From 9096e2fed809de1eaf0578163a448d50b0f39ce5 Mon Sep 17 00:00:00 2001 From: kaloz Date: Tue, 27 Oct 2009 19:18:02 +0000 Subject: [PATCH 001/288] disable ppc4xx watchdog, it's unreliable git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18186 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ppc40x/config-2.6.30 | 2 +- target/linux/ppc44x/config-default | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ppc40x/config-2.6.30 b/target/linux/ppc40x/config-2.6.30 index 39d2f39b0..5de51b042 100644 --- a/target/linux/ppc40x/config-2.6.30 +++ b/target/linux/ppc40x/config-2.6.30 @@ -24,7 +24,7 @@ CONFIG_AUDIT_ARCH=y CONFIG_BASE_SMALL=0 # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y -CONFIG_BOOKE_WDT=y +# CONFIG_BOOKE_WDT is not set CONFIG_BOUNCE=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,jffs2 noinitrd" diff --git a/target/linux/ppc44x/config-default b/target/linux/ppc44x/config-default index 2d0eb243c..c9817d567 100644 --- a/target/linux/ppc44x/config-default +++ b/target/linux/ppc44x/config-default @@ -25,7 +25,7 @@ CONFIG_AUDIT_ARCH=y CONFIG_BASE_SMALL=0 CONFIG_BITREVERSE=y CONFIG_BOOKE=y -CONFIG_BOOKE_WDT=y +# CONFIG_BOOKE_WDT is not set CONFIG_BOUNCE=y CONFIG_CANYONLANDS=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y From e0af8557d226b9199236e5a4ecc0d331e97c04f6 Mon Sep 17 00:00:00 2001 From: kaloz Date: Tue, 27 Oct 2009 19:19:07 +0000 Subject: [PATCH 002/288] remove 2.6.28 support from ppc40x git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18187 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ppc40x/config-default | 181 -------- .../001-kilauea_openwrt_flashmap.patch | 25 - .../002-disable_emac_loopback_mode.patch | 25 - .../003-powerpc-add-EBC_BXCR_BW-defines.patch | 12 - .../linux/ppc40x/patches/005-magicboxv1.patch | 313 ------------- .../linux/ppc40x/patches/006-magicboxv2.patch | 406 ---------------- .../ppc40x/patches/007-openrb-light.patch | 376 --------------- .../ppc40x/patches/008-openrb-medium.patch | 404 ---------------- .../patches/100-magicbox-ide-driver.patch | 359 -------------- .../patches/101-pata-magicbox-cf-driver.patch | 438 ------------------ 10 files changed, 2539 deletions(-) delete mode 100644 target/linux/ppc40x/config-default delete mode 100644 target/linux/ppc40x/patches/001-kilauea_openwrt_flashmap.patch delete mode 100644 target/linux/ppc40x/patches/002-disable_emac_loopback_mode.patch delete mode 100644 target/linux/ppc40x/patches/003-powerpc-add-EBC_BXCR_BW-defines.patch delete mode 100644 target/linux/ppc40x/patches/005-magicboxv1.patch delete mode 100644 target/linux/ppc40x/patches/006-magicboxv2.patch delete mode 100644 target/linux/ppc40x/patches/007-openrb-light.patch delete mode 100644 target/linux/ppc40x/patches/008-openrb-medium.patch delete mode 100644 target/linux/ppc40x/patches/100-magicbox-ide-driver.patch delete mode 100644 target/linux/ppc40x/patches/101-pata-magicbox-cf-driver.patch diff --git a/target/linux/ppc40x/config-default b/target/linux/ppc40x/config-default deleted file mode 100644 index b8ed9051b..000000000 --- a/target/linux/ppc40x/config-default +++ /dev/null @@ -1,181 +0,0 @@ -CONFIG_405EP=y -CONFIG_405EX=y -CONFIG_40x=y -# CONFIG_44x is not set -CONFIG_4xx=y -CONFIG_4xx_SOC=y -# CONFIG_6xx is not set -# CONFIG_8139TOO is not set -# CONFIG_ACADIA is not set -# CONFIG_ADVANCED_OPTIONS is not set -# CONFIG_AGP is not set -CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y -CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y -CONFIG_ARCH_HAS_ILOG2_U32=y -CONFIG_ARCH_HAS_WALK_MEMORY=y -CONFIG_ARCH_MAY_HAVE_PC_FDC=y -# CONFIG_ARCH_NO_VIRT_TO_BUS is not set -# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set -CONFIG_ARCH_POPULATES_NODE_MAP=y -CONFIG_ARCH_REQUIRE_GPIOLIB=y -CONFIG_ARCH_SUPPORTS_MSI=y -CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y -CONFIG_AUDIT_ARCH=y -CONFIG_BASE_SMALL=0 -CONFIG_BITREVERSE=y -# CONFIG_BOOKE_WDT is not set -CONFIG_BOUNCE=y -CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CLASSIC_RCU=y -CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd" -CONFIG_CMDLINE_BOOL=y -CONFIG_CONSISTENT_SIZE=0x00200000 -CONFIG_CONSISTENT_START=0xff100000 -# CONFIG_CPU_FREQ is not set -# CONFIG_DEBUG_BUGVERBOSE is not set -# CONFIG_DEFAULT_UIMAGE is not set -CONFIG_DEVPORT=y -# CONFIG_E200 is not set -CONFIG_EARLY_PRINTK=y -# CONFIG_EDAC is not set -# CONFIG_EP405 is not set -CONFIG_EXTRA_TARGETS="uImage" -CONFIG_FORCE_MAX_ZONEORDER=11 -# CONFIG_FSL_ULI1575 is not set -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_GENERIC_CMOS_UPDATE=y -CONFIG_GENERIC_FIND_NEXT_BIT=y -CONFIG_GENERIC_GPIO=y -# CONFIG_GENERIC_IOMAP is not set -CONFIG_GENERIC_NVRAM=y -# CONFIG_GENERIC_TBSYNC is not set -CONFIG_GENERIC_TIME_VSYSCALL=y -# CONFIG_GEN_RTC is not set -CONFIG_GPIOLIB=y -CONFIG_GPIO_SYSFS=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT=y -# CONFIG_HAS_RAPIDIO is not set -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_HAVE_FUNCTION_TRACER=y -# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set -CONFIG_HAVE_IDE=y -CONFIG_HAVE_IOREMAP_PROT=y -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_LATENCYTOP_SUPPORT=y -CONFIG_HAVE_LMB=y -CONFIG_HAVE_OPROFILE=y -# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set -# CONFIG_HCU4 is not set -# CONFIG_HIGHMEM is not set -CONFIG_HW_RANDOM=y -CONFIG_HZ=250 -# CONFIG_HZ_100 is not set -CONFIG_HZ_250=y -# CONFIG_I2C is not set -CONFIG_IBM_NEW_EMAC=y -# CONFIG_IBM_NEW_EMAC_DEBUG is not set -CONFIG_IBM_NEW_EMAC_EMAC4=y -CONFIG_IBM_NEW_EMAC_POLL_WEIGHT=32 -CONFIG_IBM_NEW_EMAC_RGMII=y -CONFIG_IBM_NEW_EMAC_RXB=256 -CONFIG_IBM_NEW_EMAC_RX_COPY_THRESHOLD=256 -CONFIG_IBM_NEW_EMAC_RX_SKB_HEADROOM=0 -CONFIG_IBM_NEW_EMAC_TXB=256 -# CONFIG_IDE is not set -CONFIG_INITRAMFS_SOURCE="" -# CONFIG_IOMMU_HELPER is not set -# CONFIG_IPIC is not set -# CONFIG_IRQSTACKS is not set -CONFIG_IRQ_PER_CPU=y -CONFIG_ISA_DMA_API=y -CONFIG_KERNEL_START=0xc0000000 -CONFIG_KILAUEA=y -# CONFIG_LEDS_GPIO is not set -CONFIG_LOWMEM_SIZE=0x30000000 -# CONFIG_MACINTOSH_DRIVERS is not set -CONFIG_MAGICBOXV1=y -CONFIG_MAGICBOXV2=y -# CONFIG_MAKALU is not set -# CONFIG_MATH_EMULATION is not set -# CONFIG_MMIO_NVRAM is not set -# CONFIG_MPIC is not set -# CONFIG_MPIC_WEIRD is not set -CONFIG_MTD_CFI_ADV_OPTIONS=y -# CONFIG_MTD_CFI_GEOMETRY is not set -# CONFIG_MTD_CFI_INTELEXT is not set -CONFIG_MTD_OF_PARTS=y -CONFIG_MTD_PHYSMAP_OF=y -# CONFIG_NATSEMI is not set -CONFIG_NOT_COHERENT_CACHE=y -# CONFIG_NVRAM is not set -CONFIG_OF=y -CONFIG_OF_DEVICE=y -CONFIG_OF_GPIO=y -CONFIG_OPENRB_LIGHT=y -CONFIG_OPENRB_MEDIUM=y -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PAGE_OFFSET=0xc0000000 -CONFIG_PCI=y -CONFIG_PCIEAER=y -# CONFIG_PCIEASPM is not set -CONFIG_PCIEPORTBUS=y -CONFIG_PCI_DISABLE_COMMON_QUIRKS=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_MSI=y -CONFIG_PCI_SYSCALL=y -CONFIG_PHYSICAL_START=0x00000000 -CONFIG_PPC=y -CONFIG_PPC32=y -CONFIG_PPC40x_SIMPLE=y -CONFIG_PPC4xx_PCI_EXPRESS=y -# CONFIG_PPC64 is not set -# CONFIG_PPC_85xx is not set -# CONFIG_PPC_8xx is not set -# CONFIG_PPC_970_NAP is not set -# CONFIG_PPC_CELL is not set -# CONFIG_PPC_CELL_NATIVE is not set -# CONFIG_PPC_CLOCK is not set -CONFIG_PPC_DCR=y -# CONFIG_PPC_DCR_MMIO is not set -CONFIG_PPC_DCR_NATIVE=y -# CONFIG_PPC_EARLY_DEBUG is not set -# CONFIG_PPC_I8259 is not set -# CONFIG_PPC_INDIRECT_IO is not set -CONFIG_PPC_INDIRECT_PCI=y -# CONFIG_PPC_MM_SLICES is not set -# CONFIG_PPC_MPC106 is not set -CONFIG_PPC_OF=y -CONFIG_PPC_PCI_CHOICE=y -# CONFIG_PPC_RTAS is not set -CONFIG_PPC_UDBG_16550=y -# CONFIG_PQ2ADS is not set -CONFIG_PROC_DEVICETREE=y -# CONFIG_R6040 is not set -CONFIG_RESOURCES_64BIT=y -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_SCHED_HRTICK=y -CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y -# CONFIG_SCSI_DMA is not set -# CONFIG_SERIAL_8250_DETECT_IRQ is not set -CONFIG_SERIAL_8250_EXTENDED=y -# CONFIG_SERIAL_8250_MANY_PORTS is not set -# CONFIG_SERIAL_8250_RSA is not set -CONFIG_SERIAL_8250_SHARE_IRQ=y -CONFIG_SERIAL_OF_PLATFORM=y -# CONFIG_SLAB is not set -CONFIG_SLUB=y -CONFIG_TASK_SIZE=0xc0000000 -CONFIG_TICK_ONESHOT=y -# CONFIG_VGASTATE is not set -# CONFIG_VIA_RHINE is not set -# CONFIG_WALNUT is not set -CONFIG_WORD_SIZE=32 -# CONFIG_XILINX_SYSACE is not set -# CONFIG_XILINX_VIRTEX_GENERIC_BOARD is not set diff --git a/target/linux/ppc40x/patches/001-kilauea_openwrt_flashmap.patch b/target/linux/ppc40x/patches/001-kilauea_openwrt_flashmap.patch deleted file mode 100644 index 44799cb32..000000000 --- a/target/linux/ppc40x/patches/001-kilauea_openwrt_flashmap.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/arch/powerpc/boot/dts/kilauea.dts -+++ b/arch/powerpc/boot/dts/kilauea.dts -@@ -140,15 +140,15 @@ - #size-cells = <1>; - partition@0 { - label = "kernel"; -- reg = <0x00000000 0x00200000>; -+ reg = <0x00000000 0x001e0000>; - }; -- partition@200000 { -- label = "root"; -- reg = <0x00200000 0x00200000>; -+ partition@1e0000 { -+ label = "device-tree"; -+ reg = <0x001e0000 0x0020000>; - }; -- partition@400000 { -- label = "user"; -- reg = <0x00400000 0x03b60000>; -+ partition@200000 { -+ label = "rootfs"; -+ reg = <0x00200000 0x03d60000>; - }; - partition@3f60000 { - label = "env"; diff --git a/target/linux/ppc40x/patches/002-disable_emac_loopback_mode.patch b/target/linux/ppc40x/patches/002-disable_emac_loopback_mode.patch deleted file mode 100644 index 18fefd872..000000000 --- a/target/linux/ppc40x/patches/002-disable_emac_loopback_mode.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/arch/powerpc/platforms/40x/kilauea.c -+++ b/arch/powerpc/platforms/40x/kilauea.c -@@ -21,6 +21,8 @@ - #include - #include - #include -+#include -+#include - - static __initdata struct of_device_id kilauea_of_bus[] = { - { .compatible = "ibm,plb4", }, -@@ -46,6 +48,13 @@ static int __init kilauea_probe(void) - - ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC; - -+ /* -+ * 405EX(r) has SDR0_MFR[E0CS/E1CS] set after reset. This selects -+ * the internal loopback mode. Clear these bits so that both EMACs -+ * don't use loopback mode as deafult. -+ */ -+ mtdcri(SDR0, SDR0_MFR, mfdcri(SDR0, SDR0_MFR) & ~0x0c000000); -+ - return 1; - } - diff --git a/target/linux/ppc40x/patches/003-powerpc-add-EBC_BXCR_BW-defines.patch b/target/linux/ppc40x/patches/003-powerpc-add-EBC_BXCR_BW-defines.patch deleted file mode 100644 index 8e380c1c9..000000000 --- a/target/linux/ppc40x/patches/003-powerpc-add-EBC_BXCR_BW-defines.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/arch/powerpc/boot/dcr.h -+++ b/arch/powerpc/boot/dcr.h -@@ -57,6 +57,9 @@ static const unsigned long sdram_bxcr[] - #define EBC_BXCR_BU_WO 0x00010000 - #define EBC_BXCR_BU_RW 0x00018000 - #define EBC_BXCR_BW 0x00006000 -+#define EBC_BXCR_BW_8 0x00000000 -+#define EBC_BXCR_BW_16 0x00002000 -+#define EBC_BXCR_BW_32 0x00006000 - #define EBC_B0AP 0x10 - #define EBC_B1AP 0x11 - #define EBC_B2AP 0x12 diff --git a/target/linux/ppc40x/patches/005-magicboxv1.patch b/target/linux/ppc40x/patches/005-magicboxv1.patch deleted file mode 100644 index 7c2abd38c..000000000 --- a/target/linux/ppc40x/patches/005-magicboxv1.patch +++ /dev/null @@ -1,313 +0,0 @@ ---- /dev/null -+++ b/arch/powerpc/boot/cuboot-magicboxv1.c -@@ -0,0 +1,40 @@ -+/* -+ * Old U-boot compatibility for Magicbox v1 -+ * -+ * Author: Imre Kaloz -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ */ -+ -+#include "ops.h" -+#include "io.h" -+#include "dcr.h" -+#include "stdio.h" -+#include "4xx.h" -+#include "44x.h" -+#include "cuboot.h" -+ -+#define TARGET_4xx -+#define TARGET_405EP -+#include "ppcboot.h" -+ -+static bd_t bd; -+ -+static void magicboxv1_fixups(void) -+{ -+ ibm405ep_fixup_clocks(25000000); -+ ibm4xx_sdram_fixup_memsize(); -+ dt_fixup_mac_addresses(&bd.bi_enetaddr); -+} -+ -+void platform_init(unsigned long r3, unsigned long r4, unsigned long r5, -+ unsigned long r6, unsigned long r7) -+{ -+ CUBOOT_INIT(); -+ platform_ops.fixups = magicboxv1_fixups; -+ platform_ops.exit = ibm40x_dbcr_reset; -+ fdt_init(_dtb_start); -+ serial_console_init(); -+} ---- /dev/null -+++ b/arch/powerpc/boot/dts/magicboxv1.dts -@@ -0,0 +1,217 @@ -+/* -+ * Device Tree Source for Magicbox v1 -+ * -+ * Copyright 2008 Imre Kaloz -+ * -+ * Based on walnut.dts -+ * -+ * This file is licensed under the terms of the GNU General Public -+ * License version 2. This program is licensed "as is" without -+ * any warranty of any kind, whether express or implied. -+ */ -+ -+/dts-v1/; -+ -+/ { -+ #address-cells = <1>; -+ #size-cells = <1>; -+ model = "magicboxv1"; -+ compatible = "magicboxv1"; -+ dcr-parent = <&{/cpus/cpu@0}>; -+ -+ aliases { -+ ethernet0 = &EMAC; -+ serial0 = &UART; -+ }; -+ -+ cpus { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ cpu@0 { -+ device_type = "cpu"; -+ model = "PowerPC,405EP"; -+ reg = <0x00000000>; -+ clock-frequency = <0xbebc200>; /* Filled in by zImage */ -+ timebase-frequency = <0>; /* Filled in by zImage */ -+ i-cache-line-size = <20>; -+ d-cache-line-size = <20>; -+ i-cache-size = <4000>; -+ d-cache-size = <4000>; -+ dcr-controller; -+ dcr-access-method = "native"; -+ }; -+ }; -+ -+ memory { -+ device_type = "memory"; -+ reg = <0x00000000 0x00000000>; /* Filled in by zImage */ -+ }; -+ -+ UIC0: interrupt-controller { -+ compatible = "ibm,uic"; -+ interrupt-controller; -+ cell-index = <0>; -+ dcr-reg = <0x0c0 0x009>; -+ #address-cells = <0>; -+ #size-cells = <0>; -+ #interrupt-cells = <2>; -+ }; -+ -+ plb { -+ compatible = "ibm,plb3"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ -+ SDRAM0: memory-controller { -+ compatible = "ibm,sdram-405ep"; -+ dcr-reg = <0x010 0x002>; -+ }; -+ -+ MAL: mcmal { -+ compatible = "ibm,mcmal-405ep", "ibm,mcmal"; -+ dcr-reg = <0x180 0x062>; -+ num-tx-chans = <4>; -+ num-rx-chans = <2>; -+ interrupt-parent = <&UIC0>; -+ interrupts = < -+ 0xb 0x4 /* TXEOB */ -+ 0xc 0x4 /* RXEOB */ -+ 0xa 0x4 /* SERR */ -+ 0xd 0x4 /* TXDE */ -+ 0xe 0x4 /* RXDE */>; -+ }; -+ -+ POB0: opb { -+ compatible = "ibm,opb-405ep", "ibm,opb"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges = <0xef600000 0xef600000 0x00a00000>; -+ dcr-reg = <0x0a0 0x005>; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ -+ UART: serial@ef600300 { -+ device_type = "serial"; -+ compatible = "ns16550"; -+ reg = <0xef600300 0x00000008>; -+ virtual-reg = <0xef600300>; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ current-speed = <115200>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x0 0x4>; -+ }; -+ -+ IIC: i2c@ef600500 { -+ compatible = "ibm,iic-405ep", "ibm,iic"; -+ reg = <0xef600500 0x00000011>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x2 0x4>; -+ }; -+ -+ GPIO: gpio@ef600700 { -+ compatible = "ibm,gpio-405ep"; -+ reg = <0xef600700 0x00000020>; -+ }; -+ -+ EMAC: ethernet@ef600800 { -+ linux,network-index = <0x0>; -+ device_type = "network"; -+ compatible = "ibm,emac-405ep", "ibm,emac"; -+ interrupt-parent = <&UIC0>; -+ interrupts = < -+ 0xf 0x4 /* Ethernet */ -+ 0x9 0x4 /* Ethernet Wake Up */>; -+ local-mac-address = [000000000000]; /* Filled in by zImage */ -+ reg = <0xef600800 0x00000070>; -+ mal-device = <&MAL>; -+ mal-tx-channel = <0>; -+ mal-rx-channel = <0>; -+ cell-index = <0>; -+ max-frame-size = <0x5dc>; -+ rx-fifo-size = <0x1000>; -+ tx-fifo-size = <0x800>; -+ phy-mode = "mii"; -+ phy-map = <0x00000000>; -+ }; -+ -+ }; -+ -+ EBC0: ebc { -+ compatible = "ibm,ebc-405ep", "ibm,ebc"; -+ dcr-reg = <0x012 0x002>; -+ #address-cells = <2>; -+ #size-cells = <1>; -+ /* The ranges property is supplied by the bootwrapper -+ * and is based on the firmware's configuration of the -+ * EBC bridge -+ */ -+ clock-frequency = <0>; /* Filled in by zImage */ -+ -+ nor_flash@ffc00000 { -+ compatible = "cfi-flash"; -+ bank-width = <2>; -+ reg = <0x00000000 0xffc00000 0x00400000>; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ partition@0 { -+ label = "linux"; -+ reg = <0x0 0x120000>; -+ }; -+ partition@120000 { -+ label = "rootfs"; -+ reg = <0x120000 0x2a0000>; -+ }; -+ partition@3c0000 { -+ label = "u-boot"; -+ reg = <0x3c0000 0x30000>; -+ read-only; -+ }; -+ }; -+ }; -+ -+ PCI0: pci@ec000000 { -+ device_type = "pci"; -+ #interrupt-cells = <1>; -+ #size-cells = <2>; -+ #address-cells = <3>; -+ compatible = "ibm,plb405ep-pci", "ibm,plb-pci"; -+ primary; -+ reg = <0xeec00000 0x00000008 /* Config space access */ -+ 0xeed80000 0x00000004 /* IACK */ -+ 0xeed80000 0x00000004 /* Special cycle */ -+ 0xef480000 0x00000040>; /* Internal registers */ -+ -+ /* Outbound ranges, one memory and one IO, -+ * later cannot be changed. Chip supports a second -+ * IO range but we don't use it for now -+ */ -+ ranges = <0x02000000 0x00000000 0x80000000 0x80000000 0x00000000 0x20000000 -+ 0x01000000 0x00000000 0x00000000 0xe8000000 0x00000000 0x00010000>; -+ -+ /* Inbound 2GB range starting at 0 */ -+ dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x80000000>; -+ -+ /* Magicbox v1 has all 4 IRQ pins tied together per slot */ -+ interrupt-map-mask = <0xf800 0x0 0x0 0x0>; -+ interrupt-map = < -+ /* IDSEL 1 */ -+ 0x800 0x0 0x0 0x0 &UIC0 0x1c 0x8 -+ -+ /* IDSEL 2 */ -+ 0x1000 0x0 0x0 0x0 &UIC0 0x1d 0x8 -+ -+ /* IDSEL 3 */ -+ 0x1800 0x0 0x0 0x0 &UIC0 0x1e 0x8 -+ -+ /* IDSEL 4 */ -+ 0x2000 0x0 0x0 0x0 &UIC0 0x1f 0x8 -+ >; -+ }; -+ }; -+ -+ chosen { -+ linux,stdout-path = "/plb/opb/serial@ef600300"; -+ }; -+}; ---- a/arch/powerpc/boot/Makefile -+++ b/arch/powerpc/boot/Makefile -@@ -70,7 +70,7 @@ src-plat := of.c cuboot-52xx.c cuboot-82 - cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \ - cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \ - virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \ -- cuboot-acadia.c -+ cuboot-acadia.c cuboot-magicboxv1.c - src-boot := $(src-wlib) $(src-plat) empty.c - - src-boot := $(addprefix $(obj)/, $(src-boot)) -@@ -214,6 +214,7 @@ image-$(CONFIG_DEFAULT_UIMAGE) += uImag - image-$(CONFIG_EP405) += dtbImage.ep405 - image-$(CONFIG_WALNUT) += treeImage.walnut - image-$(CONFIG_ACADIA) += cuImage.acadia -+image-$(CONFIG_MAGICBOXV1) += cuImage.magicboxv1 - - # Board ports in arch/powerpc/platform/44x/Kconfig - image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony ---- a/arch/powerpc/platforms/40x/Kconfig -+++ b/arch/powerpc/platforms/40x/Kconfig -@@ -49,6 +49,16 @@ config KILAUEA - help - This option enables support for the AMCC PPC405EX evaluation board. - -+config MAGICBOXV1 -+ bool "Magicbox v1" -+ depends on 40x -+ default n -+ select PPC40x_SIMPLE -+ select 405EP -+ select PCI -+ help -+ This option enables support for the Magicbox v1 board. -+ - config MAKALU - bool "Makalu" - depends on 40x ---- a/arch/powerpc/platforms/40x/ppc40x_simple.c -+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c -@@ -51,7 +51,8 @@ machine_device_initcall(ppc40x_simple, p - * board.c file for it rather than adding it to this list. - */ - static char *board[] __initdata = { -- "amcc,acadia" -+ "amcc,acadia", -+ "magicboxv1" - }; - - static int __init ppc40x_probe(void) diff --git a/target/linux/ppc40x/patches/006-magicboxv2.patch b/target/linux/ppc40x/patches/006-magicboxv2.patch deleted file mode 100644 index 0d7146471..000000000 --- a/target/linux/ppc40x/patches/006-magicboxv2.patch +++ /dev/null @@ -1,406 +0,0 @@ ---- /dev/null -+++ b/arch/powerpc/boot/cuboot-magicboxv2.c -@@ -0,0 +1,69 @@ -+/* -+ * Old U-boot compatibility for Magicbox v2 -+ * -+ * Author: Imre Kaloz -+ * Gabor Juhos -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ */ -+ -+#include "ops.h" -+#include "io.h" -+#include "dcr.h" -+#include "stdio.h" -+#include "4xx.h" -+#include "44x.h" -+#include "cuboot.h" -+ -+#define TARGET_4xx -+#define TARGET_405EP -+#include "ppcboot.h" -+ -+static bd_t bd; -+ -+static void fixup_cf_card(void) -+{ -+#define DCRN_CPC0_PCI_BASE 0xf9 -+#define CF_CS0_BASE 0xff100000 -+#define CF_CS1_BASE 0xff200000 -+ -+ /* Turn on PerWE instead of PCIsomething */ -+ mtdcr(DCRN_CPC0_PCI_BASE, -+ mfdcr(DCRN_CPC0_PCI_BASE) | (0x80000000L >> 27)); -+ -+ /* PerCS1 (CF's CS0): base 0xff100000, 16-bit, rw */ -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1CR); -+ mtdcr(DCRN_EBC0_CFGDATA, CF_CS0_BASE | EBC_BXCR_BU_RW | EBC_BXCR_BW_16); -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1AP); -+ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800); -+ -+ /* PerCS2 (CF's CS1): base 0xff200000, 16-bit, rw */ -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2CR); -+ mtdcr(DCRN_EBC0_CFGDATA, CF_CS1_BASE | EBC_BXCR_BU_RW | EBC_BXCR_BW_16); -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2AP); -+ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800); -+ -+#undef DCRN_CPC0_PCI_BASE -+#undef CF_CS0_BASE -+#undef CF_CS1_BASE -+} -+ -+static void magicboxv2_fixups(void) -+{ -+ fixup_cf_card(); -+ ibm405ep_fixup_clocks(25000000); -+ ibm4xx_sdram_fixup_memsize(); -+ dt_fixup_mac_addresses(&bd.bi_enetaddr, &bd.bi_enet1addr); -+} -+ -+void platform_init(unsigned long r3, unsigned long r4, unsigned long r5, -+ unsigned long r6, unsigned long r7) -+{ -+ CUBOOT_INIT(); -+ platform_ops.fixups = magicboxv2_fixups; -+ platform_ops.exit = ibm40x_dbcr_reset; -+ fdt_init(_dtb_start); -+ serial_console_init(); -+} ---- /dev/null -+++ b/arch/powerpc/boot/dts/magicboxv2.dts -@@ -0,0 +1,281 @@ -+/* -+ * Device Tree Source for Magicbox v2 -+ * -+ * Copyright 2008 Imre Kaloz -+ * Copyright 2009 Gabor Juhos -+ * -+ * Based on walnut.dts -+ * -+ * This file is licensed under the terms of the GNU General Public -+ * License version 2. This program is licensed "as is" without -+ * any warranty of any kind, whether express or implied. -+ */ -+ -+/dts-v1/; -+ -+/ { -+ #address-cells = <1>; -+ #size-cells = <1>; -+ model = "magicboxv2"; -+ compatible = "magicboxv2"; -+ dcr-parent = <&{/cpus/cpu@0}>; -+ -+ aliases { -+ ethernet0 = &EMAC0; -+ ethernet1 = &EMAC1; -+ serial0 = &UART0; -+ serial1 = &UART1; -+ }; -+ -+ cpus { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ cpu@0 { -+ device_type = "cpu"; -+ model = "PowerPC,405EP"; -+ reg = <0x00000000>; -+ clock-frequency = <0xbebc200>; /* Filled in by zImage */ -+ timebase-frequency = <0>; /* Filled in by zImage */ -+ i-cache-line-size = <20>; -+ d-cache-line-size = <20>; -+ i-cache-size = <4000>; -+ d-cache-size = <4000>; -+ dcr-controller; -+ dcr-access-method = "native"; -+ }; -+ }; -+ -+ memory { -+ device_type = "memory"; -+ reg = <0x00000000 0x00000000>; /* Filled in by zImage */ -+ }; -+ -+ UIC0: interrupt-controller { -+ compatible = "ibm,uic"; -+ interrupt-controller; -+ cell-index = <0>; -+ dcr-reg = <0x0c0 0x009>; -+ #address-cells = <0>; -+ #size-cells = <0>; -+ #interrupt-cells = <2>; -+ }; -+ -+ plb { -+ compatible = "ibm,plb3"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ -+ SDRAM0: memory-controller { -+ compatible = "ibm,sdram-405ep"; -+ dcr-reg = <0x010 0x002>; -+ }; -+ -+ MAL: mcmal { -+ compatible = "ibm,mcmal-405ep", "ibm,mcmal"; -+ dcr-reg = <0x180 0x062>; -+ num-tx-chans = <4>; -+ num-rx-chans = <2>; -+ interrupt-parent = <&UIC0>; -+ interrupts = < -+ 0xb 0x4 /* TXEOB */ -+ 0xc 0x4 /* RXEOB */ -+ 0xa 0x4 /* SERR */ -+ 0xd 0x4 /* TXDE */ -+ 0xe 0x4 /* RXDE */>; -+ }; -+ -+ POB0: opb { -+ compatible = "ibm,opb-405ep", "ibm,opb"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges = <0xef600000 0xef600000 0x00a00000>; -+ dcr-reg = <0x0a0 0x005>; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ -+ UART0: serial@ef600300 { -+ device_type = "serial"; -+ compatible = "ns16550"; -+ reg = <0xef600300 0x00000008>; -+ virtual-reg = <0xef600300>; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ current-speed = <115200>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x0 0x4>; -+ }; -+ -+ UART1: serial@ef600400 { -+ device_type = "serial"; -+ compatible = "ns16550"; -+ reg = <0xef600400 0x00000008>; -+ virtual-reg = <0xef600400>; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ current-speed = <115200>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x1 0x4>; -+ }; -+ -+ IIC: i2c@ef600500 { -+ compatible = "ibm,iic-405ep", "ibm,iic"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <0xef600500 0x00000011>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x2 0x4>; -+ -+ dtt@48 { -+ compatible = "national,lm75"; -+ reg = <0x48>; -+ }; -+ -+ eeprom@50 { -+ compatible = "at24,24c16"; -+ reg = <0x50>; -+ }; -+ }; -+ -+ GPIO0: gpio-controller@ef600700 { -+ compatible = "ibm,ppc4xx-gpio"; -+ reg = <0xef600700 0x00000020>; -+ #gpio-cells = <2>; -+ gpio-controller; -+ }; -+ -+ EMAC0: ethernet@ef600800 { -+ linux,network-index = <0x0>; -+ device_type = "network"; -+ compatible = "ibm,emac-405ep", "ibm,emac"; -+ interrupt-parent = <&UIC0>; -+ interrupts = < -+ 0xf 0x4 /* Ethernet */ -+ 0x9 0x4 /* Ethernet Wake Up */>; -+ local-mac-address = [000000000000]; /* Filled in by zImage */ -+ reg = <0xef600800 0x00000070>; -+ mal-device = <&MAL>; -+ mal-tx-channel = <0>; -+ mal-rx-channel = <0>; -+ cell-index = <0>; -+ max-frame-size = <0x5dc>; -+ rx-fifo-size = <0x1000>; -+ tx-fifo-size = <0x800>; -+ phy-mode = "mii"; -+ phy-map = <0x00000000>; -+ }; -+ -+ EMAC1: ethernet@ef600900 { -+ linux,network-index = <0x1>; -+ device_type = "network"; -+ compatible = "ibm,emac-405ep", "ibm,emac"; -+ interrupt-parent = <&UIC0>; -+ interrupts = < -+ 0x11 0x4 /* Ethernet */ -+ 0x09 0x4 /* Ethernet Wake Up */>; -+ local-mac-address = [000000000000]; /* Filled in by zImage */ -+ reg = <0xef600900 0x00000070>; -+ mal-device = <&MAL>; -+ mal-tx-channel = <2>; -+ mal-rx-channel = <1>; -+ cell-index = <1>; -+ max-frame-size = <0x5dc>; -+ rx-fifo-size = <0x1000>; -+ tx-fifo-size = <0x800>; -+ mdio-device = <&EMAC0>; -+ phy-mode = "mii"; -+ phy-map = <0x00000001>; -+ }; -+ -+ leds { -+ compatible = "gpio-leds"; -+ user { -+ label = "magicbox:red:user"; -+ gpios = <&GPIO0 2 1>; -+ }; -+ }; -+ }; -+ -+ EBC0: ebc { -+ compatible = "ibm,ebc-405ep", "ibm,ebc"; -+ dcr-reg = <0x012 0x002>; -+ #address-cells = <2>; -+ #size-cells = <1>; -+ /* The ranges property is supplied by the bootwrapper -+ * and is based on the firmware's configuration of the -+ * EBC bridge -+ */ -+ clock-frequency = <0>; /* Filled in by zImage */ -+ -+ cf_card@ff100000 { -+ compatible = "magicbox-cf", "pata-magicbox-cf"; -+ reg = <0x00000000 0xff100000 0x00001000 -+ 0x00000000 0xff200000 0x00001000>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x19 0x1 /* IRQ_TYPE_EDGE_RISING */ >; -+ }; -+ -+ nor_flash@ffc00000 { -+ compatible = "cfi-flash"; -+ bank-width = <2>; -+ reg = <0x00000000 0xffc00000 0x00400000>; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ partition@0 { -+ label = "linux"; -+ reg = <0x0 0x120000>; -+ }; -+ partition@120000 { -+ label = "rootfs"; -+ reg = <0x120000 0x2a0000>; -+ }; -+ partition@3c0000 { -+ label = "u-boot"; -+ reg = <0x3c0000 0x30000>; -+ read-only; -+ }; -+ }; -+ }; -+ -+ PCI0: pci@ec000000 { -+ device_type = "pci"; -+ #interrupt-cells = <1>; -+ #size-cells = <2>; -+ #address-cells = <3>; -+ compatible = "ibm,plb405ep-pci", "ibm,plb-pci"; -+ primary; -+ reg = <0xeec00000 0x00000008 /* Config space access */ -+ 0xeed80000 0x00000004 /* IACK */ -+ 0xeed80000 0x00000004 /* Special cycle */ -+ 0xef480000 0x00000040>; /* Internal registers */ -+ -+ /* Outbound ranges, one memory and one IO, -+ * later cannot be changed. Chip supports a second -+ * IO range but we don't use it for now -+ */ -+ ranges = <0x02000000 0x00000000 0x80000000 0x80000000 0x00000000 0x20000000 -+ 0x01000000 0x00000000 0x00000000 0xe8000000 0x00000000 0x00010000>; -+ -+ /* Inbound 2GB range starting at 0 */ -+ dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x80000000>; -+ -+ interrupt-map-mask = <0xf800 0x0 0x0 0x0>; -+ interrupt-map = < -+ /* IDSEL 1 */ -+ 0x800 0x0 0x0 0x0 &UIC0 0x1c 0x8 -+ -+ /* IDSEL 2 */ -+ 0x1000 0x0 0x0 0x0 &UIC0 0x1d 0x8 -+ -+ /* IDSEL 3 */ -+ 0x1800 0x0 0x0 0x0 &UIC0 0x1e 0x8 -+ -+ /* IDSEL 4 */ -+ 0x2000 0x0 0x0 0x0 &UIC0 0x1f 0x8 -+ >; -+ }; -+ }; -+ -+ chosen { -+ linux,stdout-path = "/plb/opb/serial@ef600300"; -+ }; -+}; ---- a/arch/powerpc/boot/Makefile -+++ b/arch/powerpc/boot/Makefile -@@ -70,7 +70,7 @@ src-plat := of.c cuboot-52xx.c cuboot-82 - cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \ - cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \ - virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \ -- cuboot-acadia.c cuboot-magicboxv1.c -+ cuboot-acadia.c cuboot-magicboxv1.c cuboot-magicboxv2.c - src-boot := $(src-wlib) $(src-plat) empty.c - - src-boot := $(addprefix $(obj)/, $(src-boot)) -@@ -215,6 +215,7 @@ image-$(CONFIG_EP405) += dtbImage.ep40 - image-$(CONFIG_WALNUT) += treeImage.walnut - image-$(CONFIG_ACADIA) += cuImage.acadia - image-$(CONFIG_MAGICBOXV1) += cuImage.magicboxv1 -+image-$(CONFIG_MAGICBOXV2) += cuImage.magicboxv2 - - # Board ports in arch/powerpc/platform/44x/Kconfig - image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony ---- a/arch/powerpc/platforms/40x/Kconfig -+++ b/arch/powerpc/platforms/40x/Kconfig -@@ -59,6 +59,16 @@ config MAGICBOXV1 - help - This option enables support for the Magicbox v1 board. - -+config MAGICBOXV2 -+ bool "Magicbox v2" -+ depends on 40x -+ default n -+ select PPC40x_SIMPLE -+ select 405EP -+ select PCI -+ help -+ This option enables support for the Magicbox v2 board. -+ - config MAKALU - bool "Makalu" - depends on 40x ---- a/arch/powerpc/platforms/40x/ppc40x_simple.c -+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c -@@ -52,7 +52,8 @@ machine_device_initcall(ppc40x_simple, p - */ - static char *board[] __initdata = { - "amcc,acadia", -- "magicboxv1" -+ "magicboxv1", -+ "magicboxv2", - }; - - static int __init ppc40x_probe(void) diff --git a/target/linux/ppc40x/patches/007-openrb-light.patch b/target/linux/ppc40x/patches/007-openrb-light.patch deleted file mode 100644 index 0d4f5e57a..000000000 --- a/target/linux/ppc40x/patches/007-openrb-light.patch +++ /dev/null @@ -1,376 +0,0 @@ ---- a/arch/powerpc/boot/Makefile -+++ b/arch/powerpc/boot/Makefile -@@ -70,7 +70,8 @@ src-plat := of.c cuboot-52xx.c cuboot-82 - cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \ - cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \ - virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \ -- cuboot-acadia.c cuboot-magicboxv1.c cuboot-magicboxv2.c -+ cuboot-acadia.c cuboot-magicboxv1.c cuboot-magicboxv2.c \ -+ cuboot-openrb-light.c - src-boot := $(src-wlib) $(src-plat) empty.c - - src-boot := $(addprefix $(obj)/, $(src-boot)) -@@ -216,6 +217,7 @@ image-$(CONFIG_WALNUT) += treeImage.wa - image-$(CONFIG_ACADIA) += cuImage.acadia - image-$(CONFIG_MAGICBOXV1) += cuImage.magicboxv1 - image-$(CONFIG_MAGICBOXV2) += cuImage.magicboxv2 -+image-$(CONFIG_OPENRB_LIGHT) += cuImage.openrb-light - - # Board ports in arch/powerpc/platform/44x/Kconfig - image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony ---- a/arch/powerpc/platforms/40x/Kconfig -+++ b/arch/powerpc/platforms/40x/Kconfig -@@ -79,6 +79,16 @@ config MAKALU - help - This option enables support for the AMCC PPC405EX board. - -+config OPENRB_LIGHT -+ bool "OpenRB Light" -+ depends on 40x -+ default n -+ select PPC40x_SIMPLE -+ select 405EP -+ select PCI -+ help -+ This option enables support for the OpenRB Light board. -+ - #config REDWOOD_5 - # bool "Redwood-5" - # depends on 40x ---- a/arch/powerpc/platforms/40x/ppc40x_simple.c -+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c -@@ -54,6 +54,7 @@ static char *board[] __initdata = { - "amcc,acadia", - "magicboxv1", - "magicboxv2", -+ "openrb,light", - }; - - static int __init ppc40x_probe(void) ---- /dev/null -+++ b/arch/powerpc/boot/cuboot-openrb-light.c -@@ -0,0 +1,69 @@ -+/* -+ * Old U-boot compatibility for OpenRB Light board -+ * -+ * Author: Gabor Juhos -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ */ -+ -+#include "ops.h" -+#include "io.h" -+#include "dcr.h" -+#include "stdio.h" -+#include "4xx.h" -+#include "44x.h" -+#include "cuboot.h" -+ -+#define TARGET_4xx -+#define TARGET_405EP -+#include "ppcboot.h" -+ -+static bd_t bd; -+ -+static void fixup_cf_card(void) -+{ -+#define DCRN_CPC0_PCI_BASE 0xf9 -+#define CF_CS0_BASE 0xff100000 -+#define CF_CS1_BASE 0xff200000 -+ -+ /* Turn on PerWE instead of PCIsomething */ -+ mtdcr(DCRN_CPC0_PCI_BASE, -+ mfdcr(DCRN_CPC0_PCI_BASE) | (0x80000000L >> 27)); -+ -+ /* PerCS1 (CF's CS0): base 0xff100000, 16-bit, rw */ -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1CR); -+ mtdcr(DCRN_EBC0_CFGDATA, CF_CS0_BASE | EBC_BXCR_BU_RW | EBC_BXCR_BW_16); -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1AP); -+ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800); -+ -+ /* PerCS2 (CF's CS1): base 0xff200000, 16-bit, rw */ -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2CR); -+ mtdcr(DCRN_EBC0_CFGDATA, CF_CS1_BASE | EBC_BXCR_BU_RW | EBC_BXCR_BW_16); -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2AP); -+ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800); -+ -+#undef DCRN_CPC0_PCI_BASE -+#undef CF_CS0_BASE -+#undef CF_CS1_BASE -+} -+ -+static void openrb_light_fixups(void) -+{ -+ fixup_cf_card(); -+ ibm405ep_fixup_clocks(33333000); -+ ibm4xx_sdram_fixup_memsize(); -+ dt_fixup_mac_addresses(&bd.bi_enetaddr, &bd.bi_enet1addr); -+} -+ -+void platform_init(unsigned long r3, unsigned long r4, unsigned long r5, -+ unsigned long r6, unsigned long r7) -+{ -+ CUBOOT_INIT(); -+ platform_ops.fixups = openrb_light_fixups; -+ platform_ops.exit = ibm40x_dbcr_reset; -+ fdt_init(_dtb_start); -+ serial_console_init(); -+} -+ ---- /dev/null -+++ b/arch/powerpc/boot/dts/openrb-light.dts -@@ -0,0 +1,252 @@ -+/* -+ * Device Tree Source for OpenRB Light board -+ * -+ * Copyright 2009 Gabor Juhos -+ * -+ * Based on magicboxv2.dts -+ * -+ * This file is licensed under the terms of the GNU General Public -+ * License version 2. This program is licensed "as is" without -+ * any warranty of any kind, whether express or implied. -+ */ -+ -+/dts-v1/; -+ -+/ { -+ #address-cells = <1>; -+ #size-cells = <1>; -+ model = "openrb,light"; -+ compatible = "openrb,light"; -+ dcr-parent = <&{/cpus/cpu@0}>; -+ -+ aliases { -+ ethernet0 = &EMAC0; -+ serial0 = &UART0; -+ serial1 = &UART1; -+ }; -+ -+ cpus { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ cpu@0 { -+ device_type = "cpu"; -+ model = "PowerPC,405EP"; -+ reg = <0x00000000>; -+ clock-frequency = <0xbebc200>; /* Filled in by zImage */ -+ timebase-frequency = <0>; /* Filled in by zImage */ -+ i-cache-line-size = <20>; -+ d-cache-line-size = <20>; -+ i-cache-size = <4000>; -+ d-cache-size = <4000>; -+ dcr-controller; -+ dcr-access-method = "native"; -+ }; -+ }; -+ -+ memory { -+ device_type = "memory"; -+ reg = <0x00000000 0x00000000>; /* Filled in by zImage */ -+ }; -+ -+ UIC0: interrupt-controller { -+ compatible = "ibm,uic"; -+ interrupt-controller; -+ cell-index = <0>; -+ dcr-reg = <0x0c0 0x009>; -+ #address-cells = <0>; -+ #size-cells = <0>; -+ #interrupt-cells = <2>; -+ }; -+ -+ plb { -+ compatible = "ibm,plb3"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ -+ SDRAM0: memory-controller { -+ compatible = "ibm,sdram-405ep"; -+ dcr-reg = <0x010 0x002>; -+ }; -+ -+ MAL: mcmal { -+ compatible = "ibm,mcmal-405ep", "ibm,mcmal"; -+ dcr-reg = <0x180 0x062>; -+ num-tx-chans = <4>; -+ num-rx-chans = <2>; -+ interrupt-parent = <&UIC0>; -+ interrupts = < -+ 0xb 0x4 /* TXEOB */ -+ 0xc 0x4 /* RXEOB */ -+ 0xa 0x4 /* SERR */ -+ 0xd 0x4 /* TXDE */ -+ 0xe 0x4 /* RXDE */>; -+ }; -+ -+ OPB0: opb { -+ compatible = "ibm,opb-405ep", "ibm,opb"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges = <0xef600000 0xef600000 0x00a00000>; -+ dcr-reg = <0x0a0 0x005>; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ -+ UART0: serial@ef600300 { -+ device_type = "serial"; -+ compatible = "ns16550"; -+ reg = <0xef600300 0x00000008>; -+ virtual-reg = <0xef600300>; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ current-speed = <115200>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x0 0x4>; -+ }; -+ -+ UART1: serial@ef600400 { -+ device_type = "serial"; -+ compatible = "ns16550"; -+ reg = <0xef600400 0x00000008>; -+ virtual-reg = <0xef600400>; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ current-speed = <115200>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x1 0x4>; -+ }; -+ -+ IIC: i2c@ef600500 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ compatible = "ibm,iic-405ep", "ibm,iic"; -+ reg = <0xef600500 0x00000011>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x2 0x4>; -+ -+ eeprom@50 { -+ compatible = "at24,24c16"; -+ reg = <0x50>; -+ }; -+ }; -+ -+ GPIO0: gpio-controller@ef600700 { -+ compatible = "ibm,ppc4xx-gpio"; -+ reg = <0xef600700 0x00000020>; -+ #gpio-cells = <2>; -+ gpio-controller; -+ }; -+ -+ EMAC0: ethernet@ef600800 { -+ linux,network-index = <0x0>; -+ device_type = "network"; -+ compatible = "ibm,emac-405ep", "ibm,emac"; -+ interrupt-parent = <&UIC0>; -+ interrupts = < -+ 0xf 0x4 /* Ethernet */ -+ 0x9 0x4 /* Ethernet Wake Up */>; -+ local-mac-address = [000000000000]; /* Filled in by zImage */ -+ reg = <0xef600800 0x00000070>; -+ mal-device = <&MAL>; -+ mal-tx-channel = <0>; -+ mal-rx-channel = <0>; -+ cell-index = <0>; -+ max-frame-size = <0x5dc>; -+ rx-fifo-size = <0x1000>; -+ tx-fifo-size = <0x800>; -+ phy-mode = "mii"; -+ phy-map = <0x00000000>; -+ }; -+ -+ leds { -+ compatible = "gpio-leds"; -+ user { -+ label = "openrb:green:user"; -+ gpios = <&GPIO0 2 1>; -+ }; -+ }; -+ }; -+ -+ EBC0: ebc { -+ compatible = "ibm,ebc-405ep", "ibm,ebc"; -+ dcr-reg = <0x012 0x002>; -+ #address-cells = <2>; -+ #size-cells = <1>; -+ /* The ranges property is supplied by the bootwrapper -+ * and is based on the firmware's configuration of the -+ * EBC bridge -+ */ -+ clock-frequency = <0>; /* Filled in by zImage */ -+ -+ cf_card@ff100000 { -+ compatible = "magicbox-cf", "pata-magicbox-cf"; -+ reg = <0x00000000 0xff100000 0x00001000 -+ 0x00000000 0xff200000 0x00001000>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x19 0x1 /* IRQ_TYPE_EDGE_RISING */ >; -+ }; -+ -+ nor_flash@ff800000 { -+ compatible = "cfi-flash"; -+ bank-width = <2>; -+ reg = <0x00000000 0xff800000 0x00800000>; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ partition@0 { -+ label = "linux"; -+ reg = <0x0 0x120000>; -+ }; -+ partition@120000 { -+ label = "rootfs"; -+ reg = <0x120000 0x6a0000>; -+ }; -+ partition@7c0000 { -+ label = "u-boot"; -+ reg = <0x7c0000 0x30000>; -+ read-only; -+ }; -+ }; -+ }; -+ -+ PCI0: pci@ec000000 { -+ device_type = "pci"; -+ #interrupt-cells = <1>; -+ #size-cells = <2>; -+ #address-cells = <3>; -+ compatible = "ibm,plb405ep-pci", "ibm,plb-pci"; -+ primary; -+ reg = <0xeec00000 0x00000008 /* Config space access */ -+ 0xeed80000 0x00000004 /* IACK */ -+ 0xeed80000 0x00000004 /* Special cycle */ -+ 0xef480000 0x00000040>; /* Internal registers */ -+ -+ /* Outbound ranges, one memory and one IO, -+ * later cannot be changed. Chip supports a second -+ * IO range but we don't use it for now -+ */ -+ ranges = <0x02000000 0x00000000 0x80000000 0x80000000 0x00000000 0x20000000 -+ 0x01000000 0x00000000 0x00000000 0xe8000000 0x00000000 0x00010000>; -+ -+ /* Inbound 2GB range starting at 0 */ -+ dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x80000000>; -+ -+ interrupt-map-mask = <0xf800 0x0 0x0 0x0>; -+ interrupt-map = < -+ /* IDSEL 1 */ -+ 0x800 0x0 0x0 0x0 &UIC0 0x1c 0x8 -+ -+ /* IDSEL 2 */ -+ 0x1000 0x0 0x0 0x0 &UIC0 0x1d 0x8 -+ -+ /* IDSEL 3 */ -+ 0x1800 0x0 0x0 0x0 &UIC0 0x1e 0x8 -+ -+ /* IDSEL 4 */ -+ 0x2000 0x0 0x0 0x0 &UIC0 0x1f 0x8 -+ >; -+ }; -+ }; -+ -+ chosen { -+ linux,stdout-path = "/plb/opb/serial@ef600300"; -+ }; -+}; diff --git a/target/linux/ppc40x/patches/008-openrb-medium.patch b/target/linux/ppc40x/patches/008-openrb-medium.patch deleted file mode 100644 index b69d9099e..000000000 --- a/target/linux/ppc40x/patches/008-openrb-medium.patch +++ /dev/null @@ -1,404 +0,0 @@ ---- a/arch/powerpc/boot/Makefile -+++ b/arch/powerpc/boot/Makefile -@@ -71,7 +71,7 @@ src-plat := of.c cuboot-52xx.c cuboot-82 - cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \ - virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \ - cuboot-acadia.c cuboot-magicboxv1.c cuboot-magicboxv2.c \ -- cuboot-openrb-light.c -+ cuboot-openrb-light.c cuboot-openrb-medium.c - src-boot := $(src-wlib) $(src-plat) empty.c - - src-boot := $(addprefix $(obj)/, $(src-boot)) -@@ -218,6 +218,7 @@ image-$(CONFIG_ACADIA) += cuImage.acad - image-$(CONFIG_MAGICBOXV1) += cuImage.magicboxv1 - image-$(CONFIG_MAGICBOXV2) += cuImage.magicboxv2 - image-$(CONFIG_OPENRB_LIGHT) += cuImage.openrb-light -+image-$(CONFIG_OPENRB_MEDIUM) += cuImage.openrb-medium - - # Board ports in arch/powerpc/platform/44x/Kconfig - image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony ---- a/arch/powerpc/platforms/40x/Kconfig -+++ b/arch/powerpc/platforms/40x/Kconfig -@@ -89,6 +89,16 @@ config OPENRB_LIGHT - help - This option enables support for the OpenRB Light board. - -+config OPENRB_MEDIUM -+ bool "OpenRB Medium" -+ depends on 40x -+ default n -+ select PPC40x_SIMPLE -+ select 405EP -+ select PCI -+ help -+ This option enables support for the OpenRB Medium board. -+ - #config REDWOOD_5 - # bool "Redwood-5" - # depends on 40x ---- a/arch/powerpc/platforms/40x/ppc40x_simple.c -+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c -@@ -55,6 +55,7 @@ static char *board[] __initdata = { - "magicboxv1", - "magicboxv2", - "openrb,light", -+ "openrb,medium", - }; - - static int __init ppc40x_probe(void) ---- /dev/null -+++ b/arch/powerpc/boot/cuboot-openrb-medium.c -@@ -0,0 +1,69 @@ -+/* -+ * Old U-boot compatibility for OpenRB Medium -+ * -+ * Author: Gabor Juhos -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ */ -+ -+#include "ops.h" -+#include "io.h" -+#include "dcr.h" -+#include "stdio.h" -+#include "4xx.h" -+#include "44x.h" -+#include "cuboot.h" -+ -+#define TARGET_4xx -+#define TARGET_405EP -+#include "ppcboot.h" -+ -+static bd_t bd; -+ -+static void fixup_cf_card(void) -+{ -+#define DCRN_CPC0_PCI_BASE 0xf9 -+#define CF_CS0_BASE 0xff100000 -+#define CF_CS1_BASE 0xff200000 -+ -+ /* Turn on PerWE instead of PCIsomething */ -+ mtdcr(DCRN_CPC0_PCI_BASE, -+ mfdcr(DCRN_CPC0_PCI_BASE) | (0x80000000L >> 27)); -+ -+ /* PerCS1 (CF's CS0): base 0xff100000, 16-bit, rw */ -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1CR); -+ mtdcr(DCRN_EBC0_CFGDATA, CF_CS0_BASE | EBC_BXCR_BU_RW | EBC_BXCR_BW_16); -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1AP); -+ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800); -+ -+ /* PerCS2 (CF's CS1): base 0xff200000, 16-bit, rw */ -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2CR); -+ mtdcr(DCRN_EBC0_CFGDATA, CF_CS1_BASE | EBC_BXCR_BU_RW | EBC_BXCR_BW_16); -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2AP); -+ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800); -+ -+#undef DCRN_CPC0_PCI_BASE -+#undef CF_CS0_BASE -+#undef CF_CS1_BASE -+} -+ -+static void openrb_light_fixups(void) -+{ -+ fixup_cf_card(); -+ ibm405ep_fixup_clocks(33333000); -+ ibm4xx_sdram_fixup_memsize(); -+ dt_fixup_mac_addresses(&bd.bi_enetaddr, &bd.bi_enet1addr); -+} -+ -+void platform_init(unsigned long r3, unsigned long r4, unsigned long r5, -+ unsigned long r6, unsigned long r7) -+{ -+ CUBOOT_INIT(); -+ platform_ops.fixups = openrb_light_fixups; -+ platform_ops.exit = ibm40x_dbcr_reset; -+ fdt_init(_dtb_start); -+ serial_console_init(); -+} -+ ---- /dev/null -+++ b/arch/powerpc/boot/dts/openrb-medium.dts -@@ -0,0 +1,281 @@ -+/* -+ * Device Tree Source for OpenRB Medium board -+ * -+ * Copyright 2008 Imre Kaloz -+ * Copyright 2009 Gabor Juhos -+ * -+ * Based on walnut.dts -+ * -+ * This file is licensed under the terms of the GNU General Public -+ * License version 2. This program is licensed "as is" without -+ * any warranty of any kind, whether express or implied. -+ */ -+ -+/dts-v1/; -+ -+/ { -+ #address-cells = <1>; -+ #size-cells = <1>; -+ model = "openrb,medium"; -+ compatible = "openrb,medium"; -+ dcr-parent = <&{/cpus/cpu@0}>; -+ -+ aliases { -+ ethernet0 = &EMAC0; -+ ethernet1 = &EMAC1; -+ serial0 = &UART0; -+ serial1 = &UART1; -+ }; -+ -+ cpus { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ cpu@0 { -+ device_type = "cpu"; -+ model = "PowerPC,405EP"; -+ reg = <0x00000000>; -+ clock-frequency = <0xbebc200>; /* Filled in by zImage */ -+ timebase-frequency = <0>; /* Filled in by zImage */ -+ i-cache-line-size = <20>; -+ d-cache-line-size = <20>; -+ i-cache-size = <4000>; -+ d-cache-size = <4000>; -+ dcr-controller; -+ dcr-access-method = "native"; -+ }; -+ }; -+ -+ memory { -+ device_type = "memory"; -+ reg = <0x00000000 0x00000000>; /* Filled in by zImage */ -+ }; -+ -+ UIC0: interrupt-controller { -+ compatible = "ibm,uic"; -+ interrupt-controller; -+ cell-index = <0>; -+ dcr-reg = <0x0c0 0x009>; -+ #address-cells = <0>; -+ #size-cells = <0>; -+ #interrupt-cells = <2>; -+ }; -+ -+ plb { -+ compatible = "ibm,plb3"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ -+ SDRAM0: memory-controller { -+ compatible = "ibm,sdram-405ep"; -+ dcr-reg = <0x010 0x002>; -+ }; -+ -+ MAL: mcmal { -+ compatible = "ibm,mcmal-405ep", "ibm,mcmal"; -+ dcr-reg = <0x180 0x062>; -+ num-tx-chans = <4>; -+ num-rx-chans = <2>; -+ interrupt-parent = <&UIC0>; -+ interrupts = < -+ 0xb 0x4 /* TXEOB */ -+ 0xc 0x4 /* RXEOB */ -+ 0xa 0x4 /* SERR */ -+ 0xd 0x4 /* TXDE */ -+ 0xe 0x4 /* RXDE */>; -+ }; -+ -+ POB0: opb { -+ compatible = "ibm,opb-405ep", "ibm,opb"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges = <0xef600000 0xef600000 0x00a00000>; -+ dcr-reg = <0x0a0 0x005>; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ -+ UART0: serial@ef600300 { -+ device_type = "serial"; -+ compatible = "ns16550"; -+ reg = <0xef600300 0x00000008>; -+ virtual-reg = <0xef600300>; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ current-speed = <115200>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x0 0x4>; -+ }; -+ -+ UART1: serial@ef600400 { -+ device_type = "serial"; -+ compatible = "ns16550"; -+ reg = <0xef600400 0x00000008>; -+ virtual-reg = <0xef600400>; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ current-speed = <115200>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x1 0x4>; -+ }; -+ -+ IIC: i2c@ef600500 { -+ compatible = "ibm,iic-405ep", "ibm,iic"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <0xef600500 0x00000011>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x2 0x4>; -+ -+ dtt@48 { -+ compatible = "national,lm75"; -+ reg = <0x48>; -+ }; -+ -+ eeprom@50 { -+ compatible = "at24,24c16"; -+ reg = <0x50>; -+ }; -+ }; -+ -+ GPIO0: gpio-controller@ef600700 { -+ compatible = "ibm,ppc4xx-gpio"; -+ reg = <0xef600700 0x00000020>; -+ #gpio-cells = <2>; -+ gpio-controller; -+ }; -+ -+ EMAC0: ethernet@ef600800 { -+ linux,network-index = <0x0>; -+ device_type = "network"; -+ compatible = "ibm,emac-405ep", "ibm,emac"; -+ interrupt-parent = <&UIC0>; -+ interrupts = < -+ 0xf 0x4 /* Ethernet */ -+ 0x9 0x4 /* Ethernet Wake Up */>; -+ local-mac-address = [000000000000]; /* Filled in by zImage */ -+ reg = <0xef600800 0x00000070>; -+ mal-device = <&MAL>; -+ mal-tx-channel = <0>; -+ mal-rx-channel = <0>; -+ cell-index = <0>; -+ max-frame-size = <0x5dc>; -+ rx-fifo-size = <0x1000>; -+ tx-fifo-size = <0x800>; -+ phy-mode = "mii"; -+ phy-map = <0x00000000>; -+ }; -+ -+ EMAC1: ethernet@ef600900 { -+ linux,network-index = <0x1>; -+ device_type = "network"; -+ compatible = "ibm,emac-405ep", "ibm,emac"; -+ interrupt-parent = <&UIC0>; -+ interrupts = < -+ 0x11 0x4 /* Ethernet */ -+ 0x09 0x4 /* Ethernet Wake Up */>; -+ local-mac-address = [000000000000]; /* Filled in by zImage */ -+ reg = <0xef600900 0x00000070>; -+ mal-device = <&MAL>; -+ mal-tx-channel = <2>; -+ mal-rx-channel = <1>; -+ cell-index = <1>; -+ max-frame-size = <0x5dc>; -+ rx-fifo-size = <0x1000>; -+ tx-fifo-size = <0x800>; -+ mdio-device = <&EMAC0>; -+ phy-mode = "mii"; -+ phy-map = <0x00000001>; -+ }; -+ -+ leds { -+ compatible = "gpio-leds"; -+ user { -+ label = "magicbox:red:user"; -+ gpios = <&GPIO0 2 1>; -+ }; -+ }; -+ }; -+ -+ EBC0: ebc { -+ compatible = "ibm,ebc-405ep", "ibm,ebc"; -+ dcr-reg = <0x012 0x002>; -+ #address-cells = <2>; -+ #size-cells = <1>; -+ /* The ranges property is supplied by the bootwrapper -+ * and is based on the firmware's configuration of the -+ * EBC bridge -+ */ -+ clock-frequency = <0>; /* Filled in by zImage */ -+ -+ cf_card@ff100000 { -+ compatible = "magicbox-cf", "pata-magicbox-cf"; -+ reg = <0x00000000 0xff100000 0x00001000 -+ 0x00000000 0xff200000 0x00001000>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x19 0x1 /* IRQ_TYPE_EDGE_RISING */ >; -+ }; -+ -+ nor_flash@ffc00000 { -+ compatible = "cfi-flash"; -+ bank-width = <2>; -+ reg = <0x00000000 0xffc00000 0x00400000>; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ partition@0 { -+ label = "linux"; -+ reg = <0x0 0x120000>; -+ }; -+ partition@120000 { -+ label = "rootfs"; -+ reg = <0x120000 0x2a0000>; -+ }; -+ partition@3c0000 { -+ label = "u-boot"; -+ reg = <0x3c0000 0x30000>; -+ read-only; -+ }; -+ }; -+ }; -+ -+ PCI0: pci@ec000000 { -+ device_type = "pci"; -+ #interrupt-cells = <1>; -+ #size-cells = <2>; -+ #address-cells = <3>; -+ compatible = "ibm,plb405ep-pci", "ibm,plb-pci"; -+ primary; -+ reg = <0xeec00000 0x00000008 /* Config space access */ -+ 0xeed80000 0x00000004 /* IACK */ -+ 0xeed80000 0x00000004 /* Special cycle */ -+ 0xef480000 0x00000040>; /* Internal registers */ -+ -+ /* Outbound ranges, one memory and one IO, -+ * later cannot be changed. Chip supports a second -+ * IO range but we don't use it for now -+ */ -+ ranges = <0x02000000 0x00000000 0x80000000 0x80000000 0x00000000 0x20000000 -+ 0x01000000 0x00000000 0x00000000 0xe8000000 0x00000000 0x00010000>; -+ -+ /* Inbound 2GB range starting at 0 */ -+ dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x80000000>; -+ -+ interrupt-map-mask = <0xf800 0x0 0x0 0x0>; -+ interrupt-map = < -+ /* IDSEL 1 */ -+ 0x800 0x0 0x0 0x0 &UIC0 0x1c 0x8 -+ -+ /* IDSEL 2 */ -+ 0x1000 0x0 0x0 0x0 &UIC0 0x1d 0x8 -+ -+ /* IDSEL 3 */ -+ 0x1800 0x0 0x0 0x0 &UIC0 0x1e 0x8 -+ -+ /* IDSEL 4 */ -+ 0x2000 0x0 0x0 0x0 &UIC0 0x1f 0x8 -+ >; -+ }; -+ }; -+ -+ chosen { -+ linux,stdout-path = "/plb/opb/serial@ef600300"; -+ }; -+}; diff --git a/target/linux/ppc40x/patches/100-magicbox-ide-driver.patch b/target/linux/ppc40x/patches/100-magicbox-ide-driver.patch deleted file mode 100644 index eca26a9e4..000000000 --- a/target/linux/ppc40x/patches/100-magicbox-ide-driver.patch +++ /dev/null @@ -1,359 +0,0 @@ ---- a/drivers/ide/Kconfig -+++ b/drivers/ide/Kconfig -@@ -712,6 +712,11 @@ config BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ - default "128" - depends on BLK_DEV_IDE_AU1XXX - -+config BLK_DEV_IDE_MAGICBOX -+ tristate "Magicbox CF card support" -+ depends on MAGICBOXV2 || OPENRB_LIGHT -+ select IDE_XFER_MODE -+ - config BLK_DEV_IDE_TX4938 - tristate "TX4938 internal IDE support" - depends on SOC_TX4938 ---- a/drivers/ide/Makefile -+++ b/drivers/ide/Makefile -@@ -110,6 +110,7 @@ obj-$(CONFIG_BLK_DEV_IDE_RAPIDE) += rapi - obj-$(CONFIG_BLK_DEV_PALMCHIP_BK3710) += palm_bk3710.o - - obj-$(CONFIG_BLK_DEV_IDE_AU1XXX) += au1xxx-ide.o -+obj-$(CONFIG_BLK_DEV_IDE_MAGICBOX) += magicbox_ide.o - - obj-$(CONFIG_BLK_DEV_IDE_TX4938) += tx4938ide.o - obj-$(CONFIG_BLK_DEV_IDE_TX4939) += tx4939ide.o ---- /dev/null -+++ b/drivers/ide/magicbox_ide.c -@@ -0,0 +1,332 @@ -+/* -+ * IDE driver for the MagicBox 2.0 onboard CompactFlash slot. -+ * -+ * Copyright (C) 2009 Gabor Juhos -+ * -+ * Based on the original driver by Wojtek Kaniewski -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define DRV_DESC "IDE driver for Magicbox 2.0 onboard CF slot" -+#define DRV_NAME "magicbox_cf" -+ -+static u8 magicbox_ide_inb(unsigned long port) -+{ -+ return (u8) (readw((void __iomem *) port) >> 8) & 0xff; -+} -+ -+static void magicbox_ide_outb(u8 value, unsigned long port) -+{ -+ writew(value << 8, (void __iomem *) port); -+} -+ -+static inline void magicbox_ide_insw(unsigned long port, void *addr, u32 count) -+{ -+ u16 *ptr; -+ -+ for (ptr = addr; count--; ptr++) -+ *ptr = readw((void __iomem *) port); -+} -+ -+static inline void magicbox_ide_insl(unsigned long port, void *addr, u32 count) -+{ -+ u32 *ptr; -+ -+ for (ptr = addr; count--; ptr++) -+ *ptr = readl((void __iomem *) port); -+} -+ -+static inline void magicbox_ide_outsw(unsigned long port, void *addr, -+ u32 count) -+{ -+ u16 *ptr; -+ -+ for (ptr = addr; count--; ptr++) -+ writew(*ptr, (void __iomem *) port); -+} -+ -+static inline void magicbox_ide_outsl(unsigned long port, void *addr, -+ u32 count) -+{ -+ u32 *ptr; -+ -+ for (ptr = addr; count--; ptr++) -+ writel(*ptr, (void __iomem *) port); -+} -+ -+static void magicbox_ide_exec_command(ide_hwif_t *hwif, u8 cmd) -+{ -+ magicbox_ide_outb(cmd, hwif->io_ports.command_addr); -+} -+ -+static u8 magicbox_ide_read_status(ide_hwif_t *hwif) -+{ -+ return magicbox_ide_inb(hwif->io_ports.status_addr); -+} -+ -+static u8 magicbox_ide_read_altstatus(ide_hwif_t *hwif) -+{ -+ return magicbox_ide_inb(hwif->io_ports.ctl_addr); -+} -+ -+static void magicbox_ide_tf_load(ide_drive_t *drive, ide_task_t *task) -+{ -+ struct ide_io_ports *io_ports = &drive->hwif->io_ports; -+ struct ide_taskfile *tf = &task->tf; -+ u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; -+ -+ if (task->tf_flags & IDE_TFLAG_FLAGGED) -+ HIHI = 0xFF; -+ -+ if (task->tf_flags & IDE_TFLAG_OUT_DATA) -+ writel((tf->hob_data << 8) | tf->data, -+ (void __iomem *) io_ports->data_addr); -+ -+ if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) -+ magicbox_ide_outb(tf->hob_feature, io_ports->feature_addr); -+ if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) -+ magicbox_ide_outb(tf->hob_nsect, io_ports->nsect_addr); -+ if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) -+ magicbox_ide_outb(tf->hob_lbal, io_ports->lbal_addr); -+ if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) -+ magicbox_ide_outb(tf->hob_lbam, io_ports->lbam_addr); -+ if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) -+ magicbox_ide_outb(tf->hob_lbah, io_ports->lbah_addr); -+ -+ if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) -+ magicbox_ide_outb(tf->feature, io_ports->feature_addr); -+ if (task->tf_flags & IDE_TFLAG_OUT_NSECT) -+ magicbox_ide_outb(tf->nsect, io_ports->nsect_addr); -+ if (task->tf_flags & IDE_TFLAG_OUT_LBAL) -+ magicbox_ide_outb(tf->lbal, io_ports->lbal_addr); -+ if (task->tf_flags & IDE_TFLAG_OUT_LBAM) -+ magicbox_ide_outb(tf->lbam, io_ports->lbam_addr); -+ if (task->tf_flags & IDE_TFLAG_OUT_LBAH) -+ magicbox_ide_outb(tf->lbah, io_ports->lbah_addr); -+ -+ if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) -+ magicbox_ide_outb((tf->device & HIHI) | drive->select, -+ io_ports->device_addr); -+} -+ -+static void magicbox_ide_tf_read(ide_drive_t *drive, ide_task_t *task) -+{ -+ struct ide_io_ports *io_ports = &drive->hwif->io_ports; -+ struct ide_taskfile *tf = &task->tf; -+ -+ if (task->tf_flags & IDE_TFLAG_IN_DATA) { -+ u16 data = (u16) readl((void __iomem *) io_ports->data_addr); -+ -+ tf->data = data & 0xff; -+ tf->hob_data = (data >> 8) & 0xff; -+ } -+ -+ /* be sure we're looking at the low order bits */ -+ magicbox_ide_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); -+ -+ if (task->tf_flags & IDE_TFLAG_IN_NSECT) -+ tf->nsect = magicbox_ide_inb(io_ports->nsect_addr); -+ if (task->tf_flags & IDE_TFLAG_IN_LBAL) -+ tf->lbal = magicbox_ide_inb(io_ports->lbal_addr); -+ if (task->tf_flags & IDE_TFLAG_IN_LBAM) -+ tf->lbam = magicbox_ide_inb(io_ports->lbam_addr); -+ if (task->tf_flags & IDE_TFLAG_IN_LBAH) -+ tf->lbah = magicbox_ide_inb(io_ports->lbah_addr); -+ if (task->tf_flags & IDE_TFLAG_IN_DEVICE) -+ tf->device = magicbox_ide_inb(io_ports->device_addr); -+ -+ if (task->tf_flags & IDE_TFLAG_LBA48) { -+ magicbox_ide_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); -+ -+ if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) -+ tf->hob_feature = magicbox_ide_inb(io_ports->feature_addr); -+ if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) -+ tf->hob_nsect = magicbox_ide_inb(io_ports->nsect_addr); -+ if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) -+ tf->hob_lbal = magicbox_ide_inb(io_ports->lbal_addr); -+ if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) -+ tf->hob_lbam = magicbox_ide_inb(io_ports->lbam_addr); -+ if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) -+ tf->hob_lbah = magicbox_ide_inb(io_ports->lbah_addr); -+ } -+} -+ -+static void magicbox_ide_input_data(ide_drive_t *drive, struct request *rq, -+ void *buf, unsigned int len) -+{ -+ unsigned long port = drive->hwif->io_ports.data_addr; -+ -+ len++; -+ -+ if (drive->io_32bit) { -+ magicbox_ide_insl(port, buf, len / 4); -+ -+ if ((len & 3) >= 2) -+ magicbox_ide_insw(port, (u8 *)buf + (len & ~3), 1); -+ } else -+ magicbox_ide_insw(port, buf, len / 2); -+} -+ -+static void magicbox_ide_output_data(ide_drive_t *drive, struct request *rq, -+ void *buf, unsigned int len) -+{ -+ unsigned long port = drive->hwif->io_ports.data_addr; -+ -+ len++; -+ -+ if (drive->io_32bit) { -+ magicbox_ide_outsl(port, buf, len / 4); -+ -+ if ((len & 3) >= 2) -+ magicbox_ide_outsw(port, (u8 *)buf + (len & ~3), 1); -+ } else -+ magicbox_ide_outsw(port, buf, len / 2); -+} -+ -+static void magicbox_ide_set_pio_mode(ide_drive_t *drive, const u8 pio) -+{ -+} -+ -+static u8 magicbox_ide_cable_detect(ide_hwif_t *hwif) -+{ -+ return ATA_CBL_PATA40; -+} -+ -+static const struct ide_tp_ops magicbox_ide_tp_ops = { -+ .exec_command = magicbox_ide_exec_command, -+ .read_status = magicbox_ide_read_status, -+ .read_altstatus = magicbox_ide_read_altstatus, -+ -+ .set_irq = ide_set_irq, -+ .tf_load = magicbox_ide_tf_load, -+ .tf_read = magicbox_ide_tf_read, -+ -+ .input_data = magicbox_ide_input_data, -+ .output_data = magicbox_ide_output_data, -+}; -+ -+static const struct ide_port_ops magicbox_ide_port_ops = { -+ .set_pio_mode = magicbox_ide_set_pio_mode, -+ .cable_detect = magicbox_ide_cable_detect, -+}; -+ -+static const struct ide_port_info magicbox_ide_port_info = { -+ .name = DRV_NAME, -+ .chipset = ide_generic, -+ .tp_ops = &magicbox_ide_tp_ops, -+ .port_ops = &magicbox_ide_port_ops, -+ .host_flags = IDE_HFLAG_SINGLE | -+ IDE_HFLAG_NO_DMA | -+ IDE_HFLAG_MMIO | -+ IDE_HFLAG_UNMASK_IRQS, -+ .pio_mask = ATA_PIO4, -+}; -+ -+static inline void magicbox_ide_setup_hw(hw_regs_t *hw, u16 __iomem *base, -+ u16 __iomem *ctrl, int irq) -+{ -+ unsigned long port = (unsigned long) base; -+ int i; -+ -+ memset(hw, 0, sizeof(*hw)); -+ for (i = 0; i <= 7; i++) -+ hw->io_ports_array[i] = port + i * 2; -+ -+ /* -+ * the IDE control register is at ATA address 6, -+ * with CS1 active instead of CS0 -+ */ -+ hw->io_ports.ctl_addr = (unsigned long)ctrl + (6 * 2); -+ -+ hw->irq = irq; -+ hw->chipset = ide_generic; -+ hw->ack_intr = NULL; -+} -+ -+static int __devinit magicbox_ide_of_probe(struct of_device *op, -+ const struct of_device_id *match) -+{ -+ hw_regs_t hw; -+ hw_regs_t *hws[] = { &hw, NULL, NULL, NULL }; -+ struct ide_host *host; -+ u16 __iomem *base; -+ u16 __iomem *ctrl; -+ int irq; -+ int ret = 0; -+ -+ irq = irq_of_parse_and_map(op->node, 0); -+ if (irq < 0) { -+ dev_err(&op->dev, "invalid irq\n"); -+ ret = -EINVAL; -+ goto err_exit; -+ } -+ -+ base = of_iomap(op->node, 0); -+ if (base == NULL) { -+ ret = -ENOMEM; -+ goto err_exit; -+ } -+ -+ ctrl = of_iomap(op->node, 1); -+ if (ctrl == NULL) { -+ ret = -ENOMEM; -+ goto err_unmap_base; -+ } -+ -+ magicbox_ide_setup_hw(&hw, base, ctrl, irq); -+ -+ hw.dev = &op->dev; -+ -+ ret = ide_host_add(&magicbox_ide_port_info, hws, &host); -+ if (ret) -+ goto err_unmap_ctrl; -+ -+ dev_set_drvdata(&op->dev, host); -+ -+ return 0; -+ -+ err_unmap_ctrl: -+ iounmap(ctrl); -+ err_unmap_base: -+ iounmap(base); -+ err_exit: -+ return ret; -+} -+ -+static struct of_device_id magicbox_ide_of_match[] = { -+ { .compatible = "magicbox-cf", }, -+ {}, -+}; -+ -+static struct of_platform_driver magicbox_ide_of_platform_driver = { -+ .owner = THIS_MODULE, -+ .name = DRV_NAME, -+ .match_table = magicbox_ide_of_match, -+ .probe = magicbox_ide_of_probe, -+ .driver = { -+ .name = DRV_NAME, -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static int __init magicbox_ide_init(void) -+{ -+ return of_register_platform_driver(&magicbox_ide_of_platform_driver); -+} -+ -+module_init(magicbox_ide_init); -+ -+MODULE_DESCRIPTION(DRV_DESC); -+MODULE_AUTHOR("Gabor Juhos "); -+MODULE_LICENSE("GPL v2"); -+MODULE_DEVICE_TABLE(of, magicbox_ide_of_match); diff --git a/target/linux/ppc40x/patches/101-pata-magicbox-cf-driver.patch b/target/linux/ppc40x/patches/101-pata-magicbox-cf-driver.patch deleted file mode 100644 index 48d2d44ee..000000000 --- a/target/linux/ppc40x/patches/101-pata-magicbox-cf-driver.patch +++ /dev/null @@ -1,438 +0,0 @@ ---- a/drivers/ata/Kconfig -+++ b/drivers/ata/Kconfig -@@ -697,6 +697,16 @@ config PATA_IXP4XX_CF - - If unsure, say N. - -+config PATA_MAGICBOX_CF -+ tristate "Magicbox/OpenRB Compact lash support" -+ depends on MAGICBOXV2 || OPENRB_LIGHT -+ help -+ This option enables supoort for a Compatc Flash connected on -+ the ppc405ep expansion bus. This driver had been written for -+ the Magicbox v2 and OpenRB boards. -+ -+ If unsure, say N. -+ - config PATA_SCC - tristate "Toshiba's Cell Reference Set IDE support" - depends on PCI && PPC_CELLEB ---- a/drivers/ata/Makefile -+++ b/drivers/ata/Makefile -@@ -48,6 +48,7 @@ obj-$(CONFIG_PATA_OPTI) += pata_opti.o - obj-$(CONFIG_PATA_OPTIDMA) += pata_optidma.o - obj-$(CONFIG_PATA_MPC52xx) += pata_mpc52xx.o - obj-$(CONFIG_PATA_MARVELL) += pata_marvell.o -+obj-$(CONFIG_PATA_MAGICBOX_CF) += pata_magicbox_cf.o - obj-$(CONFIG_PATA_MPIIX) += pata_mpiix.o - obj-$(CONFIG_PATA_OLDPIIX) += pata_oldpiix.o - obj-$(CONFIG_PATA_PCMCIA) += pata_pcmcia.o ---- /dev/null -+++ b/drivers/ata/pata_magicbox_cf.c -@@ -0,0 +1,406 @@ -+/* -+ * PATA/CompactFlash driver for the MagicBox v2/OpenRB boards. -+ * -+ * Copyright (C) 2009 Gabor Juhos -+ * -+ * Based on the IDE driver by Wojtek Kaniewski -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define DRV_DESC "PATA/CompactFlash driver for Magicbox/OpenRB boards" -+#define DRV_NAME "pata_magicbox_cf" -+#define DRV_VERSION "0.1.0" -+ -+#define MAGICBOX_CF_REG_CMD (2 * ATA_REG_CMD) -+#define MAGICBOX_CF_REG_DATA (2 * ATA_REG_DATA) -+#define MAGICBOX_CF_REG_ERR (2 * ATA_REG_ERR) -+#define MAGICBOX_CF_REG_FEATURE (2 * ATA_REG_FEATURE) -+#define MAGICBOX_CF_REG_NSECT (2 * ATA_REG_NSECT) -+#define MAGICBOX_CF_REG_LBAL (2 * ATA_REG_LBAL) -+#define MAGICBOX_CF_REG_LBAM (2 * ATA_REG_LBAM) -+#define MAGICBOX_CF_REG_LBAH (2 * ATA_REG_LBAH) -+#define MAGICBOX_CF_REG_DEVICE (2 * ATA_REG_DEVICE) -+#define MAGICBOX_CF_REG_STATUS (2 * ATA_REG_STATUS) -+#define MAGICBOX_CF_REG_ALTSTATUS (2 * 6) -+#define MAGICBOX_CF_REG_CTL (2 * 6) -+ -+#define MAGICBOX_CF_MAXPORTS 1 -+ -+struct magicbox_cf_info { -+ void __iomem *base; -+ void __iomem *ctrl; -+}; -+ -+static inline u8 magicbox_cf_inb(void __iomem *port) -+{ -+ return (u8) (readw(port) >> 8) & 0xff; -+} -+ -+static inline void magicbox_cf_outb(void __iomem *port, u8 value) -+{ -+ writew(value << 8, port); -+} -+ -+static int magicbox_cf_set_mode(struct ata_link *link, -+ struct ata_device **error) -+{ -+ struct ata_device *dev; -+ -+ ata_link_for_each_dev(dev, link) { -+ if (ata_dev_enabled(dev)) { -+ ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n"); -+ dev->pio_mode = XFER_PIO_0; -+ dev->xfer_mode = XFER_PIO_0; -+ dev->xfer_shift = ATA_SHIFT_PIO; -+ dev->flags |= ATA_DFLAG_PIO; -+ } -+ } -+ -+ return 0; -+} -+ -+static void magicbox_cf_exec_command(struct ata_port *ap, -+ const struct ata_taskfile *tf) -+{ -+ DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command); -+ -+ magicbox_cf_outb(ap->ioaddr.command_addr, tf->command); -+ ata_sff_pause(ap); -+} -+ -+static u8 magicbox_cf_check_status(struct ata_port *ap) -+{ -+ u8 status; -+ -+ status = magicbox_cf_inb(ap->ioaddr.status_addr); -+ -+ DPRINTK("ata%u: status 0x%X, from %p\n", ap->print_id, status, -+ ap->ioaddr.status_addr); -+ -+ return status; -+} -+ -+static u8 magicbox_cf_check_altstatus(struct ata_port *ap) -+{ -+ u8 altstatus; -+ -+ altstatus = magicbox_cf_inb(ap->ioaddr.altstatus_addr); -+ -+ DPRINTK("ata%u: altstatus 0x%X, from %p\n", ap->print_id, -+ altstatus, ap->ioaddr.altstatus_addr); -+ -+ return altstatus; -+} -+ -+static void magicbox_cf_dev_select(struct ata_port *ap, unsigned int device) -+{ -+ /* Nothing to do. We are supporting one device only. */ -+} -+ -+static void magicbox_cf_tf_load(struct ata_port *ap, -+ const struct ata_taskfile *tf) -+{ -+ struct ata_ioports *ioaddr = &ap->ioaddr; -+ unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; -+ -+ if (tf->ctl != ap->last_ctl) { -+ magicbox_cf_outb(ioaddr->ctl_addr, tf->ctl); -+ ap->last_ctl = tf->ctl; -+ ata_wait_idle(ap); -+ } -+ -+ if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { -+ magicbox_cf_outb(ioaddr->feature_addr, tf->hob_feature); -+ magicbox_cf_outb(ioaddr->nsect_addr, tf->hob_nsect); -+ magicbox_cf_outb(ioaddr->lbal_addr, tf->hob_lbal); -+ magicbox_cf_outb(ioaddr->lbam_addr, tf->hob_lbam); -+ magicbox_cf_outb(ioaddr->lbah_addr, tf->hob_lbah); -+ VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n", -+ tf->hob_feature, -+ tf->hob_nsect, -+ tf->hob_lbal, -+ tf->hob_lbam, -+ tf->hob_lbah); -+ } -+ -+ if (is_addr) { -+ magicbox_cf_outb(ioaddr->feature_addr, tf->feature); -+ magicbox_cf_outb(ioaddr->nsect_addr, tf->nsect); -+ magicbox_cf_outb(ioaddr->lbal_addr, tf->lbal); -+ magicbox_cf_outb(ioaddr->lbam_addr, tf->lbam); -+ magicbox_cf_outb(ioaddr->lbah_addr, tf->lbah); -+ VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n", -+ tf->feature, -+ tf->nsect, -+ tf->lbal, -+ tf->lbam, -+ tf->lbah); -+ } -+ -+ if (tf->flags & ATA_TFLAG_DEVICE) { -+ magicbox_cf_outb(ioaddr->device_addr, tf->device); -+ VPRINTK("device 0x%X\n", tf->device); -+ } -+ -+ ata_wait_idle(ap); -+} -+ -+static void magicbox_cf_tf_read(struct ata_port *ap, struct ata_taskfile *tf) -+{ -+ struct ata_ioports *ioaddr = &ap->ioaddr; -+ -+ tf->command = magicbox_cf_inb(ap->ioaddr.status_addr); -+ tf->feature = magicbox_cf_inb(ioaddr->error_addr); -+ tf->nsect = magicbox_cf_inb(ioaddr->nsect_addr); -+ tf->lbal = magicbox_cf_inb(ioaddr->lbal_addr); -+ tf->lbam = magicbox_cf_inb(ioaddr->lbam_addr); -+ tf->lbah = magicbox_cf_inb(ioaddr->lbah_addr); -+ tf->device = magicbox_cf_inb(ioaddr->device_addr); -+ VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n", -+ tf->feature, -+ tf->nsect, -+ tf->lbal, -+ tf->lbam, -+ tf->lbah); -+ -+ if (tf->flags & ATA_TFLAG_LBA48) { -+ magicbox_cf_outb(ioaddr->ctl_addr, tf->ctl | ATA_HOB); -+ tf->hob_feature = magicbox_cf_inb(ioaddr->error_addr); -+ tf->hob_nsect = magicbox_cf_inb(ioaddr->nsect_addr); -+ tf->hob_lbal = magicbox_cf_inb(ioaddr->lbal_addr); -+ tf->hob_lbam = magicbox_cf_inb(ioaddr->lbam_addr); -+ tf->hob_lbah = magicbox_cf_inb(ioaddr->lbah_addr); -+ magicbox_cf_outb(ioaddr->ctl_addr, tf->ctl); -+ ap->last_ctl = tf->ctl; -+ VPRINTK("hob: feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n", -+ tf->feature, -+ tf->nsect, -+ tf->lbal, -+ tf->lbam, -+ tf->lbah); -+ } -+} -+ -+static unsigned int magicbox_cf_data_xfer(struct ata_device *dev, -+ unsigned char *buf, -+ unsigned int buflen, int rw) -+{ -+ struct ata_port *ap = dev->link->ap; -+ unsigned int words = buflen >> 1; -+ unsigned int i; -+ u16 *buf16 = (u16 *) buf; -+ void __iomem *mmio = ap->ioaddr.data_addr; -+ -+ /* Transfer multiple of 2 bytes */ -+ if (rw == READ) -+ for (i = 0; i < words; i++) -+ buf16[i] = readw(mmio); -+ else -+ for (i = 0; i < words; i++) -+ writew(buf16[i], mmio); -+ -+ /* Transfer trailing 1 byte, if any. */ -+ if (unlikely(buflen & 0x01)) { -+ u16 align_buf[1] = { 0 }; -+ unsigned char *trailing_buf = buf + buflen - 1; -+ -+ if (rw == READ) { -+ align_buf[0] = readw(mmio); -+ memcpy(trailing_buf, align_buf, 1); -+ } else { -+ memcpy(align_buf, trailing_buf, 1); -+ writew(align_buf[0], mmio); -+ } -+ words++; -+ } -+ -+ return words << 1; -+} -+ -+static u8 magicbox_cf_irq_on(struct ata_port *ap) -+{ -+ /* Nothing to do. */ -+ return 0; -+} -+ -+static void magicbox_cf_irq_clear(struct ata_port *ap) -+{ -+ /* Nothing to do. */ -+} -+ -+static struct ata_port_operations magicbox_cf_port_ops = { -+ .inherits = &ata_sff_port_ops, -+ -+ .cable_detect = ata_cable_40wire, -+ .set_mode = magicbox_cf_set_mode, -+ -+ .sff_exec_command = magicbox_cf_exec_command, -+ .sff_check_status = magicbox_cf_check_status, -+ .sff_check_altstatus = magicbox_cf_check_altstatus, -+ .sff_dev_select = magicbox_cf_dev_select, -+ .sff_tf_load = magicbox_cf_tf_load, -+ .sff_tf_read = magicbox_cf_tf_read, -+ .sff_data_xfer = magicbox_cf_data_xfer, -+ -+ .sff_irq_on = magicbox_cf_irq_on, -+ .sff_irq_clear = magicbox_cf_irq_clear, -+ -+ .port_start = ATA_OP_NULL, -+}; -+ -+static struct scsi_host_template magicbox_cf_sht = { -+ ATA_PIO_SHT(DRV_NAME), -+}; -+ -+static inline void magicbox_cf_setup_port(struct ata_host *host) -+{ -+ struct magicbox_cf_info *info = host->private_data; -+ struct ata_port *ap; -+ -+ ap = host->ports[0]; -+ -+ ap->ops = &magicbox_cf_port_ops; -+ ap->pio_mask = ATA_PIO4; -+ ap->flags |= ATA_FLAG_MMIO | ATA_FLAG_NO_LEGACY | ATA_FLAG_NO_ATAPI; -+ -+ ap->ioaddr.cmd_addr = info->base + MAGICBOX_CF_REG_CMD; -+ ap->ioaddr.data_addr = info->base + MAGICBOX_CF_REG_DATA; -+ ap->ioaddr.error_addr = info->base + MAGICBOX_CF_REG_ERR; -+ ap->ioaddr.feature_addr = info->base + MAGICBOX_CF_REG_FEATURE; -+ ap->ioaddr.nsect_addr = info->base + MAGICBOX_CF_REG_NSECT; -+ ap->ioaddr.lbal_addr = info->base + MAGICBOX_CF_REG_LBAL; -+ ap->ioaddr.lbam_addr = info->base + MAGICBOX_CF_REG_LBAM; -+ ap->ioaddr.lbah_addr = info->base + MAGICBOX_CF_REG_LBAH; -+ ap->ioaddr.device_addr = info->base + MAGICBOX_CF_REG_DEVICE; -+ ap->ioaddr.status_addr = info->base + MAGICBOX_CF_REG_STATUS; -+ ap->ioaddr.command_addr = info->base + MAGICBOX_CF_REG_CMD; -+ -+ ap->ioaddr.altstatus_addr = info->ctrl + MAGICBOX_CF_REG_ALTSTATUS; -+ ap->ioaddr.ctl_addr = info->ctrl + MAGICBOX_CF_REG_CTL; -+ -+ ata_port_desc(ap, "cmd 0x%p ctl 0x%p", ap->ioaddr.cmd_addr, -+ ap->ioaddr.ctl_addr); -+} -+ -+static int __devinit magicbox_cf_of_probe(struct of_device *op, -+ const struct of_device_id *match) -+{ -+ struct magicbox_cf_info *info; -+ struct ata_host *host; -+ int irq; -+ int ret = 0; -+ -+ info = kzalloc(sizeof(struct magicbox_cf_info), GFP_KERNEL); -+ if (info == NULL) { -+ ret = -ENOMEM; -+ goto err_exit; -+ } -+ -+ irq = irq_of_parse_and_map(op->node, 0); -+ if (irq < 0) { -+ dev_err(&op->dev, "invalid irq\n"); -+ ret = -EINVAL; -+ goto err_free_info; -+ } -+ -+ info->base = of_iomap(op->node, 0); -+ if (info->base == NULL) { -+ ret = -ENOMEM; -+ goto err_free_info; -+ } -+ -+ info->ctrl = of_iomap(op->node, 1); -+ if (info->ctrl == NULL) { -+ ret = -ENOMEM; -+ goto err_unmap_base; -+ } -+ -+ host = ata_host_alloc(&op->dev, MAGICBOX_CF_MAXPORTS); -+ if (host == NULL) { -+ ret = -ENOMEM; -+ goto err_unmap_ctrl; -+ } -+ -+ host->private_data = info; -+ magicbox_cf_setup_port(host); -+ -+ ret = ata_host_activate(host, irq, ata_sff_interrupt, -+ IRQF_TRIGGER_RISING, &magicbox_cf_sht); -+ if (ret) -+ goto err_unmap_ctrl; -+ -+ dev_set_drvdata(&op->dev, host); -+ return 0; -+ -+ err_unmap_ctrl: -+ iounmap(info->ctrl); -+ err_unmap_base: -+ iounmap(info->base); -+ err_free_info: -+ kfree(info); -+ err_exit: -+ return ret; -+} -+ -+static __devexit int magicbox_cf_of_remove(struct of_device *op) -+{ -+ struct ata_host *host = dev_get_drvdata(&op->dev); -+ struct magicbox_cf_info *info = host->private_data; -+ -+ ata_host_detach(host); -+ iounmap(info->ctrl); -+ iounmap(info->base); -+ kfree(info); -+ -+ return 0; -+} -+ -+static struct of_device_id magicbox_cf_of_match[] = { -+ { .compatible = "pata-magicbox-cf", }, -+ {}, -+}; -+ -+static struct of_platform_driver magicbox_cf_of_platform_driver = { -+ .owner = THIS_MODULE, -+ .name = DRV_NAME, -+ .match_table = magicbox_cf_of_match, -+ .probe = magicbox_cf_of_probe, -+ .remove = __devexit_p(magicbox_cf_of_remove), -+ .driver = { -+ .name = DRV_NAME, -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static int __init magicbox_cf_init(void) -+{ -+ return of_register_platform_driver(&magicbox_cf_of_platform_driver); -+} -+ -+static void __exit magicbox_cf_exit(void) -+{ -+ of_unregister_platform_driver(&magicbox_cf_of_platform_driver); -+} -+ -+module_init(magicbox_cf_init); -+module_exit(magicbox_cf_exit); -+ -+MODULE_DESCRIPTION(DRV_DESC); -+MODULE_AUTHOR("Gabor Juhos "); -+MODULE_LICENSE("GPL v2"); -+MODULE_VERSION(DRV_VERSION); -+MODULE_DEVICE_TABLE(of, magicbox_cf_of_match); From f0bcf0323bd62f1c41e338c4ab8715b57d295096 Mon Sep 17 00:00:00 2001 From: kaloz Date: Tue, 27 Oct 2009 19:20:31 +0000 Subject: [PATCH 003/288] ppc40x: use version number-less patches and config git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18188 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ppc40x/{config-2.6.30 => config-default} | 0 .../{patches-2.6.30 => patches}/001-makalu_ppc40x_simple.patch | 0 .../002-kilauea_halekala_ppc40x_simple.patch | 0 .../003-powerpc-add-EBC_BXCR_BW-defines.patch | 0 .../linux/ppc40x/{patches-2.6.30 => patches}/004-magicbox.patch | 0 target/linux/ppc40x/{patches-2.6.30 => patches}/005-openrb.patch | 0 .../{patches-2.6.30 => patches}/100-magicbox-ide-driver.patch | 0 .../{patches-2.6.30 => patches}/101-pata-magicbox-cf-driver.patch | 0 .../110-kilauea_openwrt_flashmap.patch | 0 .../900-backport-fix-annotation-of-pcibios_claim_one_bus.patch | 0 10 files changed, 0 insertions(+), 0 deletions(-) rename target/linux/ppc40x/{config-2.6.30 => config-default} (100%) rename target/linux/ppc40x/{patches-2.6.30 => patches}/001-makalu_ppc40x_simple.patch (100%) rename target/linux/ppc40x/{patches-2.6.30 => patches}/002-kilauea_halekala_ppc40x_simple.patch (100%) rename target/linux/ppc40x/{patches-2.6.30 => patches}/003-powerpc-add-EBC_BXCR_BW-defines.patch (100%) rename target/linux/ppc40x/{patches-2.6.30 => patches}/004-magicbox.patch (100%) rename target/linux/ppc40x/{patches-2.6.30 => patches}/005-openrb.patch (100%) rename target/linux/ppc40x/{patches-2.6.30 => patches}/100-magicbox-ide-driver.patch (100%) rename target/linux/ppc40x/{patches-2.6.30 => patches}/101-pata-magicbox-cf-driver.patch (100%) rename target/linux/ppc40x/{patches-2.6.30 => patches}/110-kilauea_openwrt_flashmap.patch (100%) rename target/linux/ppc40x/{patches-2.6.30 => patches}/900-backport-fix-annotation-of-pcibios_claim_one_bus.patch (100%) diff --git a/target/linux/ppc40x/config-2.6.30 b/target/linux/ppc40x/config-default similarity index 100% rename from target/linux/ppc40x/config-2.6.30 rename to target/linux/ppc40x/config-default diff --git a/target/linux/ppc40x/patches-2.6.30/001-makalu_ppc40x_simple.patch b/target/linux/ppc40x/patches/001-makalu_ppc40x_simple.patch similarity index 100% rename from target/linux/ppc40x/patches-2.6.30/001-makalu_ppc40x_simple.patch rename to target/linux/ppc40x/patches/001-makalu_ppc40x_simple.patch diff --git a/target/linux/ppc40x/patches-2.6.30/002-kilauea_halekala_ppc40x_simple.patch b/target/linux/ppc40x/patches/002-kilauea_halekala_ppc40x_simple.patch similarity index 100% rename from target/linux/ppc40x/patches-2.6.30/002-kilauea_halekala_ppc40x_simple.patch rename to target/linux/ppc40x/patches/002-kilauea_halekala_ppc40x_simple.patch diff --git a/target/linux/ppc40x/patches-2.6.30/003-powerpc-add-EBC_BXCR_BW-defines.patch b/target/linux/ppc40x/patches/003-powerpc-add-EBC_BXCR_BW-defines.patch similarity index 100% rename from target/linux/ppc40x/patches-2.6.30/003-powerpc-add-EBC_BXCR_BW-defines.patch rename to target/linux/ppc40x/patches/003-powerpc-add-EBC_BXCR_BW-defines.patch diff --git a/target/linux/ppc40x/patches-2.6.30/004-magicbox.patch b/target/linux/ppc40x/patches/004-magicbox.patch similarity index 100% rename from target/linux/ppc40x/patches-2.6.30/004-magicbox.patch rename to target/linux/ppc40x/patches/004-magicbox.patch diff --git a/target/linux/ppc40x/patches-2.6.30/005-openrb.patch b/target/linux/ppc40x/patches/005-openrb.patch similarity index 100% rename from target/linux/ppc40x/patches-2.6.30/005-openrb.patch rename to target/linux/ppc40x/patches/005-openrb.patch diff --git a/target/linux/ppc40x/patches-2.6.30/100-magicbox-ide-driver.patch b/target/linux/ppc40x/patches/100-magicbox-ide-driver.patch similarity index 100% rename from target/linux/ppc40x/patches-2.6.30/100-magicbox-ide-driver.patch rename to target/linux/ppc40x/patches/100-magicbox-ide-driver.patch diff --git a/target/linux/ppc40x/patches-2.6.30/101-pata-magicbox-cf-driver.patch b/target/linux/ppc40x/patches/101-pata-magicbox-cf-driver.patch similarity index 100% rename from target/linux/ppc40x/patches-2.6.30/101-pata-magicbox-cf-driver.patch rename to target/linux/ppc40x/patches/101-pata-magicbox-cf-driver.patch diff --git a/target/linux/ppc40x/patches-2.6.30/110-kilauea_openwrt_flashmap.patch b/target/linux/ppc40x/patches/110-kilauea_openwrt_flashmap.patch similarity index 100% rename from target/linux/ppc40x/patches-2.6.30/110-kilauea_openwrt_flashmap.patch rename to target/linux/ppc40x/patches/110-kilauea_openwrt_flashmap.patch diff --git a/target/linux/ppc40x/patches-2.6.30/900-backport-fix-annotation-of-pcibios_claim_one_bus.patch b/target/linux/ppc40x/patches/900-backport-fix-annotation-of-pcibios_claim_one_bus.patch similarity index 100% rename from target/linux/ppc40x/patches-2.6.30/900-backport-fix-annotation-of-pcibios_claim_one_bus.patch rename to target/linux/ppc40x/patches/900-backport-fix-annotation-of-pcibios_claim_one_bus.patch From dfe29b760d974565e442ae25b5d6f50cd4851fc4 Mon Sep 17 00:00:00 2001 From: nbd Date: Tue, 27 Oct 2009 21:18:58 +0000 Subject: [PATCH 004/288] lua: re-enable host builds with some more fixes git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18189 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/lua/Makefile | 26 ++ .../010-lua-5.1.3-lnum-full-260308.patch | 2 +- .../lua/patches-host/020-shared_liblua.patch | 154 -------- .../patches-host/040-gzip-source-loader.patch | 136 ------- .../lua/patches-host/100-no_readline.patch | 53 --- package/lua/patches-host/200-lua-path.patch | 15 - .../patches-host/300-opcode_performance.patch | 363 ------------------ 7 files changed, 27 insertions(+), 722 deletions(-) delete mode 100644 package/lua/patches-host/020-shared_liblua.patch delete mode 100644 package/lua/patches-host/040-gzip-source-loader.patch delete mode 100644 package/lua/patches-host/100-no_readline.patch delete mode 100644 package/lua/patches-host/200-lua-path.patch delete mode 100644 package/lua/patches-host/300-opcode_performance.patch diff --git a/package/lua/Makefile b/package/lua/Makefile index 4589cfed2..e314341d9 100644 --- a/package/lua/Makefile +++ b/package/lua/Makefile @@ -18,7 +18,10 @@ PKG_SOURCE_URL:=http://www.lua.org/ftp/ \ http://www.tecgraf.puc-rio.br/lua/ftp/ PKG_MD5SUM:=d0870f2de55d59c1c8419f36e8fac150 +HOST_PATCH_DIR := ./patches-host + include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk define Package/lua/Default SUBMENU:=Lua @@ -108,6 +111,27 @@ define Build/Compile install endef +define Build/Configure + $(SED) 's,"/usr/local/","$(STAGING_DIR_HOST)/",' $(HOST_BUILD_DIR)/src/luaconf.h +endef + +LUA_OS.Darwin:=macosx +LUA_OS.FreeBSD:=freebsd +LUA_OS:=$(LUA_OS.$(HOST_OS)) +LUA_OS?=linux + +define Host/Compile + $(MAKE) -C $(HOST_BUILD_DIR) \ + CC="$(HOSTCC) -std=gnu99" \ + $(LUA_OS) +endef + +define Host/Install + $(MAKE) -C $(HOST_BUILD_DIR) \ + INSTALL_TOP="$(STAGING_DIR_HOST)" \ + install +endef + define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include $(CP) $(PKG_INSTALL_DIR)/usr/include/lua{,lib,conf}.h $(1)/usr/include/ @@ -145,3 +169,5 @@ $(eval $(call BuildPackage,liblua)) $(eval $(call BuildPackage,lua)) $(eval $(call BuildPackage,luac)) $(eval $(call BuildPackage,lua-examples)) +$(eval $(call HostBuild)) + diff --git a/package/lua/patches-host/010-lua-5.1.3-lnum-full-260308.patch b/package/lua/patches-host/010-lua-5.1.3-lnum-full-260308.patch index 32c39f3b7..f8d8fc7f1 100644 --- a/package/lua/patches-host/010-lua-5.1.3-lnum-full-260308.patch +++ b/package/lua/patches-host/010-lua-5.1.3-lnum-full-260308.patch @@ -1887,7 +1887,7 @@ Index: lua-5.1.4/src/lnum_config.h +** Default number modes +*/ +#if (!defined LNUM_DOUBLE) && (!defined LNUM_FLOAT) && (!defined LNUM_LDOUBLE) -+# define LNUM_DOUBLE ++# define LNUM_FLOAT +#endif +#if (!defined LNUM_INT16) && (!defined LNUM_INT32) && (!defined LNUM_INT64) +# define LNUM_INT32 diff --git a/package/lua/patches-host/020-shared_liblua.patch b/package/lua/patches-host/020-shared_liblua.patch deleted file mode 100644 index d948841b8..000000000 --- a/package/lua/patches-host/020-shared_liblua.patch +++ /dev/null @@ -1,154 +0,0 @@ -Index: lua-5.1.4/Makefile -=================================================================== ---- lua-5.1.4.orig/Makefile 2008-08-24 16:46:37.000000000 +0200 -+++ lua-5.1.4/Makefile 2008-08-24 16:48:42.000000000 +0200 -@@ -42,8 +42,8 @@ - - # What to install. - TO_BIN= lua luac --TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp --TO_LIB= liblua.a -+TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp lnum_config.h -+TO_LIB= liblua.a liblua.so.$R - TO_MAN= lua.1 luac.1 - - # Lua version and release. -@@ -63,6 +63,7 @@ - cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN) - cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) - cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) -+ ln -s liblua.so.$R $(INSTALL_LIB)/liblua.so - cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) - - ranlib: -Index: lua-5.1.4/src/ldo.h -=================================================================== ---- lua-5.1.4.orig/src/ldo.h 2008-08-24 16:46:37.000000000 +0200 -+++ lua-5.1.4/src/ldo.h 2008-08-24 16:48:42.000000000 +0200 -@@ -46,7 +46,7 @@ - LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult); - LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize); - LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); --LUAI_FUNC void luaD_growstack (lua_State *L, int n); -+LUA_API void luaD_growstack (lua_State *L, int n); - - LUAI_FUNC void luaD_throw (lua_State *L, int errcode); - LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); -Index: lua-5.1.4/src/lfunc.h -=================================================================== ---- lua-5.1.4.orig/src/lfunc.h 2008-08-24 16:46:37.000000000 +0200 -+++ lua-5.1.4/src/lfunc.h 2008-08-24 16:48:42.000000000 +0200 -@@ -18,7 +18,7 @@ - cast(int, sizeof(TValue *)*((n)-1))) - - --LUAI_FUNC Proto *luaF_newproto (lua_State *L); -+LUA_API Proto *luaF_newproto (lua_State *L); - LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e); - LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e); - LUAI_FUNC UpVal *luaF_newupval (lua_State *L); -Index: lua-5.1.4/src/lmem.h -=================================================================== ---- lua-5.1.4.orig/src/lmem.h 2008-08-24 16:46:37.000000000 +0200 -+++ lua-5.1.4/src/lmem.h 2008-08-24 16:48:42.000000000 +0200 -@@ -38,9 +38,9 @@ - ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) - - --LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, -+LUA_API void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, - size_t size); --LUAI_FUNC void *luaM_toobig (lua_State *L); -+LUA_API void *luaM_toobig (lua_State *L); - LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, - size_t size_elem, int limit, - const char *errormsg); -Index: lua-5.1.4/src/lstring.h -=================================================================== ---- lua-5.1.4.orig/src/lstring.h 2008-08-24 16:46:37.000000000 +0200 -+++ lua-5.1.4/src/lstring.h 2008-08-24 16:48:42.000000000 +0200 -@@ -25,7 +25,7 @@ - - LUAI_FUNC void luaS_resize (lua_State *L, int newsize); - LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); --LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); -+LUA_API TString *luaS_newlstr (lua_State *L, const char *str, size_t l); - - - #endif -Index: lua-5.1.4/src/lundump.h -=================================================================== ---- lua-5.1.4.orig/src/lundump.h 2008-08-24 16:46:37.000000000 +0200 -+++ lua-5.1.4/src/lundump.h 2008-08-24 16:48:42.000000000 +0200 -@@ -17,7 +17,7 @@ - LUAI_FUNC void luaU_header (char* h); - - /* dump one chunk; from ldump.c */ --LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); -+LUA_API int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); - - #ifdef luac_c - /* print one chunk; from print.c */ -Index: lua-5.1.4/src/Makefile -=================================================================== ---- lua-5.1.4.orig/src/Makefile 2008-08-24 16:48:20.000000000 +0200 -+++ lua-5.1.4/src/Makefile 2008-08-24 16:48:42.000000000 +0200 -@@ -23,6 +23,7 @@ - PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris - - LUA_A= liblua.a -+LUA_SO= liblua.so - CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \ - lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \ - lundump.o lvm.o lzio.o lnum.o -@@ -33,11 +34,12 @@ - LUA_O= lua.o - - LUAC_T= luac --LUAC_O= luac.o print.o -+LUAC_O= luac.o print.o lopcodes.o - - ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O) --ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) -+ALL_T= $(LUA_A) $(LUA_SO) $(LUA_T) $(LUAC_T) - ALL_A= $(LUA_A) -+ALL_SO= $(LUA_SO) - - default: $(PLAT) - -@@ -47,14 +49,23 @@ - - a: $(ALL_A) - -+so: $(ALL_SO) -+ - $(LUA_A): $(CORE_O) $(LIB_O) - $(AR) $@ $? - $(RANLIB) $@ - --$(LUA_T): $(LUA_O) $(LUA_A) -- $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) -+$(LUA_SO): $(CORE_O) $(LIB_O) -+ $(CC) -o $@.$(PKG_VERSION) -shared -soname="$@.$(PKG_VERSION)" $? -nostdlib -lgcc -+ ln -fs $@.$(PKG_VERSION) $@ -+ -+$(LUA_T): $(LUA_O) $(LUA_SO) -+ $(CC) -o $@ -L. -llua $(MYLDFLAGS) $(LUA_O) $(LIBS) -+ -+$(LUAC_T): $(LUAC_O) $(LUA_SO) -+ $(CC) -o $@ -L. -llua $(MYLDFLAGS) $(LUAC_O) $(LIBS) - --$(LUAC_T): $(LUAC_O) $(LUA_A) -+$(LUAC_T)-host: $(LUAC_O) $(LUA_A) - $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) - - clean: -@@ -96,7 +107,7 @@ - $(MAKE) all MYCFLAGS= - - linux: -- $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" -+ $(MAKE) all MYCFLAGS+=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" - - macosx: - $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline" diff --git a/package/lua/patches-host/040-gzip-source-loader.patch b/package/lua/patches-host/040-gzip-source-loader.patch deleted file mode 100644 index 8214ae9f8..000000000 --- a/package/lua/patches-host/040-gzip-source-loader.patch +++ /dev/null @@ -1,136 +0,0 @@ -diff -ur lua-5.1.4.orig/src/Makefile lua-5.1.4/src/Makefile ---- lua-5.1.4.orig/src/Makefile 2009-04-04 23:06:04.000000000 +0200 -+++ lua-5.1.4/src/Makefile 2009-04-04 23:06:15.000000000 +0200 -@@ -12,7 +12,7 @@ - AR= ar rcu - RANLIB= ranlib - RM= rm -f --LIBS= -lm $(MYLIBS) -+LIBS= -lm -lz $(MYLIBS) - - MYCFLAGS= - MYLDFLAGS= -diff -ur lua-5.1.4.orig/src/lauxlib.c lua-5.1.4/src/lauxlib.c ---- lua-5.1.4.orig/src/lauxlib.c 2009-04-04 23:06:04.000000000 +0200 -+++ lua-5.1.4/src/lauxlib.c 2009-04-05 03:35:24.000000000 +0200 -@@ -11,6 +11,7 @@ - #include - #include - #include -+#include - - - /* This file uses only the official API of Lua. -@@ -535,6 +536,12 @@ - char buff[LUAL_BUFFERSIZE]; - } LoadF; - -+typedef struct LoadGZ { -+ int first_chunk; -+ gzFile f; -+ char buffer[LUAL_GZLDBUFFER]; -+} LoadGZ; -+ - - static const char *getF (lua_State *L, void *ud, size_t *size) { - LoadF *lf = (LoadF *)ud; -@@ -550,6 +557,28 @@ - } - - -+static const char *getGZ (lua_State *L, void *ud, size_t *size) { -+ LoadGZ *lf = (LoadGZ *)ud; -+ char *sp = 0; -+ (void)L; -+ if (gzeof(lf->f)) return NULL; -+ *size = gzread(lf->f, lf->buffer, sizeof(lf->buffer)); -+ if (*size > 0) { -+ if (lf->first_chunk) { -+ lf->first_chunk = 0; -+ if ((lf->buffer[0] == '#') && (lf->buffer[1] == '!') && -+ (sp=strstr(lf->buffer, "\n")) != NULL) -+ { -+ *size -= ((uint)sp - (uint)lf->buffer); -+ return sp; -+ } -+ } -+ return lf->buffer; -+ } -+ return NULL; -+} -+ -+ - static int errfile (lua_State *L, const char *what, int fnameindex) { - const char *serr = strerror(errno); - const char *filename = lua_tostring(L, fnameindex) + 1; -@@ -560,6 +589,31 @@ - - - LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) { -+ if ((filename != NULL) && strstr(filename, ".lua.gz")) { -+ return luaL_loadfile_gzip(L, filename); -+ } -+ else { -+ return luaL_loadfile_plain(L, filename); -+ } -+} -+ -+ -+LUALIB_API int luaL_loadfile_gzip (lua_State *L, const char *filename) { -+ LoadGZ gzf; -+ int status; -+ int fnameindex = lua_gettop(L) + 1; /* index of filename on the stack */ -+ lua_pushfstring(L, "@%s", filename); -+ gzf.f = gzopen(filename, "r"); -+ gzf.first_chunk = 1; -+ if (gzf.f == Z_NULL) return errfile(L, "open", fnameindex); -+ status = lua_load(L, getGZ, &gzf, lua_tostring(L, -1)); -+ (void)gzclose(gzf.f); -+ lua_remove(L, fnameindex); -+ return status; -+} -+ -+ -+LUALIB_API int luaL_loadfile_plain (lua_State *L, const char *filename) { - LoadF lf; - int status, readstatus; - int c; -diff -ur lua-5.1.4.orig/src/lauxlib.h lua-5.1.4/src/lauxlib.h ---- lua-5.1.4.orig/src/lauxlib.h 2009-04-04 23:06:04.000000000 +0200 -+++ lua-5.1.4/src/lauxlib.h 2009-04-04 23:06:15.000000000 +0200 -@@ -81,6 +81,8 @@ - LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref); - - LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename); -+LUALIB_API int (luaL_loadfile_gzip) (lua_State *L, const char *filename); -+LUALIB_API int (luaL_loadfile_plain) (lua_State *L, const char *filename); - LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz, - const char *name); - LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); -diff -ur lua-5.1.4.orig/src/luaconf.h lua-5.1.4/src/luaconf.h ---- lua-5.1.4.orig/src/luaconf.h 2009-04-04 23:06:04.000000000 +0200 -+++ lua-5.1.4/src/luaconf.h 2009-04-04 23:27:20.000000000 +0200 -@@ -101,7 +101,9 @@ - #define LUA_CDIR LUA_ROOT "lib/lua/5.1/" - #define LUA_PATH_DEFAULT \ - "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ -- LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua" -+ LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ -+ "./?.lua.gz;" LUA_LDIR"?.lua.gz;" LUA_LDIR"?/init.lua.gz;" \ -+ LUA_CDIR"?.lua.gz;" LUA_CDIR"?/init.lua.gz" - #define LUA_CPATH_DEFAULT \ - "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so" - #endif -@@ -506,6 +508,12 @@ - */ - #define LUAL_BUFFERSIZE BUFSIZ - -+ -+/* -+@@ LUAL_GZLDBUFFER is the buffer size used by the gzip source loader. -+*/ -+#define LUAL_GZLDBUFFER 8192 -+ - /* }================================================================== */ - - diff --git a/package/lua/patches-host/100-no_readline.patch b/package/lua/patches-host/100-no_readline.patch deleted file mode 100644 index 7368187d8..000000000 --- a/package/lua/patches-host/100-no_readline.patch +++ /dev/null @@ -1,53 +0,0 @@ -diff -ur lua-luci-5.1.3/src/luaconf.h lua-luci-5.1.3-new/src/luaconf.h ---- lua-luci-5.1.3/src/luaconf.h 2008-04-14 13:19:54.000000000 +0200 -+++ lua-luci-5.1.3-new/src/luaconf.h 2008-04-14 13:19:17.000000000 +0200 -@@ -38,7 +38,6 @@ - #if defined(LUA_USE_LINUX) - #define LUA_USE_POSIX - #define LUA_USE_DLOPEN /* needs an extra library: -ldl */ --#define LUA_USE_READLINE /* needs some extra libraries */ - #endif - - #if defined(LUA_USE_MACOSX) -Nur in lua-luci-5.1.3-new/src: luaconf.h.orig. -diff -ur lua-luci-5.1.3/src/Makefile lua-luci-5.1.3-new/src/Makefile ---- lua-luci-5.1.3/src/Makefile 2008-04-14 13:19:57.000000000 +0200 -+++ lua-luci-5.1.3-new/src/Makefile 2008-04-14 13:19:17.000000000 +0200 -@@ -17,6 +17,7 @@ - MYCFLAGS= - MYLDFLAGS= - MYLIBS= -+# USE_READLINE=1 - - # == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE ========= - -@@ -86,7 +87,7 @@ - @echo "MYLIBS = $(MYLIBS)" - - # convenience targets for popular platforms -- -+RFLAG=$(if $(USE_READLINE),-DLUA_USE_READLINE) - none: - @echo "Please choose a platform:" - @echo " $(PLATS)" -@@ -101,16 +102,16 @@ - $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-Wl,-E" - - freebsd: -- $(MAKE) all MYCFLAGS="-DLUA_USE_LINUX" MYLIBS="-Wl,-E -lreadline" -+ $(MAKE) all MYCFLAGS="-DLUA_USE_LINUX $(RFLAG)" MYLIBS="-Wl,-E$(if $(USE_READLINE), -lreadline)" - - generic: - $(MAKE) all MYCFLAGS= - - linux: -- $(MAKE) all MYCFLAGS+=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" -+ $(MAKE) all MYCFLAGS+="-DLUA_USE_LINUX $(RFLAG)" MYLIBS="-Wl,-E -ldl $(if $(USE_READLINE), -lreadline -lhistory -lncurses)" - - macosx: -- $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline" -+ $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX $(if $(USE_READLINE), MYLIBS="-lreadline") - # use this on Mac OS X 10.3- - # $(MAKE) all MYCFLAGS=-DLUA_USE_MACOSX - -Nur in lua-luci-5.1.3-new/src: Makefile.orig. diff --git a/package/lua/patches-host/200-lua-path.patch b/package/lua/patches-host/200-lua-path.patch deleted file mode 100644 index 62dd00e39..000000000 --- a/package/lua/patches-host/200-lua-path.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- b/src/luaconf.h 2008-05-06 20:10:46.000000000 +0200 -+++ a/src/luaconf.h 2008-05-06 20:10:27.000000000 +0200 -@@ -95,9 +95,9 @@ - ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll" - - #else --#define LUA_ROOT "/usr/local/" --#define LUA_LDIR LUA_ROOT "share/lua/5.1/" --#define LUA_CDIR LUA_ROOT "lib/lua/5.1/" -+#define LUA_ROOT "/usr/" -+#define LUA_LDIR LUA_ROOT "share/lua/" -+#define LUA_CDIR LUA_ROOT "lib/lua/" - #define LUA_PATH_DEFAULT \ - "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ - LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua" diff --git a/package/lua/patches-host/300-opcode_performance.patch b/package/lua/patches-host/300-opcode_performance.patch deleted file mode 100644 index f6204ae19..000000000 --- a/package/lua/patches-host/300-opcode_performance.patch +++ /dev/null @@ -1,363 +0,0 @@ ---- a/src/lvm.c -+++ b/src/lvm.c -@@ -31,6 +31,9 @@ - /* limit for table tag-method chains (to avoid loops) */ - #define MAXTAGLOOP 100 - -+#ifdef __GNUC__ -+#define COMPUTED_GOTO 1 -+#endif - - /* - * If 'obj' is a string, it is tried to be interpreted as a number. -@@ -562,12 +565,63 @@ - ARITH_OP1_END - #endif - -+#ifdef COMPUTED_GOTO -+#define OPCODE_TARGET(op) DO_OP_##op: -+#define CALL_OPCODE(op) goto *opcodes[op]; -+#define OPCODE_PTR(op) [OP_##op] = &&DO_OP_##op -+#else -+#define OPCODE_TARGET(op) case OP_##op: -+#define CALL_OPCODE(op) switch (op) -+#endif -+ - - void luaV_execute (lua_State *L, int nexeccalls) { - LClosure *cl; - StkId base; - TValue *k; - const Instruction *pc; -+#ifdef COMPUTED_GOTO -+ static const void *opcodes[] = { -+ OPCODE_PTR(MOVE), -+ OPCODE_PTR(LOADK), -+ OPCODE_PTR(LOADBOOL), -+ OPCODE_PTR(LOADNIL), -+ OPCODE_PTR(GETUPVAL), -+ OPCODE_PTR(GETGLOBAL), -+ OPCODE_PTR(GETTABLE), -+ OPCODE_PTR(SETGLOBAL), -+ OPCODE_PTR(SETUPVAL), -+ OPCODE_PTR(SETTABLE), -+ OPCODE_PTR(NEWTABLE), -+ OPCODE_PTR(SELF), -+ OPCODE_PTR(ADD), -+ OPCODE_PTR(SUB), -+ OPCODE_PTR(MUL), -+ OPCODE_PTR(DIV), -+ OPCODE_PTR(MOD), -+ OPCODE_PTR(POW), -+ OPCODE_PTR(UNM), -+ OPCODE_PTR(NOT), -+ OPCODE_PTR(LEN), -+ OPCODE_PTR(CONCAT), -+ OPCODE_PTR(JMP), -+ OPCODE_PTR(EQ), -+ OPCODE_PTR(LT), -+ OPCODE_PTR(LE), -+ OPCODE_PTR(TEST), -+ OPCODE_PTR(TESTSET), -+ OPCODE_PTR(CALL), -+ OPCODE_PTR(TAILCALL), -+ OPCODE_PTR(RETURN), -+ OPCODE_PTR(FORLOOP), -+ OPCODE_PTR(FORPREP), -+ OPCODE_PTR(TFORLOOP), -+ OPCODE_PTR(SETLIST), -+ OPCODE_PTR(CLOSE), -+ OPCODE_PTR(CLOSURE), -+ OPCODE_PTR(VARARG) -+ }; -+#endif - reentry: /* entry point */ - lua_assert(isLua(L->ci)); - pc = L->savedpc; -@@ -592,33 +646,33 @@ - lua_assert(base == L->base && L->base == L->ci->base); - lua_assert(base <= L->top && L->top <= L->stack + L->stacksize); - lua_assert(L->top == L->ci->top || luaG_checkopenop(i)); -- switch (GET_OPCODE(i)) { -- case OP_MOVE: { -+ CALL_OPCODE(GET_OPCODE(i)) { -+ OPCODE_TARGET(MOVE) { - setobjs2s(L, ra, RB(i)); - continue; - } -- case OP_LOADK: { -+ OPCODE_TARGET(LOADK) { - setobj2s(L, ra, KBx(i)); - continue; - } -- case OP_LOADBOOL: { -+ OPCODE_TARGET(LOADBOOL) { - setbvalue(ra, GETARG_B(i)); - if (GETARG_C(i)) pc++; /* skip next instruction (if C) */ - continue; - } -- case OP_LOADNIL: { -+ OPCODE_TARGET(LOADNIL) { - TValue *rb = RB(i); - do { - setnilvalue(rb--); - } while (rb >= ra); - continue; - } -- case OP_GETUPVAL: { -+ OPCODE_TARGET(GETUPVAL) { - int b = GETARG_B(i); - setobj2s(L, ra, cl->upvals[b]->v); - continue; - } -- case OP_GETGLOBAL: { -+ OPCODE_TARGET(GETGLOBAL) { - TValue g; - TValue *rb = KBx(i); - sethvalue(L, &g, cl->env); -@@ -626,88 +680,88 @@ - Protect(luaV_gettable(L, &g, rb, ra)); - continue; - } -- case OP_GETTABLE: { -+ OPCODE_TARGET(GETTABLE) { - Protect(luaV_gettable(L, RB(i), RKC(i), ra)); - continue; - } -- case OP_SETGLOBAL: { -+ OPCODE_TARGET(SETGLOBAL) { - TValue g; - sethvalue(L, &g, cl->env); - lua_assert(ttisstring(KBx(i))); - Protect(luaV_settable(L, &g, KBx(i), ra)); - continue; - } -- case OP_SETUPVAL: { -+ OPCODE_TARGET(SETUPVAL) { - UpVal *uv = cl->upvals[GETARG_B(i)]; - setobj(L, uv->v, ra); - luaC_barrier(L, uv, ra); - continue; - } -- case OP_SETTABLE: { -+ OPCODE_TARGET(SETTABLE) { - Protect(luaV_settable(L, ra, RKB(i), RKC(i))); - continue; - } -- case OP_NEWTABLE: { -+ OPCODE_TARGET(NEWTABLE) { - int b = GETARG_B(i); - int c = GETARG_C(i); - sethvalue(L, ra, luaH_new(L, luaO_fb2int(b), luaO_fb2int(c))); - Protect(luaC_checkGC(L)); - continue; - } -- case OP_SELF: { -+ OPCODE_TARGET(SELF) { - StkId rb = RB(i); - setobjs2s(L, ra+1, rb); - Protect(luaV_gettable(L, rb, RKC(i), ra)); - continue; - } -- case OP_ADD: { -+ OPCODE_TARGET(ADD) { - TValue *rb = RKB(i), *rc= RKC(i); - arith_op_continue( luai_numadd, try_addint, luai_vectadd ); - Protect(Arith(L, ra, rb, rc, TM_ADD)); \ - continue; - } -- case OP_SUB: { -+ OPCODE_TARGET(SUB) { - TValue *rb = RKB(i), *rc= RKC(i); - arith_op_continue( luai_numsub, try_subint, luai_vectsub ); - Protect(Arith(L, ra, rb, rc, TM_SUB)); - continue; - } -- case OP_MUL: { -+ OPCODE_TARGET(MUL) { - TValue *rb = RKB(i), *rc= RKC(i); - arith_op_continue(luai_nummul, try_mulint, luai_vectmul); - Protect(Arith(L, ra, rb, rc, TM_MUL)); - continue; - } -- case OP_DIV: { -+ OPCODE_TARGET(DIV) { - TValue *rb = RKB(i), *rc= RKC(i); - arith_op_continue(luai_numdiv, try_divint, luai_vectdiv); - Protect(Arith(L, ra, rb, rc, TM_DIV)); - continue; - } -- case OP_MOD: { -+ OPCODE_TARGET(MOD) { - TValue *rb = RKB(i), *rc= RKC(i); - arith_op_continue_scalar(luai_nummod, try_modint); /* scalars only */ - Protect(Arith(L, ra, rb, rc, TM_MOD)); - continue; - } -- case OP_POW: { -+ OPCODE_TARGET(POW) { - TValue *rb = RKB(i), *rc= RKC(i); - arith_op_continue(luai_numpow, try_powint, luai_vectpow); - Protect(Arith(L, ra, rb, rc, TM_POW)); - continue; - } -- case OP_UNM: { -+ OPCODE_TARGET(UNM) { - TValue *rb = RB(i); - arith_op1_continue(luai_numunm, try_unmint, luai_vectunm); - Protect(Arith(L, ra, rb, rb, TM_UNM)); - continue; - } -- case OP_NOT: { -+ OPCODE_TARGET(NOT) { - int res = l_isfalse(RB(i)); /* next assignment may change this value */ - setbvalue(ra, res); - continue; - } -- case OP_LEN: { -+ OPCODE_TARGET(LEN) { - const TValue *rb = RB(i); - switch (ttype(rb)) { - case LUA_TTABLE: { -@@ -727,18 +781,18 @@ - } - continue; - } -- case OP_CONCAT: { -+ OPCODE_TARGET(CONCAT) { - int b = GETARG_B(i); - int c = GETARG_C(i); - Protect(luaV_concat(L, c-b+1, c); luaC_checkGC(L)); - setobjs2s(L, RA(i), base+b); - continue; - } -- case OP_JMP: { -+ OPCODE_TARGET(JMP) { - dojump(L, pc, GETARG_sBx(i)); - continue; - } -- case OP_EQ: { -+ OPCODE_TARGET(EQ) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - Protect( -@@ -748,7 +802,7 @@ - pc++; - continue; - } -- case OP_LT: { -+ OPCODE_TARGET(LT) { - Protect( - if (luaV_lessthan(L, RKB(i), RKC(i)) == GETARG_A(i)) - dojump(L, pc, GETARG_sBx(*pc)); -@@ -756,7 +810,7 @@ - pc++; - continue; - } -- case OP_LE: { -+ OPCODE_TARGET(LE) { - Protect( - if (lessequal(L, RKB(i), RKC(i)) == GETARG_A(i)) - dojump(L, pc, GETARG_sBx(*pc)); -@@ -764,13 +818,13 @@ - pc++; - continue; - } -- case OP_TEST: { -+ OPCODE_TARGET(TEST) { - if (l_isfalse(ra) != GETARG_C(i)) - dojump(L, pc, GETARG_sBx(*pc)); - pc++; - continue; - } -- case OP_TESTSET: { -+ OPCODE_TARGET(TESTSET) { - TValue *rb = RB(i); - if (l_isfalse(rb) != GETARG_C(i)) { - setobjs2s(L, ra, rb); -@@ -779,7 +833,7 @@ - pc++; - continue; - } -- case OP_CALL: { -+ OPCODE_TARGET(CALL) { - int b = GETARG_B(i); - int nresults = GETARG_C(i) - 1; - if (b != 0) L->top = ra+b; /* else previous instruction set top */ -@@ -800,7 +854,7 @@ - } - } - } -- case OP_TAILCALL: { -+ OPCODE_TARGET(TAILCALL) { - int b = GETARG_B(i); - if (b != 0) L->top = ra+b; /* else previous instruction set top */ - L->savedpc = pc; -@@ -832,7 +886,7 @@ - } - } - } -- case OP_RETURN: { -+ OPCODE_TARGET(RETURN) { - int b = GETARG_B(i); - if (b != 0) L->top = ra+b-1; - if (L->openupval) luaF_close(L, base); -@@ -847,7 +901,7 @@ - goto reentry; - } - } -- case OP_FORLOOP: { -+ OPCODE_TARGET(FORLOOP) { - /* If start,step and limit are all integers, we don't need to check - * against overflow in the looping. - */ -@@ -875,7 +929,7 @@ - } - continue; - } -- case OP_FORPREP: { -+ OPCODE_TARGET(FORPREP) { - const TValue *init = ra; - const TValue *plimit = ra+1; - const TValue *pstep = ra+2; -@@ -898,7 +952,7 @@ - dojump(L, pc, GETARG_sBx(i)); - continue; - } -- case OP_TFORLOOP: { -+ OPCODE_TARGET(TFORLOOP) { - StkId cb = ra + 3; /* call base */ - setobjs2s(L, cb+2, ra+2); - setobjs2s(L, cb+1, ra+1); -@@ -914,7 +968,7 @@ - pc++; - continue; - } -- case OP_SETLIST: { -+ OPCODE_TARGET(SETLIST) { - int n = GETARG_B(i); - int c = GETARG_C(i); - int last; -@@ -936,11 +990,11 @@ - } - continue; - } -- case OP_CLOSE: { -+ OPCODE_TARGET(CLOSE) { - luaF_close(L, ra); - continue; - } -- case OP_CLOSURE: { -+ OPCODE_TARGET(CLOSURE) { - Proto *p; - Closure *ncl; - int nup, j; -@@ -960,7 +1014,7 @@ - Protect(luaC_checkGC(L)); - continue; - } -- case OP_VARARG: { -+ OPCODE_TARGET(VARARG) { - int b = GETARG_B(i) - 1; - int j; - CallInfo *ci = L->ci; From 8f4d88ab8d83d28ef298c1f3f787678174876016 Mon Sep 17 00:00:00 2001 From: nbd Date: Tue, 27 Oct 2009 21:28:15 +0000 Subject: [PATCH 005/288] lua: fix a typo git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18190 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/lua/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/lua/Makefile b/package/lua/Makefile index e314341d9..9d9c77b9e 100644 --- a/package/lua/Makefile +++ b/package/lua/Makefile @@ -111,7 +111,7 @@ define Build/Compile install endef -define Build/Configure +define Host/Configure $(SED) 's,"/usr/local/","$(STAGING_DIR_HOST)/",' $(HOST_BUILD_DIR)/src/luaconf.h endef From 05ccb6dea8ad8550f2b61bfe3db9dcc825cc5643 Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 27 Oct 2009 22:50:34 +0000 Subject: [PATCH 006/288] [package] fix siit compile with 2.6.30 kernels and superior, when CONFIG_COMPAT_NET_DEV_OPS is not set git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18191 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/siit/src/siit.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/package/siit/src/siit.c b/package/siit/src/siit.c index dddc8ef87..c645a2580 100644 --- a/package/siit/src/siit.c +++ b/package/siit/src/siit.c @@ -1386,10 +1386,19 @@ static bool header_ops_init = false; static struct header_ops siit_header_ops ____cacheline_aligned; #endif +#ifndef CONFIG_COMPAT_NET_DEV_OPS +static const struct net_device_ops siit_netdev_ops = { + .ndo_open = siit_open, + .ndo_stop = siit_release, + .ndo_start_xmit = siit_xmit, +}; +#endif + /* * The init function initialize of the SIIT device.. * It is invoked by register_netdev() */ + static void siit_init(struct net_device *dev) { @@ -1399,9 +1408,15 @@ siit_init(struct net_device *dev) /* * Assign device function. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) dev->open = siit_open; dev->stop = siit_release; dev->hard_start_xmit = siit_xmit; +#else +#ifndef CONFIG_COMPAT_NET_DEV_OPS + dev->netdev_ops = &siit_netdev_ops; +#endif +#endif dev->flags |= IFF_NOARP; /* ARP not used */ dev->tx_queue_len = 10; From abc16b03ee0fd6e47ed92b09b6eb457c2f0895e8 Mon Sep 17 00:00:00 2001 From: jow Date: Wed, 28 Oct 2009 00:11:59 +0000 Subject: [PATCH 007/288] [package] lua: the variable expansion to detect the host os does not work with GNU Make 3.81, replace it with a nested ifeq git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18193 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/lua/Makefile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/package/lua/Makefile b/package/lua/Makefile index 9d9c77b9e..c8c64badf 100644 --- a/package/lua/Makefile +++ b/package/lua/Makefile @@ -115,10 +115,15 @@ define Host/Configure $(SED) 's,"/usr/local/","$(STAGING_DIR_HOST)/",' $(HOST_BUILD_DIR)/src/luaconf.h endef -LUA_OS.Darwin:=macosx -LUA_OS.FreeBSD:=freebsd -LUA_OS:=$(LUA_OS.$(HOST_OS)) -LUA_OS?=linux +ifeq ($(HOST_OS),Darwin) + LUA_OS:=macosx +else + ifeq ($(HOST_OS),FreeBSD) + LUA_OS:=freebsd + else + LUA_OS:=linux + endif +endif define Host/Compile $(MAKE) -C $(HOST_BUILD_DIR) \ From 699212b7b42faa56e6ecbeaf36079f9ed2fe4640 Mon Sep 17 00:00:00 2001 From: jow Date: Wed, 28 Oct 2009 13:56:33 +0000 Subject: [PATCH 008/288] [package] lua: add the 100-no_readline.patch to host build git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18195 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../lua/patches-host/100-no_readline.patch | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 package/lua/patches-host/100-no_readline.patch diff --git a/package/lua/patches-host/100-no_readline.patch b/package/lua/patches-host/100-no_readline.patch new file mode 100644 index 000000000..209c302bb --- /dev/null +++ b/package/lua/patches-host/100-no_readline.patch @@ -0,0 +1,49 @@ +--- a/src/luaconf.h ++++ b/src/luaconf.h +@@ -38,7 +38,6 @@ + #if defined(LUA_USE_LINUX) + #define LUA_USE_POSIX + #define LUA_USE_DLOPEN /* needs an extra library: -ldl */ +-#define LUA_USE_READLINE /* needs some extra libraries */ + #endif + + #if defined(LUA_USE_MACOSX) +--- a/src/Makefile ++++ b/src/Makefile +@@ -17,6 +17,7 @@ + MYCFLAGS= + MYLDFLAGS= + MYLIBS= ++# USE_READLINE=1 + + # == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE ========= + +@@ -75,7 +76,7 @@ + @echo "MYLIBS = $(MYLIBS)" + + # convenience targets for popular platforms +- ++RFLAG=$(if $(USE_READLINE),-DLUA_USE_READLINE) + none: + @echo "Please choose a platform:" + @echo " $(PLATS)" +@@ -90,16 +91,16 @@ + $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-Wl,-E" + + freebsd: +- $(MAKE) all MYCFLAGS="-DLUA_USE_LINUX" MYLIBS="-Wl,-E -lreadline" ++ $(MAKE) all MYCFLAGS="-DLUA_USE_LINUX" $(RFLAG)" MYLIBS="-Wl,-E$(if $(USE_READLINE), -lreadline)" + + generic: + $(MAKE) all MYCFLAGS= + + linux: +- $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" ++ $(MAKE) all MYCFLAGS="-DLUA_USE_LINUX $(RFLAG)" MYLIBS="-Wl,-E -ldl $(if $(USE_READLINE), -lreadline -lhistory -lncurses)" + + macosx: +- $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline" ++ $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX $(if $(USE_READLINE), MYLIBS="-lreadline") + # use this on Mac OS X 10.3- + # $(MAKE) all MYCFLAGS=-DLUA_USE_MACOSX + From a42b873f24633458128fa1602350772290bdfc0f Mon Sep 17 00:00:00 2001 From: blogic Date: Wed, 28 Oct 2009 15:10:30 +0000 Subject: [PATCH 009/288] fixes DEPENDS of SSB module, thx sn9 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18196 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/kernel/modules/other.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/modules/other.mk b/package/kernel/modules/other.mk index 58b0561bc..3d2985060 100644 --- a/package/kernel/modules/other.mk +++ b/package/kernel/modules/other.mk @@ -229,7 +229,7 @@ $(eval $(call KernelPackage,pcmcia-serial)) define KernelPackage/ssb SUBMENU:=$(OTHER_MENU) TITLE:=Silicon Sonics Backplane glue code - DEPENDS:=@LINUX_2_6 @PCI_SUPPORT @!TARGET_brcm47xx||!TARGET_brcm63xx + DEPENDS:=@LINUX_2_6 @PCI_SUPPORT @!TARGET_brcm47xx @!TARGET_brcm63xx KCONFIG:=\ CONFIG_SSB \ CONFIG_SSB_B43_PCI_BRIDGE=y \ From 6ae3b70899e2b7dc7e740c959a8a4f8ade038e73 Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 29 Oct 2009 10:43:14 +0000 Subject: [PATCH 010/288] [kernel] move the forward declaration of struct mtd_info, prevents build failures on arm and mips git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18198 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../082-mtd_info_move_forward_decl.patch | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 target/linux/generic-2.6/patches-2.6.31/082-mtd_info_move_forward_decl.patch diff --git a/target/linux/generic-2.6/patches-2.6.31/082-mtd_info_move_forward_decl.patch b/target/linux/generic-2.6/patches-2.6.31/082-mtd_info_move_forward_decl.patch new file mode 100644 index 000000000..fc69082ec --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.31/082-mtd_info_move_forward_decl.patch @@ -0,0 +1,18 @@ +--- a/include/linux/mtd/partitions.h 2009-10-29 11:24:29.000000000 +0100 ++++ b/include/linux/mtd/partitions.h 2009-10-29 11:26:35.000000000 +0100 +@@ -33,6 +33,7 @@ + * Note: writeable partitions require their size and offset be + * erasesize aligned (e.g. use MTDPART_OFS_NEXTBLK). + */ ++struct mtd_info; + + struct mtd_partition; + struct mtd_partition { +@@ -49,7 +50,6 @@ + #define MTDPART_SIZ_FULL (0) + + +-struct mtd_info; + + int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int); + int del_mtd_partitions(struct mtd_info *); From 4a72ea39d66c956670387a59623990d9c6ee6397 Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 29 Oct 2009 10:55:52 +0000 Subject: [PATCH 011/288] [kernel] fix build failure on vmlinux.lds with 2.6.31 (#6052) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18199 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches-2.6.31/032-mips_vmlinux_lds.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 target/linux/generic-2.6/patches-2.6.31/032-mips_vmlinux_lds.patch diff --git a/target/linux/generic-2.6/patches-2.6.31/032-mips_vmlinux_lds.patch b/target/linux/generic-2.6/patches-2.6.31/032-mips_vmlinux_lds.patch new file mode 100644 index 000000000..cfe2a4d6c --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.31/032-mips_vmlinux_lds.patch @@ -0,0 +1,37 @@ +diff -Nru linux-2.6.31.5/arch/mips/kernel/Makefile linux-2.6.31.5.new/arch/mips/kernel/Makefile +--- linux-2.6.31.5/arch/mips/kernel/Makefile 2009-10-25 12:35:46.137368384 +0200 ++++ linux-2.6.31.5.new/arch/mips/kernel/Makefile 2009-10-25 15:24:04.713493469 +0200 +@@ -2,6 +2,8 @@ + # Makefile for the Linux/MIPS kernel. + # + ++CPPFLAGS_vmlinux.lds := $(KBUILD_CFLAGS) $(EXTRA_LDSFLAGS) ++ + extra-y := head.o init_task.o vmlinux.lds + + obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \ +diff -Nru linux-2.6.31.5/arch/mips/kernel/vmlinux.lds.S linux-2.6.31.5.new/arch/mips/kernel/vmlinux.lds.S +--- linux-2.6.31.5/arch/mips/kernel/vmlinux.lds.S 2009-10-23 01:57:56.000000000 +0300 ++++ linux-2.6.31.5.new/arch/mips/kernel/vmlinux.lds.S 2009-10-25 15:26:11.631618513 +0200 +@@ -10,15 +10,15 @@ + note PT_NOTE FLAGS(4); /* R__ */ + } + +-ifdef CONFIG_32BIT +- ifdef CONFIG_CPU_LITTLE_ENDIAN ++#ifdef CONFIG_32BIT ++ #ifdef CONFIG_CPU_LITTLE_ENDIAN + jiffies = jiffies_64; +- else ++ #else + jiffies = jiffies_64 + 4; +- endif +-else ++ #endif ++#else + jiffies = jiffies_64; +-endif ++#endif + + SECTIONS + { From 24168b91595c0c5a9420c348c4c16e727e1aaa81 Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 29 Oct 2009 12:20:45 +0000 Subject: [PATCH 012/288] [kernel] remove support for 2.6.27, no target is using it anymore git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18201 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- include/kernel-version.mk | 3 - target/linux/generic-2.6/config-2.6.27 | 2245 ----- .../files-2.6.27/drivers/char/gpio_dev.c | 201 - .../drivers/input/misc/gpio_buttons.c | 209 - .../files-2.6.27/drivers/leds/leds-alix.c | 172 - .../files-2.6.27/drivers/leds/ledtrig-morse.c | 365 - .../drivers/leds/ledtrig-netdev.c | 451 - .../files-2.6.27/include/linux/gpio_buttons.h | 35 - .../files-2.6.27/include/linux/gpio_dev.h | 11 - .../patches-2.6.27/001-squashfs.patch | 4170 --------- .../patches-2.6.27/002-lzma_decompress.patch | 780 -- .../patches-2.6.27/003-squashfs_lzma.patch | 107 - .../004-extra_optimization.patch | 12 - .../patches-2.6.27/005-squashfs_fix.patch | 29 - .../patches-2.6.27/006-gcc4_inline_fix.patch | 11 - .../patches-2.6.27/007-samsung_flash.patch | 36 - .../008-squashfs_vfs_super.patch | 11 - ...0-disable_old_squashfs_compatibility.patch | 19 - .../patches-2.6.27/011-mips_boot.patch | 11 - .../020-mips_multi_machine_support.patch | 133 - .../021-mips_image_cmdline_hack.patch | 28 - .../022-mips_div64_gcc4.4.0.patch | 171 - .../023-mips_delay_gcc4.4.0.patch | 152 - .../patches-2.6.27/024-mips_disable_fpu.patch | 155 - .../patches-2.6.27/060-block2mtd_init.patch | 110 - .../patches-2.6.27/065-rootfs_split.patch | 624 -- .../patches-2.6.27/070-redboot_space.patch | 30 - .../071-redboot_boardconfig.patch | 60 - .../080-mtd_plat_nand_chip_fixup.patch | 32 - .../081-mtd_myloader_partition_parser.patch | 35 - .../patches-2.6.27/090-ds1672_new_style.patch | 227 - .../091-ds1672_missing_id_table.patch | 21 - .../100-netfilter_layer7_2.21.patch | 2132 ----- .../101-netfilter_layer7_pktmatch.patch | 108 - .../patches-2.6.27/150-netfilter_imq.patch | 1263 --- .../180-netfilter_depends.patch | 20 - .../patches-2.6.27/190-netfilter_rtsp.patch | 1366 --- .../patches-2.6.27/200-sched_esfq.patch | 795 -- .../202-mips-freestanding.patch | 12 - .../patches-2.6.27/204-jffs2_eofdetect.patch | 132 - .../207-powerpc_asm_segment_h.patch | 9 - .../patches-2.6.27/208-rtl8110sb_fix.patch | 44 - .../patches-2.6.27/209-mini_fo.patch | 7776 ----------------- .../210-mini_fo_2.6.25_fixes.patch | 143 - .../211-mini_fo_2.6.25_dentry_open_war.patch | 66 - .../212-mini_fo_2.6.26_fixes.patch | 37 - .../213-mini_fo_2.6.27_fixes.patch | 41 - .../patches-2.6.27/219-kobject_uevent.patch | 42 - .../patches-2.6.27/220-sound_kconfig.patch | 11 - .../patches-2.6.27/400-ledtrig_morse.patch | 18 - .../patches-2.6.27/401-led_alix.patch | 25 - .../patches-2.6.27/402-ledtrig_netdev.patch | 21 - .../patches-2.6.27/410-gpio_buttons.patch | 30 - .../patches-2.6.27/420-gpiodev.patch | 26 - ...at24_add_kernel_interface_read_write.patch | 134 - .../patches-2.6.27/510-yaffs_support.patch | 17 - .../patches-2.6.27/512-yaffs_2.6.25_fix.patch | 92 - .../patches-2.6.27/513-yaffs_2.6.26_fix.patch | 69 - .../patches-2.6.27/600-phy_extension.patch | 83 - .../patches-2.6.27/620-phy_adm6996.patch | 24 - .../patches-2.6.27/630-phy_packets.patch | 63 - .../patches-2.6.27/640-mvswitch.patch | 48 - .../patches-2.6.27/650-swconfig.patch | 25 - .../801-usb_serial_endpoint_size.patch | 25 - .../840-unable_to_open_console.patch | 11 - .../900-headers_type_and_time.patch | 46 - .../902-darwin_scripts_include.patch | 102 - .../patches-2.6.27/903-hostap_txpower.patch | 154 - .../patches-2.6.27/903-stddef_include.patch | 17 - .../patches-2.6.27/905-i386_build.patch | 10 - .../patches-2.6.27/921-gpio_spi_driver.patch | 376 - .../patches-2.6.27/922-gpiommc.patch | 838 -- .../923-gpiommc-configfs-locking.patch | 58 - .../940-wireless_mesh_header.patch | 22 - .../951-revert_gcc4_4_fixes.patch | 524 -- ...ert_xt_string_case_insensitive_match.patch | 112 - .../970-ocf_kbuild_integration.patch | 25 - .../patches-2.6.27/971-ocf_20080917.patch | 160 - .../patches-2.6.27/972-ocf_compile_fix.patch | 11 - .../patches-2.6.27/973-ocf_2.6.27_fix.patch | 197 - .../974-ssb_b43_default_on.patch | 11 - .../975-crypto_kconfig_hacks.patch | 27 - .../976-ssb_fallback_sprom.patch | 107 - .../977-textsearch_kconfig_hacks.patch | 19 - .../patches-2.6.27/978-ssb_update.patch | 1863 ---- .../patches-2.6.27/980-vm_exports.patch | 114 - .../999-use_preinit_as_init.patch | 14 - 87 files changed, 30171 deletions(-) delete mode 100644 target/linux/generic-2.6/config-2.6.27 delete mode 100644 target/linux/generic-2.6/files-2.6.27/drivers/char/gpio_dev.c delete mode 100644 target/linux/generic-2.6/files-2.6.27/drivers/input/misc/gpio_buttons.c delete mode 100644 target/linux/generic-2.6/files-2.6.27/drivers/leds/leds-alix.c delete mode 100644 target/linux/generic-2.6/files-2.6.27/drivers/leds/ledtrig-morse.c delete mode 100644 target/linux/generic-2.6/files-2.6.27/drivers/leds/ledtrig-netdev.c delete mode 100644 target/linux/generic-2.6/files-2.6.27/include/linux/gpio_buttons.h delete mode 100644 target/linux/generic-2.6/files-2.6.27/include/linux/gpio_dev.h delete mode 100644 target/linux/generic-2.6/patches-2.6.27/001-squashfs.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/002-lzma_decompress.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/003-squashfs_lzma.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/004-extra_optimization.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/005-squashfs_fix.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/006-gcc4_inline_fix.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/007-samsung_flash.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/008-squashfs_vfs_super.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/010-disable_old_squashfs_compatibility.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/011-mips_boot.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/020-mips_multi_machine_support.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/021-mips_image_cmdline_hack.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/022-mips_div64_gcc4.4.0.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/023-mips_delay_gcc4.4.0.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/024-mips_disable_fpu.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/060-block2mtd_init.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/065-rootfs_split.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/070-redboot_space.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/071-redboot_boardconfig.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/080-mtd_plat_nand_chip_fixup.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/081-mtd_myloader_partition_parser.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/090-ds1672_new_style.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/091-ds1672_missing_id_table.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/100-netfilter_layer7_2.21.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/101-netfilter_layer7_pktmatch.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/150-netfilter_imq.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/180-netfilter_depends.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/190-netfilter_rtsp.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/200-sched_esfq.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/202-mips-freestanding.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/204-jffs2_eofdetect.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/207-powerpc_asm_segment_h.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/208-rtl8110sb_fix.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/209-mini_fo.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/210-mini_fo_2.6.25_fixes.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/211-mini_fo_2.6.25_dentry_open_war.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/212-mini_fo_2.6.26_fixes.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/213-mini_fo_2.6.27_fixes.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/219-kobject_uevent.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/220-sound_kconfig.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/400-ledtrig_morse.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/401-led_alix.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/402-ledtrig_netdev.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/410-gpio_buttons.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/420-gpiodev.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/450-i2c_at24_add_kernel_interface_read_write.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/510-yaffs_support.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/512-yaffs_2.6.25_fix.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/513-yaffs_2.6.26_fix.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/600-phy_extension.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/620-phy_adm6996.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/630-phy_packets.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/640-mvswitch.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/650-swconfig.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/801-usb_serial_endpoint_size.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/840-unable_to_open_console.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/900-headers_type_and_time.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/902-darwin_scripts_include.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/903-hostap_txpower.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/903-stddef_include.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/905-i386_build.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/921-gpio_spi_driver.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/922-gpiommc.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/923-gpiommc-configfs-locking.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/940-wireless_mesh_header.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/951-revert_gcc4_4_fixes.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/952-revert_xt_string_case_insensitive_match.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/970-ocf_kbuild_integration.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/971-ocf_20080917.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/972-ocf_compile_fix.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/973-ocf_2.6.27_fix.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/974-ssb_b43_default_on.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/975-crypto_kconfig_hacks.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/976-ssb_fallback_sprom.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/977-textsearch_kconfig_hacks.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/978-ssb_update.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/980-vm_exports.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.27/999-use_preinit_as_init.patch diff --git a/include/kernel-version.mk b/include/kernel-version.mk index ad94c8e00..ad4f36d07 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -16,9 +16,6 @@ endif ifeq ($(LINUX_VERSION),2.6.25.20) LINUX_KERNEL_MD5SUM:=0da698edccf03e2235abc2830a495114 endif -ifeq ($(LINUX_VERSION),2.6.27.35) - LINUX_KERNEL_MD5SUM:=a4fa9eb5ee4876522e8015ca7da3ae40 -endif ifeq ($(LINUX_VERSION),2.6.28.10) LINUX_KERNEL_MD5SUM:=c4efb2c494d749cb5de274f8ae41c3fa endif diff --git a/target/linux/generic-2.6/config-2.6.27 b/target/linux/generic-2.6/config-2.6.27 deleted file mode 100644 index 0ac64256f..000000000 --- a/target/linux/generic-2.6/config-2.6.27 +++ /dev/null @@ -1,2245 +0,0 @@ -# CONFIG_6PACK is not set -# CONFIG_8139CP is not set -# CONFIG_9P_FS is not set -# CONFIG_ACCESSIBILITY is not set -# CONFIG_ACENIC is not set -# CONFIG_ACORN_PARTITION is not set -# CONFIG_ADAPTEC_STARFIRE is not set -# CONFIG_ADFS_FS is not set -# CONFIG_ADM6996_PHY is not set -# CONFIG_ADM8211 is not set -# CONFIG_AFFS_FS is not set -# CONFIG_AF_RXRPC is not set -# CONFIG_AFS_FS is not set -# CONFIG_AIRO_CS is not set -# CONFIG_AIRO is not set -# CONFIG_ALIM7101_WDT is not set -# CONFIG_AMD8111_ETH is not set -# CONFIG_AMIGA_PARTITION is not set -CONFIG_ANON_INODES=y -# CONFIG_APPLICOM is not set -# CONFIG_ARCH_AAEC2000 is not set -# CONFIG_ARCH_AT91 is not set -# CONFIG_ARCH_CLPS711X is not set -# CONFIG_ARCH_DAVINCI is not set -# CONFIG_ARCH_EBSA110 is not set -# CONFIG_ARCH_EP93XX is not set -CONFIG_ARCH_FLATMEM_ENABLE=y -# CONFIG_ARCH_FOOTBRIDGE is not set -# CONFIG_ARCH_GEMINI is not set -# CONFIG_ARCH_H720X is not set -# CONFIG_ARCH_IMX is not set -# CONFIG_ARCH_INTEGRATOR is not set -# CONFIG_ARCH_IOP13XX is not set -# CONFIG_ARCH_IOP32X is not set -# CONFIG_ARCH_IOP33X is not set -# CONFIG_ARCH_IXP2000 is not set -# CONFIG_ARCH_IXP23XX is not set -# CONFIG_ARCH_IXP4XX is not set -# CONFIG_ARCH_KIRKWOOD is not set -# CONFIG_ARCH_KS8695 is not set -# CONFIG_ARCH_L7200 is not set -# CONFIG_ARCH_LH7A40X is not set -# CONFIG_ARCH_LOKI is not set -# CONFIG_ARCH_MMP is not set -# CONFIG_ARCH_MSM7X00A is not set -# CONFIG_ARCH_MV78XX0 is not set -# CONFIG_ARCH_MXC is not set -# CONFIG_ARCH_NETX is not set -# CONFIG_ARCH_NS9XXX is not set -# CONFIG_ARCH_OMAP is not set -# CONFIG_ARCH_ORION5X is not set -# CONFIG_ARCH_PNX4008 is not set -# CONFIG_ARCH_PXA is not set -# CONFIG_ARCH_REALVIEW is not set -# CONFIG_ARCH_RPC is not set -# CONFIG_ARCH_S3C2410 is not set -# CONFIG_ARCH_S3C64XX is not set -# CONFIG_ARCH_SA1100 is not set -# CONFIG_ARCH_SHARK is not set -# CONFIG_ARCH_VERSATILE is not set -# CONFIG_ARCNET is not set -CONFIG_ARPD=y -CONFIG_ASK_IP_FIB_HASH=y -# CONFIG_AT24 is not set -# CONFIG_ATA_ACPI is not set -# CONFIG_ATA_GENERIC is not set -# CONFIG_ATA is not set -# CONFIG_ATALK is not set -# CONFIG_ATA_OVER_ETH is not set -# CONFIG_ATARI_PARTITION is not set -# CONFIG_ATA_SFF is not set -# CONFIG_ATH5K is not set -# CONFIG_ATH9K is not set -# CONFIG_ATL1E is not set -# CONFIG_ATL1 is not set -# CONFIG_ATM_AMBASSADOR is not set -CONFIG_ATM_BR2684_IPFILTER=y -# CONFIG_ATM_BR2684 is not set -# CONFIG_ATM_CLIP is not set -CONFIG_ATM_CLIP_NO_ICMP=y -# CONFIG_ATM_DRIVERS is not set -# CONFIG_ATM_DUMMY is not set -# CONFIG_ATMEL is not set -# CONFIG_ATM_ENI is not set -# CONFIG_ATM_FIRESTREAM is not set -# CONFIG_ATM_FORE200E is not set -# CONFIG_ATM_FORE200E_MAYBE is not set -# CONFIG_ATM_HE is not set -# CONFIG_ATM_HORIZON is not set -# CONFIG_ATM_IA is not set -# CONFIG_ATM_IDT77252 is not set -# CONFIG_ATM is not set -# CONFIG_ATM_LANAI is not set -# CONFIG_ATM_LANE is not set -# CONFIG_ATM_MPOA is not set -# CONFIG_ATM_NICSTAR is not set -# CONFIG_ATM_TCP is not set -# CONFIG_ATM_ZATM is not set -# CONFIG_AUDIT is not set -# CONFIG_AUTOFS4_FS is not set -# CONFIG_AUTOFS_FS is not set -# CONFIG_AX25_DAMA_SLAVE is not set -# CONFIG_AX25 is not set -# CONFIG_AX88796 is not set -# CONFIG_B43 is not set -# CONFIG_B43LEGACY is not set -# CONFIG_B44 is not set -# CONFIG_BACKLIGHT_LCD_SUPPORT is not set -CONFIG_BASE_FULL=y -# CONFIG_BASLER_EXCITE is not set -# CONFIG_BATTERY_DS2760 is not set -# CONFIG_BATTERY_OLPC is not set -# CONFIG_BAYCOM_EPP is not set -# CONFIG_BAYCOM_PAR is not set -# CONFIG_BAYCOM_SER_FDX is not set -# CONFIG_BAYCOM_SER_HDX is not set -CONFIG_BCM43XX_DEBUG=y -CONFIG_BCM43XX_DMA_AND_PIO_MODE=y -# CONFIG_BCM43XX_DMA_MODE is not set -CONFIG_BCM43XX_DMA=y -# CONFIG_BCM43XX is not set -# CONFIG_BCM43XX_PIO_MODE is not set -CONFIG_BCM43XX_PIO=y -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -CONFIG_BINFMT_ELF=y -# CONFIG_BINFMT_MISC is not set -# CONFIG_BLINK is not set -# CONFIG_BLK_CPQ_CISS_DA is not set -# CONFIG_BLK_CPQ_DA is not set -# CONFIG_BLK_DEV_3W_XXXX_RAID is not set -# CONFIG_BLK_DEV_AEC62XX is not set -# CONFIG_BLK_DEV_ALI15X3 is not set -# CONFIG_BLK_DEV_AMD74XX is not set -# CONFIG_BLK_DEV_ATIIXP is not set -# CONFIG_BLK_DEV_BSG is not set -# CONFIG_BLK_DEV_CMD640 is not set -# CONFIG_BLK_DEV_CMD64X is not set -# CONFIG_BLK_DEV_COW_COMMON is not set -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_CS5520 is not set -# CONFIG_BLK_DEV_CS5530 is not set -# CONFIG_BLK_DEV_CS5535 is not set -# CONFIG_BLK_DEV_CY82C693 is not set -# CONFIG_BLK_DEV_DAC960 is not set -# CONFIG_BLK_DEV_DELKIN is not set -# CONFIG_BLK_DEV_FD is not set -# CONFIG_BLK_DEV_GENERIC is not set -# CONFIG_BLK_DEV_HD_IDE is not set -# CONFIG_BLK_DEV_HD is not set -# CONFIG_BLK_DEV_HD_ONLY is not set -# CONFIG_BLK_DEV_HPT34X is not set -# CONFIG_BLK_DEV_HPT366 is not set -# CONFIG_BLK_DEV_IDEACPI is not set -# CONFIG_BLK_DEV_IDECD is not set -# CONFIG_BLK_DEV_IDECS is not set -# CONFIG_BLK_DEV_IDEDMA_FORCED is not set -# CONFIG_BLK_DEV_IDEFLOPPY is not set -# CONFIG_BLK_DEV_IDEPCI is not set -# CONFIG_BLK_DEV_IDEPNP is not set -# CONFIG_BLK_DEV_IDE_SATA is not set -# CONFIG_BLK_DEV_IDESCSI is not set -# CONFIG_BLK_DEV_IDETAPE is not set -CONFIG_BLK_DEV_INITRD=y -# CONFIG_BLK_DEV_INTEGRITY is not set -# CONFIG_BLK_DEV_IO_TRACE is not set -# CONFIG_BLK_DEV_IT8213 is not set -# CONFIG_BLK_DEV_IT821X is not set -# CONFIG_BLK_DEV_JMICRON is not set -# CONFIG_BLK_DEV_LOOP is not set -# CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_NS87415 is not set -# CONFIG_BLK_DEV_OFFBOARD is not set -# CONFIG_BLK_DEV_OPTI621 is not set -# CONFIG_BLK_DEV_PDC202XX_NEW is not set -# CONFIG_BLK_DEV_PDC202XX_OLD is not set -# CONFIG_BLK_DEV_PIIX is not set -# CONFIG_BLK_DEV_PLATFORM is not set -# CONFIG_BLK_DEV_RAM is not set -# CONFIG_BLK_DEV_RZ1000 is not set -# CONFIG_BLK_DEV_SC1200 is not set -# CONFIG_BLK_DEV_SD is not set -# CONFIG_BLK_DEV_SIIMAGE is not set -# CONFIG_BLK_DEV_SIS5513 is not set -# CONFIG_BLK_DEV_SL82C105 is not set -# CONFIG_BLK_DEV_SLC90E66 is not set -# CONFIG_BLK_DEV_SR is not set -# CONFIG_BLK_DEV_SVWKS is not set -# CONFIG_BLK_DEV_SX8 is not set -# CONFIG_BLK_DEV_TC86C001 is not set -# CONFIG_BLK_DEV_TRIFLEX is not set -# CONFIG_BLK_DEV_TRM290 is not set -# CONFIG_BLK_DEV_UB is not set -# CONFIG_BLK_DEV_UMEM is not set -# CONFIG_BLK_DEV_VIA82CXXX is not set -CONFIG_BLK_DEV=y -CONFIG_BLOCK=y -# CONFIG_BNX2 is not set -# CONFIG_BONDING is not set -# CONFIG_BPQETHER is not set -# CONFIG_BRIDGE_EBT_802_3 is not set -# CONFIG_BRIDGE_EBT_AMONG is not set -# CONFIG_BRIDGE_EBT_ARP is not set -# CONFIG_BRIDGE_EBT_ARPREPLY is not set -# CONFIG_BRIDGE_EBT_BROUTE is not set -# CONFIG_BRIDGE_EBT_DNAT is not set -# CONFIG_BRIDGE_EBT_IP6 is not set -# CONFIG_BRIDGE_EBT_IP is not set -# CONFIG_BRIDGE_EBT_LIMIT is not set -# CONFIG_BRIDGE_EBT_LOG is not set -# CONFIG_BRIDGE_EBT_MARK is not set -# CONFIG_BRIDGE_EBT_MARK_T is not set -# CONFIG_BRIDGE_EBT_NFLOG is not set -# CONFIG_BRIDGE_EBT_PKTTYPE is not set -# CONFIG_BRIDGE_EBT_REDIRECT is not set -# CONFIG_BRIDGE_EBT_SNAT is not set -# CONFIG_BRIDGE_EBT_STP is not set -# CONFIG_BRIDGE_EBT_T_FILTER is not set -# CONFIG_BRIDGE_EBT_T_NAT is not set -# CONFIG_BRIDGE_EBT_ULOG is not set -# CONFIG_BRIDGE_EBT_VLAN is not set -# CONFIG_BRIDGE_NETFILTER is not set -# CONFIG_BRIDGE_NF_EBTABLES is not set -CONFIG_BRIDGE=y -# CONFIG_BROADCOM_PHY is not set -CONFIG_BROKEN_ON_SMP=y -CONFIG_BSD_DISKLABEL=y -# CONFIG_BSD_PROCESS_ACCT_V3 is not set -CONFIG_BSD_PROCESS_ACCT=y -# CONFIG_BT_BNEP is not set -CONFIG_BT_BNEP_MC_FILTER=y -CONFIG_BT_BNEP_PROTO_FILTER=y -# CONFIG_BT_CMTP is not set -# CONFIG_BT_HCIBCM203X is not set -# CONFIG_BT_HCIBFUSB is not set -# CONFIG_BT_HCIBLUECARD is not set -# CONFIG_BT_HCIBPA10X is not set -# CONFIG_BT_HCIBT3C is not set -# CONFIG_BT_HCIBTSDIO is not set -# CONFIG_BT_HCIBTUART is not set -# CONFIG_BT_HCIBTUSB is not set -# CONFIG_BT_HCIDTL1 is not set -CONFIG_BT_HCIUART_BCSP=y -CONFIG_BT_HCIUART_H4=y -# CONFIG_BT_HCIUART is not set -# CONFIG_BT_HCIUART_LL is not set -# CONFIG_BT_HCIUSB is not set -CONFIG_BT_HCIUSB_SCO=y -# CONFIG_BT_HCIVHCI is not set -# CONFIG_BT_HIDP is not set -# CONFIG_BT is not set -# CONFIG_BT_L2CAP is not set -# CONFIG_BT_RFCOMM is not set -CONFIG_BT_RFCOMM_TTY=y -# CONFIG_BT_SCO is not set -CONFIG_BUG=y -# CONFIG_CAN is not set -# CONFIG_CAPI_AVM is not set -# CONFIG_CAPI_EICON is not set -# CONFIG_CAPI_TRACE is not set -CONFIG_CARDBUS=y -# CONFIG_CARDMAN_4000 is not set -# CONFIG_CARDMAN_4040 is not set -# CONFIG_CASSINI is not set -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -# CONFIG_CDROM_PKTCDVD is not set -# CONFIG_CFG80211 is not set -# CONFIG_CGROUPS is not set -# CONFIG_CHELSIO_T1 is not set -# CONFIG_CHELSIO_T3 is not set -# CONFIG_CHR_DEV_OSST is not set -# CONFIG_CHR_DEV_SCH is not set -# CONFIG_CHR_DEV_SG is not set -# CONFIG_CHR_DEV_ST is not set -# CONFIG_CICADA_PHY is not set -# CONFIG_CIFS_DEBUG2 is not set -# CONFIG_CIFS_EXPERIMENTAL is not set -# CONFIG_CIFS is not set -CONFIG_CIFS_POSIX=y -# CONFIG_CIFS_STATS2 is not set -CONFIG_CIFS_STATS=y -# CONFIG_CIFS_WEAK_PW_HASH is not set -# CONFIG_CIFS_XATTR is not set -CONFIG_CLS_U32_MARK=y -CONFIG_CLS_U32_PERF=y -CONFIG_CMDLINE="" -# CONFIG_CODA_FS is not set -# CONFIG_COMPAT_BRK is not set -# CONFIG_CONFIGFS_FS is not set -# CONFIG_CONNECTOR is not set -# CONFIG_CONTEXT_SWITCH_TRACER is not set -# CONFIG_CPU_DCACHE_DISABLE is not set -# CONFIG_CRAMFS is not set -# CONFIG_CRC16 is not set -CONFIG_CRC32=y -# CONFIG_CRC7 is not set -# CONFIG_CRC_CCITT is not set -# CONFIG_CRC_ITU_T is not set -# CONFIG_CRC_T10DIF is not set -CONFIG_CROSSCOMPILE=y -# CONFIG_CRYPTO_AEAD is not set -# CONFIG_CRYPTO_AES is not set -# CONFIG_CRYPTO_ALGAPI is not set -# CONFIG_CRYPTO_ANUBIS is not set -# CONFIG_CRYPTO_ARC4 is not set -# CONFIG_CRYPTO_AUTHENC is not set -# CONFIG_CRYPTO_BLKCIPHER is not set -# CONFIG_CRYPTO_BLOWFISH is not set -# CONFIG_CRYPTO_CAMELLIA is not set -# CONFIG_CRYPTO_CAST5 is not set -# CONFIG_CRYPTO_CAST6 is not set -# CONFIG_CRYPTO_CBC is not set -# CONFIG_CRYPTO_CCM is not set -# CONFIG_CRYPTO_CRC32C is not set -# CONFIG_CRYPTO_CRYPTD is not set -# CONFIG_CRYPTO_CTR is not set -# CONFIG_CRYPTO_CTS is not set -# CONFIG_CRYPTO_DEFLATE is not set -# CONFIG_CRYPTO_DES is not set -# CONFIG_CRYPTO_DEV_HIFN_795X is not set -# CONFIG_CRYPTO_ECB is not set -# CONFIG_CRYPTO_FCRYPT is not set -# CONFIG_CRYPTO_GCM is not set -# CONFIG_CRYPTO_GF128MUL is not set -# CONFIG_CRYPTO_HASH is not set -# CONFIG_CRYPTO_HMAC is not set -# CONFIG_CRYPTO_HW is not set -# CONFIG_CRYPTO_KHAZAD is not set -# CONFIG_CRYPTO_LRW is not set -# CONFIG_CRYPTO_LZO is not set -# CONFIG_CRYPTO_MANAGER is not set -# CONFIG_CRYPTO_MD4 is not set -# CONFIG_CRYPTO_MD5 is not set -# CONFIG_CRYPTO_MICHAEL_MIC is not set -# CONFIG_CRYPTO_NULL is not set -# CONFIG_CRYPTO_PCBC is not set -# CONFIG_CRYPTO_PRNG is not set -# CONFIG_CRYPTO_RMD128 is not set -# CONFIG_CRYPTO_RMD160 is not set -# CONFIG_CRYPTO_RMD256 is not set -# CONFIG_CRYPTO_RMD320 is not set -# CONFIG_CRYPTO_SALSA20_586 is not set -# CONFIG_CRYPTO_SALSA20 is not set -# CONFIG_CRYPTO_SEED is not set -# CONFIG_CRYPTO_SEQIV is not set -# CONFIG_CRYPTO_SERPENT is not set -# CONFIG_CRYPTO_SHA1 is not set -# CONFIG_CRYPTO_SHA256 is not set -# CONFIG_CRYPTO_SHA512 is not set -# CONFIG_CRYPTO_TEA is not set -# CONFIG_CRYPTO_TEST is not set -# CONFIG_CRYPTO_TGR192 is not set -# CONFIG_CRYPTO_TWOFISH_COMMON is not set -# CONFIG_CRYPTO_TWOFISH is not set -# CONFIG_CRYPTO_WP512 is not set -# CONFIG_CRYPTO_XCBC is not set -# CONFIG_CRYPTO_XTS is not set -CONFIG_CRYPTO=y -# CONFIG_DAB is not set -# CONFIG_DAVICOM_PHY is not set -CONFIG_DEBUG_FS=y -# CONFIG_DEBUG_KERNEL is not set -# CONFIG_DEBUG_MEMORY_INIT is not set -# CONFIG_DECNET is not set -# CONFIG_DEFAULT_AS is not set -# CONFIG_DEFAULT_BIC is not set -# CONFIG_DEFAULT_CFQ is not set -# CONFIG_DEFAULT_CUBIC is not set -CONFIG_DEFAULT_DEADLINE=y -# CONFIG_DEFAULT_HTCP is not set -CONFIG_DEFAULT_IOSCHED="deadline" -CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 -# CONFIG_DEFAULT_NOOP is not set -# CONFIG_DEFAULT_RENO is not set -CONFIG_DEFAULT_TCP_CONG="westwood" -# CONFIG_DEFAULT_VEGAS is not set -CONFIG_DEFAULT_WESTWOOD=y -CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" -# CONFIG_DEVKMEM is not set -# CONFIG_DGRS is not set -# CONFIG_DISCONTIGMEM_MANUAL is not set -# CONFIG_DISPLAY_SUPPORT is not set -# CONFIG_DL2K is not set -# CONFIG_DLM is not set -# CONFIG_DMADEVICES is not set -# CONFIG_DMA_ENGINE is not set -# CONFIG_DMASCC is not set -# CONFIG_DNOTIFY is not set -# CONFIG_DRM is not set -# CONFIG_DS1682 is not set -# CONFIG_DTLK is not set -# CONFIG_DUMMY is not set -# CONFIG_DVB_CORE is not set -# CONFIG_DVB is not set -# CONFIG_E1000E is not set -# CONFIG_E1000 is not set -# CONFIG_E100 is not set -# CONFIG_ECONET is not set -# CONFIG_EEPRO100 is not set -# CONFIG_EEPROM_93CX6 is not set -# CONFIG_EFI_PARTITION is not set -# CONFIG_EFS_FS is not set -# CONFIG_ELF_CORE is not set -CONFIG_EMBEDDED=y -# CONFIG_ENABLE_MUST_CHECK is not set -CONFIG_ENABLE_WARN_DEPRECATED=y -# CONFIG_ENC28J60 is not set -# CONFIG_ENCLOSURE_SERVICES is not set -# CONFIG_EPIC100 is not set -CONFIG_EPOLL=y -# CONFIG_EQUALIZER is not set -CONFIG_EVENTFD=y -CONFIG_EXPERIMENTAL=y -# CONFIG_EXPORTFS is not set -# CONFIG_EXT2_FS is not set -# CONFIG_EXT2_FS_XATTR is not set -# CONFIG_EXT2_FS_XIP is not set -# CONFIG_EXT3_FS is not set -# CONFIG_EXT3_FS_XATTR is not set -# CONFIG_EXT4DEV_FS is not set -CONFIG_EXTRA_FIRMWARE="" -CONFIG_EXTRA_TARGETS="" -# CONFIG_FAIR_GROUP_SCHED is not set -CONFIG_FAT_DEFAULT_CODEPAGE=437 -CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" -# CONFIG_FAT_FS is not set -# CONFIG_FB_3DFX is not set -# CONFIG_FB_ARC is not set -# CONFIG_FB_ARK is not set -# CONFIG_FB_ASILIANT is not set -# CONFIG_FB_ATY128 is not set -# CONFIG_FB_ATY is not set -# CONFIG_FB_BACKLIGHT is not set -# CONFIG_FB_CARMINE is not set -# CONFIG_FB_CFB_COPYAREA is not set -# CONFIG_FB_CFB_FILLRECT is not set -# CONFIG_FB_CFB_IMAGEBLIT is not set -# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set -# CONFIG_FB_CIRRUS is not set -# CONFIG_FB_CYBER2000 is not set -# CONFIG_FB_CYBLA is not set -# CONFIG_FB_DDC is not set -# CONFIG_FB_EFI is not set -# CONFIG_FB_FOREIGN_ENDIAN is not set -# CONFIG_FB_GEODE is not set -# CONFIG_FB_HGA is not set -# CONFIG_FB_I810 is not set -# CONFIG_FB_IBM_GXT4500 is not set -# CONFIG_FB_IMSTT is not set -# CONFIG_FB_INTEL is not set -# CONFIG_FB is not set -# CONFIG_FB_KYRO is not set -# CONFIG_FB_LE80578 is not set -# CONFIG_FB_MACMODES is not set -# CONFIG_FB_MATROX is not set -# CONFIG_FB_MODE_HELPERS is not set -# CONFIG_FB_N411 is not set -# CONFIG_FB_NEOMAGIC is not set -# CONFIG_FB_NVIDIA is not set -# CONFIG_FB_PM2 is not set -# CONFIG_FB_PM3 is not set -# CONFIG_FB_PXA is not set -# CONFIG_FB_RADEON is not set -# CONFIG_FB_RIVA is not set -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_S3 is not set -# CONFIG_FB_SAVAGE is not set -# CONFIG_FB_SIS is not set -# CONFIG_FB_SVGALIB is not set -# CONFIG_FB_SYS_COPYAREA is not set -# CONFIG_FB_SYS_FILLRECT is not set -# CONFIG_FB_SYS_FOPS is not set -# CONFIG_FB_SYS_IMAGEBLIT is not set -# CONFIG_FB_TILEBLITTING is not set -# CONFIG_FB_TRIDENT is not set -# CONFIG_FB_VESA is not set -# CONFIG_FB_VGA16 is not set -# CONFIG_FB_VIRTUAL is not set -# CONFIG_FB_VOODOO1 is not set -# CONFIG_FB_VT8623 is not set -# CONFIG_FDDI is not set -# CONFIG_FEALNX is not set -CONFIG_FIB_RULES=y -# CONFIG_FIREWIRE is not set -# CONFIG_FIRMWARE_IN_KERNEL is not set -# CONFIG_FIXED_PHY is not set -CONFIG_FLATMEM_MANUAL=y -CONFIG_FLATMEM=y -CONFIG_FLAT_NODE_MEM_MAP=y -# CONFIG_FORCEDETH is not set -CONFIG_FRAME_WARN=1024 -# CONFIG_FS_POSIX_ACL is not set -# CONFIG_FTL is not set -# CONFIG_FTRACE is not set -# CONFIG_FUSE_FS is not set -# CONFIG_FUSION_FC is not set -# CONFIG_FUSION is not set -# CONFIG_FUSION_SAS is not set -# CONFIG_FUSION_SPI is not set -CONFIG_FUTEX=y -CONFIG_FW_LOADER=y -CONFIG_GACT_PROB=y -# CONFIG_GAMEPORT is not set -CONFIG_GENERIC_CALIBRATE_DELAY=y -CONFIG_GENERIC_HARDIRQS=y -CONFIG_GENERIC_HWEIGHT=y -CONFIG_GENERIC_IRQ_PROBE=y -CONFIG_GENERIC_TIME=y -# CONFIG_GFS2_FS is not set -# CONFIG_GPIO_BT8XX is not set -# CONFIG_GPIO_DEVICE is not set -# CONFIG_GPIOLIB is not set -# CONFIG_GPIO_MAX7301 is not set -# CONFIG_GPIO_MAX732X is not set -# CONFIG_GPIO_MCP23S08 is not set -# CONFIG_GPIO_PCA953X is not set -# CONFIG_GPIO_PCF857X is not set -# CONFIG_GPIO_SYSFS is not set -# CONFIG_GROUP_SCHED is not set -# CONFIG_HAMACHI is not set -CONFIG_HAMRADIO=y -# CONFIG_HAPPYMEAL is not set -# CONFIG_HDLC_CISCO is not set -# CONFIG_HDLC_FR is not set -# CONFIG_HDLC is not set -# CONFIG_HDLC_PPP is not set -# CONFIG_HDLC_RAW_ETH is not set -# CONFIG_HDLC_RAW is not set -# CONFIG_HEADERS_CHECK is not set -# CONFIG_HERMES is not set -# CONFIG_HFS_FS is not set -# CONFIG_HFSPLUS_FS is not set -# CONFIG_HID_DEBUG is not set -# CONFIG_HID_FF is not set -# CONFIG_HID is not set -# CONFIG_HIDRAW is not set -# CONFIG_HID_SUPPORT is not set -CONFIG_HIGH_RES_TIMERS=y -# CONFIG_HIPPI is not set -# CONFIG_HOSTAP_CS is not set -# CONFIG_HOSTAP is not set -# CONFIG_HOSTAP_PCI is not set -# CONFIG_HOSTAP_PLX is not set -# CONFIG_HOTPLUG_CPU is not set -# CONFIG_HOTPLUG_PCI is not set -CONFIG_HOTPLUG=y -# CONFIG_HP100 is not set -# CONFIG_HPFS_FS is not set -# CONFIG_HP_ILO is not set -# CONFIG_HTC_PASIC3 is not set -# CONFIG_HUGETLB_PAGE is not set -# CONFIG_HWMON is not set -# CONFIG_HWMON_VID is not set -CONFIG_HZ=100 -# CONFIG_HZ_1000 is not set -CONFIG_HZ_100=y -# CONFIG_HZ_1024 is not set -# CONFIG_HZ_128 is not set -# CONFIG_HZ_250 is not set -# CONFIG_HZ_256 is not set -# CONFIG_HZ_300 is not set -# CONFIG_HZ_48 is not set -# CONFIG_I2C_ALGOBIT is not set -# CONFIG_I2C_ALGOPCA is not set -# CONFIG_I2C_ALGOPCF is not set -# CONFIG_I2C_ALI1535 is not set -# CONFIG_I2C_ALI1563 is not set -# CONFIG_I2C_ALI15X3 is not set -# CONFIG_I2C_AMD756 is not set -# CONFIG_I2C_AMD8111 is not set -# CONFIG_I2C_CHARDEV is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -# CONFIG_I2C_DEBUG_CHIP is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_ELEKTOR is not set -# CONFIG_I2C_GPIO is not set -# CONFIG_I2C_HELPER_AUTO is not set -# CONFIG_I2C_I801 is not set -# CONFIG_I2C_I810 is not set -# CONFIG_I2C_IBM_IIC is not set -# CONFIG_I2C_ISCH is not set -# CONFIG_I2C_MPC is not set -# CONFIG_I2C_NFORCE2 is not set -# CONFIG_I2C_OCORES is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -# CONFIG_I2C_PCA_ISA is not set -# CONFIG_I2C_PCA_PLATFORM is not set -# CONFIG_I2C_PIIX4 is not set -# CONFIG_I2C_PROSAVAGE is not set -# CONFIG_I2C_SAVAGE4 is not set -# CONFIG_I2C_SIMTEC is not set -# CONFIG_I2C_SIS5595 is not set -# CONFIG_I2C_SIS630 is not set -# CONFIG_I2C_SIS96X is not set -# CONFIG_I2C_STUB is not set -# CONFIG_I2C_TAOS_EVM is not set -# CONFIG_I2C_TINY_USB is not set -# CONFIG_I2C_VIA is not set -# CONFIG_I2C_VIAPRO is not set -# CONFIG_I2C_VOODOO3 is not set -# CONFIG_I2O is not set -# CONFIG_I82092 is not set -# CONFIG_I82365 is not set -# CONFIG_IBM_NEW_EMAC_EMAC4 is not set -# CONFIG_IBM_NEW_EMAC_RGMII is not set -# CONFIG_IBM_NEW_EMAC_TAH is not set -# CONFIG_IBM_NEW_EMAC_ZMII is not set -# CONFIG_ICPLUS_PHY is not set -# CONFIG_IDEDISK_MULTI_MODE is not set -# CONFIG_IDEDMA_IVB is not set -# CONFIG_IDEDMA_ONLYDISK is not set -CONFIG_IDE_MAX_HWIFS=4 -# CONFIG_IDEPCI_SHARE_IRQ is not set -CONFIG_IDE_PROC_FS=y -# CONFIG_IDE_TASK_IOCTL is not set -# CONFIG_IEEE1394_DV1394 is not set -# CONFIG_IEEE1394_ETH1394 is not set -# CONFIG_IEEE1394 is not set -# CONFIG_IEEE1394_OHCI1394 is not set -# CONFIG_IEEE1394_PCILYNX is not set -# CONFIG_IEEE1394_RAWIO is not set -# CONFIG_IEEE1394_VERBOSEDEBUG is not set -# CONFIG_IEEE1394_VIDEO1394 is not set -# CONFIG_IEEE80211_CRYPT_CCMP is not set -# CONFIG_IEEE80211_CRYPT_TKIP is not set -# CONFIG_IEEE80211_CRYPT_WEP is not set -# CONFIG_IEEE80211_DEBUG is not set -# CONFIG_IEEE80211 is not set -# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set -# CONFIG_IEEE80211_SOFTMAC is not set -# CONFIG_IFB is not set -# CONFIG_IGB is not set -# CONFIG_IKCONFIG is not set -# CONFIG_IKCONFIG_PROC is not set -# CONFIG_IMAGE_CMDLINE_HACK is not set -# CONFIG_IMQ_BEHAVIOR_AA is not set -# CONFIG_IMQ_BEHAVIOR_AB is not set -# CONFIG_IMQ_BEHAVIOR_BA is not set -# CONFIG_IMQ_BEHAVIOR_BB is not set -# CONFIG_IMQ is not set -CONFIG_IMQ_NUM_DEVS=2 -# CONFIG_INET6_AH is not set -# CONFIG_INET6_ESP is not set -# CONFIG_INET6_IPCOMP is not set -# CONFIG_INET6_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_BEET is not set -# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set -# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET6_XFRM_MODE_TUNNEL is not set -# CONFIG_INET6_XFRM_TUNNEL is not set -# CONFIG_INET_AH is not set -# CONFIG_INET_DIAG is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_INET_LRO is not set -# CONFIG_INET_TCP_DIAG is not set -# CONFIG_INET_TUNNEL is not set -# CONFIG_INET_XFRM_MODE_BEET is not set -# CONFIG_INET_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET_XFRM_MODE_TUNNEL is not set -# CONFIG_INET_XFRM_TUNNEL is not set -CONFIG_INET=y -# CONFIG_INFINIBAND is not set -# CONFIG_INFTL is not set -CONFIG_INIT_ENV_ARG_LIMIT=32 -# CONFIG_INOTIFY is not set -# CONFIG_INOTIFY_USER is not set -# CONFIG_INPUT_APANEL is not set -# CONFIG_INPUT_ATI_REMOTE2 is not set -# CONFIG_INPUT_ATI_REMOTE is not set -# CONFIG_INPUT_ATLAS_BTNS is not set -# CONFIG_INPUT_EVBUG is not set -# CONFIG_INPUT_EVDEV is not set -# CONFIG_INPUT_FF_MEMLESS is not set -# CONFIG_INPUT is not set -# CONFIG_INPUT_JOYDEV is not set -# CONFIG_INPUT_JOYSTICK is not set -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_KEYSPAN_REMOTE is not set -CONFIG_INPUT_MISC=y -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_MOUSE is not set -# CONFIG_INPUT_PCSPKR is not set -# CONFIG_INPUT_POLLDEV is not set -# CONFIG_INPUT_POWERMATE is not set -# CONFIG_INPUT_TABLET is not set -# CONFIG_INPUT_TOUCHSCREEN is not set -# CONFIG_INPUT_TSDEV is not set -# CONFIG_INPUT_UINPUT is not set -# CONFIG_INPUT_WISTRON_BTNS is not set -# CONFIG_INPUT_YEALINK is not set -# CONFIG_INSTRUMENTATION is not set -# CONFIG_IOSCHED_AS is not set -# CONFIG_IOSCHED_CFQ is not set -CONFIG_IOSCHED_DEADLINE=y -CONFIG_IOSCHED_NOOP=y -# CONFIG_IP1000 is not set -# CONFIG_IP6_NF_FILTER is not set -# CONFIG_IP6_NF_IPTABLES is not set -# CONFIG_IP6_NF_MANGLE is not set -# CONFIG_IP6_NF_MATCH_AH is not set -# CONFIG_IP6_NF_MATCH_EUI64 is not set -# CONFIG_IP6_NF_MATCH_FRAG is not set -# CONFIG_IP6_NF_MATCH_HL is not set -# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set -# CONFIG_IP6_NF_MATCH_LIMIT is not set -# CONFIG_IP6_NF_MATCH_MH is not set -# CONFIG_IP6_NF_MATCH_OPTS is not set -# CONFIG_IP6_NF_MATCH_OWNER is not set -# CONFIG_IP6_NF_MATCH_RT is not set -# CONFIG_IP6_NF_QUEUE is not set -# CONFIG_IP6_NF_RAW is not set -# CONFIG_IP6_NF_TARGET_HL is not set -# CONFIG_IP6_NF_TARGET_IMQ is not set -# CONFIG_IP6_NF_TARGET_LOG is not set -# CONFIG_IP6_NF_TARGET_REJECT is not set -# CONFIG_IP6_NF_TARGET_ROUTE is not set -CONFIG_IP_ADVANCED_ROUTER=y -# CONFIG_IPC_NS is not set -# CONFIG_IP_DCCP is not set -CONFIG_IP_FIB_HASH=y -# CONFIG_IP_FIB_TRIE is not set -# CONFIG_IPMI_HANDLER is not set -CONFIG_IP_MROUTE=y -CONFIG_IP_MULTICAST=y -CONFIG_IP_MULTIPLE_TABLES=y -# CONFIG_IP_NF_AMANDA is not set -# CONFIG_IP_NF_ARPFILTER is not set -# CONFIG_IP_NF_ARP_MANGLE is not set -# CONFIG_IP_NF_ARPTABLES is not set -# CONFIG_IP_NF_CONNTRACK_EVENTS is not set -CONFIG_IP_NF_CONNTRACK_MARK=y -CONFIG_IP_NF_CONNTRACK=y -CONFIG_IP_NF_CT_ACCT=y -# CONFIG_IP_NF_CT_PROTO_SCTP is not set -# CONFIG_IP_NF_FILTER is not set -# CONFIG_IP_NF_FTP is not set -# CONFIG_IP_NF_H323 is not set -# CONFIG_IP_NF_IPTABLES is not set -# CONFIG_IP_NF_IRC is not set -# CONFIG_IP_NF_MANGLE is not set -# CONFIG_IP_NF_MATCH_ADDRTYPE is not set -# CONFIG_IP_NF_MATCH_AH is not set -# CONFIG_IP_NF_MATCH_ECN is not set -# CONFIG_IP_NF_MATCH_HASHLIMIT is not set -# CONFIG_IP_NF_MATCH_IPP2P is not set -# CONFIG_IP_NF_MATCH_OWNER is not set -# CONFIG_IP_NF_MATCH_RECENT is not set -# CONFIG_IP_NF_MATCH_SET is not set -# CONFIG_IP_NF_MATCH_TIME is not set -# CONFIG_IP_NF_MATCH_TOS is not set -# CONFIG_IP_NF_MATCH_TTL is not set -# CONFIG_IP_NF_NAT_AMANDA is not set -# CONFIG_IP_NF_NAT_FTP is not set -# CONFIG_IP_NF_NAT_H323 is not set -# CONFIG_IP_NF_NAT_IRC is not set -CONFIG_IP_NF_NAT_NEEDED=y -# CONFIG_IP_NF_NAT_PPTP is not set -# CONFIG_IP_NF_NAT_SIP is not set -# CONFIG_IP_NF_NAT_SNMP_BASIC is not set -# CONFIG_IP_NF_NAT_TFTP is not set -CONFIG_IP_NF_NAT=y -# CONFIG_IP_NF_NETBIOS_NS is not set -# CONFIG_IP_NF_PPTP is not set -# CONFIG_IP_NF_QUEUE is not set -# CONFIG_IP_NF_RAW is not set -CONFIG_IP_NF_SET_HASHSIZE=1024 -# CONFIG_IP_NF_SET_IPHASH is not set -# CONFIG_IP_NF_SET_IPMAP is not set -# CONFIG_IP_NF_SET_IPPORTHASH is not set -# CONFIG_IP_NF_SET_IPTREE is not set -# CONFIG_IP_NF_SET_IPTREEMAP is not set -# CONFIG_IP_NF_SET is not set -# CONFIG_IP_NF_SET_MACIPMAP is not set -CONFIG_IP_NF_SET_MAX=256 -# CONFIG_IP_NF_SET_NETHASH is not set -# CONFIG_IP_NF_SET_PORTMAP is not set -# CONFIG_IP_NF_SIP is not set -# CONFIG_IP_NF_TARGET_CLUSTERIP is not set -# CONFIG_IP_NF_TARGET_ECN is not set -# CONFIG_IP_NF_TARGET_IMQ is not set -# CONFIG_IP_NF_TARGET_LOG is not set -# CONFIG_IP_NF_TARGET_MASQUERADE is not set -# CONFIG_IP_NF_TARGET_NETMAP is not set -# CONFIG_IP_NF_TARGET_REDIRECT is not set -# CONFIG_IP_NF_TARGET_REJECT is not set -# CONFIG_IP_NF_TARGET_ROUTE is not set -# CONFIG_IP_NF_TARGET_SAME is not set -# CONFIG_IP_NF_TARGET_SET is not set -# CONFIG_IP_NF_TARGET_TOS is not set -# CONFIG_IP_NF_TARGET_TTL is not set -# CONFIG_IP_NF_TARGET_ULOG is not set -# CONFIG_IP_NF_TFTP is not set -# CONFIG_IP_PIMSM_V1 is not set -# CONFIG_IP_PIMSM_V2 is not set -# CONFIG_IP_PNP is not set -CONFIG_IP_ROUTE_FWMARK=y -CONFIG_IP_ROUTE_MULTIPATH_CACHED=y -# CONFIG_IP_ROUTE_MULTIPATH_DRR is not set -# CONFIG_IP_ROUTE_MULTIPATH_RANDOM is not set -# CONFIG_IP_ROUTE_MULTIPATH_RR is not set -# CONFIG_IP_ROUTE_MULTIPATH_WRANDOM is not set -CONFIG_IP_ROUTE_MULTIPATH=y -CONFIG_IP_ROUTE_VERBOSE=y -# CONFIG_IP_SCTP is not set -CONFIG_IPSEC_NAT_TRAVERSAL=y -# CONFIG_IPV6 is not set -# CONFIG_IPV6_MIP6 is not set -# CONFIG_IPV6_MROUTE is not set -# CONFIG_IPV6_MULTIPLE_TABLES is not set -CONFIG_IPV6_NDISC_NODETYPE=y -# CONFIG_IPV6_OPTIMISTIC_DAD is not set -# CONFIG_IPV6_PRIVACY is not set -# CONFIG_IPV6_ROUTE_INFO is not set -# CONFIG_IPV6_ROUTER_PREF is not set -# CONFIG_IPV6_SIT is not set -# CONFIG_IPV6_TUNNEL is not set -# CONFIG_IP_VS is not set -# CONFIG_IPW2100_DEBUG is not set -# CONFIG_IPW2100 is not set -CONFIG_IPW2100_MONITOR=y -# CONFIG_IPW2200_DEBUG is not set -# CONFIG_IPW2200 is not set -CONFIG_IPW2200_MONITOR=y -# CONFIG_IPW2200_PROMISCUOUS is not set -# CONFIG_IPW2200_QOS is not set -# CONFIG_IPW2200_RADIOTAP is not set -# CONFIG_IPWIRELESS is not set -# CONFIG_IPX is not set -# CONFIG_IRDA is not set -# CONFIG_IRQSOFF_TRACER is not set -# CONFIG_ISCSI_TCP is not set -# CONFIG_ISDN_CAPI_CAPI20 is not set -CONFIG_ISDN_CAPI_CAPIFS_BOOL=y -# CONFIG_ISDN_CAPI_CAPIFS is not set -# CONFIG_ISDN_CAPI is not set -CONFIG_ISDN_CAPI_MIDDLEWARE=y -# CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON is not set -# CONFIG_ISDN_I4L is not set -CONFIG_ISDN=y -# CONFIG_ISO9660_FS is not set -# CONFIG_IWL3945 is not set -# CONFIG_IWLAGN is not set -# CONFIG_IWLCORE is not set -# CONFIG_IWLWIFI_LEDS is not set -# CONFIG_IXGB is not set -# CONFIG_JBD_DEBUG is not set -# CONFIG_JBD is not set -# CONFIG_JFFS2_CMODE_FAVOURLZO is not set -# CONFIG_JFFS2_CMODE_NONE is not set -CONFIG_JFFS2_CMODE_PRIORITY=y -# CONFIG_JFFS2_CMODE_SIZE is not set -CONFIG_JFFS2_COMPRESSION_OPTIONS=y -CONFIG_JFFS2_FS_DEBUG=0 -# CONFIG_JFFS2_FS_WBUF_VERIFY is not set -CONFIG_JFFS2_FS_WRITEBUFFER=y -# CONFIG_JFFS2_FS_XATTR is not set -CONFIG_JFFS2_FS=y -# CONFIG_JFFS2_LZO is not set -CONFIG_JFFS2_RTIME=y -# CONFIG_JFFS2_RUBIN is not set -CONFIG_JFFS2_SUMMARY=y -CONFIG_JFFS2_ZLIB=y -# CONFIG_JFFS_FS is not set -# CONFIG_JFS_DEBUG is not set -# CONFIG_JFS_FS is not set -# CONFIG_JFS_POSIX_ACL is not set -# CONFIG_JFS_SECURITY is not set -# CONFIG_JFS_STATISTICS is not set -CONFIG_JOLIET=y -# CONFIG_KALLSYMS_EXTRA_PASS is not set -# CONFIG_KALLSYMS is not set -# CONFIG_KARMA_PARTITION is not set -# CONFIG_KEXEC is not set -# CONFIG_KEYS is not set -CONFIG_KMOD=y -# CONFIG_KPROBES is not set -# CONFIG_LANMEDIA is not set -# CONFIG_LAPB is not set -# CONFIG_LASAT is not set -# CONFIG_LATENCYTOP is not set -# CONFIG_LBD is not set -# CONFIG_LDM_PARTITION is not set -# CONFIG_LEDS_ALIX is not set -CONFIG_LEDS_CLASS=y -# CONFIG_LEDS_PCA9532 is not set -# CONFIG_LEDS_PCA955X is not set -CONFIG_LEDS_TRIGGER_DEFAULT_ON=y -CONFIG_LEDS_TRIGGER_HEARTBEAT=y -# CONFIG_LEDS_TRIGGER_IDE_DISK is not set -# CONFIG_LEDS_TRIGGER_MORSE is not set -CONFIG_LEDS_TRIGGER_NETDEV=y -CONFIG_LEDS_TRIGGERS=y -CONFIG_LEDS_TRIGGER_TIMER=y -# CONFIG_LEGACY_PTYS is not set -# CONFIG_LIBCRC32C is not set -# CONFIG_LIBERTAS is not set -# CONFIG_LIBERTAS_USB is not set -# CONFIG_LLC2 is not set -CONFIG_LLC=y -CONFIG_LOCALVERSION="" -# CONFIG_LOCALVERSION_AUTO is not set -CONFIG_LOCKDEP_SUPPORT=y -# CONFIG_LOCKD is not set -CONFIG_LOCKD_V4=y -CONFIG_LOG_BUF_SHIFT=14 -# CONFIG_LSF is not set -# CONFIG_LXT_PHY is not set -# CONFIG_MAC80211 is not set -# CONFIG_MAC_EMUMOUSEBTN is not set -# CONFIG_MAC_PARTITION is not set -# CONFIG_MACVLAN is not set -# CONFIG_MAGIC_SYSRQ is not set -# CONFIG_MARKEINS is not set -# CONFIG_MARKERS is not set -# CONFIG_MARVELL_PHY is not set -# CONFIG_MDIO_BITBANG is not set -# CONFIG_MD is not set -# CONFIG_MEDIA_ATTACH is not set -# CONFIG_MEDIA_TUNER_CUSTOMIZE is not set -# CONFIG_MEGARAID_LEGACY is not set -# CONFIG_MEGARAID_NEWGEN is not set -# CONFIG_MEGARAID_SAS is not set -# CONFIG_MEMSTICK is not set -# CONFIG_MFD_ASIC3 is not set -# CONFIG_MFD_CORE is not set -# CONFIG_MFD_SM501 is not set -# CONFIG_MFD_T7L66XB is not set -# CONFIG_MFD_TC6387XB is not set -# CONFIG_MFD_TMIO is not set -# CONFIG_MIGRATION is not set -CONFIG_MII=y -CONFIG_MINI_FO=y -# CONFIG_MINIX_FS is not set -# CONFIG_MINIX_SUBPARTITION is not set -CONFIG_MISC_DEVICES=y -# CONFIG_MISDN_HFCPCI is not set -# CONFIG_MISDN is not set -# CONFIG_MKISS is not set -# CONFIG_MMC_ARMMMCI is not set -CONFIG_MMC_BLOCK_BOUNCE=y -# CONFIG_MMC_BLOCK is not set -# CONFIG_MMC_DEBUG is not set -# CONFIG_MMC is not set -# CONFIG_MMC_SDHCI is not set -# CONFIG_MMC_SDHCI_PCI is not set -# CONFIG_MMC_SDRICOH_CS is not set -# CONFIG_MMC_TEST is not set -# CONFIG_MMC_TIFM_SD is not set -# CONFIG_MMC_UNSAFE_RESUME is not set -# CONFIG_MMC_WBSD is not set -CONFIG_MMU=y -# CONFIG_MODULE_FORCE_LOAD is not set -# CONFIG_MODULE_FORCE_UNLOAD is not set -# CONFIG_MODULE_SRCVERSION_ALL is not set -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_MODVERSIONS is not set -# CONFIG_MOUSE_APPLETOUCH is not set -# CONFIG_MOUSE_INPORT is not set -# CONFIG_MOUSE_LOGIBM is not set -# CONFIG_MOUSE_PC110PAD is not set -# CONFIG_MSDOS_FS is not set -CONFIG_MSDOS_PARTITION=y -# CONFIG_MTD_ABSENT is not set -# CONFIG_MTD_AFS_PARTS is not set -# CONFIG_MTD_AR7_PARTS is not set -# CONFIG_MTD_ARM_INTEGRATOR is not set -CONFIG_MTD_BLKDEVS=y -# CONFIG_MTD_BLOCK2MTD is not set -CONFIG_MTD_BLOCK=y -# CONFIG_MTD_CFI_ADV_OPTIONS is not set -CONFIG_MTD_CFI_AMDSTD=y -# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set -CONFIG_MTD_CFI_I1=y -CONFIG_MTD_CFI_I2=y -# CONFIG_MTD_CFI_I4 is not set -# CONFIG_MTD_CFI_I8 is not set -CONFIG_MTD_CFI_INTELEXT=y -# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set -CONFIG_MTD_CFI_NOSWAP=y -# CONFIG_MTD_CFI_STAA is not set -CONFIG_MTD_CFI_UTIL=y -CONFIG_MTD_CFI=y -CONFIG_MTD_CHAR=y -# CONFIG_MTD_CMDLINE_PARTS is not set -CONFIG_MTD_COMPLEX_MAPPINGS=y -# CONFIG_MTD_CONCAT is not set -# CONFIG_MTD_DATAFLASH is not set -# CONFIG_MTD_DEBUG is not set -# CONFIG_MTD_DOC2000 is not set -# CONFIG_MTD_DOC2001 is not set -# CONFIG_MTD_DOC2001PLUS is not set -CONFIG_MTD_GEN_PROBE=y -# CONFIG_MTD_INTEL_VR_NOR is not set -# CONFIG_MTD_JEDECPROBE is not set -# CONFIG_MTD_LPDDR is not set -# CONFIG_MTD_M25P80 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set -CONFIG_MTD_MAP_BANK_WIDTH_1=y -CONFIG_MTD_MAP_BANK_WIDTH_2=y -# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set -CONFIG_MTD_MAP_BANK_WIDTH_4=y -# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set -# CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_MYLOADER_PARTS is not set -# CONFIG_MTD_NAND_CAFE is not set -# CONFIG_MTD_NAND_DISKONCHIP is not set -# CONFIG_MTD_NAND_ECC_SMC is not set -CONFIG_MTD_NAND_IDS=y -# CONFIG_MTD_NAND is not set -# CONFIG_MTD_NAND_MUSEUM_IDS is not set -# CONFIG_MTD_NAND_NANDSIM is not set -# CONFIG_MTD_NAND_PLATFORM is not set -# CONFIG_MTD_NAND_VERIFY_WRITE is not set -# CONFIG_MTD_ONENAND is not set -# CONFIG_MTD_OOPS is not set -# CONFIG_MTD_OTP is not set -CONFIG_MTD_PARTITIONS=y -# CONFIG_MTD_PCI is not set -# CONFIG_MTD_PHRAM is not set -# CONFIG_MTD_PHYSMAP is not set -# CONFIG_MTD_PLATRAM is not set -# CONFIG_MTD_PMC551 is not set -# CONFIG_MTD_RAM is not set -CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1 -# CONFIG_MTD_REDBOOT_PARTS is not set -CONFIG_MTD_REDBOOT_PARTS_READONLY=y -# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set -# CONFIG_MTD_ROM is not set -CONFIG_MTD_ROOTFS_ROOT_DEV=y -CONFIG_MTD_ROOTFS_SPLIT=y -# CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_UBI is not set -CONFIG_MTD=y -# CONFIG_MVSWITCH_PHY is not set -# CONFIG_MWAVE is not set -# CONFIG_MYRI10GE is not set -# CONFIG_NAMESPACES is not set -# CONFIG_NCP_FS is not set -# CONFIG_NE2K_PCI is not set -# CONFIG_NET_9P is not set -# CONFIG_NET_ACT_GACT is not set -# CONFIG_NET_ACT_IPT is not set -# CONFIG_NET_ACT_MIRRED is not set -# CONFIG_NET_ACT_NAT is not set -# CONFIG_NET_ACT_PEDIT is not set -CONFIG_NET_ACT_POLICE=y -# CONFIG_NET_ACT_SIMP is not set -CONFIG_NET_CLS_ACT=y -# CONFIG_NET_CLS_BASIC is not set -# CONFIG_NET_CLS_FLOW is not set -# CONFIG_NET_CLS_FW is not set -CONFIG_NET_CLS_IND=y -CONFIG_NET_CLS_POLICE=y -# CONFIG_NET_CLS_ROUTE4 is not set -CONFIG_NET_CLS_ROUTE=y -# CONFIG_NET_CLS_RSVP6 is not set -# CONFIG_NET_CLS_RSVP is not set -# CONFIG_NET_CLS_TCINDEX is not set -# CONFIG_NET_CLS_U32 is not set -CONFIG_NET_CLS=y -# CONFIG_NETCONSOLE is not set -# CONFIG_NETDEBUG is not set -# CONFIG_NETDEV_10000 is not set -CONFIG_NETDEV_1000=y -CONFIG_NETDEVICES_MULTIQUEUE=y -CONFIG_NETDEVICES=y -# CONFIG_NET_EMATCH_CMP is not set -# CONFIG_NET_EMATCH is not set -# CONFIG_NET_EMATCH_META is not set -# CONFIG_NET_EMATCH_NBYTE is not set -CONFIG_NET_EMATCH_STACK=32 -# CONFIG_NET_EMATCH_TEXT is not set -# CONFIG_NET_EMATCH_U32 is not set -CONFIG_NET_ESTIMATOR=y -CONFIG_NET_ETHERNET=y -# CONFIG_NET_FC is not set -CONFIG_NETFILTER_ADVANCED=y -# CONFIG_NETFILTER_DEBUG is not set -# CONFIG_NETFILTER_NETLINK is not set -# CONFIG_NETFILTER_NETLINK_LOG is not set -# CONFIG_NETFILTER_NETLINK_QUEUE is not set -# CONFIG_NETFILTER_XTABLES is not set -# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set -# CONFIG_NETFILTER_XT_MATCH_CONNTRACK is not set -# CONFIG_NETFILTER_XT_MATCH_DCCP is not set -# CONFIG_NETFILTER_XT_MATCH_DSCP is not set -# CONFIG_NETFILTER_XT_MATCH_ESP is not set -# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_HELPER is not set -# CONFIG_NETFILTER_XT_MATCH_IPRANGE is not set -# CONFIG_NETFILTER_XT_MATCH_LAYER7_DEBUG is not set -# CONFIG_NETFILTER_XT_MATCH_LAYER7 is not set -# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set -# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_MAC is not set -# CONFIG_NETFILTER_XT_MATCH_MARK is not set -# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set -# CONFIG_NETFILTER_XT_MATCH_OWNER is not set -# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set -# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set -# CONFIG_NETFILTER_XT_MATCH_POLICY is not set -# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set -# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set -# CONFIG_NETFILTER_XT_MATCH_REALM is not set -# CONFIG_NETFILTER_XT_MATCH_SCTP is not set -# CONFIG_NETFILTER_XT_MATCH_STATE is not set -# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set -# CONFIG_NETFILTER_XT_MATCH_STRING is not set -# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set -# CONFIG_NETFILTER_XT_MATCH_TIME is not set -# CONFIG_NETFILTER_XT_MATCH_U32 is not set -# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set -# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set -# CONFIG_NETFILTER_XT_TARGET_DSCP is not set -# CONFIG_NETFILTER_XT_TARGET_IMQ is not set -# CONFIG_NETFILTER_XT_TARGET_MARK is not set -# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set -# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set -# CONFIG_NETFILTER_XT_TARGET_NOTRACK is not set -# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set -# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set -# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set -# CONFIG_NETFILTER_XT_TARGET_TRACE is not set -CONFIG_NETFILTER=y -CONFIG_NET_IPGRE_BROADCAST=y -# CONFIG_NET_IPGRE is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_ISA is not set -# CONFIG_NET_KEY is not set -# CONFIG_NET_KEY_MIGRATE is not set -CONFIG_NET_PCI=y -# CONFIG_NET_PCMCIA is not set -# CONFIG_NET_PKTGEN is not set -# CONFIG_NET_POLL_CONTROLLER is not set -# CONFIG_NETPOLL is not set -CONFIG_NET_RADIO=y -# CONFIG_NETROM is not set -# CONFIG_NET_SB1000 is not set -# CONFIG_NET_SCH_ATM is not set -# CONFIG_NET_SCH_CBQ is not set -# CONFIG_NET_SCH_CLK_CPU is not set -# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set -CONFIG_NET_SCH_CLK_JIFFIES=y -# CONFIG_NET_SCH_DSMARK is not set -CONFIG_NET_SCHED=y -# CONFIG_NET_SCH_ESFQ is not set -CONFIG_NET_SCH_ESFQ_NFCT=y -CONFIG_NET_SCH_FIFO=y -# CONFIG_NET_SCH_GRED is not set -# CONFIG_NET_SCH_HFSC is not set -# CONFIG_NET_SCH_HTB is not set -# CONFIG_NET_SCH_INGRESS is not set -# CONFIG_NET_SCH_NETEM is not set -# CONFIG_NET_SCH_PRIO is not set -# CONFIG_NET_SCH_RED is not set -# CONFIG_NET_SCH_RR is not set -# CONFIG_NET_SCH_SFQ is not set -# CONFIG_NET_SCH_TBF is not set -# CONFIG_NET_SCH_TEQL is not set -# CONFIG_NET_TULIP is not set -# CONFIG_NET_VENDOR_3COM is not set -CONFIG_NET_WIRELESS_RTNETLINK=y -CONFIG_NET_WIRELESS=y -CONFIG_NETWORK_FILESYSTEMS=y -# CONFIG_NETWORK_SECMARK is not set -# CONFIG_NETXEN_NIC is not set -CONFIG_NET=y -# CONFIG_NEW_GPIO is not set -CONFIG_NEW_LEDS=y -# CONFIG_NF_CONNTRACK_AMANDA is not set -CONFIG_NF_CONNTRACK_ENABLED=y -# CONFIG_NF_CONNTRACK_EVENTS is not set -# CONFIG_NF_CONNTRACK_FTP is not set -# CONFIG_NF_CONNTRACK_H323 is not set -# CONFIG_NF_CONNTRACK_IPV4 is not set -# CONFIG_NF_CONNTRACK_IPV6 is not set -# CONFIG_NF_CONNTRACK_IRC is not set -# CONFIG_NF_CONNTRACK is not set -CONFIG_NF_CONNTRACK_MARK=y -# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set -# CONFIG_NF_CONNTRACK_PPTP is not set -CONFIG_NF_CONNTRACK_PROC_COMPAT=y -# CONFIG_NF_CONNTRACK_RTSP is not set -# CONFIG_NF_CONNTRACK_SANE is not set -# CONFIG_NF_CONNTRACK_SIP is not set -CONFIG_NF_CONNTRACK_SUPPORT=y -# CONFIG_NF_CONNTRACK_TFTP is not set -# CONFIG_NF_CT_ACCT is not set -# CONFIG_NF_CT_NETLINK is not set -# CONFIG_NF_CT_PROTO_DCCP is not set -# CONFIG_NF_CT_PROTO_GRE is not set -# CONFIG_NF_CT_PROTO_SCTP is not set -# CONFIG_NF_CT_PROTO_UDPLITE is not set -# CONFIG_NF_NAT_AMANDA is not set -# CONFIG_NF_NAT_FTP is not set -# CONFIG_NF_NAT_H323 is not set -# CONFIG_NF_NAT_IRC is not set -# CONFIG_NF_NAT is not set -CONFIG_NF_NAT_NEEDED=y -# CONFIG_NF_NAT_PPTP is not set -# CONFIG_NF_NAT_PROTO_GRE is not set -# CONFIG_NF_NAT_RTSP is not set -# CONFIG_NF_NAT_SIP is not set -# CONFIG_NF_NAT_SNMP_BASIC is not set -# CONFIG_NF_NAT_TFTP is not set -# CONFIG_NFS_ACL_SUPPORT is not set -CONFIG_NFS_COMMON=y -# CONFIG_NFS_DIRECTIO is not set -# CONFIG_NFSD is not set -CONFIG_NFSD_TCP=y -# CONFIG_NFSD_V2_ACL is not set -# CONFIG_NFSD_V3_ACL is not set -CONFIG_NFSD_V3=y -CONFIG_NFSD_V4=y -# CONFIG_NFS_FS is not set -# CONFIG_NFS_V3_ACL is not set -CONFIG_NFS_V3=y -CONFIG_NFS_V4=y -# CONFIG_NFTL is not set -CONFIG_NL80211=y -# CONFIG_NLS_ASCII is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -# CONFIG_NLS_CODEPAGE_437 is not set -# CONFIG_NLS_CODEPAGE_737 is not set -# CONFIG_NLS_CODEPAGE_775 is not set -# CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_CODEPAGE_852 is not set -# CONFIG_NLS_CODEPAGE_855 is not set -# CONFIG_NLS_CODEPAGE_857 is not set -# CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set -# CONFIG_NLS_CODEPAGE_862 is not set -# CONFIG_NLS_CODEPAGE_863 is not set -# CONFIG_NLS_CODEPAGE_864 is not set -# CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set -# CONFIG_NLS_CODEPAGE_869 is not set -# CONFIG_NLS_CODEPAGE_874 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -CONFIG_NLS_DEFAULT="iso8859-1" -# CONFIG_NLS is not set -# CONFIG_NLS_ISO8859_13 is not set -# CONFIG_NLS_ISO8859_14 is not set -# CONFIG_NLS_ISO8859_15 is not set -# CONFIG_NLS_ISO8859_1 is not set -# CONFIG_NLS_ISO8859_2 is not set -# CONFIG_NLS_ISO8859_3 is not set -# CONFIG_NLS_ISO8859_4 is not set -# CONFIG_NLS_ISO8859_5 is not set -# CONFIG_NLS_ISO8859_6 is not set -# CONFIG_NLS_ISO8859_7 is not set -# CONFIG_NLS_ISO8859_8 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U is not set -# CONFIG_NLS_UTF8 is not set -# CONFIG_NO_HZ is not set -# CONFIG_NORTEL_HERMES is not set -# CONFIG_NOZOMI is not set -# CONFIG_NS83820 is not set -# CONFIG_NTFS_DEBUG is not set -# CONFIG_NTFS_FS is not set -# CONFIG_NTFS_RW is not set -# CONFIG_OCF_BENCH is not set -# CONFIG_OCF_EP80579 is not set -# CONFIG_OCF_HIFNHIPP is not set -# CONFIG_OCF_HIFN is not set -# CONFIG_OCF_IXP4XX is not set -# CONFIG_OCF_OCF is not set -# CONFIG_OCF_OCFNULL is not set -# CONFIG_OCFS2_FS is not set -# CONFIG_OCF_SAFE is not set -# CONFIG_OCF_TALITOS is not set -# CONFIG_OMFS_FS is not set -# CONFIG_OSF_PARTITION is not set -# CONFIG_P54_COMMON is not set -CONFIG_PACKET_MMAP=y -CONFIG_PACKET=y -# CONFIG_PAGE_SIZE_16KB is not set -CONFIG_PAGE_SIZE_4KB=y -# CONFIG_PAGE_SIZE_64KB is not set -# CONFIG_PAGE_SIZE_8KB is not set -# CONFIG_PARPORT is not set -# CONFIG_PARPORT_PC is not set -CONFIG_PARTITION_ADVANCED=y -# CONFIG_PATA_ALI is not set -# CONFIG_PATA_AMD is not set -# CONFIG_PATA_ARTOP is not set -# CONFIG_PATA_ATIIXP is not set -# CONFIG_PATA_CMD640_PCI is not set -# CONFIG_PATA_CMD64X is not set -# CONFIG_PATA_CS5520 is not set -# CONFIG_PATA_CS5530 is not set -# CONFIG_PATA_CS5535 is not set -# CONFIG_PATA_CYPRESS is not set -# CONFIG_PATA_EFAR is not set -# CONFIG_PATA_HPT366 is not set -# CONFIG_PATA_HPT37X is not set -# CONFIG_PATA_HPT3X2N is not set -# CONFIG_PATA_HPT3X3 is not set -# CONFIG_PATA_ISAPNP is not set -# CONFIG_PATA_IT8213 is not set -# CONFIG_PATA_IT821X is not set -# CONFIG_PATA_JMICRON is not set -# CONFIG_PATA_LEGACY is not set -# CONFIG_PATA_MARVELL is not set -# CONFIG_PATA_MPIIX is not set -# CONFIG_PATA_NETCELL is not set -# CONFIG_PATA_NINJA32 is not set -# CONFIG_PATA_NS87410 is not set -# CONFIG_PATA_NS87415 is not set -# CONFIG_PATA_OLDPIIX is not set -# CONFIG_PATA_OPTIDMA is not set -# CONFIG_PATA_OPTI is not set -# CONFIG_PATA_PCMCIA is not set -# CONFIG_PATA_PDC2027X is not set -# CONFIG_PATA_PDC_OLD is not set -# CONFIG_PATA_PLATFORM is not set -# CONFIG_PATA_QDI is not set -# CONFIG_PATA_RADISYS is not set -# CONFIG_PATA_RZ1000 is not set -# CONFIG_PATA_SC1200 is not set -# CONFIG_PATA_SERVERWORKS is not set -# CONFIG_PATA_SIL680 is not set -# CONFIG_PATA_SIS is not set -# CONFIG_PATA_TRIFLEX is not set -# CONFIG_PATA_VIA is not set -# CONFIG_PATA_WINBOND is not set -# CONFIG_PATA_WINBOND_VLB is not set -# CONFIG_PC300TOO is not set -# CONFIG_PCCARD is not set -# CONFIG_PCF8575 is not set -# CONFIG_PCI200SYN is not set -# CONFIG_PCI_ATMEL is not set -# CONFIG_PCI_HERMES is not set -# CONFIG_PCI is not set -# CONFIG_PCI_LEGACY is not set -# CONFIG_PCI_MSI is not set -# CONFIG_PCIPCWATCHDOG is not set -# CONFIG_PCMCIA_AHA152X is not set -# CONFIG_PCMCIA_ATMEL is not set -# CONFIG_PCMCIA_DEBUG is not set -# CONFIG_PCMCIA_FDOMAIN is not set -# CONFIG_PCMCIA_HERMES is not set -# CONFIG_PCMCIA_IOCTL is not set -# CONFIG_PCMCIA is not set -# CONFIG_PCMCIA_LOAD_CIS is not set -# CONFIG_PCMCIA_NETWAVE is not set -# CONFIG_PCMCIA_NINJA_SCSI is not set -# CONFIG_PCMCIA_QLOGIC is not set -# CONFIG_PCMCIA_RAYCS is not set -# CONFIG_PCMCIA_SPECTRUM is not set -# CONFIG_PCMCIA_SYM53C500 is not set -# CONFIG_PCMCIA_WAVELAN is not set -# CONFIG_PCMCIA_WL3501 is not set -# CONFIG_PCNET32 is not set -# CONFIG_PD6729 is not set -# CONFIG_PDC_ADMA is not set -# CONFIG_PHANTOM is not set -# CONFIG_PHONE is not set -# CONFIG_PHYLIB is not set -# CONFIG_PID_NS is not set -CONFIG_PLIST=y -# CONFIG_PLX_HERMES is not set -# CONFIG_PM is not set -# CONFIG_POSIX_MQUEUE is not set -# CONFIG_POWER_SUPPLY is not set -# CONFIG_PPP_ASYNC is not set -# CONFIG_PPP_BSDCOMP is not set -# CONFIG_PPP_DEFLATE is not set -CONFIG_PPP_FILTER=y -# CONFIG_PPP is not set -# CONFIG_PPP_MPPE is not set -CONFIG_PPP_MULTILINK=y -# CONFIG_PPPOATM is not set -# CONFIG_PPPOE is not set -# CONFIG_PPPOL2TP is not set -# CONFIG_PPP_SYNC_TTY is not set -# CONFIG_PREEMPT is not set -CONFIG_PREEMPT_NONE=y -# CONFIG_PREEMPT_VOLUNTARY is not set -CONFIG_PREVENT_FIRMWARE_BUILD=y -# CONFIG_PRINTK_TIME is not set -CONFIG_PRINTK=y -# CONFIG_PRISM54 is not set -CONFIG_PROC_FS=y -CONFIG_PROC_KCORE=y -# CONFIG_PROC_PAGE_MONITOR is not set -CONFIG_PROC_SYSCTL=y -# CONFIG_PROFILING is not set -# CONFIG_QEMU is not set -# CONFIG_QLA3XXX is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_QSEMI_PHY is not set -# CONFIG_QUOTA is not set -# CONFIG_R3964 is not set -# CONFIG_R8169 is not set -# CONFIG_RADIO_ADAPTERS is not set -# CONFIG_RADIO_AZTECH is not set -# CONFIG_RADIO_CADET is not set -# CONFIG_RADIO_GEMTEK is not set -# CONFIG_RADIO_GEMTEK_PCI is not set -# CONFIG_RADIO_MAESTRO is not set -# CONFIG_RADIO_MAXIRADIO is not set -# CONFIG_RADIO_RTRACK2 is not set -# CONFIG_RADIO_RTRACK is not set -# CONFIG_RADIO_SF16FMI is not set -# CONFIG_RADIO_SF16FMR2 is not set -# CONFIG_RADIO_TERRATEC is not set -# CONFIG_RADIO_TRUST is not set -# CONFIG_RADIO_TYPHOON is not set -# CONFIG_RADIO_ZOLTRIX is not set -# CONFIG_RAID_ATTRS is not set -CONFIG_RAMFS=y -# CONFIG_RAW_DRIVER is not set -# CONFIG_REALTEK_PHY is not set -# CONFIG_REGULATOR_BQ24022 is not set -# CONFIG_REGULATOR_FIXED_VOLTAGE is not set -# CONFIG_REGULATOR is not set -# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set -# CONFIG_REISERFS_CHECK is not set -# CONFIG_REISERFS_FS is not set -# CONFIG_REISERFS_FS_XATTR is not set -# CONFIG_REISERFS_PROC_INFO is not set -# CONFIG_RELAY is not set -# CONFIG_RESOURCES_64BIT is not set -# CONFIG_RFD_FTL is not set -# CONFIG_RFKILL_INPUT is not set -# CONFIG_RFKILL is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_ROSE is not set -# CONFIG_RPCSEC_GSS_KRB5 is not set -# CONFIG_RPCSEC_GSS_SPKM3 is not set -# CONFIG_RT2X00 is not set -# CONFIG_RTC_CLASS is not set -# CONFIG_RTC_DEBUG is not set -CONFIG_RTC_DRV_CMOS=y -# CONFIG_RTC_DRV_DS1305 is not set -# CONFIG_RTC_DRV_DS1307 is not set -# CONFIG_RTC_DRV_DS1374 is not set -# CONFIG_RTC_DRV_DS1511 is not set -# CONFIG_RTC_DRV_DS1553 is not set -# CONFIG_RTC_DRV_DS1672 is not set -# CONFIG_RTC_DRV_DS1742 is not set -# CONFIG_RTC_DRV_FM3130 is not set -# CONFIG_RTC_DRV_ISL1208 is not set -# CONFIG_RTC_DRV_M41T80 is not set -# CONFIG_RTC_DRV_M41T94 is not set -# CONFIG_RTC_DRV_M48T59 is not set -# CONFIG_RTC_DRV_M48T86 is not set -# CONFIG_RTC_DRV_MAX6900 is not set -# CONFIG_RTC_DRV_MAX6902 is not set -# CONFIG_RTC_DRV_PCF50606 is not set -# CONFIG_RTC_DRV_PCF8563 is not set -# CONFIG_RTC_DRV_PCF8583 is not set -# CONFIG_RTC_DRV_R9701 is not set -# CONFIG_RTC_DRV_RS5C348 is not set -# CONFIG_RTC_DRV_RS5C372 is not set -# CONFIG_RTC_DRV_S35390A is not set -# CONFIG_RTC_DRV_STK17TA8 is not set -# CONFIG_RTC_DRV_TEST is not set -# CONFIG_RTC_DRV_V3020 is not set -# CONFIG_RTC_DRV_X1205 is not set -CONFIG_RTC_HCTOSYS_DEVICE="rtc0" -CONFIG_RTC_HCTOSYS=y -# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set -CONFIG_RTC_INTF_DEV=y -CONFIG_RTC_INTF_PROC=y -CONFIG_RTC_INTF_SYSFS=y -CONFIG_RTC_LIB=y -# CONFIG_RTL8180 is not set -# CONFIG_RTL8187 is not set -CONFIG_RT_MUTEXES=y -CONFIG_RWSEM_GENERIC_SPINLOCK=y -# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set -# CONFIG_S2IO is not set -# CONFIG_SAMPLES is not set -# CONFIG_SATA_AHCI is not set -# CONFIG_SATA_INIC162X is not set -# CONFIG_SATA_MV is not set -# CONFIG_SATA_NV is not set -# CONFIG_SATA_PMP is not set -# CONFIG_SATA_PROMISE is not set -# CONFIG_SATA_QSTOR is not set -# CONFIG_SATA_SIL24 is not set -# CONFIG_SATA_SIL is not set -# CONFIG_SATA_SIS is not set -# CONFIG_SATA_SVW is not set -# CONFIG_SATA_SX4 is not set -# CONFIG_SATA_ULI is not set -# CONFIG_SATA_VIA is not set -# CONFIG_SATA_VITESSE is not set -# CONFIG_SC92031 is not set -# CONFIG_SCC is not set -# CONFIG_SCHED_TRACER is not set -# CONFIG_SCSI_3W_9XXX is not set -# CONFIG_SCSI_7000FASST is not set -# CONFIG_SCSI_AACRAID is not set -# CONFIG_SCSI_ACARD is not set -# CONFIG_SCSI_ADVANSYS is not set -# CONFIG_SCSI_AHA152X is not set -# CONFIG_SCSI_AHA1542 is not set -# CONFIG_SCSI_AIC79XX is not set -# CONFIG_SCSI_AIC7XXX is not set -# CONFIG_SCSI_AIC7XXX_OLD is not set -# CONFIG_SCSI_AIC94XX is not set -# CONFIG_SCSI_ARCMSR is not set -# CONFIG_SCSI_BUSLOGIC is not set -# CONFIG_SCSI_CONSTANTS is not set -# CONFIG_SCSI_DC390T is not set -# CONFIG_SCSI_DC395x is not set -# CONFIG_SCSI_DEBUG is not set -# CONFIG_SCSI_DH is not set -CONFIG_SCSI_DMA=y -# CONFIG_SCSI_DMX3191D is not set -# CONFIG_SCSI_DPT_I2O is not set -# CONFIG_SCSI_DTC3280 is not set -# CONFIG_SCSI_EATA is not set -# CONFIG_SCSI_ESP_CORE is not set -# CONFIG_SCSI_FC_ATTRS is not set -# CONFIG_SCSI_FUTURE_DOMAIN is not set -# CONFIG_SCSI_GDTH is not set -# CONFIG_SCSI_GENERIC_NCR5380 is not set -# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set -# CONFIG_SCSI_HPTIOP is not set -# CONFIG_SCSI_IN2000 is not set -# CONFIG_SCSI_INIA100 is not set -# CONFIG_SCSI_INITIO is not set -# CONFIG_SCSI_IPR is not set -# CONFIG_SCSI_IPS is not set -# CONFIG_SCSI_ISCSI_ATTRS is not set -# CONFIG_SCSI is not set -# CONFIG_SCSI_LOGGING is not set -# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set -CONFIG_SCSI_LOWLEVEL=y -# CONFIG_SCSI_LPFC is not set -CONFIG_SCSI_MULTI_LUN=y -# CONFIG_SCSI_MVSAS is not set -# CONFIG_SCSI_NCR53C406A is not set -# CONFIG_SCSI_NETLINK is not set -# CONFIG_SCSI_NSP32 is not set -# CONFIG_SCSI_PAS16 is not set -CONFIG_SCSI_PROC_FS=y -# CONFIG_SCSI_PSI240I is not set -# CONFIG_SCSI_QLA_FC is not set -# CONFIG_SCSI_QLA_ISCSI is not set -# CONFIG_SCSI_QLOGIC_1280 is not set -# CONFIG_SCSI_QLOGIC_FAS is not set -# CONFIG_SCSI_SAS_ATTRS is not set -# CONFIG_SCSI_SAS_LIBSAS is not set -# CONFIG_SCSI_SCAN_ASYNC is not set -# CONFIG_SCSI_SEAGATE is not set -# CONFIG_SCSI_SPI_ATTRS is not set -# CONFIG_SCSI_SRP_ATTRS is not set -# CONFIG_SCSI_SRP is not set -# CONFIG_SCSI_STEX is not set -# CONFIG_SCSI_SYM53C416 is not set -# CONFIG_SCSI_SYM53C8XX_2 is not set -# CONFIG_SCSI_T128 is not set -# CONFIG_SCSI_TGT is not set -# CONFIG_SCSI_U14_34F is not set -# CONFIG_SCSI_ULTRASTOR is not set -CONFIG_SCSI_WAIT_SCAN=m -# CONFIG_SECCOMP is not set -# CONFIG_SECURITY_FILE_CAPABILITIES is not set -# CONFIG_SECURITY is not set -CONFIG_SELECT_MEMORY_MODEL=y -# CONFIG_SENSORS_ABITUGURU3 is not set -# CONFIG_SENSORS_ABITUGURU is not set -# CONFIG_SENSORS_AD7414 is not set -# CONFIG_SENSORS_AD7418 is not set -# CONFIG_SENSORS_ADCXX is not set -# CONFIG_SENSORS_ADM1021 is not set -# CONFIG_SENSORS_ADM1025 is not set -# CONFIG_SENSORS_ADM1026 is not set -# CONFIG_SENSORS_ADM1029 is not set -# CONFIG_SENSORS_ADM1031 is not set -# CONFIG_SENSORS_ADM9240 is not set -# CONFIG_SENSORS_ADS7828 is not set -# CONFIG_SENSORS_ADT7470 is not set -# CONFIG_SENSORS_ADT7473 is not set -# CONFIG_SENSORS_APPLESMC is not set -# CONFIG_SENSORS_ASB100 is not set -# CONFIG_SENSORS_ATXP1 is not set -# CONFIG_SENSORS_CORETEMP is not set -# CONFIG_SENSORS_DME1737 is not set -# CONFIG_SENSORS_DS1337 is not set -# CONFIG_SENSORS_DS1374 is not set -# CONFIG_SENSORS_DS1621 is not set -# CONFIG_SENSORS_EEPROM is not set -# CONFIG_SENSORS_F71805F is not set -# CONFIG_SENSORS_F71882FG is not set -# CONFIG_SENSORS_F75375S is not set -# CONFIG_SENSORS_FSCHER is not set -# CONFIG_SENSORS_FSCHMD is not set -# CONFIG_SENSORS_FSCPOS is not set -# CONFIG_SENSORS_GL518SM is not set -# CONFIG_SENSORS_GL520SM is not set -# CONFIG_SENSORS_HDAPS is not set -# CONFIG_SENSORS_I5K_AMB is not set -# CONFIG_SENSORS_IT87 is not set -# CONFIG_SENSORS_K8TEMP is not set -# CONFIG_SENSORS_LM63 is not set -# CONFIG_SENSORS_LM70 is not set -# CONFIG_SENSORS_LM75 is not set -# CONFIG_SENSORS_LM77 is not set -# CONFIG_SENSORS_LM78 is not set -# CONFIG_SENSORS_LM80 is not set -# CONFIG_SENSORS_LM83 is not set -# CONFIG_SENSORS_LM85 is not set -# CONFIG_SENSORS_LM87 is not set -# CONFIG_SENSORS_LM90 is not set -# CONFIG_SENSORS_LM92 is not set -# CONFIG_SENSORS_LM93 is not set -# CONFIG_SENSORS_M41T00 is not set -# CONFIG_SENSORS_MAX1619 is not set -# CONFIG_SENSORS_MAX6650 is not set -# CONFIG_SENSORS_MAX6875 is not set -# CONFIG_SENSORS_PC87427 is not set -# CONFIG_SENSORS_PCA9539 is not set -# CONFIG_SENSORS_PCF8574 is not set -# CONFIG_SENSORS_PCF8591 is not set -# CONFIG_SENSORS_SIS5595 is not set -# CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_SMSC47M192 is not set -# CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_THMC50 is not set -# CONFIG_SENSORS_TSL2550 is not set -# CONFIG_SENSORS_VIA686A is not set -# CONFIG_SENSORS_VT1211 is not set -# CONFIG_SENSORS_VT8231 is not set -# CONFIG_SENSORS_W83627EHF is not set -# CONFIG_SENSORS_W83627HF is not set -# CONFIG_SENSORS_W83781D is not set -# CONFIG_SENSORS_W83791D is not set -# CONFIG_SENSORS_W83792D is not set -# CONFIG_SENSORS_W83793 is not set -# CONFIG_SENSORS_W83L785TS is not set -# CONFIG_SENSORS_W83L786NG is not set -CONFIG_SERIAL_8250_CONSOLE=y -# CONFIG_SERIAL_8250_CS is not set -CONFIG_SERIAL_8250_NR_UARTS=2 -# CONFIG_SERIAL_8250_PCI is not set -CONFIG_SERIAL_8250_RUNTIME_UARTS=2 -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_CORE_CONSOLE=y -CONFIG_SERIAL_CORE=y -# CONFIG_SERIAL_JSM is not set -# CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_SERIAL_UARTLITE is not set -# CONFIG_SERIO is not set -# CONFIG_SGI_IOC4 is not set -# CONFIG_SGI_PARTITION is not set -# CONFIG_SHAPER is not set -CONFIG_SHMEM=y -CONFIG_SIGNALFD=y -# CONFIG_SIS190 is not set -# CONFIG_SIS900 is not set -# CONFIG_SK98LIN is not set -# CONFIG_SKGE is not set -# CONFIG_SKY2_DEBUG is not set -# CONFIG_SKY2 is not set -CONFIG_SLABINFO=y -CONFIG_SLAB=y -# CONFIG_SLHC is not set -# CONFIG_SLIP is not set -# CONFIG_SLOB is not set -# CONFIG_SLUB_DEBUG is not set -# CONFIG_SLUB is not set -# CONFIG_SMB_FS is not set -# CONFIG_SMB_NLS_DEFAULT is not set -# CONFIG_SMC91X is not set -# CONFIG_SMSC_PHY is not set -# CONFIG_SND_AC97_POWER_SAVE is not set -# CONFIG_SND_AD1816A is not set -# CONFIG_SND_AD1848 is not set -# CONFIG_SND_AD1889 is not set -# CONFIG_SND_ADLIB is not set -# CONFIG_SND_ALI5451 is not set -# CONFIG_SND_ALS100 is not set -# CONFIG_SND_ALS300 is not set -# CONFIG_SND_ALS4000 is not set -# CONFIG_SND_ATIIXP is not set -# CONFIG_SND_ATIIXP_MODEM is not set -# CONFIG_SND_AU8810 is not set -# CONFIG_SND_AU8820 is not set -# CONFIG_SND_AU8830 is not set -# CONFIG_SND_AW2 is not set -# CONFIG_SND_AZT2320 is not set -# CONFIG_SND_AZT3328 is not set -# CONFIG_SND_BT87X is not set -# CONFIG_SND_CA0106 is not set -# CONFIG_SND_CMI8330 is not set -# CONFIG_SND_CMIPCI is not set -# CONFIG_SND_CS4231 is not set -# CONFIG_SND_CS4232 is not set -# CONFIG_SND_CS4236 is not set -# CONFIG_SND_CS4281 is not set -# CONFIG_SND_CS46XX is not set -# CONFIG_SND_CS5530 is not set -# CONFIG_SND_CS5535AUDIO is not set -# CONFIG_SND_DARLA20 is not set -# CONFIG_SND_DARLA24 is not set -# CONFIG_SND_DEBUG is not set -CONFIG_SND_DRIVERS=y -# CONFIG_SND_DT019X is not set -# CONFIG_SND_DUMMY is not set -# CONFIG_SND_DYNAMIC_MINORS is not set -# CONFIG_SND_ECHO3G is not set -# CONFIG_SND_EMU10K1 is not set -# CONFIG_SND_EMU10K1X is not set -# CONFIG_SND_ENS1370 is not set -# CONFIG_SND_ENS1371 is not set -# CONFIG_SND_ES1688 is not set -# CONFIG_SND_ES18XX is not set -# CONFIG_SND_ES1938 is not set -# CONFIG_SND_ES1968 is not set -# CONFIG_SND_ES968 is not set -# CONFIG_SND_FM801 is not set -# CONFIG_SND_GINA20 is not set -# CONFIG_SND_GINA24 is not set -# CONFIG_SND_GUSCLASSIC is not set -# CONFIG_SND_GUSEXTREME is not set -# CONFIG_SND_GUSMAX is not set -# CONFIG_SND_HDA_INTEL is not set -# CONFIG_SND_HDSP is not set -# CONFIG_SND_HDSPM is not set -# CONFIG_SND_HIFIER is not set -# CONFIG_SND_HWDEP is not set -# CONFIG_SND_ICE1712 is not set -# CONFIG_SND_ICE1724 is not set -# CONFIG_SND_INDIGODJ is not set -# CONFIG_SND_INDIGOIO is not set -# CONFIG_SND_INDIGO is not set -# CONFIG_SND_INTEL8X0 is not set -# CONFIG_SND_INTEL8X0M is not set -# CONFIG_SND_INTERWAVE is not set -# CONFIG_SND_INTERWAVE_STB is not set -# CONFIG_SND_ISA is not set -# CONFIG_SND is not set -# CONFIG_SND_KORG1212 is not set -# CONFIG_SND_LAYLA20 is not set -# CONFIG_SND_LAYLA24 is not set -# CONFIG_SND_MAESTRO3 is not set -# CONFIG_SND_MIA is not set -# CONFIG_SND_MIPS is not set -# CONFIG_SND_MIRO is not set -# CONFIG_SND_MIXART is not set -# CONFIG_SND_MIXER_OSS is not set -# CONFIG_SND_MONA is not set -# CONFIG_SND_MPU401 is not set -# CONFIG_SND_MTPAV is not set -# CONFIG_SND_NM256 is not set -# CONFIG_SND_OPL3SA2 is not set -# CONFIG_SND_OPTI92X_AD1848 is not set -# CONFIG_SND_OPTI92X_CS4231 is not set -# CONFIG_SND_OPTI93X is not set -CONFIG_SND_OSSEMUL=y -# CONFIG_SND_OXYGEN is not set -# CONFIG_SND_PCI is not set -# CONFIG_SND_PCMCIA is not set -# CONFIG_SND_PCM is not set -# CONFIG_SND_PCM_OSS is not set -CONFIG_SND_PCM_OSS_PLUGINS=y -# CONFIG_SND_PCSP is not set -# CONFIG_SND_PCXHR is not set -# CONFIG_SND_PDAUDIOCF is not set -# CONFIG_SND_RAWMIDI is not set -# CONFIG_SND_RIPTIDE is not set -# CONFIG_SND_RME32 is not set -# CONFIG_SND_RME9652 is not set -# CONFIG_SND_RME96 is not set -# CONFIG_SND_RTCTIMER is not set -# CONFIG_SND_SB16 is not set -# CONFIG_SND_SB8 is not set -# CONFIG_SND_SBAWE is not set -# CONFIG_SND_SEQUENCER is not set -# CONFIG_SND_SERIAL_U16550 is not set -# CONFIG_SND_SGALAXY is not set -# CONFIG_SND_SIS7019 is not set -# CONFIG_SND_SOC is not set -# CONFIG_SND_SONICVIBES is not set -# CONFIG_SND_SPI is not set -# CONFIG_SND_SSCAPE is not set -# CONFIG_SND_SUPPORT_OLD_API is not set -# CONFIG_SND_TIMER is not set -# CONFIG_SND_TRIDENT is not set -# CONFIG_SND_USB_AUDIO is not set -# CONFIG_SND_USB_CAIAQ is not set -# CONFIG_SND_USB_USX2Y is not set -CONFIG_SND_USB=y -# CONFIG_SND_VERBOSE_PRINTK is not set -CONFIG_SND_VERBOSE_PROCFS=y -# CONFIG_SND_VIA82XX is not set -# CONFIG_SND_VIA82XX_MODEM is not set -# CONFIG_SND_VIRTUOSO is not set -# CONFIG_SND_VX222 is not set -# CONFIG_SND_VXPOCKET is not set -# CONFIG_SND_WAVEFRONT is not set -# CONFIG_SND_YMFPCI is not set -# CONFIG_SNI_RM is not set -# CONFIG_SOC_CAMERA is not set -# CONFIG_SOFT_WATCHDOG is not set -# CONFIG_SOLARIS_X86_PARTITION is not set -# CONFIG_SONYPI is not set -# CONFIG_SOUND is not set -# CONFIG_SOUND_PRIME is not set -# CONFIG_SPARSEMEM_MANUAL is not set -# CONFIG_SPARSEMEM_STATIC is not set -# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set -# CONFIG_SPI_AT25 is not set -# CONFIG_SPI_DEBUG is not set -# CONFIG_SPI is not set -# CONFIG_SPI_MASTER is not set -# CONFIG_SPI_TLE62X0 is not set -CONFIG_SPLIT_PTLOCK_CPUS=4 -# CONFIG_SQUASHFS_EMBEDDED is not set -CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 -# CONFIG_SQUASHFS_VMALLOC is not set -CONFIG_SQUASHFS=y -# CONFIG_SSB_BLOCKIO is not set -# CONFIG_SSB_DEBUG is not set -# CONFIG_SSB_DRIVER_MIPS is not set -# CONFIG_SSB is not set -# CONFIG_SSB_PCMCIAHOST is not set -CONFIG_SSB_POSSIBLE=y -# CONFIG_SSB_SILENT is not set -# CONFIG_SSFDC is not set -CONFIG_STACKTRACE_SUPPORT=y -CONFIG_STANDALONE=y -CONFIG_STP=y -# CONFIG_STRIP is not set -# CONFIG_SUNDANCE is not set -# CONFIG_SUNGEM is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_SUNRPC_BIND34 is not set -# CONFIG_SUNRPC_GSS is not set -# CONFIG_SUNRPC is not set -CONFIG_SUSPEND_UP_POSSIBLE=y -CONFIG_SWAP=y -# CONFIG_SWCONFIG is not set -# CONFIG_SYNCLINK_CS is not set -CONFIG_SYN_COOKIES=y -CONFIG_SYSCTL_SYSCALL_CHECK=y -CONFIG_SYSCTL_SYSCALL=y -CONFIG_SYSCTL=y -# CONFIG_SYSFS_DEPRECATED is not set -# CONFIG_SYSFS_DEPRECATED_V2 is not set -CONFIG_SYSFS=y -# CONFIG_SYS_HYPERVISOR is not set -# CONFIG_SYSV68_PARTITION is not set -# CONFIG_SYSV_FS is not set -CONFIG_SYSVIPC_SYSCTL=y -CONFIG_SYSVIPC=y -# CONFIG_TASKSTATS is not set -# CONFIG_TCG_TPM is not set -# CONFIG_TCIC is not set -CONFIG_TCP_CONG_ADVANCED=y -# CONFIG_TCP_CONG_BIC is not set -# CONFIG_TCP_CONG_CUBIC is not set -# CONFIG_TCP_CONG_HSTCP is not set -# CONFIG_TCP_CONG_HTCP is not set -# CONFIG_TCP_CONG_HYBLA is not set -# CONFIG_TCP_CONG_ILLINOIS is not set -# CONFIG_TCP_CONG_LP is not set -# CONFIG_TCP_CONG_SCALABLE is not set -# CONFIG_TCP_CONG_VEGAS is not set -# CONFIG_TCP_CONG_VENO is not set -CONFIG_TCP_CONG_WESTWOOD=y -# CONFIG_TCP_CONG_YEAH is not set -# CONFIG_TCP_MD5SIG is not set -# CONFIG_TEXTSEARCH_BM is not set -# CONFIG_TEXTSEARCH_FSM is not set -# CONFIG_TEXTSEARCH_KMP is not set -CONFIG_TEXTSEARCH=y -# CONFIG_THERMAL_HWMON is not set -# CONFIG_THERMAL is not set -# CONFIG_TIFM_CORE is not set -# CONFIG_TIGON3 is not set -CONFIG_TIMERFD=y -# CONFIG_TINY_SHMEM is not set -# CONFIG_TIPC is not set -# CONFIG_TLAN is not set -# CONFIG_TMD_HERMES is not set -# CONFIG_TMPFS_POSIX_ACL is not set -CONFIG_TMPFS=y -# CONFIG_TPS65010 is not set -CONFIG_TRACE_IRQFLAGS_SUPPORT=y -# CONFIG_TR is not set -# CONFIG_TUNER_3036 is not set -# CONFIG_TUNER_TEA5761 is not set -# CONFIG_TUN is not set -# CONFIG_UDF_FS is not set -CONFIG_UDF_NLS=y -CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" -# CONFIG_UFS_FS is not set -# CONFIG_UIO is not set -# CONFIG_ULTRIX_PARTITION is not set -CONFIG_UNIX98_PTYS=y -# CONFIG_UNIXWARE_DISKLABEL is not set -CONFIG_UNIX=y -# CONFIG_UNUSED_SYMBOLS is not set -# CONFIG_USB_ACECAD is not set -# CONFIG_USB_ACM is not set -# CONFIG_USB_ADUTUX is not set -# CONFIG_USB_AIPTEK is not set -CONFIG_USB_ALI_M5632=y -CONFIG_USB_AN2720=y -# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set -# CONFIG_USB_APPLEDISPLAY is not set -# CONFIG_USB_APPLETOUCH is not set -CONFIG_USB_ARCH_HAS_EHCI=y -CONFIG_USB_ARCH_HAS_HCD=y -CONFIG_USB_ARCH_HAS_OHCI=y -CONFIG_USB_ARMLINUX=y -# CONFIG_USB_ATI_REMOTE2 is not set -# CONFIG_USB_ATI_REMOTE is not set -# CONFIG_USB_ATM is not set -# CONFIG_USB_AUERSWALD is not set -# CONFIG_USB_BANDWIDTH is not set -CONFIG_USB_BELKIN=y -# CONFIG_USB_BERRY_CHARGE is not set -# CONFIG_USB_C67X00_HCD is not set -# CONFIG_USB_CATC is not set -# CONFIG_USB_CXACRU is not set -# CONFIG_USB_CYPRESS_CY7C63 is not set -# CONFIG_USB_CYTHERM is not set -# CONFIG_USB_DABUSB is not set -# CONFIG_USB_DEBUG is not set -# CONFIG_USB_DEVICE_CLASS is not set -CONFIG_USB_DEVICEFS=y -# CONFIG_USB_DSBR is not set -# CONFIG_USB_DYNAMIC_MINORS is not set -CONFIG_USB_EHCI_ROOT_HUB_TT=y -# CONFIG_USB_EHCI_SPLIT_ISO is not set -# CONFIG_USB_EHCI_TT_NEWSCHED is not set -# CONFIG_USB_EMI26 is not set -# CONFIG_USB_EMI62 is not set -# CONFIG_USB_EPSON2888 is not set -# CONFIG_USB_ET61X251 is not set -CONFIG_USB_EZUSB=y -# CONFIG_USB_FTDI_ELAN is not set -# CONFIG_USB_GADGET is not set -# CONFIG_USB_GSPCA is not set -# CONFIG_USB_HIDDEV is not set -# CONFIG_USB_HIDINPUT_POWERBOOK is not set -CONFIG_USB_HIDINPUT=y -# CONFIG_USB_HID is not set -# CONFIG_USB_HSO is not set -# CONFIG_USB_IBMCAM is not set -# CONFIG_USB_IDMOUSE is not set -# CONFIG_USB_IOWARRIOR is not set -# CONFIG_USB_ISIGHTFW is not set -# CONFIG_USB is not set -# CONFIG_USB_ISP116X_HCD is not set -# CONFIG_USB_ISP1760_HCD is not set -# CONFIG_USB_KAWETH is not set -# CONFIG_USB_KBD is not set -# CONFIG_USB_KBTAB is not set -# CONFIG_USB_KC2190 is not set -# CONFIG_USB_KEYSPAN_REMOTE is not set -# CONFIG_USB_KONICAWC is not set -# CONFIG_USB_LCD is not set -# CONFIG_USB_LD is not set -# CONFIG_USB_LED is not set -# CONFIG_USB_LEGOTOWER is not set -# CONFIG_USB_LIBUSUAL is not set -# CONFIG_USB_MDC800 is not set -# CONFIG_USB_MICROTEK is not set -# CONFIG_USB_MON is not set -# CONFIG_USB_MOUSE is not set -# CONFIG_USB_NET_AX8817X is not set -# CONFIG_USB_NET_CDCETHER is not set -# CONFIG_USB_NET_CDC_SUBSET is not set -# CONFIG_USB_NET_DM9601 is not set -# CONFIG_USB_NET_GL620A is not set -# CONFIG_USB_NET_MCS7830 is not set -# CONFIG_USB_NET_NET1080 is not set -# CONFIG_USB_NET_PLUSB is not set -# CONFIG_USB_NET_RNDIS_HOST is not set -# CONFIG_USB_NET_RNDIS_WLAN is not set -# CONFIG_USB_NET_ZAURUS is not set -# CONFIG_USB_OHCI_BIG_ENDIAN is not set -# CONFIG_USB_OHCI_HCD is not set -# CONFIG_USB_OHCI_HCD_SSB is not set -CONFIG_USB_OHCI_LITTLE_ENDIAN=y -# CONFIG_USB_OTG_BLACKLIST_HUB is not set -# CONFIG_USB_OTG is not set -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OV511 is not set -# CONFIG_USBPCWATCHDOG is not set -# CONFIG_USB_PEGASUS is not set -# CONFIG_USB_PHIDGET is not set -# CONFIG_USB_POWERMATE is not set -# CONFIG_USB_PRINTER is not set -# CONFIG_USB_QUICKCAM_MESSENGER is not set -# CONFIG_USB_R8A66597_HCD is not set -# CONFIG_USB_RIO500 is not set -# CONFIG_USB_RTL8150 is not set -# CONFIG_USB_S2255 is not set -# CONFIG_USB_SE401 is not set -# CONFIG_USB_SERIAL_AIRCABLE is not set -# CONFIG_USB_SERIAL_AIRPRIME is not set -# CONFIG_USB_SERIAL_ARK3116 is not set -# CONFIG_USB_SERIAL_BELKIN is not set -# CONFIG_USB_SERIAL_CH341 is not set -# CONFIG_USB_SERIAL_CP2101 is not set -# CONFIG_USB_SERIAL_CYBERJACK is not set -# CONFIG_USB_SERIAL_CYPRESS_M8 is not set -# CONFIG_USB_SERIAL_DEBUG is not set -# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set -# CONFIG_USB_SERIAL_EDGEPORT is not set -# CONFIG_USB_SERIAL_EDGEPORT_TI is not set -# CONFIG_USB_SERIAL_EMPEG is not set -# CONFIG_USB_SERIAL_FTDI_SIO is not set -# CONFIG_USB_SERIAL_FUNSOFT is not set -# CONFIG_USB_SERIAL_GARMIN is not set -CONFIG_USB_SERIAL_GENERIC=y -# CONFIG_USB_SERIAL_HP4X is not set -# CONFIG_USB_SERIAL_IPAQ is not set -# CONFIG_USB_SERIAL_IPW is not set -# CONFIG_USB_SERIAL_IR is not set -# CONFIG_USB_SERIAL is not set -# CONFIG_USB_SERIAL_IUU is not set -# CONFIG_USB_SERIAL_KEYSPAN is not set -CONFIG_USB_SERIAL_KEYSPAN_MPR=y -# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set -CONFIG_USB_SERIAL_KEYSPAN_USA18X=y -CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y -CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y -CONFIG_USB_SERIAL_KEYSPAN_USA19W=y -CONFIG_USB_SERIAL_KEYSPAN_USA19=y -CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y -CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y -CONFIG_USB_SERIAL_KEYSPAN_USA28X=y -CONFIG_USB_SERIAL_KEYSPAN_USA28=y -CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y -CONFIG_USB_SERIAL_KEYSPAN_USA49W=y -# CONFIG_USB_SERIAL_KLSI is not set -# CONFIG_USB_SERIAL_KOBIL_SCT is not set -# CONFIG_USB_SERIAL_MCT_U232 is not set -# CONFIG_USB_SERIAL_MOS7720 is not set -# CONFIG_USB_SERIAL_MOS7840 is not set -# CONFIG_USB_SERIAL_MOTOROLA is not set -# CONFIG_USB_SERIAL_NAVMAN is not set -# CONFIG_USB_SERIAL_OMNINET is not set -# CONFIG_USB_SERIAL_OPTION is not set -# CONFIG_USB_SERIAL_OTI6858 is not set -# CONFIG_USB_SERIAL_PL2303 is not set -# CONFIG_USB_SERIAL_SAFE is not set -CONFIG_USB_SERIAL_SAFE_PADDED=y -# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set -# CONFIG_USB_SERIAL_SPCP8X5 is not set -# CONFIG_USB_SERIAL_TI is not set -# CONFIG_USB_SERIAL_VISOR is not set -# CONFIG_USB_SERIAL_WHITEHEAT is not set -# CONFIG_USB_SERIAL_XIRCOM is not set -# CONFIG_USB_SISUSBVGA is not set -# CONFIG_USB_SL811_HCD is not set -# CONFIG_USB_SN9C102 is not set -# CONFIG_USB_SPEEDTOUCH is not set -# CONFIG_USB_STKWEBCAM is not set -CONFIG_USB_STORAGE_ALAUDA=y -# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set -CONFIG_USB_STORAGE_DATAFAB=y -# CONFIG_USB_STORAGE_DEBUG is not set -CONFIG_USB_STORAGE_DPCM=y -CONFIG_USB_STORAGE_FREECOM=y -# CONFIG_USB_STORAGE_ISD200 is not set -# CONFIG_USB_STORAGE is not set -CONFIG_USB_STORAGE_JUMPSHOT=y -CONFIG_USB_STORAGE_KARMA=y -# CONFIG_USB_STORAGE_ONETOUCH is not set -CONFIG_USB_STORAGE_SDDR09=y -CONFIG_USB_STORAGE_SDDR55=y -# CONFIG_USB_STORAGE_SIERRA is not set -CONFIG_USB_STORAGE_USBAT=y -# CONFIG_USB_STV680 is not set -# CONFIG_USB_SUPPORT is not set -# CONFIG_USB_SUSPEND is not set -# CONFIG_USB_TEST is not set -# CONFIG_USB_TOUCHSCREEN is not set -# CONFIG_USB_TRANCEVIBRATOR is not set -# CONFIG_USB_UEAGLEATM is not set -# CONFIG_USB_USBNET is not set -# CONFIG_USB_USBNET_MII is not set -# CONFIG_USB_VICAM is not set -# CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV is not set -# CONFIG_USB_VIDEO_CLASS is not set -# CONFIG_USB_W9968CF is not set -# CONFIG_USB_WACOM is not set -# CONFIG_USB_WDM is not set -# CONFIG_USB_XPAD is not set -# CONFIG_USB_XUSBATM is not set -# CONFIG_USB_YEALINK is not set -# CONFIG_USB_ZC0301 is not set -# CONFIG_USB_ZD1201 is not set -# CONFIG_USB_ZR364XX is not set -# CONFIG_USE_GENERIC_SMP_HELPERS is not set -# CONFIG_UTS_NS is not set -# CONFIG_VETH is not set -# CONFIG_VFAT_FS is not set -# CONFIG_VIA_VELOCITY is not set -# CONFIG_VIDEO_ADV7170 is not set -# CONFIG_VIDEO_ADV7175 is not set -# CONFIG_VIDEO_ADV_DEBUG is not set -# CONFIG_VIDEO_ALLOW_V4L1 is not set -# CONFIG_VIDEO_BT819 is not set -# CONFIG_VIDEO_BT848 is not set -# CONFIG_VIDEO_BT856 is not set -# CONFIG_VIDEO_BT866 is not set -# CONFIG_VIDEO_CAFE_CCIC is not set -# CONFIG_VIDEO_CAPTURE_DRIVERS is not set -# CONFIG_VIDEO_CPIA is not set -# CONFIG_VIDEO_CS5345 is not set -# CONFIG_VIDEO_CS53L32A is not set -# CONFIG_VIDEO_CX2341X is not set -# CONFIG_VIDEO_CX25840 is not set -# CONFIG_VIDEO_CX88 is not set -# CONFIG_VIDEO_DEV is not set -# CONFIG_VIDEO_DPC is not set -# CONFIG_VIDEO_EM28XX is not set -# CONFIG_VIDEO_HELPER_CHIPS_AUTO is not set -# CONFIG_VIDEO_HEXIUM_GEMINI is not set -# CONFIG_VIDEO_HEXIUM_ORION is not set -# CONFIG_VIDEO_IVTV is not set -# CONFIG_VIDEO_KS0127 is not set -# CONFIG_VIDEO_M52790 is not set -# CONFIG_VIDEO_MEDIA is not set -# CONFIG_VIDEO_MSP3400 is not set -# CONFIG_VIDEO_MXB is not set -# CONFIG_VIDEO_OUTPUT_CONTROL is not set -# CONFIG_VIDEO_OV7670 is not set -# CONFIG_VIDEO_OVCAMCHIP is not set -# CONFIG_VIDEO_PMS is not set -# CONFIG_VIDEO_PVRUSB2 is not set -# CONFIG_VIDEO_SAA5246A is not set -# CONFIG_VIDEO_SAA5249 is not set -# CONFIG_VIDEO_SAA7110 is not set -# CONFIG_VIDEO_SAA7111 is not set -# CONFIG_VIDEO_SAA7114 is not set -# CONFIG_VIDEO_SAA711X is not set -# CONFIG_VIDEO_SAA7127 is not set -# CONFIG_VIDEO_SAA7134 is not set -# CONFIG_VIDEO_SAA717X is not set -# CONFIG_VIDEO_SAA7185 is not set -# CONFIG_VIDEO_SAA7191 is not set -# CONFIG_VIDEO_SH_MOBILE_CEU is not set -# CONFIG_VIDEO_STRADIS is not set -# CONFIG_VIDEO_TCM825X is not set -# CONFIG_VIDEO_TDA7432 is not set -# CONFIG_VIDEO_TDA9840 is not set -# CONFIG_VIDEO_TDA9875 is not set -# CONFIG_VIDEO_TEA6415C is not set -# CONFIG_VIDEO_TEA6420 is not set -# CONFIG_VIDEO_TLV320AIC23B is not set -# CONFIG_VIDEO_TVAUDIO is not set -# CONFIG_VIDEO_TVP5150 is not set -# CONFIG_VIDEO_UPD64031A is not set -# CONFIG_VIDEO_UPD64083 is not set -# CONFIG_VIDEO_USBVISION is not set -CONFIG_VIDEO_V4L1_COMPAT=y -# CONFIG_VIDEO_V4L1 is not set -# CONFIG_VIDEO_V4L2_COMMON is not set -# CONFIG_VIDEO_V4L2 is not set -# CONFIG_VIDEO_VIVI is not set -# CONFIG_VIDEO_VP27SMPX is not set -# CONFIG_VIDEO_VPX3220 is not set -# CONFIG_VIDEO_WM8739 is not set -# CONFIG_VIDEO_WM8775 is not set -# CONFIG_VIDEO_ZORAN is not set -# CONFIG_VIRQ_DEBUG is not set -CONFIG_VIRT_TO_BUS=y -# CONFIG_VIRTUALIZATION is not set -# CONFIG_VITESSE_PHY is not set -# CONFIG_VLAN_8021Q_GVRP is not set -CONFIG_VLAN_8021Q=y -# CONFIG_VM_EVENT_COUNTERS is not set -# CONFIG_VT is not set -# CONFIG_VXFS_FS is not set -# CONFIG_W1 is not set -# CONFIG_W1_MASTER_DS1WM is not set -# CONFIG_W1_MASTER_DS2482 is not set -# CONFIG_W1_MASTER_DS2490 is not set -# CONFIG_W1_MASTER_GPIO is not set -# CONFIG_W1_MASTER_MATROX is not set -# CONFIG_W1_SLAVE_DS2433 is not set -# CONFIG_W1_SLAVE_DS2760 is not set -# CONFIG_W1_SLAVE_SMEM is not set -# CONFIG_W1_SLAVE_THERM is not set -# CONFIG_W83627HF_WDT is not set -# CONFIG_W83697HF_WDT is not set -# CONFIG_W83877F_WDT is not set -# CONFIG_W83977F_WDT is not set -# CONFIG_WAN is not set -# CONFIG_WAN_ROUTER is not set -# CONFIG_WANXL is not set -# CONFIG_WATCHDOG_NOWAYOUT is not set -CONFIG_WATCHDOG=y -# CONFIG_WDTPCI is not set -CONFIG_WIRELESS_EXT_SYSFS=y -CONFIG_WIRELESS_EXT=y -CONFIG_WLAN_80211=y -# CONFIG_WLAN_PRE80211 is not set -# CONFIG_WR_PPMC is not set -# CONFIG_X25 is not set -# CONFIG_XFRM_IPCOMP is not set -# CONFIG_XFRM_MIGRATE is not set -# CONFIG_XFRM_STATISTICS is not set -# CONFIG_XFRM_SUB_POLICY is not set -# CONFIG_XFRM_USER is not set -CONFIG_XFRM=y -# CONFIG_XFS_DEBUG is not set -# CONFIG_XFS_FS is not set -# CONFIG_XFS_POSIX_ACL is not set -# CONFIG_XFS_QUOTA is not set -# CONFIG_XFS_RT is not set -# CONFIG_XFS_SECURITY is not set -# CONFIG_XIP_KERNEL is not set -# CONFIG_YAFFS_FS is not set -# CONFIG_YAM is not set -# CONFIG_YELLOWFIN is not set -# CONFIG_YENTA is not set -# CONFIG_YENTA_O2 is not set -# CONFIG_YENTA_RICOH is not set -# CONFIG_YENTA_TI is not set -# CONFIG_YENTA_TOSHIBA is not set -# CONFIG_ZD1211RW_DEBUG is not set -# CONFIG_ZD1211RW is not set -# CONFIG_ZISOFS_FS is not set -CONFIG_ZISOFS=y -CONFIG_ZLIB_DEFLATE=y -CONFIG_ZLIB_INFLATE=y -CONFIG_ZONE_DMA_FLAG=1 -CONFIG_ZONE_DMA=y diff --git a/target/linux/generic-2.6/files-2.6.27/drivers/char/gpio_dev.c b/target/linux/generic-2.6/files-2.6.27/drivers/char/gpio_dev.c deleted file mode 100644 index 8392fcf2d..000000000 --- a/target/linux/generic-2.6/files-2.6.27/drivers/char/gpio_dev.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * character device wrapper for generic gpio layer - * - * 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 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA - * - * Feedback, Bugs... blogic@openwrt.org - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DRVNAME "gpiodev" -#define DEVNAME "gpio" - -static int dev_major; -static unsigned int gpio_access_mask; -static struct class *gpiodev_class; - -/* Counter is 1, if the device is not opened and zero (or less) if opened. */ -static atomic_t gpio_open_cnt = ATOMIC_INIT(1); - -static int -gpio_ioctl(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg) -{ - int retval = 0; - - if (((1 << arg) & gpio_access_mask) != (1 << arg)) - { - retval = -EINVAL; - goto out; - } - - switch (cmd) - { - case GPIO_GET: - retval = gpio_get_value(arg); - break; - - case GPIO_SET: - gpio_set_value(arg, 1); - break; - - case GPIO_CLEAR: - gpio_set_value(arg, 0); - break; - - case GPIO_DIR_IN: - gpio_direction_input(arg); - break; - - case GPIO_DIR_OUT: - gpio_direction_output(arg, 0); - break; - - default: - retval = -EINVAL; - break; - } - -out: - return retval; -} - -static int -gpio_open(struct inode *inode, struct file *file) -{ - int result = 0; - unsigned int dev_minor = MINOR(inode->i_rdev); - - if (dev_minor != 0) - { - printk(KERN_ERR DRVNAME ": trying to access unknown minor device -> %d\n", dev_minor); - result = -ENODEV; - goto out; - } - - /* FIXME: We should really allow multiple applications to open the device - * at the same time, as long as the apps access different IO pins. - * The generic gpio-registration functions can be used for that. - * Two new IOCTLs have to be introduced for that. Need to check userspace - * compatibility first. --mb */ - if (!atomic_dec_and_test(&gpio_open_cnt)) { - atomic_inc(&gpio_open_cnt); - printk(KERN_ERR DRVNAME ": Device with minor ID %d already in use\n", dev_minor); - result = -EBUSY; - goto out; - } - -out: - return result; -} - -static int -gpio_close(struct inode * inode, struct file * file) -{ - smp_mb__before_atomic_inc(); - atomic_inc(&gpio_open_cnt); - - return 0; -} - -struct file_operations gpio_fops = { - ioctl: gpio_ioctl, - open: gpio_open, - release: gpio_close -}; - -static int -gpio_probe(struct platform_device *dev) -{ - int result = 0; - - dev_major = register_chrdev(0, DEVNAME, &gpio_fops); - if (!dev_major) - { - printk(KERN_ERR DRVNAME ": Error whilst opening %s \n", DEVNAME); - result = -ENODEV; - goto out; - } - - gpiodev_class = class_create(THIS_MODULE, DRVNAME); - device_create(gpiodev_class, NULL, MKDEV(dev_major, 0), dev, DEVNAME); - - printk(KERN_INFO DRVNAME ": gpio device registered with major %d\n", dev_major); - - if (dev->num_resources != 1) - { - printk(KERN_ERR DRVNAME ": device may only have 1 resource\n"); - result = -ENODEV; - goto out; - } - - gpio_access_mask = dev->resource[0].start; - - printk(KERN_INFO DRVNAME ": gpio platform device registered with access mask %08X\n", gpio_access_mask); -out: - return result; -} - -static int -gpio_remove(struct platform_device *dev) -{ - unregister_chrdev(dev_major, DEVNAME); - return 0; -} - -static struct -platform_driver gpio_driver = { - .probe = gpio_probe, - .remove = gpio_remove, - .driver = { - .name = "GPIODEV", - .owner = THIS_MODULE, - }, -}; - -static int __init -gpio_mod_init(void) -{ - int ret = platform_driver_register(&gpio_driver); - if (ret) - printk(KERN_INFO DRVNAME ": Error registering platfom driver!"); - - return ret; -} - -static void __exit -gpio_mod_exit(void) -{ - platform_driver_unregister(&gpio_driver); -} - -module_init (gpio_mod_init); -module_exit (gpio_mod_exit); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("John Crispin / OpenWrt"); -MODULE_DESCRIPTION("Character device for for generic gpio api"); diff --git a/target/linux/generic-2.6/files-2.6.27/drivers/input/misc/gpio_buttons.c b/target/linux/generic-2.6/files-2.6.27/drivers/input/misc/gpio_buttons.c deleted file mode 100644 index 83a817834..000000000 --- a/target/linux/generic-2.6/files-2.6.27/drivers/input/misc/gpio_buttons.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Driver for buttons on GPIO lines not capable of generating interrupts - * - * Copyright (C) 2007,2008 Gabor Juhos - * - * This file was based on: /drivers/input/misc/cobalt_btns.c - * Copyright (C) 2007 Yoichi Yuasa - * - * also was based on: /drivers/input/keyboard/gpio_keys.c - * Copyright 2005 Phil Blundell - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - */ - -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include - -#define DRV_NAME "gpio-buttons" -#define DRV_VERSION "0.1.1" -#define PFX DRV_NAME ": " - -struct gpio_buttons_dev { - struct input_polled_dev *poll_dev; - struct gpio_buttons_platform_data *pdata; -}; - -static void gpio_buttons_poll(struct input_polled_dev *dev) -{ - struct gpio_buttons_dev *bdev = dev->private; - struct gpio_buttons_platform_data *pdata = bdev->pdata; - struct input_dev *input = dev->input; - int i; - - for (i = 0; i < bdev->pdata->nbuttons; i++) { - struct gpio_button *button = &pdata->buttons[i]; - unsigned int type = button->type ?: EV_KEY; - int state; - - state = gpio_get_value(button->gpio) ? 1 : 0; - state ^= button->active_low; - - if (state) { - button->count++; - } else { - if (button->count >= button->threshold) { - input_event(input, type, button->code, 1); - input_sync(input); - } - button->count = 0; - } - - if (button->count == button->threshold) { - input_event(input, type, button->code, 0); - input_sync(input); - } - } -} - -static int __devinit gpio_buttons_probe(struct platform_device *pdev) -{ - struct gpio_buttons_platform_data *pdata = pdev->dev.platform_data; - struct gpio_buttons_dev *bdev; - struct input_polled_dev *poll_dev; - struct input_dev *input; - int error, i; - - - if (!pdata) - return -ENXIO; - - bdev = kzalloc(sizeof(*bdev), GFP_KERNEL); - if (!bdev) { - printk(KERN_ERR DRV_NAME "no memory for device\n"); - return -ENOMEM; - } - - poll_dev = input_allocate_polled_device(); - if (!poll_dev) { - printk(KERN_ERR DRV_NAME "no memory for polled device\n"); - error = -ENOMEM; - goto err_free_bdev; - } - - poll_dev->private = bdev; - poll_dev->poll = gpio_buttons_poll; - poll_dev->poll_interval = pdata->poll_interval; - - input = poll_dev->input; - - input->evbit[0] = BIT(EV_KEY); - input->name = pdev->name; - input->phys = "gpio-buttons/input0"; - input->dev.parent = &pdev->dev; - - input->id.bustype = BUS_HOST; - input->id.vendor = 0x0001; - input->id.product = 0x0001; - input->id.version = 0x0100; - - for (i = 0; i < pdata->nbuttons; i++) { - struct gpio_button *button = &pdata->buttons[i]; - unsigned int gpio = button->gpio; - unsigned int type = button->type ?: EV_KEY; - - error = gpio_request(gpio, button->desc ? - button->desc : DRV_NAME); - if (error) { - printk(KERN_ERR PFX "unable to claim gpio %u, " - "error %d\n", gpio, error); - goto err_free_gpio; - } - - error = gpio_direction_input(gpio); - if (error) { - printk(KERN_ERR PFX "unable to set direction on " - "gpio %u, error %d\n", gpio, error); - goto err_free_gpio; - } - - input_set_capability(input, type, button->code); - button->count = 0; - } - - bdev->poll_dev = poll_dev; - bdev->pdata = pdata; - platform_set_drvdata(pdev, bdev); - - error = input_register_polled_device(poll_dev); - if (error) { - printk(KERN_ERR PFX "unable to register polled device, " - "error %d\n", error); - goto err_free_gpio; - } - - return 0; - -err_free_gpio: - for (i = i - 1; i >= 0; i--) - gpio_free(pdata->buttons[i].gpio); - - input_free_polled_device(poll_dev); - -err_free_bdev: - kfree(bdev); - - platform_set_drvdata(pdev, NULL); - return error; -} - -static int __devexit gpio_buttons_remove(struct platform_device *pdev) -{ - struct gpio_buttons_dev *bdev = platform_get_drvdata(pdev); - struct gpio_buttons_platform_data *pdata = bdev->pdata; - int i; - - input_unregister_polled_device(bdev->poll_dev); - - for (i = 0; i < pdata->nbuttons; i++) - gpio_free(pdata->buttons[i].gpio); - - input_free_polled_device(bdev->poll_dev); - - kfree(bdev); - platform_set_drvdata(pdev, NULL); - - return 0; -} - -static struct platform_driver gpio_buttons_driver = { - .probe = gpio_buttons_probe, - .remove = __devexit_p(gpio_buttons_remove), - .driver = { - .name = DRV_NAME, - .owner = THIS_MODULE, - }, -}; - -static int __init gpio_buttons_init(void) -{ - printk(KERN_INFO DRV_NAME " driver version " DRV_VERSION "\n"); - return platform_driver_register(&gpio_buttons_driver); -} - -static void __exit gpio_buttons_exit(void) -{ - platform_driver_unregister(&gpio_buttons_driver); -} - -module_init(gpio_buttons_init); -module_exit(gpio_buttons_exit); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Gabor Juhos "); -MODULE_VERSION(DRV_VERSION); -MODULE_DESCRIPTION("Polled buttons driver for CPU GPIOs"); - diff --git a/target/linux/generic-2.6/files-2.6.27/drivers/leds/leds-alix.c b/target/linux/generic-2.6/files-2.6.27/drivers/leds/leds-alix.c deleted file mode 100644 index 103ca7dfa..000000000 --- a/target/linux/generic-2.6/files-2.6.27/drivers/leds/leds-alix.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * LEDs driver for PCEngines ALIX 2/3 series - * - * Copyright (C) 2007 Petr Liebman - * - * Based on leds-wrap.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include - -#define DRVNAME "alix-led" - -#define ALIX_LED1_PORT (0x6100) -#define ALIX_LED1_ON (1<<22) -#define ALIX_LED1_OFF (1<<6) - -#define ALIX_LED2_PORT (0x6180) -#define ALIX_LED2_ON (1<<25) -#define ALIX_LED2_OFF (1<<9) - -#define ALIX_LED3_PORT (0x6180) -#define ALIX_LED3_ON (1<<27) -#define ALIX_LED3_OFF (1<<11) - - -static struct platform_device *pdev; - -static void alix_led_set_1(struct led_classdev *led_cdev, - enum led_brightness value) -{ - if (value) - outl(ALIX_LED1_ON, ALIX_LED1_PORT); - else - outl(ALIX_LED1_OFF, ALIX_LED1_PORT); -} - -static void alix_led_set_2(struct led_classdev *led_cdev, - enum led_brightness value) -{ - if (value) - outl(ALIX_LED2_ON, ALIX_LED2_PORT); - else - outl(ALIX_LED2_OFF, ALIX_LED2_PORT); -} - -static void alix_led_set_3(struct led_classdev *led_cdev, - enum led_brightness value) -{ - if (value) - outl(ALIX_LED3_ON, ALIX_LED3_PORT); - else - outl(ALIX_LED3_OFF, ALIX_LED3_PORT); -} - -static struct led_classdev alix_led_1 = { - .name = "alix:1", - .brightness_set = alix_led_set_1, -}; - -static struct led_classdev alix_led_2 = { - .name = "alix:2", - .brightness_set = alix_led_set_2, -}; - -static struct led_classdev alix_led_3 = { - .name = "alix:3", - .brightness_set = alix_led_set_3, -}; - - -#ifdef CONFIG_PM -static int alix_led_suspend(struct platform_device *dev, - pm_message_t state) -{ - led_classdev_suspend(&alix_led_1); - led_classdev_suspend(&alix_led_2); - led_classdev_suspend(&alix_led_3); - return 0; -} - -static int alix_led_resume(struct platform_device *dev) -{ - led_classdev_resume(&alix_led_1); - led_classdev_resume(&alix_led_2); - led_classdev_resume(&alix_led_3); - return 0; -} -#else -#define alix_led_suspend NULL -#define alix_led_resume NULL -#endif - -static int alix_led_probe(struct platform_device *pdev) -{ - int ret; - - ret = led_classdev_register(&pdev->dev, &alix_led_1); - if (ret >= 0) - { - ret = led_classdev_register(&pdev->dev, &alix_led_2); - if (ret >= 0) - { - ret = led_classdev_register(&pdev->dev, &alix_led_3); - if (ret < 0) - led_classdev_unregister(&alix_led_2); - } - if (ret < 0) - led_classdev_unregister(&alix_led_1); - } - return ret; -} - -static int alix_led_remove(struct platform_device *pdev) -{ - led_classdev_unregister(&alix_led_1); - led_classdev_unregister(&alix_led_2); - led_classdev_unregister(&alix_led_3); - return 0; -} - -static struct platform_driver alix_led_driver = { - .probe = alix_led_probe, - .remove = alix_led_remove, - .suspend = alix_led_suspend, - .resume = alix_led_resume, - .driver = { - .name = DRVNAME, - .owner = THIS_MODULE, - }, -}; - -static int __init alix_led_init(void) -{ - int ret; - - ret = platform_driver_register(&alix_led_driver); - if (ret < 0) - goto out; - - pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); - if (IS_ERR(pdev)) { - ret = PTR_ERR(pdev); - platform_driver_unregister(&alix_led_driver); - goto out; - } - -out: - return ret; -} - -static void __exit alix_led_exit(void) -{ - platform_device_unregister(pdev); - platform_driver_unregister(&alix_led_driver); -} - -module_init(alix_led_init); -module_exit(alix_led_exit); - -MODULE_AUTHOR("Petr Liebman"); -MODULE_DESCRIPTION("PCEngines ALIX LED driver"); -MODULE_LICENSE("GPL"); - diff --git a/target/linux/generic-2.6/files-2.6.27/drivers/leds/ledtrig-morse.c b/target/linux/generic-2.6/files-2.6.27/drivers/leds/ledtrig-morse.c deleted file mode 100644 index cb47480a3..000000000 --- a/target/linux/generic-2.6/files-2.6.27/drivers/leds/ledtrig-morse.c +++ /dev/null @@ -1,365 +0,0 @@ -/* - * LED Morse Trigger - * - * Copyright (C) 2007 Gabor Juhos - * - * This file was based on: drivers/led/ledtrig-timer.c - * Copyright 2005-2006 Openedhand Ltd. - * Author: Richard Purdie - * - * also based on the patch '[PATCH] 2.5.59 morse code panics' posted - * in the LKML by Tomas Szepe at Thu, 30 Jan 2003 - * Copyright (C) 2002 Andrew Rodland - * Copyright (C) 2003 Tomas Szepe - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "leds.h" - -#define MORSE_DELAY_BASE (HZ/2) - -#define MORSE_STATE_BLINK_START 0 -#define MORSE_STATE_BLINK_STOP 1 - -#define MORSE_DIT_LEN 1 -#define MORSE_DAH_LEN 3 -#define MORSE_SPACE_LEN 7 - -struct morse_trig_data { - unsigned long delay; - char *msg; - - unsigned char morse; - unsigned char state; - char *msgpos; - struct timer_list timer; -}; - -const unsigned char morsetable[] = { - 0122, 0, 0310, 0, 0, 0163, /* "#$%&' */ - 055, 0155, 0, 0, 0163, 0141, 0152, 0051, /* ()*+,-./ */ - 077, 076, 074, 070, 060, 040, 041, 043, 047, 057, /* 0-9 */ - 0107, 0125, 0, 0061, 0, 0114, 0, /* :;<=>?@ */ - 006, 021, 025, 011, 002, 024, 013, 020, 004, /* A-I */ - 036, 015, 022, 007, 005, 017, 026, 033, 012, /* J-R */ - 010, 003, 014, 030, 016, 031, 035, 023, /* S-Z */ - 0, 0, 0, 0, 0154 /* [\]^_ */ -}; - -static inline unsigned char tomorse(char c) { - if (c >= 'a' && c <= 'z') - c = c - 'a' + 'A'; - if (c >= '"' && c <= '_') { - return morsetable[c - '"']; - } else - return 0; -} - -static inline unsigned long dit_len(struct morse_trig_data *morse_data) -{ - return MORSE_DIT_LEN*morse_data->delay; -} - -static inline unsigned long dah_len(struct morse_trig_data *morse_data) -{ - return MORSE_DAH_LEN*morse_data->delay; -} - -static inline unsigned long space_len(struct morse_trig_data *morse_data) -{ - return MORSE_SPACE_LEN*morse_data->delay; -} - -static void morse_timer_function(unsigned long data) -{ - struct led_classdev *led_cdev = (struct led_classdev *)data; - struct morse_trig_data *morse_data = led_cdev->trigger_data; - unsigned long brightness = LED_OFF; - unsigned long delay = 0; - - if (!morse_data->msg) - goto set_led; - - switch (morse_data->state) { - case MORSE_STATE_BLINK_START: - /* Starting a new blink. We have a valid code in morse. */ - delay = (morse_data->morse & 001) ? dah_len(morse_data): - dit_len(morse_data); - brightness = LED_FULL; - morse_data->state = MORSE_STATE_BLINK_STOP; - morse_data->morse >>= 1; - break; - case MORSE_STATE_BLINK_STOP: - /* Coming off of a blink. */ - morse_data->state = MORSE_STATE_BLINK_START; - - if (morse_data->morse > 1) { - /* Not done yet, just a one-dit pause. */ - delay = dit_len(morse_data); - break; - } - - /* Get a new char, figure out how much space. */ - /* First time through */ - if (!morse_data->msgpos) - morse_data->msgpos = (char *)morse_data->msg; - - if (!*morse_data->msgpos) { - /* Repeating */ - morse_data->msgpos = (char *)morse_data->msg; - delay = space_len(morse_data); - } else { - /* Inter-letter space */ - delay = dah_len(morse_data); - } - - if (!(morse_data->morse = tomorse(*morse_data->msgpos))) { - delay = space_len(morse_data); - /* And get us back here */ - morse_data->state = MORSE_STATE_BLINK_STOP; - } - morse_data->msgpos++; - break; - } - - mod_timer(&morse_data->timer, jiffies + msecs_to_jiffies(delay)); - -set_led: - led_set_brightness(led_cdev, brightness); -} - -static ssize_t _morse_delay_show(struct led_classdev *led_cdev, char *buf) -{ - struct morse_trig_data *morse_data = led_cdev->trigger_data; - - sprintf(buf, "%lu\n", morse_data->delay); - - return strlen(buf) + 1; -} - -static ssize_t _morse_delay_store(struct led_classdev *led_cdev, - const char *buf, size_t size) -{ - struct morse_trig_data *morse_data = led_cdev->trigger_data; - char *after; - unsigned long state = simple_strtoul(buf, &after, 10); - size_t count = after - buf; - int ret = -EINVAL; - - if (*after && isspace(*after)) - count++; - - if (count == size) { - morse_data->delay = state; - mod_timer(&morse_data->timer, jiffies + 1); - ret = count; - } - - return ret; -} - -static ssize_t _morse_msg_show(struct led_classdev *led_cdev, char *buf) -{ - struct morse_trig_data *morse_data = led_cdev->trigger_data; - - if (!morse_data->msg) - sprintf(buf, "\n"); - else - sprintf(buf, "%s\n", morse_data->msg); - - return strlen(buf) + 1; -} - -static ssize_t _morse_msg_store(struct led_classdev *led_cdev, - const char *buf, size_t size) -{ - struct morse_trig_data *morse_data = led_cdev->trigger_data; - char *m; - - m = kmalloc(size, GFP_KERNEL); - if (!m) - return -ENOMEM; - - memcpy(m,buf,size); - m[size]='\0'; - - if (morse_data->msg) - kfree(morse_data->msg); - - morse_data->msg = m; - morse_data->msgpos = NULL; - morse_data->state = MORSE_STATE_BLINK_STOP; - - mod_timer(&morse_data->timer, jiffies + 1); - - return size; -} - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) -static ssize_t morse_delay_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct led_classdev *led_cdev = dev_get_drvdata(dev); - - return _morse_delay_show(led_cdev, buf); -} - -static ssize_t morse_delay_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t size) -{ - struct led_classdev *led_cdev = dev_get_drvdata(dev); - - return _morse_delay_store(led_cdev, buf, size); -} - -static ssize_t morse_msg_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct led_classdev *led_cdev = dev_get_drvdata(dev); - - return _morse_msg_show(led_cdev, buf); -} - -static ssize_t morse_msg_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t size) -{ - struct led_classdev *led_cdev = dev_get_drvdata(dev); - - return _morse_msg_store(led_cdev, buf, size); -} - -static DEVICE_ATTR(delay, 0644, morse_delay_show, morse_delay_store); -static DEVICE_ATTR(message, 0644, morse_msg_show, morse_msg_store); - -#define led_device_create_file(leddev, attr) \ - device_create_file(leddev->dev, &dev_attr_ ## attr) -#define led_device_remove_file(leddev, attr) \ - device_remove_file(leddev->dev, &dev_attr_ ## attr) - -#else -static ssize_t morse_delay_show(struct class_device *dev, char *buf) -{ - struct led_classdev *led_cdev = class_get_devdata(dev); - - return _morse_delay_show(led_cdev, buf); -} - -static ssize_t morse_delay_store(struct class_device *dev, const char *buf, - size_t size) -{ - struct led_classdev *led_cdev = class_get_devdata(dev); - - return _morse_delay_store(led_cdev, buf, size); -} - -static ssize_t morse_msg_show(struct class_device *dev, char *buf) -{ - struct led_classdev *led_cdev = class_get_devdata(dev); - - return _morse_msg_show(led_cdev, buf); -} - -static ssize_t morse_msg_store(struct class_device *dev, const char *buf, - size_t size) -{ - struct led_classdev *led_cdev = class_get_devdata(dev); - - return _morse_msg_store(led_cdev, buf, size); -} - -static CLASS_DEVICE_ATTR(delay, 0644, morse_delay_show, morse_delay_store); -static CLASS_DEVICE_ATTR(message, 0644, morse_msg_show, morse_msg_store); - -#define led_device_create_file(leddev, attr) \ - class_device_create_file(leddev->class_dev, &class_device_attr_ ## attr) -#define led_device_remove_file(leddev, attr) \ - class_device_remove_file(leddev->class_dev, &class_device_attr_ ## attr) - -#endif - -static void morse_trig_activate(struct led_classdev *led_cdev) -{ - struct morse_trig_data *morse_data; - int rc; - - morse_data = kzalloc(sizeof(*morse_data), GFP_KERNEL); - if (!morse_data) - return; - - morse_data->delay = MORSE_DELAY_BASE; - init_timer(&morse_data->timer); - morse_data->timer.function = morse_timer_function; - morse_data->timer.data = (unsigned long)led_cdev; - - rc = led_device_create_file(led_cdev, delay); - if (rc) goto err; - - rc = led_device_create_file(led_cdev, message); - if (rc) goto err_delay; - - led_cdev->trigger_data = morse_data; - - return; - -err_delay: - led_device_remove_file(led_cdev, delay); -err: - kfree(morse_data); -} - -static void morse_trig_deactivate(struct led_classdev *led_cdev) -{ - struct morse_trig_data *morse_data = led_cdev->trigger_data; - - if (!morse_data) - return; - - led_device_remove_file(led_cdev, message); - led_device_remove_file(led_cdev, delay); - - del_timer_sync(&morse_data->timer); - if (morse_data->msg) - kfree(morse_data->msg); - - kfree(morse_data); -} - -static struct led_trigger morse_led_trigger = { - .name = "morse", - .activate = morse_trig_activate, - .deactivate = morse_trig_deactivate, -}; - -static int __init morse_trig_init(void) -{ - return led_trigger_register(&morse_led_trigger); -} - -static void __exit morse_trig_exit(void) -{ - led_trigger_unregister(&morse_led_trigger); -} - -module_init(morse_trig_init); -module_exit(morse_trig_exit); - -MODULE_AUTHOR("Gabor Juhos "); -MODULE_DESCRIPTION("Morse LED trigger"); -MODULE_LICENSE("GPL"); diff --git a/target/linux/generic-2.6/files-2.6.27/drivers/leds/ledtrig-netdev.c b/target/linux/generic-2.6/files-2.6.27/drivers/leds/ledtrig-netdev.c deleted file mode 100644 index fac3571bd..000000000 --- a/target/linux/generic-2.6/files-2.6.27/drivers/leds/ledtrig-netdev.c +++ /dev/null @@ -1,451 +0,0 @@ -/* - * LED Kernel Netdev Trigger - * - * Toggles the LED to reflect the link and traffic state of a named net device - * - * Copyright 2007 Oliver Jowett - * - * Derived from ledtrig-timer.c which is: - * Copyright 2005-2006 Openedhand Ltd. - * Author: Richard Purdie - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) -#include -#endif - -#include "leds.h" - -/* - * Configurable sysfs attributes: - * - * device_name - network device name to monitor - * - * interval - duration of LED blink, in milliseconds - * - * mode - either "none" (LED is off) or a space separated list of one or more of: - * link: LED's normal state reflects whether the link is up (has carrier) or not - * tx: LED blinks on transmitted data - * rx: LED blinks on receive data - * - * Some suggestions: - * - * Simple link status LED: - * $ echo netdev >someled/trigger - * $ echo eth0 >someled/device_name - * $ echo link >someled/mode - * - * Ethernet-style link/activity LED: - * $ echo netdev >someled/trigger - * $ echo eth0 >someled/device_name - * $ echo "link tx rx" >someled/mode - * - * Modem-style tx/rx LEDs: - * $ echo netdev >led1/trigger - * $ echo ppp0 >led1/device_name - * $ echo tx >led1/mode - * $ echo netdev >led2/trigger - * $ echo ppp0 >led2/device_name - * $ echo rx >led2/mode - * - */ - -#define MODE_LINK 1 -#define MODE_TX 2 -#define MODE_RX 4 - -struct led_netdev_data { - rwlock_t lock; - - struct timer_list timer; - struct notifier_block notifier; - - struct led_classdev *led_cdev; - struct net_device *net_dev; - - char device_name[IFNAMSIZ]; - unsigned interval; - unsigned mode; - unsigned link_up; - unsigned last_activity; -}; - -static void set_baseline_state(struct led_netdev_data *trigger_data) -{ - if ((trigger_data->mode & MODE_LINK) != 0 && trigger_data->link_up) - led_set_brightness(trigger_data->led_cdev, LED_FULL); - else - led_set_brightness(trigger_data->led_cdev, LED_OFF); - - if ((trigger_data->mode & (MODE_TX | MODE_RX)) != 0 && trigger_data->link_up) - mod_timer(&trigger_data->timer, jiffies + trigger_data->interval); - else - del_timer(&trigger_data->timer); -} - -static ssize_t led_device_name_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct led_classdev *led_cdev = dev_get_drvdata(dev); - struct led_netdev_data *trigger_data = led_cdev->trigger_data; - - read_lock(&trigger_data->lock); - sprintf(buf, "%s\n", trigger_data->device_name); - read_unlock(&trigger_data->lock); - - return strlen(buf) + 1; -} - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) -extern struct net init_net; -#endif - -static ssize_t led_device_name_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t size) -{ - struct led_classdev *led_cdev = dev_get_drvdata(dev); - struct led_netdev_data *trigger_data = led_cdev->trigger_data; - - if (size < 0 || size >= IFNAMSIZ) - return -EINVAL; - - write_lock(&trigger_data->lock); - - strcpy(trigger_data->device_name, buf); - if (size > 0 && trigger_data->device_name[size-1] == '\n') - trigger_data->device_name[size-1] = 0; - - if (trigger_data->device_name[0] != 0) { - /* check for existing device to update from */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) - trigger_data->net_dev = dev_get_by_name(&init_net, trigger_data->device_name); -#else - trigger_data->net_dev = dev_get_by_name(trigger_data->device_name); -#endif - if (trigger_data->net_dev != NULL) - trigger_data->link_up = (dev_get_flags(trigger_data->net_dev) & IFF_LOWER_UP) != 0; - set_baseline_state(trigger_data); /* updates LEDs, may start timers */ - } - - write_unlock(&trigger_data->lock); - return size; -} - -static DEVICE_ATTR(device_name, 0644, led_device_name_show, led_device_name_store); - -static ssize_t led_mode_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct led_classdev *led_cdev = dev_get_drvdata(dev); - struct led_netdev_data *trigger_data = led_cdev->trigger_data; - - read_lock(&trigger_data->lock); - - if (trigger_data->mode == 0) { - strcpy(buf, "none\n"); - } else { - if (trigger_data->mode & MODE_LINK) - strcat(buf, "link "); - if (trigger_data->mode & MODE_TX) - strcat(buf, "tx "); - if (trigger_data->mode & MODE_RX) - strcat(buf, "rx "); - strcat(buf, "\n"); - } - - read_unlock(&trigger_data->lock); - - return strlen(buf)+1; -} - -static ssize_t led_mode_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t size) -{ - struct led_classdev *led_cdev = dev_get_drvdata(dev); - struct led_netdev_data *trigger_data = led_cdev->trigger_data; - char copybuf[1024]; - int new_mode = -1; - char *p, *token; - - /* take a copy since we don't want to trash the inbound buffer when using strsep */ - strncpy(copybuf, buf, sizeof(copybuf)); - copybuf[1023] = 0; - p = copybuf; - - while ((token = strsep(&p, " \t\n")) != NULL) { - if (!*token) - continue; - - if (new_mode == -1) - new_mode = 0; - - if (!strcmp(token, "none")) - new_mode = 0; - else if (!strcmp(token, "tx")) - new_mode |= MODE_TX; - else if (!strcmp(token, "rx")) - new_mode |= MODE_RX; - else if (!strcmp(token, "link")) - new_mode |= MODE_LINK; - else - return -EINVAL; - } - - if (new_mode == -1) - return -EINVAL; - - write_lock(&trigger_data->lock); - trigger_data->mode = new_mode; - set_baseline_state(trigger_data); - write_unlock(&trigger_data->lock); - - return size; -} - -static DEVICE_ATTR(mode, 0644, led_mode_show, led_mode_store); - -static ssize_t led_interval_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct led_classdev *led_cdev = dev_get_drvdata(dev); - struct led_netdev_data *trigger_data = led_cdev->trigger_data; - - read_lock(&trigger_data->lock); - sprintf(buf, "%u\n", jiffies_to_msecs(trigger_data->interval)); - read_unlock(&trigger_data->lock); - - return strlen(buf) + 1; -} - -static ssize_t led_interval_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t size) -{ - struct led_classdev *led_cdev = dev_get_drvdata(dev); - struct led_netdev_data *trigger_data = led_cdev->trigger_data; - int ret = -EINVAL; - char *after; - unsigned long value = simple_strtoul(buf, &after, 10); - size_t count = after - buf; - - if (*after && isspace(*after)) - count++; - - /* impose some basic bounds on the timer interval */ - if (count == size && value >= 5 && value <= 10000) { - write_lock(&trigger_data->lock); - trigger_data->interval = msecs_to_jiffies(value); - set_baseline_state(trigger_data); // resets timer - write_unlock(&trigger_data->lock); - ret = count; - } - - return ret; -} - -static DEVICE_ATTR(interval, 0644, led_interval_show, led_interval_store); - -static int netdev_trig_notify(struct notifier_block *nb, - unsigned long evt, - void *dv) -{ - struct net_device *dev = dv; - struct led_netdev_data *trigger_data = container_of(nb, struct led_netdev_data, notifier); - - if (evt != NETDEV_UP && evt != NETDEV_DOWN && evt != NETDEV_CHANGE && evt != NETDEV_REGISTER && evt != NETDEV_UNREGISTER) - return NOTIFY_DONE; - - write_lock(&trigger_data->lock); - - if (strcmp(dev->name, trigger_data->device_name)) - goto done; - - if (evt == NETDEV_REGISTER) { - if (trigger_data->net_dev != NULL) - dev_put(trigger_data->net_dev); - dev_hold(dev); - trigger_data->net_dev = dev; - trigger_data->link_up = 0; - goto done; - } - - if (evt == NETDEV_UNREGISTER && trigger_data->net_dev != NULL) { - dev_put(trigger_data->net_dev); - trigger_data->net_dev = NULL; - goto done; - } - - /* UP / DOWN / CHANGE */ - - trigger_data->link_up = (evt != NETDEV_DOWN && netif_carrier_ok(dev)); - set_baseline_state(trigger_data); - -done: - write_unlock(&trigger_data->lock); - return NOTIFY_DONE; -} - -/* here's the real work! */ -static void netdev_trig_timer(unsigned long arg) -{ - struct led_netdev_data *trigger_data = (struct led_netdev_data *)arg; - struct net_device_stats *dev_stats; - unsigned new_activity; - - write_lock(&trigger_data->lock); - - if (!trigger_data->link_up || !trigger_data->net_dev || (trigger_data->mode & (MODE_TX | MODE_RX)) == 0) { - /* we don't need to do timer work, just reflect link state. */ - led_set_brightness(trigger_data->led_cdev, ((trigger_data->mode & MODE_LINK) != 0 && trigger_data->link_up) ? LED_FULL : LED_OFF); - goto no_restart; - } - - dev_stats = trigger_data->net_dev->get_stats(trigger_data->net_dev); - new_activity = - ((trigger_data->mode & MODE_TX) ? dev_stats->tx_packets : 0) + - ((trigger_data->mode & MODE_RX) ? dev_stats->rx_packets : 0); - - if (trigger_data->mode & MODE_LINK) { - /* base state is ON (link present) */ - /* if there's no link, we don't get this far and the LED is off */ - - /* OFF -> ON always */ - /* ON -> OFF on activity */ - if (trigger_data->led_cdev->brightness == LED_OFF) { - led_set_brightness(trigger_data->led_cdev, LED_FULL); - } else if (trigger_data->last_activity != new_activity) { - led_set_brightness(trigger_data->led_cdev, LED_OFF); - } - } else { - /* base state is OFF */ - /* ON -> OFF always */ - /* OFF -> ON on activity */ - if (trigger_data->led_cdev->brightness == LED_FULL) { - led_set_brightness(trigger_data->led_cdev, LED_OFF); - } else if (trigger_data->last_activity != new_activity) { - led_set_brightness(trigger_data->led_cdev, LED_FULL); - } - } - - trigger_data->last_activity = new_activity; - mod_timer(&trigger_data->timer, jiffies + trigger_data->interval); - -no_restart: - write_unlock(&trigger_data->lock); -} - -static void netdev_trig_activate(struct led_classdev *led_cdev) -{ - struct led_netdev_data *trigger_data; - int rc; - - trigger_data = kzalloc(sizeof(struct led_netdev_data), GFP_KERNEL); - if (!trigger_data) - return; - - rwlock_init(&trigger_data->lock); - - trigger_data->notifier.notifier_call = netdev_trig_notify; - trigger_data->notifier.priority = 10; - - setup_timer(&trigger_data->timer, netdev_trig_timer, (unsigned long) trigger_data); - - trigger_data->led_cdev = led_cdev; - trigger_data->net_dev = NULL; - trigger_data->device_name[0] = 0; - - trigger_data->mode = 0; - trigger_data->interval = msecs_to_jiffies(50); - trigger_data->link_up = 0; - trigger_data->last_activity = 0; - - led_cdev->trigger_data = trigger_data; - - rc = device_create_file(led_cdev->dev, &dev_attr_device_name); - if (rc) - goto err_out; - rc = device_create_file(led_cdev->dev, &dev_attr_mode); - if (rc) - goto err_out_device_name; - rc = device_create_file(led_cdev->dev, &dev_attr_interval); - if (rc) - goto err_out_mode; - - register_netdevice_notifier(&trigger_data->notifier); - return; - -err_out_mode: - device_remove_file(led_cdev->dev, &dev_attr_mode); -err_out_device_name: - device_remove_file(led_cdev->dev, &dev_attr_device_name); -err_out: - led_cdev->trigger_data = NULL; - kfree(trigger_data); -} - -static void netdev_trig_deactivate(struct led_classdev *led_cdev) -{ - struct led_netdev_data *trigger_data = led_cdev->trigger_data; - - if (trigger_data) { - unregister_netdevice_notifier(&trigger_data->notifier); - - device_remove_file(led_cdev->dev, &dev_attr_device_name); - device_remove_file(led_cdev->dev, &dev_attr_mode); - device_remove_file(led_cdev->dev, &dev_attr_interval); - - write_lock(&trigger_data->lock); - - if (trigger_data->net_dev) { - dev_put(trigger_data->net_dev); - trigger_data->net_dev = NULL; - } - - write_unlock(&trigger_data->lock); - - del_timer_sync(&trigger_data->timer); - - kfree(trigger_data); - } -} - -static struct led_trigger netdev_led_trigger = { - .name = "netdev", - .activate = netdev_trig_activate, - .deactivate = netdev_trig_deactivate, -}; - -static int __init netdev_trig_init(void) -{ - return led_trigger_register(&netdev_led_trigger); -} - -static void __exit netdev_trig_exit(void) -{ - led_trigger_unregister(&netdev_led_trigger); -} - -module_init(netdev_trig_init); -module_exit(netdev_trig_exit); - -MODULE_AUTHOR("Oliver Jowett "); -MODULE_DESCRIPTION("Netdev LED trigger"); -MODULE_LICENSE("GPL"); diff --git a/target/linux/generic-2.6/files-2.6.27/include/linux/gpio_buttons.h b/target/linux/generic-2.6/files-2.6.27/include/linux/gpio_buttons.h deleted file mode 100644 index f5e629725..000000000 --- a/target/linux/generic-2.6/files-2.6.27/include/linux/gpio_buttons.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Definitions for the GPIO buttons interface driver - * - * Copyright (C) 2007,2008 Gabor Juhos - * - * This file was based on: /include/linux/gpio_keys.h - * The original gpio_keys.h seems not to have a license. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - */ - -#ifndef _GPIO_BUTTONS_H_ -#define _GPIO_BUTTONS_H_ - -struct gpio_button { - int gpio; /* GPIO line number */ - int active_low; - char *desc; /* button description */ - int type; /* input event type (EV_KEY, EV_SW) */ - int code; /* input event code (KEY_*, SW_*) */ - int count; - int threshold; /* count threshold */ -}; - -struct gpio_buttons_platform_data { - struct gpio_button *buttons; - int nbuttons; /* number of buttons */ - int poll_interval; /* polling interval */ -}; - -#endif /* _GPIO_BUTTONS_H_ */ - diff --git a/target/linux/generic-2.6/files-2.6.27/include/linux/gpio_dev.h b/target/linux/generic-2.6/files-2.6.27/include/linux/gpio_dev.h deleted file mode 100644 index 3f3c9c772..000000000 --- a/target/linux/generic-2.6/files-2.6.27/include/linux/gpio_dev.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _GPIODEV_H__ -#define _GPIODEV_H__ - -#define IOC_GPIODEV_MAGIC 'B' -#define GPIO_GET _IO(IOC_GPIODEV_MAGIC, 10) -#define GPIO_SET _IO(IOC_GPIODEV_MAGIC, 11) -#define GPIO_CLEAR _IO(IOC_GPIODEV_MAGIC, 12) -#define GPIO_DIR_IN _IO(IOC_GPIODEV_MAGIC, 13) -#define GPIO_DIR_OUT _IO(IOC_GPIODEV_MAGIC, 14) - -#endif diff --git a/target/linux/generic-2.6/patches-2.6.27/001-squashfs.patch b/target/linux/generic-2.6/patches-2.6.27/001-squashfs.patch deleted file mode 100644 index b8176914c..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/001-squashfs.patch +++ /dev/null @@ -1,4170 +0,0 @@ ---- a/fs/Kconfig -+++ b/fs/Kconfig -@@ -1348,6 +1348,71 @@ config CRAMFS - - If unsure, say N. - -+config SQUASHFS -+ tristate "SquashFS 3.0 - Squashed file system support" -+ select ZLIB_INFLATE -+ help -+ Saying Y here includes support for SquashFS 3.0 (a Compressed Read-Only File -+ System). Squashfs is a highly compressed read-only filesystem for Linux. -+ It uses zlib compression to compress both files, inodes and directories. -+ Inodes in the system are very small and all blocks are packed to minimise -+ data overhead. Block sizes greater than 4K are supported up to a maximum of 64K. -+ SquashFS 3.0 supports 64 bit filesystems and files (larger than 4GB), full -+ uid/gid information, hard links and timestamps. -+ -+ Squashfs is intended for general read-only filesystem use, for archival -+ use (i.e. in cases where a .tar.gz file may be used), and in embedded -+ systems where low overhead is needed. Further information and filesystem tools -+ are available from http://squashfs.sourceforge.net. -+ -+ If you want to compile this as a module ( = code which can be -+ inserted in and removed from the running kernel whenever you want), -+ say M here and read . The module -+ will be called squashfs. Note that the root file system (the one -+ containing the directory /) cannot be compiled as a module. -+ -+ If unsure, say N. -+ -+config SQUASHFS_EMBEDDED -+ -+ bool "Additional options for memory-constrained systems" -+ depends on SQUASHFS -+ default n -+ help -+ Saying Y here allows you to specify cache sizes and how Squashfs -+ allocates memory. This is only intended for memory constrained -+ systems. -+ -+ If unsure, say N. -+ -+config SQUASHFS_FRAGMENT_CACHE_SIZE -+ int "Number of fragments cached" if SQUASHFS_EMBEDDED -+ depends on SQUASHFS -+ default "3" -+ help -+ By default SquashFS caches the last 3 fragments read from -+ the filesystem. Increasing this amount may mean SquashFS -+ has to re-read fragments less often from disk, at the expense -+ of extra system memory. Decreasing this amount will mean -+ SquashFS uses less memory at the expense of extra reads from disk. -+ -+ Note there must be at least one cached fragment. Anything -+ much more than three will probably not make much difference. -+ -+config SQUASHFS_VMALLOC -+ bool "Use Vmalloc rather than Kmalloc" if SQUASHFS_EMBEDDED -+ depends on SQUASHFS -+ default n -+ help -+ By default SquashFS uses kmalloc to obtain fragment cache memory. -+ Kmalloc memory is the standard kernel allocator, but it can fail -+ on memory constrained systems. Because of the way Vmalloc works, -+ Vmalloc can succeed when kmalloc fails. Specifying this option -+ will make SquashFS always use Vmalloc to allocate the -+ fragment cache memory. -+ -+ If unsure, say N. -+ - config VXFS_FS - tristate "FreeVxFS file system support (VERITAS VxFS(TM) compatible)" - depends on BLOCK ---- a/fs/Makefile -+++ b/fs/Makefile -@@ -74,6 +74,7 @@ obj-$(CONFIG_JBD) += jbd/ - obj-$(CONFIG_JBD2) += jbd2/ - obj-$(CONFIG_EXT2_FS) += ext2/ - obj-$(CONFIG_CRAMFS) += cramfs/ -+obj-$(CONFIG_SQUASHFS) += squashfs/ - obj-y += ramfs/ - obj-$(CONFIG_HUGETLBFS) += hugetlbfs/ - obj-$(CONFIG_CODA_FS) += coda/ ---- /dev/null -+++ b/fs/squashfs/inode.c -@@ -0,0 +1,2122 @@ -+/* -+ * Squashfs - a compressed read only filesystem for Linux -+ * -+ * Copyright (c) 2002, 2003, 2004, 2005, 2006 -+ * Phillip Lougher -+ * -+ * 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, -+ * or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ * -+ * inode.c -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "squashfs.h" -+ -+static void squashfs_put_super(struct super_block *); -+static int squashfs_statfs(struct dentry *, struct kstatfs *); -+static int squashfs_symlink_readpage(struct file *file, struct page *page); -+static int squashfs_readpage(struct file *file, struct page *page); -+static int squashfs_readpage4K(struct file *file, struct page *page); -+static int squashfs_readdir(struct file *, void *, filldir_t); -+static struct inode *squashfs_alloc_inode(struct super_block *sb); -+static void squashfs_destroy_inode(struct inode *inode); -+static int init_inodecache(void); -+static void destroy_inodecache(void); -+static struct dentry *squashfs_lookup(struct inode *, struct dentry *, -+ struct nameidata *); -+static struct inode *squashfs_iget(struct super_block *s, squashfs_inode_t inode); -+static long long read_blocklist(struct inode *inode, int index, -+ int readahead_blks, char *block_list, -+ unsigned short **block_p, unsigned int *bsize); -+static int squashfs_get_sb(struct file_system_type *, int, -+ const char *, void *, struct vfsmount *); -+ -+ -+static z_stream stream; -+ -+static struct file_system_type squashfs_fs_type = { -+ .owner = THIS_MODULE, -+ .name = "squashfs", -+ .get_sb = squashfs_get_sb, -+ .kill_sb = kill_block_super, -+ .fs_flags = FS_REQUIRES_DEV -+}; -+ -+static unsigned char squashfs_filetype_table[] = { -+ DT_UNKNOWN, DT_DIR, DT_REG, DT_LNK, DT_BLK, DT_CHR, DT_FIFO, DT_SOCK -+}; -+ -+static struct super_operations squashfs_ops = { -+ .alloc_inode = squashfs_alloc_inode, -+ .destroy_inode = squashfs_destroy_inode, -+ .statfs = squashfs_statfs, -+ .put_super = squashfs_put_super, -+}; -+ -+SQSH_EXTERN struct address_space_operations squashfs_symlink_aops = { -+ .readpage = squashfs_symlink_readpage -+}; -+ -+SQSH_EXTERN struct address_space_operations squashfs_aops = { -+ .readpage = squashfs_readpage -+}; -+ -+SQSH_EXTERN struct address_space_operations squashfs_aops_4K = { -+ .readpage = squashfs_readpage4K -+}; -+ -+static struct file_operations squashfs_dir_ops = { -+ .read = generic_read_dir, -+ .readdir = squashfs_readdir -+}; -+ -+SQSH_EXTERN struct inode_operations squashfs_dir_inode_ops = { -+ .lookup = squashfs_lookup -+}; -+ -+ -+static struct buffer_head *get_block_length(struct super_block *s, -+ int *cur_index, int *offset, int *c_byte) -+{ -+ struct squashfs_sb_info *msblk = s->s_fs_info; -+ unsigned short temp; -+ struct buffer_head *bh; -+ -+ if (!(bh = sb_bread(s, *cur_index))) -+ goto out; -+ -+ if (msblk->devblksize - *offset == 1) { -+ if (msblk->swap) -+ ((unsigned char *) &temp)[1] = *((unsigned char *) -+ (bh->b_data + *offset)); -+ else -+ ((unsigned char *) &temp)[0] = *((unsigned char *) -+ (bh->b_data + *offset)); -+ brelse(bh); -+ if (!(bh = sb_bread(s, ++(*cur_index)))) -+ goto out; -+ if (msblk->swap) -+ ((unsigned char *) &temp)[0] = *((unsigned char *) -+ bh->b_data); -+ else -+ ((unsigned char *) &temp)[1] = *((unsigned char *) -+ bh->b_data); -+ *c_byte = temp; -+ *offset = 1; -+ } else { -+ if (msblk->swap) { -+ ((unsigned char *) &temp)[1] = *((unsigned char *) -+ (bh->b_data + *offset)); -+ ((unsigned char *) &temp)[0] = *((unsigned char *) -+ (bh->b_data + *offset + 1)); -+ } else { -+ ((unsigned char *) &temp)[0] = *((unsigned char *) -+ (bh->b_data + *offset)); -+ ((unsigned char *) &temp)[1] = *((unsigned char *) -+ (bh->b_data + *offset + 1)); -+ } -+ *c_byte = temp; -+ *offset += 2; -+ } -+ -+ if (SQUASHFS_CHECK_DATA(msblk->sblk.flags)) { -+ if (*offset == msblk->devblksize) { -+ brelse(bh); -+ if (!(bh = sb_bread(s, ++(*cur_index)))) -+ goto out; -+ *offset = 0; -+ } -+ if (*((unsigned char *) (bh->b_data + *offset)) != -+ SQUASHFS_MARKER_BYTE) { -+ ERROR("Metadata block marker corrupt @ %x\n", -+ *cur_index); -+ brelse(bh); -+ goto out; -+ } -+ (*offset)++; -+ } -+ return bh; -+ -+out: -+ return NULL; -+} -+ -+ -+SQSH_EXTERN unsigned int squashfs_read_data(struct super_block *s, char *buffer, -+ long long index, unsigned int length, -+ long long *next_index) -+{ -+ struct squashfs_sb_info *msblk = s->s_fs_info; -+ struct buffer_head *bh[((SQUASHFS_FILE_MAX_SIZE - 1) >> -+ msblk->devblksize_log2) + 2]; -+ unsigned int offset = index & ((1 << msblk->devblksize_log2) - 1); -+ unsigned int cur_index = index >> msblk->devblksize_log2; -+ int bytes, avail_bytes, b = 0, k; -+ char *c_buffer; -+ unsigned int compressed; -+ unsigned int c_byte = length; -+ -+ if (c_byte) { -+ bytes = msblk->devblksize - offset; -+ compressed = SQUASHFS_COMPRESSED_BLOCK(c_byte); -+ c_buffer = compressed ? msblk->read_data : buffer; -+ c_byte = SQUASHFS_COMPRESSED_SIZE_BLOCK(c_byte); -+ -+ TRACE("Block @ 0x%llx, %scompressed size %d\n", index, compressed -+ ? "" : "un", (unsigned int) c_byte); -+ -+ if (!(bh[0] = sb_getblk(s, cur_index))) -+ goto block_release; -+ -+ for (b = 1; bytes < c_byte; b++) { -+ if (!(bh[b] = sb_getblk(s, ++cur_index))) -+ goto block_release; -+ bytes += msblk->devblksize; -+ } -+ ll_rw_block(READ, b, bh); -+ } else { -+ if (!(bh[0] = get_block_length(s, &cur_index, &offset, -+ &c_byte))) -+ goto read_failure; -+ -+ bytes = msblk->devblksize - offset; -+ compressed = SQUASHFS_COMPRESSED(c_byte); -+ c_buffer = compressed ? msblk->read_data : buffer; -+ c_byte = SQUASHFS_COMPRESSED_SIZE(c_byte); -+ -+ TRACE("Block @ 0x%llx, %scompressed size %d\n", index, compressed -+ ? "" : "un", (unsigned int) c_byte); -+ -+ for (b = 1; bytes < c_byte; b++) { -+ if (!(bh[b] = sb_getblk(s, ++cur_index))) -+ goto block_release; -+ bytes += msblk->devblksize; -+ } -+ ll_rw_block(READ, b - 1, bh + 1); -+ } -+ -+ if (compressed) -+ down(&msblk->read_data_mutex); -+ -+ for (bytes = 0, k = 0; k < b; k++) { -+ avail_bytes = (c_byte - bytes) > (msblk->devblksize - offset) ? -+ msblk->devblksize - offset : -+ c_byte - bytes; -+ wait_on_buffer(bh[k]); -+ if (!buffer_uptodate(bh[k])) -+ goto block_release; -+ memcpy(c_buffer + bytes, bh[k]->b_data + offset, avail_bytes); -+ bytes += avail_bytes; -+ offset = 0; -+ brelse(bh[k]); -+ } -+ -+ /* -+ * uncompress block -+ */ -+ if (compressed) { -+ int zlib_err; -+ -+ stream.next_in = c_buffer; -+ stream.avail_in = c_byte; -+ stream.next_out = buffer; -+ stream.avail_out = msblk->read_size; -+ -+ if (((zlib_err = zlib_inflateInit(&stream)) != Z_OK) || -+ ((zlib_err = zlib_inflate(&stream, Z_FINISH)) -+ != Z_STREAM_END) || ((zlib_err = -+ zlib_inflateEnd(&stream)) != Z_OK)) { -+ ERROR("zlib_fs returned unexpected result 0x%x\n", -+ zlib_err); -+ bytes = 0; -+ } else -+ bytes = stream.total_out; -+ -+ up(&msblk->read_data_mutex); -+ } -+ -+ if (next_index) -+ *next_index = index + c_byte + (length ? 0 : -+ (SQUASHFS_CHECK_DATA(msblk->sblk.flags) -+ ? 3 : 2)); -+ return bytes; -+ -+block_release: -+ while (--b >= 0) -+ brelse(bh[b]); -+ -+read_failure: -+ ERROR("sb_bread failed reading block 0x%x\n", cur_index); -+ return 0; -+} -+ -+ -+SQSH_EXTERN int squashfs_get_cached_block(struct super_block *s, char *buffer, -+ long long block, unsigned int offset, -+ int length, long long *next_block, -+ unsigned int *next_offset) -+{ -+ struct squashfs_sb_info *msblk = s->s_fs_info; -+ int n, i, bytes, return_length = length; -+ long long next_index; -+ -+ TRACE("Entered squashfs_get_cached_block [%llx:%x]\n", block, offset); -+ -+ while ( 1 ) { -+ for (i = 0; i < SQUASHFS_CACHED_BLKS; i++) -+ if (msblk->block_cache[i].block == block) -+ break; -+ -+ down(&msblk->block_cache_mutex); -+ -+ if (i == SQUASHFS_CACHED_BLKS) { -+ /* read inode header block */ -+ for (i = msblk->next_cache, n = SQUASHFS_CACHED_BLKS; -+ n ; n --, i = (i + 1) % -+ SQUASHFS_CACHED_BLKS) -+ if (msblk->block_cache[i].block != -+ SQUASHFS_USED_BLK) -+ break; -+ -+ if (n == 0) { -+ wait_queue_t wait; -+ -+ init_waitqueue_entry(&wait, current); -+ add_wait_queue(&msblk->waitq, &wait); -+ set_current_state(TASK_UNINTERRUPTIBLE); -+ up(&msblk->block_cache_mutex); -+ schedule(); -+ set_current_state(TASK_RUNNING); -+ remove_wait_queue(&msblk->waitq, &wait); -+ continue; -+ } -+ msblk->next_cache = (i + 1) % SQUASHFS_CACHED_BLKS; -+ -+ if (msblk->block_cache[i].block == -+ SQUASHFS_INVALID_BLK) { -+ if (!(msblk->block_cache[i].data = -+ kmalloc(SQUASHFS_METADATA_SIZE, -+ GFP_KERNEL))) { -+ ERROR("Failed to allocate cache" -+ "block\n"); -+ up(&msblk->block_cache_mutex); -+ goto out; -+ } -+ } -+ -+ msblk->block_cache[i].block = SQUASHFS_USED_BLK; -+ up(&msblk->block_cache_mutex); -+ -+ if (!(msblk->block_cache[i].length = -+ squashfs_read_data(s, -+ msblk->block_cache[i].data, -+ block, 0, &next_index))) { -+ ERROR("Unable to read cache block [%llx:%x]\n", -+ block, offset); -+ goto out; -+ } -+ -+ down(&msblk->block_cache_mutex); -+ wake_up(&msblk->waitq); -+ msblk->block_cache[i].block = block; -+ msblk->block_cache[i].next_index = next_index; -+ TRACE("Read cache block [%llx:%x]\n", block, offset); -+ } -+ -+ if (msblk->block_cache[i].block != block) { -+ up(&msblk->block_cache_mutex); -+ continue; -+ } -+ -+ if ((bytes = msblk->block_cache[i].length - offset) >= length) { -+ if (buffer) -+ memcpy(buffer, msblk->block_cache[i].data + -+ offset, length); -+ if (msblk->block_cache[i].length - offset == length) { -+ *next_block = msblk->block_cache[i].next_index; -+ *next_offset = 0; -+ } else { -+ *next_block = block; -+ *next_offset = offset + length; -+ } -+ up(&msblk->block_cache_mutex); -+ goto finish; -+ } else { -+ if (buffer) { -+ memcpy(buffer, msblk->block_cache[i].data + -+ offset, bytes); -+ buffer += bytes; -+ } -+ block = msblk->block_cache[i].next_index; -+ up(&msblk->block_cache_mutex); -+ length -= bytes; -+ offset = 0; -+ } -+ } -+ -+finish: -+ return return_length; -+out: -+ return 0; -+} -+ -+ -+static int get_fragment_location(struct super_block *s, unsigned int fragment, -+ long long *fragment_start_block, -+ unsigned int *fragment_size) -+{ -+ struct squashfs_sb_info *msblk = s->s_fs_info; -+ long long start_block = -+ msblk->fragment_index[SQUASHFS_FRAGMENT_INDEX(fragment)]; -+ int offset = SQUASHFS_FRAGMENT_INDEX_OFFSET(fragment); -+ struct squashfs_fragment_entry fragment_entry; -+ -+ if (msblk->swap) { -+ struct squashfs_fragment_entry sfragment_entry; -+ -+ if (!squashfs_get_cached_block(s, (char *) &sfragment_entry, -+ start_block, offset, -+ sizeof(sfragment_entry), &start_block, -+ &offset)) -+ goto out; -+ SQUASHFS_SWAP_FRAGMENT_ENTRY(&fragment_entry, &sfragment_entry); -+ } else -+ if (!squashfs_get_cached_block(s, (char *) &fragment_entry, -+ start_block, offset, -+ sizeof(fragment_entry), &start_block, -+ &offset)) -+ goto out; -+ -+ *fragment_start_block = fragment_entry.start_block; -+ *fragment_size = fragment_entry.size; -+ -+ return 1; -+ -+out: -+ return 0; -+} -+ -+ -+SQSH_EXTERN void release_cached_fragment(struct squashfs_sb_info *msblk, struct -+ squashfs_fragment_cache *fragment) -+{ -+ down(&msblk->fragment_mutex); -+ fragment->locked --; -+ wake_up(&msblk->fragment_wait_queue); -+ up(&msblk->fragment_mutex); -+} -+ -+ -+SQSH_EXTERN struct squashfs_fragment_cache *get_cached_fragment(struct super_block -+ *s, long long start_block, -+ int length) -+{ -+ int i, n; -+ struct squashfs_sb_info *msblk = s->s_fs_info; -+ -+ while ( 1 ) { -+ down(&msblk->fragment_mutex); -+ -+ for (i = 0; i < SQUASHFS_CACHED_FRAGMENTS && -+ msblk->fragment[i].block != start_block; i++); -+ -+ if (i == SQUASHFS_CACHED_FRAGMENTS) { -+ for (i = msblk->next_fragment, n = -+ SQUASHFS_CACHED_FRAGMENTS; n && -+ msblk->fragment[i].locked; n--, i = (i + 1) % -+ SQUASHFS_CACHED_FRAGMENTS); -+ -+ if (n == 0) { -+ wait_queue_t wait; -+ -+ init_waitqueue_entry(&wait, current); -+ add_wait_queue(&msblk->fragment_wait_queue, -+ &wait); -+ set_current_state(TASK_UNINTERRUPTIBLE); -+ up(&msblk->fragment_mutex); -+ schedule(); -+ set_current_state(TASK_RUNNING); -+ remove_wait_queue(&msblk->fragment_wait_queue, -+ &wait); -+ continue; -+ } -+ msblk->next_fragment = (msblk->next_fragment + 1) % -+ SQUASHFS_CACHED_FRAGMENTS; -+ -+ if (msblk->fragment[i].data == NULL) -+ if (!(msblk->fragment[i].data = SQUASHFS_ALLOC -+ (SQUASHFS_FILE_MAX_SIZE))) { -+ ERROR("Failed to allocate fragment " -+ "cache block\n"); -+ up(&msblk->fragment_mutex); -+ goto out; -+ } -+ -+ msblk->fragment[i].block = SQUASHFS_INVALID_BLK; -+ msblk->fragment[i].locked = 1; -+ up(&msblk->fragment_mutex); -+ -+ if (!(msblk->fragment[i].length = squashfs_read_data(s, -+ msblk->fragment[i].data, -+ start_block, length, NULL))) { -+ ERROR("Unable to read fragment cache block " -+ "[%llx]\n", start_block); -+ msblk->fragment[i].locked = 0; -+ goto out; -+ } -+ -+ msblk->fragment[i].block = start_block; -+ TRACE("New fragment %d, start block %lld, locked %d\n", -+ i, msblk->fragment[i].block, -+ msblk->fragment[i].locked); -+ break; -+ } -+ -+ msblk->fragment[i].locked++; -+ up(&msblk->fragment_mutex); -+ TRACE("Got fragment %d, start block %lld, locked %d\n", i, -+ msblk->fragment[i].block, -+ msblk->fragment[i].locked); -+ break; -+ } -+ -+ return &msblk->fragment[i]; -+ -+out: -+ return NULL; -+} -+ -+ -+static struct inode *squashfs_new_inode(struct super_block *s, -+ struct squashfs_base_inode_header *inodeb) -+{ -+ struct squashfs_sb_info *msblk = s->s_fs_info; -+ struct inode *i = new_inode(s); -+ -+ if (i) { -+ i->i_ino = inodeb->inode_number; -+ i->i_mtime.tv_sec = inodeb->mtime; -+ i->i_atime.tv_sec = inodeb->mtime; -+ i->i_ctime.tv_sec = inodeb->mtime; -+ i->i_uid = msblk->uid[inodeb->uid]; -+ i->i_mode = inodeb->mode; -+ i->i_size = 0; -+ if (inodeb->guid == SQUASHFS_GUIDS) -+ i->i_gid = i->i_uid; -+ else -+ i->i_gid = msblk->guid[inodeb->guid]; -+ } -+ -+ return i; -+} -+ -+ -+static struct inode *squashfs_iget(struct super_block *s, squashfs_inode_t inode) -+{ -+ struct inode *i; -+ struct squashfs_sb_info *msblk = s->s_fs_info; -+ struct squashfs_super_block *sblk = &msblk->sblk; -+ long long block = SQUASHFS_INODE_BLK(inode) + -+ sblk->inode_table_start; -+ unsigned int offset = SQUASHFS_INODE_OFFSET(inode); -+ long long next_block; -+ unsigned int next_offset; -+ union squashfs_inode_header id, sid; -+ struct squashfs_base_inode_header *inodeb = &id.base, -+ *sinodeb = &sid.base; -+ -+ TRACE("Entered squashfs_iget\n"); -+ -+ if (msblk->swap) { -+ if (!squashfs_get_cached_block(s, (char *) sinodeb, block, -+ offset, sizeof(*sinodeb), &next_block, -+ &next_offset)) -+ goto failed_read; -+ SQUASHFS_SWAP_BASE_INODE_HEADER(inodeb, sinodeb, -+ sizeof(*sinodeb)); -+ } else -+ if (!squashfs_get_cached_block(s, (char *) inodeb, block, -+ offset, sizeof(*inodeb), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ switch(inodeb->inode_type) { -+ case SQUASHFS_FILE_TYPE: { -+ unsigned int frag_size; -+ long long frag_blk; -+ struct squashfs_reg_inode_header *inodep = &id.reg; -+ struct squashfs_reg_inode_header *sinodep = &sid.reg; -+ -+ if (msblk->swap) { -+ if (!squashfs_get_cached_block(s, (char *) -+ sinodep, block, offset, -+ sizeof(*sinodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ SQUASHFS_SWAP_REG_INODE_HEADER(inodep, sinodep); -+ } else -+ if (!squashfs_get_cached_block(s, (char *) -+ inodep, block, offset, -+ sizeof(*inodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ frag_blk = SQUASHFS_INVALID_BLK; -+ if (inodep->fragment != SQUASHFS_INVALID_FRAG && -+ !get_fragment_location(s, -+ inodep->fragment, &frag_blk, &frag_size)) -+ goto failed_read; -+ -+ if((i = squashfs_new_inode(s, inodeb)) == NULL) -+ goto failed_read1; -+ -+ i->i_nlink = 1; -+ i->i_size = inodep->file_size; -+ i->i_fop = &generic_ro_fops; -+ i->i_mode |= S_IFREG; -+ i->i_blocks = ((i->i_size - 1) >> 9) + 1; -+ SQUASHFS_I(i)->u.s1.fragment_start_block = frag_blk; -+ SQUASHFS_I(i)->u.s1.fragment_size = frag_size; -+ SQUASHFS_I(i)->u.s1.fragment_offset = inodep->offset; -+ SQUASHFS_I(i)->start_block = inodep->start_block; -+ SQUASHFS_I(i)->u.s1.block_list_start = next_block; -+ SQUASHFS_I(i)->offset = next_offset; -+ if (sblk->block_size > 4096) -+ i->i_data.a_ops = &squashfs_aops; -+ else -+ i->i_data.a_ops = &squashfs_aops_4K; -+ -+ TRACE("File inode %x:%x, start_block %llx, " -+ "block_list_start %llx, offset %x\n", -+ SQUASHFS_INODE_BLK(inode), offset, -+ inodep->start_block, next_block, -+ next_offset); -+ break; -+ } -+ case SQUASHFS_LREG_TYPE: { -+ unsigned int frag_size; -+ long long frag_blk; -+ struct squashfs_lreg_inode_header *inodep = &id.lreg; -+ struct squashfs_lreg_inode_header *sinodep = &sid.lreg; -+ -+ if (msblk->swap) { -+ if (!squashfs_get_cached_block(s, (char *) -+ sinodep, block, offset, -+ sizeof(*sinodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ SQUASHFS_SWAP_LREG_INODE_HEADER(inodep, sinodep); -+ } else -+ if (!squashfs_get_cached_block(s, (char *) -+ inodep, block, offset, -+ sizeof(*inodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ frag_blk = SQUASHFS_INVALID_BLK; -+ if (inodep->fragment != SQUASHFS_INVALID_FRAG && -+ !get_fragment_location(s, -+ inodep->fragment, &frag_blk, &frag_size)) -+ goto failed_read; -+ -+ if((i = squashfs_new_inode(s, inodeb)) == NULL) -+ goto failed_read1; -+ -+ i->i_nlink = inodep->nlink; -+ i->i_size = inodep->file_size; -+ i->i_fop = &generic_ro_fops; -+ i->i_mode |= S_IFREG; -+ i->i_blocks = ((i->i_size - 1) >> 9) + 1; -+ SQUASHFS_I(i)->u.s1.fragment_start_block = frag_blk; -+ SQUASHFS_I(i)->u.s1.fragment_size = frag_size; -+ SQUASHFS_I(i)->u.s1.fragment_offset = inodep->offset; -+ SQUASHFS_I(i)->start_block = inodep->start_block; -+ SQUASHFS_I(i)->u.s1.block_list_start = next_block; -+ SQUASHFS_I(i)->offset = next_offset; -+ if (sblk->block_size > 4096) -+ i->i_data.a_ops = &squashfs_aops; -+ else -+ i->i_data.a_ops = &squashfs_aops_4K; -+ -+ TRACE("File inode %x:%x, start_block %llx, " -+ "block_list_start %llx, offset %x\n", -+ SQUASHFS_INODE_BLK(inode), offset, -+ inodep->start_block, next_block, -+ next_offset); -+ break; -+ } -+ case SQUASHFS_DIR_TYPE: { -+ struct squashfs_dir_inode_header *inodep = &id.dir; -+ struct squashfs_dir_inode_header *sinodep = &sid.dir; -+ -+ if (msblk->swap) { -+ if (!squashfs_get_cached_block(s, (char *) -+ sinodep, block, offset, -+ sizeof(*sinodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ SQUASHFS_SWAP_DIR_INODE_HEADER(inodep, sinodep); -+ } else -+ if (!squashfs_get_cached_block(s, (char *) -+ inodep, block, offset, -+ sizeof(*inodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ if((i = squashfs_new_inode(s, inodeb)) == NULL) -+ goto failed_read1; -+ -+ i->i_nlink = inodep->nlink; -+ i->i_size = inodep->file_size; -+ i->i_op = &squashfs_dir_inode_ops; -+ i->i_fop = &squashfs_dir_ops; -+ i->i_mode |= S_IFDIR; -+ SQUASHFS_I(i)->start_block = inodep->start_block; -+ SQUASHFS_I(i)->offset = inodep->offset; -+ SQUASHFS_I(i)->u.s2.directory_index_count = 0; -+ SQUASHFS_I(i)->u.s2.parent_inode = inodep->parent_inode; -+ -+ TRACE("Directory inode %x:%x, start_block %x, offset " -+ "%x\n", SQUASHFS_INODE_BLK(inode), -+ offset, inodep->start_block, -+ inodep->offset); -+ break; -+ } -+ case SQUASHFS_LDIR_TYPE: { -+ struct squashfs_ldir_inode_header *inodep = &id.ldir; -+ struct squashfs_ldir_inode_header *sinodep = &sid.ldir; -+ -+ if (msblk->swap) { -+ if (!squashfs_get_cached_block(s, (char *) -+ sinodep, block, offset, -+ sizeof(*sinodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ SQUASHFS_SWAP_LDIR_INODE_HEADER(inodep, -+ sinodep); -+ } else -+ if (!squashfs_get_cached_block(s, (char *) -+ inodep, block, offset, -+ sizeof(*inodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ if((i = squashfs_new_inode(s, inodeb)) == NULL) -+ goto failed_read1; -+ -+ i->i_nlink = inodep->nlink; -+ i->i_size = inodep->file_size; -+ i->i_op = &squashfs_dir_inode_ops; -+ i->i_fop = &squashfs_dir_ops; -+ i->i_mode |= S_IFDIR; -+ SQUASHFS_I(i)->start_block = inodep->start_block; -+ SQUASHFS_I(i)->offset = inodep->offset; -+ SQUASHFS_I(i)->u.s2.directory_index_start = next_block; -+ SQUASHFS_I(i)->u.s2.directory_index_offset = -+ next_offset; -+ SQUASHFS_I(i)->u.s2.directory_index_count = -+ inodep->i_count; -+ SQUASHFS_I(i)->u.s2.parent_inode = inodep->parent_inode; -+ -+ TRACE("Long directory inode %x:%x, start_block %x, " -+ "offset %x\n", -+ SQUASHFS_INODE_BLK(inode), offset, -+ inodep->start_block, inodep->offset); -+ break; -+ } -+ case SQUASHFS_SYMLINK_TYPE: { -+ struct squashfs_symlink_inode_header *inodep = -+ &id.symlink; -+ struct squashfs_symlink_inode_header *sinodep = -+ &sid.symlink; -+ -+ if (msblk->swap) { -+ if (!squashfs_get_cached_block(s, (char *) -+ sinodep, block, offset, -+ sizeof(*sinodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ SQUASHFS_SWAP_SYMLINK_INODE_HEADER(inodep, -+ sinodep); -+ } else -+ if (!squashfs_get_cached_block(s, (char *) -+ inodep, block, offset, -+ sizeof(*inodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ if((i = squashfs_new_inode(s, inodeb)) == NULL) -+ goto failed_read1; -+ -+ i->i_nlink = inodep->nlink; -+ i->i_size = inodep->symlink_size; -+ i->i_op = &page_symlink_inode_operations; -+ i->i_data.a_ops = &squashfs_symlink_aops; -+ i->i_mode |= S_IFLNK; -+ SQUASHFS_I(i)->start_block = next_block; -+ SQUASHFS_I(i)->offset = next_offset; -+ -+ TRACE("Symbolic link inode %x:%x, start_block %llx, " -+ "offset %x\n", -+ SQUASHFS_INODE_BLK(inode), offset, -+ next_block, next_offset); -+ break; -+ } -+ case SQUASHFS_BLKDEV_TYPE: -+ case SQUASHFS_CHRDEV_TYPE: { -+ struct squashfs_dev_inode_header *inodep = &id.dev; -+ struct squashfs_dev_inode_header *sinodep = &sid.dev; -+ -+ if (msblk->swap) { -+ if (!squashfs_get_cached_block(s, (char *) -+ sinodep, block, offset, -+ sizeof(*sinodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ SQUASHFS_SWAP_DEV_INODE_HEADER(inodep, sinodep); -+ } else -+ if (!squashfs_get_cached_block(s, (char *) -+ inodep, block, offset, -+ sizeof(*inodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ if ((i = squashfs_new_inode(s, inodeb)) == NULL) -+ goto failed_read1; -+ -+ i->i_nlink = inodep->nlink; -+ i->i_mode |= (inodeb->inode_type == -+ SQUASHFS_CHRDEV_TYPE) ? S_IFCHR : -+ S_IFBLK; -+ init_special_inode(i, i->i_mode, -+ old_decode_dev(inodep->rdev)); -+ -+ TRACE("Device inode %x:%x, rdev %x\n", -+ SQUASHFS_INODE_BLK(inode), offset, -+ inodep->rdev); -+ break; -+ } -+ case SQUASHFS_FIFO_TYPE: -+ case SQUASHFS_SOCKET_TYPE: { -+ struct squashfs_ipc_inode_header *inodep = &id.ipc; -+ struct squashfs_ipc_inode_header *sinodep = &sid.ipc; -+ -+ if (msblk->swap) { -+ if (!squashfs_get_cached_block(s, (char *) -+ sinodep, block, offset, -+ sizeof(*sinodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ SQUASHFS_SWAP_IPC_INODE_HEADER(inodep, sinodep); -+ } else -+ if (!squashfs_get_cached_block(s, (char *) -+ inodep, block, offset, -+ sizeof(*inodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ if ((i = squashfs_new_inode(s, inodeb)) == NULL) -+ goto failed_read1; -+ -+ i->i_nlink = inodep->nlink; -+ i->i_mode |= (inodeb->inode_type == SQUASHFS_FIFO_TYPE) -+ ? S_IFIFO : S_IFSOCK; -+ init_special_inode(i, i->i_mode, 0); -+ break; -+ } -+ default: -+ ERROR("Unknown inode type %d in squashfs_iget!\n", -+ inodeb->inode_type); -+ goto failed_read1; -+ } -+ -+ insert_inode_hash(i); -+ return i; -+ -+failed_read: -+ ERROR("Unable to read inode [%llx:%x]\n", block, offset); -+ -+failed_read1: -+ return NULL; -+} -+ -+ -+static int read_fragment_index_table(struct super_block *s) -+{ -+ struct squashfs_sb_info *msblk = s->s_fs_info; -+ struct squashfs_super_block *sblk = &msblk->sblk; -+ -+ /* Allocate fragment index table */ -+ if (!(msblk->fragment_index = kmalloc(SQUASHFS_FRAGMENT_INDEX_BYTES -+ (sblk->fragments), GFP_KERNEL))) { -+ ERROR("Failed to allocate uid/gid table\n"); -+ return 0; -+ } -+ -+ if (SQUASHFS_FRAGMENT_INDEX_BYTES(sblk->fragments) && -+ !squashfs_read_data(s, (char *) -+ msblk->fragment_index, -+ sblk->fragment_table_start, -+ SQUASHFS_FRAGMENT_INDEX_BYTES -+ (sblk->fragments) | -+ SQUASHFS_COMPRESSED_BIT_BLOCK, NULL)) { -+ ERROR("unable to read fragment index table\n"); -+ return 0; -+ } -+ -+ if (msblk->swap) { -+ int i; -+ long long fragment; -+ -+ for (i = 0; i < SQUASHFS_FRAGMENT_INDEXES(sblk->fragments); -+ i++) { -+ SQUASHFS_SWAP_FRAGMENT_INDEXES((&fragment), -+ &msblk->fragment_index[i], 1); -+ msblk->fragment_index[i] = fragment; -+ } -+ } -+ -+ return 1; -+} -+ -+ -+static int supported_squashfs_filesystem(struct squashfs_sb_info *msblk, int silent) -+{ -+ struct squashfs_super_block *sblk = &msblk->sblk; -+ -+ msblk->iget = squashfs_iget; -+ msblk->read_blocklist = read_blocklist; -+ msblk->read_fragment_index_table = read_fragment_index_table; -+ -+ if (sblk->s_major == 1) { -+ if (!squashfs_1_0_supported(msblk)) { -+ SERROR("Major/Minor mismatch, Squashfs 1.0 filesystems " -+ "are unsupported\n"); -+ SERROR("Please recompile with " -+ "Squashfs 1.0 support enabled\n"); -+ return 0; -+ } -+ } else if (sblk->s_major == 2) { -+ if (!squashfs_2_0_supported(msblk)) { -+ SERROR("Major/Minor mismatch, Squashfs 2.0 filesystems " -+ "are unsupported\n"); -+ SERROR("Please recompile with " -+ "Squashfs 2.0 support enabled\n"); -+ return 0; -+ } -+ } else if(sblk->s_major != SQUASHFS_MAJOR || sblk->s_minor > -+ SQUASHFS_MINOR) { -+ SERROR("Major/Minor mismatch, trying to mount newer %d.%d " -+ "filesystem\n", sblk->s_major, sblk->s_minor); -+ SERROR("Please update your kernel\n"); -+ return 0; -+ } -+ -+ return 1; -+} -+ -+ -+static int squashfs_fill_super(struct super_block *s, void *data, int silent) -+{ -+ struct squashfs_sb_info *msblk; -+ struct squashfs_super_block *sblk; -+ int i; -+ char b[BDEVNAME_SIZE]; -+ struct inode *root; -+ -+ TRACE("Entered squashfs_read_superblock\n"); -+ -+ if (!(s->s_fs_info = kmalloc(sizeof(struct squashfs_sb_info), -+ GFP_KERNEL))) { -+ ERROR("Failed to allocate superblock\n"); -+ goto failure; -+ } -+ memset(s->s_fs_info, 0, sizeof(struct squashfs_sb_info)); -+ msblk = s->s_fs_info; -+ sblk = &msblk->sblk; -+ -+ msblk->devblksize = sb_min_blocksize(s, BLOCK_SIZE); -+ msblk->devblksize_log2 = ffz(~msblk->devblksize); -+ -+ init_MUTEX(&msblk->read_data_mutex); -+ init_MUTEX(&msblk->read_page_mutex); -+ init_MUTEX(&msblk->block_cache_mutex); -+ init_MUTEX(&msblk->fragment_mutex); -+ init_MUTEX(&msblk->meta_index_mutex); -+ -+ init_waitqueue_head(&msblk->waitq); -+ init_waitqueue_head(&msblk->fragment_wait_queue); -+ -+ if (!squashfs_read_data(s, (char *) sblk, SQUASHFS_START, -+ sizeof(struct squashfs_super_block) | -+ SQUASHFS_COMPRESSED_BIT_BLOCK, NULL)) { -+ SERROR("unable to read superblock\n"); -+ goto failed_mount; -+ } -+ -+ /* Check it is a SQUASHFS superblock */ -+ msblk->swap = 0; -+ if ((s->s_magic = sblk->s_magic) != SQUASHFS_MAGIC) { -+ if (sblk->s_magic == SQUASHFS_MAGIC_SWAP) { -+ struct squashfs_super_block ssblk; -+ -+ WARNING("Mounting a different endian SQUASHFS " -+ "filesystem on %s\n", bdevname(s->s_bdev, b)); -+ -+ SQUASHFS_SWAP_SUPER_BLOCK(&ssblk, sblk); -+ memcpy(sblk, &ssblk, sizeof(struct squashfs_super_block)); -+ msblk->swap = 1; -+ } else { -+ SERROR("Can't find a SQUASHFS superblock on %s\n", -+ bdevname(s->s_bdev, b)); -+ goto failed_mount; -+ } -+ } -+ -+ /* Check the MAJOR & MINOR versions */ -+ if(!supported_squashfs_filesystem(msblk, silent)) -+ goto failed_mount; -+ -+ TRACE("Found valid superblock on %s\n", bdevname(s->s_bdev, b)); -+ TRACE("Inodes are %scompressed\n", -+ SQUASHFS_UNCOMPRESSED_INODES -+ (sblk->flags) ? "un" : ""); -+ TRACE("Data is %scompressed\n", -+ SQUASHFS_UNCOMPRESSED_DATA(sblk->flags) -+ ? "un" : ""); -+ TRACE("Check data is %s present in the filesystem\n", -+ SQUASHFS_CHECK_DATA(sblk->flags) ? -+ "" : "not"); -+ TRACE("Filesystem size %lld bytes\n", sblk->bytes_used); -+ TRACE("Block size %d\n", sblk->block_size); -+ TRACE("Number of inodes %d\n", sblk->inodes); -+ if (sblk->s_major > 1) -+ TRACE("Number of fragments %d\n", sblk->fragments); -+ TRACE("Number of uids %d\n", sblk->no_uids); -+ TRACE("Number of gids %d\n", sblk->no_guids); -+ TRACE("sblk->inode_table_start %llx\n", sblk->inode_table_start); -+ TRACE("sblk->directory_table_start %llx\n", sblk->directory_table_start); -+ if (sblk->s_major > 1) -+ TRACE("sblk->fragment_table_start %llx\n", -+ sblk->fragment_table_start); -+ TRACE("sblk->uid_start %llx\n", sblk->uid_start); -+ -+ s->s_flags |= MS_RDONLY; -+ s->s_op = &squashfs_ops; -+ -+ /* Init inode_table block pointer array */ -+ if (!(msblk->block_cache = kmalloc(sizeof(struct squashfs_cache) * -+ SQUASHFS_CACHED_BLKS, GFP_KERNEL))) { -+ ERROR("Failed to allocate block cache\n"); -+ goto failed_mount; -+ } -+ -+ for (i = 0; i < SQUASHFS_CACHED_BLKS; i++) -+ msblk->block_cache[i].block = SQUASHFS_INVALID_BLK; -+ -+ msblk->next_cache = 0; -+ -+ /* Allocate read_data block */ -+ msblk->read_size = (sblk->block_size < SQUASHFS_METADATA_SIZE) ? -+ SQUASHFS_METADATA_SIZE : -+ sblk->block_size; -+ -+ if (!(msblk->read_data = kmalloc(msblk->read_size, GFP_KERNEL))) { -+ ERROR("Failed to allocate read_data block\n"); -+ goto failed_mount; -+ } -+ -+ /* Allocate read_page block */ -+ if (!(msblk->read_page = kmalloc(sblk->block_size, GFP_KERNEL))) { -+ ERROR("Failed to allocate read_page block\n"); -+ goto failed_mount; -+ } -+ -+ /* Allocate uid and gid tables */ -+ if (!(msblk->uid = kmalloc((sblk->no_uids + sblk->no_guids) * -+ sizeof(unsigned int), GFP_KERNEL))) { -+ ERROR("Failed to allocate uid/gid table\n"); -+ goto failed_mount; -+ } -+ msblk->guid = msblk->uid + sblk->no_uids; -+ -+ if (msblk->swap) { -+ unsigned int suid[sblk->no_uids + sblk->no_guids]; -+ -+ if (!squashfs_read_data(s, (char *) &suid, sblk->uid_start, -+ ((sblk->no_uids + sblk->no_guids) * -+ sizeof(unsigned int)) | -+ SQUASHFS_COMPRESSED_BIT_BLOCK, NULL)) { -+ ERROR("unable to read uid/gid table\n"); -+ goto failed_mount; -+ } -+ -+ SQUASHFS_SWAP_DATA(msblk->uid, suid, (sblk->no_uids + -+ sblk->no_guids), (sizeof(unsigned int) * 8)); -+ } else -+ if (!squashfs_read_data(s, (char *) msblk->uid, sblk->uid_start, -+ ((sblk->no_uids + sblk->no_guids) * -+ sizeof(unsigned int)) | -+ SQUASHFS_COMPRESSED_BIT_BLOCK, NULL)) { -+ ERROR("unable to read uid/gid table\n"); -+ goto failed_mount; -+ } -+ -+ -+ if (sblk->s_major == 1 && squashfs_1_0_supported(msblk)) -+ goto allocate_root; -+ -+ if (!(msblk->fragment = kmalloc(sizeof(struct squashfs_fragment_cache) * -+ SQUASHFS_CACHED_FRAGMENTS, GFP_KERNEL))) { -+ ERROR("Failed to allocate fragment block cache\n"); -+ goto failed_mount; -+ } -+ -+ for (i = 0; i < SQUASHFS_CACHED_FRAGMENTS; i++) { -+ msblk->fragment[i].locked = 0; -+ msblk->fragment[i].block = SQUASHFS_INVALID_BLK; -+ msblk->fragment[i].data = NULL; -+ } -+ -+ msblk->next_fragment = 0; -+ -+ /* Allocate fragment index table */ -+ if (msblk->read_fragment_index_table(s) == 0) -+ goto failed_mount; -+ -+allocate_root: -+ if ((root = (msblk->iget)(s, sblk->root_inode)) == NULL) -+ goto failed_mount; -+ -+ if ((s->s_root = d_alloc_root(root)) == NULL) { -+ ERROR("Root inode create failed\n"); -+ iput(root); -+ goto failed_mount; -+ } -+ -+ TRACE("Leaving squashfs_read_super\n"); -+ return 0; -+ -+failed_mount: -+ kfree(msblk->fragment_index); -+ kfree(msblk->fragment); -+ kfree(msblk->uid); -+ kfree(msblk->read_page); -+ kfree(msblk->read_data); -+ kfree(msblk->block_cache); -+ kfree(msblk->fragment_index_2); -+ kfree(s->s_fs_info); -+ s->s_fs_info = NULL; -+ return -EINVAL; -+ -+failure: -+ return -ENOMEM; -+} -+ -+ -+static int squashfs_statfs(struct dentry *dentry, struct kstatfs *buf) -+{ -+ struct squashfs_sb_info *msblk = dentry->d_inode->i_sb->s_fs_info; -+ struct squashfs_super_block *sblk = &msblk->sblk; -+ -+ TRACE("Entered squashfs_statfs\n"); -+ -+ buf->f_type = SQUASHFS_MAGIC; -+ buf->f_bsize = sblk->block_size; -+ buf->f_blocks = ((sblk->bytes_used - 1) >> sblk->block_log) + 1; -+ buf->f_bfree = buf->f_bavail = 0; -+ buf->f_files = sblk->inodes; -+ buf->f_ffree = 0; -+ buf->f_namelen = SQUASHFS_NAME_LEN; -+ -+ return 0; -+} -+ -+ -+static int squashfs_symlink_readpage(struct file *file, struct page *page) -+{ -+ struct inode *inode = page->mapping->host; -+ int index = page->index << PAGE_CACHE_SHIFT, length, bytes; -+ long long block = SQUASHFS_I(inode)->start_block; -+ int offset = SQUASHFS_I(inode)->offset; -+ void *pageaddr = kmap(page); -+ -+ TRACE("Entered squashfs_symlink_readpage, page index %ld, start block " -+ "%llx, offset %x\n", page->index, -+ SQUASHFS_I(inode)->start_block, -+ SQUASHFS_I(inode)->offset); -+ -+ for (length = 0; length < index; length += bytes) { -+ if (!(bytes = squashfs_get_cached_block(inode->i_sb, NULL, -+ block, offset, PAGE_CACHE_SIZE, &block, -+ &offset))) { -+ ERROR("Unable to read symbolic link [%llx:%x]\n", block, -+ offset); -+ goto skip_read; -+ } -+ } -+ -+ if (length != index) { -+ ERROR("(squashfs_symlink_readpage) length != index\n"); -+ bytes = 0; -+ goto skip_read; -+ } -+ -+ bytes = (i_size_read(inode) - length) > PAGE_CACHE_SIZE ? PAGE_CACHE_SIZE : -+ i_size_read(inode) - length; -+ -+ if (!(bytes = squashfs_get_cached_block(inode->i_sb, pageaddr, block, -+ offset, bytes, &block, &offset))) -+ ERROR("Unable to read symbolic link [%llx:%x]\n", block, offset); -+ -+skip_read: -+ memset(pageaddr + bytes, 0, PAGE_CACHE_SIZE - bytes); -+ kunmap(page); -+ SetPageUptodate(page); -+ unlock_page(page); -+ -+ return 0; -+} -+ -+ -+struct meta_index *locate_meta_index(struct inode *inode, int index, int offset) -+{ -+ struct meta_index *meta = NULL; -+ struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info; -+ int i; -+ -+ down(&msblk->meta_index_mutex); -+ -+ TRACE("locate_meta_index: index %d, offset %d\n", index, offset); -+ -+ if(msblk->meta_index == NULL) -+ goto not_allocated; -+ -+ for (i = 0; i < SQUASHFS_META_NUMBER; i ++) -+ if (msblk->meta_index[i].inode_number == inode->i_ino && -+ msblk->meta_index[i].offset >= offset && -+ msblk->meta_index[i].offset <= index && -+ msblk->meta_index[i].locked == 0) { -+ TRACE("locate_meta_index: entry %d, offset %d\n", i, -+ msblk->meta_index[i].offset); -+ meta = &msblk->meta_index[i]; -+ offset = meta->offset; -+ } -+ -+ if (meta) -+ meta->locked = 1; -+ -+not_allocated: -+ up(&msblk->meta_index_mutex); -+ -+ return meta; -+} -+ -+ -+struct meta_index *empty_meta_index(struct inode *inode, int offset, int skip) -+{ -+ struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info; -+ struct meta_index *meta = NULL; -+ int i; -+ -+ down(&msblk->meta_index_mutex); -+ -+ TRACE("empty_meta_index: offset %d, skip %d\n", offset, skip); -+ -+ if(msblk->meta_index == NULL) { -+ if (!(msblk->meta_index = kmalloc(sizeof(struct meta_index) * -+ SQUASHFS_META_NUMBER, GFP_KERNEL))) { -+ ERROR("Failed to allocate meta_index\n"); -+ goto failed; -+ } -+ for(i = 0; i < SQUASHFS_META_NUMBER; i++) { -+ msblk->meta_index[i].inode_number = 0; -+ msblk->meta_index[i].locked = 0; -+ } -+ msblk->next_meta_index = 0; -+ } -+ -+ for(i = SQUASHFS_META_NUMBER; i && -+ msblk->meta_index[msblk->next_meta_index].locked; i --) -+ msblk->next_meta_index = (msblk->next_meta_index + 1) % -+ SQUASHFS_META_NUMBER; -+ -+ if(i == 0) { -+ TRACE("empty_meta_index: failed!\n"); -+ goto failed; -+ } -+ -+ TRACE("empty_meta_index: returned meta entry %d, %p\n", -+ msblk->next_meta_index, -+ &msblk->meta_index[msblk->next_meta_index]); -+ -+ meta = &msblk->meta_index[msblk->next_meta_index]; -+ msblk->next_meta_index = (msblk->next_meta_index + 1) % -+ SQUASHFS_META_NUMBER; -+ -+ meta->inode_number = inode->i_ino; -+ meta->offset = offset; -+ meta->skip = skip; -+ meta->entries = 0; -+ meta->locked = 1; -+ -+failed: -+ up(&msblk->meta_index_mutex); -+ return meta; -+} -+ -+ -+void release_meta_index(struct inode *inode, struct meta_index *meta) -+{ -+ meta->locked = 0; -+} -+ -+ -+static int read_block_index(struct super_block *s, int blocks, char *block_list, -+ long long *start_block, int *offset) -+{ -+ struct squashfs_sb_info *msblk = s->s_fs_info; -+ unsigned int *block_listp; -+ int block = 0; -+ -+ if (msblk->swap) { -+ char sblock_list[blocks << 2]; -+ -+ if (!squashfs_get_cached_block(s, sblock_list, *start_block, -+ *offset, blocks << 2, start_block, offset)) { -+ ERROR("Unable to read block list [%llx:%x]\n", -+ *start_block, *offset); -+ goto failure; -+ } -+ SQUASHFS_SWAP_INTS(((unsigned int *)block_list), -+ ((unsigned int *)sblock_list), blocks); -+ } else -+ if (!squashfs_get_cached_block(s, block_list, *start_block, -+ *offset, blocks << 2, start_block, offset)) { -+ ERROR("Unable to read block list [%llx:%x]\n", -+ *start_block, *offset); -+ goto failure; -+ } -+ -+ for (block_listp = (unsigned int *) block_list; blocks; -+ block_listp++, blocks --) -+ block += SQUASHFS_COMPRESSED_SIZE_BLOCK(*block_listp); -+ -+ return block; -+ -+failure: -+ return -1; -+} -+ -+ -+#define SIZE 256 -+ -+static inline int calculate_skip(int blocks) { -+ int skip = (blocks - 1) / ((SQUASHFS_SLOTS * SQUASHFS_META_ENTRIES + 1) * SQUASHFS_META_INDEXES); -+ return skip >= 7 ? 7 : skip + 1; -+} -+ -+ -+static int get_meta_index(struct inode *inode, int index, -+ long long *index_block, int *index_offset, -+ long long *data_block, char *block_list) -+{ -+ struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info; -+ struct squashfs_super_block *sblk = &msblk->sblk; -+ int skip = calculate_skip(i_size_read(inode) >> sblk->block_log); -+ int offset = 0; -+ struct meta_index *meta; -+ struct meta_entry *meta_entry; -+ long long cur_index_block = SQUASHFS_I(inode)->u.s1.block_list_start; -+ int cur_offset = SQUASHFS_I(inode)->offset; -+ long long cur_data_block = SQUASHFS_I(inode)->start_block; -+ int i; -+ -+ index /= SQUASHFS_META_INDEXES * skip; -+ -+ while ( offset < index ) { -+ meta = locate_meta_index(inode, index, offset + 1); -+ -+ if (meta == NULL) { -+ if ((meta = empty_meta_index(inode, offset + 1, -+ skip)) == NULL) -+ goto all_done; -+ } else { -+ offset = index < meta->offset + meta->entries ? index : -+ meta->offset + meta->entries - 1; -+ meta_entry = &meta->meta_entry[offset - meta->offset]; -+ cur_index_block = meta_entry->index_block + sblk->inode_table_start; -+ cur_offset = meta_entry->offset; -+ cur_data_block = meta_entry->data_block; -+ TRACE("get_meta_index: offset %d, meta->offset %d, " -+ "meta->entries %d\n", offset, meta->offset, -+ meta->entries); -+ TRACE("get_meta_index: index_block 0x%llx, offset 0x%x" -+ " data_block 0x%llx\n", cur_index_block, -+ cur_offset, cur_data_block); -+ } -+ -+ for (i = meta->offset + meta->entries; i <= index && -+ i < meta->offset + SQUASHFS_META_ENTRIES; i++) { -+ int blocks = skip * SQUASHFS_META_INDEXES; -+ -+ while (blocks) { -+ int block = blocks > (SIZE >> 2) ? (SIZE >> 2) : -+ blocks; -+ int res = read_block_index(inode->i_sb, block, -+ block_list, &cur_index_block, -+ &cur_offset); -+ -+ if (res == -1) -+ goto failed; -+ -+ cur_data_block += res; -+ blocks -= block; -+ } -+ -+ meta_entry = &meta->meta_entry[i - meta->offset]; -+ meta_entry->index_block = cur_index_block - sblk->inode_table_start; -+ meta_entry->offset = cur_offset; -+ meta_entry->data_block = cur_data_block; -+ meta->entries ++; -+ offset ++; -+ } -+ -+ TRACE("get_meta_index: meta->offset %d, meta->entries %d\n", -+ meta->offset, meta->entries); -+ -+ release_meta_index(inode, meta); -+ } -+ -+all_done: -+ *index_block = cur_index_block; -+ *index_offset = cur_offset; -+ *data_block = cur_data_block; -+ -+ return offset * SQUASHFS_META_INDEXES * skip; -+ -+failed: -+ release_meta_index(inode, meta); -+ return -1; -+} -+ -+ -+static long long read_blocklist(struct inode *inode, int index, -+ int readahead_blks, char *block_list, -+ unsigned short **block_p, unsigned int *bsize) -+{ -+ long long block_ptr; -+ int offset; -+ long long block; -+ int res = get_meta_index(inode, index, &block_ptr, &offset, &block, -+ block_list); -+ -+ TRACE("read_blocklist: res %d, index %d, block_ptr 0x%llx, offset" -+ " 0x%x, block 0x%llx\n", res, index, block_ptr, offset, -+ block); -+ -+ if(res == -1) -+ goto failure; -+ -+ index -= res; -+ -+ while ( index ) { -+ int blocks = index > (SIZE >> 2) ? (SIZE >> 2) : index; -+ int res = read_block_index(inode->i_sb, blocks, block_list, -+ &block_ptr, &offset); -+ if (res == -1) -+ goto failure; -+ block += res; -+ index -= blocks; -+ } -+ -+ if (read_block_index(inode->i_sb, 1, block_list, -+ &block_ptr, &offset) == -1) -+ goto failure; -+ *bsize = *((unsigned int *) block_list); -+ -+ return block; -+ -+failure: -+ return 0; -+} -+ -+ -+static int squashfs_readpage(struct file *file, struct page *page) -+{ -+ struct inode *inode = page->mapping->host; -+ struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info; -+ struct squashfs_super_block *sblk = &msblk->sblk; -+ unsigned char block_list[SIZE]; -+ long long block; -+ unsigned int bsize, i = 0, bytes = 0, byte_offset = 0; -+ int index = page->index >> (sblk->block_log - PAGE_CACHE_SHIFT); -+ void *pageaddr; -+ struct squashfs_fragment_cache *fragment = NULL; -+ char *data_ptr = msblk->read_page; -+ -+ int mask = (1 << (sblk->block_log - PAGE_CACHE_SHIFT)) - 1; -+ int start_index = page->index & ~mask; -+ int end_index = start_index | mask; -+ -+ TRACE("Entered squashfs_readpage, page index %lx, start block %llx\n", -+ page->index, -+ SQUASHFS_I(inode)->start_block); -+ -+ if (page->index >= ((i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> -+ PAGE_CACHE_SHIFT)) -+ goto skip_read; -+ -+ if (SQUASHFS_I(inode)->u.s1.fragment_start_block == SQUASHFS_INVALID_BLK -+ || index < (i_size_read(inode) >> -+ sblk->block_log)) { -+ if ((block = (msblk->read_blocklist)(inode, index, 1, -+ block_list, NULL, &bsize)) == 0) -+ goto skip_read; -+ -+ down(&msblk->read_page_mutex); -+ -+ if (!(bytes = squashfs_read_data(inode->i_sb, msblk->read_page, -+ block, bsize, NULL))) { -+ ERROR("Unable to read page, block %llx, size %x\n", block, -+ bsize); -+ up(&msblk->read_page_mutex); -+ goto skip_read; -+ } -+ } else { -+ if ((fragment = get_cached_fragment(inode->i_sb, -+ SQUASHFS_I(inode)-> -+ u.s1.fragment_start_block, -+ SQUASHFS_I(inode)->u.s1.fragment_size)) -+ == NULL) { -+ ERROR("Unable to read page, block %llx, size %x\n", -+ SQUASHFS_I(inode)-> -+ u.s1.fragment_start_block, -+ (int) SQUASHFS_I(inode)-> -+ u.s1.fragment_size); -+ goto skip_read; -+ } -+ bytes = SQUASHFS_I(inode)->u.s1.fragment_offset + -+ (i_size_read(inode) & (sblk->block_size -+ - 1)); -+ byte_offset = SQUASHFS_I(inode)->u.s1.fragment_offset; -+ data_ptr = fragment->data; -+ } -+ -+ for (i = start_index; i <= end_index && byte_offset < bytes; -+ i++, byte_offset += PAGE_CACHE_SIZE) { -+ struct page *push_page; -+ int available_bytes = (bytes - byte_offset) > PAGE_CACHE_SIZE ? -+ PAGE_CACHE_SIZE : bytes - byte_offset; -+ -+ TRACE("bytes %d, i %d, byte_offset %d, available_bytes %d\n", -+ bytes, i, byte_offset, available_bytes); -+ -+ if (i == page->index) { -+ pageaddr = kmap_atomic(page, KM_USER0); -+ memcpy(pageaddr, data_ptr + byte_offset, -+ available_bytes); -+ memset(pageaddr + available_bytes, 0, -+ PAGE_CACHE_SIZE - available_bytes); -+ kunmap_atomic(pageaddr, KM_USER0); -+ flush_dcache_page(page); -+ SetPageUptodate(page); -+ unlock_page(page); -+ } else if ((push_page = -+ grab_cache_page_nowait(page->mapping, i))) { -+ pageaddr = kmap_atomic(push_page, KM_USER0); -+ -+ memcpy(pageaddr, data_ptr + byte_offset, -+ available_bytes); -+ memset(pageaddr + available_bytes, 0, -+ PAGE_CACHE_SIZE - available_bytes); -+ kunmap_atomic(pageaddr, KM_USER0); -+ flush_dcache_page(push_page); -+ SetPageUptodate(push_page); -+ unlock_page(push_page); -+ page_cache_release(push_page); -+ } -+ } -+ -+ if (SQUASHFS_I(inode)->u.s1.fragment_start_block == SQUASHFS_INVALID_BLK -+ || index < (i_size_read(inode) >> -+ sblk->block_log)) -+ up(&msblk->read_page_mutex); -+ else -+ release_cached_fragment(msblk, fragment); -+ -+ return 0; -+ -+skip_read: -+ pageaddr = kmap_atomic(page, KM_USER0); -+ memset(pageaddr + bytes, 0, PAGE_CACHE_SIZE - bytes); -+ kunmap_atomic(pageaddr, KM_USER0); -+ flush_dcache_page(page); -+ SetPageUptodate(page); -+ unlock_page(page); -+ -+ return 0; -+} -+ -+ -+static int squashfs_readpage4K(struct file *file, struct page *page) -+{ -+ struct inode *inode = page->mapping->host; -+ struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info; -+ struct squashfs_super_block *sblk = &msblk->sblk; -+ unsigned char block_list[SIZE]; -+ long long block; -+ unsigned int bsize, bytes = 0; -+ void *pageaddr; -+ -+ TRACE("Entered squashfs_readpage4K, page index %lx, start block %llx\n", -+ page->index, -+ SQUASHFS_I(inode)->start_block); -+ -+ if (page->index >= ((i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> -+ PAGE_CACHE_SHIFT)) { -+ pageaddr = kmap_atomic(page, KM_USER0); -+ goto skip_read; -+ } -+ -+ if (SQUASHFS_I(inode)->u.s1.fragment_start_block == SQUASHFS_INVALID_BLK -+ || page->index < (i_size_read(inode) >> -+ sblk->block_log)) { -+ block = (msblk->read_blocklist)(inode, page->index, 1, -+ block_list, NULL, &bsize); -+ -+ down(&msblk->read_page_mutex); -+ bytes = squashfs_read_data(inode->i_sb, msblk->read_page, block, -+ bsize, NULL); -+ pageaddr = kmap_atomic(page, KM_USER0); -+ if (bytes) -+ memcpy(pageaddr, msblk->read_page, bytes); -+ else -+ ERROR("Unable to read page, block %llx, size %x\n", -+ block, bsize); -+ up(&msblk->read_page_mutex); -+ } else { -+ struct squashfs_fragment_cache *fragment = -+ get_cached_fragment(inode->i_sb, -+ SQUASHFS_I(inode)-> -+ u.s1.fragment_start_block, -+ SQUASHFS_I(inode)-> u.s1.fragment_size); -+ pageaddr = kmap_atomic(page, KM_USER0); -+ if (fragment) { -+ bytes = i_size_read(inode) & (sblk->block_size - 1); -+ memcpy(pageaddr, fragment->data + SQUASHFS_I(inode)-> -+ u.s1.fragment_offset, bytes); -+ release_cached_fragment(msblk, fragment); -+ } else -+ ERROR("Unable to read page, block %llx, size %x\n", -+ SQUASHFS_I(inode)-> -+ u.s1.fragment_start_block, (int) -+ SQUASHFS_I(inode)-> u.s1.fragment_size); -+ } -+ -+skip_read: -+ memset(pageaddr + bytes, 0, PAGE_CACHE_SIZE - bytes); -+ kunmap_atomic(pageaddr, KM_USER0); -+ flush_dcache_page(page); -+ SetPageUptodate(page); -+ unlock_page(page); -+ -+ return 0; -+} -+ -+ -+static int get_dir_index_using_offset(struct super_block *s, long long -+ *next_block, unsigned int *next_offset, -+ long long index_start, -+ unsigned int index_offset, int i_count, -+ long long f_pos) -+{ -+ struct squashfs_sb_info *msblk = s->s_fs_info; -+ struct squashfs_super_block *sblk = &msblk->sblk; -+ int i, length = 0; -+ struct squashfs_dir_index index; -+ -+ TRACE("Entered get_dir_index_using_offset, i_count %d, f_pos %d\n", -+ i_count, (unsigned int) f_pos); -+ -+ f_pos =- 3; -+ if (f_pos == 0) -+ goto finish; -+ -+ for (i = 0; i < i_count; i++) { -+ if (msblk->swap) { -+ struct squashfs_dir_index sindex; -+ squashfs_get_cached_block(s, (char *) &sindex, -+ index_start, index_offset, -+ sizeof(sindex), &index_start, -+ &index_offset); -+ SQUASHFS_SWAP_DIR_INDEX(&index, &sindex); -+ } else -+ squashfs_get_cached_block(s, (char *) &index, -+ index_start, index_offset, -+ sizeof(index), &index_start, -+ &index_offset); -+ -+ if (index.index > f_pos) -+ break; -+ -+ squashfs_get_cached_block(s, NULL, index_start, index_offset, -+ index.size + 1, &index_start, -+ &index_offset); -+ -+ length = index.index; -+ *next_block = index.start_block + sblk->directory_table_start; -+ } -+ -+ *next_offset = (length + *next_offset) % SQUASHFS_METADATA_SIZE; -+ -+finish: -+ return length + 3; -+} -+ -+ -+static int get_dir_index_using_name(struct super_block *s, long long -+ *next_block, unsigned int *next_offset, -+ long long index_start, -+ unsigned int index_offset, int i_count, -+ const char *name, int size) -+{ -+ struct squashfs_sb_info *msblk = s->s_fs_info; -+ struct squashfs_super_block *sblk = &msblk->sblk; -+ int i, length = 0; -+ char buffer[sizeof(struct squashfs_dir_index) + SQUASHFS_NAME_LEN + 1]; -+ struct squashfs_dir_index *index = (struct squashfs_dir_index *) buffer; -+ char str[SQUASHFS_NAME_LEN + 1]; -+ -+ TRACE("Entered get_dir_index_using_name, i_count %d\n", i_count); -+ -+ strncpy(str, name, size); -+ str[size] = '\0'; -+ -+ for (i = 0; i < i_count; i++) { -+ if (msblk->swap) { -+ struct squashfs_dir_index sindex; -+ squashfs_get_cached_block(s, (char *) &sindex, -+ index_start, index_offset, -+ sizeof(sindex), &index_start, -+ &index_offset); -+ SQUASHFS_SWAP_DIR_INDEX(index, &sindex); -+ } else -+ squashfs_get_cached_block(s, (char *) index, -+ index_start, index_offset, -+ sizeof(struct squashfs_dir_index), -+ &index_start, &index_offset); -+ -+ squashfs_get_cached_block(s, index->name, index_start, -+ index_offset, index->size + 1, -+ &index_start, &index_offset); -+ -+ index->name[index->size + 1] = '\0'; -+ -+ if (strcmp(index->name, str) > 0) -+ break; -+ -+ length = index->index; -+ *next_block = index->start_block + sblk->directory_table_start; -+ } -+ -+ *next_offset = (length + *next_offset) % SQUASHFS_METADATA_SIZE; -+ return length + 3; -+} -+ -+ -+static int squashfs_readdir(struct file *file, void *dirent, filldir_t filldir) -+{ -+ struct inode *i = file->f_dentry->d_inode; -+ struct squashfs_sb_info *msblk = i->i_sb->s_fs_info; -+ struct squashfs_super_block *sblk = &msblk->sblk; -+ long long next_block = SQUASHFS_I(i)->start_block + -+ sblk->directory_table_start; -+ int next_offset = SQUASHFS_I(i)->offset, length = 0, dirs_read = 0, -+ dir_count; -+ struct squashfs_dir_header dirh; -+ char buffer[sizeof(struct squashfs_dir_entry) + SQUASHFS_NAME_LEN + 1]; -+ struct squashfs_dir_entry *dire = (struct squashfs_dir_entry *) buffer; -+ -+ TRACE("Entered squashfs_readdir [%llx:%x]\n", next_block, next_offset); -+ -+ while(file->f_pos < 3) { -+ char *name; -+ int size, i_ino; -+ -+ if(file->f_pos == 0) { -+ name = "."; -+ size = 1; -+ i_ino = i->i_ino; -+ } else { -+ name = ".."; -+ size = 2; -+ i_ino = SQUASHFS_I(i)->u.s2.parent_inode; -+ } -+ TRACE("Calling filldir(%x, %s, %d, %d, %d, %d)\n", -+ (unsigned int) dirent, name, size, (int) -+ file->f_pos, i_ino, -+ squashfs_filetype_table[1]); -+ -+ if (filldir(dirent, name, size, -+ file->f_pos, i_ino, -+ squashfs_filetype_table[1]) < 0) { -+ TRACE("Filldir returned less than 0\n"); -+ goto finish; -+ } -+ file->f_pos += size; -+ dirs_read++; -+ } -+ -+ length = get_dir_index_using_offset(i->i_sb, &next_block, &next_offset, -+ SQUASHFS_I(i)->u.s2.directory_index_start, -+ SQUASHFS_I(i)->u.s2.directory_index_offset, -+ SQUASHFS_I(i)->u.s2.directory_index_count, -+ file->f_pos); -+ -+ while (length < i_size_read(i)) { -+ /* read directory header */ -+ if (msblk->swap) { -+ struct squashfs_dir_header sdirh; -+ -+ if (!squashfs_get_cached_block(i->i_sb, (char *) &sdirh, -+ next_block, next_offset, sizeof(sdirh), -+ &next_block, &next_offset)) -+ goto failed_read; -+ -+ length += sizeof(sdirh); -+ SQUASHFS_SWAP_DIR_HEADER(&dirh, &sdirh); -+ } else { -+ if (!squashfs_get_cached_block(i->i_sb, (char *) &dirh, -+ next_block, next_offset, sizeof(dirh), -+ &next_block, &next_offset)) -+ goto failed_read; -+ -+ length += sizeof(dirh); -+ } -+ -+ dir_count = dirh.count + 1; -+ while (dir_count--) { -+ if (msblk->swap) { -+ struct squashfs_dir_entry sdire; -+ if (!squashfs_get_cached_block(i->i_sb, (char *) -+ &sdire, next_block, next_offset, -+ sizeof(sdire), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ length += sizeof(sdire); -+ SQUASHFS_SWAP_DIR_ENTRY(dire, &sdire); -+ } else { -+ if (!squashfs_get_cached_block(i->i_sb, (char *) -+ dire, next_block, next_offset, -+ sizeof(*dire), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ length += sizeof(*dire); -+ } -+ -+ if (!squashfs_get_cached_block(i->i_sb, dire->name, -+ next_block, next_offset, -+ dire->size + 1, &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ length += dire->size + 1; -+ -+ if (file->f_pos >= length) -+ continue; -+ -+ dire->name[dire->size + 1] = '\0'; -+ -+ TRACE("Calling filldir(%x, %s, %d, %d, %x:%x, %d, %d)\n", -+ (unsigned int) dirent, dire->name, -+ dire->size + 1, (int) file->f_pos, -+ dirh.start_block, dire->offset, -+ dirh.inode_number + dire->inode_number, -+ squashfs_filetype_table[dire->type]); -+ -+ if (filldir(dirent, dire->name, dire->size + 1, -+ file->f_pos, -+ dirh.inode_number + dire->inode_number, -+ squashfs_filetype_table[dire->type]) -+ < 0) { -+ TRACE("Filldir returned less than 0\n"); -+ goto finish; -+ } -+ file->f_pos = length; -+ dirs_read++; -+ } -+ } -+ -+finish: -+ return dirs_read; -+ -+failed_read: -+ ERROR("Unable to read directory block [%llx:%x]\n", next_block, -+ next_offset); -+ return 0; -+} -+ -+ -+static struct dentry *squashfs_lookup(struct inode *i, struct dentry *dentry, -+ struct nameidata *nd) -+{ -+ const unsigned char *name = dentry->d_name.name; -+ int len = dentry->d_name.len; -+ struct inode *inode = NULL; -+ struct squashfs_sb_info *msblk = i->i_sb->s_fs_info; -+ struct squashfs_super_block *sblk = &msblk->sblk; -+ long long next_block = SQUASHFS_I(i)->start_block + -+ sblk->directory_table_start; -+ int next_offset = SQUASHFS_I(i)->offset, length = 0, -+ dir_count; -+ struct squashfs_dir_header dirh; -+ char buffer[sizeof(struct squashfs_dir_entry) + SQUASHFS_NAME_LEN]; -+ struct squashfs_dir_entry *dire = (struct squashfs_dir_entry *) buffer; -+ -+ TRACE("Entered squashfs_lookup [%llx:%x]\n", next_block, next_offset); -+ -+ if (len > SQUASHFS_NAME_LEN) -+ goto exit_loop; -+ -+ length = get_dir_index_using_name(i->i_sb, &next_block, &next_offset, -+ SQUASHFS_I(i)->u.s2.directory_index_start, -+ SQUASHFS_I(i)->u.s2.directory_index_offset, -+ SQUASHFS_I(i)->u.s2.directory_index_count, name, -+ len); -+ -+ while (length < i_size_read(i)) { -+ /* read directory header */ -+ if (msblk->swap) { -+ struct squashfs_dir_header sdirh; -+ if (!squashfs_get_cached_block(i->i_sb, (char *) &sdirh, -+ next_block, next_offset, sizeof(sdirh), -+ &next_block, &next_offset)) -+ goto failed_read; -+ -+ length += sizeof(sdirh); -+ SQUASHFS_SWAP_DIR_HEADER(&dirh, &sdirh); -+ } else { -+ if (!squashfs_get_cached_block(i->i_sb, (char *) &dirh, -+ next_block, next_offset, sizeof(dirh), -+ &next_block, &next_offset)) -+ goto failed_read; -+ -+ length += sizeof(dirh); -+ } -+ -+ dir_count = dirh.count + 1; -+ while (dir_count--) { -+ if (msblk->swap) { -+ struct squashfs_dir_entry sdire; -+ if (!squashfs_get_cached_block(i->i_sb, (char *) -+ &sdire, next_block,next_offset, -+ sizeof(sdire), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ length += sizeof(sdire); -+ SQUASHFS_SWAP_DIR_ENTRY(dire, &sdire); -+ } else { -+ if (!squashfs_get_cached_block(i->i_sb, (char *) -+ dire, next_block,next_offset, -+ sizeof(*dire), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ length += sizeof(*dire); -+ } -+ -+ if (!squashfs_get_cached_block(i->i_sb, dire->name, -+ next_block, next_offset, dire->size + 1, -+ &next_block, &next_offset)) -+ goto failed_read; -+ -+ length += dire->size + 1; -+ -+ if (name[0] < dire->name[0]) -+ goto exit_loop; -+ -+ if ((len == dire->size + 1) && !strncmp(name, -+ dire->name, len)) { -+ squashfs_inode_t ino = -+ SQUASHFS_MKINODE(dirh.start_block, -+ dire->offset); -+ -+ TRACE("calling squashfs_iget for directory " -+ "entry %s, inode %x:%x, %d\n", name, -+ dirh.start_block, dire->offset, -+ dirh.inode_number + dire->inode_number); -+ -+ inode = (msblk->iget)(i->i_sb, ino); -+ -+ goto exit_loop; -+ } -+ } -+ } -+ -+exit_loop: -+ d_add(dentry, inode); -+ return ERR_PTR(0); -+ -+failed_read: -+ ERROR("Unable to read directory block [%llx:%x]\n", next_block, -+ next_offset); -+ goto exit_loop; -+} -+ -+ -+static void squashfs_put_super(struct super_block *s) -+{ -+ int i; -+ -+ if (s->s_fs_info) { -+ struct squashfs_sb_info *sbi = s->s_fs_info; -+ if (sbi->block_cache) -+ for (i = 0; i < SQUASHFS_CACHED_BLKS; i++) -+ if (sbi->block_cache[i].block != -+ SQUASHFS_INVALID_BLK) -+ kfree(sbi->block_cache[i].data); -+ if (sbi->fragment) -+ for (i = 0; i < SQUASHFS_CACHED_FRAGMENTS; i++) -+ SQUASHFS_FREE(sbi->fragment[i].data); -+ kfree(sbi->fragment); -+ kfree(sbi->block_cache); -+ kfree(sbi->read_data); -+ kfree(sbi->read_page); -+ kfree(sbi->uid); -+ kfree(sbi->fragment_index); -+ kfree(sbi->fragment_index_2); -+ kfree(sbi->meta_index); -+ kfree(s->s_fs_info); -+ s->s_fs_info = NULL; -+ } -+} -+ -+ -+static int squashfs_get_sb(struct file_system_type *fs_type, -+ int flags, const char *dev_name, void *data, -+ struct vfsmount *mnt) -+{ -+ return get_sb_bdev(fs_type, flags, dev_name, data, squashfs_fill_super, mnt); -+} -+ -+ -+static int __init init_squashfs_fs(void) -+{ -+ int err = init_inodecache(); -+ if (err) -+ goto out; -+ -+ printk(KERN_INFO "squashfs: version 3.0 (2006/03/15) " -+ "Phillip Lougher\n"); -+ -+ if (!(stream.workspace = vmalloc(zlib_inflate_workspacesize()))) { -+ ERROR("Failed to allocate zlib workspace\n"); -+ destroy_inodecache(); -+ err = -ENOMEM; -+ goto out; -+ } -+ -+ if ((err = register_filesystem(&squashfs_fs_type))) { -+ vfree(stream.workspace); -+ destroy_inodecache(); -+ } -+ -+out: -+ return err; -+} -+ -+ -+static void __exit exit_squashfs_fs(void) -+{ -+ vfree(stream.workspace); -+ unregister_filesystem(&squashfs_fs_type); -+ destroy_inodecache(); -+} -+ -+ -+static struct kmem_cache * squashfs_inode_cachep; -+ -+ -+static struct inode *squashfs_alloc_inode(struct super_block *sb) -+{ -+ struct squashfs_inode_info *ei; -+ ei = kmem_cache_alloc(squashfs_inode_cachep, GFP_KERNEL); -+ if (!ei) -+ return NULL; -+ return &ei->vfs_inode; -+} -+ -+ -+static void squashfs_destroy_inode(struct inode *inode) -+{ -+ kmem_cache_free(squashfs_inode_cachep, SQUASHFS_I(inode)); -+} -+ -+ -+static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) -+{ -+ struct squashfs_inode_info *ei = foo; -+ -+ inode_init_once(&ei->vfs_inode); -+} -+ -+ -+static int __init init_inodecache(void) -+{ -+ squashfs_inode_cachep = kmem_cache_create("squashfs_inode_cache", -+ sizeof(struct squashfs_inode_info), -+ 0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT, -+ init_once); -+ if (squashfs_inode_cachep == NULL) -+ return -ENOMEM; -+ return 0; -+} -+ -+ -+static void destroy_inodecache(void) -+{ -+ kmem_cache_destroy(squashfs_inode_cachep); -+} -+ -+ -+module_init(init_squashfs_fs); -+module_exit(exit_squashfs_fs); -+MODULE_DESCRIPTION("squashfs, a compressed read-only filesystem"); -+MODULE_AUTHOR("Phillip Lougher "); -+MODULE_LICENSE("GPL"); ---- /dev/null -+++ b/fs/squashfs/Makefile -@@ -0,0 +1,7 @@ -+# -+# Makefile for the linux squashfs routines. -+# -+ -+obj-$(CONFIG_SQUASHFS) += squashfs.o -+squashfs-y += inode.o -+squashfs-y += squashfs2_0.o ---- /dev/null -+++ b/fs/squashfs/squashfs2_0.c -@@ -0,0 +1,758 @@ -+/* -+ * Squashfs - a compressed read only filesystem for Linux -+ * -+ * Copyright (c) 2002, 2003, 2004, 2005, 2006 -+ * Phillip Lougher -+ * -+ * 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, -+ * or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ * -+ * squashfs2_0.c -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "squashfs.h" -+static int squashfs_readdir_2(struct file *file, void *dirent, filldir_t filldir); -+static struct dentry *squashfs_lookup_2(struct inode *, struct dentry *, -+ struct nameidata *); -+ -+static struct file_operations squashfs_dir_ops_2 = { -+ .read = generic_read_dir, -+ .readdir = squashfs_readdir_2 -+}; -+ -+static struct inode_operations squashfs_dir_inode_ops_2 = { -+ .lookup = squashfs_lookup_2 -+}; -+ -+static unsigned char squashfs_filetype_table[] = { -+ DT_UNKNOWN, DT_DIR, DT_REG, DT_LNK, DT_BLK, DT_CHR, DT_FIFO, DT_SOCK -+}; -+ -+static int read_fragment_index_table_2(struct super_block *s) -+{ -+ struct squashfs_sb_info *msblk = s->s_fs_info; -+ struct squashfs_super_block *sblk = &msblk->sblk; -+ -+ if (!(msblk->fragment_index_2 = kmalloc(SQUASHFS_FRAGMENT_INDEX_BYTES_2 -+ (sblk->fragments), GFP_KERNEL))) { -+ ERROR("Failed to allocate uid/gid table\n"); -+ return 0; -+ } -+ -+ if (SQUASHFS_FRAGMENT_INDEX_BYTES_2(sblk->fragments) && -+ !squashfs_read_data(s, (char *) -+ msblk->fragment_index_2, -+ sblk->fragment_table_start, -+ SQUASHFS_FRAGMENT_INDEX_BYTES_2 -+ (sblk->fragments) | -+ SQUASHFS_COMPRESSED_BIT_BLOCK, NULL)) { -+ ERROR("unable to read fragment index table\n"); -+ return 0; -+ } -+ -+ if (msblk->swap) { -+ int i; -+ unsigned int fragment; -+ -+ for (i = 0; i < SQUASHFS_FRAGMENT_INDEXES_2(sblk->fragments); -+ i++) { -+ SQUASHFS_SWAP_FRAGMENT_INDEXES_2((&fragment), -+ &msblk->fragment_index_2[i], 1); -+ msblk->fragment_index_2[i] = fragment; -+ } -+ } -+ -+ return 1; -+} -+ -+ -+static int get_fragment_location_2(struct super_block *s, unsigned int fragment, -+ long long *fragment_start_block, -+ unsigned int *fragment_size) -+{ -+ struct squashfs_sb_info *msblk = s->s_fs_info; -+ long long start_block = -+ msblk->fragment_index_2[SQUASHFS_FRAGMENT_INDEX_2(fragment)]; -+ int offset = SQUASHFS_FRAGMENT_INDEX_OFFSET_2(fragment); -+ struct squashfs_fragment_entry_2 fragment_entry; -+ -+ if (msblk->swap) { -+ struct squashfs_fragment_entry_2 sfragment_entry; -+ -+ if (!squashfs_get_cached_block(s, (char *) &sfragment_entry, -+ start_block, offset, -+ sizeof(sfragment_entry), &start_block, -+ &offset)) -+ goto out; -+ SQUASHFS_SWAP_FRAGMENT_ENTRY_2(&fragment_entry, &sfragment_entry); -+ } else -+ if (!squashfs_get_cached_block(s, (char *) &fragment_entry, -+ start_block, offset, -+ sizeof(fragment_entry), &start_block, -+ &offset)) -+ goto out; -+ -+ *fragment_start_block = fragment_entry.start_block; -+ *fragment_size = fragment_entry.size; -+ -+ return 1; -+ -+out: -+ return 0; -+} -+ -+ -+static struct inode *squashfs_new_inode(struct super_block *s, -+ struct squashfs_base_inode_header_2 *inodeb, unsigned int ino) -+{ -+ struct squashfs_sb_info *msblk = s->s_fs_info; -+ struct squashfs_super_block *sblk = &msblk->sblk; -+ struct inode *i = new_inode(s); -+ -+ if (i) { -+ i->i_ino = ino; -+ i->i_mtime.tv_sec = sblk->mkfs_time; -+ i->i_atime.tv_sec = sblk->mkfs_time; -+ i->i_ctime.tv_sec = sblk->mkfs_time; -+ i->i_uid = msblk->uid[inodeb->uid]; -+ i->i_mode = inodeb->mode; -+ i->i_nlink = 1; -+ i->i_size = 0; -+ if (inodeb->guid == SQUASHFS_GUIDS) -+ i->i_gid = i->i_uid; -+ else -+ i->i_gid = msblk->guid[inodeb->guid]; -+ } -+ -+ return i; -+} -+ -+ -+static struct inode *squashfs_iget_2(struct super_block *s, squashfs_inode_t inode) -+{ -+ struct inode *i; -+ struct squashfs_sb_info *msblk = s->s_fs_info; -+ struct squashfs_super_block *sblk = &msblk->sblk; -+ unsigned int block = SQUASHFS_INODE_BLK(inode) + -+ sblk->inode_table_start; -+ unsigned int offset = SQUASHFS_INODE_OFFSET(inode); -+ unsigned int ino = SQUASHFS_MK_VFS_INODE(block -+ - sblk->inode_table_start, offset); -+ long long next_block; -+ unsigned int next_offset; -+ union squashfs_inode_header_2 id, sid; -+ struct squashfs_base_inode_header_2 *inodeb = &id.base, -+ *sinodeb = &sid.base; -+ -+ TRACE("Entered squashfs_iget\n"); -+ -+ if (msblk->swap) { -+ if (!squashfs_get_cached_block(s, (char *) sinodeb, block, -+ offset, sizeof(*sinodeb), &next_block, -+ &next_offset)) -+ goto failed_read; -+ SQUASHFS_SWAP_BASE_INODE_HEADER_2(inodeb, sinodeb, -+ sizeof(*sinodeb)); -+ } else -+ if (!squashfs_get_cached_block(s, (char *) inodeb, block, -+ offset, sizeof(*inodeb), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ switch(inodeb->inode_type) { -+ case SQUASHFS_FILE_TYPE: { -+ struct squashfs_reg_inode_header_2 *inodep = &id.reg; -+ struct squashfs_reg_inode_header_2 *sinodep = &sid.reg; -+ long long frag_blk; -+ unsigned int frag_size; -+ -+ if (msblk->swap) { -+ if (!squashfs_get_cached_block(s, (char *) -+ sinodep, block, offset, -+ sizeof(*sinodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ SQUASHFS_SWAP_REG_INODE_HEADER_2(inodep, sinodep); -+ } else -+ if (!squashfs_get_cached_block(s, (char *) -+ inodep, block, offset, -+ sizeof(*inodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ frag_blk = SQUASHFS_INVALID_BLK; -+ if (inodep->fragment != SQUASHFS_INVALID_FRAG && -+ !get_fragment_location_2(s, -+ inodep->fragment, &frag_blk, &frag_size)) -+ goto failed_read; -+ -+ if((i = squashfs_new_inode(s, inodeb, ino)) == NULL) -+ goto failed_read1; -+ -+ i->i_size = inodep->file_size; -+ i->i_fop = &generic_ro_fops; -+ i->i_mode |= S_IFREG; -+ i->i_mtime.tv_sec = inodep->mtime; -+ i->i_atime.tv_sec = inodep->mtime; -+ i->i_ctime.tv_sec = inodep->mtime; -+ i->i_blocks = ((i->i_size - 1) >> 9) + 1; -+ i->i_blksize = PAGE_CACHE_SIZE; -+ SQUASHFS_I(i)->u.s1.fragment_start_block = frag_blk; -+ SQUASHFS_I(i)->u.s1.fragment_size = frag_size; -+ SQUASHFS_I(i)->u.s1.fragment_offset = inodep->offset; -+ SQUASHFS_I(i)->start_block = inodep->start_block; -+ SQUASHFS_I(i)->u.s1.block_list_start = next_block; -+ SQUASHFS_I(i)->offset = next_offset; -+ if (sblk->block_size > 4096) -+ i->i_data.a_ops = &squashfs_aops; -+ else -+ i->i_data.a_ops = &squashfs_aops_4K; -+ -+ TRACE("File inode %x:%x, start_block %x, " -+ "block_list_start %llx, offset %x\n", -+ SQUASHFS_INODE_BLK(inode), offset, -+ inodep->start_block, next_block, -+ next_offset); -+ break; -+ } -+ case SQUASHFS_DIR_TYPE: { -+ struct squashfs_dir_inode_header_2 *inodep = &id.dir; -+ struct squashfs_dir_inode_header_2 *sinodep = &sid.dir; -+ -+ if (msblk->swap) { -+ if (!squashfs_get_cached_block(s, (char *) -+ sinodep, block, offset, -+ sizeof(*sinodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ SQUASHFS_SWAP_DIR_INODE_HEADER_2(inodep, sinodep); -+ } else -+ if (!squashfs_get_cached_block(s, (char *) -+ inodep, block, offset, -+ sizeof(*inodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ if((i = squashfs_new_inode(s, inodeb, ino)) == NULL) -+ goto failed_read1; -+ -+ i->i_size = inodep->file_size; -+ i->i_op = &squashfs_dir_inode_ops_2; -+ i->i_fop = &squashfs_dir_ops_2; -+ i->i_mode |= S_IFDIR; -+ i->i_mtime.tv_sec = inodep->mtime; -+ i->i_atime.tv_sec = inodep->mtime; -+ i->i_ctime.tv_sec = inodep->mtime; -+ SQUASHFS_I(i)->start_block = inodep->start_block; -+ SQUASHFS_I(i)->offset = inodep->offset; -+ SQUASHFS_I(i)->u.s2.directory_index_count = 0; -+ SQUASHFS_I(i)->u.s2.parent_inode = 0; -+ -+ TRACE("Directory inode %x:%x, start_block %x, offset " -+ "%x\n", SQUASHFS_INODE_BLK(inode), -+ offset, inodep->start_block, -+ inodep->offset); -+ break; -+ } -+ case SQUASHFS_LDIR_TYPE: { -+ struct squashfs_ldir_inode_header_2 *inodep = &id.ldir; -+ struct squashfs_ldir_inode_header_2 *sinodep = &sid.ldir; -+ -+ if (msblk->swap) { -+ if (!squashfs_get_cached_block(s, (char *) -+ sinodep, block, offset, -+ sizeof(*sinodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ SQUASHFS_SWAP_LDIR_INODE_HEADER_2(inodep, -+ sinodep); -+ } else -+ if (!squashfs_get_cached_block(s, (char *) -+ inodep, block, offset, -+ sizeof(*inodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ if((i = squashfs_new_inode(s, inodeb, ino)) == NULL) -+ goto failed_read1; -+ -+ i->i_size = inodep->file_size; -+ i->i_op = &squashfs_dir_inode_ops_2; -+ i->i_fop = &squashfs_dir_ops_2; -+ i->i_mode |= S_IFDIR; -+ i->i_mtime.tv_sec = inodep->mtime; -+ i->i_atime.tv_sec = inodep->mtime; -+ i->i_ctime.tv_sec = inodep->mtime; -+ SQUASHFS_I(i)->start_block = inodep->start_block; -+ SQUASHFS_I(i)->offset = inodep->offset; -+ SQUASHFS_I(i)->u.s2.directory_index_start = next_block; -+ SQUASHFS_I(i)->u.s2.directory_index_offset = -+ next_offset; -+ SQUASHFS_I(i)->u.s2.directory_index_count = -+ inodep->i_count; -+ SQUASHFS_I(i)->u.s2.parent_inode = 0; -+ -+ TRACE("Long directory inode %x:%x, start_block %x, " -+ "offset %x\n", -+ SQUASHFS_INODE_BLK(inode), offset, -+ inodep->start_block, inodep->offset); -+ break; -+ } -+ case SQUASHFS_SYMLINK_TYPE: { -+ struct squashfs_symlink_inode_header_2 *inodep = -+ &id.symlink; -+ struct squashfs_symlink_inode_header_2 *sinodep = -+ &sid.symlink; -+ -+ if (msblk->swap) { -+ if (!squashfs_get_cached_block(s, (char *) -+ sinodep, block, offset, -+ sizeof(*sinodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ SQUASHFS_SWAP_SYMLINK_INODE_HEADER_2(inodep, -+ sinodep); -+ } else -+ if (!squashfs_get_cached_block(s, (char *) -+ inodep, block, offset, -+ sizeof(*inodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ if((i = squashfs_new_inode(s, inodeb, ino)) == NULL) -+ goto failed_read1; -+ -+ i->i_size = inodep->symlink_size; -+ i->i_op = &page_symlink_inode_operations; -+ i->i_data.a_ops = &squashfs_symlink_aops; -+ i->i_mode |= S_IFLNK; -+ SQUASHFS_I(i)->start_block = next_block; -+ SQUASHFS_I(i)->offset = next_offset; -+ -+ TRACE("Symbolic link inode %x:%x, start_block %llx, " -+ "offset %x\n", -+ SQUASHFS_INODE_BLK(inode), offset, -+ next_block, next_offset); -+ break; -+ } -+ case SQUASHFS_BLKDEV_TYPE: -+ case SQUASHFS_CHRDEV_TYPE: { -+ struct squashfs_dev_inode_header_2 *inodep = &id.dev; -+ struct squashfs_dev_inode_header_2 *sinodep = &sid.dev; -+ -+ if (msblk->swap) { -+ if (!squashfs_get_cached_block(s, (char *) -+ sinodep, block, offset, -+ sizeof(*sinodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ SQUASHFS_SWAP_DEV_INODE_HEADER_2(inodep, sinodep); -+ } else -+ if (!squashfs_get_cached_block(s, (char *) -+ inodep, block, offset, -+ sizeof(*inodep), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ if ((i = squashfs_new_inode(s, inodeb, ino)) == NULL) -+ goto failed_read1; -+ -+ i->i_mode |= (inodeb->inode_type == -+ SQUASHFS_CHRDEV_TYPE) ? S_IFCHR : -+ S_IFBLK; -+ init_special_inode(i, i->i_mode, -+ old_decode_dev(inodep->rdev)); -+ -+ TRACE("Device inode %x:%x, rdev %x\n", -+ SQUASHFS_INODE_BLK(inode), offset, -+ inodep->rdev); -+ break; -+ } -+ case SQUASHFS_FIFO_TYPE: -+ case SQUASHFS_SOCKET_TYPE: { -+ if ((i = squashfs_new_inode(s, inodeb, ino)) == NULL) -+ goto failed_read1; -+ -+ i->i_mode |= (inodeb->inode_type == SQUASHFS_FIFO_TYPE) -+ ? S_IFIFO : S_IFSOCK; -+ init_special_inode(i, i->i_mode, 0); -+ break; -+ } -+ default: -+ ERROR("Unknown inode type %d in squashfs_iget!\n", -+ inodeb->inode_type); -+ goto failed_read1; -+ } -+ -+ insert_inode_hash(i); -+ return i; -+ -+failed_read: -+ ERROR("Unable to read inode [%x:%x]\n", block, offset); -+ -+failed_read1: -+ return NULL; -+} -+ -+ -+static int get_dir_index_using_offset(struct super_block *s, long long -+ *next_block, unsigned int *next_offset, -+ long long index_start, -+ unsigned int index_offset, int i_count, -+ long long f_pos) -+{ -+ struct squashfs_sb_info *msblk = s->s_fs_info; -+ struct squashfs_super_block *sblk = &msblk->sblk; -+ int i, length = 0; -+ struct squashfs_dir_index_2 index; -+ -+ TRACE("Entered get_dir_index_using_offset, i_count %d, f_pos %d\n", -+ i_count, (unsigned int) f_pos); -+ -+ if (f_pos == 0) -+ goto finish; -+ -+ for (i = 0; i < i_count; i++) { -+ if (msblk->swap) { -+ struct squashfs_dir_index_2 sindex; -+ squashfs_get_cached_block(s, (char *) &sindex, -+ index_start, index_offset, -+ sizeof(sindex), &index_start, -+ &index_offset); -+ SQUASHFS_SWAP_DIR_INDEX_2(&index, &sindex); -+ } else -+ squashfs_get_cached_block(s, (char *) &index, -+ index_start, index_offset, -+ sizeof(index), &index_start, -+ &index_offset); -+ -+ if (index.index > f_pos) -+ break; -+ -+ squashfs_get_cached_block(s, NULL, index_start, index_offset, -+ index.size + 1, &index_start, -+ &index_offset); -+ -+ length = index.index; -+ *next_block = index.start_block + sblk->directory_table_start; -+ } -+ -+ *next_offset = (length + *next_offset) % SQUASHFS_METADATA_SIZE; -+ -+finish: -+ return length; -+} -+ -+ -+static int get_dir_index_using_name(struct super_block *s, long long -+ *next_block, unsigned int *next_offset, -+ long long index_start, -+ unsigned int index_offset, int i_count, -+ const char *name, int size) -+{ -+ struct squashfs_sb_info *msblk = s->s_fs_info; -+ struct squashfs_super_block *sblk = &msblk->sblk; -+ int i, length = 0; -+ char buffer[sizeof(struct squashfs_dir_index_2) + SQUASHFS_NAME_LEN + 1]; -+ struct squashfs_dir_index_2 *index = (struct squashfs_dir_index_2 *) buffer; -+ char str[SQUASHFS_NAME_LEN + 1]; -+ -+ TRACE("Entered get_dir_index_using_name, i_count %d\n", i_count); -+ -+ strncpy(str, name, size); -+ str[size] = '\0'; -+ -+ for (i = 0; i < i_count; i++) { -+ if (msblk->swap) { -+ struct squashfs_dir_index_2 sindex; -+ squashfs_get_cached_block(s, (char *) &sindex, -+ index_start, index_offset, -+ sizeof(sindex), &index_start, -+ &index_offset); -+ SQUASHFS_SWAP_DIR_INDEX_2(index, &sindex); -+ } else -+ squashfs_get_cached_block(s, (char *) index, -+ index_start, index_offset, -+ sizeof(struct squashfs_dir_index_2), -+ &index_start, &index_offset); -+ -+ squashfs_get_cached_block(s, index->name, index_start, -+ index_offset, index->size + 1, -+ &index_start, &index_offset); -+ -+ index->name[index->size + 1] = '\0'; -+ -+ if (strcmp(index->name, str) > 0) -+ break; -+ -+ length = index->index; -+ *next_block = index->start_block + sblk->directory_table_start; -+ } -+ -+ *next_offset = (length + *next_offset) % SQUASHFS_METADATA_SIZE; -+ return length; -+} -+ -+ -+static int squashfs_readdir_2(struct file *file, void *dirent, filldir_t filldir) -+{ -+ struct inode *i = file->f_dentry->d_inode; -+ struct squashfs_sb_info *msblk = i->i_sb->s_fs_info; -+ struct squashfs_super_block *sblk = &msblk->sblk; -+ long long next_block = SQUASHFS_I(i)->start_block + -+ sblk->directory_table_start; -+ int next_offset = SQUASHFS_I(i)->offset, length = 0, dirs_read = 0, -+ dir_count; -+ struct squashfs_dir_header_2 dirh; -+ char buffer[sizeof(struct squashfs_dir_entry_2) + SQUASHFS_NAME_LEN + 1]; -+ struct squashfs_dir_entry_2 *dire = (struct squashfs_dir_entry_2 *) buffer; -+ -+ TRACE("Entered squashfs_readdir_2 [%llx:%x]\n", next_block, next_offset); -+ -+ length = get_dir_index_using_offset(i->i_sb, &next_block, &next_offset, -+ SQUASHFS_I(i)->u.s2.directory_index_start, -+ SQUASHFS_I(i)->u.s2.directory_index_offset, -+ SQUASHFS_I(i)->u.s2.directory_index_count, -+ file->f_pos); -+ -+ while (length < i_size_read(i)) { -+ /* read directory header */ -+ if (msblk->swap) { -+ struct squashfs_dir_header_2 sdirh; -+ -+ if (!squashfs_get_cached_block(i->i_sb, (char *) &sdirh, -+ next_block, next_offset, sizeof(sdirh), -+ &next_block, &next_offset)) -+ goto failed_read; -+ -+ length += sizeof(sdirh); -+ SQUASHFS_SWAP_DIR_HEADER_2(&dirh, &sdirh); -+ } else { -+ if (!squashfs_get_cached_block(i->i_sb, (char *) &dirh, -+ next_block, next_offset, sizeof(dirh), -+ &next_block, &next_offset)) -+ goto failed_read; -+ -+ length += sizeof(dirh); -+ } -+ -+ dir_count = dirh.count + 1; -+ while (dir_count--) { -+ if (msblk->swap) { -+ struct squashfs_dir_entry_2 sdire; -+ if (!squashfs_get_cached_block(i->i_sb, (char *) -+ &sdire, next_block, next_offset, -+ sizeof(sdire), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ length += sizeof(sdire); -+ SQUASHFS_SWAP_DIR_ENTRY_2(dire, &sdire); -+ } else { -+ if (!squashfs_get_cached_block(i->i_sb, (char *) -+ dire, next_block, next_offset, -+ sizeof(*dire), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ length += sizeof(*dire); -+ } -+ -+ if (!squashfs_get_cached_block(i->i_sb, dire->name, -+ next_block, next_offset, -+ dire->size + 1, &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ length += dire->size + 1; -+ -+ if (file->f_pos >= length) -+ continue; -+ -+ dire->name[dire->size + 1] = '\0'; -+ -+ TRACE("Calling filldir(%x, %s, %d, %d, %x:%x, %d)\n", -+ (unsigned int) dirent, dire->name, -+ dire->size + 1, (int) file->f_pos, -+ dirh.start_block, dire->offset, -+ squashfs_filetype_table[dire->type]); -+ -+ if (filldir(dirent, dire->name, dire->size + 1, -+ file->f_pos, SQUASHFS_MK_VFS_INODE( -+ dirh.start_block, dire->offset), -+ squashfs_filetype_table[dire->type]) -+ < 0) { -+ TRACE("Filldir returned less than 0\n"); -+ goto finish; -+ } -+ file->f_pos = length; -+ dirs_read++; -+ } -+ } -+ -+finish: -+ return dirs_read; -+ -+failed_read: -+ ERROR("Unable to read directory block [%llx:%x]\n", next_block, -+ next_offset); -+ return 0; -+} -+ -+ -+static struct dentry *squashfs_lookup_2(struct inode *i, struct dentry *dentry, -+ struct nameidata *nd) -+{ -+ const unsigned char *name = dentry->d_name.name; -+ int len = dentry->d_name.len; -+ struct inode *inode = NULL; -+ struct squashfs_sb_info *msblk = i->i_sb->s_fs_info; -+ struct squashfs_super_block *sblk = &msblk->sblk; -+ long long next_block = SQUASHFS_I(i)->start_block + -+ sblk->directory_table_start; -+ int next_offset = SQUASHFS_I(i)->offset, length = 0, -+ dir_count; -+ struct squashfs_dir_header_2 dirh; -+ char buffer[sizeof(struct squashfs_dir_entry_2) + SQUASHFS_NAME_LEN]; -+ struct squashfs_dir_entry_2 *dire = (struct squashfs_dir_entry_2 *) buffer; -+ int sorted = sblk->s_major == 2 && sblk->s_minor >= 1; -+ -+ TRACE("Entered squashfs_lookup [%llx:%x]\n", next_block, next_offset); -+ -+ if (len > SQUASHFS_NAME_LEN) -+ goto exit_loop; -+ -+ length = get_dir_index_using_name(i->i_sb, &next_block, &next_offset, -+ SQUASHFS_I(i)->u.s2.directory_index_start, -+ SQUASHFS_I(i)->u.s2.directory_index_offset, -+ SQUASHFS_I(i)->u.s2.directory_index_count, name, -+ len); -+ -+ while (length < i_size_read(i)) { -+ /* read directory header */ -+ if (msblk->swap) { -+ struct squashfs_dir_header_2 sdirh; -+ if (!squashfs_get_cached_block(i->i_sb, (char *) &sdirh, -+ next_block, next_offset, sizeof(sdirh), -+ &next_block, &next_offset)) -+ goto failed_read; -+ -+ length += sizeof(sdirh); -+ SQUASHFS_SWAP_DIR_HEADER_2(&dirh, &sdirh); -+ } else { -+ if (!squashfs_get_cached_block(i->i_sb, (char *) &dirh, -+ next_block, next_offset, sizeof(dirh), -+ &next_block, &next_offset)) -+ goto failed_read; -+ -+ length += sizeof(dirh); -+ } -+ -+ dir_count = dirh.count + 1; -+ while (dir_count--) { -+ if (msblk->swap) { -+ struct squashfs_dir_entry_2 sdire; -+ if (!squashfs_get_cached_block(i->i_sb, (char *) -+ &sdire, next_block,next_offset, -+ sizeof(sdire), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ length += sizeof(sdire); -+ SQUASHFS_SWAP_DIR_ENTRY_2(dire, &sdire); -+ } else { -+ if (!squashfs_get_cached_block(i->i_sb, (char *) -+ dire, next_block,next_offset, -+ sizeof(*dire), &next_block, -+ &next_offset)) -+ goto failed_read; -+ -+ length += sizeof(*dire); -+ } -+ -+ if (!squashfs_get_cached_block(i->i_sb, dire->name, -+ next_block, next_offset, dire->size + 1, -+ &next_block, &next_offset)) -+ goto failed_read; -+ -+ length += dire->size + 1; -+ -+ if (sorted && name[0] < dire->name[0]) -+ goto exit_loop; -+ -+ if ((len == dire->size + 1) && !strncmp(name, -+ dire->name, len)) { -+ squashfs_inode_t ino = -+ SQUASHFS_MKINODE(dirh.start_block, -+ dire->offset); -+ -+ TRACE("calling squashfs_iget for directory " -+ "entry %s, inode %x:%x, %lld\n", name, -+ dirh.start_block, dire->offset, ino); -+ -+ inode = (msblk->iget)(i->i_sb, ino); -+ -+ goto exit_loop; -+ } -+ } -+ } -+ -+exit_loop: -+ d_add(dentry, inode); -+ return ERR_PTR(0); -+ -+failed_read: -+ ERROR("Unable to read directory block [%llx:%x]\n", next_block, -+ next_offset); -+ goto exit_loop; -+} -+ -+ -+int squashfs_2_0_supported(struct squashfs_sb_info *msblk) -+{ -+ struct squashfs_super_block *sblk = &msblk->sblk; -+ -+ msblk->iget = squashfs_iget_2; -+ msblk->read_fragment_index_table = read_fragment_index_table_2; -+ -+ sblk->bytes_used = sblk->bytes_used_2; -+ sblk->uid_start = sblk->uid_start_2; -+ sblk->guid_start = sblk->guid_start_2; -+ sblk->inode_table_start = sblk->inode_table_start_2; -+ sblk->directory_table_start = sblk->directory_table_start_2; -+ sblk->fragment_table_start = sblk->fragment_table_start_2; -+ -+ return 1; -+} ---- /dev/null -+++ b/fs/squashfs/squashfs.h -@@ -0,0 +1,86 @@ -+/* -+ * Squashfs - a compressed read only filesystem for Linux -+ * -+ * Copyright (c) 2002, 2003, 2004, 2005, 2006 -+ * Phillip Lougher -+ * -+ * 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, -+ * or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ * -+ * squashfs.h -+ */ -+ -+#ifdef CONFIG_SQUASHFS_1_0_COMPATIBILITY -+#undef CONFIG_SQUASHFS_1_0_COMPATIBILITY -+#endif -+ -+#ifdef SQUASHFS_TRACE -+#define TRACE(s, args...) printk(KERN_NOTICE "SQUASHFS: "s, ## args) -+#else -+#define TRACE(s, args...) {} -+#endif -+ -+#define ERROR(s, args...) printk(KERN_ERR "SQUASHFS error: "s, ## args) -+ -+#define SERROR(s, args...) do { \ -+ if (!silent) \ -+ printk(KERN_ERR "SQUASHFS error: "s, ## args);\ -+ } while(0) -+ -+#define WARNING(s, args...) printk(KERN_WARNING "SQUASHFS: "s, ## args) -+ -+static inline struct squashfs_inode_info *SQUASHFS_I(struct inode *inode) -+{ -+ return list_entry(inode, struct squashfs_inode_info, vfs_inode); -+} -+ -+#if defined(CONFIG_SQUASHFS_1_0_COMPATIBILITY ) || defined(CONFIG_SQUASHFS_2_0_COMPATIBILITY) -+#define SQSH_EXTERN -+extern unsigned int squashfs_read_data(struct super_block *s, char *buffer, -+ long long index, unsigned int length, -+ long long *next_index); -+extern int squashfs_get_cached_block(struct super_block *s, char *buffer, -+ long long block, unsigned int offset, -+ int length, long long *next_block, -+ unsigned int *next_offset); -+extern void release_cached_fragment(struct squashfs_sb_info *msblk, struct -+ squashfs_fragment_cache *fragment); -+extern struct squashfs_fragment_cache *get_cached_fragment(struct super_block -+ *s, long long start_block, -+ int length); -+extern struct address_space_operations squashfs_symlink_aops; -+extern struct address_space_operations squashfs_aops; -+extern struct address_space_operations squashfs_aops_4K; -+extern struct inode_operations squashfs_dir_inode_ops; -+#else -+#define SQSH_EXTERN static -+#endif -+ -+#ifdef CONFIG_SQUASHFS_1_0_COMPATIBILITY -+extern int squashfs_1_0_supported(struct squashfs_sb_info *msblk); -+#else -+static inline int squashfs_1_0_supported(struct squashfs_sb_info *msblk) -+{ -+ return 0; -+} -+#endif -+ -+#ifdef CONFIG_SQUASHFS_2_0_COMPATIBILITY -+extern int squashfs_2_0_supported(struct squashfs_sb_info *msblk); -+#else -+static inline int squashfs_2_0_supported(struct squashfs_sb_info *msblk) -+{ -+ return 0; -+} -+#endif ---- a/include/linux/magic.h -+++ b/include/linux/magic.h -@@ -35,6 +35,9 @@ - #define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" - #define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" - -+#define SQUASHFS_MAGIC 0x73717368 -+#define SQUASHFS_MAGIC_SWAP 0x68737173 -+ - #define SMB_SUPER_MAGIC 0x517B - #define USBDEVICE_SUPER_MAGIC 0x9fa2 - #define CGROUP_SUPER_MAGIC 0x27e0eb ---- /dev/null -+++ b/include/linux/squashfs_fs.h -@@ -0,0 +1,911 @@ -+#ifndef SQUASHFS_FS -+#define SQUASHFS_FS -+ -+/* -+ * Squashfs -+ * -+ * Copyright (c) 2002, 2003, 2004, 2005, 2006 -+ * Phillip Lougher -+ * -+ * 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, -+ * or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ * -+ * squashfs_fs.h -+ */ -+ -+#ifndef CONFIG_SQUASHFS_2_0_COMPATIBILITY -+#define CONFIG_SQUASHFS_2_0_COMPATIBILITY -+#endif -+ -+#ifdef CONFIG_SQUASHFS_VMALLOC -+#define SQUASHFS_ALLOC(a) vmalloc(a) -+#define SQUASHFS_FREE(a) vfree(a) -+#else -+#define SQUASHFS_ALLOC(a) kmalloc(a, GFP_KERNEL) -+#define SQUASHFS_FREE(a) kfree(a) -+#endif -+#define SQUASHFS_CACHED_FRAGMENTS CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE -+#define SQUASHFS_MAJOR 3 -+#define SQUASHFS_MINOR 0 -+#define SQUASHFS_START 0 -+ -+/* size of metadata (inode and directory) blocks */ -+#define SQUASHFS_METADATA_SIZE 8192 -+#define SQUASHFS_METADATA_LOG 13 -+ -+/* default size of data blocks */ -+#define SQUASHFS_FILE_SIZE 65536 -+#define SQUASHFS_FILE_LOG 16 -+ -+#define SQUASHFS_FILE_MAX_SIZE 65536 -+ -+/* Max number of uids and gids */ -+#define SQUASHFS_UIDS 256 -+#define SQUASHFS_GUIDS 255 -+ -+/* Max length of filename (not 255) */ -+#define SQUASHFS_NAME_LEN 256 -+ -+#define SQUASHFS_INVALID ((long long) 0xffffffffffff) -+#define SQUASHFS_INVALID_FRAG ((unsigned int) 0xffffffff) -+#define SQUASHFS_INVALID_BLK ((long long) -1) -+#define SQUASHFS_USED_BLK ((long long) -2) -+ -+/* Filesystem flags */ -+#define SQUASHFS_NOI 0 -+#define SQUASHFS_NOD 1 -+#define SQUASHFS_CHECK 2 -+#define SQUASHFS_NOF 3 -+#define SQUASHFS_NO_FRAG 4 -+#define SQUASHFS_ALWAYS_FRAG 5 -+#define SQUASHFS_DUPLICATE 6 -+ -+#define SQUASHFS_BIT(flag, bit) ((flag >> bit) & 1) -+ -+#define SQUASHFS_UNCOMPRESSED_INODES(flags) SQUASHFS_BIT(flags, \ -+ SQUASHFS_NOI) -+ -+#define SQUASHFS_UNCOMPRESSED_DATA(flags) SQUASHFS_BIT(flags, \ -+ SQUASHFS_NOD) -+ -+#define SQUASHFS_UNCOMPRESSED_FRAGMENTS(flags) SQUASHFS_BIT(flags, \ -+ SQUASHFS_NOF) -+ -+#define SQUASHFS_NO_FRAGMENTS(flags) SQUASHFS_BIT(flags, \ -+ SQUASHFS_NO_FRAG) -+ -+#define SQUASHFS_ALWAYS_FRAGMENTS(flags) SQUASHFS_BIT(flags, \ -+ SQUASHFS_ALWAYS_FRAG) -+ -+#define SQUASHFS_DUPLICATES(flags) SQUASHFS_BIT(flags, \ -+ SQUASHFS_DUPLICATE) -+ -+#define SQUASHFS_CHECK_DATA(flags) SQUASHFS_BIT(flags, \ -+ SQUASHFS_CHECK) -+ -+#define SQUASHFS_MKFLAGS(noi, nod, check_data, nof, no_frag, always_frag, \ -+ duplicate_checking) (noi | (nod << 1) | (check_data << 2) \ -+ | (nof << 3) | (no_frag << 4) | (always_frag << 5) | \ -+ (duplicate_checking << 6)) -+ -+/* Max number of types and file types */ -+#define SQUASHFS_DIR_TYPE 1 -+#define SQUASHFS_FILE_TYPE 2 -+#define SQUASHFS_SYMLINK_TYPE 3 -+#define SQUASHFS_BLKDEV_TYPE 4 -+#define SQUASHFS_CHRDEV_TYPE 5 -+#define SQUASHFS_FIFO_TYPE 6 -+#define SQUASHFS_SOCKET_TYPE 7 -+#define SQUASHFS_LDIR_TYPE 8 -+#define SQUASHFS_LREG_TYPE 9 -+ -+/* 1.0 filesystem type definitions */ -+#define SQUASHFS_TYPES 5 -+#define SQUASHFS_IPC_TYPE 0 -+ -+/* Flag whether block is compressed or uncompressed, bit is set if block is -+ * uncompressed */ -+#define SQUASHFS_COMPRESSED_BIT (1 << 15) -+ -+#define SQUASHFS_COMPRESSED_SIZE(B) (((B) & ~SQUASHFS_COMPRESSED_BIT) ? \ -+ (B) & ~SQUASHFS_COMPRESSED_BIT : SQUASHFS_COMPRESSED_BIT) -+ -+#define SQUASHFS_COMPRESSED(B) (!((B) & SQUASHFS_COMPRESSED_BIT)) -+ -+#define SQUASHFS_COMPRESSED_BIT_BLOCK (1 << 24) -+ -+#define SQUASHFS_COMPRESSED_SIZE_BLOCK(B) (((B) & \ -+ ~SQUASHFS_COMPRESSED_BIT_BLOCK) ? (B) & \ -+ ~SQUASHFS_COMPRESSED_BIT_BLOCK : SQUASHFS_COMPRESSED_BIT_BLOCK) -+ -+#define SQUASHFS_COMPRESSED_BLOCK(B) (!((B) & SQUASHFS_COMPRESSED_BIT_BLOCK)) -+ -+/* -+ * Inode number ops. Inodes consist of a compressed block number, and an -+ * uncompressed offset within that block -+ */ -+#define SQUASHFS_INODE_BLK(a) ((unsigned int) ((a) >> 16)) -+ -+#define SQUASHFS_INODE_OFFSET(a) ((unsigned int) ((a) & 0xffff)) -+ -+#define SQUASHFS_MKINODE(A, B) ((squashfs_inode_t)(((squashfs_inode_t) (A)\ -+ << 16) + (B))) -+ -+/* Compute 32 bit VFS inode number from squashfs inode number */ -+#define SQUASHFS_MK_VFS_INODE(a, b) ((unsigned int) (((a) << 8) + \ -+ ((b) >> 2) + 1)) -+/* XXX */ -+ -+/* Translate between VFS mode and squashfs mode */ -+#define SQUASHFS_MODE(a) ((a) & 0xfff) -+ -+/* fragment and fragment table defines */ -+#define SQUASHFS_FRAGMENT_BYTES(A) (A * sizeof(struct squashfs_fragment_entry)) -+ -+#define SQUASHFS_FRAGMENT_INDEX(A) (SQUASHFS_FRAGMENT_BYTES(A) / \ -+ SQUASHFS_METADATA_SIZE) -+ -+#define SQUASHFS_FRAGMENT_INDEX_OFFSET(A) (SQUASHFS_FRAGMENT_BYTES(A) % \ -+ SQUASHFS_METADATA_SIZE) -+ -+#define SQUASHFS_FRAGMENT_INDEXES(A) ((SQUASHFS_FRAGMENT_BYTES(A) + \ -+ SQUASHFS_METADATA_SIZE - 1) / \ -+ SQUASHFS_METADATA_SIZE) -+ -+#define SQUASHFS_FRAGMENT_INDEX_BYTES(A) (SQUASHFS_FRAGMENT_INDEXES(A) *\ -+ sizeof(long long)) -+ -+/* cached data constants for filesystem */ -+#define SQUASHFS_CACHED_BLKS 8 -+ -+#define SQUASHFS_MAX_FILE_SIZE_LOG 64 -+ -+#define SQUASHFS_MAX_FILE_SIZE ((long long) 1 << \ -+ (SQUASHFS_MAX_FILE_SIZE_LOG - 2)) -+ -+#define SQUASHFS_MARKER_BYTE 0xff -+ -+/* meta index cache */ -+#define SQUASHFS_META_INDEXES (SQUASHFS_METADATA_SIZE / sizeof(unsigned int)) -+#define SQUASHFS_META_ENTRIES 31 -+#define SQUASHFS_META_NUMBER 8 -+#define SQUASHFS_SLOTS 4 -+ -+#include -+ -+struct meta_entry { -+ long long data_block; -+ unsigned int index_block; -+ unsigned short offset; -+ unsigned short pad; -+}; -+ -+struct meta_index { -+ unsigned int inode_number; -+ unsigned int offset; -+ unsigned short entries; -+ unsigned short skip; -+ unsigned short locked; -+ unsigned short pad; -+ struct meta_entry meta_entry[SQUASHFS_META_ENTRIES]; -+}; -+ -+ -+/* -+ * definitions for structures on disk -+ */ -+ -+typedef long long squashfs_block_t; -+typedef long long squashfs_inode_t; -+ -+struct squashfs_super_block { -+ unsigned int s_magic; -+ unsigned int inodes; -+ unsigned int bytes_used_2; -+ unsigned int uid_start_2; -+ unsigned int guid_start_2; -+ unsigned int inode_table_start_2; -+ unsigned int directory_table_start_2; -+ unsigned int s_major:16; -+ unsigned int s_minor:16; -+ unsigned int block_size_1:16; -+ unsigned int block_log:16; -+ unsigned int flags:8; -+ unsigned int no_uids:8; -+ unsigned int no_guids:8; -+ unsigned int mkfs_time /* time of filesystem creation */; -+ squashfs_inode_t root_inode; -+ unsigned int block_size; -+ unsigned int fragments; -+ unsigned int fragment_table_start_2; -+ long long bytes_used; -+ long long uid_start; -+ long long guid_start; -+ long long inode_table_start; -+ long long directory_table_start; -+ long long fragment_table_start; -+ long long unused; -+} __attribute__ ((packed)); -+ -+struct squashfs_dir_index { -+ unsigned int index; -+ unsigned int start_block; -+ unsigned char size; -+ unsigned char name[0]; -+} __attribute__ ((packed)); -+ -+#define SQUASHFS_BASE_INODE_HEADER \ -+ unsigned int inode_type:4; \ -+ unsigned int mode:12; \ -+ unsigned int uid:8; \ -+ unsigned int guid:8; \ -+ unsigned int mtime; \ -+ unsigned int inode_number; -+ -+struct squashfs_base_inode_header { -+ SQUASHFS_BASE_INODE_HEADER; -+} __attribute__ ((packed)); -+ -+struct squashfs_ipc_inode_header { -+ SQUASHFS_BASE_INODE_HEADER; -+ unsigned int nlink; -+} __attribute__ ((packed)); -+ -+struct squashfs_dev_inode_header { -+ SQUASHFS_BASE_INODE_HEADER; -+ unsigned int nlink; -+ unsigned short rdev; -+} __attribute__ ((packed)); -+ -+struct squashfs_symlink_inode_header { -+ SQUASHFS_BASE_INODE_HEADER; -+ unsigned int nlink; -+ unsigned short symlink_size; -+ char symlink[0]; -+} __attribute__ ((packed)); -+ -+struct squashfs_reg_inode_header { -+ SQUASHFS_BASE_INODE_HEADER; -+ squashfs_block_t start_block; -+ unsigned int fragment; -+ unsigned int offset; -+ unsigned int file_size; -+ unsigned short block_list[0]; -+} __attribute__ ((packed)); -+ -+struct squashfs_lreg_inode_header { -+ SQUASHFS_BASE_INODE_HEADER; -+ unsigned int nlink; -+ squashfs_block_t start_block; -+ unsigned int fragment; -+ unsigned int offset; -+ long long file_size; -+ unsigned short block_list[0]; -+} __attribute__ ((packed)); -+ -+struct squashfs_dir_inode_header { -+ SQUASHFS_BASE_INODE_HEADER; -+ unsigned int nlink; -+ unsigned int file_size:19; -+ unsigned int offset:13; -+ unsigned int start_block; -+ unsigned int parent_inode; -+} __attribute__ ((packed)); -+ -+struct squashfs_ldir_inode_header { -+ SQUASHFS_BASE_INODE_HEADER; -+ unsigned int nlink; -+ unsigned int file_size:27; -+ unsigned int offset:13; -+ unsigned int start_block; -+ unsigned int i_count:16; -+ unsigned int parent_inode; -+ struct squashfs_dir_index index[0]; -+} __attribute__ ((packed)); -+ -+union squashfs_inode_header { -+ struct squashfs_base_inode_header base; -+ struct squashfs_dev_inode_header dev; -+ struct squashfs_symlink_inode_header symlink; -+ struct squashfs_reg_inode_header reg; -+ struct squashfs_lreg_inode_header lreg; -+ struct squashfs_dir_inode_header dir; -+ struct squashfs_ldir_inode_header ldir; -+ struct squashfs_ipc_inode_header ipc; -+}; -+ -+struct squashfs_dir_entry { -+ unsigned int offset:13; -+ unsigned int type:3; -+ unsigned int size:8; -+ int inode_number:16; -+ char name[0]; -+} __attribute__ ((packed)); -+ -+struct squashfs_dir_header { -+ unsigned int count:8; -+ unsigned int start_block; -+ unsigned int inode_number; -+} __attribute__ ((packed)); -+ -+struct squashfs_fragment_entry { -+ long long start_block; -+ unsigned int size; -+ unsigned int unused; -+} __attribute__ ((packed)); -+ -+extern int squashfs_uncompress_block(void *d, int dstlen, void *s, int srclen); -+extern int squashfs_uncompress_init(void); -+extern int squashfs_uncompress_exit(void); -+ -+/* -+ * macros to convert each packed bitfield structure from little endian to big -+ * endian and vice versa. These are needed when creating or using a filesystem -+ * on a machine with different byte ordering to the target architecture. -+ * -+ */ -+ -+#define SQUASHFS_SWAP_START \ -+ int bits;\ -+ int b_pos;\ -+ unsigned long long val;\ -+ unsigned char *s;\ -+ unsigned char *d; -+ -+#define SQUASHFS_SWAP_SUPER_BLOCK(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_super_block));\ -+ SQUASHFS_SWAP((s)->s_magic, d, 0, 32);\ -+ SQUASHFS_SWAP((s)->inodes, d, 32, 32);\ -+ SQUASHFS_SWAP((s)->bytes_used_2, d, 64, 32);\ -+ SQUASHFS_SWAP((s)->uid_start_2, d, 96, 32);\ -+ SQUASHFS_SWAP((s)->guid_start_2, d, 128, 32);\ -+ SQUASHFS_SWAP((s)->inode_table_start_2, d, 160, 32);\ -+ SQUASHFS_SWAP((s)->directory_table_start_2, d, 192, 32);\ -+ SQUASHFS_SWAP((s)->s_major, d, 224, 16);\ -+ SQUASHFS_SWAP((s)->s_minor, d, 240, 16);\ -+ SQUASHFS_SWAP((s)->block_size_1, d, 256, 16);\ -+ SQUASHFS_SWAP((s)->block_log, d, 272, 16);\ -+ SQUASHFS_SWAP((s)->flags, d, 288, 8);\ -+ SQUASHFS_SWAP((s)->no_uids, d, 296, 8);\ -+ SQUASHFS_SWAP((s)->no_guids, d, 304, 8);\ -+ SQUASHFS_SWAP((s)->mkfs_time, d, 312, 32);\ -+ SQUASHFS_SWAP((s)->root_inode, d, 344, 64);\ -+ SQUASHFS_SWAP((s)->block_size, d, 408, 32);\ -+ SQUASHFS_SWAP((s)->fragments, d, 440, 32);\ -+ SQUASHFS_SWAP((s)->fragment_table_start_2, d, 472, 32);\ -+ SQUASHFS_SWAP((s)->bytes_used, d, 504, 64);\ -+ SQUASHFS_SWAP((s)->uid_start, d, 568, 64);\ -+ SQUASHFS_SWAP((s)->guid_start, d, 632, 64);\ -+ SQUASHFS_SWAP((s)->inode_table_start, d, 696, 64);\ -+ SQUASHFS_SWAP((s)->directory_table_start, d, 760, 64);\ -+ SQUASHFS_SWAP((s)->fragment_table_start, d, 824, 64);\ -+ SQUASHFS_SWAP((s)->unused, d, 888, 64);\ -+} -+ -+#define SQUASHFS_SWAP_BASE_INODE_CORE(s, d, n)\ -+ SQUASHFS_MEMSET(s, d, n);\ -+ SQUASHFS_SWAP((s)->inode_type, d, 0, 4);\ -+ SQUASHFS_SWAP((s)->mode, d, 4, 12);\ -+ SQUASHFS_SWAP((s)->uid, d, 16, 8);\ -+ SQUASHFS_SWAP((s)->guid, d, 24, 8);\ -+ SQUASHFS_SWAP((s)->mtime, d, 32, 32);\ -+ SQUASHFS_SWAP((s)->inode_number, d, 64, 32); -+ -+#define SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, n) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_SWAP_BASE_INODE_CORE(s, d, n)\ -+} -+ -+#define SQUASHFS_SWAP_IPC_INODE_HEADER(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \ -+ sizeof(struct squashfs_ipc_inode_header))\ -+ SQUASHFS_SWAP((s)->nlink, d, 96, 32);\ -+} -+ -+#define SQUASHFS_SWAP_DEV_INODE_HEADER(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \ -+ sizeof(struct squashfs_dev_inode_header)); \ -+ SQUASHFS_SWAP((s)->nlink, d, 96, 32);\ -+ SQUASHFS_SWAP((s)->rdev, d, 128, 16);\ -+} -+ -+#define SQUASHFS_SWAP_SYMLINK_INODE_HEADER(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \ -+ sizeof(struct squashfs_symlink_inode_header));\ -+ SQUASHFS_SWAP((s)->nlink, d, 96, 32);\ -+ SQUASHFS_SWAP((s)->symlink_size, d, 128, 16);\ -+} -+ -+#define SQUASHFS_SWAP_REG_INODE_HEADER(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \ -+ sizeof(struct squashfs_reg_inode_header));\ -+ SQUASHFS_SWAP((s)->start_block, d, 96, 64);\ -+ SQUASHFS_SWAP((s)->fragment, d, 160, 32);\ -+ SQUASHFS_SWAP((s)->offset, d, 192, 32);\ -+ SQUASHFS_SWAP((s)->file_size, d, 224, 32);\ -+} -+ -+#define SQUASHFS_SWAP_LREG_INODE_HEADER(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \ -+ sizeof(struct squashfs_lreg_inode_header));\ -+ SQUASHFS_SWAP((s)->nlink, d, 96, 32);\ -+ SQUASHFS_SWAP((s)->start_block, d, 128, 64);\ -+ SQUASHFS_SWAP((s)->fragment, d, 192, 32);\ -+ SQUASHFS_SWAP((s)->offset, d, 224, 32);\ -+ SQUASHFS_SWAP((s)->file_size, d, 256, 64);\ -+} -+ -+#define SQUASHFS_SWAP_DIR_INODE_HEADER(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \ -+ sizeof(struct squashfs_dir_inode_header));\ -+ SQUASHFS_SWAP((s)->nlink, d, 96, 32);\ -+ SQUASHFS_SWAP((s)->file_size, d, 128, 19);\ -+ SQUASHFS_SWAP((s)->offset, d, 147, 13);\ -+ SQUASHFS_SWAP((s)->start_block, d, 160, 32);\ -+ SQUASHFS_SWAP((s)->parent_inode, d, 192, 32);\ -+} -+ -+#define SQUASHFS_SWAP_LDIR_INODE_HEADER(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \ -+ sizeof(struct squashfs_ldir_inode_header));\ -+ SQUASHFS_SWAP((s)->nlink, d, 96, 32);\ -+ SQUASHFS_SWAP((s)->file_size, d, 128, 27);\ -+ SQUASHFS_SWAP((s)->offset, d, 155, 13);\ -+ SQUASHFS_SWAP((s)->start_block, d, 168, 32);\ -+ SQUASHFS_SWAP((s)->i_count, d, 200, 16);\ -+ SQUASHFS_SWAP((s)->parent_inode, d, 216, 32);\ -+} -+ -+#define SQUASHFS_SWAP_DIR_INDEX(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_index));\ -+ SQUASHFS_SWAP((s)->index, d, 0, 32);\ -+ SQUASHFS_SWAP((s)->start_block, d, 32, 32);\ -+ SQUASHFS_SWAP((s)->size, d, 64, 8);\ -+} -+ -+#define SQUASHFS_SWAP_DIR_HEADER(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_header));\ -+ SQUASHFS_SWAP((s)->count, d, 0, 8);\ -+ SQUASHFS_SWAP((s)->start_block, d, 8, 32);\ -+ SQUASHFS_SWAP((s)->inode_number, d, 40, 32);\ -+} -+ -+#define SQUASHFS_SWAP_DIR_ENTRY(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_entry));\ -+ SQUASHFS_SWAP((s)->offset, d, 0, 13);\ -+ SQUASHFS_SWAP((s)->type, d, 13, 3);\ -+ SQUASHFS_SWAP((s)->size, d, 16, 8);\ -+ SQUASHFS_SWAP((s)->inode_number, d, 24, 16);\ -+} -+ -+#define SQUASHFS_SWAP_FRAGMENT_ENTRY(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_fragment_entry));\ -+ SQUASHFS_SWAP((s)->start_block, d, 0, 64);\ -+ SQUASHFS_SWAP((s)->size, d, 64, 32);\ -+} -+ -+#define SQUASHFS_SWAP_SHORTS(s, d, n) {\ -+ int entry;\ -+ int bit_position;\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_MEMSET(s, d, n * 2);\ -+ for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += \ -+ 16)\ -+ SQUASHFS_SWAP(s[entry], d, bit_position, 16);\ -+} -+ -+#define SQUASHFS_SWAP_INTS(s, d, n) {\ -+ int entry;\ -+ int bit_position;\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_MEMSET(s, d, n * 4);\ -+ for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += \ -+ 32)\ -+ SQUASHFS_SWAP(s[entry], d, bit_position, 32);\ -+} -+ -+#define SQUASHFS_SWAP_LONG_LONGS(s, d, n) {\ -+ int entry;\ -+ int bit_position;\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_MEMSET(s, d, n * 8);\ -+ for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += \ -+ 64)\ -+ SQUASHFS_SWAP(s[entry], d, bit_position, 64);\ -+} -+ -+#define SQUASHFS_SWAP_DATA(s, d, n, bits) {\ -+ int entry;\ -+ int bit_position;\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_MEMSET(s, d, n * bits / 8);\ -+ for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += \ -+ bits)\ -+ SQUASHFS_SWAP(s[entry], d, bit_position, bits);\ -+} -+ -+#define SQUASHFS_SWAP_FRAGMENT_INDEXES(s, d, n) SQUASHFS_SWAP_LONG_LONGS(s, d, n) -+ -+#ifdef CONFIG_SQUASHFS_1_0_COMPATIBILITY -+ -+struct squashfs_base_inode_header_1 { -+ unsigned int inode_type:4; -+ unsigned int mode:12; /* protection */ -+ unsigned int uid:4; /* index into uid table */ -+ unsigned int guid:4; /* index into guid table */ -+} __attribute__ ((packed)); -+ -+struct squashfs_ipc_inode_header_1 { -+ unsigned int inode_type:4; -+ unsigned int mode:12; /* protection */ -+ unsigned int uid:4; /* index into uid table */ -+ unsigned int guid:4; /* index into guid table */ -+ unsigned int type:4; -+ unsigned int offset:4; -+} __attribute__ ((packed)); -+ -+struct squashfs_dev_inode_header_1 { -+ unsigned int inode_type:4; -+ unsigned int mode:12; /* protection */ -+ unsigned int uid:4; /* index into uid table */ -+ unsigned int guid:4; /* index into guid table */ -+ unsigned short rdev; -+} __attribute__ ((packed)); -+ -+struct squashfs_symlink_inode_header_1 { -+ unsigned int inode_type:4; -+ unsigned int mode:12; /* protection */ -+ unsigned int uid:4; /* index into uid table */ -+ unsigned int guid:4; /* index into guid table */ -+ unsigned short symlink_size; -+ char symlink[0]; -+} __attribute__ ((packed)); -+ -+struct squashfs_reg_inode_header_1 { -+ unsigned int inode_type:4; -+ unsigned int mode:12; /* protection */ -+ unsigned int uid:4; /* index into uid table */ -+ unsigned int guid:4; /* index into guid table */ -+ unsigned int mtime; -+ unsigned int start_block; -+ unsigned int file_size:32; -+ unsigned short block_list[0]; -+} __attribute__ ((packed)); -+ -+struct squashfs_dir_inode_header_1 { -+ unsigned int inode_type:4; -+ unsigned int mode:12; /* protection */ -+ unsigned int uid:4; /* index into uid table */ -+ unsigned int guid:4; /* index into guid table */ -+ unsigned int file_size:19; -+ unsigned int offset:13; -+ unsigned int mtime; -+ unsigned int start_block:24; -+} __attribute__ ((packed)); -+ -+#define SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, n) \ -+ SQUASHFS_MEMSET(s, d, n);\ -+ SQUASHFS_SWAP((s)->inode_type, d, 0, 4);\ -+ SQUASHFS_SWAP((s)->mode, d, 4, 12);\ -+ SQUASHFS_SWAP((s)->uid, d, 16, 4);\ -+ SQUASHFS_SWAP((s)->guid, d, 20, 4); -+ -+#define SQUASHFS_SWAP_BASE_INODE_HEADER_1(s, d, n) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, n)\ -+} -+ -+#define SQUASHFS_SWAP_IPC_INODE_HEADER_1(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \ -+ sizeof(struct squashfs_ipc_inode_header_1));\ -+ SQUASHFS_SWAP((s)->type, d, 24, 4);\ -+ SQUASHFS_SWAP((s)->offset, d, 28, 4);\ -+} -+ -+#define SQUASHFS_SWAP_DEV_INODE_HEADER_1(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \ -+ sizeof(struct squashfs_dev_inode_header_1));\ -+ SQUASHFS_SWAP((s)->rdev, d, 24, 16);\ -+} -+ -+#define SQUASHFS_SWAP_SYMLINK_INODE_HEADER_1(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \ -+ sizeof(struct squashfs_symlink_inode_header_1));\ -+ SQUASHFS_SWAP((s)->symlink_size, d, 24, 16);\ -+} -+ -+#define SQUASHFS_SWAP_REG_INODE_HEADER_1(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \ -+ sizeof(struct squashfs_reg_inode_header_1));\ -+ SQUASHFS_SWAP((s)->mtime, d, 24, 32);\ -+ SQUASHFS_SWAP((s)->start_block, d, 56, 32);\ -+ SQUASHFS_SWAP((s)->file_size, d, 88, 32);\ -+} -+ -+#define SQUASHFS_SWAP_DIR_INODE_HEADER_1(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \ -+ sizeof(struct squashfs_dir_inode_header_1));\ -+ SQUASHFS_SWAP((s)->file_size, d, 24, 19);\ -+ SQUASHFS_SWAP((s)->offset, d, 43, 13);\ -+ SQUASHFS_SWAP((s)->mtime, d, 56, 32);\ -+ SQUASHFS_SWAP((s)->start_block, d, 88, 24);\ -+} -+ -+#endif -+ -+#ifdef CONFIG_SQUASHFS_2_0_COMPATIBILITY -+ -+struct squashfs_dir_index_2 { -+ unsigned int index:27; -+ unsigned int start_block:29; -+ unsigned char size; -+ unsigned char name[0]; -+} __attribute__ ((packed)); -+ -+struct squashfs_base_inode_header_2 { -+ unsigned int inode_type:4; -+ unsigned int mode:12; /* protection */ -+ unsigned int uid:8; /* index into uid table */ -+ unsigned int guid:8; /* index into guid table */ -+} __attribute__ ((packed)); -+ -+struct squashfs_ipc_inode_header_2 { -+ unsigned int inode_type:4; -+ unsigned int mode:12; /* protection */ -+ unsigned int uid:8; /* index into uid table */ -+ unsigned int guid:8; /* index into guid table */ -+} __attribute__ ((packed)); -+ -+struct squashfs_dev_inode_header_2 { -+ unsigned int inode_type:4; -+ unsigned int mode:12; /* protection */ -+ unsigned int uid:8; /* index into uid table */ -+ unsigned int guid:8; /* index into guid table */ -+ unsigned short rdev; -+} __attribute__ ((packed)); -+ -+struct squashfs_symlink_inode_header_2 { -+ unsigned int inode_type:4; -+ unsigned int mode:12; /* protection */ -+ unsigned int uid:8; /* index into uid table */ -+ unsigned int guid:8; /* index into guid table */ -+ unsigned short symlink_size; -+ char symlink[0]; -+} __attribute__ ((packed)); -+ -+struct squashfs_reg_inode_header_2 { -+ unsigned int inode_type:4; -+ unsigned int mode:12; /* protection */ -+ unsigned int uid:8; /* index into uid table */ -+ unsigned int guid:8; /* index into guid table */ -+ unsigned int mtime; -+ unsigned int start_block; -+ unsigned int fragment; -+ unsigned int offset; -+ unsigned int file_size:32; -+ unsigned short block_list[0]; -+} __attribute__ ((packed)); -+ -+struct squashfs_dir_inode_header_2 { -+ unsigned int inode_type:4; -+ unsigned int mode:12; /* protection */ -+ unsigned int uid:8; /* index into uid table */ -+ unsigned int guid:8; /* index into guid table */ -+ unsigned int file_size:19; -+ unsigned int offset:13; -+ unsigned int mtime; -+ unsigned int start_block:24; -+} __attribute__ ((packed)); -+ -+struct squashfs_ldir_inode_header_2 { -+ unsigned int inode_type:4; -+ unsigned int mode:12; /* protection */ -+ unsigned int uid:8; /* index into uid table */ -+ unsigned int guid:8; /* index into guid table */ -+ unsigned int file_size:27; -+ unsigned int offset:13; -+ unsigned int mtime; -+ unsigned int start_block:24; -+ unsigned int i_count:16; -+ struct squashfs_dir_index_2 index[0]; -+} __attribute__ ((packed)); -+ -+union squashfs_inode_header_2 { -+ struct squashfs_base_inode_header_2 base; -+ struct squashfs_dev_inode_header_2 dev; -+ struct squashfs_symlink_inode_header_2 symlink; -+ struct squashfs_reg_inode_header_2 reg; -+ struct squashfs_dir_inode_header_2 dir; -+ struct squashfs_ldir_inode_header_2 ldir; -+ struct squashfs_ipc_inode_header_2 ipc; -+}; -+ -+struct squashfs_dir_header_2 { -+ unsigned int count:8; -+ unsigned int start_block:24; -+} __attribute__ ((packed)); -+ -+struct squashfs_dir_entry_2 { -+ unsigned int offset:13; -+ unsigned int type:3; -+ unsigned int size:8; -+ char name[0]; -+} __attribute__ ((packed)); -+ -+struct squashfs_fragment_entry_2 { -+ unsigned int start_block; -+ unsigned int size; -+} __attribute__ ((packed)); -+ -+#define SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, n)\ -+ SQUASHFS_MEMSET(s, d, n);\ -+ SQUASHFS_SWAP((s)->inode_type, d, 0, 4);\ -+ SQUASHFS_SWAP((s)->mode, d, 4, 12);\ -+ SQUASHFS_SWAP((s)->uid, d, 16, 8);\ -+ SQUASHFS_SWAP((s)->guid, d, 24, 8);\ -+ -+#define SQUASHFS_SWAP_BASE_INODE_HEADER_2(s, d, n) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, n)\ -+} -+ -+#define SQUASHFS_SWAP_IPC_INODE_HEADER_2(s, d) \ -+ SQUASHFS_SWAP_BASE_INODE_HEADER_2(s, d, sizeof(struct squashfs_ipc_inode_header_2)) -+ -+#define SQUASHFS_SWAP_DEV_INODE_HEADER_2(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \ -+ sizeof(struct squashfs_dev_inode_header_2)); \ -+ SQUASHFS_SWAP((s)->rdev, d, 32, 16);\ -+} -+ -+#define SQUASHFS_SWAP_SYMLINK_INODE_HEADER_2(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \ -+ sizeof(struct squashfs_symlink_inode_header_2));\ -+ SQUASHFS_SWAP((s)->symlink_size, d, 32, 16);\ -+} -+ -+#define SQUASHFS_SWAP_REG_INODE_HEADER_2(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \ -+ sizeof(struct squashfs_reg_inode_header_2));\ -+ SQUASHFS_SWAP((s)->mtime, d, 32, 32);\ -+ SQUASHFS_SWAP((s)->start_block, d, 64, 32);\ -+ SQUASHFS_SWAP((s)->fragment, d, 96, 32);\ -+ SQUASHFS_SWAP((s)->offset, d, 128, 32);\ -+ SQUASHFS_SWAP((s)->file_size, d, 160, 32);\ -+} -+ -+#define SQUASHFS_SWAP_DIR_INODE_HEADER_2(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \ -+ sizeof(struct squashfs_dir_inode_header_2));\ -+ SQUASHFS_SWAP((s)->file_size, d, 32, 19);\ -+ SQUASHFS_SWAP((s)->offset, d, 51, 13);\ -+ SQUASHFS_SWAP((s)->mtime, d, 64, 32);\ -+ SQUASHFS_SWAP((s)->start_block, d, 96, 24);\ -+} -+ -+#define SQUASHFS_SWAP_LDIR_INODE_HEADER_2(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \ -+ sizeof(struct squashfs_ldir_inode_header_2));\ -+ SQUASHFS_SWAP((s)->file_size, d, 32, 27);\ -+ SQUASHFS_SWAP((s)->offset, d, 59, 13);\ -+ SQUASHFS_SWAP((s)->mtime, d, 72, 32);\ -+ SQUASHFS_SWAP((s)->start_block, d, 104, 24);\ -+ SQUASHFS_SWAP((s)->i_count, d, 128, 16);\ -+} -+ -+#define SQUASHFS_SWAP_DIR_INDEX_2(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_index_2));\ -+ SQUASHFS_SWAP((s)->index, d, 0, 27);\ -+ SQUASHFS_SWAP((s)->start_block, d, 27, 29);\ -+ SQUASHFS_SWAP((s)->size, d, 56, 8);\ -+} -+#define SQUASHFS_SWAP_DIR_HEADER_2(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_header_2));\ -+ SQUASHFS_SWAP((s)->count, d, 0, 8);\ -+ SQUASHFS_SWAP((s)->start_block, d, 8, 24);\ -+} -+ -+#define SQUASHFS_SWAP_DIR_ENTRY_2(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_entry_2));\ -+ SQUASHFS_SWAP((s)->offset, d, 0, 13);\ -+ SQUASHFS_SWAP((s)->type, d, 13, 3);\ -+ SQUASHFS_SWAP((s)->size, d, 16, 8);\ -+} -+ -+#define SQUASHFS_SWAP_FRAGMENT_ENTRY_2(s, d) {\ -+ SQUASHFS_SWAP_START\ -+ SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_fragment_entry_2));\ -+ SQUASHFS_SWAP((s)->start_block, d, 0, 32);\ -+ SQUASHFS_SWAP((s)->size, d, 32, 32);\ -+} -+ -+#define SQUASHFS_SWAP_FRAGMENT_INDEXES_2(s, d, n) SQUASHFS_SWAP_INTS(s, d, n) -+ -+/* fragment and fragment table defines */ -+#define SQUASHFS_FRAGMENT_BYTES_2(A) (A * sizeof(struct squashfs_fragment_entry_2)) -+ -+#define SQUASHFS_FRAGMENT_INDEX_2(A) (SQUASHFS_FRAGMENT_BYTES_2(A) / \ -+ SQUASHFS_METADATA_SIZE) -+ -+#define SQUASHFS_FRAGMENT_INDEX_OFFSET_2(A) (SQUASHFS_FRAGMENT_BYTES_2(A) % \ -+ SQUASHFS_METADATA_SIZE) -+ -+#define SQUASHFS_FRAGMENT_INDEXES_2(A) ((SQUASHFS_FRAGMENT_BYTES_2(A) + \ -+ SQUASHFS_METADATA_SIZE - 1) / \ -+ SQUASHFS_METADATA_SIZE) -+ -+#define SQUASHFS_FRAGMENT_INDEX_BYTES_2(A) (SQUASHFS_FRAGMENT_INDEXES_2(A) *\ -+ sizeof(int)) -+ -+#endif -+ -+#ifdef __KERNEL__ -+ -+/* -+ * macros used to swap each structure entry, taking into account -+ * bitfields and different bitfield placing conventions on differing -+ * architectures -+ */ -+ -+#include -+ -+#ifdef __BIG_ENDIAN -+ /* convert from little endian to big endian */ -+#define SQUASHFS_SWAP(value, p, pos, tbits) _SQUASHFS_SWAP(value, p, pos, \ -+ tbits, b_pos) -+#else -+ /* convert from big endian to little endian */ -+#define SQUASHFS_SWAP(value, p, pos, tbits) _SQUASHFS_SWAP(value, p, pos, \ -+ tbits, 64 - tbits - b_pos) -+#endif -+ -+#define _SQUASHFS_SWAP(value, p, pos, tbits, SHIFT) {\ -+ b_pos = pos % 8;\ -+ val = 0;\ -+ s = (unsigned char *)p + (pos / 8);\ -+ d = ((unsigned char *) &val) + 7;\ -+ for(bits = 0; bits < (tbits + b_pos); bits += 8) \ -+ *d-- = *s++;\ -+ value = (val >> (SHIFT))/* & ((1 << tbits) - 1)*/;\ -+} -+ -+#define SQUASHFS_MEMSET(s, d, n) memset(s, 0, n); -+ -+#endif -+#endif ---- /dev/null -+++ b/include/linux/squashfs_fs_i.h -@@ -0,0 +1,45 @@ -+#ifndef SQUASHFS_FS_I -+#define SQUASHFS_FS_I -+/* -+ * Squashfs -+ * -+ * Copyright (c) 2002, 2003, 2004, 2005, 2006 -+ * Phillip Lougher -+ * -+ * 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, -+ * or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ * -+ * squashfs_fs_i.h -+ */ -+ -+struct squashfs_inode_info { -+ long long start_block; -+ unsigned int offset; -+ union { -+ struct { -+ long long fragment_start_block; -+ unsigned int fragment_size; -+ unsigned int fragment_offset; -+ long long block_list_start; -+ } s1; -+ struct { -+ long long directory_index_start; -+ unsigned int directory_index_offset; -+ unsigned int directory_index_count; -+ unsigned int parent_inode; -+ } s2; -+ } u; -+ struct inode vfs_inode; -+}; -+#endif ---- /dev/null -+++ b/include/linux/squashfs_fs_sb.h -@@ -0,0 +1,74 @@ -+#ifndef SQUASHFS_FS_SB -+#define SQUASHFS_FS_SB -+/* -+ * Squashfs -+ * -+ * Copyright (c) 2002, 2003, 2004, 2005, 2006 -+ * Phillip Lougher -+ * -+ * 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, -+ * or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ * -+ * squashfs_fs_sb.h -+ */ -+ -+#include -+ -+struct squashfs_cache { -+ long long block; -+ int length; -+ long long next_index; -+ char *data; -+}; -+ -+struct squashfs_fragment_cache { -+ long long block; -+ int length; -+ unsigned int locked; -+ char *data; -+}; -+ -+struct squashfs_sb_info { -+ struct squashfs_super_block sblk; -+ int devblksize; -+ int devblksize_log2; -+ int swap; -+ struct squashfs_cache *block_cache; -+ struct squashfs_fragment_cache *fragment; -+ int next_cache; -+ int next_fragment; -+ int next_meta_index; -+ unsigned int *uid; -+ unsigned int *guid; -+ long long *fragment_index; -+ unsigned int *fragment_index_2; -+ unsigned int read_size; -+ char *read_data; -+ char *read_page; -+ struct semaphore read_data_mutex; -+ struct semaphore read_page_mutex; -+ struct semaphore block_cache_mutex; -+ struct semaphore fragment_mutex; -+ struct semaphore meta_index_mutex; -+ wait_queue_head_t waitq; -+ wait_queue_head_t fragment_wait_queue; -+ struct meta_index *meta_index; -+ struct inode *(*iget)(struct super_block *s, squashfs_inode_t \ -+ inode); -+ long long (*read_blocklist)(struct inode *inode, int \ -+ index, int readahead_blks, char *block_list, \ -+ unsigned short **block_p, unsigned int *bsize); -+ int (*read_fragment_index_table)(struct super_block *s); -+}; -+#endif ---- a/init/do_mounts_rd.c -+++ b/init/do_mounts_rd.c -@@ -5,6 +5,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -37,6 +38,7 @@ static int __init crd_load(int in_fd, in - * numbers could not be found. - * - * We currently check for the following magic numbers: -+ * squashfs - * minix - * ext2 - * romfs -@@ -51,6 +53,7 @@ identify_ramdisk_image(int fd, int start - struct ext2_super_block *ext2sb; - struct romfs_super_block *romfsb; - struct cramfs_super *cramfsb; -+ struct squashfs_super_block *squashfsb; - int nblocks = -1; - unsigned char *buf; - -@@ -62,6 +65,7 @@ identify_ramdisk_image(int fd, int start - ext2sb = (struct ext2_super_block *) buf; - romfsb = (struct romfs_super_block *) buf; - cramfsb = (struct cramfs_super *) buf; -+ squashfsb = (struct squashfs_super_block *) buf; - memset(buf, 0xe5, size); - - /* -@@ -99,6 +103,15 @@ identify_ramdisk_image(int fd, int start - goto done; - } - -+ /* squashfs is at block zero too */ -+ if (squashfsb->s_magic == SQUASHFS_MAGIC) { -+ printk(KERN_NOTICE -+ "RAMDISK: squashfs filesystem found at block %d\n", -+ start_block); -+ nblocks = (squashfsb->bytes_used+BLOCK_SIZE-1)>>BLOCK_SIZE_BITS; -+ goto done; -+ } -+ - /* - * Read block 1 to test for minix and ext2 superblock - */ diff --git a/target/linux/generic-2.6/patches-2.6.27/002-lzma_decompress.patch b/target/linux/generic-2.6/patches-2.6.27/002-lzma_decompress.patch deleted file mode 100644 index c643ebe38..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/002-lzma_decompress.patch +++ /dev/null @@ -1,780 +0,0 @@ ---- /dev/null -+++ b/include/linux/LzmaDecode.h -@@ -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 ---- /dev/null -+++ b/lib/LzmaDecode.c -@@ -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 -+ -+#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; -+} ---- a/lib/Makefile -+++ b/lib/Makefile -@@ -19,7 +19,7 @@ lib-$(CONFIG_SMP) += cpumask.o - lib-y += kobject.o kref.o klist.o - - obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ -- bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o -+ bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o LzmaDecode.o - - ifeq ($(CONFIG_DEBUG_KOBJECT),y) - CFLAGS_kobject.o += -DDEBUG diff --git a/target/linux/generic-2.6/patches-2.6.27/003-squashfs_lzma.patch b/target/linux/generic-2.6/patches-2.6.27/003-squashfs_lzma.patch deleted file mode 100644 index 9050e370c..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/003-squashfs_lzma.patch +++ /dev/null @@ -1,107 +0,0 @@ ---- a/fs/squashfs/inode.c -+++ b/fs/squashfs/inode.c -@@ -4,6 +4,9 @@ - * Copyright (c) 2002, 2003, 2004, 2005, 2006 - * Phillip Lougher - * -+ * LZMA decompressor support added by Oleg I. Vdovikin -+ * Copyright (c) 2005 Oleg I.Vdovikin -+ * - * 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,6 +24,7 @@ - * inode.c - */ - -+#define SQUASHFS_LZMA - #include - #include - #include -@@ -44,6 +48,19 @@ - - #include "squashfs.h" - -+#ifdef SQUASHFS_LZMA -+#include -+ -+/* 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 -+ - static void squashfs_put_super(struct super_block *); - static int squashfs_statfs(struct dentry *, struct kstatfs *); - static int squashfs_symlink_readpage(struct file *file, struct page *page); -@@ -64,7 +81,11 @@ static int squashfs_get_sb(struct file_s - const char *, void *, struct vfsmount *); - - -+#ifdef SQUASHFS_LZMA -+static unsigned char lzma_workspace[LZMA_WORKSPACE_SIZE]; -+#else - static z_stream stream; -+#endif - - static struct file_system_type squashfs_fs_type = { - .owner = THIS_MODULE, -@@ -249,6 +270,15 @@ SQSH_EXTERN unsigned int squashfs_read_d - 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; -@@ -263,7 +293,7 @@ SQSH_EXTERN unsigned int squashfs_read_d - bytes = 0; - } else - bytes = stream.total_out; -- -+#endif - up(&msblk->read_data_mutex); - } - -@@ -2045,15 +2075,19 @@ static int __init init_squashfs_fs(void) - printk(KERN_INFO "squashfs: version 3.0 (2006/03/15) " - "Phillip Lougher\n"); - -+#ifndef SQUASHFS_LZMA - if (!(stream.workspace = vmalloc(zlib_inflate_workspacesize()))) { - ERROR("Failed to allocate zlib workspace\n"); - destroy_inodecache(); - err = -ENOMEM; - goto out; - } -+#endif - - if ((err = register_filesystem(&squashfs_fs_type))) { -+#ifndef SQUASHFS_LZMA - vfree(stream.workspace); -+#endif - destroy_inodecache(); - } - -@@ -2064,7 +2098,9 @@ out: - - static void __exit exit_squashfs_fs(void) - { -+#ifndef SQUASHFS_LZMA - vfree(stream.workspace); -+#endif - unregister_filesystem(&squashfs_fs_type); - destroy_inodecache(); - } diff --git a/target/linux/generic-2.6/patches-2.6.27/004-extra_optimization.patch b/target/linux/generic-2.6/patches-2.6.27/004-extra_optimization.patch deleted file mode 100644 index 9a15d5d37..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/004-extra_optimization.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/Makefile -+++ b/Makefile -@@ -550,6 +550,9 @@ endif - NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) - CHECKFLAGS += $(NOSTDINC_FLAGS) - -+# improve gcc optimization -+CFLAGS += $(call cc-option,-funit-at-a-time,) -+ - # warn about C99 declaration after statement - KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) - diff --git a/target/linux/generic-2.6/patches-2.6.27/005-squashfs_fix.patch b/target/linux/generic-2.6/patches-2.6.27/005-squashfs_fix.patch deleted file mode 100644 index 51474864e..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/005-squashfs_fix.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/fs/squashfs/inode.c -+++ b/fs/squashfs/inode.c -@@ -33,6 +33,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -43,8 +44,8 @@ - #include - #include - #include -+#include - #include --#include - - #include "squashfs.h" - -@@ -2125,7 +2126,7 @@ static void squashfs_destroy_inode(struc - } - - --static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) -+static void init_once(void *foo) - { - struct squashfs_inode_info *ei = foo; - diff --git a/target/linux/generic-2.6/patches-2.6.27/006-gcc4_inline_fix.patch b/target/linux/generic-2.6/patches-2.6.27/006-gcc4_inline_fix.patch deleted file mode 100644 index cd62e9c25..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/006-gcc4_inline_fix.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/include/asm-mips/system.h -+++ b/include/asm-mips/system.h -@@ -185,7 +185,7 @@ extern __u64 __xchg_u64_unsupported_on_3 - if something tries to do an invalid xchg(). */ - extern void __xchg_called_with_bad_pointer(void); - --static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) -+static __always_inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) - { - switch (size) { - case 4: diff --git a/target/linux/generic-2.6/patches-2.6.27/007-samsung_flash.patch b/target/linux/generic-2.6/patches-2.6.27/007-samsung_flash.patch deleted file mode 100644 index 1ca45d854..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/007-samsung_flash.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- a/drivers/mtd/chips/cfi_cmdset_0002.c -+++ b/drivers/mtd/chips/cfi_cmdset_0002.c -@@ -48,6 +48,7 @@ - #define SST49LF040B 0x0050 - #define SST49LF008A 0x005a - #define AT49BV6416 0x00d6 -+#define MANUFACTURER_SAMSUNG 0x00ec - - static int cfi_amdstd_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); - static int cfi_amdstd_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); -@@ -321,12 +322,19 @@ struct mtd_info *cfi_cmdset_0002(struct - - if (extp->MajorVersion != '1' || - (extp->MinorVersion < '0' || extp->MinorVersion > '4')) { -- printk(KERN_ERR " Unknown Amd/Fujitsu Extended Query " -- "version %c.%c.\n", extp->MajorVersion, -- extp->MinorVersion); -- kfree(extp); -- kfree(mtd); -- return NULL; -+ if (cfi->mfr == MANUFACTURER_SAMSUNG && -+ (extp->MajorVersion == '3' && extp->MinorVersion == '3')) { -+ printk(KERN_NOTICE " Newer Samsung flash detected, " -+ "should be compatibile with Amd/Fujitsu.\n"); -+ } -+ else { -+ printk(KERN_ERR " Unknown Amd/Fujitsu Extended Query " -+ "version %c.%c.\n", extp->MajorVersion, -+ extp->MinorVersion); -+ kfree(extp); -+ kfree(mtd); -+ return NULL; -+ } - } - - /* Install our own private info structure */ diff --git a/target/linux/generic-2.6/patches-2.6.27/008-squashfs_vfs_super.patch b/target/linux/generic-2.6/patches-2.6.27/008-squashfs_vfs_super.patch deleted file mode 100644 index f1dc2d751..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/008-squashfs_vfs_super.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/fs/squashfs/inode.c -+++ b/fs/squashfs/inode.c -@@ -1179,7 +1179,7 @@ failure: - - static int squashfs_statfs(struct dentry *dentry, struct kstatfs *buf) - { -- struct squashfs_sb_info *msblk = dentry->d_inode->i_sb->s_fs_info; -+ struct squashfs_sb_info *msblk = dentry->d_sb->s_fs_info; - struct squashfs_super_block *sblk = &msblk->sblk; - - TRACE("Entered squashfs_statfs\n"); diff --git a/target/linux/generic-2.6/patches-2.6.27/010-disable_old_squashfs_compatibility.patch b/target/linux/generic-2.6/patches-2.6.27/010-disable_old_squashfs_compatibility.patch deleted file mode 100644 index 01e27573b..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/010-disable_old_squashfs_compatibility.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/fs/squashfs/Makefile -+++ b/fs/squashfs/Makefile -@@ -4,4 +4,3 @@ - - obj-$(CONFIG_SQUASHFS) += squashfs.o - squashfs-y += inode.o --squashfs-y += squashfs2_0.o ---- a/fs/squashfs/squashfs.h -+++ b/fs/squashfs/squashfs.h -@@ -24,6 +24,9 @@ - #ifdef CONFIG_SQUASHFS_1_0_COMPATIBILITY - #undef CONFIG_SQUASHFS_1_0_COMPATIBILITY - #endif -+#ifdef CONFIG_SQUASHFS_2_0_COMPATIBILITY -+#undef CONFIG_SQUASHFS_2_0_COMPATIBILITY -+#endif - - #ifdef SQUASHFS_TRACE - #define TRACE(s, args...) printk(KERN_NOTICE "SQUASHFS: "s, ## args) diff --git a/target/linux/generic-2.6/patches-2.6.27/011-mips_boot.patch b/target/linux/generic-2.6/patches-2.6.27/011-mips_boot.patch deleted file mode 100644 index c2a043acd..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/011-mips_boot.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/arch/mips/kernel/head.S -+++ b/arch/mips/kernel/head.S -@@ -121,6 +121,8 @@ - #endif - .endm - -+ j kernel_entry -+ nop - #ifndef CONFIG_NO_EXCEPT_FILL - /* - * Reserved space for exception handlers. diff --git a/target/linux/generic-2.6/patches-2.6.27/020-mips_multi_machine_support.patch b/target/linux/generic-2.6/patches-2.6.27/020-mips_multi_machine_support.patch deleted file mode 100644 index 59406c382..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/020-mips_multi_machine_support.patch +++ /dev/null @@ -1,133 +0,0 @@ ---- /dev/null -+++ b/include/asm-mips/mips_machine.h -@@ -0,0 +1,47 @@ -+/* -+ * Copyright (C) 2008 Gabor Juhos -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ * -+ */ -+ -+#ifndef __ASM_MIPS_MACHINE_H -+#define __ASM_MIPS_MACHINE_H -+ -+#include -+#include -+ -+#define MIPS_MACHINE_NAME_LEN 64 -+ -+struct mips_machine { -+ unsigned long mach_type; -+ void (*mach_setup)(void); -+ unsigned char mach_name[MIPS_MACHINE_NAME_LEN]; -+ struct list_head list; -+}; -+ -+void mips_machine_register(struct mips_machine *) __init; -+void mips_machine_setup(unsigned long machtype) __init; -+ -+extern unsigned char mips_machine_name[MIPS_MACHINE_NAME_LEN]; -+ -+#define MIPS_MACHINE(_type, _name, _setup) \ -+static struct mips_machine machine_##_type __initdata = \ -+{ \ -+ .mach_type = _type, \ -+ .mach_name = _name, \ -+ .mach_setup = _setup, \ -+}; \ -+ \ -+static int __init register_machine_##_type(void) \ -+{ \ -+ mips_machine_register(&machine_##_type); \ -+ return 0; \ -+} \ -+ \ -+pure_initcall(register_machine_##_type) -+ -+#endif /* __ASM_MIPS_MACHINE_H */ -+ ---- /dev/null -+++ b/arch/mips/kernel/mips_machine.c -@@ -0,0 +1,58 @@ -+/* -+ * Copyright (C) 2008 Gabor Juhos -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ * -+ */ -+ -+#include -+#include -+ -+static struct list_head mips_machines __initdata = -+ LIST_HEAD_INIT(mips_machines); -+ -+unsigned char mips_machine_name[MIPS_MACHINE_NAME_LEN] = "Unknown"; -+ -+static struct mips_machine * __init mips_machine_find(unsigned long machtype) -+{ -+ struct list_head *this; -+ -+ list_for_each(this, &mips_machines) { -+ struct mips_machine *mach; -+ -+ mach = list_entry(this, struct mips_machine, list); -+ if (mach->mach_type == machtype) -+ return mach; -+ } -+ -+ return NULL; -+} -+ -+void __init mips_machine_register(struct mips_machine *mach) -+{ -+ list_add_tail(&mach->list, &mips_machines); -+} -+ -+void __init mips_machine_setup(unsigned long machtype) -+{ -+ struct mips_machine *mach; -+ -+ mach = mips_machine_find(machtype); -+ if (!mach) { -+ printk(KERN_ALERT "MIPS: no machine registered for " -+ "machtype %lu\n", machtype); -+ return; -+ } -+ -+ if (mach->mach_name[0]) -+ strncpy(mips_machine_name, mach->mach_name, -+ MIPS_MACHINE_NAME_LEN); -+ -+ printk(KERN_INFO "MIPS: machine is %s\n", mips_machine_name); -+ -+ if (mach->mach_setup) -+ mach->mach_setup(); -+} -+ ---- a/arch/mips/kernel/Makefile -+++ b/arch/mips/kernel/Makefile -@@ -83,6 +83,7 @@ obj-$(CONFIG_GPIO_TXX9) += gpio_txx9.o - - obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o -+obj-$(CONFIG_MIPS_MACHINE) += mips_machine.o - - CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) - ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -768,6 +768,9 @@ config MIPS_DISABLE_OBSOLETE_IDE - config SYNC_R4K - bool - -+config MIPS_MACHINE -+ def_bool n -+ - config NO_IOPORT - def_bool n - diff --git a/target/linux/generic-2.6/patches-2.6.27/021-mips_image_cmdline_hack.patch b/target/linux/generic-2.6/patches-2.6.27/021-mips_image_cmdline_hack.patch deleted file mode 100644 index da4a1b1bf..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/021-mips_image_cmdline_hack.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -771,6 +771,10 @@ config SYNC_R4K - config MIPS_MACHINE - def_bool n - -+config IMAGE_CMDLINE_HACK -+ bool "OpenWrt specific image command line hack" -+ default n -+ - config NO_IOPORT - def_bool n - ---- a/arch/mips/kernel/head.S -+++ b/arch/mips/kernel/head.S -@@ -143,6 +143,12 @@ FEXPORT(__kernel_entry) - j kernel_entry - #endif - -+#ifdef CONFIG_IMAGE_CMDLINE_HACK -+ .ascii "CMDLINE:" -+EXPORT(__image_cmdline) -+ .fill 0x400 -+#endif /* CONFIG_IMAGE_CMDLINE_HACK */ -+ - __REF - - NESTED(kernel_entry, 16, sp) # kernel entry point diff --git a/target/linux/generic-2.6/patches-2.6.27/022-mips_div64_gcc4.4.0.patch b/target/linux/generic-2.6/patches-2.6.27/022-mips_div64_gcc4.4.0.patch deleted file mode 100644 index c01765d8f..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/022-mips_div64_gcc4.4.0.patch +++ /dev/null @@ -1,171 +0,0 @@ -From: Ralf Baechle -Date: Thu, 30 Apr 2009 16:14:56 +0000 (+0200) -Subject: MIPS: Rewrite to work with gcc 4.4.0. -X-Git-Url: http://www.linux-mips.org/git?p=linux.git;a=commitdiff_plain;h=a1b68289997030df64cba8478d5767fe10e42a58 - -MIPS: Rewrite to work with gcc 4.4.0. - -The inline assembler used on 32-bit kernels was using the "h" constraint -which was considered dangerous and removed for gcc 4.4.0. - -Signed-off-by: Ralf Baechle ---- - ---- a/include/asm-mips/div64.h -+++ b/include/asm-mips/div64.h -@@ -6,105 +6,63 @@ - * License. See the file "COPYING" in the main directory of this archive - * for more details. - */ --#ifndef _ASM_DIV64_H --#define _ASM_DIV64_H -+#ifndef __ASM_DIV64_H -+#define __ASM_DIV64_H - --#include -+#include - --#if (_MIPS_SZLONG == 32) -+#if BITS_PER_LONG == 64 - --#include -+#include - - /* - * No traps on overflows for any of these... - */ - --#define do_div64_32(res, high, low, base) ({ \ -- unsigned long __quot32, __mod32; \ -- unsigned long __cf, __tmp, __tmp2, __i; \ -- \ -- __asm__(".set push\n\t" \ -- ".set noat\n\t" \ -- ".set noreorder\n\t" \ -- "move %2, $0\n\t" \ -- "move %3, $0\n\t" \ -- "b 1f\n\t" \ -- " li %4, 0x21\n" \ -- "0:\n\t" \ -- "sll $1, %0, 0x1\n\t" \ -- "srl %3, %0, 0x1f\n\t" \ -- "or %0, $1, %5\n\t" \ -- "sll %1, %1, 0x1\n\t" \ -- "sll %2, %2, 0x1\n" \ -- "1:\n\t" \ -- "bnez %3, 2f\n\t" \ -- " sltu %5, %0, %z6\n\t" \ -- "bnez %5, 3f\n" \ -- "2:\n\t" \ -- " addiu %4, %4, -1\n\t" \ -- "subu %0, %0, %z6\n\t" \ -- "addiu %2, %2, 1\n" \ -- "3:\n\t" \ -- "bnez %4, 0b\n\t" \ -- " srl %5, %1, 0x1f\n\t" \ -- ".set pop" \ -- : "=&r" (__mod32), "=&r" (__tmp), \ -- "=&r" (__quot32), "=&r" (__cf), \ -- "=&r" (__i), "=&r" (__tmp2) \ -- : "Jr" (base), "0" (high), "1" (low)); \ -- \ -- (res) = __quot32; \ -- __mod32; }) -- --#define do_div(n, base) ({ \ -- unsigned long long __quot; \ -- unsigned long __mod; \ -- unsigned long long __div; \ -- unsigned long __upper, __low, __high, __base; \ -- \ -- __div = (n); \ -- __base = (base); \ -- \ -- __high = __div >> 32; \ -- __low = __div; \ -- __upper = __high; \ -- \ -- if (__high) \ -- __asm__("divu $0, %z2, %z3" \ -- : "=h" (__upper), "=l" (__high) \ -- : "Jr" (__high), "Jr" (__base) \ -- : GCC_REG_ACCUM); \ -- \ -- __mod = do_div64_32(__low, __upper, __low, __base); \ -- \ -- __quot = __high; \ -- __quot = __quot << 32 | __low; \ -- (n) = __quot; \ -- __mod; }) -- --#endif /* (_MIPS_SZLONG == 32) */ -- --#if (_MIPS_SZLONG == 64) -- --/* -- * Hey, we're already 64-bit, no -- * need to play games.. -- */ --#define do_div(n, base) ({ \ -- unsigned long __quot; \ -- unsigned int __mod; \ -- unsigned long __div; \ -- unsigned int __base; \ -- \ -- __div = (n); \ -- __base = (base); \ -- \ -- __mod = __div % __base; \ -- __quot = __div / __base; \ -- \ -- (n) = __quot; \ -- __mod; }) -+#define __div64_32(n, base) \ -+({ \ -+ unsigned long __cf, __tmp, __tmp2, __i; \ -+ unsigned long __quot32, __mod32; \ -+ unsigned long __high, __low; \ -+ unsigned long long __n; \ -+ \ -+ __high = *__n >> 32; \ -+ __low = __n; \ -+ __asm__( \ -+ " .set push \n" \ -+ " .set noat \n" \ -+ " .set noreorder \n" \ -+ " move %2, $0 \n" \ -+ " move %3, $0 \n" \ -+ " b 1f \n" \ -+ " li %4, 0x21 \n" \ -+ "0: \n" \ -+ " sll $1, %0, 0x1 \n" \ -+ " srl %3, %0, 0x1f \n" \ -+ " or %0, $1, %5 \n" \ -+ " sll %1, %1, 0x1 \n" \ -+ " sll %2, %2, 0x1 \n" \ -+ "1: \n" \ -+ " bnez %3, 2f \n" \ -+ " sltu %5, %0, %z6 \n" \ -+ " bnez %5, 3f \n" \ -+ "2: \n" \ -+ " addiu %4, %4, -1 \n" \ -+ " subu %0, %0, %z6 \n" \ -+ " addiu %2, %2, 1 \n" \ -+ "3: \n" \ -+ " bnez %4, 0b\n\t" \ -+ " srl %5, %1, 0x1f\n\t" \ -+ " .set pop" \ -+ : "=&r" (__mod32), "=&r" (__tmp), \ -+ "=&r" (__quot32), "=&r" (__cf), \ -+ "=&r" (__i), "=&r" (__tmp2) \ -+ : "Jr" (base), "0" (__high), "1" (__low)); \ -+ \ -+ (__n) = __quot32; \ -+ __mod32; \ -+}) - --#endif /* (_MIPS_SZLONG == 64) */ -+#endif /* BITS_PER_LONG == 64 */ - --#endif /* _ASM_DIV64_H */ -+#endif /* __ASM_DIV64_H */ diff --git a/target/linux/generic-2.6/patches-2.6.27/023-mips_delay_gcc4.4.0.patch b/target/linux/generic-2.6/patches-2.6.27/023-mips_delay_gcc4.4.0.patch deleted file mode 100644 index 4f7f32788..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/023-mips_delay_gcc4.4.0.patch +++ /dev/null @@ -1,152 +0,0 @@ -From: Wu Zhangjin - -the gcc 4.4 support for MIPS mostly refer to this PATCH: -http://www.nabble.com/-PATCH--MIPS:-Handle-removal-of-%27h%27-constraint-in-GCC-4.4-td22192768.html -but have been tuned a little. - -because only gcc 4.4 have loongson-specific support, so, we need to -choose the suitable -march argument for gcc <= 4.3 and gcc >= 4.4, and -we also need to consider use -march=loongson2e and -march=loongson2f for -loongson2e and loongson2f respectively. this is handled by adding two -new kernel options: CPU_LOONGSON2E and CPU_LOONGSON2F(thanks for the -solutin provided by ZhangLe). - -I have tested it on FuLoong(2f) in 32bit and 64bit with gcc-4.4 and -gcc-4.3. so, basically, it works. - -Signed-off-by: Wu Zhangjin ---- - arch/mips/Makefile | 9 +++++- - arch/mips/include/asm/compiler.h | 10 ++++++ - arch/mips/include/asm/delay.h | 58 +++++++++++++++++++++++++------------ - 3 files changed, 57 insertions(+), 20 deletions(-) - ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -119,7 +119,14 @@ cflags-$(CONFIG_CPU_R4300) += -march=r43 - cflags-$(CONFIG_CPU_VR41XX) += -march=r4100 -Wa,--trap - cflags-$(CONFIG_CPU_R4X00) += -march=r4600 -Wa,--trap - cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap --cflags-$(CONFIG_CPU_LOONGSON2) += -march=r4600 -Wa,--trap -+ -+# only gcc >= 4.4 have the loongson-specific support -+cflags-$(CONFIG_CPU_LOONGSON2) += -Wa,--trap -+cflags-$(CONFIG_CPU_LOONGSON2E) += $(shell if [ $(call cc-version) -lt 0440 ] ; then \ -+ echo $(call cc-option,-march=r4600); else echo $(call cc-option,-march=loongson2e); fi ;) -+cflags-$(CONFIG_CPU_LOONGSON2F) += $(shell if [ $(call cc-version) -lt 0440 ] ; then \ -+ echo $(call cc-option,-march=r4600); else echo $(call cc-option,-march=loongson2f); fi ;) -+ - cflags-$(CONFIG_CPU_MIPS32_R1) += $(call cc-option,-march=mips32,-mips32 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ - -Wa,-mips32 -Wa,--trap - cflags-$(CONFIG_CPU_MIPS32_R2) += $(call cc-option,-march=mips32r2,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ ---- a/include/asm-mips/compiler.h -+++ b/include/asm-mips/compiler.h -@@ -1,5 +1,6 @@ - /* - * Copyright (C) 2004, 2007 Maciej W. Rozycki -+ * Copyright (C) 2009 Wu Zhangjin, wuzj@lemote.com - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive -@@ -16,4 +17,13 @@ - #define GCC_REG_ACCUM "accum" - #endif - -+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) -+#define GCC_NO_H_CONSTRAINT -+#ifdef CONFIG_64BIT -+typedef unsigned int uintx_t __attribute__((mode(TI))); -+#else -+typedef u64 uintx_t; -+#endif -+#endif -+ - #endif /* _ASM_COMPILER_H */ ---- a/include/asm-mips/delay.h -+++ b/include/asm-mips/delay.h -@@ -7,6 +7,7 @@ - * Copyright (C) 1995 - 2000, 01, 03 by Ralf Baechle - * Copyright (C) 1999, 2000 Silicon Graphics, Inc. - * Copyright (C) 2007 Maciej W. Rozycki -+ * Copyright (C) 2009 Wu Zhangjin, wuzj@lemote.com - */ - #ifndef _ASM_DELAY_H - #define _ASM_DELAY_H -@@ -48,6 +49,43 @@ static inline void __delay(unsigned long - : "0" (loops), "r" (1)); - } - -+/* -+ * convert usecs to loops -+ * -+ * handle removal of 'h' constraint in GCC 4.4 -+ */ -+ -+#ifndef GCC_NO_H_CONSTRAINT /* gcc <= 4.3 */ -+static inline unsigned long __usecs_to_loops(unsigned long usecs, -+ unsigned long lpj) -+{ -+ unsigned long hi, lo; -+ -+ if (sizeof(long) == 4) -+ __asm__("multu\t%2, %3" -+ : "=h" (usecs), "=l" (lo) -+ : "r" (usecs), "r" (lpj) -+ : GCC_REG_ACCUM); -+ else if (sizeof(long) == 8 && !R4000_WAR) -+ __asm__("dmultu\t%2, %3" -+ : "=h" (usecs), "=l" (lo) -+ : "r" (usecs), "r" (lpj) -+ : GCC_REG_ACCUM); -+ else if (sizeof(long) == 8 && R4000_WAR) -+ __asm__("dmultu\t%3, %4\n\tmfhi\t%0" -+ : "=r" (usecs), "=h" (hi), "=l" (lo) -+ : "r" (usecs), "r" (lpj) -+ : GCC_REG_ACCUM); -+ -+ return usecs; -+} -+#else /* GCC_NO_H_CONSTRAINT, gcc >= 4.4 */ -+static inline unsigned long __usecs_to_loops(unsigned long usecs, -+ unsigned long lpj) -+{ -+ return ((uintx_t)usecs * lpj) >> BITS_PER_LONG; -+} -+#endif - - /* - * Division by multiplication: you don't have to worry about -@@ -62,8 +100,6 @@ static inline void __delay(unsigned long - - static inline void __udelay(unsigned long usecs, unsigned long lpj) - { -- unsigned long hi, lo; -- - /* - * The rates of 128 is rounded wrongly by the catchall case - * for 64-bit. Excessive precission? Probably ... -@@ -77,23 +113,7 @@ static inline void __udelay(unsigned lon - 0x80000000ULL) >> 32); - #endif - -- if (sizeof(long) == 4) -- __asm__("multu\t%2, %3" -- : "=h" (usecs), "=l" (lo) -- : "r" (usecs), "r" (lpj) -- : GCC_REG_ACCUM); -- else if (sizeof(long) == 8 && !R4000_WAR) -- __asm__("dmultu\t%2, %3" -- : "=h" (usecs), "=l" (lo) -- : "r" (usecs), "r" (lpj) -- : GCC_REG_ACCUM); -- else if (sizeof(long) == 8 && R4000_WAR) -- __asm__("dmultu\t%3, %4\n\tmfhi\t%0" -- : "=r" (usecs), "=h" (hi), "=l" (lo) -- : "r" (usecs), "r" (lpj) -- : GCC_REG_ACCUM); -- -- __delay(usecs); -+ __delay(__usecs_to_loops(usecs, lpj)); - } - - #define __udelay_val cpu_data[raw_smp_processor_id()].udelay_val diff --git a/target/linux/generic-2.6/patches-2.6.27/024-mips_disable_fpu.patch b/target/linux/generic-2.6/patches-2.6.27/024-mips_disable_fpu.patch deleted file mode 100644 index 91fbb9f14..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/024-mips_disable_fpu.patch +++ /dev/null @@ -1,155 +0,0 @@ -MIPS: allow disabling the kernel FPU emulator - -This patch allows turning off the in-kernel Algorithmics -FPU emulator support, which allows one to save a couple of -precious blocks on an embedded system. - -Signed-off-by: Florian Fainelli --- ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -756,6 +756,17 @@ config I8259 - config MIPS_BONITO64 - bool - -+config MIPS_FPU_EMU -+ bool -+ default n -+ help -+ This option allows building a kernel with or without the Algorithmics -+ FPU emulator enabled. Turning off this option results in a kernel which -+ does not catch floating operations exceptions. Make sure that your toolchain -+ is configured to enable software floating point emulation in that case. -+ -+ If unsure say Y here. -+ - config MIPS_MSC - bool - ---- a/arch/mips/math-emu/Makefile -+++ b/arch/mips/math-emu/Makefile -@@ -2,12 +2,14 @@ - # Makefile for the Linux/MIPS kernel FPU emulation. - # - --obj-y := cp1emu.o ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \ -+obj-y := kernel_linkage.o dsemul.o cp1emu.o -+ -+obj-$(CONFIG_MIPS_FPU_EMU) += ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \ - ieee754xcpt.o dp_frexp.o dp_modf.o dp_div.o dp_mul.o dp_sub.o \ - dp_add.o dp_fsp.o dp_cmp.o dp_logb.o dp_scalb.o dp_simple.o \ - dp_tint.o dp_fint.o dp_tlong.o dp_flong.o sp_frexp.o sp_modf.o \ - sp_div.o sp_mul.o sp_sub.o sp_add.o sp_fdp.o sp_cmp.o sp_logb.o \ - sp_scalb.o sp_simple.o sp_tint.o sp_fint.o sp_tlong.o sp_flong.o \ -- dp_sqrt.o sp_sqrt.o kernel_linkage.o dsemul.o -+ dp_sqrt.o sp_sqrt.o - - EXTRA_CFLAGS += -Werror ---- a/arch/mips/math-emu/cp1emu.c -+++ b/arch/mips/math-emu/cp1emu.c -@@ -57,6 +57,12 @@ - #endif - #define __mips 4 - -+/* Further private data for which no space exists in mips_fpu_struct */ -+ -+struct mips_fpu_emulator_stats fpuemustats; -+ -+#ifdef CONFIG_MIPS_FPU_EMU -+ - /* Function which emulates a floating point instruction. */ - - static int fpu_emu(struct pt_regs *, struct mips_fpu_struct *, -@@ -67,10 +73,6 @@ static int fpux_emu(struct pt_regs *, - struct mips_fpu_struct *, mips_instruction); - #endif - --/* Further private data for which no space exists in mips_fpu_struct */ -- --struct mips_fpu_emulator_stats fpuemustats; -- - /* Control registers */ - - #define FPCREG_RID 0 /* $0 = revision id */ -@@ -1277,6 +1279,13 @@ int fpu_emulator_cop1Handler(struct pt_r - - return sig; - } -+#else -+int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx, -+ int has_fpu) -+{ -+ return 0; -+} -+#endif /* CONFIG_MIPS_FPU_EMU */ - - #ifdef CONFIG_DEBUG_FS - extern struct dentry *mips_debugfs_dir; ---- a/arch/mips/math-emu/dsemul.c -+++ b/arch/mips/math-emu/dsemul.c -@@ -110,6 +110,7 @@ int mips_dsemul(struct pt_regs *regs, mi - return SIGILL; /* force out of emulation loop */ - } - -+#ifdef CONFIG_MIPS_FPU_EMU - int do_dsemulret(struct pt_regs *xcp) - { - struct emuframe __user *fr; -@@ -166,3 +167,9 @@ int do_dsemulret(struct pt_regs *xcp) - - return 1; - } -+#else -+int do_dsemulret(struct pt_regs *xcp) -+{ -+ return 0; -+} -+#endif /* CONFIG_MIPS_FPU_EMU */ ---- a/arch/mips/math-emu/kernel_linkage.c -+++ b/arch/mips/math-emu/kernel_linkage.c -@@ -29,6 +29,7 @@ - - #define SIGNALLING_NAN 0x7ff800007ff80000LL - -+#ifdef CONFIG_MIPS_FPU_EMU - void fpu_emulator_init_fpu(void) - { - static int first = 1; -@@ -112,4 +113,36 @@ int fpu_emulator_restore_context32(struc - - return err; - } --#endif -+#endif /* CONFIG_64BIT */ -+#else -+ -+void fpu_emulator_init_fpu(void) -+{ -+ printk(KERN_INFO "FPU emulator disabled, make sure your toolchain" -+ "was compiled with software floating point support (soft-float)\n"); -+ return; -+} -+ -+int fpu_emulator_save_context(struct sigcontext __user *sc) -+{ -+ return 0; -+} -+ -+int fpu_emulator_restore_context(struct sigcontext __user *sc) -+{ -+ return 0; -+} -+ -+int fpu_emulator_save_context32(struct sigcontext32 __user *sc) -+{ -+ return 0; -+} -+ -+int fpu_emulator_restore_context32(struct sigcontext32 __user *sc) -+{ -+ return 0; -+} -+ -+#ifdef CONFIG_64BIT -+#endif /* CONFIG_64BIT */ -+#endif /* CONFIG_MIPS_FPU_EMU */ diff --git a/target/linux/generic-2.6/patches-2.6.27/060-block2mtd_init.patch b/target/linux/generic-2.6/patches-2.6.27/060-block2mtd_init.patch deleted file mode 100644 index 50df4aae0..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/060-block2mtd_init.patch +++ /dev/null @@ -1,110 +0,0 @@ ---- a/drivers/mtd/devices/block2mtd.c -+++ b/drivers/mtd/devices/block2mtd.c -@@ -14,6 +14,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -232,10 +233,11 @@ static void block2mtd_free_device(struct - - - /* FIXME: ensure that mtd->size % erase_size == 0 */ --static struct block2mtd_dev *add_device(char *devname, int erase_size) -+static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname) - { - struct block_device *bdev; - struct block2mtd_dev *dev; -+ struct mtd_partition *part; - char *name; - - if (!devname) -@@ -273,17 +275,17 @@ static struct block2mtd_dev *add_device( - - mutex_init(&dev->write_mutex); - -- /* Setup the MTD structure */ -- /* make the name contain the block device in */ -- name = kmalloc(sizeof("block2mtd: ") + strlen(devname) + 1, -- GFP_KERNEL); -+ if (!mtdname) -+ mtdname = devname; -+ -+ name = kmalloc(strlen(mtdname) + 1, GFP_KERNEL); - if (!name) - goto devinit_err; - -- sprintf(name, "block2mtd: %s", devname); -+ strcpy(name, mtdname); - dev->mtd.name = name; - -- dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK; -+ dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK & ~(erase_size - 1); - dev->mtd.erasesize = erase_size; - dev->mtd.writesize = 1; - dev->mtd.type = MTD_RAM; -@@ -296,14 +298,17 @@ static struct block2mtd_dev *add_device( - dev->mtd.priv = dev; - dev->mtd.owner = THIS_MODULE; - -- if (add_mtd_device(&dev->mtd)) { -+ part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL); -+ part->name = dev->mtd.name; -+ part->offset = 0; -+ part->size = dev->mtd.size; -+ if (add_mtd_partitions(&dev->mtd, part, 1)) { - /* Device didnt get added, so free the entry */ - goto devinit_err; - } - list_add(&dev->list, &blkmtd_device_list); - INFO("mtd%d: [%s] erase_size = %dKiB [%d]", dev->mtd.index, -- dev->mtd.name + strlen("block2mtd: "), -- dev->mtd.erasesize >> 10, dev->mtd.erasesize); -+ mtdname, dev->mtd.erasesize >> 10, dev->mtd.erasesize); - return dev; - - devinit_err: -@@ -376,9 +381,9 @@ static char block2mtd_paramline[80 + 12] - - static int block2mtd_setup2(const char *val) - { -- char buf[80 + 12]; /* 80 for device, 12 for erase size */ -+ char buf[80 + 12 + 80]; /* 80 for device, 12 for erase size, 80 for name */ - char *str = buf; -- char *token[2]; -+ char *token[3]; - char *name; - size_t erase_size = PAGE_SIZE; - int i, ret; -@@ -389,7 +394,7 @@ static int block2mtd_setup2(const char * - strcpy(str, val); - kill_final_newline(str); - -- for (i = 0; i < 2; i++) -+ for (i = 0; i < 3; i++) - token[i] = strsep(&str, ","); - - if (str) -@@ -408,8 +413,10 @@ static int block2mtd_setup2(const char * - parse_err("illegal erase size"); - } - } -+ if (token[2] && (strlen(token[2]) + 1 > 80)) -+ parse_err("mtd device name too long"); - -- add_device(name, erase_size); -+ add_device(name, erase_size, token[2]); - - return 0; - } -@@ -443,7 +450,7 @@ static int block2mtd_setup(const char *v - - - module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200); --MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,]\""); -+MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,[,]]\""); - - static int __init block2mtd_init(void) - { diff --git a/target/linux/generic-2.6/patches-2.6.27/065-rootfs_split.patch b/target/linux/generic-2.6/patches-2.6.27/065-rootfs_split.patch deleted file mode 100644 index 685a246a8..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/065-rootfs_split.patch +++ /dev/null @@ -1,624 +0,0 @@ ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -45,6 +45,16 @@ config MTD_PARTITIONS - devices. Partitioning on NFTL 'devices' is a different - that's the - 'normal' form of partitioning used on a block device. - -+config MTD_ROOTFS_ROOT_DEV -+ bool "Automatically set 'rootfs' partition to be root filesystem" -+ depends on MTD_PARTITIONS -+ default y -+ -+config MTD_ROOTFS_SPLIT -+ bool "Automatically split 'rootfs' partition for squashfs" -+ depends on MTD_PARTITIONS -+ default y -+ - config MTD_REDBOOT_PARTS - tristate "RedBoot partition table parsing" - depends on MTD_PARTITIONS ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -18,6 +18,8 @@ - #include - #include - #include -+#include -+#include - - /* Our partition linked list */ - static LIST_HEAD(mtd_partitions); -@@ -37,7 +39,7 @@ struct mtd_part { - * the pointer to that structure with this macro. - */ - #define PART(x) ((struct mtd_part *)(x)) -- -+#define IS_PART(mtd) (mtd->read == part_read) - - /* - * MTD methods which simply translate the effective address and pass through -@@ -489,6 +491,147 @@ out_register: - return slave; - } - -+#ifdef CONFIG_MTD_ROOTFS_SPLIT -+#define ROOTFS_SPLIT_NAME "rootfs_data" -+#define ROOTFS_REMOVED_NAME "" -+static int split_squashfs(struct mtd_info *master, int offset, int *split_offset) -+{ -+ struct squashfs_super_block sb; -+ int len, ret; -+ -+ ret = master->read(master, offset, sizeof(sb), &len, (void *) &sb); -+ if (ret || (len != sizeof(sb))) { -+ printk(KERN_ALERT "split_squashfs: error occured while reading " -+ "from \"%s\"\n", master->name); -+ return -EINVAL; -+ } -+ -+ if (sb.s_magic != SQUASHFS_MAGIC) { -+ printk(KERN_ALERT "split_squashfs: no squashfs found in \"%s\"\n", -+ master->name); -+ *split_offset = 0; -+ return 0; -+ } -+ -+ if (sb.bytes_used <= 0) { -+ printk(KERN_ALERT "split_squashfs: squashfs is empty in \"%s\"\n", -+ master->name); -+ *split_offset = 0; -+ return 0; -+ } -+ -+ len = (u32) sb.bytes_used; -+ len += (offset & 0x000fffff); -+ len += (master->erasesize - 1); -+ len &= ~(master->erasesize - 1); -+ len -= (offset & 0x000fffff); -+ *split_offset = offset + len; -+ -+ return 0; -+} -+ -+static int split_rootfs_data(struct mtd_info *master, struct mtd_info *rpart, const struct mtd_partition *part, -+ int index) -+{ -+ struct mtd_partition *dpart; -+ struct mtd_part *slave = NULL; -+ int split_offset = 0; -+ int ret; -+ -+ ret = split_squashfs(master, part->offset, &split_offset); -+ if (ret) -+ return ret; -+ -+ if (split_offset <= 0) -+ return 0; -+ -+ dpart = kmalloc(sizeof(*part)+sizeof(ROOTFS_SPLIT_NAME)+1, GFP_KERNEL); -+ if (dpart == NULL) { -+ printk(KERN_INFO "split_squashfs: no memory for partition \"%s\"\n", -+ ROOTFS_SPLIT_NAME); -+ return -ENOMEM; -+ } -+ -+ memcpy(dpart, part, sizeof(*part)); -+ dpart->name = (unsigned char *)&dpart[1]; -+ strcpy(dpart->name, ROOTFS_SPLIT_NAME); -+ -+ dpart->size -= split_offset - dpart->offset; -+ dpart->offset = split_offset; -+ -+ if (dpart == NULL) -+ return 1; -+ -+ printk(KERN_INFO "mtd: partition \"%s\" created automatically, ofs=%X, len=%X \n", -+ ROOTFS_SPLIT_NAME, dpart->offset, dpart->size); -+ -+ slave = add_one_partition(master, dpart, index, split_offset); -+ if (!slave) { -+ kfree(dpart); -+ return -ENOMEM; -+ } -+ rpart->split = &slave->mtd; -+ -+ return 0; -+} -+ -+static int refresh_rootfs_split(struct mtd_info *mtd) -+{ -+ struct mtd_partition tpart; -+ struct mtd_part *part; -+ char *name; -+ int index = 0; -+ int offset, size; -+ int ret; -+ -+ part = PART(mtd); -+ -+ /* check for the new squashfs offset first */ -+ ret = split_squashfs(part->master, part->offset, &offset); -+ if (ret) -+ return ret; -+ -+ if ((offset > 0) && !mtd->split) { -+ printk(KERN_INFO "%s: creating new split partition for \"%s\"\n", __func__, mtd->name); -+ /* if we don't have a rootfs split partition, create a new one */ -+ tpart.name = (char *) mtd->name; -+ tpart.size = mtd->size; -+ tpart.offset = part->offset; -+ -+ /* find the index of the last partition */ -+ if (!list_empty(&mtd_partitions)) -+ index = list_first_entry(&mtd_partitions, struct mtd_part, list)->index + 1; -+ -+ return split_rootfs_data(part->master, &part->mtd, &tpart, index); -+ } else if ((offset > 0) && mtd->split) { -+ /* update the offsets of the existing partition */ -+ size = mtd->size + part->offset - offset; -+ -+ part = PART(mtd->split); -+ part->offset = offset; -+ part->mtd.size = size; -+ printk(KERN_INFO "%s: %s partition \"" ROOTFS_SPLIT_NAME "\", offset: 0x%06x (0x%06x)\n", -+ __func__, (!strcmp(part->mtd.name, ROOTFS_SPLIT_NAME) ? "updating" : "creating"), -+ part->offset, part->mtd.size); -+ name = kmalloc(sizeof(ROOTFS_SPLIT_NAME) + 1, GFP_KERNEL); -+ strcpy(name, ROOTFS_SPLIT_NAME); -+ part->mtd.name = name; -+ } else if ((offset <= 0) && mtd->split) { -+ printk(KERN_INFO "%s: removing partition \"%s\"\n", __func__, mtd->split->name); -+ -+ /* mark existing partition as removed */ -+ part = PART(mtd->split); -+ name = kmalloc(sizeof(ROOTFS_SPLIT_NAME) + 1, GFP_KERNEL); -+ strcpy(name, ROOTFS_REMOVED_NAME); -+ part->mtd.name = name; -+ part->offset = 0; -+ part->mtd.size = 0; -+ } -+ -+ return 0; -+} -+#endif /* CONFIG_MTD_ROOTFS_SPLIT */ -+ - /* - * This function, given a master MTD object and a partition table, creates - * and registers slave MTD objects which are bound to the master according to -@@ -502,14 +645,29 @@ int add_mtd_partitions(struct mtd_info * - { - struct mtd_part *slave; - u_int32_t cur_offset = 0; -- int i; -+ int i, j, ret; - - printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name); - -- for (i = 0; i < nbparts; i++) { -- slave = add_one_partition(master, parts + i, i, cur_offset); -+ for (i = 0, j = 0; i < nbparts; i++) { -+ slave = add_one_partition(master, parts + i, j++, cur_offset); - if (!slave) - return -ENOMEM; -+ -+ if (!strcmp(parts[i].name, "rootfs") && slave->registered) { -+#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV -+ if (ROOT_DEV == 0) { -+ printk(KERN_NOTICE "mtd: partition \"rootfs\" " -+ "set to be root filesystem\n"); -+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, slave->mtd.index); -+ } -+#endif -+#ifdef CONFIG_MTD_ROOTFS_SPLIT -+ ret = split_rootfs_data(master, &slave->mtd, &parts[i], j); -+ if (ret == 0) -+ j++; -+#endif -+ } - cur_offset = slave->offset + slave->mtd.size; - } - -@@ -517,6 +675,32 @@ int add_mtd_partitions(struct mtd_info * - } - EXPORT_SYMBOL(add_mtd_partitions); - -+int refresh_mtd_partitions(struct mtd_info *mtd) -+{ -+ int ret = 0; -+ -+ if (IS_PART(mtd)) { -+ struct mtd_part *part; -+ struct mtd_info *master; -+ -+ part = PART(mtd); -+ master = part->master; -+ if (master->refresh_device) -+ ret = master->refresh_device(master); -+ } -+ -+ if (!ret && mtd->refresh_device) -+ ret = mtd->refresh_device(mtd); -+ -+#ifdef CONFIG_MTD_ROOTFS_SPLIT -+ if (!ret && IS_PART(mtd) && !strcmp(mtd->name, "rootfs")) -+ refresh_rootfs_split(mtd); -+#endif -+ -+ return 0; -+} -+EXPORT_SYMBOL_GPL(refresh_mtd_partitions); -+ - static DEFINE_SPINLOCK(part_parser_lock); - static LIST_HEAD(part_parsers); - ---- a/drivers/mtd/devices/block2mtd.c -+++ b/drivers/mtd/devices/block2mtd.c -@@ -29,6 +29,8 @@ struct block2mtd_dev { - struct block_device *blkdev; - struct mtd_info mtd; - struct mutex write_mutex; -+ rwlock_t bdev_mutex; -+ char devname[0]; - }; - - -@@ -81,6 +83,12 @@ static int block2mtd_erase(struct mtd_in - size_t len = instr->len; - int err; - -+ read_lock(&dev->bdev_mutex); -+ if (!dev->blkdev) { -+ err = -EINVAL; -+ goto done; -+ } -+ - instr->state = MTD_ERASING; - mutex_lock(&dev->write_mutex); - err = _block2mtd_erase(dev, from, len); -@@ -93,6 +101,10 @@ static int block2mtd_erase(struct mtd_in - - instr->state = MTD_ERASE_DONE; - mtd_erase_callback(instr); -+ -+done: -+ read_unlock(&dev->bdev_mutex); -+ - return err; - } - -@@ -104,10 +116,14 @@ static int block2mtd_read(struct mtd_inf - struct page *page; - int index = from >> PAGE_SHIFT; - int offset = from & (PAGE_SIZE-1); -- int cpylen; -+ int cpylen, err = 0; -+ -+ read_lock(&dev->bdev_mutex); -+ if (!dev->blkdev || (from > mtd->size)) { -+ err = -EINVAL; -+ goto done; -+ } - -- if (from > mtd->size) -- return -EINVAL; - if (from + len > mtd->size) - len = mtd->size - from; - -@@ -122,10 +138,14 @@ static int block2mtd_read(struct mtd_inf - len = len - cpylen; - - page = page_read(dev->blkdev->bd_inode->i_mapping, index); -- if (!page) -- return -ENOMEM; -- if (IS_ERR(page)) -- return PTR_ERR(page); -+ if (!page) { -+ err = -ENOMEM; -+ goto done; -+ } -+ if (IS_ERR(page)) { -+ err = PTR_ERR(page); -+ goto done; -+ } - - memcpy(buf, page_address(page) + offset, cpylen); - page_cache_release(page); -@@ -136,7 +156,10 @@ static int block2mtd_read(struct mtd_inf - offset = 0; - index++; - } -- return 0; -+ -+done: -+ read_unlock(&dev->bdev_mutex); -+ return err; - } - - -@@ -188,12 +211,22 @@ static int block2mtd_write(struct mtd_in - size_t *retlen, const u_char *buf) - { - struct block2mtd_dev *dev = mtd->priv; -- int err; -+ int err = 0; -+ -+ read_lock(&dev->bdev_mutex); -+ if (!dev->blkdev) { -+ err = -EINVAL; -+ goto done; -+ } - - if (!len) -- return 0; -- if (to >= mtd->size) -- return -ENOSPC; -+ goto done; -+ -+ if (to >= mtd->size) { -+ err = -ENOSPC; -+ goto done; -+ } -+ - if (to + len > mtd->size) - len = mtd->size - to; - -@@ -202,6 +235,9 @@ static int block2mtd_write(struct mtd_in - mutex_unlock(&dev->write_mutex); - if (err > 0) - err = 0; -+ -+done: -+ read_unlock(&dev->bdev_mutex); - return err; - } - -@@ -210,52 +246,29 @@ static int block2mtd_write(struct mtd_in - static void block2mtd_sync(struct mtd_info *mtd) - { - struct block2mtd_dev *dev = mtd->priv; -- sync_blockdev(dev->blkdev); -- return; --} -- -- --static void block2mtd_free_device(struct block2mtd_dev *dev) --{ -- if (!dev) -- return; -- -- kfree(dev->mtd.name); - -- if (dev->blkdev) { -- invalidate_mapping_pages(dev->blkdev->bd_inode->i_mapping, -- 0, -1); -- close_bdev_excl(dev->blkdev); -- } -+ read_lock(&dev->bdev_mutex); -+ if (dev->blkdev) -+ sync_blockdev(dev->blkdev); -+ read_unlock(&dev->bdev_mutex); - -- kfree(dev); -+ return; - } - - --/* FIXME: ensure that mtd->size % erase_size == 0 */ --static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname) -+static int _open_bdev(struct block2mtd_dev *dev) - { - struct block_device *bdev; -- struct block2mtd_dev *dev; -- struct mtd_partition *part; -- char *name; -- -- if (!devname) -- return NULL; -- -- dev = kzalloc(sizeof(struct block2mtd_dev), GFP_KERNEL); -- if (!dev) -- return NULL; - - /* Get a handle on the device */ -- bdev = open_bdev_excl(devname, O_RDWR, NULL); -+ bdev = open_bdev_excl(dev->devname, O_RDWR, NULL); - #ifndef MODULE - if (IS_ERR(bdev)) { - - /* We might not have rootfs mounted at this point. Try - to resolve the device name by other means. */ - -- dev_t devt = name_to_dev_t(devname); -+ dev_t devt = name_to_dev_t(dev->devname); - if (devt) { - bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ); - } -@@ -263,17 +276,97 @@ static struct block2mtd_dev *add_device( - #endif - - if (IS_ERR(bdev)) { -- ERROR("error: cannot open device %s", devname); -- goto devinit_err; -+ ERROR("error: cannot open device %s", dev->devname); -+ return 1; - } - dev->blkdev = bdev; - - if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) { - ERROR("attempting to use an MTD device as a block device"); -- goto devinit_err; -+ return 1; - } - -+ return 0; -+} -+ -+static void _close_bdev(struct block2mtd_dev *dev) -+{ -+ struct block_device *bdev; -+ -+ if (!dev->blkdev) -+ return; -+ -+ bdev = dev->blkdev; -+ invalidate_mapping_pages(dev->blkdev->bd_inode->i_mapping, 0, -1); -+ close_bdev_excl(dev->blkdev); -+ dev->blkdev = NULL; -+} -+ -+static void block2mtd_free_device(struct block2mtd_dev *dev) -+{ -+ if (!dev) -+ return; -+ -+ kfree(dev->mtd.name); -+ _close_bdev(dev); -+ kfree(dev); -+} -+ -+ -+static int block2mtd_refresh(struct mtd_info *mtd) -+{ -+ struct block2mtd_dev *dev = mtd->priv; -+ struct block_device *bdev; -+ dev_t devt; -+ int err = 0; -+ -+ /* no other mtd function can run at this point */ -+ write_lock(&dev->bdev_mutex); -+ -+ /* get the device number for the whole disk */ -+ devt = MKDEV(MAJOR(dev->blkdev->bd_dev), 0); -+ -+ /* close the old block device */ -+ _close_bdev(dev); -+ -+ /* open the whole disk, issue a partition rescan, then */ -+ bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ); -+ if (!bdev || !bdev->bd_disk) -+ err = -EINVAL; -+ else { -+ err = rescan_partitions(bdev->bd_disk, bdev); -+ } -+ if (bdev) -+ close_bdev_excl(bdev); -+ -+ /* try to open the partition block device again */ -+ _open_bdev(dev); -+ write_unlock(&dev->bdev_mutex); -+ -+ return err; -+} -+ -+/* FIXME: ensure that mtd->size % erase_size == 0 */ -+static struct block2mtd_dev *add_device(char *devname, int erase_size, char *mtdname) -+{ -+ struct block2mtd_dev *dev; -+ struct mtd_partition *part; -+ char *name; -+ -+ if (!devname) -+ return NULL; -+ -+ dev = kzalloc(sizeof(struct block2mtd_dev) + strlen(devname) + 1, GFP_KERNEL); -+ if (!dev) -+ return NULL; -+ -+ strcpy(dev->devname, devname); -+ -+ if (_open_bdev(dev)) -+ goto devinit_err; -+ - mutex_init(&dev->write_mutex); -+ rwlock_init(&dev->bdev_mutex); - - if (!mtdname) - mtdname = devname; -@@ -297,6 +390,7 @@ static struct block2mtd_dev *add_device( - dev->mtd.read = block2mtd_read; - dev->mtd.priv = dev; - dev->mtd.owner = THIS_MODULE; -+ dev->mtd.refresh_device = block2mtd_refresh; - - part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL); - part->name = dev->mtd.name; ---- a/drivers/mtd/mtdchar.c -+++ b/drivers/mtd/mtdchar.c -@@ -16,6 +16,7 @@ - - #include - #include -+#include - - #include - -@@ -771,6 +772,13 @@ static int mtd_ioctl(struct inode *inode - file->f_pos = 0; - break; - } -+#ifdef CONFIG_MTD_PARTITIONS -+ case MTDREFRESH: -+ { -+ ret = refresh_mtd_partitions(mtd); -+ break; -+ } -+#endif - - default: - ret = -ENOTTY; ---- a/include/linux/mtd/mtd.h -+++ b/include/linux/mtd/mtd.h -@@ -96,6 +96,7 @@ struct mtd_oob_ops { - uint8_t *oobbuf; - }; - -+struct mtd_info; - struct mtd_info { - u_char type; - u_int32_t flags; -@@ -211,6 +212,9 @@ struct mtd_info { - struct module *owner; - int usecount; - -+ int (*refresh_device)(struct mtd_info *mtd); -+ struct mtd_info *split; -+ - /* If the driver is something smart, like UBI, it may need to maintain - * its own reference counting. The below functions are only for driver. - * The driver may register its callbacks. These callbacks are not ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -34,6 +34,7 @@ - * erasesize aligned (e.g. use MTDPART_OFS_NEXTBLK). - */ - -+struct mtd_partition; - struct mtd_partition { - char *name; /* identifier string */ - u_int32_t size; /* partition size */ -@@ -41,6 +42,7 @@ struct mtd_partition { - u_int32_t mask_flags; /* master MTD flags to mask out for this partition */ - struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only)*/ - struct mtd_info **mtdp; /* pointer to store the MTD object */ -+ int (*refresh_partition)(struct mtd_info *); - }; - - #define MTDPART_OFS_NXTBLK (-2) -@@ -50,6 +52,7 @@ struct mtd_partition { - - int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int); - int del_mtd_partitions(struct mtd_info *); -+int refresh_mtd_partitions(struct mtd_info *); - - /* - * Functions dealing with the various ways of partitioning the space ---- a/include/mtd/mtd-abi.h -+++ b/include/mtd/mtd-abi.h -@@ -93,6 +93,7 @@ struct otp_info { - #define ECCGETLAYOUT _IOR('M', 17, struct nand_ecclayout) - #define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats) - #define MTDFILEMODE _IO('M', 19) -+#define MTDREFRESH _IO('M', 23) - - /* - * Obsolete legacy interface. Keep it in order not to break userspace diff --git a/target/linux/generic-2.6/patches-2.6.27/070-redboot_space.patch b/target/linux/generic-2.6/patches-2.6.27/070-redboot_space.patch deleted file mode 100644 index 6ace83c01..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/070-redboot_space.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/drivers/mtd/redboot.c -+++ b/drivers/mtd/redboot.c -@@ -249,14 +249,21 @@ static int parse_redboot_partitions(stru - #endif - names += strlen(names)+1; - --#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED - if(fl->next && fl->img->flash_base + fl->img->size + master->erasesize <= fl->next->img->flash_base) { -- i++; -- parts[i].offset = parts[i-1].size + parts[i-1].offset; -- parts[i].size = fl->next->img->flash_base - parts[i].offset; -- parts[i].name = nullname; -- } -+ if (!strcmp(parts[i].name, "rootfs")) { -+ parts[i].size = fl->next->img->flash_base; -+ parts[i].size &= ~(master->erasesize - 1); -+ parts[i].size -= parts[i].offset; -+#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED -+ nrparts--; -+ } else { -+ i++; -+ parts[i].offset = parts[i-1].size + parts[i-1].offset; -+ parts[i].size = fl->next->img->flash_base - parts[i].offset; -+ parts[i].name = nullname; - #endif -+ } -+ } - tmp_fl = fl; - fl = fl->next; - kfree(tmp_fl); diff --git a/target/linux/generic-2.6/patches-2.6.27/071-redboot_boardconfig.patch b/target/linux/generic-2.6/patches-2.6.27/071-redboot_boardconfig.patch deleted file mode 100644 index f9bc4fe36..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/071-redboot_boardconfig.patch +++ /dev/null @@ -1,60 +0,0 @@ ---- a/drivers/mtd/redboot.c -+++ b/drivers/mtd/redboot.c -@@ -11,6 +11,8 @@ - #include - #include - -+#define BOARD_CONFIG_PART "boardconfig" -+ - struct fis_image_desc { - unsigned char name[16]; // Null terminated name - uint32_t flash_base; // Address within FLASH of image -@@ -41,6 +43,7 @@ static int parse_redboot_partitions(stru - struct mtd_partition **pparts, - unsigned long fis_origin) - { -+ unsigned long max_offset = 0; - int nrparts = 0; - struct fis_image_desc *buf; - struct mtd_partition *parts; -@@ -209,14 +212,14 @@ static int parse_redboot_partitions(stru - } - } - #endif -- parts = kzalloc(sizeof(*parts)*nrparts + nulllen + namelen, GFP_KERNEL); -+ parts = kzalloc(sizeof(*parts) * (nrparts + 1) + nulllen + namelen + sizeof(BOARD_CONFIG_PART), GFP_KERNEL); - - if (!parts) { - ret = -ENOMEM; - goto out; - } - -- nullname = (char *)&parts[nrparts]; -+ nullname = (char *)&parts[nrparts + 1]; - #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED - if (nulllen > 0) { - strcpy(nullname, nullstring); -@@ -235,6 +238,8 @@ static int parse_redboot_partitions(stru - } - #endif - for ( ; iimg->size; - parts[i].offset = fl->img->flash_base; - parts[i].name = names; -@@ -268,6 +273,14 @@ static int parse_redboot_partitions(stru - fl = fl->next; - kfree(tmp_fl); - } -+ if(master->size - max_offset >= master->erasesize) -+ { -+ parts[nrparts].size = master->size - max_offset; -+ parts[nrparts].offset = max_offset; -+ parts[nrparts].name = names; -+ strcpy(names, BOARD_CONFIG_PART); -+ nrparts++; -+ } - ret = nrparts; - *pparts = parts; - out: diff --git a/target/linux/generic-2.6/patches-2.6.27/080-mtd_plat_nand_chip_fixup.patch b/target/linux/generic-2.6/patches-2.6.27/080-mtd_plat_nand_chip_fixup.patch deleted file mode 100644 index 62d96ac56..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/080-mtd_plat_nand_chip_fixup.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- a/include/linux/mtd/nand.h -+++ b/include/linux/mtd/nand.h -@@ -578,6 +578,7 @@ struct platform_nand_chip { - int chip_delay; - unsigned int options; - const char **part_probe_types; -+ int (*chip_fixup)(struct mtd_info *mtd); - void *priv; - }; - ---- a/drivers/mtd/nand/plat_nand.c -+++ b/drivers/mtd/nand/plat_nand.c -@@ -71,7 +71,18 @@ static int __init plat_nand_probe(struct - platform_set_drvdata(pdev, data); - - /* Scan to find existance of the device */ -- if (nand_scan(&data->mtd, 1)) { -+ if (nand_scan_ident(&data->mtd, 1)) { -+ res = -ENXIO; -+ goto out; -+ } -+ -+ if (pdata->chip.chip_fixup) { -+ res = pdata->chip.chip_fixup(&data->mtd); -+ if (res) -+ goto out; -+ } -+ -+ if (nand_scan_tail(&data->mtd)) { - res = -ENXIO; - goto out; - } diff --git a/target/linux/generic-2.6/patches-2.6.27/081-mtd_myloader_partition_parser.patch b/target/linux/generic-2.6/patches-2.6.27/081-mtd_myloader_partition_parser.patch deleted file mode 100644 index 7a5addd63..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/081-mtd_myloader_partition_parser.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -172,6 +172,22 @@ config MTD_AR7_PARTS - ---help--- - TI AR7 partitioning support - -+config MTD_MYLOADER_PARTS -+ tristate "MyLoader partition parsing" -+ depends on MTD_PARTITIONS && (ADM5120 || ATHEROS || ATHEROS_AR71XX) -+ ---help--- -+ MyLoader is a bootloader which allows the user to define partitions -+ in flash devices, by putting a table in the second erase block -+ on the device, similar to a partition table. This table gives the -+ offsets and lengths of the user defined partitions. -+ -+ If you need code which can detect and parse these tables, and -+ register MTD 'partitions' corresponding to each image detected, -+ enable this option. -+ -+ You will still need the parsing functions to be called by the driver -+ for your particular device. It won't happen automatically. -+ - comment "User Modules And Translation Layers" - - config MTD_CHAR ---- a/drivers/mtd/Makefile -+++ b/drivers/mtd/Makefile -@@ -13,6 +13,7 @@ obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdli - obj-$(CONFIG_MTD_AFS_PARTS) += afs.o - obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o - obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o -+obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o - - # 'Users' - code which presents functionality to userspace. - obj-$(CONFIG_MTD_CHAR) += mtdchar.o diff --git a/target/linux/generic-2.6/patches-2.6.27/090-ds1672_new_style.patch b/target/linux/generic-2.6/patches-2.6.27/090-ds1672_new_style.patch deleted file mode 100644 index 26c0097d0..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/090-ds1672_new_style.patch +++ /dev/null @@ -1,227 +0,0 @@ -From: Alessandro Zummo -Date: Thu, 16 Oct 2008 05:03:10 +0000 (-0700) -Subject: rtc-ds1672 new style driver -X-Git-Tag: v2.6.28-rc1~429 -X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=1716b0fea36c2be628440c1050182a1a1e9caae7 - -rtc-ds1672 new style driver - -New style conversion and reformatting as per indent --linux-style - -Signed-off-by: Alessandro Zummo -Cc: David Brownell -Signed-off-by: Andrew Morton -Signed-off-by: Linus Torvalds ---- - ---- a/drivers/rtc/rtc-ds1672.c -+++ b/drivers/rtc/rtc-ds1672.c -@@ -9,17 +9,10 @@ - * published by the Free Software Foundation. - */ - --#include - #include - #include - --#define DRV_VERSION "0.3" -- --/* Addresses to scan: none. This chip cannot be detected. */ --static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; -- --/* Insmod parameters */ --I2C_CLIENT_INSMOD; -+#define DRV_VERSION "0.4" - - /* Registers */ - -@@ -29,8 +22,7 @@ I2C_CLIENT_INSMOD; - - #define DS1672_REG_CONTROL_EOSC 0x80 - --/* Prototypes */ --static int ds1672_probe(struct i2c_adapter *adapter, int address, int kind); -+static struct i2c_driver ds1672_driver; - - /* - * In the routines that deal directly with the ds1672 hardware, we use -@@ -44,8 +36,8 @@ static int ds1672_get_datetime(struct i2 - unsigned char buf[4]; - - struct i2c_msg msgs[] = { -- { client->addr, 0, 1, &addr }, /* setup read ptr */ -- { client->addr, I2C_M_RD, 4, buf }, /* read date */ -+ {client->addr, 0, 1, &addr}, /* setup read ptr */ -+ {client->addr, I2C_M_RD, 4, buf}, /* read date */ - }; - - /* read date registers */ -@@ -80,7 +72,7 @@ static int ds1672_set_mmss(struct i2c_cl - buf[2] = (secs & 0x0000FF00) >> 8; - buf[3] = (secs & 0x00FF0000) >> 16; - buf[4] = (secs & 0xFF000000) >> 24; -- buf[5] = 0; /* set control reg to enable counting */ -+ buf[5] = 0; /* set control reg to enable counting */ - - xfer = i2c_master_send(client, buf, 6); - if (xfer != 6) { -@@ -127,8 +119,8 @@ static int ds1672_get_control(struct i2c - unsigned char addr = DS1672_REG_CONTROL; - - struct i2c_msg msgs[] = { -- { client->addr, 0, 1, &addr }, /* setup read ptr */ -- { client->addr, I2C_M_RD, 1, status }, /* read control */ -+ {client->addr, 0, 1, &addr}, /* setup read ptr */ -+ {client->addr, I2C_M_RD, 1, status}, /* read control */ - }; - - /* read control register */ -@@ -141,7 +133,8 @@ static int ds1672_get_control(struct i2c - } - - /* following are the sysfs callback functions */ --static ssize_t show_control(struct device *dev, struct device_attribute *attr, char *buf) -+static ssize_t show_control(struct device *dev, struct device_attribute *attr, -+ char *buf) - { - struct i2c_client *client = to_i2c_client(dev); - u8 control; -@@ -152,85 +145,46 @@ static ssize_t show_control(struct devic - return err; - - return sprintf(buf, "%s\n", (control & DS1672_REG_CONTROL_EOSC) -- ? "disabled" : "enabled"); -+ ? "disabled" : "enabled"); - } -+ - static DEVICE_ATTR(control, S_IRUGO, show_control, NULL); - - static const struct rtc_class_ops ds1672_rtc_ops = { -- .read_time = ds1672_rtc_read_time, -- .set_time = ds1672_rtc_set_time, -- .set_mmss = ds1672_rtc_set_mmss, -+ .read_time = ds1672_rtc_read_time, -+ .set_time = ds1672_rtc_set_time, -+ .set_mmss = ds1672_rtc_set_mmss, - }; - --static int ds1672_attach(struct i2c_adapter *adapter) --{ -- return i2c_probe(adapter, &addr_data, ds1672_probe); --} -- --static int ds1672_detach(struct i2c_client *client) -+static int ds1672_remove(struct i2c_client *client) - { -- int err; - struct rtc_device *rtc = i2c_get_clientdata(client); - -- if (rtc) -+ if (rtc) - rtc_device_unregister(rtc); - -- if ((err = i2c_detach_client(client))) -- return err; -- -- kfree(client); -- - return 0; - } - --static struct i2c_driver ds1672_driver = { -- .driver = { -- .name = "ds1672", -- }, -- .id = I2C_DRIVERID_DS1672, -- .attach_adapter = &ds1672_attach, -- .detach_client = &ds1672_detach, --}; -- --static int ds1672_probe(struct i2c_adapter *adapter, int address, int kind) -+static int ds1672_probe(struct i2c_client *client, -+ const struct i2c_device_id *id) - { - int err = 0; - u8 control; -- struct i2c_client *client; - struct rtc_device *rtc; - -- dev_dbg(&adapter->dev, "%s\n", __func__); -- -- if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) { -- err = -ENODEV; -- goto exit; -- } -- -- if (!(client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL))) { -- err = -ENOMEM; -- goto exit; -- } -+ dev_dbg(&client->dev, "%s\n", __func__); - -- /* I2C client */ -- client->addr = address; -- client->driver = &ds1672_driver; -- client->adapter = adapter; -- -- strlcpy(client->name, ds1672_driver.driver.name, I2C_NAME_SIZE); -- -- /* Inform the i2c layer */ -- if ((err = i2c_attach_client(client))) -- goto exit_kfree; -+ if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) -+ return -ENODEV; - - dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n"); - - rtc = rtc_device_register(ds1672_driver.driver.name, &client->dev, -- &ds1672_rtc_ops, THIS_MODULE); -+ &ds1672_rtc_ops, THIS_MODULE); - -- if (IS_ERR(rtc)) { -- err = PTR_ERR(rtc); -- goto exit_detach; -- } -+ if (IS_ERR(rtc)) -+ return PTR_ERR(rtc); - - i2c_set_clientdata(client, rtc); - -@@ -241,7 +195,7 @@ static int ds1672_probe(struct i2c_adapt - - if (control & DS1672_REG_CONTROL_EOSC) - dev_warn(&client->dev, "Oscillator not enabled. " -- "Set time to enable.\n"); -+ "Set time to enable.\n"); - - /* Register sysfs hooks */ - err = device_create_file(&client->dev, &dev_attr_control); -@@ -250,19 +204,19 @@ static int ds1672_probe(struct i2c_adapt - - return 0; - --exit_devreg: -+ exit_devreg: - rtc_device_unregister(rtc); -- --exit_detach: -- i2c_detach_client(client); -- --exit_kfree: -- kfree(client); -- --exit: - return err; - } - -+static struct i2c_driver ds1672_driver = { -+ .driver = { -+ .name = "rtc-ds1672", -+ }, -+ .probe = &ds1672_probe, -+ .remove = &ds1672_remove, -+}; -+ - static int __init ds1672_init(void) - { - return i2c_add_driver(&ds1672_driver); diff --git a/target/linux/generic-2.6/patches-2.6.27/091-ds1672_missing_id_table.patch b/target/linux/generic-2.6/patches-2.6.27/091-ds1672_missing_id_table.patch deleted file mode 100644 index 78a160c9a..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/091-ds1672_missing_id_table.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/drivers/rtc/rtc-ds1672.c -+++ b/drivers/rtc/rtc-ds1672.c -@@ -209,12 +209,18 @@ static int ds1672_probe(struct i2c_clien - return err; - } - -+static struct i2c_device_id ds1672_id[] = { -+ { "ds1672", 0 }, -+ { } -+}; -+ - static struct i2c_driver ds1672_driver = { - .driver = { - .name = "rtc-ds1672", - }, - .probe = &ds1672_probe, - .remove = &ds1672_remove, -+ .id_table = ds1672_id, - }; - - static int __init ds1672_init(void) diff --git a/target/linux/generic-2.6/patches-2.6.27/100-netfilter_layer7_2.21.patch b/target/linux/generic-2.6/patches-2.6.27/100-netfilter_layer7_2.21.patch deleted file mode 100644 index e70a5fe3f..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/100-netfilter_layer7_2.21.patch +++ /dev/null @@ -1,2132 +0,0 @@ ---- /dev/null -+++ b/include/linux/netfilter/xt_layer7.h -@@ -0,0 +1,13 @@ -+#ifndef _XT_LAYER7_H -+#define _XT_LAYER7_H -+ -+#define MAX_PATTERN_LEN 8192 -+#define MAX_PROTOCOL_LEN 256 -+ -+struct xt_layer7_info { -+ char protocol[MAX_PROTOCOL_LEN]; -+ char pattern[MAX_PATTERN_LEN]; -+ u_int8_t invert; -+}; -+ -+#endif /* _XT_LAYER7_H */ ---- a/include/net/netfilter/nf_conntrack.h -+++ b/include/net/netfilter/nf_conntrack.h -@@ -118,6 +118,22 @@ struct nf_conn - u_int32_t secmark; - #endif - -+#if defined(CONFIG_NETFILTER_XT_MATCH_LAYER7) || \ -+ defined(CONFIG_NETFILTER_XT_MATCH_LAYER7_MODULE) -+ struct { -+ /* -+ * e.g. "http". NULL before decision. "unknown" after decision -+ * if no match. -+ */ -+ char *app_proto; -+ /* -+ * application layer data so far. NULL after match decision. -+ */ -+ char *app_data; -+ unsigned int app_data_len; -+ } layer7; -+#endif -+ - /* Storage reserved for other modules: */ - union nf_conntrack_proto proto; - ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -757,6 +757,27 @@ config NETFILTER_XT_MATCH_STATE - - To compile it as a module, choose M here. If unsure, say N. - -+config NETFILTER_XT_MATCH_LAYER7 -+ tristate '"layer7" match support' -+ depends on NETFILTER_XTABLES -+ depends on EXPERIMENTAL && (IP_NF_CONNTRACK || NF_CONNTRACK) -+ depends on NF_CT_ACCT -+ help -+ Say Y if you want to be able to classify connections (and their -+ packets) based on regular expression matching of their application -+ layer data. This is one way to classify applications such as -+ peer-to-peer filesharing systems that do not always use the same -+ port. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ -+config NETFILTER_XT_MATCH_LAYER7_DEBUG -+ bool 'Layer 7 debugging output' -+ depends on NETFILTER_XT_MATCH_LAYER7 -+ help -+ Say Y to get lots of debugging output. -+ -+ - config NETFILTER_XT_MATCH_STATISTIC - tristate '"statistic" match support' - depends on NETFILTER_XTABLES ---- a/net/netfilter/Makefile -+++ b/net/netfilter/Makefile -@@ -78,6 +78,7 @@ obj-$(CONFIG_NETFILTER_XT_MATCH_RATEEST) - obj-$(CONFIG_NETFILTER_XT_MATCH_REALM) += xt_realm.o - obj-$(CONFIG_NETFILTER_XT_MATCH_SCTP) += xt_sctp.o - obj-$(CONFIG_NETFILTER_XT_MATCH_STATE) += xt_state.o -+obj-$(CONFIG_NETFILTER_XT_MATCH_LAYER7) += xt_layer7.o - obj-$(CONFIG_NETFILTER_XT_MATCH_STATISTIC) += xt_statistic.o - obj-$(CONFIG_NETFILTER_XT_MATCH_STRING) += xt_string.o - obj-$(CONFIG_NETFILTER_XT_MATCH_TCPMSS) += xt_tcpmss.o ---- a/net/netfilter/nf_conntrack_core.c -+++ b/net/netfilter/nf_conntrack_core.c -@@ -206,6 +206,14 @@ destroy_conntrack(struct nf_conntrack *n - * too. */ - nf_ct_remove_expectations(ct); - -+ #if defined(CONFIG_NETFILTER_XT_MATCH_LAYER7) || defined(CONFIG_NETFILTER_XT_MATCH_LAYER7_MODULE) -+ if(ct->layer7.app_proto) -+ kfree(ct->layer7.app_proto); -+ if(ct->layer7.app_data) -+ kfree(ct->layer7.app_data); -+ #endif -+ -+ - /* We overload first tuple to link into unconfirmed list. */ - if (!nf_ct_is_confirmed(ct)) { - BUG_ON(hlist_unhashed(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnode)); ---- a/net/netfilter/nf_conntrack_standalone.c -+++ b/net/netfilter/nf_conntrack_standalone.c -@@ -162,6 +162,12 @@ static int ct_seq_show(struct seq_file * - return -ENOSPC; - #endif - -+#if defined(CONFIG_NETFILTER_XT_MATCH_LAYER7) || defined(CONFIG_NETFILTER_XT_MATCH_LAYER7_MODULE) -+ if(ct->layer7.app_proto && -+ seq_printf(s, "l7proto=%s ", ct->layer7.app_proto)) -+ return -ENOSPC; -+#endif -+ - if (seq_printf(s, "use=%u\n", atomic_read(&ct->ct_general.use))) - return -ENOSPC; - ---- /dev/null -+++ b/net/netfilter/regexp/regexp.c -@@ -0,0 +1,1197 @@ -+/* -+ * regcomp and regexec -- regsub and regerror are elsewhere -+ * @(#)regexp.c 1.3 of 18 April 87 -+ * -+ * Copyright (c) 1986 by University of Toronto. -+ * Written by Henry Spencer. Not derived from licensed software. -+ * -+ * Permission is granted to anyone to use this software for any -+ * purpose on any computer system, and to redistribute it freely, -+ * subject to the following restrictions: -+ * -+ * 1. The author is not responsible for the consequences of use of -+ * this software, no matter how awful, even if they arise -+ * from defects in it. -+ * -+ * 2. The origin of this software must not be misrepresented, either -+ * by explicit claim or by omission. -+ * -+ * 3. Altered versions must be plainly marked as such, and must not -+ * be misrepresented as being the original software. -+ * -+ * Beware that some of this code is subtly aware of the way operator -+ * precedence is structured in regular expressions. Serious changes in -+ * regular-expression syntax might require a total rethink. -+ * -+ * This code was modified by Ethan Sommer to work within the kernel -+ * (it now uses kmalloc etc..) -+ * -+ * Modified slightly by Matthew Strait to use more modern C. -+ */ -+ -+#include "regexp.h" -+#include "regmagic.h" -+ -+/* added by ethan and matt. Lets it work in both kernel and user space. -+(So iptables can use it, for instance.) Yea, it goes both ways... */ -+#if __KERNEL__ -+ #define malloc(foo) kmalloc(foo,GFP_ATOMIC) -+#else -+ #define printk(format,args...) printf(format,##args) -+#endif -+ -+void regerror(char * s) -+{ -+ printk("<3>Regexp: %s\n", s); -+ /* NOTREACHED */ -+} -+ -+/* -+ * The "internal use only" fields in regexp.h are present to pass info from -+ * compile to execute that permits the execute phase to run lots faster on -+ * simple cases. They are: -+ * -+ * regstart char that must begin a match; '\0' if none obvious -+ * reganch is the match anchored (at beginning-of-line only)? -+ * regmust string (pointer into program) that match must include, or NULL -+ * regmlen length of regmust string -+ * -+ * Regstart and reganch permit very fast decisions on suitable starting points -+ * for a match, cutting down the work a lot. Regmust permits fast rejection -+ * of lines that cannot possibly match. The regmust tests are costly enough -+ * that regcomp() supplies a regmust only if the r.e. contains something -+ * potentially expensive (at present, the only such thing detected is * or + -+ * at the start of the r.e., which can involve a lot of backup). Regmlen is -+ * supplied because the test in regexec() needs it and regcomp() is computing -+ * it anyway. -+ */ -+ -+/* -+ * Structure for regexp "program". This is essentially a linear encoding -+ * of a nondeterministic finite-state machine (aka syntax charts or -+ * "railroad normal form" in parsing technology). Each node is an opcode -+ * plus a "next" pointer, possibly plus an operand. "Next" pointers of -+ * all nodes except BRANCH implement concatenation; a "next" pointer with -+ * a BRANCH on both ends of it is connecting two alternatives. (Here we -+ * have one of the subtle syntax dependencies: an individual BRANCH (as -+ * opposed to a collection of them) is never concatenated with anything -+ * because of operator precedence.) The operand of some types of node is -+ * a literal string; for others, it is a node leading into a sub-FSM. In -+ * particular, the operand of a BRANCH node is the first node of the branch. -+ * (NB this is *not* a tree structure: the tail of the branch connects -+ * to the thing following the set of BRANCHes.) The opcodes are: -+ */ -+ -+/* definition number opnd? meaning */ -+#define END 0 /* no End of program. */ -+#define BOL 1 /* no Match "" at beginning of line. */ -+#define EOL 2 /* no Match "" at end of line. */ -+#define ANY 3 /* no Match any one character. */ -+#define ANYOF 4 /* str Match any character in this string. */ -+#define ANYBUT 5 /* str Match any character not in this string. */ -+#define BRANCH 6 /* node Match this alternative, or the next... */ -+#define BACK 7 /* no Match "", "next" ptr points backward. */ -+#define EXACTLY 8 /* str Match this string. */ -+#define NOTHING 9 /* no Match empty string. */ -+#define STAR 10 /* node Match this (simple) thing 0 or more times. */ -+#define PLUS 11 /* node Match this (simple) thing 1 or more times. */ -+#define OPEN 20 /* no Mark this point in input as start of #n. */ -+ /* OPEN+1 is number 1, etc. */ -+#define CLOSE 30 /* no Analogous to OPEN. */ -+ -+/* -+ * Opcode notes: -+ * -+ * BRANCH The set of branches constituting a single choice are hooked -+ * together with their "next" pointers, since precedence prevents -+ * anything being concatenated to any individual branch. The -+ * "next" pointer of the last BRANCH in a choice points to the -+ * thing following the whole choice. This is also where the -+ * final "next" pointer of each individual branch points; each -+ * branch starts with the operand node of a BRANCH node. -+ * -+ * BACK Normal "next" pointers all implicitly point forward; BACK -+ * exists to make loop structures possible. -+ * -+ * STAR,PLUS '?', and complex '*' and '+', are implemented as circular -+ * BRANCH structures using BACK. Simple cases (one character -+ * per match) are implemented with STAR and PLUS for speed -+ * and to minimize recursive plunges. -+ * -+ * OPEN,CLOSE ...are numbered at compile time. -+ */ -+ -+/* -+ * A node is one char of opcode followed by two chars of "next" pointer. -+ * "Next" pointers are stored as two 8-bit pieces, high order first. The -+ * value is a positive offset from the opcode of the node containing it. -+ * An operand, if any, simply follows the node. (Note that much of the -+ * code generation knows about this implicit relationship.) -+ * -+ * Using two bytes for the "next" pointer is vast overkill for most things, -+ * but allows patterns to get big without disasters. -+ */ -+#define OP(p) (*(p)) -+#define NEXT(p) (((*((p)+1)&0377)<<8) + (*((p)+2)&0377)) -+#define OPERAND(p) ((p) + 3) -+ -+/* -+ * See regmagic.h for one further detail of program structure. -+ */ -+ -+ -+/* -+ * Utility definitions. -+ */ -+#ifndef CHARBITS -+#define UCHARAT(p) ((int)*(unsigned char *)(p)) -+#else -+#define UCHARAT(p) ((int)*(p)&CHARBITS) -+#endif -+ -+#define FAIL(m) { regerror(m); return(NULL); } -+#define ISMULT(c) ((c) == '*' || (c) == '+' || (c) == '?') -+#define META "^$.[()|?+*\\" -+ -+/* -+ * Flags to be passed up and down. -+ */ -+#define HASWIDTH 01 /* Known never to match null string. */ -+#define SIMPLE 02 /* Simple enough to be STAR/PLUS operand. */ -+#define SPSTART 04 /* Starts with * or +. */ -+#define WORST 0 /* Worst case. */ -+ -+/* -+ * Global work variables for regcomp(). -+ */ -+struct match_globals { -+char *reginput; /* String-input pointer. */ -+char *regbol; /* Beginning of input, for ^ check. */ -+char **regstartp; /* Pointer to startp array. */ -+char **regendp; /* Ditto for endp. */ -+char *regparse; /* Input-scan pointer. */ -+int regnpar; /* () count. */ -+char regdummy; -+char *regcode; /* Code-emit pointer; ®dummy = don't. */ -+long regsize; /* Code size. */ -+}; -+ -+/* -+ * Forward declarations for regcomp()'s friends. -+ */ -+#ifndef STATIC -+#define STATIC static -+#endif -+STATIC char *reg(struct match_globals *g, int paren,int *flagp); -+STATIC char *regbranch(struct match_globals *g, int *flagp); -+STATIC char *regpiece(struct match_globals *g, int *flagp); -+STATIC char *regatom(struct match_globals *g, int *flagp); -+STATIC char *regnode(struct match_globals *g, char op); -+STATIC char *regnext(struct match_globals *g, char *p); -+STATIC void regc(struct match_globals *g, char b); -+STATIC void reginsert(struct match_globals *g, char op, char *opnd); -+STATIC void regtail(struct match_globals *g, char *p, char *val); -+STATIC void regoptail(struct match_globals *g, char *p, char *val); -+ -+ -+__kernel_size_t my_strcspn(const char *s1,const char *s2) -+{ -+ char *scan1; -+ char *scan2; -+ int count; -+ -+ count = 0; -+ for (scan1 = (char *)s1; *scan1 != '\0'; scan1++) { -+ for (scan2 = (char *)s2; *scan2 != '\0';) /* ++ moved down. */ -+ if (*scan1 == *scan2++) -+ return(count); -+ count++; -+ } -+ return(count); -+} -+ -+/* -+ - regcomp - compile a regular expression into internal code -+ * -+ * We can't allocate space until we know how big the compiled form will be, -+ * but we can't compile it (and thus know how big it is) until we've got a -+ * place to put the code. So we cheat: we compile it twice, once with code -+ * generation turned off and size counting turned on, and once "for real". -+ * This also means that we don't allocate space until we are sure that the -+ * thing really will compile successfully, and we never have to move the -+ * code and thus invalidate pointers into it. (Note that it has to be in -+ * one piece because free() must be able to free it all.) -+ * -+ * Beware that the optimization-preparation code in here knows about some -+ * of the structure of the compiled regexp. -+ */ -+regexp * -+regcomp(char *exp,int *patternsize) -+{ -+ register regexp *r; -+ register char *scan; -+ register char *longest; -+ register int len; -+ int flags; -+ struct match_globals g; -+ -+ /* commented out by ethan -+ extern char *malloc(); -+ */ -+ -+ if (exp == NULL) -+ FAIL("NULL argument"); -+ -+ /* First pass: determine size, legality. */ -+ g.regparse = exp; -+ g.regnpar = 1; -+ g.regsize = 0L; -+ g.regcode = &g.regdummy; -+ regc(&g, MAGIC); -+ if (reg(&g, 0, &flags) == NULL) -+ return(NULL); -+ -+ /* Small enough for pointer-storage convention? */ -+ if (g.regsize >= 32767L) /* Probably could be 65535L. */ -+ FAIL("regexp too big"); -+ -+ /* Allocate space. */ -+ *patternsize=sizeof(regexp) + (unsigned)g.regsize; -+ r = (regexp *)malloc(sizeof(regexp) + (unsigned)g.regsize); -+ if (r == NULL) -+ FAIL("out of space"); -+ -+ /* Second pass: emit code. */ -+ g.regparse = exp; -+ g.regnpar = 1; -+ g.regcode = r->program; -+ regc(&g, MAGIC); -+ if (reg(&g, 0, &flags) == NULL) -+ return(NULL); -+ -+ /* Dig out information for optimizations. */ -+ r->regstart = '\0'; /* Worst-case defaults. */ -+ r->reganch = 0; -+ r->regmust = NULL; -+ r->regmlen = 0; -+ scan = r->program+1; /* First BRANCH. */ -+ if (OP(regnext(&g, scan)) == END) { /* Only one top-level choice. */ -+ scan = OPERAND(scan); -+ -+ /* Starting-point info. */ -+ if (OP(scan) == EXACTLY) -+ r->regstart = *OPERAND(scan); -+ else if (OP(scan) == BOL) -+ r->reganch++; -+ -+ /* -+ * If there's something expensive in the r.e., find the -+ * longest literal string that must appear and make it the -+ * regmust. Resolve ties in favor of later strings, since -+ * the regstart check works with the beginning of the r.e. -+ * and avoiding duplication strengthens checking. Not a -+ * strong reason, but sufficient in the absence of others. -+ */ -+ if (flags&SPSTART) { -+ longest = NULL; -+ len = 0; -+ for (; scan != NULL; scan = regnext(&g, scan)) -+ if (OP(scan) == EXACTLY && strlen(OPERAND(scan)) >= len) { -+ longest = OPERAND(scan); -+ len = strlen(OPERAND(scan)); -+ } -+ r->regmust = longest; -+ r->regmlen = len; -+ } -+ } -+ -+ return(r); -+} -+ -+/* -+ - reg - regular expression, i.e. main body or parenthesized thing -+ * -+ * Caller must absorb opening parenthesis. -+ * -+ * Combining parenthesis handling with the base level of regular expression -+ * is a trifle forced, but the need to tie the tails of the branches to what -+ * follows makes it hard to avoid. -+ */ -+static char * -+reg(struct match_globals *g, int paren, int *flagp /* Parenthesized? */ ) -+{ -+ register char *ret; -+ register char *br; -+ register char *ender; -+ register int parno = 0; /* 0 makes gcc happy */ -+ int flags; -+ -+ *flagp = HASWIDTH; /* Tentatively. */ -+ -+ /* Make an OPEN node, if parenthesized. */ -+ if (paren) { -+ if (g->regnpar >= NSUBEXP) -+ FAIL("too many ()"); -+ parno = g->regnpar; -+ g->regnpar++; -+ ret = regnode(g, OPEN+parno); -+ } else -+ ret = NULL; -+ -+ /* Pick up the branches, linking them together. */ -+ br = regbranch(g, &flags); -+ if (br == NULL) -+ return(NULL); -+ if (ret != NULL) -+ regtail(g, ret, br); /* OPEN -> first. */ -+ else -+ ret = br; -+ if (!(flags&HASWIDTH)) -+ *flagp &= ~HASWIDTH; -+ *flagp |= flags&SPSTART; -+ while (*g->regparse == '|') { -+ g->regparse++; -+ br = regbranch(g, &flags); -+ if (br == NULL) -+ return(NULL); -+ regtail(g, ret, br); /* BRANCH -> BRANCH. */ -+ if (!(flags&HASWIDTH)) -+ *flagp &= ~HASWIDTH; -+ *flagp |= flags&SPSTART; -+ } -+ -+ /* Make a closing node, and hook it on the end. */ -+ ender = regnode(g, (paren) ? CLOSE+parno : END); -+ regtail(g, ret, ender); -+ -+ /* Hook the tails of the branches to the closing node. */ -+ for (br = ret; br != NULL; br = regnext(g, br)) -+ regoptail(g, br, ender); -+ -+ /* Check for proper termination. */ -+ if (paren && *g->regparse++ != ')') { -+ FAIL("unmatched ()"); -+ } else if (!paren && *g->regparse != '\0') { -+ if (*g->regparse == ')') { -+ FAIL("unmatched ()"); -+ } else -+ FAIL("junk on end"); /* "Can't happen". */ -+ /* NOTREACHED */ -+ } -+ -+ return(ret); -+} -+ -+/* -+ - regbranch - one alternative of an | operator -+ * -+ * Implements the concatenation operator. -+ */ -+static char * -+regbranch(struct match_globals *g, int *flagp) -+{ -+ register char *ret; -+ register char *chain; -+ register char *latest; -+ int flags; -+ -+ *flagp = WORST; /* Tentatively. */ -+ -+ ret = regnode(g, BRANCH); -+ chain = NULL; -+ while (*g->regparse != '\0' && *g->regparse != '|' && *g->regparse != ')') { -+ latest = regpiece(g, &flags); -+ if (latest == NULL) -+ return(NULL); -+ *flagp |= flags&HASWIDTH; -+ if (chain == NULL) /* First piece. */ -+ *flagp |= flags&SPSTART; -+ else -+ regtail(g, chain, latest); -+ chain = latest; -+ } -+ if (chain == NULL) /* Loop ran zero times. */ -+ (void) regnode(g, NOTHING); -+ -+ return(ret); -+} -+ -+/* -+ - regpiece - something followed by possible [*+?] -+ * -+ * Note that the branching code sequences used for ? and the general cases -+ * of * and + are somewhat optimized: they use the same NOTHING node as -+ * both the endmarker for their branch list and the body of the last branch. -+ * It might seem that this node could be dispensed with entirely, but the -+ * endmarker role is not redundant. -+ */ -+static char * -+regpiece(struct match_globals *g, int *flagp) -+{ -+ register char *ret; -+ register char op; -+ register char *next; -+ int flags; -+ -+ ret = regatom(g, &flags); -+ if (ret == NULL) -+ return(NULL); -+ -+ op = *g->regparse; -+ if (!ISMULT(op)) { -+ *flagp = flags; -+ return(ret); -+ } -+ -+ if (!(flags&HASWIDTH) && op != '?') -+ FAIL("*+ operand could be empty"); -+ *flagp = (op != '+') ? (WORST|SPSTART) : (WORST|HASWIDTH); -+ -+ if (op == '*' && (flags&SIMPLE)) -+ reginsert(g, STAR, ret); -+ else if (op == '*') { -+ /* Emit x* as (x&|), where & means "self". */ -+ reginsert(g, BRANCH, ret); /* Either x */ -+ regoptail(g, ret, regnode(g, BACK)); /* and loop */ -+ regoptail(g, ret, ret); /* back */ -+ regtail(g, ret, regnode(g, BRANCH)); /* or */ -+ regtail(g, ret, regnode(g, NOTHING)); /* null. */ -+ } else if (op == '+' && (flags&SIMPLE)) -+ reginsert(g, PLUS, ret); -+ else if (op == '+') { -+ /* Emit x+ as x(&|), where & means "self". */ -+ next = regnode(g, BRANCH); /* Either */ -+ regtail(g, ret, next); -+ regtail(g, regnode(g, BACK), ret); /* loop back */ -+ regtail(g, next, regnode(g, BRANCH)); /* or */ -+ regtail(g, ret, regnode(g, NOTHING)); /* null. */ -+ } else if (op == '?') { -+ /* Emit x? as (x|) */ -+ reginsert(g, BRANCH, ret); /* Either x */ -+ regtail(g, ret, regnode(g, BRANCH)); /* or */ -+ next = regnode(g, NOTHING); /* null. */ -+ regtail(g, ret, next); -+ regoptail(g, ret, next); -+ } -+ g->regparse++; -+ if (ISMULT(*g->regparse)) -+ FAIL("nested *?+"); -+ -+ return(ret); -+} -+ -+/* -+ - regatom - the lowest level -+ * -+ * Optimization: gobbles an entire sequence of ordinary characters so that -+ * it can turn them into a single node, which is smaller to store and -+ * faster to run. Backslashed characters are exceptions, each becoming a -+ * separate node; the code is simpler that way and it's not worth fixing. -+ */ -+static char * -+regatom(struct match_globals *g, int *flagp) -+{ -+ register char *ret; -+ int flags; -+ -+ *flagp = WORST; /* Tentatively. */ -+ -+ switch (*g->regparse++) { -+ case '^': -+ ret = regnode(g, BOL); -+ break; -+ case '$': -+ ret = regnode(g, EOL); -+ break; -+ case '.': -+ ret = regnode(g, ANY); -+ *flagp |= HASWIDTH|SIMPLE; -+ break; -+ case '[': { -+ register int class; -+ register int classend; -+ -+ if (*g->regparse == '^') { /* Complement of range. */ -+ ret = regnode(g, ANYBUT); -+ g->regparse++; -+ } else -+ ret = regnode(g, ANYOF); -+ if (*g->regparse == ']' || *g->regparse == '-') -+ regc(g, *g->regparse++); -+ while (*g->regparse != '\0' && *g->regparse != ']') { -+ if (*g->regparse == '-') { -+ g->regparse++; -+ if (*g->regparse == ']' || *g->regparse == '\0') -+ regc(g, '-'); -+ else { -+ class = UCHARAT(g->regparse-2)+1; -+ classend = UCHARAT(g->regparse); -+ if (class > classend+1) -+ FAIL("invalid [] range"); -+ for (; class <= classend; class++) -+ regc(g, class); -+ g->regparse++; -+ } -+ } else -+ regc(g, *g->regparse++); -+ } -+ regc(g, '\0'); -+ if (*g->regparse != ']') -+ FAIL("unmatched []"); -+ g->regparse++; -+ *flagp |= HASWIDTH|SIMPLE; -+ } -+ break; -+ case '(': -+ ret = reg(g, 1, &flags); -+ if (ret == NULL) -+ return(NULL); -+ *flagp |= flags&(HASWIDTH|SPSTART); -+ break; -+ case '\0': -+ case '|': -+ case ')': -+ FAIL("internal urp"); /* Supposed to be caught earlier. */ -+ break; -+ case '?': -+ case '+': -+ case '*': -+ FAIL("?+* follows nothing"); -+ break; -+ case '\\': -+ if (*g->regparse == '\0') -+ FAIL("trailing \\"); -+ ret = regnode(g, EXACTLY); -+ regc(g, *g->regparse++); -+ regc(g, '\0'); -+ *flagp |= HASWIDTH|SIMPLE; -+ break; -+ default: { -+ register int len; -+ register char ender; -+ -+ g->regparse--; -+ len = my_strcspn((const char *)g->regparse, (const char *)META); -+ if (len <= 0) -+ FAIL("internal disaster"); -+ ender = *(g->regparse+len); -+ if (len > 1 && ISMULT(ender)) -+ len--; /* Back off clear of ?+* operand. */ -+ *flagp |= HASWIDTH; -+ if (len == 1) -+ *flagp |= SIMPLE; -+ ret = regnode(g, EXACTLY); -+ while (len > 0) { -+ regc(g, *g->regparse++); -+ len--; -+ } -+ regc(g, '\0'); -+ } -+ break; -+ } -+ -+ return(ret); -+} -+ -+/* -+ - regnode - emit a node -+ */ -+static char * /* Location. */ -+regnode(struct match_globals *g, char op) -+{ -+ register char *ret; -+ register char *ptr; -+ -+ ret = g->regcode; -+ if (ret == &g->regdummy) { -+ g->regsize += 3; -+ return(ret); -+ } -+ -+ ptr = ret; -+ *ptr++ = op; -+ *ptr++ = '\0'; /* Null "next" pointer. */ -+ *ptr++ = '\0'; -+ g->regcode = ptr; -+ -+ return(ret); -+} -+ -+/* -+ - regc - emit (if appropriate) a byte of code -+ */ -+static void -+regc(struct match_globals *g, char b) -+{ -+ if (g->regcode != &g->regdummy) -+ *g->regcode++ = b; -+ else -+ g->regsize++; -+} -+ -+/* -+ - reginsert - insert an operator in front of already-emitted operand -+ * -+ * Means relocating the operand. -+ */ -+static void -+reginsert(struct match_globals *g, char op, char* opnd) -+{ -+ register char *src; -+ register char *dst; -+ register char *place; -+ -+ if (g->regcode == &g->regdummy) { -+ g->regsize += 3; -+ return; -+ } -+ -+ src = g->regcode; -+ g->regcode += 3; -+ dst = g->regcode; -+ while (src > opnd) -+ *--dst = *--src; -+ -+ place = opnd; /* Op node, where operand used to be. */ -+ *place++ = op; -+ *place++ = '\0'; -+ *place++ = '\0'; -+} -+ -+/* -+ - regtail - set the next-pointer at the end of a node chain -+ */ -+static void -+regtail(struct match_globals *g, char *p, char *val) -+{ -+ register char *scan; -+ register char *temp; -+ register int offset; -+ -+ if (p == &g->regdummy) -+ return; -+ -+ /* Find last node. */ -+ scan = p; -+ for (;;) { -+ temp = regnext(g, scan); -+ if (temp == NULL) -+ break; -+ scan = temp; -+ } -+ -+ if (OP(scan) == BACK) -+ offset = scan - val; -+ else -+ offset = val - scan; -+ *(scan+1) = (offset>>8)&0377; -+ *(scan+2) = offset&0377; -+} -+ -+/* -+ - regoptail - regtail on operand of first argument; nop if operandless -+ */ -+static void -+regoptail(struct match_globals *g, char *p, char *val) -+{ -+ /* "Operandless" and "op != BRANCH" are synonymous in practice. */ -+ if (p == NULL || p == &g->regdummy || OP(p) != BRANCH) -+ return; -+ regtail(g, OPERAND(p), val); -+} -+ -+/* -+ * regexec and friends -+ */ -+ -+ -+/* -+ * Forwards. -+ */ -+STATIC int regtry(struct match_globals *g, regexp *prog, char *string); -+STATIC int regmatch(struct match_globals *g, char *prog); -+STATIC int regrepeat(struct match_globals *g, char *p); -+ -+#ifdef DEBUG -+int regnarrate = 0; -+void regdump(); -+STATIC char *regprop(char *op); -+#endif -+ -+/* -+ - regexec - match a regexp against a string -+ */ -+int -+regexec(regexp *prog, char *string) -+{ -+ register char *s; -+ struct match_globals g; -+ -+ /* Be paranoid... */ -+ if (prog == NULL || string == NULL) { -+ printk("<3>Regexp: NULL parameter\n"); -+ return(0); -+ } -+ -+ /* Check validity of program. */ -+ if (UCHARAT(prog->program) != MAGIC) { -+ printk("<3>Regexp: corrupted program\n"); -+ return(0); -+ } -+ -+ /* If there is a "must appear" string, look for it. */ -+ if (prog->regmust != NULL) { -+ s = string; -+ while ((s = strchr(s, prog->regmust[0])) != NULL) { -+ if (strncmp(s, prog->regmust, prog->regmlen) == 0) -+ break; /* Found it. */ -+ s++; -+ } -+ if (s == NULL) /* Not present. */ -+ return(0); -+ } -+ -+ /* Mark beginning of line for ^ . */ -+ g.regbol = string; -+ -+ /* Simplest case: anchored match need be tried only once. */ -+ if (prog->reganch) -+ return(regtry(&g, prog, string)); -+ -+ /* Messy cases: unanchored match. */ -+ s = string; -+ if (prog->regstart != '\0') -+ /* We know what char it must start with. */ -+ while ((s = strchr(s, prog->regstart)) != NULL) { -+ if (regtry(&g, prog, s)) -+ return(1); -+ s++; -+ } -+ else -+ /* We don't -- general case. */ -+ do { -+ if (regtry(&g, prog, s)) -+ return(1); -+ } while (*s++ != '\0'); -+ -+ /* Failure. */ -+ return(0); -+} -+ -+/* -+ - regtry - try match at specific point -+ */ -+static int /* 0 failure, 1 success */ -+regtry(struct match_globals *g, regexp *prog, char *string) -+{ -+ register int i; -+ register char **sp; -+ register char **ep; -+ -+ g->reginput = string; -+ g->regstartp = prog->startp; -+ g->regendp = prog->endp; -+ -+ sp = prog->startp; -+ ep = prog->endp; -+ for (i = NSUBEXP; i > 0; i--) { -+ *sp++ = NULL; -+ *ep++ = NULL; -+ } -+ if (regmatch(g, prog->program + 1)) { -+ prog->startp[0] = string; -+ prog->endp[0] = g->reginput; -+ return(1); -+ } else -+ return(0); -+} -+ -+/* -+ - regmatch - main matching routine -+ * -+ * Conceptually the strategy is simple: check to see whether the current -+ * node matches, call self recursively to see whether the rest matches, -+ * and then act accordingly. In practice we make some effort to avoid -+ * recursion, in particular by going through "ordinary" nodes (that don't -+ * need to know whether the rest of the match failed) by a loop instead of -+ * by recursion. -+ */ -+static int /* 0 failure, 1 success */ -+regmatch(struct match_globals *g, char *prog) -+{ -+ register char *scan = prog; /* Current node. */ -+ char *next; /* Next node. */ -+ -+#ifdef DEBUG -+ if (scan != NULL && regnarrate) -+ fprintf(stderr, "%s(\n", regprop(scan)); -+#endif -+ while (scan != NULL) { -+#ifdef DEBUG -+ if (regnarrate) -+ fprintf(stderr, "%s...\n", regprop(scan)); -+#endif -+ next = regnext(g, scan); -+ -+ switch (OP(scan)) { -+ case BOL: -+ if (g->reginput != g->regbol) -+ return(0); -+ break; -+ case EOL: -+ if (*g->reginput != '\0') -+ return(0); -+ break; -+ case ANY: -+ if (*g->reginput == '\0') -+ return(0); -+ g->reginput++; -+ break; -+ case EXACTLY: { -+ register int len; -+ register char *opnd; -+ -+ opnd = OPERAND(scan); -+ /* Inline the first character, for speed. */ -+ if (*opnd != *g->reginput) -+ return(0); -+ len = strlen(opnd); -+ if (len > 1 && strncmp(opnd, g->reginput, len) != 0) -+ return(0); -+ g->reginput += len; -+ } -+ break; -+ case ANYOF: -+ if (*g->reginput == '\0' || strchr(OPERAND(scan), *g->reginput) == NULL) -+ return(0); -+ g->reginput++; -+ break; -+ case ANYBUT: -+ if (*g->reginput == '\0' || strchr(OPERAND(scan), *g->reginput) != NULL) -+ return(0); -+ g->reginput++; -+ break; -+ case NOTHING: -+ case BACK: -+ break; -+ case OPEN+1: -+ case OPEN+2: -+ case OPEN+3: -+ case OPEN+4: -+ case OPEN+5: -+ case OPEN+6: -+ case OPEN+7: -+ case OPEN+8: -+ case OPEN+9: { -+ register int no; -+ register char *save; -+ -+ no = OP(scan) - OPEN; -+ save = g->reginput; -+ -+ if (regmatch(g, next)) { -+ /* -+ * Don't set startp if some later -+ * invocation of the same parentheses -+ * already has. -+ */ -+ if (g->regstartp[no] == NULL) -+ g->regstartp[no] = save; -+ return(1); -+ } else -+ return(0); -+ } -+ break; -+ case CLOSE+1: -+ case CLOSE+2: -+ case CLOSE+3: -+ case CLOSE+4: -+ case CLOSE+5: -+ case CLOSE+6: -+ case CLOSE+7: -+ case CLOSE+8: -+ case CLOSE+9: -+ { -+ register int no; -+ register char *save; -+ -+ no = OP(scan) - CLOSE; -+ save = g->reginput; -+ -+ if (regmatch(g, next)) { -+ /* -+ * Don't set endp if some later -+ * invocation of the same parentheses -+ * already has. -+ */ -+ if (g->regendp[no] == NULL) -+ g->regendp[no] = save; -+ return(1); -+ } else -+ return(0); -+ } -+ break; -+ case BRANCH: { -+ register char *save; -+ -+ if (OP(next) != BRANCH) /* No choice. */ -+ next = OPERAND(scan); /* Avoid recursion. */ -+ else { -+ do { -+ save = g->reginput; -+ if (regmatch(g, OPERAND(scan))) -+ return(1); -+ g->reginput = save; -+ scan = regnext(g, scan); -+ } while (scan != NULL && OP(scan) == BRANCH); -+ return(0); -+ /* NOTREACHED */ -+ } -+ } -+ break; -+ case STAR: -+ case PLUS: { -+ register char nextch; -+ register int no; -+ register char *save; -+ register int min; -+ -+ /* -+ * Lookahead to avoid useless match attempts -+ * when we know what character comes next. -+ */ -+ nextch = '\0'; -+ if (OP(next) == EXACTLY) -+ nextch = *OPERAND(next); -+ min = (OP(scan) == STAR) ? 0 : 1; -+ save = g->reginput; -+ no = regrepeat(g, OPERAND(scan)); -+ while (no >= min) { -+ /* If it could work, try it. */ -+ if (nextch == '\0' || *g->reginput == nextch) -+ if (regmatch(g, next)) -+ return(1); -+ /* Couldn't or didn't -- back up. */ -+ no--; -+ g->reginput = save + no; -+ } -+ return(0); -+ } -+ break; -+ case END: -+ return(1); /* Success! */ -+ break; -+ default: -+ printk("<3>Regexp: memory corruption\n"); -+ return(0); -+ break; -+ } -+ -+ scan = next; -+ } -+ -+ /* -+ * We get here only if there's trouble -- normally "case END" is -+ * the terminating point. -+ */ -+ printk("<3>Regexp: corrupted pointers\n"); -+ return(0); -+} -+ -+/* -+ - regrepeat - repeatedly match something simple, report how many -+ */ -+static int -+regrepeat(struct match_globals *g, char *p) -+{ -+ register int count = 0; -+ register char *scan; -+ register char *opnd; -+ -+ scan = g->reginput; -+ opnd = OPERAND(p); -+ switch (OP(p)) { -+ case ANY: -+ count = strlen(scan); -+ scan += count; -+ break; -+ case EXACTLY: -+ while (*opnd == *scan) { -+ count++; -+ scan++; -+ } -+ break; -+ case ANYOF: -+ while (*scan != '\0' && strchr(opnd, *scan) != NULL) { -+ count++; -+ scan++; -+ } -+ break; -+ case ANYBUT: -+ while (*scan != '\0' && strchr(opnd, *scan) == NULL) { -+ count++; -+ scan++; -+ } -+ break; -+ default: /* Oh dear. Called inappropriately. */ -+ printk("<3>Regexp: internal foulup\n"); -+ count = 0; /* Best compromise. */ -+ break; -+ } -+ g->reginput = scan; -+ -+ return(count); -+} -+ -+/* -+ - regnext - dig the "next" pointer out of a node -+ */ -+static char* -+regnext(struct match_globals *g, char *p) -+{ -+ register int offset; -+ -+ if (p == &g->regdummy) -+ return(NULL); -+ -+ offset = NEXT(p); -+ if (offset == 0) -+ return(NULL); -+ -+ if (OP(p) == BACK) -+ return(p-offset); -+ else -+ return(p+offset); -+} -+ -+#ifdef DEBUG -+ -+STATIC char *regprop(); -+ -+/* -+ - regdump - dump a regexp onto stdout in vaguely comprehensible form -+ */ -+void -+regdump(regexp *r) -+{ -+ register char *s; -+ register char op = EXACTLY; /* Arbitrary non-END op. */ -+ register char *next; -+ /* extern char *strchr(); */ -+ -+ -+ s = r->program + 1; -+ while (op != END) { /* While that wasn't END last time... */ -+ op = OP(s); -+ printf("%2d%s", s-r->program, regprop(s)); /* Where, what. */ -+ next = regnext(s); -+ if (next == NULL) /* Next ptr. */ -+ printf("(0)"); -+ else -+ printf("(%d)", (s-r->program)+(next-s)); -+ s += 3; -+ if (op == ANYOF || op == ANYBUT || op == EXACTLY) { -+ /* Literal string, where present. */ -+ while (*s != '\0') { -+ putchar(*s); -+ s++; -+ } -+ s++; -+ } -+ putchar('\n'); -+ } -+ -+ /* Header fields of interest. */ -+ if (r->regstart != '\0') -+ printf("start `%c' ", r->regstart); -+ if (r->reganch) -+ printf("anchored "); -+ if (r->regmust != NULL) -+ printf("must have \"%s\"", r->regmust); -+ printf("\n"); -+} -+ -+/* -+ - regprop - printable representation of opcode -+ */ -+static char * -+regprop(char *op) -+{ -+#define BUFLEN 50 -+ register char *p; -+ static char buf[BUFLEN]; -+ -+ strcpy(buf, ":"); -+ -+ switch (OP(op)) { -+ case BOL: -+ p = "BOL"; -+ break; -+ case EOL: -+ p = "EOL"; -+ break; -+ case ANY: -+ p = "ANY"; -+ break; -+ case ANYOF: -+ p = "ANYOF"; -+ break; -+ case ANYBUT: -+ p = "ANYBUT"; -+ break; -+ case BRANCH: -+ p = "BRANCH"; -+ break; -+ case EXACTLY: -+ p = "EXACTLY"; -+ break; -+ case NOTHING: -+ p = "NOTHING"; -+ break; -+ case BACK: -+ p = "BACK"; -+ break; -+ case END: -+ p = "END"; -+ break; -+ case OPEN+1: -+ case OPEN+2: -+ case OPEN+3: -+ case OPEN+4: -+ case OPEN+5: -+ case OPEN+6: -+ case OPEN+7: -+ case OPEN+8: -+ case OPEN+9: -+ snprintf(buf+strlen(buf),BUFLEN-strlen(buf), "OPEN%d", OP(op)-OPEN); -+ p = NULL; -+ break; -+ case CLOSE+1: -+ case CLOSE+2: -+ case CLOSE+3: -+ case CLOSE+4: -+ case CLOSE+5: -+ case CLOSE+6: -+ case CLOSE+7: -+ case CLOSE+8: -+ case CLOSE+9: -+ snprintf(buf+strlen(buf),BUFLEN-strlen(buf), "CLOSE%d", OP(op)-CLOSE); -+ p = NULL; -+ break; -+ case STAR: -+ p = "STAR"; -+ break; -+ case PLUS: -+ p = "PLUS"; -+ break; -+ default: -+ printk("<3>Regexp: corrupted opcode\n"); -+ break; -+ } -+ if (p != NULL) -+ strncat(buf, p, BUFLEN-strlen(buf)); -+ return(buf); -+} -+#endif -+ -+ ---- /dev/null -+++ b/net/netfilter/regexp/regexp.h -@@ -0,0 +1,41 @@ -+/* -+ * Definitions etc. for regexp(3) routines. -+ * -+ * Caveat: this is V8 regexp(3) [actually, a reimplementation thereof], -+ * not the System V one. -+ */ -+ -+#ifndef REGEXP_H -+#define REGEXP_H -+ -+ -+/* -+http://www.opensource.apple.com/darwinsource/10.3/expect-1/expect/expect.h , -+which contains a version of this library, says: -+ -+ * -+ * NSUBEXP must be at least 10, and no greater than 117 or the parser -+ * will not work properly. -+ * -+ -+However, it looks rather like this library is limited to 10. If you think -+otherwise, let us know. -+*/ -+ -+#define NSUBEXP 10 -+typedef struct regexp { -+ char *startp[NSUBEXP]; -+ char *endp[NSUBEXP]; -+ char regstart; /* Internal use only. */ -+ char reganch; /* Internal use only. */ -+ char *regmust; /* Internal use only. */ -+ int regmlen; /* Internal use only. */ -+ char program[1]; /* Unwarranted chumminess with compiler. */ -+} regexp; -+ -+regexp * regcomp(char *exp, int *patternsize); -+int regexec(regexp *prog, char *string); -+void regsub(regexp *prog, char *source, char *dest); -+void regerror(char *s); -+ -+#endif ---- /dev/null -+++ b/net/netfilter/regexp/regmagic.h -@@ -0,0 +1,5 @@ -+/* -+ * The first byte of the regexp internal "program" is actually this magic -+ * number; the start node begins in the second byte. -+ */ -+#define MAGIC 0234 ---- /dev/null -+++ b/net/netfilter/regexp/regsub.c -@@ -0,0 +1,95 @@ -+/* -+ * regsub -+ * @(#)regsub.c 1.3 of 2 April 86 -+ * -+ * Copyright (c) 1986 by University of Toronto. -+ * Written by Henry Spencer. Not derived from licensed software. -+ * -+ * Permission is granted to anyone to use this software for any -+ * purpose on any computer system, and to redistribute it freely, -+ * subject to the following restrictions: -+ * -+ * 1. The author is not responsible for the consequences of use of -+ * this software, no matter how awful, even if they arise -+ * from defects in it. -+ * -+ * 2. The origin of this software must not be misrepresented, either -+ * by explicit claim or by omission. -+ * -+ * 3. Altered versions must be plainly marked as such, and must not -+ * be misrepresented as being the original software. -+ * -+ * -+ * This code was modified by Ethan Sommer to work within the kernel -+ * (it now uses kmalloc etc..) -+ * -+ */ -+#include "regexp.h" -+#include "regmagic.h" -+#include -+ -+ -+#ifndef CHARBITS -+#define UCHARAT(p) ((int)*(unsigned char *)(p)) -+#else -+#define UCHARAT(p) ((int)*(p)&CHARBITS) -+#endif -+ -+#if 0 -+//void regerror(char * s) -+//{ -+// printk("regexp(3): %s", s); -+// /* NOTREACHED */ -+//} -+#endif -+ -+/* -+ - regsub - perform substitutions after a regexp match -+ */ -+void -+regsub(regexp * prog, char * source, char * dest) -+{ -+ register char *src; -+ register char *dst; -+ register char c; -+ register int no; -+ register int len; -+ -+ /* Not necessary and gcc doesn't like it -MLS */ -+ /*extern char *strncpy();*/ -+ -+ if (prog == NULL || source == NULL || dest == NULL) { -+ regerror("NULL parm to regsub"); -+ return; -+ } -+ if (UCHARAT(prog->program) != MAGIC) { -+ regerror("damaged regexp fed to regsub"); -+ return; -+ } -+ -+ src = source; -+ dst = dest; -+ while ((c = *src++) != '\0') { -+ if (c == '&') -+ no = 0; -+ else if (c == '\\' && '0' <= *src && *src <= '9') -+ no = *src++ - '0'; -+ else -+ no = -1; -+ -+ if (no < 0) { /* Ordinary character. */ -+ if (c == '\\' && (*src == '\\' || *src == '&')) -+ c = *src++; -+ *dst++ = c; -+ } else if (prog->startp[no] != NULL && prog->endp[no] != NULL) { -+ len = prog->endp[no] - prog->startp[no]; -+ (void) strncpy(dst, prog->startp[no], len); -+ dst += len; -+ if (len != 0 && *(dst-1) == '\0') { /* strncpy hit NUL. */ -+ regerror("damaged match string"); -+ return; -+ } -+ } -+ } -+ *dst++ = '\0'; -+} ---- /dev/null -+++ b/net/netfilter/xt_layer7.c -@@ -0,0 +1,666 @@ -+/* -+ Kernel module to match application layer (OSI layer 7) data in connections. -+ -+ http://l7-filter.sf.net -+ -+ (C) 2003-2009 Matthew Strait and Ethan Sommer. -+ -+ 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 of the License, or (at your option) any later version. -+ http://www.gnu.org/licenses/gpl.txt -+ -+ Based on ipt_string.c (C) 2000 Emmanuel Roger , -+ xt_helper.c (C) 2002 Harald Welte and cls_layer7.c (C) 2003 Matthew Strait, -+ Ethan Sommer, Justin Levandoski. -+*/ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) -+#include -+#include -+#endif -+#include -+#include -+#include -+#include -+ -+#include "regexp/regexp.c" -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Matthew Strait , Ethan Sommer "); -+MODULE_DESCRIPTION("iptables application layer match module"); -+MODULE_ALIAS("ipt_layer7"); -+MODULE_VERSION("2.21"); -+ -+static int maxdatalen = 2048; // this is the default -+module_param(maxdatalen, int, 0444); -+MODULE_PARM_DESC(maxdatalen, "maximum bytes of data looked at by l7-filter"); -+#ifdef CONFIG_NETFILTER_XT_MATCH_LAYER7_DEBUG -+ #define DPRINTK(format,args...) printk(format,##args) -+#else -+ #define DPRINTK(format,args...) -+#endif -+ -+/* Number of packets whose data we look at. -+This can be modified through /proc/net/layer7_numpackets */ -+static int num_packets = 10; -+ -+static struct pattern_cache { -+ char * regex_string; -+ regexp * pattern; -+ struct pattern_cache * next; -+} * first_pattern_cache = NULL; -+ -+DEFINE_SPINLOCK(l7_lock); -+ -+static int total_acct_packets(struct nf_conn *ct) -+{ -+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 26) -+ BUG_ON(ct == NULL); -+ return (ct->counters[IP_CT_DIR_ORIGINAL].packets + ct->counters[IP_CT_DIR_REPLY].packets); -+#else -+ struct nf_conn_counter *acct; -+ -+ BUG_ON(ct == NULL); -+ acct = nf_conn_acct_find(ct); -+ if (!acct) -+ return 0; -+ return (acct[IP_CT_DIR_ORIGINAL].packets + acct[IP_CT_DIR_REPLY].packets); -+#endif -+} -+ -+#ifdef CONFIG_IP_NF_MATCH_LAYER7_DEBUG -+/* Converts an unfriendly string into a friendly one by -+replacing unprintables with periods and all whitespace with " ". */ -+static char * friendly_print(unsigned char * s) -+{ -+ char * f = kmalloc(strlen(s) + 1, GFP_ATOMIC); -+ int i; -+ -+ if(!f) { -+ if (net_ratelimit()) -+ printk(KERN_ERR "layer7: out of memory in " -+ "friendly_print, bailing.\n"); -+ return NULL; -+ } -+ -+ for(i = 0; i < strlen(s); i++){ -+ if(isprint(s[i]) && s[i] < 128) f[i] = s[i]; -+ else if(isspace(s[i])) f[i] = ' '; -+ else f[i] = '.'; -+ } -+ f[i] = '\0'; -+ return f; -+} -+ -+static char dec2hex(int i) -+{ -+ switch (i) { -+ case 0 ... 9: -+ return (i + '0'); -+ break; -+ case 10 ... 15: -+ return (i - 10 + 'a'); -+ break; -+ default: -+ if (net_ratelimit()) -+ printk("layer7: Problem in dec2hex\n"); -+ return '\0'; -+ } -+} -+ -+static char * hex_print(unsigned char * s) -+{ -+ char * g = kmalloc(strlen(s)*3 + 1, GFP_ATOMIC); -+ int i; -+ -+ if(!g) { -+ if (net_ratelimit()) -+ printk(KERN_ERR "layer7: out of memory in hex_print, " -+ "bailing.\n"); -+ return NULL; -+ } -+ -+ for(i = 0; i < strlen(s); i++) { -+ g[i*3 ] = dec2hex(s[i]/16); -+ g[i*3 + 1] = dec2hex(s[i]%16); -+ g[i*3 + 2] = ' '; -+ } -+ g[i*3] = '\0'; -+ -+ return g; -+} -+#endif // DEBUG -+ -+/* Use instead of regcomp. As we expect to be seeing the same regexps over and -+over again, it make sense to cache the results. */ -+static regexp * compile_and_cache(const char * regex_string, -+ const char * protocol) -+{ -+ struct pattern_cache * node = first_pattern_cache; -+ struct pattern_cache * last_pattern_cache = first_pattern_cache; -+ struct pattern_cache * tmp; -+ unsigned int len; -+ -+ while (node != NULL) { -+ if (!strcmp(node->regex_string, regex_string)) -+ return node->pattern; -+ -+ last_pattern_cache = node;/* points at the last non-NULL node */ -+ node = node->next; -+ } -+ -+ /* If we reach the end of the list, then we have not yet cached -+ the pattern for this regex. Let's do that now. -+ Be paranoid about running out of memory to avoid list corruption. */ -+ tmp = kmalloc(sizeof(struct pattern_cache), GFP_ATOMIC); -+ -+ if(!tmp) { -+ if (net_ratelimit()) -+ printk(KERN_ERR "layer7: out of memory in " -+ "compile_and_cache, bailing.\n"); -+ return NULL; -+ } -+ -+ tmp->regex_string = kmalloc(strlen(regex_string) + 1, GFP_ATOMIC); -+ tmp->pattern = kmalloc(sizeof(struct regexp), GFP_ATOMIC); -+ tmp->next = NULL; -+ -+ if(!tmp->regex_string || !tmp->pattern) { -+ if (net_ratelimit()) -+ printk(KERN_ERR "layer7: out of memory in " -+ "compile_and_cache, bailing.\n"); -+ kfree(tmp->regex_string); -+ kfree(tmp->pattern); -+ kfree(tmp); -+ return NULL; -+ } -+ -+ /* Ok. The new node is all ready now. */ -+ node = tmp; -+ -+ if(first_pattern_cache == NULL) /* list is empty */ -+ first_pattern_cache = node; /* make node the beginning */ -+ else -+ last_pattern_cache->next = node; /* attach node to the end */ -+ -+ /* copy the string and compile the regex */ -+ len = strlen(regex_string); -+ DPRINTK("About to compile this: \"%s\"\n", regex_string); -+ node->pattern = regcomp((char *)regex_string, &len); -+ if ( !node->pattern ) { -+ if (net_ratelimit()) -+ printk(KERN_ERR "layer7: Error compiling regexp " -+ "\"%s\" (%s)\n", -+ regex_string, protocol); -+ /* pattern is now cached as NULL, so we won't try again. */ -+ } -+ -+ strcpy(node->regex_string, regex_string); -+ return node->pattern; -+} -+ -+static int can_handle(const struct sk_buff *skb) -+{ -+ if(!ip_hdr(skb)) /* not IP */ -+ return 0; -+ if(ip_hdr(skb)->protocol != IPPROTO_TCP && -+ ip_hdr(skb)->protocol != IPPROTO_UDP && -+ ip_hdr(skb)->protocol != IPPROTO_ICMP) -+ return 0; -+ return 1; -+} -+ -+/* Returns offset the into the skb->data that the application data starts */ -+static int app_data_offset(const struct sk_buff *skb) -+{ -+ /* In case we are ported somewhere (ebtables?) where ip_hdr(skb) -+ isn't set, this can be gotten from 4*(skb->data[0] & 0x0f) as well. */ -+ int ip_hl = 4*ip_hdr(skb)->ihl; -+ -+ if( ip_hdr(skb)->protocol == IPPROTO_TCP ) { -+ /* 12 == offset into TCP header for the header length field. -+ Can't get this with skb->h.th->doff because the tcphdr -+ struct doesn't get set when routing (this is confirmed to be -+ true in Netfilter as well as QoS.) */ -+ int tcp_hl = 4*(skb->data[ip_hl + 12] >> 4); -+ -+ return ip_hl + tcp_hl; -+ } else if( ip_hdr(skb)->protocol == IPPROTO_UDP ) { -+ return ip_hl + 8; /* UDP header is always 8 bytes */ -+ } else if( ip_hdr(skb)->protocol == IPPROTO_ICMP ) { -+ return ip_hl + 8; /* ICMP header is 8 bytes */ -+ } else { -+ if (net_ratelimit()) -+ printk(KERN_ERR "layer7: tried to handle unknown " -+ "protocol!\n"); -+ return ip_hl + 8; /* something reasonable */ -+ } -+} -+ -+/* handles whether there's a match when we aren't appending data anymore */ -+static int match_no_append(struct nf_conn * conntrack, -+ struct nf_conn * master_conntrack, -+ enum ip_conntrack_info ctinfo, -+ enum ip_conntrack_info master_ctinfo, -+ const struct xt_layer7_info * info) -+{ -+ /* If we're in here, throw the app data away */ -+ if(master_conntrack->layer7.app_data != NULL) { -+ -+ #ifdef CONFIG_IP_NF_MATCH_LAYER7_DEBUG -+ if(!master_conntrack->layer7.app_proto) { -+ char * f = -+ friendly_print(master_conntrack->layer7.app_data); -+ char * g = -+ hex_print(master_conntrack->layer7.app_data); -+ DPRINTK("\nl7-filter gave up after %d bytes " -+ "(%d packets):\n%s\n", -+ strlen(f), total_acct_packets(master_conntrack), f); -+ kfree(f); -+ DPRINTK("In hex: %s\n", g); -+ kfree(g); -+ } -+ #endif -+ -+ kfree(master_conntrack->layer7.app_data); -+ master_conntrack->layer7.app_data = NULL; /* don't free again */ -+ } -+ -+ if(master_conntrack->layer7.app_proto){ -+ /* Here child connections set their .app_proto (for /proc) */ -+ if(!conntrack->layer7.app_proto) { -+ conntrack->layer7.app_proto = -+ kmalloc(strlen(master_conntrack->layer7.app_proto)+1, -+ GFP_ATOMIC); -+ if(!conntrack->layer7.app_proto){ -+ if (net_ratelimit()) -+ printk(KERN_ERR "layer7: out of memory " -+ "in match_no_append, " -+ "bailing.\n"); -+ return 1; -+ } -+ strcpy(conntrack->layer7.app_proto, -+ master_conntrack->layer7.app_proto); -+ } -+ -+ return (!strcmp(master_conntrack->layer7.app_proto, -+ info->protocol)); -+ } -+ else { -+ /* If not classified, set to "unknown" to distinguish from -+ connections that are still being tested. */ -+ master_conntrack->layer7.app_proto = -+ kmalloc(strlen("unknown")+1, GFP_ATOMIC); -+ if(!master_conntrack->layer7.app_proto){ -+ if (net_ratelimit()) -+ printk(KERN_ERR "layer7: out of memory in " -+ "match_no_append, bailing.\n"); -+ return 1; -+ } -+ strcpy(master_conntrack->layer7.app_proto, "unknown"); -+ return 0; -+ } -+} -+ -+/* add the new app data to the conntrack. Return number of bytes added. */ -+static int add_data(struct nf_conn * master_conntrack, -+ char * app_data, int appdatalen) -+{ -+ int length = 0, i; -+ int oldlength = master_conntrack->layer7.app_data_len; -+ -+ /* This is a fix for a race condition by Deti Fliegl. However, I'm not -+ clear on whether the race condition exists or whether this really -+ fixes it. I might just be being dense... Anyway, if it's not really -+ a fix, all it does is waste a very small amount of time. */ -+ if(!master_conntrack->layer7.app_data) return 0; -+ -+ /* Strip nulls. Make everything lower case (our regex lib doesn't -+ do case insensitivity). Add it to the end of the current data. */ -+ for(i = 0; i < maxdatalen-oldlength-1 && -+ i < appdatalen; i++) { -+ if(app_data[i] != '\0') { -+ /* the kernel version of tolower mungs 'upper ascii' */ -+ master_conntrack->layer7.app_data[length+oldlength] = -+ isascii(app_data[i])? -+ tolower(app_data[i]) : app_data[i]; -+ length++; -+ } -+ } -+ -+ master_conntrack->layer7.app_data[length+oldlength] = '\0'; -+ master_conntrack->layer7.app_data_len = length + oldlength; -+ -+ return length; -+} -+ -+/* taken from drivers/video/modedb.c */ -+static int my_atoi(const char *s) -+{ -+ int val = 0; -+ -+ for (;; s++) { -+ switch (*s) { -+ case '0'...'9': -+ val = 10*val+(*s-'0'); -+ break; -+ default: -+ return val; -+ } -+ } -+} -+ -+/* write out num_packets to userland. */ -+static int layer7_read_proc(char* page, char ** start, off_t off, int count, -+ int* eof, void * data) -+{ -+ if(num_packets > 99 && net_ratelimit()) -+ printk(KERN_ERR "layer7: NOT REACHED. num_packets too big\n"); -+ -+ page[0] = num_packets/10 + '0'; -+ page[1] = num_packets%10 + '0'; -+ page[2] = '\n'; -+ page[3] = '\0'; -+ -+ *eof=1; -+ -+ return 3; -+} -+ -+/* Read in num_packets from userland */ -+static int layer7_write_proc(struct file* file, const char* buffer, -+ unsigned long count, void *data) -+{ -+ char * foo = kmalloc(count, GFP_ATOMIC); -+ -+ if(!foo){ -+ if (net_ratelimit()) -+ printk(KERN_ERR "layer7: out of memory, bailing. " -+ "num_packets unchanged.\n"); -+ return count; -+ } -+ -+ if(copy_from_user(foo, buffer, count)) { -+ return -EFAULT; -+ } -+ -+ -+ num_packets = my_atoi(foo); -+ kfree (foo); -+ -+ /* This has an arbitrary limit to make the math easier. I'm lazy. -+ But anyway, 99 is a LOT! If you want more, you're doing it wrong! */ -+ if(num_packets > 99) { -+ printk(KERN_WARNING "layer7: num_packets can't be > 99.\n"); -+ num_packets = 99; -+ } else if(num_packets < 1) { -+ printk(KERN_WARNING "layer7: num_packets can't be < 1.\n"); -+ num_packets = 1; -+ } -+ -+ return count; -+} -+ -+static bool -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) -+match(const struct sk_buff *skbin, const struct xt_match_param *par) -+#else -+match(const struct sk_buff *skbin, -+ const struct net_device *in, -+ const struct net_device *out, -+ const struct xt_match *match, -+ const void *matchinfo, -+ int offset, -+ unsigned int protoff, -+ bool *hotdrop) -+#endif -+{ -+ /* sidestep const without getting a compiler warning... */ -+ struct sk_buff * skb = (struct sk_buff *)skbin; -+ -+ const struct xt_layer7_info * info = -+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) -+ par->matchinfo; -+ #else -+ matchinfo; -+ #endif -+ -+ enum ip_conntrack_info master_ctinfo, ctinfo; -+ struct nf_conn *master_conntrack, *conntrack; -+ unsigned char * app_data; -+ unsigned int pattern_result, appdatalen; -+ regexp * comppattern; -+ -+ /* Be paranoid/incompetent - lock the entire match function. */ -+ spin_lock_bh(&l7_lock); -+ -+ if(!can_handle(skb)){ -+ DPRINTK("layer7: This is some protocol I can't handle.\n"); -+ spin_unlock_bh(&l7_lock); -+ return info->invert; -+ } -+ -+ /* Treat parent & all its children together as one connection, except -+ for the purpose of setting conntrack->layer7.app_proto in the actual -+ connection. This makes /proc/net/ip_conntrack more satisfying. */ -+ if(!(conntrack = nf_ct_get(skb, &ctinfo)) || -+ !(master_conntrack=nf_ct_get(skb,&master_ctinfo))){ -+ DPRINTK("layer7: couldn't get conntrack.\n"); -+ spin_unlock_bh(&l7_lock); -+ return info->invert; -+ } -+ -+ /* Try to get a master conntrack (and its master etc) for FTP, etc. */ -+ while (master_ct(master_conntrack) != NULL) -+ master_conntrack = master_ct(master_conntrack); -+ -+ /* if we've classified it or seen too many packets */ -+ if(total_acct_packets(master_conntrack) > num_packets || -+ master_conntrack->layer7.app_proto) { -+ -+ pattern_result = match_no_append(conntrack, master_conntrack, -+ ctinfo, master_ctinfo, info); -+ -+ /* skb->cb[0] == seen. Don't do things twice if there are -+ multiple l7 rules. I'm not sure that using cb for this purpose -+ is correct, even though it says "put your private variables -+ there". But it doesn't look like it is being used for anything -+ else in the skbs that make it here. */ -+ skb->cb[0] = 1; /* marking it seen here's probably irrelevant */ -+ -+ spin_unlock_bh(&l7_lock); -+ return (pattern_result ^ info->invert); -+ } -+ -+ if(skb_is_nonlinear(skb)){ -+ if(skb_linearize(skb) != 0){ -+ if (net_ratelimit()) -+ printk(KERN_ERR "layer7: failed to linearize " -+ "packet, bailing.\n"); -+ spin_unlock_bh(&l7_lock); -+ return info->invert; -+ } -+ } -+ -+ /* now that the skb is linearized, it's safe to set these. */ -+ app_data = skb->data + app_data_offset(skb); -+ appdatalen = skb_tail_pointer(skb) - app_data; -+ -+ /* the return value gets checked later, when we're ready to use it */ -+ comppattern = compile_and_cache(info->pattern, info->protocol); -+ -+ /* On the first packet of a connection, allocate space for app data */ -+ if(total_acct_packets(master_conntrack) == 1 && !skb->cb[0] && -+ !master_conntrack->layer7.app_data){ -+ master_conntrack->layer7.app_data = -+ kmalloc(maxdatalen, GFP_ATOMIC); -+ if(!master_conntrack->layer7.app_data){ -+ if (net_ratelimit()) -+ printk(KERN_ERR "layer7: out of memory in " -+ "match, bailing.\n"); -+ spin_unlock_bh(&l7_lock); -+ return info->invert; -+ } -+ -+ master_conntrack->layer7.app_data[0] = '\0'; -+ } -+ -+ /* Can be here, but unallocated, if numpackets is increased near -+ the beginning of a connection */ -+ if(master_conntrack->layer7.app_data == NULL){ -+ spin_unlock_bh(&l7_lock); -+ return info->invert; /* unmatched */ -+ } -+ -+ if(!skb->cb[0]){ -+ int newbytes; -+ newbytes = add_data(master_conntrack, app_data, appdatalen); -+ -+ if(newbytes == 0) { /* didn't add any data */ -+ skb->cb[0] = 1; -+ /* Didn't match before, not going to match now */ -+ spin_unlock_bh(&l7_lock); -+ return info->invert; -+ } -+ } -+ -+ /* If looking for "unknown", then never match. "Unknown" means that -+ we've given up; we're still trying with these packets. */ -+ if(!strcmp(info->protocol, "unknown")) { -+ pattern_result = 0; -+ /* If looking for "unset", then always match. "Unset" means that we -+ haven't yet classified the connection. */ -+ } else if(!strcmp(info->protocol, "unset")) { -+ pattern_result = 2; -+ DPRINTK("layer7: matched unset: not yet classified " -+ "(%d/%d packets)\n", -+ total_acct_packets(master_conntrack), num_packets); -+ /* If the regexp failed to compile, don't bother running it */ -+ } else if(comppattern && -+ regexec(comppattern, master_conntrack->layer7.app_data)){ -+ DPRINTK("layer7: matched %s\n", info->protocol); -+ pattern_result = 1; -+ } else pattern_result = 0; -+ -+ if(pattern_result == 1) { -+ master_conntrack->layer7.app_proto = -+ kmalloc(strlen(info->protocol)+1, GFP_ATOMIC); -+ if(!master_conntrack->layer7.app_proto){ -+ if (net_ratelimit()) -+ printk(KERN_ERR "layer7: out of memory in " -+ "match, bailing.\n"); -+ spin_unlock_bh(&l7_lock); -+ return (pattern_result ^ info->invert); -+ } -+ strcpy(master_conntrack->layer7.app_proto, info->protocol); -+ } else if(pattern_result > 1) { /* cleanup from "unset" */ -+ pattern_result = 1; -+ } -+ -+ /* mark the packet seen */ -+ skb->cb[0] = 1; -+ -+ spin_unlock_bh(&l7_lock); -+ return (pattern_result ^ info->invert); -+} -+ -+// load nf_conntrack_ipv4 -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) -+static bool check(const struct xt_mtchk_param *par) -+{ -+ if (nf_ct_l3proto_try_module_get(par->match->family) < 0) { -+ printk(KERN_WARNING "can't load conntrack support for " -+ "proto=%d\n", par->match->family); -+#else -+static bool check(const char *tablename, const void *inf, -+ const struct xt_match *match, void *matchinfo, -+ unsigned int hook_mask) -+{ -+ if (nf_ct_l3proto_try_module_get(match->family) < 0) { -+ printk(KERN_WARNING "can't load conntrack support for " -+ "proto=%d\n", match->family); -+#endif -+ return 0; -+ } -+ return 1; -+} -+ -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) -+ static void destroy(const struct xt_mtdtor_param *par) -+ { -+ nf_ct_l3proto_module_put(par->match->family); -+ } -+#else -+ static void destroy(const struct xt_match *match, void *matchinfo) -+ { -+ nf_ct_l3proto_module_put(match->family); -+ } -+#endif -+ -+static struct xt_match xt_layer7_match[] __read_mostly = { -+{ -+ .name = "layer7", -+ .family = AF_INET, -+ .checkentry = check, -+ .match = match, -+ .destroy = destroy, -+ .matchsize = sizeof(struct xt_layer7_info), -+ .me = THIS_MODULE -+} -+}; -+ -+static void layer7_cleanup_proc(void) -+{ -+ remove_proc_entry("layer7_numpackets", init_net.proc_net); -+} -+ -+/* register the proc file */ -+static void layer7_init_proc(void) -+{ -+ struct proc_dir_entry* entry; -+ entry = create_proc_entry("layer7_numpackets", 0644, init_net.proc_net); -+ entry->read_proc = layer7_read_proc; -+ entry->write_proc = layer7_write_proc; -+} -+ -+static int __init xt_layer7_init(void) -+{ -+ need_conntrack(); -+ -+ layer7_init_proc(); -+ if(maxdatalen < 1) { -+ printk(KERN_WARNING "layer7: maxdatalen can't be < 1, " -+ "using 1\n"); -+ maxdatalen = 1; -+ } -+ /* This is not a hard limit. It's just here to prevent people from -+ bringing their slow machines to a grinding halt. */ -+ else if(maxdatalen > 65536) { -+ printk(KERN_WARNING "layer7: maxdatalen can't be > 65536, " -+ "using 65536\n"); -+ maxdatalen = 65536; -+ } -+ return xt_register_matches(xt_layer7_match, -+ ARRAY_SIZE(xt_layer7_match)); -+} -+ -+static void __exit xt_layer7_fini(void) -+{ -+ layer7_cleanup_proc(); -+ xt_unregister_matches(xt_layer7_match, ARRAY_SIZE(xt_layer7_match)); -+} -+ -+module_init(xt_layer7_init); -+module_exit(xt_layer7_fini); diff --git a/target/linux/generic-2.6/patches-2.6.27/101-netfilter_layer7_pktmatch.patch b/target/linux/generic-2.6/patches-2.6.27/101-netfilter_layer7_pktmatch.patch deleted file mode 100644 index f65e301fd..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/101-netfilter_layer7_pktmatch.patch +++ /dev/null @@ -1,108 +0,0 @@ ---- a/include/linux/netfilter/xt_layer7.h -+++ b/include/linux/netfilter/xt_layer7.h -@@ -8,6 +8,7 @@ struct xt_layer7_info { - char protocol[MAX_PROTOCOL_LEN]; - char pattern[MAX_PATTERN_LEN]; - u_int8_t invert; -+ u_int8_t pkt; - }; - - #endif /* _XT_LAYER7_H */ ---- a/net/netfilter/xt_layer7.c -+++ b/net/netfilter/xt_layer7.c -@@ -314,33 +314,35 @@ static int match_no_append(struct nf_con - } - - /* add the new app data to the conntrack. Return number of bytes added. */ --static int add_data(struct nf_conn * master_conntrack, -- char * app_data, int appdatalen) -+static int add_datastr(char *target, int offset, char *app_data, int len) - { - int length = 0, i; -- int oldlength = master_conntrack->layer7.app_data_len; -- -- /* This is a fix for a race condition by Deti Fliegl. However, I'm not -- clear on whether the race condition exists or whether this really -- fixes it. I might just be being dense... Anyway, if it's not really -- a fix, all it does is waste a very small amount of time. */ -- if(!master_conntrack->layer7.app_data) return 0; -+ if (!target) return 0; - - /* Strip nulls. Make everything lower case (our regex lib doesn't - do case insensitivity). Add it to the end of the current data. */ -- for(i = 0; i < maxdatalen-oldlength-1 && -- i < appdatalen; i++) { -+ for(i = 0; i < maxdatalen-offset-1 && i < len; i++) { - if(app_data[i] != '\0') { - /* the kernel version of tolower mungs 'upper ascii' */ -- master_conntrack->layer7.app_data[length+oldlength] = -+ target[length+offset] = - isascii(app_data[i])? - tolower(app_data[i]) : app_data[i]; - length++; - } - } -+ target[length+offset] = '\0'; -+ -+ return length; -+} -+ -+/* add the new app data to the conntrack. Return number of bytes added. */ -+static int add_data(struct nf_conn * master_conntrack, -+ char * app_data, int appdatalen) -+{ -+ int length; - -- master_conntrack->layer7.app_data[length+oldlength] = '\0'; -- master_conntrack->layer7.app_data_len = length + oldlength; -+ length = add_datastr(master_conntrack->layer7.app_data, master_conntrack->layer7.app_data_len, app_data, appdatalen); -+ master_conntrack->layer7.app_data_len += length; - - return length; - } -@@ -438,7 +440,7 @@ match(const struct sk_buff *skbin, - - enum ip_conntrack_info master_ctinfo, ctinfo; - struct nf_conn *master_conntrack, *conntrack; -- unsigned char * app_data; -+ unsigned char *app_data, *tmp_data; - unsigned int pattern_result, appdatalen; - regexp * comppattern; - -@@ -466,8 +468,8 @@ match(const struct sk_buff *skbin, - master_conntrack = master_ct(master_conntrack); - - /* if we've classified it or seen too many packets */ -- if(total_acct_packets(master_conntrack) > num_packets || -- master_conntrack->layer7.app_proto) { -+ if(!info->pkt && (total_acct_packets(master_conntrack) > num_packets || -+ master_conntrack->layer7.app_proto)) { - - pattern_result = match_no_append(conntrack, master_conntrack, - ctinfo, master_ctinfo, info); -@@ -500,6 +502,25 @@ match(const struct sk_buff *skbin, - /* the return value gets checked later, when we're ready to use it */ - comppattern = compile_and_cache(info->pattern, info->protocol); - -+ if (info->pkt) { -+ tmp_data = kmalloc(maxdatalen, GFP_ATOMIC); -+ if(!tmp_data){ -+ if (net_ratelimit()) -+ printk(KERN_ERR "layer7: out of memory in match, bailing.\n"); -+ return info->invert; -+ } -+ -+ tmp_data[0] = '\0'; -+ add_datastr(tmp_data, 0, app_data, appdatalen); -+ pattern_result = ((comppattern && regexec(comppattern, tmp_data)) ? 1 : 0); -+ -+ kfree(tmp_data); -+ tmp_data = NULL; -+ spin_unlock_bh(&l7_lock); -+ -+ return (pattern_result ^ info->invert); -+ } -+ - /* On the first packet of a connection, allocate space for app data */ - if(total_acct_packets(master_conntrack) == 1 && !skb->cb[0] && - !master_conntrack->layer7.app_data){ diff --git a/target/linux/generic-2.6/patches-2.6.27/150-netfilter_imq.patch b/target/linux/generic-2.6/patches-2.6.27/150-netfilter_imq.patch deleted file mode 100644 index a31bb2bc6..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/150-netfilter_imq.patch +++ /dev/null @@ -1,1263 +0,0 @@ ---- /dev/null -+++ b/drivers/net/imq.c -@@ -0,0 +1,566 @@ -+/* -+ * Pseudo-driver for the intermediate queue device. -+ * -+ * 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 of the License, or (at your option) any later version. -+ * -+ * Authors: Patrick McHardy, -+ * -+ * The first version was written by Martin Devera, -+ * -+ * Credits: Jan Rafaj -+ * - Update patch to 2.4.21 -+ * Sebastian Strollo -+ * - Fix "Dead-loop on netdevice imq"-issue -+ * Marcel Sebek -+ * - Update to 2.6.2-rc1 -+ * -+ * After some time of inactivity there is a group taking care -+ * of IMQ again: http://www.linuximq.net -+ * -+ * -+ * 2004/06/30 - New version of IMQ patch to kernels <=2.6.7 -+ * including the following changes: -+ * -+ * - Correction of ipv6 support "+"s issue (Hasso Tepper) -+ * - Correction of imq_init_devs() issue that resulted in -+ * kernel OOPS unloading IMQ as module (Norbert Buchmuller) -+ * - Addition of functionality to choose number of IMQ devices -+ * during kernel config (Andre Correa) -+ * - Addition of functionality to choose how IMQ hooks on -+ * PRE and POSTROUTING (after or before NAT) (Andre Correa) -+ * - Cosmetic corrections (Norbert Buchmuller) (Andre Correa) -+ * -+ * -+ * 2005/12/16 - IMQ versions between 2.6.7 and 2.6.13 were -+ * released with almost no problems. 2.6.14-x was released -+ * with some important changes: nfcache was removed; After -+ * some weeks of trouble we figured out that some IMQ fields -+ * in skb were missing in skbuff.c - skb_clone and copy_skb_header. -+ * These functions are correctly patched by this new patch version. -+ * -+ * Thanks for all who helped to figure out all the problems with -+ * 2.6.14.x: Patrick McHardy, Rune Kock, VeNoMouS, Max CtRiX, -+ * Kevin Shanahan, Richard Lucassen, Valery Dachev (hopefully -+ * I didn't forget anybody). I apologize again for my lack of time. -+ * -+ * -+ * 2008/06/17 - 2.6.25 - Changed imq.c to use qdisc_run() instead -+ * of qdisc_restart() and moved qdisc_run() to tasklet to avoid -+ * recursive locking. New initialization routines to fix 'rmmod' not -+ * working anymore. Used code from ifb.c. (Jussi Kivilinna) -+ * -+ * 2008/08/06 - 2.6.26 - (JK) -+ * - Replaced tasklet with 'netif_schedule()'. -+ * - Cleaned up and added comments for imq_nf_queue(). -+ * -+ * 2009/04/12 -+ * - Add skb_save_cb/skb_restore_cb helper functions for backuping -+ * control buffer. This is needed because qdisc-layer on kernels -+ * 2.6.27 and newer overwrite control buffer. (Jussi Kivilinna) -+ * - Add better locking for IMQ device. Hopefully this will solve -+ * SMP issues. (Jussi Kivilinna) -+ * - Port to 2.6.27 -+ * -+ * 2009/04/20 - (Jussi Kivilinna) -+ * - Fix rmmod not working -+ * - Use netdevice feature flags to avoid extra packet handling -+ * by core networking layer and possibly increase performance. -+ * -+ * Also, many thanks to pablo Sebastian Greco for making the initial -+ * patch and to those who helped the testing. -+ * -+ * More info at: http://www.linuximq.net/ (Andre Correa) -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) -+ #include -+#endif -+#include -+#include -+#include -+ -+static nf_hookfn imq_nf_hook; -+ -+static struct nf_hook_ops imq_ingress_ipv4 = { -+ .hook = imq_nf_hook, -+ .owner = THIS_MODULE, -+ .pf = PF_INET, -+ .hooknum = NF_INET_PRE_ROUTING, -+#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB) -+ .priority = NF_IP_PRI_MANGLE + 1 -+#else -+ .priority = NF_IP_PRI_NAT_DST + 1 -+#endif -+}; -+ -+static struct nf_hook_ops imq_egress_ipv4 = { -+ .hook = imq_nf_hook, -+ .owner = THIS_MODULE, -+ .pf = PF_INET, -+ .hooknum = NF_INET_POST_ROUTING, -+#if defined(CONFIG_IMQ_BEHAVIOR_AA) || defined(CONFIG_IMQ_BEHAVIOR_BA) -+ .priority = NF_IP_PRI_LAST -+#else -+ .priority = NF_IP_PRI_NAT_SRC - 1 -+#endif -+}; -+ -+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) -+static struct nf_hook_ops imq_ingress_ipv6 = { -+ .hook = imq_nf_hook, -+ .owner = THIS_MODULE, -+ .pf = PF_INET6, -+ .hooknum = NF_INET_PRE_ROUTING, -+#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB) -+ .priority = NF_IP6_PRI_MANGLE + 1 -+#else -+ .priority = NF_IP6_PRI_NAT_DST + 1 -+#endif -+}; -+ -+static struct nf_hook_ops imq_egress_ipv6 = { -+ .hook = imq_nf_hook, -+ .owner = THIS_MODULE, -+ .pf = PF_INET6, -+ .hooknum = NF_INET_POST_ROUTING, -+#if defined(CONFIG_IMQ_BEHAVIOR_AA) || defined(CONFIG_IMQ_BEHAVIOR_BA) -+ .priority = NF_IP6_PRI_LAST -+#else -+ .priority = NF_IP6_PRI_NAT_SRC - 1 -+#endif -+}; -+#endif -+ -+#if defined(CONFIG_IMQ_NUM_DEVS) -+static unsigned int numdevs = CONFIG_IMQ_NUM_DEVS; -+#else -+static unsigned int numdevs = IMQ_MAX_DEVS; -+#endif -+ -+static DEFINE_SPINLOCK(imq_nf_queue_lock); -+ -+static struct net_device *imq_devs_cache[IMQ_MAX_DEVS]; -+ -+ -+static struct net_device_stats *imq_get_stats(struct net_device *dev) -+{ -+ return &dev->stats; -+} -+ -+/* called for packets kfree'd in qdiscs at places other than enqueue */ -+static void imq_skb_destructor(struct sk_buff *skb) -+{ -+ struct nf_queue_entry *entry = skb->nf_queue_entry; -+ -+ if (entry) { -+ nf_queue_entry_release_refs(entry); -+ kfree(entry); -+ } -+ -+ skb_restore_cb(skb); /* kfree backup */ -+} -+ -+static void imq_nf_reinject(struct nf_queue_entry *entry, unsigned int verdict) -+{ -+ int status; -+ -+ if (!entry->next_outfn) { -+ spin_lock_bh(&imq_nf_queue_lock); -+ nf_reinject(entry, verdict); -+ spin_unlock_bh(&imq_nf_queue_lock); -+ return; -+ } -+ -+ rcu_read_lock(); -+ local_bh_disable(); -+ status = entry->next_outfn(entry, entry->next_queuenum); -+ local_bh_enable(); -+ if (status < 0) { -+ nf_queue_entry_release_refs(entry); -+ kfree_skb(entry->skb); -+ kfree(entry); -+ } -+ -+ rcu_read_unlock(); -+} -+ -+static int imq_dev_xmit(struct sk_buff *skb, struct net_device *dev) -+{ -+ dev->stats.tx_bytes += skb->len; -+ dev->stats.tx_packets++; -+ -+ skb->imq_flags = 0; -+ skb->destructor = NULL; -+ -+ skb_restore_cb(skb); /* restore skb->cb */ -+ -+ dev->trans_start = jiffies; -+ imq_nf_reinject(skb->nf_queue_entry, NF_ACCEPT); -+ return 0; -+} -+ -+static int imq_nf_queue(struct nf_queue_entry *entry, unsigned queue_num) -+{ -+ struct net_device *dev; -+ struct sk_buff *skb_orig, *skb, *skb_shared; -+ struct Qdisc *q; -+ struct netdev_queue *txq; -+ int users, index; -+ int retval = -EINVAL; -+ -+ index = entry->skb->imq_flags & IMQ_F_IFMASK; -+ if (unlikely(index > numdevs - 1)) { -+ if (net_ratelimit()) -+ printk(KERN_WARNING -+ "IMQ: invalid device specified, highest is %u\n", -+ numdevs - 1); -+ retval = -EINVAL; -+ goto out; -+ } -+ -+ /* check for imq device by index from cache */ -+ dev = imq_devs_cache[index]; -+ if (unlikely(!dev)) { -+ char buf[8]; -+ -+ /* get device by name and cache result */ -+ snprintf(buf, sizeof(buf), "imq%d", index); -+ dev = dev_get_by_name(&init_net, buf); -+ if (!dev) { -+ /* not found ?!*/ -+ BUG(); -+ retval = -ENODEV; -+ goto out; -+ } -+ -+ imq_devs_cache[index] = dev; -+ dev_put(dev); -+ } -+ -+ if (unlikely(!(dev->flags & IFF_UP))) { -+ entry->skb->imq_flags = 0; -+ imq_nf_reinject(entry, NF_ACCEPT); -+ retval = 0; -+ goto out; -+ } -+ dev->last_rx = jiffies; -+ -+ skb = entry->skb; -+ skb_orig = NULL; -+ -+ /* skb has owner? => make clone */ -+ if (unlikely(skb->destructor)) { -+ skb_orig = skb; -+ skb = skb_clone(skb, GFP_ATOMIC); -+ if (!skb) { -+ retval = -ENOMEM; -+ goto out; -+ } -+ entry->skb = skb; -+ } -+ -+ skb->nf_queue_entry = entry; -+ -+ dev->stats.rx_bytes += skb->len; -+ dev->stats.rx_packets++; -+ -+ txq = dev_pick_tx(dev, skb); -+ -+ q = rcu_dereference(txq->qdisc); -+ if (unlikely(!q->enqueue)) -+ goto packet_not_eaten_by_imq_dev; -+ -+ spin_lock_bh(qdisc_lock(q)); -+ -+ users = atomic_read(&skb->users); -+ -+ skb_shared = skb_get(skb); /* increase reference count by one */ -+ skb_save_cb(skb_shared); /* backup skb->cb, as qdisc layer will -+ overwrite it */ -+ qdisc_enqueue_root(skb_shared, q); /* might kfree_skb */ -+ -+ if (likely(atomic_read(&skb_shared->users) == users + 1)) { -+ kfree_skb(skb_shared); /* decrease reference count by one */ -+ -+ skb->destructor = &imq_skb_destructor; -+ -+ /* cloned? */ -+ if (skb_orig) -+ kfree_skb(skb_orig); /* free original */ -+ -+ spin_unlock_bh(qdisc_lock(q)); -+ -+ /* schedule qdisc dequeue */ -+ __netif_schedule(q); -+ -+ retval = 0; -+ goto out; -+ } else { -+ skb_restore_cb(skb_shared); /* restore skb->cb */ -+ /* qdisc dropped packet and decreased skb reference count of -+ * skb, so we don't really want to and try refree as that would -+ * actually destroy the skb. */ -+ spin_unlock_bh(qdisc_lock(q)); -+ goto packet_not_eaten_by_imq_dev; -+ } -+ -+packet_not_eaten_by_imq_dev: -+ /* cloned? restore original */ -+ if (skb_orig) { -+ kfree_skb(skb); -+ entry->skb = skb_orig; -+ } -+ retval = -1; -+out: -+ return retval; -+} -+ -+static struct nf_queue_handler nfqh = { -+ .name = "imq", -+ .outfn = imq_nf_queue, -+}; -+ -+static unsigned int imq_nf_hook(unsigned int hook, struct sk_buff *pskb, -+ const struct net_device *indev, -+ const struct net_device *outdev, -+ int (*okfn)(struct sk_buff *)) -+{ -+ if (pskb->imq_flags & IMQ_F_ENQUEUE) -+ return NF_QUEUE; -+ -+ return NF_ACCEPT; -+} -+ -+static int imq_close(struct net_device *dev) -+{ -+ netif_stop_queue(dev); -+ return 0; -+} -+ -+static int imq_open(struct net_device *dev) -+{ -+ netif_start_queue(dev); -+ return 0; -+} -+ -+static void imq_setup(struct net_device *dev) -+{ -+ dev->hard_start_xmit = imq_dev_xmit; -+ dev->open = imq_open; -+ dev->get_stats = imq_get_stats; -+ dev->stop = imq_close; -+ dev->type = ARPHRD_VOID; -+ dev->mtu = 16000; -+ dev->tx_queue_len = 11000; -+ dev->flags = IFF_NOARP; -+ dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | -+ NETIF_F_GSO | NETIF_F_HW_CSUM | -+ NETIF_F_HIGHDMA; -+} -+ -+static int imq_validate(struct nlattr *tb[], struct nlattr *data[]) -+{ -+ int ret = 0; -+ -+ if (tb[IFLA_ADDRESS]) { -+ if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN) { -+ ret = -EINVAL; -+ goto end; -+ } -+ if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS]))) { -+ ret = -EADDRNOTAVAIL; -+ goto end; -+ } -+ } -+ return 0; -+end: -+ printk(KERN_WARNING "IMQ: imq_validate failed (%d)\n", ret); -+ return ret; -+} -+ -+static struct rtnl_link_ops imq_link_ops __read_mostly = { -+ .kind = "imq", -+ .priv_size = 0, -+ .setup = imq_setup, -+ .validate = imq_validate, -+}; -+ -+static int __init imq_init_hooks(void) -+{ -+ int err; -+ -+ nf_register_queue_imq_handler(&nfqh); -+ -+ err = nf_register_hook(&imq_ingress_ipv4); -+ if (err) -+ goto err1; -+ -+ err = nf_register_hook(&imq_egress_ipv4); -+ if (err) -+ goto err2; -+ -+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) -+ err = nf_register_hook(&imq_ingress_ipv6); -+ if (err) -+ goto err3; -+ -+ err = nf_register_hook(&imq_egress_ipv6); -+ if (err) -+ goto err4; -+#endif -+ -+ return 0; -+ -+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) -+err4: -+ nf_unregister_hook(&imq_ingress_ipv6); -+err3: -+ nf_unregister_hook(&imq_egress_ipv4); -+#endif -+err2: -+ nf_unregister_hook(&imq_ingress_ipv4); -+err1: -+ nf_unregister_queue_imq_handler(); -+ return err; -+} -+ -+static int __init imq_init_one(int index) -+{ -+ struct net_device *dev; -+ int ret; -+ -+ dev = alloc_netdev(0, "imq%d", imq_setup); -+ if (!dev) -+ return -ENOMEM; -+ -+ ret = dev_alloc_name(dev, dev->name); -+ if (ret < 0) -+ goto fail; -+ -+ dev->rtnl_link_ops = &imq_link_ops; -+ ret = register_netdevice(dev); -+ if (ret < 0) -+ goto fail; -+ -+ return 0; -+fail: -+ free_netdev(dev); -+ return ret; -+} -+ -+static int __init imq_init_devs(void) -+{ -+ int err, i; -+ -+ if (numdevs < 1 || numdevs > IMQ_MAX_DEVS) { -+ printk(KERN_ERR "IMQ: numdevs has to be betweed 1 and %u\n", -+ IMQ_MAX_DEVS); -+ return -EINVAL; -+ } -+ -+ rtnl_lock(); -+ err = __rtnl_link_register(&imq_link_ops); -+ -+ for (i = 0; i < numdevs && !err; i++) -+ err = imq_init_one(i); -+ -+ if (err) { -+ __rtnl_link_unregister(&imq_link_ops); -+ memset(imq_devs_cache, 0, sizeof(imq_devs_cache)); -+ } -+ rtnl_unlock(); -+ -+ return err; -+} -+ -+static int __init imq_init_module(void) -+{ -+ int err; -+ -+#if defined(CONFIG_IMQ_NUM_DEVS) -+ BUILD_BUG_ON(CONFIG_IMQ_NUM_DEVS > 16); -+ BUILD_BUG_ON(CONFIG_IMQ_NUM_DEVS < 2); -+ BUILD_BUG_ON(CONFIG_IMQ_NUM_DEVS - 1 > IMQ_F_IFMASK); -+#endif -+ -+ err = imq_init_devs(); -+ if (err) { -+ printk(KERN_ERR "IMQ: Error trying imq_init_devs(net)\n"); -+ return err; -+ } -+ -+ err = imq_init_hooks(); -+ if (err) { -+ printk(KERN_ERR "IMQ: Error trying imq_init_hooks()\n"); -+ rtnl_link_unregister(&imq_link_ops); -+ memset(imq_devs_cache, 0, sizeof(imq_devs_cache)); -+ return err; -+ } -+ -+ printk(KERN_INFO "IMQ driver loaded successfully.\n"); -+ -+#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB) -+ printk(KERN_INFO "\tHooking IMQ before NAT on PREROUTING.\n"); -+#else -+ printk(KERN_INFO "\tHooking IMQ after NAT on PREROUTING.\n"); -+#endif -+#if defined(CONFIG_IMQ_BEHAVIOR_AB) || defined(CONFIG_IMQ_BEHAVIOR_BB) -+ printk(KERN_INFO "\tHooking IMQ before NAT on POSTROUTING.\n"); -+#else -+ printk(KERN_INFO "\tHooking IMQ after NAT on POSTROUTING.\n"); -+#endif -+ -+ return 0; -+} -+ -+static void __exit imq_unhook(void) -+{ -+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) -+ nf_unregister_hook(&imq_ingress_ipv6); -+ nf_unregister_hook(&imq_egress_ipv6); -+#endif -+ nf_unregister_hook(&imq_ingress_ipv4); -+ nf_unregister_hook(&imq_egress_ipv4); -+ -+ nf_unregister_queue_imq_handler(); -+} -+ -+static void __exit imq_cleanup_devs(void) -+{ -+ rtnl_link_unregister(&imq_link_ops); -+ memset(imq_devs_cache, 0, sizeof(imq_devs_cache)); -+} -+ -+static void __exit imq_exit_module(void) -+{ -+ imq_unhook(); -+ imq_cleanup_devs(); -+ printk(KERN_INFO "IMQ driver unloaded successfully.\n"); -+} -+ -+module_init(imq_init_module); -+module_exit(imq_exit_module); -+ -+module_param(numdevs, int, 0); -+MODULE_PARM_DESC(numdevs, "number of IMQ devices (how many imq* devices will " -+ "be created)"); -+MODULE_AUTHOR("http://www.linuximq.net"); -+MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See " -+ "http://www.linuximq.net/ for more information."); -+MODULE_LICENSE("GPL"); -+MODULE_ALIAS_RTNL_LINK("imq"); -+ ---- a/drivers/net/Kconfig -+++ b/drivers/net/Kconfig -@@ -109,6 +109,129 @@ config EQUALIZER - To compile this driver as a module, choose M here: the module - will be called eql. If unsure, say N. - -+config IMQ -+ tristate "IMQ (intermediate queueing device) support" -+ depends on NETDEVICES && NETFILTER -+ ---help--- -+ The IMQ device(s) is used as placeholder for QoS queueing -+ disciplines. Every packet entering/leaving the IP stack can be -+ directed through the IMQ device where it's enqueued/dequeued to the -+ attached qdisc. This allows you to treat network devices as classes -+ and distribute bandwidth among them. Iptables is used to specify -+ through which IMQ device, if any, packets travel. -+ -+ More information at: http://www.linuximq.net/ -+ -+ To compile this driver as a module, choose M here: the module -+ will be called imq. If unsure, say N. -+ -+choice -+ prompt "IMQ behavior (PRE/POSTROUTING)" -+ depends on IMQ -+ default IMQ_BEHAVIOR_AB -+ help -+ -+ This settings defines how IMQ behaves in respect to its -+ hooking in PREROUTING and POSTROUTING. -+ -+ IMQ can work in any of the following ways: -+ -+ PREROUTING | POSTROUTING -+ -----------------|------------------- -+ #1 After NAT | After NAT -+ #2 After NAT | Before NAT -+ #3 Before NAT | After NAT -+ #4 Before NAT | Before NAT -+ -+ The default behavior is to hook before NAT on PREROUTING -+ and after NAT on POSTROUTING (#3). -+ -+ This settings are specially usefull when trying to use IMQ -+ to shape NATed clients. -+ -+ More information can be found at: www.linuximq.net -+ -+ If not sure leave the default settings alone. -+ -+config IMQ_BEHAVIOR_AA -+ bool "IMQ AA" -+ help -+ This settings defines how IMQ behaves in respect to its -+ hooking in PREROUTING and POSTROUTING. -+ -+ Choosing this option will make IMQ hook like this: -+ -+ PREROUTING: After NAT -+ POSTROUTING: After NAT -+ -+ More information can be found at: www.linuximq.net -+ -+ If not sure leave the default settings alone. -+ -+config IMQ_BEHAVIOR_AB -+ bool "IMQ AB" -+ help -+ This settings defines how IMQ behaves in respect to its -+ hooking in PREROUTING and POSTROUTING. -+ -+ Choosing this option will make IMQ hook like this: -+ -+ PREROUTING: After NAT -+ POSTROUTING: Before NAT -+ -+ More information can be found at: www.linuximq.net -+ -+ If not sure leave the default settings alone. -+ -+config IMQ_BEHAVIOR_BA -+ bool "IMQ BA" -+ help -+ This settings defines how IMQ behaves in respect to its -+ hooking in PREROUTING and POSTROUTING. -+ -+ Choosing this option will make IMQ hook like this: -+ -+ PREROUTING: Before NAT -+ POSTROUTING: After NAT -+ -+ More information can be found at: www.linuximq.net -+ -+ If not sure leave the default settings alone. -+ -+config IMQ_BEHAVIOR_BB -+ bool "IMQ BB" -+ help -+ This settings defines how IMQ behaves in respect to its -+ hooking in PREROUTING and POSTROUTING. -+ -+ Choosing this option will make IMQ hook like this: -+ -+ PREROUTING: Before NAT -+ POSTROUTING: Before NAT -+ -+ More information can be found at: www.linuximq.net -+ -+ If not sure leave the default settings alone. -+ -+endchoice -+ -+config IMQ_NUM_DEVS -+ -+ int "Number of IMQ devices" -+ range 2 16 -+ depends on IMQ -+ default "16" -+ help -+ -+ This settings defines how many IMQ devices will be -+ created. -+ -+ The default value is 16. -+ -+ More information can be found at: www.linuximq.net -+ -+ If not sure leave the default settings alone. -+ - config TUN - tristate "Universal TUN/TAP device driver support" - select CRC32 ---- a/drivers/net/Makefile -+++ b/drivers/net/Makefile -@@ -144,6 +144,7 @@ obj-$(CONFIG_SLHC) += slhc.o - obj-$(CONFIG_XEN_NETDEV_FRONTEND) += xen-netfront.o - - obj-$(CONFIG_DUMMY) += dummy.o -+obj-$(CONFIG_IMQ) += imq.o - obj-$(CONFIG_IFB) += ifb.o - obj-$(CONFIG_MACVLAN) += macvlan.o - obj-$(CONFIG_DE600) += de600.o ---- /dev/null -+++ b/include/linux/imq.h -@@ -0,0 +1,13 @@ -+#ifndef _IMQ_H -+#define _IMQ_H -+ -+/* IFMASK (16 device indexes, 0 to 15) and flag(s) fit in 5 bits */ -+#define IMQ_F_BITS 5 -+ -+#define IMQ_F_IFMASK 0x0f -+#define IMQ_F_ENQUEUE 0x10 -+ -+#define IMQ_MAX_DEVS (IMQ_F_IFMASK + 1) -+ -+#endif /* _IMQ_H */ -+ ---- /dev/null -+++ b/include/linux/netfilter_ipv4/ipt_IMQ.h -@@ -0,0 +1,10 @@ -+#ifndef _IPT_IMQ_H -+#define _IPT_IMQ_H -+ -+/* Backwards compatibility for old userspace */ -+#include -+ -+#define ipt_imq_info xt_imq_info -+ -+#endif /* _IPT_IMQ_H */ -+ ---- /dev/null -+++ b/include/linux/netfilter_ipv6/ip6t_IMQ.h -@@ -0,0 +1,10 @@ -+#ifndef _IP6T_IMQ_H -+#define _IP6T_IMQ_H -+ -+/* Backwards compatibility for old userspace */ -+#include -+ -+#define ip6t_imq_info xt_imq_info -+ -+#endif /* _IP6T_IMQ_H */ -+ ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -28,6 +28,9 @@ - #include - #include - #include -+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -+#include -+#endif - - #define HAVE_ALLOC_SKB /* For the drivers to know */ - #define HAVE_ALIGNABLE_SKB /* Ditto 8) */ -@@ -272,6 +275,9 @@ struct sk_buff { - * first. This is owned by whoever has the skb queued ATM. - */ - char cb[48]; -+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -+ void *cb_next; -+#endif - - unsigned int len, - data_len; -@@ -302,6 +308,9 @@ struct sk_buff { - struct nf_conntrack *nfct; - struct sk_buff *nfct_reasm; - #endif -+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -+ struct nf_queue_entry *nf_queue_entry; -+#endif - #ifdef CONFIG_BRIDGE_NETFILTER - struct nf_bridge_info *nf_bridge; - #endif -@@ -321,6 +330,9 @@ struct sk_buff { - __u8 do_not_encrypt:1; - #endif - /* 0/13/14 bit hole */ -+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -+ __u8 imq_flags:IMQ_F_BITS; -+#endif - - #ifdef CONFIG_NET_DMA - dma_cookie_t dma_cookie; -@@ -353,6 +365,12 @@ struct sk_buff { - - #include - -+ -+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -+extern int skb_save_cb(struct sk_buff *skb); -+extern int skb_restore_cb(struct sk_buff *skb); -+#endif -+ - extern void kfree_skb(struct sk_buff *skb); - extern void __kfree_skb(struct sk_buff *skb); - extern struct sk_buff *__alloc_skb(unsigned int size, -@@ -1633,6 +1651,10 @@ static inline void __nf_copy(struct sk_b - dst->nfct_reasm = src->nfct_reasm; - nf_conntrack_get_reasm(src->nfct_reasm); - #endif -+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -+ dst->imq_flags = src->imq_flags; -+ dst->nf_queue_entry = src->nf_queue_entry; -+#endif - #ifdef CONFIG_BRIDGE_NETFILTER - dst->nf_bridge = src->nf_bridge; - nf_bridge_get(src->nf_bridge); ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -96,6 +96,9 @@ - #include - #include - #include -+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -+#include -+#endif - #include - #include - #include -@@ -1624,7 +1627,11 @@ int dev_hard_start_xmit(struct sk_buff * - struct netdev_queue *txq) - { - if (likely(!skb->next)) { -- if (!list_empty(&ptype_all)) -+ if (!list_empty(&ptype_all) -+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -+ && !(skb->imq_flags & IMQ_F_ENQUEUE) -+#endif -+ ) - dev_queue_xmit_nit(skb, dev); - - if (netif_needs_gso(dev, skb)) { -@@ -1715,8 +1722,7 @@ static u16 simple_tx_hash(struct net_dev - return (u16) (((u64) hash * dev->real_num_tx_queues) >> 32); - } - --static struct netdev_queue *dev_pick_tx(struct net_device *dev, -- struct sk_buff *skb) -+struct netdev_queue *dev_pick_tx(struct net_device *dev, struct sk_buff *skb) - { - u16 queue_index = 0; - -@@ -1728,6 +1734,7 @@ static struct netdev_queue *dev_pick_tx( - skb_set_queue_mapping(skb, queue_index); - return netdev_get_tx_queue(dev, queue_index); - } -+EXPORT_SYMBOL(dev_pick_tx); - - /** - * dev_queue_xmit - transmit a buffer ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -915,6 +915,7 @@ extern int dev_alloc_name(struct net_de - extern int dev_open(struct net_device *dev); - extern int dev_close(struct net_device *dev); - extern void dev_disable_lro(struct net_device *dev); -+extern struct netdev_queue *dev_pick_tx(struct net_device *dev, struct sk_buff *skb); - extern int dev_queue_xmit(struct sk_buff *skb); - extern int register_netdevice(struct net_device *dev); - extern void unregister_netdevice(struct net_device *dev); ---- /dev/null -+++ b/include/linux/netfilter/xt_IMQ.h -@@ -0,0 +1,9 @@ -+#ifndef _XT_IMQ_H -+#define _XT_IMQ_H -+ -+struct xt_imq_info { -+ unsigned int todev; /* target imq device */ -+}; -+ -+#endif /* _XT_IMQ_H */ -+ ---- a/include/net/netfilter/nf_queue.h -+++ b/include/net/netfilter/nf_queue.h -@@ -13,6 +13,12 @@ struct nf_queue_entry { - struct net_device *indev; - struct net_device *outdev; - int (*okfn)(struct sk_buff *); -+ -+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -+ int (*next_outfn)(struct nf_queue_entry *entry, -+ unsigned int queuenum); -+ unsigned int next_queuenum; -+#endif - }; - - #define nf_queue_entry_reroute(x) ((void *)x + sizeof(struct nf_queue_entry)) -@@ -30,5 +36,11 @@ extern int nf_unregister_queue_handler(i - const struct nf_queue_handler *qh); - extern void nf_unregister_queue_handlers(const struct nf_queue_handler *qh); - extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); -+extern void nf_queue_entry_release_refs(struct nf_queue_entry *entry); -+ -+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -+extern void nf_register_queue_imq_handler(const struct nf_queue_handler *qh); -+extern void nf_unregister_queue_imq_handler(void); -+#endif - - #endif /* _NF_QUEUE_H */ ---- a/net/core/skbuff.c -+++ b/net/core/skbuff.c -@@ -69,6 +69,9 @@ - - static struct kmem_cache *skbuff_head_cache __read_mostly; - static struct kmem_cache *skbuff_fclone_cache __read_mostly; -+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -+static struct kmem_cache *skbuff_cb_store_cache __read_mostly; -+#endif - - static void sock_pipe_buf_release(struct pipe_inode_info *pipe, - struct pipe_buffer *buf) -@@ -88,6 +91,80 @@ static int sock_pipe_buf_steal(struct pi - return 1; - } - -+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -+/* Control buffer save/restore for IMQ devices */ -+struct skb_cb_table { -+ void *cb_next; -+ atomic_t refcnt; -+ char cb[48]; -+}; -+ -+static DEFINE_SPINLOCK(skb_cb_store_lock); -+ -+int skb_save_cb(struct sk_buff *skb) -+{ -+ struct skb_cb_table *next; -+ -+ next = kmem_cache_alloc(skbuff_cb_store_cache, GFP_ATOMIC); -+ if (!next) -+ return -ENOMEM; -+ -+ BUILD_BUG_ON(sizeof(skb->cb) != sizeof(next->cb)); -+ -+ memcpy(next->cb, skb->cb, sizeof(skb->cb)); -+ next->cb_next = skb->cb_next; -+ -+ atomic_set(&next->refcnt, 1); -+ -+ skb->cb_next = next; -+ return 0; -+} -+EXPORT_SYMBOL(skb_save_cb); -+ -+int skb_restore_cb(struct sk_buff *skb) -+{ -+ struct skb_cb_table *next; -+ -+ if (!skb->cb_next) -+ return 0; -+ -+ next = skb->cb_next; -+ -+ BUILD_BUG_ON(sizeof(skb->cb) != sizeof(next->cb)); -+ -+ memcpy(skb->cb, next->cb, sizeof(skb->cb)); -+ skb->cb_next = next->cb_next; -+ -+ spin_lock(&skb_cb_store_lock); -+ -+ if (atomic_dec_and_test(&next->refcnt)) { -+ kmem_cache_free(skbuff_cb_store_cache, next); -+ } -+ -+ spin_unlock(&skb_cb_store_lock); -+ -+ return 0; -+} -+EXPORT_SYMBOL(skb_restore_cb); -+ -+static void skb_copy_stored_cb(struct sk_buff *new, struct sk_buff *old) -+{ -+ struct skb_cb_table *next; -+ -+ if (!old->cb_next) { -+ new->cb_next = 0; -+ return; -+ } -+ -+ spin_lock(&skb_cb_store_lock); -+ -+ next = old->cb_next; -+ atomic_inc(&next->refcnt); -+ new->cb_next = next; -+ -+ spin_unlock(&skb_cb_store_lock); -+} -+#endif - - /* Pipe buffer operations for a socket. */ - static struct pipe_buf_operations sock_pipe_buf_ops = { -@@ -362,6 +439,15 @@ static void skb_release_all(struct sk_bu - WARN_ON(in_irq()); - skb->destructor(skb); - } -+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -+ /* This should not happen. When it does, avoid memleak by restoring -+ the chain of cb-backups. */ -+ while(skb->cb_next != NULL) { -+ printk(KERN_WARNING "kfree_skb: skb->cb_next: %08x\n", -+ skb->cb_next); -+ skb_restore_cb(skb); -+ } -+#endif - #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) - nf_conntrack_put(skb->nfct); - nf_conntrack_put_reasm(skb->nfct_reasm); -@@ -424,6 +510,9 @@ static void __copy_skb_header(struct sk_ - new->sp = secpath_get(old->sp); - #endif - memcpy(new->cb, old->cb, sizeof(old->cb)); -+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -+ skb_copy_stored_cb(new, old); -+#endif - new->csum_start = old->csum_start; - new->csum_offset = old->csum_offset; - new->local_df = old->local_df; -@@ -2326,6 +2415,13 @@ void __init skb_init(void) - 0, - SLAB_HWCACHE_ALIGN|SLAB_PANIC, - NULL); -+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -+ skbuff_cb_store_cache = kmem_cache_create("skbuff_cb_store_cache", -+ sizeof(struct skb_cb_table), -+ 0, -+ SLAB_HWCACHE_ALIGN|SLAB_PANIC, -+ NULL); -+#endif - } - - /** ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -342,6 +342,18 @@ config NETFILTER_XT_TARGET_DSCP - - To compile it as a module, choose M here. If unsure, say N. - -+config NETFILTER_XT_TARGET_IMQ -+ tristate '"IMQ" target support' -+ depends on NETFILTER_XTABLES -+ depends on IP_NF_MANGLE || IP6_NF_MANGLE -+ select IMQ -+ default m if NETFILTER_ADVANCED=n -+ help -+ This option adds a `IMQ' target which is used to specify if and -+ to which imq device packets should get enqueued/dequeued. -+ -+ To compile it as a module, choose M here. If unsure, say N. -+ - config NETFILTER_XT_TARGET_MARK - tristate '"MARK" target support' - depends on NETFILTER_XTABLES ---- a/net/netfilter/Makefile -+++ b/net/netfilter/Makefile -@@ -42,6 +42,7 @@ obj-$(CONFIG_NETFILTER_XT_TARGET_CLASSIF - obj-$(CONFIG_NETFILTER_XT_TARGET_CONNMARK) += xt_CONNMARK.o - obj-$(CONFIG_NETFILTER_XT_TARGET_CONNSECMARK) += xt_CONNSECMARK.o - obj-$(CONFIG_NETFILTER_XT_TARGET_DSCP) += xt_DSCP.o -+obj-$(CONFIG_NETFILTER_XT_TARGET_IMQ) += xt_IMQ.o - obj-$(CONFIG_NETFILTER_XT_TARGET_MARK) += xt_MARK.o - obj-$(CONFIG_NETFILTER_XT_TARGET_NFLOG) += xt_NFLOG.o - obj-$(CONFIG_NETFILTER_XT_TARGET_NFQUEUE) += xt_NFQUEUE.o ---- a/net/netfilter/nf_queue.c -+++ b/net/netfilter/nf_queue.c -@@ -20,6 +20,26 @@ static const struct nf_queue_handler *qu - - static DEFINE_MUTEX(queue_handler_mutex); - -+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -+static const struct nf_queue_handler *queue_imq_handler; -+ -+void nf_register_queue_imq_handler(const struct nf_queue_handler *qh) -+{ -+ mutex_lock(&queue_handler_mutex); -+ rcu_assign_pointer(queue_imq_handler, qh); -+ mutex_unlock(&queue_handler_mutex); -+} -+EXPORT_SYMBOL(nf_register_queue_imq_handler); -+ -+void nf_unregister_queue_imq_handler(void) -+{ -+ mutex_lock(&queue_handler_mutex); -+ rcu_assign_pointer(queue_imq_handler, NULL); -+ mutex_unlock(&queue_handler_mutex); -+} -+EXPORT_SYMBOL(nf_unregister_queue_imq_handler); -+#endif -+ - /* return EBUSY when somebody else is registered, return EEXIST if the - * same handler is registered, return 0 in case of success. */ - int nf_register_queue_handler(int pf, const struct nf_queue_handler *qh) -@@ -80,7 +100,7 @@ void nf_unregister_queue_handlers(const - } - EXPORT_SYMBOL_GPL(nf_unregister_queue_handlers); - --static void nf_queue_entry_release_refs(struct nf_queue_entry *entry) -+void nf_queue_entry_release_refs(struct nf_queue_entry *entry) - { - /* Release those devices we held, or Alexey will kill me. */ - if (entry->indev) -@@ -100,6 +120,7 @@ static void nf_queue_entry_release_refs( - /* Drop reference to owner of hook which queued us. */ - module_put(entry->elem->owner); - } -+EXPORT_SYMBOL_GPL(nf_queue_entry_release_refs); - - /* - * Any packet that leaves via this function must come back -@@ -121,12 +142,26 @@ static int __nf_queue(struct sk_buff *sk - #endif - const struct nf_afinfo *afinfo; - const struct nf_queue_handler *qh; -+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -+ const struct nf_queue_handler *qih = NULL; -+#endif - - /* QUEUE == DROP if noone is waiting, to be safe. */ - rcu_read_lock(); - - qh = rcu_dereference(queue_handler[pf]); -+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) -+ if (pf == PF_INET || pf == PF_INET6) -+#else -+ if (pf == PF_INET) -+#endif -+ qih = rcu_dereference(queue_imq_handler); -+ -+ if (!qh && !qih) -+#else /* !IMQ */ - if (!qh) -+#endif - goto err_unlock; - - afinfo = nf_get_afinfo(pf); -@@ -145,6 +180,10 @@ static int __nf_queue(struct sk_buff *sk - .indev = indev, - .outdev = outdev, - .okfn = okfn, -+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -+ .next_outfn = qh ? qh->outfn : NULL, -+ .next_queuenum = queuenum, -+#endif - }; - - /* If it's going away, ignore hook. */ -@@ -170,8 +209,19 @@ static int __nf_queue(struct sk_buff *sk - } - #endif - afinfo->saveroute(skb, entry); -+ -+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -+ if (qih) { -+ status = qih->outfn(entry, queuenum); -+ goto imq_skip_queue; -+ } -+#endif -+ - status = qh->outfn(entry, queuenum); - -+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -+imq_skip_queue: -+#endif - rcu_read_unlock(); - - if (status < 0) { ---- /dev/null -+++ b/net/netfilter/xt_IMQ.c -@@ -0,0 +1,81 @@ -+/* -+ * This target marks packets to be enqueued to an imq device -+ */ -+#include -+#include -+#include -+#include -+#include -+ -+static unsigned int imq_target(struct sk_buff *pskb, -+ const struct net_device *in, -+ const struct net_device *out, -+ unsigned int hooknum, -+ const struct xt_target *target, -+ const void *targinfo) -+{ -+ const struct xt_imq_info *mr = targinfo; -+ -+ pskb->imq_flags = (mr->todev & IMQ_F_IFMASK) | IMQ_F_ENQUEUE; -+ -+ return XT_CONTINUE; -+} -+ -+static bool imq_checkentry(const char *tablename, -+ const void *entry, -+ const struct xt_target *target, -+ void *targinfo, -+ unsigned int hook_mask) -+{ -+ struct xt_imq_info *mr = targinfo; -+ -+ if (mr->todev > IMQ_MAX_DEVS - 1) { -+ printk(KERN_WARNING -+ "IMQ: invalid device specified, highest is %u\n", -+ IMQ_MAX_DEVS - 1); -+ return 0; -+ } -+ -+ return 1; -+} -+ -+static struct xt_target xt_imq_reg[] __read_mostly = { -+ { -+ .name = "IMQ", -+ .family = AF_INET, -+ .target = imq_target, -+ .targetsize = sizeof(struct xt_imq_info), -+ .table = "mangle", -+ .checkentry = imq_checkentry, -+ .me = THIS_MODULE -+ }, -+ { -+ .name = "IMQ", -+ .family = AF_INET6, -+ .target = imq_target, -+ .targetsize = sizeof(struct xt_imq_info), -+ .table = "mangle", -+ .checkentry = imq_checkentry, -+ .me = THIS_MODULE -+ }, -+}; -+ -+static int __init imq_init(void) -+{ -+ return xt_register_targets(xt_imq_reg, ARRAY_SIZE(xt_imq_reg)); -+} -+ -+static void __exit imq_fini(void) -+{ -+ xt_unregister_targets(xt_imq_reg, ARRAY_SIZE(xt_imq_reg)); -+} -+ -+module_init(imq_init); -+module_exit(imq_fini); -+ -+MODULE_AUTHOR("http://www.linuximq.net"); -+MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See http://www.linuximq.net/ for more information."); -+MODULE_LICENSE("GPL"); -+MODULE_ALIAS("ipt_IMQ"); -+MODULE_ALIAS("ip6t_IMQ"); -+ diff --git a/target/linux/generic-2.6/patches-2.6.27/180-netfilter_depends.patch b/target/linux/generic-2.6/patches-2.6.27/180-netfilter_depends.patch deleted file mode 100644 index 74cfa5328..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/180-netfilter_depends.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -165,7 +165,7 @@ config NF_CONNTRACK_FTP - - config NF_CONNTRACK_H323 - tristate "H.323 protocol support" -- depends on NF_CONNTRACK && (IPV6 || IPV6=n) -+ depends on NF_CONNTRACK - depends on NETFILTER_ADVANCED - help - H.323 is a VoIP signalling protocol from ITU-T. As one of the most -@@ -455,7 +455,7 @@ config NETFILTER_XT_TARGET_CONNSECMARK - - config NETFILTER_XT_TARGET_TCPMSS - tristate '"TCPMSS" target support' -- depends on NETFILTER_XTABLES && (IPV6 || IPV6=n) -+ depends on NETFILTER_XTABLES - default m if NETFILTER_ADVANCED=n - ---help--- - This option adds a `TCPMSS' target, which allows you to alter the diff --git a/target/linux/generic-2.6/patches-2.6.27/190-netfilter_rtsp.patch b/target/linux/generic-2.6/patches-2.6.27/190-netfilter_rtsp.patch deleted file mode 100644 index 78a1b30a0..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/190-netfilter_rtsp.patch +++ /dev/null @@ -1,1366 +0,0 @@ ---- /dev/null -+++ b/include/linux/netfilter/nf_conntrack_rtsp.h -@@ -0,0 +1,63 @@ -+/* -+ * RTSP extension for IP connection tracking. -+ * (C) 2003 by Tom Marshall -+ * based on ip_conntrack_irc.h -+ * -+ * 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 of the License, or (at your option) any later version. -+ */ -+#ifndef _IP_CONNTRACK_RTSP_H -+#define _IP_CONNTRACK_RTSP_H -+ -+//#define IP_NF_RTSP_DEBUG 1 -+#define IP_NF_RTSP_VERSION "0.6.21" -+ -+#ifdef __KERNEL__ -+/* port block types */ -+typedef enum { -+ pb_single, /* client_port=x */ -+ pb_range, /* client_port=x-y */ -+ pb_discon /* client_port=x/y (rtspbis) */ -+} portblock_t; -+ -+/* We record seq number and length of rtsp headers here, all in host order. */ -+ -+/* -+ * This structure is per expected connection. It is a member of struct -+ * ip_conntrack_expect. The TCP SEQ for the conntrack expect is stored -+ * there and we are expected to only store the length of the data which -+ * needs replaced. If a packet contains multiple RTSP messages, we create -+ * one expected connection per message. -+ * -+ * We use these variables to mark the entire header block. This may seem -+ * like overkill, but the nature of RTSP requires it. A header may appear -+ * multiple times in a message. We must treat two Transport headers the -+ * same as one Transport header with two entries. -+ */ -+struct ip_ct_rtsp_expect -+{ -+ u_int32_t len; /* length of header block */ -+ portblock_t pbtype; /* Type of port block that was requested */ -+ u_int16_t loport; /* Port that was requested, low or first */ -+ u_int16_t hiport; /* Port that was requested, high or second */ -+#if 0 -+ uint method; /* RTSP method */ -+ uint cseq; /* CSeq from request */ -+#endif -+}; -+ -+extern unsigned int (*nf_nat_rtsp_hook)(struct sk_buff *skb, -+ enum ip_conntrack_info ctinfo, -+ unsigned int matchoff, unsigned int matchlen, -+ struct ip_ct_rtsp_expect *prtspexp, -+ struct nf_conntrack_expect *exp); -+ -+extern void (*nf_nat_rtsp_hook_expectfn)(struct nf_conn *ct, struct nf_conntrack_expect *exp); -+ -+#define RTSP_PORT 554 -+ -+#endif /* __KERNEL__ */ -+ -+#endif /* _IP_CONNTRACK_RTSP_H */ ---- /dev/null -+++ b/include/linux/netfilter_helpers.h -@@ -0,0 +1,133 @@ -+/* -+ * Helpers for netfiler modules. This file provides implementations for basic -+ * functions such as strncasecmp(), etc. -+ * -+ * gcc will warn for defined but unused functions, so we only include the -+ * functions requested. The following macros are used: -+ * NF_NEED_STRNCASECMP nf_strncasecmp() -+ * NF_NEED_STRTOU16 nf_strtou16() -+ * NF_NEED_STRTOU32 nf_strtou32() -+ */ -+#ifndef _NETFILTER_HELPERS_H -+#define _NETFILTER_HELPERS_H -+ -+/* Only include these functions for kernel code. */ -+#ifdef __KERNEL__ -+ -+#include -+#define iseol(c) ( (c) == '\r' || (c) == '\n' ) -+ -+/* -+ * The standard strncasecmp() -+ */ -+#ifdef NF_NEED_STRNCASECMP -+static int -+nf_strncasecmp(const char* s1, const char* s2, u_int32_t len) -+{ -+ if (s1 == NULL || s2 == NULL) -+ { -+ if (s1 == NULL && s2 == NULL) -+ { -+ return 0; -+ } -+ return (s1 == NULL) ? -1 : 1; -+ } -+ while (len > 0 && tolower(*s1) == tolower(*s2)) -+ { -+ len--; -+ s1++; -+ s2++; -+ } -+ return ( (len == 0) ? 0 : (tolower(*s1) - tolower(*s2)) ); -+} -+#endif /* NF_NEED_STRNCASECMP */ -+ -+/* -+ * Parse a string containing a 16-bit unsigned integer. -+ * Returns the number of chars used, or zero if no number is found. -+ */ -+#ifdef NF_NEED_STRTOU16 -+static int -+nf_strtou16(const char* pbuf, u_int16_t* pval) -+{ -+ int n = 0; -+ -+ *pval = 0; -+ while (isdigit(pbuf[n])) -+ { -+ *pval = (*pval * 10) + (pbuf[n] - '0'); -+ n++; -+ } -+ -+ return n; -+} -+#endif /* NF_NEED_STRTOU16 */ -+ -+/* -+ * Parse a string containing a 32-bit unsigned integer. -+ * Returns the number of chars used, or zero if no number is found. -+ */ -+#ifdef NF_NEED_STRTOU32 -+static int -+nf_strtou32(const char* pbuf, u_int32_t* pval) -+{ -+ int n = 0; -+ -+ *pval = 0; -+ while (pbuf[n] >= '0' && pbuf[n] <= '9') -+ { -+ *pval = (*pval * 10) + (pbuf[n] - '0'); -+ n++; -+ } -+ -+ return n; -+} -+#endif /* NF_NEED_STRTOU32 */ -+ -+/* -+ * Given a buffer and length, advance to the next line and mark the current -+ * line. -+ */ -+#ifdef NF_NEED_NEXTLINE -+static int -+nf_nextline(char* p, uint len, uint* poff, uint* plineoff, uint* plinelen) -+{ -+ uint off = *poff; -+ uint physlen = 0; -+ -+ if (off >= len) -+ { -+ return 0; -+ } -+ -+ while (p[off] != '\n') -+ { -+ if (len-off <= 1) -+ { -+ return 0; -+ } -+ -+ physlen++; -+ off++; -+ } -+ -+ /* if we saw a crlf, physlen needs adjusted */ -+ if (physlen > 0 && p[off] == '\n' && p[off-1] == '\r') -+ { -+ physlen--; -+ } -+ -+ /* advance past the newline */ -+ off++; -+ -+ *plineoff = *poff; -+ *plinelen = physlen; -+ *poff = off; -+ -+ return 1; -+} -+#endif /* NF_NEED_NEXTLINE */ -+ -+#endif /* __KERNEL__ */ -+ -+#endif /* _NETFILTER_HELPERS_H */ ---- /dev/null -+++ b/include/linux/netfilter_mime.h -@@ -0,0 +1,89 @@ -+/* -+ * MIME functions for netfilter modules. This file provides implementations -+ * for basic MIME parsing. MIME headers are used in many protocols, such as -+ * HTTP, RTSP, SIP, etc. -+ * -+ * gcc will warn for defined but unused functions, so we only include the -+ * functions requested. The following macros are used: -+ * NF_NEED_MIME_NEXTLINE nf_mime_nextline() -+ */ -+#ifndef _NETFILTER_MIME_H -+#define _NETFILTER_MIME_H -+ -+/* Only include these functions for kernel code. */ -+#ifdef __KERNEL__ -+ -+#include -+ -+/* -+ * Given a buffer and length, advance to the next line and mark the current -+ * line. If the current line is empty, *plinelen will be set to zero. If -+ * not, it will be set to the actual line length (including CRLF). -+ * -+ * 'line' in this context means logical line (includes LWS continuations). -+ * Returns 1 on success, 0 on failure. -+ */ -+#ifdef NF_NEED_MIME_NEXTLINE -+static int -+nf_mime_nextline(char* p, uint len, uint* poff, uint* plineoff, uint* plinelen) -+{ -+ uint off = *poff; -+ uint physlen = 0; -+ int is_first_line = 1; -+ -+ if (off >= len) -+ { -+ return 0; -+ } -+ -+ do -+ { -+ while (p[off] != '\n') -+ { -+ if (len-off <= 1) -+ { -+ return 0; -+ } -+ -+ physlen++; -+ off++; -+ } -+ -+ /* if we saw a crlf, physlen needs adjusted */ -+ if (physlen > 0 && p[off] == '\n' && p[off-1] == '\r') -+ { -+ physlen--; -+ } -+ -+ /* advance past the newline */ -+ off++; -+ -+ /* check for an empty line */ -+ if (physlen == 0) -+ { -+ break; -+ } -+ -+ /* check for colon on the first physical line */ -+ if (is_first_line) -+ { -+ is_first_line = 0; -+ if (memchr(p+(*poff), ':', physlen) == NULL) -+ { -+ return 0; -+ } -+ } -+ } -+ while (p[off] == ' ' || p[off] == '\t'); -+ -+ *plineoff = *poff; -+ *plinelen = (physlen == 0) ? 0 : (off - *poff); -+ *poff = off; -+ -+ return 1; -+} -+#endif /* NF_NEED_MIME_NEXTLINE */ -+ -+#endif /* __KERNEL__ */ -+ -+#endif /* _NETFILTER_MIME_H */ ---- a/net/ipv4/netfilter/Makefile -+++ b/net/ipv4/netfilter/Makefile -@@ -23,6 +23,7 @@ obj-$(CONFIG_NF_NAT_AMANDA) += nf_nat_am - obj-$(CONFIG_NF_NAT_FTP) += nf_nat_ftp.o - obj-$(CONFIG_NF_NAT_H323) += nf_nat_h323.o - obj-$(CONFIG_NF_NAT_IRC) += nf_nat_irc.o -+obj-$(CONFIG_NF_NAT_RTSP) += nf_nat_rtsp.o - obj-$(CONFIG_NF_NAT_PPTP) += nf_nat_pptp.o - obj-$(CONFIG_NF_NAT_SIP) += nf_nat_sip.o - obj-$(CONFIG_NF_NAT_SNMP_BASIC) += nf_nat_snmp_basic.o ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -278,6 +278,16 @@ config NF_CONNTRACK_TFTP - - To compile it as a module, choose M here. If unsure, say N. - -+config NF_CONNTRACK_RTSP -+ tristate "RTSP protocol support" -+ depends on NF_CONNTRACK -+ help -+ Support the RTSP protocol. This allows UDP transports to be setup -+ properly, including RTP and RDT. -+ -+ If you want to compile it as a module, say 'M' here and read -+ Documentation/modules.txt. If unsure, say 'Y'. -+ - config NF_CT_NETLINK - tristate 'Connection tracking netlink interface' - depends on NF_CONNTRACK ---- a/net/netfilter/Makefile -+++ b/net/netfilter/Makefile -@@ -33,6 +33,7 @@ obj-$(CONFIG_NF_CONNTRACK_PPTP) += nf_co - obj-$(CONFIG_NF_CONNTRACK_SANE) += nf_conntrack_sane.o - obj-$(CONFIG_NF_CONNTRACK_SIP) += nf_conntrack_sip.o - obj-$(CONFIG_NF_CONNTRACK_TFTP) += nf_conntrack_tftp.o -+obj-$(CONFIG_NF_CONNTRACK_RTSP) += nf_conntrack_rtsp.o - - # generic X tables - obj-$(CONFIG_NETFILTER_XTABLES) += x_tables.o xt_tcpudp.o ---- a/net/ipv4/netfilter/Kconfig -+++ b/net/ipv4/netfilter/Kconfig -@@ -270,6 +270,11 @@ config NF_NAT_IRC - depends on IP_NF_IPTABLES && NF_CONNTRACK && NF_NAT - default NF_NAT && NF_CONNTRACK_IRC - -+config NF_NAT_RTSP -+ tristate -+ depends on IP_NF_IPTABLES && NF_CONNTRACK && NF_NAT -+ default NF_NAT && NF_CONNTRACK_RTSP -+ - config NF_NAT_TFTP - tristate - depends on IP_NF_IPTABLES && NF_CONNTRACK && NF_NAT ---- /dev/null -+++ b/net/netfilter/nf_conntrack_rtsp.c -@@ -0,0 +1,517 @@ -+/* -+ * RTSP extension for IP connection tracking -+ * (C) 2003 by Tom Marshall -+ * based on ip_conntrack_irc.c -+ * -+ * 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 of the License, or (at your option) any later version. -+ * -+ * Module load syntax: -+ * insmod nf_conntrack_rtsp.o ports=port1,port2,...port -+ * max_outstanding=n setup_timeout=secs -+ * -+ * If no ports are specified, the default will be port 554. -+ * -+ * With max_outstanding you can define the maximum number of not yet -+ * answered SETUP requests per RTSP session (default 8). -+ * With setup_timeout you can specify how long the system waits for -+ * an expected data channel (default 300 seconds). -+ * -+ * 2005-02-13: Harald Welte -+ * - port to 2.6 -+ * - update to recent post-2.6.11 api changes -+ * 2006-09-14: Steven Van Acker -+ * - removed calls to NAT code from conntrack helper: NAT no longer needed to use rtsp-conntrack -+ * 2007-04-18: Michael Guntsche -+ * - Port to new NF API -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#define NF_NEED_STRNCASECMP -+#define NF_NEED_STRTOU16 -+#define NF_NEED_STRTOU32 -+#define NF_NEED_NEXTLINE -+#include -+#define NF_NEED_MIME_NEXTLINE -+#include -+ -+#include -+#define MAX_SIMUL_SETUP 8 /* XXX: use max_outstanding */ -+#define INFOP(fmt, args...) printk(KERN_INFO "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args) -+#if 0 -+#define DEBUGP(fmt, args...) printk(KERN_DEBUG "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args) -+#else -+#define DEBUGP(fmt, args...) -+#endif -+ -+#define MAX_PORTS 8 -+static int ports[MAX_PORTS]; -+static int num_ports = 0; -+static int max_outstanding = 8; -+static unsigned int setup_timeout = 300; -+ -+MODULE_AUTHOR("Tom Marshall "); -+MODULE_DESCRIPTION("RTSP connection tracking module"); -+MODULE_LICENSE("GPL"); -+module_param_array(ports, int, &num_ports, 0400); -+MODULE_PARM_DESC(ports, "port numbers of RTSP servers"); -+module_param(max_outstanding, int, 0400); -+MODULE_PARM_DESC(max_outstanding, "max number of outstanding SETUP requests per RTSP session"); -+module_param(setup_timeout, int, 0400); -+MODULE_PARM_DESC(setup_timeout, "timeout on for unestablished data channels"); -+ -+static char *rtsp_buffer; -+static DEFINE_SPINLOCK(rtsp_buffer_lock); -+ -+unsigned int (*nf_nat_rtsp_hook)(struct sk_buff *skb, -+ enum ip_conntrack_info ctinfo, -+ unsigned int matchoff, unsigned int matchlen,struct ip_ct_rtsp_expect* prtspexp, -+ struct nf_conntrack_expect *exp); -+void (*nf_nat_rtsp_hook_expectfn)(struct nf_conn *ct, struct nf_conntrack_expect *exp); -+ -+EXPORT_SYMBOL_GPL(nf_nat_rtsp_hook); -+ -+/* -+ * Max mappings we will allow for one RTSP connection (for RTP, the number -+ * of allocated ports is twice this value). Note that SMIL burns a lot of -+ * ports so keep this reasonably high. If this is too low, you will see a -+ * lot of "no free client map entries" messages. -+ */ -+#define MAX_PORT_MAPS 16 -+ -+/*** default port list was here in the masq code: 554, 3030, 4040 ***/ -+ -+#define SKIP_WSPACE(ptr,len,off) while(off < len && isspace(*(ptr+off))) { off++; } -+ -+/* -+ * Parse an RTSP packet. -+ * -+ * Returns zero if parsing failed. -+ * -+ * Parameters: -+ * IN ptcp tcp data pointer -+ * IN tcplen tcp data len -+ * IN/OUT ptcpoff points to current tcp offset -+ * OUT phdrsoff set to offset of rtsp headers -+ * OUT phdrslen set to length of rtsp headers -+ * OUT pcseqoff set to offset of CSeq header -+ * OUT pcseqlen set to length of CSeq header -+ */ -+static int -+rtsp_parse_message(char* ptcp, uint tcplen, uint* ptcpoff, -+ uint* phdrsoff, uint* phdrslen, -+ uint* pcseqoff, uint* pcseqlen, -+ uint* transoff, uint* translen) -+{ -+ uint entitylen = 0; -+ uint lineoff; -+ uint linelen; -+ -+ if (!nf_nextline(ptcp, tcplen, ptcpoff, &lineoff, &linelen)) -+ return 0; -+ -+ *phdrsoff = *ptcpoff; -+ while (nf_mime_nextline(ptcp, tcplen, ptcpoff, &lineoff, &linelen)) { -+ if (linelen == 0) { -+ if (entitylen > 0) -+ *ptcpoff += min(entitylen, tcplen - *ptcpoff); -+ break; -+ } -+ if (lineoff+linelen > tcplen) { -+ INFOP("!! overrun !!\n"); -+ break; -+ } -+ -+ if (nf_strncasecmp(ptcp+lineoff, "CSeq:", 5) == 0) { -+ *pcseqoff = lineoff; -+ *pcseqlen = linelen; -+ } -+ -+ if (nf_strncasecmp(ptcp+lineoff, "Transport:", 10) == 0) { -+ *transoff = lineoff; -+ *translen = linelen; -+ } -+ -+ if (nf_strncasecmp(ptcp+lineoff, "Content-Length:", 15) == 0) { -+ uint off = lineoff+15; -+ SKIP_WSPACE(ptcp+lineoff, linelen, off); -+ nf_strtou32(ptcp+off, &entitylen); -+ } -+ } -+ *phdrslen = (*ptcpoff) - (*phdrsoff); -+ -+ return 1; -+} -+ -+/* -+ * Find lo/hi client ports (if any) in transport header -+ * In: -+ * ptcp, tcplen = packet -+ * tranoff, tranlen = buffer to search -+ * -+ * Out: -+ * pport_lo, pport_hi = lo/hi ports (host endian) -+ * -+ * Returns nonzero if any client ports found -+ * -+ * Note: it is valid (and expected) for the client to request multiple -+ * transports, so we need to parse the entire line. -+ */ -+static int -+rtsp_parse_transport(char* ptran, uint tranlen, -+ struct ip_ct_rtsp_expect* prtspexp) -+{ -+ int rc = 0; -+ uint off = 0; -+ -+ if (tranlen < 10 || !iseol(ptran[tranlen-1]) || -+ nf_strncasecmp(ptran, "Transport:", 10) != 0) { -+ INFOP("sanity check failed\n"); -+ return 0; -+ } -+ -+ DEBUGP("tran='%.*s'\n", (int)tranlen, ptran); -+ off += 10; -+ SKIP_WSPACE(ptran, tranlen, off); -+ -+ /* Transport: tran;field;field=val,tran;field;field=val,... */ -+ while (off < tranlen) { -+ const char* pparamend; -+ uint nextparamoff; -+ -+ pparamend = memchr(ptran+off, ',', tranlen-off); -+ pparamend = (pparamend == NULL) ? ptran+tranlen : pparamend+1; -+ nextparamoff = pparamend-ptran; -+ -+ while (off < nextparamoff) { -+ const char* pfieldend; -+ uint nextfieldoff; -+ -+ pfieldend = memchr(ptran+off, ';', nextparamoff-off); -+ nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1; -+ -+ if (strncmp(ptran+off, "client_port=", 12) == 0) { -+ u_int16_t port; -+ uint numlen; -+ -+ off += 12; -+ numlen = nf_strtou16(ptran+off, &port); -+ off += numlen; -+ if (prtspexp->loport != 0 && prtspexp->loport != port) -+ DEBUGP("multiple ports found, port %hu ignored\n", port); -+ else { -+ DEBUGP("lo port found : %hu\n", port); -+ prtspexp->loport = prtspexp->hiport = port; -+ if (ptran[off] == '-') { -+ off++; -+ numlen = nf_strtou16(ptran+off, &port); -+ off += numlen; -+ prtspexp->pbtype = pb_range; -+ prtspexp->hiport = port; -+ -+ // If we have a range, assume rtp: -+ // loport must be even, hiport must be loport+1 -+ if ((prtspexp->loport & 0x0001) != 0 || -+ prtspexp->hiport != prtspexp->loport+1) { -+ DEBUGP("incorrect range: %hu-%hu, correcting\n", -+ prtspexp->loport, prtspexp->hiport); -+ prtspexp->loport &= 0xfffe; -+ prtspexp->hiport = prtspexp->loport+1; -+ } -+ } else if (ptran[off] == '/') { -+ off++; -+ numlen = nf_strtou16(ptran+off, &port); -+ off += numlen; -+ prtspexp->pbtype = pb_discon; -+ prtspexp->hiport = port; -+ } -+ rc = 1; -+ } -+ } -+ -+ /* -+ * Note we don't look for the destination parameter here. -+ * If we are using NAT, the NAT module will handle it. If not, -+ * and the client is sending packets elsewhere, the expectation -+ * will quietly time out. -+ */ -+ -+ off = nextfieldoff; -+ } -+ -+ off = nextparamoff; -+ } -+ -+ return rc; -+} -+ -+void expected(struct nf_conn *ct, struct nf_conntrack_expect *exp) -+{ -+ if(nf_nat_rtsp_hook_expectfn) { -+ nf_nat_rtsp_hook_expectfn(ct,exp); -+ } -+} -+ -+/*** conntrack functions ***/ -+ -+/* outbound packet: client->server */ -+ -+static inline int -+help_out(struct sk_buff *skb, unsigned char *rb_ptr, unsigned int datalen, -+ struct nf_conn *ct, enum ip_conntrack_info ctinfo) -+{ -+ struct ip_ct_rtsp_expect expinfo; -+ -+ int dir = CTINFO2DIR(ctinfo); /* = IP_CT_DIR_ORIGINAL */ -+ //struct tcphdr* tcph = (void*)iph + iph->ihl * 4; -+ //uint tcplen = pktlen - iph->ihl * 4; -+ char* pdata = rb_ptr; -+ //uint datalen = tcplen - tcph->doff * 4; -+ uint dataoff = 0; -+ int ret = NF_ACCEPT; -+ -+ struct nf_conntrack_expect *exp; -+ -+ __be16 be_loport; -+ -+ memset(&expinfo, 0, sizeof(expinfo)); -+ -+ while (dataoff < datalen) { -+ uint cmdoff = dataoff; -+ uint hdrsoff = 0; -+ uint hdrslen = 0; -+ uint cseqoff = 0; -+ uint cseqlen = 0; -+ uint transoff = 0; -+ uint translen = 0; -+ uint off; -+ -+ if (!rtsp_parse_message(pdata, datalen, &dataoff, -+ &hdrsoff, &hdrslen, -+ &cseqoff, &cseqlen, -+ &transoff, &translen)) -+ break; /* not a valid message */ -+ -+ if (strncmp(pdata+cmdoff, "SETUP ", 6) != 0) -+ continue; /* not a SETUP message */ -+ DEBUGP("found a setup message\n"); -+ -+ off = 0; -+ if(translen) { -+ rtsp_parse_transport(pdata+transoff, translen, &expinfo); -+ } -+ -+ if (expinfo.loport == 0) { -+ DEBUGP("no udp transports found\n"); -+ continue; /* no udp transports found */ -+ } -+ -+ DEBUGP("udp transport found, ports=(%d,%hu,%hu)\n", -+ (int)expinfo.pbtype, expinfo.loport, expinfo.hiport); -+ -+ exp = nf_ct_expect_alloc(ct); -+ if (!exp) { -+ ret = NF_DROP; -+ goto out; -+ } -+ -+ be_loport = htons(expinfo.loport); -+ -+ nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, -+ ct->tuplehash[!dir].tuple.src.l3num, -+ &ct->tuplehash[!dir].tuple.src.u3, &ct->tuplehash[!dir].tuple.dst.u3, -+ IPPROTO_UDP, NULL, &be_loport); -+ -+ exp->master = ct; -+ -+ exp->expectfn = expected; -+ exp->flags = 0; -+ -+ if (expinfo.pbtype == pb_range) { -+ DEBUGP("Changing expectation mask to handle multiple ports\n"); -+ exp->mask.src.u.udp.port = 0xfffe; -+ } -+ -+ DEBUGP("expect_related %u.%u.%u.%u:%u-%u.%u.%u.%u:%u\n", -+ NIPQUAD(exp->tuple.src.u3.ip), -+ ntohs(exp->tuple.src.u.udp.port), -+ NIPQUAD(exp->tuple.dst.u3.ip), -+ ntohs(exp->tuple.dst.u.udp.port)); -+ -+ if (nf_nat_rtsp_hook) -+ /* pass the request off to the nat helper */ -+ ret = nf_nat_rtsp_hook(skb, ctinfo, hdrsoff, hdrslen, &expinfo, exp); -+ else if (nf_ct_expect_related(exp) != 0) { -+ INFOP("nf_ct_expect_related failed\n"); -+ ret = NF_DROP; -+ } -+ nf_ct_expect_put(exp); -+ goto out; -+ } -+out: -+ -+ return ret; -+} -+ -+ -+static inline int -+help_in(struct sk_buff *skb, size_t pktlen, -+ struct nf_conn* ct, enum ip_conntrack_info ctinfo) -+{ -+ return NF_ACCEPT; -+} -+ -+static int help(struct sk_buff *skb, unsigned int protoff, -+ struct nf_conn *ct, enum ip_conntrack_info ctinfo) -+{ -+ struct tcphdr _tcph, *th; -+ unsigned int dataoff, datalen; -+ char *rb_ptr; -+ int ret = NF_DROP; -+ -+ /* Until there's been traffic both ways, don't look in packets. */ -+ if (ctinfo != IP_CT_ESTABLISHED && -+ ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) { -+ DEBUGP("conntrackinfo = %u\n", ctinfo); -+ return NF_ACCEPT; -+ } -+ -+ /* Not whole TCP header? */ -+ th = skb_header_pointer(skb, protoff, sizeof(_tcph), &_tcph); -+ -+ if (!th) -+ return NF_ACCEPT; -+ -+ /* No data ? */ -+ dataoff = protoff + th->doff*4; -+ datalen = skb->len - dataoff; -+ if (dataoff >= skb->len) -+ return NF_ACCEPT; -+ -+ spin_lock_bh(&rtsp_buffer_lock); -+ rb_ptr = skb_header_pointer(skb, dataoff, -+ skb->len - dataoff, rtsp_buffer); -+ BUG_ON(rb_ptr == NULL); -+ -+#if 0 -+ /* Checksum invalid? Ignore. */ -+ /* FIXME: Source route IP option packets --RR */ -+ if (tcp_v4_check(tcph, tcplen, iph->saddr, iph->daddr, -+ csum_partial((char*)tcph, tcplen, 0))) -+ { -+ DEBUGP("bad csum: %p %u %u.%u.%u.%u %u.%u.%u.%u\n", -+ tcph, tcplen, NIPQUAD(iph->saddr), NIPQUAD(iph->daddr)); -+ return NF_ACCEPT; -+ } -+#endif -+ -+ switch (CTINFO2DIR(ctinfo)) { -+ case IP_CT_DIR_ORIGINAL: -+ ret = help_out(skb, rb_ptr, datalen, ct, ctinfo); -+ break; -+ case IP_CT_DIR_REPLY: -+ DEBUGP("IP_CT_DIR_REPLY\n"); -+ /* inbound packet: server->client */ -+ ret = NF_ACCEPT; -+ break; -+ } -+ -+ spin_unlock_bh(&rtsp_buffer_lock); -+ -+ return ret; -+} -+ -+static struct nf_conntrack_helper rtsp_helpers[MAX_PORTS]; -+static char rtsp_names[MAX_PORTS][10]; -+static struct nf_conntrack_expect_policy rtsp_expect_policy; -+ -+/* This function is intentionally _NOT_ defined as __exit */ -+static void -+fini(void) -+{ -+ int i; -+ for (i = 0; i < num_ports; i++) { -+ DEBUGP("unregistering port %d\n", ports[i]); -+ nf_conntrack_helper_unregister(&rtsp_helpers[i]); -+ } -+ kfree(rtsp_buffer); -+} -+ -+static int __init -+init(void) -+{ -+ int i, ret; -+ struct nf_conntrack_helper *hlpr; -+ char *tmpname; -+ -+ printk("nf_conntrack_rtsp v" IP_NF_RTSP_VERSION " loading\n"); -+ -+ if (max_outstanding < 1) { -+ printk("nf_conntrack_rtsp: max_outstanding must be a positive integer\n"); -+ return -EBUSY; -+ } -+ if (setup_timeout < 0) { -+ printk("nf_conntrack_rtsp: setup_timeout must be a positive integer\n"); -+ return -EBUSY; -+ } -+ -+ rtsp_expect_policy.max_expected = max_outstanding; -+ rtsp_expect_policy.timeout = setup_timeout; -+ -+ rtsp_buffer = kmalloc(65536, GFP_KERNEL); -+ if (!rtsp_buffer) -+ return -ENOMEM; -+ -+ /* If no port given, default to standard rtsp port */ -+ if (ports[0] == 0) { -+ ports[0] = RTSP_PORT; -+ } -+ -+ for (i = 0; (i < MAX_PORTS) && ports[i]; i++) { -+ hlpr = &rtsp_helpers[i]; -+ memset(hlpr, 0, sizeof(struct nf_conntrack_helper)); -+ hlpr->tuple.src.u.tcp.port = htons(ports[i]); -+ hlpr->tuple.dst.protonum = IPPROTO_TCP; -+ hlpr->expect_policy = &rtsp_expect_policy; -+ hlpr->me = THIS_MODULE; -+ hlpr->help = help; -+ -+ tmpname = &rtsp_names[i][0]; -+ if (ports[i] == RTSP_PORT) { -+ sprintf(tmpname, "rtsp"); -+ } else { -+ sprintf(tmpname, "rtsp-%d", i); -+ } -+ hlpr->name = tmpname; -+ -+ DEBUGP("port #%d: %d\n", i, ports[i]); -+ -+ ret = nf_conntrack_helper_register(hlpr); -+ -+ if (ret) { -+ printk("nf_conntrack_rtsp: ERROR registering port %d\n", ports[i]); -+ fini(); -+ return -EBUSY; -+ } -+ num_ports++; -+ } -+ return 0; -+} -+ -+module_init(init); -+module_exit(fini); -+ -+EXPORT_SYMBOL(nf_nat_rtsp_hook_expectfn); -+ ---- /dev/null -+++ b/net/ipv4/netfilter/nf_nat_rtsp.c -@@ -0,0 +1,496 @@ -+/* -+ * RTSP extension for TCP NAT alteration -+ * (C) 2003 by Tom Marshall -+ * based on ip_nat_irc.c -+ * -+ * 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 of the License, or (at your option) any later version. -+ * -+ * Module load syntax: -+ * insmod nf_nat_rtsp.o ports=port1,port2,...port -+ * stunaddr=
-+ * destaction=[auto|strip|none] -+ * -+ * If no ports are specified, the default will be port 554 only. -+ * -+ * stunaddr specifies the address used to detect that a client is using STUN. -+ * If this address is seen in the destination parameter, it is assumed that -+ * the client has already punched a UDP hole in the firewall, so we don't -+ * mangle the client_port. If none is specified, it is autodetected. It -+ * only needs to be set if you have multiple levels of NAT. It should be -+ * set to the external address that the STUN clients detect. Note that in -+ * this case, it will not be possible for clients to use UDP with servers -+ * between the NATs. -+ * -+ * If no destaction is specified, auto is used. -+ * destaction=auto: strip destination parameter if it is not stunaddr. -+ * destaction=strip: always strip destination parameter (not recommended). -+ * destaction=none: do not touch destination parameter (not recommended). -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#define NF_NEED_STRNCASECMP -+#define NF_NEED_STRTOU16 -+#include -+#define NF_NEED_MIME_NEXTLINE -+#include -+ -+#define INFOP(fmt, args...) printk(KERN_INFO "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args) -+#if 0 -+#define DEBUGP(fmt, args...) printk(KERN_DEBUG "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args) -+#else -+#define DEBUGP(fmt, args...) -+#endif -+ -+#define MAX_PORTS 8 -+#define DSTACT_AUTO 0 -+#define DSTACT_STRIP 1 -+#define DSTACT_NONE 2 -+ -+static char* stunaddr = NULL; -+static char* destaction = NULL; -+ -+static u_int32_t extip = 0; -+static int dstact = 0; -+ -+MODULE_AUTHOR("Tom Marshall "); -+MODULE_DESCRIPTION("RTSP network address translation module"); -+MODULE_LICENSE("GPL"); -+module_param(stunaddr, charp, 0644); -+MODULE_PARM_DESC(stunaddr, "Address for detecting STUN"); -+module_param(destaction, charp, 0644); -+MODULE_PARM_DESC(destaction, "Action for destination parameter (auto/strip/none)"); -+ -+#define SKIP_WSPACE(ptr,len,off) while(off < len && isspace(*(ptr+off))) { off++; } -+ -+/*** helper functions ***/ -+ -+static void -+get_skb_tcpdata(struct sk_buff* skb, char** pptcpdata, uint* ptcpdatalen) -+{ -+ struct iphdr* iph = ip_hdr(skb); -+ struct tcphdr* tcph = (void *)iph + ip_hdrlen(skb); -+ -+ *pptcpdata = (char*)tcph + tcph->doff*4; -+ *ptcpdatalen = ((char*)skb_transport_header(skb) + skb->len) - *pptcpdata; -+} -+ -+/*** nat functions ***/ -+ -+/* -+ * Mangle the "Transport:" header: -+ * - Replace all occurences of "client_port=" -+ * - Handle destination parameter -+ * -+ * In: -+ * ct, ctinfo = conntrack context -+ * skb = packet -+ * tranoff = Transport header offset from TCP data -+ * tranlen = Transport header length (incl. CRLF) -+ * rport_lo = replacement low port (host endian) -+ * rport_hi = replacement high port (host endian) -+ * -+ * Returns packet size difference. -+ * -+ * Assumes that a complete transport header is present, ending with CR or LF -+ */ -+static int -+rtsp_mangle_tran(enum ip_conntrack_info ctinfo, -+ struct nf_conntrack_expect* exp, -+ struct ip_ct_rtsp_expect* prtspexp, -+ struct sk_buff* skb, uint tranoff, uint tranlen) -+{ -+ char* ptcp; -+ uint tcplen; -+ char* ptran; -+ char rbuf1[16]; /* Replacement buffer (one port) */ -+ uint rbuf1len; /* Replacement len (one port) */ -+ char rbufa[16]; /* Replacement buffer (all ports) */ -+ uint rbufalen; /* Replacement len (all ports) */ -+ u_int32_t newip; -+ u_int16_t loport, hiport; -+ uint off = 0; -+ uint diff; /* Number of bytes we removed */ -+ -+ struct nf_conn *ct = exp->master; -+ struct nf_conntrack_tuple *t; -+ -+ char szextaddr[15+1]; -+ uint extaddrlen; -+ int is_stun; -+ -+ get_skb_tcpdata(skb, &ptcp, &tcplen); -+ ptran = ptcp+tranoff; -+ -+ if (tranoff+tranlen > tcplen || tcplen-tranoff < tranlen || -+ tranlen < 10 || !iseol(ptran[tranlen-1]) || -+ nf_strncasecmp(ptran, "Transport:", 10) != 0) -+ { -+ INFOP("sanity check failed\n"); -+ return 0; -+ } -+ off += 10; -+ SKIP_WSPACE(ptcp+tranoff, tranlen, off); -+ -+ newip = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip; -+ t = &exp->tuple; -+ t->dst.u3.ip = newip; -+ -+ extaddrlen = extip ? sprintf(szextaddr, "%u.%u.%u.%u", NIPQUAD(extip)) -+ : sprintf(szextaddr, "%u.%u.%u.%u", NIPQUAD(newip)); -+ DEBUGP("stunaddr=%s (%s)\n", szextaddr, (extip?"forced":"auto")); -+ -+ rbuf1len = rbufalen = 0; -+ switch (prtspexp->pbtype) -+ { -+ case pb_single: -+ for (loport = prtspexp->loport; loport != 0; loport++) /* XXX: improper wrap? */ -+ { -+ t->dst.u.udp.port = htons(loport); -+ if (nf_ct_expect_related(exp) == 0) -+ { -+ DEBUGP("using port %hu\n", loport); -+ break; -+ } -+ } -+ if (loport != 0) -+ { -+ rbuf1len = sprintf(rbuf1, "%hu", loport); -+ rbufalen = sprintf(rbufa, "%hu", loport); -+ } -+ break; -+ case pb_range: -+ for (loport = prtspexp->loport; loport != 0; loport += 2) /* XXX: improper wrap? */ -+ { -+ t->dst.u.udp.port = htons(loport); -+ if (nf_ct_expect_related(exp) == 0) -+ { -+ hiport = loport + ~exp->mask.src.u.udp.port; -+ DEBUGP("using ports %hu-%hu\n", loport, hiport); -+ break; -+ } -+ } -+ if (loport != 0) -+ { -+ rbuf1len = sprintf(rbuf1, "%hu", loport); -+ rbufalen = sprintf(rbufa, "%hu-%hu", loport, loport+1); -+ } -+ break; -+ case pb_discon: -+ for (loport = prtspexp->loport; loport != 0; loport++) /* XXX: improper wrap? */ -+ { -+ t->dst.u.udp.port = htons(loport); -+ if (nf_ct_expect_related(exp) == 0) -+ { -+ DEBUGP("using port %hu (1 of 2)\n", loport); -+ break; -+ } -+ } -+ for (hiport = prtspexp->hiport; hiport != 0; hiport++) /* XXX: improper wrap? */ -+ { -+ t->dst.u.udp.port = htons(hiport); -+ if (nf_ct_expect_related(exp) == 0) -+ { -+ DEBUGP("using port %hu (2 of 2)\n", hiport); -+ break; -+ } -+ } -+ if (loport != 0 && hiport != 0) -+ { -+ rbuf1len = sprintf(rbuf1, "%hu", loport); -+ if (hiport == loport+1) -+ { -+ rbufalen = sprintf(rbufa, "%hu-%hu", loport, hiport); -+ } -+ else -+ { -+ rbufalen = sprintf(rbufa, "%hu/%hu", loport, hiport); -+ } -+ } -+ break; -+ } -+ -+ if (rbuf1len == 0) -+ { -+ return 0; /* cannot get replacement port(s) */ -+ } -+ -+ /* Transport: tran;field;field=val,tran;field;field=val,... */ -+ while (off < tranlen) -+ { -+ uint saveoff; -+ const char* pparamend; -+ uint nextparamoff; -+ -+ pparamend = memchr(ptran+off, ',', tranlen-off); -+ pparamend = (pparamend == NULL) ? ptran+tranlen : pparamend+1; -+ nextparamoff = pparamend-ptcp; -+ -+ /* -+ * We pass over each param twice. On the first pass, we look for a -+ * destination= field. It is handled by the security policy. If it -+ * is present, allowed, and equal to our external address, we assume -+ * that STUN is being used and we leave the client_port= field alone. -+ */ -+ is_stun = 0; -+ saveoff = off; -+ while (off < nextparamoff) -+ { -+ const char* pfieldend; -+ uint nextfieldoff; -+ -+ pfieldend = memchr(ptran+off, ';', nextparamoff-off); -+ nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1; -+ -+ if (dstact != DSTACT_NONE && strncmp(ptran+off, "destination=", 12) == 0) -+ { -+ if (strncmp(ptran+off+12, szextaddr, extaddrlen) == 0) -+ { -+ is_stun = 1; -+ } -+ if (dstact == DSTACT_STRIP || (dstact == DSTACT_AUTO && !is_stun)) -+ { -+ diff = nextfieldoff-off; -+ if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo, -+ off, diff, NULL, 0)) -+ { -+ /* mangle failed, all we can do is bail */ -+ nf_ct_unexpect_related(exp); -+ return 0; -+ } -+ get_skb_tcpdata(skb, &ptcp, &tcplen); -+ ptran = ptcp+tranoff; -+ tranlen -= diff; -+ nextparamoff -= diff; -+ nextfieldoff -= diff; -+ } -+ } -+ -+ off = nextfieldoff; -+ } -+ if (is_stun) -+ { -+ continue; -+ } -+ off = saveoff; -+ while (off < nextparamoff) -+ { -+ const char* pfieldend; -+ uint nextfieldoff; -+ -+ pfieldend = memchr(ptran+off, ';', nextparamoff-off); -+ nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1; -+ -+ if (strncmp(ptran+off, "client_port=", 12) == 0) -+ { -+ u_int16_t port; -+ uint numlen; -+ uint origoff; -+ uint origlen; -+ char* rbuf = rbuf1; -+ uint rbuflen = rbuf1len; -+ -+ off += 12; -+ origoff = (ptran-ptcp)+off; -+ origlen = 0; -+ numlen = nf_strtou16(ptran+off, &port); -+ off += numlen; -+ origlen += numlen; -+ if (port != prtspexp->loport) -+ { -+ DEBUGP("multiple ports found, port %hu ignored\n", port); -+ } -+ else -+ { -+ if (ptran[off] == '-' || ptran[off] == '/') -+ { -+ off++; -+ origlen++; -+ numlen = nf_strtou16(ptran+off, &port); -+ off += numlen; -+ origlen += numlen; -+ rbuf = rbufa; -+ rbuflen = rbufalen; -+ } -+ -+ /* -+ * note we cannot just memcpy() if the sizes are the same. -+ * the mangle function does skb resizing, checks for a -+ * cloned skb, and updates the checksums. -+ * -+ * parameter 4 below is offset from start of tcp data. -+ */ -+ diff = origlen-rbuflen; -+ if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo, -+ origoff, origlen, rbuf, rbuflen)) -+ { -+ /* mangle failed, all we can do is bail */ -+ nf_ct_unexpect_related(exp); -+ return 0; -+ } -+ get_skb_tcpdata(skb, &ptcp, &tcplen); -+ ptran = ptcp+tranoff; -+ tranlen -= diff; -+ nextparamoff -= diff; -+ nextfieldoff -= diff; -+ } -+ } -+ -+ off = nextfieldoff; -+ } -+ -+ off = nextparamoff; -+ } -+ -+ return 1; -+} -+ -+static uint -+help_out(struct sk_buff *skb, enum ip_conntrack_info ctinfo, -+ unsigned int matchoff, unsigned int matchlen, struct ip_ct_rtsp_expect* prtspexp, -+ struct nf_conntrack_expect* exp) -+{ -+ char* ptcp; -+ uint tcplen; -+ uint hdrsoff; -+ uint hdrslen; -+ uint lineoff; -+ uint linelen; -+ uint off; -+ -+ //struct iphdr* iph = (struct iphdr*)skb->nh.iph; -+ //struct tcphdr* tcph = (struct tcphdr*)((void*)iph + iph->ihl*4); -+ -+ get_skb_tcpdata(skb, &ptcp, &tcplen); -+ hdrsoff = matchoff;//exp->seq - ntohl(tcph->seq); -+ hdrslen = matchlen; -+ off = hdrsoff; -+ DEBUGP("NAT rtsp help_out\n"); -+ -+ while (nf_mime_nextline(ptcp, hdrsoff+hdrslen, &off, &lineoff, &linelen)) -+ { -+ if (linelen == 0) -+ { -+ break; -+ } -+ if (off > hdrsoff+hdrslen) -+ { -+ INFOP("!! overrun !!"); -+ break; -+ } -+ DEBUGP("hdr: len=%u, %.*s", linelen, (int)linelen, ptcp+lineoff); -+ -+ if (nf_strncasecmp(ptcp+lineoff, "Transport:", 10) == 0) -+ { -+ uint oldtcplen = tcplen; -+ DEBUGP("hdr: Transport\n"); -+ if (!rtsp_mangle_tran(ctinfo, exp, prtspexp, skb, lineoff, linelen)) -+ { -+ DEBUGP("hdr: Transport mangle failed"); -+ break; -+ } -+ get_skb_tcpdata(skb, &ptcp, &tcplen); -+ hdrslen -= (oldtcplen-tcplen); -+ off -= (oldtcplen-tcplen); -+ lineoff -= (oldtcplen-tcplen); -+ linelen -= (oldtcplen-tcplen); -+ DEBUGP("rep: len=%u, %.*s", linelen, (int)linelen, ptcp+lineoff); -+ } -+ } -+ -+ return NF_ACCEPT; -+} -+ -+static unsigned int -+help(struct sk_buff *skb, enum ip_conntrack_info ctinfo, -+ unsigned int matchoff, unsigned int matchlen, struct ip_ct_rtsp_expect* prtspexp, -+ struct nf_conntrack_expect* exp) -+{ -+ int dir = CTINFO2DIR(ctinfo); -+ int rc = NF_ACCEPT; -+ -+ switch (dir) -+ { -+ case IP_CT_DIR_ORIGINAL: -+ rc = help_out(skb, ctinfo, matchoff, matchlen, prtspexp, exp); -+ break; -+ case IP_CT_DIR_REPLY: -+ DEBUGP("unmangle ! %u\n", ctinfo); -+ /* XXX: unmangle */ -+ rc = NF_ACCEPT; -+ break; -+ } -+ //UNLOCK_BH(&ip_rtsp_lock); -+ -+ return rc; -+} -+ -+static void expected(struct nf_conn* ct, struct nf_conntrack_expect *exp) -+{ -+ struct nf_nat_multi_range_compat mr; -+ u_int32_t newdstip, newsrcip, newip; -+ -+ struct nf_conn *master = ct->master; -+ -+ newdstip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip; -+ newsrcip = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip; -+ //FIXME (how to port that ?) -+ //code from 2.4 : newip = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC) ? newsrcip : newdstip; -+ newip = newdstip; -+ -+ DEBUGP("newsrcip=%u.%u.%u.%u, newdstip=%u.%u.%u.%u, newip=%u.%u.%u.%u\n", -+ NIPQUAD(newsrcip), NIPQUAD(newdstip), NIPQUAD(newip)); -+ -+ mr.rangesize = 1; -+ // We don't want to manip the per-protocol, just the IPs. -+ mr.range[0].flags = IP_NAT_RANGE_MAP_IPS; -+ mr.range[0].min_ip = mr.range[0].max_ip = newip; -+ -+ nf_nat_setup_info(ct, &mr.range[0], IP_NAT_MANIP_DST); -+} -+ -+ -+static void __exit fini(void) -+{ -+ nf_nat_rtsp_hook = NULL; -+ nf_nat_rtsp_hook_expectfn = NULL; -+ synchronize_net(); -+} -+ -+static int __init init(void) -+{ -+ printk("nf_nat_rtsp v" IP_NF_RTSP_VERSION " loading\n"); -+ -+ BUG_ON(nf_nat_rtsp_hook); -+ nf_nat_rtsp_hook = help; -+ nf_nat_rtsp_hook_expectfn = &expected; -+ -+ if (stunaddr != NULL) -+ extip = in_aton(stunaddr); -+ -+ if (destaction != NULL) { -+ if (strcmp(destaction, "auto") == 0) -+ dstact = DSTACT_AUTO; -+ -+ if (strcmp(destaction, "strip") == 0) -+ dstact = DSTACT_STRIP; -+ -+ if (strcmp(destaction, "none") == 0) -+ dstact = DSTACT_NONE; -+ } -+ -+ return 0; -+} -+ -+module_init(init); -+module_exit(fini); diff --git a/target/linux/generic-2.6/patches-2.6.27/200-sched_esfq.patch b/target/linux/generic-2.6/patches-2.6.27/200-sched_esfq.patch deleted file mode 100644 index ef4c21f77..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/200-sched_esfq.patch +++ /dev/null @@ -1,795 +0,0 @@ ---- a/include/linux/pkt_sched.h -+++ b/include/linux/pkt_sched.h -@@ -173,8 +173,37 @@ struct tc_sfq_xstats - * - * The only reason for this is efficiency, it is possible - * to change these parameters in compile time. -+ * -+ * If you need to play with these values, use esfq instead. - */ - -+/* ESFQ section */ -+ -+enum -+{ -+ /* traditional */ -+ TCA_SFQ_HASH_CLASSIC, -+ TCA_SFQ_HASH_DST, -+ TCA_SFQ_HASH_SRC, -+ TCA_SFQ_HASH_FWMARK, -+ /* conntrack */ -+ TCA_SFQ_HASH_CTORIGDST, -+ TCA_SFQ_HASH_CTORIGSRC, -+ TCA_SFQ_HASH_CTREPLDST, -+ TCA_SFQ_HASH_CTREPLSRC, -+ TCA_SFQ_HASH_CTNATCHG, -+}; -+ -+struct tc_esfq_qopt -+{ -+ unsigned quantum; /* Bytes per round allocated to flow */ -+ int perturb_period; /* Period of hash perturbation */ -+ __u32 limit; /* Maximal packets in queue */ -+ unsigned divisor; /* Hash divisor */ -+ unsigned flows; /* Maximal number of flows */ -+ unsigned hash_kind; /* Hash function to use for flow identification */ -+}; -+ - /* RED section */ - - enum ---- a/net/sched/Kconfig -+++ b/net/sched/Kconfig -@@ -128,6 +128,37 @@ config NET_SCH_SFQ - To compile this code as a module, choose M here: the - module will be called sch_sfq. - -+config NET_SCH_ESFQ -+ tristate "Enhanced Stochastic Fairness Queueing (ESFQ)" -+ ---help--- -+ Say Y here if you want to use the Enhanced Stochastic Fairness -+ Queueing (ESFQ) packet scheduling algorithm for some of your network -+ devices or as a leaf discipline for a classful qdisc such as HTB or -+ CBQ (see the top of for details and -+ references to the SFQ algorithm). -+ -+ This is an enchanced SFQ version which allows you to control some -+ hardcoded values in the SFQ scheduler. -+ -+ ESFQ also adds control of the hash function used to identify packet -+ flows. The original SFQ discipline hashes by connection; ESFQ add -+ several other hashing methods, such as by src IP or by dst IP, which -+ can be more fair to users in some networking situations. -+ -+ To compile this code as a module, choose M here: the -+ module will be called sch_esfq. -+ -+config NET_SCH_ESFQ_NFCT -+ bool "Connection Tracking Hash Types" -+ depends on NET_SCH_ESFQ && NF_CONNTRACK -+ ---help--- -+ Say Y here to enable support for hashing based on netfilter connection -+ tracking information. This is useful for a router that is also using -+ NAT to connect privately-addressed hosts to the Internet. If you want -+ to provide fair distribution of upstream bandwidth, ESFQ must use -+ connection tracking information, since all outgoing packets will share -+ the same source address. -+ - config NET_SCH_TEQL - tristate "True Link Equalizer (TEQL)" - ---help--- ---- a/net/sched/Makefile -+++ b/net/sched/Makefile -@@ -23,6 +23,7 @@ obj-$(CONFIG_NET_SCH_GRED) += sch_gred.o - obj-$(CONFIG_NET_SCH_INGRESS) += sch_ingress.o - obj-$(CONFIG_NET_SCH_DSMARK) += sch_dsmark.o - obj-$(CONFIG_NET_SCH_SFQ) += sch_sfq.o -+obj-$(CONFIG_NET_SCH_ESFQ) += sch_esfq.o - obj-$(CONFIG_NET_SCH_TBF) += sch_tbf.o - obj-$(CONFIG_NET_SCH_TEQL) += sch_teql.o - obj-$(CONFIG_NET_SCH_PRIO) += sch_prio.o ---- /dev/null -+++ b/net/sched/sch_esfq.c -@@ -0,0 +1,702 @@ -+/* -+ * net/sched/sch_esfq.c Extended Stochastic Fairness Queueing discipline. -+ * -+ * 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 of the License, or (at your option) any later version. -+ * -+ * Authors: Alexey Kuznetsov, -+ * -+ * Changes: Alexander Atanasov, -+ * Added dynamic depth,limit,divisor,hash_kind options. -+ * Added dst and src hashes. -+ * -+ * Alexander Clouter, -+ * Ported ESFQ to Linux 2.6. -+ * -+ * Corey Hickey, -+ * Maintenance of the Linux 2.6 port. -+ * Added fwmark hash (thanks to Robert Kurjata). -+ * Added usage of jhash. -+ * Added conntrack support. -+ * Added ctnatchg hash (thanks to Ben Pfountz). -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* Stochastic Fairness Queuing algorithm. -+ For more comments look at sch_sfq.c. -+ The difference is that you can change limit, depth, -+ hash table size and choose alternate hash types. -+ -+ classic: same as in sch_sfq.c -+ dst: destination IP address -+ src: source IP address -+ fwmark: netfilter mark value -+ ctorigdst: original destination IP address -+ ctorigsrc: original source IP address -+ ctrepldst: reply destination IP address -+ ctreplsrc: reply source IP -+ -+*/ -+ -+#define ESFQ_HEAD 0 -+#define ESFQ_TAIL 1 -+ -+/* This type should contain at least SFQ_DEPTH*2 values */ -+typedef unsigned int esfq_index; -+ -+struct esfq_head -+{ -+ esfq_index next; -+ esfq_index prev; -+}; -+ -+struct esfq_sched_data -+{ -+/* Parameters */ -+ int perturb_period; -+ unsigned quantum; /* Allotment per round: MUST BE >= MTU */ -+ int limit; -+ unsigned depth; -+ unsigned hash_divisor; -+ unsigned hash_kind; -+/* Variables */ -+ struct timer_list perturb_timer; -+ int perturbation; -+ esfq_index tail; /* Index of current slot in round */ -+ esfq_index max_depth; /* Maximal depth */ -+ -+ esfq_index *ht; /* Hash table */ -+ esfq_index *next; /* Active slots link */ -+ short *allot; /* Current allotment per slot */ -+ unsigned short *hash; /* Hash value indexed by slots */ -+ struct sk_buff_head *qs; /* Slot queue */ -+ struct esfq_head *dep; /* Linked list of slots, indexed by depth */ -+}; -+ -+/* This contains the info we will hash. */ -+struct esfq_packet_info -+{ -+ u32 proto; /* protocol or port */ -+ u32 src; /* source from packet header */ -+ u32 dst; /* destination from packet header */ -+ u32 ctorigsrc; /* original source from conntrack */ -+ u32 ctorigdst; /* original destination from conntrack */ -+ u32 ctreplsrc; /* reply source from conntrack */ -+ u32 ctrepldst; /* reply destination from conntrack */ -+ u32 mark; /* netfilter mark (fwmark) */ -+}; -+ -+static __inline__ unsigned esfq_jhash_1word(struct esfq_sched_data *q,u32 a) -+{ -+ return jhash_1word(a, q->perturbation) & (q->hash_divisor-1); -+} -+ -+static __inline__ unsigned esfq_jhash_2words(struct esfq_sched_data *q, u32 a, u32 b) -+{ -+ return jhash_2words(a, b, q->perturbation) & (q->hash_divisor-1); -+} -+ -+static __inline__ unsigned esfq_jhash_3words(struct esfq_sched_data *q, u32 a, u32 b, u32 c) -+{ -+ return jhash_3words(a, b, c, q->perturbation) & (q->hash_divisor-1); -+} -+ -+static unsigned esfq_hash(struct esfq_sched_data *q, struct sk_buff *skb) -+{ -+ struct esfq_packet_info info; -+#ifdef CONFIG_NET_SCH_ESFQ_NFCT -+ enum ip_conntrack_info ctinfo; -+ struct nf_conn *ct = nf_ct_get(skb, &ctinfo); -+#endif -+ -+ switch (skb->protocol) { -+ case __constant_htons(ETH_P_IP): -+ { -+ struct iphdr *iph = ip_hdr(skb); -+ info.dst = iph->daddr; -+ info.src = iph->saddr; -+ if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) && -+ (iph->protocol == IPPROTO_TCP || -+ iph->protocol == IPPROTO_UDP || -+ iph->protocol == IPPROTO_SCTP || -+ iph->protocol == IPPROTO_DCCP || -+ iph->protocol == IPPROTO_ESP)) -+ info.proto = *(((u32*)iph) + iph->ihl); -+ else -+ info.proto = iph->protocol; -+ break; -+ } -+ case __constant_htons(ETH_P_IPV6): -+ { -+ struct ipv6hdr *iph = ipv6_hdr(skb); -+ /* Hash ipv6 addresses into a u32. This isn't ideal, -+ * but the code is simple. */ -+ info.dst = jhash2(iph->daddr.s6_addr32, 4, q->perturbation); -+ info.src = jhash2(iph->saddr.s6_addr32, 4, q->perturbation); -+ if (iph->nexthdr == IPPROTO_TCP || -+ iph->nexthdr == IPPROTO_UDP || -+ iph->nexthdr == IPPROTO_SCTP || -+ iph->nexthdr == IPPROTO_DCCP || -+ iph->nexthdr == IPPROTO_ESP) -+ info.proto = *(u32*)&iph[1]; -+ else -+ info.proto = iph->nexthdr; -+ break; -+ } -+ default: -+ info.dst = (u32)(unsigned long)skb->dst; -+ info.src = (u32)(unsigned long)skb->sk; -+ info.proto = skb->protocol; -+ } -+ -+ info.mark = skb->mark; -+ -+#ifdef CONFIG_NET_SCH_ESFQ_NFCT -+ /* defaults if there is no conntrack info */ -+ info.ctorigsrc = info.src; -+ info.ctorigdst = info.dst; -+ info.ctreplsrc = info.dst; -+ info.ctrepldst = info.src; -+ /* collect conntrack info */ -+ if (ct && ct != &nf_conntrack_untracked) { -+ if (skb->protocol == __constant_htons(ETH_P_IP)) { -+ info.ctorigsrc = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip; -+ info.ctorigdst = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u3.ip; -+ info.ctreplsrc = ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3.ip; -+ info.ctrepldst = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip; -+ } -+ else if (skb->protocol == __constant_htons(ETH_P_IPV6)) { -+ /* Again, hash ipv6 addresses into a single u32. */ -+ info.ctorigsrc = jhash2(ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip6, 4, q->perturbation); -+ info.ctorigdst = jhash2(ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u3.ip6, 4, q->perturbation); -+ info.ctreplsrc = jhash2(ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3.ip6, 4, q->perturbation); -+ info.ctrepldst = jhash2(ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip6, 4, q->perturbation); -+ } -+ -+ } -+#endif -+ -+ switch(q->hash_kind) { -+ case TCA_SFQ_HASH_CLASSIC: -+ return esfq_jhash_3words(q, info.dst, info.src, info.proto); -+ case TCA_SFQ_HASH_DST: -+ return esfq_jhash_1word(q, info.dst); -+ case TCA_SFQ_HASH_SRC: -+ return esfq_jhash_1word(q, info.src); -+ case TCA_SFQ_HASH_FWMARK: -+ return esfq_jhash_1word(q, info.mark); -+#ifdef CONFIG_NET_SCH_ESFQ_NFCT -+ case TCA_SFQ_HASH_CTORIGDST: -+ return esfq_jhash_1word(q, info.ctorigdst); -+ case TCA_SFQ_HASH_CTORIGSRC: -+ return esfq_jhash_1word(q, info.ctorigsrc); -+ case TCA_SFQ_HASH_CTREPLDST: -+ return esfq_jhash_1word(q, info.ctrepldst); -+ case TCA_SFQ_HASH_CTREPLSRC: -+ return esfq_jhash_1word(q, info.ctreplsrc); -+ case TCA_SFQ_HASH_CTNATCHG: -+ { -+ if (info.ctorigdst == info.ctreplsrc) -+ return esfq_jhash_1word(q, info.ctorigsrc); -+ return esfq_jhash_1word(q, info.ctreplsrc); -+ } -+#endif -+ default: -+ if (net_ratelimit()) -+ printk(KERN_WARNING "ESFQ: Unknown hash method. Falling back to classic.\n"); -+ } -+ return esfq_jhash_3words(q, info.dst, info.src, info.proto); -+} -+ -+static inline void esfq_link(struct esfq_sched_data *q, esfq_index x) -+{ -+ esfq_index p, n; -+ int d = q->qs[x].qlen + q->depth; -+ -+ p = d; -+ n = q->dep[d].next; -+ q->dep[x].next = n; -+ q->dep[x].prev = p; -+ q->dep[p].next = q->dep[n].prev = x; -+} -+ -+static inline void esfq_dec(struct esfq_sched_data *q, esfq_index x) -+{ -+ esfq_index p, n; -+ -+ n = q->dep[x].next; -+ p = q->dep[x].prev; -+ q->dep[p].next = n; -+ q->dep[n].prev = p; -+ -+ if (n == p && q->max_depth == q->qs[x].qlen + 1) -+ q->max_depth--; -+ -+ esfq_link(q, x); -+} -+ -+static inline void esfq_inc(struct esfq_sched_data *q, esfq_index x) -+{ -+ esfq_index p, n; -+ int d; -+ -+ n = q->dep[x].next; -+ p = q->dep[x].prev; -+ q->dep[p].next = n; -+ q->dep[n].prev = p; -+ d = q->qs[x].qlen; -+ if (q->max_depth < d) -+ q->max_depth = d; -+ -+ esfq_link(q, x); -+} -+ -+static unsigned int esfq_drop(struct Qdisc *sch) -+{ -+ struct esfq_sched_data *q = qdisc_priv(sch); -+ esfq_index d = q->max_depth; -+ struct sk_buff *skb; -+ unsigned int len; -+ -+ /* Queue is full! Find the longest slot and -+ drop a packet from it */ -+ -+ if (d > 1) { -+ esfq_index x = q->dep[d+q->depth].next; -+ skb = q->qs[x].prev; -+ len = skb->len; -+ __skb_unlink(skb, &q->qs[x]); -+ kfree_skb(skb); -+ esfq_dec(q, x); -+ sch->q.qlen--; -+ sch->qstats.drops++; -+ sch->qstats.backlog -= len; -+ return len; -+ } -+ -+ if (d == 1) { -+ /* It is difficult to believe, but ALL THE SLOTS HAVE LENGTH 1. */ -+ d = q->next[q->tail]; -+ q->next[q->tail] = q->next[d]; -+ q->allot[q->next[d]] += q->quantum; -+ skb = q->qs[d].prev; -+ len = skb->len; -+ __skb_unlink(skb, &q->qs[d]); -+ kfree_skb(skb); -+ esfq_dec(q, d); -+ sch->q.qlen--; -+ q->ht[q->hash[d]] = q->depth; -+ sch->qstats.drops++; -+ sch->qstats.backlog -= len; -+ return len; -+ } -+ -+ return 0; -+} -+ -+static void esfq_q_enqueue(struct sk_buff *skb, struct esfq_sched_data *q, unsigned int end) -+{ -+ unsigned hash = esfq_hash(q, skb); -+ unsigned depth = q->depth; -+ esfq_index x; -+ -+ x = q->ht[hash]; -+ if (x == depth) { -+ q->ht[hash] = x = q->dep[depth].next; -+ q->hash[x] = hash; -+ } -+ -+ if (end == ESFQ_TAIL) -+ __skb_queue_tail(&q->qs[x], skb); -+ else -+ __skb_queue_head(&q->qs[x], skb); -+ -+ esfq_inc(q, x); -+ if (q->qs[x].qlen == 1) { /* The flow is new */ -+ if (q->tail == depth) { /* It is the first flow */ -+ q->tail = x; -+ q->next[x] = x; -+ q->allot[x] = q->quantum; -+ } else { -+ q->next[x] = q->next[q->tail]; -+ q->next[q->tail] = x; -+ q->tail = x; -+ } -+ } -+} -+ -+static int esfq_enqueue(struct sk_buff *skb, struct Qdisc* sch) -+{ -+ struct esfq_sched_data *q = qdisc_priv(sch); -+ esfq_q_enqueue(skb, q, ESFQ_TAIL); -+ sch->qstats.backlog += skb->len; -+ if (++sch->q.qlen < q->limit-1) { -+ sch->bstats.bytes += skb->len; -+ sch->bstats.packets++; -+ return 0; -+ } -+ -+ sch->qstats.drops++; -+ esfq_drop(sch); -+ return NET_XMIT_CN; -+} -+ -+ -+static int esfq_requeue(struct sk_buff *skb, struct Qdisc* sch) -+{ -+ struct esfq_sched_data *q = qdisc_priv(sch); -+ esfq_q_enqueue(skb, q, ESFQ_HEAD); -+ sch->qstats.backlog += skb->len; -+ if (++sch->q.qlen < q->limit - 1) { -+ sch->qstats.requeues++; -+ return 0; -+ } -+ -+ sch->qstats.drops++; -+ esfq_drop(sch); -+ return NET_XMIT_CN; -+} -+ -+static struct sk_buff *esfq_q_dequeue(struct esfq_sched_data *q) -+{ -+ struct sk_buff *skb; -+ unsigned depth = q->depth; -+ esfq_index a, old_a; -+ -+ /* No active slots */ -+ if (q->tail == depth) -+ return NULL; -+ -+ a = old_a = q->next[q->tail]; -+ -+ /* Grab packet */ -+ skb = __skb_dequeue(&q->qs[a]); -+ esfq_dec(q, a); -+ -+ /* Is the slot empty? */ -+ if (q->qs[a].qlen == 0) { -+ q->ht[q->hash[a]] = depth; -+ a = q->next[a]; -+ if (a == old_a) { -+ q->tail = depth; -+ return skb; -+ } -+ q->next[q->tail] = a; -+ q->allot[a] += q->quantum; -+ } else if ((q->allot[a] -= skb->len) <= 0) { -+ q->tail = a; -+ a = q->next[a]; -+ q->allot[a] += q->quantum; -+ } -+ -+ return skb; -+} -+ -+static struct sk_buff *esfq_dequeue(struct Qdisc* sch) -+{ -+ struct esfq_sched_data *q = qdisc_priv(sch); -+ struct sk_buff *skb; -+ -+ skb = esfq_q_dequeue(q); -+ if (skb == NULL) -+ return NULL; -+ sch->q.qlen--; -+ sch->qstats.backlog -= skb->len; -+ return skb; -+} -+ -+static void esfq_q_destroy(struct esfq_sched_data *q) -+{ -+ del_timer(&q->perturb_timer); -+ if(q->ht) -+ kfree(q->ht); -+ if(q->dep) -+ kfree(q->dep); -+ if(q->next) -+ kfree(q->next); -+ if(q->allot) -+ kfree(q->allot); -+ if(q->hash) -+ kfree(q->hash); -+ if(q->qs) -+ kfree(q->qs); -+} -+ -+static void esfq_destroy(struct Qdisc *sch) -+{ -+ struct esfq_sched_data *q = qdisc_priv(sch); -+ esfq_q_destroy(q); -+} -+ -+ -+static void esfq_reset(struct Qdisc* sch) -+{ -+ struct sk_buff *skb; -+ -+ while ((skb = esfq_dequeue(sch)) != NULL) -+ kfree_skb(skb); -+} -+ -+static void esfq_perturbation(unsigned long arg) -+{ -+ struct Qdisc *sch = (struct Qdisc*)arg; -+ struct esfq_sched_data *q = qdisc_priv(sch); -+ -+ q->perturbation = net_random()&0x1F; -+ -+ if (q->perturb_period) { -+ q->perturb_timer.expires = jiffies + q->perturb_period; -+ add_timer(&q->perturb_timer); -+ } -+} -+ -+static unsigned int esfq_check_hash(unsigned int kind) -+{ -+ switch (kind) { -+ case TCA_SFQ_HASH_CTORIGDST: -+ case TCA_SFQ_HASH_CTORIGSRC: -+ case TCA_SFQ_HASH_CTREPLDST: -+ case TCA_SFQ_HASH_CTREPLSRC: -+ case TCA_SFQ_HASH_CTNATCHG: -+#ifndef CONFIG_NET_SCH_ESFQ_NFCT -+ { -+ if (net_ratelimit()) -+ printk(KERN_WARNING "ESFQ: Conntrack hash types disabled in kernel config. Falling back to classic.\n"); -+ return TCA_SFQ_HASH_CLASSIC; -+ } -+#endif -+ case TCA_SFQ_HASH_CLASSIC: -+ case TCA_SFQ_HASH_DST: -+ case TCA_SFQ_HASH_SRC: -+ case TCA_SFQ_HASH_FWMARK: -+ return kind; -+ default: -+ { -+ if (net_ratelimit()) -+ printk(KERN_WARNING "ESFQ: Unknown hash type. Falling back to classic.\n"); -+ return TCA_SFQ_HASH_CLASSIC; -+ } -+ } -+} -+ -+static int esfq_q_init(struct esfq_sched_data *q, struct rtattr *opt) -+{ -+ struct tc_esfq_qopt *ctl = RTA_DATA(opt); -+ esfq_index p = ~0U/2; -+ int i; -+ -+ if (opt && opt->rta_len < RTA_LENGTH(sizeof(*ctl))) -+ return -EINVAL; -+ -+ q->perturbation = 0; -+ q->hash_kind = TCA_SFQ_HASH_CLASSIC; -+ q->max_depth = 0; -+ if (opt == NULL) { -+ q->perturb_period = 0; -+ q->hash_divisor = 1024; -+ q->tail = q->limit = q->depth = 128; -+ -+ } else { -+ struct tc_esfq_qopt *ctl = RTA_DATA(opt); -+ if (ctl->quantum) -+ q->quantum = ctl->quantum; -+ q->perturb_period = ctl->perturb_period*HZ; -+ q->hash_divisor = ctl->divisor ? : 1024; -+ q->tail = q->limit = q->depth = ctl->flows ? : 128; -+ -+ if ( q->depth > p - 1 ) -+ return -EINVAL; -+ -+ if (ctl->limit) -+ q->limit = min_t(u32, ctl->limit, q->depth); -+ -+ if (ctl->hash_kind) { -+ q->hash_kind = esfq_check_hash(ctl->hash_kind); -+ } -+ } -+ -+ q->ht = kmalloc(q->hash_divisor*sizeof(esfq_index), GFP_KERNEL); -+ if (!q->ht) -+ goto err_case; -+ q->dep = kmalloc((1+q->depth*2)*sizeof(struct esfq_head), GFP_KERNEL); -+ if (!q->dep) -+ goto err_case; -+ q->next = kmalloc(q->depth*sizeof(esfq_index), GFP_KERNEL); -+ if (!q->next) -+ goto err_case; -+ q->allot = kmalloc(q->depth*sizeof(short), GFP_KERNEL); -+ if (!q->allot) -+ goto err_case; -+ q->hash = kmalloc(q->depth*sizeof(unsigned short), GFP_KERNEL); -+ if (!q->hash) -+ goto err_case; -+ q->qs = kmalloc(q->depth*sizeof(struct sk_buff_head), GFP_KERNEL); -+ if (!q->qs) -+ goto err_case; -+ -+ for (i=0; i< q->hash_divisor; i++) -+ q->ht[i] = q->depth; -+ for (i=0; idepth; i++) { -+ skb_queue_head_init(&q->qs[i]); -+ q->dep[i+q->depth].next = i+q->depth; -+ q->dep[i+q->depth].prev = i+q->depth; -+ } -+ -+ for (i=0; idepth; i++) -+ esfq_link(q, i); -+ return 0; -+err_case: -+ esfq_q_destroy(q); -+ return -ENOBUFS; -+} -+ -+static int esfq_init(struct Qdisc *sch, struct rtattr *opt) -+{ -+ struct esfq_sched_data *q = qdisc_priv(sch); -+ int err; -+ -+ q->quantum = psched_mtu(qdisc_dev(sch)); /* default */ -+ if ((err = esfq_q_init(q, opt))) -+ return err; -+ -+ init_timer(&q->perturb_timer); -+ q->perturb_timer.data = (unsigned long)sch; -+ q->perturb_timer.function = esfq_perturbation; -+ if (q->perturb_period) { -+ q->perturb_timer.expires = jiffies + q->perturb_period; -+ add_timer(&q->perturb_timer); -+ } -+ -+ return 0; -+} -+ -+static int esfq_change(struct Qdisc *sch, struct rtattr *opt) -+{ -+ struct esfq_sched_data *q = qdisc_priv(sch); -+ struct esfq_sched_data new; -+ struct sk_buff *skb; -+ int err; -+ -+ /* set up new queue */ -+ memset(&new, 0, sizeof(struct esfq_sched_data)); -+ new.quantum = psched_mtu(qdisc_dev(sch)); /* default */ -+ if ((err = esfq_q_init(&new, opt))) -+ return err; -+ -+ /* copy all packets from the old queue to the new queue */ -+ sch_tree_lock(sch); -+ while ((skb = esfq_q_dequeue(q)) != NULL) -+ esfq_q_enqueue(skb, &new, ESFQ_TAIL); -+ -+ /* clean up the old queue */ -+ esfq_q_destroy(q); -+ -+ /* copy elements of the new queue into the old queue */ -+ q->perturb_period = new.perturb_period; -+ q->quantum = new.quantum; -+ q->limit = new.limit; -+ q->depth = new.depth; -+ q->hash_divisor = new.hash_divisor; -+ q->hash_kind = new.hash_kind; -+ q->tail = new.tail; -+ q->max_depth = new.max_depth; -+ q->ht = new.ht; -+ q->dep = new.dep; -+ q->next = new.next; -+ q->allot = new.allot; -+ q->hash = new.hash; -+ q->qs = new.qs; -+ -+ /* finish up */ -+ if (q->perturb_period) { -+ q->perturb_timer.expires = jiffies + q->perturb_period; -+ add_timer(&q->perturb_timer); -+ } else { -+ q->perturbation = 0; -+ } -+ sch_tree_unlock(sch); -+ return 0; -+} -+ -+static int esfq_dump(struct Qdisc *sch, struct sk_buff *skb) -+{ -+ struct esfq_sched_data *q = qdisc_priv(sch); -+ unsigned char *b = skb->tail; -+ struct tc_esfq_qopt opt; -+ -+ opt.quantum = q->quantum; -+ opt.perturb_period = q->perturb_period/HZ; -+ -+ opt.limit = q->limit; -+ opt.divisor = q->hash_divisor; -+ opt.flows = q->depth; -+ opt.hash_kind = q->hash_kind; -+ -+ RTA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt); -+ -+ return skb->len; -+ -+rtattr_failure: -+ skb_trim(skb, b - skb->data); -+ return -1; -+} -+ -+static struct Qdisc_ops esfq_qdisc_ops = -+{ -+ .next = NULL, -+ .cl_ops = NULL, -+ .id = "esfq", -+ .priv_size = sizeof(struct esfq_sched_data), -+ .enqueue = esfq_enqueue, -+ .dequeue = esfq_dequeue, -+ .requeue = esfq_requeue, -+ .drop = esfq_drop, -+ .init = esfq_init, -+ .reset = esfq_reset, -+ .destroy = esfq_destroy, -+ .change = esfq_change, -+ .dump = esfq_dump, -+ .owner = THIS_MODULE, -+}; -+ -+static int __init esfq_module_init(void) -+{ -+ return register_qdisc(&esfq_qdisc_ops); -+} -+static void __exit esfq_module_exit(void) -+{ -+ unregister_qdisc(&esfq_qdisc_ops); -+} -+module_init(esfq_module_init) -+module_exit(esfq_module_exit) -+MODULE_LICENSE("GPL"); diff --git a/target/linux/generic-2.6/patches-2.6.27/202-mips-freestanding.patch b/target/linux/generic-2.6/patches-2.6.27/202-mips-freestanding.patch deleted file mode 100644 index a26d3f2e0..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/202-mips-freestanding.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -584,6 +584,9 @@ core-$(CONFIG_TOSHIBA_RBTX4927) += arch/ - # - core-$(CONFIG_TOSHIBA_RBTX4938) += arch/mips/txx9/rbtx4938/ - -+# temporary until string.h is fixed -+cflags-y += -ffreestanding -+ - cflags-y += -Iinclude/asm-mips/mach-generic - drivers-$(CONFIG_PCI) += arch/mips/pci/ - diff --git a/target/linux/generic-2.6/patches-2.6.27/204-jffs2_eofdetect.patch b/target/linux/generic-2.6/patches-2.6.27/204-jffs2_eofdetect.patch deleted file mode 100644 index 16d3e1f8e..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/204-jffs2_eofdetect.patch +++ /dev/null @@ -1,132 +0,0 @@ ---- a/fs/jffs2/build.c -+++ b/fs/jffs2/build.c -@@ -111,6 +111,17 @@ static int jffs2_build_filesystem(struct - dbg_fsbuild("scanned flash completely\n"); - jffs2_dbg_dump_block_lists_nolock(c); - -+ if (c->flags & (1 << 7)) { -+ printk("%s(): unlocking the mtd device... ", __func__); -+ if (c->mtd->unlock) -+ c->mtd->unlock(c->mtd, 0, c->mtd->size); -+ printk("done.\n"); -+ -+ printk("%s(): erasing all blocks after the end marker... ", __func__); -+ jffs2_erase_pending_blocks(c, -1); -+ printk("done.\n"); -+ } -+ - dbg_fsbuild("pass 1 starting\n"); - c->flags |= JFFS2_SB_FLAG_BUILDING; - /* Now scan the directory tree, increasing nlink according to every dirent found. */ ---- a/fs/jffs2/scan.c -+++ b/fs/jffs2/scan.c -@@ -72,7 +72,7 @@ static int file_dirty(struct jffs2_sb_in - return ret; - if ((ret = jffs2_scan_dirty_space(c, jeb, jeb->free_size))) - return ret; -- /* Turned wasted size into dirty, since we apparently -+ /* Turned wasted size into dirty, since we apparently - think it's recoverable now. */ - jeb->dirty_size += jeb->wasted_size; - c->dirty_size += jeb->wasted_size; -@@ -144,8 +144,11 @@ int jffs2_scan_medium(struct jffs2_sb_in - /* reset summary info for next eraseblock scan */ - jffs2_sum_reset_collected(s); - -- ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset), -- buf_size, s); -+ if (c->flags & (1 << 7)) -+ ret = BLK_STATE_ALLFF; -+ else -+ ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset), -+ buf_size, s); - - if (ret < 0) - goto out; -@@ -400,7 +403,7 @@ static int jffs2_scan_xref_node(struct j - if (!ref) - return -ENOMEM; - -- /* BEFORE jffs2_build_xattr_subsystem() called, -+ /* BEFORE jffs2_build_xattr_subsystem() called, - * and AFTER xattr_ref is marked as a dead xref, - * ref->xid is used to store 32bit xid, xd is not used - * ref->ino is used to store 32bit inode-number, ic is not used -@@ -473,7 +476,7 @@ static int jffs2_scan_eraseblock (struct - struct jffs2_sum_marker *sm; - void *sumptr = NULL; - uint32_t sumlen; -- -+ - if (!buf_size) { - /* XIP case. Just look, point at the summary if it's there */ - sm = (void *)buf + c->sector_size - sizeof(*sm); -@@ -489,9 +492,9 @@ static int jffs2_scan_eraseblock (struct - buf_len = sizeof(*sm); - - /* Read as much as we want into the _end_ of the preallocated buffer */ -- err = jffs2_fill_scan_buf(c, buf + buf_size - buf_len, -+ err = jffs2_fill_scan_buf(c, buf + buf_size - buf_len, - jeb->offset + c->sector_size - buf_len, -- buf_len); -+ buf_len); - if (err) - return err; - -@@ -510,9 +513,9 @@ static int jffs2_scan_eraseblock (struct - } - if (buf_len < sumlen) { - /* Need to read more so that the entire summary node is present */ -- err = jffs2_fill_scan_buf(c, sumptr, -+ err = jffs2_fill_scan_buf(c, sumptr, - jeb->offset + c->sector_size - sumlen, -- sumlen - buf_len); -+ sumlen - buf_len); - if (err) - return err; - } -@@ -525,7 +528,7 @@ static int jffs2_scan_eraseblock (struct - - if (buf_size && sumlen > buf_size) - kfree(sumptr); -- /* If it returns with a real error, bail. -+ /* If it returns with a real error, bail. - If it returns positive, that's a block classification - (i.e. BLK_STATE_xxx) so return that too. - If it returns zero, fall through to full scan. */ -@@ -546,6 +549,17 @@ static int jffs2_scan_eraseblock (struct - return err; - } - -+ if ((buf[0] == 0xde) && -+ (buf[1] == 0xad) && -+ (buf[2] == 0xc0) && -+ (buf[3] == 0xde)) { -+ /* end of filesystem. erase everything after this point */ -+ printk("%s(): End of filesystem marker found at 0x%x\n", __func__, jeb->offset); -+ c->flags |= (1 << 7); -+ -+ return BLK_STATE_ALLFF; -+ } -+ - /* We temporarily use 'ofs' as a pointer into the buffer/jeb */ - ofs = 0; - -@@ -671,7 +685,7 @@ scan_more: - scan_end = buf_len; - goto more_empty; - } -- -+ - /* See how much more there is to read in this eraseblock... */ - buf_len = min_t(uint32_t, buf_size, jeb->offset + c->sector_size - ofs); - if (!buf_len) { -@@ -907,7 +921,7 @@ scan_more: - - D1(printk(KERN_DEBUG "Block at 0x%08x: free 0x%08x, dirty 0x%08x, unchecked 0x%08x, used 0x%08x, wasted 0x%08x\n", - jeb->offset,jeb->free_size, jeb->dirty_size, jeb->unchecked_size, jeb->used_size, jeb->wasted_size)); -- -+ - /* mark_node_obsolete can add to wasted !! */ - if (jeb->wasted_size) { - jeb->dirty_size += jeb->wasted_size; diff --git a/target/linux/generic-2.6/patches-2.6.27/207-powerpc_asm_segment_h.patch b/target/linux/generic-2.6/patches-2.6.27/207-powerpc_asm_segment_h.patch deleted file mode 100644 index 1272e82c7..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/207-powerpc_asm_segment_h.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- /dev/null -+++ b/include/asm-powerpc/segment.h -@@ -0,0 +1,6 @@ -+#ifndef _ASM_SEGMENT_H -+#define _ASM_SEGMENT_H -+ -+/* Only here because we have some old header files that expect it.. */ -+ -+#endif /* _ASM_SEGMENT_H */ diff --git a/target/linux/generic-2.6/patches-2.6.27/208-rtl8110sb_fix.patch b/target/linux/generic-2.6/patches-2.6.27/208-rtl8110sb_fix.patch deleted file mode 100644 index 297db2ac7..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/208-rtl8110sb_fix.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/drivers/net/r8169.c -+++ b/drivers/net/r8169.c -@@ -1526,7 +1526,7 @@ static const struct rtl_cfg_info { - .hw_start = rtl_hw_start_8169, - .region = 1, - .align = 0, -- .intr_event = SYSErr | LinkChg | RxOverflow | -+ .intr_event = LinkChg | RxOverflow | - RxFIFOOver | TxErr | TxOK | RxOK | RxErr, - .napi_event = RxFIFOOver | TxErr | TxOK | RxOK | RxOverflow, - .features = RTL_FEATURE_GMII -@@ -1535,7 +1535,7 @@ static const struct rtl_cfg_info { - .hw_start = rtl_hw_start_8168, - .region = 2, - .align = 8, -- .intr_event = SYSErr | LinkChg | RxOverflow | -+ .intr_event = LinkChg | RxOverflow | - TxErr | TxOK | RxOK | RxErr, - .napi_event = TxErr | TxOK | RxOK | RxOverflow, - .features = RTL_FEATURE_GMII | RTL_FEATURE_MSI -@@ -1544,7 +1544,7 @@ static const struct rtl_cfg_info { - .hw_start = rtl_hw_start_8101, - .region = 2, - .align = 8, -- .intr_event = SYSErr | LinkChg | RxOverflow | PCSTimeout | -+ .intr_event = LinkChg | RxOverflow | PCSTimeout | - RxFIFOOver | TxErr | TxOK | RxOK | RxErr, - .napi_event = RxFIFOOver | TxErr | TxOK | RxOK | RxOverflow, - .features = RTL_FEATURE_MSI -@@ -2872,12 +2872,12 @@ static irqreturn_t rtl8169_interrupt(int - rtl8169_tx_timeout(dev); - break; - } -- -+#if 0 - if (unlikely(status & SYSErr)) { - rtl8169_pcierr_interrupt(dev); - break; - } -- -+#endif - if (status & LinkChg) - rtl8169_check_link_status(dev, tp, ioaddr); - diff --git a/target/linux/generic-2.6/patches-2.6.27/209-mini_fo.patch b/target/linux/generic-2.6/patches-2.6.27/209-mini_fo.patch deleted file mode 100644 index d4abd9222..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/209-mini_fo.patch +++ /dev/null @@ -1,7776 +0,0 @@ ---- a/fs/Kconfig -+++ b/fs/Kconfig -@@ -1430,6 +1430,9 @@ config VXFS_FS - To compile this as a module, choose M here: the module will be - called freevxfs. If unsure, say N. - -+config MINI_FO -+ tristate "Mini fanout overlay filesystem" -+ - config MINIX_FS - tristate "Minix file system support" - depends on BLOCK ---- a/fs/Makefile -+++ b/fs/Makefile -@@ -78,6 +78,7 @@ obj-$(CONFIG_SQUASHFS) += squashfs/ - obj-y += ramfs/ - obj-$(CONFIG_HUGETLBFS) += hugetlbfs/ - obj-$(CONFIG_CODA_FS) += coda/ -+obj-$(CONFIG_MINI_FO) += mini_fo/ - obj-$(CONFIG_MINIX_FS) += minix/ - obj-$(CONFIG_FAT_FS) += fat/ - obj-$(CONFIG_MSDOS_FS) += msdos/ ---- /dev/null -+++ b/fs/mini_fo/aux.c -@@ -0,0 +1,577 @@ -+/* -+ * Copyright (c) 1997-2003 Erez Zadok -+ * Copyright (c) 2001-2003 Stony Brook University -+ * -+ * For specific licensing information, see the COPYING file distributed with -+ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING. -+ * -+ * This Copyright notice must be kept intact and distributed with all -+ * fistgen sources INCLUDING sources generated by fistgen. -+ */ -+/* -+ * Copyright (C) 2004, 2005 Markus Klotzbuecher -+ * -+ * 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 of the License, or (at your option) any later version. -+ */ -+/* -+ * $Id$ -+ */ -+ -+#ifdef HAVE_CONFIG_H -+# include -+#endif -+ -+#include "fist.h" -+#include "mini_fo.h" -+ -+/* check if file exists in storage */ -+int exists_in_storage(dentry_t *dentry) -+{ -+ check_mini_fo_dentry(dentry); -+ if(dtost(dentry) == MODIFIED || dtost(dentry) == CREATED || dtost(dentry) == DEL_REWRITTEN) -+ return 1; -+ return 0; -+} -+ -+/* check if dentry is in an existing state */ -+int is_mini_fo_existant(dentry_t *dentry) -+{ -+ check_mini_fo_dentry(dentry); -+ -+ if(dtost(dentry) == DELETED || dtost(dentry) == NON_EXISTANT) -+ return 0; -+ else -+ return 1; -+} -+ -+/* -+ * This function will create a negative storage dentry for -+ * dentry, what is required for many create like options. -+ * It will create the storage structure if necessary. -+ */ -+int get_neg_sto_dentry(dentry_t *dentry) -+{ -+ int err = 0; -+ unsigned int len; -+ const unsigned char *name; -+ -+ if(!dentry || -+ !dtopd(dentry) || -+ !(dtost(dentry) == UNMODIFIED || -+ dtost(dentry) == NON_EXISTANT || -+ dtost(dentry) == DELETED)) { -+ printk(KERN_CRIT "mini_fo: get_neg_sto_dentry: invalid dentry passed.\n"); -+ err = -1; -+ goto out; -+ } -+ /* Have we got a neg. dentry already? */ -+ if(dtohd2(dentry)) { -+ err = 0; -+ goto out; -+ } -+ if(dtost(dentry->d_parent) == UNMODIFIED) { -+ /* build sto struct */ -+ err = build_sto_structure(dentry->d_parent->d_parent, dentry->d_parent); -+ if(err || -+ dtost(dentry->d_parent) != MODIFIED) { -+ printk(KERN_CRIT "mini_fo: get_neg_sto_dentry: ERROR building sto structure.\n"); -+ err = -1; -+ goto out; -+ } -+ } -+ -+ len = dentry->d_name.len; -+ name = dentry->d_name.name; -+ -+ dtohd2(dentry) = -+ lookup_one_len(name, dtohd2(dentry->d_parent), len); -+ -+ out: -+ return err; -+} -+ -+int check_mini_fo_dentry(dentry_t *dentry) -+{ -+ ASSERT(dentry != NULL); -+ ASSERT(dtopd(dentry) != NULL); -+ ASSERT((dtohd(dentry) != NULL) || (dtohd2(dentry) != NULL)); -+ -+/* if(dtost(dentry) == MODIFIED) { */ -+/* ASSERT(dentry->d_inode != NULL); */ -+/* ASSERT(dtohd(dentry) != NULL); */ -+/* ASSERT(dtohd(dentry)->d_inode != NULL); */ -+/* ASSERT(dtohd2(dentry) != NULL); */ -+/* ASSERT(dtohd2(dentry)->d_inode != NULL); */ -+/* } */ -+/* else if(dtost(dentry) == UNMODIFIED) { */ -+/* ASSERT(dentry->d_inode != NULL); */ -+/* ASSERT( */ -+/* } */ -+ return 0; -+} -+ -+int check_mini_fo_file(file_t *file) -+{ -+ ASSERT(file != NULL); -+ ASSERT(ftopd(file) != NULL); -+ ASSERT(file->f_dentry != NULL); -+ -+ /* violent checking, check depending of state and type -+ * if(S_ISDIR(file->f_dentry->d_inode->i_mode)) {} -+ */ -+ ASSERT((ftohf(file) != NULL) || (ftohf2(file) != NULL)); -+ return 0; -+} -+ -+int check_mini_fo_inode(inode_t *inode) -+{ -+ ASSERT(inode != NULL); -+ ASSERT(itopd(inode) != NULL); -+ ASSERT((itohi(inode) != NULL) || (itohi2(inode) != NULL)); -+ return 0; -+} -+ -+/* -+ * will walk a base path as provided by get_mini_fo_bpath and return -+ * the (hopefully ;-) ) positive dentry of the renamed base dir. -+ * -+ * This does some work of path_init. -+ */ -+dentry_t *bpath_walk(super_block_t *sb, char *bpath) -+{ -+ int err; -+ struct vfsmount *mnt; -+ struct nameidata nd; -+ -+ /* be paranoid */ -+ if(!bpath || bpath[0] != '/') { -+ printk(KERN_CRIT "mini_fo: bpath_walk: Invalid string.\n"); -+ return NULL; -+ } -+ if(!sb || !stopd(sb)) { -+ printk(KERN_CRIT "mini_fo: bpath_walk: Invalid sb.\n"); -+ return NULL; -+ } -+ -+ /* fix this: how do I reach this lock? -+ * read_lock(¤t->fs->lock); */ -+ mnt = mntget(stopd(sb)->hidden_mnt); -+ /* read_unlock(¤t->fs->lock); */ -+ -+ err = vfs_path_lookup(mnt->mnt_root, mnt, bpath+1, 0, &nd); -+ -+ /* validate */ -+ if (err || !nd.dentry || !nd.dentry->d_inode) { -+ printk(KERN_CRIT "mini_fo: bpath_walk: path_walk failed.\n"); -+ return NULL; -+ } -+ return nd.dentry; -+} -+ -+ -+/* returns the full path of the basefile incl. its name */ -+int get_mini_fo_bpath(dentry_t *dentry, char **bpath, int *bpath_len) -+{ -+ char *buf_walker; -+ int len = 0; -+ dentry_t *sky_walker; -+ -+ if(!dentry || !dtohd(dentry)) { -+ printk(KERN_CRIT "mini_fo: get_mini_fo_bpath: invalid dentry passed.\n"); -+ return -1; -+ } -+ sky_walker = dtohd(dentry); -+ -+ do { -+ len += sky_walker->d_name.len + 1 ; /* 1 for '/' */ -+ sky_walker = sky_walker->d_parent; -+ } while(sky_walker != stopd(dentry->d_inode->i_sb)->base_dir_dentry); -+ -+ /* 1 to oil the loop */ -+ *bpath = (char*) kmalloc(len + 1, GFP_KERNEL); -+ if(!*bpath) { -+ printk(KERN_CRIT "mini_fo: get_mini_fo_bpath: out of mem.\n"); -+ return -1; -+ } -+ buf_walker = *bpath+len; /* put it on last char */ -+ *buf_walker = '\n'; -+ sky_walker = dtohd(dentry); -+ -+ do { -+ buf_walker -= sky_walker->d_name.len; -+ strncpy(buf_walker, -+ sky_walker->d_name.name, -+ sky_walker->d_name.len); -+ *(--buf_walker) = '/'; -+ sky_walker = sky_walker->d_parent; -+ } while(sky_walker != stopd(dentry->d_inode->i_sb)->base_dir_dentry); -+ -+ /* bpath_len doesn't count newline! */ -+ *bpath_len = len; -+ return 0; -+} -+ -+int mini_fo_cp_cont(dentry_t *tgt_dentry, struct vfsmount *tgt_mnt, -+ dentry_t *src_dentry, struct vfsmount *src_mnt) -+{ -+ void *buf; -+ mm_segment_t old_fs; -+ file_t *tgt_file; -+ file_t *src_file; -+ int bytes, len, tmp, err; -+ err = 0; -+ -+ if(!(tgt_dentry->d_inode && src_dentry->d_inode)) { -+ printk(KERN_CRIT "mini_fo_cp_cont: ERROR, neg. dentry passed.\n"); -+ err = -EINVAL; -+ goto out; -+ } -+ -+ dget(tgt_dentry); -+ dget(src_dentry); -+ mntget(tgt_mnt); -+ mntget(src_mnt); -+ -+ /* open file write only */ -+ tgt_file = dentry_open(tgt_dentry, tgt_mnt, 0x1); -+ if(!tgt_file || IS_ERR(tgt_file)) { -+ printk(KERN_CRIT "mini_fo_cp_cont: ERROR opening target file.\n"); -+ err = PTR_ERR(tgt_file); -+ goto out_err; -+ } -+ -+ /* open file read only */ -+ src_file = dentry_open(src_dentry, src_mnt, 0x0); -+ if(!src_file || IS_ERR(src_file)) { -+ printk(KERN_CRIT "mini_fo_cp_cont: ERROR opening source file.\n"); -+ err = PTR_ERR(src_file); -+ -+ /* close target file */ -+ fput(tgt_file); -+ goto out_err; -+ } -+ -+ /* check if the filesystem(s) support read respective write */ -+ if(!src_file->f_op->read || !tgt_file->f_op->write) { -+ printk(KERN_CRIT "mini_fo_cp_cont: ERROR, no fs read or write support.\n"); -+ err = -EPERM; -+ goto out_close; -+ } -+ -+ /* allocate a page for transfering the data */ -+ buf = (void *) __get_free_page(GFP_KERNEL); -+ if(!buf) { -+ printk(KERN_CRIT "mini_fo_cp_cont: ERROR, out of kernel mem.\n"); -+ goto out_err; -+ } -+ -+ tgt_file->f_pos = 0; -+ src_file->f_pos = 0; -+ -+ old_fs = get_fs(); -+ set_fs(KERNEL_DS); -+ -+ /* Doing this I assume that a read operation will return a full -+ * buffer while there is still data to read, and a less than -+ * full buffer when all data has been read. -+ */ -+ bytes = len = PAGE_SIZE; -+ while(bytes == len) { -+ bytes = src_file->f_op->read(src_file, buf, len, -+ &src_file->f_pos); -+ tmp = tgt_file->f_op->write(tgt_file, buf, bytes, -+ &tgt_file->f_pos); -+ if(tmp != bytes) { -+ printk(KERN_CRIT "mini_fo_cp_cont: ERROR writing.\n"); -+ goto out_close_unset; -+ } -+ } -+ -+ free_page((unsigned long) buf); -+ set_fs(old_fs); -+ fput(tgt_file); -+ fput(src_file); -+ goto out; -+ -+ out_close_unset: -+ free_page((unsigned long) buf); -+ set_fs(old_fs); -+ -+ out_close: -+ fput(tgt_file); -+ fput(src_file); -+ -+ out_err: -+ dput(tgt_dentry); -+ dput(src_dentry); -+ -+ /* mk: not sure if this need to be done */ -+ mntput(tgt_mnt); -+ mntput(src_mnt); -+ -+ out: -+ return err; -+} -+ -+/* mk: -+ * ndl (no-duplicate list) stuff -+ * This is used in mini_fo_readdir, to save the storage directory contents -+ * and later when reading base, match them against the list in order -+ * to avoid duplicates. -+ */ -+ -+/* add a file specified by name and len to the ndl -+ * Return values: 0 on success, <0 on failure. -+ */ -+int ndl_add_entry(struct readdir_data *rd, const char *name, int len) -+{ -+ struct ndl_entry *tmp_entry; -+ -+ tmp_entry = (struct ndl_entry *) -+ kmalloc(sizeof(struct ndl_entry), GFP_KERNEL); -+ if(!tmp_entry) { -+ printk(KERN_CRIT "mini_fo: ndl_add_entry: out of mem.\n"); -+ return -ENOMEM; -+ } -+ tmp_entry->name = (char*) kmalloc(len, GFP_KERNEL); -+ if(!tmp_entry->name) { -+ printk(KERN_CRIT "mini_fo: ndl_add_entry: out of mem.\n"); -+ return -ENOMEM; -+ } -+ strncpy(tmp_entry->name, name, len); -+ tmp_entry->len = len; -+ -+ list_add(&tmp_entry->list, &rd->ndl_list); -+ rd->ndl_size++; -+ return 0; -+} -+ -+/* delete all list entries and free memory */ -+void ndl_put_list(struct readdir_data *rd) -+{ -+ struct list_head *tmp; -+ struct ndl_entry *tmp_entry; -+ -+ if(rd->ndl_size <= 0) -+ return; -+ while(!list_empty(&rd->ndl_list)) { -+ tmp = rd->ndl_list.next; -+ list_del(tmp); -+ tmp_entry = list_entry(tmp, struct ndl_entry, list); -+ kfree(tmp_entry->name); -+ kfree(tmp_entry); -+ } -+ rd->ndl_size = 0; -+} -+ -+/* Check if a file specified by name and len is in the ndl -+ * Return value: 0 if not in list, 1 if file is found in ndl. -+ */ -+int ndl_check_entry(struct readdir_data *rd, const char *name, int len) -+{ -+ struct list_head *tmp; -+ struct ndl_entry *tmp_entry; -+ -+ if(rd->ndl_size <= 0) -+ return 0; -+ -+ list_for_each(tmp, &rd->ndl_list) { -+ tmp_entry = list_entry(tmp, struct ndl_entry, list); -+ if(tmp_entry->len != len) -+ continue; -+ if(!strncmp(tmp_entry->name, name, len)) -+ return 1; -+ } -+ return 0; -+} -+ -+/* mk: -+ * Recursive function to create corresponding directorys in the storage fs. -+ * The function will build the storage directorys up to dentry. -+ */ -+int build_sto_structure(dentry_t *dir, dentry_t *dentry) -+{ -+ int err; -+ dentry_t *hidden_sto_dentry; -+ dentry_t *hidden_sto_dir_dentry; -+ -+ if(dentry->d_parent != dir) { -+ printk(KERN_CRIT "mini_fo: build_sto_structure: invalid parameter or meta data corruption [1].\n"); -+ return 1; -+ } -+ -+ if(dtost(dir) != MODIFIED) { -+ err = build_sto_structure(dir->d_parent, dentry->d_parent); -+ if(err) -+ return err; -+ } -+ -+ /* ok, coming back again. */ -+ check_mini_fo_dentry(dentry); -+ hidden_sto_dentry = dtohd2(dentry); -+ -+ if(!hidden_sto_dentry) { -+ /* -+ * This is the case after creating the first -+ * hidden_sto_dentry. -+ * After one negative storage_dentry, all pointers to -+ * hidden_storage dentries are set to NULL. We need to -+ * create the negative dentry before we create the storage -+ * file. -+ */ -+ unsigned int len; -+ const unsigned char *name; -+ len = dtohd(dentry)->d_name.len; -+ name = dtohd(dentry)->d_name.name; -+ hidden_sto_dentry = lookup_one_len(name, dtohd2(dir), len); -+ dtohd2(dentry) = hidden_sto_dentry; -+ } -+ -+ /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */ -+ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ down(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ /* lets be safe */ -+ if(dtohd2(dir) != hidden_sto_dir_dentry) { -+ printk(KERN_CRIT "mini_fo: build_sto_structure: invalid parameter or meta data corruption [2].\n"); -+ return 1; -+ } -+ -+ /* check for errors in lock_parent */ -+ err = PTR_ERR(hidden_sto_dir_dentry); -+ if(IS_ERR(hidden_sto_dir_dentry)) { -+ printk(KERN_CRIT "mini_fo: build_sto_structure: lock_parent failed.\n"); -+ return err; -+ } -+ -+ err = vfs_mkdir(hidden_sto_dir_dentry->d_inode, -+ hidden_sto_dentry, -+ dir->d_inode->i_mode); -+ -+ if(err) { -+ printk(KERN_CRIT "mini_fo: build_sto_structure: failed to create storage dir [1].\n"); -+ /* was: unlock_dir(dir); */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&dir->d_inode->i_mutex); -+#else -+ up(&dir->d_inode->i_sem); -+#endif -+ dput(dir); -+ return err; -+ } -+ -+ /* everything ok! */ -+ if(!dtohd2(dentry)->d_inode) { -+ printk(KERN_CRIT "mini_fo: build_sto_structure: failed to create storage dir [2].\n"); -+ /* was: unlock_dir(dir); */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&dir->d_inode->i_mutex); -+#else -+ up(&dir->d_inode->i_sem); -+#endif -+ dput(dir); -+ return 1; -+ } -+ -+ /* interpose the new inode and set new state */ -+ itohi2(dentry->d_inode) = igrab(dtohd2(dentry)->d_inode); -+ dtopd(dentry)->state = MODIFIED; -+ -+ /* initalize the wol list */ -+ itopd(dentry->d_inode)->deleted_list_size = -1; -+ itopd(dentry->d_inode)->renamed_list_size = -1; -+ meta_build_lists(dentry); -+ -+ fist_copy_attr_all(dentry->d_inode, itohi2(dentry->d_inode)); -+ fist_copy_attr_timesizes(dir->d_inode, -+ hidden_sto_dir_dentry->d_inode); -+ dir->d_inode->i_nlink++; -+ /* was: unlock_dir(hidden_sto_dir_dentry); */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ up(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ dput(hidden_sto_dir_dentry); -+ return 0; -+} -+ -+ -+#if 0 /* unused */ -+ -+/* -+ * Read "len" bytes from "filename" into "buf". -+ * "buf" is in kernel space. -+ */ -+int -+mini_fo_read_file(const char *filename, void *buf, int len) -+{ -+ file_t *filp; -+ mm_segment_t oldfs; -+ int bytes; -+ /* Chroot? Maybe NULL isn't right here */ -+ filp = filp_open(filename, O_RDONLY, 0); -+ if (!filp || IS_ERR(filp)) { -+ printk("mini_fo_read_file err %d\n", (int) PTR_ERR(filp)); -+ return -1; /* or do something else */ -+ } -+ -+ if (!filp->f_op->read) -+ return -2; /* file(system) doesn't allow reads */ -+ -+ /* now read len bytes from offset 0 */ -+ filp->f_pos = 0; /* start offset */ -+ oldfs = get_fs(); -+ set_fs(KERNEL_DS); -+ bytes = filp->f_op->read(filp, buf, len, &filp->f_pos); -+ set_fs(oldfs); -+ -+ /* close the file */ -+ fput(filp); -+ -+ return bytes; -+} -+ -+ -+ -+/* -+ * Write "len" bytes from "buf" to "filename" -+ * "buf" is in kernel space. -+ */ -+int -+mini_fo_write_file(const char *filename, void *buf, int len) -+{ -+ file_t *filp; -+ mm_segment_t oldfs; -+ int bytes; -+ /* Chroot? Maybe NULL isn't right here */ -+ filp = filp_open(filename, O_RDWR|O_CREAT, 0640); -+ if (!filp || IS_ERR(filp)) { -+ printk("mini_fo_write_file err %d\n", (int) PTR_ERR(filp)); -+ return -1; /* or do something else */ -+ } -+ -+ if (!filp->f_op->write) -+ return -2; /* file(system) doesn't allow writes */ -+ -+ /* now write len bytes from offset 0 */ -+ filp->f_pos = 0; /* start offset */ -+ oldfs = get_fs(); -+ set_fs(KERNEL_DS); -+ bytes = filp->f_op->write(filp, buf, len, &filp->f_pos); -+ set_fs(oldfs); -+ -+ /* close the file */ -+ fput(filp); -+ -+ return bytes; -+} -+ -+#endif /* unused */ -+ ---- /dev/null -+++ b/fs/mini_fo/ChangeLog -@@ -0,0 +1,281 @@ -+2006-01-24 Markus Klotzbuecher -+ -+ * Add tons of ugly ifdefs to Ed L. Cashin's mutex patch to -+ retain backwards compatibility. -+ -+2006-01-24 Ed L. Cashin -+ -+ * Support for the new mutex infrastructure -+ (7892f2f48d165a34b0b8130c8a195dfd807b8cb6) -+ -+2005-10-15 Markus Klotzbuecher -+ -+ * Bugfix for a serious memory leak in mini_fo_follow_link. -+ -+2005-09-21 Markus Klotzbuecher -+ -+ * new release 0.6.1 -+ -+ * fix of a compiler warning due to changes in 2.6.13 -+ -+2005-09-21 Klaus Wenninger -+ -+ * file.c: readdir: fix for a bug that caused directory entries -+ to show up twice when using storage filesystems such as -+ minixfs or pramfs. -+ -+2005-06-30 Eric Lammerts -+ -+ * fix for an oops when overwriting a binary thats beeing -+ executed. -+ -+2005-06-09 -+ -+ * Renamed overlay to mini_fo-overlay. -+ -+ * Added mini_fo-merge script to allow merging of storage and base -+ after making modifications. -+ -+2005-05-22 root -+ -+ * Added overlay script that allows to easily mount mini_fo ontop -+ of a given base directory -+ -+2005-05-10 -+ -+ * inode.c: xattr functions return -EOPNOSUPP instead of -+ -ENOSUPP, what confuses "ls -l" -+ -+ * Changed license from LGPL to GPL. -+ -+2005-05-08 root -+ -+ * Makefile: clean it up and added make install and make -+ uninstall. -+ -+2005-05-06 -+ -+ * merged devel branch back to main. [v0-6-0-pre3] -+ -+ * removed unused files print.c and fist_ioctl. [devel-0-0-18] -+ -+ * ioctl: removed fist_ioctl stuff, that is not needed for -+ now. -+ -+2005-05-03 -+ -+ * file.c: simplified mini_fo_open and mini_fo_setattr using -+ new state changing functions. [devel-0-0-17] -+ -+ * inode.c: Fixed getattr state bug (see below) in 2.4 function -+ mini_fo_inode revalidate. -+ -+ * inode.c: found an other bug in mini_fo_getattr. States are not -+ reliable in this function, as a file can be opened, unlinked and -+ the getattr function called. This results in a deleted dentry -+ with an inode. Fix is to ignore states and simply use the inode -+ available. -+ -+2005-04-29 -+ -+ * file.c: Bugfix and cleanup in fasync and fsync. [devel-0-0-16] -+ -+ * file.c: do not use mini_fo_lock so the generic version is -+ used (I guess). -+ -+ * inode.c: getattr, never call getattr on lower files, as this -+ will cause the inum to change. -+ -+ * inode.c: rename_reg_file renamed to rename_nondir, as it -+ doesn't matter as long it't not a dir. Removed all -+ rename_dev_file etc. -+ -+ * tagged as devel-0-0-15 -+ -+ * inode.c: added support for chosing support for extended -+ attrs at compile time by XATTR define in mini_fo.h . -+ -+ * inode.c: fixed mini_fo_getattr to use mini_fo inode and not -+ lower again, what avoids inode number changes that confused -+ rm again. This is the proper solution. -+ -+2005-04-24 -+ -+ * all files: updated Copyright notive to 2005. [devel-0-0-14] -+ -+ * inode.c: fixed mini_fo_getattr to not change the inode -+ number, even if lower files change. -+ -+ * super.c: fixed a bug that caused deleted base file to show -+ up suddenly after some time, or after creating a special -+ file. The problem was that after some time or after special -+ file creating sync_sb_inodes is called by the vfs, that -+ called our mini_fo_put_inode. There was (wrongly) called -+ __meta_put_lists, that nuked the lists, although the inode -+ was going to continue its life. Moving __meta_put_lists to -+ mini_fo_clear_inode, where an inode is really destroyed, -+ solved the problem. -+ -+ -+2005-04-23 -+ -+ * state.c, aux.c: more cleaning up and -+ simplifications. [devel-0-0-13] -+ -+ * inode.c: implemented mini_fo_getattr, that was required for -+ 2.6 because inode_revalidate has been remove there, and the -+ old "du" bug returned. -+ -+ -+2005-04-20 -+ -+ * aux.c: get_neg_sto_dentry(): allow to be called for dentries -+ in state UNMODIFIED, NON_EXISTANT _and_ DELETED. -+ -+2005-04-19 -+ -+ * Fixed a bug under 2.6 that caused files deleted via mini_fo -+ not to be deleted properly and therefore the fs filled up -+ untill no memory was left. [devel-0-0-12] -+ -+ * Added basic hard link support. This means that creating -+ hardlinks will work, but existing ones will be treated as -+ individual files. [devel-0-0-11] -+ -+2005-04-17 -+ -+ * Bugfixes -+ -+2005-04-13 root -+ -+ * Added file state.c for the state transition -+ functions. Doesn't work very well yet, though... -+ -+2005-04-12 -+ -+ * Porting to 2.6 started, which is easier than expected, also -+ due to Olivier previous work. -+ -+2005-04-08 -+ -+ * Fixed the bug that caused du to return invalid sizes of -+ directory trees. The problem was that -+ mini_fo_inode_revalidate didn't always copy the attributes -+ from the base inode properly. -+ -+2005-04-01 Markus Klotzbuecher -+ -+ * Merged devel branch back to main trunk and updated the -+ RELEASE notes. This will be 0-6-0-pre1. -+ -+2005-03-31 Markus Klotzbuecher -+ -+ * Fixed some bugs in rename_reg_file, that only showed up in -+ the kernel compile test. Kernel compiles cleanly ontop of -+ mini_fo, now also make mrproper etc. work. Seems pretty stable. -+ -+2005-03-28 Markus Klotzbuecher -+ -+ * Many, many directory renaming bugfixes and a lot of other -+ cleanup. Dir renaming seems to work relatively stable. -+ -+2005-03-22 Markus Klotzbuecher -+ -+ * Finished implementing lightweight directory renaming. Some -+ basic testing indicates it works fine. -+ Next is to implement testcases for the testsuite and confirm -+ everything is really working ok. -+ -+2005-03-18 Markus Klotzbuecher -+ -+ * Finished implementing meta.c stuff required for directory -+ renaming. -+ -+2005-03-17 Markus Klotzbuecher -+ -+ * Fixed all compile warnings + an extremly old bug that -+ somehow crept in while reworking the wol stuff to the META -+ system. Turning on -Werror again... :-) -+ -+ * Fixed some bugs in the new rename_reg_file function. -+ -+ * Rewrote mini_fo rename and split it into several -+ subfunctions, that handle the different types -+ seperately. Rewrote the regular file function aswell, as it -+ was implemented somewhat inefficient. -+ -+2005-03-16 Markus Klotzbuecher -+ -+ * Implemented new META subsystem, removed old WOL stuff in favor -+ if it. -+ -+ * After some basic testing everything seems ok... -+ -+2005-03-11 Markus Klotzbuecher -+ -+ * Renaming a non regular file caused trouble because I always -+ tried to copy the contents. Now I only do this for regular -+ files. mini_fo_rename still isn't implemented properly, renaming -+ of device files, symlinks etc. results in a empty regular file -+ instead of the proper type. -+ -+ * Directory renaming suddenly works! What a surprise! I guess -+ this is because renaming is implemented as making a copy and -+ removing the original. Still this might not work -+ everywhere... -+ -+2005-03-09 Markus Klotzbuecher -+ -+ * Bugfix, when a mini_fo directory that exists in storage -+ (state: MODIFIED, CREATED and DEL_REWRITTEN) is deleted, a -+ possibly existing WOL file contained in it needs to be -+ deleted too. -+ -+ * Starting cleanup: defined state names in order to get rid of -+ the state numbers. -+ -+2005-03-08 Markus Klotzbuecher -+ -+ * Makefile fix, fist_ioctl was built against wrong sources if ARCH=um -+ -+ * Fixed a bug in dentry.c, mini_fo_d_hash. In state 4 = -+ DEL_REWRITTEN the hash was calculated from the base dentry, -+ which was wrong and and caused assertions in -+ __mini_fo_hidden_dentry to fail. -+ -+2005-02-21 -+ -+ * Implemented directory deleting (inode.c) -+ -+ * main.c: made mini_fo_parse_options a little more robust. -+ -+2004-12-22 -+ -+ * Makefile cleanup and uml stuff, removed unneccessary files -+ -+ * Created a new and hopefully more informative README -+ -+ * CHANGELOG: created a new CHANGELOG and added old entries reversely -+ -+ -+2004-10-24 Gleb Natapov -+ -+ * Fix: owner and group where not correctly copied from base to -+ storage. -+ -+ -+2004-10-05 Gleb Natapov -+ -+ * Implementation of fsync, fasync and lock mini_fo functions. -+ -+ -+2004-09-29 Bob Lee -+ -+ * Fix of a serious pointer bug -+ -+ -+2004-09-28 Gleb Natapov -+ -+ * Implementation of mini_fo_mknod and mini_fo_rename, support -+ for device files. -+ ---- /dev/null -+++ b/fs/mini_fo/dentry.c -@@ -0,0 +1,244 @@ -+/* -+ * Copyright (c) 1997-2003 Erez Zadok -+ * Copyright (c) 2001-2003 Stony Brook University -+ * -+ * For specific licensing information, see the COPYING file distributed with -+ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING. -+ * -+ * This Copyright notice must be kept intact and distributed with all -+ * fistgen sources INCLUDING sources generated by fistgen. -+ */ -+/* -+ * Copyright (C) 2004, 2005 Markus Klotzbuecher -+ * -+ * 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 of the License, or (at your option) any later version. -+ */ -+ -+/* -+ * $Id$ -+ */ -+ -+#ifdef HAVE_CONFIG_H -+# include -+#endif -+ -+#include "fist.h" -+#include "mini_fo.h" -+ -+/* -+ * THIS IS A BOOLEAN FUNCTION: returns 1 if valid, 0 otherwise. -+ */ -+STATIC int -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+mini_fo_d_revalidate(dentry_t *dentry, struct nameidata *nd) -+#else -+mini_fo_d_revalidate(dentry_t *dentry, int flags) -+#endif -+{ -+ int err1 = 1; /* valid = 1, invalid = 0 */ -+ int err2 = 1; -+ dentry_t *hidden_dentry; -+ dentry_t *hidden_sto_dentry; -+ -+ -+ check_mini_fo_dentry(dentry); -+ -+ hidden_dentry = dtohd(dentry); -+ hidden_sto_dentry = dtohd2(dentry); -+ -+ if(hidden_dentry && -+ hidden_dentry->d_op && -+ hidden_dentry->d_op->d_revalidate) { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+ err1 = hidden_dentry->d_op->d_revalidate(hidden_dentry, nd); -+#else -+ err1 = hidden_dentry->d_op->d_revalidate(hidden_dentry, flags); -+#endif -+ } -+ if(hidden_sto_dentry && -+ hidden_sto_dentry->d_op && -+ hidden_sto_dentry->d_op->d_revalidate) { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+ err2 = hidden_sto_dentry->d_op->d_revalidate(hidden_sto_dentry, -+ nd); -+#else -+ err2 = hidden_sto_dentry->d_op->d_revalidate(hidden_sto_dentry, -+ flags); -+#endif -+ } -+ -+ /* mk: if one of the lower level dentries are valid, -+ * the mini_fo dentry is too. -+ */ -+ return (err1 || err2); -+} -+ -+ -+STATIC int -+mini_fo_d_hash(dentry_t *dentry, qstr_t *name) -+{ -+ int err = 0; -+ dentry_t *hidden_dentry; -+ dentry_t *hidden_sto_dentry; -+ -+ /* hidden_dentry = mini_fo_hidden_dentry(dentry); -+ * hidden_sto_dentry = mini_fo_hidden_sto_dentry(dentry); */ -+ -+ /* state 1, 3, 4, 5: build the hash for the storage dentry */ -+ if((dtopd(dentry)->state == MODIFIED) || -+ (dtopd(dentry)->state == CREATED) || -+ (dtopd(dentry)->state == DEL_REWRITTEN) || -+ (dtopd(dentry)->state == DELETED)) { -+ hidden_sto_dentry = dtohd2(dentry); -+ if(hidden_sto_dentry && -+ hidden_sto_dentry->d_op && -+ hidden_sto_dentry->d_op->d_hash) { -+ err = hidden_sto_dentry->d_op->d_hash(hidden_sto_dentry, name); -+ } -+ goto out; -+ } -+ /* state 2: build the hash for the base dentry */ -+ if(dtopd(dentry)->state == UNMODIFIED) { -+ hidden_dentry = dtohd(dentry); -+ if(hidden_dentry && -+ hidden_dentry->d_op && -+ hidden_dentry->d_op->d_hash) { -+ err = hidden_dentry->d_op->d_hash(hidden_dentry, name); -+ } -+ goto out; -+ } -+ /* state 6: build hash for the dentry that exists */ -+ if(dtopd(dentry)->state == NON_EXISTANT) { -+ hidden_sto_dentry = dtohd2(dentry); -+ if(hidden_sto_dentry && -+ hidden_sto_dentry->d_op && -+ hidden_sto_dentry->d_op->d_hash) { -+ err = hidden_sto_dentry->d_op->d_hash(hidden_sto_dentry, name); -+ goto out; -+ } -+ hidden_dentry = dtohd(dentry); -+ if(hidden_dentry && -+ hidden_dentry->d_op && -+ hidden_dentry->d_op->d_hash) { -+ err = hidden_dentry->d_op->d_hash(hidden_dentry, name); -+ goto out; -+ } -+ } -+ -+ printk(KERN_CRIT "mini_fo: d_hash: invalid state detected.\n"); -+ -+ out: -+ return err; -+} -+ -+ -+STATIC int -+mini_fo_d_compare(dentry_t *dentry, qstr_t *a, qstr_t *b) -+{ -+ int err; -+ dentry_t *hidden_dentry=NULL; -+ -+ /* hidden_dentry = mini_fo_hidden_dentry(dentry); */ -+ if(dtohd2(dentry)) -+ hidden_dentry = dtohd2(dentry); -+ else if(dtohd(dentry)) -+ hidden_dentry = dtohd(dentry); -+ -+ if (hidden_dentry && hidden_dentry->d_op && hidden_dentry->d_op->d_compare) { -+ err = hidden_dentry->d_op->d_compare(hidden_dentry, a, b); -+ } else { -+ err = ((a->len != b->len) || memcmp(a->name, b->name, b->len)); -+ } -+ -+ return err; -+} -+ -+ -+int -+mini_fo_d_delete(dentry_t *dentry) -+{ -+ dentry_t *hidden_dentry; -+ dentry_t *hidden_sto_dentry; -+ int err = 0; -+ -+ /* this could be a negative dentry, so check first */ -+ if (!dtopd(dentry)) { -+ printk(KERN_CRIT "mini_fo_d_delete: negative dentry passed.\n"); -+ goto out; -+ } -+ hidden_dentry = dtohd(dentry); -+ hidden_sto_dentry = dtohd2(dentry); -+ -+ if(hidden_dentry) { -+ if(hidden_dentry->d_op && -+ hidden_dentry->d_op->d_delete) { -+ err = hidden_dentry->d_op->d_delete(hidden_dentry); -+ } -+ } -+ if(hidden_sto_dentry) { -+ if(hidden_sto_dentry->d_op && -+ hidden_sto_dentry->d_op->d_delete) { -+ err = hidden_sto_dentry->d_op->d_delete(hidden_sto_dentry); -+ } -+ } -+ -+ out: -+ return err; -+} -+ -+ -+void -+mini_fo_d_release(dentry_t *dentry) -+{ -+ dentry_t *hidden_dentry; -+ dentry_t *hidden_sto_dentry; -+ -+ -+ /* this could be a negative dentry, so check first */ -+ if (!dtopd(dentry)) { -+ printk(KERN_CRIT "mini_fo_d_release: no private data.\n"); -+ goto out; -+ } -+ hidden_dentry = dtohd(dentry); -+ hidden_sto_dentry = dtohd2(dentry); -+ -+ if(hidden_dentry) { -+ /* decrement hidden dentry's counter and free its inode */ -+ dput(hidden_dentry); -+ } -+ if(hidden_sto_dentry) { -+ /* decrement hidden dentry's counter and free its inode */ -+ dput(hidden_sto_dentry); -+ } -+ -+ /* free private data (mini_fo_dentry_info) here */ -+ kfree(dtopd(dentry)); -+ __dtopd(dentry) = NULL; /* just to be safe */ -+ out: -+ return; -+} -+ -+ -+/* -+ * we don't really need mini_fo_d_iput, because dentry_iput will call iput() if -+ * mini_fo_d_iput is not defined. We left this implemented for ease of -+ * tracing/debugging. -+ */ -+void -+mini_fo_d_iput(dentry_t *dentry, inode_t *inode) -+{ -+ iput(inode); -+} -+ -+ -+struct dentry_operations mini_fo_dops = { -+ d_revalidate: mini_fo_d_revalidate, -+ d_hash: mini_fo_d_hash, -+ d_compare: mini_fo_d_compare, -+ d_release: mini_fo_d_release, -+ d_delete: mini_fo_d_delete, -+ d_iput: mini_fo_d_iput, -+}; ---- /dev/null -+++ b/fs/mini_fo/file.c -@@ -0,0 +1,713 @@ -+/* -+ * Copyright (c) 1997-2003 Erez Zadok -+ * Copyright (c) 2001-2003 Stony Brook University -+ * -+ * For specific licensing information, see the COPYING file distributed with -+ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING. -+ * -+ * This Copyright notice must be kept intact and distributed with all -+ * fistgen sources INCLUDING sources generated by fistgen. -+ */ -+/* -+ * Copyright (C) 2004, 2005 Markus Klotzbuecher -+ * -+ * 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 of the License, or (at your option) any later version. -+ */ -+ -+/* -+ * $Id$ -+ */ -+ -+#ifdef HAVE_CONFIG_H -+# include -+#endif -+ -+#include "fist.h" -+#include "mini_fo.h" -+#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1)) -+ -+/******************* -+ * File Operations * -+ *******************/ -+ -+STATIC loff_t -+mini_fo_llseek(file_t *file, loff_t offset, int origin) -+{ -+ loff_t err; -+ file_t *hidden_file = NULL; -+ -+ if(S_ISDIR(file->f_dentry->d_inode->i_mode)) { -+ /* Check if trying to llseek from a directory */ -+ err = -EISDIR; -+ goto out; -+ } -+ if (ftopd(file) != NULL) { -+ if(ftohf2(file)) { -+ hidden_file = ftohf2(file); -+ } else { -+ hidden_file = ftohf(file); -+ } -+ } -+ -+ /* always set hidden position to this one */ -+ hidden_file->f_pos = file->f_pos; -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+ memcpy(&(hidden_file->f_ra), -+ &(file->f_ra), -+ sizeof(struct file_ra_state)); -+#else -+ if (file->f_reada) { /* update readahead information if needed */ -+ hidden_file->f_reada = file->f_reada; -+ hidden_file->f_ramax = file->f_ramax; -+ hidden_file->f_raend = file->f_raend; -+ hidden_file->f_ralen = file->f_ralen; -+ hidden_file->f_rawin = file->f_rawin; -+ } -+#endif -+ if (hidden_file->f_op && hidden_file->f_op->llseek) -+ err = hidden_file->f_op->llseek(hidden_file, offset, origin); -+ else -+ err = generic_file_llseek(hidden_file, offset, origin); -+ -+ if (err < 0) -+ goto out; -+ -+ if (err != file->f_pos) { -+ file->f_pos = err; -+ // ION maybe this? -+ // file->f_pos = hidden_file->f_pos; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -+ file->f_reada = 0; -+#endif -+ file->f_version++; -+ } -+ -+ out: -+ return err; -+} -+ -+ -+/* mk: fanout capable */ -+STATIC ssize_t -+mini_fo_read(file_t *file, char *buf, size_t count, loff_t *ppos) -+{ -+ int err = -EINVAL; -+ file_t *hidden_file = NULL; -+ loff_t pos = *ppos; -+ -+ if(S_ISDIR(file->f_dentry->d_inode->i_mode)) { -+ /* Check if trying to read from a directory */ -+ /* printk(KERN_CRIT "mini_fo_read: ERROR: trying to read data from a directory.\n"); */ -+ err = -EISDIR; -+ goto out; -+ } -+ -+ if (ftopd(file) != NULL) { -+ if(ftohf2(file)) { -+ hidden_file = ftohf2(file); -+ } else { -+ hidden_file = ftohf(file); -+ } -+ } -+ -+ if (!hidden_file->f_op || !hidden_file->f_op->read) -+ goto out; -+ -+ err = hidden_file->f_op->read(hidden_file, buf, count, &pos); -+ *ppos = pos; -+ -+ if (err >= 0) { -+ /* atime should also be updated for reads of size zero or more */ -+ fist_copy_attr_atime(file->f_dentry->d_inode, -+ hidden_file->f_dentry->d_inode); -+ } -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -+ /* -+ * MAJOR HACK -+ * because pread() does not have any way to tell us that it is -+ * our caller, then we don't know for sure if we have to update -+ * the file positions. This hack relies on read() having passed us -+ * the "real" pointer of its struct file's f_pos field. -+ */ -+ if (ppos == &file->f_pos) -+ hidden_file->f_pos = *ppos = pos; -+ if (hidden_file->f_reada) { /* update readahead information if needed */ -+ file->f_reada = hidden_file->f_reada; -+ file->f_ramax = hidden_file->f_ramax; -+ file->f_raend = hidden_file->f_raend; -+ file->f_ralen = hidden_file->f_ralen; -+ file->f_rawin = hidden_file->f_rawin; -+ } -+#else -+ memcpy(&(file->f_ra),&(hidden_file->f_ra),sizeof(struct file_ra_state)); -+#endif -+ -+ out: -+ return err; -+} -+ -+ -+/* this mini_fo_write() does not modify data pages! */ -+STATIC ssize_t -+mini_fo_write(file_t *file, const char *buf, size_t count, loff_t *ppos) -+{ -+ int err = -EINVAL; -+ file_t *hidden_file = NULL; -+ inode_t *inode; -+ inode_t *hidden_inode; -+ loff_t pos = *ppos; -+ -+ /* mk: fan out: */ -+ if (ftopd(file) != NULL) { -+ if(ftohf2(file)) { -+ hidden_file = ftohf2(file); -+ } else { -+ /* This is bad! We have no storage file to write to. This -+ * should never happen because if a file is opened for -+ * writing, a copy should have been made earlier. -+ */ -+ printk(KERN_CRIT "mini_fo: write : ERROR, no storage file to write.\n"); -+ err = -EINVAL; -+ goto out; -+ } -+ } -+ -+ inode = file->f_dentry->d_inode; -+ hidden_inode = itohi2(inode); -+ if(!hidden_inode) { -+ printk(KERN_CRIT "mini_fo: write: no sto inode found, not good.\n"); -+ goto out; -+ } -+ -+ if (!hidden_file->f_op || !hidden_file->f_op->write) -+ goto out; -+ -+ /* adjust for append -- seek to the end of the file */ -+ if (file->f_flags & O_APPEND) -+ pos = inode->i_size; -+ -+ err = hidden_file->f_op->write(hidden_file, buf, count, &pos); -+ -+ /* -+ * copy ctime and mtime from lower layer attributes -+ * atime is unchanged for both layers -+ */ -+ if (err >= 0) -+ fist_copy_attr_times(inode, hidden_inode); -+ -+ *ppos = pos; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -+ /* -+ * XXX: MAJOR HACK -+ * -+ * because pwrite() does not have any way to tell us that it is -+ * our caller, then we don't know for sure if we have to update -+ * the file positions. This hack relies on write() having passed us -+ * the "real" pointer of its struct file's f_pos field. -+ */ -+ if (ppos == &file->f_pos) -+ hidden_file->f_pos = *ppos = pos; -+#endif -+ /* update this inode's size */ -+ if (pos > inode->i_size) -+ inode->i_size = pos; -+ -+ out: -+ return err; -+} -+ -+/* Global variable to hold a file_t pointer. -+ * This serves to allow mini_fo_filldir function to know which file is -+ * beeing read, which is required for two reasons: -+ * -+ * - be able to call wol functions in order to avoid listing deleted -+ * base files. -+ * - if we're reading a directory which is in state 1, we need to -+ * maintain a list (in mini_fo_filldir) of which files allready -+ * have been copied to userspace,to detect files existing in base -+ * and storage and not list them twice. -+ */ -+filldir_t mini_fo_filldir_orig; -+file_t *mini_fo_filldir_file; -+ -+/* mainly copied from fs/readdir.c */ -+STATIC int -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) -+mini_fo_filldir(void * __buf, const char * name, int namlen, loff_t offset, -+ u64 ino, unsigned int d_type) -+#else -+mini_fo_filldir(void * __buf, const char * name, int namlen, loff_t offset, -+ ino_t ino, unsigned int d_type) -+#endif -+{ -+ struct getdents_callback * buf = (struct getdents_callback *) __buf; -+ file_t* file = mini_fo_filldir_file; -+ -+ /* In theses states we filter meta files in storage (WOL) */ -+ if(file && (dtopd(file->f_dentry)->state == MODIFIED || -+ dtopd(file->f_dentry)->state == CREATED || -+ dtopd(file->f_dentry)->state == DEL_REWRITTEN)) { -+ -+ int tmp = strlen(META_FILENAME); -+ if(tmp == namlen) { -+ if(!strncmp(name, META_FILENAME, namlen)) -+ return 0; -+ } -+ } -+ -+ /* check if we are merging the contents of storage and base */ -+ if(file && dtopd(file->f_dentry)->state == MODIFIED) { -+ /* check if we are still reading storage contents, if -+ * yes, we just save the name of the file for duplicate -+ * checking later. */ -+ -+ if(!ftopd(file)->rd.sto_done) { -+ /* put file into ndl list */ -+ if(ndl_add_entry(&ftopd(file)->rd, name, namlen)) -+ printk(KERN_CRIT "mini_fo_filldir: Error adding to ndl.\n"); -+ } else { -+ /* check if file has been deleted */ -+ if(meta_check_d_entry(file->f_dentry, name, namlen)) -+ return 0; -+ -+ /* do duplicate checking */ -+ if(ndl_check_entry(&ftopd(file)->rd, name, namlen)) -+ return 0; -+ } -+ } -+ -+ return mini_fo_filldir_orig(buf, name, namlen, offset, ino, d_type); -+} -+ -+ -+STATIC int -+mini_fo_readdir(file_t *file, void *dirent, filldir_t filldir) -+{ -+ int err = 0;/* mk: ??? -ENOTDIR; */ -+ file_t *hidden_file = NULL; -+ file_t *hidden_sto_file = NULL; -+ inode_t *inode; -+ struct getdents_callback *buf; -+ int oldcount; -+ -+#if defined(FIST_FILTER_NAME) || defined(FIST_FILTER_SCA) -+ struct mini_fo_getdents_callback buf; -+#endif /* FIST_FILTER_NAME || FIST_FILTER_SCA */ -+ -+ buf = (struct getdents_callback *) dirent; -+ oldcount = buf->count; -+ inode = file->f_dentry->d_inode; -+ mini_fo_filldir_file = file; -+ mini_fo_filldir_orig = filldir; -+ -+ ftopd(file)->rd.sto_done = 0; -+ do { -+ if (ftopd(file) != NULL) { -+ if(ftohf2(file)) { -+ hidden_sto_file = ftohf2(file); -+ err = vfs_readdir(hidden_sto_file, mini_fo_filldir, dirent); -+ file->f_pos = hidden_sto_file->f_pos; -+ if (err > 0) -+ fist_copy_attr_atime(inode, hidden_sto_file->f_dentry->d_inode); -+ /* not finshed yet, we'll be called again */ -+ if (buf->count != oldcount) -+ break; -+ } -+ -+ ftopd(file)->rd.sto_done = 1; -+ -+ if(ftohf(file)) { -+ hidden_file = ftohf(file); -+ err = vfs_readdir(hidden_file, mini_fo_filldir, dirent); -+ file->f_pos = hidden_file->f_pos; -+ if (err > 0) -+ fist_copy_attr_atime(inode, hidden_file->f_dentry->d_inode); -+ } -+ -+ } -+ } while (0); -+ -+ /* mk: -+ * we need to check if all the directory data has been copied to userspace, -+ * or if we will be called again by userspace to complete the operation. -+ */ -+ if(buf->count == oldcount) { -+ ndl_put_list(&ftopd(file)->rd); -+ } -+ -+ /* unset this, safe */ -+ mini_fo_filldir_file = NULL; -+ return err; -+} -+ -+ -+STATIC unsigned int -+mini_fo_poll(file_t *file, poll_table *wait) -+{ -+ unsigned int mask = DEFAULT_POLLMASK; -+ file_t *hidden_file = NULL; -+ -+ if (ftopd(file) != NULL) { -+ if(ftohf2(file)) { -+ hidden_file = ftohf2(file); -+ } else { -+ hidden_file = ftohf(file); -+ } -+ } -+ -+ if (!hidden_file->f_op || !hidden_file->f_op->poll) -+ goto out; -+ -+ mask = hidden_file->f_op->poll(hidden_file, wait); -+ -+ out: -+ return mask; -+} -+ -+/* FIST-LITE special version of mmap */ -+STATIC int -+mini_fo_mmap(file_t *file, vm_area_t *vma) -+{ -+ int err = 0; -+ file_t *hidden_file = NULL; -+ -+ /* fanout capability */ -+ if (ftopd(file) != NULL) { -+ if(ftohf2(file)) { -+ hidden_file = ftohf2(file); -+ } else { -+ hidden_file = ftohf(file); -+ } -+ } -+ -+ ASSERT(hidden_file != NULL); -+ ASSERT(hidden_file->f_op != NULL); -+ ASSERT(hidden_file->f_op->mmap != NULL); -+ -+ vma->vm_file = hidden_file; -+ err = hidden_file->f_op->mmap(hidden_file, vma); -+ get_file(hidden_file); /* make sure it doesn't get freed on us */ -+ fput(file); /* no need to keep extra ref on ours */ -+ -+ return err; -+} -+ -+ -+ -+STATIC int -+mini_fo_open(inode_t *inode, file_t *file) -+{ -+ int err = 0; -+ int hidden_flags; -+ file_t *hidden_file = NULL; -+ dentry_t *hidden_dentry = NULL; -+ -+ /* fanout stuff */ -+ file_t *hidden_sto_file = NULL; -+ dentry_t *hidden_sto_dentry = NULL; -+ -+ __ftopd(file) = -+ kmalloc(sizeof(struct mini_fo_file_info), GFP_KERNEL); -+ if (!ftopd(file)) { -+ err = -ENOMEM; -+ goto out; -+ } -+ -+ /* init the readdir_helper structure */ -+ INIT_LIST_HEAD(&ftopd(file)->rd.ndl_list); -+ ftopd(file)->rd.ndl_size = 0; -+ -+ /* In certain paths this could stay uninitalized and cause trouble */ -+ ftohf(file) = NULL; -+ ftohf2(file) = NULL; -+ hidden_flags = file->f_flags; -+ -+ /* create storage files? */ -+ if(dtost(file->f_dentry) == UNMODIFIED) { -+ if(!IS_WRITE_FLAG(file->f_flags)) { -+ hidden_dentry = dtohd(file->f_dentry); -+ dget(hidden_dentry); -+ /* dentry_open will decrement mnt refcnt if err. -+ * otherwise fput() will do an mntput() for us upon file close. */ -+ mntget(stopd(inode->i_sb)->hidden_mnt); -+ hidden_file = dentry_open(hidden_dentry, -+ stopd(inode->i_sb)->hidden_mnt, -+ hidden_flags); -+ if (IS_ERR(hidden_file)) { -+ err = PTR_ERR(hidden_file); -+ dput(hidden_dentry); -+ goto out; -+ } -+ ftohf(file) = hidden_file; /* link two files */ -+ goto out; -+ } -+ else { -+ if(S_ISDIR(file->f_dentry->d_inode->i_mode)) { -+ err = dir_unmod_to_mod(file->f_dentry); -+ } else -+ err = nondir_unmod_to_mod(file->f_dentry, 1); -+ -+ if (err) { -+ printk("mini_fo_open: ERROR creating storage file.\n"); -+ goto out; -+ } -+ } -+ } -+ hidden_sto_dentry = dtohd2(file->f_dentry); -+ dget(hidden_sto_dentry); -+ -+ if(dtopd(file->f_dentry)->state == MODIFIED) { -+ /* Directorys are special, interpose on both lower level files */ -+ if(S_ISDIR(itohi(inode)->i_mode)) { -+ /* check for invalid file types of lower level files */ -+ if(!(S_ISDIR(itohi(inode)->i_mode) && S_ISDIR(itohi2(inode)->i_mode))) { -+ printk(KERN_CRIT "mini_fo_open: meta data corruption detected.\n"); -+ dput(hidden_sto_dentry); -+ err = -EINVAL; -+ goto out; -+ } -+ -+ /* lower level directorys are ok, open the base file */ -+ hidden_dentry = dtohd(file->f_dentry); -+ dget(hidden_dentry); -+ -+ mntget(stopd(inode->i_sb)->hidden_mnt); -+ hidden_file = dentry_open(hidden_dentry, -+ stopd(inode->i_sb)->hidden_mnt, -+ hidden_flags); -+ if (IS_ERR(hidden_file)) { -+ err = PTR_ERR(hidden_file); -+ dput(hidden_dentry); -+ dput(hidden_sto_dentry); -+ goto out; -+ } -+ ftohf(file) = hidden_file; /* link the two files */ -+ } -+ } -+ -+ if(!exists_in_storage(file->f_dentry)) { -+ printk(KERN_CRIT "mini_fo_open: invalid file state detected.\n"); -+ err = -EINVAL; -+ dput(hidden_sto_dentry); -+ -+ /* If the base file has been opened, we need to close it here */ -+ if(ftohf(file)) { -+ if (hidden_file->f_op && hidden_file->f_op->flush) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) -+ hidden_file->f_op->flush(hidden_file, NULL); -+#else -+ hidden_file->f_op->flush(hidden_file); -+#endif -+ dput(hidden_dentry); -+ } -+ goto out; -+ } -+ -+ /* ok, now we can safely open the storage file */ -+ mntget(stopd(inode->i_sb)->hidden_mnt2); -+ hidden_sto_file = dentry_open(hidden_sto_dentry, -+ stopd(inode->i_sb)->hidden_mnt2, -+ hidden_flags); -+ -+ /* dentry_open dputs the dentry if it fails */ -+ if (IS_ERR(hidden_sto_file)) { -+ err = PTR_ERR(hidden_sto_file); -+ /* close base file if open */ -+ if(ftohf(file)) { -+ if (hidden_file->f_op && hidden_file->f_op->flush) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) -+ hidden_file->f_op->flush(hidden_file, NULL); -+#else -+ hidden_file->f_op->flush(hidden_file); -+#endif -+ dput(hidden_dentry); -+ } -+ goto out; -+ } -+ ftohf2(file) = hidden_sto_file; /* link storage file */ -+ -+ out: -+ if (err < 0 && ftopd(file)) { -+ kfree(ftopd(file)); -+ } -+ return err; -+} -+ -+STATIC int -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) -+mini_fo_flush(file_t *file, fl_owner_t id) -+#else -+mini_fo_flush(file_t *file) -+#endif -+{ -+ int err1 = 0; /* assume ok (see open.c:close_fp) */ -+ int err2 = 0; -+ file_t *hidden_file = NULL; -+ -+ check_mini_fo_file(file); -+ -+ /* mk: we don't do any state checking here, as its not worth the time. -+ * Just flush the lower level files if they exist. -+ */ -+ if(ftopd(file) != NULL) { -+ if(ftohf(file) != NULL) { -+ hidden_file = ftohf(file); -+ if (hidden_file->f_op && hidden_file->f_op->flush) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) -+ err1 = hidden_file->f_op->flush(hidden_file, id); -+#else -+ err1 = hidden_file->f_op->flush(hidden_file); -+#endif -+ } -+ if(ftohf2(file) != NULL) { -+ hidden_file = ftohf2(file); -+ if (hidden_file->f_op && hidden_file->f_op->flush) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) -+ err2 = hidden_file->f_op->flush(hidden_file, id); -+#else -+ err2 = hidden_file->f_op->flush(hidden_file); -+#endif -+ } -+ } -+ return (err1 | err2); -+} -+ -+ -+STATIC int -+mini_fo_release(inode_t *inode, file_t *file) -+{ -+ int err = 0; -+ file_t *hidden_file = NULL; -+ -+ if (ftopd(file) != NULL) { -+ if(ftohf(file)) { -+ hidden_file = ftohf(file); -+ fput(hidden_file); -+ } -+ if(ftohf2(file)) { -+ hidden_file = ftohf2(file); -+ fput(hidden_file); -+ } -+ kfree(ftopd(file)); -+ } -+ return err; -+} -+ -+STATIC int -+mini_fo_fsync(file_t *file, dentry_t *dentry, int datasync) -+{ -+ int err1 = 0; -+ int err2 = 0; -+ file_t *hidden_file = NULL; -+ dentry_t *hidden_dentry; -+ -+ check_mini_fo_file(file); -+ -+ if ((hidden_file = ftohf(file)) != NULL) { -+ hidden_dentry = dtohd(dentry); -+ if (hidden_file->f_op && hidden_file->f_op->fsync) { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&hidden_dentry->d_inode->i_mutex); -+#else -+ down(&hidden_dentry->d_inode->i_sem); -+#endif -+ err1 = hidden_file->f_op->fsync(hidden_file, hidden_dentry, datasync); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&hidden_dentry->d_inode->i_mutex); -+#else -+ up(&hidden_dentry->d_inode->i_sem); -+#endif -+ } -+ } -+ -+ if ((hidden_file = ftohf2(file)) != NULL) { -+ hidden_dentry = dtohd2(dentry); -+ if (hidden_file->f_op && hidden_file->f_op->fsync) { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&hidden_dentry->d_inode->i_mutex); -+#else -+ down(&hidden_dentry->d_inode->i_sem); -+#endif -+ err2 = hidden_file->f_op->fsync(hidden_file, hidden_dentry, datasync); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&hidden_dentry->d_inode->i_mutex); -+#else -+ up(&hidden_dentry->d_inode->i_sem); -+#endif -+ } -+ } -+ else -+ goto err; -+ -+err: -+ return (err1 || err2); -+} -+ -+ -+STATIC int -+mini_fo_fasync(int fd, file_t *file, int flag) -+{ -+ int err1 = 0; -+ int err2 = 0; -+ -+ file_t *hidden_file = NULL; -+ -+ check_mini_fo_file(file); -+ -+ if((hidden_file = ftohf(file)) != NULL) { -+ err1 = hidden_file->f_op->fasync(fd, hidden_file, flag); -+ } -+ if((hidden_file = ftohf2(file)) != NULL) { -+ err2 = hidden_file->f_op->fasync(fd, hidden_file, flag); -+ } -+ -+ return (err1 || err2); -+} -+ -+ -+ -+struct file_operations mini_fo_dir_fops = -+ { -+ read: generic_read_dir, -+ write: mini_fo_write, -+ readdir: mini_fo_readdir, -+ poll: mini_fo_poll, -+ /* ioctl: mini_fo_ioctl, */ -+ mmap: mini_fo_mmap, -+ open: mini_fo_open, -+ flush: mini_fo_flush, -+ release: mini_fo_release, -+ fsync: mini_fo_fsync, -+ fasync: mini_fo_fasync, -+ /* not needed lock: mini_fo_lock, */ -+ /* not needed: readv */ -+ /* not needed: writev */ -+ /* not implemented: sendpage */ -+ /* not implemented: get_unmapped_area */ -+ }; -+ -+struct file_operations mini_fo_main_fops = -+ { -+ llseek: mini_fo_llseek, -+ read: mini_fo_read, -+ write: mini_fo_write, -+ readdir: mini_fo_readdir, -+ poll: mini_fo_poll, -+ /* ioctl: mini_fo_ioctl, */ -+ mmap: mini_fo_mmap, -+ open: mini_fo_open, -+ flush: mini_fo_flush, -+ release: mini_fo_release, -+ fsync: mini_fo_fsync, -+ fasync: mini_fo_fasync, -+ /* not needed: lock: mini_fo_lock, */ -+ /* not needed: readv */ -+ /* not needed: writev */ -+ /* not implemented: sendpage */ -+ /* not implemented: get_unmapped_area */ -+ }; ---- /dev/null -+++ b/fs/mini_fo/fist.h -@@ -0,0 +1,252 @@ -+/* -+ * Copyright (c) 1997-2003 Erez Zadok -+ * Copyright (c) 2001-2003 Stony Brook University -+ * -+ * For specific licensing information, see the COPYING file distributed with -+ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING. -+ * -+ * This Copyright notice must be kept intact and distributed with all -+ * fistgen sources INCLUDING sources generated by fistgen. -+ */ -+/* -+ * Copyright (C) 2004, 2005 Markus Klotzbuecher -+ * -+ * 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 of the License, or (at your option) any later version. -+ */ -+ -+ -+/* -+ * $Id$ -+ */ -+ -+#ifndef __FIST_H_ -+#define __FIST_H_ -+ -+/* -+ * KERNEL ONLY CODE: -+ */ -+#ifdef __KERNEL__ -+#include -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) -+#include -+#else -+#include -+#endif -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -+#ifdef CONFIG_MODVERSIONS -+# define MODVERSIONS -+# include -+#endif /* CONFIG_MODVERSIONS */ -+#endif /* KERNEL_VERSION < 2.6.0 */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -+#include -+#else -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#endif -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20) -+#include -+#endif -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+#include -+#endif -+ -+#include -+ -+#include -+/* #include */ -+#include -+#include -+ -+/* -+ * MACROS: -+ */ -+ -+/* those mapped to ATTR_* were copied from linux/fs.h */ -+#define FA_MODE ATTR_MODE -+#define FA_UID ATTR_UID -+#define FA_GID ATTR_GID -+#define FA_SIZE ATTR_SIZE -+#define FA_ATIME ATTR_ATIME -+#define FA_MTIME ATTR_MTIME -+#define FA_CTIME ATTR_CTIME -+#define FA_ATIME_SET ATTR_ATIME_SET -+#define FA_MTIME_SET ATTR_MTIME_SET -+#define FA_FORCE ATTR_FORCE -+#define FA_ATTR_FLAGS ATTR_ATTR_FLAG -+ -+/* must be greater than all other ATTR_* flags! */ -+#define FA_NLINK 2048 -+#define FA_BLKSIZE 4096 -+#define FA_BLOCKS 8192 -+#define FA_TIMES (FA_ATIME|FA_MTIME|FA_CTIME) -+#define FA_ALL 0 -+ -+/* macros to manage changes between kernels */ -+#define INODE_DATA(i) (&(i)->i_data) -+ -+#define MIN(x,y) ((x < y) ? (x) : (y)) -+#define MAX(x,y) ((x > y) ? (x) : (y)) -+#define MAXPATHLEN PATH_MAX -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,5) -+# define lookup_one_len(a,b,c) lookup_one(a,b) -+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,4,5) */ -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,8) -+# define generic_file_llseek default_llseek -+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,4,8) */ -+ -+#ifndef SEEK_SET -+# define SEEK_SET 0 -+#endif /* not SEEK_SET */ -+ -+#ifndef SEEK_CUR -+# define SEEK_CUR 1 -+#endif /* not SEEK_CUR */ -+ -+#ifndef SEEK_END -+# define SEEK_END 2 -+#endif /* not SEEK_END */ -+ -+#ifndef DEFAULT_POLLMASK -+# define DEFAULT_POLLMASK (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM) -+#endif /* not DEFAULT_POLLMASK */ -+ -+/* XXX: fix this so fistgen generates kfree() code directly */ -+#define kfree_s(a,b) kfree(a) -+ -+/* -+ * TYPEDEFS: -+ */ -+typedef struct dentry dentry_t; -+typedef struct file file_t; -+typedef struct inode inode_t; -+typedef inode_t vnode_t; -+typedef struct page page_t; -+typedef struct qstr qstr_t; -+typedef struct super_block super_block_t; -+typedef super_block_t vfs_t; -+typedef struct vm_area_struct vm_area_t; -+ -+ -+/* -+ * EXTERNALS: -+ */ -+ -+#define FPPF(str,page) printk("PPF %s 0x%x/%d: Lck:%d Err:%d Ref:%d Upd:%d Other::%d:%d:%d:%d:\n", \ -+ str, \ -+ (int) page, \ -+ (int) page->index, \ -+ (PageLocked(page) ? 1 : 0), \ -+ (PageError(page) ? 1 : 0), \ -+ (PageReferenced(page) ? 1 : 0), \ -+ (Page_Uptodate(page) ? 1 : 0), \ -+ (PageDecrAfter(page) ? 1 : 0), \ -+ (PageSlab(page) ? 1 : 0), \ -+ (PageSwapCache(page) ? 1 : 0), \ -+ (PageReserved(page) ? 1 : 0) \ -+ ) -+#define EZKDBG printk("EZK %s:%d:%s\n",__FILE__,__LINE__,__FUNCTION__) -+#if 0 -+# define EZKDBG1 printk("EZK %s:%d\n",__FILE__,__LINE__) -+#else -+# define EZKDBG1 -+#endif -+ -+extern int fist_get_debug_value(void); -+extern int fist_set_debug_value(int val); -+#if 0 /* mini_fo doesn't need these */ -+extern void fist_dprint_internal(int level, char *str,...); -+extern void fist_print_dentry(char *str, const dentry_t *dentry); -+extern void fist_print_inode(char *str, const inode_t *inode); -+extern void fist_print_file(char *str, const file_t *file); -+extern void fist_print_buffer_flags(char *str, struct buffer_head *buffer); -+extern void fist_print_page_flags(char *str, page_t *page); -+extern void fist_print_page_bytes(char *str, page_t *page); -+extern void fist_print_pte_flags(char *str, const page_t *page); -+extern void fist_checkinode(inode_t *inode, char *msg); -+extern void fist_print_sb(char *str, const super_block_t *sb); -+ -+/* §$% by mk: special debug functions */ -+extern void fist_mk_print_dentry(char *str, const dentry_t *dentry); -+extern void fist_mk_print_inode(char *str, const inode_t *inode); -+ -+extern char *add_indent(void); -+extern char *del_indent(void); -+#endif/* mini_fo doesn't need these */ -+ -+ -+#define STATIC -+#define ASSERT(EX) \ -+do { \ -+ if (!(EX)) { \ -+ printk(KERN_CRIT "ASSERTION FAILED: %s at %s:%d (%s)\n", #EX, \ -+ __FILE__, __LINE__, __FUNCTION__); \ -+ (*((char *)0))=0; \ -+ } \ -+} while (0) -+/* same ASSERT, but tell me who was the caller of the function */ -+#define ASSERT2(EX) \ -+do { \ -+ if (!(EX)) { \ -+ printk(KERN_CRIT "ASSERTION FAILED (caller): %s at %s:%d (%s)\n", #EX, \ -+ file, line, func); \ -+ (*((char *)0))=0; \ -+ } \ -+} while (0) -+ -+#if 0 /* mini_fo doesn't need these */ -+#define dprintk(format, args...) printk(KERN_DEBUG format, ##args) -+#define fist_dprint(level, str, args...) fist_dprint_internal(level, KERN_DEBUG str, ## args) -+#define print_entry_location() fist_dprint(4, "%sIN: %s %s:%d\n", add_indent(), __FUNCTION__, __FILE__, __LINE__) -+#define print_exit_location() fist_dprint(4, "%s OUT: %s %s:%d\n", del_indent(), __FUNCTION__, __FILE__, __LINE__) -+#define print_exit_status(status) fist_dprint(4, "%s OUT: %s %s:%d, STATUS: %d\n", del_indent(), __FUNCTION__, __FILE__, __LINE__, status) -+#define print_exit_pointer(status) \ -+do { \ -+ if (IS_ERR(status)) \ -+ fist_dprint(4, "%s OUT: %s %s:%d, RESULT: %ld\n", del_indent(), __FUNCTION__, __FILE__, __LINE__, PTR_ERR(status)); \ -+ else \ -+ fist_dprint(4, "%s OUT: %s %s:%d, RESULT: 0x%x\n", del_indent(), __FUNCTION__, __FILE__, __LINE__, PTR_ERR(status)); \ -+} while (0) -+#endif/* mini_fo doesn't need these */ -+ -+#endif /* __KERNEL__ */ -+ -+ -+/* -+ * DEFINITIONS FOR USER AND KERNEL CODE: -+ * (Note: ioctl numbers 1--9 are reserved for fistgen, the rest -+ * are auto-generated automatically based on the user's .fist file.) -+ */ -+# define FIST_IOCTL_GET_DEBUG_VALUE _IOR(0x15, 1, int) -+# define FIST_IOCTL_SET_DEBUG_VALUE _IOW(0x15, 2, int) -+ -+#endif /* not __FIST_H_ */ ---- /dev/null -+++ b/fs/mini_fo/inode.c -@@ -0,0 +1,1564 @@ -+/* -+ * Copyright (c) 1997-2003 Erez Zadok -+ * Copyright (c) 2001-2003 Stony Brook University -+ * -+ * For specific licensing information, see the COPYING file distributed with -+ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING. -+ * -+ * This Copyright notice must be kept intact and distributed with all -+ * fistgen sources INCLUDING sources generated by fistgen. -+ */ -+/* -+ * Copyright (C) 2004, 2005 Markus Klotzbuecher -+ * -+ * 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 of the License, or (at your option) any later version. -+ */ -+ -+/* -+ * $Id$ -+ */ -+ -+#ifdef HAVE_CONFIG_H -+# include -+#endif -+ -+#include "fist.h" -+#include "mini_fo.h" -+ -+STATIC int -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+mini_fo_create(inode_t *dir, dentry_t *dentry, int mode, struct nameidata *nd) -+#else -+mini_fo_create(inode_t *dir, dentry_t *dentry, int mode) -+#endif -+{ -+ int err = 0; -+ -+ check_mini_fo_dentry(dentry); -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+ err = create_sto_reg_file(dentry, mode, nd); -+#else -+ err = create_sto_reg_file(dentry, mode); -+#endif -+ check_mini_fo_dentry(dentry); -+ return err; -+} -+ -+ -+STATIC dentry_t * -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+mini_fo_lookup(inode_t *dir, dentry_t *dentry, struct nameidata* nd) -+#else -+mini_fo_lookup(inode_t *dir, dentry_t *dentry) -+#endif -+{ -+ int err = 0; -+ dentry_t *hidden_dir_dentry; -+ dentry_t *hidden_dentry = NULL; -+ -+ dentry_t *hidden_sto_dir_dentry; -+ dentry_t *hidden_sto_dentry = NULL; -+ -+ /* whiteout flag */ -+ int del_flag = 0; -+ char *bpath = NULL; -+ -+ const char *name; -+ unsigned int namelen; -+ -+ /* Don't allow lookups of META-files */ -+ namelen = strlen(META_FILENAME); -+ if(namelen == dentry->d_name.len) { -+ if(!strncmp(dentry->d_name.name, META_FILENAME, namelen)) { -+ err = -ENOENT; -+ goto out; -+ } -+ } -+ -+ hidden_dir_dentry = dtohd(dentry->d_parent); -+ hidden_sto_dir_dentry = dtohd2(dentry->d_parent); -+ -+ name = dentry->d_name.name; -+ namelen = dentry->d_name.len; -+ -+ /* must initialize dentry operations */ -+ dentry->d_op = &mini_fo_dops; -+ -+ /* setup the del_flag */ -+ del_flag = __meta_check_d_entry(dir, name, namelen); -+ bpath = __meta_check_r_entry(dir, name, namelen); -+ -+ /* perform the lookups of base and storage files: -+ * -+ * This caused some serious trouble, as a lookup_one_len passing -+ * a negative dentry oopses. Solution is to only do the lookup -+ * if the dentry is positive, else we set it to NULL -+ * More trouble, who said a *_dir_dentry can't be NULL? -+ */ -+ if(bpath) { -+ /* Cross-Interposing (C), yeah! */ -+ hidden_dentry = bpath_walk(dir->i_sb, bpath); -+ if(!hidden_dentry || !hidden_dentry->d_inode) { -+ printk(KERN_CRIT "mini_fo_lookup: bpath_walk failed.\n"); -+ err= -EINVAL; -+ goto out; -+ } -+ -+ /* this can be set up safely without fear of spaghetti -+ * interposing as it is only used for copying times */ -+ hidden_dir_dentry = hidden_dentry->d_parent; -+ kfree(bpath); -+ } -+ else if(hidden_dir_dentry && hidden_dir_dentry->d_inode) -+ hidden_dentry = -+ lookup_one_len(name, hidden_dir_dentry, namelen); -+ else -+ hidden_dentry = NULL; -+ -+ if(hidden_sto_dir_dentry && hidden_sto_dir_dentry->d_inode) -+ hidden_sto_dentry = -+ lookup_one_len(name, hidden_sto_dir_dentry, namelen); -+ else -+ hidden_sto_dentry = NULL; -+ -+ /* catch error in lookup */ -+ if (IS_ERR(hidden_dentry) || IS_ERR(hidden_sto_dentry)) { -+ /* mk: we need to call dput on the dentry, whose -+ * lookup_one_len operation failed, in order to avoid -+ * unmount trouble. -+ */ -+ if(IS_ERR(hidden_dentry)) { -+ printk(KERN_CRIT "mini_fo_lookup: ERR from base dentry, lookup failed.\n"); -+ err = PTR_ERR(hidden_dentry); -+ } else { -+ dput(hidden_dentry); -+ } -+ if(IS_ERR(hidden_sto_dentry)) { -+ printk(KERN_CRIT "mini_fo_lookup: ERR from storage dentry, lookup failed.\n"); -+ err = PTR_ERR(hidden_sto_dentry); -+ } else { -+ dput(hidden_sto_dentry); -+ } -+ goto out; -+ } -+ -+ /* allocate dentry private data */ -+ __dtopd(dentry) = (struct mini_fo_dentry_info *) -+ kmalloc(sizeof(struct mini_fo_dentry_info), GFP_KERNEL); -+ -+ if (!dtopd(dentry)) { -+ err = -ENOMEM; -+ goto out_dput; -+ } -+ -+ /* check for different states of the mini_fo file to be looked up. */ -+ -+ /* state 1, file has been modified */ -+ if(hidden_dentry && hidden_sto_dentry && -+ hidden_dentry->d_inode && hidden_sto_dentry->d_inode && !del_flag) { -+ -+ /* update parent directory's atime */ -+ fist_copy_attr_atime(dir, hidden_sto_dir_dentry->d_inode); -+ -+ dtopd(dentry)->state = MODIFIED; -+ dtohd(dentry) = hidden_dentry; -+ dtohd2(dentry) = hidden_sto_dentry; -+ -+ err = mini_fo_tri_interpose(hidden_dentry, -+ hidden_sto_dentry, -+ dentry, dir->i_sb, 1); -+ if (err) { -+ printk(KERN_CRIT "mini_fo_lookup: error interposing (state1).\n"); -+ goto out_free; -+ } -+ goto out; -+ } -+ /* state 2, file is unmodified */ -+ if(hidden_dentry && hidden_dentry->d_inode && !del_flag) { -+ -+ fist_copy_attr_atime(dir, hidden_dir_dentry->d_inode); -+ -+ dtopd(dentry)->state = UNMODIFIED; -+ dtohd(dentry) = hidden_dentry; -+ dtohd2(dentry) = hidden_sto_dentry; /* could be negative */ -+ -+ err = mini_fo_tri_interpose(hidden_dentry, -+ hidden_sto_dentry, -+ dentry, dir->i_sb, 1); -+ if (err) { -+ printk(KERN_CRIT "mini_fo_lookup: error interposing (state2).\n"); -+ goto out_free; -+ } -+ goto out; -+ } -+ /* state 3, file has been newly created */ -+ if(hidden_sto_dentry && hidden_sto_dentry->d_inode && !del_flag) { -+ -+ fist_copy_attr_atime(dir, hidden_sto_dir_dentry->d_inode); -+ dtopd(dentry)->state = CREATED; -+ dtohd(dentry) = hidden_dentry; /* could be negative */ -+ dtohd2(dentry) = hidden_sto_dentry; -+ -+ err = mini_fo_tri_interpose(hidden_dentry, -+ hidden_sto_dentry, -+ dentry, dir->i_sb, 1); -+ if (err) { -+ printk(KERN_CRIT "mini_fo_lookup: error interposing (state3).\n"); -+ goto out_free; -+ } -+ goto out; -+ } -+ -+ /* state 4, file has deleted and created again. */ -+ if(hidden_dentry && hidden_sto_dentry && -+ hidden_dentry->d_inode && -+ hidden_sto_dentry->d_inode && del_flag) { -+ -+ fist_copy_attr_atime(dir, hidden_sto_dir_dentry->d_inode); -+ dtopd(dentry)->state = DEL_REWRITTEN; -+ dtohd(dentry) = NULL; -+ dtohd2(dentry) = hidden_sto_dentry; -+ -+ err = mini_fo_tri_interpose(NULL, -+ hidden_sto_dentry, -+ dentry, dir->i_sb, 1); -+ if (err) { -+ printk(KERN_CRIT "mini_fo_lookup: error interposing (state4).\n"); -+ goto out_free; -+ } -+ /* We will never need this dentry again, as the file has been -+ * deleted from base */ -+ dput(hidden_dentry); -+ goto out; -+ } -+ /* state 5, file has been deleted in base */ -+ if(hidden_dentry && hidden_sto_dentry && -+ hidden_dentry->d_inode && -+ !hidden_sto_dentry->d_inode && del_flag) { -+ -+ /* check which parents atime we need for updating */ -+ if(hidden_sto_dir_dentry->d_inode) -+ fist_copy_attr_atime(dir, -+ hidden_sto_dir_dentry->d_inode); -+ else -+ fist_copy_attr_atime(dir, -+ hidden_dir_dentry->d_inode); -+ -+ dtopd(dentry)->state = DELETED; -+ dtohd(dentry) = NULL; -+ dtohd2(dentry) = hidden_sto_dentry; -+ -+ /* add negative dentry to dcache to speed up lookups */ -+ d_add(dentry, NULL); -+ dput(hidden_dentry); -+ goto out; -+ } -+ /* state 6, file does not exist */ -+ if(((hidden_dentry && !hidden_dentry->d_inode) || -+ (hidden_sto_dentry && !hidden_sto_dentry->d_inode)) && !del_flag) -+ { -+ /* check which parents atime we need for updating */ -+ if(hidden_sto_dir_dentry && hidden_sto_dir_dentry->d_inode) -+ fist_copy_attr_atime(dir, hidden_sto_dir_dentry->d_inode); -+ else -+ fist_copy_attr_atime(dir, hidden_dir_dentry->d_inode); -+ -+ dtopd(dentry)->state = NON_EXISTANT; -+ dtohd(dentry) = hidden_dentry; -+ dtohd2(dentry) = hidden_sto_dentry; -+ d_add(dentry, NULL); -+ goto out; -+ } -+ -+ /* if we get to here, were in an invalid state. bad. */ -+ printk(KERN_CRIT "mini_fo_lookup: ERROR, meta data corruption detected.\n"); -+ -+ /* end state checking */ -+ out_free: -+ d_drop(dentry); /* so that our bad dentry will get destroyed */ -+ kfree(dtopd(dentry)); -+ __dtopd(dentry) = NULL; /* be safe */ -+ -+ out_dput: -+ if(hidden_dentry) -+ dput(hidden_dentry); -+ if(hidden_sto_dentry) -+ dput(hidden_sto_dentry); /* drops usage count and marks for release */ -+ -+ out: -+ /* initalize wol if file exists and is directory */ -+ if(dentry->d_inode) { -+ if(S_ISDIR(dentry->d_inode->i_mode)) { -+ itopd(dentry->d_inode)->deleted_list_size = -1; -+ itopd(dentry->d_inode)->renamed_list_size = -1; -+ meta_build_lists(dentry); -+ } -+ } -+ return ERR_PTR(err); -+} -+ -+ -+STATIC int -+mini_fo_link(dentry_t *old_dentry, inode_t *dir, dentry_t *new_dentry) -+{ -+ int err; -+ dentry_t *hidden_old_dentry; -+ dentry_t *hidden_new_dentry; -+ dentry_t *hidden_dir_dentry; -+ -+ -+ check_mini_fo_dentry(old_dentry); -+ check_mini_fo_dentry(new_dentry); -+ check_mini_fo_inode(dir); -+ -+ /* no links to directorys and existing targets target allowed */ -+ if(S_ISDIR(old_dentry->d_inode->i_mode) || -+ is_mini_fo_existant(new_dentry)) { -+ err = -EPERM; -+ goto out; -+ } -+ -+ /* bring it directly from unmod to del_rew */ -+ if(dtost(old_dentry) == UNMODIFIED) { -+ err = nondir_unmod_to_mod(old_dentry, 1); -+ if(err) { -+ err = -EINVAL; -+ goto out; -+ } -+ err = meta_add_d_entry(old_dentry->d_parent, -+ old_dentry->d_name.name, -+ old_dentry->d_name.len); -+ if(err) { -+ err = -EINVAL; -+ goto out; -+ } -+ dput(dtohd(old_dentry)); -+ dtohd(old_dentry) = NULL; -+ dtost(old_dentry) = DEL_REWRITTEN; -+ } -+ -+ err = get_neg_sto_dentry(new_dentry); -+ if(err) { -+ err = -EINVAL; -+ goto out; -+ } -+ -+ hidden_old_dentry = dtohd2(old_dentry); -+ hidden_new_dentry = dtohd2(new_dentry); -+ -+ dget(hidden_old_dentry); -+ dget(hidden_new_dentry); -+ -+ /* was: hidden_dir_dentry = lock_parent(hidden_new_dentry); */ -+ hidden_dir_dentry = dget(hidden_new_dentry->d_parent); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&hidden_dir_dentry->d_inode->i_mutex); -+#else -+ down(&hidden_dir_dentry->d_inode->i_sem); -+#endif -+ -+ err = vfs_link(hidden_old_dentry, -+ hidden_dir_dentry->d_inode, -+ hidden_new_dentry); -+ if (err || !hidden_new_dentry->d_inode) -+ goto out_lock; -+ -+ dtost(new_dentry) = CREATED; -+ err = mini_fo_tri_interpose(NULL, hidden_new_dentry, new_dentry, dir->i_sb, 0); -+ if (err) -+ goto out_lock; -+ -+ fist_copy_attr_timesizes(dir, hidden_new_dentry->d_inode); -+ /* propagate number of hard-links */ -+ old_dentry->d_inode->i_nlink = itohi2(old_dentry->d_inode)->i_nlink; -+ -+ out_lock: -+ /* was: unlock_dir(hidden_dir_dentry); */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&hidden_dir_dentry->d_inode->i_mutex); -+#else -+ up(&hidden_dir_dentry->d_inode->i_sem); -+#endif -+ dput(hidden_dir_dentry); -+ -+ dput(hidden_new_dentry); -+ dput(hidden_old_dentry); -+ if (!new_dentry->d_inode) -+ d_drop(new_dentry); -+ -+ out: -+ return err; -+} -+ -+ -+STATIC int -+mini_fo_unlink(inode_t *dir, dentry_t *dentry) -+{ -+ int err = 0; -+ -+ dget(dentry); -+ if(dtopd(dentry)->state == MODIFIED) { -+ err = nondir_mod_to_del(dentry); -+ goto out; -+ } -+ else if(dtopd(dentry)->state == UNMODIFIED) { -+ err = nondir_unmod_to_del(dentry); -+ goto out; -+ } -+ else if(dtopd(dentry)->state == CREATED) { -+ err = nondir_creat_to_del(dentry); -+ goto out; -+ } -+ else if(dtopd(dentry)->state == DEL_REWRITTEN) { -+ err = nondir_del_rew_to_del(dentry); -+ goto out; -+ } -+ -+ printk(KERN_CRIT "mini_fo_unlink: ERROR, invalid state detected.\n"); -+ -+ out: -+ fist_copy_attr_times(dir, itohi2(dentry->d_parent->d_inode)); -+ -+ if(!err) { -+ /* is this causing my pain? d_delete(dentry); */ -+ d_drop(dentry); -+ } -+ -+ dput(dentry); -+ return err; -+} -+ -+ -+STATIC int -+mini_fo_symlink(inode_t *dir, dentry_t *dentry, const char *symname) -+{ -+ int err=0; -+ dentry_t *hidden_sto_dentry; -+ dentry_t *hidden_sto_dir_dentry; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+ umode_t mode; -+#endif -+ -+ /* Fail if the symlink file exists */ -+ if(!(dtost(dentry) == DELETED || -+ dtost(dentry) == NON_EXISTANT)) { -+ err = -EEXIST; -+ goto out; -+ } -+ -+ err = get_neg_sto_dentry(dentry); -+ if(err) { -+ err = -EINVAL; -+ goto out; -+ } -+ hidden_sto_dentry = dtohd2(dentry); -+ -+ dget(hidden_sto_dentry); -+ /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */ -+ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ down(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+ mode = S_IALLUGO; -+ err = vfs_symlink(hidden_sto_dir_dentry->d_inode, -+ hidden_sto_dentry, symname, mode); -+#else -+ err = vfs_symlink(hidden_sto_dir_dentry->d_inode, -+ hidden_sto_dentry, -+ symname); -+#endif -+ if (err || !hidden_sto_dentry->d_inode) -+ goto out_lock; -+ -+ if(dtost(dentry) == DELETED) { -+ dtost(dentry) = DEL_REWRITTEN; -+ err = mini_fo_tri_interpose(NULL, hidden_sto_dentry, dentry, dir->i_sb, 0); -+ if(err) -+ goto out_lock; -+ } else if(dtost(dentry) == NON_EXISTANT) { -+ dtost(dentry) = CREATED; -+ err = mini_fo_tri_interpose(dtohd(dentry), hidden_sto_dentry, dentry, dir->i_sb, 0); -+ if(err) -+ goto out_lock; -+ } -+ fist_copy_attr_timesizes(dir, hidden_sto_dir_dentry->d_inode); -+ -+ out_lock: -+ /* was: unlock_dir(hidden_sto_dir_dentry); */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ up(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ dput(hidden_sto_dir_dentry); -+ -+ dput(hidden_sto_dentry); -+ if (!dentry->d_inode) -+ d_drop(dentry); -+ out: -+ return err; -+} -+ -+STATIC int -+mini_fo_mkdir(inode_t *dir, dentry_t *dentry, int mode) -+{ -+ int err; -+ -+ err = create_sto_dir(dentry, mode); -+ -+ check_mini_fo_dentry(dentry); -+ -+ return err; -+} -+ -+ -+STATIC int -+mini_fo_rmdir(inode_t *dir, dentry_t *dentry) -+{ -+ int err = 0; -+ -+ dentry_t *hidden_sto_dentry; -+ dentry_t *hidden_sto_dir_dentry; -+ dentry_t *meta_dentry; -+ inode_t *hidden_sto_dir = NULL; -+ -+ check_mini_fo_dentry(dentry); -+ check_mini_fo_inode(dir); -+ -+ dget(dentry); -+ if(dtopd(dentry)->state == MODIFIED) { -+ /* XXX: disabled, because it does not bother to check files on -+ * the original filesystem - just a hack, but better than simply -+ * removing it without testing */ -+ err = -EINVAL; -+ goto out; -+ -+ hidden_sto_dir = itohi2(dir); -+ hidden_sto_dentry = dtohd2(dentry); -+ -+ /* was:hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */ -+ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ down(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ -+ /* Delete an old WOL file contained in the storage dir */ -+ meta_dentry = lookup_one_len(META_FILENAME, -+ hidden_sto_dentry, -+ strlen(META_FILENAME)); -+ if(meta_dentry->d_inode) { -+ err = vfs_unlink(hidden_sto_dentry->d_inode, meta_dentry); -+ dput(meta_dentry); -+ if(!err) -+ d_delete(meta_dentry); -+ } -+ -+ err = vfs_rmdir(hidden_sto_dir, hidden_sto_dentry); -+ dput(hidden_sto_dentry); -+ if(!err) -+ d_delete(hidden_sto_dentry); -+ -+ /* propagate number of hard-links */ -+ dentry->d_inode->i_nlink = itohi2(dentry->d_inode)->i_nlink; -+ -+ dput(dtohd(dentry)); -+ -+ dtohd(dentry) = NULL; -+ dtopd(dentry)->state = DELETED; -+ -+ /* carefull with R files */ -+ if( __meta_is_r_entry(dir, -+ dentry->d_name.name, -+ dentry->d_name.len) == 1) { -+ err = meta_remove_r_entry(dentry->d_parent, -+ dentry->d_name.name, -+ dentry->d_name.len); -+ if(err) { -+ printk(KERN_CRIT "mini_fo: rmdir: meta_remove_r_entry failed.\n"); -+ goto out; -+ } -+ } -+ else { -+ /* ok, add deleted file to META */ -+ meta_add_d_entry(dentry->d_parent, -+ dentry->d_name.name, -+ dentry->d_name.len); -+ } -+ /* was: unlock_dir(hidden_sto_dir_dentry); */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ up(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ dput(hidden_sto_dir_dentry); -+ goto out; -+ } -+ else if(dtopd(dentry)->state == UNMODIFIED) { -+ /* XXX: simply adding it to the delete list here is fscking dangerous! -+ * as a temporary hack, i will disable rmdir on unmodified directories -+ * for now. -+ */ -+ err = -EINVAL; -+ goto out; -+ -+ err = get_neg_sto_dentry(dentry); -+ if(err) { -+ err = -EINVAL; -+ goto out; -+ } -+ -+ /* dput base dentry, this will relase the inode and free the -+ * dentry, as we will never need it again. */ -+ dput(dtohd(dentry)); -+ dtohd(dentry) = NULL; -+ dtopd(dentry)->state = DELETED; -+ -+ /* add deleted file to META-file */ -+ meta_add_d_entry(dentry->d_parent, -+ dentry->d_name.name, -+ dentry->d_name.len); -+ goto out; -+ } -+ else if(dtopd(dentry)->state == CREATED) { -+ hidden_sto_dir = itohi2(dir); -+ hidden_sto_dentry = dtohd2(dentry); -+ -+ /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry);*/ -+ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ down(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ -+ /* Delete an old WOL file contained in the storage dir */ -+ meta_dentry = lookup_one_len(META_FILENAME, -+ hidden_sto_dentry, -+ strlen(META_FILENAME)); -+ if(meta_dentry->d_inode) { -+ /* is this necessary? dget(meta_dentry); */ -+ err = vfs_unlink(hidden_sto_dentry->d_inode, -+ meta_dentry); -+ dput(meta_dentry); -+ if(!err) -+ d_delete(meta_dentry); -+ } -+ -+ err = vfs_rmdir(hidden_sto_dir, hidden_sto_dentry); -+ dput(hidden_sto_dentry); -+ if(!err) -+ d_delete(hidden_sto_dentry); -+ -+ /* propagate number of hard-links */ -+ dentry->d_inode->i_nlink = itohi2(dentry->d_inode)->i_nlink; -+ dtopd(dentry)->state = NON_EXISTANT; -+ -+ /* was: unlock_dir(hidden_sto_dir_dentry); */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ up(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ dput(hidden_sto_dir_dentry); -+ -+ goto out; -+ } -+ else if(dtopd(dentry)->state == DEL_REWRITTEN) { -+ hidden_sto_dir = itohi2(dir); -+ hidden_sto_dentry = dtohd2(dentry); -+ -+ /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry);*/ -+ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ down(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ -+ /* Delete an old WOL file contained in the storage dir */ -+ meta_dentry = lookup_one_len(META_FILENAME, -+ hidden_sto_dentry, -+ strlen(META_FILENAME)); -+ if(meta_dentry->d_inode) { -+ /* is this necessary? dget(meta_dentry); */ -+ err = vfs_unlink(hidden_sto_dentry->d_inode, -+ meta_dentry); -+ dput(meta_dentry); -+ if(!err) -+ d_delete(meta_dentry); -+ } -+ -+ err = vfs_rmdir(hidden_sto_dir, hidden_sto_dentry); -+ dput(hidden_sto_dentry); -+ if(!err) -+ d_delete(hidden_sto_dentry); -+ -+ /* propagate number of hard-links */ -+ dentry->d_inode->i_nlink = itohi2(dentry->d_inode)->i_nlink; -+ dtopd(dentry)->state = DELETED; -+ /* was: unlock_dir(hidden_sto_dir_dentry); */ -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ up(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ dput(hidden_sto_dir_dentry); -+ goto out; -+ } -+ -+ printk(KERN_CRIT "mini_fo_rmdir: ERROR, invalid state detected.\n"); -+ -+ out: -+ if(!err) { -+ d_drop(dentry); -+ } -+ -+ fist_copy_attr_times(dir, itohi2(dentry->d_parent->d_inode)); -+ dput(dentry); -+ -+ return err; -+} -+ -+ -+STATIC int -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+mini_fo_mknod(inode_t *dir, dentry_t *dentry, int mode, dev_t dev) -+#else -+mini_fo_mknod(inode_t *dir, dentry_t *dentry, int mode, int dev) -+#endif -+{ -+ int err = 0; -+ -+ check_mini_fo_dentry(dentry); -+ -+ err = create_sto_nod(dentry, mode, dev); -+ if(err) { -+ printk(KERN_CRIT "mini_fo_mknod: creating sto nod failed.\n"); -+ err = -EINVAL; -+ } -+ -+ check_mini_fo_dentry(dentry); -+ return err; -+} -+ -+ -+STATIC int -+mini_fo_rename(inode_t *old_dir, dentry_t *old_dentry, -+ inode_t *new_dir, dentry_t *new_dentry) -+{ -+ /* dispatch */ -+ if(S_ISDIR(old_dentry->d_inode->i_mode)) -+ return rename_directory(old_dir, old_dentry, new_dir, new_dentry); -+ return rename_nondir(old_dir, old_dentry, new_dir, new_dentry); -+ -+} -+ -+int rename_directory(inode_t *old_dir, dentry_t *old_dentry, -+ inode_t *new_dir, dentry_t *new_dentry) -+{ -+ int err, bpath_len; -+ char *bpath; -+ -+ dentry_t *hidden_old_dentry; -+ dentry_t *hidden_new_dentry; -+ dentry_t *hidden_old_dir_dentry; -+ dentry_t *hidden_new_dir_dentry; -+ -+ err = 0; -+ bpath = NULL; -+ bpath_len = 0; -+ -+ /* this is a test, chuck out if it works */ -+ if(!(dtopd(new_dentry)->state == DELETED || -+ dtopd(new_dentry)->state == NON_EXISTANT)) { -+ printk(KERN_CRIT "mini_fo: rename_directory: \ -+ uh, ah, new_dentry not negative.\n"); -+ /* return -1; */ -+ } -+ -+ /* state = UNMODIFIED */ -+ if(dtopd(old_dentry)->state == UNMODIFIED) { -+ err = dir_unmod_to_mod(old_dentry); -+ if (err) -+ goto out; -+ } -+ -+ /* state = MODIFIED */ -+ if(dtopd(old_dentry)->state == MODIFIED) { -+ bpath = meta_check_r_entry(old_dentry->d_parent, -+ old_dentry->d_name.name, -+ old_dentry->d_name.len); -+ if(bpath) { -+ err = meta_remove_r_entry(old_dentry->d_parent, -+ old_dentry->d_name.name, -+ old_dentry->d_name.len); -+ if(err) { -+ printk(KERN_CRIT "mini_fo: rename_directory:\ -+ meta_remove_r_entry \ -+ failed.\n"); -+ goto out; -+ } -+ err = meta_add_r_entry(new_dentry->d_parent, -+ bpath, -+ strlen(bpath), -+ new_dentry->d_name.name, -+ new_dentry->d_name.len); -+ kfree(bpath); -+ } -+ else {/* wol it */ -+ err = meta_add_d_entry(old_dentry->d_parent, -+ old_dentry->d_name.name, -+ old_dentry->d_name.len); -+ if (err) -+ goto out; -+ /* put it on rename list */ -+ err = get_mini_fo_bpath(old_dentry, -+ &bpath, -+ &bpath_len); -+ if (err) -+ goto out; -+ err = meta_add_r_entry(new_dentry->d_parent, -+ bpath, bpath_len, -+ new_dentry->d_name.name, -+ new_dentry->d_name.len); -+ if (err) -+ goto out; -+ } -+ /* no state change, MODIFIED stays MODIFIED */ -+ } -+ /* state = CREATED */ -+ if(dtopd(old_dentry)->state == CREATED || -+ dtopd(old_dentry)->state == DEL_REWRITTEN) { -+ if(dtohd(old_dentry)) -+ dput(dtohd(old_dentry)); -+ -+ if(dtopd(new_dentry)->state == DELETED) { -+ dtopd(old_dentry)->state = DEL_REWRITTEN; -+ dtohd(old_dentry) = NULL; -+ } -+ else if(dtopd(new_dentry)->state == NON_EXISTANT) { -+ dtopd(old_dentry)->state = CREATED; -+ /* steal new dentry's neg. base dentry */ -+ dtohd(old_dentry) = dtohd(new_dentry); -+ dtohd(new_dentry) = NULL; -+ } -+ } -+ if(dtopd(new_dentry)->state == UNMODIFIED || -+ dtopd(new_dentry)->state == NON_EXISTANT) { -+ err = get_neg_sto_dentry(new_dentry); -+ if(err) -+ goto out; -+ } -+ -+ /* now move sto file */ -+ hidden_old_dentry = dtohd2(old_dentry); -+ hidden_new_dentry = dtohd2(new_dentry); -+ -+ dget(hidden_old_dentry); -+ dget(hidden_new_dentry); -+ -+ hidden_old_dir_dentry = dget(hidden_old_dentry->d_parent); -+ hidden_new_dir_dentry = dget(hidden_new_dentry->d_parent); -+ double_lock(hidden_old_dir_dentry, hidden_new_dir_dentry); -+ -+ err = vfs_rename(hidden_old_dir_dentry->d_inode, hidden_old_dentry, -+ hidden_new_dir_dentry->d_inode, hidden_new_dentry); -+ if(err) -+ goto out_lock; -+ -+ fist_copy_attr_all(new_dir, hidden_new_dir_dentry->d_inode); -+ if (new_dir != old_dir) -+ fist_copy_attr_all(old_dir, -+ hidden_old_dir_dentry->d_inode); -+ -+ out_lock: -+ /* double_unlock will dput the new/old parent dentries -+ * whose refcnts were incremented via get_parent above. */ -+ double_unlock(hidden_old_dir_dentry, hidden_new_dir_dentry); -+ dput(hidden_new_dentry); -+ dput(hidden_old_dentry); -+ -+ out: -+ return err; -+} -+ -+int rename_nondir(inode_t *old_dir, dentry_t *old_dentry, -+ inode_t *new_dir, dentry_t *new_dentry) -+{ -+ int err=0; -+ -+ check_mini_fo_dentry(old_dentry); -+ check_mini_fo_dentry(new_dentry); -+ check_mini_fo_inode(old_dir); -+ check_mini_fo_inode(new_dir); -+ -+ /* state: UNMODIFIED */ -+ if(dtost(old_dentry) == UNMODIFIED) { -+ err = nondir_unmod_to_mod(old_dentry, 1); -+ if(err) { -+ err = -EINVAL; -+ goto out; -+ } -+ } -+ -+ /* the easy states */ -+ if(exists_in_storage(old_dentry)) { -+ -+ dentry_t *hidden_old_dentry; -+ dentry_t *hidden_new_dentry; -+ dentry_t *hidden_old_dir_dentry; -+ dentry_t *hidden_new_dir_dentry; -+ -+ /* if old file is MODIFIED, add it to the deleted_list */ -+ if(dtopd(old_dentry)->state == MODIFIED) { -+ meta_add_d_entry(old_dentry->d_parent, -+ old_dentry->d_name.name, -+ old_dentry->d_name.len); -+ -+ dput(dtohd(old_dentry)); -+ } -+ /* if old file is CREATED, we only release the base dentry */ -+ if(dtopd(old_dentry)->state == CREATED) { -+ if(dtohd(old_dentry)) -+ dput(dtohd(old_dentry)); -+ } -+ -+ /* now setup the new states (depends on new_dentry state) */ -+ /* new dentry state = MODIFIED */ -+ if(dtopd(new_dentry)->state == MODIFIED) { -+ meta_add_d_entry(new_dentry->d_parent, -+ new_dentry->d_name.name, -+ new_dentry->d_name.len); -+ -+ /* new dentry will be d_put'ed later by the vfs -+ * so don't do it here -+ * dput(dtohd(new_dentry)); -+ */ -+ dtohd(old_dentry) = NULL; -+ dtopd(old_dentry)->state = DEL_REWRITTEN; -+ } -+ /* new dentry state = UNMODIFIED */ -+ else if(dtopd(new_dentry)->state == UNMODIFIED) { -+ if(get_neg_sto_dentry(new_dentry)) -+ return -EINVAL; -+ -+ meta_add_d_entry(new_dentry->d_parent, -+ new_dentry->d_name.name, -+ new_dentry->d_name.len); -+ -+ /* is this right??? */ -+ /*dput(dtohd(new_dentry));*/ -+ dtohd(old_dentry) = NULL; -+ dtopd(old_dentry)->state = DEL_REWRITTEN; -+ } -+ /* new dentry state = CREATED */ -+ else if(dtopd(new_dentry)->state == CREATED) { -+ /* we keep the neg. base dentry (if exists) */ -+ dtohd(old_dentry) = dtohd(new_dentry); -+ /* ...and set it to Null, or we'll get -+ * dcache.c:345 if it gets dput twice... */ -+ dtohd(new_dentry) = NULL; -+ dtopd(old_dentry)->state = CREATED; -+ } -+ /* new dentry state = NON_EXISTANT */ -+ else if(dtopd(new_dentry)->state == NON_EXISTANT) { -+ if(get_neg_sto_dentry(new_dentry)) -+ return -EINVAL; -+ -+ /* we keep the neg. base dentry (if exists) */ -+ dtohd(old_dentry) = dtohd(new_dentry); -+ /* ...and set it to Null, or we'll get -+ * Dr. dcache.c:345 if it gets dput twice... */ -+ dtohd(new_dentry) = NULL; -+ dtopd(old_dentry)->state = CREATED; -+ } -+ /* new dentry state = DEL_REWRITTEN or DELETED */ -+ else if(dtopd(new_dentry)->state == DEL_REWRITTEN || -+ dtopd(new_dentry)->state == DELETED) { -+ dtohd(old_dentry) = NULL; -+ dtopd(old_dentry)->state = DEL_REWRITTEN; -+ } -+ else { /* not possible, uhh, ahh */ -+ printk(KERN_CRIT -+ "mini_fo: rename_reg_file: invalid state detected [1].\n"); -+ return -1; -+ } -+ -+ /* now we definitely have a sto file */ -+ hidden_old_dentry = dtohd2(old_dentry); -+ hidden_new_dentry = dtohd2(new_dentry); -+ -+ dget(hidden_old_dentry); -+ dget(hidden_new_dentry); -+ -+ hidden_old_dir_dentry = dget(hidden_old_dentry->d_parent); -+ hidden_new_dir_dentry = dget(hidden_new_dentry->d_parent); -+ double_lock(hidden_old_dir_dentry, hidden_new_dir_dentry); -+ -+ err = vfs_rename(hidden_old_dir_dentry->d_inode, -+ hidden_old_dentry, -+ hidden_new_dir_dentry->d_inode, -+ hidden_new_dentry); -+ if(err) -+ goto out_lock; -+ -+ fist_copy_attr_all(new_dir, hidden_new_dir_dentry->d_inode); -+ if (new_dir != old_dir) -+ fist_copy_attr_all(old_dir, hidden_old_dir_dentry->d_inode); -+ -+ out_lock: -+ /* double_unlock will dput the new/old parent dentries -+ * whose refcnts were incremented via get_parent above. -+ */ -+ double_unlock(hidden_old_dir_dentry, hidden_new_dir_dentry); -+ dput(hidden_new_dentry); -+ dput(hidden_old_dentry); -+ out: -+ return err; -+ } -+ else { /* invalid state */ -+ printk(KERN_CRIT "mini_fo: rename_reg_file: ERROR: invalid state detected [2].\n"); -+ return -1; -+ } -+} -+ -+ -+STATIC int -+mini_fo_readlink(dentry_t *dentry, char *buf, int bufsiz) -+{ -+ int err=0; -+ dentry_t *hidden_dentry = NULL; -+ -+ if(dtohd2(dentry) && dtohd2(dentry)->d_inode) { -+ hidden_dentry = dtohd2(dentry); -+ } else if(dtohd(dentry) && dtohd(dentry)->d_inode) { -+ hidden_dentry = dtohd(dentry); -+ } else { -+ goto out; -+ } -+ -+ if (!hidden_dentry->d_inode->i_op || -+ !hidden_dentry->d_inode->i_op->readlink) { -+ err = -EINVAL; goto out; -+ } -+ -+ err = hidden_dentry->d_inode->i_op->readlink(hidden_dentry, -+ buf, -+ bufsiz); -+ if (err > 0) -+ fist_copy_attr_atime(dentry->d_inode, hidden_dentry->d_inode); -+ -+ out: -+ return err; -+} -+ -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) -+static int mini_fo_follow_link(dentry_t *dentry, struct nameidata *nd) -+#else -+static void* mini_fo_follow_link(dentry_t *dentry, struct nameidata *nd) -+#endif -+{ -+ char *buf; -+ int len = PAGE_SIZE, err; -+ mm_segment_t old_fs; -+ -+ /* in 2.6 this is freed by mini_fo_put_link called by __do_follow_link */ -+ buf = kmalloc(len, GFP_KERNEL); -+ if (!buf) { -+ err = -ENOMEM; -+ goto out; -+ } -+ -+ /* read the symlink, and then we will follow it */ -+ old_fs = get_fs(); -+ set_fs(KERNEL_DS); -+ err = dentry->d_inode->i_op->readlink(dentry, buf, len); -+ set_fs(old_fs); -+ if (err < 0) { -+ kfree(buf); -+ buf = NULL; -+ goto out; -+ } -+ buf[err] = 0; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+ nd_set_link(nd, buf); -+ err = 0; -+#else -+ err = vfs_follow_link(nd, buf); -+#endif -+ -+ out: -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -+ kfree(buf); -+#endif -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) -+ return err; -+#else -+ return ERR_PTR(err); -+#endif -+} -+ -+STATIC -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) -+void mini_fo_put_link(struct dentry *dentry, struct nameidata *nd) -+#else -+void mini_fo_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie) -+#endif -+{ -+ char *link; -+ link = nd_get_link(nd); -+ kfree(link); -+} -+#endif -+ -+STATIC int -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+mini_fo_permission(inode_t *inode, int mask, struct nameidata *nd) -+#else -+mini_fo_permission(inode_t *inode, int mask) -+#endif -+{ -+ inode_t *hidden_inode; -+ int mode; -+ int err; -+ -+ if(itohi2(inode)) { -+ hidden_inode = itohi2(inode); -+ } else { -+ hidden_inode = itohi(inode); -+ } -+ mode = inode->i_mode; -+ -+ /* not really needed, as permission handles everything: -+ * err = vfs_permission(inode, mask); -+ * if (err) -+ * goto out; -+ */ -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+ err = permission(hidden_inode, mask, nd); -+#else -+ err = permission(hidden_inode, mask); -+#endif -+ -+ /* out: */ -+ return err; -+} -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -+STATIC int -+mini_fo_inode_revalidate(dentry_t *dentry) -+{ -+ int err = 0; -+ dentry_t *hidden_dentry; -+ inode_t *hidden_inode; -+ -+ ASSERT(dentry->d_inode); -+ ASSERT(itopd(dentry->d_inode)); -+ -+ if(itohi2(dentry->d_inode)) { -+ hidden_dentry = dtohd2(dentry); -+ hidden_inode = hidden_dentry->d_inode; -+ } else if(itohi(dentry->d_inode)) { -+ hidden_dentry = dtohd(dentry); -+ hidden_inode = hidden_dentry->d_inode; -+ } else { -+ printk(KERN_CRIT "mini_fo_inode_revalidate: ERROR, invalid state detected.\n"); -+ err = -ENOENT; -+ goto out; -+ } -+ if (hidden_inode && hidden_inode->i_op && hidden_inode->i_op->revalidate){ -+ err = hidden_inode->i_op->revalidate(hidden_dentry); -+ if (err) -+ goto out; -+ } -+ fist_copy_attr_all(dentry->d_inode, hidden_inode); -+ out: -+ return err; -+} -+#endif -+ -+STATIC int -+mini_fo_setattr(dentry_t *dentry, struct iattr *ia) -+{ -+ int err = 0; -+ -+ check_mini_fo_dentry(dentry); -+ -+ if(!is_mini_fo_existant(dentry)) { -+ printk(KERN_CRIT "mini_fo_setattr: ERROR, invalid state detected [1].\n"); -+ goto out; -+ } -+ -+ if(dtost(dentry) == UNMODIFIED) { -+ if(!IS_COPY_FLAG(ia->ia_valid)) -+ goto out; /* we ignore these changes to base */ -+ -+ if(S_ISDIR(dentry->d_inode->i_mode)) { -+ err = dir_unmod_to_mod(dentry); -+ } else { -+ /* we copy contents if file is not beeing truncated */ -+ if(S_ISREG(dentry->d_inode->i_mode) && -+ !(ia->ia_size == 0 && (ia->ia_valid & ATTR_SIZE))) { -+ err = nondir_unmod_to_mod(dentry, 1); -+ } else -+ err = nondir_unmod_to_mod(dentry, 0); -+ } -+ if(err) { -+ err = -EINVAL; -+ printk(KERN_CRIT "mini_fo_setattr: ERROR changing states.\n"); -+ goto out; -+ } -+ } -+ if(!exists_in_storage(dentry)) { -+ printk(KERN_CRIT "mini_fo_setattr: ERROR, invalid state detected [2].\n"); -+ err = -EINVAL; -+ goto out; -+ } -+ ASSERT(dentry->d_inode); -+ ASSERT(dtohd2(dentry)); -+ ASSERT(itopd(dentry->d_inode)); -+ ASSERT(itohi2(dentry->d_inode)); -+ -+ err = notify_change(dtohd2(dentry), ia); -+ fist_copy_attr_all(dentry->d_inode, itohi2(dentry->d_inode)); -+ out: -+ return err; -+} -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+STATIC int -+mini_fo_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) -+{ -+ int err = 0; -+ dentry_t *hidden_dentry; -+ -+ ASSERT(dentry->d_inode); -+ ASSERT(itopd(dentry->d_inode)); -+ -+ if(itohi2(dentry->d_inode)) { -+ hidden_dentry = dtohd2(dentry); -+ } else if(itohi(dentry->d_inode)) { -+ hidden_dentry = dtohd(dentry); -+ } else { -+ printk(KERN_CRIT "mini_fo_getattr: ERROR, invalid state detected.\n"); -+ err = -ENOENT; -+ goto out; -+ } -+ fist_copy_attr_all(dentry->d_inode, hidden_dentry->d_inode); -+ -+ ASSERT(hidden_dentry); -+ ASSERT(hidden_dentry->d_inode); -+ ASSERT(hidden_dentry->d_inode->i_op); -+ -+ generic_fillattr(dentry->d_inode, stat); -+ if (!stat->blksize) { -+ struct super_block *s = hidden_dentry->d_inode->i_sb; -+ unsigned blocks; -+ blocks = (stat->size+s->s_blocksize-1) >> s->s_blocksize_bits; -+ stat->blocks = (s->s_blocksize / 512) * blocks; -+ stat->blksize = s->s_blocksize; -+ } -+ out: -+ return err; -+} -+#endif -+ -+#if defined(XATTR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)) -+#if 0 /* no xattr_alloc() and xattr_free() */ -+/* This is lifted from fs/xattr.c */ -+static void * -+xattr_alloc(size_t size, size_t limit) -+{ -+ void *ptr; -+ -+ if (size > limit) -+ return ERR_PTR(-E2BIG); -+ -+ if (!size) /* size request, no buffer is needed */ -+ return NULL; -+ else if (size <= PAGE_SIZE) -+ ptr = kmalloc((unsigned long) size, GFP_KERNEL); -+ else -+ ptr = vmalloc((unsigned long) size); -+ if (!ptr) -+ return ERR_PTR(-ENOMEM); -+ return ptr; -+} -+ -+static void -+xattr_free(void *ptr, size_t size) -+{ -+ if (!size) /* size request, no buffer was needed */ -+ return; -+ else if (size <= PAGE_SIZE) -+ kfree(ptr); -+ else -+ vfree(ptr); -+} -+#endif /* no xattr_alloc() and xattr_free() */ -+ -+/* BKL held by caller. -+ * dentry->d_inode->i_sem down -+ */ -+STATIC int -+mini_fo_getxattr(struct dentry *dentry, const char *name, void *value, size_t size) { -+ struct dentry *hidden_dentry = NULL; -+ int err = -EOPNOTSUPP; -+ /* Define these anyway so we don't need as much ifdef'ed code. */ -+ char *encoded_name = NULL; -+ char *encoded_value = NULL; -+ -+ check_mini_fo_dentry(dentry); -+ -+ if(exists_in_storage(dentry)) -+ hidden_dentry = dtohd2(dentry); -+ else -+ hidden_dentry = dtohd(dentry); -+ -+ ASSERT(hidden_dentry); -+ ASSERT(hidden_dentry->d_inode); -+ ASSERT(hidden_dentry->d_inode->i_op); -+ -+ if (hidden_dentry->d_inode->i_op->getxattr) { -+ encoded_name = (char *)name; -+ encoded_value = (char *)value; -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&hidden_dentry->d_inode->i_mutex); -+#else -+ down(&hidden_dentry->d_inode->i_sem); -+#endif -+ /* lock_kernel() already done by caller. */ -+ err = hidden_dentry->d_inode->i_op->getxattr(hidden_dentry, encoded_name, encoded_value, size); -+ /* unlock_kernel() will be done by caller. */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&hidden_dentry->d_inode->i_mutex); -+#else -+ up(&hidden_dentry->d_inode->i_sem); -+#endif -+ } -+ return err; -+} -+ -+/* BKL held by caller. -+ * dentry->d_inode->i_sem down -+ */ -+STATIC int -+#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,21) \ -+ && LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,23)) \ -+ || LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) -+mini_fo_setxattr(struct dentry *dentry, const char *name, -+ const void *value, size_t size, int flags) -+#else -+mini_fo_setxattr(struct dentry *dentry, const char *name, -+ void *value, size_t size, int flags) -+#endif -+ -+{ -+ struct dentry *hidden_dentry = NULL; -+ int err = -EOPNOTSUPP; -+ -+ /* Define these anyway, so we don't have as much ifdef'ed code. */ -+ char *encoded_value = NULL; -+ char *encoded_name = NULL; -+ -+ check_mini_fo_dentry(dentry); -+ -+ if(exists_in_storage(dentry)) -+ hidden_dentry = dtohd2(dentry); -+ else -+ hidden_dentry = dtohd(dentry); -+ -+ ASSERT(hidden_dentry); -+ ASSERT(hidden_dentry->d_inode); -+ ASSERT(hidden_dentry->d_inode->i_op); -+ -+ if (hidden_dentry->d_inode->i_op->setxattr) { -+ encoded_name = (char *)name; -+ encoded_value = (char *)value; -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&hidden_dentry->d_inode->i_mutex); -+#else -+ down(&hidden_dentry->d_inode->i_sem); -+#endif -+ /* lock_kernel() already done by caller. */ -+ err = hidden_dentry->d_inode->i_op->setxattr(hidden_dentry, encoded_name, encoded_value, size, flags); -+ /* unlock_kernel() will be done by caller. */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&hidden_dentry->d_inode->i_mutex); -+#else -+ up(&hidden_dentry->d_inode->i_sem); -+#endif -+ } -+ return err; -+} -+ -+/* BKL held by caller. -+ * dentry->d_inode->i_sem down -+ */ -+STATIC int -+mini_fo_removexattr(struct dentry *dentry, const char *name) { -+ struct dentry *hidden_dentry = NULL; -+ int err = -EOPNOTSUPP; -+ char *encoded_name; -+ -+ check_mini_fo_dentry(dentry); -+ -+ if(exists_in_storage(dentry)) -+ hidden_dentry = dtohd2(dentry); -+ else -+ hidden_dentry = dtohd(dentry); -+ -+ ASSERT(hidden_dentry); -+ ASSERT(hidden_dentry->d_inode); -+ ASSERT(hidden_dentry->d_inode->i_op); -+ -+ if (hidden_dentry->d_inode->i_op->removexattr) { -+ encoded_name = (char *)name; -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&hidden_dentry->d_inode->i_mutex); -+#else -+ down(&hidden_dentry->d_inode->i_sem); -+#endif -+ /* lock_kernel() already done by caller. */ -+ err = hidden_dentry->d_inode->i_op->removexattr(hidden_dentry, encoded_name); -+ /* unlock_kernel() will be done by caller. */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&hidden_dentry->d_inode->i_mutex); -+#else -+ up(&hidden_dentry->d_inode->i_sem); -+#endif -+ } -+ return err; -+} -+ -+/* BKL held by caller. -+ * dentry->d_inode->i_sem down -+ */ -+STATIC int -+mini_fo_listxattr(struct dentry *dentry, char *list, size_t size) { -+ struct dentry *hidden_dentry = NULL; -+ int err = -EOPNOTSUPP; -+ char *encoded_list = NULL; -+ -+ check_mini_fo_dentry(dentry); -+ -+ if(exists_in_storage(dentry)) -+ hidden_dentry = dtohd2(dentry); -+ else -+ hidden_dentry = dtohd(dentry); -+ -+ ASSERT(hidden_dentry); -+ ASSERT(hidden_dentry->d_inode); -+ ASSERT(hidden_dentry->d_inode->i_op); -+ -+ if (hidden_dentry->d_inode->i_op->listxattr) { -+ encoded_list = list; -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&hidden_dentry->d_inode->i_mutex); -+#else -+ down(&hidden_dentry->d_inode->i_sem); -+#endif -+ /* lock_kernel() already done by caller. */ -+ err = hidden_dentry->d_inode->i_op->listxattr(hidden_dentry, encoded_list, size); -+ /* unlock_kernel() will be done by caller. */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&hidden_dentry->d_inode->i_mutex); -+#else -+ up(&hidden_dentry->d_inode->i_sem); -+#endif -+ } -+ return err; -+} -+# endif /* defined(XATTR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)) */ -+ -+struct inode_operations mini_fo_symlink_iops = -+ { -+ readlink: mini_fo_readlink, -+ follow_link: mini_fo_follow_link, -+ /* mk: permission: mini_fo_permission, */ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -+ revalidate: mini_fo_inode_revalidate, -+#endif -+ setattr: mini_fo_setattr, -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+ getattr: mini_fo_getattr, -+ put_link: mini_fo_put_link, -+#endif -+ -+#if defined(XATTR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)) -+ setxattr: mini_fo_setxattr, -+ getxattr: mini_fo_getxattr, -+ listxattr: mini_fo_listxattr, -+ removexattr: mini_fo_removexattr -+# endif /* defined(XATTR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)) */ -+ }; -+ -+struct inode_operations mini_fo_dir_iops = -+ { -+ create: mini_fo_create, -+ lookup: mini_fo_lookup, -+ link: mini_fo_link, -+ unlink: mini_fo_unlink, -+ symlink: mini_fo_symlink, -+ mkdir: mini_fo_mkdir, -+ rmdir: mini_fo_rmdir, -+ mknod: mini_fo_mknod, -+ rename: mini_fo_rename, -+ /* no readlink/follow_link for non-symlinks */ -+ // off because we have setattr -+ // truncate: mini_fo_truncate, -+ /* mk:permission: mini_fo_permission, */ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -+ revalidate: mini_fo_inode_revalidate, -+#endif -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+ getattr: mini_fo_getattr, -+#endif -+ setattr: mini_fo_setattr, -+#if defined(XATTR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)) -+ setxattr: mini_fo_setxattr, -+ getxattr: mini_fo_getxattr, -+ listxattr: mini_fo_listxattr, -+ removexattr: mini_fo_removexattr -+# endif /* XATTR && LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20) */ -+ }; -+ -+struct inode_operations mini_fo_main_iops = -+ { -+ /* permission: mini_fo_permission, */ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -+ revalidate: mini_fo_inode_revalidate, -+#endif -+ setattr: mini_fo_setattr, -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+ getattr: mini_fo_getattr, -+#endif -+#if defined(XATTR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)) -+ setxattr: mini_fo_setxattr, -+ getxattr: mini_fo_getxattr, -+ listxattr: mini_fo_listxattr, -+ removexattr: mini_fo_removexattr -+# endif /* XATTR && LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20) */ -+ }; ---- /dev/null -+++ b/fs/mini_fo/main.c -@@ -0,0 +1,423 @@ -+/* -+ * Copyright (c) 1997-2003 Erez Zadok -+ * Copyright (c) 2001-2003 Stony Brook University -+ * -+ * For specific licensing information, see the COPYING file distributed with -+ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING. -+ * -+ * This Copyright notice must be kept intact and distributed with all -+ * fistgen sources INCLUDING sources generated by fistgen. -+ */ -+/* -+ * Copyright (C) 2004, 2005 Markus Klotzbuecher -+ * -+ * 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 of the License, or (at your option) any later version. -+ */ -+ -+/* -+ * $Id$ -+ */ -+ -+#ifdef HAVE_CONFIG_H -+# include -+#endif -+ -+#include "fist.h" -+#include "mini_fo.h" -+#include -+ -+/* This definition must only appear after we include */ -+#ifndef MODULE_LICENSE -+# define MODULE_LICENSE(bison) -+#endif /* not MODULE_LICENSE */ -+ -+/* -+ * This is the mini_fo tri interpose function, which extends the -+ * functionality of the regular interpose by interposing a higher -+ * level inode on top of two lower level ones: the base filesystem -+ * inode and the storage filesystem inode. -+ * -+ * sb we pass is mini_fo's super_block -+ */ -+int -+mini_fo_tri_interpose(dentry_t *hidden_dentry, -+ dentry_t *hidden_sto_dentry, -+ dentry_t *dentry, super_block_t *sb, int flag) -+{ -+ inode_t *hidden_inode = NULL; -+ inode_t *hidden_sto_inode = NULL; /* store corresponding storage inode */ -+ int err = 0; -+ inode_t *inode; -+ -+ /* Pointer to hidden_sto_inode if exists, else to hidden_inode. -+ * This is used to copy the attributes of the correct inode. */ -+ inode_t *master_inode; -+ -+ if(hidden_dentry) -+ hidden_inode = hidden_dentry->d_inode; -+ if(hidden_sto_dentry) -+ hidden_sto_inode = hidden_sto_dentry->d_inode; -+ -+ ASSERT(dentry->d_inode == NULL); -+ -+ /* mk: One of the inodes associated with the dentrys is likely to -+ * be NULL, so carefull: -+ */ -+ ASSERT((hidden_inode != NULL) || (hidden_sto_inode != NULL)); -+ -+ if(hidden_sto_inode) -+ master_inode = hidden_sto_inode; -+ else -+ master_inode = hidden_inode; -+ -+ /* -+ * We allocate our new inode below, by calling iget. -+ * iget will call our read_inode which will initialize some -+ * of the new inode's fields -+ */ -+ -+ /* -+ * original: inode = iget(sb, hidden_inode->i_ino); -+ */ -+ inode = iget(sb, iunique(sb, 25)); -+ if (!inode) { -+ err = -EACCES; /* should be impossible??? */ -+ goto out; -+ } -+ -+ /* -+ * interpose the inode if not already interposed -+ * this is possible if the inode is being reused -+ * XXX: what happens if we get_empty_inode() but there's another already? -+ * for now, ASSERT() that this can't happen; fix later. -+ */ -+ if (itohi(inode) != NULL) { -+ printk(KERN_CRIT "mini_fo_tri_interpose: itohi(inode) != NULL.\n"); -+ } -+ if (itohi2(inode) != NULL) { -+ printk(KERN_CRIT "mini_fo_tri_interpose: itohi2(inode) != NULL.\n"); -+ } -+ -+ /* mk: Carefull, igrab can't handle NULL inodes (ok, why should it?), so -+ * we need to check here: -+ */ -+ if(hidden_inode) -+ itohi(inode) = igrab(hidden_inode); -+ else -+ itohi(inode) = NULL; -+ -+ if(hidden_sto_inode) -+ itohi2(inode) = igrab(hidden_sto_inode); -+ else -+ itohi2(inode) = NULL; -+ -+ -+ /* Use different set of inode ops for symlinks & directories*/ -+ if (S_ISLNK(master_inode->i_mode)) -+ inode->i_op = &mini_fo_symlink_iops; -+ else if (S_ISDIR(master_inode->i_mode)) -+ inode->i_op = &mini_fo_dir_iops; -+ -+ /* Use different set of file ops for directories */ -+ if (S_ISDIR(master_inode->i_mode)) -+ inode->i_fop = &mini_fo_dir_fops; -+ -+ /* properly initialize special inodes */ -+ if (S_ISBLK(master_inode->i_mode) || S_ISCHR(master_inode->i_mode) || -+ S_ISFIFO(master_inode->i_mode) || S_ISSOCK(master_inode->i_mode)) { -+ init_special_inode(inode, master_inode->i_mode, master_inode->i_rdev); -+ } -+ -+ /* Fix our inode's address operations to that of the lower inode */ -+ if (inode->i_mapping->a_ops != master_inode->i_mapping->a_ops) { -+ inode->i_mapping->a_ops = master_inode->i_mapping->a_ops; -+ } -+ -+ /* only (our) lookup wants to do a d_add */ -+ if (flag) -+ d_add(dentry, inode); -+ else -+ d_instantiate(dentry, inode); -+ -+ ASSERT(dtopd(dentry) != NULL); -+ -+ /* all well, copy inode attributes */ -+ fist_copy_attr_all(inode, master_inode); -+ -+ out: -+ return err; -+} -+ -+/* parse mount options "base=" and "sto=" */ -+dentry_t * -+mini_fo_parse_options(super_block_t *sb, char *options) -+{ -+ dentry_t *hidden_root = ERR_PTR(-EINVAL); -+ dentry_t *hidden_root2 = ERR_PTR(-EINVAL); -+ struct nameidata nd, nd2; -+ char *name, *tmp, *end; -+ int err = 0; -+ -+ /* We don't want to go off the end of our arguments later on. */ -+ for (end = options; *end; end++); -+ -+ while (options < end) { -+ tmp = options; -+ while (*tmp && *tmp != ',') -+ tmp++; -+ *tmp = '\0'; -+ if (!strncmp("base=", options, 5)) { -+ name = options + 5; -+ printk(KERN_INFO "mini_fo: using base directory: %s\n", name); -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -+ if (path_init(name, LOOKUP_FOLLOW, &nd)) -+ err = path_walk(name, &nd); -+#else -+ err = path_lookup(name, LOOKUP_FOLLOW, &nd); -+#endif -+ if (err) { -+ printk(KERN_CRIT "mini_fo: error accessing hidden directory '%s'\n", name); -+ hidden_root = ERR_PTR(err); -+ goto out; -+ } -+ hidden_root = nd.dentry; -+ stopd(sb)->base_dir_dentry = nd.dentry; -+ stopd(sb)->hidden_mnt = nd.mnt; -+ -+ } else if(!strncmp("sto=", options, 4)) { -+ /* parse the storage dir */ -+ name = options + 4; -+ printk(KERN_INFO "mini_fo: using storage directory: %s\n", name); -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -+ if(path_init(name, LOOKUP_FOLLOW, &nd2)) -+ err = path_walk(name, &nd2); -+#else -+ err = path_lookup(name, LOOKUP_FOLLOW, &nd2); -+#endif -+ if(err) { -+ printk(KERN_CRIT "mini_fo: error accessing hidden storage directory '%s'\n", name); -+ -+ hidden_root2 = ERR_PTR(err); -+ goto out; -+ } -+ hidden_root2 = nd2.dentry; -+ stopd(sb)->storage_dir_dentry = nd2.dentry; -+ stopd(sb)->hidden_mnt2 = nd2.mnt; -+ stohs2(sb) = hidden_root2->d_sb; -+ -+ /* validate storage dir, this is done in -+ * mini_fo_read_super for the base directory. -+ */ -+ if (IS_ERR(hidden_root2)) { -+ printk(KERN_WARNING "mini_fo_parse_options: storage dentry lookup failed (err = %ld)\n", PTR_ERR(hidden_root2)); -+ goto out; -+ } -+ if (!hidden_root2->d_inode) { -+ printk(KERN_WARNING "mini_fo_parse_options: no storage dir to interpose on.\n"); -+ goto out; -+ } -+ stohs2(sb) = hidden_root2->d_sb; -+ } else { -+ printk(KERN_WARNING "mini_fo: unrecognized option '%s'\n", options); -+ hidden_root = ERR_PTR(-EINVAL); -+ goto out; -+ } -+ options = tmp + 1; -+ } -+ -+ out: -+ if(IS_ERR(hidden_root2)) -+ return hidden_root2; -+ return hidden_root; -+} -+ -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+static int -+#else -+super_block_t * -+#endif -+mini_fo_read_super(super_block_t *sb, void *raw_data, int silent) -+{ -+ dentry_t *hidden_root; -+ int err = 0; -+ -+ if (!raw_data) { -+ printk(KERN_WARNING "mini_fo_read_super: missing argument\n"); -+ err = -EINVAL; -+ goto out; -+ } -+ /* -+ * Allocate superblock private data -+ */ -+ __stopd(sb) = kmalloc(sizeof(struct mini_fo_sb_info), GFP_KERNEL); -+ if (!stopd(sb)) { -+ printk(KERN_WARNING "%s: out of memory\n", __FUNCTION__); -+ err = -ENOMEM; -+ goto out; -+ } -+ stohs(sb) = NULL; -+ -+ hidden_root = mini_fo_parse_options(sb, raw_data); -+ if (IS_ERR(hidden_root)) { -+ printk(KERN_WARNING "mini_fo_read_super: lookup_dentry failed (err = %ld)\n", PTR_ERR(hidden_root)); -+ err = PTR_ERR(hidden_root); -+ goto out_free; -+ } -+ if (!hidden_root->d_inode) { -+ printk(KERN_WARNING "mini_fo_read_super: no directory to interpose on\n"); -+ goto out_free; -+ } -+ stohs(sb) = hidden_root->d_sb; -+ -+ /* -+ * Linux 2.4.2-ac3 and beyond has code in -+ * mm/filemap.c:generic_file_write() that requires sb->s_maxbytes -+ * to be populated. If not set, all write()s under that sb will -+ * return 0. -+ * -+ * Linux 2.4.4+ automatically sets s_maxbytes to MAX_NON_LFS; -+ * the filesystem should override it only if it supports LFS. -+ */ -+ /* non-SCA code is good to go with LFS */ -+ sb->s_maxbytes = hidden_root->d_sb->s_maxbytes; -+ -+ sb->s_op = &mini_fo_sops; -+ /* -+ * we can't use d_alloc_root if we want to use -+ * our own interpose function unchanged, -+ * so we simply replicate *most* of the code in d_alloc_root here -+ */ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -+ sb->s_root = d_alloc(NULL, &(const struct qstr) { "/", 1, 0 }); -+#else -+ sb->s_root = d_alloc(NULL, &(const struct qstr){hash: 0, name: "/", len : 1}); -+#endif -+ if (IS_ERR(sb->s_root)) { -+ printk(KERN_WARNING "mini_fo_read_super: d_alloc failed\n"); -+ err = -ENOMEM; -+ goto out_dput; -+ } -+ -+ sb->s_root->d_op = &mini_fo_dops; -+ sb->s_root->d_sb = sb; -+ sb->s_root->d_parent = sb->s_root; -+ -+ /* link the upper and lower dentries */ -+ __dtopd(sb->s_root) = (struct mini_fo_dentry_info *) -+ kmalloc(sizeof(struct mini_fo_dentry_info), GFP_KERNEL); -+ if (!dtopd(sb->s_root)) { -+ err = -ENOMEM; -+ goto out_dput2; -+ } -+ dtopd(sb->s_root)->state = MODIFIED; -+ dtohd(sb->s_root) = hidden_root; -+ -+ /* fanout relevant, interpose on storage root dentry too */ -+ dtohd2(sb->s_root) = stopd(sb)->storage_dir_dentry; -+ -+ /* ...and call tri-interpose to interpose root dir inodes -+ * if (mini_fo_interpose(hidden_root, sb->s_root, sb, 0)) -+ */ -+ if(mini_fo_tri_interpose(hidden_root, dtohd2(sb->s_root), sb->s_root, sb, 0)) -+ goto out_dput2; -+ -+ /* initalize the wol list */ -+ itopd(sb->s_root->d_inode)->deleted_list_size = -1; -+ itopd(sb->s_root->d_inode)->renamed_list_size = -1; -+ meta_build_lists(sb->s_root); -+ -+ goto out; -+ -+ out_dput2: -+ dput(sb->s_root); -+ out_dput: -+ dput(hidden_root); -+ dput(dtohd2(sb->s_root)); /* release the hidden_sto_dentry too */ -+ out_free: -+ kfree(stopd(sb)); -+ __stopd(sb) = NULL; -+ out: -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+ return err; -+#else -+ if (err) { -+ return ERR_PTR(err); -+ } else { -+ return sb; -+ } -+#endif -+} -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) -+static int mini_fo_get_sb(struct file_system_type *fs_type, -+ int flags, const char *dev_name, -+ void *raw_data, struct vfsmount *mnt) -+{ -+ return get_sb_nodev(fs_type, flags, raw_data, mini_fo_read_super, mnt); -+} -+#else -+static struct super_block *mini_fo_get_sb(struct file_system_type *fs_type, -+ int flags, const char *dev_name, -+ void *raw_data) -+{ -+ return get_sb_nodev(fs_type, flags, raw_data, mini_fo_read_super); -+} -+#endif -+ -+void mini_fo_kill_block_super(struct super_block *sb) -+{ -+ generic_shutdown_super(sb); -+ /* -+ * XXX: BUG: Halcrow: Things get unstable sometime after this point: -+ * lib/rwsem-spinlock.c:127: spin_is_locked on uninitialized -+ * fs/fs-writeback.c:402: spin_lock(fs/super.c:a0381828) already -+ * locked by fs/fs-writeback.c/402 -+ * -+ * Apparently, someone's not releasing a lock on sb_lock... -+ */ -+} -+ -+static struct file_system_type mini_fo_fs_type = { -+ .owner = THIS_MODULE, -+ .name = "mini_fo", -+ .get_sb = mini_fo_get_sb, -+ .kill_sb = mini_fo_kill_block_super, -+ .fs_flags = 0, -+}; -+ -+ -+#else -+static DECLARE_FSTYPE(mini_fo_fs_type, "mini_fo", mini_fo_read_super, 0); -+#endif -+ -+static int __init init_mini_fo_fs(void) -+{ -+ printk("Registering mini_fo version $Id$\n"); -+ return register_filesystem(&mini_fo_fs_type); -+} -+static void __exit exit_mini_fo_fs(void) -+{ -+ printk("Unregistering mini_fo version $Id$\n"); -+ unregister_filesystem(&mini_fo_fs_type); -+} -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -+EXPORT_NO_SYMBOLS; -+#endif -+ -+MODULE_AUTHOR("Erez Zadok "); -+MODULE_DESCRIPTION("FiST-generated mini_fo filesystem"); -+MODULE_LICENSE("GPL"); -+ -+/* MODULE_PARM(fist_debug_var, "i"); */ -+/* MODULE_PARM_DESC(fist_debug_var, "Debug level"); */ -+ -+module_init(init_mini_fo_fs) -+module_exit(exit_mini_fo_fs) ---- /dev/null -+++ b/fs/mini_fo/Makefile -@@ -0,0 +1,17 @@ -+# -+# Makefile for mini_fo 2.4 and 2.6 Linux kernels -+# -+# Copyright (C) 2004, 2005 Markus Klotzbuecher -+# -+# 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 of the License, or (at your option) any later version. -+# -+ -+obj-$(CONFIG_MINI_FO) := mini_fo.o -+mini_fo-objs := meta.o dentry.o file.o inode.o main.o super.o state.o aux.o -+ -+# dependencies -+${mini_fo-objs}: mini_fo.h fist.h -+ ---- /dev/null -+++ b/fs/mini_fo/meta.c -@@ -0,0 +1,1000 @@ -+/* -+ * Copyright (C) 2004, 2005 Markus Klotzbuecher -+ * -+ * 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 of the License, or (at your option) any later version. -+ */ -+ -+#ifdef HAVE_CONFIG_H -+# include -+#endif /* HAVE_CONFIG_H */ -+#include "fist.h" -+#include "mini_fo.h" -+ -+int meta_build_lists(dentry_t *dentry) -+{ -+ struct mini_fo_inode_info *inode_info; -+ -+ dentry_t *meta_dentry = 0; -+ file_t *meta_file = 0; -+ mm_segment_t old_fs; -+ void *buf; -+ -+ int bytes, len; -+ struct vfsmount *meta_mnt; -+ char *entry; -+ -+ inode_info = itopd(dentry->d_inode); -+ if(!(inode_info->deleted_list_size == -1 && -+ inode_info->renamed_list_size == -1)) { -+ printk(KERN_CRIT "mini_fo: meta_build_lists: \ -+ Error, list(s) not virgin.\n"); -+ return -1; -+ } -+ -+ /* init our meta lists */ -+ INIT_LIST_HEAD(&inode_info->deleted_list); -+ inode_info->deleted_list_size = 0; -+ -+ INIT_LIST_HEAD(&inode_info->renamed_list); -+ inode_info->renamed_list_size = 0; -+ -+ /* might there be a META-file? */ -+ if(dtohd2(dentry) && dtohd2(dentry)->d_inode) { -+ meta_dentry = lookup_one_len(META_FILENAME, -+ dtohd2(dentry), -+ strlen(META_FILENAME)); -+ if(!meta_dentry->d_inode) { -+ dput(meta_dentry); -+ goto out_ok; -+ } -+ /* $%& err, is this correct? */ -+ meta_mnt = stopd(dentry->d_inode->i_sb)->hidden_mnt2; -+ mntget(meta_mnt); -+ -+ -+ /* open META-file for reading */ -+ meta_file = dentry_open(meta_dentry, meta_mnt, 0x0); -+ if(!meta_file || IS_ERR(meta_file)) { -+ printk(KERN_CRIT "mini_fo: meta_build_lists: \ -+ ERROR opening META file.\n"); -+ goto out_err; -+ } -+ -+ /* check if fs supports reading */ -+ if(!meta_file->f_op->read) { -+ printk(KERN_CRIT "mini_fo: meta_build_lists: \ -+ ERROR, fs does not support reading.\n"); -+ goto out_err_close; -+ } -+ -+ /* allocate a page for transfering the data */ -+ buf = (void *) __get_free_page(GFP_KERNEL); -+ if(!buf) { -+ printk(KERN_CRIT "mini_fo: meta_build_lists: \ -+ ERROR, out of mem.\n"); -+ goto out_err_close; -+ } -+ meta_file->f_pos = 0; -+ old_fs = get_fs(); -+ set_fs(KERNEL_DS); -+ do { -+ char *c; -+ bytes = meta_file->f_op->read(meta_file, buf, PAGE_SIZE, &meta_file->f_pos); -+ if(bytes == PAGE_SIZE) { -+ /* trim a cut off filename and adjust f_pos to get it next time */ -+ for(c = (char*) buf+PAGE_SIZE; -+ *c != '\n'; -+ c--, bytes--, meta_file->f_pos--); -+ } -+ entry = (char *) buf; -+ while(entry < (char *) buf+bytes) { -+ -+ char *old_path; -+ char *dir_name; -+ int old_len, new_len; -+ -+ /* len without '\n'*/ -+ len = (int) (strchr(entry, '\n') - entry); -+ switch (*entry) { -+ case 'D': -+ /* format: "D filename" */ -+ meta_list_add_d_entry(dentry, -+ entry+2, -+ len-2); -+ break; -+ case 'R': -+ /* format: "R path/xy/dir newDir" */ -+ old_path = entry+2; -+ dir_name = strchr(old_path, ' ') + 1; -+ old_len = dir_name - old_path - 1; -+ new_len = ((int) entry) + len - ((int ) dir_name); -+ meta_list_add_r_entry(dentry, -+ old_path, -+ old_len, -+ dir_name, -+ new_len); -+ break; -+ default: -+ /* unknown entry type detected */ -+ break; -+ } -+ entry += len+1; -+ } -+ -+ } while(meta_file->f_pos < meta_dentry->d_inode->i_size); -+ -+ free_page((unsigned long) buf); -+ set_fs(old_fs); -+ fput(meta_file); -+ } -+ goto out_ok; -+ -+ out_err_close: -+ fput(meta_file); -+ out_err: -+ mntput(meta_mnt); -+ dput(meta_dentry); -+ return -1; -+ out_ok: -+ return 1; /* check this!!! inode_info->wol_size; */ -+} -+ -+/* cleanups up all lists and free's the mem by dentry */ -+int meta_put_lists(dentry_t *dentry) -+{ -+ if(!dentry || !dentry->d_inode) { -+ printk("mini_fo: meta_put_lists: invalid dentry passed.\n"); -+ return -1; -+ } -+ return __meta_put_lists(dentry->d_inode); -+} -+ -+/* cleanups up all lists and free's the mem by inode */ -+int __meta_put_lists(inode_t *inode) -+{ -+ int err = 0; -+ if(!inode || !itopd(inode)) { -+ printk("mini_fo: __meta_put_lists: invalid inode passed.\n"); -+ return -1; -+ } -+ err = __meta_put_d_list(inode); -+ err |= __meta_put_r_list(inode); -+ return err; -+} -+ -+int meta_sync_lists(dentry_t *dentry) -+{ -+ int err = 0; -+ if(!dentry || !dentry->d_inode) { -+ printk("mini_fo: meta_sync_lists: \ -+ invalid dentry passed.\n"); -+ return -1; -+ } -+ err = meta_sync_d_list(dentry, 0); -+ err |= meta_sync_r_list(dentry, 1); -+ return err; -+} -+ -+ -+/* remove all D entries from the renamed list and free the mem */ -+int __meta_put_d_list(inode_t *inode) -+{ -+ struct list_head *tmp; -+ struct deleted_entry *del_entry; -+ struct mini_fo_inode_info *inode_info; -+ -+ if(!inode || !itopd(inode)) { -+ printk(KERN_CRIT "mini_fo: __meta_put_d_list: \ -+ invalid inode passed.\n"); -+ return -1; -+ } -+ inode_info = itopd(inode); -+ -+ /* nuke the DELETED-list */ -+ if(inode_info->deleted_list_size <= 0) -+ return 0; -+ -+ while(!list_empty(&inode_info->deleted_list)) { -+ tmp = inode_info->deleted_list.next; -+ list_del(tmp); -+ del_entry = list_entry(tmp, struct deleted_entry, list); -+ kfree(del_entry->name); -+ kfree(del_entry); -+ } -+ inode_info->deleted_list_size = 0; -+ -+ return 0; -+} -+ -+/* remove all R entries from the renamed list and free the mem */ -+int __meta_put_r_list(inode_t *inode) -+{ -+ struct list_head *tmp; -+ struct renamed_entry *ren_entry; -+ struct mini_fo_inode_info *inode_info; -+ -+ if(!inode || !itopd(inode)) { -+ printk(KERN_CRIT "mini_fo: meta_put_r_list: invalid inode.\n"); -+ return -1; -+ } -+ inode_info = itopd(inode); -+ -+ /* nuke the RENAMED-list */ -+ if(inode_info->renamed_list_size <= 0) -+ return 0; -+ -+ while(!list_empty(&inode_info->renamed_list)) { -+ tmp = inode_info->renamed_list.next; -+ list_del(tmp); -+ ren_entry = list_entry(tmp, struct renamed_entry, list); -+ kfree(ren_entry->new_name); -+ kfree(ren_entry->old_name); -+ kfree(ren_entry); -+ } -+ inode_info->renamed_list_size = 0; -+ -+ return 0; -+} -+ -+int meta_add_d_entry(dentry_t *dentry, const char *name, int len) -+{ -+ int err = 0; -+ err = meta_list_add_d_entry(dentry, name, len); -+ err |= meta_write_d_entry(dentry,name,len); -+ return err; -+} -+ -+/* add a D entry to the deleted list */ -+int meta_list_add_d_entry(dentry_t *dentry, const char *name, int len) -+{ -+ struct deleted_entry *del_entry; -+ struct mini_fo_inode_info *inode_info; -+ -+ if(!dentry || !dentry->d_inode) { -+ printk(KERN_CRIT "mini_fo: meta_list_add_d_entry: \ -+ invalid dentry passed.\n"); -+ return -1; -+ } -+ inode_info = itopd(dentry->d_inode); -+ -+ if(inode_info->deleted_list_size < 0) -+ return -1; -+ -+ del_entry = (struct deleted_entry *) -+ kmalloc(sizeof(struct deleted_entry), GFP_KERNEL); -+ del_entry->name = (char*) kmalloc(len, GFP_KERNEL); -+ if(!del_entry || !del_entry->name) { -+ printk(KERN_CRIT "mini_fo: meta_list_add_d_entry: \ -+ out of mem.\n"); -+ kfree(del_entry->name); -+ kfree(del_entry); -+ return -ENOMEM; -+ } -+ -+ strncpy(del_entry->name, name, len); -+ del_entry->len = len; -+ -+ list_add(&del_entry->list, &inode_info->deleted_list); -+ inode_info->deleted_list_size++; -+ return 0; -+} -+ -+int meta_add_r_entry(dentry_t *dentry, -+ const char *old_name, int old_len, -+ const char *new_name, int new_len) -+{ -+ int err = 0; -+ err = meta_list_add_r_entry(dentry, -+ old_name, old_len, -+ new_name, new_len); -+ err |= meta_write_r_entry(dentry, -+ old_name, old_len, -+ new_name, new_len); -+ return err; -+} -+ -+/* add a R entry to the renamed list */ -+int meta_list_add_r_entry(dentry_t *dentry, -+ const char *old_name, int old_len, -+ const char *new_name, int new_len) -+{ -+ struct renamed_entry *ren_entry; -+ struct mini_fo_inode_info *inode_info; -+ -+ if(!dentry || !dentry->d_inode) { -+ printk(KERN_CRIT "mini_fo: meta_list_add_r_entry: \ -+ invalid dentry passed.\n"); -+ return -1; -+ } -+ inode_info = itopd(dentry->d_inode); -+ -+ if(inode_info->renamed_list_size < 0) -+ return -1; -+ -+ ren_entry = (struct renamed_entry *) -+ kmalloc(sizeof(struct renamed_entry), GFP_KERNEL); -+ ren_entry->old_name = (char*) kmalloc(old_len, GFP_KERNEL); -+ ren_entry->new_name = (char*) kmalloc(new_len, GFP_KERNEL); -+ -+ if(!ren_entry || !ren_entry->old_name || !ren_entry->new_name) { -+ printk(KERN_CRIT "mini_fo: meta_list_add_r_entry: \ -+ out of mem.\n"); -+ kfree(ren_entry->new_name); -+ kfree(ren_entry->old_name); -+ kfree(ren_entry); -+ return -ENOMEM; -+ } -+ -+ strncpy(ren_entry->old_name, old_name, old_len); -+ ren_entry->old_len = old_len; -+ strncpy(ren_entry->new_name, new_name, new_len); -+ ren_entry->new_len = new_len; -+ -+ list_add(&ren_entry->list, &inode_info->renamed_list); -+ inode_info->renamed_list_size++; -+ return 0; -+} -+ -+ -+int meta_remove_r_entry(dentry_t *dentry, const char *name, int len) -+{ -+ int err = 0; -+ if(!dentry || !dentry->d_inode) { -+ printk(KERN_CRIT -+ "mini_fo: meta_remove_r_entry: \ -+ invalid dentry passed.\n"); -+ return -1; -+ } -+ -+ err = meta_list_remove_r_entry(dentry, name, len); -+ err |= meta_sync_lists(dentry); -+ return err; -+} -+ -+int meta_list_remove_r_entry(dentry_t *dentry, const char *name, int len) -+{ -+ if(!dentry || !dentry->d_inode) { -+ printk(KERN_CRIT -+ "mini_fo: meta_list_remove_r_entry: \ -+ invalid dentry passed.\n"); -+ return -1; -+ } -+ return __meta_list_remove_r_entry(dentry->d_inode, name, len); -+} -+ -+int __meta_list_remove_r_entry(inode_t *inode, const char *name, int len) -+{ -+ struct list_head *tmp; -+ struct renamed_entry *ren_entry; -+ struct mini_fo_inode_info *inode_info; -+ -+ if(!inode || !itopd(inode)) -+ printk(KERN_CRIT -+ "mini_fo: __meta_list_remove_r_entry: \ -+ invalid inode passed.\n"); -+ inode_info = itopd(inode); -+ -+ if(inode_info->renamed_list_size < 0) -+ return -1; -+ if(inode_info->renamed_list_size == 0) -+ return 1; -+ -+ list_for_each(tmp, &inode_info->renamed_list) { -+ ren_entry = list_entry(tmp, struct renamed_entry, list); -+ if(ren_entry->new_len != len) -+ continue; -+ -+ if(!strncmp(ren_entry->new_name, name, len)) { -+ list_del(tmp); -+ kfree(ren_entry->new_name); -+ kfree(ren_entry->old_name); -+ kfree(ren_entry); -+ inode_info->renamed_list_size--; -+ return 0; -+ } -+ } -+ return 1; -+} -+ -+ -+/* append a single D entry to the meta file */ -+int meta_write_d_entry(dentry_t *dentry, const char *name, int len) -+{ -+ dentry_t *meta_dentry = 0; -+ file_t *meta_file = 0; -+ mm_segment_t old_fs; -+ -+ int bytes, err; -+ struct vfsmount *meta_mnt = 0; -+ char *buf; -+ -+ err = 0; -+ -+ if(itopd(dentry->d_inode)->deleted_list_size < 0) { -+ err = -1; -+ goto out; -+ } -+ -+ if(dtopd(dentry)->state == UNMODIFIED) { -+ err = build_sto_structure(dentry->d_parent, dentry); -+ if(err) { -+ printk(KERN_CRIT "mini_fo: meta_write_d_entry: \ -+ build_sto_structure failed.\n"); -+ goto out; -+ } -+ } -+ meta_dentry = lookup_one_len(META_FILENAME, -+ dtohd2(dentry), strlen (META_FILENAME)); -+ -+ /* We need to create a META-file */ -+ if(!meta_dentry->d_inode) { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+ vfs_create(dtohd2(dentry)->d_inode, -+ meta_dentry, -+ S_IRUSR | S_IWUSR, -+ NULL); -+#else -+ vfs_create(dtohd2(dentry)->d_inode, -+ meta_dentry, -+ S_IRUSR | S_IWUSR); -+#endif -+ } -+ /* open META-file for writing */ -+ meta_file = dentry_open(meta_dentry, meta_mnt, 0x1); -+ if(!meta_file || IS_ERR(meta_file)) { -+ printk(KERN_CRIT "mini_fo: meta_write_d_entry: \ -+ ERROR opening meta file.\n"); -+ mntput(meta_mnt); /* $%& is this necessary? */ -+ dput(meta_dentry); -+ err = -1; -+ goto out; -+ } -+ -+ /* check if fs supports writing */ -+ if(!meta_file->f_op->write) { -+ printk(KERN_CRIT "mini_fo: meta_write_d_entry: \ -+ ERROR, fs does not support writing.\n"); -+ goto out_err_close; -+ } -+ -+ meta_file->f_pos = meta_dentry->d_inode->i_size; /* append */ -+ old_fs = get_fs(); -+ set_fs(KERNEL_DS); -+ -+ /* size: len for name, 1 for \n and 2 for "D " */ -+ buf = (char *) kmalloc(len+3, GFP_KERNEL); -+ if (!buf) { -+ printk(KERN_CRIT "mini_fo: meta_write_d_entry: \ -+ out of mem.\n"); -+ return -ENOMEM; -+ } -+ -+ buf[0] = 'D'; -+ buf[1] = ' '; -+ strncpy(buf+2, name, len); -+ buf[len+2] = '\n'; -+ bytes = meta_file->f_op->write(meta_file, buf, len+3, -+ &meta_file->f_pos); -+ if(bytes != len+3) { -+ printk(KERN_CRIT "mini_fo: meta_write_d_entry: \ -+ ERROR writing.\n"); -+ err = -1; -+ } -+ kfree(buf); -+ set_fs(old_fs); -+ -+ out_err_close: -+ fput(meta_file); -+ out: -+ return err; -+} -+ -+/* append a single R entry to the meta file */ -+int meta_write_r_entry(dentry_t *dentry, -+ const char *old_name, int old_len, -+ const char *new_name, int new_len) -+{ -+ dentry_t *meta_dentry = 0; -+ file_t *meta_file = 0; -+ mm_segment_t old_fs; -+ -+ int bytes, err, buf_len; -+ struct vfsmount *meta_mnt = 0; -+ char *buf; -+ -+ -+ err = 0; -+ -+ if(itopd(dentry->d_inode)->renamed_list_size < 0) { -+ err = -1; -+ goto out; -+ } -+ -+ /* build the storage structure? */ -+ if(dtopd(dentry)->state == UNMODIFIED) { -+ err = build_sto_structure(dentry->d_parent, dentry); -+ if(err) { -+ printk(KERN_CRIT "mini_fo: meta_write_r_entry: \ -+ build_sto_structure failed.\n"); -+ goto out; -+ } -+ } -+ meta_dentry = lookup_one_len(META_FILENAME, -+ dtohd2(dentry), -+ strlen (META_FILENAME)); -+ if(!meta_dentry->d_inode) { -+ /* We need to create a META-file */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+ vfs_create(dtohd2(dentry)->d_inode, -+ meta_dentry, S_IRUSR | S_IWUSR, NULL); -+#else -+ vfs_create(dtohd2(dentry)->d_inode, -+ meta_dentry, S_IRUSR | S_IWUSR); -+#endif -+ } -+ /* open META-file for writing */ -+ meta_file = dentry_open(meta_dentry, meta_mnt, 0x1); -+ if(!meta_file || IS_ERR(meta_file)) { -+ printk(KERN_CRIT "mini_fo: meta_write_r_entry: \ -+ ERROR opening meta file.\n"); -+ mntput(meta_mnt); -+ dput(meta_dentry); -+ err = -1; -+ goto out; -+ } -+ -+ /* check if fs supports writing */ -+ if(!meta_file->f_op->write) { -+ printk(KERN_CRIT "mini_fo: meta_write_r_entry: \ -+ ERROR, fs does not support writing.\n"); -+ goto out_err_close; -+ } -+ -+ meta_file->f_pos = meta_dentry->d_inode->i_size; /* append */ -+ old_fs = get_fs(); -+ set_fs(KERNEL_DS); -+ -+ /* size: 2 for "R ", old_len+new_len for names, 1 blank+1 \n */ -+ buf_len = old_len + new_len + 4; -+ buf = (char *) kmalloc(buf_len, GFP_KERNEL); -+ if (!buf) { -+ printk(KERN_CRIT "mini_fo: meta_write_r_entry: out of mem.\n"); -+ return -ENOMEM; -+ } -+ -+ buf[0] = 'R'; -+ buf[1] = ' '; -+ strncpy(buf + 2, old_name, old_len); -+ buf[old_len + 2] = ' '; -+ strncpy(buf + old_len + 3, new_name, new_len); -+ buf[buf_len -1] = '\n'; -+ bytes = meta_file->f_op->write(meta_file, buf, buf_len, &meta_file->f_pos); -+ if(bytes != buf_len) { -+ printk(KERN_CRIT "mini_fo: meta_write_r_entry: ERROR writing.\n"); -+ err = -1; -+ } -+ -+ kfree(buf); -+ set_fs(old_fs); -+ -+ out_err_close: -+ fput(meta_file); -+ out: -+ return err; -+} -+ -+/* sync D list to disk, append data if app_flag is 1 */ -+/* check the meta_mnt, which seems not to be used (properly) */ -+ -+int meta_sync_d_list(dentry_t *dentry, int app_flag) -+{ -+ dentry_t *meta_dentry; -+ file_t *meta_file; -+ mm_segment_t old_fs; -+ -+ int bytes, err; -+ struct vfsmount *meta_mnt; -+ char *buf; -+ -+ struct list_head *tmp; -+ struct deleted_entry *del_entry; -+ struct mini_fo_inode_info *inode_info; -+ -+ err = 0; -+ meta_file=0; -+ meta_mnt=0; -+ -+ if(!dentry || !dentry->d_inode) { -+ printk(KERN_CRIT "mini_fo: meta_sync_d_list: \ -+ invalid inode passed.\n"); -+ err = -1; -+ goto out; -+ } -+ inode_info = itopd(dentry->d_inode); -+ -+ if(inode_info->deleted_list_size < 0) { -+ err = -1; -+ goto out; -+ } -+ -+ /* ok, there is something to sync */ -+ -+ /* build the storage structure? */ -+ if(!dtohd2(dentry) && !itohi2(dentry->d_inode)) { -+ err = build_sto_structure(dentry->d_parent, dentry); -+ if(err) { -+ printk(KERN_CRIT "mini_fo: meta_sync_d_list: \ -+ build_sto_structure failed.\n"); -+ goto out; -+ } -+ } -+ meta_dentry = lookup_one_len(META_FILENAME, -+ dtohd2(dentry), -+ strlen(META_FILENAME)); -+ if(!meta_dentry->d_inode) { -+ /* We need to create a META-file */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+ vfs_create(dtohd2(dentry)->d_inode, -+ meta_dentry, S_IRUSR | S_IWUSR, NULL); -+#else -+ vfs_create(dtohd2(dentry)->d_inode, -+ meta_dentry, S_IRUSR | S_IWUSR); -+#endif -+ app_flag = 0; -+ } -+ /* need we truncate the meta file? */ -+ if(!app_flag) { -+ struct iattr newattrs; -+ newattrs.ia_size = 0; -+ newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&meta_dentry->d_inode->i_mutex); -+#else -+ down(&meta_dentry->d_inode->i_sem); -+#endif -+ err = notify_change(meta_dentry, &newattrs); -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&meta_dentry->d_inode->i_mutex); -+#else -+ up(&meta_dentry->d_inode->i_sem); -+#endif -+ -+ if(err || meta_dentry->d_inode->i_size != 0) { -+ printk(KERN_CRIT "mini_fo: meta_sync_d_list: \ -+ ERROR truncating meta file.\n"); -+ goto out_err_close; -+ } -+ } -+ -+ /* open META-file for writing */ -+ meta_file = dentry_open(meta_dentry, meta_mnt, 0x1); -+ if(!meta_file || IS_ERR(meta_file)) { -+ printk(KERN_CRIT "mini_fo: meta_sync_d_list: \ -+ ERROR opening meta file.\n"); -+ /* we don't mntget so we dont't mntput (for now) -+ * mntput(meta_mnt); -+ */ -+ dput(meta_dentry); -+ err = -1; -+ goto out; -+ } -+ -+ /* check if fs supports writing */ -+ if(!meta_file->f_op->write) { -+ printk(KERN_CRIT "mini_fo: meta_sync_d_list: \ -+ ERROR, fs does not support writing.\n"); -+ goto out_err_close; -+ } -+ -+ meta_file->f_pos = meta_dentry->d_inode->i_size; /* append */ -+ old_fs = get_fs(); -+ set_fs(KERNEL_DS); -+ -+ /* here we go... */ -+ list_for_each(tmp, &inode_info->deleted_list) { -+ del_entry = list_entry(tmp, struct deleted_entry, list); -+ -+ /* size: len for name, 1 for \n and 2 for "D " */ -+ buf = (char *) kmalloc(del_entry->len+3, GFP_KERNEL); -+ if (!buf) { -+ printk(KERN_CRIT "mini_fo: meta_sync_d_list: \ -+ out of mem.\n"); -+ return -ENOMEM; -+ } -+ -+ buf[0] = 'D'; -+ buf[1] = ' '; -+ strncpy(buf+2, del_entry->name, del_entry->len); -+ buf[del_entry->len+2] = '\n'; -+ bytes = meta_file->f_op->write(meta_file, buf, -+ del_entry->len+3, -+ &meta_file->f_pos); -+ if(bytes != del_entry->len+3) { -+ printk(KERN_CRIT "mini_fo: meta_sync_d_list: \ -+ ERROR writing.\n"); -+ err |= -1; -+ } -+ kfree(buf); -+ } -+ set_fs(old_fs); -+ -+ out_err_close: -+ fput(meta_file); -+ out: -+ return err; -+ -+} -+ -+int meta_sync_r_list(dentry_t *dentry, int app_flag) -+{ -+ dentry_t *meta_dentry; -+ file_t *meta_file; -+ mm_segment_t old_fs; -+ -+ int bytes, err, buf_len; -+ struct vfsmount *meta_mnt; -+ char *buf; -+ -+ struct list_head *tmp; -+ struct renamed_entry *ren_entry; -+ struct mini_fo_inode_info *inode_info; -+ -+ err = 0; -+ meta_file=0; -+ meta_mnt=0; -+ -+ if(!dentry || !dentry->d_inode) { -+ printk(KERN_CRIT "mini_fo: meta_sync_r_list: \ -+ invalid dentry passed.\n"); -+ err = -1; -+ goto out; -+ } -+ inode_info = itopd(dentry->d_inode); -+ -+ if(inode_info->deleted_list_size < 0) { -+ err = -1; -+ goto out; -+ } -+ -+ /* ok, there is something to sync */ -+ -+ /* build the storage structure? */ -+ if(!dtohd2(dentry) && !itohi2(dentry->d_inode)) { -+ err = build_sto_structure(dentry->d_parent, dentry); -+ if(err) { -+ printk(KERN_CRIT "mini_fo: meta_sync_r_list: \ -+ build_sto_structure failed.\n"); -+ goto out; -+ } -+ } -+ meta_dentry = lookup_one_len(META_FILENAME, -+ dtohd2(dentry), -+ strlen(META_FILENAME)); -+ if(!meta_dentry->d_inode) { -+ /* We need to create a META-file */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+ vfs_create(dtohd2(dentry)->d_inode, -+ meta_dentry, S_IRUSR | S_IWUSR, NULL); -+#else -+ vfs_create(dtohd2(dentry)->d_inode, -+ meta_dentry, S_IRUSR | S_IWUSR); -+#endif -+ app_flag = 0; -+ } -+ /* need we truncate the meta file? */ -+ if(!app_flag) { -+ struct iattr newattrs; -+ newattrs.ia_size = 0; -+ newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&meta_dentry->d_inode->i_mutex); -+#else -+ down(&meta_dentry->d_inode->i_sem); -+#endif -+ err = notify_change(meta_dentry, &newattrs); -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&meta_dentry->d_inode->i_mutex); -+#else -+ up(&meta_dentry->d_inode->i_sem); -+#endif -+ if(err || meta_dentry->d_inode->i_size != 0) { -+ printk(KERN_CRIT "mini_fo: meta_sync_r_list: \ -+ ERROR truncating meta file.\n"); -+ goto out_err_close; -+ } -+ } -+ -+ /* open META-file for writing */ -+ meta_file = dentry_open(meta_dentry, meta_mnt, 0x1); -+ if(!meta_file || IS_ERR(meta_file)) { -+ printk(KERN_CRIT "mini_fo: meta_sync_r_list: \ -+ ERROR opening meta file.\n"); -+ /* we don't mntget so we dont't mntput (for now) -+ * mntput(meta_mnt); -+ */ -+ dput(meta_dentry); -+ err = -1; -+ goto out; -+ } -+ -+ /* check if fs supports writing */ -+ if(!meta_file->f_op->write) { -+ printk(KERN_CRIT "mini_fo: meta_sync_r_list: \ -+ ERROR, fs does not support writing.\n"); -+ goto out_err_close; -+ } -+ -+ meta_file->f_pos = meta_dentry->d_inode->i_size; /* append */ -+ old_fs = get_fs(); -+ set_fs(KERNEL_DS); -+ -+ /* here we go... */ -+ list_for_each(tmp, &inode_info->renamed_list) { -+ ren_entry = list_entry(tmp, struct renamed_entry, list); -+ /* size: -+ * 2 for "R ", old_len+new_len for names, 1 blank+1 \n */ -+ buf_len = ren_entry->old_len + ren_entry->new_len + 4; -+ buf = (char *) kmalloc(buf_len, GFP_KERNEL); -+ if (!buf) { -+ printk(KERN_CRIT "mini_fo: meta_sync_r_list: \ -+ out of mem.\n"); -+ return -ENOMEM; -+ } -+ buf[0] = 'R'; -+ buf[1] = ' '; -+ strncpy(buf + 2, ren_entry->old_name, ren_entry->old_len); -+ buf[ren_entry->old_len + 2] = ' '; -+ strncpy(buf + ren_entry->old_len + 3, -+ ren_entry->new_name, ren_entry->new_len); -+ buf[buf_len - 1] = '\n'; -+ bytes = meta_file->f_op->write(meta_file, buf, -+ buf_len, &meta_file->f_pos); -+ if(bytes != buf_len) { -+ printk(KERN_CRIT "mini_fo: meta_sync_r_list: \ -+ ERROR writing.\n"); -+ err |= -1; -+ } -+ kfree(buf); -+ } -+ set_fs(old_fs); -+ -+ out_err_close: -+ fput(meta_file); -+ out: -+ return err; -+} -+ -+int meta_check_d_entry(dentry_t *dentry, const char *name, int len) -+{ -+ if(!dentry || !dentry->d_inode) -+ printk(KERN_CRIT "mini_fo: meta_check_d_dentry: \ -+ invalid dentry passed.\n"); -+ return __meta_check_d_entry(dentry->d_inode, name, len); -+} -+ -+int __meta_check_d_entry(inode_t *inode, const char *name, int len) -+{ -+ struct list_head *tmp; -+ struct deleted_entry *del_entry; -+ struct mini_fo_inode_info *inode_info; -+ -+ if(!inode || !itopd(inode)) -+ printk(KERN_CRIT "mini_fo: __meta_check_d_dentry: \ -+ invalid inode passed.\n"); -+ -+ inode_info = itopd(inode); -+ -+ if(inode_info->deleted_list_size <= 0) -+ return 0; -+ -+ list_for_each(tmp, &inode_info->deleted_list) { -+ del_entry = list_entry(tmp, struct deleted_entry, list); -+ if(del_entry->len != len) -+ continue; -+ -+ if(!strncmp(del_entry->name, name, len)) -+ return 1; -+ } -+ return 0; -+} -+ -+/* -+ * check if file has been renamed and return path to orig. base dir. -+ * Implements no error return values so far, what of course sucks. -+ * String is null terminated.' -+ */ -+char* meta_check_r_entry(dentry_t *dentry, const char *name, int len) -+{ -+ if(!dentry || !dentry->d_inode) { -+ printk(KERN_CRIT "mini_fo: meta_check_r_dentry: \ -+ invalid dentry passed.\n"); -+ return NULL; -+ } -+ return __meta_check_r_entry(dentry->d_inode, name, len); -+} -+ -+char* __meta_check_r_entry(inode_t *inode, const char *name, int len) -+{ -+ struct list_head *tmp; -+ struct renamed_entry *ren_entry; -+ struct mini_fo_inode_info *inode_info; -+ char *old_path; -+ -+ if(!inode || !itopd(inode)) { -+ printk(KERN_CRIT "mini_fo: meta_check_r_dentry: \ -+ invalid inode passed.\n"); -+ return NULL; -+ } -+ inode_info = itopd(inode); -+ -+ if(inode_info->renamed_list_size <= 0) -+ return NULL; -+ -+ list_for_each(tmp, &inode_info->renamed_list) { -+ ren_entry = list_entry(tmp, struct renamed_entry, list); -+ if(ren_entry->new_len != len) -+ continue; -+ -+ if(!strncmp(ren_entry->new_name, name, len)) { -+ old_path = (char *) -+ kmalloc(ren_entry->old_len+1, GFP_KERNEL); -+ strncpy(old_path, -+ ren_entry->old_name, -+ ren_entry->old_len); -+ old_path[ren_entry->old_len]='\0'; -+ return old_path; -+ } -+ } -+ return NULL; -+} -+ -+/* -+ * This version only checks if entry exists and return: -+ * 1 if exists, -+ * 0 if not, -+ * -1 if error. -+ */ -+int meta_is_r_entry(dentry_t *dentry, const char *name, int len) -+{ -+ if(!dentry || !dentry->d_inode) { -+ printk(KERN_CRIT "mini_fo: meta_check_r_dentry [2]: \ -+ invalid dentry passed.\n"); -+ return -1; -+ } -+ return __meta_is_r_entry(dentry->d_inode, name, len); -+} -+ -+int __meta_is_r_entry(inode_t *inode, const char *name, int len) -+{ -+ struct list_head *tmp; -+ struct renamed_entry *ren_entry; -+ struct mini_fo_inode_info *inode_info; -+ -+ if(!inode || !itopd(inode)) { -+ printk(KERN_CRIT "mini_fo: meta_check_r_dentry [2]: \ -+ invalid inode passed.\n"); -+ return -1; -+ } -+ inode_info = itopd(inode); -+ -+ if(inode_info->renamed_list_size <= 0) -+ return -1; -+ -+ list_for_each(tmp, &inode_info->renamed_list) { -+ ren_entry = list_entry(tmp, struct renamed_entry, list); -+ if(ren_entry->new_len != len) -+ continue; -+ -+ if(!strncmp(ren_entry->new_name, name, len)) -+ return 1; -+ } -+ return 0; -+} -+ ---- /dev/null -+++ b/fs/mini_fo/mini_fo.h -@@ -0,0 +1,510 @@ -+/* -+ * Copyright (c) 1997-2003 Erez Zadok -+ * Copyright (c) 2001-2003 Stony Brook University -+ * -+ * For specific licensing information, see the COPYING file distributed with -+ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING. -+ * -+ * This Copyright notice must be kept intact and distributed with all -+ * fistgen sources INCLUDING sources generated by fistgen. -+ */ -+/* -+ * Copyright (C) 2004, 2005 Markus Klotzbuecher -+ * -+ * 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 of the License, or (at your option) any later version. -+ */ -+ -+/* -+ * $Id$ -+ */ -+ -+#ifndef __MINI_FO_H_ -+#define __MINI_FO_H_ -+ -+#ifdef __KERNEL__ -+ -+/* META stuff */ -+#define META_FILENAME "META_dAfFgHE39ktF3HD2sr" -+ -+/* use xattrs? */ -+#define XATTR -+ -+/* File attributes that when changed, result in a file beeing copied to storage */ -+#define COPY_FLAGS ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_SIZE -+ -+/* -+ * mini_fo filestates -+ */ -+#define MODIFIED 1 -+#define UNMODIFIED 2 -+#define CREATED 3 -+#define DEL_REWRITTEN 4 -+#define DELETED 5 -+#define NON_EXISTANT 6 -+ -+/* fist file systems superblock magic */ -+# define MINI_FO_SUPER_MAGIC 0xf15f -+ -+/* -+ * STRUCTURES: -+ */ -+ -+/* mini_fo inode data in memory */ -+struct mini_fo_inode_info { -+ inode_t *wii_inode; -+ inode_t *wii_inode2; /* pointer to storage inode */ -+ -+ /* META-data lists */ -+ /* deleted list, ex wol */ -+ struct list_head deleted_list; -+ int deleted_list_size; -+ -+ /* renamed list */ -+ struct list_head renamed_list; -+ int renamed_list_size; -+ -+ /* add other lists here ... */ -+}; -+ -+/* mini_fo dentry data in memory */ -+struct mini_fo_dentry_info { -+ dentry_t *wdi_dentry; -+ dentry_t *wdi_dentry2; /* pointer to storage dentry */ -+ unsigned int state; /* state of the mini_fo dentry */ -+}; -+ -+ -+/* mini_fo super-block data in memory */ -+struct mini_fo_sb_info { -+ super_block_t *wsi_sb, *wsi_sb2; /* mk: might point to the same sb */ -+ struct vfsmount *hidden_mnt, *hidden_mnt2; -+ dentry_t *base_dir_dentry; -+ dentry_t *storage_dir_dentry; -+ ; -+}; -+ -+/* readdir_data, readdir helper struct */ -+struct readdir_data { -+ struct list_head ndl_list; /* linked list head ptr */ -+ int ndl_size; /* list size */ -+ int sto_done; /* flag to show that the storage dir entries have -+ * all been read an now follow base entries */ -+}; -+ -+/* file private data. */ -+struct mini_fo_file_info { -+ struct file *wfi_file; -+ struct file *wfi_file2; /* pointer to storage file */ -+ struct readdir_data rd; -+}; -+ -+/* struct ndl_entry */ -+struct ndl_entry { -+ struct list_head list; -+ char *name; -+ int len; -+}; -+ -+/******************************** -+ * META-data structures -+ ********************************/ -+ -+/* deleted entry */ -+struct deleted_entry { -+ struct list_head list; -+ char *name; -+ int len; -+}; -+ -+/* renamed entry */ -+struct renamed_entry { -+ struct list_head list; -+ char *old_name; /* old directory with full path */ -+ int old_len; /* length of above string */ -+ char *new_name; /* new directory name */ -+ int new_len; /* length of above string */ -+}; -+ -+/* attr_change entry */ -+struct attr_change_entry { -+ struct list_head list; -+ char *name; -+ int len; -+}; -+ -+/* link entry */ -+struct link_entry { -+ struct list_head list; -+ int links_moved; -+ int inum_base; -+ int inum_sto; -+ char *weird_name; -+ int weird_name_len; -+}; -+ -+ -+/* Some other stuff required for mini_fo_filldir64, copied from -+ * fs/readdir.c -+ */ -+ -+#define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1)) -+#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de))) -+ -+ -+struct linux_dirent64 { -+ u64 d_ino; -+ s64 d_off; -+ unsigned short d_reclen; -+ unsigned char d_type; -+ char d_name[0]; -+}; -+ -+ -+struct getdents_callback64 { -+ struct linux_dirent64 * current_dir; -+ struct linux_dirent64 * previous; -+ int count; -+ int error; -+}; -+ -+struct linux_dirent { -+ unsigned long d_ino; -+ unsigned long d_off; -+ unsigned short d_reclen; -+ char d_name[1]; -+}; -+ -+struct getdents_callback { -+ struct linux_dirent * current_dir; -+ struct linux_dirent * previous; -+ int count; -+ int error; -+}; -+ -+ -+/* -+ * MACROS: -+ */ -+ -+/* file TO private_data */ -+# define ftopd(file) ((struct mini_fo_file_info *)((file)->private_data)) -+# define __ftopd(file) ((file)->private_data) -+/* file TO hidden_file */ -+# define ftohf(file) ((ftopd(file))->wfi_file) -+# define ftohf2(file) ((ftopd(file))->wfi_file2) -+ -+/* inode TO private_data */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) -+# define itopd(ino) ((struct mini_fo_inode_info *)(ino)->i_private) -+# define __itopd(ino) ((ino)->i_private) -+#else -+# define itopd(ino) ((struct mini_fo_inode_info *)(ino)->u.generic_ip) -+# define __itopd(ino) ((ino)->u.generic_ip) -+#endif -+/* inode TO hidden_inode */ -+# define itohi(ino) (itopd(ino)->wii_inode) -+# define itohi2(ino) (itopd(ino)->wii_inode2) -+ -+/* superblock TO private_data */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+# define stopd(super) ((struct mini_fo_sb_info *)(super)->s_fs_info) -+# define __stopd(super) ((super)->s_fs_info) -+#else -+# define stopd(super) ((struct mini_fo_sb_info *)(super)->u.generic_sbp) -+# define __stopd(super) ((super)->u.generic_sbp) -+#endif -+ -+/* unused? # define vfs2priv stopd */ -+/* superblock TO hidden_superblock */ -+ -+# define stohs(super) (stopd(super)->wsi_sb) -+# define stohs2(super) (stopd(super)->wsi_sb2) -+ -+/* dentry TO private_data */ -+# define dtopd(dentry) ((struct mini_fo_dentry_info *)(dentry)->d_fsdata) -+# define __dtopd(dentry) ((dentry)->d_fsdata) -+/* dentry TO hidden_dentry */ -+# define dtohd(dent) (dtopd(dent)->wdi_dentry) -+# define dtohd2(dent) (dtopd(dent)->wdi_dentry2) -+ -+/* dentry to state */ -+# define dtost(dent) (dtopd(dent)->state) -+# define sbt(sb) ((sb)->s_type->name) -+ -+#define IS_WRITE_FLAG(flag) (flag & (O_RDWR | O_WRONLY | O_APPEND)) -+#define IS_COPY_FLAG(flag) (flag & (COPY_FLAGS)) -+ -+/* macros to simplify non-SCA code */ -+# define MALLOC_PAGE_POINTERS(hidden_pages, num_hidden_pages) -+# define MALLOC_PAGEDATA_POINTERS(hidden_pages_data, num_hidden_pages) -+# define FREE_PAGE_POINTERS(hidden_pages, num) -+# define FREE_PAGEDATA_POINTERS(hidden_pages_data, num) -+# define FOR_EACH_PAGE -+# define CURRENT_HIDDEN_PAGE hidden_page -+# define CURRENT_HIDDEN_PAGEDATA hidden_page_data -+# define CURRENT_HIDDEN_PAGEINDEX page->index -+ -+/* -+ * EXTERNALS: -+ */ -+extern struct file_operations mini_fo_main_fops; -+extern struct file_operations mini_fo_dir_fops; -+extern struct inode_operations mini_fo_main_iops; -+extern struct inode_operations mini_fo_dir_iops; -+extern struct inode_operations mini_fo_symlink_iops; -+extern struct super_operations mini_fo_sops; -+extern struct dentry_operations mini_fo_dops; -+extern struct vm_operations_struct mini_fo_shared_vmops; -+extern struct vm_operations_struct mini_fo_private_vmops; -+extern struct address_space_operations mini_fo_aops; -+ -+#if 0 /* unused by mini_fo */ -+extern int mini_fo_interpose(dentry_t *hidden_dentry, dentry_t *this_dentry, super_block_t *sb, int flag); -+#if defined(FIST_FILTER_DATA) || defined(FIST_FILTER_SCA) -+extern page_t *mini_fo_get1page(file_t *file, int index); -+extern int mini_fo_fill_zeros(file_t *file, page_t *page, unsigned from); -+# endif /* FIST_FILTER_DATA || FIST_FILTER_SCA */ -+ -+ -+# define mini_fo_hidden_dentry(d) __mini_fo_hidden_dentry(__FILE__,__FUNCTION__,__LINE__,(d)) -+# define mini_fo_hidden_sto_dentry(d) __mini_fo_hidden_sto_dentry(__FILE__,__FUNCTION__,__LINE__,(d)) -+ -+extern dentry_t *__mini_fo_hidden_dentry(char *file, char *func, int line, dentry_t *this_dentry); -+extern dentry_t *__mini_fo_hidden_sto_dentry(char *file, char *func, int line, dentry_t *this_dentry); -+ -+extern int mini_fo_read_file(const char *filename, void *buf, int len); -+extern int mini_fo_write_file(const char *filename, void *buf, int len); -+extern dentry_t *fist_lookup(dentry_t *dir, const char *name, vnode_t **out, uid_t uid, gid_t gid); -+#endif /* unused by mini_fo */ -+ -+/* state transition functions */ -+extern int nondir_unmod_to_mod(dentry_t *dentry, int cp_flag); -+extern int nondir_del_rew_to_del(dentry_t *dentry); -+extern int nondir_creat_to_del(dentry_t *dentry); -+extern int nondir_mod_to_del(dentry_t *dentry); -+extern int nondir_unmod_to_del(dentry_t *dentry); -+ -+extern int dir_unmod_to_mod(dentry_t *dentry); -+ -+/* rename specials */ -+extern int rename_directory(inode_t *old_dir, dentry_t *old_dentry, inode_t *new_dir, dentry_t *new_dentry); -+extern int rename_nondir(inode_t *old_dir, dentry_t *old_dentry, inode_t *new_dir, dentry_t *new_dentry); -+ -+/* misc stuff */ -+extern int mini_fo_tri_interpose(dentry_t *hidden_dentry, -+ dentry_t *hidden_sto_dentry, -+ dentry_t *dentry, -+ super_block_t *sb, int flag); -+ -+extern int mini_fo_cp_cont(dentry_t *tgt_dentry, struct vfsmount *tgt_mnt, -+ dentry_t *src_dentry, struct vfsmount *src_mnt); -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+extern int mini_fo_create(inode_t *dir, dentry_t *dentry, int mode, struct nameidata *nd); -+ -+extern int create_sto_nod(dentry_t *dentry, int mode, dev_t dev); -+extern int create_sto_reg_file(dentry_t *dentry, int mode, struct nameidata *nd); -+#else -+extern int mini_fo_create(inode_t *dir, dentry_t *dentry, int mode); -+ -+extern int create_sto_nod(dentry_t *dentry, int mode, int dev); -+extern int create_sto_reg_file(dentry_t *dentry, int mode); -+#endif -+ -+extern int create_sto_dir(dentry_t *dentry, int mode); -+ -+extern int exists_in_storage(dentry_t *dentry); -+extern int is_mini_fo_existant(dentry_t *dentry); -+extern int get_neg_sto_dentry(dentry_t *dentry); -+extern int build_sto_structure(dentry_t *dir, dentry_t *dentry); -+extern int get_mini_fo_bpath(dentry_t *dentry, char **bpath, int *bpath_len); -+extern dentry_t *bpath_walk(super_block_t *sb, char *bpath); -+extern int bpath_put(dentry_t *dentry); -+ -+/* check_mini_fo types functions */ -+extern int check_mini_fo_dentry(dentry_t *dentry); -+extern int check_mini_fo_file(file_t *file); -+extern int check_mini_fo_inode(inode_t *inode); -+ -+/* General meta functions, can be called from outside of meta.c */ -+extern int meta_build_lists(dentry_t *dentry); -+extern int meta_put_lists(dentry_t *dentry); -+extern int __meta_put_lists(inode_t *inode); -+ -+extern int meta_add_d_entry(dentry_t *dentry, const char *name, int len); -+extern int meta_add_r_entry(dentry_t *dentry, -+ const char *old_name, int old_len, -+ const char *new_name, int new_len); -+ -+extern int meta_remove_r_entry(dentry_t *dentry, const char *name, int len); -+ -+extern int meta_check_d_entry(dentry_t *dentry, const char *name, int len); -+extern int __meta_check_d_entry(inode_t *inode, const char *name, int len); -+ -+extern char* meta_check_r_entry(dentry_t *dentry, const char *name, int len); -+extern char* __meta_check_r_entry(inode_t *inode, const char *name, int len); -+extern int meta_is_r_entry(dentry_t *dentry, const char *name, int len); -+extern int __meta_is_r_entry(inode_t *inode, const char *name, int len); -+ -+/* Specific meta functions, should be called only inside meta.c */ -+extern int __meta_put_d_list(inode_t *inode); -+extern int __meta_put_r_list(inode_t *inode); -+ -+extern int meta_list_add_d_entry(dentry_t *dentry, -+ const char *name, int len); -+extern int meta_list_add_r_entry(dentry_t *dentry, -+ const char *old_name, int old_len, -+ const char *new_name, int new_len); -+ -+extern int meta_list_remove_r_entry(dentry_t *dentry, -+ const char *name, int len); -+ -+extern int __meta_list_remove_r_entry(inode_t *inode, -+ const char *name, int len); -+ -+extern int meta_write_d_entry(dentry_t *dentry, const char *name, int len); -+extern int meta_write_r_entry(dentry_t *dentry, -+ const char *old_name, int old_len, -+ const char *new_name, int new_len); -+ -+extern int meta_sync_lists(dentry_t *dentry); -+extern int meta_sync_d_list(dentry_t *dentry, int app_flag); -+extern int meta_sync_r_list(dentry_t *dentry, int app_flag); -+ -+/* ndl stuff */ -+extern int ndl_add_entry(struct readdir_data *rd, const char *name, int len); -+extern void ndl_put_list(struct readdir_data *rd); -+extern int ndl_check_entry(struct readdir_data *rd, -+ const char *name, int len); -+ -+ -+# define copy_inode_size(dst, src) \ -+ dst->i_size = src->i_size; \ -+ dst->i_blocks = src->i_blocks; -+ -+static inline void -+fist_copy_attr_atime(inode_t *dest, const inode_t *src) -+{ -+ ASSERT(dest != NULL); -+ ASSERT(src != NULL); -+ dest->i_atime = src->i_atime; -+} -+static inline void -+fist_copy_attr_times(inode_t *dest, const inode_t *src) -+{ -+ ASSERT(dest != NULL); -+ ASSERT(src != NULL); -+ dest->i_atime = src->i_atime; -+ dest->i_mtime = src->i_mtime; -+ dest->i_ctime = src->i_ctime; -+} -+static inline void -+fist_copy_attr_timesizes(inode_t *dest, const inode_t *src) -+{ -+ ASSERT(dest != NULL); -+ ASSERT(src != NULL); -+ dest->i_atime = src->i_atime; -+ dest->i_mtime = src->i_mtime; -+ dest->i_ctime = src->i_ctime; -+ copy_inode_size(dest, src); -+} -+static inline void -+fist_copy_attr_all(inode_t *dest, const inode_t *src) -+{ -+ ASSERT(dest != NULL); -+ ASSERT(src != NULL); -+ dest->i_mode = src->i_mode; -+ dest->i_nlink = src->i_nlink; -+ dest->i_uid = src->i_uid; -+ dest->i_gid = src->i_gid; -+ dest->i_rdev = src->i_rdev; -+ dest->i_atime = src->i_atime; -+ dest->i_mtime = src->i_mtime; -+ dest->i_ctime = src->i_ctime; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -+ dest->i_blksize = src->i_blksize; -+#endif -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,12) -+ dest->i_blkbits = src->i_blkbits; -+# endif /* linux 2.4.12 and newer */ -+ copy_inode_size(dest, src); -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -+ dest->i_attr_flags = src->i_attr_flags; -+#else -+ dest->i_flags = src->i_flags; -+#endif -+} -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+/* copied from linux/fs.h */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+static inline void double_lock(struct dentry *d1, struct dentry *d2) -+{ -+ struct mutex *m1 = &d1->d_inode->i_mutex; -+ struct mutex *m2 = &d2->d_inode->i_mutex; -+ if (m1 != m2) { -+ if ((unsigned long) m1 < (unsigned long) m2) { -+ struct mutex *tmp = m2; -+ m2 = m1; m1 = tmp; -+ } -+ mutex_lock(m1); -+ } -+ mutex_lock(m2); -+} -+ -+static inline void double_unlock(struct dentry *d1, struct dentry *d2) -+{ -+ struct mutex *m1 = &d1->d_inode->i_mutex; -+ struct mutex *m2 = &d2->d_inode->i_mutex; -+ mutex_unlock(m1); -+ if (m1 != m2) -+ mutex_unlock(m2); -+ dput(d1); -+ dput(d2); -+} -+ -+#else -+static inline void double_down(struct semaphore *s1, struct semaphore *s2) -+{ -+ if (s1 != s2) { -+ if ((unsigned long) s1 < (unsigned long) s2) { -+ struct semaphore *tmp = s2; -+ s2 = s1; s1 = tmp; -+ } -+ down(s1); -+ } -+ down(s2); -+} -+ -+static inline void double_up(struct semaphore *s1, struct semaphore *s2) -+{ -+ up(s1); -+ if (s1 != s2) -+ up(s2); -+} -+ -+static inline void double_lock(struct dentry *d1, struct dentry *d2) -+{ -+ double_down(&d1->d_inode->i_sem, &d2->d_inode->i_sem); -+} -+ -+static inline void double_unlock(struct dentry *d1, struct dentry *d2) -+{ -+ double_up(&d1->d_inode->i_sem,&d2->d_inode->i_sem); -+ dput(d1); -+ dput(d2); -+} -+#endif /* if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) */ -+#endif /* if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */ -+#endif /* __KERNEL__ */ -+ -+/* -+ * Definitions for user and kernel code -+ */ -+ -+/* ioctls */ -+ -+#endif /* not __MINI_FO_H_ */ ---- /dev/null -+++ b/fs/mini_fo/mini_fo-merge -@@ -0,0 +1,180 @@ -+#!/bin/bash -+# -+# Copyright (C) 2005 Markus Klotzbuecher -+# 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 of the License, or (at your option) any later version. -+# -+ -+BASE= -+STO= -+HELP= -+DRYRUN= -+VERBOSE= -+TMP="/tmp/" -+META_NAME="META_dAfFgHE39ktF3HD2sr" -+SKIP_DEL_LIST="skip-delete-list.mini_fo-merge" -+ -+COMMAND= -+exec_command() -+{ -+ if [ x$DRYRUN == "xset" ]; then -+ echo " would run: $COMMAND" -+ elif ! [ x$DRYRUN == "xset" ]; then -+ if [ x$VERBOSE == "xset" ]; then -+ echo " running: $COMMAND" -+ fi -+ eval $COMMAND -+ fi -+} -+ -+usage() -+{ -+cat < -s -+Version 0.1 -+ -+This script merges the contents of a mini_fo storage file system back -+to the base file system. -+ -+!!! Warning: This will modify the base filesystem and can destroy data -+ if used wrongly. -+ -+Options: -+ -b -+ the directory of the base file system. -+ -+ -s -+ the directory of the storage file system. -+ -+ -d dry run, will not change anything and print the commands that -+ would be executed. -+ -+ -t tmp dir for storing temporary file. default: $TMP -+ -+ -v show what operations are performed. -+ -+ -h displays this message. -+ -+EOF -+} -+ -+# parse parameters -+while getopts hdvt:b:s: OPTS -+ do -+ case $OPTS in -+ h) HELP="set";; -+ d) DRYRUN="set";; -+ v) VERBOSE="set";; -+ b) BASE="$OPTARG";; -+ s) STO="$OPTARG";; -+ t) TMP="$OPTARG";; -+ ?) usage -+ exit 1;; -+ esac -+done -+ -+if [ "x$HELP" == "xset" ]; then -+ usage -+ exit -1 -+fi -+ -+if ! [ -d "$BASE" ] || ! [ -d "$STO" ]; then -+ echo -e "$0:\n Error, -s and/or -b argument missing. type $0 -h for help." -+ exit -1; -+fi -+ -+# get full paths -+pushd $STO; STO=`pwd`; popd -+pushd $BASE; BASE=`pwd`; popd -+TMP=${TMP%/} -+ -+ -+cat< /dev/null -+find . -name $META_NAME -type f -print0 | xargs -0 -e grep -e '^R ' | tr -s ':R' ' ' | while read ENTRY; do -+ echo "entry: $ENTRY" -+ META_FILE=`echo $ENTRY | cut -d ' ' -f 1` -+ OLD_B_DIR=`echo $ENTRY | cut -d ' ' -f 2 | sed -e 's/\///'` -+ NEW_NAME=`echo $ENTRY | cut -d ' ' -f 3` -+ NEW_B_DIR=`echo $META_FILE | sed -e "s/$META_NAME/$NEW_NAME/" | sed -e 's/^\.\///'` -+ echo "META_FILE: $META_FILE" -+ echo "OLD_B_DIR: $OLD_B_DIR" -+ echo "NEW_NAME: $NEW_NAME" -+ echo "NEW_B_DIR: $NEW_B_DIR" -+ -+ pushd $BASE &> /dev/null -+ # remove an existing dir in storage -+ COMMAND="rm -rf $NEW_B_DIR"; exec_command -+ COMMAND="cp -R $OLD_B_DIR $NEW_B_DIR"; exec_command -+ echo "" -+ popd &> /dev/null -+ -+ # remember this dir to exclude it from deleting later -+ echo $NEW_B_DIR >> $TMP/$SKIP_DEL_LIST -+done -+ -+# delete all whiteouted files from base -+echo -e "\nDeleting whiteout'ed files from base file system..." -+find . -name $META_NAME -type f -print0 | xargs -0 -e grep -e '^D ' | sed -e 's/:D//' | while read ENTRY; do -+ META_FILE=`echo $ENTRY | cut -d ' ' -f 1` -+ DEL_NAME=`echo $ENTRY | cut -d ' ' -f 2` -+ DEL_FILE=`echo $META_FILE | sed -e "s/$META_NAME/$DEL_NAME/" | sed -e 's/^\.\///'` -+ grep -x $DEL_FILE $TMP/$SKIP_DEL_LIST &> /dev/null -+ if [ $? -ne 0 ]; then -+ pushd $BASE &> /dev/null -+ COMMAND="rm -rf $DEL_FILE"; exec_command -+ popd &> /dev/null -+ else -+ echo " excluding: $DEL_FILE as in skip-del-list." -+ fi -+done -+ -+# create all dirs and update permissions -+echo -e "\nSetting up directory structures in base file system..." -+find . -type d | sed -e 's/^\.\///' | while read DIR; do -+ PERMS=`stat -c %a $DIR` -+ DIR_UID=`stat -c %u $DIR` -+ DIR_GID=`stat -c %g $DIR` -+ pushd $BASE &> /dev/null -+ if ! [ -d $DIR ]; then -+ COMMAND="mkdir -p $DIR"; exec_command -+ fi -+ COMMAND="chmod $PERMS $DIR"; exec_command -+ COMMAND="chown $DIR_UID:$DIR_GID $DIR"; exec_command -+ popd &> /dev/null -+done -+ -+# merge all non-directory files -+echo -e "\nMerging all non-directory files...." -+for i in b c p f l s; do -+ find . -type $i | sed -e 's/^\.\///' | grep -v "$META_NAME" | while read FILE; do -+ pushd $BASE #&> /dev/null -+ COMMAND="cp -df $STO/$FILE $BASE/$FILE"; exec_command -+ popd &> /dev/null -+ done -+done -+popd &> /dev/null -+ -+#rm $TMP/$SKIP_DEL_LIST -+ -+echo "Done!" ---- /dev/null -+++ b/fs/mini_fo/mini_fo-overlay -@@ -0,0 +1,130 @@ -+#!/bin/bash -+# -+# Copyright (C) 2005 Markus Klotzbuecher -+# 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 of the License, or (at your option) any later version. -+# -+ -+HELP= -+SUFF= -+MNTP= -+MNT_DIR="/mnt" -+STO= -+STO_DIR="/tmp" -+BASE= -+ -+usage() -+{ -+cat <" in $STO_DIR, -+and mount point "mini_fo-" in $MNT_DIR. -+ -+Options: -+ -s -+ add given suffix to storage directory and the mount -+ point. This is usefull for overlaying one base directory -+ several times and avoiding conflicts with storage directory -+ names and mount points. -+ -+ -d -+ change the directory in which the storage directory will be -+ created (default is currently "$STO_DIR". -+ -+ -m -+ use an alternative directory to create the mini_fo -+ mountpoint (default is currently "$MNT_DIR". -+ -+ -h displays this message. -+ -+EOF -+exit 1; -+} -+ -+while getopts hm:s:d: OPTS -+ do -+ case $OPTS in -+ s) SUFF="$OPTARG";; -+ d) STO_DIR="$OPTARG";; -+ m) MNT_DIR="$OPTARG";; -+ h) HELP="set";; -+ ?) usage -+ exit 1;; -+ esac -+done -+shift $(($OPTIND - 1)) -+ -+BASE="$1" -+ -+if [ "x$HELP" == "xset" ]; then -+ usage -+ exit -1 -+fi -+ -+# fix suffix -+if [ "x$SUFF" != "x" ]; then -+ SUFF="-$SUFF" -+fi -+ -+# kill trailing slashes -+MNT_DIR=${MNT_DIR%/} -+STO_DIR=${STO_DIR%/} -+BASE=${BASE%/} -+ -+ -+if ! [ -d "$BASE" ]; then -+ echo "invalid base dir $BASE, run $0 -h for help." -+ exit -1 -+fi -+ -+# check opts -+if ! [ -d "$MNT_DIR" ]; then -+ echo "invalid mount dir $MNT_DIR, run $0 -h for help." -+ exit -1 -+fi -+ -+if ! [ -d "$STO_DIR" ]; then -+ echo "invalid sto_dir_dir $STO_DIR, run $0 -h for help." -+ exit -1 -+fi -+ -+MNTP="$MNT_DIR/mini_fo-`basename $BASE`$SUFF" -+STO="$STO_DIR/sto-`basename $BASE`$SUFF" -+ -+# create the mount point if it doesn't exist -+mkdir -p $MNTP -+if [ $? -ne 0 ]; then -+ echo "Error, failed to create mount point $MNTP" -+fi -+ -+mkdir -p $STO -+if [ $? -ne 0 ]; then -+ echo "Error, failed to create storage dir $STO" -+fi -+ -+# check if fs is already mounted -+mount | grep mini_fo | grep $MNTP &> /dev/null -+if [ $? -eq 0 ]; then -+ echo "Error, existing mini_fo mount at $MNTP." -+ exit -1 -+fi -+ -+mount | grep mini_fo | grep $STO &> /dev/null -+if [ $? -eq 0 ]; then -+ echo "Error, $STO seems to be used already." -+ exit -1 -+fi -+ -+# mount -+mount -t mini_fo -o base=$BASE,sto=$STO $BASE $MNTP -+ -+if [ $? -ne 0 ]; then -+ echo "Error, mounting failed, maybe no permisson to mount?" -+fi ---- /dev/null -+++ b/fs/mini_fo/mmap.c -@@ -0,0 +1,637 @@ -+/* -+ * Copyright (c) 1997-2003 Erez Zadok -+ * Copyright (c) 2001-2003 Stony Brook University -+ * -+ * For specific licensing information, see the COPYING file distributed with -+ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING. -+ * -+ * This Copyright notice must be kept intact and distributed with all -+ * fistgen sources INCLUDING sources generated by fistgen. -+ */ -+/* -+ * Copyright (C) 2004, 2005 Markus Klotzbuecher -+ * -+ * 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 of the License, or (at your option) any later version. -+ */ -+ -+/* -+ * $Id$ -+ */ -+ -+#ifdef HAVE_CONFIG_H -+# include -+#endif /* HAVE_CONFIG_H */ -+ -+#include "fist.h" -+#include "mini_fo.h" -+ -+ -+#ifdef FIST_COUNT_WRITES -+/* for counting writes in the middle vs. regular writes */ -+unsigned long count_writes = 0, count_writes_middle = 0; -+#endif /* FIST_COUNT_WRITES */ -+ -+/* forward declaration of commit write and prepare write */ -+STATIC int mini_fo_commit_write(file_t *file, page_t *page, unsigned from, unsigned to); -+STATIC int mini_fo_prepare_write(file_t *file, page_t *page, unsigned from, unsigned to); -+ -+ -+/* -+ * Function for handling creation of holes when lseek-ing past the -+ * end of the file and then writing some data. -+ */ -+int -+mini_fo_fill_zeros(file_t* file, page_t *page, unsigned from) -+{ -+ int err = 0; -+ dentry_t *dentry = file->f_dentry; -+ inode_t *inode = dentry->d_inode; -+ page_t *tmp_page; -+ int index; -+ -+ print_entry_location(); -+ -+ for (index = inode->i_size >> PAGE_CACHE_SHIFT; index < page->index; index++) { -+ tmp_page = mini_fo_get1page(file, index); -+ if (IS_ERR(tmp_page)) { -+ err = PTR_ERR(tmp_page); -+ goto out; -+ } -+ -+ /* -+ * zero out rest of the contents of the page between the appropriate -+ * offsets. -+ */ -+ memset((char*)page_address(tmp_page) + (inode->i_size & ~PAGE_CACHE_MASK), 0, PAGE_CACHE_SIZE - (inode->i_size & ~PAGE_CACHE_MASK)); -+ -+ if (! (err = mini_fo_prepare_write(file, tmp_page, 0, PAGE_CACHE_SIZE))) -+ err = mini_fo_commit_write(file, tmp_page, 0, PAGE_CACHE_SIZE); -+ -+ page_cache_release(tmp_page); -+ if (err < 0) -+ goto out; -+ if (current->need_resched) -+ schedule(); -+ } -+ -+ /* zero out appropriate parts of last page */ -+ -+ /* -+ * if the encoding type is block, then adjust the 'from' (where the -+ * zeroing will start) offset appropriately -+ */ -+ from = from & (~(FIST_ENCODING_BLOCKSIZE - 1)); -+ -+ if ((from - (inode->i_size & ~PAGE_CACHE_MASK)) > 0) { -+ -+ memset((char*)page_address(page) + (inode->i_size & ~PAGE_CACHE_MASK), 0, from - (inode->i_size & ~PAGE_CACHE_MASK)); -+ if (! (err = mini_fo_prepare_write(file, page, 0, PAGE_CACHE_SIZE))) -+ err = mini_fo_commit_write(file, page, 0, PAGE_CACHE_SIZE); -+ -+ if (err < 0) -+ goto out; -+ if (current->need_resched) -+ schedule(); -+ } -+ -+ out: -+ print_exit_status(err); -+ return err; -+} -+ -+ -+ -+STATIC int -+mini_fo_writepage(page_t *page) -+{ -+ int err = -EIO; -+ inode_t *inode; -+ inode_t *hidden_inode; -+ page_t *hidden_page; -+ char *kaddr, *hidden_kaddr; -+ -+ print_entry_location(); -+ -+ inode = page->mapping->host; -+ hidden_inode = itohi(inode); -+ -+ /* -+ * writepage is called when shared mmap'ed files need to write -+ * their pages, while prepare/commit_write are called from the -+ * non-paged write() interface. (However, in 2.3 the two interfaces -+ * share the same cache, while in 2.2 they didn't.) -+ * -+ * So we pretty much have to duplicate much of what commit_write does. -+ */ -+ -+ /* find lower page (returns a locked page) */ -+ hidden_page = grab_cache_page(hidden_inode->i_mapping, page->index); -+ if (!hidden_page) -+ goto out; -+ -+ /* get page address, and encode it */ -+ kaddr = (char *) kmap(page); -+ hidden_kaddr = (char*) kmap(hidden_page); -+ mini_fo_encode_block(kaddr, hidden_kaddr, PAGE_CACHE_SIZE, inode, inode->i_sb, page->index); -+ /* if encode_block could fail, then return error */ -+ kunmap(page); -+ kunmap(hidden_page); -+ -+ /* call lower writepage (expects locked page) */ -+ err = hidden_inode->i_mapping->a_ops->writepage(hidden_page); -+ -+ /* -+ * update mtime and ctime of lower level file system -+ * mini_fo' mtime and ctime are updated by generic_file_write -+ */ -+ hidden_inode->i_mtime = hidden_inode->i_ctime = CURRENT_TIME; -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,1) -+ UnlockPage(hidden_page); /* b/c grab_cache_page locked it */ -+# endif /* kernel older than 2.4.1 */ -+ page_cache_release(hidden_page); /* b/c grab_cache_page increased refcnt */ -+ -+ if (err) -+ ClearPageUptodate(page); -+ else -+ SetPageUptodate(page); -+ out: -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,1) -+ UnlockPage(page); -+# endif /* kernel 2.4.1 and newer */ -+ print_exit_status(err); -+ return err; -+} -+ -+ -+/* -+ * get one page from cache or lower f/s, return error otherwise. -+ * returns unlocked, up-to-date page (if ok), with increased refcnt. -+ */ -+page_t * -+mini_fo_get1page(file_t *file, int index) -+{ -+ page_t *page; -+ dentry_t *dentry; -+ inode_t *inode; -+ struct address_space *mapping; -+ int err; -+ -+ print_entry_location(); -+ -+ dentry = file->f_dentry; /* CPW: Moved below print_entry_location */ -+ inode = dentry->d_inode; -+ mapping = inode->i_mapping; -+ -+ fist_dprint(8, "%s: read page index %d pid %d\n", __FUNCTION__, index, current->pid); -+ if (index < 0) { -+ printk("%s BUG: index=%d\n", __FUNCTION__, index); -+ page = ERR_PTR(-EIO); -+ goto out; -+ } -+ page = read_cache_page(mapping, -+ index, -+ (filler_t *) mapping->a_ops->readpage, -+ (void *) file); -+ if (IS_ERR(page)) -+ goto out; -+ wait_on_page(page); -+ if (!Page_Uptodate(page)) { -+ lock_page(page); -+ err = mapping->a_ops->readpage(file, page); -+ if (err) { -+ page = ERR_PTR(err); -+ goto out; -+ } -+ wait_on_page(page); -+ if (!Page_Uptodate(page)) { -+ page = ERR_PTR(-EIO); -+ goto out; -+ } -+ } -+ -+ out: -+ print_exit_pointer(page); -+ return page; -+} -+ -+ -+/* -+ * get one page from cache or lower f/s, return error otherwise. -+ * similar to get1page, but doesn't guarantee that it will return -+ * an unlocked page. -+ */ -+page_t * -+mini_fo_get1page_cached(file_t *file, int index) -+{ -+ page_t *page; -+ dentry_t *dentry; -+ inode_t *inode; -+ struct address_space *mapping; -+ int err; -+ -+ print_entry_location(); -+ -+ dentry = file->f_dentry; /* CPW: Moved below print_entry_location */ -+ inode = dentry->d_inode; -+ mapping = inode->i_mapping; -+ -+ fist_dprint(8, "%s: read page index %d pid %d\n", __FUNCTION__, index, current->pid); -+ if (index < 0) { -+ printk("%s BUG: index=%d\n", __FUNCTION__, index); -+ page = ERR_PTR(-EIO); -+ goto out; -+ } -+ page = read_cache_page(mapping, -+ index, -+ (filler_t *) mapping->a_ops->readpage, -+ (void *) file); -+ if (IS_ERR(page)) -+ goto out; -+ -+ out: -+ print_exit_pointer(page); -+ return page; -+} -+ -+ -+/* -+ * readpage is called from generic_page_read and the fault handler. -+ * If your file system uses generic_page_read for the read op, it -+ * must implement readpage. -+ * -+ * Readpage expects a locked page, and must unlock it. -+ */ -+STATIC int -+mini_fo_do_readpage(file_t *file, page_t *page) -+{ -+ int err = -EIO; -+ dentry_t *dentry; -+ file_t *hidden_file = NULL; -+ dentry_t *hidden_dentry; -+ inode_t *inode; -+ inode_t *hidden_inode; -+ char *page_data; -+ page_t *hidden_page; -+ char *hidden_page_data; -+ int real_size; -+ -+ print_entry_location(); -+ -+ dentry = file->f_dentry; /* CPW: Moved below print_entry_location */ -+ if (ftopd(file) != NULL) -+ hidden_file = ftohf(file); -+ hidden_dentry = dtohd(dentry); -+ inode = dentry->d_inode; -+ hidden_inode = itohi(inode); -+ -+ fist_dprint(7, "%s: requesting page %d from file %s\n", __FUNCTION__, page->index, dentry->d_name.name); -+ -+ MALLOC_PAGE_POINTERS(hidden_pages, num_hidden_pages); -+ MALLOC_PAGEDATA_POINTERS(hidden_pages_data, num_hidden_pages); -+ FOR_EACH_PAGE -+ CURRENT_HIDDEN_PAGE = NULL; -+ -+ /* find lower page (returns a locked page) */ -+ FOR_EACH_PAGE { -+ fist_dprint(8, "%s: Current page index = %d\n", __FUNCTION__, CURRENT_HIDDEN_PAGEINDEX); -+ CURRENT_HIDDEN_PAGE = read_cache_page(hidden_inode->i_mapping, -+ CURRENT_HIDDEN_PAGEINDEX, -+ (filler_t *) hidden_inode->i_mapping->a_ops->readpage, -+ (void *) hidden_file); -+ if (IS_ERR(CURRENT_HIDDEN_PAGE)) { -+ err = PTR_ERR(CURRENT_HIDDEN_PAGE); -+ CURRENT_HIDDEN_PAGE = NULL; -+ goto out_release; -+ } -+ } -+ -+ /* -+ * wait for the page data to show up -+ * (signaled by readpage as unlocking the page) -+ */ -+ FOR_EACH_PAGE { -+ wait_on_page(CURRENT_HIDDEN_PAGE); -+ if (!Page_Uptodate(CURRENT_HIDDEN_PAGE)) { -+ /* -+ * call readpage() again if we returned from wait_on_page with a -+ * page that's not up-to-date; that can happen when a partial -+ * page has a few buffers which are ok, but not the whole -+ * page. -+ */ -+ lock_page(CURRENT_HIDDEN_PAGE); -+ err = hidden_inode->i_mapping->a_ops->readpage(hidden_file, -+ CURRENT_HIDDEN_PAGE); -+ if (err) { -+ CURRENT_HIDDEN_PAGE = NULL; -+ goto out_release; -+ } -+ wait_on_page(CURRENT_HIDDEN_PAGE); -+ if (!Page_Uptodate(CURRENT_HIDDEN_PAGE)) { -+ err = -EIO; -+ goto out_release; -+ } -+ } -+ } -+ -+ /* map pages, get their addresses */ -+ page_data = (char *) kmap(page); -+ FOR_EACH_PAGE -+ CURRENT_HIDDEN_PAGEDATA = (char *) kmap(CURRENT_HIDDEN_PAGE); -+ -+ /* if decode_block could fail, then return error */ -+ err = 0; -+ real_size = hidden_inode->i_size - (page->index << PAGE_CACHE_SHIFT); -+ if (real_size <= 0) -+ memset(page_data, 0, PAGE_CACHE_SIZE); -+ else if (real_size < PAGE_CACHE_SIZE) { -+ mini_fo_decode_block(hidden_page_data, page_data, real_size, inode, inode->i_sb, page->index); -+ memset(page_data + real_size, 0, PAGE_CACHE_SIZE - real_size); -+ } else -+ mini_fo_decode_block(hidden_page_data, page_data, PAGE_CACHE_SIZE, inode, inode->i_sb, page->index); -+ -+ FOR_EACH_PAGE -+ kunmap(CURRENT_HIDDEN_PAGE); -+ kunmap(page); -+ -+ out_release: -+ FOR_EACH_PAGE -+ if (CURRENT_HIDDEN_PAGE) -+ page_cache_release(CURRENT_HIDDEN_PAGE); /* undo read_cache_page */ -+ -+ FREE_PAGE_POINTERS(hidden_pages, num_hidden_pages); -+ FREE_PAGEDATA_POINTERS(hidden_pages_data, num_hidden_pages); -+ -+ out: -+ if (err == 0) -+ SetPageUptodate(page); -+ else -+ ClearPageUptodate(page); -+ -+ print_exit_status(err); -+ return err; -+} -+ -+ -+STATIC int -+mini_fo_readpage(file_t *file, page_t *page) -+{ -+ int err; -+ print_entry_location(); -+ -+ err = mini_fo_do_readpage(file, page); -+ -+ /* -+ * we have to unlock our page, b/c we _might_ have gotten a locked page. -+ * but we no longer have to wakeup on our page here, b/c UnlockPage does -+ * it -+ */ -+ UnlockPage(page); -+ -+ print_exit_status(err); -+ return err; -+} -+ -+ -+STATIC int -+mini_fo_prepare_write(file_t *file, page_t *page, unsigned from, unsigned to) -+{ -+ int err = 0; -+ -+ print_entry_location(); -+ -+ /* -+ * we call kmap(page) only here, and do the kunmap -+ * and the actual downcalls, including unlockpage and uncache -+ * in commit_write. -+ */ -+ kmap(page); -+ -+ /* fast path for whole page writes */ -+ if (from == 0 && to == PAGE_CACHE_SIZE) -+ goto out; -+ /* read the page to "revalidate" our data */ -+ /* call the helper function which doesn't unlock the page */ -+ if (!Page_Uptodate(page)) -+ err = mini_fo_do_readpage(file, page); -+ -+ out: -+ print_exit_status(err); -+ return err; -+} -+ -+ -+ -+STATIC int -+mini_fo_commit_write(file_t *file, page_t *page, unsigned from, unsigned to) -+{ -+ int err = -ENOMEM; -+ inode_t *inode; -+ inode_t *hidden_inode; -+ page_t *hidden_page; -+ file_t *hidden_file = NULL; -+ loff_t pos; -+ unsigned bytes = to - from; -+ unsigned hidden_from, hidden_to, hidden_bytes; -+ -+ print_entry_location(); -+ -+ inode = page->mapping->host; /* CPW: Moved below print_entry_location */ -+ hidden_inode = itohi(inode); -+ -+ ASSERT(file != NULL); -+ /* -+ * here we have a kmapped page, with data from the user copied -+ * into it. we need to encode_block it, and then call the lower -+ * commit_write. We also need to simulate same behavior of -+ * generic_file_write, and call prepare_write on the lower f/s first. -+ */ -+#ifdef FIST_COUNT_WRITES -+ count_writes++; -+# endif /* FIST_COUNT_WRITES */ -+ -+ /* this is append and/or extend -- we can't have holes so fill them in */ -+ if (page->index > (hidden_inode->i_size >> PAGE_CACHE_SHIFT)) { -+ page_t *tmp_page; -+ int index; -+ for (index = hidden_inode->i_size >> PAGE_CACHE_SHIFT; index < page->index; index++) { -+ tmp_page = mini_fo_get1page(file, index); -+ if (IS_ERR(tmp_page)) { -+ err = PTR_ERR(tmp_page); -+ goto out; -+ } -+ /* zero out the contents of the page at the appropriate offsets */ -+ memset((char*)page_address(tmp_page) + (inode->i_size & ~PAGE_CACHE_MASK), 0, PAGE_CACHE_SIZE - (inode->i_size & ~PAGE_CACHE_MASK)); -+ if (!(err = mini_fo_prepare_write(file, tmp_page, 0, PAGE_CACHE_SIZE))) -+ err = mini_fo_commit_write(file, tmp_page, 0, PAGE_CACHE_SIZE); -+ page_cache_release(tmp_page); -+ if (err < 0) -+ goto out; -+ if (current->need_resched) -+ schedule(); -+ } -+ } -+ -+ if (ftopd(file) != NULL) -+ hidden_file = ftohf(file); -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&hidden_inode->i_mutex); -+#else -+ down(&hidden_inode->i_sem); -+#endif -+ /* find lower page (returns a locked page) */ -+ hidden_page = grab_cache_page(hidden_inode->i_mapping, page->index); -+ if (!hidden_page) -+ goto out; -+ -+#if FIST_ENCODING_BLOCKSIZE > 1 -+# error encoding_blocksize greater than 1 is not yet supported -+# endif /* FIST_ENCODING_BLOCKSIZE > 1 */ -+ -+ hidden_from = from & (~(FIST_ENCODING_BLOCKSIZE - 1)); -+ hidden_to = ((to + FIST_ENCODING_BLOCKSIZE - 1) & (~(FIST_ENCODING_BLOCKSIZE - 1))); -+ if ((page->index << PAGE_CACHE_SHIFT) + to > hidden_inode->i_size) { -+ -+ /* -+ * if this call to commit_write had introduced holes and the code -+ * for handling holes was invoked, then the beginning of this page -+ * must be zeroed out -+ * zero out bytes from 'size_of_file%pagesize' to 'from'. -+ */ -+ if ((hidden_from - (inode->i_size & ~PAGE_CACHE_MASK)) > 0) -+ memset((char*)page_address(page) + (inode->i_size & ~PAGE_CACHE_MASK), 0, hidden_from - (inode->i_size & ~PAGE_CACHE_MASK)); -+ -+ } -+ hidden_bytes = hidden_to - hidden_from; -+ -+ /* call lower prepare_write */ -+ err = -EINVAL; -+ if (hidden_inode->i_mapping && -+ hidden_inode->i_mapping->a_ops && -+ hidden_inode->i_mapping->a_ops->prepare_write) -+ err = hidden_inode->i_mapping->a_ops->prepare_write(hidden_file, -+ hidden_page, -+ hidden_from, -+ hidden_to); -+ if (err) -+ /* don't leave locked pages behind, esp. on an ENOSPC */ -+ goto out_unlock; -+ -+ fist_dprint(8, "%s: encoding %d bytes\n", __FUNCTION__, hidden_bytes); -+ mini_fo_encode_block((char *) page_address(page) + hidden_from, (char*) page_address(hidden_page) + hidden_from, hidden_bytes, inode, inode->i_sb, page->index); -+ /* if encode_block could fail, then goto unlock and return error */ -+ -+ /* call lower commit_write */ -+ err = hidden_inode->i_mapping->a_ops->commit_write(hidden_file, -+ hidden_page, -+ hidden_from, -+ hidden_to); -+ -+ if (err < 0) -+ goto out_unlock; -+ -+ err = bytes; /* convert error to no. of bytes */ -+ -+ inode->i_blocks = hidden_inode->i_blocks; -+ /* we may have to update i_size */ -+ pos = (page->index << PAGE_CACHE_SHIFT) + to; -+ if (pos > inode->i_size) -+ inode->i_size = pos; -+ -+ /* -+ * update mtime and ctime of lower level file system -+ * mini_fo' mtime and ctime are updated by generic_file_write -+ */ -+ hidden_inode->i_mtime = hidden_inode->i_ctime = CURRENT_TIME; -+ -+ mark_inode_dirty_sync(inode); -+ -+ out_unlock: -+ UnlockPage(hidden_page); -+ page_cache_release(hidden_page); -+ kunmap(page); /* kmap was done in prepare_write */ -+ out: -+ /* we must set our page as up-to-date */ -+ if (err < 0) -+ ClearPageUptodate(page); -+ else -+ SetPageUptodate(page); -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&hidden_inode->i_mutex); -+#else -+ up(&hidden_inode->i_sem); -+#endif -+ print_exit_status(err); -+ return err; /* assume all is ok */ -+} -+ -+ -+STATIC int -+mini_fo_bmap(struct address_space *mapping, long block) -+{ -+ int err = 0; -+ inode_t *inode; -+ inode_t *hidden_inode; -+ -+ print_entry_location(); -+ -+ inode = (inode_t *) mapping->host; -+ hidden_inode = itohi(inode); -+ -+ if (hidden_inode->i_mapping->a_ops->bmap) -+ err = hidden_inode->i_mapping->a_ops->bmap(hidden_inode->i_mapping, block); -+ print_exit_location(); -+ return err; -+} -+ -+ -+/* -+ * This function is copied verbatim from mm/filemap.c. -+ * XXX: It should be simply moved to some header file instead -- bug Al about it! -+ */ -+static inline int sync_page(struct page *page) -+{ -+ struct address_space *mapping = page->mapping; -+ -+ if (mapping && mapping->a_ops && mapping->a_ops->sync_page) -+ return mapping->a_ops->sync_page(page); -+ return 0; -+} -+ -+ -+/* -+ * XXX: we may not need this function if not FIST_FILTER_DATA. -+ * FIXME: for FIST_FILTER_SCA, get all lower pages and sync them each. -+ */ -+STATIC int -+mini_fo_sync_page(page_t *page) -+{ -+ int err = 0; -+ inode_t *inode; -+ inode_t *hidden_inode; -+ page_t *hidden_page; -+ -+ print_entry_location(); -+ -+ inode = page->mapping->host; /* CPW: Moved below print_entry_location */ -+ hidden_inode = itohi(inode); -+ -+ /* find lower page (returns a locked page) */ -+ hidden_page = grab_cache_page(hidden_inode->i_mapping, page->index); -+ if (!hidden_page) -+ goto out; -+ -+ err = sync_page(hidden_page); -+ -+ UnlockPage(hidden_page); /* b/c grab_cache_page locked it */ -+ page_cache_release(hidden_page); /* b/c grab_cache_page increased refcnt */ -+ -+ out: -+ print_exit_status(err); -+ return err; -+} ---- /dev/null -+++ b/fs/mini_fo/README -@@ -0,0 +1,163 @@ -+README for the mini_fo overlay file system -+========================================= -+ -+ -+WHAT IS MINI_FO? -+---------------- -+ -+mini_fo is a virtual kernel file system that can make read-only -+file systems writable. This is done by redirecting modifying operations -+to a writeable location called "storage directory", and leaving the -+original data in the "base directory" untouched. When reading, the -+file system merges the modifed and original data so that only the -+newest versions will appear. This occurs transparently to the user, -+who can access the data like on any other read-write file system. -+ -+Base and storage directories may be located on the same or on -+different partitions and may be of different file system types. While -+the storage directory obviously needs to be writable, the base may or -+may not be writable, what doesn't matter as it will no be modified -+anyway. -+ -+ -+WHAT IS GOOD FOR? -+----------------- -+ -+The primary purpose of the mini_fo file system is to allow easy -+software updates to embedded systems, that often store their root -+file system in a read-only flash file system, but there are many -+more as for example sandboxing, or for allowing live-cds to -+permanently store information. -+ -+ -+BUILDING -+-------- -+This should be simple. Adjust the Makefile to point to the correct -+kernel headers you want to build the module for. Then: -+ -+ # make -+ -+should build "mini_fo.o" for a 2.4 kernel or "mini_fo.ko" for a 2.6 -+kernel. -+ -+If you are building the module for you current kernel, you can install -+the module (as root): -+ -+ # make install -+ -+or uninstall with -+ -+ # make uninstall -+ -+ -+USING THE FILE SYSTEM -+-------------------- -+ -+the general mount syntax is: -+ -+ mount -t mini_fo -o base=,sto=\ -+ -+ -+Example: -+ -+You have mounted a cdrom to /mnt/cdrom and want to modifiy some files -+on it: -+ -+load the module (as root) -+ -+ # insmod mini_fo.o for a 2.4 kernel or -+ -+ # insmod mini_fo.ko for a 2.6 kernel -+ -+ -+create a storage dir in tmp and a mountpoint for mini_fo: -+ -+ # mkdir /tmp/sto -+ # mkdir /mnt/mini_fo -+ -+and mount the mini_fo file system: -+ -+ # mount -t mini_fo -o base=/mnt/cdrom,sto=/tmp/sto /mnt/cdrom /mnt/mini_fo -+ -+ -+Now the data stored on the cd can be accessed via the mini_fo -+mountpoint just like any read-write file system, files can be modified -+and deleted, new ones can be created and so on. When done unmount the -+file system: -+ -+ # unmount /mnt/mini_fo -+ -+Note that if the file system is mounted again using the same storage -+file system, of course it will appear in the modified state again. If -+you remount it using an new empty storage directory, it will be -+unmodified. Therefore by executing: -+ -+ # cd /tmp/sto -+ # rm -rf * -+ -+you can nuke all the changes you made to the original file system. But -+ remember NEVER do this while the mini_fo file system is mounted! -+ -+ -+Alternatively you can use the mini_fo-overlay bash script, that -+simplifies managing mini_fo mounts. See TOOLS Section. -+ -+ -+TOOLS -+----- -+ -+mini_fo-merge (experimental): -+ -+This is a bash script that will merge changes contained in the storage -+directory back to the base directory. This allows mini_fo to function -+as a cache file system by overlaying a slow (network, ...) file system -+and using a fast (ramdisk, ...) as storage. When done, changes can be -+merged back to the (slow) base with mini_fo-merge. See "mini_fo-merge -+-h" for details. -+ -+It can be usefull for merging changes back after a successfull test -+(patches, software updates...) -+ -+ -+mini_fo-overlay: -+ -+This bash script simplifies managing one or more mini_fo mounts. For -+overlaying a directory called "basedir1", you can just call: -+ -+ # mini_fo-overlay basedir1 -+ -+This will mount mini_fo with "basedir1" as base, "/tmp/sto-basedir1/" -+as storage to "/mnt/mini_fo-basedir1/". It has more options though, -+type "mini_fo-overlay -h" for details. -+ -+ -+DOCUMENTATION, REPORTING BUGS, GETTING HELP -+------------------------------------------- -+ -+Please visit the mini_fo project page at: -+ -+http://www.denx.de/twiki/bin/view/Know/MiniFOHome -+ -+ -+WARNINGS -+-------- -+ -+Never modify the base or the storage directorys while the mini_fo -+file system is mounted, or you might crash you system. Simply accessing -+and reading should not cause any trouble. -+ -+Exporting a mini_fo mount point via NFS has not been tested, and may -+or may not work. -+ -+Check the RELEASE_NOTES for details on bugs and features. -+ -+ -+ -+Copyright (C) 2004, 2005 Markus Klotzbuecher -+ -+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 of the License, or (at your option) any later version. -+ -+ ---- /dev/null -+++ b/fs/mini_fo/RELEASE_NOTES -@@ -0,0 +1,111 @@ -+Release: mini_fo-0.6.1 (v0-6-1) -+Date: 21.09.2005 -+ -+ -+Changes: -+-------- -+v0-6-1: -+ -+- bugfixes (see ChangeLog) -+ -+- two helper scripts "mini_fo_merge" and "mini_fo_overlay" (see -+ README for details). -+ -+v0-6-0: -+ -+- Support for 2.4 and 2.6 (see Makefile) -+ -+- Partial hard link support (creating works as expected, but already -+ existing links in the base file system will be treated as if they -+ were individual files). -+ -+- Various bugfixes and cleanups. -+ -+ -+v0-6-0-pre1: -+ -+- This is mini_fo-0-6-0-pre1! This release is a complete rewrite of -+ many vital mini_fo parts such as the old whiteout list code which -+ has been replaced by the new META subsystem. -+ -+- Light weight directory renaming implemented. This means if a -+ directory is renamed via the mini_fo filesystem this will no longer -+ result in a complete copy in storage, instead only one empty -+ directory will be created. All base filed contained in the original -+ directory stay there until modified. -+ -+- Special files (creating, renaming, deleting etc.) now working. -+ -+- Many bugfixes and cleanup, mini_fo is now a lot more stable. -+ -+ -+v0-5-10: -+ -+- Final release of the 0-5-* versions. Next will be a complete rewrite -+ of many features. This release contains several bugfixes related to -+ directory renaming. -+ -+ -+v0-5-10-pre6: -+ -+- Lots of cleanup and several bugfixes related to directory deleting -+ -+- Directory renaming suddenly works, what is most likely due to the -+ fact tha that "mv" is smart: if the classic rename doesn't work it -+ will assume that source and target file are on different fs and will -+ copy the directory and try to remove the source directory. Until -+ directory removing wasn't implemented, it would fail to do this and -+ rollback. -+ So, directory renaming works for now, but it doesn't yet do what you -+ would expect from a overlay fs, so use with care. -+ -+ -+v0-5-10-pre5: -+ -+- implemented directory deleting -+- made parsing of mount options more stable -+- New format of mount options! (See README) -+- I can't reproduce the unknown panic with 2.4.25 anymore, so I'll -+ happily assume it never existed! -+ -+ -+Implemented features: -+--------------------- -+ -+- creating hard links (see BUGS on already existing hard links) -+- lightweight directory renaming -+- renaming device files, pipes, sockets, etc. -+- creating, renaming, deleting of special files -+- deleting directorys -+- general directory reading (simple "ls" ) -+- creating files in existing directorys -+- creating directorys -+- renaming files. -+- reading and writing files (involves opening) -+- appending to files (creates copy in storage) -+- deleting files -+- llseek works too, what allows editors to work -+- persistency (a deleted file stay deleted over remounts) -+- use of symbolic links -+- creating of device files -+ -+ -+Not (yet) implemented features: -+------------------------------- -+ -+- full hard link support. -+ -+ -+ -+BUGS: -+----- -+ -+Hard links in the base file system will be treated as individual -+files, not as links to one inode. -+ -+The main problem with hard links isn't allowing to create them, but -+their pure existence. If you modify a base hard link, the changes made -+will only show up on this link, the other link will remain in the -+original state. I hope to fix this someday. Please note that this does -+not effect the special hard links '.' and '..', that are handled -+seperately by the lower fs. ---- /dev/null -+++ b/fs/mini_fo/state.c -@@ -0,0 +1,620 @@ -+/* -+ * Copyright (C) 2005 Markus Klotzbuecher -+ * -+ * 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 of the License, or (at your option) any later version. -+ */ -+ -+#ifdef HAVE_CONFIG_H -+# include -+#endif /* HAVE_CONFIG_H */ -+ -+#include "fist.h" -+#include "mini_fo.h" -+ -+ -+/* create the storage file, setup new states */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+int create_sto_reg_file(dentry_t *dentry, int mode, struct nameidata *nd) -+#else -+int create_sto_reg_file(dentry_t *dentry, int mode) -+#endif -+{ -+ int err = 0; -+ inode_t *dir; -+ dentry_t *hidden_sto_dentry; -+ dentry_t *hidden_sto_dir_dentry; -+ -+ if(exists_in_storage(dentry)) { -+ printk(KERN_CRIT "mini_fo: create_sto_file: wrong type or state.\n"); -+ err = -EINVAL; -+ goto out; -+ } -+ err = get_neg_sto_dentry(dentry); -+ -+ if (err) { -+ printk(KERN_CRIT "mini_fo: create_sto_file: ERROR getting neg. sto dentry.\n"); -+ goto out; -+ } -+ -+ dir = dentry->d_parent->d_inode; -+ hidden_sto_dentry = dtohd2(dentry); -+ -+ /* lock parent */ -+ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ down(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ -+ err = PTR_ERR(hidden_sto_dir_dentry); -+ if (IS_ERR(hidden_sto_dir_dentry)) -+ goto out; -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+ err = vfs_create(hidden_sto_dir_dentry->d_inode, -+ hidden_sto_dentry, -+ mode, nd); -+#else -+ err = vfs_create(hidden_sto_dir_dentry->d_inode, -+ hidden_sto_dentry, -+ mode); -+#endif -+ if(err) { -+ printk(KERN_CRIT "mini_fo: create_sto_file: ERROR creating sto file.\n"); -+ goto out_lock; -+ } -+ -+ if(!dtohd2(dentry)->d_inode) { -+ printk(KERN_CRIT "mini_fo: create_sto_file: ERROR creating sto file [2].\n"); -+ err = -EINVAL; -+ goto out_lock; -+ } -+ -+ /* interpose the new inode */ -+ if(dtost(dentry) == DELETED) { -+ dtost(dentry) = DEL_REWRITTEN; -+ err = mini_fo_tri_interpose(NULL, hidden_sto_dentry, dentry, dir->i_sb, 0); -+ if(err) -+ goto out_lock; -+ } -+ else if(dtost(dentry) == NON_EXISTANT) { -+ dtost(dentry) = CREATED; -+ err = mini_fo_tri_interpose(dtohd(dentry), hidden_sto_dentry, dentry, dir->i_sb, 0); -+ if(err) -+ goto out_lock; -+ } -+ else if(dtost(dentry) == UNMODIFIED) { -+ dtost(dentry) = MODIFIED; -+ /* interpose on new inode */ -+ if(itohi2(dentry->d_inode) != NULL) { -+ printk(KERN_CRIT "mini_fo: create_sto_file: invalid inode detected.\n"); -+ err = -EINVAL; -+ goto out_lock; -+ } -+ itohi2(dentry->d_inode) = igrab(dtohd2(dentry)->d_inode); -+ } -+ fist_copy_attr_timesizes(dentry->d_parent->d_inode, -+ hidden_sto_dir_dentry->d_inode); -+ -+ out_lock: -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ up(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ dput(hidden_sto_dir_dentry); -+ out: -+ return err; -+} -+ -+/* create the sto dir, setup states */ -+int create_sto_dir(dentry_t *dentry, int mode) -+{ -+ int err = 0; -+ inode_t *dir; -+ dentry_t *hidden_sto_dentry; -+ dentry_t *hidden_sto_dir_dentry; -+ -+ /* had to take the "!S_ISDIR(mode))" check out, because it failed */ -+ if(exists_in_storage(dentry)) { -+ printk(KERN_CRIT "mini_fo: create_sto_dir: wrong type or state.\\ -+n"); -+ err = -EINVAL; -+ goto out; -+ } -+ -+ err = get_neg_sto_dentry(dentry); -+ if(err) { -+ err = -EINVAL; -+ goto out; -+ } -+ -+ dir = dentry->d_parent->d_inode; -+ hidden_sto_dentry = dtohd2(dentry); -+ -+ /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */ -+ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ down(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ -+ err = PTR_ERR(hidden_sto_dir_dentry); -+ if (IS_ERR(hidden_sto_dir_dentry)) -+ goto out; -+ -+ err = vfs_mkdir(hidden_sto_dir_dentry->d_inode, -+ hidden_sto_dentry, -+ mode); -+ if(err) { -+ printk(KERN_CRIT "mini_fo: create_sto_dir: ERROR creating sto dir.\n"); -+ goto out_lock; -+ } -+ -+ if(!dtohd2(dentry)->d_inode) { -+ printk(KERN_CRIT "mini_fo: create_sto_dir: ERROR creating sto dir [2].\n"); -+ err = -EINVAL; -+ goto out_lock; -+ } -+ -+ /* interpose the new inode */ -+ if(dtost(dentry) == DELETED) { -+ dtost(dentry) = DEL_REWRITTEN; -+ err = mini_fo_tri_interpose(NULL, hidden_sto_dentry, dentry, dir->i_sb, 0); -+ if(err) -+ goto out_lock; -+ } -+ else if(dtopd(dentry)->state == NON_EXISTANT) { -+ dtopd(dentry)->state = CREATED; -+ err = mini_fo_tri_interpose(dtohd(dentry), hidden_sto_dentry, dentry, dir->i_sb, 0); -+ if(err) -+ goto out_lock; -+ } -+ else if(dtopd(dentry)->state == UNMODIFIED) { -+ dtopd(dentry)->state = MODIFIED; -+ /* interpose on new inode */ -+ if(itohi2(dentry->d_inode) != NULL) { -+ printk(KERN_CRIT "mini_fo: create_sto_dir: ERROR, invalid inode detected.\n"); -+ err = -EINVAL; -+ goto out_lock; -+ } -+ itohi2(dentry->d_inode) = igrab(dtohd2(dentry)->d_inode); -+ } -+ -+ fist_copy_attr_timesizes(dir, hidden_sto_dir_dentry->d_inode); -+ -+ /* initalize the wol list */ -+ itopd(dentry->d_inode)->deleted_list_size = -1; -+ itopd(dentry->d_inode)->renamed_list_size = -1; -+ meta_build_lists(dentry); -+ -+ -+ out_lock: -+ /* was: unlock_dir(hidden_sto_dir_dentry); */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ up(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ dput(hidden_sto_dir_dentry); -+ out: -+ return err; -+} -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+int create_sto_nod(dentry_t *dentry, int mode, dev_t dev) -+#else -+int create_sto_nod(dentry_t *dentry, int mode, int dev) -+#endif -+{ -+ int err = 0; -+ inode_t *dir; -+ dentry_t *hidden_sto_dentry; -+ dentry_t *hidden_sto_dir_dentry; -+ -+ if(exists_in_storage(dentry)) { -+ err = -EEXIST; -+ goto out; -+ } -+ err = get_neg_sto_dentry(dentry); -+ -+ if (err) { -+ printk(KERN_CRIT "mini_fo: create_sto_nod: ERROR getting neg. sto dentry.\n"); -+ goto out; -+ } -+ -+ dir = dentry->d_parent->d_inode; -+ hidden_sto_dentry = dtohd2(dentry); -+ -+ /* lock parent */ -+ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ down(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ -+ err = PTR_ERR(hidden_sto_dir_dentry); -+ if (IS_ERR(hidden_sto_dir_dentry)) -+ goto out; -+ -+ err = vfs_mknod(hidden_sto_dir_dentry->d_inode, hidden_sto_dentry, mode, dev); -+ if(err) -+ goto out_lock; -+ -+ if(!dtohd2(dentry)->d_inode) { -+ printk(KERN_CRIT "mini_fo: create_sto_nod: creating storage inode failed [1].\n"); -+ err = -EINVAL; /* return something indicating failure */ -+ goto out_lock; -+ } -+ -+ /* interpose the new inode */ -+ if(dtost(dentry) == DELETED) { -+ dtost(dentry) = DEL_REWRITTEN; -+ err = mini_fo_tri_interpose(NULL, hidden_sto_dentry, dentry, dir->i_sb, 0); -+ if(err) -+ goto out_lock; -+ } -+ else if(dtost(dentry) == NON_EXISTANT) { -+ dtost(dentry) = CREATED; -+ err = mini_fo_tri_interpose(dtohd(dentry), hidden_sto_dentry, dentry, dir->i_sb, 0); -+ if(err) -+ goto out_lock; -+ } -+ else if(dtost(dentry) == UNMODIFIED) { -+ dtost(dentry) = MODIFIED; -+ /* interpose on new inode */ -+ if(itohi2(dentry->d_inode) != NULL) { -+ printk(KERN_CRIT "mini_fo: create_sto_nod: error, invalid inode detected.\n"); -+ err = -EINVAL; -+ goto out_lock; -+ } -+ itohi2(dentry->d_inode) = igrab(dtohd2(dentry)->d_inode); -+ } -+ -+ fist_copy_attr_timesizes(dir, hidden_sto_dir_dentry->d_inode); -+ -+ out_lock: -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ up(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ dput(hidden_sto_dir_dentry); -+ out: -+ return err; -+} -+ -+ -+/* unimplemented (and possibly not usefull): -+ -+ nondir-del_to_del_rew -+ nondir-non_exist_to_creat -+ -+ dir-unmod_to_del -+ dir-mod_to_del -+ dir-creat_to_del -+ dir-del_rew_to_del -+ dir-del_to_del_rew -+ dir-non_exist_to_creat -+*/ -+ -+ -+/* bring a file of any type from state UNMODIFIED to MODIFIED */ -+int nondir_unmod_to_mod(dentry_t *dentry, int cp_flag) -+{ -+ int err = 0; -+ struct vfsmount *tgt_mnt; -+ struct vfsmount *src_mnt; -+ dentry_t *tgt_dentry; -+ dentry_t *src_dentry; -+ dentry_t *hidden_sto_dentry; -+ dentry_t *hidden_sto_dir_dentry; -+ -+ check_mini_fo_dentry(dentry); -+ -+ if((dtost(dentry) != UNMODIFIED) || -+ S_ISDIR(dentry->d_inode->i_mode)) { -+ printk(KERN_CRIT "mini_fo: nondir_unmod_to_mod: \ -+ wrong type or state.\n"); -+ err = -1; -+ goto out; -+ } -+ err = get_neg_sto_dentry(dentry); -+ -+ if (err) { -+ printk(KERN_CRIT "mini_fo: nondir_unmod_to_mod: \ -+ ERROR getting neg. sto dentry.\n"); -+ goto out; -+ } -+ -+ /* create sto file */ -+ hidden_sto_dentry = dtohd2(dentry); -+ -+ /* lock parent */ -+ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ down(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ -+ err = PTR_ERR(hidden_sto_dir_dentry); -+ if (IS_ERR(hidden_sto_dir_dentry)) -+ goto out; -+ -+ /* handle different types of nondirs */ -+ if(S_ISCHR(dentry->d_inode->i_mode) || -+ S_ISBLK(dentry->d_inode->i_mode)) { -+ err = vfs_mknod(hidden_sto_dir_dentry->d_inode, -+ hidden_sto_dentry, -+ dtohd(dentry)->d_inode->i_mode, -+ dtohd(dentry)->d_inode->i_rdev); -+ } -+ -+ else if(S_ISREG(dentry->d_inode->i_mode)) { -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+ err = vfs_create(hidden_sto_dir_dentry->d_inode, -+ hidden_sto_dentry, -+ dtohd(dentry)->d_inode->i_mode, NULL); -+#else -+ err = vfs_create(hidden_sto_dir_dentry->d_inode, -+ hidden_sto_dentry, -+ dtohd(dentry)->d_inode->i_mode); -+#endif -+ } -+ if(err) { -+ printk(KERN_CRIT "mini_fo: nondir_unmod_to_mod: \ -+ ERROR creating sto file.\n"); -+ goto out_lock; -+ } -+ -+ /* interpose on new inode */ -+ if(itohi2(dentry->d_inode) != NULL) { -+ printk(KERN_CRIT "mini_fo: nondir_unmod_to_mod: \ -+ ERROR, invalid inode detected.\n"); -+ err = -EINVAL; -+ goto out_lock; -+ } -+ -+ itohi2(dentry->d_inode) = igrab(dtohd2(dentry)->d_inode); -+ -+ fist_copy_attr_timesizes(dentry->d_parent->d_inode, -+ hidden_sto_dir_dentry->d_inode); -+ dtost(dentry) = MODIFIED; -+ -+ /* copy contents if regular file and cp_flag = 1 */ -+ if((cp_flag == 1) && S_ISREG(dentry->d_inode->i_mode)) { -+ -+ /* unlock first */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ up(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ -+ dput(hidden_sto_dir_dentry); -+ -+ tgt_dentry = dtohd2(dentry); -+ tgt_mnt = stopd(dentry->d_inode->i_sb)->hidden_mnt2; -+ src_dentry = dtohd(dentry); -+ src_mnt = stopd(dentry->d_inode->i_sb)->hidden_mnt; -+ -+ err = mini_fo_cp_cont(tgt_dentry, tgt_mnt, -+ src_dentry, src_mnt); -+ if(err) { -+ printk(KERN_CRIT "mini_fo: nondir_unmod_to_mod: \ -+ ERROR copying contents.\n"); -+ } -+ goto out; -+ } -+ -+ out_lock: -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ up(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ dput(hidden_sto_dir_dentry); -+ out: -+ return err; -+} -+ -+/* this function is currently identical to nondir_creat_to_del */ -+int nondir_del_rew_to_del(dentry_t *dentry) -+{ -+ return nondir_creat_to_del(dentry); -+} -+ -+int nondir_creat_to_del(dentry_t *dentry) -+{ -+ int err = 0; -+ -+ inode_t *hidden_sto_dir_inode; -+ dentry_t *hidden_sto_dir_dentry; -+ dentry_t *hidden_sto_dentry; -+ -+ check_mini_fo_dentry(dentry); -+ -+ /* for now this function serves for both state DEL_REWRITTEN and -+ * CREATED */ -+ if(!(dtost(dentry) == CREATED || (dtost(dentry) == DEL_REWRITTEN)) || -+ S_ISDIR(dentry->d_inode->i_mode)) { -+ printk(KERN_CRIT "mini_fo: nondir_mod_to_del/del_rew_to_del: \ -+ wrong type or state.\n"); -+ err = -1; -+ goto out; -+ } -+ -+ hidden_sto_dir_inode = itohi2(dentry->d_parent->d_inode); -+ hidden_sto_dentry = dtohd2(dentry); -+ -+ /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry);*/ -+ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ down(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ -+ /* avoid destroying the hidden inode if the file is in use */ -+ dget(hidden_sto_dentry); -+ err = vfs_unlink(hidden_sto_dir_inode, hidden_sto_dentry); -+ dput(hidden_sto_dentry); -+ if(!err) -+ d_delete(hidden_sto_dentry); -+ -+ /* propagate number of hard-links */ -+ dentry->d_inode->i_nlink = itohi2(dentry->d_inode)->i_nlink; -+ -+ dtost(dentry) = NON_EXISTANT; -+ -+ /* was: unlock_dir(hidden_sto_dir_dentry); */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ up(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ dput(hidden_sto_dir_dentry); -+ -+ out: -+ return err; -+} -+ -+int nondir_mod_to_del(dentry_t *dentry) -+{ -+ int err; -+ dentry_t *hidden_sto_dentry; -+ inode_t *hidden_sto_dir_inode; -+ dentry_t *hidden_sto_dir_dentry; -+ -+ check_mini_fo_dentry(dentry); -+ -+ if(dtost(dentry) != MODIFIED || -+ S_ISDIR(dentry->d_inode->i_mode)) { -+ printk(KERN_CRIT "mini_fo: nondir_mod_to_del: \ -+ wrong type or state.\n"); -+ err = -1; -+ goto out; -+ } -+ -+ hidden_sto_dir_inode = itohi2(dentry->d_parent->d_inode); -+ hidden_sto_dentry = dtohd2(dentry); -+ -+ /* was hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */ -+ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ down(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ -+ /* avoid destroying the hidden inode if the file is in use */ -+ dget(hidden_sto_dentry); -+ err = vfs_unlink(hidden_sto_dir_inode, hidden_sto_dentry); -+ dput(hidden_sto_dentry); -+ if(!err) -+ d_delete(hidden_sto_dentry); -+ -+ /* propagate number of hard-links */ -+ dentry->d_inode->i_nlink = itohi2(dentry->d_inode)->i_nlink; -+ -+ /* dput base dentry, this will relase the inode and free the -+ * dentry, as we will never need it again. */ -+ dput(dtohd(dentry)); -+ dtohd(dentry) = NULL; -+ dtost(dentry) = DELETED; -+ -+ /* add deleted file to META-file */ -+ meta_add_d_entry(dentry->d_parent, -+ dentry->d_name.name, -+ dentry->d_name.len); -+ -+ /* was: unlock_dir(hidden_sto_dir_dentry); */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); -+#else -+ up(&hidden_sto_dir_dentry->d_inode->i_sem); -+#endif -+ dput(hidden_sto_dir_dentry); -+ -+ out: -+ return err; -+} -+ -+int nondir_unmod_to_del(dentry_t *dentry) -+{ -+ int err = 0; -+ -+ check_mini_fo_dentry(dentry); -+ -+ if(dtost(dentry) != UNMODIFIED || -+ S_ISDIR(dentry->d_inode->i_mode)) { -+ printk(KERN_CRIT "mini_fo: nondir_unmod_to_del: \ -+ wrong type or state.\n"); -+ err = -1; -+ goto out; -+ } -+ -+ /* next we have to get a negative dentry for the storage file */ -+ err = get_neg_sto_dentry(dentry); -+ -+ if(err) -+ goto out; -+ -+ /* add deleted file to META lists */ -+ err = meta_add_d_entry(dentry->d_parent, -+ dentry->d_name.name, -+ dentry->d_name.len); -+ -+ if(err) -+ goto out; -+ -+ /* dput base dentry, this will relase the inode and free the -+ * dentry, as we will never need it again. */ -+ dput(dtohd(dentry)); -+ dtohd(dentry) = NULL; -+ dtost(dentry) = DELETED; -+ -+ out: -+ return err; -+} -+ -+/* bring a dir from state UNMODIFIED to MODIFIED */ -+int dir_unmod_to_mod(dentry_t *dentry) -+{ -+ int err; -+ -+ check_mini_fo_dentry(dentry); -+ -+ if(dtost(dentry) != UNMODIFIED || -+ !S_ISDIR(dentry->d_inode->i_mode)) { -+ printk(KERN_CRIT "mini_fo: dir_unmod_to_mod: \ -+ wrong type or state.\n"); -+ err = -1; -+ goto out; -+ } -+ -+ /* this creates our dir incl. sto. structure */ -+ err = build_sto_structure(dentry->d_parent, dentry); -+ if(err) { -+ printk(KERN_CRIT "mini_fo: dir_unmod_to_mod: \ -+ build_sto_structure failed.\n"); -+ goto out; -+ } -+ out: -+ return err; -+} -+ ---- /dev/null -+++ b/fs/mini_fo/super.c -@@ -0,0 +1,281 @@ -+/* -+ * Copyright (c) 1997-2003 Erez Zadok -+ * Copyright (c) 2001-2003 Stony Brook University -+ * -+ * For specific licensing information, see the COPYING file distributed with -+ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING. -+ * -+ * This Copyright notice must be kept intact and distributed with all -+ * fistgen sources INCLUDING sources generated by fistgen. -+ */ -+/* -+ * Copyright (C) 2004, 2005 Markus Klotzbuecher -+ * -+ * 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 of the License, or (at your option) any later version. -+ */ -+ -+/* -+ * $Id$ -+ */ -+ -+#ifdef HAVE_CONFIG_H -+# include -+#endif -+ -+#include "fist.h" -+#include "mini_fo.h" -+ -+ -+STATIC void -+mini_fo_read_inode(inode_t *inode) -+{ -+ static struct address_space_operations mini_fo_empty_aops; -+ -+ __itopd(inode) = kmalloc(sizeof(struct mini_fo_inode_info), GFP_KERNEL); -+ if (!itopd(inode)) { -+ printk("<0>%s:%s:%d: No kernel memory!\n", __FILE__, __FUNCTION__, __LINE__); -+ ASSERT(NULL); -+ } -+ itohi(inode) = NULL; -+ itohi2(inode) = NULL; -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+ inode->i_version++; -+#else -+ inode->i_version = ++event; /* increment inode version */ -+#endif -+ inode->i_op = &mini_fo_main_iops; -+ inode->i_fop = &mini_fo_main_fops; -+#if 0 -+ /* -+ * XXX: To export a file system via NFS, it has to have the -+ * FS_REQUIRES_DEV flag, so turn it on. But should we inherit it from -+ * the lower file system, or can we allow our file system to be exported -+ * even if the lower one cannot be natively exported. -+ */ -+ inode->i_sb->s_type->fs_flags |= FS_REQUIRES_DEV; -+ /* -+ * OK, the above was a hack, which is now turned off because it may -+ * cause a panic/oops on some systems. The correct way to export a -+ * "nodev" filesystem is via using nfs-utils > 1.0 and the "fsid=" export -+ * parameter, which requires 2.4.20 or later. -+ */ -+#endif -+ /* I don't think ->a_ops is ever allowed to be NULL */ -+ inode->i_mapping->a_ops = &mini_fo_empty_aops; -+} -+ -+ -+#if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) -+/* -+ * No need to call write_inode() on the lower inode, as it -+ * will have been marked 'dirty' anyway. But we might need -+ * to write some of our own stuff to disk. -+ */ -+STATIC void -+mini_fo_write_inode(inode_t *inode, int sync) -+{ -+ print_entry_location(); -+ print_exit_location(); -+} -+#endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */ -+ -+ -+STATIC void -+mini_fo_put_inode(inode_t *inode) -+{ -+ /* -+ * This is really funky stuff: -+ * Basically, if i_count == 1, iput will then decrement it and this inode will be destroyed. -+ * It is currently holding a reference to the hidden inode. -+ * Therefore, it needs to release that reference by calling iput on the hidden inode. -+ * iput() _will_ do it for us (by calling our clear_inode), but _only_ if i_nlink == 0. -+ * The problem is, NFS keeps i_nlink == 1 for silly_rename'd files. -+ * So we must for our i_nlink to 0 here to trick iput() into calling our clear_inode. -+ */ -+ if (atomic_read(&inode->i_count) == 1) -+ inode->i_nlink = 0; -+} -+ -+ -+#if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) -+/* -+ * we now define delete_inode, because there are two VFS paths that may -+ * destroy an inode: one of them calls clear inode before doing everything -+ * else that's needed, and the other is fine. This way we truncate the inode -+ * size (and its pages) and then clear our own inode, which will do an iput -+ * on our and the lower inode. -+ */ -+STATIC void -+mini_fo_delete_inode(inode_t *inode) -+{ -+ print_entry_location(); -+ -+ fist_checkinode(inode, "mini_fo_delete_inode IN"); -+ inode->i_size = 0; /* every f/s seems to do that */ -+ clear_inode(inode); -+ -+ print_exit_location(); -+} -+#endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */ -+ -+ -+/* final actions when unmounting a file system */ -+STATIC void -+mini_fo_put_super(super_block_t *sb) -+{ -+ if (stopd(sb)) { -+ mntput(stopd(sb)->hidden_mnt); -+ mntput(stopd(sb)->hidden_mnt2); -+ -+ /* mk: no! dput(stopd(sb)->base_dir_dentry); -+ dput(stopd(sb)->storage_dir_dentry); */ -+ -+ kfree(stopd(sb)); -+ __stopd(sb) = NULL; -+ } -+} -+ -+ -+#ifdef NOT_NEEDED -+/* -+ * This is called in do_umount before put_super. -+ * The superblock lock is not held yet. -+ * We probably do not need to define this or call write_super -+ * on the hidden_sb, because sync_supers() will get to hidden_sb -+ * sooner or later. But it is also called from file_fsync()... -+ */ -+STATIC void -+mini_fo_write_super(super_block_t *sb) -+{ -+ return; -+} -+#endif /* NOT_NEEDED */ -+ -+ -+STATIC int -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) -+mini_fo_statfs(struct dentry *d, struct kstatfs *buf) -+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+mini_fo_statfs(super_block_t *sb, struct kstatfs *buf) -+#else -+mini_fo_statfs(super_block_t *sb, struct statfs *buf) -+#endif -+{ -+ int err = 0; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) -+ struct dentry *hidden_d; -+ -+ hidden_d = dtohd(d); -+ err = vfs_statfs(hidden_d, buf); -+#else -+ super_block_t *hidden_sb; -+ -+ hidden_sb = stohs(sb); -+ err = vfs_statfs(hidden_sb, buf); -+#endif -+ -+ return err; -+} -+ -+ -+/* -+ * XXX: not implemented. This is not allowed yet. -+ * Should we call this on the hidden_sb? Probably not. -+ */ -+STATIC int -+mini_fo_remount_fs(super_block_t *sb, int *flags, char *data) -+{ -+ //printk(KERN_CRIT "mini_fo_remount_fs: WARNING, this function is umimplemented.\n"); -+ return -ENOSYS; -+} -+ -+ -+/* -+ * Called by iput() when the inode reference count reached zero -+ * and the inode is not hashed anywhere. Used to clear anything -+ * that needs to be, before the inode is completely destroyed and put -+ * on the inode free list. -+ */ -+STATIC void -+mini_fo_clear_inode(inode_t *inode) -+{ -+ /* -+ * Decrement a reference to a hidden_inode, which was incremented -+ * by our read_inode when it was created initially. -+ */ -+ -+ /* release the wol_list */ -+ if(S_ISDIR(inode->i_mode)) { -+ __meta_put_lists(inode); -+ } -+ -+ /* mk: fan out fun */ -+ if(itohi(inode)) -+ iput(itohi(inode)); -+ if(itohi2(inode)) -+ iput(itohi2(inode)); -+ -+ // XXX: why this assertion fails? -+ // because it doesn't like us -+ // ASSERT((inode->i_state & I_DIRTY) == 0); -+ kfree(itopd(inode)); -+ __itopd(inode) = NULL; -+} -+ -+ -+/* -+ * Called in do_umount() if the MNT_FORCE flag was used and this -+ * function is defined. See comment in linux/fs/super.c:do_umount(). -+ * Used only in nfs, to kill any pending RPC tasks, so that subsequent -+ * code can actually succeed and won't leave tasks that need handling. -+ * -+ * PS. I wonder if this is somehow useful to undo damage that was -+ * left in the kernel after a user level file server (such as amd) -+ * dies. -+ */ -+STATIC void -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) -+mini_fo_umount_begin(struct vfsmount *mnt, int flags) -+{ -+ struct vfsmount *hidden_mnt; -+ -+ hidden_mnt = stopd(mnt->mnt_sb)->hidden_mnt; -+ -+ if (hidden_mnt->mnt_sb->s_op->umount_begin) -+ hidden_mnt->mnt_sb->s_op->umount_begin(hidden_mnt, flags); -+ -+} -+#else -+mini_fo_umount_begin(super_block_t *sb) -+{ -+ super_block_t *hidden_sb; -+ -+ hidden_sb = stohs(sb); -+ -+ if (hidden_sb->s_op->umount_begin) -+ hidden_sb->s_op->umount_begin(hidden_sb); -+ -+} -+#endif -+ -+ -+struct super_operations mini_fo_sops = -+{ -+ read_inode: mini_fo_read_inode, -+#if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) -+ write_inode: mini_fo_write_inode, -+#endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */ -+ put_inode: mini_fo_put_inode, -+#if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) -+ delete_inode: mini_fo_delete_inode, -+#endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */ -+ put_super: mini_fo_put_super, -+ statfs: mini_fo_statfs, -+ remount_fs: mini_fo_remount_fs, -+ clear_inode: mini_fo_clear_inode, -+ umount_begin: mini_fo_umount_begin, -+}; diff --git a/target/linux/generic-2.6/patches-2.6.27/210-mini_fo_2.6.25_fixes.patch b/target/linux/generic-2.6/patches-2.6.27/210-mini_fo_2.6.25_fixes.patch deleted file mode 100644 index d71e3b6fa..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/210-mini_fo_2.6.25_fixes.patch +++ /dev/null @@ -1,143 +0,0 @@ ---- a/fs/mini_fo/main.c -+++ b/fs/mini_fo/main.c -@@ -79,6 +79,7 @@ mini_fo_tri_interpose(dentry_t *hidden_d - * of the new inode's fields - */ - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) - /* - * original: inode = iget(sb, hidden_inode->i_ino); - */ -@@ -87,6 +88,13 @@ mini_fo_tri_interpose(dentry_t *hidden_d - err = -EACCES; /* should be impossible??? */ - goto out; - } -+#else -+ inode = mini_fo_iget(sb, iunique(sb, 25)); -+ if (IS_ERR(inode)) { -+ err = PTR_ERR(inode); -+ goto out; -+ } -+#endif - - /* - * interpose the inode if not already interposed -@@ -184,9 +192,9 @@ mini_fo_parse_options(super_block_t *sb, - hidden_root = ERR_PTR(err); - goto out; - } -- hidden_root = nd.dentry; -- stopd(sb)->base_dir_dentry = nd.dentry; -- stopd(sb)->hidden_mnt = nd.mnt; -+ hidden_root = nd_get_dentry(&nd); -+ stopd(sb)->base_dir_dentry = nd_get_dentry(&nd); -+ stopd(sb)->hidden_mnt = nd_get_mnt(&nd); - - } else if(!strncmp("sto=", options, 4)) { - /* parse the storage dir */ -@@ -204,9 +212,9 @@ mini_fo_parse_options(super_block_t *sb, - hidden_root2 = ERR_PTR(err); - goto out; - } -- hidden_root2 = nd2.dentry; -- stopd(sb)->storage_dir_dentry = nd2.dentry; -- stopd(sb)->hidden_mnt2 = nd2.mnt; -+ hidden_root2 = nd_get_dentry(&nd2); -+ stopd(sb)->storage_dir_dentry = nd_get_dentry(&nd2); -+ stopd(sb)->hidden_mnt2 = nd_get_mnt(&nd2); - stohs2(sb) = hidden_root2->d_sb; - - /* validate storage dir, this is done in ---- a/fs/mini_fo/mini_fo.h -+++ b/fs/mini_fo/mini_fo.h -@@ -302,6 +302,10 @@ extern int mini_fo_tri_interpose(dentry_ - extern int mini_fo_cp_cont(dentry_t *tgt_dentry, struct vfsmount *tgt_mnt, - dentry_t *src_dentry, struct vfsmount *src_mnt); - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) -+extern struct inode *mini_fo_iget(struct super_block *sb, unsigned long ino); -+#endif -+ - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - extern int mini_fo_create(inode_t *dir, dentry_t *dentry, int mode, struct nameidata *nd); - -@@ -501,6 +505,29 @@ static inline void double_unlock(struct - #endif /* if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */ - #endif /* __KERNEL__ */ - -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) -+static inline dentry_t *nd_get_dentry(struct nameidata *nd) -+{ -+ return (nd->path.dentry); -+} -+ -+static inline struct vfsmount *nd_get_mnt(struct nameidata *nd) -+{ -+ return (nd->path.mnt); -+} -+#else -+static inline dentry_t *nd_get_dentry(struct nameidata *nd) -+{ -+ return (nd->dentry); -+} -+ -+static inline struct vfsmount *nd_get_mnt(struct nameidata *nd) -+{ -+ return (nd->mnt); -+} -+#endif -+ - /* - * Definitions for user and kernel code - */ ---- a/fs/mini_fo/super.c -+++ b/fs/mini_fo/super.c -@@ -262,10 +262,31 @@ mini_fo_umount_begin(super_block_t *sb) - } - #endif - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) -+struct inode * -+mini_fo_iget(struct super_block *sb, unsigned long ino) -+{ -+ struct inode *inode; -+ -+ inode = iget_locked(sb, ino); -+ if (!inode) -+ return ERR_PTR(-ENOMEM); -+ -+ if (!(inode->i_state & I_NEW)) -+ return inode; -+ -+ mini_fo_read_inode(inode); -+ -+ unlock_new_inode(inode); -+ return inode; -+} -+#endif /* if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) */ - - struct super_operations mini_fo_sops = - { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) - read_inode: mini_fo_read_inode, -+#endif - #if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) - write_inode: mini_fo_write_inode, - #endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */ ---- a/fs/mini_fo/aux.c -+++ b/fs/mini_fo/aux.c -@@ -164,11 +164,11 @@ dentry_t *bpath_walk(super_block_t *sb, - err = vfs_path_lookup(mnt->mnt_root, mnt, bpath+1, 0, &nd); - - /* validate */ -- if (err || !nd.dentry || !nd.dentry->d_inode) { -+ if (err || !nd_get_dentry(&nd) || !nd_get_dentry(&nd)->d_inode) { - printk(KERN_CRIT "mini_fo: bpath_walk: path_walk failed.\n"); - return NULL; - } -- return nd.dentry; -+ return nd_get_dentry(&nd); - } - - diff --git a/target/linux/generic-2.6/patches-2.6.27/211-mini_fo_2.6.25_dentry_open_war.patch b/target/linux/generic-2.6/patches-2.6.27/211-mini_fo_2.6.25_dentry_open_war.patch deleted file mode 100644 index 48a19429b..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/211-mini_fo_2.6.25_dentry_open_war.patch +++ /dev/null @@ -1,66 +0,0 @@ ---- a/fs/mini_fo/meta.c -+++ b/fs/mini_fo/meta.c -@@ -442,6 +442,11 @@ int meta_write_d_entry(dentry_t *dentry, - S_IRUSR | S_IWUSR); - #endif - } -+ -+ /* $%& err, is this correct? */ -+ meta_mnt = stopd(dentry->d_inode->i_sb)->hidden_mnt2; -+ mntget(meta_mnt); -+ - /* open META-file for writing */ - meta_file = dentry_open(meta_dentry, meta_mnt, 0x1); - if(!meta_file || IS_ERR(meta_file)) { -@@ -535,6 +540,11 @@ int meta_write_r_entry(dentry_t *dentry, - meta_dentry, S_IRUSR | S_IWUSR); - #endif - } -+ -+ /* $%& err, is this correct? */ -+ meta_mnt = stopd(dentry->d_inode->i_sb)->hidden_mnt2; -+ mntget(meta_mnt); -+ - /* open META-file for writing */ - meta_file = dentry_open(meta_dentry, meta_mnt, 0x1); - if(!meta_file || IS_ERR(meta_file)) { -@@ -671,14 +681,16 @@ int meta_sync_d_list(dentry_t *dentry, i - } - } - -+ /* $%& err, is this correct? */ -+ meta_mnt = stopd(dentry->d_inode->i_sb)->hidden_mnt2; -+ mntget(meta_mnt); -+ - /* open META-file for writing */ - meta_file = dentry_open(meta_dentry, meta_mnt, 0x1); - if(!meta_file || IS_ERR(meta_file)) { - printk(KERN_CRIT "mini_fo: meta_sync_d_list: \ - ERROR opening meta file.\n"); -- /* we don't mntget so we dont't mntput (for now) -- * mntput(meta_mnt); -- */ -+ mntput(meta_mnt); - dput(meta_dentry); - err = -1; - goto out; -@@ -811,14 +823,16 @@ int meta_sync_r_list(dentry_t *dentry, i - } - } - -+ /* $%& err, is this correct? */ -+ meta_mnt = stopd(dentry->d_inode->i_sb)->hidden_mnt2; -+ mntget(meta_mnt); -+ - /* open META-file for writing */ - meta_file = dentry_open(meta_dentry, meta_mnt, 0x1); - if(!meta_file || IS_ERR(meta_file)) { - printk(KERN_CRIT "mini_fo: meta_sync_r_list: \ - ERROR opening meta file.\n"); -- /* we don't mntget so we dont't mntput (for now) -- * mntput(meta_mnt); -- */ -+ mntput(meta_mnt); - dput(meta_dentry); - err = -1; - goto out; diff --git a/target/linux/generic-2.6/patches-2.6.27/212-mini_fo_2.6.26_fixes.patch b/target/linux/generic-2.6/patches-2.6.27/212-mini_fo_2.6.26_fixes.patch deleted file mode 100644 index 8bd9ba324..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/212-mini_fo_2.6.26_fixes.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- a/fs/mini_fo/super.c -+++ b/fs/mini_fo/super.c -@@ -84,6 +84,7 @@ mini_fo_write_inode(inode_t *inode, int - #endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */ - - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) - STATIC void - mini_fo_put_inode(inode_t *inode) - { -@@ -99,6 +100,7 @@ mini_fo_put_inode(inode_t *inode) - if (atomic_read(&inode->i_count) == 1) - inode->i_nlink = 0; - } -+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) */ - - - #if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) -@@ -238,7 +240,7 @@ mini_fo_clear_inode(inode_t *inode) - * dies. - */ - STATIC void --#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) - mini_fo_umount_begin(struct vfsmount *mnt, int flags) - { - struct vfsmount *hidden_mnt; -@@ -290,7 +292,9 @@ struct super_operations mini_fo_sops = - #if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) - write_inode: mini_fo_write_inode, - #endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) - put_inode: mini_fo_put_inode, -+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) */ - #if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) - delete_inode: mini_fo_delete_inode, - #endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */ diff --git a/target/linux/generic-2.6/patches-2.6.27/213-mini_fo_2.6.27_fixes.patch b/target/linux/generic-2.6/patches-2.6.27/213-mini_fo_2.6.27_fixes.patch deleted file mode 100644 index f92c18b25..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/213-mini_fo_2.6.27_fixes.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- a/fs/mini_fo/inode.c -+++ b/fs/mini_fo/inode.c -@@ -439,7 +439,7 @@ mini_fo_symlink(inode_t *dir, dentry_t * - int err=0; - dentry_t *hidden_sto_dentry; - dentry_t *hidden_sto_dir_dentry; --#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) - umode_t mode; - #endif - -@@ -466,7 +466,7 @@ mini_fo_symlink(inode_t *dir, dentry_t * - down(&hidden_sto_dir_dentry->d_inode->i_sem); - #endif - --#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) - mode = S_IALLUGO; - err = vfs_symlink(hidden_sto_dir_dentry->d_inode, - hidden_sto_dentry, symname, mode); -@@ -1128,7 +1128,7 @@ void mini_fo_put_link(struct dentry *den - #endif - - STATIC int --#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) - mini_fo_permission(inode_t *inode, int mask, struct nameidata *nd) - #else - mini_fo_permission(inode_t *inode, int mask) -@@ -1150,8 +1150,9 @@ mini_fo_permission(inode_t *inode, int m - * if (err) - * goto out; - */ -- --#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) -+ err = inode_permission(hidden_inode, mask); -+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - err = permission(hidden_inode, mask, nd); - #else - err = permission(hidden_inode, mask); diff --git a/target/linux/generic-2.6/patches-2.6.27/219-kobject_uevent.patch b/target/linux/generic-2.6/patches-2.6.27/219-kobject_uevent.patch deleted file mode 100644 index 279665e86..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/219-kobject_uevent.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- a/lib/kobject_uevent.c -+++ b/lib/kobject_uevent.c -@@ -29,7 +29,8 @@ u64 uevent_seqnum; - char uevent_helper[UEVENT_HELPER_PATH_LEN] = CONFIG_UEVENT_HELPER_PATH; - static DEFINE_SPINLOCK(sequence_lock); - #if defined(CONFIG_NET) --static struct sock *uevent_sock; -+struct sock *uevent_sock = NULL; -+EXPORT_SYMBOL_GPL(uevent_sock); - #endif - - /* the strings here must match the enum in include/linux/kobject.h */ -@@ -42,6 +43,18 @@ static const char *kobject_actions[] = { - [KOBJ_OFFLINE] = "offline", - }; - -+u64 uevent_next_seqnum(void) -+{ -+ u64 seq; -+ -+ spin_lock(&sequence_lock); -+ seq = ++uevent_seqnum; -+ spin_unlock(&sequence_lock); -+ -+ return seq; -+} -+EXPORT_SYMBOL_GPL(uevent_next_seqnum); -+ - /** - * kobject_action_type - translate action string to numeric type - * -@@ -194,9 +207,7 @@ int kobject_uevent_env(struct kobject *k - kobj->state_remove_uevent_sent = 1; - - /* we will send an event, so request a new sequence number */ -- spin_lock(&sequence_lock); -- seq = ++uevent_seqnum; -- spin_unlock(&sequence_lock); -+ seq = uevent_next_seqnum(); - retval = add_uevent_var(env, "SEQNUM=%llu", (unsigned long long)seq); - if (retval) - goto exit; diff --git a/target/linux/generic-2.6/patches-2.6.27/220-sound_kconfig.patch b/target/linux/generic-2.6/patches-2.6.27/220-sound_kconfig.patch deleted file mode 100644 index f374009a6..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/220-sound_kconfig.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/sound/core/Kconfig -+++ b/sound/core/Kconfig -@@ -7,7 +7,7 @@ config SND_PCM - select SND_TIMER - - config SND_HWDEP -- tristate -+ tristate "Sound hardware support" - - config SND_RAWMIDI - tristate diff --git a/target/linux/generic-2.6/patches-2.6.27/400-ledtrig_morse.patch b/target/linux/generic-2.6/patches-2.6.27/400-ledtrig_morse.patch deleted file mode 100644 index b7df26e70..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/400-ledtrig_morse.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/drivers/leds/Kconfig -+++ b/drivers/leds/Kconfig -@@ -206,4 +206,8 @@ config LEDS_TRIGGER_DEFAULT_ON - This allows LEDs to be initialised in the ON state. - If unsure, say Y. - -+config LEDS_TRIGGER_MORSE -+ tristate "LED Morse Trigger" -+ depends on LEDS_TRIGGERS -+ - endif # NEW_LEDS ---- a/drivers/leds/Makefile -+++ b/drivers/leds/Makefile -@@ -29,3 +29,4 @@ obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledt - obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK) += ledtrig-ide-disk.o - obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT) += ledtrig-heartbeat.o - obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o -+obj-$(CONFIG_LEDS_TRIGGER_MORSE) += ledtrig-morse.o diff --git a/target/linux/generic-2.6/patches-2.6.27/401-led_alix.patch b/target/linux/generic-2.6/patches-2.6.27/401-led_alix.patch deleted file mode 100644 index 80e5401c7..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/401-led_alix.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/drivers/leds/Kconfig -+++ b/drivers/leds/Kconfig -@@ -77,6 +77,12 @@ config LEDS_WRAP - help - This option enables support for the PCEngines WRAP programmable LEDs. - -+config LEDS_ALIX -+ tristate "LED Support for the ALIX 2/3 boards" -+ depends on LEDS_CLASS -+ help -+ This option enables support for the three LEDs on the PCEngines ALIX 2/3 boards. -+ - config LEDS_H1940 - tristate "LED Support for iPAQ H1940 device" - depends on LEDS_CLASS && ARCH_H1940 ---- a/drivers/leds/Makefile -+++ b/drivers/leds/Makefile -@@ -13,6 +13,7 @@ obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c2 - obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o - obj-$(CONFIG_LEDS_NET48XX) += leds-net48xx.o - obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o -+obj-$(CONFIG_LEDS_ALIX) += leds-alix.o - obj-$(CONFIG_LEDS_H1940) += leds-h1940.o - obj-$(CONFIG_LEDS_COBALT_QUBE) += leds-cobalt-qube.o - obj-$(CONFIG_LEDS_COBALT_RAQ) += leds-cobalt-raq.o diff --git a/target/linux/generic-2.6/patches-2.6.27/402-ledtrig_netdev.patch b/target/linux/generic-2.6/patches-2.6.27/402-ledtrig_netdev.patch deleted file mode 100644 index 3b5ad97a1..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/402-ledtrig_netdev.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/drivers/leds/Kconfig -+++ b/drivers/leds/Kconfig -@@ -216,4 +216,11 @@ config LEDS_TRIGGER_MORSE - tristate "LED Morse Trigger" - depends on LEDS_TRIGGERS - -+config LEDS_TRIGGER_NETDEV -+ tristate "LED Netdev Trigger" -+ depends on LEDS_TRIGGERS -+ help -+ This allows LEDs to be controlled by network device activity. -+ If unsure, say Y. -+ - endif # NEW_LEDS ---- a/drivers/leds/Makefile -+++ b/drivers/leds/Makefile -@@ -31,3 +31,4 @@ obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK) += l - obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT) += ledtrig-heartbeat.o - obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o - obj-$(CONFIG_LEDS_TRIGGER_MORSE) += ledtrig-morse.o -+obj-$(CONFIG_LEDS_TRIGGER_NETDEV) += ledtrig-netdev.o diff --git a/target/linux/generic-2.6/patches-2.6.27/410-gpio_buttons.patch b/target/linux/generic-2.6/patches-2.6.27/410-gpio_buttons.patch deleted file mode 100644 index 20201aa90..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/410-gpio_buttons.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/drivers/input/misc/Kconfig -+++ b/drivers/input/misc/Kconfig -@@ -207,4 +207,20 @@ config HP_SDC_RTC - Say Y here if you want to support the built-in real time clock - of the HP SDC controller. - -+config INPUT_GPIO_BUTTONS -+ tristate "Polled GPIO buttons interface" -+ depends on GENERIC_GPIO -+ select INPUT_POLLDEV -+ help -+ This driver implements support for buttons connected -+ to GPIO pins of various CPUs (and some other chips). -+ -+ Say Y here if your device has buttons connected -+ directly to such GPIO pins. Your board-specific -+ setup logic must also provide a platform device, -+ with configuration data saying which GPIOs are used. -+ -+ To compile this driver as a module, choose M here: the -+ module will be called gpio-buttons. -+ - endif ---- a/drivers/input/misc/Makefile -+++ b/drivers/input/misc/Makefile -@@ -20,3 +20,4 @@ obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc. - obj-$(CONFIG_INPUT_UINPUT) += uinput.o - obj-$(CONFIG_INPUT_APANEL) += apanel.o - obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o -+obj-$(CONFIG_INPUT_GPIO_BUTTONS) += gpio_buttons.o diff --git a/target/linux/generic-2.6/patches-2.6.27/420-gpiodev.patch b/target/linux/generic-2.6/patches-2.6.27/420-gpiodev.patch deleted file mode 100644 index da17f8d7e..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/420-gpiodev.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/drivers/char/Kconfig -+++ b/drivers/char/Kconfig -@@ -1010,6 +1010,13 @@ config CS5535_GPIO - - If compiled as a module, it will be called cs5535_gpio. - -+config GPIO_DEVICE -+ tristate "GPIO device support" -+ depends on GENERIC_GPIO -+ help -+ Say Y to enable Linux GPIO device support. This allows control of -+ GPIO pins using a character device -+ - config GPIO_VR41XX - tristate "NEC VR4100 series General-purpose I/O Unit support" - depends on CPU_VR41XX ---- a/drivers/char/Makefile -+++ b/drivers/char/Makefile -@@ -94,6 +94,7 @@ obj-$(CONFIG_SCx200_GPIO) += scx200_gpio - obj-$(CONFIG_PC8736x_GPIO) += pc8736x_gpio.o - obj-$(CONFIG_NSC_GPIO) += nsc_gpio.o - obj-$(CONFIG_CS5535_GPIO) += cs5535_gpio.o -+obj-$(CONFIG_GPIO_DEVICE) += gpio_dev.o - obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.o - obj-$(CONFIG_GPIO_TB0219) += tb0219.o - obj-$(CONFIG_TELCLOCK) += tlclk.o diff --git a/target/linux/generic-2.6/patches-2.6.27/450-i2c_at24_add_kernel_interface_read_write.patch b/target/linux/generic-2.6/patches-2.6.27/450-i2c_at24_add_kernel_interface_read_write.patch deleted file mode 100644 index 36a3e6912..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/450-i2c_at24_add_kernel_interface_read_write.patch +++ /dev/null @@ -1,134 +0,0 @@ -Subject: [PATCH 2/3] I2C: at24: add kernel interface for reading/writing EEPROM -Date: Monday 25 August 2008 -From: Kevin Hilman -To: davinci-linux-open-source@linux.davincidsp.com - -This patch adds an interface by which other kernel code can read/write -detected EEPROM. - -The platform code registers a 'setup' callback with the -at24_platform_data. When the at24 driver detects an EEPROM, it fills -out the read and write functions of at24_iface and calls the setup -callback. The platform code can then use the read/write functions in -the at24_iface struct for reading and writing the EEPROM. - -Original idea, review and updates by David Brownell - -Signed-off-by: Kevin Hilman ---- - drivers/i2c/chips/at24.c | 42 +++++++++++++++++++++++++++++++++++------- - include/linux/i2c/at24.h | 10 ++++++++++ - 2 files changed, 45 insertions(+), 7 deletions(-) - ---- a/drivers/i2c/chips/at24.c -+++ b/drivers/i2c/chips/at24.c -@@ -53,6 +53,7 @@ - - struct at24_data { - struct at24_platform_data chip; -+ struct at24_iface iface; - bool use_smbus; - - /* -@@ -264,13 +265,6 @@ static ssize_t at24_bin_read(struct kobj - - - /* -- * REVISIT: export at24_bin{read,write}() to let other kernel code use -- * eeprom data. For example, it might hold a board's Ethernet address, or -- * board-specific calibration data generated on the manufacturing floor. -- */ -- -- --/* - * Note that if the hardware write-protect pin is pulled high, the whole - * chip is normally write protected. But there are plenty of product - * variants here, including OTP fuses and partial chip protect. -@@ -386,6 +380,30 @@ static ssize_t at24_bin_write(struct kob - - /*-------------------------------------------------------------------------*/ - -+/* -+ * This lets other kernel code access the eeprom data. For example, it -+ * might hold a board's Ethernet address, or board-specific calibration -+ * data generated on the manufacturing floor. -+ */ -+ -+static ssize_t at24_iface_read(struct at24_iface *iface, char *buf, -+ off_t offset, size_t count) -+{ -+ struct at24_data *at24 = container_of(iface, struct at24_data, iface); -+ -+ return at24_eeprom_read(at24, buf, offset, count); -+} -+ -+static ssize_t at24_iface_write(struct at24_iface *iface, char *buf, -+ off_t offset, size_t count) -+{ -+ struct at24_data *at24 = container_of(iface, struct at24_data, iface); -+ -+ return at24_eeprom_write(at24, buf, offset, count); -+} -+ -+/*-------------------------------------------------------------------------*/ -+ - static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) - { - struct at24_platform_data chip; -@@ -413,6 +431,9 @@ static int at24_probe(struct i2c_client - * is recommended anyhow. - */ - chip.page_size = 1; -+ -+ chip.setup = NULL; -+ chip.context = NULL; - } - - if (!is_power_of_2(chip.byte_len)) -@@ -449,6 +470,9 @@ static int at24_probe(struct i2c_client - goto err_out; - } - -+ at24->iface.read = at24_iface_read; -+ at24->iface.write = at24_iface_write; -+ - mutex_init(&at24->lock); - at24->use_smbus = use_smbus; - at24->chip = chip; -@@ -521,6 +545,10 @@ static int at24_probe(struct i2c_client - at24->write_max, - use_smbus ? ", use_smbus" : ""); - -+ /* export data to kernel code */ -+ if (chip.setup) -+ chip.setup(&at24->iface, chip.context); -+ - return 0; - - err_clients: ---- a/include/linux/i2c/at24.h -+++ b/include/linux/i2c/at24.h -@@ -15,6 +15,13 @@ - * is bigger than what the chip actually supports! - */ - -+struct at24_iface { -+ ssize_t (*read)(struct at24_iface *, char *buf, off_t offset, -+ size_t count); -+ ssize_t (*write)(struct at24_iface *, char *buf, off_t offset, -+ size_t count); -+}; -+ - struct at24_platform_data { - u32 byte_len; /* size (sum of all addr) */ - u16 page_size; /* for writes */ -@@ -23,6 +30,9 @@ struct at24_platform_data { - #define AT24_FLAG_READONLY 0x40 /* sysfs-entry will be read-only */ - #define AT24_FLAG_IRUGO 0x20 /* sysfs-entry will be world-readable */ - #define AT24_FLAG_TAKE8ADDR 0x10 /* take always 8 addresses (24c00) */ -+ -+ int (*setup)(struct at24_iface *, void *context); -+ void *context; - }; - - #endif /* _LINUX_AT24_H */ diff --git a/target/linux/generic-2.6/patches-2.6.27/510-yaffs_support.patch b/target/linux/generic-2.6/patches-2.6.27/510-yaffs_support.patch deleted file mode 100644 index 8c01f0a74..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/510-yaffs_support.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/fs/Kconfig -+++ b/fs/Kconfig -@@ -421,6 +421,7 @@ config FS_POSIX_ACL - - source "fs/xfs/Kconfig" - source "fs/gfs2/Kconfig" -+source "fs/yaffs2/Kconfig" - - config OCFS2_FS - tristate "OCFS2 file system support" ---- a/fs/Makefile -+++ b/fs/Makefile -@@ -124,3 +124,4 @@ obj-$(CONFIG_HPPFS) += hppfs/ - obj-$(CONFIG_DEBUG_FS) += debugfs/ - obj-$(CONFIG_OCFS2_FS) += ocfs2/ - obj-$(CONFIG_GFS2_FS) += gfs2/ -+obj-$(CONFIG_YAFFS_FS) += yaffs2/ diff --git a/target/linux/generic-2.6/patches-2.6.27/512-yaffs_2.6.25_fix.patch b/target/linux/generic-2.6/patches-2.6.27/512-yaffs_2.6.25_fix.patch deleted file mode 100644 index c12733634..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/512-yaffs_2.6.25_fix.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- a/fs/yaffs2/yaffs_fs.c -+++ b/fs/yaffs2/yaffs_fs.c -@@ -181,7 +181,13 @@ static int yaffs_statfs(struct super_blo - #else - static int yaffs_statfs(struct super_block *sb, struct statfs *buf); - #endif -+ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)) -+static struct inode *yaffs_iget(struct super_block *sb, unsigned long ino); -+#else - static void yaffs_read_inode(struct inode *inode); -+#endif -+ - - static void yaffs_put_inode(struct inode *inode); - static void yaffs_delete_inode(struct inode *); -@@ -284,7 +290,9 @@ static struct file_operations yaffs_dir_ - - static struct super_operations yaffs_super_ops = { - .statfs = yaffs_statfs, -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)) - .read_inode = yaffs_read_inode, -+#endif - .put_inode = yaffs_put_inode, - .put_super = yaffs_put_super, - .delete_inode = yaffs_delete_inode, -@@ -844,11 +852,17 @@ struct inode *yaffs_get_inode(struct sup - T(YAFFS_TRACE_OS, - (KERN_DEBUG "yaffs_get_inode for object %d\n", obj->objectId)); - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)) -+ inode = yaffs_iget(sb, obj->objectId); -+ if (IS_ERR(inode)) -+ return NULL; -+#else - inode = iget(sb, obj->objectId); - - /* NB Side effect: iget calls back to yaffs_read_inode(). */ - /* iget also increments the inode's i_count */ - /* NB You can't be holding grossLock or deadlock will happen! */ -+#endif - - return inode; - } -@@ -1427,6 +1441,39 @@ static int yaffs_sync_fs(struct super_bl - } - - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)) -+static struct inode *yaffs_iget(struct super_block *sb, unsigned long ino) -+{ -+ yaffs_Object *obj; -+ yaffs_Device *dev = yaffs_SuperToDevice(sb); -+ struct inode *inode; -+ -+ T(YAFFS_TRACE_OS, -+ (KERN_DEBUG "yaffs_iget for %lu\n", ino)); -+ -+ inode = iget_locked(sb, ino); -+ if (!inode) -+ return ERR_PTR(-ENOMEM); -+ if (!(inode->i_state & I_NEW)) -+ return inode; -+ -+ /* NB This is called as a side effect of other functions, but -+ * we had to release the lock to prevent deadlocks, so -+ * need to lock again. -+ */ -+ -+ yaffs_GrossLock(dev); -+ -+ obj = yaffs_FindObjectByNumber(dev, inode->i_ino); -+ -+ yaffs_FillInodeFromObject(inode, obj); -+ -+ yaffs_GrossUnlock(dev); -+ -+ unlock_new_inode(inode); -+ return inode; -+} -+#else - static void yaffs_read_inode(struct inode *inode) - { - /* NB This is called as a side effect of other functions, but -@@ -1448,6 +1495,7 @@ static void yaffs_read_inode(struct inod - - yaffs_GrossUnlock(dev); - } -+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)) */ - - static LIST_HEAD(yaffs_dev_list); - diff --git a/target/linux/generic-2.6/patches-2.6.27/513-yaffs_2.6.26_fix.patch b/target/linux/generic-2.6/patches-2.6.27/513-yaffs_2.6.26_fix.patch deleted file mode 100644 index 11594547d..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/513-yaffs_2.6.26_fix.patch +++ /dev/null @@ -1,69 +0,0 @@ ---- a/fs/yaffs2/yaffs_fs.c -+++ b/fs/yaffs2/yaffs_fs.c -@@ -76,6 +76,12 @@ extern const char *yaffs_guts_c_version; - - #endif - -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) -+#define YPROC_ROOT &proc_root -+#else -+#define YPROC_ROOT NULL -+#endif -+ - #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) - #define WRITE_SIZE_STR "writesize" - #define WRITE_SIZE(mtd) (mtd)->writesize -@@ -189,7 +195,9 @@ static void yaffs_read_inode(struct inod - #endif - - -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) - static void yaffs_put_inode(struct inode *inode); -+#endif - static void yaffs_delete_inode(struct inode *); - static void yaffs_clear_inode(struct inode *); - -@@ -293,7 +301,9 @@ static struct super_operations yaffs_sup - #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)) - .read_inode = yaffs_read_inode, - #endif -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) - .put_inode = yaffs_put_inode, -+#endif - .put_super = yaffs_put_super, - .delete_inode = yaffs_delete_inode, - .clear_inode = yaffs_clear_inode, -@@ -437,6 +447,7 @@ static struct dentry *yaffs_lookup(struc - - } - -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) - /* For now put inode is just for debugging - * Put inode is called when the inode **structure** is put. - */ -@@ -447,6 +458,7 @@ static void yaffs_put_inode(struct inode - atomic_read(&inode->i_count))); - - } -+#endif - - /* clear is called to tell the fs to release any per-inode data it holds */ - static void yaffs_clear_inode(struct inode *inode) -@@ -2279,7 +2291,7 @@ static int __init init_yaffs_fs(void) - /* Install the proc_fs entry */ - my_proc_entry = create_proc_entry("yaffs", - S_IRUGO | S_IFREG, -- &proc_root); -+ YPROC_ROOT); - - if (my_proc_entry) { - my_proc_entry->write_proc = yaffs_proc_write; -@@ -2325,7 +2337,7 @@ static void __exit exit_yaffs_fs(void) - T(YAFFS_TRACE_ALWAYS, ("yaffs " __DATE__ " " __TIME__ - " removing. \n")); - -- remove_proc_entry("yaffs", &proc_root); -+ remove_proc_entry("yaffs", YPROC_ROOT); - - fsinst = fs_to_install; - diff --git a/target/linux/generic-2.6/patches-2.6.27/600-phy_extension.patch b/target/linux/generic-2.6/patches-2.6.27/600-phy_extension.patch deleted file mode 100644 index cacb7483a..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/600-phy_extension.patch +++ /dev/null @@ -1,83 +0,0 @@ ---- a/drivers/net/phy/phy.c -+++ b/drivers/net/phy/phy.c -@@ -348,6 +348,50 @@ int phy_ethtool_gset(struct phy_device * - } - EXPORT_SYMBOL(phy_ethtool_gset); - -+int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr) -+{ -+ u32 cmd; -+ int tmp; -+ struct ethtool_cmd ecmd = { ETHTOOL_GSET }; -+ struct ethtool_value edata = { ETHTOOL_GLINK }; -+ -+ if (get_user(cmd, (u32 *) useraddr)) -+ return -EFAULT; -+ -+ switch (cmd) { -+ case ETHTOOL_GSET: -+ phy_ethtool_gset(phydev, &ecmd); -+ if (copy_to_user(useraddr, &ecmd, sizeof(ecmd))) -+ return -EFAULT; -+ return 0; -+ -+ case ETHTOOL_SSET: -+ if (copy_from_user(&ecmd, useraddr, sizeof(ecmd))) -+ return -EFAULT; -+ return phy_ethtool_sset(phydev, &ecmd); -+ -+ case ETHTOOL_NWAY_RST: -+ /* if autoneg is off, it's an error */ -+ tmp = phy_read(phydev, MII_BMCR); -+ if (tmp & BMCR_ANENABLE) { -+ tmp |= (BMCR_ANRESTART); -+ phy_write(phydev, MII_BMCR, tmp); -+ return 0; -+ } -+ return -EINVAL; -+ -+ case ETHTOOL_GLINK: -+ edata.data = (phy_read(phydev, -+ MII_BMSR) & BMSR_LSTATUS) ? 1 : 0; -+ if (copy_to_user(useraddr, &edata, sizeof(edata))) -+ return -EFAULT; -+ return 0; -+ } -+ -+ return -EOPNOTSUPP; -+} -+EXPORT_SYMBOL(phy_ethtool_ioctl); -+ - /** - * phy_mii_ioctl - generic PHY MII ioctl interface - * @phydev: the phy_device struct -@@ -403,8 +447,8 @@ int phy_mii_ioctl(struct phy_device *phy - } - - phy_write(phydev, mii_data->reg_num, val); -- -- if (mii_data->reg_num == MII_BMCR -+ -+ if (mii_data->reg_num == MII_BMCR - && val & BMCR_RESET - && phydev->drv->config_init) { - phy_scan_fixups(phydev); -@@ -524,7 +568,7 @@ static void phy_force_reduction(struct p - int idx; - - idx = phy_find_setting(phydev->speed, phydev->duplex); -- -+ - idx++; - - idx = phy_find_valid(idx, phydev->supported); ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -434,6 +434,7 @@ void phy_start_machine(struct phy_device - void phy_stop_machine(struct phy_device *phydev); - int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd); - int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd); -+int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr); - int phy_mii_ioctl(struct phy_device *phydev, - struct mii_ioctl_data *mii_data, int cmd); - int phy_start_interrupts(struct phy_device *phydev); diff --git a/target/linux/generic-2.6/patches-2.6.27/620-phy_adm6996.patch b/target/linux/generic-2.6/patches-2.6.27/620-phy_adm6996.patch deleted file mode 100644 index 7c98a0f51..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/620-phy_adm6996.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -66,6 +66,11 @@ config REALTEK_PHY - ---help--- - Supports the Realtek 821x PHY. - -+config ADM6996_PHY -+ tristate "Driver for ADM6996 switches" -+ ---help--- -+ Currently supports the ADM6996F switch -+ - config FIXED_PHY - bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" - depends on PHYLIB=y ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -12,6 +12,7 @@ obj-$(CONFIG_SMSC_PHY) += smsc.o - obj-$(CONFIG_VITESSE_PHY) += vitesse.o - obj-$(CONFIG_BROADCOM_PHY) += broadcom.o - obj-$(CONFIG_ICPLUS_PHY) += icplus.o -+obj-$(CONFIG_ADM6996_PHY) += adm6996.o - obj-$(CONFIG_REALTEK_PHY) += realtek.o - obj-$(CONFIG_FIXED_PHY) += fixed.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic-2.6/patches-2.6.27/630-phy_packets.patch b/target/linux/generic-2.6/patches-2.6.27/630-phy_packets.patch deleted file mode 100644 index b4e8b4dbe..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/630-phy_packets.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- a/drivers/net/phy/phy_device.c -+++ b/drivers/net/phy/phy_device.c -@@ -143,6 +143,18 @@ int phy_scan_fixups(struct phy_device *p - } - EXPORT_SYMBOL(phy_scan_fixups); - -+static int generic_receive_skb(struct sk_buff *skb) -+{ -+ skb->protocol = eth_type_trans(skb, skb->dev); -+ return netif_receive_skb(skb); -+} -+ -+static int generic_rx(struct sk_buff *skb) -+{ -+ skb->protocol = eth_type_trans(skb, skb->dev); -+ return netif_rx(skb); -+} -+ - struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) - { - struct phy_device *dev; -@@ -168,6 +180,8 @@ struct phy_device* phy_device_create(str - dev->bus = bus; - - dev->state = PHY_DOWN; -+ dev->netif_receive_skb = &generic_receive_skb; -+ dev->netif_rx = &generic_rx; - - mutex_init(&dev->lock); - ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -309,6 +309,20 @@ struct phy_device { - void (*adjust_link)(struct net_device *dev); - - void (*adjust_state)(struct net_device *dev); -+ -+ /* -+ * By default these point to the original functions -+ * with the same name. adding them to the phy_device -+ * allows the phy driver to override them for packet -+ * mangling if the ethernet driver supports it -+ * This is required to support some really horrible -+ * switches such as the Marvell 88E6060 -+ */ -+ int (*netif_receive_skb)(struct sk_buff *skb); -+ int (*netif_rx)(struct sk_buff *skb); -+ -+ /* alignment offset for packets */ -+ int pkt_align; - }; - #define to_phy_device(d) container_of(d, struct phy_device, dev) - ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -613,6 +613,7 @@ struct net_device - void *ax25_ptr; /* AX.25 specific data */ - struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data, - assign before registering */ -+ void *phy_ptr; /* PHY device specific data */ - - /* - * Cache line mostly used on receive path (including eth_type_trans()) diff --git a/target/linux/generic-2.6/patches-2.6.27/640-mvswitch.patch b/target/linux/generic-2.6/patches-2.6.27/640-mvswitch.patch deleted file mode 100644 index 1810be9a3..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/640-mvswitch.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -71,6 +71,12 @@ config ADM6996_PHY - ---help--- - Currently supports the ADM6996F switch - -+config MVSWITCH_PHY -+ tristate "Driver for Marvell switches" -+ select VLAN_8021Q -+ ---help--- -+ Currently supports the Marvell 88E6060 switch. -+ - config FIXED_PHY - bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" - depends on PHYLIB=y ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -13,6 +13,7 @@ obj-$(CONFIG_VITESSE_PHY) += vitesse.o - obj-$(CONFIG_BROADCOM_PHY) += broadcom.o - obj-$(CONFIG_ICPLUS_PHY) += icplus.o - obj-$(CONFIG_ADM6996_PHY) += adm6996.o -+obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o - obj-$(CONFIG_REALTEK_PHY) += realtek.o - obj-$(CONFIG_FIXED_PHY) += fixed.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o ---- a/drivers/net/phy/mdio_bus.c -+++ b/drivers/net/phy/mdio_bus.c -@@ -35,6 +35,12 @@ - #include - #include - -+static void mdio_dev_release(struct device *dev) -+{ -+ /* nothing to do */ -+} -+ -+ - /** - * mdiobus_register - bring up all the PHYs on a given bus and attach them to bus - * @bus: target mii_bus -@@ -85,6 +91,7 @@ int mdiobus_register(struct mii_bus *bus - - phydev->dev.parent = bus->dev; - phydev->dev.bus = &mdio_bus_type; -+ phydev->dev.release = mdio_dev_release; - snprintf(phydev->dev.bus_id, BUS_ID_SIZE, PHY_ID_FMT, bus->id, i); - - phydev->bus = bus; diff --git a/target/linux/generic-2.6/patches-2.6.27/650-swconfig.patch b/target/linux/generic-2.6/patches-2.6.27/650-swconfig.patch deleted file mode 100644 index 6825037ce..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/650-swconfig.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -13,6 +13,12 @@ menuconfig PHYLIB - - if PHYLIB - -+config SWCONFIG -+ tristate "Switch configuration API" -+ ---help--- -+ Switch configuration API using netlink. This allows -+ you to configure the VLAN features of certain switches. -+ - comment "MII PHY device drivers" - - config MARVELL_PHY ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -3,6 +3,7 @@ - libphy-objs := phy.o phy_device.o mdio_bus.o - - obj-$(CONFIG_PHYLIB) += libphy.o -+obj-$(CONFIG_SWCONFIG) += swconfig.o - obj-$(CONFIG_MARVELL_PHY) += marvell.o - obj-$(CONFIG_DAVICOM_PHY) += davicom.o - obj-$(CONFIG_CICADA_PHY) += cicada.o diff --git a/target/linux/generic-2.6/patches-2.6.27/801-usb_serial_endpoint_size.patch b/target/linux/generic-2.6/patches-2.6.27/801-usb_serial_endpoint_size.patch deleted file mode 100644 index 78681d2b4..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/801-usb_serial_endpoint_size.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/drivers/usb/serial/usb-serial.c -+++ b/drivers/usb/serial/usb-serial.c -@@ -59,6 +59,7 @@ static struct usb_driver usb_serial_driv - drivers depend on it. - */ - -+static ushort maxSize = 0; - static int debug; - /* initially all NULL */ - static struct usb_serial *serial_table[SERIAL_TTY_MINORS]; -@@ -856,7 +857,7 @@ int usb_serial_probe(struct usb_interfac - dev_err(&interface->dev, "No free urbs available\n"); - goto probe_error; - } -- buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); -+ buffer_size = (endpoint->wMaxPacketSize > maxSize) ? endpoint->wMaxPacketSize : maxSize; - port->bulk_in_size = buffer_size; - port->bulk_in_endpointAddress = endpoint->bEndpointAddress; - port->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL); -@@ -1292,3 +1293,5 @@ MODULE_LICENSE("GPL"); - - module_param(debug, bool, S_IRUGO | S_IWUSR); - MODULE_PARM_DESC(debug, "Debug enabled or not"); -+module_param(maxSize, ushort,0); -+MODULE_PARM_DESC(maxSize,"User specified USB endpoint size"); diff --git a/target/linux/generic-2.6/patches-2.6.27/840-unable_to_open_console.patch b/target/linux/generic-2.6/patches-2.6.27/840-unable_to_open_console.patch deleted file mode 100644 index b109b0e7c..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/840-unable_to_open_console.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/init/main.c -+++ b/init/main.c -@@ -801,7 +801,7 @@ static int noinline init_post(void) - numa_default_policy(); - - if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) -- printk(KERN_WARNING "Warning: unable to open an initial console.\n"); -+ printk(KERN_WARNING "Please be patient, while OpenWrt loads ...\n"); - - (void) sys_dup(0); - (void) sys_dup(0); diff --git a/target/linux/generic-2.6/patches-2.6.27/900-headers_type_and_time.patch b/target/linux/generic-2.6/patches-2.6.27/900-headers_type_and_time.patch deleted file mode 100644 index 6350cb9fe..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/900-headers_type_and_time.patch +++ /dev/null @@ -1,46 +0,0 @@ ---- a/include/linux/time.h -+++ b/include/linux/time.h -@@ -1,6 +1,10 @@ - #ifndef _LINUX_TIME_H - #define _LINUX_TIME_H - -+#ifndef __KERNEL__ -+#include -+#else -+ - #include - - #ifdef __KERNEL__ -@@ -229,4 +233,6 @@ struct itimerval { - */ - #define TIMER_ABSTIME 0x01 - -+#endif /* __KERNEL__ DEBIAN */ -+ - #endif ---- a/include/linux/types.h -+++ b/include/linux/types.h -@@ -1,6 +1,14 @@ - #ifndef _LINUX_TYPES_H - #define _LINUX_TYPES_H - -+/* Debian: Use userland types instead. */ -+#ifndef __KERNEL__ -+# include -+/* For other kernel headers. */ -+# include -+# include -+#else -+ - #ifdef __KERNEL__ - - #define DECLARE_BITMAP(name,bits) \ -@@ -161,6 +169,8 @@ typedef unsigned long blkcnt_t; - - #endif /* __KERNEL_STRICT_NAMES */ - -+#endif /* __KERNEL__ DEBIAN */ -+ - /* - * Below are truly Linux-specific types that should never collide with - * any application/library that wants linux/types.h. diff --git a/target/linux/generic-2.6/patches-2.6.27/902-darwin_scripts_include.patch b/target/linux/generic-2.6/patches-2.6.27/902-darwin_scripts_include.patch deleted file mode 100644 index b59027d7c..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/902-darwin_scripts_include.patch +++ /dev/null @@ -1,102 +0,0 @@ ---- a/scripts/genksyms/parse.c_shipped -+++ b/scripts/genksyms/parse.c_shipped -@@ -160,7 +160,9 @@ - - - #include -+#ifndef __APPLE__ - #include -+#endif - #include "genksyms.h" - - static int is_typedef; ---- a/scripts/genksyms/parse.y -+++ b/scripts/genksyms/parse.y -@@ -24,7 +24,9 @@ - %{ - - #include -+#ifndef __APPLE__ - #include -+#endif - #include "genksyms.h" - - static int is_typedef; ---- a/scripts/kallsyms.c -+++ b/scripts/kallsyms.c -@@ -22,6 +22,35 @@ - #include - #include - #include -+#ifdef __APPLE__ -+/* Darwin has no memmem implementation, this one is ripped of the uClibc-0.9.28 source */ -+void *memmem (const void *haystack, size_t haystack_len, -+ const void *needle, size_t needle_len) -+{ -+ const char *begin; -+ const char *const last_possible -+ = (const char *) haystack + haystack_len - needle_len; -+ -+ if (needle_len == 0) -+ /* The first occurrence of the empty string is deemed to occur at -+ the beginning of the string. */ -+ return (void *) haystack; -+ -+ /* Sanity check, otherwise the loop might search through the whole -+ memory. */ -+ if (__builtin_expect (haystack_len < needle_len, 0)) -+ return NULL; -+ -+ for (begin = (const char *) haystack; begin <= last_possible; ++begin) -+ if (begin[0] == ((const char *) needle)[0] && -+ !memcmp ((const void *) &begin[1], -+ (const void *) ((const char *) needle + 1), -+ needle_len - 1)) -+ return (void *) begin; -+ -+ return NULL; -+} -+#endif - - #define KSYM_NAME_LEN 128 - ---- a/scripts/kconfig/Makefile -+++ b/scripts/kconfig/Makefile -@@ -93,6 +93,9 @@ check-lxdialog := $(srctree)/$(src)/lxd - # we really need to do so. (Do not call gcc as part of make mrproper) - HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) - HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) -+ifeq ($(shell uname -s),Darwin) -+HOST_LOADLIBES += -lncurses -+endif - - HOST_EXTRACFLAGS += -DLOCALE - ---- a/scripts/mod/mk_elfconfig.c -+++ b/scripts/mod/mk_elfconfig.c -@@ -1,7 +1,11 @@ - #include - #include - #include -+#ifndef __APPLE__ - #include -+#else -+#include "../../../../../tools/sstrip/include/elf.h" -+#endif - - int - main(int argc, char **argv) ---- a/scripts/mod/modpost.h -+++ b/scripts/mod/modpost.h -@@ -7,7 +7,11 @@ - #include - #include - #include -+#if !(defined(__APPLE__) || defined(__CYGWIN__)) - #include -+#else -+#include "../../../../../tools/sstrip/include/elf.h" -+#endif - - #include "elfconfig.h" - diff --git a/target/linux/generic-2.6/patches-2.6.27/903-hostap_txpower.patch b/target/linux/generic-2.6/patches-2.6.27/903-hostap_txpower.patch deleted file mode 100644 index 6b4fc9f23..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/903-hostap_txpower.patch +++ /dev/null @@ -1,154 +0,0 @@ ---- a/drivers/net/wireless/hostap/hostap_ap.c -+++ b/drivers/net/wireless/hostap/hostap_ap.c -@@ -2397,13 +2397,13 @@ int prism2_ap_get_sta_qual(local_info_t - addr[count].sa_family = ARPHRD_ETHER; - memcpy(addr[count].sa_data, sta->addr, ETH_ALEN); - if (sta->last_rx_silence == 0) -- qual[count].qual = sta->last_rx_signal < 27 ? -- 0 : (sta->last_rx_signal - 27) * 92 / 127; -+ qual[count].qual = (sta->last_rx_signal - 156) == 0 ? -+ 0 : (sta->last_rx_signal - 156) * 92 / 64; - else -- qual[count].qual = sta->last_rx_signal - -- sta->last_rx_silence - 35; -- qual[count].level = HFA384X_LEVEL_TO_dBm(sta->last_rx_signal); -- qual[count].noise = HFA384X_LEVEL_TO_dBm(sta->last_rx_silence); -+ qual[count].qual = (sta->last_rx_signal - -+ sta->last_rx_silence) * 92 / 64; -+ qual[count].level = sta->last_rx_signal; -+ qual[count].noise = sta->last_rx_silence; - qual[count].updated = sta->last_rx_updated; - - sta->last_rx_updated = IW_QUAL_DBM; -@@ -2469,13 +2469,13 @@ int prism2_ap_translate_scan(struct net_ - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVQUAL; - if (sta->last_rx_silence == 0) -- iwe.u.qual.qual = sta->last_rx_signal < 27 ? -- 0 : (sta->last_rx_signal - 27) * 92 / 127; -+ iwe.u.qual.qual = (sta->last_rx_signal -156) == 0 ? -+ 0 : (sta->last_rx_signal - 156) * 92 / 64; - else -- iwe.u.qual.qual = sta->last_rx_signal - -- sta->last_rx_silence - 35; -- iwe.u.qual.level = HFA384X_LEVEL_TO_dBm(sta->last_rx_signal); -- iwe.u.qual.noise = HFA384X_LEVEL_TO_dBm(sta->last_rx_silence); -+ iwe.u.qual.qual = (sta->last_rx_signal - -+ sta->last_rx_silence) * 92 / 64; -+ iwe.u.qual.level = sta->last_rx_signal; -+ iwe.u.qual.noise = sta->last_rx_silence; - iwe.u.qual.updated = sta->last_rx_updated; - iwe.len = IW_EV_QUAL_LEN; - current_ev = iwe_stream_add_event(info, current_ev, end_buf, ---- a/drivers/net/wireless/hostap/hostap_config.h -+++ b/drivers/net/wireless/hostap/hostap_config.h -@@ -45,4 +45,9 @@ - */ - /* #define PRISM2_NO_STATION_MODES */ - -+/* Enable TX power Setting functions -+ * (min att = -128 , max att = 127) -+ */ -+#define RAW_TXPOWER_SETTING -+ - #endif /* HOSTAP_CONFIG_H */ ---- a/drivers/net/wireless/hostap/hostap.h -+++ b/drivers/net/wireless/hostap/hostap.h -@@ -90,6 +90,7 @@ extern const struct iw_handler_def hosta - extern const struct ethtool_ops prism2_ethtool_ops; - - int hostap_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); -+int hostap_restore_power(struct net_device *dev); - - - #endif /* HOSTAP_H */ ---- a/drivers/net/wireless/hostap/hostap_hw.c -+++ b/drivers/net/wireless/hostap/hostap_hw.c -@@ -933,6 +933,7 @@ static int hfa384x_set_rid(struct net_de - prism2_hw_reset(dev); - } - -+ hostap_restore_power(dev); - return res; - } - ---- a/drivers/net/wireless/hostap/hostap_info.c -+++ b/drivers/net/wireless/hostap/hostap_info.c -@@ -434,6 +434,11 @@ static void handle_info_queue_linkstatus - } - - /* Get BSSID if we have a valid AP address */ -+ -+ if ( val == HFA384X_LINKSTATUS_CONNECTED || -+ val == HFA384X_LINKSTATUS_DISCONNECTED ) -+ hostap_restore_power(local->dev); -+ - if (connected) { - netif_carrier_on(local->dev); - netif_carrier_on(local->ddev); ---- a/drivers/net/wireless/hostap/hostap_ioctl.c -+++ b/drivers/net/wireless/hostap/hostap_ioctl.c -@@ -1502,23 +1502,20 @@ static int prism2_txpower_hfa386x_to_dBm - val = 255; - - tmp = val; -- tmp >>= 2; - -- return -12 - tmp; -+ return tmp; - } - - static u16 prism2_txpower_dBm_to_hfa386x(int val) - { - signed char tmp; - -- if (val > 20) -- return 128; -- else if (val < -43) -+ if (val > 127) - return 127; -+ else if (val < -128) -+ return 128; - - tmp = val; -- tmp = -12 - tmp; -- tmp <<= 2; - - return (unsigned char) tmp; - } -@@ -4083,3 +4080,35 @@ int hostap_ioctl(struct net_device *dev, - - return ret; - } -+ -+/* BUG FIX: Restore power setting value when lost due to F/W bug */ -+ -+int hostap_restore_power(struct net_device *dev) -+{ -+ struct hostap_interface *iface = dev->priv; -+ local_info_t *local = iface->local; -+ -+ u16 val; -+ int ret = 0; -+ -+ if (local->txpower_type == PRISM2_TXPOWER_OFF) { -+ val = 0xff; /* use all standby and sleep modes */ -+ ret = local->func->cmd(dev, HFA384X_CMDCODE_WRITEMIF, -+ HFA386X_CR_A_D_TEST_MODES2, -+ &val, NULL); -+ } -+ -+#ifdef RAW_TXPOWER_SETTING -+ if (local->txpower_type == PRISM2_TXPOWER_FIXED) { -+ val = HFA384X_TEST_CFG_BIT_ALC; -+ local->func->cmd(dev, HFA384X_CMDCODE_TEST | -+ (HFA384X_TEST_CFG_BITS << 8), 0, &val, NULL); -+ val = prism2_txpower_dBm_to_hfa386x(local->txpower); -+ ret = (local->func->cmd(dev, HFA384X_CMDCODE_WRITEMIF, -+ HFA386X_CR_MANUAL_TX_POWER, &val, NULL)); -+ } -+#endif /* RAW_TXPOWER_SETTING */ -+ return (ret ? -EOPNOTSUPP : 0); -+} -+ -+EXPORT_SYMBOL(hostap_restore_power); diff --git a/target/linux/generic-2.6/patches-2.6.27/903-stddef_include.patch b/target/linux/generic-2.6/patches-2.6.27/903-stddef_include.patch deleted file mode 100644 index 7fe248d8d..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/903-stddef_include.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/include/linux/stddef.h -+++ b/include/linux/stddef.h -@@ -16,6 +16,7 @@ enum { - false = 0, - true = 1 - }; -+#endif /* __KERNEL__ */ - - #undef offsetof - #ifdef __compiler_offsetof -@@ -23,6 +24,5 @@ enum { - #else - #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) - #endif --#endif /* __KERNEL__ */ - - #endif diff --git a/target/linux/generic-2.6/patches-2.6.27/905-i386_build.patch b/target/linux/generic-2.6/patches-2.6.27/905-i386_build.patch deleted file mode 100644 index c701fdaa9..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/905-i386_build.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/arch/x86/boot/tools/build.c -+++ b/arch/x86/boot/tools/build.c -@@ -29,7 +29,6 @@ - #include - #include - #include --#include - #include - #include - #include diff --git a/target/linux/generic-2.6/patches-2.6.27/921-gpio_spi_driver.patch b/target/linux/generic-2.6/patches-2.6.27/921-gpio_spi_driver.patch deleted file mode 100644 index 590a2230f..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/921-gpio_spi_driver.patch +++ /dev/null @@ -1,376 +0,0 @@ ---- /dev/null -+++ b/include/linux/spi/spi_gpio.h -@@ -0,0 +1,73 @@ -+/* -+ * spi_gpio interface to platform code -+ * -+ * Copyright (c) 2008 Piotr Skamruk -+ * Copyright (c) 2008 Michael Buesch -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+#ifndef _LINUX_SPI_SPI_GPIO -+#define _LINUX_SPI_SPI_GPIO -+ -+#include -+#include -+ -+ -+/** -+ * struct spi_gpio_platform_data - Data definitions for a SPI-GPIO device. -+ * -+ * This structure holds information about a GPIO-based SPI device. -+ * -+ * @pin_clk: The GPIO pin number of the CLOCK pin. -+ * -+ * @pin_miso: The GPIO pin number of the MISO pin. -+ * -+ * @pin_mosi: The GPIO pin number of the MOSI pin. -+ * -+ * @pin_cs: The GPIO pin number of the CHIPSELECT pin. -+ * -+ * @cs_activelow: If true, the chip is selected when the CS line is low. -+ * -+ * @no_spi_delay: If true, no delay is done in the lowlevel bitbanging. -+ * Note that doing no delay is not standards compliant, -+ * but it might be needed to speed up transfers on some -+ * slow embedded machines. -+ * -+ * @boardinfo_setup: This callback is called after the -+ * SPI master device was registered, but before the -+ * device is registered. -+ * @boardinfo_setup_data: Data argument passed to boardinfo_setup(). -+ */ -+struct spi_gpio_platform_data { -+ unsigned int pin_clk; -+ unsigned int pin_miso; -+ unsigned int pin_mosi; -+ unsigned int pin_cs; -+ bool cs_activelow; -+ bool no_spi_delay; -+ int (*boardinfo_setup)(struct spi_board_info *bi, -+ struct spi_master *master, -+ void *data); -+ void *boardinfo_setup_data; -+}; -+ -+/** -+ * SPI_GPIO_PLATDEV_NAME - The platform device name string. -+ * -+ * The name string that has to be used for platform_device_alloc -+ * when allocating a spi-gpio device. -+ */ -+#define SPI_GPIO_PLATDEV_NAME "spi-gpio" -+ -+/** -+ * spi_gpio_next_id - Get another platform device ID number. -+ * -+ * This returns the next platform device ID number that has to be used -+ * for platform_device_alloc. The ID is opaque and should not be used for -+ * anything else. -+ */ -+int spi_gpio_next_id(void); -+ -+#endif /* _LINUX_SPI_SPI_GPIO */ ---- /dev/null -+++ b/drivers/spi/spi_gpio.c -@@ -0,0 +1,251 @@ -+/* -+ * Bitbanging SPI bus driver using GPIO API -+ * -+ * Copyright (c) 2008 Piotr Skamruk -+ * Copyright (c) 2008 Michael Buesch -+ * -+ * based on spi_s3c2410_gpio.c -+ * Copyright (c) 2006 Ben Dooks -+ * Copyright (c) 2006 Simtec Electronics -+ * and on i2c-gpio.c -+ * Copyright (C) 2007 Atmel Corporation -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+ -+struct spi_gpio { -+ struct spi_bitbang bitbang; -+ struct spi_gpio_platform_data *info; -+ struct platform_device *pdev; -+ struct spi_board_info bi; -+}; -+ -+ -+static inline struct spi_gpio *spidev_to_sg(struct spi_device *dev) -+{ -+ return dev->controller_data; -+} -+ -+static inline void setsck(struct spi_device *dev, int val) -+{ -+ struct spi_gpio *sp = spidev_to_sg(dev); -+ gpio_set_value(sp->info->pin_clk, val ? 1 : 0); -+} -+ -+static inline void setmosi(struct spi_device *dev, int val) -+{ -+ struct spi_gpio *sp = spidev_to_sg(dev); -+ gpio_set_value(sp->info->pin_mosi, val ? 1 : 0); -+} -+ -+static inline u32 getmiso(struct spi_device *dev) -+{ -+ struct spi_gpio *sp = spidev_to_sg(dev); -+ return gpio_get_value(sp->info->pin_miso) ? 1 : 0; -+} -+ -+static inline void do_spidelay(struct spi_device *dev, unsigned nsecs) -+{ -+ struct spi_gpio *sp = spidev_to_sg(dev); -+ -+ if (!sp->info->no_spi_delay) -+ ndelay(nsecs); -+} -+ -+#define spidelay(nsecs) do { \ -+ /* Steal the spi_device pointer from our caller. \ -+ * The bitbang-API should probably get fixed here... */ \ -+ do_spidelay(spi, nsecs); \ -+ } while (0) -+ -+#define EXPAND_BITBANG_TXRX -+#include -+ -+static u32 spi_gpio_txrx_mode0(struct spi_device *spi, -+ unsigned nsecs, u32 word, u8 bits) -+{ -+ return bitbang_txrx_be_cpha0(spi, nsecs, 0, word, bits); -+} -+ -+static u32 spi_gpio_txrx_mode1(struct spi_device *spi, -+ unsigned nsecs, u32 word, u8 bits) -+{ -+ return bitbang_txrx_be_cpha1(spi, nsecs, 0, word, bits); -+} -+ -+static u32 spi_gpio_txrx_mode2(struct spi_device *spi, -+ unsigned nsecs, u32 word, u8 bits) -+{ -+ return bitbang_txrx_be_cpha0(spi, nsecs, 1, word, bits); -+} -+ -+static u32 spi_gpio_txrx_mode3(struct spi_device *spi, -+ unsigned nsecs, u32 word, u8 bits) -+{ -+ return bitbang_txrx_be_cpha1(spi, nsecs, 1, word, bits); -+} -+ -+static void spi_gpio_chipselect(struct spi_device *dev, int on) -+{ -+ struct spi_gpio *sp = spidev_to_sg(dev); -+ -+ if (sp->info->cs_activelow) -+ on = !on; -+ gpio_set_value(sp->info->pin_cs, on ? 1 : 0); -+} -+ -+static int spi_gpio_probe(struct platform_device *pdev) -+{ -+ struct spi_master *master; -+ struct spi_gpio_platform_data *pdata; -+ struct spi_gpio *sp; -+ struct spi_device *spidev; -+ int err; -+ -+ pdata = pdev->dev.platform_data; -+ if (!pdata) -+ return -ENXIO; -+ -+ err = -ENOMEM; -+ master = spi_alloc_master(&pdev->dev, sizeof(struct spi_gpio)); -+ if (!master) -+ goto err_alloc_master; -+ -+ sp = spi_master_get_devdata(master); -+ platform_set_drvdata(pdev, sp); -+ sp->info = pdata; -+ -+ err = gpio_request(pdata->pin_clk, "spi_clock"); -+ if (err) -+ goto err_request_clk; -+ err = gpio_request(pdata->pin_mosi, "spi_mosi"); -+ if (err) -+ goto err_request_mosi; -+ err = gpio_request(pdata->pin_miso, "spi_miso"); -+ if (err) -+ goto err_request_miso; -+ err = gpio_request(pdata->pin_cs, "spi_cs"); -+ if (err) -+ goto err_request_cs; -+ -+ sp->bitbang.master = spi_master_get(master); -+ sp->bitbang.master->bus_num = -1; -+ sp->bitbang.master->num_chipselect = 1; -+ sp->bitbang.chipselect = spi_gpio_chipselect; -+ sp->bitbang.txrx_word[SPI_MODE_0] = spi_gpio_txrx_mode0; -+ sp->bitbang.txrx_word[SPI_MODE_1] = spi_gpio_txrx_mode1; -+ sp->bitbang.txrx_word[SPI_MODE_2] = spi_gpio_txrx_mode2; -+ sp->bitbang.txrx_word[SPI_MODE_3] = spi_gpio_txrx_mode3; -+ -+ gpio_direction_output(pdata->pin_clk, 0); -+ gpio_direction_output(pdata->pin_mosi, 0); -+ gpio_direction_output(pdata->pin_cs, -+ pdata->cs_activelow ? 1 : 0); -+ gpio_direction_input(pdata->pin_miso); -+ -+ err = spi_bitbang_start(&sp->bitbang); -+ if (err) -+ goto err_no_bitbang; -+ err = pdata->boardinfo_setup(&sp->bi, master, -+ pdata->boardinfo_setup_data); -+ if (err) -+ goto err_bi_setup; -+ sp->bi.controller_data = sp; -+ spidev = spi_new_device(master, &sp->bi); -+ if (!spidev) -+ goto err_new_dev; -+ -+ return 0; -+ -+err_new_dev: -+err_bi_setup: -+ spi_bitbang_stop(&sp->bitbang); -+err_no_bitbang: -+ spi_master_put(sp->bitbang.master); -+ gpio_free(pdata->pin_cs); -+err_request_cs: -+ gpio_free(pdata->pin_miso); -+err_request_miso: -+ gpio_free(pdata->pin_mosi); -+err_request_mosi: -+ gpio_free(pdata->pin_clk); -+err_request_clk: -+ kfree(master); -+ -+err_alloc_master: -+ return err; -+} -+ -+static int __devexit spi_gpio_remove(struct platform_device *pdev) -+{ -+ struct spi_gpio *sp; -+ struct spi_gpio_platform_data *pdata; -+ -+ pdata = pdev->dev.platform_data; -+ sp = platform_get_drvdata(pdev); -+ -+ gpio_free(pdata->pin_clk); -+ gpio_free(pdata->pin_mosi); -+ gpio_free(pdata->pin_miso); -+ gpio_free(pdata->pin_cs); -+ spi_bitbang_stop(&sp->bitbang); -+ spi_master_put(sp->bitbang.master); -+ -+ return 0; -+} -+ -+static struct platform_driver spi_gpio_driver = { -+ .driver = { -+ .name = SPI_GPIO_PLATDEV_NAME, -+ .owner = THIS_MODULE, -+ }, -+ .probe = spi_gpio_probe, -+ .remove = __devexit_p(spi_gpio_remove), -+}; -+ -+int spi_gpio_next_id(void) -+{ -+ static atomic_t counter = ATOMIC_INIT(-1); -+ -+ return atomic_inc_return(&counter); -+} -+EXPORT_SYMBOL(spi_gpio_next_id); -+ -+static int __init spi_gpio_init(void) -+{ -+ int err; -+ -+ err = platform_driver_register(&spi_gpio_driver); -+ if (err) -+ printk(KERN_ERR "spi-gpio: register failed: %d\n", err); -+ -+ return err; -+} -+module_init(spi_gpio_init); -+ -+static void __exit spi_gpio_exit(void) -+{ -+ platform_driver_unregister(&spi_gpio_driver); -+} -+module_exit(spi_gpio_exit); -+ -+MODULE_AUTHOR("Piot Skamruk "); -+MODULE_AUTHOR("Michael Buesch"); -+MODULE_DESCRIPTION("Platform independent GPIO bitbanging SPI driver"); -+MODULE_LICENSE("GPL v2"); ---- a/drivers/spi/Kconfig -+++ b/drivers/spi/Kconfig -@@ -100,6 +100,19 @@ config SPI_BUTTERFLY - inexpensive battery powered microcontroller evaluation board. - This same cable can be used to flash new firmware. - -+config SPI_GPIO -+ tristate "GPIO API based bitbanging SPI controller" -+ depends on SPI_MASTER && GENERIC_GPIO -+ select SPI_BITBANG -+ help -+ This is a platform driver that can be used for bitbanging -+ an SPI bus over GPIO pins. -+ Select this if you have any SPI device that is connected via -+ GPIO pins. -+ The module will be called spi_gpio. -+ -+ If unsure, say N. -+ - config SPI_IMX - tristate "Freescale iMX SPI controller" - depends on ARCH_IMX && EXPERIMENTAL ---- a/drivers/spi/Makefile -+++ b/drivers/spi/Makefile -@@ -16,6 +16,7 @@ obj-$(CONFIG_SPI_BFIN) += spi_bfin5xx. - obj-$(CONFIG_SPI_BITBANG) += spi_bitbang.o - obj-$(CONFIG_SPI_AU1550) += au1550_spi.o - obj-$(CONFIG_SPI_BUTTERFLY) += spi_butterfly.o -+obj-$(CONFIG_SPI_GPIO) += spi_gpio.o - obj-$(CONFIG_SPI_IMX) += spi_imx.o - obj-$(CONFIG_SPI_LM70_LLP) += spi_lm70llp.o - obj-$(CONFIG_SPI_PXA2XX) += pxa2xx_spi.o ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -3854,6 +3854,11 @@ L: cbe-oss-dev@ozlabs.org - W: http://www.ibm.com/developerworks/power/cell/ - S: Supported - -+SPI GPIO MASTER DRIVER -+P: Michael Buesch -+M: mb@bu3sch.de -+S: Maintained -+ - STABLE BRANCH: - P: Greg Kroah-Hartman - M: greg@kroah.com diff --git a/target/linux/generic-2.6/patches-2.6.27/922-gpiommc.patch b/target/linux/generic-2.6/patches-2.6.27/922-gpiommc.patch deleted file mode 100644 index d4bb0537f..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/922-gpiommc.patch +++ /dev/null @@ -1,838 +0,0 @@ ---- /dev/null -+++ b/drivers/mmc/host/gpiommc.c -@@ -0,0 +1,608 @@ -+/* -+ * Driver an MMC/SD card on a bitbanging GPIO SPI bus. -+ * This module hooks up the mmc_spi and spi_gpio modules and also -+ * provides a configfs interface. -+ * -+ * Copyright 2008 Michael Buesch -+ * -+ * Licensed under the GNU/GPL. See COPYING for details. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+ -+#define PFX "gpio-mmc: " -+ -+ -+struct gpiommc_device { -+ struct platform_device *pdev; -+ struct platform_device *spi_pdev; -+ struct spi_board_info boardinfo; -+}; -+ -+ -+MODULE_DESCRIPTION("GPIO based MMC driver"); -+MODULE_AUTHOR("Michael Buesch"); -+MODULE_LICENSE("GPL"); -+ -+ -+static int gpiommc_boardinfo_setup(struct spi_board_info *bi, -+ struct spi_master *master, -+ void *data) -+{ -+ struct gpiommc_device *d = data; -+ struct gpiommc_platform_data *pdata = d->pdev->dev.platform_data; -+ -+ /* Bind the SPI master to the MMC-SPI host driver. */ -+ strlcpy(bi->modalias, "mmc_spi", sizeof(bi->modalias)); -+ -+ bi->max_speed_hz = pdata->max_bus_speed; -+ bi->bus_num = master->bus_num; -+ bi->mode = pdata->mode; -+ -+ return 0; -+} -+ -+static int gpiommc_probe(struct platform_device *pdev) -+{ -+ struct gpiommc_platform_data *mmc_pdata = pdev->dev.platform_data; -+ struct spi_gpio_platform_data spi_pdata; -+ struct gpiommc_device *d; -+ int err; -+ -+ err = -ENXIO; -+ if (!mmc_pdata) -+ goto error; -+ -+#ifdef CONFIG_MMC_SPI_MODULE -+ err = request_module("mmc_spi"); -+ if (err) { -+ printk(KERN_WARNING PFX -+ "Failed to request mmc_spi module.\n"); -+ } -+#endif /* CONFIG_MMC_SPI_MODULE */ -+ -+ /* Allocate the GPIO-MMC device */ -+ err = -ENOMEM; -+ d = kzalloc(sizeof(*d), GFP_KERNEL); -+ if (!d) -+ goto error; -+ d->pdev = pdev; -+ -+ /* Create the SPI-GPIO device */ -+ d->spi_pdev = platform_device_alloc(SPI_GPIO_PLATDEV_NAME, -+ spi_gpio_next_id()); -+ if (!d->spi_pdev) -+ goto err_free_d; -+ -+ memset(&spi_pdata, 0, sizeof(spi_pdata)); -+ spi_pdata.pin_clk = mmc_pdata->pins.gpio_clk; -+ spi_pdata.pin_miso = mmc_pdata->pins.gpio_do; -+ spi_pdata.pin_mosi = mmc_pdata->pins.gpio_di; -+ spi_pdata.pin_cs = mmc_pdata->pins.gpio_cs; -+ spi_pdata.cs_activelow = mmc_pdata->pins.cs_activelow; -+ spi_pdata.no_spi_delay = mmc_pdata->no_spi_delay; -+ spi_pdata.boardinfo_setup = gpiommc_boardinfo_setup; -+ spi_pdata.boardinfo_setup_data = d; -+ -+ err = platform_device_add_data(d->spi_pdev, &spi_pdata, -+ sizeof(spi_pdata)); -+ if (err) -+ goto err_free_pdev; -+ err = platform_device_add(d->spi_pdev); -+ if (err) -+ goto err_free_pdata; -+ platform_set_drvdata(pdev, d); -+ -+ printk(KERN_INFO PFX "MMC-Card \"%s\" " -+ "attached to GPIO pins di=%u, do=%u, clk=%u, cs=%u\n", -+ mmc_pdata->name, mmc_pdata->pins.gpio_di, -+ mmc_pdata->pins.gpio_do, -+ mmc_pdata->pins.gpio_clk, -+ mmc_pdata->pins.gpio_cs); -+ -+ return 0; -+ -+err_free_pdata: -+ kfree(d->spi_pdev->dev.platform_data); -+ d->spi_pdev->dev.platform_data = NULL; -+err_free_pdev: -+ platform_device_put(d->spi_pdev); -+err_free_d: -+ kfree(d); -+error: -+ return err; -+} -+ -+static int gpiommc_remove(struct platform_device *pdev) -+{ -+ struct gpiommc_device *d = platform_get_drvdata(pdev); -+ struct gpiommc_platform_data *pdata = d->pdev->dev.platform_data; -+ -+ platform_device_unregister(d->spi_pdev); -+ printk(KERN_INFO PFX "GPIO based MMC-Card \"%s\" removed\n", -+ pdata->name); -+ platform_device_put(d->spi_pdev); -+ -+ return 0; -+} -+ -+#ifdef CONFIG_GPIOMMC_CONFIGFS -+ -+/* A device that was created through configfs */ -+struct gpiommc_configfs_device { -+ struct config_item item; -+ /* The platform device, after registration. */ -+ struct platform_device *pdev; -+ /* The configuration */ -+ struct gpiommc_platform_data pdata; -+}; -+ -+#define GPIO_INVALID -1 -+ -+static inline bool gpiommc_is_registered(struct gpiommc_configfs_device *dev) -+{ -+ return (dev->pdev != NULL); -+} -+ -+static inline struct gpiommc_configfs_device *ci_to_gpiommc(struct config_item *item) -+{ -+ return item ? container_of(item, struct gpiommc_configfs_device, item) : NULL; -+} -+ -+static struct configfs_attribute gpiommc_attr_DI = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "gpio_data_in", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_DO = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "gpio_data_out", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_CLK = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "gpio_clock", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_CS = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "gpio_chipselect", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_CS_activelow = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "gpio_chipselect_activelow", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_spimode = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "spi_mode", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_spidelay = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "spi_delay", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_max_bus_speed = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "max_bus_speed", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute gpiommc_attr_register = { -+ .ca_owner = THIS_MODULE, -+ .ca_name = "register", -+ .ca_mode = S_IRUGO | S_IWUSR, -+}; -+ -+static struct configfs_attribute *gpiommc_config_attrs[] = { -+ &gpiommc_attr_DI, -+ &gpiommc_attr_DO, -+ &gpiommc_attr_CLK, -+ &gpiommc_attr_CS, -+ &gpiommc_attr_CS_activelow, -+ &gpiommc_attr_spimode, -+ &gpiommc_attr_spidelay, -+ &gpiommc_attr_max_bus_speed, -+ &gpiommc_attr_register, -+ NULL, -+}; -+ -+static ssize_t gpiommc_config_attr_show(struct config_item *item, -+ struct configfs_attribute *attr, -+ char *page) -+{ -+ struct gpiommc_configfs_device *dev = ci_to_gpiommc(item); -+ ssize_t count = 0; -+ unsigned int gpio; -+ int err = 0; -+ -+ if (attr == &gpiommc_attr_DI) { -+ gpio = dev->pdata.pins.gpio_di; -+ if (gpio == GPIO_INVALID) -+ count = snprintf(page, PAGE_SIZE, "not configured\n"); -+ else -+ count = snprintf(page, PAGE_SIZE, "%u\n", gpio); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_DO) { -+ gpio = dev->pdata.pins.gpio_do; -+ if (gpio == GPIO_INVALID) -+ count = snprintf(page, PAGE_SIZE, "not configured\n"); -+ else -+ count = snprintf(page, PAGE_SIZE, "%u\n", gpio); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CLK) { -+ gpio = dev->pdata.pins.gpio_clk; -+ if (gpio == GPIO_INVALID) -+ count = snprintf(page, PAGE_SIZE, "not configured\n"); -+ else -+ count = snprintf(page, PAGE_SIZE, "%u\n", gpio); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CS) { -+ gpio = dev->pdata.pins.gpio_cs; -+ if (gpio == GPIO_INVALID) -+ count = snprintf(page, PAGE_SIZE, "not configured\n"); -+ else -+ count = snprintf(page, PAGE_SIZE, "%u\n", gpio); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CS_activelow) { -+ count = snprintf(page, PAGE_SIZE, "%u\n", -+ dev->pdata.pins.cs_activelow); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_spimode) { -+ count = snprintf(page, PAGE_SIZE, "%u\n", -+ dev->pdata.mode); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_spidelay) { -+ count = snprintf(page, PAGE_SIZE, "%u\n", -+ !dev->pdata.no_spi_delay); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_max_bus_speed) { -+ count = snprintf(page, PAGE_SIZE, "%u\n", -+ dev->pdata.max_bus_speed); -+ goto out; -+ } -+ if (attr == &gpiommc_attr_register) { -+ count = snprintf(page, PAGE_SIZE, "%u\n", -+ gpiommc_is_registered(dev)); -+ goto out; -+ } -+ WARN_ON(1); -+ err = -ENOSYS; -+out: -+ return err ? err : count; -+} -+ -+static int gpiommc_do_register(struct gpiommc_configfs_device *dev, -+ const char *name) -+{ -+ int err; -+ -+ if (gpiommc_is_registered(dev)) -+ return 0; -+ -+ if (!gpio_is_valid(dev->pdata.pins.gpio_di) || -+ !gpio_is_valid(dev->pdata.pins.gpio_do) || -+ !gpio_is_valid(dev->pdata.pins.gpio_clk) || -+ !gpio_is_valid(dev->pdata.pins.gpio_cs)) { -+ printk(KERN_ERR PFX -+ "configfs: Invalid GPIO pin number(s)\n"); -+ return -EINVAL; -+ } -+ -+ strlcpy(dev->pdata.name, name, -+ sizeof(dev->pdata.name)); -+ -+ dev->pdev = platform_device_alloc(GPIOMMC_PLATDEV_NAME, -+ gpiommc_next_id()); -+ if (!dev->pdev) -+ return -ENOMEM; -+ err = platform_device_add_data(dev->pdev, &dev->pdata, -+ sizeof(dev->pdata)); -+ if (err) { -+ platform_device_put(dev->pdev); -+ return err; -+ } -+ err = platform_device_add(dev->pdev); -+ if (err) { -+ platform_device_put(dev->pdev); -+ return err; -+ } -+ -+ return 0; -+} -+ -+static void gpiommc_do_unregister(struct gpiommc_configfs_device *dev) -+{ -+ if (!gpiommc_is_registered(dev)) -+ return; -+ -+ platform_device_unregister(dev->pdev); -+ dev->pdev = NULL; -+} -+ -+static ssize_t gpiommc_config_attr_store(struct config_item *item, -+ struct configfs_attribute *attr, -+ const char *page, size_t count) -+{ -+ struct gpiommc_configfs_device *dev = ci_to_gpiommc(item); -+ int err = -EINVAL; -+ unsigned long data; -+ -+ if (attr == &gpiommc_attr_register) { -+ err = strict_strtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (data == 1) -+ err = gpiommc_do_register(dev, item->ci_name); -+ if (data == 0) { -+ gpiommc_do_unregister(dev); -+ err = 0; -+ } -+ goto out; -+ } -+ -+ if (gpiommc_is_registered(dev)) { -+ /* The rest of the config parameters can only be set -+ * as long as the device is not registered, yet. */ -+ err = -EBUSY; -+ goto out; -+ } -+ -+ if (attr == &gpiommc_attr_DI) { -+ err = strict_strtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (!gpio_is_valid(data)) -+ goto out; -+ dev->pdata.pins.gpio_di = data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_DO) { -+ err = strict_strtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (!gpio_is_valid(data)) -+ goto out; -+ dev->pdata.pins.gpio_do = data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CLK) { -+ err = strict_strtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (!gpio_is_valid(data)) -+ goto out; -+ dev->pdata.pins.gpio_clk = data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CS) { -+ err = strict_strtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (!gpio_is_valid(data)) -+ goto out; -+ dev->pdata.pins.gpio_cs = data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_CS_activelow) { -+ err = strict_strtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (data != 0 && data != 1) -+ goto out; -+ dev->pdata.pins.cs_activelow = data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_spimode) { -+ err = strict_strtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ switch (data) { -+ case 0: -+ dev->pdata.mode = SPI_MODE_0; -+ break; -+ case 1: -+ dev->pdata.mode = SPI_MODE_1; -+ break; -+ case 2: -+ dev->pdata.mode = SPI_MODE_2; -+ break; -+ case 3: -+ dev->pdata.mode = SPI_MODE_3; -+ break; -+ default: -+ goto out; -+ } -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_spidelay) { -+ err = strict_strtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (data != 0 && data != 1) -+ goto out; -+ dev->pdata.no_spi_delay = !data; -+ err = 0; -+ goto out; -+ } -+ if (attr == &gpiommc_attr_max_bus_speed) { -+ err = strict_strtoul(page, 10, &data); -+ if (err) -+ goto out; -+ err = -EINVAL; -+ if (data > UINT_MAX) -+ goto out; -+ dev->pdata.max_bus_speed = data; -+ err = 0; -+ goto out; -+ } -+ WARN_ON(1); -+ err = -ENOSYS; -+out: -+ return err ? err : count; -+} -+ -+static void gpiommc_config_item_release(struct config_item *item) -+{ -+ struct gpiommc_configfs_device *dev = ci_to_gpiommc(item); -+ -+ kfree(dev); -+} -+ -+static struct configfs_item_operations gpiommc_config_item_ops = { -+ .release = gpiommc_config_item_release, -+ .show_attribute = gpiommc_config_attr_show, -+ .store_attribute = gpiommc_config_attr_store, -+}; -+ -+static struct config_item_type gpiommc_dev_ci_type = { -+ .ct_item_ops = &gpiommc_config_item_ops, -+ .ct_attrs = gpiommc_config_attrs, -+ .ct_owner = THIS_MODULE, -+}; -+ -+static struct config_item *gpiommc_make_item(struct config_group *group, -+ const char *name) -+{ -+ struct gpiommc_configfs_device *dev; -+ -+ if (strlen(name) > GPIOMMC_MAX_NAMELEN) { -+ printk(KERN_ERR PFX "configfs: device name too long\n"); -+ return NULL; -+ } -+ -+ dev = kzalloc(sizeof(*dev), GFP_KERNEL); -+ if (!dev) -+ return NULL; -+ -+ config_item_init_type_name(&dev->item, name, -+ &gpiommc_dev_ci_type); -+ -+ /* Assign default configuration */ -+ dev->pdata.pins.gpio_di = GPIO_INVALID; -+ dev->pdata.pins.gpio_do = GPIO_INVALID; -+ dev->pdata.pins.gpio_clk = GPIO_INVALID; -+ dev->pdata.pins.gpio_cs = GPIO_INVALID; -+ dev->pdata.pins.cs_activelow = 1; -+ dev->pdata.mode = SPI_MODE_0; -+ dev->pdata.no_spi_delay = 0; -+ dev->pdata.max_bus_speed = 5000000; /* 5 MHz */ -+ -+ return &(dev->item); -+} -+ -+static void gpiommc_drop_item(struct config_group *group, -+ struct config_item *item) -+{ -+ struct gpiommc_configfs_device *dev = ci_to_gpiommc(item); -+ -+ gpiommc_do_unregister(dev); -+ kfree(dev); -+} -+ -+static struct configfs_group_operations gpiommc_ct_group_ops = { -+ .make_item = gpiommc_make_item, -+ .drop_item = gpiommc_drop_item, -+}; -+ -+static struct config_item_type gpiommc_ci_type = { -+ .ct_group_ops = &gpiommc_ct_group_ops, -+ .ct_owner = THIS_MODULE, -+}; -+ -+static struct configfs_subsystem gpiommc_subsys = { -+ .su_group = { -+ .cg_item = { -+ .ci_namebuf = GPIOMMC_PLATDEV_NAME, -+ .ci_type = &gpiommc_ci_type, -+ }, -+ }, -+ .su_mutex = __MUTEX_INITIALIZER(gpiommc_subsys.su_mutex), -+}; -+ -+#endif /* CONFIG_GPIOMMC_CONFIGFS */ -+ -+static struct platform_driver gpiommc_plat_driver = { -+ .probe = gpiommc_probe, -+ .remove = gpiommc_remove, -+ .driver = { -+ .name = GPIOMMC_PLATDEV_NAME, -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+int gpiommc_next_id(void) -+{ -+ static atomic_t counter = ATOMIC_INIT(-1); -+ -+ return atomic_inc_return(&counter); -+} -+EXPORT_SYMBOL(gpiommc_next_id); -+ -+static int __init gpiommc_modinit(void) -+{ -+ int err; -+ -+ err = platform_driver_register(&gpiommc_plat_driver); -+ if (err) -+ return err; -+ -+#ifdef CONFIG_GPIOMMC_CONFIGFS -+ config_group_init(&gpiommc_subsys.su_group); -+ err = configfs_register_subsystem(&gpiommc_subsys); -+ if (err) { -+ platform_driver_unregister(&gpiommc_plat_driver); -+ return err; -+ } -+#endif /* CONFIG_GPIOMMC_CONFIGFS */ -+ -+ return 0; -+} -+module_init(gpiommc_modinit); -+ -+static void __exit gpiommc_modexit(void) -+{ -+#ifdef CONFIG_GPIOMMC_CONFIGFS -+ configfs_unregister_subsystem(&gpiommc_subsys); -+#endif -+ platform_driver_unregister(&gpiommc_plat_driver); -+} -+module_exit(gpiommc_modexit); ---- a/drivers/mmc/host/Kconfig -+++ b/drivers/mmc/host/Kconfig -@@ -180,3 +180,28 @@ config MMC_TMIO - help - This provides support for the SD/MMC cell found in TC6393XB, - T7L66XB and also ipaq ASIC3 -+ -+config GPIOMMC -+ tristate "MMC/SD over GPIO-based SPI" -+ depends on MMC && MMC_SPI && SPI_GPIO -+ help -+ This driver hooks up the mmc_spi and spi_gpio modules so that -+ MMC/SD cards can be used on a GPIO based bus by bitbanging -+ the SPI protocol in software. -+ -+ This driver provides a configfs interface to dynamically create -+ and destroy GPIO-based MMC/SD card devices. It also provides -+ a platform device interface API. -+ See Documentation/gpiommc.txt for details. -+ -+ The module will be called gpiommc. -+ -+ If unsure, say N. -+ -+config GPIOMMC_CONFIGFS -+ bool -+ depends on GPIOMMC && CONFIGFS_FS -+ default y -+ help -+ This option automatically enables configfs support for gpiommc -+ if configfs is available. ---- a/drivers/mmc/host/Makefile -+++ b/drivers/mmc/host/Makefile -@@ -22,4 +22,5 @@ obj-$(CONFIG_MMC_SPI) += mmc_spi.o - obj-$(CONFIG_MMC_S3C) += s3cmci.o - obj-$(CONFIG_MMC_SDRICOH_CS) += sdricoh_cs.o - obj-$(CONFIG_MMC_TMIO) += tmio_mmc.o -+obj-$(CONFIG_GPIOMMC) += gpiommc.o - ---- /dev/null -+++ b/include/linux/mmc/gpiommc.h -@@ -0,0 +1,71 @@ -+/* -+ * Device driver for MMC/SD cards driven over a GPIO bus. -+ * -+ * Copyright (c) 2008 Michael Buesch -+ * -+ * Licensed under the GNU/GPL version 2. -+ */ -+#ifndef LINUX_GPIOMMC_H_ -+#define LINUX_GPIOMMC_H_ -+ -+#include -+ -+ -+#define GPIOMMC_MAX_NAMELEN 15 -+#define GPIOMMC_MAX_NAMELEN_STR __stringify(GPIOMMC_MAX_NAMELEN) -+ -+/** -+ * struct gpiommc_pins - Hardware pin assignments -+ * -+ * @gpio_di: The GPIO number of the DATA IN pin -+ * @gpio_do: The GPIO number of the DATA OUT pin -+ * @gpio_clk: The GPIO number of the CLOCK pin -+ * @gpio_cs: The GPIO number of the CHIPSELECT pin -+ * @cs_activelow: If true, the chip is considered selected if @gpio_cs is low. -+ */ -+struct gpiommc_pins { -+ unsigned int gpio_di; -+ unsigned int gpio_do; -+ unsigned int gpio_clk; -+ unsigned int gpio_cs; -+ bool cs_activelow; -+}; -+ -+/** -+ * struct gpiommc_platform_data - Platform data for a MMC-over-SPI-GPIO device. -+ * -+ * @name: The unique name string of the device. -+ * @pins: The hardware pin assignments. -+ * @mode: The hardware mode. This is either SPI_MODE_0, -+ * SPI_MODE_1, SPI_MODE_2 or SPI_MODE_3. See the SPI documentation. -+ * @no_spi_delay: Do not use delays in the lowlevel SPI bitbanging code. -+ * This is not standards compliant, but may be required for some -+ * embedded machines to gain reasonable speed. -+ * @max_bus_speed: The maximum speed of the SPI bus, in Hertz. -+ */ -+struct gpiommc_platform_data { -+ char name[GPIOMMC_MAX_NAMELEN + 1]; -+ struct gpiommc_pins pins; -+ u8 mode; -+ bool no_spi_delay; -+ unsigned int max_bus_speed; -+}; -+ -+/** -+ * GPIOMMC_PLATDEV_NAME - The platform device name string. -+ * -+ * The name string that has to be used for platform_device_alloc -+ * when allocating a gpiommc device. -+ */ -+#define GPIOMMC_PLATDEV_NAME "gpiommc" -+ -+/** -+ * gpiommc_next_id - Get another platform device ID number. -+ * -+ * This returns the next platform device ID number that has to be used -+ * for platform_device_alloc. The ID is opaque and should not be used for -+ * anything else. -+ */ -+int gpiommc_next_id(void); -+ -+#endif /* LINUX_GPIOMMC_H_ */ ---- /dev/null -+++ b/Documentation/gpiommc.txt -@@ -0,0 +1,97 @@ -+GPIOMMC - Driver for an MMC/SD card on a bitbanging GPIO SPI bus -+================================================================ -+ -+The gpiommc module hooks up the mmc_spi and spi_gpio modules for running an -+MMC or SD card on GPIO pins. -+ -+Two interfaces for registering a new MMC/SD card device are provided: -+A static platform-device based mechanism and a dynamic configfs based interface. -+ -+ -+Registering devices via platform-device -+======================================= -+ -+The platform-device interface is used for registering MMC/SD devices that are -+part of the hardware platform. This is most useful only for embedded machines -+with MMC/SD devices statically connected to the platform GPIO bus. -+ -+The data structures are declared in . -+ -+To register a new device, define an instance of struct gpiommc_platform_data. -+This structure holds any information about how the device is hooked up to the -+GPIO pins and what hardware modes the device supports. See the docbook-style -+documentation in the header file for more information on the struct fields. -+ -+Then allocate a new instance of a platform device by doing: -+ -+ pdev = platform_device_alloc(GPIOMMC_PLATDEV_NAME, gpiommc_next_id()); -+ -+This will allocate the platform device data structures and hook it up to the -+gpiommc driver. -+Then add the gpiommc_platform_data to the platform device. -+ -+ err = platform_device_add_data(pdev, pdata, sizeof(struct gpiommc_platform_data)); -+ -+You may free the local instance of struct gpiommc_platform_data now. (So the -+struct may be allocated on the stack, too). -+Now simply register the platform device. -+ -+ err = platform_device_add(pdev); -+ -+Done. The gpiommc probe routine will be invoked now and you should see a kernel -+log message for the added device. -+ -+ -+Registering devices via configfs -+================================ -+ -+MMC/SD cards connected via GPIO often are a pretty dynamic thing, as for example -+selfmade hacks for soldering an MMC/SD card to standard GPIO pins on embedded -+hardware are a common situation. -+So we provide a dynamic interface to conveniently handle adding and removing -+devices from userspace, without the need to recompile the kernel. -+ -+The "gpiommc" subdirectory at the configfs mountpoint is used for handling -+the dynamic configuration. -+ -+To create a new device, it must first be allocated with mkdir. -+The following command will allocate a device named "my_mmc": -+ mkdir /config/gpiommc/my_mmc -+ -+There are several configuration files available in the new -+/config/gpiommc/my_mmc/ directory: -+ -+gpio_data_in = The SPI data-IN GPIO pin number. -+gpio_data_out = The SPI data-OUT GPIO pin number. -+gpio_clock = The SPI Clock GPIO pin number. -+gpio_chipselect = The SPI Chipselect GPIO pin number. -+gpio_chipselect_activelow = Boolean. If 0, Chipselect is active-HIGH. -+ If 1, Chipselect is active-LOW. -+spi_mode = The SPI data mode. Can be 0-3. -+spi_delay = Enable all delays in the lowlevel bitbanging. -+max_bus_speed = The maximum SPI bus speed. In Hertz. -+ -+register = Not a configuration parameter. -+ Used to register the configured card -+ with the kernel. -+ -+The device must first get configured and then registered by writing "1" to -+the "register" file. -+The configuration parameters "gpio_data_in", "gpio_data_out", "gpio_clock" -+and "gpio_chipselect" are essential and _must_ be configured before writing -+"1" to the "register" file. The registration will fail, otherwise. -+ -+The default values for the other parameters are: -+gpio_chipselect_activelow = 1 (CS active-LOW) -+spi_mode = 0 (SPI_MODE_0) -+spi_delay = 1 (enabled) -+max_bus_speed = 5000000 (5 Mhz) -+ -+Configuration values can not be changed after registration. To unregister -+the device, write a "0" to the "register" file. The configuration can be -+changed again after unregistering. -+ -+To completely remove the device, simply rmdir the directory -+(/config/gpiommc/my_mmc in this example). -+There's no need to first unregister the device before removing it. That will -+be done automatically. ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -1833,6 +1833,11 @@ L: gigaset307x-common@lists.sourceforge. - W: http://gigaset307x.sourceforge.net/ - S: Maintained - -+GPIOMMC DRIVER -+P: Michael Buesch -+M: mb@bu3sch.de -+S: Maintained -+ - HARDWARE MONITORING - L: lm-sensors@lm-sensors.org - W: http://www.lm-sensors.org/ diff --git a/target/linux/generic-2.6/patches-2.6.27/923-gpiommc-configfs-locking.patch b/target/linux/generic-2.6/patches-2.6.27/923-gpiommc-configfs-locking.patch deleted file mode 100644 index 2e4e820b2..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/923-gpiommc-configfs-locking.patch +++ /dev/null @@ -1,58 +0,0 @@ -The gpiommc configfs context structure needs locking, as configfs -does not lock access between files. - ---- a/drivers/mmc/host/gpiommc.c -+++ b/drivers/mmc/host/gpiommc.c -@@ -143,6 +143,8 @@ struct gpiommc_configfs_device { - struct platform_device *pdev; - /* The configuration */ - struct gpiommc_platform_data pdata; -+ /* Mutex to protect this structure */ -+ struct mutex mutex; - }; - - #define GPIO_INVALID -1 -@@ -233,6 +235,8 @@ static ssize_t gpiommc_config_attr_show( - unsigned int gpio; - int err = 0; - -+ mutex_lock(&dev->mutex); -+ - if (attr == &gpiommc_attr_DI) { - gpio = dev->pdata.pins.gpio_di; - if (gpio == GPIO_INVALID) -@@ -293,6 +297,8 @@ static ssize_t gpiommc_config_attr_show( - WARN_ON(1); - err = -ENOSYS; - out: -+ mutex_unlock(&dev->mutex); -+ - return err ? err : count; - } - -@@ -352,6 +358,8 @@ static ssize_t gpiommc_config_attr_store - int err = -EINVAL; - unsigned long data; - -+ mutex_lock(&dev->mutex); -+ - if (attr == &gpiommc_attr_register) { - err = strict_strtoul(page, 10, &data); - if (err) -@@ -477,6 +485,8 @@ static ssize_t gpiommc_config_attr_store - WARN_ON(1); - err = -ENOSYS; - out: -+ mutex_unlock(&dev->mutex); -+ - return err ? err : count; - } - -@@ -513,6 +523,7 @@ static struct config_item *gpiommc_make_ - if (!dev) - return NULL; - -+ mutex_init(&dev->mutex); - config_item_init_type_name(&dev->item, name, - &gpiommc_dev_ci_type); - diff --git a/target/linux/generic-2.6/patches-2.6.27/940-wireless_mesh_header.patch b/target/linux/generic-2.6/patches-2.6.27/940-wireless_mesh_header.patch deleted file mode 100644 index e766e2ecf..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/940-wireless_mesh_header.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -94,7 +94,7 @@ struct wireless_dev; - */ - - #if defined(CONFIG_WLAN_80211) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) --# if defined(CONFIG_MAC80211_MESH) -+# if 1 || defined(CONFIG_MAC80211_MESH) - # define LL_MAX_HEADER 128 - # else - # define LL_MAX_HEADER 96 ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -326,7 +326,7 @@ struct sk_buff { - #ifdef CONFIG_IPV6_NDISC_NODETYPE - __u8 ndisc_nodetype:2; - #endif --#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE) -+#if 1 - __u8 do_not_encrypt:1; - #endif - /* 0/13/14 bit hole */ diff --git a/target/linux/generic-2.6/patches-2.6.27/951-revert_gcc4_4_fixes.patch b/target/linux/generic-2.6/patches-2.6.27/951-revert_gcc4_4_fixes.patch deleted file mode 100644 index 1f1800f23..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/951-revert_gcc4_4_fixes.patch +++ /dev/null @@ -1,524 +0,0 @@ ---- a/arch/powerpc/boot/crtsavres.S -+++ /dev/null -@@ -1,233 +0,0 @@ --/* -- * Special support for eabi and SVR4 -- * -- * Copyright (C) 1995, 1996, 1998, 2000, 2001 Free Software Foundation, Inc. -- * Copyright 2008 Freescale Semiconductor, Inc. -- * Written By Michael Meissner -- * -- * Based on gcc/config/rs6000/crtsavres.asm from gcc -- * -- * This file 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, or (at your option) any -- * later version. -- * -- * In addition to the permissions in the GNU General Public License, the -- * Free Software Foundation gives you unlimited permission to link the -- * compiled version of this file with other programs, and to distribute -- * those programs without any restriction coming from the use of this -- * file. (The General Public License restrictions do apply in other -- * respects; for example, they cover modification of the file, and -- * distribution when not linked into another program.) -- * -- * This file is distributed in the hope that it will be useful, but -- * WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- * General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with this program; see the file COPYING. If not, write to -- * the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- * Boston, MA 02110-1301, USA. -- * -- * As a special exception, if you link this library with files -- * compiled with GCC to produce an executable, this does not cause -- * the resulting executable to be covered by the GNU General Public License. -- * This exception does not however invalidate any other reasons why -- * the executable file might be covered by the GNU General Public License. -- */ -- -- .file "crtsavres.S" -- .section ".text" -- --/* On PowerPC64 Linux, these functions are provided by the linker. */ --#ifndef __powerpc64__ -- --#define _GLOBAL(name) \ -- .type name,@function; \ -- .globl name; \ --name: -- --/* Routines for saving integer registers, called by the compiler. */ --/* Called with r11 pointing to the stack header word of the caller of the */ --/* function, just beyond the end of the integer save area. */ -- --_GLOBAL(_savegpr_14) --_GLOBAL(_save32gpr_14) -- stw 14,-72(11) /* save gp registers */ --_GLOBAL(_savegpr_15) --_GLOBAL(_save32gpr_15) -- stw 15,-68(11) --_GLOBAL(_savegpr_16) --_GLOBAL(_save32gpr_16) -- stw 16,-64(11) --_GLOBAL(_savegpr_17) --_GLOBAL(_save32gpr_17) -- stw 17,-60(11) --_GLOBAL(_savegpr_18) --_GLOBAL(_save32gpr_18) -- stw 18,-56(11) --_GLOBAL(_savegpr_19) --_GLOBAL(_save32gpr_19) -- stw 19,-52(11) --_GLOBAL(_savegpr_20) --_GLOBAL(_save32gpr_20) -- stw 20,-48(11) --_GLOBAL(_savegpr_21) --_GLOBAL(_save32gpr_21) -- stw 21,-44(11) --_GLOBAL(_savegpr_22) --_GLOBAL(_save32gpr_22) -- stw 22,-40(11) --_GLOBAL(_savegpr_23) --_GLOBAL(_save32gpr_23) -- stw 23,-36(11) --_GLOBAL(_savegpr_24) --_GLOBAL(_save32gpr_24) -- stw 24,-32(11) --_GLOBAL(_savegpr_25) --_GLOBAL(_save32gpr_25) -- stw 25,-28(11) --_GLOBAL(_savegpr_26) --_GLOBAL(_save32gpr_26) -- stw 26,-24(11) --_GLOBAL(_savegpr_27) --_GLOBAL(_save32gpr_27) -- stw 27,-20(11) --_GLOBAL(_savegpr_28) --_GLOBAL(_save32gpr_28) -- stw 28,-16(11) --_GLOBAL(_savegpr_29) --_GLOBAL(_save32gpr_29) -- stw 29,-12(11) --_GLOBAL(_savegpr_30) --_GLOBAL(_save32gpr_30) -- stw 30,-8(11) --_GLOBAL(_savegpr_31) --_GLOBAL(_save32gpr_31) -- stw 31,-4(11) -- blr -- --/* Routines for restoring integer registers, called by the compiler. */ --/* Called with r11 pointing to the stack header word of the caller of the */ --/* function, just beyond the end of the integer restore area. */ -- --_GLOBAL(_restgpr_14) --_GLOBAL(_rest32gpr_14) -- lwz 14,-72(11) /* restore gp registers */ --_GLOBAL(_restgpr_15) --_GLOBAL(_rest32gpr_15) -- lwz 15,-68(11) --_GLOBAL(_restgpr_16) --_GLOBAL(_rest32gpr_16) -- lwz 16,-64(11) --_GLOBAL(_restgpr_17) --_GLOBAL(_rest32gpr_17) -- lwz 17,-60(11) --_GLOBAL(_restgpr_18) --_GLOBAL(_rest32gpr_18) -- lwz 18,-56(11) --_GLOBAL(_restgpr_19) --_GLOBAL(_rest32gpr_19) -- lwz 19,-52(11) --_GLOBAL(_restgpr_20) --_GLOBAL(_rest32gpr_20) -- lwz 20,-48(11) --_GLOBAL(_restgpr_21) --_GLOBAL(_rest32gpr_21) -- lwz 21,-44(11) --_GLOBAL(_restgpr_22) --_GLOBAL(_rest32gpr_22) -- lwz 22,-40(11) --_GLOBAL(_restgpr_23) --_GLOBAL(_rest32gpr_23) -- lwz 23,-36(11) --_GLOBAL(_restgpr_24) --_GLOBAL(_rest32gpr_24) -- lwz 24,-32(11) --_GLOBAL(_restgpr_25) --_GLOBAL(_rest32gpr_25) -- lwz 25,-28(11) --_GLOBAL(_restgpr_26) --_GLOBAL(_rest32gpr_26) -- lwz 26,-24(11) --_GLOBAL(_restgpr_27) --_GLOBAL(_rest32gpr_27) -- lwz 27,-20(11) --_GLOBAL(_restgpr_28) --_GLOBAL(_rest32gpr_28) -- lwz 28,-16(11) --_GLOBAL(_restgpr_29) --_GLOBAL(_rest32gpr_29) -- lwz 29,-12(11) --_GLOBAL(_restgpr_30) --_GLOBAL(_rest32gpr_30) -- lwz 30,-8(11) --_GLOBAL(_restgpr_31) --_GLOBAL(_rest32gpr_31) -- lwz 31,-4(11) -- blr -- --/* Routines for restoring integer registers, called by the compiler. */ --/* Called with r11 pointing to the stack header word of the caller of the */ --/* function, just beyond the end of the integer restore area. */ -- --_GLOBAL(_restgpr_14_x) --_GLOBAL(_rest32gpr_14_x) -- lwz 14,-72(11) /* restore gp registers */ --_GLOBAL(_restgpr_15_x) --_GLOBAL(_rest32gpr_15_x) -- lwz 15,-68(11) --_GLOBAL(_restgpr_16_x) --_GLOBAL(_rest32gpr_16_x) -- lwz 16,-64(11) --_GLOBAL(_restgpr_17_x) --_GLOBAL(_rest32gpr_17_x) -- lwz 17,-60(11) --_GLOBAL(_restgpr_18_x) --_GLOBAL(_rest32gpr_18_x) -- lwz 18,-56(11) --_GLOBAL(_restgpr_19_x) --_GLOBAL(_rest32gpr_19_x) -- lwz 19,-52(11) --_GLOBAL(_restgpr_20_x) --_GLOBAL(_rest32gpr_20_x) -- lwz 20,-48(11) --_GLOBAL(_restgpr_21_x) --_GLOBAL(_rest32gpr_21_x) -- lwz 21,-44(11) --_GLOBAL(_restgpr_22_x) --_GLOBAL(_rest32gpr_22_x) -- lwz 22,-40(11) --_GLOBAL(_restgpr_23_x) --_GLOBAL(_rest32gpr_23_x) -- lwz 23,-36(11) --_GLOBAL(_restgpr_24_x) --_GLOBAL(_rest32gpr_24_x) -- lwz 24,-32(11) --_GLOBAL(_restgpr_25_x) --_GLOBAL(_rest32gpr_25_x) -- lwz 25,-28(11) --_GLOBAL(_restgpr_26_x) --_GLOBAL(_rest32gpr_26_x) -- lwz 26,-24(11) --_GLOBAL(_restgpr_27_x) --_GLOBAL(_rest32gpr_27_x) -- lwz 27,-20(11) --_GLOBAL(_restgpr_28_x) --_GLOBAL(_rest32gpr_28_x) -- lwz 28,-16(11) --_GLOBAL(_restgpr_29_x) --_GLOBAL(_rest32gpr_29_x) -- lwz 29,-12(11) --_GLOBAL(_restgpr_30_x) --_GLOBAL(_rest32gpr_30_x) -- lwz 30,-8(11) --_GLOBAL(_restgpr_31_x) --_GLOBAL(_rest32gpr_31_x) -- lwz 0,4(11) -- lwz 31,-4(11) -- mtlr 0 -- mr 1,11 -- blr --#endif ---- a/arch/powerpc/boot/Makefile -+++ b/arch/powerpc/boot/Makefile -@@ -53,7 +53,7 @@ $(addprefix $(obj)/,$(zlib) cuboot-c2k.o - $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) - - src-libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c --src-wlib := string.S crt0.S crtsavres.S stdio.c main.c \ -+src-wlib := string.S crt0.S stdio.c main.c \ - $(addprefix libfdt/,$(src-libfdt)) libfdt-wrapper.c \ - ns16550.c serial.c simple_alloc.c div64.S util.S \ - gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \ ---- a/arch/powerpc/kernel/prom_init_check.sh -+++ b/arch/powerpc/kernel/prom_init_check.sh -@@ -48,20 +48,6 @@ do - fi - done - -- # ignore register save/restore funcitons -- if [ "${UNDEF:0:9}" = "_restgpr_" ]; then -- OK=1 -- fi -- if [ "${UNDEF:0:11}" = "_rest32gpr_" ]; then -- OK=1 -- fi -- if [ "${UNDEF:0:9}" = "_savegpr_" ]; then -- OK=1 -- fi -- if [ "${UNDEF:0:11}" = "_save32gpr_" ]; then -- OK=1 -- fi -- - if [ $OK -eq 0 ]; then - ERROR=1 - echo "Error: External symbol '$UNDEF' referenced" \ ---- a/arch/powerpc/lib/crtsavres.S -+++ /dev/null -@@ -1,229 +0,0 @@ --/* -- * Special support for eabi and SVR4 -- * -- * Copyright (C) 1995, 1996, 1998, 2000, 2001 Free Software Foundation, Inc. -- * Copyright 2008 Freescale Semiconductor, Inc. -- * Written By Michael Meissner -- * -- * Based on gcc/config/rs6000/crtsavres.asm from gcc -- * -- * This file 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, or (at your option) any -- * later version. -- * -- * In addition to the permissions in the GNU General Public License, the -- * Free Software Foundation gives you unlimited permission to link the -- * compiled version of this file with other programs, and to distribute -- * those programs without any restriction coming from the use of this -- * file. (The General Public License restrictions do apply in other -- * respects; for example, they cover modification of the file, and -- * distribution when not linked into another program.) -- * -- * This file is distributed in the hope that it will be useful, but -- * WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- * General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with this program; see the file COPYING. If not, write to -- * the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- * Boston, MA 02110-1301, USA. -- * -- * As a special exception, if you link this library with files -- * compiled with GCC to produce an executable, this does not cause -- * the resulting executable to be covered by the GNU General Public License. -- * This exception does not however invalidate any other reasons why -- * the executable file might be covered by the GNU General Public License. -- */ -- --#include -- -- .file "crtsavres.S" -- .section ".text" -- --#ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE -- --/* Routines for saving integer registers, called by the compiler. */ --/* Called with r11 pointing to the stack header word of the caller of the */ --/* function, just beyond the end of the integer save area. */ -- --_GLOBAL(_savegpr_14) --_GLOBAL(_save32gpr_14) -- stw 14,-72(11) /* save gp registers */ --_GLOBAL(_savegpr_15) --_GLOBAL(_save32gpr_15) -- stw 15,-68(11) --_GLOBAL(_savegpr_16) --_GLOBAL(_save32gpr_16) -- stw 16,-64(11) --_GLOBAL(_savegpr_17) --_GLOBAL(_save32gpr_17) -- stw 17,-60(11) --_GLOBAL(_savegpr_18) --_GLOBAL(_save32gpr_18) -- stw 18,-56(11) --_GLOBAL(_savegpr_19) --_GLOBAL(_save32gpr_19) -- stw 19,-52(11) --_GLOBAL(_savegpr_20) --_GLOBAL(_save32gpr_20) -- stw 20,-48(11) --_GLOBAL(_savegpr_21) --_GLOBAL(_save32gpr_21) -- stw 21,-44(11) --_GLOBAL(_savegpr_22) --_GLOBAL(_save32gpr_22) -- stw 22,-40(11) --_GLOBAL(_savegpr_23) --_GLOBAL(_save32gpr_23) -- stw 23,-36(11) --_GLOBAL(_savegpr_24) --_GLOBAL(_save32gpr_24) -- stw 24,-32(11) --_GLOBAL(_savegpr_25) --_GLOBAL(_save32gpr_25) -- stw 25,-28(11) --_GLOBAL(_savegpr_26) --_GLOBAL(_save32gpr_26) -- stw 26,-24(11) --_GLOBAL(_savegpr_27) --_GLOBAL(_save32gpr_27) -- stw 27,-20(11) --_GLOBAL(_savegpr_28) --_GLOBAL(_save32gpr_28) -- stw 28,-16(11) --_GLOBAL(_savegpr_29) --_GLOBAL(_save32gpr_29) -- stw 29,-12(11) --_GLOBAL(_savegpr_30) --_GLOBAL(_save32gpr_30) -- stw 30,-8(11) --_GLOBAL(_savegpr_31) --_GLOBAL(_save32gpr_31) -- stw 31,-4(11) -- blr -- --/* Routines for restoring integer registers, called by the compiler. */ --/* Called with r11 pointing to the stack header word of the caller of the */ --/* function, just beyond the end of the integer restore area. */ -- --_GLOBAL(_restgpr_14) --_GLOBAL(_rest32gpr_14) -- lwz 14,-72(11) /* restore gp registers */ --_GLOBAL(_restgpr_15) --_GLOBAL(_rest32gpr_15) -- lwz 15,-68(11) --_GLOBAL(_restgpr_16) --_GLOBAL(_rest32gpr_16) -- lwz 16,-64(11) --_GLOBAL(_restgpr_17) --_GLOBAL(_rest32gpr_17) -- lwz 17,-60(11) --_GLOBAL(_restgpr_18) --_GLOBAL(_rest32gpr_18) -- lwz 18,-56(11) --_GLOBAL(_restgpr_19) --_GLOBAL(_rest32gpr_19) -- lwz 19,-52(11) --_GLOBAL(_restgpr_20) --_GLOBAL(_rest32gpr_20) -- lwz 20,-48(11) --_GLOBAL(_restgpr_21) --_GLOBAL(_rest32gpr_21) -- lwz 21,-44(11) --_GLOBAL(_restgpr_22) --_GLOBAL(_rest32gpr_22) -- lwz 22,-40(11) --_GLOBAL(_restgpr_23) --_GLOBAL(_rest32gpr_23) -- lwz 23,-36(11) --_GLOBAL(_restgpr_24) --_GLOBAL(_rest32gpr_24) -- lwz 24,-32(11) --_GLOBAL(_restgpr_25) --_GLOBAL(_rest32gpr_25) -- lwz 25,-28(11) --_GLOBAL(_restgpr_26) --_GLOBAL(_rest32gpr_26) -- lwz 26,-24(11) --_GLOBAL(_restgpr_27) --_GLOBAL(_rest32gpr_27) -- lwz 27,-20(11) --_GLOBAL(_restgpr_28) --_GLOBAL(_rest32gpr_28) -- lwz 28,-16(11) --_GLOBAL(_restgpr_29) --_GLOBAL(_rest32gpr_29) -- lwz 29,-12(11) --_GLOBAL(_restgpr_30) --_GLOBAL(_rest32gpr_30) -- lwz 30,-8(11) --_GLOBAL(_restgpr_31) --_GLOBAL(_rest32gpr_31) -- lwz 31,-4(11) -- blr -- --/* Routines for restoring integer registers, called by the compiler. */ --/* Called with r11 pointing to the stack header word of the caller of the */ --/* function, just beyond the end of the integer restore area. */ -- --_GLOBAL(_restgpr_14_x) --_GLOBAL(_rest32gpr_14_x) -- lwz 14,-72(11) /* restore gp registers */ --_GLOBAL(_restgpr_15_x) --_GLOBAL(_rest32gpr_15_x) -- lwz 15,-68(11) --_GLOBAL(_restgpr_16_x) --_GLOBAL(_rest32gpr_16_x) -- lwz 16,-64(11) --_GLOBAL(_restgpr_17_x) --_GLOBAL(_rest32gpr_17_x) -- lwz 17,-60(11) --_GLOBAL(_restgpr_18_x) --_GLOBAL(_rest32gpr_18_x) -- lwz 18,-56(11) --_GLOBAL(_restgpr_19_x) --_GLOBAL(_rest32gpr_19_x) -- lwz 19,-52(11) --_GLOBAL(_restgpr_20_x) --_GLOBAL(_rest32gpr_20_x) -- lwz 20,-48(11) --_GLOBAL(_restgpr_21_x) --_GLOBAL(_rest32gpr_21_x) -- lwz 21,-44(11) --_GLOBAL(_restgpr_22_x) --_GLOBAL(_rest32gpr_22_x) -- lwz 22,-40(11) --_GLOBAL(_restgpr_23_x) --_GLOBAL(_rest32gpr_23_x) -- lwz 23,-36(11) --_GLOBAL(_restgpr_24_x) --_GLOBAL(_rest32gpr_24_x) -- lwz 24,-32(11) --_GLOBAL(_restgpr_25_x) --_GLOBAL(_rest32gpr_25_x) -- lwz 25,-28(11) --_GLOBAL(_restgpr_26_x) --_GLOBAL(_rest32gpr_26_x) -- lwz 26,-24(11) --_GLOBAL(_restgpr_27_x) --_GLOBAL(_rest32gpr_27_x) -- lwz 27,-20(11) --_GLOBAL(_restgpr_28_x) --_GLOBAL(_rest32gpr_28_x) -- lwz 28,-16(11) --_GLOBAL(_restgpr_29_x) --_GLOBAL(_rest32gpr_29_x) -- lwz 29,-12(11) --_GLOBAL(_restgpr_30_x) --_GLOBAL(_rest32gpr_30_x) -- lwz 30,-8(11) --_GLOBAL(_restgpr_31_x) --_GLOBAL(_rest32gpr_31_x) -- lwz 0,4(11) -- lwz 31,-4(11) -- mtlr 0 -- mr 1,11 -- blr --#endif ---- a/arch/powerpc/lib/Makefile -+++ b/arch/powerpc/lib/Makefile -@@ -8,7 +8,7 @@ endif - - obj-y := string.o alloc.o \ - checksum_$(CONFIG_WORD_SIZE).o --obj-$(CONFIG_PPC32) += div64.o copy_32.o crtsavres.o -+obj-$(CONFIG_PPC32) += div64.o copy_32.o - obj-$(CONFIG_HAS_IOMEM) += devres.o - - obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \ ---- a/arch/powerpc/Makefile -+++ b/arch/powerpc/Makefile -@@ -90,8 +90,6 @@ endif - else - KBUILD_CFLAGS += $(call cc-option,-mtune=power4) - endif --else --LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o - endif - - ifeq ($(CONFIG_TUNE_CELL),y) diff --git a/target/linux/generic-2.6/patches-2.6.27/952-revert_xt_string_case_insensitive_match.patch b/target/linux/generic-2.6/patches-2.6.27/952-revert_xt_string_case_insensitive_match.patch deleted file mode 100644 index 6f317e466..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/952-revert_xt_string_case_insensitive_match.patch +++ /dev/null @@ -1,112 +0,0 @@ ---- a/include/linux/netfilter/xt_string.h -+++ b/include/linux/netfilter/xt_string.h -@@ -4,11 +4,6 @@ - #define XT_STRING_MAX_PATTERN_SIZE 128 - #define XT_STRING_MAX_ALGO_NAME_SIZE 16 - --enum { -- XT_STRING_FLAG_INVERT = 0x01, -- XT_STRING_FLAG_IGNORECASE = 0x02 --}; -- - struct xt_string_info - { - u_int16_t from_offset; -@@ -16,15 +11,7 @@ struct xt_string_info - char algo[XT_STRING_MAX_ALGO_NAME_SIZE]; - char pattern[XT_STRING_MAX_PATTERN_SIZE]; - u_int8_t patlen; -- union { -- struct { -- u_int8_t invert; -- } v0; -- -- struct { -- u_int8_t flags; -- } v1; -- } u; -+ u_int8_t invert; - - /* Used internally by the kernel */ - struct ts_config __attribute__((aligned(8))) *config; ---- a/net/netfilter/xt_string.c -+++ b/net/netfilter/xt_string.c -@@ -29,16 +29,12 @@ string_mt(const struct sk_buff *skb, con - { - const struct xt_string_info *conf = matchinfo; - struct ts_state state; -- int invert; - - memset(&state, 0, sizeof(struct ts_state)); - -- invert = (match->revision == 0 ? conf->u.v0.invert : -- conf->u.v1.flags & XT_STRING_FLAG_INVERT); -- - return (skb_find_text((struct sk_buff *)skb, conf->from_offset, - conf->to_offset, conf->config, &state) -- != UINT_MAX) ^ invert; -+ != UINT_MAX) ^ conf->invert; - } - - #define STRING_TEXT_PRIV(m) ((struct xt_string_info *)(m)) -@@ -50,7 +46,6 @@ string_mt_check(const char *tablename, c - { - struct xt_string_info *conf = matchinfo; - struct ts_config *ts_conf; -- int flags = TS_AUTOLOAD; - - /* Damn, can't handle this case properly with iptables... */ - if (conf->from_offset > conf->to_offset) -@@ -59,15 +54,8 @@ string_mt_check(const char *tablename, c - return false; - if (conf->patlen > XT_STRING_MAX_PATTERN_SIZE) - return false; -- if (match->revision == 1) { -- if (conf->u.v1.flags & -- ~(XT_STRING_FLAG_IGNORECASE | XT_STRING_FLAG_INVERT)) -- return false; -- if (conf->u.v1.flags & XT_STRING_FLAG_IGNORECASE) -- flags |= TS_IGNORECASE; -- } - ts_conf = textsearch_prepare(conf->algo, conf->pattern, conf->patlen, -- GFP_KERNEL, flags); -+ GFP_KERNEL, TS_AUTOLOAD); - if (IS_ERR(ts_conf)) - return false; - -@@ -84,17 +72,6 @@ static void string_mt_destroy(const stru - static struct xt_match string_mt_reg[] __read_mostly = { - { - .name = "string", -- .revision = 0, -- .family = AF_INET, -- .checkentry = string_mt_check, -- .match = string_mt, -- .destroy = string_mt_destroy, -- .matchsize = sizeof(struct xt_string_info), -- .me = THIS_MODULE -- }, -- { -- .name = "string", -- .revision = 1, - .family = AF_INET, - .checkentry = string_mt_check, - .match = string_mt, -@@ -104,17 +81,6 @@ static struct xt_match string_mt_reg[] _ - }, - { - .name = "string", -- .revision = 0, -- .family = AF_INET6, -- .checkentry = string_mt_check, -- .match = string_mt, -- .destroy = string_mt_destroy, -- .matchsize = sizeof(struct xt_string_info), -- .me = THIS_MODULE -- }, -- { -- .name = "string", -- .revision = 1, - .family = AF_INET6, - .checkentry = string_mt_check, - .match = string_mt, diff --git a/target/linux/generic-2.6/patches-2.6.27/970-ocf_kbuild_integration.patch b/target/linux/generic-2.6/patches-2.6.27/970-ocf_kbuild_integration.patch deleted file mode 100644 index 243708f7e..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/970-ocf_kbuild_integration.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/crypto/Kconfig -+++ b/crypto/Kconfig -@@ -666,6 +666,8 @@ config CRYPTO_LZO - help - This is the LZO algorithm. - -+source "crypto/ocf/Kconfig" -+ - source "drivers/crypto/Kconfig" - - endif # if CRYPTO ---- a/crypto/Makefile -+++ b/crypto/Makefile -@@ -73,6 +73,11 @@ obj-$(CONFIG_CRYPTO_LZO) += lzo.o - obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o - - # -+# OCF -+# -+obj-$(CONFIG_OCF_OCF) += ocf/ -+ -+# - # generic algorithms and the async_tx api - # - obj-$(CONFIG_XOR_BLOCKS) += xor.o diff --git a/target/linux/generic-2.6/patches-2.6.27/971-ocf_20080917.patch b/target/linux/generic-2.6/patches-2.6.27/971-ocf_20080917.patch deleted file mode 100644 index 3a84e6e4d..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/971-ocf_20080917.patch +++ /dev/null @@ -1,160 +0,0 @@ ---- a/drivers/char/random.c -+++ b/drivers/char/random.c -@@ -129,6 +129,9 @@ - * unsigned int value); - * void add_interrupt_randomness(int irq); - * -+ * void random_input_words(__u32 *buf, size_t wordcount, int ent_count) -+ * int random_input_wait(void); -+ * - * add_input_randomness() uses the input layer interrupt timing, as well as - * the event type information from the hardware. - * -@@ -140,6 +143,13 @@ - * a better measure, since the timing of the disk interrupts are more - * unpredictable. - * -+ * random_input_words() just provides a raw block of entropy to the input -+ * pool, such as from a hardware entropy generator. -+ * -+ * random_input_wait() suspends the caller until such time as the -+ * entropy pool falls below the write threshold, and returns a count of how -+ * much entropy (in bits) is needed to sustain the pool. -+ * - * All of these routines try to estimate how many bits of randomness a - * particular randomness source. They do this by keeping track of the - * first and second order deltas of the event timings. -@@ -668,6 +678,61 @@ void add_disk_randomness(struct gendisk - } - #endif - -+/* -+ * random_input_words - add bulk entropy to pool -+ * -+ * @buf: buffer to add -+ * @wordcount: number of __u32 words to add -+ * @ent_count: total amount of entropy (in bits) to credit -+ * -+ * this provides bulk input of entropy to the input pool -+ * -+ */ -+void random_input_words(__u32 *buf, size_t wordcount, int ent_count) -+{ -+ mix_pool_bytes(&input_pool, buf, wordcount*4); -+ -+ credit_entropy_bits(&input_pool, ent_count); -+ -+ DEBUG_ENT("crediting %d bits => %d\n", -+ ent_count, input_pool.entropy_count); -+ /* -+ * Wake up waiting processes if we have enough -+ * entropy. -+ */ -+ if (input_pool.entropy_count >= random_read_wakeup_thresh) -+ wake_up_interruptible(&random_read_wait); -+} -+EXPORT_SYMBOL(random_input_words); -+ -+/* -+ * random_input_wait - wait until random needs entropy -+ * -+ * this function sleeps until the /dev/random subsystem actually -+ * needs more entropy, and then return the amount of entropy -+ * that it would be nice to have added to the system. -+ */ -+int random_input_wait(void) -+{ -+ int count; -+ -+ wait_event_interruptible(random_write_wait, -+ input_pool.entropy_count < random_write_wakeup_thresh); -+ -+ count = random_write_wakeup_thresh - input_pool.entropy_count; -+ -+ /* likely we got woken up due to a signal */ -+ if (count <= 0) count = random_read_wakeup_thresh; -+ -+ DEBUG_ENT("requesting %d bits from input_wait()er %d<%d\n", -+ count, -+ input_pool.entropy_count, random_write_wakeup_thresh); -+ -+ return count; -+} -+EXPORT_SYMBOL(random_input_wait); -+ -+ - #define EXTRACT_SIZE 10 - - /********************************************************************* ---- a/fs/fcntl.c -+++ b/fs/fcntl.c -@@ -142,6 +142,7 @@ SYSCALL_DEFINE1(dup, unsigned int, filde - } - return ret; - } -+EXPORT_SYMBOL(sys_dup); - - #define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | FASYNC | O_DIRECT | O_NOATIME) - ---- a/include/linux/miscdevice.h -+++ b/include/linux/miscdevice.h -@@ -12,6 +12,7 @@ - #define APOLLO_MOUSE_MINOR 7 - #define PC110PAD_MINOR 9 - /*#define ADB_MOUSE_MINOR 10 FIXME OBSOLETE */ -+#define CRYPTODEV_MINOR 70 /* /dev/crypto */ - #define WATCHDOG_MINOR 130 /* Watchdog timer */ - #define TEMP_MINOR 131 /* Temperature Sensor */ - #define RTC_MINOR 135 ---- a/include/linux/random.h -+++ b/include/linux/random.h -@@ -8,6 +8,7 @@ - #define _LINUX_RANDOM_H - - #include -+#include /* for __u32 in user space */ - - /* ioctl()'s for the random number generator */ - -@@ -32,6 +33,30 @@ - /* Clear the entropy pool and associated counters. (Superuser only.) */ - #define RNDCLEARPOOL _IO( 'R', 0x06 ) - -+#ifdef CONFIG_FIPS_RNG -+ -+/* Size of seed value - equal to AES blocksize */ -+#define AES_BLOCK_SIZE_BYTES 16 -+#define SEED_SIZE_BYTES AES_BLOCK_SIZE_BYTES -+/* Size of AES key */ -+#define KEY_SIZE_BYTES 16 -+ -+/* ioctl() structure used by FIPS 140-2 Tests */ -+struct rand_fips_test { -+ unsigned char key[KEY_SIZE_BYTES]; /* Input */ -+ unsigned char datetime[SEED_SIZE_BYTES]; /* Input */ -+ unsigned char seed[SEED_SIZE_BYTES]; /* Input */ -+ unsigned char result[SEED_SIZE_BYTES]; /* Output */ -+}; -+ -+/* FIPS 140-2 RNG Variable Seed Test. (Superuser only.) */ -+#define RNDFIPSVST _IOWR('R', 0x10, struct rand_fips_test) -+ -+/* FIPS 140-2 RNG Monte Carlo Test. (Superuser only.) */ -+#define RNDFIPSMCT _IOWR('R', 0x11, struct rand_fips_test) -+ -+#endif /* #ifdef CONFIG_FIPS_RNG */ -+ - struct rand_pool_info { - int entropy_count; - int buf_size; -@@ -48,6 +73,10 @@ extern void add_input_randomness(unsigne - unsigned int value); - extern void add_interrupt_randomness(int irq); - -+extern void random_input_words(__u32 *buf, size_t wordcount, int ent_count); -+extern int random_input_wait(void); -+#define HAS_RANDOM_INPUT_WAIT 1 -+ - extern void get_random_bytes(void *buf, int nbytes); - void generate_random_uuid(unsigned char uuid_out[16]); - diff --git a/target/linux/generic-2.6/patches-2.6.27/972-ocf_compile_fix.patch b/target/linux/generic-2.6/patches-2.6.27/972-ocf_compile_fix.patch deleted file mode 100644 index a3fa22681..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/972-ocf_compile_fix.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/crypto/ocf/cryptosoft.c -+++ b/crypto/ocf/cryptosoft.c -@@ -47,7 +47,7 @@ - #include - #include - #include --#include -+#include - - #include - #include diff --git a/target/linux/generic-2.6/patches-2.6.27/973-ocf_2.6.27_fix.patch b/target/linux/generic-2.6/patches-2.6.27/973-ocf_2.6.27_fix.patch deleted file mode 100644 index ecb9bef51..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/973-ocf_2.6.27_fix.patch +++ /dev/null @@ -1,197 +0,0 @@ ---- a/crypto/ocf/random.c -+++ b/crypto/ocf/random.c -@@ -49,6 +49,7 @@ - #include - #include - #include -+#include - #include - - #ifdef CONFIG_OCF_FIPS -@@ -81,7 +82,7 @@ struct random_op { - - static int random_proc(void *arg); - --static pid_t randomproc = (pid_t) -1; -+static struct task_struct *random_task; - static spinlock_t random_lock; - - /* -@@ -141,13 +142,18 @@ crypto_rregister( - spin_lock_irqsave(&random_lock, flags); - list_add_tail(&rops->random_list, &random_ops); - if (!started) { -- randomproc = kernel_thread(random_proc, NULL, CLONE_FS|CLONE_FILES); -- if (randomproc < 0) { -- ret = randomproc; -+ struct task_struct *t; -+ -+ t = kthread_create(random_proc, NULL, "ocf-random"); -+ if (IS_ERR(t)) { -+ ret = PTR_ERR(t); - printk("crypto: crypto_rregister cannot start random thread; " - "error %d", ret); -- } else -+ } else { -+ random_task = t; -+ wake_up_process(t); - started = 1; -+ } - } - spin_unlock_irqrestore(&random_lock, flags); - -@@ -172,7 +178,7 @@ crypto_runregister_all(u_int32_t driveri - - spin_lock_irqsave(&random_lock, flags); - if (list_empty(&random_ops) && started) -- kill_proc(randomproc, SIGKILL, 1); -+ send_sig(SIGKILL, random_task, 1); - spin_unlock_irqrestore(&random_lock, flags); - return(0); - } -@@ -308,7 +314,7 @@ random_proc(void *arg) - - bad_alloc: - spin_lock_irq(&random_lock); -- randomproc = (pid_t) -1; -+ random_task = NULL; - started = 0; - spin_unlock_irq(&random_lock); - ---- a/crypto/ocf/crypto.c -+++ b/crypto/ocf/crypto.c -@@ -74,6 +74,7 @@ __FBSDID("$FreeBSD: src/sys/opencrypto/c - #include - #include - #include -+#include - #include - - /* -@@ -255,10 +256,10 @@ module_param(crypto_devallowsoft, int, 0 - MODULE_PARM_DESC(crypto_devallowsoft, - "Enable/disable use of software crypto support"); - --static pid_t cryptoproc = (pid_t) -1; -+static struct task_struct *crypto_task; - static struct completion cryptoproc_exited; - static DECLARE_WAIT_QUEUE_HEAD(cryptoproc_wait); --static pid_t cryptoretproc = (pid_t) -1; -+static struct task_struct *cryptoret_task; - static struct completion cryptoretproc_exited; - static DECLARE_WAIT_QUEUE_HEAD(cryptoretproc_wait); - -@@ -1401,7 +1402,7 @@ crypto_proc(void *arg) - wait_event_interruptible(cryptoproc_wait, - !(list_empty(&crp_q) || crypto_all_qblocked) || - !(list_empty(&crp_kq) || crypto_all_kqblocked) || -- cryptoproc == (pid_t) -1); -+ crypto_task == NULL); - crp_sleep = 0; - if (signal_pending (current)) { - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -@@ -1414,7 +1415,7 @@ crypto_proc(void *arg) - } - CRYPTO_Q_LOCK(); - dprintk("%s - awake\n", __FUNCTION__); -- if (cryptoproc == (pid_t) -1) -+ if (crypto_task == NULL) - break; - cryptostats.cs_intrs++; - } -@@ -1470,7 +1471,7 @@ crypto_ret_proc(void *arg) - dprintk("%s - sleeping\n", __FUNCTION__); - CRYPTO_RETQ_UNLOCK(); - wait_event_interruptible(cryptoretproc_wait, -- cryptoretproc == (pid_t) -1 || -+ cryptoret_task == NULL || - !list_empty(&crp_ret_q) || - !list_empty(&crp_ret_kq)); - if (signal_pending (current)) { -@@ -1484,7 +1485,7 @@ crypto_ret_proc(void *arg) - } - CRYPTO_RETQ_LOCK(); - dprintk("%s - awake\n", __FUNCTION__); -- if (cryptoretproc == (pid_t) -1) { -+ if (cryptoret_task == NULL) { - dprintk("%s - EXITING!\n", __FUNCTION__); - break; - } -@@ -1597,6 +1598,7 @@ DB_SHOW_COMMAND(kcrypto, db_show_kcrypto - static int - crypto_init(void) - { -+ struct task_struct *t; - int error; - - dprintk("%s(0x%x)\n", __FUNCTION__, (int) crypto_init); -@@ -1643,23 +1645,27 @@ crypto_init(void) - init_completion(&cryptoproc_exited); - init_completion(&cryptoretproc_exited); - -- cryptoproc = 0; /* to avoid race condition where proc runs first */ -- cryptoproc = kernel_thread(crypto_proc, NULL, CLONE_FS|CLONE_FILES); -- if (cryptoproc < 0) { -- error = cryptoproc; -+ crypto_task = NULL; /* to avoid race condition where proc runs first */ -+ t = kthread_create(crypto_proc, NULL, "ocf-crypto"); -+ if (IS_ERR(t)) { -+ error = PTR_ERR(t); - printk("crypto: crypto_init cannot start crypto thread; error %d", - error); - goto bad; - } -+ wake_up_process(t); -+ crypto_task = t; - -- cryptoretproc = 0; /* to avoid race condition where proc runs first */ -- cryptoretproc = kernel_thread(crypto_ret_proc, NULL, CLONE_FS|CLONE_FILES); -- if (cryptoretproc < 0) { -- error = cryptoretproc; -+ cryptoret_task = NULL; /* to avoid race condition where proc runs first */ -+ t = kthread_create(crypto_ret_proc, NULL, "ocf-cryptoret"); -+ if (IS_ERR(t)) { -+ error = PTR_ERR(t); - printk("crypto: crypto_init cannot start cryptoret thread; error %d", - error); - goto bad; - } -+ wake_up_process(t); -+ cryptoret_task = t; - - return 0; - bad: -@@ -1671,7 +1677,7 @@ bad: - static void - crypto_exit(void) - { -- pid_t p; -+ struct task_struct *t; - unsigned long d_flags; - - dprintk("%s()\n", __FUNCTION__); -@@ -1681,18 +1687,18 @@ crypto_exit(void) - */ - - CRYPTO_DRIVER_LOCK(); -- p = cryptoproc; -- cryptoproc = (pid_t) -1; -- kill_proc(p, SIGTERM, 1); -+ t = crypto_task; -+ crypto_task = NULL; -+ send_sig(SIGTERM, t, 1); - wake_up_interruptible(&cryptoproc_wait); - CRYPTO_DRIVER_UNLOCK(); - - wait_for_completion(&cryptoproc_exited); - - CRYPTO_DRIVER_LOCK(); -- p = cryptoretproc; -- cryptoretproc = (pid_t) -1; -- kill_proc(p, SIGTERM, 1); -+ t = cryptoret_task; -+ cryptoret_task = NULL; -+ send_sig(SIGTERM, t, 1); - wake_up_interruptible(&cryptoretproc_wait); - CRYPTO_DRIVER_UNLOCK(); - diff --git a/target/linux/generic-2.6/patches-2.6.27/974-ssb_b43_default_on.patch b/target/linux/generic-2.6/patches-2.6.27/974-ssb_b43_default_on.patch deleted file mode 100644 index 943230f76..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/974-ssb_b43_default_on.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/drivers/ssb/Kconfig -+++ b/drivers/ssb/Kconfig -@@ -48,7 +48,7 @@ config SSB_PCIHOST - config SSB_B43_PCI_BRIDGE - bool - depends on SSB_PCIHOST -- default n -+ default y - - config SSB_PCMCIAHOST_POSSIBLE - bool diff --git a/target/linux/generic-2.6/patches-2.6.27/975-crypto_kconfig_hacks.patch b/target/linux/generic-2.6/patches-2.6.27/975-crypto_kconfig_hacks.patch deleted file mode 100644 index ebf201b7b..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/975-crypto_kconfig_hacks.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/crypto/Kconfig -+++ b/crypto/Kconfig -@@ -22,20 +22,20 @@ if CRYPTO - comment "Crypto core or helper" - - config CRYPTO_ALGAPI -- tristate -+ tristate "ALG API" - help - This option provides the API for cryptographic algorithms. - - config CRYPTO_AEAD -- tristate -+ tristate "AEAD" - select CRYPTO_ALGAPI - - config CRYPTO_BLKCIPHER -- tristate -+ tristate "Block cipher" - select CRYPTO_ALGAPI - - config CRYPTO_HASH -- tristate -+ tristate "HASH" - select CRYPTO_ALGAPI - - config CRYPTO_MANAGER diff --git a/target/linux/generic-2.6/patches-2.6.27/976-ssb_fallback_sprom.patch b/target/linux/generic-2.6/patches-2.6.27/976-ssb_fallback_sprom.patch deleted file mode 100644 index 295d00ee6..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/976-ssb_fallback_sprom.patch +++ /dev/null @@ -1,107 +0,0 @@ ---- a/drivers/ssb/pci.c -+++ b/drivers/ssb/pci.c -@@ -500,6 +500,7 @@ unsupported: - static int ssb_pci_sprom_get(struct ssb_bus *bus, - struct ssb_sprom *sprom) - { -+ const struct ssb_sprom *fallback; - int err = -ENOMEM; - u16 *buf; - -@@ -519,12 +520,23 @@ static int ssb_pci_sprom_get(struct ssb_ - bus->sprom_size = SSB_SPROMSIZE_WORDS_R4; - sprom_do_read(bus, buf); - err = sprom_check_crc(buf, bus->sprom_size); -- if (err) -+ if (err) { -+ /* All CRC attempts failed. -+ * Maybe there is no SPROM on the device? -+ * If we have a fallback, use that. */ -+ fallback = ssb_get_fallback_sprom(); -+ if (fallback) { -+ memcpy(sprom, fallback, sizeof(*sprom)); -+ err = 0; -+ goto out_free; -+ } - ssb_printk(KERN_WARNING PFX "WARNING: Invalid" - " SPROM CRC (corrupt SPROM)\n"); -+ } - } - err = sprom_extract(bus, sprom, buf, bus->sprom_size); - -+out_free: - kfree(buf); - out: - return err; ---- a/drivers/ssb/sprom.c -+++ b/drivers/ssb/sprom.c -@@ -14,6 +14,9 @@ - #include "ssb_private.h" - - -+static const struct ssb_sprom *fallback_sprom; -+ -+ - static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len, - size_t sprom_size_words) - { -@@ -131,3 +134,36 @@ out: - return res; - return err ? err : count; - } -+ -+/** -+ * ssb_arch_set_fallback_sprom - Set a fallback SPROM for use if no SPROM is found. -+ * -+ * @sprom: The SPROM data structure to register. -+ * -+ * With this function the architecture implementation may register a fallback -+ * SPROM data structure. The fallback is only used for PCI based SSB devices, -+ * where no valid SPROM can be found in the shadow registers. -+ * -+ * This function is useful for weird architectures that have a half-assed SSB device -+ * hardwired to their PCI bus. -+ * -+ * Note that it does only work with PCI attached SSB devices. PCMCIA devices currently -+ * don't use this fallback. -+ * Architectures must provide the SPROM for native SSB devices anyway, -+ * so the fallback also isn't used for native devices. -+ * -+ * This function is available for architecture code, only. So it is not exported. -+ */ -+int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom) -+{ -+ if (fallback_sprom) -+ return -EEXIST; -+ fallback_sprom = sprom; -+ -+ return 0; -+} -+ -+const struct ssb_sprom *ssb_get_fallback_sprom(void) -+{ -+ return fallback_sprom; -+} ---- a/drivers/ssb/ssb_private.h -+++ b/drivers/ssb/ssb_private.h -@@ -131,6 +131,7 @@ ssize_t ssb_attr_sprom_store(struct ssb_ - const char *buf, size_t count, - int (*sprom_check_crc)(const u16 *sprom, size_t size), - int (*sprom_write)(struct ssb_bus *bus, const u16 *sprom)); -+extern const struct ssb_sprom *ssb_get_fallback_sprom(void); - - - /* core.c */ ---- a/include/linux/ssb/ssb.h -+++ b/include/linux/ssb/ssb.h -@@ -339,6 +339,10 @@ extern int ssb_bus_pcmciabus_register(st - - extern void ssb_bus_unregister(struct ssb_bus *bus); - -+/* Set a fallback SPROM. -+ * See kdoc at the function definition for complete documentation. */ -+extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom); -+ - /* Suspend a SSB bus. - * Call this from the parent bus suspend routine. */ - extern int ssb_bus_suspend(struct ssb_bus *bus); diff --git a/target/linux/generic-2.6/patches-2.6.27/977-textsearch_kconfig_hacks.patch b/target/linux/generic-2.6/patches-2.6.27/977-textsearch_kconfig_hacks.patch deleted file mode 100644 index 6370139ef..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/977-textsearch_kconfig_hacks.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/lib/Kconfig -+++ b/lib/Kconfig -@@ -122,13 +122,13 @@ config TEXTSEARCH - boolean - - config TEXTSEARCH_KMP -- tristate -+ tristate "Textsearch KMP" - - config TEXTSEARCH_BM -- tristate -+ tristate "Textsearch BM" - - config TEXTSEARCH_FSM -- tristate -+ tristate "Textsearch FSM" - - # - # plist support is select#ed if needed diff --git a/target/linux/generic-2.6/patches-2.6.27/978-ssb_update.patch b/target/linux/generic-2.6/patches-2.6.27/978-ssb_update.patch deleted file mode 100644 index ae3b50bba..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/978-ssb_update.patch +++ /dev/null @@ -1,1863 +0,0 @@ ---- a/drivers/ssb/Kconfig -+++ b/drivers/ssb/Kconfig -@@ -1,10 +1,11 @@ --menu "Sonics Silicon Backplane" -- - config SSB_POSSIBLE - bool - depends on HAS_IOMEM && HAS_DMA - default y - -+menu "Sonics Silicon Backplane" -+ depends on SSB_POSSIBLE -+ - config SSB - tristate "Sonics Silicon Backplane support" - depends on SSB_POSSIBLE -@@ -52,11 +53,11 @@ config SSB_B43_PCI_BRIDGE - - config SSB_PCMCIAHOST_POSSIBLE - bool -- depends on SSB && (PCMCIA = y || PCMCIA = SSB) && EXPERIMENTAL -+ depends on SSB && (PCMCIA = y || PCMCIA = SSB) - default y - - config SSB_PCMCIAHOST -- bool "Support for SSB on PCMCIA-bus host (EXPERIMENTAL)" -+ bool "Support for SSB on PCMCIA-bus host" - depends on SSB_PCMCIAHOST_POSSIBLE - select SSB_SPROM - help -@@ -106,14 +107,14 @@ config SSB_DRIVER_PCICORE - If unsure, say Y - - config SSB_PCICORE_HOSTMODE -- bool "Hostmode support for SSB PCI core (EXPERIMENTAL)" -- depends on SSB_DRIVER_PCICORE && SSB_DRIVER_MIPS && EXPERIMENTAL -+ bool "Hostmode support for SSB PCI core" -+ depends on SSB_DRIVER_PCICORE && SSB_DRIVER_MIPS - help - PCIcore hostmode operation (external PCI bus). - - config SSB_DRIVER_MIPS -- bool "SSB Broadcom MIPS core driver (EXPERIMENTAL)" -- depends on SSB && MIPS && EXPERIMENTAL -+ bool "SSB Broadcom MIPS core driver" -+ depends on SSB && MIPS - select SSB_SERIAL - help - Driver for the Sonics Silicon Backplane attached -@@ -125,11 +126,13 @@ config SSB_DRIVER_MIPS - config SSB_EMBEDDED - bool - depends on SSB_DRIVER_MIPS -+ select USB_EHCI_HCD_SSB if USB_EHCI_HCD -+ select USB_OHCI_HCD_SSB if USB_OHCI_HCD - default y - - config SSB_DRIVER_EXTIF -- bool "SSB Broadcom EXTIF core driver (EXPERIMENTAL)" -- depends on SSB_DRIVER_MIPS && EXPERIMENTAL -+ bool "SSB Broadcom EXTIF core driver" -+ depends on SSB_DRIVER_MIPS - help - Driver for the Sonics Silicon Backplane attached - Broadcom EXTIF core. ---- a/drivers/ssb/Makefile -+++ b/drivers/ssb/Makefile -@@ -9,6 +9,7 @@ ssb-$(CONFIG_SSB_PCMCIAHOST) += pcmcia. - - # built-in drivers - ssb-y += driver_chipcommon.o -+ssb-y += driver_chipcommon_pmu.o - ssb-$(CONFIG_SSB_DRIVER_MIPS) += driver_mipscore.o - ssb-$(CONFIG_SSB_DRIVER_EXTIF) += driver_extif.o - ssb-$(CONFIG_SSB_DRIVER_PCICORE) += driver_pcicore.o ---- a/drivers/ssb/b43_pci_bridge.c -+++ b/drivers/ssb/b43_pci_bridge.c -@@ -18,9 +18,11 @@ - - static const struct pci_device_id b43_pci_bridge_tbl[] = { - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4301) }, -+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4306) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4307) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4311) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4312) }, -+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4315) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4318) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4319) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4320) }, -@@ -29,6 +31,7 @@ static const struct pci_device_id b43_pc - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4325) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4328) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4329) }, -+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x432b) }, - { 0, }, - }; - MODULE_DEVICE_TABLE(pci, b43_pci_bridge_tbl); ---- a/drivers/ssb/driver_chipcommon.c -+++ b/drivers/ssb/driver_chipcommon.c -@@ -26,19 +26,6 @@ enum ssb_clksrc { - }; - - --static inline u32 chipco_read32(struct ssb_chipcommon *cc, -- u16 offset) --{ -- return ssb_read32(cc->dev, offset); --} -- --static inline void chipco_write32(struct ssb_chipcommon *cc, -- u16 offset, -- u32 value) --{ -- ssb_write32(cc->dev, offset, value); --} -- - static inline u32 chipco_write32_masked(struct ssb_chipcommon *cc, u16 offset, - u32 mask, u32 value) - { ---- a/drivers/ssb/main.c -+++ b/drivers/ssb/main.c -@@ -473,6 +473,8 @@ static int ssb_devices_register(struct s - case SSB_BUSTYPE_SSB: - dev->dma_mask = &dev->coherent_dma_mask; - break; -+ default: -+ break; - } - - sdev->dev = dev; -@@ -1359,8 +1361,10 @@ static int __init ssb_modinit(void) - ssb_buses_lock(); - err = ssb_attach_queued_buses(); - ssb_buses_unlock(); -- if (err) -+ if (err) { - bus_unregister(&ssb_bustype); -+ goto out; -+ } - - err = b43_pci_ssb_bridge_init(); - if (err) { -@@ -1376,7 +1380,7 @@ static int __init ssb_modinit(void) - /* don't fail SSB init because of this */ - err = 0; - } -- -+out: - return err; - } - /* ssb must be initialized after PCI but before the ssb drivers. ---- a/drivers/ssb/pci.c -+++ b/drivers/ssb/pci.c -@@ -169,8 +169,14 @@ err_pci: - /* Get the word-offset for a SSB_SPROM_XXX define. */ - #define SPOFF(offset) (((offset) - SSB_SPROM_BASE) / sizeof(u16)) - /* Helper to extract some _offset, which is one of the SSB_SPROM_XXX defines. */ --#define SPEX(_outvar, _offset, _mask, _shift) \ -+#define SPEX16(_outvar, _offset, _mask, _shift) \ - out->_outvar = ((in[SPOFF(_offset)] & (_mask)) >> (_shift)) -+#define SPEX32(_outvar, _offset, _mask, _shift) \ -+ out->_outvar = ((((u32)in[SPOFF((_offset)+2)] << 16 | \ -+ in[SPOFF(_offset)]) & (_mask)) >> (_shift)) -+#define SPEX(_outvar, _offset, _mask, _shift) \ -+ SPEX16(_outvar, _offset, _mask, _shift) -+ - - static inline u8 ssb_crc8(u8 crc, u8 data) - { -@@ -327,11 +333,9 @@ static void sprom_extract_r123(struct ss - s8 gain; - u16 loc[3]; - -- if (out->revision == 3) { /* rev 3 moved MAC */ -+ if (out->revision == 3) /* rev 3 moved MAC */ - loc[0] = SSB_SPROM3_IL0MAC; -- loc[1] = SSB_SPROM3_ET0MAC; -- loc[2] = SSB_SPROM3_ET1MAC; -- } else { -+ else { - loc[0] = SSB_SPROM1_IL0MAC; - loc[1] = SSB_SPROM1_ET0MAC; - loc[2] = SSB_SPROM1_ET1MAC; -@@ -340,13 +344,15 @@ static void sprom_extract_r123(struct ss - v = in[SPOFF(loc[0]) + i]; - *(((__be16 *)out->il0mac) + i) = cpu_to_be16(v); - } -- for (i = 0; i < 3; i++) { -- v = in[SPOFF(loc[1]) + i]; -- *(((__be16 *)out->et0mac) + i) = cpu_to_be16(v); -- } -- for (i = 0; i < 3; i++) { -- v = in[SPOFF(loc[2]) + i]; -- *(((__be16 *)out->et1mac) + i) = cpu_to_be16(v); -+ if (out->revision < 3) { /* only rev 1-2 have et0, et1 */ -+ for (i = 0; i < 3; i++) { -+ v = in[SPOFF(loc[1]) + i]; -+ *(((__be16 *)out->et0mac) + i) = cpu_to_be16(v); -+ } -+ for (i = 0; i < 3; i++) { -+ v = in[SPOFF(loc[2]) + i]; -+ *(((__be16 *)out->et1mac) + i) = cpu_to_be16(v); -+ } - } - SPEX(et0phyaddr, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET0A, 0); - SPEX(et1phyaddr, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET1A, -@@ -399,30 +405,33 @@ static void sprom_extract_r123(struct ss - out->antenna_gain.ghz5.a3 = gain; - } - --static void sprom_extract_r4(struct ssb_sprom *out, const u16 *in) -+static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in) - { - int i; - u16 v; -+ u16 il0mac_offset; - -- /* extract the equivalent of the r1 variables */ -+ if (out->revision == 4) -+ il0mac_offset = SSB_SPROM4_IL0MAC; -+ else -+ il0mac_offset = SSB_SPROM5_IL0MAC; -+ /* extract the MAC address */ - for (i = 0; i < 3; i++) { -- v = in[SPOFF(SSB_SPROM4_IL0MAC) + i]; -+ v = in[SPOFF(il0mac_offset) + i]; - *(((__be16 *)out->il0mac) + i) = cpu_to_be16(v); - } -- for (i = 0; i < 3; i++) { -- v = in[SPOFF(SSB_SPROM4_ET0MAC) + i]; -- *(((__be16 *)out->et0mac) + i) = cpu_to_be16(v); -- } -- for (i = 0; i < 3; i++) { -- v = in[SPOFF(SSB_SPROM4_ET1MAC) + i]; -- *(((__be16 *)out->et1mac) + i) = cpu_to_be16(v); -- } - SPEX(et0phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET0A, 0); - SPEX(et1phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET1A, - SSB_SPROM4_ETHPHY_ET1A_SHIFT); -- SPEX(country_code, SSB_SPROM4_CCODE, 0xFFFF, 0); -- SPEX(boardflags_lo, SSB_SPROM4_BFLLO, 0xFFFF, 0); -- SPEX(boardflags_hi, SSB_SPROM4_BFLHI, 0xFFFF, 0); -+ if (out->revision == 4) { -+ SPEX(country_code, SSB_SPROM4_CCODE, 0xFFFF, 0); -+ SPEX(boardflags_lo, SSB_SPROM4_BFLLO, 0xFFFF, 0); -+ SPEX(boardflags_hi, SSB_SPROM4_BFLHI, 0xFFFF, 0); -+ } else { -+ SPEX(country_code, SSB_SPROM5_CCODE, 0xFFFF, 0); -+ SPEX(boardflags_lo, SSB_SPROM5_BFLLO, 0xFFFF, 0); -+ SPEX(boardflags_hi, SSB_SPROM5_BFLHI, 0xFFFF, 0); -+ } - SPEX(ant_available_a, SSB_SPROM4_ANTAVAIL, SSB_SPROM4_ANTAVAIL_A, - SSB_SPROM4_ANTAVAIL_A_SHIFT); - SPEX(ant_available_bg, SSB_SPROM4_ANTAVAIL, SSB_SPROM4_ANTAVAIL_BG, -@@ -433,12 +442,21 @@ static void sprom_extract_r4(struct ssb_ - SPEX(maxpwr_a, SSB_SPROM4_MAXP_A, SSB_SPROM4_MAXP_A_MASK, 0); - SPEX(itssi_a, SSB_SPROM4_MAXP_A, SSB_SPROM4_ITSSI_A, - SSB_SPROM4_ITSSI_A_SHIFT); -- SPEX(gpio0, SSB_SPROM4_GPIOA, SSB_SPROM4_GPIOA_P0, 0); -- SPEX(gpio1, SSB_SPROM4_GPIOA, SSB_SPROM4_GPIOA_P1, -- SSB_SPROM4_GPIOA_P1_SHIFT); -- SPEX(gpio2, SSB_SPROM4_GPIOB, SSB_SPROM4_GPIOB_P2, 0); -- SPEX(gpio3, SSB_SPROM4_GPIOB, SSB_SPROM4_GPIOB_P3, -- SSB_SPROM4_GPIOB_P3_SHIFT); -+ if (out->revision == 4) { -+ SPEX(gpio0, SSB_SPROM4_GPIOA, SSB_SPROM4_GPIOA_P0, 0); -+ SPEX(gpio1, SSB_SPROM4_GPIOA, SSB_SPROM4_GPIOA_P1, -+ SSB_SPROM4_GPIOA_P1_SHIFT); -+ SPEX(gpio2, SSB_SPROM4_GPIOB, SSB_SPROM4_GPIOB_P2, 0); -+ SPEX(gpio3, SSB_SPROM4_GPIOB, SSB_SPROM4_GPIOB_P3, -+ SSB_SPROM4_GPIOB_P3_SHIFT); -+ } else { -+ SPEX(gpio0, SSB_SPROM5_GPIOA, SSB_SPROM5_GPIOA_P0, 0); -+ SPEX(gpio1, SSB_SPROM5_GPIOA, SSB_SPROM5_GPIOA_P1, -+ SSB_SPROM5_GPIOA_P1_SHIFT); -+ SPEX(gpio2, SSB_SPROM5_GPIOB, SSB_SPROM5_GPIOB_P2, 0); -+ SPEX(gpio3, SSB_SPROM5_GPIOB, SSB_SPROM5_GPIOB_P3, -+ SSB_SPROM5_GPIOB_P3_SHIFT); -+ } - - /* Extract the antenna gain values. */ - SPEX(antenna_gain.ghz24.a0, SSB_SPROM4_AGAIN01, -@@ -455,6 +473,96 @@ static void sprom_extract_r4(struct ssb_ - /* TODO - get remaining rev 4 stuff needed */ - } - -+static void sprom_extract_r8(struct ssb_sprom *out, const u16 *in) -+{ -+ int i; -+ u16 v; -+ -+ /* extract the MAC address */ -+ for (i = 0; i < 3; i++) { -+ v = in[SPOFF(SSB_SPROM8_IL0MAC) + i]; -+ *(((__be16 *)out->il0mac) + i) = cpu_to_be16(v); -+ } -+ SPEX(country_code, SSB_SPROM8_CCODE, 0xFFFF, 0); -+ SPEX(boardflags_lo, SSB_SPROM8_BFLLO, 0xFFFF, 0); -+ SPEX(boardflags_hi, SSB_SPROM8_BFLHI, 0xFFFF, 0); -+ SPEX(boardflags2_lo, SSB_SPROM8_BFL2LO, 0xFFFF, 0); -+ SPEX(boardflags2_hi, SSB_SPROM8_BFL2HI, 0xFFFF, 0); -+ SPEX(ant_available_a, SSB_SPROM8_ANTAVAIL, SSB_SPROM8_ANTAVAIL_A, -+ SSB_SPROM8_ANTAVAIL_A_SHIFT); -+ SPEX(ant_available_bg, SSB_SPROM8_ANTAVAIL, SSB_SPROM8_ANTAVAIL_BG, -+ SSB_SPROM8_ANTAVAIL_BG_SHIFT); -+ SPEX(maxpwr_bg, SSB_SPROM8_MAXP_BG, SSB_SPROM8_MAXP_BG_MASK, 0); -+ SPEX(itssi_bg, SSB_SPROM8_MAXP_BG, SSB_SPROM8_ITSSI_BG, -+ SSB_SPROM8_ITSSI_BG_SHIFT); -+ SPEX(maxpwr_a, SSB_SPROM8_MAXP_A, SSB_SPROM8_MAXP_A_MASK, 0); -+ SPEX(itssi_a, SSB_SPROM8_MAXP_A, SSB_SPROM8_ITSSI_A, -+ SSB_SPROM8_ITSSI_A_SHIFT); -+ SPEX(maxpwr_ah, SSB_SPROM8_MAXP_AHL, SSB_SPROM8_MAXP_AH_MASK, 0); -+ SPEX(maxpwr_al, SSB_SPROM8_MAXP_AHL, SSB_SPROM8_MAXP_AL_MASK, -+ SSB_SPROM8_MAXP_AL_SHIFT); -+ SPEX(gpio0, SSB_SPROM8_GPIOA, SSB_SPROM8_GPIOA_P0, 0); -+ SPEX(gpio1, SSB_SPROM8_GPIOA, SSB_SPROM8_GPIOA_P1, -+ SSB_SPROM8_GPIOA_P1_SHIFT); -+ SPEX(gpio2, SSB_SPROM8_GPIOB, SSB_SPROM8_GPIOB_P2, 0); -+ SPEX(gpio3, SSB_SPROM8_GPIOB, SSB_SPROM8_GPIOB_P3, -+ SSB_SPROM8_GPIOB_P3_SHIFT); -+ SPEX(tri2g, SSB_SPROM8_TRI25G, SSB_SPROM8_TRI2G, 0); -+ SPEX(tri5g, SSB_SPROM8_TRI25G, SSB_SPROM8_TRI5G, -+ SSB_SPROM8_TRI5G_SHIFT); -+ SPEX(tri5gl, SSB_SPROM8_TRI5GHL, SSB_SPROM8_TRI5GL, 0); -+ SPEX(tri5gh, SSB_SPROM8_TRI5GHL, SSB_SPROM8_TRI5GH, -+ SSB_SPROM8_TRI5GH_SHIFT); -+ SPEX(rxpo2g, SSB_SPROM8_RXPO, SSB_SPROM8_RXPO2G, 0); -+ SPEX(rxpo5g, SSB_SPROM8_RXPO, SSB_SPROM8_RXPO5G, -+ SSB_SPROM8_RXPO5G_SHIFT); -+ SPEX(rssismf2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_RSSISMF2G, 0); -+ SPEX(rssismc2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_RSSISMC2G, -+ SSB_SPROM8_RSSISMC2G_SHIFT); -+ SPEX(rssisav2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_RSSISAV2G, -+ SSB_SPROM8_RSSISAV2G_SHIFT); -+ SPEX(bxa2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_BXA2G, -+ SSB_SPROM8_BXA2G_SHIFT); -+ SPEX(rssismf5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_RSSISMF5G, 0); -+ SPEX(rssismc5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_RSSISMC5G, -+ SSB_SPROM8_RSSISMC5G_SHIFT); -+ SPEX(rssisav5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_RSSISAV5G, -+ SSB_SPROM8_RSSISAV5G_SHIFT); -+ SPEX(bxa5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_BXA5G, -+ SSB_SPROM8_BXA5G_SHIFT); -+ SPEX(pa0b0, SSB_SPROM8_PA0B0, 0xFFFF, 0); -+ SPEX(pa0b1, SSB_SPROM8_PA0B1, 0xFFFF, 0); -+ SPEX(pa0b2, SSB_SPROM8_PA0B2, 0xFFFF, 0); -+ SPEX(pa1b0, SSB_SPROM8_PA1B0, 0xFFFF, 0); -+ SPEX(pa1b1, SSB_SPROM8_PA1B1, 0xFFFF, 0); -+ SPEX(pa1b2, SSB_SPROM8_PA1B2, 0xFFFF, 0); -+ SPEX(pa1lob0, SSB_SPROM8_PA1LOB0, 0xFFFF, 0); -+ SPEX(pa1lob1, SSB_SPROM8_PA1LOB1, 0xFFFF, 0); -+ SPEX(pa1lob2, SSB_SPROM8_PA1LOB2, 0xFFFF, 0); -+ SPEX(pa1hib0, SSB_SPROM8_PA1HIB0, 0xFFFF, 0); -+ SPEX(pa1hib1, SSB_SPROM8_PA1HIB1, 0xFFFF, 0); -+ SPEX(pa1hib2, SSB_SPROM8_PA1HIB2, 0xFFFF, 0); -+ SPEX(cck2gpo, SSB_SPROM8_CCK2GPO, 0xFFFF, 0); -+ SPEX32(ofdm2gpo, SSB_SPROM8_OFDM2GPO, 0xFFFFFFFF, 0); -+ SPEX32(ofdm5glpo, SSB_SPROM8_OFDM5GLPO, 0xFFFFFFFF, 0); -+ SPEX32(ofdm5gpo, SSB_SPROM8_OFDM5GPO, 0xFFFFFFFF, 0); -+ SPEX32(ofdm5ghpo, SSB_SPROM8_OFDM5GHPO, 0xFFFFFFFF, 0); -+ -+ /* Extract the antenna gain values. */ -+ SPEX(antenna_gain.ghz24.a0, SSB_SPROM8_AGAIN01, -+ SSB_SPROM8_AGAIN0, SSB_SPROM8_AGAIN0_SHIFT); -+ SPEX(antenna_gain.ghz24.a1, SSB_SPROM8_AGAIN01, -+ SSB_SPROM8_AGAIN1, SSB_SPROM8_AGAIN1_SHIFT); -+ SPEX(antenna_gain.ghz24.a2, SSB_SPROM8_AGAIN23, -+ SSB_SPROM8_AGAIN2, SSB_SPROM8_AGAIN2_SHIFT); -+ SPEX(antenna_gain.ghz24.a3, SSB_SPROM8_AGAIN23, -+ SSB_SPROM8_AGAIN3, SSB_SPROM8_AGAIN3_SHIFT); -+ memcpy(&out->antenna_gain.ghz5, &out->antenna_gain.ghz24, -+ sizeof(out->antenna_gain.ghz5)); -+ -+ /* TODO - get remaining rev 8 stuff needed */ -+} -+ - static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out, - const u16 *in, u16 size) - { -@@ -462,6 +570,8 @@ static int sprom_extract(struct ssb_bus - - out->revision = in[size - 1] & 0x00FF; - ssb_dprintk(KERN_DEBUG PFX "SPROM revision %d detected.\n", out->revision); -+ memset(out->et0mac, 0xFF, 6); /* preset et0 and et1 mac */ -+ memset(out->et1mac, 0xFF, 6); - if ((bus->chip_id & 0xFF00) == 0x4400) { - /* Workaround: The BCM44XX chip has a stupid revision - * number stored in the SPROM. -@@ -471,17 +581,28 @@ static int sprom_extract(struct ssb_bus - } else if (bus->chip_id == 0x4321) { - /* the BCM4328 has a chipid == 0x4321 and a rev 4 SPROM */ - out->revision = 4; -- sprom_extract_r4(out, in); -+ sprom_extract_r45(out, in); - } else { -- if (out->revision == 0) -- goto unsupported; -- if (out->revision >= 1 && out->revision <= 3) { -+ switch (out->revision) { -+ case 1: -+ case 2: -+ case 3: -+ sprom_extract_r123(out, in); -+ break; -+ case 4: -+ case 5: -+ sprom_extract_r45(out, in); -+ break; -+ case 8: -+ sprom_extract_r8(out, in); -+ break; -+ default: -+ ssb_printk(KERN_WARNING PFX "Unsupported SPROM" -+ " revision %d detected. Will extract" -+ " v1\n", out->revision); -+ out->revision = 1; - sprom_extract_r123(out, in); - } -- if (out->revision == 4) -- sprom_extract_r4(out, in); -- if (out->revision >= 5) -- goto unsupported; - } - - if (out->boardflags_lo == 0xFFFF) -@@ -490,11 +611,6 @@ static int sprom_extract(struct ssb_bus - out->boardflags_hi = 0; /* per specs */ - - return 0; --unsupported: -- ssb_printk(KERN_WARNING PFX "Unsupported SPROM revision %d " -- "detected. Will extract v1\n", out->revision); -- sprom_extract_r123(out, in); -- return 0; - } - - static int ssb_pci_sprom_get(struct ssb_bus *bus, ---- a/drivers/ssb/pcmcia.c -+++ b/drivers/ssb/pcmcia.c -@@ -80,7 +80,7 @@ static int ssb_pcmcia_cfg_write(struct s - reg.Action = CS_WRITE; - reg.Value = value; - res = pcmcia_access_configuration_register(bus->host_pcmcia, ®); -- if (unlikely(res != CS_SUCCESS)) -+ if (unlikely(res != 0)) - return -EBUSY; - - return 0; -@@ -96,7 +96,7 @@ static int ssb_pcmcia_cfg_read(struct ss - reg.Offset = offset; - reg.Action = CS_READ; - res = pcmcia_access_configuration_register(bus->host_pcmcia, ®); -- if (unlikely(res != CS_SUCCESS)) -+ if (unlikely(res != 0)) - return -EBUSY; - *value = reg.Value; - -@@ -583,7 +583,7 @@ static int ssb_pcmcia_sprom_write_all(st - ssb_printk("."); - err = ssb_pcmcia_sprom_write(bus, i, sprom[i]); - if (err) { -- ssb_printk("\n" KERN_NOTICE PFX -+ ssb_printk(KERN_NOTICE PFX - "Failed to write to SPROM.\n"); - failed = 1; - break; -@@ -591,7 +591,7 @@ static int ssb_pcmcia_sprom_write_all(st - } - err = ssb_pcmcia_sprom_command(bus, SSB_PCMCIA_SPROMCTL_WRITEDIS); - if (err) { -- ssb_printk("\n" KERN_NOTICE PFX -+ ssb_printk(KERN_NOTICE PFX - "Could not disable SPROM write access.\n"); - failed = 1; - } -@@ -638,17 +638,17 @@ int ssb_pcmcia_get_invariants(struct ssb - tuple.TupleData = buf; - tuple.TupleDataMax = sizeof(buf); - res = pcmcia_get_first_tuple(bus->host_pcmcia, &tuple); -- GOTO_ERROR_ON(res != CS_SUCCESS, "MAC first tpl"); -+ GOTO_ERROR_ON(res != 0, "MAC first tpl"); - res = pcmcia_get_tuple_data(bus->host_pcmcia, &tuple); -- GOTO_ERROR_ON(res != CS_SUCCESS, "MAC first tpl data"); -+ GOTO_ERROR_ON(res != 0, "MAC first tpl data"); - while (1) { - GOTO_ERROR_ON(tuple.TupleDataLen < 1, "MAC tpl < 1"); - if (tuple.TupleData[0] == CISTPL_FUNCE_LAN_NODE_ID) - break; - res = pcmcia_get_next_tuple(bus->host_pcmcia, &tuple); -- GOTO_ERROR_ON(res != CS_SUCCESS, "MAC next tpl"); -+ GOTO_ERROR_ON(res != 0, "MAC next tpl"); - res = pcmcia_get_tuple_data(bus->host_pcmcia, &tuple); -- GOTO_ERROR_ON(res != CS_SUCCESS, "MAC next tpl data"); -+ GOTO_ERROR_ON(res != 0, "MAC next tpl data"); - } - GOTO_ERROR_ON(tuple.TupleDataLen != ETH_ALEN + 2, "MAC tpl size"); - memcpy(sprom->il0mac, &tuple.TupleData[2], ETH_ALEN); -@@ -659,9 +659,9 @@ int ssb_pcmcia_get_invariants(struct ssb - tuple.TupleData = buf; - tuple.TupleDataMax = sizeof(buf); - res = pcmcia_get_first_tuple(bus->host_pcmcia, &tuple); -- GOTO_ERROR_ON(res != CS_SUCCESS, "VEN first tpl"); -+ GOTO_ERROR_ON(res != 0, "VEN first tpl"); - res = pcmcia_get_tuple_data(bus->host_pcmcia, &tuple); -- GOTO_ERROR_ON(res != CS_SUCCESS, "VEN first tpl data"); -+ GOTO_ERROR_ON(res != 0, "VEN first tpl data"); - while (1) { - GOTO_ERROR_ON(tuple.TupleDataLen < 1, "VEN tpl < 1"); - switch (tuple.TupleData[0]) { -@@ -678,7 +678,8 @@ int ssb_pcmcia_get_invariants(struct ssb - sprom->board_rev = tuple.TupleData[1]; - break; - case SSB_PCMCIA_CIS_PA: -- GOTO_ERROR_ON(tuple.TupleDataLen != 9, -+ GOTO_ERROR_ON((tuple.TupleDataLen != 9) && -+ (tuple.TupleDataLen != 10), - "pa tpl size"); - sprom->pa0b0 = tuple.TupleData[1] | - ((u16)tuple.TupleData[2] << 8); -@@ -718,7 +719,8 @@ int ssb_pcmcia_get_invariants(struct ssb - sprom->antenna_gain.ghz5.a3 = tuple.TupleData[1]; - break; - case SSB_PCMCIA_CIS_BFLAGS: -- GOTO_ERROR_ON(tuple.TupleDataLen != 3, -+ GOTO_ERROR_ON((tuple.TupleDataLen != 3) && -+ (tuple.TupleDataLen != 5), - "bfl tpl size"); - sprom->boardflags_lo = tuple.TupleData[1] | - ((u16)tuple.TupleData[2] << 8); -@@ -733,11 +735,11 @@ int ssb_pcmcia_get_invariants(struct ssb - break; - } - res = pcmcia_get_next_tuple(bus->host_pcmcia, &tuple); -- if (res == CS_NO_MORE_ITEMS) -+ if (res == -ENOSPC) - break; -- GOTO_ERROR_ON(res != CS_SUCCESS, "VEN next tpl"); -+ GOTO_ERROR_ON(res != 0, "VEN next tpl"); - res = pcmcia_get_tuple_data(bus->host_pcmcia, &tuple); -- GOTO_ERROR_ON(res != CS_SUCCESS, "VEN next tpl data"); -+ GOTO_ERROR_ON(res != 0, "VEN next tpl data"); - } - - return 0; ---- a/drivers/ssb/scan.c -+++ b/drivers/ssb/scan.c -@@ -175,6 +175,8 @@ static u32 scan_read32(struct ssb_bus *b - } else - ssb_pcmcia_switch_segment(bus, 0); - break; -+ default: -+ break; - } - return readl(bus->mmio + offset); - } -@@ -188,6 +190,8 @@ static int scan_switchcore(struct ssb_bu - return ssb_pci_switch_coreidx(bus, coreidx); - case SSB_BUSTYPE_PCMCIA: - return ssb_pcmcia_switch_coreidx(bus, coreidx); -+ default: -+ break; - } - return 0; - } -@@ -206,6 +210,8 @@ void ssb_iounmap(struct ssb_bus *bus) - SSB_BUG_ON(1); /* Can't reach this code. */ - #endif - break; -+ default: -+ break; - } - bus->mmio = NULL; - bus->mapped_device = NULL; -@@ -230,6 +236,8 @@ static void __iomem *ssb_ioremap(struct - SSB_BUG_ON(1); /* Can't reach this code. */ - #endif - break; -+ default: -+ break; - } - - return mmio; ---- a/include/linux/ssb/ssb.h -+++ b/include/linux/ssb/ssb.h -@@ -27,24 +27,54 @@ struct ssb_sprom { - u8 et1mdcport; /* MDIO for enet1 */ - u8 board_rev; /* Board revision number from SPROM. */ - u8 country_code; /* Country Code */ -- u8 ant_available_a; /* A-PHY antenna available bits (up to 4) */ -- u8 ant_available_bg; /* B/G-PHY antenna available bits (up to 4) */ -+ u8 ant_available_a; /* 2GHz antenna available bits (up to 4) */ -+ u8 ant_available_bg; /* 5GHz antenna available bits (up to 4) */ - u16 pa0b0; - u16 pa0b1; - u16 pa0b2; - u16 pa1b0; - u16 pa1b1; - u16 pa1b2; -+ u16 pa1lob0; -+ u16 pa1lob1; -+ u16 pa1lob2; -+ u16 pa1hib0; -+ u16 pa1hib1; -+ u16 pa1hib2; - u8 gpio0; /* GPIO pin 0 */ - u8 gpio1; /* GPIO pin 1 */ - u8 gpio2; /* GPIO pin 2 */ - u8 gpio3; /* GPIO pin 3 */ -- u16 maxpwr_a; /* A-PHY Amplifier Max Power (in dBm Q5.2) */ -- u16 maxpwr_bg; /* B/G-PHY Amplifier Max Power (in dBm Q5.2) */ -+ u16 maxpwr_bg; /* 2.4GHz Amplifier Max Power (in dBm Q5.2) */ -+ u16 maxpwr_al; /* 5.2GHz Amplifier Max Power (in dBm Q5.2) */ -+ u16 maxpwr_a; /* 5.3GHz Amplifier Max Power (in dBm Q5.2) */ -+ u16 maxpwr_ah; /* 5.8GHz Amplifier Max Power (in dBm Q5.2) */ - u8 itssi_a; /* Idle TSSI Target for A-PHY */ - u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */ -- u16 boardflags_lo; /* Boardflags (low 16 bits) */ -- u16 boardflags_hi; /* Boardflags (high 16 bits) */ -+ u8 tri2g; /* 2.4GHz TX isolation */ -+ u8 tri5gl; /* 5.2GHz TX isolation */ -+ u8 tri5g; /* 5.3GHz TX isolation */ -+ u8 tri5gh; /* 5.8GHz TX isolation */ -+ u8 rxpo2g; /* 2GHz RX power offset */ -+ u8 rxpo5g; /* 5GHz RX power offset */ -+ u8 rssisav2g; /* 2GHz RSSI params */ -+ u8 rssismc2g; -+ u8 rssismf2g; -+ u8 bxa2g; /* 2GHz BX arch */ -+ u8 rssisav5g; /* 5GHz RSSI params */ -+ u8 rssismc5g; -+ u8 rssismf5g; -+ u8 bxa5g; /* 5GHz BX arch */ -+ u16 cck2gpo; /* CCK power offset */ -+ u32 ofdm2gpo; /* 2.4GHz OFDM power offset */ -+ u32 ofdm5glpo; /* 5.2GHz OFDM power offset */ -+ u32 ofdm5gpo; /* 5.3GHz OFDM power offset */ -+ u32 ofdm5ghpo; /* 5.8GHz OFDM power offset */ -+ u16 boardflags_lo; /* Board flags (bits 0-15) */ -+ u16 boardflags_hi; /* Board flags (bits 16-31) */ -+ u16 boardflags2_lo; /* Board flags (bits 32-47) */ -+ u16 boardflags2_hi; /* Board flags (bits 48-63) */ -+ /* TODO store board flags in a single u64 */ - - /* Antenna gain values for up to 4 antennas - * on each band. Values in dBm/4 (Q5.2). Negative gain means the -@@ -58,7 +88,7 @@ struct ssb_sprom { - } ghz5; /* 5GHz band */ - } antenna_gain; - -- /* TODO - add any parameters needed from rev 2, 3, or 4 SPROMs */ -+ /* TODO - add any parameters needed from rev 2, 3, 4, 5 or 8 SPROMs */ - }; - - /* Information about the PCB the circuitry is soldered on. */ -@@ -208,6 +238,7 @@ enum ssb_bustype { - SSB_BUSTYPE_SSB, /* This SSB bus is the system bus */ - SSB_BUSTYPE_PCI, /* SSB is connected to PCI bus */ - SSB_BUSTYPE_PCMCIA, /* SSB is connected to PCMCIA bus */ -+ SSB_BUSTYPE_SDIO, /* SSB is connected to SDIO bus */ - }; - - /* board_vendor */ -@@ -240,8 +271,12 @@ struct ssb_bus { - - /* The core in the basic address register window. (PCI bus only) */ - struct ssb_device *mapped_device; -- /* Currently mapped PCMCIA segment. (bustype == SSB_BUSTYPE_PCMCIA only) */ -- u8 mapped_pcmcia_seg; -+ union { -+ /* Currently mapped PCMCIA segment. (bustype == SSB_BUSTYPE_PCMCIA only) */ -+ u8 mapped_pcmcia_seg; -+ /* Current SSB base address window for SDIO. */ -+ u32 sdio_sbaddr; -+ }; - /* Lock for core and segment switching. - * On PCMCIA-host busses this is used to protect the whole MMIO access. */ - spinlock_t bar_lock; -@@ -252,6 +287,11 @@ struct ssb_bus { - struct pci_dev *host_pci; - /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */ - struct pcmcia_device *host_pcmcia; -+ /* Pointer to the SDIO device (only if bustype == SSB_BUSTYPE_SDIO). */ -+ struct sdio_func *host_sdio; -+ -+ /* See enum ssb_quirks */ -+ unsigned int quirks; - - #ifdef CONFIG_SSB_SPROM - /* Mutex to protect the SPROM writing. */ -@@ -306,6 +346,11 @@ struct ssb_bus { - #endif /* DEBUG */ - }; - -+enum ssb_quirks { -+ /* SDIO connected card requires performing a read after writing a 32-bit value */ -+ SSB_QUIRK_SDIO_READ_AFTER_WRITE32 = (1 << 0), -+}; -+ - /* The initialization-invariants. */ - struct ssb_init_invariants { - /* Versioning information about the PCB. */ -@@ -431,12 +476,16 @@ static inline int ssb_dma_mapping_error( - { - switch (dev->bus->bustype) { - case SSB_BUSTYPE_PCI: -+#ifdef CONFIG_SSB_PCIHOST - return pci_dma_mapping_error(dev->bus->host_pci, addr); -+#endif -+ break; - case SSB_BUSTYPE_SSB: - return dma_mapping_error(dev->dev, addr); - default: -- __ssb_dma_not_implemented(dev); -+ break; - } -+ __ssb_dma_not_implemented(dev); - return -ENOSYS; - } - -@@ -445,12 +494,16 @@ static inline dma_addr_t ssb_dma_map_sin - { - switch (dev->bus->bustype) { - case SSB_BUSTYPE_PCI: -+#ifdef CONFIG_SSB_PCIHOST - return pci_map_single(dev->bus->host_pci, p, size, dir); -+#endif -+ break; - case SSB_BUSTYPE_SSB: - return dma_map_single(dev->dev, p, size, dir); - default: -- __ssb_dma_not_implemented(dev); -+ break; - } -+ __ssb_dma_not_implemented(dev); - return 0; - } - -@@ -459,14 +512,18 @@ static inline void ssb_dma_unmap_single( - { - switch (dev->bus->bustype) { - case SSB_BUSTYPE_PCI: -+#ifdef CONFIG_SSB_PCIHOST - pci_unmap_single(dev->bus->host_pci, dma_addr, size, dir); - return; -+#endif -+ break; - case SSB_BUSTYPE_SSB: - dma_unmap_single(dev->dev, dma_addr, size, dir); - return; - default: -- __ssb_dma_not_implemented(dev); -+ break; - } -+ __ssb_dma_not_implemented(dev); - } - - static inline void ssb_dma_sync_single_for_cpu(struct ssb_device *dev, -@@ -476,15 +533,19 @@ static inline void ssb_dma_sync_single_f - { - switch (dev->bus->bustype) { - case SSB_BUSTYPE_PCI: -+#ifdef CONFIG_SSB_PCIHOST - pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr, - size, dir); - return; -+#endif -+ break; - case SSB_BUSTYPE_SSB: - dma_sync_single_for_cpu(dev->dev, dma_addr, size, dir); - return; - default: -- __ssb_dma_not_implemented(dev); -+ break; - } -+ __ssb_dma_not_implemented(dev); - } - - static inline void ssb_dma_sync_single_for_device(struct ssb_device *dev, -@@ -494,15 +555,19 @@ static inline void ssb_dma_sync_single_f - { - switch (dev->bus->bustype) { - case SSB_BUSTYPE_PCI: -+#ifdef CONFIG_SSB_PCIHOST - pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr, - size, dir); - return; -+#endif -+ break; - case SSB_BUSTYPE_SSB: - dma_sync_single_for_device(dev->dev, dma_addr, size, dir); - return; - default: -- __ssb_dma_not_implemented(dev); -+ break; - } -+ __ssb_dma_not_implemented(dev); - } - - static inline void ssb_dma_sync_single_range_for_cpu(struct ssb_device *dev, -@@ -513,17 +578,21 @@ static inline void ssb_dma_sync_single_r - { - switch (dev->bus->bustype) { - case SSB_BUSTYPE_PCI: -+#ifdef CONFIG_SSB_PCIHOST - /* Just sync everything. That's all the PCI API can do. */ - pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr, - offset + size, dir); - return; -+#endif -+ break; - case SSB_BUSTYPE_SSB: - dma_sync_single_range_for_cpu(dev->dev, dma_addr, offset, - size, dir); - return; - default: -- __ssb_dma_not_implemented(dev); -+ break; - } -+ __ssb_dma_not_implemented(dev); - } - - static inline void ssb_dma_sync_single_range_for_device(struct ssb_device *dev, -@@ -534,17 +603,21 @@ static inline void ssb_dma_sync_single_r - { - switch (dev->bus->bustype) { - case SSB_BUSTYPE_PCI: -+#ifdef CONFIG_SSB_PCIHOST - /* Just sync everything. That's all the PCI API can do. */ - pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr, - offset + size, dir); - return; -+#endif -+ break; - case SSB_BUSTYPE_SSB: - dma_sync_single_range_for_device(dev->dev, dma_addr, offset, - size, dir); - return; - default: -- __ssb_dma_not_implemented(dev); -+ break; - } -+ __ssb_dma_not_implemented(dev); - } - - ---- a/include/linux/ssb/ssb_driver_chipcommon.h -+++ b/include/linux/ssb/ssb_driver_chipcommon.h -@@ -181,6 +181,16 @@ - #define SSB_CHIPCO_PROG_WAITCNT 0x0124 - #define SSB_CHIPCO_FLASH_CFG 0x0128 - #define SSB_CHIPCO_FLASH_WAITCNT 0x012C -+#define SSB_CHIPCO_CLKCTLST 0x01E0 /* Clock control and status (rev >= 20) */ -+#define SSB_CHIPCO_CLKCTLST_FORCEALP 0x00000001 /* Force ALP request */ -+#define SSB_CHIPCO_CLKCTLST_FORCEHT 0x00000002 /* Force HT request */ -+#define SSB_CHIPCO_CLKCTLST_FORCEILP 0x00000004 /* Force ILP request */ -+#define SSB_CHIPCO_CLKCTLST_HAVEALPREQ 0x00000008 /* ALP available request */ -+#define SSB_CHIPCO_CLKCTLST_HAVEHTREQ 0x00000010 /* HT available request */ -+#define SSB_CHIPCO_CLKCTLST_HWCROFF 0x00000020 /* Force HW clock request off */ -+#define SSB_CHIPCO_CLKCTLST_HAVEHT 0x00010000 /* HT available */ -+#define SSB_CHIPCO_CLKCTLST_HAVEALP 0x00020000 /* APL available */ -+#define SSB_CHIPCO_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */ - #define SSB_CHIPCO_UART0_DATA 0x0300 - #define SSB_CHIPCO_UART0_IMR 0x0304 - #define SSB_CHIPCO_UART0_FCR 0x0308 -@@ -197,6 +207,196 @@ - #define SSB_CHIPCO_UART1_LSR 0x0414 - #define SSB_CHIPCO_UART1_MSR 0x0418 - #define SSB_CHIPCO_UART1_SCRATCH 0x041C -+/* PMU registers (rev >= 20) */ -+#define SSB_CHIPCO_PMU_CTL 0x0600 /* PMU control */ -+#define SSB_CHIPCO_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */ -+#define SSB_CHIPCO_PMU_CTL_ILP_DIV_SHIFT 16 -+#define SSB_CHIPCO_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */ -+#define SSB_CHIPCO_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */ -+#define SSB_CHIPCO_PMU_CTL_ALPREQEN 0x00000080 /* ALP req enable */ -+#define SSB_CHIPCO_PMU_CTL_XTALFREQ 0x0000007C /* Crystal freq */ -+#define SSB_CHIPCO_PMU_CTL_XTALFREQ_SHIFT 2 -+#define SSB_CHIPCO_PMU_CTL_ILPDIVEN 0x00000002 /* ILP div enable */ -+#define SSB_CHIPCO_PMU_CTL_LPOSEL 0x00000001 /* LPO sel */ -+#define SSB_CHIPCO_PMU_CAP 0x0604 /* PMU capabilities */ -+#define SSB_CHIPCO_PMU_CAP_REVISION 0x000000FF /* Revision mask */ -+#define SSB_CHIPCO_PMU_STAT 0x0608 /* PMU status */ -+#define SSB_CHIPCO_PMU_STAT_INTPEND 0x00000040 /* Interrupt pending */ -+#define SSB_CHIPCO_PMU_STAT_SBCLKST 0x00000030 /* Backplane clock status? */ -+#define SSB_CHIPCO_PMU_STAT_HAVEALP 0x00000008 /* ALP available */ -+#define SSB_CHIPCO_PMU_STAT_HAVEHT 0x00000004 /* HT available */ -+#define SSB_CHIPCO_PMU_STAT_RESINIT 0x00000003 /* Res init */ -+#define SSB_CHIPCO_PMU_RES_STAT 0x060C /* PMU res status */ -+#define SSB_CHIPCO_PMU_RES_PEND 0x0610 /* PMU res pending */ -+#define SSB_CHIPCO_PMU_TIMER 0x0614 /* PMU timer */ -+#define SSB_CHIPCO_PMU_MINRES_MSK 0x0618 /* PMU min res mask */ -+#define SSB_CHIPCO_PMU_MAXRES_MSK 0x061C /* PMU max res mask */ -+#define SSB_CHIPCO_PMU_RES_TABSEL 0x0620 /* PMU res table sel */ -+#define SSB_CHIPCO_PMU_RES_DEPMSK 0x0624 /* PMU res dep mask */ -+#define SSB_CHIPCO_PMU_RES_UPDNTM 0x0628 /* PMU res updown timer */ -+#define SSB_CHIPCO_PMU_RES_TIMER 0x062C /* PMU res timer */ -+#define SSB_CHIPCO_PMU_CLKSTRETCH 0x0630 /* PMU clockstretch */ -+#define SSB_CHIPCO_PMU_WATCHDOG 0x0634 /* PMU watchdog */ -+#define SSB_CHIPCO_PMU_RES_REQTS 0x0640 /* PMU res req timer sel */ -+#define SSB_CHIPCO_PMU_RES_REQT 0x0644 /* PMU res req timer */ -+#define SSB_CHIPCO_PMU_RES_REQM 0x0648 /* PMU res req mask */ -+#define SSB_CHIPCO_CHIPCTL_ADDR 0x0650 -+#define SSB_CHIPCO_CHIPCTL_DATA 0x0654 -+#define SSB_CHIPCO_REGCTL_ADDR 0x0658 -+#define SSB_CHIPCO_REGCTL_DATA 0x065C -+#define SSB_CHIPCO_PLLCTL_ADDR 0x0660 -+#define SSB_CHIPCO_PLLCTL_DATA 0x0664 -+ -+ -+ -+/** PMU PLL registers */ -+ -+/* PMU rev 0 PLL registers */ -+#define SSB_PMU0_PLLCTL0 0 -+#define SSB_PMU0_PLLCTL0_PDIV_MSK 0x00000001 -+#define SSB_PMU0_PLLCTL0_PDIV_FREQ 25000 /* kHz */ -+#define SSB_PMU0_PLLCTL1 1 -+#define SSB_PMU0_PLLCTL1_WILD_IMSK 0xF0000000 /* Wild int mask (low nibble) */ -+#define SSB_PMU0_PLLCTL1_WILD_IMSK_SHIFT 28 -+#define SSB_PMU0_PLLCTL1_WILD_FMSK 0x0FFFFF00 /* Wild frac mask */ -+#define SSB_PMU0_PLLCTL1_WILD_FMSK_SHIFT 8 -+#define SSB_PMU0_PLLCTL1_STOPMOD 0x00000040 /* Stop mod */ -+#define SSB_PMU0_PLLCTL2 2 -+#define SSB_PMU0_PLLCTL2_WILD_IMSKHI 0x0000000F /* Wild int mask (high nibble) */ -+#define SSB_PMU0_PLLCTL2_WILD_IMSKHI_SHIFT 0 -+ -+/* PMU rev 1 PLL registers */ -+#define SSB_PMU1_PLLCTL0 0 -+#define SSB_PMU1_PLLCTL0_P1DIV 0x00F00000 /* P1 div */ -+#define SSB_PMU1_PLLCTL0_P1DIV_SHIFT 20 -+#define SSB_PMU1_PLLCTL0_P2DIV 0x0F000000 /* P2 div */ -+#define SSB_PMU1_PLLCTL0_P2DIV_SHIFT 24 -+#define SSB_PMU1_PLLCTL1 1 -+#define SSB_PMU1_PLLCTL1_M1DIV 0x000000FF /* M1 div */ -+#define SSB_PMU1_PLLCTL1_M1DIV_SHIFT 0 -+#define SSB_PMU1_PLLCTL1_M2DIV 0x0000FF00 /* M2 div */ -+#define SSB_PMU1_PLLCTL1_M2DIV_SHIFT 8 -+#define SSB_PMU1_PLLCTL1_M3DIV 0x00FF0000 /* M3 div */ -+#define SSB_PMU1_PLLCTL1_M3DIV_SHIFT 16 -+#define SSB_PMU1_PLLCTL1_M4DIV 0xFF000000 /* M4 div */ -+#define SSB_PMU1_PLLCTL1_M4DIV_SHIFT 24 -+#define SSB_PMU1_PLLCTL2 2 -+#define SSB_PMU1_PLLCTL2_M5DIV 0x000000FF /* M5 div */ -+#define SSB_PMU1_PLLCTL2_M5DIV_SHIFT 0 -+#define SSB_PMU1_PLLCTL2_M6DIV 0x0000FF00 /* M6 div */ -+#define SSB_PMU1_PLLCTL2_M6DIV_SHIFT 8 -+#define SSB_PMU1_PLLCTL2_NDIVMODE 0x000E0000 /* NDIV mode */ -+#define SSB_PMU1_PLLCTL2_NDIVMODE_SHIFT 17 -+#define SSB_PMU1_PLLCTL2_NDIVINT 0x1FF00000 /* NDIV int */ -+#define SSB_PMU1_PLLCTL2_NDIVINT_SHIFT 20 -+#define SSB_PMU1_PLLCTL3 3 -+#define SSB_PMU1_PLLCTL3_NDIVFRAC 0x00FFFFFF /* NDIV frac */ -+#define SSB_PMU1_PLLCTL3_NDIVFRAC_SHIFT 0 -+#define SSB_PMU1_PLLCTL4 4 -+#define SSB_PMU1_PLLCTL5 5 -+#define SSB_PMU1_PLLCTL5_CLKDRV 0xFFFFFF00 /* clk drv */ -+#define SSB_PMU1_PLLCTL5_CLKDRV_SHIFT 8 -+ -+/* BCM4312 PLL resource numbers. */ -+#define SSB_PMURES_4312_SWITCHER_BURST 0 -+#define SSB_PMURES_4312_SWITCHER_PWM 1 -+#define SSB_PMURES_4312_PA_REF_LDO 2 -+#define SSB_PMURES_4312_CORE_LDO_BURST 3 -+#define SSB_PMURES_4312_CORE_LDO_PWM 4 -+#define SSB_PMURES_4312_RADIO_LDO 5 -+#define SSB_PMURES_4312_ILP_REQUEST 6 -+#define SSB_PMURES_4312_BG_FILTBYP 7 -+#define SSB_PMURES_4312_TX_FILTBYP 8 -+#define SSB_PMURES_4312_RX_FILTBYP 9 -+#define SSB_PMURES_4312_XTAL_PU 10 -+#define SSB_PMURES_4312_ALP_AVAIL 11 -+#define SSB_PMURES_4312_BB_PLL_FILTBYP 12 -+#define SSB_PMURES_4312_RF_PLL_FILTBYP 13 -+#define SSB_PMURES_4312_HT_AVAIL 14 -+ -+/* BCM4325 PLL resource numbers. */ -+#define SSB_PMURES_4325_BUCK_BOOST_BURST 0 -+#define SSB_PMURES_4325_CBUCK_BURST 1 -+#define SSB_PMURES_4325_CBUCK_PWM 2 -+#define SSB_PMURES_4325_CLDO_CBUCK_BURST 3 -+#define SSB_PMURES_4325_CLDO_CBUCK_PWM 4 -+#define SSB_PMURES_4325_BUCK_BOOST_PWM 5 -+#define SSB_PMURES_4325_ILP_REQUEST 6 -+#define SSB_PMURES_4325_ABUCK_BURST 7 -+#define SSB_PMURES_4325_ABUCK_PWM 8 -+#define SSB_PMURES_4325_LNLDO1_PU 9 -+#define SSB_PMURES_4325_LNLDO2_PU 10 -+#define SSB_PMURES_4325_LNLDO3_PU 11 -+#define SSB_PMURES_4325_LNLDO4_PU 12 -+#define SSB_PMURES_4325_XTAL_PU 13 -+#define SSB_PMURES_4325_ALP_AVAIL 14 -+#define SSB_PMURES_4325_RX_PWRSW_PU 15 -+#define SSB_PMURES_4325_TX_PWRSW_PU 16 -+#define SSB_PMURES_4325_RFPLL_PWRSW_PU 17 -+#define SSB_PMURES_4325_LOGEN_PWRSW_PU 18 -+#define SSB_PMURES_4325_AFE_PWRSW_PU 19 -+#define SSB_PMURES_4325_BBPLL_PWRSW_PU 20 -+#define SSB_PMURES_4325_HT_AVAIL 21 -+ -+/* BCM4328 PLL resource numbers. */ -+#define SSB_PMURES_4328_EXT_SWITCHER_PWM 0 -+#define SSB_PMURES_4328_BB_SWITCHER_PWM 1 -+#define SSB_PMURES_4328_BB_SWITCHER_BURST 2 -+#define SSB_PMURES_4328_BB_EXT_SWITCHER_BURST 3 -+#define SSB_PMURES_4328_ILP_REQUEST 4 -+#define SSB_PMURES_4328_RADIO_SWITCHER_PWM 5 -+#define SSB_PMURES_4328_RADIO_SWITCHER_BURST 6 -+#define SSB_PMURES_4328_ROM_SWITCH 7 -+#define SSB_PMURES_4328_PA_REF_LDO 8 -+#define SSB_PMURES_4328_RADIO_LDO 9 -+#define SSB_PMURES_4328_AFE_LDO 10 -+#define SSB_PMURES_4328_PLL_LDO 11 -+#define SSB_PMURES_4328_BG_FILTBYP 12 -+#define SSB_PMURES_4328_TX_FILTBYP 13 -+#define SSB_PMURES_4328_RX_FILTBYP 14 -+#define SSB_PMURES_4328_XTAL_PU 15 -+#define SSB_PMURES_4328_XTAL_EN 16 -+#define SSB_PMURES_4328_BB_PLL_FILTBYP 17 -+#define SSB_PMURES_4328_RF_PLL_FILTBYP 18 -+#define SSB_PMURES_4328_BB_PLL_PU 19 -+ -+/* BCM5354 PLL resource numbers. */ -+#define SSB_PMURES_5354_EXT_SWITCHER_PWM 0 -+#define SSB_PMURES_5354_BB_SWITCHER_PWM 1 -+#define SSB_PMURES_5354_BB_SWITCHER_BURST 2 -+#define SSB_PMURES_5354_BB_EXT_SWITCHER_BURST 3 -+#define SSB_PMURES_5354_ILP_REQUEST 4 -+#define SSB_PMURES_5354_RADIO_SWITCHER_PWM 5 -+#define SSB_PMURES_5354_RADIO_SWITCHER_BURST 6 -+#define SSB_PMURES_5354_ROM_SWITCH 7 -+#define SSB_PMURES_5354_PA_REF_LDO 8 -+#define SSB_PMURES_5354_RADIO_LDO 9 -+#define SSB_PMURES_5354_AFE_LDO 10 -+#define SSB_PMURES_5354_PLL_LDO 11 -+#define SSB_PMURES_5354_BG_FILTBYP 12 -+#define SSB_PMURES_5354_TX_FILTBYP 13 -+#define SSB_PMURES_5354_RX_FILTBYP 14 -+#define SSB_PMURES_5354_XTAL_PU 15 -+#define SSB_PMURES_5354_XTAL_EN 16 -+#define SSB_PMURES_5354_BB_PLL_FILTBYP 17 -+#define SSB_PMURES_5354_RF_PLL_FILTBYP 18 -+#define SSB_PMURES_5354_BB_PLL_PU 19 -+ -+ -+ -+/** Chip specific Chip-Status register contents. */ -+#define SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL 0x00000003 -+#define SSB_CHIPCO_CHST_4325_DEFCIS_SEL 0 /* OTP is powered up, use def. CIS, no SPROM */ -+#define SSB_CHIPCO_CHST_4325_SPROM_SEL 1 /* OTP is powered up, SPROM is present */ -+#define SSB_CHIPCO_CHST_4325_OTP_SEL 2 /* OTP is powered up, no SPROM */ -+#define SSB_CHIPCO_CHST_4325_OTP_PWRDN 3 /* OTP is powered down, SPROM is present */ -+#define SSB_CHIPCO_CHST_4325_SDIO_USB_MODE 0x00000004 -+#define SSB_CHIPCO_CHST_4325_SDIO_USB_MODE_SHIFT 2 -+#define SSB_CHIPCO_CHST_4325_RCAL_VALID 0x00000008 -+#define SSB_CHIPCO_CHST_4325_RCAL_VALID_SHIFT 3 -+#define SSB_CHIPCO_CHST_4325_RCAL_VALUE 0x000001F0 -+#define SSB_CHIPCO_CHST_4325_RCAL_VALUE_SHIFT 4 -+#define SSB_CHIPCO_CHST_4325_PMUTOP_2B 0x00000200 /* 1 for 2b, 0 for to 2a */ - - - -@@ -353,11 +553,20 @@ - struct ssb_device; - struct ssb_serial_port; - -+/* Data for the PMU, if available. -+ * Check availability with ((struct ssb_chipcommon)->capabilities & SSB_CHIPCO_CAP_PMU) -+ */ -+struct ssb_chipcommon_pmu { -+ u8 rev; /* PMU revision */ -+ u32 crystalfreq; /* The active crystal frequency (in kHz) */ -+}; -+ - struct ssb_chipcommon { - struct ssb_device *dev; - u32 capabilities; - /* Fast Powerup Delay constant */ - u16 fast_pwrup_delay; -+ struct ssb_chipcommon_pmu pmu; - }; - - static inline bool ssb_chipco_available(struct ssb_chipcommon *cc) -@@ -365,6 +574,17 @@ static inline bool ssb_chipco_available( - return (cc->dev != NULL); - } - -+/* Register access */ -+#define chipco_read32(cc, offset) ssb_read32((cc)->dev, offset) -+#define chipco_write32(cc, offset, val) ssb_write32((cc)->dev, offset, val) -+ -+#define chipco_mask32(cc, offset, mask) \ -+ chipco_write32(cc, offset, chipco_read32(cc, offset) & (mask)) -+#define chipco_set32(cc, offset, set) \ -+ chipco_write32(cc, offset, chipco_read32(cc, offset) | (set)) -+#define chipco_maskset32(cc, offset, mask, set) \ -+ chipco_write32(cc, offset, (chipco_read32(cc, offset) & (mask)) | (set)) -+ - extern void ssb_chipcommon_init(struct ssb_chipcommon *cc); - - extern void ssb_chipco_suspend(struct ssb_chipcommon *cc); -@@ -406,4 +626,18 @@ extern int ssb_chipco_serial_init(struct - struct ssb_serial_port *ports); - #endif /* CONFIG_SSB_SERIAL */ - -+/* PMU support */ -+extern void ssb_pmu_init(struct ssb_chipcommon *cc); -+ -+enum ssb_pmu_ldo_volt_id { -+ LDO_PAREF = 0, -+ LDO_VOLT1, -+ LDO_VOLT2, -+ LDO_VOLT3, -+}; -+ -+void ssb_pmu_set_ldo_voltage(struct ssb_chipcommon *cc, -+ enum ssb_pmu_ldo_volt_id id, u32 voltage); -+void ssb_pmu_set_ldo_paref(struct ssb_chipcommon *cc, bool on); -+ - #endif /* LINUX_SSB_CHIPCO_H_ */ ---- a/include/linux/ssb/ssb_regs.h -+++ b/include/linux/ssb/ssb_regs.h -@@ -162,7 +162,7 @@ - - /* SPROM shadow area. If not otherwise noted, fields are - * two bytes wide. Note that the SPROM can _only_ be read -- * in two-byte quantinies. -+ * in two-byte quantities. - */ - #define SSB_SPROMSIZE_WORDS 64 - #define SSB_SPROMSIZE_BYTES (SSB_SPROMSIZE_WORDS * sizeof(u16)) -@@ -245,8 +245,6 @@ - - /* SPROM Revision 3 (inherits most data from rev 2) */ - #define SSB_SPROM3_IL0MAC 0x104A /* 6 bytes MAC address for 802.11b/g */ --#define SSB_SPROM3_ET0MAC 0x1050 /* 6 bytes MAC address for Ethernet ?? */ --#define SSB_SPROM3_ET1MAC 0x1050 /* 6 bytes MAC address for 802.11a ?? */ - #define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */ - #define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */ - #define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */ -@@ -267,8 +265,6 @@ - - /* SPROM Revision 4 */ - #define SSB_SPROM4_IL0MAC 0x104C /* 6 byte MAC address for a/b/g/n */ --#define SSB_SPROM4_ET0MAC 0x1018 /* 6 bytes MAC address for Ethernet ?? */ --#define SSB_SPROM4_ET1MAC 0x1018 /* 6 bytes MAC address for 802.11a ?? */ - #define SSB_SPROM4_ETHPHY 0x105A /* Ethernet PHY settings ?? */ - #define SSB_SPROM4_ETHPHY_ET0A 0x001F /* MII Address for enet0 */ - #define SSB_SPROM4_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */ -@@ -316,6 +312,109 @@ - #define SSB_SPROM4_PA1B1 0x1090 - #define SSB_SPROM4_PA1B2 0x1092 - -+/* SPROM Revision 5 (inherits most data from rev 4) */ -+#define SSB_SPROM5_BFLLO 0x104A /* Boardflags (low 16 bits) */ -+#define SSB_SPROM5_BFLHI 0x104C /* Board Flags Hi */ -+#define SSB_SPROM5_IL0MAC 0x1052 /* 6 byte MAC address for a/b/g/n */ -+#define SSB_SPROM5_CCODE 0x1044 /* Country Code (2 bytes) */ -+#define SSB_SPROM5_GPIOA 0x1076 /* Gen. Purpose IO # 0 and 1 */ -+#define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */ -+#define SSB_SPROM5_GPIOA_P1 0xFF00 /* Pin 1 */ -+#define SSB_SPROM5_GPIOA_P1_SHIFT 8 -+#define SSB_SPROM5_GPIOB 0x1078 /* Gen. Purpose IO # 2 and 3 */ -+#define SSB_SPROM5_GPIOB_P2 0x00FF /* Pin 2 */ -+#define SSB_SPROM5_GPIOB_P3 0xFF00 /* Pin 3 */ -+#define SSB_SPROM5_GPIOB_P3_SHIFT 8 -+ -+/* SPROM Revision 8 */ -+#define SSB_SPROM8_BOARDREV 0x1082 /* Board revision */ -+#define SSB_SPROM8_BFLLO 0x1084 /* Board flags (bits 0-15) */ -+#define SSB_SPROM8_BFLHI 0x1086 /* Board flags (bits 16-31) */ -+#define SSB_SPROM8_BFL2LO 0x1088 /* Board flags (bits 32-47) */ -+#define SSB_SPROM8_BFL2HI 0x108A /* Board flags (bits 48-63) */ -+#define SSB_SPROM8_IL0MAC 0x108C /* 6 byte MAC address */ -+#define SSB_SPROM8_CCODE 0x1092 /* 2 byte country code */ -+#define SSB_SPROM8_ANTAVAIL 0x109C /* Antenna available bitfields*/ -+#define SSB_SPROM8_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */ -+#define SSB_SPROM8_ANTAVAIL_A_SHIFT 8 -+#define SSB_SPROM8_ANTAVAIL_BG 0x00FF /* B-PHY and G-PHY bitfield */ -+#define SSB_SPROM8_ANTAVAIL_BG_SHIFT 0 -+#define SSB_SPROM8_AGAIN01 0x109E /* Antenna Gain (in dBm Q5.2) */ -+#define SSB_SPROM8_AGAIN0 0x00FF /* Antenna 0 */ -+#define SSB_SPROM8_AGAIN0_SHIFT 0 -+#define SSB_SPROM8_AGAIN1 0xFF00 /* Antenna 1 */ -+#define SSB_SPROM8_AGAIN1_SHIFT 8 -+#define SSB_SPROM8_AGAIN23 0x10A0 -+#define SSB_SPROM8_AGAIN2 0x00FF /* Antenna 2 */ -+#define SSB_SPROM8_AGAIN2_SHIFT 0 -+#define SSB_SPROM8_AGAIN3 0xFF00 /* Antenna 3 */ -+#define SSB_SPROM8_AGAIN3_SHIFT 8 -+#define SSB_SPROM8_GPIOA 0x1096 /*Gen. Purpose IO # 0 and 1 */ -+#define SSB_SPROM8_GPIOA_P0 0x00FF /* Pin 0 */ -+#define SSB_SPROM8_GPIOA_P1 0xFF00 /* Pin 1 */ -+#define SSB_SPROM8_GPIOA_P1_SHIFT 8 -+#define SSB_SPROM8_GPIOB 0x1098 /* Gen. Purpose IO # 2 and 3 */ -+#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */ -+#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */ -+#define SSB_SPROM8_GPIOB_P3_SHIFT 8 -+#define SSB_SPROM8_RSSIPARM2G 0x10A4 /* RSSI params for 2GHz */ -+#define SSB_SPROM8_RSSISMF2G 0x000F -+#define SSB_SPROM8_RSSISMC2G 0x00F0 -+#define SSB_SPROM8_RSSISMC2G_SHIFT 4 -+#define SSB_SPROM8_RSSISAV2G 0x0700 -+#define SSB_SPROM8_RSSISAV2G_SHIFT 8 -+#define SSB_SPROM8_BXA2G 0x1800 -+#define SSB_SPROM8_BXA2G_SHIFT 11 -+#define SSB_SPROM8_RSSIPARM5G 0x10A6 /* RSSI params for 5GHz */ -+#define SSB_SPROM8_RSSISMF5G 0x000F -+#define SSB_SPROM8_RSSISMC5G 0x00F0 -+#define SSB_SPROM8_RSSISMC5G_SHIFT 4 -+#define SSB_SPROM8_RSSISAV5G 0x0700 -+#define SSB_SPROM8_RSSISAV5G_SHIFT 8 -+#define SSB_SPROM8_BXA5G 0x1800 -+#define SSB_SPROM8_BXA5G_SHIFT 11 -+#define SSB_SPROM8_TRI25G 0x10A8 /* TX isolation 2.4&5.3GHz */ -+#define SSB_SPROM8_TRI2G 0x00FF /* TX isolation 2.4GHz */ -+#define SSB_SPROM8_TRI5G 0xFF00 /* TX isolation 5.3GHz */ -+#define SSB_SPROM8_TRI5G_SHIFT 8 -+#define SSB_SPROM8_TRI5GHL 0x10AA /* TX isolation 5.2/5.8GHz */ -+#define SSB_SPROM8_TRI5GL 0x00FF /* TX isolation 5.2GHz */ -+#define SSB_SPROM8_TRI5GH 0xFF00 /* TX isolation 5.8GHz */ -+#define SSB_SPROM8_TRI5GH_SHIFT 8 -+#define SSB_SPROM8_RXPO 0x10AC /* RX power offsets */ -+#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */ -+#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */ -+#define SSB_SPROM8_RXPO5G_SHIFT 8 -+#define SSB_SPROM8_MAXP_BG 0x10C0 /* Max Power 2GHz in path 1 */ -+#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */ -+#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ -+#define SSB_SPROM8_ITSSI_BG_SHIFT 8 -+#define SSB_SPROM8_PA0B0 0x10C2 /* 2GHz power amp settings */ -+#define SSB_SPROM8_PA0B1 0x10C4 -+#define SSB_SPROM8_PA0B2 0x10C6 -+#define SSB_SPROM8_MAXP_A 0x10C8 /* Max Power 5.3GHz */ -+#define SSB_SPROM8_MAXP_A_MASK 0x00FF /* Mask for Max Power 5.3GHz */ -+#define SSB_SPROM8_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */ -+#define SSB_SPROM8_ITSSI_A_SHIFT 8 -+#define SSB_SPROM8_MAXP_AHL 0x10CA /* Max Power 5.2/5.8GHz */ -+#define SSB_SPROM8_MAXP_AH_MASK 0x00FF /* Mask for Max Power 5.8GHz */ -+#define SSB_SPROM8_MAXP_AL_MASK 0xFF00 /* Mask for Max Power 5.2GHz */ -+#define SSB_SPROM8_MAXP_AL_SHIFT 8 -+#define SSB_SPROM8_PA1B0 0x10CC /* 5.3GHz power amp settings */ -+#define SSB_SPROM8_PA1B1 0x10CE -+#define SSB_SPROM8_PA1B2 0x10D0 -+#define SSB_SPROM8_PA1LOB0 0x10D2 /* 5.2GHz power amp settings */ -+#define SSB_SPROM8_PA1LOB1 0x10D4 -+#define SSB_SPROM8_PA1LOB2 0x10D6 -+#define SSB_SPROM8_PA1HIB0 0x10D8 /* 5.8GHz power amp settings */ -+#define SSB_SPROM8_PA1HIB1 0x10DA -+#define SSB_SPROM8_PA1HIB2 0x10DC -+#define SSB_SPROM8_CCK2GPO 0x1140 /* CCK power offset */ -+#define SSB_SPROM8_OFDM2GPO 0x1142 /* 2.4GHz OFDM power offset */ -+#define SSB_SPROM8_OFDM5GPO 0x1146 /* 5.3GHz OFDM power offset */ -+#define SSB_SPROM8_OFDM5GLPO 0x114A /* 5.2GHz OFDM power offset */ -+#define SSB_SPROM8_OFDM5GHPO 0x114E /* 5.8GHz OFDM power offset */ -+ - /* Values for SSB_SPROM1_BINF_CCODE */ - enum { - SSB_SPROM1CCODE_WORLD = 0, ---- /dev/null -+++ b/drivers/ssb/driver_chipcommon_pmu.c -@@ -0,0 +1,602 @@ -+/* -+ * Sonics Silicon Backplane -+ * Broadcom ChipCommon Power Management Unit driver -+ * -+ * Copyright 2009, Michael Buesch -+ * Copyright 2007, Broadcom Corporation -+ * -+ * Licensed under the GNU/GPL. See COPYING for details. -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include "ssb_private.h" -+ -+static u32 ssb_chipco_pll_read(struct ssb_chipcommon *cc, u32 offset) -+{ -+ chipco_write32(cc, SSB_CHIPCO_PLLCTL_ADDR, offset); -+ return chipco_read32(cc, SSB_CHIPCO_PLLCTL_DATA); -+} -+ -+static void ssb_chipco_pll_write(struct ssb_chipcommon *cc, -+ u32 offset, u32 value) -+{ -+ chipco_write32(cc, SSB_CHIPCO_PLLCTL_ADDR, offset); -+ chipco_write32(cc, SSB_CHIPCO_PLLCTL_DATA, value); -+} -+ -+static void ssb_chipco_regctl_maskset(struct ssb_chipcommon *cc, -+ u32 offset, u32 mask, u32 set) -+{ -+ u32 value; -+ -+ chipco_read32(cc, SSB_CHIPCO_REGCTL_ADDR); -+ chipco_write32(cc, SSB_CHIPCO_REGCTL_ADDR, offset); -+ chipco_read32(cc, SSB_CHIPCO_REGCTL_ADDR); -+ value = chipco_read32(cc, SSB_CHIPCO_REGCTL_DATA); -+ value &= mask; -+ value |= set; -+ chipco_write32(cc, SSB_CHIPCO_REGCTL_DATA, value); -+ chipco_read32(cc, SSB_CHIPCO_REGCTL_DATA); -+} -+ -+struct pmu0_plltab_entry { -+ u16 freq; /* Crystal frequency in kHz.*/ -+ u8 xf; /* Crystal frequency value for PMU control */ -+ u8 wb_int; -+ u32 wb_frac; -+}; -+ -+static const struct pmu0_plltab_entry pmu0_plltab[] = { -+ { .freq = 12000, .xf = 1, .wb_int = 73, .wb_frac = 349525, }, -+ { .freq = 13000, .xf = 2, .wb_int = 67, .wb_frac = 725937, }, -+ { .freq = 14400, .xf = 3, .wb_int = 61, .wb_frac = 116508, }, -+ { .freq = 15360, .xf = 4, .wb_int = 57, .wb_frac = 305834, }, -+ { .freq = 16200, .xf = 5, .wb_int = 54, .wb_frac = 336579, }, -+ { .freq = 16800, .xf = 6, .wb_int = 52, .wb_frac = 399457, }, -+ { .freq = 19200, .xf = 7, .wb_int = 45, .wb_frac = 873813, }, -+ { .freq = 19800, .xf = 8, .wb_int = 44, .wb_frac = 466033, }, -+ { .freq = 20000, .xf = 9, .wb_int = 44, .wb_frac = 0, }, -+ { .freq = 25000, .xf = 10, .wb_int = 70, .wb_frac = 419430, }, -+ { .freq = 26000, .xf = 11, .wb_int = 67, .wb_frac = 725937, }, -+ { .freq = 30000, .xf = 12, .wb_int = 58, .wb_frac = 699050, }, -+ { .freq = 38400, .xf = 13, .wb_int = 45, .wb_frac = 873813, }, -+ { .freq = 40000, .xf = 14, .wb_int = 45, .wb_frac = 0, }, -+}; -+#define SSB_PMU0_DEFAULT_XTALFREQ 20000 -+ -+static const struct pmu0_plltab_entry * pmu0_plltab_find_entry(u32 crystalfreq) -+{ -+ const struct pmu0_plltab_entry *e; -+ unsigned int i; -+ -+ for (i = 0; i < ARRAY_SIZE(pmu0_plltab); i++) { -+ e = &pmu0_plltab[i]; -+ if (e->freq == crystalfreq) -+ return e; -+ } -+ -+ return NULL; -+} -+ -+/* Tune the PLL to the crystal speed. crystalfreq is in kHz. */ -+static void ssb_pmu0_pllinit_r0(struct ssb_chipcommon *cc, -+ u32 crystalfreq) -+{ -+ struct ssb_bus *bus = cc->dev->bus; -+ const struct pmu0_plltab_entry *e = NULL; -+ u32 pmuctl, tmp, pllctl; -+ unsigned int i; -+ -+ if ((bus->chip_id == 0x5354) && !crystalfreq) { -+ /* The 5354 crystal freq is 25MHz */ -+ crystalfreq = 25000; -+ } -+ if (crystalfreq) -+ e = pmu0_plltab_find_entry(crystalfreq); -+ if (!e) -+ e = pmu0_plltab_find_entry(SSB_PMU0_DEFAULT_XTALFREQ); -+ BUG_ON(!e); -+ crystalfreq = e->freq; -+ cc->pmu.crystalfreq = e->freq; -+ -+ /* Check if the PLL already is programmed to this frequency. */ -+ pmuctl = chipco_read32(cc, SSB_CHIPCO_PMU_CTL); -+ if (((pmuctl & SSB_CHIPCO_PMU_CTL_XTALFREQ) >> SSB_CHIPCO_PMU_CTL_XTALFREQ_SHIFT) == e->xf) { -+ /* We're already there... */ -+ return; -+ } -+ -+ ssb_printk(KERN_INFO PFX "Programming PLL to %u.%03u MHz\n", -+ (crystalfreq / 1000), (crystalfreq % 1000)); -+ -+ /* First turn the PLL off. */ -+ switch (bus->chip_id) { -+ case 0x4328: -+ chipco_mask32(cc, SSB_CHIPCO_PMU_MINRES_MSK, -+ ~(1 << SSB_PMURES_4328_BB_PLL_PU)); -+ chipco_mask32(cc, SSB_CHIPCO_PMU_MAXRES_MSK, -+ ~(1 << SSB_PMURES_4328_BB_PLL_PU)); -+ break; -+ case 0x5354: -+ chipco_mask32(cc, SSB_CHIPCO_PMU_MINRES_MSK, -+ ~(1 << SSB_PMURES_5354_BB_PLL_PU)); -+ chipco_mask32(cc, SSB_CHIPCO_PMU_MAXRES_MSK, -+ ~(1 << SSB_PMURES_5354_BB_PLL_PU)); -+ break; -+ default: -+ SSB_WARN_ON(1); -+ } -+ for (i = 1500; i; i--) { -+ tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST); -+ if (!(tmp & SSB_CHIPCO_CLKCTLST_HAVEHT)) -+ break; -+ udelay(10); -+ } -+ tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST); -+ if (tmp & SSB_CHIPCO_CLKCTLST_HAVEHT) -+ ssb_printk(KERN_EMERG PFX "Failed to turn the PLL off!\n"); -+ -+ /* Set PDIV in PLL control 0. */ -+ pllctl = ssb_chipco_pll_read(cc, SSB_PMU0_PLLCTL0); -+ if (crystalfreq >= SSB_PMU0_PLLCTL0_PDIV_FREQ) -+ pllctl |= SSB_PMU0_PLLCTL0_PDIV_MSK; -+ else -+ pllctl &= ~SSB_PMU0_PLLCTL0_PDIV_MSK; -+ ssb_chipco_pll_write(cc, SSB_PMU0_PLLCTL0, pllctl); -+ -+ /* Set WILD in PLL control 1. */ -+ pllctl = ssb_chipco_pll_read(cc, SSB_PMU0_PLLCTL1); -+ pllctl &= ~SSB_PMU0_PLLCTL1_STOPMOD; -+ pllctl &= ~(SSB_PMU0_PLLCTL1_WILD_IMSK | SSB_PMU0_PLLCTL1_WILD_FMSK); -+ pllctl |= ((u32)e->wb_int << SSB_PMU0_PLLCTL1_WILD_IMSK_SHIFT) & SSB_PMU0_PLLCTL1_WILD_IMSK; -+ pllctl |= ((u32)e->wb_frac << SSB_PMU0_PLLCTL1_WILD_FMSK_SHIFT) & SSB_PMU0_PLLCTL1_WILD_FMSK; -+ if (e->wb_frac == 0) -+ pllctl |= SSB_PMU0_PLLCTL1_STOPMOD; -+ ssb_chipco_pll_write(cc, SSB_PMU0_PLLCTL1, pllctl); -+ -+ /* Set WILD in PLL control 2. */ -+ pllctl = ssb_chipco_pll_read(cc, SSB_PMU0_PLLCTL2); -+ pllctl &= ~SSB_PMU0_PLLCTL2_WILD_IMSKHI; -+ pllctl |= (((u32)e->wb_int >> 4) << SSB_PMU0_PLLCTL2_WILD_IMSKHI_SHIFT) & SSB_PMU0_PLLCTL2_WILD_IMSKHI; -+ ssb_chipco_pll_write(cc, SSB_PMU0_PLLCTL2, pllctl); -+ -+ /* Set the crystalfrequency and the divisor. */ -+ pmuctl = chipco_read32(cc, SSB_CHIPCO_PMU_CTL); -+ pmuctl &= ~SSB_CHIPCO_PMU_CTL_ILP_DIV; -+ pmuctl |= (((crystalfreq + 127) / 128 - 1) << SSB_CHIPCO_PMU_CTL_ILP_DIV_SHIFT) -+ & SSB_CHIPCO_PMU_CTL_ILP_DIV; -+ pmuctl &= ~SSB_CHIPCO_PMU_CTL_XTALFREQ; -+ pmuctl |= ((u32)e->xf << SSB_CHIPCO_PMU_CTL_XTALFREQ_SHIFT) & SSB_CHIPCO_PMU_CTL_XTALFREQ; -+ chipco_write32(cc, SSB_CHIPCO_PMU_CTL, pmuctl); -+} -+ -+struct pmu1_plltab_entry { -+ u16 freq; /* Crystal frequency in kHz.*/ -+ u8 xf; /* Crystal frequency value for PMU control */ -+ u8 ndiv_int; -+ u32 ndiv_frac; -+ u8 p1div; -+ u8 p2div; -+}; -+ -+static const struct pmu1_plltab_entry pmu1_plltab[] = { -+ { .freq = 12000, .xf = 1, .p1div = 3, .p2div = 22, .ndiv_int = 0x9, .ndiv_frac = 0xFFFFEF, }, -+ { .freq = 13000, .xf = 2, .p1div = 1, .p2div = 6, .ndiv_int = 0xb, .ndiv_frac = 0x483483, }, -+ { .freq = 14400, .xf = 3, .p1div = 1, .p2div = 10, .ndiv_int = 0xa, .ndiv_frac = 0x1C71C7, }, -+ { .freq = 15360, .xf = 4, .p1div = 1, .p2div = 5, .ndiv_int = 0xb, .ndiv_frac = 0x755555, }, -+ { .freq = 16200, .xf = 5, .p1div = 1, .p2div = 10, .ndiv_int = 0x5, .ndiv_frac = 0x6E9E06, }, -+ { .freq = 16800, .xf = 6, .p1div = 1, .p2div = 10, .ndiv_int = 0x5, .ndiv_frac = 0x3CF3CF, }, -+ { .freq = 19200, .xf = 7, .p1div = 1, .p2div = 9, .ndiv_int = 0x5, .ndiv_frac = 0x17B425, }, -+ { .freq = 19800, .xf = 8, .p1div = 1, .p2div = 11, .ndiv_int = 0x4, .ndiv_frac = 0xA57EB, }, -+ { .freq = 20000, .xf = 9, .p1div = 1, .p2div = 11, .ndiv_int = 0x4, .ndiv_frac = 0, }, -+ { .freq = 24000, .xf = 10, .p1div = 3, .p2div = 11, .ndiv_int = 0xa, .ndiv_frac = 0, }, -+ { .freq = 25000, .xf = 11, .p1div = 5, .p2div = 16, .ndiv_int = 0xb, .ndiv_frac = 0, }, -+ { .freq = 26000, .xf = 12, .p1div = 1, .p2div = 2, .ndiv_int = 0x10, .ndiv_frac = 0xEC4EC4, }, -+ { .freq = 30000, .xf = 13, .p1div = 3, .p2div = 8, .ndiv_int = 0xb, .ndiv_frac = 0, }, -+ { .freq = 38400, .xf = 14, .p1div = 1, .p2div = 5, .ndiv_int = 0x4, .ndiv_frac = 0x955555, }, -+ { .freq = 40000, .xf = 15, .p1div = 1, .p2div = 2, .ndiv_int = 0xb, .ndiv_frac = 0, }, -+}; -+ -+#define SSB_PMU1_DEFAULT_XTALFREQ 15360 -+ -+static const struct pmu1_plltab_entry * pmu1_plltab_find_entry(u32 crystalfreq) -+{ -+ const struct pmu1_plltab_entry *e; -+ unsigned int i; -+ -+ for (i = 0; i < ARRAY_SIZE(pmu1_plltab); i++) { -+ e = &pmu1_plltab[i]; -+ if (e->freq == crystalfreq) -+ return e; -+ } -+ -+ return NULL; -+} -+ -+/* Tune the PLL to the crystal speed. crystalfreq is in kHz. */ -+static void ssb_pmu1_pllinit_r0(struct ssb_chipcommon *cc, -+ u32 crystalfreq) -+{ -+ struct ssb_bus *bus = cc->dev->bus; -+ const struct pmu1_plltab_entry *e = NULL; -+ u32 buffer_strength = 0; -+ u32 tmp, pllctl, pmuctl; -+ unsigned int i; -+ -+ if (bus->chip_id == 0x4312) { -+ /* We do not touch the BCM4312 PLL and assume -+ * the default crystal settings work out-of-the-box. */ -+ cc->pmu.crystalfreq = 20000; -+ return; -+ } -+ -+ if (crystalfreq) -+ e = pmu1_plltab_find_entry(crystalfreq); -+ if (!e) -+ e = pmu1_plltab_find_entry(SSB_PMU1_DEFAULT_XTALFREQ); -+ BUG_ON(!e); -+ crystalfreq = e->freq; -+ cc->pmu.crystalfreq = e->freq; -+ -+ /* Check if the PLL already is programmed to this frequency. */ -+ pmuctl = chipco_read32(cc, SSB_CHIPCO_PMU_CTL); -+ if (((pmuctl & SSB_CHIPCO_PMU_CTL_XTALFREQ) >> SSB_CHIPCO_PMU_CTL_XTALFREQ_SHIFT) == e->xf) { -+ /* We're already there... */ -+ return; -+ } -+ -+ ssb_printk(KERN_INFO PFX "Programming PLL to %u.%03u MHz\n", -+ (crystalfreq / 1000), (crystalfreq % 1000)); -+ -+ /* First turn the PLL off. */ -+ switch (bus->chip_id) { -+ case 0x4325: -+ chipco_mask32(cc, SSB_CHIPCO_PMU_MINRES_MSK, -+ ~((1 << SSB_PMURES_4325_BBPLL_PWRSW_PU) | -+ (1 << SSB_PMURES_4325_HT_AVAIL))); -+ chipco_mask32(cc, SSB_CHIPCO_PMU_MAXRES_MSK, -+ ~((1 << SSB_PMURES_4325_BBPLL_PWRSW_PU) | -+ (1 << SSB_PMURES_4325_HT_AVAIL))); -+ /* Adjust the BBPLL to 2 on all channels later. */ -+ buffer_strength = 0x222222; -+ break; -+ default: -+ SSB_WARN_ON(1); -+ } -+ for (i = 1500; i; i--) { -+ tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST); -+ if (!(tmp & SSB_CHIPCO_CLKCTLST_HAVEHT)) -+ break; -+ udelay(10); -+ } -+ tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST); -+ if (tmp & SSB_CHIPCO_CLKCTLST_HAVEHT) -+ ssb_printk(KERN_EMERG PFX "Failed to turn the PLL off!\n"); -+ -+ /* Set p1div and p2div. */ -+ pllctl = ssb_chipco_pll_read(cc, SSB_PMU1_PLLCTL0); -+ pllctl &= ~(SSB_PMU1_PLLCTL0_P1DIV | SSB_PMU1_PLLCTL0_P2DIV); -+ pllctl |= ((u32)e->p1div << SSB_PMU1_PLLCTL0_P1DIV_SHIFT) & SSB_PMU1_PLLCTL0_P1DIV; -+ pllctl |= ((u32)e->p2div << SSB_PMU1_PLLCTL0_P2DIV_SHIFT) & SSB_PMU1_PLLCTL0_P2DIV; -+ ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL0, pllctl); -+ -+ /* Set ndiv int and ndiv mode */ -+ pllctl = ssb_chipco_pll_read(cc, SSB_PMU1_PLLCTL2); -+ pllctl &= ~(SSB_PMU1_PLLCTL2_NDIVINT | SSB_PMU1_PLLCTL2_NDIVMODE); -+ pllctl |= ((u32)e->ndiv_int << SSB_PMU1_PLLCTL2_NDIVINT_SHIFT) & SSB_PMU1_PLLCTL2_NDIVINT; -+ pllctl |= (1 << SSB_PMU1_PLLCTL2_NDIVMODE_SHIFT) & SSB_PMU1_PLLCTL2_NDIVMODE; -+ ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL2, pllctl); -+ -+ /* Set ndiv frac */ -+ pllctl = ssb_chipco_pll_read(cc, SSB_PMU1_PLLCTL3); -+ pllctl &= ~SSB_PMU1_PLLCTL3_NDIVFRAC; -+ pllctl |= ((u32)e->ndiv_frac << SSB_PMU1_PLLCTL3_NDIVFRAC_SHIFT) & SSB_PMU1_PLLCTL3_NDIVFRAC; -+ ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL3, pllctl); -+ -+ /* Change the drive strength, if required. */ -+ if (buffer_strength) { -+ pllctl = ssb_chipco_pll_read(cc, SSB_PMU1_PLLCTL5); -+ pllctl &= ~SSB_PMU1_PLLCTL5_CLKDRV; -+ pllctl |= (buffer_strength << SSB_PMU1_PLLCTL5_CLKDRV_SHIFT) & SSB_PMU1_PLLCTL5_CLKDRV; -+ ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL5, pllctl); -+ } -+ -+ /* Tune the crystalfreq and the divisor. */ -+ pmuctl = chipco_read32(cc, SSB_CHIPCO_PMU_CTL); -+ pmuctl &= ~(SSB_CHIPCO_PMU_CTL_ILP_DIV | SSB_CHIPCO_PMU_CTL_XTALFREQ); -+ pmuctl |= ((((u32)e->freq + 127) / 128 - 1) << SSB_CHIPCO_PMU_CTL_ILP_DIV_SHIFT) -+ & SSB_CHIPCO_PMU_CTL_ILP_DIV; -+ pmuctl |= ((u32)e->xf << SSB_CHIPCO_PMU_CTL_XTALFREQ_SHIFT) & SSB_CHIPCO_PMU_CTL_XTALFREQ; -+ chipco_write32(cc, SSB_CHIPCO_PMU_CTL, pmuctl); -+} -+ -+static void ssb_pmu_pll_init(struct ssb_chipcommon *cc) -+{ -+ struct ssb_bus *bus = cc->dev->bus; -+ u32 crystalfreq = 0; /* in kHz. 0 = keep default freq. */ -+ -+ if (bus->bustype == SSB_BUSTYPE_SSB) { -+ /* TODO: The user may override the crystal frequency. */ -+ } -+ -+ switch (bus->chip_id) { -+ case 0x4312: -+ case 0x4325: -+ ssb_pmu1_pllinit_r0(cc, crystalfreq); -+ break; -+ case 0x4328: -+ case 0x5354: -+ ssb_pmu0_pllinit_r0(cc, crystalfreq); -+ break; -+ default: -+ ssb_printk(KERN_ERR PFX -+ "ERROR: PLL init unknown for device %04X\n", -+ bus->chip_id); -+ } -+} -+ -+struct pmu_res_updown_tab_entry { -+ u8 resource; /* The resource number */ -+ u16 updown; /* The updown value */ -+}; -+ -+enum pmu_res_depend_tab_task { -+ PMU_RES_DEP_SET = 1, -+ PMU_RES_DEP_ADD, -+ PMU_RES_DEP_REMOVE, -+}; -+ -+struct pmu_res_depend_tab_entry { -+ u8 resource; /* The resource number */ -+ u8 task; /* SET | ADD | REMOVE */ -+ u32 depend; /* The depend mask */ -+}; -+ -+static const struct pmu_res_updown_tab_entry pmu_res_updown_tab_4328a0[] = { -+ { .resource = SSB_PMURES_4328_EXT_SWITCHER_PWM, .updown = 0x0101, }, -+ { .resource = SSB_PMURES_4328_BB_SWITCHER_PWM, .updown = 0x1F01, }, -+ { .resource = SSB_PMURES_4328_BB_SWITCHER_BURST, .updown = 0x010F, }, -+ { .resource = SSB_PMURES_4328_BB_EXT_SWITCHER_BURST, .updown = 0x0101, }, -+ { .resource = SSB_PMURES_4328_ILP_REQUEST, .updown = 0x0202, }, -+ { .resource = SSB_PMURES_4328_RADIO_SWITCHER_PWM, .updown = 0x0F01, }, -+ { .resource = SSB_PMURES_4328_RADIO_SWITCHER_BURST, .updown = 0x0F01, }, -+ { .resource = SSB_PMURES_4328_ROM_SWITCH, .updown = 0x0101, }, -+ { .resource = SSB_PMURES_4328_PA_REF_LDO, .updown = 0x0F01, }, -+ { .resource = SSB_PMURES_4328_RADIO_LDO, .updown = 0x0F01, }, -+ { .resource = SSB_PMURES_4328_AFE_LDO, .updown = 0x0F01, }, -+ { .resource = SSB_PMURES_4328_PLL_LDO, .updown = 0x0F01, }, -+ { .resource = SSB_PMURES_4328_BG_FILTBYP, .updown = 0x0101, }, -+ { .resource = SSB_PMURES_4328_TX_FILTBYP, .updown = 0x0101, }, -+ { .resource = SSB_PMURES_4328_RX_FILTBYP, .updown = 0x0101, }, -+ { .resource = SSB_PMURES_4328_XTAL_PU, .updown = 0x0101, }, -+ { .resource = SSB_PMURES_4328_XTAL_EN, .updown = 0xA001, }, -+ { .resource = SSB_PMURES_4328_BB_PLL_FILTBYP, .updown = 0x0101, }, -+ { .resource = SSB_PMURES_4328_RF_PLL_FILTBYP, .updown = 0x0101, }, -+ { .resource = SSB_PMURES_4328_BB_PLL_PU, .updown = 0x0701, }, -+}; -+ -+static const struct pmu_res_depend_tab_entry pmu_res_depend_tab_4328a0[] = { -+ { -+ /* Adjust ILP Request to avoid forcing EXT/BB into burst mode. */ -+ .resource = SSB_PMURES_4328_ILP_REQUEST, -+ .task = PMU_RES_DEP_SET, -+ .depend = ((1 << SSB_PMURES_4328_EXT_SWITCHER_PWM) | -+ (1 << SSB_PMURES_4328_BB_SWITCHER_PWM)), -+ }, -+}; -+ -+static const struct pmu_res_updown_tab_entry pmu_res_updown_tab_4325a0[] = { -+ { .resource = SSB_PMURES_4325_XTAL_PU, .updown = 0x1501, }, -+}; -+ -+static const struct pmu_res_depend_tab_entry pmu_res_depend_tab_4325a0[] = { -+ { -+ /* Adjust HT-Available dependencies. */ -+ .resource = SSB_PMURES_4325_HT_AVAIL, -+ .task = PMU_RES_DEP_ADD, -+ .depend = ((1 << SSB_PMURES_4325_RX_PWRSW_PU) | -+ (1 << SSB_PMURES_4325_TX_PWRSW_PU) | -+ (1 << SSB_PMURES_4325_LOGEN_PWRSW_PU) | -+ (1 << SSB_PMURES_4325_AFE_PWRSW_PU)), -+ }, -+}; -+ -+static void ssb_pmu_resources_init(struct ssb_chipcommon *cc) -+{ -+ struct ssb_bus *bus = cc->dev->bus; -+ u32 min_msk = 0, max_msk = 0; -+ unsigned int i; -+ const struct pmu_res_updown_tab_entry *updown_tab = NULL; -+ unsigned int updown_tab_size; -+ const struct pmu_res_depend_tab_entry *depend_tab = NULL; -+ unsigned int depend_tab_size; -+ -+ switch (bus->chip_id) { -+ case 0x4312: -+ /* We keep the default settings: -+ * min_msk = 0xCBB -+ * max_msk = 0x7FFFF -+ */ -+ break; -+ case 0x4325: -+ /* Power OTP down later. */ -+ min_msk = (1 << SSB_PMURES_4325_CBUCK_BURST) | -+ (1 << SSB_PMURES_4325_LNLDO2_PU); -+ if (chipco_read32(cc, SSB_CHIPCO_CHIPSTAT) & -+ SSB_CHIPCO_CHST_4325_PMUTOP_2B) -+ min_msk |= (1 << SSB_PMURES_4325_CLDO_CBUCK_BURST); -+ /* The PLL may turn on, if it decides so. */ -+ max_msk = 0xFFFFF; -+ updown_tab = pmu_res_updown_tab_4325a0; -+ updown_tab_size = ARRAY_SIZE(pmu_res_updown_tab_4325a0); -+ depend_tab = pmu_res_depend_tab_4325a0; -+ depend_tab_size = ARRAY_SIZE(pmu_res_depend_tab_4325a0); -+ break; -+ case 0x4328: -+ min_msk = (1 << SSB_PMURES_4328_EXT_SWITCHER_PWM) | -+ (1 << SSB_PMURES_4328_BB_SWITCHER_PWM) | -+ (1 << SSB_PMURES_4328_XTAL_EN); -+ /* The PLL may turn on, if it decides so. */ -+ max_msk = 0xFFFFF; -+ updown_tab = pmu_res_updown_tab_4328a0; -+ updown_tab_size = ARRAY_SIZE(pmu_res_updown_tab_4328a0); -+ depend_tab = pmu_res_depend_tab_4328a0; -+ depend_tab_size = ARRAY_SIZE(pmu_res_depend_tab_4328a0); -+ break; -+ case 0x5354: -+ /* The PLL may turn on, if it decides so. */ -+ max_msk = 0xFFFFF; -+ break; -+ default: -+ ssb_printk(KERN_ERR PFX -+ "ERROR: PMU resource config unknown for device %04X\n", -+ bus->chip_id); -+ } -+ -+ if (updown_tab) { -+ for (i = 0; i < updown_tab_size; i++) { -+ chipco_write32(cc, SSB_CHIPCO_PMU_RES_TABSEL, -+ updown_tab[i].resource); -+ chipco_write32(cc, SSB_CHIPCO_PMU_RES_UPDNTM, -+ updown_tab[i].updown); -+ } -+ } -+ if (depend_tab) { -+ for (i = 0; i < depend_tab_size; i++) { -+ chipco_write32(cc, SSB_CHIPCO_PMU_RES_TABSEL, -+ depend_tab[i].resource); -+ switch (depend_tab[i].task) { -+ case PMU_RES_DEP_SET: -+ chipco_write32(cc, SSB_CHIPCO_PMU_RES_DEPMSK, -+ depend_tab[i].depend); -+ break; -+ case PMU_RES_DEP_ADD: -+ chipco_set32(cc, SSB_CHIPCO_PMU_RES_DEPMSK, -+ depend_tab[i].depend); -+ break; -+ case PMU_RES_DEP_REMOVE: -+ chipco_mask32(cc, SSB_CHIPCO_PMU_RES_DEPMSK, -+ ~(depend_tab[i].depend)); -+ break; -+ default: -+ SSB_WARN_ON(1); -+ } -+ } -+ } -+ -+ /* Set the resource masks. */ -+ if (min_msk) -+ chipco_write32(cc, SSB_CHIPCO_PMU_MINRES_MSK, min_msk); -+ if (max_msk) -+ chipco_write32(cc, SSB_CHIPCO_PMU_MAXRES_MSK, max_msk); -+} -+ -+void ssb_pmu_init(struct ssb_chipcommon *cc) -+{ -+ struct ssb_bus *bus = cc->dev->bus; -+ u32 pmucap; -+ -+ if (!(cc->capabilities & SSB_CHIPCO_CAP_PMU)) -+ return; -+ -+ pmucap = chipco_read32(cc, SSB_CHIPCO_PMU_CAP); -+ cc->pmu.rev = (pmucap & SSB_CHIPCO_PMU_CAP_REVISION); -+ -+ ssb_dprintk(KERN_DEBUG PFX "Found rev %u PMU (capabilities 0x%08X)\n", -+ cc->pmu.rev, pmucap); -+ -+ if (cc->pmu.rev >= 1) { -+ if ((bus->chip_id == 0x4325) && (bus->chip_rev < 2)) { -+ chipco_mask32(cc, SSB_CHIPCO_PMU_CTL, -+ ~SSB_CHIPCO_PMU_CTL_NOILPONW); -+ } else { -+ chipco_set32(cc, SSB_CHIPCO_PMU_CTL, -+ SSB_CHIPCO_PMU_CTL_NOILPONW); -+ } -+ } -+ ssb_pmu_pll_init(cc); -+ ssb_pmu_resources_init(cc); -+} -+ -+void ssb_pmu_set_ldo_voltage(struct ssb_chipcommon *cc, -+ enum ssb_pmu_ldo_volt_id id, u32 voltage) -+{ -+ struct ssb_bus *bus = cc->dev->bus; -+ u32 addr, shift, mask; -+ -+ switch (bus->chip_id) { -+ case 0x4328: -+ case 0x5354: -+ switch (id) { -+ case LDO_VOLT1: -+ addr = 2; -+ shift = 25; -+ mask = 0xF; -+ break; -+ case LDO_VOLT2: -+ addr = 3; -+ shift = 1; -+ mask = 0xF; -+ break; -+ case LDO_VOLT3: -+ addr = 3; -+ shift = 9; -+ mask = 0xF; -+ break; -+ case LDO_PAREF: -+ addr = 3; -+ shift = 17; -+ mask = 0x3F; -+ break; -+ default: -+ SSB_WARN_ON(1); -+ return; -+ } -+ break; -+ case 0x4312: -+ if (SSB_WARN_ON(id != LDO_PAREF)) -+ return; -+ addr = 0; -+ shift = 21; -+ mask = 0x3F; -+ break; -+ default: -+ return; -+ } -+ -+ ssb_chipco_regctl_maskset(cc, addr, ~(mask << shift), -+ (voltage & mask) << shift); -+} -+ -+void ssb_pmu_set_ldo_paref(struct ssb_chipcommon *cc, bool on) -+{ -+ struct ssb_bus *bus = cc->dev->bus; -+ int ldo; -+ -+ switch (bus->chip_id) { -+ case 0x4312: -+ ldo = SSB_PMURES_4312_PA_REF_LDO; -+ break; -+ case 0x4328: -+ ldo = SSB_PMURES_4328_PA_REF_LDO; -+ break; -+ case 0x5354: -+ ldo = SSB_PMURES_5354_PA_REF_LDO; -+ break; -+ default: -+ return; -+ } -+ -+ if (on) -+ chipco_set32(cc, SSB_CHIPCO_PMU_MINRES_MSK, 1 << ldo); -+ else -+ chipco_mask32(cc, SSB_CHIPCO_PMU_MINRES_MSK, ~(1 << ldo)); -+ chipco_read32(cc, SSB_CHIPCO_PMU_MINRES_MSK); //SPEC FIXME found via mmiotrace - dummy read? -+} -+ -+EXPORT_SYMBOL(ssb_pmu_set_ldo_voltage); -+EXPORT_SYMBOL(ssb_pmu_set_ldo_paref); diff --git a/target/linux/generic-2.6/patches-2.6.27/980-vm_exports.patch b/target/linux/generic-2.6/patches-2.6.27/980-vm_exports.patch deleted file mode 100644 index 58c6289e4..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/980-vm_exports.patch +++ /dev/null @@ -1,114 +0,0 @@ ---- a/mm/shmem.c -+++ b/mm/shmem.c -@@ -2582,6 +2582,16 @@ put_memory: - shmem_unacct_size(flags, size); - return ERR_PTR(error); - } -+EXPORT_SYMBOL_GPL(shmem_file_setup); -+ -+void shmem_set_file(struct vm_area_struct *vma, struct file *file) -+{ -+ if (vma->vm_file) -+ fput(vma->vm_file); -+ vma->vm_file = file; -+ vma->vm_ops = &shmem_vm_ops; -+} -+EXPORT_SYMBOL_GPL(shmem_set_file); - - /** - * shmem_zero_setup - setup a shared anonymous mapping -@@ -2596,9 +2606,6 @@ int shmem_zero_setup(struct vm_area_stru - if (IS_ERR(file)) - return PTR_ERR(file); - -- if (vma->vm_file) -- fput(vma->vm_file); -- vma->vm_file = file; -- vma->vm_ops = &shmem_vm_ops; -+ shmem_set_file(vma, file); - return 0; - } ---- a/fs/file.c -+++ b/fs/file.c -@@ -270,6 +270,7 @@ int expand_files(struct files_struct *fi - /* All good, so we try */ - return expand_fdtable(files, nr); - } -+EXPORT_SYMBOL_GPL(expand_files); - - static int count_open_files(struct fdtable *fdt) - { ---- a/kernel/exit.c -+++ b/kernel/exit.c -@@ -504,6 +504,7 @@ struct files_struct *get_files_struct(st - - return files; - } -+EXPORT_SYMBOL_GPL(get_files_struct); - - void put_files_struct(struct files_struct *files) - { -@@ -523,6 +524,7 @@ void put_files_struct(struct files_struc - free_fdtable(fdt); - } - } -+EXPORT_SYMBOL_GPL(put_files_struct); - - void reset_files_struct(struct files_struct *files) - { ---- a/kernel/fork.c -+++ b/kernel/fork.c -@@ -153,6 +153,7 @@ void __put_task_struct(struct task_struc - if (!profile_handoff_task(tsk)) - free_task(tsk); - } -+EXPORT_SYMBOL_GPL(__put_task_struct); - - /* - * macro override instead of weak attribute alias, to workaround ---- a/kernel/sched.c -+++ b/kernel/sched.c -@@ -4932,6 +4932,7 @@ int can_nice(const struct task_struct *p - return (nice_rlim <= p->signal->rlim[RLIMIT_NICE].rlim_cur || - capable(CAP_SYS_NICE)); - } -+EXPORT_SYMBOL_GPL(can_nice); - - #ifdef __ARCH_WANT_SYS_NICE - ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -993,6 +993,7 @@ unsigned long zap_page_range(struct vm_a - tlb_finish_mmu(tlb, address, end); - return end; - } -+EXPORT_SYMBOL_GPL(zap_page_range); - - /** - * zap_vma_ptes - remove ptes mapping the vma -@@ -2287,6 +2288,7 @@ int vmtruncate_range(struct inode *inode - - return 0; - } -+EXPORT_SYMBOL_GPL(vmtruncate_range); - - /* - * We enter with non-exclusive mmap_sem (to exclude vma changes, ---- a/mm/vmalloc.c -+++ b/mm/vmalloc.c -@@ -88,6 +88,7 @@ void unmap_kernel_range(unsigned long ad - } while (pgd++, addr = next, addr != end); - flush_tlb_kernel_range(start, end); - } -+EXPORT_SYMBOL_GPL(unmap_kernel_range); - - static void unmap_vm_area(struct vm_struct *area) - { -@@ -306,6 +307,7 @@ struct vm_struct *get_vm_area(unsigned l - return __get_vm_area_node(size, flags, VMALLOC_START, VMALLOC_END, - -1, GFP_KERNEL, __builtin_return_address(0)); - } -+EXPORT_SYMBOL_GPL(get_vm_area); - - struct vm_struct *get_vm_area_caller(unsigned long size, unsigned long flags, - void *caller) diff --git a/target/linux/generic-2.6/patches-2.6.27/999-use_preinit_as_init.patch b/target/linux/generic-2.6/patches-2.6.27/999-use_preinit_as_init.patch deleted file mode 100644 index ab104032f..000000000 --- a/target/linux/generic-2.6/patches-2.6.27/999-use_preinit_as_init.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/init/main.c -+++ b/init/main.c -@@ -825,10 +825,7 @@ static int noinline init_post(void) - printk(KERN_WARNING "Failed to execute %s. Attempting " - "defaults...\n", execute_command); - } -- run_init_process("/sbin/init"); -- run_init_process("/etc/init"); -- run_init_process("/bin/init"); -- run_init_process("/bin/sh"); -+ run_init_process("/etc/preinit"); - - panic("No init found. Try passing init= option to kernel."); - } From ca341a66db5ca390f55901056cb08c8e3435cba4 Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 29 Oct 2009 12:22:53 +0000 Subject: [PATCH 013/288] [package] remove references to 2_6_27 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18202 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/kernel/modules/fs.mk | 2 +- package/kernel/modules/netdevices.mk | 2 +- package/kernel/modules/netsupport.mk | 2 +- package/kernel/modules/video.mk | 2 +- package/kernel/modules/wireless.mk | 2 +- package/mac80211/Makefile | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package/kernel/modules/fs.mk b/package/kernel/modules/fs.mk index 9c7fa17d2..425a78219 100644 --- a/package/kernel/modules/fs.mk +++ b/package/kernel/modules/fs.mk @@ -364,7 +364,7 @@ define KernelPackage/fs-btrfs CONFIG_BTRFS_FS \ CONFIG_BTRFS_FS_POSIX_ACL=n # for crc32c - DEPENDS:=+kmod-crypto-core @!LINUX_2_6_21&&!LINUX_2_6_25&&!LINUX_2_6_27&&!LINUX_2_6_28 + DEPENDS:=+kmod-crypto-core @!LINUX_2_6_21&&!LINUX_2_6_25&&!LINUX_2_6_28 FILES:=\ $(LINUX_DIR)/crypto/crc32c.$(LINUX_KMOD_SUFFIX) \ $(LINUX_DIR)/lib/libcrc32c.$(LINUX_KMOD_SUFFIX) \ diff --git a/package/kernel/modules/netdevices.mk b/package/kernel/modules/netdevices.mk index 79e2abed1..b6a7ababc 100644 --- a/package/kernel/modules/netdevices.mk +++ b/package/kernel/modules/netdevices.mk @@ -289,7 +289,7 @@ define KernelPackage/tg3 TITLE:=Broadcom Tigon3 Gigabit Ethernet FILES:=$(LINUX_DIR)/drivers/net/tg3.$(LINUX_KMOD_SUFFIX) KCONFIG:=CONFIG_TIGON3 - DEPENDS:=@LINUX_2_6 +LINUX_2_6_27||LINUX_2_6_28||LINUX_2_6_30||LINUX_2_6_31:kmod-libphy + DEPENDS:=@LINUX_2_6 +LINUX_2_6_28||LINUX_2_6_30||LINUX_2_6_31:kmod-libphy SUBMENU:=$(NETWORK_DEVICES_MENU) AUTOLOAD:=$(call AutoLoad,50,tg3) endef diff --git a/package/kernel/modules/netsupport.mk b/package/kernel/modules/netsupport.mk index 78d77f0b1..c58dfcb3a 100644 --- a/package/kernel/modules/netsupport.mk +++ b/package/kernel/modules/netsupport.mk @@ -473,7 +473,7 @@ $(eval $(call KernelPackage,pppoa)) define KernelPackage/pppol2tp SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=PPPoL2TP support - DEPENDS:=kmod-ppp +kmod-pppoe @!LINUX_2_6_21||!LINUX_2_6_25||!LINUX_2_6_27 + DEPENDS:=kmod-ppp +kmod-pppoe @!LINUX_2_6_21||!LINUX_2_6_25 KCONFIG:=CONFIG_PPPOL2TP FILES:=$(LINUX_DIR)/drivers/net/pppol2tp.$(LINUX_KMOD_SUFFIX) AUTOLOAD:=$(call AutoLoad,40,pppol2tp) diff --git a/package/kernel/modules/video.mk b/package/kernel/modules/video.mk index 47fa3be0c..5bcdbe63e 100644 --- a/package/kernel/modules/video.mk +++ b/package/kernel/modules/video.mk @@ -184,7 +184,7 @@ define KernelPackage/video-gspca-core SUBMENU:=$(VIDEO_MENU) MENU:=1 TITLE:=GSPCA webcam core support framework - DEPENDS:=@LINUX_2_6 @!LINUX_2_6_21 @!LINUX_2_6_25 @!LINUX_2_6_27 @USB_SUPPORT +kmod-usb-core +kmod-video-core + DEPENDS:=@LINUX_2_6 @!LINUX_2_6_21 @!LINUX_2_6_25 @USB_SUPPORT +kmod-usb-core +kmod-video-core KCONFIG:=CONFIG_USB_GSPCA FILES:=$(LINUX_DIR)/drivers/media/video/gspca/gspca_main.$(LINUX_KMOD_SUFFIX) AUTOLOAD:=$(call AutoLoad,70,gspca_main) diff --git a/package/kernel/modules/wireless.mk b/package/kernel/modules/wireless.mk index 7965963e9..609e04bf8 100644 --- a/package/kernel/modules/wireless.mk +++ b/package/kernel/modules/wireless.mk @@ -12,7 +12,7 @@ WIRELESS_MENU:=Wireless Drivers define KernelPackage/ieee80211 SUBMENU:=$(WIRELESS_MENU) TITLE:=802.11 Networking stack - DEPENDS:=+kmod-crypto-arc4 +kmod-crypto-aes +kmod-crypto-michael-mic @LINUX_2_4||@LINUX_2_6_21||LINUX_2_6_23||LINUX_2_6_24||LINUX_2_6_25||LINUX_2_6_26||LINUX_2_6_27||LINUX_2_6_28 + DEPENDS:=+kmod-crypto-arc4 +kmod-crypto-aes +kmod-crypto-michael-mic @LINUX_2_4||@LINUX_2_6_21||LINUX_2_6_23||LINUX_2_6_24||LINUX_2_6_25||LINUX_2_6_26||LINUX_2_6_28 KCONFIG:= \ CONFIG_IEEE80211 \ CONFIG_IEEE80211_CRYPT_WEP \ diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile index 2fe2bfbe2..d3f81365a 100644 --- a/package/mac80211/Makefile +++ b/package/mac80211/Makefile @@ -356,7 +356,7 @@ define KernelPackage/ar9170 $(call KernelPackage/mac80211/Default) TITLE:=Atheros AR9170 802.11n USB support URL:=http://wireless.kernel.org/en/users/Drivers/ar9170 - DEPENDS+= @USB_SUPPORT @!LINUX_2_6_25 @!LINUX_2_6_27 +kmod-ath +kmod-usb-core + DEPENDS+= @USB_SUPPORT @!LINUX_2_6_25 +kmod-ath +kmod-usb-core FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ar9170/ar9170usb.$(LINUX_KMOD_SUFFIX) AUTOLOAD:=$(call AutoLoad,27,ar9170usb) endef From 7616e48d77eb9f484e064295f83cc5580496456e Mon Sep 17 00:00:00 2001 From: blogic Date: Thu, 29 Oct 2009 12:51:45 +0000 Subject: [PATCH 014/288] [ramips] hopefully fixes dma issues seen on ethernet driver when under high load git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18203 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ramips/files/drivers/net/ramips.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/target/linux/ramips/files/drivers/net/ramips.c b/target/linux/ramips/files/drivers/net/ramips.c index 7168f18f6..b1cc5504d 100644 --- a/target/linux/ramips/files/drivers/net/ramips.c +++ b/target/linux/ramips/files/drivers/net/ramips.c @@ -147,6 +147,8 @@ ramips_eth_hard_start_xmit(struct sk_buff* skb, struct net_device *dev) unsigned long tx; unsigned int tx_next; unsigned int mapped_addr; + + if(priv->plat->min_pkt_len) { if(skb->len < priv->plat->min_pkt_len) @@ -169,9 +171,9 @@ ramips_eth_hard_start_xmit(struct sk_buff* skb, struct net_device *dev) tx_next = 0; else tx_next = tx + 1; - if((priv->tx_skb[tx]== 0) && (priv->tx_skb[tx_next] == 0)) + if((priv->tx_skb[tx] == 0) && (priv->tx_skb[tx_next] == 0)) { - if(!(priv->tx[tx].txd2 & TX_DMA_DONE)) + if(!(priv->tx[tx].txd2 & TX_DMA_DONE) || !(priv->tx[tx_next].txd2 & TX_DMA_DONE)) { kfree_skb(skb); dev->stats.tx_dropped++; @@ -181,10 +183,12 @@ ramips_eth_hard_start_xmit(struct sk_buff* skb, struct net_device *dev) priv->tx[tx].txd1 = virt_to_phys(skb->data); priv->tx[tx].txd2 &= ~(TX_DMA_PLEN0_MASK | TX_DMA_DONE); priv->tx[tx].txd2 |= TX_DMA_PLEN0(skb->len); + wmb(); ramips_fe_wr((tx + 1) % NUM_TX_DESC, RAMIPS_TX_CTX_IDX0); dev->stats.tx_packets++; dev->stats.tx_bytes += skb->len; priv->tx_skb[tx] = skb; + wmb(); ramips_fe_wr((tx + 1) % NUM_TX_DESC, RAMIPS_TX_CTX_IDX0); } else { dev->stats.tx_dropped++; @@ -228,6 +232,7 @@ ramips_eth_rx_hw(unsigned long ptr) dma_map_single(NULL, new_skb->data, MAX_RX_LENGTH + 2, DMA_FROM_DEVICE); priv->rx[rx].rxd2 &= ~RX_DMA_DONE; + wmb(); ramips_fe_wr(rx, RAMIPS_RX_CALC_IDX0); } if(max_rx == 0) From eb47209914247d1f06c532c7b828d9fe7b2ba4fd Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 29 Oct 2009 13:39:29 +0000 Subject: [PATCH 015/288] [brcm63xx] do not generate trx images, this is useless git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18204 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/brcm63xx/image/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/target/linux/brcm63xx/image/Makefile b/target/linux/brcm63xx/image/Makefile index c583aa54e..af15c1b45 100644 --- a/target/linux/brcm63xx/image/Makefile +++ b/target/linux/brcm63xx/image/Makefile @@ -94,7 +94,6 @@ define Image/Prepare endef define Image/Build - $(STAGING_DIR_HOST)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(1).trx -f $(KDIR)/loader.gz -f $(KDIR)/vmlinux.lzma $(call trxalign/$(1)) -f $(KDIR)/root.$(1) dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-root.$(1) bs=128k conv=sync # Various routers $(call Image/Build/CFE,$(1),96345GW2,6345,bccfe,,bccfe,) From 6bc0d6136909b9328501d4150e7f9e6821860c43 Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 29 Oct 2009 15:48:34 +0000 Subject: [PATCH 016/288] [at91] fix dfboot linking failures (#5937) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18206 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/at91/image/dfboot/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/at91/image/dfboot/Makefile b/target/linux/at91/image/dfboot/Makefile index 344af5d56..91a603de4 100644 --- a/target/linux/at91/image/dfboot/Makefile +++ b/target/linux/at91/image/dfboot/Makefile @@ -24,7 +24,8 @@ endef define Build/Compile $(MAKE) -C $(PKG_BUILD_DIR) \ $(TARGET_CONFIGURE_OPTS) \ - CFLAGS="$(TARGET_CFLAGS)" + CFLAGS="$(TARGET_CFLAGS)" \ + LDFLAGS="$(LIBGCC_S)" endef define Build/InstallDev From 7ac41a58e02231b5a4102d086a9acbf127d609d9 Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 29 Oct 2009 16:00:37 +0000 Subject: [PATCH 017/288] [at91] fix u-boot linking failure with an EABI toolchain git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18207 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../image/u-boot/patches/015-eabi_fixes.patch | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 target/linux/at91/image/u-boot/patches/015-eabi_fixes.patch diff --git a/target/linux/at91/image/u-boot/patches/015-eabi_fixes.patch b/target/linux/at91/image/u-boot/patches/015-eabi_fixes.patch new file mode 100644 index 000000000..ec94a4b40 --- /dev/null +++ b/target/linux/at91/image/u-boot/patches/015-eabi_fixes.patch @@ -0,0 +1,52 @@ +Index: git/lib_arm/div0.c +=================================================================== +--- git.orig/lib_arm/div0.c ++++ git/lib_arm/div0.c +@@ -22,9 +22,3 @@ + */ + + /* Replacement (=dummy) for GNU/Linux division-by zero handler */ +-void __div0 (void) +-{ +- extern void hang (void); +- +- hang(); +-} +Index: git/Makefile +=================================================================== +--- git.orig/Makefile ++++ git/Makefile +@@ -225,7 +225,7 @@ LIBS := $(addprefix $(obj),$(LIBS)) + .PHONY : $(LIBS) + + # Add GCC lib +-PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc ++PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc -lgcc_eh + + # The "tools" are needed early, so put this first + # Don't include stuff already done in $(LIBS) +--- a/board/vlink/vlink.c 2009-10-29 16:40:33.000000000 +0100 ++++ b/board/vlink/vlink.c 2009-10-29 16:43:27.000000000 +0100 +@@ -33,6 +33,9 @@ + * Miscelaneous platform dependent initialisations + */ + ++void raise() {} ++void abort() {} ++ + int board_init (void) + { + DECLARE_GLOBAL_DATA_PTR; +--- a/board/vlink/u-boot.lds 2009-10-29 16:40:33.000000000 +0100 ++++ b/board/vlink/u-boot.lds 2009-10-29 16:43:57.000000000 +0100 +@@ -38,6 +38,10 @@ + + . = ALIGN(4); + .rodata : { *(.rodata) } ++ .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } ++ __exidx_start = .; ++ .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } ++ __exidx_end = .; + + . = ALIGN(4); + .data : { *(.data) } From b08f29cbc9c8559092e0015a0524b6f90d7181db Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 29 Oct 2009 16:03:15 +0000 Subject: [PATCH 018/288] [at91] fix u-boot installation git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18208 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/at91/image/u-boot/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/at91/image/u-boot/Makefile b/target/linux/at91/image/u-boot/Makefile index 31168bcec..f53df11a9 100644 --- a/target/linux/at91/image/u-boot/Makefile +++ b/target/linux/at91/image/u-boot/Makefile @@ -43,7 +43,7 @@ define Build/InstallDev dd if=$(PKG_BUILD_DIR)/u-boot.bin of=$(PKG_BUILD_DIR)/u-boot.block bs=232k count=1 conv=sync # $(INSTALL_DIR) $(STAGING_DIR)/ubclient/sbin # $(INSTALL_BIN) $(PKG_BUILD_DIR)/ubclient/ubpar $(STAGING_DIR)/ubclient/sbin/ - $(CP) $(PKG_BUILD_DIR)/ubclient/ubpar ../../base-files/default/sbin + $(CP) $(PKG_BUILD_DIR)/ubclient/ubpar ../../base-files/sbin endef $(eval $(call Build/DefaultTargets)) From f46dbe37e17df00aee7afb337f1476b1c114c726 Mon Sep 17 00:00:00 2001 From: blogic Date: Thu, 29 Oct 2009 21:08:11 +0000 Subject: [PATCH 019/288] [ramips] fixes rx path for eth, spinlock it, increases buffer size, board now survives ping -f git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18212 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../linux/ramips/files/drivers/net/ramips.c | 51 +++++++++---------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/target/linux/ramips/files/drivers/net/ramips.c b/target/linux/ramips/files/drivers/net/ramips.c index b1cc5504d..e78eb6f8d 100644 --- a/target/linux/ramips/files/drivers/net/ramips.c +++ b/target/linux/ramips/files/drivers/net/ramips.c @@ -28,7 +28,7 @@ #include "ramips_eth.h" #define TX_TIMEOUT (20 * HZ / 100) -#define MAX_RX_LENGTH 1500 +#define MAX_RX_LENGTH 1600 #ifdef CONFIG_RALINK_RT305X #include "ramips_esw.c" @@ -147,7 +147,7 @@ ramips_eth_hard_start_xmit(struct sk_buff* skb, struct net_device *dev) unsigned long tx; unsigned int tx_next; unsigned int mapped_addr; - + unsigned long flags; if(priv->plat->min_pkt_len) { @@ -166,35 +166,30 @@ ramips_eth_hard_start_xmit(struct sk_buff* skb, struct net_device *dev) mapped_addr = (unsigned int)dma_map_single(NULL, skb->data, skb->len, DMA_TO_DEVICE); dma_sync_single_for_device(NULL, mapped_addr, skb->len, DMA_TO_DEVICE); + spin_lock_irqsave(&priv->page_lock, flags); tx = ramips_fe_rr(RAMIPS_TX_CTX_IDX0); if(tx == NUM_TX_DESC - 1) tx_next = 0; else tx_next = tx + 1; - if((priv->tx_skb[tx] == 0) && (priv->tx_skb[tx_next] == 0)) - { - if(!(priv->tx[tx].txd2 & TX_DMA_DONE) || !(priv->tx[tx_next].txd2 & TX_DMA_DONE)) - { - kfree_skb(skb); - dev->stats.tx_dropped++; - printk(KERN_ERR "%s: dropping\n", dev->name); - return 0; - } - priv->tx[tx].txd1 = virt_to_phys(skb->data); - priv->tx[tx].txd2 &= ~(TX_DMA_PLEN0_MASK | TX_DMA_DONE); - priv->tx[tx].txd2 |= TX_DMA_PLEN0(skb->len); - wmb(); - ramips_fe_wr((tx + 1) % NUM_TX_DESC, RAMIPS_TX_CTX_IDX0); - dev->stats.tx_packets++; - dev->stats.tx_bytes += skb->len; - priv->tx_skb[tx] = skb; - wmb(); - ramips_fe_wr((tx + 1) % NUM_TX_DESC, RAMIPS_TX_CTX_IDX0); - } else { - dev->stats.tx_dropped++; - kfree_skb(skb); - } - return 0; + if((priv->tx_skb[tx]) || (priv->tx_skb[tx_next]) || + !(priv->tx[tx].txd2 & TX_DMA_DONE) || !(priv->tx[tx_next].txd2 & TX_DMA_DONE)) + goto out; + priv->tx[tx].txd1 = mapped_addr; + priv->tx[tx].txd2 &= ~(TX_DMA_PLEN0_MASK | TX_DMA_DONE); + priv->tx[tx].txd2 |= TX_DMA_PLEN0(skb->len); + dev->stats.tx_packets++; + dev->stats.tx_bytes += skb->len; + priv->tx_skb[tx] = skb; + wmb(); + ramips_fe_wr((tx + 1) % NUM_TX_DESC, RAMIPS_TX_CTX_IDX0); + spin_unlock_irqrestore(&priv->page_lock, flags); + return NETDEV_TX_OK; +out: + spin_unlock_irqrestore(&priv->page_lock, flags); + dev->stats.tx_dropped++; + kfree_skb(skb); + return NETDEV_TX_OK; } static void @@ -216,7 +211,6 @@ ramips_eth_rx_hw(unsigned long ptr) rx_skb = priv->rx_skb[rx]; rx_skb->len = RX_DMA_PLEN0(priv->rx[rx].rxd2); - rx_skb->tail = rx_skb->data + rx_skb->len; rx_skb->dev = dev; rx_skb->protocol = eth_type_trans(rx_skb, dev); rx_skb->ip_summed = CHECKSUM_NONE; @@ -224,7 +218,7 @@ ramips_eth_rx_hw(unsigned long ptr) dev->stats.rx_bytes += rx_skb->len; netif_rx(rx_skb); - new_skb = __dev_alloc_skb(MAX_RX_LENGTH + 2, GFP_DMA | GFP_ATOMIC); + new_skb = netdev_alloc_skb(dev, MAX_RX_LENGTH + 2); priv->rx_skb[rx] = new_skb; BUG_ON(!new_skb); skb_reserve(new_skb, 2); @@ -384,6 +378,7 @@ ramips_eth_probe(struct net_device *dev) dev->mtu = MAX_RX_LENGTH; dev->tx_timeout = ramips_eth_timeout; dev->watchdog_timeo = TX_TIMEOUT; + spin_lock_init(&priv->page_lock); return 0; } From 91c099418f210c955d86044405650494e27371b3 Mon Sep 17 00:00:00 2001 From: blogic Date: Thu, 29 Oct 2009 21:25:55 +0000 Subject: [PATCH 020/288] fixes bluetooth dependency, thx sn9 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18213 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/kernel/modules/other.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/modules/other.mk b/package/kernel/modules/other.mk index 3d2985060..28ba41469 100644 --- a/package/kernel/modules/other.mk +++ b/package/kernel/modules/other.mk @@ -255,7 +255,7 @@ $(eval $(call KernelPackage,ssb)) define KernelPackage/bluetooth SUBMENU:=$(OTHER_MENU) TITLE:=Bluetooth support - DEPENDS:=@USB_SUPPORT +kmod-usb-core +kmod-input-core + DEPENDS:=@USB_SUPPORT +kmod-usb-core +kmod-hid KCONFIG:= \ CONFIG_BLUEZ \ CONFIG_BLUEZ_L2CAP \ From 70916d05defae02ed83ba6af2d1e2ba03e062525 Mon Sep 17 00:00:00 2001 From: blogic Date: Thu, 29 Oct 2009 21:26:36 +0000 Subject: [PATCH 021/288] make etehrent work on wrt350n, thx sn9 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18214 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/switch/src/switch-robo.c | 27 +++++++++++++++++-- .../brcm-2.4/base-files/etc/preinit.arch | 5 ++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/package/switch/src/switch-robo.c b/package/switch/src/switch-robo.c index 206359d07..481bb76a5 100644 --- a/package/switch/src/switch-robo.c +++ b/package/switch/src/switch-robo.c @@ -58,6 +58,7 @@ #define ROBO_DEVICE_ID_5395 0x95 #define ROBO_DEVICE_ID_5397 0x97 #define ROBO_DEVICE_ID_5398 0x98 +#define ROBO_DEVICE_ID_53115 0x3115 /* Private et.o ioctls */ #define SIOCGETCPHYRD (SIOCDEVPRIVATE + 9) @@ -297,6 +298,7 @@ static void robo_switch_reset(void) (robo.devid == ROBO_DEVICE_ID_5398)) { /* Trigger a software reset. */ robo_write16(ROBO_CTRL_PAGE, 0x79, 0x83); + mdelay(500); robo_write16(ROBO_CTRL_PAGE, 0x79, 0); } } @@ -367,7 +369,8 @@ static int robo_probe(char *devname) if (err) return err; - printk("found!\n"); + printk("found a 5%s%x!%s\n", robo.devid & 0xff00 ? "" : "3", robo.devid, + robo.is_5350 ? " It's a 5350." : ""); return 0; } @@ -445,6 +448,17 @@ static int handle_vlan_port_write(void *driver, char *buf, int nr) } /* write config now */ + + if (robo.devid != ROBO_DEVICE_ID_5325) { + __u8 regoff = ((robo.devid == ROBO_DEVICE_ID_5395) || + (robo.devid == ROBO_DEVICE_ID_53115)) ? 0x20 : 0; + + robo_write32(ROBO_ARLIO_PAGE, 0x63 + regoff, (c->untag << 9) | c->port); + robo_write16(ROBO_ARLIO_PAGE, 0x61 + regoff, nr); + robo_write16(ROBO_ARLIO_PAGE, 0x60 + regoff, 1 << 7); + return 0; + } + val16 = (nr) /* vlan */ | (1 << 12) /* write */ | (1 << 13) /* enable */; if (robo.is_5350) { robo_write32(ROBO_VLAN_PAGE, ROBO_VLAN_WRITE_5350, @@ -486,7 +500,12 @@ static int handle_enable_vlan_write(void *driver, char *buf, int nr) robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL0, disable ? 0 : (1 << 7) /* 802.1Q VLAN */ | (3 << 5) /* mac check and hash */); robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL1, disable ? 0 : - (1 << 1) | (1 << 2) | (1 << 3) /* RSV multicast */); + (robo.devid == ROBO_DEVICE_ID_5325 ? (1 << 1) : 0) | /* RSV multicast */ + robo_read16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL0) | (1 << 2) | (1 << 3)); + + if (robo.devid != ROBO_DEVICE_ID_5325) + return 0; + robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL4, disable ? 0 : (1 << 6) /* drop invalid VID frames */); robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL5, disable ? 0 : @@ -585,6 +604,10 @@ static int __init robo_init(void) .port_handlers = NULL, .vlan_handlers = vlan, }; + if (robo.devid != ROBO_DEVICE_ID_5325) { + driver.ports = 9; + driver.cpuport = 8; + } return switch_register_driver(&driver); } diff --git a/target/linux/brcm-2.4/base-files/etc/preinit.arch b/target/linux/brcm-2.4/base-files/etc/preinit.arch index 25d11d96a..a90d314e2 100755 --- a/target/linux/brcm-2.4/base-files/etc/preinit.arch +++ b/target/linux/brcm-2.4/base-files/etc/preinit.arch @@ -37,8 +37,6 @@ case "$(cat /proc/diag/model)" in "Sitecom WL-105b") ifname=eth1;; esac -failsafe_ip - check_module () { module="$1"; shift; params="$*" @@ -48,11 +46,14 @@ check_module () { return $? } +check_module tg3 insmod switch-core check_module switch-robo || check_module switch-adm || { check_module bcm57xx activate_gpio=0x4 && cpu_port="8u*" } || rmmod switch-core +failsafe_ip + [ -d /proc/switch/eth0 ] && { echo 1 > /proc/switch/eth0/reset From 30576ebab8e3cafeba9bc1bc67faa8703fdd5168 Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 29 Oct 2009 23:34:39 +0000 Subject: [PATCH 022/288] [olpc] ext2 images need to wait for /dev/sda2 to appear before attempting to mount it, fixes olpc boot on ext2 images git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18215 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/olpc/image/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/olpc/image/Makefile b/target/linux/olpc/image/Makefile index eb1bedd0a..f60b76e20 100644 --- a/target/linux/olpc/image/Makefile +++ b/target/linux/olpc/image/Makefile @@ -27,7 +27,7 @@ ifeq ($(CONFIG_OLPC_BOOTSCRIPT_IMAGES),y) endef define Image/cmdline/ext2 - root=$(ROOTPART) rootfstype=ext2 + root=$(ROOTPART) rootfstype=ext2 rootwait endef define Image/Build/bootscript From 5e0a41a0410e6d38ad8573eb5ec441a9c38c5e47 Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 29 Oct 2009 23:35:54 +0000 Subject: [PATCH 023/288] [olpc] make the kernel also output on ttyS0 and ask openfirmware to unfreeze the screen git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18216 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/olpc/image/olpc.fth | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/olpc/image/olpc.fth b/target/linux/olpc/image/olpc.fth index f250ab0c7..5914be660 100644 --- a/target/linux/olpc/image/olpc.fth +++ b/target/linux/olpc/image/olpc.fth @@ -1,4 +1,5 @@ \ Boot script " u:\boot\vmlinuz" to boot-device -" @CMDLINE@ noinitrd console=tty0" to boot-file +" @CMDLINE@ noinitrd console=ttyS0,115200 console=tty0" to boot-file +unfreeze boot From 7b15803c7f92a7f5b50bad694d7ab0c798f1b539 Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 29 Oct 2009 23:42:12 +0000 Subject: [PATCH 024/288] [toolchain] update insight to 6.8-1 (#6007) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18217 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- toolchain/insight/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/toolchain/insight/Makefile b/toolchain/insight/Makefile index 34e6867b9..e53635b27 100644 --- a/toolchain/insight/Makefile +++ b/toolchain/insight/Makefile @@ -7,10 +7,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:=insight -PKG_VERSION:=6.8 +PKG_VERSION:=6.8-1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 -PKG_MD5SUM:=b403972b35520399663c7054e8132ca9 +PKG_MD5SUM:=4ee9824c1e8d6108d886c6c09b24f0ac PKG_SOURCE_URL:=ftp://sourceware.org/pub/insight/releases PKG_CAT:=bzcat @@ -30,6 +30,7 @@ define Host/Configure --target=$(REAL_GNU_TARGET_NAME) \ $(DISABLE_NLS) \ --enable-threads \ + --enable-werror=no \ ); endef From 09e306ce30c6a9b28d41442c157b03c2c5ce5148 Mon Sep 17 00:00:00 2001 From: thepeople Date: Fri, 30 Oct 2009 01:05:37 +0000 Subject: [PATCH 025/288] add WRT350Nv1 target, thanks sn9 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18218 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/brcm47xx/profiles/WRT350Nv1.mk | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 target/linux/brcm47xx/profiles/WRT350Nv1.mk diff --git a/target/linux/brcm47xx/profiles/WRT350Nv1.mk b/target/linux/brcm47xx/profiles/WRT350Nv1.mk new file mode 100644 index 000000000..414196484 --- /dev/null +++ b/target/linux/brcm47xx/profiles/WRT350Nv1.mk @@ -0,0 +1,16 @@ +# +# Copyright (C) 2009 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/WRT350Nv1 + NAME:=Linksys WRT350Nv1 + PACKAGES:=kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-ssb-gige kmod-ocf-ubsec-ssb +endef + +define Profile/WRT350Nv1/Description + Package set compatible with the Linksys WRT350Nv1. Contains USB support +endef +$(eval $(call Profile,WRT350Nv1) From 163074a14b931713b829391d8afc472cec6b8064 Mon Sep 17 00:00:00 2001 From: thepeople Date: Fri, 30 Oct 2009 01:08:11 +0000 Subject: [PATCH 026/288] fix my typo git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18219 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/brcm47xx/profiles/WRT350Nv1.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/brcm47xx/profiles/WRT350Nv1.mk b/target/linux/brcm47xx/profiles/WRT350Nv1.mk index 414196484..82be93aa8 100644 --- a/target/linux/brcm47xx/profiles/WRT350Nv1.mk +++ b/target/linux/brcm47xx/profiles/WRT350Nv1.mk @@ -13,4 +13,4 @@ endef define Profile/WRT350Nv1/Description Package set compatible with the Linksys WRT350Nv1. Contains USB support endef -$(eval $(call Profile,WRT350Nv1) +$(eval $(call Profile,WRT350Nv1)) From 7a9d21909278eae2a6b82a0ce206dbd3cd9d9169 Mon Sep 17 00:00:00 2001 From: blogic Date: Fri, 30 Oct 2009 09:18:40 +0000 Subject: [PATCH 027/288] [ramips] missing header file changes, and fix mtu value git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18220 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ramips/files/drivers/net/ramips.c | 2 +- target/linux/ramips/files/drivers/net/ramips_eth.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/ramips/files/drivers/net/ramips.c b/target/linux/ramips/files/drivers/net/ramips.c index e78eb6f8d..f9ce27241 100644 --- a/target/linux/ramips/files/drivers/net/ramips.c +++ b/target/linux/ramips/files/drivers/net/ramips.c @@ -375,7 +375,7 @@ ramips_eth_probe(struct net_device *dev) dev->stop = ramips_eth_stop; dev->hard_start_xmit = ramips_eth_hard_start_xmit; dev->set_mac_address = ramips_eth_set_mac_addr; - dev->mtu = MAX_RX_LENGTH; + dev->mtu = 1500; dev->tx_timeout = ramips_eth_timeout; dev->watchdog_timeo = TX_TIMEOUT; spin_lock_init(&priv->page_lock); diff --git a/target/linux/ramips/files/drivers/net/ramips_eth.h b/target/linux/ramips/files/drivers/net/ramips_eth.h index 891c47b43..ead1b785c 100644 --- a/target/linux/ramips/files/drivers/net/ramips_eth.h +++ b/target/linux/ramips/files/drivers/net/ramips_eth.h @@ -197,6 +197,7 @@ struct raeth_priv unsigned int skb_free_idx; + spinlock_t page_lock; struct ramips_eth_platform_data *plat; }; From 877e45fb1d8e3d631207075e0f598f9df7e887ac Mon Sep 17 00:00:00 2001 From: florian Date: Fri, 30 Oct 2009 09:55:53 +0000 Subject: [PATCH 028/288] [kernel] remove no longer used configs and patches git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18221 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/brcm63xx/config-2.6.27 | 205 ------ target/linux/brcm63xx/config-2.6.28 | 203 ------ ...01-add_broadcom_63xx_cpu_definitions.patch | 100 --- ...2-add_support_for_broadcom_63xx_cpus.patch | 122 ---- ...add_serial_driver_for_bcm63xx_integr.patch | 66 -- .../patches-2.6.27/004_add_pci_support.patch | 33 - .../006-pcmcia_cardbus_support.patch | 43 -- .../patches-2.6.27/007-usb_ohci_support.patch | 56 -- .../patches-2.6.27/008-usb_ehci_support.patch | 58 -- ...-add_integrated_ethernet_mac_support.patch | 48 -- ...-add_integrated_ethernet_phy_support.patch | 38 -- .../patches-2.6.27/020-watchdog.patch | 29 - .../040-bcm963xx_flashmap.patch | 73 --- .../brcm63xx/patches-2.6.27/050-spi.patch | 26 - .../patches-2.6.27/500-lzma_initramfs.patch | 125 ---- target/linux/olpc/config-2.6.27 | 587 ------------------ .../patches-2.6.27/300-block2mtd_init.patch | 205 ------ 17 files changed, 2017 deletions(-) delete mode 100644 target/linux/brcm63xx/config-2.6.27 delete mode 100644 target/linux/brcm63xx/config-2.6.28 delete mode 100644 target/linux/brcm63xx/patches-2.6.27/001-add_broadcom_63xx_cpu_definitions.patch delete mode 100644 target/linux/brcm63xx/patches-2.6.27/002-add_support_for_broadcom_63xx_cpus.patch delete mode 100644 target/linux/brcm63xx/patches-2.6.27/003-add_serial_driver_for_bcm63xx_integr.patch delete mode 100644 target/linux/brcm63xx/patches-2.6.27/004_add_pci_support.patch delete mode 100644 target/linux/brcm63xx/patches-2.6.27/006-pcmcia_cardbus_support.patch delete mode 100644 target/linux/brcm63xx/patches-2.6.27/007-usb_ohci_support.patch delete mode 100644 target/linux/brcm63xx/patches-2.6.27/008-usb_ehci_support.patch delete mode 100644 target/linux/brcm63xx/patches-2.6.27/009-add_integrated_ethernet_mac_support.patch delete mode 100644 target/linux/brcm63xx/patches-2.6.27/010-add_integrated_ethernet_phy_support.patch delete mode 100644 target/linux/brcm63xx/patches-2.6.27/020-watchdog.patch delete mode 100644 target/linux/brcm63xx/patches-2.6.27/040-bcm963xx_flashmap.patch delete mode 100644 target/linux/brcm63xx/patches-2.6.27/050-spi.patch delete mode 100644 target/linux/brcm63xx/patches-2.6.27/500-lzma_initramfs.patch delete mode 100644 target/linux/olpc/config-2.6.27 delete mode 100644 target/linux/olpc/patches-2.6.27/300-block2mtd_init.patch diff --git a/target/linux/brcm63xx/config-2.6.27 b/target/linux/brcm63xx/config-2.6.27 deleted file mode 100644 index a9881d71a..000000000 --- a/target/linux/brcm63xx/config-2.6.27 +++ /dev/null @@ -1,205 +0,0 @@ -CONFIG_32BIT=y -# CONFIG_64BIT is not set -# CONFIG_8139TOO is not set -# CONFIG_ARCH_HAS_ILOG2_U32 is not set -# CONFIG_ARCH_HAS_ILOG2_U64 is not set -CONFIG_ARCH_POPULATES_NODE_MAP=y -CONFIG_ARCH_REQUIRE_GPIOLIB=y -# CONFIG_ARCH_SUPPORTS_MSI is not set -CONFIG_ARCH_SUPPORTS_OPROFILE=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_AUDIT=y -CONFIG_AUDIT_GENERIC=y -CONFIG_BASE_SMALL=0 -# CONFIG_BCM47XX is not set -CONFIG_BCM63XX=y -CONFIG_BCM63XX_CPU_6338=y -CONFIG_BCM63XX_CPU_6345=y -CONFIG_BCM63XX_CPU_6348=y -CONFIG_BCM63XX_CPU_6358=y -CONFIG_BCM63XX_ENET=y -CONFIG_BCM63XX_PHY=y -CONFIG_BCM63XX_WDT=y -CONFIG_BITREVERSE=y -CONFIG_BLK_DEV_IO_TRACE=y -CONFIG_BOARD_BCM963XX=y -# CONFIG_BOARD_LIVEBOX is not set -# CONFIG_BSD_DISKLABEL is not set -CONFIG_BSD_PROCESS_ACCT_V3=y -CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CEVT_R4K=y -CONFIG_CLASSIC_RCU=y -CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200" -CONFIG_CPU_BIG_ENDIAN=y -CONFIG_CPU_HAS_LLSC=y -CONFIG_CPU_HAS_PREFETCH=y -CONFIG_CPU_HAS_SYNC=y -# CONFIG_CPU_LITTLE_ENDIAN is not set -# CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y -CONFIG_CPU_MIPS32_R1=y -# CONFIG_CPU_MIPS32_R2 is not set -# CONFIG_CPU_MIPS64_R1 is not set -# CONFIG_CPU_MIPS64_R2 is not set -CONFIG_CPU_MIPSR1=y -# CONFIG_CPU_NEVADA is not set -# CONFIG_CPU_R10000 is not set -# CONFIG_CPU_R3000 is not set -# CONFIG_CPU_R4300 is not set -# CONFIG_CPU_R4X00 is not set -# CONFIG_CPU_R5000 is not set -# CONFIG_CPU_R5432 is not set -# CONFIG_CPU_R6000 is not set -# CONFIG_CPU_R8000 is not set -# CONFIG_CPU_RM7000 is not set -# CONFIG_CPU_RM9000 is not set -# CONFIG_CPU_SB1 is not set -CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y -CONFIG_CPU_SUPPORTS_HIGHMEM=y -# CONFIG_CPU_TX39XX is not set -# CONFIG_CPU_TX49XX is not set -# CONFIG_CPU_VR41XX is not set -CONFIG_CRAMFS=y -CONFIG_CSRC_R4K=y -CONFIG_DEVPORT=y -# CONFIG_DM9000 is not set -CONFIG_DMA_NEED_PCI_MAP_STATE=y -CONFIG_DMA_NONCOHERENT=y -CONFIG_EARLY_PRINTK=y -CONFIG_ELF_CORE=y -CONFIG_FIRMWARE_IN_KERNEL=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_GENERIC_CMOS_UPDATE=y -# CONFIG_GENERIC_FIND_FIRST_BIT is not set -CONFIG_GENERIC_FIND_NEXT_BIT=y -CONFIG_GENERIC_GPIO=y -# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set -CONFIG_GPIOLIB=y -CONFIG_GPIO_DEVICE=y -CONFIG_GPIO_SYSFS=y -# CONFIG_HAMRADIO is not set -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT=y -CONFIG_HAVE_ARCH_KGDB=y -# CONFIG_HAVE_ARCH_TRACEHOOK is not set -# CONFIG_HAVE_CLK is not set -# CONFIG_HAVE_DMA_ATTRS is not set -# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set -# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set -CONFIG_HAVE_IDE=y -# CONFIG_HAVE_IOREMAP_PROT is not set -# CONFIG_HAVE_KPROBES is not set -# CONFIG_HAVE_KRETPROBES is not set -CONFIG_HAVE_OPROFILE=y -CONFIG_HW_HAS_PCI=y -CONFIG_HW_RANDOM=y -CONFIG_HZ=250 -# CONFIG_HZ_100 is not set -CONFIG_HZ_250=y -# CONFIG_I2C is not set -# CONFIG_IDE is not set -CONFIG_INITRAMFS_SOURCE="" -CONFIG_INOTIFY=y -CONFIG_INOTIFY_USER=y -CONFIG_IP_PIMSM_V1=y -CONFIG_IP_PIMSM_V2=y -CONFIG_IRQ_CPU=y -# CONFIG_ISDN is not set -CONFIG_KEXEC=y -CONFIG_LBD=y -CONFIG_LEDS_GPIO=y -# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set -# CONFIG_LEMOTE_FULONG is not set -# CONFIG_MACH_ALCHEMY is not set -# CONFIG_MACH_DECSTATION is not set -# CONFIG_MACH_JAZZ is not set -# CONFIG_MACH_TX39XX is not set -# CONFIG_MACH_TX49XX is not set -# CONFIG_MACH_VR41XX is not set -CONFIG_MAGIC_SYSRQ=y -# CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y -# CONFIG_MIPS_COBALT is not set -# CONFIG_MIPS_FPU_EMU is not set -CONFIG_MIPS_L1_CACHE_SHIFT=5 -# CONFIG_MIPS_MACHINE is not set -# CONFIG_MIPS_MALTA is not set -CONFIG_MIPS_MT_DISABLED=y -# CONFIG_MIPS_MT_SMP is not set -# CONFIG_MIPS_MT_SMTC is not set -# CONFIG_MIPS_SIM is not set -CONFIG_MODULE_FORCE_LOAD=y -CONFIG_MODULE_FORCE_UNLOAD=y -CONFIG_MTD_BCM963XX=y -CONFIG_MTD_CFI_ADV_OPTIONS=y -CONFIG_MTD_CFI_BE_BYTE_SWAP=y -# CONFIG_MTD_CFI_GEOMETRY is not set -# CONFIG_MTD_CFI_NOSWAP is not set -CONFIG_MTD_CFI_STAA=y -CONFIG_MTD_CMDLINE_PARTS=y -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -CONFIG_MTD_CONCAT=y -CONFIG_MTD_JEDECPROBE=y -CONFIG_MTD_REDBOOT_PARTS=y -CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED=y -# CONFIG_NATSEMI is not set -# CONFIG_NO_IOPORT is not set -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PCI=y -CONFIG_PCI_DOMAINS=y -# CONFIG_PCSPKR_PLATFORM is not set -CONFIG_PHYLIB=y -# CONFIG_PMC_MSP is not set -# CONFIG_PMC_YOSEMITE is not set -# CONFIG_PNX8550_JBS is not set -# CONFIG_PNX8550_STB810 is not set -CONFIG_POSIX_MQUEUE=y -# CONFIG_PROBE_INITRD_HEADER is not set -# CONFIG_R6040 is not set -CONFIG_RELAY=y -CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y -# CONFIG_SCSI_DMA is not set -# CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_BCM63XX=y -CONFIG_SERIAL_BCM63XX_CONSOLE=y -# CONFIG_SGI_IP22 is not set -# CONFIG_SGI_IP27 is not set -# CONFIG_SGI_IP28 is not set -# CONFIG_SGI_IP32 is not set -# CONFIG_SIBYTE_BIGSUR is not set -# CONFIG_SIBYTE_CARMEL is not set -# CONFIG_SIBYTE_CRHINE is not set -# CONFIG_SIBYTE_CRHONE is not set -# CONFIG_SIBYTE_LITTLESUR is not set -# CONFIG_SIBYTE_RHONE is not set -# CONFIG_SIBYTE_SENTOSA is not set -# CONFIG_SIBYTE_SWARM is not set -CONFIG_SQUASHFS_EMBEDDED=y -CONFIG_SQUASHFS_VMALLOC=y -CONFIG_SSB=y -CONFIG_SSB_B43_PCI_BRIDGE=y -CONFIG_SSB_DRIVER_PCICORE=y -CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y -CONFIG_SSB_PCIHOST=y -CONFIG_SSB_PCIHOST_POSSIBLE=y -CONFIG_SSB_SPROM=y -CONFIG_SWAP_IO_SPACE=y -CONFIG_SYS_HAS_CPU_MIPS32_R1=y -CONFIG_SYS_HAS_EARLY_PRINTK=y -CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y -CONFIG_SYS_SUPPORTS_ARBIT_HZ=y -CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y -# CONFIG_TC35815 is not set -CONFIG_TICK_ONESHOT=y -CONFIG_TRAD_SIGNALS=y -CONFIG_USB_EHCI_BIG_ENDIAN_MMIO=y -CONFIG_USB_OHCI_BIG_ENDIAN_DESC=y -CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y -CONFIG_USB_SUPPORT=y -# CONFIG_VGASTATE is not set -# CONFIG_VIA_RHINE is not set -CONFIG_VM_EVENT_COUNTERS=y -CONFIG_WATCHDOG_NOWAYOUT=y -CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/brcm63xx/config-2.6.28 b/target/linux/brcm63xx/config-2.6.28 deleted file mode 100644 index ba4769713..000000000 --- a/target/linux/brcm63xx/config-2.6.28 +++ /dev/null @@ -1,203 +0,0 @@ -CONFIG_32BIT=y -# CONFIG_64BIT is not set -# CONFIG_8139TOO is not set -# CONFIG_ARCH_HAS_ILOG2_U32 is not set -# CONFIG_ARCH_HAS_ILOG2_U64 is not set -CONFIG_ARCH_POPULATES_NODE_MAP=y -CONFIG_ARCH_REQUIRE_GPIOLIB=y -# CONFIG_ARCH_SUPPORTS_MSI is not set -CONFIG_ARCH_SUPPORTS_OPROFILE=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_AUDIT=y -CONFIG_AUDIT_GENERIC=y -CONFIG_BASE_SMALL=0 -# CONFIG_BCM47XX is not set -CONFIG_BCM63XX=y -CONFIG_BCM63XX_CPU_6338=y -CONFIG_BCM63XX_CPU_6345=y -CONFIG_BCM63XX_CPU_6348=y -CONFIG_BCM63XX_CPU_6358=y -CONFIG_BCM63XX_ENET=y -CONFIG_BCM63XX_PHY=y -CONFIG_BCM63XX_WDT=y -CONFIG_BITREVERSE=y -CONFIG_BLK_DEV_IO_TRACE=y -CONFIG_BOARD_BCM963XX=y -# CONFIG_BOARD_LIVEBOX is not set -# CONFIG_BSD_DISKLABEL is not set -CONFIG_BSD_PROCESS_ACCT_V3=y -CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CEVT_R4K=y -CONFIG_CLASSIC_RCU=y -CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200" -CONFIG_CPU_BIG_ENDIAN=y -CONFIG_CPU_HAS_LLSC=y -CONFIG_CPU_HAS_PREFETCH=y -CONFIG_CPU_HAS_SYNC=y -# CONFIG_CPU_LITTLE_ENDIAN is not set -# CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y -CONFIG_CPU_MIPS32_R1=y -# CONFIG_CPU_MIPS32_R2 is not set -# CONFIG_CPU_MIPS64_R1 is not set -# CONFIG_CPU_MIPS64_R2 is not set -CONFIG_CPU_MIPSR1=y -# CONFIG_CPU_NEVADA is not set -# CONFIG_CPU_R10000 is not set -# CONFIG_CPU_R3000 is not set -# CONFIG_CPU_R4300 is not set -# CONFIG_CPU_R4X00 is not set -# CONFIG_CPU_R5000 is not set -# CONFIG_CPU_R5432 is not set -# CONFIG_CPU_R5500 is not set -# CONFIG_CPU_R6000 is not set -# CONFIG_CPU_R8000 is not set -# CONFIG_CPU_RM7000 is not set -# CONFIG_CPU_RM9000 is not set -# CONFIG_CPU_SB1 is not set -CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y -CONFIG_CPU_SUPPORTS_HIGHMEM=y -# CONFIG_CPU_TX39XX is not set -# CONFIG_CPU_TX49XX is not set -# CONFIG_CPU_VR41XX is not set -CONFIG_CRAMFS=y -CONFIG_CSRC_R4K=y -CONFIG_DEVPORT=y -# CONFIG_DM9000 is not set -CONFIG_DMA_NEED_PCI_MAP_STATE=y -CONFIG_DMA_NONCOHERENT=y -CONFIG_EARLY_PRINTK=y -CONFIG_ELF_CORE=y -CONFIG_FIRMWARE_IN_KERNEL=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_GENERIC_CMOS_UPDATE=y -CONFIG_GENERIC_FIND_NEXT_BIT=y -CONFIG_GENERIC_GPIO=y -# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set -CONFIG_GPIOLIB=y -CONFIG_GPIO_DEVICE=y -CONFIG_GPIO_SYSFS=y -# CONFIG_HAMRADIO is not set -CONFIG_HARDWARE_WATCHPOINTS=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT=y -CONFIG_HAVE_ARCH_KGDB=y -# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set -CONFIG_HAVE_IDE=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HW_HAS_PCI=y -CONFIG_HW_RANDOM=y -CONFIG_HZ=250 -# CONFIG_HZ_100 is not set -CONFIG_HZ_250=y -# CONFIG_I2C is not set -# CONFIG_IDE is not set -CONFIG_INITRAMFS_SOURCE="" -CONFIG_INOTIFY=y -CONFIG_INOTIFY_USER=y -CONFIG_IP_PIMSM_V1=y -CONFIG_IP_PIMSM_V2=y -CONFIG_IRQ_CPU=y -# CONFIG_ISDN is not set -CONFIG_KEXEC=y -CONFIG_LBD=y -CONFIG_LEDS_GPIO=y -# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set -# CONFIG_LEMOTE_FULONG is not set -# CONFIG_MACH_ALCHEMY is not set -# CONFIG_MACH_DECSTATION is not set -# CONFIG_MACH_EMMA is not set -# CONFIG_MACH_JAZZ is not set -# CONFIG_MACH_TX39XX is not set -# CONFIG_MACH_TX49XX is not set -# CONFIG_MACH_VR41XX is not set -CONFIG_MAGIC_SYSRQ=y -# CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y -# CONFIG_MIPS_COBALT is not set -# CONFIG_MIPS_FPU_EMU is not set -CONFIG_MIPS_L1_CACHE_SHIFT=5 -# CONFIG_MIPS_MACHINE is not set -# CONFIG_MIPS_MALTA is not set -CONFIG_MIPS_MT_DISABLED=y -# CONFIG_MIPS_MT_SMP is not set -# CONFIG_MIPS_MT_SMTC is not set -# CONFIG_MIPS_SIM is not set -CONFIG_MODULE_FORCE_LOAD=y -CONFIG_MODULE_FORCE_UNLOAD=y -CONFIG_MTD_BCM963XX=y -CONFIG_MTD_CFI_ADV_OPTIONS=y -CONFIG_MTD_CFI_BE_BYTE_SWAP=y -# CONFIG_MTD_CFI_GEOMETRY is not set -# CONFIG_MTD_CFI_NOSWAP is not set -CONFIG_MTD_CFI_STAA=y -CONFIG_MTD_CMDLINE_PARTS=y -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -CONFIG_MTD_CONCAT=y -CONFIG_MTD_JEDECPROBE=y -CONFIG_MTD_REDBOOT_PARTS=y -CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED=y -# CONFIG_NATSEMI is not set -# CONFIG_NO_IOPORT is not set -# CONFIG_NXP_STB220 is not set -# CONFIG_NXP_STB225 is not set -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PCI=y -CONFIG_PCI_DOMAINS=y -# CONFIG_PCSPKR_PLATFORM is not set -CONFIG_PHYLIB=y -# CONFIG_PMC_MSP is not set -# CONFIG_PMC_YOSEMITE is not set -# CONFIG_PNX8550_JBS is not set -# CONFIG_PNX8550_STB810 is not set -CONFIG_POSIX_MQUEUE=y -# CONFIG_PROBE_INITRD_HEADER is not set -# CONFIG_R6040 is not set -CONFIG_RELAY=y -CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y -# CONFIG_SCSI_DMA is not set -# CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_BCM63XX=y -CONFIG_SERIAL_BCM63XX_CONSOLE=y -# CONFIG_SGI_IP22 is not set -# CONFIG_SGI_IP27 is not set -# CONFIG_SGI_IP28 is not set -# CONFIG_SGI_IP32 is not set -# CONFIG_SIBYTE_BIGSUR is not set -# CONFIG_SIBYTE_CARMEL is not set -# CONFIG_SIBYTE_CRHINE is not set -# CONFIG_SIBYTE_CRHONE is not set -# CONFIG_SIBYTE_LITTLESUR is not set -# CONFIG_SIBYTE_RHONE is not set -# CONFIG_SIBYTE_SENTOSA is not set -# CONFIG_SIBYTE_SWARM is not set -CONFIG_SQUASHFS_EMBEDDED=y -CONFIG_SQUASHFS_VMALLOC=y -CONFIG_SSB=y -CONFIG_SSB_B43_PCI_BRIDGE=y -# CONFIG_SSB_DRIVER_MIPS is not set -CONFIG_SSB_DRIVER_PCICORE=y -CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y -CONFIG_SSB_PCIHOST=y -CONFIG_SSB_PCIHOST_POSSIBLE=y -CONFIG_SSB_SPROM=y -CONFIG_SWAP_IO_SPACE=y -CONFIG_SYS_HAS_CPU_MIPS32_R1=y -CONFIG_SYS_HAS_EARLY_PRINTK=y -CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y -CONFIG_SYS_SUPPORTS_ARBIT_HZ=y -CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y -# CONFIG_TC35815 is not set -CONFIG_TICK_ONESHOT=y -CONFIG_TRAD_SIGNALS=y -CONFIG_USB_EHCI_BIG_ENDIAN_MMIO=y -CONFIG_USB_OHCI_BIG_ENDIAN_DESC=y -CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y -CONFIG_USB_SUPPORT=y -# CONFIG_VGASTATE is not set -# CONFIG_VIA_RHINE is not set -CONFIG_VM_EVENT_COUNTERS=y -CONFIG_WATCHDOG_NOWAYOUT=y -CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/brcm63xx/patches-2.6.27/001-add_broadcom_63xx_cpu_definitions.patch b/target/linux/brcm63xx/patches-2.6.27/001-add_broadcom_63xx_cpu_definitions.patch deleted file mode 100644 index 163f8bea5..000000000 --- a/target/linux/brcm63xx/patches-2.6.27/001-add_broadcom_63xx_cpu_definitions.patch +++ /dev/null @@ -1,100 +0,0 @@ -From a9f65413f9ea81ef2208da66a3db9cb8a9020eef Mon Sep 17 00:00:00 2001 -From: Maxime Bizon -Date: Fri, 18 Jul 2008 15:53:08 +0200 -Subject: [PATCH] [MIPS] BCM63XX: Add Broadcom 63xx CPU definitions. - -Signed-off-by: Maxime Bizon ---- - arch/mips/kernel/cpu-probe.c | 25 +++++++++++++++++++++++++ - arch/mips/mm/tlbex.c | 4 ++++ - include/asm-mips/cpu.h | 7 +++++++ - 3 files changed, 36 insertions(+), 0 deletions(-) - ---- a/arch/mips/kernel/cpu-probe.c -+++ b/arch/mips/kernel/cpu-probe.c -@@ -153,6 +153,9 @@ void __init check_wait(void) - case CPU_25KF: - case CPU_PR4450: - case CPU_BCM3302: -+ case CPU_BCM6338: -+ case CPU_BCM6348: -+ case CPU_BCM6358: - cpu_wait = r4k_wait; - break; - -@@ -802,11 +805,28 @@ static inline void cpu_probe_broadcom(st - decode_configs(c); - switch (c->processor_id & 0xff00) { - case PRID_IMP_BCM3302: -+ /* same as PRID_IMP_BCM6338 */ - c->cputype = CPU_BCM3302; - break; - case PRID_IMP_BCM4710: - c->cputype = CPU_BCM4710; - break; -+ case PRID_IMP_BCM6345: -+ c->cputype = CPU_BCM6345; -+ break; -+ case PRID_IMP_BCM6348: -+ c->cputype = CPU_BCM6348; -+ break; -+ case PRID_IMP_BCM4350: -+ switch (c->processor_id & 0xf0) { -+ case PRID_REV_BCM6358: -+ c->cputype = CPU_BCM6358; -+ break; -+ default: -+ c->cputype = CPU_UNKNOWN; -+ break; -+ } -+ break; - default: - c->cputype = CPU_UNKNOWN; - break; -@@ -892,6 +912,10 @@ static __cpuinit const char *cpu_to_name - case CPU_SR71000: name = "Sandcraft SR71000"; break; - case CPU_BCM3302: name = "Broadcom BCM3302"; break; - case CPU_BCM4710: name = "Broadcom BCM4710"; break; -+ case CPU_BCM6338: name = "Broadcom BCM6338"; break; -+ case CPU_BCM6345: name = "Broadcom BCM6345"; break; -+ case CPU_BCM6348: name = "Broadcom BCM6348"; break; -+ case CPU_BCM6358: name = "Broadcom BCM6358"; break; - case CPU_PR4450: name = "Philips PR4450"; break; - case CPU_LOONGSON2: name = "ICT Loongson-2"; break; - default: ---- a/arch/mips/mm/tlbex.c -+++ b/arch/mips/mm/tlbex.c -@@ -317,6 +317,10 @@ static void __cpuinit build_tlb_write_en - case CPU_BCM3302: - case CPU_BCM4710: - case CPU_LOONGSON2: -+ case CPU_BCM6338: -+ case CPU_BCM6345: -+ case CPU_BCM6348: -+ case CPU_BCM6358: - if (m4kc_tlbp_war()) - uasm_i_nop(p); - tlbw(p); ---- a/include/asm-mips/cpu.h -+++ b/include/asm-mips/cpu.h -@@ -112,6 +112,12 @@ - - #define PRID_IMP_BCM4710 0x4000 - #define PRID_IMP_BCM3302 0x9000 -+#define PRID_IMP_BCM6338 0x9000 -+#define PRID_IMP_BCM6345 0x8000 -+#define PRID_IMP_BCM6348 0x9100 -+#define PRID_IMP_BCM4350 0xA000 -+#define PRID_REV_BCM6358 0x0010 -+#define PRID_REV_BCM6368 0x0030 - - /* - * Definitions for 7:0 on legacy processors -@@ -198,6 +204,7 @@ enum cpu_type_enum { - CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K, - CPU_AU1000, CPU_AU1100, CPU_AU1200, CPU_AU1210, CPU_AU1250, CPU_AU1500, - CPU_AU1550, CPU_PR4450, CPU_BCM3302, CPU_BCM4710, -+ CPU_BCM6338, CPU_BCM6345, CPU_BCM6348, CPU_BCM6358, - - /* - * MIPS64 class processors diff --git a/target/linux/brcm63xx/patches-2.6.27/002-add_support_for_broadcom_63xx_cpus.patch b/target/linux/brcm63xx/patches-2.6.27/002-add_support_for_broadcom_63xx_cpus.patch deleted file mode 100644 index af494f495..000000000 --- a/target/linux/brcm63xx/patches-2.6.27/002-add_support_for_broadcom_63xx_cpus.patch +++ /dev/null @@ -1,122 +0,0 @@ -From 0713aadd2a4e543b69022aa40bdec3e1dc5bc1e5 Mon Sep 17 00:00:00 2001 -From: Maxime Bizon -Date: Mon, 18 Aug 2008 13:56:57 +0200 -Subject: [PATCH] [MIPS] BCM63XX: Add support for Broadcom 63xx CPUs. - -Signed-off-by: Maxime Bizon ---- - arch/mips/Kconfig | 16 + - arch/mips/Makefile | 7 + - arch/mips/bcm63xx/Kconfig | 9 + - arch/mips/bcm63xx/Makefile | 2 + - arch/mips/bcm63xx/clk.c | 220 ++++++ - arch/mips/bcm63xx/cpu.c | 245 +++++++ - arch/mips/bcm63xx/cs.c | 144 ++++ - arch/mips/bcm63xx/early_printk.c | 30 + - arch/mips/bcm63xx/gpio.c | 98 +++ - arch/mips/bcm63xx/irq.c | 253 +++++++ - arch/mips/bcm63xx/prom.c | 43 ++ - arch/mips/bcm63xx/setup.c | 108 +++ - arch/mips/bcm63xx/timer.c | 205 ++++++ - include/asm-mips/fixmap.h | 4 + - include/asm-mips/mach-bcm63xx/bcm63xx_clk.h | 11 + - include/asm-mips/mach-bcm63xx/bcm63xx_cpu.h | 314 +++++++++ - include/asm-mips/mach-bcm63xx/bcm63xx_cs.h | 10 + - include/asm-mips/mach-bcm63xx/bcm63xx_gpio.h | 14 + - include/asm-mips/mach-bcm63xx/bcm63xx_io.h | 93 +++ - include/asm-mips/mach-bcm63xx/bcm63xx_irq.h | 15 + - include/asm-mips/mach-bcm63xx/bcm63xx_regs.h | 728 ++++++++++++++++++++ - include/asm-mips/mach-bcm63xx/bcm63xx_timer.h | 11 + - .../asm-mips/mach-bcm63xx/cpu-feature-overrides.h | 51 ++ - include/asm-mips/mach-bcm63xx/gpio.h | 52 ++ - include/asm-mips/mach-bcm63xx/war.h | 25 + - 25 files changed, 2708 insertions(+), 0 deletions(-) - create mode 100644 arch/mips/bcm63xx/Kconfig - create mode 100644 arch/mips/bcm63xx/Makefile - create mode 100644 arch/mips/bcm63xx/clk.c - create mode 100644 arch/mips/bcm63xx/cpu.c - create mode 100644 arch/mips/bcm63xx/cs.c - create mode 100644 arch/mips/bcm63xx/early_printk.c - create mode 100644 arch/mips/bcm63xx/gpio.c - create mode 100644 arch/mips/bcm63xx/irq.c - create mode 100644 arch/mips/bcm63xx/prom.c - create mode 100644 arch/mips/bcm63xx/setup.c - create mode 100644 arch/mips/bcm63xx/timer.c - create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_clk.h - create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_cpu.h - create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_cs.h - create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_gpio.h - create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_io.h - create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_irq.h - create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_regs.h - create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_timer.h - create mode 100644 include/asm-mips/mach-bcm63xx/cpu-feature-overrides.h - create mode 100644 include/asm-mips/mach-bcm63xx/gpio.h - create mode 100644 include/asm-mips/mach-bcm63xx/war.h - ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -59,6 +59,21 @@ config BCM47XX - help - Support for BCM47XX based boards - -+config BCM63XX -+ bool "Broadcom 63xx based boards" -+ select CEVT_R4K -+ select CSRC_R4K -+ select DMA_NONCOHERENT -+ select IRQ_CPU -+ select SYS_HAS_CPU_MIPS32_R1 -+ select SYS_SUPPORTS_32BIT_KERNEL -+ select SYS_SUPPORTS_BIG_ENDIAN -+ select SYS_HAS_EARLY_PRINTK -+ select SWAP_IO_SPACE -+ select ARCH_REQUIRE_GPIOLIB -+ help -+ Support for BCM63XX based boards -+ - config MIPS_COBALT - bool "Cobalt Server" - select CEVT_R4K -@@ -600,6 +615,7 @@ endchoice - - source "arch/mips/au1000/Kconfig" - source "arch/mips/basler/excite/Kconfig" -+source "arch/mips/bcm63xx/Kconfig" - source "arch/mips/jazz/Kconfig" - source "arch/mips/lasat/Kconfig" - source "arch/mips/pmc-sierra/Kconfig" ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -540,6 +540,13 @@ cflags-$(CONFIG_BCM47XX) += -Iinclude/as - load-$(CONFIG_BCM47XX) := 0xffffffff80001000 - - # -+# Broadcom BCM63XX boards -+# -+core-$(CONFIG_BCM63XX) += arch/mips/bcm63xx/ -+cflags-$(CONFIG_BCM63XX) += -Iinclude/asm-mips/mach-bcm63xx/ -+load-$(CONFIG_BCM63XX) := 0xffffffff80010000 -+ -+# - # SNI RM - # - core-$(CONFIG_SNI_RM) += arch/mips/sni/ ---- a/include/asm-mips/fixmap.h -+++ b/include/asm-mips/fixmap.h -@@ -67,11 +67,15 @@ enum fixed_addresses { - * the start of the fixmap, and leave one page empty - * at the top of mem.. - */ -+#ifdef CONFIG_BCM63XX -+#define FIXADDR_TOP ((unsigned long)(long)(int)0xff000000) -+#else - #if defined(CONFIG_CPU_TX39XX) || defined(CONFIG_CPU_TX49XX) - #define FIXADDR_TOP ((unsigned long)(long)(int)(0xff000000 - 0x20000)) - #else - #define FIXADDR_TOP ((unsigned long)(long)(int)0xfffe0000) - #endif -+#endif - #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) - #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) - diff --git a/target/linux/brcm63xx/patches-2.6.27/003-add_serial_driver_for_bcm63xx_integr.patch b/target/linux/brcm63xx/patches-2.6.27/003-add_serial_driver_for_bcm63xx_integr.patch deleted file mode 100644 index c998b00bf..000000000 --- a/target/linux/brcm63xx/patches-2.6.27/003-add_serial_driver_for_bcm63xx_integr.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 6c489656b09998ed6a6f857e01ccf630e29358dd Mon Sep 17 00:00:00 2001 -From: Maxime Bizon -Date: Fri, 18 Jul 2008 19:35:55 +0200 -Subject: [PATCH] [MIPS] BCM63XX: Add serial driver for bcm63xx integrated UART. - -Signed-off-by: Maxime Bizon ---- - arch/mips/bcm63xx/Makefile | 1 + - arch/mips/bcm63xx/dev-uart.c | 41 + - drivers/serial/Kconfig | 19 + - drivers/serial/Makefile | 1 + - drivers/serial/bcm63xx_uart.c | 890 ++++++++++++++++++++++ - include/asm-mips/mach-bcm63xx/bcm63xx_dev_uart.h | 6 + - include/linux/serial_core.h | 2 + - 7 files changed, 960 insertions(+), 0 deletions(-) - create mode 100644 arch/mips/bcm63xx/dev-uart.c - create mode 100644 drivers/serial/bcm63xx_uart.c - create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_dev_uart.h - ---- a/drivers/serial/Kconfig -+++ b/drivers/serial/Kconfig -@@ -1421,4 +1421,23 @@ config SPORT_BAUD_RATE - default 19200 if (SERIAL_SPORT_BAUD_RATE_19200) - default 9600 if (SERIAL_SPORT_BAUD_RATE_9600) - -+config SERIAL_BCM63XX -+ tristate "bcm63xx serial port support" -+ select SERIAL_CORE -+ depends on BCM63XX -+ help -+ If you have a bcm63xx CPU, you can enable its onboard -+ serial port by enabling this options. -+ -+ To compile this driver as a module, choose M here: the -+ module will be called bcm963xx_uart. -+ -+config SERIAL_BCM63XX_CONSOLE -+ bool "Console on bcm63xx serial port" -+ depends on SERIAL_BCM63XX -+ select SERIAL_CORE_CONSOLE -+ help -+ If you have enabled the serial port on the bcm63xx CPU -+ you can make it the console by answering Y to this option. -+ - endmenu ---- a/drivers/serial/Makefile -+++ b/drivers/serial/Makefile -@@ -24,6 +24,7 @@ obj-$(CONFIG_SERIAL_CLPS711X) += clps711 - obj-$(CONFIG_SERIAL_PXA) += pxa.o - obj-$(CONFIG_SERIAL_PNX8XXX) += pnx8xxx_uart.o - obj-$(CONFIG_SERIAL_SA1100) += sa1100.o -+obj-$(CONFIG_SERIAL_BCM63XX) += bcm63xx_uart.o - obj-$(CONFIG_SERIAL_BFIN) += bfin_5xx.o - obj-$(CONFIG_SERIAL_BFIN_SPORT) += bfin_sport_uart.o - obj-$(CONFIG_SERIAL_SAMSUNG) += samsung.o ---- a/include/linux/serial_core.h -+++ b/include/linux/serial_core.h -@@ -155,6 +155,8 @@ - - #define PORT_SC26XX 82 - -+#define PORT_BCM63XX 83 -+ - #ifdef __KERNEL__ - - #include diff --git a/target/linux/brcm63xx/patches-2.6.27/004_add_pci_support.patch b/target/linux/brcm63xx/patches-2.6.27/004_add_pci_support.patch deleted file mode 100644 index 47390f30a..000000000 --- a/target/linux/brcm63xx/patches-2.6.27/004_add_pci_support.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 2a7fa2dbbf68650644f807a50cc2d84ca30835c1 Mon Sep 17 00:00:00 2001 -From: Maxime Bizon -Date: Sun, 21 Sep 2008 04:47:13 +0200 -Subject: [PATCH] [MIPS] BCM63XX: Add PCI support. - -Signed-off-by: Maxime Bizon ---- - arch/mips/bcm63xx/Kconfig | 2 + - arch/mips/bcm63xx/setup.c | 2 + - arch/mips/pci/Makefile | 2 + - arch/mips/pci/fixup-bcm63xx.c | 21 +++ - arch/mips/pci/ops-bcm63xx.c | 179 +++++++++++++++++++++++ - arch/mips/pci/pci-bcm63xx.c | 178 ++++++++++++++++++++++ - arch/mips/pci/pci-bcm63xx.h | 27 ++++ - include/asm-mips/mach-bcm63xx/bcm63xx_dev_pci.h | 6 + - 8 files changed, 417 insertions(+), 0 deletions(-) - create mode 100644 arch/mips/pci/fixup-bcm63xx.c - create mode 100644 arch/mips/pci/ops-bcm63xx.c - create mode 100644 arch/mips/pci/pci-bcm63xx.c - create mode 100644 arch/mips/pci/pci-bcm63xx.h - create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_dev_pci.h - ---- a/arch/mips/pci/Makefile -+++ b/arch/mips/pci/Makefile -@@ -16,6 +16,8 @@ obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o - obj-$(CONFIG_MARKEINS) += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o - obj-$(CONFIG_PCI_TX4927) += ops-tx4927.o - obj-$(CONFIG_BCM47XX) += pci-bcm47xx.o -+obj-$(CONFIG_BCM63XX) += pci-bcm63xx.o fixup-bcm63xx.o \ -+ ops-bcm63xx.o - - # - # These are still pretty much in the old state, watch, go blind. diff --git a/target/linux/brcm63xx/patches-2.6.27/006-pcmcia_cardbus_support.patch b/target/linux/brcm63xx/patches-2.6.27/006-pcmcia_cardbus_support.patch deleted file mode 100644 index 5812912c0..000000000 --- a/target/linux/brcm63xx/patches-2.6.27/006-pcmcia_cardbus_support.patch +++ /dev/null @@ -1,43 +0,0 @@ -From b17597be763621ba63534fda6e1ea0a802be2087 Mon Sep 17 00:00:00 2001 -From: Maxime Bizon -Date: Fri, 18 Jul 2008 21:18:51 +0200 -Subject: [PATCH] [MIPS] BCM63XX: Add PCMCIA & Cardbus support. - -Signed-off-by: Maxime Bizon ---- - arch/mips/bcm63xx/Makefile | 1 + - arch/mips/bcm63xx/dev-pcmcia.c | 135 +++++ - drivers/pcmcia/Kconfig | 4 + - drivers/pcmcia/Makefile | 1 + - drivers/pcmcia/bcm63xx_pcmcia.c | 521 ++++++++++++++++++++ - drivers/pcmcia/bcm63xx_pcmcia.h | 65 +++ - include/asm-mips/mach-bcm63xx/bcm63xx_dev_pcmcia.h | 13 + - 7 files changed, 740 insertions(+), 0 deletions(-) - create mode 100644 arch/mips/bcm63xx/dev-pcmcia.c - create mode 100644 drivers/pcmcia/bcm63xx_pcmcia.c - create mode 100644 drivers/pcmcia/bcm63xx_pcmcia.h - create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_dev_pcmcia.h - ---- a/drivers/pcmcia/Kconfig -+++ b/drivers/pcmcia/Kconfig -@@ -196,6 +196,10 @@ config PCMCIA_AU1X00 - tristate "Au1x00 pcmcia support" - depends on SOC_AU1X00 && PCMCIA - -+config PCMCIA_BCM63XX -+ tristate "bcm63xx pcmcia support" -+ depends on BCM63XX && PCMCIA -+ - config PCMCIA_SA1100 - tristate "SA1100 support" - depends on ARM && ARCH_SA1100 && PCMCIA ---- a/drivers/pcmcia/Makefile -+++ b/drivers/pcmcia/Makefile -@@ -33,6 +33,7 @@ obj-$(CONFIG_PCMCIA_PXA2XX) - obj-$(CONFIG_M32R_PCC) += m32r_pcc.o - obj-$(CONFIG_M32R_CFC) += m32r_cfc.o - obj-$(CONFIG_PCMCIA_AU1X00) += au1x00_ss.o -+obj-$(CONFIG_PCMCIA_BCM63XX) += bcm63xx_pcmcia.o - obj-$(CONFIG_PCMCIA_VRC4171) += vrc4171_card.o - obj-$(CONFIG_PCMCIA_VRC4173) += vrc4173_cardu.o - obj-$(CONFIG_OMAP_CF) += omap_cf.o diff --git a/target/linux/brcm63xx/patches-2.6.27/007-usb_ohci_support.patch b/target/linux/brcm63xx/patches-2.6.27/007-usb_ohci_support.patch deleted file mode 100644 index e41d1c5f3..000000000 --- a/target/linux/brcm63xx/patches-2.6.27/007-usb_ohci_support.patch +++ /dev/null @@ -1,56 +0,0 @@ -From f7416412febd7efc1d33c7506c81265719368667 Mon Sep 17 00:00:00 2001 -From: Maxime Bizon -Date: Mon, 21 Jul 2008 14:58:19 +0200 -Subject: [PATCH] [MIPS] BCM63XX: Add USB OHCI support. - -Signed-off-by: Maxime Bizon ---- - arch/mips/bcm63xx/Kconfig | 6 + - arch/mips/bcm63xx/Makefile | 1 + - arch/mips/bcm63xx/dev-usb-ohci.c | 50 ++++++ - drivers/usb/host/ohci-bcm63xx.c | 159 ++++++++++++++++++++ - drivers/usb/host/ohci-hcd.c | 5 + - drivers/usb/host/ohci.h | 7 +- - .../asm-mips/mach-bcm63xx/bcm63xx_dev_usb_ohci.h | 6 + - 7 files changed, 233 insertions(+), 1 deletions(-) - create mode 100644 arch/mips/bcm63xx/dev-usb-ohci.c - create mode 100644 drivers/usb/host/ohci-bcm63xx.c - create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_dev_usb_ohci.h - ---- a/drivers/usb/host/ohci-hcd.c -+++ b/drivers/usb/host/ohci-hcd.c -@@ -1050,6 +1050,11 @@ MODULE_LICENSE ("GPL"); - #define PLATFORM_DRIVER usb_hcd_pnx4008_driver - #endif - -+#ifdef CONFIG_BCM63XX -+#include "ohci-bcm63xx.c" -+#define PLATFORM_DRIVER ohci_hcd_bcm63xx_driver -+#endif -+ - #if defined(CONFIG_CPU_SUBTYPE_SH7720) || \ - defined(CONFIG_CPU_SUBTYPE_SH7721) || \ - defined(CONFIG_CPU_SUBTYPE_SH7763) ---- a/drivers/usb/host/ohci.h -+++ b/drivers/usb/host/ohci.h -@@ -549,6 +549,11 @@ static inline struct usb_hcd *ohci_to_hc - #define writel_be(val, addr) out_be32((__force unsigned *)addr, val) - #endif - -+#if defined(CONFIG_MIPS) && defined(CONFIG_BCM63XX) -+#define readl_be(addr) __raw_readl((__force unsigned *)addr) -+#define writel_be(val, addr) __raw_writel(val, (__force unsigned *)addr) -+#endif -+ - static inline unsigned int _ohci_readl (const struct ohci_hcd *ohci, - __hc32 __iomem * regs) - { -@@ -654,7 +659,7 @@ static inline u32 hc32_to_cpup (const st - * some big-endian SOC implementations. Same thing happens with PSW access. - */ - --#ifdef CONFIG_PPC_MPC52xx -+#if defined(CONFIG_PPC_MPC52xx) || defined(CONFIG_BCM63XX) - #define big_endian_frame_no_quirk(ohci) (ohci->flags & OHCI_QUIRK_FRAME_NO) - #else - #define big_endian_frame_no_quirk(ohci) 0 diff --git a/target/linux/brcm63xx/patches-2.6.27/008-usb_ehci_support.patch b/target/linux/brcm63xx/patches-2.6.27/008-usb_ehci_support.patch deleted file mode 100644 index b656a2cb9..000000000 --- a/target/linux/brcm63xx/patches-2.6.27/008-usb_ehci_support.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 2940d1996c86c4c4dd7a82214f846d0c0b707165 Mon Sep 17 00:00:00 2001 -From: Maxime Bizon -Date: Mon, 21 Jul 2008 18:24:42 +0200 -Subject: [PATCH] [MIPS] BCM63XX: Add USB EHCI support. - -Signed-off-by: Maxime Bizon ---- - arch/mips/bcm63xx/Kconfig | 2 + - arch/mips/bcm63xx/Makefile | 1 + - arch/mips/bcm63xx/dev-usb-ehci.c | 50 +++++++ - drivers/usb/host/ehci-bcm63xx.c | 152 ++++++++++++++++++++ - drivers/usb/host/ehci-hcd.c | 5 + - drivers/usb/host/ehci.h | 5 + - .../asm-mips/mach-bcm63xx/bcm63xx_dev_usb_ehci.h | 6 + - 7 files changed, 221 insertions(+), 0 deletions(-) - create mode 100644 arch/mips/bcm63xx/dev-usb-ehci.c - create mode 100644 drivers/usb/host/ehci-bcm63xx.c - create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_dev_usb_ehci.h - ---- a/drivers/usb/host/ehci-hcd.c -+++ b/drivers/usb/host/ehci-hcd.c -@@ -1041,6 +1041,11 @@ MODULE_LICENSE ("GPL"); - #define PLATFORM_DRIVER ixp4xx_ehci_driver - #endif - -+#ifdef CONFIG_BCM63XX -+#include "ehci-bcm63xx.c" -+#define PLATFORM_DRIVER ehci_hcd_bcm63xx_driver -+#endif -+ - #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \ - !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER) - #error "missing bus glue for ehci-hcd" ---- a/drivers/usb/host/ehci.h -+++ b/drivers/usb/host/ehci.h -@@ -764,6 +764,11 @@ ehci_port_speed(struct ehci_hcd *ehci, u - #define writel_be(val, addr) __raw_writel(val, (__force unsigned *)addr) - #endif - -+#if defined(CONFIG_MIPS) && defined(CONFIG_BCM63XX) -+#define readl_be(addr) __raw_readl((__force unsigned *)addr) -+#define writel_be(val, addr) __raw_writel(val, (__force unsigned *)addr) -+#endif -+ - static inline unsigned int ehci_readl(const struct ehci_hcd *ehci, - __u32 __iomem * regs) - { ---- a/drivers/usb/host/Kconfig -+++ b/drivers/usb/host/Kconfig -@@ -44,7 +44,7 @@ config USB_EHCI_HCD - - config USB_EHCI_ROOT_HUB_TT - bool "Root Hub Transaction Translators" -- depends on USB_EHCI_HCD -+ depends on USB_EHCI_HCD && !BCM63XX - ---help--- - Some EHCI chips have vendor-specific extensions to integrate - transaction translators, so that no OHCI or UHCI companion diff --git a/target/linux/brcm63xx/patches-2.6.27/009-add_integrated_ethernet_mac_support.patch b/target/linux/brcm63xx/patches-2.6.27/009-add_integrated_ethernet_mac_support.patch deleted file mode 100644 index fcb045bcb..000000000 --- a/target/linux/brcm63xx/patches-2.6.27/009-add_integrated_ethernet_mac_support.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 49aa7ffcd9bd2d9a0af99fced7b8511160dbf345 Mon Sep 17 00:00:00 2001 -From: Maxime Bizon -Date: Sun, 21 Sep 2008 03:43:26 +0200 -Subject: [PATCH] [MIPS] BCM63XX: Add integrated ethernet mac support. - -Signed-off-by: Maxime Bizon ---- - arch/mips/bcm63xx/Makefile | 1 + - arch/mips/bcm63xx/dev-enet.c | 158 ++ - drivers/net/Kconfig | 9 + - drivers/net/Makefile | 1 + - drivers/net/bcm63xx_enet.c | 1894 ++++++++++++++++++++++ - drivers/net/bcm63xx_enet.h | 294 ++++ - include/asm-mips/mach-bcm63xx/bcm63xx_dev_enet.h | 45 + - 7 files changed, 2402 insertions(+), 0 deletions(-) - create mode 100644 arch/mips/bcm63xx/dev-enet.c - create mode 100644 drivers/net/bcm63xx_enet.c - create mode 100644 drivers/net/bcm63xx_enet.h - create mode 100644 include/asm-mips/mach-bcm63xx/bcm63xx_dev_enet.h - ---- a/drivers/net/Kconfig -+++ b/drivers/net/Kconfig -@@ -1963,6 +1963,15 @@ config NE_H8300 - Say Y here if you want to use the NE2000 compatible - controller on the Renesas H8/300 processor. - -+config BCM63XX_ENET -+ tristate "Broadcom 63xx internal mac support" -+ depends on BCM63XX -+ select MII -+ select PHYLIB -+ help -+ This driver supports the ethernet MACs in the Broadcom 63xx -+ MIPS chipset family (BCM63XX). -+ - source "drivers/net/fs_enet/Kconfig" - - endif # NET_ETHERNET ---- a/drivers/net/Makefile -+++ b/drivers/net/Makefile -@@ -123,6 +123,7 @@ obj-$(CONFIG_SB1250_MAC) += sb1250-mac.o - obj-$(CONFIG_B44) += b44.o - obj-$(CONFIG_FORCEDETH) += forcedeth.o - obj-$(CONFIG_NE_H8300) += ne-h8300.o -+obj-$(CONFIG_BCM63XX_ENET) += bcm63xx_enet.o - obj-$(CONFIG_AX88796) += ax88796.o - - obj-$(CONFIG_TSI108_ETH) += tsi108_eth.o diff --git a/target/linux/brcm63xx/patches-2.6.27/010-add_integrated_ethernet_phy_support.patch b/target/linux/brcm63xx/patches-2.6.27/010-add_integrated_ethernet_phy_support.patch deleted file mode 100644 index b2eace1c5..000000000 --- a/target/linux/brcm63xx/patches-2.6.27/010-add_integrated_ethernet_phy_support.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 7eefcb968019804e024c8243e28afb1eebd674a2 Mon Sep 17 00:00:00 2001 -From: Maxime Bizon -Date: Sun, 21 Sep 2008 02:20:53 +0200 -Subject: [PATCH] [MIPS] BCM63XX: Add integrated ethernet PHY support for phylib. - -Signed-off-by: Maxime Bizon ---- - drivers/net/phy/Kconfig | 6 ++ - drivers/net/phy/Makefile | 1 + - drivers/net/phy/bcm63xx.c | 132 +++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 139 insertions(+), 0 deletions(-) - create mode 100644 drivers/net/phy/bcm63xx.c - ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -62,6 +62,12 @@ config BROADCOM_PHY - Currently supports the BCM5411, BCM5421, BCM5461, BCM5464, BCM5481 - and BCM5482 PHYs. - -+config BCM63XX_PHY -+ tristate "Drivers for Broadcom 63xx SOCs internal PHY" -+ depends on BCM63XX -+ ---help--- -+ Currently supports the 6348 and 6358 PHYs. -+ - config ICPLUS_PHY - tristate "Drivers for ICPlus PHYs" - ---help--- ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -12,6 +12,7 @@ obj-$(CONFIG_QSEMI_PHY) += qsemi.o - obj-$(CONFIG_SMSC_PHY) += smsc.o - obj-$(CONFIG_VITESSE_PHY) += vitesse.o - obj-$(CONFIG_BROADCOM_PHY) += broadcom.o -+obj-$(CONFIG_BCM63XX_PHY) += bcm63xx.o - obj-$(CONFIG_ICPLUS_PHY) += icplus.o - obj-$(CONFIG_ADM6996_PHY) += adm6996.o - obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o diff --git a/target/linux/brcm63xx/patches-2.6.27/020-watchdog.patch b/target/linux/brcm63xx/patches-2.6.27/020-watchdog.patch deleted file mode 100644 index 0df588263..000000000 --- a/target/linux/brcm63xx/patches-2.6.27/020-watchdog.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/drivers/watchdog/Makefile -+++ b/drivers/watchdog/Makefile -@@ -102,6 +102,7 @@ obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o - obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o - obj-$(CONFIG_AR7_WDT) += ar7_wdt.o - obj-$(CONFIG_TXX9_WDT) += txx9wdt.o -+obj-$(CONFIG_BCM63XX_WDT) += bcm63xx_wdt.o - - # PARISC Architecture - ---- a/drivers/watchdog/Kconfig -+++ b/drivers/watchdog/Kconfig -@@ -704,6 +704,16 @@ config TXX9_WDT - help - Hardware driver for the built-in watchdog timer on TXx9 MIPS SoCs. - -+config BCM63XX_WDT -+ tristate "Broadcom BCM63xx hardware watchdog" -+ depends on BCM63XX -+ help -+ Watchdog driver for the built in watchdog hardware in Broadcom -+ BCM63xx SoC. -+ -+ To compile thi driver as a loadable module, choose M here. -+ The module will be called bcm63xx_wdt. -+ - # PARISC Architecture - - # POWERPC Architecture diff --git a/target/linux/brcm63xx/patches-2.6.27/040-bcm963xx_flashmap.patch b/target/linux/brcm63xx/patches-2.6.27/040-bcm963xx_flashmap.patch deleted file mode 100644 index 7c7fd9458..000000000 --- a/target/linux/brcm63xx/patches-2.6.27/040-bcm963xx_flashmap.patch +++ /dev/null @@ -1,73 +0,0 @@ -From e734ace5baa04e0e8af1d4483475fbd6bd2b32a1 Mon Sep 17 00:00:00 2001 -From: Axel Gembe -Date: Mon, 12 May 2008 18:54:09 +0200 -Subject: [PATCH] bcm963xx: flashmap support - - -Signed-off-by: Axel Gembe ---- - drivers/mtd/maps/Kconfig | 7 +++++++ - drivers/mtd/maps/Makefile | 1 + - drivers/mtd/redboot.c | 13 ++++++++++--- - 3 files changed, 18 insertions(+), 3 deletions(-) - ---- a/drivers/mtd/maps/Kconfig -+++ b/drivers/mtd/maps/Kconfig -@@ -257,6 +257,13 @@ config MTD_ALCHEMY - help - Flash memory access on AMD Alchemy Pb/Db/RDK Reference Boards - -+config MTD_BCM963XX -+ tristate "BCM963xx Flash device" -+ depends on MIPS && BCM63XX -+ help -+ Flash memory access on BCM963xx boards. Currently only works with -+ RedBoot and CFE. -+ - config MTD_DILNETPC - tristate "CFI Flash device mapped on DIL/Net PC" - depends on X86 && MTD_CONCAT && MTD_PARTITIONS && MTD_CFI_INTELEXT ---- a/drivers/mtd/redboot.c -+++ b/drivers/mtd/redboot.c -@@ -39,7 +39,7 @@ static inline int redboot_checksum(struc - return 1; - } - --static int parse_redboot_partitions(struct mtd_info *master, -+int parse_redboot_partitions(struct mtd_info *master, - struct mtd_partition **pparts, - unsigned long fis_origin) - { -@@ -162,6 +162,14 @@ static int parse_redboot_partitions(stru - goto out; - } - -+ if (!fis_origin) { -+ for (i = 0; i < numslots; i++) { -+ if (!strncmp(buf[i].name, "RedBoot", 8)) { -+ fis_origin = (buf[i].flash_base & (master->size << 1) - 1); -+ } -+ } -+ } -+ - for (i = 0; i < numslots; i++) { - struct fis_list *new_fl, **prev; - -@@ -184,9 +192,8 @@ static int parse_redboot_partitions(stru - new_fl->img = &buf[i]; - if (fis_origin) { - buf[i].flash_base -= fis_origin; -- } else { -- buf[i].flash_base &= master->size-1; - } -+ buf[i].flash_base &= (master->size << 1) - 1; - - /* I'm sure the JFFS2 code has done me permanent damage. - * I now think the following is _normal_ ---- a/drivers/mtd/maps/Makefile -+++ b/drivers/mtd/maps/Makefile -@@ -65,3 +65,4 @@ obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o - obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o - obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_vr_nor.o - obj-$(CONFIG_MTD_BFIN_ASYNC) += bfin-async-flash.o -+obj-$(CONFIG_MTD_BCM963XX) += bcm963xx-flash.o diff --git a/target/linux/brcm63xx/patches-2.6.27/050-spi.patch b/target/linux/brcm63xx/patches-2.6.27/050-spi.patch deleted file mode 100644 index fe3c430f1..000000000 --- a/target/linux/brcm63xx/patches-2.6.27/050-spi.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/drivers/spi/Kconfig -+++ b/drivers/spi/Kconfig -@@ -217,6 +217,13 @@ config SPI_XILINX - See the "OPB Serial Peripheral Interface (SPI) (v1.00e)" - Product Specification document (DS464) for hardware details. - -+config SPI_BCM63XX -+ tristate "Broadcom BCM63xx SPI controller" -+ depends on BCM63XX -+ select SPI_BITBANG -+ help -+ SPI driver for the Broadcom BCM63xx SPI controller. -+ - # - # Add new SPI master controllers in alphabetical order above this line - # ---- a/drivers/spi/Makefile -+++ b/drivers/spi/Makefile -@@ -30,6 +30,7 @@ obj-$(CONFIG_SPI_S3C24XX) += spi_s3c24x - obj-$(CONFIG_SPI_TXX9) += spi_txx9.o - obj-$(CONFIG_SPI_XILINX) += xilinx_spi.o - obj-$(CONFIG_SPI_SH_SCI) += spi_sh_sci.o -+obj-$(CONFIG_SPI_BCM63XX) += bcm63xx_spi.o - # ... add above this line ... - - # SPI protocol drivers (device/link on bus) diff --git a/target/linux/brcm63xx/patches-2.6.27/500-lzma_initramfs.patch b/target/linux/brcm63xx/patches-2.6.27/500-lzma_initramfs.patch deleted file mode 100644 index ad30e9436..000000000 --- a/target/linux/brcm63xx/patches-2.6.27/500-lzma_initramfs.patch +++ /dev/null @@ -1,125 +0,0 @@ ---- a/init/initramfs.c -+++ b/init/initramfs.c -@@ -6,6 +6,7 @@ - #include - #include - #include -+#include - - static __initdata char *message; - static void __init error(char *x) -@@ -423,6 +424,69 @@ static void __init flush_window(void) - outcnt = 0; - } - -+#include -+static int __init lzma_unzip(void) -+{ -+ unsigned int i; /* temp value */ -+ unsigned int lc; /* literal context bits */ -+ unsigned int lp; /* literal pos state bits */ -+ unsigned int pb; /* pos state bits */ -+ unsigned int osize; /* uncompressed size */ -+ unsigned char *workspace; -+ unsigned char* outputbuffer; -+ unsigned int outsizeProcessed = 0; -+ int workspace_size; -+ int res; -+ -+ // lzma args -+ i = get_byte(); -+ lc = i % 9, i = i / 9; -+ lp = i % 5, pb = i / 5; -+ -+ // skip dictionary size -+ for (i = 0; i < 4; i++) -+ get_byte(); -+ -+ /* read the lower half of uncompressed size in the header */ -+ osize = ((unsigned int)get_byte()) + -+ ((unsigned int)get_byte() << 8) + -+ ((unsigned int)get_byte() << 16) + -+ ((unsigned int)get_byte() << 24); -+ -+ /* skip rest of the header (upper half of uncompressed size) */ -+ for (i = 0; i < 4; i++) -+ get_byte(); -+ -+ workspace_size = ((LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp))) * sizeof(CProb)) + 100; -+ printk( KERN_NOTICE "initramfs: LZMA lc=%d,lp=%d,pb=%d,origSize=%d\n", -+ lc,lp,pb,osize); -+ outputbuffer = vmalloc(osize); -+ if (outputbuffer == 0) { -+ printk(KERN_ERR "initramfs: Couldn't allocate lzma output buffer\n"); -+ return -1; -+ } -+ -+ workspace = vmalloc(workspace_size); -+ if (workspace == NULL) { -+ printk(KERN_ERR "initramfs: Couldn't allocate lzma workspace\n"); -+ return -1; -+ } -+ -+ res = LzmaDecode(workspace, workspace_size, lc, lp, pb, inbuf + inptr, insize - inptr, outputbuffer, osize, &outsizeProcessed); -+ if( res != 0 ) { -+ panic( KERN_ERR "initramfs: Lzma decode failure\n"); -+ return -1; -+ } -+ -+ flush_buffer(outputbuffer, outsizeProcessed); -+ inptr = insize; -+ -+ vfree(outputbuffer); -+ vfree(workspace); -+ state = Reset; -+ return 0; -+} -+ - static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only) - { - int written; -@@ -457,12 +521,28 @@ static char * __init unpack_to_rootfs(ch - inptr = 0; - outcnt = 0; /* bytes in output buffer */ - bytes_out = 0; -- crc = (ulg)0xffffffffL; /* shift register contents */ -- makecrc(); -- gunzip(); -- if (state != Reset) -+ if( inbuf[0] == 037 && ((inbuf[1] == 0213) || (inbuf[1] == 0236))) -+ { -+ printk( KERN_NOTICE "detected gzip initramfs\n"); -+ crc = (ulg)0xffffffffL; /* shift register contents */ -+ makecrc(); -+ gunzip(); -+ if (state != Reset) - error("junk in gzipped archive"); -- this_header = saved_offset + inptr; -+ } -+ else if(!memcmp(inbuf+1, "\x00\x00\x80\x00", 4)) /* FIXME: hardcoded dictionary size */ -+ { -+ printk( KERN_NOTICE "detected lzma initramfs\n"); -+ lzma_unzip(); -+ } -+ else -+ { -+ // skip forward ? -+ crc = (ulg)0xffffffffL; /* shift register contents */ -+ makecrc(); -+ gunzip(); -+ } -+ this_header = saved_offset + inptr; - buf += inptr; - len -= inptr; - } ---- a/scripts/gen_initramfs_list.sh -+++ b/scripts/gen_initramfs_list.sh -@@ -287,7 +287,7 @@ if [ ! -z ${output_file} ]; then - if [ "${is_cpio_compressed}" = "compressed" ]; then - cat ${cpio_tfile} > ${output_file} - else -- cat ${cpio_tfile} | gzip -f -9 - > ${output_file} -+ lzma e -lc1 -lp2 -pb2 ${cpio_tfile} ${output_file} - fi - [ -z ${cpio_file} ] && rm ${cpio_tfile} - fi diff --git a/target/linux/olpc/config-2.6.27 b/target/linux/olpc/config-2.6.27 deleted file mode 100644 index c3ad33aef..000000000 --- a/target/linux/olpc/config-2.6.27 +++ /dev/null @@ -1,587 +0,0 @@ -CONFIG_4KSTACKS=y -# CONFIG_64BIT is not set -CONFIG_ACPI=y -CONFIG_ACPI_AC=y -# CONFIG_ACPI_ASUS is not set -CONFIG_ACPI_BATTERY=y -CONFIG_ACPI_BLACKLIST_YEAR=0 -CONFIG_ACPI_BUTTON=y -# CONFIG_ACPI_CONTAINER is not set -# CONFIG_ACPI_CUSTOM_DSDT is not set -# CONFIG_ACPI_DEBUG is not set -# CONFIG_ACPI_DOCK is not set -CONFIG_ACPI_EC=y -CONFIG_ACPI_FAN=y -# CONFIG_ACPI_PCI_SLOT is not set -CONFIG_ACPI_POWER=y -CONFIG_ACPI_PROCESSOR=y -# CONFIG_ACPI_PROCFS is not set -CONFIG_ACPI_PROCFS_POWER=y -CONFIG_ACPI_PROC_EVENT=y -# CONFIG_ACPI_SBS is not set -CONFIG_ACPI_SLEEP=y -CONFIG_ACPI_SYSFS_POWER=y -CONFIG_ACPI_SYSTEM=y -CONFIG_ACPI_THERMAL=y -# CONFIG_ACPI_TOSHIBA is not set -# CONFIG_ACPI_WMI is not set -# CONFIG_AGP is not set -# CONFIG_AIRO is not set -# CONFIG_APM is not set -CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" -CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y -CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y -CONFIG_ARCH_HAS_CPU_RELAX=y -# CONFIG_ARCH_HAS_ILOG2_U32 is not set -# CONFIG_ARCH_HAS_ILOG2_U64 is not set -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_MAY_HAVE_PC_FDC=y -CONFIG_ARCH_POPULATES_NODE_MAP=y -CONFIG_ARCH_SELECT_MEMORY_MODEL=y -CONFIG_ARCH_SPARSEMEM_ENABLE=y -CONFIG_ARCH_SUPPORTS_AOUT=y -CONFIG_ARCH_SUPPORTS_MSI=y -CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y -# CONFIG_ATM is not set -# CONFIG_ATMEL is not set -# CONFIG_AUDIT_ARCH is not set -CONFIG_BACKLIGHT_CLASS_DEVICE=y -# CONFIG_BACKLIGHT_CORGI is not set -CONFIG_BACKLIGHT_LCD_SUPPORT=y -# CONFIG_BACKLIGHT_MBP_NVIDIA is not set -# CONFIG_BACKLIGHT_PROGEAR is not set -# CONFIG_BACKTRACE_SELF_TEST is not set -CONFIG_BASE_SMALL=0 -CONFIG_BATTERY_OLPC=y -# CONFIG_BINFMT_AOUT is not set -CONFIG_BINFMT_MISC=y -CONFIG_BITREVERSE=y -# CONFIG_BLK_DEV is not set -CONFIG_BLK_DEV_SD=y -CONFIG_BLK_DEV_SR=y -CONFIG_BLK_DEV_SR_VENDOR=y -# CONFIG_BONDING is not set -# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set -CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 -# CONFIG_BOOT_PRINTK_DELAY is not set -CONFIG_BOUNCE=y -CONFIG_CAN_PM_TRACE=y -CONFIG_CHR_DEV_SG=y -CONFIG_CLASSIC_RCU=y -CONFIG_CLOCKSOURCE_WATCHDOG=y -CONFIG_COMPAT_VDSO=y -CONFIG_CONSOLE_TRANSLATIONS=y -# CONFIG_CPA_DEBUG is not set -CONFIG_CPU_FREQ=y -# CONFIG_CPU_FREQ_DEBUG is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set -# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set -# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_STAT=y -# CONFIG_CPU_FREQ_STAT_DETAILS is not set -CONFIG_CPU_FREQ_TABLE=y -# CONFIG_CPU_IDLE is not set -# CONFIG_CRC_ITU_T is not set -# CONFIG_CS5535_GPIO is not set -# CONFIG_DCDBAS is not set -# CONFIG_DEBUG_BOOT_PARAMS is not set -# CONFIG_DEBUG_BUGVERBOSE is not set -# CONFIG_DEBUG_DEVRES is not set -# CONFIG_DEBUG_DRIVER is not set -# CONFIG_DEBUG_INFO is not set -CONFIG_DEBUG_KERNEL=y -# CONFIG_DEBUG_KOBJECT is not set -# CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set -# CONFIG_DEBUG_LOCK_ALLOC is not set -# CONFIG_DEBUG_MUTEXES is not set -# CONFIG_DEBUG_NX_TEST is not set -# CONFIG_DEBUG_OBJECTS is not set -# CONFIG_DEBUG_PAGEALLOC is not set -# CONFIG_DEBUG_RODATA is not set -# CONFIG_DEBUG_RT_MUTEXES is not set -# CONFIG_DEBUG_SG is not set -# CONFIG_DEBUG_SHIRQ is not set -# CONFIG_DEBUG_SLAB is not set -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_SPINLOCK_SLEEP is not set -# CONFIG_DEBUG_STACKOVERFLOW is not set -# CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_DEBUG_VM is not set -# CONFIG_DEBUG_WRITECOUNT is not set -CONFIG_DEFAULT_IO_DELAY_TYPE=0 -# CONFIG_DELL_RBU is not set -CONFIG_DETECT_SOFTLOCKUP=y -CONFIG_DEVPORT=y -CONFIG_DISPLAY_SUPPORT=y -CONFIG_DMI=y -CONFIG_DMIID=y -CONFIG_DOUBLEFAULT=y -CONFIG_DUMMY_CONSOLE=y -CONFIG_EARLY_PRINTK=y -# CONFIG_EDAC is not set -# CONFIG_EDD is not set -# CONFIG_EFI is not set -CONFIG_ELF_CORE=y -CONFIG_EXT2_FS=y -# CONFIG_EXT3_FS is not set -CONFIG_FAST_CMPXCHG_LOCAL=y -# CONFIG_FAULT_INJECTION is not set -CONFIG_FB=y -CONFIG_FB_CFB_COPYAREA=y -CONFIG_FB_CFB_FILLRECT=y -CONFIG_FB_CFB_IMAGEBLIT=y -CONFIG_FB_GEODE=y -# CONFIG_FB_GEODE_GX is not set -# CONFIG_FB_GEODE_GX1 is not set -CONFIG_FB_GEODE_LX=y -# CONFIG_FIRMWARE_EDID is not set -# CONFIG_FIRMWARE_MEMMAP is not set -CONFIG_FIX_EARLYCON_MEM=y -# CONFIG_FONTS is not set -CONFIG_FONT_8x16=y -CONFIG_FONT_8x8=y -CONFIG_FRAMEBUFFER_CONSOLE=y -CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y -CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y -# CONFIG_FRAME_POINTER is not set -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_GENERIC_CMOS_UPDATE=y -# CONFIG_GENERIC_CPU is not set -CONFIG_GENERIC_FIND_FIRST_BIT=y -CONFIG_GENERIC_FIND_NEXT_BIT=y -# CONFIG_GENERIC_GPIO is not set -CONFIG_GENERIC_IOMAP=y -CONFIG_GENERIC_ISA_DMA=y -# CONFIG_GENERIC_LOCKBREAK is not set -# CONFIG_GENERIC_TIME_VSYSCALL is not set -CONFIG_GEODE_MFGPT_TIMER=y -# CONFIG_HAMRADIO is not set -# CONFIG_HANGCHECK_TIMER is not set -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT=y -CONFIG_HAVE_ARCH_KGDB=y -# CONFIG_HAVE_ARCH_TRACEHOOK is not set -# CONFIG_HAVE_CLK is not set -# CONFIG_HAVE_CPUMASK_OF_CPU_MAP is not set -# CONFIG_HAVE_DMA_ATTRS is not set -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_HAVE_FTRACE=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_HAVE_IDE=y -CONFIG_HAVE_IOREMAP_PROT=y -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_KVM=y -CONFIG_HAVE_LATENCYTOP_SUPPORT=y -CONFIG_HAVE_OPROFILE=y -# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set -CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y -# CONFIG_HERMES is not set -# CONFIG_HFSPLUS_FS is not set -# CONFIG_HFS_FS is not set -CONFIG_HIBERNATION=y -CONFIG_HID=y -CONFIG_HID_SUPPORT=y -# CONFIG_HIGHMEM4G is not set -# CONFIG_HIGHMEM64G is not set -# CONFIG_HPET is not set -CONFIG_HPET_EMULATE_RTC=y -CONFIG_HPET_TIMER=y -CONFIG_HT_IRQ=y -# CONFIG_HUGETLBFS is not set -CONFIG_HW_CONSOLE=y -CONFIG_HW_RANDOM=y -# CONFIG_HW_RANDOM_AMD is not set -CONFIG_HW_RANDOM_GEODE=y -# CONFIG_HW_RANDOM_INTEL is not set -CONFIG_HW_RANDOM_VIA=y -# CONFIG_I2C is not set -CONFIG_I2C_BOARDINFO=y -# CONFIG_I8K is not set -# CONFIG_IDE is not set -# CONFIG_IEEE80211 is not set -# CONFIG_IFB is not set -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_INET_TUNNEL is not set -# CONFIG_INET_XFRM_MODE_BEET is not set -# CONFIG_INET_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET_XFRM_MODE_TUNNEL is not set -# CONFIG_INET_XFRM_TUNNEL is not set -CONFIG_INITRAMFS_SOURCE="" -CONFIG_INPUT=y -CONFIG_INPUT_EVDEV=y -CONFIG_INPUT_KEYBOARD=y -CONFIG_INPUT_MOUSE=y -CONFIG_INPUT_MOUSEDEV=y -# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -CONFIG_INPUT_MOUSEDEV_SCREEN_X=1200 -CONFIG_INPUT_MOUSEDEV_SCREEN_Y=900 -# CONFIG_IOMMU_HELPER is not set -CONFIG_IO_DELAY_0X80=y -# CONFIG_IO_DELAY_0XED is not set -# CONFIG_IO_DELAY_NONE is not set -CONFIG_IO_DELAY_TYPE_0X80=0 -CONFIG_IO_DELAY_TYPE_0XED=1 -CONFIG_IO_DELAY_TYPE_NONE=3 -CONFIG_IO_DELAY_TYPE_UDELAY=2 -# CONFIG_IO_DELAY_UDELAY is not set -# CONFIG_IPV6 is not set -# CONFIG_IPW2100 is not set -# CONFIG_IPW2200 is not set -# CONFIG_IP_NF_MATCH_AH is not set -# CONFIG_IP_NF_MATCH_TTL is not set -# CONFIG_IP_NF_QUEUE is not set -# CONFIG_IP_NF_TARGET_REDIRECT is not set -# CONFIG_ISA is not set -CONFIG_ISA_DMA_API=y -# CONFIG_ISCSI_IBFT_FIND is not set -# CONFIG_ISDN is not set -# CONFIG_ISO9660_FS is not set -CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set -CONFIG_KEXEC=y -# CONFIG_KEXEC_JUMP is not set -CONFIG_KEYBOARD_ATKBD=y -# CONFIG_KEYBOARD_LKKBD is not set -# CONFIG_KEYBOARD_NEWTON is not set -# CONFIG_KEYBOARD_STOWAWAY is not set -# CONFIG_KEYBOARD_SUNKBD is not set -# CONFIG_KEYBOARD_XTKBD is not set -# CONFIG_KGDB is not set -CONFIG_KTIME_SCALAR=y -CONFIG_LCD_CLASS_DEVICE=y -# CONFIG_LCD_ILI9320 is not set -# CONFIG_LCD_LTV350QV is not set -# CONFIG_LCD_PLATFORM is not set -# CONFIG_LCD_VGG2432A4 is not set -# CONFIG_LEDS_CLEVO_MAIL is not set -# CONFIG_LIBERTAS is not set -CONFIG_LIBERTAS_DEBUG=y -# CONFIG_LIBERTAS_SDIO is not set -# CONFIG_LIBERTAS_USB is not set -# CONFIG_LOCK_STAT is not set -# CONFIG_LOGO is not set -# CONFIG_M386 is not set -# CONFIG_M486 is not set -# CONFIG_M586 is not set -# CONFIG_M586MMX is not set -# CONFIG_M586TSC is not set -# CONFIG_M686 is not set -# CONFIG_MACINTOSH_DRIVERS is not set -CONFIG_MARKERS=y -# CONFIG_MATH_EMULATION is not set -# CONFIG_MCA is not set -# CONFIG_MCORE2 is not set -# CONFIG_MCRUSOE is not set -# CONFIG_MCYRIXIII is not set -# CONFIG_MEDIA_TUNER is not set -# CONFIG_MEDIA_TUNER_MT20XX is not set -# CONFIG_MEDIA_TUNER_SIMPLE is not set -# CONFIG_MEDIA_TUNER_TDA8290 is not set -# CONFIG_MEDIA_TUNER_TDA9887 is not set -# CONFIG_MEDIA_TUNER_TEA5761 is not set -# CONFIG_MEDIA_TUNER_TEA5767 is not set -# CONFIG_MEDIA_TUNER_XC2028 is not set -# CONFIG_MEDIA_TUNER_XC5000 is not set -# CONFIG_MEFFICEON is not set -# CONFIG_MEMTEST is not set -# CONFIG_MGEODEGX1 is not set -CONFIG_MGEODE_LX=y -CONFIG_MICROCODE=y -CONFIG_MICROCODE_OLD_INTERFACE=y -# CONFIG_MINIX_FS is not set -# CONFIG_MISC_DEVICES is not set -# CONFIG_MK6 is not set -# CONFIG_MK7 is not set -# CONFIG_MK8 is not set -CONFIG_MMC=y -CONFIG_MMC_BLOCK=y -CONFIG_MMC_SDHCI=y -# CONFIG_MMIOTRACE is not set -# CONFIG_MOUSE_BCM5974 is not set -CONFIG_MOUSE_PS2=y -CONFIG_MOUSE_PS2_ALPS=y -CONFIG_MOUSE_PS2_LIFEBOOK=y -CONFIG_MOUSE_PS2_LOGIPS2PP=y -CONFIG_MOUSE_PS2_SYNAPTICS=y -# CONFIG_MOUSE_PS2_TOUCHKIT is not set -CONFIG_MOUSE_PS2_TRACKPOINT=y -# CONFIG_MOUSE_SERIAL is not set -# CONFIG_MOUSE_VSXXXAA is not set -# CONFIG_MPENTIUM4 is not set -# CONFIG_MPENTIUMII is not set -# CONFIG_MPENTIUMIII is not set -# CONFIG_MPENTIUMM is not set -# CONFIG_MPSC is not set -# CONFIG_MSDOS_FS is not set -CONFIG_MTD_BLOCK2MTD=y -# CONFIG_MTD_CFI is not set -CONFIG_MTD_CMDLINE_PARTS=y -# CONFIG_MTD_OOPS is not set -CONFIG_MTD_PCI=y -# CONFIG_MTD_TS5500 is not set -# CONFIG_MTRR is not set -# CONFIG_MVIAC3_2 is not set -# CONFIG_MVIAC7 is not set -# CONFIG_MWINCHIP2 is not set -# CONFIG_MWINCHIP3D is not set -# CONFIG_MWINCHIPC6 is not set -# CONFIG_NETDEV_1000 is not set -# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set -# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set -# CONFIG_NETFILTER_XT_MATCH_CONNTRACK is not set -# CONFIG_NETFILTER_XT_MATCH_DSCP is not set -# CONFIG_NETFILTER_XT_MATCH_ESP is not set -# CONFIG_NETFILTER_XT_MATCH_HELPER is not set -# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set -# CONFIG_NETFILTER_XT_MATCH_MAC is not set -# CONFIG_NETFILTER_XT_MATCH_MARK is not set -# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set -# CONFIG_NETFILTER_XT_MATCH_STRING is not set -# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set -# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set -# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set -# CONFIG_NETFILTER_XT_TARGET_DSCP is not set -# CONFIG_NETFILTER_XT_TARGET_MARK is not set -# CONFIG_NETFILTER_XT_TARGET_NOTRACK is not set -# CONFIG_NETWORK_FILESYSTEMS is not set -# CONFIG_NET_ETHERNET is not set -# CONFIG_NET_IPGRE is not set -# CONFIG_NET_KEY is not set -# CONFIG_NET_PKTGEN is not set -# CONFIG_NET_SCH_DSMARK is not set -# CONFIG_NET_SCH_GRED is not set -# CONFIG_NET_SCH_HFSC is not set -# CONFIG_NET_SCH_HTB is not set -# CONFIG_NET_SCH_INGRESS is not set -# CONFIG_NET_SCH_RED is not set -# CONFIG_NET_SCH_SFQ is not set -# CONFIG_NET_SCH_TBF is not set -# CONFIG_NET_SCH_TEQL is not set -# CONFIG_NF_CONNTRACK_AMANDA is not set -# CONFIG_NF_CONNTRACK_H323 is not set -# CONFIG_NF_CONNTRACK_PPTP is not set -# CONFIG_NF_CONNTRACK_SIP is not set -# CONFIG_NF_NAT_AMANDA is not set -# CONFIG_NF_NAT_H323 is not set -# CONFIG_NF_NAT_PPTP is not set -# CONFIG_NF_NAT_SIP is not set -# CONFIG_NF_NAT_SNMP_BASIC is not set -# CONFIG_NLS is not set -CONFIG_NOHIGHMEM=y -CONFIG_NO_HZ=y -# CONFIG_NSC_GPIO is not set -CONFIG_NVRAM=y -CONFIG_OLPC=y -CONFIG_OPROFILE=y -# CONFIG_OPTIMIZE_INLINING is not set -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PAGE_OFFSET=0xC0000000 -# CONFIG_PARAVIRT_GUEST is not set -# CONFIG_PARTITION_ADVANCED is not set -# CONFIG_PC8736x_GPIO is not set -CONFIG_PCI=y -# CONFIG_PCIEPORTBUS is not set -# CONFIG_PCI_DEBUG is not set -CONFIG_PCI_DIRECT=y -CONFIG_PCI_DOMAINS=y -# CONFIG_PCI_GOANY is not set -# CONFIG_PCI_GOBIOS is not set -# CONFIG_PCI_GODIRECT is not set -# CONFIG_PCI_GOMMCONFIG is not set -CONFIG_PCI_GOOLPC=y -CONFIG_PCI_OLPC=y -CONFIG_PCSPKR_PLATFORM=y -# CONFIG_PDA_POWER is not set -CONFIG_PHYSICAL_ALIGN=0x100000 -CONFIG_PHYSICAL_START=0x100000 -CONFIG_PM=y -CONFIG_PM_DEBUG=y -CONFIG_PM_SLEEP=y -CONFIG_PM_STD_PARTITION="" -# CONFIG_PM_TRACE_RTC is not set -# CONFIG_PM_VERBOSE is not set -CONFIG_PNP=y -CONFIG_PNPACPI=y -# CONFIG_PNP_DEBUG is not set -CONFIG_POWER_SUPPLY=y -# CONFIG_POWER_SUPPLY_DEBUG is not set -# CONFIG_PPP is not set -# CONFIG_PREEMPT_NONE is not set -CONFIG_PREEMPT_VOLUNTARY=y -CONFIG_PROFILING=y -# CONFIG_PROVE_LOCKING is not set -# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set -# CONFIG_RCU_TORTURE_TEST is not set -CONFIG_RELAY=y -# CONFIG_RELOCATABLE is not set -CONFIG_RTC=y -# CONFIG_RT_MUTEX_TESTER is not set -# CONFIG_RWSEM_GENERIC_SPINLOCK is not set -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_SCHEDSTATS=y -CONFIG_SCHED_DEBUG=y -CONFIG_SCHED_HRTICK=y -CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y -CONFIG_SCSI=y -# CONFIG_SCSI_WAIT_SCAN is not set -# CONFIG_SCx200 is not set -# CONFIG_SCx200_ACB is not set -# CONFIG_SDIO_UART is not set -# CONFIG_SERIAL_8250_EXTENDED is not set -CONFIG_SERIAL_8250_PCI=y -CONFIG_SERIAL_8250_PNP=y -CONFIG_SERIO=y -# CONFIG_SERIO_CT82C710 is not set -CONFIG_SERIO_I8042=y -CONFIG_SERIO_LIBPS2=y -# CONFIG_SERIO_PCIPS2 is not set -# CONFIG_SERIO_RAW is not set -CONFIG_SERIO_SERPORT=y -# CONFIG_SMP is not set -CONFIG_SND_HDA_CODEC_ANALOG=y -CONFIG_SND_HDA_CODEC_ATIHDMI=y -CONFIG_SND_HDA_CODEC_CMEDIA=y -CONFIG_SND_HDA_CODEC_CONEXANT=y -CONFIG_SND_HDA_CODEC_REALTEK=y -CONFIG_SND_HDA_CODEC_SI3054=y -CONFIG_SND_HDA_CODEC_SIGMATEL=y -CONFIG_SND_HDA_CODEC_VIA=y -CONFIG_SND_HDA_GENERIC=y -CONFIG_SND_HDA_HWDEP=y -# CONFIG_SND_HDA_INTEL is not set -# CONFIG_SND_HDA_POWER_SAVE is not set -CONFIG_SND_PCI=y -# CONFIG_SND_USB is not set -CONFIG_SND_VMASTER=y -# CONFIG_SONYPI is not set -CONFIG_SPARSEMEM_STATIC=y -CONFIG_STRICT_DEVMEM=y -CONFIG_SUSPEND=y -CONFIG_SUSPEND_FREEZER=y -# CONFIG_SYSPROF_TRACER is not set -# CONFIG_TELCLOCK is not set -CONFIG_THERMAL=y -CONFIG_TICK_ONESHOT=y -CONFIG_TIMER_STATS=y -# CONFIG_TOSHIBA is not set -# CONFIG_UDF_FS is not set -CONFIG_UID16=y -CONFIG_USB=y -# CONFIG_USB_ACM is not set -# CONFIG_USB_CATC is not set -CONFIG_USB_EHCI_HCD=y -CONFIG_USB_EHCI_ROOT_HUB_TT=y -CONFIG_USB_EHCI_TT_NEWSCHED=y -# CONFIG_USB_HID is not set -# CONFIG_USB_KAWETH is not set -# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set -# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set -CONFIG_USB_OHCI_HCD=y -# CONFIG_USB_PEGASUS is not set -# CONFIG_USB_PRINTER is not set -# CONFIG_USB_PWC is not set -# CONFIG_USB_SERIAL is not set -CONFIG_USB_STORAGE=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_SUSPEND=y -CONFIG_USB_UHCI_HCD=y -# CONFIG_USB_USBNET is not set -CONFIG_V4L_USB_DRIVERS=y -# CONFIG_VFAT_FS is not set -CONFIG_VGACON_SOFT_SCROLLBACK=y -CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=64 -# CONFIG_VGASTATE is not set -CONFIG_VGA_CONSOLE=y -CONFIG_VIDEO_ALLOW_V4L1=y -# CONFIG_VIDEO_CAFE_CCIC is not set -CONFIG_VIDEO_CAPTURE_DRIVERS=y -# CONFIG_VIDEO_CPIA2 is not set -# CONFIG_VIDEO_MEDIA is not set -# CONFIG_VIDEO_OV7670 is not set -# CONFIG_VIDEO_OVCAMCHIP is not set -CONFIG_VIDEO_SELECT=y -CONFIG_VM86=y -# CONFIG_VMSPLIT_1G is not set -# CONFIG_VMSPLIT_2G is not set -# CONFIG_VMSPLIT_2G_OPT is not set -CONFIG_VMSPLIT_3G=y -# CONFIG_VMSPLIT_3G_OPT is not set -CONFIG_VM_EVENT_COUNTERS=y -CONFIG_VT=y -CONFIG_VT_CONSOLE=y -# CONFIG_VT_HW_CONSOLE_BINDING is not set -# CONFIG_W1 is not set -# CONFIG_WATCHDOG is not set -CONFIG_X86=y -CONFIG_X86_32=y -# CONFIG_X86_64 is not set -# CONFIG_X86_ACPI_CPUFREQ is not set -CONFIG_X86_BIOS_REBOOT=y -CONFIG_X86_BSWAP=y -CONFIG_X86_CMPXCHG=y -CONFIG_X86_CPU=y -# CONFIG_X86_CPUFREQ_NFORCE2 is not set -# CONFIG_X86_CPUID is not set -CONFIG_X86_DEBUGCTLMSR=y -# CONFIG_X86_ELAN is not set -# CONFIG_X86_E_POWERSAVER is not set -CONFIG_X86_FIND_SMP_CONFIG=y -CONFIG_X86_GENERIC=y -# CONFIG_X86_GENERICARCH is not set -# CONFIG_X86_GX_SUSPMOD is not set -CONFIG_X86_INTEL_USERCOPY=y -CONFIG_X86_INVLPG=y -CONFIG_X86_IO_APIC=y -CONFIG_X86_L1_CACHE_SHIFT=7 -CONFIG_X86_LOCAL_APIC=y -# CONFIG_X86_LONGHAUL is not set -# CONFIG_X86_LONGRUN is not set -# CONFIG_X86_MCE is not set -CONFIG_X86_MINIMUM_CPU_FAMILY=4 -CONFIG_X86_MPPARSE=y -# CONFIG_X86_MSR is not set -# CONFIG_X86_P4_CLOCKMOD is not set -# CONFIG_X86_PAE is not set -CONFIG_X86_PC=y -CONFIG_X86_PM_TIMER=y -CONFIG_X86_POPAD_OK=y -# CONFIG_X86_POWERNOW_K6 is not set -# CONFIG_X86_POWERNOW_K7 is not set -# CONFIG_X86_POWERNOW_K8 is not set -# CONFIG_X86_PTDUMP is not set -# CONFIG_X86_RDC321X is not set -# CONFIG_X86_REBOOTFIXUPS is not set -# CONFIG_X86_RESERVE_LOW_64K is not set -# CONFIG_X86_SPEEDSTEP_CENTRINO is not set -# CONFIG_X86_SPEEDSTEP_ICH is not set -# CONFIG_X86_SPEEDSTEP_LIB is not set -# CONFIG_X86_SPEEDSTEP_SMI is not set -CONFIG_X86_TSC=y -CONFIG_X86_UP_APIC=y -CONFIG_X86_UP_IOAPIC=y -CONFIG_X86_USE_3DNOW=y -CONFIG_X86_USE_PPRO_CHECKSUM=y -CONFIG_X86_VERBOSE_BOOTUP=y -# CONFIG_X86_VOYAGER is not set -# CONFIG_X86_VSMP is not set -CONFIG_X86_WP_WORKS_OK=y -CONFIG_X86_XADD=y -# CONFIG_ZONE_DMA32 is not set diff --git a/target/linux/olpc/patches-2.6.27/300-block2mtd_init.patch b/target/linux/olpc/patches-2.6.27/300-block2mtd_init.patch deleted file mode 100644 index e16570fdd..000000000 --- a/target/linux/olpc/patches-2.6.27/300-block2mtd_init.patch +++ /dev/null @@ -1,205 +0,0 @@ ---- a/arch/x86/kernel/vmlinux_32.lds.S -+++ b/arch/x86/kernel/vmlinux_32.lds.S -@@ -135,6 +135,12 @@ SECTIONS - INITCALLS - __initcall_end = .; - } -+ .root_initcall.init : AT(ADDR(.root_initcall.init) - LOAD_OFFSET) { -+ __root_initcall_start = .; -+ INITCALLS_ROOT -+ __root_initcall_end = .; -+ } -+ - .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) { - __con_initcall_start = .; - *(.con_initcall.init) ---- a/drivers/mtd/devices/block2mtd.c -+++ b/drivers/mtd/devices/block2mtd.c -@@ -18,10 +18,18 @@ - #include - #include - #include -+#include -+#include - - #define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args) - #define INFO(fmt, args...) printk(KERN_INFO "block2mtd: " fmt "\n" , ## args) - -+struct retry { -+ struct list_head list; -+ const char *val; -+}; -+ -+static LIST_HEAD(retry_list); - - /* Info for the block device */ - struct block2mtd_dev { -@@ -33,10 +41,34 @@ struct block2mtd_dev { - char devname[0]; - }; - -+static int block2mtd_setup2(const char *val); - - /* Static info about the MTD, used in cleanup_module */ - static LIST_HEAD(blkmtd_device_list); - -+static int add_retry(const char *val) { -+ struct retry *r = kmalloc(sizeof(struct retry), GFP_KERNEL); -+ -+ INIT_LIST_HEAD(&r->list); -+ r->val = val; -+ list_add(&r->list, &retry_list); -+ -+ return 0; -+} -+ -+static int __init process_retries(void) { -+ struct list_head *p, *tmp; -+ -+ list_for_each_safe(p, tmp, &retry_list) { -+ struct retry *r = list_entry(p, struct retry, list); -+ block2mtd_setup2(r->val); -+ msleep(100); -+ list_del(p); -+ kfree(r); -+ } -+ return 0; -+} -+rootfs_initcall(process_retries); - - static struct page *page_read(struct address_space *mapping, int index) - { -@@ -510,7 +542,9 @@ static int block2mtd_setup2(const char * - if (token[2] && (strlen(token[2]) + 1 > 80)) - parse_err("mtd device name too long"); - -- add_device(name, erase_size, token[2]); -+ if (add_device(name, erase_size, token[2]) == NULL) { -+ add_retry(val); -+ } - - return 0; - } ---- a/include/asm-generic/vmlinux.lds.h -+++ b/include/asm-generic/vmlinux.lds.h -@@ -375,12 +375,14 @@ - *(.initcall4s.init) \ - *(.initcall5.init) \ - *(.initcall5s.init) \ -- *(.initcallrootfs.init) \ - *(.initcall6.init) \ - *(.initcall6s.init) \ - *(.initcall7.init) \ - *(.initcall7s.init) - -+#define INITCALLS_ROOT \ -+ *(.initcallrootfs.init) -+ - #define PERCPU(align) \ - . = ALIGN(align); \ - VMLINUX_SYMBOL(__per_cpu_start) = .; \ ---- a/init/do_mounts.c -+++ b/init/do_mounts.c -@@ -174,16 +174,8 @@ static int __init fs_names_setup(char *s - return 1; - } - --static unsigned int __initdata root_delay; --static int __init root_delay_setup(char *str) --{ -- root_delay = simple_strtoul(str, NULL, 0); -- return 1; --} -- - __setup("rootflags=", root_data_setup); - __setup("rootfstype=", fs_names_setup); --__setup("rootdelay=", root_delay_setup); - - static void __init get_fs_names(char *page) - { -@@ -359,18 +351,6 @@ void __init prepare_namespace(void) - { - int is_floppy; - -- if (root_delay) { -- printk(KERN_INFO "Waiting %dsec before mounting root device...\n", -- root_delay); -- ssleep(root_delay); -- } -- -- /* wait for the known devices to complete their probing */ -- while (driver_probe_done() != 0) -- msleep(100); -- -- md_run_setup(); -- - if (saved_root_name[0]) { - root_device_name = saved_root_name; - if (!strncmp(root_device_name, "mtd", 3) || ---- a/init/main.c -+++ b/init/main.c -@@ -70,6 +70,7 @@ - #ifdef CONFIG_X86_LOCAL_APIC - #include - #endif -+#include "do_mounts.h" - - /* - * This is one of the first .c files built. Error out early if we have compiler -@@ -745,12 +746,13 @@ int do_one_initcall(initcall_t fn) - - - extern initcall_t __initcall_start[], __initcall_end[], __early_initcall_end[]; -+extern initcall_t __root_initcall_start[], __root_initcall_end[]; - --static void __init do_initcalls(void) -+static void __init do_initcalls(initcall_t *start, initcall_t *end) - { - initcall_t *call; - -- for (call = __early_initcall_end; call < __initcall_end; call++) -+ for (call = start; call < end; call++) - do_one_initcall(*call); - - /* Make sure there is no pending stuff from the initcall sequence */ -@@ -772,7 +774,7 @@ static void __init do_basic_setup(void) - usermodehelper_init(); - driver_init(); - init_irq_proc(); -- do_initcalls(); -+ do_initcalls(__early_initcall_end, __initcall_end); - } - - static void __init do_pre_smp_initcalls(void) -@@ -833,6 +835,13 @@ static int noinline init_post(void) - panic("No init found. Try passing init= option to kernel."); - } - -+static unsigned int __initdata root_delay; -+static int __init root_delay_setup(char *str) -+{ -+ root_delay = simple_strtoul(str, NULL, 0); -+ return 1; -+} -+__setup("rootdelay=", root_delay_setup); - static int __init kernel_init(void * unused) - { - lock_kernel(); -@@ -873,7 +882,16 @@ static int __init kernel_init(void * unu - - if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) { - ramdisk_execute_command = NULL; -- prepare_namespace(); -+ if (root_delay) { -+ printk(KERN_INFO "Waiting %desc before mounting root device...\n", -+ root_delay); -+ ssleep(root_delay); -+ } -+ while (driver_probe_done() != 0) -+ msleep(100); -+ md_run_setup(); -+ do_initcalls(__root_initcall_start, __root_initcall_end); -+ prepare_namespace(); - } - - /* From e75593217a6083c3c9a43fe6f127e06464a72f05 Mon Sep 17 00:00:00 2001 From: juhosg Date: Fri, 30 Oct 2009 12:26:10 +0000 Subject: [PATCH 029/288] ar71xx: simplify image generation git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18222 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/image/Makefile | 106 +++++++++++++++-------------- 1 file changed, 55 insertions(+), 51 deletions(-) diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 5a126c0af..577758a32 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -18,28 +18,47 @@ ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) VMLINUX:=$(IMGNAME)-vmlinux-initramfs endif +define CompressLzma + $(STAGING_DIR_HOST)/bin/lzma e $(1) -lc1 -lp2 -pb2 $(2) +endef + +define PatchKernelLzma + cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(1) + $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(1) '$(strip $(2))' + $(call CompressLzma,$(KDIR)/vmlinux-$(1),$(KDIR)/vmlinux-$(1).bin.lzma) +endef + +define PatchKernelGzip + cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(1) + $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(1) '$(strip $(2))' + gzip -9 -c $(KDIR)/vmlinux-$(1) > $(KDIR)/vmlinux-$(1).bin.gz +endef + +define MkImageLzma + mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma \ + -e 0x80060000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \ + -d $(1) $(2) +endef + +define MkImageGzip + mkimage -A mips -O linux -T kernel -a 0x80060000 -C gzip \ + -e 0x80060000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \ + -d $(1) $(2) +endef + define Image/BuildKernel cp $(KDIR)/vmlinux.elf $(VMLINUX).elf cp $(KDIR)/vmlinux $(VMLINUX).bin gzip -9 -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz - $(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.bin.l7 - $(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux -lc1 -lp2 -pb2 $(KDIR)/vmlinux.bin.lzma - dd if=$(KDIR)/vmlinux.bin.l7 of=$(VMLINUX).lzma bs=65536 conv=sync + $(call CompressLzma,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.lzma) + dd if=$(KDIR)/vmlinux.bin.lzma of=$(VMLINUX).lzma bs=65536 conv=sync dd if=$(KDIR)/vmlinux.bin.gz of=$(VMLINUX).gz bs=65536 conv=sync - mkimage -A mips -O linux -T kernel -a 0x80060000 -C gzip -e \ - 0x80060000 \ - -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \ - -d $(KDIR)/vmlinux.bin.gz $(IMGNAME)-uImage-gzip.bin - mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \ - 0x80060000 \ - -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \ - -d $(KDIR)/vmlinux.bin.lzma $(IMGNAME)-uImage-lzma.bin + $(call MkImageGzip,$(KDIR)/vmlinux.bin.gz,$(IMGNAME)-uImage-gzip.bin) + $(call MkImageLzma,$(KDIR)/vmlinux.bin.lzma,$(IMGNAME)-uImage-lzma.bin) endef define Image/Build/WRT400N - cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(2) - $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(2) '$(strip $(3))' - $(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux-$(2) $(KDIR)/vmlinux-$(2).bin.lzma + $(call PatchKernelLzma,$(2),$(3)) if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt 1310720 ]; then \ echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \ else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 6488064 ]; then \ @@ -58,10 +77,8 @@ define Image/Build/WRT400N fi; fi endef -define Image/Build/AP81 - cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(2) - $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(2) '$(strip $(3))' - $(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux-$(2) $(KDIR)/vmlinux-$(2).bin.lzma +define Image/Build/Cameo + $(call PatchKernelLzma,$(2),$(3)) if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt 851968 ]; then \ echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \ else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 3014656 ]; then \ @@ -80,9 +97,7 @@ define Image/Build/AP81 endef define Image/Build/AP83 - cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(2) - $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(2) '$(strip $(3))' - gzip -9 -c $(KDIR)/vmlinux-$(2) > $(KDIR)/vmlinux-$(2).bin.gz + $(call PatchKernelGzip,$(2),$(3)) if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.gz"` -gt 1310720 ]; then \ echo "Warning: $(KDIR)/vmlinux-$(2).bin.gz is too big"; \ else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 6619136 ]; then \ @@ -124,30 +139,26 @@ define Image/Build/MyLoader endef define Image/Build/UBNT - cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(2) - $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(2) '$(strip $(3))' - $(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux-$(2) $(KDIR)/vmlinux-$(2).lzma - dd if=$(KDIR)/vmlinux-$(2).lzma of=$(KDIR)/vmlinux-$(2).bin.lzma bs=64k conv=sync + $(call PatchKernelLzma,$(2),$(3)) + dd if=$(KDIR)/vmlinux-$(2).bin.lzma of=$(KDIR)/vmlinux-$(2).lzma bs=64k conv=sync -$(STAGING_DIR_HOST)/bin/mkfwimage \ -B $(4) -v $(5).$(6).OpenWrt.$(REVISION) \ - -k $(KDIR)/vmlinux-$(2).bin.lzma \ + -k $(KDIR)/vmlinux-$(2).lzma \ -r $(BIN_DIR)/openwrt-$(BOARD)-root.$(1) \ -o $(call imgname,$(1),$(2)).bin endef define Image/Build/Planex - cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(2) - $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(2) '$(strip $(3))' - gzip -9 -c $(KDIR)/vmlinux-$(2) > $(KDIR)/vmlinux-$(2).bin.gzip - if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.gzip"` -gt 1441792 ]; then \ - echo "Warning: $(KDIR)/vmlinux-$(2).bin.gzip is too big"; \ + $(call PatchKernelGzip,$(2),$(3)) + if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.gz"` -gt 1441792 ]; then \ + echo "Warning: $(KDIR)/vmlinux-$(2).bin.gz is too big"; \ else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 6356992 ]; then \ echo "Warning: $(KDIR)/root.$(1) is too big"; \ else \ mkimage -A mips -O linux -T kernel -a 0x80060000 -C gzip -e \ 0x80060000 \ -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \ - -d $(KDIR)/vmlinux-$(2).bin.gzip $(KDIR)/vmlinux-$(2).uImage; \ + -d $(KDIR)/vmlinux-$(2).bin.gz $(KDIR)/vmlinux-$(2).uImage; \ ( \ dd if=$(KDIR)/vmlinux-$(2).uImage bs=1408k conv=sync; \ dd if=$(KDIR)/root.$(1) bs=6208k conv=sync; \ @@ -161,24 +172,17 @@ define Image/Build/Planex endef define Image/Build/TPLINK - cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(2) - $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(2) '$(strip $(3))' - gzip -9 -c $(KDIR)/vmlinux-$(2) > $(KDIR)/vmlinux-$(2).bin.gzip + $(call PatchKernelGzip,$(2),$(3)) -$(STAGING_DIR_HOST)/bin/mktplinkfw \ -B $(4) -N OpenWrt -V $(REVISION)\ - -k $(KDIR)/vmlinux-$(2).bin.gzip \ + -k $(KDIR)/vmlinux-$(2).bin.gz \ -r $(BIN_DIR)/openwrt-$(BOARD)-root.$(1) \ -o $(call imgname,$(1),$(2)).uni endef define Image/Build/CyberTAN - cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(2) - $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(2) '$(strip $(3))' - gzip -9 -c $(KDIR)/vmlinux-$(2) > $(KDIR)/vmlinux-$(2).bin.gzip - mkimage -A mips -O linux -T kernel -a 0x80060000 -C gzip -e \ - 0x80060000 \ - -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \ - -d $(KDIR)/vmlinux-$(2).bin.gzip $(KDIR)/vmlinux-$(2).uImage + $(call PatchKernelGzip,$(2),$(3)) + $(call MkImageGzip,$(KDIR)/vmlinux-$(2).bin.gz,$(KDIR)/vmlinux-$(2).uImage) ( \ dd if=$(KDIR)/vmlinux-$(2).uImage bs=64k conv=sync; \ dd if=/dev/zero bs=1 count=65476; \ @@ -223,12 +227,12 @@ define Image/Build/Template/CyberTAN/jffs2-64k $(call Image/Build/Template/CyberTAN,jffs2-64k,$(1),$(2),$(3)) endef -define Image/Build/Template/AP81 - $(call Image/Build/AP81,$(1),$(2),$(3),$(4)) +define Image/Build/Template/Cameo + $(call Image/Build/Cameo,$(1),$(2),$(3),$(4)) endef -define Image/Build/Template/AP81/squashfs - $(call Image/Build/Template/AP81,squashfs,$(1),$(2),$(3)) +define Image/Build/Template/Cameo/squashfs + $(call Image/Build/Template/Cameo,squashfs,$(1),$(2),$(3)) endef define Image/Build/Template/AP83 @@ -292,19 +296,19 @@ define Image/Build/Profile/WP543 endef define Image/Build/Profile/DIR615C1 - $(call Image/Build/Template/AP81/$(1),dir-615c1,board=TEW-632BRP,"AP81-AR9130-RT-070614-02") + $(call Image/Build/Template/Cameo/$(1),dir-615c1,board=TEW-632BRP,"AP81-AR9130-RT-070614-02") endef define Image/Build/Profile/TEW632BRP - $(call Image/Build/Template/AP81/$(1),tew-632brp,board=TEW-632BRP,"AP81-AR9130-RT-070614-00") + $(call Image/Build/Template/Cameo/$(1),tew-632brp,board=TEW-632BRP,"AP81-AR9130-RT-070614-00") endef define Image/Build/Profile/TEW652BRP - $(call Image/Build/Template/AP81/$(1),tew-652brp,board=TEW-632BRP,"AP81-AR9130-RT-080609-05") + $(call Image/Build/Template/Cameo/$(1),tew-652brp,board=TEW-632BRP,"AP81-AR9130-RT-080609-05") endef define Image/Build/Profile/A02RBW300N - $(call Image/Build/Template/AP81/$(1),a02-rb-w300n,board=TEW-632BRP,"AP81-AR9130-RT-070614-03") + $(call Image/Build/Template/Cameo/$(1),a02-rb-w300n,board=TEW-632BRP,"AP81-AR9130-RT-070614-03") endef define Image/Build/Profile/UBNTRS From 8b79390edbac82d1e503c6be62cf7078b8abc9b9 Mon Sep 17 00:00:00 2001 From: juhosg Date: Fri, 30 Oct 2009 12:26:14 +0000 Subject: [PATCH 030/288] ar71xx: add missing profiles for the TL-WR841ND v3 and MZK-W300NH boards git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18223 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/profiles/planex.mk | 11 +++++++++++ target/linux/ar71xx/profiles/tp-link.mk | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/target/linux/ar71xx/profiles/planex.mk b/target/linux/ar71xx/profiles/planex.mk index 2d80d4d1d..35d88e512 100644 --- a/target/linux/ar71xx/profiles/planex.mk +++ b/target/linux/ar71xx/profiles/planex.mk @@ -15,3 +15,14 @@ define Profile/MZKW04NU/Description endef $(eval $(call Profile,MZKW04NU)) + +define Profile/MZKW300NH + NAME:=Planex MZK-W300NH + PACKAGES:=kmod-ath9k hostapd-mini +endef + +define Profile/MZKW300NH/Description + Package set optimized for the Planex MZK-W300NH. +endef + +$(eval $(call Profile,MZKW300NH)) diff --git a/target/linux/ar71xx/profiles/tp-link.mk b/target/linux/ar71xx/profiles/tp-link.mk index 551aec904..7b804e5b9 100644 --- a/target/linux/ar71xx/profiles/tp-link.mk +++ b/target/linux/ar71xx/profiles/tp-link.mk @@ -15,6 +15,17 @@ endef $(eval $(call Profile,TLWR741NDV1)) +define Profile/TLWR841NDV3 + NAME:=TP-LINK TL-WR841ND v3 + PACKAGES:=kmod-ath9k hostapd-mini +endef + +define Profile/TLWR841NDV3/Description + Package set optimized for the TP-LINK TL-WR841ND v3. +endef + +$(eval $(call Profile,TLWR841NDV3)) + define Profile/TLWR941NDV2 NAME:=TP-LINK TL-WR941ND v2 PACKAGES:=kmod-ath9k hostapd-mini From 5be08769f35ba9a5c170eb7a1139f7778a2549a1 Mon Sep 17 00:00:00 2001 From: juhosg Date: Fri, 30 Oct 2009 12:26:17 +0000 Subject: [PATCH 031/288] ar71xx: update mdio_reset code git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18224 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_mdio.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_mdio.c b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_mdio.c index 72f732d54..d3cbacedb 100644 --- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_mdio.c +++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_mdio.c @@ -104,11 +104,14 @@ static void ag71xx_mdio_mii_write(struct ag71xx_mdio *am, static int ag71xx_mdio_reset(struct mii_bus *bus) { struct ag71xx_mdio *am = bus->priv; + u32 t; - ag71xx_mdio_wr(am, AG71XX_REG_MII_CFG, MII_CFG_RESET); + t = MII_CFG_CLK_DIV_28; + + ag71xx_mdio_wr(am, AG71XX_REG_MII_CFG, t | MII_CFG_RESET); udelay(100); - ag71xx_mdio_wr(am, AG71XX_REG_MII_CFG, MII_CFG_CLK_DIV_28); + ag71xx_mdio_wr(am, AG71XX_REG_MII_CFG, t); udelay(100); return 0; From 0724c81c225516ac88aeb5cd6b837b1fddca7bb1 Mon Sep 17 00:00:00 2001 From: juhosg Date: Fri, 30 Oct 2009 12:26:22 +0000 Subject: [PATCH 032/288] ar71xx: use soc specific divider for mdio clock git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18225 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../ar71xx/files/arch/mips/ar71xx/devices.c | 8 +++++--- .../mips/include/asm/mach-ar71xx/platform.h | 1 + .../ar71xx/files/drivers/net/ag71xx/ag71xx.h | 7 ++++--- .../files/drivers/net/ag71xx/ag71xx_mdio.c | 18 +++++++++++++----- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c b/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c index 7c08bc997..d55022f88 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c @@ -186,9 +186,7 @@ static struct resource ar71xx_mdio_resources[] = { } }; -static struct ag71xx_mdio_platform_data ar71xx_mdio_data = { - .phy_mask = 0xffffffff, -}; +static struct ag71xx_mdio_platform_data ar71xx_mdio_data; static struct platform_device ar71xx_mdio_device = { .name = "ag71xx-mdio", @@ -202,7 +200,11 @@ static struct platform_device ar71xx_mdio_device = { void __init ar71xx_add_device_mdio(u32 phy_mask) { + if (ar71xx_soc == AR71XX_SOC_AR7240) + ar71xx_mdio_data.is_ar7240 = 1; + ar71xx_mdio_data.phy_mask = phy_mask; + platform_device_register(&ar71xx_mdio_device); } diff --git a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/platform.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/platform.h index c305a821d..52f41f47a 100644 --- a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/platform.h +++ b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/platform.h @@ -37,6 +37,7 @@ struct ag71xx_platform_data { struct ag71xx_mdio_platform_data { u32 phy_mask; + int is_ar7240; }; struct ar71xx_ehci_platform_data { diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h index f4ae0eb17..77962fec8 100644 --- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h +++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h @@ -103,9 +103,10 @@ struct ag71xx_ring { }; struct ag71xx_mdio { - struct mii_bus *mii_bus; - int mii_irq[PHY_MAX_ADDR]; - void __iomem *mdio_base; + struct mii_bus *mii_bus; + int mii_irq[PHY_MAX_ADDR]; + void __iomem *mdio_base; + struct ag71xx_mdio_platform_data *pdata; }; struct ag71xx { diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_mdio.c b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_mdio.c index d3cbacedb..b6fccbbcd 100644 --- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_mdio.c +++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_mdio.c @@ -106,7 +106,10 @@ static int ag71xx_mdio_reset(struct mii_bus *bus) struct ag71xx_mdio *am = bus->priv; u32 t; - t = MII_CFG_CLK_DIV_28; + if (am->pdata->is_ar7240) + t = MII_CFG_CLK_DIV_6; + else + t = MII_CFG_CLK_DIV_28; ag71xx_mdio_wr(am, AG71XX_REG_MII_CFG, t | MII_CFG_RESET); udelay(100); @@ -143,12 +146,20 @@ static int __init ag71xx_mdio_probe(struct platform_device *pdev) if (ag71xx_mdio_bus) return -EBUSY; + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "no platform data specified\n"); + return -EINVAL; + } + am = kzalloc(sizeof(*am), GFP_KERNEL); if (!am) { err = -ENOMEM; goto err_out; } + am->pdata = pdata; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { dev_err(&pdev->dev, "no iomem resource found\n"); @@ -177,10 +188,7 @@ static int __init ag71xx_mdio_probe(struct platform_device *pdev) am->mii_bus->priv = am; am->mii_bus->parent = &pdev->dev; snprintf(am->mii_bus->id, MII_BUS_ID_SIZE, "%x", 0); - - pdata = pdev->dev.platform_data; - if (pdata) - am->mii_bus->phy_mask = pdata->phy_mask; + am->mii_bus->phy_mask = pdata->phy_mask; for (i = 0; i < PHY_MAX_ADDR; i++) am->mii_irq[i] = PHY_POLL; From 1d2b1e7279a8096a331d5fc33f914d6dfa082526 Mon Sep 17 00:00:00 2001 From: juhosg Date: Fri, 30 Oct 2009 12:26:25 +0000 Subject: [PATCH 033/288] ar71xx: add preliminary support for the TL-WR841ND v5 board git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18226 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/image/Makefile | 5 +++++ tools/firmware-utils/src/mktplinkfw.c | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 577758a32..dac7ded01 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -345,6 +345,10 @@ define Image/Build/Profile/TLWR841NDV3 $(call Image/Build/Template/TPLINK/$(1),tl-wr841ndv3,board=TL-WR941ND,TL-WR841NDv3) endef +define Image/Build/Profile/TLWR841NDV5 + $(call Image/Build/Template/TPLINK4K/$(1),tl-wr841ndv5,board=TL-WR741ND,TL-WR841NDv5) +endef + define Image/Build/Profile/TLWR941NDV2 $(call Image/Build/Template/TPLINK/$(1),tl-wr941ndv2,board=TL-WR941ND,TL-WR941NDv2) endef @@ -367,6 +371,7 @@ define Image/Build/Profile/Default $(call Image/Build/Profile/TEW652BRP,$(1)) $(call Image/Build/Profile/TLWR741NDV1,$(1)) $(call Image/Build/Profile/TLWR841NDV3,$(1)) + $(call Image/Build/Profile/TLWR841NDV5,$(1)) $(call Image/Build/Profile/TLWR941NDV2,$(1)) $(call Image/Build/Profile/UBNT,$(1)) $(call Image/Build/Profile/WP543,$(1)) diff --git a/tools/firmware-utils/src/mktplinkfw.c b/tools/firmware-utils/src/mktplinkfw.c index 9bb353eb6..cb6a59bea 100644 --- a/tools/firmware-utils/src/mktplinkfw.c +++ b/tools/firmware-utils/src/mktplinkfw.c @@ -35,6 +35,7 @@ #define HEADER_VERSION_V1 0x01000000 #define HWID_TL_WR741ND_V1 0x07410001 #define HWID_TL_WR841ND_V3 0x08410003 +#define HWID_TL_WR841ND_V5 0x08410005 #define HWID_TL_WR941ND_V2 0x09410002 #define MD5SUM_LEN 16 @@ -119,6 +120,14 @@ static struct board_info boards[] = { .kernel_la = 0x80060000, .kernel_ep = 0x80060000, .rootfs_ofs = 0x140000, + }, { + .id = "TL-WR841NDv5", + .hw_id = HWID_TL_WR841ND_V5, + .hw_rev = 1, + .fw_max_len = 0x3c0000, + .kernel_la = 0x80060000, + .kernel_ep = 0x80060000, + .rootfs_ofs = 0x140000, }, { .id = "TL-WR941NDv2", .hw_id = HWID_TL_WR941ND_V2, From ad1488bf57c3db4f1a542a77107903e487aeb82d Mon Sep 17 00:00:00 2001 From: juhosg Date: Fri, 30 Oct 2009 12:26:28 +0000 Subject: [PATCH 034/288] ar71xx: sync 2.6.31 kernel config git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18227 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/config-2.6.31 | 6 ------ 1 file changed, 6 deletions(-) diff --git a/target/linux/ar71xx/config-2.6.31 b/target/linux/ar71xx/config-2.6.31 index 0d29388da..bc817fdc3 100644 --- a/target/linux/ar71xx/config-2.6.31 +++ b/target/linux/ar71xx/config-2.6.31 @@ -34,7 +34,6 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ATHEROS_AR71XX=y CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set -# CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y # CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set @@ -42,7 +41,6 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CEVT_R4K=y CONFIG_CEVT_R4K_LIB=y CONFIG_CMDLINE="rootfstype=squashfs,yaffs,jffs2 noinitrd console=ttyS0,115200" -CONFIG_CONSTRUCTORS=y CONFIG_CPU_BIG_ENDIAN=y # CONFIG_CPU_CAVIUM_OCTEON is not set CONFIG_CPU_HAS_LLSC=y @@ -100,8 +98,6 @@ CONFIG_HAS_IOPORT=y CONFIG_HAVE_ARCH_KGDB=y # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set CONFIG_HAVE_IDE=y -CONFIG_HAVE_MLOCK=y -CONFIG_HAVE_MLOCKED_PAGE_BIT=y CONFIG_HAVE_OPROFILE=y CONFIG_HW_HAS_PCI=y # CONFIG_HW_RANDOM is not set @@ -193,7 +189,6 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=1 # CONFIG_SIBYTE_SENTOSA is not set # CONFIG_SIBYTE_SWARM is not set # CONFIG_SLAB is not set -# CONFIG_SLOW_WORK is not set CONFIG_SLUB=y CONFIG_SPI=y CONFIG_SPI_AP83=y @@ -213,7 +208,6 @@ CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y # CONFIG_TC35815 is not set CONFIG_TICK_ONESHOT=y -CONFIG_TRACING_SUPPORT=y CONFIG_TRAD_SIGNALS=y CONFIG_USB_SUPPORT=y CONFIG_YAFFS_9BYTE_TAGS=y From db0cb2eef522b43a8c58c8ef6133bcd5facff551 Mon Sep 17 00:00:00 2001 From: florian Date: Fri, 30 Oct 2009 14:14:53 +0000 Subject: [PATCH 035/288] [package] fix siit compilation failures on brcm-2.4 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18228 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/siit/src/siit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/siit/src/siit.c b/package/siit/src/siit.c index c645a2580..f458f5de4 100644 --- a/package/siit/src/siit.c +++ b/package/siit/src/siit.c @@ -1386,7 +1386,7 @@ static bool header_ops_init = false; static struct header_ops siit_header_ops ____cacheline_aligned; #endif -#ifndef CONFIG_COMPAT_NET_DEV_OPS +#if !(defined CONFIG_COMPAT_NET_DEV_OPS) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) static const struct net_device_ops siit_netdev_ops = { .ndo_open = siit_open, .ndo_stop = siit_release, @@ -1413,7 +1413,7 @@ siit_init(struct net_device *dev) dev->stop = siit_release; dev->hard_start_xmit = siit_xmit; #else -#ifndef CONFIG_COMPAT_NET_DEV_OPS +#if !(defined CONFIG_COMPAT_NET_DEV_OPS) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) dev->netdev_ops = &siit_netdev_ops; #endif #endif From a1509a7028c70d1c9d2244b3717a8dad06e0011e Mon Sep 17 00:00:00 2001 From: juhosg Date: Fri, 30 Oct 2009 15:15:41 +0000 Subject: [PATCH 036/288] ramips: register ethernet device on the WHR-G300N and V22RW-2x2 boards git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18229 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../linux/ramips/files/arch/mips/ralink/rt305x/mach-v22rw-2x2.c | 2 +- .../linux/ramips/files/arch/mips/ralink/rt305x/mach-whr-g300n.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-v22rw-2x2.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-v22rw-2x2.c index 8bd2c956f..64466e2ee 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-v22rw-2x2.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-v22rw-2x2.c @@ -85,7 +85,7 @@ static void __init v22rw_2x2_init(void) rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); rt305x_register_flash(0, &v22rw_2x2_flash_data); - + rt305x_register_ethernet(); ramips_register_gpio_leds(-1, ARRAY_SIZE(v22rw_2x2_leds_gpio), v22rw_2x2_leds_gpio); } diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-whr-g300n.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-whr-g300n.c index 2c2f44469..e4c5988d6 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-whr-g300n.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-whr-g300n.c @@ -92,7 +92,7 @@ static void __init whr_g300n_init(void) rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); rt305x_register_flash(0, &whr_g300n_flash_data); - + rt305x_register_ethernet(); ramips_register_gpio_leds(-1, ARRAY_SIZE(whr_g300n_leds_gpio), whr_g300n_leds_gpio); } From ddcb850f7be988c15d4bd2780608c8461af3e160 Mon Sep 17 00:00:00 2001 From: florian Date: Fri, 30 Oct 2009 16:24:20 +0000 Subject: [PATCH 037/288] [kernel] fix build failures on include/scsi/scsi.h, spotted by udev compilation git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18230 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches-2.6.30/430-scsi_header_fix.patch | 17 +++++++++++++++++ .../patches-2.6.31/430-scsi_header_fix.patch | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 target/linux/generic-2.6/patches-2.6.30/430-scsi_header_fix.patch create mode 100644 target/linux/generic-2.6/patches-2.6.31/430-scsi_header_fix.patch diff --git a/target/linux/generic-2.6/patches-2.6.30/430-scsi_header_fix.patch b/target/linux/generic-2.6/patches-2.6.30/430-scsi_header_fix.patch new file mode 100644 index 000000000..575bec92d --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.30/430-scsi_header_fix.patch @@ -0,0 +1,17 @@ +--- a/include/scsi/scsi.h ++++ b/include/scsi/scsi.h +@@ -142,10 +142,10 @@ struct scsi_cmnd; + + /* defined in T10 SCSI Primary Commands-2 (SPC2) */ + struct scsi_varlen_cdb_hdr { +- u8 opcode; /* opcode always == VARIABLE_LENGTH_CMD */ +- u8 control; +- u8 misc[5]; +- u8 additional_cdb_length; /* total cdb length - 8 */ ++ __u8 opcode; /* opcode always == VARIABLE_LENGTH_CMD */ ++ __u8 control; ++ __u8 misc[5]; ++ __u8 additional_cdb_length; /* total cdb length - 8 */ + __be16 service_action; + /* service specific data follows */ + }; diff --git a/target/linux/generic-2.6/patches-2.6.31/430-scsi_header_fix.patch b/target/linux/generic-2.6/patches-2.6.31/430-scsi_header_fix.patch new file mode 100644 index 000000000..575bec92d --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.31/430-scsi_header_fix.patch @@ -0,0 +1,17 @@ +--- a/include/scsi/scsi.h ++++ b/include/scsi/scsi.h +@@ -142,10 +142,10 @@ struct scsi_cmnd; + + /* defined in T10 SCSI Primary Commands-2 (SPC2) */ + struct scsi_varlen_cdb_hdr { +- u8 opcode; /* opcode always == VARIABLE_LENGTH_CMD */ +- u8 control; +- u8 misc[5]; +- u8 additional_cdb_length; /* total cdb length - 8 */ ++ __u8 opcode; /* opcode always == VARIABLE_LENGTH_CMD */ ++ __u8 control; ++ __u8 misc[5]; ++ __u8 additional_cdb_length; /* total cdb length - 8 */ + __be16 service_action; + /* service specific data follows */ + }; From 15e0985ea537d60b0527a2d57a9ecba1c84f04cf Mon Sep 17 00:00:00 2001 From: florian Date: Fri, 30 Oct 2009 16:24:52 +0000 Subject: [PATCH 038/288] [rdc] refresh 2.6.30 kernel patches git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18231 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches-2.6.30/001-rdc3210_flash_map.patch | 2 +- .../rdc/patches-2.6.30/003-rootfstype.patch | 2 +- .../patches-2.6.30/005-fix_amit_breakage.patch | 2 +- .../rdc/patches-2.6.30/008-r8610_flash_map.patch | 16 ++++++---------- .../009-rdc321x_select_embedded.patch | 6 +++--- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/target/linux/rdc/patches-2.6.30/001-rdc3210_flash_map.patch b/target/linux/rdc/patches-2.6.30/001-rdc3210_flash_map.patch index 2c35b841a..d1ac2e7b6 100644 --- a/target/linux/rdc/patches-2.6.30/001-rdc3210_flash_map.patch +++ b/target/linux/rdc/patches-2.6.30/001-rdc3210_flash_map.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig -@@ -112,6 +112,50 @@ config MTD_SUN_UFLASH +@@ -123,6 +123,50 @@ config MTD_SUN_UFLASH Sun Microsystems boardsets. This driver will require CFI support in the kernel, so if you did not enable CFI previously, do that now. diff --git a/target/linux/rdc/patches-2.6.30/003-rootfstype.patch b/target/linux/rdc/patches-2.6.30/003-rootfstype.patch index 386e63897..e7ed527ca 100644 --- a/target/linux/rdc/patches-2.6.30/003-rootfstype.patch +++ b/target/linux/rdc/patches-2.6.30/003-rootfstype.patch @@ -1,6 +1,6 @@ --- a/init/do_mounts.c +++ b/init/do_mounts.c -@@ -189,6 +189,8 @@ static void __init get_fs_names(char *pa +@@ -191,6 +191,8 @@ static void __init get_fs_names(char *pa { char *s = page; diff --git a/target/linux/rdc/patches-2.6.30/005-fix_amit_breakage.patch b/target/linux/rdc/patches-2.6.30/005-fix_amit_breakage.patch index 8103e841d..92bce802b 100644 --- a/target/linux/rdc/patches-2.6.30/005-fix_amit_breakage.patch +++ b/target/linux/rdc/patches-2.6.30/005-fix_amit_breakage.patch @@ -21,7 +21,7 @@ /* * Invoke the realmode switch hook if present; otherwise -@@ -156,6 +159,16 @@ void go_to_protected_mode(void) +@@ -112,6 +115,16 @@ void go_to_protected_mode(void) die(); } diff --git a/target/linux/rdc/patches-2.6.30/008-r8610_flash_map.patch b/target/linux/rdc/patches-2.6.30/008-r8610_flash_map.patch index e0ccb83cc..b374c0616 100644 --- a/target/linux/rdc/patches-2.6.30/008-r8610_flash_map.patch +++ b/target/linux/rdc/patches-2.6.30/008-r8610_flash_map.patch @@ -1,8 +1,6 @@ -Index: linux-2.6.29.5/drivers/mtd/maps/Kconfig -=================================================================== ---- linux-2.6.29.5.orig/drivers/mtd/maps/Kconfig 2009-06-19 11:26:44.000000000 +0200 -+++ linux-2.6.29.5/drivers/mtd/maps/Kconfig 2009-06-19 11:26:45.000000000 +0200 -@@ -167,6 +167,12 @@ +--- a/drivers/mtd/maps/Kconfig ++++ b/drivers/mtd/maps/Kconfig +@@ -167,6 +167,12 @@ config MTD_RDC3210_BUSWIDTH Number of bytes addressed on the RDC-3210 flash device before addressing the same chip again @@ -15,11 +13,9 @@ Index: linux-2.6.29.5/drivers/mtd/maps/Kconfig config MTD_SC520CDP tristate "CFI Flash device mapped on AMD SC520 CDP" depends on X86 && MTD_CFI && MTD_CONCAT -Index: linux-2.6.29.5/drivers/mtd/maps/Makefile -=================================================================== ---- linux-2.6.29.5.orig/drivers/mtd/maps/Makefile 2009-06-19 11:26:44.000000000 +0200 -+++ linux-2.6.29.5/drivers/mtd/maps/Makefile 2009-06-19 11:26:45.000000000 +0200 -@@ -28,6 +28,7 @@ +--- a/drivers/mtd/maps/Makefile ++++ b/drivers/mtd/maps/Makefile +@@ -28,6 +28,7 @@ obj-$(CONFIG_MTD_PMC_MSP_EVM) += pmcms obj-$(CONFIG_MTD_PMC_MSP_RAMROOT)+= pmcmsp-ramroot.o obj-$(CONFIG_MTD_PCMCIA) += pcmciamtd.o obj-$(CONFIG_MTD_RDC3210) += rdc3210.o diff --git a/target/linux/rdc/patches-2.6.30/009-rdc321x_select_embedded.patch b/target/linux/rdc/patches-2.6.30/009-rdc321x_select_embedded.patch index 84ab6c5c2..0e0e1192b 100644 --- a/target/linux/rdc/patches-2.6.30/009-rdc321x_select_embedded.patch +++ b/target/linux/rdc/patches-2.6.30/009-rdc321x_select_embedded.patch @@ -1,6 +1,6 @@ ---- a/arch/x86/Kconfig 2009-06-19 15:06:16.000000000 +0200 -+++ b/arch/x86/Kconfig 2009-06-19 15:06:01.000000000 +0200 -@@ -380,6 +380,7 @@ +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig +@@ -380,6 +380,7 @@ config X86_RDC321X depends on X86_EXTENDED_PLATFORM select M486 select X86_REBOOTFIXUPS From 06c8c0c238e9b7a600fd5bb0ed3025e9380b6c35 Mon Sep 17 00:00:00 2001 From: agb Date: Fri, 30 Oct 2009 22:52:27 +0000 Subject: [PATCH 039/288] use $(HOST_CFLAGS) when not cross-compiling. Thanks Daniel Gimpelevich git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18232 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- include/host-build.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/include/host-build.mk b/include/host-build.mk index 2da41cc08..8eb49c8f4 100644 --- a/include/host-build.mk +++ b/include/host-build.mk @@ -36,6 +36,7 @@ define Host/Prepare endef HOST_CONFIGURE_VARS = \ + CFLAGS="$(HOST_CFLAGS)" \ CPPFLAGS="$(HOST_CFLAGS)" \ LDFLAGS="$(HOST_LDFLAGS)" \ SHELL="$(BASH)" From aa196b361191e3498cd8b96f0669722a4742cca2 Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 31 Oct 2009 12:28:55 +0000 Subject: [PATCH 040/288] [package] kmod-libertas needs kmod-lib80211 to load git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18244 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile index d3f81365a..1367d9a24 100644 --- a/package/mac80211/Makefile +++ b/package/mac80211/Makefile @@ -330,7 +330,6 @@ define KernelPackage/ath9k/config source "$(SOURCE)/Config.in.ath9k" endef - USB8388FW_NAME:=usb8388 USB8388FW_VERSION:=5.110.22.p23 @@ -343,7 +342,7 @@ $(eval $(call Download,usb8388)) define KernelPackage/libertas $(call KernelPackage/mac80211/Default) - DEPENDS+= @USB_SUPPORT +kmod-mac80211 +kmod-usb-core + DEPENDS+= @USB_SUPPORT +kmod-mac80211 +kmod-usb-core +kmod-lib80211 TITLE:=Marvell 88W8015 Wireless Driver FILES:= \ $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas.$(LINUX_KMOD_SUFFIX) \ From 56311db0caafbe6087b438cb06baf831bfb9cba4 Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 31 Oct 2009 12:29:14 +0000 Subject: [PATCH 041/288] [olpc] alway include kmod-libertas by default git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18245 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/olpc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/olpc/Makefile b/target/linux/olpc/Makefile index 9e7b11427..fb535c976 100644 --- a/target/linux/olpc/Makefile +++ b/target/linux/olpc/Makefile @@ -14,7 +14,7 @@ FEATURES:=squashfs ext2 LINUX_VERSION:=2.6.30.9 include $(INCLUDE_DIR)/target.mk -DEFAULT_PACKAGES += kmod-natsemi kmod-ne2k-pci +DEFAULT_PACKAGES += kmod-natsemi kmod-ne2k-pci kmod-libertas $(eval $(call Target,generic)) $(eval $(call BuildTarget)) From 2d033cdc390e1458704378997edd1ba3d4b04d97 Mon Sep 17 00:00:00 2001 From: juhosg Date: Sat, 31 Oct 2009 20:10:30 +0000 Subject: [PATCH 042/288] ixp4xx: remove bogus 'eth%d: MII PHY x on NPE-x' messages git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18251 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ...05-npe_driver_separate_phy_functions.patch | 15 ++++++-------- ...-npe_driver_add_update_link_function.patch | 20 +++++++++---------- .../207-npe_driver_multiphy_support.patch | 6 +++--- .../304-ixp4xx_eth_jumboframe.patch | 6 +++--- ...05-npe_driver_separate_phy_functions.patch | 15 ++++++-------- ...-npe_driver_add_update_link_function.patch | 20 +++++++++---------- .../207-npe_driver_multiphy_support.patch | 6 +++--- .../304-ixp4xx_eth_jumboframe.patch | 6 +++--- 8 files changed, 44 insertions(+), 50 deletions(-) diff --git a/target/linux/ixp4xx/patches-2.6.30/205-npe_driver_separate_phy_functions.patch b/target/linux/ixp4xx/patches-2.6.30/205-npe_driver_separate_phy_functions.patch index 6120176b6..d96265812 100644 --- a/target/linux/ixp4xx/patches-2.6.30/205-npe_driver_separate_phy_functions.patch +++ b/target/linux/ixp4xx/patches-2.6.30/205-npe_driver_separate_phy_functions.patch @@ -1,6 +1,6 @@ --- a/drivers/net/arm/ixp4xx_eth.c +++ b/drivers/net/arm/ixp4xx_eth.c -@@ -396,6 +396,53 @@ static void ixp4xx_adjust_link(struct ne +@@ -396,6 +396,50 @@ static void ixp4xx_adjust_link(struct ne dev->name, port->speed, port->duplex ? "full" : "half"); } @@ -24,9 +24,6 @@ + + port->phydev->irq = PHY_POLL; + -+ printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy, -+ npe_name(port->npe)); -+ + return 0; +} + @@ -54,7 +51,7 @@ static inline void debug_pkt(struct net_device *dev, const char *func, u8 *data, int len) -@@ -1003,8 +1050,7 @@ static int eth_open(struct net_device *d +@@ -1003,8 +1047,7 @@ static int eth_open(struct net_device *d return err; } @@ -64,7 +61,7 @@ for (i = 0; i < ETH_ALEN; i++) __raw_writel(dev->dev_addr[i], &port->regs->hw_addr[i]); -@@ -1125,7 +1171,7 @@ static int eth_close(struct net_device * +@@ -1125,7 +1168,7 @@ static int eth_close(struct net_device * printk(KERN_CRIT "%s: unable to disable loopback\n", dev->name); @@ -73,7 +70,7 @@ if (!ports_open) qmgr_disable_irq(TXDONE_QUEUE); -@@ -1151,7 +1197,6 @@ static int __devinit eth_init_one(struct +@@ -1151,7 +1194,6 @@ static int __devinit eth_init_one(struct struct net_device *dev; struct eth_plat_info *plat = pdev->dev.platform_data; u32 regs_phys; @@ -81,7 +78,7 @@ int err; if (!(dev = alloc_etherdev(sizeof(struct port)))) -@@ -1209,18 +1254,10 @@ static int __devinit eth_init_one(struct +@@ -1209,18 +1251,10 @@ static int __devinit eth_init_one(struct __raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control); udelay(50); @@ -102,7 +99,7 @@ if ((err = register_netdev(dev))) goto err_phy_dis; -@@ -1247,7 +1284,7 @@ static int __devexit eth_remove_one(stru +@@ -1247,7 +1281,7 @@ static int __devexit eth_remove_one(stru struct net_device *dev = platform_get_drvdata(pdev); struct port *port = netdev_priv(dev); diff --git a/target/linux/ixp4xx/patches-2.6.30/206-npe_driver_add_update_link_function.patch b/target/linux/ixp4xx/patches-2.6.30/206-npe_driver_add_update_link_function.patch index 9529cce2c..f12c671a3 100644 --- a/target/linux/ixp4xx/patches-2.6.30/206-npe_driver_add_update_link_function.patch +++ b/target/linux/ixp4xx/patches-2.6.30/206-npe_driver_add_update_link_function.patch @@ -77,9 +77,17 @@ static int ixp4xx_phy_connect(struct net_device *dev) { struct port *port = netdev_priv(dev); -@@ -416,6 +431,10 @@ static int ixp4xx_phy_connect(struct net +@@ -430,7 +445,6 @@ static void ixp4xx_phy_start(struct net_ + { + struct port *port = netdev_priv(dev); - port->phydev->irq = PHY_POLL; +- port->speed = 0; /* force "link up" message */ + phy_start(port->phydev); + } + +@@ -1258,6 +1272,10 @@ static int __devinit eth_init_one(struct + if ((err = register_netdev(dev))) + goto err_phy_dis; + port->link = 0; + port->speed = 0; @@ -88,11 +96,3 @@ printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy, npe_name(port->npe)); -@@ -433,7 +452,6 @@ static void ixp4xx_phy_start(struct net_ - { - struct port *port = netdev_priv(dev); - -- port->speed = 0; /* force "link up" message */ - phy_start(port->phydev); - } - diff --git a/target/linux/ixp4xx/patches-2.6.30/207-npe_driver_multiphy_support.patch b/target/linux/ixp4xx/patches-2.6.30/207-npe_driver_multiphy_support.patch index 4f2f8bbdb..a3866a908 100644 --- a/target/linux/ixp4xx/patches-2.6.30/207-npe_driver_multiphy_support.patch +++ b/target/linux/ixp4xx/patches-2.6.30/207-npe_driver_multiphy_support.patch @@ -75,7 +75,7 @@ TODO: take care of additional PHYs through the PHY abstraction layer snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, "0", plat->phy); port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0, PHY_INTERFACE_MODE_MII); -@@ -445,21 +476,32 @@ static void ixp4xx_phy_disconnect(struct +@@ -438,21 +469,32 @@ static void ixp4xx_phy_disconnect(struct { struct port *port = netdev_priv(dev); @@ -111,7 +111,7 @@ TODO: take care of additional PHYs through the PHY abstraction layer } static inline void debug_pkt(struct net_device *dev, const char *func, -@@ -831,6 +873,10 @@ static int eth_ioctl(struct net_device * +@@ -824,6 +866,10 @@ static int eth_ioctl(struct net_device * if (!netif_running(dev)) return -EINVAL; @@ -122,7 +122,7 @@ TODO: take care of additional PHYs through the PHY abstraction layer return phy_mii_ioctl(port->phydev, if_mii(req), cmd); } -@@ -850,18 +896,30 @@ static void ixp4xx_get_drvinfo(struct ne +@@ -843,18 +889,30 @@ static void ixp4xx_get_drvinfo(struct ne static int ixp4xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) { struct port *port = netdev_priv(dev); diff --git a/target/linux/ixp4xx/patches-2.6.30/304-ixp4xx_eth_jumboframe.patch b/target/linux/ixp4xx/patches-2.6.30/304-ixp4xx_eth_jumboframe.patch index d7f5a1f56..9ee3c904c 100644 --- a/target/linux/ixp4xx/patches-2.6.30/304-ixp4xx_eth_jumboframe.patch +++ b/target/linux/ixp4xx/patches-2.6.30/304-ixp4xx_eth_jumboframe.patch @@ -9,7 +9,7 @@ #define RX_BUFF_SIZE ALIGN((NET_IP_ALIGN) + MAX_MRU, 4) #define NAPI_WEIGHT 16 -@@ -1066,6 +1066,32 @@ static void destroy_queues(struct port * +@@ -1059,6 +1059,32 @@ static void destroy_queues(struct port * } } @@ -42,7 +42,7 @@ static int eth_open(struct net_device *dev) { struct port *port = netdev_priv(dev); -@@ -1117,6 +1143,8 @@ static int eth_open(struct net_device *d +@@ -1110,6 +1136,8 @@ static int eth_open(struct net_device *d if (npe_send_recv_message(port->npe, &msg, "ETH_SET_FIREWALL_MODE")) return -EIO; @@ -51,7 +51,7 @@ if ((err = request_queues(port)) != 0) return err; -@@ -1256,7 +1284,26 @@ static int eth_close(struct net_device * +@@ -1249,7 +1277,26 @@ static int eth_close(struct net_device * return 0; } diff --git a/target/linux/ixp4xx/patches-2.6.31/205-npe_driver_separate_phy_functions.patch b/target/linux/ixp4xx/patches-2.6.31/205-npe_driver_separate_phy_functions.patch index c1fc76d2a..857d959a4 100644 --- a/target/linux/ixp4xx/patches-2.6.31/205-npe_driver_separate_phy_functions.patch +++ b/target/linux/ixp4xx/patches-2.6.31/205-npe_driver_separate_phy_functions.patch @@ -1,6 +1,6 @@ --- a/drivers/net/arm/ixp4xx_eth.c +++ b/drivers/net/arm/ixp4xx_eth.c -@@ -396,6 +396,53 @@ static void ixp4xx_adjust_link(struct ne +@@ -396,6 +396,50 @@ static void ixp4xx_adjust_link(struct ne dev->name, port->speed, port->duplex ? "full" : "half"); } @@ -24,9 +24,6 @@ + + port->phydev->irq = PHY_POLL; + -+ printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy, -+ npe_name(port->npe)); -+ + return 0; +} + @@ -54,7 +51,7 @@ static inline void debug_pkt(struct net_device *dev, const char *func, u8 *data, int len) -@@ -1005,8 +1052,7 @@ static int eth_open(struct net_device *d +@@ -1005,8 +1049,7 @@ static int eth_open(struct net_device *d return err; } @@ -64,7 +61,7 @@ for (i = 0; i < ETH_ALEN; i++) __raw_writel(dev->dev_addr[i], &port->regs->hw_addr[i]); -@@ -1127,7 +1173,7 @@ static int eth_close(struct net_device * +@@ -1127,7 +1170,7 @@ static int eth_close(struct net_device * printk(KERN_CRIT "%s: unable to disable loopback\n", dev->name); @@ -73,7 +70,7 @@ if (!ports_open) qmgr_disable_irq(TXDONE_QUEUE); -@@ -1153,7 +1199,6 @@ static int __devinit eth_init_one(struct +@@ -1153,7 +1196,6 @@ static int __devinit eth_init_one(struct struct net_device *dev; struct eth_plat_info *plat = pdev->dev.platform_data; u32 regs_phys; @@ -81,7 +78,7 @@ int err; if (!(dev = alloc_etherdev(sizeof(struct port)))) -@@ -1211,18 +1256,10 @@ static int __devinit eth_init_one(struct +@@ -1211,18 +1253,10 @@ static int __devinit eth_init_one(struct __raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control); udelay(50); @@ -102,7 +99,7 @@ if ((err = register_netdev(dev))) goto err_phy_dis; -@@ -1249,7 +1286,7 @@ static int __devexit eth_remove_one(stru +@@ -1249,7 +1283,7 @@ static int __devexit eth_remove_one(stru struct net_device *dev = platform_get_drvdata(pdev); struct port *port = netdev_priv(dev); diff --git a/target/linux/ixp4xx/patches-2.6.31/206-npe_driver_add_update_link_function.patch b/target/linux/ixp4xx/patches-2.6.31/206-npe_driver_add_update_link_function.patch index 9529cce2c..419ec4cdb 100644 --- a/target/linux/ixp4xx/patches-2.6.31/206-npe_driver_add_update_link_function.patch +++ b/target/linux/ixp4xx/patches-2.6.31/206-npe_driver_add_update_link_function.patch @@ -77,9 +77,17 @@ static int ixp4xx_phy_connect(struct net_device *dev) { struct port *port = netdev_priv(dev); -@@ -416,6 +431,10 @@ static int ixp4xx_phy_connect(struct net +@@ -430,7 +445,6 @@ static void ixp4xx_phy_start(struct net_ + { + struct port *port = netdev_priv(dev); - port->phydev->irq = PHY_POLL; +- port->speed = 0; /* force "link up" message */ + phy_start(port->phydev); + } + +@@ -1260,6 +1274,10 @@ static int __devinit eth_init_one(struct + if ((err = register_netdev(dev))) + goto err_phy_dis; + port->link = 0; + port->speed = 0; @@ -88,11 +96,3 @@ printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy, npe_name(port->npe)); -@@ -433,7 +452,6 @@ static void ixp4xx_phy_start(struct net_ - { - struct port *port = netdev_priv(dev); - -- port->speed = 0; /* force "link up" message */ - phy_start(port->phydev); - } - diff --git a/target/linux/ixp4xx/patches-2.6.31/207-npe_driver_multiphy_support.patch b/target/linux/ixp4xx/patches-2.6.31/207-npe_driver_multiphy_support.patch index 3eefdcc8c..afcf7e156 100644 --- a/target/linux/ixp4xx/patches-2.6.31/207-npe_driver_multiphy_support.patch +++ b/target/linux/ixp4xx/patches-2.6.31/207-npe_driver_multiphy_support.patch @@ -75,7 +75,7 @@ TODO: take care of additional PHYs through the PHY abstraction layer snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, "0", plat->phy); port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0, PHY_INTERFACE_MODE_MII); -@@ -445,21 +476,32 @@ static void ixp4xx_phy_disconnect(struct +@@ -438,21 +469,32 @@ static void ixp4xx_phy_disconnect(struct { struct port *port = netdev_priv(dev); @@ -111,7 +111,7 @@ TODO: take care of additional PHYs through the PHY abstraction layer } static inline void debug_pkt(struct net_device *dev, const char *func, -@@ -833,6 +875,10 @@ static int eth_ioctl(struct net_device * +@@ -826,6 +868,10 @@ static int eth_ioctl(struct net_device * if (!netif_running(dev)) return -EINVAL; @@ -122,7 +122,7 @@ TODO: take care of additional PHYs through the PHY abstraction layer return phy_mii_ioctl(port->phydev, if_mii(req), cmd); } -@@ -852,18 +898,30 @@ static void ixp4xx_get_drvinfo(struct ne +@@ -845,18 +891,30 @@ static void ixp4xx_get_drvinfo(struct ne static int ixp4xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) { struct port *port = netdev_priv(dev); diff --git a/target/linux/ixp4xx/patches-2.6.31/304-ixp4xx_eth_jumboframe.patch b/target/linux/ixp4xx/patches-2.6.31/304-ixp4xx_eth_jumboframe.patch index d3d8af6ab..26f5bd953 100644 --- a/target/linux/ixp4xx/patches-2.6.31/304-ixp4xx_eth_jumboframe.patch +++ b/target/linux/ixp4xx/patches-2.6.31/304-ixp4xx_eth_jumboframe.patch @@ -9,7 +9,7 @@ #define RX_BUFF_SIZE ALIGN((NET_IP_ALIGN) + MAX_MRU, 4) #define NAPI_WEIGHT 16 -@@ -1068,6 +1068,32 @@ static void destroy_queues(struct port * +@@ -1061,6 +1061,32 @@ static void destroy_queues(struct port * } } @@ -42,7 +42,7 @@ static int eth_open(struct net_device *dev) { struct port *port = netdev_priv(dev); -@@ -1119,6 +1145,8 @@ static int eth_open(struct net_device *d +@@ -1112,6 +1138,8 @@ static int eth_open(struct net_device *d if (npe_send_recv_message(port->npe, &msg, "ETH_SET_FIREWALL_MODE")) return -EIO; @@ -51,7 +51,7 @@ if ((err = request_queues(port)) != 0) return err; -@@ -1258,7 +1286,26 @@ static int eth_close(struct net_device * +@@ -1251,7 +1279,26 @@ static int eth_close(struct net_device * return 0; } From f622ac94c8cb804e6abd8cd45edf42d7cdeb3678 Mon Sep 17 00:00:00 2001 From: juhosg Date: Sat, 31 Oct 2009 20:10:34 +0000 Subject: [PATCH 043/288] ixp4xx: the missing phy_disconnect call has been added in upstream, remove that patch git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18252 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ...pe_driver_add_missing_phy_disconnect.patch | 10 ---------- ...05-npe_driver_separate_phy_functions.patch | 19 ++++++++++++++----- ...pe_driver_add_missing_phy_disconnect.patch | 10 ---------- ...05-npe_driver_separate_phy_functions.patch | 17 +++++++++++++---- 4 files changed, 27 insertions(+), 29 deletions(-) delete mode 100644 target/linux/ixp4xx/patches-2.6.30/204-npe_driver_add_missing_phy_disconnect.patch delete mode 100644 target/linux/ixp4xx/patches-2.6.31/204-npe_driver_add_missing_phy_disconnect.patch diff --git a/target/linux/ixp4xx/patches-2.6.30/204-npe_driver_add_missing_phy_disconnect.patch b/target/linux/ixp4xx/patches-2.6.30/204-npe_driver_add_missing_phy_disconnect.patch deleted file mode 100644 index 6663733db..000000000 --- a/target/linux/ixp4xx/patches-2.6.30/204-npe_driver_add_missing_phy_disconnect.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/net/arm/ixp4xx_eth.c -+++ b/drivers/net/arm/ixp4xx_eth.c -@@ -1247,6 +1247,7 @@ static int __devexit eth_remove_one(stru - struct net_device *dev = platform_get_drvdata(pdev); - struct port *port = netdev_priv(dev); - -+ phy_disconnect(port->phydev); - unregister_netdev(dev); - phy_disconnect(port->phydev); - npe_port_tab[NPE_ID(port->id)] = NULL; diff --git a/target/linux/ixp4xx/patches-2.6.30/205-npe_driver_separate_phy_functions.patch b/target/linux/ixp4xx/patches-2.6.30/205-npe_driver_separate_phy_functions.patch index d96265812..53fa05e1b 100644 --- a/target/linux/ixp4xx/patches-2.6.30/205-npe_driver_separate_phy_functions.patch +++ b/target/linux/ixp4xx/patches-2.6.30/205-npe_driver_separate_phy_functions.patch @@ -99,12 +99,21 @@ if ((err = register_netdev(dev))) goto err_phy_dis; -@@ -1247,7 +1281,7 @@ static int __devexit eth_remove_one(stru - struct net_device *dev = platform_get_drvdata(pdev); - struct port *port = netdev_priv(dev); +@@ -1230,7 +1264,7 @@ static int __devinit eth_init_one(struct + return 0; + err_phy_dis: - phy_disconnect(port->phydev); + ixp4xx_phy_disconnect(dev); - unregister_netdev(dev); - phy_disconnect(port->phydev); + err_free_mem: npe_port_tab[NPE_ID(port->id)] = NULL; + platform_set_drvdata(pdev, NULL); +@@ -1248,7 +1282,7 @@ static int __devexit eth_remove_one(stru + struct port *port = netdev_priv(dev); + + unregister_netdev(dev); +- phy_disconnect(port->phydev); ++ ixp4xx_phy_disconnect(dev); + npe_port_tab[NPE_ID(port->id)] = NULL; + platform_set_drvdata(pdev, NULL); + npe_release(port->npe); diff --git a/target/linux/ixp4xx/patches-2.6.31/204-npe_driver_add_missing_phy_disconnect.patch b/target/linux/ixp4xx/patches-2.6.31/204-npe_driver_add_missing_phy_disconnect.patch deleted file mode 100644 index b77dc0633..000000000 --- a/target/linux/ixp4xx/patches-2.6.31/204-npe_driver_add_missing_phy_disconnect.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/net/arm/ixp4xx_eth.c -+++ b/drivers/net/arm/ixp4xx_eth.c -@@ -1249,6 +1249,7 @@ static int __devexit eth_remove_one(stru - struct net_device *dev = platform_get_drvdata(pdev); - struct port *port = netdev_priv(dev); - -+ phy_disconnect(port->phydev); - unregister_netdev(dev); - phy_disconnect(port->phydev); - npe_port_tab[NPE_ID(port->id)] = NULL; diff --git a/target/linux/ixp4xx/patches-2.6.31/205-npe_driver_separate_phy_functions.patch b/target/linux/ixp4xx/patches-2.6.31/205-npe_driver_separate_phy_functions.patch index 857d959a4..b9835a012 100644 --- a/target/linux/ixp4xx/patches-2.6.31/205-npe_driver_separate_phy_functions.patch +++ b/target/linux/ixp4xx/patches-2.6.31/205-npe_driver_separate_phy_functions.patch @@ -99,12 +99,21 @@ if ((err = register_netdev(dev))) goto err_phy_dis; -@@ -1249,7 +1283,7 @@ static int __devexit eth_remove_one(stru - struct net_device *dev = platform_get_drvdata(pdev); +@@ -1232,7 +1266,7 @@ static int __devinit eth_init_one(struct + return 0; + + err_phy_dis: +- phy_disconnect(port->phydev); ++ ixp4xx_phy_disconnect(port->phydev); + err_free_mem: + npe_port_tab[NPE_ID(port->id)] = NULL; + platform_set_drvdata(pdev, NULL); +@@ -1250,7 +1284,7 @@ static int __devexit eth_remove_one(stru struct port *port = netdev_priv(dev); + unregister_netdev(dev); - phy_disconnect(port->phydev); + ixp4xx_phy_disconnect(dev); - unregister_netdev(dev); - phy_disconnect(port->phydev); npe_port_tab[NPE_ID(port->id)] = NULL; + platform_set_drvdata(pdev, NULL); + npe_release(port->npe); From 100ec06353e57cee2a70f851a974759ecd2af9c1 Mon Sep 17 00:00:00 2001 From: agb Date: Sun, 1 Nov 2009 01:09:56 +0000 Subject: [PATCH 044/288] [brcm-2.4] fix failsafe, was accidentally broken by r18214. Thanks Daniel Gimpelevich git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18253 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/brcm-2.4/base-files/etc/preinit.arch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/brcm-2.4/base-files/etc/preinit.arch b/target/linux/brcm-2.4/base-files/etc/preinit.arch index a90d314e2..e62360e44 100755 --- a/target/linux/brcm-2.4/base-files/etc/preinit.arch +++ b/target/linux/brcm-2.4/base-files/etc/preinit.arch @@ -47,13 +47,13 @@ check_module () { } check_module tg3 +failsafe_ip + insmod switch-core check_module switch-robo || check_module switch-adm || { check_module bcm57xx activate_gpio=0x4 && cpu_port="8u*" } || rmmod switch-core -failsafe_ip - [ -d /proc/switch/eth0 ] && { echo 1 > /proc/switch/eth0/reset From cbd083f77e670109507819d3f592cf3bf6bc6044 Mon Sep 17 00:00:00 2001 From: agb Date: Sun, 1 Nov 2009 05:34:46 +0000 Subject: [PATCH 045/288] [rdc] 2.6.28: add ZyXEL and Amit flashmapping and start fixing up GPIO support. Thanks Daniel Gimpelevich git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18254 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/rdc/config-2.6.28 | 13 +- target/linux/rdc/modules.mk | 5 + .../patches-2.6.28/002-platform_support.patch | 308 ++++++++++++++++++ .../rdc/patches-2.6.28/003-rootfstype.patch | 11 - 4 files changed, 319 insertions(+), 18 deletions(-) create mode 100644 target/linux/rdc/modules.mk create mode 100644 target/linux/rdc/patches-2.6.28/002-platform_support.patch diff --git a/target/linux/rdc/config-2.6.28 b/target/linux/rdc/config-2.6.28 index 80aecef86..7fec13148 100644 --- a/target/linux/rdc/config-2.6.28 +++ b/target/linux/rdc/config-2.6.28 @@ -33,7 +33,7 @@ CONFIG_BOUNCE=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CLASSIC_RCU=y CONFIG_CLOCKSOURCE_WATCHDOG=y -CONFIG_CMDLINE="console=ttyS0,38400" +CONFIG_CMDLINE="console=ttyS0,38400 rootfstype=squashfs,jffs2" CONFIG_CMDLINE_BOOL=y # CONFIG_CMDLINE_OVERRIDE is not set # CONFIG_COMPAT_VDSO is not set @@ -176,13 +176,12 @@ CONFIG_MTD_CMDLINE_PARTS=y # CONFIG_MTD_COMPLEX_MAPPINGS is not set CONFIG_MTD_CONCAT=y # CONFIG_MTD_NETSC520 is not set +CONFIG_MTD_PHYSMAP=y +CONFIG_MTD_PHYSMAP_BANKWIDTH=2 +CONFIG_MTD_PHYSMAP_LEN=0 +CONFIG_MTD_PHYSMAP_START=0x8000000 # CONFIG_MTD_R8610 is not set -CONFIG_MTD_RDC3210=y -CONFIG_MTD_RDC3210_ALLOW_JFFS2=y -CONFIG_MTD_RDC3210_BUSWIDTH=2 -# CONFIG_MTD_RDC3210_FACTORY_PRESENT is not set -CONFIG_MTD_RDC3210_SIZE=0x400000 -# CONFIG_MTD_RDC3210_STATIC_MAP is not set +# CONFIG_MTD_RDC3210 is not set # CONFIG_MTD_SC520CDP is not set # CONFIG_MTD_TS5500 is not set # CONFIG_MTRR is not set diff --git a/target/linux/rdc/modules.mk b/target/linux/rdc/modules.mk new file mode 100644 index 000000000..668c1c063 --- /dev/null +++ b/target/linux/rdc/modules.mk @@ -0,0 +1,5 @@ +define KernelPackage/ide-core/install + rm -f $(1)/etc/modules.d/30-ide-core +endef + + diff --git a/target/linux/rdc/patches-2.6.28/002-platform_support.patch b/target/linux/rdc/patches-2.6.28/002-platform_support.patch new file mode 100644 index 000000000..e42052ecb --- /dev/null +++ b/target/linux/rdc/patches-2.6.28/002-platform_support.patch @@ -0,0 +1,308 @@ +Index: linux-2.6.28.10/arch/x86/mach-rdc321x/gpio.c +=================================================================== +--- linux-2.6.28.10.orig/arch/x86/mach-rdc321x/gpio.c 2009-05-02 11:54:43.000000000 -0700 ++++ linux-2.6.28.10/arch/x86/mach-rdc321x/gpio.c 2009-10-30 22:24:23.779705091 -0700 +@@ -26,7 +26,7 @@ + #include + #include + +-#include ++#include + #include + + +@@ -74,8 +74,8 @@ + } + + /* initially setup the 2 copies of the gpio data registers. +- This function must be called by the platform setup code. */ +-void __init rdc321x_gpio_setup() ++ This function is called before the platform setup code. */ ++static int __init rdc321x_gpio_setup(void) + { + /* this might not be, what others (BIOS, bootloader, etc.) + wrote to these registers before, but it's a good guess. Still +@@ -83,6 +83,8 @@ + + gpio_data_reg1 = rdc321x_conf_read(RDC321X_GPIO_DATA_REG1); + gpio_data_reg2 = rdc321x_conf_read(RDC321X_GPIO_DATA_REG2); ++ ++ return 0; + } + + /* determine, if gpio number is valid */ +@@ -192,3 +194,5 @@ + return 0; + } + EXPORT_SYMBOL(rdc_gpio_direction_output); ++ ++arch_initcall(rdc321x_gpio_setup); +Index: linux-2.6.28.10/arch/x86/mach-rdc321x/platform.c +=================================================================== +--- linux-2.6.28.10.orig/arch/x86/mach-rdc321x/platform.c 2009-05-02 11:54:43.000000000 -0700 ++++ linux-2.6.28.10/arch/x86/mach-rdc321x/platform.c 2009-10-30 22:37:01.595670310 -0700 +@@ -1,7 +1,9 @@ + /* + * Generic RDC321x platform devices + * ++ * Copyright (C) 2007-2008 OpenWrt.org + * Copyright (C) 2007 Florian Fainelli ++ * Copyright (C) 2008 Daniel Gimpelevich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License +@@ -25,13 +27,59 @@ + #include + #include + #include ++#include + #include ++#include ++#include ++#include ++#include ++#include ++#include + +-#include ++#include ++ ++/* Flash */ ++#ifdef CONFIG_MTD_R8610 ++#define CONFIG_MTD_RDC3210 1 ++#elif defined CONFIG_MTD_RDC3210 ++static struct resource rdc_flash_resource[] = { ++ [0] = { ++ .start = (u32)-CONFIG_MTD_RDC3210_SIZE, ++ .end = (u32)-1, ++ .flags = IORESOURCE_MEM, ++ }, ++}; ++ ++static struct platform_device rdc_flash_device = { ++ .name = "rdc321x-flash", ++ .id = -1, ++ .num_resources = ARRAY_SIZE(rdc_flash_resource), ++ .resource = rdc_flash_resource, ++}; ++#else ++static struct mtd_partition rdc_flash_parts[15]; ++ ++static struct resource rdc_flash_resource = { ++ .end = (u32)-1, ++ .flags = IORESOURCE_MEM, ++}; ++ ++static struct physmap_flash_data rdc_flash_data = { ++ .parts = rdc_flash_parts, ++}; ++ ++static struct platform_device rdc_flash_device = { ++ .name = "physmap-flash", ++ .id = -1, ++ .resource = &rdc_flash_resource, ++ .num_resources = 1, ++ .dev.platform_data = &rdc_flash_data, ++}; ++#endif + + /* LEDS */ + static struct gpio_led default_leds[] = { +- { .name = "rdc:dmz", .gpio = 1, }, ++ { .name = "rdc321x:dmz", .gpio = 1, }, + }; + + static struct gpio_led_platform_data rdc321x_led_data = { +@@ -54,16 +102,163 @@ + .num_resources = 0, + }; + ++/* Button */ ++static struct gpio_keys_button rdc321x_gpio_btn[] = { ++ { ++ .gpio = 0, ++ .code = BTN_0, ++ .desc = "Reset", ++ .active_low = 1, ++ } ++}; ++ ++static struct gpio_keys_platform_data rdc321x_gpio_btn_data = { ++ .buttons = rdc321x_gpio_btn, ++ .nbuttons = ARRAY_SIZE(rdc321x_gpio_btn), ++}; ++ ++static struct platform_device rdc321x_button = { ++ .name = "gpio-keys", ++ .id = -1, ++ .dev = { ++ .platform_data = &rdc321x_gpio_btn_data, ++ } ++}; ++ + static struct platform_device *rdc321x_devs[] = { ++ &rdc_flash_device, + &rdc321x_leds, +- &rdc321x_wdt ++ &rdc321x_wdt, ++ &rdc321x_button, + }; + ++static int probe_flash_start(struct map_info *the_map) ++{ ++ struct mtd_info *res; ++ ++ the_map->virt = ioremap(the_map->phys, the_map->size); ++ if (the_map->virt == NULL) ++ return 1; ++ for (the_map->bankwidth = 32; the_map->bankwidth; the_map->bankwidth ++ >>= 1) { ++ res = do_map_probe("cfi_probe", the_map); ++ if (res == NULL) ++ res = do_map_probe("jedec_probe", the_map); ++ if (res != NULL) ++ break; ++ } ++ iounmap(the_map->virt); ++ if (res != NULL) ++ the_map->phys = (u32)-(s32)(the_map->size = res->size); ++ return res == NULL; ++} ++ + static int __init rdc_board_setup(void) + { +- rdc321x_gpio_setup(); ++#ifndef CONFIG_MTD_RDC3210 ++ struct map_info rdc_map_info; ++ u32 the_header[4]; + ++ ROOT_DEV = 0; ++ rdc_map_info.name = rdc_flash_device.name; ++ rdc_map_info.phys = 0xff000000; ++ rdc_map_info.size = 0x1000000; ++ rdc_map_info.bankwidth = 2; ++ rdc_map_info.set_vpp = NULL; ++ simple_map_init(&rdc_map_info); ++ while (probe_flash_start(&rdc_map_info)) { ++ rdc_map_info.phys++; ++ if (--rdc_map_info.size) ++ panic("Could not find start of flash!"); ++ } ++ rdc_flash_resource.start = rdc_map_info.phys; ++ rdc_flash_data.width = rdc_map_info.bankwidth; ++ rdc_map_info.virt = ioremap_nocache(rdc_map_info.phys, 0x10); ++ if (rdc_map_info.virt == NULL) ++ panic("Could not ioremap to read device magic!"); ++ the_header[0] = ((u32 *)rdc_map_info.virt)[0]; ++ the_header[1] = ((u32 *)rdc_map_info.virt)[1]; ++ the_header[2] = ((u32 *)rdc_map_info.virt)[2]; ++ the_header[3] = ((u32 *)rdc_map_info.virt)[3]; ++ iounmap(rdc_map_info.virt); ++ if (!memcmp(the_header, "GMTK", 4)) { /* Gemtek */ ++ /* TODO */ ++ } else if (!memcmp(the_header, "CSYS", 4)) { /* Sitecom */ ++ /* TODO */ ++ } else if (!memcmp(((u8 *)the_header) + 14, "Li", 2)) { /* AMIT */ ++ rdc_flash_parts[0].name = "kernel_parthdr"; ++ rdc_flash_parts[0].offset = 0; ++ rdc_flash_parts[0].size = 0x10; ++ rdc_flash_parts[1].name = "kernel"; ++ rdc_flash_parts[1].offset = 0x10; ++ rdc_flash_parts[1].size = 0xffff0; ++ rdc_flash_parts[2].name = "rootfs_parthdr"; ++ rdc_flash_parts[2].offset = 0x100000; ++ rdc_flash_parts[2].size = 0x10; ++ rdc_flash_parts[3].name = "rootfs"; ++ rdc_flash_parts[3].offset = 0x100010; ++ rdc_flash_parts[3].size = rdc_map_info.size - 0x160010; ++ rdc_flash_parts[4].name = "config_parthdr"; ++ rdc_flash_parts[4].offset = rdc_map_info.size - 0x60000; ++ rdc_flash_parts[4].size = 0x10; ++ rdc_flash_parts[5].name = "config"; ++ rdc_flash_parts[5].offset = rdc_map_info.size - 0x5fff0; ++ rdc_flash_parts[5].size = 0xfff0; ++ rdc_flash_parts[6].name = "recoveryfs_parthdr"; ++ rdc_flash_parts[6].offset = rdc_map_info.size - 0x50000; ++ rdc_flash_parts[6].size = 0x10; ++ rdc_flash_parts[7].name = "recoveryfs"; ++ rdc_flash_parts[7].offset = rdc_map_info.size - 0x4fff0; ++ rdc_flash_parts[7].size = 0x3fff0; ++ rdc_flash_parts[8].name = "recovery_parthdr"; ++ rdc_flash_parts[8].offset = rdc_map_info.size - 0x10000; ++ rdc_flash_parts[8].size = 0x10; ++ rdc_flash_parts[9].name = "recovery"; ++ rdc_flash_parts[9].offset = rdc_map_info.size - 0xfff0; ++ rdc_flash_parts[9].size = 0x7ff0; ++ rdc_flash_parts[10].name = "productinfo_parthdr"; ++ rdc_flash_parts[10].offset = rdc_map_info.size - 0x8000; ++ rdc_flash_parts[10].size = 0x10; ++ rdc_flash_parts[11].name = "productinfo"; ++ rdc_flash_parts[11].offset = rdc_map_info.size - 0x7ff0; ++ rdc_flash_parts[11].size = 0x1ff0; ++ rdc_flash_parts[12].name = "bootloader_parthdr"; ++ rdc_flash_parts[12].offset = rdc_map_info.size - 0x6000; ++ rdc_flash_parts[12].size = 0x10; ++ rdc_flash_parts[13].name = "bootloader"; ++ rdc_flash_parts[13].offset = rdc_map_info.size - 0x5ff0; ++ rdc_flash_parts[13].size = 0x5ff0; ++ rdc_flash_parts[14].name = "everything"; ++ rdc_flash_parts[14].offset = 0; ++ rdc_flash_parts[14].size = rdc_map_info.size; ++ rdc_flash_data.nr_parts = 15; ++ } else { /* ZyXEL */ ++ rdc_flash_parts[0].name = "kernel"; ++ rdc_flash_parts[0].offset = 0; ++ rdc_flash_parts[0].size = 0x100000; ++ rdc_flash_parts[1].name = "rootfs"; ++ rdc_flash_parts[1].offset = 0x100000; ++ rdc_flash_parts[1].size = rdc_map_info.size - 0x140000; ++ rdc_flash_parts[2].name = "linux"; ++ rdc_flash_parts[2].offset = 0; ++ rdc_flash_parts[2].size = rdc_map_info.size - 0x40000; ++ rdc_flash_parts[3].name = "config"; ++ rdc_flash_parts[3].offset = rdc_map_info.size - 0x40000; ++ rdc_flash_parts[3].size = 0x10000; ++ rdc_flash_parts[4].name = "productinfo"; ++ rdc_flash_parts[4].offset = rdc_map_info.size - 0x30000; ++ rdc_flash_parts[4].size = 0x10000; ++ rdc_flash_parts[5].name = "bootloader"; ++ rdc_flash_parts[5].offset = rdc_map_info.size - 0x20000; ++ rdc_flash_parts[5].size = 0x20000; ++ rdc_flash_data.nr_parts = 6; ++ } ++#endif + return platform_add_devices(rdc321x_devs, ARRAY_SIZE(rdc321x_devs)); + } + ++#ifdef CONFIG_MTD_RDC3210 + arch_initcall(rdc_board_setup); ++#else ++late_initcall(rdc_board_setup); ++#endif +Index: linux-2.6.28.10/arch/x86/Makefile +=================================================================== +--- linux-2.6.28.10.orig/arch/x86/Makefile 2009-05-02 11:54:43.000000000 -0700 ++++ linux-2.6.28.10/arch/x86/Makefile 2009-10-30 22:04:55.444672426 -0700 +@@ -113,6 +113,10 @@ + mflags-$(CONFIG_X86_VOYAGER) := -Iarch/x86/include/asm/mach-voyager + mcore-$(CONFIG_X86_VOYAGER) := arch/x86/mach-voyager/ + ++# RDC subarch support ++mflags-$(CONFIG_X86_RDC321X) := -Iarch/x86/include/asm/mach-rdc321x ++mcore-$(CONFIG_X86_RDC321X) += arch/x86/mach-rdc321x/ ++ + # generic subarchitecture + mflags-$(CONFIG_X86_GENERICARCH):= -Iarch/x86/include/asm/mach-generic + fcore-$(CONFIG_X86_GENERICARCH) += arch/x86/mach-generic/ +Index: linux-2.6.28.10/arch/x86/include/asm/mach-rdc321x/gpio.h +=================================================================== +--- linux-2.6.28.10.orig/arch/x86/include/asm/mach-rdc321x/gpio.h 2009-10-30 22:31:04.680702348 -0700 ++++ linux-2.6.28.10/arch/x86/include/asm/mach-rdc321x/gpio.h 2009-10-30 22:34:24.024670851 -0700 +@@ -9,7 +9,6 @@ + extern int rdc_gpio_direction_output(unsigned gpio, int value); + extern int rdc_gpio_request(unsigned gpio, const char *label); + extern void rdc_gpio_free(unsigned gpio); +-extern void __init rdc321x_gpio_setup(void); + + /* Wrappers for the arch-neutral GPIO API */ + diff --git a/target/linux/rdc/patches-2.6.28/003-rootfstype.patch b/target/linux/rdc/patches-2.6.28/003-rootfstype.patch index 386e63897..e69de29bb 100644 --- a/target/linux/rdc/patches-2.6.28/003-rootfstype.patch +++ b/target/linux/rdc/patches-2.6.28/003-rootfstype.patch @@ -1,11 +0,0 @@ ---- a/init/do_mounts.c -+++ b/init/do_mounts.c -@@ -189,6 +189,8 @@ static void __init get_fs_names(char *pa - { - char *s = page; - -+ if (!root_fs_names) -+ root_fs_names = "squashfs,jffs2"; - if (root_fs_names) { - strcpy(page, root_fs_names); - while (*s++) { From 76e192d94ce5ad16ea4754c4559ba9e1249f410e Mon Sep 17 00:00:00 2001 From: agb Date: Sun, 1 Nov 2009 06:24:34 +0000 Subject: [PATCH 046/288] [rdc] 2.6.28: remove zero-byte patch left by last commit git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18255 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/rdc/patches-2.6.28/003-rootfstype.patch | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 target/linux/rdc/patches-2.6.28/003-rootfstype.patch diff --git a/target/linux/rdc/patches-2.6.28/003-rootfstype.patch b/target/linux/rdc/patches-2.6.28/003-rootfstype.patch deleted file mode 100644 index e69de29bb..000000000 From 5a58232dfa18a1f8fbb4becc9f2df586f9039cce Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 1 Nov 2009 10:46:36 +0000 Subject: [PATCH 047/288] [package] fix hostapd frame injection in mac80211, backport 9b1ce526eb917c8b5c8497c327768130ee683392 (#6070) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18258 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ...c80211_fix_incorrect_seq_num_hostapd.patch | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 package/mac80211/patches/200-mac80211_fix_incorrect_seq_num_hostapd.patch diff --git a/package/mac80211/patches/200-mac80211_fix_incorrect_seq_num_hostapd.patch b/package/mac80211/patches/200-mac80211_fix_incorrect_seq_num_hostapd.patch new file mode 100644 index 000000000..5762c101f --- /dev/null +++ b/package/mac80211/patches/200-mac80211_fix_incorrect_seq_num_hostapd.patch @@ -0,0 +1,44 @@ +From 9b1ce526eb917c8b5c8497c327768130ee683392 Mon Sep 17 00:00:00 2001 +From: =?utf8?q?Bj=C3=B6rn=20Smedman?= +Date: Sat, 24 Oct 2009 20:55:09 +0200 +Subject: [PATCH] mac80211: fix for incorrect sequence number on hostapd injected frames +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf8 +Content-Transfer-Encoding: 8bit + +When hostapd injects a frame, e.g. an authentication or association +response, mac80211 looks for a suitable access point virtual interface +to associate the frame with based on its source address. This makes it +possible e.g. to correctly assign sequence numbers to the frames. + +A small typo in the ethernet address comparison statement caused a +failure to find a suitable ap interface. Sequence numbers on such +frames where therefore left unassigned causing some clients +(especially windows-based 11b/g clients) to reject them and fail to +authenticate or associate with the access point. This patch fixes the +typo in the address comparison statement. + +Signed-off-by: Björn Smedman +Reviewed-by: Johannes Berg +Cc: stable@kernel.org +Signed-off-by: John W. Linville +--- + net/mac80211/tx.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c +index db4bda6..eaa4118 100644 +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -1445,7 +1445,7 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, + if (tmp_sdata->vif.type != NL80211_IFTYPE_AP) + continue; + if (compare_ether_addr(tmp_sdata->dev->dev_addr, +- hdr->addr2)) { ++ hdr->addr2) == 0) { + dev_hold(tmp_sdata->dev); + dev_put(sdata->dev); + sdata = tmp_sdata; +-- +1.6.5.1 + From d30299b51ebb3b15a67e66dc95f7b75c40a114c1 Mon Sep 17 00:00:00 2001 From: blogic Date: Sun, 1 Nov 2009 18:52:35 +0000 Subject: [PATCH 048/288] [ifxmips] adds dsl support, thank you infineon/lantiq git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18259 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/ifxmips-atm/Makefile | 49 - package/ifxmips-atm/src/Makefile | 4 - package/ifxmips-atm/src/common.h | 896 ----- package/ifxmips-atm/src/core.c | 800 ----- package/ifxmips-atm/src/irq.c | 506 --- package/ifxmips-atm/src/ppe.c | 838 ----- package/ifxmips-atm/src/proc.c | 98 - package/ifxmips-atm/src/proc.h | 9 - package/ifxmips-atm/src/skb.c | 128 - package/ifxmips-dsl-api/Config.in | 18 + package/ifxmips-dsl-api/Makefile | 140 + .../patches/100-dsl_compat.patch | 43 + .../patches/200-mei_compat.patch | 95 + .../patches/300-atm_compat.patch | 168 + package/ifxmips-dsl-api/src/Makefile | 3 + package/ifxmips-dsl-api/src/ifx_atm.h | 172 + package/ifxmips-dsl-api/src/ifxmips_atm.h | 172 + .../ifxmips-dsl-api/src/ifxmips_atm_core.c | 2507 ++++++++++++++ .../ifxmips-dsl-api/src/ifxmips_atm_core.h | 249 ++ .../ifxmips-dsl-api/src/ifxmips_atm_danube.c | 272 ++ .../src/ifxmips_atm_fw_danube.h} | 17 +- .../src/ifxmips_atm_fw_regs_common.h | 364 ++ .../src/ifxmips_atm_fw_regs_danube.h | 30 + .../src/ifxmips_atm_ppe_common.h | 231 ++ .../src/ifxmips_atm_ppe_danube.h | 100 + package/ifxmips-dsl-api/src/ifxmips_mei.c | 2998 +++++++++++++++++ .../src/ifxmips_mei_interface.h | 700 ++++ package/ifxmips-dsl-control/Makefile | 84 + .../files/ifx_cpe_control_init.sh | 21 + .../patches-2.6.30/251-atm.patch} | 12 - target/linux/ifxmips/Makefile | 5 +- .../ifxmips/base-files/etc/config/network | 3 +- .../include/asm/mach-ifxmips/ifxmips_irq.h | 1 + .../ifxmips/patches-2.6.30/400-atm_hack.patch | 48 + 34 files changed, 8430 insertions(+), 3351 deletions(-) delete mode 100644 package/ifxmips-atm/Makefile delete mode 100644 package/ifxmips-atm/src/Makefile delete mode 100644 package/ifxmips-atm/src/common.h delete mode 100644 package/ifxmips-atm/src/core.c delete mode 100644 package/ifxmips-atm/src/irq.c delete mode 100644 package/ifxmips-atm/src/ppe.c delete mode 100644 package/ifxmips-atm/src/proc.c delete mode 100644 package/ifxmips-atm/src/proc.h delete mode 100644 package/ifxmips-atm/src/skb.c create mode 100644 package/ifxmips-dsl-api/Config.in create mode 100644 package/ifxmips-dsl-api/Makefile create mode 100644 package/ifxmips-dsl-api/patches/100-dsl_compat.patch create mode 100644 package/ifxmips-dsl-api/patches/200-mei_compat.patch create mode 100644 package/ifxmips-dsl-api/patches/300-atm_compat.patch create mode 100644 package/ifxmips-dsl-api/src/Makefile create mode 100644 package/ifxmips-dsl-api/src/ifx_atm.h create mode 100644 package/ifxmips-dsl-api/src/ifxmips_atm.h create mode 100644 package/ifxmips-dsl-api/src/ifxmips_atm_core.c create mode 100644 package/ifxmips-dsl-api/src/ifxmips_atm_core.h create mode 100644 package/ifxmips-dsl-api/src/ifxmips_atm_danube.c rename package/{ifxmips-atm/src/ifx_ppe_fw.h => ifxmips-dsl-api/src/ifxmips_atm_fw_danube.h} (99%) create mode 100644 package/ifxmips-dsl-api/src/ifxmips_atm_fw_regs_common.h create mode 100644 package/ifxmips-dsl-api/src/ifxmips_atm_fw_regs_danube.h create mode 100644 package/ifxmips-dsl-api/src/ifxmips_atm_ppe_common.h create mode 100644 package/ifxmips-dsl-api/src/ifxmips_atm_ppe_danube.h create mode 100644 package/ifxmips-dsl-api/src/ifxmips_mei.c create mode 100644 package/ifxmips-dsl-api/src/ifxmips_mei_interface.h create mode 100644 package/ifxmips-dsl-control/Makefile create mode 100644 package/ifxmips-dsl-control/files/ifx_cpe_control_init.sh rename target/linux/{ifxmips/patches-2.6.30/201-atm.patch => generic-2.6/patches-2.6.30/251-atm.patch} (58%) create mode 100644 target/linux/ifxmips/patches-2.6.30/400-atm_hack.patch diff --git a/package/ifxmips-atm/Makefile b/package/ifxmips-atm/Makefile deleted file mode 100644 index 68b77b6c7..000000000 --- a/package/ifxmips-atm/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2009 OpenWrt.org -# All rights reserved. -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# -# blogic@openwrt.org -# - -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/kernel.mk - -PKG_NAME:=ifxmips-atm -PKG_RELEASE:=1 - -include $(INCLUDE_DIR)/package.mk - -define KernelPackage/ifxmips-atm - SUBMENU:=Network Devices - DEPENDS:=@BROKEN @TARGET_ifxmips +kmod-atm - TITLE:=ifxmips atm driver - FILES:=$(PKG_BUILD_DIR)/ifx-atm.$(LINUX_KMOD_SUFFIX) - AUTOLOAD:=$(call AutoLoad,50,ifx-atm) -endef - -define Kernel/Package/ifxmips-atm/description - This package provides the atm driver needed to make dsl work on ifxmips based boards -endef - -define Build/Prepare - mkdir -p $(PKG_BUILD_DIR) - $(CP) ./src/* $(PKG_BUILD_DIR)/ -endef - -define Build/Compile - $(MAKE) -C "$(LINUX_DIR)" \ - CROSS_COMPILE="$(TARGET_CROSS)" \ - ARCH="$(LINUX_KARCH)" \ - SUBDIRS="$(PKG_BUILD_DIR)" \ - modules -endef - -define KernelPackage/ifxmips-atm/install - $(INSTALL_DIR) $(1)/lib/modules/$(LINUX_VERSION) - $(CP) $(PKG_BUILD_DIR)/ifx-atm.ko $(1)/lib/modules/$(LINUX_VERSION) -endef - -$(eval $(call KernelPackage,ifxmips-atm)) - diff --git a/package/ifxmips-atm/src/Makefile b/package/ifxmips-atm/src/Makefile deleted file mode 100644 index 23e0ea067..000000000 --- a/package/ifxmips-atm/src/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -obj-m += ifx-atm.o -ifx-atm-objs := skb.o irq.o proc.o core.o ppe.o - -EXTRA_CFLAGS += -DENABLE_RX_QOS=1 diff --git a/package/ifxmips-atm/src/common.h b/package/ifxmips-atm/src/common.h deleted file mode 100644 index aad6a984e..000000000 --- a/package/ifxmips-atm/src/common.h +++ /dev/null @@ -1,896 +0,0 @@ -#include -#include -#include -#include -#include - -#define RX_DMA_CH_CBR 0 -#define RX_DMA_CH_VBR_RT 1 -#define RX_DMA_CH_VBR_NRT 2 -#define RX_DMA_CH_AVR 3 -#define RX_DMA_CH_UBR 4 -#define RX_DMA_CH_OAM 5 -#define RX_DMA_CH_TOTAL 6 - -#define WRX_DMA_CHANNEL_INTERRUPT_MODE 0x00 -#define WRX_DMA_CHANNEL_POLLING_MODE 0x01 -//#define WRX_DMA_CHANNEL_COUNTER_MODE 0x02 -#define WRX_DMA_CHANNEL_COUNTER_MODE WRX_DMA_CHANNEL_INTERRUPT_MODE -#define WRX_DMA_BUF_LEN_PER_DESCRIPTOR 0x00 -#define WRX_DMA_BUF_LEN_PER_CHANNEL 0x01 - -#define ATM_VBR_RT 6 -#define ATM_VBR_NRT ATM_VBR -#define ATM_UBR_PLUS 7 - -#define SET_BITS(x, msb, lsb, value) (((x) & ~(((1 << ((msb) + 1)) - 1) ^ ((1 << (lsb)) - 1))) | (((value) & ((1 << (1 + (msb) - (lsb))) - 1)) << (lsb))) - -#define GET_ATM_PRIV(dev) ((Atm_Priv *)dev->priv) - -#define CDM_CFG PPE_REG_ADDR(0x0100) - -#define CDM_CFG_RAM1 GET_BITS(*CDM_CFG, 3, 2) -#define CDM_CFG_RAM0 (*CDM_CFG & (1 << 1)) - -#define CDM_CFG_RAM1_SET(value) SET_BITS(0, 3, 2, value) -#define CDM_CFG_RAM0_SET(value) ((value) ? (1 << 1) : 0) - -/* - * EMA Registers - */ -#define EMA_CMDCFG PPE_REG_ADDR(0x0A00) -#define EMA_DATACFG PPE_REG_ADDR(0x0A01) -#define EMA_CMDCNT PPE_REG_ADDR(0x0A02) -#define EMA_DATACNT PPE_REG_ADDR(0x0A03) -#define EMA_ISR PPE_REG_ADDR(0x0A04) -#define EMA_IER PPE_REG_ADDR(0x0A05) -#define EMA_CFG PPE_REG_ADDR(0x0A06) -#define EMA_SUBID PPE_REG_ADDR(0x0A07) - - -/* - * QSB RAM Access Register - */ -#define QSB_RAMAC QSB_CONF_REG(0x000D) - -#define QSB_RAMAC_RW (*QSB_RAMAC & (1 << 31)) -#define QSB_RAMAC_TSEL GET_BITS(*QSB_RAMAC, 27, 24) -#define QSB_RAMAC_LH (*QSB_RAMAC & (1 << 16)) -#define QSB_RAMAC_TESEL GET_BITS(*QSB_RAMAC, 9, 0) - -#define QSB_RAMAC_RW_SET(value) ((value) ? (1 << 31) : 0) -#define QSB_RAMAC_TSEL_SET(value) SET_BITS(0, 27, 24, value) -#define QSB_RAMAC_LH_SET(value) ((value) ? (1 << 16) : 0) -#define QSB_RAMAC_TESEL_SET(value) SET_BITS(0, 9, 0, value) - -/* QSB */ -#define QSB_RAMAC_RW_READ 0 -#define QSB_RAMAC_RW_WRITE 1 - -#define QSB_RAMAC_TSEL_QPT 0x01 -#define QSB_RAMAC_TSEL_SCT 0x02 -#define QSB_RAMAC_TSEL_SPT 0x03 -#define QSB_RAMAC_TSEL_VBR 0x08 - -#define QSB_RAMAC_LH_LOW 0 -#define QSB_RAMAC_LH_HIGH 1 - -#define QSB_QPT_SET_MASK 0x0 -#define QSB_QVPT_SET_MASK 0x0 -#define QSB_SET_SCT_MASK 0x0 -#define QSB_SET_SPT_MASK 0x0 -#define QSB_SET_SPT_SBVALID_MASK 0x7FFFFFFF - -#define QSB_SPT_SBV_VALID (1 << 31) -#define QSB_SPT_PN_SET(value) (((value) & 0x01) ? (1 << 16) : 0) -#define QSB_SPT_INTRATE_SET(value) SET_BITS(0, 13, 0, value) - -/* - * QSB Internal Cell Delay Variation Register - */ -#define QSB_ICDV QSB_CONF_REG(0x0007) - -#define QSB_ICDV_TAU GET_BITS(*QSB_ICDV, 5, 0) - -#define QSB_ICDV_TAU_SET(value) SET_BITS(0, 5, 0, value) - -/* - * QSB Scheduler Burst Limit Register - */ -#define QSB_SBL QSB_CONF_REG(0x0009) - -#define QSB_SBL_SBL GET_BITS(*QSB_SBL, 3, 0) - -#define QSB_SBL_SBL_SET(value) SET_BITS(0, 3, 0, value) - -/* - * QSB Configuration Register - */ -#define QSB_CFG QSB_CONF_REG(0x000A) - -#define QSB_CFG_TSTEPC GET_BITS(*QSB_CFG, 1, 0) - -#define QSB_CFG_TSTEPC_SET(value) SET_BITS(0, 1, 0, value) - -/* - * QSB RAM Transfer Table Register - */ -#define QSB_RTM QSB_CONF_REG(0x000B) - -#define QSB_RTM_DM (*QSB_RTM) - -#define QSB_RTM_DM_SET(value) ((value) & 0xFFFFFFFF) - -/* - * QSB RAM Transfer Data Register - */ -#define QSB_RTD QSB_CONF_REG(0x000C) - -#define QSB_RTD_TTV (*QSB_RTD) - -#define QSB_RTD_TTV_SET(value) ((value) & 0xFFFFFFFF) - -/* - * PP32 Debug Control Register - */ -#define PP32_DBG_CTRL PP32_DEBUG_REG_ADDR(0x0000) - -#define DBG_CTRL_START_SET(value) ((value) ? (1 << 0) : 0) -#define DBG_CTRL_STOP_SET(value) ((value) ? (1 << 1) : 0) -#define DBG_CTRL_STEP_SET(value) ((value) ? (1 << 2) : 0) - -#define SB_RAM0_ADDR(x) ((volatile u32*)(DANUBE_PPE + (((x) + 0x8000) << 2))) -#define UPDATE_VCC_STAT(conn, item, num) do { ppe_dev.connection[conn].item += num; } while (0) -/* - * EMA Settings - */ -#define EMA_CMD_BUF_LEN 0x0040 -#define EMA_CMD_BASE_ADDR (0x00001580 << 2) -#define EMA_DATA_BUF_LEN 0x0100 -#define EMA_DATA_BASE_ADDR (0x00001900 << 2) -#define EMA_WRITE_BURST 0x2 -#define EMA_READ_BURST 0x2 - - -#define CELL_SIZE ATM_AAL0_SDU -#define IDLE_CYCLE_NUMBER 30000 - -#define MBOX_IGU1_ISR PPE_REG_ADDR(0x0206) -#define MBOX_IGU3_ISRS PPE_REG_ADDR(0x0214) -#define MBOX_IGU1_ISRC PPE_REG_ADDR(0x0205) -#define MBOX_IGU3_ISR PPE_REG_ADDR(0x0216) -#define MBOX_IGU3_ISRS_SET(n) (1 << (n)) -#define MBOX_IGU3_ISR_ISR(n) (*MBOX_IGU3_ISR & (1 << (n))) -/* - * * Mailbox IGU1 Registers - * */ -#define MBOX_IGU1_ISRS PPE_REG_ADDR(0x0204) -#define MBOX_IGU1_IER PPE_REG_ADDR(0x0207) - -#define MBOX_IGU1_ISRS_SET(n) (1 << (n)) -#define MBOX_IGU1_ISRC_CLEAR(n) (1 << (n)) -#define MBOX_IGU1_ISR_ISR(n) (*MBOX_IGU1_ISR & (1 << (n))) -#define MBOX_IGU1_IER_EN(n) (*MBOX_IGU1_IER & (1 << (n))) -#define MBOX_IGU1_IER_EN_SET(n) (1 << (n)) - -/* - * * Mailbox IGU3 Registers - * */ -#define MBOX_IGU3_ISRC PPE_REG_ADDR(0x0215) -#define MBOX_IGU3_IER PPE_REG_ADDR(0x0217) - -#define MBOX_IGU3_ISRS_SET(n) (1 << (n)) -#define MBOX_IGU3_ISRC_CLEAR(n) (1 << (n)) -#define MBOX_IGU3_ISR_ISR(n) (*MBOX_IGU3_ISR & (1 << (n))) -#define MBOX_IGU3_IER_EN(n) (*MBOX_IGU3_IER & (1 << (n))) -#define MBOX_IGU3_IER_EN_SET(n) (1 << (n)) - - -// RX Frame Definitions -#define MAX_RX_PACKET_ALIGN_BYTES 3 -#define MAX_RX_PACKET_PADDING_BYTES 3 -#define RX_INBAND_TRAILER_LENGTH 8 -#define MAX_RX_FRAME_EXTRA_BYTES (RX_INBAND_TRAILER_LENGTH + MAX_RX_PACKET_ALIGN_BYTES + MAX_RX_PACKET_PADDING_BYTES) - -// TX Frame Definitions -#define MAX_TX_HEADER_ALIGN_BYTES 12 -#define MAX_TX_PACKET_ALIGN_BYTES 3 -#define MAX_TX_PACKET_PADDING_BYTES 3 -#define TX_INBAND_HEADER_LENGTH 8 -#define MAX_TX_FRAME_EXTRA_BYTES (TX_INBAND_HEADER_LENGTH + MAX_TX_HEADER_ALIGN_BYTES + MAX_TX_PACKET_ALIGN_BYTES + MAX_TX_PACKET_PADDING_BYTES) - - -// DWORD-Length of Memory Blocks -#define PP32_DEBUG_REG_DWLEN 0x0030 -#define PPM_INT_REG_DWLEN 0x0010 -#define PP32_INTERNAL_RES_DWLEN 0x00C0 -#define PPE_CLOCK_CONTROL_DWLEN 0x0F00 -#define CDM_CODE_MEMORY_RAM0_DWLEN 0x1000 -#define CDM_CODE_MEMORY_RAM1_DWLEN 0x0800 -#define PPE_REG_DWLEN 0x1000 -#define PP32_DATA_MEMORY_RAM1_DWLEN 0x0800 -#define PPM_INT_UNIT_DWLEN 0x0100 -#define PPM_TIMER0_DWLEN 0x0100 -#define PPM_TASK_IND_REG_DWLEN 0x0100 -#define PPS_BRK_DWLEN 0x0100 -#define PPM_TIMER1_DWLEN 0x0100 -#define SB_RAM0_DWLEN 0x0400 -#define SB_RAM1_DWLEN 0x0800 -#define SB_RAM2_DWLEN 0x0A00 -#define SB_RAM3_DWLEN 0x0400 -#define QSB_CONF_REG_DWLEN 0x0100 -/* - * QSB Queue Scheduling and Shaping Definitions - */ -#define QSB_WFQ_NONUBR_MAX 0x3f00 -#define QSB_WFQ_UBR_BYPASS 0x3fff -#define QSB_TP_TS_MAX 65472 -#define QSB_TAUS_MAX 64512 -#define QSB_GCR_MIN 18 - - - -// OAM Definitions -#define OAM_RX_QUEUE_NUMBER 1 -#define OAM_TX_QUEUE_NUMBER_PER_PORT 0 -#define OAM_RX_DMA_CHANNEL_NUMBER OAM_RX_QUEUE_NUMBER -#define OAM_HTU_ENTRY_NUMBER 3 -#define OAM_F4_SEG_HTU_ENTRY 0 -#define OAM_F4_TOT_HTU_ENTRY 1 -#define OAM_F5_HTU_ENTRY 2 -#define OAM_F4_CELL_ID 0 -#define OAM_F5_CELL_ID 15 - -// ATM Port, QSB Queue, DMA RX/TX Channel Parameters -#define ATM_PORT_NUMBER 2 -#define MAX_QUEUE_NUMBER 16 -#define QSB_QUEUE_NUMBER_BASE 1 -#define MAX_QUEUE_NUMBER_PER_PORT (MAX_QUEUE_NUMBER - QSB_QUEUE_NUMBER_BASE) -#define MAX_CONNECTION_NUMBER MAX_QUEUE_NUMBER -#define MAX_RX_DMA_CHANNEL_NUMBER 8 -#define MAX_TX_DMA_CHANNEL_NUMBER 16 -#define DMA_ALIGNMENT 4 - -#define DEFAULT_RX_HUNT_BITTH 4 - -/* - * FPI Configuration Bus Register and Memory Address Mapping - */ -#define DANUBE_PPE (KSEG1 + 0x1E180000) -#define PP32_DEBUG_REG_ADDR(x) ((volatile u32*)(DANUBE_PPE + (((x) + 0x0000) << 2))) -#define PPM_INT_REG_ADDR(x) ((volatile u32*)(DANUBE_PPE + (((x) + 0x0030) << 2))) -#define PP32_INTERNAL_RES_ADDR(x) ((volatile u32*)(DANUBE_PPE + (((x) + 0x0040) << 2))) -#define PPE_CLOCK_CONTROL_ADDR(x) ((volatile u32*)(DANUBE_PPE + (((x) + 0x0100) << 2))) -#define CDM_CODE_MEMORY_RAM0_ADDR(x) ((volatile u32*)(DANUBE_PPE + (((x) + 0x1000) << 2))) -#define CDM_CODE_MEMORY_RAM1_ADDR(x) ((volatile u32*)(DANUBE_PPE + (((x) + 0x2000) << 2))) -#define PPE_REG_ADDR(x) ((volatile u32*)(DANUBE_PPE + (((x) + 0x4000) << 2))) -#define PP32_DATA_MEMORY_RAM1_ADDR(x) ((volatile u32*)(DANUBE_PPE + (((x) + 0x5000) << 2))) -#define PPM_INT_UNIT_ADDR(x) ((volatile u32*)(DANUBE_PPE + (((x) + 0x6000) << 2))) -#define PPM_TIMER0_ADDR(x) ((volatile u32*)(DANUBE_PPE + (((x) + 0x6100) << 2))) -#define PPM_TASK_IND_REG_ADDR(x) ((volatile u32*)(DANUBE_PPE + (((x) + 0x6200) << 2))) -#define PPS_BRK_ADDR(x) ((volatile u32*)(DANUBE_PPE + (((x) + 0x6300) << 2))) -#define PPM_TIMER1_ADDR(x) ((volatile u32*)(DANUBE_PPE + (((x) + 0x6400) << 2))) -#define SB_RAM0_ADDR(x) ((volatile u32*)(DANUBE_PPE + (((x) + 0x8000) << 2))) -#define SB_RAM1_ADDR(x) ((volatile u32*)(DANUBE_PPE + (((x) + 0x8400) << 2))) -#define SB_RAM2_ADDR(x) ((volatile u32*)(DANUBE_PPE + (((x) + 0x8C00) << 2))) -#define SB_RAM3_ADDR(x) ((volatile u32*)(DANUBE_PPE + (((x) + 0x9600) << 2))) -#define QSB_CONF_REG(x) ((volatile u32*)(DANUBE_PPE + (((x) + 0xC000) << 2))) - -/* - * Host-PPE Communication Data Address Mapping - */ -#define CFG_WRX_HTUTS PPM_INT_UNIT_ADDR(0x2400) /* WAN RX HTU Table Size, must be configured before enable PPE firmware. */ -#define CFG_WRX_QNUM PPM_INT_UNIT_ADDR(0x2401) /* WAN RX Queue Number */ -#define CFG_WRX_DCHNUM PPM_INT_UNIT_ADDR(0x2402) /* WAN RX DMA Channel Number, no more than 8, must be configured before enable PPE firmware. */ -#define CFG_WTX_DCHNUM PPM_INT_UNIT_ADDR(0x2403) /* WAN TX DMA Channel Number, no more than 16, must be configured before enable PPE firmware. */ -#define CFG_WRDES_DELAY PPM_INT_UNIT_ADDR(0x2404) /* WAN Descriptor Write Delay, must be configured before enable PPE firmware. */ -#define WRX_DMACH_ON PPM_INT_UNIT_ADDR(0x2405) /* WAN RX DMA Channel Enable, must be configured before enable PPE firmware. */ -#define WTX_DMACH_ON PPM_INT_UNIT_ADDR(0x2406) /* WAN TX DMA Channel Enable, must be configured before enable PPE firmware. */ -#define WRX_HUNT_BITTH PPM_INT_UNIT_ADDR(0x2407) /* WAN RX HUNT Threshold, must be between 2 to 8. */ -#define WRX_QUEUE_CONFIG(i) ((struct wrx_queue_config*)PPM_INT_UNIT_ADDR(0x2500 + (i) * 20)) -#define WRX_DMA_CHANNEL_CONFIG(i) ((struct wrx_dma_channel_config*)PPM_INT_UNIT_ADDR(0x2640 + (i) * 7)) -#define WTX_PORT_CONFIG(i) ((struct wtx_port_config*)PPM_INT_UNIT_ADDR(0x2440 + (i))) -#define WTX_QUEUE_CONFIG(i) ((struct wtx_queue_config*)PPM_INT_UNIT_ADDR(0x2710 + (i) * 27)) -#define WTX_DMA_CHANNEL_CONFIG(i) ((struct wtx_dma_channel_config*)PPM_INT_UNIT_ADDR(0x2711 + (i) * 27)) -#define WAN_MIB_TABLE ((struct wan_mib_table*)PPM_INT_UNIT_ADDR(0x2410)) -#define HTU_ENTRY(i) ((struct htu_entry*)PPM_INT_UNIT_ADDR(0x2000 + (i))) -#define HTU_MASK(i) ((struct htu_mask*)PPM_INT_UNIT_ADDR(0x2020 + (i))) -#define HTU_RESULT(i) ((struct htu_result*)PPM_INT_UNIT_ADDR(0x2040 + (i))) - -// DREG Idle Counters -#define DREG_AT_CELL0 PPE_REG_ADDR(0x0D24) -#define DREG_AT_CELL1 PPE_REG_ADDR(0x0D25) -#define DREG_AT_IDLE_CNT0 PPE_REG_ADDR(0x0D26) -#define DREG_AT_IDLE_CNT1 PPE_REG_ADDR(0x0D27) -#define DREG_AR_CELL0 PPE_REG_ADDR(0x0D68) -#define DREG_AR_CELL1 PPE_REG_ADDR(0x0D69) -#define DREG_AR_IDLE_CNT0 PPE_REG_ADDR(0x0D6A) -#define DREG_AR_IDLE_CNT1 PPE_REG_ADDR(0x0D6B) -#define DREG_AR_AIIDLE_CNT0 PPE_REG_ADDR(0x0D6C) -#define DREG_AR_AIIDLE_CNT1 PPE_REG_ADDR(0x0D6D) -#define DREG_AR_BE_CNT0 PPE_REG_ADDR(0x0D6E) -#define DREG_AR_BE_CNT1 PPE_REG_ADDR(0x0D6F) - - -/* - * 64-bit Data Type - */ -typedef struct { - unsigned int h: 32; - unsigned int l: 32; -} ppe_u64_t; - -/* - * PPE ATM Cell Header - */ -#if defined(__BIG_ENDIAN) - struct uni_cell_header { - unsigned int gfc :4; - unsigned int vpi :8; - unsigned int vci :16; - unsigned int pti :3; - unsigned int clp :1; - }; -#else - struct uni_cell_header { - unsigned int clp :1; - unsigned int pti :3; - unsigned int vci :16; - unsigned int vpi :8; - unsigned int gfc :4; - }; -#endif // defined(__BIG_ENDIAN) - -/* - * Inband Header and Trailer - */ -#if defined(__BIG_ENDIAN) - struct rx_inband_trailer { - /* 0 - 3h */ - unsigned int uu :8; - unsigned int cpi :8; - unsigned int stw_res1:4; - unsigned int stw_clp :1; - unsigned int stw_ec :1; - unsigned int stw_uu :1; - unsigned int stw_cpi :1; - unsigned int stw_ovz :1; - unsigned int stw_mfl :1; - unsigned int stw_usz :1; - unsigned int stw_crc :1; - unsigned int stw_il :1; - unsigned int stw_ra :1; - unsigned int stw_res2:2; - /* 4 - 7h */ - unsigned int gfc :4; - unsigned int vpi :8; - unsigned int vci :16; - unsigned int pti :3; - unsigned int clp :1; - }; - - struct tx_inband_header { - /* 0 - 3h */ - unsigned int gfc :4; - unsigned int vpi :8; - unsigned int vci :16; - unsigned int pti :3; - unsigned int clp :1; - /* 4 - 7h */ - unsigned int uu :8; - unsigned int cpi :8; - unsigned int pad :8; - unsigned int res1 :8; - }; -#else - struct rx_inband_trailer { - /* 0 - 3h */ - unsigned int stw_res2:2; - unsigned int stw_ra :1; - unsigned int stw_il :1; - unsigned int stw_crc :1; - unsigned int stw_usz :1; - unsigned int stw_mfl :1; - unsigned int stw_ovz :1; - unsigned int stw_cpi :1; - unsigned int stw_uu :1; - unsigned int stw_ec :1; - unsigned int stw_clp :1; - unsigned int stw_res1:4; - unsigned int cpi :8; - unsigned int uu :8; - /* 4 - 7h */ - unsigned int clp :1; - unsigned int pti :3; - unsigned int vci :16; - unsigned int vpi :8; - unsigned int gfc :4; - }; - - struct tx_inband_header { - /* 0 - 3h */ - unsigned int clp :1; - unsigned int pti :3; - unsigned int vci :16; - unsigned int vpi :8; - unsigned int gfc :4; - /* 4 - 7h */ - unsigned int res1 :8; - unsigned int pad :8; - unsigned int cpi :8; - unsigned int uu :8; - }; -#endif // defined(__BIG_ENDIAN) - -struct wan_mib_table { - unsigned int res1; - unsigned int wrx_drophtu_cell; - unsigned int wrx_dropdes_pdu; - unsigned int wrx_correct_pdu; - unsigned int wrx_err_pdu; - unsigned int wrx_dropdes_cell; - unsigned int wrx_correct_cell; - unsigned int wrx_err_cell; - unsigned int wrx_total_byte; - unsigned int wtx_total_pdu; - unsigned int wtx_total_cell; - unsigned int wtx_total_byte; -}; - -/* - * Internal Structure of Device - */ -struct port { - int connection_base; /* first connection ID (RX/TX queue ID) */ - unsigned int max_connections; /* maximum connection number */ - unsigned int connection_table; /* connection opened status, every bit */ - unsigned int tx_max_cell_rate; /* maximum cell rate */ - unsigned int tx_current_cell_rate; /* currently used cell rate */ -#if !defined(ENABLE_RX_QOS) || !ENABLE_RX_QOS - int rx_dma_channel_base; /* first RX DMA channel ID */ - unsigned int rx_dma_channel_assigned;/* totally RX DMA channels used */ -#endif // !defined(ENABLE_RX_QOS) || !ENABLE_RX_QOS - int oam_tx_queue; /* first TX queue ID of OAM cell */ - struct atm_dev *dev; - -}; - -struct connection { - struct atm_vcc *vcc; /* opened VCC */ - struct timespec access_time; /* time when last F4/F5 user cell arrives */ - unsigned int aal5_vcc_crc_err; /* number of packets with CRC error */ - unsigned int aal5_vcc_oversize_sdu; /* number of packets with oversize error */ - int rx_dma_channel; /* RX DMA channel ID assigned */ - int port; /* to which port the connection belongs */ - unsigned int rx_pdu; - unsigned int rx_err_pdu; - unsigned int rx_sw_drop_pdu; - unsigned int tx_pdu; - unsigned int tx_err_pdu; - unsigned int tx_hw_drop_pdu; - unsigned int tx_sw_drop_pdu; -}; - -struct ppe_dev { - struct connection connection[MAX_CONNECTION_NUMBER]; - struct port port[ATM_PORT_NUMBER]; - - struct aal5 { - unsigned char padding_byte; /* padding byte pattern of AAL5 packet */ - unsigned int rx_max_packet_size; /* max AAL5 packet length */ - unsigned int rx_min_packet_size; /* min AAL5 packet length */ - unsigned int rx_buffer_size; /* max memory allocated for a AAL5 packet */ - unsigned int tx_max_packet_size; /* max AAL5 packet length */ - unsigned int tx_min_packet_size; /* min AAL5 packet length */ - unsigned int tx_buffer_size; /* max memory allocated for a AAL5 packet */ - unsigned int rx_drop_error_packet; /* 1: drop error packet, 0: ignore errors */ - } aal5; - - struct qsb { - unsigned int tau; /* cell delay variation due to concurrency */ - unsigned int tstepc; /* shceduler burst length */ - unsigned int sbl; /* time step */ - } qsb; - - struct dma { - unsigned int rx_descriptor_number; /* number of RX descriptors */ - unsigned int tx_descriptor_number; /* number of TX descriptors */ - unsigned int rx_clp1_desc_threshold; /* threshold to drop cells with CLP1 */ - unsigned int write_descriptor_delay; /* delay on descriptor write path */ - unsigned int rx_total_channel_used; /* total RX channel used */ - void *rx_descriptor_addr; /* base address of memory allocated for */ - struct rx_descriptor - *rx_descriptor_base; /* base address of RX descriptors */ - int rx_desc_read_pos[MAX_RX_DMA_CHANNEL_NUMBER]; /* first RX descriptor */ - /* to be read */ -// struct sk_buff **rx_skb_pointers; /* base address of RX sk_buff pointers */ - -#if defined(ENABLE_RX_QOS) && ENABLE_RX_QOS - long rx_weight[MAX_RX_DMA_CHANNEL_NUMBER]; /* RX schedule weight */ - long rx_default_weight[MAX_RX_DMA_CHANNEL_NUMBER]; /* default weight */ -#endif - - unsigned int tx_total_channel_used; /* total TX channel used */ - void *tx_descriptor_addr; /* base address of memory allocated for */ - /* TX descriptors */ - struct tx_descriptor - *tx_descriptor_base; /* base address of TX descriptors */ - int tx_desc_alloc_pos[MAX_TX_DMA_CHANNEL_NUMBER]; /* first TX descriptor */ - /* could be allocated */ -// int tx_desc_alloc_num[MAX_TX_DMA_CHANNEL_NUMBER]; /* number of allocated */ -// /* TX descriptors */ - int tx_desc_alloc_flag[MAX_TX_DMA_CHANNEL_NUMBER]; /* at least one TX */ - /* descriptor is alloc */ -// int tx_desc_send_pos[MAX_TX_DMA_CHANNEL_NUMBER]; /* first TX descriptor */ -// /* to be send */ - int tx_desc_release_pos[MAX_TX_DMA_CHANNEL_NUMBER]; /* first TX descriptor */ - /* to be released */ - struct sk_buff **tx_skb_pointers; /* base address of TX sk_buff pointers */ - } dma; - - struct mib { - ppe_u64_t wrx_total_byte; /* bit-64 extention of MIB table member */ - ppe_u64_t wtx_total_byte; /* bit-64 extention of MIB talbe member */ - - unsigned int wrx_pdu; /* successfully received AAL5 packet */ - unsigned int wrx_drop_pdu; /* AAL5 packet dropped by driver on RX */ - unsigned int wtx_err_pdu; /* error AAL5 packet */ - unsigned int wtx_drop_pdu; /* AAL5 packet dropped by driver on TX */ - } mib; - struct wan_mib_table prev_mib; - - int oam_rx_queue; /* RX queue ID of OAM cell */ - int oam_rx_dma_channel; /* RX DMA channel ID of OAM cell */ - int max_connections; /* total connections available */ - - struct semaphore sem; /* lock used by open/close function */ -}; - -/* - * Host-PPE Communication Data Structure - */ -#if defined(__BIG_ENDIAN) - struct wrx_queue_config { - /* 0h */ - unsigned int res2 :27; - unsigned int dmach :4; - unsigned int errdp :1; - /* 1h */ - unsigned int oversize :16; - unsigned int undersize :16; - /* 2h */ - unsigned int res1 :16; - unsigned int mfs :16; - /* 3h */ - unsigned int uumask :8; - unsigned int cpimask :8; - unsigned int uuexp :8; - unsigned int cpiexp :8; - }; - - struct wtx_port_config { - unsigned int res1 :27; - unsigned int qid :4; - unsigned int qsben :1; - }; - - struct wtx_queue_config { - unsigned int res1 :25; - unsigned int sbid :1; - unsigned int res2 :3; - unsigned int type :2; - unsigned int qsben :1; - }; - - struct wrx_dma_channel_config { - /* 0h */ - unsigned int res1 :1; - unsigned int mode :2; - unsigned int rlcfg :1; - unsigned int desba :28; - /* 1h */ - unsigned int chrl :16; - unsigned int clp1th :16; - /* 2h */ - unsigned int deslen :16; - unsigned int vlddes :16; - }; - - struct wtx_dma_channel_config { - /* 0h */ - unsigned int res2 :1; - unsigned int mode :2; - unsigned int res3 :1; - unsigned int desba :28; - /* 1h */ - unsigned int res1 :32; - /* 2h */ - unsigned int deslen :16; - unsigned int vlddes :16; - }; - - struct htu_entry { - unsigned int res1 :2; - unsigned int pid :2; - unsigned int vpi :8; - unsigned int vci :16; - unsigned int pti :3; - unsigned int vld :1; - }; - - struct htu_mask { - unsigned int set :2; - unsigned int pid_mask :2; - unsigned int vpi_mask :8; - unsigned int vci_mask :16; - unsigned int pti_mask :3; - unsigned int clear :1; - }; - - struct htu_result { - unsigned int res1 :12; - unsigned int cellid :4; - unsigned int res2 :5; - unsigned int type :1; - unsigned int ven :1; - unsigned int res3 :5; - unsigned int qid :4; - }; - - struct rx_descriptor { - /* 0 - 3h */ - unsigned int own :1; - unsigned int c :1; - unsigned int sop :1; - unsigned int eop :1; - unsigned int res1 :3; - unsigned int byteoff :2; - unsigned int res2 :2; - unsigned int id :4; - unsigned int err :1; - unsigned int datalen :16; - /* 4 - 7h */ - unsigned int res3 :4; - unsigned int dataptr :28; - }; - - struct tx_descriptor { - /* 0 - 3h */ - unsigned int own :1; - unsigned int c :1; - unsigned int sop :1; - unsigned int eop :1; - unsigned int byteoff :5; - unsigned int res1 :5; - unsigned int iscell :1; - unsigned int clp :1; - unsigned int datalen :16; - /* 4 - 7h */ - unsigned int res2 :4; - unsigned int dataptr :28; - }; -#else - struct wrx_queue_config { - /* 0h */ - unsigned int errdp :1; - unsigned int dmach :4; - unsigned int res2 :27; - /* 1h */ - unsigned int undersize :16; - unsigned int oversize :16; - /* 2h */ - unsigned int mfs :16; - unsigned int res1 :16; - /* 3h */ - unsigned int cpiexp :8; - unsigned int uuexp :8; - unsigned int cpimask :8; - unsigned int uumask :8; - }; - - struct wtx_port_config { - unsigned int qsben :1; - unsigned int qid :4; - unsigned int res1 :27; - }; - - struct wtx_queue_config { - unsigned int qsben :1; - unsigned int type :2; - unsigned int res2 :3; - unsigned int sbid :1; - unsigned int res1 :25; - }; - - struct wrx_dma_channel_config - { - /* 0h */ - unsigned int desba :28; - unsigned int rlcfg :1; - unsigned int mode :2; - unsigned int res1 :1; - /* 1h */ - unsigned int clp1th :16; - unsigned int chrl :16; - /* 2h */ - unsigned int vlddes :16; - unsigned int deslen :16; - }; - - struct wtx_dma_channel_config { - /* 0h */ - unsigned int desba :28; - unsigned int res3 :1; - unsigned int mode :2; - unsigned int res2 :1; - /* 1h */ - unsigned int res1 :32; - /* 2h */ - unsigned int vlddes :16; - unsigned int deslen :16; - }; - - struct rx_descriptor { - /* 4 - 7h */ - unsigned int dataptr :28; - unsigned int res3 :4; - /* 0 - 3h */ - unsigned int datalen :16; - unsigned int err :1; - unsigned int id :4; - unsigned int res2 :2; - unsigned int byteoff :2; - unsigned int res1 :3; - unsigned int eop :1; - unsigned int sop :1; - unsigned int c :1; - unsigned int own :1; - }; - - struct tx_descriptor { - /* 4 - 7h */ - unsigned int dataptr :28; - unsigned int res2 :4; - /* 0 - 3h */ - unsigned int datalen :16; - unsigned int clp :1; - unsigned int iscell :1; - unsigned int res1 :5; - unsigned int byteoff :5; - unsigned int eop :1; - unsigned int sop :1; - unsigned int c :1; - unsigned int own :1; - }; -#endif // defined(__BIG_ENDIAN) - -/* - * QSB Queue Parameter Table Entry and Queue VBR Parameter Table Entry - */ -#if defined(__BIG_ENDIAN) - union qsb_queue_parameter_table { - struct { - unsigned int res1 :1; - unsigned int vbr :1; - unsigned int wfqf :14; - unsigned int tp :16; - } bit; - unsigned int dword; - }; - - union qsb_queue_vbr_parameter_table { - struct { - unsigned int taus :16; - unsigned int ts :16; - } bit; - unsigned int dword; - }; -#else - union qsb_queue_parameter_table { - struct { - unsigned int tp :16; - unsigned int wfqf :14; - unsigned int vbr :1; - unsigned int res1 :1; - } bit; - unsigned int dword; - }; - - union qsb_queue_vbr_parameter_table { - struct { - unsigned int ts :16; - unsigned int taus :16; - } bit; - unsigned int dword; - }; -#endif // defined(__BIG_ENDIAN) - - -typedef enum -{ - IAD_ATM_CBR = 6, /* IAD_ATM_PRI_HIGH, */ - IAD_ATM_VBR_RT = 4, /* IAD_ATM_PRI_MED_HIGH, VBR, Real-Time */ - IAD_ATM_VBR_NRT = 2, /* IAD_ATM_PRI_MED_LOW, VBR, Non-Real-Time */ - IAD_ATM_UBR = 0, /* IAD_ATM_PRI_LOW */ -} iad_atmServiceCategory; - -typedef unsigned int iad_atmDiffServCategory; - -typedef struct -{ - int cellRate; - int round; /* IAD_ATM_RATE_CEILING, IAD_ATM_RATE_FLOOR */ -} iad_atmCellRateDesc; - -typedef struct -{ - unsigned int phyID; /* IAD_ATM_PHY0, IAD_ATM_PHY1 */ - unsigned int txQHnd; /* Tx HW Q */ - union _pri - { - int priority; /* TS Q: 4 priorities: IAD_ATM_PRI_HIGH, IAD_ATM_PRI_MED_HIGH, IAD_ATM_PRI_MED_LOW, IAD_ATM_PRI_LOW - non-TS Q: 8 priorities: IAD_ATM_PRI_LEVEL_7, IAD_ATM_PRI_LEVEL_6,..., IAD_ATM_PRI_LEVEL_0 */ - iad_atmServiceCategory qosClass; /* IAD_ATM_CBR, IAD_ATM_VBR_RT, IAD_ATM_VBR_NRT, IAD_ATM_UBR */ - iad_atmDiffServCategory diffServClass; /* IP_QOS */ - } srvCat; /* service category */ - iad_atmCellRateDesc pcr; /* Peak Cell Rate */ - iad_atmCellRateDesc scr; /* Sustained Cell Rate. */ - iad_atmCellRateDesc mcr; /* Minimum Cell Rate, not used */ - int mbs; /* maximum bursting size in cells */ - int isPrioritize; /* TRUE: This flow is of the higher priority than the flows of the same QOS category.(Use MCR to boost priority) */ -} iad_atmTrfPar; /* Tx Traffic Parameters */ - -typedef struct -{ - unsigned int txGrpId; - unsigned int flowId; - iad_atmTrfPar trfPar; -} Atm_Ictl_Flow_Set; - -typedef struct -{ - unsigned int txGrpId; - unsigned int vpi; - unsigned int vci; - - unsigned int encaps; - unsigned int proto; - -} Atm_Ictl_Open_Vcc; - -typedef struct -{ - struct atm_vcc vcc; - unsigned int valid; - unsigned int on; - unsigned int vccIndex; /* 0~7 */ - unsigned int itf; - struct net_device_stats stats; -} Atm_Priv; - - -extern struct ppe_dev ppe_dev; - - -int pp32_start(void); -void pp32_stop(void); -void init_rx_tables(void); -void init_tx_tables(void); -struct sk_buff* alloc_skb_rx(void); -struct sk_buff* alloc_skb_tx(unsigned int); -void resize_skb_rx(struct sk_buff *, unsigned int, int); -struct sk_buff* atm_alloc_tx(struct atm_vcc *, unsigned int); -void atm_free_tx_skb_vcc(struct sk_buff *); -int alloc_tx_connection(int); -int ppe_open(struct atm_vcc *vcc); -void ppe_close(struct atm_vcc *vcc); -int ppe_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg); -int ppe_send(struct atm_vcc *vcc, struct sk_buff *skb); -int ppe_send_oam(struct atm_vcc *vcc, void *cell, int flags); -int ppe_change_qos(struct atm_vcc *vcc, struct atm_qos *qos, int flags); -irqreturn_t mailbox_irq_handler(int, void *); -int find_vcc(struct atm_vcc *vcc); -int find_vpi(unsigned int vpi); -int find_vpivci(unsigned int vpi, unsigned int vci); -void mailbox_signal(unsigned int channel, int is_tx); - diff --git a/package/ifxmips-atm/src/core.c b/package/ifxmips-atm/src/core.c deleted file mode 100644 index 95b05f3db..000000000 --- a/package/ifxmips-atm/src/core.c +++ /dev/null @@ -1,800 +0,0 @@ -#include -#include -#include -#include - -#include "common.h" -#include "proc.h" - -// our main struct -struct ppe_dev ppe_dev; - -static int port_max_connection[2] = {7, 7}; /* Maximum number of connections for ports (0-14) */ -static int port_cell_rate_up[2] = {3200, 3200}; /* Maximum TX cell rate for ports */ -static int qsb_tau = 1; -static int qsb_srvm = 0x0f; -static int qsb_tstep = 4; -static int write_descriptor_delay = 0x20; -static int aal5_fill_pattern = 0x007E; -static int aal5r_max_packet_size = 0x0700; -static int aal5r_min_packet_size = 0x0000; -static int aal5s_max_packet_size = 0x0700; -static int aal5s_min_packet_size = 0x0000; -static int aal5r_drop_error_packet = 1; -static int dma_rx_descriptor_length = 48; -static int dma_tx_descriptor_length = 64; -static int dma_rx_clp1_descriptor_threshold = 38; - -//module_param(port_max_connection, "2-2i"); -//module_param(port_cell_rate_up, "2-2i"); -module_param(qsb_tau, int, 0); -module_param(qsb_srvm, int, 0); -module_param(qsb_tstep, int, 0); -module_param(write_descriptor_delay, int, 0); -module_param(aal5_fill_pattern, int, 0); -module_param(aal5r_max_packet_size, int, 0); -module_param(aal5r_min_packet_size, int, 0); -module_param(aal5s_max_packet_size, int, 0); -module_param(aal5s_min_packet_size, int, 0); -module_param(aal5r_drop_error_packet, int, 0); -module_param(dma_rx_descriptor_length, int, 0); -module_param(dma_tx_descriptor_length, int, 0); -module_param(dma_rx_clp1_descriptor_threshold, int, 0); - -MODULE_PARM_DESC(port_cell_rate_up, "ATM port upstream rate in cells/s"); -MODULE_PARM_DESC(port_max_connection, "Maximum atm connection for port (0-1)"); -MODULE_PARM_DESC(qsb_tau, "Cell delay variation. Value must be > 0"); -MODULE_PARM_DESC(qsb_srvm, "Maximum burst size"); -MODULE_PARM_DESC(qsb_tstep, "n*32 cycles per sbs cycles n=1,2,4"); -MODULE_PARM_DESC(write_descriptor_delay, "PPE core clock cycles between descriptor write and effectiveness in external RAM"); -MODULE_PARM_DESC(a5_fill_pattern, "Filling pattern (PAD) for AAL5 frames"); -MODULE_PARM_DESC(aal5r_max_packet_size, "Max packet size in byte for downstream AAL5 frames"); -MODULE_PARM_DESC(aal5r_min_packet_size, "Min packet size in byte for downstream AAL5 frames"); -MODULE_PARM_DESC(aal5s_max_packet_size, "Max packet size in byte for upstream AAL5 frames"); -MODULE_PARM_DESC(aal5s_min_packet_size, "Min packet size in byte for upstream AAL5 frames"); -MODULE_PARM_DESC(aal5r_drop_error_packet, "Non-zero value to drop error packet for downstream"); -MODULE_PARM_DESC(dma_rx_descriptor_length, "Number of descriptor assigned to DMA RX channel (>16)"); -MODULE_PARM_DESC(dma_tx_descriptor_length, "Number of descriptor assigned to DMA TX channel (>16)"); -MODULE_PARM_DESC(dma_rx_clp1_descriptor_threshold, "Descriptor threshold for cells with cell loss priority 1"); - -void init_rx_tables(void) -{ - int i, j; - struct wrx_queue_config wrx_queue_config = {0}; - struct wrx_dma_channel_config wrx_dma_channel_config = {0}; - struct htu_entry htu_entry = {0}; - struct htu_result htu_result = {0}; - - struct htu_mask htu_mask = { set: 0x03, - pid_mask: 0x00, - vpi_mask: 0x00, - vci_mask: 0x00, - pti_mask: 0x00, - clear: 0x00}; - - /* - * General Registers - */ - *CFG_WRX_HTUTS = ppe_dev.max_connections + OAM_HTU_ENTRY_NUMBER; - *CFG_WRX_QNUM = ppe_dev.max_connections + OAM_RX_QUEUE_NUMBER + QSB_QUEUE_NUMBER_BASE; - *CFG_WRX_DCHNUM = ppe_dev.dma.rx_total_channel_used; - *WRX_DMACH_ON = (1 << ppe_dev.dma.rx_total_channel_used) - 1; - *WRX_HUNT_BITTH = DEFAULT_RX_HUNT_BITTH; - - /* - * WRX Queue Configuration Table - */ - wrx_queue_config.uumask = 0; - wrx_queue_config.cpimask = 0; - wrx_queue_config.uuexp = 0; - wrx_queue_config.cpiexp = 0; - wrx_queue_config.mfs = ppe_dev.aal5.rx_max_packet_size; // rx_buffer_size - wrx_queue_config.oversize = ppe_dev.aal5.rx_max_packet_size; - wrx_queue_config.undersize = ppe_dev.aal5.rx_min_packet_size; - wrx_queue_config.errdp = ppe_dev.aal5.rx_drop_error_packet; - for ( i = 0; i < QSB_QUEUE_NUMBER_BASE; i++ ) - *WRX_QUEUE_CONFIG(i) = wrx_queue_config; - for ( j = 0; j < ppe_dev.max_connections; j++ ) - { -#if !defined(ENABLE_RX_QOS) || !ENABLE_RX_QOS - /* If RX QoS is disabled, the DMA channel must be fixed. */ - wrx_queue_config.dmach = ppe_dev.connection[i].rx_dma_channel; -#endif // !defined(ENABLE_RX_QOS) || !ENABLE_RX_QOS - *WRX_QUEUE_CONFIG(i++) = wrx_queue_config; - } - /* OAM RX Queue */ - for ( j = 0; j < OAM_RX_DMA_CHANNEL_NUMBER; j++ ) - { -#if defined(ENABLE_RX_QOS) && ENABLE_RX_QOS - wrx_queue_config.dmach = RX_DMA_CH_OAM; -#else - wrx_queue_config.dmach = ppe_dev.oam_rx_dma_channel + j; -#endif // defined(ENABLE_RX_QOS) && ENABLE_RX_QOS - *WRX_QUEUE_CONFIG(i++) = wrx_queue_config; - } - - wrx_dma_channel_config.deslen = ppe_dev.dma.rx_descriptor_number; - wrx_dma_channel_config.chrl = 0; - wrx_dma_channel_config.clp1th = ppe_dev.dma.rx_clp1_desc_threshold; - wrx_dma_channel_config.mode = WRX_DMA_CHANNEL_COUNTER_MODE; - wrx_dma_channel_config.rlcfg = WRX_DMA_BUF_LEN_PER_DESCRIPTOR; - for ( i = 0; i < ppe_dev.dma.rx_total_channel_used; i++ ) - { - wrx_dma_channel_config.desba = (((u32)ppe_dev.dma.rx_descriptor_base >> 2) & 0x0FFFFFFF) + ppe_dev.dma.rx_descriptor_number * i * (sizeof(struct rx_descriptor) >> 2); - *WRX_DMA_CHANNEL_CONFIG(i) = wrx_dma_channel_config; - } - - /* - * HTU Tables - */ - for ( i = 0; i < ppe_dev.max_connections; i++ ) - { - htu_result.qid = (unsigned int)i; - - *HTU_ENTRY(i + OAM_HTU_ENTRY_NUMBER) = htu_entry; - *HTU_MASK(i + OAM_HTU_ENTRY_NUMBER) = htu_mask; - *HTU_RESULT(i + OAM_HTU_ENTRY_NUMBER) = htu_result; - } - /* OAM HTU Entry */ - htu_entry.vci = 0x03; - htu_mask.pid_mask = 0x03; - htu_mask.vpi_mask = 0xFF; - htu_mask.vci_mask = 0x0000; - htu_mask.pti_mask = 0x07; - htu_result.cellid = ppe_dev.oam_rx_queue; - htu_result.type = 1; - htu_result.ven = 1; - htu_result.qid = ppe_dev.oam_rx_queue; - *HTU_RESULT(OAM_F4_SEG_HTU_ENTRY) = htu_result; - *HTU_MASK(OAM_F4_SEG_HTU_ENTRY) = htu_mask; - *HTU_ENTRY(OAM_F4_SEG_HTU_ENTRY) = htu_entry; - htu_entry.vci = 0x04; - htu_result.cellid = ppe_dev.oam_rx_queue; - htu_result.type = 1; - htu_result.ven = 1; - htu_result.qid = ppe_dev.oam_rx_queue; - *HTU_RESULT(OAM_F4_TOT_HTU_ENTRY) = htu_result; - *HTU_MASK(OAM_F4_TOT_HTU_ENTRY) = htu_mask; - *HTU_ENTRY(OAM_F4_TOT_HTU_ENTRY) = htu_entry; - htu_entry.vci = 0x00; - htu_entry.pti = 0x04; - htu_mask.vci_mask = 0xFFFF; - htu_mask.pti_mask = 0x01; - htu_result.cellid = ppe_dev.oam_rx_queue; - htu_result.type = 1; - htu_result.ven = 1; - htu_result.qid = ppe_dev.oam_rx_queue; - *HTU_RESULT(OAM_F5_HTU_ENTRY) = htu_result; - *HTU_MASK(OAM_F5_HTU_ENTRY) = htu_mask; - *HTU_ENTRY(OAM_F5_HTU_ENTRY) = htu_entry; -} - -void init_tx_tables(void) -{ - int i, j; - struct wtx_queue_config wtx_queue_config = {0}; - struct wtx_dma_channel_config wtx_dma_channel_config = {0}; - - struct wtx_port_config wtx_port_config = { res1: 0, - qid: 0, - qsben: 1}; - - /* - * General Registers - */ - *CFG_WTX_DCHNUM = ppe_dev.dma.tx_total_channel_used + QSB_QUEUE_NUMBER_BASE; - *WTX_DMACH_ON = ((1 << (ppe_dev.dma.tx_total_channel_used + QSB_QUEUE_NUMBER_BASE)) - 1) ^ ((1 << QSB_QUEUE_NUMBER_BASE) - 1); - *CFG_WRDES_DELAY = ppe_dev.dma.write_descriptor_delay; - - /* - * WTX Port Configuration Table - */ -#if !defined(DISABLE_QSB) || !DISABLE_QSB - for ( i = 0; i < ATM_PORT_NUMBER; i++ ) - *WTX_PORT_CONFIG(i) = wtx_port_config; -#else - wtx_port_config.qsben = 0; - for ( i = 0; i < ATM_PORT_NUMBER; i++ ) - { - wtx_port_config.qid = ppe_dev.port[i].connection_base; - *WTX_PORT_CONFIG(i) = wtx_port_config; - -printk("port %d: qid = %d, qsb disabled\n", i, wtx_port_config.qid); - } -#endif - - /* - * WTX Queue Configuration Table - */ - wtx_queue_config.res1 = 0; - wtx_queue_config.res2 = 0; -// wtx_queue_config.type = 0x03; - wtx_queue_config.type = 0x0; -#if !defined(DISABLE_QSB) || !DISABLE_QSB - wtx_queue_config.qsben = 1; -#else - wtx_queue_config.qsben = 0; -#endif - wtx_queue_config.sbid = 0; - for ( i = 0; i < QSB_QUEUE_NUMBER_BASE; i++ ) - *WTX_QUEUE_CONFIG(i) = wtx_queue_config; - for ( j = 0; j < ppe_dev.max_connections; j++ ) - { - wtx_queue_config.sbid = ppe_dev.connection[i].port & 0x01; /* assign QSB to TX queue */ - *WTX_QUEUE_CONFIG(i) = wtx_queue_config; - i++; - } - /* OAM TX Queue */ -// wtx_queue_config.type = 0x01; - wtx_queue_config.type = 0x00; - for ( i = 0; i < ATM_PORT_NUMBER; i++ ) - { - wtx_queue_config.sbid = i & 0x01; - for ( j = 0; j < OAM_TX_QUEUE_NUMBER_PER_PORT; j++ ) - *WTX_QUEUE_CONFIG(ppe_dev.port[i].oam_tx_queue + j) = wtx_queue_config; - } - - wtx_dma_channel_config.mode = WRX_DMA_CHANNEL_COUNTER_MODE; - wtx_dma_channel_config.deslen = 0; - wtx_dma_channel_config.desba = 0; - for ( i = 0; i < QSB_QUEUE_NUMBER_BASE; i++ ) - *WTX_DMA_CHANNEL_CONFIG(i) = wtx_dma_channel_config; - /* normal connection and OAM channel */ - wtx_dma_channel_config.deslen = ppe_dev.dma.tx_descriptor_number; - for ( j = 0; j < ppe_dev.dma.tx_total_channel_used; j++ ) - { - wtx_dma_channel_config.desba = (((u32)ppe_dev.dma.tx_descriptor_base >> 2) & 0x0FFFFFFF) + ppe_dev.dma.tx_descriptor_number * j * (sizeof(struct tx_descriptor) >> 2); - *WTX_DMA_CHANNEL_CONFIG(i++) = wtx_dma_channel_config; - } -} - -static inline void qsb_global_set(void) -{ - int i, j; - u32 qsb_clk = cgu_get_fpi_bus_clock(2); - u32 tmp1, tmp2, tmp3; - union qsb_queue_parameter_table qsb_queue_parameter_table = {{0}}; - union qsb_queue_vbr_parameter_table qsb_queue_vbr_parameter_table = {{0}}; - int qsb_qid; - - *QSB_ICDV = QSB_ICDV_TAU_SET(ppe_dev.qsb.tau); - *QSB_SBL = QSB_SBL_SBL_SET(ppe_dev.qsb.sbl); - *QSB_CFG = QSB_CFG_TSTEPC_SET(ppe_dev.qsb.tstepc >> 1); - - /* - * set SCT and SPT per port - */ - for ( i = 0; i < ATM_PORT_NUMBER; i++ ) - if ( ppe_dev.port[i].max_connections != 0 && ppe_dev.port[i].tx_max_cell_rate != 0 ) - { - tmp1 = ((qsb_clk * ppe_dev.qsb.tstepc) >> 1) / ppe_dev.port[i].tx_max_cell_rate; - tmp2 = tmp1 >> 6; /* integer value of Tsb */ - tmp3 = (tmp1 & ((1 << 6) - 1)) + 1; /* fractional part of Tsb */ - /* carry over to integer part (?) */ - if ( tmp3 == (1 << 6) ) - { - tmp3 = 0; - tmp2++; - } - if ( tmp2 == 0 ) - tmp2 = tmp3 = 1; - /* 1. set mask */ - /* 2. write value to data transfer register */ - /* 3. start the tranfer */ - /* SCT (FracRate) */ - *QSB_RTM = QSB_RTM_DM_SET(QSB_SET_SCT_MASK); - *QSB_RTD = QSB_RTD_TTV_SET(tmp3); - *QSB_RAMAC = QSB_RAMAC_RW_SET(QSB_RAMAC_RW_WRITE) | QSB_RAMAC_TSEL_SET(QSB_RAMAC_TSEL_SCT) | QSB_RAMAC_LH_SET(QSB_RAMAC_LH_LOW) | QSB_RAMAC_TESEL_SET(i & 0x01); - /* SPT (SBV + PN + IntRage) */ - *QSB_RTM = QSB_RTM_DM_SET(QSB_SET_SPT_MASK); - *QSB_RTD = QSB_RTD_TTV_SET(QSB_SPT_SBV_VALID | QSB_SPT_PN_SET(i & 0x01) | QSB_SPT_INTRATE_SET(tmp2)); - *QSB_RAMAC = QSB_RAMAC_RW_SET(QSB_RAMAC_RW_WRITE) | QSB_RAMAC_TSEL_SET(QSB_RAMAC_TSEL_SPT) | QSB_RAMAC_LH_SET(QSB_RAMAC_LH_LOW) | QSB_RAMAC_TESEL_SET(i & 0x01); - } - - /* - * set OAM TX queue - */ - for ( i = 0; i < ATM_PORT_NUMBER; i++ ) - if ( ppe_dev.port[i].max_connections != 0 ) - { - tmp1 = ((qsb_clk * ppe_dev.qsb.tstepc) >> 1) / ppe_dev.port[i].tx_max_cell_rate; - tmp2 = tmp1 >> 6; /* integer value of Tsb */ - tmp3 = (tmp1 & ((1 << 6) - 1)) + 1; /* fractional part of Tsb */ - /* carry over to integer part (?) */ - if ( tmp3 == (1 << 6) ) - { - tmp3 = 0; - tmp2++; - } - if ( tmp2 == 0 ) - tmp2 = tmp3 = 1; - /* 1. set mask */ - /* 2. write value to data transfer register */ - /* 3. start the tranfer */ - /* SCT (FracRate) */ - *QSB_RTM = QSB_RTM_DM_SET(QSB_SET_SCT_MASK); - *QSB_RTD = QSB_RTD_TTV_SET(tmp3); - *QSB_RAMAC = QSB_RAMAC_RW_SET(QSB_RAMAC_RW_WRITE) | QSB_RAMAC_TSEL_SET(QSB_RAMAC_TSEL_SCT) | QSB_RAMAC_LH_SET(QSB_RAMAC_LH_LOW) | QSB_RAMAC_TESEL_SET(i & 0x01); - - /* SPT (SBV + PN + IntRage) */ - *QSB_RTM = QSB_RTM_DM_SET(QSB_SET_SPT_MASK); - *QSB_RTD = QSB_RTD_TTV_SET(QSB_SPT_SBV_VALID | QSB_SPT_PN_SET(i & 0x01) | QSB_SPT_INTRATE_SET(tmp2)); - *QSB_RAMAC = QSB_RAMAC_RW_SET(QSB_RAMAC_RW_WRITE) | QSB_RAMAC_TSEL_SET(QSB_RAMAC_TSEL_SPT) | QSB_RAMAC_LH_SET(QSB_RAMAC_LH_LOW) | QSB_RAMAC_TESEL_SET(i & 0x01); - } - - /* - * * set OAM TX queue - * */ - for ( i = 0; i < ATM_PORT_NUMBER; i++ ) - if ( ppe_dev.port[i].max_connections != 0 ) - for ( j = 0; j < OAM_TX_QUEUE_NUMBER_PER_PORT; j++ ) - { - qsb_qid = ppe_dev.port[i].oam_tx_queue + j; - - /* disable PCR limiter */ - qsb_queue_parameter_table.bit.tp = 0; - /* set WFQ as real time queue */ - qsb_queue_parameter_table.bit.wfqf = 0; - /* disable leaky bucket shaper */ - qsb_queue_vbr_parameter_table.bit.taus = 0; - qsb_queue_vbr_parameter_table.bit.ts = 0; - - /* Queue Parameter Table (QPT) */ - *QSB_RTM = QSB_RTM_DM_SET(QSB_QPT_SET_MASK); - *QSB_RTD = QSB_RTD_TTV_SET(qsb_queue_parameter_table.dword); - *QSB_RAMAC = QSB_RAMAC_RW_SET(QSB_RAMAC_RW_WRITE) | QSB_RAMAC_TSEL_SET(QSB_RAMAC_TSEL_QPT) | QSB_RAMAC_LH_SET(QSB_RAMAC_LH_LOW) | QSB_RAMAC_TESEL_SET(qsb_qid); - /* Queue VBR Paramter Table (QVPT) */ - *QSB_RTM = QSB_RTM_DM_SET(QSB_QVPT_SET_MASK); - *QSB_RTD = QSB_RTD_TTV_SET(qsb_queue_vbr_parameter_table.dword); - *QSB_RAMAC = QSB_RAMAC_RW_SET(QSB_RAMAC_RW_WRITE) | QSB_RAMAC_TSEL_SET(QSB_RAMAC_TSEL_VBR) | QSB_RAMAC_LH_SET(QSB_RAMAC_LH_LOW) | QSB_RAMAC_TESEL_SET(qsb_qid); - } -} - -static inline void clear_ppe_dev(void) -{ - int i; - - for (i = 0; i < ppe_dev.dma.tx_total_channel_used; i++ ) - { - int conn = i + QSB_QUEUE_NUMBER_BASE; - int desc_base; - struct sk_buff *skb; - - while(ppe_dev.dma.tx_desc_release_pos[conn] != ppe_dev.dma.tx_desc_alloc_pos[conn]) - { - desc_base = ppe_dev.dma.tx_descriptor_number * (conn - QSB_QUEUE_NUMBER_BASE) + ppe_dev.dma.tx_desc_release_pos[conn]; - if(!ppe_dev.dma.tx_descriptor_base[desc_base].own) - { - skb = ppe_dev.dma.tx_skb_pointers[desc_base]; - atm_free_tx_skb_vcc(skb); - - // pretend PP32 hold owner bit, so that won't be released more than once, so allocation process don't check this bit - ppe_dev.dma.tx_descriptor_base[desc_base].own = 1; - } - if (++ppe_dev.dma.tx_desc_release_pos[conn] == ppe_dev.dma.tx_descriptor_number) - ppe_dev.dma.tx_desc_release_pos[conn] = 0; - } - } - - for (i = ppe_dev.dma.rx_total_channel_used * ppe_dev.dma.rx_descriptor_number - 1; i >= 0; i--) - dev_kfree_skb_any(*(struct sk_buff **)(((ppe_dev.dma.rx_descriptor_base[i].dataptr << 2) | KSEG0) - 4)); - - kfree(ppe_dev.dma.tx_skb_pointers); - kfree(ppe_dev.dma.tx_descriptor_addr); - kfree(ppe_dev.dma.rx_descriptor_addr); -} - -static inline int init_ppe_dev(void) -{ - int i, j; - int rx_desc, tx_desc; - int conn; - int oam_tx_queue; -#if !defined(ENABLE_RX_QOS) || !ENABLE_RX_QOS - int rx_dma_channel_base; - int rx_dma_channel_assigned; -#endif // !defined(ENABLE_RX_QOS) || !ENABLE_RX_QOS - - struct rx_descriptor rx_descriptor = { own: 1, - c: 0, - sop: 1, - eop: 1, - res1: 0, - byteoff:0, - res2: 0, - id: 0, - err: 0, - datalen:0, - res3: 0, - dataptr:0}; - - struct tx_descriptor tx_descriptor = { own: 1, // pretend it's hold by PP32 - c: 0, - sop: 1, - eop: 1, - byteoff:0, - res1: 0, - iscell: 0, - clp: 0, - datalen:0, - res2: 0, - dataptr:0}; - - memset(&ppe_dev, 0, sizeof(ppe_dev)); - - /* - * Setup AAL5 members, buffer size must be larger than max packet size plus overhead. - */ - ppe_dev.aal5.padding_byte = (u8)aal5_fill_pattern; - ppe_dev.aal5.rx_max_packet_size = (u32)aal5r_max_packet_size; - ppe_dev.aal5.rx_min_packet_size = (u32)aal5r_min_packet_size; - ppe_dev.aal5.rx_buffer_size = ((u32)(aal5r_max_packet_size > CELL_SIZE ? aal5r_max_packet_size + MAX_RX_FRAME_EXTRA_BYTES : CELL_SIZE + MAX_RX_FRAME_EXTRA_BYTES) + DMA_ALIGNMENT - 1) & ~(DMA_ALIGNMENT - 1); - ppe_dev.aal5.tx_max_packet_size = (u32)aal5s_max_packet_size; - ppe_dev.aal5.tx_min_packet_size = (u32)aal5s_min_packet_size; - ppe_dev.aal5.tx_buffer_size = ((u32)(aal5s_max_packet_size > CELL_SIZE ? aal5s_max_packet_size + MAX_TX_FRAME_EXTRA_BYTES : CELL_SIZE + MAX_TX_FRAME_EXTRA_BYTES) + DMA_ALIGNMENT - 1) & ~(DMA_ALIGNMENT - 1); - ppe_dev.aal5.rx_drop_error_packet = aal5r_drop_error_packet ? 1 : 0; - - /* - * Setup QSB members, please refer to Amazon spec 15.4 to get the value calculation formula. - */ - ppe_dev.qsb.tau = (u32)qsb_tau; - ppe_dev.qsb.tstepc = (u32)qsb_tstep; - ppe_dev.qsb.sbl = (u32)qsb_srvm; - - /* - * Setup port, connection, other members. - */ - conn = 0; - for ( i = 0; i < ATM_PORT_NUMBER; i++ ) - { - /* first connection ID of port */ - ppe_dev.port[i].connection_base = conn + QSB_QUEUE_NUMBER_BASE; - /* max number of connections of port */ - ppe_dev.port[i].max_connections = (u32)port_max_connection[i]; - /* max cell rate the port has */ - ppe_dev.port[i].tx_max_cell_rate = (u32)port_cell_rate_up[i]; - - /* link connection ID to port ID */ - for ( j = port_max_connection[i] - 1; j >= 0; j-- ) - ppe_dev.connection[conn++ + QSB_QUEUE_NUMBER_BASE].port = i; - } - /* total connection numbers of all ports */ - ppe_dev.max_connections = conn; - /* OAM RX queue ID, which is the first available connection ID after */ - /* connections assigned to ports. */ - ppe_dev.oam_rx_queue = conn + QSB_QUEUE_NUMBER_BASE; - -#if defined(ENABLE_RX_QOS) && ENABLE_RX_QOS - oam_tx_queue = conn; - for ( i = 0; i < ATM_PORT_NUMBER; i++ ) - if ( port_max_connection[i] != 0 ) - { - ppe_dev.port[i].oam_tx_queue = oam_tx_queue + QSB_QUEUE_NUMBER_BASE; - - for ( j = 0; j < OAM_TX_QUEUE_NUMBER_PER_PORT; j++ ) - /* Since connection ID is one to one mapped to RX/TX queue ID, the connection */ - /* structure must be reserved for OAM RX/TX queues, and member "port" is set */ - /* according to port to which OAM TX queue is connected. */ - ppe_dev.connection[oam_tx_queue++ + QSB_QUEUE_NUMBER_BASE].port = i; - } - /* DMA RX channel assigned to OAM RX queue */ - ppe_dev.oam_rx_dma_channel = RX_DMA_CH_OAM; - /* DMA RX channel will be assigned dynamically when VCC is open. */ -#else // defined(ENABLE_RX_QOS) && ENABLE_RX_QOS - rx_dma_channel_base = 0; - oam_tx_queue = conn; - for ( i = 0; i < ATM_PORT_NUMBER; i++ ) - if ( port_max_connection[i] != 0 ) - { - /* Calculate the number of DMA RX channels could be assigned to port. */ - rx_dma_channel_assigned = i == ATM_PORT_NUMBER - 1 - ? (MAX_RX_DMA_CHANNEL_NUMBER - OAM_RX_DMA_CHANNEL_NUMBER) - rx_dma_channel_base - : (ppe_dev.port[i].max_connections * (MAX_RX_DMA_CHANNEL_NUMBER - OAM_RX_DMA_CHANNEL_NUMBER) + ppe_dev.max_connections / 2) / ppe_dev.max_connections; - /* Amend the number, which could be zero. */ - if ( rx_dma_channel_assigned == 0 ) - rx_dma_channel_assigned = 1; - /* Calculate the first DMA RX channel ID could be assigned to port. */ - if ( rx_dma_channel_base + rx_dma_channel_assigned > MAX_RX_DMA_CHANNEL_NUMBER - OAM_RX_DMA_CHANNEL_NUMBER ) - rx_dma_channel_base = MAX_RX_DMA_CHANNEL_NUMBER - OAM_RX_DMA_CHANNEL_NUMBER - rx_dma_channel_assigned; - - /* first DMA RX channel ID */ - ppe_dev.port[i].rx_dma_channel_base = rx_dma_channel_base; - /* number of DMA RX channels assigned to this port */ - ppe_dev.port[i].rx_dma_channel_assigned = rx_dma_channel_assigned; - /* OAM TX queue ID, which must be assigned after connections assigned to ports */ - ppe_dev.port[i].oam_tx_queue = oam_tx_queue + QSB_QUEUE_NUMBER_BASE; - - rx_dma_channel_base += rx_dma_channel_assigned; - - for ( j = 0; j < OAM_TX_QUEUE_NUMBER_PER_PORT; j++ ) - /* Since connection ID is one to one mapped to RX/TX queue ID, the connection */ - /* structure must be reserved for OAM RX/TX queues, and member "port" is set */ - /* according to port to which OAM TX queue is connected. */ - ppe_dev.connection[oam_tx_queue++ + QSB_QUEUE_NUMBER_BASE].port = i; - } - /* DMA RX channel assigned to OAM RX queue */ - ppe_dev.oam_rx_dma_channel = rx_dma_channel_base; - - for ( i = 0; i < ATM_PORT_NUMBER; i++ ) - for ( j = 0; j < port_max_connection[i]; j++ ) - /* Assign DMA RX channel to RX queues. One channel could be assigned to more than one queue. */ - ppe_dev.connection[ppe_dev.port[i].connection_base + j].rx_dma_channel = ppe_dev.port[i].rx_dma_channel_base + j % ppe_dev.port[i].rx_dma_channel_assigned; -#endif // defined(ENABLE_RX_QOS) && ENABLE_RX_QOS - - /* initialize semaphore used by open and close */ - sema_init(&ppe_dev.sem, 1); - /* descriptor number of RX DMA channel */ - ppe_dev.dma.rx_descriptor_number = dma_rx_descriptor_length; - /* descriptor number of TX DMA channel */ - ppe_dev.dma.tx_descriptor_number = dma_tx_descriptor_length; - /* If used descriptors are more than this value, cell with CLP1 is dropped. */ - ppe_dev.dma.rx_clp1_desc_threshold = dma_rx_clp1_descriptor_threshold; - - /* delay on descriptor write path */ - ppe_dev.dma.write_descriptor_delay = write_descriptor_delay; - - /* total DMA RX channel used */ -#if defined(ENABLE_RX_QOS) && ENABLE_RX_QOS - ppe_dev.dma.rx_total_channel_used = RX_DMA_CH_TOTAL; -#else - ppe_dev.dma.rx_total_channel_used = rx_dma_channel_base + OAM_RX_DMA_CHANNEL_NUMBER; -#endif // defined(ENABLE_RX_QOS) && ENABLE_RX_QOS - /* total DMA TX channel used (exclude channel reserved by QSB) */ - ppe_dev.dma.tx_total_channel_used = oam_tx_queue; - - /* allocate memory for RX descriptors */ - ppe_dev.dma.rx_descriptor_addr = kmalloc(ppe_dev.dma.rx_total_channel_used * ppe_dev.dma.rx_descriptor_number * sizeof(struct rx_descriptor) + 4, GFP_KERNEL | GFP_DMA); - if ( !ppe_dev.dma.rx_descriptor_addr ) - goto RX_DESCRIPTOR_BASE_ALLOCATE_FAIL; - /* do alignment (DWORD) */ - ppe_dev.dma.rx_descriptor_base = (struct rx_descriptor *)(((u32)ppe_dev.dma.rx_descriptor_addr + 0x03) & ~0x03); - ppe_dev.dma.rx_descriptor_base = (struct rx_descriptor *)((u32)ppe_dev.dma.rx_descriptor_base | KSEG1); // no cache - - /* allocate memory for TX descriptors */ - ppe_dev.dma.tx_descriptor_addr = kmalloc(ppe_dev.dma.tx_total_channel_used * ppe_dev.dma.tx_descriptor_number * sizeof(struct tx_descriptor) + 4, GFP_KERNEL | GFP_DMA); - if ( !ppe_dev.dma.tx_descriptor_addr ) - goto TX_DESCRIPTOR_BASE_ALLOCATE_FAIL; - /* do alignment (DWORD) */ - ppe_dev.dma.tx_descriptor_base = (struct tx_descriptor *)(((u32)ppe_dev.dma.tx_descriptor_addr + 0x03) & ~0x03); - ppe_dev.dma.tx_descriptor_base = (struct tx_descriptor *)((u32)ppe_dev.dma.tx_descriptor_base | KSEG1); // no cache - /* allocate pointers to TX sk_buff */ - ppe_dev.dma.tx_skb_pointers = kmalloc(ppe_dev.dma.tx_total_channel_used * ppe_dev.dma.tx_descriptor_number * sizeof(struct sk_buff *), GFP_KERNEL); - if ( !ppe_dev.dma.tx_skb_pointers ) - goto TX_SKB_POINTER_ALLOCATE_FAIL; - memset(ppe_dev.dma.tx_skb_pointers, 0, ppe_dev.dma.tx_total_channel_used * ppe_dev.dma.tx_descriptor_number * sizeof(struct sk_buff *)); - - /* Allocate RX sk_buff and fill up RX descriptors. */ - rx_descriptor.datalen = ppe_dev.aal5.rx_buffer_size; - for ( rx_desc = ppe_dev.dma.rx_total_channel_used * ppe_dev.dma.rx_descriptor_number - 1; rx_desc >= 0; rx_desc-- ) - { - struct sk_buff *skb; - skb = alloc_skb_rx(); - if ( skb == NULL ) - panic("sk buffer is used up\n"); - rx_descriptor.dataptr = (u32)skb->data >> 2; - ppe_dev.dma.rx_descriptor_base[rx_desc] = rx_descriptor; - - } - - /* Fill up TX descriptors. */ - tx_descriptor.datalen = ppe_dev.aal5.tx_buffer_size; - for ( tx_desc = ppe_dev.dma.tx_total_channel_used * ppe_dev.dma.tx_descriptor_number - 1; tx_desc >= 0; tx_desc-- ) - ppe_dev.dma.tx_descriptor_base[tx_desc] = tx_descriptor; - - return 0; - -TX_SKB_POINTER_ALLOCATE_FAIL: - kfree(ppe_dev.dma.tx_descriptor_addr); -TX_DESCRIPTOR_BASE_ALLOCATE_FAIL: - kfree(ppe_dev.dma.rx_descriptor_addr); -RX_DESCRIPTOR_BASE_ALLOCATE_FAIL: - return -ENOMEM; -} - - -static inline void clear_share_buffer(void) -{ - volatile u32 *p = SB_RAM0_ADDR(0); - unsigned int i; - - /* write all zeros only */ - for ( i = 0; i < SB_RAM0_DWLEN + SB_RAM1_DWLEN + SB_RAM2_DWLEN + SB_RAM3_DWLEN; i++ ) - *p++ = 0; -} - - -static inline void check_parameters(void) -{ - int i; - int enabled_port_number; - int unassigned_queue_number; - int assigned_queue_number; - - enabled_port_number = 0; - for ( i = 0; i < ATM_PORT_NUMBER; i++ ) - if ( port_max_connection[i] < 1 ) - port_max_connection[i] = 0; - else - enabled_port_number++; - /* If the max connection number of a port is not 0, the port is enabled */ - /* and at lease two connection ID must be reserved for this port. One of */ - /* them is used as OAM TX path. */ - unassigned_queue_number = MAX_QUEUE_NUMBER - QSB_QUEUE_NUMBER_BASE; - for ( i = 0; i < ATM_PORT_NUMBER; i++ ) - if ( port_max_connection[i] > 0 ) - { - enabled_port_number--; - assigned_queue_number = unassigned_queue_number - enabled_port_number * (1 + OAM_TX_QUEUE_NUMBER_PER_PORT) - OAM_TX_QUEUE_NUMBER_PER_PORT; - if ( assigned_queue_number > MAX_QUEUE_NUMBER_PER_PORT - OAM_TX_QUEUE_NUMBER_PER_PORT ) - assigned_queue_number = MAX_QUEUE_NUMBER_PER_PORT - OAM_TX_QUEUE_NUMBER_PER_PORT; - if ( port_max_connection[i] > assigned_queue_number ) - { - port_max_connection[i] = assigned_queue_number; - unassigned_queue_number -= assigned_queue_number; - } - else - unassigned_queue_number -= port_max_connection[i]; - } - - /* Please refer to Amazon spec 15.4 for setting these values. */ - if ( qsb_tau < 1 ) - qsb_tau = 1; - if ( qsb_tstep < 1 ) - qsb_tstep = 1; - else if ( qsb_tstep > 4 ) - qsb_tstep = 4; - else if ( qsb_tstep == 3 ) - qsb_tstep = 2; - - /* There is a delay between PPE write descriptor and descriptor is */ - /* really stored in memory. Host also has this delay when writing */ - /* descriptor. So PPE will use this value to determine if the write */ - /* operation makes effect. */ - if ( write_descriptor_delay < 0 ) - write_descriptor_delay = 0; - - if ( aal5_fill_pattern < 0 ) - aal5_fill_pattern = 0; - else - aal5_fill_pattern &= 0xFF; - - /* Because of the limitation of length field in descriptors, the packet */ - /* size could not be larger than 64K minus overhead size. */ - if ( aal5r_max_packet_size < 0 ) - aal5r_max_packet_size = 0; - else if ( aal5r_max_packet_size >= 65536 - MAX_RX_FRAME_EXTRA_BYTES ) - aal5r_max_packet_size = 65536 - MAX_RX_FRAME_EXTRA_BYTES; - if ( aal5r_min_packet_size < 0 ) - aal5r_min_packet_size = 0; - else if ( aal5r_min_packet_size > aal5r_max_packet_size ) - aal5r_min_packet_size = aal5r_max_packet_size; - if ( aal5s_max_packet_size < 0 ) - aal5s_max_packet_size = 0; - else if ( aal5s_max_packet_size >= 65536 - MAX_TX_FRAME_EXTRA_BYTES ) - aal5s_max_packet_size = 65536 - MAX_TX_FRAME_EXTRA_BYTES; - if ( aal5s_min_packet_size < 0 ) - aal5s_min_packet_size = 0; - else if ( aal5s_min_packet_size > aal5s_max_packet_size ) - aal5s_min_packet_size = aal5s_max_packet_size; - - if ( dma_rx_descriptor_length < 2 ) - dma_rx_descriptor_length = 2; - if ( dma_tx_descriptor_length < 2 ) - dma_tx_descriptor_length = 2; - if ( dma_rx_clp1_descriptor_threshold < 0 ) - dma_rx_clp1_descriptor_threshold = 0; - else if ( dma_rx_clp1_descriptor_threshold > dma_rx_descriptor_length ) - dma_rx_clp1_descriptor_threshold = dma_rx_descriptor_length; -} - -static struct atmdev_ops ppe_atm_ops = { - owner: THIS_MODULE, - open: ppe_open, - close: ppe_close, - ioctl: ppe_ioctl, - send: ppe_send, - send_oam: ppe_send_oam, - change_qos: ppe_change_qos, -}; - -int __init danube_ppe_init(void) -{ - int ret; - int port_num; - - check_parameters(); - - ret = init_ppe_dev(); - if ( ret ) - goto INIT_PPE_DEV_FAIL; - - clear_share_buffer(); - init_rx_tables(); - init_tx_tables(); -printk("%s:%s[%d]\n", __FILE__, __func__, __LINE__); - - for ( port_num = 0; port_num < ATM_PORT_NUMBER; port_num++ ) - if ( ppe_dev.port[port_num].max_connections != 0 ) - { - printk("%s:%s[%d]\n", __FILE__, __func__, __LINE__); - ppe_dev.port[port_num].dev = atm_dev_register("danube_atm", &ppe_atm_ops, -1, 0UL); - if ( !ppe_dev.port[port_num].dev ) - { - printk("%s:%s[%d]\n", __FILE__, __func__, __LINE__); - ret = -EIO; - goto ATM_DEV_REGISTER_FAIL; - } - else - { - printk("%s:%s[%d]\n", __FILE__, __func__, __LINE__); - ppe_dev.port[port_num].dev->ci_range.vpi_bits = 8; - ppe_dev.port[port_num].dev->ci_range.vci_bits = 16; - ppe_dev.port[port_num].dev->link_rate = ppe_dev.port[port_num].tx_max_cell_rate; - ppe_dev.port[port_num].dev->dev_data = (void*)port_num; - } - } - /* register interrupt handler */ - ret = request_irq(IFXMIPS_PPE_MBOX_INT, mailbox_irq_handler, IRQF_DISABLED, "ppe_mailbox_isr", NULL); - if ( ret ) - { - if ( ret == -EBUSY ) - printk("ppe: IRQ may be occupied by ETH2 driver, please reconfig to disable it.\n"); - goto REQUEST_IRQ_IFXMIPS_PPE_MBOX_INT_FAIL; - } - disable_irq(IFXMIPS_PPE_MBOX_INT); - - #if defined(CONFIG_PCI) && defined(USE_FIX_FOR_PCI_PPE) && USE_FIX_FOR_PCI_PPE - ret = request_irq(PPE_MAILBOX_IGU0_INT, pci_fix_irq_handler, SA_INTERRUPT, "ppe_pci_fix_isr", NULL); - if ( ret ) - printk("failed in registering mailbox 0 interrupt (pci fix)\n"); - #endif // defined(CONFIG_PCI) && defined(USE_FIX_FOR_PCI_PPE) && USE_FIX_FOR_PCI_PPE - - ret = pp32_start(); - if ( ret ) - goto PP32_START_FAIL; - - qsb_global_set(); - HTU_ENTRY(OAM_F4_SEG_HTU_ENTRY)->vld = 1; - HTU_ENTRY(OAM_F4_TOT_HTU_ENTRY)->vld = 1; - HTU_ENTRY(OAM_F5_HTU_ENTRY)->vld = 1; - - /* create proc file */ - proc_file_create(); - - printk("ppe: ATM init succeeded (firmware version 1.1.0.2.1.13\n"); - return 0; - -PP32_START_FAIL: - - free_irq(IFXMIPS_PPE_MBOX_INT, NULL); -REQUEST_IRQ_IFXMIPS_PPE_MBOX_INT_FAIL: -ATM_DEV_REGISTER_FAIL: - clear_ppe_dev(); -INIT_PPE_DEV_FAIL: - printk("ppe: ATM init failed\n"); - return ret; -} - -void __exit danube_ppe_exit(void) -{ - int port_num; - register int l; - proc_file_delete(); - HTU_ENTRY(OAM_F4_SEG_HTU_ENTRY)->vld = 0; - HTU_ENTRY(OAM_F4_TOT_HTU_ENTRY)->vld = 0; - HTU_ENTRY(OAM_F5_HTU_ENTRY)->vld = 0; - /* idle for a while to finish running HTU search */ - for (l = 0; l < IDLE_CYCLE_NUMBER; l++ ); - pp32_stop(); - free_irq(IFXMIPS_PPE_MBOX_INT, NULL); - for ( port_num = 0; port_num < ATM_PORT_NUMBER; port_num++ ) - if ( ppe_dev.port[port_num].max_connections != 0 ) - atm_dev_deregister(ppe_dev.port[port_num].dev); - clear_ppe_dev(); -} - -module_init(danube_ppe_init); -module_exit(danube_ppe_exit); - -MODULE_LICENSE("GPL"); - diff --git a/package/ifxmips-atm/src/irq.c b/package/ifxmips-atm/src/irq.c deleted file mode 100644 index 02651686b..000000000 --- a/package/ifxmips-atm/src/irq.c +++ /dev/null @@ -1,506 +0,0 @@ -#include -#include - -#include "common.h" - -void mailbox_signal(unsigned int channel, int is_tx) -{ - if(is_tx) - { - while(MBOX_IGU3_ISR_ISR(channel + 16)); - *MBOX_IGU3_ISRS = MBOX_IGU3_ISRS_SET(channel + 16); - } else { - while(MBOX_IGU3_ISR_ISR(channel)); - *MBOX_IGU3_ISRS = MBOX_IGU3_ISRS_SET(channel); - } -} - -static int mailbox_rx_irq_handler(unsigned int channel, unsigned int *len) -{ - int conn; - int skb_base; - register struct rx_descriptor reg_desc; - struct rx_descriptor *desc; - struct sk_buff *skb; - struct atm_vcc *vcc; - struct rx_inband_trailer *trailer; - - /* get sk_buff pointer and descriptor */ - skb_base = ppe_dev.dma.rx_descriptor_number * channel + ppe_dev.dma.rx_desc_read_pos[channel]; - desc = &ppe_dev.dma.rx_descriptor_base[skb_base]; - reg_desc = *desc; - if ( reg_desc.own || !reg_desc.c ) - return -EAGAIN; - - if ( ++ppe_dev.dma.rx_desc_read_pos[channel] == ppe_dev.dma.rx_descriptor_number ) - ppe_dev.dma.rx_desc_read_pos[channel] = 0; - - skb = *(struct sk_buff **)((((u32)reg_desc.dataptr << 2) | KSEG0) - 4); - if ( (u32)skb <= 0x80000000 ) - { - int key = 0; - printk("skb problem: skb = %08X, system is panic!\n", (u32)skb); - for ( ; !key; ); - } - - conn = reg_desc.id; - - if ( conn == ppe_dev.oam_rx_queue ) - { - /* OAM */ - struct uni_cell_header *header = (struct uni_cell_header *)skb->data; - - if ( header->pti == ATM_PTI_SEGF5 || header->pti == ATM_PTI_E2EF5 ) - conn = find_vpivci(header->vpi, header->vci); - else if ( header->vci == 0x03 || header->vci == 0x04 ) - conn = find_vpi(header->vpi); - else - conn = -1; - - if ( conn >= 0 && ppe_dev.connection[conn].vcc != NULL ) - { - vcc = ppe_dev.connection[conn].vcc; - ppe_dev.connection[conn].access_time = xtime; - if ( vcc->push_oam != NULL ) - vcc->push_oam(vcc, skb->data); - } - - /* don't need resize */ - } - else - { - if ( len ) - *len = 0; - - if ( ppe_dev.connection[conn].vcc != NULL ) - { - vcc = ppe_dev.connection[conn].vcc; - - if ( !reg_desc.err ) - if ( vcc->qos.aal == ATM_AAL5 ) - { - /* AAL5 packet */ - resize_skb_rx(skb, reg_desc.datalen + reg_desc.byteoff, 0); - skb_reserve(skb, reg_desc.byteoff); - skb_put(skb, reg_desc.datalen); - - if ( (u32)ATM_SKB(skb) <= 0x80000000 ) - { - int key = 0; - printk("ATM_SKB(skb) problem: ATM_SKB(skb) = %08X, system is panic!\n", (u32)ATM_SKB(skb)); - for ( ; !key; ); - } - ATM_SKB(skb)->vcc = vcc; - ppe_dev.connection[conn].access_time = xtime; - if ( atm_charge(vcc, skb->truesize) ) - { - struct sk_buff *new_skb; - - new_skb = alloc_skb_rx(); - if ( new_skb ) - { - - UPDATE_VCC_STAT(conn, rx_pdu, 1); - - ppe_dev.mib.wrx_pdu++; - if ( vcc->stats ) - atomic_inc(&vcc->stats->rx); - vcc->push(vcc, skb); - { - struct k_atm_aal_stats stats = *vcc->stats; - int flag = 0; - - vcc->push(vcc, skb); - if ( vcc->stats->rx.counter != stats.rx.counter ) - { - printk("vcc->stats->rx (diff) = %d", vcc->stats->rx.counter - stats.rx.counter); - flag++; - } - if ( vcc->stats->rx_err.counter != stats.rx_err.counter ) - { - printk("vcc->stats->rx_err (diff) = %d", vcc->stats->rx_err.counter - stats.rx_err.counter); - flag++; - } - if ( vcc->stats->rx_drop.counter != stats.rx_drop.counter ) - { - printk("vcc->stats->rx_drop (diff) = %d", vcc->stats->rx_drop.counter - stats.rx_drop.counter); - flag++; - } - if ( vcc->stats->tx.counter != stats.tx.counter ) - { - printk("vcc->stats->tx (diff) = %d", vcc->stats->tx.counter - stats.tx.counter); - flag++; - } - if ( vcc->stats->tx_err.counter != stats.tx_err.counter ) - { - printk("vcc->stats->tx_err (diff) = %d", vcc->stats->tx_err.counter - stats.tx_err.counter); - flag++; - } - if ( !flag ) - printk("vcc->stats not changed"); - } - reg_desc.dataptr = (u32)new_skb->data >> 2; - - if ( len ) - *len = reg_desc.datalen; - } - else - { - /* no sk buffer */ - UPDATE_VCC_STAT(conn, rx_sw_drop_pdu, 1); - - ppe_dev.mib.wrx_drop_pdu++; - if ( vcc->stats ) - atomic_inc(&vcc->stats->rx_drop); - - resize_skb_rx(skb, ppe_dev.aal5.rx_buffer_size, 0); - } - } - else - { - /* no enough space */ - UPDATE_VCC_STAT(conn, rx_sw_drop_pdu, 1); - - ppe_dev.mib.wrx_drop_pdu++; - if ( vcc->stats ) - atomic_inc(&vcc->stats->rx_drop); - - resize_skb_rx(skb, ppe_dev.aal5.rx_buffer_size, 0); - } - } - else - { - /* AAL0 cell */ - resize_skb_rx(skb, CELL_SIZE, 1); - skb_put(skb, CELL_SIZE); - - ATM_SKB(skb)->vcc = vcc; - ppe_dev.connection[conn].access_time = xtime; - if ( atm_charge(vcc, skb->truesize) ) - { - struct sk_buff *new_skb; - - new_skb = alloc_skb_rx(); - if ( new_skb ) - { - if ( vcc->stats ) - atomic_inc(&vcc->stats->rx); - vcc->push(vcc, skb); - reg_desc.dataptr = (u32)new_skb->data >> 2; - - if ( len ) - *len = CELL_SIZE; - } - else - { - if ( vcc->stats ) - atomic_inc(&vcc->stats->rx_drop); - resize_skb_rx(skb, ppe_dev.aal5.rx_buffer_size, 0); - } - } - else - { - if ( vcc->stats ) - atomic_inc(&vcc->stats->rx_drop); - resize_skb_rx(skb, ppe_dev.aal5.rx_buffer_size, 0); - } - } - else - { -printk("reg_desc.err\n"); - - /* drop packet/cell */ - if ( vcc->qos.aal == ATM_AAL5 ) - { - UPDATE_VCC_STAT(conn, rx_err_pdu, 1); - - trailer = (struct rx_inband_trailer *)((u32)skb->data + ((reg_desc.byteoff + reg_desc.datalen + DMA_ALIGNMENT - 1) & ~ (DMA_ALIGNMENT - 1))); - if ( trailer->stw_crc ) - ppe_dev.connection[conn].aal5_vcc_crc_err++; - if ( trailer->stw_ovz ) - ppe_dev.connection[conn].aal5_vcc_oversize_sdu++; - } - if ( vcc->stats ) - atomic_inc(&vcc->stats->rx_err); - /* don't need resize */ - } - } - else - { -printk("ppe_dev.connection[%d].vcc == NULL\n", conn); - - ppe_dev.mib.wrx_drop_pdu++; - - /* don't need resize */ - } - } - - reg_desc.byteoff = 0; - reg_desc.datalen = ppe_dev.aal5.rx_buffer_size; - reg_desc.own = 1; - reg_desc.c = 0; - - /* write discriptor to memory */ - *desc = reg_desc; - -printk("leave mailbox_rx_irq_handler"); - - return 0; -} - -static inline void mailbox_tx_irq_handler(unsigned int conn) -{ - if ( ppe_dev.dma.tx_desc_alloc_flag[conn] ) - { - int desc_base; - int *release_pos; - struct sk_buff *skb; - - release_pos = &ppe_dev.dma.tx_desc_release_pos[conn]; - desc_base = ppe_dev.dma.tx_descriptor_number * (conn - QSB_QUEUE_NUMBER_BASE) + *release_pos; - while ( !ppe_dev.dma.tx_descriptor_base[desc_base].own ) - { - skb = ppe_dev.dma.tx_skb_pointers[desc_base]; - - ppe_dev.dma.tx_descriptor_base[desc_base].own = 1; // pretend PP32 hold owner bit, so that won't be released more than once, so allocation process don't check this bit - - if ( ++*release_pos == ppe_dev.dma.tx_descriptor_number ) - *release_pos = 0; - - if ( *release_pos == ppe_dev.dma.tx_desc_alloc_pos[conn] ) - { - ppe_dev.dma.tx_desc_alloc_flag[conn] = 0; - - atm_free_tx_skb_vcc(skb); - break; - } - - if ( *release_pos == 0 ) - desc_base = ppe_dev.dma.tx_descriptor_number * (conn - QSB_QUEUE_NUMBER_BASE); - else - desc_base++; - - atm_free_tx_skb_vcc(skb); - } - } -} - -#if defined(ENABLE_RX_QOS) && ENABLE_RX_QOS -static inline int check_desc_valid(unsigned int channel) -{ - int skb_base; - struct rx_descriptor *desc; - - skb_base = ppe_dev.dma.rx_descriptor_number * channel + ppe_dev.dma.rx_desc_read_pos[channel]; - desc = &ppe_dev.dma.rx_descriptor_base[skb_base]; - return !desc->own && desc->c ? 1 : 0; -} -#endif - -irqreturn_t mailbox_irq_handler(int irq, void *dev_id) -{ - int channel_mask; /* DMA channel accordant IRQ bit mask */ - int channel; - unsigned int rx_irq_number[MAX_RX_DMA_CHANNEL_NUMBER] = {0}; - unsigned int total_rx_irq_number = 0; - -printk("mailbox_irq_handler"); - - if ( !*MBOX_IGU1_ISR ) - return IRQ_RETVAL(1); - - channel_mask = 1; - channel = 0; - while ( channel < ppe_dev.dma.rx_total_channel_used ) - { - if ( (*MBOX_IGU1_ISR & channel_mask) ) - { - /* RX */ - /* clear IRQ */ - *MBOX_IGU1_ISRC = channel_mask; -printk(" RX: *MBOX_IGU1_ISR = 0x%08X\n", *MBOX_IGU1_ISR); - /* wait for mailbox cleared */ - while ( (*MBOX_IGU3_ISR & channel_mask) ); - - /* shadow the number of valid descriptor */ - rx_irq_number[channel] = WRX_DMA_CHANNEL_CONFIG(channel)->vlddes; - - total_rx_irq_number += rx_irq_number[channel]; - -printk("total_rx_irq_number = %d", total_rx_irq_number); -printk("vlddes = %d, rx_irq_number[%d] = %d, total_rx_irq_number = %d\n", WRX_DMA_CHANNEL_CONFIG(channel)->vlddes, channel, rx_irq_number[channel], total_rx_irq_number); - } - - channel_mask <<= 1; - channel++; - } - - channel_mask = 1 << (16 + QSB_QUEUE_NUMBER_BASE); - channel = QSB_QUEUE_NUMBER_BASE; - while ( channel - QSB_QUEUE_NUMBER_BASE < ppe_dev.dma.tx_total_channel_used ) - { - if ( (*MBOX_IGU1_ISR & channel_mask) ) - { -// if ( channel != 1 ) -// { -printk("TX irq error\n"); -// while ( 1 ) -// { -// } -// } - /* TX */ - /* clear IRQ */ - *MBOX_IGU1_ISRC = channel_mask; -printk(" TX: *MBOX_IGU1_ISR = 0x%08X\n", *MBOX_IGU1_ISR); - mailbox_tx_irq_handler(channel); - } - - channel_mask <<= 1; - channel++; - } - - #if defined(ENABLE_RX_QOS) && ENABLE_RX_QOS - channel = 0; - while ( total_rx_irq_number ) - { - switch ( channel ) - { - case RX_DMA_CH_CBR: - case RX_DMA_CH_OAM: - /* handle it as soon as possible */ - while ( rx_irq_number[channel] != 0 && mailbox_rx_irq_handler(channel, NULL) == 0 ) - { - rx_irq_number[channel]--; - total_rx_irq_number--; -printk("RX_DMA_CH_CBR, total_rx_irq_number = %d", total_rx_irq_number); -printk("RX_DMA_CH_CBR, total_rx_irq_number = %d, rx_irq_number[%d] = %d\n", total_rx_irq_number, channel, rx_irq_number[channel]); - /* signal firmware that descriptor is updated */ - mailbox_signal(channel, 0); - } -// if ( rx_irq_number[channel] != 0 ) -printk("RX_DMA_CH_CBR, rx_irq_number[channel] = %d", rx_irq_number[channel]); - break; - case RX_DMA_CH_VBR_RT: - /* WFQ */ - if ( rx_irq_number[RX_DMA_CH_VBR_RT] != 0 - && (rx_irq_number[RX_DMA_CH_VBR_NRT] == 0 || !check_desc_valid(RX_DMA_CH_VBR_NRT) || ppe_dev.dma.rx_weight[RX_DMA_CH_VBR_NRT] < ppe_dev.dma.rx_weight[RX_DMA_CH_VBR_RT]) - && (rx_irq_number[RX_DMA_CH_AVR] == 0 || !check_desc_valid(RX_DMA_CH_AVR) || ppe_dev.dma.rx_weight[RX_DMA_CH_AVR] < ppe_dev.dma.rx_weight[RX_DMA_CH_VBR_RT]) - ) - { - unsigned int len; - - if ( mailbox_rx_irq_handler(RX_DMA_CH_VBR_RT, &len) == 0 ) - { - rx_irq_number[RX_DMA_CH_VBR_RT]--; - total_rx_irq_number--; -printk("RX_DMA_CH_VBR_RT, total_rx_irq_number = %d", total_rx_irq_number); -printk("RX_DMA_CH_VBR_RT, total_rx_irq_number = %d, rx_irq_number[%d] = %d\n", total_rx_irq_number, channel, rx_irq_number[channel]); - /* signal firmware that descriptor is updated */ - mailbox_signal(channel, 0); - - len = (len + CELL_SIZE - 1) / CELL_SIZE; - if ( ppe_dev.dma.rx_weight[RX_DMA_CH_VBR_RT] <= len ) - ppe_dev.dma.rx_weight[RX_DMA_CH_VBR_RT] = ppe_dev.dma.rx_default_weight[RX_DMA_CH_VBR_RT] + ppe_dev.dma.rx_weight[RX_DMA_CH_VBR_RT] - len; - } - } -// if ( rx_irq_number[channel] != 0 ) -// { -printk("RX_DMA_CH_VBR_RT, rx_irq_number[channel] = %d, total_rx_irq_number = %d", rx_irq_number[channel], total_rx_irq_number); -// rx_irq_number[channel] = 0; -// total_rx_irq_number = 0; -// } - break; - case RX_DMA_CH_VBR_NRT: - /* WFQ */ - if ( rx_irq_number[RX_DMA_CH_VBR_NRT] != 0 - && (rx_irq_number[RX_DMA_CH_VBR_RT] == 0 || !check_desc_valid(RX_DMA_CH_VBR_RT) || ppe_dev.dma.rx_weight[RX_DMA_CH_VBR_RT] < ppe_dev.dma.rx_weight[RX_DMA_CH_VBR_NRT]) - && (rx_irq_number[RX_DMA_CH_AVR] == 0 || !check_desc_valid(RX_DMA_CH_AVR) || ppe_dev.dma.rx_weight[RX_DMA_CH_AVR] < ppe_dev.dma.rx_weight[RX_DMA_CH_VBR_NRT]) - ) - { - unsigned int len; - - if ( mailbox_rx_irq_handler(RX_DMA_CH_VBR_NRT, &len) == 0 ) - { - rx_irq_number[RX_DMA_CH_VBR_NRT]--; - total_rx_irq_number--; -printk("RX_DMA_CH_VBR_NRT, total_rx_irq_number = %d", total_rx_irq_number); -printk("RX_DMA_CH_VBR_NRT, total_rx_irq_number = %d, rx_irq_number[%d] = %d\n", total_rx_irq_number, channel, rx_irq_number[channel]); - /* signal firmware that descriptor is updated */ - mailbox_signal(channel, 0); - - len = (len + CELL_SIZE - 1) / CELL_SIZE; - if ( ppe_dev.dma.rx_weight[RX_DMA_CH_VBR_NRT] <= len ) - ppe_dev.dma.rx_weight[RX_DMA_CH_VBR_NRT] = ppe_dev.dma.rx_default_weight[RX_DMA_CH_VBR_NRT] + ppe_dev.dma.rx_weight[RX_DMA_CH_VBR_NRT] - len; - } - } -// if ( rx_irq_number[channel] != 0 ) -printk("RX_DMA_CH_VBR_NRT, rx_irq_number[channel] = %d", rx_irq_number[channel]); - break; - case RX_DMA_CH_AVR: - /* WFQ */ - if ( rx_irq_number[RX_DMA_CH_AVR] != 0 - && (rx_irq_number[RX_DMA_CH_VBR_RT] == 0 || !check_desc_valid(RX_DMA_CH_VBR_RT) || ppe_dev.dma.rx_weight[RX_DMA_CH_VBR_RT] < ppe_dev.dma.rx_weight[RX_DMA_CH_AVR]) - && (rx_irq_number[RX_DMA_CH_VBR_NRT] == 0 || !check_desc_valid(RX_DMA_CH_VBR_NRT) || ppe_dev.dma.rx_weight[RX_DMA_CH_VBR_NRT] < ppe_dev.dma.rx_weight[RX_DMA_CH_AVR]) - ) - { - unsigned int len; - - if ( mailbox_rx_irq_handler(RX_DMA_CH_AVR, &len) == 0 ) - { - rx_irq_number[RX_DMA_CH_AVR]--; - total_rx_irq_number--; -printk("RX_DMA_CH_AVR, total_rx_irq_number = %d", total_rx_irq_number); -printk("RX_DMA_CH_AVR, total_rx_irq_number = %d, rx_irq_number[%d] = %d\n", total_rx_irq_number, channel, rx_irq_number[channel]); - /* signal firmware that descriptor is updated */ - mailbox_signal(channel, 0); - - len = (len + CELL_SIZE - 1) / CELL_SIZE; - if ( ppe_dev.dma.rx_weight[RX_DMA_CH_AVR] <= len ) - ppe_dev.dma.rx_weight[RX_DMA_CH_AVR] = ppe_dev.dma.rx_default_weight[RX_DMA_CH_AVR] + ppe_dev.dma.rx_weight[RX_DMA_CH_AVR] - len; - } - } -// if ( rx_irq_number[channel] != 0 ) -printk("RX_DMA_CH_AVR, rx_irq_number[channel] = %d", rx_irq_number[channel]); - break; - case RX_DMA_CH_UBR: - default: - /* Handle it when all others are handled or others are not available to handle. */ - if ( rx_irq_number[channel] != 0 - && (rx_irq_number[RX_DMA_CH_VBR_RT] == 0 || !check_desc_valid(RX_DMA_CH_VBR_RT)) - && (rx_irq_number[RX_DMA_CH_VBR_NRT] == 0 || !check_desc_valid(RX_DMA_CH_VBR_NRT)) - && (rx_irq_number[RX_DMA_CH_AVR] == 0 || !check_desc_valid(RX_DMA_CH_AVR)) ) - if ( mailbox_rx_irq_handler(channel, NULL) == 0 ) - { - rx_irq_number[channel]--; - total_rx_irq_number--; -printk("RX_DMA_CH_UBR, total_rx_irq_number = %d, rx_irq_number[%d] = %d", total_rx_irq_number, channel, rx_irq_number[channel]); -printk("RX_DMA_CH_UBR, total_rx_irq_number = %d, rx_irq_number[%d] = %d\n", total_rx_irq_number, channel, rx_irq_number[channel]); - /* signal firmware that descriptor is updated */ - mailbox_signal(channel, 0); - } -printk("RX_DMA_CH_UBR, rx_irq_number[channel] = %d", rx_irq_number[channel]); - } - - if ( ++channel == ppe_dev.dma.rx_total_channel_used ) - channel = 0; - } - #else - channel = 0; - while ( total_rx_irq_number ) - { - while ( rx_irq_number[channel] != 0 && mailbox_rx_irq_handler(channel, NULL) == 0 ) - { - rx_irq_number[channel]--; - total_rx_irq_number--; - /* signal firmware that descriptor is updated */ - mailbox_signal(channel, 0); - } - - if ( ++channel == ppe_dev.dma.rx_total_channel_used ) - channel = 0; - } - #endif // defined(ENABLE_RX_QOS) && ENABLE_RX_QOS - return IRQ_RETVAL(1); -} - - diff --git a/package/ifxmips-atm/src/ppe.c b/package/ifxmips-atm/src/ppe.c deleted file mode 100644 index 65e4be9c6..000000000 --- a/package/ifxmips-atm/src/ppe.c +++ /dev/null @@ -1,838 +0,0 @@ -#include -#include "common.h" - -#include "ifx_ppe_fw.h" -static void set_qsb(struct atm_vcc *vcc, struct atm_qos *qos, unsigned int connection) -{ - - u32 qsb_clk = cgu_get_fpi_bus_clock(2); /* FPI configuration 2 (slow FPI bus) */ - union qsb_queue_parameter_table qsb_queue_parameter_table = {{0}}; - union qsb_queue_vbr_parameter_table qsb_queue_vbr_parameter_table = {{0}}; - u32 tmp; - - /* - * Peak Cell Rate (PCR) Limiter - */ - if ( qos->txtp.max_pcr == 0 ) - qsb_queue_parameter_table.bit.tp = 0; /* disable PCR limiter */ - else - { - /* peak cell rate would be slightly lower than requested [maximum_rate / pcr = (qsb_clock / 8) * (time_step / 4) / pcr] */ - tmp = ((qsb_clk * ppe_dev.qsb.tstepc) >> 5) / qos->txtp.max_pcr + 1; - /* check if overflow takes place */ - qsb_queue_parameter_table.bit.tp = tmp > QSB_TP_TS_MAX ? QSB_TP_TS_MAX : tmp; - } - /* - * Weighted Fair Queueing Factor (WFQF) - */ - switch ( qos->txtp.traffic_class ) - { - case ATM_CBR: - case ATM_VBR_RT: - /* real time queue gets weighted fair queueing bypass */ - qsb_queue_parameter_table.bit.wfqf = 0; - break; - case ATM_VBR_NRT: - case ATM_UBR_PLUS: - /* WFQF calculation here is based on virtual cell rates, to reduce granularity for high rates */ - /* WFQF is maximum cell rate / garenteed cell rate */ - /* wfqf = qsb_minimum_cell_rate * QSB_WFQ_NONUBR_MAX / requested_minimum_peak_cell_rate */ - if ( qos->txtp.min_pcr == 0 ) - qsb_queue_parameter_table.bit.wfqf = QSB_WFQ_NONUBR_MAX; - else - { - tmp = QSB_GCR_MIN * QSB_WFQ_NONUBR_MAX / qos->txtp.min_pcr; - if ( tmp == 0 ) - qsb_queue_parameter_table.bit.wfqf = 1; - else if ( tmp > QSB_WFQ_NONUBR_MAX ) - qsb_queue_parameter_table.bit.wfqf = QSB_WFQ_NONUBR_MAX; - else - qsb_queue_parameter_table.bit.wfqf = tmp; - } - break; - default: - case ATM_UBR: - qsb_queue_parameter_table.bit.wfqf = QSB_WFQ_UBR_BYPASS; - } - /* - * Sustained Cell Rate (SCR) Leaky Bucket Shaper VBR.0/VBR.1 - */ - if ( qos->txtp.traffic_class == ATM_VBR_RT || qos->txtp.traffic_class == ATM_VBR_NRT ) - { - if ( qos->txtp.scr == 0 ) - { - /* disable shaper */ - qsb_queue_vbr_parameter_table.bit.taus = 0; - qsb_queue_vbr_parameter_table.bit.ts = 0; - } - else - { - /* Cell Loss Priority (CLP) */ - if ( (vcc->atm_options & ATM_ATMOPT_CLP) ) - /* CLP1 */ - qsb_queue_parameter_table.bit.vbr = 1; - else - /* CLP0 */ - qsb_queue_parameter_table.bit.vbr = 0; - /* Rate Shaper Parameter (TS) and Burst Tolerance Parameter for SCR (tauS) */ - tmp = ((qsb_clk * ppe_dev.qsb.tstepc) >> 5) / qos->txtp.scr + 1; - qsb_queue_vbr_parameter_table.bit.ts = tmp > QSB_TP_TS_MAX ? QSB_TP_TS_MAX : tmp; - tmp = (qos->txtp.mbs - 1) * (qsb_queue_vbr_parameter_table.bit.ts - qsb_queue_parameter_table.bit.tp) / 64; - if ( tmp == 0 ) - qsb_queue_vbr_parameter_table.bit.taus = 1; - else if ( tmp > QSB_TAUS_MAX ) - qsb_queue_vbr_parameter_table.bit.taus = QSB_TAUS_MAX; - else - qsb_queue_vbr_parameter_table.bit.taus = tmp; - } - } - else - { - qsb_queue_vbr_parameter_table.bit.taus = 0; - qsb_queue_vbr_parameter_table.bit.ts = 0; - } - - /* Queue Parameter Table (QPT) */ - *QSB_RTM = QSB_RTM_DM_SET(QSB_QPT_SET_MASK); - *QSB_RTD = QSB_RTD_TTV_SET(qsb_queue_parameter_table.dword); - *QSB_RAMAC = QSB_RAMAC_RW_SET(QSB_RAMAC_RW_WRITE) | QSB_RAMAC_TSEL_SET(QSB_RAMAC_TSEL_QPT) | QSB_RAMAC_LH_SET(QSB_RAMAC_LH_LOW) | QSB_RAMAC_TESEL_SET(connection); - /* Queue VBR Paramter Table (QVPT) */ - *QSB_RTM = QSB_RTM_DM_SET(QSB_QVPT_SET_MASK); - *QSB_RTD = QSB_RTD_TTV_SET(qsb_queue_vbr_parameter_table.dword); - *QSB_RAMAC = QSB_RAMAC_RW_SET(QSB_RAMAC_RW_WRITE) | QSB_RAMAC_TSEL_SET(QSB_RAMAC_TSEL_VBR) | QSB_RAMAC_LH_SET(QSB_RAMAC_LH_LOW) | QSB_RAMAC_TESEL_SET(connection); - -} - - -static inline void u64_add_u32(ppe_u64_t opt1, u32 opt2,ppe_u64_t *ret) -{ - ret->l = opt1.l + opt2; - if ( ret->l < opt1.l || ret->l < opt2 ) - ret->h++; -} - -int find_vcc(struct atm_vcc *vcc) -{ - int i; - struct connection *connection = ppe_dev.connection; - int max_connections = ppe_dev.port[(int)vcc->dev->dev_data].max_connections; - u32 occupation_table = ppe_dev.port[(int)vcc->dev->dev_data].connection_table; - int base = ppe_dev.port[(int)vcc->dev->dev_data].connection_base; - for ( i = 0; i < max_connections; i++, base++ ) - if ( (occupation_table & (1 << i)) - && connection[base].vcc == vcc ) - return base; - return -1; -} - -int find_vpi(unsigned int vpi) -{ - int i, j; - struct connection *connection = ppe_dev.connection; - struct port *port; - int base; - - port = ppe_dev.port; - for ( i = 0; i < ATM_PORT_NUMBER; i++, port++ ) - { - base = port->connection_base; - for ( j = 0; j < port->max_connections; j++, base++ ) - if ( (port->connection_table & (1 << j)) - && connection[base].vcc != NULL - && vpi == connection[base].vcc->vpi ) - return base; - } - return -1; -} - -int find_vpivci(unsigned int vpi, unsigned int vci) -{ - int i, j; - struct connection *connection = ppe_dev.connection; - struct port *port; - int base; - - port = ppe_dev.port; - for ( i = 0; i < ATM_PORT_NUMBER; i++, port++ ) - { - base = port->connection_base; - for ( j = 0; j < port->max_connections; j++, base++ ) - if ( (port->connection_table & (1 << j)) - && connection[base].vcc != NULL - && vpi == connection[base].vcc->vpi - && vci == connection[base].vcc->vci ) - return base; - } - return -1; -} - - -static inline void clear_htu_entry(unsigned int connection) -{ - HTU_ENTRY(connection - QSB_QUEUE_NUMBER_BASE + OAM_HTU_ENTRY_NUMBER)->vld = 0; -} - -static inline void set_htu_entry(unsigned int vpi, unsigned int vci, unsigned int connection, int aal5) -{ - struct htu_entry htu_entry = { res1: 0x00, - pid: ppe_dev.connection[connection].port & 0x01, - vpi: vpi, - vci: vci, - pti: 0x00, - vld: 0x01}; - - struct htu_mask htu_mask = { set: 0x03, - pid_mask: 0x02, - vpi_mask: 0x00, - vci_mask: 0x0000, - pti_mask: 0x03, // 0xx, user data - clear: 0x00}; - - struct htu_result htu_result = {res1: 0x00, - cellid: connection, - res2: 0x00, - type: aal5 ? 0x00 : 0x01, - ven: 0x01, - res3: 0x00, - qid: connection}; - - *HTU_RESULT(connection - QSB_QUEUE_NUMBER_BASE + OAM_HTU_ENTRY_NUMBER) = htu_result; - *HTU_MASK(connection - QSB_QUEUE_NUMBER_BASE + OAM_HTU_ENTRY_NUMBER) = htu_mask; - *HTU_ENTRY(connection - QSB_QUEUE_NUMBER_BASE + OAM_HTU_ENTRY_NUMBER) = htu_entry; -} - -int alloc_tx_connection(int connection) -{ - unsigned long sys_flag; - int desc_base; - - if ( ppe_dev.dma.tx_desc_alloc_pos[connection] == ppe_dev.dma.tx_desc_release_pos[connection] && ppe_dev.dma.tx_desc_alloc_flag[connection] ) - return -1; - - /* amend descriptor pointer and allocation number */ - local_irq_save(sys_flag); - desc_base = ppe_dev.dma.tx_descriptor_number * (connection - QSB_QUEUE_NUMBER_BASE) + ppe_dev.dma.tx_desc_alloc_pos[connection]; - if ( ++ppe_dev.dma.tx_desc_alloc_pos[connection] == ppe_dev.dma.tx_descriptor_number ) - ppe_dev.dma.tx_desc_alloc_pos[connection] = 0; - ppe_dev.dma.tx_desc_alloc_flag[connection] = 1; - local_irq_restore(sys_flag); - - return desc_base; -} - - -int ppe_open(struct atm_vcc *vcc) -{ - int ret; - struct port *port = &ppe_dev.port[(int)vcc->dev->dev_data]; - int conn; - int f_enable_irq = 0; - int i; -printk("%s:%s[%d] removed 2 args from signature\n", __FILE__, __func__, __LINE__); - -printk("ppe_open"); - - if ( vcc->qos.aal != ATM_AAL5 && vcc->qos.aal != ATM_AAL0 ) - return -EPROTONOSUPPORT; - - down(&ppe_dev.sem); - - /* check bandwidth */ - if ( (vcc->qos.txtp.traffic_class == ATM_CBR && vcc->qos.txtp.max_pcr > (port->tx_max_cell_rate - port->tx_current_cell_rate)) - || (vcc->qos.txtp.traffic_class == ATM_VBR_RT && vcc->qos.txtp.max_pcr > (port->tx_max_cell_rate - port->tx_current_cell_rate)) - || (vcc->qos.txtp.traffic_class == ATM_VBR_NRT && vcc->qos.txtp.pcr > (port->tx_max_cell_rate - port->tx_current_cell_rate)) - || (vcc->qos.txtp.traffic_class == ATM_UBR_PLUS && vcc->qos.txtp.min_pcr > (port->tx_max_cell_rate - port->tx_current_cell_rate)) ) - { - ret = -EINVAL; - goto PPE_OPEN_EXIT; - } - - printk("alloc vpi = %d, vci = %d\n", vcc->vpi, vcc->vci); - - /* check existing vpi,vci */ - conn = find_vpivci(vcc->vpi, vcc->vci); - if ( conn >= 0 ) - { - ret = -EADDRINUSE; - goto PPE_OPEN_EXIT; - } - - /* check whether it need to enable irq */ - for ( i = 0; i < ATM_PORT_NUMBER; i++ ) - if ( ppe_dev.port[i].max_connections != 0 && ppe_dev.port[i].connection_table != 0 ) - break; - if ( i == ATM_PORT_NUMBER ) - f_enable_irq = 1; - - /* allocate connection */ - for ( i = 0, conn = port->connection_base; i < port->max_connections; i++, conn++ ) - if ( !(port->connection_table & (1 << i)) ) - { - port->connection_table |= 1 << i; - ppe_dev.connection[conn].vcc = vcc; - break; - } - if ( i == port->max_connections ) - { - ret = -EINVAL; - goto PPE_OPEN_EXIT; - } - -#if defined(ENABLE_RX_QOS) && ENABLE_RX_QOS - /* assign DMA channel and setup weight value for RX QoS */ - switch ( vcc->qos.rxtp.traffic_class ) - { - case ATM_CBR: - ppe_dev.connection[conn].rx_dma_channel = RX_DMA_CH_CBR; - break; - case ATM_VBR_RT: - ppe_dev.connection[conn].rx_dma_channel = RX_DMA_CH_VBR_RT; - ppe_dev.dma.rx_default_weight[RX_DMA_CH_VBR_RT] += vcc->qos.rxtp.max_pcr; - ppe_dev.dma.rx_weight[RX_DMA_CH_VBR_RT] += vcc->qos.rxtp.max_pcr; - break; - case ATM_VBR_NRT: - ppe_dev.connection[conn].rx_dma_channel = RX_DMA_CH_VBR_NRT; - ppe_dev.dma.rx_default_weight[RX_DMA_CH_VBR_NRT] += vcc->qos.rxtp.pcr; - ppe_dev.dma.rx_weight[RX_DMA_CH_VBR_NRT] += vcc->qos.rxtp.pcr; - break; - case ATM_ABR: - ppe_dev.connection[conn].rx_dma_channel = RX_DMA_CH_AVR; - ppe_dev.dma.rx_default_weight[RX_DMA_CH_AVR] += vcc->qos.rxtp.min_pcr; - ppe_dev.dma.rx_weight[RX_DMA_CH_AVR] += vcc->qos.rxtp.min_pcr; - break; - case ATM_UBR_PLUS: - default: - ppe_dev.connection[conn].rx_dma_channel = RX_DMA_CH_UBR; - break; - } - - /* update RX queue configuration table */ - WRX_QUEUE_CONFIG(conn)->dmach = ppe_dev.connection[conn].rx_dma_channel; - - printk("ppe_open: QID %d, DMA %d\n", conn, WRX_QUEUE_CONFIG(conn)->dmach); - - printk("conn = %d, dmach = %d", conn, WRX_QUEUE_CONFIG(conn)->dmach); -#endif // defined(ENABLE_RX_QOS) && ENABLE_RX_QOS - - /* reserve bandwidth */ - switch ( vcc->qos.txtp.traffic_class ) - { - case ATM_CBR: - case ATM_VBR_RT: - port->tx_current_cell_rate += vcc->qos.txtp.max_pcr; - break; - case ATM_VBR_NRT: - port->tx_current_cell_rate += vcc->qos.txtp.pcr; - break; - case ATM_UBR_PLUS: - port->tx_current_cell_rate += vcc->qos.txtp.min_pcr; - break; - } - - /* set qsb */ - set_qsb(vcc, &vcc->qos, conn); - - /* update atm_vcc structure */ - vcc->itf = (int)vcc->dev->dev_data; - - set_bit(ATM_VF_READY, &vcc->flags); - - /* enable irq */ - printk("ppe_open: enable_irq\n"); - if ( f_enable_irq ) - enable_irq(IFXMIPS_PPE_MBOX_INT); - - /* enable mailbox */ - *MBOX_IGU1_ISRC = (1 << conn) | (1 << (conn + 16)); - *MBOX_IGU1_IER |= (1 << conn) | (1 << (conn + 16)); - *MBOX_IGU3_ISRC = (1 << conn) | (1 << (conn + 16)); - *MBOX_IGU3_IER |= (1 << conn) | (1 << (conn + 16)); - - /* set htu entry */ - set_htu_entry(vcc->vpi, vcc->vci, conn, vcc->qos.aal == ATM_AAL5 ? 1 : 0); - - ret = 0; - - printk("ppe_open(%d.%d): conn = %d, ppe_dev.dma = %08X\n", vcc->vpi, vcc->vci, conn, (u32)&ppe_dev.dma.rx_descriptor_number); - - -PPE_OPEN_EXIT: - up(&ppe_dev.sem); - - printk("open ATM itf = %d, vpi = %d, vci = %d, ret = %d", (int)vcc->dev->dev_data, (int)vcc->vpi, vcc->vci, ret); - return ret; -} - -void ppe_close(struct atm_vcc *vcc) -{ - int conn; - struct port *port; - struct connection *connection; - int i; - - if ( vcc == NULL ) - return; - - down(&ppe_dev.sem); - - /* get connection id */ - conn = find_vcc(vcc); - if ( conn < 0 ) - { - printk("can't find vcc\n"); - goto PPE_CLOSE_EXIT; - } - if(!((Atm_Priv *)vcc)->on) - goto PPE_CLOSE_EXIT; - connection = &ppe_dev.connection[conn]; - port = &ppe_dev.port[connection->port]; - - /* clear htu */ - clear_htu_entry(conn); - - /* release connection */ - port->connection_table &= ~(1 << (conn - port->connection_base)); - connection->vcc = NULL; - connection->access_time.tv_sec = 0; - connection->access_time.tv_nsec = 0; - connection->aal5_vcc_crc_err = 0; - connection->aal5_vcc_oversize_sdu = 0; - - /* disable irq */ - for ( i = 0; i < ATM_PORT_NUMBER; i++ ) - if ( ppe_dev.port[i].max_connections != 0 && ppe_dev.port[i].connection_table != 0 ) - break; - if ( i == ATM_PORT_NUMBER ) - disable_irq(IFXMIPS_PPE_MBOX_INT); - - *MBOX_IGU1_ISRC = (1 << conn) | (1 << (conn + 16)); - -#if defined(ENABLE_RX_QOS) && ENABLE_RX_QOS - /* remove weight value from RX DMA channel */ - switch ( vcc->qos.rxtp.traffic_class ) - { - case ATM_VBR_RT: - ppe_dev.dma.rx_default_weight[RX_DMA_CH_VBR_RT] -= vcc->qos.rxtp.max_pcr; - if ( ppe_dev.dma.rx_weight[RX_DMA_CH_VBR_RT] > ppe_dev.dma.rx_default_weight[RX_DMA_CH_VBR_RT] ) - ppe_dev.dma.rx_weight[RX_DMA_CH_VBR_RT] = ppe_dev.dma.rx_default_weight[RX_DMA_CH_VBR_RT]; - break; - case ATM_VBR_NRT: - ppe_dev.dma.rx_default_weight[RX_DMA_CH_VBR_NRT] -= vcc->qos.rxtp.pcr; - if ( ppe_dev.dma.rx_weight[RX_DMA_CH_VBR_NRT] > ppe_dev.dma.rx_default_weight[RX_DMA_CH_VBR_NRT] ) - ppe_dev.dma.rx_weight[RX_DMA_CH_VBR_NRT] = ppe_dev.dma.rx_default_weight[RX_DMA_CH_VBR_NRT]; - break; - case ATM_ABR: - ppe_dev.dma.rx_default_weight[RX_DMA_CH_AVR] -= vcc->qos.rxtp.min_pcr; - if ( ppe_dev.dma.rx_weight[RX_DMA_CH_AVR] > ppe_dev.dma.rx_default_weight[RX_DMA_CH_AVR] ) - ppe_dev.dma.rx_weight[RX_DMA_CH_AVR] = ppe_dev.dma.rx_default_weight[RX_DMA_CH_AVR]; - break; - case ATM_CBR: - case ATM_UBR_PLUS: - default: - break; - } -#endif // defined(ENABLE_RX_QOS) && ENABLE_RX_QOS - - /* release bandwidth */ - switch ( vcc->qos.txtp.traffic_class ) - { - case ATM_CBR: - case ATM_VBR_RT: - port->tx_current_cell_rate -= vcc->qos.txtp.max_pcr; - break; - case ATM_VBR_NRT: - port->tx_current_cell_rate -= vcc->qos.txtp.pcr; - break; - case ATM_UBR_PLUS: - port->tx_current_cell_rate -= vcc->qos.txtp.min_pcr; - break; - } - - /* idle for a while to let parallel operation finish */ - for ( i = 0; i < IDLE_CYCLE_NUMBER; i++ ); - ((Atm_Priv *)vcc)->on = 0; - -PPE_CLOSE_EXIT: - up(&ppe_dev.sem); -} - -int ppe_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg) -{ - return -ENOTTY; -} - -int ppe_send(struct atm_vcc *vcc, struct sk_buff *skb) -{ - int ret; - int conn; - int desc_base; - register struct tx_descriptor reg_desc; - struct tx_descriptor *desc; - - -printk("ppe_send"); -printk("ppe_send\n"); -printk("skb->users = %d\n", skb->users.counter); - - if ( vcc == NULL || skb == NULL ) - return -EINVAL; - -// down(&ppe_dev.sem); - - ATM_SKB(skb)->vcc = vcc; - conn = find_vcc(vcc); -// if ( conn != 1 ) -printk("ppe_send: conn = %d\n", conn); - if ( conn < 0 ) - { - ret = -EINVAL; - goto FIND_VCC_FAIL; - } - -printk("find_vcc"); - - if ( vcc->qos.aal == ATM_AAL5 ) - { - int byteoff; - int datalen; - struct tx_inband_header *header; - - /* allocate descriptor */ - desc_base = alloc_tx_connection(conn); - if ( desc_base < 0 ) - { - ret = -EIO; - //goto ALLOC_TX_CONNECTION_FAIL; - } - desc = &ppe_dev.dma.tx_descriptor_base[desc_base]; - - /* load descriptor from memory */ - reg_desc = *desc; - - datalen = skb->len; - byteoff = (u32)skb->data & (DMA_ALIGNMENT - 1); - if ( skb_headroom(skb) < byteoff + TX_INBAND_HEADER_LENGTH ) - { - struct sk_buff *new_skb; - -printk("skb_headroom(skb) < byteoff + TX_INBAND_HEADER_LENGTH"); -printk("skb_headroom(skb 0x%08X, skb->data 0x%08X) (%d) < byteoff (%d) + TX_INBAND_HEADER_LENGTH (%d)\n", (u32)skb, (u32)skb->data, skb_headroom(skb), byteoff, TX_INBAND_HEADER_LENGTH); - - new_skb = alloc_skb_tx(datalen); - if ( new_skb == NULL ) - { - printk("alloc_skb_tx: fail\n"); - ret = -ENOMEM; - goto ALLOC_SKB_TX_FAIL; - } - ATM_SKB(new_skb)->vcc = NULL; - skb_put(new_skb, datalen); - memcpy(new_skb->data, skb->data, datalen); - atm_free_tx_skb_vcc(skb); - skb = new_skb; - byteoff = (u32)skb->data & (DMA_ALIGNMENT - 1); - } - else - { -printk("skb_headroom(skb) >= byteoff + TX_INBAND_HEADER_LENGTH"); - } -printk("before skb_push, skb->data = 0x%08X", (u32)skb->data); - skb_push(skb, byteoff + TX_INBAND_HEADER_LENGTH); -printk("after skb_push, skb->data = 0x%08X", (u32)skb->data); - - header = (struct tx_inband_header *)(u32)skb->data; -printk("header = 0x%08X", (u32)header); - - /* setup inband trailer */ - header->uu = 0; - header->cpi = 0; - header->pad = ppe_dev.aal5.padding_byte; - header->res1 = 0; - - /* setup cell header */ - header->clp = (vcc->atm_options & ATM_ATMOPT_CLP) ? 1 : 0; - header->pti = ATM_PTI_US0; - header->vci = vcc->vci; - header->vpi = vcc->vpi; - header->gfc = 0; - - /* setup descriptor */ - reg_desc.dataptr = (u32)skb->data >> 2; - reg_desc.datalen = datalen; - reg_desc.byteoff = byteoff; - reg_desc.iscell = 0; - -printk("setup header, datalen = %d, byteoff = %d", reg_desc.datalen, reg_desc.byteoff); - - UPDATE_VCC_STAT(conn, tx_pdu, 1); - - if ( vcc->stats ) - atomic_inc(&vcc->stats->tx); - } - else - { - /* allocate descriptor */ - desc_base = alloc_tx_connection(conn); - if ( desc_base < 0 ) - { - ret = -EIO; - goto ALLOC_TX_CONNECTION_FAIL; - } - desc = &ppe_dev.dma.tx_descriptor_base[desc_base]; - - /* load descriptor from memory */ - reg_desc = *desc; - - /* if data pointer is not aligned, allocate new sk_buff */ - if ( ((u32)skb->data & (DMA_ALIGNMENT - 1)) ) - { - struct sk_buff *new_skb; - - printk("skb->data not aligned\n"); - - new_skb = alloc_skb_tx(skb->len); - if ( new_skb == NULL ) - { - ret = -ENOMEM; - goto ALLOC_SKB_TX_FAIL; - } - ATM_SKB(new_skb)->vcc = NULL; - skb_put(new_skb, skb->len); - memcpy(new_skb->data, skb->data, skb->len); - atm_free_tx_skb_vcc(skb); - skb = new_skb; - } - - reg_desc.dataptr = (u32)skb->data >> 2; - reg_desc.datalen = skb->len; - reg_desc.byteoff = 0; - reg_desc.iscell = 1; - - if ( vcc->stats ) - atomic_inc(&vcc->stats->tx); - } - - reg_desc.own = 1; - reg_desc.c = 1; - -printk("update descriptor send pointer, desc = 0x%08X", (u32)desc); - - ppe_dev.dma.tx_skb_pointers[desc_base] = skb; - *desc = reg_desc; - dma_cache_wback((unsigned long)skb->data, skb->len); - - mailbox_signal(conn, 1); - -printk("ppe_send: success"); -// up(&ppe_dev.sem); - - return 0; - -FIND_VCC_FAIL: - printk("FIND_VCC_FAIL\n"); - -// up(&ppe_dev.sem); - ppe_dev.mib.wtx_err_pdu++; - atm_free_tx_skb_vcc(skb); - - return ret; - -ALLOC_SKB_TX_FAIL: - printk("ALLOC_SKB_TX_FAIL\n"); - -// up(&ppe_dev.sem); - if ( vcc->qos.aal == ATM_AAL5 ) - { - UPDATE_VCC_STAT(conn, tx_err_pdu, 1); - ppe_dev.mib.wtx_err_pdu++; - } - if ( vcc->stats ) - atomic_inc(&vcc->stats->tx_err); - atm_free_tx_skb_vcc(skb); - - return ret; - -ALLOC_TX_CONNECTION_FAIL: - printk("ALLOC_TX_CONNECTION_FAIL\n"); - -// up(&ppe_dev.sem); - if ( vcc->qos.aal == ATM_AAL5 ) - { - UPDATE_VCC_STAT(conn, tx_sw_drop_pdu, 1); - ppe_dev.mib.wtx_drop_pdu++; - } - if ( vcc->stats ) - atomic_inc(&vcc->stats->tx_err); - atm_free_tx_skb_vcc(skb); - - return ret; -} - -int ppe_send_oam(struct atm_vcc *vcc, void *cell, int flags) -{ - int conn; - struct uni_cell_header *uni_cell_header = (struct uni_cell_header *)cell; - int desc_base; - struct sk_buff *skb; - register struct tx_descriptor reg_desc; - struct tx_descriptor *desc; - -printk("ppe_send_oam"); - - if ( ((uni_cell_header->pti == ATM_PTI_SEGF5 || uni_cell_header->pti == ATM_PTI_E2EF5) - && find_vpivci(uni_cell_header->vpi, uni_cell_header->vci) < 0) - || ((uni_cell_header->vci == 0x03 || uni_cell_header->vci == 0x04) - && find_vpi(uni_cell_header->vpi) < 0) ) - return -EINVAL; - -#if OAM_TX_QUEUE_NUMBER_PER_PORT != 0 - /* get queue ID of OAM TX queue, and the TX DMA channel ID is the same as queue ID */ - conn = ppe_dev.port[(int)vcc->dev->dev_data].oam_tx_queue; -#else - /* find queue ID */ - conn = find_vcc(vcc); - if ( conn < 0 ) - { - printk("OAM not find queue\n"); -// up(&ppe_dev.sem); - return -EINVAL; - } -#endif // OAM_TX_QUEUE_NUMBER_PER_PORT != 0 - - /* allocate descriptor */ - desc_base = alloc_tx_connection(conn); - if ( desc_base < 0 ) - { - printk("OAM not alloc tx connection\n"); -// up(&ppe_dev.sem); - return -EIO; - } - - desc = &ppe_dev.dma.tx_descriptor_base[desc_base]; - - /* load descriptor from memory */ - reg_desc = *(struct tx_descriptor *)desc; - - /* allocate sk_buff */ - skb = alloc_skb_tx(CELL_SIZE); - if ( skb == NULL ) - { -// up(&ppe_dev.sem); - return -ENOMEM; - } -#if OAM_TX_QUEUE_NUMBER_PER_PORT != 0 - ATM_SKB(skb)->vcc = NULL; -#else - ATM_SKB(skb)->vcc = vcc; -#endif // OAM_TX_QUEUE_NUMBER_PER_PORT != 0 - - /* copy data */ - skb_put(skb, CELL_SIZE); - memcpy(skb->data, cell, CELL_SIZE); - - /* setup descriptor */ - reg_desc.dataptr = (u32)skb->data >> 2; - reg_desc.datalen = CELL_SIZE; - reg_desc.byteoff = 0; - reg_desc.iscell = 1; - reg_desc.own = 1; - reg_desc.c = 1; - - /* update descriptor send pointer */ - ppe_dev.dma.tx_skb_pointers[desc_base] = skb; - - /* write discriptor to memory and write back cache */ - *(struct tx_descriptor *)desc = reg_desc; - dma_cache_wback((unsigned long)skb->data, skb->len); - - /* signal PPE */ - mailbox_signal(conn, 1); - - return 0; -} - -int ppe_change_qos(struct atm_vcc *vcc, struct atm_qos *qos, int flags) -{ - int conn; - printk("%s:%s[%d]\n", __FILE__, __func__, __LINE__); - - if(vcc == NULL || qos == NULL ) - return -EINVAL; - conn = find_vcc(vcc); - if ( conn < 0 ) - return -EINVAL; - set_qsb(vcc, qos, conn); - - return 0; -} - -static inline void init_chip(void) -{ - /* enable PPE module in PMU */ - *(unsigned long *)0xBF10201C &= ~((1 << 15) | (1 << 13) | (1 << 9)); - - *EMA_CMDCFG = (EMA_CMD_BUF_LEN << 16) | (EMA_CMD_BASE_ADDR >> 2); - *EMA_DATACFG = (EMA_DATA_BUF_LEN << 16) | (EMA_DATA_BASE_ADDR >> 2); - *EMA_IER = 0x000000FF; - *EMA_CFG = EMA_READ_BURST | (EMA_WRITE_BURST << 2); - - /* enable mailbox */ - *MBOX_IGU1_ISRC = 0xFFFFFFFF; - *MBOX_IGU1_IER = 0x00000000; - *MBOX_IGU3_ISRC = 0xFFFFFFFF; - *MBOX_IGU3_IER = 0x00000000; -} - -int pp32_download_code(u32 *code_src, unsigned int code_dword_len, u32 *data_src, unsigned int data_dword_len) -{ - u32 reg_old_value; - volatile u32 *dest; - - if ( code_src == 0 || ((unsigned long)code_src & 0x03) != 0 - || data_src == 0 || ((unsigned long)data_src & 0x03) ) - return -EINVAL; - - /* save the old value of CDM_CFG and set PPE code memory to FPI bus access mode */ - reg_old_value = *CDM_CFG; - if ( code_dword_len <= 4096 ) - *CDM_CFG = CDM_CFG_RAM1_SET(0x00) | CDM_CFG_RAM0_SET(0x00); - else - *CDM_CFG = CDM_CFG_RAM1_SET(0x01) | CDM_CFG_RAM0_SET(0x00); - - /* copy code */ - dest = CDM_CODE_MEMORY_RAM0_ADDR(0); - while ( code_dword_len-- > 0 ) - *dest++ = *code_src++; - - /* copy data */ - dest = PP32_DATA_MEMORY_RAM1_ADDR(0); - while ( data_dword_len-- > 0 ) - *dest++ = *data_src++; - - return 0; -} - -int pp32_start(void) -{ - int ret; - register int i; - init_chip(); - /* download firmware */ - ret = pp32_download_code(firmware_binary_code, sizeof(firmware_binary_code) / sizeof(*firmware_binary_code), firmware_binary_data, sizeof(firmware_binary_data) / sizeof(*firmware_binary_data)); - if ( ret ) - return ret; - - /* run PP32 */ - *PP32_DBG_CTRL = DBG_CTRL_START_SET(1); - - /* idle for a while to let PP32 init itself */ - for ( i = 0; i < IDLE_CYCLE_NUMBER; i++ ); - - return 0; -} - -void pp32_stop(void) -{ - /* halt PP32 */ - *PP32_DBG_CTRL = DBG_CTRL_STOP_SET(1); -} diff --git a/package/ifxmips-atm/src/proc.c b/package/ifxmips-atm/src/proc.c deleted file mode 100644 index 47b882052..000000000 --- a/package/ifxmips-atm/src/proc.c +++ /dev/null @@ -1,98 +0,0 @@ -#include -#include - -#include "proc.h" -#include "common.h" - -struct proc_dir_entry *ppe_proc_dir; - -int proc_read_idle_counter(char *page, char **start, off_t off, int count, int *eof, void *data) -{ - int len = 0; - - len += sprintf(page + off, "Channel 0\n"); - len += sprintf(page + off + len, " TX\n"); - len += sprintf(page + off + len, - " DREG_AT_CELL0 = %d\n", *DREG_AT_CELL0 & 0xFFFF); - len += sprintf(page + off + len, - " DREG_AT_IDLE_CNT0 = %d\n", *DREG_AT_IDLE_CNT0 & 0xFFFF); - len += sprintf(page + off + len, " RX\n"); - len += sprintf(page + off + len, - " DREG_AR_CELL0 = %d\n", *DREG_AR_CELL0 & 0xFFFF); - len += sprintf(page + off + len, - " DREG_AR_IDLE_CNT0 = %d\n", *DREG_AR_IDLE_CNT0 & 0xFFFF); - len += sprintf(page + off + len, - " DREG_AR_AIIDLE_CNT0 = %d\n", *DREG_AR_AIIDLE_CNT0 & 0xFFFF); - len += sprintf(page + off + len, - " DREG_AR_BE_CNT0 = %d\n", *DREG_AR_BE_CNT0 & 0xFFFF); - len += sprintf(page + off + len, "Channel 1\n"); - len += sprintf(page + off + len, " TX\n"); - len += sprintf(page + off + len, - " DREG_AT_CELL1 = %d\n", *DREG_AT_CELL1 & 0xFFFF); - len += sprintf(page + off + len, - " DREG_AT_IDLE_CNT1 = %d\n", *DREG_AT_IDLE_CNT1 & 0xFFFF); - len += sprintf(page + off + len, " RX\n"); - len += sprintf(page + off + len, - " DREG_AR_CELL1 = %d\n", *DREG_AR_CELL1 & 0xFFFF); - len += sprintf(page + off + len, - " DREG_AR_IDLE_CNT1 = %d\n", *DREG_AR_IDLE_CNT1 & 0xFFFF); - len += sprintf(page + off + len, - " DREG_AR_AIIDLE_CNT1 = %d\n", *DREG_AR_AIIDLE_CNT1 & 0xFFFF); - len += sprintf(page + off + len, - " DREG_AR_BE_CNT1 = %d\n", *DREG_AR_BE_CNT1 & 0xFFFF); - - return len; -} - -int proc_read_stats(char *page, char **start, off_t off, int count, int *eof, void *data) -{ - int len = 0; - - int i, j; - struct connection *connection; - struct port *port; - int base; - - len += sprintf(page + off, "ATM Stats:\n"); - - connection = ppe_dev.connection; - port = ppe_dev.port; - for ( i = 0; i < ATM_PORT_NUMBER; i++, port++ ) - { - base = port->connection_base; - for ( j = 0; j < port->max_connections; j++, base++ ) - if ( (port->connection_table & (1 << j)) - && connection[base].vcc != NULL ) - { - if ( connection[base].vcc->stats ) - { - struct k_atm_aal_stats *stats = connection[base].vcc->stats; - - len += sprintf(page + off + len, " VCC %d.%d.%d (stats)\n", i, connection[base].vcc->vpi, connection[base].vcc->vci); - len += sprintf(page + off + len, " rx = %d\n", stats->rx.counter); - len += sprintf(page + off + len, " rx_err = %d\n", stats->rx_err.counter); - len += sprintf(page + off + len, " rx_drop = %d\n", stats->rx_drop.counter); - len += sprintf(page + off + len, " tx = %d\n", stats->tx.counter); - len += sprintf(page + off + len, " tx_err = %d\n", stats->tx_err.counter); - } - else - len += sprintf(page + off + len, " VCC %d.%d.%d\n", i, connection[base].vcc->vpi, connection[base].vcc->vci); - } - } - - return len; -} - -void proc_file_create(void) -{ - ppe_proc_dir = proc_mkdir("ppe", NULL); - create_proc_read_entry("idle_counter", 0, ppe_proc_dir, proc_read_idle_counter, NULL); - create_proc_read_entry("stats", 0, ppe_proc_dir, proc_read_stats, NULL); -} - -void proc_file_delete(void) -{ - remove_proc_entry("idle_counter", ppe_proc_dir); - remove_proc_entry("stats", ppe_proc_dir); - remove_proc_entry("ppe", NULL); -} diff --git a/package/ifxmips-atm/src/proc.h b/package/ifxmips-atm/src/proc.h deleted file mode 100644 index c632c0ce1..000000000 --- a/package/ifxmips-atm/src/proc.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _IFXMIPS_PPE_PROC_H__ -#define _IFXMIPS_PPE_PROC_H__ - -void proc_file_create(void); -void proc_file_delete(void); -int proc_read_idle_counter(char *page, char **start, off_t off, int count, int *eof, void *data); -int proc_read_stats(char *page, char **start, off_t off, int count, int *eof, void *data); - -#endif diff --git a/package/ifxmips-atm/src/skb.c b/package/ifxmips-atm/src/skb.c deleted file mode 100644 index 7ad60fd75..000000000 --- a/package/ifxmips-atm/src/skb.c +++ /dev/null @@ -1,128 +0,0 @@ -#include - -#include "common.h" - -void resize_skb_rx(struct sk_buff *skb, unsigned int size, int is_cell) -{ - if((u32)skb < 0x80000000) - { - int key = 0; - printk("resize_skb_rx problem: skb = %08X, size = %d, is_cell = %d\n", (u32)skb, size, is_cell); - while(!key){} - } - skb->data = (unsigned char*)(((u32)skb->head + 16 + (DMA_ALIGNMENT - 1)) & ~(DMA_ALIGNMENT - 1)); - skb->tail = skb->data; - - /* Set up other state */ - skb->len = 0; - skb->cloned = 0; -#if defined(CONFIG_IMQ) || defined (CONFIG_IMQ_MODULE) - skb->imq_flags = 0; - skb->nf_info = NULL; -#endif - skb->data_len = 0; -} - -struct sk_buff* alloc_skb_rx(void) -{ - struct sk_buff *skb; - - /* allocate memroy including trailer and padding */ - skb = dev_alloc_skb(ppe_dev.aal5.rx_buffer_size + DMA_ALIGNMENT); - if (skb) - { - /* must be burst length alignment */ - if ( ((u32)skb->data & (DMA_ALIGNMENT - 1)) != 0 ) - skb_reserve(skb, ~((u32)skb->data + (DMA_ALIGNMENT - 1)) & (DMA_ALIGNMENT - 1)); - /* put skb in reserved area "skb->data - 4" */ - *((u32*)skb->data - 1) = (u32)skb; - /* invalidate cache */ - dma_cache_inv((unsigned long)skb->head, (u32)skb->end - (u32)skb->head); - } - return skb; -} - -void atm_free_tx_skb_vcc(struct sk_buff *skb) -{ - struct atm_vcc* vcc; - - if ( (u32)skb <= 0x80000000 ) - { - volatile int key = 0; - printk("atm_free_tx_skb_vcc: skb = %08X\n", (u32)skb); - for ( ; !key; ); - } - - vcc = ATM_SKB(skb)->vcc; - if ( vcc != NULL && vcc->pop != NULL ) - { - if ( atomic_read(&skb->users) == 0 ) - { - volatile int key = 0; - printk("atm_free_tx_skb_vcc(vcc->pop): skb->users == 0, skb = %08X\n", (u32)skb); - for ( ; !key; ); - } - vcc->pop(vcc, skb); - } - else - { - if ( atomic_read(&skb->users) == 0 ) - { - volatile int key = 0; - printk("atm_free_tx_skb_vcc(dev_kfree_skb_any): skb->users == 0, skb = %08X\n", (u32)skb); - for ( ; !key; ); - } - dev_kfree_skb_any(skb); - } -} - -struct sk_buff* alloc_skb_tx(unsigned int size) -{ - struct sk_buff *skb; - - /* allocate memory including header and padding */ - size += TX_INBAND_HEADER_LENGTH + MAX_TX_PACKET_ALIGN_BYTES + MAX_TX_PACKET_PADDING_BYTES; - size &= ~(DMA_ALIGNMENT - 1); - skb = dev_alloc_skb(size + DMA_ALIGNMENT); - /* must be burst length alignment */ - if ( skb ) - skb_reserve(skb, (~((u32)skb->data + (DMA_ALIGNMENT - 1)) & (DMA_ALIGNMENT - 1)) + TX_INBAND_HEADER_LENGTH); - return skb; -} - -struct sk_buff* atm_alloc_tx(struct atm_vcc *vcc, unsigned int size) -{ - int conn; - struct sk_buff *skb; - - /* oversize packet */ - if ( ((size + TX_INBAND_HEADER_LENGTH + MAX_TX_PACKET_ALIGN_BYTES + MAX_TX_PACKET_PADDING_BYTES) & ~(DMA_ALIGNMENT - 1)) > ppe_dev.aal5.tx_max_packet_size ) - { - printk("atm_alloc_tx: oversize packet\n"); - return NULL; - } - /* send buffer overflow */ - if ( atomic_read(&vcc->sk.sk_wmem_alloc) && !atm_may_send(vcc, size) ) - { - printk("atm_alloc_tx: send buffer overflow\n"); - return NULL; - } - conn = find_vcc(vcc); - if ( conn < 0 ) - { - printk("atm_alloc_tx: unknown VCC\n"); - return NULL; - } - - skb = dev_alloc_skb(size); - if ( skb == NULL ) - { - printk("atm_alloc_tx: sk buffer is used up\n"); - return NULL; - } -#define ATM_PDU_OVHD 0 - atomic_add(skb->truesize + ATM_PDU_OVHD, &vcc->sk.sk_wmem_alloc); - - return skb; -} - diff --git a/package/ifxmips-dsl-api/Config.in b/package/ifxmips-dsl-api/Config.in new file mode 100644 index 000000000..a1c3cd4f0 --- /dev/null +++ b/package/ifxmips-dsl-api/Config.in @@ -0,0 +1,18 @@ +choice + prompt "Firmware" + depends on PACKAGE_kmod-ifxmips-dsl-api + default IFXMIPS_ANNEX_B + help + This option controls which firmware is loaded + +config IFXMIPS_ANNEX_A + bool "Annex-A" + help + Annex-A + +config IFXMIPS_ANNEX_B + bool "Annex-B" + help + Annex-B + +endchoice diff --git a/package/ifxmips-dsl-api/Makefile b/package/ifxmips-dsl-api/Makefile new file mode 100644 index 000000000..73d6f4f1a --- /dev/null +++ b/package/ifxmips-dsl-api/Makefile @@ -0,0 +1,140 @@ +# +# Copyright (C) 2009 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# ralph / blogic + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=ifxmips-dsl-api +PKG_BASE_NAME:=drv_dsl_cpe_api_danube +PKG_VERSION:=3.24.4.4 +PKG_SOURCE:=$(PKG_BASE_NAME)-$(PKG_VERSION).tar.gz +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/drv_dsl_cpe_api-$(PKG_VERSION) +PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources/ +PKG_MD5SUM:=c45bc531c1ed2ac80f68fb986b63bb87 + +FW_BASE_NAME:=dsl_danube_firmware_adsl +FW_A_VER:=02.04.04.00.00.01 +FW_B_VER:=02.04.01.07.00.02 +FW_A_FILE_VER:=244001 +FW_B_FILE_VER:=241702 +FW_A_MD5:=f717db3067a0049a26e233ab11238710 +FW_B_MD5:=349de7cd20368f4ac9b7e8322114a512 + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/ifxmips-dsl-api + SECTION:=driver + CATEGORY:=Infineon + TITLE:=DSL CPE API driver + URL:=http://www.infineon.com/ + MAINTAINER:=Infineon Technologies AG / Lantiq / blogic@openwrt.org + DEPENDS:=@TARGET_ifxmips + FILES:=$(PKG_BUILD_DIR)/src/mei/ifxmips_mei.$(LINUX_KMOD_SUFFIX) \ + $(PKG_BUILD_DIR)/src/drv_dsl_cpe_api.$(LINUX_KMOD_SUFFIX) \ + $(PKG_BUILD_DIR)/src/mei/ifxmips_atm.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoLoad,50,ifxmips_mei drv_dsl_cpe_api ifxmips_atm) +endef + +define KernelPackage/ifxmips-dsl-api/description + Infineon DSL CPE API for Amazon SE, Danube and Vinax. + + This package contains the DSL CPE API driver for Amazon SE & Danube. + + Supported Devices: + - Amazon SE + - Danube + + This package was kindly contributed to openwrt by Infineon/Lantiq +endef + +define KernelPackage/ifxmips-dsl-api/config + source "$(SOURCE)/Config.in" +endef + +define Download/annex-a + FILE:=$(FW_BASE_NAME)_a-$(FW_A_VER).tar.gz + URL:=http://mirror2.openwrt.org/sources/ + MD5SUM:=$(FW_A_MD5) +endef +$(eval $(call Download,annex-a)) + +define Download/annex-b + FILE:=$(FW_BASE_NAME)_b-$(FW_B_VER).tar.gz + URL:=http://mirror2.openwrt.org/sources/ + MD5SUM:=$(FW_B_MD5) +endef +$(eval $(call Download,annex-b)) + +IFX_DSL_MAX_DEVICE=1 +IFX_DSL_LINES_PER_DEVICE=1 +IFX_DSL_CHANNELS_PER_LINE=1 + +CONFIGURE_ARGS += --enable-kernel-include="$(LINUX_DIR)/include" \ + --with-max-device="$(IFX_DSL_MAX_DEVICE)" \ + --with-lines-per-device="$(IFX_DSL_LINES_PER_DEVICE)" \ + --with-channels-per-line="$(IFX_DSL_CHANNELS_PER_LINE)" \ + --enable-danube \ + --enable-add-drv-cflags="-DMODULE" \ + --enable-debug=yes \ + --enable-debug-prints=yes \ + --disable-dsl-delt-static \ + --disable-adsl-led \ + --enable-dsl-ceoc \ + --enable-dsl-pm \ + --enable-dsl-pm-total \ + --enable-dsl-pm-history \ + --enable-dsl-pm-showtime \ + --enable-dsl-pm-channel-counters \ + --enable-dsl-pm-datapath-counters \ + --enable-dsl-pm-line-counters \ + --enable-dsl-pm-channel-thresholds \ + --enable-dsl-pm-datapath-thresholds \ + --enable-dsl-pm-line-thresholds \ + --enable-dsl-pm-optional-parameters \ + --enable-linux-26 \ + --enable-kernelbuild="$(LINUX_DIR)" \ + ARCH=$(LINUX_KARCH) + +EXTRA_CFLAGS = -fno-pic -mno-abicalls -mlong-calls -G 0 + +define Build/Prepare + $(PKG_UNPACK) + $(INSTALL_DIR) $(PKG_BUILD_DIR)/src/mei/ + $(CP) ./src/* $(PKG_BUILD_DIR)/src/mei/ + $(Build/Patch) + $(TAR) -C $(PKG_BUILD_DIR) -xzf $(DL_DIR)/$(FW_BASE_NAME)_a-$(FW_A_VER).tar.gz + $(TAR) -C $(PKG_BUILD_DIR) -xzf $(DL_DIR)/$(FW_BASE_NAME)_b-$(FW_B_VER).tar.gz +endef + +define Build/Compile + cd $(LINUX_DIR); \ + ARCH=mips CROSS_COMPILE="$(KERNEL_CROSS)" \ + $(MAKE) M=$(PKG_BUILD_DIR)/src/mei/ V=1 modules + $(call Build/Compile/Default) +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api.h $(1)/usr/include + $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api_ioctl.h $(1)/usr/include + $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api_adslmib.h $(1)/usr/include + $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api_adslmib_ioctl.h $(1)/usr/include + $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api_g997.h $(1)/usr/include + $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api_types.h $(1)/usr/include + $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api_pm.h $(1)/usr/include + $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api_error.h $(1)/usr/include + $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_danube_ctx.h $(1)/usr/include + $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_cmv_danube.h $(1)/usr/include +endef + +define KernelPackage/ifxmips-dsl-api/install + $(INSTALL_DIR) $(1)/lib/firmware/ + $(CP) $(PKG_BUILD_DIR)/$(FW_BASE_NAME)_$(if $(CONFIG_IFXMIPS_ANNEX_A),a_$(FW_A_FILE_VER),b_$(FW_B_FILE_VER)).bin $(1)/lib/firmware/ModemHWE.bin +endef + +$(eval $(call KernelPackage,ifxmips-dsl-api)) diff --git a/package/ifxmips-dsl-api/patches/100-dsl_compat.patch b/package/ifxmips-dsl-api/patches/100-dsl_compat.patch new file mode 100644 index 000000000..a3b9930c2 --- /dev/null +++ b/package/ifxmips-dsl-api/patches/100-dsl_compat.patch @@ -0,0 +1,43 @@ +Index: drv_dsl_cpe_api-3.24.4.4/src/include/drv_dsl_cpe_device_danube.h +=================================================================== +--- drv_dsl_cpe_api-3.24.4.4.orig/src/include/drv_dsl_cpe_device_danube.h 2009-05-12 20:02:16.000000000 +0200 ++++ drv_dsl_cpe_api-3.24.4.4/src/include/drv_dsl_cpe_device_danube.h 2009-11-01 00:57:23.000000000 +0100 +@@ -24,7 +24,7 @@ + #include "drv_dsl_cpe_simulator_danube.h" + #else + /* Include for the low level driver interface header file */ +-#include "asm/ifx/ifx_mei_bsp.h" ++#include "mei/ifxmips_mei_interface.h" + #endif /* defined(DSL_CPE_SIMULATOR_DRIVER) && defined(WIN32)*/ + + #define DSL_MAX_LINE_NUMBER 1 +Index: drv_dsl_cpe_api-3.24.4.4/src/common/drv_dsl_cpe_os_linux.c +=================================================================== +--- drv_dsl_cpe_api-3.24.4.4.orig/src/common/drv_dsl_cpe_os_linux.c 2009-11-01 01:00:08.000000000 +0100 ++++ drv_dsl_cpe_api-3.24.4.4/src/common/drv_dsl_cpe_os_linux.c 2009-11-01 01:03:51.000000000 +0100 +@@ -11,6 +11,7 @@ + #ifdef __LINUX__ + + #define DSL_INTERN ++#include + + #include "drv_dsl_cpe_api.h" + #include "drv_dsl_cpe_api_ioctl.h" +@@ -1058,6 +1059,7 @@ + /* Entry point of driver */ + int __init DSL_ModuleInit(void) + { ++ struct class *dsl_class; + DSL_int_t i; + + printk(DSL_DRV_CRLF DSL_DRV_CRLF "Infineon CPE API Driver version: %s" DSL_DRV_CRLF, +@@ -1104,7 +1106,8 @@ + } + + DSL_DRV_DevNodeInit(); +- ++ dsl_class = class_create(THIS_MODULE, "dsl_cpe_api"); ++ device_create(dsl_class, NULL, MKDEV(DRV_DSL_CPE_API_DEV_MAJOR, 0), NULL, "dsl_cpe_api"); + return 0; + } + diff --git a/package/ifxmips-dsl-api/patches/200-mei_compat.patch b/package/ifxmips-dsl-api/patches/200-mei_compat.patch new file mode 100644 index 000000000..ae2d59350 --- /dev/null +++ b/package/ifxmips-dsl-api/patches/200-mei_compat.patch @@ -0,0 +1,95 @@ +Index: drv_dsl_cpe_api-3.24.4.4/src/mei/ifxmips_mei.c +=================================================================== +--- drv_dsl_cpe_api-3.24.4.4.orig/src/mei/ifxmips_mei.c 2009-10-31 23:30:20.000000000 +0100 ++++ drv_dsl_cpe_api-3.24.4.4/src/mei/ifxmips_mei.c 2009-11-01 04:41:58.000000000 +0100 +@@ -41,18 +41,19 @@ + #include + #include + #include ++#include + #include + #include +-#include +-#include +-#include +-//#include +-#include +-#include ++ ++#include ++#include ++#include ++#include ++#include "ifxmips_atm.h" + #define IFX_MEI_BSP + #include "ifxmips_mei_interface.h" + +-#define IFXMIPS_RCU_RST IFX_RCU_RST_REQ ++/*#define IFXMIPS_RCU_RST IFX_RCU_RST_REQ + #define IFXMIPS_RCU_RST_REQ_ARC_JTAG IFX_RCU_RST_REQ_ARC_JTAG + #define IFXMIPS_RCU_RST_REQ_DFE IFX_RCU_RST_REQ_DFE + #define IFXMIPS_RCU_RST_REQ_AFE IFX_RCU_RST_REQ_AFE +@@ -76,7 +77,7 @@ + #define ifxmips_r32(reg) __raw_readl(reg) + #define ifxmips_w32(val, reg) __raw_writel(val, reg) + #define ifxmips_w32_mask(clear, set, reg) ifxmips_w32((ifxmips_r32(reg) & ~clear) | set, reg) +- ++*/ + #define IFX_MEI_EMSG(fmt, args...) printk(KERN_ERR "[%s %d]: " fmt,__FUNCTION__, __LINE__, ## args) + #define IFX_MEI_DMSG(fmt, args...) printk(KERN_INFO "[%s %d]: " fmt,__FUNCTION__, __LINE__, ## args) + +@@ -173,7 +174,8 @@ + extern void ifxmips_mask_and_ack_irq(unsigned int irq_nr); + #define MEI_MASK_AND_ACK_IRQ ifxmips_mask_and_ack_irq + +-static int dev_major = 105; ++#define MEI_MAJOR 105 ++static int dev_major = MEI_MAJOR; + + static struct file_operations bsp_mei_operations = { + owner:THIS_MODULE, +@@ -2294,10 +2296,10 @@ + IFX_MEI_EMSG ("request_irq %d failed!\n", pDev->nIrq[IFX_DFEIR]); + return -1; + } +- if (request_irq (pDev->nIrq[IFX_DYING_GASP], IFX_MEI_Dying_Gasp_IrqHandle, 0, "DYING_GASP", pDev) != 0) { ++ /*if (request_irq (pDev->nIrq[IFX_DYING_GASP], IFX_MEI_Dying_Gasp_IrqHandle, 0, "DYING_GASP", pDev) != 0) { + IFX_MEI_EMSG ("request_irq %d failed!\n", pDev->nIrq[IFX_DYING_GASP]); + return -1; +- } ++ }*/ + // IFX_MEI_DMSG("Device %d initialized. IER %#x\n", num, bsp_get_irq_ier(pDev->nIrq[IFX_DYING_GASP])); + return 0; + } +@@ -2922,6 +2924,7 @@ + IFX_MEI_ModuleInit (void) + { + int i = 0; ++ static struct class *dsl_class; + + printk ("IFX MEI Version %ld.%02ld.%02ld", bsp_mei_version.major, bsp_mei_version.minor, bsp_mei_version.revision); + +@@ -2935,14 +2938,15 @@ + IFX_MEI_InitProcFS (i); + #endif + } +- for (i = 0; i <= DSL_BSP_CB_LAST ; i++) ++ for (i = 0; i <= DSL_BSP_CB_LAST ; i++) + dsl_bsp_event_callback[i].function = NULL; + + #ifdef CONFIG_IFXMIPS_MEI_FW_LOOPBACK + printk(KERN_INFO "[%s %s %d]: Start loopback test...\n", __FILE__, __func__, __LINE__); + DFE_Loopback_Test (); + #endif +- ++ dsl_class = class_create(THIS_MODULE, "ifx_mei"); ++ device_create(dsl_class, NULL, MKDEV(MEI_MAJOR, 0), NULL, "ifx_mei"); + return 0; + } + +@@ -2996,3 +3000,5 @@ + + module_init (IFX_MEI_ModuleInit); + module_exit (IFX_MEI_ModuleExit); ++ ++MODULE_LICENSE("Dual BSD/GPL"); diff --git a/package/ifxmips-dsl-api/patches/300-atm_compat.patch b/package/ifxmips-dsl-api/patches/300-atm_compat.patch new file mode 100644 index 000000000..35c7b13f8 --- /dev/null +++ b/package/ifxmips-dsl-api/patches/300-atm_compat.patch @@ -0,0 +1,168 @@ +Index: drv_dsl_cpe_api-3.24.4.4/src/mei/ifxmips_atm_core.c +=================================================================== +--- drv_dsl_cpe_api-3.24.4.4.orig/src/mei/ifxmips_atm_core.c 2009-11-01 14:29:05.000000000 +0100 ++++ drv_dsl_cpe_api-3.24.4.4/src/mei/ifxmips_atm_core.c 2009-11-01 16:07:46.000000000 +0100 +@@ -58,9 +58,8 @@ + /* + * Chip Specific Head File + */ +-#include +-#include +-#include ++#include ++#include + #include "ifxmips_atm_core.h" + + +@@ -1146,7 +1145,7 @@ + + static void set_qsb(struct atm_vcc *vcc, struct atm_qos *qos, unsigned int queue) + { +- unsigned int qsb_clk = ifx_get_fpi_hz(); ++ unsigned int qsb_clk = ifxmips_get_fpi_hz(); + unsigned int qsb_qid = queue + FIRST_QSB_QID; + union qsb_queue_parameter_table qsb_queue_parameter_table = {{0}}; + union qsb_queue_vbr_parameter_table qsb_queue_vbr_parameter_table = {{0}}; +@@ -1318,7 +1317,7 @@ + + static void qsb_global_set(void) + { +- unsigned int qsb_clk = ifx_get_fpi_hz(); ++ unsigned int qsb_clk = ifxmips_get_fpi_hz(); + int i; + unsigned int tmp1, tmp2, tmp3; + +@@ -2505,3 +2504,4 @@ + + module_init(ifx_atm_init); + module_exit(ifx_atm_exit); ++MODULE_LICENSE("Dual BSD/GPL"); +Index: drv_dsl_cpe_api-3.24.4.4/src/mei/ifxmips_atm_ppe_common.h +=================================================================== +--- drv_dsl_cpe_api-3.24.4.4.orig/src/mei/ifxmips_atm_ppe_common.h 2009-11-01 14:30:55.000000000 +0100 ++++ drv_dsl_cpe_api-3.24.4.4/src/mei/ifxmips_atm_ppe_common.h 2009-11-01 15:58:50.000000000 +0100 +@@ -1,9 +1,10 @@ + #ifndef IFXMIPS_ATM_PPE_COMMON_H + #define IFXMIPS_ATM_PPE_COMMON_H + +- +- +-#if defined(CONFIG_DANUBE) ++#if defined(CONFIG_IFXMIPS) ++ #include "ifxmips_atm_ppe_danube.h" ++ #define CONFIG_DANUBE ++#elif defined(CONFIG_DANUBE) + #include "ifxmips_atm_ppe_danube.h" + #elif defined(CONFIG_AMAZON_SE) + #include "ifxmips_atm_ppe_amazon_se.h" +@@ -16,7 +17,6 @@ + #endif + + +- + /* + * Code/Data Memory (CDM) Interface Configuration Register + */ +Index: drv_dsl_cpe_api-3.24.4.4/src/mei/ifxmips_atm_core.h +=================================================================== +--- drv_dsl_cpe_api-3.24.4.4.orig/src/mei/ifxmips_atm_core.h 2009-11-01 14:30:55.000000000 +0100 ++++ drv_dsl_cpe_api-3.24.4.4/src/mei/ifxmips_atm_core.h 2009-11-01 15:58:50.000000000 +0100 +@@ -25,8 +25,8 @@ + #define IFXMIPS_ATM_CORE_H + + +- +-#include ++#include "ifxmips_compat.h" ++#include "ifx_atm.h" + #include "ifxmips_atm_ppe_common.h" + #include "ifxmips_atm_fw_regs_common.h" + +Index: drv_dsl_cpe_api-3.24.4.4/src/mei/ifxmips_compat.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ drv_dsl_cpe_api-3.24.4.4/src/mei/ifxmips_compat.h 2009-11-01 15:58:50.000000000 +0100 +@@ -0,0 +1,43 @@ ++#ifndef _IFXMIPS_COMPAT_H__ ++#define _IFXMIPS_COMPAT_H__ ++ ++#define IFX_SUCCESS 0 ++#define IFX_ERROR (-1) ++ ++#define ATM_VBR_NRT ATM_VBR ++#define ATM_VBR_RT 6 ++#define ATM_UBR_PLUS 7 ++#define ATM_GFR 8 ++ ++#define NUM_ENTITY(x) (sizeof(x) / sizeof(*(x))) ++ ++#define SET_BITS(x, msb, lsb, value) \ ++ (((x) & ~(((1 << ((msb) + 1)) - 1) ^ ((1 << (lsb)) - 1))) | (((value) & ((1 << (1 + (msb) - (lsb))) - 1)) << (lsb))) ++ ++ ++#define IFX_PMU_ENABLE 1 ++#define IFX_PMU_DISABLE 0 ++ ++#define IFX_PMU_MODULE_DSL_DFE (1 << 9) ++#define IFX_PMU_MODULE_AHBS (1 << 13) ++#define IFX_PMU_MODULE_PPE_QSB (1 << 18) ++#define IFX_PMU_MODULE_PPE_SLL01 (1 << 19) ++#define IFX_PMU_MODULE_PPE_TC (1 << 21) ++#define IFX_PMU_MODULE_PPE_EMA (1 << 22) ++#define IFX_PMU_MODULE_PPE_TOP (1 << 29) ++ ++#define ifx_pmu_set(a,b) {if(a == IFX_PMU_ENABLE) ifxmips_pmu_enable(b); else ifxmips_pmu_disable(b);} ++ ++#define PPE_TOP_PMU_SETUP(__x) ifx_pmu_set(IFX_PMU_MODULE_PPE_TOP, (__x)) ++#define PPE_SLL01_PMU_SETUP(__x) ifx_pmu_set(IFX_PMU_MODULE_PPE_SLL01, (__x)) ++#define PPE_TC_PMU_SETUP(__x) ifx_pmu_set(IFX_PMU_MODULE_PPE_TC, (__x)) ++#define PPE_EMA_PMU_SETUP(__x) ifx_pmu_set(IFX_PMU_MODULE_PPE_EMA, (__x)) ++#define PPE_QSB_PMU_SETUP(__x) ifx_pmu_set(IFX_PMU_MODULE_PPE_QSB, (__x)) ++#define PPE_TPE_PMU_SETUP(__x) ifx_pmu_set(IFX_PMU_MODULE_AHBS, (__x)) ++#define DSL_DFE_PMU_SETUP(__x) ifx_pmu_set(IFX_PMU_MODULE_DSL_DFE, (__x)) ++ ++#define IFX_REG_W32(_v, _r) __raw_writel((_v), (_r)) ++ ++#define CONFIG_IFXMIPS_DSL_CPE_MEI y ++ ++#endif +Index: drv_dsl_cpe_api-3.24.4.4/src/mei/ifxmips_atm_ppe_danube.h +=================================================================== +--- drv_dsl_cpe_api-3.24.4.4.orig/src/mei/ifxmips_atm_ppe_danube.h 2009-11-01 14:30:55.000000000 +0100 ++++ drv_dsl_cpe_api-3.24.4.4/src/mei/ifxmips_atm_ppe_danube.h 2009-11-01 15:58:50.000000000 +0100 +@@ -1,7 +1,7 @@ + #ifndef IFXMIPS_ATM_PPE_DANUBE_H + #define IFXMIPS_ATM_PPE_DANUBE_H + +- ++#include + + /* + * FPI Configuration Bus Register and Memory Address Mapping +@@ -93,7 +93,7 @@ + /* + * Mailbox IGU1 Interrupt + */ +-#define PPE_MAILBOX_IGU1_INT INT_NUM_IM2_IRL24 ++#define PPE_MAILBOX_IGU1_INT IFXMIPS_PPE_MBOX_INT + + + +Index: drv_dsl_cpe_api-3.24.4.4/src/mei/ifxmips_atm_danube.c +=================================================================== +--- drv_dsl_cpe_api-3.24.4.4.orig/src/mei/ifxmips_atm_danube.c 2009-11-01 14:29:18.000000000 +0100 ++++ drv_dsl_cpe_api-3.24.4.4/src/mei/ifxmips_atm_danube.c 2009-11-01 15:58:50.000000000 +0100 +@@ -45,10 +45,9 @@ + /* + * Chip Specific Head File + */ +-#include +-#include +-#include +-#include ++#include ++#include ++#include "ifxmips_compat.h" + #include "ifxmips_atm_core.h" + #include "ifxmips_atm_fw_danube.h" + diff --git a/package/ifxmips-dsl-api/src/Makefile b/package/ifxmips-dsl-api/src/Makefile new file mode 100644 index 000000000..c8211d371 --- /dev/null +++ b/package/ifxmips-dsl-api/src/Makefile @@ -0,0 +1,3 @@ +obj-m = ifxmips_mei.o ifxmips_atm.o + +ifxmips_atm-objs := ifxmips_atm_core.o ifxmips_atm_danube.o diff --git a/package/ifxmips-dsl-api/src/ifx_atm.h b/package/ifxmips-dsl-api/src/ifx_atm.h new file mode 100644 index 000000000..ed90b5d4d --- /dev/null +++ b/package/ifxmips-dsl-api/src/ifx_atm.h @@ -0,0 +1,172 @@ +/****************************************************************************** +** +** FILE NAME : ifx_atm.h +** PROJECT : UEIP +** MODULES : ATM +** +** DATE : 17 Jun 2009 +** AUTHOR : Xu Liang +** DESCRIPTION : Global ATM driver header file +** COPYRIGHT : Copyright (c) 2006 +** Infineon Technologies AG +** Am Campeon 1-12, 85579 Neubiberg, Germany +** +** 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 of the License, or +** (at your option) any later version. +** +** HISTORY +** $Date $Author $Comment +** 07 JUL 2009 Xu Liang Init Version +*******************************************************************************/ + +#ifndef IFX_ATM_H +#define IFX_ATM_H + + + +/*! + \defgroup IFX_ATM UEIP Project - ATM driver module + \brief UEIP Project - ATM driver module, support Danube, Amazon-SE, AR9, VR9. + */ + +/*! + \defgroup IFX_ATM_IOCTL IOCTL Commands + \ingroup IFX_ATM + \brief IOCTL Commands used by user application. + */ + +/*! + \defgroup IFX_ATM_STRUCT Structures + \ingroup IFX_ATM + \brief Structures used by user application. + */ + +/*! + \file ifx_atm.h + \ingroup IFX_ATM + \brief ATM driver header file + */ + + + +/* + * #################################### + * Definition + * #################################### + */ + +/*! + \addtogroup IFX_ATM_STRUCT + */ +/*@{*/ + +/* + * ATM MIB + */ + +typedef struct { + __u32 ifHCInOctets_h; /*!< byte counter of ingress cells (upper 32 bits, total 64 bits) */ + __u32 ifHCInOctets_l; /*!< byte counter of ingress cells (lower 32 bits, total 64 bits) */ + __u32 ifHCOutOctets_h; /*!< byte counter of egress cells (upper 32 bits, total 64 bits) */ + __u32 ifHCOutOctets_l; /*!< byte counter of egress cells (lower 32 bits, total 64 bits) */ + __u32 ifInErrors; /*!< counter of error ingress cells */ + __u32 ifInUnknownProtos; /*!< counter of unknown ingress cells */ + __u32 ifOutErrors; /*!< counter of error egress cells */ +} atm_cell_ifEntry_t; + +typedef struct { + __u32 ifHCInOctets_h; /*!< byte counter of ingress packets (upper 32 bits, total 64 bits) */ + __u32 ifHCInOctets_l; /*!< byte counter of ingress packets (lower 32 bits, total 64 bits) */ + __u32 ifHCOutOctets_h; /*!< byte counter of egress packets (upper 32 bits, total 64 bits) */ + __u32 ifHCOutOctets_l; /*!< byte counter of egress packets (lower 32 bits, total 64 bits) */ + __u32 ifInUcastPkts; /*!< counter of ingress packets */ + __u32 ifOutUcastPkts; /*!< counter of egress packets */ + __u32 ifInErrors; /*!< counter of error ingress packets */ + __u32 ifInDiscards; /*!< counter of dropped ingress packets */ + __u32 ifOutErros; /*!< counter of error egress packets */ + __u32 ifOutDiscards; /*!< counter of dropped egress packets */ +} atm_aal5_ifEntry_t; + +typedef struct { + __u32 aal5VccCrcErrors; /*!< counter of ingress packets with CRC error */ + __u32 aal5VccSarTimeOuts; /*!< counter of ingress packets with Re-assemble timeout */ //no timer support yet + __u32 aal5VccOverSizedSDUs; /*!< counter of oversized ingress packets */ +} atm_aal5_vcc_t; + +typedef struct { + int vpi; /*!< VPI of the VCC to get MIB counters */ + int vci; /*!< VCI of the VCC to get MIB counters */ + atm_aal5_vcc_t mib_vcc; /*!< structure to get MIB counters */ +} atm_aal5_vcc_x_t; + +/*@}*/ + + + +/* + * #################################### + * IOCTL + * #################################### + */ + +/*! + \addtogroup IFX_ATM_IOCTL + */ +/*@{*/ + +/* + * ioctl Command + */ +/*! + \brief ATM IOCTL Magic Number + */ +#define PPE_ATM_IOC_MAGIC 'o' +/*! + \brief ATM IOCTL Command - Get Cell Level MIB Counters + + This command is obsolete. User can get cell level MIB from DSL API. + This command uses structure "atm_cell_ifEntry_t" as parameter for output of MIB counters. + */ +#define PPE_ATM_MIB_CELL _IOW(PPE_ATM_IOC_MAGIC, 0, atm_cell_ifEntry_t) +/*! + \brief ATM IOCTL Command - Get AAL5 Level MIB Counters + + Get AAL5 packet counters. + This command uses structure "atm_aal5_ifEntry_t" as parameter for output of MIB counters. + */ +#define PPE_ATM_MIB_AAL5 _IOW(PPE_ATM_IOC_MAGIC, 1, atm_aal5_ifEntry_t) +/*! + \brief ATM IOCTL Command - Get Per PVC MIB Counters + + Get AAL5 packet counters for each PVC. + This command uses structure "atm_aal5_vcc_x_t" as parameter for input of VPI/VCI information and output of MIB counters. + */ +#define PPE_ATM_MIB_VCC _IOWR(PPE_ATM_IOC_MAGIC, 2, atm_aal5_vcc_x_t) +/*! + \brief Total Number of ATM IOCTL Commands + */ +#define PPE_ATM_IOC_MAXNR 3 + +/*@}*/ + + + +/* + * #################################### + * API + * #################################### + */ + +#ifdef __KERNEL__ +struct port_cell_info { + unsigned int port_num; + unsigned int tx_link_rate[2]; +}; +#endif + + + +#endif // IFX_ATM_H + diff --git a/package/ifxmips-dsl-api/src/ifxmips_atm.h b/package/ifxmips-dsl-api/src/ifxmips_atm.h new file mode 100644 index 000000000..ed90b5d4d --- /dev/null +++ b/package/ifxmips-dsl-api/src/ifxmips_atm.h @@ -0,0 +1,172 @@ +/****************************************************************************** +** +** FILE NAME : ifx_atm.h +** PROJECT : UEIP +** MODULES : ATM +** +** DATE : 17 Jun 2009 +** AUTHOR : Xu Liang +** DESCRIPTION : Global ATM driver header file +** COPYRIGHT : Copyright (c) 2006 +** Infineon Technologies AG +** Am Campeon 1-12, 85579 Neubiberg, Germany +** +** 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 of the License, or +** (at your option) any later version. +** +** HISTORY +** $Date $Author $Comment +** 07 JUL 2009 Xu Liang Init Version +*******************************************************************************/ + +#ifndef IFX_ATM_H +#define IFX_ATM_H + + + +/*! + \defgroup IFX_ATM UEIP Project - ATM driver module + \brief UEIP Project - ATM driver module, support Danube, Amazon-SE, AR9, VR9. + */ + +/*! + \defgroup IFX_ATM_IOCTL IOCTL Commands + \ingroup IFX_ATM + \brief IOCTL Commands used by user application. + */ + +/*! + \defgroup IFX_ATM_STRUCT Structures + \ingroup IFX_ATM + \brief Structures used by user application. + */ + +/*! + \file ifx_atm.h + \ingroup IFX_ATM + \brief ATM driver header file + */ + + + +/* + * #################################### + * Definition + * #################################### + */ + +/*! + \addtogroup IFX_ATM_STRUCT + */ +/*@{*/ + +/* + * ATM MIB + */ + +typedef struct { + __u32 ifHCInOctets_h; /*!< byte counter of ingress cells (upper 32 bits, total 64 bits) */ + __u32 ifHCInOctets_l; /*!< byte counter of ingress cells (lower 32 bits, total 64 bits) */ + __u32 ifHCOutOctets_h; /*!< byte counter of egress cells (upper 32 bits, total 64 bits) */ + __u32 ifHCOutOctets_l; /*!< byte counter of egress cells (lower 32 bits, total 64 bits) */ + __u32 ifInErrors; /*!< counter of error ingress cells */ + __u32 ifInUnknownProtos; /*!< counter of unknown ingress cells */ + __u32 ifOutErrors; /*!< counter of error egress cells */ +} atm_cell_ifEntry_t; + +typedef struct { + __u32 ifHCInOctets_h; /*!< byte counter of ingress packets (upper 32 bits, total 64 bits) */ + __u32 ifHCInOctets_l; /*!< byte counter of ingress packets (lower 32 bits, total 64 bits) */ + __u32 ifHCOutOctets_h; /*!< byte counter of egress packets (upper 32 bits, total 64 bits) */ + __u32 ifHCOutOctets_l; /*!< byte counter of egress packets (lower 32 bits, total 64 bits) */ + __u32 ifInUcastPkts; /*!< counter of ingress packets */ + __u32 ifOutUcastPkts; /*!< counter of egress packets */ + __u32 ifInErrors; /*!< counter of error ingress packets */ + __u32 ifInDiscards; /*!< counter of dropped ingress packets */ + __u32 ifOutErros; /*!< counter of error egress packets */ + __u32 ifOutDiscards; /*!< counter of dropped egress packets */ +} atm_aal5_ifEntry_t; + +typedef struct { + __u32 aal5VccCrcErrors; /*!< counter of ingress packets with CRC error */ + __u32 aal5VccSarTimeOuts; /*!< counter of ingress packets with Re-assemble timeout */ //no timer support yet + __u32 aal5VccOverSizedSDUs; /*!< counter of oversized ingress packets */ +} atm_aal5_vcc_t; + +typedef struct { + int vpi; /*!< VPI of the VCC to get MIB counters */ + int vci; /*!< VCI of the VCC to get MIB counters */ + atm_aal5_vcc_t mib_vcc; /*!< structure to get MIB counters */ +} atm_aal5_vcc_x_t; + +/*@}*/ + + + +/* + * #################################### + * IOCTL + * #################################### + */ + +/*! + \addtogroup IFX_ATM_IOCTL + */ +/*@{*/ + +/* + * ioctl Command + */ +/*! + \brief ATM IOCTL Magic Number + */ +#define PPE_ATM_IOC_MAGIC 'o' +/*! + \brief ATM IOCTL Command - Get Cell Level MIB Counters + + This command is obsolete. User can get cell level MIB from DSL API. + This command uses structure "atm_cell_ifEntry_t" as parameter for output of MIB counters. + */ +#define PPE_ATM_MIB_CELL _IOW(PPE_ATM_IOC_MAGIC, 0, atm_cell_ifEntry_t) +/*! + \brief ATM IOCTL Command - Get AAL5 Level MIB Counters + + Get AAL5 packet counters. + This command uses structure "atm_aal5_ifEntry_t" as parameter for output of MIB counters. + */ +#define PPE_ATM_MIB_AAL5 _IOW(PPE_ATM_IOC_MAGIC, 1, atm_aal5_ifEntry_t) +/*! + \brief ATM IOCTL Command - Get Per PVC MIB Counters + + Get AAL5 packet counters for each PVC. + This command uses structure "atm_aal5_vcc_x_t" as parameter for input of VPI/VCI information and output of MIB counters. + */ +#define PPE_ATM_MIB_VCC _IOWR(PPE_ATM_IOC_MAGIC, 2, atm_aal5_vcc_x_t) +/*! + \brief Total Number of ATM IOCTL Commands + */ +#define PPE_ATM_IOC_MAXNR 3 + +/*@}*/ + + + +/* + * #################################### + * API + * #################################### + */ + +#ifdef __KERNEL__ +struct port_cell_info { + unsigned int port_num; + unsigned int tx_link_rate[2]; +}; +#endif + + + +#endif // IFX_ATM_H + diff --git a/package/ifxmips-dsl-api/src/ifxmips_atm_core.c b/package/ifxmips-dsl-api/src/ifxmips_atm_core.c new file mode 100644 index 000000000..5d1af1f7b --- /dev/null +++ b/package/ifxmips-dsl-api/src/ifxmips_atm_core.c @@ -0,0 +1,2507 @@ +/****************************************************************************** +** +** FILE NAME : ifxmips_atm_core.c +** PROJECT : UEIP +** MODULES : ATM +** +** DATE : 7 Jul 2009 +** AUTHOR : Xu Liang +** DESCRIPTION : ATM driver common source file (core functions) +** COPYRIGHT : Copyright (c) 2006 +** Infineon Technologies AG +** Am Campeon 1-12, 85579 Neubiberg, Germany +** +** 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 of the License, or +** (at your option) any later version. +** +** HISTORY +** $Date $Author $Comment +** 07 JUL 2009 Xu Liang Init Version +*******************************************************************************/ + + + +/* + * #################################### + * Version No. + * #################################### + */ + +#define IFX_ATM_VER_MAJOR 1 +#define IFX_ATM_VER_MID 0 +#define IFX_ATM_VER_MINOR 8 + + + +/* + * #################################### + * Head File + * #################################### + */ + +/* + * Common Head File + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Chip Specific Head File + */ +#include +#include +#include +#include "ifxmips_atm_core.h" + + + +/* + * #################################### + * Kernel Version Adaption + * #################################### + */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11) + #define MODULE_PARM_ARRAY(a, b) module_param_array(a, int, NULL, 0) + #define MODULE_PARM(a, b) module_param(a, int, 0) +#else + #define MODULE_PARM_ARRAY(a, b) MODULE_PARM(a, b) +#endif + + + +/*! + \addtogroup IFXMIPS_ATM_MODULE_PARAMS + */ +/*@{*/ +/* + * #################################### + * Parameters to Configure PPE + * #################################### + */ +/*! + \brief QSB cell delay variation due to concurrency + */ +static int qsb_tau = 1; /* QSB cell delay variation due to concurrency */ +/*! + \brief QSB scheduler burst length + */ +static int qsb_srvm = 0x0F; /* QSB scheduler burst length */ +/*! + \brief QSB time step, all legal values are 1, 2, 4 + */ +static int qsb_tstep = 4 ; /* QSB time step, all legal values are 1, 2, 4 */ + +/*! + \brief Write descriptor delay + */ +static int write_descriptor_delay = 0x20; /* Write descriptor delay */ + +/*! + \brief AAL5 padding byte ('~') + */ +static int aal5_fill_pattern = 0x007E; /* AAL5 padding byte ('~') */ +/*! + \brief Max frame size for RX + */ +static int aal5r_max_packet_size = 0x0700; /* Max frame size for RX */ +/*! + \brief Min frame size for RX + */ +static int aal5r_min_packet_size = 0x0000; /* Min frame size for RX */ +/*! + \brief Max frame size for TX + */ +static int aal5s_max_packet_size = 0x0700; /* Max frame size for TX */ +/*! + \brief Min frame size for TX + */ +static int aal5s_min_packet_size = 0x0000; /* Min frame size for TX */ +/*! + \brief Drop error packet in RX path + */ +static int aal5r_drop_error_packet = 1; /* Drop error packet in RX path */ + +/*! + \brief Number of descriptors per DMA RX channel + */ +static int dma_rx_descriptor_length = 128; /* Number of descriptors per DMA RX channel */ +/*! + \brief Number of descriptors per DMA TX channel + */ +static int dma_tx_descriptor_length = 64; /* Number of descriptors per DMA TX channel */ +/*! + \brief PPE core clock cycles between descriptor write and effectiveness in external RAM + */ +static int dma_rx_clp1_descriptor_threshold = 38; +/*@}*/ + +MODULE_PARM(qsb_tau, "i"); +MODULE_PARM_DESC(qsb_tau, "Cell delay variation. Value must be > 0"); +MODULE_PARM(qsb_srvm, "i"); +MODULE_PARM_DESC(qsb_srvm, "Maximum burst size"); +MODULE_PARM(qsb_tstep, "i"); +MODULE_PARM_DESC(qsb_tstep, "n*32 cycles per sbs cycles n=1,2,4"); + +MODULE_PARM(write_descriptor_delay, "i"); +MODULE_PARM_DESC(write_descriptor_delay, "PPE core clock cycles between descriptor write and effectiveness in external RAM"); + +MODULE_PARM(aal5_fill_pattern, "i"); +MODULE_PARM_DESC(aal5_fill_pattern, "Filling pattern (PAD) for AAL5 frames"); +MODULE_PARM(aal5r_max_packet_size, "i"); +MODULE_PARM_DESC(aal5r_max_packet_size, "Max packet size in byte for downstream AAL5 frames"); +MODULE_PARM(aal5r_min_packet_size, "i"); +MODULE_PARM_DESC(aal5r_min_packet_size, "Min packet size in byte for downstream AAL5 frames"); +MODULE_PARM(aal5s_max_packet_size, "i"); +MODULE_PARM_DESC(aal5s_max_packet_size, "Max packet size in byte for upstream AAL5 frames"); +MODULE_PARM(aal5s_min_packet_size, "i"); +MODULE_PARM_DESC(aal5s_min_packet_size, "Min packet size in byte for upstream AAL5 frames"); +MODULE_PARM(aal5r_drop_error_packet, "i"); +MODULE_PARM_DESC(aal5r_drop_error_packet, "Non-zero value to drop error packet for downstream"); + +MODULE_PARM(dma_rx_descriptor_length, "i"); +MODULE_PARM_DESC(dma_rx_descriptor_length, "Number of descriptor assigned to DMA RX channel (>16)"); +MODULE_PARM(dma_tx_descriptor_length, "i"); +MODULE_PARM_DESC(dma_tx_descriptor_length, "Number of descriptor assigned to DMA TX channel (>16)"); +MODULE_PARM(dma_rx_clp1_descriptor_threshold, "i"); +MODULE_PARM_DESC(dma_rx_clp1_descriptor_threshold, "Descriptor threshold for cells with cell loss priority 1"); + + + +/* + * #################################### + * Definition + * #################################### + */ + +#define DUMP_SKB_LEN ~0 + + + +/* + * #################################### + * Declaration + * #################################### + */ + +/* + * Network Operations + */ +static int ppe_ioctl(struct atm_dev *, unsigned int, void *); +static int ppe_open(struct atm_vcc *); +static void ppe_close(struct atm_vcc *); +static int ppe_send(struct atm_vcc *, struct sk_buff *); +static int ppe_send_oam(struct atm_vcc *, void *, int); +static int ppe_change_qos(struct atm_vcc *, struct atm_qos *, int); + +/* + * ADSL LED + */ +static INLINE int adsl_led_flash(void); + +/* + * 64-bit operation used by MIB calculation + */ +static INLINE void u64_add_u32(ppe_u64_t, unsigned int, ppe_u64_t *); + +/* + * buffer manage functions + */ +static INLINE struct sk_buff* alloc_skb_rx(void); +static INLINE struct sk_buff* alloc_skb_tx(unsigned int); +struct sk_buff* atm_alloc_tx(struct atm_vcc *, unsigned int); +static INLINE void atm_free_tx_skb_vcc(struct sk_buff *, struct atm_vcc *); +static INLINE struct sk_buff *get_skb_rx_pointer(unsigned int); +static INLINE int get_tx_desc(unsigned int); + +/* + * mailbox handler and signal function + */ +static INLINE void mailbox_oam_rx_handler(void); +static INLINE void mailbox_aal_rx_handler(void); +#if defined(ENABLE_TASKLET) && ENABLE_TASKLET + static void do_ppe_tasklet(unsigned long); +#endif +static irqreturn_t mailbox_irq_handler(int, void *); +static INLINE void mailbox_signal(unsigned int, int); + +/* + * QSB & HTU setting functions + */ +static void set_qsb(struct atm_vcc *, struct atm_qos *, unsigned int); +static void qsb_global_set(void); +static INLINE void set_htu_entry(unsigned int, unsigned int, unsigned int, int, int); +static INLINE void clear_htu_entry(unsigned int); +static void validate_oam_htu_entry(void); +static void invalidate_oam_htu_entry(void); + +/* + * look up for connection ID + */ +static INLINE int find_vpi(unsigned int); +static INLINE int find_vpivci(unsigned int, unsigned int); +static INLINE int find_vcc(struct atm_vcc *); + +/* + * Debug Functions + */ +#if defined(DEBUG_DUMP_SKB) && DEBUG_DUMP_SKB + static void dump_skb(struct sk_buff *, u32, char *, int, int, int); +#else + #define dump_skb(skb, len, title, port, ch, is_tx) do {} while (0) +#endif + +/* + * Proc File Functions + */ +static INLINE void proc_file_create(void); +static INLINE void proc_file_delete(void); +static int proc_read_version(char *, char **, off_t, int, int *, void *); +static int proc_read_mib(char *, char **, off_t, int, int *, void *); +static int proc_write_mib(struct file *, const char *, unsigned long, void *); +#if defined(ENABLE_DBG_PROC) && ENABLE_DBG_PROC + static int proc_read_dbg(char *, char **, off_t, int, int *, void *); + static int proc_write_dbg(struct file *, const char *, unsigned long, void *); +#endif +#if defined(ENABLE_FW_PROC) && ENABLE_FW_PROC + static int proc_read_htu(char *, char **, off_t, int, int *, void *); + static int proc_read_txq(char *, char **, off_t, int, int *, void *); +#endif + +/* + * Proc Help Functions + */ +static int stricmp(const char *, const char *); +#if defined(ENABLE_DBG_PROC) && ENABLE_DBG_PROC + static int strincmp(const char *, const char *, int); +#endif +static INLINE int ifx_atm_version(char *); +//static INLINE int print_reset_domain(char *, int); +//static INLINE int print_reset_handler(char *, int, ifx_rcu_handler_t *); + +/* + * Init & clean-up functions + */ +#ifdef MODULE + static INLINE void reset_ppe(void); +#endif +static INLINE void check_parameters(void); +static INLINE int init_priv_data(void); +static INLINE void clear_priv_data(void); +static INLINE void init_rx_tables(void); +static INLINE void init_tx_tables(void); + +/* + * Exteranl Function + */ +#if defined(CONFIG_IFX_OAM) || defined(CONFIG_IFX_OAM_MODULE) + extern void ifx_push_oam(unsigned char *); +#else + static inline void ifx_push_oam(unsigned char *dummy) {} +#endif +#if defined(CONFIG_IFXMIPS_DSL_CPE_MEI) || defined(CONFIG_IFXMIPS_DSL_CPE_MEI_MODULE) + extern int ifx_mei_atm_led_blink(void); + extern int ifx_mei_atm_showtime_check(int *is_showtime, struct port_cell_info *port_cell, void **xdata_addr); +#else + static inline int ifx_mei_atm_led_blink(void) { return IFX_SUCCESS; } + static inline int ifx_mei_atm_showtime_check(int *is_showtime, struct port_cell_info *port_cell, void **xdata_addr) + { + if ( is_showtime != NULL ) + *is_showtime = 0; + return IFX_SUCCESS; + } +#endif + +/* + * External variable + */ +extern struct sk_buff* (*ifx_atm_alloc_tx)(struct atm_vcc *, unsigned int); +#if defined(CONFIG_IFXMIPS_DSL_CPE_MEI) || defined(CONFIG_IFXMIPS_DSL_CPE_MEI_MODULE) + extern int (*ifx_mei_atm_showtime_enter)(struct port_cell_info *, void *); + extern int (*ifx_mei_atm_showtime_exit)(void); +#else + int (*ifx_mei_atm_showtime_enter)(struct port_cell_info *, void *) = NULL; + EXPORT_SYMBOL(ifx_mei_atm_showtime_enter); + int (*ifx_mei_atm_showtime_exit)(void) = NULL; + EXPORT_SYMBOL(ifx_mei_atm_showtime_exit); +#endif + + + +/* + * #################################### + * Local Variable + * #################################### + */ + +static struct atm_priv_data g_atm_priv_data; + +static struct atmdev_ops g_ifx_atm_ops = { + .open = ppe_open, + .close = ppe_close, + .ioctl = ppe_ioctl, + .send = ppe_send, + .send_oam = ppe_send_oam, + .change_qos = ppe_change_qos, + .owner = THIS_MODULE, +}; + +#if defined(ENABLE_TASKLET) && ENABLE_TASKLET + DECLARE_TASKLET(g_dma_tasklet, do_ppe_tasklet, 0); +#endif + +static int g_showtime = 0; +static void *g_xdata_addr = NULL; + +unsigned int ifx_atm_dbg_enable = 0; + +static struct proc_dir_entry* g_atm_dir = NULL; + + + +/* + * #################################### + * Local Function + * #################################### + */ + +static int ppe_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg) +{ + int ret = 0; + atm_cell_ifEntry_t mib_cell; + atm_aal5_ifEntry_t mib_aal5; + atm_aal5_vcc_x_t mib_vcc; + unsigned int value; + int conn; + + if ( _IOC_TYPE(cmd) != PPE_ATM_IOC_MAGIC + || _IOC_NR(cmd) >= PPE_ATM_IOC_MAXNR ) + return -ENOTTY; + + if ( _IOC_DIR(cmd) & _IOC_READ ) + ret = !access_ok(VERIFY_WRITE, arg, _IOC_SIZE(cmd)); + else if ( _IOC_DIR(cmd) & _IOC_WRITE ) + ret = !access_ok(VERIFY_READ, arg, _IOC_SIZE(cmd)); + if ( ret ) + return -EFAULT; + + switch ( cmd ) + { + case PPE_ATM_MIB_CELL: /* cell level MIB */ + /* These MIB should be read at ARC side, now put zero only. */ + mib_cell.ifHCInOctets_h = 0; + mib_cell.ifHCInOctets_l = 0; + mib_cell.ifHCOutOctets_h = 0; + mib_cell.ifHCOutOctets_l = 0; + mib_cell.ifInErrors = 0; + mib_cell.ifInUnknownProtos = WAN_MIB_TABLE->wrx_drophtu_cell; + mib_cell.ifOutErrors = 0; + + ret = sizeof(mib_cell) - copy_to_user(arg, &mib_cell, sizeof(mib_cell)); + break; + + case PPE_ATM_MIB_AAL5: /* AAL5 MIB */ + value = WAN_MIB_TABLE->wrx_total_byte; + u64_add_u32(g_atm_priv_data.wrx_total_byte, value - g_atm_priv_data.prev_wrx_total_byte, &g_atm_priv_data.wrx_total_byte); + g_atm_priv_data.prev_wrx_total_byte = value; + mib_aal5.ifHCInOctets_h = g_atm_priv_data.wrx_total_byte.h; + mib_aal5.ifHCInOctets_l = g_atm_priv_data.wrx_total_byte.l; + + value = WAN_MIB_TABLE->wtx_total_byte; + u64_add_u32(g_atm_priv_data.wtx_total_byte, value - g_atm_priv_data.prev_wtx_total_byte, &g_atm_priv_data.wtx_total_byte); + g_atm_priv_data.prev_wtx_total_byte = value; + mib_aal5.ifHCOutOctets_h = g_atm_priv_data.wtx_total_byte.h; + mib_aal5.ifHCOutOctets_l = g_atm_priv_data.wtx_total_byte.l; + + mib_aal5.ifInUcastPkts = g_atm_priv_data.wrx_pdu; + mib_aal5.ifOutUcastPkts = WAN_MIB_TABLE->wtx_total_pdu; + mib_aal5.ifInErrors = WAN_MIB_TABLE->wrx_err_pdu; + mib_aal5.ifInDiscards = WAN_MIB_TABLE->wrx_dropdes_pdu + g_atm_priv_data.wrx_drop_pdu; + mib_aal5.ifOutErros = g_atm_priv_data.wtx_err_pdu; + mib_aal5.ifOutDiscards = g_atm_priv_data.wtx_drop_pdu; + + ret = sizeof(mib_aal5) - copy_to_user(arg, &mib_aal5, sizeof(mib_aal5)); + break; + + case PPE_ATM_MIB_VCC: /* VCC related MIB */ + copy_from_user(&mib_vcc, arg, sizeof(mib_vcc)); + conn = find_vpivci(mib_vcc.vpi, mib_vcc.vci); + if ( conn >= 0 ) + { + mib_vcc.mib_vcc.aal5VccCrcErrors = g_atm_priv_data.conn[conn].aal5_vcc_crc_err; + mib_vcc.mib_vcc.aal5VccOverSizedSDUs = g_atm_priv_data.conn[conn].aal5_vcc_oversize_sdu; + mib_vcc.mib_vcc.aal5VccSarTimeOuts = 0; /* no timer support */ + ret = sizeof(mib_vcc) - copy_to_user(arg, &mib_vcc, sizeof(mib_vcc)); + } + else + ret = -EINVAL; + break; + + default: + ret = -ENOIOCTLCMD; + } + + return ret; +} + +static int ppe_open(struct atm_vcc *vcc) +{ + int ret; + short vpi = vcc->vpi; + int vci = vcc->vci; + struct port *port = &g_atm_priv_data.port[(int)vcc->dev->dev_data]; + int conn; + int f_enable_irq = 0; +#if defined(ENABLE_ATM_RETX) && ENABLE_ATM_RETX + int sys_flag; +#endif + + if ( vcc->qos.aal != ATM_AAL5 && vcc->qos.aal != ATM_AAL0 ) + return -EPROTONOSUPPORT; + + /* check bandwidth */ + if ( (vcc->qos.txtp.traffic_class == ATM_CBR && vcc->qos.txtp.max_pcr > (port->tx_max_cell_rate - port->tx_current_cell_rate)) + || (vcc->qos.txtp.traffic_class == ATM_VBR_RT && vcc->qos.txtp.max_pcr > (port->tx_max_cell_rate - port->tx_current_cell_rate)) + || (vcc->qos.txtp.traffic_class == ATM_VBR_NRT && vcc->qos.txtp.scr > (port->tx_max_cell_rate - port->tx_current_cell_rate)) + || (vcc->qos.txtp.traffic_class == ATM_UBR_PLUS && vcc->qos.txtp.min_pcr > (port->tx_max_cell_rate - port->tx_current_cell_rate)) ) + { + ret = -EINVAL; + goto PPE_OPEN_EXIT; + } + + /* check existing vpi,vci */ + conn = find_vpivci(vpi, vci); + if ( conn >= 0 ) { + ret = -EADDRINUSE; + goto PPE_OPEN_EXIT; + } + + /* check whether it need to enable irq */ + if ( g_atm_priv_data.conn_table == 0 ) + f_enable_irq = 1; + + /* allocate connection */ + for ( conn = 0; conn < MAX_PVC_NUMBER; conn++ ) { + if ( test_and_set_bit(conn, &g_atm_priv_data.conn_table) == 0 ) { + g_atm_priv_data.conn[conn].vcc = vcc; + break; + } + } + if ( conn == MAX_PVC_NUMBER ) + { + ret = -EINVAL; + goto PPE_OPEN_EXIT; + } + + /* reserve bandwidth */ + switch ( vcc->qos.txtp.traffic_class ) { + case ATM_CBR: + case ATM_VBR_RT: + port->tx_current_cell_rate += vcc->qos.txtp.max_pcr; + break; + case ATM_VBR_NRT: + port->tx_current_cell_rate += vcc->qos.txtp.scr; + break; + case ATM_UBR_PLUS: + port->tx_current_cell_rate += vcc->qos.txtp.min_pcr; + break; + } + + /* set qsb */ + set_qsb(vcc, &vcc->qos, conn); + + /* update atm_vcc structure */ + vcc->itf = (int)vcc->dev->dev_data; + vcc->vpi = vpi; + vcc->vci = vci; + set_bit(ATM_VF_READY, &vcc->flags); + + /* enable irq */ + if (f_enable_irq ) { + ifx_atm_alloc_tx = atm_alloc_tx; + + *MBOX_IGU1_ISRC = (1 << RX_DMA_CH_AAL) | (1 << RX_DMA_CH_OAM); + *MBOX_IGU1_IER = (1 << RX_DMA_CH_AAL) | (1 << RX_DMA_CH_OAM); + + enable_irq(PPE_MAILBOX_IGU1_INT); + } + + /* set port */ + WTX_QUEUE_CONFIG(conn)->sbid = (int)vcc->dev->dev_data; + + /* set htu entry */ + set_htu_entry(vpi, vci, conn, vcc->qos.aal == ATM_AAL5 ? 1 : 0, 0); + +#if defined(ENABLE_ATM_RETX) && ENABLE_ATM_RETX + // ReTX: occupy second QID + local_irq_save(sys_flag); + if ( g_retx_htu && vcc->qos.aal == ATM_AAL5 ) + { + int retx_conn = (conn + 8) % 16; // ReTX queue + + if ( retx_conn < MAX_PVC_NUMBER && test_and_set_bit(retx_conn, &g_atm_priv_data.conn_table) == 0 ) { + g_atm_priv_data.conn[retx_conn].vcc = vcc; + set_htu_entry(vpi, vci, retx_conn, vcc->qos.aal == ATM_AAL5 ? 1 : 0, 1); + } + } + local_irq_restore(sys_flag); +#endif + + ret = 0; + +PPE_OPEN_EXIT: + return ret; +} + +static void ppe_close(struct atm_vcc *vcc) +{ + int conn; + struct port *port; + struct connection *connection; + + if ( vcc == NULL ) + return; + + /* get connection id */ + conn = find_vcc(vcc); + if ( conn < 0 ) { + err("can't find vcc"); + goto PPE_CLOSE_EXIT; + } + connection = &g_atm_priv_data.conn[conn]; + port = &g_atm_priv_data.port[connection->port]; + + /* clear htu */ + clear_htu_entry(conn); + + /* release connection */ + clear_bit(conn, &g_atm_priv_data.conn_table); + connection->vcc = NULL; + connection->aal5_vcc_crc_err = 0; + connection->aal5_vcc_oversize_sdu = 0; + + /* disable irq */ + if ( g_atm_priv_data.conn_table == 0 ) { + disable_irq(PPE_MAILBOX_IGU1_INT); + ifx_atm_alloc_tx = NULL; + } + + /* release bandwidth */ + switch ( vcc->qos.txtp.traffic_class ) + { + case ATM_CBR: + case ATM_VBR_RT: + port->tx_current_cell_rate -= vcc->qos.txtp.max_pcr; + break; + case ATM_VBR_NRT: + port->tx_current_cell_rate -= vcc->qos.txtp.scr; + break; + case ATM_UBR_PLUS: + port->tx_current_cell_rate -= vcc->qos.txtp.min_pcr; + break; + } + +PPE_CLOSE_EXIT: + return; +} + +static int ppe_send(struct atm_vcc *vcc, struct sk_buff *skb) +{ + int ret; + int conn; + int desc_base; + struct tx_descriptor reg_desc = {0}; + + if ( vcc == NULL || skb == NULL ) + return -EINVAL; + + skb_get(skb); + atm_free_tx_skb_vcc(skb, vcc); + + conn = find_vcc(vcc); + if ( conn < 0 ) { + ret = -EINVAL; + goto FIND_VCC_FAIL; + } + + if ( !g_showtime ) { + err("not in showtime"); + ret = -EIO; + goto PPE_SEND_FAIL; + } + + if ( vcc->qos.aal == ATM_AAL5 ) { + int byteoff; + int datalen; + struct tx_inband_header *header; + + datalen = skb->len; + byteoff = (unsigned int)skb->data & (DATA_BUFFER_ALIGNMENT - 1); + + if ( skb_headroom(skb) < byteoff + TX_INBAND_HEADER_LENGTH ) { + struct sk_buff *new_skb; + + new_skb = alloc_skb_tx(datalen); + if ( new_skb == NULL ) { + err("ALLOC_SKB_TX_FAIL"); + ret = -ENOMEM; + goto PPE_SEND_FAIL; + } + skb_put(new_skb, datalen); + memcpy(new_skb->data, skb->data, datalen); + dev_kfree_skb_any(skb); + skb = new_skb; + byteoff = (unsigned int)skb->data & (DATA_BUFFER_ALIGNMENT - 1); + } + + skb_push(skb, byteoff + TX_INBAND_HEADER_LENGTH); + + header = (struct tx_inband_header *)skb->data; + + /* setup inband trailer */ + header->uu = 0; + header->cpi = 0; + header->pad = aal5_fill_pattern; + header->res1 = 0; + + /* setup cell header */ + header->clp = (vcc->atm_options & ATM_ATMOPT_CLP) ? 1 : 0; + header->pti = ATM_PTI_US0; + header->vci = vcc->vci; + header->vpi = vcc->vpi; + header->gfc = 0; + + /* setup descriptor */ + reg_desc.dataptr = (unsigned int)skb->data >> 2; + reg_desc.datalen = datalen; + reg_desc.byteoff = byteoff; + reg_desc.iscell = 0; + } + else { + /* if data pointer is not aligned, allocate new sk_buff */ + if ( ((unsigned int)skb->data & (DATA_BUFFER_ALIGNMENT - 1)) != 0 ) { + struct sk_buff *new_skb; + + err("skb->data not aligned"); + + new_skb = alloc_skb_tx(skb->len); + if ( new_skb == NULL ) { + err("ALLOC_SKB_TX_FAIL"); + ret = -ENOMEM; + goto PPE_SEND_FAIL; + } + skb_put(new_skb, skb->len); + memcpy(new_skb->data, skb->data, skb->len); + dev_kfree_skb_any(skb); + skb = new_skb; + } + + reg_desc.dataptr = (unsigned int)skb->data >> 2; + reg_desc.datalen = skb->len; + reg_desc.byteoff = 0; + reg_desc.iscell = 1; + } + + reg_desc.own = 1; + reg_desc.c = 1; + reg_desc.sop = reg_desc.eop = 1; + + desc_base = get_tx_desc(conn); + if ( desc_base < 0 ) { + err("ALLOC_TX_CONNECTION_FAIL"); + ret = -EIO; + goto PPE_SEND_FAIL; + } + + if ( vcc->stats ) + atomic_inc(&vcc->stats->tx); + if ( vcc->qos.aal == ATM_AAL5 ) + g_atm_priv_data.wtx_pdu++; + + /* update descriptor send pointer */ + if ( g_atm_priv_data.conn[conn].tx_skb[desc_base] != NULL ) + dev_kfree_skb_any(g_atm_priv_data.conn[conn].tx_skb[desc_base]); + g_atm_priv_data.conn[conn].tx_skb[desc_base] = skb; + + /* write discriptor to memory and write back cache */ + g_atm_priv_data.conn[conn].tx_desc[desc_base] = reg_desc; + dma_cache_wback((unsigned long)skb->data, skb->len); + + dump_skb(skb, DUMP_SKB_LEN, (char *)__func__, 0, conn, 1); + + mailbox_signal(conn, 1); + + adsl_led_flash(); + + return 0; + +FIND_VCC_FAIL: + err("FIND_VCC_FAIL"); + g_atm_priv_data.wtx_err_pdu++; + dev_kfree_skb_any(skb); + return ret; + +PPE_SEND_FAIL: + if ( vcc->qos.aal == ATM_AAL5 ) + g_atm_priv_data.wtx_drop_pdu++; + if ( vcc->stats ) + atomic_inc(&vcc->stats->tx_err); + dev_kfree_skb_any(skb); + return ret; +} + +static int ppe_send_oam(struct atm_vcc *vcc, void *cell, int flags) +{ + int conn; + struct uni_cell_header *uni_cell_header = (struct uni_cell_header *)cell; + int desc_base; + struct sk_buff *skb; + struct tx_descriptor reg_desc = {0}; + + if ( ((uni_cell_header->pti == ATM_PTI_SEGF5 || uni_cell_header->pti == ATM_PTI_E2EF5) + && find_vpivci(uni_cell_header->vpi, uni_cell_header->vci) < 0) + || ((uni_cell_header->vci == 0x03 || uni_cell_header->vci == 0x04) + && find_vpi(uni_cell_header->vpi) < 0) ) + return -EINVAL; + + if ( !g_showtime ) { + err("not in showtime"); + return -EIO; + } + + conn = find_vcc(vcc); + if ( conn < 0 ) { + err("FIND_VCC_FAIL"); + return -EINVAL; + } + + skb = alloc_skb_tx(CELL_SIZE); + if ( skb == NULL ) { + err("ALLOC_SKB_TX_FAIL"); + return -ENOMEM; + } + memcpy(skb->data, cell, CELL_SIZE); + + reg_desc.dataptr = (unsigned int)skb->data >> 2; + reg_desc.datalen = CELL_SIZE; + reg_desc.byteoff = 0; + reg_desc.iscell = 1; + + reg_desc.own = 1; + reg_desc.c = 1; + reg_desc.sop = reg_desc.eop = 1; + + desc_base = get_tx_desc(conn); + if ( desc_base < 0 ) { + dev_kfree_skb_any(skb); + err("ALLOC_TX_CONNECTION_FAIL"); + return -EIO; + } + + if ( vcc->stats ) + atomic_inc(&vcc->stats->tx); + + /* update descriptor send pointer */ + if ( g_atm_priv_data.conn[conn].tx_skb[desc_base] != NULL ) + dev_kfree_skb_any(g_atm_priv_data.conn[conn].tx_skb[desc_base]); + g_atm_priv_data.conn[conn].tx_skb[desc_base] = skb; + + /* write discriptor to memory and write back cache */ + g_atm_priv_data.conn[conn].tx_desc[desc_base] = reg_desc; + dma_cache_wback((unsigned long)skb->data, CELL_SIZE); + + dump_skb(skb, DUMP_SKB_LEN, (char *)__func__, 0, conn, 1); + + mailbox_signal(conn, 1); + + adsl_led_flash(); + + return 0; +} + +static int ppe_change_qos(struct atm_vcc *vcc, struct atm_qos *qos, int flags) +{ + int conn; + + if ( vcc == NULL || qos == NULL ) + return -EINVAL; + + conn = find_vcc(vcc); + if ( conn < 0 ) + return -EINVAL; + + set_qsb(vcc, qos, conn); + + return 0; +} + +static INLINE int adsl_led_flash(void) +{ + return ifx_mei_atm_led_blink(); +} + +/* + * Description: + * Add a 32-bit value to 64-bit value, and put result in a 64-bit variable. + * Input: + * opt1 --- ppe_u64_t, first operand, a 64-bit unsigned integer value + * opt2 --- unsigned int, second operand, a 32-bit unsigned integer value + * ret --- ppe_u64_t, pointer to a variable to hold result + * Output: + * none + */ +static INLINE void u64_add_u32(ppe_u64_t opt1, unsigned int opt2, ppe_u64_t *ret) +{ + ret->l = opt1.l + opt2; + if ( ret->l < opt1.l || ret->l < opt2 ) + ret->h++; +} + +static INLINE struct sk_buff* alloc_skb_rx(void) +{ + struct sk_buff *skb; + + skb = dev_alloc_skb(RX_DMA_CH_AAL_BUF_SIZE + DATA_BUFFER_ALIGNMENT); + if ( skb != NULL ) { + /* must be burst length alignment */ + if ( ((unsigned int)skb->data & (DATA_BUFFER_ALIGNMENT - 1)) != 0 ) + skb_reserve(skb, ~((unsigned int)skb->data + (DATA_BUFFER_ALIGNMENT - 1)) & (DATA_BUFFER_ALIGNMENT - 1)); + /* pub skb in reserved area "skb->data - 4" */ + *((struct sk_buff **)skb->data - 1) = skb; + /* write back and invalidate cache */ + dma_cache_wback_inv((unsigned long)skb->data - sizeof(skb), sizeof(skb)); + /* invalidate cache */ + dma_cache_inv((unsigned long)skb->data, (unsigned int)skb->end - (unsigned int)skb->data); + } + + return skb; +} + +static INLINE struct sk_buff* alloc_skb_tx(unsigned int size) +{ + struct sk_buff *skb; + + /* allocate memory including header and padding */ + size += TX_INBAND_HEADER_LENGTH + MAX_TX_PACKET_ALIGN_BYTES + MAX_TX_PACKET_PADDING_BYTES; + size &= ~(DATA_BUFFER_ALIGNMENT - 1); + skb = dev_alloc_skb(size + DATA_BUFFER_ALIGNMENT); + /* must be burst length alignment */ + if ( skb != NULL ) + skb_reserve(skb, (~((unsigned int)skb->data + (DATA_BUFFER_ALIGNMENT - 1)) & (DATA_BUFFER_ALIGNMENT - 1)) + TX_INBAND_HEADER_LENGTH); + return skb; +} + +struct sk_buff* atm_alloc_tx(struct atm_vcc *vcc, unsigned int size) +{ + int conn; + struct sk_buff *skb; + + /* oversize packet */ + if ( size > aal5s_max_packet_size ) { + err("atm_alloc_tx: oversize packet"); + return NULL; + } + /* send buffer overflow */ + if ( atomic_read(&sk_atm(vcc)->sk_wmem_alloc) && !atm_may_send(vcc, size) ) { + err("atm_alloc_tx: send buffer overflow"); + return NULL; + } + conn = find_vcc(vcc); + if ( conn < 0 ) { + err("atm_alloc_tx: unknown VCC"); + return NULL; + } + + skb = dev_alloc_skb(size); + if ( skb == NULL ) { + err("atm_alloc_tx: sk buffer is used up"); + return NULL; + } + + atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); + + return skb; +} + +static INLINE void atm_free_tx_skb_vcc(struct sk_buff *skb, struct atm_vcc *vcc) +{ + if ( vcc->pop != NULL ) + vcc->pop(vcc, skb); + else + dev_kfree_skb_any(skb); +} + +static INLINE struct sk_buff *get_skb_rx_pointer(unsigned int dataptr) +{ + unsigned int skb_dataptr; + struct sk_buff *skb; + + skb_dataptr = ((dataptr - 1) << 2) | KSEG1; + skb = *(struct sk_buff **)skb_dataptr; + + ASSERT((unsigned int)skb >= KSEG0, "invalid skb - skb = %#08x, dataptr = %#08x", (unsigned int)skb, dataptr); + ASSERT(((unsigned int)skb->data | KSEG1) == ((dataptr << 2) | KSEG1), "invalid skb - skb = %#08x, skb->data = %#08x, dataptr = %#08x", (unsigned int)skb, (unsigned int)skb->data, dataptr); + + return skb; +} + +static INLINE int get_tx_desc(unsigned int conn) +{ + int desc_base = -1; + struct connection *p_conn = &g_atm_priv_data.conn[conn]; + + if ( p_conn->tx_desc[p_conn->tx_desc_pos].own == 0 ) { + desc_base = p_conn->tx_desc_pos; + if ( ++(p_conn->tx_desc_pos) == dma_tx_descriptor_length ) + p_conn->tx_desc_pos = 0; + } + + return desc_base; +} + +static INLINE void mailbox_oam_rx_handler(void) +{ + unsigned int vlddes = WRX_DMA_CHANNEL_CONFIG(RX_DMA_CH_OAM)->vlddes; + struct rx_descriptor reg_desc; + struct uni_cell_header *header; + int conn; + struct atm_vcc *vcc; + unsigned int i; + + for ( i = 0; i < vlddes; i++ ) { + do { + reg_desc = g_atm_priv_data.oam_desc[g_atm_priv_data.oam_desc_pos]; + } while ( reg_desc.own || !reg_desc.c ); // keep test OWN and C bit until data is ready + + header = (struct uni_cell_header *)&g_atm_priv_data.oam_buf[g_atm_priv_data.oam_desc_pos * RX_DMA_CH_OAM_BUF_SIZE]; + + if ( header->pti == ATM_PTI_SEGF5 || header->pti == ATM_PTI_E2EF5 ) + conn = find_vpivci(header->vpi, header->vci); + else if ( header->vci == 0x03 || header->vci == 0x04 ) + conn = find_vpi(header->vpi); + else + conn = -1; + + if ( conn >= 0 && g_atm_priv_data.conn[conn].vcc != NULL ) { + vcc = g_atm_priv_data.conn[conn].vcc; + + if ( vcc->push_oam != NULL ) + vcc->push_oam(vcc, header); + else + ifx_push_oam((unsigned char *)header); + + adsl_led_flash(); + } + + reg_desc.byteoff = 0; + reg_desc.datalen = RX_DMA_CH_OAM_BUF_SIZE; + reg_desc.own = 1; + reg_desc.c = 0; + + g_atm_priv_data.oam_desc[g_atm_priv_data.oam_desc_pos] = reg_desc; + if ( ++g_atm_priv_data.oam_desc_pos == RX_DMA_CH_OAM_DESC_LEN ) + g_atm_priv_data.oam_desc_pos = 0; + + mailbox_signal(RX_DMA_CH_OAM, 0); + } +} + +static INLINE void mailbox_aal_rx_handler(void) +{ + unsigned int vlddes = WRX_DMA_CHANNEL_CONFIG(RX_DMA_CH_AAL)->vlddes; + struct rx_descriptor reg_desc; + int conn; + struct atm_vcc *vcc; + struct sk_buff *skb, *new_skb; + struct rx_inband_trailer *trailer; + unsigned int i; + + for ( i = 0; i < vlddes; i++ ) { + do { + reg_desc = g_atm_priv_data.aal_desc[g_atm_priv_data.aal_desc_pos]; + } while ( reg_desc.own || !reg_desc.c ); // keep test OWN and C bit until data is ready + + conn = reg_desc.id; + + if ( g_atm_priv_data.conn[conn].vcc != NULL ) { + vcc = g_atm_priv_data.conn[conn].vcc; + + skb = get_skb_rx_pointer(reg_desc.dataptr); + + if ( reg_desc.err ) { + if ( vcc->qos.aal == ATM_AAL5 ) { + trailer = (struct rx_inband_trailer *)((unsigned int)skb->data + ((reg_desc.byteoff + reg_desc.datalen + MAX_RX_PACKET_PADDING_BYTES) & ~MAX_RX_PACKET_PADDING_BYTES)); + if ( trailer->stw_crc ) + g_atm_priv_data.conn[conn].aal5_vcc_crc_err++; + if ( trailer->stw_ovz ) + g_atm_priv_data.conn[conn].aal5_vcc_oversize_sdu++; + g_atm_priv_data.wrx_drop_pdu++; + } + if ( vcc->stats ) { + atomic_inc(&vcc->stats->rx_drop); + atomic_inc(&vcc->stats->rx_err); + } + } + else if ( atm_charge(vcc, skb->truesize) ) { + new_skb = alloc_skb_rx(); + if ( new_skb != NULL ) { + skb_reserve(skb, reg_desc.byteoff); + skb_put(skb, reg_desc.datalen); + ATM_SKB(skb)->vcc = vcc; + + dump_skb(skb, DUMP_SKB_LEN, (char *)__func__, 0, conn, 0); + + vcc->push(vcc, skb); + + if ( vcc->qos.aal == ATM_AAL5 ) + g_atm_priv_data.wrx_pdu++; + if ( vcc->stats ) + atomic_inc(&vcc->stats->rx); + adsl_led_flash(); + + reg_desc.dataptr = (unsigned int)new_skb->data >> 2; + } + else { + atm_return(vcc, skb->truesize); + if ( vcc->qos.aal == ATM_AAL5 ) + g_atm_priv_data.wrx_drop_pdu++; + if ( vcc->stats ) + atomic_inc(&vcc->stats->rx_drop); + } + } + else { + if ( vcc->qos.aal == ATM_AAL5 ) + g_atm_priv_data.wrx_drop_pdu++; + if ( vcc->stats ) + atomic_inc(&vcc->stats->rx_drop); + } + } + else { + g_atm_priv_data.wrx_drop_pdu++; + } + + reg_desc.byteoff = 0; + reg_desc.datalen = RX_DMA_CH_AAL_BUF_SIZE; + reg_desc.own = 1; + reg_desc.c = 0; + + g_atm_priv_data.aal_desc[g_atm_priv_data.aal_desc_pos] = reg_desc; + if ( ++g_atm_priv_data.aal_desc_pos == dma_rx_descriptor_length ) + g_atm_priv_data.aal_desc_pos = 0; + + mailbox_signal(RX_DMA_CH_AAL, 0); + } +} + +#if defined(ENABLE_TASKLET) && ENABLE_TASKLET +static void do_ppe_tasklet(unsigned long arg) +{ + *MBOX_IGU1_ISRC = *MBOX_IGU1_ISR; + mailbox_oam_rx_handler(); + mailbox_aal_rx_handler(); + if ( (*MBOX_IGU1_ISR & ((1 << RX_DMA_CH_AAL) | (1 << RX_DMA_CH_OAM))) != 0 ) + tasklet_schedule(&g_dma_tasklet); + else + enable_irq(PPE_MAILBOX_IGU1_INT); +} +#endif + +static irqreturn_t mailbox_irq_handler(int irq, void *dev_id) +{ + if ( !*MBOX_IGU1_ISR ) + return IRQ_HANDLED; + +#if defined(ENABLE_TASKLET) && ENABLE_TASKLET + disable_irq(PPE_MAILBOX_IGU1_INT); + tasklet_schedule(&g_dma_tasklet); +#else + *MBOX_IGU1_ISRC = *MBOX_IGU1_ISR; + mailbox_oam_rx_handler(); + mailbox_aal_rx_handler(); +#endif + + return IRQ_HANDLED; +} + +static INLINE void mailbox_signal(unsigned int queue, int is_tx) +{ + if ( is_tx ) { + while ( MBOX_IGU3_ISR_ISR(queue + FIRST_QSB_QID + 16) ); + *MBOX_IGU3_ISRS = MBOX_IGU3_ISRS_SET(queue + FIRST_QSB_QID + 16); + } + else { + while ( MBOX_IGU3_ISR_ISR(queue) ); + *MBOX_IGU3_ISRS = MBOX_IGU3_ISRS_SET(queue); + } +} + +static void set_qsb(struct atm_vcc *vcc, struct atm_qos *qos, unsigned int queue) +{ + unsigned int qsb_clk = ifx_get_fpi_hz(); + unsigned int qsb_qid = queue + FIRST_QSB_QID; + union qsb_queue_parameter_table qsb_queue_parameter_table = {{0}}; + union qsb_queue_vbr_parameter_table qsb_queue_vbr_parameter_table = {{0}}; + unsigned int tmp; + +#if defined(DEBUG_QOS) && DEBUG_QOS + if ( (ifx_atm_dbg_enable & DBG_ENABLE_MASK_DUMP_QOS) ) { + static char *str_traffic_class[9] = { + "ATM_NONE", + "ATM_UBR", + "ATM_CBR", + "ATM_VBR", + "ATM_ABR", + "ATM_ANYCLASS", + "ATM_VBR_RT", + "ATM_UBR_PLUS", + "ATM_MAX_PCR" + }; + printk(KERN_INFO "QoS Parameters:\n"); + printk(KERN_INFO "\tAAL : %d\n", qos->aal); + printk(KERN_INFO "\tTX Traffic Class: %s\n", str_traffic_class[qos->txtp.traffic_class]); + printk(KERN_INFO "\tTX Max PCR : %d\n", qos->txtp.max_pcr); + printk(KERN_INFO "\tTX Min PCR : %d\n", qos->txtp.min_pcr); + printk(KERN_INFO "\tTX PCR : %d\n", qos->txtp.pcr); + printk(KERN_INFO "\tTX Max CDV : %d\n", qos->txtp.max_cdv); + printk(KERN_INFO "\tTX Max SDU : %d\n", qos->txtp.max_sdu); + printk(KERN_INFO "\tTX SCR : %d\n", qos->txtp.scr); + printk(KERN_INFO "\tTX MBS : %d\n", qos->txtp.mbs); + printk(KERN_INFO "\tTX CDV : %d\n", qos->txtp.cdv); + printk(KERN_INFO "\tRX Traffic Class: %s\n", str_traffic_class[qos->rxtp.traffic_class]); + printk(KERN_INFO "\tRX Max PCR : %d\n", qos->rxtp.max_pcr); + printk(KERN_INFO "\tRX Min PCR : %d\n", qos->rxtp.min_pcr); + printk(KERN_INFO "\tRX PCR : %d\n", qos->rxtp.pcr); + printk(KERN_INFO "\tRX Max CDV : %d\n", qos->rxtp.max_cdv); + printk(KERN_INFO "\tRX Max SDU : %d\n", qos->rxtp.max_sdu); + printk(KERN_INFO "\tRX SCR : %d\n", qos->rxtp.scr); + printk(KERN_INFO "\tRX MBS : %d\n", qos->rxtp.mbs); + printk(KERN_INFO "\tRX CDV : %d\n", qos->rxtp.cdv); + } +#endif // defined(DEBUG_QOS) && DEBUG_QOS + + /* + * Peak Cell Rate (PCR) Limiter + */ + if ( qos->txtp.max_pcr == 0 ) + qsb_queue_parameter_table.bit.tp = 0; /* disable PCR limiter */ + else { + /* peak cell rate would be slightly lower than requested [maximum_rate / pcr = (qsb_clock / 8) * (time_step / 4) / pcr] */ + tmp = ((qsb_clk * qsb_tstep) >> 5) / qos->txtp.max_pcr + 1; + /* check if overflow takes place */ + qsb_queue_parameter_table.bit.tp = tmp > QSB_TP_TS_MAX ? QSB_TP_TS_MAX : tmp; + } + + // A funny issue. Create two PVCs, one UBR and one UBR with max_pcr. + // Send packets to these two PVCs at same time, it trigger strange behavior. + // In A1, RAM from 0x80000000 to 0x0x8007FFFF was corrupted with fixed pattern 0x00000000 0x40000000. + // In A4, PPE firmware keep emiting unknown cell and do not respond to driver. + // To work around, create UBR always with max_pcr. + // If user want to create UBR without max_pcr, we give a default one larger than line-rate. + if ( qos->txtp.traffic_class == ATM_UBR && qsb_queue_parameter_table.bit.tp == 0 ) { + int port = g_atm_priv_data.conn[queue].port; + unsigned int max_pcr = g_atm_priv_data.port[port].tx_max_cell_rate + 1000; + + tmp = ((qsb_clk * qsb_tstep) >> 5) / max_pcr + 1; + if ( tmp > QSB_TP_TS_MAX ) + tmp = QSB_TP_TS_MAX; + else if ( tmp < 1 ) + tmp = 1; + qsb_queue_parameter_table.bit.tp = tmp; + } + + /* + * Weighted Fair Queueing Factor (WFQF) + */ + switch ( qos->txtp.traffic_class ) { + case ATM_CBR: + case ATM_VBR_RT: + /* real time queue gets weighted fair queueing bypass */ + qsb_queue_parameter_table.bit.wfqf = 0; + break; + case ATM_VBR_NRT: + case ATM_UBR_PLUS: + /* WFQF calculation here is based on virtual cell rates, to reduce granularity for high rates */ + /* WFQF is maximum cell rate / garenteed cell rate */ + /* wfqf = qsb_minimum_cell_rate * QSB_WFQ_NONUBR_MAX / requested_minimum_peak_cell_rate */ + if ( qos->txtp.min_pcr == 0 ) + qsb_queue_parameter_table.bit.wfqf = QSB_WFQ_NONUBR_MAX; + else + { + tmp = QSB_GCR_MIN * QSB_WFQ_NONUBR_MAX / qos->txtp.min_pcr; + if ( tmp == 0 ) + qsb_queue_parameter_table.bit.wfqf = 1; + else if ( tmp > QSB_WFQ_NONUBR_MAX ) + qsb_queue_parameter_table.bit.wfqf = QSB_WFQ_NONUBR_MAX; + else + qsb_queue_parameter_table.bit.wfqf = tmp; + } + break; + default: + case ATM_UBR: + qsb_queue_parameter_table.bit.wfqf = QSB_WFQ_UBR_BYPASS; + } + + /* + * Sustained Cell Rate (SCR) Leaky Bucket Shaper VBR.0/VBR.1 + */ + if ( qos->txtp.traffic_class == ATM_VBR_RT || qos->txtp.traffic_class == ATM_VBR_NRT ) { + if ( qos->txtp.scr == 0 ) { + /* disable shaper */ + qsb_queue_vbr_parameter_table.bit.taus = 0; + qsb_queue_vbr_parameter_table.bit.ts = 0; + } + else { + /* Cell Loss Priority (CLP) */ + if ( (vcc->atm_options & ATM_ATMOPT_CLP) ) + /* CLP1 */ + qsb_queue_parameter_table.bit.vbr = 1; + else + /* CLP0 */ + qsb_queue_parameter_table.bit.vbr = 0; + /* Rate Shaper Parameter (TS) and Burst Tolerance Parameter for SCR (tauS) */ + tmp = ((qsb_clk * qsb_tstep) >> 5) / qos->txtp.scr + 1; + qsb_queue_vbr_parameter_table.bit.ts = tmp > QSB_TP_TS_MAX ? QSB_TP_TS_MAX : tmp; + tmp = (qos->txtp.mbs - 1) * (qsb_queue_vbr_parameter_table.bit.ts - qsb_queue_parameter_table.bit.tp) / 64; + if ( tmp == 0 ) + qsb_queue_vbr_parameter_table.bit.taus = 1; + else if ( tmp > QSB_TAUS_MAX ) + qsb_queue_vbr_parameter_table.bit.taus = QSB_TAUS_MAX; + else + qsb_queue_vbr_parameter_table.bit.taus = tmp; + } + } + else { + qsb_queue_vbr_parameter_table.bit.taus = 0; + qsb_queue_vbr_parameter_table.bit.ts = 0; + } + + /* Queue Parameter Table (QPT) */ + *QSB_RTM = QSB_RTM_DM_SET(QSB_QPT_SET_MASK); + *QSB_RTD = QSB_RTD_TTV_SET(qsb_queue_parameter_table.dword); + *QSB_RAMAC = QSB_RAMAC_RW_SET(QSB_RAMAC_RW_WRITE) | QSB_RAMAC_TSEL_SET(QSB_RAMAC_TSEL_QPT) | QSB_RAMAC_LH_SET(QSB_RAMAC_LH_LOW) | QSB_RAMAC_TESEL_SET(qsb_qid); +#if defined(DEBUG_QOS) && DEBUG_QOS + if ( (ifx_atm_dbg_enable & DBG_ENABLE_MASK_DUMP_QOS) ) + printk("QPT: QSB_RTM (%08X) = 0x%08X, QSB_RTD (%08X) = 0x%08X, QSB_RAMAC (%08X) = 0x%08X\n", (unsigned int)QSB_RTM, *QSB_RTM, (unsigned int)QSB_RTD, *QSB_RTD, (unsigned int)QSB_RAMAC, *QSB_RAMAC); +#endif + /* Queue VBR Paramter Table (QVPT) */ + *QSB_RTM = QSB_RTM_DM_SET(QSB_QVPT_SET_MASK); + *QSB_RTD = QSB_RTD_TTV_SET(qsb_queue_vbr_parameter_table.dword); + *QSB_RAMAC = QSB_RAMAC_RW_SET(QSB_RAMAC_RW_WRITE) | QSB_RAMAC_TSEL_SET(QSB_RAMAC_TSEL_VBR) | QSB_RAMAC_LH_SET(QSB_RAMAC_LH_LOW) | QSB_RAMAC_TESEL_SET(qsb_qid); +#if defined(DEBUG_QOS) && DEBUG_QOS + if ( (ifx_atm_dbg_enable & DBG_ENABLE_MASK_DUMP_QOS) ) + printk("QVPT: QSB_RTM (%08X) = 0x%08X, QSB_RTD (%08X) = 0x%08X, QSB_RAMAC (%08X) = 0x%08X\n", (unsigned int)QSB_RTM, *QSB_RTM, (unsigned int)QSB_RTD, *QSB_RTD, (unsigned int)QSB_RAMAC, *QSB_RAMAC); +#endif + +#if defined(DEBUG_QOS) && DEBUG_QOS + if ( (ifx_atm_dbg_enable & DBG_ENABLE_MASK_DUMP_QOS) ) { + printk("set_qsb\n"); + printk(" qsb_clk = %lu\n", (unsigned long)qsb_clk); + printk(" qsb_queue_parameter_table.bit.tp = %d\n", (int)qsb_queue_parameter_table.bit.tp); + printk(" qsb_queue_parameter_table.bit.wfqf = %d (0x%08X)\n", (int)qsb_queue_parameter_table.bit.wfqf, (int)qsb_queue_parameter_table.bit.wfqf); + printk(" qsb_queue_parameter_table.bit.vbr = %d\n", (int)qsb_queue_parameter_table.bit.vbr); + printk(" qsb_queue_parameter_table.dword = 0x%08X\n", (int)qsb_queue_parameter_table.dword); + printk(" qsb_queue_vbr_parameter_table.bit.ts = %d\n", (int)qsb_queue_vbr_parameter_table.bit.ts); + printk(" qsb_queue_vbr_parameter_table.bit.taus = %d\n", (int)qsb_queue_vbr_parameter_table.bit.taus); + printk(" qsb_queue_vbr_parameter_table.dword = 0x%08X\n", (int)qsb_queue_vbr_parameter_table.dword); + } +#endif +} + +static void qsb_global_set(void) +{ + unsigned int qsb_clk = ifx_get_fpi_hz(); + int i; + unsigned int tmp1, tmp2, tmp3; + + *QSB_ICDV = QSB_ICDV_TAU_SET(qsb_tau); + *QSB_SBL = QSB_SBL_SBL_SET(qsb_srvm); + *QSB_CFG = QSB_CFG_TSTEPC_SET(qsb_tstep >> 1); +#if defined(DEBUG_QOS) && DEBUG_QOS + if ( (ifx_atm_dbg_enable & DBG_ENABLE_MASK_DUMP_QOS) ) { + printk("qsb_clk = %u\n", qsb_clk); + printk("QSB_ICDV (%08X) = %d (%d), QSB_SBL (%08X) = %d (%d), QSB_CFG (%08X) = %d (%d)\n", (unsigned int)QSB_ICDV, *QSB_ICDV, QSB_ICDV_TAU_SET(qsb_tau), (unsigned int)QSB_SBL, *QSB_SBL, QSB_SBL_SBL_SET(qsb_srvm), (unsigned int)QSB_CFG, *QSB_CFG, QSB_CFG_TSTEPC_SET(qsb_tstep >> 1)); + } +#endif + + /* + * set SCT and SPT per port + */ + for ( i = 0; i < ATM_PORT_NUMBER; i++ ) { + if ( g_atm_priv_data.port[i].tx_max_cell_rate != 0 ) { + tmp1 = ((qsb_clk * qsb_tstep) >> 1) / g_atm_priv_data.port[i].tx_max_cell_rate; + tmp2 = tmp1 >> 6; /* integer value of Tsb */ + tmp3 = (tmp1 & ((1 << 6) - 1)) + 1; /* fractional part of Tsb */ + /* carry over to integer part (?) */ + if ( tmp3 == (1 << 6) ) + { + tmp3 = 0; + tmp2++; + } + if ( tmp2 == 0 ) + tmp2 = tmp3 = 1; + /* 1. set mask */ + /* 2. write value to data transfer register */ + /* 3. start the tranfer */ + /* SCT (FracRate) */ + *QSB_RTM = QSB_RTM_DM_SET(QSB_SET_SCT_MASK); + *QSB_RTD = QSB_RTD_TTV_SET(tmp3); + *QSB_RAMAC = QSB_RAMAC_RW_SET(QSB_RAMAC_RW_WRITE) | QSB_RAMAC_TSEL_SET(QSB_RAMAC_TSEL_SCT) | QSB_RAMAC_LH_SET(QSB_RAMAC_LH_LOW) | QSB_RAMAC_TESEL_SET(i & 0x01); +#if defined(DEBUG_QOS) && DEBUG_QOS + if ( (ifx_atm_dbg_enable & DBG_ENABLE_MASK_DUMP_QOS) ) + printk("SCT: QSB_RTM (%08X) = 0x%08X, QSB_RTD (%08X) = 0x%08X, QSB_RAMAC (%08X) = 0x%08X\n", (unsigned int)QSB_RTM, *QSB_RTM, (unsigned int)QSB_RTD, *QSB_RTD, (unsigned int)QSB_RAMAC, *QSB_RAMAC); +#endif + /* SPT (SBV + PN + IntRage) */ + *QSB_RTM = QSB_RTM_DM_SET(QSB_SET_SPT_MASK); + *QSB_RTD = QSB_RTD_TTV_SET(QSB_SPT_SBV_VALID | QSB_SPT_PN_SET(i & 0x01) | QSB_SPT_INTRATE_SET(tmp2)); + *QSB_RAMAC = QSB_RAMAC_RW_SET(QSB_RAMAC_RW_WRITE) | QSB_RAMAC_TSEL_SET(QSB_RAMAC_TSEL_SPT) | QSB_RAMAC_LH_SET(QSB_RAMAC_LH_LOW) | QSB_RAMAC_TESEL_SET(i & 0x01); +#if defined(DEBUG_QOS) && DEBUG_QOS + if ( (ifx_atm_dbg_enable & DBG_ENABLE_MASK_DUMP_QOS) ) + printk("SPT: QSB_RTM (%08X) = 0x%08X, QSB_RTD (%08X) = 0x%08X, QSB_RAMAC (%08X) = 0x%08X\n", (unsigned int)QSB_RTM, *QSB_RTM, (unsigned int)QSB_RTD, *QSB_RTD, (unsigned int)QSB_RAMAC, *QSB_RAMAC); +#endif + } + } +} + +static INLINE void set_htu_entry(unsigned int vpi, unsigned int vci, unsigned int queue, int aal5, int is_retx) +{ + struct htu_entry htu_entry = { res1: 0x00, + clp: is_retx ? 0x01 : 0x00, + pid: g_atm_priv_data.conn[queue].port & 0x01, + vpi: vpi, + vci: vci, + pti: 0x00, + vld: 0x01}; + + struct htu_mask htu_mask = { set: 0x01, +#if !defined(ENABLE_ATM_RETX) || !ENABLE_ATM_RETX + clp: 0x01, + pid_mask: 0x02, +#else + clp: g_retx_htu ? 0x00 : 0x01, + pid_mask: RETX_MODE_CFG->retx_en ? 0x03 : 0x02, +#endif + vpi_mask: 0x00, +#if !defined(ENABLE_ATM_RETX) || !ENABLE_ATM_RETX + vci_mask: 0x0000, +#else + vci_mask: RETX_MODE_CFG->retx_en ? 0xFF00 : 0x0000, +#endif + pti_mask: 0x03, // 0xx, user data + clear: 0x00}; + + struct htu_result htu_result = {res1: 0x00, + cellid: queue, + res2: 0x00, + type: aal5 ? 0x00 : 0x01, + ven: 0x01, + res3: 0x00, + qid: queue}; + + *HTU_RESULT(queue + OAM_HTU_ENTRY_NUMBER) = htu_result; + *HTU_MASK(queue + OAM_HTU_ENTRY_NUMBER) = htu_mask; + *HTU_ENTRY(queue + OAM_HTU_ENTRY_NUMBER) = htu_entry; +} + +static INLINE void clear_htu_entry(unsigned int queue) +{ + HTU_ENTRY(queue + OAM_HTU_ENTRY_NUMBER)->vld = 0; +} + +static void validate_oam_htu_entry(void) +{ + HTU_ENTRY(OAM_F4_SEG_HTU_ENTRY)->vld = 1; + HTU_ENTRY(OAM_F4_TOT_HTU_ENTRY)->vld = 1; + HTU_ENTRY(OAM_F5_HTU_ENTRY)->vld = 1; +#if defined(ENABLE_ATM_RETX) && ENABLE_ATM_RETX + HTU_ENTRY(OAM_ARQ_HTU_ENTRY)->vld = 1; +#endif +} + +static void invalidate_oam_htu_entry(void) +{ + HTU_ENTRY(OAM_F4_SEG_HTU_ENTRY)->vld = 0; + HTU_ENTRY(OAM_F4_TOT_HTU_ENTRY)->vld = 0; + HTU_ENTRY(OAM_F5_HTU_ENTRY)->vld = 0; +#if defined(ENABLE_ATM_RETX) && ENABLE_ATM_RETX + HTU_ENTRY(OAM_ARQ_HTU_ENTRY)->vld = 0; +#endif +} + +static INLINE int find_vpi(unsigned int vpi) +{ + int i; + unsigned int bit; + + for ( i = 0, bit = 1; i < MAX_PVC_NUMBER; i++, bit <<= 1 ) { + if ( (g_atm_priv_data.conn_table & bit) != 0 + && g_atm_priv_data.conn[i].vcc != NULL + && vpi == g_atm_priv_data.conn[i].vcc->vpi ) + return i; + } + + return -1; +} + +static INLINE int find_vpivci(unsigned int vpi, unsigned int vci) +{ + int i; + unsigned int bit; + + for ( i = 0, bit = 1; i < MAX_PVC_NUMBER; i++, bit <<= 1 ) { + if ( (g_atm_priv_data.conn_table & bit) != 0 + && g_atm_priv_data.conn[i].vcc != NULL + && vpi == g_atm_priv_data.conn[i].vcc->vpi + && vci == g_atm_priv_data.conn[i].vcc->vci ) + return i; + } + + return -1; +} + +static INLINE int find_vcc(struct atm_vcc *vcc) +{ + int i; + unsigned int bit; + + for ( i = 0, bit = 1; i < MAX_PVC_NUMBER; i++, bit <<= 1 ) { + if ( (g_atm_priv_data.conn_table & bit) != 0 + && g_atm_priv_data.conn[i].vcc == vcc ) + return i; + } + + return -1; +} + +#if defined(DEBUG_DUMP_SKB) && DEBUG_DUMP_SKB +static void dump_skb(struct sk_buff *skb, u32 len, char *title, int port, int ch, int is_tx) +{ + int i; + + if ( !(ifx_atm_dbg_enable & (is_tx ? DBG_ENABLE_MASK_DUMP_SKB_TX : DBG_ENABLE_MASK_DUMP_SKB_RX)) ) + return; + + if ( skb->len < len ) + len = skb->len; + + if ( len > RX_DMA_CH_AAL_BUF_SIZE ) { + printk("too big data length: skb = %08x, skb->data = %08x, skb->len = %d\n", (u32)skb, (u32)skb->data, skb->len); + return; + } + + if ( ch >= 0 ) + printk("%s (port %d, ch %d)\n", title, port, ch); + else + printk("%s\n", title); + printk(" skb->data = %08X, skb->tail = %08X, skb->len = %d\n", (u32)skb->data, (u32)skb->tail, (int)skb->len); + for ( i = 1; i <= len; i++ ) { + if ( i % 16 == 1 ) + printk(" %4d:", i - 1); + printk(" %02X", (int)(*((char*)skb->data + i - 1) & 0xFF)); + if ( i % 16 == 0 ) + printk("\n"); + } + if ( (i - 1) % 16 != 0 ) + printk("\n"); +} +#endif + +static INLINE void proc_file_create(void) +{ +#if defined(ENABLE_DBG_PROC) && ENABLE_DBG_PROC + struct proc_dir_entry *res; +#endif + + g_atm_dir = proc_mkdir("driver/ifx_atm", NULL); + + create_proc_read_entry("version", + 0, + g_atm_dir, + proc_read_version, + NULL); + + res = create_proc_entry("mib", + 0, + g_atm_dir); + if ( res != NULL ) { + res->read_proc = proc_read_mib; + res->write_proc = proc_write_mib; + } + +#if defined(ENABLE_DBG_PROC) && ENABLE_DBG_PROC + res = create_proc_entry("dbg", + 0, + g_atm_dir); + if ( res != NULL ) { + res->read_proc = proc_read_dbg; + res->write_proc = proc_write_dbg; + } +#endif + +#if defined(ENABLE_FW_PROC) && ENABLE_FW_PROC + create_proc_read_entry("htu", + 0, + g_atm_dir, + proc_read_htu, + NULL); + + create_proc_read_entry("txq", + 0, + g_atm_dir, + proc_read_txq, + NULL); +#endif +} + +static INLINE void proc_file_delete(void) +{ +#if defined(ENABLE_FW_PROC) && ENABLE_FW_PROC + remove_proc_entry("txq", g_atm_dir); + + remove_proc_entry("htu", g_atm_dir); +#endif + +#if defined(ENABLE_DBG_PROC) && ENABLE_DBG_PROC + remove_proc_entry("dbg", g_atm_dir); +#endif + + remove_proc_entry("version", g_atm_dir); + + remove_proc_entry("driver/ifx_atm", NULL); +} + +static int proc_read_version(char *buf, char **start, off_t offset, int count, int *eof, void *data) +{ + int len = 0; + + len += ifx_atm_version(buf + len); + + if ( offset >= len ) { + *start = buf; + *eof = 1; + return 0; + } + *start = buf + offset; + if ( (len -= offset) > count ) + return count; + *eof = 1; + return len; +} + +static int proc_read_mib(char *page, char **start, off_t off, int count, int *eof, void *data) +{ + int len = 0; + + len += sprintf(page + off + len, "Firmware\n"); + len += sprintf(page + off + len, " wrx_drophtu_cell = %u\n", WAN_MIB_TABLE->wrx_drophtu_cell); + len += sprintf(page + off + len, " wrx_dropdes_pdu = %u\n", WAN_MIB_TABLE->wrx_dropdes_pdu); + len += sprintf(page + off + len, " wrx_correct_pdu = %u\n", WAN_MIB_TABLE->wrx_correct_pdu); + len += sprintf(page + off + len, " wrx_err_pdu = %u\n", WAN_MIB_TABLE->wrx_err_pdu); + len += sprintf(page + off + len, " wrx_dropdes_cell = %u\n", WAN_MIB_TABLE->wrx_dropdes_cell); + len += sprintf(page + off + len, " wrx_correct_cell = %u\n", WAN_MIB_TABLE->wrx_correct_cell); + len += sprintf(page + off + len, " wrx_err_cell = %u\n", WAN_MIB_TABLE->wrx_err_cell); + len += sprintf(page + off + len, " wrx_total_byte = %u\n", WAN_MIB_TABLE->wrx_total_byte); + len += sprintf(page + off + len, " wtx_total_pdu = %u\n", WAN_MIB_TABLE->wtx_total_pdu); + len += sprintf(page + off + len, " wtx_total_cell = %u\n", WAN_MIB_TABLE->wtx_total_cell); + len += sprintf(page + off + len, " wtx_total_byte = %u\n", WAN_MIB_TABLE->wtx_total_byte); + len += sprintf(page + off + len, "Driver\n"); + len += sprintf(page + off + len, " wrx_pdu = %u\n", g_atm_priv_data.wrx_pdu); + len += sprintf(page + off + len, " wrx_drop_pdu = %u\n", g_atm_priv_data.wrx_drop_pdu); + len += sprintf(page + off + len, " wtx_pdu = %u\n", g_atm_priv_data.wtx_pdu); + len += sprintf(page + off + len, " wtx_err_pdu = %u\n", g_atm_priv_data.wtx_err_pdu); + len += sprintf(page + off + len, " wtx_drop_pdu = %u\n", g_atm_priv_data.wtx_drop_pdu); + + *eof = 1; + + return len; +} + +static int proc_write_mib(struct file *file, const char *buf, unsigned long count, void *data) +{ + char str[2048]; + char *p; + int len, rlen; + + len = count < sizeof(str) ? count : sizeof(str) - 1; + rlen = len - copy_from_user(str, buf, len); + while ( rlen && str[rlen - 1] <= ' ' ) + rlen--; + str[rlen] = 0; + for ( p = str; *p && *p <= ' '; p++, rlen-- ); + if ( !*p ) + return 0; + + if ( stricmp(p, "clear") == 0 || stricmp(p, "clear all") == 0 + || stricmp(p, "clean") == 0 || stricmp(p, "clean all") == 0 ) { + memset(WAN_MIB_TABLE, 0, sizeof(*WAN_MIB_TABLE)); + g_atm_priv_data.wrx_pdu = 0; + g_atm_priv_data.wrx_drop_pdu = 0; + g_atm_priv_data.wtx_pdu = 0; + g_atm_priv_data.wtx_err_pdu = 0; + g_atm_priv_data.wtx_drop_pdu = 0; + } + + return count; +} + +#if defined(ENABLE_DBG_PROC) && ENABLE_DBG_PROC + +static int proc_read_dbg(char *page, char **start, off_t off, int count, int *eof, void *data) +{ + int len = 0; + + len += sprintf(page + off + len, "error print - %s\n", (ifx_atm_dbg_enable & DBG_ENABLE_MASK_ERR) ? "enabled" : "disabled"); + len += sprintf(page + off + len, "debug print - %s\n", (ifx_atm_dbg_enable & DBG_ENABLE_MASK_DEBUG_PRINT) ? "enabled" : "disabled"); + len += sprintf(page + off + len, "assert - %s\n", (ifx_atm_dbg_enable & DBG_ENABLE_MASK_ASSERT) ? "enabled" : "disabled"); + len += sprintf(page + off + len, "dump rx skb - %s\n", (ifx_atm_dbg_enable & DBG_ENABLE_MASK_DUMP_SKB_RX) ? "enabled" : "disabled"); + len += sprintf(page + off + len, "dump tx skb - %s\n", (ifx_atm_dbg_enable & DBG_ENABLE_MASK_DUMP_SKB_TX) ? "enabled" : "disabled"); + len += sprintf(page + off + len, "qos - %s\n", (ifx_atm_dbg_enable & DBG_ENABLE_MASK_DUMP_QOS) ? "enabled" : "disabled"); + len += sprintf(page + off + len, "dump init - %s\n", (ifx_atm_dbg_enable & DBG_ENABLE_MASK_DUMP_INIT) ? "enabled" : "disabled"); + + *eof = 1; + + return len; +} + +static int proc_write_dbg(struct file *file, const char *buf, unsigned long count, void *data) +{ + static const char *dbg_enable_mask_str[] = { + " error print", + " err", + " debug print", + " dbg", + " assert", + " assert", + " dump rx skb", + " rx", + " dump tx skb", + " tx", + " dump qos", + " qos", + " dump init", + " init", + " all" + }; + static const int dbg_enable_mask_str_len[] = { + 12, 4, + 12, 4, + 7, 7, + 12, 3, + 12, 3, + 9, 4, + 10, 5, + 4 + }; + u32 dbg_enable_mask[] = { + DBG_ENABLE_MASK_ERR, + DBG_ENABLE_MASK_DEBUG_PRINT, + DBG_ENABLE_MASK_ASSERT, + DBG_ENABLE_MASK_DUMP_SKB_RX, + DBG_ENABLE_MASK_DUMP_SKB_TX, + DBG_ENABLE_MASK_DUMP_QOS, + DBG_ENABLE_MASK_DUMP_INIT, + DBG_ENABLE_MASK_ALL + }; + + char str[2048]; + char *p; + + int len, rlen; + + int f_enable = 0; + int i; + + len = count < sizeof(str) ? count : sizeof(str) - 1; + rlen = len - copy_from_user(str, buf, len); + while ( rlen && str[rlen - 1] <= ' ' ) + rlen--; + str[rlen] = 0; + for ( p = str; *p && *p <= ' '; p++, rlen-- ); + if ( !*p ) + return 0; + + if ( strincmp(p, "enable", 6) == 0 ) { + p += 6; + f_enable = 1; + } + else if ( strincmp(p, "disable", 7) == 0 ) { + p += 7; + f_enable = -1; + } + else if ( strincmp(p, "help", 4) == 0 || *p == '?' ) { + printk("echo [err/dbg/assert/rx/tx/init/all] > /proc/eth/dbg\n"); + } + + if ( f_enable ) { + if ( *p == 0 ) { + if ( f_enable > 0 ) + ifx_atm_dbg_enable |= DBG_ENABLE_MASK_ALL; + else + ifx_atm_dbg_enable &= ~DBG_ENABLE_MASK_ALL; + } + else { + do { + for ( i = 0; i < NUM_ENTITY(dbg_enable_mask_str); i++ ) + if ( strincmp(p, dbg_enable_mask_str[i], dbg_enable_mask_str_len[i]) == 0 ) { + if ( f_enable > 0 ) + ifx_atm_dbg_enable |= dbg_enable_mask[i >> 1]; + else + ifx_atm_dbg_enable &= ~dbg_enable_mask[i >> 1]; + p += dbg_enable_mask_str_len[i]; + break; + } + } while ( i < NUM_ENTITY(dbg_enable_mask_str) ); + } + } + + return count; +} + +#endif + +#if defined(ENABLE_FW_PROC) && ENABLE_FW_PROC + +static INLINE int print_htu(char *buf, int i) +{ + int len = 0; + + if ( HTU_ENTRY(i)->vld ) { + len += sprintf(buf + len, "%2d. valid\n", i); + len += sprintf(buf + len, " entry 0x%08x - pid %01x vpi %02x vci %04x pti %01x\n", *(u32*)HTU_ENTRY(i), HTU_ENTRY(i)->pid, HTU_ENTRY(i)->vpi, HTU_ENTRY(i)->vci, HTU_ENTRY(i)->pti); + len += sprintf(buf + len, " mask 0x%08x - pid %01x vpi %02x vci %04x pti %01x\n", *(u32*)HTU_MASK(i), HTU_MASK(i)->pid_mask, HTU_MASK(i)->vpi_mask, HTU_MASK(i)->vci_mask, HTU_MASK(i)->pti_mask); + len += sprintf(buf + len, " result 0x%08x - type: %s, qid: %d", *(u32*)HTU_RESULT(i), HTU_RESULT(i)->type ? "cell" : "AAL5", HTU_RESULT(i)->qid); + if ( HTU_RESULT(i)->type ) + len += sprintf(buf + len, ", cell id: %d, verification: %s", HTU_RESULT(i)->cellid, HTU_RESULT(i)->ven ? "on" : "off"); + len += sprintf(buf + len, "\n"); + } + else + len += sprintf(buf + len, "%2d. invalid\n", i); + + return len; +} + +static int proc_read_htu(char *page, char **start, off_t off, int count, int *eof, void *data) +{ + int len = 0; + int len_max = off + count; + char *pstr; + char str[1024]; + int llen; + + int htuts = *CFG_WRX_HTUTS; + int i; + + pstr = *start = page; + + llen = sprintf(pstr, "HTU Table (Max %d):\n", htuts); + pstr += llen; + len += llen; + + for ( i = 0; i < htuts; i++ ) { + llen = print_htu(str, i); + if ( len <= off && len + llen > off ) { + memcpy(pstr, str + off - len, len + llen - off); + pstr += len + llen - off; + } + else if ( len > off ) { + memcpy(pstr, str, llen); + pstr += llen; + } + len += llen; + if ( len >= len_max ) + goto PROC_READ_HTU_OVERRUN_END; + } + + *eof = 1; + + return len - off; + +PROC_READ_HTU_OVERRUN_END: + + return len - llen - off; +} + +static INLINE int print_tx_queue(char *buf, int i) +{ + int len = 0; + + if ( (*WTX_DMACH_ON & (1 << i)) ) { + len += sprintf(buf + len, "%2d. valid\n", i); + len += sprintf(buf + len, " queue 0x%08x - sbid %u, qsb %s\n", *(u32*)WTX_QUEUE_CONFIG(i), (unsigned int)WTX_QUEUE_CONFIG(i)->sbid, WTX_QUEUE_CONFIG(i)->qsben ? "enable" : "disable"); + len += sprintf(buf + len, " dma 0x%08x - base %08x, len %u, vlddes %u\n", *(u32*)WTX_DMA_CHANNEL_CONFIG(i), WTX_DMA_CHANNEL_CONFIG(i)->desba, WTX_DMA_CHANNEL_CONFIG(i)->deslen, WTX_DMA_CHANNEL_CONFIG(i)->vlddes); + } + else + len += sprintf(buf + len, "%2d. invalid\n", i); + + return len; +} + +static int proc_read_txq(char *page, char **start, off_t off, int count, int *eof, void *data) +{ + int len = 0; + int len_max = off + count; + char *pstr; + char str[1024]; + int llen; + + int i; + + pstr = *start = page; + + llen = sprintf(pstr, "TX Queue Config (Max %d):\n", *CFG_WTX_DCHNUM); + pstr += llen; + len += llen; + + for ( i = 0; i < 16; i++ ) { + llen = print_tx_queue(str, i); + if ( len <= off && len + llen > off ) { + memcpy(pstr, str + off - len, len + llen - off); + pstr += len + llen - off; + } + else if ( len > off ) { + memcpy(pstr, str, llen); + pstr += llen; + } + len += llen; + if ( len >= len_max ) + goto PROC_READ_HTU_OVERRUN_END; + } + + *eof = 1; + + return len - off; + +PROC_READ_HTU_OVERRUN_END: + + return len - llen - off; +} + +#endif + +static int stricmp(const char *p1, const char *p2) +{ + int c1, c2; + + while ( *p1 && *p2 ) + { + c1 = *p1 >= 'A' && *p1 <= 'Z' ? *p1 + 'a' - 'A' : *p1; + c2 = *p2 >= 'A' && *p2 <= 'Z' ? *p2 + 'a' - 'A' : *p2; + if ( (c1 -= c2) ) + return c1; + p1++; + p2++; + } + + return *p1 - *p2; +} + +#if defined(ENABLE_DBG_PROC) && ENABLE_DBG_PROC +static int strincmp(const char *p1, const char *p2, int n) +{ + int c1 = 0, c2; + + while ( n && *p1 && *p2 ) + { + c1 = *p1 >= 'A' && *p1 <= 'Z' ? *p1 + 'a' - 'A' : *p1; + c2 = *p2 >= 'A' && *p2 <= 'Z' ? *p2 + 'a' - 'A' : *p2; + if ( (c1 -= c2) ) + return c1; + p1++; + p2++; + n--; + } + + return n ? *p1 - *p2 : c1; +} +#endif + +static INLINE int ifx_atm_version(char *buf) +{ + int len = 0; + unsigned int major, minor; + + ifx_atm_get_fw_ver(&major, &minor); + + len += sprintf(buf + len, "Infineon Technologies ATM driver version %d.%d.%d\n", IFX_ATM_VER_MAJOR, IFX_ATM_VER_MID, IFX_ATM_VER_MINOR); + len += sprintf(buf + len, "Infineon Technologies ATM (A1) firmware version %d.%d\n", major, minor); + + return len; +} + +#ifdef MODULE +static INLINE void reset_ppe(void) +{ + // TODO: +} +#endif + +static INLINE void check_parameters(void) +{ + /* Please refer to Amazon spec 15.4 for setting these values. */ + if ( qsb_tau < 1 ) + qsb_tau = 1; + if ( qsb_tstep < 1 ) + qsb_tstep = 1; + else if ( qsb_tstep > 4 ) + qsb_tstep = 4; + else if ( qsb_tstep == 3 ) + qsb_tstep = 2; + + /* There is a delay between PPE write descriptor and descriptor is */ + /* really stored in memory. Host also has this delay when writing */ + /* descriptor. So PPE will use this value to determine if the write */ + /* operation makes effect. */ + if ( write_descriptor_delay < 0 ) + write_descriptor_delay = 0; + + if ( aal5_fill_pattern < 0 ) + aal5_fill_pattern = 0; + else + aal5_fill_pattern &= 0xFF; + + /* Because of the limitation of length field in descriptors, the packet */ + /* size could not be larger than 64K minus overhead size. */ + if ( aal5r_max_packet_size < 0 ) + aal5r_max_packet_size = 0; + else if ( aal5r_max_packet_size >= 65535 - MAX_RX_FRAME_EXTRA_BYTES ) + aal5r_max_packet_size = 65535 - MAX_RX_FRAME_EXTRA_BYTES; + if ( aal5r_min_packet_size < 0 ) + aal5r_min_packet_size = 0; + else if ( aal5r_min_packet_size > aal5r_max_packet_size ) + aal5r_min_packet_size = aal5r_max_packet_size; + if ( aal5s_max_packet_size < 0 ) + aal5s_max_packet_size = 0; + else if ( aal5s_max_packet_size >= 65535 - MAX_TX_FRAME_EXTRA_BYTES ) + aal5s_max_packet_size = 65535 - MAX_TX_FRAME_EXTRA_BYTES; + if ( aal5s_min_packet_size < 0 ) + aal5s_min_packet_size = 0; + else if ( aal5s_min_packet_size > aal5s_max_packet_size ) + aal5s_min_packet_size = aal5s_max_packet_size; + + if ( dma_rx_descriptor_length < 2 ) + dma_rx_descriptor_length = 2; + if ( dma_tx_descriptor_length < 2 ) + dma_tx_descriptor_length = 2; + if ( dma_rx_clp1_descriptor_threshold < 0 ) + dma_rx_clp1_descriptor_threshold = 0; + else if ( dma_rx_clp1_descriptor_threshold > dma_rx_descriptor_length ) + dma_rx_clp1_descriptor_threshold = dma_rx_descriptor_length; + + if ( dma_tx_descriptor_length < 2 ) + dma_tx_descriptor_length = 2; +} + +static INLINE int init_priv_data(void) +{ + void *p; + int i; + struct rx_descriptor rx_desc = {0}; + struct sk_buff *skb; + volatile struct tx_descriptor *p_tx_desc; + struct sk_buff **ppskb; + + // clear atm private data structure + memset(&g_atm_priv_data, 0, sizeof(g_atm_priv_data)); + + // allocate memory for RX (AAL) descriptors + p = kzalloc(dma_rx_descriptor_length * sizeof(struct rx_descriptor) + DESC_ALIGNMENT, GFP_KERNEL); + if ( p == NULL ) + return IFX_ERROR; + dma_cache_wback_inv((unsigned long)p, dma_rx_descriptor_length * sizeof(struct rx_descriptor) + DESC_ALIGNMENT); + g_atm_priv_data.aal_desc_base = p; + p = (void *)((((unsigned int)p + DESC_ALIGNMENT - 1) & ~(DESC_ALIGNMENT - 1)) | KSEG1); + g_atm_priv_data.aal_desc = (volatile struct rx_descriptor *)p; + + // allocate memory for RX (OAM) descriptors + p = kzalloc(RX_DMA_CH_OAM_DESC_LEN * sizeof(struct rx_descriptor) + DESC_ALIGNMENT, GFP_KERNEL); + if ( p == NULL ) + return IFX_ERROR; + dma_cache_wback_inv((unsigned long)p, RX_DMA_CH_OAM_DESC_LEN * sizeof(struct rx_descriptor) + DESC_ALIGNMENT); + g_atm_priv_data.oam_desc_base = p; + p = (void *)((((unsigned int)p + DESC_ALIGNMENT - 1) & ~(DESC_ALIGNMENT - 1)) | KSEG1); + g_atm_priv_data.oam_desc = (volatile struct rx_descriptor *)p; + + // allocate memory for RX (OAM) buffer + p = kzalloc(RX_DMA_CH_OAM_DESC_LEN * RX_DMA_CH_OAM_BUF_SIZE + DATA_BUFFER_ALIGNMENT, GFP_KERNEL); + if ( p == NULL ) + return IFX_ERROR; + dma_cache_wback_inv((unsigned long)p, RX_DMA_CH_OAM_DESC_LEN * RX_DMA_CH_OAM_BUF_SIZE + DATA_BUFFER_ALIGNMENT); + g_atm_priv_data.oam_buf_base = p; + p = (void *)(((unsigned int)p + DATA_BUFFER_ALIGNMENT - 1) & ~(DATA_BUFFER_ALIGNMENT - 1)); + g_atm_priv_data.oam_buf = p; + + // allocate memory for TX descriptors + p = kzalloc(MAX_PVC_NUMBER * dma_tx_descriptor_length * sizeof(struct tx_descriptor) + DESC_ALIGNMENT, GFP_KERNEL); + if ( p == NULL ) + return IFX_ERROR; + dma_cache_wback_inv((unsigned long)p, MAX_PVC_NUMBER * dma_tx_descriptor_length * sizeof(struct tx_descriptor) + DESC_ALIGNMENT); + g_atm_priv_data.tx_desc_base = p; + + // allocate memory for TX skb pointers + p = kzalloc(MAX_PVC_NUMBER * dma_tx_descriptor_length * sizeof(struct sk_buff *) + 4, GFP_KERNEL); + if ( p == NULL ) + return IFX_ERROR; + dma_cache_wback_inv((unsigned long)p, MAX_PVC_NUMBER * dma_tx_descriptor_length * sizeof(struct sk_buff *) + 4); + g_atm_priv_data.tx_skb_base = p; + + // setup RX (AAL) descriptors + rx_desc.own = 1; + rx_desc.c = 0; + rx_desc.sop = 1; + rx_desc.eop = 1; + rx_desc.byteoff = 0; + rx_desc.id = 0; + rx_desc.err = 0; + rx_desc.datalen = RX_DMA_CH_AAL_BUF_SIZE; + for ( i = 0; i < dma_rx_descriptor_length; i++ ) { + skb = alloc_skb_rx(); + if ( skb == NULL ) + return IFX_ERROR; + rx_desc.dataptr = ((unsigned int)skb->data >> 2) & 0x0FFFFFFF; + g_atm_priv_data.aal_desc[i] = rx_desc; + } + + // setup RX (OAM) descriptors + p = (void *)((unsigned int)g_atm_priv_data.oam_buf | KSEG1); + rx_desc.own = 1; + rx_desc.c = 0; + rx_desc.sop = 1; + rx_desc.eop = 1; + rx_desc.byteoff = 0; + rx_desc.id = 0; + rx_desc.err = 0; + rx_desc.datalen = RX_DMA_CH_OAM_BUF_SIZE; + for ( i = 0; i < RX_DMA_CH_OAM_DESC_LEN; i++ ) { + rx_desc.dataptr = ((unsigned int)p >> 2) & 0x0FFFFFFF; + g_atm_priv_data.oam_desc[i] = rx_desc; + p = (void *)((unsigned int)p + RX_DMA_CH_OAM_BUF_SIZE); + } + + // setup TX descriptors and skb pointers + p_tx_desc = (volatile struct tx_descriptor *)((((unsigned int)g_atm_priv_data.tx_desc_base + DESC_ALIGNMENT - 1) & ~(DESC_ALIGNMENT - 1)) | KSEG1); + ppskb = (struct sk_buff **)(((unsigned int)g_atm_priv_data.tx_skb_base + 3) & ~3); + for ( i = 0; i < MAX_PVC_NUMBER; i++ ) { + g_atm_priv_data.conn[i].tx_desc = &p_tx_desc[i * dma_tx_descriptor_length]; + g_atm_priv_data.conn[i].tx_skb = &ppskb[i * dma_tx_descriptor_length]; + } + + for ( i = 0; i < ATM_PORT_NUMBER; i++ ) + g_atm_priv_data.port[i].tx_max_cell_rate = DEFAULT_TX_LINK_RATE; + + return IFX_SUCCESS; +} + +static INLINE void clear_priv_data(void) +{ + int i, j; + struct sk_buff *skb; + + for ( i = 0; i < MAX_PVC_NUMBER; i++ ) { + if ( g_atm_priv_data.conn[i].tx_skb != NULL ) { + for ( j = 0; j < dma_tx_descriptor_length; j++ ) + if ( g_atm_priv_data.conn[i].tx_skb[j] != NULL ) + dev_kfree_skb_any(g_atm_priv_data.conn[i].tx_skb[j]); + } + } + + if ( g_atm_priv_data.tx_skb_base != NULL ) + kfree(g_atm_priv_data.tx_skb_base); + + if ( g_atm_priv_data.tx_desc_base != NULL ) + kfree(g_atm_priv_data.tx_desc_base); + + if ( g_atm_priv_data.oam_buf_base != NULL ) + kfree(g_atm_priv_data.oam_buf_base); + + if ( g_atm_priv_data.oam_desc_base != NULL ) + kfree(g_atm_priv_data.oam_desc_base); + + if ( g_atm_priv_data.aal_desc_base != NULL ) { + for ( i = 0; i < dma_rx_descriptor_length; i++ ) { + if ( g_atm_priv_data.aal_desc[i].sop || g_atm_priv_data.aal_desc[i].eop ) { // descriptor initialized + skb = get_skb_rx_pointer(g_atm_priv_data.aal_desc[i].dataptr); + dev_kfree_skb_any(skb); + } + } + kfree(g_atm_priv_data.aal_desc_base); + } +} + +static INLINE void init_rx_tables(void) +{ + int i; + struct wrx_queue_config wrx_queue_config = {0}; + struct wrx_dma_channel_config wrx_dma_channel_config = {0}; + struct htu_entry htu_entry = {0}; + struct htu_result htu_result = {0}; + struct htu_mask htu_mask = { set: 0x01, + clp: 0x01, + pid_mask: 0x00, + vpi_mask: 0x00, + vci_mask: 0x00, + pti_mask: 0x00, + clear: 0x00}; + + /* + * General Registers + */ + *CFG_WRX_HTUTS = MAX_PVC_NUMBER + OAM_HTU_ENTRY_NUMBER; + *CFG_WRX_QNUM = MAX_QUEUE_NUMBER; + *CFG_WRX_DCHNUM = RX_DMA_CH_TOTAL; + *WRX_DMACH_ON = (1 << RX_DMA_CH_TOTAL) - 1; + *WRX_HUNT_BITTH = DEFAULT_RX_HUNT_BITTH; + + /* + * WRX Queue Configuration Table + */ + wrx_queue_config.uumask = 0; + wrx_queue_config.cpimask = 0; + wrx_queue_config.uuexp = 0; + wrx_queue_config.cpiexp = 0; + wrx_queue_config.mfs = aal5r_max_packet_size; + wrx_queue_config.oversize = aal5r_max_packet_size; + wrx_queue_config.undersize = aal5r_min_packet_size; + wrx_queue_config.errdp = aal5r_drop_error_packet; + wrx_queue_config.dmach = RX_DMA_CH_AAL; + for ( i = 0; i < MAX_QUEUE_NUMBER; i++ ) + *WRX_QUEUE_CONFIG(i) = wrx_queue_config; + WRX_QUEUE_CONFIG(OAM_RX_QUEUE)->dmach = RX_DMA_CH_OAM; + + /* + * WRX DMA Channel Configuration Table + */ + wrx_dma_channel_config.chrl = 0; + wrx_dma_channel_config.clp1th = dma_rx_clp1_descriptor_threshold; + wrx_dma_channel_config.mode = 0; + wrx_dma_channel_config.rlcfg = 0; + + wrx_dma_channel_config.deslen = RX_DMA_CH_OAM_DESC_LEN; + wrx_dma_channel_config.desba = ((unsigned int)g_atm_priv_data.oam_desc >> 2) & 0x0FFFFFFF; + *WRX_DMA_CHANNEL_CONFIG(RX_DMA_CH_OAM) = wrx_dma_channel_config; + + wrx_dma_channel_config.deslen = dma_rx_descriptor_length; + wrx_dma_channel_config.desba = ((unsigned int)g_atm_priv_data.aal_desc >> 2) & 0x0FFFFFFF; + *WRX_DMA_CHANNEL_CONFIG(RX_DMA_CH_AAL) = wrx_dma_channel_config; + + /* + * HTU Tables + */ + for ( i = 0; i < MAX_PVC_NUMBER; i++ ) + { + htu_result.qid = (unsigned int)i; + + *HTU_ENTRY(i + OAM_HTU_ENTRY_NUMBER) = htu_entry; + *HTU_MASK(i + OAM_HTU_ENTRY_NUMBER) = htu_mask; + *HTU_RESULT(i + OAM_HTU_ENTRY_NUMBER) = htu_result; + } + /* OAM HTU Entry */ + htu_entry.vci = 0x03; + htu_mask.pid_mask = 0x03; + htu_mask.vpi_mask = 0xFF; + htu_mask.vci_mask = 0x0000; + htu_mask.pti_mask = 0x07; + htu_result.cellid = OAM_RX_QUEUE; + htu_result.type = 1; + htu_result.ven = 1; + htu_result.qid = OAM_RX_QUEUE; + *HTU_RESULT(OAM_F4_SEG_HTU_ENTRY) = htu_result; + *HTU_MASK(OAM_F4_SEG_HTU_ENTRY) = htu_mask; + *HTU_ENTRY(OAM_F4_SEG_HTU_ENTRY) = htu_entry; + htu_entry.vci = 0x04; + htu_result.cellid = OAM_RX_QUEUE; + htu_result.type = 1; + htu_result.ven = 1; + htu_result.qid = OAM_RX_QUEUE; + *HTU_RESULT(OAM_F4_TOT_HTU_ENTRY) = htu_result; + *HTU_MASK(OAM_F4_TOT_HTU_ENTRY) = htu_mask; + *HTU_ENTRY(OAM_F4_TOT_HTU_ENTRY) = htu_entry; + htu_entry.vci = 0x00; + htu_entry.pti = 0x04; + htu_mask.vci_mask = 0xFFFF; + htu_mask.pti_mask = 0x01; + htu_result.cellid = OAM_RX_QUEUE; + htu_result.type = 1; + htu_result.ven = 1; + htu_result.qid = OAM_RX_QUEUE; + *HTU_RESULT(OAM_F5_HTU_ENTRY) = htu_result; + *HTU_MASK(OAM_F5_HTU_ENTRY) = htu_mask; + *HTU_ENTRY(OAM_F5_HTU_ENTRY) = htu_entry; +#if defined(ENABLE_ATM_RETX) && ENABLE_ATM_RETX + htu_entry.pid = 0x0; + htu_entry.vpi = 0x01; + htu_entry.vci = 0x0001; + htu_entry.pti = 0x00; + htu_mask.pid_mask = 0x0; + htu_mask.vpi_mask = 0x00; + htu_mask.vci_mask = 0x0000; + htu_mask.pti_mask = 0x3; + htu_result.cellid = OAM_RX_QUEUE; + htu_result.type = 1; + htu_result.ven = 1; + htu_result.qid = OAM_RX_QUEUE; + *HTU_RESULT(OAM_ARQ_HTU_ENTRY) = htu_result; + *HTU_MASK(OAM_ARQ_HTU_ENTRY) = htu_mask; + *HTU_ENTRY(OAM_ARQ_HTU_ENTRY) = htu_entry; +#endif +} + +static INLINE void init_tx_tables(void) +{ + int i; + struct wtx_queue_config wtx_queue_config = {0}; + struct wtx_dma_channel_config wtx_dma_channel_config = {0}; + struct wtx_port_config wtx_port_config = { res1: 0, + qid: 0, + qsben: 1}; + + /* + * General Registers + */ + *CFG_WTX_DCHNUM = MAX_TX_DMA_CHANNEL_NUMBER; + *WTX_DMACH_ON = ((1 << MAX_TX_DMA_CHANNEL_NUMBER) - 1) ^ ((1 << FIRST_QSB_QID) - 1); + *CFG_WRDES_DELAY = write_descriptor_delay; + + /* + * WTX Port Configuration Table + */ + for ( i = 0; i < ATM_PORT_NUMBER; i++ ) + *WTX_PORT_CONFIG(i) = wtx_port_config; + + /* + * WTX Queue Configuration Table + */ + wtx_queue_config.type = 0x0; + wtx_queue_config.qsben = 1; + wtx_queue_config.sbid = 0; + for ( i = 0; i < MAX_TX_DMA_CHANNEL_NUMBER; i++ ) + *WTX_QUEUE_CONFIG(i) = wtx_queue_config; + + /* + * WTX DMA Channel Configuration Table + */ + wtx_dma_channel_config.mode = 0; + wtx_dma_channel_config.deslen = 0; + wtx_dma_channel_config.desba = 0; + for ( i = 0; i < FIRST_QSB_QID; i++ ) + *WTX_DMA_CHANNEL_CONFIG(i) = wtx_dma_channel_config; + /* normal connection */ + wtx_dma_channel_config.deslen = dma_tx_descriptor_length; + for ( ; i < MAX_TX_DMA_CHANNEL_NUMBER ; i++ ) { + wtx_dma_channel_config.desba = ((unsigned int)g_atm_priv_data.conn[i - FIRST_QSB_QID].tx_desc >> 2) & 0x0FFFFFFF; + *WTX_DMA_CHANNEL_CONFIG(i) = wtx_dma_channel_config; + } +} + + + +/* + * #################################### + * Global Function + * #################################### + */ + +static int atm_showtime_enter(struct port_cell_info *port_cell, void *xdata_addr) +{ + int i, j; + + ASSERT(port_cell != NULL, "port_cell is NULL"); + ASSERT(xdata_addr != NULL, "xdata_addr is NULL"); + + for ( j = 0; j < ATM_PORT_NUMBER && j < port_cell->port_num; j++ ) + if ( port_cell->tx_link_rate[j] > 0 ) + break; + for ( i = 0; i < ATM_PORT_NUMBER && i < port_cell->port_num; i++ ) + g_atm_priv_data.port[i].tx_max_cell_rate = port_cell->tx_link_rate[i] > 0 ? port_cell->tx_link_rate[i] : port_cell->tx_link_rate[j]; + + qsb_global_set(); + + for ( i = 0; i < MAX_PVC_NUMBER; i++ ) + if ( g_atm_priv_data.conn[i].vcc != NULL ) + set_qsb(g_atm_priv_data.conn[i].vcc, &g_atm_priv_data.conn[i].vcc->qos, i); + + // TODO: ReTX set xdata_addr + g_xdata_addr = xdata_addr; + + g_showtime = 1; + +#if defined(CONFIG_VR9) + IFX_REG_W32(0x0F, UTP_CFG); +#endif + + printk("enter showtime, cell rate: 0 - %d, 1 - %d, xdata addr: 0x%08x\n", g_atm_priv_data.port[0].tx_max_cell_rate, g_atm_priv_data.port[1].tx_max_cell_rate, (unsigned int)g_xdata_addr); + + return IFX_SUCCESS; +} + +static int atm_showtime_exit(void) +{ +#if defined(CONFIG_VR9) + IFX_REG_W32(0x00, UTP_CFG); +#endif + + g_showtime = 0; + + // TODO: ReTX clean state + g_xdata_addr = NULL; + + printk("leave showtime\n"); + + return IFX_SUCCESS; +} + + + +/* + * #################################### + * Init/Cleanup API + * #################################### + */ + +/* + * Description: + * Initialize global variables, PP32, comunication structures, register IRQ + * and register device. + * Input: + * none + * Output: + * 0 --- successful + * else --- failure, usually it is negative value of error code + */ +static int __devinit ifx_atm_init(void) +{ + int ret; + int port_num; + struct port_cell_info port_cell = {0}; + int i, j; + char ver_str[256]; + +#ifdef MODULE + reset_ppe(); +#endif + + check_parameters(); + + ret = init_priv_data(); + if ( ret != IFX_SUCCESS ) { + err("INIT_PRIV_DATA_FAIL"); + goto INIT_PRIV_DATA_FAIL; + } + + ifx_atm_init_chip(); + init_rx_tables(); + init_tx_tables(); + + /* create devices */ + for ( port_num = 0; port_num < ATM_PORT_NUMBER; port_num++ ) { + g_atm_priv_data.port[port_num].dev = atm_dev_register("ifxmips_atm", &g_ifx_atm_ops, -1, NULL); + if ( !g_atm_priv_data.port[port_num].dev ) { + err("failed to register atm device %d!", port_num); + ret = -EIO; + goto ATM_DEV_REGISTER_FAIL; + } + else { + g_atm_priv_data.port[port_num].dev->ci_range.vpi_bits = 8; + g_atm_priv_data.port[port_num].dev->ci_range.vci_bits = 16; + g_atm_priv_data.port[port_num].dev->link_rate = g_atm_priv_data.port[port_num].tx_max_cell_rate; + g_atm_priv_data.port[port_num].dev->dev_data = (void*)port_num; + } + } + + /* register interrupt handler */ + ret = request_irq(PPE_MAILBOX_IGU1_INT, mailbox_irq_handler, IRQF_DISABLED, "atm_mailbox_isr", &g_atm_priv_data); + if ( ret ) { + if ( ret == -EBUSY ) { + err("IRQ may be occupied by other driver, please reconfig to disable it."); + } + else { + err("request_irq fail"); + } + goto REQUEST_IRQ_PPE_MAILBOX_IGU1_INT_FAIL; + } + disable_irq(PPE_MAILBOX_IGU1_INT); + + ret = ifx_pp32_start(0); + if ( ret ) { + err("ifx_pp32_start fail!"); + goto PP32_START_FAIL; + } + + port_cell.port_num = ATM_PORT_NUMBER; + ifx_mei_atm_showtime_check(&g_showtime, &port_cell, &g_xdata_addr); + if ( g_showtime ) { + for ( i = 0; i < ATM_PORT_NUMBER; i++ ) + if ( port_cell.tx_link_rate[i] != 0 ) + break; + for ( j = 0; j < ATM_PORT_NUMBER; j++ ) + g_atm_priv_data.port[j].tx_max_cell_rate = port_cell.tx_link_rate[j] != 0 ? port_cell.tx_link_rate[j] : port_cell.tx_link_rate[i]; + } + + qsb_global_set(); + validate_oam_htu_entry(); + + /* create proc file */ + proc_file_create(); + + ifx_mei_atm_showtime_enter = atm_showtime_enter; + ifx_mei_atm_showtime_exit = atm_showtime_exit; + + ifx_atm_version(ver_str); + printk(KERN_INFO "%s", ver_str); + + printk("ifxmips_atm: ATM init succeed\n"); + + return IFX_SUCCESS; + +PP32_START_FAIL: + free_irq(PPE_MAILBOX_IGU1_INT, &g_atm_priv_data); +REQUEST_IRQ_PPE_MAILBOX_IGU1_INT_FAIL: +ATM_DEV_REGISTER_FAIL: + while ( port_num-- > 0 ) + atm_dev_deregister(g_atm_priv_data.port[port_num].dev); +INIT_PRIV_DATA_FAIL: + clear_priv_data(); + printk("ifxmips_atm: ATM init failed\n"); + return ret; +} + +/* + * Description: + * Release memory, free IRQ, and deregister device. + * Input: + * none + * Output: + * none + */ +static void __exit ifx_atm_exit(void) +{ + int port_num; + + ifx_mei_atm_showtime_enter = NULL; + ifx_mei_atm_showtime_exit = NULL; + + proc_file_delete(); + + invalidate_oam_htu_entry(); + + ifx_pp32_stop(0); + + free_irq(PPE_MAILBOX_IGU1_INT, &g_atm_priv_data); + + for ( port_num = 0; port_num < ATM_PORT_NUMBER; port_num++ ) + atm_dev_deregister(g_atm_priv_data.port[port_num].dev); + + ifx_atm_uninit_chip(); + + clear_priv_data(); +} + +module_init(ifx_atm_init); +module_exit(ifx_atm_exit); diff --git a/package/ifxmips-dsl-api/src/ifxmips_atm_core.h b/package/ifxmips-dsl-api/src/ifxmips_atm_core.h new file mode 100644 index 000000000..f7774fbf1 --- /dev/null +++ b/package/ifxmips-dsl-api/src/ifxmips_atm_core.h @@ -0,0 +1,249 @@ +/****************************************************************************** +** +** FILE NAME : ifxmips_atm_core.h +** PROJECT : UEIP +** MODULES : ATM +** +** DATE : 7 Jul 2009 +** AUTHOR : Xu Liang +** DESCRIPTION : ATM driver header file (core functions) +** COPYRIGHT : Copyright (c) 2006 +** Infineon Technologies AG +** Am Campeon 1-12, 85579 Neubiberg, Germany +** +** 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 of the License, or +** (at your option) any later version. +** +** HISTORY +** $Date $Author $Comment +** 17 JUN 2009 Xu Liang Init Version +*******************************************************************************/ + +#ifndef IFXMIPS_ATM_CORE_H +#define IFXMIPS_ATM_CORE_H + + + +#include +#include "ifxmips_atm_ppe_common.h" +#include "ifxmips_atm_fw_regs_common.h" + + + +/* + * #################################### + * Definition + * #################################### + */ + +/* + * Compile Options + */ + +#define ENABLE_DEBUG 1 + +#define ENABLE_ASSERT 1 + +#define INLINE + +#define DEBUG_DUMP_SKB 1 + +#define DEBUG_QOS 1 + +#define ENABLE_DBG_PROC 1 + +#define ENABLE_FW_PROC 1 + +#ifdef CONFIG_IFX_ATM_TASKLET + #define ENABLE_TASKLET 1 +#endif + + +/* + * Debug/Assert/Error Message + */ + +#define DBG_ENABLE_MASK_ERR (1 << 0) +#define DBG_ENABLE_MASK_DEBUG_PRINT (1 << 1) +#define DBG_ENABLE_MASK_ASSERT (1 << 2) +#define DBG_ENABLE_MASK_DUMP_SKB_RX (1 << 8) +#define DBG_ENABLE_MASK_DUMP_SKB_TX (1 << 9) +#define DBG_ENABLE_MASK_DUMP_QOS (1 << 10) +#define DBG_ENABLE_MASK_DUMP_INIT (1 << 11) +#define DBG_ENABLE_MASK_ALL (DBG_ENABLE_MASK_ERR | DBG_ENABLE_MASK_DEBUG_PRINT | DBG_ENABLE_MASK_ASSERT | DBG_ENABLE_MASK_DUMP_SKB_RX | DBG_ENABLE_MASK_DUMP_SKB_TX | DBG_ENABLE_MASK_DUMP_QOS | DBG_ENABLE_MASK_DUMP_INIT) + +#define err(format, arg...) do { if ( (ifx_atm_dbg_enable & DBG_ENABLE_MASK_ERR) ) printk(KERN_ERR __FILE__ ":%d:%s: " format "\n", __LINE__, __FUNCTION__, ##arg); } while ( 0 ) + +#if defined(ENABLE_DEBUG) && ENABLE_DEBUG + #undef dbg + #define dbg(format, arg...) do { if ( (ifx_atm_dbg_enable & DBG_ENABLE_MASK_DEBUG_PRINT) ) printk(KERN_WARNING __FILE__ ":%d:%s: " format "\n", __LINE__, __FUNCTION__, ##arg); } while ( 0 ) +#else + #if !defined(dbg) + #define dbg(format, arg...) + #endif +#endif + +#if defined(ENABLE_ASSERT) && ENABLE_ASSERT + #define ASSERT(cond, format, arg...) do { if ( (ifx_atm_dbg_enable & DBG_ENABLE_MASK_ASSERT) && !(cond) ) printk(KERN_ERR __FILE__ ":%d:%s: " format "\n", __LINE__, __FUNCTION__, ##arg); } while ( 0 ) +#else + #define ASSERT(cond, format, arg...) +#endif + + +/* + * Constants + */ +#define DEFAULT_TX_LINK_RATE 3200 // in cells + +/* + * ATM Port, QSB Queue, DMA RX/TX Channel Parameters + */ +#define ATM_PORT_NUMBER 2 +#define MAX_QUEUE_NUMBER 16 +#define OAM_RX_QUEUE 15 +#define QSB_RESERVE_TX_QUEUE 0 +#define FIRST_QSB_QID 1 +#define MAX_PVC_NUMBER (MAX_QUEUE_NUMBER - FIRST_QSB_QID) +#define MAX_RX_DMA_CHANNEL_NUMBER 8 +#define MAX_TX_DMA_CHANNEL_NUMBER 16 +#define DATA_BUFFER_ALIGNMENT EMA_ALIGNMENT +#define DESC_ALIGNMENT 8 +#define DEFAULT_RX_HUNT_BITTH 4 + +/* + * RX DMA Channel Allocation + */ +#define RX_DMA_CH_OAM 0 +#define RX_DMA_CH_AAL 1 +#define RX_DMA_CH_TOTAL 2 +#define RX_DMA_CH_OAM_DESC_LEN 32 +#define RX_DMA_CH_OAM_BUF_SIZE (CELL_SIZE & ~15) +#define RX_DMA_CH_AAL_BUF_SIZE (2048 - 48) + +/* + * OAM Constants + */ +#define OAM_HTU_ENTRY_NUMBER 3 +#define OAM_F4_SEG_HTU_ENTRY 0 +#define OAM_F4_TOT_HTU_ENTRY 1 +#define OAM_F5_HTU_ENTRY 2 +#define OAM_F4_CELL_ID 0 +#define OAM_F5_CELL_ID 15 +//#if defined(ENABLE_ATM_RETX) && ENABLE_ATM_RETX +// #undef OAM_HTU_ENTRY_NUMBER +// #define OAM_HTU_ENTRY_NUMBER 4 +// #define OAM_ARQ_HTU_ENTRY 3 +//#endif + +/* + * RX Frame Definitions + */ +#define MAX_RX_PACKET_ALIGN_BYTES 3 +#define MAX_RX_PACKET_PADDING_BYTES 3 +#define RX_INBAND_TRAILER_LENGTH 8 +#define MAX_RX_FRAME_EXTRA_BYTES (RX_INBAND_TRAILER_LENGTH + MAX_RX_PACKET_ALIGN_BYTES + MAX_RX_PACKET_PADDING_BYTES) + +/* + * TX Frame Definitions + */ +#define MAX_TX_HEADER_ALIGN_BYTES 12 +#define MAX_TX_PACKET_ALIGN_BYTES 3 +#define MAX_TX_PACKET_PADDING_BYTES 3 +#define TX_INBAND_HEADER_LENGTH 8 +#define MAX_TX_FRAME_EXTRA_BYTES (TX_INBAND_HEADER_LENGTH + MAX_TX_HEADER_ALIGN_BYTES + MAX_TX_PACKET_ALIGN_BYTES + MAX_TX_PACKET_PADDING_BYTES) + +/* + * Cell Constant + */ +#define CELL_SIZE ATM_AAL0_SDU + + + +/* + * #################################### + * Data Type + * #################################### + */ + +typedef struct { + unsigned int h; + unsigned int l; +} ppe_u64_t; + +struct port { + unsigned int tx_max_cell_rate; + unsigned int tx_current_cell_rate; + + struct atm_dev *dev; +}; + +struct connection { + struct atm_vcc *vcc; + + volatile struct tx_descriptor + *tx_desc; + unsigned int tx_desc_pos; + struct sk_buff **tx_skb; + + unsigned int aal5_vcc_crc_err; /* number of packets with CRC error */ + unsigned int aal5_vcc_oversize_sdu; /* number of packets with oversize error */ + + unsigned int port; +}; + +struct atm_priv_data { + unsigned long conn_table; + struct connection conn[MAX_PVC_NUMBER]; + + volatile struct rx_descriptor + *aal_desc; + unsigned int aal_desc_pos; + + volatile struct rx_descriptor + *oam_desc; + unsigned char *oam_buf; + unsigned int oam_desc_pos; + + struct port port[ATM_PORT_NUMBER]; + + unsigned int wrx_pdu; /* successfully received AAL5 packet */ + unsigned int wrx_drop_pdu; /* AAL5 packet dropped by driver on RX */ + unsigned int wtx_pdu; /* successfully tranmitted AAL5 packet */ + unsigned int wtx_err_pdu; /* error AAL5 packet */ + unsigned int wtx_drop_pdu; /* AAL5 packet dropped by driver on TX */ + + ppe_u64_t wrx_total_byte; + ppe_u64_t wtx_total_byte; + unsigned int prev_wrx_total_byte; + unsigned int prev_wtx_total_byte; + + void *aal_desc_base; + void *oam_desc_base; + void *oam_buf_base; + void *tx_desc_base; + void *tx_skb_base; +}; + + + +/* + * #################################### + * Declaration + * #################################### + */ + +extern unsigned int ifx_atm_dbg_enable; + +extern void ifx_atm_get_fw_ver(unsigned int *major, unsigned int *minor); + +extern void ifx_atm_init_chip(void); +extern void ifx_atm_uninit_chip(void); + +extern int ifx_pp32_start(int pp32); +extern void ifx_pp32_stop(int pp32); + + + +#endif // IFXMIPS_ATM_CORE_H diff --git a/package/ifxmips-dsl-api/src/ifxmips_atm_danube.c b/package/ifxmips-dsl-api/src/ifxmips_atm_danube.c new file mode 100644 index 000000000..5768678bf --- /dev/null +++ b/package/ifxmips-dsl-api/src/ifxmips_atm_danube.c @@ -0,0 +1,272 @@ +/****************************************************************************** +** +** FILE NAME : ifxmips_atm_danube.c +** PROJECT : UEIP +** MODULES : ATM +** +** DATE : 7 Jul 2009 +** AUTHOR : Xu Liang +** DESCRIPTION : ATM driver common source file (core functions) +** COPYRIGHT : Copyright (c) 2006 +** Infineon Technologies AG +** Am Campeon 1-12, 85579 Neubiberg, Germany +** +** 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 of the License, or +** (at your option) any later version. +** +** HISTORY +** $Date $Author $Comment +** 07 JUL 2009 Xu Liang Init Version +*******************************************************************************/ + + + +/* + * #################################### + * Head File + * #################################### + */ + +/* + * Common Head File + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Chip Specific Head File + */ +#include +#include +#include +#include +#include "ifxmips_atm_core.h" +#include "ifxmips_atm_fw_danube.h" + + + +/* + * #################################### + * Definition + * #################################### + */ + +/* + * EMA Settings + */ +#define EMA_CMD_BUF_LEN 0x0040 +#define EMA_CMD_BASE_ADDR (0x00001580 << 2) +#define EMA_DATA_BUF_LEN 0x0100 +#define EMA_DATA_BASE_ADDR (0x00001900 << 2) +#define EMA_WRITE_BURST 0x2 +#define EMA_READ_BURST 0x2 + + + +/* + * #################################### + * Declaration + * #################################### + */ + +/* + * Hardware Init/Uninit Functions + */ +static inline void init_pmu(void); +static inline void uninit_pmu(void); +static inline void init_ema(void); +static inline void init_mailbox(void); +static inline void init_atm_tc(void); +static inline void clear_share_buffer(void); + + + +/* + * #################################### + * Local Variable + * #################################### + */ + + + +/* + * #################################### + * Local Function + * #################################### + */ + +static inline void init_pmu(void) +{ + //*(unsigned long *)0xBF10201C &= ~((1 << 15) | (1 << 13) | (1 << 9)); + PPE_TOP_PMU_SETUP(IFX_PMU_ENABLE); + PPE_SLL01_PMU_SETUP(IFX_PMU_ENABLE); + PPE_TC_PMU_SETUP(IFX_PMU_ENABLE); + PPE_EMA_PMU_SETUP(IFX_PMU_ENABLE); + PPE_QSB_PMU_SETUP(IFX_PMU_ENABLE); + PPE_TPE_PMU_SETUP(IFX_PMU_ENABLE); + DSL_DFE_PMU_SETUP(IFX_PMU_ENABLE); +} + +static inline void uninit_pmu(void) +{ + PPE_SLL01_PMU_SETUP(IFX_PMU_DISABLE); + PPE_TC_PMU_SETUP(IFX_PMU_DISABLE); + PPE_EMA_PMU_SETUP(IFX_PMU_DISABLE); + PPE_QSB_PMU_SETUP(IFX_PMU_DISABLE); + PPE_TPE_PMU_SETUP(IFX_PMU_DISABLE); + DSL_DFE_PMU_SETUP(IFX_PMU_DISABLE); + PPE_TOP_PMU_SETUP(IFX_PMU_DISABLE); +} + +static inline void init_ema(void) +{ + IFX_REG_W32((EMA_CMD_BUF_LEN << 16) | (EMA_CMD_BASE_ADDR >> 2), EMA_CMDCFG); + IFX_REG_W32((EMA_DATA_BUF_LEN << 16) | (EMA_DATA_BASE_ADDR >> 2), EMA_DATACFG); + IFX_REG_W32(0x000000FF, EMA_IER); + IFX_REG_W32(EMA_READ_BURST | (EMA_WRITE_BURST << 2), EMA_CFG); +} + +static inline void init_mailbox(void) +{ + IFX_REG_W32(0xFFFFFFFF, MBOX_IGU1_ISRC); + IFX_REG_W32(0x00000000, MBOX_IGU1_IER); + IFX_REG_W32(0xFFFFFFFF, MBOX_IGU3_ISRC); + IFX_REG_W32(0x00000000, MBOX_IGU3_IER); +} + +static inline void init_atm_tc(void) +{ + // for ReTX expansion in future + //*FFSM_CFG0 = SET_BITS(*FFSM_CFG0, 5, 0, 6); // pnum = 6 + //*FFSM_CFG1 = SET_BITS(*FFSM_CFG1, 5, 0, 6); // pnum = 6 +} + +static inline void clear_share_buffer(void) +{ + volatile u32 *p = SB_RAM0_ADDR(0); + unsigned int i; + + for ( i = 0; i < SB_RAM0_DWLEN + SB_RAM1_DWLEN + SB_RAM2_DWLEN + SB_RAM3_DWLEN; i++ ) + IFX_REG_W32(0, p++); +} + +/* + * Description: + * Download PPE firmware binary code. + * Input: + * src --- u32 *, binary code buffer + * dword_len --- unsigned int, binary code length in DWORD (32-bit) + * Output: + * int --- IFX_SUCCESS: Success + * else: Error Code + */ +static inline int pp32_download_code(u32 *code_src, unsigned int code_dword_len, u32 *data_src, unsigned int data_dword_len) +{ + volatile u32 *dest; + + if ( code_src == 0 || ((unsigned long)code_src & 0x03) != 0 + || data_src == 0 || ((unsigned long)data_src & 0x03) != 0 ) + return IFX_ERROR; + + if ( code_dword_len <= CDM_CODE_MEMORYn_DWLEN(0) ) + IFX_REG_W32(0x00, CDM_CFG); + else + IFX_REG_W32(0x02, CDM_CFG); + + /* copy code */ + dest = CDM_CODE_MEMORY(0, 0); + while ( code_dword_len-- > 0 ) + IFX_REG_W32(*code_src++, dest++); + + /* copy data */ + dest = CDM_DATA_MEMORY(0, 0); + while ( data_dword_len-- > 0 ) + IFX_REG_W32(*data_src++, dest++); + + return IFX_SUCCESS; +} + + + +/* + * #################################### + * Global Function + * #################################### + */ + +extern void ifx_atm_get_fw_ver(unsigned int *major, unsigned int *minor) +{ + ASSERT(major != NULL, "pointer is NULL"); + ASSERT(minor != NULL, "pointer is NULL"); + + *major = ATM_FW_VER_MAJOR; + *minor = ATM_FW_VER_MINOR; +} + +void ifx_atm_init_chip(void) +{ + init_pmu(); + + init_ema(); + + init_mailbox(); + + init_atm_tc(); + + clear_share_buffer(); +} + +void ifx_atm_uninit_chip(void) +{ + uninit_pmu(); +} + +/* + * Description: + * Initialize and start up PP32. + * Input: + * none + * Output: + * int --- IFX_SUCCESS: Success + * else: Error Code + */ +int ifx_pp32_start(int pp32) +{ + int ret; + + /* download firmware */ + ret = pp32_download_code(firmware_binary_code, sizeof(firmware_binary_code) / sizeof(*firmware_binary_code), firmware_binary_data, sizeof(firmware_binary_data) / sizeof(*firmware_binary_data)); + if ( ret != IFX_SUCCESS ) + return ret; + + /* run PP32 */ + IFX_REG_W32(DBG_CTRL_START_SET(1), PP32_DBG_CTRL); + + /* idle for a while to let PP32 init itself */ + udelay(10); + + return IFX_SUCCESS; +} + +/* + * Description: + * Halt PP32. + * Input: + * none + * Output: + * none + */ +void ifx_pp32_stop(int pp32) +{ + /* halt PP32 */ + IFX_REG_W32(DBG_CTRL_STOP_SET(1), PP32_DBG_CTRL); +} diff --git a/package/ifxmips-atm/src/ifx_ppe_fw.h b/package/ifxmips-dsl-api/src/ifxmips_atm_fw_danube.h similarity index 99% rename from package/ifxmips-atm/src/ifx_ppe_fw.h rename to package/ifxmips-dsl-api/src/ifxmips_atm_fw_danube.h index af250f3a9..c36c96845 100644 --- a/package/ifxmips-atm/src/ifx_ppe_fw.h +++ b/package/ifxmips-dsl-api/src/ifxmips_atm_fw_danube.h @@ -1,10 +1,10 @@ -#ifndef __DANUBE_PPE_FW_H__2005_08_04__12_00__ -#define __DANUBE_PPE_FW_H__2005_08_04__12_00__ +#ifndef IFXMIPS_ATM_FW_DANUBE_H +#define IFXMIPS_ATM_FW_DANUBE_H /****************************************************************************** ** -** FILE NAME : danube_ppe_fw.h +** FILE NAME : ifxmips_atm_fw_danube.h ** PROJECT : Danube ** MODULES : ATM (ADSL) ** @@ -27,7 +27,11 @@ *******************************************************************************/ -static u32 firmware_binary_code[] = { +#define ATM_FW_VER_MAJOR 0 +#define ATM_FW_VER_MINOR 1 + + +static unsigned int firmware_binary_code[] = { 0x800004A0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x8000FFC8, 0x00000000, 0x00000000, 0x00000000, 0xC1000002, 0xD90C0000, 0xC2000002, 0xDA080001, 0x80004710, 0xC2000000, 0xDA080001, 0x80003D98, @@ -418,9 +422,8 @@ static u32 firmware_binary_code[] = { 0x00000000, }; -static u32 firmware_binary_data[] = { +static unsigned int firmware_binary_data[] = { }; -#endif // __DANUBE_PPE_FW_H__2005_08_04__12_00__ - +#endif // IFXMIPS_ATM_FW_DANUBE_H diff --git a/package/ifxmips-dsl-api/src/ifxmips_atm_fw_regs_common.h b/package/ifxmips-dsl-api/src/ifxmips_atm_fw_regs_common.h new file mode 100644 index 000000000..a5f59b8c4 --- /dev/null +++ b/package/ifxmips-dsl-api/src/ifxmips_atm_fw_regs_common.h @@ -0,0 +1,364 @@ +#ifndef IFXMIPS_ATM_FW_REGS_COMMON_H +#define IFXMIPS_ATM_FW_REGS_COMMON_H + + + +#if defined(CONFIG_DANUBE) + #include "ifxmips_atm_fw_regs_danube.h" +#elif defined(CONFIG_AMAZON_SE) + #include "ifxmips_atm_fw_regs_amazon_se.h" +#elif defined(CONFIG_AR9) + #include "ifxmips_atm_fw_regs_ar9.h" +#elif defined(CONFIG_VR9) + #include "ifxmips_atm_fw_regs_vr9.h" +#else + #error Platform is not specified! +#endif + + + +/* + * PPE ATM Cell Header + */ +#if defined(__BIG_ENDIAN) + struct uni_cell_header { + unsigned int gfc :4; + unsigned int vpi :8; + unsigned int vci :16; + unsigned int pti :3; + unsigned int clp :1; + }; +#else + struct uni_cell_header { + unsigned int clp :1; + unsigned int pti :3; + unsigned int vci :16; + unsigned int vpi :8; + unsigned int gfc :4; + }; +#endif // defined(__BIG_ENDIAN) + +/* + * Inband Header and Trailer + */ +#if defined(__BIG_ENDIAN) + struct rx_inband_trailer { + /* 0 - 3h */ + unsigned int uu :8; + unsigned int cpi :8; + unsigned int stw_res1:4; + unsigned int stw_clp :1; + unsigned int stw_ec :1; + unsigned int stw_uu :1; + unsigned int stw_cpi :1; + unsigned int stw_ovz :1; + unsigned int stw_mfl :1; + unsigned int stw_usz :1; + unsigned int stw_crc :1; + unsigned int stw_il :1; + unsigned int stw_ra :1; + unsigned int stw_res2:2; + /* 4 - 7h */ + unsigned int gfc :4; + unsigned int vpi :8; + unsigned int vci :16; + unsigned int pti :3; + unsigned int clp :1; + }; + + struct tx_inband_header { + /* 0 - 3h */ + unsigned int gfc :4; + unsigned int vpi :8; + unsigned int vci :16; + unsigned int pti :3; + unsigned int clp :1; + /* 4 - 7h */ + unsigned int uu :8; + unsigned int cpi :8; + unsigned int pad :8; + unsigned int res1 :8; + }; +#else + struct rx_inband_trailer { + /* 0 - 3h */ + unsigned int stw_res2:2; + unsigned int stw_ra :1; + unsigned int stw_il :1; + unsigned int stw_crc :1; + unsigned int stw_usz :1; + unsigned int stw_mfl :1; + unsigned int stw_ovz :1; + unsigned int stw_cpi :1; + unsigned int stw_uu :1; + unsigned int stw_ec :1; + unsigned int stw_clp :1; + unsigned int stw_res1:4; + unsigned int cpi :8; + unsigned int uu :8; + /* 4 - 7h */ + unsigned int clp :1; + unsigned int pti :3; + unsigned int vci :16; + unsigned int vpi :8; + unsigned int gfc :4; + }; + + struct tx_inband_header { + /* 0 - 3h */ + unsigned int clp :1; + unsigned int pti :3; + unsigned int vci :16; + unsigned int vpi :8; + unsigned int gfc :4; + /* 4 - 7h */ + unsigned int res1 :8; + unsigned int pad :8; + unsigned int cpi :8; + unsigned int uu :8; + }; +#endif // defined(__BIG_ENDIAN) + +/* + * MIB Table Maintained by Firmware + */ +struct wan_mib_table { + u32 res1; + u32 wrx_drophtu_cell; + u32 wrx_dropdes_pdu; + u32 wrx_correct_pdu; + u32 wrx_err_pdu; + u32 wrx_dropdes_cell; + u32 wrx_correct_cell; + u32 wrx_err_cell; + u32 wrx_total_byte; + u32 res2; + u32 wtx_total_pdu; + u32 wtx_total_cell; + u32 wtx_total_byte; +}; + +/* + * Host-PPE Communication Data Structure + */ + +#if defined(__BIG_ENDIAN) + struct wrx_queue_config { + /* 0h */ + unsigned int res2 :27; + unsigned int dmach :4; + unsigned int errdp :1; + /* 1h */ + unsigned int oversize :16; + unsigned int undersize :16; + /* 2h */ + unsigned int res1 :16; + unsigned int mfs :16; + /* 3h */ + unsigned int uumask :8; + unsigned int cpimask :8; + unsigned int uuexp :8; + unsigned int cpiexp :8; + }; + + struct wtx_port_config { + unsigned int res1 :27; + unsigned int qid :4; + unsigned int qsben :1; + }; + + struct wtx_queue_config { + unsigned int res1 :25; + unsigned int sbid :1; + unsigned int res2 :3; + unsigned int type :2; + unsigned int qsben :1; + }; + + struct wrx_dma_channel_config { + /* 0h */ + unsigned int res1 :1; + unsigned int mode :2; + unsigned int rlcfg :1; + unsigned int desba :28; + /* 1h */ + unsigned int chrl :16; + unsigned int clp1th :16; + /* 2h */ + unsigned int deslen :16; + unsigned int vlddes :16; + }; + + struct wtx_dma_channel_config { + /* 0h */ + unsigned int res2 :1; + unsigned int mode :2; + unsigned int res3 :1; + unsigned int desba :28; + /* 1h */ + unsigned int res1 :32; + /* 2h */ + unsigned int deslen :16; + unsigned int vlddes :16; + }; + + struct htu_entry { + unsigned int res1 :1; + unsigned int clp :1; + unsigned int pid :2; + unsigned int vpi :8; + unsigned int vci :16; + unsigned int pti :3; + unsigned int vld :1; + }; + + struct htu_mask { + unsigned int set :1; + unsigned int clp :1; + unsigned int pid_mask :2; + unsigned int vpi_mask :8; + unsigned int vci_mask :16; + unsigned int pti_mask :3; + unsigned int clear :1; + }; + + struct htu_result { + unsigned int res1 :12; + unsigned int cellid :4; + unsigned int res2 :5; + unsigned int type :1; + unsigned int ven :1; + unsigned int res3 :5; + unsigned int qid :4; + }; + + struct rx_descriptor { + /* 0 - 3h */ + unsigned int own :1; + unsigned int c :1; + unsigned int sop :1; + unsigned int eop :1; + unsigned int res1 :3; + unsigned int byteoff :2; + unsigned int res2 :2; + unsigned int id :4; + unsigned int err :1; + unsigned int datalen :16; + /* 4 - 7h */ + unsigned int res3 :4; + unsigned int dataptr :28; + }; + + struct tx_descriptor { + /* 0 - 3h */ + unsigned int own :1; + unsigned int c :1; + unsigned int sop :1; + unsigned int eop :1; + unsigned int byteoff :5; + unsigned int res1 :5; + unsigned int iscell :1; + unsigned int clp :1; + unsigned int datalen :16; + /* 4 - 7h */ + unsigned int res2 :4; + unsigned int dataptr :28; + }; +#else + struct wrx_queue_config { + /* 0h */ + unsigned int errdp :1; + unsigned int dmach :4; + unsigned int res2 :27; + /* 1h */ + unsigned int undersize :16; + unsigned int oversize :16; + /* 2h */ + unsigned int mfs :16; + unsigned int res1 :16; + /* 3h */ + unsigned int cpiexp :8; + unsigned int uuexp :8; + unsigned int cpimask :8; + unsigned int uumask :8; + }; + + struct wtx_port_config { + unsigned int qsben :1; + unsigned int qid :4; + unsigned int res1 :27; + }; + + struct wtx_queue_config { + unsigned int qsben :1; + unsigned int type :2; + unsigned int res2 :3; + unsigned int sbid :1; + unsigned int res1 :25; + }; + + struct wrx_dma_channel_config + { + /* 0h */ + unsigned int desba :28; + unsigned int rlcfg :1; + unsigned int mode :2; + unsigned int res1 :1; + /* 1h */ + unsigned int clp1th :16; + unsigned int chrl :16; + /* 2h */ + unsigned int vlddes :16; + unsigned int deslen :16; + }; + + struct wtx_dma_channel_config { + /* 0h */ + unsigned int desba :28; + unsigned int res3 :1; + unsigned int mode :2; + unsigned int res2 :1; + /* 1h */ + unsigned int res1 :32; + /* 2h */ + unsigned int vlddes :16; + unsigned int deslen :16; + }; + + struct rx_descriptor { + /* 4 - 7h */ + unsigned int dataptr :28; + unsigned int res3 :4; + /* 0 - 3h */ + unsigned int datalen :16; + unsigned int err :1; + unsigned int id :4; + unsigned int res2 :2; + unsigned int byteoff :2; + unsigned int res1 :3; + unsigned int eop :1; + unsigned int sop :1; + unsigned int c :1; + unsigned int own :1; + }; + + struct tx_descriptor { + /* 4 - 7h */ + unsigned int dataptr :28; + unsigned int res2 :4; + /* 0 - 3h */ + unsigned int datalen :16; + unsigned int clp :1; + unsigned int iscell :1; + unsigned int res1 :5; + unsigned int byteoff :5; + unsigned int eop :1; + unsigned int sop :1; + unsigned int c :1; + unsigned int own :1; + }; +#endif // defined(__BIG_ENDIAN) + + + +#endif // IFXMIPS_ATM_FW_REGS_COMMON_H diff --git a/package/ifxmips-dsl-api/src/ifxmips_atm_fw_regs_danube.h b/package/ifxmips-dsl-api/src/ifxmips_atm_fw_regs_danube.h new file mode 100644 index 000000000..c0dfc6a2e --- /dev/null +++ b/package/ifxmips-dsl-api/src/ifxmips_atm_fw_regs_danube.h @@ -0,0 +1,30 @@ +#ifndef IFXMIPS_ATM_FW_REGS_DANUBE_H +#define IFXMIPS_ATM_FW_REGS_DANUBE_H + + + +/* + * Host-PPE Communication Data Address Mapping + */ +#define FW_VER_ID SB_BUFFER(0x2001) +#define CFG_WRX_HTUTS SB_BUFFER(0x2400) /* WAN RX HTU Table Size, must be configured before enable PPE firmware. */ +#define CFG_WRX_QNUM SB_BUFFER(0x2401) /* WAN RX Queue Number */ +#define CFG_WRX_DCHNUM SB_BUFFER(0x2402) /* WAN RX DMA Channel Number, no more than 8, must be configured before enable PPE firmware. */ +#define CFG_WTX_DCHNUM SB_BUFFER(0x2403) /* WAN TX DMA Channel Number, no more than 16, must be configured before enable PPE firmware. */ +#define CFG_WRDES_DELAY SB_BUFFER(0x2404) /* WAN Descriptor Write Delay, must be configured before enable PPE firmware. */ +#define WRX_DMACH_ON SB_BUFFER(0x2405) /* WAN RX DMA Channel Enable, must be configured before enable PPE firmware. */ +#define WTX_DMACH_ON SB_BUFFER(0x2406) /* WAN TX DMA Channel Enable, must be configured before enable PPE firmware. */ +#define WRX_HUNT_BITTH SB_BUFFER(0x2407) /* WAN RX HUNT Threshold, must be between 2 to 8. */ +#define WRX_QUEUE_CONFIG(i) ((struct wrx_queue_config*) SB_BUFFER(0x2500 + (i) * 20)) +#define WRX_DMA_CHANNEL_CONFIG(i) ((struct wrx_dma_channel_config*) SB_BUFFER(0x2640 + (i) * 7)) +#define WTX_PORT_CONFIG(i) ((struct wtx_port_config*) SB_BUFFER(0x2440 + (i))) +#define WTX_QUEUE_CONFIG(i) ((struct wtx_queue_config*) SB_BUFFER(0x2710 + (i) * 27)) +#define WTX_DMA_CHANNEL_CONFIG(i) ((struct wtx_dma_channel_config*) SB_BUFFER(0x2711 + (i) * 27)) +#define WAN_MIB_TABLE ((struct wan_mib_table*) SB_BUFFER(0x2410)) +#define HTU_ENTRY(i) ((struct htu_entry*) SB_BUFFER(0x2000 + (i))) +#define HTU_MASK(i) ((struct htu_mask*) SB_BUFFER(0x2020 + (i))) +#define HTU_RESULT(i) ((struct htu_result*) SB_BUFFER(0x2040 + (i))) + + + +#endif // IFXMIPS_ATM_FW_REGS_DANUBE_H diff --git a/package/ifxmips-dsl-api/src/ifxmips_atm_ppe_common.h b/package/ifxmips-dsl-api/src/ifxmips_atm_ppe_common.h new file mode 100644 index 000000000..c9cb38918 --- /dev/null +++ b/package/ifxmips-dsl-api/src/ifxmips_atm_ppe_common.h @@ -0,0 +1,231 @@ +#ifndef IFXMIPS_ATM_PPE_COMMON_H +#define IFXMIPS_ATM_PPE_COMMON_H + + + +#if defined(CONFIG_DANUBE) + #include "ifxmips_atm_ppe_danube.h" +#elif defined(CONFIG_AMAZON_SE) + #include "ifxmips_atm_ppe_amazon_se.h" +#elif defined(CONFIG_AR9) + #include "ifxmips_atm_ppe_ar9.h" +#elif defined(CONFIG_VR9) + #include "ifxmips_atm_ppe_vr9.h" +#else + #error Platform is not specified! +#endif + + + +/* + * Code/Data Memory (CDM) Interface Configuration Register + */ +#define CDM_CFG PPE_REG_ADDR(0x0100) + +#define CDM_CFG_RAM1 GET_BITS(*CDM_CFG, 3, 2) +#define CDM_CFG_RAM0 (*CDM_CFG & (1 << 1)) + +#define CDM_CFG_RAM1_SET(value) SET_BITS(0, 3, 2, value) +#define CDM_CFG_RAM0_SET(value) ((value) ? (1 << 1) : 0) + +/* + * QSB Internal Cell Delay Variation Register + */ +#define QSB_ICDV QSB_CONF_REG_ADDR(0x0007) + +#define QSB_ICDV_TAU GET_BITS(*QSB_ICDV, 5, 0) + +#define QSB_ICDV_TAU_SET(value) SET_BITS(0, 5, 0, value) + +/* + * QSB Scheduler Burst Limit Register + */ +#define QSB_SBL QSB_CONF_REG_ADDR(0x0009) + +#define QSB_SBL_SBL GET_BITS(*QSB_SBL, 3, 0) + +#define QSB_SBL_SBL_SET(value) SET_BITS(0, 3, 0, value) + +/* + * QSB Configuration Register + */ +#define QSB_CFG QSB_CONF_REG_ADDR(0x000A) + +#define QSB_CFG_TSTEPC GET_BITS(*QSB_CFG, 1, 0) + +#define QSB_CFG_TSTEPC_SET(value) SET_BITS(0, 1, 0, value) + +/* + * QSB RAM Transfer Table Register + */ +#define QSB_RTM QSB_CONF_REG_ADDR(0x000B) + +#define QSB_RTM_DM (*QSB_RTM) + +#define QSB_RTM_DM_SET(value) ((value) & 0xFFFFFFFF) + +/* + * QSB RAM Transfer Data Register + */ +#define QSB_RTD QSB_CONF_REG_ADDR(0x000C) + +#define QSB_RTD_TTV (*QSB_RTD) + +#define QSB_RTD_TTV_SET(value) ((value) & 0xFFFFFFFF) + +/* + * QSB RAM Access Register + */ +#define QSB_RAMAC QSB_CONF_REG_ADDR(0x000D) + +#define QSB_RAMAC_RW (*QSB_RAMAC & (1 << 31)) +#define QSB_RAMAC_TSEL GET_BITS(*QSB_RAMAC, 27, 24) +#define QSB_RAMAC_LH (*QSB_RAMAC & (1 << 16)) +#define QSB_RAMAC_TESEL GET_BITS(*QSB_RAMAC, 9, 0) + +#define QSB_RAMAC_RW_SET(value) ((value) ? (1 << 31) : 0) +#define QSB_RAMAC_TSEL_SET(value) SET_BITS(0, 27, 24, value) +#define QSB_RAMAC_LH_SET(value) ((value) ? (1 << 16) : 0) +#define QSB_RAMAC_TESEL_SET(value) SET_BITS(0, 9, 0, value) + +/* + * QSB Queue Scheduling and Shaping Definitions + */ +#define QSB_WFQ_NONUBR_MAX 0x3f00 +#define QSB_WFQ_UBR_BYPASS 0x3fff +#define QSB_TP_TS_MAX 65472 +#define QSB_TAUS_MAX 64512 +#define QSB_GCR_MIN 18 + +/* + * QSB Constant + */ +#define QSB_RAMAC_RW_READ 0 +#define QSB_RAMAC_RW_WRITE 1 + +#define QSB_RAMAC_TSEL_QPT 0x01 +#define QSB_RAMAC_TSEL_SCT 0x02 +#define QSB_RAMAC_TSEL_SPT 0x03 +#define QSB_RAMAC_TSEL_VBR 0x08 + +#define QSB_RAMAC_LH_LOW 0 +#define QSB_RAMAC_LH_HIGH 1 + +#define QSB_QPT_SET_MASK 0x0 +#define QSB_QVPT_SET_MASK 0x0 +#define QSB_SET_SCT_MASK 0x0 +#define QSB_SET_SPT_MASK 0x0 +#define QSB_SET_SPT_SBVALID_MASK 0x7FFFFFFF + +#define QSB_SPT_SBV_VALID (1 << 31) +#define QSB_SPT_PN_SET(value) (((value) & 0x01) ? (1 << 16) : 0) +#define QSB_SPT_INTRATE_SET(value) SET_BITS(0, 13, 0, value) + +/* + * QSB Queue Parameter Table Entry and Queue VBR Parameter Table Entry + */ +#if defined(__BIG_ENDIAN) + union qsb_queue_parameter_table { + struct { + unsigned int res1 :1; + unsigned int vbr :1; + unsigned int wfqf :14; + unsigned int tp :16; + } bit; + u32 dword; + }; + + union qsb_queue_vbr_parameter_table { + struct { + unsigned int taus :16; + unsigned int ts :16; + } bit; + u32 dword; + }; +#else + union qsb_queue_parameter_table { + struct { + unsigned int tp :16; + unsigned int wfqf :14; + unsigned int vbr :1; + unsigned int res1 :1; + } bit; + u32 dword; + }; + + union qsb_queue_vbr_parameter_table { + struct { + unsigned int ts :16; + unsigned int taus :16; + } bit; + u32 dword; + }; +#endif // defined(__BIG_ENDIAN) + +/* + * Mailbox IGU0 Registers + */ +#define MBOX_IGU0_ISRS PPE_REG_ADDR(0x0200) +#define MBOX_IGU0_ISRC PPE_REG_ADDR(0x0201) +#define MBOX_IGU0_ISR PPE_REG_ADDR(0x0202) +#define MBOX_IGU0_IER PPE_REG_ADDR(0x0203) + +#define MBOX_IGU0_ISRS_SET(n) (1 << (n)) +#define MBOX_IGU0_ISRC_CLEAR(n) (1 << (n)) +#define MBOX_IGU0_ISR_ISR(n) (*MBOX_IGU0_ISR & (1 << (n))) +#define MBOX_IGU0_IER_EN(n) (*MBOX_IGU0_IER & (1 << (n))) +#define MBOX_IGU0_IER_EN_SET(n) (1 << (n)) + +/* + * Mailbox IGU1 Registers + */ +#define MBOX_IGU1_ISRS PPE_REG_ADDR(0x0204) +#define MBOX_IGU1_ISRC PPE_REG_ADDR(0x0205) +#define MBOX_IGU1_ISR PPE_REG_ADDR(0x0206) +#define MBOX_IGU1_IER PPE_REG_ADDR(0x0207) + +#define MBOX_IGU1_ISRS_SET(n) (1 << (n)) +#define MBOX_IGU1_ISRC_CLEAR(n) (1 << (n)) +#define MBOX_IGU1_ISR_ISR(n) (*MBOX_IGU1_ISR & (1 << (n))) +#define MBOX_IGU1_IER_EN(n) (*MBOX_IGU1_IER & (1 << (n))) +#define MBOX_IGU1_IER_EN_SET(n) (1 << (n)) + +/* + * Mailbox IGU3 Registers + */ +#define MBOX_IGU3_ISRS PPE_REG_ADDR(0x0214) +#define MBOX_IGU3_ISRC PPE_REG_ADDR(0x0215) +#define MBOX_IGU3_ISR PPE_REG_ADDR(0x0216) +#define MBOX_IGU3_IER PPE_REG_ADDR(0x0217) + +#define MBOX_IGU3_ISRS_SET(n) (1 << (n)) +#define MBOX_IGU3_ISRC_CLEAR(n) (1 << (n)) +#define MBOX_IGU3_ISR_ISR(n) (*MBOX_IGU3_ISR & (1 << (n))) +#define MBOX_IGU3_IER_EN(n) (*MBOX_IGU3_IER & (1 << (n))) +#define MBOX_IGU3_IER_EN_SET(n) (1 << (n)) + +/* + * RTHA/TTHA Registers + */ +#define SFSM_STATE0 PPE_REG_ADDR(0x0410) +#define SFSM_STATE1 PPE_REG_ADDR(0x0411) +#define SFSM_DBA0 PPE_REG_ADDR(0x0412) +#define SFSM_DBA1 PPE_REG_ADDR(0x0413) +#define SFSM_CBA0 PPE_REG_ADDR(0x0414) +#define SFSM_CBA1 PPE_REG_ADDR(0x0415) +#define SFSM_CFG0 PPE_REG_ADDR(0x0416) +#define SFSM_CFG1 PPE_REG_ADDR(0x0417) +#define SFSM_PGCNT0 PPE_REG_ADDR(0x041C) +#define SFSM_PGCNT1 PPE_REG_ADDR(0x041D) +#define FFSM_DBA0 PPE_REG_ADDR(0x0508) +#define FFSM_DBA1 PPE_REG_ADDR(0x0509) +#define FFSM_CFG0 PPE_REG_ADDR(0x050A) +#define FFSM_CFG1 PPE_REG_ADDR(0x050B) +#define FFSM_IDLE_HEAD_BC0 PPE_REG_ADDR(0x050E) +#define FFSM_IDLE_HEAD_BC1 PPE_REG_ADDR(0x050F) +#define FFSM_PGCNT0 PPE_REG_ADDR(0x0514) +#define FFSM_PGCNT1 PPE_REG_ADDR(0x0515) + + + +#endif // IFXMIPS_ATM_PPE_COMMON_H diff --git a/package/ifxmips-dsl-api/src/ifxmips_atm_ppe_danube.h b/package/ifxmips-dsl-api/src/ifxmips_atm_ppe_danube.h new file mode 100644 index 000000000..3df4e9db0 --- /dev/null +++ b/package/ifxmips-dsl-api/src/ifxmips_atm_ppe_danube.h @@ -0,0 +1,100 @@ +#ifndef IFXMIPS_ATM_PPE_DANUBE_H +#define IFXMIPS_ATM_PPE_DANUBE_H + + + +/* + * FPI Configuration Bus Register and Memory Address Mapping + */ +#define IFX_PPE (KSEG1 | 0x1E180000) +#define PP32_DEBUG_REG_ADDR(i, x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x0000) << 2))) +#define PPM_INT_REG_ADDR(i, x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x0030) << 2))) +#define PP32_INTERNAL_RES_ADDR(i, x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x0040) << 2))) +#define CDM_CODE_MEMORY(i, x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x1000) << 2))) +#define PPE_REG_ADDR(x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x4000) << 2))) +#define CDM_DATA_MEMORY(i, x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x5000) << 2))) +#define PPM_INT_UNIT_ADDR(x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x6000) << 2))) +#define PPM_TIMER0_ADDR(x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x6100) << 2))) +#define PPM_TASK_IND_REG_ADDR(x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x6200) << 2))) +#define PPS_BRK_ADDR(x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x6300) << 2))) +#define PPM_TIMER1_ADDR(x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x6400) << 2))) +#define SB_RAM0_ADDR(x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x8000) << 2))) +#define SB_RAM1_ADDR(x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x8400) << 2))) +#define SB_RAM2_ADDR(x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x8C00) << 2))) +#define SB_RAM3_ADDR(x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0x9600) << 2))) +#define QSB_CONF_REG_ADDR(x) ((volatile unsigned int*)(IFX_PPE + (((x) + 0xC000) << 2))) + +/* + * DWORD-Length of Memory Blocks + */ +#define PP32_DEBUG_REG_DWLEN 0x0030 +#define PPM_INT_REG_DWLEN 0x0010 +#define PP32_INTERNAL_RES_DWLEN 0x00C0 +#define CDM_CODE_MEMORYn_DWLEN(n) ((n) == 0 ? 0x1000 : 0x0800) +#define PPE_REG_DWLEN 0x1000 +#define CDM_DATA_MEMORY_DWLEN CDM_CODE_MEMORYn_DWLEN(1) +#define PPM_INT_UNIT_DWLEN 0x0100 +#define PPM_TIMER0_DWLEN 0x0100 +#define PPM_TASK_IND_REG_DWLEN 0x0100 +#define PPS_BRK_DWLEN 0x0100 +#define PPM_TIMER1_DWLEN 0x0100 +#define SB_RAM0_DWLEN 0x0400 +#define SB_RAM1_DWLEN 0x0800 +#define SB_RAM2_DWLEN 0x0A00 +#define SB_RAM3_DWLEN 0x0400 +#define QSB_CONF_REG_DWLEN 0x0100 + +/* + * PP32 to FPI Address Mapping + */ +#define SB_BUFFER(__sb_addr) ((volatile unsigned int *)((((__sb_addr) >= 0x2000) && ((__sb_addr) <= 0x23FF)) ? SB_RAM0_ADDR((__sb_addr) - 0x2000) : \ + (((__sb_addr) >= 0x2400) && ((__sb_addr) <= 0x2BFF)) ? SB_RAM1_ADDR((__sb_addr) - 0x2400) : \ + (((__sb_addr) >= 0x2C00) && ((__sb_addr) <= 0x35FF)) ? SB_RAM2_ADDR((__sb_addr) - 0x2C00) : \ + (((__sb_addr) >= 0x3600) && ((__sb_addr) <= 0x39FF)) ? SB_RAM3_ADDR((__sb_addr) - 0x3600) : \ + 0)) + +/* + * PP32 Debug Control Register + */ +#define PP32_DBG_CTRL PP32_DEBUG_REG_ADDR(0, 0x0000) + +#define DBG_CTRL_START_SET(value) ((value) ? (1 << 0) : 0) +#define DBG_CTRL_STOP_SET(value) ((value) ? (1 << 1) : 0) +#define DBG_CTRL_STEP_SET(value) ((value) ? (1 << 2) : 0) + +#define PP32_HALT_STAT PP32_DEBUG_REG_ADDR(0, 0x0001) + +#define PP32_BRK_SRC PP32_DEBUG_REG_ADDR(0, 0x0002) + +#define PP32_DBG_PC_MIN(i) PP32_DEBUG_REG_ADDR(0, 0x0010 + (i)) +#define PP32_DBG_PC_MAX(i) PP32_DEBUG_REG_ADDR(0, 0x0014 + (i)) +#define PP32_DBG_DATA_MIN(i) PP32_DEBUG_REG_ADDR(0, 0x0018 + (i)) +#define PP32_DBG_DATA_MAX(i) PP32_DEBUG_REG_ADDR(0, 0x001A + (i)) +#define PP32_DBG_DATA_VAL(i) PP32_DEBUG_REG_ADDR(0, 0x001C + (i)) + +#define PP32_DBG_CUR_PC PP32_DEBUG_REG_ADDR(0, 0x0080) + +#define PP32_DBG_TASK_NO PP32_DEBUG_REG_ADDR(0, 0x0081) + +/* + * EMA Registers + */ +#define EMA_CMDCFG PPE_REG_ADDR(0x0A00) +#define EMA_DATACFG PPE_REG_ADDR(0x0A01) +#define EMA_CMDCNT PPE_REG_ADDR(0x0A02) +#define EMA_DATACNT PPE_REG_ADDR(0x0A03) +#define EMA_ISR PPE_REG_ADDR(0x0A04) +#define EMA_IER PPE_REG_ADDR(0x0A05) +#define EMA_CFG PPE_REG_ADDR(0x0A06) +#define EMA_SUBID PPE_REG_ADDR(0x0A07) + +#define EMA_ALIGNMENT 4 + +/* + * Mailbox IGU1 Interrupt + */ +#define PPE_MAILBOX_IGU1_INT INT_NUM_IM2_IRL24 + + + +#endif // IFXMIPS_ATM_PPE_DANUBE_H diff --git a/package/ifxmips-dsl-api/src/ifxmips_mei.c b/package/ifxmips-dsl-api/src/ifxmips_mei.c new file mode 100644 index 000000000..5651b9f20 --- /dev/null +++ b/package/ifxmips-dsl-api/src/ifxmips_mei.c @@ -0,0 +1,2998 @@ +/****************************************************************************** + + Copyright (c) 2009 + Infineon Technologies AG + Am Campeon 1-12; 81726 Munich, Germany + + For licensing information, see the file 'LICENSE' in the root folder of + this software module. + +******************************************************************************/ + +/*! + \defgroup AMAZON_S_MEI Amazon-S MEI Driver Module + \brief Amazon-S MEI driver module + */ + +/*! + \defgroup Internal Compile Parametere + \ingroup AMAZON_S_MEI + \brief exported functions for other driver use + */ + +/*! + \file amazon_s_mei_bsp.c + \ingroup AMAZON_S_MEI + \brief Amazon-S MEI driver file + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include +#include +#include +#define IFX_MEI_BSP +#include "ifxmips_mei_interface.h" + +#define IFXMIPS_RCU_RST IFX_RCU_RST_REQ +#define IFXMIPS_RCU_RST_REQ_ARC_JTAG IFX_RCU_RST_REQ_ARC_JTAG +#define IFXMIPS_RCU_RST_REQ_DFE IFX_RCU_RST_REQ_DFE +#define IFXMIPS_RCU_RST_REQ_AFE IFX_RCU_RST_REQ_AFE +#define IFXMIPS_FUSE_BASE_ADDR IFX_FUSE_BASE_ADDR +#define IFXMIPS_ICU_IM0_IER IFX_ICU_IM0_IER +#define IFXMIPS_ICU_IM2_IER IFX_ICU_IM2_IER +#define IFXMIPS_MEI_INT IFX_MEI_INT +#define IFXMIPS_MEI_DYING_GASP_INT IFX_MEI_DYING_GASP_INT +#define IFXMIPS_MEI_BASE_ADDR IFX_MEI_SPACE_ACCESS +#define IFXMIPS_PMU_PWDCR IFX_PMU_PWDCR +#define IFXMIPS_MPS_CHIPID IFX_MPS_CHIPID + +#define ifxmips_port_reserve_pin ifx_gpio_pin_reserve +#define ifxmips_port_set_dir_in ifx_gpio_dir_in_set +#define ifxmips_port_clear_altsel0 ifx_gpio_altsel0_set +#define ifxmips_port_clear_altsel1 ifx_gpio_altsel1_clear +#define ifxmips_port_set_open_drain ifx_gpio_open_drain_clear +#define ifxmips_port_free_pin ifx_gpio_pin_free +#define ifxmips_mask_and_ack_irq bsp_mask_and_ack_irq +#define IFXMIPS_MPS_CHIPID_VERSION_GET IFX_MCD_CHIPID_VERSION_GET +#define ifxmips_r32(reg) __raw_readl(reg) +#define ifxmips_w32(val, reg) __raw_writel(val, reg) +#define ifxmips_w32_mask(clear, set, reg) ifxmips_w32((ifxmips_r32(reg) & ~clear) | set, reg) + +#define IFX_MEI_EMSG(fmt, args...) printk(KERN_ERR "[%s %d]: " fmt,__FUNCTION__, __LINE__, ## args) +#define IFX_MEI_DMSG(fmt, args...) printk(KERN_INFO "[%s %d]: " fmt,__FUNCTION__, __LINE__, ## args) + +#ifdef CONFIG_IFXMIPS_MEI_FW_LOOPBACK +//#define DFE_MEM_TEST +//#define DFE_PING_TEST +#define DFE_ATM_LOOPBACK + +#ifdef DFE_PING_TEST +#include "dsp_xmem_arb_rand_em.h" +#endif + +#ifdef DFE_MEM_TEST +#include "aai_mem_test.h" +#endif + +#ifdef DFE_ATM_LOOPBACK +#include +#endif + +void dfe_loopback_irq_handler (DSL_DEV_Device_t *pDev); + +#endif //CONFIG_AMAZON_S_MEI_FW_LOOPBACK + +DSL_DEV_Version_t bsp_mei_version = { + major: 5, + minor: 0, + revision:0 +}; +DSL_DEV_HwVersion_t bsp_chip_info; + +#define IFX_MEI_DEVNAME "ifx_mei" +#define BSP_MAX_DEVICES 1 + +DSL_DEV_MeiError_t DSL_BSP_FWDownload (DSL_DEV_Device_t *, const char *, unsigned long, long *, long *); +DSL_DEV_MeiError_t DSL_BSP_Showtime (DSL_DEV_Device_t *, DSL_uint32_t, DSL_uint32_t); +DSL_DEV_MeiError_t DSL_BSP_AdslLedInit (DSL_DEV_Device_t *, DSL_DEV_LedId_t, DSL_DEV_LedType_t, DSL_DEV_LedHandler_t); +//DSL_DEV_MeiError_t DSL_BSP_AdslLedSet (DSL_DEV_Device_t *, DSL_DEV_LedId_t, DSL_DEV_LedMode_t); +DSL_DEV_MeiError_t DSL_BSP_MemoryDebugAccess (DSL_DEV_Device_t *, DSL_BSP_MemoryAccessType_t, DSL_uint32_t, DSL_uint32_t*, DSL_uint32_t); +DSL_DEV_MeiError_t DSL_BSP_SendCMV (DSL_DEV_Device_t *, u16 *, int, u16 *); + +int DSL_BSP_KernelIoctls (DSL_DEV_Device_t *, unsigned int, unsigned long); + +static DSL_DEV_MeiError_t IFX_MEI_RunAdslModem (DSL_DEV_Device_t *); +static DSL_DEV_MeiError_t IFX_MEI_CpuModeSet (DSL_DEV_Device_t *, DSL_DEV_CpuMode_t); +static DSL_DEV_MeiError_t IFX_MEI_DownloadBootCode (DSL_DEV_Device_t *); +static DSL_DEV_MeiError_t IFX_MEI_ArcJtagEnable (DSL_DEV_Device_t *, int); +static DSL_DEV_MeiError_t IFX_MEI_AdslMailboxIRQEnable (DSL_DEV_Device_t *, int); + +static int IFX_MEI_GetPage (DSL_DEV_Device_t *, u32, u32, u32, u32 *, u32 *); +static int IFX_MEI_BarUpdate (DSL_DEV_Device_t *, int); + +static ssize_t IFX_MEI_Write (DSL_DRV_file_t *, const char *, size_t, loff_t *); +static int IFX_MEI_UserIoctls (DSL_DRV_inode_t *, DSL_DRV_file_t *, unsigned int, unsigned long); +static int IFX_MEI_Open (DSL_DRV_inode_t *, DSL_DRV_file_t *); +static int IFX_MEI_Release (DSL_DRV_inode_t *, DSL_DRV_file_t *); + +void AMAZON_SE_MEI_ARC_MUX_Test(void); + +#ifdef CONFIG_PROC_FS +static int IFX_MEI_ProcRead (struct file *, char *, size_t, loff_t *); +static ssize_t IFX_MEI_ProcWrite (struct file *, const char *, size_t, loff_t *); + +#define PROC_ITEMS 11 +#define MEI_DIRNAME "ifxmips_mei" + +static struct proc_dir_entry *meidir; +static struct file_operations IFX_MEI_ProcOperations = { + read:IFX_MEI_ProcRead, + write:IFX_MEI_ProcWrite, +}; +static reg_entry_t regs[BSP_MAX_DEVICES][PROC_ITEMS]; //total items to be monitored by /proc/mei +#define NUM_OF_REG_ENTRY (sizeof(regs[0])/sizeof(reg_entry_t)) +#endif //CONFIG_PROC_FS + +void IFX_MEI_ARC_MUX_Test(void); + +static int adsl_dummy_ledcallback(void); + +int (*ifx_mei_atm_showtime_enter)(struct port_cell_info *, void *) = NULL; +EXPORT_SYMBOL(ifx_mei_atm_showtime_enter); + +int (*ifx_mei_atm_showtime_exit)(void) = NULL; +EXPORT_SYMBOL(ifx_mei_atm_showtime_exit); + +static int (*g_adsl_ledcallback)(void) = adsl_dummy_ledcallback; + +static unsigned int g_tx_link_rate[2] = {0}; + +static void *g_xdata_addr = NULL; + +static u32 *mei_arc_swap_buff = NULL; // holding swap pages + +extern void ifxmips_mask_and_ack_irq(unsigned int irq_nr); +#define MEI_MASK_AND_ACK_IRQ ifxmips_mask_and_ack_irq + +static int dev_major = 105; + +static struct file_operations bsp_mei_operations = { + owner:THIS_MODULE, + open:IFX_MEI_Open, + release:IFX_MEI_Release, + write:IFX_MEI_Write, + ioctl:IFX_MEI_UserIoctls, +}; + +static DSL_DEV_Device_t dsl_devices[BSP_MAX_DEVICES]; + +static ifx_mei_device_private_t + sDanube_Mei_Private[BSP_MAX_DEVICES]; + +static DSL_BSP_EventCallBack_t dsl_bsp_event_callback[DSL_BSP_CB_LAST + 1]; + +/** + * Write a value to register + * This function writes a value to danube register + * + * \param ul_address The address to write + * \param ul_data The value to write + * \ingroup Internal + */ +static void +IFX_MEI_LongWordWrite (u32 ul_address, u32 ul_data) +{ + IFX_MEI_WRITE_REGISTER_L (ul_data, ul_address); + wmb(); + return; +} + +/** + * Write a value to register + * This function writes a value to danube register + * + * \param pDev the device pointer + * \param ul_address The address to write + * \param ul_data The value to write + * \ingroup Internal + */ +static void +IFX_MEI_LongWordWriteOffset (DSL_DEV_Device_t * pDev, u32 ul_address, + u32 ul_data) +{ + IFX_MEI_WRITE_REGISTER_L (ul_data, pDev->base_address + ul_address); + wmb(); + return; +} + +/** + * Read the danube register + * This function read the value from danube register + * + * \param ul_address The address to write + * \param pul_data Pointer to the data + * \ingroup Internal + */ +static void +IFX_MEI_LongWordRead (u32 ul_address, u32 * pul_data) +{ + *pul_data = IFX_MEI_READ_REGISTER_L (ul_address); + rmb(); + return; +} + +/** + * Read the danube register + * This function read the value from danube register + * + * \param pDev the device pointer + * \param ul_address The address to write + * \param pul_data Pointer to the data + * \ingroup Internal + */ +static void +IFX_MEI_LongWordReadOffset (DSL_DEV_Device_t * pDev, u32 ul_address, + u32 * pul_data) +{ + *pul_data = IFX_MEI_READ_REGISTER_L (pDev->base_address + ul_address); + rmb(); + return; +} + +/** + * Write several DWORD datas to ARC memory via ARC DMA interface + * This function writes several DWORD datas to ARC memory via DMA interface. + * + * \param pDev the device pointer + * \param destaddr The address to write + * \param databuff Pointer to the data buffer + * \param databuffsize Number of DWORDs to write + * \return DSL_DEV_MEI_ERR_SUCCESS or DSL_DEV_MEI_ERR_FAILURE + * \ingroup Internal + */ +static DSL_DEV_MeiError_t +IFX_MEI_DMAWrite (DSL_DEV_Device_t * pDev, u32 destaddr, + u32 * databuff, u32 databuffsize) +{ + u32 *p = databuff; + u32 temp; + + if (destaddr & 3) + return DSL_DEV_MEI_ERR_FAILURE; + + // Set the write transfer address + IFX_MEI_LongWordWriteOffset (pDev, ME_DX_AD, destaddr); + + // Write the data pushed across DMA + while (databuffsize--) { + temp = *p; + if (destaddr == MEI_TO_ARC_MAILBOX) + MEI_HALF_WORD_SWAP (temp); + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_DX_DATA, temp); + p++; + } + + return DSL_DEV_MEI_ERR_SUCCESS; + +} + +/** + * Read several DWORD datas from ARC memory via ARC DMA interface + * This function reads several DWORD datas from ARC memory via DMA interface. + * + * \param pDev the device pointer + * \param srcaddr The address to read + * \param databuff Pointer to the data buffer + * \param databuffsize Number of DWORDs to read + * \return DSL_DEV_MEI_ERR_SUCCESS or DSL_DEV_MEI_ERR_FAILURE + * \ingroup Internal + */ +static DSL_DEV_MeiError_t +IFX_MEI_DMARead (DSL_DEV_Device_t * pDev, u32 srcaddr, u32 * databuff, + u32 databuffsize) +{ + u32 *p = databuff; + u32 temp; + + if (srcaddr & 3) + return DSL_DEV_MEI_ERR_FAILURE; + + // Set the read transfer address + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_DX_AD, srcaddr); + + // Read the data popped across DMA + while (databuffsize--) { + IFX_MEI_LongWordReadOffset (pDev, (u32) ME_DX_DATA, &temp); + if (databuff == (u32 *) DSL_DEV_PRIVATE(pDev)->CMV_RxMsg) // swap half word + MEI_HALF_WORD_SWAP (temp); + *p = temp; + p++; + } + + return DSL_DEV_MEI_ERR_SUCCESS; + +} + +/** + * Switch the ARC control mode + * This function switchs the ARC control mode to JTAG mode or MEI mode + * + * \param pDev the device pointer + * \param mode The mode want to switch: JTAG_MASTER_MODE or MEI_MASTER_MODE. + * \ingroup Internal + */ +static void +IFX_MEI_ControlModeSet (DSL_DEV_Device_t * pDev, int mode) +{ + u32 temp = 0x0; + + IFX_MEI_LongWordReadOffset (pDev, (u32) ME_DBG_MASTER, &temp); + switch (mode) { + case JTAG_MASTER_MODE: + temp &= ~(HOST_MSTR); + break; + case MEI_MASTER_MODE: + temp |= (HOST_MSTR); + break; + default: + IFX_MEI_EMSG ("IFX_MEI_ControlModeSet: unkonwn mode [%d]\n", mode); + return; + } + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_DBG_MASTER, temp); +} + +/** + * Disable ARC to MEI interrupt + * + * \param pDev the device pointer + * \ingroup Internal + */ +static void +IFX_MEI_IRQDisable (DSL_DEV_Device_t * pDev) +{ + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_ARC2ME_MASK, 0x0); +} + +/** + * Eable ARC to MEI interrupt + * + * \param pDev the device pointer + * \ingroup Internal + */ +static void +IFX_MEI_IRQEnable (DSL_DEV_Device_t * pDev) +{ + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_ARC2ME_MASK, MSGAV_EN); +} + +/** + * Poll for transaction complete signal + * This function polls and waits for transaction complete signal. + * + * \param pDev the device pointer + * \ingroup Internal + */ +static void +meiPollForDbgDone (DSL_DEV_Device_t * pDev) +{ + u32 query = 0; + int i = 0; + + while (i < WHILE_DELAY) { + IFX_MEI_LongWordReadOffset (pDev, (u32) ME_ARC2ME_STAT, &query); + query &= (ARC_TO_MEI_DBG_DONE); + if (query) + break; + i++; + if (i == WHILE_DELAY) { + IFX_MEI_EMSG ("PollforDbg fail!\n"); + } + } + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_ARC2ME_STAT, ARC_TO_MEI_DBG_DONE); // to clear this interrupt +} + +/** + * ARC Debug Memory Access for a single DWORD reading. + * This function used for direct, address-based access to ARC memory. + * + * \param pDev the device pointer + * \param DEC_mode ARC memory space to used + * \param address Address to read + * \param data Pointer to data + * \return DSL_DEV_MEI_ERR_SUCCESS or DSL_DEV_MEI_ERR_FAILURE + * \ingroup Internal + */ +static DSL_DEV_MeiError_t +_IFX_MEI_DBGLongWordRead (DSL_DEV_Device_t * pDev, u32 DEC_mode, + u32 address, u32 * data) +{ + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_DBG_DECODE, DEC_mode); + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_DBG_RD_AD, address); + meiPollForDbgDone (pDev); + IFX_MEI_LongWordReadOffset (pDev, (u32) ME_DBG_DATA, data); + return DSL_DEV_MEI_ERR_SUCCESS; +} + +/** + * ARC Debug Memory Access for a single DWORD writing. + * This function used for direct, address-based access to ARC memory. + * + * \param pDev the device pointer + * \param DEC_mode ARC memory space to used + * \param address The address to write + * \param data The data to write + * \return DSL_DEV_MEI_ERR_SUCCESS or DSL_DEV_MEI_ERR_FAILURE + * \ingroup Internal + */ +static DSL_DEV_MeiError_t +_IFX_MEI_DBGLongWordWrite (DSL_DEV_Device_t * pDev, u32 DEC_mode, + u32 address, u32 data) +{ + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_DBG_DECODE, DEC_mode); + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_DBG_WR_AD, address); + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_DBG_DATA, data); + meiPollForDbgDone (pDev); + return DSL_DEV_MEI_ERR_SUCCESS; +} + +/** + * ARC Debug Memory Access for writing. + * This function used for direct, address-based access to ARC memory. + * + * \param pDev the device pointer + * \param destaddr The address to read + * \param databuffer Pointer to data + * \param databuffsize The number of DWORDs to read + * \return DSL_DEV_MEI_ERR_SUCCESS or DSL_DEV_MEI_ERR_FAILURE + * \ingroup Internal + */ + +static DSL_DEV_MeiError_t +IFX_MEI_DebugWrite (DSL_DEV_Device_t * pDev, u32 destaddr, + u32 * databuff, u32 databuffsize) +{ + u32 i; + u32 temp = 0x0; + u32 address = 0x0; + u32 *buffer = 0x0; + + // Open the debug port before DMP memory write + IFX_MEI_ControlModeSet (pDev, MEI_MASTER_MODE); + + // For the requested length, write the address and write the data + address = destaddr; + buffer = databuff; + for (i = 0; i < databuffsize; i++) { + temp = *buffer; + _IFX_MEI_DBGLongWordWrite (pDev, ME_DBG_DECODE_DMP1_MASK, address, temp); + address += 4; + buffer++; + } + + // Close the debug port after DMP memory write + IFX_MEI_ControlModeSet (pDev, JTAG_MASTER_MODE); + + return DSL_DEV_MEI_ERR_SUCCESS; +} + +/** + * ARC Debug Memory Access for reading. + * This function used for direct, address-based access to ARC memory. + * + * \param pDev the device pointer + * \param srcaddr The address to read + * \param databuffer Pointer to data + * \param databuffsize The number of DWORDs to read + * \return DSL_DEV_MEI_ERR_SUCCESS or DSL_DEV_MEI_ERR_FAILURE + * \ingroup Internal + */ +static DSL_DEV_MeiError_t +IFX_MEI_DebugRead (DSL_DEV_Device_t * pDev, u32 srcaddr, u32 * databuff, u32 databuffsize) +{ + u32 i; + u32 temp = 0x0; + u32 address = 0x0; + u32 *buffer = 0x0; + + // Open the debug port before DMP memory read + IFX_MEI_ControlModeSet (pDev, MEI_MASTER_MODE); + + // For the requested length, write the address and read the data + address = srcaddr; + buffer = databuff; + for (i = 0; i < databuffsize; i++) { + _IFX_MEI_DBGLongWordRead (pDev, ME_DBG_DECODE_DMP1_MASK, address, &temp); + *buffer = temp; + address += 4; + buffer++; + } + + // Close the debug port after DMP memory read + IFX_MEI_ControlModeSet (pDev, JTAG_MASTER_MODE); + + return DSL_DEV_MEI_ERR_SUCCESS; +} + +/** + * Send a message to ARC MailBox. + * This function sends a message to ARC Mailbox via ARC DMA interface. + * + * \param pDev the device pointer + * \param msgsrcbuffer Pointer to message. + * \param msgsize The number of words to write. + * \return DSL_DEV_MEI_ERR_SUCCESS or DSL_DEV_MEI_ERR_FAILURE + * \ingroup Internal + */ +static DSL_DEV_MeiError_t +IFX_MEI_MailboxWrite (DSL_DEV_Device_t * pDev, u16 * msgsrcbuffer, + u16 msgsize) +{ + int i; + u32 arc_mailbox_status = 0x0; + u32 temp = 0; + DSL_DEV_MeiError_t meiMailboxError = DSL_DEV_MEI_ERR_SUCCESS; + + // Write to mailbox + meiMailboxError = + IFX_MEI_DMAWrite (pDev, MEI_TO_ARC_MAILBOX, (u32 *) msgsrcbuffer, msgsize / 2); + meiMailboxError = + IFX_MEI_DMAWrite (pDev, MEI_TO_ARC_MAILBOXR, (u32 *) (&temp), 1); + + // Notify arc that mailbox write completed + DSL_DEV_PRIVATE(pDev)->cmv_waiting = 1; + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_ME2ARC_INT, MEI_TO_ARC_MSGAV); + + i = 0; + while (i < WHILE_DELAY) { // wait for ARC to clear the bit + IFX_MEI_LongWordReadOffset (pDev, (u32) ME_ME2ARC_INT, &arc_mailbox_status); + if ((arc_mailbox_status & MEI_TO_ARC_MSGAV) != MEI_TO_ARC_MSGAV) + break; + i++; + if (i == WHILE_DELAY) { + IFX_MEI_EMSG (">>> Timeout waiting for ARC to clear MEI_TO_ARC_MSGAV!!!" + " MEI_TO_ARC message size = %d DWORDs <<<\n", msgsize/2); + meiMailboxError = DSL_DEV_MEI_ERR_FAILURE; + } + } + + return meiMailboxError; +} + +/** + * Read a message from ARC MailBox. + * This function reads a message from ARC Mailbox via ARC DMA interface. + * + * \param pDev the device pointer + * \param msgsrcbuffer Pointer to message. + * \param msgsize The number of words to read + * \return DSL_DEV_MEI_ERR_SUCCESS or DSL_DEV_MEI_ERR_FAILURE + * \ingroup Internal + */ +static DSL_DEV_MeiError_t +IFX_MEI_MailboxRead (DSL_DEV_Device_t * pDev, u16 * msgdestbuffer, + u16 msgsize) +{ + DSL_DEV_MeiError_t meiMailboxError = DSL_DEV_MEI_ERR_SUCCESS; + // Read from mailbox + meiMailboxError = + IFX_MEI_DMARead (pDev, ARC_TO_MEI_MAILBOX, (u32 *) msgdestbuffer, msgsize / 2); + + // Notify arc that mailbox read completed + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_ARC2ME_STAT, ARC_TO_MEI_MSGAV); + + return meiMailboxError; +} + +/** + * Download boot pages to ARC. + * This function downloads boot pages to ARC. + * + * \param pDev the device pointer + * \return DSL_DEV_MEI_ERR_SUCCESS or DSL_DEV_MEI_ERR_FAILURE + * \ingroup Internal + */ +static DSL_DEV_MeiError_t +IFX_MEI_DownloadBootPages (DSL_DEV_Device_t * pDev) +{ + int boot_loop; + int page_size; + u32 dest_addr; + + /* + ** DMA the boot code page(s) + */ + + for (boot_loop = 1; + boot_loop < + (DSL_DEV_PRIVATE(pDev)->img_hdr-> count); boot_loop++) { + if ((DSL_DEV_PRIVATE(pDev)-> img_hdr->page[boot_loop].p_size) & BOOT_FLAG) { + page_size = IFX_MEI_GetPage (pDev, boot_loop, + GET_PROG, MAXSWAPSIZE, + mei_arc_swap_buff, + &dest_addr); + if (page_size > 0) { + IFX_MEI_DMAWrite (pDev, dest_addr, + mei_arc_swap_buff, + page_size); + } + } + if ((DSL_DEV_PRIVATE(pDev)-> img_hdr->page[boot_loop].d_size) & BOOT_FLAG) { + page_size = IFX_MEI_GetPage (pDev, boot_loop, + GET_DATA, MAXSWAPSIZE, + mei_arc_swap_buff, + &dest_addr); + if (page_size > 0) { + IFX_MEI_DMAWrite (pDev, dest_addr, + mei_arc_swap_buff, + page_size); + } + } + } + return DSL_DEV_MEI_ERR_SUCCESS; +} + +/** + * Initial efuse rar. + **/ +static void +IFX_MEI_FuseInit (DSL_DEV_Device_t * pDev) +{ + u32 data = 0; + IFX_MEI_DMAWrite (pDev, IRAM0_BASE, &data, 1); + IFX_MEI_DMAWrite (pDev, IRAM0_BASE + 4, &data, 1); + IFX_MEI_DMAWrite (pDev, IRAM1_BASE, &data, 1); + IFX_MEI_DMAWrite (pDev, IRAM1_BASE + 4, &data, 1); + IFX_MEI_DMAWrite (pDev, BRAM_BASE, &data, 1); + IFX_MEI_DMAWrite (pDev, BRAM_BASE + 4, &data, 1); + IFX_MEI_DMAWrite (pDev, ADSL_DILV_BASE, &data, 1); + IFX_MEI_DMAWrite (pDev, ADSL_DILV_BASE + 4, &data, 1); +} + +/** + * efuse rar program + **/ +static void +IFX_MEI_FuseProg (DSL_DEV_Device_t * pDev) +{ + u32 reg_data, fuse_value; + int i = 0; + + IFX_MEI_LongWordRead ((u32) IFXMIPS_RCU_RST, ®_data); + while ((reg_data & 0x10000000) == 0) { + IFX_MEI_LongWordRead ((u32) IFXMIPS_RCU_RST, ®_data); + i++; + /* 0x4000 translate to about 16 ms@111M, so should be enough */ + if (i == 0x4000) + return; + } + // STEP a: Prepare memory for external accesses + // Write fuse_en bit24 + IFX_MEI_LongWordRead ((u32) IFXMIPS_RCU_RST, ®_data); + IFX_MEI_LongWordWrite ((u32) IFXMIPS_RCU_RST, reg_data | (1 << 24)); + + IFX_MEI_FuseInit (pDev); + for (i = 0; i < 4; i++) { + IFX_MEI_LongWordRead ((u32) (IFXMIPS_FUSE_BASE_ADDR) + i * 4, &fuse_value); + switch (fuse_value & 0xF0000) { + case 0x80000: + reg_data = ((fuse_value & RX_DILV_ADDR_BIT_MASK) | + (RX_DILV_ADDR_BIT_MASK + 0x1)); + IFX_MEI_DMAWrite (pDev, ADSL_DILV_BASE, ®_data, 1); + break; + case 0x90000: + reg_data = ((fuse_value & RX_DILV_ADDR_BIT_MASK) | + (RX_DILV_ADDR_BIT_MASK + 0x1)); + IFX_MEI_DMAWrite (pDev, ADSL_DILV_BASE + 4, ®_data, 1); + break; + case 0xA0000: + reg_data = ((fuse_value & IRAM0_ADDR_BIT_MASK) | + (IRAM0_ADDR_BIT_MASK + 0x1)); + IFX_MEI_DMAWrite (pDev, IRAM0_BASE, ®_data, 1); + break; + case 0xB0000: + reg_data = ((fuse_value & IRAM0_ADDR_BIT_MASK) | + (IRAM0_ADDR_BIT_MASK + 0x1)); + IFX_MEI_DMAWrite (pDev, IRAM0_BASE + 4, ®_data, 1); + break; + case 0xC0000: + reg_data = ((fuse_value & IRAM1_ADDR_BIT_MASK) | + (IRAM1_ADDR_BIT_MASK + 0x1)); + IFX_MEI_DMAWrite (pDev, IRAM1_BASE, ®_data, 1); + break; + case 0xD0000: + reg_data = ((fuse_value & IRAM1_ADDR_BIT_MASK) | + (IRAM1_ADDR_BIT_MASK + 0x1)); + IFX_MEI_DMAWrite (pDev, IRAM1_BASE + 4, ®_data, 1); + break; + case 0xE0000: + reg_data = ((fuse_value & BRAM_ADDR_BIT_MASK) | + (BRAM_ADDR_BIT_MASK + 0x1)); + IFX_MEI_DMAWrite (pDev, BRAM_BASE, ®_data, 1); + break; + case 0xF0000: + reg_data = ((fuse_value & BRAM_ADDR_BIT_MASK) | + (BRAM_ADDR_BIT_MASK + 0x1)); + IFX_MEI_DMAWrite (pDev, BRAM_BASE + 4, ®_data, 1); + break; + default: // PPE efuse + break; + } + } + IFX_MEI_LongWordRead ((u32) IFXMIPS_RCU_RST, ®_data); + IFX_MEI_LongWordWrite ((u32) IFXMIPS_RCU_RST, reg_data & ~(1 << 24)); + IFX_MEI_LongWordRead ((u32) IFXMIPS_RCU_RST, ®_data); +} + +/** + * Enable DFE Clock + * This function enables DFE Clock + * + * \param pDev the device pointer + * \return DSL_DEV_MEI_ERR_SUCCESS or DSL_DEV_MEI_ERR_FAILURE + * \ingroup Internal + */ +static DSL_DEV_MeiError_t +IFX_MEI_EnableCLK (DSL_DEV_Device_t * pDev) +{ + u32 arc_debug_data = 0; + IFX_MEI_ControlModeSet (pDev, MEI_MASTER_MODE); + //enable ac_clk signal + _IFX_MEI_DBGLongWordRead (pDev, ME_DBG_DECODE_DMP1_MASK, + CRI_CCR0, &arc_debug_data); + arc_debug_data |= ACL_CLK_MODE_ENABLE; + _IFX_MEI_DBGLongWordWrite (pDev, ME_DBG_DECODE_DMP1_MASK, + CRI_CCR0, arc_debug_data); + IFX_MEI_ControlModeSet (pDev, JTAG_MASTER_MODE); + return DSL_DEV_MEI_ERR_SUCCESS; +} + +/** + * Halt the ARC. + * This function halts the ARC. + * + * \param pDev the device pointer + * \return DSL_DEV_MEI_ERR_SUCCESS or DSL_DEV_MEI_ERR_FAILURE + * \ingroup Internal + */ +static DSL_DEV_MeiError_t +IFX_MEI_HaltArc (DSL_DEV_Device_t * pDev) +{ + u32 arc_debug_data = 0x0; + + // Switch arc control from JTAG mode to MEI mode + IFX_MEI_ControlModeSet (pDev, MEI_MASTER_MODE); + _IFX_MEI_DBGLongWordRead (pDev, MEI_DEBUG_DEC_AUX_MASK, + ARC_DEBUG, &arc_debug_data); + arc_debug_data |= ARC_DEBUG_HALT; + _IFX_MEI_DBGLongWordWrite (pDev, MEI_DEBUG_DEC_AUX_MASK, + ARC_DEBUG, arc_debug_data); + // Switch arc control from MEI mode to JTAG mode + IFX_MEI_ControlModeSet (pDev, JTAG_MASTER_MODE); + + MEI_WAIT (10); + + return DSL_DEV_MEI_ERR_SUCCESS; +} + +/** + * Run the ARC. + * This function runs the ARC. + * + * \param pDev the device pointer + * \return DSL_DEV_MEI_ERR_SUCCESS or DSL_DEV_MEI_ERR_FAILURE + * \ingroup Internal + */ +static DSL_DEV_MeiError_t +IFX_MEI_RunArc (DSL_DEV_Device_t * pDev) +{ + u32 arc_debug_data = 0x0; + + // Switch arc control from JTAG mode to MEI mode- write '1' to bit0 + IFX_MEI_ControlModeSet (pDev, MEI_MASTER_MODE); + _IFX_MEI_DBGLongWordRead (pDev, MEI_DEBUG_DEC_AUX_MASK, + AUX_STATUS, &arc_debug_data); + + // Write debug data reg with content ANDd with 0xFDFFFFFF (halt bit cleared) + arc_debug_data &= ~ARC_AUX_HALT; + _IFX_MEI_DBGLongWordWrite (pDev, MEI_DEBUG_DEC_AUX_MASK, + AUX_STATUS, arc_debug_data); + + // Switch arc control from MEI mode to JTAG mode- write '0' to bit0 + IFX_MEI_ControlModeSet (pDev, JTAG_MASTER_MODE); + // Enable mask for arc codeswap interrupts + IFX_MEI_IRQEnable (pDev); + + return DSL_DEV_MEI_ERR_SUCCESS; + +} + +/** + * Reset the ARC. + * This function resets the ARC. + * + * \param pDev the device pointer + * \return DSL_DEV_MEI_ERR_SUCCESS or DSL_DEV_MEI_ERR_FAILURE + * \ingroup Internal + */ +static DSL_DEV_MeiError_t +IFX_MEI_ResetARC (DSL_DEV_Device_t * pDev) +{ + u32 arc_debug_data = 0; + + IFX_MEI_HaltArc (pDev); + + IFX_MEI_LongWordRead ((u32) IFXMIPS_RCU_RST, &arc_debug_data); + IFX_MEI_LongWordWrite ((u32) IFXMIPS_RCU_RST, + arc_debug_data | IFXMIPS_RCU_RST_REQ_DFE | IFXMIPS_RCU_RST_REQ_AFE); + + // reset ARC + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_RST_CTRL, MEI_SOFT_RESET); + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_RST_CTRL, 0); + + IFX_MEI_IRQDisable (pDev); + + IFX_MEI_EnableCLK (pDev); + +#if 0 + // reset part of PPE + *(unsigned long *) (BSP_PPE32_SRST) = 0xC30; + *(unsigned long *) (BSP_PPE32_SRST) = 0xFFF; +#endif + + DSL_DEV_PRIVATE(pDev)->modem_ready = 0; + + return DSL_DEV_MEI_ERR_SUCCESS; +} + +DSL_DEV_MeiError_t +DSL_BSP_Showtime (DSL_DEV_Device_t * dev, DSL_uint32_t rate_fast, DSL_uint32_t rate_intl) +{ + struct port_cell_info port_cell = {0}; + + IFX_MEI_EMSG ("Datarate US intl = %d, fast = %d\n", (int)rate_intl, + (int)rate_fast); + + if ( rate_fast ) + g_tx_link_rate[0] = rate_fast / (53 * 8); + if ( rate_intl ) + g_tx_link_rate[1] = rate_intl / (53 * 8); + + if ( g_tx_link_rate[0] == 0 && g_tx_link_rate[1] == 0 ) { + IFX_MEI_EMSG ("Got rate fail.\n"); + } + + if ( ifx_mei_atm_showtime_enter ) + { + port_cell.port_num = 2; + port_cell.tx_link_rate[0] = g_tx_link_rate[0]; + port_cell.tx_link_rate[1] = g_tx_link_rate[1]; + ifx_mei_atm_showtime_enter(&port_cell, g_xdata_addr); + } + else + { + IFX_MEI_EMSG("no hookup from ATM driver to set cell rate\n"); + } + + return DSL_DEV_MEI_ERR_SUCCESS; +}; + +/** + * Reset/halt/run the DFE. + * This function provide operations to reset/halt/run the DFE. + * + * \param pDev the device pointer + * \param mode which operation want to do + * \return DSL_DEV_MEI_ERR_SUCCESS or DSL_DEV_MEI_ERR_FAILURE + * \ingroup Internal + */ +static DSL_DEV_MeiError_t +IFX_MEI_CpuModeSet (DSL_DEV_Device_t *pDev, + DSL_DEV_CpuMode_t mode) +{ + DSL_DEV_MeiError_t err_ret = DSL_DEV_MEI_ERR_FAILURE; + switch (mode) { + case DSL_CPU_HALT: + err_ret = IFX_MEI_HaltArc (pDev); + break; + case DSL_CPU_RUN: + err_ret = IFX_MEI_RunArc (pDev); + break; + case DSL_CPU_RESET: + err_ret = IFX_MEI_ResetARC (pDev); + break; + default: + break; + } + return err_ret; +} + +/** + * Accress DFE memory. + * This function provide a way to access DFE memory; + * + * \param pDev the device pointer + * \param type read or write + * \param destaddr destination address + * \param databuff pointer to hold data + * \param databuffsize size want to read/write + * \return DSL_DEV_MEI_ERR_SUCCESS or DSL_DEV_MEI_ERR_FAILURE + * \ingroup Internal + */ +DSL_DEV_MeiError_t +DSL_BSP_MemoryDebugAccess (DSL_DEV_Device_t * pDev, + DSL_BSP_MemoryAccessType_t type, + DSL_uint32_t destaddr, DSL_uint32_t *databuff, + DSL_uint32_t databuffsize) +{ + DSL_DEV_MeiError_t meierr = DSL_DEV_MEI_ERR_SUCCESS; + switch (type) { + case DSL_BSP_MEMORY_READ: + meierr = IFX_MEI_DebugRead (pDev, (u32)destaddr, (u32*)databuff, (u32)databuffsize); + break; + case DSL_BSP_MEMORY_WRITE: + meierr = IFX_MEI_DebugWrite (pDev, (u32)destaddr, (u32*)databuff, (u32)databuffsize); + break; + } + return DSL_DEV_MEI_ERR_SUCCESS; +}; + +/** + * Download boot code to ARC. + * This function downloads boot code to ARC. + * + * \param pDev the device pointer + * \return DSL_DEV_MEI_ERR_SUCCESS or DSL_DEV_MEI_ERR_FAILURE + * \ingroup Internal + */ +static DSL_DEV_MeiError_t +IFX_MEI_DownloadBootCode (DSL_DEV_Device_t *pDev) +{ + IFX_MEI_IRQDisable (pDev); + + IFX_MEI_EnableCLK (pDev); + + IFX_MEI_FuseProg (pDev); //program fuse rar + + IFX_MEI_DownloadBootPages (pDev); + + return DSL_DEV_MEI_ERR_SUCCESS; +}; + +/** + * Enable Jtag debugger interface + * This function setups mips gpio to enable jtag debugger + * + * \param pDev the device pointer + * \param enable enable or disable + * \return DSL_DEV_MEI_ERR_SUCCESS or DSL_DEV_MEI_ERR_FAILURE + * \ingroup Internal + */ +static DSL_DEV_MeiError_t +IFX_MEI_ArcJtagEnable (DSL_DEV_Device_t *dev, int enable) +{ + int meierr=0; + u32 reg_data; + + switch (enable) { + case 1: + //reserve gpio 9, 10, 11, 14, 19 for ARC JTAG + ifxmips_port_reserve_pin (0, 9); + ifxmips_port_reserve_pin (0, 10); + ifxmips_port_reserve_pin (0, 11); + ifxmips_port_reserve_pin (0, 14); + ifxmips_port_reserve_pin (1, 3); + + ifxmips_port_set_dir_in(0, 11); + ifxmips_port_clear_altsel0(0, 11); + ifxmips_port_clear_altsel1(0, 11); + ifxmips_port_set_open_drain(0, 11); + //enable ARC JTAG + IFX_MEI_LongWordRead ((u32) IFXMIPS_RCU_RST, ®_data); + IFX_MEI_LongWordWrite ((u32) IFXMIPS_RCU_RST, reg_data | IFXMIPS_RCU_RST_REQ_ARC_JTAG); + break; + case 0: + default: + //reserve gpio 9, 10, 11, 14, 19 for ARC JTAG + meierr = ifxmips_port_free_pin (0, 9); + if (meierr < 0) { + IFX_MEI_EMSG ("Reserve GPIO 9 Fail.\n"); + goto jtag_end; + } + meierr = ifxmips_port_free_pin (0, 10); + if (meierr < 0) { + IFX_MEI_EMSG ("Reserve GPIO 10 Fail.\n"); + goto jtag_end; + } + meierr = ifxmips_port_free_pin (0, 11); + if (meierr < 0) { + IFX_MEI_EMSG ("Reserve GPIO 11 Fail.\n"); + goto jtag_end; + } + meierr = ifxmips_port_free_pin (0, 14); + if (meierr < 0) { + IFX_MEI_EMSG ("Reserve GPIO 14 Fail.\n"); + goto jtag_end; + } + meierr = ifxmips_port_free_pin (1, 3); + if (meierr < 0) { + IFX_MEI_EMSG ("Reserve GPIO 19 Fail.\n"); + goto jtag_end; + } + break; + } +jtag_end: + if (meierr) + return DSL_DEV_MEI_ERR_FAILURE; + + return DSL_DEV_MEI_ERR_SUCCESS; +}; + +/** + * Enable DFE to MIPS interrupt + * This function enable DFE to MIPS interrupt + * + * \param pDev the device pointer + * \param enable enable or disable + * \return DSL_DEV_MEI_ERR_SUCCESS or DSL_DEV_MEI_ERR_FAILURE + * \ingroup Internal + */ +static DSL_DEV_MeiError_t +IFX_MEI_AdslMailboxIRQEnable (DSL_DEV_Device_t *pDev, int enable) +{ + DSL_DEV_MeiError_t meierr; + switch (enable) { + case 0: + meierr = DSL_DEV_MEI_ERR_SUCCESS; + IFX_MEI_IRQDisable (pDev); + break; + case 1: + IFX_MEI_IRQEnable (pDev); + meierr = DSL_DEV_MEI_ERR_SUCCESS; + break; + default: + meierr = DSL_DEV_MEI_ERR_FAILURE; + break; + + } + return meierr; +} + +/** + * Get the modem status + * This function return the modem status + * + * \param pDev the device pointer + * \return 1: modem ready 0: not ready + * \ingroup Internal + */ +static int +IFX_MEI_IsModemReady (DSL_DEV_Device_t * pDev) +{ + return DSL_DEV_PRIVATE(pDev)->modem_ready; +} + +DSL_DEV_MeiError_t +DSL_BSP_AdslLedInit (DSL_DEV_Device_t * dev, + DSL_DEV_LedId_t led_number, + DSL_DEV_LedType_t type, + DSL_DEV_LedHandler_t handler) +{ +#if 0 + struct led_config_param param; + if (led_number == DSL_LED_LINK_ID && type == DSL_LED_LINK_TYPE && handler == /*DSL_LED_HD_CPU*/DSL_LED_HD_FW) { + param.operation_mask = CONFIG_OPERATION_UPDATE_SOURCE; + param.led = 0x01; + param.source = 0x01; +// bsp_led_config (¶m); + + } else if (led_number == DSL_LED_DATA_ID && type == DSL_LED_DATA_TYPE && (handler == DSL_LED_HD_FW)) { + param.operation_mask = CONFIG_OPERATION_UPDATE_SOURCE; + param.led = 0x02; + param.source = 0x02; +// bsp_led_config (¶m); + } +#endif + return DSL_DEV_MEI_ERR_SUCCESS; +}; +#if 0 +DSL_DEV_MeiError_t +DSL_BSP_AdslLedSet (DSL_DEV_Device_t * dev, DSL_DEV_LedId_t led_number, DSL_DEV_LedMode_t mode) +{ + printk(KERN_INFO "[%s %d]: mode = %#x, led_number = %d\n", __func__, __LINE__, mode, led_number); + switch (mode) { + case DSL_LED_OFF: + switch (led_number) { + case DSL_LED_LINK_ID: +#ifdef CONFIG_BSP_LED + bsp_led_set_blink (1, 0); + bsp_led_set_data (1, 0); +#endif + break; + case DSL_LED_DATA_ID: +#ifdef CONFIG_BSP_LED + bsp_led_set_blink (0, 0); + bsp_led_set_data (0, 0); +#endif + break; + } + break; + case DSL_LED_FLASH: + switch (led_number) { + case DSL_LED_LINK_ID: +#ifdef CONFIG_BSP_LED + bsp_led_set_blink (1, 1); // data +#endif + break; + case DSL_LED_DATA_ID: +#ifdef CONFIG_BSP_LED + bsp_led_set_blink (0, 1); // data +#endif + break; + } + break; + case DSL_LED_ON: + switch (led_number) { + case DSL_LED_LINK_ID: +#ifdef CONFIG_BSP_LED + bsp_led_set_blink (1, 0); + bsp_led_set_data (1, 1); +#endif + break; + case DSL_LED_DATA_ID: +#ifdef CONFIG_BSP_LED + bsp_led_set_blink (0, 0); + bsp_led_set_data (0, 1); +#endif + break; + } + break; + } + return DSL_DEV_MEI_ERR_SUCCESS; +}; + +#endif + +/** +* Compose a message. +* This function compose a message from opcode, group, address, index, size, and data +* +* \param opcode The message opcode +* \param group The message group number +* \param address The message address. +* \param index The message index. +* \param size The number of words to read/write. +* \param data The pointer to data. +* \param CMVMSG The pointer to message buffer. +* \ingroup Internal +*/ +void +makeCMV (u8 opcode, u8 group, u16 address, u16 index, int size, u16 * data, u16 *CMVMSG) +{ + memset (CMVMSG, 0, MSG_LENGTH * 2); + CMVMSG[0] = (opcode << 4) + (size & 0xf); + CMVMSG[1] = (((index == 0) ? 0 : 1) << 7) + (group & 0x7f); + CMVMSG[2] = address; + CMVMSG[3] = index; + if (opcode == H2D_CMV_WRITE) + memcpy (CMVMSG + 4, data, size * 2); + return; +} + +/** + * Send a message to ARC and read the response + * This function sends a message to arc, waits the response, and reads the responses. + * + * \param pDev the device pointer + * \param request Pointer to the request + * \param reply Wait reply or not. + * \param response Pointer to the response + * \return DSL_DEV_MEI_ERR_SUCCESS or DSL_DEV_MEI_ERR_FAILURE + * \ingroup Internal + */ +DSL_DEV_MeiError_t +DSL_BSP_SendCMV (DSL_DEV_Device_t * pDev, u16 * request, int reply, u16 * response) // write cmv to arc, if reply needed, wait for reply +{ + DSL_DEV_MeiError_t meierror; +#if defined(BSP_PORT_RTEMS) + int delay_counter = 0; +#endif + + if (MEI_MUTEX_LOCK (DSL_DEV_PRIVATE(pDev)->mei_cmv_sema)) + return -ERESTARTSYS; + + DSL_DEV_PRIVATE(pDev)->cmv_reply = reply; + memset (DSL_DEV_PRIVATE(pDev)->CMV_RxMsg, 0, + sizeof (DSL_DEV_PRIVATE(pDev)-> + CMV_RxMsg)); + DSL_DEV_PRIVATE(pDev)->arcmsgav = 0; + + meierror = IFX_MEI_MailboxWrite (pDev, request, MSG_LENGTH); + + if (meierror != DSL_DEV_MEI_ERR_SUCCESS) { + DSL_DEV_PRIVATE(pDev)->cmv_waiting = 0; + DSL_DEV_PRIVATE(pDev)->arcmsgav = 0; + IFX_MEI_EMSG ("MailboxWrite Fail!\n"); + IFX_MEI_EMSG ("Resetting ARC...\n"); + IFX_MEI_ResetARC(pDev); + MEI_MUTEX_UNLOCK (DSL_DEV_PRIVATE(pDev)->mei_cmv_sema); + return meierror; + } + else { + DSL_DEV_PRIVATE(pDev)->cmv_count++; + } + + if (DSL_DEV_PRIVATE(pDev)->cmv_reply == + NO_REPLY) { + MEI_MUTEX_UNLOCK (DSL_DEV_PRIVATE(pDev)->mei_cmv_sema); + return DSL_DEV_MEI_ERR_SUCCESS; + } + +#if !defined(BSP_PORT_RTEMS) + if (DSL_DEV_PRIVATE(pDev)->arcmsgav == 0) + MEI_WAIT_EVENT_TIMEOUT (DSL_DEV_PRIVATE(pDev)->wait_queue_arcmsgav, CMV_TIMEOUT); +#else + while (DSL_DEV_PRIVATE(pDev)->arcmsgav == 0 && delay_counter < CMV_TIMEOUT / 5) { + MEI_WAIT (5); + delay_counter++; + } +#endif + + DSL_DEV_PRIVATE(pDev)->cmv_waiting = 0; + if (DSL_DEV_PRIVATE(pDev)->arcmsgav == 0) { //CMV_timeout + DSL_DEV_PRIVATE(pDev)->arcmsgav = 0; + IFX_MEI_EMSG ("\%s: DSL_DEV_MEI_ERR_MAILBOX_TIMEOUT\n", + __FUNCTION__); + MEI_MUTEX_UNLOCK (DSL_DEV_PRIVATE(pDev)->mei_cmv_sema); + return DSL_DEV_MEI_ERR_MAILBOX_TIMEOUT; + } + else { + DSL_DEV_PRIVATE(pDev)->arcmsgav = 0; + DSL_DEV_PRIVATE(pDev)-> + reply_count++; + memcpy (response, DSL_DEV_PRIVATE(pDev)->CMV_RxMsg, MSG_LENGTH * 2); + MEI_MUTEX_UNLOCK (DSL_DEV_PRIVATE(pDev)->mei_cmv_sema); + return DSL_DEV_MEI_ERR_SUCCESS; + } + MEI_MUTEX_UNLOCK (DSL_DEV_PRIVATE(pDev)->mei_cmv_sema); + return DSL_DEV_MEI_ERR_SUCCESS; +} + +/** + * Reset the ARC, download boot codes, and run the ARC. + * This function resets the ARC, downloads boot codes to ARC, and runs the ARC. + * + * \param pDev the device pointer + * \return DSL_DEV_MEI_ERR_SUCCESS or DSL_DEV_MEI_ERR_FAILURE + * \ingroup Internal + */ +static DSL_DEV_MeiError_t +IFX_MEI_RunAdslModem (DSL_DEV_Device_t *pDev) +{ + int nSize = 0, idx = 0; + uint32_t im0_register, im2_register; +// DSL_DEV_WinHost_Message_t m; + + if (mei_arc_swap_buff == NULL) { + mei_arc_swap_buff = + (u32 *) kmalloc (MAXSWAPSIZE * 4, GFP_KERNEL); + if (mei_arc_swap_buff == NULL) { + IFX_MEI_EMSG (">>> malloc fail for codeswap buff!!! <<<\n"); + return DSL_DEV_MEI_ERR_FAILURE; + } + printk("allocate %dKB swap buff memory at: 0x%p\n", ksize(mei_arc_swap_buff)/1024, mei_arc_swap_buff); + } + + DSL_DEV_PRIVATE(pDev)->img_hdr = + (ARC_IMG_HDR *) DSL_DEV_PRIVATE(pDev)->adsl_mem_info[0].address; + if ((DSL_DEV_PRIVATE(pDev)->img_hdr-> + count) * sizeof (ARC_SWP_PAGE_HDR) > SDRAM_SEGMENT_SIZE) { + IFX_MEI_EMSG ("firmware header size is bigger than 64K segment size\n"); + return DSL_DEV_MEI_ERR_FAILURE; + } + // check image size + for (idx = 0; idx < MAX_BAR_REGISTERS; idx++) { + nSize += DSL_DEV_PRIVATE(pDev)->adsl_mem_info[idx].nCopy; + } + if (nSize != + DSL_DEV_PRIVATE(pDev)->image_size) { + IFX_MEI_EMSG ("Firmware download is not completed. Please download firmware again!\n"); + return DSL_DEV_MEI_ERR_FAILURE; + } + // TODO: check crc + /// + + IFX_MEI_ResetARC (pDev); + IFX_MEI_HaltArc (pDev); + IFX_MEI_BarUpdate (pDev, DSL_DEV_PRIVATE(pDev)->nBar); + + //IFX_MEI_DMSG("Starting to meiDownloadBootCode\n"); + + IFX_MEI_DownloadBootCode (pDev); + + im0_register = (*IFXMIPS_ICU_IM0_IER) & (1 << 20); + im2_register = (*IFXMIPS_ICU_IM2_IER) & (1 << 20); + /* Turn off irq */ + #ifdef CONFIG_IFXMIPS_AMAZON_SE + disable_irq (IFXMIPS_USB_OC_INT0); + disable_irq (IFXMIPS_USB_OC_INT2); + #elif defined(CONFIG_IFXMIPS_AR9) + disable_irq (IFXMIPS_USB_OC_INT0); + disable_irq (IFXMIPS_USB_OC_INT2); + #elif defined(CONFIG_IFXMIPS_DANUBE) + disable_irq (IFXMIPS_USB_OC_INT); + #endif + disable_irq (pDev->nIrq[IFX_DYING_GASP]); + + IFX_MEI_RunArc (pDev); + + MEI_WAIT_EVENT_TIMEOUT (DSL_DEV_PRIVATE(pDev)->wait_queue_modemready, 1000); + + #ifdef CONFIG_IFXMIPS_AMAZON_SE + MEI_MASK_AND_ACK_IRQ (IFXMIPS_USB_OC_INT0); + MEI_MASK_AND_ACK_IRQ (IFXMIPS_USB_OC_INT2); + #elif defined(CONFIG_IFXMIPS_AMAZON_S) + MEI_MASK_AND_ACK_IRQ (IFXMIPS_USB_OC_INT0); + MEI_MASK_AND_ACK_IRQ (IFXMIPS_USB_OC_INT2); + #elif defined(CONFIG_IFXMIPS_DANUBE) + MEI_MASK_AND_ACK_IRQ (IFXMIPS_USB_OC_INT); + #endif + MEI_MASK_AND_ACK_IRQ (pDev->nIrq[IFX_DYING_GASP]); + + /* Re-enable irq */ + enable_irq(pDev->nIrq[IFX_DYING_GASP]); + *IFXMIPS_ICU_IM0_IER |= im0_register; + *IFXMIPS_ICU_IM2_IER |= im2_register; + + if (DSL_DEV_PRIVATE(pDev)->modem_ready != 1) { + IFX_MEI_EMSG ("Modem failed to be ready!\n"); + return DSL_DEV_MEI_ERR_FAILURE; + } else { + IFX_MEI_DMSG("Modem is ready.\n"); + return DSL_DEV_MEI_ERR_SUCCESS; + } +} + +/** + * Get the page's data pointer + * This function caculats the data address from the firmware header. + * + * \param pDev the device pointer + * \param Page The page number. + * \param data Data page or program page. + * \param MaxSize The maximum size to read. + * \param Buffer Pointer to data. + * \param Dest Pointer to the destination address. + * \return The number of bytes to read. + * \ingroup Internal + */ +static int +IFX_MEI_GetPage (DSL_DEV_Device_t * pDev, u32 Page, u32 data, + u32 MaxSize, u32 * Buffer, u32 * Dest) +{ + u32 size; + u32 i; + u32 *p; + u32 idx, offset, nBar = 0; + + if (Page > DSL_DEV_PRIVATE(pDev)->img_hdr->count) + return -2; + /* + ** Get program or data size, depending on "data" flag + */ + size = (data == GET_DATA) ? (DSL_DEV_PRIVATE(pDev)->img_hdr->page[Page].d_size) : + (DSL_DEV_PRIVATE(pDev)->img_hdr->page[Page].p_size); + size &= BOOT_FLAG_MASK; // Clear boot bit! + if (size > MaxSize) + return -1; + + if (size == 0) + return 0; + /* + ** Get program or data offset, depending on "data" flag + */ + i = data ? (DSL_DEV_PRIVATE(pDev)->img_hdr->page[Page].d_offset) : + (DSL_DEV_PRIVATE(pDev)->img_hdr->page[Page].p_offset); + + /* + ** Copy data/program to buffer + */ + + idx = i / SDRAM_SEGMENT_SIZE; + offset = i % SDRAM_SEGMENT_SIZE; + p = (u32 *) ((u8 *) DSL_DEV_PRIVATE(pDev)->adsl_mem_info[idx].address + offset); + + for (i = 0; i < size; i++) { + if (offset + i * 4 - (nBar * SDRAM_SEGMENT_SIZE) >= SDRAM_SEGMENT_SIZE) { + idx++; + nBar++; + p = (u32 *) ((u8 *) KSEG1ADDR ((u32)DSL_DEV_PRIVATE(pDev)->adsl_mem_info[idx].address)); + } + Buffer[i] = *p++; + } + + /* + ** Pass back data/program destination address + */ + *Dest = data ? (DSL_DEV_PRIVATE(pDev)-> img_hdr->page[Page].d_dest) : + (DSL_DEV_PRIVATE(pDev)->img_hdr->page[Page].p_dest); + + return size; +} + +/** + * Free the memory for ARC firmware + * + * \param pDev the device pointer + * \param type Free all memory or free the unused memory after showtime + * \ingroup Internal + */ +const char *free_str[4] = {"Invalid", "Free_Reload", "Free_Showtime", "Free_All"}; +static int +IFX_MEI_DFEMemoryFree (DSL_DEV_Device_t * pDev, int type) +{ + int idx = 0; + smmu_mem_info_t *adsl_mem_info = + DSL_DEV_PRIVATE(pDev)->adsl_mem_info; + + for (idx = 0; idx < MAX_BAR_REGISTERS; idx++) { + if (type == FREE_ALL ||adsl_mem_info[idx].type == type) { + if (adsl_mem_info[idx].size > 0) { + IFX_MEI_DMSG ("Freeing memory %p (%s)\n", adsl_mem_info[idx].org_address, free_str[adsl_mem_info[idx].type]); + if ( idx == XDATA_REGISTER ) { + g_xdata_addr = NULL; + if ( ifx_mei_atm_showtime_exit ) + ifx_mei_atm_showtime_exit(); + } + kfree (adsl_mem_info[idx].org_address); + adsl_mem_info[idx].org_address = 0; + adsl_mem_info[idx].address = 0; + adsl_mem_info[idx].size = 0; + adsl_mem_info[idx].type = 0; + adsl_mem_info[idx].nCopy = 0; + } + } + } + + if(mei_arc_swap_buff != NULL){ + printk("free %dKB swap buff memory at: 0x%p\n", ksize(mei_arc_swap_buff)/1024, mei_arc_swap_buff); + kfree(mei_arc_swap_buff); + mei_arc_swap_buff=NULL; + } + + return 0; +} +static int +IFX_MEI_DFEMemoryAlloc (DSL_DEV_Device_t * pDev, long size) +{ + unsigned long mem_ptr; + char *org_mem_ptr = NULL; + int idx = 0; + long total_size = 0; + int err = 0; + smmu_mem_info_t *adsl_mem_info = + ((ifx_mei_device_private_t *) pDev->pPriv)->adsl_mem_info; +// DSL_DEV_PRIVATE(pDev)->adsl_mem_info; + int allocate_size = SDRAM_SEGMENT_SIZE; + + printk(KERN_INFO "[%s %d]: image_size = %ld\n", __func__, __LINE__, size); + // Alloc Swap Pages + for (idx = 0; size > 0 && idx < MAX_BAR_REGISTERS; idx++) { + // skip bar15 for XDATA usage. +#ifndef CONFIG_IFXMIPS_MEI_FW_LOOPBACK + if (idx == XDATA_REGISTER) + continue; +#endif +#if 0 + if (size < SDRAM_SEGMENT_SIZE) { + allocate_size = size; + if (allocate_size < 1024) + allocate_size = 1024; + } +#endif + if (idx == (MAX_BAR_REGISTERS - 1)) + allocate_size = size; + else + allocate_size = SDRAM_SEGMENT_SIZE; + org_mem_ptr = kmalloc (allocate_size + 1024, GFP_KERNEL); + if (org_mem_ptr == NULL) { + IFX_MEI_EMSG ("%d: kmalloc %d bytes memory fail!\n", idx, allocate_size); + err = -ENOMEM; + goto allocate_error; + } + mem_ptr = (unsigned long) (org_mem_ptr + 1023) & ~(1024 -1); + adsl_mem_info[idx].address = (char *) mem_ptr; + adsl_mem_info[idx].org_address = org_mem_ptr; + adsl_mem_info[idx].size = allocate_size; + size -= allocate_size; + total_size += allocate_size; + } + if (size > 0) { + IFX_MEI_EMSG ("Image size is too large!\n"); + err = -EFBIG; + goto allocate_error; + } + err = idx; + return err; + + allocate_error: + IFX_MEI_DFEMemoryFree (pDev, FREE_ALL); + return err; +} + +/** + * Program the BAR registers + * + * \param pDev the device pointer + * \param nTotalBar The number of bar to program. + * \ingroup Internal + */ +static int +IFX_MEI_BarUpdate (DSL_DEV_Device_t * pDev, int nTotalBar) +{ + int idx = 0; + smmu_mem_info_t *adsl_mem_info = + DSL_DEV_PRIVATE(pDev)->adsl_mem_info; + + for (idx = 0; idx < nTotalBar; idx++) { + //skip XDATA register + if (idx == XDATA_REGISTER) + continue; + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_XMEM_BAR_BASE + idx * 4, + (((uint32_t) adsl_mem_info[idx].address) & 0x0FFFFFFF)); + } + for (idx = nTotalBar; idx < MAX_BAR_REGISTERS; idx++) { + if (idx == XDATA_REGISTER) + continue; + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_XMEM_BAR_BASE + idx * 4, + (((uint32_t)adsl_mem_info[nTotalBar - 1].address) & 0x0FFFFFFF)); + /* These are for /proc/danube_mei/meminfo purpose */ + adsl_mem_info[idx].address = adsl_mem_info[nTotalBar - 1].address; + adsl_mem_info[idx].org_address = adsl_mem_info[nTotalBar - 1].org_address; + adsl_mem_info[idx].size = 0; /* Prevent it from being freed */ + } + + g_xdata_addr = adsl_mem_info[XDATA_REGISTER].address; + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_XMEM_BAR_BASE + XDATA_REGISTER * 4, + (((uint32_t) adsl_mem_info [XDATA_REGISTER].address) & 0x0FFFFFFF)); + // update MEI_XDATA_BASE_SH + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_XDATA_BASE_SH, + ((unsigned long)adsl_mem_info[XDATA_REGISTER].address) & 0x0FFFFFFF); + + return DSL_DEV_MEI_ERR_SUCCESS; +} + +/* This copies the firmware from secondary storage to 64k memory segment in SDRAM */ +DSL_DEV_MeiError_t +DSL_BSP_FWDownload (DSL_DEV_Device_t * pDev, const char *buf, + unsigned long size, long *loff, long *current_offset) +{ + ARC_IMG_HDR img_hdr_tmp; + smmu_mem_info_t *adsl_mem_info = DSL_DEV_PRIVATE(pDev)->adsl_mem_info; + + size_t nRead = 0, nCopy = 0; + char *mem_ptr; + ssize_t retval = -ENOMEM; + int idx = 0; + + printk("\n%s\n", __func__); + + if (*loff == 0) { + if (size < sizeof (img_hdr_tmp)) { + IFX_MEI_EMSG ("Firmware size is too small!\n"); + return retval; + } + copy_from_user ((char *) &img_hdr_tmp, buf, sizeof (img_hdr_tmp)); + // header of image_size and crc are not included. + DSL_DEV_PRIVATE(pDev)->image_size = le32_to_cpu (img_hdr_tmp.size) + 8; + + if (DSL_DEV_PRIVATE(pDev)->image_size > 1024 * 1024) { + IFX_MEI_EMSG ("Firmware size is too large!\n"); + return retval; + } + // check if arc is halt + IFX_MEI_ResetARC (pDev); + IFX_MEI_HaltArc (pDev); + + IFX_MEI_DFEMemoryFree (pDev, FREE_ALL); //free all + + retval = IFX_MEI_DFEMemoryAlloc (pDev, DSL_DEV_PRIVATE(pDev)->image_size); + if (retval < 0) { + IFX_MEI_EMSG ("Error: No memory space left.\n"); + goto error; + } + for (idx = 0; idx < retval; idx++) { + //skip XDATA register + if (idx == XDATA_REGISTER) + continue; + if (idx * SDRAM_SEGMENT_SIZE < le32_to_cpu (img_hdr_tmp.page[0].p_offset)) + adsl_mem_info[idx].type = FREE_RELOAD; + else + adsl_mem_info[idx].type = FREE_SHOWTIME; + } + DSL_DEV_PRIVATE(pDev)->nBar = retval; + + DSL_DEV_PRIVATE(pDev)->img_hdr = + (ARC_IMG_HDR *) adsl_mem_info[0].address; + + adsl_mem_info[XDATA_REGISTER].org_address = kmalloc (SDRAM_SEGMENT_SIZE + 1024, GFP_KERNEL); + adsl_mem_info[XDATA_REGISTER].address = + (char *) ((unsigned long) (adsl_mem_info[XDATA_REGISTER].org_address + 1023) & 0xFFFFFC00); + + adsl_mem_info[XDATA_REGISTER].size = SDRAM_SEGMENT_SIZE; + + if (adsl_mem_info[XDATA_REGISTER].address == NULL) { + IFX_MEI_EMSG ("kmalloc memory fail!\n"); + retval = -ENOMEM; + goto error; + } + adsl_mem_info[XDATA_REGISTER].type = FREE_RELOAD; + printk(KERN_INFO "[%s %d] -> IFX_MEI_BarUpdate()\n", __func__, __LINE__); + IFX_MEI_BarUpdate (pDev, (DSL_DEV_PRIVATE(pDev)->nBar)); + } + else if (DSL_DEV_PRIVATE(pDev)-> image_size == 0) { + IFX_MEI_EMSG ("Error: Firmware size=0! \n"); + goto error; + } + + nRead = 0; + while (nRead < size) { + long offset = ((long) (*loff) + nRead) % SDRAM_SEGMENT_SIZE; + idx = (((long) (*loff)) + nRead) / SDRAM_SEGMENT_SIZE; + mem_ptr = (char *) KSEG1ADDR ((unsigned long) (adsl_mem_info[idx].address) + offset); + if ((size - nRead + offset) > SDRAM_SEGMENT_SIZE) + nCopy = SDRAM_SEGMENT_SIZE - offset; + else + nCopy = size - nRead; + copy_from_user (mem_ptr, buf + nRead, nCopy); + for (offset = 0; offset < (nCopy / 4); offset++) { + ((unsigned long *) mem_ptr)[offset] = le32_to_cpu (((unsigned long *) mem_ptr)[offset]); + } + nRead += nCopy; + adsl_mem_info[idx].nCopy += nCopy; + } + + *loff += size; + *current_offset = size; + return DSL_DEV_MEI_ERR_SUCCESS; +error: + IFX_MEI_DFEMemoryFree (pDev, FREE_ALL); + return DSL_DEV_MEI_ERR_FAILURE; +} +/* + * Register a callback event. + * Return: + * -1 if the event already has a callback function registered. + * 0 success + */ +int DSL_BSP_EventCBRegister(DSL_BSP_EventCallBack_t *p) +{ + if (!p) { + IFX_MEI_EMSG("Invalid parameter!\n"); + return -EINVAL; + } + if (p->event > DSL_BSP_CB_LAST || p->event < DSL_BSP_CB_FIRST) { + IFX_MEI_EMSG("Invalid Event %d\n", p->event); + return -EINVAL; + } + if (dsl_bsp_event_callback[p->event].function) { + IFX_MEI_EMSG("Event %d already has a callback function registered!\n", p->event); + return -1; + } else { + dsl_bsp_event_callback[p->event].function = p->function; + dsl_bsp_event_callback[p->event].event = p->event; + dsl_bsp_event_callback[p->event].pData = p->pData; + } + return 0; +} +int DSL_BSP_EventCBUnregister(DSL_BSP_EventCallBack_t *p) +{ + if (!p) { + IFX_MEI_EMSG("Invalid parameter!\n"); + return -EINVAL; + } + if (p->event > DSL_BSP_CB_LAST || p->event < DSL_BSP_CB_FIRST) { + IFX_MEI_EMSG("Invalid Event %d\n", p->event); + return -EINVAL; + } + if (dsl_bsp_event_callback[p->event].function) { + IFX_MEI_EMSG("Unregistering Event %d...\n", p->event); + dsl_bsp_event_callback[p->event].function = NULL; + dsl_bsp_event_callback[p->event].pData = NULL; + } else { + IFX_MEI_EMSG("Event %d is not registered!\n", p->event); + return -1; + } + return 0; +} + +/** + * MEI Dying Gasp interrupt handler + * + * \param int1 + * \param void0 + * \param regs Pointer to the structure of danube mips registers + * \ingroup Internal + */ +static irqreturn_t IFX_MEI_Dying_Gasp_IrqHandle (int int1, void *void0) +{ + DSL_DEV_Device_t *pDev = (DSL_DEV_Device_t *) void0; + DSL_BSP_CB_Type_t event; + + if (pDev == NULL) + IFX_MEI_EMSG("Error: Got Interrupt but pDev is NULL!!!!\n"); + +#ifndef CONFIG_SMP + disable_irq (pDev->nIrq[IFX_DYING_GASP]); +#else + disable_irq_nosync(pDev->nIrq[IFX_DYING_GASP]); +#endif + event = DSL_BSP_CB_DYING_GASP; + + if (dsl_bsp_event_callback[event].function) + (*dsl_bsp_event_callback[event].function)(pDev, event, dsl_bsp_event_callback[event].pData); + +#ifdef CONFIG_USE_EMULATOR + IFX_MEI_EMSG("Dying Gasp! Shutting Down... (Work around for Amazon-S Venus emulator)\n"); +#else + IFX_MEI_EMSG("Dying Gasp! Shutting Down...\n"); +// kill_proc (1, SIGINT, 1); /* Ask init to reboot us */ +#endif + return IRQ_HANDLED; +} + +extern void ifx_usb_enable_afe_oc(void); + +/** + * MEI interrupt handler + * + * \param int1 + * \param void0 + * \param regs Pointer to the structure of danube mips registers + * \ingroup Internal + */ +static irqreturn_t IFX_MEI_IrqHandle (int int1, void *void0) +{ + u32 scratch; + DSL_DEV_Device_t *pDev = (DSL_DEV_Device_t *) void0; +#if defined(CONFIG_IFXMIPS_MEI_FW_LOOPBACK) && defined(DFE_PING_TEST) + dfe_loopback_irq_handler (pDev); + return IRQ_HANDLED; +#endif //CONFIG_AMAZON_S_MEI_FW_LOOPBACK + DSL_BSP_CB_Type_t event; + + if (pDev == NULL) + IFX_MEI_EMSG("Error: Got Interrupt but pDev is NULL!!!!\n"); + + IFX_MEI_DebugRead (pDev, ARC_MEI_MAILBOXR, &scratch, 1); + if (scratch & OMB_CODESWAP_MESSAGE_MSG_TYPE_MASK) { + IFX_MEI_EMSG("Receive Code Swap Request interrupt!!!\n"); + return IRQ_HANDLED; + } + else if (scratch & OMB_CLEAREOC_INTERRUPT_CODE) { + // clear eoc message interrupt + IFX_MEI_DMSG("OMB_CLEAREOC_INTERRUPT_CODE\n"); + event = DSL_BSP_CB_CEOC_IRQ; + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_ARC2ME_STAT, ARC_TO_MEI_MSGAV); + if (dsl_bsp_event_callback[event].function) + (*dsl_bsp_event_callback[event].function)(pDev, event, dsl_bsp_event_callback[event].pData); + } else if (scratch & OMB_REBOOT_INTERRUPT_CODE) { + // Reboot + IFX_MEI_DMSG("OMB_REBOOT_INTERRUPT_CODE\n"); + event = DSL_BSP_CB_FIRMWARE_REBOOT; + + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_ARC2ME_STAT, ARC_TO_MEI_MSGAV); + + if (dsl_bsp_event_callback[event].function) + (*dsl_bsp_event_callback[event].function)(pDev, event, dsl_bsp_event_callback[event].pData); + } else { // normal message + IFX_MEI_MailboxRead (pDev, DSL_DEV_PRIVATE(pDev)->CMV_RxMsg, MSG_LENGTH); + if (DSL_DEV_PRIVATE(pDev)-> cmv_waiting == 1) { + DSL_DEV_PRIVATE(pDev)-> arcmsgav = 1; + DSL_DEV_PRIVATE(pDev)-> cmv_waiting = 0; +#if !defined(BSP_PORT_RTEMS) + MEI_WAKEUP_EVENT (DSL_DEV_PRIVATE(pDev)->wait_queue_arcmsgav); +#endif + } + else { + DSL_DEV_PRIVATE(pDev)-> modem_ready_cnt++; + memcpy ((char *) DSL_DEV_PRIVATE(pDev)->Recent_indicator, + (char *) DSL_DEV_PRIVATE(pDev)->CMV_RxMsg, MSG_LENGTH * 2); + if (((DSL_DEV_PRIVATE(pDev)->CMV_RxMsg[0] & 0xff0) >> 4) == D2H_AUTONOMOUS_MODEM_READY_MSG) { + //check ARC ready message + IFX_MEI_DMSG ("Got MODEM_READY_MSG\n"); + DSL_DEV_PRIVATE(pDev)->modem_ready = 1; + MEI_WAKEUP_EVENT (DSL_DEV_PRIVATE(pDev)->wait_queue_modemready); + } + } + } + + return IRQ_HANDLED; +} + +int +DSL_BSP_ATMLedCBRegister (int (*ifx_adsl_ledcallback) (void)) +{ + g_adsl_ledcallback = ifx_adsl_ledcallback; + return 0; +} + +int +DSL_BSP_ATMLedCBUnregister (int (*ifx_adsl_ledcallback) (void)) +{ + g_adsl_ledcallback = adsl_dummy_ledcallback; + return 0; +} + +#if 0 +int +DSL_BSP_EventCBRegister (int (*ifx_adsl_callback) + (DSL_BSP_CB_Event_t * param)) +{ + int error = 0; + + if (DSL_EventCB == NULL) { + DSL_EventCB = ifx_adsl_callback; + } + else { + error = -EIO; + } + return error; +} + +int +DSL_BSP_EventCBUnregister (int (*ifx_adsl_callback) + (DSL_BSP_CB_Event_t * param)) +{ + int error = 0; + + if (DSL_EventCB == ifx_adsl_callback) { + DSL_EventCB = NULL; + } + else { + error = -EIO; + } + return error; +} + +static int +DSL_BSP_GetEventCB (int (**ifx_adsl_callback) + (DSL_BSP_CB_Event_t * param)) +{ + *ifx_adsl_callback = DSL_EventCB; + return 0; +} +#endif + +#ifdef CONFIG_IFXMIPS_MEI_FW_LOOPBACK +#define mte_reg_base (0x4800*4+0x20000) + +/* Iridia Registers Address Constants */ +#define MTE_Reg(r) (int)(mte_reg_base + (r*4)) + +#define IT_AMODE MTE_Reg(0x0004) + +#define TIMER_DELAY (1024) +#define BC0_BYTES (32) +#define BC1_BYTES (30) +#define NUM_MB (12) +#define TIMEOUT_VALUE 2000 + +static void +BFMWait (u32 cycle) +{ + u32 i; + for (i = 0; i < cycle; i++); +} + +static void +WriteRegLong (u32 addr, u32 data) +{ + //*((volatile u32 *)(addr)) = data; + IFX_MEI_WRITE_REGISTER_L (data, addr); +} + +static u32 +ReadRegLong (u32 addr) +{ + // u32 rd_val; + //rd_val = *((volatile u32 *)(addr)); + // return rd_val; + return IFX_MEI_READ_REGISTER_L (addr); +} + +/* This routine writes the mailbox with the data in an input array */ +static void +WriteMbox (u32 * mboxarray, u32 size) +{ + IFX_MEI_DebugWrite (&dsl_devices[0], IMBOX_BASE, mboxarray, size); + printk ("write to %X\n", IMBOX_BASE); + IFX_MEI_LongWordWriteOffset (&dsl_devices[0], (u32) ME_ME2ARC_INT, MEI_TO_ARC_MSGAV); +} + +/* This routine reads the output mailbox and places the results into an array */ +static void +ReadMbox (u32 * mboxarray, u32 size) +{ + IFX_MEI_DebugRead (&dsl_devices[0], OMBOX_BASE, mboxarray, size); + printk ("read from %X\n", OMBOX_BASE); +} + +static void +MEIWriteARCValue (u32 address, u32 value) +{ + u32 i, check = 0; + + /* Write address register */ + IFX_MEI_WRITE_REGISTER_L (address, ME_DBG_WR_AD + IFXMIPS_MEI_BASE_ADDR); + + /* Write data register */ + IFX_MEI_WRITE_REGISTER_L (value, ME_DBG_DATA + IFXMIPS_MEI_BASE_ADDR); + + /* wait until complete - timeout at 40 */ + for (i = 0; i < 40; i++) { + check = IFX_MEI_READ_REGISTER_L (ME_ARC2ME_STAT + IFXMIPS_MEI_BASE_ADDR); + + if ((check & ARC_TO_MEI_DBG_DONE)) + break; + } + /* clear the flag */ + IFX_MEI_WRITE_REGISTER_L (ARC_TO_MEI_DBG_DONE, ME_ARC2ME_STAT + IFXMIPS_MEI_BASE_ADDR); +} + +void +arc_code_page_download (uint32_t arc_code_length, uint32_t * start_address) +{ + int count; + + printk ("try to download pages,size=%d\n", arc_code_length); + IFX_MEI_ControlModeSet (&dsl_devices[0], MEI_MASTER_MODE); + IFX_MEI_HaltArc (&dsl_devices[0]); + IFX_MEI_LongWordWriteOffset (&dsl_devices[0], (u32) ME_DX_AD, 0); + for (count = 0; count < arc_code_length; count++) { + IFX_MEI_LongWordWriteOffset (&dsl_devices[0], (u32) ME_DX_DATA, + *(start_address + count)); + } + IFX_MEI_ControlModeSet (&dsl_devices[0], JTAG_MASTER_MODE); +} +static int +load_jump_table (unsigned long addr) +{ + int i; + uint32_t addr_le, addr_be; + uint32_t jump_table[32]; + + for (i = 0; i < 16; i++) { + addr_le = i * 8 + addr; + addr_be = ((addr_le >> 16) & 0xffff); + addr_be |= ((addr_le & 0xffff) << 16); + jump_table[i * 2 + 0] = 0x0f802020; + jump_table[i * 2 + 1] = addr_be; + //printk("jt %X %08X %08X\n",i,jump_table[i*2+0],jump_table[i*2+1]); + } + arc_code_page_download (32, &jump_table[0]); +return 0; +} + +int got_int = 0; + +void +dfe_loopback_irq_handler (DSL_DEV_Device_t *pDev) +{ + uint32_t rd_mbox[10]; + + memset (&rd_mbox[0], 0, 10 * 4); + ReadMbox (&rd_mbox[0], 6); + if (rd_mbox[0] == 0x0) { + printk ("Get ARC_ACK\n"); + got_int = 1; + } + else if (rd_mbox[0] == 0x5) { + printk ("Get ARC_BUSY\n"); + got_int = 2; + } + else if (rd_mbox[0] == 0x3) { + printk ("Get ARC_EDONE\n"); + if (rd_mbox[1] == 0x0) { + got_int = 3; + printk ("Get E_MEMTEST\n"); + if (rd_mbox[2] != 0x1) { + got_int = 4; + printk ("Get Result %X\n", rd_mbox[2]); + } + } + } + IFX_MEI_LongWordWriteOffset (&dsl_devices[0], (u32) ME_ARC2ME_STAT, + ARC_TO_MEI_DBG_DONE); + MEI_MASK_AND_ACK_IRQ (pDev->nIrq[IFX_DFEIR]); + disable_irq (pDev->nIrq[IFX_DFEIR]); + //got_int = 1; + return; +} + +static void +wait_mem_test_result (void) +{ + uint32_t mbox[5]; + mbox[0] = 0; + + printk ("Waiting Starting\n"); + while (mbox[0] == 0) { + ReadMbox (&mbox[0], 5); + } + printk ("Try to get mem test result.\n"); + ReadMbox (&mbox[0], 5); + if (mbox[0] == 0xA) { + printk ("Success.\n"); + } + else if (mbox[0] == 0xA) { + printk ("Fail,address %X,except data %X,receive data %X\n", + mbox[1], mbox[2], mbox[3]); + } + else { + printk ("Fail\n"); + } +} + +static int +arc_ping_testing (DSL_DEV_Device_t *pDev) +{ +#define MEI_PING 0x00000001 + uint32_t wr_mbox[10], rd_mbox[10]; + int i; + + for (i = 0; i < 10; i++) { + wr_mbox[i] = 0; + rd_mbox[i] = 0; + } + + printk ("send ping msg\n"); + wr_mbox[0] = MEI_PING; + WriteMbox (&wr_mbox[0], 10); + + while (got_int == 0) { + MEI_WAIT (100); + } + + printk ("send start event\n"); + got_int = 0; + + wr_mbox[0] = 0x4; + wr_mbox[1] = 0; + wr_mbox[2] = 0; + wr_mbox[3] = (uint32_t) 0xf5acc307e; + wr_mbox[4] = 5; + wr_mbox[5] = 2; + wr_mbox[6] = 0x1c000; + wr_mbox[7] = 64; + wr_mbox[8] = 0; + wr_mbox[9] = 0; + WriteMbox (&wr_mbox[0], 10); + DSL_ENABLE_IRQ (pDev->nIrq[IFX_DFEIR]); + //printk("IFX_MEI_MailboxWrite ret=%d\n",i); + IFX_MEI_LongWordWriteOffset (&dsl_devices[0], + (u32) ME_ME2ARC_INT, + MEI_TO_ARC_MSGAV); + printk ("sleeping\n"); + while (1) { + if (got_int > 0) { + + if (got_int > 3) + printk ("got_int >>>> 3\n"); + else + printk ("got int = %d\n", got_int); + got_int = 0; + //schedule(); + DSL_ENABLE_IRQ (pDev->nIrq[IFX_DFEIR]); + } + //mbox_read(&rd_mbox[0],6); + MEI_WAIT (100); + } + return 0; +} + +static DSL_DEV_MeiError_t +DFE_Loopback_Test (void) +{ + int i = 0; + u32 arc_debug_data = 0, temp; + DSL_DEV_Device_t *pDev = &dsl_devices[0]; + uint32_t wr_mbox[10]; + + IFX_MEI_ResetARC (pDev); + // start the clock + arc_debug_data = ACL_CLK_MODE_ENABLE; + IFX_MEI_DebugWrite (pDev, CRI_CCR0, &arc_debug_data, 1); + +#if defined( DFE_PING_TEST )|| defined( DFE_ATM_LOOPBACK) + // WriteARCreg(AUX_XMEM_LTEST,0); + IFX_MEI_ControlModeSet (pDev, MEI_MASTER_MODE); +#define AUX_XMEM_LTEST 0x128 + _IFX_MEI_DBGLongWordWrite (pDev, MEI_DEBUG_DEC_AUX_MASK, AUX_XMEM_LTEST, 0); + IFX_MEI_ControlModeSet (pDev, JTAG_MASTER_MODE); + + // WriteARCreg(AUX_XDMA_GAP,0); + IFX_MEI_ControlModeSet (pDev, MEI_MASTER_MODE); +#define AUX_XDMA_GAP 0x114 + _IFX_MEI_DBGLongWordWrite (pDev, MEI_DEBUG_DEC_AUX_MASK, AUX_XDMA_GAP, 0); + IFX_MEI_ControlModeSet (pDev, JTAG_MASTER_MODE); + + IFX_MEI_ControlModeSet (pDev, MEI_MASTER_MODE); + temp = 0; + _IFX_MEI_DBGLongWordWrite (pDev, MEI_DEBUG_DEC_AUX_MASK, + (u32) ME_XDATA_BASE_SH + IFXMIPS_MEI_BASE_ADDR, temp); + IFX_MEI_ControlModeSet (pDev, JTAG_MASTER_MODE); + + i = IFX_MEI_DFEMemoryAlloc (pDev, SDRAM_SEGMENT_SIZE * 16); + if (i >= 0) { + int idx; + + for (idx = 0; idx < i; idx++) { + DSL_DEV_PRIVATE(pDev)->adsl_mem_info[idx].type = FREE_RELOAD; + IFX_MEI_WRITE_REGISTER_L ((((uint32_t) DSL_DEV_PRIVATE(pDev)->adsl_mem_info[idx].address) & 0x0fffffff), + IFXMIPS_MEI_BASE_ADDR + ME_XMEM_BAR_BASE + idx * 4); + printk ("bar%d(%X)=%X\n", idx, + IFXMIPS_MEI_BASE_ADDR + ME_XMEM_BAR_BASE + + idx * 4, (((uint32_t) + ((ifx_mei_device_private_t *) + pDev->pPriv)->adsl_mem_info[idx]. + address) & 0x0fffffff)); + memset ((u8 *) DSL_DEV_PRIVATE(pDev)->adsl_mem_info[idx].address, 0, SDRAM_SEGMENT_SIZE); + } + + IFX_MEI_LongWordWriteOffset (pDev, (u32) ME_XDATA_BASE_SH, + ((unsigned long) DSL_DEV_PRIVATE(pDev)->adsl_mem_info[XDATA_REGISTER].address) & 0x0FFFFFFF); + } + else { + IFX_MEI_EMSG ("cannot load image: no memory\n"); + return DSL_DEV_MEI_ERR_FAILURE; + } + //WriteARCreg(AUX_IC_CTRL,2); + printk(KERN_INFO "[%s %s %d]: Setting MEI_MASTER_MODE..\n", __FILE__, __func__, __LINE__); + IFX_MEI_ControlModeSet (pDev, MEI_MASTER_MODE); +#define AUX_IC_CTRL 0x11 + _IFX_MEI_DBGLongWordWrite (pDev, MEI_DEBUG_DEC_AUX_MASK, + AUX_IC_CTRL, 2); + printk(KERN_INFO "[%s %s %d]: Setting JTAG_MASTER_MODE..\n", __FILE__, __func__, __LINE__); + IFX_MEI_ControlModeSet (pDev, JTAG_MASTER_MODE); + + printk(KERN_INFO "[%s %s %d]: Halting ARC...\n", __FILE__, __func__, __LINE__); + IFX_MEI_HaltArc (&dsl_devices[0]); + +#ifdef DFE_PING_TEST + + printk ("ping test image size=%d\n", sizeof (arc_ahb_access_code)); + memcpy ((u8 *) (DSL_DEV_PRIVATE(pDev)-> + adsl_mem_info[0].address + 0x1004), + &arc_ahb_access_code[0], sizeof (arc_ahb_access_code)); + load_jump_table (0x80000 + 0x1004); + +#endif //DFE_PING_TEST + + printk ("ARC ping test code download complete\n"); +#endif //defined( DFE_PING_TEST )|| defined( DFE_ATM_LOOPBACK) +#ifdef DFE_MEM_TEST + IFX_MEI_LongWordWriteOffset (&dsl_devices[0], (u32) ME_ARC2ME_MASK, MSGAV_EN); + + arc_code_page_download (1537, &code_array[0]); + printk ("ARC mem test code download complete\n"); +#endif //DFE_MEM_TEST +#ifdef DFE_ATM_LOOPBACK + arc_debug_data = 0xf; + arc_code_page_download (sizeof(code_array) / sizeof(*code_array), &code_array[0]); + wr_mbox[0] = 0; //TIMER_DELAY - org: 1024 + wr_mbox[1] = 0; //TXFB_START0 + wr_mbox[2] = 0x7f; //TXFB_END0 - org: 49 + wr_mbox[3] = 0x80; //TXFB_START1 - org: 80 + wr_mbox[4] = 0xff; //TXFB_END1 - org: 109 + wr_mbox[5] = 0x100; //RXFB_START0 - org: 0 + wr_mbox[6] = 0x17f; //RXFB_END0 - org: 49 + wr_mbox[7] = 0x180; //RXFB_START1 - org: 256 + wr_mbox[8] = 0x1ff; //RXFB_END1 - org: 315 + WriteMbox (&wr_mbox[0], 9); + // Start Iridia IT_AMODE (in dmp access) why is it required? + IFX_MEI_DebugWrite (&dsl_devices[0], 0x32010, &arc_debug_data, 1); +#endif //DFE_ATM_LOOPBACK + IFX_MEI_IRQEnable (pDev); + printk(KERN_INFO "[%s %s %d]: run ARC...\n", __FILE__, __func__, __LINE__); + IFX_MEI_RunArc (&dsl_devices[0]); + +#ifdef DFE_PING_TEST + arc_ping_testing (pDev); +#endif //DFE_PING_TEST +#ifdef DFE_MEM_TEST + wait_mem_test_result (); +#endif //DFE_MEM_TEST + + IFX_MEI_DFEMemoryFree (pDev, FREE_ALL); + return DSL_DEV_MEI_ERR_SUCCESS; +} + +#endif //CONFIG_AMAZON_S_MEI_FW_LOOPBACK + +static int +IFX_MEI_InitDevNode (int num) +{ + if (num == 0) { + if ((dev_major = register_chrdev (dev_major, IFX_MEI_DEVNAME, &bsp_mei_operations)) < 0) { + IFX_MEI_EMSG ("register_chrdev(%d %s) failed!\n", dev_major, IFX_MEI_DEVNAME); + return -ENODEV; + } + } + return 0; +} + +static int +IFX_MEI_CleanUpDevNode (int num) +{ + if (num == 0) + unregister_chrdev (dev_major, MEI_DIRNAME); + return 0; +} + +static int +IFX_MEI_InitDevice (int num) +{ + DSL_DEV_Device_t *pDev; + u32 temp; + pDev = &dsl_devices[num]; + if (pDev == NULL) + return -ENOMEM; + pDev->pPriv = &sDanube_Mei_Private[num]; + memset (pDev->pPriv, 0, sizeof (ifx_mei_device_private_t)); + + memset (&DSL_DEV_PRIVATE(pDev)-> + adsl_mem_info[0], 0, + sizeof (smmu_mem_info_t) * MAX_BAR_REGISTERS); + + if (num == 0) { + pDev->nIrq[IFX_DFEIR] = IFXMIPS_MEI_INT; + pDev->nIrq[IFX_DYING_GASP] = IFXMIPS_MEI_DYING_GASP_INT; + pDev->base_address = IFXMIPS_MEI_BASE_ADDR; + + /* Power up MEI */ +#ifdef CONFIG_IFXMIPS_AMAZON_SE + *IFXMIPS_PMU_PWDCR &= ~(1 << 9); // enable dsl + *IFXMIPS_PMU_PWDCR &= ~(1 << 15); // enable AHB base +#else + temp = ifxmips_r32(IFXMIPS_PMU_PWDCR); + temp &= 0xffff7dbe; + ifxmips_w32(temp, IFXMIPS_PMU_PWDCR); +#endif + } + pDev->nInUse = 0; + DSL_DEV_PRIVATE(pDev)->modem_ready = 0; + DSL_DEV_PRIVATE(pDev)->arcmsgav = 0; + + MEI_INIT_WAKELIST ("arcq", DSL_DEV_PRIVATE(pDev)->wait_queue_arcmsgav); // for ARCMSGAV + MEI_INIT_WAKELIST ("arcr", DSL_DEV_PRIVATE(pDev)->wait_queue_modemready); // for arc modem ready + + MEI_MUTEX_INIT (DSL_DEV_PRIVATE(pDev)->mei_cmv_sema, 1); // semaphore initialization, mutex +#if 0 + MEI_MASK_AND_ACK_IRQ (pDev->nIrq[IFX_DFEIR]); + MEI_MASK_AND_ACK_IRQ (pDev->nIrq[IFX_DYING_GASP]); +#endif + if (request_irq (pDev->nIrq[IFX_DFEIR], IFX_MEI_IrqHandle, 0, "DFEIR", pDev) != 0) { + IFX_MEI_EMSG ("request_irq %d failed!\n", pDev->nIrq[IFX_DFEIR]); + return -1; + } + if (request_irq (pDev->nIrq[IFX_DYING_GASP], IFX_MEI_Dying_Gasp_IrqHandle, 0, "DYING_GASP", pDev) != 0) { + IFX_MEI_EMSG ("request_irq %d failed!\n", pDev->nIrq[IFX_DYING_GASP]); + return -1; + } +// IFX_MEI_DMSG("Device %d initialized. IER %#x\n", num, bsp_get_irq_ier(pDev->nIrq[IFX_DYING_GASP])); + return 0; +} + +static int +IFX_MEI_ExitDevice (int num) +{ + DSL_DEV_Device_t *pDev; + pDev = &dsl_devices[num]; + + if (pDev == NULL) + return -EIO; + + disable_irq (pDev->nIrq[IFX_DFEIR]); + disable_irq (pDev->nIrq[IFX_DYING_GASP]); + + free_irq(pDev->nIrq[IFX_DFEIR], pDev); + free_irq(pDev->nIrq[IFX_DYING_GASP], pDev); + + return 0; +} + +static DSL_DEV_Device_t * +IFX_BSP_HandleGet (int maj, int num) +{ + if (num > BSP_MAX_DEVICES) + return NULL; + return &dsl_devices[num]; +} + +DSL_DEV_Device_t * +DSL_BSP_DriverHandleGet (int maj, int num) +{ + DSL_DEV_Device_t *pDev; + + if (num > BSP_MAX_DEVICES) + return NULL; + + pDev = &dsl_devices[num]; + if (!try_module_get(pDev->owner)) + return NULL; + + pDev->nInUse++; + return pDev; +} + +int +DSL_BSP_DriverHandleDelete (DSL_DEV_Device_t * nHandle) +{ + DSL_DEV_Device_t *pDev = (DSL_DEV_Device_t *) nHandle; + if (pDev->nInUse) + pDev->nInUse--; + module_put(pDev->owner); + return 0; +} + +static int +IFX_MEI_Open (DSL_DRV_inode_t * ino, DSL_DRV_file_t * fil) +{ + int maj = MAJOR (ino->i_rdev); + int num = MINOR (ino->i_rdev); + + DSL_DEV_Device_t *pDev = NULL; + if ((pDev = DSL_BSP_DriverHandleGet (maj, num)) == NULL) { + IFX_MEI_EMSG("open(%d:%d) fail!\n", maj, num); + return -EIO; + } + fil->private_data = pDev; + return 0; +} + +static int +IFX_MEI_Release (DSL_DRV_inode_t * ino, DSL_DRV_file_t * fil) +{ + //int maj = MAJOR(ino->i_rdev); + int num = MINOR (ino->i_rdev); + DSL_DEV_Device_t *pDev; + + pDev = &dsl_devices[num]; + if (pDev == NULL) + return -EIO; + DSL_BSP_DriverHandleDelete (pDev); + return 0; +} + +/** + * Callback function for linux userspace program writing + */ +static ssize_t +IFX_MEI_Write (DSL_DRV_file_t * filp, const char *buf, size_t size, loff_t * loff) +{ + DSL_DEV_MeiError_t mei_error = DSL_DEV_MEI_ERR_FAILURE; + long offset = 0; + DSL_DEV_Device_t *pDev = (DSL_DEV_Device_t *) filp->private_data; + + if (pDev == NULL) + return -EIO; + + mei_error = + DSL_BSP_FWDownload (pDev, buf, size, (long *) loff, &offset); + + if (mei_error == DSL_DEV_MEI_ERR_FAILURE) + return -EIO; + return (ssize_t) offset; +} + +/** + * Callback function for linux userspace program ioctling + */ +static int +IFX_MEI_IoctlCopyFrom (int from_kernel, char *dest, char *from, int size) +{ + int ret = 0; + + if (!from_kernel) + ret = copy_from_user ((char *) dest, (char *) from, size); + else + ret = (int)memcpy ((char *) dest, (char *) from, size); + return ret; +} + +static int +IFX_MEI_IoctlCopyTo (int from_kernel, char *dest, char *from, int size) +{ + int ret = 0; + + if (!from_kernel) + ret = copy_to_user ((char *) dest, (char *) from, size); + else + ret = (int)memcpy ((char *) dest, (char *) from, size); + return ret; +} + +static int +IFX_MEI_Ioctls (DSL_DEV_Device_t * pDev, int from_kernel, unsigned int command, unsigned long lon) +{ + int i = 0; + int meierr = DSL_DEV_MEI_ERR_SUCCESS; + u32 base_address = IFXMIPS_MEI_BASE_ADDR; + DSL_DEV_WinHost_Message_t winhost_msg, m; + DSL_DEV_MeiDebug_t debugrdwr; + DSL_DEV_MeiReg_t regrdwr; + + switch (command) { + + case DSL_FIO_BSP_CMV_WINHOST: + IFX_MEI_IoctlCopyFrom (from_kernel, (char *) winhost_msg.msg.TxMessage, + (char *) lon, MSG_LENGTH * 2); + + if ((meierr = DSL_BSP_SendCMV (pDev, winhost_msg.msg.TxMessage, YES_REPLY, + winhost_msg.msg.RxMessage)) != DSL_DEV_MEI_ERR_SUCCESS) { + IFX_MEI_EMSG ("WINHOST CMV fail :TxMessage:%X %X %X %X, RxMessage:%X %X %X %X %X\n", + winhost_msg.msg.TxMessage[0], winhost_msg.msg.TxMessage[1], winhost_msg.msg.TxMessage[2], winhost_msg.msg.TxMessage[3], + winhost_msg.msg.RxMessage[0], winhost_msg.msg.RxMessage[1], winhost_msg.msg.RxMessage[2], winhost_msg.msg.RxMessage[3], + winhost_msg.msg.RxMessage[4]); + meierr = DSL_DEV_MEI_ERR_FAILURE; + } + else { + IFX_MEI_IoctlCopyTo (from_kernel, (char *) lon, + (char *) winhost_msg.msg.RxMessage, + MSG_LENGTH * 2); + } + break; + + case DSL_FIO_BSP_CMV_READ: + IFX_MEI_IoctlCopyFrom (from_kernel, (char *) (®rdwr), + (char *) lon, sizeof (DSL_DEV_MeiReg_t)); + + IFX_MEI_LongWordRead ((u32) regrdwr.iAddress, + (u32 *) & (regrdwr.iData)); + + IFX_MEI_IoctlCopyTo (from_kernel, (char *) lon, + (char *) (®rdwr), + sizeof (DSL_DEV_MeiReg_t)); + + break; + + case DSL_FIO_BSP_CMV_WRITE: + IFX_MEI_IoctlCopyFrom (from_kernel, (char *) (®rdwr), + (char *) lon, sizeof (DSL_DEV_MeiReg_t)); + + IFX_MEI_LongWordWrite ((u32) regrdwr.iAddress, + regrdwr.iData); + break; + + case DSL_FIO_BSP_GET_BASE_ADDRESS: + IFX_MEI_IoctlCopyTo (from_kernel, (char *) lon, + (char *) (&base_address), + sizeof (base_address)); + break; + + case DSL_FIO_BSP_IS_MODEM_READY: + i = IFX_MEI_IsModemReady (pDev); + IFX_MEI_IoctlCopyTo (from_kernel, (char *) lon, + (char *) (&i), sizeof (int)); + meierr = DSL_DEV_MEI_ERR_SUCCESS; + break; + case DSL_FIO_BSP_RESET: + case DSL_FIO_BSP_REBOOT: + meierr = IFX_MEI_CpuModeSet (pDev, DSL_CPU_RESET); + meierr = IFX_MEI_CpuModeSet (pDev, DSL_CPU_HALT); + break; + + case DSL_FIO_BSP_HALT: + meierr = IFX_MEI_CpuModeSet (pDev, DSL_CPU_HALT); + break; + + case DSL_FIO_BSP_RUN: + meierr = IFX_MEI_CpuModeSet (pDev, DSL_CPU_RUN); + break; + case DSL_FIO_BSP_BOOTDOWNLOAD: + meierr = IFX_MEI_DownloadBootCode (pDev); + break; + case DSL_FIO_BSP_JTAG_ENABLE: + meierr = IFX_MEI_ArcJtagEnable (pDev, 1); + break; + + case DSL_FIO_BSP_REMOTE: + IFX_MEI_IoctlCopyFrom (from_kernel, (char *) (&i), + (char *) lon, sizeof (int)); + + meierr = IFX_MEI_AdslMailboxIRQEnable (pDev, i); + break; + + case DSL_FIO_BSP_DSL_START: + printk("\n%s: DSL_FIO_BSP_DSL_START\n",__func__); + if ((meierr = IFX_MEI_RunAdslModem (pDev)) != DSL_DEV_MEI_ERR_SUCCESS) { + IFX_MEI_EMSG ("IFX_MEI_RunAdslModem() error..."); + meierr = DSL_DEV_MEI_ERR_FAILURE; + } + break; + + case DSL_FIO_BSP_DEBUG_READ: + case DSL_FIO_BSP_DEBUG_WRITE: + IFX_MEI_IoctlCopyFrom (from_kernel, + (char *) (&debugrdwr), + (char *) lon, + sizeof (debugrdwr)); + + if (command == DSL_FIO_BSP_DEBUG_READ) + meierr = DSL_BSP_MemoryDebugAccess (pDev, + DSL_BSP_MEMORY_READ, + debugrdwr. + iAddress, + debugrdwr. + buffer, + debugrdwr. + iCount); + else + meierr = DSL_BSP_MemoryDebugAccess (pDev, + DSL_BSP_MEMORY_WRITE, + debugrdwr. + iAddress, + debugrdwr. + buffer, + debugrdwr. + iCount); + + IFX_MEI_IoctlCopyTo (from_kernel, (char *) lon, (char *) (&debugrdwr), sizeof (debugrdwr)); + break; + case DSL_FIO_BSP_GET_VERSION: + IFX_MEI_IoctlCopyTo (from_kernel, (char *) lon, (char *) (&bsp_mei_version), sizeof (DSL_DEV_Version_t)); + break; + + case DSL_FIO_BSP_GET_CHIP_INFO: + bsp_chip_info.major = 1; + bsp_chip_info.minor = IFXMIPS_MPS_CHIPID_VERSION_GET(*IFXMIPS_MPS_CHIPID); + IFX_MEI_IoctlCopyTo (from_kernel, (char *) lon, (char *) (&bsp_chip_info), sizeof (DSL_DEV_HwVersion_t)); + meierr = DSL_DEV_MEI_ERR_SUCCESS; + break; + + case DSL_FIO_BSP_FREE_RESOURCE: + makeCMV (H2D_CMV_READ, DSL_CMV_GROUP_STAT, 4, 0, 1, NULL, m.msg.TxMessage); + if (DSL_BSP_SendCMV (pDev, m.msg.TxMessage, YES_REPLY, m.msg.RxMessage) != DSL_DEV_MEI_ERR_SUCCESS) { + meierr = DSL_DEV_MEI_ERR_FAILURE; + return -EIO; + } + IFX_MEI_DMSG("RxMessage[4] = %#x\n", m.msg.RxMessage[4]); + if (!(m.msg.RxMessage[4] & DSL_DEV_STAT_CODESWAP_COMPLETE)) { + meierr = DSL_DEV_MEI_ERR_FAILURE; + return -EAGAIN; + } + IFX_MEI_DMSG("Freeing all memories marked FREE_SHOWTIME\n"); + IFX_MEI_DFEMemoryFree (pDev, FREE_SHOWTIME); + meierr = DSL_DEV_MEI_ERR_SUCCESS; + break; +#ifdef CONFIG_IFXMIPS_AMAZON_SE + case DSL_FIO_ARC_MUX_TEST: + AMAZON_SE_MEI_ARC_MUX_Test(); + break; +#endif + default: +// IFX_MEI_EMSG("Invalid IOCTL command: %d\n"); + break; + } + return meierr; +} + +#ifdef CONFIG_IFXMIPS_AMAZON_SE +void AMAZON_SE_MEI_ARC_MUX_Test(void) +{ + u32 *p, i; + *IFXMIPS_RCU_RST |= IFXMIPS_RCU_RST_REQ_MUX_ARC; + + p = (u32*)(DFE_LDST_BASE_ADDR + IRAM0_BASE); + IFX_MEI_EMSG("Writing to IRAM0(%p)...\n", p); + for (i = 0; i < IRAM0_SIZE/sizeof(u32); i++, p++) { + *p = 0xdeadbeef; + if (*p != 0xdeadbeef) + IFX_MEI_EMSG("%p: %#x\n", p, *p); + } + + p = (u32*)(DFE_LDST_BASE_ADDR + IRAM1_BASE); + IFX_MEI_EMSG("Writing to IRAM1(%p)...\n", p); + for (i = 0; i < IRAM1_SIZE/sizeof(u32); i++, p++) { + *p = 0xdeadbeef; + if (*p != 0xdeadbeef) + IFX_MEI_EMSG("%p: %#x\n", p, *p); + } + + p = (u32*)(DFE_LDST_BASE_ADDR + BRAM_BASE); + IFX_MEI_EMSG("Writing to BRAM(%p)...\n", p); + for (i = 0; i < BRAM_SIZE/sizeof(u32); i++, p++) { + *p = 0xdeadbeef; + if (*p != 0xdeadbeef) + IFX_MEI_EMSG("%p: %#x\n", p, *p); + } + + p = (u32*)(DFE_LDST_BASE_ADDR + XRAM_BASE); + IFX_MEI_EMSG("Writing to XRAM(%p)...\n", p); + for (i = 0; i < XRAM_SIZE/sizeof(u32); i++, p++) { + *p = 0xdeadbeef; + if (*p != 0xdeadbeef) + IFX_MEI_EMSG("%p: %#x\n", p, *p); + } + + p = (u32*)(DFE_LDST_BASE_ADDR + YRAM_BASE); + IFX_MEI_EMSG("Writing to YRAM(%p)...\n", p); + for (i = 0; i < YRAM_SIZE/sizeof(u32); i++, p++) { + *p = 0xdeadbeef; + if (*p != 0xdeadbeef) + IFX_MEI_EMSG("%p: %#x\n", p, *p); + } + + p = (u32*)(DFE_LDST_BASE_ADDR + EXT_MEM_BASE); + IFX_MEI_EMSG("Writing to EXT_MEM(%p)...\n", p); + for (i = 0; i < EXT_MEM_SIZE/sizeof(u32); i++, p++) { + *p = 0xdeadbeef; + if (*p != 0xdeadbeef) + IFX_MEI_EMSG("%p: %#x\n", p, *p); + } + *IFXMIPS_RCU_RST &= ~IFXMIPS_RCU_RST_REQ_MUX_ARC; +} +#endif +int +DSL_BSP_KernelIoctls (DSL_DEV_Device_t * pDev, unsigned int command, + unsigned long lon) +{ + int error = 0; + + error = IFX_MEI_Ioctls (pDev, 1, command, lon); + return error; +} + +static int +IFX_MEI_UserIoctls (DSL_DRV_inode_t * ino, DSL_DRV_file_t * fil, + unsigned int command, unsigned long lon) +{ + int error = 0; + int maj = MAJOR (ino->i_rdev); + int num = MINOR (ino->i_rdev); + DSL_DEV_Device_t *pDev; + + pDev = IFX_BSP_HandleGet (maj, num); + if (pDev == NULL) + return -EIO; + + error = IFX_MEI_Ioctls (pDev, 0, command, lon); + return error; +} + +#ifdef CONFIG_PROC_FS +/* + * Register a callback function for linux proc filesystem + */ +static int +IFX_MEI_InitProcFS (int num) +{ + struct proc_dir_entry *entry; + int i ; + DSL_DEV_Device_t *pDev; + reg_entry_t regs_temp[PROC_ITEMS] = { + /* flag, name, description } */ + {NULL, "arcmsgav", "arc to mei message ", 0}, + {NULL, "cmv_reply", "cmv needs reply", 0}, + {NULL, "cmv_waiting", "waiting for cmv reply from arc", 0}, + {NULL, "modem_ready_cnt", "ARC to MEI indicator count", 0}, + {NULL, "cmv_count", "MEI to ARC CMVs", 0}, + {NULL, "reply_count", "ARC to MEI Reply", 0}, + {NULL, "Recent_indicator", "most recent indicator", 0}, + {NULL, "fw_version", "Firmware Version", 0}, + {NULL, "fw_date", "Firmware Date", 0}, + {NULL, "meminfo", "Memory Allocation Information", 0}, + {NULL, "version", "MEI version information", 0}, + }; + + pDev = &dsl_devices[num]; + if (pDev == NULL) + return -ENOMEM; + + regs_temp[0].flag = &(DSL_DEV_PRIVATE(pDev)->arcmsgav); + regs_temp[1].flag = &(DSL_DEV_PRIVATE(pDev)->cmv_reply); + regs_temp[2].flag = &(DSL_DEV_PRIVATE(pDev)->cmv_waiting); + regs_temp[3].flag = &(DSL_DEV_PRIVATE(pDev)->modem_ready_cnt); + regs_temp[4].flag = &(DSL_DEV_PRIVATE(pDev)->cmv_count); + regs_temp[5].flag = &(DSL_DEV_PRIVATE(pDev)->reply_count); + regs_temp[6].flag = (int *) &(DSL_DEV_PRIVATE(pDev)->Recent_indicator); + + memcpy ((char *) regs[num], (char *) regs_temp, sizeof (regs_temp)); + // procfs + meidir = proc_mkdir (MEI_DIRNAME, NULL); + if (meidir == NULL) { + IFX_MEI_EMSG ("Failed to create /proc/%s\n", MEI_DIRNAME); + return (-ENOMEM); + } + + for (i = 0; i < NUM_OF_REG_ENTRY; i++) { + entry = create_proc_entry (regs[num][i].name, + S_IWUSR | S_IRUSR | S_IRGRP | + S_IROTH, meidir); + if (entry) { + regs[num][i].low_ino = entry->low_ino; + entry->proc_fops = &IFX_MEI_ProcOperations; + } + else { + IFX_MEI_EMSG ("Failed to create /proc/%s/%s\n", MEI_DIRNAME, regs[num][i].name); + return (-ENOMEM); + } + } + return 0; +} + +/* + * Reading function for linux proc filesystem + */ +static int +IFX_MEI_ProcRead (struct file *file, char *buf, size_t nbytes, loff_t * ppos) +{ + int i_ino = (file->f_dentry->d_inode)->i_ino; + char *p = buf; + int i; + int num; + reg_entry_t *entry = NULL; + DSL_DEV_Device_t *pDev = NULL; + DSL_DEV_WinHost_Message_t m; + + for (num = 0; num < BSP_MAX_DEVICES; num++) { + for (i = 0; i < NUM_OF_REG_ENTRY; i++) { + if (regs[num][i].low_ino == (unsigned short)i_ino) { + entry = ®s[num][i]; + pDev = &dsl_devices[num]; + break; + } + } + } + if (entry == NULL) + return -EINVAL; + else if (strcmp(entry->name, "meminfo") == 0) { + if (*ppos > 0) /* Assume reading completed in previous read */ + return 0; + p += sprintf (p, "No Address Size\n"); + for (i = 0; i < MAX_BAR_REGISTERS; i++) { + p += sprintf (p, "BAR[%02d] Addr:0x%08X Size:%lu\n", + i, (u32) DSL_DEV_PRIVATE(pDev)->adsl_mem_info[i].address, + DSL_DEV_PRIVATE(pDev)-> adsl_mem_info[i].size); + //printk( "BAR[%02d] Addr:0x%08X Size:%d\n",i,adsl_mem_info[i].address,adsl_mem_info[i].size); + } + *ppos += (p - buf); + } else if (strcmp(entry->name, "fw_version") == 0) { + if (*ppos > 0) /* Assume reading completed in previous read */ + return 0; + if (DSL_DEV_PRIVATE(pDev)->modem_ready_cnt < 1) + return -EAGAIN; + //major:bits 0-7 + //minor:bits 8-15 + makeCMV (H2D_CMV_READ, DSL_CMV_GROUP_INFO, 54, 0, 1, NULL, m.msg.TxMessage); + if (DSL_BSP_SendCMV (pDev, m.msg.TxMessage, YES_REPLY, m.msg.RxMessage) != DSL_DEV_MEI_ERR_SUCCESS) + return -EIO; + p += sprintf(p, "FW Version: %d.%d.", m.msg.RxMessage[4] & 0xFF, (m.msg.RxMessage[4] >> 8) & 0xFF); + //sub_version:bits 4-7 + //int_version:bits 0-3 + //spl_appl:bits 8-13 + //rel_state:bits 14-15 + makeCMV (H2D_CMV_READ, DSL_CMV_GROUP_INFO, 54, 1, 1, NULL, m.msg.TxMessage); + if (DSL_BSP_SendCMV (pDev, m.msg.TxMessage, YES_REPLY, m.msg.RxMessage) != DSL_DEV_MEI_ERR_SUCCESS) + return -EIO; + p += sprintf(p, "%d.%d.%d.%d\n", + (m.msg.RxMessage[4] >> 4) & 0xF, m.msg.RxMessage[4] & 0xF, + (m.msg.RxMessage[4] >> 14) & 3, (m.msg.RxMessage[4] >> 8) & 0x3F); + *ppos += (p - buf); + } else if (strcmp(entry->name, "fw_date") == 0) { + if (*ppos > 0) /* Assume reading completed in previous read */ + return 0; + if (DSL_DEV_PRIVATE(pDev)->modem_ready_cnt < 1) + return -EAGAIN; + + makeCMV (H2D_CMV_READ, DSL_CMV_GROUP_INFO, 55, 0, 1, NULL, m.msg.TxMessage); + if (DSL_BSP_SendCMV (pDev, m.msg.TxMessage, YES_REPLY, m.msg.RxMessage) != DSL_DEV_MEI_ERR_SUCCESS) + return -EIO; + /* Day/Month */ + p += sprintf(p, "FW Date: %d.%d.", m.msg.RxMessage[4] & 0xFF, (m.msg.RxMessage[4] >> 8) & 0xFF); + + makeCMV (H2D_CMV_READ, DSL_CMV_GROUP_INFO, 55, 2, 1, NULL, m.msg.TxMessage); + if (DSL_BSP_SendCMV (pDev, m.msg.TxMessage, YES_REPLY, m.msg.RxMessage) != DSL_DEV_MEI_ERR_SUCCESS) + return -EIO; + /* Year */ + p += sprintf(p, "%d ", m.msg.RxMessage[4]); + + makeCMV (H2D_CMV_READ, DSL_CMV_GROUP_INFO, 55, 1, 1, NULL, m.msg.TxMessage); + if (DSL_BSP_SendCMV (pDev, m.msg.TxMessage, YES_REPLY, m.msg.RxMessage) != DSL_DEV_MEI_ERR_SUCCESS) + return -EIO; + /* Hour:Minute */ + p += sprintf(p, "%d:%d\n", (m.msg.RxMessage[4] >> 8) & 0xFF, m.msg.RxMessage[4] & 0xFF); + + *ppos += (p - buf); + } else if (strcmp(entry->name, "version") == 0) { + if (*ppos > 0) /* Assume reading completed in previous read */ + return 0; + p += sprintf (p, "IFX MEI V%ld.%ld.%ld\n", bsp_mei_version.major, bsp_mei_version.minor, bsp_mei_version.revision); + + *ppos += (p - buf); + } else if (entry->flag != (int *) DSL_DEV_PRIVATE(pDev)->Recent_indicator) { + if (*ppos > 0) /* Assume reading completed in previous read */ + return 0; // indicates end of file + p += sprintf (p, "0x%08X\n\n", *(entry->flag)); + *ppos += (p - buf); + if ((p - buf) > nbytes) /* Assume output can be read at one time */ + return -EINVAL; + } else { + if ((int) (*ppos) / ((int) 7) == 16) + return 0; // indicate end of the message + p += sprintf (p, "0x%04X\n\n", *(((u16 *) (entry->flag)) + (int) (*ppos) / ((int) 7))); + *ppos += (p - buf); + } + return p - buf; +} + +/* + * Writing function for linux proc filesystem + */ +static ssize_t +IFX_MEI_ProcWrite (struct file *file, const char *buffer, size_t count, loff_t * ppos) +{ + int i_ino = (file->f_dentry->d_inode)->i_ino; + reg_entry_t *current_reg = NULL; + int i = 0; + int num = 0; + unsigned long newRegValue = 0; + char *endp = NULL; + DSL_DEV_Device_t *pDev = NULL; + + for (num = 0; num < BSP_MAX_DEVICES; num++) { + for (i = 0; i < NUM_OF_REG_ENTRY; i++) { + if (regs[num][i].low_ino == i_ino) { + current_reg = ®s[num][i]; + pDev = &dsl_devices[num]; + break; + } + } + } + if ((current_reg == NULL) + || (current_reg->flag == + (int *) DSL_DEV_PRIVATE(pDev)-> + Recent_indicator)) + return -EINVAL; + + newRegValue = simple_strtoul (buffer, &endp, 0); + *(current_reg->flag) = (int) newRegValue; + return (count + endp - buffer); +} +#endif //CONFIG_PROC_FS + +static int adsl_dummy_ledcallback(void) +{ + return 0; +} + +int ifx_mei_atm_led_blink(void) +{ + return g_adsl_ledcallback(); +} +EXPORT_SYMBOL(ifx_mei_atm_led_blink); + +int ifx_mei_atm_showtime_check(int *is_showtime, struct port_cell_info *port_cell, void **xdata_addr) +{ + int i; + + if ( is_showtime ) { + *is_showtime = g_tx_link_rate[0] == 0 && g_tx_link_rate[1] == 0 ? 0 : 1; + } + + if ( port_cell ) { + for ( i = 0; i < port_cell->port_num && i < 2; i++ ) + port_cell->tx_link_rate[i] = g_tx_link_rate[i]; + } + + if ( xdata_addr ) { + if ( g_tx_link_rate[0] == 0 && g_tx_link_rate[1] == 0 ) + *xdata_addr = NULL; + else + *xdata_addr = g_xdata_addr; + } + + return 0; +} +EXPORT_SYMBOL(ifx_mei_atm_showtime_check); + +/* + * Writing function for linux proc filesystem + */ +int __init +IFX_MEI_ModuleInit (void) +{ + int i = 0; + + printk ("IFX MEI Version %ld.%02ld.%02ld", bsp_mei_version.major, bsp_mei_version.minor, bsp_mei_version.revision); + + for (i = 0; i < BSP_MAX_DEVICES; i++) { + if (IFX_MEI_InitDevice (i) != 0) { + printk ("%s: Init device fail!\n", __FUNCTION__); + return -EIO; + } + IFX_MEI_InitDevNode (i); +#ifdef CONFIG_PROC_FS + IFX_MEI_InitProcFS (i); +#endif + } + for (i = 0; i <= DSL_BSP_CB_LAST ; i++) + dsl_bsp_event_callback[i].function = NULL; + +#ifdef CONFIG_IFXMIPS_MEI_FW_LOOPBACK + printk(KERN_INFO "[%s %s %d]: Start loopback test...\n", __FILE__, __func__, __LINE__); + DFE_Loopback_Test (); +#endif + + return 0; +} + +void __exit +IFX_MEI_ModuleExit (void) +{ + int i = 0; + int num; + + for (num = 0; num < BSP_MAX_DEVICES; num++) { + IFX_MEI_CleanUpDevNode (num); +#ifdef CONFIG_PROC_FS + for (i = 0; i < NUM_OF_REG_ENTRY; i++) { + remove_proc_entry (regs[num][i].name, meidir); + } +#endif + } + + remove_proc_entry (MEI_DIRNAME, NULL); + for (i = 0; i < BSP_MAX_DEVICES; i++) { + for (i = 0; i < BSP_MAX_DEVICES; i++) { + IFX_MEI_ExitDevice (i); + } + } +} + +/* export function for DSL Driver */ + +/* The functions of MEI_DriverHandleGet and MEI_DriverHandleDelete are +something like open/close in kernel space , where the open could be used +to register a callback for autonomous messages and returns a mei driver context pointer (comparable to the file descriptor in user space) + The context will be required for the multi line chips future! */ + +EXPORT_SYMBOL (DSL_BSP_DriverHandleGet); +EXPORT_SYMBOL (DSL_BSP_DriverHandleDelete); + +EXPORT_SYMBOL (DSL_BSP_ATMLedCBRegister); +EXPORT_SYMBOL (DSL_BSP_ATMLedCBUnregister); +EXPORT_SYMBOL (DSL_BSP_KernelIoctls); +EXPORT_SYMBOL (DSL_BSP_AdslLedInit); +//EXPORT_SYMBOL (DSL_BSP_AdslLedSet); +EXPORT_SYMBOL (DSL_BSP_FWDownload); +EXPORT_SYMBOL (DSL_BSP_Showtime); + +EXPORT_SYMBOL (DSL_BSP_MemoryDebugAccess); +EXPORT_SYMBOL (DSL_BSP_SendCMV); + +// provide a register/unregister function for DSL driver to register a event callback function +EXPORT_SYMBOL (DSL_BSP_EventCBRegister); +EXPORT_SYMBOL (DSL_BSP_EventCBUnregister); + +module_init (IFX_MEI_ModuleInit); +module_exit (IFX_MEI_ModuleExit); diff --git a/package/ifxmips-dsl-api/src/ifxmips_mei_interface.h b/package/ifxmips-dsl-api/src/ifxmips_mei_interface.h new file mode 100644 index 000000000..ffde6113c --- /dev/null +++ b/package/ifxmips-dsl-api/src/ifxmips_mei_interface.h @@ -0,0 +1,700 @@ +/****************************************************************************** + + Copyright (c) 2009 + Infineon Technologies AG + Am Campeon 1-12; 81726 Munich, Germany + + For licensing information, see the file 'LICENSE' in the root folder of + this software module. + +******************************************************************************/ + +#ifndef IFXMIPS_MEI_H +#define IFXMIPS_MEI_H + +#define CONFIG_DANUBE 1 + +#if !defined(CONFIG_DANUBE) && !defined(CONFIG_AMAZON_SE) && !defined(CONFIG_AR9) && !defined(CONFIG_VR9) +#error Platform undefined!!! +#endif + +#ifdef IFX_MEI_BSP +/** This is the character datatype. */ +typedef char DSL_char_t; +/** This is the unsigned 8-bit datatype. */ +typedef unsigned char DSL_uint8_t; +/** This is the signed 8-bit datatype. */ +typedef signed char DSL_int8_t; +/** This is the unsigned 16-bit datatype. */ +typedef unsigned short DSL_uint16_t; +/** This is the signed 16-bit datatype. */ +typedef signed short DSL_int16_t; +/** This is the unsigned 32-bit datatype. */ +typedef unsigned long DSL_uint32_t; +/** This is the signed 32-bit datatype. */ +typedef signed long DSL_int32_t; +/** This is the float datatype. */ +typedef float DSL_float_t; +/** This is the void datatype. */ +typedef void DSL_void_t; +/** integer type, width is depending on processor arch */ +typedef int DSL_int_t; +/** unsigned integer type, width is depending on processor arch */ +typedef unsigned int DSL_uint_t; +typedef struct file DSL_DRV_file_t; +typedef struct inode DSL_DRV_inode_t; + +/** + * Defines all possible CMV groups + * */ +typedef enum { + DSL_CMV_GROUP_CNTL = 1, + DSL_CMV_GROUP_STAT = 2, + DSL_CMV_GROUP_INFO = 3, + DSL_CMV_GROUP_TEST = 4, + DSL_CMV_GROUP_OPTN = 5, + DSL_CMV_GROUP_RATE = 6, + DSL_CMV_GROUP_PLAM = 7, + DSL_CMV_GROUP_CNFG = 8 +} DSL_CmvGroup_t; +/** + * Defines all opcode types + * */ +typedef enum { + H2D_CMV_READ = 0x00, + H2D_CMV_WRITE = 0x04, + H2D_CMV_INDICATE_REPLY = 0x10, + H2D_ERROR_OPCODE_UNKNOWN =0x20, + H2D_ERROR_CMV_UNKNOWN =0x30, + + D2H_CMV_READ_REPLY =0x01, + D2H_CMV_WRITE_REPLY = 0x05, + D2H_CMV_INDICATE = 0x11, + D2H_ERROR_OPCODE_UNKNOWN = 0x21, + D2H_ERROR_CMV_UNKNOWN = 0x31, + D2H_ERROR_CMV_READ_NOT_AVAILABLE = 0x41, + D2H_ERROR_CMV_WRITE_ONLY = 0x51, + D2H_ERROR_CMV_READ_ONLY = 0x61, + + H2D_DEBUG_READ_DM = 0x02, + H2D_DEBUG_READ_PM = 0x06, + H2D_DEBUG_WRITE_DM = 0x0a, + H2D_DEBUG_WRITE_PM = 0x0e, + + D2H_DEBUG_READ_DM_REPLY = 0x03, + D2H_DEBUG_READ_FM_REPLY = 0x07, + D2H_DEBUG_WRITE_DM_REPLY = 0x0b, + D2H_DEBUG_WRITE_FM_REPLY = 0x0f, + D2H_ERROR_ADDR_UNKNOWN = 0x33, + + D2H_AUTONOMOUS_MODEM_READY_MSG = 0xf1 +} DSL_CmvOpcode_t; + +/* mutex macros */ +#define MEI_MUTEX_INIT(id,flag) \ + sema_init(&id,flag) +#define MEI_MUTEX_LOCK(id) \ + down_interruptible(&id) +#define MEI_MUTEX_UNLOCK(id) \ + up(&id) +#define MEI_WAIT(ms) \ + {\ + set_current_state(TASK_INTERRUPTIBLE);\ + schedule_timeout(ms);\ + } +#define MEI_INIT_WAKELIST(name,queue) \ + init_waitqueue_head(&queue) + +/* wait for an event, timeout is measured in ms */ +#define MEI_WAIT_EVENT_TIMEOUT(ev,timeout)\ + interruptible_sleep_on_timeout(&ev,timeout * HZ / 1000) +#define MEI_WAKEUP_EVENT(ev)\ + wake_up_interruptible(&ev) +#endif /* IFX_MEI_BSP */ + +/*** Register address offsets, relative to MEI_SPACE_ADDRESS ***/ +#define ME_DX_DATA (0x0000) +#define ME_VERSION (0x0004) +#define ME_ARC_GP_STAT (0x0008) +#define ME_DX_STAT (0x000C) +#define ME_DX_AD (0x0010) +#define ME_DX_MWS (0x0014) +#define ME_ME2ARC_INT (0x0018) +#define ME_ARC2ME_STAT (0x001C) +#define ME_ARC2ME_MASK (0x0020) +#define ME_DBG_WR_AD (0x0024) +#define ME_DBG_RD_AD (0x0028) +#define ME_DBG_DATA (0x002C) +#define ME_DBG_DECODE (0x0030) +#define ME_CONFIG (0x0034) +#define ME_RST_CTRL (0x0038) +#define ME_DBG_MASTER (0x003C) +#define ME_CLK_CTRL (0x0040) +#define ME_BIST_CTRL (0x0044) +#define ME_BIST_STAT (0x0048) +#define ME_XDATA_BASE_SH (0x004c) +#define ME_XDATA_BASE (0x0050) +#define ME_XMEM_BAR_BASE (0x0054) +#define ME_XMEM_BAR0 (0x0054) +#define ME_XMEM_BAR1 (0x0058) +#define ME_XMEM_BAR2 (0x005C) +#define ME_XMEM_BAR3 (0x0060) +#define ME_XMEM_BAR4 (0x0064) +#define ME_XMEM_BAR5 (0x0068) +#define ME_XMEM_BAR6 (0x006C) +#define ME_XMEM_BAR7 (0x0070) +#define ME_XMEM_BAR8 (0x0074) +#define ME_XMEM_BAR9 (0x0078) +#define ME_XMEM_BAR10 (0x007C) +#define ME_XMEM_BAR11 (0x0080) +#define ME_XMEM_BAR12 (0x0084) +#define ME_XMEM_BAR13 (0x0088) +#define ME_XMEM_BAR14 (0x008C) +#define ME_XMEM_BAR15 (0x0090) +#define ME_XMEM_BAR16 (0x0094) + +#define WHILE_DELAY 20000 +/* +** Define where in ME Processor's memory map the Stratify chip lives +*/ + +#define MAXSWAPSIZE (8 * 1024) //8k *(32bits) + +// Mailboxes +#define MSG_LENGTH 16 // x16 bits +#define YES_REPLY 1 +#define NO_REPLY 0 + +#define CMV_TIMEOUT 1000 //jiffies + +// Block size per BAR +#define SDRAM_SEGMENT_SIZE (64*1024) +// Number of Bar registers +#define MAX_BAR_REGISTERS (17) + +#define XDATA_REGISTER (15) + +// ARC register addresss +#define ARC_STATUS 0x0 +#define ARC_LP_START 0x2 +#define ARC_LP_END 0x3 +#define ARC_DEBUG 0x5 +#define ARC_INT_MASK 0x10A + +#define IRAM0_BASE (0x00000) +#define IRAM1_BASE (0x04000) +#if defined(CONFIG_DANUBE) +#define BRAM_BASE (0x0A000) +#elif defined(CONFIG_AMAZON_SE) || defined(CONFIG_AR9) || defined(CONFIG_VR9) +#define BRAM_BASE (0x08000) +#endif +#define XRAM_BASE (0x18000) +#define YRAM_BASE (0x1A000) +#define EXT_MEM_BASE (0x80000) +#define ARC_GPIO_CTRL (0xC030) +#define ARC_GPIO_DATA (0xC034) + +#define IRAM0_SIZE (16*1024) +#define IRAM1_SIZE (16*1024) +#define BRAM_SIZE (12*1024) +#define XRAM_SIZE (8*1024) +#define YRAM_SIZE (8*1024) +#define EXT_MEM_SIZE (1536*1024) + +#define ADSL_BASE (0x20000) +#define CRI_BASE (ADSL_BASE + 0x11F00) +#define CRI_CCR0 (CRI_BASE + 0x00) +#define CRI_RST (CRI_BASE + 0x04*4) +#define ADSL_DILV_BASE (ADSL_BASE+0x20000) + +// +#define IRAM0_ADDR_BIT_MASK 0xFFF +#define IRAM1_ADDR_BIT_MASK 0xFFF +#define BRAM_ADDR_BIT_MASK 0xFFF +#define RX_DILV_ADDR_BIT_MASK 0x1FFF + +/*** Bit definitions ***/ +#define ARC_AUX_HALT (1 << 25) +#define ARC_DEBUG_HALT (1 << 1) +#define FALSE 0 +#define TRUE 1 +#define BIT0 (1<<0) +#define BIT1 (1<<1) +#define BIT2 (1<<2) +#define BIT3 (1<<3) +#define BIT4 (1<<4) +#define BIT5 (1<<5) +#define BIT6 (1<<6) +#define BIT7 (1<<7) +#define BIT8 (1<<8) +#define BIT9 (1<<9) +#define BIT10 (1<<10) +#define BIT11 (1<<11) +#define BIT12 (1<<12) +#define BIT13 (1<<13) +#define BIT14 (1<<14) +#define BIT15 (1<<15) +#define BIT16 (1<<16) +#define BIT17 (1<<17) +#define BIT18 (1<<18) +#define BIT19 (1<<19) +#define BIT20 (1<<20) +#define BIT21 (1<<21) +#define BIT22 (1<<22) +#define BIT23 (1<<23) +#define BIT24 (1<<24) +#define BIT25 (1<<25) +#define BIT26 (1<<26) +#define BIT27 (1<<27) +#define BIT28 (1<<28) +#define BIT29 (1<<29) +#define BIT30 (1<<30) +#define BIT31 (1<<31) + +// CRI_CCR0 Register definitions +#define CLK_2M_MODE_ENABLE BIT6 +#define ACL_CLK_MODE_ENABLE BIT4 +#define FDF_CLK_MODE_ENABLE BIT2 +#define STM_CLK_MODE_ENABLE BIT0 + +// CRI_RST Register definitions +#define FDF_SRST BIT3 +#define MTE_SRST BIT2 +#define FCI_SRST BIT1 +#define AAI_SRST BIT0 + +// MEI_TO_ARC_INTERRUPT Register definitions +#define MEI_TO_ARC_INT1 BIT3 +#define MEI_TO_ARC_INT0 BIT2 +#define MEI_TO_ARC_CS_DONE BIT1 //need to check +#define MEI_TO_ARC_MSGAV BIT0 + +// ARC_TO_MEI_INTERRUPT Register definitions +#define ARC_TO_MEI_INT1 BIT8 +#define ARC_TO_MEI_INT0 BIT7 +#define ARC_TO_MEI_CS_REQ BIT6 +#define ARC_TO_MEI_DBG_DONE BIT5 +#define ARC_TO_MEI_MSGACK BIT4 +#define ARC_TO_MEI_NO_ACCESS BIT3 +#define ARC_TO_MEI_CHECK_AAITX BIT2 +#define ARC_TO_MEI_CHECK_AAIRX BIT1 +#define ARC_TO_MEI_MSGAV BIT0 + +// ARC_TO_MEI_INTERRUPT_MASK Register definitions +#define GP_INT1_EN BIT8 +#define GP_INT0_EN BIT7 +#define CS_REQ_EN BIT6 +#define DBG_DONE_EN BIT5 +#define MSGACK_EN BIT4 +#define NO_ACC_EN BIT3 +#define AAITX_EN BIT2 +#define AAIRX_EN BIT1 +#define MSGAV_EN BIT0 + +#define MEI_SOFT_RESET BIT0 + +#define HOST_MSTR BIT0 + +#define JTAG_MASTER_MODE 0x0 +#define MEI_MASTER_MODE HOST_MSTR + +// MEI_DEBUG_DECODE Register definitions +#define MEI_DEBUG_DEC_MASK (0x3) +#define MEI_DEBUG_DEC_AUX_MASK (0x0) +#define ME_DBG_DECODE_DMP1_MASK (0x1) +#define MEI_DEBUG_DEC_DMP2_MASK (0x2) +#define MEI_DEBUG_DEC_CORE_MASK (0x3) + +#define AUX_STATUS (0x0) +#define AUX_ARC_GPIO_CTRL (0x10C) +#define AUX_ARC_GPIO_DATA (0x10D) +// ARC_TO_MEI_MAILBOX[11] is a special location used to indicate +// page swap requests. +#if defined(CONFIG_DANUBE) +#define OMBOX_BASE 0xDF80 +#define ARC_TO_MEI_MAILBOX 0xDFA0 +#define IMBOX_BASE 0xDFC0 +#define MEI_TO_ARC_MAILBOX 0xDFD0 +#elif defined(CONFIG_AMAZON_SE) || defined(CONFIG_AR9) || defined(CONFIG_VR9) +#define OMBOX_BASE 0xAF80 +#define ARC_TO_MEI_MAILBOX 0xAFA0 +#define IMBOX_BASE 0xAFC0 +#define MEI_TO_ARC_MAILBOX 0xAFD0 +#endif + +#define MEI_TO_ARC_MAILBOXR (MEI_TO_ARC_MAILBOX + 0x2C) +#define ARC_MEI_MAILBOXR (ARC_TO_MEI_MAILBOX + 0x2C) +#define OMBOX1 (OMBOX_BASE+0x4) + +// Codeswap request messages are indicated by setting BIT31 +#define OMB_CODESWAP_MESSAGE_MSG_TYPE_MASK (0x80000000) + +// Clear Eoc messages received are indicated by setting BIT17 +#define OMB_CLEAREOC_INTERRUPT_CODE (0x00020000) +#define OMB_REBOOT_INTERRUPT_CODE (1 << 18) + +/* +** Swap page header +*/ +// Page must be loaded at boot time if size field has BIT31 set +#define BOOT_FLAG (BIT31) +#define BOOT_FLAG_MASK ~BOOT_FLAG + +#define FREE_RELOAD 1 +#define FREE_SHOWTIME 2 +#define FREE_ALL 3 + +// marcos +#define IFX_MEI_WRITE_REGISTER_L(data,addr) *((volatile u32*)(addr)) = (u32)(data) +#define IFX_MEI_READ_REGISTER_L(addr) (*((volatile u32*)(addr))) +#define SET_BIT(reg, mask) reg |= (mask) +#define CLEAR_BIT(reg, mask) reg &= (~mask) +#define CLEAR_BITS(reg, mask) CLEAR_BIT(reg, mask) +//#define SET_BITS(reg, mask) SET_BIT(reg, mask) +#define SET_BITFIELD(reg, mask, off, val) {reg &= (~mask); reg |= (val << off);} + +#define ALIGN_SIZE ( 1L<<10 ) //1K size align +#define MEM_ALIGN(addr) (((addr) + ALIGN_SIZE - 1) & ~ (ALIGN_SIZE -1) ) + +// swap marco +#define MEI_HALF_WORD_SWAP(data) {data = ((data & 0xffff)<<16) + ((data & 0xffff0000)>>16);} +#define MEI_BYTE_SWAP(data) {data = ((data & 0xff)<<24) + ((data & 0xff00)<<8)+ ((data & 0xff0000)>>8)+ ((data & 0xff000000)>>24);} + + +#ifdef CONFIG_PROC_FS +typedef struct reg_entry +{ + int *flag; + char name[30]; /* big enough to hold names */ + char description[100]; /* big enough to hold description */ + unsigned short low_ino; +} reg_entry_t; +#endif +// Swap page header describes size in 32-bit words, load location, and image offset +// for program and/or data segments +typedef struct _arc_swp_page_hdr { + u32 p_offset; //Offset bytes of progseg from beginning of image + u32 p_dest; //Destination addr of progseg on processor + u32 p_size; //Size in 32-bitwords of program segment + u32 d_offset; //Offset bytes of dataseg from beginning of image + u32 d_dest; //Destination addr of dataseg on processor + u32 d_size; //Size in 32-bitwords of data segment +} ARC_SWP_PAGE_HDR; + +/* +** Swap image header +*/ +#define GET_PROG 0 // Flag used for program mem segment +#define GET_DATA 1 // Flag used for data mem segment + +// Image header contains size of image, checksum for image, and count of +// page headers. Following that are 'count' page headers followed by +// the code and/or data segments to be loaded +typedef struct _arc_img_hdr { + u32 size; // Size of binary image in bytes + u32 checksum; // Checksum for image + u32 count; // Count of swp pages in image + ARC_SWP_PAGE_HDR page[1]; // Should be "count" pages - '1' to make compiler happy +} ARC_IMG_HDR; + +typedef struct smmu_mem_info { + int type; + int boot; + unsigned long nCopy; + unsigned long size; + unsigned char *address; + unsigned char *org_address; +} smmu_mem_info_t; + +#ifdef __KERNEL__ +typedef struct ifx_mei_device_private { + int modem_ready; + int arcmsgav; + int cmv_reply; + int cmv_waiting; + // Mei to ARC CMV count, reply count, ARC Indicator count + int modem_ready_cnt; + int cmv_count; + int reply_count; + unsigned long image_size; + int nBar; + u16 Recent_indicator[MSG_LENGTH]; + + u16 CMV_RxMsg[MSG_LENGTH] __attribute__ ((aligned (4))); + + smmu_mem_info_t adsl_mem_info[MAX_BAR_REGISTERS]; + ARC_IMG_HDR *img_hdr; + // to wait for arc cmv reply, sleep on wait_queue_arcmsgav; + wait_queue_head_t wait_queue_arcmsgav; + wait_queue_head_t wait_queue_modemready; + struct semaphore mei_cmv_sema; +} ifx_mei_device_private_t; +#endif +typedef struct winhost_message { + union { + u16 RxMessage[MSG_LENGTH] __attribute__ ((aligned (4))); + u16 TxMessage[MSG_LENGTH] __attribute__ ((aligned (4))); + } msg; +} DSL_DEV_WinHost_Message_t; +/******************************************************************************************************** + * DSL CPE API Driver Stack Interface Definitions + * *****************************************************************************************************/ +/** IOCTL codes for bsp driver */ +#define DSL_IOC_MEI_BSP_MAGIC 's' + +#define DSL_FIO_BSP_DSL_START _IO (DSL_IOC_MEI_BSP_MAGIC, 0) +#define DSL_FIO_BSP_RUN _IO (DSL_IOC_MEI_BSP_MAGIC, 1) +#define DSL_FIO_BSP_FREE_RESOURCE _IO (DSL_IOC_MEI_BSP_MAGIC, 2) +#define DSL_FIO_BSP_RESET _IO (DSL_IOC_MEI_BSP_MAGIC, 3) +#define DSL_FIO_BSP_REBOOT _IO (DSL_IOC_MEI_BSP_MAGIC, 4) +#define DSL_FIO_BSP_HALT _IO (DSL_IOC_MEI_BSP_MAGIC, 5) +#define DSL_FIO_BSP_BOOTDOWNLOAD _IO (DSL_IOC_MEI_BSP_MAGIC, 6) +#define DSL_FIO_BSP_JTAG_ENABLE _IO (DSL_IOC_MEI_BSP_MAGIC, 7) +#define DSL_FIO_FREE_RESOURCE _IO (DSL_IOC_MEI_BSP_MAGIC, 8) +#define DSL_FIO_ARC_MUX_TEST _IO (DSL_IOC_MEI_BSP_MAGIC, 9) +#define DSL_FIO_BSP_REMOTE _IOW (DSL_IOC_MEI_BSP_MAGIC, 10, u32) +#define DSL_FIO_BSP_GET_BASE_ADDRESS _IOR (DSL_IOC_MEI_BSP_MAGIC, 11, u32) +#define DSL_FIO_BSP_IS_MODEM_READY _IOR (DSL_IOC_MEI_BSP_MAGIC, 12, u32) +#define DSL_FIO_BSP_GET_VERSION _IOR (DSL_IOC_MEI_BSP_MAGIC, 13, DSL_DEV_Version_t) +#define DSL_FIO_BSP_CMV_WINHOST _IOWR(DSL_IOC_MEI_BSP_MAGIC, 14, DSL_DEV_WinHost_Message_t) +#define DSL_FIO_BSP_CMV_READ _IOWR(DSL_IOC_MEI_BSP_MAGIC, 15, DSL_DEV_MeiReg_t) +#define DSL_FIO_BSP_CMV_WRITE _IOW (DSL_IOC_MEI_BSP_MAGIC, 16, DSL_DEV_MeiReg_t) +#define DSL_FIO_BSP_DEBUG_READ _IOWR(DSL_IOC_MEI_BSP_MAGIC, 17, DSL_DEV_MeiDebug_t) +#define DSL_FIO_BSP_DEBUG_WRITE _IOWR(DSL_IOC_MEI_BSP_MAGIC, 18, DSL_DEV_MeiDebug_t) +#define DSL_FIO_BSP_GET_CHIP_INFO _IOR (DSL_IOC_MEI_BSP_MAGIC, 19, DSL_DEV_HwVersion_t) + +#define DSL_DEV_MEIDEBUG_BUFFER_SIZES 512 + +typedef struct DSL_DEV_MeiDebug +{ + DSL_uint32_t iAddress; + DSL_uint32_t iCount; + DSL_uint32_t buffer[DSL_DEV_MEIDEBUG_BUFFER_SIZES]; +} DSL_DEV_MeiDebug_t; /* meidebug */ + +/** + * Structure is used for debug access only. + * Refer to configure option INCLUDE_ADSL_WINHOST_DEBUG */ +typedef struct struct_meireg +{ + /* + * Specifies that address for debug access */ + unsigned long iAddress; + /* + * Specifies the pointer to the data that has to be written or returns a + * pointer to the data that has been read out*/ + unsigned long iData; +} DSL_DEV_MeiReg_t; /* meireg */ + +typedef struct DSL_DEV_Device +{ + DSL_int_t nInUse; /* modem state, update by bsp driver, */ + DSL_void_t *pPriv; + DSL_uint32_t base_address; /* mei base address */ + DSL_int_t nIrq[2]; /* irq number */ +#define IFX_DFEIR 0 +#define IFX_DYING_GASP 1 + DSL_DEV_MeiDebug_t lop_debugwr; /* dying gasp */ +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)) + struct module *owner; +#endif +} DSL_DEV_Device_t; /* ifx_adsl_device_t */ + +#define DSL_DEV_PRIVATE(dev) ((ifx_mei_device_private_t*)(dev->pPriv)) + +typedef struct DSL_DEV_Version /* ifx_adsl_bsp_version */ +{ + unsigned long major; + unsigned long minor; + unsigned long revision; +} DSL_DEV_Version_t; /* ifx_adsl_bsp_version_t */ + +typedef struct DSL_DEV_ChipInfo +{ + unsigned long major; + unsigned long minor; +} DSL_DEV_HwVersion_t; + +typedef struct +{ + DSL_uint8_t dummy; +} DSL_DEV_DeviceConfig_t; + +/** error code definitions */ +typedef enum DSL_DEV_MeiError +{ + DSL_DEV_MEI_ERR_SUCCESS = 0, + DSL_DEV_MEI_ERR_FAILURE = -1, + DSL_DEV_MEI_ERR_MAILBOX_FULL = -2, + DSL_DEV_MEI_ERR_MAILBOX_EMPTY = -3, + DSL_DEV_MEI_ERR_MAILBOX_TIMEOUT = -4 +} DSL_DEV_MeiError_t; /* MEI_ERROR */ + +typedef enum { + DSL_BSP_MEMORY_READ=0, + DSL_BSP_MEMORY_WRITE, +} DSL_BSP_MemoryAccessType_t; /* ifx_adsl_memory_access_type_t */ + +typedef enum +{ + DSL_LED_LINK_ID=0, + DSL_LED_DATA_ID +} DSL_DEV_LedId_t; /* ifx_adsl_led_id_t */ + +typedef enum +{ + DSL_LED_LINK_TYPE=0, + DSL_LED_DATA_TYPE +} DSL_DEV_LedType_t; /* ifx_adsl_led_type_t */ + +typedef enum +{ + DSL_LED_HD_CPU=0, + DSL_LED_HD_FW +} DSL_DEV_LedHandler_t; /* ifx_adsl_led_handler_t */ + +typedef enum { + DSL_LED_ON=0, + DSL_LED_OFF, + DSL_LED_FLASH, +} DSL_DEV_LedMode_t; /* ifx_adsl_led_mode_t */ + +typedef enum { + DSL_CPU_HALT=0, + DSL_CPU_RUN, + DSL_CPU_RESET, +} DSL_DEV_CpuMode_t; /* ifx_adsl_cpu_mode_t */ + +#if 0 +typedef enum { + DSL_BSP_EVENT_DYING_GASP = 0, + DSL_BSP_EVENT_CEOC_IRQ, +} DSL_BSP_Event_id_t; /* ifx_adsl_event_id_t */ + +typedef union DSL_BSP_CB_Param +{ + DSL_uint32_t nIrqMessage; +} DSL_BSP_CB_Param_t; /* ifx_adsl_cbparam_t */ + +typedef struct DSL_BSP_CB_Event +{ + DSL_BSP_Event_id_t nID; + DSL_DEV_Device_t *pDev; + DSL_BSP_CB_Param_t *pParam; +} DSL_BSP_CB_Event_t; /* ifx_adsl_cb_event_t */ +#endif + +/* external functions (from the BSP Driver) */ +extern DSL_DEV_Device_t* DSL_BSP_DriverHandleGet(int, int); +extern DSL_int_t DSL_BSP_DriverHandleDelete(DSL_DEV_Device_t *); +extern DSL_DEV_MeiError_t DSL_BSP_FWDownload(DSL_DEV_Device_t *, const DSL_char_t *, DSL_uint32_t, DSL_int32_t *, DSL_int32_t *); +extern int DSL_BSP_KernelIoctls(DSL_DEV_Device_t *, unsigned int, unsigned long); +extern DSL_DEV_MeiError_t DSL_BSP_SendCMV(DSL_DEV_Device_t *, DSL_uint16_t *, DSL_int_t, DSL_uint16_t *); +extern DSL_DEV_MeiError_t DSL_BSP_AdslLedInit(DSL_DEV_Device_t *, DSL_DEV_LedId_t, DSL_DEV_LedType_t, DSL_DEV_LedHandler_t); +extern DSL_DEV_MeiError_t DSL_BSP_Showtime(DSL_DEV_Device_t *, DSL_uint32_t, DSL_uint32_t); +extern int DSL_BSP_ATMLedCBRegister( int (*ifx_adsl_ledcallback)(void)); +extern DSL_DEV_MeiError_t DSL_BSP_MemoryDebugAccess(DSL_DEV_Device_t *, DSL_BSP_MemoryAccessType_t, DSL_uint32_t, DSL_uint32_t *, DSL_uint32_t); +extern volatile DSL_DEV_Device_t *adsl_dev; + +/** + * Dummy structure by now to show mechanism of extended data that will be + * provided within event callback itself. + * */ +typedef struct +{ + /** + * Dummy value */ + DSL_uint32_t nDummy1; +} DSL_BSP_CB_Event1DataDummy_t; + +/** + * Dummy structure by now to show mechanism of extended data that will be + * provided within event callback itself. + * */ +typedef struct +{ + /** + * Dummy value */ + DSL_uint32_t nDummy2; +} DSL_BSP_CB_Event2DataDummy_t; + +/** + * encapsulate all data structures that are necessary for status event + * callbacks. + * */ +typedef union +{ + DSL_BSP_CB_Event1DataDummy_t dataEvent1; + DSL_BSP_CB_Event2DataDummy_t dataEvent2; +} DSL_BSP_CB_DATA_Union_t; + + +typedef enum +{ + /** + * Informs the upper layer driver (DSL CPE API) about a reboot request from the + * firmware. + * \note This event does NOT include any additional data. + * More detailed information upon reboot reason has to be requested from + * upper layer software via CMV (INFO 109) if necessary. */ + DSL_BSP_CB_FIRST = 0, + DSL_BSP_CB_DYING_GASP, + DSL_BSP_CB_CEOC_IRQ, + DSL_BSP_CB_FIRMWARE_REBOOT, + /** + * Delimiter only */ + DSL_BSP_CB_LAST +} DSL_BSP_CB_Type_t; + +/** + * Specifies the common event type that has to be used for registering and + * signalling of interrupts/autonomous status events from MEI BSP Driver. + * + * \param pDev + * Context pointer from MEI BSP Driver. + * + * \param IFX_ADSL_BSP_CallbackType_t + * Specifies the event callback type (reason of callback). Regrading to the + * setting of this value the data which is included in the following union + * might have different meanings. + * Please refer to the description of the union to get information about the + * meaning of the included data. + * + * \param pData + * Data according to \ref DSL_BSP_CB_DATA_Union_t. + * If this pointer is NULL there is no additional data available. + * + * \return depending on event + */ +typedef int (*DSL_BSP_EventCallback_t) +( + DSL_DEV_Device_t *pDev, + DSL_BSP_CB_Type_t nCallbackType, + DSL_BSP_CB_DATA_Union_t *pData +); + +typedef struct { + DSL_BSP_EventCallback_t function; + DSL_BSP_CB_Type_t event; + DSL_BSP_CB_DATA_Union_t *pData; +} DSL_BSP_EventCallBack_t; + +extern int DSL_BSP_EventCBRegister(DSL_BSP_EventCallBack_t *); +extern int DSL_BSP_EventCBUnregister(DSL_BSP_EventCallBack_t *); + +/** Modem states */ +#define DSL_DEV_STAT_InitState 0x0000 +#define DSL_DEV_STAT_ReadyState 0x0001 +#define DSL_DEV_STAT_FailState 0x0002 +#define DSL_DEV_STAT_IdleState 0x0003 +#define DSL_DEV_STAT_QuietState 0x0004 +#define DSL_DEV_STAT_GhsState 0x0005 +#define DSL_DEV_STAT_FullInitState 0x0006 +#define DSL_DEV_STAT_ShowTimeState 0x0007 +#define DSL_DEV_STAT_FastRetrainState 0x0008 +#define DSL_DEV_STAT_LoopDiagMode 0x0009 +#define DSL_DEV_STAT_ShortInit 0x000A /* Bis short initialization */ + +#define DSL_DEV_STAT_CODESWAP_COMPLETE 0x0002 + +#endif //IFXMIPS_MEI_H diff --git a/package/ifxmips-dsl-control/Makefile b/package/ifxmips-dsl-control/Makefile new file mode 100644 index 000000000..6905aeafa --- /dev/null +++ b/package/ifxmips-dsl-control/Makefile @@ -0,0 +1,84 @@ +# +# Copyright (C) 2009 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# ralph / blogic + +include $(TOPDIR)/rules.mk + +PKG_BASE_NAME:=dsl_cpe_control_danube +PKG_VERSION:=3.24.4.4 +PKG_SOURCE:=$(PKG_BASE_NAME)-$(PKG_VERSION).tar.gz +PKG_BUILD_DIR:=$(BUILD_DIR)/dsl_cpe_control-$(PKG_VERSION) +PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources/ +PKG_MD5SUM:=ee315306626b68794d3d3636dabfe161 + +include $(INCLUDE_DIR)/package.mk + +define Package/ifxmips-dsl-control + SECTION:=application + CATEGORY:=Infineon + TITLE:=DSL CPE control application + URL:=http://www.infineon.com/ + MAINTAINER:=Infineon Technologies AG / Lantiq / blogic@openwrt.org + DEPENDS:=+kmod-ifxmips-dsl-api +libpthread +endef + +define Package/ifxmips-dsl-control/description + Infineon DSL CPE API for Amazon SE, Danube and Vinax. + This package contains the DSL CPE control application for Amazon SE & Danube. + + Supported Devices: + - Amazon SE + - Danube + + This package was kindly contributed to openwrt by Infineon/Lantiq +endef + +IFX_DSL_MAX_DEVICE=1 +IFX_DSL_LINES_PER_DEVICE=1 +IFX_DSL_CHANNELS_PER_LINE=1 +#CONFIG_IFX_CLI=y + +CONFIGURE_ARGS += \ + --with-max-device="$(IFX_DSL_MAX_DEVICE)" \ + --with-lines-per-device="$(IFX_DSL_LINES_PER_DEVICE)" \ + --with-channels-per-line="$(IFX_DSL_CHANNELS_PER_LINE)" \ + --enable-danube \ + --enable-driver-include="-I$(STAGING_DIR)/usr/include" \ + --enable-debug-prints \ + --enable-add-appl-cflags="-DMAX_CLI_PIPES=2" \ + --enable-cmv-scripts \ + --enable-debug-tool-interface \ + --enable-adsl-led \ + --enable-dsl-ceoc \ + --enable-script-notification \ + --enable-dsl-pm \ + --enable-dsl-pm-total \ + --enable-dsl-pm-history \ + --enable-dsl-pm-showtime \ + --enable-dsl-pm-channel-counters \ + --enable-dsl-pm-datapath-counters \ + --enable-dsl-pm-line-counters \ + --enable-dsl-pm-channel-thresholds \ + --enable-dsl-pm-datapath-thresholds \ + --enable-dsl-pm-line-thresholds \ + --enable-dsl-pm-optional-parameters + +ifeq ($(CONFIG_IFX_CLI),y) +CONFIGURE_ARGS += \ + --enable-cli-support \ + --enable-soap-support +endif + +define Package/ifxmips-dsl-control/install + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/ifx_cpe_control_init.sh $(1)/etc/init.d/ + + $(INSTALL_DIR) $(1)/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/dsl_cpe_control $(1)/sbin +endef + +$(eval $(call BuildPackage,ifxmips-dsl-control)) diff --git a/package/ifxmips-dsl-control/files/ifx_cpe_control_init.sh b/package/ifxmips-dsl-control/files/ifx_cpe_control_init.sh new file mode 100644 index 000000000..91316938c --- /dev/null +++ b/package/ifxmips-dsl-control/files/ifx_cpe_control_init.sh @@ -0,0 +1,21 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2008 OpenWrt.org +START=99 + +start() { + + # start CPE dsl daemon in the background + /sbin/dsl_cpe_control -i -f /lib/firmware/ModemHWE.bin & + +# PS=`ps` +# echo $PS | grep -q dsl_cpe_control && { +# # workaround for nfs: allow write to pipes for non-root +# while [ ! -e /tmp/pipe/dsl_cpe1_ack ] ; do sleep 1; done +# chmod a+w /tmp/pipe/dsl_* +# } + echo $PS | grep -q dsl_cpe_control || { + echo "Start of dsl_cpe_control failed!!!" + false + } + +} diff --git a/target/linux/ifxmips/patches-2.6.30/201-atm.patch b/target/linux/generic-2.6/patches-2.6.30/251-atm.patch similarity index 58% rename from target/linux/ifxmips/patches-2.6.30/201-atm.patch rename to target/linux/generic-2.6/patches-2.6.30/251-atm.patch index bbf013dc3..07da34425 100644 --- a/target/linux/ifxmips/patches-2.6.30/201-atm.patch +++ b/target/linux/generic-2.6/patches-2.6.30/251-atm.patch @@ -12,15 +12,3 @@ Index: linux-2.6.28.10/include/linux/atm.h /* extra params for ABR */ unsigned int icr; /* Initial Cell Rate (24-bit) */ unsigned int tbe; /* Transient Buffer Exposure (24-bit) */ -Index: linux-2.6.28.10/kernel/time/timekeeping.c -=================================================================== ---- linux-2.6.28.10.orig/kernel/time/timekeeping.c 2009-09-02 15:41:06.000000000 +0200 -+++ linux-2.6.28.10/kernel/time/timekeeping.c 2009-09-02 15:41:23.000000000 +0200 -@@ -43,6 +43,7 @@ - * used instead. - */ - struct timespec xtime __attribute__ ((aligned (16))); -+EXPORT_SYMBOL(xtime); - struct timespec wall_to_monotonic __attribute__ ((aligned (16))); - static unsigned long total_sleep_time; /* seconds */ - diff --git a/target/linux/ifxmips/Makefile b/target/linux/ifxmips/Makefile index e72892148..14ee8831f 100644 --- a/target/linux/ifxmips/Makefile +++ b/target/linux/ifxmips/Makefile @@ -13,9 +13,10 @@ FEATURES:=squashfs jffs2 atm LINUX_VERSION:=2.6.30.9 +CFLAGS=-Os -pipe -mips32r2 -mtune=mips32r2 -funit-at-a-time + include $(INCLUDE_DIR)/target.mk -DEFAULT_PACKAGES+=uboot-ifxmips -#kmod-pppoa ppp-mod-pppoa linux-atm atm-tools br2684ctl kmod-ifxmips-atm +DEFAULT_PACKAGES+=kmod-pppoa ppp-mod-pppoa linux-atm atm-tools br2684ctl ifxmips-dsl-api ifxmips-dsl-control define Target/Description Build firmware images for Infineon Mips Controllers diff --git a/target/linux/ifxmips/base-files/etc/config/network b/target/linux/ifxmips/base-files/etc/config/network index 8f5624b4a..183e6bf34 100644 --- a/target/linux/ifxmips/base-files/etc/config/network +++ b/target/linux/ifxmips/base-files/etc/config/network @@ -23,5 +23,4 @@ config interface wan option proto pppoe option username "" option password "" - option defaultroute 0 - option unit 1 + option unit 0 diff --git a/target/linux/ifxmips/files/arch/mips/include/asm/mach-ifxmips/ifxmips_irq.h b/target/linux/ifxmips/files/arch/mips/include/asm/mach-ifxmips/ifxmips_irq.h index f84fdcb12..f3cb99c2b 100644 --- a/target/linux/ifxmips/files/arch/mips/include/asm/mach-ifxmips/ifxmips_irq.h +++ b/target/linux/ifxmips/files/arch/mips/include/asm/mach-ifxmips/ifxmips_irq.h @@ -35,6 +35,7 @@ #define IFXMIPS_SSC_RIR (INT_NUM_IM0_IRL0 + 14) #define IFXMIPS_SSC_EIR (INT_NUM_IM0_IRL0 + 16) +#define IFXMIPS_MEI_DYING_GASP_INT (INT_NUM_IM1_IRL0 + 21) #define IFXMIPS_MEI_INT (INT_NUM_IM1_IRL0 + 23) #define IFXMIPS_TIMER6_INT (INT_NUM_IM1_IRL0 + 23) diff --git a/target/linux/ifxmips/patches-2.6.30/400-atm_hack.patch b/target/linux/ifxmips/patches-2.6.30/400-atm_hack.patch new file mode 100644 index 000000000..c14d1399d --- /dev/null +++ b/target/linux/ifxmips/patches-2.6.30/400-atm_hack.patch @@ -0,0 +1,48 @@ +Index: linux-2.6.30.9/arch/mips/mm/cache.c +=================================================================== +--- linux-2.6.30.9.orig/arch/mips/mm/cache.c 2009-11-01 16:10:29.000000000 +0100 ++++ linux-2.6.30.9/arch/mips/mm/cache.c 2009-11-01 16:11:56.000000000 +0100 +@@ -52,6 +52,8 @@ + void (*_dma_cache_inv)(unsigned long start, unsigned long size); + + EXPORT_SYMBOL(_dma_cache_wback_inv); ++EXPORT_SYMBOL(_dma_cache_wback); ++EXPORT_SYMBOL(_dma_cache_inv); + + #endif /* CONFIG_DMA_NONCOHERENT */ + +Index: linux-2.6.30.9/net/atm/proc.c +=================================================================== +--- linux-2.6.30.9.orig/net/atm/proc.c 2009-11-01 16:34:42.000000000 +0100 ++++ linux-2.6.30.9/net/atm/proc.c 2009-11-01 16:35:59.000000000 +0100 +@@ -151,7 +151,7 @@ + + static void pvc_info(struct seq_file *seq, struct atm_vcc *vcc) + { +- static const char *class_name[] = { "off","UBR","CBR","VBR","ABR" }; ++ static const char *class_name[] = { "off","UBR","CBR","NTR-VBR","ABR","ANY","RT-VBR","UBR+","GFR" }; + static const char *aal_name[] = { + "---", "1", "2", "3/4", /* 0- 3 */ + "???", "5", "???", "???", /* 4- 7 */ +Index: linux-2.6.30.9/net/atm/common.c +=================================================================== +--- linux-2.6.30.9.orig/net/atm/common.c 2009-11-01 16:38:12.000000000 +0100 ++++ linux-2.6.30.9/net/atm/common.c 2009-11-01 16:47:06.000000000 +0100 +@@ -56,12 +56,17 @@ + write_unlock_irq(&vcc_sklist_lock); + } + ++struct sk_buff* (*ifx_atm_alloc_tx)(struct atm_vcc *, unsigned int) = NULL; ++EXPORT_SYMBOL(ifx_atm_alloc_tx); + + static struct sk_buff *alloc_tx(struct atm_vcc *vcc,unsigned int size) + { + struct sk_buff *skb; + struct sock *sk = sk_atm(vcc); + ++ if (ifx_atm_alloc_tx != NULL) ++ return ifx_atm_alloc_tx(vcc, size); ++ + if (atomic_read(&sk->sk_wmem_alloc) && !atm_may_send(vcc, size)) { + pr_debug("Sorry: wmem_alloc = %d, size = %d, sndbuf = %d\n", + atomic_read(&sk->sk_wmem_alloc), size, From 6e82572b177b0dd7e5949f7416e331a18a7b767f Mon Sep 17 00:00:00 2001 From: blogic Date: Sun, 1 Nov 2009 19:05:32 +0000 Subject: [PATCH 049/288] [ifxmips] clean up menuconfig path of dsl driver and userland helper git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18260 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/ifxmips-dsl-api/Makefile | 5 +++-- package/ifxmips-dsl-control/Makefile | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package/ifxmips-dsl-api/Makefile b/package/ifxmips-dsl-api/Makefile index 73d6f4f1a..992c241e1 100644 --- a/package/ifxmips-dsl-api/Makefile +++ b/package/ifxmips-dsl-api/Makefile @@ -28,8 +28,9 @@ FW_B_MD5:=349de7cd20368f4ac9b7e8322114a512 include $(INCLUDE_DIR)/package.mk define KernelPackage/ifxmips-dsl-api - SECTION:=driver - CATEGORY:=Infineon + SECTION:=sys + CATEGORY:=Kernel modules + SUBMENU:=Network Devices TITLE:=DSL CPE API driver URL:=http://www.infineon.com/ MAINTAINER:=Infineon Technologies AG / Lantiq / blogic@openwrt.org diff --git a/package/ifxmips-dsl-control/Makefile b/package/ifxmips-dsl-control/Makefile index 6905aeafa..90cefd259 100644 --- a/package/ifxmips-dsl-control/Makefile +++ b/package/ifxmips-dsl-control/Makefile @@ -18,8 +18,8 @@ PKG_MD5SUM:=ee315306626b68794d3d3636dabfe161 include $(INCLUDE_DIR)/package.mk define Package/ifxmips-dsl-control - SECTION:=application - CATEGORY:=Infineon + SECTION:=net + CATEGORY:=Network TITLE:=DSL CPE control application URL:=http://www.infineon.com/ MAINTAINER:=Infineon Technologies AG / Lantiq / blogic@openwrt.org From 17747ab1accd3feccbd4e4265183063358b39274 Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 2 Nov 2009 00:44:01 +0000 Subject: [PATCH 050/288] ixp4xx: fix weird ethernet issues with some devices caused by the ethernet packet size increase. despite what the docs day, 14320 is the largest working MRU value, not 16320 fixes #5785 for me git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18262 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../linux/ixp4xx/patches-2.6.28/304-ixp4xx_eth_jumboframe.patch | 2 +- .../linux/ixp4xx/patches-2.6.30/304-ixp4xx_eth_jumboframe.patch | 2 +- .../linux/ixp4xx/patches-2.6.31/304-ixp4xx_eth_jumboframe.patch | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target/linux/ixp4xx/patches-2.6.28/304-ixp4xx_eth_jumboframe.patch b/target/linux/ixp4xx/patches-2.6.28/304-ixp4xx_eth_jumboframe.patch index f7b5c81b6..8f76f7c27 100644 --- a/target/linux/ixp4xx/patches-2.6.28/304-ixp4xx_eth_jumboframe.patch +++ b/target/linux/ixp4xx/patches-2.6.28/304-ixp4xx_eth_jumboframe.patch @@ -5,7 +5,7 @@ #define POOL_ALLOC_SIZE (sizeof(struct desc) * (RX_DESCS + TX_DESCS)) #define REGS_SIZE 0x1000 -#define MAX_MRU 1536 /* 0x600 */ -+#define MAX_MRU (16320 - ETH_HLEN - ETH_FCS_LEN) ++#define MAX_MRU (14320 - ETH_HLEN - ETH_FCS_LEN) #define RX_BUFF_SIZE ALIGN((NET_IP_ALIGN) + MAX_MRU, 4) #define NAPI_WEIGHT 16 diff --git a/target/linux/ixp4xx/patches-2.6.30/304-ixp4xx_eth_jumboframe.patch b/target/linux/ixp4xx/patches-2.6.30/304-ixp4xx_eth_jumboframe.patch index 9ee3c904c..b4cf82437 100644 --- a/target/linux/ixp4xx/patches-2.6.30/304-ixp4xx_eth_jumboframe.patch +++ b/target/linux/ixp4xx/patches-2.6.30/304-ixp4xx_eth_jumboframe.patch @@ -5,7 +5,7 @@ #define POOL_ALLOC_SIZE (sizeof(struct desc) * (RX_DESCS + TX_DESCS)) #define REGS_SIZE 0x1000 -#define MAX_MRU 1536 /* 0x600 */ -+#define MAX_MRU (16320 - ETH_HLEN - ETH_FCS_LEN) ++#define MAX_MRU (14320 - ETH_HLEN - ETH_FCS_LEN) #define RX_BUFF_SIZE ALIGN((NET_IP_ALIGN) + MAX_MRU, 4) #define NAPI_WEIGHT 16 diff --git a/target/linux/ixp4xx/patches-2.6.31/304-ixp4xx_eth_jumboframe.patch b/target/linux/ixp4xx/patches-2.6.31/304-ixp4xx_eth_jumboframe.patch index 26f5bd953..a9cbddcf5 100644 --- a/target/linux/ixp4xx/patches-2.6.31/304-ixp4xx_eth_jumboframe.patch +++ b/target/linux/ixp4xx/patches-2.6.31/304-ixp4xx_eth_jumboframe.patch @@ -5,7 +5,7 @@ #define POOL_ALLOC_SIZE (sizeof(struct desc) * (RX_DESCS + TX_DESCS)) #define REGS_SIZE 0x1000 -#define MAX_MRU 1536 /* 0x600 */ -+#define MAX_MRU (16320 - ETH_HLEN - ETH_FCS_LEN) ++#define MAX_MRU (14320 - ETH_HLEN - ETH_FCS_LEN) #define RX_BUFF_SIZE ALIGN((NET_IP_ALIGN) + MAX_MRU, 4) #define NAPI_WEIGHT 16 From a1f7ac70653d6307b61408a5f9495f75041bd390 Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 2 Nov 2009 00:47:17 +0000 Subject: [PATCH 051/288] add binutils 2.20 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18263 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- toolchain/binutils/Config.in | 6 + toolchain/binutils/Makefile | 3 + .../patches/2.20/110-arm-eabi-conf.patch | 22 ++ .../patches/2.20/111-pr7093.elf32-arm.c.patch | 13 ++ .../binutils/patches/2.20/120-sh-conf.patch | 40 ++++ .../patches/2.20/200-mips_non_pic.patch | 202 ++++++++++++++++++ .../2.20/300-001_ld_makefile_patch.patch | 22 ++ .../2.20/300-012_check_ldrunpath_length.patch | 20 ++ 8 files changed, 328 insertions(+) create mode 100644 toolchain/binutils/patches/2.20/110-arm-eabi-conf.patch create mode 100644 toolchain/binutils/patches/2.20/111-pr7093.elf32-arm.c.patch create mode 100644 toolchain/binutils/patches/2.20/120-sh-conf.patch create mode 100644 toolchain/binutils/patches/2.20/200-mips_non_pic.patch create mode 100644 toolchain/binutils/patches/2.20/300-001_ld_makefile_patch.patch create mode 100644 toolchain/binutils/patches/2.20/300-012_check_ldrunpath_length.patch diff --git a/toolchain/binutils/Config.in b/toolchain/binutils/Config.in index 544f62bdc..65bc9c980 100644 --- a/toolchain/binutils/Config.in +++ b/toolchain/binutils/Config.in @@ -14,6 +14,11 @@ choice depends !avr32 bool "binutils 2.19.1" + config BINUTILS_VERSION_2_20 + depends !avr32 + depends !ubicom32 + bool "binutils 2.20" + config BINUTILS_VERSION_CS depends !avr32 depends !ubicom32 @@ -34,6 +39,7 @@ config BINUTILS_VERSION prompt "Binutils Version" if (TOOLCHAINOPTS && NULL) default "2.18" if BINUTILS_VERSION_2_18 default "2.19.1" if BINUTILS_VERSION_2_19_1 + default "2.20" if BINUTILS_VERSION_2_20 default "2.19.1+cs" if BINUTILS_VERSION_CS default "2.18" if avr32 default "2.19.1" diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile index 7073507de..d24151db2 100644 --- a/toolchain/binutils/Makefile +++ b/toolchain/binutils/Makefile @@ -26,6 +26,9 @@ ifeq ($(PKG_VERSION),2.19.1+cs) PKG_MD5SUM:=040740e8c864dd1a15886753f9c0bc0b HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/binutils-$(BIN_VERSION) endif +ifeq ($(PKG_VERSION),2.20) + PKG_MD5SUM:=ee2d3e996e9a2d669808713360fa96f8 +endif PATCH_DIR:=./patches/$(PKG_VERSION) diff --git a/toolchain/binutils/patches/2.20/110-arm-eabi-conf.patch b/toolchain/binutils/patches/2.20/110-arm-eabi-conf.patch new file mode 100644 index 000000000..74c9653e5 --- /dev/null +++ b/toolchain/binutils/patches/2.20/110-arm-eabi-conf.patch @@ -0,0 +1,22 @@ +--- a/configure ++++ b/configure +@@ -3086,7 +3086,7 @@ case "${target}" in + noconfigdirs="$noconfigdirs target-libffi target-qthreads" + libgloss_dir=arm + ;; +- arm*-*-linux-gnueabi) ++ arm*-*-linux-*gnueabi) + noconfigdirs="$noconfigdirs target-qthreads" + case ${with_newlib} in + no) noconfigdirs="$noconfigdirs target-newlib target-libgloss" +--- a/configure.ac ++++ b/configure.ac +@@ -573,7 +573,7 @@ case "${target}" in + noconfigdirs="$noconfigdirs target-libffi target-qthreads" + libgloss_dir=arm + ;; +- arm*-*-linux-gnueabi) ++ arm*-*-linux-*gnueabi) + noconfigdirs="$noconfigdirs target-qthreads" + case ${with_newlib} in + no) noconfigdirs="$noconfigdirs target-newlib target-libgloss" diff --git a/toolchain/binutils/patches/2.20/111-pr7093.elf32-arm.c.patch b/toolchain/binutils/patches/2.20/111-pr7093.elf32-arm.c.patch new file mode 100644 index 000000000..76aa34372 --- /dev/null +++ b/toolchain/binutils/patches/2.20/111-pr7093.elf32-arm.c.patch @@ -0,0 +1,13 @@ +--- a/bfd/elf32-arm.c ++++ b/bfd/elf32-arm.c +@@ -5511,6 +5511,10 @@ bfd_elf32_arm_init_maps (bfd *abfd) + if (! is_arm_elf (abfd)) + return; + ++ /* PR 7093: Make sure that we are dealing with an arm elf binary. */ ++ if (! is_arm_elf (abfd)) ++ return; ++ + if ((abfd->flags & DYNAMIC) != 0) + return; + diff --git a/toolchain/binutils/patches/2.20/120-sh-conf.patch b/toolchain/binutils/patches/2.20/120-sh-conf.patch new file mode 100644 index 000000000..030fff375 --- /dev/null +++ b/toolchain/binutils/patches/2.20/120-sh-conf.patch @@ -0,0 +1,40 @@ +--- a/configure ++++ b/configure +@@ -3054,7 +3054,7 @@ case "${target}" in + am33_2.0-*-linux*) + noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss" + ;; +- sh-*-linux*) ++ sh*-*-linux*) + noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss" + ;; + sh*-*-pe|mips*-*-pe|*arm-wince-pe) +@@ -3390,7 +3390,7 @@ case "${target}" in + romp-*-*) + noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}" + ;; +- sh-*-* | sh64-*-*) ++ sh*-*-* | sh64-*-*) + case "${host}" in + i[3456789]86-*-vsta) ;; # don't add gprof back in + i[3456789]86-*-go32*) ;; # don't add gprof back in +--- a/configure.ac ++++ b/configure.ac +@@ -541,7 +541,7 @@ case "${target}" in + am33_2.0-*-linux*) + noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss" + ;; +- sh-*-linux*) ++ sh*-*-linux*) + noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss" + ;; + sh*-*-pe|mips*-*-pe|*arm-wince-pe) +@@ -877,7 +877,7 @@ case "${target}" in + romp-*-*) + noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}" + ;; +- sh-*-* | sh64-*-*) ++ sh*-*-* | sh64-*-*) + case "${host}" in + i[[3456789]]86-*-vsta) ;; # don't add gprof back in + i[[3456789]]86-*-go32*) ;; # don't add gprof back in diff --git a/toolchain/binutils/patches/2.20/200-mips_non_pic.patch b/toolchain/binutils/patches/2.20/200-mips_non_pic.patch new file mode 100644 index 000000000..71799ff1f --- /dev/null +++ b/toolchain/binutils/patches/2.20/200-mips_non_pic.patch @@ -0,0 +1,202 @@ +--- a/bfd/elf32-mips.c ++++ b/bfd/elf32-mips.c +@@ -1663,6 +1663,15 @@ static const struct ecoff_debug_swap mip + #define elf_backend_plt_readonly 1 + #define elf_backend_plt_sym_val _bfd_mips_elf_plt_sym_val + ++/* Most MIPS ELF files do not contain a traditional PLT; only VxWorks ++ and non-PIC dynamic executables do. These settings only affect ++ _bfd_elf_create_dynamic_sections, which is only called when we ++ do want a traditional PLT. */ ++#undef elf_backend_want_plt_sym ++#define elf_backend_want_plt_sym 1 ++#undef elf_backend_plt_readonly ++#define elf_backend_plt_readonly 1 ++ + #define elf_backend_discard_info _bfd_mips_elf_discard_info + #define elf_backend_ignore_discarded_relocs \ + _bfd_mips_elf_ignore_discarded_relocs +@@ -1687,6 +1696,8 @@ static const struct ecoff_debug_swap mip + #define bfd_elf32_bfd_print_private_bfd_data \ + _bfd_mips_elf_print_private_bfd_data + ++#define elf_backend_plt_sym_val _bfd_mips_elf_plt_sym_val ++ + /* Support for SGI-ish mips targets. */ + #define TARGET_LITTLE_SYM bfd_elf32_littlemips_vec + #define TARGET_LITTLE_NAME "elf32-littlemips" +@@ -1790,6 +1801,7 @@ mips_vxworks_final_write_processing (bfd + #undef elf_backend_additional_program_headers + #undef elf_backend_modify_segment_map + #undef elf_backend_symbol_processing ++#undef elf_backend_plt_sym_val + /* NOTE: elf_backend_rela_normal is not defined for MIPS. */ + + #include "elf32-target.h" +--- a/bfd/elfxx-mips.c ++++ b/bfd/elfxx-mips.c +@@ -694,6 +694,11 @@ static bfd *reldyn_sorting_bfd; + /* Nonzero if ABFD is using NewABI conventions. */ + #define NEWABI_P(abfd) (ABI_N32_P (abfd) || ABI_64_P (abfd)) + ++/* Nonzero if ABFD is a non-PIC object. */ ++#define NON_PIC_P(abfd) \ ++ (((elf_elfheader (abfd)->e_flags & EF_MIPS_PIC) == 0) \ ++ && ((elf_elfheader (abfd)->e_flags & EF_MIPS_CPIC) == EF_MIPS_CPIC)) ++ + /* The IRIX compatibility level we are striving for. */ + #define IRIX_COMPAT(abfd) \ + (get_elf_backend_data (abfd)->elf_backend_mips_irix_compat (abfd)) +@@ -706,6 +711,9 @@ static bfd *reldyn_sorting_bfd; + #define MIPS_ELF_OPTIONS_SECTION_NAME(abfd) \ + (NEWABI_P (abfd) ? ".MIPS.options" : ".options") + ++/* The name of the section holding non-PIC to PIC call stubs. */ ++#define NON_PIC_TO_PIC_STUB_SECTION_NAME ".MIPS.pic_stubs" ++ + /* True if NAME is the recognized name of any SHT_MIPS_OPTIONS section. + Some IRIX system files do not use MIPS_ELF_OPTIONS_SECTION_NAME. */ + #define MIPS_ELF_OPTIONS_SECTION_NAME_P(NAME) \ +@@ -7619,7 +7627,9 @@ _bfd_mips_elf_check_relocs (bfd *abfd, s + + /* We need a stub, not a plt entry for the undefined + function. But we record it as if it needs plt. See +- _bfd_elf_adjust_dynamic_symbol. */ ++ _bfd_elf_adjust_dynamic_symbol. Note that these relocations ++ are always used for PIC calls, even when using the new ++ non-PIC ABI. */ + h->needs_plt = 1; + h->type = STT_FUNC; + } +@@ -7725,6 +7735,8 @@ _bfd_mips_elf_check_relocs (bfd *abfd, s + case R_MIPS_32: + case R_MIPS_REL32: + case R_MIPS_64: ++ if (h != NULL) ++ h->non_got_ref = TRUE; + /* In VxWorks executables, references to external symbols + are handled using copy relocs or PLT stubs, so there's + no need to add a .rela.dyn entry for this relocation. */ +@@ -7780,11 +7792,21 @@ _bfd_mips_elf_check_relocs (bfd *abfd, s + case R_MIPS_GPREL16: + case R_MIPS_LITERAL: + case R_MIPS_GPREL32: ++ if (h != NULL ++ && (r_type == R_MIPS_GPREL16 || r_type == R_MIPS_GPREL32)) ++ h->non_got_ref = TRUE; ++ + if (SGI_COMPAT (abfd)) + mips_elf_hash_table (info)->compact_rel_size += + sizeof (Elf32_External_crinfo); + break; + ++ case R_MIPS_HI16: ++ case R_MIPS_LO16: ++ if (h != NULL && strcmp (h->root.root.string, "_gp_disp") != 0) ++ h->non_got_ref = TRUE; ++ break; ++ + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_MIPS_GNU_VTINHERIT: +@@ -7807,20 +7829,20 @@ _bfd_mips_elf_check_relocs (bfd *abfd, s + + /* We must not create a stub for a symbol that has relocations + related to taking the function's address. This doesn't apply to +- VxWorks, where CALL relocs refer to a .got.plt entry instead of +- a normal .got entry. */ ++ VxWorks or the non-PIC ABI, where CALL relocs refer to a ++ .got.plt entry instead of a normal .got entry. */ + if (!htab->is_vxworks && h != NULL) + switch (r_type) + { +- default: +- ((struct mips_elf_link_hash_entry *) h)->no_fn_stub = TRUE; +- break; + case R_MIPS16_CALL16: + case R_MIPS_CALL16: + case R_MIPS_CALL_HI16: + case R_MIPS_CALL_LO16: + case R_MIPS_JALR: + break; ++ default: ++ ((struct mips_elf_link_hash_entry *) h)->no_fn_stub = TRUE; ++ break; + } + + /* See if this reloc would need to refer to a MIPS16 hard-float stub, +@@ -12514,7 +12536,9 @@ _bfd_mips_elf_merge_private_bfd_data (bf + break; + } + } +- if (null_input_bfd) ++ /* Dynamic objects normally have no sections, and do not reach ++ here - but they might if used as DYNOBJ. */ ++ if (null_input_bfd || (ibfd->flags & DYNAMIC) != 0) + return TRUE; + + ok = TRUE; +--- a/bfd/elfxx-mips.h ++++ b/bfd/elfxx-mips.h +@@ -63,6 +63,9 @@ extern bfd_boolean _bfd_mips_elf_finish_ + extern bfd_boolean _bfd_mips_vxworks_finish_dynamic_symbol + (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, + Elf_Internal_Sym *); ++extern bfd_boolean _bfd_mips_nonpic_finish_dynamic_symbol ++ (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, ++ Elf_Internal_Sym *); + extern bfd_boolean _bfd_mips_elf_finish_dynamic_sections + (bfd *, struct bfd_link_info *); + extern void _bfd_mips_elf_final_write_processing +@@ -153,6 +156,15 @@ extern const struct bfd_elf_special_sect + + extern bfd_boolean _bfd_mips_elf_common_definition (Elf_Internal_Sym *); + ++extern bfd_vma _bfd_mips_elf_plt_sym_val ++ (bfd_vma, const asection *, const arelent *); ++extern void _bfd_mips_elf_begin_write_processing ++ (bfd *abfd, struct bfd_link_info *link_info); ++extern bfd_boolean bfd_mips_elf_maybe_create_non_pic_to_pic_stubs_section ++ (struct bfd_link_info *); ++extern void _bfd_mips_post_process_headers ++ (bfd *abfd, struct bfd_link_info *link_info); ++ + #define elf_backend_common_definition _bfd_mips_elf_common_definition + #define elf_backend_name_local_section_symbols \ + _bfd_mips_elf_name_local_section_symbols +--- a/gas/config/tc-mips.c ++++ b/gas/config/tc-mips.c +@@ -1891,6 +1891,12 @@ md_begin (void) + as_bad (_("-G may not be used in position-independent code")); + g_switch_value = 0; + } ++ else if (mips_abicalls) ++ { ++ if (g_switch_seen && g_switch_value != 0) ++ as_bad (_("-G may not be used with abicalls")); ++ g_switch_value = 0; ++ } + + if (! bfd_set_arch_mach (stdoutput, bfd_arch_mips, file_mips_arch)) + as_warn (_("Could not set architecture and machine")); +@@ -11359,6 +11365,8 @@ struct option md_longopts[] = + {"mpdr", no_argument, NULL, OPTION_PDR}, + {"mno-pdr", no_argument, NULL, OPTION_NO_PDR}, + {"mvxworks-pic", no_argument, NULL, OPTION_MVXWORKS_PIC}, ++#define OPTION_NON_PIC_ABICALLS (OPTION_ELF_BASE + 13) ++ {"mnon-pic-abicalls", no_argument, NULL, OPTION_NON_PIC_ABICALLS}, + #endif /* OBJ_ELF */ + + {NULL, no_argument, NULL, 0} +@@ -11783,6 +11791,11 @@ md_parse_option (int c, char *arg) + case OPTION_MVXWORKS_PIC: + mips_pic = VXWORKS_PIC; + break; ++ ++ case OPTION_NON_PIC_ABICALLS: ++ mips_pic = NO_PIC; ++ mips_abicalls = TRUE; ++ break; + #endif /* OBJ_ELF */ + + default: diff --git a/toolchain/binutils/patches/2.20/300-001_ld_makefile_patch.patch b/toolchain/binutils/patches/2.20/300-001_ld_makefile_patch.patch new file mode 100644 index 000000000..3ca4a5866 --- /dev/null +++ b/toolchain/binutils/patches/2.20/300-001_ld_makefile_patch.patch @@ -0,0 +1,22 @@ +--- a/ld/Makefile.am ++++ b/ld/Makefile.am +@@ -24,7 +24,7 @@ AM_CFLAGS = $(WARN_CFLAGS) + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + + EMUL = @EMUL@ + EMULATION_OFILES = @EMULATION_OFILES@ +--- a/ld/Makefile.in ++++ b/ld/Makefile.in +@@ -333,7 +333,7 @@ AM_CFLAGS = $(WARN_CFLAGS) + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + BASEDIR = $(srcdir)/.. + BFDDIR = $(BASEDIR)/bfd + INCDIR = $(BASEDIR)/include diff --git a/toolchain/binutils/patches/2.20/300-012_check_ldrunpath_length.patch b/toolchain/binutils/patches/2.20/300-012_check_ldrunpath_length.patch new file mode 100644 index 000000000..08072a429 --- /dev/null +++ b/toolchain/binutils/patches/2.20/300-012_check_ldrunpath_length.patch @@ -0,0 +1,20 @@ +--- a/ld/emultempl/elf32.em ++++ b/ld/emultempl/elf32.em +@@ -1233,6 +1233,8 @@ fragment < Date: Mon, 2 Nov 2009 00:47:21 +0000 Subject: [PATCH 052/288] add cloog and ppl to the tools build for the graphite framework in gcc 4.4 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18264 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- tools/Makefile | 5 +++++ tools/cloog/Makefile | 42 ++++++++++++++++++++++++++++++++++++++++++ tools/ppl/Makefile | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 tools/cloog/Makefile create mode 100644 tools/ppl/Makefile diff --git a/tools/Makefile b/tools/Makefile index 0d91b1f95..8a5f36c28 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -19,6 +19,11 @@ tools-$(CONFIG_CCACHE) += ccache tools-$(CONFIG_powerpc) += dtc tools-dep += lzma +ifdef CONFIG_GCC_VERSION_4_4 + tools-y += ppl cloog + $(curdir)/cloog/compile := $(curdir)/ppl/install +endif + # builddir dependencies $(curdir)/pkg-config/compile := $(curdir)/sed/install $(curdir)/squashfs/compile := $(curdir)/lzma-old/install diff --git a/tools/cloog/Makefile b/tools/cloog/Makefile new file mode 100644 index 000000000..e2043b1f7 --- /dev/null +++ b/tools/cloog/Makefile @@ -0,0 +1,42 @@ +# +# Copyright (C) 2009 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +PKG_NAME:=cloog-ppl +PKG_VERSION:=0.15.7 + +PKG_SOURCE_URL:=ftp://gcc.gnu.org/pub/gcc/infrastructure +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=6455e7875daac5bd885545c71c3f2001 + +include $(INCLUDE_DIR)/host-build.mk + +unexport CFLAGS + +ifeq ($(HOST_OS),Darwin) + GNU_HOST_NAME:= + HOST_CONFIGURE_ARGS:=$(filter-out --target= --build= --host=,$(HOST_CONFIGURE_ARGS)) +endif + +HOST_CONFIGURE_VARS += \ + LIBS=-lstdc++ + +HOST_CONFIGURE_ARGS += \ + --enable-static \ + --disable-shared \ + --with-ppl=$(BUILD_DIR_HOST) + +define Host/Configure + (cd $(HOST_BUILD_DIR)/$(3); \ + $(HOST_CONFIGURE_CMD) \ + $(HOST_CONFIGURE_VARS) \ + $(HOST_CONFIGURE_ARGS); \ + ) +endef + + +$(eval $(call HostBuild)) diff --git a/tools/ppl/Makefile b/tools/ppl/Makefile new file mode 100644 index 000000000..c9c09c512 --- /dev/null +++ b/tools/ppl/Makefile @@ -0,0 +1,38 @@ +# +# Copyright (C) 2009 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +PKG_NAME:=ppl +PKG_VERSION:=0.10.2 + +PKG_SOURCE_URL:=ftp://gcc.gnu.org/pub/gcc/infrastructure +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=e7dd265afdeaea81f7e87a72b182d875 + +include $(INCLUDE_DIR)/host-build.mk + +unexport CFLAGS + +ifeq ($(HOST_OS),Darwin) + GNU_HOST_NAME:= + HOST_CONFIGURE_ARGS:=$(filter-out --target= --build= --host=,$(HOST_CONFIGURE_ARGS)) +endif + +HOST_CONFIGURE_ARGS += \ + --enable-static \ + --disable-shared + +define Host/Configure + (cd $(HOST_BUILD_DIR)/$(3); \ + $(HOST_CONFIGURE_CMD) \ + $(HOST_CONFIGURE_VARS) \ + $(HOST_CONFIGURE_ARGS); \ + ) +endef + + +$(eval $(call HostBuild)) From 07caea4e3759dde687cd3869e7d8e2c72731b7a6 Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 2 Nov 2009 00:47:24 +0000 Subject: [PATCH 053/288] binutils: fix path to cloog and ppl git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18265 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- include/toolchain-build.mk | 1 + toolchain/binutils/Makefile | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/include/toolchain-build.mk b/include/toolchain-build.mk index 08054ac9c..6defe63ed 100644 --- a/include/toolchain-build.mk +++ b/include/toolchain-build.mk @@ -7,6 +7,7 @@ override CONFIG_AUTOREBUILD= +REAL_STAGING_DIR_HOST:=$(STAGING_DIR_HOST) STAGING_DIR_HOST:=$(TOOLCHAIN_DIR) BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN) diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile index d24151db2..91d982c00 100644 --- a/toolchain/binutils/Makefile +++ b/toolchain/binutils/Makefile @@ -46,6 +46,10 @@ BINUTILS_CONFIGURE:= \ --disable-multilib \ --disable-werror \ --disable-nls \ + $(if $(CONFIG_GCC_VERSION_4_4), \ + --with-ppl=$(REAL_STAGING_DIR_HOST) \ + --with-cloog=$(REAL_STAGING_DIR_HOST) \ + ) \ $(SOFT_FLOAT_CONFIG_OPTION) \ $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS)) \ From f7eef9ce534eedd9323aa9ec2af524c9d12aa0a5 Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 2 Nov 2009 00:47:27 +0000 Subject: [PATCH 054/288] gcc: fix build with cloog/ppl git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18266 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- toolchain/gcc/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/toolchain/gcc/Makefile b/toolchain/gcc/Makefile index 77243c5fa..9d865e94d 100644 --- a/toolchain/gcc/Makefile +++ b/toolchain/gcc/Makefile @@ -90,6 +90,7 @@ GCC_CONFIGURE:= \ --disable-libmudflap \ --disable-multilib \ --disable-nls \ + $(if $(CONFIG_GCC_VERSION_4_4),--with-host-libstdcxx=-lstdc++) \ $(SOFT_FLOAT_CONFIG_OPTION) \ $(call qstrip,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS)) \ $(if $(CONFIG_mips64)$(CONFIG_mips64el),--with-arch=mips64 --with-abi=64) \ From 7e8dd669c9aa3a76c7b9855e824cfb2c9290a9fc Mon Sep 17 00:00:00 2001 From: kaloz Date: Mon, 2 Nov 2009 09:51:35 +0000 Subject: [PATCH 055/288] Switch to the squashfs-lzma code from the squashfs-devel git tree. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18267 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic-2.6/config-2.6.30 | 3 +- target/linux/generic-2.6/config-2.6.31 | 3 +- .../000-bzip_lzma_remove_nasty_hack.patch | 113 +++ .../001-squashfs_move_zlib_decomp.patch | 244 +++++ ...2-squashfs_factor_out_remaining_zlib.patch | 317 ++++++ ...-squashfs_add_decompressor_framework.patch | 426 +++++++++ ...4-squashfs_add_decompressor_lzma_lzo.patch | 54 ++ .../005-squashfs_extra_parameter.patch | 42 + .../006-squashfs_add_lzma.patch | 216 +++++ .../007-squashfs_make_lzma_available.patch | 165 ++++ .../patches-2.6.30/050-pcomp_update.patch | 280 ------ .../patches-2.6.30/051-squashfs_pcomp.patch | 234 ----- .../052-pcomp_lzma_support.patch | 901 ------------------ .../patches-2.6.30/053-squashfs_lzma.patch | 244 ----- .../001-squashfs_move_zlib_decomp.patch | 244 +++++ ...2-squashfs_factor_out_remaining_zlib.patch | 317 ++++++ ...-squashfs_add_decompressor_framework.patch | 426 +++++++++ ...4-squashfs_add_decompressor_lzma_lzo.patch | 54 ++ .../005-squashfs_extra_parameter.patch | 42 + .../006-squashfs_add_lzma.patch | 216 +++++ .../007-squashfs_make_lzma_available.patch | 165 ++++ .../patches-2.6.31/051-squashfs_pcomp.patch | 234 ----- .../052-pcomp_lzma_support.patch | 901 ------------------ .../patches-2.6.31/053-squashfs_lzma.patch | 244 ----- 24 files changed, 3045 insertions(+), 3040 deletions(-) create mode 100644 target/linux/generic-2.6/patches-2.6.30/000-bzip_lzma_remove_nasty_hack.patch create mode 100644 target/linux/generic-2.6/patches-2.6.30/001-squashfs_move_zlib_decomp.patch create mode 100644 target/linux/generic-2.6/patches-2.6.30/002-squashfs_factor_out_remaining_zlib.patch create mode 100644 target/linux/generic-2.6/patches-2.6.30/003-squashfs_add_decompressor_framework.patch create mode 100644 target/linux/generic-2.6/patches-2.6.30/004-squashfs_add_decompressor_lzma_lzo.patch create mode 100644 target/linux/generic-2.6/patches-2.6.30/005-squashfs_extra_parameter.patch create mode 100644 target/linux/generic-2.6/patches-2.6.30/006-squashfs_add_lzma.patch create mode 100644 target/linux/generic-2.6/patches-2.6.30/007-squashfs_make_lzma_available.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.30/050-pcomp_update.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.30/051-squashfs_pcomp.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.30/052-pcomp_lzma_support.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.30/053-squashfs_lzma.patch create mode 100644 target/linux/generic-2.6/patches-2.6.31/001-squashfs_move_zlib_decomp.patch create mode 100644 target/linux/generic-2.6/patches-2.6.31/002-squashfs_factor_out_remaining_zlib.patch create mode 100644 target/linux/generic-2.6/patches-2.6.31/003-squashfs_add_decompressor_framework.patch create mode 100644 target/linux/generic-2.6/patches-2.6.31/004-squashfs_add_decompressor_lzma_lzo.patch create mode 100644 target/linux/generic-2.6/patches-2.6.31/005-squashfs_extra_parameter.patch create mode 100644 target/linux/generic-2.6/patches-2.6.31/006-squashfs_add_lzma.patch create mode 100644 target/linux/generic-2.6/patches-2.6.31/007-squashfs_make_lzma_available.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.31/051-squashfs_pcomp.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.31/052-pcomp_lzma_support.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.31/053-squashfs_lzma.patch diff --git a/target/linux/generic-2.6/config-2.6.30 b/target/linux/generic-2.6/config-2.6.30 index 403cc54d7..8e590b766 100644 --- a/target/linux/generic-2.6/config-2.6.30 +++ b/target/linux/generic-2.6/config-2.6.30 @@ -403,6 +403,7 @@ CONFIG_DEBUG_FS=y # CONFIG_DEBUG_KERNEL is not set # CONFIG_DEBUG_MEMORY_INIT is not set # CONFIG_DECNET is not set +CONFIG_DECOMPRESS_LZMA_NEEDED=y # CONFIG_DEFAULT_AS is not set # CONFIG_DEFAULT_BIC is not set # CONFIG_DEFAULT_CFQ is not set @@ -2059,7 +2060,7 @@ CONFIG_SND_VERBOSE_PROCFS=y CONFIG_SPLIT_PTLOCK_CPUS=4 # CONFIG_SQUASHFS_EMBEDDED is not set CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 -CONFIG_SQUASHFS_SUPPORT_LZMA=y +CONFIG_SQUASHFS_LZMA=y CONFIG_SQUASHFS_SUPPORT_ZLIB=y # CONFIG_SQUASHFS_VMALLOC is not set CONFIG_SQUASHFS=y diff --git a/target/linux/generic-2.6/config-2.6.31 b/target/linux/generic-2.6/config-2.6.31 index e60f993a1..3b4bed5e4 100644 --- a/target/linux/generic-2.6/config-2.6.31 +++ b/target/linux/generic-2.6/config-2.6.31 @@ -420,6 +420,7 @@ CONFIG_DEBUG_FS=y # CONFIG_DEBUG_KERNEL is not set # CONFIG_DEBUG_MEMORY_INIT is not set # CONFIG_DECNET is not set +CONFIG_DECOMPRESS_LZMA_NEEDED=y # CONFIG_DEFAULT_AS is not set # CONFIG_DEFAULT_BIC is not set # CONFIG_DEFAULT_CFQ is not set @@ -2104,7 +2105,7 @@ CONFIG_SND_VERBOSE_PROCFS=y CONFIG_SPLIT_PTLOCK_CPUS=4 # CONFIG_SQUASHFS_EMBEDDED is not set CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 -CONFIG_SQUASHFS_SUPPORT_LZMA=y +CONFIG_SQUASHFS_LZMA=y CONFIG_SQUASHFS_SUPPORT_ZLIB=y # CONFIG_SQUASHFS_VMALLOC is not set CONFIG_SQUASHFS=y diff --git a/target/linux/generic-2.6/patches-2.6.30/000-bzip_lzma_remove_nasty_hack.patch b/target/linux/generic-2.6/patches-2.6.30/000-bzip_lzma_remove_nasty_hack.patch new file mode 100644 index 000000000..33572b890 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.30/000-bzip_lzma_remove_nasty_hack.patch @@ -0,0 +1,113 @@ +From b1af4315d823a2b6659c5b14bc17f7bc61878ef4 Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Thu, 6 Aug 2009 15:09:31 -0700 +Subject: [PATCH] bzip2/lzma: remove nasty uncompressed size hack in pre-boot environment + +decompress_bunzip2 and decompress_unlzma have a nasty hack that subtracts +4 from the input length if being called in the pre-boot environment. + +This is a nasty hack because it relies on the fact that flush = NULL only +when called from the pre-boot environment (i.e. +arch/x86/boot/compressed/misc.c). initramfs.c/do_mounts_rd.c pass in a +flush buffer (flush != NULL). + +This hack prevents the decompressors from being used with flush = NULL by +other callers unless knowledge of the hack is propagated to them. + +This patch removes the hack by making decompress (called only from the +pre-boot environment) a wrapper function that subtracts 4 from the input +length before calling the decompressor. + +Signed-off-by: Phillip Lougher +Cc: "H. Peter Anvin" +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +--- + lib/decompress_bunzip2.c | 22 ++++++++++++++++------ + lib/decompress_unlzma.c | 21 ++++++++++++++++----- + 2 files changed, 32 insertions(+), 11 deletions(-) + +--- a/lib/decompress_bunzip2.c ++++ b/lib/decompress_bunzip2.c +@@ -45,9 +45,11 @@ + */ + + +-#ifndef STATIC ++#ifdef STATIC ++#define PREBOOT ++#else + #include +-#endif /* !STATIC */ ++#endif /* STATIC */ + + #include + #include +@@ -681,9 +683,7 @@ STATIC int INIT bunzip2(unsigned char *b + set_error_fn(error_fn); + if (flush) + outbuf = malloc(BZIP2_IOBUF_SIZE); +- else +- len -= 4; /* Uncompressed size hack active in pre-boot +- environment */ ++ + if (!outbuf) { + error("Could not allocate output bufer"); + return -1; +@@ -733,4 +733,14 @@ exit_0: + return i; + } + +-#define decompress bunzip2 ++#ifdef PREBOOT ++STATIC int INIT decompress(unsigned char *buf, int len, ++ int(*fill)(void*, unsigned int), ++ int(*flush)(void*, unsigned int), ++ unsigned char *outbuf, ++ int *pos, ++ void(*error_fn)(char *x)) ++{ ++ return bunzip2(buf, len - 4, fill, flush, outbuf, pos, error_fn); ++} ++#endif +--- a/lib/decompress_unlzma.c ++++ b/lib/decompress_unlzma.c +@@ -29,7 +29,9 @@ + *Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +-#ifndef STATIC ++#ifdef STATIC ++#define PREBOOT ++#else + #include + #endif /* STATIC */ + +@@ -543,9 +545,7 @@ STATIC inline int INIT unlzma(unsigned c + int ret = -1; + + set_error_fn(error_fn); +- if (!flush) +- in_len -= 4; /* Uncompressed size hack active in pre-boot +- environment */ ++ + if (buf) + inbuf = buf; + else +@@ -645,4 +645,15 @@ exit_0: + return ret; + } + +-#define decompress unlzma ++#ifdef PREBOOT ++STATIC int INIT decompress(unsigned char *buf, int in_len, ++ int(*fill)(void*, unsigned int), ++ int(*flush)(void*, unsigned int), ++ unsigned char *output, ++ int *posp, ++ void(*error_fn)(char *x) ++ ) ++{ ++ return unlzma(buf, in_len - 4, fill, flush, output, posp, error_fn); ++} ++#endif diff --git a/target/linux/generic-2.6/patches-2.6.30/001-squashfs_move_zlib_decomp.patch b/target/linux/generic-2.6/patches-2.6.30/001-squashfs_move_zlib_decomp.patch new file mode 100644 index 000000000..94096791f --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.30/001-squashfs_move_zlib_decomp.patch @@ -0,0 +1,244 @@ +From 6c4419d997d4431bb62e73475cd6b084e83efbd1 Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Tue, 22 Sep 2009 19:25:24 +0100 +Subject: [PATCH] Squashfs: move zlib decompression wrapper code into a separate file + +Signed-off-by: Phillip Lougher +--- + fs/squashfs/Makefile | 2 +- + fs/squashfs/block.c | 74 ++---------------------------- + fs/squashfs/squashfs.h | 4 ++ + fs/squashfs/zlib_wrapper.c | 109 ++++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 118 insertions(+), 71 deletions(-) + create mode 100644 fs/squashfs/zlib_wrapper.c + +--- a/fs/squashfs/Makefile ++++ b/fs/squashfs/Makefile +@@ -4,4 +4,4 @@ + + obj-$(CONFIG_SQUASHFS) += squashfs.o + squashfs-y += block.o cache.o dir.o export.o file.o fragment.o id.o inode.o +-squashfs-y += namei.o super.o symlink.o ++squashfs-y += namei.o super.o symlink.o zlib_wrapper.o +--- a/fs/squashfs/block.c ++++ b/fs/squashfs/block.c +@@ -29,7 +29,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -153,72 +152,10 @@ int squashfs_read_data(struct super_bloc + } + + if (compressed) { +- int zlib_err = 0, zlib_init = 0; +- +- /* +- * Uncompress block. +- */ +- +- mutex_lock(&msblk->read_data_mutex); +- +- msblk->stream.avail_out = 0; +- msblk->stream.avail_in = 0; +- +- bytes = length; +- do { +- if (msblk->stream.avail_in == 0 && k < b) { +- avail = min(bytes, msblk->devblksize - offset); +- bytes -= avail; +- wait_on_buffer(bh[k]); +- if (!buffer_uptodate(bh[k])) +- goto release_mutex; +- +- if (avail == 0) { +- offset = 0; +- put_bh(bh[k++]); +- continue; +- } +- +- msblk->stream.next_in = bh[k]->b_data + offset; +- msblk->stream.avail_in = avail; +- offset = 0; +- } +- +- if (msblk->stream.avail_out == 0 && page < pages) { +- msblk->stream.next_out = buffer[page++]; +- msblk->stream.avail_out = PAGE_CACHE_SIZE; +- } +- +- if (!zlib_init) { +- zlib_err = zlib_inflateInit(&msblk->stream); +- if (zlib_err != Z_OK) { +- ERROR("zlib_inflateInit returned" +- " unexpected result 0x%x," +- " srclength %d\n", zlib_err, +- srclength); +- goto release_mutex; +- } +- zlib_init = 1; +- } +- +- zlib_err = zlib_inflate(&msblk->stream, Z_SYNC_FLUSH); +- +- if (msblk->stream.avail_in == 0 && k < b) +- put_bh(bh[k++]); +- } while (zlib_err == Z_OK); +- +- if (zlib_err != Z_STREAM_END) { +- ERROR("zlib_inflate error, data probably corrupt\n"); +- goto release_mutex; +- } +- +- zlib_err = zlib_inflateEnd(&msblk->stream); +- if (zlib_err != Z_OK) { +- ERROR("zlib_inflate error, data probably corrupt\n"); +- goto release_mutex; +- } +- length = msblk->stream.total_out; +- mutex_unlock(&msblk->read_data_mutex); ++ length = zlib_uncompress(msblk, buffer, bh, b, offset, length, ++ srclength, pages); ++ if (length < 0) ++ goto read_failure; + } else { + /* + * Block is uncompressed. +@@ -255,9 +192,6 @@ int squashfs_read_data(struct super_bloc + kfree(bh); + return length; + +-release_mutex: +- mutex_unlock(&msblk->read_data_mutex); +- + block_release: + for (; k < b; k++) + put_bh(bh[k]); +--- a/fs/squashfs/squashfs.h ++++ b/fs/squashfs/squashfs.h +@@ -70,6 +70,10 @@ extern struct inode *squashfs_iget(struc + unsigned int); + extern int squashfs_read_inode(struct inode *, long long); + ++/* zlib_wrapper.c */ ++extern int zlib_uncompress(struct squashfs_sb_info *, void **, ++ struct buffer_head **, int, int, int, int, int); ++ + /* + * Inodes and files operations + */ +--- /dev/null ++++ b/fs/squashfs/zlib_wrapper.c +@@ -0,0 +1,109 @@ ++/* ++ * Squashfs - a compressed read only filesystem for Linux ++ * ++ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 ++ * Phillip Lougher ++ * ++ * 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, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ * ++ * zlib_wrapper.c ++ */ ++ ++ ++#include ++#include ++#include ++ ++#include "squashfs_fs.h" ++#include "squashfs_fs_sb.h" ++#include "squashfs_fs_i.h" ++#include "squashfs.h" ++ ++int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, ++ struct buffer_head **bh, int b, int offset, int length, int srclength, ++ int pages) ++{ ++ int zlib_err = 0, zlib_init = 0; ++ int avail, bytes, k = 0, page = 0; ++ ++ mutex_lock(&msblk->read_data_mutex); ++ ++ msblk->stream.avail_out = 0; ++ msblk->stream.avail_in = 0; ++ ++ bytes = length; ++ do { ++ if (msblk->stream.avail_in == 0 && k < b) { ++ avail = min(bytes, msblk->devblksize - offset); ++ bytes -= avail; ++ wait_on_buffer(bh[k]); ++ if (!buffer_uptodate(bh[k])) ++ goto release_mutex; ++ ++ if (avail == 0) { ++ offset = 0; ++ put_bh(bh[k++]); ++ continue; ++ } ++ ++ msblk->stream.next_in = bh[k]->b_data + offset; ++ msblk->stream.avail_in = avail; ++ offset = 0; ++ } ++ ++ if (msblk->stream.avail_out == 0 && page < pages) { ++ msblk->stream.next_out = buffer[page++]; ++ msblk->stream.avail_out = PAGE_CACHE_SIZE; ++ } ++ ++ if (!zlib_init) { ++ zlib_err = zlib_inflateInit(&msblk->stream); ++ if (zlib_err != Z_OK) { ++ ERROR("zlib_inflateInit returned unexpected " ++ "result 0x%x, srclength %d\n", ++ zlib_err, srclength); ++ goto release_mutex; ++ } ++ zlib_init = 1; ++ } ++ ++ zlib_err = zlib_inflate(&msblk->stream, Z_SYNC_FLUSH); ++ ++ if (msblk->stream.avail_in == 0 && k < b) ++ put_bh(bh[k++]); ++ } while (zlib_err == Z_OK); ++ ++ if (zlib_err != Z_STREAM_END) { ++ ERROR("zlib_inflate error, data probably corrupt\n"); ++ goto release_mutex; ++ } ++ ++ zlib_err = zlib_inflateEnd(&msblk->stream); ++ if (zlib_err != Z_OK) { ++ ERROR("zlib_inflate error, data probably corrupt\n"); ++ goto release_mutex; ++ } ++ ++ mutex_unlock(&msblk->read_data_mutex); ++ return msblk->stream.total_out; ++ ++release_mutex: ++ mutex_unlock(&msblk->read_data_mutex); ++ ++ for (; k < b; k++) ++ put_bh(bh[k]); ++ ++ return -EIO; ++} diff --git a/target/linux/generic-2.6/patches-2.6.30/002-squashfs_factor_out_remaining_zlib.patch b/target/linux/generic-2.6/patches-2.6.30/002-squashfs_factor_out_remaining_zlib.patch new file mode 100644 index 000000000..857834f21 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.30/002-squashfs_factor_out_remaining_zlib.patch @@ -0,0 +1,317 @@ +From 37c44e85fd49676ec15ccaeea065662c1fbcda7d Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Wed, 23 Sep 2009 19:04:49 +0100 +Subject: [PATCH] Squashfs: Factor out remaining zlib dependencies into separate wrapper file + +Move zlib buffer init/destroy code into separate wrapper file. Also +make zlib z_stream field a void * removing the need to include zlib.h +for most files. + +Signed-off-by: Phillip Lougher +--- + fs/squashfs/block.c | 1 - + fs/squashfs/cache.c | 1 - + fs/squashfs/dir.c | 1 - + fs/squashfs/export.c | 1 - + fs/squashfs/file.c | 1 - + fs/squashfs/fragment.c | 1 - + fs/squashfs/id.c | 1 - + fs/squashfs/inode.c | 1 - + fs/squashfs/namei.c | 1 - + fs/squashfs/squashfs.h | 2 + + fs/squashfs/squashfs_fs_sb.h | 2 +- + fs/squashfs/super.c | 14 +++------ + fs/squashfs/symlink.c | 1 - + fs/squashfs/zlib_wrapper.c | 56 ++++++++++++++++++++++++++++++++--------- + 14 files changed, 51 insertions(+), 33 deletions(-) + +--- a/fs/squashfs/block.c ++++ b/fs/squashfs/block.c +@@ -31,7 +31,6 @@ + #include + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/cache.c ++++ b/fs/squashfs/cache.c +@@ -51,7 +51,6 @@ + #include + #include + #include +-#include + #include + + #include "squashfs_fs.h" +--- a/fs/squashfs/dir.c ++++ b/fs/squashfs/dir.c +@@ -30,7 +30,6 @@ + #include + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/export.c ++++ b/fs/squashfs/export.c +@@ -39,7 +39,6 @@ + #include + #include + #include +-#include + #include + + #include "squashfs_fs.h" +--- a/fs/squashfs/file.c ++++ b/fs/squashfs/file.c +@@ -47,7 +47,6 @@ + #include + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/fragment.c ++++ b/fs/squashfs/fragment.c +@@ -36,7 +36,6 @@ + #include + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/id.c ++++ b/fs/squashfs/id.c +@@ -34,7 +34,6 @@ + #include + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/inode.c ++++ b/fs/squashfs/inode.c +@@ -40,7 +40,6 @@ + + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/namei.c ++++ b/fs/squashfs/namei.c +@@ -57,7 +57,6 @@ + #include + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/squashfs.h ++++ b/fs/squashfs/squashfs.h +@@ -71,6 +71,8 @@ extern struct inode *squashfs_iget(struc + extern int squashfs_read_inode(struct inode *, long long); + + /* zlib_wrapper.c */ ++extern void *zlib_init(void); ++extern void zlib_free(void *); + extern int zlib_uncompress(struct squashfs_sb_info *, void **, + struct buffer_head **, int, int, int, int, int); + +--- a/fs/squashfs/squashfs_fs_sb.h ++++ b/fs/squashfs/squashfs_fs_sb.h +@@ -64,7 +64,7 @@ struct squashfs_sb_info { + struct mutex read_data_mutex; + struct mutex meta_index_mutex; + struct meta_index *meta_index; +- z_stream stream; ++ void *stream; + __le64 *inode_lookup_table; + u64 inode_table; + u64 directory_table; +--- a/fs/squashfs/super.c ++++ b/fs/squashfs/super.c +@@ -34,7 +34,6 @@ + #include + #include + #include +-#include + #include + + #include "squashfs_fs.h" +@@ -86,12 +85,9 @@ static int squashfs_fill_super(struct su + } + msblk = sb->s_fs_info; + +- msblk->stream.workspace = kmalloc(zlib_inflate_workspacesize(), +- GFP_KERNEL); +- if (msblk->stream.workspace == NULL) { +- ERROR("Failed to allocate zlib workspace\n"); ++ msblk->stream = zlib_init(); ++ if (msblk->stream == NULL) + goto failure; +- } + + sblk = kzalloc(sizeof(*sblk), GFP_KERNEL); + if (sblk == NULL) { +@@ -291,17 +287,17 @@ failed_mount: + squashfs_cache_delete(msblk->block_cache); + squashfs_cache_delete(msblk->fragment_cache); + squashfs_cache_delete(msblk->read_page); ++ zlib_free(msblk->stream); + kfree(msblk->inode_lookup_table); + kfree(msblk->fragment_index); + kfree(msblk->id_table); +- kfree(msblk->stream.workspace); + kfree(sb->s_fs_info); + sb->s_fs_info = NULL; + kfree(sblk); + return err; + + failure: +- kfree(msblk->stream.workspace); ++ zlib_free(msblk->stream); + kfree(sb->s_fs_info); + sb->s_fs_info = NULL; + return -ENOMEM; +@@ -343,10 +339,10 @@ static void squashfs_put_super(struct su + squashfs_cache_delete(sbi->block_cache); + squashfs_cache_delete(sbi->fragment_cache); + squashfs_cache_delete(sbi->read_page); ++ zlib_free(sbi->stream); + kfree(sbi->id_table); + kfree(sbi->fragment_index); + kfree(sbi->meta_index); +- kfree(sbi->stream.workspace); + kfree(sb->s_fs_info); + sb->s_fs_info = NULL; + } +--- a/fs/squashfs/symlink.c ++++ b/fs/squashfs/symlink.c +@@ -36,7 +36,6 @@ + #include + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/zlib_wrapper.c ++++ b/fs/squashfs/zlib_wrapper.c +@@ -31,21 +31,51 @@ + #include "squashfs_fs_i.h" + #include "squashfs.h" + ++void *zlib_init() ++{ ++ z_stream *stream = kmalloc(sizeof(z_stream), GFP_KERNEL); ++ if (stream == NULL) ++ goto failed; ++ stream->workspace = kmalloc(zlib_inflate_workspacesize(), ++ GFP_KERNEL); ++ if (stream->workspace == NULL) ++ goto failed; ++ ++ return stream; ++ ++failed: ++ ERROR("Failed to allocate zlib workspace\n"); ++ kfree(stream); ++ return NULL; ++} ++ ++ ++void zlib_free(void *strm) ++{ ++ z_stream *stream = strm; ++ ++ if (stream) ++ kfree(stream->workspace); ++ kfree(stream); ++} ++ ++ + int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, + struct buffer_head **bh, int b, int offset, int length, int srclength, + int pages) + { + int zlib_err = 0, zlib_init = 0; + int avail, bytes, k = 0, page = 0; ++ z_stream *stream = msblk->stream; + + mutex_lock(&msblk->read_data_mutex); + +- msblk->stream.avail_out = 0; +- msblk->stream.avail_in = 0; ++ stream->avail_out = 0; ++ stream->avail_in = 0; + + bytes = length; + do { +- if (msblk->stream.avail_in == 0 && k < b) { ++ if (stream->avail_in == 0 && k < b) { + avail = min(bytes, msblk->devblksize - offset); + bytes -= avail; + wait_on_buffer(bh[k]); +@@ -58,18 +88,18 @@ int zlib_uncompress(struct squashfs_sb_i + continue; + } + +- msblk->stream.next_in = bh[k]->b_data + offset; +- msblk->stream.avail_in = avail; ++ stream->next_in = bh[k]->b_data + offset; ++ stream->avail_in = avail; + offset = 0; + } + +- if (msblk->stream.avail_out == 0 && page < pages) { +- msblk->stream.next_out = buffer[page++]; +- msblk->stream.avail_out = PAGE_CACHE_SIZE; ++ if (stream->avail_out == 0 && page < pages) { ++ stream->next_out = buffer[page++]; ++ stream->avail_out = PAGE_CACHE_SIZE; + } + + if (!zlib_init) { +- zlib_err = zlib_inflateInit(&msblk->stream); ++ zlib_err = zlib_inflateInit(stream); + if (zlib_err != Z_OK) { + ERROR("zlib_inflateInit returned unexpected " + "result 0x%x, srclength %d\n", +@@ -79,9 +109,9 @@ int zlib_uncompress(struct squashfs_sb_i + zlib_init = 1; + } + +- zlib_err = zlib_inflate(&msblk->stream, Z_SYNC_FLUSH); ++ zlib_err = zlib_inflate(stream, Z_SYNC_FLUSH); + +- if (msblk->stream.avail_in == 0 && k < b) ++ if (stream->avail_in == 0 && k < b) + put_bh(bh[k++]); + } while (zlib_err == Z_OK); + +@@ -90,14 +120,14 @@ int zlib_uncompress(struct squashfs_sb_i + goto release_mutex; + } + +- zlib_err = zlib_inflateEnd(&msblk->stream); ++ zlib_err = zlib_inflateEnd(stream); + if (zlib_err != Z_OK) { + ERROR("zlib_inflate error, data probably corrupt\n"); + goto release_mutex; + } + + mutex_unlock(&msblk->read_data_mutex); +- return msblk->stream.total_out; ++ return stream->total_out; + + release_mutex: + mutex_unlock(&msblk->read_data_mutex); diff --git a/target/linux/generic-2.6/patches-2.6.30/003-squashfs_add_decompressor_framework.patch b/target/linux/generic-2.6/patches-2.6.30/003-squashfs_add_decompressor_framework.patch new file mode 100644 index 000000000..db2fe538e --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.30/003-squashfs_add_decompressor_framework.patch @@ -0,0 +1,426 @@ +From 327fbf47a419befc6bff74f3ca42d2b6f0841903 Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Tue, 6 Oct 2009 04:04:15 +0100 +Subject: [PATCH] Squashfs: add a decompressor framework + +This adds a decompressor framework which allows multiple compression +algorithms to be cleanly supported. + +Also update zlib wrapper and other code to use the new framework. + +Signed-off-by: Phillip Lougher +--- + fs/squashfs/Makefile | 2 +- + fs/squashfs/block.c | 6 ++-- + fs/squashfs/decompressor.c | 58 ++++++++++++++++++++++++++++++++++++++++++ + fs/squashfs/decompressor.h | 55 +++++++++++++++++++++++++++++++++++++++ + fs/squashfs/squashfs.h | 14 +++++----- + fs/squashfs/squashfs_fs_sb.h | 41 +++++++++++++++-------------- + fs/squashfs/super.c | 45 ++++++++++++++++++------------- + fs/squashfs/zlib_wrapper.c | 17 ++++++++++-- + 8 files changed, 185 insertions(+), 53 deletions(-) + create mode 100644 fs/squashfs/decompressor.c + create mode 100644 fs/squashfs/decompressor.h + +--- a/fs/squashfs/Makefile ++++ b/fs/squashfs/Makefile +@@ -4,4 +4,4 @@ + + obj-$(CONFIG_SQUASHFS) += squashfs.o + squashfs-y += block.o cache.o dir.o export.o file.o fragment.o id.o inode.o +-squashfs-y += namei.o super.o symlink.o zlib_wrapper.o ++squashfs-y += namei.o super.o symlink.o zlib_wrapper.o decompressor.o +--- a/fs/squashfs/block.c ++++ b/fs/squashfs/block.c +@@ -36,7 +36,7 @@ + #include "squashfs_fs_sb.h" + #include "squashfs_fs_i.h" + #include "squashfs.h" +- ++#include "decompressor.h" + /* + * Read the metadata block length, this is stored in the first two + * bytes of the metadata block. +@@ -151,8 +151,8 @@ int squashfs_read_data(struct super_bloc + } + + if (compressed) { +- length = zlib_uncompress(msblk, buffer, bh, b, offset, length, +- srclength, pages); ++ length = squashfs_decompress(msblk, buffer, bh, b, offset, ++ length, srclength, pages); + if (length < 0) + goto read_failure; + } else { +--- /dev/null ++++ b/fs/squashfs/decompressor.c +@@ -0,0 +1,58 @@ ++/* ++ * Squashfs - a compressed read only filesystem for Linux ++ * ++ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 ++ * Phillip Lougher ++ * ++ * 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, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ * ++ * decompressor.c ++ */ ++ ++#include ++#include ++#include ++ ++#include "squashfs_fs.h" ++#include "squashfs_fs_sb.h" ++#include "squashfs_fs_i.h" ++#include "decompressor.h" ++#include "squashfs.h" ++ ++/* ++ * This file (and decompressor.h) implements a decompressor framework for ++ * Squashfs, allowing multiple decompressors to be easily supported ++ */ ++ ++static const struct squashfs_decompressor squashfs_unknown_comp_ops = { ++ NULL, NULL, NULL, 0, "unknown", 0 ++}; ++ ++static const struct squashfs_decompressor *decompressor[] = { ++ &squashfs_zlib_comp_ops, ++ &squashfs_unknown_comp_ops ++}; ++ ++ ++const struct squashfs_decompressor *squashfs_lookup_decompressor(int id) ++{ ++ int i; ++ ++ for (i = 0; decompressor[i]->id; i++) ++ if (id == decompressor[i]->id) ++ break; ++ ++ return decompressor[i]; ++} +--- /dev/null ++++ b/fs/squashfs/decompressor.h +@@ -0,0 +1,55 @@ ++#ifndef DECOMPRESSOR_H ++#define DECOMPRESSOR_H ++/* ++ * Squashfs - a compressed read only filesystem for Linux ++ * ++ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 ++ * Phillip Lougher ++ * ++ * 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, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ * ++ * decompressor.h ++ */ ++ ++struct squashfs_decompressor { ++ void *(*init)(void); ++ void (*free)(void *); ++ int (*decompress)(struct squashfs_sb_info *, void **, ++ struct buffer_head **, int, int, int, int, int); ++ int id; ++ char *name; ++ int supported; ++}; ++ ++static inline void *squashfs_decompressor_init(struct squashfs_sb_info *msblk) ++{ ++ return msblk->decompressor->init(); ++} ++ ++static inline void squashfs_decompressor_free(struct squashfs_sb_info *msblk, ++ void *s) ++{ ++ if (msblk->decompressor) ++ msblk->decompressor->free(s); ++} ++ ++static inline int squashfs_decompress(struct squashfs_sb_info *msblk, ++ void **buffer, struct buffer_head **bh, int b, int offset, int length, ++ int srclength, int pages) ++{ ++ return msblk->decompressor->decompress(msblk, buffer, bh, b, offset, ++ length, srclength, pages); ++} ++#endif +--- a/fs/squashfs/squashfs.h ++++ b/fs/squashfs/squashfs.h +@@ -51,6 +51,9 @@ extern struct squashfs_cache_entry *squa + u64, int); + extern int squashfs_read_table(struct super_block *, void *, u64, int); + ++/* decompressor.c */ ++extern const struct squashfs_decompressor *squashfs_lookup_decompressor(int); ++ + /* export.c */ + extern __le64 *squashfs_read_inode_lookup_table(struct super_block *, u64, + unsigned int); +@@ -70,14 +73,8 @@ extern struct inode *squashfs_iget(struc + unsigned int); + extern int squashfs_read_inode(struct inode *, long long); + +-/* zlib_wrapper.c */ +-extern void *zlib_init(void); +-extern void zlib_free(void *); +-extern int zlib_uncompress(struct squashfs_sb_info *, void **, +- struct buffer_head **, int, int, int, int, int); +- + /* +- * Inodes and files operations ++ * Inodes, files and decompressor operations + */ + + /* dir.c */ +@@ -94,3 +91,6 @@ extern const struct inode_operations squ + + /* symlink.c */ + extern const struct address_space_operations squashfs_symlink_aops; ++ ++/* zlib_wrapper.c */ ++extern const struct squashfs_decompressor squashfs_zlib_comp_ops; +--- a/fs/squashfs/squashfs_fs_sb.h ++++ b/fs/squashfs/squashfs_fs_sb.h +@@ -52,25 +52,26 @@ struct squashfs_cache_entry { + }; + + struct squashfs_sb_info { +- int devblksize; +- int devblksize_log2; +- struct squashfs_cache *block_cache; +- struct squashfs_cache *fragment_cache; +- struct squashfs_cache *read_page; +- int next_meta_index; +- __le64 *id_table; +- __le64 *fragment_index; +- unsigned int *fragment_index_2; +- struct mutex read_data_mutex; +- struct mutex meta_index_mutex; +- struct meta_index *meta_index; +- void *stream; +- __le64 *inode_lookup_table; +- u64 inode_table; +- u64 directory_table; +- unsigned int block_size; +- unsigned short block_log; +- long long bytes_used; +- unsigned int inodes; ++ const struct squashfs_decompressor *decompressor; ++ int devblksize; ++ int devblksize_log2; ++ struct squashfs_cache *block_cache; ++ struct squashfs_cache *fragment_cache; ++ struct squashfs_cache *read_page; ++ int next_meta_index; ++ __le64 *id_table; ++ __le64 *fragment_index; ++ unsigned int *fragment_index_2; ++ struct mutex read_data_mutex; ++ struct mutex meta_index_mutex; ++ struct meta_index *meta_index; ++ void *stream; ++ __le64 *inode_lookup_table; ++ u64 inode_table; ++ u64 directory_table; ++ unsigned int block_size; ++ unsigned short block_log; ++ long long bytes_used; ++ unsigned int inodes; + }; + #endif +--- a/fs/squashfs/super.c ++++ b/fs/squashfs/super.c +@@ -40,27 +40,35 @@ + #include "squashfs_fs_sb.h" + #include "squashfs_fs_i.h" + #include "squashfs.h" ++#include "decompressor.h" + + static struct file_system_type squashfs_fs_type; + static struct super_operations squashfs_super_ops; + +-static int supported_squashfs_filesystem(short major, short minor, short comp) ++static const struct squashfs_decompressor *supported_squashfs_filesystem(short ++ major, short minor, short id) + { ++ const struct squashfs_decompressor *decompressor; ++ + if (major < SQUASHFS_MAJOR) { + ERROR("Major/Minor mismatch, older Squashfs %d.%d " + "filesystems are unsupported\n", major, minor); +- return -EINVAL; ++ return NULL; + } else if (major > SQUASHFS_MAJOR || minor > SQUASHFS_MINOR) { + ERROR("Major/Minor mismatch, trying to mount newer " + "%d.%d filesystem\n", major, minor); + ERROR("Please update your kernel\n"); +- return -EINVAL; ++ return NULL; + } + +- if (comp != ZLIB_COMPRESSION) +- return -EINVAL; ++ decompressor = squashfs_lookup_decompressor(id); ++ if (!decompressor->supported) { ++ ERROR("Filesystem uses \"%s\" compression. This is not " ++ "supported\n", decompressor->name); ++ return NULL; ++ } + +- return 0; ++ return decompressor; + } + + +@@ -85,10 +93,6 @@ static int squashfs_fill_super(struct su + } + msblk = sb->s_fs_info; + +- msblk->stream = zlib_init(); +- if (msblk->stream == NULL) +- goto failure; +- + sblk = kzalloc(sizeof(*sblk), GFP_KERNEL); + if (sblk == NULL) { + ERROR("Failed to allocate squashfs_super_block\n"); +@@ -115,25 +119,25 @@ static int squashfs_fill_super(struct su + goto failed_mount; + } + ++ err = -EINVAL; ++ + /* Check it is a SQUASHFS superblock */ + sb->s_magic = le32_to_cpu(sblk->s_magic); + if (sb->s_magic != SQUASHFS_MAGIC) { + if (!silent) + ERROR("Can't find a SQUASHFS superblock on %s\n", + bdevname(sb->s_bdev, b)); +- err = -EINVAL; + goto failed_mount; + } + +- /* Check the MAJOR & MINOR versions and compression type */ +- err = supported_squashfs_filesystem(le16_to_cpu(sblk->s_major), ++ /* Check the MAJOR & MINOR versions and lookup compression type */ ++ msblk->decompressor = supported_squashfs_filesystem( ++ le16_to_cpu(sblk->s_major), + le16_to_cpu(sblk->s_minor), + le16_to_cpu(sblk->compression)); +- if (err < 0) ++ if (msblk->decompressor == NULL) + goto failed_mount; + +- err = -EINVAL; +- + /* + * Check if there's xattrs in the filesystem. These are not + * supported in this version, so warn that they will be ignored. +@@ -200,6 +204,10 @@ static int squashfs_fill_super(struct su + + err = -ENOMEM; + ++ msblk->stream = squashfs_decompressor_init(msblk); ++ if (msblk->stream == NULL) ++ goto failed_mount; ++ + msblk->block_cache = squashfs_cache_init("metadata", + SQUASHFS_CACHED_BLKS, SQUASHFS_METADATA_SIZE); + if (msblk->block_cache == NULL) +@@ -287,7 +295,7 @@ failed_mount: + squashfs_cache_delete(msblk->block_cache); + squashfs_cache_delete(msblk->fragment_cache); + squashfs_cache_delete(msblk->read_page); +- zlib_free(msblk->stream); ++ squashfs_decompressor_free(msblk, msblk->stream); + kfree(msblk->inode_lookup_table); + kfree(msblk->fragment_index); + kfree(msblk->id_table); +@@ -297,7 +305,6 @@ failed_mount: + return err; + + failure: +- zlib_free(msblk->stream); + kfree(sb->s_fs_info); + sb->s_fs_info = NULL; + return -ENOMEM; +@@ -339,7 +346,7 @@ static void squashfs_put_super(struct su + squashfs_cache_delete(sbi->block_cache); + squashfs_cache_delete(sbi->fragment_cache); + squashfs_cache_delete(sbi->read_page); +- zlib_free(sbi->stream); ++ squashfs_decompressor_free(sbi, sbi->stream); + kfree(sbi->id_table); + kfree(sbi->fragment_index); + kfree(sbi->meta_index); +--- a/fs/squashfs/zlib_wrapper.c ++++ b/fs/squashfs/zlib_wrapper.c +@@ -30,8 +30,9 @@ + #include "squashfs_fs_sb.h" + #include "squashfs_fs_i.h" + #include "squashfs.h" ++#include "decompressor.h" + +-void *zlib_init() ++static void *zlib_init(void) + { + z_stream *stream = kmalloc(sizeof(z_stream), GFP_KERNEL); + if (stream == NULL) +@@ -50,7 +51,7 @@ failed: + } + + +-void zlib_free(void *strm) ++static void zlib_free(void *strm) + { + z_stream *stream = strm; + +@@ -60,7 +61,7 @@ void zlib_free(void *strm) + } + + +-int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, ++static int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, + struct buffer_head **bh, int b, int offset, int length, int srclength, + int pages) + { +@@ -137,3 +138,13 @@ release_mutex: + + return -EIO; + } ++ ++const struct squashfs_decompressor squashfs_zlib_comp_ops = { ++ .init = zlib_init, ++ .free = zlib_free, ++ .decompress = zlib_uncompress, ++ .id = ZLIB_COMPRESSION, ++ .name = "zlib", ++ .supported = 1 ++}; ++ diff --git a/target/linux/generic-2.6/patches-2.6.30/004-squashfs_add_decompressor_lzma_lzo.patch b/target/linux/generic-2.6/patches-2.6.30/004-squashfs_add_decompressor_lzma_lzo.patch new file mode 100644 index 000000000..a378c0005 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.30/004-squashfs_add_decompressor_lzma_lzo.patch @@ -0,0 +1,54 @@ +From 1885ca0a1973944684f252094a703b7c80dfc974 Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Wed, 14 Oct 2009 03:58:11 +0100 +Subject: [PATCH] Squashfs: add decompressor entries for lzma and lzo + +Add knowledge of lzma/lzo compression formats to the decompressor +framework. For now these are added as unsupported. Without +these entries lzma/lzo compressed filesystems will be flagged as +having unknown compression which is undesirable. + +Signed-off-by: Phillip Lougher +--- + fs/squashfs/decompressor.c | 10 ++++++++++ + fs/squashfs/squashfs_fs.h | 4 +++- + 2 files changed, 13 insertions(+), 1 deletions(-) + +--- a/fs/squashfs/decompressor.c ++++ b/fs/squashfs/decompressor.c +@@ -36,12 +36,22 @@ + * Squashfs, allowing multiple decompressors to be easily supported + */ + ++static const struct squashfs_decompressor squashfs_lzma_unsupported_comp_ops = { ++ NULL, NULL, NULL, LZMA_COMPRESSION, "lzma", 0 ++}; ++ ++static const struct squashfs_decompressor squashfs_lzo_unsupported_comp_ops = { ++ NULL, NULL, NULL, LZO_COMPRESSION, "lzo", 0 ++}; ++ + static const struct squashfs_decompressor squashfs_unknown_comp_ops = { + NULL, NULL, NULL, 0, "unknown", 0 + }; + + static const struct squashfs_decompressor *decompressor[] = { + &squashfs_zlib_comp_ops, ++ &squashfs_lzma_unsupported_comp_ops, ++ &squashfs_lzo_unsupported_comp_ops, + &squashfs_unknown_comp_ops + }; + +--- a/fs/squashfs/squashfs_fs.h ++++ b/fs/squashfs/squashfs_fs.h +@@ -211,7 +211,9 @@ struct meta_index { + /* + * definitions for structures on disk + */ +-#define ZLIB_COMPRESSION 1 ++#define ZLIB_COMPRESSION 1 ++#define LZMA_COMPRESSION 2 ++#define LZO_COMPRESSION 3 + + struct squashfs_super_block { + __le32 s_magic; diff --git a/target/linux/generic-2.6/patches-2.6.30/005-squashfs_extra_parameter.patch b/target/linux/generic-2.6/patches-2.6.30/005-squashfs_extra_parameter.patch new file mode 100644 index 000000000..099168134 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.30/005-squashfs_extra_parameter.patch @@ -0,0 +1,42 @@ +From 5f393ede3ddb5dd4cc2a9f243182fac45f1ce10b Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Wed, 14 Oct 2009 04:07:54 +0100 +Subject: [PATCH] Squashfs: add an extra parameter to the decompressor init function + +Signed-off-by: Phillip Lougher +--- + fs/squashfs/decompressor.h | 4 ++-- + fs/squashfs/zlib_wrapper.c | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +--- a/fs/squashfs/decompressor.h ++++ b/fs/squashfs/decompressor.h +@@ -24,7 +24,7 @@ + */ + + struct squashfs_decompressor { +- void *(*init)(void); ++ void *(*init)(struct squashfs_sb_info *); + void (*free)(void *); + int (*decompress)(struct squashfs_sb_info *, void **, + struct buffer_head **, int, int, int, int, int); +@@ -35,7 +35,7 @@ struct squashfs_decompressor { + + static inline void *squashfs_decompressor_init(struct squashfs_sb_info *msblk) + { +- return msblk->decompressor->init(); ++ return msblk->decompressor->init(msblk); + } + + static inline void squashfs_decompressor_free(struct squashfs_sb_info *msblk, +--- a/fs/squashfs/zlib_wrapper.c ++++ b/fs/squashfs/zlib_wrapper.c +@@ -32,7 +32,7 @@ + #include "squashfs.h" + #include "decompressor.h" + +-static void *zlib_init(void) ++static void *zlib_init(struct squashfs_sb_info *dummy) + { + z_stream *stream = kmalloc(sizeof(z_stream), GFP_KERNEL); + if (stream == NULL) diff --git a/target/linux/generic-2.6/patches-2.6.30/006-squashfs_add_lzma.patch b/target/linux/generic-2.6/patches-2.6.30/006-squashfs_add_lzma.patch new file mode 100644 index 000000000..9fd57970f --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.30/006-squashfs_add_lzma.patch @@ -0,0 +1,216 @@ +From f49e1efdd179d54e814ff2a8e8f469496583062c Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Tue, 20 Oct 2009 10:54:36 +0100 +Subject: [PATCH] Squashfs: add LZMA compression + +Add support for LZMA compressed filesystems. This is an initial +implementation. + +Signed-off-by: Phillip Lougher +--- + fs/squashfs/Kconfig | 5 ++ + fs/squashfs/Makefile | 1 + + fs/squashfs/decompressor.c | 4 + + fs/squashfs/lzma_wrapper.c | 151 ++++++++++++++++++++++++++++++++++++++++++++ + fs/squashfs/squashfs.h | 3 + + 5 files changed, 164 insertions(+), 0 deletions(-) + create mode 100644 fs/squashfs/lzma_wrapper.c + +--- a/fs/squashfs/Kconfig ++++ b/fs/squashfs/Kconfig +@@ -26,6 +26,11 @@ config SQUASHFS + + If unsure, say N. + ++config SQUASHFS_LZMA ++ bool "Include support for LZMA compressed file systems" ++ depends on SQUASHFS ++ select DECOMPRESS_LZMA ++ + config SQUASHFS_EMBEDDED + + bool "Additional option for memory-constrained systems" +--- a/fs/squashfs/Makefile ++++ b/fs/squashfs/Makefile +@@ -5,3 +5,4 @@ + obj-$(CONFIG_SQUASHFS) += squashfs.o + squashfs-y += block.o cache.o dir.o export.o file.o fragment.o id.o inode.o + squashfs-y += namei.o super.o symlink.o zlib_wrapper.o decompressor.o ++squashfs-$(CONFIG_SQUASHFS_LZMA) += lzma_wrapper.o +--- a/fs/squashfs/decompressor.c ++++ b/fs/squashfs/decompressor.c +@@ -50,7 +50,11 @@ static const struct squashfs_decompresso + + static const struct squashfs_decompressor *decompressor[] = { + &squashfs_zlib_comp_ops, ++#ifdef CONFIG_SQUASHFS_LZMA ++ &squashfs_lzma_comp_ops, ++#else + &squashfs_lzma_unsupported_comp_ops, ++#endif + &squashfs_lzo_unsupported_comp_ops, + &squashfs_unknown_comp_ops + }; +--- /dev/null ++++ b/fs/squashfs/lzma_wrapper.c +@@ -0,0 +1,151 @@ ++/* ++ * Squashfs - a compressed read only filesystem for Linux ++ * ++ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 ++ * Phillip Lougher ++ * ++ * 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, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ * ++ * lzma_wrapper.c ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "squashfs_fs.h" ++#include "squashfs_fs_sb.h" ++#include "squashfs_fs_i.h" ++#include "squashfs.h" ++#include "decompressor.h" ++ ++struct squashfs_lzma { ++ void *input; ++ void *output; ++}; ++ ++/* decompress_unlzma.c is currently non re-entrant... */ ++DEFINE_MUTEX(lzma_mutex); ++ ++/* decompress_unlzma.c doesn't provide any context in its callbacks... */ ++static int lzma_error; ++ ++static void error(char *m) ++{ ++ ERROR("unlzma error: %s\n", m); ++ lzma_error = 1; ++} ++ ++ ++static void *lzma_init(struct squashfs_sb_info *msblk) ++{ ++ struct squashfs_lzma *stream = kzalloc(sizeof(*stream), GFP_KERNEL); ++ if (stream == NULL) ++ goto failed; ++ stream->input = vmalloc(msblk->block_size); ++ if (stream->input == NULL) ++ goto failed; ++ stream->output = vmalloc(msblk->block_size); ++ if (stream->output == NULL) ++ goto failed2; ++ ++ return stream; ++ ++failed2: ++ vfree(stream->input); ++failed: ++ ERROR("failed to allocate lzma workspace\n"); ++ kfree(stream); ++ return NULL; ++} ++ ++ ++static void lzma_free(void *strm) ++{ ++ struct squashfs_lzma *stream = strm; ++ ++ if (stream) { ++ vfree(stream->input); ++ vfree(stream->output); ++ } ++ kfree(stream); ++} ++ ++ ++static int lzma_uncompress(struct squashfs_sb_info *msblk, void **buffer, ++ struct buffer_head **bh, int b, int offset, int length, int srclength, ++ int pages) ++{ ++ struct squashfs_lzma *stream = msblk->stream; ++ void *buff = stream->input; ++ int avail, i, bytes = length, res; ++ ++ mutex_lock(&lzma_mutex); ++ ++ for (i = 0; i < b; i++) { ++ wait_on_buffer(bh[i]); ++ if (!buffer_uptodate(bh[i])) ++ goto block_release; ++ ++ avail = min(bytes, msblk->devblksize - offset); ++ memcpy(buff, bh[i]->b_data + offset, avail); ++ buff += avail; ++ bytes -= avail; ++ offset = 0; ++ put_bh(bh[i]); ++ } ++ ++ lzma_error = 0; ++ res = unlzma(stream->input, length, NULL, NULL, stream->output, NULL, ++ error); ++ if (res || lzma_error) ++ goto failed; ++ ++ /* uncompressed size is stored in the LZMA header (5 byte offset) */ ++ res = bytes = get_unaligned_le32(stream->input + 5); ++ for (i = 0, buff = stream->output; bytes && i < pages; i++) { ++ avail = min_t(int, bytes, PAGE_CACHE_SIZE); ++ memcpy(buffer[i], buff, avail); ++ buff += avail; ++ bytes -= avail; ++ } ++ if (bytes) ++ goto failed; ++ ++ mutex_unlock(&lzma_mutex); ++ return res; ++ ++block_release: ++ for (; i < b; i++) ++ put_bh(bh[i]); ++ ++failed: ++ mutex_unlock(&lzma_mutex); ++ ++ ERROR("lzma decompression failed, data probably corrupt\n"); ++ return -EIO; ++} ++ ++const struct squashfs_decompressor squashfs_lzma_comp_ops = { ++ .init = lzma_init, ++ .free = lzma_free, ++ .decompress = lzma_uncompress, ++ .id = LZMA_COMPRESSION, ++ .name = "lzma", ++ .supported = 1 ++}; ++ +--- a/fs/squashfs/squashfs.h ++++ b/fs/squashfs/squashfs.h +@@ -94,3 +94,6 @@ extern const struct address_space_operat + + /* zlib_wrapper.c */ + extern const struct squashfs_decompressor squashfs_zlib_comp_ops; ++ ++/* lzma wrapper.c */ ++extern const struct squashfs_decompressor squashfs_lzma_comp_ops; diff --git a/target/linux/generic-2.6/patches-2.6.30/007-squashfs_make_lzma_available.patch b/target/linux/generic-2.6/patches-2.6.30/007-squashfs_make_lzma_available.patch new file mode 100644 index 000000000..64705d2a9 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.30/007-squashfs_make_lzma_available.patch @@ -0,0 +1,165 @@ +From fdf23ed283bc6ef5c25076ce2065f892120ff556 Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Thu, 22 Oct 2009 04:57:38 +0100 +Subject: [PATCH] Squashfs: Make unlzma available to non initramfs/initrd code + +Add a config option DECOMPRESS_LZMA_NEEDED which allows subsystems to +specify they need the unlzma code. Normally decompress_unlzma.c is +compiled with __init and unlzma is not exported to modules. + +Signed-off-by: Phillip Lougher +--- + fs/squashfs/Kconfig | 1 + + include/linux/decompress/bunzip2_mm.h | 12 ++++++++++++ + include/linux/decompress/inflate_mm.h | 12 ++++++++++++ + include/linux/decompress/mm.h | 3 --- + include/linux/decompress/unlzma_mm.h | 20 ++++++++++++++++++++ + lib/Kconfig | 3 +++ + lib/decompress_bunzip2.c | 1 + + lib/decompress_inflate.c | 1 + + lib/decompress_unlzma.c | 5 ++++- + 9 files changed, 54 insertions(+), 4 deletions(-) + create mode 100644 include/linux/decompress/bunzip2_mm.h + create mode 100644 include/linux/decompress/inflate_mm.h + create mode 100644 include/linux/decompress/unlzma_mm.h + +--- a/fs/squashfs/Kconfig ++++ b/fs/squashfs/Kconfig +@@ -30,6 +30,7 @@ config SQUASHFS_LZMA + bool "Include support for LZMA compressed file systems" + depends on SQUASHFS + select DECOMPRESS_LZMA ++ select DECOMPRESS_LZMA_NEEDED + + config SQUASHFS_EMBEDDED + +--- /dev/null ++++ b/include/linux/decompress/bunzip2_mm.h +@@ -0,0 +1,12 @@ ++#ifndef BUNZIP2_MM_H ++#define BUNZIP2_MM_H ++ ++#ifdef STATIC ++/* Code active when included from pre-boot environment: */ ++#define INIT ++#else ++/* Compile for initramfs/initrd code only */ ++#define INIT __init ++#endif ++ ++#endif +--- /dev/null ++++ b/include/linux/decompress/inflate_mm.h +@@ -0,0 +1,12 @@ ++#ifndef INFLATE_MM_H ++#define INFLATE_MM_H ++ ++#ifdef STATIC ++/* Code active when included from pre-boot environment: */ ++#define INIT ++#else ++/* Compile for initramfs/initrd code only */ ++#define INIT __init ++#endif ++ ++#endif +--- a/include/linux/decompress/mm.h ++++ b/include/linux/decompress/mm.h +@@ -53,8 +53,6 @@ static void free(void *where) + + #define set_error_fn(x) + +-#define INIT +- + #else /* STATIC */ + + /* Code active when compiled standalone for use when loading ramdisk: */ +@@ -77,7 +75,6 @@ static void free(void *where) + static void(*error)(char *m); + #define set_error_fn(x) error = x; + +-#define INIT __init + #define STATIC + + #include +--- /dev/null ++++ b/include/linux/decompress/unlzma_mm.h +@@ -0,0 +1,20 @@ ++#ifndef UNLZMA_MM_H ++#define UNLZMA_MM_H ++ ++#ifdef STATIC ++ ++/* Code active when included from pre-boot environment: */ ++#define INIT ++ ++#elif defined(CONFIG_DECOMPRESS_LZMA_NEEDED) ++ ++/* Make it available to non initramfs/initrd code */ ++#define INIT ++#include ++#else ++ ++/* Compile for initramfs/initrd code only */ ++#define INIT __init ++#endif ++ ++#endif +--- a/lib/Kconfig ++++ b/lib/Kconfig +@@ -114,6 +114,9 @@ config DECOMPRESS_BZIP2 + config DECOMPRESS_LZMA + tristate + ++config DECOMPRESS_LZMA_NEEDED ++ boolean ++ + # + # Generic allocator support is selected if needed + # +--- a/lib/decompress_bunzip2.c ++++ b/lib/decompress_bunzip2.c +@@ -51,6 +51,7 @@ + #include + #endif /* STATIC */ + ++#include + #include + #include + +--- a/lib/decompress_inflate.c ++++ b/lib/decompress_inflate.c +@@ -22,6 +22,7 @@ + + #endif /* STATIC */ + ++#include + #include + #include + +--- a/lib/decompress_unlzma.c ++++ b/lib/decompress_unlzma.c +@@ -35,6 +35,7 @@ + #include + #endif /* STATIC */ + ++#include + #include + #include + +@@ -523,7 +524,7 @@ static inline void INIT process_bit1(str + + + +-STATIC inline int INIT unlzma(unsigned char *buf, int in_len, ++STATIC int INIT unlzma(unsigned char *buf, int in_len, + int(*fill)(void*, unsigned int), + int(*flush)(void*, unsigned int), + unsigned char *output, +@@ -656,4 +657,6 @@ STATIC int INIT decompress(unsigned char + { + return unlzma(buf, in_len - 4, fill, flush, output, posp, error_fn); + } ++#elif defined(CONFIG_DECOMPRESS_LZMA_NEEDED) ++EXPORT_SYMBOL(unlzma); + #endif diff --git a/target/linux/generic-2.6/patches-2.6.30/050-pcomp_update.patch b/target/linux/generic-2.6/patches-2.6.30/050-pcomp_update.patch deleted file mode 100644 index abad724f5..000000000 --- a/target/linux/generic-2.6/patches-2.6.30/050-pcomp_update.patch +++ /dev/null @@ -1,280 +0,0 @@ ---- a/crypto/testmgr.c -+++ b/crypto/testmgr.c -@@ -914,24 +914,25 @@ static int test_pcomp(struct crypto_pcom - const char *algo = crypto_tfm_alg_driver_name(crypto_pcomp_tfm(tfm)); - unsigned int i; - char result[COMP_BUF_SIZE]; -- int error; -+ int res; - - for (i = 0; i < ctcount; i++) { - struct comp_request req; -+ unsigned int produced = 0; - -- error = crypto_compress_setup(tfm, ctemplate[i].params, -- ctemplate[i].paramsize); -- if (error) { -+ res = crypto_compress_setup(tfm, ctemplate[i].params, -+ ctemplate[i].paramsize); -+ if (res) { - pr_err("alg: pcomp: compression setup failed on test " -- "%d for %s: error=%d\n", i + 1, algo, error); -- return error; -+ "%d for %s: error=%d\n", i + 1, algo, res); -+ return res; - } - -- error = crypto_compress_init(tfm); -- if (error) { -+ res = crypto_compress_init(tfm); -+ if (res) { - pr_err("alg: pcomp: compression init failed on test " -- "%d for %s: error=%d\n", i + 1, algo, error); -- return error; -+ "%d for %s: error=%d\n", i + 1, algo, res); -+ return res; - } - - memset(result, 0, sizeof(result)); -@@ -941,32 +942,37 @@ static int test_pcomp(struct crypto_pcom - req.next_out = result; - req.avail_out = ctemplate[i].outlen / 2; - -- error = crypto_compress_update(tfm, &req); -- if (error && (error != -EAGAIN || req.avail_in)) { -+ res = crypto_compress_update(tfm, &req); -+ if (res < 0 && (res != -EAGAIN || req.avail_in)) { - pr_err("alg: pcomp: compression update failed on test " -- "%d for %s: error=%d\n", i + 1, algo, error); -- return error; -+ "%d for %s: error=%d\n", i + 1, algo, res); -+ return res; - } -+ if (res > 0) -+ produced += res; - - /* Add remaining input data */ - req.avail_in += (ctemplate[i].inlen + 1) / 2; - -- error = crypto_compress_update(tfm, &req); -- if (error && (error != -EAGAIN || req.avail_in)) { -+ res = crypto_compress_update(tfm, &req); -+ if (res < 0 && (res != -EAGAIN || req.avail_in)) { - pr_err("alg: pcomp: compression update failed on test " -- "%d for %s: error=%d\n", i + 1, algo, error); -- return error; -+ "%d for %s: error=%d\n", i + 1, algo, res); -+ return res; - } -+ if (res > 0) -+ produced += res; - - /* Provide remaining output space */ - req.avail_out += COMP_BUF_SIZE - ctemplate[i].outlen / 2; - -- error = crypto_compress_final(tfm, &req); -- if (error) { -+ res = crypto_compress_final(tfm, &req); -+ if (res < 0) { - pr_err("alg: pcomp: compression final failed on test " -- "%d for %s: error=%d\n", i + 1, algo, error); -- return error; -+ "%d for %s: error=%d\n", i + 1, algo, res); -+ return res; - } -+ produced += res; - - if (COMP_BUF_SIZE - req.avail_out != ctemplate[i].outlen) { - pr_err("alg: comp: Compression test %d failed for %s: " -@@ -976,6 +982,13 @@ static int test_pcomp(struct crypto_pcom - return -EINVAL; - } - -+ if (produced != ctemplate[i].outlen) { -+ pr_err("alg: comp: Compression test %d failed for %s: " -+ "returned len = %u (expected %d)\n", i + 1, -+ algo, produced, ctemplate[i].outlen); -+ return -EINVAL; -+ } -+ - if (memcmp(result, ctemplate[i].output, ctemplate[i].outlen)) { - pr_err("alg: pcomp: Compression test %d failed for " - "%s\n", i + 1, algo); -@@ -986,21 +999,21 @@ static int test_pcomp(struct crypto_pcom - - for (i = 0; i < dtcount; i++) { - struct comp_request req; -+ unsigned int produced = 0; - -- error = crypto_decompress_setup(tfm, dtemplate[i].params, -- dtemplate[i].paramsize); -- if (error) { -+ res = crypto_decompress_setup(tfm, dtemplate[i].params, -+ dtemplate[i].paramsize); -+ if (res) { - pr_err("alg: pcomp: decompression setup failed on " -- "test %d for %s: error=%d\n", i + 1, algo, -- error); -- return error; -+ "test %d for %s: error=%d\n", i + 1, algo, res); -+ return res; - } - -- error = crypto_decompress_init(tfm); -- if (error) { -+ res = crypto_decompress_init(tfm); -+ if (res) { - pr_err("alg: pcomp: decompression init failed on test " -- "%d for %s: error=%d\n", i + 1, algo, error); -- return error; -+ "%d for %s: error=%d\n", i + 1, algo, res); -+ return res; - } - - memset(result, 0, sizeof(result)); -@@ -1010,35 +1023,38 @@ static int test_pcomp(struct crypto_pcom - req.next_out = result; - req.avail_out = dtemplate[i].outlen / 2; - -- error = crypto_decompress_update(tfm, &req); -- if (error && (error != -EAGAIN || req.avail_in)) { -+ res = crypto_decompress_update(tfm, &req); -+ if (res < 0 && (res != -EAGAIN || req.avail_in)) { - pr_err("alg: pcomp: decompression update failed on " -- "test %d for %s: error=%d\n", i + 1, algo, -- error); -- return error; -+ "test %d for %s: error=%d\n", i + 1, algo, res); -+ return res; - } -+ if (res > 0) -+ produced += res; - - /* Add remaining input data */ - req.avail_in += (dtemplate[i].inlen + 1) / 2; - -- error = crypto_decompress_update(tfm, &req); -- if (error && (error != -EAGAIN || req.avail_in)) { -+ res = crypto_decompress_update(tfm, &req); -+ if (res < 0 && (res != -EAGAIN || req.avail_in)) { - pr_err("alg: pcomp: decompression update failed on " -- "test %d for %s: error=%d\n", i + 1, algo, -- error); -- return error; -+ "test %d for %s: error=%d\n", i + 1, algo, res); -+ return res; - } -+ if (res > 0) -+ produced += res; - - /* Provide remaining output space */ - req.avail_out += COMP_BUF_SIZE - dtemplate[i].outlen / 2; - -- error = crypto_decompress_final(tfm, &req); -- if (error && (error != -EAGAIN || req.avail_in)) { -+ res = crypto_decompress_final(tfm, &req); -+ if (res < 0 && (res != -EAGAIN || req.avail_in)) { - pr_err("alg: pcomp: decompression final failed on " -- "test %d for %s: error=%d\n", i + 1, algo, -- error); -- return error; -+ "test %d for %s: error=%d\n", i + 1, algo, res); -+ return res; - } -+ if (res > 0) -+ produced += res; - - if (COMP_BUF_SIZE - req.avail_out != dtemplate[i].outlen) { - pr_err("alg: comp: Decompression test %d failed for " -@@ -1048,6 +1064,13 @@ static int test_pcomp(struct crypto_pcom - return -EINVAL; - } - -+ if (produced != dtemplate[i].outlen) { -+ pr_err("alg: comp: Decompression test %d failed for " -+ "%s: returned len = %u (expected %d)\n", i + 1, -+ algo, produced, dtemplate[i].outlen); -+ return -EINVAL; -+ } -+ - if (memcmp(result, dtemplate[i].output, dtemplate[i].outlen)) { - pr_err("alg: pcomp: Decompression test %d failed for " - "%s\n", i + 1, algo); ---- a/crypto/zlib.c -+++ b/crypto/zlib.c -@@ -165,15 +165,15 @@ static int zlib_compress_update(struct c - return -EINVAL; - } - -+ ret = req->avail_out - stream->avail_out; - pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n", - stream->avail_in, stream->avail_out, -- req->avail_in - stream->avail_in, -- req->avail_out - stream->avail_out); -+ req->avail_in - stream->avail_in, ret); - req->next_in = stream->next_in; - req->avail_in = stream->avail_in; - req->next_out = stream->next_out; - req->avail_out = stream->avail_out; -- return 0; -+ return ret; - } - - static int zlib_compress_final(struct crypto_pcomp *tfm, -@@ -195,15 +195,15 @@ static int zlib_compress_final(struct cr - return -EINVAL; - } - -+ ret = req->avail_out - stream->avail_out; - pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n", - stream->avail_in, stream->avail_out, -- req->avail_in - stream->avail_in, -- req->avail_out - stream->avail_out); -+ req->avail_in - stream->avail_in, ret); - req->next_in = stream->next_in; - req->avail_in = stream->avail_in; - req->next_out = stream->next_out; - req->avail_out = stream->avail_out; -- return 0; -+ return ret; - } - - -@@ -280,15 +280,15 @@ static int zlib_decompress_update(struct - return -EINVAL; - } - -+ ret = req->avail_out - stream->avail_out; - pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n", - stream->avail_in, stream->avail_out, -- req->avail_in - stream->avail_in, -- req->avail_out - stream->avail_out); -+ req->avail_in - stream->avail_in, ret); - req->next_in = stream->next_in; - req->avail_in = stream->avail_in; - req->next_out = stream->next_out; - req->avail_out = stream->avail_out; -- return 0; -+ return ret; - } - - static int zlib_decompress_final(struct crypto_pcomp *tfm, -@@ -328,15 +328,15 @@ static int zlib_decompress_final(struct - return -EINVAL; - } - -+ ret = req->avail_out - stream->avail_out; - pr_debug("avail_in %u, avail_out %u (consumed %u, produced %u)\n", - stream->avail_in, stream->avail_out, -- req->avail_in - stream->avail_in, -- req->avail_out - stream->avail_out); -+ req->avail_in - stream->avail_in, ret); - req->next_in = stream->next_in; - req->avail_in = stream->avail_in; - req->next_out = stream->next_out; - req->avail_out = stream->avail_out; -- return 0; -+ return ret; - } - - diff --git a/target/linux/generic-2.6/patches-2.6.30/051-squashfs_pcomp.patch b/target/linux/generic-2.6/patches-2.6.30/051-squashfs_pcomp.patch deleted file mode 100644 index fc2a731dd..000000000 --- a/target/linux/generic-2.6/patches-2.6.30/051-squashfs_pcomp.patch +++ /dev/null @@ -1,234 +0,0 @@ ---- a/fs/squashfs/Kconfig -+++ b/fs/squashfs/Kconfig -@@ -1,7 +1,8 @@ - config SQUASHFS - tristate "SquashFS 4.0 - Squashed file system support" - depends on BLOCK -- select ZLIB_INFLATE -+ select CRYPTO -+ select CRYPTO_ZLIB - help - Saying Y here includes support for SquashFS 4.0 (a Compressed - Read-Only File System). Squashfs is a highly compressed read-only ---- a/fs/squashfs/block.c -+++ b/fs/squashfs/block.c -@@ -32,7 +32,8 @@ - #include - #include - #include --#include -+ -+#include - - #include "squashfs_fs.h" - #include "squashfs_fs_sb.h" -@@ -153,7 +154,8 @@ int squashfs_read_data(struct super_bloc - } - - if (compressed) { -- int zlib_err = 0, zlib_init = 0; -+ int res = 0, decomp_init = 0; -+ struct comp_request req; - - /* - * Uncompress block. -@@ -161,12 +163,13 @@ int squashfs_read_data(struct super_bloc - - mutex_lock(&msblk->read_data_mutex); - -- msblk->stream.avail_out = 0; -- msblk->stream.avail_in = 0; -+ req.avail_out = 0; -+ req.avail_in = 0; - - bytes = length; -+ length = 0; - do { -- if (msblk->stream.avail_in == 0 && k < b) { -+ if (req.avail_in == 0 && k < b) { - avail = min(bytes, msblk->devblksize - offset); - bytes -= avail; - wait_on_buffer(bh[k]); -@@ -179,45 +182,47 @@ int squashfs_read_data(struct super_bloc - continue; - } - -- msblk->stream.next_in = bh[k]->b_data + offset; -- msblk->stream.avail_in = avail; -+ req.next_in = bh[k]->b_data + offset; -+ req.avail_in = avail; - offset = 0; - } - -- if (msblk->stream.avail_out == 0 && page < pages) { -- msblk->stream.next_out = buffer[page++]; -- msblk->stream.avail_out = PAGE_CACHE_SIZE; -+ if (req.avail_out == 0 && page < pages) { -+ req.next_out = buffer[page++]; -+ req.avail_out = PAGE_CACHE_SIZE; - } - -- if (!zlib_init) { -- zlib_err = zlib_inflateInit(&msblk->stream); -- if (zlib_err != Z_OK) { -- ERROR("zlib_inflateInit returned" -- " unexpected result 0x%x," -- " srclength %d\n", zlib_err, -- srclength); -+ if (!decomp_init) { -+ res = crypto_decompress_init(msblk->tfm); -+ if (res) { -+ ERROR("crypto_decompress_init " -+ "returned %d, srclength %d\n", -+ res, srclength); - goto release_mutex; - } -- zlib_init = 1; -+ decomp_init = 1; - } - -- zlib_err = zlib_inflate(&msblk->stream, Z_SYNC_FLUSH); -+ res = crypto_decompress_update(msblk->tfm, &req); -+ if (res < 0) { -+ ERROR("crypto_decompress_update returned %d, " -+ "data probably corrupt\n", res); -+ goto release_mutex; -+ } -+ length += res; - -- if (msblk->stream.avail_in == 0 && k < b) -+ if (req.avail_in == 0 && k < b) - put_bh(bh[k++]); -- } while (zlib_err == Z_OK); -+ } while (bytes || res); - -- if (zlib_err != Z_STREAM_END) { -- ERROR("zlib_inflate error, data probably corrupt\n"); -+ res = crypto_decompress_final(msblk->tfm, &req); -+ if (res < 0) { -+ ERROR("crypto_decompress_final returned %d, data " -+ "probably corrupt\n", res); - goto release_mutex; - } -+ length += res; - -- zlib_err = zlib_inflateEnd(&msblk->stream); -- if (zlib_err != Z_OK) { -- ERROR("zlib_inflate error, data probably corrupt\n"); -- goto release_mutex; -- } -- length = msblk->stream.total_out; - mutex_unlock(&msblk->read_data_mutex); - } else { - /* ---- a/fs/squashfs/squashfs_fs_sb.h -+++ b/fs/squashfs/squashfs_fs_sb.h -@@ -64,7 +64,7 @@ struct squashfs_sb_info { - struct mutex read_data_mutex; - struct mutex meta_index_mutex; - struct meta_index *meta_index; -- z_stream stream; -+ struct crypto_pcomp *tfm; - __le64 *inode_lookup_table; - u64 inode_table; - u64 directory_table; ---- a/fs/squashfs/super.c -+++ b/fs/squashfs/super.c -@@ -37,11 +37,19 @@ - #include - #include - -+#include -+ -+#include -+ - #include "squashfs_fs.h" - #include "squashfs_fs_sb.h" - #include "squashfs_fs_i.h" - #include "squashfs.h" - -+ -+#define SQUASHFS_CRYPTO_ALG "zlib" -+ -+ - static struct file_system_type squashfs_fs_type; - static struct super_operations squashfs_super_ops; - -@@ -75,6 +83,16 @@ static int squashfs_fill_super(struct su - unsigned short flags; - unsigned int fragments; - u64 lookup_table_start; -+ struct { -+ struct nlattr nla; -+ int val; -+ } params = { -+ .nla = { -+ .nla_len = nla_attr_size(sizeof(int)), -+ .nla_type = ZLIB_DECOMP_WINDOWBITS, -+ }, -+ .val = DEF_WBITS, -+ }; - int err; - - TRACE("Entered squashfs_fill_superblock\n"); -@@ -86,16 +104,25 @@ static int squashfs_fill_super(struct su - } - msblk = sb->s_fs_info; - -- msblk->stream.workspace = kmalloc(zlib_inflate_workspacesize(), -- GFP_KERNEL); -- if (msblk->stream.workspace == NULL) { -- ERROR("Failed to allocate zlib workspace\n"); -+ msblk->tfm = crypto_alloc_pcomp(SQUASHFS_CRYPTO_ALG, 0, -+ CRYPTO_ALG_ASYNC); -+ if (IS_ERR(msblk->tfm)) { -+ ERROR("Failed to load %s crypto module\n", -+ SQUASHFS_CRYPTO_ALG); -+ err = PTR_ERR(msblk->tfm); -+ goto failed_pcomp; -+ } -+ -+ err = crypto_decompress_setup(msblk->tfm, ¶ms, sizeof(params)); -+ if (err) { -+ ERROR("Failed to set up decompression parameters\n"); - goto failure; - } - - sblk = kzalloc(sizeof(*sblk), GFP_KERNEL); - if (sblk == NULL) { - ERROR("Failed to allocate squashfs_super_block\n"); -+ err = -ENOMEM; - goto failure; - } - -@@ -294,17 +321,18 @@ failed_mount: - kfree(msblk->inode_lookup_table); - kfree(msblk->fragment_index); - kfree(msblk->id_table); -- kfree(msblk->stream.workspace); -+ crypto_free_pcomp(msblk->tfm); - kfree(sb->s_fs_info); - sb->s_fs_info = NULL; - kfree(sblk); - return err; - - failure: -- kfree(msblk->stream.workspace); -+ crypto_free_pcomp(msblk->tfm); -+failed_pcomp: - kfree(sb->s_fs_info); - sb->s_fs_info = NULL; -- return -ENOMEM; -+ return err; - } - - -@@ -346,7 +374,7 @@ static void squashfs_put_super(struct su - kfree(sbi->id_table); - kfree(sbi->fragment_index); - kfree(sbi->meta_index); -- kfree(sbi->stream.workspace); -+ crypto_free_pcomp(sbi->tfm); - kfree(sb->s_fs_info); - sb->s_fs_info = NULL; - } diff --git a/target/linux/generic-2.6/patches-2.6.30/052-pcomp_lzma_support.patch b/target/linux/generic-2.6/patches-2.6.30/052-pcomp_lzma_support.patch deleted file mode 100644 index d20285c5c..000000000 --- a/target/linux/generic-2.6/patches-2.6.30/052-pcomp_lzma_support.patch +++ /dev/null @@ -1,901 +0,0 @@ ---- /dev/null -+++ b/crypto/unlzma.c -@@ -0,0 +1,775 @@ -+/* -+ * LZMA uncompresion module for pcomp -+ * Copyright (C) 2009 Felix Fietkau -+ * -+ * Based on: -+ * Initial Linux kernel adaptation -+ * Copyright (C) 2006 Alain < alain@knaff.lu > -+ * -+ * Based on small lzma deflate implementation/Small range coder -+ * implementation for lzma. -+ * Copyright (C) 2006 Aurelien Jacobs < aurel@gnuage.org > -+ * -+ * Based on LzmaDecode.c from the LZMA SDK 4.22 (http://www.7-zip.org/) -+ * Copyright (C) 1999-2005 Igor Pavlov -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ * -+ * FIXME: the current implementation assumes that the caller will -+ * not free any output buffers until the whole decompression has been -+ * completed. This is necessary, because LZMA looks back at old output -+ * instead of doing a separate dictionary allocation, which saves RAM. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include "unlzma.h" -+ -+static int instance = 0; -+ -+struct unlzma_buffer { -+ int offset; -+ int size; -+ u8 *ptr; -+}; -+ -+struct unlzma_ctx { -+ struct task_struct *thread; -+ wait_queue_head_t next_req; -+ wait_queue_head_t req_done; -+ struct mutex mutex; -+ bool waiting; -+ bool active; -+ bool cancel; -+ -+ const u8 *next_in; -+ int avail_in; -+ -+ u8 *next_out; -+ int avail_out; -+ -+ /* reader state */ -+ u32 code; -+ u32 range; -+ u32 bound; -+ -+ /* writer state */ -+ u8 previous_byte; -+ ssize_t pos; -+ int buf_full; -+ int n_buffers; -+ int buffers_max; -+ struct unlzma_buffer *buffers; -+ -+ /* cstate */ -+ int state; -+ u32 rep0, rep1, rep2, rep3; -+ -+ u32 dict_size; -+ -+ void *workspace; -+ int workspace_size; -+}; -+ -+static inline bool -+unlzma_should_stop(struct unlzma_ctx *ctx) -+{ -+ return unlikely(kthread_should_stop() || ctx->cancel); -+} -+ -+static void -+get_buffer(struct unlzma_ctx *ctx) -+{ -+ struct unlzma_buffer *bh; -+ -+ BUG_ON(ctx->n_buffers >= ctx->buffers_max); -+ bh = &ctx->buffers[ctx->n_buffers++]; -+ bh->ptr = ctx->next_out; -+ bh->offset = ctx->pos; -+ bh->size = ctx->avail_out; -+ ctx->buf_full = 0; -+} -+ -+static void -+unlzma_request_buffer(struct unlzma_ctx *ctx, int *avail) -+{ -+ do { -+ ctx->waiting = true; -+ mutex_unlock(&ctx->mutex); -+ wake_up(&ctx->req_done); -+ if (wait_event_interruptible(ctx->next_req, -+ unlzma_should_stop(ctx) || (*avail > 0))) -+ schedule(); -+ mutex_lock(&ctx->mutex); -+ } while (*avail <= 0 && !unlzma_should_stop(ctx)); -+ -+ if (!unlzma_should_stop(ctx) && ctx->buf_full) -+ get_buffer(ctx); -+} -+ -+static u8 -+rc_read(struct unlzma_ctx *ctx) -+{ -+ if (unlikely(ctx->avail_in <= 0)) -+ unlzma_request_buffer(ctx, &ctx->avail_in); -+ -+ if (unlzma_should_stop(ctx)) -+ return 0; -+ -+ ctx->avail_in--; -+ return *(ctx->next_in++); -+} -+ -+ -+static inline void -+rc_get_code(struct unlzma_ctx *ctx) -+{ -+ ctx->code = (ctx->code << 8) | rc_read(ctx); -+} -+ -+static void -+rc_normalize(struct unlzma_ctx *ctx) -+{ -+ if (ctx->range < (1 << RC_TOP_BITS)) { -+ ctx->range <<= 8; -+ rc_get_code(ctx); -+ } -+} -+ -+static int -+rc_is_bit_0(struct unlzma_ctx *ctx, u16 *p) -+{ -+ rc_normalize(ctx); -+ ctx->bound = *p * (ctx->range >> RC_MODEL_TOTAL_BITS); -+ return ctx->code < ctx->bound; -+} -+ -+static void -+rc_update_bit_0(struct unlzma_ctx *ctx, u16 *p) -+{ -+ ctx->range = ctx->bound; -+ *p += ((1 << RC_MODEL_TOTAL_BITS) - *p) >> RC_MOVE_BITS; -+} -+ -+static void -+rc_update_bit_1(struct unlzma_ctx *ctx, u16 *p) -+{ -+ ctx->range -= ctx->bound; -+ ctx->code -= ctx->bound; -+ *p -= *p >> RC_MOVE_BITS; -+} -+ -+static bool -+rc_get_bit(struct unlzma_ctx *ctx, u16 *p, int *symbol) -+{ -+ if (rc_is_bit_0(ctx, p)) { -+ rc_update_bit_0(ctx, p); -+ *symbol *= 2; -+ return 0; -+ } else { -+ rc_update_bit_1(ctx, p); -+ *symbol = *symbol * 2 + 1; -+ return 1; -+ } -+} -+ -+static int -+rc_direct_bit(struct unlzma_ctx *ctx) -+{ -+ rc_normalize(ctx); -+ ctx->range >>= 1; -+ if (ctx->code >= ctx->range) { -+ ctx->code -= ctx->range; -+ return 1; -+ } -+ return 0; -+} -+ -+static void -+rc_bit_tree_decode(struct unlzma_ctx *ctx, u16 *p, int num_levels, int *symbol) -+{ -+ int i = num_levels; -+ -+ *symbol = 1; -+ while (i--) -+ rc_get_bit(ctx, p + *symbol, symbol); -+ *symbol -= 1 << num_levels; -+} -+ -+static u8 -+peek_old_byte(struct unlzma_ctx *ctx, u32 offs) -+{ -+ struct unlzma_buffer *bh = &ctx->buffers[ctx->n_buffers - 1]; -+ int i = ctx->n_buffers; -+ u32 pos; -+ -+ if (!ctx->n_buffers) { -+ printk(KERN_ERR "unlzma/%s: no buffer\n", __func__); -+ goto error; -+ } -+ -+ pos = ctx->pos - offs; -+ if (unlikely(pos >= ctx->dict_size)) -+ pos = ~pos & (ctx->dict_size - 1); -+ -+ while (bh->offset > pos) { -+ bh--; -+ i--; -+ if (!i) { -+ printk(KERN_ERR "unlzma/%s: position %d out of range\n", __func__, pos); -+ goto error; -+ } -+ } -+ -+ pos -= bh->offset; -+ if (pos >= bh->size) { -+ printk(KERN_ERR "unlzma/%s: position %d out of range\n", __func__, pos); -+ goto error; -+ } -+ -+ return bh->ptr[pos]; -+ -+error: -+ ctx->cancel = true; -+ return 0; -+} -+ -+static void -+write_byte(struct unlzma_ctx *ctx, u8 byte) -+{ -+ if (unlikely(ctx->avail_out <= 0)) { -+ unlzma_request_buffer(ctx, &ctx->avail_out); -+ } -+ -+ if (!ctx->avail_out) -+ return; -+ -+ ctx->previous_byte = byte; -+ *(ctx->next_out++) = byte; -+ ctx->avail_out--; -+ if (ctx->avail_out == 0) -+ ctx->buf_full = 1; -+ ctx->pos++; -+} -+ -+ -+static inline void -+copy_byte(struct unlzma_ctx *ctx, u32 offs) -+{ -+ write_byte(ctx, peek_old_byte(ctx, offs)); -+} -+ -+static void -+copy_bytes(struct unlzma_ctx *ctx, u32 rep0, int len) -+{ -+ do { -+ copy_byte(ctx, rep0); -+ len--; -+ if (unlzma_should_stop(ctx)) -+ break; -+ } while (len != 0); -+} -+ -+static void -+process_bit0(struct unlzma_ctx *ctx, u16 *p, int pos_state, u16 *prob, -+ int lc, u32 literal_pos_mask) -+{ -+ int mi = 1; -+ rc_update_bit_0(ctx, prob); -+ prob = (p + LZMA_LITERAL + -+ (LZMA_LIT_SIZE -+ * (((ctx->pos & literal_pos_mask) << lc) -+ + (ctx->previous_byte >> (8 - lc)))) -+ ); -+ -+ if (ctx->state >= LZMA_NUM_LIT_STATES) { -+ int match_byte = peek_old_byte(ctx, ctx->rep0); -+ do { -+ u16 bit; -+ u16 *prob_lit; -+ -+ match_byte <<= 1; -+ bit = match_byte & 0x100; -+ prob_lit = prob + 0x100 + bit + mi; -+ if (rc_get_bit(ctx, prob_lit, &mi) != !!bit) -+ break; -+ } while (mi < 0x100); -+ } -+ while (mi < 0x100) { -+ u16 *prob_lit = prob + mi; -+ rc_get_bit(ctx, prob_lit, &mi); -+ } -+ write_byte(ctx, mi); -+ if (ctx->state < 4) -+ ctx->state = 0; -+ else if (ctx->state < 10) -+ ctx->state -= 3; -+ else -+ ctx->state -= 6; -+} -+ -+static void -+process_bit1(struct unlzma_ctx *ctx, u16 *p, int pos_state, u16 *prob) -+{ -+ int offset; -+ u16 *prob_len; -+ int num_bits; -+ int len; -+ -+ rc_update_bit_1(ctx, prob); -+ prob = p + LZMA_IS_REP + ctx->state; -+ if (rc_is_bit_0(ctx, prob)) { -+ rc_update_bit_0(ctx, prob); -+ ctx->rep3 = ctx->rep2; -+ ctx->rep2 = ctx->rep1; -+ ctx->rep1 = ctx->rep0; -+ ctx->state = ctx->state < LZMA_NUM_LIT_STATES ? 0 : 3; -+ prob = p + LZMA_LEN_CODER; -+ } else { -+ rc_update_bit_1(ctx, prob); -+ prob = p + LZMA_IS_REP_G0 + ctx->state; -+ if (rc_is_bit_0(ctx, prob)) { -+ rc_update_bit_0(ctx, prob); -+ prob = (p + LZMA_IS_REP_0_LONG -+ + (ctx->state << -+ LZMA_NUM_POS_BITS_MAX) + -+ pos_state); -+ if (rc_is_bit_0(ctx, prob)) { -+ rc_update_bit_0(ctx, prob); -+ -+ ctx->state = ctx->state < LZMA_NUM_LIT_STATES ? -+ 9 : 11; -+ copy_byte(ctx, ctx->rep0); -+ return; -+ } else { -+ rc_update_bit_1(ctx, prob); -+ } -+ } else { -+ u32 distance; -+ -+ rc_update_bit_1(ctx, prob); -+ prob = p + LZMA_IS_REP_G1 + ctx->state; -+ if (rc_is_bit_0(ctx, prob)) { -+ rc_update_bit_0(ctx, prob); -+ distance = ctx->rep1; -+ } else { -+ rc_update_bit_1(ctx, prob); -+ prob = p + LZMA_IS_REP_G2 + ctx->state; -+ if (rc_is_bit_0(ctx, prob)) { -+ rc_update_bit_0(ctx, prob); -+ distance = ctx->rep2; -+ } else { -+ rc_update_bit_1(ctx, prob); -+ distance = ctx->rep3; -+ ctx->rep3 = ctx->rep2; -+ } -+ ctx->rep2 = ctx->rep1; -+ } -+ ctx->rep1 = ctx->rep0; -+ ctx->rep0 = distance; -+ } -+ ctx->state = ctx->state < LZMA_NUM_LIT_STATES ? 8 : 11; -+ prob = p + LZMA_REP_LEN_CODER; -+ } -+ -+ prob_len = prob + LZMA_LEN_CHOICE; -+ if (rc_is_bit_0(ctx, prob_len)) { -+ rc_update_bit_0(ctx, prob_len); -+ prob_len = (prob + LZMA_LEN_LOW -+ + (pos_state << -+ LZMA_LEN_NUM_LOW_BITS)); -+ offset = 0; -+ num_bits = LZMA_LEN_NUM_LOW_BITS; -+ } else { -+ rc_update_bit_1(ctx, prob_len); -+ prob_len = prob + LZMA_LEN_CHOICE_2; -+ if (rc_is_bit_0(ctx, prob_len)) { -+ rc_update_bit_0(ctx, prob_len); -+ prob_len = (prob + LZMA_LEN_MID -+ + (pos_state << -+ LZMA_LEN_NUM_MID_BITS)); -+ offset = 1 << LZMA_LEN_NUM_LOW_BITS; -+ num_bits = LZMA_LEN_NUM_MID_BITS; -+ } else { -+ rc_update_bit_1(ctx, prob_len); -+ prob_len = prob + LZMA_LEN_HIGH; -+ offset = ((1 << LZMA_LEN_NUM_LOW_BITS) -+ + (1 << LZMA_LEN_NUM_MID_BITS)); -+ num_bits = LZMA_LEN_NUM_HIGH_BITS; -+ } -+ } -+ -+ rc_bit_tree_decode(ctx, prob_len, num_bits, &len); -+ len += offset; -+ -+ if (ctx->state < 4) { -+ int pos_slot; -+ -+ ctx->state += LZMA_NUM_LIT_STATES; -+ prob = -+ p + LZMA_POS_SLOT + -+ ((len < -+ LZMA_NUM_LEN_TO_POS_STATES ? len : -+ LZMA_NUM_LEN_TO_POS_STATES - 1) -+ << LZMA_NUM_POS_SLOT_BITS); -+ rc_bit_tree_decode(ctx, prob, -+ LZMA_NUM_POS_SLOT_BITS, -+ &pos_slot); -+ if (pos_slot >= LZMA_START_POS_MODEL_INDEX) { -+ int i, mi; -+ num_bits = (pos_slot >> 1) - 1; -+ ctx->rep0 = 2 | (pos_slot & 1); -+ if (pos_slot < LZMA_END_POS_MODEL_INDEX) { -+ ctx->rep0 <<= num_bits; -+ prob = p + LZMA_SPEC_POS + -+ ctx->rep0 - pos_slot - 1; -+ } else { -+ num_bits -= LZMA_NUM_ALIGN_BITS; -+ while (num_bits--) -+ ctx->rep0 = (ctx->rep0 << 1) | -+ rc_direct_bit(ctx); -+ prob = p + LZMA_ALIGN; -+ ctx->rep0 <<= LZMA_NUM_ALIGN_BITS; -+ num_bits = LZMA_NUM_ALIGN_BITS; -+ } -+ i = 1; -+ mi = 1; -+ while (num_bits--) { -+ if (rc_get_bit(ctx, prob + mi, &mi)) -+ ctx->rep0 |= i; -+ i <<= 1; -+ } -+ } else -+ ctx->rep0 = pos_slot; -+ if (++(ctx->rep0) == 0) -+ return; -+ } -+ -+ len += LZMA_MATCH_MIN_LEN; -+ -+ copy_bytes(ctx, ctx->rep0, len); -+} -+ -+ -+static int -+do_unlzma(struct unlzma_ctx *ctx) -+{ -+ u8 hdr_buf[sizeof(struct lzma_header)]; -+ struct lzma_header *header = (struct lzma_header *)hdr_buf; -+ u32 pos_state_mask; -+ u32 literal_pos_mask; -+ int lc, pb, lp; -+ int num_probs; -+ int i, mi; -+ u16 *p; -+ -+ for (i = 0; i < sizeof(struct lzma_header); i++) { -+ hdr_buf[i] = rc_read(ctx); -+ } -+ -+ ctx->n_buffers = 0; -+ ctx->pos = 0; -+ get_buffer(ctx); -+ ctx->active = true; -+ ctx->state = 0; -+ ctx->rep0 = ctx->rep1 = ctx->rep2 = ctx->rep3 = 1; -+ -+ ctx->previous_byte = 0; -+ ctx->code = 0; -+ ctx->range = 0xFFFFFFFF; -+ -+ ctx->dict_size = le32_to_cpu(header->dict_size); -+ -+ if (header->pos >= (9 * 5 * 5)) -+ return -1; -+ -+ mi = 0; -+ lc = header->pos; -+ while (lc >= 9) { -+ mi++; -+ lc -= 9; -+ } -+ pb = 0; -+ lp = mi; -+ while (lp >= 5) { -+ pb++; -+ lp -= 5; -+ } -+ pos_state_mask = (1 << pb) - 1; -+ literal_pos_mask = (1 << lp) - 1; -+ -+ if (ctx->dict_size == 0) -+ ctx->dict_size = 1; -+ -+ num_probs = LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp)); -+ if (ctx->workspace_size < num_probs * sizeof(*p)) { -+ if (ctx->workspace) -+ vfree(ctx->workspace); -+ ctx->workspace_size = num_probs * sizeof(*p); -+ ctx->workspace = vmalloc(ctx->workspace_size); -+ } -+ p = (u16 *) ctx->workspace; -+ if (!p) -+ return -1; -+ -+ num_probs = LZMA_LITERAL + (LZMA_LIT_SIZE << (lc + lp)); -+ for (i = 0; i < num_probs; i++) -+ p[i] = (1 << RC_MODEL_TOTAL_BITS) >> 1; -+ -+ for (i = 0; i < 5; i++) -+ rc_get_code(ctx); -+ -+ while (1) { -+ int pos_state = ctx->pos & pos_state_mask; -+ u16 *prob = p + LZMA_IS_MATCH + -+ (ctx->state << LZMA_NUM_POS_BITS_MAX) + pos_state; -+ if (rc_is_bit_0(ctx, prob)) -+ process_bit0(ctx, p, pos_state, prob, -+ lc, literal_pos_mask); -+ else { -+ process_bit1(ctx, p, pos_state, prob); -+ if (ctx->rep0 == 0) -+ break; -+ } -+ if (unlzma_should_stop(ctx)) -+ break; -+ } -+ if (likely(!unlzma_should_stop(ctx))) -+ rc_normalize(ctx); -+ -+ return ctx->pos; -+} -+ -+ -+static void -+unlzma_reset_buf(struct unlzma_ctx *ctx) -+{ -+ ctx->avail_in = 0; -+ ctx->next_in = NULL; -+ ctx->avail_out = 0; -+ ctx->next_out = NULL; -+} -+ -+static int -+unlzma_thread(void *data) -+{ -+ struct unlzma_ctx *ctx = data; -+ -+ mutex_lock(&ctx->mutex); -+ do { -+ if (do_unlzma(ctx) < 0) -+ ctx->pos = 0; -+ unlzma_reset_buf(ctx); -+ ctx->cancel = false; -+ ctx->active = false; -+ } while (!kthread_should_stop()); -+ mutex_unlock(&ctx->mutex); -+ return 0; -+} -+ -+ -+static int -+unlzma_init(struct crypto_tfm *tfm) -+{ -+ return 0; -+} -+ -+static void -+unlzma_cancel(struct unlzma_ctx *ctx) -+{ -+ unlzma_reset_buf(ctx); -+ -+ if (!ctx->active) -+ return; -+ -+ ctx->cancel = true; -+ do { -+ mutex_unlock(&ctx->mutex); -+ wake_up(&ctx->next_req); -+ schedule(); -+ mutex_lock(&ctx->mutex); -+ } while (ctx->cancel); -+} -+ -+ -+static void -+unlzma_exit(struct crypto_tfm *tfm) -+{ -+ struct unlzma_ctx *ctx = crypto_tfm_ctx(tfm); -+ -+ if (ctx->thread) { -+ unlzma_cancel(ctx); -+ kthread_stop(ctx->thread); -+ ctx->thread = NULL; -+ if (ctx->buffers) -+ kfree(ctx->buffers); -+ ctx->buffers_max = 0; -+ ctx->buffers = NULL; -+ } -+} -+ -+static int -+unlzma_decompress_setup(struct crypto_pcomp *tfm, void *p, unsigned int len) -+{ -+ struct unlzma_ctx *ctx = crypto_tfm_ctx(crypto_pcomp_tfm(tfm)); -+ struct nlattr *tb[UNLZMA_DECOMP_MAX + 1]; -+ int ret = 0; -+ -+ if (ctx->thread) -+ return -EINVAL; -+ -+ if (!p) -+ return -EINVAL; -+ -+ ret = nla_parse(tb, UNLZMA_DECOMP_MAX, p, len, NULL); -+ if (ret) -+ return ret; -+ -+ if (!tb[UNLZMA_DECOMP_OUT_BUFFERS]) -+ return -EINVAL; -+ -+ if (ctx->buffers_max && (ctx->buffers_max < -+ nla_get_u32(tb[UNLZMA_DECOMP_OUT_BUFFERS]))) { -+ kfree(ctx->buffers); -+ ctx->buffers_max = 0; -+ ctx->buffers = NULL; -+ } -+ if (!ctx->buffers) { -+ ctx->buffers_max = nla_get_u32(tb[UNLZMA_DECOMP_OUT_BUFFERS]); -+ ctx->buffers = kzalloc(sizeof(struct unlzma_buffer) * ctx->buffers_max, GFP_KERNEL); -+ } -+ if (!ctx->buffers) -+ return -ENOMEM; -+ -+ ctx->waiting = false; -+ mutex_init(&ctx->mutex); -+ init_waitqueue_head(&ctx->next_req); -+ init_waitqueue_head(&ctx->req_done); -+ ctx->thread = kthread_run(unlzma_thread, ctx, "unlzma/%d", instance++); -+ if (IS_ERR(ctx->thread)) { -+ ret = PTR_ERR(ctx->thread); -+ ctx->thread = NULL; -+ } -+ -+ return ret; -+} -+ -+static int -+unlzma_decompress_init(struct crypto_pcomp *tfm) -+{ -+ return 0; -+} -+ -+static void -+unlzma_wait_complete(struct unlzma_ctx *ctx, bool finish) -+{ -+ DEFINE_WAIT(__wait); -+ -+ do { -+ wake_up(&ctx->next_req); -+ prepare_to_wait(&ctx->req_done, &__wait, TASK_INTERRUPTIBLE); -+ mutex_unlock(&ctx->mutex); -+ schedule(); -+ mutex_lock(&ctx->mutex); -+ } while (!ctx->waiting && ctx->active); -+ finish_wait(&ctx->req_done, &__wait); -+} -+ -+static int -+unlzma_decompress_update(struct crypto_pcomp *tfm, struct comp_request *req) -+{ -+ struct unlzma_ctx *ctx = crypto_tfm_ctx(crypto_pcomp_tfm(tfm)); -+ size_t pos = 0; -+ -+ mutex_lock(&ctx->mutex); -+ if (!ctx->active && !req->avail_in) -+ goto out; -+ -+ pos = ctx->pos; -+ ctx->waiting = false; -+ ctx->next_in = req->next_in; -+ ctx->avail_in = req->avail_in; -+ ctx->next_out = req->next_out; -+ ctx->avail_out = req->avail_out; -+ -+ unlzma_wait_complete(ctx, false); -+ -+ req->next_in = ctx->next_in; -+ req->avail_in = ctx->avail_in; -+ req->next_out = ctx->next_out; -+ req->avail_out = ctx->avail_out; -+ ctx->next_in = 0; -+ ctx->avail_in = 0; -+ pos = ctx->pos - pos; -+ -+out: -+ mutex_unlock(&ctx->mutex); -+ if (ctx->cancel) -+ return -EINVAL; -+ -+ return pos; -+} -+ -+static int -+unlzma_decompress_final(struct crypto_pcomp *tfm, struct comp_request *req) -+{ -+ struct unlzma_ctx *ctx = crypto_tfm_ctx(crypto_pcomp_tfm(tfm)); -+ int ret = 0; -+ -+ /* cancel pending operation */ -+ mutex_lock(&ctx->mutex); -+ if (ctx->active) { -+ // ret = -EINVAL; -+ unlzma_cancel(ctx); -+ } -+ ctx->pos = 0; -+ mutex_unlock(&ctx->mutex); -+ return ret; -+} -+ -+ -+static struct pcomp_alg unlzma_alg = { -+ .decompress_setup = unlzma_decompress_setup, -+ .decompress_init = unlzma_decompress_init, -+ .decompress_update = unlzma_decompress_update, -+ .decompress_final = unlzma_decompress_final, -+ -+ .base = { -+ .cra_name = "lzma", -+ .cra_flags = CRYPTO_ALG_TYPE_PCOMPRESS, -+ .cra_ctxsize = sizeof(struct unlzma_ctx), -+ .cra_module = THIS_MODULE, -+ .cra_init = unlzma_init, -+ .cra_exit = unlzma_exit, -+ } -+}; -+ -+static int __init -+unlzma_mod_init(void) -+{ -+ return crypto_register_pcomp(&unlzma_alg); -+} -+ -+static void __exit -+unlzma_mod_exit(void) -+{ -+ crypto_unregister_pcomp(&unlzma_alg); -+} -+ -+module_init(unlzma_mod_init); -+module_exit(unlzma_mod_exit); -+ -+MODULE_LICENSE("GPL"); -+MODULE_DESCRIPTION("LZMA Decompression Algorithm"); -+MODULE_AUTHOR("Felix Fietkau "); ---- a/crypto/Kconfig -+++ b/crypto/Kconfig -@@ -758,6 +758,12 @@ config CRYPTO_ZLIB - help - This is the zlib algorithm. - -+config CRYPTO_UNLZMA -+ tristate "LZMA decompression" -+ select CRYPTO_PCOMP -+ help -+ This is the lzma decompression module. -+ - config CRYPTO_LZO - tristate "LZO compression algorithm" - select CRYPTO_ALGAPI ---- a/crypto/Makefile -+++ b/crypto/Makefile -@@ -75,6 +75,7 @@ obj-$(CONFIG_CRYPTO_SEED) += seed.o - obj-$(CONFIG_CRYPTO_SALSA20) += salsa20_generic.o - obj-$(CONFIG_CRYPTO_DEFLATE) += deflate.o - obj-$(CONFIG_CRYPTO_ZLIB) += zlib.o -+obj-$(CONFIG_CRYPTO_UNLZMA) += unlzma.o - obj-$(CONFIG_CRYPTO_MICHAEL_MIC) += michael_mic.o - obj-$(CONFIG_CRYPTO_CRC32C) += crc32c.o - obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.o ---- /dev/null -+++ b/crypto/unlzma.h -@@ -0,0 +1,80 @@ -+/* LZMA uncompresion module for pcomp -+ * Copyright (C) 2009 Felix Fietkau -+ * -+ * Based on: -+ * Initial Linux kernel adaptation -+ * Copyright (C) 2006 Alain < alain@knaff.lu > -+ * -+ * Based on small lzma deflate implementation/Small range coder -+ * implementation for lzma. -+ * Copyright (C) 2006 Aurelien Jacobs < aurel@gnuage.org > -+ * -+ * Based on LzmaDecode.c from the LZMA SDK 4.22 (http://www.7-zip.org/) -+ * Copyright (C) 1999-2005 Igor Pavlov -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ */ -+#ifndef __UNLZMA_H -+#define __UNLZMA_H -+ -+struct lzma_header { -+ __u8 pos; -+ __le32 dict_size; -+} __attribute__ ((packed)) ; -+ -+ -+#define RC_TOP_BITS 24 -+#define RC_MOVE_BITS 5 -+#define RC_MODEL_TOTAL_BITS 11 -+ -+#define LZMA_BASE_SIZE 1846 -+#define LZMA_LIT_SIZE 768 -+ -+#define LZMA_NUM_POS_BITS_MAX 4 -+ -+#define LZMA_LEN_NUM_LOW_BITS 3 -+#define LZMA_LEN_NUM_MID_BITS 3 -+#define LZMA_LEN_NUM_HIGH_BITS 8 -+ -+#define LZMA_LEN_CHOICE 0 -+#define LZMA_LEN_CHOICE_2 (LZMA_LEN_CHOICE + 1) -+#define LZMA_LEN_LOW (LZMA_LEN_CHOICE_2 + 1) -+#define LZMA_LEN_MID (LZMA_LEN_LOW \ -+ + (1 << (LZMA_NUM_POS_BITS_MAX + LZMA_LEN_NUM_LOW_BITS))) -+#define LZMA_LEN_HIGH (LZMA_LEN_MID \ -+ +(1 << (LZMA_NUM_POS_BITS_MAX + LZMA_LEN_NUM_MID_BITS))) -+#define LZMA_NUM_LEN_PROBS (LZMA_LEN_HIGH + (1 << LZMA_LEN_NUM_HIGH_BITS)) -+ -+#define LZMA_NUM_STATES 12 -+#define LZMA_NUM_LIT_STATES 7 -+ -+#define LZMA_START_POS_MODEL_INDEX 4 -+#define LZMA_END_POS_MODEL_INDEX 14 -+#define LZMA_NUM_FULL_DISTANCES (1 << (LZMA_END_POS_MODEL_INDEX >> 1)) -+ -+#define LZMA_NUM_POS_SLOT_BITS 6 -+#define LZMA_NUM_LEN_TO_POS_STATES 4 -+ -+#define LZMA_NUM_ALIGN_BITS 4 -+ -+#define LZMA_MATCH_MIN_LEN 2 -+ -+#define LZMA_IS_MATCH 0 -+#define LZMA_IS_REP (LZMA_IS_MATCH + (LZMA_NUM_STATES << LZMA_NUM_POS_BITS_MAX)) -+#define LZMA_IS_REP_G0 (LZMA_IS_REP + LZMA_NUM_STATES) -+#define LZMA_IS_REP_G1 (LZMA_IS_REP_G0 + LZMA_NUM_STATES) -+#define LZMA_IS_REP_G2 (LZMA_IS_REP_G1 + LZMA_NUM_STATES) -+#define LZMA_IS_REP_0_LONG (LZMA_IS_REP_G2 + LZMA_NUM_STATES) -+#define LZMA_POS_SLOT (LZMA_IS_REP_0_LONG \ -+ + (LZMA_NUM_STATES << LZMA_NUM_POS_BITS_MAX)) -+#define LZMA_SPEC_POS (LZMA_POS_SLOT \ -+ +(LZMA_NUM_LEN_TO_POS_STATES << LZMA_NUM_POS_SLOT_BITS)) -+#define LZMA_ALIGN (LZMA_SPEC_POS \ -+ + LZMA_NUM_FULL_DISTANCES - LZMA_END_POS_MODEL_INDEX) -+#define LZMA_LEN_CODER (LZMA_ALIGN + (1 << LZMA_NUM_ALIGN_BITS)) -+#define LZMA_REP_LEN_CODER (LZMA_LEN_CODER + LZMA_NUM_LEN_PROBS) -+#define LZMA_LITERAL (LZMA_REP_LEN_CODER + LZMA_NUM_LEN_PROBS) -+ -+#endif ---- a/include/crypto/compress.h -+++ b/include/crypto/compress.h -@@ -49,6 +49,12 @@ enum zlib_decomp_params { - - #define ZLIB_DECOMP_MAX (__ZLIB_DECOMP_MAX - 1) - -+enum unlzma_decomp_params { -+ UNLZMA_DECOMP_OUT_BUFFERS = 1, /* naximum number of output buffers */ -+ __UNLZMA_DECOMP_MAX, -+}; -+#define UNLZMA_DECOMP_MAX (__UNLZMA_DECOMP_MAX - 1) -+ - - struct crypto_pcomp { - struct crypto_tfm base; diff --git a/target/linux/generic-2.6/patches-2.6.30/053-squashfs_lzma.patch b/target/linux/generic-2.6/patches-2.6.30/053-squashfs_lzma.patch deleted file mode 100644 index 19deb7335..000000000 --- a/target/linux/generic-2.6/patches-2.6.30/053-squashfs_lzma.patch +++ /dev/null @@ -1,244 +0,0 @@ ---- a/fs/squashfs/Kconfig -+++ b/fs/squashfs/Kconfig -@@ -2,7 +2,6 @@ config SQUASHFS - tristate "SquashFS 4.0 - Squashed file system support" - depends on BLOCK - select CRYPTO -- select CRYPTO_ZLIB - help - Saying Y here includes support for SquashFS 4.0 (a Compressed - Read-Only File System). Squashfs is a highly compressed read-only -@@ -37,6 +36,26 @@ config SQUASHFS_EMBEDDED - - If unsure, say N. - -+config SQUASHFS_SUPPORT_ZLIB -+ bool -+ prompt "Support ZLIB compression" if SQUASHFS_SUPPORT_LZMA -+ depends on SQUASHFS -+ select CRYPTO_ZLIB -+ default y -+ help -+ ZLIB is the default compression used in squashfs. If you are -+ using LZMA compression instead, you can remove support for ZLIB -+ entirely. -+ -+config SQUASHFS_SUPPORT_LZMA -+ bool "Support LZMA compression" -+ depends on SQUASHFS -+ select CRYPTO_UNLZMA -+ help -+ By default SquashFS uses ZLIB compression, however (if your tools -+ support it, you can use LZMA instead, which saves space. -+ -+ - config SQUASHFS_FRAGMENT_CACHE_SIZE - int "Number of fragments cached" if SQUASHFS_EMBEDDED - depends on SQUASHFS ---- a/fs/squashfs/squashfs_fs.h -+++ b/fs/squashfs/squashfs_fs.h -@@ -212,6 +212,7 @@ struct meta_index { - * definitions for structures on disk - */ - #define ZLIB_COMPRESSION 1 -+#define LZMA_COMPRESSION 2 - - struct squashfs_super_block { - __le32 s_magic; ---- a/fs/squashfs/super.c -+++ b/fs/squashfs/super.c -@@ -47,13 +47,76 @@ - #include "squashfs.h" - - --#define SQUASHFS_CRYPTO_ALG "zlib" -+static int squashfs_setup_zlib(struct squashfs_sb_info *msblk) -+{ -+ int err = -EOPNOTSUPP; -+ -+#ifdef CONFIG_SQUASHFS_SUPPORT_ZLIB -+ struct { -+ struct nlattr nla; -+ int val; -+ } params = { -+ .nla = { -+ .nla_len = nla_attr_size(sizeof(int)), -+ .nla_type = ZLIB_DECOMP_WINDOWBITS, -+ }, -+ .val = DEF_WBITS, -+ }; -+ -+ msblk->tfm = crypto_alloc_pcomp("zlib", 0, -+ CRYPTO_ALG_ASYNC); -+ if (IS_ERR(msblk->tfm)) { -+ ERROR("Failed to load zlib crypto module\n"); -+ return PTR_ERR(msblk->tfm); -+ } -+ -+ err = crypto_decompress_setup(msblk->tfm, ¶ms, sizeof(params)); -+ if (err) { -+ ERROR("Failed to set up decompression parameters\n"); -+ crypto_free_pcomp(msblk->tfm); -+ } -+#endif -+ -+ return err; -+} -+ -+static int squashfs_setup_lzma(struct squashfs_sb_info *msblk) -+{ -+ int err = -EOPNOTSUPP; -+ -+#ifdef CONFIG_SQUASHFS_SUPPORT_LZMA -+ struct { -+ struct nlattr nla; -+ int val; -+ } params = { -+ .nla = { -+ .nla_len = nla_attr_size(sizeof(int)), -+ .nla_type = UNLZMA_DECOMP_OUT_BUFFERS, -+ }, -+ .val = (msblk->block_size / PAGE_CACHE_SIZE) + 1 -+ }; - -+ msblk->tfm = crypto_alloc_pcomp("lzma", 0, -+ CRYPTO_ALG_ASYNC); -+ if (IS_ERR(msblk->tfm)) { -+ ERROR("Failed to load lzma crypto module\n"); -+ return PTR_ERR(msblk->tfm); -+ } -+ -+ err = crypto_decompress_setup(msblk->tfm, ¶ms, sizeof(params)); -+ if (err) { -+ ERROR("Failed to set up decompression parameters\n"); -+ crypto_free_pcomp(msblk->tfm); -+ } -+#endif -+ -+ return err; -+} - - static struct file_system_type squashfs_fs_type; - static struct super_operations squashfs_super_ops; - --static int supported_squashfs_filesystem(short major, short minor, short comp) -+static int supported_squashfs_filesystem(short major, short minor) - { - if (major < SQUASHFS_MAJOR) { - ERROR("Major/Minor mismatch, older Squashfs %d.%d " -@@ -66,9 +129,6 @@ static int supported_squashfs_filesystem - return -EINVAL; - } - -- if (comp != ZLIB_COMPRESSION) -- return -EINVAL; -- - return 0; - } - -@@ -83,16 +143,6 @@ static int squashfs_fill_super(struct su - unsigned short flags; - unsigned int fragments; - u64 lookup_table_start; -- struct { -- struct nlattr nla; -- int val; -- } params = { -- .nla = { -- .nla_len = nla_attr_size(sizeof(int)), -- .nla_type = ZLIB_DECOMP_WINDOWBITS, -- }, -- .val = DEF_WBITS, -- }; - int err; - - TRACE("Entered squashfs_fill_superblock\n"); -@@ -104,21 +154,6 @@ static int squashfs_fill_super(struct su - } - msblk = sb->s_fs_info; - -- msblk->tfm = crypto_alloc_pcomp(SQUASHFS_CRYPTO_ALG, 0, -- CRYPTO_ALG_ASYNC); -- if (IS_ERR(msblk->tfm)) { -- ERROR("Failed to load %s crypto module\n", -- SQUASHFS_CRYPTO_ALG); -- err = PTR_ERR(msblk->tfm); -- goto failed_pcomp; -- } -- -- err = crypto_decompress_setup(msblk->tfm, ¶ms, sizeof(params)); -- if (err) { -- ERROR("Failed to set up decompression parameters\n"); -- goto failure; -- } -- - sblk = kzalloc(sizeof(*sblk), GFP_KERNEL); - if (sblk == NULL) { - ERROR("Failed to allocate squashfs_super_block\n"); -@@ -156,10 +191,28 @@ static int squashfs_fill_super(struct su - goto failed_mount; - } - -+ /* Check block size for sanity */ -+ msblk->block_size = le32_to_cpu(sblk->block_size); -+ if (msblk->block_size > SQUASHFS_FILE_MAX_SIZE) -+ goto failed_mount; -+ - /* Check the MAJOR & MINOR versions and compression type */ - err = supported_squashfs_filesystem(le16_to_cpu(sblk->s_major), -- le16_to_cpu(sblk->s_minor), -- le16_to_cpu(sblk->compression)); -+ le16_to_cpu(sblk->s_minor)); -+ if (err < 0) -+ goto failed_mount; -+ -+ switch(le16_to_cpu(sblk->compression)) { -+ case ZLIB_COMPRESSION: -+ err = squashfs_setup_zlib(msblk); -+ break; -+ case LZMA_COMPRESSION: -+ err = squashfs_setup_lzma(msblk); -+ break; -+ default: -+ err = -EINVAL; -+ break; -+ } - if (err < 0) - goto failed_mount; - -@@ -179,11 +232,6 @@ static int squashfs_fill_super(struct su - i_size_read(sb->s_bdev->bd_inode)) - goto failed_mount; - -- /* Check block size for sanity */ -- msblk->block_size = le32_to_cpu(sblk->block_size); -- if (msblk->block_size > SQUASHFS_FILE_MAX_SIZE) -- goto failed_mount; -- - /* - * Check the system page size is not larger than the filesystem - * block size (by default 128K). This is currently not supported. -@@ -315,21 +363,16 @@ allocate_root: - return 0; - - failed_mount: -+ if (msblk->tfm) -+ crypto_free_pcomp(msblk->tfm); - squashfs_cache_delete(msblk->block_cache); - squashfs_cache_delete(msblk->fragment_cache); - squashfs_cache_delete(msblk->read_page); - kfree(msblk->inode_lookup_table); - kfree(msblk->fragment_index); - kfree(msblk->id_table); -- crypto_free_pcomp(msblk->tfm); -- kfree(sb->s_fs_info); -- sb->s_fs_info = NULL; - kfree(sblk); -- return err; -- - failure: -- crypto_free_pcomp(msblk->tfm); --failed_pcomp: - kfree(sb->s_fs_info); - sb->s_fs_info = NULL; - return err; diff --git a/target/linux/generic-2.6/patches-2.6.31/001-squashfs_move_zlib_decomp.patch b/target/linux/generic-2.6/patches-2.6.31/001-squashfs_move_zlib_decomp.patch new file mode 100644 index 000000000..94096791f --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.31/001-squashfs_move_zlib_decomp.patch @@ -0,0 +1,244 @@ +From 6c4419d997d4431bb62e73475cd6b084e83efbd1 Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Tue, 22 Sep 2009 19:25:24 +0100 +Subject: [PATCH] Squashfs: move zlib decompression wrapper code into a separate file + +Signed-off-by: Phillip Lougher +--- + fs/squashfs/Makefile | 2 +- + fs/squashfs/block.c | 74 ++---------------------------- + fs/squashfs/squashfs.h | 4 ++ + fs/squashfs/zlib_wrapper.c | 109 ++++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 118 insertions(+), 71 deletions(-) + create mode 100644 fs/squashfs/zlib_wrapper.c + +--- a/fs/squashfs/Makefile ++++ b/fs/squashfs/Makefile +@@ -4,4 +4,4 @@ + + obj-$(CONFIG_SQUASHFS) += squashfs.o + squashfs-y += block.o cache.o dir.o export.o file.o fragment.o id.o inode.o +-squashfs-y += namei.o super.o symlink.o ++squashfs-y += namei.o super.o symlink.o zlib_wrapper.o +--- a/fs/squashfs/block.c ++++ b/fs/squashfs/block.c +@@ -29,7 +29,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -153,72 +152,10 @@ int squashfs_read_data(struct super_bloc + } + + if (compressed) { +- int zlib_err = 0, zlib_init = 0; +- +- /* +- * Uncompress block. +- */ +- +- mutex_lock(&msblk->read_data_mutex); +- +- msblk->stream.avail_out = 0; +- msblk->stream.avail_in = 0; +- +- bytes = length; +- do { +- if (msblk->stream.avail_in == 0 && k < b) { +- avail = min(bytes, msblk->devblksize - offset); +- bytes -= avail; +- wait_on_buffer(bh[k]); +- if (!buffer_uptodate(bh[k])) +- goto release_mutex; +- +- if (avail == 0) { +- offset = 0; +- put_bh(bh[k++]); +- continue; +- } +- +- msblk->stream.next_in = bh[k]->b_data + offset; +- msblk->stream.avail_in = avail; +- offset = 0; +- } +- +- if (msblk->stream.avail_out == 0 && page < pages) { +- msblk->stream.next_out = buffer[page++]; +- msblk->stream.avail_out = PAGE_CACHE_SIZE; +- } +- +- if (!zlib_init) { +- zlib_err = zlib_inflateInit(&msblk->stream); +- if (zlib_err != Z_OK) { +- ERROR("zlib_inflateInit returned" +- " unexpected result 0x%x," +- " srclength %d\n", zlib_err, +- srclength); +- goto release_mutex; +- } +- zlib_init = 1; +- } +- +- zlib_err = zlib_inflate(&msblk->stream, Z_SYNC_FLUSH); +- +- if (msblk->stream.avail_in == 0 && k < b) +- put_bh(bh[k++]); +- } while (zlib_err == Z_OK); +- +- if (zlib_err != Z_STREAM_END) { +- ERROR("zlib_inflate error, data probably corrupt\n"); +- goto release_mutex; +- } +- +- zlib_err = zlib_inflateEnd(&msblk->stream); +- if (zlib_err != Z_OK) { +- ERROR("zlib_inflate error, data probably corrupt\n"); +- goto release_mutex; +- } +- length = msblk->stream.total_out; +- mutex_unlock(&msblk->read_data_mutex); ++ length = zlib_uncompress(msblk, buffer, bh, b, offset, length, ++ srclength, pages); ++ if (length < 0) ++ goto read_failure; + } else { + /* + * Block is uncompressed. +@@ -255,9 +192,6 @@ int squashfs_read_data(struct super_bloc + kfree(bh); + return length; + +-release_mutex: +- mutex_unlock(&msblk->read_data_mutex); +- + block_release: + for (; k < b; k++) + put_bh(bh[k]); +--- a/fs/squashfs/squashfs.h ++++ b/fs/squashfs/squashfs.h +@@ -70,6 +70,10 @@ extern struct inode *squashfs_iget(struc + unsigned int); + extern int squashfs_read_inode(struct inode *, long long); + ++/* zlib_wrapper.c */ ++extern int zlib_uncompress(struct squashfs_sb_info *, void **, ++ struct buffer_head **, int, int, int, int, int); ++ + /* + * Inodes and files operations + */ +--- /dev/null ++++ b/fs/squashfs/zlib_wrapper.c +@@ -0,0 +1,109 @@ ++/* ++ * Squashfs - a compressed read only filesystem for Linux ++ * ++ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 ++ * Phillip Lougher ++ * ++ * 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, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ * ++ * zlib_wrapper.c ++ */ ++ ++ ++#include ++#include ++#include ++ ++#include "squashfs_fs.h" ++#include "squashfs_fs_sb.h" ++#include "squashfs_fs_i.h" ++#include "squashfs.h" ++ ++int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, ++ struct buffer_head **bh, int b, int offset, int length, int srclength, ++ int pages) ++{ ++ int zlib_err = 0, zlib_init = 0; ++ int avail, bytes, k = 0, page = 0; ++ ++ mutex_lock(&msblk->read_data_mutex); ++ ++ msblk->stream.avail_out = 0; ++ msblk->stream.avail_in = 0; ++ ++ bytes = length; ++ do { ++ if (msblk->stream.avail_in == 0 && k < b) { ++ avail = min(bytes, msblk->devblksize - offset); ++ bytes -= avail; ++ wait_on_buffer(bh[k]); ++ if (!buffer_uptodate(bh[k])) ++ goto release_mutex; ++ ++ if (avail == 0) { ++ offset = 0; ++ put_bh(bh[k++]); ++ continue; ++ } ++ ++ msblk->stream.next_in = bh[k]->b_data + offset; ++ msblk->stream.avail_in = avail; ++ offset = 0; ++ } ++ ++ if (msblk->stream.avail_out == 0 && page < pages) { ++ msblk->stream.next_out = buffer[page++]; ++ msblk->stream.avail_out = PAGE_CACHE_SIZE; ++ } ++ ++ if (!zlib_init) { ++ zlib_err = zlib_inflateInit(&msblk->stream); ++ if (zlib_err != Z_OK) { ++ ERROR("zlib_inflateInit returned unexpected " ++ "result 0x%x, srclength %d\n", ++ zlib_err, srclength); ++ goto release_mutex; ++ } ++ zlib_init = 1; ++ } ++ ++ zlib_err = zlib_inflate(&msblk->stream, Z_SYNC_FLUSH); ++ ++ if (msblk->stream.avail_in == 0 && k < b) ++ put_bh(bh[k++]); ++ } while (zlib_err == Z_OK); ++ ++ if (zlib_err != Z_STREAM_END) { ++ ERROR("zlib_inflate error, data probably corrupt\n"); ++ goto release_mutex; ++ } ++ ++ zlib_err = zlib_inflateEnd(&msblk->stream); ++ if (zlib_err != Z_OK) { ++ ERROR("zlib_inflate error, data probably corrupt\n"); ++ goto release_mutex; ++ } ++ ++ mutex_unlock(&msblk->read_data_mutex); ++ return msblk->stream.total_out; ++ ++release_mutex: ++ mutex_unlock(&msblk->read_data_mutex); ++ ++ for (; k < b; k++) ++ put_bh(bh[k]); ++ ++ return -EIO; ++} diff --git a/target/linux/generic-2.6/patches-2.6.31/002-squashfs_factor_out_remaining_zlib.patch b/target/linux/generic-2.6/patches-2.6.31/002-squashfs_factor_out_remaining_zlib.patch new file mode 100644 index 000000000..eacbb97ae --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.31/002-squashfs_factor_out_remaining_zlib.patch @@ -0,0 +1,317 @@ +From 37c44e85fd49676ec15ccaeea065662c1fbcda7d Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Wed, 23 Sep 2009 19:04:49 +0100 +Subject: [PATCH] Squashfs: Factor out remaining zlib dependencies into separate wrapper file + +Move zlib buffer init/destroy code into separate wrapper file. Also +make zlib z_stream field a void * removing the need to include zlib.h +for most files. + +Signed-off-by: Phillip Lougher +--- + fs/squashfs/block.c | 1 - + fs/squashfs/cache.c | 1 - + fs/squashfs/dir.c | 1 - + fs/squashfs/export.c | 1 - + fs/squashfs/file.c | 1 - + fs/squashfs/fragment.c | 1 - + fs/squashfs/id.c | 1 - + fs/squashfs/inode.c | 1 - + fs/squashfs/namei.c | 1 - + fs/squashfs/squashfs.h | 2 + + fs/squashfs/squashfs_fs_sb.h | 2 +- + fs/squashfs/super.c | 14 +++------ + fs/squashfs/symlink.c | 1 - + fs/squashfs/zlib_wrapper.c | 56 ++++++++++++++++++++++++++++++++--------- + 14 files changed, 51 insertions(+), 33 deletions(-) + +--- a/fs/squashfs/block.c ++++ b/fs/squashfs/block.c +@@ -31,7 +31,6 @@ + #include + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/cache.c ++++ b/fs/squashfs/cache.c +@@ -51,7 +51,6 @@ + #include + #include + #include +-#include + #include + + #include "squashfs_fs.h" +--- a/fs/squashfs/dir.c ++++ b/fs/squashfs/dir.c +@@ -30,7 +30,6 @@ + #include + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/export.c ++++ b/fs/squashfs/export.c +@@ -39,7 +39,6 @@ + #include + #include + #include +-#include + #include + + #include "squashfs_fs.h" +--- a/fs/squashfs/file.c ++++ b/fs/squashfs/file.c +@@ -47,7 +47,6 @@ + #include + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/fragment.c ++++ b/fs/squashfs/fragment.c +@@ -36,7 +36,6 @@ + #include + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/id.c ++++ b/fs/squashfs/id.c +@@ -34,7 +34,6 @@ + #include + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/inode.c ++++ b/fs/squashfs/inode.c +@@ -40,7 +40,6 @@ + + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/namei.c ++++ b/fs/squashfs/namei.c +@@ -57,7 +57,6 @@ + #include + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/squashfs.h ++++ b/fs/squashfs/squashfs.h +@@ -71,6 +71,8 @@ extern struct inode *squashfs_iget(struc + extern int squashfs_read_inode(struct inode *, long long); + + /* zlib_wrapper.c */ ++extern void *zlib_init(void); ++extern void zlib_free(void *); + extern int zlib_uncompress(struct squashfs_sb_info *, void **, + struct buffer_head **, int, int, int, int, int); + +--- a/fs/squashfs/squashfs_fs_sb.h ++++ b/fs/squashfs/squashfs_fs_sb.h +@@ -64,7 +64,7 @@ struct squashfs_sb_info { + struct mutex read_data_mutex; + struct mutex meta_index_mutex; + struct meta_index *meta_index; +- z_stream stream; ++ void *stream; + __le64 *inode_lookup_table; + u64 inode_table; + u64 directory_table; +--- a/fs/squashfs/super.c ++++ b/fs/squashfs/super.c +@@ -35,7 +35,6 @@ + #include + #include + #include +-#include + #include + + #include "squashfs_fs.h" +@@ -87,12 +86,9 @@ static int squashfs_fill_super(struct su + } + msblk = sb->s_fs_info; + +- msblk->stream.workspace = kmalloc(zlib_inflate_workspacesize(), +- GFP_KERNEL); +- if (msblk->stream.workspace == NULL) { +- ERROR("Failed to allocate zlib workspace\n"); ++ msblk->stream = zlib_init(); ++ if (msblk->stream == NULL) + goto failure; +- } + + sblk = kzalloc(sizeof(*sblk), GFP_KERNEL); + if (sblk == NULL) { +@@ -292,17 +288,17 @@ failed_mount: + squashfs_cache_delete(msblk->block_cache); + squashfs_cache_delete(msblk->fragment_cache); + squashfs_cache_delete(msblk->read_page); ++ zlib_free(msblk->stream); + kfree(msblk->inode_lookup_table); + kfree(msblk->fragment_index); + kfree(msblk->id_table); +- kfree(msblk->stream.workspace); + kfree(sb->s_fs_info); + sb->s_fs_info = NULL; + kfree(sblk); + return err; + + failure: +- kfree(msblk->stream.workspace); ++ zlib_free(msblk->stream); + kfree(sb->s_fs_info); + sb->s_fs_info = NULL; + return -ENOMEM; +@@ -346,10 +342,10 @@ static void squashfs_put_super(struct su + squashfs_cache_delete(sbi->block_cache); + squashfs_cache_delete(sbi->fragment_cache); + squashfs_cache_delete(sbi->read_page); ++ zlib_free(sbi->stream); + kfree(sbi->id_table); + kfree(sbi->fragment_index); + kfree(sbi->meta_index); +- kfree(sbi->stream.workspace); + kfree(sb->s_fs_info); + sb->s_fs_info = NULL; + } +--- a/fs/squashfs/symlink.c ++++ b/fs/squashfs/symlink.c +@@ -36,7 +36,6 @@ + #include + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/zlib_wrapper.c ++++ b/fs/squashfs/zlib_wrapper.c +@@ -31,21 +31,51 @@ + #include "squashfs_fs_i.h" + #include "squashfs.h" + ++void *zlib_init() ++{ ++ z_stream *stream = kmalloc(sizeof(z_stream), GFP_KERNEL); ++ if (stream == NULL) ++ goto failed; ++ stream->workspace = kmalloc(zlib_inflate_workspacesize(), ++ GFP_KERNEL); ++ if (stream->workspace == NULL) ++ goto failed; ++ ++ return stream; ++ ++failed: ++ ERROR("Failed to allocate zlib workspace\n"); ++ kfree(stream); ++ return NULL; ++} ++ ++ ++void zlib_free(void *strm) ++{ ++ z_stream *stream = strm; ++ ++ if (stream) ++ kfree(stream->workspace); ++ kfree(stream); ++} ++ ++ + int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, + struct buffer_head **bh, int b, int offset, int length, int srclength, + int pages) + { + int zlib_err = 0, zlib_init = 0; + int avail, bytes, k = 0, page = 0; ++ z_stream *stream = msblk->stream; + + mutex_lock(&msblk->read_data_mutex); + +- msblk->stream.avail_out = 0; +- msblk->stream.avail_in = 0; ++ stream->avail_out = 0; ++ stream->avail_in = 0; + + bytes = length; + do { +- if (msblk->stream.avail_in == 0 && k < b) { ++ if (stream->avail_in == 0 && k < b) { + avail = min(bytes, msblk->devblksize - offset); + bytes -= avail; + wait_on_buffer(bh[k]); +@@ -58,18 +88,18 @@ int zlib_uncompress(struct squashfs_sb_i + continue; + } + +- msblk->stream.next_in = bh[k]->b_data + offset; +- msblk->stream.avail_in = avail; ++ stream->next_in = bh[k]->b_data + offset; ++ stream->avail_in = avail; + offset = 0; + } + +- if (msblk->stream.avail_out == 0 && page < pages) { +- msblk->stream.next_out = buffer[page++]; +- msblk->stream.avail_out = PAGE_CACHE_SIZE; ++ if (stream->avail_out == 0 && page < pages) { ++ stream->next_out = buffer[page++]; ++ stream->avail_out = PAGE_CACHE_SIZE; + } + + if (!zlib_init) { +- zlib_err = zlib_inflateInit(&msblk->stream); ++ zlib_err = zlib_inflateInit(stream); + if (zlib_err != Z_OK) { + ERROR("zlib_inflateInit returned unexpected " + "result 0x%x, srclength %d\n", +@@ -79,9 +109,9 @@ int zlib_uncompress(struct squashfs_sb_i + zlib_init = 1; + } + +- zlib_err = zlib_inflate(&msblk->stream, Z_SYNC_FLUSH); ++ zlib_err = zlib_inflate(stream, Z_SYNC_FLUSH); + +- if (msblk->stream.avail_in == 0 && k < b) ++ if (stream->avail_in == 0 && k < b) + put_bh(bh[k++]); + } while (zlib_err == Z_OK); + +@@ -90,14 +120,14 @@ int zlib_uncompress(struct squashfs_sb_i + goto release_mutex; + } + +- zlib_err = zlib_inflateEnd(&msblk->stream); ++ zlib_err = zlib_inflateEnd(stream); + if (zlib_err != Z_OK) { + ERROR("zlib_inflate error, data probably corrupt\n"); + goto release_mutex; + } + + mutex_unlock(&msblk->read_data_mutex); +- return msblk->stream.total_out; ++ return stream->total_out; + + release_mutex: + mutex_unlock(&msblk->read_data_mutex); diff --git a/target/linux/generic-2.6/patches-2.6.31/003-squashfs_add_decompressor_framework.patch b/target/linux/generic-2.6/patches-2.6.31/003-squashfs_add_decompressor_framework.patch new file mode 100644 index 000000000..cbfbf5369 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.31/003-squashfs_add_decompressor_framework.patch @@ -0,0 +1,426 @@ +From 327fbf47a419befc6bff74f3ca42d2b6f0841903 Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Tue, 6 Oct 2009 04:04:15 +0100 +Subject: [PATCH] Squashfs: add a decompressor framework + +This adds a decompressor framework which allows multiple compression +algorithms to be cleanly supported. + +Also update zlib wrapper and other code to use the new framework. + +Signed-off-by: Phillip Lougher +--- + fs/squashfs/Makefile | 2 +- + fs/squashfs/block.c | 6 ++-- + fs/squashfs/decompressor.c | 58 ++++++++++++++++++++++++++++++++++++++++++ + fs/squashfs/decompressor.h | 55 +++++++++++++++++++++++++++++++++++++++ + fs/squashfs/squashfs.h | 14 +++++----- + fs/squashfs/squashfs_fs_sb.h | 41 +++++++++++++++-------------- + fs/squashfs/super.c | 45 ++++++++++++++++++------------- + fs/squashfs/zlib_wrapper.c | 17 ++++++++++-- + 8 files changed, 185 insertions(+), 53 deletions(-) + create mode 100644 fs/squashfs/decompressor.c + create mode 100644 fs/squashfs/decompressor.h + +--- a/fs/squashfs/Makefile ++++ b/fs/squashfs/Makefile +@@ -4,4 +4,4 @@ + + obj-$(CONFIG_SQUASHFS) += squashfs.o + squashfs-y += block.o cache.o dir.o export.o file.o fragment.o id.o inode.o +-squashfs-y += namei.o super.o symlink.o zlib_wrapper.o ++squashfs-y += namei.o super.o symlink.o zlib_wrapper.o decompressor.o +--- a/fs/squashfs/block.c ++++ b/fs/squashfs/block.c +@@ -36,7 +36,7 @@ + #include "squashfs_fs_sb.h" + #include "squashfs_fs_i.h" + #include "squashfs.h" +- ++#include "decompressor.h" + /* + * Read the metadata block length, this is stored in the first two + * bytes of the metadata block. +@@ -151,8 +151,8 @@ int squashfs_read_data(struct super_bloc + } + + if (compressed) { +- length = zlib_uncompress(msblk, buffer, bh, b, offset, length, +- srclength, pages); ++ length = squashfs_decompress(msblk, buffer, bh, b, offset, ++ length, srclength, pages); + if (length < 0) + goto read_failure; + } else { +--- /dev/null ++++ b/fs/squashfs/decompressor.c +@@ -0,0 +1,58 @@ ++/* ++ * Squashfs - a compressed read only filesystem for Linux ++ * ++ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 ++ * Phillip Lougher ++ * ++ * 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, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ * ++ * decompressor.c ++ */ ++ ++#include ++#include ++#include ++ ++#include "squashfs_fs.h" ++#include "squashfs_fs_sb.h" ++#include "squashfs_fs_i.h" ++#include "decompressor.h" ++#include "squashfs.h" ++ ++/* ++ * This file (and decompressor.h) implements a decompressor framework for ++ * Squashfs, allowing multiple decompressors to be easily supported ++ */ ++ ++static const struct squashfs_decompressor squashfs_unknown_comp_ops = { ++ NULL, NULL, NULL, 0, "unknown", 0 ++}; ++ ++static const struct squashfs_decompressor *decompressor[] = { ++ &squashfs_zlib_comp_ops, ++ &squashfs_unknown_comp_ops ++}; ++ ++ ++const struct squashfs_decompressor *squashfs_lookup_decompressor(int id) ++{ ++ int i; ++ ++ for (i = 0; decompressor[i]->id; i++) ++ if (id == decompressor[i]->id) ++ break; ++ ++ return decompressor[i]; ++} +--- /dev/null ++++ b/fs/squashfs/decompressor.h +@@ -0,0 +1,55 @@ ++#ifndef DECOMPRESSOR_H ++#define DECOMPRESSOR_H ++/* ++ * Squashfs - a compressed read only filesystem for Linux ++ * ++ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 ++ * Phillip Lougher ++ * ++ * 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, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ * ++ * decompressor.h ++ */ ++ ++struct squashfs_decompressor { ++ void *(*init)(void); ++ void (*free)(void *); ++ int (*decompress)(struct squashfs_sb_info *, void **, ++ struct buffer_head **, int, int, int, int, int); ++ int id; ++ char *name; ++ int supported; ++}; ++ ++static inline void *squashfs_decompressor_init(struct squashfs_sb_info *msblk) ++{ ++ return msblk->decompressor->init(); ++} ++ ++static inline void squashfs_decompressor_free(struct squashfs_sb_info *msblk, ++ void *s) ++{ ++ if (msblk->decompressor) ++ msblk->decompressor->free(s); ++} ++ ++static inline int squashfs_decompress(struct squashfs_sb_info *msblk, ++ void **buffer, struct buffer_head **bh, int b, int offset, int length, ++ int srclength, int pages) ++{ ++ return msblk->decompressor->decompress(msblk, buffer, bh, b, offset, ++ length, srclength, pages); ++} ++#endif +--- a/fs/squashfs/squashfs.h ++++ b/fs/squashfs/squashfs.h +@@ -51,6 +51,9 @@ extern struct squashfs_cache_entry *squa + u64, int); + extern int squashfs_read_table(struct super_block *, void *, u64, int); + ++/* decompressor.c */ ++extern const struct squashfs_decompressor *squashfs_lookup_decompressor(int); ++ + /* export.c */ + extern __le64 *squashfs_read_inode_lookup_table(struct super_block *, u64, + unsigned int); +@@ -70,14 +73,8 @@ extern struct inode *squashfs_iget(struc + unsigned int); + extern int squashfs_read_inode(struct inode *, long long); + +-/* zlib_wrapper.c */ +-extern void *zlib_init(void); +-extern void zlib_free(void *); +-extern int zlib_uncompress(struct squashfs_sb_info *, void **, +- struct buffer_head **, int, int, int, int, int); +- + /* +- * Inodes and files operations ++ * Inodes, files and decompressor operations + */ + + /* dir.c */ +@@ -94,3 +91,6 @@ extern const struct inode_operations squ + + /* symlink.c */ + extern const struct address_space_operations squashfs_symlink_aops; ++ ++/* zlib_wrapper.c */ ++extern const struct squashfs_decompressor squashfs_zlib_comp_ops; +--- a/fs/squashfs/squashfs_fs_sb.h ++++ b/fs/squashfs/squashfs_fs_sb.h +@@ -52,25 +52,26 @@ struct squashfs_cache_entry { + }; + + struct squashfs_sb_info { +- int devblksize; +- int devblksize_log2; +- struct squashfs_cache *block_cache; +- struct squashfs_cache *fragment_cache; +- struct squashfs_cache *read_page; +- int next_meta_index; +- __le64 *id_table; +- __le64 *fragment_index; +- unsigned int *fragment_index_2; +- struct mutex read_data_mutex; +- struct mutex meta_index_mutex; +- struct meta_index *meta_index; +- void *stream; +- __le64 *inode_lookup_table; +- u64 inode_table; +- u64 directory_table; +- unsigned int block_size; +- unsigned short block_log; +- long long bytes_used; +- unsigned int inodes; ++ const struct squashfs_decompressor *decompressor; ++ int devblksize; ++ int devblksize_log2; ++ struct squashfs_cache *block_cache; ++ struct squashfs_cache *fragment_cache; ++ struct squashfs_cache *read_page; ++ int next_meta_index; ++ __le64 *id_table; ++ __le64 *fragment_index; ++ unsigned int *fragment_index_2; ++ struct mutex read_data_mutex; ++ struct mutex meta_index_mutex; ++ struct meta_index *meta_index; ++ void *stream; ++ __le64 *inode_lookup_table; ++ u64 inode_table; ++ u64 directory_table; ++ unsigned int block_size; ++ unsigned short block_log; ++ long long bytes_used; ++ unsigned int inodes; + }; + #endif +--- a/fs/squashfs/super.c ++++ b/fs/squashfs/super.c +@@ -41,27 +41,35 @@ + #include "squashfs_fs_sb.h" + #include "squashfs_fs_i.h" + #include "squashfs.h" ++#include "decompressor.h" + + static struct file_system_type squashfs_fs_type; + static struct super_operations squashfs_super_ops; + +-static int supported_squashfs_filesystem(short major, short minor, short comp) ++static const struct squashfs_decompressor *supported_squashfs_filesystem(short ++ major, short minor, short id) + { ++ const struct squashfs_decompressor *decompressor; ++ + if (major < SQUASHFS_MAJOR) { + ERROR("Major/Minor mismatch, older Squashfs %d.%d " + "filesystems are unsupported\n", major, minor); +- return -EINVAL; ++ return NULL; + } else if (major > SQUASHFS_MAJOR || minor > SQUASHFS_MINOR) { + ERROR("Major/Minor mismatch, trying to mount newer " + "%d.%d filesystem\n", major, minor); + ERROR("Please update your kernel\n"); +- return -EINVAL; ++ return NULL; + } + +- if (comp != ZLIB_COMPRESSION) +- return -EINVAL; ++ decompressor = squashfs_lookup_decompressor(id); ++ if (!decompressor->supported) { ++ ERROR("Filesystem uses \"%s\" compression. This is not " ++ "supported\n", decompressor->name); ++ return NULL; ++ } + +- return 0; ++ return decompressor; + } + + +@@ -86,10 +94,6 @@ static int squashfs_fill_super(struct su + } + msblk = sb->s_fs_info; + +- msblk->stream = zlib_init(); +- if (msblk->stream == NULL) +- goto failure; +- + sblk = kzalloc(sizeof(*sblk), GFP_KERNEL); + if (sblk == NULL) { + ERROR("Failed to allocate squashfs_super_block\n"); +@@ -116,25 +120,25 @@ static int squashfs_fill_super(struct su + goto failed_mount; + } + ++ err = -EINVAL; ++ + /* Check it is a SQUASHFS superblock */ + sb->s_magic = le32_to_cpu(sblk->s_magic); + if (sb->s_magic != SQUASHFS_MAGIC) { + if (!silent) + ERROR("Can't find a SQUASHFS superblock on %s\n", + bdevname(sb->s_bdev, b)); +- err = -EINVAL; + goto failed_mount; + } + +- /* Check the MAJOR & MINOR versions and compression type */ +- err = supported_squashfs_filesystem(le16_to_cpu(sblk->s_major), ++ /* Check the MAJOR & MINOR versions and lookup compression type */ ++ msblk->decompressor = supported_squashfs_filesystem( ++ le16_to_cpu(sblk->s_major), + le16_to_cpu(sblk->s_minor), + le16_to_cpu(sblk->compression)); +- if (err < 0) ++ if (msblk->decompressor == NULL) + goto failed_mount; + +- err = -EINVAL; +- + /* + * Check if there's xattrs in the filesystem. These are not + * supported in this version, so warn that they will be ignored. +@@ -201,6 +205,10 @@ static int squashfs_fill_super(struct su + + err = -ENOMEM; + ++ msblk->stream = squashfs_decompressor_init(msblk); ++ if (msblk->stream == NULL) ++ goto failed_mount; ++ + msblk->block_cache = squashfs_cache_init("metadata", + SQUASHFS_CACHED_BLKS, SQUASHFS_METADATA_SIZE); + if (msblk->block_cache == NULL) +@@ -288,7 +296,7 @@ failed_mount: + squashfs_cache_delete(msblk->block_cache); + squashfs_cache_delete(msblk->fragment_cache); + squashfs_cache_delete(msblk->read_page); +- zlib_free(msblk->stream); ++ squashfs_decompressor_free(msblk, msblk->stream); + kfree(msblk->inode_lookup_table); + kfree(msblk->fragment_index); + kfree(msblk->id_table); +@@ -298,7 +306,6 @@ failed_mount: + return err; + + failure: +- zlib_free(msblk->stream); + kfree(sb->s_fs_info); + sb->s_fs_info = NULL; + return -ENOMEM; +@@ -342,7 +349,7 @@ static void squashfs_put_super(struct su + squashfs_cache_delete(sbi->block_cache); + squashfs_cache_delete(sbi->fragment_cache); + squashfs_cache_delete(sbi->read_page); +- zlib_free(sbi->stream); ++ squashfs_decompressor_free(sbi, sbi->stream); + kfree(sbi->id_table); + kfree(sbi->fragment_index); + kfree(sbi->meta_index); +--- a/fs/squashfs/zlib_wrapper.c ++++ b/fs/squashfs/zlib_wrapper.c +@@ -30,8 +30,9 @@ + #include "squashfs_fs_sb.h" + #include "squashfs_fs_i.h" + #include "squashfs.h" ++#include "decompressor.h" + +-void *zlib_init() ++static void *zlib_init(void) + { + z_stream *stream = kmalloc(sizeof(z_stream), GFP_KERNEL); + if (stream == NULL) +@@ -50,7 +51,7 @@ failed: + } + + +-void zlib_free(void *strm) ++static void zlib_free(void *strm) + { + z_stream *stream = strm; + +@@ -60,7 +61,7 @@ void zlib_free(void *strm) + } + + +-int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, ++static int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, + struct buffer_head **bh, int b, int offset, int length, int srclength, + int pages) + { +@@ -137,3 +138,13 @@ release_mutex: + + return -EIO; + } ++ ++const struct squashfs_decompressor squashfs_zlib_comp_ops = { ++ .init = zlib_init, ++ .free = zlib_free, ++ .decompress = zlib_uncompress, ++ .id = ZLIB_COMPRESSION, ++ .name = "zlib", ++ .supported = 1 ++}; ++ diff --git a/target/linux/generic-2.6/patches-2.6.31/004-squashfs_add_decompressor_lzma_lzo.patch b/target/linux/generic-2.6/patches-2.6.31/004-squashfs_add_decompressor_lzma_lzo.patch new file mode 100644 index 000000000..a378c0005 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.31/004-squashfs_add_decompressor_lzma_lzo.patch @@ -0,0 +1,54 @@ +From 1885ca0a1973944684f252094a703b7c80dfc974 Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Wed, 14 Oct 2009 03:58:11 +0100 +Subject: [PATCH] Squashfs: add decompressor entries for lzma and lzo + +Add knowledge of lzma/lzo compression formats to the decompressor +framework. For now these are added as unsupported. Without +these entries lzma/lzo compressed filesystems will be flagged as +having unknown compression which is undesirable. + +Signed-off-by: Phillip Lougher +--- + fs/squashfs/decompressor.c | 10 ++++++++++ + fs/squashfs/squashfs_fs.h | 4 +++- + 2 files changed, 13 insertions(+), 1 deletions(-) + +--- a/fs/squashfs/decompressor.c ++++ b/fs/squashfs/decompressor.c +@@ -36,12 +36,22 @@ + * Squashfs, allowing multiple decompressors to be easily supported + */ + ++static const struct squashfs_decompressor squashfs_lzma_unsupported_comp_ops = { ++ NULL, NULL, NULL, LZMA_COMPRESSION, "lzma", 0 ++}; ++ ++static const struct squashfs_decompressor squashfs_lzo_unsupported_comp_ops = { ++ NULL, NULL, NULL, LZO_COMPRESSION, "lzo", 0 ++}; ++ + static const struct squashfs_decompressor squashfs_unknown_comp_ops = { + NULL, NULL, NULL, 0, "unknown", 0 + }; + + static const struct squashfs_decompressor *decompressor[] = { + &squashfs_zlib_comp_ops, ++ &squashfs_lzma_unsupported_comp_ops, ++ &squashfs_lzo_unsupported_comp_ops, + &squashfs_unknown_comp_ops + }; + +--- a/fs/squashfs/squashfs_fs.h ++++ b/fs/squashfs/squashfs_fs.h +@@ -211,7 +211,9 @@ struct meta_index { + /* + * definitions for structures on disk + */ +-#define ZLIB_COMPRESSION 1 ++#define ZLIB_COMPRESSION 1 ++#define LZMA_COMPRESSION 2 ++#define LZO_COMPRESSION 3 + + struct squashfs_super_block { + __le32 s_magic; diff --git a/target/linux/generic-2.6/patches-2.6.31/005-squashfs_extra_parameter.patch b/target/linux/generic-2.6/patches-2.6.31/005-squashfs_extra_parameter.patch new file mode 100644 index 000000000..099168134 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.31/005-squashfs_extra_parameter.patch @@ -0,0 +1,42 @@ +From 5f393ede3ddb5dd4cc2a9f243182fac45f1ce10b Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Wed, 14 Oct 2009 04:07:54 +0100 +Subject: [PATCH] Squashfs: add an extra parameter to the decompressor init function + +Signed-off-by: Phillip Lougher +--- + fs/squashfs/decompressor.h | 4 ++-- + fs/squashfs/zlib_wrapper.c | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +--- a/fs/squashfs/decompressor.h ++++ b/fs/squashfs/decompressor.h +@@ -24,7 +24,7 @@ + */ + + struct squashfs_decompressor { +- void *(*init)(void); ++ void *(*init)(struct squashfs_sb_info *); + void (*free)(void *); + int (*decompress)(struct squashfs_sb_info *, void **, + struct buffer_head **, int, int, int, int, int); +@@ -35,7 +35,7 @@ struct squashfs_decompressor { + + static inline void *squashfs_decompressor_init(struct squashfs_sb_info *msblk) + { +- return msblk->decompressor->init(); ++ return msblk->decompressor->init(msblk); + } + + static inline void squashfs_decompressor_free(struct squashfs_sb_info *msblk, +--- a/fs/squashfs/zlib_wrapper.c ++++ b/fs/squashfs/zlib_wrapper.c +@@ -32,7 +32,7 @@ + #include "squashfs.h" + #include "decompressor.h" + +-static void *zlib_init(void) ++static void *zlib_init(struct squashfs_sb_info *dummy) + { + z_stream *stream = kmalloc(sizeof(z_stream), GFP_KERNEL); + if (stream == NULL) diff --git a/target/linux/generic-2.6/patches-2.6.31/006-squashfs_add_lzma.patch b/target/linux/generic-2.6/patches-2.6.31/006-squashfs_add_lzma.patch new file mode 100644 index 000000000..9fd57970f --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.31/006-squashfs_add_lzma.patch @@ -0,0 +1,216 @@ +From f49e1efdd179d54e814ff2a8e8f469496583062c Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Tue, 20 Oct 2009 10:54:36 +0100 +Subject: [PATCH] Squashfs: add LZMA compression + +Add support for LZMA compressed filesystems. This is an initial +implementation. + +Signed-off-by: Phillip Lougher +--- + fs/squashfs/Kconfig | 5 ++ + fs/squashfs/Makefile | 1 + + fs/squashfs/decompressor.c | 4 + + fs/squashfs/lzma_wrapper.c | 151 ++++++++++++++++++++++++++++++++++++++++++++ + fs/squashfs/squashfs.h | 3 + + 5 files changed, 164 insertions(+), 0 deletions(-) + create mode 100644 fs/squashfs/lzma_wrapper.c + +--- a/fs/squashfs/Kconfig ++++ b/fs/squashfs/Kconfig +@@ -26,6 +26,11 @@ config SQUASHFS + + If unsure, say N. + ++config SQUASHFS_LZMA ++ bool "Include support for LZMA compressed file systems" ++ depends on SQUASHFS ++ select DECOMPRESS_LZMA ++ + config SQUASHFS_EMBEDDED + + bool "Additional option for memory-constrained systems" +--- a/fs/squashfs/Makefile ++++ b/fs/squashfs/Makefile +@@ -5,3 +5,4 @@ + obj-$(CONFIG_SQUASHFS) += squashfs.o + squashfs-y += block.o cache.o dir.o export.o file.o fragment.o id.o inode.o + squashfs-y += namei.o super.o symlink.o zlib_wrapper.o decompressor.o ++squashfs-$(CONFIG_SQUASHFS_LZMA) += lzma_wrapper.o +--- a/fs/squashfs/decompressor.c ++++ b/fs/squashfs/decompressor.c +@@ -50,7 +50,11 @@ static const struct squashfs_decompresso + + static const struct squashfs_decompressor *decompressor[] = { + &squashfs_zlib_comp_ops, ++#ifdef CONFIG_SQUASHFS_LZMA ++ &squashfs_lzma_comp_ops, ++#else + &squashfs_lzma_unsupported_comp_ops, ++#endif + &squashfs_lzo_unsupported_comp_ops, + &squashfs_unknown_comp_ops + }; +--- /dev/null ++++ b/fs/squashfs/lzma_wrapper.c +@@ -0,0 +1,151 @@ ++/* ++ * Squashfs - a compressed read only filesystem for Linux ++ * ++ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 ++ * Phillip Lougher ++ * ++ * 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, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ * ++ * lzma_wrapper.c ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "squashfs_fs.h" ++#include "squashfs_fs_sb.h" ++#include "squashfs_fs_i.h" ++#include "squashfs.h" ++#include "decompressor.h" ++ ++struct squashfs_lzma { ++ void *input; ++ void *output; ++}; ++ ++/* decompress_unlzma.c is currently non re-entrant... */ ++DEFINE_MUTEX(lzma_mutex); ++ ++/* decompress_unlzma.c doesn't provide any context in its callbacks... */ ++static int lzma_error; ++ ++static void error(char *m) ++{ ++ ERROR("unlzma error: %s\n", m); ++ lzma_error = 1; ++} ++ ++ ++static void *lzma_init(struct squashfs_sb_info *msblk) ++{ ++ struct squashfs_lzma *stream = kzalloc(sizeof(*stream), GFP_KERNEL); ++ if (stream == NULL) ++ goto failed; ++ stream->input = vmalloc(msblk->block_size); ++ if (stream->input == NULL) ++ goto failed; ++ stream->output = vmalloc(msblk->block_size); ++ if (stream->output == NULL) ++ goto failed2; ++ ++ return stream; ++ ++failed2: ++ vfree(stream->input); ++failed: ++ ERROR("failed to allocate lzma workspace\n"); ++ kfree(stream); ++ return NULL; ++} ++ ++ ++static void lzma_free(void *strm) ++{ ++ struct squashfs_lzma *stream = strm; ++ ++ if (stream) { ++ vfree(stream->input); ++ vfree(stream->output); ++ } ++ kfree(stream); ++} ++ ++ ++static int lzma_uncompress(struct squashfs_sb_info *msblk, void **buffer, ++ struct buffer_head **bh, int b, int offset, int length, int srclength, ++ int pages) ++{ ++ struct squashfs_lzma *stream = msblk->stream; ++ void *buff = stream->input; ++ int avail, i, bytes = length, res; ++ ++ mutex_lock(&lzma_mutex); ++ ++ for (i = 0; i < b; i++) { ++ wait_on_buffer(bh[i]); ++ if (!buffer_uptodate(bh[i])) ++ goto block_release; ++ ++ avail = min(bytes, msblk->devblksize - offset); ++ memcpy(buff, bh[i]->b_data + offset, avail); ++ buff += avail; ++ bytes -= avail; ++ offset = 0; ++ put_bh(bh[i]); ++ } ++ ++ lzma_error = 0; ++ res = unlzma(stream->input, length, NULL, NULL, stream->output, NULL, ++ error); ++ if (res || lzma_error) ++ goto failed; ++ ++ /* uncompressed size is stored in the LZMA header (5 byte offset) */ ++ res = bytes = get_unaligned_le32(stream->input + 5); ++ for (i = 0, buff = stream->output; bytes && i < pages; i++) { ++ avail = min_t(int, bytes, PAGE_CACHE_SIZE); ++ memcpy(buffer[i], buff, avail); ++ buff += avail; ++ bytes -= avail; ++ } ++ if (bytes) ++ goto failed; ++ ++ mutex_unlock(&lzma_mutex); ++ return res; ++ ++block_release: ++ for (; i < b; i++) ++ put_bh(bh[i]); ++ ++failed: ++ mutex_unlock(&lzma_mutex); ++ ++ ERROR("lzma decompression failed, data probably corrupt\n"); ++ return -EIO; ++} ++ ++const struct squashfs_decompressor squashfs_lzma_comp_ops = { ++ .init = lzma_init, ++ .free = lzma_free, ++ .decompress = lzma_uncompress, ++ .id = LZMA_COMPRESSION, ++ .name = "lzma", ++ .supported = 1 ++}; ++ +--- a/fs/squashfs/squashfs.h ++++ b/fs/squashfs/squashfs.h +@@ -94,3 +94,6 @@ extern const struct address_space_operat + + /* zlib_wrapper.c */ + extern const struct squashfs_decompressor squashfs_zlib_comp_ops; ++ ++/* lzma wrapper.c */ ++extern const struct squashfs_decompressor squashfs_lzma_comp_ops; diff --git a/target/linux/generic-2.6/patches-2.6.31/007-squashfs_make_lzma_available.patch b/target/linux/generic-2.6/patches-2.6.31/007-squashfs_make_lzma_available.patch new file mode 100644 index 000000000..aa6c11012 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.31/007-squashfs_make_lzma_available.patch @@ -0,0 +1,165 @@ +From fdf23ed283bc6ef5c25076ce2065f892120ff556 Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Thu, 22 Oct 2009 04:57:38 +0100 +Subject: [PATCH] Squashfs: Make unlzma available to non initramfs/initrd code + +Add a config option DECOMPRESS_LZMA_NEEDED which allows subsystems to +specify they need the unlzma code. Normally decompress_unlzma.c is +compiled with __init and unlzma is not exported to modules. + +Signed-off-by: Phillip Lougher +--- + fs/squashfs/Kconfig | 1 + + include/linux/decompress/bunzip2_mm.h | 12 ++++++++++++ + include/linux/decompress/inflate_mm.h | 12 ++++++++++++ + include/linux/decompress/mm.h | 3 --- + include/linux/decompress/unlzma_mm.h | 20 ++++++++++++++++++++ + lib/Kconfig | 3 +++ + lib/decompress_bunzip2.c | 1 + + lib/decompress_inflate.c | 1 + + lib/decompress_unlzma.c | 5 ++++- + 9 files changed, 54 insertions(+), 4 deletions(-) + create mode 100644 include/linux/decompress/bunzip2_mm.h + create mode 100644 include/linux/decompress/inflate_mm.h + create mode 100644 include/linux/decompress/unlzma_mm.h + +--- a/fs/squashfs/Kconfig ++++ b/fs/squashfs/Kconfig +@@ -30,6 +30,7 @@ config SQUASHFS_LZMA + bool "Include support for LZMA compressed file systems" + depends on SQUASHFS + select DECOMPRESS_LZMA ++ select DECOMPRESS_LZMA_NEEDED + + config SQUASHFS_EMBEDDED + +--- /dev/null ++++ b/include/linux/decompress/bunzip2_mm.h +@@ -0,0 +1,12 @@ ++#ifndef BUNZIP2_MM_H ++#define BUNZIP2_MM_H ++ ++#ifdef STATIC ++/* Code active when included from pre-boot environment: */ ++#define INIT ++#else ++/* Compile for initramfs/initrd code only */ ++#define INIT __init ++#endif ++ ++#endif +--- /dev/null ++++ b/include/linux/decompress/inflate_mm.h +@@ -0,0 +1,12 @@ ++#ifndef INFLATE_MM_H ++#define INFLATE_MM_H ++ ++#ifdef STATIC ++/* Code active when included from pre-boot environment: */ ++#define INIT ++#else ++/* Compile for initramfs/initrd code only */ ++#define INIT __init ++#endif ++ ++#endif +--- a/include/linux/decompress/mm.h ++++ b/include/linux/decompress/mm.h +@@ -53,8 +53,6 @@ static void free(void *where) + + #define set_error_fn(x) + +-#define INIT +- + #else /* STATIC */ + + /* Code active when compiled standalone for use when loading ramdisk: */ +@@ -77,7 +75,6 @@ static void free(void *where) + static void(*error)(char *m); + #define set_error_fn(x) error = x; + +-#define INIT __init + #define STATIC + + #include +--- /dev/null ++++ b/include/linux/decompress/unlzma_mm.h +@@ -0,0 +1,20 @@ ++#ifndef UNLZMA_MM_H ++#define UNLZMA_MM_H ++ ++#ifdef STATIC ++ ++/* Code active when included from pre-boot environment: */ ++#define INIT ++ ++#elif defined(CONFIG_DECOMPRESS_LZMA_NEEDED) ++ ++/* Make it available to non initramfs/initrd code */ ++#define INIT ++#include ++#else ++ ++/* Compile for initramfs/initrd code only */ ++#define INIT __init ++#endif ++ ++#endif +--- a/lib/Kconfig ++++ b/lib/Kconfig +@@ -117,6 +117,9 @@ config DECOMPRESS_BZIP2 + config DECOMPRESS_LZMA + tristate + ++config DECOMPRESS_LZMA_NEEDED ++ boolean ++ + # + # Generic allocator support is selected if needed + # +--- a/lib/decompress_bunzip2.c ++++ b/lib/decompress_bunzip2.c +@@ -52,6 +52,7 @@ + #include + #endif /* STATIC */ + ++#include + #include + + #ifndef INT_MAX +--- a/lib/decompress_inflate.c ++++ b/lib/decompress_inflate.c +@@ -23,6 +23,7 @@ + + #endif /* STATIC */ + ++#include + #include + + #define GZIP_IOBUF_SIZE (16*1024) +--- a/lib/decompress_unlzma.c ++++ b/lib/decompress_unlzma.c +@@ -36,6 +36,7 @@ + #include + #endif /* STATIC */ + ++#include + #include + + #define MIN(a, b) (((a) < (b)) ? (a) : (b)) +@@ -523,7 +524,7 @@ static inline void INIT process_bit1(str + + + +-STATIC inline int INIT unlzma(unsigned char *buf, int in_len, ++STATIC int INIT unlzma(unsigned char *buf, int in_len, + int(*fill)(void*, unsigned int), + int(*flush)(void*, unsigned int), + unsigned char *output, +@@ -656,4 +657,6 @@ STATIC int INIT decompress(unsigned char + { + return unlzma(buf, in_len - 4, fill, flush, output, posp, error_fn); + } ++#elif defined(CONFIG_DECOMPRESS_LZMA_NEEDED) ++EXPORT_SYMBOL(unlzma); + #endif diff --git a/target/linux/generic-2.6/patches-2.6.31/051-squashfs_pcomp.patch b/target/linux/generic-2.6/patches-2.6.31/051-squashfs_pcomp.patch deleted file mode 100644 index 086adf651..000000000 --- a/target/linux/generic-2.6/patches-2.6.31/051-squashfs_pcomp.patch +++ /dev/null @@ -1,234 +0,0 @@ ---- a/fs/squashfs/Kconfig -+++ b/fs/squashfs/Kconfig -@@ -1,7 +1,8 @@ - config SQUASHFS - tristate "SquashFS 4.0 - Squashed file system support" - depends on BLOCK -- select ZLIB_INFLATE -+ select CRYPTO -+ select CRYPTO_ZLIB - help - Saying Y here includes support for SquashFS 4.0 (a Compressed - Read-Only File System). Squashfs is a highly compressed read-only ---- a/fs/squashfs/block.c -+++ b/fs/squashfs/block.c -@@ -32,7 +32,8 @@ - #include - #include - #include --#include -+ -+#include - - #include "squashfs_fs.h" - #include "squashfs_fs_sb.h" -@@ -153,7 +154,8 @@ int squashfs_read_data(struct super_bloc - } - - if (compressed) { -- int zlib_err = 0, zlib_init = 0; -+ int res = 0, decomp_init = 0; -+ struct comp_request req; - - /* - * Uncompress block. -@@ -161,12 +163,13 @@ int squashfs_read_data(struct super_bloc - - mutex_lock(&msblk->read_data_mutex); - -- msblk->stream.avail_out = 0; -- msblk->stream.avail_in = 0; -+ req.avail_out = 0; -+ req.avail_in = 0; - - bytes = length; -+ length = 0; - do { -- if (msblk->stream.avail_in == 0 && k < b) { -+ if (req.avail_in == 0 && k < b) { - avail = min(bytes, msblk->devblksize - offset); - bytes -= avail; - wait_on_buffer(bh[k]); -@@ -179,45 +182,47 @@ int squashfs_read_data(struct super_bloc - continue; - } - -- msblk->stream.next_in = bh[k]->b_data + offset; -- msblk->stream.avail_in = avail; -+ req.next_in = bh[k]->b_data + offset; -+ req.avail_in = avail; - offset = 0; - } - -- if (msblk->stream.avail_out == 0 && page < pages) { -- msblk->stream.next_out = buffer[page++]; -- msblk->stream.avail_out = PAGE_CACHE_SIZE; -+ if (req.avail_out == 0 && page < pages) { -+ req.next_out = buffer[page++]; -+ req.avail_out = PAGE_CACHE_SIZE; - } - -- if (!zlib_init) { -- zlib_err = zlib_inflateInit(&msblk->stream); -- if (zlib_err != Z_OK) { -- ERROR("zlib_inflateInit returned" -- " unexpected result 0x%x," -- " srclength %d\n", zlib_err, -- srclength); -+ if (!decomp_init) { -+ res = crypto_decompress_init(msblk->tfm); -+ if (res) { -+ ERROR("crypto_decompress_init " -+ "returned %d, srclength %d\n", -+ res, srclength); - goto release_mutex; - } -- zlib_init = 1; -+ decomp_init = 1; - } - -- zlib_err = zlib_inflate(&msblk->stream, Z_SYNC_FLUSH); -+ res = crypto_decompress_update(msblk->tfm, &req); -+ if (res < 0) { -+ ERROR("crypto_decompress_update returned %d, " -+ "data probably corrupt\n", res); -+ goto release_mutex; -+ } -+ length += res; - -- if (msblk->stream.avail_in == 0 && k < b) -+ if (req.avail_in == 0 && k < b) - put_bh(bh[k++]); -- } while (zlib_err == Z_OK); -+ } while (bytes || res); - -- if (zlib_err != Z_STREAM_END) { -- ERROR("zlib_inflate error, data probably corrupt\n"); -+ res = crypto_decompress_final(msblk->tfm, &req); -+ if (res < 0) { -+ ERROR("crypto_decompress_final returned %d, data " -+ "probably corrupt\n", res); - goto release_mutex; - } -+ length += res; - -- zlib_err = zlib_inflateEnd(&msblk->stream); -- if (zlib_err != Z_OK) { -- ERROR("zlib_inflate error, data probably corrupt\n"); -- goto release_mutex; -- } -- length = msblk->stream.total_out; - mutex_unlock(&msblk->read_data_mutex); - } else { - /* ---- a/fs/squashfs/squashfs_fs_sb.h -+++ b/fs/squashfs/squashfs_fs_sb.h -@@ -64,7 +64,7 @@ struct squashfs_sb_info { - struct mutex read_data_mutex; - struct mutex meta_index_mutex; - struct meta_index *meta_index; -- z_stream stream; -+ struct crypto_pcomp *tfm; - __le64 *inode_lookup_table; - u64 inode_table; - u64 directory_table; ---- a/fs/squashfs/super.c -+++ b/fs/squashfs/super.c -@@ -38,11 +38,19 @@ - #include - #include - -+#include -+ -+#include -+ - #include "squashfs_fs.h" - #include "squashfs_fs_sb.h" - #include "squashfs_fs_i.h" - #include "squashfs.h" - -+ -+#define SQUASHFS_CRYPTO_ALG "zlib" -+ -+ - static struct file_system_type squashfs_fs_type; - static struct super_operations squashfs_super_ops; - -@@ -76,6 +84,16 @@ static int squashfs_fill_super(struct su - unsigned short flags; - unsigned int fragments; - u64 lookup_table_start; -+ struct { -+ struct nlattr nla; -+ int val; -+ } params = { -+ .nla = { -+ .nla_len = nla_attr_size(sizeof(int)), -+ .nla_type = ZLIB_DECOMP_WINDOWBITS, -+ }, -+ .val = DEF_WBITS, -+ }; - int err; - - TRACE("Entered squashfs_fill_superblock\n"); -@@ -87,16 +105,25 @@ static int squashfs_fill_super(struct su - } - msblk = sb->s_fs_info; - -- msblk->stream.workspace = kmalloc(zlib_inflate_workspacesize(), -- GFP_KERNEL); -- if (msblk->stream.workspace == NULL) { -- ERROR("Failed to allocate zlib workspace\n"); -+ msblk->tfm = crypto_alloc_pcomp(SQUASHFS_CRYPTO_ALG, 0, -+ CRYPTO_ALG_ASYNC); -+ if (IS_ERR(msblk->tfm)) { -+ ERROR("Failed to load %s crypto module\n", -+ SQUASHFS_CRYPTO_ALG); -+ err = PTR_ERR(msblk->tfm); -+ goto failed_pcomp; -+ } -+ -+ err = crypto_decompress_setup(msblk->tfm, ¶ms, sizeof(params)); -+ if (err) { -+ ERROR("Failed to set up decompression parameters\n"); - goto failure; - } - - sblk = kzalloc(sizeof(*sblk), GFP_KERNEL); - if (sblk == NULL) { - ERROR("Failed to allocate squashfs_super_block\n"); -+ err = -ENOMEM; - goto failure; - } - -@@ -295,17 +322,18 @@ failed_mount: - kfree(msblk->inode_lookup_table); - kfree(msblk->fragment_index); - kfree(msblk->id_table); -- kfree(msblk->stream.workspace); -+ crypto_free_pcomp(msblk->tfm); - kfree(sb->s_fs_info); - sb->s_fs_info = NULL; - kfree(sblk); - return err; - - failure: -- kfree(msblk->stream.workspace); -+ crypto_free_pcomp(msblk->tfm); -+failed_pcomp: - kfree(sb->s_fs_info); - sb->s_fs_info = NULL; -- return -ENOMEM; -+ return err; - } - - -@@ -349,7 +377,7 @@ static void squashfs_put_super(struct su - kfree(sbi->id_table); - kfree(sbi->fragment_index); - kfree(sbi->meta_index); -- kfree(sbi->stream.workspace); -+ crypto_free_pcomp(sbi->tfm); - kfree(sb->s_fs_info); - sb->s_fs_info = NULL; - } diff --git a/target/linux/generic-2.6/patches-2.6.31/052-pcomp_lzma_support.patch b/target/linux/generic-2.6/patches-2.6.31/052-pcomp_lzma_support.patch deleted file mode 100644 index 48eb07de7..000000000 --- a/target/linux/generic-2.6/patches-2.6.31/052-pcomp_lzma_support.patch +++ /dev/null @@ -1,901 +0,0 @@ ---- /dev/null -+++ b/crypto/unlzma.c -@@ -0,0 +1,775 @@ -+/* -+ * LZMA uncompresion module for pcomp -+ * Copyright (C) 2009 Felix Fietkau -+ * -+ * Based on: -+ * Initial Linux kernel adaptation -+ * Copyright (C) 2006 Alain < alain@knaff.lu > -+ * -+ * Based on small lzma deflate implementation/Small range coder -+ * implementation for lzma. -+ * Copyright (C) 2006 Aurelien Jacobs < aurel@gnuage.org > -+ * -+ * Based on LzmaDecode.c from the LZMA SDK 4.22 (http://www.7-zip.org/) -+ * Copyright (C) 1999-2005 Igor Pavlov -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ * -+ * FIXME: the current implementation assumes that the caller will -+ * not free any output buffers until the whole decompression has been -+ * completed. This is necessary, because LZMA looks back at old output -+ * instead of doing a separate dictionary allocation, which saves RAM. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include "unlzma.h" -+ -+static int instance = 0; -+ -+struct unlzma_buffer { -+ int offset; -+ int size; -+ u8 *ptr; -+}; -+ -+struct unlzma_ctx { -+ struct task_struct *thread; -+ wait_queue_head_t next_req; -+ wait_queue_head_t req_done; -+ struct mutex mutex; -+ bool waiting; -+ bool active; -+ bool cancel; -+ -+ const u8 *next_in; -+ int avail_in; -+ -+ u8 *next_out; -+ int avail_out; -+ -+ /* reader state */ -+ u32 code; -+ u32 range; -+ u32 bound; -+ -+ /* writer state */ -+ u8 previous_byte; -+ ssize_t pos; -+ int buf_full; -+ int n_buffers; -+ int buffers_max; -+ struct unlzma_buffer *buffers; -+ -+ /* cstate */ -+ int state; -+ u32 rep0, rep1, rep2, rep3; -+ -+ u32 dict_size; -+ -+ void *workspace; -+ int workspace_size; -+}; -+ -+static inline bool -+unlzma_should_stop(struct unlzma_ctx *ctx) -+{ -+ return unlikely(kthread_should_stop() || ctx->cancel); -+} -+ -+static void -+get_buffer(struct unlzma_ctx *ctx) -+{ -+ struct unlzma_buffer *bh; -+ -+ BUG_ON(ctx->n_buffers >= ctx->buffers_max); -+ bh = &ctx->buffers[ctx->n_buffers++]; -+ bh->ptr = ctx->next_out; -+ bh->offset = ctx->pos; -+ bh->size = ctx->avail_out; -+ ctx->buf_full = 0; -+} -+ -+static void -+unlzma_request_buffer(struct unlzma_ctx *ctx, int *avail) -+{ -+ do { -+ ctx->waiting = true; -+ mutex_unlock(&ctx->mutex); -+ wake_up(&ctx->req_done); -+ if (wait_event_interruptible(ctx->next_req, -+ unlzma_should_stop(ctx) || (*avail > 0))) -+ schedule(); -+ mutex_lock(&ctx->mutex); -+ } while (*avail <= 0 && !unlzma_should_stop(ctx)); -+ -+ if (!unlzma_should_stop(ctx) && ctx->buf_full) -+ get_buffer(ctx); -+} -+ -+static u8 -+rc_read(struct unlzma_ctx *ctx) -+{ -+ if (unlikely(ctx->avail_in <= 0)) -+ unlzma_request_buffer(ctx, &ctx->avail_in); -+ -+ if (unlzma_should_stop(ctx)) -+ return 0; -+ -+ ctx->avail_in--; -+ return *(ctx->next_in++); -+} -+ -+ -+static inline void -+rc_get_code(struct unlzma_ctx *ctx) -+{ -+ ctx->code = (ctx->code << 8) | rc_read(ctx); -+} -+ -+static void -+rc_normalize(struct unlzma_ctx *ctx) -+{ -+ if (ctx->range < (1 << RC_TOP_BITS)) { -+ ctx->range <<= 8; -+ rc_get_code(ctx); -+ } -+} -+ -+static int -+rc_is_bit_0(struct unlzma_ctx *ctx, u16 *p) -+{ -+ rc_normalize(ctx); -+ ctx->bound = *p * (ctx->range >> RC_MODEL_TOTAL_BITS); -+ return ctx->code < ctx->bound; -+} -+ -+static void -+rc_update_bit_0(struct unlzma_ctx *ctx, u16 *p) -+{ -+ ctx->range = ctx->bound; -+ *p += ((1 << RC_MODEL_TOTAL_BITS) - *p) >> RC_MOVE_BITS; -+} -+ -+static void -+rc_update_bit_1(struct unlzma_ctx *ctx, u16 *p) -+{ -+ ctx->range -= ctx->bound; -+ ctx->code -= ctx->bound; -+ *p -= *p >> RC_MOVE_BITS; -+} -+ -+static bool -+rc_get_bit(struct unlzma_ctx *ctx, u16 *p, int *symbol) -+{ -+ if (rc_is_bit_0(ctx, p)) { -+ rc_update_bit_0(ctx, p); -+ *symbol *= 2; -+ return 0; -+ } else { -+ rc_update_bit_1(ctx, p); -+ *symbol = *symbol * 2 + 1; -+ return 1; -+ } -+} -+ -+static int -+rc_direct_bit(struct unlzma_ctx *ctx) -+{ -+ rc_normalize(ctx); -+ ctx->range >>= 1; -+ if (ctx->code >= ctx->range) { -+ ctx->code -= ctx->range; -+ return 1; -+ } -+ return 0; -+} -+ -+static void -+rc_bit_tree_decode(struct unlzma_ctx *ctx, u16 *p, int num_levels, int *symbol) -+{ -+ int i = num_levels; -+ -+ *symbol = 1; -+ while (i--) -+ rc_get_bit(ctx, p + *symbol, symbol); -+ *symbol -= 1 << num_levels; -+} -+ -+static u8 -+peek_old_byte(struct unlzma_ctx *ctx, u32 offs) -+{ -+ struct unlzma_buffer *bh = &ctx->buffers[ctx->n_buffers - 1]; -+ int i = ctx->n_buffers; -+ u32 pos; -+ -+ if (!ctx->n_buffers) { -+ printk(KERN_ERR "unlzma/%s: no buffer\n", __func__); -+ goto error; -+ } -+ -+ pos = ctx->pos - offs; -+ if (unlikely(pos >= ctx->dict_size)) -+ pos = ~pos & (ctx->dict_size - 1); -+ -+ while (bh->offset > pos) { -+ bh--; -+ i--; -+ if (!i) { -+ printk(KERN_ERR "unlzma/%s: position %d out of range\n", __func__, pos); -+ goto error; -+ } -+ } -+ -+ pos -= bh->offset; -+ if (pos >= bh->size) { -+ printk(KERN_ERR "unlzma/%s: position %d out of range\n", __func__, pos); -+ goto error; -+ } -+ -+ return bh->ptr[pos]; -+ -+error: -+ ctx->cancel = true; -+ return 0; -+} -+ -+static void -+write_byte(struct unlzma_ctx *ctx, u8 byte) -+{ -+ if (unlikely(ctx->avail_out <= 0)) { -+ unlzma_request_buffer(ctx, &ctx->avail_out); -+ } -+ -+ if (!ctx->avail_out) -+ return; -+ -+ ctx->previous_byte = byte; -+ *(ctx->next_out++) = byte; -+ ctx->avail_out--; -+ if (ctx->avail_out == 0) -+ ctx->buf_full = 1; -+ ctx->pos++; -+} -+ -+ -+static inline void -+copy_byte(struct unlzma_ctx *ctx, u32 offs) -+{ -+ write_byte(ctx, peek_old_byte(ctx, offs)); -+} -+ -+static void -+copy_bytes(struct unlzma_ctx *ctx, u32 rep0, int len) -+{ -+ do { -+ copy_byte(ctx, rep0); -+ len--; -+ if (unlzma_should_stop(ctx)) -+ break; -+ } while (len != 0); -+} -+ -+static void -+process_bit0(struct unlzma_ctx *ctx, u16 *p, int pos_state, u16 *prob, -+ int lc, u32 literal_pos_mask) -+{ -+ int mi = 1; -+ rc_update_bit_0(ctx, prob); -+ prob = (p + LZMA_LITERAL + -+ (LZMA_LIT_SIZE -+ * (((ctx->pos & literal_pos_mask) << lc) -+ + (ctx->previous_byte >> (8 - lc)))) -+ ); -+ -+ if (ctx->state >= LZMA_NUM_LIT_STATES) { -+ int match_byte = peek_old_byte(ctx, ctx->rep0); -+ do { -+ u16 bit; -+ u16 *prob_lit; -+ -+ match_byte <<= 1; -+ bit = match_byte & 0x100; -+ prob_lit = prob + 0x100 + bit + mi; -+ if (rc_get_bit(ctx, prob_lit, &mi) != !!bit) -+ break; -+ } while (mi < 0x100); -+ } -+ while (mi < 0x100) { -+ u16 *prob_lit = prob + mi; -+ rc_get_bit(ctx, prob_lit, &mi); -+ } -+ write_byte(ctx, mi); -+ if (ctx->state < 4) -+ ctx->state = 0; -+ else if (ctx->state < 10) -+ ctx->state -= 3; -+ else -+ ctx->state -= 6; -+} -+ -+static void -+process_bit1(struct unlzma_ctx *ctx, u16 *p, int pos_state, u16 *prob) -+{ -+ int offset; -+ u16 *prob_len; -+ int num_bits; -+ int len; -+ -+ rc_update_bit_1(ctx, prob); -+ prob = p + LZMA_IS_REP + ctx->state; -+ if (rc_is_bit_0(ctx, prob)) { -+ rc_update_bit_0(ctx, prob); -+ ctx->rep3 = ctx->rep2; -+ ctx->rep2 = ctx->rep1; -+ ctx->rep1 = ctx->rep0; -+ ctx->state = ctx->state < LZMA_NUM_LIT_STATES ? 0 : 3; -+ prob = p + LZMA_LEN_CODER; -+ } else { -+ rc_update_bit_1(ctx, prob); -+ prob = p + LZMA_IS_REP_G0 + ctx->state; -+ if (rc_is_bit_0(ctx, prob)) { -+ rc_update_bit_0(ctx, prob); -+ prob = (p + LZMA_IS_REP_0_LONG -+ + (ctx->state << -+ LZMA_NUM_POS_BITS_MAX) + -+ pos_state); -+ if (rc_is_bit_0(ctx, prob)) { -+ rc_update_bit_0(ctx, prob); -+ -+ ctx->state = ctx->state < LZMA_NUM_LIT_STATES ? -+ 9 : 11; -+ copy_byte(ctx, ctx->rep0); -+ return; -+ } else { -+ rc_update_bit_1(ctx, prob); -+ } -+ } else { -+ u32 distance; -+ -+ rc_update_bit_1(ctx, prob); -+ prob = p + LZMA_IS_REP_G1 + ctx->state; -+ if (rc_is_bit_0(ctx, prob)) { -+ rc_update_bit_0(ctx, prob); -+ distance = ctx->rep1; -+ } else { -+ rc_update_bit_1(ctx, prob); -+ prob = p + LZMA_IS_REP_G2 + ctx->state; -+ if (rc_is_bit_0(ctx, prob)) { -+ rc_update_bit_0(ctx, prob); -+ distance = ctx->rep2; -+ } else { -+ rc_update_bit_1(ctx, prob); -+ distance = ctx->rep3; -+ ctx->rep3 = ctx->rep2; -+ } -+ ctx->rep2 = ctx->rep1; -+ } -+ ctx->rep1 = ctx->rep0; -+ ctx->rep0 = distance; -+ } -+ ctx->state = ctx->state < LZMA_NUM_LIT_STATES ? 8 : 11; -+ prob = p + LZMA_REP_LEN_CODER; -+ } -+ -+ prob_len = prob + LZMA_LEN_CHOICE; -+ if (rc_is_bit_0(ctx, prob_len)) { -+ rc_update_bit_0(ctx, prob_len); -+ prob_len = (prob + LZMA_LEN_LOW -+ + (pos_state << -+ LZMA_LEN_NUM_LOW_BITS)); -+ offset = 0; -+ num_bits = LZMA_LEN_NUM_LOW_BITS; -+ } else { -+ rc_update_bit_1(ctx, prob_len); -+ prob_len = prob + LZMA_LEN_CHOICE_2; -+ if (rc_is_bit_0(ctx, prob_len)) { -+ rc_update_bit_0(ctx, prob_len); -+ prob_len = (prob + LZMA_LEN_MID -+ + (pos_state << -+ LZMA_LEN_NUM_MID_BITS)); -+ offset = 1 << LZMA_LEN_NUM_LOW_BITS; -+ num_bits = LZMA_LEN_NUM_MID_BITS; -+ } else { -+ rc_update_bit_1(ctx, prob_len); -+ prob_len = prob + LZMA_LEN_HIGH; -+ offset = ((1 << LZMA_LEN_NUM_LOW_BITS) -+ + (1 << LZMA_LEN_NUM_MID_BITS)); -+ num_bits = LZMA_LEN_NUM_HIGH_BITS; -+ } -+ } -+ -+ rc_bit_tree_decode(ctx, prob_len, num_bits, &len); -+ len += offset; -+ -+ if (ctx->state < 4) { -+ int pos_slot; -+ -+ ctx->state += LZMA_NUM_LIT_STATES; -+ prob = -+ p + LZMA_POS_SLOT + -+ ((len < -+ LZMA_NUM_LEN_TO_POS_STATES ? len : -+ LZMA_NUM_LEN_TO_POS_STATES - 1) -+ << LZMA_NUM_POS_SLOT_BITS); -+ rc_bit_tree_decode(ctx, prob, -+ LZMA_NUM_POS_SLOT_BITS, -+ &pos_slot); -+ if (pos_slot >= LZMA_START_POS_MODEL_INDEX) { -+ int i, mi; -+ num_bits = (pos_slot >> 1) - 1; -+ ctx->rep0 = 2 | (pos_slot & 1); -+ if (pos_slot < LZMA_END_POS_MODEL_INDEX) { -+ ctx->rep0 <<= num_bits; -+ prob = p + LZMA_SPEC_POS + -+ ctx->rep0 - pos_slot - 1; -+ } else { -+ num_bits -= LZMA_NUM_ALIGN_BITS; -+ while (num_bits--) -+ ctx->rep0 = (ctx->rep0 << 1) | -+ rc_direct_bit(ctx); -+ prob = p + LZMA_ALIGN; -+ ctx->rep0 <<= LZMA_NUM_ALIGN_BITS; -+ num_bits = LZMA_NUM_ALIGN_BITS; -+ } -+ i = 1; -+ mi = 1; -+ while (num_bits--) { -+ if (rc_get_bit(ctx, prob + mi, &mi)) -+ ctx->rep0 |= i; -+ i <<= 1; -+ } -+ } else -+ ctx->rep0 = pos_slot; -+ if (++(ctx->rep0) == 0) -+ return; -+ } -+ -+ len += LZMA_MATCH_MIN_LEN; -+ -+ copy_bytes(ctx, ctx->rep0, len); -+} -+ -+ -+static int -+do_unlzma(struct unlzma_ctx *ctx) -+{ -+ u8 hdr_buf[sizeof(struct lzma_header)]; -+ struct lzma_header *header = (struct lzma_header *)hdr_buf; -+ u32 pos_state_mask; -+ u32 literal_pos_mask; -+ int lc, pb, lp; -+ int num_probs; -+ int i, mi; -+ u16 *p; -+ -+ for (i = 0; i < sizeof(struct lzma_header); i++) { -+ hdr_buf[i] = rc_read(ctx); -+ } -+ -+ ctx->n_buffers = 0; -+ ctx->pos = 0; -+ get_buffer(ctx); -+ ctx->active = true; -+ ctx->state = 0; -+ ctx->rep0 = ctx->rep1 = ctx->rep2 = ctx->rep3 = 1; -+ -+ ctx->previous_byte = 0; -+ ctx->code = 0; -+ ctx->range = 0xFFFFFFFF; -+ -+ ctx->dict_size = le32_to_cpu(header->dict_size); -+ -+ if (header->pos >= (9 * 5 * 5)) -+ return -1; -+ -+ mi = 0; -+ lc = header->pos; -+ while (lc >= 9) { -+ mi++; -+ lc -= 9; -+ } -+ pb = 0; -+ lp = mi; -+ while (lp >= 5) { -+ pb++; -+ lp -= 5; -+ } -+ pos_state_mask = (1 << pb) - 1; -+ literal_pos_mask = (1 << lp) - 1; -+ -+ if (ctx->dict_size == 0) -+ ctx->dict_size = 1; -+ -+ num_probs = LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp)); -+ if (ctx->workspace_size < num_probs * sizeof(*p)) { -+ if (ctx->workspace) -+ vfree(ctx->workspace); -+ ctx->workspace_size = num_probs * sizeof(*p); -+ ctx->workspace = vmalloc(ctx->workspace_size); -+ } -+ p = (u16 *) ctx->workspace; -+ if (!p) -+ return -1; -+ -+ num_probs = LZMA_LITERAL + (LZMA_LIT_SIZE << (lc + lp)); -+ for (i = 0; i < num_probs; i++) -+ p[i] = (1 << RC_MODEL_TOTAL_BITS) >> 1; -+ -+ for (i = 0; i < 5; i++) -+ rc_get_code(ctx); -+ -+ while (1) { -+ int pos_state = ctx->pos & pos_state_mask; -+ u16 *prob = p + LZMA_IS_MATCH + -+ (ctx->state << LZMA_NUM_POS_BITS_MAX) + pos_state; -+ if (rc_is_bit_0(ctx, prob)) -+ process_bit0(ctx, p, pos_state, prob, -+ lc, literal_pos_mask); -+ else { -+ process_bit1(ctx, p, pos_state, prob); -+ if (ctx->rep0 == 0) -+ break; -+ } -+ if (unlzma_should_stop(ctx)) -+ break; -+ } -+ if (likely(!unlzma_should_stop(ctx))) -+ rc_normalize(ctx); -+ -+ return ctx->pos; -+} -+ -+ -+static void -+unlzma_reset_buf(struct unlzma_ctx *ctx) -+{ -+ ctx->avail_in = 0; -+ ctx->next_in = NULL; -+ ctx->avail_out = 0; -+ ctx->next_out = NULL; -+} -+ -+static int -+unlzma_thread(void *data) -+{ -+ struct unlzma_ctx *ctx = data; -+ -+ mutex_lock(&ctx->mutex); -+ do { -+ if (do_unlzma(ctx) < 0) -+ ctx->pos = 0; -+ unlzma_reset_buf(ctx); -+ ctx->cancel = false; -+ ctx->active = false; -+ } while (!kthread_should_stop()); -+ mutex_unlock(&ctx->mutex); -+ return 0; -+} -+ -+ -+static int -+unlzma_init(struct crypto_tfm *tfm) -+{ -+ return 0; -+} -+ -+static void -+unlzma_cancel(struct unlzma_ctx *ctx) -+{ -+ unlzma_reset_buf(ctx); -+ -+ if (!ctx->active) -+ return; -+ -+ ctx->cancel = true; -+ do { -+ mutex_unlock(&ctx->mutex); -+ wake_up(&ctx->next_req); -+ schedule(); -+ mutex_lock(&ctx->mutex); -+ } while (ctx->cancel); -+} -+ -+ -+static void -+unlzma_exit(struct crypto_tfm *tfm) -+{ -+ struct unlzma_ctx *ctx = crypto_tfm_ctx(tfm); -+ -+ if (ctx->thread) { -+ unlzma_cancel(ctx); -+ kthread_stop(ctx->thread); -+ ctx->thread = NULL; -+ if (ctx->buffers) -+ kfree(ctx->buffers); -+ ctx->buffers_max = 0; -+ ctx->buffers = NULL; -+ } -+} -+ -+static int -+unlzma_decompress_setup(struct crypto_pcomp *tfm, void *p, unsigned int len) -+{ -+ struct unlzma_ctx *ctx = crypto_tfm_ctx(crypto_pcomp_tfm(tfm)); -+ struct nlattr *tb[UNLZMA_DECOMP_MAX + 1]; -+ int ret = 0; -+ -+ if (ctx->thread) -+ return -EINVAL; -+ -+ if (!p) -+ return -EINVAL; -+ -+ ret = nla_parse(tb, UNLZMA_DECOMP_MAX, p, len, NULL); -+ if (ret) -+ return ret; -+ -+ if (!tb[UNLZMA_DECOMP_OUT_BUFFERS]) -+ return -EINVAL; -+ -+ if (ctx->buffers_max && (ctx->buffers_max < -+ nla_get_u32(tb[UNLZMA_DECOMP_OUT_BUFFERS]))) { -+ kfree(ctx->buffers); -+ ctx->buffers_max = 0; -+ ctx->buffers = NULL; -+ } -+ if (!ctx->buffers) { -+ ctx->buffers_max = nla_get_u32(tb[UNLZMA_DECOMP_OUT_BUFFERS]); -+ ctx->buffers = kzalloc(sizeof(struct unlzma_buffer) * ctx->buffers_max, GFP_KERNEL); -+ } -+ if (!ctx->buffers) -+ return -ENOMEM; -+ -+ ctx->waiting = false; -+ mutex_init(&ctx->mutex); -+ init_waitqueue_head(&ctx->next_req); -+ init_waitqueue_head(&ctx->req_done); -+ ctx->thread = kthread_run(unlzma_thread, ctx, "unlzma/%d", instance++); -+ if (IS_ERR(ctx->thread)) { -+ ret = PTR_ERR(ctx->thread); -+ ctx->thread = NULL; -+ } -+ -+ return ret; -+} -+ -+static int -+unlzma_decompress_init(struct crypto_pcomp *tfm) -+{ -+ return 0; -+} -+ -+static void -+unlzma_wait_complete(struct unlzma_ctx *ctx, bool finish) -+{ -+ DEFINE_WAIT(__wait); -+ -+ do { -+ wake_up(&ctx->next_req); -+ prepare_to_wait(&ctx->req_done, &__wait, TASK_INTERRUPTIBLE); -+ mutex_unlock(&ctx->mutex); -+ schedule(); -+ mutex_lock(&ctx->mutex); -+ } while (!ctx->waiting && ctx->active); -+ finish_wait(&ctx->req_done, &__wait); -+} -+ -+static int -+unlzma_decompress_update(struct crypto_pcomp *tfm, struct comp_request *req) -+{ -+ struct unlzma_ctx *ctx = crypto_tfm_ctx(crypto_pcomp_tfm(tfm)); -+ size_t pos = 0; -+ -+ mutex_lock(&ctx->mutex); -+ if (!ctx->active && !req->avail_in) -+ goto out; -+ -+ pos = ctx->pos; -+ ctx->waiting = false; -+ ctx->next_in = req->next_in; -+ ctx->avail_in = req->avail_in; -+ ctx->next_out = req->next_out; -+ ctx->avail_out = req->avail_out; -+ -+ unlzma_wait_complete(ctx, false); -+ -+ req->next_in = ctx->next_in; -+ req->avail_in = ctx->avail_in; -+ req->next_out = ctx->next_out; -+ req->avail_out = ctx->avail_out; -+ ctx->next_in = 0; -+ ctx->avail_in = 0; -+ pos = ctx->pos - pos; -+ -+out: -+ mutex_unlock(&ctx->mutex); -+ if (ctx->cancel) -+ return -EINVAL; -+ -+ return pos; -+} -+ -+static int -+unlzma_decompress_final(struct crypto_pcomp *tfm, struct comp_request *req) -+{ -+ struct unlzma_ctx *ctx = crypto_tfm_ctx(crypto_pcomp_tfm(tfm)); -+ int ret = 0; -+ -+ /* cancel pending operation */ -+ mutex_lock(&ctx->mutex); -+ if (ctx->active) { -+ // ret = -EINVAL; -+ unlzma_cancel(ctx); -+ } -+ ctx->pos = 0; -+ mutex_unlock(&ctx->mutex); -+ return ret; -+} -+ -+ -+static struct pcomp_alg unlzma_alg = { -+ .decompress_setup = unlzma_decompress_setup, -+ .decompress_init = unlzma_decompress_init, -+ .decompress_update = unlzma_decompress_update, -+ .decompress_final = unlzma_decompress_final, -+ -+ .base = { -+ .cra_name = "lzma", -+ .cra_flags = CRYPTO_ALG_TYPE_PCOMPRESS, -+ .cra_ctxsize = sizeof(struct unlzma_ctx), -+ .cra_module = THIS_MODULE, -+ .cra_init = unlzma_init, -+ .cra_exit = unlzma_exit, -+ } -+}; -+ -+static int __init -+unlzma_mod_init(void) -+{ -+ return crypto_register_pcomp(&unlzma_alg); -+} -+ -+static void __exit -+unlzma_mod_exit(void) -+{ -+ crypto_unregister_pcomp(&unlzma_alg); -+} -+ -+module_init(unlzma_mod_init); -+module_exit(unlzma_mod_exit); -+ -+MODULE_LICENSE("GPL"); -+MODULE_DESCRIPTION("LZMA Decompression Algorithm"); -+MODULE_AUTHOR("Felix Fietkau "); ---- a/crypto/Kconfig -+++ b/crypto/Kconfig -@@ -768,6 +768,12 @@ config CRYPTO_ZLIB - help - This is the zlib algorithm. - -+config CRYPTO_UNLZMA -+ tristate "LZMA decompression" -+ select CRYPTO_PCOMP -+ help -+ This is the lzma decompression module. -+ - config CRYPTO_LZO - tristate "LZO compression algorithm" - select CRYPTO_ALGAPI ---- a/crypto/Makefile -+++ b/crypto/Makefile -@@ -75,6 +75,7 @@ obj-$(CONFIG_CRYPTO_SEED) += seed.o - obj-$(CONFIG_CRYPTO_SALSA20) += salsa20_generic.o - obj-$(CONFIG_CRYPTO_DEFLATE) += deflate.o - obj-$(CONFIG_CRYPTO_ZLIB) += zlib.o -+obj-$(CONFIG_CRYPTO_UNLZMA) += unlzma.o - obj-$(CONFIG_CRYPTO_MICHAEL_MIC) += michael_mic.o - obj-$(CONFIG_CRYPTO_CRC32C) += crc32c.o - obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.o ---- /dev/null -+++ b/crypto/unlzma.h -@@ -0,0 +1,80 @@ -+/* LZMA uncompresion module for pcomp -+ * Copyright (C) 2009 Felix Fietkau -+ * -+ * Based on: -+ * Initial Linux kernel adaptation -+ * Copyright (C) 2006 Alain < alain@knaff.lu > -+ * -+ * Based on small lzma deflate implementation/Small range coder -+ * implementation for lzma. -+ * Copyright (C) 2006 Aurelien Jacobs < aurel@gnuage.org > -+ * -+ * Based on LzmaDecode.c from the LZMA SDK 4.22 (http://www.7-zip.org/) -+ * Copyright (C) 1999-2005 Igor Pavlov -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ */ -+#ifndef __UNLZMA_H -+#define __UNLZMA_H -+ -+struct lzma_header { -+ __u8 pos; -+ __le32 dict_size; -+} __attribute__ ((packed)) ; -+ -+ -+#define RC_TOP_BITS 24 -+#define RC_MOVE_BITS 5 -+#define RC_MODEL_TOTAL_BITS 11 -+ -+#define LZMA_BASE_SIZE 1846 -+#define LZMA_LIT_SIZE 768 -+ -+#define LZMA_NUM_POS_BITS_MAX 4 -+ -+#define LZMA_LEN_NUM_LOW_BITS 3 -+#define LZMA_LEN_NUM_MID_BITS 3 -+#define LZMA_LEN_NUM_HIGH_BITS 8 -+ -+#define LZMA_LEN_CHOICE 0 -+#define LZMA_LEN_CHOICE_2 (LZMA_LEN_CHOICE + 1) -+#define LZMA_LEN_LOW (LZMA_LEN_CHOICE_2 + 1) -+#define LZMA_LEN_MID (LZMA_LEN_LOW \ -+ + (1 << (LZMA_NUM_POS_BITS_MAX + LZMA_LEN_NUM_LOW_BITS))) -+#define LZMA_LEN_HIGH (LZMA_LEN_MID \ -+ +(1 << (LZMA_NUM_POS_BITS_MAX + LZMA_LEN_NUM_MID_BITS))) -+#define LZMA_NUM_LEN_PROBS (LZMA_LEN_HIGH + (1 << LZMA_LEN_NUM_HIGH_BITS)) -+ -+#define LZMA_NUM_STATES 12 -+#define LZMA_NUM_LIT_STATES 7 -+ -+#define LZMA_START_POS_MODEL_INDEX 4 -+#define LZMA_END_POS_MODEL_INDEX 14 -+#define LZMA_NUM_FULL_DISTANCES (1 << (LZMA_END_POS_MODEL_INDEX >> 1)) -+ -+#define LZMA_NUM_POS_SLOT_BITS 6 -+#define LZMA_NUM_LEN_TO_POS_STATES 4 -+ -+#define LZMA_NUM_ALIGN_BITS 4 -+ -+#define LZMA_MATCH_MIN_LEN 2 -+ -+#define LZMA_IS_MATCH 0 -+#define LZMA_IS_REP (LZMA_IS_MATCH + (LZMA_NUM_STATES << LZMA_NUM_POS_BITS_MAX)) -+#define LZMA_IS_REP_G0 (LZMA_IS_REP + LZMA_NUM_STATES) -+#define LZMA_IS_REP_G1 (LZMA_IS_REP_G0 + LZMA_NUM_STATES) -+#define LZMA_IS_REP_G2 (LZMA_IS_REP_G1 + LZMA_NUM_STATES) -+#define LZMA_IS_REP_0_LONG (LZMA_IS_REP_G2 + LZMA_NUM_STATES) -+#define LZMA_POS_SLOT (LZMA_IS_REP_0_LONG \ -+ + (LZMA_NUM_STATES << LZMA_NUM_POS_BITS_MAX)) -+#define LZMA_SPEC_POS (LZMA_POS_SLOT \ -+ +(LZMA_NUM_LEN_TO_POS_STATES << LZMA_NUM_POS_SLOT_BITS)) -+#define LZMA_ALIGN (LZMA_SPEC_POS \ -+ + LZMA_NUM_FULL_DISTANCES - LZMA_END_POS_MODEL_INDEX) -+#define LZMA_LEN_CODER (LZMA_ALIGN + (1 << LZMA_NUM_ALIGN_BITS)) -+#define LZMA_REP_LEN_CODER (LZMA_LEN_CODER + LZMA_NUM_LEN_PROBS) -+#define LZMA_LITERAL (LZMA_REP_LEN_CODER + LZMA_NUM_LEN_PROBS) -+ -+#endif ---- a/include/crypto/compress.h -+++ b/include/crypto/compress.h -@@ -49,6 +49,12 @@ enum zlib_decomp_params { - - #define ZLIB_DECOMP_MAX (__ZLIB_DECOMP_MAX - 1) - -+enum unlzma_decomp_params { -+ UNLZMA_DECOMP_OUT_BUFFERS = 1, /* naximum number of output buffers */ -+ __UNLZMA_DECOMP_MAX, -+}; -+#define UNLZMA_DECOMP_MAX (__UNLZMA_DECOMP_MAX - 1) -+ - - struct crypto_pcomp { - struct crypto_tfm base; diff --git a/target/linux/generic-2.6/patches-2.6.31/053-squashfs_lzma.patch b/target/linux/generic-2.6/patches-2.6.31/053-squashfs_lzma.patch deleted file mode 100644 index 2725f0669..000000000 --- a/target/linux/generic-2.6/patches-2.6.31/053-squashfs_lzma.patch +++ /dev/null @@ -1,244 +0,0 @@ ---- a/fs/squashfs/Kconfig -+++ b/fs/squashfs/Kconfig -@@ -2,7 +2,6 @@ config SQUASHFS - tristate "SquashFS 4.0 - Squashed file system support" - depends on BLOCK - select CRYPTO -- select CRYPTO_ZLIB - help - Saying Y here includes support for SquashFS 4.0 (a Compressed - Read-Only File System). Squashfs is a highly compressed read-only -@@ -37,6 +36,26 @@ config SQUASHFS_EMBEDDED - - If unsure, say N. - -+config SQUASHFS_SUPPORT_ZLIB -+ bool -+ prompt "Support ZLIB compression" if SQUASHFS_SUPPORT_LZMA -+ depends on SQUASHFS -+ select CRYPTO_ZLIB -+ default y -+ help -+ ZLIB is the default compression used in squashfs. If you are -+ using LZMA compression instead, you can remove support for ZLIB -+ entirely. -+ -+config SQUASHFS_SUPPORT_LZMA -+ bool "Support LZMA compression" -+ depends on SQUASHFS -+ select CRYPTO_UNLZMA -+ help -+ By default SquashFS uses ZLIB compression, however (if your tools -+ support it, you can use LZMA instead, which saves space. -+ -+ - config SQUASHFS_FRAGMENT_CACHE_SIZE - int "Number of fragments cached" if SQUASHFS_EMBEDDED - depends on SQUASHFS ---- a/fs/squashfs/squashfs_fs.h -+++ b/fs/squashfs/squashfs_fs.h -@@ -212,6 +212,7 @@ struct meta_index { - * definitions for structures on disk - */ - #define ZLIB_COMPRESSION 1 -+#define LZMA_COMPRESSION 2 - - struct squashfs_super_block { - __le32 s_magic; ---- a/fs/squashfs/super.c -+++ b/fs/squashfs/super.c -@@ -48,13 +48,76 @@ - #include "squashfs.h" - - --#define SQUASHFS_CRYPTO_ALG "zlib" -+static int squashfs_setup_zlib(struct squashfs_sb_info *msblk) -+{ -+ int err = -EOPNOTSUPP; -+ -+#ifdef CONFIG_SQUASHFS_SUPPORT_ZLIB -+ struct { -+ struct nlattr nla; -+ int val; -+ } params = { -+ .nla = { -+ .nla_len = nla_attr_size(sizeof(int)), -+ .nla_type = ZLIB_DECOMP_WINDOWBITS, -+ }, -+ .val = DEF_WBITS, -+ }; -+ -+ msblk->tfm = crypto_alloc_pcomp("zlib", 0, -+ CRYPTO_ALG_ASYNC); -+ if (IS_ERR(msblk->tfm)) { -+ ERROR("Failed to load zlib crypto module\n"); -+ return PTR_ERR(msblk->tfm); -+ } -+ -+ err = crypto_decompress_setup(msblk->tfm, ¶ms, sizeof(params)); -+ if (err) { -+ ERROR("Failed to set up decompression parameters\n"); -+ crypto_free_pcomp(msblk->tfm); -+ } -+#endif -+ -+ return err; -+} -+ -+static int squashfs_setup_lzma(struct squashfs_sb_info *msblk) -+{ -+ int err = -EOPNOTSUPP; -+ -+#ifdef CONFIG_SQUASHFS_SUPPORT_LZMA -+ struct { -+ struct nlattr nla; -+ int val; -+ } params = { -+ .nla = { -+ .nla_len = nla_attr_size(sizeof(int)), -+ .nla_type = UNLZMA_DECOMP_OUT_BUFFERS, -+ }, -+ .val = (msblk->block_size / PAGE_CACHE_SIZE) + 1 -+ }; - -+ msblk->tfm = crypto_alloc_pcomp("lzma", 0, -+ CRYPTO_ALG_ASYNC); -+ if (IS_ERR(msblk->tfm)) { -+ ERROR("Failed to load lzma crypto module\n"); -+ return PTR_ERR(msblk->tfm); -+ } -+ -+ err = crypto_decompress_setup(msblk->tfm, ¶ms, sizeof(params)); -+ if (err) { -+ ERROR("Failed to set up decompression parameters\n"); -+ crypto_free_pcomp(msblk->tfm); -+ } -+#endif -+ -+ return err; -+} - - static struct file_system_type squashfs_fs_type; - static struct super_operations squashfs_super_ops; - --static int supported_squashfs_filesystem(short major, short minor, short comp) -+static int supported_squashfs_filesystem(short major, short minor) - { - if (major < SQUASHFS_MAJOR) { - ERROR("Major/Minor mismatch, older Squashfs %d.%d " -@@ -67,9 +130,6 @@ static int supported_squashfs_filesystem - return -EINVAL; - } - -- if (comp != ZLIB_COMPRESSION) -- return -EINVAL; -- - return 0; - } - -@@ -84,16 +144,6 @@ static int squashfs_fill_super(struct su - unsigned short flags; - unsigned int fragments; - u64 lookup_table_start; -- struct { -- struct nlattr nla; -- int val; -- } params = { -- .nla = { -- .nla_len = nla_attr_size(sizeof(int)), -- .nla_type = ZLIB_DECOMP_WINDOWBITS, -- }, -- .val = DEF_WBITS, -- }; - int err; - - TRACE("Entered squashfs_fill_superblock\n"); -@@ -105,21 +155,6 @@ static int squashfs_fill_super(struct su - } - msblk = sb->s_fs_info; - -- msblk->tfm = crypto_alloc_pcomp(SQUASHFS_CRYPTO_ALG, 0, -- CRYPTO_ALG_ASYNC); -- if (IS_ERR(msblk->tfm)) { -- ERROR("Failed to load %s crypto module\n", -- SQUASHFS_CRYPTO_ALG); -- err = PTR_ERR(msblk->tfm); -- goto failed_pcomp; -- } -- -- err = crypto_decompress_setup(msblk->tfm, ¶ms, sizeof(params)); -- if (err) { -- ERROR("Failed to set up decompression parameters\n"); -- goto failure; -- } -- - sblk = kzalloc(sizeof(*sblk), GFP_KERNEL); - if (sblk == NULL) { - ERROR("Failed to allocate squashfs_super_block\n"); -@@ -157,10 +192,28 @@ static int squashfs_fill_super(struct su - goto failed_mount; - } - -+ /* Check block size for sanity */ -+ msblk->block_size = le32_to_cpu(sblk->block_size); -+ if (msblk->block_size > SQUASHFS_FILE_MAX_SIZE) -+ goto failed_mount; -+ - /* Check the MAJOR & MINOR versions and compression type */ - err = supported_squashfs_filesystem(le16_to_cpu(sblk->s_major), -- le16_to_cpu(sblk->s_minor), -- le16_to_cpu(sblk->compression)); -+ le16_to_cpu(sblk->s_minor)); -+ if (err < 0) -+ goto failed_mount; -+ -+ switch(le16_to_cpu(sblk->compression)) { -+ case ZLIB_COMPRESSION: -+ err = squashfs_setup_zlib(msblk); -+ break; -+ case LZMA_COMPRESSION: -+ err = squashfs_setup_lzma(msblk); -+ break; -+ default: -+ err = -EINVAL; -+ break; -+ } - if (err < 0) - goto failed_mount; - -@@ -180,11 +233,6 @@ static int squashfs_fill_super(struct su - i_size_read(sb->s_bdev->bd_inode)) - goto failed_mount; - -- /* Check block size for sanity */ -- msblk->block_size = le32_to_cpu(sblk->block_size); -- if (msblk->block_size > SQUASHFS_FILE_MAX_SIZE) -- goto failed_mount; -- - /* - * Check the system page size is not larger than the filesystem - * block size (by default 128K). This is currently not supported. -@@ -316,21 +364,16 @@ allocate_root: - return 0; - - failed_mount: -+ if (msblk->tfm) -+ crypto_free_pcomp(msblk->tfm); - squashfs_cache_delete(msblk->block_cache); - squashfs_cache_delete(msblk->fragment_cache); - squashfs_cache_delete(msblk->read_page); - kfree(msblk->inode_lookup_table); - kfree(msblk->fragment_index); - kfree(msblk->id_table); -- crypto_free_pcomp(msblk->tfm); -- kfree(sb->s_fs_info); -- sb->s_fs_info = NULL; - kfree(sblk); -- return err; -- - failure: -- crypto_free_pcomp(msblk->tfm); --failed_pcomp: - kfree(sb->s_fs_info); - sb->s_fs_info = NULL; - return err; From e7cdf7db479819878d0f6bef475511f9f1204688 Mon Sep 17 00:00:00 2001 From: kaloz Date: Mon, 2 Nov 2009 09:52:54 +0000 Subject: [PATCH 056/288] sync mksquashfs4 with the CVS code to generate LZMA images git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18268 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- tools/squashfs4/patches/110-lzma.patch | 2522 ++++++++++++++++++++---- 1 file changed, 2144 insertions(+), 378 deletions(-) diff --git a/tools/squashfs4/patches/110-lzma.patch b/tools/squashfs4/patches/110-lzma.patch index 1441fb42f..5fd697085 100644 --- a/tools/squashfs4/patches/110-lzma.patch +++ b/tools/squashfs4/patches/110-lzma.patch @@ -1,153 +1,1952 @@ -Index: squashfs4.0/squashfs-tools/mksquashfs.c -=================================================================== ---- squashfs4.0.orig/squashfs-tools/mksquashfs.c 2009-04-05 23:22:48.000000000 +0200 -+++ squashfs4.0/squashfs-tools/mksquashfs.c 2009-09-14 17:21:46.210480446 +0200 -@@ -64,6 +64,18 @@ +diff -Nur squashfs4.0/squashfs-tools/compressor.c squashfs4.0-lzma-snapshot/squashfs-tools/compressor.c +--- squashfs4.0/squashfs-tools/compressor.c 1970-01-01 01:00:00.000000000 +0100 ++++ squashfs4.0-lzma-snapshot/squashfs-tools/compressor.c 2009-10-20 06:03:37.000000000 +0200 +@@ -0,0 +1,78 @@ ++/* ++ * ++ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 ++ * Phillip Lougher ++ * ++ * 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, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * compressor.c ++ */ ++ ++#include ++#include ++#include "compressor.h" ++#include "squashfs_fs.h" ++ ++extern int gzip_compress(void **, char *, char *, int, int, int *); ++extern int gzip_uncompress(char *, char *, int, int, int *); ++extern int lzma_compress(void **, char *, char *, int, int, int *); ++extern int lzma_uncompress(char *, char *, int, int, int *); ++ ++struct compressor compressor[] = { ++ { gzip_compress, gzip_uncompress, ZLIB_COMPRESSION, "gzip", 1 }, ++#ifdef LZMA_SUPPORT ++ { lzma_compress, lzma_uncompress, LZMA_COMPRESSION, "lzma", 1 }, ++#else ++ { NULL, NULL, LZMA_COMPRESSION, "lzma", 0 }, ++#endif ++ { NULL, NULL , 0, "unknown", 0} ++}; ++ ++ ++struct compressor *lookup_compressor(char *name) ++{ ++ int i; ++ ++ for(i = 0; compressor[i].id; i++) ++ if(strcmp(compressor[i].name, name) == 0) ++ break; ++ ++ return &compressor[i]; ++} ++ ++ ++struct compressor *lookup_compressor_id(int id) ++{ ++ int i; ++ ++ for(i = 0; compressor[i].id; i++) ++ if(id == compressor[i].id) ++ break; ++ ++ return &compressor[i]; ++} ++ ++ ++void display_compressors(char *indent, char *def_comp) ++{ ++ int i; ++ ++ for(i = 0; compressor[i].id; i++) ++ if(compressor[i].supported) ++ fprintf(stderr, "%s\t%s%s\n", indent, ++ compressor[i].name, ++ strcmp(compressor[i].name, def_comp) == 0 ? ++ " (default)" : ""); ++} +diff -Nur squashfs4.0/squashfs-tools/compressor.h squashfs4.0-lzma-snapshot/squashfs-tools/compressor.h +--- squashfs4.0/squashfs-tools/compressor.h 1970-01-01 01:00:00.000000000 +0100 ++++ squashfs4.0-lzma-snapshot/squashfs-tools/compressor.h 2009-10-20 06:03:37.000000000 +0200 +@@ -0,0 +1,33 @@ ++/* ++ * ++ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 ++ * Phillip Lougher ++ * ++ * 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, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * compressor.h ++ */ ++ ++struct compressor { ++ int (*compress)(void **, char *, char *, int, int, int *); ++ int (*uncompress)(char *, char *, int, int, int *); ++ int id; ++ char *name; ++ int supported; ++}; ++ ++extern struct compressor *lookup_compressor(char *); ++extern struct compressor *lookup_compressor_id(int); ++extern void display_compressors(char *, char *); +diff -Nur squashfs4.0/squashfs-tools/gzip_wrapper.c squashfs4.0-lzma-snapshot/squashfs-tools/gzip_wrapper.c +--- squashfs4.0/squashfs-tools/gzip_wrapper.c 1970-01-01 01:00:00.000000000 +0100 ++++ squashfs4.0-lzma-snapshot/squashfs-tools/gzip_wrapper.c 2009-10-20 06:03:37.000000000 +0200 +@@ -0,0 +1,80 @@ ++/* ++ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 ++ * Phillip Lougher ++ * ++ * 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, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * gzip_wrapper.c ++ */ ++ ++#include ++#include ++ ++int gzip_compress(void **strm, char *d, char *s, int size, int block_size, ++ int *error) ++{ ++ int res = 0; ++ z_stream *stream = *strm; ++ ++ if(stream == NULL) { ++ if((stream = *strm = malloc(sizeof(z_stream))) == NULL) ++ goto failed; ++ ++ stream->zalloc = Z_NULL; ++ stream->zfree = Z_NULL; ++ stream->opaque = 0; ++ ++ if((res = deflateInit(stream, 9)) != Z_OK) ++ goto failed; ++ } else if((res = deflateReset(stream)) != Z_OK) ++ goto failed; ++ ++ stream->next_in = (unsigned char *) s; ++ stream->avail_in = size; ++ stream->next_out = (unsigned char *) d; ++ stream->avail_out = block_size; ++ ++ res = deflate(stream, Z_FINISH); ++ if(res == Z_STREAM_END) ++ /* ++ * Success, return the compressed size. ++ */ ++ return (int) stream->total_out; ++ if(res == Z_OK) ++ /* ++ * Output buffer overflow. Return out of buffer space ++ */ ++ return 0; ++failed: ++ /* ++ * All other errors return failure, with the compressor ++ * specific error code in *error ++ */ ++ *error = res; ++ return -1; ++} ++ ++ ++int gzip_uncompress(char *d, char *s, int size, int block_size, int *error) ++{ ++ int res; ++ unsigned long bytes = block_size; ++ ++ res = uncompress((unsigned char *) d, &bytes, ++ (const unsigned char *) s, size); ++ ++ *error = res; ++ return res == Z_OK ? (int) bytes : -1; ++} +diff -Nur squashfs4.0/squashfs-tools/lzma_wrapper.c squashfs4.0-lzma-snapshot/squashfs-tools/lzma_wrapper.c +--- squashfs4.0/squashfs-tools/lzma_wrapper.c 1970-01-01 01:00:00.000000000 +0100 ++++ squashfs4.0-lzma-snapshot/squashfs-tools/lzma_wrapper.c 2009-10-14 05:32:57.000000000 +0200 +@@ -0,0 +1,93 @@ ++/* ++ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 ++ * Phillip Lougher ++ * ++ * 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, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * lzma_wrapper.c ++ */ ++ ++#include ++ ++#define LZMA_HEADER_SIZE (LZMA_PROPS_SIZE + 8) ++ ++int lzma_compress(void **strm, char *dest, char *src, int size,int block_size, ++ int *error) ++{ ++ unsigned char *d = (unsigned char *) dest, *s = (unsigned char *) src; ++ size_t props_size = LZMA_PROPS_SIZE, ++ outlen = block_size - LZMA_HEADER_SIZE; ++ int res; ++ ++ res = LzmaCompress(d + LZMA_HEADER_SIZE, &outlen, s, size, d, ++ &props_size, 5, block_size, 3, 0, 2, 32, 1); ++ ++ if(res == SZ_ERROR_OUTPUT_EOF) { ++ /* ++ * Output buffer overflow. Return out of buffer space error ++ */ ++ return 0; ++ } ++ ++ if(res != SZ_OK) { ++ /* ++ * All other errors return failure, with the compressor ++ * specific error code in *error ++ */ ++ *error = res; ++ return -1; ++ } ++ ++ /* ++ * Fill in the 8 byte little endian uncompressed size field in the ++ * LZMA header. 8 bytes is excessively large for squashfs but ++ * this is the standard LZMA header and which is expected by the kernel ++ * code ++ */ ++ d[LZMA_PROPS_SIZE] = size & 255; ++ d[LZMA_PROPS_SIZE + 1] = (size >> 8) & 255; ++ d[LZMA_PROPS_SIZE + 2] = (size >> 16) & 255; ++ d[LZMA_PROPS_SIZE + 3] = (size >> 24) & 255; ++ d[LZMA_PROPS_SIZE + 4] = 0; ++ d[LZMA_PROPS_SIZE + 5] = 0; ++ d[LZMA_PROPS_SIZE + 6] = 0; ++ d[LZMA_PROPS_SIZE + 7] = 0; ++ ++ /* ++ * Success, return the compressed size. Outlen returned by the LZMA ++ * compressor does not include the LZMA header space ++ */ ++ return outlen + LZMA_HEADER_SIZE; ++} ++ ++ ++int lzma_uncompress(char *dest, char *src, int size, int block_size, ++ int *error) ++{ ++ unsigned char *d = (unsigned char *) dest, *s = (unsigned char *) src; ++ size_t outlen, inlen = size - LZMA_HEADER_SIZE; ++ int res; ++ ++ outlen = s[LZMA_PROPS_SIZE] | ++ (s[LZMA_PROPS_SIZE + 1] << 8) | ++ (s[LZMA_PROPS_SIZE + 2] << 16) | ++ (s[LZMA_PROPS_SIZE + 3] << 24); ++ ++ res = LzmaUncompress(d, &outlen, s + LZMA_HEADER_SIZE, &inlen, ++ s, LZMA_PROPS_SIZE); ++ ++ *error = res; ++ return res == SZ_OK ? outlen : -1; ++} +diff -Nur squashfs4.0/squashfs-tools/Makefile squashfs4.0-lzma-snapshot/squashfs-tools/Makefile +--- squashfs4.0/squashfs-tools/Makefile 2009-04-05 04:03:36.000000000 +0200 ++++ squashfs4.0-lzma-snapshot/squashfs-tools/Makefile 2009-10-22 06:17:12.000000000 +0200 +@@ -1,40 +1,76 @@ ++# ++# Building LZMA support ++# Download LZMA sdk (4.65 used in development, other versions may work), ++# set LZMA_DIR to unpacked source, and uncomment next line ++LZMA_SUPPORT = 1 ++LZMA_DIR = ../../lzma-4.65 ++ ++#Compression default. ++COMP_DEFAULT = gzip ++ ++INCLUDEDIR = -I. + INSTALL_DIR = /usr/local/bin + +-INCLUDEDIR = . ++MKSQUASHFS_OBJS = mksquashfs.o read_fs.o sort.o swap.o pseudo.o compressor.o \ ++ gzip_wrapper.o ++ ++UNSQUASHFS_OBJS = unsquashfs.o unsquash-1.o unsquash-2.o unsquash-3.o \ ++ unsquash-4.o swap.o compressor.o gzip_wrapper.o + +-CFLAGS := -I$(INCLUDEDIR) -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -O2 ++CFLAGS = $(INCLUDEDIR) -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \ ++ -D_GNU_SOURCE -DCOMP_DEFAULT=\"$(COMP_DEFAULT)\" -O2 -Wall + ++ifdef LZMA_SUPPORT ++LZMA_OBJS = $(LZMA_DIR)/C/Alloc.o $(LZMA_DIR)/C/LzFind.o \ ++ $(LZMA_DIR)/C/LzmaDec.o $(LZMA_DIR)/C/LzmaEnc.o $(LZMA_DIR)/C/LzmaLib.o ++INCLUDEDIR += -I$(LZMA_DIR)/C ++CFLAGS += -DLZMA_SUPPORT ++MKSQUASHFS_OBJS += lzma_wrapper.o $(LZMA_OBJS) ++UNSQUASHFS_OBJS += lzma_wrapper.o $(LZMA_OBJS) ++endif ++ ++.PHONY: all + all: mksquashfs unsquashfs + +-mksquashfs: mksquashfs.o read_fs.o sort.o swap.o pseudo.o +- $(CC) mksquashfs.o read_fs.o sort.o swap.o pseudo.o -lz -lpthread -lm -o $@ ++mksquashfs: $(MKSQUASHFS_OBJS) ++ $(CC) $(MKSQUASHFS_OBJS) -lz -lpthread -lm -o $@ ++ ++mksquashfs.o: mksquashfs.c squashfs_fs.h mksquashfs.h global.h sort.h \ ++ squashfs_swap.h + +-mksquashfs.o: mksquashfs.c squashfs_fs.h mksquashfs.h global.h sort.h squashfs_swap.h Makefile ++read_fs.o: read_fs.c squashfs_fs.h read_fs.h global.h squashfs_swap.h + +-read_fs.o: read_fs.c squashfs_fs.h read_fs.h global.h squashfs_swap.h Makefile ++sort.o: sort.c squashfs_fs.h global.h sort.h + +-sort.o: sort.c squashfs_fs.h global.h sort.h Makefile ++swap.o: swap.c + +-swap.o: swap.c Makefile ++pseudo.o: pseudo.c pseudo.h + +-pseudo.o: pseudo.c pseudo.h Makefile ++compressor.o: compressor.c compressor.h + +-unsquashfs: unsquashfs.o unsquash-1.o unsquash-2.o unsquash-3.o unsquash-4.o swap.o +- $(CC) unsquashfs.o unsquash-1.o unsquash-2.o unsquash-3.o unsquash-4.o swap.o -lz -lpthread -lm -o $@ ++unsquashfs: $(UNSQUASHFS_OBJS) ++ $(CC) $(UNSQUASHFS_OBJS) -lz -lpthread -lm -o $@ + +-unsquashfs.o: unsquashfs.h unsquashfs.c squashfs_fs.h squashfs_swap.h squashfs_compat.h global.h Makefile ++unsquashfs.o: unsquashfs.h unsquashfs.c squashfs_fs.h squashfs_swap.h \ ++ squashfs_compat.h global.h + +-unsquash-1.o: unsquashfs.h unsquash-1.c squashfs_fs.h squashfs_compat.h global.h Makefile ++unsquash-1.o: unsquashfs.h unsquash-1.c squashfs_fs.h squashfs_compat.h \ ++ global.h + +-unsquash-2.o: unsquashfs.h unsquash-2.c unsquashfs.h squashfs_fs.h squashfs_compat.h global.h Makefile ++unsquash-2.o: unsquashfs.h unsquash-2.c unsquashfs.h squashfs_fs.h \ ++ squashfs_compat.h global.h + +-unsquash-3.o: unsquashfs.h unsquash-3.c squashfs_fs.h squashfs_compat.h global.h Makefile ++unsquash-3.o: unsquashfs.h unsquash-3.c squashfs_fs.h squashfs_compat.h \ ++ global.h + +-unsquash-4.o: unsquashfs.h unsquash-4.c squashfs_fs.h squashfs_swap.h global.h Makefile ++unsquash-4.o: unsquashfs.h unsquash-4.c squashfs_fs.h squashfs_swap.h \ ++ global.h + ++.PHONY: clean + clean: + -rm -f *.o mksquashfs unsquashfs + ++.PHONY: install + install: mksquashfs unsquashfs + mkdir -p $(INSTALL_DIR) + cp mksquashfs $(INSTALL_DIR) +diff -Nur squashfs4.0/squashfs-tools/mksquashfs.c squashfs4.0-lzma-snapshot/squashfs-tools/mksquashfs.c +--- squashfs4.0/squashfs-tools/mksquashfs.c 2009-04-05 23:22:48.000000000 +0200 ++++ squashfs4.0-lzma-snapshot/squashfs-tools/mksquashfs.c 2009-10-20 06:03:38.000000000 +0200 +@@ -36,7 +36,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -47,6 +46,7 @@ + #include + #include + #include ++#include + + #ifndef linux + #define __BYTE_ORDER BYTE_ORDER +@@ -64,6 +64,7 @@ #include "global.h" #include "sort.h" #include "pseudo.h" -+#include "uncompress.h" -+ -+#ifdef USE_LZMA -+#include -+#include -+#define LZMA_DEFAULT_LEVEL 5 -+#define LZMA_DEFAULT_DICT 0 -+#define LZMA_DEFAULT_LC 1 -+#define LZMA_DEFAULT_LP 2 -+#define LZMA_DEFAULT_PB 2 -+#define LZMA_DEFAULT_FB 32 -+#endif ++#include "compressor.h" #ifdef SQUASHFS_TRACE #define TRACE(s, args...) do { \ -@@ -830,6 +842,19 @@ - rotate = (rotate + 1) % 4; +@@ -245,10 +246,8 @@ + /* list of root directory entries read from original filesystem */ + int old_root_entries = 0; + struct old_root_entry_info { +- char name[SQUASHFS_NAME_LEN + 1]; +- squashfs_inode inode; +- int type; +- int inode_number; ++ char *name; ++ struct inode_info inode; + }; + struct old_root_entry_info *old_root_entry; + +@@ -371,10 +370,15 @@ + int reader_buffer_size; + int fragment_buffer_size; + ++/* compression operations structure */ ++static struct compressor *comp; ++char *comp_name = COMP_DEFAULT; ++ + char *read_from_disk(long long start, unsigned int avail_bytes); + void add_old_root_entry(char *name, squashfs_inode inode, int inode_number, + int type); +-extern int read_super(int fd, squashfs_super_block *sBlk, char *source); ++extern struct compressor *read_super(int fd, squashfs_super_block *sBlk, ++ char *source); + extern long long read_filesystem(char *root_name, int fd, + squashfs_super_block *sBlk, char **cinode_table, char **data_cache, + char **cdirectory_table, char **directory_data_cache, +@@ -831,83 +835,32 @@ } -+#ifdef USE_LZMA -+static void *lzma_malloc(void *p, size_t size) -+{ -+ (void)p; -+ return malloc(size); -+} -+static void lzma_free(void *p, void *addr) -+{ -+ (void)p; -+ free(addr); -+} -+static ISzAlloc lzma_alloc = { lzma_malloc, lzma_free }; -+#endif - unsigned int mangle2(z_stream **strm, char *d, char *s, int size, +-unsigned int mangle2(z_stream **strm, char *d, char *s, int size, ++int mangle2(void **strm, char *d, char *s, int size, int block_size, int uncompressed, int data_block) -@@ -841,6 +866,50 @@ - if(uncompressed) - goto notcompressed; + { +- unsigned long c_byte; +- unsigned int res; +- z_stream *stream = *strm; +- +- if(uncompressed) +- goto notcompressed; +- +- if(stream == NULL) { +- if((stream = *strm = malloc(sizeof(z_stream))) == NULL) +- BAD_ERROR("mangle::compress failed, not enough " +- "memory\n"); +- +- stream->zalloc = Z_NULL; +- stream->zfree = Z_NULL; +- stream->opaque = 0; +- +- if((res = deflateInit(stream, 9)) != Z_OK) { +- if(res == Z_MEM_ERROR) +- BAD_ERROR("zlib::compress failed, not enough " +- "memory\n"); +- else if(res == Z_STREAM_ERROR) +- BAD_ERROR("zlib::compress failed, not a valid " +- "compression level\n"); +- else if(res == Z_VERSION_ERROR) +- BAD_ERROR("zlib::compress failed, incorrect " +- "zlib version\n"); +- else +- BAD_ERROR("zlib::compress failed, unknown " +- "error %d\n", res); +- } +- } else if((res = deflateReset(stream)) != Z_OK) { +- if(res == Z_STREAM_ERROR) +- BAD_ERROR("zlib::compress failed, stream state " +- "inconsistent\n"); +- else +- BAD_ERROR("zlib::compress failed, unknown error %d\n", +- res); +- } ++ int error, c_byte = 0; -+#ifdef USE_LZMA -+ if (compression == LZMA_COMPRESSION) { -+ size_t outsize = block_size - LZMA_PROPS_SIZE; -+ size_t propsize = LZMA_PROPS_SIZE; -+ CLzmaEncProps props; -+ -+ LzmaEncProps_Init(&props); -+ props.level = LZMA_DEFAULT_LEVEL; -+ props.dictSize = LZMA_DEFAULT_DICT; -+ props.lc = LZMA_DEFAULT_LC; -+ props.lp = LZMA_DEFAULT_LP; -+ props.pb = LZMA_DEFAULT_PB; -+ props.fb = LZMA_DEFAULT_FB; -+ props.numThreads = 1; -+ -+ res = LzmaEncode((unsigned char *) d + LZMA_PROPS_SIZE, &outsize, -+ (unsigned char *) s, size, -+ &props, (unsigned char *) d, &propsize, -+ 1, NULL, &lzma_alloc, &lzma_alloc); -+ switch(res) { -+ case SZ_OK: -+ outsize += LZMA_PROPS_SIZE; -+ break; -+ case SZ_ERROR_DATA: -+ BAD_ERROR("lzma::compress failed, data error\n"); -+ break; -+ case SZ_ERROR_MEM: -+ BAD_ERROR("lzma::compress failed, memory allocation error\n"); -+ break; -+ case SZ_ERROR_PARAM: -+ BAD_ERROR("lzma::compress failed, invalid parameters\n"); -+ break; -+ case SZ_ERROR_OUTPUT_EOF: -+ goto notcompressed; -+ /* should not happen */ -+ default: -+ BAD_ERROR("lzma::compress failed, unknown error (%d)\n", res); -+ break; -+ } -+ -+ return outsize; -+ } -+#endif -+ - if(stream == NULL) { - if((stream = *strm = malloc(sizeof(z_stream))) == NULL) - BAD_ERROR("mangle::compress failed, not enough " -@@ -1669,17 +1738,17 @@ +- stream->next_in = (unsigned char *) s; +- stream->avail_in = size; +- stream->next_out = (unsigned char *) d; +- stream->avail_out = block_size; +- +- res = deflate(stream, Z_FINISH); +- if(res != Z_STREAM_END && res != Z_OK) { +- if(res == Z_STREAM_ERROR) +- BAD_ERROR("zlib::compress failed, stream state " +- "inconsistent\n"); +- else if(res == Z_BUF_ERROR) +- BAD_ERROR("zlib::compress failed, no progress possible" +- "\n"); +- else +- BAD_ERROR("zlib::compress failed, unknown error %d\n", +- res); ++ if(!uncompressed) { ++ c_byte = comp->compress(strm, d, s, size, block_size, &error); ++ if(c_byte == -1) ++ BAD_ERROR("mangle2:: %s compress failed with error " ++ "code %d\n", comp->name, error); + } + +- c_byte = stream->total_out; +- +- if(res != Z_STREAM_END || c_byte >= size) { +-notcompressed: ++ if(c_byte == 0 || c_byte >= size) { + memcpy(d, s, size); + return size | (data_block ? SQUASHFS_COMPRESSED_BIT_BLOCK : + SQUASHFS_COMPRESSED_BIT); + } + +- return (unsigned int) c_byte; ++ return c_byte; + } + + +-unsigned int mangle(char *d, char *s, int size, int block_size, ++int mangle(char *d, char *s, int size, int block_size, + int uncompressed, int data_block) + { +- static z_stream *stream = NULL; ++ static void *stream = NULL; + + return mangle2(&stream, d, s, size, block_size, uncompressed, + data_block); +@@ -1660,8 +1613,7 @@ + pthread_mutex_unlock(&fragment_mutex); + + if(SQUASHFS_COMPRESSED_BLOCK(disk_fragment->size)) { +- int res; +- unsigned long bytes = block_size; ++ int error, res; + char *data; + + if(compressed_buffer) +@@ -1669,19 +1621,11 @@ else data = read_from_disk(start_block, size); - res = uncompress((unsigned char *) buffer->data, &bytes, -+ res = uncompress_wrapper((unsigned char *) buffer->data, &bytes, - (const unsigned char *) data, size); - if(res != Z_OK) { - if(res == Z_MEM_ERROR) +- (const unsigned char *) data, size); +- if(res != Z_OK) { +- if(res == Z_MEM_ERROR) - BAD_ERROR("zlib::uncompress failed, not enough " -+ BAD_ERROR("uncompress failed, not enough " - "memory\n"); - else if(res == Z_BUF_ERROR) +- "memory\n"); +- else if(res == Z_BUF_ERROR) - BAD_ERROR("zlib::uncompress failed, not enough " -+ BAD_ERROR("uncompress failed, not enough " - "room in output buffer\n"); - else +- "room in output buffer\n"); +- else - BAD_ERROR("zlib::uncompress failed," -+ BAD_ERROR("uncompress failed," - " unknown error %d\n", res); - } +- " unknown error %d\n", res); +- } ++ res = comp->uncompress(buffer->data, data, size, block_size, ++ &error); ++ if(res == -1) ++ BAD_ERROR("%s uncompress failed with error code %d\n", ++ comp->name, error); } else if(compressed_buffer) -@@ -4282,6 +4351,10 @@ + memcpy(buffer->data, compressed_buffer->data, size); + else +@@ -1733,9 +1677,7 @@ + entry->buffer->block = bytes; + bytes += compressed_size; + fragments_outstanding --; +- pthread_mutex_unlock(&fragment_mutex); + queue_put(to_writer, entry->buffer); +- pthread_mutex_lock(&fragment_mutex); + TRACE("fragment_locked writing fragment %d, compressed size %d" + "\n", entry->fragment, compressed_size); + free(entry); +@@ -1758,6 +1700,8 @@ + pthread_mutex_lock(&fragment_mutex); + insert_fragment_list(&frag_locked_list, entry); + pthread_mutex_unlock(&fragment_mutex); ++ ++ return TRUE; + } + + +@@ -1824,7 +1768,9 @@ + unsigned short c_byte; + char cbuffer[(SQUASHFS_METADATA_SIZE << 2) + 2]; + ++#ifdef SQUASHFS_TRACE + long long obytes = bytes; ++#endif + + for(i = 0; i < meta_blocks; i++) { + int avail_bytes = length > SQUASHFS_METADATA_SIZE ? +@@ -2170,11 +2116,85 @@ + } + + ++static int seq = 0; ++void reader_read_process(struct dir_ent *dir_ent) ++{ ++ struct file_buffer *prev_buffer = NULL, *file_buffer; ++ int status, res, byte, count = 0; ++ int file = get_pseudo_file(dir_ent->inode->pseudo_id)->fd; ++ int child = get_pseudo_file(dir_ent->inode->pseudo_id)->child; ++ long long bytes = 0; ++ ++ while(1) { ++ file_buffer = cache_get(reader_buffer, 0, 0); ++ file_buffer->sequence = seq ++; ++ ++ byte = read_bytes(file, file_buffer->data, block_size); ++ if(byte == -1) ++ goto read_err; ++ ++ file_buffer->size = byte; ++ file_buffer->file_size = -1; ++ file_buffer->block = count ++; ++ file_buffer->error = FALSE; ++ file_buffer->fragment = FALSE; ++ bytes += byte; ++ ++ if(byte == 0) ++ break; ++ ++ /* ++ * Update estimated_uncompressed block count. This is done ++ * on every block rather than waiting for all blocks to be ++ * read incase write_file_process() is running in parallel ++ * with this. Otherwise cur uncompressed block count may ++ * get ahead of the total uncompressed block count. ++ */ ++ estimated_uncompressed ++; ++ ++ if(prev_buffer) ++ queue_put(from_reader, prev_buffer); ++ prev_buffer = file_buffer; ++ } ++ ++ /* ++ * Update inode file size now that the size of the dynamic pseudo file ++ * is known. This is needed for the -info option. ++ */ ++ dir_ent->inode->buf.st_size = bytes; ++ ++ res = waitpid(child, &status, 0); ++ if(res == -1 || !WIFEXITED(status) || WEXITSTATUS(status) != 0) ++ goto read_err; ++ ++ if(prev_buffer == NULL) ++ prev_buffer = file_buffer; ++ else { ++ cache_block_put(file_buffer); ++ seq --; ++ } ++ prev_buffer->file_size = bytes; ++ prev_buffer->fragment = !no_fragments && ++ (count == 2 || always_use_fragments) && (byte < block_size); ++ queue_put(from_reader, prev_buffer); ++ ++ return; ++ ++read_err: ++ if(prev_buffer) { ++ cache_block_put(file_buffer); ++ seq --; ++ file_buffer = prev_buffer; ++ } ++ file_buffer->error = TRUE; ++ queue_put(from_deflate, file_buffer); ++} ++ ++ + void reader_read_file(struct dir_ent *dir_ent) + { + struct stat *buf = &dir_ent->inode->buf, buf2; + struct file_buffer *file_buffer; +- static int index = 0; + int blocks, byte, count, expected, file, frag_block; + long long bytes, read_size; + +@@ -2202,7 +2222,7 @@ + if(file_buffer) + queue_put(from_reader, file_buffer); + file_buffer = cache_get(reader_buffer, 0, 0); +- file_buffer->sequence = index ++; ++ file_buffer->sequence = seq ++; + + byte = file_buffer->size = read_bytes(file, file_buffer->data, + block_size); +@@ -2238,7 +2258,7 @@ + + read_err: + file_buffer = cache_get(reader_buffer, 0, 0); +- file_buffer->sequence = index ++; ++ file_buffer->sequence = seq ++; + read_err2: + file_buffer->error = TRUE; + queue_put(from_deflate, file_buffer); +@@ -2262,9 +2282,14 @@ + for(i = 0; i < dir->count; i++) { + struct dir_ent *dir_ent = dir->list[i]; + struct stat *buf = &dir_ent->inode->buf; +- if(dir_ent->data) ++ if(dir_ent->inode->root_entry) + continue; + ++ if(dir_ent->inode->pseudo_file) { ++ reader_read_process(dir_ent); ++ continue; ++ } ++ + switch(buf->st_mode & S_IFMT) { + case S_IFREG: + reader_read_file(dir_ent); +@@ -2365,7 +2390,7 @@ + + void *deflator(void *arg) + { +- z_stream *stream = NULL; ++ void *stream = NULL; + int oldstate; + + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &oldstate); +@@ -2402,7 +2427,7 @@ + + void *frag_deflator(void *arg) + { +- z_stream *stream = NULL; ++ void *stream = NULL; + int oldstate; + + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &oldstate); +@@ -2426,8 +2451,8 @@ + write_buffer->block = bytes; + bytes += compressed_size; + fragments_outstanding --; +- pthread_mutex_unlock(&fragment_mutex); + queue_put(to_writer, write_buffer); ++ pthread_mutex_unlock(&fragment_mutex); + TRACE("Writing fragment %lld, uncompressed size %d, " + "compressed size %d\n", file_buffer->block, + file_buffer->size, compressed_size); +@@ -2674,6 +2699,98 @@ + } + + ++int write_file_process(squashfs_inode *inode, struct dir_ent *dir_ent, ++ struct file_buffer *read_buffer, int *duplicate_file) ++{ ++ long long read_size, file_bytes, start; ++ struct fragment *fragment; ++ unsigned int *block_list = NULL; ++ int block = 0, status; ++ long long sparse = 0; ++ struct file_buffer *fragment_buffer = NULL; ++ ++ *duplicate_file = FALSE; ++ ++ lock_fragments(); ++ ++ file_bytes = 0; ++ start = bytes; ++ while (1) { ++ read_size = read_buffer->file_size; ++ if(read_buffer->fragment && read_buffer->c_byte) ++ fragment_buffer = read_buffer; ++ else { ++ block_list = realloc(block_list, (block + 1) * ++ sizeof(unsigned int)); ++ if(block_list == NULL) ++ BAD_ERROR("Out of memory allocating block_list" ++ "\n"); ++ block_list[block ++] = read_buffer->c_byte; ++ if(read_buffer->c_byte) { ++ read_buffer->block = bytes; ++ bytes += read_buffer->size; ++ cache_rehash(read_buffer, read_buffer->block); ++ file_bytes += read_buffer->size; ++ queue_put(to_writer, read_buffer); ++ } else { ++ sparse += read_buffer->size; ++ cache_block_put(read_buffer); ++ } ++ } ++ inc_progress_bar(); ++ ++ if(read_size != -1) ++ break; ++ ++ read_buffer = get_file_buffer(from_deflate); ++ if(read_buffer->error) ++ goto read_err; ++ } ++ ++ unlock_fragments(); ++ fragment = get_and_fill_fragment(fragment_buffer); ++ cache_block_put(fragment_buffer); ++ ++ if(duplicate_checking) ++ add_non_dup(read_size, file_bytes, block_list, start, fragment, ++ 0, 0, FALSE); ++ file_count ++; ++ total_bytes += read_size; ++ ++ if(read_size < (1LL << 32) && start < (1LL << 32) && sparse == 0) ++ create_inode(inode, dir_ent, SQUASHFS_FILE_TYPE, read_size, ++ start, block, block_list, fragment, NULL, 0); ++ else ++ create_inode(inode, dir_ent, SQUASHFS_LREG_TYPE, read_size, ++ start, block, block_list, fragment, NULL, sparse); ++ ++ if(duplicate_checking == FALSE) ++ free(block_list); ++ ++ return 0; ++ ++read_err: ++ cur_uncompressed -= block; ++ status = read_buffer->error; ++ bytes = start; ++ if(!block_device) { ++ int res; ++ ++ queue_put(to_writer, NULL); ++ if(queue_get(from_writer) != 0) ++ EXIT_MKSQUASHFS(); ++ res = ftruncate(fd, bytes); ++ if(res != 0) ++ BAD_ERROR("Failed to truncate dest file because %s\n", ++ strerror(errno)); ++ } ++ unlock_fragments(); ++ free(block_list); ++ cache_block_put(read_buffer); ++ return status; ++} ++ ++ + int write_file_blocks(squashfs_inode *inode, struct dir_ent *dir_ent, + long long read_size, struct file_buffer *read_buffer, + int *duplicate_file) +@@ -2941,7 +3058,10 @@ + + read_size = read_buffer->file_size; + +- if(read_size == 0) { ++ if(read_size == -1) ++ status = write_file_process(inode, dir_ent, read_buffer, ++ duplicate_file); ++ else if(read_size == 0) { + write_file_empty(inode, dir_ent, duplicate_file); + cache_block_put(read_buffer); + } else if(read_buffer->fragment && read_buffer->c_byte) +@@ -3036,6 +3156,8 @@ + + memcpy(&inode->buf, buf, sizeof(struct stat)); + inode->read = FALSE; ++ inode->root_entry = FALSE; ++ inode->pseudo_file = FALSE; + inode->inode = SQUASHFS_INVALID_BLK; + inode->nlink = 1; + +@@ -3056,7 +3178,7 @@ + + + inline void add_dir_entry(char *name, char *pathname, struct dir_info *sub_dir, +- struct inode_info *inode_info, void *data, struct dir_info *dir) ++ struct inode_info *inode_info, struct dir_info *dir) + { + if((dir->count % DIR_ENTRIES) == 0) { + dir->list = realloc(dir->list, (dir->count + DIR_ENTRIES) * +@@ -3075,8 +3197,7 @@ + NULL; + dir->list[dir->count]->inode = inode_info; + dir->list[dir->count]->dir = sub_dir; +- dir->list[dir->count]->our_dir = dir; +- dir->list[dir->count++]->data = data; ++ dir->list[dir->count++]->our_dir = dir; + dir->byte_count += strlen(name) + sizeof(squashfs_dir_entry); + } + +@@ -3128,10 +3249,10 @@ + + if(dir->count < old_root_entries) + for(i = 0; i < old_root_entries; i++) { +- if(old_root_entry[i].type == SQUASHFS_DIR_TYPE) ++ if(old_root_entry[i].inode.type == SQUASHFS_DIR_TYPE) + dir->directory_count ++; +- add_dir_entry(old_root_entry[i].name, "", NULL, NULL, +- &old_root_entry[i], dir); ++ add_dir_entry(old_root_entry[i].name, "", NULL, ++ &old_root_entry[i].inode, dir); + } + + while(index < source) { +@@ -3167,10 +3288,10 @@ + + if(dir->count < old_root_entries) + for(i = 0; i < old_root_entries; i++) { +- if(old_root_entry[i].type == SQUASHFS_DIR_TYPE) ++ if(old_root_entry[i].inode.type == SQUASHFS_DIR_TYPE) + dir->directory_count ++; +- add_dir_entry(old_root_entry[i].name, "", NULL, NULL, +- &old_root_entry[i], dir); ++ add_dir_entry(old_root_entry[i].name, "", NULL, ++ &old_root_entry[i].inode, dir); + } + + if((d_name = readdir(dir->linuxdir)) != NULL) { +@@ -3215,7 +3336,7 @@ + int current_count; + + while((current_count = dir_info->current_count++) < dir_info->count) +- if(dir_info->list[current_count]->data) ++ if(dir_info->list[current_count]->inode->root_entry) + continue; + else + return dir_info->list[current_count]; +@@ -3240,11 +3361,11 @@ + int current_count; + + while((current_count = dir_info->current_count++) < dir_info->count) +- if(dir_info->list[current_count]->data) +- add_dir(dir_info->list[current_count]->data->inode, +- dir_info->list[current_count]->data->inode_number, ++ if(dir_info->list[current_count]->inode->root_entry) ++ add_dir(dir_info->list[current_count]->inode->inode, ++ dir_info->list[current_count]->inode->inode_number, + dir_info->list[current_count]->name, +- dir_info->list[current_count]->data->type, dir); ++ dir_info->list[current_count]->inode->type, dir); + else + return dir_info->list[current_count]; + return NULL; +@@ -3313,7 +3434,6 @@ + dir_ent->name = dir_ent->pathname = strdup(pathname); + dir_ent->dir = dir_info; + dir_ent->our_dir = NULL; +- dir_ent->data = NULL; + dir_info->dir_ent = dir_ent; + + if(sorted) +@@ -3383,7 +3503,7 @@ + sub_dir = NULL; + + add_dir_entry(dir_name, filename, sub_dir, lookup_inode(&buf), +- NULL, dir); ++ dir); + } + + scan1_freedir(dir); +@@ -3399,7 +3519,7 @@ + struct dir_ent *dir_ent; + struct pseudo_entry *pseudo_ent; + struct stat buf; +- static pseudo_ino = 1; ++ static int pseudo_ino = 1; + + if(dir == NULL && (dir = scan1_opendir("")) == NULL) + return NULL; +@@ -3415,6 +3535,29 @@ + + while((pseudo_ent = pseudo_readdir(pseudo)) != NULL) { + dir_ent = scan2_lookup(dir, pseudo_ent->name); ++ if(pseudo_ent->dev->type == 's') { ++ struct stat *buf; ++ if(dir_ent == NULL) { ++ ERROR("Pseudo set file \"%s\" does not exist " ++ "in source filesystem. Ignoring\n", ++ pseudo_ent->pathname); ++ continue; ++ } ++ if(dir_ent->inode->root_entry) { ++ ERROR("Pseudo set file \"%s\" is a pre-existing" ++ " file in the filesystem being appended" ++ " to. It cannot be modified. " ++ "Ignoring!\n", pseudo_ent->pathname); ++ continue; ++ } ++ buf = &dir_ent->inode->buf; ++ buf->st_mode = (buf->st_mode & S_IFMT) | ++ pseudo_ent->dev->mode; ++ buf->st_uid = pseudo_ent->dev->uid; ++ buf->st_gid = pseudo_ent->dev->gid; ++ continue; ++ } ++ + if(dir_ent) { + ERROR("Pseudo file \"%s\" exists in source filesystem " + "\"%s\"\n", pseudo_ent->pathname, +@@ -3444,8 +3587,29 @@ + buf.st_mtime = time(NULL); + buf.st_ino = pseudo_ino ++; + +- add_dir_entry(pseudo_ent->name, pseudo_ent->pathname, sub_dir, +- lookup_inode(&buf), NULL, dir); ++ if(pseudo_ent->dev->type == 'f') { ++#ifdef USE_TMP_FILE ++ struct stat buf2; ++ int res = stat(pseudo_ent->dev->filename, &buf2); ++ if(res == -1) { ++ ERROR("Stat on pseudo file \"%s\" failed, " ++ "skipping...", pseudo_ent->pathname); ++ continue; ++ } ++ buf.st_size = buf2.st_size; ++ add_dir_entry(pseudo_ent->name, ++ pseudo_ent->dev->filename, sub_dir, ++ lookup_inode(&buf), dir); ++#else ++ struct inode_info *inode = lookup_inode(&buf); ++ inode->pseudo_id = pseudo_ent->dev->pseudo_id; ++ inode->pseudo_file = TRUE; ++ add_dir_entry(pseudo_ent->name, pseudo_ent->pathname, ++ sub_dir, inode, dir); ++#endif ++ } else ++ add_dir_entry(pseudo_ent->name, pseudo_ent->pathname, ++ sub_dir, lookup_inode(&buf), dir); + } + + scan2_freedir(dir); +@@ -3482,8 +3646,9 @@ + &duplicate_file); + INFO("file %s, uncompressed size %lld " + "bytes %s\n", filename, +- buf->st_size, duplicate_file ? +- "DUPLICATE" : ""); ++ (long long) buf->st_size, ++ duplicate_file ? "DUPLICATE" : ++ ""); + break; + + case S_IFDIR: +@@ -3557,6 +3722,7 @@ + INFO("file %s, uncompressed " + "size %lld bytes LINK" + "\n", filename, ++ (long long) + buf->st_size); + break; + case SQUASHFS_SYMLINK_TYPE: +@@ -3667,10 +3833,11 @@ + BAD_ERROR("Out of memory in old root directory entries " + "reallocation\n"); + +- strcpy(old_root_entry[old_root_entries].name, name); +- old_root_entry[old_root_entries].inode = inode; +- old_root_entry[old_root_entries].inode_number = inode_number; +- old_root_entry[old_root_entries++].type = type; ++ old_root_entry[old_root_entries].name = strdup(name); ++ old_root_entry[old_root_entries].inode.inode = inode; ++ old_root_entry[old_root_entries].inode.inode_number = inode_number; ++ old_root_entry[old_root_entries].inode.type = type; ++ old_root_entry[old_root_entries++].inode.root_entry = TRUE; + } + + +@@ -4137,7 +4304,7 @@ + + + #define VERSION() \ +- printf("mksquashfs version 4.0 (2009/04/05)\n");\ ++ printf("mksquashfs version 4.1-CVS (2009/09/20)\n");\ + printf("copyright (C) 2009 Phillip Lougher \n\n"); \ + printf("This program is free software; you can redistribute it and/or\n");\ + printf("modify it under the terms of the GNU General Public License\n");\ +@@ -4172,26 +4339,28 @@ + source_path = argv + 1; + source = i - 2; + for(; i < argc; i++) { +- if(strcmp(argv[i], "-pf") == 0) { ++ if(strcmp(argv[i], "-comp") == 0) { + if(++i == argc) { +- ERROR("%s: -pf missing filename\n", argv[0]); ++ ERROR("%s: -comp missing compression type\n", ++ argv[0]); + exit(1); + } +- if(read_pseudo_file(&pseudo, argv[i]) == FALSE) { +- ERROR("Failed to parse pseudo file \"%s\"\n", +- argv[i]); ++ comp_name = argv[i]; ++ } else if(strcmp(argv[i], "-pf") == 0) { ++ if(++i == argc) { ++ ERROR("%s: -pf missing filename\n", argv[0]); + exit(1); + } ++ if(read_pseudo_file(&pseudo, argv[i]) == FALSE) ++ exit(1); + } else if(strcmp(argv[i], "-p") == 0) { + if(++i == argc) { + ERROR("%s: -p missing pseudo file definition\n", argv[0]); exit(1); } -+#ifdef USE_LZMA -+ } else if(strcmp(argv[i], "-lzma") == 0) { -+ compression = LZMA_COMPRESSION; -+#endif - } else if(strcmp(argv[i], "-ef") == 0) { +- if(read_pseudo_def(&pseudo, argv[i]) == FALSE) { +- ERROR("Failed to parse pseudo definition\n"); ++ if(read_pseudo_def(&pseudo, argv[i]) == FALSE) + exit(1); +- } + } else if(strcmp(argv[i], "-recover") == 0) { if(++i == argc) { - ERROR("%s: -ef missing filename\n", argv[0]); -@@ -4410,6 +4483,9 @@ + ERROR("%s: -recover missing recovery file\n", +@@ -4394,34 +4563,16 @@ + printOptions: + ERROR("SYNTAX:%s source1 source2 ... dest [options] " + "[-e list of exclude\ndirs/files]\n", argv[0]); +- ERROR("\nOptions are\n"); +- ERROR("-version\t\tprint version, licence and " +- "copyright message\n"); +- ERROR("-recover \t\trecover filesystem data " +- "using recovery file \n"); +- ERROR("-no-recovery\t\tdon't generate a recovery " +- "file\n"); +- ERROR("-info\t\t\tprint files written to filesystem\n"); +- ERROR("-no-exports\t\tdon't make the filesystem " +- "exportable via NFS\n"); +- ERROR("-no-progress\t\tdon't display the progress " +- "bar\n"); +- ERROR("-no-sparse\t\tdon't detect sparse files\n"); ++ ERROR("\nFilesystem build options:\n"); ++ ERROR("-comp \t\tselect compression\n"); ++ ERROR("\t\t\tCompressors available:\n"); ++ display_compressors("\t\t\t", COMP_DEFAULT); ERROR("-b \t\tset data block to " ". Default %d bytes\n", SQUASHFS_FILE_SIZE); -+#ifdef USE_LZMA -+ ERROR("-lzma Enable LZMA compression\n"); -+#endif - ERROR("-processors \tUse processors." - " By default will use number of\n"); - ERROR("\t\t\tprocessors available\n"); -@@ -4804,7 +4880,7 @@ +- ERROR("-processors \tUse processors." +- " By default will use number of\n"); +- ERROR("\t\t\tprocessors available\n"); +- ERROR("-read-queue \tSet input queue to " +- "Mbytes. Default %d Mbytes\n", +- READER_BUFFER_DEFAULT); +- ERROR("-write-queue \tSet output queue to " +- "Mbytes. Default %d Mbytes\n", +- WRITER_BUFFER_DEFAULT); +- ERROR("-fragment-queue \tSet fagment queue to " +- " Mbytes. Default %d Mbytes\n", +- FRAGMENT_BUFFER_DEFAULT); ++ ERROR("-no-exports\t\tdon't make the filesystem " ++ "exportable via NFS\n"); ++ ERROR("-no-sparse\t\tdon't detect sparse files\n"); + ERROR("-noI\t\t\tdo not compress inode table\n"); + ERROR("-noD\t\t\tdo not compress data blocks\n"); + ERROR("-noF\t\t\tdo not compress fragment blocks\n"); +@@ -4430,13 +4581,34 @@ + "files larger than block size\n"); + ERROR("-no-duplicates\t\tdo not perform duplicate " + "checking\n"); +- ERROR("-noappend\t\tdo not append to existing " +- "filesystem\n"); ++ ERROR("-all-root\t\tmake all files owned by root\n"); ++ ERROR("-force-uid uid\t\tset all file uids to uid\n"); ++ ERROR("-force-gid gid\t\tset all file gids to gid\n"); ++ ERROR("-nopad\t\t\tdo not pad filesystem to a multiple " ++ "of 4K\n"); + ERROR("-keep-as-directory\tif one source directory is " + "specified, create a root\n"); + ERROR("\t\t\tdirectory containing that directory, " + "rather than the\n"); + ERROR("\t\t\tcontents of the directory\n"); ++ ERROR("\nFilesystem filter options:\n"); ++ ERROR("-p \tAdd pseudo file definition\n"); ++ ERROR("-pf \tAdd list of pseudo file definitions\n"); ++ ERROR("-sort \tsort files according to " ++ "priorities in . One\n"); ++ ERROR("\t\t\tfile or dir with priority per line. " ++ "Priority -32768 to\n"); ++ ERROR("\t\t\t32767, default priority 0\n"); ++ ERROR("-ef \tlist of exclude dirs/files." ++ " One per line\n"); ++ ERROR("-wildcards\t\tAllow extended shell wildcards " ++ "(globbing) to be used in\n\t\t\texclude " ++ "dirs/files\n"); ++ ERROR("-regex\t\t\tAllow POSIX regular expressions to " ++ "be used in exclude\n\t\t\tdirs/files\n"); ++ ERROR("\nFilesystem append options:\n"); ++ ERROR("-noappend\t\tdo not append to existing " ++ "filesystem\n"); + ERROR("-root-becomes \twhen appending source " + "files/directories, make the\n"); + ERROR("\t\t\toriginal root become a subdirectory in " +@@ -4444,11 +4616,29 @@ + ERROR("\t\t\tcalled , rather than adding the new " + "source items\n"); + ERROR("\t\t\tto the original root\n"); +- ERROR("-all-root\t\tmake all files owned by root\n"); +- ERROR("-force-uid uid\t\tset all file uids to uid\n"); +- ERROR("-force-gid gid\t\tset all file gids to gid\n"); +- ERROR("-nopad\t\t\tdo not pad filesystem to a multiple " +- "of 4K\n"); ++ ERROR("\nMksquashfs runtime options:\n"); ++ ERROR("-version\t\tprint version, licence and " ++ "copyright message\n"); ++ ERROR("-recover \t\trecover filesystem data " ++ "using recovery file \n"); ++ ERROR("-no-recovery\t\tdon't generate a recovery " ++ "file\n"); ++ ERROR("-info\t\t\tprint files written to filesystem\n"); ++ ERROR("-no-progress\t\tdon't display the progress " ++ "bar\n"); ++ ERROR("-processors \tUse processors." ++ " By default will use number of\n"); ++ ERROR("\t\t\tprocessors available\n"); ++ ERROR("-read-queue \tSet input queue to " ++ "Mbytes. Default %d Mbytes\n", ++ READER_BUFFER_DEFAULT); ++ ERROR("-write-queue \tSet output queue to " ++ "Mbytes. Default %d Mbytes\n", ++ WRITER_BUFFER_DEFAULT); ++ ERROR("-fragment-queue \tSet fagment queue to " ++ " Mbytes. Default %d Mbytes\n", ++ FRAGMENT_BUFFER_DEFAULT); ++ ERROR("\nMiscellaneous options:\n"); + ERROR("-root-owned\t\talternative name for -all-root" + "\n"); + ERROR("-noInodeCompression\talternative name for -noI" +@@ -4457,20 +4647,6 @@ + "\n"); + ERROR("-noFragmentCompression\talternative name for " + "-noF\n"); +- ERROR("-sort \tsort files according to " +- "priorities in . One\n"); +- ERROR("\t\t\tfile or dir with priority per line. " +- "Priority -32768 to\n"); +- ERROR("\t\t\t32767, default priority 0\n"); +- ERROR("-ef \tlist of exclude dirs/files." +- " One per line\n"); +- ERROR("-wildcards\t\tAllow extended shell wildcards " +- "(globbing) to be used in\n\t\t\texclude " +- "dirs/files\n"); +- ERROR("-regex\t\t\tAllow POSIX regular expressions to " +- "be used in exclude\n\t\t\tdirs/files\n"); +- ERROR("-p \tAdd pseudo file definition\n"); +- ERROR("-pf \tAdd list of pseudo file definitions\n"); + exit(1); + } + } +@@ -4548,11 +4724,10 @@ + fclose(fd); + } else if(strcmp(argv[i], "-e") == 0) + break; +- else if(strcmp(argv[i], "-b") == 0 || +- strcmp(argv[i], "-root-becomes") == 0 || ++ else if(strcmp(argv[i], "-root-becomes") == 0 || + strcmp(argv[i], "-sort") == 0 || + strcmp(argv[i], "-pf") == 0 || +- strcmp(argv[i], "-p") == 0) ++ strcmp(argv[i], "-comp") == 0) + i++; + + if(i != argc) { +@@ -4574,11 +4749,10 @@ + sorted ++; + } else if(strcmp(argv[i], "-e") == 0) + break; +- else if(strcmp(argv[i], "-b") == 0 || +- strcmp(argv[i], "-root-becomes") == 0 || ++ else if(strcmp(argv[i], "-root-becomes") == 0 || + strcmp(argv[i], "-ef") == 0 || + strcmp(argv[i], "-pf") == 0 || +- strcmp(argv[i], "-p") == 0) ++ strcmp(argv[i], "-comp") == 0) + i++; + + #ifdef SQUASHFS_TRACE +@@ -4586,7 +4760,8 @@ + #endif + + if(!delete) { +- if(read_super(fd, &sBlk, argv[source + 1]) == 0) { ++ comp = read_super(fd, &sBlk, argv[source + 1]); ++ if(comp == NULL) { + ERROR("Failed to read existing filesystem - will not " + "overwrite - ABORTING!\n"); + ERROR("To force Mksquashfs to write to this block " +@@ -4603,6 +4778,15 @@ + always_use_fragments = SQUASHFS_ALWAYS_FRAGMENTS(sBlk.flags); + duplicate_checking = SQUASHFS_DUPLICATES(sBlk.flags); + exportable = SQUASHFS_EXPORTABLE(sBlk.flags); ++ } else { ++ comp = lookup_compressor(comp_name); ++ if(!comp->supported) { ++ ERROR("FATAL_ERROR: Compressor \"%s\" is not " ++ "supported!\n", comp_name); ++ ERROR("Compressors available:\n"); ++ display_compressors("", COMP_DEFAULT); ++ EXIT_MKSQUASHFS(); ++ } + } + + initialise_threads(); +@@ -4648,8 +4832,8 @@ + "size %d\n", SQUASHFS_MAJOR, s_minor, argv[source + 1], + block_size); + printf("All -b, -noI, -noD, -noF, no-duplicates, no-fragments, " +- "-always-use-fragments and -exportable options ignored" +- "\n"); ++ "-always-use-fragments,\n-exportable and -comp options " ++ "ignored\n"); + printf("\nIf appending is not wanted, please re-run with " + "-noappend specified!\n\n"); + +@@ -4803,8 +4987,7 @@ + sBlk.bytes_used = bytes; - /* Only compression supported */ +- /* Only compression supported */ - sBlk.compression = ZLIB_COMPRESSION; -+ sBlk.compression = compression; ++ sBlk.compression = comp->id; /* Xattrs are not currently supported */ sBlk.xattr_table_start = SQUASHFS_INVALID_BLK; -Index: squashfs4.0/squashfs-tools/squashfs_fs.h -=================================================================== ---- squashfs4.0.orig/squashfs-tools/squashfs_fs.h 2009-03-18 03:50:20.000000000 +0100 -+++ squashfs4.0/squashfs-tools/squashfs_fs.h 2009-09-14 17:20:36.310480350 +0200 +@@ -4820,6 +5003,8 @@ + + close(fd); + ++ delete_pseudo_files(); ++ + if(recovery_file[0] != '\0') + unlink(recovery_file); + +@@ -4827,9 +5012,9 @@ + * sizeof(unsigned short) + guid_count * sizeof(unsigned short) + + sizeof(squashfs_super_block); + +- printf("\n%sSquashfs %d.%d filesystem, data block size %d\n", +- exportable ? "Exportable " : "", SQUASHFS_MAJOR, SQUASHFS_MINOR, +- block_size); ++ printf("\n%sSquashfs %d.%d filesystem, %s compressed, data block size" ++ " %d\n", exportable ? "Exportable " : "", SQUASHFS_MAJOR, ++ SQUASHFS_MINOR, comp->name, block_size); + printf("\t%s data, %s metadata, %s fragments\n", + noD ? "uncompressed" : "compressed", noI ? "uncompressed" : + "compressed", no_fragments ? "no" : noF ? "uncompressed" : +diff -Nur squashfs4.0/squashfs-tools/pseudo.c squashfs4.0-lzma-snapshot/squashfs-tools/pseudo.c +--- squashfs4.0/squashfs-tools/pseudo.c 2009-04-05 04:01:58.000000000 +0200 ++++ squashfs4.0-lzma-snapshot/squashfs-tools/pseudo.c 2009-10-20 06:03:38.000000000 +0200 +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + + #include "pseudo.h" + +@@ -55,6 +56,9 @@ + #define TRUE 1 + #define FALSE 0 + ++struct pseudo_dev **pseudo_file = NULL; ++int pseudo_count = 0; ++ + static void dump_pseudo(struct pseudo *pseudo, char *string) + { + int i; +@@ -99,7 +103,7 @@ + char *target, char *alltarget) + { + char targname[1024]; +- int i, error; ++ int i; + + target = get_component(target, targname); + +@@ -128,12 +132,8 @@ + if(target[0] == '\0') { + /* at leaf pathname component */ + pseudo->name[i].pseudo = NULL; +- pseudo->name[i].dev = malloc(sizeof(struct pseudo_dev)); +- if(pseudo->name[i].dev == NULL) +- BAD_ERROR("failed to allocate pseudo file\n"); + pseudo->name[i].pathname = strdup(alltarget); +- memcpy(pseudo->name[i].dev, pseudo_dev, +- sizeof(struct pseudo_dev)); ++ pseudo->name[i].dev = pseudo_dev; + } else { + /* recurse adding child components */ + pseudo->name[i].dev = NULL; +@@ -169,15 +169,9 @@ + if(target[0] == '\0') { + if(pseudo->name[i].dev == NULL && + pseudo_dev->type == 'd') { +- pseudo->name[i].dev = +- malloc(sizeof(struct pseudo_dev)); +- if(pseudo->name[i].dev == NULL) +- BAD_ERROR("failed to allocate " +- "pseudo file\n"); + pseudo->name[i].pathname = + strdup(alltarget); +- memcpy(pseudo->name[i].dev, pseudo_dev, +- sizeof(struct pseudo_dev)); ++ pseudo->name[i].dev = pseudo_dev; + } else + ERROR("%s already exists as a " + "directory. Ignoring %s!\n", +@@ -229,16 +223,113 @@ + } + + ++int exec_file(char *command, struct pseudo_dev *dev) ++{ ++ int child, res; ++ static pid_t pid = -1; ++ int pipefd[2]; ++#ifdef USE_TMP_FILE ++ char filename[1024]; ++ int status; ++ static int number = 0; ++#endif ++ ++ if(pid == -1) ++ pid = getpid(); ++ ++#ifdef USE_TMP_FILE ++ sprintf(filename, "/tmp/squashfs_pseudo_%d_%d", pid, number ++); ++ pipefd[1] = open(filename, O_CREAT | O_TRUNC | O_RDWR, S_IRWXU); ++ if(pipefd[1] == -1) { ++ printf("open failed\n"); ++ return -1; ++ } ++#else ++ res = pipe(pipefd); ++ if(res == -1) { ++ printf("pipe failed\n"); ++ return -1; ++ } ++#endif ++ ++ child = fork(); ++ if(child == -1) { ++ printf("fork failed\n"); ++ goto failed; ++ } ++ ++ if(child == 0) { ++ close(STDOUT_FILENO); ++ res = dup(pipefd[1]); ++ if(res == -1) { ++ printf("dup failed\n"); ++ exit(EXIT_FAILURE); ++ } ++ execl("/bin/sh", "sh", "-c", command, (char *) NULL); ++ printf("execl failed\n"); ++ exit(EXIT_FAILURE); ++ } ++ ++#ifdef USE_TMP_FILE ++ res = waitpid(child, &status, 0); ++ close(pipefd[1]); ++ if(res != -1 && WIFEXITED(status) && WEXITSTATUS(status) == 0) { ++ dev->filename = strdup(filename); ++ return 0; ++ } ++failed: ++ unlink(filename); ++ return -1; ++#else ++ close(pipefd[1]); ++ dev->fd = pipefd[0]; ++ dev->child = child; ++ return 0; ++failed: ++ return -1; ++#endif ++} ++ ++ ++void add_pseudo_file(struct pseudo_dev *dev) ++{ ++ pseudo_file = realloc(pseudo_file, (pseudo_count + 1) * ++ sizeof(struct pseudo_dev *)); ++ if(pseudo_file == NULL) ++ BAD_ERROR("Failed to realloc pseudo_file\n"); ++ ++ dev->pseudo_id = pseudo_count; ++ pseudo_file[pseudo_count ++] = dev; ++} ++ ++ ++void delete_pseudo_files() ++{ ++#ifdef USE_TMP_FILE ++ int i; ++ ++ for(i = 0; i < pseudo_count; i++) ++ unlink(pseudo_file[i]->filename); ++#endif ++} ++ ++ ++struct pseudo_dev *get_pseudo_file(int pseudo_id) ++{ ++ return pseudo_file[pseudo_id]; ++} ++ ++ + int read_pseudo_def(struct pseudo **pseudo, char *def) + { +- int n; ++ int n, bytes; + unsigned int major = 0, minor = 0, mode; + char filename[2048], type, suid[100], sgid[100], *ptr; + long long uid, gid; +- struct pseudo_dev dev; ++ struct pseudo_dev *dev; + +- n = sscanf(def, "%s %c %o %s %s %u %u", filename, &type, &mode, suid, sgid, +- &major, &minor); ++ n = sscanf(def, "%s %c %o %s %s %n", filename, &type, &mode, suid, ++ sgid, &bytes); + + if(n < 5) { + ERROR("Not enough or invalid arguments in pseudo file " +@@ -249,7 +340,9 @@ + switch(type) { + case 'b': + case 'c': +- if(n < 7) { ++ n = sscanf(def + bytes, "%u %u", &major, &minor); ++ ++ if(n < 2) { + ERROR("Not enough or invalid arguments in pseudo file " + "definition\n"); + goto error; +@@ -265,47 +358,15 @@ + goto error; + } + +- /* fall through */ +- case 'd': +- if(mode > 0777) { +- ERROR("Mode %o out of range\n", mode); ++ case 'f': ++ if(def[bytes] == '\0') { ++ ERROR("Not enough arguments in pseudo file " ++ "definition\n"); + goto error; +- } +- +- uid = strtoll(suid, &ptr, 10); +- if(*ptr == '\0') { +- if(uid < 0 || uid > ((1LL << 32) - 1)) { +- ERROR("Uid %s out of range\n", suid); +- goto error; +- } +- } else { +- struct passwd *pwuid = getpwnam(suid); +- if(pwuid) +- uid = pwuid->pw_uid; +- else { +- ERROR("Uid %s invalid uid or unknown user\n", +- suid); +- goto error; +- } +- } +- +- gid = strtoll(sgid, &ptr, 10); +- if(*ptr == '\0') { +- if(gid < 0 || gid > ((1LL << 32) - 1)) { +- ERROR("Gid %s out of range\n", sgid); +- goto error; +- } +- } else { +- struct group *grgid = getgrnam(sgid); +- if(grgid) +- gid = grgid->gr_gid; +- else { +- ERROR("Gid %s invalid uid or unknown user\n", +- sgid); +- goto error; +- } +- } +- ++ } ++ break; ++ case 'd': ++ case 'm': + break; + default: + ERROR("Unsupported type %c\n", type); +@@ -313,6 +374,43 @@ + } + + ++ if(mode > 0777) { ++ ERROR("Mode %o out of range\n", mode); ++ goto error; ++ } ++ ++ uid = strtoll(suid, &ptr, 10); ++ if(*ptr == '\0') { ++ if(uid < 0 || uid > ((1LL << 32) - 1)) { ++ ERROR("Uid %s out of range\n", suid); ++ goto error; ++ } ++ } else { ++ struct passwd *pwuid = getpwnam(suid); ++ if(pwuid) ++ uid = pwuid->pw_uid; ++ else { ++ ERROR("Uid %s invalid uid or unknown user\n", suid); ++ goto error; ++ } ++ } ++ ++ gid = strtoll(sgid, &ptr, 10); ++ if(*ptr == '\0') { ++ if(gid < 0 || gid > ((1LL << 32) - 1)) { ++ ERROR("Gid %s out of range\n", sgid); ++ goto error; ++ } ++ } else { ++ struct group *grgid = getgrnam(sgid); ++ if(grgid) ++ gid = grgid->gr_gid; ++ else { ++ ERROR("Gid %s invalid uid or unknown user\n", sgid); ++ goto error; ++ } ++ } ++ + switch(type) { + case 'b': + mode |= S_IFBLK; +@@ -323,16 +421,37 @@ + case 'd': + mode |= S_IFDIR; + break; ++ case 'f': ++ mode |= S_IFREG; ++ break; + } + +- dev.type = type; +- dev.mode = mode; +- dev.uid = uid; +- dev.gid = gid; +- dev.major = major; +- dev.minor = minor; ++ dev = malloc(sizeof(struct pseudo_dev)); ++ if(dev == NULL) ++ BAD_ERROR("Failed to create pseudo_dev\n"); ++ ++ dev->type = type; ++ dev->mode = mode; ++ dev->uid = uid; ++ dev->gid = gid; ++ dev->major = major; ++ dev->minor = minor; ++ ++ if(type == 'f') { ++ int res; ++ ++ printf("Executing dynamic pseudo file\n"); ++ printf("\t\"%s\"\n", def); ++ res = exec_file(def + bytes, dev); ++ if(res == -1) { ++ ERROR("Failed to execute dynamic pseudo file definition" ++ " \"%s\"\n", def); ++ return FALSE; ++ } ++ add_pseudo_file(dev); ++ } + +- *pseudo = add_pseudo(*pseudo, &dev, filename, filename); ++ *pseudo = add_pseudo(*pseudo, dev, filename, filename); + + return TRUE; + +diff -Nur squashfs4.0/squashfs-tools/pseudo.h squashfs4.0-lzma-snapshot/squashfs-tools/pseudo.h +--- squashfs4.0/squashfs-tools/pseudo.h 2009-04-04 03:44:24.000000000 +0200 ++++ squashfs4.0-lzma-snapshot/squashfs-tools/pseudo.h 2009-10-20 06:03:38.000000000 +0200 +@@ -27,6 +27,12 @@ + unsigned int gid; + unsigned int major; + unsigned int minor; ++ int pseudo_id; ++ int fd; ++ int child; ++#ifdef USE_TMP_FILE ++ char *filename; ++#endif + }; + + struct pseudo_entry { +@@ -46,3 +52,5 @@ + extern int read_pseudo_file(struct pseudo **, char *); + extern struct pseudo *pseudo_subdir(char *, struct pseudo *); + extern struct pseudo_entry *pseudo_readdir(struct pseudo *); ++extern struct pseudo_dev *get_pseudo_file(int); ++extern void delete_pseudo_files(); +diff -Nur squashfs4.0/squashfs-tools/read_fs.c squashfs4.0-lzma-snapshot/squashfs-tools/read_fs.c +--- squashfs4.0/squashfs-tools/read_fs.c 2009-03-31 06:23:14.000000000 +0200 ++++ squashfs4.0-lzma-snapshot/squashfs-tools/read_fs.c 2009-10-20 06:03:38.000000000 +0200 +@@ -36,7 +36,6 @@ + #include + #include + #include +-#include + #include + + #ifndef linux +@@ -51,6 +50,7 @@ + #include "squashfs_swap.h" + #include "read_fs.h" + #include "global.h" ++#include "compressor.h" + + #include + +@@ -66,7 +66,9 @@ + fprintf(stderr, s, ## args); \ + } while(0) + +-int read_block(int fd, long long start, long long *next, unsigned char *block, ++static struct compressor *comp; ++ ++int read_block(int fd, long long start, long long *next, void *block, + squashfs_super_block *sBlk) + { + unsigned short c_byte; +@@ -77,32 +79,24 @@ + + if(SQUASHFS_COMPRESSED(c_byte)) { + char buffer[SQUASHFS_METADATA_SIZE]; +- int res; +- unsigned long bytes = SQUASHFS_METADATA_SIZE; ++ int error, res; + + c_byte = SQUASHFS_COMPRESSED_SIZE(c_byte); + read_destination(fd, start + offset, c_byte, buffer); + +- res = uncompress(block, &bytes, (const unsigned char *) buffer, +- c_byte); +- if(res != Z_OK) { +- if(res == Z_MEM_ERROR) +- ERROR("zlib::uncompress failed, not enough " +- "memory\n"); +- else if(res == Z_BUF_ERROR) +- ERROR("zlib::uncompress failed, not enough " +- "room in output buffer\n"); +- else +- ERROR("zlib::uncompress failed, unknown error " +- "%d\n", res); ++ res = comp->uncompress(block, buffer, c_byte, ++ SQUASHFS_METADATA_SIZE, &error); ++ if(res == -1) { ++ ERROR("%s uncompress failed with error code %d\n", ++ comp->name, error); + return 0; + } + if(next) + *next = start + offset + c_byte; +- return bytes; ++ return res; + } else { + c_byte = SQUASHFS_COMPRESSED_SIZE(c_byte); +- read_destination(fd, start + offset, c_byte, (char *) block); ++ read_destination(fd, start + offset, c_byte, block); + if(next) + *next = start + offset + c_byte; + return c_byte; +@@ -356,7 +350,7 @@ + } + + +-int read_super(int fd, squashfs_super_block *sBlk, char *source) ++struct compressor *read_super(int fd, squashfs_super_block *sBlk, char *source) + { + read_destination(fd, SQUASHFS_START, sizeof(squashfs_super_block), + (char *) sBlk); +@@ -388,8 +382,18 @@ + goto failed_mount; + } + ++ /* Check the compression type */ ++ comp = lookup_compressor_id(sBlk->compression); ++ if(!comp->supported) { ++ ERROR("Filesystem on %s uses %s compression, this is" ++ "unsupported by this version\n", source, comp->name); ++ display_compressors("", ""); ++ goto failed_mount; ++ } ++ + printf("Found a valid %sSQUASHFS superblock on %s.\n", + SQUASHFS_EXPORTABLE(sBlk->flags) ? "exportable " : "", source); ++ printf("\tCompression used %s\n", comp->name); + printf("\tInodes are %scompressed\n", + SQUASHFS_UNCOMPRESSED_INODES(sBlk->flags) ? "un" : ""); + printf("\tData is %scompressed\n", +@@ -417,10 +421,10 @@ + TRACE("sBlk->lookup_table_start %llx\n", sBlk->lookup_table_start); + printf("\n"); + +- return TRUE; ++ return comp; + + failed_mount: +- return FALSE; ++ return NULL; + } + + +@@ -514,12 +518,17 @@ + SQUASHFS_INSWAP_ID_BLOCKS(index, indexes); + + for(i = 0; i < indexes; i++) { +- int length; +- length = read_block(fd, index[i], NULL, ++ int length = read_block(fd, index[i], NULL, + ((unsigned char *) id_table) + + (i * SQUASHFS_METADATA_SIZE), sBlk); + TRACE("Read id table block %d, from 0x%llx, length %d\n", i, + index[i], length); ++ if(length == 0) { ++ ERROR("Failed to read id table block %d, from 0x%llx, " ++ "length %d\n", i, index[i], length); ++ free(id_table); ++ return NULL; ++ } + } + + SQUASHFS_INSWAP_INTS(id_table, sBlk->no_ids); +@@ -563,6 +572,13 @@ + (i * SQUASHFS_METADATA_SIZE), sBlk); + TRACE("Read fragment table block %d, from 0x%llx, length %d\n", + i, fragment_table_index[i], length); ++ if(length == 0) { ++ ERROR("Failed to read fragment table block %d, from " ++ "0x%llx, length %d\n", i, ++ fragment_table_index[i], length); ++ free(*fragment_table); ++ return 0; ++ } + } + + for(i = 0; i < sBlk->fragments; i++) +@@ -599,6 +615,13 @@ + (i * SQUASHFS_METADATA_SIZE), sBlk); + TRACE("Read inode lookup table block %d, from 0x%llx, length " + "%d\n", i, index[i], length); ++ if(length == 0) { ++ ERROR("Failed to read inode lookup table block %d, " ++ "from 0x%llx, length %d\n", i, index[i], ++ length); ++ free(*inode_lookup_table); ++ return 0; ++ } + } + + SQUASHFS_INSWAP_LONG_LONGS(*inode_lookup_table, sBlk->inodes); +diff -Nur squashfs4.0/squashfs-tools/sort.c squashfs4.0-lzma-snapshot/squashfs-tools/sort.c +--- squashfs4.0/squashfs-tools/sort.c 2009-03-31 06:25:53.000000000 +0200 ++++ squashfs4.0-lzma-snapshot/squashfs-tools/sort.c 2009-10-20 06:03:38.000000000 +0200 +@@ -198,7 +198,7 @@ + while(dir->current_count < dir->count) { + struct dir_ent *dir_ent = dir->list[dir->current_count++]; + struct stat *buf = &dir_ent->inode->buf; +- if(dir_ent->data) ++ if(dir_ent->inode->root_entry) + continue; + + switch(buf->st_mode & S_IFMT) { +@@ -254,6 +254,7 @@ + write_file(&inode, entry->dir, &duplicate_file); + INFO("file %s, uncompressed size %lld bytes %s" + "\n", entry->dir->pathname, ++ (long long) + entry->dir->inode->buf.st_size, + duplicate_file ? "DUPLICATE" : ""); + entry->dir->inode->inode = inode; +@@ -261,6 +262,7 @@ + } else + INFO("file %s, uncompressed size %lld bytes " + "LINK\n", entry->dir->pathname, ++ (long long) + entry->dir->inode->buf.st_size); + } + } +diff -Nur squashfs4.0/squashfs-tools/sort.h squashfs4.0-lzma-snapshot/squashfs-tools/sort.h +--- squashfs4.0/squashfs-tools/sort.h 2009-02-08 13:02:53.000000000 +0100 ++++ squashfs4.0-lzma-snapshot/squashfs-tools/sort.h 2009-10-20 06:03:38.000000000 +0200 +@@ -42,17 +42,19 @@ + struct inode_info *inode; + struct dir_info *dir; + struct dir_info *our_dir; +- struct old_root_entry_info *data; + }; + + struct inode_info { +- unsigned int nlink; + struct stat buf; ++ struct inode_info *next; + squashfs_inode inode; +- unsigned int type; + unsigned int inode_number; ++ unsigned int nlink; ++ int pseudo_id; ++ char type; + char read; +- struct inode_info *next; ++ char root_entry; ++ char pseudo_file; + }; + + struct priority_entry { +diff -Nur squashfs4.0/squashfs-tools/squashfs_compat.h squashfs4.0-lzma-snapshot/squashfs-tools/squashfs_compat.h +--- squashfs4.0/squashfs-tools/squashfs_compat.h 2009-03-16 05:27:27.000000000 +0100 ++++ squashfs4.0-lzma-snapshot/squashfs-tools/squashfs_compat.h 2009-10-20 06:03:38.000000000 +0200 +@@ -777,11 +777,10 @@ + #endif + + #define _SQUASHFS_SWAP(value, p, pos, tbits, SHIFT) {\ +- int bits;\ +- int b_pos = pos % 8;\ +- unsigned long long val = 0;\ +- unsigned char *s = (unsigned char *)p + (pos / 8);\ +- unsigned char *d = ((unsigned char *) &val) + 7;\ ++ b_pos = pos % 8;\ ++ val = 0;\ ++ s = (unsigned char *)p + (pos / 8);\ ++ d = ((unsigned char *) &val) + 7;\ + for(bits = 0; bits < (tbits + b_pos); bits += 8) \ + *d-- = *s++;\ + value = (val >> (SHIFT))/* & ((1 << tbits) - 1)*/;\ +diff -Nur squashfs4.0/squashfs-tools/squashfs_fs.h squashfs4.0-lzma-snapshot/squashfs-tools/squashfs_fs.h +--- squashfs4.0/squashfs-tools/squashfs_fs.h 2009-03-18 03:50:20.000000000 +0100 ++++ squashfs4.0-lzma-snapshot/squashfs-tools/squashfs_fs.h 2009-10-20 06:03:38.000000000 +0200 @@ -229,6 +229,7 @@ typedef long long squashfs_inode_t; @@ -156,307 +1955,274 @@ Index: squashfs4.0/squashfs-tools/squashfs_fs.h struct squashfs_super_block { unsigned int s_magic; -Index: squashfs4.0/squashfs-tools/Makefile -=================================================================== ---- squashfs4.0.orig/squashfs-tools/Makefile 2009-04-05 04:03:36.000000000 +0200 -+++ squashfs4.0/squashfs-tools/Makefile 2009-09-14 17:20:36.310480350 +0200 -@@ -4,14 +4,20 @@ +diff -Nur squashfs4.0/squashfs-tools/unsquash-3.c squashfs4.0-lzma-snapshot/squashfs-tools/unsquash-3.c +--- squashfs4.0/squashfs-tools/unsquash-3.c 2009-03-31 06:35:10.000000000 +0200 ++++ squashfs4.0-lzma-snapshot/squashfs-tools/unsquash-3.c 2009-10-20 06:03:38.000000000 +0200 +@@ -36,7 +36,7 @@ + sBlk.fragment_table_start); - CFLAGS := -I$(INCLUDEDIR) -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -O2 + if(sBlk.fragments == 0) +- return; ++ return TRUE; -+ifdef USE_LZMA -+ LZMA_CFLAGS = -DUSE_LZMA -+ LZMA_LIB = -llzma -+ CFLAGS += $(LZMA_CFLAGS) -+endif -+ - all: mksquashfs unsquashfs + if((fragment_table = malloc(sBlk.fragments * + sizeof(squashfs_fragment_entry_3))) == NULL) +diff -Nur squashfs4.0/squashfs-tools/unsquash-4.c squashfs4.0-lzma-snapshot/squashfs-tools/unsquash-4.c +--- squashfs4.0/squashfs-tools/unsquash-4.c 2009-03-31 06:38:31.000000000 +0200 ++++ squashfs4.0-lzma-snapshot/squashfs-tools/unsquash-4.c 2009-10-20 06:03:38.000000000 +0200 +@@ -38,7 +38,7 @@ + sBlk.fragment_table_start); --mksquashfs: mksquashfs.o read_fs.o sort.o swap.o pseudo.o -- $(CC) mksquashfs.o read_fs.o sort.o swap.o pseudo.o -lz -lpthread -lm -o $@ -+mksquashfs: mksquashfs.o read_fs.o sort.o swap.o pseudo.o uncompress.o -+ $(CC) mksquashfs.o read_fs.o sort.o swap.o pseudo.o uncompress.o -lz -lpthread -lm $(LZMA_LIB) -o $@ + if(sBlk.fragments == 0) +- return; ++ return TRUE; --mksquashfs.o: mksquashfs.c squashfs_fs.h mksquashfs.h global.h sort.h squashfs_swap.h Makefile -+mksquashfs.o: mksquashfs.c squashfs_fs.h mksquashfs.h global.h sort.h squashfs_swap.h uncompress.h Makefile - --read_fs.o: read_fs.c squashfs_fs.h read_fs.h global.h squashfs_swap.h Makefile -+read_fs.o: read_fs.c squashfs_fs.h read_fs.h global.h squashfs_swap.h uncompress.h Makefile - - sort.o: sort.c squashfs_fs.h global.h sort.h Makefile - -@@ -19,18 +25,20 @@ - - pseudo.o: pseudo.c pseudo.h Makefile - --unsquashfs: unsquashfs.o unsquash-1.o unsquash-2.o unsquash-3.o unsquash-4.o swap.o -- $(CC) unsquashfs.o unsquash-1.o unsquash-2.o unsquash-3.o unsquash-4.o swap.o -lz -lpthread -lm -o $@ -+uncompress.o: uncompress.c uncompress.h -+ -+unsquashfs: unsquashfs.o unsquash-1.o unsquash-2.o unsquash-3.o unsquash-4.o swap.o uncompress.o -+ $(CC) unsquashfs.o unsquash-1.o unsquash-2.o unsquash-3.o unsquash-4.o swap.o uncompress.o -lz -lpthread -lm $(LZMA_LIB) -o $@ - --unsquashfs.o: unsquashfs.h unsquashfs.c squashfs_fs.h squashfs_swap.h squashfs_compat.h global.h Makefile -+unsquashfs.o: unsquashfs.h unsquashfs.c squashfs_fs.h squashfs_swap.h squashfs_compat.h global.h uncompress.h Makefile - --unsquash-1.o: unsquashfs.h unsquash-1.c squashfs_fs.h squashfs_compat.h global.h Makefile -+unsquash-1.o: unsquashfs.h unsquash-1.c squashfs_fs.h squashfs_compat.h global.h uncompress.h Makefile - --unsquash-2.o: unsquashfs.h unsquash-2.c unsquashfs.h squashfs_fs.h squashfs_compat.h global.h Makefile -+unsquash-2.o: unsquashfs.h unsquash-2.c unsquashfs.h squashfs_fs.h squashfs_compat.h global.h uncompress.h Makefile - --unsquash-3.o: unsquashfs.h unsquash-3.c squashfs_fs.h squashfs_compat.h global.h Makefile -+unsquash-3.o: unsquashfs.h unsquash-3.c squashfs_fs.h squashfs_compat.h global.h uncompress.h Makefile - --unsquash-4.o: unsquashfs.h unsquash-4.c squashfs_fs.h squashfs_swap.h global.h Makefile -+unsquash-4.o: unsquashfs.h unsquash-4.c squashfs_fs.h squashfs_swap.h global.h uncompress.h Makefile - - clean: - -rm -f *.o mksquashfs unsquashfs -Index: squashfs4.0/squashfs-tools/read_fs.c -=================================================================== ---- squashfs4.0.orig/squashfs-tools/read_fs.c 2009-03-31 06:23:14.000000000 +0200 -+++ squashfs4.0/squashfs-tools/read_fs.c 2009-09-14 17:20:36.310480350 +0200 -@@ -51,6 +51,7 @@ - #include "squashfs_swap.h" - #include "read_fs.h" - #include "global.h" -+#include "uncompress.h" - - #include - -@@ -83,17 +84,17 @@ - c_byte = SQUASHFS_COMPRESSED_SIZE(c_byte); - read_destination(fd, start + offset, c_byte, buffer); - -- res = uncompress(block, &bytes, (const unsigned char *) buffer, -- c_byte); -+ res = uncompress_wrapper(block, &bytes, -+ (const unsigned char *) buffer, c_byte); - if(res != Z_OK) { - if(res == Z_MEM_ERROR) -- ERROR("zlib::uncompress failed, not enough " -+ ERROR("uncompress failed, not enough " - "memory\n"); - else if(res == Z_BUF_ERROR) -- ERROR("zlib::uncompress failed, not enough " -+ ERROR("uncompress failed, not enough " - "room in output buffer\n"); - else -- ERROR("zlib::uncompress failed, unknown error " -+ ERROR("uncompress failed, unknown error " - "%d\n", res); - return 0; - } -Index: squashfs4.0/squashfs-tools/unsquashfs.c -=================================================================== ---- squashfs4.0.orig/squashfs-tools/unsquashfs.c 2009-04-05 23:23:06.000000000 +0200 -+++ squashfs4.0/squashfs-tools/unsquashfs.c 2009-09-14 17:20:36.310480350 +0200 -@@ -24,6 +24,7 @@ - #include "unsquashfs.h" + if((fragment_table = malloc(sBlk.fragments * + sizeof(squashfs_fragment_entry))) == NULL) +diff -Nur squashfs4.0/squashfs-tools/unsquashfs.c squashfs4.0-lzma-snapshot/squashfs-tools/unsquashfs.c +--- squashfs4.0/squashfs-tools/unsquashfs.c 2009-04-05 23:23:06.000000000 +0200 ++++ squashfs4.0-lzma-snapshot/squashfs-tools/unsquashfs.c 2009-10-20 06:03:39.000000000 +0200 +@@ -25,6 +25,9 @@ #include "squashfs_swap.h" #include "squashfs_compat.h" -+#include "uncompress.h" #include "read_fs.h" ++#include "compressor.h" ++ ++#include struct cache *fragment_cache, *data_cache; -@@ -597,18 +598,17 @@ + struct queue *to_reader, *to_deflate, *to_writer, *from_writer; +@@ -36,6 +39,7 @@ + + struct super_block sBlk; + squashfs_operations s_ops; ++struct compressor *comp; + + int bytes = 0, swap, file_count = 0, dir_count = 0, sym_count = 0, + dev_count = 0, fifo_count = 0; +@@ -590,31 +594,23 @@ + offset = 3; + if(SQUASHFS_COMPRESSED(c_byte)) { + char buffer[SQUASHFS_METADATA_SIZE]; +- int res; +- unsigned long bytes = SQUASHFS_METADATA_SIZE; ++ int error, res; + + c_byte = SQUASHFS_COMPRESSED_SIZE(c_byte); if(read_bytes(start + offset, c_byte, buffer) == FALSE) goto failed; - res = uncompress((unsigned char *) block, &bytes, -+ res = uncompress_wrapper((unsigned char *) block, &bytes, - (const unsigned char *) buffer, c_byte); -- - if(res != Z_OK) { - if(res == Z_MEM_ERROR) +- (const unsigned char *) buffer, c_byte); ++ res = comp->uncompress(block, buffer, c_byte, ++ SQUASHFS_METADATA_SIZE, &error); + +- if(res != Z_OK) { +- if(res == Z_MEM_ERROR) - ERROR("zlib::uncompress failed, not enough " -+ ERROR("uncompress failed, not enough " - "memory\n"); - else if(res == Z_BUF_ERROR) +- "memory\n"); +- else if(res == Z_BUF_ERROR) - ERROR("zlib::uncompress failed, not enough " -+ ERROR("uncompress failed, not enough " - "room in output buffer\n"); - else +- "room in output buffer\n"); +- else - ERROR("zlib::uncompress failed, unknown error " -+ ERROR("uncompress failed, unknown error " - "%d\n", res); +- "%d\n", res); ++ if(res == -1) { ++ ERROR("%s uncompress failed with error code %d\n", ++ comp->name, error); goto failed; } -@@ -645,18 +645,17 @@ + if(next) + *next = start + offset + c_byte; +- return bytes; ++ return res; + } else { + c_byte = SQUASHFS_COMPRESSED_SIZE(c_byte); + if(read_bytes(start + offset, c_byte, block) == FALSE) +@@ -632,36 +628,26 @@ + + int read_data_block(long long start, unsigned int size, char *block) + { +- int res; +- unsigned long bytes = block_size; ++ int error, res; + int c_byte = SQUASHFS_COMPRESSED_SIZE_BLOCK(size); + + TRACE("read_data_block: block @0x%llx, %d %s bytes\n", start, +- SQUASHFS_COMPRESSED_SIZE_BLOCK(c_byte), +- SQUASHFS_COMPRESSED_BLOCK(c_byte) ? "compressed" : ++ c_byte, SQUASHFS_COMPRESSED_BLOCK(size) ? "compressed" : + "uncompressed"); + + if(SQUASHFS_COMPRESSED_BLOCK(size)) { if(read_bytes(start, c_byte, data) == FALSE) goto failed; - res = uncompress((unsigned char *) block, &bytes, -+ res = uncompress_wrapper((unsigned char *) block, &bytes, - (const unsigned char *) data, c_byte); -- - if(res != Z_OK) { - if(res == Z_MEM_ERROR) +- (const unsigned char *) data, c_byte); ++ res = comp->uncompress(block, data, c_byte, block_size, &error); + +- if(res != Z_OK) { +- if(res == Z_MEM_ERROR) - ERROR("zlib::uncompress failed, not enough " -+ ERROR("uncompress failed, not enough " - "memory\n"); - else if(res == Z_BUF_ERROR) +- "memory\n"); +- else if(res == Z_BUF_ERROR) - ERROR("zlib::uncompress failed, not enough " -+ ERROR("uncompress failed, not enough " - "room in output buffer\n"); - else +- "room in output buffer\n"); +- else - ERROR("zlib::uncompress failed, unknown error " -+ ERROR("uncompress failed, unknown error " - "%d\n", res); +- "%d\n", res); ++ if(res == -1) { ++ ERROR("%s uncompress failed with error code %d\n", ++ comp->name, error); goto failed; } -@@ -1459,7 +1458,7 @@ + +- return bytes; ++ return res; + } else { + if(read_bytes(start, c_byte, block) == FALSE) + goto failed; +@@ -671,7 +657,7 @@ + + failed: + ERROR("read_data_block: failed to read block @0x%llx, size %d\n", start, +- size); ++ c_byte); + return FALSE; + } + +@@ -1383,6 +1369,11 @@ + #endif + printf("Creation or last append time %s", mkfs_str ? mkfs_str : + "failed to get time\n"); ++ printf("Filesystem size %.2f Kbytes (%.2f Mbytes)\n", ++ sBlk.bytes_used / 1024.0, sBlk.bytes_used / (1024.0 * 1024.0)); ++ if(sBlk.s_major == 4) ++ printf("Compression %s\n", comp->name); ++ printf("Block size %d\n", sBlk.block_size); + printf("Filesystem is %sexportable via NFS\n", + SQUASHFS_EXPORTABLE(sBlk.flags) ? "" : "not "); + +@@ -1409,9 +1400,6 @@ + SQUASHFS_DUPLICATES(sBlk.flags) ? "" : "not "); + else + printf("Duplicates are removed\n"); +- printf("Filesystem size %.2f Kbytes (%.2f Mbytes)\n", +- sBlk.bytes_used / 1024.0, sBlk.bytes_used / (1024.0 * 1024.0)); +- printf("Block size %d\n", sBlk.block_size); + if(sBlk.s_major > 1) + printf("Number of fragments %d\n", sBlk.fragments); + printf("Number of inodes %d\n", sBlk.inodes); +@@ -1459,6 +1447,18 @@ s_ops.read_inode = read_inode_4; s_ops.read_uids_guids = read_uids_guids_4; memcpy(&sBlk, &sBlk_4, sizeof(sBlk_4)); -- return TRUE; -+ goto done; ++ ++ /* ++ * Check the compression type ++ */ ++ comp = lookup_compressor_id(sBlk.compression); ++ if(!comp->supported) { ++ ERROR("Filesystem uses %s compression, this is " ++ "unsupported by this version\n", comp->name); ++ ERROR("Decompressors available:\n"); ++ display_compressors("", ""); ++ goto failed_mount; ++ } + return TRUE; } - /* -@@ -1548,6 +1547,9 @@ +@@ -1548,6 +1548,11 @@ goto failed_mount; } -+done: -+ compression = sBlk.compression; -+ ++ /* ++ * 1.x, 2.x and 3.x filesystems use gzip compression. Gzip is always ++ * suppported. ++ */ ++ comp = lookup_compressor("gzip"); return TRUE; failed_mount: -@@ -1710,19 +1712,19 @@ - int res; - unsigned long bytes = block_size; +@@ -1707,32 +1712,24 @@ + + while(1) { + struct cache_entry *entry = queue_get(to_deflate); +- int res; +- unsigned long bytes = block_size; ++ int error, res; - res = uncompress((unsigned char *) tmp, &bytes, -+ res = uncompress_wrapper((unsigned char *) tmp, &bytes, - (const unsigned char *) entry->data, - SQUASHFS_COMPRESSED_SIZE_BLOCK(entry->size)); - - if(res != Z_OK) { - if(res == Z_MEM_ERROR) +- (const unsigned char *) entry->data, +- SQUASHFS_COMPRESSED_SIZE_BLOCK(entry->size)); +- +- if(res != Z_OK) { +- if(res == Z_MEM_ERROR) - ERROR("zlib::uncompress failed, not enough" -+ ERROR("uncompress failed, not enough" - "memory\n"); - else if(res == Z_BUF_ERROR) +- "memory\n"); +- else if(res == Z_BUF_ERROR) - ERROR("zlib::uncompress failed, not enough " -+ ERROR("uncompress failed, not enough " - "room in output buffer\n"); - else +- "room in output buffer\n"); +- else - ERROR("zlib::uncompress failed, unknown error " -+ ERROR("uncompress failed, unknown error " - "%d\n", res); - } else - memcpy(entry->data, tmp, bytes); -Index: squashfs4.0/squashfs-tools/mksquashfs.h -=================================================================== ---- squashfs4.0.orig/squashfs-tools/mksquashfs.h 2009-02-19 19:31:08.000000000 +0100 -+++ squashfs4.0/squashfs-tools/mksquashfs.h 2009-09-14 17:20:36.310480350 +0200 -@@ -41,4 +41,9 @@ - #define SQUASHFS_SWAP_LONG_LONGS(s, d, n) \ - memcpy(d, s, n * sizeof(long long)) - #endif -+ -+extern int uncompress_wrapper(unsigned char *dest, unsigned long *dest_len, -+ const unsigned char *src, unsigned long src_len); -+ -+ - #endif -Index: squashfs4.0/squashfs-tools/uncompress.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ squashfs4.0/squashfs-tools/uncompress.c 2009-09-14 17:20:36.310480350 +0200 -@@ -0,0 +1,58 @@ -+/* -+ * Copyright (c) 2009 Felix Fietkau -+ * -+ * 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, -+ * or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ * -+ * uncompress.c -+ */ -+ -+ -+ -+#ifdef USE_LZMA -+#include -+#endif -+#include -+#include "squashfs_fs.h" -+ -+/* compression algorithm */ -+int compression = ZLIB_COMPRESSION; -+ -+ -+int uncompress_wrapper(unsigned char *dest, unsigned long *dest_len, -+ const unsigned char *src, unsigned long src_len) -+{ -+ int res; -+ -+#ifdef USE_LZMA -+ if (compression == LZMA_COMPRESSION) { -+ size_t slen = src_len - LZMA_PROPS_SIZE; -+ res = LzmaUncompress((unsigned char *)dest, dest_len, -+ (const unsigned char *) src + LZMA_PROPS_SIZE, &slen, -+ (const unsigned char *) src, LZMA_PROPS_SIZE); -+ switch(res) { -+ case SZ_OK: -+ res = Z_OK; -+ break; -+ case SZ_ERROR_MEM: -+ res = Z_MEM_ERROR; -+ break; -+ } -+ } else -+#endif -+ res = uncompress(dest, dest_len, src, src_len); -+ return res; -+} -+ -+ -Index: squashfs4.0/squashfs-tools/uncompress.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ squashfs4.0/squashfs-tools/uncompress.h 2009-09-14 17:20:36.310480350 +0200 -@@ -0,0 +1,29 @@ -+/* -+ * Copyright (c) 2009 Felix Fietkau -+ * -+ * 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, -+ * or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ * -+ * uncompress.h -+ */ -+ -+#ifdef USE_LZMA -+#include -+#endif -+ -+extern int compression; -+extern int uncompress_wrapper(unsigned char *dest, unsigned long *dest_len, -+ const unsigned char *src, unsigned long src_len); -+ +- "%d\n", res); +- } else +- memcpy(entry->data, tmp, bytes); ++ res = comp->uncompress(tmp, entry->data, ++ SQUASHFS_COMPRESSED_SIZE_BLOCK(entry->size), block_size, ++ &error); + ++ if(res == -1) ++ ERROR("%s uncompress failed with error code %d\n", ++ comp->name, error); ++ else ++ memcpy(entry->data, tmp, res); + + /* + * block has been either successfully decompressed, or an error + * occurred, clear pending flag, set error appropriately and + * wake up any threads waiting on this block + */ +- cache_block_ready(entry, res != Z_OK); ++ cache_block_ready(entry, res == -1); + } + } + +@@ -1913,7 +1910,7 @@ + + + #define VERSION() \ +- printf("unsquashfs version 4.0 (2009/04/05)\n");\ ++ printf("unsquashfs version 4.1-CVS (2009/08/30)\n");\ + printf("copyright (C) 2009 Phillip Lougher "\ + "\n\n");\ + printf("This program is free software; you can redistribute it and/or\n");\ +@@ -1938,7 +1935,6 @@ + int fragment_buffer_size = FRAGMENT_BUFFER_DEFAULT; + int data_buffer_size = DATA_BUFFER_DEFAULT; + char *b; +- struct winsize winsize; + + pthread_mutex_init(&screen_mutex, NULL); + root_process = geteuid() == 0; +@@ -2087,6 +2083,8 @@ + "regular expressions\n"); + ERROR("\t\t\t\trather than use the default shell " + "wildcard\n\t\t\t\texpansion (globbing)\n"); ++ ERROR("\nDecompressors available:\n"); ++ display_compressors("", ""); + } + exit(1); + } +diff -Nur squashfs4.0/squashfs-tools/unsquashfs.h squashfs4.0-lzma-snapshot/squashfs-tools/unsquashfs.h +--- squashfs4.0/squashfs-tools/unsquashfs.h 2009-03-29 04:29:02.000000000 +0200 ++++ squashfs4.0-lzma-snapshot/squashfs-tools/unsquashfs.h 2009-10-20 06:03:39.000000000 +0200 +@@ -31,7 +31,6 @@ + #include + #include + #include +-#include + #include + #include + #include From d23190405507f9c898228bad75c5c3b1c24ccf52 Mon Sep 17 00:00:00 2001 From: kaloz Date: Mon, 2 Nov 2009 09:53:29 +0000 Subject: [PATCH 057/288] use the new option for creating squashfs4-lzma images git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18269 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- include/image.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/image.mk b/include/image.mk index 237d87c90..c6d5e2649 100644 --- a/include/image.mk +++ b/include/image.mk @@ -31,7 +31,7 @@ ifneq ($(USE_SQUASHFS3),) MKSQUASHFS_CMD := $(STAGING_DIR_HOST)/bin/mksquashfs-lzma else MKSQUASHFS_CMD := $(STAGING_DIR_HOST)/bin/mksquashfs4 -SQUASHFS_OPTS := -lzma -processors 1 +SQUASHFS_OPTS := -comp lzma -processors 1 endif JFFS2_BLOCKSIZE ?= 64k 128k From 4c1bc63b769a707a715e45761bd6f9350167ead5 Mon Sep 17 00:00:00 2001 From: kaloz Date: Mon, 2 Nov 2009 09:54:06 +0000 Subject: [PATCH 058/288] resync 2.6.30/2.6.31 patches git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18270 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../970-ocf_kbuild_integration.patch | 4 +- .../977-textsearch_kconfig_hacks.patch | 2 +- .../patches-2.6.31/014-samsung_flash | 2 +- .../patches-2.6.31/028-module_exports.patch | 34 ++++++---------- .../patches-2.6.31/230-union_mounts.patch | 40 +++++++++---------- .../801-usb_serial_endpoint_size.patch | 6 +-- .../patches-2.6.31/922-gpiommc.patch | 2 +- .../970-ocf_kbuild_integration.patch | 4 +- .../977-textsearch_kconfig_hacks.patch | 2 +- 9 files changed, 44 insertions(+), 52 deletions(-) diff --git a/target/linux/generic-2.6/patches-2.6.30/970-ocf_kbuild_integration.patch b/target/linux/generic-2.6/patches-2.6.30/970-ocf_kbuild_integration.patch index bf229eab8..b24d59cff 100644 --- a/target/linux/generic-2.6/patches-2.6.30/970-ocf_kbuild_integration.patch +++ b/target/linux/generic-2.6/patches-2.6.30/970-ocf_kbuild_integration.patch @@ -1,6 +1,6 @@ --- a/crypto/Kconfig +++ b/crypto/Kconfig -@@ -784,6 +784,8 @@ config CRYPTO_ANSI_CPRNG +@@ -778,6 +778,8 @@ config CRYPTO_ANSI_CPRNG for cryptographic modules. Uses the Algorithm specified in ANSI X9.31 A.2.4 @@ -11,7 +11,7 @@ endif # if CRYPTO --- a/crypto/Makefile +++ b/crypto/Makefile -@@ -86,6 +86,11 @@ obj-$(CONFIG_CRYPTO_ANSI_CPRNG) += ansi_ +@@ -85,6 +85,11 @@ obj-$(CONFIG_CRYPTO_ANSI_CPRNG) += ansi_ obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o # diff --git a/target/linux/generic-2.6/patches-2.6.30/977-textsearch_kconfig_hacks.patch b/target/linux/generic-2.6/patches-2.6.30/977-textsearch_kconfig_hacks.patch index 66a86ad99..655ebae64 100644 --- a/target/linux/generic-2.6/patches-2.6.30/977-textsearch_kconfig_hacks.patch +++ b/target/linux/generic-2.6/patches-2.6.30/977-textsearch_kconfig_hacks.patch @@ -1,6 +1,6 @@ --- a/lib/Kconfig +++ b/lib/Kconfig -@@ -142,16 +142,16 @@ config REED_SOLOMON_DEC16 +@@ -145,16 +145,16 @@ config REED_SOLOMON_DEC16 # Textsearch support is select'ed if needed # config TEXTSEARCH diff --git a/target/linux/generic-2.6/patches-2.6.31/014-samsung_flash b/target/linux/generic-2.6/patches-2.6.31/014-samsung_flash index 5c835081b..1faeb41ea 100644 --- a/target/linux/generic-2.6/patches-2.6.31/014-samsung_flash +++ b/target/linux/generic-2.6/patches-2.6.31/014-samsung_flash @@ -8,7 +8,7 @@ static int cfi_amdstd_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); static int cfi_amdstd_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); -@@ -386,12 +387,19 @@ struct mtd_info *cfi_cmdset_0002(struct +@@ -375,12 +376,19 @@ struct mtd_info *cfi_cmdset_0002(struct if (extp->MajorVersion != '1' || (extp->MinorVersion < '0' || extp->MinorVersion > '4')) { diff --git a/target/linux/generic-2.6/patches-2.6.31/028-module_exports.patch b/target/linux/generic-2.6/patches-2.6.31/028-module_exports.patch index 355139e8f..3d73a0212 100644 --- a/target/linux/generic-2.6/patches-2.6.31/028-module_exports.patch +++ b/target/linux/generic-2.6/patches-2.6.31/028-module_exports.patch @@ -1,7 +1,5 @@ -Index: linux-2.6.31.5/include/asm-generic/vmlinux.lds.h -=================================================================== ---- linux-2.6.31.5.orig/include/asm-generic/vmlinux.lds.h 2009-10-23 00:57:56.000000000 +0200 -+++ linux-2.6.31.5/include/asm-generic/vmlinux.lds.h 2009-10-23 12:43:50.000000000 +0200 +--- a/include/asm-generic/vmlinux.lds.h ++++ b/include/asm-generic/vmlinux.lds.h @@ -55,6 +55,27 @@ #define LOAD_OFFSET 0 #endif @@ -86,11 +84,9 @@ Index: linux-2.6.31.5/include/asm-generic/vmlinux.lds.h } \ \ /* __*init sections */ \ -Index: linux-2.6.31.5/include/linux/module.h -=================================================================== ---- linux-2.6.31.5.orig/include/linux/module.h 2009-10-23 00:57:56.000000000 +0200 -+++ linux-2.6.31.5/include/linux/module.h 2009-10-23 12:43:50.000000000 +0200 -@@ -188,16 +188,24 @@ +--- a/include/linux/module.h ++++ b/include/linux/module.h +@@ -188,16 +188,24 @@ void *__symbol_get_gpl(const char *symbo #define __CRC_SYMBOL(sym, sec) #endif @@ -117,11 +113,9 @@ Index: linux-2.6.31.5/include/linux/module.h = { (unsigned long)&sym, __kstrtab_##sym } #define EXPORT_SYMBOL(sym) \ -Index: linux-2.6.31.5/arch/arm/kernel/vmlinux.lds.S -=================================================================== ---- linux-2.6.31.5.orig/arch/arm/kernel/vmlinux.lds.S 2009-10-23 00:57:56.000000000 +0200 -+++ linux-2.6.31.5/arch/arm/kernel/vmlinux.lds.S 2009-10-23 12:43:50.000000000 +0200 -@@ -79,26 +79,6 @@ +--- a/arch/arm/kernel/vmlinux.lds.S ++++ b/arch/arm/kernel/vmlinux.lds.S +@@ -79,26 +79,6 @@ SECTIONS #endif } @@ -148,7 +142,7 @@ Index: linux-2.6.31.5/arch/arm/kernel/vmlinux.lds.S .text : { /* Real text segment */ _text = .; /* Text and read-only data */ __exception_text_start = .; -@@ -205,6 +185,28 @@ +@@ -205,6 +185,28 @@ SECTIONS __bss_stop = .; _end = .; } @@ -177,11 +171,9 @@ Index: linux-2.6.31.5/arch/arm/kernel/vmlinux.lds.S /* Stabs debugging sections. */ .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) } -Index: linux-2.6.31.5/arch/powerpc/kernel/vmlinux.lds.S -=================================================================== ---- linux-2.6.31.5.orig/arch/powerpc/kernel/vmlinux.lds.S 2009-10-23 00:57:56.000000000 +0200 -+++ linux-2.6.31.5/arch/powerpc/kernel/vmlinux.lds.S 2009-10-23 12:43:50.000000000 +0200 -@@ -37,12 +37,6 @@ +--- a/arch/powerpc/kernel/vmlinux.lds.S ++++ b/arch/powerpc/kernel/vmlinux.lds.S +@@ -37,12 +37,6 @@ jiffies = jiffies_64 + 4; #endif SECTIONS { @@ -194,7 +186,7 @@ Index: linux-2.6.31.5/arch/powerpc/kernel/vmlinux.lds.S . = KERNELBASE; /* -@@ -295,6 +289,12 @@ +@@ -295,6 +289,12 @@ SECTIONS __bss_stop = .; } diff --git a/target/linux/generic-2.6/patches-2.6.31/230-union_mounts.patch b/target/linux/generic-2.6/patches-2.6.31/230-union_mounts.patch index 5c9d784ef..b26d5fae8 100644 --- a/target/linux/generic-2.6/patches-2.6.31/230-union_mounts.patch +++ b/target/linux/generic-2.6/patches-2.6.31/230-union_mounts.patch @@ -2343,7 +2343,7 @@ if (error) return error; -@@ -1575,6 +2409,9 @@ int may_open(struct path *path, int acc_ +@@ -1577,6 +2411,9 @@ int may_open(struct path *path, int acc_ if (!error) error = security_path_truncate(path, 0, ATTR_MTIME|ATTR_CTIME|ATTR_OPEN); @@ -2353,7 +2353,7 @@ if (!error) { vfs_dq_init(inode); -@@ -1621,7 +2458,7 @@ out_unlock: +@@ -1623,7 +2460,7 @@ out_unlock: if (error) return error; /* Don't check for write permission, don't truncate */ @@ -2362,7 +2362,7 @@ } /* -@@ -1736,12 +2573,10 @@ struct file *do_filp_open(int dfd, const +@@ -1738,12 +2575,10 @@ struct file *do_filp_open(int dfd, const if (flag & O_EXCL) nd.flags |= LOOKUP_EXCL; mutex_lock(&dir->d_inode->i_mutex); @@ -2377,7 +2377,7 @@ mutex_unlock(&dir->d_inode->i_mutex); goto exit; } -@@ -1801,10 +2636,23 @@ do_last: +@@ -1803,10 +2638,23 @@ do_last: if (path.dentry->d_inode->i_op->follow_link) goto do_link; @@ -2403,7 +2403,7 @@ ok: /* * Consider: -@@ -1822,12 +2670,18 @@ ok: +@@ -1824,12 +2672,18 @@ ok: if (error) goto exit; } @@ -2423,7 +2423,7 @@ filp = nameidata_to_filp(&nd, open_flag); if (IS_ERR(filp)) ima_counts_put(&nd.path, -@@ -1902,8 +2756,7 @@ do_link: +@@ -1904,8 +2758,7 @@ do_link: } dir = nd.path.dentry; mutex_lock(&dir->d_inode->i_mutex); @@ -2433,7 +2433,7 @@ __putname(nd.last.name); goto do_last; } -@@ -1937,7 +2790,8 @@ EXPORT_SYMBOL(filp_open); +@@ -1939,7 +2792,8 @@ EXPORT_SYMBOL(filp_open); */ struct dentry *lookup_create(struct nameidata *nd, int is_dir) { @@ -2443,7 +2443,7 @@ mutex_lock_nested(&nd->path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); /* -@@ -1953,11 +2807,13 @@ struct dentry *lookup_create(struct name +@@ -1955,11 +2809,13 @@ struct dentry *lookup_create(struct name /* * Do the final lookup. */ @@ -2460,7 +2460,7 @@ goto eexist; /* * Special case - lookup gave negative, but... we had foo/bar/ -@@ -1966,15 +2822,17 @@ struct dentry *lookup_create(struct name +@@ -1968,15 +2824,17 @@ struct dentry *lookup_create(struct name * been asking for (non-existent) directory. -ENOENT for you. */ if (unlikely(!is_dir && nd->last.name[nd->last.len])) { @@ -2484,7 +2484,7 @@ } EXPORT_SYMBOL_GPL(lookup_create); -@@ -2086,6 +2944,7 @@ SYSCALL_DEFINE3(mknod, const char __user +@@ -2088,6 +2946,7 @@ SYSCALL_DEFINE3(mknod, const char __user int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) { int error = may_create(dir, dentry); @@ -2492,7 +2492,7 @@ if (error) return error; -@@ -2099,9 +2958,18 @@ int vfs_mkdir(struct inode *dir, struct +@@ -2101,9 +2960,18 @@ int vfs_mkdir(struct inode *dir, struct return error; vfs_dq_init(dir); @@ -2512,7 +2512,7 @@ return error; } -@@ -2147,6 +3015,212 @@ SYSCALL_DEFINE2(mkdir, const char __user +@@ -2149,6 +3017,212 @@ SYSCALL_DEFINE2(mkdir, const char __user return sys_mkdirat(AT_FDCWD, pathname, mode); } @@ -2725,7 +2725,7 @@ /* * We try to drop the dentry early: we should have * a usage count of 2 if we're the only user of this -@@ -2211,7 +3285,7 @@ static long do_rmdir(int dfd, const char +@@ -2213,7 +3287,7 @@ static long do_rmdir(int dfd, const char { int error = 0; char * name; @@ -2734,7 +2734,7 @@ struct nameidata nd; error = user_path_parent(dfd, pathname, &nd, &name); -@@ -2233,21 +3307,24 @@ static long do_rmdir(int dfd, const char +@@ -2235,21 +3309,24 @@ static long do_rmdir(int dfd, const char nd.flags &= ~LOOKUP_PARENT; mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); @@ -2765,7 +2765,7 @@ exit2: mutex_unlock(&nd.path.dentry->d_inode->i_mutex); exit1: -@@ -2302,7 +3379,7 @@ static long do_unlinkat(int dfd, const c +@@ -2304,7 +3381,7 @@ static long do_unlinkat(int dfd, const c { int error; char *name; @@ -2774,7 +2774,7 @@ struct nameidata nd; struct inode *inode = NULL; -@@ -2317,26 +3394,29 @@ static long do_unlinkat(int dfd, const c +@@ -2319,26 +3396,29 @@ static long do_unlinkat(int dfd, const c nd.flags &= ~LOOKUP_PARENT; mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); @@ -2811,7 +2811,7 @@ } mutex_unlock(&nd.path.dentry->d_inode->i_mutex); if (inode) -@@ -2347,8 +3427,8 @@ exit1: +@@ -2349,8 +3429,8 @@ exit1: return error; slashes: @@ -2822,7 +2822,7 @@ goto exit2; } -@@ -2684,11 +3764,96 @@ int vfs_rename(struct inode *old_dir, st +@@ -2686,11 +3766,96 @@ int vfs_rename(struct inode *old_dir, st return error; } @@ -2920,7 +2920,7 @@ struct dentry *trap; struct nameidata oldnd, newnd; char *from; -@@ -2722,16 +3887,28 @@ SYSCALL_DEFINE4(renameat, int, olddfd, c +@@ -2724,16 +3889,28 @@ SYSCALL_DEFINE4(renameat, int, olddfd, c trap = lock_rename(new_dir, old_dir); @@ -2954,7 +2954,7 @@ error = -ENOTDIR; if (oldnd.last.name[oldnd.last.len]) goto exit4; -@@ -2740,32 +3917,44 @@ SYSCALL_DEFINE4(renameat, int, olddfd, c +@@ -2742,32 +3919,44 @@ SYSCALL_DEFINE4(renameat, int, olddfd, c } /* source should not be ancestor of target */ error = -EINVAL; diff --git a/target/linux/generic-2.6/patches-2.6.31/801-usb_serial_endpoint_size.patch b/target/linux/generic-2.6/patches-2.6.31/801-usb_serial_endpoint_size.patch index 6f0262538..41b3848f4 100644 --- a/target/linux/generic-2.6/patches-2.6.31/801-usb_serial_endpoint_size.patch +++ b/target/linux/generic-2.6/patches-2.6.31/801-usb_serial_endpoint_size.patch @@ -1,6 +1,6 @@ --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c -@@ -62,6 +62,7 @@ static struct usb_driver usb_serial_driv +@@ -60,6 +60,7 @@ static struct usb_driver usb_serial_driv drivers depend on it. */ @@ -8,7 +8,7 @@ static int debug; /* initially all NULL */ static struct usb_serial *serial_table[SERIAL_TTY_MINORS]; -@@ -946,7 +947,7 @@ int usb_serial_probe(struct usb_interfac +@@ -947,7 +948,7 @@ int usb_serial_probe(struct usb_interfac dev_err(&interface->dev, "No free urbs available\n"); goto probe_error; } @@ -17,7 +17,7 @@ port->bulk_in_size = buffer_size; port->bulk_in_endpointAddress = endpoint->bEndpointAddress; port->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL); -@@ -1416,3 +1417,5 @@ MODULE_LICENSE("GPL"); +@@ -1381,3 +1382,5 @@ MODULE_LICENSE("GPL"); module_param(debug, bool, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(debug, "Debug enabled or not"); diff --git a/target/linux/generic-2.6/patches-2.6.31/922-gpiommc.patch b/target/linux/generic-2.6/patches-2.6.31/922-gpiommc.patch index 9375823f5..512a0b196 100644 --- a/target/linux/generic-2.6/patches-2.6.31/922-gpiommc.patch +++ b/target/linux/generic-2.6/patches-2.6.31/922-gpiommc.patch @@ -829,7 +829,7 @@ +be done automatically. --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -2260,6 +2260,11 @@ T: git git://git.kernel.org/pub/scm/linu +@@ -2266,6 +2266,11 @@ T: git git://git.kernel.org/pub/scm/linu S: Maintained F: drivers/media/video/gspca/ diff --git a/target/linux/generic-2.6/patches-2.6.31/970-ocf_kbuild_integration.patch b/target/linux/generic-2.6/patches-2.6.31/970-ocf_kbuild_integration.patch index 54740df08..a6d86ce44 100644 --- a/target/linux/generic-2.6/patches-2.6.31/970-ocf_kbuild_integration.patch +++ b/target/linux/generic-2.6/patches-2.6.31/970-ocf_kbuild_integration.patch @@ -1,6 +1,6 @@ --- a/crypto/Kconfig +++ b/crypto/Kconfig -@@ -794,6 +794,8 @@ config CRYPTO_ANSI_CPRNG +@@ -788,6 +788,8 @@ config CRYPTO_ANSI_CPRNG for cryptographic modules. Uses the Algorithm specified in ANSI X9.31 A.2.4 @@ -11,7 +11,7 @@ endif # if CRYPTO --- a/crypto/Makefile +++ b/crypto/Makefile -@@ -86,6 +86,11 @@ obj-$(CONFIG_CRYPTO_ANSI_CPRNG) += ansi_ +@@ -85,6 +85,11 @@ obj-$(CONFIG_CRYPTO_ANSI_CPRNG) += ansi_ obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o # diff --git a/target/linux/generic-2.6/patches-2.6.31/977-textsearch_kconfig_hacks.patch b/target/linux/generic-2.6/patches-2.6.31/977-textsearch_kconfig_hacks.patch index 655ebae64..97fad7dfe 100644 --- a/target/linux/generic-2.6/patches-2.6.31/977-textsearch_kconfig_hacks.patch +++ b/target/linux/generic-2.6/patches-2.6.31/977-textsearch_kconfig_hacks.patch @@ -1,6 +1,6 @@ --- a/lib/Kconfig +++ b/lib/Kconfig -@@ -145,16 +145,16 @@ config REED_SOLOMON_DEC16 +@@ -148,16 +148,16 @@ config REED_SOLOMON_DEC16 # Textsearch support is select'ed if needed # config TEXTSEARCH From 0511a5502c350ead7373be3c92e972e3dc2c31fd Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 2 Nov 2009 14:52:03 +0000 Subject: [PATCH 059/288] squashfs4: fix build breakage git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18271 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- tools/squashfs4/patches/110-lzma.patch | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/squashfs4/patches/110-lzma.patch b/tools/squashfs4/patches/110-lzma.patch index 5fd697085..1a86e0585 100644 --- a/tools/squashfs4/patches/110-lzma.patch +++ b/tools/squashfs4/patches/110-lzma.patch @@ -1982,13 +1982,11 @@ diff -Nur squashfs4.0/squashfs-tools/unsquash-4.c squashfs4.0-lzma-snapshot/squa diff -Nur squashfs4.0/squashfs-tools/unsquashfs.c squashfs4.0-lzma-snapshot/squashfs-tools/unsquashfs.c --- squashfs4.0/squashfs-tools/unsquashfs.c 2009-04-05 23:23:06.000000000 +0200 +++ squashfs4.0-lzma-snapshot/squashfs-tools/unsquashfs.c 2009-10-20 06:03:39.000000000 +0200 -@@ -25,6 +25,9 @@ +@@ -25,6 +25,7 @@ #include "squashfs_swap.h" #include "squashfs_compat.h" #include "read_fs.h" +#include "compressor.h" -+ -+#include struct cache *fragment_cache, *data_cache; struct queue *to_reader, *to_deflate, *to_writer, *from_writer; From e1ec0a87e19fc1e27d1b989093a6ee2cf644f55c Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 2 Nov 2009 14:52:09 +0000 Subject: [PATCH 060/288] squashfs4: refresh the cygwin patch git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18272 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../squashfs4/patches/120-cygwin_fixes.patch | 54 +++++++++---------- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/tools/squashfs4/patches/120-cygwin_fixes.patch b/tools/squashfs4/patches/120-cygwin_fixes.patch index 1cc563e69..79469a9ea 100644 --- a/tools/squashfs4/patches/120-cygwin_fixes.patch +++ b/tools/squashfs4/patches/120-cygwin_fixes.patch @@ -1,7 +1,6 @@ -diff -urN squashfs4.0/squashfs-tools/global.h squashfs4.0.new/squashfs-tools/global.h ---- squashfs4.0/squashfs-tools/global.h 2009-08-27 21:33:03.000000000 +0200 -+++ squashfs4.0.new/squashfs-tools/global.h 2009-08-27 21:36:38.000000000 +0200 -@@ -44,6 +44,11 @@ +--- a/squashfs-tools/global.h ++++ b/squashfs-tools/global.h +@@ -44,6 +44,11 @@ typedef long long squashfs_fragment_inde typedef squashfs_inode_t squashfs_inode; typedef squashfs_block_t squashfs_block; @@ -13,11 +12,10 @@ diff -urN squashfs4.0/squashfs-tools/global.h squashfs4.0.new/squashfs-tools/glo #ifndef FNM_EXTMATCH #define FNM_EXTMATCH 0 #endif -diff -urN squashfs4.0/squashfs-tools/mksquashfs.c squashfs4.0.new/squashfs-tools/mksquashfs.c ---- squashfs4.0/squashfs-tools/mksquashfs.c 2009-08-27 21:33:06.000000000 +0200 -+++ squashfs4.0.new/squashfs-tools/mksquashfs.c 2009-08-27 21:37:22.000000000 +0200 +--- a/squashfs-tools/mksquashfs.c ++++ b/squashfs-tools/mksquashfs.c @@ -49,10 +49,12 @@ - #include + #include #ifndef linux +#ifndef __CYGWIN__ @@ -29,7 +27,7 @@ diff -urN squashfs4.0/squashfs-tools/mksquashfs.c squashfs4.0.new/squashfs-tools #else #include #include -@@ -825,6 +827,7 @@ +@@ -817,6 +819,7 @@ void sigusr1_handler() void sigwinch_handler() { @@ -37,7 +35,7 @@ diff -urN squashfs4.0/squashfs-tools/mksquashfs.c squashfs4.0.new/squashfs-tools struct winsize winsize; if(ioctl(1, TIOCGWINSZ, &winsize) == -1) { -@@ -834,6 +837,9 @@ +@@ -826,6 +829,9 @@ void sigwinch_handler() columns = 80; } else columns = winsize.ws_col; @@ -47,7 +45,7 @@ diff -urN squashfs4.0/squashfs-tools/mksquashfs.c squashfs4.0.new/squashfs-tools } -@@ -3753,7 +3759,9 @@ +@@ -3853,7 +3859,9 @@ void initialise_threads() BAD_ERROR("Failed to set signal mask in intialise_threads\n"); signal(SIGUSR1, sigusr1_handler); @@ -58,7 +56,7 @@ diff -urN squashfs4.0/squashfs-tools/mksquashfs.c squashfs4.0.new/squashfs-tools if(processors == -1) { #ifndef linux int mib[2]; -@@ -3775,6 +3783,7 @@ +@@ -3875,6 +3883,7 @@ void initialise_threads() processors = get_nprocs(); #endif } @@ -66,10 +64,9 @@ diff -urN squashfs4.0/squashfs-tools/mksquashfs.c squashfs4.0.new/squashfs-tools if((thread = malloc((2 + processors * 2) * sizeof(pthread_t))) == NULL) BAD_ERROR("Out of memory allocating thread descriptors\n"); -diff -urN squashfs4.0/squashfs-tools/read_fs.c squashfs4.0.new/squashfs-tools/read_fs.c ---- squashfs4.0/squashfs-tools/read_fs.c 2009-08-27 21:33:06.000000000 +0200 -+++ squashfs4.0.new/squashfs-tools/read_fs.c 2009-08-27 21:41:54.000000000 +0200 -@@ -40,9 +40,11 @@ +--- a/squashfs-tools/read_fs.c ++++ b/squashfs-tools/read_fs.c +@@ -39,9 +39,11 @@ extern unsigned int get_guid(unsigned in #include #ifndef linux @@ -81,9 +78,8 @@ diff -urN squashfs4.0/squashfs-tools/read_fs.c squashfs4.0.new/squashfs-tools/re #else #include #endif -diff -urN squashfs4.0/squashfs-tools/swap.c squashfs4.0.new/squashfs-tools/swap.c ---- squashfs4.0/squashfs-tools/swap.c 2009-03-26 05:40:16.000000000 +0100 -+++ squashfs4.0.new/squashfs-tools/swap.c 2009-08-27 21:44:52.000000000 +0200 +--- a/squashfs-tools/swap.c ++++ b/squashfs-tools/swap.c @@ -20,9 +20,11 @@ */ @@ -96,10 +92,9 @@ diff -urN squashfs4.0/squashfs-tools/swap.c squashfs4.0.new/squashfs-tools/swap. #else #include #endif -diff -urN squashfs4.0/squashfs-tools/unsquashfs.c squashfs4.0.new/squashfs-tools/unsquashfs.c ---- squashfs4.0/squashfs-tools/unsquashfs.c 2009-08-27 21:33:06.000000000 +0200 -+++ squashfs4.0.new/squashfs-tools/unsquashfs.c 2009-08-27 21:41:38.000000000 +0200 -@@ -111,6 +111,7 @@ +--- a/squashfs-tools/unsquashfs.c ++++ b/squashfs-tools/unsquashfs.c +@@ -112,6 +112,7 @@ void update_progress_bar(); void sigwinch_handler() { @@ -107,7 +102,7 @@ diff -urN squashfs4.0/squashfs-tools/unsquashfs.c squashfs4.0.new/squashfs-tools struct winsize winsize; if(ioctl(1, TIOCGWINSZ, &winsize) == -1) { -@@ -120,6 +121,9 @@ +@@ -121,6 +122,9 @@ void sigwinch_handler() columns = 80; } else columns = winsize.ws_col; @@ -117,7 +112,7 @@ diff -urN squashfs4.0/squashfs-tools/unsquashfs.c squashfs4.0.new/squashfs-tools } -@@ -1794,7 +1798,9 @@ +@@ -1787,7 +1791,9 @@ void initialise_threads(int fragment_buf if(sigprocmask(SIG_BLOCK, &sigmask, &old_mask) == -1) EXIT_UNSQUASH("Failed to set signal mask in intialise_threads" "\n"); @@ -128,7 +123,7 @@ diff -urN squashfs4.0/squashfs-tools/unsquashfs.c squashfs4.0.new/squashfs-tools if(processors == -1) { #ifndef linux int mib[2]; -@@ -1816,6 +1822,7 @@ +@@ -1809,6 +1815,7 @@ void initialise_threads(int fragment_buf processors = get_nprocs(); #endif } @@ -136,10 +131,9 @@ diff -urN squashfs4.0/squashfs-tools/unsquashfs.c squashfs4.0.new/squashfs-tools if((thread = malloc((3 + processors) * sizeof(pthread_t))) == NULL) EXIT_UNSQUASH("Out of memory allocating thread descriptors\n"); -diff -urN squashfs4.0/squashfs-tools/unsquashfs.h squashfs4.0.new/squashfs-tools/unsquashfs.h ---- squashfs4.0/squashfs-tools/unsquashfs.h 2009-08-27 21:33:03.000000000 +0200 -+++ squashfs4.0.new/squashfs-tools/unsquashfs.h 2009-08-27 21:44:17.000000000 +0200 -@@ -46,10 +46,12 @@ +--- a/squashfs-tools/unsquashfs.h ++++ b/squashfs-tools/unsquashfs.h +@@ -45,10 +45,12 @@ #include #ifndef linux From 6456a706de91e6ff3309df7eef4e94acb629ea70 Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 2 Nov 2009 14:52:15 +0000 Subject: [PATCH 061/288] squashfs4: use our lzma props settings again instead of the defaults (smaller images on arm/mips) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18273 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- tools/squashfs4/patches/130-lzma_props.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tools/squashfs4/patches/130-lzma_props.patch diff --git a/tools/squashfs4/patches/130-lzma_props.patch b/tools/squashfs4/patches/130-lzma_props.patch new file mode 100644 index 000000000..3ac6b9b03 --- /dev/null +++ b/tools/squashfs4/patches/130-lzma_props.patch @@ -0,0 +1,11 @@ +--- a/squashfs-tools/lzma_wrapper.c ++++ b/squashfs-tools/lzma_wrapper.c +@@ -32,7 +32,7 @@ int lzma_compress(void **strm, char *des + int res; + + res = LzmaCompress(d + LZMA_HEADER_SIZE, &outlen, s, size, d, +- &props_size, 5, block_size, 3, 0, 2, 32, 1); ++ &props_size, 5, block_size, 1, 2, 2, 32, 1); + + if(res == SZ_ERROR_OUTPUT_EOF) { + /* From b2f236b82b51018434550c9434e43f9b923afa7c Mon Sep 17 00:00:00 2001 From: florian Date: Mon, 2 Nov 2009 15:55:16 +0000 Subject: [PATCH 062/288] [adm5120] fix compilation failure of adm5120-dbg.c with the removal of bus_id git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18274 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/adm5120/files/drivers/usb/host/adm5120-dbg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/adm5120/files/drivers/usb/host/adm5120-dbg.c b/target/linux/adm5120/files/drivers/usb/host/adm5120-dbg.c index 482179685..ee148171a 100644 --- a/target/linux/adm5120/files/drivers/usb/host/adm5120-dbg.c +++ b/target/linux/adm5120/files/drivers/usb/host/adm5120-dbg.c @@ -638,7 +638,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf) "%s\n" "%s version " DRIVER_VERSION "\n", hcd->self.controller->bus->name, - hcd->self.controller->bus_id, + dev_name(hcd->self.controller), hcd->product_desc, hcd_name); From fd6919ffec2669531bc980a279b4c7c8b15bb2fd Mon Sep 17 00:00:00 2001 From: florian Date: Mon, 2 Nov 2009 23:05:47 +0000 Subject: [PATCH 063/288] [kernel] refresh patches git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18275 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic-2.6/patches-2.6.30/251-atm.patch | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/target/linux/generic-2.6/patches-2.6.30/251-atm.patch b/target/linux/generic-2.6/patches-2.6.30/251-atm.patch index 07da34425..238d6f81c 100644 --- a/target/linux/generic-2.6/patches-2.6.30/251-atm.patch +++ b/target/linux/generic-2.6/patches-2.6.30/251-atm.patch @@ -1,8 +1,6 @@ -Index: linux-2.6.28.10/include/linux/atm.h -=================================================================== ---- linux-2.6.28.10.orig/include/linux/atm.h 2009-05-02 20:54:43.000000000 +0200 -+++ linux-2.6.28.10/include/linux/atm.h 2009-09-02 15:00:30.000000000 +0200 -@@ -139,6 +139,9 @@ +--- a/include/linux/atm.h ++++ b/include/linux/atm.h +@@ -139,6 +139,9 @@ struct atm_trafprm { int min_pcr; /* minimum PCR in cells per second */ int max_cdv; /* maximum CDV in microseconds */ int max_sdu; /* maximum SDU in bytes */ From 550454d4b6186e712a1b48e27a3dce788dd54ca9 Mon Sep 17 00:00:00 2001 From: florian Date: Mon, 2 Nov 2009 23:07:47 +0000 Subject: [PATCH 064/288] [rdc] forward port r18254 to 2.6.30 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18276 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../arch/x86/include/asm/mach-rdc321x/gpio.h | 59 ++++ .../include/asm/mach-rdc321x/rdc321x_defs.h | 12 + .../arch/x86/mach-rdc321x/Makefile | 5 + .../files-2.6.30/arch/x86/mach-rdc321x/gpio.c | 198 +++++++++++++ .../arch/x86/mach-rdc321x/platform.c | 264 ++++++++++++++++++ .../patches-2.6.30/002-platform_support.patch | 13 + 6 files changed, 551 insertions(+) create mode 100644 target/linux/rdc/files-2.6.30/arch/x86/include/asm/mach-rdc321x/gpio.h create mode 100644 target/linux/rdc/files-2.6.30/arch/x86/include/asm/mach-rdc321x/rdc321x_defs.h create mode 100644 target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/Makefile create mode 100644 target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/gpio.c create mode 100644 target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/platform.c create mode 100644 target/linux/rdc/patches-2.6.30/002-platform_support.patch diff --git a/target/linux/rdc/files-2.6.30/arch/x86/include/asm/mach-rdc321x/gpio.h b/target/linux/rdc/files-2.6.30/arch/x86/include/asm/mach-rdc321x/gpio.h new file mode 100644 index 000000000..873bffe30 --- /dev/null +++ b/target/linux/rdc/files-2.6.30/arch/x86/include/asm/mach-rdc321x/gpio.h @@ -0,0 +1,59 @@ +#ifndef _ASM_X86_MACH_RDC321X_GPIO_H +#define _ASM_X86_MACH_RDC321X_GPIO_H + +#include + +extern int rdc_gpio_get_value(unsigned gpio); +extern void rdc_gpio_set_value(unsigned gpio, int value); +extern int rdc_gpio_direction_input(unsigned gpio); +extern int rdc_gpio_direction_output(unsigned gpio, int value); +extern int rdc_gpio_request(unsigned gpio, const char *label); +extern void rdc_gpio_free(unsigned gpio); + +/* Wrappers for the arch-neutral GPIO API */ + +static inline int gpio_request(unsigned gpio, const char *label) +{ + return rdc_gpio_request(gpio, label); +} + +static inline void gpio_free(unsigned gpio) +{ + might_sleep(); + rdc_gpio_free(gpio); +} + +static inline int gpio_direction_input(unsigned gpio) +{ + return rdc_gpio_direction_input(gpio); +} + +static inline int gpio_direction_output(unsigned gpio, int value) +{ + return rdc_gpio_direction_output(gpio, value); +} + +static inline int gpio_get_value(unsigned gpio) +{ + return rdc_gpio_get_value(gpio); +} + +static inline void gpio_set_value(unsigned gpio, int value) +{ + rdc_gpio_set_value(gpio, value); +} + +static inline int gpio_to_irq(unsigned gpio) +{ + return gpio; +} + +static inline int irq_to_gpio(unsigned irq) +{ + return irq; +} + +/* For cansleep */ +#include + +#endif /* _ASM_X86_MACH_RDC321X_GPIO_H */ diff --git a/target/linux/rdc/files-2.6.30/arch/x86/include/asm/mach-rdc321x/rdc321x_defs.h b/target/linux/rdc/files-2.6.30/arch/x86/include/asm/mach-rdc321x/rdc321x_defs.h new file mode 100644 index 000000000..c8e9c8bed --- /dev/null +++ b/target/linux/rdc/files-2.6.30/arch/x86/include/asm/mach-rdc321x/rdc321x_defs.h @@ -0,0 +1,12 @@ +#define PFX "rdc321x: " + +/* General purpose configuration and data registers */ +#define RDC3210_CFGREG_ADDR 0x0CF8 +#define RDC3210_CFGREG_DATA 0x0CFC + +#define RDC321X_GPIO_CTRL_REG1 0x48 +#define RDC321X_GPIO_CTRL_REG2 0x84 +#define RDC321X_GPIO_DATA_REG1 0x4c +#define RDC321X_GPIO_DATA_REG2 0x88 + +#define RDC321X_MAX_GPIO 58 diff --git a/target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/Makefile b/target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/Makefile new file mode 100644 index 000000000..8325b4ca4 --- /dev/null +++ b/target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/Makefile @@ -0,0 +1,5 @@ +# +# Makefile for the RDC321x specific parts of the kernel +# +obj-$(CONFIG_X86_RDC321X) := gpio.o platform.o + diff --git a/target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/gpio.c b/target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/gpio.c new file mode 100644 index 000000000..c7eff5d2c --- /dev/null +++ b/target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/gpio.c @@ -0,0 +1,198 @@ +/* + * GPIO support for RDC SoC R3210/R8610 + * + * Copyright (C) 2007, Florian Fainelli + * Copyright (C) 2008, Volker Weiss + * + * 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 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + + +#include +#include +#include +#include + +#include +#include + + +/* spin lock to protect our private copy of GPIO data register plus + the access to PCI conf registers. */ +static DEFINE_SPINLOCK(gpio_lock); + +/* copy of GPIO data registers */ +static u32 gpio_data_reg1; +static u32 gpio_data_reg2; + +static u32 gpio_request_data[2]; + + +static inline void rdc321x_conf_write(unsigned addr, u32 value) +{ + outl((1 << 31) | (7 << 11) | addr, RDC3210_CFGREG_ADDR); + outl(value, RDC3210_CFGREG_DATA); +} + +static inline void rdc321x_conf_or(unsigned addr, u32 value) +{ + outl((1 << 31) | (7 << 11) | addr, RDC3210_CFGREG_ADDR); + value |= inl(RDC3210_CFGREG_DATA); + outl(value, RDC3210_CFGREG_DATA); +} + +static inline u32 rdc321x_conf_read(unsigned addr) +{ + outl((1 << 31) | (7 << 11) | addr, RDC3210_CFGREG_ADDR); + + return inl(RDC3210_CFGREG_DATA); +} + +/* configure pin as GPIO */ +static void rdc321x_configure_gpio(unsigned gpio) +{ + unsigned long flags; + + spin_lock_irqsave(&gpio_lock, flags); + rdc321x_conf_or(gpio < 32 + ? RDC321X_GPIO_CTRL_REG1 : RDC321X_GPIO_CTRL_REG2, + 1 << (gpio & 0x1f)); + spin_unlock_irqrestore(&gpio_lock, flags); +} + +/* initially setup the 2 copies of the gpio data registers. + This function is called before the platform setup code. */ +static int __init rdc321x_gpio_setup(void) +{ + /* this might not be, what others (BIOS, bootloader, etc.) + wrote to these registers before, but it's a good guess. Still + better than just using 0xffffffff. */ + + gpio_data_reg1 = rdc321x_conf_read(RDC321X_GPIO_DATA_REG1); + gpio_data_reg2 = rdc321x_conf_read(RDC321X_GPIO_DATA_REG2); + + return 0; +} + +/* determine, if gpio number is valid */ +static inline int rdc321x_is_gpio(unsigned gpio) +{ + return gpio <= RDC321X_MAX_GPIO; +} + +/* request GPIO */ +int rdc_gpio_request(unsigned gpio, const char *label) +{ + unsigned long flags; + + if (!rdc321x_is_gpio(gpio)) + return -EINVAL; + + spin_lock_irqsave(&gpio_lock, flags); + if (gpio_request_data[(gpio & 0x20) ? 1 : 0] & (1 << (gpio & 0x1f))) + goto inuse; + gpio_request_data[(gpio & 0x20) ? 1 : 0] |= (1 << (gpio & 0x1f)); + spin_unlock_irqrestore(&gpio_lock, flags); + + return 0; +inuse: + spin_unlock_irqrestore(&gpio_lock, flags); + return -EINVAL; +} +EXPORT_SYMBOL(rdc_gpio_request); + +/* release previously-claimed GPIO */ +void rdc_gpio_free(unsigned gpio) +{ + unsigned long flags; + + if (!rdc321x_is_gpio(gpio)) + return; + + spin_lock_irqsave(&gpio_lock, flags); + gpio_request_data[(gpio & 0x20) ? 1 : 0] &= ~(1 << (gpio & 0x1f)); + spin_unlock_irqrestore(&gpio_lock, flags); +} +EXPORT_SYMBOL(rdc_gpio_free); + +/* read GPIO pin */ +int rdc_gpio_get_value(unsigned gpio) +{ + u32 reg; + unsigned long flags; + + spin_lock_irqsave(&gpio_lock, flags); + reg = rdc321x_conf_read(gpio < 32 + ? RDC321X_GPIO_DATA_REG1 : RDC321X_GPIO_DATA_REG2); + spin_unlock_irqrestore(&gpio_lock, flags); + + return (1 << (gpio & 0x1f)) & reg ? 1 : 0; +} +EXPORT_SYMBOL(rdc_gpio_get_value); + +/* set GPIO pin to value */ +void rdc_gpio_set_value(unsigned gpio, int value) +{ + unsigned long flags; + u32 reg; + + reg = 1 << (gpio & 0x1f); + if (gpio < 32) { + spin_lock_irqsave(&gpio_lock, flags); + if (value) + gpio_data_reg1 |= reg; + else + gpio_data_reg1 &= ~reg; + rdc321x_conf_write(RDC321X_GPIO_DATA_REG1, gpio_data_reg1); + spin_unlock_irqrestore(&gpio_lock, flags); + } else { + spin_lock_irqsave(&gpio_lock, flags); + if (value) + gpio_data_reg2 |= reg; + else + gpio_data_reg2 &= ~reg; + rdc321x_conf_write(RDC321X_GPIO_DATA_REG2, gpio_data_reg2); + spin_unlock_irqrestore(&gpio_lock, flags); + } +} +EXPORT_SYMBOL(rdc_gpio_set_value); + +/* configure GPIO pin as input */ +int rdc_gpio_direction_input(unsigned gpio) +{ + if (!rdc321x_is_gpio(gpio)) + return -EINVAL; + + rdc321x_configure_gpio(gpio); + + return 0; +} +EXPORT_SYMBOL(rdc_gpio_direction_input); + +/* configure GPIO pin as output and set value */ +int rdc_gpio_direction_output(unsigned gpio, int value) +{ + if (!rdc321x_is_gpio(gpio)) + return -EINVAL; + + gpio_set_value(gpio, value); + rdc321x_configure_gpio(gpio); + + return 0; +} +EXPORT_SYMBOL(rdc_gpio_direction_output); + +arch_initcall(rdc321x_gpio_setup); diff --git a/target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/platform.c b/target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/platform.c new file mode 100644 index 000000000..9eb08c8dd --- /dev/null +++ b/target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/platform.c @@ -0,0 +1,264 @@ +/* + * Generic RDC321x platform devices + * + * Copyright (C) 2007-2008 OpenWrt.org + * Copyright (C) 2007 Florian Fainelli + * Copyright (C) 2008 Daniel Gimpelevich + * + * 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 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/* Flash */ +#ifdef CONFIG_MTD_R8610 +#define CONFIG_MTD_RDC3210 1 +#elif defined CONFIG_MTD_RDC3210 +static struct resource rdc_flash_resource[] = { + [0] = { + .start = (u32)-CONFIG_MTD_RDC3210_SIZE, + .end = (u32)-1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device rdc_flash_device = { + .name = "rdc321x-flash", + .id = -1, + .num_resources = ARRAY_SIZE(rdc_flash_resource), + .resource = rdc_flash_resource, +}; +#else +static struct mtd_partition rdc_flash_parts[15]; + +static struct resource rdc_flash_resource = { + .end = (u32)-1, + .flags = IORESOURCE_MEM, +}; + +static struct physmap_flash_data rdc_flash_data = { + .parts = rdc_flash_parts, +}; + +static struct platform_device rdc_flash_device = { + .name = "physmap-flash", + .id = -1, + .resource = &rdc_flash_resource, + .num_resources = 1, + .dev.platform_data = &rdc_flash_data, +}; +#endif + +/* LEDS */ +static struct gpio_led default_leds[] = { + { .name = "rdc321x:dmz", .gpio = 1, }, +}; + +static struct gpio_led_platform_data rdc321x_led_data = { + .num_leds = ARRAY_SIZE(default_leds), + .leds = default_leds, +}; + +static struct platform_device rdc321x_leds = { + .name = "leds-gpio", + .id = -1, + .dev = { + .platform_data = &rdc321x_led_data, + } +}; + +/* Watchdog */ +static struct platform_device rdc321x_wdt = { + .name = "rdc321x-wdt", + .id = -1, + .num_resources = 0, +}; + +/* Button */ +static struct gpio_keys_button rdc321x_gpio_btn[] = { + { + .gpio = 0, + .code = BTN_0, + .desc = "Reset", + .active_low = 1, + } +}; + +static struct gpio_keys_platform_data rdc321x_gpio_btn_data = { + .buttons = rdc321x_gpio_btn, + .nbuttons = ARRAY_SIZE(rdc321x_gpio_btn), +}; + +static struct platform_device rdc321x_button = { + .name = "gpio-keys", + .id = -1, + .dev = { + .platform_data = &rdc321x_gpio_btn_data, + } +}; + +static struct platform_device *rdc321x_devs[] = { + &rdc_flash_device, + &rdc321x_leds, + &rdc321x_wdt, + &rdc321x_button, +}; + +static int probe_flash_start(struct map_info *the_map) +{ + struct mtd_info *res; + + the_map->virt = ioremap(the_map->phys, the_map->size); + if (the_map->virt == NULL) + return 1; + for (the_map->bankwidth = 32; the_map->bankwidth; the_map->bankwidth + >>= 1) { + res = do_map_probe("cfi_probe", the_map); + if (res == NULL) + res = do_map_probe("jedec_probe", the_map); + if (res != NULL) + break; + } + iounmap(the_map->virt); + if (res != NULL) + the_map->phys = (u32)-(s32)(the_map->size = res->size); + return res == NULL; +} + +static int __init rdc_board_setup(void) +{ +#ifndef CONFIG_MTD_RDC3210 + struct map_info rdc_map_info; + u32 the_header[4]; + + ROOT_DEV = 0; + rdc_map_info.name = rdc_flash_device.name; + rdc_map_info.phys = 0xff000000; + rdc_map_info.size = 0x1000000; + rdc_map_info.bankwidth = 2; + rdc_map_info.set_vpp = NULL; + simple_map_init(&rdc_map_info); + while (probe_flash_start(&rdc_map_info)) { + rdc_map_info.phys++; + if (--rdc_map_info.size) + panic("Could not find start of flash!"); + } + rdc_flash_resource.start = rdc_map_info.phys; + rdc_flash_data.width = rdc_map_info.bankwidth; + rdc_map_info.virt = ioremap_nocache(rdc_map_info.phys, 0x10); + if (rdc_map_info.virt == NULL) + panic("Could not ioremap to read device magic!"); + the_header[0] = ((u32 *)rdc_map_info.virt)[0]; + the_header[1] = ((u32 *)rdc_map_info.virt)[1]; + the_header[2] = ((u32 *)rdc_map_info.virt)[2]; + the_header[3] = ((u32 *)rdc_map_info.virt)[3]; + iounmap(rdc_map_info.virt); + if (!memcmp(the_header, "GMTK", 4)) { /* Gemtek */ + /* TODO */ + } else if (!memcmp(the_header, "CSYS", 4)) { /* Sitecom */ + /* TODO */ + } else if (!memcmp(((u8 *)the_header) + 14, "Li", 2)) { /* AMIT */ + rdc_flash_parts[0].name = "kernel_parthdr"; + rdc_flash_parts[0].offset = 0; + rdc_flash_parts[0].size = 0x10; + rdc_flash_parts[1].name = "kernel"; + rdc_flash_parts[1].offset = 0x10; + rdc_flash_parts[1].size = 0xffff0; + rdc_flash_parts[2].name = "rootfs_parthdr"; + rdc_flash_parts[2].offset = 0x100000; + rdc_flash_parts[2].size = 0x10; + rdc_flash_parts[3].name = "rootfs"; + rdc_flash_parts[3].offset = 0x100010; + rdc_flash_parts[3].size = rdc_map_info.size - 0x160010; + rdc_flash_parts[4].name = "config_parthdr"; + rdc_flash_parts[4].offset = rdc_map_info.size - 0x60000; + rdc_flash_parts[4].size = 0x10; + rdc_flash_parts[5].name = "config"; + rdc_flash_parts[5].offset = rdc_map_info.size - 0x5fff0; + rdc_flash_parts[5].size = 0xfff0; + rdc_flash_parts[6].name = "recoveryfs_parthdr"; + rdc_flash_parts[6].offset = rdc_map_info.size - 0x50000; + rdc_flash_parts[6].size = 0x10; + rdc_flash_parts[7].name = "recoveryfs"; + rdc_flash_parts[7].offset = rdc_map_info.size - 0x4fff0; + rdc_flash_parts[7].size = 0x3fff0; + rdc_flash_parts[8].name = "recovery_parthdr"; + rdc_flash_parts[8].offset = rdc_map_info.size - 0x10000; + rdc_flash_parts[8].size = 0x10; + rdc_flash_parts[9].name = "recovery"; + rdc_flash_parts[9].offset = rdc_map_info.size - 0xfff0; + rdc_flash_parts[9].size = 0x7ff0; + rdc_flash_parts[10].name = "productinfo_parthdr"; + rdc_flash_parts[10].offset = rdc_map_info.size - 0x8000; + rdc_flash_parts[10].size = 0x10; + rdc_flash_parts[11].name = "productinfo"; + rdc_flash_parts[11].offset = rdc_map_info.size - 0x7ff0; + rdc_flash_parts[11].size = 0x1ff0; + rdc_flash_parts[12].name = "bootloader_parthdr"; + rdc_flash_parts[12].offset = rdc_map_info.size - 0x6000; + rdc_flash_parts[12].size = 0x10; + rdc_flash_parts[13].name = "bootloader"; + rdc_flash_parts[13].offset = rdc_map_info.size - 0x5ff0; + rdc_flash_parts[13].size = 0x5ff0; + rdc_flash_parts[14].name = "everything"; + rdc_flash_parts[14].offset = 0; + rdc_flash_parts[14].size = rdc_map_info.size; + rdc_flash_data.nr_parts = 15; + } else { /* ZyXEL */ + rdc_flash_parts[0].name = "kernel"; + rdc_flash_parts[0].offset = 0; + rdc_flash_parts[0].size = 0x100000; + rdc_flash_parts[1].name = "rootfs"; + rdc_flash_parts[1].offset = 0x100000; + rdc_flash_parts[1].size = rdc_map_info.size - 0x140000; + rdc_flash_parts[2].name = "linux"; + rdc_flash_parts[2].offset = 0; + rdc_flash_parts[2].size = rdc_map_info.size - 0x40000; + rdc_flash_parts[3].name = "config"; + rdc_flash_parts[3].offset = rdc_map_info.size - 0x40000; + rdc_flash_parts[3].size = 0x10000; + rdc_flash_parts[4].name = "productinfo"; + rdc_flash_parts[4].offset = rdc_map_info.size - 0x30000; + rdc_flash_parts[4].size = 0x10000; + rdc_flash_parts[5].name = "bootloader"; + rdc_flash_parts[5].offset = rdc_map_info.size - 0x20000; + rdc_flash_parts[5].size = 0x20000; + rdc_flash_data.nr_parts = 6; + } +#endif + return platform_add_devices(rdc321x_devs, ARRAY_SIZE(rdc321x_devs)); +} + +#ifdef CONFIG_MTD_RDC3210 +arch_initcall(rdc_board_setup); +#else +late_initcall(rdc_board_setup); +#endif diff --git a/target/linux/rdc/patches-2.6.30/002-platform_support.patch b/target/linux/rdc/patches-2.6.30/002-platform_support.patch new file mode 100644 index 000000000..74fa95dbe --- /dev/null +++ b/target/linux/rdc/patches-2.6.30/002-platform_support.patch @@ -0,0 +1,13 @@ +--- a/arch/x86/Makefile ++++ b/arch/x86/Makefile +@@ -124,6 +124,10 @@ core-y += $(fcore-y) + # Xen paravirtualization support + core-$(CONFIG_XEN) += arch/x86/xen/ + ++# RDC R-321X support ++cflags-$(CONFIG_X86_RDC321X) := -Iarch/x86/include/asm/mach-rdc321x ++core-$(CONFIG_X86_RDC321X) += arch/x86/mach-rdc321x/ ++ + # lguest paravirtualization support + core-$(CONFIG_LGUEST_GUEST) += arch/x86/lguest/ + From be9a42ea6595d153cf534f98d005302465b2d110 Mon Sep 17 00:00:00 2001 From: florian Date: Mon, 2 Nov 2009 23:10:14 +0000 Subject: [PATCH 065/288] [rdc] add cpu identification patch from bifferos git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18277 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches-2.6.30/010-rdc_cpu_ident.patch | 176 ++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 target/linux/rdc/patches-2.6.30/010-rdc_cpu_ident.patch diff --git a/target/linux/rdc/patches-2.6.30/010-rdc_cpu_ident.patch b/target/linux/rdc/patches-2.6.30/010-rdc_cpu_ident.patch new file mode 100644 index 000000000..79a6c9495 --- /dev/null +++ b/target/linux/rdc/patches-2.6.30/010-rdc_cpu_ident.patch @@ -0,0 +1,176 @@ +--- /dev/null ++++ b/Documentation/x86/rdc.txt +@@ -0,0 +1,69 @@ ++ ++Introduction ++============ ++ ++RDC (http://www.rdc.com.tw) have been manufacturing x86-compatible SoC ++(system-on-chips) for a number of years. They are not the fastest of ++CPUs (clock speeds ranging from 133-150MHz) but 486SX compatibility ++coupled with very low power consumption[1] and low cost make them ideal ++for embedded applications. ++ ++ ++Where to find ++============= ++ ++RDC chips show up in numerous embedded devices, but be careful since ++many of them will not run Linux 2.6 without significant expertise. ++ ++There are several variants of what the linux kernel refers to generically ++as RDC321X: R8610, R321x, S3282 and AMRISC20000. ++ ++R321x: Found in various routers, see the OpenWrt project for details, ++ http://wiki.openwrt.org/oldwiki/rdcport ++ ++R8610: Found on the RDC evaluation board ++ http://www.ivankuten.com/system-on-chip-soc/rdc-r8610/ ++ ++AMRISC20000: Found in the MGB-100 wireless hard disk ++ http://tintuc.no-ip.com/linux/tipps/mgb100/ ++ ++S3282: Found in various NAS devices, including the Bifferboard ++ http://www.bifferos.com ++ ++ ++Kernel Configuration ++==================== ++ ++Add support for this CPU with CONFIG_X86_RDC321X. Ensure that maths ++emulation is included (CONFIG_MATH_EMULATION selected) and avoid MCE ++(CONFIG_X86_MCE not selected). ++ ++ ++CPU detection ++============= ++ ++None of these chips support the cpuid instruction, so as with some ++other x86 compatible SoCs, we must check the north bridge and look ++for specific 'signature' PCI device config. ++ ++The current detection code has been tested only on the Bifferboard ++(S3282 CPU), please send bug reports or success stories with ++other devices to bifferos@yahoo.co.uk. ++ ++ ++Credits ++======= ++ ++Many thanks to RDC for providing the customer codes to allow ++detection of all known variants, without which this detection code ++would have been very hard to ascertain. ++ ++ ++References ++========== ++ ++[1] S3282 in certain NAS solutions consumes less than 1W ++ ++ ++mark@bifferos.com 2009 ++ +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig +@@ -378,6 +378,7 @@ config X86_RDC321X + bool "RDC R-321x SoC" + depends on X86_32 + depends on X86_EXTENDED_PLATFORM ++ select PCI + select M486 + select X86_REBOOTFIXUPS + select EMBEDDED +--- a/arch/x86/include/asm/processor.h ++++ b/arch/x86/include/asm/processor.h +@@ -121,7 +121,8 @@ struct cpuinfo_x86 { + #define X86_VENDOR_CENTAUR 5 + #define X86_VENDOR_TRANSMETA 7 + #define X86_VENDOR_NSC 8 +-#define X86_VENDOR_NUM 9 ++#define X86_VENDOR_RDC 9 ++#define X86_VENDOR_NUM 10 + + #define X86_VENDOR_UNKNOWN 0xff + +--- a/arch/x86/kernel/cpu/Makefile ++++ b/arch/x86/kernel/cpu/Makefile +@@ -22,6 +22,7 @@ obj-$(CONFIG_CPU_SUP_CYRIX_32) += cyrix + obj-$(CONFIG_CPU_SUP_CENTAUR) += centaur.o + obj-$(CONFIG_CPU_SUP_TRANSMETA_32) += transmeta.o + obj-$(CONFIG_CPU_SUP_UMC_32) += umc.o ++obj-$(CONFIG_X86_RDC321X) += rdc.o + + obj-$(CONFIG_X86_MCE) += mcheck/ + obj-$(CONFIG_MTRR) += mtrr/ +--- /dev/null ++++ b/arch/x86/kernel/cpu/rdc.c +@@ -0,0 +1,69 @@ ++/* ++ * See Documentation/x86/rdc.txt ++ * ++ * mark@bifferos.com ++ */ ++ ++#include ++#include ++#include "cpu.h" ++ ++ ++static void __cpuinit rdc_identify(struct cpuinfo_x86 *c) ++{ ++ u16 vendor, device; ++ u32 customer_id; ++ ++ if (!early_pci_allowed()) ++ return; ++ ++ /* RDC CPU is SoC (system-on-chip), Northbridge is always present */ ++ vendor = read_pci_config_16(0, 0, 0, PCI_VENDOR_ID); ++ device = read_pci_config_16(0, 0, 0, PCI_DEVICE_ID); ++ ++ if (vendor != PCI_VENDOR_ID_RDC || device != PCI_DEVICE_ID_RDC_R6020) ++ return; /* not RDC */ ++ /* ++ * NB: We could go on and check other devices, e.g. r6040 NIC, but ++ * that's probably overkill ++ */ ++ ++ customer_id = read_pci_config(0, 0, 0, 0x90); ++ ++ switch (customer_id) { ++ /* id names are from RDC */ ++ case 0x00321000: ++ strcpy(c->x86_model_id, "R3210/R3211"); ++ break; ++ case 0x00321001: ++ strcpy(c->x86_model_id, "AMITRISC20000/20010"); ++ break; ++ case 0x00321002: ++ strcpy(c->x86_model_id, "R3210X/Edimax"); ++ break; ++ case 0x00321003: ++ strcpy(c->x86_model_id, "R3210/Kcodes"); ++ break; ++ case 0x00321004: /* tested */ ++ strcpy(c->x86_model_id, "S3282/CodeTek"); ++ break; ++ case 0x00321007: ++ strcpy(c->x86_model_id, "R8610"); ++ break; ++ default: ++ pr_info("RDC CPU: Unrecognised Customer ID (0x%x) please report to linux-kernel@vger.kernel.org\n", customer_id); ++ return; ++ } ++ ++ strcpy(c->x86_vendor_id, "RDC"); ++ c->x86_vendor = X86_VENDOR_RDC; ++} ++ ++static const struct cpu_dev __cpuinitconst rdc_cpu_dev = { ++ .c_vendor = "RDC", ++ .c_ident = { "RDC" }, ++ .c_identify = rdc_identify, ++ .c_x86_vendor = X86_VENDOR_RDC, ++}; ++ ++cpu_dev_register(rdc_cpu_dev); From f6a11cc55378ee1eb4d7566fb376d31a5bfca933 Mon Sep 17 00:00:00 2001 From: florian Date: Mon, 2 Nov 2009 23:40:12 +0000 Subject: [PATCH 066/288] [olpc] increase the rootdelay value to ensure usb enumeration completes before block2mtd uses /dev/sdX git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18278 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/olpc/image/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/olpc/image/Makefile b/target/linux/olpc/image/Makefile index f60b76e20..7ba712da6 100644 --- a/target/linux/olpc/image/Makefile +++ b/target/linux/olpc/image/Makefile @@ -11,7 +11,7 @@ export PATH=$(TARGET_PATH):/sbin ROOTPART=$(strip $(subst ",, $(CONFIG_OLPC_BOOTSCRIPT_ROOTPART))) #"))")) # fix vim's broken syntax highlighting -ROOTDELAY=5 +ROOTDELAY=10 ifeq ($(CONFIG_OLPC_BOOTSCRIPT_IMAGES),y) define Image/cmdline/squashfs From ea8823c99319e5c11b975d14c95b487d25ec0f3f Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 3 Nov 2009 01:02:39 +0000 Subject: [PATCH 067/288] [x86] merge the olpc target with the x86 target, both tested and running git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18279 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/x86/Makefile | 4 +- target/linux/x86/image/Config.in | 30 +- target/linux/x86/image/Makefile | 46 +- target/linux/x86/image/gen_image_olpc.sh | 35 ++ .../image/{gen_image.sh => gen_image_x86.sh} | 0 target/linux/x86/image/olpc.fth | 5 + .../x86/olpc/base-files/etc/X11/xorg.conf | 71 +++ .../x86/olpc/base-files/etc/config/network | 11 + .../x86/olpc/base-files/etc/preinit.arch | 2 + .../olpc/base-files/lib/upgrade/platform.sh | 27 + target/linux/x86/olpc/config-default | 528 ++++++++++++++++++ target/linux/x86/olpc/target.mk | 2 + .../patches-2.6.30/300-block2mtd_init.patch | 210 +++++++ 13 files changed, 964 insertions(+), 7 deletions(-) create mode 100755 target/linux/x86/image/gen_image_olpc.sh rename target/linux/x86/image/{gen_image.sh => gen_image_x86.sh} (100%) create mode 100644 target/linux/x86/image/olpc.fth create mode 100644 target/linux/x86/olpc/base-files/etc/X11/xorg.conf create mode 100644 target/linux/x86/olpc/base-files/etc/config/network create mode 100644 target/linux/x86/olpc/base-files/etc/preinit.arch create mode 100644 target/linux/x86/olpc/base-files/lib/upgrade/platform.sh create mode 100644 target/linux/x86/olpc/config-default create mode 100644 target/linux/x86/olpc/target.mk create mode 100644 target/linux/x86/patches-2.6.30/300-block2mtd_init.patch diff --git a/target/linux/x86/Makefile b/target/linux/x86/Makefile index 899939581..d7c562522 100644 --- a/target/linux/x86/Makefile +++ b/target/linux/x86/Makefile @@ -10,9 +10,9 @@ ARCH=i386 BOARD:=x86 BOARDNAME:=x86 FEATURES:=squashfs jffs2 ext2 vdi vmdk pcmcia tgz -SUBTARGETS=generic +SUBTARGETS=generic olpc -LINUX_VERSION:=2.6.31.5 +LINUX_VERSION:=2.6.30.9 include $(INCLUDE_DIR)/target.mk diff --git a/target/linux/x86/image/Config.in b/target/linux/x86/image/Config.in index bf1426723..9dd7ae587 100644 --- a/target/linux/x86/image/Config.in +++ b/target/linux/x86/image/Config.in @@ -1,6 +1,6 @@ config X86_GRUB_IMAGES bool "Build GRUB images (Linux x86 or x86_64 host only)" - depends TARGET_x86 + depends TARGET_x86_generic depends TARGET_ROOTFS_EXT2FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS || TARGET_ROOTFS_ISO select PACKAGE_grub default y @@ -38,14 +38,38 @@ config X86_GRUB_BOOTOPTS config X86_VDI_IMAGES bool "Build VirtualBox image files (VDI). Requires VBoxManage" - depends TARGET_x86 + depends TARGET_x86_generic depends TARGET_ROOTFS_EXT2FS depends X86_GRUB_IMAGES select PACKAGE_kmod-pcnet32 config X86_VMDK_IMAGES bool "Build VMware image files (VMDK). Requires qemu-img" - depends TARGET_x86 + depends TARGET_x86_generic depends TARGET_ROOTFS_EXT2FS depends X86_GRUB_IMAGES select PACKAGE_kmod-e1000 + +config OLPC_BOOTSCRIPT_IMAGES + bool "Build images with bootscript" + depends TARGET_x86_olpc + depends TARGET_ROOTFS_EXT2FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS || TARGET_ROOTFS_ISO + default y + +config OLPC_BOOTSCRIPT_IMAGES_PAD + bool "Pad bootscript images to filesystem size (for JFFS2)" + depends OLPC_BOOTSCRIPT_IMAGES + +config OLPC_BOOTSCRIPT_KERNELPART + int "Kernel partition size (in MB)" + depends OLPC_BOOTSCRIPT_IMAGES + default 4 + +config OLPC_BOOTSCRIPT_ROOTPART + string + prompt "Root partition on target device" if OLPC_BOOTSCRIPT_IMAGES + default "/dev/sda2" + help + The root partition on the final device. If you don't know, + you probably want the default (/dev/sda2). + diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile index 6d3c77b77..699dcfe6a 100644 --- a/target/linux/x86/image/Makefile +++ b/target/linux/x86/image/Makefile @@ -8,10 +8,17 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk export PATH=$(TARGET_PATH):/sbin + +ifeq ($(CONFIG_TARGET_x86_generic),y) BOOTOPTS=$(strip $(subst ",, $(CONFIG_X86_GRUB_BOOTOPTS))) ROOTPART=$(strip $(subst ",, $(CONFIG_X86_GRUB_ROOTPART))) #"))")) # fix vim's broken syntax highlighting +endif +ifeq ($(CONFIG_TARGET_x86_olpc),y) +ROOTPART=$(strip $(subst ",, $(CONFIG_OLPC_BOOTSCRIPT_ROOTPART))) +endif +#"))")) # fix vim's broken syntax highlighting ifeq ($(CONFIG_X86_GRUB_IMAGES),y) ifneq ($(HOST_OS),Darwin) @@ -42,7 +49,7 @@ ifneq ($(HOST_OS),Darwin) -e 's#@CMDLINE@#$(strip $(call Image/cmdline/$(1))) $(BOOTOPTS)#g' \ -e 's#@BAUDRATE@#$(CONFIG_X86_GRUB_BAUDRATE)#g' \ ./menu.lst > $(KDIR)/root.grub/boot/grub/menu.lst - PADDING="$(CONFIG_X86_GRUB_IMAGES_PAD)" PATH="$(TARGET_PATH)" ./gen_image.sh $(BIN_DIR)/openwrt-$(BOARD)-$(1).image $(CONFIG_X86_GRUB_KERNELPART) $(KDIR)/root.grub $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1) + PADDING="$(CONFIG_X86_GRUB_IMAGES_PAD)" PATH="$(TARGET_PATH)" ./gen_image_x86.sh $(BIN_DIR)/openwrt-$(BOARD)-$(1).image $(CONFIG_X86_GRUB_KERNELPART) $(KDIR)/root.grub $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1) $(call Image/Build/grub/$(1)) endef @@ -56,7 +63,7 @@ ifneq ($(HOST_OS),Darwin) endef else define Image/Build/grub - PADDING="$(CONFIG_X86_GRUB_IMAGES_PAD)" PATH="$(TARGET_PATH)" NOGRUB=1 ./gen_image.sh $(BIN_DIR)/openwrt-$(BOARD)-$(1).image $(CONFIG_X86_GRUB_KERNELPART) "" $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1) + PADDING="$(CONFIG_X86_GRUB_IMAGES_PAD)" PATH="$(TARGET_PATH)" NOGRUB=1 ./gen_image_x86.sh $(BIN_DIR)/openwrt-$(BOARD)-$(1).image $(CONFIG_X86_GRUB_KERNELPART) "" $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1) endef endif endif @@ -82,9 +89,43 @@ ifeq ($(CONFIG_X86_VMDK_IMAGES),y) endef endif +ROOTDELAY=10 + +ifeq ($(CONFIG_OLPC_BOOTSCRIPT_IMAGES),y) + define Image/cmdline/squashfs + block2mtd.block2mtd=$(ROOTPART),65536,rootfs root=/dev/mtdblock0 rootfstype=squashfs rootdelay=$(ROOTDELAY) + endef + + define Image/cmdline/jffs2-64k + block2mtd.block2mtd=$(ROOTPART),65536,rootfs root=/dev/mtdblock0 rootfstype=jffs2 rootdelay=$(ROOTDELAY) + endef + + define Image/cmdline/jffs2-128k + block2mtd.block2mtd=$(ROOTPART),131072,rootfs root=/dev/mtdblock0 rootfstype=jffs2 rootdelay=$(ROOTDELAY) + endef + + define Image/cmdline/ext2 + root=$(ROOTPART) rootfstype=ext2 rootwait + endef + + define Image/Build/bootscript + # left here because the image builder doesnt need these + $(INSTALL_DIR) $(KDIR)/root.bootscript/boot + $(CP) $(KDIR)/bzImage $(KDIR)/root.bootscript/boot/vmlinuz + sed -e 's#@CMDLINE@#$(strip $(call Image/cmdline/$(1))) $(BOOTOPTS)#g' \ + ./olpc.fth > $(KDIR)/root.bootscript/boot/olpc.fth + PADDING="$(CONFIG_OLPC_BOOTSCRIPT_IMAGES_PAD)" PATH="$(TARGET_PATH)" ./gen_image_olpc.sh $(BIN_DIR)/openwrt-$(BOARD)-$(1).image $(CONFIG_OLPC_BOOTSCRIPT_KERNELPART) $(KDIR)/root.bootscript $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1) + endef +endif + define Image/Prepare $(CP) $(LINUX_DIR)/arch/x86/boot/bzImage $(KDIR)/bzImage +ifeq ($(CONFIG_TARGET_x86_generic),y) $(call Image/Prepare/grub) +endif +ifeq ($(CONFIG_TARGET_x86_olpc),y) + $(call Image/Prepare/bootscript) +endif endef define Image/Build/squashfs @@ -112,6 +153,7 @@ endef define Image/Build $(call Image/Build/$(1)) + $(call Image/Build/bootscript,$(1)) ifneq ($(1),iso) $(call Image/Build/grub,$(1)) $(call Image/Build/vdi,$(1)) diff --git a/target/linux/x86/image/gen_image_olpc.sh b/target/linux/x86/image/gen_image_olpc.sh new file mode 100755 index 000000000..4fd6e377e --- /dev/null +++ b/target/linux/x86/image/gen_image_olpc.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# Copyright (C) 2006 - 2007 OpenWrt.org +set -x +[ $# == 5 ] || { + echo "SYNTAX: $0 " + exit 1 +} + +OUTPUT="$1" +KERNELSIZE="$2" +KERNELDIR="$3" +ROOTFSSIZE="$4" +ROOTFSIMAGE="$5" + +rm -f "$OUTPUT" + +head=16 +sect=63 +cyl=$(( ($KERNELSIZE + $ROOTFSSIZE) * 1024 * 1024 / ($head * $sect * 512))) + +# create partition table +set `ptgen -o "$OUTPUT" -h $head -s $sect -p ${KERNELSIZE}m -p ${ROOTFSSIZE}m` + +KERNELOFFSET="$(($1 / 512))" +KERNELSIZE="$(($2 / 512))" +ROOTFSOFFSET="$(($3 / 512))" +ROOTFSSIZE="$(($4 / 512))" + +BLOCKS="$((($KERNELSIZE / 2) - 1))" + +genext2fs -d "$KERNELDIR" -b "$BLOCKS" "$OUTPUT.kernel" +dd if="$OUTPUT.kernel" of="$OUTPUT" bs=512 seek="$KERNELOFFSET" conv=notrunc +[ -n "$PADDING" ] && dd if=/dev/zero of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc count="$ROOTFSSIZE" +dd if="$ROOTFSIMAGE" of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc +#rm -f "$OUTPUT.kernel" diff --git a/target/linux/x86/image/gen_image.sh b/target/linux/x86/image/gen_image_x86.sh similarity index 100% rename from target/linux/x86/image/gen_image.sh rename to target/linux/x86/image/gen_image_x86.sh diff --git a/target/linux/x86/image/olpc.fth b/target/linux/x86/image/olpc.fth new file mode 100644 index 000000000..5914be660 --- /dev/null +++ b/target/linux/x86/image/olpc.fth @@ -0,0 +1,5 @@ +\ Boot script +" u:\boot\vmlinuz" to boot-device +" @CMDLINE@ noinitrd console=ttyS0,115200 console=tty0" to boot-file +unfreeze +boot diff --git a/target/linux/x86/olpc/base-files/etc/X11/xorg.conf b/target/linux/x86/olpc/base-files/etc/X11/xorg.conf new file mode 100644 index 000000000..d98a8f87a --- /dev/null +++ b/target/linux/x86/olpc/base-files/etc/X11/xorg.conf @@ -0,0 +1,71 @@ +# xorg configuration + +Section "ServerLayout" + Identifier "Default Layout" + Screen 0 "Screen0" 0 0 + InputDevice "Mouse0" "CorePointer" + InputDevice "Keyboard0" "CoreKeyboard" +EndSection + +Section "Files" + FontPath "/usr/lib/X11/fonts/misc" +EndSection + +Section "Module" + Load "dbe" + Load "extmod" + Load "fbdevhw" +# Load "glx" + Load "record" + Load "freetype" + Load "type1" +EndSection + +Section "InputDevice" + Identifier "Keyboard0" + Driver "keyboard" + Option "XkbModel" "pc105" + Option "XkbLayout" "us" +EndSection + +Section "InputDevice" + Identifier "Mouse0" + Driver "mouse" + Option "Protocol" "PS/2" + Option "Device" "/dev/psaux" + Option "ZAxisMapping" "4 5" + Option "Emulate3Buttons" "yes" +EndSection + +Section "Monitor" + Identifier "Monitor0" + VendorName "Monitor Vendor" + ModelName "OWRT" + Option "dpms" +EndSection + +Section "Device" + Identifier "FBDev" + Driver "fbdev" + #Option "shadowfb" "off" + VideoRam 4096 +EndSection + +Section "Screen" + Identifier "Screen0" + Device "FBDev" + Monitor "Monitor0" + DefaultDepth 16 + + SubSection "Display" + Depth 16 + Modes "1200x900-75" + EndSubsection + +EndSection + +Section "DRI" + Group 0 + Mode 0666 +EndSection + diff --git a/target/linux/x86/olpc/base-files/etc/config/network b/target/linux/x86/olpc/base-files/etc/config/network new file mode 100644 index 000000000..faa8f0e78 --- /dev/null +++ b/target/linux/x86/olpc/base-files/etc/config/network @@ -0,0 +1,11 @@ +# Copyright (C) 2006 OpenWrt.org + +config interface loopback + option ifname lo + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + +config interface wlan + option ifname eth0 + option proto dhcp diff --git a/target/linux/x86/olpc/base-files/etc/preinit.arch b/target/linux/x86/olpc/base-files/etc/preinit.arch new file mode 100644 index 000000000..f29f0d448 --- /dev/null +++ b/target/linux/x86/olpc/base-files/etc/preinit.arch @@ -0,0 +1,2 @@ +mount -t proc none /proc +grep 'failsafe=' /proc/cmdline && export FAILSAFE=true diff --git a/target/linux/x86/olpc/base-files/lib/upgrade/platform.sh b/target/linux/x86/olpc/base-files/lib/upgrade/platform.sh new file mode 100644 index 000000000..ffd0b93ab --- /dev/null +++ b/target/linux/x86/olpc/base-files/lib/upgrade/platform.sh @@ -0,0 +1,27 @@ +platform_check_image() { + [ "$ARGC" -gt 1 ] && return 1 + + case "$(get_magic_word "$1")" in + 48eb) return 0;; + *) + echo "Invalid image type" + return 1 + ;; + esac +} + +platform_do_upgrade() { + get_image "$1" > /dev/hda + sync +} + +x86_prepare_ext2() { + # if we're running from ext2, we need to make sure that we have a mtd + # partition that points to the active rootfs partition. + # however this only matters if we actually need to preserve the config files + [ "$SAVE_CONFIG" -eq 1 ] && return 0 + grep rootfs /proc/mtd >/dev/null || { + echo /dev/hda2,65536,rootfs > /sys/module/block2mtd/parameters/block2mtd + } +} +append sysupgrade_pre_upgrade x86_prepare_ext2 diff --git a/target/linux/x86/olpc/config-default b/target/linux/x86/olpc/config-default new file mode 100644 index 000000000..f4f32e0a9 --- /dev/null +++ b/target/linux/x86/olpc/config-default @@ -0,0 +1,528 @@ +CONFIG_4KSTACKS=y +# CONFIG_64BIT is not set +CONFIG_ACPI=y +CONFIG_ACPI_AC=y +# CONFIG_ACPI_ASUS is not set +CONFIG_ACPI_BATTERY=y +CONFIG_ACPI_BLACKLIST_YEAR=0 +CONFIG_ACPI_BUTTON=y +# CONFIG_ACPI_CONTAINER is not set +# CONFIG_ACPI_CUSTOM_DSDT is not set +# CONFIG_ACPI_DEBUG is not set +# CONFIG_ACPI_DOCK is not set +CONFIG_ACPI_FAN=y +# CONFIG_ACPI_PCI_SLOT is not set +CONFIG_ACPI_PROCESSOR=y +# CONFIG_ACPI_PROCFS is not set +CONFIG_ACPI_PROCFS_POWER=y +CONFIG_ACPI_PROC_EVENT=y +# CONFIG_ACPI_SBS is not set +CONFIG_ACPI_SLEEP=y +CONFIG_ACPI_SYSFS_POWER=y +CONFIG_ACPI_THERMAL=y +# CONFIG_ACPI_TOSHIBA is not set +# CONFIG_ACPI_WMI is not set +# CONFIG_AGP is not set +# CONFIG_APM is not set +CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" +CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y +CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y +CONFIG_ARCH_HAS_CPU_RELAX=y +CONFIG_ARCH_HAS_DEFAULT_IDLE=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_MAY_HAVE_PC_FDC=y +# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set +CONFIG_ARCH_POPULATES_NODE_MAP=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y +CONFIG_ARCH_SUPPORTS_MSI=y +CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_WANT_FRAME_POINTERS=y +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +# CONFIG_ASUS_LAPTOP is not set +# CONFIG_AUDIT_ARCH is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +CONFIG_BACKLIGHT_GENERIC=y +CONFIG_BACKLIGHT_LCD_SUPPORT=y +# CONFIG_BACKLIGHT_MBP_NVIDIA is not set +# CONFIG_BACKLIGHT_PROGEAR is not set +# CONFIG_BACKLIGHT_SAHARA is not set +# CONFIG_BACKTRACE_SELF_TEST is not set +CONFIG_BASE_SMALL=0 +CONFIG_BATTERY_OLPC=y +CONFIG_BINARY_PRINTF=y +CONFIG_BINFMT_MISC=y +CONFIG_BITREVERSE=y +# CONFIG_BLK_DEV is not set +CONFIG_BLK_DEV_SD=y +CONFIG_BLK_DEV_SR=y +CONFIG_BLK_DEV_SR_VENDOR=y +# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set +CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 +# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set +CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 +# CONFIG_BOOT_PRINTK_DELAY is not set +CONFIG_BOUNCE=y +CONFIG_CAN_PM_TRACE=y +# CONFIG_CC_STACKPROTECTOR is not set +CONFIG_CHR_DEV_SG=y +CONFIG_CLOCKSOURCE_WATCHDOG=y +# CONFIG_CMDLINE_BOOL is not set +# CONFIG_COMPAL_LAPTOP is not set +CONFIG_COMPAT_VDSO=y +CONFIG_CONSOLE_TRANSLATIONS=y +# CONFIG_CPA_DEBUG is not set +CONFIG_CPU_FREQ=y +# CONFIG_CPU_FREQ_DEBUG is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set +# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set +# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_GOV_USERSPACE is not set +CONFIG_CPU_FREQ_STAT=y +# CONFIG_CPU_FREQ_STAT_DETAILS is not set +CONFIG_CPU_FREQ_TABLE=y +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_LADDER=y +CONFIG_CPU_IDLE_GOV_MENU=y +CONFIG_CPU_SUP_AMD=y +# CONFIG_CPU_SUP_CENTAUR is not set +# CONFIG_CPU_SUP_CYRIX_32 is not set +# CONFIG_CPU_SUP_INTEL is not set +# CONFIG_CPU_SUP_TRANSMETA_32 is not set +# CONFIG_CPU_SUP_UMC_32 is not set +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_MANAGER2=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_WORKQUEUE=y +# CONFIG_CS5535_GPIO is not set +# CONFIG_DCDBAS is not set +# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +# CONFIG_DEBUG_BOOT_PARAMS is not set +# CONFIG_DEBUG_BUGVERBOSE is not set +# CONFIG_DEBUG_DEVRES is not set +# CONFIG_DEBUG_DRIVER is not set +# CONFIG_DEBUG_INFO is not set +CONFIG_DEBUG_KERNEL=y +# CONFIG_DEBUG_KOBJECT is not set +# CONFIG_DEBUG_LIST is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_NOTIFIERS is not set +# CONFIG_DEBUG_NX_TEST is not set +# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_DEBUG_PAGEALLOC is not set +# CONFIG_DEBUG_RODATA is not set +# CONFIG_DEBUG_RT_MUTEXES is not set +# CONFIG_DEBUG_SG is not set +# CONFIG_DEBUG_SHIRQ is not set +# CONFIG_DEBUG_SLAB is not set +# CONFIG_DEBUG_SPINLOCK is not set +# CONFIG_DEBUG_SPINLOCK_SLEEP is not set +# CONFIG_DEBUG_STACKOVERFLOW is not set +# CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_DEBUG_VIRTUAL is not set +# CONFIG_DEBUG_VM is not set +# CONFIG_DEBUG_WRITECOUNT is not set +CONFIG_DECOMPRESS_LZMA=y +CONFIG_DEFAULT_IO_DELAY_TYPE=0 +# CONFIG_DELL_RBU is not set +CONFIG_DETECT_HUNG_TASK=y +CONFIG_DETECT_SOFTLOCKUP=y +CONFIG_DEVPORT=y +CONFIG_DISPLAY_SUPPORT=y +# CONFIG_DMA_API_DEBUG is not set +CONFIG_DMI=y +CONFIG_DMIID=y +CONFIG_DOUBLEFAULT=y +CONFIG_DUMMY_CONSOLE=y +CONFIG_EARLY_PRINTK=y +# CONFIG_EARLY_PRINTK_DBGP is not set +# CONFIG_EDAC is not set +# CONFIG_EDD is not set +# CONFIG_EEEPC_LAPTOP is not set +# CONFIG_EFI is not set +CONFIG_ELF_CORE=y +CONFIG_EXT2_FS=y +CONFIG_FAST_CMPXCHG_LOCAL=y +# CONFIG_FAULT_INJECTION is not set +CONFIG_FB=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB_GEODE=y +# CONFIG_FB_GEODE_GX is not set +# CONFIG_FB_GEODE_GX1 is not set +CONFIG_FB_GEODE_LX=y +# CONFIG_FCOE_FNIC is not set +# CONFIG_FIRMWARE_EDID is not set +# CONFIG_FIRMWARE_MEMMAP is not set +CONFIG_FIX_EARLYCON_MEM=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x16=y +CONFIG_FONT_8x8=y +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y +# CONFIG_FRAME_POINTER is not set +CONFIG_FREEZER=y +# CONFIG_FTRACE_STARTUP_TEST is not set +# CONFIG_FTRACE_SYSCALLS is not set +# CONFIG_FUJITSU_LAPTOP is not set +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CMOS_UPDATE=y +# CONFIG_GENERIC_CPU is not set +CONFIG_GENERIC_FIND_FIRST_BIT=y +CONFIG_GENERIC_FIND_LAST_BIT=y +CONFIG_GENERIC_FIND_NEXT_BIT=y +CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y +CONFIG_GENERIC_IOMAP=y +CONFIG_GENERIC_ISA_DMA=y +# CONFIG_GENERIC_TIME_VSYSCALL is not set +CONFIG_GEODE_MFGPT_TIMER=y +# CONFIG_HAMRADIO is not set +# CONFIG_HANGCHECK_TIMER is not set +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +CONFIG_HAVE_AOUT=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_ATOMIC_IOMAP=y +# CONFIG_HAVE_CPUMASK_OF_CPU_MAP is not set +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_DYNAMIC_PER_CPU_AREA=y +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FTRACE_SYSCALLS=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_IDE=y +CONFIG_HAVE_IOREMAP_PROT=y +CONFIG_HAVE_KERNEL_BZIP2=y +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_KVM=y +CONFIG_HAVE_KVM_IRQCHIP=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_HAVE_MLOCK=y +CONFIG_HAVE_MMIOTRACE_SUPPORT=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_SETUP_PER_CPU_AREA=y +CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y +CONFIG_HIBERNATION=y +CONFIG_HID=y +CONFIG_HID_SUPPORT=y +# CONFIG_HIGHMEM4G is not set +# CONFIG_HIGHMEM64G is not set +# CONFIG_HPET is not set +CONFIG_HPET_EMULATE_RTC=y +CONFIG_HPET_TIMER=y +CONFIG_HT_IRQ=y +# CONFIG_HUGETLBFS is not set +CONFIG_HW_CONSOLE=y +CONFIG_HW_RANDOM=y +# CONFIG_HW_RANDOM_AMD is not set +CONFIG_HW_RANDOM_GEODE=y +# CONFIG_HW_RANDOM_INTEL is not set +CONFIG_HW_RANDOM_VIA=y +# CONFIG_I2C is not set +# CONFIG_I8K is not set +# CONFIG_IMA is not set +CONFIG_INITRAMFS_SOURCE="" +CONFIG_INPUT=y +CONFIG_INPUT_EVDEV=y +CONFIG_INPUT_KEYBOARD=y +CONFIG_INPUT_MOUSE=y +CONFIG_INPUT_MOUSEDEV=y +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1200 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=900 +# CONFIG_INPUT_YEALINK is not set +# CONFIG_INTEL_MENLOW is not set +# CONFIG_IOMMU_API is not set +# CONFIG_IOMMU_HELPER is not set +CONFIG_IO_DELAY_0X80=y +# CONFIG_IO_DELAY_0XED is not set +# CONFIG_IO_DELAY_NONE is not set +CONFIG_IO_DELAY_TYPE_0X80=0 +CONFIG_IO_DELAY_TYPE_0XED=1 +CONFIG_IO_DELAY_TYPE_NONE=3 +CONFIG_IO_DELAY_TYPE_UDELAY=2 +# CONFIG_IO_DELAY_UDELAY is not set +# CONFIG_ISA is not set +CONFIG_ISA_DMA_API=y +# CONFIG_ISCSI_IBFT_FIND is not set +# CONFIG_ISDN is not set +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +# CONFIG_KERNEL_BZIP2 is not set +CONFIG_KERNEL_GZIP=y +# CONFIG_KERNEL_LZMA is not set +CONFIG_KEXEC=y +# CONFIG_KEXEC_JUMP is not set +CONFIG_KEYBOARD_ATKBD=y +# CONFIG_KEYBOARD_LKKBD is not set +# CONFIG_KEYBOARD_NEWTON is not set +# CONFIG_KEYBOARD_STOWAWAY is not set +# CONFIG_KEYBOARD_SUNKBD is not set +# CONFIG_KEYBOARD_XTKBD is not set +# CONFIG_KGDB is not set +CONFIG_KTIME_SCALAR=y +CONFIG_LCD_CLASS_DEVICE=y +# CONFIG_LCD_ILI9320 is not set +# CONFIG_LCD_PLATFORM is not set +# CONFIG_LEDS_ALIX2 is not set +# CONFIG_LEDS_CLEVO_MAIL is not set +# CONFIG_LOCK_STAT is not set +# CONFIG_LOGO is not set +# CONFIG_M386 is not set +# CONFIG_M486 is not set +# CONFIG_M586 is not set +# CONFIG_M586MMX is not set +# CONFIG_M586TSC is not set +# CONFIG_M686 is not set +# CONFIG_MACINTOSH_DRIVERS is not set +CONFIG_MARKERS=y +# CONFIG_MATH_EMULATION is not set +# CONFIG_MCA is not set +# CONFIG_MCORE2 is not set +# CONFIG_MCRUSOE is not set +# CONFIG_MCYRIXIII is not set +# CONFIG_MEFFICEON is not set +# CONFIG_MEMTEST is not set +# CONFIG_MGEODEGX1 is not set +CONFIG_MGEODE_LX=y +# CONFIG_MICROCODE is not set +# CONFIG_MISC_DEVICES is not set +# CONFIG_MK6 is not set +# CONFIG_MK7 is not set +# CONFIG_MK8 is not set +CONFIG_MMC=y +CONFIG_MMC_BLOCK=y +CONFIG_MMC_SDHCI=y +# CONFIG_MMIOTRACE is not set +# CONFIG_MOUSE_BCM5974 is not set +CONFIG_MOUSE_PS2=y +CONFIG_MOUSE_PS2_ALPS=y +# CONFIG_MOUSE_PS2_ELANTECH is not set +CONFIG_MOUSE_PS2_LIFEBOOK=y +CONFIG_MOUSE_PS2_LOGIPS2PP=y +CONFIG_MOUSE_PS2_OLPC=y +CONFIG_MOUSE_PS2_SYNAPTICS=y +# CONFIG_MOUSE_PS2_TOUCHKIT is not set +CONFIG_MOUSE_PS2_TRACKPOINT=y +# CONFIG_MOUSE_SERIAL is not set +# CONFIG_MOUSE_VSXXXAA is not set +# CONFIG_MPENTIUM4 is not set +# CONFIG_MPENTIUMII is not set +# CONFIG_MPENTIUMIII is not set +# CONFIG_MPENTIUMM is not set +# CONFIG_MPSC is not set +# CONFIG_MSI_LAPTOP is not set +CONFIG_MTD_BLOCK2MTD=y +# CONFIG_MTD_CFI is not set +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_PCI=y +# CONFIG_MTD_TS5500 is not set +# CONFIG_MTRR is not set +# CONFIG_MVIAC3_2 is not set +# CONFIG_MVIAC7 is not set +# CONFIG_MWINCHIP3D is not set +# CONFIG_MWINCHIPC6 is not set +# CONFIG_NETDEV_1000 is not set +# CONFIG_NETWORK_FILESYSTEMS is not set +# CONFIG_NET_DROP_MONITOR is not set +# CONFIG_NET_ETHERNET is not set +CONFIG_NOHIGHMEM=y +CONFIG_NOP_TRACER=y +CONFIG_NO_HZ=y +CONFIG_NR_CPUS=1 +# CONFIG_NSC_GPIO is not set +CONFIG_NVRAM=y +CONFIG_OLPC=y +CONFIG_OPROFILE=y +# CONFIG_OPTIMIZE_INLINING is not set +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PAGE_OFFSET=0xC0000000 +# CONFIG_PANASONIC_LAPTOP is not set +# CONFIG_PARAVIRT_GUEST is not set +# CONFIG_PARTITION_ADVANCED is not set +# CONFIG_PC8736x_GPIO is not set +CONFIG_PCI=y +# CONFIG_PCIEPORTBUS is not set +# CONFIG_PCI_DEBUG is not set +CONFIG_PCI_DIRECT=y +CONFIG_PCI_DOMAINS=y +# CONFIG_PCI_GOANY is not set +# CONFIG_PCI_GOBIOS is not set +# CONFIG_PCI_GODIRECT is not set +# CONFIG_PCI_GOMMCONFIG is not set +CONFIG_PCI_GOOLPC=y +CONFIG_PCI_OLPC=y +CONFIG_PCSPKR_PLATFORM=y +# CONFIG_PDA_POWER is not set +CONFIG_PHYSICAL_ALIGN=0x100000 +CONFIG_PHYSICAL_START=0x100000 +CONFIG_PM=y +CONFIG_PM_DEBUG=y +CONFIG_PM_SLEEP=y +CONFIG_PM_STD_PARTITION="" +# CONFIG_PM_TRACE_RTC is not set +# CONFIG_PM_VERBOSE is not set +CONFIG_PNP=y +CONFIG_PNPACPI=y +CONFIG_PNP_DEBUG_MESSAGES=y +CONFIG_POWER_SUPPLY=y +# CONFIG_POWER_SUPPLY_DEBUG is not set +# CONFIG_POWER_TRACER is not set +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_VOLUNTARY=y +CONFIG_PROCESSOR_SELECT=y +CONFIG_PROFILING=y +# CONFIG_PROVE_LOCKING is not set +# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set +# CONFIG_RCU_TORTURE_TEST is not set +CONFIG_RELAY=y +# CONFIG_RELOCATABLE is not set +CONFIG_RING_BUFFER=y +CONFIG_RTC=y +# CONFIG_RT_MUTEX_TESTER is not set +# CONFIG_RWSEM_GENERIC_SPINLOCK is not set +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_SCHEDSTATS=y +CONFIG_SCHED_DEBUG=y +CONFIG_SCHED_HRTICK=y +CONFIG_SCHED_OMIT_FRAME_POINTER=y +CONFIG_SCSI=y +# CONFIG_SCx200 is not set +# CONFIG_SDIO_UART is not set +# CONFIG_SERIAL_8250_EXTENDED is not set +CONFIG_SERIAL_8250_PCI=y +CONFIG_SERIAL_8250_PNP=y +CONFIG_SERIO=y +# CONFIG_SERIO_CT82C710 is not set +CONFIG_SERIO_I8042=y +CONFIG_SERIO_LIBPS2=y +# CONFIG_SERIO_PCIPS2 is not set +# CONFIG_SERIO_RAW is not set +CONFIG_SERIO_SERPORT=y +# CONFIG_SLOW_WORK is not set +# CONFIG_SMP is not set +# CONFIG_SONYPI is not set +CONFIG_SPARSEMEM_STATIC=y +# CONFIG_SPARSE_IRQ is not set +CONFIG_STACKTRACE=y +CONFIG_STRICT_DEVMEM=y +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +# CONFIG_SYSPROF_TRACER is not set +# CONFIG_TC1100_WMI is not set +# CONFIG_TELCLOCK is not set +CONFIG_THERMAL=y +# CONFIG_THINKPAD_ACPI is not set +CONFIG_TICK_ONESHOT=y +CONFIG_TIMER_STATS=y +# CONFIG_TOSHIBA is not set +CONFIG_TRACEPOINTS=y +CONFIG_TRACING=y +CONFIG_TRACING_SUPPORT=y +CONFIG_UID16=y +CONFIG_USB=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_TT_NEWSCHED=y +# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set +# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set +CONFIG_USB_OHCI_HCD=y +CONFIG_USB_STORAGE=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_SUSPEND=y +CONFIG_USB_UHCI_HCD=y +CONFIG_USER_STACKTRACE_SUPPORT=y +CONFIG_VGACON_SOFT_SCROLLBACK=y +CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=64 +CONFIG_VGA_CONSOLE=y +CONFIG_VM86=y +# CONFIG_VMSPLIT_2G_OPT is not set +# CONFIG_VMSPLIT_3G_OPT is not set +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +# CONFIG_VT_HW_CONSOLE_BINDING is not set +# CONFIG_WATCHDOG is not set +CONFIG_X86=y +CONFIG_X86_32=y +CONFIG_X86_32_LAZY_GS=y +# CONFIG_X86_64 is not set +# CONFIG_X86_ACPI_CPUFREQ is not set +CONFIG_X86_BSWAP=y +# CONFIG_X86_CHECK_BIOS_CORRUPTION is not set +CONFIG_X86_CMPXCHG=y +CONFIG_X86_CPU=y +# CONFIG_X86_CPUFREQ_NFORCE2 is not set +# CONFIG_X86_CPUID is not set +# CONFIG_X86_CPU_DEBUG is not set +CONFIG_X86_DEBUGCTLMSR=y +# CONFIG_X86_DS is not set +# CONFIG_X86_ELAN is not set +CONFIG_X86_EXTENDED_PLATFORM=y +# CONFIG_X86_E_POWERSAVER is not set +CONFIG_X86_GENERIC=y +# CONFIG_X86_GX_SUSPMOD is not set +CONFIG_X86_INTEL_USERCOPY=y +CONFIG_X86_INTERNODE_CACHE_BYTES=64 +CONFIG_X86_INVLPG=y +CONFIG_X86_IO_APIC=y +CONFIG_X86_L1_CACHE_BYTES=64 +CONFIG_X86_L1_CACHE_SHIFT=5 +CONFIG_X86_LOCAL_APIC=y +# CONFIG_X86_LONGHAUL is not set +# CONFIG_X86_LONGRUN is not set +# CONFIG_X86_MCE is not set +CONFIG_X86_MINIMUM_CPU_FAMILY=4 +CONFIG_X86_MPPARSE=y +# CONFIG_X86_MSR is not set +# CONFIG_X86_P4_CLOCKMOD is not set +# CONFIG_X86_PAE is not set +CONFIG_X86_PLATFORM_DEVICES=y +CONFIG_X86_PM_TIMER=y +CONFIG_X86_POPAD_OK=y +# CONFIG_X86_POWERNOW_K6 is not set +# CONFIG_X86_POWERNOW_K7 is not set +# CONFIG_X86_POWERNOW_K8 is not set +# CONFIG_X86_PTDUMP is not set +# CONFIG_X86_RDC321X is not set +# CONFIG_X86_REBOOTFIXUPS is not set +# CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS is not set +# CONFIG_X86_RESERVE_LOW_64K is not set +# CONFIG_X86_SPEEDSTEP_CENTRINO is not set +# CONFIG_X86_SPEEDSTEP_ICH is not set +# CONFIG_X86_SPEEDSTEP_LIB is not set +# CONFIG_X86_SPEEDSTEP_SMI is not set +CONFIG_X86_TSC=y +CONFIG_X86_UP_APIC=y +CONFIG_X86_UP_IOAPIC=y +CONFIG_X86_USE_3DNOW=y +CONFIG_X86_USE_PPRO_CHECKSUM=y +CONFIG_X86_VERBOSE_BOOTUP=y +CONFIG_X86_WP_WORKS_OK=y +CONFIG_X86_XADD=y +# CONFIG_ZONE_DMA32 is not set diff --git a/target/linux/x86/olpc/target.mk b/target/linux/x86/olpc/target.mk new file mode 100644 index 000000000..9ed2edc9e --- /dev/null +++ b/target/linux/x86/olpc/target.mk @@ -0,0 +1,2 @@ +BOARDNAME:=OLPC XO-1 +DEFAULT_PACKAGES += kmod-natsemi kmod-ne2k-pci kmod-libertas diff --git a/target/linux/x86/patches-2.6.30/300-block2mtd_init.patch b/target/linux/x86/patches-2.6.30/300-block2mtd_init.patch new file mode 100644 index 000000000..12165b52b --- /dev/null +++ b/target/linux/x86/patches-2.6.30/300-block2mtd_init.patch @@ -0,0 +1,210 @@ +--- a/arch/x86/kernel/vmlinux_32.lds.S ++++ b/arch/x86/kernel/vmlinux_32.lds.S +@@ -136,6 +136,12 @@ SECTIONS + INITCALLS + __initcall_end = .; + } ++ .root_initcall.init : AT(ADDR(.root_initcall.init) - LOAD_OFFSET) { ++ __root_initcall_start = .; ++ INITCALLS_ROOT ++ __root_initcall_end = .; ++ } ++ + .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) { + __con_initcall_start = .; + *(.con_initcall.init) +--- a/drivers/mtd/devices/block2mtd.c ++++ b/drivers/mtd/devices/block2mtd.c +@@ -18,10 +18,18 @@ + #include + #include + #include ++#include ++#include + + #define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args) + #define INFO(fmt, args...) printk(KERN_INFO "block2mtd: " fmt "\n" , ## args) + ++struct retry { ++ struct list_head list; ++ const char *val; ++}; ++ ++static LIST_HEAD(retry_list); + + /* Info for the block device */ + struct block2mtd_dev { +@@ -33,10 +41,34 @@ struct block2mtd_dev { + char devname[0]; + }; + ++static int block2mtd_setup2(const char *val); + + /* Static info about the MTD, used in cleanup_module */ + static LIST_HEAD(blkmtd_device_list); + ++static int add_retry(const char *val) { ++ struct retry *r = kmalloc(sizeof(struct retry), GFP_KERNEL); ++ ++ INIT_LIST_HEAD(&r->list); ++ r->val = val; ++ list_add(&r->list, &retry_list); ++ ++ return 0; ++} ++ ++static int __init process_retries(void) { ++ struct list_head *p, *tmp; ++ ++ list_for_each_safe(p, tmp, &retry_list) { ++ struct retry *r = list_entry(p, struct retry, list); ++ block2mtd_setup2(r->val); ++ msleep(100); ++ list_del(p); ++ kfree(r); ++ } ++ return 0; ++} ++rootfs_initcall(process_retries); + + static struct page *page_read(struct address_space *mapping, int index) + { +@@ -510,7 +542,9 @@ static int block2mtd_setup2(const char * + if (token[2] && (strlen(token[2]) + 1 > 80)) + parse_err("mtd device name too long"); + +- add_device(name, erase_size, token[2]); ++ if (add_device(name, erase_size, token[2]) == NULL) { ++ add_retry(val); ++ } + + return 0; + } +--- a/include/asm-generic/vmlinux.lds.h ++++ b/include/asm-generic/vmlinux.lds.h +@@ -447,12 +447,14 @@ + *(.initcall4s.init) \ + *(.initcall5.init) \ + *(.initcall5s.init) \ +- *(.initcallrootfs.init) \ + *(.initcall6.init) \ + *(.initcall6s.init) \ + *(.initcall7.init) \ + *(.initcall7s.init) + ++#define INITCALLS_ROOT \ ++ *(.initcallrootfs.init) ++ + /** + * PERCPU_VADDR - define output section for percpu area + * @vaddr: explicit base address (optional) +--- a/init/do_mounts.c ++++ b/init/do_mounts.c +@@ -176,16 +176,8 @@ static int __init fs_names_setup(char *s + return 1; + } + +-static unsigned int __initdata root_delay; +-static int __init root_delay_setup(char *str) +-{ +- root_delay = simple_strtoul(str, NULL, 0); +- return 1; +-} +- + __setup("rootflags=", root_data_setup); + __setup("rootfstype=", fs_names_setup); +-__setup("rootdelay=", root_delay_setup); + + static void __init get_fs_names(char *page) + { +@@ -365,23 +357,6 @@ void __init prepare_namespace(void) + { + int is_floppy; + +- if (root_delay) { +- printk(KERN_INFO "Waiting %dsec before mounting root device...\n", +- root_delay); +- ssleep(root_delay); +- } +- +- /* +- * wait for the known devices to complete their probing +- * +- * Note: this is a potential source of long boot delays. +- * For example, it is not atypical to wait 5 seconds here +- * for the touchpad of a laptop to initialize. +- */ +- wait_for_device_probe(); +- +- md_run_setup(); +- + if (saved_root_name[0]) { + root_device_name = saved_root_name; + if (!strncmp(root_device_name, "mtd", 3) || +--- a/init/main.c ++++ b/init/main.c +@@ -76,6 +76,7 @@ + #ifdef CONFIG_X86_LOCAL_APIC + #include + #endif ++#include "do_mounts.h" + + static int kernel_init(void *); + +@@ -752,12 +753,13 @@ int do_one_initcall(initcall_t fn) + + + extern initcall_t __initcall_start[], __initcall_end[], __early_initcall_end[]; ++extern initcall_t __root_initcall_start[], __root_initcall_end[]; + +-static void __init do_initcalls(void) ++static void __init do_initcalls(initcall_t *start, initcall_t *end) + { + initcall_t *call; + +- for (call = __early_initcall_end; call < __initcall_end; call++) ++ for (call = start; call < end; call++) + do_one_initcall(*call); + + /* Make sure there is no pending stuff from the initcall sequence */ +@@ -779,7 +781,7 @@ static void __init do_basic_setup(void) + usermodehelper_init(); + driver_init(); + init_irq_proc(); +- do_initcalls(); ++ do_initcalls(__early_initcall_end, __initcall_end); + } + + static void __init do_pre_smp_initcalls(void) +@@ -840,6 +842,13 @@ static noinline int init_post(void) + panic("No init found. Try passing init= option to kernel."); + } + ++static unsigned int __initdata root_delay; ++static int __init root_delay_setup(char *str) ++{ ++ root_delay = simple_strtoul(str, NULL, 0); ++ return 1; ++} ++__setup("rootdelay=", root_delay_setup); + static int __init kernel_init(void * unused) + { + lock_kernel(); +@@ -879,7 +888,16 @@ static int __init kernel_init(void * unu + + if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) { + ramdisk_execute_command = NULL; +- prepare_namespace(); ++ if (root_delay) { ++ printk(KERN_INFO "Waiting %desc before mounting root device...\n", ++ root_delay); ++ ssleep(root_delay); ++ } ++ while (driver_probe_done() != 0) ++ msleep(100); ++ md_run_setup(); ++ do_initcalls(__root_initcall_start, __root_initcall_end); ++ prepare_namespace(); + } + + /* From b8f6c2dc9e0013ccf9c052c64193da96a8355610 Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 3 Nov 2009 01:12:20 +0000 Subject: [PATCH 068/288] [x86] use 2.6.31.5, left-over from r18279 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18280 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/x86/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/x86/Makefile b/target/linux/x86/Makefile index d7c562522..e90680799 100644 --- a/target/linux/x86/Makefile +++ b/target/linux/x86/Makefile @@ -12,7 +12,7 @@ BOARDNAME:=x86 FEATURES:=squashfs jffs2 ext2 vdi vmdk pcmcia tgz SUBTARGETS=generic olpc -LINUX_VERSION:=2.6.30.9 +LINUX_VERSION:=2.6.31.5 include $(INCLUDE_DIR)/target.mk From 78015b1b6d9d91f7ccb3f58531f63e3fc498a332 Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 3 Nov 2009 01:12:48 +0000 Subject: [PATCH 069/288] [x86] refresh kernel patches git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18281 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../x86/patches-2.6.30/100-pata_sc1200-wrap.patch | 2 +- .../x86/patches-2.6.30/300-block2mtd_init.patch | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/target/linux/x86/patches-2.6.30/100-pata_sc1200-wrap.patch b/target/linux/x86/patches-2.6.30/100-pata_sc1200-wrap.patch index 691d1ca85..066694b35 100644 --- a/target/linux/x86/patches-2.6.30/100-pata_sc1200-wrap.patch +++ b/target/linux/x86/patches-2.6.30/100-pata_sc1200-wrap.patch @@ -1,6 +1,6 @@ --- a/drivers/ata/pata_sc1200.c +++ b/drivers/ata/pata_sc1200.c -@@ -236,7 +236,7 @@ +@@ -236,7 +236,7 @@ static int sc1200_init_one(struct pci_de .port_ops = &sc1200_port_ops }; /* Can't enable port 2 yet, see top comments */ diff --git a/target/linux/x86/patches-2.6.30/300-block2mtd_init.patch b/target/linux/x86/patches-2.6.30/300-block2mtd_init.patch index 12165b52b..c09432e28 100644 --- a/target/linux/x86/patches-2.6.30/300-block2mtd_init.patch +++ b/target/linux/x86/patches-2.6.30/300-block2mtd_init.patch @@ -69,7 +69,7 @@ static struct page *page_read(struct address_space *mapping, int index) { -@@ -510,7 +542,9 @@ static int block2mtd_setup2(const char * +@@ -511,7 +543,9 @@ static int block2mtd_setup2(const char * if (token[2] && (strlen(token[2]) + 1 > 80)) parse_err("mtd device name too long"); @@ -82,7 +82,7 @@ } --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h -@@ -447,12 +447,14 @@ +@@ -474,12 +474,14 @@ *(.initcall4s.init) \ *(.initcall5.init) \ *(.initcall5s.init) \ @@ -151,7 +151,7 @@ static int kernel_init(void *); -@@ -752,12 +753,13 @@ int do_one_initcall(initcall_t fn) +@@ -753,12 +754,13 @@ int do_one_initcall(initcall_t fn) extern initcall_t __initcall_start[], __initcall_end[], __early_initcall_end[]; @@ -167,7 +167,7 @@ do_one_initcall(*call); /* Make sure there is no pending stuff from the initcall sequence */ -@@ -779,7 +781,7 @@ static void __init do_basic_setup(void) +@@ -780,7 +782,7 @@ static void __init do_basic_setup(void) usermodehelper_init(); driver_init(); init_irq_proc(); @@ -176,7 +176,7 @@ } static void __init do_pre_smp_initcalls(void) -@@ -840,6 +842,13 @@ static noinline int init_post(void) +@@ -841,6 +843,13 @@ static noinline int init_post(void) panic("No init found. Try passing init= option to kernel."); } @@ -190,7 +190,7 @@ static int __init kernel_init(void * unused) { lock_kernel(); -@@ -879,7 +888,16 @@ static int __init kernel_init(void * unu +@@ -880,7 +889,16 @@ static int __init kernel_init(void * unu if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) { ramdisk_execute_command = NULL; From ea913739e983d46b6e57114ce74b2e6efa693eeb Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 3 Nov 2009 01:24:44 +0000 Subject: [PATCH 070/288] [kernel] add more missing configuration symbols git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18282 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic-2.6/config-2.6.30 | 7 +++++++ target/linux/generic-2.6/config-2.6.31 | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/target/linux/generic-2.6/config-2.6.30 b/target/linux/generic-2.6/config-2.6.30 index 8e590b766..6ab9a66bb 100644 --- a/target/linux/generic-2.6/config-2.6.30 +++ b/target/linux/generic-2.6/config-2.6.30 @@ -4,6 +4,7 @@ # CONFIG_9P_FS is not set # CONFIG_ACCESSIBILITY is not set # CONFIG_ACENIC is not set +# CONFIG_ACER_WMI is not set # CONFIG_ACORN_PARTITION is not set # CONFIG_ADAPTEC_STARFIRE is not set # CONFIG_ADFS_FS is not set @@ -1007,6 +1008,9 @@ CONFIG_KMOD=y # CONFIG_LATENCYTOP is not set # CONFIG_LBD is not set # CONFIG_LDM_PARTITION is not set +# CONFIG_LCD_LTV350QV is not set +# CONFIG_LCD_TDO24M is not set +# CONFIG_LCD_VGG2432A4 is not set # CONFIG_LEDS_ALIX is not set # CONFIG_LEDS_BD2802 is not set CONFIG_LEDS_CLASS=y @@ -1807,6 +1811,7 @@ CONFIG_SELECT_MEMORY_MODEL=y # CONFIG_SENSORS_ADT7475 is not set # CONFIG_SENSORS_APPLESMC is not set # CONFIG_SENSORS_ASB100 is not set +# CONFIG_SENSORS_ATK0110 is not set # CONFIG_SENSORS_ATXP1 is not set # CONFIG_SENSORS_CORETEMP is not set # CONFIG_SENSORS_DME1737 is not set @@ -1828,6 +1833,7 @@ CONFIG_SELECT_MEMORY_MODEL=y # CONFIG_SENSORS_IT87 is not set # CONFIG_SENSORS_K8TEMP is not set # CONFIG_SENSORS_LIS3_SPI is not set +# CONFIG_SENSORS_LIS3LV02D is not set # CONFIG_SENSORS_LM63 is not set # CONFIG_SENSORS_LM70 is not set # CONFIG_SENSORS_LM75 is not set @@ -2044,6 +2050,7 @@ CONFIG_SND_VERBOSE_PROCFS=y # CONFIG_SOC_CAMERA is not set # CONFIG_SOFT_WATCHDOG is not set # CONFIG_SOLARIS_X86_PARTITION is not set +# CONFIG_SONY_LAPTOP is not set # CONFIG_SONYPI is not set # CONFIG_SOUND is not set # CONFIG_SOUND_PRIME is not set diff --git a/target/linux/generic-2.6/config-2.6.31 b/target/linux/generic-2.6/config-2.6.31 index 3b4bed5e4..c2bac32f9 100644 --- a/target/linux/generic-2.6/config-2.6.31 +++ b/target/linux/generic-2.6/config-2.6.31 @@ -5,6 +5,7 @@ # CONFIG_AB3100_CORE is not set # CONFIG_ACCESSIBILITY is not set # CONFIG_ACENIC is not set +# CONFIG_ACER_WMI is not set # CONFIG_ACORN_PARTITION is not set # CONFIG_ADAPTEC_STARFIRE is not set # CONFIG_ADFS_FS is not set @@ -1033,6 +1034,9 @@ CONFIG_KMOD=y # CONFIG_LBDAF is not set # CONFIG_LBD is not set # CONFIG_LDM_PARTITION is not set +# CONFIG_LCD_LTV350QV is not set +# CONFIG_LCD_TDO24M is not set +# CONFIG_LCD_VGG2432A4 is not set # CONFIG_LEDS_ALIX is not set # CONFIG_LEDS_BD2802 is not set CONFIG_LEDS_CLASS=y @@ -1849,6 +1853,7 @@ CONFIG_SELECT_MEMORY_MODEL=y # CONFIG_SENSORS_ADT7475 is not set # CONFIG_SENSORS_APPLESMC is not set # CONFIG_SENSORS_ASB100 is not set +# CONFIG_SENSORS_ATK0110 is not set # CONFIG_SENSORS_ATXP1 is not set # CONFIG_SENSORS_CORETEMP is not set # CONFIG_SENSORS_DME1737 is not set @@ -1870,6 +1875,7 @@ CONFIG_SELECT_MEMORY_MODEL=y # CONFIG_SENSORS_IT87 is not set # CONFIG_SENSORS_K8TEMP is not set # CONFIG_SENSORS_LIS3_SPI is not set +# CONFIG_SENSORS_LIS3LV02D is not set # CONFIG_SENSORS_LM63 is not set # CONFIG_SENSORS_LM70 is not set # CONFIG_SENSORS_LM75 is not set @@ -2089,6 +2095,7 @@ CONFIG_SND_VERBOSE_PROCFS=y # CONFIG_SOC_CAMERA is not set # CONFIG_SOFT_WATCHDOG is not set # CONFIG_SOLARIS_X86_PARTITION is not set +# CONFIG_SONY_LAPTOP is not set # CONFIG_SONYPI is not set # CONFIG_SOUND is not set # CONFIG_SOUND_PRIME is not set From 5f33b429e2ec7a5aa0f78cb1d96e22778c6ea5c3 Mon Sep 17 00:00:00 2001 From: kaloz Date: Tue, 3 Nov 2009 10:49:27 +0000 Subject: [PATCH 071/288] add preliminary 2.6.32 support git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18283 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/madwifi/patches/453-procps.patch | 55 + target/linux/generic-2.6/config-2.6.32 | 2666 ++++ .../files-2.6.32/drivers/char/gpio_dev.c | 201 + .../drivers/input/misc/gpio_buttons.c | 209 + .../files-2.6.32/drivers/leds/leds-alix.c | 172 + .../files-2.6.32/drivers/leds/ledtrig-morse.c | 365 + .../drivers/leds/ledtrig-netdev.c | 454 + .../files-2.6.32/include/linux/glamo-engine.h | 27 + .../files-2.6.32/include/linux/glamofb.h | 35 + .../files-2.6.32/include/linux/gpio_buttons.h | 35 + .../files-2.6.32/include/linux/gpio_dev.h | 11 + .../001-squashfs_move_zlib_decomp.patch | 244 + ...2-squashfs_factor_out_remaining_zlib.patch | 317 + ...-squashfs_add_decompressor_framework.patch | 426 + ...4-squashfs_add_decompressor_lzma_lzo.patch | 54 + .../005-squashfs_extra_parameter.patch | 42 + .../006-squashfs_add_lzma.patch | 216 + .../007-squashfs_make_lzma_available.patch | 165 + .../patches-2.6.32/011-mips_boot.patch | 11 + .../012-extra_optimization.patch | 21 + .../patches-2.6.32/013-gcc4_inline_fix.patch | 11 + .../patches-2.6.32/014-samsung_flash | 36 + .../020-mips_multi_machine_support.patch | 168 + .../021-mips_image_cmdline_hack.patch | 28 + .../patches-2.6.32/025-mips_disable_fpu.patch | 155 + .../027-mips_module_reloc.patch | 331 + .../patches-2.6.32/028-module_exports.patch | 115 + .../029-arm_module_unresolved_weak_sym.patch | 13 + .../030-pci_disable_common_quirks.patch | 43 + .../031-ppc_gcc_build_fix.patch | 226 + .../patches-2.6.32/060-block2mtd_init.patch | 110 + .../patches-2.6.32/065-rootfs_split.patch | 624 + .../patches-2.6.32/066-block2mtd_probe.patch | 10 + .../patches-2.6.32/070-redboot_space.patch | 30 + .../071-redboot_boardconfig.patch | 60 + .../080-mtd_plat_nand_chip_fixup.patch | 32 + .../081-mtd_myloader_partition_parser.patch | 35 + .../082-mtd_info_move_forward_decl.patch | 18 + ...td_fix_nand_correct_data_return_code.patch | 12 + .../100-netfilter_layer7_2.21.patch | 2132 +++ .../101-netfilter_layer7_pktmatch.patch | 108 + .../110-netfilter_match_speedup.patch | 121 + .../patches-2.6.32/150-netfilter_imq.patch | 1260 ++ .../180-netfilter_depends.patch | 18 + .../patches-2.6.32/190-netfilter_rtsp.patch | 1366 ++ .../patches-2.6.32/200-sched_esfq.patch | 793 + .../patches-2.6.32/201-jhash3.patch | 227 + .../202-mips-freestanding.patch | 12 + .../patches-2.6.32/203-slab_maxsize.patch | 13 + .../patches-2.6.32/204-jffs2_eofdetect.patch | 132 + .../patches-2.6.32/205-skb_padding.patch | 56 + .../207-powerpc_asm_segment_h.patch | 9 + .../patches-2.6.32/209-mini_fo.patch | 7780 ++++++++++ .../210-mini_fo_2.6.25_fixes.patch | 143 + .../211-mini_fo_2.6.25_dentry_open_war.patch | 66 + .../212-mini_fo_2.6.26_fixes.patch | 37 + .../213-mini_fo_2.6.27_fixes.patch | 41 + .../patches-2.6.32/214-mini_fo_2.6.29.patch | 96 + .../patches-2.6.32/215-mini_fo_2.6.30.patch | 157 + .../patches-2.6.32/219-kobject_uevent.patch | 42 + .../patches-2.6.32/220-sound_kconfig.patch | 11 + .../221-binfmt_elf_gcc4.1.patch | 11 + .../222-partial_eraseblock_write.patch | 146 + .../patches-2.6.32/230-union_mounts.patch | 5203 +++++++ .../231-union_mounts_bind_fix.patch | 11 + .../232-union_mounts_compile_fix.patch | 11 + .../233-jffs2_whiteout_support.patch | 186 + .../234-union_mounts_no_debug.patch | 30 + .../235-union_mount_fixes.patch | 117 + .../240-packet_socket_type.patch | 132 + .../patches-2.6.32/250-pppoe_header_pad.patch | 20 + .../260-extend_pfifo_fast.patch | 144 + .../patches-2.6.32/400-ledtrig_morse.patch | 18 + .../patches-2.6.32/402-ledtrig_netdev.patch | 21 + .../patches-2.6.32/410-gpio_buttons.patch | 31 + .../patches-2.6.32/420-gpiodev.patch | 27 + .../patches-2.6.32/430-scsi_header_fix.patch | 17 + .../patches-2.6.32/510-yaffs_support.patch | 17 + .../511-yaffs-cvs-2009-04-24.patch | 12344 ++++++++++++++++ .../patches-2.6.32/600-phy_extension.patch | 83 + .../patches-2.6.32/620-phy_adm6996.patch | 24 + .../patches-2.6.32/630-phy_packets.patch | 63 + .../patches-2.6.32/650-swconfig.patch | 25 + .../patches-2.6.32/660-phy_mvswitch.patch | 22 + .../patches-2.6.32/670-phy_ip175c.patch | 23 + .../patches-2.6.32/680-phy_ar8216.patch | 23 + .../patches-2.6.32/690-phy_rtl8306.patch | 23 + .../patches-2.6.32/700-rtc7301.patch | 250 + .../patches-2.6.32/750-glamo-headers.patch | 21 + .../801-usb_serial_endpoint_size.patch | 25 + .../840-unable_to_open_console.patch | 11 + .../902-darwin_scripts_include.patch | 102 + .../patches-2.6.32/903-hostap_txpower.patch | 154 + .../patches-2.6.32/903-stddef_include.patch | 17 + .../patches-2.6.32/905-i386_build.patch | 10 + .../920-01-hotpluggable-spi-gpio.patch | 60 + .../920-04-spi-gpio-implement-spi-delay.patch | 58 + .../patches-2.6.32/921-gpio_spi_driver.patch | 366 + .../patches-2.6.32/922-gpiommc.patch | 843 ++ .../923-gpiommc-configfs-locking.patch | 58 + .../patches-2.6.32/924-cs5535_gpio.patch | 102 + .../925-modify-i2c-gpio-initcall-level.patch | 11 + .../940-wireless_mesh_header.patch | 11 + .../951-revert_gcc4_4_fixes.patch | 524 + .../patches-2.6.32/960-arm_lzma_loader.patch | 710 + .../970-ocf_kbuild_integration.patch | 25 + .../patches-2.6.32/971-ocf_20080917.patch | 152 + .../patches-2.6.32/972-ocf_compile_fix.patch | 11 + .../patches-2.6.32/973-ocf_2.6.27_fix.patch | 197 + .../974-ssb_b43_default_on.patch | 11 + .../977-textsearch_kconfig_hacks.patch | 23 + .../978-lib80211_kconfig_hacks.patch | 19 + .../979-crypto_add_kconfig_prompts.patch | 47 + .../patches-2.6.32/980-vm_exports.patch | 134 + .../patches-2.6.32/985-cris-headers.patch | 27 + .../991-ppc4xx_optimization.patch | 31 + .../998-openwrt_lzma_options.patch | 42 + .../999-use_preinit_as_init.patch | 14 + target/linux/ixp4xx/config-2.6.32 | 157 + .../patches-2.6.32/010-ixp43x_pci_fixup.patch | 11 + .../020-gateworks_i2c_pld.patch | 421 + .../050-disable_dmabounce.patch | 164 + .../090-increase_entropy_pools.patch | 15 + ...00-wg302v2_gateway7001_mac_plat_info.patch | 68 + .../patches-2.6.32/105-wg302v1_support.patch | 257 + .../110-pronghorn_series_support.patch | 387 + .../111-pronghorn_swap_uarts.patch | 44 + .../115-sidewinder_support.patch | 282 + .../116-sidewinder_fis_location.patch | 30 + .../patches-2.6.32/120-compex_support.patch | 212 + .../130-wrt300nv2_support.patch | 225 + .../131-wrt300nv2_mac_plat_info.patch | 40 + .../150-lanready_ap1000_support.patch | 200 + .../151-lanready_ap1000_mac_plat_info.patch | 41 + .../162-wg302v1_mem_fixup.patch | 47 + .../170-ixdpg425_mac_plat_info.patch | 41 + .../patches-2.6.32/180-tw5334_support.patch | 284 + .../patches-2.6.32/185-mi424wr_support.patch | 465 + .../patches-2.6.32/190-cambria_support.patch | 553 + .../191-cambria_optional_uart.patch | 217 + .../192-cambria_gpio_device.patch | 46 + .../patches-2.6.32/193-cambria_pld_gpio.patch | 107 + ...01-npe_driver_print_license_location.patch | 11 + .../203-npe_driver_mask_phy_features.patch | 13 + ...05-npe_driver_separate_phy_functions.patch | 119 + ...-npe_driver_add_update_link_function.patch | 98 + .../207-npe_driver_multiphy_support.patch | 155 + .../patches-2.6.32/295-latch_led_driver.patch | 200 + .../patches-2.6.32/300-avila_fetch_mac.patch | 244 + .../ixp4xx/patches-2.6.32/301-avila_led.patch | 171 + .../302-avila_gpio_device.patch | 41 + .../304-ixp4xx_eth_jumboframe.patch | 80 + .../patches-2.6.32/310-gtwx5717_spi_bus.patch | 53 + .../311-gtwx5717_mac_plat_info.patch | 40 + .../312-ixp4xx_pata_optimization.patch | 137 + .../patches-2.6.32/401-avila_pci_dev.patch | 11 + .../patches-2.6.32/402-ixp4xx_gpiolib.patch | 125 + .../patches-2.6.32/500-usr8200_support.patch | 342 + 158 files changed, 51395 insertions(+) create mode 100644 package/madwifi/patches/453-procps.patch create mode 100644 target/linux/generic-2.6/config-2.6.32 create mode 100644 target/linux/generic-2.6/files-2.6.32/drivers/char/gpio_dev.c create mode 100644 target/linux/generic-2.6/files-2.6.32/drivers/input/misc/gpio_buttons.c create mode 100644 target/linux/generic-2.6/files-2.6.32/drivers/leds/leds-alix.c create mode 100644 target/linux/generic-2.6/files-2.6.32/drivers/leds/ledtrig-morse.c create mode 100644 target/linux/generic-2.6/files-2.6.32/drivers/leds/ledtrig-netdev.c create mode 100644 target/linux/generic-2.6/files-2.6.32/include/linux/glamo-engine.h create mode 100644 target/linux/generic-2.6/files-2.6.32/include/linux/glamofb.h create mode 100644 target/linux/generic-2.6/files-2.6.32/include/linux/gpio_buttons.h create mode 100644 target/linux/generic-2.6/files-2.6.32/include/linux/gpio_dev.h create mode 100644 target/linux/generic-2.6/patches-2.6.32/001-squashfs_move_zlib_decomp.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/002-squashfs_factor_out_remaining_zlib.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/003-squashfs_add_decompressor_framework.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/004-squashfs_add_decompressor_lzma_lzo.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/005-squashfs_extra_parameter.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/006-squashfs_add_lzma.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/007-squashfs_make_lzma_available.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/011-mips_boot.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/012-extra_optimization.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/013-gcc4_inline_fix.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/014-samsung_flash create mode 100644 target/linux/generic-2.6/patches-2.6.32/020-mips_multi_machine_support.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/021-mips_image_cmdline_hack.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/025-mips_disable_fpu.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/027-mips_module_reloc.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/028-module_exports.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/029-arm_module_unresolved_weak_sym.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/030-pci_disable_common_quirks.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/031-ppc_gcc_build_fix.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/060-block2mtd_init.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/065-rootfs_split.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/066-block2mtd_probe.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/070-redboot_space.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/071-redboot_boardconfig.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/080-mtd_plat_nand_chip_fixup.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/081-mtd_myloader_partition_parser.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/082-mtd_info_move_forward_decl.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/090-mtd_fix_nand_correct_data_return_code.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/100-netfilter_layer7_2.21.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/101-netfilter_layer7_pktmatch.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/110-netfilter_match_speedup.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/150-netfilter_imq.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/180-netfilter_depends.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/190-netfilter_rtsp.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/200-sched_esfq.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/201-jhash3.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/202-mips-freestanding.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/203-slab_maxsize.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/204-jffs2_eofdetect.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/205-skb_padding.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/207-powerpc_asm_segment_h.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/209-mini_fo.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/210-mini_fo_2.6.25_fixes.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/211-mini_fo_2.6.25_dentry_open_war.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/212-mini_fo_2.6.26_fixes.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/213-mini_fo_2.6.27_fixes.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/214-mini_fo_2.6.29.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/215-mini_fo_2.6.30.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/219-kobject_uevent.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/220-sound_kconfig.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/221-binfmt_elf_gcc4.1.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/222-partial_eraseblock_write.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/230-union_mounts.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/231-union_mounts_bind_fix.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/232-union_mounts_compile_fix.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/233-jffs2_whiteout_support.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/234-union_mounts_no_debug.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/235-union_mount_fixes.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/240-packet_socket_type.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/250-pppoe_header_pad.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/260-extend_pfifo_fast.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/400-ledtrig_morse.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/402-ledtrig_netdev.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/410-gpio_buttons.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/420-gpiodev.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/430-scsi_header_fix.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/510-yaffs_support.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/511-yaffs-cvs-2009-04-24.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/600-phy_extension.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/620-phy_adm6996.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/630-phy_packets.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/650-swconfig.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/660-phy_mvswitch.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/670-phy_ip175c.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/680-phy_ar8216.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/690-phy_rtl8306.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/700-rtc7301.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/750-glamo-headers.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/801-usb_serial_endpoint_size.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/840-unable_to_open_console.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/902-darwin_scripts_include.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/903-hostap_txpower.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/903-stddef_include.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/905-i386_build.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/920-01-hotpluggable-spi-gpio.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/920-04-spi-gpio-implement-spi-delay.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/921-gpio_spi_driver.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/922-gpiommc.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/923-gpiommc-configfs-locking.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/924-cs5535_gpio.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/925-modify-i2c-gpio-initcall-level.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/940-wireless_mesh_header.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/951-revert_gcc4_4_fixes.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/960-arm_lzma_loader.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/970-ocf_kbuild_integration.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/971-ocf_20080917.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/972-ocf_compile_fix.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/973-ocf_2.6.27_fix.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/974-ssb_b43_default_on.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/977-textsearch_kconfig_hacks.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/978-lib80211_kconfig_hacks.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/979-crypto_add_kconfig_prompts.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/980-vm_exports.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/985-cris-headers.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/991-ppc4xx_optimization.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/998-openwrt_lzma_options.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/999-use_preinit_as_init.patch create mode 100644 target/linux/ixp4xx/config-2.6.32 create mode 100644 target/linux/ixp4xx/patches-2.6.32/010-ixp43x_pci_fixup.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/020-gateworks_i2c_pld.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/050-disable_dmabounce.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/090-increase_entropy_pools.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/100-wg302v2_gateway7001_mac_plat_info.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/105-wg302v1_support.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/110-pronghorn_series_support.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/111-pronghorn_swap_uarts.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/115-sidewinder_support.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/116-sidewinder_fis_location.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/120-compex_support.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/130-wrt300nv2_support.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/131-wrt300nv2_mac_plat_info.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/150-lanready_ap1000_support.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/151-lanready_ap1000_mac_plat_info.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/162-wg302v1_mem_fixup.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/170-ixdpg425_mac_plat_info.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/180-tw5334_support.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/185-mi424wr_support.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/190-cambria_support.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/191-cambria_optional_uart.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/192-cambria_gpio_device.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/193-cambria_pld_gpio.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/201-npe_driver_print_license_location.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/203-npe_driver_mask_phy_features.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/205-npe_driver_separate_phy_functions.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/206-npe_driver_add_update_link_function.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/207-npe_driver_multiphy_support.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/295-latch_led_driver.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/300-avila_fetch_mac.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/301-avila_led.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/302-avila_gpio_device.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/304-ixp4xx_eth_jumboframe.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/310-gtwx5717_spi_bus.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/311-gtwx5717_mac_plat_info.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/312-ixp4xx_pata_optimization.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/401-avila_pci_dev.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/402-ixp4xx_gpiolib.patch create mode 100644 target/linux/ixp4xx/patches-2.6.32/500-usr8200_support.patch diff --git a/package/madwifi/patches/453-procps.patch b/package/madwifi/patches/453-procps.patch new file mode 100644 index 000000000..253764055 --- /dev/null +++ b/package/madwifi/patches/453-procps.patch @@ -0,0 +1,55 @@ +--- a/net80211/ieee80211_linux.h 2009-10-04 22:27:05.528151949 +0300 ++++ b/net80211/ieee80211_linux.h 2009-10-04 22:28:06.255777139 +0300 +@@ -640,12 +640,24 @@ + void __user *buffer, size_t *lenp) + #define IEEE80211_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, lenp, ppos) \ + proc_dointvec(ctl, write, filp, buffer, lenp) +-#else ++#define IEEE80211_SYSCTL_PROC_DOSTRING(ctl, write, filp, buffer, lenp, ppos) \ ++ proc_dostring(ctl, write, filp, buffer, lenp) ++#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32) + #define IEEE80211_SYSCTL_DECL(f, ctl, write, filp, buffer, lenp, ppos) \ + f(ctl_table *ctl, int write, struct file *filp, \ + void __user *buffer, size_t *lenp, loff_t *ppos) + #define IEEE80211_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, lenp, ppos) \ + proc_dointvec(ctl, write, filp, buffer, lenp, ppos) ++#define IEEE80211_SYSCTL_PROC_DOSTRING(ctl, write, filp, buffer, lenp, ppos) \ ++ proc_dostring(ctl, write, filp, buffer, lenp, ppos) ++#else /* Linux 2.6.32+ */ ++#define IEEE80211_SYSCTL_DECL(f, ctl, write, filp, buffer, lenp, ppos) \ ++ f(ctl_table *ctl, int write, \ ++ void __user *buffer, size_t *lenp, loff_t *ppos) ++#define IEEE80211_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, lenp, ppos) \ ++ proc_dointvec(ctl, write, buffer, lenp, ppos) ++#define IEEE80211_SYSCTL_PROC_DOSTRING(ctl, write, filp, buffer, lenp, ppos) \ ++ proc_dostring(ctl, write, buffer, lenp, ppos) + #endif + + void ieee80211_virtfs_latevattach(struct ieee80211vap *); +--- a/ath/if_athvar.h 2009-10-04 22:27:05.543151943 +0300 ++++ b/ath/if_athvar.h 2009-10-04 22:27:40.115902053 +0300 +@@ -173,14 +173,22 @@ + proc_dointvec(ctl, write, filp, buffer, lenp) + #define ATH_SYSCTL_PROC_DOSTRING(ctl, write, filp, buffer, lenp, ppos) \ + proc_dostring(ctl, write, filp, buffer, lenp) +-#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) */ ++#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32) + #define ATH_SYSCTL_DECL(f, ctl, write, filp, buffer, lenp, ppos) \ + f(ctl_table *ctl, int write, struct file *filp, \ + void __user *buffer, size_t *lenp, loff_t *ppos) + #define ATH_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, lenp, ppos) \ + proc_dointvec(ctl, write, filp, buffer, lenp, ppos) ++#define ATH_SYSCTL_PROC_DOSTRING(ctl, write, filp, buffer, lenp, ppos) \ ++ proc_dostring(ctl, write, filp, buffer, lenp, ppos) ++#else /* Linux 2.6.32+ */ ++#define ATH_SYSCTL_DECL(f, ctl, write, filp, buffer, lenp, ppos) \ ++ f(ctl_table *ctl, int write, \ ++ void __user *buffer, size_t *lenp, loff_t *ppos) ++#define ATH_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, lenp, ppos) \ ++ proc_dointvec(ctl, write, buffer, lenp, ppos) + #define ATH_SYSCTL_PROC_DOSTRING(ctl, write, filp, buffer, lenp, ppos) \ +- proc_dostring(ctl, write, filp, buffer, lenp, ppos) ++ proc_dostring(ctl, write, buffer, lenp, ppos) + #endif + + #define ATH_TIMEOUT 1000 diff --git a/target/linux/generic-2.6/config-2.6.32 b/target/linux/generic-2.6/config-2.6.32 new file mode 100644 index 000000000..4d1aee1fe --- /dev/null +++ b/target/linux/generic-2.6/config-2.6.32 @@ -0,0 +1,2666 @@ +# CONFIG_6PACK is not set +# CONFIG_8139CP is not set +# CONFIG_8139TOO is not set +# CONFIG_9P_FS is not set +# CONFIG_AB3100_CORE is not set +# CONFIG_ACCESSIBILITY is not set +# CONFIG_ACENIC is not set +# CONFIG_ACORN_PARTITION is not set +# CONFIG_ADAPTEC_STARFIRE is not set +# CONFIG_ADFS_FS is not set +# CONFIG_ADM6996_PHY is not set +# CONFIG_ADM8211 is not set +# CONFIG_AFFS_FS is not set +# CONFIG_AF_RXRPC is not set +# CONFIG_AFS_FS is not set +CONFIG_AIO=y +# CONFIG_AIRO_CS is not set +# CONFIG_AIRO is not set +# CONFIG_ALIM7101_WDT is not set +# CONFIG_ALTERA_PCIE_CHDMA is not set +# CONFIG_AMD8111_ETH is not set +# CONFIG_AMIGA_PARTITION is not set +# CONFIG_ANDROID is not set +CONFIG_ANON_INODES=y +# CONFIG_APPLICOM is not set +# CONFIG_AR8216_PHY is not set +# CONFIG_AR9170_USB is not set +# CONFIG_ARCH_AAEC2000 is not set +# CONFIG_ARCH_AT91 is not set +# CONFIG_ARCH_BCMRING is not set +# CONFIG_ARCH_CLPS711X is not set +# CONFIG_ARCH_DAVINCI is not set +# CONFIG_ARCH_EBSA110 is not set +# CONFIG_ARCH_EP93XX is not set +CONFIG_ARCH_FLATMEM_ENABLE=y +# CONFIG_ARCH_FOOTBRIDGE is not set +# CONFIG_ARCH_GEMINI is not set +# CONFIG_ARCH_H720X is not set +# CONFIG_ARCH_IMX is not set +# CONFIG_ARCH_INTEGRATOR is not set +# CONFIG_ARCH_IOP13XX is not set +# CONFIG_ARCH_IOP32X is not set +# CONFIG_ARCH_IOP33X is not set +# CONFIG_ARCH_IXP2000 is not set +# CONFIG_ARCH_IXP23XX is not set +# CONFIG_ARCH_IXP4XX is not set +# CONFIG_ARCH_KIRKWOOD is not set +# CONFIG_ARCH_KS8695 is not set +# CONFIG_ARCH_L7200 is not set +# CONFIG_ARCH_LH7A40X is not set +# CONFIG_ARCH_LOKI is not set +# CONFIG_ARCH_MMP is not set +# CONFIG_ARCH_MSM is not set +# CONFIG_ARCH_MV78XX0 is not set +# CONFIG_ARCH_MXC is not set +# CONFIG_ARCH_NETX is not set +# CONFIG_ARCH_NOMADIK is not set +# CONFIG_ARCH_NS9XXX is not set +# CONFIG_ARCH_OMAP is not set +# CONFIG_ARCH_ORION5X is not set +# CONFIG_ARCH_PNX4008 is not set +# CONFIG_ARCH_PXA is not set +# CONFIG_ARCH_REALVIEW is not set +# CONFIG_ARCH_RPC is not set +# CONFIG_ARCH_S3C2410 is not set +# CONFIG_ARCH_S3C64XX is not set +# CONFIG_ARCH_S5PC1XX is not set +# CONFIG_ARCH_SA1100 is not set +# CONFIG_ARCH_SHARK is not set +# CONFIG_ARCH_STMP3XXX is not set +# CONFIG_ARCH_U300 is not set +# CONFIG_ARCH_VERSATILE is not set +# CONFIG_ARCH_W90X900 is not set +# CONFIG_ARCNET is not set +# CONFIG_ARM_UNWIND is not set +CONFIG_ARPD=y +# CONFIG_ARTHUR is not set +CONFIG_ASK_IP_FIB_HASH=y +# CONFIG_ASUS_OLED is not set +# CONFIG_ASYNC_TX_DMA is not set +# CONFIG_AT24 is not set +# CONFIG_AT76C50X_USB is not set +# CONFIG_ATA_ACPI is not set +# CONFIG_ATA_GENERIC is not set +# CONFIG_ATA is not set +# CONFIG_ATALK is not set +# CONFIG_ATA_OVER_ETH is not set +# CONFIG_ATARI_PARTITION is not set +CONFIG_ATA_SFF=y +# CONFIG_ATH5K is not set +# CONFIG_ATH9K is not set +# CONFIG_ATL1C is not set +# CONFIG_ATL1E is not set +# CONFIG_ATL1 is not set +# CONFIG_ATL2 is not set +# CONFIG_ATM_AMBASSADOR is not set +CONFIG_ATM_BR2684_IPFILTER=y +# CONFIG_ATM_BR2684 is not set +# CONFIG_ATM_CLIP is not set +CONFIG_ATM_CLIP_NO_ICMP=y +# CONFIG_ATM_DRIVERS is not set +# CONFIG_ATM_DUMMY is not set +# CONFIG_ATMEL is not set +# CONFIG_ATM_ENI is not set +# CONFIG_ATM_FIRESTREAM is not set +# CONFIG_ATM_FORE200E is not set +# CONFIG_ATM_FORE200E_MAYBE is not set +# CONFIG_ATM_HE is not set +# CONFIG_ATM_HORIZON is not set +# CONFIG_ATM_IA is not set +# CONFIG_ATM_IDT77252 is not set +# CONFIG_ATM is not set +# CONFIG_ATM_LANAI is not set +# CONFIG_ATM_LANE is not set +# CONFIG_ATM_MPOA is not set +# CONFIG_ATM_NICSTAR is not set +# CONFIG_ATM_SOLOS is not set +# CONFIG_ATM_TCP is not set +# CONFIG_ATM_ZATM is not set +# CONFIG_AUDIT is not set +# CONFIG_AUTOFS4_FS is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUXDISPLAY is not set +# CONFIG_AX25_DAMA_SLAVE is not set +# CONFIG_AX25 is not set +# CONFIG_AX88796 is not set +# CONFIG_B3DFG is not set +# CONFIG_B43 is not set +# CONFIG_B43LEGACY is not set +# CONFIG_B44 is not set +# CONFIG_BACKLIGHT_LCD_SUPPORT is not set +CONFIG_BASE_FULL=y +# CONFIG_BASLER_EXCITE is not set +# CONFIG_BATTERY_BQ27000_HDQ is not set +# CONFIG_BATTERY_BQ27x00 is not set +# CONFIG_BATTERY_DS2760 is not set +# CONFIG_BATTERY_DS2782 is not set +# CONFIG_BATTERY_MAX17040 is not set +# CONFIG_BAYCOM_EPP is not set +# CONFIG_BAYCOM_PAR is not set +# CONFIG_BAYCOM_SER_FDX is not set +# CONFIG_BAYCOM_SER_HDX is not set +CONFIG_BCM43XX_DEBUG=y +CONFIG_BCM43XX_DMA_AND_PIO_MODE=y +# CONFIG_BCM43XX_DMA_MODE is not set +CONFIG_BCM43XX_DMA=y +# CONFIG_BCM43XX is not set +# CONFIG_BCM43XX_PIO_MODE is not set +CONFIG_BCM43XX_PIO=y +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_BINARY_PRINTF is not set +# CONFIG_BINFMT_AOUT is not set +CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_MISC is not set +# CONFIG_BLINK is not set +# CONFIG_BLK_CPQ_CISS_DA is not set +# CONFIG_BLK_CPQ_DA is not set +# CONFIG_BLK_DEV_3W_XXXX_RAID is not set +# CONFIG_BLK_DEV_4DRIVES is not set +# CONFIG_BLK_DEV_AEC62XX is not set +# CONFIG_BLK_DEV_ALI14XX is not set +# CONFIG_BLK_DEV_ALI15X3 is not set +# CONFIG_BLK_DEV_AMD74XX is not set +# CONFIG_BLK_DEV_ATIIXP is not set +# CONFIG_BLK_DEV_BSG is not set +# CONFIG_BLK_DEV_CMD640 is not set +# CONFIG_BLK_DEV_CMD64X is not set +# CONFIG_BLK_DEV_COW_COMMON is not set +# CONFIG_BLK_DEV_CRYPTOLOOP is not set +# CONFIG_BLK_DEV_CS5520 is not set +# CONFIG_BLK_DEV_CS5530 is not set +# CONFIG_BLK_DEV_CS5535 is not set +# CONFIG_BLK_DEV_CS5536 is not set +# CONFIG_BLK_DEV_CY82C693 is not set +# CONFIG_BLK_DEV_DAC960 is not set +# CONFIG_BLK_DEV_DELKIN is not set +# CONFIG_BLK_DEV_DTC2278 is not set +# CONFIG_BLK_DEV_FD is not set +# CONFIG_BLK_DEV_GENERIC is not set +# CONFIG_BLK_DEV_HD_IDE is not set +# CONFIG_BLK_DEV_HD is not set +# CONFIG_BLK_DEV_HD_ONLY is not set +# CONFIG_BLK_DEV_HPT34X is not set +# CONFIG_BLK_DEV_HPT366 is not set +# CONFIG_BLK_DEV_HT6560B is not set +# CONFIG_BLK_DEV_IDEACPI is not set +# CONFIG_BLK_DEV_IDECD is not set +# CONFIG_BLK_DEV_IDECS is not set +# CONFIG_BLK_DEV_IDEDMA_FORCED is not set +# CONFIG_BLK_DEV_IDEFLOPPY is not set +# CONFIG_BLK_DEV_IDEPCI is not set +# CONFIG_BLK_DEV_IDEPNP is not set +# CONFIG_BLK_DEV_IDE_SATA is not set +# CONFIG_BLK_DEV_IDESCSI is not set +# CONFIG_BLK_DEV_IDETAPE is not set +CONFIG_BLK_DEV_INITRD=y +# CONFIG_BLK_DEV_INTEGRITY is not set +# CONFIG_BLK_DEV_IO_TRACE is not set +# CONFIG_BLK_DEV_IT8172 is not set +# CONFIG_BLK_DEV_IT8213 is not set +# CONFIG_BLK_DEV_IT821X is not set +# CONFIG_BLK_DEV_JMICRON is not set +# CONFIG_BLK_DEV_LOOP is not set +# CONFIG_BLK_DEV_NBD is not set +# CONFIG_BLK_DEV_NS87415 is not set +# CONFIG_BLK_DEV_OFFBOARD is not set +# CONFIG_BLK_DEV_OPTI621 is not set +# CONFIG_BLK_DEV_PDC202XX_NEW is not set +# CONFIG_BLK_DEV_PDC202XX_OLD is not set +# CONFIG_BLK_DEV_PIIX is not set +# CONFIG_BLK_DEV_PLATFORM is not set +# CONFIG_BLK_DEV_QD65XX is not set +# CONFIG_BLK_DEV_RAM is not set +# CONFIG_BLK_DEV_RZ1000 is not set +# CONFIG_BLK_DEV_SC1200 is not set +# CONFIG_BLK_DEV_SD is not set +# CONFIG_BLK_DEV_SIIMAGE is not set +# CONFIG_BLK_DEV_SIS5513 is not set +# CONFIG_BLK_DEV_SL82C105 is not set +# CONFIG_BLK_DEV_SLC90E66 is not set +# CONFIG_BLK_DEV_SR is not set +# CONFIG_BLK_DEV_SVWKS is not set +# CONFIG_BLK_DEV_SX8 is not set +# CONFIG_BLK_DEV_TC86C001 is not set +# CONFIG_BLK_DEV_TRIFLEX is not set +# CONFIG_BLK_DEV_TRM290 is not set +# CONFIG_BLK_DEV_UB is not set +# CONFIG_BLK_DEV_UMC8672 is not set +# CONFIG_BLK_DEV_UMEM is not set +# CONFIG_BLK_DEV_VIA82CXXX is not set +# CONFIG_BLK_DEV_XIP is not set +CONFIG_BLK_DEV=y +CONFIG_BLOCK=y +# CONFIG_BNX2 is not set +# CONFIG_BONDING is not set +# CONFIG_BOOT_TRACER is not set +# CONFIG_BPQETHER is not set +# CONFIG_BRIDGE_EBT_802_3 is not set +# CONFIG_BRIDGE_EBT_AMONG is not set +# CONFIG_BRIDGE_EBT_ARP is not set +# CONFIG_BRIDGE_EBT_ARPREPLY is not set +# CONFIG_BRIDGE_EBT_BROUTE is not set +# CONFIG_BRIDGE_EBT_DNAT is not set +# CONFIG_BRIDGE_EBT_IP6 is not set +# CONFIG_BRIDGE_EBT_IP is not set +# CONFIG_BRIDGE_EBT_LIMIT is not set +# CONFIG_BRIDGE_EBT_LOG is not set +# CONFIG_BRIDGE_EBT_MARK is not set +# CONFIG_BRIDGE_EBT_MARK_T is not set +# CONFIG_BRIDGE_EBT_NFLOG is not set +# CONFIG_BRIDGE_EBT_PKTTYPE is not set +# CONFIG_BRIDGE_EBT_REDIRECT is not set +# CONFIG_BRIDGE_EBT_SNAT is not set +# CONFIG_BRIDGE_EBT_STP is not set +# CONFIG_BRIDGE_EBT_T_FILTER is not set +# CONFIG_BRIDGE_EBT_T_NAT is not set +# CONFIG_BRIDGE_EBT_ULOG is not set +# CONFIG_BRIDGE_EBT_VLAN is not set +# CONFIG_BRIDGE_NETFILTER is not set +# CONFIG_BRIDGE_NF_EBTABLES is not set +CONFIG_BRIDGE=y +# CONFIG_BROADCOM_PHY is not set +CONFIG_BROKEN_ON_SMP=y +# CONFIG_BSD_DISKLABEL is not set +# CONFIG_BSD_PROCESS_ACCT_V3 is not set +CONFIG_BSD_PROCESS_ACCT=y +# CONFIG_BT_BNEP is not set +CONFIG_BT_BNEP_MC_FILTER=y +CONFIG_BT_BNEP_PROTO_FILTER=y +# CONFIG_BT_CMTP is not set +# CONFIG_BT_HCIBCM203X is not set +# CONFIG_BT_HCIBFUSB is not set +# CONFIG_BT_HCIBLUECARD is not set +# CONFIG_BT_HCIBPA10X is not set +# CONFIG_BT_HCIBT3C is not set +# CONFIG_BT_HCIBTSDIO is not set +# CONFIG_BT_HCIBTUART is not set +# CONFIG_BT_HCIBTUSB is not set +# CONFIG_BT_HCIDTL1 is not set +CONFIG_BT_HCIUART_BCSP=y +CONFIG_BT_HCIUART_H4=y +# CONFIG_BT_HCIUART is not set +# CONFIG_BT_HCIUART_LL is not set +# CONFIG_BT_HCIUSB is not set +CONFIG_BT_HCIUSB_SCO=y +# CONFIG_BT_HCIVHCI is not set +# CONFIG_BT_HIDP is not set +# CONFIG_BT is not set +# CONFIG_BT_L2CAP is not set +# CONFIG_BT_RFCOMM is not set +CONFIG_BT_RFCOMM_TTY=y +# CONFIG_BTRFS_FS is not set +# CONFIG_BT_SCO is not set +CONFIG_BUG=y +# CONFIG_C2PORT is not set +# CONFIG_CAN is not set +# CONFIG_CAPI_AVM is not set +# CONFIG_CAPI_EICON is not set +# CONFIG_CAPI_TRACE is not set +CONFIG_CARDBUS=y +# CONFIG_CARDMAN_4000 is not set +# CONFIG_CARDMAN_4040 is not set +# CONFIG_CASSINI is not set +# CONFIG_CB710_CORE is not set +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +# CONFIG_CDROM_PKTCDVD is not set +# CONFIG_CFG80211 is not set +# CONFIG_CGROUPS is not set +# CONFIG_CHELSIO_T1 is not set +# CONFIG_CHELSIO_T3 is not set +# CONFIG_CHR_DEV_OSST is not set +# CONFIG_CHR_DEV_SCH is not set +# CONFIG_CHR_DEV_SG is not set +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CICADA_PHY is not set +# CONFIG_CIFS_DEBUG2 is not set +# CONFIG_CIFS_EXPERIMENTAL is not set +# CONFIG_CIFS is not set +CONFIG_CIFS_POSIX=y +# CONFIG_CIFS_STATS2 is not set +CONFIG_CIFS_STATS=y +# CONFIG_CIFS_WEAK_PW_HASH is not set +# CONFIG_CIFS_XATTR is not set +CONFIG_CLASSIC_RCU=y +CONFIG_CLS_U32_MARK=y +CONFIG_CLS_U32_PERF=y +CONFIG_CMDLINE="" +# CONFIG_CNIC is not set +# CONFIG_CODA_FS is not set +# CONFIG_COMEDI is not set +# CONFIG_COMPAT_BRK is not set +CONFIG_COMPAT_NET_DEV_OPS=y +# CONFIG_CONFIGFS_FS is not set +# CONFIG_CONNECTOR is not set +CONFIG_CONSTRUCTORS=y +# CONFIG_CONTEXT_SWITCH_TRACER is not set +# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set +# CONFIG_CPU_DCACHE_DISABLE is not set +# CONFIG_CPU_IDLE is not set +# CONFIG_CRAMFS is not set +# CONFIG_CRC16 is not set +CONFIG_CRC32=y +# CONFIG_CRC7 is not set +# CONFIG_CRC_CCITT is not set +# CONFIG_CRC_ITU_T is not set +# CONFIG_CRC_T10DIF is not set +CONFIG_CROSSCOMPILE=y +# CONFIG_CRYPTO_AEAD is not set +# CONFIG_CRYPTO_AES_586 is not set +# CONFIG_CRYPTO_AES is not set +CONFIG_CRYPTO_ALGAPI2=y +CONFIG_CRYPTO_ALGAPI=y +# CONFIG_CRYPTO_ANSI_CPRNG is not set +# CONFIG_CRYPTO_ANUBIS is not set +# CONFIG_CRYPTO_ARC4 is not set +# CONFIG_CRYPTO_AUTHENC is not set +# CONFIG_CRYPTO_BLKCIPHER is not set +# CONFIG_CRYPTO_BLOWFISH is not set +# CONFIG_CRYPTO_CAMELLIA is not set +# CONFIG_CRYPTO_CAST5 is not set +# CONFIG_CRYPTO_CAST6 is not set +# CONFIG_CRYPTO_CBC is not set +# CONFIG_CRYPTO_CCM is not set +# CONFIG_CRYPTO_CRC32C_INTEL is not set +# CONFIG_CRYPTO_CRC32C is not set +# CONFIG_CRYPTO_CRYPTD is not set +# CONFIG_CRYPTO_CTR is not set +# CONFIG_CRYPTO_CTS is not set +# CONFIG_CRYPTO_DEFLATE is not set +# CONFIG_CRYPTO_DES is not set +# CONFIG_CRYPTO_DEV_HIFN_795X is not set +# CONFIG_CRYPTO_ECB is not set +# CONFIG_CRYPTO_FCRYPT is not set +# CONFIG_CRYPTO_FIPS is not set +# CONFIG_CRYPTO_GCM is not set +# CONFIG_CRYPTO_GF128MUL is not set +# CONFIG_CRYPTO_GHASH is not set +# CONFIG_CRYPTO_HASH is not set +# CONFIG_CRYPTO_HMAC is not set +# CONFIG_CRYPTO_HW is not set +# CONFIG_CRYPTO_KHAZAD is not set +# CONFIG_CRYPTO_LRW is not set +# CONFIG_CRYPTO_LZO is not set +# CONFIG_CRYPTO_MANAGER2 is not set +# CONFIG_CRYPTO_MANAGER is not set +# CONFIG_CRYPTO_MD4 is not set +# CONFIG_CRYPTO_MD5 is not set +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_NULL is not set +# CONFIG_CRYPTO_PCBC is not set +CONFIG_CRYPTO_PCOMP=y +# CONFIG_CRYPTO_PRNG is not set +# CONFIG_CRYPTO_RMD128 is not set +# CONFIG_CRYPTO_RMD160 is not set +# CONFIG_CRYPTO_RMD256 is not set +# CONFIG_CRYPTO_RMD320 is not set +# CONFIG_CRYPTO_RNG is not set +# CONFIG_CRYPTO_SALSA20_586 is not set +# CONFIG_CRYPTO_SALSA20 is not set +# CONFIG_CRYPTO_SEED is not set +# CONFIG_CRYPTO_SEQIV is not set +# CONFIG_CRYPTO_SERPENT is not set +# CONFIG_CRYPTO_SHA1 is not set +# CONFIG_CRYPTO_SHA256 is not set +# CONFIG_CRYPTO_SHA512 is not set +# CONFIG_CRYPTO_TEA is not set +# CONFIG_CRYPTO_TEST is not set +# CONFIG_CRYPTO_TGR192 is not set +# CONFIG_CRYPTO_TWOFISH_586 is not set +# CONFIG_CRYPTO_TWOFISH_COMMON is not set +# CONFIG_CRYPTO_TWOFISH is not set +CONFIG_CRYPTO_UNLZMA=y +# CONFIG_CRYPTO_VMAC is not set +# CONFIG_CRYPTO_WP512 is not set +# CONFIG_CRYPTO_XCBC is not set +# CONFIG_CRYPTO_XTS is not set +CONFIG_CRYPTO=y +CONFIG_CRYPTO_ZLIB=y +# CONFIG_CUSE is not set +# CONFIG_DAB is not set +# CONFIG_DAVICOM_PHY is not set +# CONFIG_DCB is not set +CONFIG_DEBUG_FS=y +# CONFIG_DEBUG_KERNEL is not set +# CONFIG_DEBUG_MEMORY_INIT is not set +# CONFIG_DECNET is not set +CONFIG_DECOMPRESS_LZMA_NEEDED=y +# CONFIG_DEFAULT_AS is not set +# CONFIG_DEFAULT_BIC is not set +# CONFIG_DEFAULT_CFQ is not set +# CONFIG_DEFAULT_CUBIC is not set +CONFIG_DEFAULT_DEADLINE=y +# CONFIG_DEFAULT_HTCP is not set +CONFIG_DEFAULT_IOSCHED="deadline" +CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 +# CONFIG_DEFAULT_NOOP is not set +# CONFIG_DEFAULT_RENO is not set +CONFIG_DEFAULT_TCP_CONG="westwood" +# CONFIG_DEFAULT_VEGAS is not set +CONFIG_DEFAULT_WESTWOOD=y +CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" +# CONFIG_DEVKMEM is not set +# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_DEVTMPFS=y +# CONFIG_DGRS is not set +# CONFIG_DISCONTIGMEM_MANUAL is not set +# CONFIG_DISPLAY_SUPPORT is not set +# CONFIG_DL2K is not set +# CONFIG_DLM is not set +# CONFIG_DMADEVICES is not set +# CONFIG_DMA_ENGINE is not set +# CONFIG_DMASCC is not set +# CONFIG_DMATEST is not set +# CONFIG_DNET is not set +# CONFIG_DNOTIFY is not set +# CONFIG_DRAGONRISE_FF is not set +# CONFIG_DRM is not set +# CONFIG_DS1682 is not set +# CONFIG_DST is not set +# CONFIG_DTLK is not set +# CONFIG_DUMMY is not set +# CONFIG_DVB_CORE is not set +# CONFIG_DVB is not set +# CONFIG_DYNAMIC_DEBUG is not set +# CONFIG_DYNAMIC_PRINTK_DEBUG is not set +# CONFIG_E1000E is not set +# CONFIG_E1000 is not set +# CONFIG_E100 is not set +# CONFIG_ECHO is not set +# CONFIG_ECONET is not set +# CONFIG_EEPRO100 is not set +# CONFIG_EEPROM_93CX6 is not set +# CONFIG_EEPROM_AT24 is not set +# CONFIG_EEPROM_AT25 is not set +# CONFIG_EEPROM_LEGACY is not set +# CONFIG_EEPROM_MAX6875 is not set +# CONFIG_EFI_PARTITION is not set +# CONFIG_EFS_FS is not set +# CONFIG_ELF_CORE is not set +CONFIG_EMBEDDED=y +# CONFIG_ENABLE_MUST_CHECK is not set +CONFIG_ENABLE_WARN_DEPRECATED=y +# CONFIG_ENC28J60 is not set +# CONFIG_ENCLOSURE_SERVICES is not set +# CONFIG_EPIC100 is not set +CONFIG_EPOLL=y +# CONFIG_EQUALIZER is not set +# CONFIG_ET131X is not set +# CONFIG_ETHOC is not set +CONFIG_EVENTFD=y +# CONFIG_EVENT_TRACER is not set +CONFIG_EXPERIMENTAL=y +# CONFIG_EXPORTFS is not set +# CONFIG_EXT2_FS is not set +# CONFIG_EXT2_FS_XATTR is not set +# CONFIG_EXT2_FS_XIP is not set +# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set +# CONFIG_EXT3_FS is not set +# CONFIG_EXT3_FS_XATTR is not set +# CONFIG_EXT4DEV_FS is not set +# CONFIG_EXT4_FS is not set +CONFIG_EXTRA_FIRMWARE="" +CONFIG_EXTRA_TARGETS="" +# CONFIG_EZX_PCAP is not set +# CONFIG_FAIR_GROUP_SCHED is not set +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" +# CONFIG_FAT_FS is not set +# CONFIG_FB_3DFX is not set +# CONFIG_FB_ARC is not set +# CONFIG_FB_ARK is not set +# CONFIG_FB_ASILIANT is not set +# CONFIG_FB_ATY128 is not set +# CONFIG_FB_ATY is not set +# CONFIG_FB_BACKLIGHT is not set +# CONFIG_FB_BOOT_VESA_SUPPORT is not set +# CONFIG_FB_BROADSHEET is not set +# CONFIG_FB_CARMINE is not set +# CONFIG_FB_CFB_COPYAREA is not set +# CONFIG_FB_CFB_FILLRECT is not set +# CONFIG_FB_CFB_IMAGEBLIT is not set +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set +# CONFIG_FB_CIRRUS is not set +# CONFIG_FB_CYBER2000 is not set +# CONFIG_FB_DDC is not set +# CONFIG_FB_EARLYSUSPEND is not set +# CONFIG_FB_FOREIGN_ENDIAN is not set +# CONFIG_FB_GEODE is not set +# CONFIG_FB_GOLDFISH is not set +# CONFIG_FB_IBM_GXT4500 is not set +# CONFIG_FB_IMSTT is not set +# CONFIG_FB is not set +# CONFIG_FB_KYRO is not set +# CONFIG_FB_MACMODES is not set +# CONFIG_FB_MATROX is not set +# CONFIG_FB_MB862XX is not set +# CONFIG_FB_METRONOME is not set +# CONFIG_FB_MODE_HELPERS is not set +# CONFIG_FB_NEOMAGIC is not set +# CONFIG_FB_NVIDIA is not set +# CONFIG_FB_OF is not set +# CONFIG_FB_PM2 is not set +# CONFIG_FB_PM3 is not set +# CONFIG_FB_PS3 is not set +# CONFIG_FB_PXA is not set +# CONFIG_FB_RADEON is not set +# CONFIG_FB_RIVA is not set +# CONFIG_FB_S1D13XXX is not set +# CONFIG_FB_S3 is not set +# CONFIG_FB_SAVAGE is not set +# CONFIG_FB_SIS is not set +# CONFIG_FB_SVGALIB is not set +# CONFIG_FB_SYS_COPYAREA is not set +# CONFIG_FB_SYS_FILLRECT is not set +# CONFIG_FB_SYS_FOPS is not set +# CONFIG_FB_SYS_IMAGEBLIT is not set +# CONFIG_FB_TILEBLITTING is not set +# CONFIG_FB_TRIDENT is not set +# CONFIG_FB_VGA16 is not set +# CONFIG_FB_VIA is not set +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FB_VOODOO1 is not set +# CONFIG_FB_VT8623 is not set +# CONFIG_FCOE_FNIC is not set +# CONFIG_FCOE is not set +# CONFIG_FDDI is not set +# CONFIG_FEALNX is not set +CONFIG_FIB_RULES=y +CONFIG_FILE_LOCKING=y +# CONFIG_FIREWIRE is not set +# CONFIG_FIRMWARE_IN_KERNEL is not set +# CONFIG_FIXED_PHY is not set +CONFIG_FLATMEM_MANUAL=y +CONFIG_FLATMEM=y +CONFIG_FLAT_NODE_MEM_MAP=y +# CONFIG_FORCEDETH is not set +CONFIG_FRAME_WARN=1024 +# CONFIG_FREEZER is not set +# CONFIG_FSCACHE is not set +CONFIG_FSNOTIFY=y +# CONFIG_FS_POSIX_ACL is not set +# CONFIG_FTL is not set +# CONFIG_FTRACE is not set +# CONFIG_FUNCTION_TRACER is not set +# CONFIG_FUSE_FS is not set +# CONFIG_FUSION_FC is not set +# CONFIG_FUSION is not set +# CONFIG_FUSION_SAS is not set +# CONFIG_FUSION_SPI is not set +CONFIG_FUTEX=y +CONFIG_FW_LOADER=y +CONFIG_GACT_PROB=y +# CONFIG_GAMEPORT is not set +# CONFIG_GCOV_KERNEL is not set +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_GENERIC_HARDIRQS=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_GENERIC_TIME=y +# CONFIG_GFS2_FS is not set +# CONFIG_GPIO_BT8XX is not set +# CONFIG_GPIO_DEVICE is not set +# CONFIG_GPIO_LANGWELL is not set +# CONFIG_GPIOLIB is not set +# CONFIG_GPIO_MAX7301 is not set +# CONFIG_GPIO_MAX732X is not set +# CONFIG_GPIO_MCP23S08 is not set +# CONFIG_GPIO_PCA953X is not set +# CONFIG_GPIO_PCF857X is not set +# CONFIG_GPIO_SYSFS is not set +# CONFIG_GPIO_XILINX is not set +# CONFIG_GREENASIA_FF is not set +# CONFIG_GROUP_SCHED is not set +# CONFIG_HAMACHI is not set +CONFIG_HAMRADIO=y +# CONFIG_HAPPYMEAL is not set +# CONFIG_HAVE_AOUT is not set +CONFIG_HAVE_MLOCKED_PAGE_BIT=y +CONFIG_HAVE_MLOCK=y +# CONFIG_HDLC_CISCO is not set +# CONFIG_HDLC_FR is not set +# CONFIG_HDLC is not set +# CONFIG_HDLC_PPP is not set +# CONFIG_HDLC_RAW_ETH is not set +# CONFIG_HDLC_RAW is not set +# CONFIG_HEADERS_CHECK is not set +# CONFIG_HECI is not set +# CONFIG_HERMES is not set +# CONFIG_HFS_FS is not set +# CONFIG_HFSPLUS_FS is not set +# CONFIG_HID_A4TECH is not set +# CONFIG_HID_APPLE is not set +# CONFIG_HID_BELKIN is not set +# CONFIG_HID_BRIGHT is not set +# CONFIG_HID_CHERRY is not set +# CONFIG_HID_CHICONY is not set +# CONFIG_HID_COMPAT is not set +# CONFIG_HID_CYPRESS is not set +# CONFIG_HID_DEBUG is not set +# CONFIG_HID_DELL is not set +# CONFIG_HID_EZKEY is not set +# CONFIG_HID_FF is not set +# CONFIG_HID_GYRATION is not set +# CONFIG_HID is not set +# CONFIG_HID_KENSINGTON is not set +# CONFIG_HID_KYE is not set +# CONFIG_HID_LOGITECH is not set +# CONFIG_HID_MICROSOFT is not set +# CONFIG_HID_MONTEREY is not set +# CONFIG_HID_NTRIG is not set +# CONFIG_HID_PANTHERLORD is not set +# CONFIG_HID_PETALYNX is not set +# CONFIG_HID_PID is not set +# CONFIG_HIDRAW is not set +# CONFIG_HID_SAMSUNG is not set +# CONFIG_HID_SONY is not set +# CONFIG_HID_SUNPLUS is not set +# CONFIG_HID_SUPPORT is not set +# CONFIG_HID_TOPSEED is not set +# CONFIG_HIGHMEM is not set +CONFIG_HIGH_RES_TIMERS=y +# CONFIG_HIPPI is not set +# CONFIG_HOSTAP_CS is not set +# CONFIG_HOSTAP is not set +# CONFIG_HOSTAP_PCI is not set +# CONFIG_HOSTAP_PLX is not set +# CONFIG_HOTPLUG_CPU is not set +# CONFIG_HOTPLUG_PCI is not set +CONFIG_HOTPLUG=y +# CONFIG_HP100 is not set +# CONFIG_HPFS_FS is not set +# CONFIG_HP_ILO is not set +# CONFIG_HTC_EGPIO is not set +# CONFIG_HTC_PASIC3 is not set +# CONFIG_HUGETLB_PAGE is not set +# CONFIG_HVC_UDBG is not set +# CONFIG_HWMON is not set +# CONFIG_HWMON_VID is not set +# CONFIG_HW_RANDOM_AMD is not set +# CONFIG_HW_RANDOM_GEODE is not set +# CONFIG_HW_RANDOM_INTEL is not set +# CONFIG_HW_RANDOM_TIMERIOMEM is not set +# CONFIG_HW_RANDOM_VIA is not set +CONFIG_HZ=100 +# CONFIG_HZ_1000 is not set +CONFIG_HZ_100=y +# CONFIG_HZ_1024 is not set +# CONFIG_HZ_128 is not set +# CONFIG_HZ_250 is not set +# CONFIG_HZ_256 is not set +# CONFIG_HZ_300 is not set +# CONFIG_HZ_48 is not set +# CONFIG_I2C_ALGOBIT is not set +# CONFIG_I2C_ALGOPCA is not set +# CONFIG_I2C_ALGOPCF is not set +# CONFIG_I2C_ALI1535 is not set +# CONFIG_I2C_ALI1563 is not set +# CONFIG_I2C_ALI15X3 is not set +# CONFIG_I2C_AMD756 is not set +# CONFIG_I2C_AMD8111 is not set +# CONFIG_I2C_CHARDEV is not set +# CONFIG_I2C_COMPAT is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +# CONFIG_I2C_DEBUG_CHIP is not set +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_ELEKTOR is not set +# CONFIG_I2C_GPIO is not set +# CONFIG_I2C_HELPER_AUTO is not set +# CONFIG_I2C_I801 is not set +# CONFIG_I2C_I810 is not set +# CONFIG_I2C_IBM_IIC is not set +# CONFIG_I2C_ISCH is not set +# CONFIG_I2C_MPC is not set +# CONFIG_I2C_NFORCE2 is not set +# CONFIG_I2C_OCORES is not set +# CONFIG_I2C_PARPORT_LIGHT is not set +# CONFIG_I2C_PCA_ISA is not set +# CONFIG_I2C_PCA_PLATFORM is not set +# CONFIG_I2C_PIIX4 is not set +# CONFIG_I2C_PROSAVAGE is not set +# CONFIG_I2C_SAVAGE4 is not set +# CONFIG_I2C_SIMTEC is not set +# CONFIG_I2C_SIS5595 is not set +# CONFIG_I2C_SIS630 is not set +# CONFIG_I2C_SIS96X is not set +# CONFIG_I2C_STUB is not set +# CONFIG_I2C_TAOS_EVM is not set +# CONFIG_I2C_TINY_USB is not set +# CONFIG_I2C_VIA is not set +# CONFIG_I2C_VIAPRO is not set +# CONFIG_I2C_VOODOO3 is not set +# CONFIG_I2O is not set +# CONFIG_I82092 is not set +# CONFIG_I82365 is not set +# CONFIG_IBM_ASM is not set +# CONFIG_IBM_NEW_EMAC_EMAC4 is not set +# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set +# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set +# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set +# CONFIG_IBM_NEW_EMAC_RGMII is not set +# CONFIG_IBM_NEW_EMAC_TAH is not set +# CONFIG_IBM_NEW_EMAC_ZMII is not set +# CONFIG_ICPLUS_PHY is not set +# CONFIG_ICS932S401 is not set +# CONFIG_IDEDISK_MULTI_MODE is not set +# CONFIG_IDEDMA_IVB is not set +# CONFIG_IDEDMA_ONLYDISK is not set +# CONFIG_IDE_GD is not set +# CONFIG_IDE is not set +CONFIG_IDE_MAX_HWIFS=4 +# CONFIG_IDEPCI_SHARE_IRQ is not set +# CONFIG_IDE_PHISON is not set +CONFIG_IDE_PROC_FS=y +# CONFIG_IDE_TASK_IOCTL is not set +# CONFIG_IEEE1394_DV1394 is not set +# CONFIG_IEEE1394_ETH1394 is not set +# CONFIG_IEEE1394 is not set +# CONFIG_IEEE1394_OHCI1394 is not set +# CONFIG_IEEE1394_PCILYNX is not set +# CONFIG_IEEE1394_RAWIO is not set +# CONFIG_IEEE1394_VERBOSEDEBUG is not set +# CONFIG_IEEE1394_VIDEO1394 is not set +# CONFIG_IEEE80211_CRYPT_CCMP is not set +# CONFIG_IEEE80211_CRYPT_TKIP is not set +# CONFIG_IEEE80211_CRYPT_WEP is not set +# CONFIG_IEEE80211_DEBUG is not set +# CONFIG_IEEE80211 is not set +# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set +# CONFIG_IEEE80211_SOFTMAC is not set +# CONFIG_IEEE802154 is not set +# CONFIG_IFB is not set +# CONFIG_IGB is not set +# CONFIG_IGBVF is not set +# CONFIG_IIO is not set +# CONFIG_IKCONFIG is not set +# CONFIG_IKCONFIG_PROC is not set +# CONFIG_IMAGE_CMDLINE_HACK is not set +# CONFIG_IMQ_BEHAVIOR_AA is not set +# CONFIG_IMQ_BEHAVIOR_AB is not set +# CONFIG_IMQ_BEHAVIOR_BA is not set +# CONFIG_IMQ_BEHAVIOR_BB is not set +# CONFIG_IMQ is not set +CONFIG_IMQ_NUM_DEVS=2 +# CONFIG_INET6_AH is not set +# CONFIG_INET6_ESP is not set +# CONFIG_INET6_IPCOMP is not set +# CONFIG_INET6_TUNNEL is not set +# CONFIG_INET6_XFRM_MODE_BEET is not set +# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set +# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET6_XFRM_MODE_TUNNEL is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_DIAG is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_INET_LRO is not set +# CONFIG_INET_TCP_DIAG is not set +# CONFIG_INET_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_TUNNEL is not set +CONFIG_INET=y +# CONFIG_INFINIBAND is not set +# CONFIG_INFTL is not set +CONFIG_INIT_ENV_ARG_LIMIT=32 +# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set +# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set +# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set +CONFIG_INITRAMFS_COMPRESSION_NONE=y +# CONFIG_INOTIFY is not set +# CONFIG_INOTIFY_USER is not set +# CONFIG_INPUT_APANEL is not set +# CONFIG_INPUT_ATI_REMOTE2 is not set +# CONFIG_INPUT_ATI_REMOTE is not set +# CONFIG_INPUT_ATLAS_BTNS is not set +# CONFIG_INPUT_CM109 is not set +# CONFIG_INPUT_EVBUG is not set +# CONFIG_INPUT_EVDEV is not set +# CONFIG_INPUT_FF_MEMLESS is not set +# CONFIG_INPUT_GPIO is not set +# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set +# CONFIG_INPUT is not set +# CONFIG_INPUT_JOYDEV is not set +# CONFIG_INPUT_JOYSTICK is not set +# CONFIG_INPUT_KEYBOARD is not set +# CONFIG_INPUT_KEYSPAN_REMOTE is not set +# CONFIG_INPUT_MIMIO is not set +CONFIG_INPUT_MISC=y +# CONFIG_INPUT_MOUSEDEV is not set +# CONFIG_INPUT_MOUSE is not set +# CONFIG_INPUT_PCSPKR is not set +# CONFIG_INPUT_POLLDEV is not set +# CONFIG_INPUT_POWERMATE is not set +# CONFIG_INPUT_TABLET is not set +# CONFIG_INPUT_TOUCHSCREEN is not set +# CONFIG_INPUT_TSDEV is not set +# CONFIG_INPUT_UINPUT is not set +# CONFIG_INPUT_WISTRON_BTNS is not set +# CONFIG_INSTRUMENTATION is not set +# CONFIG_IOSCHED_AS is not set +# CONFIG_IOSCHED_CFQ is not set +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_NOOP=y +# CONFIG_IP1000 is not set +# CONFIG_IP175C_PHY is not set +# CONFIG_IP6_NF_FILTER is not set +# CONFIG_IP6_NF_IPTABLES is not set +# CONFIG_IP6_NF_MANGLE is not set +# CONFIG_IP6_NF_MATCH_AH is not set +# CONFIG_IP6_NF_MATCH_EUI64 is not set +# CONFIG_IP6_NF_MATCH_FRAG is not set +# CONFIG_IP6_NF_MATCH_HL is not set +# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set +# CONFIG_IP6_NF_MATCH_LIMIT is not set +# CONFIG_IP6_NF_MATCH_MH is not set +# CONFIG_IP6_NF_MATCH_OPTS is not set +# CONFIG_IP6_NF_MATCH_OWNER is not set +# CONFIG_IP6_NF_MATCH_RT is not set +# CONFIG_IP6_NF_QUEUE is not set +# CONFIG_IP6_NF_RAW is not set +# CONFIG_IP6_NF_TARGET_HL is not set +# CONFIG_IP6_NF_TARGET_IMQ is not set +# CONFIG_IP6_NF_TARGET_LOG is not set +# CONFIG_IP6_NF_TARGET_REJECT is not set +# CONFIG_IP6_NF_TARGET_ROUTE is not set +CONFIG_IP_ADVANCED_ROUTER=y +# CONFIG_IPC_NS is not set +# CONFIG_IP_DCCP is not set +CONFIG_IP_FIB_HASH=y +# CONFIG_IP_FIB_TRIE is not set +# CONFIG_IPMI_HANDLER is not set +CONFIG_IP_MROUTE=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_MULTIPLE_TABLES=y +# CONFIG_IP_NF_AMANDA is not set +# CONFIG_IP_NF_ARPFILTER is not set +# CONFIG_IP_NF_ARP_MANGLE is not set +# CONFIG_IP_NF_ARPTABLES is not set +# CONFIG_IP_NF_CONNTRACK_EVENTS is not set +CONFIG_IP_NF_CONNTRACK_MARK=y +CONFIG_IP_NF_CONNTRACK=y +CONFIG_IP_NF_CT_ACCT=y +# CONFIG_IP_NF_CT_PROTO_SCTP is not set +# CONFIG_IP_NF_FILTER is not set +# CONFIG_IP_NF_FTP is not set +# CONFIG_IP_NF_H323 is not set +# CONFIG_IP_NF_IPTABLES is not set +# CONFIG_IP_NF_IRC is not set +# CONFIG_IP_NF_MANGLE is not set +# CONFIG_IP_NF_MATCH_ADDRTYPE is not set +# CONFIG_IP_NF_MATCH_AH is not set +# CONFIG_IP_NF_MATCH_ECN is not set +# CONFIG_IP_NF_MATCH_HASHLIMIT is not set +# CONFIG_IP_NF_MATCH_IPP2P is not set +# CONFIG_IP_NF_MATCH_OWNER is not set +# CONFIG_IP_NF_MATCH_RECENT is not set +# CONFIG_IP_NF_MATCH_SET is not set +# CONFIG_IP_NF_MATCH_TIME is not set +# CONFIG_IP_NF_MATCH_TOS is not set +# CONFIG_IP_NF_MATCH_TTL is not set +# CONFIG_IP_NF_NAT_AMANDA is not set +# CONFIG_IP_NF_NAT_FTP is not set +# CONFIG_IP_NF_NAT_H323 is not set +# CONFIG_IP_NF_NAT_IRC is not set +CONFIG_IP_NF_NAT_NEEDED=y +# CONFIG_IP_NF_NAT_PPTP is not set +# CONFIG_IP_NF_NAT_SIP is not set +# CONFIG_IP_NF_NAT_SNMP_BASIC is not set +# CONFIG_IP_NF_NAT_TFTP is not set +CONFIG_IP_NF_NAT=y +# CONFIG_IP_NF_NETBIOS_NS is not set +# CONFIG_IP_NF_PPTP is not set +# CONFIG_IP_NF_QUEUE is not set +# CONFIG_IP_NF_RAW is not set +# CONFIG_IP_NF_SECURITY is not set +CONFIG_IP_NF_SET_HASHSIZE=1024 +# CONFIG_IP_NF_SET_IPHASH is not set +# CONFIG_IP_NF_SET_IPMAP is not set +# CONFIG_IP_NF_SET_IPPORTHASH is not set +# CONFIG_IP_NF_SET_IPTREE is not set +# CONFIG_IP_NF_SET_IPTREEMAP is not set +# CONFIG_IP_NF_SET is not set +# CONFIG_IP_NF_SET_MACIPMAP is not set +CONFIG_IP_NF_SET_MAX=256 +# CONFIG_IP_NF_SET_NETHASH is not set +# CONFIG_IP_NF_SET_PORTMAP is not set +# CONFIG_IP_NF_SIP is not set +# CONFIG_IP_NF_TARGET_CLUSTERIP is not set +# CONFIG_IP_NF_TARGET_ECN is not set +# CONFIG_IP_NF_TARGET_IMQ is not set +# CONFIG_IP_NF_TARGET_LOG is not set +# CONFIG_IP_NF_TARGET_MASQUERADE is not set +# CONFIG_IP_NF_TARGET_NETMAP is not set +# CONFIG_IP_NF_TARGET_REDIRECT is not set +# CONFIG_IP_NF_TARGET_REJECT is not set +# CONFIG_IP_NF_TARGET_ROUTE is not set +# CONFIG_IP_NF_TARGET_SAME is not set +# CONFIG_IP_NF_TARGET_SET is not set +# CONFIG_IP_NF_TARGET_TOS is not set +# CONFIG_IP_NF_TARGET_TTL is not set +# CONFIG_IP_NF_TARGET_ULOG is not set +# CONFIG_IP_NF_TFTP is not set +# CONFIG_IP_PIMSM_V1 is not set +# CONFIG_IP_PIMSM_V2 is not set +# CONFIG_IP_PNP is not set +CONFIG_IP_ROUTE_FWMARK=y +CONFIG_IP_ROUTE_MULTIPATH_CACHED=y +# CONFIG_IP_ROUTE_MULTIPATH_DRR is not set +# CONFIG_IP_ROUTE_MULTIPATH_RANDOM is not set +# CONFIG_IP_ROUTE_MULTIPATH_RR is not set +# CONFIG_IP_ROUTE_MULTIPATH_WRANDOM is not set +CONFIG_IP_ROUTE_MULTIPATH=y +CONFIG_IP_ROUTE_VERBOSE=y +# CONFIG_IP_SCTP is not set +CONFIG_IPSEC_NAT_TRAVERSAL=y +# CONFIG_IPV6 is not set +# CONFIG_IPV6_MIP6 is not set +# CONFIG_IPV6_MROUTE is not set +# CONFIG_IPV6_MULTIPLE_TABLES is not set +CONFIG_IPV6_NDISC_NODETYPE=y +# CONFIG_IPV6_OPTIMISTIC_DAD is not set +# CONFIG_IPV6_PRIVACY is not set +# CONFIG_IPV6_ROUTE_INFO is not set +# CONFIG_IPV6_ROUTER_PREF is not set +# CONFIG_IPV6_SIT is not set +# CONFIG_IPV6_TUNNEL is not set +# CONFIG_IP_VS is not set +# CONFIG_IPW2100_DEBUG is not set +# CONFIG_IPW2100 is not set +CONFIG_IPW2100_MONITOR=y +# CONFIG_IPW2200_DEBUG is not set +# CONFIG_IPW2200 is not set +CONFIG_IPW2200_MONITOR=y +# CONFIG_IPW2200_PROMISCUOUS is not set +# CONFIG_IPW2200_QOS is not set +# CONFIG_IPW2200_RADIOTAP is not set +# CONFIG_IPWIRELESS is not set +# CONFIG_IPX is not set +# CONFIG_IRDA is not set +# CONFIG_IRQSOFF_TRACER is not set +# CONFIG_ISCSI_TCP is not set +# CONFIG_ISDN_CAPI_CAPI20 is not set +CONFIG_ISDN_CAPI_CAPIFS_BOOL=y +# CONFIG_ISDN_CAPI_CAPIFS is not set +# CONFIG_ISDN_CAPI is not set +CONFIG_ISDN_CAPI_MIDDLEWARE=y +# CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON is not set +# CONFIG_ISDN_I4L is not set +CONFIG_ISDN=y +# CONFIG_ISL29003 is not set +# CONFIG_ISO9660_FS is not set +# CONFIG_IWL3945 is not set +# CONFIG_IWLAGN is not set +# CONFIG_IWLCORE is not set +# CONFIG_IWLWIFI is not set +# CONFIG_IWLWIFI_LEDS is not set +# CONFIG_IXGB is not set +# CONFIG_JBD2_DEBUG is not set +# CONFIG_JBD_DEBUG is not set +# CONFIG_JBD is not set +# CONFIG_JFFS2_CMODE_FAVOURLZO is not set +# CONFIG_JFFS2_CMODE_NONE is not set +CONFIG_JFFS2_CMODE_PRIORITY=y +# CONFIG_JFFS2_CMODE_SIZE is not set +CONFIG_JFFS2_COMPRESSION_OPTIONS=y +CONFIG_JFFS2_FS_DEBUG=0 +# CONFIG_JFFS2_FS_WBUF_VERIFY is not set +CONFIG_JFFS2_FS_WRITEBUFFER=y +# CONFIG_JFFS2_FS_XATTR is not set +CONFIG_JFFS2_FS=y +# CONFIG_JFFS2_LZO is not set +CONFIG_JFFS2_RTIME=y +# CONFIG_JFFS2_RUBIN is not set +CONFIG_JFFS2_SUMMARY=y +CONFIG_JFFS2_ZLIB=y +# CONFIG_JFFS_FS is not set +# CONFIG_JFS_DEBUG is not set +# CONFIG_JFS_FS is not set +# CONFIG_JFS_POSIX_ACL is not set +# CONFIG_JFS_SECURITY is not set +# CONFIG_JFS_STATISTICS is not set +# CONFIG_JME is not set +CONFIG_JOLIET=y +# CONFIG_KALLSYMS_EXTRA_PASS is not set +# CONFIG_KALLSYMS is not set +# CONFIG_KARMA_PARTITION is not set +# CONFIG_KEXEC is not set +# CONFIG_KEYBOARD_LM8323 is not set +# CONFIG_KEYS is not set +# CONFIG_KMEMTRACE is not set +CONFIG_KMOD=y +# CONFIG_KPROBES is not set +# CONFIG_KS8842 is not set +# CONFIG_KS8851 is not set +# CONFIG_KS8851_MLL is not set +# CONFIG_KSM is not set +# CONFIG_LANMEDIA is not set +# CONFIG_LAPB is not set +# CONFIG_LASAT is not set +# CONFIG_LATENCYTOP is not set +# CONFIG_LBDAF is not set +# CONFIG_LBD is not set +# CONFIG_LDM_PARTITION is not set +# CONFIG_LEDS_ALIX is not set +# CONFIG_LEDS_BD2802 is not set +CONFIG_LEDS_CLASS=y +# CONFIG_LEDS_DAC124S085 is not set +CONFIG_LEDS_GPIO_PLATFORM=y +# CONFIG_LEDS_LP3944 is not set +# CONFIG_LEDS_LP5521 is not set +# CONFIG_LEDS_PCA9532 is not set +# CONFIG_LEDS_PCA955X is not set +# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y +# CONFIG_LEDS_TRIGGER_GPIO is not set +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +# CONFIG_LEDS_TRIGGER_IDE_DISK is not set +# CONFIG_LEDS_TRIGGER_MORSE is not set +CONFIG_LEDS_TRIGGER_NETDEV=y +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_TIMER=y +# CONFIG_LEGACY_PTYS is not set +# CONFIG_LIB80211_CRYPT_CCMP is not set +# CONFIG_LIB80211_CRYPT_TKIP is not set +# CONFIG_LIB80211_CRYPT_WEP is not set +# CONFIG_LIB80211_DEBUG is not set +# CONFIG_LIB80211 is not set +# CONFIG_LIBCRC32C is not set +# CONFIG_LIBERTAS is not set +# CONFIG_LIBERTAS_THINFIRM is not set +# CONFIG_LIBERTAS_USB is not set +# CONFIG_LIBFC is not set +# CONFIG_LIBFCOE is not set +# CONFIG_LIBIPW_DEBUG is not set +# CONFIG_LINE6_USB is not set +# CONFIG_LLC2 is not set +CONFIG_LLC=y +CONFIG_LOCALVERSION="" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_LOCKDEP_SUPPORT=y +# CONFIG_LOCKD is not set +CONFIG_LOCKD_V4=y +CONFIG_LOG_BUF_SHIFT=14 +# CONFIG_LOGIRUMBLEPAD2_FF is not set +# CONFIG_LOGITECH_FF is not set +# CONFIG_LSF is not set +# CONFIG_LSI_ET1011C_PHY is not set +# CONFIG_LXT_PHY is not set +CONFIG_MAC80211_DEFAULT_PS_VALUE=1 +CONFIG_MAC80211_DEFAULT_PS=y +# CONFIG_MAC80211 is not set +# CONFIG_MAC_EMUMOUSEBTN is not set +# CONFIG_MAC_PARTITION is not set +# CONFIG_MACVLAN is not set +# CONFIG_MAGIC_SYSRQ is not set +# CONFIG_MARKEINS is not set +# CONFIG_MARKERS is not set +# CONFIG_MARVELL_PHY is not set +# CONFIG_MDIO_BITBANG is not set +# CONFIG_MD is not set +# CONFIG_ME4000 is not set +# CONFIG_MEDIA_ATTACH is not set +# CONFIG_MEDIA_SUPPORT is not set +# CONFIG_MEDIA_TUNER_CUSTOMISE is not set +# CONFIG_MEGARAID_LEGACY is not set +# CONFIG_MEGARAID_NEWGEN is not set +# CONFIG_MEGARAID_SAS is not set +# CONFIG_MEILHAUS is not set +# CONFIG_MEMSTICK is not set +# CONFIG_MFD_ASIC3 is not set +# CONFIG_MFD_CORE is not set +# CONFIG_MFD_PCF50633 is not set +# CONFIG_MFD_SM501 is not set +# CONFIG_MFD_TC6387XB is not set +# CONFIG_MFD_TC6393XB is not set +# CONFIG_MFD_TMIO is not set +# CONFIG_MFD_WM831X is not set +# CONFIG_MFD_WM8350_I2C is not set +# CONFIG_MFD_WM8400 is not set +# CONFIG_MG_DISK is not set +# CONFIG_MIGRATION is not set +CONFIG_MII=y +CONFIG_MINI_FO=y +# CONFIG_MINIX_FS is not set +# CONFIG_MINIX_SUBPARTITION is not set +CONFIG_MISC_DEVICES=y +CONFIG_MISC_FILESYSTEMS=y +# CONFIG_MISDN_HFCPCI is not set +# CONFIG_MISDN_HFCUSB is not set +# CONFIG_MISDN is not set +# CONFIG_MKISS is not set +# CONFIG_MMC_ARMMMCI is not set +CONFIG_MMC_BLOCK_BOUNCE=y +# CONFIG_MMC_BLOCK is not set +# CONFIG_MMC_CB710 is not set +# CONFIG_MMC_DEBUG is not set +# CONFIG_MMC is not set +# CONFIG_MMC_S3C is not set +# CONFIG_MMC_SDHCI is not set +# CONFIG_MMC_SDRICOH_CS is not set +# CONFIG_MMC_SPI is not set +# CONFIG_MMC_TEST is not set +# CONFIG_MMC_UNSAFE_RESUME is not set +# CONFIG_MMC_VIA_SDMMC is not set +CONFIG_MMU=y +# CONFIG_MODULE_FORCE_LOAD is not set +# CONFIG_MODULE_FORCE_UNLOAD is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODVERSIONS is not set +# CONFIG_MOUSE_APPLETOUCH is not set +# CONFIG_MOUSE_INPORT is not set +# CONFIG_MOUSE_LOGIBM is not set +# CONFIG_MOUSE_PC110PAD is not set +# CONFIG_MOUSE_SYNAPTICS_I2C is not set +# CONFIG_MSDOS_FS is not set +CONFIG_MSDOS_PARTITION=y +# CONFIG_MTD_ABSENT is not set +# CONFIG_MTD_AFS_PARTS is not set +# CONFIG_MTD_ALAUDA is not set +# CONFIG_MTD_AR7_PARTS is not set +# CONFIG_MTD_ARM_INTEGRATOR is not set +CONFIG_MTD_BLKDEVS=y +# CONFIG_MTD_BLOCK2MTD is not set +CONFIG_MTD_BLOCK=y +# CONFIG_MTD_CFI_ADV_OPTIONS is not set +CONFIG_MTD_CFI_AMDSTD=y +# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set +CONFIG_MTD_CFI_I1=y +CONFIG_MTD_CFI_I2=y +# CONFIG_MTD_CFI_I4 is not set +# CONFIG_MTD_CFI_I8 is not set +CONFIG_MTD_CFI_INTELEXT=y +# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set +CONFIG_MTD_CFI_NOSWAP=y +# CONFIG_MTD_CFI_STAA is not set +CONFIG_MTD_CFI_UTIL=y +CONFIG_MTD_CFI=y +CONFIG_MTD_CHAR=y +# CONFIG_MTD_CMDLINE_PARTS is not set +CONFIG_MTD_COMPLEX_MAPPINGS=y +# CONFIG_MTD_CONCAT is not set +# CONFIG_MTD_DATAFLASH is not set +# CONFIG_MTD_DEBUG is not set +# CONFIG_MTD_DOC2000 is not set +# CONFIG_MTD_DOC2001 is not set +# CONFIG_MTD_DOC2001PLUS is not set +CONFIG_MTD_GEN_PROBE=y +# CONFIG_MTD_GPIO_ADDR is not set +# CONFIG_MTD_INTEL_VR_NOR is not set +# CONFIG_MTD_JEDECPROBE is not set +# CONFIG_MTD_LPDDR is not set +# CONFIG_MTD_M25P80 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set +CONFIG_MTD_MAP_BANK_WIDTH_1=y +CONFIG_MTD_MAP_BANK_WIDTH_2=y +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set +CONFIG_MTD_MAP_BANK_WIDTH_4=y +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set +# CONFIG_MTD_MTDRAM is not set +# CONFIG_MTD_MYLOADER_PARTS is not set +# CONFIG_MTD_NAND_CAFE is not set +# CONFIG_MTD_NAND_DISKONCHIP is not set +# CONFIG_MTD_NAND_ECC_SMC is not set +# CONFIG_MTD_NAND_GPIO is not set +CONFIG_MTD_NAND_IDS=y +# CONFIG_MTD_NAND is not set +# CONFIG_MTD_NAND_MUSEUM_IDS is not set +# CONFIG_MTD_NAND_NANDSIM is not set +# CONFIG_MTD_NAND_PLATFORM is not set +# CONFIG_MTD_NAND_VERIFY_WRITE is not set +# CONFIG_MTD_ONENAND is not set +# CONFIG_MTD_OOPS is not set +# CONFIG_MTD_OTP is not set +CONFIG_MTD_PARTITIONS=y +# CONFIG_MTD_PCI is not set +# CONFIG_MTD_PHRAM is not set +# CONFIG_MTD_PHYSMAP_COMPAT is not set +# CONFIG_MTD_PHYSMAP is not set +# CONFIG_MTD_PLATRAM is not set +# CONFIG_MTD_PMC551 is not set +# CONFIG_MTD_RAM is not set +CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1 +# CONFIG_MTD_REDBOOT_PARTS is not set +# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set +# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set +# CONFIG_MTD_ROM is not set +CONFIG_MTD_ROOTFS_ROOT_DEV=y +CONFIG_MTD_ROOTFS_SPLIT=y +# CONFIG_MTD_SLRAM is not set +# CONFIG_MTD_TESTS is not set +# CONFIG_MTD_UBI is not set +CONFIG_MTD=y +# CONFIG_MVSWITCH_PHY is not set +# CONFIG_MWAVE is not set +# CONFIG_MWL8K is not set +# CONFIG_MYRI10GE is not set +# CONFIG_NAMESPACES is not set +# CONFIG_NATIONAL_PHY is not set +# CONFIG_NCP_FS is not set +# CONFIG_NE2K_PCI is not set +# CONFIG_NEC_MARKEINS is not set +# CONFIG_NET_9P is not set +# CONFIG_NET_ACT_GACT is not set +# CONFIG_NET_ACT_IPT is not set +# CONFIG_NET_ACT_MIRRED is not set +# CONFIG_NET_ACT_NAT is not set +# CONFIG_NET_ACT_PEDIT is not set +# CONFIG_NET_ACT_POLICE is not set +# CONFIG_NET_ACT_SIMP is not set +CONFIG_NET_ACT_SKBEDIT=y +CONFIG_NET_CLS_ACT=y +CONFIG_NET_CLS_BASIC=y +# CONFIG_NET_CLS_FLOW is not set +# CONFIG_NET_CLS_FW is not set +CONFIG_NET_CLS_IND=y +# CONFIG_NET_CLS_ROUTE4 is not set +# CONFIG_NET_CLS_RSVP6 is not set +# CONFIG_NET_CLS_RSVP is not set +# CONFIG_NET_CLS_TCINDEX is not set +# CONFIG_NET_CLS_U32 is not set +CONFIG_NET_CLS=y +# CONFIG_NETCONSOLE is not set +# CONFIG_NETDEBUG is not set +# CONFIG_NETDEV_10000 is not set +CONFIG_NETDEV_1000=y +CONFIG_NETDEVICES_MULTIQUEUE=y +CONFIG_NETDEVICES=y +# CONFIG_NET_DSA is not set +# CONFIG_NET_EMATCH_CMP is not set +# CONFIG_NET_EMATCH is not set +# CONFIG_NET_EMATCH_META is not set +# CONFIG_NET_EMATCH_NBYTE is not set +CONFIG_NET_EMATCH_STACK=32 +# CONFIG_NET_EMATCH_TEXT is not set +# CONFIG_NET_EMATCH_U32 is not set +CONFIG_NET_ESTIMATOR=y +CONFIG_NET_ETHERNET=y +# CONFIG_NET_FC is not set +CONFIG_NETFILTER_ADVANCED=y +# CONFIG_NETFILTER_DEBUG is not set +# CONFIG_NETFILTER_NETLINK is not set +# CONFIG_NETFILTER_NETLINK_LOG is not set +# CONFIG_NETFILTER_NETLINK_QUEUE is not set +# CONFIG_NETFILTER_TPROXY is not set +# CONFIG_NETFILTER_XTABLES is not set +# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set +# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set +# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set +# CONFIG_NETFILTER_XT_MATCH_CONNTRACK is not set +# CONFIG_NETFILTER_XT_MATCH_DCCP is not set +# CONFIG_NETFILTER_XT_MATCH_DSCP is not set +# CONFIG_NETFILTER_XT_MATCH_ESP is not set +# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_HELPER is not set +# CONFIG_NETFILTER_XT_MATCH_HL is not set +# CONFIG_NETFILTER_XT_MATCH_IPRANGE is not set +# CONFIG_NETFILTER_XT_MATCH_LAYER7_DEBUG is not set +# CONFIG_NETFILTER_XT_MATCH_LAYER7 is not set +# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set +# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set +# CONFIG_NETFILTER_XT_MATCH_MAC is not set +# CONFIG_NETFILTER_XT_MATCH_MARK is not set +# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set +# CONFIG_NETFILTER_XT_MATCH_OSF is not set +# CONFIG_NETFILTER_XT_MATCH_OWNER is not set +# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set +# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set +# CONFIG_NETFILTER_XT_MATCH_POLICY is not set +# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set +# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set +# CONFIG_NETFILTER_XT_MATCH_REALM is not set +# CONFIG_NETFILTER_XT_MATCH_RECENT is not set +# CONFIG_NETFILTER_XT_MATCH_RECENT_PROC_COMPAT is not set +# CONFIG_NETFILTER_XT_MATCH_SCTP is not set +# CONFIG_NETFILTER_XT_MATCH_STATE is not set +# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set +# CONFIG_NETFILTER_XT_MATCH_STRING is not set +# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set +# CONFIG_NETFILTER_XT_MATCH_TIME is not set +# CONFIG_NETFILTER_XT_MATCH_U32 is not set +# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set +# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set +# CONFIG_NETFILTER_XT_TARGET_DSCP is not set +# CONFIG_NETFILTER_XT_TARGET_HL is not set +# CONFIG_NETFILTER_XT_TARGET_IMQ is not set +# CONFIG_NETFILTER_XT_TARGET_LED is not set +# CONFIG_NETFILTER_XT_TARGET_MARK is not set +# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set +# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set +# CONFIG_NETFILTER_XT_TARGET_NOTRACK is not set +# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set +# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set +# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set +# CONFIG_NETFILTER_XT_TARGET_TRACE is not set +CONFIG_NETFILTER=y +CONFIG_NET_IPGRE_BROADCAST=y +# CONFIG_NET_IPGRE is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_ISA is not set +# CONFIG_NET_KEY is not set +# CONFIG_NET_KEY_MIGRATE is not set +CONFIG_NET_PCI=y +# CONFIG_NET_PCMCIA is not set +# CONFIG_NET_PKTGEN is not set +# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_NETPOLL is not set +CONFIG_NET_RADIO=y +# CONFIG_NETROM is not set +# CONFIG_NET_SB1000 is not set +# CONFIG_NET_SCH_ATM is not set +# CONFIG_NET_SCH_CBQ is not set +# CONFIG_NET_SCH_CLK_CPU is not set +# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set +CONFIG_NET_SCH_CLK_JIFFIES=y +# CONFIG_NET_SCH_DRR is not set +# CONFIG_NET_SCH_DSMARK is not set +CONFIG_NET_SCHED=y +# CONFIG_NET_SCH_ESFQ is not set +CONFIG_NET_SCH_ESFQ_NFCT=y +CONFIG_NET_SCH_FIFO=y +# CONFIG_NET_SCH_GRED is not set +# CONFIG_NET_SCH_HFSC is not set +# CONFIG_NET_SCH_HTB is not set +# CONFIG_NET_SCH_INGRESS is not set +# CONFIG_NET_SCH_MULTIQ is not set +# CONFIG_NET_SCH_NETEM is not set +# CONFIG_NET_SCH_PRIO is not set +# CONFIG_NET_SCH_RED is not set +# CONFIG_NET_SCH_RR is not set +# CONFIG_NET_SCH_SFQ is not set +# CONFIG_NET_SCH_TBF is not set +# CONFIG_NET_SCH_TEQL is not set +# CONFIG_NET_TULIP is not set +# CONFIG_NET_VENDOR_3COM is not set +CONFIG_NET_WIRELESS_RTNETLINK=y +CONFIG_NET_WIRELESS=y +CONFIG_NETWORK_FILESYSTEMS=y +# CONFIG_NETWORK_SECMARK is not set +# CONFIG_NETXEN_NIC is not set +CONFIG_NET=y +# CONFIG_NEW_GPIO is not set +CONFIG_NEW_LEDS=y +# CONFIG_NF_CONNTRACK_AMANDA is not set +CONFIG_NF_CONNTRACK_ENABLED=y +# CONFIG_NF_CONNTRACK_EVENTS is not set +# CONFIG_NF_CONNTRACK_FTP is not set +# CONFIG_NF_CONNTRACK_H323 is not set +# CONFIG_NF_CONNTRACK_IPV4 is not set +# CONFIG_NF_CONNTRACK_IPV6 is not set +# CONFIG_NF_CONNTRACK_IRC is not set +# CONFIG_NF_CONNTRACK is not set +CONFIG_NF_CONNTRACK_MARK=y +# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set +# CONFIG_NF_CONNTRACK_PPTP is not set +CONFIG_NF_CONNTRACK_PROC_COMPAT=y +# CONFIG_NF_CONNTRACK_RTSP is not set +# CONFIG_NF_CONNTRACK_SANE is not set +# CONFIG_NF_CONNTRACK_SIP is not set +CONFIG_NF_CONNTRACK_SUPPORT=y +# CONFIG_NF_CONNTRACK_TFTP is not set +# CONFIG_NF_CT_ACCT is not set +# CONFIG_NF_CT_NETLINK is not set +# CONFIG_NF_CT_PROTO_DCCP is not set +# CONFIG_NF_CT_PROTO_GRE is not set +# CONFIG_NF_CT_PROTO_SCTP is not set +# CONFIG_NF_CT_PROTO_UDPLITE is not set +# CONFIG_NF_DEFRAG_IPV4 is not set +# CONFIG_NF_NAT_AMANDA is not set +# CONFIG_NF_NAT_FTP is not set +# CONFIG_NF_NAT_H323 is not set +# CONFIG_NF_NAT_IRC is not set +# CONFIG_NF_NAT is not set +CONFIG_NF_NAT_NEEDED=y +# CONFIG_NF_NAT_PPTP is not set +# CONFIG_NF_NAT_PROTO_GRE is not set +# CONFIG_NF_NAT_RTSP is not set +# CONFIG_NF_NAT_SIP is not set +# CONFIG_NF_NAT_SNMP_BASIC is not set +# CONFIG_NF_NAT_TFTP is not set +# CONFIG_NFS_ACL_SUPPORT is not set +CONFIG_NFS_COMMON=y +# CONFIG_NFS_DIRECTIO is not set +# CONFIG_NFSD is not set +CONFIG_NFSD_TCP=y +# CONFIG_NFSD_V2_ACL is not set +# CONFIG_NFSD_V3_ACL is not set +CONFIG_NFSD_V3=y +CONFIG_NFSD_V4=y +# CONFIG_NFS_FS is not set +# CONFIG_NFS_V3_ACL is not set +CONFIG_NFS_V3=y +# CONFIG_NFS_V4_1 is not set +CONFIG_NFS_V4=y +# CONFIG_NFTL is not set +# CONFIG_NILFS2_FS is not set +CONFIG_NL80211=y +CONFIG_NLATTR=y +# CONFIG_NLS_ASCII is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_UTF8 is not set +# CONFIG_NO_HZ is not set +# CONFIG_NOP_USB_XCEIV is not set +# CONFIG_NORTEL_HERMES is not set +# CONFIG_NOZOMI is not set +# CONFIG_NS83820 is not set +# CONFIG_NTFS_DEBUG is not set +# CONFIG_NTFS_FS is not set +# CONFIG_NTFS_RW is not set +# CONFIG_OCF_BENCH is not set +# CONFIG_OCF_EP80579 is not set +# CONFIG_OCF_HIFNHIPP is not set +# CONFIG_OCF_HIFN is not set +# CONFIG_OCF_IXP4XX is not set +# CONFIG_OCF_OCF is not set +# CONFIG_OCF_OCFNULL is not set +# CONFIG_OCFS2_FS is not set +# CONFIG_OCF_SAFE is not set +# CONFIG_OCF_TALITOS is not set +# CONFIG_OMFS_FS is not set +# CONFIG_OSF_PARTITION is not set +# CONFIG_P54_COMMON is not set +CONFIG_PACKET_MMAP=y +CONFIG_PACKET=y +# CONFIG_PAGE_SIZE_16KB is not set +# CONFIG_PAGE_SIZE_32KB is not set +CONFIG_PAGE_SIZE_4KB=y +# CONFIG_PAGE_SIZE_64KB is not set +# CONFIG_PAGE_SIZE_8KB is not set +# CONFIG_PANTHERLORD_FF is not set +# CONFIG_PARPORT is not set +# CONFIG_PARPORT_PC is not set +CONFIG_PARTITION_ADVANCED=y +# CONFIG_PATA_ALI is not set +# CONFIG_PATA_AMD is not set +# CONFIG_PATA_ARTOP is not set +# CONFIG_PATA_ATIIXP is not set +# CONFIG_PATA_CMD640_PCI is not set +# CONFIG_PATA_CMD64X is not set +# CONFIG_PATA_CS5520 is not set +# CONFIG_PATA_CS5530 is not set +# CONFIG_PATA_CS5535 is not set +# CONFIG_PATA_CS5536 is not set +# CONFIG_PATA_CYPRESS is not set +# CONFIG_PATA_EFAR is not set +# CONFIG_PATA_HPT366 is not set +# CONFIG_PATA_HPT37X is not set +# CONFIG_PATA_HPT3X2N is not set +# CONFIG_PATA_HPT3X3 is not set +# CONFIG_PATA_ISAPNP is not set +# CONFIG_PATA_IT8213 is not set +# CONFIG_PATA_IT821X is not set +# CONFIG_PATA_JMICRON is not set +# CONFIG_PATA_LEGACY is not set +# CONFIG_PATA_MARVELL is not set +# CONFIG_PATA_MPIIX is not set +# CONFIG_PATA_NETCELL is not set +# CONFIG_PATA_NINJA32 is not set +# CONFIG_PATA_NS87410 is not set +# CONFIG_PATA_NS87415 is not set +# CONFIG_PATA_OLDPIIX is not set +# CONFIG_PATA_OPTIDMA is not set +# CONFIG_PATA_OPTI is not set +# CONFIG_PATA_PCMCIA is not set +# CONFIG_PATA_PDC2027X is not set +# CONFIG_PATA_PDC_OLD is not set +# CONFIG_PATA_PLATFORM is not set +# CONFIG_PATA_QDI is not set +# CONFIG_PATA_RADISYS is not set +# CONFIG_PATA_RZ1000 is not set +# CONFIG_PATA_SC1200 is not set +# CONFIG_PATA_SCH is not set +# CONFIG_PATA_SERVERWORKS is not set +# CONFIG_PATA_SIL680 is not set +# CONFIG_PATA_SIS is not set +# CONFIG_PATA_TRIFLEX is not set +# CONFIG_PATA_VIA is not set +# CONFIG_PATA_WINBOND is not set +# CONFIG_PATA_WINBOND_VLB is not set +# CONFIG_PC300TOO is not set +# CONFIG_PCCARD is not set +# CONFIG_PCF8575 is not set +# CONFIG_PCI200SYN is not set +# CONFIG_PCI_ATMEL is not set +# CONFIG_PCI_DISABLE_COMMON_QUIRKS is not set +# CONFIG_PCIEASPM is not set +# CONFIG_PCI_HERMES is not set +# CONFIG_PCI_IOV is not set +# CONFIG_PCI is not set +# CONFIG_PCI_LEGACY is not set +# CONFIG_PCI_MSI is not set +# CONFIG_PCIPCWATCHDOG is not set +CONFIG_PCI_QUIRKS=y +# CONFIG_PCI_STUB is not set +# CONFIG_PCMCIA_AHA152X is not set +# CONFIG_PCMCIA_ATMEL is not set +# CONFIG_PCMCIA_DEBUG is not set +# CONFIG_PCMCIA_FDOMAIN is not set +# CONFIG_PCMCIA_HERMES is not set +# CONFIG_PCMCIA_IOCTL is not set +# CONFIG_PCMCIA is not set +# CONFIG_PCMCIA_LOAD_CIS is not set +# CONFIG_PCMCIA_NETWAVE is not set +# CONFIG_PCMCIA_NINJA_SCSI is not set +# CONFIG_PCMCIA_QLOGIC is not set +# CONFIG_PCMCIA_RAYCS is not set +# CONFIG_PCMCIA_SPECTRUM is not set +# CONFIG_PCMCIA_SYM53C500 is not set +# CONFIG_PCMCIA_WAVELAN is not set +# CONFIG_PCMCIA_WL3501 is not set +# CONFIG_PCNET32 is not set +# CONFIG_PD6729 is not set +# CONFIG_PDC_ADMA is not set +# CONFIG_PHANTOM is not set +# CONFIG_PHONE is not set +# CONFIG_PHONET is not set +# CONFIG_PHYLIB is not set +# CONFIG_PHYS_ADDR_T_64BIT is not set +# CONFIG_PID_NS is not set +# CONFIG_PLAN9AUTH is not set +CONFIG_PLIST=y +# CONFIG_PLX_HERMES is not set +# CONFIG_PMIC_DA903X is not set +# CONFIG_PM is not set +# CONFIG_POHMELFS is not set +# CONFIG_POSIX_MQUEUE is not set +# CONFIG_POWER_SUPPLY is not set +# CONFIG_PPC_16K_PAGES is not set +# CONFIG_PPC_256K_PAGES is not set +CONFIG_PPC_4K_PAGES=y +CONFIG_PPC4xx_GPIO=y +# CONFIG_PPC_64K_PAGES is not set +# CONFIG_PPC_EMULATED_STATS is not set +# CONFIG_PPP_ASYNC is not set +# CONFIG_PPP_BSDCOMP is not set +# CONFIG_PPP_DEFLATE is not set +CONFIG_PPP_FILTER=y +# CONFIG_PPP is not set +# CONFIG_PPP_MPPE is not set +CONFIG_PPP_MULTILINK=y +# CONFIG_PPPOATM is not set +# CONFIG_PPPOE is not set +# CONFIG_PPPOL2TP is not set +# CONFIG_PPP_SYNC_TTY is not set +# CONFIG_PPS is not set +# CONFIG_PREEMPT is not set +CONFIG_PREEMPT_NONE=y +# CONFIG_PREEMPT_RCU is not set +# CONFIG_PREEMPT_RCU_TRACE is not set +# CONFIG_PREEMPT_VOLUNTARY is not set +CONFIG_PREVENT_FIRMWARE_BUILD=y +# CONFIG_PRINTK_TIME is not set +CONFIG_PRINTK=y +# CONFIG_PRISM2_USB is not set +# CONFIG_PRISM54 is not set +CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y +# CONFIG_PROC_PAGE_MONITOR is not set +CONFIG_PROC_SYSCTL=y +# CONFIG_PROFILING is not set +# CONFIG_QEMU is not set +# CONFIG_QLA3XXX is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_QSEMI_PHY is not set +# CONFIG_QUOTA is not set +# CONFIG_R3964 is not set +# CONFIG_R6040 is not set +# CONFIG_R8169 is not set +# CONFIG_RADIO_ADAPTERS is not set +# CONFIG_RADIO_AZTECH is not set +# CONFIG_RADIO_CADET is not set +# CONFIG_RADIO_GEMTEK is not set +# CONFIG_RADIO_GEMTEK_PCI is not set +# CONFIG_RADIO_MAESTRO is not set +# CONFIG_RADIO_MAXIRADIO is not set +# CONFIG_RADIO_RTRACK2 is not set +# CONFIG_RADIO_RTRACK is not set +# CONFIG_RADIO_SF16FMI is not set +# CONFIG_RADIO_SF16FMR2 is not set +# CONFIG_RADIO_TERRATEC is not set +# CONFIG_RADIO_TRUST is not set +# CONFIG_RADIO_TYPHOON is not set +# CONFIG_RADIO_ZOLTRIX is not set +# CONFIG_RAID_ATTRS is not set +CONFIG_RAMFS=y +# CONFIG_RAR_REGISTER is not set +# CONFIG_RAW_DRIVER is not set +# CONFIG_RCU_CPU_STALL_DETECTOR is not set +CONFIG_RCU_FANOUT=32 +# CONFIG_RCU_FANOUT_EXACT is not set +# CONFIG_RCU_TRACE is not set +# CONFIG_RD_BZIP2 is not set +# CONFIG_RDC_17F3101X is not set +# CONFIG_RD_GZIP is not set +CONFIG_RD_LZMA=y +# CONFIG_RDS is not set +# CONFIG_REALTEK_PHY is not set +# CONFIG_REDWOOD is not set +# CONFIG_REGULATOR_BQ24022 is not set +# CONFIG_REGULATOR_FIXED_VOLTAGE is not set +# CONFIG_REGULATOR is not set +# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set +# CONFIG_REISERFS_CHECK is not set +# CONFIG_REISERFS_FS is not set +# CONFIG_REISERFS_FS_XATTR is not set +# CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_RELAY is not set +# CONFIG_RESOURCES_64BIT is not set +# CONFIG_RFD_FTL is not set +# CONFIG_RFKILL_INPUT is not set +# CONFIG_RFKILL is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_ROSE is not set +# CONFIG_RPCSEC_GSS_KRB5 is not set +# CONFIG_RPCSEC_GSS_SPKM3 is not set +# CONFIG_RT2860 is not set +# CONFIG_RT2870 is not set +# CONFIG_RT2X00 is not set +# CONFIG_RT3070 is not set +# CONFIG_RTC_CLASS is not set +# CONFIG_RTC_DEBUG is not set +# CONFIG_RTC_DRV_BQ4802 is not set +CONFIG_RTC_DRV_CMOS=y +# CONFIG_RTC_DRV_DS1286 is not set +# CONFIG_RTC_DRV_DS1305 is not set +# CONFIG_RTC_DRV_DS1307 is not set +# CONFIG_RTC_DRV_DS1374 is not set +# CONFIG_RTC_DRV_DS1390 is not set +# CONFIG_RTC_DRV_DS1511 is not set +# CONFIG_RTC_DRV_DS1553 is not set +# CONFIG_RTC_DRV_DS1672 is not set +# CONFIG_RTC_DRV_DS1742 is not set +# CONFIG_RTC_DRV_DS3234 is not set +# CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_ISL1208 is not set +# CONFIG_RTC_DRV_M41T80 is not set +# CONFIG_RTC_DRV_M41T94 is not set +# CONFIG_RTC_DRV_M48T35 is not set +# CONFIG_RTC_DRV_M48T59 is not set +# CONFIG_RTC_DRV_M48T86 is not set +# CONFIG_RTC_DRV_MAX6900 is not set +# CONFIG_RTC_DRV_MAX6902 is not set +# CONFIG_RTC_DRV_PCF50606 is not set +# CONFIG_RTC_DRV_PCF8563 is not set +# CONFIG_RTC_DRV_PCF8583 is not set +# CONFIG_RTC_DRV_R9701 is not set +# CONFIG_RTC_DRV_RS5C348 is not set +# CONFIG_RTC_DRV_RS5C372 is not set +# CONFIG_RTC_DRV_RTC7301 is not set +# CONFIG_RTC_DRV_RX8025 is not set +# CONFIG_RTC_DRV_RX8581 is not set +# CONFIG_RTC_DRV_S35390A is not set +# CONFIG_RTC_DRV_STK17TA8 is not set +# CONFIG_RTC_DRV_TEST is not set +# CONFIG_RTC_DRV_V3020 is not set +# CONFIG_RTC_DRV_X1205 is not set +CONFIG_RTC_HCTOSYS_DEVICE="rtc0" +CONFIG_RTC_HCTOSYS=y +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set +CONFIG_RTC_INTF_DEV=y +CONFIG_RTC_INTF_PROC=y +CONFIG_RTC_INTF_SYSFS=y +CONFIG_RTC_LIB=y +# CONFIG_RTL8180 is not set +# CONFIG_RTL8187 is not set +# CONFIG_RTL8187SE is not set +# CONFIG_RTL8192E is not set +# CONFIG_RTL8192SU is not set +# CONFIG_RTL8306_PHY is not set +CONFIG_RT_MUTEXES=y +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_S2IO is not set +# CONFIG_SAMPLES is not set +# CONFIG_SATA_AHCI is not set +# CONFIG_SATA_INIC162X is not set +# CONFIG_SATA_MV is not set +# CONFIG_SATA_NV is not set +# CONFIG_SATA_PMP is not set +# CONFIG_SATA_PROMISE is not set +# CONFIG_SATA_QSTOR is not set +# CONFIG_SATA_SIL24 is not set +# CONFIG_SATA_SIL is not set +# CONFIG_SATA_SIS is not set +# CONFIG_SATA_SVW is not set +# CONFIG_SATA_SX4 is not set +# CONFIG_SATA_ULI is not set +# CONFIG_SATA_VIA is not set +# CONFIG_SATA_VITESSE is not set +# CONFIG_SC92031 is not set +# CONFIG_SCC is not set +# CONFIG_SCHED_BFS is not set +CONFIG_SCHED_CFS=y +# CONFIG_SCHED_TRACER is not set +# CONFIG_SCSI_3W_9XXX is not set +# CONFIG_SCSI_7000FASST is not set +# CONFIG_SCSI_AACRAID is not set +# CONFIG_SCSI_ACARD is not set +# CONFIG_SCSI_ADVANSYS is not set +# CONFIG_SCSI_AHA152X is not set +# CONFIG_SCSI_AHA1542 is not set +# CONFIG_SCSI_AIC79XX is not set +# CONFIG_SCSI_AIC7XXX is not set +# CONFIG_SCSI_AIC7XXX_OLD is not set +# CONFIG_SCSI_AIC94XX is not set +# CONFIG_SCSI_ARCMSR is not set +# CONFIG_SCSI_BNX2_ISCSI is not set +# CONFIG_SCSI_BUSLOGIC is not set +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_DC390T is not set +# CONFIG_SCSI_DC395x is not set +# CONFIG_SCSI_DEBUG is not set +# CONFIG_SCSI_DH is not set +CONFIG_SCSI_DMA=y +# CONFIG_SCSI_DMX3191D is not set +# CONFIG_SCSI_DPT_I2O is not set +# CONFIG_SCSI_DTC3280 is not set +# CONFIG_SCSI_EATA is not set +# CONFIG_SCSI_ESP_CORE is not set +# CONFIG_SCSI_FC_ATTRS is not set +# CONFIG_SCSI_FUTURE_DOMAIN is not set +# CONFIG_SCSI_GDTH is not set +# CONFIG_SCSI_GENERIC_NCR5380 is not set +# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set +# CONFIG_SCSI_HPTIOP is not set +# CONFIG_SCSI_IN2000 is not set +# CONFIG_SCSI_INIA100 is not set +# CONFIG_SCSI_INITIO is not set +# CONFIG_SCSI_IPR is not set +# CONFIG_SCSI_IPS is not set +# CONFIG_SCSI_ISCSI_ATTRS is not set +# CONFIG_SCSI is not set +# CONFIG_SCSI_LOGGING is not set +# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set +CONFIG_SCSI_LOWLEVEL=y +# CONFIG_SCSI_LPFC is not set +# CONFIG_SCSI_MPT2SAS is not set +CONFIG_SCSI_MULTI_LUN=y +# CONFIG_SCSI_MVSAS is not set +# CONFIG_SCSI_NCR53C406A is not set +# CONFIG_SCSI_NETLINK is not set +# CONFIG_SCSI_NSP32 is not set +# CONFIG_SCSI_OSD_INITIATOR is not set +# CONFIG_SCSI_PAS16 is not set +CONFIG_SCSI_PROC_FS=y +# CONFIG_SCSI_PSI240I is not set +# CONFIG_SCSI_QLA_FC is not set +# CONFIG_SCSI_QLA_ISCSI is not set +# CONFIG_SCSI_QLOGIC_1280 is not set +# CONFIG_SCSI_QLOGIC_FAS is not set +# CONFIG_SCSI_SAS_ATTRS is not set +# CONFIG_SCSI_SAS_LIBSAS is not set +# CONFIG_SCSI_SCAN_ASYNC is not set +# CONFIG_SCSI_SEAGATE is not set +# CONFIG_SCSI_SPI_ATTRS is not set +# CONFIG_SCSI_SRP_ATTRS is not set +# CONFIG_SCSI_SRP is not set +# CONFIG_SCSI_STEX is not set +# CONFIG_SCSI_SYM53C416 is not set +# CONFIG_SCSI_SYM53C8XX_2 is not set +# CONFIG_SCSI_T128 is not set +# CONFIG_SCSI_TGT is not set +# CONFIG_SCSI_U14_34F is not set +# CONFIG_SCSI_ULTRASTOR is not set +CONFIG_SCSI_WAIT_SCAN=m +# CONFIG_SECCOMP is not set +# CONFIG_SECURITY_FILE_CAPABILITIES is not set +# CONFIG_SECURITYFS is not set +# CONFIG_SECURITY is not set +CONFIG_SELECT_MEMORY_MODEL=y +# CONFIG_SENSORS_ABITUGURU3 is not set +# CONFIG_SENSORS_ABITUGURU is not set +# CONFIG_SENSORS_AD7414 is not set +# CONFIG_SENSORS_AD7418 is not set +# CONFIG_SENSORS_ADCXX is not set +# CONFIG_SENSORS_ADM1021 is not set +# CONFIG_SENSORS_ADM1025 is not set +# CONFIG_SENSORS_ADM1026 is not set +# CONFIG_SENSORS_ADM1029 is not set +# CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM9240 is not set +# CONFIG_SENSORS_ADS7828 is not set +# CONFIG_SENSORS_ADT7462 is not set +# CONFIG_SENSORS_ADT7470 is not set +# CONFIG_SENSORS_ADT7473 is not set +# CONFIG_SENSORS_ADT7475 is not set +# CONFIG_SENSORS_APPLESMC is not set +# CONFIG_SENSORS_ASB100 is not set +# CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_CORETEMP is not set +# CONFIG_SENSORS_DME1737 is not set +# CONFIG_SENSORS_DS1337 is not set +# CONFIG_SENSORS_DS1374 is not set +# CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_EEPROM is not set +# CONFIG_SENSORS_F71805F is not set +# CONFIG_SENSORS_F71882FG is not set +# CONFIG_SENSORS_F75375S is not set +# CONFIG_SENSORS_FSCHER is not set +# CONFIG_SENSORS_FSCHMD is not set +# CONFIG_SENSORS_FSCPOS is not set +# CONFIG_SENSORS_G760A is not set +# CONFIG_SENSORS_GL518SM is not set +# CONFIG_SENSORS_GL520SM is not set +# CONFIG_SENSORS_HDAPS is not set +# CONFIG_SENSORS_I5K_AMB is not set +# CONFIG_SENSORS_IT87 is not set +# CONFIG_SENSORS_K8TEMP is not set +# CONFIG_SENSORS_LIS3_SPI is not set +# CONFIG_SENSORS_LM63 is not set +# CONFIG_SENSORS_LM70 is not set +# CONFIG_SENSORS_LM75 is not set +# CONFIG_SENSORS_LM77 is not set +# CONFIG_SENSORS_LM78 is not set +# CONFIG_SENSORS_LM80 is not set +# CONFIG_SENSORS_LM83 is not set +# CONFIG_SENSORS_LM85 is not set +# CONFIG_SENSORS_LM87 is not set +# CONFIG_SENSORS_LM90 is not set +# CONFIG_SENSORS_LM92 is not set +# CONFIG_SENSORS_LM93 is not set +# CONFIG_SENSORS_LM95241 is not set +# CONFIG_SENSORS_LTC4215 is not set +# CONFIG_SENSORS_LTC4245 is not set +# CONFIG_SENSORS_M41T00 is not set +# CONFIG_SENSORS_MAX1111 is not set +# CONFIG_SENSORS_MAX1619 is not set +# CONFIG_SENSORS_MAX6650 is not set +# CONFIG_SENSORS_MAX6875 is not set +# CONFIG_SENSORS_PC87360 is not set +# CONFIG_SENSORS_PC87427 is not set +# CONFIG_SENSORS_PCA9539 is not set +# CONFIG_SENSORS_PCF8574 is not set +# CONFIG_SENSORS_PCF8591 is not set +# CONFIG_SENSORS_SHT15 is not set +# CONFIG_SENSORS_SIS5595 is not set +# CONFIG_SENSORS_SMSC47B397 is not set +# CONFIG_SENSORS_SMSC47M192 is not set +# CONFIG_SENSORS_SMSC47M1 is not set +# CONFIG_SENSORS_THMC50 is not set +# CONFIG_SENSORS_TMP401 is not set +# CONFIG_SENSORS_TMP421 is not set +# CONFIG_SENSORS_TSL2550 is not set +# CONFIG_SENSORS_VIA686A is not set +# CONFIG_SENSORS_VT1211 is not set +# CONFIG_SENSORS_VT8231 is not set +# CONFIG_SENSORS_W83627EHF is not set +# CONFIG_SENSORS_W83627HF is not set +# CONFIG_SENSORS_W83781D is not set +# CONFIG_SENSORS_W83791D is not set +# CONFIG_SENSORS_W83792D is not set +# CONFIG_SENSORS_W83793 is not set +# CONFIG_SENSORS_W83L785TS is not set +# CONFIG_SENSORS_W83L786NG is not set +CONFIG_SERIAL_8250_CONSOLE=y +# CONFIG_SERIAL_8250_CS is not set +CONFIG_SERIAL_8250_NR_UARTS=2 +# CONFIG_SERIAL_8250_PCI is not set +CONFIG_SERIAL_8250_RUNTIME_UARTS=2 +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_CORE_CONSOLE=y +CONFIG_SERIAL_CORE=y +# CONFIG_SERIAL_JSM is not set +# CONFIG_SERIAL_MAX3100 is not set +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set +# CONFIG_SERIAL_UARTLITE is not set +# CONFIG_SERIO is not set +# CONFIG_SGI_IOC4 is not set +# CONFIG_SGI_PARTITION is not set +# CONFIG_SHAPER is not set +CONFIG_SHMEM=y +CONFIG_SIGNALFD=y +# CONFIG_SIMPLE_GPIO is not set +# CONFIG_SIS190 is not set +# CONFIG_SIS900 is not set +# CONFIG_SK98LIN is not set +# CONFIG_SKGE is not set +# CONFIG_SKY2_DEBUG is not set +# CONFIG_SKY2 is not set +CONFIG_SLABINFO=y +CONFIG_SLAB=y +# CONFIG_SLHC is not set +# CONFIG_SLICOSS is not set +# CONFIG_SLIP is not set +# CONFIG_SLOB is not set +# CONFIG_SLOW_WORK is not set +# CONFIG_SLUB_DEBUG is not set +# CONFIG_SLUB is not set +# CONFIG_SMARTJOYPLUS_FF is not set +# CONFIG_SMB_FS is not set +# CONFIG_SMB_NLS_DEFAULT is not set +# CONFIG_SMC911X is not set +# CONFIG_SMC91X is not set +# CONFIG_SMSC911X is not set +# CONFIG_SMSC9420 is not set +# CONFIG_SMSC_PHY is not set +# CONFIG_SND_AC97_POWER_SAVE is not set +# CONFIG_SND_AD1816A is not set +# CONFIG_SND_AD1848 is not set +# CONFIG_SND_AD1889 is not set +# CONFIG_SND_ADLIB is not set +# CONFIG_SND_ALI5451 is not set +# CONFIG_SND_ALS100 is not set +# CONFIG_SND_ALS300 is not set +# CONFIG_SND_ALS4000 is not set +# CONFIG_SND_ARM is not set +# CONFIG_SND_ATIIXP is not set +# CONFIG_SND_ATIIXP_MODEM is not set +# CONFIG_SND_AU8810 is not set +# CONFIG_SND_AU8820 is not set +# CONFIG_SND_AU8830 is not set +# CONFIG_SND_AW2 is not set +# CONFIG_SND_AZT2320 is not set +# CONFIG_SND_AZT3328 is not set +# CONFIG_SND_BT87X is not set +# CONFIG_SND_CA0106 is not set +# CONFIG_SND_CMI8330 is not set +# CONFIG_SND_CMIPCI is not set +# CONFIG_SND_CS4231 is not set +# CONFIG_SND_CS4232 is not set +# CONFIG_SND_CS4236 is not set +# CONFIG_SND_CS4281 is not set +# CONFIG_SND_CS46XX is not set +# CONFIG_SND_CS5530 is not set +# CONFIG_SND_CS5535AUDIO is not set +# CONFIG_SND_DARLA20 is not set +# CONFIG_SND_DARLA24 is not set +# CONFIG_SND_DEBUG is not set +CONFIG_SND_DRIVERS=y +# CONFIG_SND_DT019X is not set +# CONFIG_SND_DUMMY is not set +# CONFIG_SND_DYNAMIC_MINORS is not set +# CONFIG_SND_ECHO3G is not set +# CONFIG_SND_EMU10K1 is not set +# CONFIG_SND_EMU10K1X is not set +# CONFIG_SND_ENS1370 is not set +# CONFIG_SND_ENS1371 is not set +# CONFIG_SND_ES1688 is not set +# CONFIG_SND_ES18XX is not set +# CONFIG_SND_ES1938 is not set +# CONFIG_SND_ES1968 is not set +# CONFIG_SND_ES968 is not set +# CONFIG_SND_FM801 is not set +# CONFIG_SND_GINA20 is not set +# CONFIG_SND_GINA24 is not set +# CONFIG_SND_GUSCLASSIC is not set +# CONFIG_SND_GUSEXTREME is not set +# CONFIG_SND_GUSMAX is not set +# CONFIG_SND_HDA_INTEL is not set +# CONFIG_SND_HDSP is not set +# CONFIG_SND_HDSPM is not set +# CONFIG_SND_HIFIER is not set +# CONFIG_SND_HRTIMER is not set +# CONFIG_SND_HWDEP is not set +# CONFIG_SND_ICE1712 is not set +# CONFIG_SND_ICE1724 is not set +# CONFIG_SND_INDIGODJ is not set +# CONFIG_SND_INDIGOIO is not set +# CONFIG_SND_INDIGO is not set +# CONFIG_SND_INTEL8X0 is not set +# CONFIG_SND_INTEL8X0M is not set +# CONFIG_SND_INTERWAVE is not set +# CONFIG_SND_INTERWAVE_STB is not set +# CONFIG_SND_ISA is not set +# CONFIG_SND is not set +# CONFIG_SND_KORG1212 is not set +# CONFIG_SND_LAYLA20 is not set +# CONFIG_SND_LAYLA24 is not set +# CONFIG_SND_MAESTRO3 is not set +# CONFIG_SND_MIA is not set +# CONFIG_SND_MIPS is not set +# CONFIG_SND_MIRO is not set +# CONFIG_SND_MIXART is not set +# CONFIG_SND_MIXER_OSS is not set +# CONFIG_SND_MONA is not set +# CONFIG_SND_MPU401 is not set +# CONFIG_SND_MTPAV is not set +# CONFIG_SND_NM256 is not set +# CONFIG_SND_OPL3SA2 is not set +# CONFIG_SND_OPTI92X_AD1848 is not set +# CONFIG_SND_OPTI92X_CS4231 is not set +# CONFIG_SND_OPTI93X is not set +CONFIG_SND_OSSEMUL=y +# CONFIG_SND_OXYGEN is not set +# CONFIG_SND_PCI is not set +# CONFIG_SND_PCMCIA is not set +# CONFIG_SND_PCM is not set +# CONFIG_SND_PCM_OSS is not set +CONFIG_SND_PCM_OSS_PLUGINS=y +# CONFIG_SND_PCXHR is not set +# CONFIG_SND_PDAUDIOCF is not set +# CONFIG_SND_RAWMIDI is not set +# CONFIG_SND_RIPTIDE is not set +# CONFIG_SND_RME32 is not set +# CONFIG_SND_RME9652 is not set +# CONFIG_SND_RME96 is not set +# CONFIG_SND_RTCTIMER is not set +# CONFIG_SND_SB16 is not set +# CONFIG_SND_SB8 is not set +# CONFIG_SND_SBAWE is not set +# CONFIG_SND_SEQUENCER is not set +# CONFIG_SND_SERIAL_U16550 is not set +# CONFIG_SND_SGALAXY is not set +# CONFIG_SND_SOC is not set +# CONFIG_SND_SONICVIBES is not set +# CONFIG_SND_SPI is not set +# CONFIG_SND_SSCAPE is not set +# CONFIG_SND_SUPPORT_OLD_API is not set +# CONFIG_SND_TIMER is not set +# CONFIG_SND_TRIDENT is not set +# CONFIG_SND_USB_AUDIO is not set +# CONFIG_SND_USB_CAIAQ is not set +# CONFIG_SND_USB_US122L is not set +# CONFIG_SND_USB_USX2Y is not set +CONFIG_SND_USB=y +# CONFIG_SND_VERBOSE_PRINTK is not set +CONFIG_SND_VERBOSE_PROCFS=y +# CONFIG_SND_VIA82XX is not set +# CONFIG_SND_VIA82XX_MODEM is not set +# CONFIG_SND_VIRTUOSO is not set +# CONFIG_SND_VX222 is not set +# CONFIG_SND_VXPOCKET is not set +# CONFIG_SND_WAVEFRONT is not set +# CONFIG_SND_YMFPCI is not set +# CONFIG_SNI_RM is not set +# CONFIG_SOC_CAMERA is not set +# CONFIG_SOFT_WATCHDOG is not set +# CONFIG_SOLARIS_X86_PARTITION is not set +# CONFIG_SONYPI is not set +# CONFIG_SOUND is not set +# CONFIG_SOUND_PRIME is not set +# CONFIG_SPARSEMEM_MANUAL is not set +# CONFIG_SPARSEMEM_STATIC is not set +# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set +# CONFIG_SPI_AT25 is not set +# CONFIG_SPI_DEBUG is not set +# CONFIG_SPI_GPIO_OLD is not set +# CONFIG_SPI is not set +# CONFIG_SPI_MASTER is not set +# CONFIG_SPI_ORION is not set +# CONFIG_SPI_TLE62X0 is not set +CONFIG_SPLIT_PTLOCK_CPUS=4 +# CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 +CONFIG_SQUASHFS_LZMA=y +CONFIG_SQUASHFS_SUPPORT_ZLIB=y +# CONFIG_SQUASHFS_VMALLOC is not set +CONFIG_SQUASHFS=y +# CONFIG_SSB_BLOCKIO is not set +# CONFIG_SSB_DEBUG is not set +# CONFIG_SSB is not set +# CONFIG_SSB_PCMCIAHOST is not set +CONFIG_SSB_POSSIBLE=y +# CONFIG_SSB_SILENT is not set +# CONFIG_SSFDC is not set +# CONFIG_STACK_TRACER is not set +CONFIG_STACKTRACE_SUPPORT=y +# CONFIG_STAGING_EXCLUDE_BUILD is not set +CONFIG_STAGING=y +CONFIG_STANDALONE=y +CONFIG_STDBINUTILS=y +# CONFIG_STE10XP is not set +CONFIG_STP=y +CONFIG_STRIP_ASM_SYMS=y +# CONFIG_STRIP is not set +# CONFIG_SUNDANCE is not set +# CONFIG_SUNGEM is not set +# CONFIG_SUN_PARTITION is not set +# CONFIG_SUNRPC_BIND34 is not set +# CONFIG_SUNRPC_GSS is not set +# CONFIG_SUNRPC is not set +# CONFIG_SUNRPC_REGISTER_V4 is not set +CONFIG_SUSPEND_UP_POSSIBLE=y +CONFIG_SWAP=y +# CONFIG_SWCONFIG is not set +# CONFIG_SYNCLINK_CS is not set +CONFIG_SYN_COOKIES=y +CONFIG_SYSCTL_SYSCALL_CHECK=y +CONFIG_SYSCTL_SYSCALL=y +CONFIG_SYSCTL=y +# CONFIG_SYSFS_DEPRECATED is not set +# CONFIG_SYSFS_DEPRECATED_V2 is not set +CONFIG_SYSFS=y +# CONFIG_SYS_HYPERVISOR is not set +# CONFIG_SYSV68_PARTITION is not set +# CONFIG_SYSV_FS is not set +CONFIG_SYSVIPC_SYSCTL=y +CONFIG_SYSVIPC=y +# CONFIG_TASKSTATS is not set +# CONFIG_TCG_TPM is not set +# CONFIG_TCIC is not set +CONFIG_TCP_CONG_ADVANCED=y +# CONFIG_TCP_CONG_BIC is not set +# CONFIG_TCP_CONG_CUBIC is not set +# CONFIG_TCP_CONG_HSTCP is not set +# CONFIG_TCP_CONG_HTCP is not set +# CONFIG_TCP_CONG_HYBLA is not set +# CONFIG_TCP_CONG_ILLINOIS is not set +# CONFIG_TCP_CONG_LP is not set +# CONFIG_TCP_CONG_SCALABLE is not set +# CONFIG_TCP_CONG_VEGAS is not set +# CONFIG_TCP_CONG_VENO is not set +CONFIG_TCP_CONG_WESTWOOD=y +# CONFIG_TCP_CONG_YEAH is not set +# CONFIG_TCP_MD5SIG is not set +# CONFIG_TEXTSEARCH_BM is not set +# CONFIG_TEXTSEARCH_FSM is not set +# CONFIG_TEXTSEARCH_KMP is not set +CONFIG_TEXTSEARCH=y +# CONFIG_THERMAL_HWMON is not set +# CONFIG_THERMAL is not set +# CONFIG_THRUSTMASTER_FF is not set +# CONFIG_TIFM_CORE is not set +# CONFIG_TIGON3 is not set +CONFIG_TIMERFD=y +# CONFIG_TINY_SHMEM is not set +# CONFIG_TIPC is not set +# CONFIG_TLAN is not set +# CONFIG_TMD_HERMES is not set +# CONFIG_TMPFS_POSIX_ACL is not set +CONFIG_TMPFS=y +# CONFIG_TOUCHSCREEN_AD7877 is not set +# CONFIG_TOUCHSCREEN_AD7879_I2C is not set +# CONFIG_TOUCHSCREEN_AD7879 is not set +# CONFIG_TOUCHSCREEN_AD7879_SPI is not set +# CONFIG_TOUCHSCREEN_ADS7846 is not set +# CONFIG_TOUCHSCREEN_EETI is not set +# CONFIG_TOUCHSCREEN_ELO is not set +# CONFIG_TOUCHSCREEN_FILTER is not set +# CONFIG_TOUCHSCREEN_FUJITSU is not set +# CONFIG_TOUCHSCREEN_GUNZE is not set +# CONFIG_TOUCHSCREEN_INEXIO is not set +# CONFIG_TOUCHSCREEN_MK712 is not set +# CONFIG_TOUCHSCREEN_MTOUCH is not set +# CONFIG_TOUCHSCREEN_PENMOUNT is not set +# CONFIG_TOUCHSCREEN_S3C2410 is not set +# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set +# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set +# CONFIG_TOUCHSCREEN_TOUCHWIN is not set +# CONFIG_TOUCHSCREEN_TSC2007 is not set +# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set +# CONFIG_TOUCHSCREEN_W90X900 is not set +# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set +# CONFIG_TPS65010 is not set +# CONFIG_TRACE_BRANCH_PROFILING is not set +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +CONFIG_TRACING_SUPPORT=y +# CONFIG_TRANZPORT is not set +# CONFIG_TREE_RCU is not set +# CONFIG_TREE_RCU_TRACE is not set +# CONFIG_TR is not set +# CONFIG_TUNER_3036 is not set +# CONFIG_TUNER_TEA5761 is not set +# CONFIG_TUN is not set +# CONFIG_TWL4030_CORE is not set +# CONFIG_UACCESS_WITH_MEMCPY is not set +# CONFIG_UDF_FS is not set +CONFIG_UDF_NLS=y +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +# CONFIG_UFS_FS is not set +# CONFIG_UIO is not set +# CONFIG_ULTRIX_PARTITION is not set +# CONFIG_UNEVICTABLE_LRU is not set +# CONFIG_UNION_MOUNT is not set +CONFIG_UNIX98_PTYS=y +# CONFIG_UNIXWARE_DISKLABEL is not set +CONFIG_UNIX=y +# CONFIG_UNUSED_SYMBOLS is not set +# CONFIG_USB_ACECAD is not set +# CONFIG_USB_ACM is not set +# CONFIG_USB_ADUTUX is not set +# CONFIG_USB_AIPTEK is not set +CONFIG_USB_ALI_M5632=y +CONFIG_USB_AN2720=y +# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set +# CONFIG_USB_APPLEDISPLAY is not set +# CONFIG_USB_APPLETOUCH is not set +CONFIG_USB_ARCH_HAS_EHCI=y +CONFIG_USB_ARCH_HAS_HCD=y +CONFIG_USB_ARCH_HAS_OHCI=y +CONFIG_USB_ARMLINUX=y +# CONFIG_USB_ATI_REMOTE2 is not set +# CONFIG_USB_ATI_REMOTE is not set +# CONFIG_USB_ATMEL is not set +# CONFIG_USB_ATM is not set +# CONFIG_USB_AUERSWALD is not set +# CONFIG_USB_BANDWIDTH is not set +CONFIG_USB_BELKIN=y +# CONFIG_USB_BERRY_CHARGE is not set +# CONFIG_USB_C67X00_HCD is not set +# CONFIG_USB_CATC is not set +# CONFIG_USB_CPC is not set +# CONFIG_USB_CXACRU is not set +# CONFIG_USB_CYPRESS_CY7C63 is not set +# CONFIG_USB_CYTHERM is not set +# CONFIG_USB_DABUSB is not set +# CONFIG_USB_DEBUG is not set +# CONFIG_USB_DEVICE_CLASS is not set +CONFIG_USB_DEVICEFS=y +# CONFIG_USB_DSBR is not set +# CONFIG_USB_DYNAMIC_MINORS is not set +# CONFIG_USB_EHCI_HCD_PPC_OF is not set +CONFIG_USB_EHCI_ROOT_HUB_TT=y +# CONFIG_USB_EHCI_SPLIT_ISO is not set +# CONFIG_USB_EHCI_TT_NEWSCHED is not set +# CONFIG_USB_EMI26 is not set +# CONFIG_USB_EMI62 is not set +# CONFIG_USB_EPSON2888 is not set +# CONFIG_USB_ET61X251 is not set +CONFIG_USB_EZUSB=y +# CONFIG_USB_FTDI_ELAN is not set +# CONFIG_USB_GADGET is not set +# CONFIG_USB_GPIO_VBUS is not set +# CONFIG_USB_GSPCA_CONEX is not set +# CONFIG_USB_GSPCA_ETOMS is not set +# CONFIG_USB_GSPCA_FINEPIX is not set +# CONFIG_USB_GSPCA is not set +# CONFIG_USB_GSPCA_MARS is not set +# CONFIG_USB_GSPCA_MR97310A is not set +# CONFIG_USB_GSPCA_OV519 is not set +# CONFIG_USB_GSPCA_OV534 is not set +# CONFIG_USB_GSPCA_PAC207 is not set +# CONFIG_USB_GSPCA_PAC7311 is not set +CONFIG_USB_GSPCA_SN9C20X_EVDEV=y +# CONFIG_USB_GSPCA_SN9C20X is not set +# CONFIG_USB_GSPCA_SONIXB is not set +# CONFIG_USB_GSPCA_SONIXJ is not set +# CONFIG_USB_GSPCA_SPCA500 is not set +# CONFIG_USB_GSPCA_SPCA501 is not set +# CONFIG_USB_GSPCA_SPCA505 is not set +# CONFIG_USB_GSPCA_SPCA506 is not set +# CONFIG_USB_GSPCA_SPCA508 is not set +# CONFIG_USB_GSPCA_SPCA561 is not set +# CONFIG_USB_GSPCA_SQ905C is not set +# CONFIG_USB_GSPCA_SQ905 is not set +# CONFIG_USB_GSPCA_STK014 is not set +# CONFIG_USB_GSPCA_SUNPLUS is not set +# CONFIG_USB_GSPCA_T613 is not set +# CONFIG_USB_GSPCA_TV8532 is not set +# CONFIG_USB_GSPCA_VC032X is not set +# CONFIG_USB_GSPCA_ZC3XX is not set +# CONFIG_USB_HIDDEV is not set +# CONFIG_USB_HIDINPUT_POWERBOOK is not set +CONFIG_USB_HIDINPUT=y +# CONFIG_USB_HID is not set +# CONFIG_USB_HSO is not set +# CONFIG_USB_HWA_HCD is not set +# CONFIG_USB_IBMCAM is not set +# CONFIG_USB_IDMOUSE is not set +# CONFIG_USB_IOWARRIOR is not set +# CONFIG_USB_IP_COMMON is not set +# CONFIG_USB_ISIGHTFW is not set +# CONFIG_USB is not set +# CONFIG_USB_ISP116X_HCD is not set +# CONFIG_USB_ISP1760_HCD is not set +# CONFIG_USB_KAWETH is not set +# CONFIG_USB_KBD is not set +# CONFIG_USB_KBTAB is not set +# CONFIG_USB_KC2190 is not set +# CONFIG_USB_KEYSPAN_REMOTE is not set +# CONFIG_USB_KONICAWC is not set +# CONFIG_USB_LCD is not set +# CONFIG_USB_LD is not set +# CONFIG_USB_LED is not set +# CONFIG_USB_LEGOTOWER is not set +# CONFIG_USB_LIBUSUAL is not set +# CONFIG_USB_M5602 is not set +# CONFIG_USB_MDC800 is not set +# CONFIG_USB_MICROTEK is not set +# CONFIG_USB_MON is not set +# CONFIG_USB_MOUSE is not set +# CONFIG_USB_MUSB_HDRC is not set +# CONFIG_USB_NET_AX8817X is not set +# CONFIG_USB_NET_CDC_EEM is not set +# CONFIG_USB_NET_CDCETHER is not set +# CONFIG_USB_NET_CDC_SUBSET is not set +# CONFIG_USB_NET_DM9601 is not set +# CONFIG_USB_NET_GL620A is not set +# CONFIG_USB_NET_INT51X1 is not set +# CONFIG_USB_NET_MCS7830 is not set +# CONFIG_USB_NET_NET1080 is not set +# CONFIG_USB_NET_PLUSB is not set +# CONFIG_USB_NET_RNDIS_HOST is not set +# CONFIG_USB_NET_RNDIS_WLAN is not set +# CONFIG_USB_NET_SMSC95XX is not set +# CONFIG_USB_NET_ZAURUS is not set +# CONFIG_USB_OHCI_BIG_ENDIAN is not set +# CONFIG_USB_OHCI_HCD is not set +# CONFIG_USB_OHCI_HCD_PCI is not set +# CONFIG_USB_OHCI_HCD_PPC_OF is not set +# CONFIG_USB_OHCI_HCD_PPC_SOC is not set +# CONFIG_USB_OHCI_HCD_SSB is not set +CONFIG_USB_OHCI_LITTLE_ENDIAN=y +# CONFIG_USB_OTG_BLACKLIST_HUB is not set +# CONFIG_USB_OTG is not set +# CONFIG_USB_OTG_WHITELIST is not set +# CONFIG_USB_OV511 is not set +# CONFIG_USB_OXU210HP_HCD is not set +# CONFIG_USBPCWATCHDOG is not set +# CONFIG_USB_PEGASUS is not set +# CONFIG_USB_PHIDGET is not set +# CONFIG_USB_POWERMATE is not set +# CONFIG_USB_PRINTER is not set +# CONFIG_USB_PWC_INPUT_EVDEV is not set +# CONFIG_USB_QUICKCAM_MESSENGER is not set +# CONFIG_USB_R8A66597_HCD is not set +# CONFIG_USB_RIO500 is not set +# CONFIG_USB_RTL8150 is not set +# CONFIG_USB_S2255 is not set +# CONFIG_USB_SE401 is not set +# CONFIG_USB_SERIAL_AIRCABLE is not set +# CONFIG_USB_SERIAL_AIRPRIME is not set +# CONFIG_USB_SERIAL_ARK3116 is not set +# CONFIG_USB_SERIAL_BELKIN is not set +# CONFIG_USB_SERIAL_CH341 is not set +# CONFIG_USB_SERIAL_CP2101 is not set +# CONFIG_USB_SERIAL_CP210X is not set +# CONFIG_USB_SERIAL_CYBERJACK is not set +# CONFIG_USB_SERIAL_CYPRESS_M8 is not set +# CONFIG_USB_SERIAL_DEBUG is not set +# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set +# CONFIG_USB_SERIAL_EDGEPORT is not set +# CONFIG_USB_SERIAL_EDGEPORT_TI is not set +# CONFIG_USB_SERIAL_EMPEG is not set +# CONFIG_USB_SERIAL_FTDI_SIO is not set +# CONFIG_USB_SERIAL_FUNSOFT is not set +# CONFIG_USB_SERIAL_GARMIN is not set +CONFIG_USB_SERIAL_GENERIC=y +# CONFIG_USB_SERIAL_HP4X is not set +# CONFIG_USB_SERIAL_IPAQ is not set +# CONFIG_USB_SERIAL_IPW is not set +# CONFIG_USB_SERIAL_IR is not set +# CONFIG_USB_SERIAL is not set +# CONFIG_USB_SERIAL_IUU is not set +# CONFIG_USB_SERIAL_KEYSPAN is not set +CONFIG_USB_SERIAL_KEYSPAN_MPR=y +# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set +CONFIG_USB_SERIAL_KEYSPAN_USA18X=y +CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y +CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y +CONFIG_USB_SERIAL_KEYSPAN_USA19W=y +CONFIG_USB_SERIAL_KEYSPAN_USA19=y +CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y +CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y +CONFIG_USB_SERIAL_KEYSPAN_USA28X=y +CONFIG_USB_SERIAL_KEYSPAN_USA28=y +CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y +CONFIG_USB_SERIAL_KEYSPAN_USA49W=y +# CONFIG_USB_SERIAL_KLSI is not set +# CONFIG_USB_SERIAL_KOBIL_SCT is not set +# CONFIG_USB_SERIAL_MCT_U232 is not set +# CONFIG_USB_SERIAL_MOS7720 is not set +# CONFIG_USB_SERIAL_MOS7840 is not set +# CONFIG_USB_SERIAL_MOTOROLA is not set +# CONFIG_USB_SERIAL_NAVMAN is not set +# CONFIG_USB_SERIAL_OMNINET is not set +# CONFIG_USB_SERIAL_OPTICON is not set +# CONFIG_USB_SERIAL_OPTION is not set +# CONFIG_USB_SERIAL_OTI6858 is not set +# CONFIG_USB_SERIAL_PL2303 is not set +# CONFIG_USB_SERIAL_QUALCOMM is not set +# CONFIG_USB_SERIAL_QUATECH2 is not set +# CONFIG_USB_SERIAL_SAFE is not set +CONFIG_USB_SERIAL_SAFE_PADDED=y +# CONFIG_USB_SERIAL_SIEMENS_MPI is not set +# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set +# CONFIG_USB_SERIAL_SPCP8X5 is not set +# CONFIG_USB_SERIAL_SYMBOL is not set +# CONFIG_USB_SERIAL_TI is not set +# CONFIG_USB_SERIAL_VISOR is not set +# CONFIG_USB_SERIAL_WHITEHEAT is not set +# CONFIG_USB_SERIAL_XIRCOM is not set +# CONFIG_USB_SEVSEG is not set +# CONFIG_USB_SISUSBVGA is not set +# CONFIG_USB_SL811_HCD is not set +# CONFIG_USB_SN9C102 is not set +# CONFIG_USB_SPEEDTOUCH is not set +# CONFIG_USB_STKWEBCAM is not set +CONFIG_USB_STORAGE_ALAUDA=y +# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set +CONFIG_USB_STORAGE_DATAFAB=y +# CONFIG_USB_STORAGE_DEBUG is not set +CONFIG_USB_STORAGE_DPCM=y +CONFIG_USB_STORAGE_FREECOM=y +# CONFIG_USB_STORAGE_ISD200 is not set +# CONFIG_USB_STORAGE is not set +CONFIG_USB_STORAGE_JUMPSHOT=y +CONFIG_USB_STORAGE_KARMA=y +# CONFIG_USB_STORAGE_ONETOUCH is not set +CONFIG_USB_STORAGE_SDDR09=y +CONFIG_USB_STORAGE_SDDR55=y +# CONFIG_USB_STORAGE_SIERRA is not set +CONFIG_USB_STORAGE_USBAT=y +# CONFIG_USB_STV06XX is not set +# CONFIG_USB_STV680 is not set +# CONFIG_USB_SUPPORT is not set +# CONFIG_USB_SUSPEND is not set +# CONFIG_USB_TEST is not set +# CONFIG_USB_TMC is not set +# CONFIG_USB_TOUCHSCREEN is not set +# CONFIG_USB_TRANCEVIBRATOR is not set +# CONFIG_USB_UEAGLEATM is not set +# CONFIG_USB_USBNET is not set +# CONFIG_USB_USBNET_MII is not set +# CONFIG_USB_VICAM is not set +CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y +# CONFIG_USB_VIDEO_CLASS is not set +# CONFIG_USB_VST is not set +# CONFIG_USB_W9968CF is not set +# CONFIG_USB_WACOM is not set +# CONFIG_USB_WDM is not set +# CONFIG_USB_WHCI_HCD is not set +# CONFIG_USB_WUSB_CBAF is not set +# CONFIG_USB_WUSB is not set +# CONFIG_USB_XHCI_HCD is not set +# CONFIG_USB_XPAD is not set +# CONFIG_USB_XUSBATM is not set +# CONFIG_USB_YEALINK is not set +# CONFIG_USB_ZC0301 is not set +# CONFIG_USB_ZD1201 is not set +# CONFIG_USB_ZR364XX is not set +# CONFIG_USE_GENERIC_SMP_HELPERS is not set +# CONFIG_UTS_NS is not set +# CONFIG_UWB is not set +# CONFIG_VETH is not set +# CONFIG_VFAT_FS is not set +# CONFIG_VGA_ARB is not set +# CONFIG_VGASTATE is not set +# CONFIG_VIA_RHINE is not set +# CONFIG_VIA_VELOCITY is not set +# CONFIG_VIDEO_ADV7170 is not set +# CONFIG_VIDEO_ADV7175 is not set +# CONFIG_VIDEO_ADV_DEBUG is not set +# CONFIG_VIDEO_ALLOW_V4L1 is not set +# CONFIG_VIDEO_BT819 is not set +# CONFIG_VIDEO_BT848 is not set +# CONFIG_VIDEO_BT856 is not set +# CONFIG_VIDEO_BT866 is not set +# CONFIG_VIDEO_CAFE_CCIC is not set +# CONFIG_VIDEO_CAPTURE_DRIVERS is not set +# CONFIG_VIDEO_CPIA is not set +# CONFIG_VIDEO_CS5345 is not set +# CONFIG_VIDEO_CS53L32A is not set +# CONFIG_VIDEO_CX231XX is not set +# CONFIG_VIDEO_CX2341X is not set +# CONFIG_VIDEO_CX25840 is not set +# CONFIG_VIDEO_CX88 is not set +# CONFIG_VIDEO_DEV is not set +# CONFIG_VIDEO_DPC is not set +# CONFIG_VIDEO_EM28XX is not set +# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set +# CONFIG_VIDEO_GO7007 is not set +# CONFIG_VIDEO_HDPVR is not set +# CONFIG_VIDEO_HELPER_CHIPS_AUTO is not set +# CONFIG_VIDEO_HEXIUM_GEMINI is not set +# CONFIG_VIDEO_HEXIUM_ORION is not set +# CONFIG_VIDEO_IVTV is not set +# CONFIG_VIDEO_KS0127 is not set +# CONFIG_VIDEO_M52790 is not set +# CONFIG_VIDEO_MEDIA is not set +# CONFIG_VIDEO_MSP3400 is not set +# CONFIG_VIDEO_MXB is not set +# CONFIG_VIDEO_OUTPUT_CONTROL is not set +# CONFIG_VIDEO_OV7670 is not set +# CONFIG_VIDEO_OVCAMCHIP is not set +# CONFIG_VIDEO_PMS is not set +# CONFIG_VIDEO_PVRUSB2 is not set +# CONFIG_VIDEO_SAA5246A is not set +# CONFIG_VIDEO_SAA5249 is not set +# CONFIG_VIDEO_SAA6588 is not set +# CONFIG_VIDEO_SAA7110 is not set +# CONFIG_VIDEO_SAA7111 is not set +# CONFIG_VIDEO_SAA7114 is not set +# CONFIG_VIDEO_SAA711X is not set +# CONFIG_VIDEO_SAA7127 is not set +# CONFIG_VIDEO_SAA7134 is not set +# CONFIG_VIDEO_SAA717X is not set +# CONFIG_VIDEO_SAA7185 is not set +# CONFIG_VIDEO_SAA7191 is not set +# CONFIG_VIDEO_SH_MOBILE_CEU is not set +# CONFIG_VIDEO_STRADIS is not set +# CONFIG_VIDEO_TCM825X is not set +# CONFIG_VIDEO_TDA7432 is not set +# CONFIG_VIDEO_TDA9840 is not set +# CONFIG_VIDEO_TDA9875 is not set +# CONFIG_VIDEO_TEA6415C is not set +# CONFIG_VIDEO_TEA6420 is not set +# CONFIG_VIDEO_TLV320AIC23B is not set +# CONFIG_VIDEO_TVAUDIO is not set +# CONFIG_VIDEO_TVP514X is not set +# CONFIG_VIDEO_TVP5150 is not set +# CONFIG_VIDEO_UPD64031A is not set +# CONFIG_VIDEO_UPD64083 is not set +# CONFIG_VIDEO_USBVISION is not set +CONFIG_VIDEO_V4L1_COMPAT=y +# CONFIG_VIDEO_V4L1 is not set +# CONFIG_VIDEO_V4L2_COMMON is not set +# CONFIG_VIDEO_V4L2 is not set +# CONFIG_VIDEO_VIVI is not set +# CONFIG_VIDEO_VP27SMPX is not set +# CONFIG_VIDEO_VPX3220 is not set +# CONFIG_VIDEO_WM8739 is not set +# CONFIG_VIDEO_WM8775 is not set +# CONFIG_VIDEO_ZORAN is not set +# CONFIG_VIRQ_DEBUG is not set +CONFIG_VIRT_TO_BUS=y +# CONFIG_VIRTUALIZATION is not set +# CONFIG_VITESSE_PHY is not set +# CONFIG_VLAN_8021Q_GVRP is not set +CONFIG_VLAN_8021Q=y +# CONFIG_VME_BUS is not set +# CONFIG_VM_EVENT_COUNTERS is not set +# CONFIG_VMSPLIT_1G is not set +# CONFIG_VMSPLIT_2G is not set +CONFIG_VMSPLIT_3G=y +# CONFIG_VT6655 is not set +# CONFIG_VT is not set +# CONFIG_VXFS_FS is not set +# CONFIG_W1 is not set +# CONFIG_W1_MASTER_DS1WM is not set +# CONFIG_W1_MASTER_DS2482 is not set +# CONFIG_W1_MASTER_DS2490 is not set +# CONFIG_W1_MASTER_GPIO is not set +# CONFIG_W1_MASTER_MATROX is not set +# CONFIG_W1_SLAVE_BQ27000 is not set +# CONFIG_W1_SLAVE_DS2431 is not set +# CONFIG_W1_SLAVE_DS2433 is not set +# CONFIG_W1_SLAVE_DS2760 is not set +# CONFIG_W1_SLAVE_SMEM is not set +# CONFIG_W1_SLAVE_THERM is not set +# CONFIG_W83627HF_WDT is not set +# CONFIG_W83697HF_WDT is not set +# CONFIG_W83877F_WDT is not set +# CONFIG_W83977F_WDT is not set +# CONFIG_WAN is not set +# CONFIG_WAN_ROUTER is not set +# CONFIG_WANXL is not set +# CONFIG_WATCHDOG_NOWAYOUT is not set +CONFIG_WATCHDOG=y +# CONFIG_WDTPCI is not set +# CONFIG_WIMAX is not set +CONFIG_WIRELESS_EXT_SYSFS=y +CONFIG_WIRELESS_EXT=y +CONFIG_WIRELESS_OLD_REGULATORY=y +CONFIG_WIRELESS=y +CONFIG_WLAN_80211=y +# CONFIG_WLAN_PRE80211 is not set +CONFIG_WLAN=y +# CONFIG_WORKQUEUE_TRACER is not set +# CONFIG_WR_PPMC is not set +# CONFIG_X25 is not set +# CONFIG_XFRM_IPCOMP is not set +# CONFIG_XFRM_MIGRATE is not set +# CONFIG_XFRM_STATISTICS is not set +# CONFIG_XFRM_SUB_POLICY is not set +# CONFIG_XFRM_USER is not set +CONFIG_XFRM=y +# CONFIG_XFS_DEBUG is not set +# CONFIG_XFS_FS is not set +# CONFIG_XFS_POSIX_ACL is not set +# CONFIG_XFS_QUOTA is not set +# CONFIG_XFS_RT is not set +# CONFIG_XFS_SECURITY is not set +# CONFIG_XIP_KERNEL is not set +# CONFIG_YAFFS_FS is not set +# CONFIG_YAM is not set +# CONFIG_YELLOWFIN is not set +# CONFIG_YENTA is not set +# CONFIG_YENTA_O2 is not set +# CONFIG_YENTA_RICOH is not set +# CONFIG_YENTA_TI is not set +# CONFIG_YENTA_TOSHIBA is not set +# CONFIG_ZD1211RW_DEBUG is not set +# CONFIG_ZD1211RW is not set +# CONFIG_ZEROPLUS_FF is not set +# CONFIG_ZISOFS_FS is not set +CONFIG_ZISOFS=y +CONFIG_ZLIB_DEFLATE=y +CONFIG_ZLIB_INFLATE=y +CONFIG_ZONE_DMA_FLAG=1 +CONFIG_ZONE_DMA=y diff --git a/target/linux/generic-2.6/files-2.6.32/drivers/char/gpio_dev.c b/target/linux/generic-2.6/files-2.6.32/drivers/char/gpio_dev.c new file mode 100644 index 000000000..8392fcf2d --- /dev/null +++ b/target/linux/generic-2.6/files-2.6.32/drivers/char/gpio_dev.c @@ -0,0 +1,201 @@ +/* + * character device wrapper for generic gpio layer + * + * 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 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA + * + * Feedback, Bugs... blogic@openwrt.org + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRVNAME "gpiodev" +#define DEVNAME "gpio" + +static int dev_major; +static unsigned int gpio_access_mask; +static struct class *gpiodev_class; + +/* Counter is 1, if the device is not opened and zero (or less) if opened. */ +static atomic_t gpio_open_cnt = ATOMIC_INIT(1); + +static int +gpio_ioctl(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg) +{ + int retval = 0; + + if (((1 << arg) & gpio_access_mask) != (1 << arg)) + { + retval = -EINVAL; + goto out; + } + + switch (cmd) + { + case GPIO_GET: + retval = gpio_get_value(arg); + break; + + case GPIO_SET: + gpio_set_value(arg, 1); + break; + + case GPIO_CLEAR: + gpio_set_value(arg, 0); + break; + + case GPIO_DIR_IN: + gpio_direction_input(arg); + break; + + case GPIO_DIR_OUT: + gpio_direction_output(arg, 0); + break; + + default: + retval = -EINVAL; + break; + } + +out: + return retval; +} + +static int +gpio_open(struct inode *inode, struct file *file) +{ + int result = 0; + unsigned int dev_minor = MINOR(inode->i_rdev); + + if (dev_minor != 0) + { + printk(KERN_ERR DRVNAME ": trying to access unknown minor device -> %d\n", dev_minor); + result = -ENODEV; + goto out; + } + + /* FIXME: We should really allow multiple applications to open the device + * at the same time, as long as the apps access different IO pins. + * The generic gpio-registration functions can be used for that. + * Two new IOCTLs have to be introduced for that. Need to check userspace + * compatibility first. --mb */ + if (!atomic_dec_and_test(&gpio_open_cnt)) { + atomic_inc(&gpio_open_cnt); + printk(KERN_ERR DRVNAME ": Device with minor ID %d already in use\n", dev_minor); + result = -EBUSY; + goto out; + } + +out: + return result; +} + +static int +gpio_close(struct inode * inode, struct file * file) +{ + smp_mb__before_atomic_inc(); + atomic_inc(&gpio_open_cnt); + + return 0; +} + +struct file_operations gpio_fops = { + ioctl: gpio_ioctl, + open: gpio_open, + release: gpio_close +}; + +static int +gpio_probe(struct platform_device *dev) +{ + int result = 0; + + dev_major = register_chrdev(0, DEVNAME, &gpio_fops); + if (!dev_major) + { + printk(KERN_ERR DRVNAME ": Error whilst opening %s \n", DEVNAME); + result = -ENODEV; + goto out; + } + + gpiodev_class = class_create(THIS_MODULE, DRVNAME); + device_create(gpiodev_class, NULL, MKDEV(dev_major, 0), dev, DEVNAME); + + printk(KERN_INFO DRVNAME ": gpio device registered with major %d\n", dev_major); + + if (dev->num_resources != 1) + { + printk(KERN_ERR DRVNAME ": device may only have 1 resource\n"); + result = -ENODEV; + goto out; + } + + gpio_access_mask = dev->resource[0].start; + + printk(KERN_INFO DRVNAME ": gpio platform device registered with access mask %08X\n", gpio_access_mask); +out: + return result; +} + +static int +gpio_remove(struct platform_device *dev) +{ + unregister_chrdev(dev_major, DEVNAME); + return 0; +} + +static struct +platform_driver gpio_driver = { + .probe = gpio_probe, + .remove = gpio_remove, + .driver = { + .name = "GPIODEV", + .owner = THIS_MODULE, + }, +}; + +static int __init +gpio_mod_init(void) +{ + int ret = platform_driver_register(&gpio_driver); + if (ret) + printk(KERN_INFO DRVNAME ": Error registering platfom driver!"); + + return ret; +} + +static void __exit +gpio_mod_exit(void) +{ + platform_driver_unregister(&gpio_driver); +} + +module_init (gpio_mod_init); +module_exit (gpio_mod_exit); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("John Crispin / OpenWrt"); +MODULE_DESCRIPTION("Character device for for generic gpio api"); diff --git a/target/linux/generic-2.6/files-2.6.32/drivers/input/misc/gpio_buttons.c b/target/linux/generic-2.6/files-2.6.32/drivers/input/misc/gpio_buttons.c new file mode 100644 index 000000000..83a817834 --- /dev/null +++ b/target/linux/generic-2.6/files-2.6.32/drivers/input/misc/gpio_buttons.c @@ -0,0 +1,209 @@ +/* + * Driver for buttons on GPIO lines not capable of generating interrupts + * + * Copyright (C) 2007,2008 Gabor Juhos + * + * This file was based on: /drivers/input/misc/cobalt_btns.c + * Copyright (C) 2007 Yoichi Yuasa + * + * also was based on: /drivers/input/keyboard/gpio_keys.c + * Copyright 2005 Phil Blundell + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include + +#define DRV_NAME "gpio-buttons" +#define DRV_VERSION "0.1.1" +#define PFX DRV_NAME ": " + +struct gpio_buttons_dev { + struct input_polled_dev *poll_dev; + struct gpio_buttons_platform_data *pdata; +}; + +static void gpio_buttons_poll(struct input_polled_dev *dev) +{ + struct gpio_buttons_dev *bdev = dev->private; + struct gpio_buttons_platform_data *pdata = bdev->pdata; + struct input_dev *input = dev->input; + int i; + + for (i = 0; i < bdev->pdata->nbuttons; i++) { + struct gpio_button *button = &pdata->buttons[i]; + unsigned int type = button->type ?: EV_KEY; + int state; + + state = gpio_get_value(button->gpio) ? 1 : 0; + state ^= button->active_low; + + if (state) { + button->count++; + } else { + if (button->count >= button->threshold) { + input_event(input, type, button->code, 1); + input_sync(input); + } + button->count = 0; + } + + if (button->count == button->threshold) { + input_event(input, type, button->code, 0); + input_sync(input); + } + } +} + +static int __devinit gpio_buttons_probe(struct platform_device *pdev) +{ + struct gpio_buttons_platform_data *pdata = pdev->dev.platform_data; + struct gpio_buttons_dev *bdev; + struct input_polled_dev *poll_dev; + struct input_dev *input; + int error, i; + + + if (!pdata) + return -ENXIO; + + bdev = kzalloc(sizeof(*bdev), GFP_KERNEL); + if (!bdev) { + printk(KERN_ERR DRV_NAME "no memory for device\n"); + return -ENOMEM; + } + + poll_dev = input_allocate_polled_device(); + if (!poll_dev) { + printk(KERN_ERR DRV_NAME "no memory for polled device\n"); + error = -ENOMEM; + goto err_free_bdev; + } + + poll_dev->private = bdev; + poll_dev->poll = gpio_buttons_poll; + poll_dev->poll_interval = pdata->poll_interval; + + input = poll_dev->input; + + input->evbit[0] = BIT(EV_KEY); + input->name = pdev->name; + input->phys = "gpio-buttons/input0"; + input->dev.parent = &pdev->dev; + + input->id.bustype = BUS_HOST; + input->id.vendor = 0x0001; + input->id.product = 0x0001; + input->id.version = 0x0100; + + for (i = 0; i < pdata->nbuttons; i++) { + struct gpio_button *button = &pdata->buttons[i]; + unsigned int gpio = button->gpio; + unsigned int type = button->type ?: EV_KEY; + + error = gpio_request(gpio, button->desc ? + button->desc : DRV_NAME); + if (error) { + printk(KERN_ERR PFX "unable to claim gpio %u, " + "error %d\n", gpio, error); + goto err_free_gpio; + } + + error = gpio_direction_input(gpio); + if (error) { + printk(KERN_ERR PFX "unable to set direction on " + "gpio %u, error %d\n", gpio, error); + goto err_free_gpio; + } + + input_set_capability(input, type, button->code); + button->count = 0; + } + + bdev->poll_dev = poll_dev; + bdev->pdata = pdata; + platform_set_drvdata(pdev, bdev); + + error = input_register_polled_device(poll_dev); + if (error) { + printk(KERN_ERR PFX "unable to register polled device, " + "error %d\n", error); + goto err_free_gpio; + } + + return 0; + +err_free_gpio: + for (i = i - 1; i >= 0; i--) + gpio_free(pdata->buttons[i].gpio); + + input_free_polled_device(poll_dev); + +err_free_bdev: + kfree(bdev); + + platform_set_drvdata(pdev, NULL); + return error; +} + +static int __devexit gpio_buttons_remove(struct platform_device *pdev) +{ + struct gpio_buttons_dev *bdev = platform_get_drvdata(pdev); + struct gpio_buttons_platform_data *pdata = bdev->pdata; + int i; + + input_unregister_polled_device(bdev->poll_dev); + + for (i = 0; i < pdata->nbuttons; i++) + gpio_free(pdata->buttons[i].gpio); + + input_free_polled_device(bdev->poll_dev); + + kfree(bdev); + platform_set_drvdata(pdev, NULL); + + return 0; +} + +static struct platform_driver gpio_buttons_driver = { + .probe = gpio_buttons_probe, + .remove = __devexit_p(gpio_buttons_remove), + .driver = { + .name = DRV_NAME, + .owner = THIS_MODULE, + }, +}; + +static int __init gpio_buttons_init(void) +{ + printk(KERN_INFO DRV_NAME " driver version " DRV_VERSION "\n"); + return platform_driver_register(&gpio_buttons_driver); +} + +static void __exit gpio_buttons_exit(void) +{ + platform_driver_unregister(&gpio_buttons_driver); +} + +module_init(gpio_buttons_init); +module_exit(gpio_buttons_exit); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Gabor Juhos "); +MODULE_VERSION(DRV_VERSION); +MODULE_DESCRIPTION("Polled buttons driver for CPU GPIOs"); + diff --git a/target/linux/generic-2.6/files-2.6.32/drivers/leds/leds-alix.c b/target/linux/generic-2.6/files-2.6.32/drivers/leds/leds-alix.c new file mode 100644 index 000000000..103ca7dfa --- /dev/null +++ b/target/linux/generic-2.6/files-2.6.32/drivers/leds/leds-alix.c @@ -0,0 +1,172 @@ +/* + * LEDs driver for PCEngines ALIX 2/3 series + * + * Copyright (C) 2007 Petr Liebman + * + * Based on leds-wrap.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include + +#define DRVNAME "alix-led" + +#define ALIX_LED1_PORT (0x6100) +#define ALIX_LED1_ON (1<<22) +#define ALIX_LED1_OFF (1<<6) + +#define ALIX_LED2_PORT (0x6180) +#define ALIX_LED2_ON (1<<25) +#define ALIX_LED2_OFF (1<<9) + +#define ALIX_LED3_PORT (0x6180) +#define ALIX_LED3_ON (1<<27) +#define ALIX_LED3_OFF (1<<11) + + +static struct platform_device *pdev; + +static void alix_led_set_1(struct led_classdev *led_cdev, + enum led_brightness value) +{ + if (value) + outl(ALIX_LED1_ON, ALIX_LED1_PORT); + else + outl(ALIX_LED1_OFF, ALIX_LED1_PORT); +} + +static void alix_led_set_2(struct led_classdev *led_cdev, + enum led_brightness value) +{ + if (value) + outl(ALIX_LED2_ON, ALIX_LED2_PORT); + else + outl(ALIX_LED2_OFF, ALIX_LED2_PORT); +} + +static void alix_led_set_3(struct led_classdev *led_cdev, + enum led_brightness value) +{ + if (value) + outl(ALIX_LED3_ON, ALIX_LED3_PORT); + else + outl(ALIX_LED3_OFF, ALIX_LED3_PORT); +} + +static struct led_classdev alix_led_1 = { + .name = "alix:1", + .brightness_set = alix_led_set_1, +}; + +static struct led_classdev alix_led_2 = { + .name = "alix:2", + .brightness_set = alix_led_set_2, +}; + +static struct led_classdev alix_led_3 = { + .name = "alix:3", + .brightness_set = alix_led_set_3, +}; + + +#ifdef CONFIG_PM +static int alix_led_suspend(struct platform_device *dev, + pm_message_t state) +{ + led_classdev_suspend(&alix_led_1); + led_classdev_suspend(&alix_led_2); + led_classdev_suspend(&alix_led_3); + return 0; +} + +static int alix_led_resume(struct platform_device *dev) +{ + led_classdev_resume(&alix_led_1); + led_classdev_resume(&alix_led_2); + led_classdev_resume(&alix_led_3); + return 0; +} +#else +#define alix_led_suspend NULL +#define alix_led_resume NULL +#endif + +static int alix_led_probe(struct platform_device *pdev) +{ + int ret; + + ret = led_classdev_register(&pdev->dev, &alix_led_1); + if (ret >= 0) + { + ret = led_classdev_register(&pdev->dev, &alix_led_2); + if (ret >= 0) + { + ret = led_classdev_register(&pdev->dev, &alix_led_3); + if (ret < 0) + led_classdev_unregister(&alix_led_2); + } + if (ret < 0) + led_classdev_unregister(&alix_led_1); + } + return ret; +} + +static int alix_led_remove(struct platform_device *pdev) +{ + led_classdev_unregister(&alix_led_1); + led_classdev_unregister(&alix_led_2); + led_classdev_unregister(&alix_led_3); + return 0; +} + +static struct platform_driver alix_led_driver = { + .probe = alix_led_probe, + .remove = alix_led_remove, + .suspend = alix_led_suspend, + .resume = alix_led_resume, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +static int __init alix_led_init(void) +{ + int ret; + + ret = platform_driver_register(&alix_led_driver); + if (ret < 0) + goto out; + + pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(pdev)) { + ret = PTR_ERR(pdev); + platform_driver_unregister(&alix_led_driver); + goto out; + } + +out: + return ret; +} + +static void __exit alix_led_exit(void) +{ + platform_device_unregister(pdev); + platform_driver_unregister(&alix_led_driver); +} + +module_init(alix_led_init); +module_exit(alix_led_exit); + +MODULE_AUTHOR("Petr Liebman"); +MODULE_DESCRIPTION("PCEngines ALIX LED driver"); +MODULE_LICENSE("GPL"); + diff --git a/target/linux/generic-2.6/files-2.6.32/drivers/leds/ledtrig-morse.c b/target/linux/generic-2.6/files-2.6.32/drivers/leds/ledtrig-morse.c new file mode 100644 index 000000000..cb47480a3 --- /dev/null +++ b/target/linux/generic-2.6/files-2.6.32/drivers/leds/ledtrig-morse.c @@ -0,0 +1,365 @@ +/* + * LED Morse Trigger + * + * Copyright (C) 2007 Gabor Juhos + * + * This file was based on: drivers/led/ledtrig-timer.c + * Copyright 2005-2006 Openedhand Ltd. + * Author: Richard Purdie + * + * also based on the patch '[PATCH] 2.5.59 morse code panics' posted + * in the LKML by Tomas Szepe at Thu, 30 Jan 2003 + * Copyright (C) 2002 Andrew Rodland + * Copyright (C) 2003 Tomas Szepe + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "leds.h" + +#define MORSE_DELAY_BASE (HZ/2) + +#define MORSE_STATE_BLINK_START 0 +#define MORSE_STATE_BLINK_STOP 1 + +#define MORSE_DIT_LEN 1 +#define MORSE_DAH_LEN 3 +#define MORSE_SPACE_LEN 7 + +struct morse_trig_data { + unsigned long delay; + char *msg; + + unsigned char morse; + unsigned char state; + char *msgpos; + struct timer_list timer; +}; + +const unsigned char morsetable[] = { + 0122, 0, 0310, 0, 0, 0163, /* "#$%&' */ + 055, 0155, 0, 0, 0163, 0141, 0152, 0051, /* ()*+,-./ */ + 077, 076, 074, 070, 060, 040, 041, 043, 047, 057, /* 0-9 */ + 0107, 0125, 0, 0061, 0, 0114, 0, /* :;<=>?@ */ + 006, 021, 025, 011, 002, 024, 013, 020, 004, /* A-I */ + 036, 015, 022, 007, 005, 017, 026, 033, 012, /* J-R */ + 010, 003, 014, 030, 016, 031, 035, 023, /* S-Z */ + 0, 0, 0, 0, 0154 /* [\]^_ */ +}; + +static inline unsigned char tomorse(char c) { + if (c >= 'a' && c <= 'z') + c = c - 'a' + 'A'; + if (c >= '"' && c <= '_') { + return morsetable[c - '"']; + } else + return 0; +} + +static inline unsigned long dit_len(struct morse_trig_data *morse_data) +{ + return MORSE_DIT_LEN*morse_data->delay; +} + +static inline unsigned long dah_len(struct morse_trig_data *morse_data) +{ + return MORSE_DAH_LEN*morse_data->delay; +} + +static inline unsigned long space_len(struct morse_trig_data *morse_data) +{ + return MORSE_SPACE_LEN*morse_data->delay; +} + +static void morse_timer_function(unsigned long data) +{ + struct led_classdev *led_cdev = (struct led_classdev *)data; + struct morse_trig_data *morse_data = led_cdev->trigger_data; + unsigned long brightness = LED_OFF; + unsigned long delay = 0; + + if (!morse_data->msg) + goto set_led; + + switch (morse_data->state) { + case MORSE_STATE_BLINK_START: + /* Starting a new blink. We have a valid code in morse. */ + delay = (morse_data->morse & 001) ? dah_len(morse_data): + dit_len(morse_data); + brightness = LED_FULL; + morse_data->state = MORSE_STATE_BLINK_STOP; + morse_data->morse >>= 1; + break; + case MORSE_STATE_BLINK_STOP: + /* Coming off of a blink. */ + morse_data->state = MORSE_STATE_BLINK_START; + + if (morse_data->morse > 1) { + /* Not done yet, just a one-dit pause. */ + delay = dit_len(morse_data); + break; + } + + /* Get a new char, figure out how much space. */ + /* First time through */ + if (!morse_data->msgpos) + morse_data->msgpos = (char *)morse_data->msg; + + if (!*morse_data->msgpos) { + /* Repeating */ + morse_data->msgpos = (char *)morse_data->msg; + delay = space_len(morse_data); + } else { + /* Inter-letter space */ + delay = dah_len(morse_data); + } + + if (!(morse_data->morse = tomorse(*morse_data->msgpos))) { + delay = space_len(morse_data); + /* And get us back here */ + morse_data->state = MORSE_STATE_BLINK_STOP; + } + morse_data->msgpos++; + break; + } + + mod_timer(&morse_data->timer, jiffies + msecs_to_jiffies(delay)); + +set_led: + led_set_brightness(led_cdev, brightness); +} + +static ssize_t _morse_delay_show(struct led_classdev *led_cdev, char *buf) +{ + struct morse_trig_data *morse_data = led_cdev->trigger_data; + + sprintf(buf, "%lu\n", morse_data->delay); + + return strlen(buf) + 1; +} + +static ssize_t _morse_delay_store(struct led_classdev *led_cdev, + const char *buf, size_t size) +{ + struct morse_trig_data *morse_data = led_cdev->trigger_data; + char *after; + unsigned long state = simple_strtoul(buf, &after, 10); + size_t count = after - buf; + int ret = -EINVAL; + + if (*after && isspace(*after)) + count++; + + if (count == size) { + morse_data->delay = state; + mod_timer(&morse_data->timer, jiffies + 1); + ret = count; + } + + return ret; +} + +static ssize_t _morse_msg_show(struct led_classdev *led_cdev, char *buf) +{ + struct morse_trig_data *morse_data = led_cdev->trigger_data; + + if (!morse_data->msg) + sprintf(buf, "\n"); + else + sprintf(buf, "%s\n", morse_data->msg); + + return strlen(buf) + 1; +} + +static ssize_t _morse_msg_store(struct led_classdev *led_cdev, + const char *buf, size_t size) +{ + struct morse_trig_data *morse_data = led_cdev->trigger_data; + char *m; + + m = kmalloc(size, GFP_KERNEL); + if (!m) + return -ENOMEM; + + memcpy(m,buf,size); + m[size]='\0'; + + if (morse_data->msg) + kfree(morse_data->msg); + + morse_data->msg = m; + morse_data->msgpos = NULL; + morse_data->state = MORSE_STATE_BLINK_STOP; + + mod_timer(&morse_data->timer, jiffies + 1); + + return size; +} + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) +static ssize_t morse_delay_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct led_classdev *led_cdev = dev_get_drvdata(dev); + + return _morse_delay_show(led_cdev, buf); +} + +static ssize_t morse_delay_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t size) +{ + struct led_classdev *led_cdev = dev_get_drvdata(dev); + + return _morse_delay_store(led_cdev, buf, size); +} + +static ssize_t morse_msg_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct led_classdev *led_cdev = dev_get_drvdata(dev); + + return _morse_msg_show(led_cdev, buf); +} + +static ssize_t morse_msg_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t size) +{ + struct led_classdev *led_cdev = dev_get_drvdata(dev); + + return _morse_msg_store(led_cdev, buf, size); +} + +static DEVICE_ATTR(delay, 0644, morse_delay_show, morse_delay_store); +static DEVICE_ATTR(message, 0644, morse_msg_show, morse_msg_store); + +#define led_device_create_file(leddev, attr) \ + device_create_file(leddev->dev, &dev_attr_ ## attr) +#define led_device_remove_file(leddev, attr) \ + device_remove_file(leddev->dev, &dev_attr_ ## attr) + +#else +static ssize_t morse_delay_show(struct class_device *dev, char *buf) +{ + struct led_classdev *led_cdev = class_get_devdata(dev); + + return _morse_delay_show(led_cdev, buf); +} + +static ssize_t morse_delay_store(struct class_device *dev, const char *buf, + size_t size) +{ + struct led_classdev *led_cdev = class_get_devdata(dev); + + return _morse_delay_store(led_cdev, buf, size); +} + +static ssize_t morse_msg_show(struct class_device *dev, char *buf) +{ + struct led_classdev *led_cdev = class_get_devdata(dev); + + return _morse_msg_show(led_cdev, buf); +} + +static ssize_t morse_msg_store(struct class_device *dev, const char *buf, + size_t size) +{ + struct led_classdev *led_cdev = class_get_devdata(dev); + + return _morse_msg_store(led_cdev, buf, size); +} + +static CLASS_DEVICE_ATTR(delay, 0644, morse_delay_show, morse_delay_store); +static CLASS_DEVICE_ATTR(message, 0644, morse_msg_show, morse_msg_store); + +#define led_device_create_file(leddev, attr) \ + class_device_create_file(leddev->class_dev, &class_device_attr_ ## attr) +#define led_device_remove_file(leddev, attr) \ + class_device_remove_file(leddev->class_dev, &class_device_attr_ ## attr) + +#endif + +static void morse_trig_activate(struct led_classdev *led_cdev) +{ + struct morse_trig_data *morse_data; + int rc; + + morse_data = kzalloc(sizeof(*morse_data), GFP_KERNEL); + if (!morse_data) + return; + + morse_data->delay = MORSE_DELAY_BASE; + init_timer(&morse_data->timer); + morse_data->timer.function = morse_timer_function; + morse_data->timer.data = (unsigned long)led_cdev; + + rc = led_device_create_file(led_cdev, delay); + if (rc) goto err; + + rc = led_device_create_file(led_cdev, message); + if (rc) goto err_delay; + + led_cdev->trigger_data = morse_data; + + return; + +err_delay: + led_device_remove_file(led_cdev, delay); +err: + kfree(morse_data); +} + +static void morse_trig_deactivate(struct led_classdev *led_cdev) +{ + struct morse_trig_data *morse_data = led_cdev->trigger_data; + + if (!morse_data) + return; + + led_device_remove_file(led_cdev, message); + led_device_remove_file(led_cdev, delay); + + del_timer_sync(&morse_data->timer); + if (morse_data->msg) + kfree(morse_data->msg); + + kfree(morse_data); +} + +static struct led_trigger morse_led_trigger = { + .name = "morse", + .activate = morse_trig_activate, + .deactivate = morse_trig_deactivate, +}; + +static int __init morse_trig_init(void) +{ + return led_trigger_register(&morse_led_trigger); +} + +static void __exit morse_trig_exit(void) +{ + led_trigger_unregister(&morse_led_trigger); +} + +module_init(morse_trig_init); +module_exit(morse_trig_exit); + +MODULE_AUTHOR("Gabor Juhos "); +MODULE_DESCRIPTION("Morse LED trigger"); +MODULE_LICENSE("GPL"); diff --git a/target/linux/generic-2.6/files-2.6.32/drivers/leds/ledtrig-netdev.c b/target/linux/generic-2.6/files-2.6.32/drivers/leds/ledtrig-netdev.c new file mode 100644 index 000000000..4193e4eda --- /dev/null +++ b/target/linux/generic-2.6/files-2.6.32/drivers/leds/ledtrig-netdev.c @@ -0,0 +1,454 @@ +/* + * LED Kernel Netdev Trigger + * + * Toggles the LED to reflect the link and traffic state of a named net device + * + * Copyright 2007 Oliver Jowett + * + * Derived from ledtrig-timer.c which is: + * Copyright 2005-2006 Openedhand Ltd. + * Author: Richard Purdie + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) +#include +#endif + +#include "leds.h" + +/* + * Configurable sysfs attributes: + * + * device_name - network device name to monitor + * + * interval - duration of LED blink, in milliseconds + * + * mode - either "none" (LED is off) or a space separated list of one or more of: + * link: LED's normal state reflects whether the link is up (has carrier) or not + * tx: LED blinks on transmitted data + * rx: LED blinks on receive data + * + * Some suggestions: + * + * Simple link status LED: + * $ echo netdev >someled/trigger + * $ echo eth0 >someled/device_name + * $ echo link >someled/mode + * + * Ethernet-style link/activity LED: + * $ echo netdev >someled/trigger + * $ echo eth0 >someled/device_name + * $ echo "link tx rx" >someled/mode + * + * Modem-style tx/rx LEDs: + * $ echo netdev >led1/trigger + * $ echo ppp0 >led1/device_name + * $ echo tx >led1/mode + * $ echo netdev >led2/trigger + * $ echo ppp0 >led2/device_name + * $ echo rx >led2/mode + * + */ + +#define MODE_LINK 1 +#define MODE_TX 2 +#define MODE_RX 4 + +struct led_netdev_data { + rwlock_t lock; + + struct timer_list timer; + struct notifier_block notifier; + + struct led_classdev *led_cdev; + struct net_device *net_dev; + + char device_name[IFNAMSIZ]; + unsigned interval; + unsigned mode; + unsigned link_up; + unsigned last_activity; +}; + +static void set_baseline_state(struct led_netdev_data *trigger_data) +{ + if ((trigger_data->mode & MODE_LINK) != 0 && trigger_data->link_up) + led_set_brightness(trigger_data->led_cdev, LED_FULL); + else + led_set_brightness(trigger_data->led_cdev, LED_OFF); + + if ((trigger_data->mode & (MODE_TX | MODE_RX)) != 0 && trigger_data->link_up) + mod_timer(&trigger_data->timer, jiffies + trigger_data->interval); + else + del_timer(&trigger_data->timer); +} + +static ssize_t led_device_name_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct led_classdev *led_cdev = dev_get_drvdata(dev); + struct led_netdev_data *trigger_data = led_cdev->trigger_data; + + read_lock(&trigger_data->lock); + sprintf(buf, "%s\n", trigger_data->device_name); + read_unlock(&trigger_data->lock); + + return strlen(buf) + 1; +} + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) +extern struct net init_net; +#endif + +static ssize_t led_device_name_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t size) +{ + struct led_classdev *led_cdev = dev_get_drvdata(dev); + struct led_netdev_data *trigger_data = led_cdev->trigger_data; + + if (size < 0 || size >= IFNAMSIZ) + return -EINVAL; + + write_lock(&trigger_data->lock); + + strcpy(trigger_data->device_name, buf); + if (size > 0 && trigger_data->device_name[size-1] == '\n') + trigger_data->device_name[size-1] = 0; + + if (trigger_data->device_name[0] != 0) { + /* check for existing device to update from */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) + trigger_data->net_dev = dev_get_by_name(&init_net, trigger_data->device_name); +#else + trigger_data->net_dev = dev_get_by_name(trigger_data->device_name); +#endif + if (trigger_data->net_dev != NULL) + trigger_data->link_up = (dev_get_flags(trigger_data->net_dev) & IFF_LOWER_UP) != 0; + set_baseline_state(trigger_data); /* updates LEDs, may start timers */ + } + + write_unlock(&trigger_data->lock); + return size; +} + +static DEVICE_ATTR(device_name, 0644, led_device_name_show, led_device_name_store); + +static ssize_t led_mode_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct led_classdev *led_cdev = dev_get_drvdata(dev); + struct led_netdev_data *trigger_data = led_cdev->trigger_data; + + read_lock(&trigger_data->lock); + + if (trigger_data->mode == 0) { + strcpy(buf, "none\n"); + } else { + if (trigger_data->mode & MODE_LINK) + strcat(buf, "link "); + if (trigger_data->mode & MODE_TX) + strcat(buf, "tx "); + if (trigger_data->mode & MODE_RX) + strcat(buf, "rx "); + strcat(buf, "\n"); + } + + read_unlock(&trigger_data->lock); + + return strlen(buf)+1; +} + +static ssize_t led_mode_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t size) +{ + struct led_classdev *led_cdev = dev_get_drvdata(dev); + struct led_netdev_data *trigger_data = led_cdev->trigger_data; + char copybuf[1024]; + int new_mode = -1; + char *p, *token; + + /* take a copy since we don't want to trash the inbound buffer when using strsep */ + strncpy(copybuf, buf, sizeof(copybuf)); + copybuf[1023] = 0; + p = copybuf; + + while ((token = strsep(&p, " \t\n")) != NULL) { + if (!*token) + continue; + + if (new_mode == -1) + new_mode = 0; + + if (!strcmp(token, "none")) + new_mode = 0; + else if (!strcmp(token, "tx")) + new_mode |= MODE_TX; + else if (!strcmp(token, "rx")) + new_mode |= MODE_RX; + else if (!strcmp(token, "link")) + new_mode |= MODE_LINK; + else + return -EINVAL; + } + + if (new_mode == -1) + return -EINVAL; + + write_lock(&trigger_data->lock); + trigger_data->mode = new_mode; + set_baseline_state(trigger_data); + write_unlock(&trigger_data->lock); + + return size; +} + +static DEVICE_ATTR(mode, 0644, led_mode_show, led_mode_store); + +static ssize_t led_interval_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct led_classdev *led_cdev = dev_get_drvdata(dev); + struct led_netdev_data *trigger_data = led_cdev->trigger_data; + + read_lock(&trigger_data->lock); + sprintf(buf, "%u\n", jiffies_to_msecs(trigger_data->interval)); + read_unlock(&trigger_data->lock); + + return strlen(buf) + 1; +} + +static ssize_t led_interval_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t size) +{ + struct led_classdev *led_cdev = dev_get_drvdata(dev); + struct led_netdev_data *trigger_data = led_cdev->trigger_data; + int ret = -EINVAL; + char *after; + unsigned long value = simple_strtoul(buf, &after, 10); + size_t count = after - buf; + + if (*after && isspace(*after)) + count++; + + /* impose some basic bounds on the timer interval */ + if (count == size && value >= 5 && value <= 10000) { + write_lock(&trigger_data->lock); + trigger_data->interval = msecs_to_jiffies(value); + set_baseline_state(trigger_data); // resets timer + write_unlock(&trigger_data->lock); + ret = count; + } + + return ret; +} + +static DEVICE_ATTR(interval, 0644, led_interval_show, led_interval_store); + +static int netdev_trig_notify(struct notifier_block *nb, + unsigned long evt, + void *dv) +{ + struct net_device *dev = dv; + struct led_netdev_data *trigger_data = container_of(nb, struct led_netdev_data, notifier); + + if (evt != NETDEV_UP && evt != NETDEV_DOWN && evt != NETDEV_CHANGE && evt != NETDEV_REGISTER && evt != NETDEV_UNREGISTER) + return NOTIFY_DONE; + + write_lock(&trigger_data->lock); + + if (strcmp(dev->name, trigger_data->device_name)) + goto done; + + if (evt == NETDEV_REGISTER) { + if (trigger_data->net_dev != NULL) + dev_put(trigger_data->net_dev); + dev_hold(dev); + trigger_data->net_dev = dev; + trigger_data->link_up = 0; + goto done; + } + + if (evt == NETDEV_UNREGISTER && trigger_data->net_dev != NULL) { + dev_put(trigger_data->net_dev); + trigger_data->net_dev = NULL; + goto done; + } + + /* UP / DOWN / CHANGE */ + + trigger_data->link_up = (evt != NETDEV_DOWN && netif_carrier_ok(dev)); + set_baseline_state(trigger_data); + +done: + write_unlock(&trigger_data->lock); + return NOTIFY_DONE; +} + +/* here's the real work! */ +static void netdev_trig_timer(unsigned long arg) +{ + struct led_netdev_data *trigger_data = (struct led_netdev_data *)arg; + struct net_device_stats *dev_stats; + unsigned new_activity; + + write_lock(&trigger_data->lock); + + if (!trigger_data->link_up || !trigger_data->net_dev || (trigger_data->mode & (MODE_TX | MODE_RX)) == 0) { + /* we don't need to do timer work, just reflect link state. */ + led_set_brightness(trigger_data->led_cdev, ((trigger_data->mode & MODE_LINK) != 0 && trigger_data->link_up) ? LED_FULL : LED_OFF); + goto no_restart; + } +#ifdef CONFIG_COMPAT_NET_DEV_OPS + dev_stats = trigger_data->net_dev->get_stats(trigger_data->net_dev); +#else + dev_stats = trigger_data->net_dev->netdev_ops->ndo_get_stats(trigger_data->net_dev); +#endif + new_activity = + ((trigger_data->mode & MODE_TX) ? dev_stats->tx_packets : 0) + + ((trigger_data->mode & MODE_RX) ? dev_stats->rx_packets : 0); + + if (trigger_data->mode & MODE_LINK) { + /* base state is ON (link present) */ + /* if there's no link, we don't get this far and the LED is off */ + + /* OFF -> ON always */ + /* ON -> OFF on activity */ + if (trigger_data->led_cdev->brightness == LED_OFF) { + led_set_brightness(trigger_data->led_cdev, LED_FULL); + } else if (trigger_data->last_activity != new_activity) { + led_set_brightness(trigger_data->led_cdev, LED_OFF); + } + } else { + /* base state is OFF */ + /* ON -> OFF always */ + /* OFF -> ON on activity */ + if (trigger_data->led_cdev->brightness == LED_FULL) { + led_set_brightness(trigger_data->led_cdev, LED_OFF); + } else if (trigger_data->last_activity != new_activity) { + led_set_brightness(trigger_data->led_cdev, LED_FULL); + } + } + + trigger_data->last_activity = new_activity; + mod_timer(&trigger_data->timer, jiffies + trigger_data->interval); + +no_restart: + write_unlock(&trigger_data->lock); +} + +static void netdev_trig_activate(struct led_classdev *led_cdev) +{ + struct led_netdev_data *trigger_data; + int rc; + + trigger_data = kzalloc(sizeof(struct led_netdev_data), GFP_KERNEL); + if (!trigger_data) + return; + + rwlock_init(&trigger_data->lock); + + trigger_data->notifier.notifier_call = netdev_trig_notify; + trigger_data->notifier.priority = 10; + + setup_timer(&trigger_data->timer, netdev_trig_timer, (unsigned long) trigger_data); + + trigger_data->led_cdev = led_cdev; + trigger_data->net_dev = NULL; + trigger_data->device_name[0] = 0; + + trigger_data->mode = 0; + trigger_data->interval = msecs_to_jiffies(50); + trigger_data->link_up = 0; + trigger_data->last_activity = 0; + + led_cdev->trigger_data = trigger_data; + + rc = device_create_file(led_cdev->dev, &dev_attr_device_name); + if (rc) + goto err_out; + rc = device_create_file(led_cdev->dev, &dev_attr_mode); + if (rc) + goto err_out_device_name; + rc = device_create_file(led_cdev->dev, &dev_attr_interval); + if (rc) + goto err_out_mode; + + register_netdevice_notifier(&trigger_data->notifier); + return; + +err_out_mode: + device_remove_file(led_cdev->dev, &dev_attr_mode); +err_out_device_name: + device_remove_file(led_cdev->dev, &dev_attr_device_name); +err_out: + led_cdev->trigger_data = NULL; + kfree(trigger_data); +} + +static void netdev_trig_deactivate(struct led_classdev *led_cdev) +{ + struct led_netdev_data *trigger_data = led_cdev->trigger_data; + + if (trigger_data) { + unregister_netdevice_notifier(&trigger_data->notifier); + + device_remove_file(led_cdev->dev, &dev_attr_device_name); + device_remove_file(led_cdev->dev, &dev_attr_mode); + device_remove_file(led_cdev->dev, &dev_attr_interval); + + write_lock(&trigger_data->lock); + + if (trigger_data->net_dev) { + dev_put(trigger_data->net_dev); + trigger_data->net_dev = NULL; + } + + write_unlock(&trigger_data->lock); + + del_timer_sync(&trigger_data->timer); + + kfree(trigger_data); + } +} + +static struct led_trigger netdev_led_trigger = { + .name = "netdev", + .activate = netdev_trig_activate, + .deactivate = netdev_trig_deactivate, +}; + +static int __init netdev_trig_init(void) +{ + return led_trigger_register(&netdev_led_trigger); +} + +static void __exit netdev_trig_exit(void) +{ + led_trigger_unregister(&netdev_led_trigger); +} + +module_init(netdev_trig_init); +module_exit(netdev_trig_exit); + +MODULE_AUTHOR("Oliver Jowett "); +MODULE_DESCRIPTION("Netdev LED trigger"); +MODULE_LICENSE("GPL"); diff --git a/target/linux/generic-2.6/files-2.6.32/include/linux/glamo-engine.h b/target/linux/generic-2.6/files-2.6.32/include/linux/glamo-engine.h new file mode 100644 index 000000000..516d45fa6 --- /dev/null +++ b/target/linux/generic-2.6/files-2.6.32/include/linux/glamo-engine.h @@ -0,0 +1,27 @@ +#ifndef __GLAMO_ENGINE_H +#define __GLAMO_ENGINE_H + +enum glamo_engine { + GLAMO_ENGINE_CAPTURE = 0, + GLAMO_ENGINE_ISP = 1, + GLAMO_ENGINE_JPEG = 2, + GLAMO_ENGINE_MPEG_ENC = 3, + GLAMO_ENGINE_MPEG_DEC = 4, + GLAMO_ENGINE_LCD = 5, + GLAMO_ENGINE_CMDQ = 6, + GLAMO_ENGINE_2D = 7, + GLAMO_ENGINE_3D = 8, + GLAMO_ENGINE_MMC = 9, + GLAMO_ENGINE_MICROP0 = 10, + GLAMO_ENGINE_RISC = 11, + GLAMO_ENGINE_MICROP1_MPEG_ENC = 12, + GLAMO_ENGINE_MICROP1_MPEG_DEC = 13, +#if 0 + GLAMO_ENGINE_H264_DEC = 14, + GLAMO_ENGINE_RISC1 = 15, + GLAMO_ENGINE_SPI = 16, +#endif + __NUM_GLAMO_ENGINES +}; + +#endif diff --git a/target/linux/generic-2.6/files-2.6.32/include/linux/glamofb.h b/target/linux/generic-2.6/files-2.6.32/include/linux/glamofb.h new file mode 100644 index 000000000..5f9fab5a4 --- /dev/null +++ b/target/linux/generic-2.6/files-2.6.32/include/linux/glamofb.h @@ -0,0 +1,35 @@ +#ifndef _LINUX_GLAMOFB_H +#define _LINUX_GLAMOFB_H + +#include + +#ifdef __KERNEL__ + +struct glamo_core; +struct glamofb_handle; + +struct glamo_fb_platform_data { + int width, height; + + int num_modes; + struct fb_videomode *modes; + + struct glamo_core *core; +}; + +int glamofb_cmd_mode(struct glamofb_handle *gfb, int on); +int glamofb_cmd_write(struct glamofb_handle *gfb, u_int16_t val); + +#ifdef CONFIG_MFD_GLAMO +void glamo_lcm_reset(struct platform_device *pdev, int level); +#else +#define glamo_lcm_reset(...) do {} while (0) +#endif + +#endif + +#define GLAMOFB_ENGINE_ENABLE _IOW('F', 0x1, __u32) +#define GLAMOFB_ENGINE_DISABLE _IOW('F', 0x2, __u32) +#define GLAMOFB_ENGINE_RESET _IOW('F', 0x3, __u32) + +#endif diff --git a/target/linux/generic-2.6/files-2.6.32/include/linux/gpio_buttons.h b/target/linux/generic-2.6/files-2.6.32/include/linux/gpio_buttons.h new file mode 100644 index 000000000..f5e629725 --- /dev/null +++ b/target/linux/generic-2.6/files-2.6.32/include/linux/gpio_buttons.h @@ -0,0 +1,35 @@ +/* + * Definitions for the GPIO buttons interface driver + * + * Copyright (C) 2007,2008 Gabor Juhos + * + * This file was based on: /include/linux/gpio_keys.h + * The original gpio_keys.h seems not to have a license. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#ifndef _GPIO_BUTTONS_H_ +#define _GPIO_BUTTONS_H_ + +struct gpio_button { + int gpio; /* GPIO line number */ + int active_low; + char *desc; /* button description */ + int type; /* input event type (EV_KEY, EV_SW) */ + int code; /* input event code (KEY_*, SW_*) */ + int count; + int threshold; /* count threshold */ +}; + +struct gpio_buttons_platform_data { + struct gpio_button *buttons; + int nbuttons; /* number of buttons */ + int poll_interval; /* polling interval */ +}; + +#endif /* _GPIO_BUTTONS_H_ */ + diff --git a/target/linux/generic-2.6/files-2.6.32/include/linux/gpio_dev.h b/target/linux/generic-2.6/files-2.6.32/include/linux/gpio_dev.h new file mode 100644 index 000000000..3f3c9c772 --- /dev/null +++ b/target/linux/generic-2.6/files-2.6.32/include/linux/gpio_dev.h @@ -0,0 +1,11 @@ +#ifndef _GPIODEV_H__ +#define _GPIODEV_H__ + +#define IOC_GPIODEV_MAGIC 'B' +#define GPIO_GET _IO(IOC_GPIODEV_MAGIC, 10) +#define GPIO_SET _IO(IOC_GPIODEV_MAGIC, 11) +#define GPIO_CLEAR _IO(IOC_GPIODEV_MAGIC, 12) +#define GPIO_DIR_IN _IO(IOC_GPIODEV_MAGIC, 13) +#define GPIO_DIR_OUT _IO(IOC_GPIODEV_MAGIC, 14) + +#endif diff --git a/target/linux/generic-2.6/patches-2.6.32/001-squashfs_move_zlib_decomp.patch b/target/linux/generic-2.6/patches-2.6.32/001-squashfs_move_zlib_decomp.patch new file mode 100644 index 000000000..94096791f --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/001-squashfs_move_zlib_decomp.patch @@ -0,0 +1,244 @@ +From 6c4419d997d4431bb62e73475cd6b084e83efbd1 Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Tue, 22 Sep 2009 19:25:24 +0100 +Subject: [PATCH] Squashfs: move zlib decompression wrapper code into a separate file + +Signed-off-by: Phillip Lougher +--- + fs/squashfs/Makefile | 2 +- + fs/squashfs/block.c | 74 ++---------------------------- + fs/squashfs/squashfs.h | 4 ++ + fs/squashfs/zlib_wrapper.c | 109 ++++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 118 insertions(+), 71 deletions(-) + create mode 100644 fs/squashfs/zlib_wrapper.c + +--- a/fs/squashfs/Makefile ++++ b/fs/squashfs/Makefile +@@ -4,4 +4,4 @@ + + obj-$(CONFIG_SQUASHFS) += squashfs.o + squashfs-y += block.o cache.o dir.o export.o file.o fragment.o id.o inode.o +-squashfs-y += namei.o super.o symlink.o ++squashfs-y += namei.o super.o symlink.o zlib_wrapper.o +--- a/fs/squashfs/block.c ++++ b/fs/squashfs/block.c +@@ -29,7 +29,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -153,72 +152,10 @@ int squashfs_read_data(struct super_bloc + } + + if (compressed) { +- int zlib_err = 0, zlib_init = 0; +- +- /* +- * Uncompress block. +- */ +- +- mutex_lock(&msblk->read_data_mutex); +- +- msblk->stream.avail_out = 0; +- msblk->stream.avail_in = 0; +- +- bytes = length; +- do { +- if (msblk->stream.avail_in == 0 && k < b) { +- avail = min(bytes, msblk->devblksize - offset); +- bytes -= avail; +- wait_on_buffer(bh[k]); +- if (!buffer_uptodate(bh[k])) +- goto release_mutex; +- +- if (avail == 0) { +- offset = 0; +- put_bh(bh[k++]); +- continue; +- } +- +- msblk->stream.next_in = bh[k]->b_data + offset; +- msblk->stream.avail_in = avail; +- offset = 0; +- } +- +- if (msblk->stream.avail_out == 0 && page < pages) { +- msblk->stream.next_out = buffer[page++]; +- msblk->stream.avail_out = PAGE_CACHE_SIZE; +- } +- +- if (!zlib_init) { +- zlib_err = zlib_inflateInit(&msblk->stream); +- if (zlib_err != Z_OK) { +- ERROR("zlib_inflateInit returned" +- " unexpected result 0x%x," +- " srclength %d\n", zlib_err, +- srclength); +- goto release_mutex; +- } +- zlib_init = 1; +- } +- +- zlib_err = zlib_inflate(&msblk->stream, Z_SYNC_FLUSH); +- +- if (msblk->stream.avail_in == 0 && k < b) +- put_bh(bh[k++]); +- } while (zlib_err == Z_OK); +- +- if (zlib_err != Z_STREAM_END) { +- ERROR("zlib_inflate error, data probably corrupt\n"); +- goto release_mutex; +- } +- +- zlib_err = zlib_inflateEnd(&msblk->stream); +- if (zlib_err != Z_OK) { +- ERROR("zlib_inflate error, data probably corrupt\n"); +- goto release_mutex; +- } +- length = msblk->stream.total_out; +- mutex_unlock(&msblk->read_data_mutex); ++ length = zlib_uncompress(msblk, buffer, bh, b, offset, length, ++ srclength, pages); ++ if (length < 0) ++ goto read_failure; + } else { + /* + * Block is uncompressed. +@@ -255,9 +192,6 @@ int squashfs_read_data(struct super_bloc + kfree(bh); + return length; + +-release_mutex: +- mutex_unlock(&msblk->read_data_mutex); +- + block_release: + for (; k < b; k++) + put_bh(bh[k]); +--- a/fs/squashfs/squashfs.h ++++ b/fs/squashfs/squashfs.h +@@ -70,6 +70,10 @@ extern struct inode *squashfs_iget(struc + unsigned int); + extern int squashfs_read_inode(struct inode *, long long); + ++/* zlib_wrapper.c */ ++extern int zlib_uncompress(struct squashfs_sb_info *, void **, ++ struct buffer_head **, int, int, int, int, int); ++ + /* + * Inodes and files operations + */ +--- /dev/null ++++ b/fs/squashfs/zlib_wrapper.c +@@ -0,0 +1,109 @@ ++/* ++ * Squashfs - a compressed read only filesystem for Linux ++ * ++ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 ++ * Phillip Lougher ++ * ++ * 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, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ * ++ * zlib_wrapper.c ++ */ ++ ++ ++#include ++#include ++#include ++ ++#include "squashfs_fs.h" ++#include "squashfs_fs_sb.h" ++#include "squashfs_fs_i.h" ++#include "squashfs.h" ++ ++int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, ++ struct buffer_head **bh, int b, int offset, int length, int srclength, ++ int pages) ++{ ++ int zlib_err = 0, zlib_init = 0; ++ int avail, bytes, k = 0, page = 0; ++ ++ mutex_lock(&msblk->read_data_mutex); ++ ++ msblk->stream.avail_out = 0; ++ msblk->stream.avail_in = 0; ++ ++ bytes = length; ++ do { ++ if (msblk->stream.avail_in == 0 && k < b) { ++ avail = min(bytes, msblk->devblksize - offset); ++ bytes -= avail; ++ wait_on_buffer(bh[k]); ++ if (!buffer_uptodate(bh[k])) ++ goto release_mutex; ++ ++ if (avail == 0) { ++ offset = 0; ++ put_bh(bh[k++]); ++ continue; ++ } ++ ++ msblk->stream.next_in = bh[k]->b_data + offset; ++ msblk->stream.avail_in = avail; ++ offset = 0; ++ } ++ ++ if (msblk->stream.avail_out == 0 && page < pages) { ++ msblk->stream.next_out = buffer[page++]; ++ msblk->stream.avail_out = PAGE_CACHE_SIZE; ++ } ++ ++ if (!zlib_init) { ++ zlib_err = zlib_inflateInit(&msblk->stream); ++ if (zlib_err != Z_OK) { ++ ERROR("zlib_inflateInit returned unexpected " ++ "result 0x%x, srclength %d\n", ++ zlib_err, srclength); ++ goto release_mutex; ++ } ++ zlib_init = 1; ++ } ++ ++ zlib_err = zlib_inflate(&msblk->stream, Z_SYNC_FLUSH); ++ ++ if (msblk->stream.avail_in == 0 && k < b) ++ put_bh(bh[k++]); ++ } while (zlib_err == Z_OK); ++ ++ if (zlib_err != Z_STREAM_END) { ++ ERROR("zlib_inflate error, data probably corrupt\n"); ++ goto release_mutex; ++ } ++ ++ zlib_err = zlib_inflateEnd(&msblk->stream); ++ if (zlib_err != Z_OK) { ++ ERROR("zlib_inflate error, data probably corrupt\n"); ++ goto release_mutex; ++ } ++ ++ mutex_unlock(&msblk->read_data_mutex); ++ return msblk->stream.total_out; ++ ++release_mutex: ++ mutex_unlock(&msblk->read_data_mutex); ++ ++ for (; k < b; k++) ++ put_bh(bh[k]); ++ ++ return -EIO; ++} diff --git a/target/linux/generic-2.6/patches-2.6.32/002-squashfs_factor_out_remaining_zlib.patch b/target/linux/generic-2.6/patches-2.6.32/002-squashfs_factor_out_remaining_zlib.patch new file mode 100644 index 000000000..eacbb97ae --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/002-squashfs_factor_out_remaining_zlib.patch @@ -0,0 +1,317 @@ +From 37c44e85fd49676ec15ccaeea065662c1fbcda7d Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Wed, 23 Sep 2009 19:04:49 +0100 +Subject: [PATCH] Squashfs: Factor out remaining zlib dependencies into separate wrapper file + +Move zlib buffer init/destroy code into separate wrapper file. Also +make zlib z_stream field a void * removing the need to include zlib.h +for most files. + +Signed-off-by: Phillip Lougher +--- + fs/squashfs/block.c | 1 - + fs/squashfs/cache.c | 1 - + fs/squashfs/dir.c | 1 - + fs/squashfs/export.c | 1 - + fs/squashfs/file.c | 1 - + fs/squashfs/fragment.c | 1 - + fs/squashfs/id.c | 1 - + fs/squashfs/inode.c | 1 - + fs/squashfs/namei.c | 1 - + fs/squashfs/squashfs.h | 2 + + fs/squashfs/squashfs_fs_sb.h | 2 +- + fs/squashfs/super.c | 14 +++------ + fs/squashfs/symlink.c | 1 - + fs/squashfs/zlib_wrapper.c | 56 ++++++++++++++++++++++++++++++++--------- + 14 files changed, 51 insertions(+), 33 deletions(-) + +--- a/fs/squashfs/block.c ++++ b/fs/squashfs/block.c +@@ -31,7 +31,6 @@ + #include + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/cache.c ++++ b/fs/squashfs/cache.c +@@ -51,7 +51,6 @@ + #include + #include + #include +-#include + #include + + #include "squashfs_fs.h" +--- a/fs/squashfs/dir.c ++++ b/fs/squashfs/dir.c +@@ -30,7 +30,6 @@ + #include + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/export.c ++++ b/fs/squashfs/export.c +@@ -39,7 +39,6 @@ + #include + #include + #include +-#include + #include + + #include "squashfs_fs.h" +--- a/fs/squashfs/file.c ++++ b/fs/squashfs/file.c +@@ -47,7 +47,6 @@ + #include + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/fragment.c ++++ b/fs/squashfs/fragment.c +@@ -36,7 +36,6 @@ + #include + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/id.c ++++ b/fs/squashfs/id.c +@@ -34,7 +34,6 @@ + #include + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/inode.c ++++ b/fs/squashfs/inode.c +@@ -40,7 +40,6 @@ + + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/namei.c ++++ b/fs/squashfs/namei.c +@@ -57,7 +57,6 @@ + #include + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/squashfs.h ++++ b/fs/squashfs/squashfs.h +@@ -71,6 +71,8 @@ extern struct inode *squashfs_iget(struc + extern int squashfs_read_inode(struct inode *, long long); + + /* zlib_wrapper.c */ ++extern void *zlib_init(void); ++extern void zlib_free(void *); + extern int zlib_uncompress(struct squashfs_sb_info *, void **, + struct buffer_head **, int, int, int, int, int); + +--- a/fs/squashfs/squashfs_fs_sb.h ++++ b/fs/squashfs/squashfs_fs_sb.h +@@ -64,7 +64,7 @@ struct squashfs_sb_info { + struct mutex read_data_mutex; + struct mutex meta_index_mutex; + struct meta_index *meta_index; +- z_stream stream; ++ void *stream; + __le64 *inode_lookup_table; + u64 inode_table; + u64 directory_table; +--- a/fs/squashfs/super.c ++++ b/fs/squashfs/super.c +@@ -35,7 +35,6 @@ + #include + #include + #include +-#include + #include + + #include "squashfs_fs.h" +@@ -87,12 +86,9 @@ static int squashfs_fill_super(struct su + } + msblk = sb->s_fs_info; + +- msblk->stream.workspace = kmalloc(zlib_inflate_workspacesize(), +- GFP_KERNEL); +- if (msblk->stream.workspace == NULL) { +- ERROR("Failed to allocate zlib workspace\n"); ++ msblk->stream = zlib_init(); ++ if (msblk->stream == NULL) + goto failure; +- } + + sblk = kzalloc(sizeof(*sblk), GFP_KERNEL); + if (sblk == NULL) { +@@ -292,17 +288,17 @@ failed_mount: + squashfs_cache_delete(msblk->block_cache); + squashfs_cache_delete(msblk->fragment_cache); + squashfs_cache_delete(msblk->read_page); ++ zlib_free(msblk->stream); + kfree(msblk->inode_lookup_table); + kfree(msblk->fragment_index); + kfree(msblk->id_table); +- kfree(msblk->stream.workspace); + kfree(sb->s_fs_info); + sb->s_fs_info = NULL; + kfree(sblk); + return err; + + failure: +- kfree(msblk->stream.workspace); ++ zlib_free(msblk->stream); + kfree(sb->s_fs_info); + sb->s_fs_info = NULL; + return -ENOMEM; +@@ -346,10 +342,10 @@ static void squashfs_put_super(struct su + squashfs_cache_delete(sbi->block_cache); + squashfs_cache_delete(sbi->fragment_cache); + squashfs_cache_delete(sbi->read_page); ++ zlib_free(sbi->stream); + kfree(sbi->id_table); + kfree(sbi->fragment_index); + kfree(sbi->meta_index); +- kfree(sbi->stream.workspace); + kfree(sb->s_fs_info); + sb->s_fs_info = NULL; + } +--- a/fs/squashfs/symlink.c ++++ b/fs/squashfs/symlink.c +@@ -36,7 +36,6 @@ + #include + #include + #include +-#include + + #include "squashfs_fs.h" + #include "squashfs_fs_sb.h" +--- a/fs/squashfs/zlib_wrapper.c ++++ b/fs/squashfs/zlib_wrapper.c +@@ -31,21 +31,51 @@ + #include "squashfs_fs_i.h" + #include "squashfs.h" + ++void *zlib_init() ++{ ++ z_stream *stream = kmalloc(sizeof(z_stream), GFP_KERNEL); ++ if (stream == NULL) ++ goto failed; ++ stream->workspace = kmalloc(zlib_inflate_workspacesize(), ++ GFP_KERNEL); ++ if (stream->workspace == NULL) ++ goto failed; ++ ++ return stream; ++ ++failed: ++ ERROR("Failed to allocate zlib workspace\n"); ++ kfree(stream); ++ return NULL; ++} ++ ++ ++void zlib_free(void *strm) ++{ ++ z_stream *stream = strm; ++ ++ if (stream) ++ kfree(stream->workspace); ++ kfree(stream); ++} ++ ++ + int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, + struct buffer_head **bh, int b, int offset, int length, int srclength, + int pages) + { + int zlib_err = 0, zlib_init = 0; + int avail, bytes, k = 0, page = 0; ++ z_stream *stream = msblk->stream; + + mutex_lock(&msblk->read_data_mutex); + +- msblk->stream.avail_out = 0; +- msblk->stream.avail_in = 0; ++ stream->avail_out = 0; ++ stream->avail_in = 0; + + bytes = length; + do { +- if (msblk->stream.avail_in == 0 && k < b) { ++ if (stream->avail_in == 0 && k < b) { + avail = min(bytes, msblk->devblksize - offset); + bytes -= avail; + wait_on_buffer(bh[k]); +@@ -58,18 +88,18 @@ int zlib_uncompress(struct squashfs_sb_i + continue; + } + +- msblk->stream.next_in = bh[k]->b_data + offset; +- msblk->stream.avail_in = avail; ++ stream->next_in = bh[k]->b_data + offset; ++ stream->avail_in = avail; + offset = 0; + } + +- if (msblk->stream.avail_out == 0 && page < pages) { +- msblk->stream.next_out = buffer[page++]; +- msblk->stream.avail_out = PAGE_CACHE_SIZE; ++ if (stream->avail_out == 0 && page < pages) { ++ stream->next_out = buffer[page++]; ++ stream->avail_out = PAGE_CACHE_SIZE; + } + + if (!zlib_init) { +- zlib_err = zlib_inflateInit(&msblk->stream); ++ zlib_err = zlib_inflateInit(stream); + if (zlib_err != Z_OK) { + ERROR("zlib_inflateInit returned unexpected " + "result 0x%x, srclength %d\n", +@@ -79,9 +109,9 @@ int zlib_uncompress(struct squashfs_sb_i + zlib_init = 1; + } + +- zlib_err = zlib_inflate(&msblk->stream, Z_SYNC_FLUSH); ++ zlib_err = zlib_inflate(stream, Z_SYNC_FLUSH); + +- if (msblk->stream.avail_in == 0 && k < b) ++ if (stream->avail_in == 0 && k < b) + put_bh(bh[k++]); + } while (zlib_err == Z_OK); + +@@ -90,14 +120,14 @@ int zlib_uncompress(struct squashfs_sb_i + goto release_mutex; + } + +- zlib_err = zlib_inflateEnd(&msblk->stream); ++ zlib_err = zlib_inflateEnd(stream); + if (zlib_err != Z_OK) { + ERROR("zlib_inflate error, data probably corrupt\n"); + goto release_mutex; + } + + mutex_unlock(&msblk->read_data_mutex); +- return msblk->stream.total_out; ++ return stream->total_out; + + release_mutex: + mutex_unlock(&msblk->read_data_mutex); diff --git a/target/linux/generic-2.6/patches-2.6.32/003-squashfs_add_decompressor_framework.patch b/target/linux/generic-2.6/patches-2.6.32/003-squashfs_add_decompressor_framework.patch new file mode 100644 index 000000000..fdf0d407a --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/003-squashfs_add_decompressor_framework.patch @@ -0,0 +1,426 @@ +From 327fbf47a419befc6bff74f3ca42d2b6f0841903 Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Tue, 6 Oct 2009 04:04:15 +0100 +Subject: [PATCH] Squashfs: add a decompressor framework + +This adds a decompressor framework which allows multiple compression +algorithms to be cleanly supported. + +Also update zlib wrapper and other code to use the new framework. + +Signed-off-by: Phillip Lougher +--- + fs/squashfs/Makefile | 2 +- + fs/squashfs/block.c | 6 ++-- + fs/squashfs/decompressor.c | 58 ++++++++++++++++++++++++++++++++++++++++++ + fs/squashfs/decompressor.h | 55 +++++++++++++++++++++++++++++++++++++++ + fs/squashfs/squashfs.h | 14 +++++----- + fs/squashfs/squashfs_fs_sb.h | 41 +++++++++++++++-------------- + fs/squashfs/super.c | 45 ++++++++++++++++++------------- + fs/squashfs/zlib_wrapper.c | 17 ++++++++++-- + 8 files changed, 185 insertions(+), 53 deletions(-) + create mode 100644 fs/squashfs/decompressor.c + create mode 100644 fs/squashfs/decompressor.h + +--- a/fs/squashfs/Makefile ++++ b/fs/squashfs/Makefile +@@ -4,4 +4,4 @@ + + obj-$(CONFIG_SQUASHFS) += squashfs.o + squashfs-y += block.o cache.o dir.o export.o file.o fragment.o id.o inode.o +-squashfs-y += namei.o super.o symlink.o zlib_wrapper.o ++squashfs-y += namei.o super.o symlink.o zlib_wrapper.o decompressor.o +--- a/fs/squashfs/block.c ++++ b/fs/squashfs/block.c +@@ -36,7 +36,7 @@ + #include "squashfs_fs_sb.h" + #include "squashfs_fs_i.h" + #include "squashfs.h" +- ++#include "decompressor.h" + /* + * Read the metadata block length, this is stored in the first two + * bytes of the metadata block. +@@ -151,8 +151,8 @@ int squashfs_read_data(struct super_bloc + } + + if (compressed) { +- length = zlib_uncompress(msblk, buffer, bh, b, offset, length, +- srclength, pages); ++ length = squashfs_decompress(msblk, buffer, bh, b, offset, ++ length, srclength, pages); + if (length < 0) + goto read_failure; + } else { +--- /dev/null ++++ b/fs/squashfs/decompressor.c +@@ -0,0 +1,58 @@ ++/* ++ * Squashfs - a compressed read only filesystem for Linux ++ * ++ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 ++ * Phillip Lougher ++ * ++ * 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, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ * ++ * decompressor.c ++ */ ++ ++#include ++#include ++#include ++ ++#include "squashfs_fs.h" ++#include "squashfs_fs_sb.h" ++#include "squashfs_fs_i.h" ++#include "decompressor.h" ++#include "squashfs.h" ++ ++/* ++ * This file (and decompressor.h) implements a decompressor framework for ++ * Squashfs, allowing multiple decompressors to be easily supported ++ */ ++ ++static const struct squashfs_decompressor squashfs_unknown_comp_ops = { ++ NULL, NULL, NULL, 0, "unknown", 0 ++}; ++ ++static const struct squashfs_decompressor *decompressor[] = { ++ &squashfs_zlib_comp_ops, ++ &squashfs_unknown_comp_ops ++}; ++ ++ ++const struct squashfs_decompressor *squashfs_lookup_decompressor(int id) ++{ ++ int i; ++ ++ for (i = 0; decompressor[i]->id; i++) ++ if (id == decompressor[i]->id) ++ break; ++ ++ return decompressor[i]; ++} +--- /dev/null ++++ b/fs/squashfs/decompressor.h +@@ -0,0 +1,55 @@ ++#ifndef DECOMPRESSOR_H ++#define DECOMPRESSOR_H ++/* ++ * Squashfs - a compressed read only filesystem for Linux ++ * ++ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 ++ * Phillip Lougher ++ * ++ * 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, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ * ++ * decompressor.h ++ */ ++ ++struct squashfs_decompressor { ++ void *(*init)(void); ++ void (*free)(void *); ++ int (*decompress)(struct squashfs_sb_info *, void **, ++ struct buffer_head **, int, int, int, int, int); ++ int id; ++ char *name; ++ int supported; ++}; ++ ++static inline void *squashfs_decompressor_init(struct squashfs_sb_info *msblk) ++{ ++ return msblk->decompressor->init(); ++} ++ ++static inline void squashfs_decompressor_free(struct squashfs_sb_info *msblk, ++ void *s) ++{ ++ if (msblk->decompressor) ++ msblk->decompressor->free(s); ++} ++ ++static inline int squashfs_decompress(struct squashfs_sb_info *msblk, ++ void **buffer, struct buffer_head **bh, int b, int offset, int length, ++ int srclength, int pages) ++{ ++ return msblk->decompressor->decompress(msblk, buffer, bh, b, offset, ++ length, srclength, pages); ++} ++#endif +--- a/fs/squashfs/squashfs.h ++++ b/fs/squashfs/squashfs.h +@@ -51,6 +51,9 @@ extern struct squashfs_cache_entry *squa + u64, int); + extern int squashfs_read_table(struct super_block *, void *, u64, int); + ++/* decompressor.c */ ++extern const struct squashfs_decompressor *squashfs_lookup_decompressor(int); ++ + /* export.c */ + extern __le64 *squashfs_read_inode_lookup_table(struct super_block *, u64, + unsigned int); +@@ -70,14 +73,8 @@ extern struct inode *squashfs_iget(struc + unsigned int); + extern int squashfs_read_inode(struct inode *, long long); + +-/* zlib_wrapper.c */ +-extern void *zlib_init(void); +-extern void zlib_free(void *); +-extern int zlib_uncompress(struct squashfs_sb_info *, void **, +- struct buffer_head **, int, int, int, int, int); +- + /* +- * Inodes and files operations ++ * Inodes, files and decompressor operations + */ + + /* dir.c */ +@@ -94,3 +91,6 @@ extern const struct inode_operations squ + + /* symlink.c */ + extern const struct address_space_operations squashfs_symlink_aops; ++ ++/* zlib_wrapper.c */ ++extern const struct squashfs_decompressor squashfs_zlib_comp_ops; +--- a/fs/squashfs/squashfs_fs_sb.h ++++ b/fs/squashfs/squashfs_fs_sb.h +@@ -52,25 +52,26 @@ struct squashfs_cache_entry { + }; + + struct squashfs_sb_info { +- int devblksize; +- int devblksize_log2; +- struct squashfs_cache *block_cache; +- struct squashfs_cache *fragment_cache; +- struct squashfs_cache *read_page; +- int next_meta_index; +- __le64 *id_table; +- __le64 *fragment_index; +- unsigned int *fragment_index_2; +- struct mutex read_data_mutex; +- struct mutex meta_index_mutex; +- struct meta_index *meta_index; +- void *stream; +- __le64 *inode_lookup_table; +- u64 inode_table; +- u64 directory_table; +- unsigned int block_size; +- unsigned short block_log; +- long long bytes_used; +- unsigned int inodes; ++ const struct squashfs_decompressor *decompressor; ++ int devblksize; ++ int devblksize_log2; ++ struct squashfs_cache *block_cache; ++ struct squashfs_cache *fragment_cache; ++ struct squashfs_cache *read_page; ++ int next_meta_index; ++ __le64 *id_table; ++ __le64 *fragment_index; ++ unsigned int *fragment_index_2; ++ struct mutex read_data_mutex; ++ struct mutex meta_index_mutex; ++ struct meta_index *meta_index; ++ void *stream; ++ __le64 *inode_lookup_table; ++ u64 inode_table; ++ u64 directory_table; ++ unsigned int block_size; ++ unsigned short block_log; ++ long long bytes_used; ++ unsigned int inodes; + }; + #endif +--- a/fs/squashfs/super.c ++++ b/fs/squashfs/super.c +@@ -41,27 +41,35 @@ + #include "squashfs_fs_sb.h" + #include "squashfs_fs_i.h" + #include "squashfs.h" ++#include "decompressor.h" + + static struct file_system_type squashfs_fs_type; + static const struct super_operations squashfs_super_ops; + +-static int supported_squashfs_filesystem(short major, short minor, short comp) ++static const struct squashfs_decompressor *supported_squashfs_filesystem(short ++ major, short minor, short id) + { ++ const struct squashfs_decompressor *decompressor; ++ + if (major < SQUASHFS_MAJOR) { + ERROR("Major/Minor mismatch, older Squashfs %d.%d " + "filesystems are unsupported\n", major, minor); +- return -EINVAL; ++ return NULL; + } else if (major > SQUASHFS_MAJOR || minor > SQUASHFS_MINOR) { + ERROR("Major/Minor mismatch, trying to mount newer " + "%d.%d filesystem\n", major, minor); + ERROR("Please update your kernel\n"); +- return -EINVAL; ++ return NULL; + } + +- if (comp != ZLIB_COMPRESSION) +- return -EINVAL; ++ decompressor = squashfs_lookup_decompressor(id); ++ if (!decompressor->supported) { ++ ERROR("Filesystem uses \"%s\" compression. This is not " ++ "supported\n", decompressor->name); ++ return NULL; ++ } + +- return 0; ++ return decompressor; + } + + +@@ -86,10 +94,6 @@ static int squashfs_fill_super(struct su + } + msblk = sb->s_fs_info; + +- msblk->stream = zlib_init(); +- if (msblk->stream == NULL) +- goto failure; +- + sblk = kzalloc(sizeof(*sblk), GFP_KERNEL); + if (sblk == NULL) { + ERROR("Failed to allocate squashfs_super_block\n"); +@@ -116,25 +120,25 @@ static int squashfs_fill_super(struct su + goto failed_mount; + } + ++ err = -EINVAL; ++ + /* Check it is a SQUASHFS superblock */ + sb->s_magic = le32_to_cpu(sblk->s_magic); + if (sb->s_magic != SQUASHFS_MAGIC) { + if (!silent) + ERROR("Can't find a SQUASHFS superblock on %s\n", + bdevname(sb->s_bdev, b)); +- err = -EINVAL; + goto failed_mount; + } + +- /* Check the MAJOR & MINOR versions and compression type */ +- err = supported_squashfs_filesystem(le16_to_cpu(sblk->s_major), ++ /* Check the MAJOR & MINOR versions and lookup compression type */ ++ msblk->decompressor = supported_squashfs_filesystem( ++ le16_to_cpu(sblk->s_major), + le16_to_cpu(sblk->s_minor), + le16_to_cpu(sblk->compression)); +- if (err < 0) ++ if (msblk->decompressor == NULL) + goto failed_mount; + +- err = -EINVAL; +- + /* + * Check if there's xattrs in the filesystem. These are not + * supported in this version, so warn that they will be ignored. +@@ -201,6 +205,10 @@ static int squashfs_fill_super(struct su + + err = -ENOMEM; + ++ msblk->stream = squashfs_decompressor_init(msblk); ++ if (msblk->stream == NULL) ++ goto failed_mount; ++ + msblk->block_cache = squashfs_cache_init("metadata", + SQUASHFS_CACHED_BLKS, SQUASHFS_METADATA_SIZE); + if (msblk->block_cache == NULL) +@@ -288,7 +296,7 @@ failed_mount: + squashfs_cache_delete(msblk->block_cache); + squashfs_cache_delete(msblk->fragment_cache); + squashfs_cache_delete(msblk->read_page); +- zlib_free(msblk->stream); ++ squashfs_decompressor_free(msblk, msblk->stream); + kfree(msblk->inode_lookup_table); + kfree(msblk->fragment_index); + kfree(msblk->id_table); +@@ -298,7 +306,6 @@ failed_mount: + return err; + + failure: +- zlib_free(msblk->stream); + kfree(sb->s_fs_info); + sb->s_fs_info = NULL; + return -ENOMEM; +@@ -342,7 +349,7 @@ static void squashfs_put_super(struct su + squashfs_cache_delete(sbi->block_cache); + squashfs_cache_delete(sbi->fragment_cache); + squashfs_cache_delete(sbi->read_page); +- zlib_free(sbi->stream); ++ squashfs_decompressor_free(sbi, sbi->stream); + kfree(sbi->id_table); + kfree(sbi->fragment_index); + kfree(sbi->meta_index); +--- a/fs/squashfs/zlib_wrapper.c ++++ b/fs/squashfs/zlib_wrapper.c +@@ -30,8 +30,9 @@ + #include "squashfs_fs_sb.h" + #include "squashfs_fs_i.h" + #include "squashfs.h" ++#include "decompressor.h" + +-void *zlib_init() ++static void *zlib_init(void) + { + z_stream *stream = kmalloc(sizeof(z_stream), GFP_KERNEL); + if (stream == NULL) +@@ -50,7 +51,7 @@ failed: + } + + +-void zlib_free(void *strm) ++static void zlib_free(void *strm) + { + z_stream *stream = strm; + +@@ -60,7 +61,7 @@ void zlib_free(void *strm) + } + + +-int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, ++static int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, + struct buffer_head **bh, int b, int offset, int length, int srclength, + int pages) + { +@@ -137,3 +138,13 @@ release_mutex: + + return -EIO; + } ++ ++const struct squashfs_decompressor squashfs_zlib_comp_ops = { ++ .init = zlib_init, ++ .free = zlib_free, ++ .decompress = zlib_uncompress, ++ .id = ZLIB_COMPRESSION, ++ .name = "zlib", ++ .supported = 1 ++}; ++ diff --git a/target/linux/generic-2.6/patches-2.6.32/004-squashfs_add_decompressor_lzma_lzo.patch b/target/linux/generic-2.6/patches-2.6.32/004-squashfs_add_decompressor_lzma_lzo.patch new file mode 100644 index 000000000..a378c0005 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/004-squashfs_add_decompressor_lzma_lzo.patch @@ -0,0 +1,54 @@ +From 1885ca0a1973944684f252094a703b7c80dfc974 Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Wed, 14 Oct 2009 03:58:11 +0100 +Subject: [PATCH] Squashfs: add decompressor entries for lzma and lzo + +Add knowledge of lzma/lzo compression formats to the decompressor +framework. For now these are added as unsupported. Without +these entries lzma/lzo compressed filesystems will be flagged as +having unknown compression which is undesirable. + +Signed-off-by: Phillip Lougher +--- + fs/squashfs/decompressor.c | 10 ++++++++++ + fs/squashfs/squashfs_fs.h | 4 +++- + 2 files changed, 13 insertions(+), 1 deletions(-) + +--- a/fs/squashfs/decompressor.c ++++ b/fs/squashfs/decompressor.c +@@ -36,12 +36,22 @@ + * Squashfs, allowing multiple decompressors to be easily supported + */ + ++static const struct squashfs_decompressor squashfs_lzma_unsupported_comp_ops = { ++ NULL, NULL, NULL, LZMA_COMPRESSION, "lzma", 0 ++}; ++ ++static const struct squashfs_decompressor squashfs_lzo_unsupported_comp_ops = { ++ NULL, NULL, NULL, LZO_COMPRESSION, "lzo", 0 ++}; ++ + static const struct squashfs_decompressor squashfs_unknown_comp_ops = { + NULL, NULL, NULL, 0, "unknown", 0 + }; + + static const struct squashfs_decompressor *decompressor[] = { + &squashfs_zlib_comp_ops, ++ &squashfs_lzma_unsupported_comp_ops, ++ &squashfs_lzo_unsupported_comp_ops, + &squashfs_unknown_comp_ops + }; + +--- a/fs/squashfs/squashfs_fs.h ++++ b/fs/squashfs/squashfs_fs.h +@@ -211,7 +211,9 @@ struct meta_index { + /* + * definitions for structures on disk + */ +-#define ZLIB_COMPRESSION 1 ++#define ZLIB_COMPRESSION 1 ++#define LZMA_COMPRESSION 2 ++#define LZO_COMPRESSION 3 + + struct squashfs_super_block { + __le32 s_magic; diff --git a/target/linux/generic-2.6/patches-2.6.32/005-squashfs_extra_parameter.patch b/target/linux/generic-2.6/patches-2.6.32/005-squashfs_extra_parameter.patch new file mode 100644 index 000000000..099168134 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/005-squashfs_extra_parameter.patch @@ -0,0 +1,42 @@ +From 5f393ede3ddb5dd4cc2a9f243182fac45f1ce10b Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Wed, 14 Oct 2009 04:07:54 +0100 +Subject: [PATCH] Squashfs: add an extra parameter to the decompressor init function + +Signed-off-by: Phillip Lougher +--- + fs/squashfs/decompressor.h | 4 ++-- + fs/squashfs/zlib_wrapper.c | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +--- a/fs/squashfs/decompressor.h ++++ b/fs/squashfs/decompressor.h +@@ -24,7 +24,7 @@ + */ + + struct squashfs_decompressor { +- void *(*init)(void); ++ void *(*init)(struct squashfs_sb_info *); + void (*free)(void *); + int (*decompress)(struct squashfs_sb_info *, void **, + struct buffer_head **, int, int, int, int, int); +@@ -35,7 +35,7 @@ struct squashfs_decompressor { + + static inline void *squashfs_decompressor_init(struct squashfs_sb_info *msblk) + { +- return msblk->decompressor->init(); ++ return msblk->decompressor->init(msblk); + } + + static inline void squashfs_decompressor_free(struct squashfs_sb_info *msblk, +--- a/fs/squashfs/zlib_wrapper.c ++++ b/fs/squashfs/zlib_wrapper.c +@@ -32,7 +32,7 @@ + #include "squashfs.h" + #include "decompressor.h" + +-static void *zlib_init(void) ++static void *zlib_init(struct squashfs_sb_info *dummy) + { + z_stream *stream = kmalloc(sizeof(z_stream), GFP_KERNEL); + if (stream == NULL) diff --git a/target/linux/generic-2.6/patches-2.6.32/006-squashfs_add_lzma.patch b/target/linux/generic-2.6/patches-2.6.32/006-squashfs_add_lzma.patch new file mode 100644 index 000000000..9fd57970f --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/006-squashfs_add_lzma.patch @@ -0,0 +1,216 @@ +From f49e1efdd179d54e814ff2a8e8f469496583062c Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Tue, 20 Oct 2009 10:54:36 +0100 +Subject: [PATCH] Squashfs: add LZMA compression + +Add support for LZMA compressed filesystems. This is an initial +implementation. + +Signed-off-by: Phillip Lougher +--- + fs/squashfs/Kconfig | 5 ++ + fs/squashfs/Makefile | 1 + + fs/squashfs/decompressor.c | 4 + + fs/squashfs/lzma_wrapper.c | 151 ++++++++++++++++++++++++++++++++++++++++++++ + fs/squashfs/squashfs.h | 3 + + 5 files changed, 164 insertions(+), 0 deletions(-) + create mode 100644 fs/squashfs/lzma_wrapper.c + +--- a/fs/squashfs/Kconfig ++++ b/fs/squashfs/Kconfig +@@ -26,6 +26,11 @@ config SQUASHFS + + If unsure, say N. + ++config SQUASHFS_LZMA ++ bool "Include support for LZMA compressed file systems" ++ depends on SQUASHFS ++ select DECOMPRESS_LZMA ++ + config SQUASHFS_EMBEDDED + + bool "Additional option for memory-constrained systems" +--- a/fs/squashfs/Makefile ++++ b/fs/squashfs/Makefile +@@ -5,3 +5,4 @@ + obj-$(CONFIG_SQUASHFS) += squashfs.o + squashfs-y += block.o cache.o dir.o export.o file.o fragment.o id.o inode.o + squashfs-y += namei.o super.o symlink.o zlib_wrapper.o decompressor.o ++squashfs-$(CONFIG_SQUASHFS_LZMA) += lzma_wrapper.o +--- a/fs/squashfs/decompressor.c ++++ b/fs/squashfs/decompressor.c +@@ -50,7 +50,11 @@ static const struct squashfs_decompresso + + static const struct squashfs_decompressor *decompressor[] = { + &squashfs_zlib_comp_ops, ++#ifdef CONFIG_SQUASHFS_LZMA ++ &squashfs_lzma_comp_ops, ++#else + &squashfs_lzma_unsupported_comp_ops, ++#endif + &squashfs_lzo_unsupported_comp_ops, + &squashfs_unknown_comp_ops + }; +--- /dev/null ++++ b/fs/squashfs/lzma_wrapper.c +@@ -0,0 +1,151 @@ ++/* ++ * Squashfs - a compressed read only filesystem for Linux ++ * ++ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 ++ * Phillip Lougher ++ * ++ * 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, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ * ++ * lzma_wrapper.c ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "squashfs_fs.h" ++#include "squashfs_fs_sb.h" ++#include "squashfs_fs_i.h" ++#include "squashfs.h" ++#include "decompressor.h" ++ ++struct squashfs_lzma { ++ void *input; ++ void *output; ++}; ++ ++/* decompress_unlzma.c is currently non re-entrant... */ ++DEFINE_MUTEX(lzma_mutex); ++ ++/* decompress_unlzma.c doesn't provide any context in its callbacks... */ ++static int lzma_error; ++ ++static void error(char *m) ++{ ++ ERROR("unlzma error: %s\n", m); ++ lzma_error = 1; ++} ++ ++ ++static void *lzma_init(struct squashfs_sb_info *msblk) ++{ ++ struct squashfs_lzma *stream = kzalloc(sizeof(*stream), GFP_KERNEL); ++ if (stream == NULL) ++ goto failed; ++ stream->input = vmalloc(msblk->block_size); ++ if (stream->input == NULL) ++ goto failed; ++ stream->output = vmalloc(msblk->block_size); ++ if (stream->output == NULL) ++ goto failed2; ++ ++ return stream; ++ ++failed2: ++ vfree(stream->input); ++failed: ++ ERROR("failed to allocate lzma workspace\n"); ++ kfree(stream); ++ return NULL; ++} ++ ++ ++static void lzma_free(void *strm) ++{ ++ struct squashfs_lzma *stream = strm; ++ ++ if (stream) { ++ vfree(stream->input); ++ vfree(stream->output); ++ } ++ kfree(stream); ++} ++ ++ ++static int lzma_uncompress(struct squashfs_sb_info *msblk, void **buffer, ++ struct buffer_head **bh, int b, int offset, int length, int srclength, ++ int pages) ++{ ++ struct squashfs_lzma *stream = msblk->stream; ++ void *buff = stream->input; ++ int avail, i, bytes = length, res; ++ ++ mutex_lock(&lzma_mutex); ++ ++ for (i = 0; i < b; i++) { ++ wait_on_buffer(bh[i]); ++ if (!buffer_uptodate(bh[i])) ++ goto block_release; ++ ++ avail = min(bytes, msblk->devblksize - offset); ++ memcpy(buff, bh[i]->b_data + offset, avail); ++ buff += avail; ++ bytes -= avail; ++ offset = 0; ++ put_bh(bh[i]); ++ } ++ ++ lzma_error = 0; ++ res = unlzma(stream->input, length, NULL, NULL, stream->output, NULL, ++ error); ++ if (res || lzma_error) ++ goto failed; ++ ++ /* uncompressed size is stored in the LZMA header (5 byte offset) */ ++ res = bytes = get_unaligned_le32(stream->input + 5); ++ for (i = 0, buff = stream->output; bytes && i < pages; i++) { ++ avail = min_t(int, bytes, PAGE_CACHE_SIZE); ++ memcpy(buffer[i], buff, avail); ++ buff += avail; ++ bytes -= avail; ++ } ++ if (bytes) ++ goto failed; ++ ++ mutex_unlock(&lzma_mutex); ++ return res; ++ ++block_release: ++ for (; i < b; i++) ++ put_bh(bh[i]); ++ ++failed: ++ mutex_unlock(&lzma_mutex); ++ ++ ERROR("lzma decompression failed, data probably corrupt\n"); ++ return -EIO; ++} ++ ++const struct squashfs_decompressor squashfs_lzma_comp_ops = { ++ .init = lzma_init, ++ .free = lzma_free, ++ .decompress = lzma_uncompress, ++ .id = LZMA_COMPRESSION, ++ .name = "lzma", ++ .supported = 1 ++}; ++ +--- a/fs/squashfs/squashfs.h ++++ b/fs/squashfs/squashfs.h +@@ -94,3 +94,6 @@ extern const struct address_space_operat + + /* zlib_wrapper.c */ + extern const struct squashfs_decompressor squashfs_zlib_comp_ops; ++ ++/* lzma wrapper.c */ ++extern const struct squashfs_decompressor squashfs_lzma_comp_ops; diff --git a/target/linux/generic-2.6/patches-2.6.32/007-squashfs_make_lzma_available.patch b/target/linux/generic-2.6/patches-2.6.32/007-squashfs_make_lzma_available.patch new file mode 100644 index 000000000..ca43a98bc --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/007-squashfs_make_lzma_available.patch @@ -0,0 +1,165 @@ +From fdf23ed283bc6ef5c25076ce2065f892120ff556 Mon Sep 17 00:00:00 2001 +From: Phillip Lougher +Date: Thu, 22 Oct 2009 04:57:38 +0100 +Subject: [PATCH] Squashfs: Make unlzma available to non initramfs/initrd code + +Add a config option DECOMPRESS_LZMA_NEEDED which allows subsystems to +specify they need the unlzma code. Normally decompress_unlzma.c is +compiled with __init and unlzma is not exported to modules. + +Signed-off-by: Phillip Lougher +--- + fs/squashfs/Kconfig | 1 + + include/linux/decompress/bunzip2_mm.h | 12 ++++++++++++ + include/linux/decompress/inflate_mm.h | 12 ++++++++++++ + include/linux/decompress/mm.h | 3 --- + include/linux/decompress/unlzma_mm.h | 20 ++++++++++++++++++++ + lib/Kconfig | 3 +++ + lib/decompress_bunzip2.c | 1 + + lib/decompress_inflate.c | 1 + + lib/decompress_unlzma.c | 5 ++++- + 9 files changed, 54 insertions(+), 4 deletions(-) + create mode 100644 include/linux/decompress/bunzip2_mm.h + create mode 100644 include/linux/decompress/inflate_mm.h + create mode 100644 include/linux/decompress/unlzma_mm.h + +--- a/fs/squashfs/Kconfig ++++ b/fs/squashfs/Kconfig +@@ -30,6 +30,7 @@ config SQUASHFS_LZMA + bool "Include support for LZMA compressed file systems" + depends on SQUASHFS + select DECOMPRESS_LZMA ++ select DECOMPRESS_LZMA_NEEDED + + config SQUASHFS_EMBEDDED + +--- /dev/null ++++ b/include/linux/decompress/bunzip2_mm.h +@@ -0,0 +1,12 @@ ++#ifndef BUNZIP2_MM_H ++#define BUNZIP2_MM_H ++ ++#ifdef STATIC ++/* Code active when included from pre-boot environment: */ ++#define INIT ++#else ++/* Compile for initramfs/initrd code only */ ++#define INIT __init ++#endif ++ ++#endif +--- /dev/null ++++ b/include/linux/decompress/inflate_mm.h +@@ -0,0 +1,12 @@ ++#ifndef INFLATE_MM_H ++#define INFLATE_MM_H ++ ++#ifdef STATIC ++/* Code active when included from pre-boot environment: */ ++#define INIT ++#else ++/* Compile for initramfs/initrd code only */ ++#define INIT __init ++#endif ++ ++#endif +--- a/include/linux/decompress/mm.h ++++ b/include/linux/decompress/mm.h +@@ -53,8 +53,6 @@ static void free(void *where) + + #define set_error_fn(x) + +-#define INIT +- + #else /* STATIC */ + + /* Code active when compiled standalone for use when loading ramdisk: */ +@@ -77,7 +75,6 @@ static void free(void *where) + static void(*error)(char *m); + #define set_error_fn(x) error = x; + +-#define INIT __init + #define STATIC + + #include +--- /dev/null ++++ b/include/linux/decompress/unlzma_mm.h +@@ -0,0 +1,20 @@ ++#ifndef UNLZMA_MM_H ++#define UNLZMA_MM_H ++ ++#ifdef STATIC ++ ++/* Code active when included from pre-boot environment: */ ++#define INIT ++ ++#elif defined(CONFIG_DECOMPRESS_LZMA_NEEDED) ++ ++/* Make it available to non initramfs/initrd code */ ++#define INIT ++#include ++#else ++ ++/* Compile for initramfs/initrd code only */ ++#define INIT __init ++#endif ++ ++#endif +--- a/lib/Kconfig ++++ b/lib/Kconfig +@@ -117,6 +117,9 @@ config DECOMPRESS_BZIP2 + config DECOMPRESS_LZMA + tristate + ++config DECOMPRESS_LZMA_NEEDED ++ boolean ++ + # + # Generic allocator support is selected if needed + # +--- a/lib/decompress_bunzip2.c ++++ b/lib/decompress_bunzip2.c +@@ -52,6 +52,7 @@ + #include + #endif /* STATIC */ + ++#include + #include + + #ifndef INT_MAX +--- a/lib/decompress_inflate.c ++++ b/lib/decompress_inflate.c +@@ -23,6 +23,7 @@ + + #endif /* STATIC */ + ++#include + #include + + #define GZIP_IOBUF_SIZE (16*1024) +--- a/lib/decompress_unlzma.c ++++ b/lib/decompress_unlzma.c +@@ -36,6 +36,7 @@ + #include + #endif /* STATIC */ + ++#include + #include + + #define MIN(a, b) (((a) < (b)) ? (a) : (b)) +@@ -531,7 +532,7 @@ static inline void INIT process_bit1(str + + + +-STATIC inline int INIT unlzma(unsigned char *buf, int in_len, ++STATIC int INIT unlzma(unsigned char *buf, int in_len, + int(*fill)(void*, unsigned int), + int(*flush)(void*, unsigned int), + unsigned char *output, +@@ -664,4 +665,6 @@ STATIC int INIT decompress(unsigned char + { + return unlzma(buf, in_len - 4, fill, flush, output, posp, error_fn); + } ++#elif defined(CONFIG_DECOMPRESS_LZMA_NEEDED) ++EXPORT_SYMBOL(unlzma); + #endif diff --git a/target/linux/generic-2.6/patches-2.6.32/011-mips_boot.patch b/target/linux/generic-2.6/patches-2.6.32/011-mips_boot.patch new file mode 100644 index 000000000..c2a043acd --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/011-mips_boot.patch @@ -0,0 +1,11 @@ +--- a/arch/mips/kernel/head.S ++++ b/arch/mips/kernel/head.S +@@ -121,6 +121,8 @@ + #endif + .endm + ++ j kernel_entry ++ nop + #ifndef CONFIG_NO_EXCEPT_FILL + /* + * Reserved space for exception handlers. diff --git a/target/linux/generic-2.6/patches-2.6.32/012-extra_optimization.patch b/target/linux/generic-2.6/patches-2.6.32/012-extra_optimization.patch new file mode 100644 index 000000000..77eb10377 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/012-extra_optimization.patch @@ -0,0 +1,21 @@ +--- a/Makefile ++++ b/Makefile +@@ -523,7 +523,7 @@ all: vmlinux + ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE + KBUILD_CFLAGS += -Os + else +-KBUILD_CFLAGS += -O2 ++KBUILD_CFLAGS += -O2 -fno-reorder-blocks -fno-tree-ch + endif + + include $(srctree)/arch/$(SRCARCH)/Makefile +@@ -561,6 +561,9 @@ endif + NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) + CHECKFLAGS += $(NOSTDINC_FLAGS) + ++# improve gcc optimization ++CFLAGS += $(call cc-option,-funit-at-a-time,) ++ + # warn about C99 declaration after statement + KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) + diff --git a/target/linux/generic-2.6/patches-2.6.32/013-gcc4_inline_fix.patch b/target/linux/generic-2.6/patches-2.6.32/013-gcc4_inline_fix.patch new file mode 100644 index 000000000..9997ff283 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/013-gcc4_inline_fix.patch @@ -0,0 +1,11 @@ +--- a/arch/mips/include/asm/system.h ++++ b/arch/mips/include/asm/system.h +@@ -197,7 +197,7 @@ extern __u64 __xchg_u64_unsupported_on_3 + if something tries to do an invalid xchg(). */ + extern void __xchg_called_with_bad_pointer(void); + +-static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) ++static __always_inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) + { + switch (size) { + case 4: diff --git a/target/linux/generic-2.6/patches-2.6.32/014-samsung_flash b/target/linux/generic-2.6/patches-2.6.32/014-samsung_flash new file mode 100644 index 000000000..1faeb41ea --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/014-samsung_flash @@ -0,0 +1,36 @@ +--- a/drivers/mtd/chips/cfi_cmdset_0002.c ++++ b/drivers/mtd/chips/cfi_cmdset_0002.c +@@ -51,6 +51,7 @@ + #define SST49LF040B 0x0050 + #define SST49LF008A 0x005a + #define AT49BV6416 0x00d6 ++#define MANUFACTURER_SAMSUNG 0x00ec + + static int cfi_amdstd_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); + static int cfi_amdstd_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); +@@ -375,12 +376,19 @@ struct mtd_info *cfi_cmdset_0002(struct + + if (extp->MajorVersion != '1' || + (extp->MinorVersion < '0' || extp->MinorVersion > '4')) { +- printk(KERN_ERR " Unknown Amd/Fujitsu Extended Query " +- "version %c.%c.\n", extp->MajorVersion, +- extp->MinorVersion); +- kfree(extp); +- kfree(mtd); +- return NULL; ++ if (cfi->mfr == MANUFACTURER_SAMSUNG && ++ (extp->MajorVersion == '3' && extp->MinorVersion == '3')) { ++ printk(KERN_NOTICE " Newer Samsung flash detected, " ++ "should be compatibile with Amd/Fujitsu.\n"); ++ } ++ else { ++ printk(KERN_ERR " Unknown Amd/Fujitsu Extended Query " ++ "version %c.%c.\n", extp->MajorVersion, ++ extp->MinorVersion); ++ kfree(extp); ++ kfree(mtd); ++ return NULL; ++ } + } + + /* Install our own private info structure */ diff --git a/target/linux/generic-2.6/patches-2.6.32/020-mips_multi_machine_support.patch b/target/linux/generic-2.6/patches-2.6.32/020-mips_multi_machine_support.patch new file mode 100644 index 000000000..1b29290e5 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/020-mips_multi_machine_support.patch @@ -0,0 +1,168 @@ +--- /dev/null ++++ b/include/asm-mips/mips_machine.h +@@ -0,0 +1,46 @@ ++/* ++ * Copyright (C) 2008-2009 Gabor Juhos ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ * ++ */ ++ ++#ifndef __ASM_MIPS_MACHINE_H ++#define __ASM_MIPS_MACHINE_H ++ ++#include ++#include ++ ++struct mips_machine { ++ unsigned long mach_type; ++ void (*mach_setup)(void); ++ char *mach_name; ++ struct list_head list; ++}; ++ ++void mips_machine_register(struct mips_machine *) __init; ++void mips_machine_setup(unsigned long machtype) __init; ++ ++extern char *mips_machine_name; ++ ++#define MIPS_MACHINE(_type, _name, _setup) \ ++static char machine_name_##_type[] __initdata = _name; \ ++static struct mips_machine machine_##_type __initdata = \ ++{ \ ++ .mach_type = _type, \ ++ .mach_name = machine_name_##_type, \ ++ .mach_setup = _setup, \ ++}; \ ++ \ ++static int __init register_machine_##_type(void) \ ++{ \ ++ mips_machine_register(&machine_##_type); \ ++ return 0; \ ++} \ ++ \ ++pure_initcall(register_machine_##_type) ++ ++#endif /* __ASM_MIPS_MACHINE_H */ ++ +--- /dev/null ++++ b/arch/mips/kernel/mips_machine.c +@@ -0,0 +1,70 @@ ++/* ++ * Copyright (C) 2008-2009 Gabor Juhos ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ * ++ */ ++#include ++ ++#include ++#include ++ ++static struct list_head mips_machines __initdata = ++ LIST_HEAD_INIT(mips_machines); ++ ++char *mips_machine_name = "Unknown"; ++ ++static struct mips_machine * __init mips_machine_find(unsigned long machtype) ++{ ++ struct list_head *this; ++ ++ list_for_each(this, &mips_machines) { ++ struct mips_machine *mach; ++ ++ mach = list_entry(this, struct mips_machine, list); ++ if (mach->mach_type == machtype) ++ return mach; ++ } ++ ++ return NULL; ++} ++ ++void __init mips_machine_register(struct mips_machine *mach) ++{ ++ list_add_tail(&mach->list, &mips_machines); ++} ++ ++void __init mips_machine_setup(unsigned long machtype) ++{ ++ struct mips_machine *mach; ++ ++ mach = mips_machine_find(machtype); ++ if (!mach) { ++ printk(KERN_ALERT "MIPS: no machine registered for " ++ "machtype %lu\n", machtype); ++ return; ++ } ++ ++ if (mach->mach_name) { ++ char *name; ++ unsigned int len; ++ ++ len = strlen(mach->mach_name); ++ name = kmalloc(len + 1, GFP_KERNEL); ++ if (name) { ++ strncpy(name, mach->mach_name,len); ++ name[len] = '\0'; ++ mips_machine_name = name; ++ } else { ++ printk(KERN_WARNING "MIPS: no memory for machine_name\n"); ++ } ++ } ++ ++ printk(KERN_INFO "MIPS: machine is %s\n", mips_machine_name); ++ ++ if (mach->mach_setup) ++ mach->mach_setup(); ++} ++ +--- a/arch/mips/kernel/Makefile ++++ b/arch/mips/kernel/Makefile +@@ -87,6 +87,7 @@ obj-$(CONFIG_GPIO_TXX9) += gpio_txx9.o + + obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o + obj-$(CONFIG_EARLY_PRINTK) += early_printk.o ++obj-$(CONFIG_MIPS_MACHINE) += mips_machine.o + + CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) + +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -839,6 +839,9 @@ config MIPS_DISABLE_OBSOLETE_IDE + config SYNC_R4K + bool + ++config MIPS_MACHINE ++ def_bool n ++ + config NO_IOPORT + def_bool n + +--- a/arch/mips/kernel/proc.c ++++ b/arch/mips/kernel/proc.c +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + + unsigned int vced_count, vcei_count; + +@@ -31,8 +32,12 @@ static int show_cpuinfo(struct seq_file + /* + * For the first processor also print the system type + */ +- if (n == 0) ++ if (n == 0) { + seq_printf(m, "system type\t\t: %s\n", get_system_type()); ++#ifdef CONFIG_MIPS_MACHINE ++ seq_printf(m, "machine\t\t\t: %s\n", mips_machine_name); ++#endif ++ } + + seq_printf(m, "processor\t\t: %ld\n", n); + sprintf(fmt, "cpu model\t\t: %%s V%%d.%%d%s\n", diff --git a/target/linux/generic-2.6/patches-2.6.32/021-mips_image_cmdline_hack.patch b/target/linux/generic-2.6/patches-2.6.32/021-mips_image_cmdline_hack.patch new file mode 100644 index 000000000..b63c76304 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/021-mips_image_cmdline_hack.patch @@ -0,0 +1,28 @@ +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -842,6 +842,10 @@ config SYNC_R4K + config MIPS_MACHINE + def_bool n + ++config IMAGE_CMDLINE_HACK ++ bool "OpenWrt specific image command line hack" ++ default n ++ + config NO_IOPORT + def_bool n + +--- a/arch/mips/kernel/head.S ++++ b/arch/mips/kernel/head.S +@@ -143,6 +143,12 @@ FEXPORT(__kernel_entry) + j kernel_entry + #endif + ++#ifdef CONFIG_IMAGE_CMDLINE_HACK ++ .ascii "CMDLINE:" ++EXPORT(__image_cmdline) ++ .fill 0x400 ++#endif /* CONFIG_IMAGE_CMDLINE_HACK */ ++ + __REF + + NESTED(kernel_entry, 16, sp) # kernel entry point diff --git a/target/linux/generic-2.6/patches-2.6.32/025-mips_disable_fpu.patch b/target/linux/generic-2.6/patches-2.6.32/025-mips_disable_fpu.patch new file mode 100644 index 000000000..087a9a96a --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/025-mips_disable_fpu.patch @@ -0,0 +1,155 @@ +MIPS: allow disabling the kernel FPU emulator + +This patch allows turning off the in-kernel Algorithmics +FPU emulator support, which allows one to save a couple of +precious blocks on an embedded system. + +Signed-off-by: Florian Fainelli +-- +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -827,6 +827,17 @@ config I8259 + config MIPS_BONITO64 + bool + ++config MIPS_FPU_EMU ++ bool ++ default n ++ help ++ This option allows building a kernel with or without the Algorithmics ++ FPU emulator enabled. Turning off this option results in a kernel which ++ does not catch floating operations exceptions. Make sure that your toolchain ++ is configured to enable software floating point emulation in that case. ++ ++ If unsure say Y here. ++ + config MIPS_MSC + bool + +--- a/arch/mips/math-emu/Makefile ++++ b/arch/mips/math-emu/Makefile +@@ -2,12 +2,14 @@ + # Makefile for the Linux/MIPS kernel FPU emulation. + # + +-obj-y := cp1emu.o ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \ ++obj-y := kernel_linkage.o dsemul.o cp1emu.o ++ ++obj-$(CONFIG_MIPS_FPU_EMU) += ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \ + ieee754xcpt.o dp_frexp.o dp_modf.o dp_div.o dp_mul.o dp_sub.o \ + dp_add.o dp_fsp.o dp_cmp.o dp_logb.o dp_scalb.o dp_simple.o \ + dp_tint.o dp_fint.o dp_tlong.o dp_flong.o sp_frexp.o sp_modf.o \ + sp_div.o sp_mul.o sp_sub.o sp_add.o sp_fdp.o sp_cmp.o sp_logb.o \ + sp_scalb.o sp_simple.o sp_tint.o sp_fint.o sp_tlong.o sp_flong.o \ +- dp_sqrt.o sp_sqrt.o kernel_linkage.o dsemul.o ++ dp_sqrt.o sp_sqrt.o + + EXTRA_CFLAGS += -Werror +--- a/arch/mips/math-emu/cp1emu.c ++++ b/arch/mips/math-emu/cp1emu.c +@@ -56,6 +56,12 @@ + #endif + #define __mips 4 + ++/* Further private data for which no space exists in mips_fpu_struct */ ++ ++struct mips_fpu_emulator_stats fpuemustats; ++ ++#ifdef CONFIG_MIPS_FPU_EMU ++ + /* Function which emulates a floating point instruction. */ + + static int fpu_emu(struct pt_regs *, struct mips_fpu_struct *, +@@ -66,10 +72,6 @@ static int fpux_emu(struct pt_regs *, + struct mips_fpu_struct *, mips_instruction); + #endif + +-/* Further private data for which no space exists in mips_fpu_struct */ +- +-struct mips_fpu_emulator_stats fpuemustats; +- + /* Control registers */ + + #define FPCREG_RID 0 /* $0 = revision id */ +@@ -1273,6 +1275,13 @@ int fpu_emulator_cop1Handler(struct pt_r + + return sig; + } ++#else ++int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx, ++ int has_fpu) ++{ ++ return 0; ++} ++#endif /* CONFIG_MIPS_FPU_EMU */ + + #ifdef CONFIG_DEBUG_FS + extern struct dentry *mips_debugfs_dir; +--- a/arch/mips/math-emu/dsemul.c ++++ b/arch/mips/math-emu/dsemul.c +@@ -109,6 +109,7 @@ int mips_dsemul(struct pt_regs *regs, mi + return SIGILL; /* force out of emulation loop */ + } + ++#ifdef CONFIG_MIPS_FPU_EMU + int do_dsemulret(struct pt_regs *xcp) + { + struct emuframe __user *fr; +@@ -165,3 +166,9 @@ int do_dsemulret(struct pt_regs *xcp) + + return 1; + } ++#else ++int do_dsemulret(struct pt_regs *xcp) ++{ ++ return 0; ++} ++#endif /* CONFIG_MIPS_FPU_EMU */ +--- a/arch/mips/math-emu/kernel_linkage.c ++++ b/arch/mips/math-emu/kernel_linkage.c +@@ -29,6 +29,7 @@ + + #define SIGNALLING_NAN 0x7ff800007ff80000LL + ++#ifdef CONFIG_MIPS_FPU_EMU + void fpu_emulator_init_fpu(void) + { + static int first = 1; +@@ -112,4 +113,36 @@ int fpu_emulator_restore_context32(struc + + return err; + } +-#endif ++#endif /* CONFIG_64BIT */ ++#else ++ ++void fpu_emulator_init_fpu(void) ++{ ++ printk(KERN_INFO "FPU emulator disabled, make sure your toolchain" ++ "was compiled with software floating point support (soft-float)\n"); ++ return; ++} ++ ++int fpu_emulator_save_context(struct sigcontext __user *sc) ++{ ++ return 0; ++} ++ ++int fpu_emulator_restore_context(struct sigcontext __user *sc) ++{ ++ return 0; ++} ++ ++int fpu_emulator_save_context32(struct sigcontext32 __user *sc) ++{ ++ return 0; ++} ++ ++int fpu_emulator_restore_context32(struct sigcontext32 __user *sc) ++{ ++ return 0; ++} ++ ++#ifdef CONFIG_64BIT ++#endif /* CONFIG_64BIT */ ++#endif /* CONFIG_MIPS_FPU_EMU */ diff --git a/target/linux/generic-2.6/patches-2.6.32/027-mips_module_reloc.patch b/target/linux/generic-2.6/patches-2.6.32/027-mips_module_reloc.patch new file mode 100644 index 000000000..f65a09c94 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/027-mips_module_reloc.patch @@ -0,0 +1,331 @@ +--- a/arch/mips/Makefile ++++ b/arch/mips/Makefile +@@ -83,7 +83,7 @@ all-$(CONFIG_BOOT_ELF64) := $(vmlinux-64 + cflags-y += -G 0 -mno-abicalls -fno-pic -pipe + cflags-y += -msoft-float + LDFLAGS_vmlinux += -G 0 -static -n -nostdlib +-MODFLAGS += -mlong-calls ++MODFLAGS += -mno-long-calls + + cflags-y += -ffreestanding + +--- a/arch/mips/include/asm/module.h ++++ b/arch/mips/include/asm/module.h +@@ -9,6 +9,11 @@ struct mod_arch_specific { + struct list_head dbe_list; + const struct exception_table_entry *dbe_start; + const struct exception_table_entry *dbe_end; ++ ++ void *plt_tbl; ++ unsigned int core_plt_offset; ++ unsigned int core_plt_size; ++ unsigned int init_plt_offset; + }; + + typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */ +--- a/arch/mips/kernel/module.c ++++ b/arch/mips/kernel/module.c +@@ -43,6 +43,117 @@ static struct mips_hi16 *mips_hi16_list; + static LIST_HEAD(dbe_list); + static DEFINE_SPINLOCK(dbe_lock); + ++/* ++ * Get the potential max trampolines size required of the init and ++ * non-init sections. Only used if we cannot find enough contiguous ++ * physically mapped memory to put the module into. ++ */ ++static unsigned int ++get_plt_size(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, ++ const char *secstrings, unsigned int symindex, bool is_init) ++{ ++ unsigned long ret = 0; ++ unsigned int i, j; ++ Elf_Sym *syms; ++ ++ /* Everything marked ALLOC (this includes the exported symbols) */ ++ for (i = 1; i < hdr->e_shnum; ++i) { ++ unsigned int info = sechdrs[i].sh_info; ++ ++ if (sechdrs[i].sh_type != SHT_REL ++ && sechdrs[i].sh_type != SHT_RELA) ++ continue; ++ ++ /* Not a valid relocation section? */ ++ if (info >= hdr->e_shnum) ++ continue; ++ ++ /* Don't bother with non-allocated sections */ ++ if (!(sechdrs[info].sh_flags & SHF_ALLOC)) ++ continue; ++ ++ /* If it's called *.init*, and we're not init, we're ++ not interested */ ++ if ((strstr(secstrings + sechdrs[i].sh_name, ".init") != 0) ++ != is_init) ++ continue; ++ ++ syms = (Elf_Sym *) sechdrs[symindex].sh_addr; ++ if (sechdrs[i].sh_type == SHT_REL) { ++ Elf_Mips_Rel *rel = (void *) sechdrs[i].sh_addr; ++ unsigned int size = sechdrs[i].sh_size / sizeof(*rel); ++ ++ for (j = 0; j < size; ++j) { ++ Elf_Sym *sym; ++ ++ if (ELF_MIPS_R_TYPE(rel[j]) != R_MIPS_26) ++ continue; ++ ++ sym = syms + ELF_MIPS_R_SYM(rel[j]); ++ if (!is_init && sym->st_shndx != SHN_UNDEF) ++ continue; ++ ++ ret += 4 * sizeof(int); ++ } ++ } else { ++ Elf_Mips_Rela *rela = (void *) sechdrs[i].sh_addr; ++ unsigned int size = sechdrs[i].sh_size / sizeof(*rela); ++ ++ for (j = 0; j < size; ++j) { ++ Elf_Sym *sym; ++ ++ if (ELF_MIPS_R_TYPE(rela[j]) != R_MIPS_26) ++ continue; ++ ++ sym = syms + ELF_MIPS_R_SYM(rela[j]); ++ if (!is_init && sym->st_shndx != SHN_UNDEF) ++ continue; ++ ++ ret += 4 * sizeof(int); ++ } ++ } ++ } ++ ++ return ret; ++} ++ ++#ifndef MODULE_START ++static void *alloc_phys(unsigned long size) ++{ ++ unsigned order; ++ struct page *page; ++ struct page *p; ++ ++ size = PAGE_ALIGN(size); ++ order = get_order(size); ++ ++ page = alloc_pages(GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN | ++ __GFP_THISNODE, order); ++ if (!page) ++ return NULL; ++ ++ split_page(page, order); ++ ++ for (p = page + (size >> PAGE_SHIFT); p < page + (1 << order); ++p) ++ __free_page(p); ++ ++ return page_address(page); ++} ++#endif ++ ++static void free_phys(void *ptr, unsigned long size) ++{ ++ struct page *page; ++ struct page *end; ++ ++ page = virt_to_page(ptr); ++ end = page + (PAGE_ALIGN(size) >> PAGE_SHIFT); ++ ++ for (; page < end; ++page) ++ __free_page(page); ++} ++ ++ + void *module_alloc(unsigned long size) + { + #ifdef MODULE_START +@@ -58,21 +169,68 @@ void *module_alloc(unsigned long size) + + return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL); + #else ++ void *ptr; ++ + if (size == 0) + return NULL; +- return vmalloc(size); ++ ++ ptr = alloc_phys(size); ++ ++ /* If we failed to allocate physically contiguous memory, ++ * fall back to regular vmalloc. The module loader code will ++ * create jump tables to handle long jumps */ ++ if (!ptr) ++ return vmalloc(size); ++ ++ return ptr; ++#endif ++} ++ ++static inline bool is_phys_addr(void *ptr) ++{ ++#ifdef CONFIG_64BIT ++ return (KSEGX((unsigned long)ptr) == CKSEG0); ++#else ++ return (KSEGX(ptr) == KSEG0); + #endif + } + + /* Free memory returned from module_alloc */ + void module_free(struct module *mod, void *module_region) + { +- vfree(module_region); ++ if (is_phys_addr(module_region)) { ++ if (mod->module_init == module_region) ++ free_phys(module_region, mod->init_size); ++ else if (mod->module_core == module_region) ++ free_phys(module_region, mod->core_size); ++ else ++ BUG(); ++ } else { ++ vfree(module_region); ++ } + } + + int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, + char *secstrings, struct module *mod) + { ++ unsigned int symindex = 0; ++ unsigned int core_size, init_size; ++ int i; ++ ++ for (i = 1; i < hdr->e_shnum; i++) ++ if (sechdrs[i].sh_type == SHT_SYMTAB) ++ symindex = i; ++ ++ core_size = get_plt_size(hdr, sechdrs, secstrings, symindex, false); ++ init_size = get_plt_size(hdr, sechdrs, secstrings, symindex, true); ++ ++ mod->arch.core_plt_offset = 0; ++ mod->arch.core_plt_size = core_size; ++ mod->arch.init_plt_offset = core_size; ++ mod->arch.plt_tbl = kmalloc(core_size + init_size, GFP_KERNEL); ++ if (!mod->arch.plt_tbl) ++ return -ENOMEM; ++ + return 0; + } + +@@ -95,28 +253,40 @@ static int apply_r_mips_32_rela(struct m + return 0; + } + +-static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v) ++static Elf_Addr add_plt_entry_to(unsigned *plt_offset, ++ void *start, Elf_Addr v) + { +- if (v % 4) { +- pr_err("module %s: dangerous R_MIPS_26 REL relocation\n", +- me->name); +- return -ENOEXEC; +- } ++ unsigned *tramp = start + *plt_offset; ++ *plt_offset += 4 * sizeof(int); + +- if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { +- printk(KERN_ERR +- "module %s: relocation overflow\n", +- me->name); +- return -ENOEXEC; +- } ++ /* adjust carry for addiu */ ++ if (v & 0x00008000) ++ v += 0x10000; ++ ++ tramp[0] = 0x3c190000 | (v >> 16); /* lui t9, hi16 */ ++ tramp[1] = 0x27390000 | (v & 0xffff); /* addiu t9, t9, lo16 */ ++ tramp[2] = 0x03200008; /* jr t9 */ ++ tramp[3] = 0x00000000; /* nop */ + +- *location = (*location & ~0x03ffffff) | +- ((*location + (v >> 2)) & 0x03ffffff); ++ return (Elf_Addr) tramp; ++} ++ ++static Elf_Addr add_plt_entry(struct module *me, void *location, Elf_Addr v) ++{ ++ if (location >= me->module_core && ++ location < me->module_core + me->core_size) ++ return add_plt_entry_to(&me->arch.core_plt_offset, ++ me->arch.plt_tbl, v); ++ ++ if (location >= me->module_init && ++ location < me->module_init + me->init_size) ++ return add_plt_entry_to(&me->arch.init_plt_offset, ++ me->arch.plt_tbl, v); + + return 0; + } + +-static int apply_r_mips_26_rela(struct module *me, u32 *location, Elf_Addr v) ++static int set_r_mips_26(struct module *me, u32 *location, u32 ofs, Elf_Addr v) + { + if (v % 4) { + pr_err("module %s: dangerous R_MIPS_26 RELArelocation\n", +@@ -125,17 +295,31 @@ static int apply_r_mips_26_rela(struct m + } + + if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { +- printk(KERN_ERR ++ v = add_plt_entry(me, location, v + (ofs << 2)); ++ if (!v) { ++ printk(KERN_ERR + "module %s: relocation overflow\n", + me->name); +- return -ENOEXEC; ++ return -ENOEXEC; ++ } ++ ofs = 0; + } + +- *location = (*location & ~0x03ffffff) | ((v >> 2) & 0x03ffffff); ++ *location = (*location & ~0x03ffffff) | ((ofs + (v >> 2)) & 0x03ffffff); + + return 0; + } + ++static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v) ++{ ++ return set_r_mips_26(me, location, *location & 0x03ffffff, v); ++} ++ ++static int apply_r_mips_26_rela(struct module *me, u32 *location, Elf_Addr v) ++{ ++ return set_r_mips_26(me, location, 0, v); ++} ++ + static int apply_r_mips_hi16_rel(struct module *me, u32 *location, Elf_Addr v) + { + struct mips_hi16 *n; +@@ -400,11 +584,23 @@ int module_finalize(const Elf_Ehdr *hdr, + list_add(&me->arch.dbe_list, &dbe_list); + spin_unlock_irq(&dbe_lock); + } ++ ++ /* Get rid of the fixup trampoline if we're running the module ++ * from physically mapped address space */ ++ if (me->arch.core_plt_offset == 0 && ++ me->arch.init_plt_offset == me->arch.core_plt_size && ++ is_phys_addr(me->module_core)) { ++ kfree(me->arch.plt_tbl); ++ me->arch.plt_tbl = NULL; ++ } ++ + return 0; + } + + void module_arch_cleanup(struct module *mod) + { ++ if (mod->arch.plt_tbl) ++ kfree(mod->arch.plt_tbl); + spin_lock_irq(&dbe_lock); + list_del(&mod->arch.dbe_list); + spin_unlock_irq(&dbe_lock); diff --git a/target/linux/generic-2.6/patches-2.6.32/028-module_exports.patch b/target/linux/generic-2.6/patches-2.6.32/028-module_exports.patch new file mode 100644 index 000000000..b06939f48 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/028-module_exports.patch @@ -0,0 +1,115 @@ +--- a/include/asm-generic/vmlinux.lds.h ++++ b/include/asm-generic/vmlinux.lds.h +@@ -52,6 +52,27 @@ + #define LOAD_OFFSET 0 + #endif + ++#ifndef SYMTAB_KEEP_STR ++#define SYMTAB_KEEP_STR *(__ksymtab_strings.*) ++#define SYMTAB_DISCARD_STR ++#else ++#define SYMTAB_DISCARD_STR *(__ksymtab_strings.*) ++#endif ++ ++#ifndef SYMTAB_KEEP ++#define SYMTAB_KEEP *(__ksymtab.*) ++#define SYMTAB_DISCARD ++#else ++#define SYMTAB_DISCARD *(__ksymtab.*) ++#endif ++ ++#ifndef SYMTAB_KEEP_GPL ++#define SYMTAB_KEEP_GPL *(__ksymtab_gpl.*) ++#define SYMTAB_DISCARD_GPL ++#else ++#define SYMTAB_DISCARD_GPL *(__ksymtab_gpl.*) ++#endif ++ + #ifndef VMLINUX_SYMBOL + #define VMLINUX_SYMBOL(_sym_) _sym_ + #endif +@@ -254,35 +275,35 @@ + /* Kernel symbol table: Normal symbols */ \ + __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___ksymtab) = .; \ +- *(__ksymtab) \ ++ SYMTAB_KEEP \ + VMLINUX_SYMBOL(__stop___ksymtab) = .; \ + } \ + \ + /* Kernel symbol table: GPL-only symbols */ \ + __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \ +- *(__ksymtab_gpl) \ ++ SYMTAB_KEEP_GPL \ + VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \ + } \ + \ + /* Kernel symbol table: Normal unused symbols */ \ + __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \ +- *(__ksymtab_unused) \ ++ *(__ksymtab_unused.*) \ + VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \ + } \ + \ + /* Kernel symbol table: GPL-only unused symbols */ \ + __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \ +- *(__ksymtab_unused_gpl) \ ++ *(__ksymtab_unused_gpl.*) \ + VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \ + } \ + \ + /* Kernel symbol table: GPL-future-only symbols */ \ + __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \ +- *(__ksymtab_gpl_future) \ ++ *(__ksymtab_gpl_future.*) \ + VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \ + } \ + \ +@@ -323,7 +344,13 @@ + \ + /* Kernel symbol table: strings */ \ + __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ +- *(__ksymtab_strings) \ ++ SYMTAB_KEEP_STR \ ++ } \ ++ \ ++ /DISCARD/ : { \ ++ SYMTAB_DISCARD \ ++ SYMTAB_DISCARD_GPL \ ++ SYMTAB_DISCARD_STR \ + } \ + \ + /* __*init sections */ \ +--- a/include/linux/module.h ++++ b/include/linux/module.h +@@ -192,16 +192,24 @@ void *__symbol_get_gpl(const char *symbo + #define __CRC_SYMBOL(sym, sec) + #endif + ++#ifdef MODULE ++#define __EXPORT_SUFFIX(sym) ++#else ++#define __EXPORT_SUFFIX(sym) "." #sym ++#endif ++ + /* For every exported symbol, place a struct in the __ksymtab section */ + #define __EXPORT_SYMBOL(sym, sec) \ + extern typeof(sym) sym; \ + __CRC_SYMBOL(sym, sec) \ + static const char __kstrtab_##sym[] \ +- __attribute__((section("__ksymtab_strings"), aligned(1))) \ ++ __attribute__((section("__ksymtab_strings" \ ++ __EXPORT_SUFFIX(sym)), aligned(1))) \ + = MODULE_SYMBOL_PREFIX #sym; \ + static const struct kernel_symbol __ksymtab_##sym \ + __used \ +- __attribute__((section("__ksymtab" sec), unused)) \ ++ __attribute__((section("__ksymtab" sec \ ++ __EXPORT_SUFFIX(sym)), unused)) \ + = { (unsigned long)&sym, __kstrtab_##sym } + + #define EXPORT_SYMBOL(sym) \ diff --git a/target/linux/generic-2.6/patches-2.6.32/029-arm_module_unresolved_weak_sym.patch b/target/linux/generic-2.6/patches-2.6.32/029-arm_module_unresolved_weak_sym.patch new file mode 100644 index 000000000..8a3b2e23c --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/029-arm_module_unresolved_weak_sym.patch @@ -0,0 +1,13 @@ +--- a/arch/arm/kernel/module.c ++++ b/arch/arm/kernel/module.c +@@ -121,6 +121,10 @@ apply_relocate(Elf32_Shdr *sechdrs, cons + return -ENOEXEC; + } + ++ if ((IS_ERR_VALUE(sym->st_value) || !sym->st_value) && ++ ELF_ST_BIND(sym->st_info) == STB_WEAK) ++ continue; ++ + loc = dstsec->sh_addr + rel->r_offset; + + switch (ELF32_R_TYPE(rel->r_info)) { diff --git a/target/linux/generic-2.6/patches-2.6.32/030-pci_disable_common_quirks.patch b/target/linux/generic-2.6/patches-2.6.32/030-pci_disable_common_quirks.patch new file mode 100644 index 000000000..4050cf14c --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/030-pci_disable_common_quirks.patch @@ -0,0 +1,43 @@ +--- a/drivers/pci/Kconfig ++++ b/drivers/pci/Kconfig +@@ -51,6 +51,12 @@ config PCI_STUB + + When in doubt, say N. + ++config PCI_DISABLE_COMMON_QUIRKS ++ bool "PCI disable common quirks" ++ depends on PCI ++ help ++ If you don't know what to do here, say N. ++ + config HT_IRQ + bool "Interrupts on hypertransport devices" + default y +--- a/drivers/pci/quirks.c ++++ b/drivers/pci/quirks.c +@@ -96,6 +96,7 @@ static void __devinit quirk_resource_ali + } + DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, quirk_resource_alignment); + ++#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS + /* The Mellanox Tavor device gives false positive parity errors + * Mark this device with a broken_parity_status, to allow + * PCI scanning code to "skip" this now blacklisted device. +@@ -1884,7 +1885,9 @@ static void __devinit fixup_rev1_53c810( + } + } + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810); ++#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */ + ++#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS + /* Enable 1k I/O space granularity on the Intel P64H2 */ + static void __devinit quirk_p64h2_1k_io(struct pci_dev *dev) + { +@@ -2515,6 +2518,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_I + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x150d, quirk_i82576_sriov); + + #endif /* CONFIG_PCI_IOV */ ++#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */ + + static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, + struct pci_fixup *end) diff --git a/target/linux/generic-2.6/patches-2.6.32/031-ppc_gcc_build_fix.patch b/target/linux/generic-2.6/patches-2.6.32/031-ppc_gcc_build_fix.patch new file mode 100644 index 000000000..6945ebf4c --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/031-ppc_gcc_build_fix.patch @@ -0,0 +1,226 @@ +GCC 4.4.x looks to be adding support for generating out-of-line register +saves/restores based on: + +http://gcc.gnu.org/ml/gcc-patches/2008-04/msg01678.html + +This breaks the kernel build as we'd have to link with libgcc to get the +implementation of the register save/restores. + +To workaround this issue, we just stole the save/restore code from gcc +and simplified it down for our needs (integer only). We only do this if +PPC32 as gcc makes believe the linker on ppc64 will deal with this and +only if CONFIG_CC_OPTIMIZE_FOR_SIZE is set (thus -Os). + +Signed-off-by: Kumar Gala <[EMAIL PROTECTED]> +--- + +If someone using cutting edge toolchains for ppc64 could test and make +sure if we enable CONFIG_CC_OPTIMIZE_FOR_SIZE things work that would be +nice. + +- k + + arch/powerpc/kernel/misc_32.S | 77 +++++++++++++++++++++++++++ + arch/powerpc/kernel/ppc_ksyms.c | 111 +++++++++++++++++++++++++++++++++++++++ + 2 files changed, 188 insertions(+), 0 deletions(-) + +--- a/arch/powerpc/kernel/misc_32.S ++++ b/arch/powerpc/kernel/misc_32.S +@@ -820,3 +820,80 @@ relocate_new_kernel_end: + relocate_new_kernel_size: + .long relocate_new_kernel_end - relocate_new_kernel + #endif ++ ++#if defined(CONFIG_PPC32) && defined(CONFIG_CC_OPTIMIZE_FOR_SIZE) ++/* Routines for saving integer registers, called by the compiler. */ ++/* Called with r11 pointing to the stack header word of the caller of the */ ++/* function, just beyond the end of the integer save area. */ ++ ++_GLOBAL(_savegpr_14) stw 14,-72(11) /* save gp registers */ ++_GLOBAL(_savegpr_15) stw 15,-68(11) ++_GLOBAL(_savegpr_16) stw 16,-64(11) ++_GLOBAL(_savegpr_17) stw 17,-60(11) ++_GLOBAL(_savegpr_18) stw 18,-56(11) ++_GLOBAL(_savegpr_19) stw 19,-52(11) ++_GLOBAL(_savegpr_20) stw 20,-48(11) ++_GLOBAL(_savegpr_21) stw 21,-44(11) ++_GLOBAL(_savegpr_22) stw 22,-40(11) ++_GLOBAL(_savegpr_23) stw 23,-36(11) ++_GLOBAL(_savegpr_24) stw 24,-32(11) ++_GLOBAL(_savegpr_25) stw 25,-28(11) ++_GLOBAL(_savegpr_26) stw 26,-24(11) ++_GLOBAL(_savegpr_27) stw 27,-20(11) ++_GLOBAL(_savegpr_28) stw 28,-16(11) ++_GLOBAL(_savegpr_29) stw 29,-12(11) ++_GLOBAL(_savegpr_30) stw 30,-8(11) ++_GLOBAL(_savegpr_31) stw 31,-4(11) ++ blr ++ ++/* Routines for restoring integer registers, called by the compiler. */ ++/* Called with r11 pointing to the stack header word of the caller of the */ ++/* function, just beyond the end of the integer restore area. */ ++ ++_GLOBAL(_restgpr_14) lwz 14,-72(11) /* restore gp registers */ ++_GLOBAL(_restgpr_15) lwz 15,-68(11) ++_GLOBAL(_restgpr_16) lwz 16,-64(11) ++_GLOBAL(_restgpr_17) lwz 17,-60(11) ++_GLOBAL(_restgpr_18) lwz 18,-56(11) ++_GLOBAL(_restgpr_19) lwz 19,-52(11) ++_GLOBAL(_restgpr_20) lwz 20,-48(11) ++_GLOBAL(_restgpr_21) lwz 21,-44(11) ++_GLOBAL(_restgpr_22) lwz 22,-40(11) ++_GLOBAL(_restgpr_23) lwz 23,-36(11) ++_GLOBAL(_restgpr_24) lwz 24,-32(11) ++_GLOBAL(_restgpr_25) lwz 25,-28(11) ++_GLOBAL(_restgpr_26) lwz 26,-24(11) ++_GLOBAL(_restgpr_27) lwz 27,-20(11) ++_GLOBAL(_restgpr_28) lwz 28,-16(11) ++_GLOBAL(_restgpr_29) lwz 29,-12(11) ++_GLOBAL(_restgpr_30) lwz 30,-8(11) ++_GLOBAL(_restgpr_31) lwz 31,-4(11) ++ blr ++ ++/* Routines for restoring integer registers, called by the compiler. */ ++/* Called with r11 pointing to the stack header word of the caller of the */ ++/* function, just beyond the end of the integer restore area. */ ++ ++_GLOBAL(_restgpr_14_x) lwz 14,-72(11) /* restore gp registers */ ++_GLOBAL(_restgpr_15_x) lwz 15,-68(11) ++_GLOBAL(_restgpr_16_x) lwz 16,-64(11) ++_GLOBAL(_restgpr_17_x) lwz 17,-60(11) ++_GLOBAL(_restgpr_18_x) lwz 18,-56(11) ++_GLOBAL(_restgpr_19_x) lwz 19,-52(11) ++_GLOBAL(_restgpr_20_x) lwz 20,-48(11) ++_GLOBAL(_restgpr_21_x) lwz 21,-44(11) ++_GLOBAL(_restgpr_22_x) lwz 22,-40(11) ++_GLOBAL(_restgpr_23_x) lwz 23,-36(11) ++_GLOBAL(_restgpr_24_x) lwz 24,-32(11) ++_GLOBAL(_restgpr_25_x) lwz 25,-28(11) ++_GLOBAL(_restgpr_26_x) lwz 26,-24(11) ++_GLOBAL(_restgpr_27_x) lwz 27,-20(11) ++_GLOBAL(_restgpr_28_x) lwz 28,-16(11) ++_GLOBAL(_restgpr_29_x) lwz 29,-12(11) ++_GLOBAL(_restgpr_30_x) lwz 30,-8(11) ++_GLOBAL(_restgpr_31_x) lwz 0,4(11) ++ lwz 31,-4(11) ++ mtlr 0 ++ mr 1,11 ++ blr ++#endif +--- a/arch/powerpc/kernel/ppc_ksyms.c ++++ b/arch/powerpc/kernel/ppc_ksyms.c +@@ -188,3 +188,114 @@ EXPORT_SYMBOL(__mtdcr); + EXPORT_SYMBOL(__mfdcr); + #endif + EXPORT_SYMBOL(empty_zero_page); ++ ++#if defined(CONFIG_PPC32) && defined(CONFIG_CC_OPTIMIZE_FOR_SIZE) ++void _savegpr_14(void); ++void _savegpr_15(void); ++void _savegpr_16(void); ++void _savegpr_17(void); ++void _savegpr_18(void); ++void _savegpr_19(void); ++void _savegpr_20(void); ++void _savegpr_21(void); ++void _savegpr_22(void); ++void _savegpr_23(void); ++void _savegpr_24(void); ++void _savegpr_25(void); ++void _savegpr_26(void); ++void _savegpr_27(void); ++void _savegpr_28(void); ++void _savegpr_29(void); ++void _savegpr_30(void); ++void _savegpr_31(void); ++void _restgpr_14(void); ++void _restgpr_15(void); ++void _restgpr_16(void); ++void _restgpr_17(void); ++void _restgpr_18(void); ++void _restgpr_19(void); ++void _restgpr_20(void); ++void _restgpr_21(void); ++void _restgpr_22(void); ++void _restgpr_23(void); ++void _restgpr_24(void); ++void _restgpr_25(void); ++void _restgpr_26(void); ++void _restgpr_27(void); ++void _restgpr_28(void); ++void _restgpr_29(void); ++void _restgpr_30(void); ++void _restgpr_31(void); ++void _restgpr_14_x(void); ++void _restgpr_15_x(void); ++void _restgpr_16_x(void); ++void _restgpr_17_x(void); ++void _restgpr_18_x(void); ++void _restgpr_19_x(void); ++void _restgpr_20_x(void); ++void _restgpr_21_x(void); ++void _restgpr_22_x(void); ++void _restgpr_23_x(void); ++void _restgpr_24_x(void); ++void _restgpr_25_x(void); ++void _restgpr_26_x(void); ++void _restgpr_27_x(void); ++void _restgpr_28_x(void); ++void _restgpr_29_x(void); ++void _restgpr_30_x(void); ++void _restgpr_31_x(void); ++EXPORT_SYMBOL(_savegpr_14); ++EXPORT_SYMBOL(_savegpr_15); ++EXPORT_SYMBOL(_savegpr_16); ++EXPORT_SYMBOL(_savegpr_17); ++EXPORT_SYMBOL(_savegpr_18); ++EXPORT_SYMBOL(_savegpr_19); ++EXPORT_SYMBOL(_savegpr_20); ++EXPORT_SYMBOL(_savegpr_21); ++EXPORT_SYMBOL(_savegpr_22); ++EXPORT_SYMBOL(_savegpr_23); ++EXPORT_SYMBOL(_savegpr_24); ++EXPORT_SYMBOL(_savegpr_25); ++EXPORT_SYMBOL(_savegpr_26); ++EXPORT_SYMBOL(_savegpr_27); ++EXPORT_SYMBOL(_savegpr_28); ++EXPORT_SYMBOL(_savegpr_29); ++EXPORT_SYMBOL(_savegpr_30); ++EXPORT_SYMBOL(_savegpr_31); ++EXPORT_SYMBOL(_restgpr_14); ++EXPORT_SYMBOL(_restgpr_15); ++EXPORT_SYMBOL(_restgpr_16); ++EXPORT_SYMBOL(_restgpr_17); ++EXPORT_SYMBOL(_restgpr_18); ++EXPORT_SYMBOL(_restgpr_19); ++EXPORT_SYMBOL(_restgpr_20); ++EXPORT_SYMBOL(_restgpr_21); ++EXPORT_SYMBOL(_restgpr_22); ++EXPORT_SYMBOL(_restgpr_23); ++EXPORT_SYMBOL(_restgpr_24); ++EXPORT_SYMBOL(_restgpr_25); ++EXPORT_SYMBOL(_restgpr_26); ++EXPORT_SYMBOL(_restgpr_27); ++EXPORT_SYMBOL(_restgpr_28); ++EXPORT_SYMBOL(_restgpr_29); ++EXPORT_SYMBOL(_restgpr_30); ++EXPORT_SYMBOL(_restgpr_31); ++EXPORT_SYMBOL(_restgpr_14_x); ++EXPORT_SYMBOL(_restgpr_15_x); ++EXPORT_SYMBOL(_restgpr_16_x); ++EXPORT_SYMBOL(_restgpr_17_x); ++EXPORT_SYMBOL(_restgpr_18_x); ++EXPORT_SYMBOL(_restgpr_19_x); ++EXPORT_SYMBOL(_restgpr_20_x); ++EXPORT_SYMBOL(_restgpr_21_x); ++EXPORT_SYMBOL(_restgpr_22_x); ++EXPORT_SYMBOL(_restgpr_23_x); ++EXPORT_SYMBOL(_restgpr_24_x); ++EXPORT_SYMBOL(_restgpr_25_x); ++EXPORT_SYMBOL(_restgpr_26_x); ++EXPORT_SYMBOL(_restgpr_27_x); ++EXPORT_SYMBOL(_restgpr_28_x); ++EXPORT_SYMBOL(_restgpr_29_x); ++EXPORT_SYMBOL(_restgpr_30_x); ++EXPORT_SYMBOL(_restgpr_31_x); ++#endif /* CONFIG_PPC32 && CONFIG_CC_OPTIMIZE_FOR_SIZE */ diff --git a/target/linux/generic-2.6/patches-2.6.32/060-block2mtd_init.patch b/target/linux/generic-2.6/patches-2.6.32/060-block2mtd_init.patch new file mode 100644 index 000000000..50df4aae0 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/060-block2mtd_init.patch @@ -0,0 +1,110 @@ +--- a/drivers/mtd/devices/block2mtd.c ++++ b/drivers/mtd/devices/block2mtd.c +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -232,10 +233,11 @@ static void block2mtd_free_device(struct + + + /* FIXME: ensure that mtd->size % erase_size == 0 */ +-static struct block2mtd_dev *add_device(char *devname, int erase_size) ++static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname) + { + struct block_device *bdev; + struct block2mtd_dev *dev; ++ struct mtd_partition *part; + char *name; + + if (!devname) +@@ -273,17 +275,17 @@ static struct block2mtd_dev *add_device( + + mutex_init(&dev->write_mutex); + +- /* Setup the MTD structure */ +- /* make the name contain the block device in */ +- name = kmalloc(sizeof("block2mtd: ") + strlen(devname) + 1, +- GFP_KERNEL); ++ if (!mtdname) ++ mtdname = devname; ++ ++ name = kmalloc(strlen(mtdname) + 1, GFP_KERNEL); + if (!name) + goto devinit_err; + +- sprintf(name, "block2mtd: %s", devname); ++ strcpy(name, mtdname); + dev->mtd.name = name; + +- dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK; ++ dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK & ~(erase_size - 1); + dev->mtd.erasesize = erase_size; + dev->mtd.writesize = 1; + dev->mtd.type = MTD_RAM; +@@ -296,14 +298,17 @@ static struct block2mtd_dev *add_device( + dev->mtd.priv = dev; + dev->mtd.owner = THIS_MODULE; + +- if (add_mtd_device(&dev->mtd)) { ++ part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL); ++ part->name = dev->mtd.name; ++ part->offset = 0; ++ part->size = dev->mtd.size; ++ if (add_mtd_partitions(&dev->mtd, part, 1)) { + /* Device didnt get added, so free the entry */ + goto devinit_err; + } + list_add(&dev->list, &blkmtd_device_list); + INFO("mtd%d: [%s] erase_size = %dKiB [%d]", dev->mtd.index, +- dev->mtd.name + strlen("block2mtd: "), +- dev->mtd.erasesize >> 10, dev->mtd.erasesize); ++ mtdname, dev->mtd.erasesize >> 10, dev->mtd.erasesize); + return dev; + + devinit_err: +@@ -376,9 +381,9 @@ static char block2mtd_paramline[80 + 12] + + static int block2mtd_setup2(const char *val) + { +- char buf[80 + 12]; /* 80 for device, 12 for erase size */ ++ char buf[80 + 12 + 80]; /* 80 for device, 12 for erase size, 80 for name */ + char *str = buf; +- char *token[2]; ++ char *token[3]; + char *name; + size_t erase_size = PAGE_SIZE; + int i, ret; +@@ -389,7 +394,7 @@ static int block2mtd_setup2(const char * + strcpy(str, val); + kill_final_newline(str); + +- for (i = 0; i < 2; i++) ++ for (i = 0; i < 3; i++) + token[i] = strsep(&str, ","); + + if (str) +@@ -408,8 +413,10 @@ static int block2mtd_setup2(const char * + parse_err("illegal erase size"); + } + } ++ if (token[2] && (strlen(token[2]) + 1 > 80)) ++ parse_err("mtd device name too long"); + +- add_device(name, erase_size); ++ add_device(name, erase_size, token[2]); + + return 0; + } +@@ -443,7 +450,7 @@ static int block2mtd_setup(const char *v + + + module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200); +-MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,]\""); ++MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,[,]]\""); + + static int __init block2mtd_init(void) + { diff --git a/target/linux/generic-2.6/patches-2.6.32/065-rootfs_split.patch b/target/linux/generic-2.6/patches-2.6.32/065-rootfs_split.patch new file mode 100644 index 000000000..307e5ee34 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/065-rootfs_split.patch @@ -0,0 +1,624 @@ +--- a/drivers/mtd/Kconfig ++++ b/drivers/mtd/Kconfig +@@ -53,6 +53,16 @@ config MTD_PARTITIONS + devices. Partitioning on NFTL 'devices' is a different - that's the + 'normal' form of partitioning used on a block device. + ++config MTD_ROOTFS_ROOT_DEV ++ bool "Automatically set 'rootfs' partition to be root filesystem" ++ depends on MTD_PARTITIONS ++ default y ++ ++config MTD_ROOTFS_SPLIT ++ bool "Automatically split 'rootfs' partition for squashfs" ++ depends on MTD_PARTITIONS ++ default y ++ + config MTD_REDBOOT_PARTS + tristate "RedBoot partition table parsing" + depends on MTD_PARTITIONS +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -18,6 +18,8 @@ + #include + #include + #include ++#include ++#include + + /* Our partition linked list */ + static LIST_HEAD(mtd_partitions); +@@ -35,7 +37,7 @@ struct mtd_part { + * the pointer to that structure with this macro. + */ + #define PART(x) ((struct mtd_part *)(x)) +- ++#define IS_PART(mtd) (mtd->read == part_read) + + /* + * MTD methods which simply translate the effective address and pass through +@@ -503,6 +505,150 @@ out_register: + return slave; + } + ++#ifdef CONFIG_MTD_ROOTFS_SPLIT ++#define ROOTFS_SPLIT_NAME "rootfs_data" ++#define ROOTFS_REMOVED_NAME "" ++ ++struct squashfs_super_block { ++ __le32 s_magic; ++ __le32 pad0[9]; ++ __le64 bytes_used; ++}; ++ ++ ++static int split_squashfs(struct mtd_info *master, int offset, int *split_offset) ++{ ++ struct squashfs_super_block sb; ++ int len, ret; ++ ++ ret = master->read(master, offset, sizeof(sb), &len, (void *) &sb); ++ if (ret || (len != sizeof(sb))) { ++ printk(KERN_ALERT "split_squashfs: error occured while reading " ++ "from \"%s\"\n", master->name); ++ return -EINVAL; ++ } ++ ++ if (SQUASHFS_MAGIC != le32_to_cpu(sb.s_magic) ) { ++ printk(KERN_ALERT "split_squashfs: no squashfs found in \"%s\"\n", ++ master->name); ++ *split_offset = 0; ++ return 0; ++ } ++ ++ if (le64_to_cpu((sb.bytes_used)) <= 0) { ++ printk(KERN_ALERT "split_squashfs: squashfs is empty in \"%s\"\n", ++ master->name); ++ *split_offset = 0; ++ return 0; ++ } ++ ++ len = (u32) le64_to_cpu(sb.bytes_used); ++ len += (offset & 0x000fffff); ++ len += (master->erasesize - 1); ++ len &= ~(master->erasesize - 1); ++ len -= (offset & 0x000fffff); ++ *split_offset = offset + len; ++ ++ return 0; ++} ++ ++static int split_rootfs_data(struct mtd_info *master, struct mtd_info *rpart, const struct mtd_partition *part) ++{ ++ struct mtd_partition *dpart; ++ struct mtd_part *slave = NULL; ++ int split_offset = 0; ++ int ret; ++ ++ ret = split_squashfs(master, part->offset, &split_offset); ++ if (ret) ++ return ret; ++ ++ if (split_offset <= 0) ++ return 0; ++ ++ dpart = kmalloc(sizeof(*part)+sizeof(ROOTFS_SPLIT_NAME)+1, GFP_KERNEL); ++ if (dpart == NULL) { ++ printk(KERN_INFO "split_squashfs: no memory for partition \"%s\"\n", ++ ROOTFS_SPLIT_NAME); ++ return -ENOMEM; ++ } ++ ++ memcpy(dpart, part, sizeof(*part)); ++ dpart->name = (unsigned char *)&dpart[1]; ++ strcpy(dpart->name, ROOTFS_SPLIT_NAME); ++ ++ dpart->size -= split_offset - dpart->offset; ++ dpart->offset = split_offset; ++ ++ if (dpart == NULL) ++ return 1; ++ ++ printk(KERN_INFO "mtd: partition \"%s\" created automatically, ofs=%llX, len=%llX \n", ++ ROOTFS_SPLIT_NAME, dpart->offset, dpart->size); ++ ++ slave = add_one_partition(master, dpart, 0, split_offset); ++ if (!slave) { ++ kfree(dpart); ++ return -ENOMEM; ++ } ++ rpart->split = &slave->mtd; ++ ++ return 0; ++} ++ ++static int refresh_rootfs_split(struct mtd_info *mtd) ++{ ++ struct mtd_partition tpart; ++ struct mtd_part *part; ++ char *name; ++ //int index = 0; ++ int offset, size; ++ int ret; ++ ++ part = PART(mtd); ++ ++ /* check for the new squashfs offset first */ ++ ret = split_squashfs(part->master, part->offset, &offset); ++ if (ret) ++ return ret; ++ ++ if ((offset > 0) && !mtd->split) { ++ printk(KERN_INFO "%s: creating new split partition for \"%s\"\n", __func__, mtd->name); ++ /* if we don't have a rootfs split partition, create a new one */ ++ tpart.name = (char *) mtd->name; ++ tpart.size = mtd->size; ++ tpart.offset = part->offset; ++ ++ return split_rootfs_data(part->master, &part->mtd, &tpart); ++ } else if ((offset > 0) && mtd->split) { ++ /* update the offsets of the existing partition */ ++ size = mtd->size + part->offset - offset; ++ ++ part = PART(mtd->split); ++ part->offset = offset; ++ part->mtd.size = size; ++ printk(KERN_INFO "%s: %s partition \"" ROOTFS_SPLIT_NAME "\", offset: 0x%06x (0x%06x)\n", ++ __func__, (!strcmp(part->mtd.name, ROOTFS_SPLIT_NAME) ? "updating" : "creating"), ++ (u32) part->offset, (u32) part->mtd.size); ++ name = kmalloc(sizeof(ROOTFS_SPLIT_NAME) + 1, GFP_KERNEL); ++ strcpy(name, ROOTFS_SPLIT_NAME); ++ part->mtd.name = name; ++ } else if ((offset <= 0) && mtd->split) { ++ printk(KERN_INFO "%s: removing partition \"%s\"\n", __func__, mtd->split->name); ++ ++ /* mark existing partition as removed */ ++ part = PART(mtd->split); ++ name = kmalloc(sizeof(ROOTFS_SPLIT_NAME) + 1, GFP_KERNEL); ++ strcpy(name, ROOTFS_REMOVED_NAME); ++ part->mtd.name = name; ++ part->offset = 0; ++ part->mtd.size = 0; ++ } ++ ++ return 0; ++} ++#endif /* CONFIG_MTD_ROOTFS_SPLIT */ ++ + /* + * This function, given a master MTD object and a partition table, creates + * and registers slave MTD objects which are bound to the master according to +@@ -518,7 +664,7 @@ int add_mtd_partitions(struct mtd_info * + { + struct mtd_part *slave; + uint64_t cur_offset = 0; +- int i; ++ int i, ret; + + printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name); + +@@ -526,6 +672,21 @@ int add_mtd_partitions(struct mtd_info * + slave = add_one_partition(master, parts + i, i, cur_offset); + if (!slave) + return -ENOMEM; ++ ++ if (!strcmp(parts[i].name, "rootfs")) { ++#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV ++ if (ROOT_DEV == 0) { ++ printk(KERN_NOTICE "mtd: partition \"rootfs\" " ++ "set to be root filesystem\n"); ++ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, slave->mtd.index); ++ } ++#endif ++#ifdef CONFIG_MTD_ROOTFS_SPLIT ++ ret = split_rootfs_data(master, &slave->mtd, &parts[i]); ++ /* if (ret == 0) ++ j++; */ ++#endif ++ } + cur_offset = slave->offset + slave->mtd.size; + } + +@@ -533,6 +694,32 @@ int add_mtd_partitions(struct mtd_info * + } + EXPORT_SYMBOL(add_mtd_partitions); + ++int refresh_mtd_partitions(struct mtd_info *mtd) ++{ ++ int ret = 0; ++ ++ if (IS_PART(mtd)) { ++ struct mtd_part *part; ++ struct mtd_info *master; ++ ++ part = PART(mtd); ++ master = part->master; ++ if (master->refresh_device) ++ ret = master->refresh_device(master); ++ } ++ ++ if (!ret && mtd->refresh_device) ++ ret = mtd->refresh_device(mtd); ++ ++#ifdef CONFIG_MTD_ROOTFS_SPLIT ++ if (!ret && IS_PART(mtd) && !strcmp(mtd->name, "rootfs")) ++ refresh_rootfs_split(mtd); ++#endif ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(refresh_mtd_partitions); ++ + static DEFINE_SPINLOCK(part_parser_lock); + static LIST_HEAD(part_parsers); + +--- a/drivers/mtd/devices/block2mtd.c ++++ b/drivers/mtd/devices/block2mtd.c +@@ -29,6 +29,8 @@ struct block2mtd_dev { + struct block_device *blkdev; + struct mtd_info mtd; + struct mutex write_mutex; ++ rwlock_t bdev_mutex; ++ char devname[0]; + }; + + +@@ -81,6 +83,12 @@ static int block2mtd_erase(struct mtd_in + size_t len = instr->len; + int err; + ++ read_lock(&dev->bdev_mutex); ++ if (!dev->blkdev) { ++ err = -EINVAL; ++ goto done; ++ } ++ + instr->state = MTD_ERASING; + mutex_lock(&dev->write_mutex); + err = _block2mtd_erase(dev, from, len); +@@ -93,6 +101,10 @@ static int block2mtd_erase(struct mtd_in + + instr->state = MTD_ERASE_DONE; + mtd_erase_callback(instr); ++ ++done: ++ read_unlock(&dev->bdev_mutex); ++ + return err; + } + +@@ -104,10 +116,14 @@ static int block2mtd_read(struct mtd_inf + struct page *page; + int index = from >> PAGE_SHIFT; + int offset = from & (PAGE_SIZE-1); +- int cpylen; ++ int cpylen, err = 0; ++ ++ read_lock(&dev->bdev_mutex); ++ if (!dev->blkdev || (from > mtd->size)) { ++ err = -EINVAL; ++ goto done; ++ } + +- if (from > mtd->size) +- return -EINVAL; + if (from + len > mtd->size) + len = mtd->size - from; + +@@ -122,10 +138,14 @@ static int block2mtd_read(struct mtd_inf + len = len - cpylen; + + page = page_read(dev->blkdev->bd_inode->i_mapping, index); +- if (!page) +- return -ENOMEM; +- if (IS_ERR(page)) +- return PTR_ERR(page); ++ if (!page) { ++ err = -ENOMEM; ++ goto done; ++ } ++ if (IS_ERR(page)) { ++ err = PTR_ERR(page); ++ goto done; ++ } + + memcpy(buf, page_address(page) + offset, cpylen); + page_cache_release(page); +@@ -136,7 +156,10 @@ static int block2mtd_read(struct mtd_inf + offset = 0; + index++; + } +- return 0; ++ ++done: ++ read_unlock(&dev->bdev_mutex); ++ return err; + } + + +@@ -188,12 +211,22 @@ static int block2mtd_write(struct mtd_in + size_t *retlen, const u_char *buf) + { + struct block2mtd_dev *dev = mtd->priv; +- int err; ++ int err = 0; ++ ++ read_lock(&dev->bdev_mutex); ++ if (!dev->blkdev) { ++ err = -EINVAL; ++ goto done; ++ } + + if (!len) +- return 0; +- if (to >= mtd->size) +- return -ENOSPC; ++ goto done; ++ ++ if (to >= mtd->size) { ++ err = -ENOSPC; ++ goto done; ++ } ++ + if (to + len > mtd->size) + len = mtd->size - to; + +@@ -202,6 +235,9 @@ static int block2mtd_write(struct mtd_in + mutex_unlock(&dev->write_mutex); + if (err > 0) + err = 0; ++ ++done: ++ read_unlock(&dev->bdev_mutex); + return err; + } + +@@ -210,52 +246,29 @@ static int block2mtd_write(struct mtd_in + static void block2mtd_sync(struct mtd_info *mtd) + { + struct block2mtd_dev *dev = mtd->priv; +- sync_blockdev(dev->blkdev); +- return; +-} +- +- +-static void block2mtd_free_device(struct block2mtd_dev *dev) +-{ +- if (!dev) +- return; +- +- kfree(dev->mtd.name); + +- if (dev->blkdev) { +- invalidate_mapping_pages(dev->blkdev->bd_inode->i_mapping, +- 0, -1); +- close_bdev_exclusive(dev->blkdev, FMODE_READ|FMODE_WRITE); +- } ++ read_lock(&dev->bdev_mutex); ++ if (dev->blkdev) ++ sync_blockdev(dev->blkdev); ++ read_unlock(&dev->bdev_mutex); + +- kfree(dev); ++ return; + } + + +-/* FIXME: ensure that mtd->size % erase_size == 0 */ +-static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname) ++static int _open_bdev(struct block2mtd_dev *dev) + { + struct block_device *bdev; +- struct block2mtd_dev *dev; +- struct mtd_partition *part; +- char *name; +- +- if (!devname) +- return NULL; +- +- dev = kzalloc(sizeof(struct block2mtd_dev), GFP_KERNEL); +- if (!dev) +- return NULL; + + /* Get a handle on the device */ +- bdev = open_bdev_exclusive(devname, FMODE_READ|FMODE_WRITE, NULL); ++ bdev = open_bdev_exclusive(dev->devname, FMODE_READ|FMODE_WRITE, NULL); + #ifndef MODULE + if (IS_ERR(bdev)) { + + /* We might not have rootfs mounted at this point. Try + to resolve the device name by other means. */ + +- dev_t devt = name_to_dev_t(devname); ++ dev_t devt = name_to_dev_t(dev->devname); + if (devt) { + bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ); + } +@@ -263,17 +276,97 @@ static struct block2mtd_dev *add_device( + #endif + + if (IS_ERR(bdev)) { +- ERROR("error: cannot open device %s", devname); +- goto devinit_err; ++ ERROR("error: cannot open device %s", dev->devname); ++ return 1; + } + dev->blkdev = bdev; + + if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) { + ERROR("attempting to use an MTD device as a block device"); +- goto devinit_err; ++ return 1; + } + ++ return 0; ++} ++ ++static void _close_bdev(struct block2mtd_dev *dev) ++{ ++ struct block_device *bdev; ++ ++ if (!dev->blkdev) ++ return; ++ ++ bdev = dev->blkdev; ++ invalidate_mapping_pages(dev->blkdev->bd_inode->i_mapping, 0, -1); ++ close_bdev_exclusive(dev->blkdev, FMODE_READ|FMODE_WRITE); ++ dev->blkdev = NULL; ++} ++ ++static void block2mtd_free_device(struct block2mtd_dev *dev) ++{ ++ if (!dev) ++ return; ++ ++ kfree(dev->mtd.name); ++ _close_bdev(dev); ++ kfree(dev); ++} ++ ++ ++static int block2mtd_refresh(struct mtd_info *mtd) ++{ ++ struct block2mtd_dev *dev = mtd->priv; ++ struct block_device *bdev; ++ dev_t devt; ++ int err = 0; ++ ++ /* no other mtd function can run at this point */ ++ write_lock(&dev->bdev_mutex); ++ ++ /* get the device number for the whole disk */ ++ devt = MKDEV(MAJOR(dev->blkdev->bd_dev), 0); ++ ++ /* close the old block device */ ++ _close_bdev(dev); ++ ++ /* open the whole disk, issue a partition rescan, then */ ++ bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ); ++ if (!bdev || !bdev->bd_disk) ++ err = -EINVAL; ++ else { ++ err = rescan_partitions(bdev->bd_disk, bdev); ++ } ++ if (bdev) ++ close_bdev_exclusive(bdev, FMODE_READ|FMODE_WRITE); ++ ++ /* try to open the partition block device again */ ++ _open_bdev(dev); ++ write_unlock(&dev->bdev_mutex); ++ ++ return err; ++} ++ ++/* FIXME: ensure that mtd->size % erase_size == 0 */ ++static struct block2mtd_dev *add_device(char *devname, int erase_size, char *mtdname) ++{ ++ struct block2mtd_dev *dev; ++ struct mtd_partition *part; ++ char *name; ++ ++ if (!devname) ++ return NULL; ++ ++ dev = kzalloc(sizeof(struct block2mtd_dev) + strlen(devname) + 1, GFP_KERNEL); ++ if (!dev) ++ return NULL; ++ ++ strcpy(dev->devname, devname); ++ ++ if (_open_bdev(dev)) ++ goto devinit_err; ++ + mutex_init(&dev->write_mutex); ++ rwlock_init(&dev->bdev_mutex); + + if (!mtdname) + mtdname = devname; +@@ -297,6 +390,7 @@ static struct block2mtd_dev *add_device( + dev->mtd.read = block2mtd_read; + dev->mtd.priv = dev; + dev->mtd.owner = THIS_MODULE; ++ dev->mtd.refresh_device = block2mtd_refresh; + + part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL); + part->name = dev->mtd.name; +--- a/drivers/mtd/mtdchar.c ++++ b/drivers/mtd/mtdchar.c +@@ -18,6 +18,7 @@ + + #include + #include ++#include + + #include + +@@ -814,6 +815,13 @@ static int mtd_ioctl(struct inode *inode + file->f_pos = 0; + break; + } ++#ifdef CONFIG_MTD_PARTITIONS ++ case MTDREFRESH: ++ { ++ ret = refresh_mtd_partitions(mtd); ++ break; ++ } ++#endif + + default: + ret = -ENOTTY; +--- a/include/linux/mtd/mtd.h ++++ b/include/linux/mtd/mtd.h +@@ -101,6 +101,7 @@ struct mtd_oob_ops { + uint8_t *oobbuf; + }; + ++struct mtd_info; + struct mtd_info { + u_char type; + uint32_t flags; +@@ -241,6 +242,9 @@ struct mtd_info { + struct device dev; + int usecount; + ++ int (*refresh_device)(struct mtd_info *mtd); ++ struct mtd_info *split; ++ + /* If the driver is something smart, like UBI, it may need to maintain + * its own reference counting. The below functions are only for driver. + * The driver may register its callbacks. These callbacks are not +--- a/include/linux/mtd/partitions.h ++++ b/include/linux/mtd/partitions.h +@@ -34,12 +34,14 @@ + * erasesize aligned (e.g. use MTDPART_OFS_NEXTBLK). + */ + ++struct mtd_partition; + struct mtd_partition { + char *name; /* identifier string */ + uint64_t size; /* partition size */ + uint64_t offset; /* offset within the master MTD space */ + uint32_t mask_flags; /* master MTD flags to mask out for this partition */ + struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only)*/ ++ int (*refresh_partition)(struct mtd_info *); + }; + + #define MTDPART_OFS_NXTBLK (-2) +@@ -51,6 +53,7 @@ struct mtd_info; + + int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int); + int del_mtd_partitions(struct mtd_info *); ++int refresh_mtd_partitions(struct mtd_info *); + + /* + * Functions dealing with the various ways of partitioning the space +--- a/include/mtd/mtd-abi.h ++++ b/include/mtd/mtd-abi.h +@@ -110,6 +110,7 @@ struct otp_info { + #define MEMERASE64 _IOW('M', 20, struct erase_info_user64) + #define MEMWRITEOOB64 _IOWR('M', 21, struct mtd_oob_buf64) + #define MEMREADOOB64 _IOWR('M', 22, struct mtd_oob_buf64) ++#define MTDREFRESH _IO('M', 23) + + /* + * Obsolete legacy interface. Keep it in order not to break userspace diff --git a/target/linux/generic-2.6/patches-2.6.32/066-block2mtd_probe.patch b/target/linux/generic-2.6/patches-2.6.32/066-block2mtd_probe.patch new file mode 100644 index 000000000..b2b1a347f --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/066-block2mtd_probe.patch @@ -0,0 +1,10 @@ +--- a/drivers/mtd/devices/block2mtd.c ++++ b/drivers/mtd/devices/block2mtd.c +@@ -268,6 +268,7 @@ static int _open_bdev(struct block2mtd_d + /* We might not have rootfs mounted at this point. Try + to resolve the device name by other means. */ + ++ wait_for_device_probe(); + dev_t devt = name_to_dev_t(dev->devname); + if (devt) { + bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ); diff --git a/target/linux/generic-2.6/patches-2.6.32/070-redboot_space.patch b/target/linux/generic-2.6/patches-2.6.32/070-redboot_space.patch new file mode 100644 index 000000000..6ace83c01 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/070-redboot_space.patch @@ -0,0 +1,30 @@ +--- a/drivers/mtd/redboot.c ++++ b/drivers/mtd/redboot.c +@@ -249,14 +249,21 @@ static int parse_redboot_partitions(stru + #endif + names += strlen(names)+1; + +-#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED + if(fl->next && fl->img->flash_base + fl->img->size + master->erasesize <= fl->next->img->flash_base) { +- i++; +- parts[i].offset = parts[i-1].size + parts[i-1].offset; +- parts[i].size = fl->next->img->flash_base - parts[i].offset; +- parts[i].name = nullname; +- } ++ if (!strcmp(parts[i].name, "rootfs")) { ++ parts[i].size = fl->next->img->flash_base; ++ parts[i].size &= ~(master->erasesize - 1); ++ parts[i].size -= parts[i].offset; ++#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED ++ nrparts--; ++ } else { ++ i++; ++ parts[i].offset = parts[i-1].size + parts[i-1].offset; ++ parts[i].size = fl->next->img->flash_base - parts[i].offset; ++ parts[i].name = nullname; + #endif ++ } ++ } + tmp_fl = fl; + fl = fl->next; + kfree(tmp_fl); diff --git a/target/linux/generic-2.6/patches-2.6.32/071-redboot_boardconfig.patch b/target/linux/generic-2.6/patches-2.6.32/071-redboot_boardconfig.patch new file mode 100644 index 000000000..f9bc4fe36 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/071-redboot_boardconfig.patch @@ -0,0 +1,60 @@ +--- a/drivers/mtd/redboot.c ++++ b/drivers/mtd/redboot.c +@@ -11,6 +11,8 @@ + #include + #include + ++#define BOARD_CONFIG_PART "boardconfig" ++ + struct fis_image_desc { + unsigned char name[16]; // Null terminated name + uint32_t flash_base; // Address within FLASH of image +@@ -41,6 +43,7 @@ static int parse_redboot_partitions(stru + struct mtd_partition **pparts, + unsigned long fis_origin) + { ++ unsigned long max_offset = 0; + int nrparts = 0; + struct fis_image_desc *buf; + struct mtd_partition *parts; +@@ -209,14 +212,14 @@ static int parse_redboot_partitions(stru + } + } + #endif +- parts = kzalloc(sizeof(*parts)*nrparts + nulllen + namelen, GFP_KERNEL); ++ parts = kzalloc(sizeof(*parts) * (nrparts + 1) + nulllen + namelen + sizeof(BOARD_CONFIG_PART), GFP_KERNEL); + + if (!parts) { + ret = -ENOMEM; + goto out; + } + +- nullname = (char *)&parts[nrparts]; ++ nullname = (char *)&parts[nrparts + 1]; + #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED + if (nulllen > 0) { + strcpy(nullname, nullstring); +@@ -235,6 +238,8 @@ static int parse_redboot_partitions(stru + } + #endif + for ( ; iimg->size; + parts[i].offset = fl->img->flash_base; + parts[i].name = names; +@@ -268,6 +273,14 @@ static int parse_redboot_partitions(stru + fl = fl->next; + kfree(tmp_fl); + } ++ if(master->size - max_offset >= master->erasesize) ++ { ++ parts[nrparts].size = master->size - max_offset; ++ parts[nrparts].offset = max_offset; ++ parts[nrparts].name = names; ++ strcpy(names, BOARD_CONFIG_PART); ++ nrparts++; ++ } + ret = nrparts; + *pparts = parts; + out: diff --git a/target/linux/generic-2.6/patches-2.6.32/080-mtd_plat_nand_chip_fixup.patch b/target/linux/generic-2.6/patches-2.6.32/080-mtd_plat_nand_chip_fixup.patch new file mode 100644 index 000000000..3897c33c2 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/080-mtd_plat_nand_chip_fixup.patch @@ -0,0 +1,32 @@ +--- a/include/linux/mtd/nand.h ++++ b/include/linux/mtd/nand.h +@@ -576,6 +576,7 @@ struct platform_nand_chip { + int chip_delay; + unsigned int options; + const char **part_probe_types; ++ int (*chip_fixup)(struct mtd_info *mtd); + void (*set_parts)(uint64_t size, + struct platform_nand_chip *chip); + void *priv; +--- a/drivers/mtd/nand/plat_nand.c ++++ b/drivers/mtd/nand/plat_nand.c +@@ -80,7 +80,18 @@ static int __devinit plat_nand_probe(str + } + + /* Scan to find existance of the device */ +- if (nand_scan(&data->mtd, 1)) { ++ if (nand_scan_ident(&data->mtd, 1)) { ++ res = -ENXIO; ++ goto out; ++ } ++ ++ if (pdata->chip.chip_fixup) { ++ res = pdata->chip.chip_fixup(&data->mtd); ++ if (res) ++ goto out; ++ } ++ ++ if (nand_scan_tail(&data->mtd)) { + res = -ENXIO; + goto out; + } diff --git a/target/linux/generic-2.6/patches-2.6.32/081-mtd_myloader_partition_parser.patch b/target/linux/generic-2.6/patches-2.6.32/081-mtd_myloader_partition_parser.patch new file mode 100644 index 000000000..61b822ee8 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/081-mtd_myloader_partition_parser.patch @@ -0,0 +1,35 @@ +--- a/drivers/mtd/Kconfig ++++ b/drivers/mtd/Kconfig +@@ -181,6 +181,22 @@ config MTD_AR7_PARTS + ---help--- + TI AR7 partitioning support + ++config MTD_MYLOADER_PARTS ++ tristate "MyLoader partition parsing" ++ depends on MTD_PARTITIONS && (ADM5120 || ATHEROS_AR231X || ATHEROS_AR71XX) ++ ---help--- ++ MyLoader is a bootloader which allows the user to define partitions ++ in flash devices, by putting a table in the second erase block ++ on the device, similar to a partition table. This table gives the ++ offsets and lengths of the user defined partitions. ++ ++ If you need code which can detect and parse these tables, and ++ register MTD 'partitions' corresponding to each image detected, ++ enable this option. ++ ++ You will still need the parsing functions to be called by the driver ++ for your particular device. It won't happen automatically. ++ + comment "User Modules And Translation Layers" + + config MTD_CHAR +--- a/drivers/mtd/Makefile ++++ b/drivers/mtd/Makefile +@@ -13,6 +13,7 @@ obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdli + obj-$(CONFIG_MTD_AFS_PARTS) += afs.o + obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o + obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o ++obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o + + # 'Users' - code which presents functionality to userspace. + obj-$(CONFIG_MTD_CHAR) += mtdchar.o diff --git a/target/linux/generic-2.6/patches-2.6.32/082-mtd_info_move_forward_decl.patch b/target/linux/generic-2.6/patches-2.6.32/082-mtd_info_move_forward_decl.patch new file mode 100644 index 000000000..13f0a217d --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/082-mtd_info_move_forward_decl.patch @@ -0,0 +1,18 @@ +--- a/include/linux/mtd/partitions.h ++++ b/include/linux/mtd/partitions.h +@@ -33,6 +33,7 @@ + * Note: writeable partitions require their size and offset be + * erasesize aligned (e.g. use MTDPART_OFS_NEXTBLK). + */ ++struct mtd_info; + + struct mtd_partition; + struct mtd_partition { +@@ -49,7 +50,6 @@ struct mtd_partition { + #define MTDPART_SIZ_FULL (0) + + +-struct mtd_info; + + int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int); + int del_mtd_partitions(struct mtd_info *); diff --git a/target/linux/generic-2.6/patches-2.6.32/090-mtd_fix_nand_correct_data_return_code.patch b/target/linux/generic-2.6/patches-2.6.32/090-mtd_fix_nand_correct_data_return_code.patch new file mode 100644 index 000000000..97148d07d --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/090-mtd_fix_nand_correct_data_return_code.patch @@ -0,0 +1,12 @@ +--- a/drivers/mtd/nand/nand_ecc.c ++++ b/drivers/mtd/nand/nand_ecc.c +@@ -492,8 +492,7 @@ int __nand_correct_data(unsigned char *b + if ((bitsperbyte[b0] + bitsperbyte[b1] + bitsperbyte[b2]) == 1) + return 1; /* error in ecc data; no action needed */ + +- printk(KERN_ERR "uncorrectable error : "); +- return -1; ++ return -EBADMSG; + } + EXPORT_SYMBOL(__nand_correct_data); + diff --git a/target/linux/generic-2.6/patches-2.6.32/100-netfilter_layer7_2.21.patch b/target/linux/generic-2.6/patches-2.6.32/100-netfilter_layer7_2.21.patch new file mode 100644 index 000000000..be7d97fe1 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/100-netfilter_layer7_2.21.patch @@ -0,0 +1,2132 @@ +--- /dev/null ++++ b/include/linux/netfilter/xt_layer7.h +@@ -0,0 +1,13 @@ ++#ifndef _XT_LAYER7_H ++#define _XT_LAYER7_H ++ ++#define MAX_PATTERN_LEN 8192 ++#define MAX_PROTOCOL_LEN 256 ++ ++struct xt_layer7_info { ++ char protocol[MAX_PROTOCOL_LEN]; ++ char pattern[MAX_PATTERN_LEN]; ++ u_int8_t invert; ++}; ++ ++#endif /* _XT_LAYER7_H */ +--- a/include/net/netfilter/nf_conntrack.h ++++ b/include/net/netfilter/nf_conntrack.h +@@ -116,6 +116,22 @@ struct nf_conn { + u_int32_t secmark; + #endif + ++#if defined(CONFIG_NETFILTER_XT_MATCH_LAYER7) || \ ++ defined(CONFIG_NETFILTER_XT_MATCH_LAYER7_MODULE) ++ struct { ++ /* ++ * e.g. "http". NULL before decision. "unknown" after decision ++ * if no match. ++ */ ++ char *app_proto; ++ /* ++ * application layer data so far. NULL after match decision. ++ */ ++ char *app_data; ++ unsigned int app_data_len; ++ } layer7; ++#endif ++ + /* Storage reserved for other modules: */ + union nf_conntrack_proto proto; + +--- a/net/netfilter/Kconfig ++++ b/net/netfilter/Kconfig +@@ -858,6 +858,27 @@ config NETFILTER_XT_MATCH_STATE + + To compile it as a module, choose M here. If unsure, say N. + ++config NETFILTER_XT_MATCH_LAYER7 ++ tristate '"layer7" match support' ++ depends on NETFILTER_XTABLES ++ depends on EXPERIMENTAL && (IP_NF_CONNTRACK || NF_CONNTRACK) ++ depends on NF_CT_ACCT ++ help ++ Say Y if you want to be able to classify connections (and their ++ packets) based on regular expression matching of their application ++ layer data. This is one way to classify applications such as ++ peer-to-peer filesharing systems that do not always use the same ++ port. ++ ++ To compile it as a module, choose M here. If unsure, say N. ++ ++config NETFILTER_XT_MATCH_LAYER7_DEBUG ++ bool 'Layer 7 debugging output' ++ depends on NETFILTER_XT_MATCH_LAYER7 ++ help ++ Say Y to get lots of debugging output. ++ ++ + config NETFILTER_XT_MATCH_STATISTIC + tristate '"statistic" match support' + depends on NETFILTER_ADVANCED +--- a/net/netfilter/Makefile ++++ b/net/netfilter/Makefile +@@ -89,6 +89,7 @@ obj-$(CONFIG_NETFILTER_XT_MATCH_RECENT) + obj-$(CONFIG_NETFILTER_XT_MATCH_SCTP) += xt_sctp.o + obj-$(CONFIG_NETFILTER_XT_MATCH_SOCKET) += xt_socket.o + obj-$(CONFIG_NETFILTER_XT_MATCH_STATE) += xt_state.o ++obj-$(CONFIG_NETFILTER_XT_MATCH_LAYER7) += xt_layer7.o + obj-$(CONFIG_NETFILTER_XT_MATCH_STATISTIC) += xt_statistic.o + obj-$(CONFIG_NETFILTER_XT_MATCH_STRING) += xt_string.o + obj-$(CONFIG_NETFILTER_XT_MATCH_TCPMSS) += xt_tcpmss.o +--- a/net/netfilter/nf_conntrack_core.c ++++ b/net/netfilter/nf_conntrack_core.c +@@ -201,6 +201,14 @@ destroy_conntrack(struct nf_conntrack *n + * too. */ + nf_ct_remove_expectations(ct); + ++ #if defined(CONFIG_NETFILTER_XT_MATCH_LAYER7) || defined(CONFIG_NETFILTER_XT_MATCH_LAYER7_MODULE) ++ if(ct->layer7.app_proto) ++ kfree(ct->layer7.app_proto); ++ if(ct->layer7.app_data) ++ kfree(ct->layer7.app_data); ++ #endif ++ ++ + /* We overload first tuple to link into unconfirmed list. */ + if (!nf_ct_is_confirmed(ct)) { + BUG_ON(hlist_nulls_unhashed(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode)); +--- a/net/netfilter/nf_conntrack_standalone.c ++++ b/net/netfilter/nf_conntrack_standalone.c +@@ -171,6 +171,12 @@ static int ct_seq_show(struct seq_file * + goto release; + #endif + ++#if defined(CONFIG_NETFILTER_XT_MATCH_LAYER7) || defined(CONFIG_NETFILTER_XT_MATCH_LAYER7_MODULE) ++ if(ct->layer7.app_proto && ++ seq_printf(s, "l7proto=%s ", ct->layer7.app_proto)) ++ return -ENOSPC; ++#endif ++ + if (seq_printf(s, "use=%u\n", atomic_read(&ct->ct_general.use))) + goto release; + +--- /dev/null ++++ b/net/netfilter/regexp/regexp.c +@@ -0,0 +1,1197 @@ ++/* ++ * regcomp and regexec -- regsub and regerror are elsewhere ++ * @(#)regexp.c 1.3 of 18 April 87 ++ * ++ * Copyright (c) 1986 by University of Toronto. ++ * Written by Henry Spencer. Not derived from licensed software. ++ * ++ * Permission is granted to anyone to use this software for any ++ * purpose on any computer system, and to redistribute it freely, ++ * subject to the following restrictions: ++ * ++ * 1. The author is not responsible for the consequences of use of ++ * this software, no matter how awful, even if they arise ++ * from defects in it. ++ * ++ * 2. The origin of this software must not be misrepresented, either ++ * by explicit claim or by omission. ++ * ++ * 3. Altered versions must be plainly marked as such, and must not ++ * be misrepresented as being the original software. ++ * ++ * Beware that some of this code is subtly aware of the way operator ++ * precedence is structured in regular expressions. Serious changes in ++ * regular-expression syntax might require a total rethink. ++ * ++ * This code was modified by Ethan Sommer to work within the kernel ++ * (it now uses kmalloc etc..) ++ * ++ * Modified slightly by Matthew Strait to use more modern C. ++ */ ++ ++#include "regexp.h" ++#include "regmagic.h" ++ ++/* added by ethan and matt. Lets it work in both kernel and user space. ++(So iptables can use it, for instance.) Yea, it goes both ways... */ ++#if __KERNEL__ ++ #define malloc(foo) kmalloc(foo,GFP_ATOMIC) ++#else ++ #define printk(format,args...) printf(format,##args) ++#endif ++ ++void regerror(char * s) ++{ ++ printk("<3>Regexp: %s\n", s); ++ /* NOTREACHED */ ++} ++ ++/* ++ * The "internal use only" fields in regexp.h are present to pass info from ++ * compile to execute that permits the execute phase to run lots faster on ++ * simple cases. They are: ++ * ++ * regstart char that must begin a match; '\0' if none obvious ++ * reganch is the match anchored (at beginning-of-line only)? ++ * regmust string (pointer into program) that match must include, or NULL ++ * regmlen length of regmust string ++ * ++ * Regstart and reganch permit very fast decisions on suitable starting points ++ * for a match, cutting down the work a lot. Regmust permits fast rejection ++ * of lines that cannot possibly match. The regmust tests are costly enough ++ * that regcomp() supplies a regmust only if the r.e. contains something ++ * potentially expensive (at present, the only such thing detected is * or + ++ * at the start of the r.e., which can involve a lot of backup). Regmlen is ++ * supplied because the test in regexec() needs it and regcomp() is computing ++ * it anyway. ++ */ ++ ++/* ++ * Structure for regexp "program". This is essentially a linear encoding ++ * of a nondeterministic finite-state machine (aka syntax charts or ++ * "railroad normal form" in parsing technology). Each node is an opcode ++ * plus a "next" pointer, possibly plus an operand. "Next" pointers of ++ * all nodes except BRANCH implement concatenation; a "next" pointer with ++ * a BRANCH on both ends of it is connecting two alternatives. (Here we ++ * have one of the subtle syntax dependencies: an individual BRANCH (as ++ * opposed to a collection of them) is never concatenated with anything ++ * because of operator precedence.) The operand of some types of node is ++ * a literal string; for others, it is a node leading into a sub-FSM. In ++ * particular, the operand of a BRANCH node is the first node of the branch. ++ * (NB this is *not* a tree structure: the tail of the branch connects ++ * to the thing following the set of BRANCHes.) The opcodes are: ++ */ ++ ++/* definition number opnd? meaning */ ++#define END 0 /* no End of program. */ ++#define BOL 1 /* no Match "" at beginning of line. */ ++#define EOL 2 /* no Match "" at end of line. */ ++#define ANY 3 /* no Match any one character. */ ++#define ANYOF 4 /* str Match any character in this string. */ ++#define ANYBUT 5 /* str Match any character not in this string. */ ++#define BRANCH 6 /* node Match this alternative, or the next... */ ++#define BACK 7 /* no Match "", "next" ptr points backward. */ ++#define EXACTLY 8 /* str Match this string. */ ++#define NOTHING 9 /* no Match empty string. */ ++#define STAR 10 /* node Match this (simple) thing 0 or more times. */ ++#define PLUS 11 /* node Match this (simple) thing 1 or more times. */ ++#define OPEN 20 /* no Mark this point in input as start of #n. */ ++ /* OPEN+1 is number 1, etc. */ ++#define CLOSE 30 /* no Analogous to OPEN. */ ++ ++/* ++ * Opcode notes: ++ * ++ * BRANCH The set of branches constituting a single choice are hooked ++ * together with their "next" pointers, since precedence prevents ++ * anything being concatenated to any individual branch. The ++ * "next" pointer of the last BRANCH in a choice points to the ++ * thing following the whole choice. This is also where the ++ * final "next" pointer of each individual branch points; each ++ * branch starts with the operand node of a BRANCH node. ++ * ++ * BACK Normal "next" pointers all implicitly point forward; BACK ++ * exists to make loop structures possible. ++ * ++ * STAR,PLUS '?', and complex '*' and '+', are implemented as circular ++ * BRANCH structures using BACK. Simple cases (one character ++ * per match) are implemented with STAR and PLUS for speed ++ * and to minimize recursive plunges. ++ * ++ * OPEN,CLOSE ...are numbered at compile time. ++ */ ++ ++/* ++ * A node is one char of opcode followed by two chars of "next" pointer. ++ * "Next" pointers are stored as two 8-bit pieces, high order first. The ++ * value is a positive offset from the opcode of the node containing it. ++ * An operand, if any, simply follows the node. (Note that much of the ++ * code generation knows about this implicit relationship.) ++ * ++ * Using two bytes for the "next" pointer is vast overkill for most things, ++ * but allows patterns to get big without disasters. ++ */ ++#define OP(p) (*(p)) ++#define NEXT(p) (((*((p)+1)&0377)<<8) + (*((p)+2)&0377)) ++#define OPERAND(p) ((p) + 3) ++ ++/* ++ * See regmagic.h for one further detail of program structure. ++ */ ++ ++ ++/* ++ * Utility definitions. ++ */ ++#ifndef CHARBITS ++#define UCHARAT(p) ((int)*(unsigned char *)(p)) ++#else ++#define UCHARAT(p) ((int)*(p)&CHARBITS) ++#endif ++ ++#define FAIL(m) { regerror(m); return(NULL); } ++#define ISMULT(c) ((c) == '*' || (c) == '+' || (c) == '?') ++#define META "^$.[()|?+*\\" ++ ++/* ++ * Flags to be passed up and down. ++ */ ++#define HASWIDTH 01 /* Known never to match null string. */ ++#define SIMPLE 02 /* Simple enough to be STAR/PLUS operand. */ ++#define SPSTART 04 /* Starts with * or +. */ ++#define WORST 0 /* Worst case. */ ++ ++/* ++ * Global work variables for regcomp(). ++ */ ++struct match_globals { ++char *reginput; /* String-input pointer. */ ++char *regbol; /* Beginning of input, for ^ check. */ ++char **regstartp; /* Pointer to startp array. */ ++char **regendp; /* Ditto for endp. */ ++char *regparse; /* Input-scan pointer. */ ++int regnpar; /* () count. */ ++char regdummy; ++char *regcode; /* Code-emit pointer; ®dummy = don't. */ ++long regsize; /* Code size. */ ++}; ++ ++/* ++ * Forward declarations for regcomp()'s friends. ++ */ ++#ifndef STATIC ++#define STATIC static ++#endif ++STATIC char *reg(struct match_globals *g, int paren,int *flagp); ++STATIC char *regbranch(struct match_globals *g, int *flagp); ++STATIC char *regpiece(struct match_globals *g, int *flagp); ++STATIC char *regatom(struct match_globals *g, int *flagp); ++STATIC char *regnode(struct match_globals *g, char op); ++STATIC char *regnext(struct match_globals *g, char *p); ++STATIC void regc(struct match_globals *g, char b); ++STATIC void reginsert(struct match_globals *g, char op, char *opnd); ++STATIC void regtail(struct match_globals *g, char *p, char *val); ++STATIC void regoptail(struct match_globals *g, char *p, char *val); ++ ++ ++__kernel_size_t my_strcspn(const char *s1,const char *s2) ++{ ++ char *scan1; ++ char *scan2; ++ int count; ++ ++ count = 0; ++ for (scan1 = (char *)s1; *scan1 != '\0'; scan1++) { ++ for (scan2 = (char *)s2; *scan2 != '\0';) /* ++ moved down. */ ++ if (*scan1 == *scan2++) ++ return(count); ++ count++; ++ } ++ return(count); ++} ++ ++/* ++ - regcomp - compile a regular expression into internal code ++ * ++ * We can't allocate space until we know how big the compiled form will be, ++ * but we can't compile it (and thus know how big it is) until we've got a ++ * place to put the code. So we cheat: we compile it twice, once with code ++ * generation turned off and size counting turned on, and once "for real". ++ * This also means that we don't allocate space until we are sure that the ++ * thing really will compile successfully, and we never have to move the ++ * code and thus invalidate pointers into it. (Note that it has to be in ++ * one piece because free() must be able to free it all.) ++ * ++ * Beware that the optimization-preparation code in here knows about some ++ * of the structure of the compiled regexp. ++ */ ++regexp * ++regcomp(char *exp,int *patternsize) ++{ ++ register regexp *r; ++ register char *scan; ++ register char *longest; ++ register int len; ++ int flags; ++ struct match_globals g; ++ ++ /* commented out by ethan ++ extern char *malloc(); ++ */ ++ ++ if (exp == NULL) ++ FAIL("NULL argument"); ++ ++ /* First pass: determine size, legality. */ ++ g.regparse = exp; ++ g.regnpar = 1; ++ g.regsize = 0L; ++ g.regcode = &g.regdummy; ++ regc(&g, MAGIC); ++ if (reg(&g, 0, &flags) == NULL) ++ return(NULL); ++ ++ /* Small enough for pointer-storage convention? */ ++ if (g.regsize >= 32767L) /* Probably could be 65535L. */ ++ FAIL("regexp too big"); ++ ++ /* Allocate space. */ ++ *patternsize=sizeof(regexp) + (unsigned)g.regsize; ++ r = (regexp *)malloc(sizeof(regexp) + (unsigned)g.regsize); ++ if (r == NULL) ++ FAIL("out of space"); ++ ++ /* Second pass: emit code. */ ++ g.regparse = exp; ++ g.regnpar = 1; ++ g.regcode = r->program; ++ regc(&g, MAGIC); ++ if (reg(&g, 0, &flags) == NULL) ++ return(NULL); ++ ++ /* Dig out information for optimizations. */ ++ r->regstart = '\0'; /* Worst-case defaults. */ ++ r->reganch = 0; ++ r->regmust = NULL; ++ r->regmlen = 0; ++ scan = r->program+1; /* First BRANCH. */ ++ if (OP(regnext(&g, scan)) == END) { /* Only one top-level choice. */ ++ scan = OPERAND(scan); ++ ++ /* Starting-point info. */ ++ if (OP(scan) == EXACTLY) ++ r->regstart = *OPERAND(scan); ++ else if (OP(scan) == BOL) ++ r->reganch++; ++ ++ /* ++ * If there's something expensive in the r.e., find the ++ * longest literal string that must appear and make it the ++ * regmust. Resolve ties in favor of later strings, since ++ * the regstart check works with the beginning of the r.e. ++ * and avoiding duplication strengthens checking. Not a ++ * strong reason, but sufficient in the absence of others. ++ */ ++ if (flags&SPSTART) { ++ longest = NULL; ++ len = 0; ++ for (; scan != NULL; scan = regnext(&g, scan)) ++ if (OP(scan) == EXACTLY && strlen(OPERAND(scan)) >= len) { ++ longest = OPERAND(scan); ++ len = strlen(OPERAND(scan)); ++ } ++ r->regmust = longest; ++ r->regmlen = len; ++ } ++ } ++ ++ return(r); ++} ++ ++/* ++ - reg - regular expression, i.e. main body or parenthesized thing ++ * ++ * Caller must absorb opening parenthesis. ++ * ++ * Combining parenthesis handling with the base level of regular expression ++ * is a trifle forced, but the need to tie the tails of the branches to what ++ * follows makes it hard to avoid. ++ */ ++static char * ++reg(struct match_globals *g, int paren, int *flagp /* Parenthesized? */ ) ++{ ++ register char *ret; ++ register char *br; ++ register char *ender; ++ register int parno = 0; /* 0 makes gcc happy */ ++ int flags; ++ ++ *flagp = HASWIDTH; /* Tentatively. */ ++ ++ /* Make an OPEN node, if parenthesized. */ ++ if (paren) { ++ if (g->regnpar >= NSUBEXP) ++ FAIL("too many ()"); ++ parno = g->regnpar; ++ g->regnpar++; ++ ret = regnode(g, OPEN+parno); ++ } else ++ ret = NULL; ++ ++ /* Pick up the branches, linking them together. */ ++ br = regbranch(g, &flags); ++ if (br == NULL) ++ return(NULL); ++ if (ret != NULL) ++ regtail(g, ret, br); /* OPEN -> first. */ ++ else ++ ret = br; ++ if (!(flags&HASWIDTH)) ++ *flagp &= ~HASWIDTH; ++ *flagp |= flags&SPSTART; ++ while (*g->regparse == '|') { ++ g->regparse++; ++ br = regbranch(g, &flags); ++ if (br == NULL) ++ return(NULL); ++ regtail(g, ret, br); /* BRANCH -> BRANCH. */ ++ if (!(flags&HASWIDTH)) ++ *flagp &= ~HASWIDTH; ++ *flagp |= flags&SPSTART; ++ } ++ ++ /* Make a closing node, and hook it on the end. */ ++ ender = regnode(g, (paren) ? CLOSE+parno : END); ++ regtail(g, ret, ender); ++ ++ /* Hook the tails of the branches to the closing node. */ ++ for (br = ret; br != NULL; br = regnext(g, br)) ++ regoptail(g, br, ender); ++ ++ /* Check for proper termination. */ ++ if (paren && *g->regparse++ != ')') { ++ FAIL("unmatched ()"); ++ } else if (!paren && *g->regparse != '\0') { ++ if (*g->regparse == ')') { ++ FAIL("unmatched ()"); ++ } else ++ FAIL("junk on end"); /* "Can't happen". */ ++ /* NOTREACHED */ ++ } ++ ++ return(ret); ++} ++ ++/* ++ - regbranch - one alternative of an | operator ++ * ++ * Implements the concatenation operator. ++ */ ++static char * ++regbranch(struct match_globals *g, int *flagp) ++{ ++ register char *ret; ++ register char *chain; ++ register char *latest; ++ int flags; ++ ++ *flagp = WORST; /* Tentatively. */ ++ ++ ret = regnode(g, BRANCH); ++ chain = NULL; ++ while (*g->regparse != '\0' && *g->regparse != '|' && *g->regparse != ')') { ++ latest = regpiece(g, &flags); ++ if (latest == NULL) ++ return(NULL); ++ *flagp |= flags&HASWIDTH; ++ if (chain == NULL) /* First piece. */ ++ *flagp |= flags&SPSTART; ++ else ++ regtail(g, chain, latest); ++ chain = latest; ++ } ++ if (chain == NULL) /* Loop ran zero times. */ ++ (void) regnode(g, NOTHING); ++ ++ return(ret); ++} ++ ++/* ++ - regpiece - something followed by possible [*+?] ++ * ++ * Note that the branching code sequences used for ? and the general cases ++ * of * and + are somewhat optimized: they use the same NOTHING node as ++ * both the endmarker for their branch list and the body of the last branch. ++ * It might seem that this node could be dispensed with entirely, but the ++ * endmarker role is not redundant. ++ */ ++static char * ++regpiece(struct match_globals *g, int *flagp) ++{ ++ register char *ret; ++ register char op; ++ register char *next; ++ int flags; ++ ++ ret = regatom(g, &flags); ++ if (ret == NULL) ++ return(NULL); ++ ++ op = *g->regparse; ++ if (!ISMULT(op)) { ++ *flagp = flags; ++ return(ret); ++ } ++ ++ if (!(flags&HASWIDTH) && op != '?') ++ FAIL("*+ operand could be empty"); ++ *flagp = (op != '+') ? (WORST|SPSTART) : (WORST|HASWIDTH); ++ ++ if (op == '*' && (flags&SIMPLE)) ++ reginsert(g, STAR, ret); ++ else if (op == '*') { ++ /* Emit x* as (x&|), where & means "self". */ ++ reginsert(g, BRANCH, ret); /* Either x */ ++ regoptail(g, ret, regnode(g, BACK)); /* and loop */ ++ regoptail(g, ret, ret); /* back */ ++ regtail(g, ret, regnode(g, BRANCH)); /* or */ ++ regtail(g, ret, regnode(g, NOTHING)); /* null. */ ++ } else if (op == '+' && (flags&SIMPLE)) ++ reginsert(g, PLUS, ret); ++ else if (op == '+') { ++ /* Emit x+ as x(&|), where & means "self". */ ++ next = regnode(g, BRANCH); /* Either */ ++ regtail(g, ret, next); ++ regtail(g, regnode(g, BACK), ret); /* loop back */ ++ regtail(g, next, regnode(g, BRANCH)); /* or */ ++ regtail(g, ret, regnode(g, NOTHING)); /* null. */ ++ } else if (op == '?') { ++ /* Emit x? as (x|) */ ++ reginsert(g, BRANCH, ret); /* Either x */ ++ regtail(g, ret, regnode(g, BRANCH)); /* or */ ++ next = regnode(g, NOTHING); /* null. */ ++ regtail(g, ret, next); ++ regoptail(g, ret, next); ++ } ++ g->regparse++; ++ if (ISMULT(*g->regparse)) ++ FAIL("nested *?+"); ++ ++ return(ret); ++} ++ ++/* ++ - regatom - the lowest level ++ * ++ * Optimization: gobbles an entire sequence of ordinary characters so that ++ * it can turn them into a single node, which is smaller to store and ++ * faster to run. Backslashed characters are exceptions, each becoming a ++ * separate node; the code is simpler that way and it's not worth fixing. ++ */ ++static char * ++regatom(struct match_globals *g, int *flagp) ++{ ++ register char *ret; ++ int flags; ++ ++ *flagp = WORST; /* Tentatively. */ ++ ++ switch (*g->regparse++) { ++ case '^': ++ ret = regnode(g, BOL); ++ break; ++ case '$': ++ ret = regnode(g, EOL); ++ break; ++ case '.': ++ ret = regnode(g, ANY); ++ *flagp |= HASWIDTH|SIMPLE; ++ break; ++ case '[': { ++ register int class; ++ register int classend; ++ ++ if (*g->regparse == '^') { /* Complement of range. */ ++ ret = regnode(g, ANYBUT); ++ g->regparse++; ++ } else ++ ret = regnode(g, ANYOF); ++ if (*g->regparse == ']' || *g->regparse == '-') ++ regc(g, *g->regparse++); ++ while (*g->regparse != '\0' && *g->regparse != ']') { ++ if (*g->regparse == '-') { ++ g->regparse++; ++ if (*g->regparse == ']' || *g->regparse == '\0') ++ regc(g, '-'); ++ else { ++ class = UCHARAT(g->regparse-2)+1; ++ classend = UCHARAT(g->regparse); ++ if (class > classend+1) ++ FAIL("invalid [] range"); ++ for (; class <= classend; class++) ++ regc(g, class); ++ g->regparse++; ++ } ++ } else ++ regc(g, *g->regparse++); ++ } ++ regc(g, '\0'); ++ if (*g->regparse != ']') ++ FAIL("unmatched []"); ++ g->regparse++; ++ *flagp |= HASWIDTH|SIMPLE; ++ } ++ break; ++ case '(': ++ ret = reg(g, 1, &flags); ++ if (ret == NULL) ++ return(NULL); ++ *flagp |= flags&(HASWIDTH|SPSTART); ++ break; ++ case '\0': ++ case '|': ++ case ')': ++ FAIL("internal urp"); /* Supposed to be caught earlier. */ ++ break; ++ case '?': ++ case '+': ++ case '*': ++ FAIL("?+* follows nothing"); ++ break; ++ case '\\': ++ if (*g->regparse == '\0') ++ FAIL("trailing \\"); ++ ret = regnode(g, EXACTLY); ++ regc(g, *g->regparse++); ++ regc(g, '\0'); ++ *flagp |= HASWIDTH|SIMPLE; ++ break; ++ default: { ++ register int len; ++ register char ender; ++ ++ g->regparse--; ++ len = my_strcspn((const char *)g->regparse, (const char *)META); ++ if (len <= 0) ++ FAIL("internal disaster"); ++ ender = *(g->regparse+len); ++ if (len > 1 && ISMULT(ender)) ++ len--; /* Back off clear of ?+* operand. */ ++ *flagp |= HASWIDTH; ++ if (len == 1) ++ *flagp |= SIMPLE; ++ ret = regnode(g, EXACTLY); ++ while (len > 0) { ++ regc(g, *g->regparse++); ++ len--; ++ } ++ regc(g, '\0'); ++ } ++ break; ++ } ++ ++ return(ret); ++} ++ ++/* ++ - regnode - emit a node ++ */ ++static char * /* Location. */ ++regnode(struct match_globals *g, char op) ++{ ++ register char *ret; ++ register char *ptr; ++ ++ ret = g->regcode; ++ if (ret == &g->regdummy) { ++ g->regsize += 3; ++ return(ret); ++ } ++ ++ ptr = ret; ++ *ptr++ = op; ++ *ptr++ = '\0'; /* Null "next" pointer. */ ++ *ptr++ = '\0'; ++ g->regcode = ptr; ++ ++ return(ret); ++} ++ ++/* ++ - regc - emit (if appropriate) a byte of code ++ */ ++static void ++regc(struct match_globals *g, char b) ++{ ++ if (g->regcode != &g->regdummy) ++ *g->regcode++ = b; ++ else ++ g->regsize++; ++} ++ ++/* ++ - reginsert - insert an operator in front of already-emitted operand ++ * ++ * Means relocating the operand. ++ */ ++static void ++reginsert(struct match_globals *g, char op, char* opnd) ++{ ++ register char *src; ++ register char *dst; ++ register char *place; ++ ++ if (g->regcode == &g->regdummy) { ++ g->regsize += 3; ++ return; ++ } ++ ++ src = g->regcode; ++ g->regcode += 3; ++ dst = g->regcode; ++ while (src > opnd) ++ *--dst = *--src; ++ ++ place = opnd; /* Op node, where operand used to be. */ ++ *place++ = op; ++ *place++ = '\0'; ++ *place++ = '\0'; ++} ++ ++/* ++ - regtail - set the next-pointer at the end of a node chain ++ */ ++static void ++regtail(struct match_globals *g, char *p, char *val) ++{ ++ register char *scan; ++ register char *temp; ++ register int offset; ++ ++ if (p == &g->regdummy) ++ return; ++ ++ /* Find last node. */ ++ scan = p; ++ for (;;) { ++ temp = regnext(g, scan); ++ if (temp == NULL) ++ break; ++ scan = temp; ++ } ++ ++ if (OP(scan) == BACK) ++ offset = scan - val; ++ else ++ offset = val - scan; ++ *(scan+1) = (offset>>8)&0377; ++ *(scan+2) = offset&0377; ++} ++ ++/* ++ - regoptail - regtail on operand of first argument; nop if operandless ++ */ ++static void ++regoptail(struct match_globals *g, char *p, char *val) ++{ ++ /* "Operandless" and "op != BRANCH" are synonymous in practice. */ ++ if (p == NULL || p == &g->regdummy || OP(p) != BRANCH) ++ return; ++ regtail(g, OPERAND(p), val); ++} ++ ++/* ++ * regexec and friends ++ */ ++ ++ ++/* ++ * Forwards. ++ */ ++STATIC int regtry(struct match_globals *g, regexp *prog, char *string); ++STATIC int regmatch(struct match_globals *g, char *prog); ++STATIC int regrepeat(struct match_globals *g, char *p); ++ ++#ifdef DEBUG ++int regnarrate = 0; ++void regdump(); ++STATIC char *regprop(char *op); ++#endif ++ ++/* ++ - regexec - match a regexp against a string ++ */ ++int ++regexec(regexp *prog, char *string) ++{ ++ register char *s; ++ struct match_globals g; ++ ++ /* Be paranoid... */ ++ if (prog == NULL || string == NULL) { ++ printk("<3>Regexp: NULL parameter\n"); ++ return(0); ++ } ++ ++ /* Check validity of program. */ ++ if (UCHARAT(prog->program) != MAGIC) { ++ printk("<3>Regexp: corrupted program\n"); ++ return(0); ++ } ++ ++ /* If there is a "must appear" string, look for it. */ ++ if (prog->regmust != NULL) { ++ s = string; ++ while ((s = strchr(s, prog->regmust[0])) != NULL) { ++ if (strncmp(s, prog->regmust, prog->regmlen) == 0) ++ break; /* Found it. */ ++ s++; ++ } ++ if (s == NULL) /* Not present. */ ++ return(0); ++ } ++ ++ /* Mark beginning of line for ^ . */ ++ g.regbol = string; ++ ++ /* Simplest case: anchored match need be tried only once. */ ++ if (prog->reganch) ++ return(regtry(&g, prog, string)); ++ ++ /* Messy cases: unanchored match. */ ++ s = string; ++ if (prog->regstart != '\0') ++ /* We know what char it must start with. */ ++ while ((s = strchr(s, prog->regstart)) != NULL) { ++ if (regtry(&g, prog, s)) ++ return(1); ++ s++; ++ } ++ else ++ /* We don't -- general case. */ ++ do { ++ if (regtry(&g, prog, s)) ++ return(1); ++ } while (*s++ != '\0'); ++ ++ /* Failure. */ ++ return(0); ++} ++ ++/* ++ - regtry - try match at specific point ++ */ ++static int /* 0 failure, 1 success */ ++regtry(struct match_globals *g, regexp *prog, char *string) ++{ ++ register int i; ++ register char **sp; ++ register char **ep; ++ ++ g->reginput = string; ++ g->regstartp = prog->startp; ++ g->regendp = prog->endp; ++ ++ sp = prog->startp; ++ ep = prog->endp; ++ for (i = NSUBEXP; i > 0; i--) { ++ *sp++ = NULL; ++ *ep++ = NULL; ++ } ++ if (regmatch(g, prog->program + 1)) { ++ prog->startp[0] = string; ++ prog->endp[0] = g->reginput; ++ return(1); ++ } else ++ return(0); ++} ++ ++/* ++ - regmatch - main matching routine ++ * ++ * Conceptually the strategy is simple: check to see whether the current ++ * node matches, call self recursively to see whether the rest matches, ++ * and then act accordingly. In practice we make some effort to avoid ++ * recursion, in particular by going through "ordinary" nodes (that don't ++ * need to know whether the rest of the match failed) by a loop instead of ++ * by recursion. ++ */ ++static int /* 0 failure, 1 success */ ++regmatch(struct match_globals *g, char *prog) ++{ ++ register char *scan = prog; /* Current node. */ ++ char *next; /* Next node. */ ++ ++#ifdef DEBUG ++ if (scan != NULL && regnarrate) ++ fprintf(stderr, "%s(\n", regprop(scan)); ++#endif ++ while (scan != NULL) { ++#ifdef DEBUG ++ if (regnarrate) ++ fprintf(stderr, "%s...\n", regprop(scan)); ++#endif ++ next = regnext(g, scan); ++ ++ switch (OP(scan)) { ++ case BOL: ++ if (g->reginput != g->regbol) ++ return(0); ++ break; ++ case EOL: ++ if (*g->reginput != '\0') ++ return(0); ++ break; ++ case ANY: ++ if (*g->reginput == '\0') ++ return(0); ++ g->reginput++; ++ break; ++ case EXACTLY: { ++ register int len; ++ register char *opnd; ++ ++ opnd = OPERAND(scan); ++ /* Inline the first character, for speed. */ ++ if (*opnd != *g->reginput) ++ return(0); ++ len = strlen(opnd); ++ if (len > 1 && strncmp(opnd, g->reginput, len) != 0) ++ return(0); ++ g->reginput += len; ++ } ++ break; ++ case ANYOF: ++ if (*g->reginput == '\0' || strchr(OPERAND(scan), *g->reginput) == NULL) ++ return(0); ++ g->reginput++; ++ break; ++ case ANYBUT: ++ if (*g->reginput == '\0' || strchr(OPERAND(scan), *g->reginput) != NULL) ++ return(0); ++ g->reginput++; ++ break; ++ case NOTHING: ++ case BACK: ++ break; ++ case OPEN+1: ++ case OPEN+2: ++ case OPEN+3: ++ case OPEN+4: ++ case OPEN+5: ++ case OPEN+6: ++ case OPEN+7: ++ case OPEN+8: ++ case OPEN+9: { ++ register int no; ++ register char *save; ++ ++ no = OP(scan) - OPEN; ++ save = g->reginput; ++ ++ if (regmatch(g, next)) { ++ /* ++ * Don't set startp if some later ++ * invocation of the same parentheses ++ * already has. ++ */ ++ if (g->regstartp[no] == NULL) ++ g->regstartp[no] = save; ++ return(1); ++ } else ++ return(0); ++ } ++ break; ++ case CLOSE+1: ++ case CLOSE+2: ++ case CLOSE+3: ++ case CLOSE+4: ++ case CLOSE+5: ++ case CLOSE+6: ++ case CLOSE+7: ++ case CLOSE+8: ++ case CLOSE+9: ++ { ++ register int no; ++ register char *save; ++ ++ no = OP(scan) - CLOSE; ++ save = g->reginput; ++ ++ if (regmatch(g, next)) { ++ /* ++ * Don't set endp if some later ++ * invocation of the same parentheses ++ * already has. ++ */ ++ if (g->regendp[no] == NULL) ++ g->regendp[no] = save; ++ return(1); ++ } else ++ return(0); ++ } ++ break; ++ case BRANCH: { ++ register char *save; ++ ++ if (OP(next) != BRANCH) /* No choice. */ ++ next = OPERAND(scan); /* Avoid recursion. */ ++ else { ++ do { ++ save = g->reginput; ++ if (regmatch(g, OPERAND(scan))) ++ return(1); ++ g->reginput = save; ++ scan = regnext(g, scan); ++ } while (scan != NULL && OP(scan) == BRANCH); ++ return(0); ++ /* NOTREACHED */ ++ } ++ } ++ break; ++ case STAR: ++ case PLUS: { ++ register char nextch; ++ register int no; ++ register char *save; ++ register int min; ++ ++ /* ++ * Lookahead to avoid useless match attempts ++ * when we know what character comes next. ++ */ ++ nextch = '\0'; ++ if (OP(next) == EXACTLY) ++ nextch = *OPERAND(next); ++ min = (OP(scan) == STAR) ? 0 : 1; ++ save = g->reginput; ++ no = regrepeat(g, OPERAND(scan)); ++ while (no >= min) { ++ /* If it could work, try it. */ ++ if (nextch == '\0' || *g->reginput == nextch) ++ if (regmatch(g, next)) ++ return(1); ++ /* Couldn't or didn't -- back up. */ ++ no--; ++ g->reginput = save + no; ++ } ++ return(0); ++ } ++ break; ++ case END: ++ return(1); /* Success! */ ++ break; ++ default: ++ printk("<3>Regexp: memory corruption\n"); ++ return(0); ++ break; ++ } ++ ++ scan = next; ++ } ++ ++ /* ++ * We get here only if there's trouble -- normally "case END" is ++ * the terminating point. ++ */ ++ printk("<3>Regexp: corrupted pointers\n"); ++ return(0); ++} ++ ++/* ++ - regrepeat - repeatedly match something simple, report how many ++ */ ++static int ++regrepeat(struct match_globals *g, char *p) ++{ ++ register int count = 0; ++ register char *scan; ++ register char *opnd; ++ ++ scan = g->reginput; ++ opnd = OPERAND(p); ++ switch (OP(p)) { ++ case ANY: ++ count = strlen(scan); ++ scan += count; ++ break; ++ case EXACTLY: ++ while (*opnd == *scan) { ++ count++; ++ scan++; ++ } ++ break; ++ case ANYOF: ++ while (*scan != '\0' && strchr(opnd, *scan) != NULL) { ++ count++; ++ scan++; ++ } ++ break; ++ case ANYBUT: ++ while (*scan != '\0' && strchr(opnd, *scan) == NULL) { ++ count++; ++ scan++; ++ } ++ break; ++ default: /* Oh dear. Called inappropriately. */ ++ printk("<3>Regexp: internal foulup\n"); ++ count = 0; /* Best compromise. */ ++ break; ++ } ++ g->reginput = scan; ++ ++ return(count); ++} ++ ++/* ++ - regnext - dig the "next" pointer out of a node ++ */ ++static char* ++regnext(struct match_globals *g, char *p) ++{ ++ register int offset; ++ ++ if (p == &g->regdummy) ++ return(NULL); ++ ++ offset = NEXT(p); ++ if (offset == 0) ++ return(NULL); ++ ++ if (OP(p) == BACK) ++ return(p-offset); ++ else ++ return(p+offset); ++} ++ ++#ifdef DEBUG ++ ++STATIC char *regprop(); ++ ++/* ++ - regdump - dump a regexp onto stdout in vaguely comprehensible form ++ */ ++void ++regdump(regexp *r) ++{ ++ register char *s; ++ register char op = EXACTLY; /* Arbitrary non-END op. */ ++ register char *next; ++ /* extern char *strchr(); */ ++ ++ ++ s = r->program + 1; ++ while (op != END) { /* While that wasn't END last time... */ ++ op = OP(s); ++ printf("%2d%s", s-r->program, regprop(s)); /* Where, what. */ ++ next = regnext(s); ++ if (next == NULL) /* Next ptr. */ ++ printf("(0)"); ++ else ++ printf("(%d)", (s-r->program)+(next-s)); ++ s += 3; ++ if (op == ANYOF || op == ANYBUT || op == EXACTLY) { ++ /* Literal string, where present. */ ++ while (*s != '\0') { ++ putchar(*s); ++ s++; ++ } ++ s++; ++ } ++ putchar('\n'); ++ } ++ ++ /* Header fields of interest. */ ++ if (r->regstart != '\0') ++ printf("start `%c' ", r->regstart); ++ if (r->reganch) ++ printf("anchored "); ++ if (r->regmust != NULL) ++ printf("must have \"%s\"", r->regmust); ++ printf("\n"); ++} ++ ++/* ++ - regprop - printable representation of opcode ++ */ ++static char * ++regprop(char *op) ++{ ++#define BUFLEN 50 ++ register char *p; ++ static char buf[BUFLEN]; ++ ++ strcpy(buf, ":"); ++ ++ switch (OP(op)) { ++ case BOL: ++ p = "BOL"; ++ break; ++ case EOL: ++ p = "EOL"; ++ break; ++ case ANY: ++ p = "ANY"; ++ break; ++ case ANYOF: ++ p = "ANYOF"; ++ break; ++ case ANYBUT: ++ p = "ANYBUT"; ++ break; ++ case BRANCH: ++ p = "BRANCH"; ++ break; ++ case EXACTLY: ++ p = "EXACTLY"; ++ break; ++ case NOTHING: ++ p = "NOTHING"; ++ break; ++ case BACK: ++ p = "BACK"; ++ break; ++ case END: ++ p = "END"; ++ break; ++ case OPEN+1: ++ case OPEN+2: ++ case OPEN+3: ++ case OPEN+4: ++ case OPEN+5: ++ case OPEN+6: ++ case OPEN+7: ++ case OPEN+8: ++ case OPEN+9: ++ snprintf(buf+strlen(buf),BUFLEN-strlen(buf), "OPEN%d", OP(op)-OPEN); ++ p = NULL; ++ break; ++ case CLOSE+1: ++ case CLOSE+2: ++ case CLOSE+3: ++ case CLOSE+4: ++ case CLOSE+5: ++ case CLOSE+6: ++ case CLOSE+7: ++ case CLOSE+8: ++ case CLOSE+9: ++ snprintf(buf+strlen(buf),BUFLEN-strlen(buf), "CLOSE%d", OP(op)-CLOSE); ++ p = NULL; ++ break; ++ case STAR: ++ p = "STAR"; ++ break; ++ case PLUS: ++ p = "PLUS"; ++ break; ++ default: ++ printk("<3>Regexp: corrupted opcode\n"); ++ break; ++ } ++ if (p != NULL) ++ strncat(buf, p, BUFLEN-strlen(buf)); ++ return(buf); ++} ++#endif ++ ++ +--- /dev/null ++++ b/net/netfilter/regexp/regexp.h +@@ -0,0 +1,41 @@ ++/* ++ * Definitions etc. for regexp(3) routines. ++ * ++ * Caveat: this is V8 regexp(3) [actually, a reimplementation thereof], ++ * not the System V one. ++ */ ++ ++#ifndef REGEXP_H ++#define REGEXP_H ++ ++ ++/* ++http://www.opensource.apple.com/darwinsource/10.3/expect-1/expect/expect.h , ++which contains a version of this library, says: ++ ++ * ++ * NSUBEXP must be at least 10, and no greater than 117 or the parser ++ * will not work properly. ++ * ++ ++However, it looks rather like this library is limited to 10. If you think ++otherwise, let us know. ++*/ ++ ++#define NSUBEXP 10 ++typedef struct regexp { ++ char *startp[NSUBEXP]; ++ char *endp[NSUBEXP]; ++ char regstart; /* Internal use only. */ ++ char reganch; /* Internal use only. */ ++ char *regmust; /* Internal use only. */ ++ int regmlen; /* Internal use only. */ ++ char program[1]; /* Unwarranted chumminess with compiler. */ ++} regexp; ++ ++regexp * regcomp(char *exp, int *patternsize); ++int regexec(regexp *prog, char *string); ++void regsub(regexp *prog, char *source, char *dest); ++void regerror(char *s); ++ ++#endif +--- /dev/null ++++ b/net/netfilter/regexp/regmagic.h +@@ -0,0 +1,5 @@ ++/* ++ * The first byte of the regexp internal "program" is actually this magic ++ * number; the start node begins in the second byte. ++ */ ++#define MAGIC 0234 +--- /dev/null ++++ b/net/netfilter/regexp/regsub.c +@@ -0,0 +1,95 @@ ++/* ++ * regsub ++ * @(#)regsub.c 1.3 of 2 April 86 ++ * ++ * Copyright (c) 1986 by University of Toronto. ++ * Written by Henry Spencer. Not derived from licensed software. ++ * ++ * Permission is granted to anyone to use this software for any ++ * purpose on any computer system, and to redistribute it freely, ++ * subject to the following restrictions: ++ * ++ * 1. The author is not responsible for the consequences of use of ++ * this software, no matter how awful, even if they arise ++ * from defects in it. ++ * ++ * 2. The origin of this software must not be misrepresented, either ++ * by explicit claim or by omission. ++ * ++ * 3. Altered versions must be plainly marked as such, and must not ++ * be misrepresented as being the original software. ++ * ++ * ++ * This code was modified by Ethan Sommer to work within the kernel ++ * (it now uses kmalloc etc..) ++ * ++ */ ++#include "regexp.h" ++#include "regmagic.h" ++#include ++ ++ ++#ifndef CHARBITS ++#define UCHARAT(p) ((int)*(unsigned char *)(p)) ++#else ++#define UCHARAT(p) ((int)*(p)&CHARBITS) ++#endif ++ ++#if 0 ++//void regerror(char * s) ++//{ ++// printk("regexp(3): %s", s); ++// /* NOTREACHED */ ++//} ++#endif ++ ++/* ++ - regsub - perform substitutions after a regexp match ++ */ ++void ++regsub(regexp * prog, char * source, char * dest) ++{ ++ register char *src; ++ register char *dst; ++ register char c; ++ register int no; ++ register int len; ++ ++ /* Not necessary and gcc doesn't like it -MLS */ ++ /*extern char *strncpy();*/ ++ ++ if (prog == NULL || source == NULL || dest == NULL) { ++ regerror("NULL parm to regsub"); ++ return; ++ } ++ if (UCHARAT(prog->program) != MAGIC) { ++ regerror("damaged regexp fed to regsub"); ++ return; ++ } ++ ++ src = source; ++ dst = dest; ++ while ((c = *src++) != '\0') { ++ if (c == '&') ++ no = 0; ++ else if (c == '\\' && '0' <= *src && *src <= '9') ++ no = *src++ - '0'; ++ else ++ no = -1; ++ ++ if (no < 0) { /* Ordinary character. */ ++ if (c == '\\' && (*src == '\\' || *src == '&')) ++ c = *src++; ++ *dst++ = c; ++ } else if (prog->startp[no] != NULL && prog->endp[no] != NULL) { ++ len = prog->endp[no] - prog->startp[no]; ++ (void) strncpy(dst, prog->startp[no], len); ++ dst += len; ++ if (len != 0 && *(dst-1) == '\0') { /* strncpy hit NUL. */ ++ regerror("damaged match string"); ++ return; ++ } ++ } ++ } ++ *dst++ = '\0'; ++} +--- /dev/null ++++ b/net/netfilter/xt_layer7.c +@@ -0,0 +1,666 @@ ++/* ++ Kernel module to match application layer (OSI layer 7) data in connections. ++ ++ http://l7-filter.sf.net ++ ++ (C) 2003-2009 Matthew Strait and Ethan Sommer. ++ ++ 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 of the License, or (at your option) any later version. ++ http://www.gnu.org/licenses/gpl.txt ++ ++ Based on ipt_string.c (C) 2000 Emmanuel Roger , ++ xt_helper.c (C) 2002 Harald Welte and cls_layer7.c (C) 2003 Matthew Strait, ++ Ethan Sommer, Justin Levandoski. ++*/ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) ++#include ++#include ++#endif ++#include ++#include ++#include ++#include ++ ++#include "regexp/regexp.c" ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Matthew Strait , Ethan Sommer "); ++MODULE_DESCRIPTION("iptables application layer match module"); ++MODULE_ALIAS("ipt_layer7"); ++MODULE_VERSION("2.21"); ++ ++static int maxdatalen = 2048; // this is the default ++module_param(maxdatalen, int, 0444); ++MODULE_PARM_DESC(maxdatalen, "maximum bytes of data looked at by l7-filter"); ++#ifdef CONFIG_NETFILTER_XT_MATCH_LAYER7_DEBUG ++ #define DPRINTK(format,args...) printk(format,##args) ++#else ++ #define DPRINTK(format,args...) ++#endif ++ ++/* Number of packets whose data we look at. ++This can be modified through /proc/net/layer7_numpackets */ ++static int num_packets = 10; ++ ++static struct pattern_cache { ++ char * regex_string; ++ regexp * pattern; ++ struct pattern_cache * next; ++} * first_pattern_cache = NULL; ++ ++DEFINE_SPINLOCK(l7_lock); ++ ++static int total_acct_packets(struct nf_conn *ct) ++{ ++#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 26) ++ BUG_ON(ct == NULL); ++ return (ct->counters[IP_CT_DIR_ORIGINAL].packets + ct->counters[IP_CT_DIR_REPLY].packets); ++#else ++ struct nf_conn_counter *acct; ++ ++ BUG_ON(ct == NULL); ++ acct = nf_conn_acct_find(ct); ++ if (!acct) ++ return 0; ++ return (acct[IP_CT_DIR_ORIGINAL].packets + acct[IP_CT_DIR_REPLY].packets); ++#endif ++} ++ ++#ifdef CONFIG_IP_NF_MATCH_LAYER7_DEBUG ++/* Converts an unfriendly string into a friendly one by ++replacing unprintables with periods and all whitespace with " ". */ ++static char * friendly_print(unsigned char * s) ++{ ++ char * f = kmalloc(strlen(s) + 1, GFP_ATOMIC); ++ int i; ++ ++ if(!f) { ++ if (net_ratelimit()) ++ printk(KERN_ERR "layer7: out of memory in " ++ "friendly_print, bailing.\n"); ++ return NULL; ++ } ++ ++ for(i = 0; i < strlen(s); i++){ ++ if(isprint(s[i]) && s[i] < 128) f[i] = s[i]; ++ else if(isspace(s[i])) f[i] = ' '; ++ else f[i] = '.'; ++ } ++ f[i] = '\0'; ++ return f; ++} ++ ++static char dec2hex(int i) ++{ ++ switch (i) { ++ case 0 ... 9: ++ return (i + '0'); ++ break; ++ case 10 ... 15: ++ return (i - 10 + 'a'); ++ break; ++ default: ++ if (net_ratelimit()) ++ printk("layer7: Problem in dec2hex\n"); ++ return '\0'; ++ } ++} ++ ++static char * hex_print(unsigned char * s) ++{ ++ char * g = kmalloc(strlen(s)*3 + 1, GFP_ATOMIC); ++ int i; ++ ++ if(!g) { ++ if (net_ratelimit()) ++ printk(KERN_ERR "layer7: out of memory in hex_print, " ++ "bailing.\n"); ++ return NULL; ++ } ++ ++ for(i = 0; i < strlen(s); i++) { ++ g[i*3 ] = dec2hex(s[i]/16); ++ g[i*3 + 1] = dec2hex(s[i]%16); ++ g[i*3 + 2] = ' '; ++ } ++ g[i*3] = '\0'; ++ ++ return g; ++} ++#endif // DEBUG ++ ++/* Use instead of regcomp. As we expect to be seeing the same regexps over and ++over again, it make sense to cache the results. */ ++static regexp * compile_and_cache(const char * regex_string, ++ const char * protocol) ++{ ++ struct pattern_cache * node = first_pattern_cache; ++ struct pattern_cache * last_pattern_cache = first_pattern_cache; ++ struct pattern_cache * tmp; ++ unsigned int len; ++ ++ while (node != NULL) { ++ if (!strcmp(node->regex_string, regex_string)) ++ return node->pattern; ++ ++ last_pattern_cache = node;/* points at the last non-NULL node */ ++ node = node->next; ++ } ++ ++ /* If we reach the end of the list, then we have not yet cached ++ the pattern for this regex. Let's do that now. ++ Be paranoid about running out of memory to avoid list corruption. */ ++ tmp = kmalloc(sizeof(struct pattern_cache), GFP_ATOMIC); ++ ++ if(!tmp) { ++ if (net_ratelimit()) ++ printk(KERN_ERR "layer7: out of memory in " ++ "compile_and_cache, bailing.\n"); ++ return NULL; ++ } ++ ++ tmp->regex_string = kmalloc(strlen(regex_string) + 1, GFP_ATOMIC); ++ tmp->pattern = kmalloc(sizeof(struct regexp), GFP_ATOMIC); ++ tmp->next = NULL; ++ ++ if(!tmp->regex_string || !tmp->pattern) { ++ if (net_ratelimit()) ++ printk(KERN_ERR "layer7: out of memory in " ++ "compile_and_cache, bailing.\n"); ++ kfree(tmp->regex_string); ++ kfree(tmp->pattern); ++ kfree(tmp); ++ return NULL; ++ } ++ ++ /* Ok. The new node is all ready now. */ ++ node = tmp; ++ ++ if(first_pattern_cache == NULL) /* list is empty */ ++ first_pattern_cache = node; /* make node the beginning */ ++ else ++ last_pattern_cache->next = node; /* attach node to the end */ ++ ++ /* copy the string and compile the regex */ ++ len = strlen(regex_string); ++ DPRINTK("About to compile this: \"%s\"\n", regex_string); ++ node->pattern = regcomp((char *)regex_string, &len); ++ if ( !node->pattern ) { ++ if (net_ratelimit()) ++ printk(KERN_ERR "layer7: Error compiling regexp " ++ "\"%s\" (%s)\n", ++ regex_string, protocol); ++ /* pattern is now cached as NULL, so we won't try again. */ ++ } ++ ++ strcpy(node->regex_string, regex_string); ++ return node->pattern; ++} ++ ++static int can_handle(const struct sk_buff *skb) ++{ ++ if(!ip_hdr(skb)) /* not IP */ ++ return 0; ++ if(ip_hdr(skb)->protocol != IPPROTO_TCP && ++ ip_hdr(skb)->protocol != IPPROTO_UDP && ++ ip_hdr(skb)->protocol != IPPROTO_ICMP) ++ return 0; ++ return 1; ++} ++ ++/* Returns offset the into the skb->data that the application data starts */ ++static int app_data_offset(const struct sk_buff *skb) ++{ ++ /* In case we are ported somewhere (ebtables?) where ip_hdr(skb) ++ isn't set, this can be gotten from 4*(skb->data[0] & 0x0f) as well. */ ++ int ip_hl = 4*ip_hdr(skb)->ihl; ++ ++ if( ip_hdr(skb)->protocol == IPPROTO_TCP ) { ++ /* 12 == offset into TCP header for the header length field. ++ Can't get this with skb->h.th->doff because the tcphdr ++ struct doesn't get set when routing (this is confirmed to be ++ true in Netfilter as well as QoS.) */ ++ int tcp_hl = 4*(skb->data[ip_hl + 12] >> 4); ++ ++ return ip_hl + tcp_hl; ++ } else if( ip_hdr(skb)->protocol == IPPROTO_UDP ) { ++ return ip_hl + 8; /* UDP header is always 8 bytes */ ++ } else if( ip_hdr(skb)->protocol == IPPROTO_ICMP ) { ++ return ip_hl + 8; /* ICMP header is 8 bytes */ ++ } else { ++ if (net_ratelimit()) ++ printk(KERN_ERR "layer7: tried to handle unknown " ++ "protocol!\n"); ++ return ip_hl + 8; /* something reasonable */ ++ } ++} ++ ++/* handles whether there's a match when we aren't appending data anymore */ ++static int match_no_append(struct nf_conn * conntrack, ++ struct nf_conn * master_conntrack, ++ enum ip_conntrack_info ctinfo, ++ enum ip_conntrack_info master_ctinfo, ++ const struct xt_layer7_info * info) ++{ ++ /* If we're in here, throw the app data away */ ++ if(master_conntrack->layer7.app_data != NULL) { ++ ++ #ifdef CONFIG_IP_NF_MATCH_LAYER7_DEBUG ++ if(!master_conntrack->layer7.app_proto) { ++ char * f = ++ friendly_print(master_conntrack->layer7.app_data); ++ char * g = ++ hex_print(master_conntrack->layer7.app_data); ++ DPRINTK("\nl7-filter gave up after %d bytes " ++ "(%d packets):\n%s\n", ++ strlen(f), total_acct_packets(master_conntrack), f); ++ kfree(f); ++ DPRINTK("In hex: %s\n", g); ++ kfree(g); ++ } ++ #endif ++ ++ kfree(master_conntrack->layer7.app_data); ++ master_conntrack->layer7.app_data = NULL; /* don't free again */ ++ } ++ ++ if(master_conntrack->layer7.app_proto){ ++ /* Here child connections set their .app_proto (for /proc) */ ++ if(!conntrack->layer7.app_proto) { ++ conntrack->layer7.app_proto = ++ kmalloc(strlen(master_conntrack->layer7.app_proto)+1, ++ GFP_ATOMIC); ++ if(!conntrack->layer7.app_proto){ ++ if (net_ratelimit()) ++ printk(KERN_ERR "layer7: out of memory " ++ "in match_no_append, " ++ "bailing.\n"); ++ return 1; ++ } ++ strcpy(conntrack->layer7.app_proto, ++ master_conntrack->layer7.app_proto); ++ } ++ ++ return (!strcmp(master_conntrack->layer7.app_proto, ++ info->protocol)); ++ } ++ else { ++ /* If not classified, set to "unknown" to distinguish from ++ connections that are still being tested. */ ++ master_conntrack->layer7.app_proto = ++ kmalloc(strlen("unknown")+1, GFP_ATOMIC); ++ if(!master_conntrack->layer7.app_proto){ ++ if (net_ratelimit()) ++ printk(KERN_ERR "layer7: out of memory in " ++ "match_no_append, bailing.\n"); ++ return 1; ++ } ++ strcpy(master_conntrack->layer7.app_proto, "unknown"); ++ return 0; ++ } ++} ++ ++/* add the new app data to the conntrack. Return number of bytes added. */ ++static int add_data(struct nf_conn * master_conntrack, ++ char * app_data, int appdatalen) ++{ ++ int length = 0, i; ++ int oldlength = master_conntrack->layer7.app_data_len; ++ ++ /* This is a fix for a race condition by Deti Fliegl. However, I'm not ++ clear on whether the race condition exists or whether this really ++ fixes it. I might just be being dense... Anyway, if it's not really ++ a fix, all it does is waste a very small amount of time. */ ++ if(!master_conntrack->layer7.app_data) return 0; ++ ++ /* Strip nulls. Make everything lower case (our regex lib doesn't ++ do case insensitivity). Add it to the end of the current data. */ ++ for(i = 0; i < maxdatalen-oldlength-1 && ++ i < appdatalen; i++) { ++ if(app_data[i] != '\0') { ++ /* the kernel version of tolower mungs 'upper ascii' */ ++ master_conntrack->layer7.app_data[length+oldlength] = ++ isascii(app_data[i])? ++ tolower(app_data[i]) : app_data[i]; ++ length++; ++ } ++ } ++ ++ master_conntrack->layer7.app_data[length+oldlength] = '\0'; ++ master_conntrack->layer7.app_data_len = length + oldlength; ++ ++ return length; ++} ++ ++/* taken from drivers/video/modedb.c */ ++static int my_atoi(const char *s) ++{ ++ int val = 0; ++ ++ for (;; s++) { ++ switch (*s) { ++ case '0'...'9': ++ val = 10*val+(*s-'0'); ++ break; ++ default: ++ return val; ++ } ++ } ++} ++ ++/* write out num_packets to userland. */ ++static int layer7_read_proc(char* page, char ** start, off_t off, int count, ++ int* eof, void * data) ++{ ++ if(num_packets > 99 && net_ratelimit()) ++ printk(KERN_ERR "layer7: NOT REACHED. num_packets too big\n"); ++ ++ page[0] = num_packets/10 + '0'; ++ page[1] = num_packets%10 + '0'; ++ page[2] = '\n'; ++ page[3] = '\0'; ++ ++ *eof=1; ++ ++ return 3; ++} ++ ++/* Read in num_packets from userland */ ++static int layer7_write_proc(struct file* file, const char* buffer, ++ unsigned long count, void *data) ++{ ++ char * foo = kmalloc(count, GFP_ATOMIC); ++ ++ if(!foo){ ++ if (net_ratelimit()) ++ printk(KERN_ERR "layer7: out of memory, bailing. " ++ "num_packets unchanged.\n"); ++ return count; ++ } ++ ++ if(copy_from_user(foo, buffer, count)) { ++ return -EFAULT; ++ } ++ ++ ++ num_packets = my_atoi(foo); ++ kfree (foo); ++ ++ /* This has an arbitrary limit to make the math easier. I'm lazy. ++ But anyway, 99 is a LOT! If you want more, you're doing it wrong! */ ++ if(num_packets > 99) { ++ printk(KERN_WARNING "layer7: num_packets can't be > 99.\n"); ++ num_packets = 99; ++ } else if(num_packets < 1) { ++ printk(KERN_WARNING "layer7: num_packets can't be < 1.\n"); ++ num_packets = 1; ++ } ++ ++ return count; ++} ++ ++static bool ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) ++match(const struct sk_buff *skbin, const struct xt_match_param *par) ++#else ++match(const struct sk_buff *skbin, ++ const struct net_device *in, ++ const struct net_device *out, ++ const struct xt_match *match, ++ const void *matchinfo, ++ int offset, ++ unsigned int protoff, ++ bool *hotdrop) ++#endif ++{ ++ /* sidestep const without getting a compiler warning... */ ++ struct sk_buff * skb = (struct sk_buff *)skbin; ++ ++ const struct xt_layer7_info * info = ++ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) ++ par->matchinfo; ++ #else ++ matchinfo; ++ #endif ++ ++ enum ip_conntrack_info master_ctinfo, ctinfo; ++ struct nf_conn *master_conntrack, *conntrack; ++ unsigned char * app_data; ++ unsigned int pattern_result, appdatalen; ++ regexp * comppattern; ++ ++ /* Be paranoid/incompetent - lock the entire match function. */ ++ spin_lock_bh(&l7_lock); ++ ++ if(!can_handle(skb)){ ++ DPRINTK("layer7: This is some protocol I can't handle.\n"); ++ spin_unlock_bh(&l7_lock); ++ return info->invert; ++ } ++ ++ /* Treat parent & all its children together as one connection, except ++ for the purpose of setting conntrack->layer7.app_proto in the actual ++ connection. This makes /proc/net/ip_conntrack more satisfying. */ ++ if(!(conntrack = nf_ct_get(skb, &ctinfo)) || ++ !(master_conntrack=nf_ct_get(skb,&master_ctinfo))){ ++ DPRINTK("layer7: couldn't get conntrack.\n"); ++ spin_unlock_bh(&l7_lock); ++ return info->invert; ++ } ++ ++ /* Try to get a master conntrack (and its master etc) for FTP, etc. */ ++ while (master_ct(master_conntrack) != NULL) ++ master_conntrack = master_ct(master_conntrack); ++ ++ /* if we've classified it or seen too many packets */ ++ if(total_acct_packets(master_conntrack) > num_packets || ++ master_conntrack->layer7.app_proto) { ++ ++ pattern_result = match_no_append(conntrack, master_conntrack, ++ ctinfo, master_ctinfo, info); ++ ++ /* skb->cb[0] == seen. Don't do things twice if there are ++ multiple l7 rules. I'm not sure that using cb for this purpose ++ is correct, even though it says "put your private variables ++ there". But it doesn't look like it is being used for anything ++ else in the skbs that make it here. */ ++ skb->cb[0] = 1; /* marking it seen here's probably irrelevant */ ++ ++ spin_unlock_bh(&l7_lock); ++ return (pattern_result ^ info->invert); ++ } ++ ++ if(skb_is_nonlinear(skb)){ ++ if(skb_linearize(skb) != 0){ ++ if (net_ratelimit()) ++ printk(KERN_ERR "layer7: failed to linearize " ++ "packet, bailing.\n"); ++ spin_unlock_bh(&l7_lock); ++ return info->invert; ++ } ++ } ++ ++ /* now that the skb is linearized, it's safe to set these. */ ++ app_data = skb->data + app_data_offset(skb); ++ appdatalen = skb_tail_pointer(skb) - app_data; ++ ++ /* the return value gets checked later, when we're ready to use it */ ++ comppattern = compile_and_cache(info->pattern, info->protocol); ++ ++ /* On the first packet of a connection, allocate space for app data */ ++ if(total_acct_packets(master_conntrack) == 1 && !skb->cb[0] && ++ !master_conntrack->layer7.app_data){ ++ master_conntrack->layer7.app_data = ++ kmalloc(maxdatalen, GFP_ATOMIC); ++ if(!master_conntrack->layer7.app_data){ ++ if (net_ratelimit()) ++ printk(KERN_ERR "layer7: out of memory in " ++ "match, bailing.\n"); ++ spin_unlock_bh(&l7_lock); ++ return info->invert; ++ } ++ ++ master_conntrack->layer7.app_data[0] = '\0'; ++ } ++ ++ /* Can be here, but unallocated, if numpackets is increased near ++ the beginning of a connection */ ++ if(master_conntrack->layer7.app_data == NULL){ ++ spin_unlock_bh(&l7_lock); ++ return info->invert; /* unmatched */ ++ } ++ ++ if(!skb->cb[0]){ ++ int newbytes; ++ newbytes = add_data(master_conntrack, app_data, appdatalen); ++ ++ if(newbytes == 0) { /* didn't add any data */ ++ skb->cb[0] = 1; ++ /* Didn't match before, not going to match now */ ++ spin_unlock_bh(&l7_lock); ++ return info->invert; ++ } ++ } ++ ++ /* If looking for "unknown", then never match. "Unknown" means that ++ we've given up; we're still trying with these packets. */ ++ if(!strcmp(info->protocol, "unknown")) { ++ pattern_result = 0; ++ /* If looking for "unset", then always match. "Unset" means that we ++ haven't yet classified the connection. */ ++ } else if(!strcmp(info->protocol, "unset")) { ++ pattern_result = 2; ++ DPRINTK("layer7: matched unset: not yet classified " ++ "(%d/%d packets)\n", ++ total_acct_packets(master_conntrack), num_packets); ++ /* If the regexp failed to compile, don't bother running it */ ++ } else if(comppattern && ++ regexec(comppattern, master_conntrack->layer7.app_data)){ ++ DPRINTK("layer7: matched %s\n", info->protocol); ++ pattern_result = 1; ++ } else pattern_result = 0; ++ ++ if(pattern_result == 1) { ++ master_conntrack->layer7.app_proto = ++ kmalloc(strlen(info->protocol)+1, GFP_ATOMIC); ++ if(!master_conntrack->layer7.app_proto){ ++ if (net_ratelimit()) ++ printk(KERN_ERR "layer7: out of memory in " ++ "match, bailing.\n"); ++ spin_unlock_bh(&l7_lock); ++ return (pattern_result ^ info->invert); ++ } ++ strcpy(master_conntrack->layer7.app_proto, info->protocol); ++ } else if(pattern_result > 1) { /* cleanup from "unset" */ ++ pattern_result = 1; ++ } ++ ++ /* mark the packet seen */ ++ skb->cb[0] = 1; ++ ++ spin_unlock_bh(&l7_lock); ++ return (pattern_result ^ info->invert); ++} ++ ++// load nf_conntrack_ipv4 ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) ++static bool check(const struct xt_mtchk_param *par) ++{ ++ if (nf_ct_l3proto_try_module_get(par->match->family) < 0) { ++ printk(KERN_WARNING "can't load conntrack support for " ++ "proto=%d\n", par->match->family); ++#else ++static bool check(const char *tablename, const void *inf, ++ const struct xt_match *match, void *matchinfo, ++ unsigned int hook_mask) ++{ ++ if (nf_ct_l3proto_try_module_get(match->family) < 0) { ++ printk(KERN_WARNING "can't load conntrack support for " ++ "proto=%d\n", match->family); ++#endif ++ return 0; ++ } ++ return 1; ++} ++ ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) ++ static void destroy(const struct xt_mtdtor_param *par) ++ { ++ nf_ct_l3proto_module_put(par->match->family); ++ } ++#else ++ static void destroy(const struct xt_match *match, void *matchinfo) ++ { ++ nf_ct_l3proto_module_put(match->family); ++ } ++#endif ++ ++static struct xt_match xt_layer7_match[] __read_mostly = { ++{ ++ .name = "layer7", ++ .family = AF_INET, ++ .checkentry = check, ++ .match = match, ++ .destroy = destroy, ++ .matchsize = sizeof(struct xt_layer7_info), ++ .me = THIS_MODULE ++} ++}; ++ ++static void layer7_cleanup_proc(void) ++{ ++ remove_proc_entry("layer7_numpackets", init_net.proc_net); ++} ++ ++/* register the proc file */ ++static void layer7_init_proc(void) ++{ ++ struct proc_dir_entry* entry; ++ entry = create_proc_entry("layer7_numpackets", 0644, init_net.proc_net); ++ entry->read_proc = layer7_read_proc; ++ entry->write_proc = layer7_write_proc; ++} ++ ++static int __init xt_layer7_init(void) ++{ ++ need_conntrack(); ++ ++ layer7_init_proc(); ++ if(maxdatalen < 1) { ++ printk(KERN_WARNING "layer7: maxdatalen can't be < 1, " ++ "using 1\n"); ++ maxdatalen = 1; ++ } ++ /* This is not a hard limit. It's just here to prevent people from ++ bringing their slow machines to a grinding halt. */ ++ else if(maxdatalen > 65536) { ++ printk(KERN_WARNING "layer7: maxdatalen can't be > 65536, " ++ "using 65536\n"); ++ maxdatalen = 65536; ++ } ++ return xt_register_matches(xt_layer7_match, ++ ARRAY_SIZE(xt_layer7_match)); ++} ++ ++static void __exit xt_layer7_fini(void) ++{ ++ layer7_cleanup_proc(); ++ xt_unregister_matches(xt_layer7_match, ARRAY_SIZE(xt_layer7_match)); ++} ++ ++module_init(xt_layer7_init); ++module_exit(xt_layer7_fini); diff --git a/target/linux/generic-2.6/patches-2.6.32/101-netfilter_layer7_pktmatch.patch b/target/linux/generic-2.6/patches-2.6.32/101-netfilter_layer7_pktmatch.patch new file mode 100644 index 000000000..f65e301fd --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/101-netfilter_layer7_pktmatch.patch @@ -0,0 +1,108 @@ +--- a/include/linux/netfilter/xt_layer7.h ++++ b/include/linux/netfilter/xt_layer7.h +@@ -8,6 +8,7 @@ struct xt_layer7_info { + char protocol[MAX_PROTOCOL_LEN]; + char pattern[MAX_PATTERN_LEN]; + u_int8_t invert; ++ u_int8_t pkt; + }; + + #endif /* _XT_LAYER7_H */ +--- a/net/netfilter/xt_layer7.c ++++ b/net/netfilter/xt_layer7.c +@@ -314,33 +314,35 @@ static int match_no_append(struct nf_con + } + + /* add the new app data to the conntrack. Return number of bytes added. */ +-static int add_data(struct nf_conn * master_conntrack, +- char * app_data, int appdatalen) ++static int add_datastr(char *target, int offset, char *app_data, int len) + { + int length = 0, i; +- int oldlength = master_conntrack->layer7.app_data_len; +- +- /* This is a fix for a race condition by Deti Fliegl. However, I'm not +- clear on whether the race condition exists or whether this really +- fixes it. I might just be being dense... Anyway, if it's not really +- a fix, all it does is waste a very small amount of time. */ +- if(!master_conntrack->layer7.app_data) return 0; ++ if (!target) return 0; + + /* Strip nulls. Make everything lower case (our regex lib doesn't + do case insensitivity). Add it to the end of the current data. */ +- for(i = 0; i < maxdatalen-oldlength-1 && +- i < appdatalen; i++) { ++ for(i = 0; i < maxdatalen-offset-1 && i < len; i++) { + if(app_data[i] != '\0') { + /* the kernel version of tolower mungs 'upper ascii' */ +- master_conntrack->layer7.app_data[length+oldlength] = ++ target[length+offset] = + isascii(app_data[i])? + tolower(app_data[i]) : app_data[i]; + length++; + } + } ++ target[length+offset] = '\0'; ++ ++ return length; ++} ++ ++/* add the new app data to the conntrack. Return number of bytes added. */ ++static int add_data(struct nf_conn * master_conntrack, ++ char * app_data, int appdatalen) ++{ ++ int length; + +- master_conntrack->layer7.app_data[length+oldlength] = '\0'; +- master_conntrack->layer7.app_data_len = length + oldlength; ++ length = add_datastr(master_conntrack->layer7.app_data, master_conntrack->layer7.app_data_len, app_data, appdatalen); ++ master_conntrack->layer7.app_data_len += length; + + return length; + } +@@ -438,7 +440,7 @@ match(const struct sk_buff *skbin, + + enum ip_conntrack_info master_ctinfo, ctinfo; + struct nf_conn *master_conntrack, *conntrack; +- unsigned char * app_data; ++ unsigned char *app_data, *tmp_data; + unsigned int pattern_result, appdatalen; + regexp * comppattern; + +@@ -466,8 +468,8 @@ match(const struct sk_buff *skbin, + master_conntrack = master_ct(master_conntrack); + + /* if we've classified it or seen too many packets */ +- if(total_acct_packets(master_conntrack) > num_packets || +- master_conntrack->layer7.app_proto) { ++ if(!info->pkt && (total_acct_packets(master_conntrack) > num_packets || ++ master_conntrack->layer7.app_proto)) { + + pattern_result = match_no_append(conntrack, master_conntrack, + ctinfo, master_ctinfo, info); +@@ -500,6 +502,25 @@ match(const struct sk_buff *skbin, + /* the return value gets checked later, when we're ready to use it */ + comppattern = compile_and_cache(info->pattern, info->protocol); + ++ if (info->pkt) { ++ tmp_data = kmalloc(maxdatalen, GFP_ATOMIC); ++ if(!tmp_data){ ++ if (net_ratelimit()) ++ printk(KERN_ERR "layer7: out of memory in match, bailing.\n"); ++ return info->invert; ++ } ++ ++ tmp_data[0] = '\0'; ++ add_datastr(tmp_data, 0, app_data, appdatalen); ++ pattern_result = ((comppattern && regexec(comppattern, tmp_data)) ? 1 : 0); ++ ++ kfree(tmp_data); ++ tmp_data = NULL; ++ spin_unlock_bh(&l7_lock); ++ ++ return (pattern_result ^ info->invert); ++ } ++ + /* On the first packet of a connection, allocate space for app data */ + if(total_acct_packets(master_conntrack) == 1 && !skb->cb[0] && + !master_conntrack->layer7.app_data){ diff --git a/target/linux/generic-2.6/patches-2.6.32/110-netfilter_match_speedup.patch b/target/linux/generic-2.6/patches-2.6.32/110-netfilter_match_speedup.patch new file mode 100644 index 000000000..2f4c7a292 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/110-netfilter_match_speedup.patch @@ -0,0 +1,121 @@ +--- a/include/linux/netfilter_ipv4/ip_tables.h ++++ b/include/linux/netfilter_ipv4/ip_tables.h +@@ -62,6 +62,7 @@ struct ipt_ip { + #define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */ + #define IPT_F_GOTO 0x02 /* Set if jump is a goto */ + #define IPT_F_MASK 0x03 /* All possible flag bits mask. */ ++#define IPT_F_NO_DEF_MATCH 0x80 /* Internal: no default match rules present */ + + /* Values for "inv" field in struct ipt_ip. */ + #define IPT_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ +--- a/net/ipv4/netfilter/ip_tables.c ++++ b/net/ipv4/netfilter/ip_tables.c +@@ -88,6 +88,9 @@ ip_packet_match(const struct iphdr *ip, + + #define FWINV(bool, invflg) ((bool) ^ !!(ipinfo->invflags & (invflg))) + ++ if (ipinfo->flags & IPT_F_NO_DEF_MATCH) ++ return true; ++ + if (FWINV((ip->saddr&ipinfo->smsk.s_addr) != ipinfo->src.s_addr, + IPT_INV_SRCIP) + || FWINV((ip->daddr&ipinfo->dmsk.s_addr) != ipinfo->dst.s_addr, +@@ -138,13 +141,35 @@ ip_packet_match(const struct iphdr *ip, + return false; + } + ++#undef FWINV + return true; + } + + static bool +-ip_checkentry(const struct ipt_ip *ip) ++ip_checkentry(struct ipt_ip *ip) + { +- if (ip->flags & ~IPT_F_MASK) { ++#define FWINV(bool, invflg) ((bool) || (ip->invflags & (invflg))) ++ ++ if (FWINV(ip->smsk.s_addr, IPT_INV_SRCIP) || ++ FWINV(ip->dmsk.s_addr, IPT_INV_DSTIP)) ++ goto has_match_rules; ++ ++ if (FWINV(!!((const unsigned long *)ip->iniface_mask)[0], ++ IPT_INV_VIA_IN) || ++ FWINV(!!((const unsigned long *)ip->outiface_mask)[0], ++ IPT_INV_VIA_OUT)) ++ goto has_match_rules; ++ ++ if (FWINV(ip->proto, IPT_INV_PROTO)) ++ goto has_match_rules; ++ ++ if (FWINV(ip->flags&IPT_F_FRAG, IPT_INV_FRAG)) ++ goto has_match_rules; ++ ++ ip->flags |= IPT_F_NO_DEF_MATCH; ++ ++has_match_rules: ++ if (ip->flags & ~(IPT_F_MASK|IPT_F_NO_DEF_MATCH)) { + duprintf("Unknown flag bits set: %08X\n", + ip->flags & ~IPT_F_MASK); + return false; +@@ -154,6 +179,8 @@ ip_checkentry(const struct ipt_ip *ip) + ip->invflags & ~IPT_INV_MASK); + return false; + } ++ ++#undef FWINV + return true; + } + +@@ -196,7 +223,6 @@ static inline bool unconditional(const s + static const struct ipt_ip uncond; + + return memcmp(ip, &uncond, sizeof(uncond)) == 0; +-#undef FWINV + } + + #if defined(CONFIG_NETFILTER_XT_TARGET_TRACE) || \ +@@ -321,8 +347,28 @@ ipt_do_table(struct sk_buff *skb, + struct xt_match_param mtpar; + struct xt_target_param tgpar; + +- /* Initialization */ + ip = ip_hdr(skb); ++ ++ IP_NF_ASSERT(table->valid_hooks & (1 << hook)); ++ xt_info_rdlock_bh(); ++ private = table->private; ++ table_base = private->entries[smp_processor_id()]; ++ e = get_entry(table_base, private->hook_entry[hook]); ++ ++ if (e->target_offset <= sizeof(struct ipt_entry) && ++ (e->ip.flags & IPT_F_NO_DEF_MATCH)) { ++ struct ipt_entry_target *t = ipt_get_target(e); ++ if (!t->u.kernel.target->target) { ++ int v = ((struct ipt_standard_target *)t)->verdict; ++ if ((v < 0) && (v != IPT_RETURN)) { ++ ADD_COUNTER(e->counters, ntohs(ip->tot_len), 1); ++ xt_info_rdunlock_bh(); ++ return (unsigned)(-v) - 1; ++ } ++ } ++ } ++ ++ /* Initialization */ + indev = in ? in->name : nulldevname; + outdev = out ? out->name : nulldevname; + /* We handle fragments by dealing with the first fragment as +@@ -339,13 +385,6 @@ ipt_do_table(struct sk_buff *skb, + mtpar.family = tgpar.family = NFPROTO_IPV4; + mtpar.hooknum = tgpar.hooknum = hook; + +- IP_NF_ASSERT(table->valid_hooks & (1 << hook)); +- xt_info_rdlock_bh(); +- private = table->private; +- table_base = private->entries[smp_processor_id()]; +- +- e = get_entry(table_base, private->hook_entry[hook]); +- + /* For return from builtin chain */ + back = get_entry(table_base, private->underflow[hook]); + diff --git a/target/linux/generic-2.6/patches-2.6.32/150-netfilter_imq.patch b/target/linux/generic-2.6/patches-2.6.32/150-netfilter_imq.patch new file mode 100644 index 000000000..35090871a --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/150-netfilter_imq.patch @@ -0,0 +1,1260 @@ +--- /dev/null ++++ b/drivers/net/imq.c +@@ -0,0 +1,571 @@ ++/* ++ * Pseudo-driver for the intermediate queue device. ++ * ++ * 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 of the License, or (at your option) any later version. ++ * ++ * Authors: Patrick McHardy, ++ * ++ * The first version was written by Martin Devera, ++ * ++ * Credits: Jan Rafaj ++ * - Update patch to 2.4.21 ++ * Sebastian Strollo ++ * - Fix "Dead-loop on netdevice imq"-issue ++ * Marcel Sebek ++ * - Update to 2.6.2-rc1 ++ * ++ * After some time of inactivity there is a group taking care ++ * of IMQ again: http://www.linuximq.net ++ * ++ * ++ * 2004/06/30 - New version of IMQ patch to kernels <=2.6.7 ++ * including the following changes: ++ * ++ * - Correction of ipv6 support "+"s issue (Hasso Tepper) ++ * - Correction of imq_init_devs() issue that resulted in ++ * kernel OOPS unloading IMQ as module (Norbert Buchmuller) ++ * - Addition of functionality to choose number of IMQ devices ++ * during kernel config (Andre Correa) ++ * - Addition of functionality to choose how IMQ hooks on ++ * PRE and POSTROUTING (after or before NAT) (Andre Correa) ++ * - Cosmetic corrections (Norbert Buchmuller) (Andre Correa) ++ * ++ * ++ * 2005/12/16 - IMQ versions between 2.6.7 and 2.6.13 were ++ * released with almost no problems. 2.6.14-x was released ++ * with some important changes: nfcache was removed; After ++ * some weeks of trouble we figured out that some IMQ fields ++ * in skb were missing in skbuff.c - skb_clone and copy_skb_header. ++ * These functions are correctly patched by this new patch version. ++ * ++ * Thanks for all who helped to figure out all the problems with ++ * 2.6.14.x: Patrick McHardy, Rune Kock, VeNoMouS, Max CtRiX, ++ * Kevin Shanahan, Richard Lucassen, Valery Dachev (hopefully ++ * I didn't forget anybody). I apologize again for my lack of time. ++ * ++ * ++ * 2008/06/17 - 2.6.25 - Changed imq.c to use qdisc_run() instead ++ * of qdisc_restart() and moved qdisc_run() to tasklet to avoid ++ * recursive locking. New initialization routines to fix 'rmmod' not ++ * working anymore. Used code from ifb.c. (Jussi Kivilinna) ++ * ++ * 2008/08/06 - 2.6.26 - (JK) ++ * - Replaced tasklet with 'netif_schedule()'. ++ * - Cleaned up and added comments for imq_nf_queue(). ++ * ++ * 2009/04/12 ++ * - Add skb_save_cb/skb_restore_cb helper functions for backuping ++ * control buffer. This is needed because qdisc-layer on kernels ++ * 2.6.27 and newer overwrite control buffer. (Jussi Kivilinna) ++ * - Add better locking for IMQ device. Hopefully this will solve ++ * SMP issues. (Jussi Kivilinna) ++ * - Port to 2.6.27 ++ * - Port to 2.6.28 ++ * - Port to 2.6.29 + fix rmmod not working ++ * ++ * 2009/04/20 - (Jussi Kivilinna) ++ * - Use netdevice feature flags to avoid extra packet handling ++ * by core networking layer and possibly increase performance. ++ * ++ * Also, many thanks to pablo Sebastian Greco for making the initial ++ * patch and to those who helped the testing. ++ * ++ * More info at: http://www.linuximq.net/ (Andre Correa) ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) ++ #include ++#endif ++#include ++#include ++#include ++ ++static nf_hookfn imq_nf_hook; ++ ++static struct nf_hook_ops imq_ingress_ipv4 = { ++ .hook = imq_nf_hook, ++ .owner = THIS_MODULE, ++ .pf = PF_INET, ++ .hooknum = NF_INET_PRE_ROUTING, ++#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB) ++ .priority = NF_IP_PRI_MANGLE + 1 ++#else ++ .priority = NF_IP_PRI_NAT_DST + 1 ++#endif ++}; ++ ++static struct nf_hook_ops imq_egress_ipv4 = { ++ .hook = imq_nf_hook, ++ .owner = THIS_MODULE, ++ .pf = PF_INET, ++ .hooknum = NF_INET_POST_ROUTING, ++#if defined(CONFIG_IMQ_BEHAVIOR_AA) || defined(CONFIG_IMQ_BEHAVIOR_BA) ++ .priority = NF_IP_PRI_LAST ++#else ++ .priority = NF_IP_PRI_NAT_SRC - 1 ++#endif ++}; ++ ++#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) ++static struct nf_hook_ops imq_ingress_ipv6 = { ++ .hook = imq_nf_hook, ++ .owner = THIS_MODULE, ++ .pf = PF_INET6, ++ .hooknum = NF_INET_PRE_ROUTING, ++#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB) ++ .priority = NF_IP6_PRI_MANGLE + 1 ++#else ++ .priority = NF_IP6_PRI_NAT_DST + 1 ++#endif ++}; ++ ++static struct nf_hook_ops imq_egress_ipv6 = { ++ .hook = imq_nf_hook, ++ .owner = THIS_MODULE, ++ .pf = PF_INET6, ++ .hooknum = NF_INET_POST_ROUTING, ++#if defined(CONFIG_IMQ_BEHAVIOR_AA) || defined(CONFIG_IMQ_BEHAVIOR_BA) ++ .priority = NF_IP6_PRI_LAST ++#else ++ .priority = NF_IP6_PRI_NAT_SRC - 1 ++#endif ++}; ++#endif ++ ++#if defined(CONFIG_IMQ_NUM_DEVS) ++static unsigned int numdevs = CONFIG_IMQ_NUM_DEVS; ++#else ++static unsigned int numdevs = IMQ_MAX_DEVS; ++#endif ++ ++static DEFINE_SPINLOCK(imq_nf_queue_lock); ++ ++static struct net_device *imq_devs_cache[IMQ_MAX_DEVS]; ++ ++ ++static struct net_device_stats *imq_get_stats(struct net_device *dev) ++{ ++ return &dev->stats; ++} ++ ++/* called for packets kfree'd in qdiscs at places other than enqueue */ ++static void imq_skb_destructor(struct sk_buff *skb) ++{ ++ struct nf_queue_entry *entry = skb->nf_queue_entry; ++ ++ if (entry) { ++ nf_queue_entry_release_refs(entry); ++ kfree(entry); ++ } ++ ++ skb_restore_cb(skb); /* kfree backup */ ++} ++ ++static void imq_nf_reinject(struct nf_queue_entry *entry, unsigned int verdict) ++{ ++ int status; ++ ++ if (!entry->next_outfn) { ++ spin_lock_bh(&imq_nf_queue_lock); ++ nf_reinject(entry, verdict); ++ spin_unlock_bh(&imq_nf_queue_lock); ++ return; ++ } ++ ++ rcu_read_lock(); ++ local_bh_disable(); ++ status = entry->next_outfn(entry, entry->next_queuenum); ++ local_bh_enable(); ++ if (status < 0) { ++ nf_queue_entry_release_refs(entry); ++ kfree_skb(entry->skb); ++ kfree(entry); ++ } ++ ++ rcu_read_unlock(); ++} ++ ++static int imq_dev_xmit(struct sk_buff *skb, struct net_device *dev) ++{ ++ dev->stats.tx_bytes += skb->len; ++ dev->stats.tx_packets++; ++ ++ skb->imq_flags = 0; ++ skb->destructor = NULL; ++ ++ skb_restore_cb(skb); /* restore skb->cb */ ++ ++ dev->trans_start = jiffies; ++ imq_nf_reinject(skb->nf_queue_entry, NF_ACCEPT); ++ return 0; ++} ++ ++static int imq_nf_queue(struct nf_queue_entry *entry, unsigned queue_num) ++{ ++ struct net_device *dev; ++ struct sk_buff *skb_orig, *skb, *skb_shared; ++ struct Qdisc *q; ++ struct netdev_queue *txq; ++ int users, index; ++ int retval = -EINVAL; ++ ++ index = entry->skb->imq_flags & IMQ_F_IFMASK; ++ if (unlikely(index > numdevs - 1)) { ++ if (net_ratelimit()) ++ printk(KERN_WARNING ++ "IMQ: invalid device specified, highest is %u\n", ++ numdevs - 1); ++ retval = -EINVAL; ++ goto out; ++ } ++ ++ /* check for imq device by index from cache */ ++ dev = imq_devs_cache[index]; ++ if (unlikely(!dev)) { ++ char buf[8]; ++ ++ /* get device by name and cache result */ ++ snprintf(buf, sizeof(buf), "imq%d", index); ++ dev = dev_get_by_name(&init_net, buf); ++ if (!dev) { ++ /* not found ?!*/ ++ BUG(); ++ retval = -ENODEV; ++ goto out; ++ } ++ ++ imq_devs_cache[index] = dev; ++ dev_put(dev); ++ } ++ ++ if (unlikely(!(dev->flags & IFF_UP))) { ++ entry->skb->imq_flags = 0; ++ imq_nf_reinject(entry, NF_ACCEPT); ++ retval = 0; ++ goto out; ++ } ++ dev->last_rx = jiffies; ++ ++ skb = entry->skb; ++ skb_orig = NULL; ++ ++ /* skb has owner? => make clone */ ++ if (unlikely(skb->destructor)) { ++ skb_orig = skb; ++ skb = skb_clone(skb, GFP_ATOMIC); ++ if (!skb) { ++ retval = -ENOMEM; ++ goto out; ++ } ++ entry->skb = skb; ++ } ++ ++ skb->nf_queue_entry = entry; ++ ++ dev->stats.rx_bytes += skb->len; ++ dev->stats.rx_packets++; ++ ++ txq = dev_pick_tx(dev, skb); ++ ++ q = rcu_dereference(txq->qdisc); ++ if (unlikely(!q->enqueue)) ++ goto packet_not_eaten_by_imq_dev; ++ ++ spin_lock_bh(qdisc_lock(q)); ++ ++ users = atomic_read(&skb->users); ++ ++ skb_shared = skb_get(skb); /* increase reference count by one */ ++ skb_save_cb(skb_shared); /* backup skb->cb, as qdisc layer will ++ overwrite it */ ++ qdisc_enqueue_root(skb_shared, q); /* might kfree_skb */ ++ ++ if (likely(atomic_read(&skb_shared->users) == users + 1)) { ++ kfree_skb(skb_shared); /* decrease reference count by one */ ++ ++ skb->destructor = &imq_skb_destructor; ++ ++ /* cloned? */ ++ if (skb_orig) ++ kfree_skb(skb_orig); /* free original */ ++ ++ spin_unlock_bh(qdisc_lock(q)); ++ ++ /* schedule qdisc dequeue */ ++ __netif_schedule(q); ++ ++ retval = 0; ++ goto out; ++ } else { ++ skb_restore_cb(skb_shared); /* restore skb->cb */ ++ /* qdisc dropped packet and decreased skb reference count of ++ * skb, so we don't really want to and try refree as that would ++ * actually destroy the skb. */ ++ spin_unlock_bh(qdisc_lock(q)); ++ goto packet_not_eaten_by_imq_dev; ++ } ++ ++packet_not_eaten_by_imq_dev: ++ /* cloned? restore original */ ++ if (skb_orig) { ++ kfree_skb(skb); ++ entry->skb = skb_orig; ++ } ++ retval = -1; ++out: ++ return retval; ++} ++ ++static struct nf_queue_handler nfqh = { ++ .name = "imq", ++ .outfn = imq_nf_queue, ++}; ++ ++static unsigned int imq_nf_hook(unsigned int hook, struct sk_buff *pskb, ++ const struct net_device *indev, ++ const struct net_device *outdev, ++ int (*okfn)(struct sk_buff *)) ++{ ++ if (pskb->imq_flags & IMQ_F_ENQUEUE) ++ return NF_QUEUE; ++ ++ return NF_ACCEPT; ++} ++ ++static int imq_close(struct net_device *dev) ++{ ++ netif_stop_queue(dev); ++ return 0; ++} ++ ++static int imq_open(struct net_device *dev) ++{ ++ netif_start_queue(dev); ++ return 0; ++} ++ ++static const struct net_device_ops imq_netdev_ops = { ++ .ndo_open = imq_open, ++ .ndo_stop = imq_close, ++ .ndo_start_xmit = imq_dev_xmit, ++ .ndo_get_stats = imq_get_stats, ++}; ++ ++static void imq_setup(struct net_device *dev) ++{ ++ dev->netdev_ops = &imq_netdev_ops; ++ dev->type = ARPHRD_VOID; ++ dev->mtu = 16000; ++ dev->tx_queue_len = 11000; ++ dev->flags = IFF_NOARP; ++ dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | ++ NETIF_F_GSO | NETIF_F_HW_CSUM | ++ NETIF_F_HIGHDMA; ++} ++ ++static int imq_validate(struct nlattr *tb[], struct nlattr *data[]) ++{ ++ int ret = 0; ++ ++ if (tb[IFLA_ADDRESS]) { ++ if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN) { ++ ret = -EINVAL; ++ goto end; ++ } ++ if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS]))) { ++ ret = -EADDRNOTAVAIL; ++ goto end; ++ } ++ } ++ return 0; ++end: ++ printk(KERN_WARNING "IMQ: imq_validate failed (%d)\n", ret); ++ return ret; ++} ++ ++static struct rtnl_link_ops imq_link_ops __read_mostly = { ++ .kind = "imq", ++ .priv_size = 0, ++ .setup = imq_setup, ++ .validate = imq_validate, ++}; ++ ++static int __init imq_init_hooks(void) ++{ ++ int err; ++ ++ nf_register_queue_imq_handler(&nfqh); ++ ++ err = nf_register_hook(&imq_ingress_ipv4); ++ if (err) ++ goto err1; ++ ++ err = nf_register_hook(&imq_egress_ipv4); ++ if (err) ++ goto err2; ++ ++#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) ++ err = nf_register_hook(&imq_ingress_ipv6); ++ if (err) ++ goto err3; ++ ++ err = nf_register_hook(&imq_egress_ipv6); ++ if (err) ++ goto err4; ++#endif ++ ++ return 0; ++ ++#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) ++err4: ++ nf_unregister_hook(&imq_ingress_ipv6); ++err3: ++ nf_unregister_hook(&imq_egress_ipv4); ++#endif ++err2: ++ nf_unregister_hook(&imq_ingress_ipv4); ++err1: ++ nf_unregister_queue_imq_handler(); ++ return err; ++} ++ ++static int __init imq_init_one(int index) ++{ ++ struct net_device *dev; ++ int ret; ++ ++ dev = alloc_netdev(0, "imq%d", imq_setup); ++ if (!dev) ++ return -ENOMEM; ++ ++ ret = dev_alloc_name(dev, dev->name); ++ if (ret < 0) ++ goto fail; ++ ++ dev->rtnl_link_ops = &imq_link_ops; ++ ret = register_netdevice(dev); ++ if (ret < 0) ++ goto fail; ++ ++ return 0; ++fail: ++ free_netdev(dev); ++ return ret; ++} ++ ++static int __init imq_init_devs(void) ++{ ++ int err, i; ++ ++ if (numdevs < 1 || numdevs > IMQ_MAX_DEVS) { ++ printk(KERN_ERR "IMQ: numdevs has to be betweed 1 and %u\n", ++ IMQ_MAX_DEVS); ++ return -EINVAL; ++ } ++ ++ rtnl_lock(); ++ err = __rtnl_link_register(&imq_link_ops); ++ ++ for (i = 0; i < numdevs && !err; i++) ++ err = imq_init_one(i); ++ ++ if (err) { ++ __rtnl_link_unregister(&imq_link_ops); ++ memset(imq_devs_cache, 0, sizeof(imq_devs_cache)); ++ } ++ rtnl_unlock(); ++ ++ return err; ++} ++ ++static int __init imq_init_module(void) ++{ ++ int err; ++ ++#if defined(CONFIG_IMQ_NUM_DEVS) ++ BUILD_BUG_ON(CONFIG_IMQ_NUM_DEVS > 16); ++ BUILD_BUG_ON(CONFIG_IMQ_NUM_DEVS < 2); ++ BUILD_BUG_ON(CONFIG_IMQ_NUM_DEVS - 1 > IMQ_F_IFMASK); ++#endif ++ ++ err = imq_init_devs(); ++ if (err) { ++ printk(KERN_ERR "IMQ: Error trying imq_init_devs(net)\n"); ++ return err; ++ } ++ ++ err = imq_init_hooks(); ++ if (err) { ++ printk(KERN_ERR "IMQ: Error trying imq_init_hooks()\n"); ++ rtnl_link_unregister(&imq_link_ops); ++ memset(imq_devs_cache, 0, sizeof(imq_devs_cache)); ++ return err; ++ } ++ ++ printk(KERN_INFO "IMQ driver loaded successfully.\n"); ++ ++#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB) ++ printk(KERN_INFO "\tHooking IMQ before NAT on PREROUTING.\n"); ++#else ++ printk(KERN_INFO "\tHooking IMQ after NAT on PREROUTING.\n"); ++#endif ++#if defined(CONFIG_IMQ_BEHAVIOR_AB) || defined(CONFIG_IMQ_BEHAVIOR_BB) ++ printk(KERN_INFO "\tHooking IMQ before NAT on POSTROUTING.\n"); ++#else ++ printk(KERN_INFO "\tHooking IMQ after NAT on POSTROUTING.\n"); ++#endif ++ ++ return 0; ++} ++ ++static void __exit imq_unhook(void) ++{ ++#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) ++ nf_unregister_hook(&imq_ingress_ipv6); ++ nf_unregister_hook(&imq_egress_ipv6); ++#endif ++ nf_unregister_hook(&imq_ingress_ipv4); ++ nf_unregister_hook(&imq_egress_ipv4); ++ ++ nf_unregister_queue_imq_handler(); ++} ++ ++static void __exit imq_cleanup_devs(void) ++{ ++ rtnl_link_unregister(&imq_link_ops); ++ memset(imq_devs_cache, 0, sizeof(imq_devs_cache)); ++} ++ ++static void __exit imq_exit_module(void) ++{ ++ imq_unhook(); ++ imq_cleanup_devs(); ++ printk(KERN_INFO "IMQ driver unloaded successfully.\n"); ++} ++ ++module_init(imq_init_module); ++module_exit(imq_exit_module); ++ ++module_param(numdevs, int, 0); ++MODULE_PARM_DESC(numdevs, "number of IMQ devices (how many imq* devices will " ++ "be created)"); ++MODULE_AUTHOR("http://www.linuximq.net"); ++MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See " ++ "http://www.linuximq.net/ for more information."); ++MODULE_LICENSE("GPL"); ++MODULE_ALIAS_RTNL_LINK("imq"); ++ +--- a/drivers/net/Kconfig ++++ b/drivers/net/Kconfig +@@ -109,6 +109,129 @@ config EQUALIZER + To compile this driver as a module, choose M here: the module + will be called eql. If unsure, say N. + ++config IMQ ++ tristate "IMQ (intermediate queueing device) support" ++ depends on NETDEVICES && NETFILTER ++ ---help--- ++ The IMQ device(s) is used as placeholder for QoS queueing ++ disciplines. Every packet entering/leaving the IP stack can be ++ directed through the IMQ device where it's enqueued/dequeued to the ++ attached qdisc. This allows you to treat network devices as classes ++ and distribute bandwidth among them. Iptables is used to specify ++ through which IMQ device, if any, packets travel. ++ ++ More information at: http://www.linuximq.net/ ++ ++ To compile this driver as a module, choose M here: the module ++ will be called imq. If unsure, say N. ++ ++choice ++ prompt "IMQ behavior (PRE/POSTROUTING)" ++ depends on IMQ ++ default IMQ_BEHAVIOR_AB ++ help ++ ++ This settings defines how IMQ behaves in respect to its ++ hooking in PREROUTING and POSTROUTING. ++ ++ IMQ can work in any of the following ways: ++ ++ PREROUTING | POSTROUTING ++ -----------------|------------------- ++ #1 After NAT | After NAT ++ #2 After NAT | Before NAT ++ #3 Before NAT | After NAT ++ #4 Before NAT | Before NAT ++ ++ The default behavior is to hook before NAT on PREROUTING ++ and after NAT on POSTROUTING (#3). ++ ++ This settings are specially usefull when trying to use IMQ ++ to shape NATed clients. ++ ++ More information can be found at: www.linuximq.net ++ ++ If not sure leave the default settings alone. ++ ++config IMQ_BEHAVIOR_AA ++ bool "IMQ AA" ++ help ++ This settings defines how IMQ behaves in respect to its ++ hooking in PREROUTING and POSTROUTING. ++ ++ Choosing this option will make IMQ hook like this: ++ ++ PREROUTING: After NAT ++ POSTROUTING: After NAT ++ ++ More information can be found at: www.linuximq.net ++ ++ If not sure leave the default settings alone. ++ ++config IMQ_BEHAVIOR_AB ++ bool "IMQ AB" ++ help ++ This settings defines how IMQ behaves in respect to its ++ hooking in PREROUTING and POSTROUTING. ++ ++ Choosing this option will make IMQ hook like this: ++ ++ PREROUTING: After NAT ++ POSTROUTING: Before NAT ++ ++ More information can be found at: www.linuximq.net ++ ++ If not sure leave the default settings alone. ++ ++config IMQ_BEHAVIOR_BA ++ bool "IMQ BA" ++ help ++ This settings defines how IMQ behaves in respect to its ++ hooking in PREROUTING and POSTROUTING. ++ ++ Choosing this option will make IMQ hook like this: ++ ++ PREROUTING: Before NAT ++ POSTROUTING: After NAT ++ ++ More information can be found at: www.linuximq.net ++ ++ If not sure leave the default settings alone. ++ ++config IMQ_BEHAVIOR_BB ++ bool "IMQ BB" ++ help ++ This settings defines how IMQ behaves in respect to its ++ hooking in PREROUTING and POSTROUTING. ++ ++ Choosing this option will make IMQ hook like this: ++ ++ PREROUTING: Before NAT ++ POSTROUTING: Before NAT ++ ++ More information can be found at: www.linuximq.net ++ ++ If not sure leave the default settings alone. ++ ++endchoice ++ ++config IMQ_NUM_DEVS ++ ++ int "Number of IMQ devices" ++ range 2 16 ++ depends on IMQ ++ default "16" ++ help ++ ++ This settings defines how many IMQ devices will be ++ created. ++ ++ The default value is 16. ++ ++ More information can be found at: www.linuximq.net ++ ++ If not sure leave the default settings alone. ++ + config TUN + tristate "Universal TUN/TAP device driver support" + select CRC32 +--- a/drivers/net/Makefile ++++ b/drivers/net/Makefile +@@ -165,6 +165,7 @@ obj-$(CONFIG_SLHC) += slhc.o + obj-$(CONFIG_XEN_NETDEV_FRONTEND) += xen-netfront.o + + obj-$(CONFIG_DUMMY) += dummy.o ++obj-$(CONFIG_IMQ) += imq.o + obj-$(CONFIG_IFB) += ifb.o + obj-$(CONFIG_MACVLAN) += macvlan.o + obj-$(CONFIG_DE600) += de600.o +--- /dev/null ++++ b/include/linux/imq.h +@@ -0,0 +1,13 @@ ++#ifndef _IMQ_H ++#define _IMQ_H ++ ++/* IFMASK (16 device indexes, 0 to 15) and flag(s) fit in 5 bits */ ++#define IMQ_F_BITS 5 ++ ++#define IMQ_F_IFMASK 0x0f ++#define IMQ_F_ENQUEUE 0x10 ++ ++#define IMQ_MAX_DEVS (IMQ_F_IFMASK + 1) ++ ++#endif /* _IMQ_H */ ++ +--- /dev/null ++++ b/include/linux/netfilter_ipv4/ipt_IMQ.h +@@ -0,0 +1,10 @@ ++#ifndef _IPT_IMQ_H ++#define _IPT_IMQ_H ++ ++/* Backwards compatibility for old userspace */ ++#include ++ ++#define ipt_imq_info xt_imq_info ++ ++#endif /* _IPT_IMQ_H */ ++ +--- /dev/null ++++ b/include/linux/netfilter_ipv6/ip6t_IMQ.h +@@ -0,0 +1,10 @@ ++#ifndef _IP6T_IMQ_H ++#define _IP6T_IMQ_H ++ ++/* Backwards compatibility for old userspace */ ++#include ++ ++#define ip6t_imq_info xt_imq_info ++ ++#endif /* _IP6T_IMQ_H */ ++ +--- a/include/linux/skbuff.h ++++ b/include/linux/skbuff.h +@@ -29,6 +29,9 @@ + #include + #include + #include ++#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) ++#include ++#endif + + /* Don't change this without changing skb_csum_unnecessary! */ + #define CHECKSUM_NONE 0 +@@ -330,6 +333,9 @@ struct sk_buff { + * first. This is owned by whoever has the skb queued ATM. + */ + char cb[48]; ++#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) ++ void *cb_next; ++#endif + + unsigned int len, + data_len; +@@ -362,6 +368,9 @@ struct sk_buff { + struct nf_conntrack *nfct; + struct sk_buff *nfct_reasm; + #endif ++#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) ++ struct nf_queue_entry *nf_queue_entry; ++#endif + #ifdef CONFIG_BRIDGE_NETFILTER + struct nf_bridge_info *nf_bridge; + #endif +@@ -382,6 +391,9 @@ struct sk_buff { + kmemcheck_bitfield_end(flags2); + + /* 0/14 bit hole */ ++#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) ++ __u8 imq_flags:IMQ_F_BITS; ++#endif + + #ifdef CONFIG_NET_DMA + dma_cookie_t dma_cookie; +@@ -437,6 +449,12 @@ static inline struct rtable *skb_rtable( + return (struct rtable *)skb_dst(skb); + } + ++ ++#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) ++extern int skb_save_cb(struct sk_buff *skb); ++extern int skb_restore_cb(struct sk_buff *skb); ++#endif ++ + extern void kfree_skb(struct sk_buff *skb); + extern void consume_skb(struct sk_buff *skb); + extern void __kfree_skb(struct sk_buff *skb); +@@ -1970,6 +1988,10 @@ static inline void __nf_copy(struct sk_b + dst->nfct_reasm = src->nfct_reasm; + nf_conntrack_get_reasm(src->nfct_reasm); + #endif ++#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) ++ dst->imq_flags = src->imq_flags; ++ dst->nf_queue_entry = src->nf_queue_entry; ++#endif + #ifdef CONFIG_BRIDGE_NETFILTER + dst->nf_bridge = src->nf_bridge; + nf_bridge_get(src->nf_bridge); +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -96,6 +96,9 @@ + #include + #include + #include ++#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) ++#include ++#endif + #include + #include + #include +@@ -1703,7 +1706,11 @@ int dev_hard_start_xmit(struct sk_buff * + int rc; + + if (likely(!skb->next)) { +- if (!list_empty(&ptype_all)) ++ if (!list_empty(&ptype_all) ++#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) ++ && !(skb->imq_flags & IMQ_F_ENQUEUE) ++#endif ++ ) + dev_queue_xmit_nit(skb, dev); + + if (netif_needs_gso(dev, skb)) { +@@ -1788,8 +1795,7 @@ u16 skb_tx_hash(const struct net_device + } + EXPORT_SYMBOL(skb_tx_hash); + +-static struct netdev_queue *dev_pick_tx(struct net_device *dev, +- struct sk_buff *skb) ++struct netdev_queue *dev_pick_tx(struct net_device *dev, struct sk_buff *skb) + { + const struct net_device_ops *ops = dev->netdev_ops; + u16 queue_index = 0; +@@ -1802,6 +1808,7 @@ static struct netdev_queue *dev_pick_tx( + skb_set_queue_mapping(skb, queue_index); + return netdev_get_tx_queue(dev, queue_index); + } ++EXPORT_SYMBOL(dev_pick_tx); + + static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q, + struct net_device *dev, +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h +@@ -1114,6 +1114,7 @@ extern int dev_alloc_name(struct net_de + extern int dev_open(struct net_device *dev); + extern int dev_close(struct net_device *dev); + extern void dev_disable_lro(struct net_device *dev); ++extern struct netdev_queue *dev_pick_tx(struct net_device *dev, struct sk_buff *skb); + extern int dev_queue_xmit(struct sk_buff *skb); + extern int register_netdevice(struct net_device *dev); + extern void unregister_netdevice(struct net_device *dev); +--- /dev/null ++++ b/include/linux/netfilter/xt_IMQ.h +@@ -0,0 +1,9 @@ ++#ifndef _XT_IMQ_H ++#define _XT_IMQ_H ++ ++struct xt_imq_info { ++ unsigned int todev; /* target imq device */ ++}; ++ ++#endif /* _XT_IMQ_H */ ++ +--- a/include/net/netfilter/nf_queue.h ++++ b/include/net/netfilter/nf_queue.h +@@ -13,6 +13,12 @@ struct nf_queue_entry { + struct net_device *indev; + struct net_device *outdev; + int (*okfn)(struct sk_buff *); ++ ++#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) ++ int (*next_outfn)(struct nf_queue_entry *entry, ++ unsigned int queuenum); ++ unsigned int next_queuenum; ++#endif + }; + + #define nf_queue_entry_reroute(x) ((void *)x + sizeof(struct nf_queue_entry)) +@@ -30,5 +36,11 @@ extern int nf_unregister_queue_handler(u + const struct nf_queue_handler *qh); + extern void nf_unregister_queue_handlers(const struct nf_queue_handler *qh); + extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); ++extern void nf_queue_entry_release_refs(struct nf_queue_entry *entry); ++ ++#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) ++extern void nf_register_queue_imq_handler(const struct nf_queue_handler *qh); ++extern void nf_unregister_queue_imq_handler(void); ++#endif + + #endif /* _NF_QUEUE_H */ +--- a/net/core/skbuff.c ++++ b/net/core/skbuff.c +@@ -72,6 +72,9 @@ + + static struct kmem_cache *skbuff_head_cache __read_mostly; + static struct kmem_cache *skbuff_fclone_cache __read_mostly; ++#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) ++static struct kmem_cache *skbuff_cb_store_cache __read_mostly; ++#endif + + static void sock_pipe_buf_release(struct pipe_inode_info *pipe, + struct pipe_buffer *buf) +@@ -91,6 +94,80 @@ static int sock_pipe_buf_steal(struct pi + return 1; + } + ++#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) ++/* Control buffer save/restore for IMQ devices */ ++struct skb_cb_table { ++ void *cb_next; ++ atomic_t refcnt; ++ char cb[48]; ++}; ++ ++static DEFINE_SPINLOCK(skb_cb_store_lock); ++ ++int skb_save_cb(struct sk_buff *skb) ++{ ++ struct skb_cb_table *next; ++ ++ next = kmem_cache_alloc(skbuff_cb_store_cache, GFP_ATOMIC); ++ if (!next) ++ return -ENOMEM; ++ ++ BUILD_BUG_ON(sizeof(skb->cb) != sizeof(next->cb)); ++ ++ memcpy(next->cb, skb->cb, sizeof(skb->cb)); ++ next->cb_next = skb->cb_next; ++ ++ atomic_set(&next->refcnt, 1); ++ ++ skb->cb_next = next; ++ return 0; ++} ++EXPORT_SYMBOL(skb_save_cb); ++ ++int skb_restore_cb(struct sk_buff *skb) ++{ ++ struct skb_cb_table *next; ++ ++ if (!skb->cb_next) ++ return 0; ++ ++ next = skb->cb_next; ++ ++ BUILD_BUG_ON(sizeof(skb->cb) != sizeof(next->cb)); ++ ++ memcpy(skb->cb, next->cb, sizeof(skb->cb)); ++ skb->cb_next = next->cb_next; ++ ++ spin_lock(&skb_cb_store_lock); ++ ++ if (atomic_dec_and_test(&next->refcnt)) { ++ kmem_cache_free(skbuff_cb_store_cache, next); ++ } ++ ++ spin_unlock(&skb_cb_store_lock); ++ ++ return 0; ++} ++EXPORT_SYMBOL(skb_restore_cb); ++ ++static void skb_copy_stored_cb(struct sk_buff *new, struct sk_buff *old) ++{ ++ struct skb_cb_table *next; ++ ++ if (!old->cb_next) { ++ new->cb_next = 0; ++ return; ++ } ++ ++ spin_lock(&skb_cb_store_lock); ++ ++ next = old->cb_next; ++ atomic_inc(&next->refcnt); ++ new->cb_next = next; ++ ++ spin_unlock(&skb_cb_store_lock); ++} ++#endif + + /* Pipe buffer operations for a socket. */ + static struct pipe_buf_operations sock_pipe_buf_ops = { +@@ -398,6 +475,15 @@ static void skb_release_head_state(struc + WARN_ON(in_irq()); + skb->destructor(skb); + } ++#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) ++ /* This should not happen. When it does, avoid memleak by restoring ++ the chain of cb-backups. */ ++ while(skb->cb_next != NULL) { ++ printk(KERN_WARNING "kfree_skb: skb->cb_next: %08x\n", ++ skb->cb_next); ++ skb_restore_cb(skb); ++ } ++#endif + #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) + nf_conntrack_put(skb->nfct); + nf_conntrack_put_reasm(skb->nfct_reasm); +@@ -535,6 +621,9 @@ static void __copy_skb_header(struct sk_ + new->sp = secpath_get(old->sp); + #endif + memcpy(new->cb, old->cb, sizeof(old->cb)); ++#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) ++ skb_copy_stored_cb(new, old); ++#endif + new->csum = old->csum; + new->local_df = old->local_df; + new->pkt_type = old->pkt_type; +@@ -2775,6 +2864,13 @@ void __init skb_init(void) + 0, + SLAB_HWCACHE_ALIGN|SLAB_PANIC, + NULL); ++#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) ++ skbuff_cb_store_cache = kmem_cache_create("skbuff_cb_store_cache", ++ sizeof(struct skb_cb_table), ++ 0, ++ SLAB_HWCACHE_ALIGN|SLAB_PANIC, ++ NULL); ++#endif + } + + /** +--- a/net/netfilter/Kconfig ++++ b/net/netfilter/Kconfig +@@ -396,6 +396,18 @@ config NETFILTER_XT_TARGET_LED + For more information on the LEDs available on your system, see + Documentation/leds-class.txt + ++config NETFILTER_XT_TARGET_IMQ ++ tristate '"IMQ" target support' ++ depends on NETFILTER_XTABLES ++ depends on IP_NF_MANGLE || IP6_NF_MANGLE ++ select IMQ ++ default m if NETFILTER_ADVANCED=n ++ help ++ This option adds a `IMQ' target which is used to specify if and ++ to which imq device packets should get enqueued/dequeued. ++ ++ To compile it as a module, choose M here. If unsure, say N. ++ + config NETFILTER_XT_TARGET_MARK + tristate '"MARK" target support' + default m if NETFILTER_ADVANCED=n +--- a/net/netfilter/Makefile ++++ b/net/netfilter/Makefile +@@ -46,6 +46,7 @@ obj-$(CONFIG_NETFILTER_XT_TARGET_CONNMAR + obj-$(CONFIG_NETFILTER_XT_TARGET_CONNSECMARK) += xt_CONNSECMARK.o + obj-$(CONFIG_NETFILTER_XT_TARGET_DSCP) += xt_DSCP.o + obj-$(CONFIG_NETFILTER_XT_TARGET_HL) += xt_HL.o ++obj-$(CONFIG_NETFILTER_XT_TARGET_IMQ) += xt_IMQ.o + obj-$(CONFIG_NETFILTER_XT_TARGET_LED) += xt_LED.o + obj-$(CONFIG_NETFILTER_XT_TARGET_MARK) += xt_MARK.o + obj-$(CONFIG_NETFILTER_XT_TARGET_NFLOG) += xt_NFLOG.o +--- a/net/netfilter/nf_queue.c ++++ b/net/netfilter/nf_queue.c +@@ -20,6 +20,26 @@ static const struct nf_queue_handler *qu + + static DEFINE_MUTEX(queue_handler_mutex); + ++#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) ++static const struct nf_queue_handler *queue_imq_handler; ++ ++void nf_register_queue_imq_handler(const struct nf_queue_handler *qh) ++{ ++ mutex_lock(&queue_handler_mutex); ++ rcu_assign_pointer(queue_imq_handler, qh); ++ mutex_unlock(&queue_handler_mutex); ++} ++EXPORT_SYMBOL(nf_register_queue_imq_handler); ++ ++void nf_unregister_queue_imq_handler(void) ++{ ++ mutex_lock(&queue_handler_mutex); ++ rcu_assign_pointer(queue_imq_handler, NULL); ++ mutex_unlock(&queue_handler_mutex); ++} ++EXPORT_SYMBOL(nf_unregister_queue_imq_handler); ++#endif ++ + /* return EBUSY when somebody else is registered, return EEXIST if the + * same handler is registered, return 0 in case of success. */ + int nf_register_queue_handler(u_int8_t pf, const struct nf_queue_handler *qh) +@@ -80,7 +100,7 @@ void nf_unregister_queue_handlers(const + } + EXPORT_SYMBOL_GPL(nf_unregister_queue_handlers); + +-static void nf_queue_entry_release_refs(struct nf_queue_entry *entry) ++void nf_queue_entry_release_refs(struct nf_queue_entry *entry) + { + /* Release those devices we held, or Alexey will kill me. */ + if (entry->indev) +@@ -100,6 +120,7 @@ static void nf_queue_entry_release_refs( + /* Drop reference to owner of hook which queued us. */ + module_put(entry->elem->owner); + } ++EXPORT_SYMBOL_GPL(nf_queue_entry_release_refs); + + /* + * Any packet that leaves via this function must come back +@@ -121,12 +142,26 @@ static int __nf_queue(struct sk_buff *sk + #endif + const struct nf_afinfo *afinfo; + const struct nf_queue_handler *qh; ++#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) ++ const struct nf_queue_handler *qih = NULL; ++#endif + + /* QUEUE == DROP if noone is waiting, to be safe. */ + rcu_read_lock(); + + qh = rcu_dereference(queue_handler[pf]); ++#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) ++#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) ++ if (pf == PF_INET || pf == PF_INET6) ++#else ++ if (pf == PF_INET) ++#endif ++ qih = rcu_dereference(queue_imq_handler); ++ ++ if (!qh && !qih) ++#else /* !IMQ */ + if (!qh) ++#endif + goto err_unlock; + + afinfo = nf_get_afinfo(pf); +@@ -145,6 +180,10 @@ static int __nf_queue(struct sk_buff *sk + .indev = indev, + .outdev = outdev, + .okfn = okfn, ++#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) ++ .next_outfn = qh ? qh->outfn : NULL, ++ .next_queuenum = queuenum, ++#endif + }; + + /* If it's going away, ignore hook. */ +@@ -170,8 +209,19 @@ static int __nf_queue(struct sk_buff *sk + } + #endif + afinfo->saveroute(skb, entry); ++ ++#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) ++ if (qih) { ++ status = qih->outfn(entry, queuenum); ++ goto imq_skip_queue; ++ } ++#endif ++ + status = qh->outfn(entry, queuenum); + ++#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) ++imq_skip_queue: ++#endif + rcu_read_unlock(); + + if (status < 0) { +--- /dev/null ++++ b/net/netfilter/xt_IMQ.c +@@ -0,0 +1,73 @@ ++/* ++ * This target marks packets to be enqueued to an imq device ++ */ ++#include ++#include ++#include ++#include ++#include ++ ++static unsigned int imq_target(struct sk_buff *pskb, ++ const struct xt_target_param *par) ++{ ++ const struct xt_imq_info *mr = par->targinfo; ++ ++ pskb->imq_flags = (mr->todev & IMQ_F_IFMASK) | IMQ_F_ENQUEUE; ++ ++ return XT_CONTINUE; ++} ++ ++static bool imq_checkentry(const struct xt_tgchk_param *par) ++{ ++ struct xt_imq_info *mr = par->targinfo; ++ ++ if (mr->todev > IMQ_MAX_DEVS - 1) { ++ printk(KERN_WARNING ++ "IMQ: invalid device specified, highest is %u\n", ++ IMQ_MAX_DEVS - 1); ++ return 0; ++ } ++ ++ return 1; ++} ++ ++static struct xt_target xt_imq_reg[] __read_mostly = { ++ { ++ .name = "IMQ", ++ .family = AF_INET, ++ .checkentry = imq_checkentry, ++ .target = imq_target, ++ .targetsize = sizeof(struct xt_imq_info), ++ .table = "mangle", ++ .me = THIS_MODULE ++ }, ++ { ++ .name = "IMQ", ++ .family = AF_INET6, ++ .checkentry = imq_checkentry, ++ .target = imq_target, ++ .targetsize = sizeof(struct xt_imq_info), ++ .table = "mangle", ++ .me = THIS_MODULE ++ }, ++}; ++ ++static int __init imq_init(void) ++{ ++ return xt_register_targets(xt_imq_reg, ARRAY_SIZE(xt_imq_reg)); ++} ++ ++static void __exit imq_fini(void) ++{ ++ xt_unregister_targets(xt_imq_reg, ARRAY_SIZE(xt_imq_reg)); ++} ++ ++module_init(imq_init); ++module_exit(imq_fini); ++ ++MODULE_AUTHOR("http://www.linuximq.net"); ++MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See http://www.linuximq.net/ for more information."); ++MODULE_LICENSE("GPL"); ++MODULE_ALIAS("ipt_IMQ"); ++MODULE_ALIAS("ip6t_IMQ"); ++ diff --git a/target/linux/generic-2.6/patches-2.6.32/180-netfilter_depends.patch b/target/linux/generic-2.6/patches-2.6.32/180-netfilter_depends.patch new file mode 100644 index 000000000..fc00d159c --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/180-netfilter_depends.patch @@ -0,0 +1,18 @@ +--- a/net/netfilter/Kconfig ++++ b/net/netfilter/Kconfig +@@ -160,7 +160,6 @@ config NF_CONNTRACK_FTP + + config NF_CONNTRACK_H323 + tristate "H.323 protocol support" +- depends on (IPV6 || IPV6=n) + depends on NETFILTER_ADVANCED + help + H.323 is a VoIP signalling protocol from ITU-T. As one of the most +@@ -505,7 +504,6 @@ config NETFILTER_XT_TARGET_SECMARK + + config NETFILTER_XT_TARGET_TCPMSS + tristate '"TCPMSS" target support' +- depends on (IPV6 || IPV6=n) + default m if NETFILTER_ADVANCED=n + ---help--- + This option adds a `TCPMSS' target, which allows you to alter the diff --git a/target/linux/generic-2.6/patches-2.6.32/190-netfilter_rtsp.patch b/target/linux/generic-2.6/patches-2.6.32/190-netfilter_rtsp.patch new file mode 100644 index 000000000..29e82084c --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/190-netfilter_rtsp.patch @@ -0,0 +1,1366 @@ +--- /dev/null ++++ b/include/linux/netfilter/nf_conntrack_rtsp.h +@@ -0,0 +1,63 @@ ++/* ++ * RTSP extension for IP connection tracking. ++ * (C) 2003 by Tom Marshall ++ * based on ip_conntrack_irc.h ++ * ++ * 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 of the License, or (at your option) any later version. ++ */ ++#ifndef _IP_CONNTRACK_RTSP_H ++#define _IP_CONNTRACK_RTSP_H ++ ++//#define IP_NF_RTSP_DEBUG 1 ++#define IP_NF_RTSP_VERSION "0.6.21" ++ ++#ifdef __KERNEL__ ++/* port block types */ ++typedef enum { ++ pb_single, /* client_port=x */ ++ pb_range, /* client_port=x-y */ ++ pb_discon /* client_port=x/y (rtspbis) */ ++} portblock_t; ++ ++/* We record seq number and length of rtsp headers here, all in host order. */ ++ ++/* ++ * This structure is per expected connection. It is a member of struct ++ * ip_conntrack_expect. The TCP SEQ for the conntrack expect is stored ++ * there and we are expected to only store the length of the data which ++ * needs replaced. If a packet contains multiple RTSP messages, we create ++ * one expected connection per message. ++ * ++ * We use these variables to mark the entire header block. This may seem ++ * like overkill, but the nature of RTSP requires it. A header may appear ++ * multiple times in a message. We must treat two Transport headers the ++ * same as one Transport header with two entries. ++ */ ++struct ip_ct_rtsp_expect ++{ ++ u_int32_t len; /* length of header block */ ++ portblock_t pbtype; /* Type of port block that was requested */ ++ u_int16_t loport; /* Port that was requested, low or first */ ++ u_int16_t hiport; /* Port that was requested, high or second */ ++#if 0 ++ uint method; /* RTSP method */ ++ uint cseq; /* CSeq from request */ ++#endif ++}; ++ ++extern unsigned int (*nf_nat_rtsp_hook)(struct sk_buff *skb, ++ enum ip_conntrack_info ctinfo, ++ unsigned int matchoff, unsigned int matchlen, ++ struct ip_ct_rtsp_expect *prtspexp, ++ struct nf_conntrack_expect *exp); ++ ++extern void (*nf_nat_rtsp_hook_expectfn)(struct nf_conn *ct, struct nf_conntrack_expect *exp); ++ ++#define RTSP_PORT 554 ++ ++#endif /* __KERNEL__ */ ++ ++#endif /* _IP_CONNTRACK_RTSP_H */ +--- /dev/null ++++ b/include/linux/netfilter_helpers.h +@@ -0,0 +1,133 @@ ++/* ++ * Helpers for netfiler modules. This file provides implementations for basic ++ * functions such as strncasecmp(), etc. ++ * ++ * gcc will warn for defined but unused functions, so we only include the ++ * functions requested. The following macros are used: ++ * NF_NEED_STRNCASECMP nf_strncasecmp() ++ * NF_NEED_STRTOU16 nf_strtou16() ++ * NF_NEED_STRTOU32 nf_strtou32() ++ */ ++#ifndef _NETFILTER_HELPERS_H ++#define _NETFILTER_HELPERS_H ++ ++/* Only include these functions for kernel code. */ ++#ifdef __KERNEL__ ++ ++#include ++#define iseol(c) ( (c) == '\r' || (c) == '\n' ) ++ ++/* ++ * The standard strncasecmp() ++ */ ++#ifdef NF_NEED_STRNCASECMP ++static int ++nf_strncasecmp(const char* s1, const char* s2, u_int32_t len) ++{ ++ if (s1 == NULL || s2 == NULL) ++ { ++ if (s1 == NULL && s2 == NULL) ++ { ++ return 0; ++ } ++ return (s1 == NULL) ? -1 : 1; ++ } ++ while (len > 0 && tolower(*s1) == tolower(*s2)) ++ { ++ len--; ++ s1++; ++ s2++; ++ } ++ return ( (len == 0) ? 0 : (tolower(*s1) - tolower(*s2)) ); ++} ++#endif /* NF_NEED_STRNCASECMP */ ++ ++/* ++ * Parse a string containing a 16-bit unsigned integer. ++ * Returns the number of chars used, or zero if no number is found. ++ */ ++#ifdef NF_NEED_STRTOU16 ++static int ++nf_strtou16(const char* pbuf, u_int16_t* pval) ++{ ++ int n = 0; ++ ++ *pval = 0; ++ while (isdigit(pbuf[n])) ++ { ++ *pval = (*pval * 10) + (pbuf[n] - '0'); ++ n++; ++ } ++ ++ return n; ++} ++#endif /* NF_NEED_STRTOU16 */ ++ ++/* ++ * Parse a string containing a 32-bit unsigned integer. ++ * Returns the number of chars used, or zero if no number is found. ++ */ ++#ifdef NF_NEED_STRTOU32 ++static int ++nf_strtou32(const char* pbuf, u_int32_t* pval) ++{ ++ int n = 0; ++ ++ *pval = 0; ++ while (pbuf[n] >= '0' && pbuf[n] <= '9') ++ { ++ *pval = (*pval * 10) + (pbuf[n] - '0'); ++ n++; ++ } ++ ++ return n; ++} ++#endif /* NF_NEED_STRTOU32 */ ++ ++/* ++ * Given a buffer and length, advance to the next line and mark the current ++ * line. ++ */ ++#ifdef NF_NEED_NEXTLINE ++static int ++nf_nextline(char* p, uint len, uint* poff, uint* plineoff, uint* plinelen) ++{ ++ uint off = *poff; ++ uint physlen = 0; ++ ++ if (off >= len) ++ { ++ return 0; ++ } ++ ++ while (p[off] != '\n') ++ { ++ if (len-off <= 1) ++ { ++ return 0; ++ } ++ ++ physlen++; ++ off++; ++ } ++ ++ /* if we saw a crlf, physlen needs adjusted */ ++ if (physlen > 0 && p[off] == '\n' && p[off-1] == '\r') ++ { ++ physlen--; ++ } ++ ++ /* advance past the newline */ ++ off++; ++ ++ *plineoff = *poff; ++ *plinelen = physlen; ++ *poff = off; ++ ++ return 1; ++} ++#endif /* NF_NEED_NEXTLINE */ ++ ++#endif /* __KERNEL__ */ ++ ++#endif /* _NETFILTER_HELPERS_H */ +--- /dev/null ++++ b/include/linux/netfilter_mime.h +@@ -0,0 +1,89 @@ ++/* ++ * MIME functions for netfilter modules. This file provides implementations ++ * for basic MIME parsing. MIME headers are used in many protocols, such as ++ * HTTP, RTSP, SIP, etc. ++ * ++ * gcc will warn for defined but unused functions, so we only include the ++ * functions requested. The following macros are used: ++ * NF_NEED_MIME_NEXTLINE nf_mime_nextline() ++ */ ++#ifndef _NETFILTER_MIME_H ++#define _NETFILTER_MIME_H ++ ++/* Only include these functions for kernel code. */ ++#ifdef __KERNEL__ ++ ++#include ++ ++/* ++ * Given a buffer and length, advance to the next line and mark the current ++ * line. If the current line is empty, *plinelen will be set to zero. If ++ * not, it will be set to the actual line length (including CRLF). ++ * ++ * 'line' in this context means logical line (includes LWS continuations). ++ * Returns 1 on success, 0 on failure. ++ */ ++#ifdef NF_NEED_MIME_NEXTLINE ++static int ++nf_mime_nextline(char* p, uint len, uint* poff, uint* plineoff, uint* plinelen) ++{ ++ uint off = *poff; ++ uint physlen = 0; ++ int is_first_line = 1; ++ ++ if (off >= len) ++ { ++ return 0; ++ } ++ ++ do ++ { ++ while (p[off] != '\n') ++ { ++ if (len-off <= 1) ++ { ++ return 0; ++ } ++ ++ physlen++; ++ off++; ++ } ++ ++ /* if we saw a crlf, physlen needs adjusted */ ++ if (physlen > 0 && p[off] == '\n' && p[off-1] == '\r') ++ { ++ physlen--; ++ } ++ ++ /* advance past the newline */ ++ off++; ++ ++ /* check for an empty line */ ++ if (physlen == 0) ++ { ++ break; ++ } ++ ++ /* check for colon on the first physical line */ ++ if (is_first_line) ++ { ++ is_first_line = 0; ++ if (memchr(p+(*poff), ':', physlen) == NULL) ++ { ++ return 0; ++ } ++ } ++ } ++ while (p[off] == ' ' || p[off] == '\t'); ++ ++ *plineoff = *poff; ++ *plinelen = (physlen == 0) ? 0 : (off - *poff); ++ *poff = off; ++ ++ return 1; ++} ++#endif /* NF_NEED_MIME_NEXTLINE */ ++ ++#endif /* __KERNEL__ */ ++ ++#endif /* _NETFILTER_MIME_H */ +--- a/net/ipv4/netfilter/Makefile ++++ b/net/ipv4/netfilter/Makefile +@@ -26,6 +26,7 @@ obj-$(CONFIG_NF_NAT_AMANDA) += nf_nat_am + obj-$(CONFIG_NF_NAT_FTP) += nf_nat_ftp.o + obj-$(CONFIG_NF_NAT_H323) += nf_nat_h323.o + obj-$(CONFIG_NF_NAT_IRC) += nf_nat_irc.o ++obj-$(CONFIG_NF_NAT_RTSP) += nf_nat_rtsp.o + obj-$(CONFIG_NF_NAT_PPTP) += nf_nat_pptp.o + obj-$(CONFIG_NF_NAT_SIP) += nf_nat_sip.o + obj-$(CONFIG_NF_NAT_SNMP_BASIC) += nf_nat_snmp_basic.o +--- a/net/netfilter/Kconfig ++++ b/net/netfilter/Kconfig +@@ -267,6 +267,16 @@ config NF_CONNTRACK_TFTP + + To compile it as a module, choose M here. If unsure, say N. + ++config NF_CONNTRACK_RTSP ++ tristate "RTSP protocol support" ++ depends on NF_CONNTRACK ++ help ++ Support the RTSP protocol. This allows UDP transports to be setup ++ properly, including RTP and RDT. ++ ++ If you want to compile it as a module, say 'M' here and read ++ Documentation/modules.txt. If unsure, say 'Y'. ++ + config NF_CT_NETLINK + tristate 'Connection tracking netlink interface' + select NETFILTER_NETLINK +--- a/net/netfilter/Makefile ++++ b/net/netfilter/Makefile +@@ -33,6 +33,7 @@ obj-$(CONFIG_NF_CONNTRACK_PPTP) += nf_co + obj-$(CONFIG_NF_CONNTRACK_SANE) += nf_conntrack_sane.o + obj-$(CONFIG_NF_CONNTRACK_SIP) += nf_conntrack_sip.o + obj-$(CONFIG_NF_CONNTRACK_TFTP) += nf_conntrack_tftp.o ++obj-$(CONFIG_NF_CONNTRACK_RTSP) += nf_conntrack_rtsp.o + + # transparent proxy support + obj-$(CONFIG_NETFILTER_TPROXY) += nf_tproxy_core.o +--- a/net/ipv4/netfilter/Kconfig ++++ b/net/ipv4/netfilter/Kconfig +@@ -257,6 +257,11 @@ config NF_NAT_IRC + depends on NF_CONNTRACK && NF_NAT + default NF_NAT && NF_CONNTRACK_IRC + ++config NF_NAT_RTSP ++ tristate ++ depends on IP_NF_IPTABLES && NF_CONNTRACK && NF_NAT ++ default NF_NAT && NF_CONNTRACK_RTSP ++ + config NF_NAT_TFTP + tristate + depends on NF_CONNTRACK && NF_NAT +--- /dev/null ++++ b/net/netfilter/nf_conntrack_rtsp.c +@@ -0,0 +1,517 @@ ++/* ++ * RTSP extension for IP connection tracking ++ * (C) 2003 by Tom Marshall ++ * based on ip_conntrack_irc.c ++ * ++ * 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 of the License, or (at your option) any later version. ++ * ++ * Module load syntax: ++ * insmod nf_conntrack_rtsp.o ports=port1,port2,...port ++ * max_outstanding=n setup_timeout=secs ++ * ++ * If no ports are specified, the default will be port 554. ++ * ++ * With max_outstanding you can define the maximum number of not yet ++ * answered SETUP requests per RTSP session (default 8). ++ * With setup_timeout you can specify how long the system waits for ++ * an expected data channel (default 300 seconds). ++ * ++ * 2005-02-13: Harald Welte ++ * - port to 2.6 ++ * - update to recent post-2.6.11 api changes ++ * 2006-09-14: Steven Van Acker ++ * - removed calls to NAT code from conntrack helper: NAT no longer needed to use rtsp-conntrack ++ * 2007-04-18: Michael Guntsche ++ * - Port to new NF API ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++ ++#define NF_NEED_STRNCASECMP ++#define NF_NEED_STRTOU16 ++#define NF_NEED_STRTOU32 ++#define NF_NEED_NEXTLINE ++#include ++#define NF_NEED_MIME_NEXTLINE ++#include ++ ++#include ++#define MAX_SIMUL_SETUP 8 /* XXX: use max_outstanding */ ++#define INFOP(fmt, args...) printk(KERN_INFO "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args) ++#if 0 ++#define DEBUGP(fmt, args...) printk(KERN_DEBUG "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args) ++#else ++#define DEBUGP(fmt, args...) ++#endif ++ ++#define MAX_PORTS 8 ++static int ports[MAX_PORTS]; ++static int num_ports = 0; ++static int max_outstanding = 8; ++static unsigned int setup_timeout = 300; ++ ++MODULE_AUTHOR("Tom Marshall "); ++MODULE_DESCRIPTION("RTSP connection tracking module"); ++MODULE_LICENSE("GPL"); ++module_param_array(ports, int, &num_ports, 0400); ++MODULE_PARM_DESC(ports, "port numbers of RTSP servers"); ++module_param(max_outstanding, int, 0400); ++MODULE_PARM_DESC(max_outstanding, "max number of outstanding SETUP requests per RTSP session"); ++module_param(setup_timeout, int, 0400); ++MODULE_PARM_DESC(setup_timeout, "timeout on for unestablished data channels"); ++ ++static char *rtsp_buffer; ++static DEFINE_SPINLOCK(rtsp_buffer_lock); ++ ++unsigned int (*nf_nat_rtsp_hook)(struct sk_buff *skb, ++ enum ip_conntrack_info ctinfo, ++ unsigned int matchoff, unsigned int matchlen,struct ip_ct_rtsp_expect* prtspexp, ++ struct nf_conntrack_expect *exp); ++void (*nf_nat_rtsp_hook_expectfn)(struct nf_conn *ct, struct nf_conntrack_expect *exp); ++ ++EXPORT_SYMBOL_GPL(nf_nat_rtsp_hook); ++ ++/* ++ * Max mappings we will allow for one RTSP connection (for RTP, the number ++ * of allocated ports is twice this value). Note that SMIL burns a lot of ++ * ports so keep this reasonably high. If this is too low, you will see a ++ * lot of "no free client map entries" messages. ++ */ ++#define MAX_PORT_MAPS 16 ++ ++/*** default port list was here in the masq code: 554, 3030, 4040 ***/ ++ ++#define SKIP_WSPACE(ptr,len,off) while(off < len && isspace(*(ptr+off))) { off++; } ++ ++/* ++ * Parse an RTSP packet. ++ * ++ * Returns zero if parsing failed. ++ * ++ * Parameters: ++ * IN ptcp tcp data pointer ++ * IN tcplen tcp data len ++ * IN/OUT ptcpoff points to current tcp offset ++ * OUT phdrsoff set to offset of rtsp headers ++ * OUT phdrslen set to length of rtsp headers ++ * OUT pcseqoff set to offset of CSeq header ++ * OUT pcseqlen set to length of CSeq header ++ */ ++static int ++rtsp_parse_message(char* ptcp, uint tcplen, uint* ptcpoff, ++ uint* phdrsoff, uint* phdrslen, ++ uint* pcseqoff, uint* pcseqlen, ++ uint* transoff, uint* translen) ++{ ++ uint entitylen = 0; ++ uint lineoff; ++ uint linelen; ++ ++ if (!nf_nextline(ptcp, tcplen, ptcpoff, &lineoff, &linelen)) ++ return 0; ++ ++ *phdrsoff = *ptcpoff; ++ while (nf_mime_nextline(ptcp, tcplen, ptcpoff, &lineoff, &linelen)) { ++ if (linelen == 0) { ++ if (entitylen > 0) ++ *ptcpoff += min(entitylen, tcplen - *ptcpoff); ++ break; ++ } ++ if (lineoff+linelen > tcplen) { ++ INFOP("!! overrun !!\n"); ++ break; ++ } ++ ++ if (nf_strncasecmp(ptcp+lineoff, "CSeq:", 5) == 0) { ++ *pcseqoff = lineoff; ++ *pcseqlen = linelen; ++ } ++ ++ if (nf_strncasecmp(ptcp+lineoff, "Transport:", 10) == 0) { ++ *transoff = lineoff; ++ *translen = linelen; ++ } ++ ++ if (nf_strncasecmp(ptcp+lineoff, "Content-Length:", 15) == 0) { ++ uint off = lineoff+15; ++ SKIP_WSPACE(ptcp+lineoff, linelen, off); ++ nf_strtou32(ptcp+off, &entitylen); ++ } ++ } ++ *phdrslen = (*ptcpoff) - (*phdrsoff); ++ ++ return 1; ++} ++ ++/* ++ * Find lo/hi client ports (if any) in transport header ++ * In: ++ * ptcp, tcplen = packet ++ * tranoff, tranlen = buffer to search ++ * ++ * Out: ++ * pport_lo, pport_hi = lo/hi ports (host endian) ++ * ++ * Returns nonzero if any client ports found ++ * ++ * Note: it is valid (and expected) for the client to request multiple ++ * transports, so we need to parse the entire line. ++ */ ++static int ++rtsp_parse_transport(char* ptran, uint tranlen, ++ struct ip_ct_rtsp_expect* prtspexp) ++{ ++ int rc = 0; ++ uint off = 0; ++ ++ if (tranlen < 10 || !iseol(ptran[tranlen-1]) || ++ nf_strncasecmp(ptran, "Transport:", 10) != 0) { ++ INFOP("sanity check failed\n"); ++ return 0; ++ } ++ ++ DEBUGP("tran='%.*s'\n", (int)tranlen, ptran); ++ off += 10; ++ SKIP_WSPACE(ptran, tranlen, off); ++ ++ /* Transport: tran;field;field=val,tran;field;field=val,... */ ++ while (off < tranlen) { ++ const char* pparamend; ++ uint nextparamoff; ++ ++ pparamend = memchr(ptran+off, ',', tranlen-off); ++ pparamend = (pparamend == NULL) ? ptran+tranlen : pparamend+1; ++ nextparamoff = pparamend-ptran; ++ ++ while (off < nextparamoff) { ++ const char* pfieldend; ++ uint nextfieldoff; ++ ++ pfieldend = memchr(ptran+off, ';', nextparamoff-off); ++ nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1; ++ ++ if (strncmp(ptran+off, "client_port=", 12) == 0) { ++ u_int16_t port; ++ uint numlen; ++ ++ off += 12; ++ numlen = nf_strtou16(ptran+off, &port); ++ off += numlen; ++ if (prtspexp->loport != 0 && prtspexp->loport != port) ++ DEBUGP("multiple ports found, port %hu ignored\n", port); ++ else { ++ DEBUGP("lo port found : %hu\n", port); ++ prtspexp->loport = prtspexp->hiport = port; ++ if (ptran[off] == '-') { ++ off++; ++ numlen = nf_strtou16(ptran+off, &port); ++ off += numlen; ++ prtspexp->pbtype = pb_range; ++ prtspexp->hiport = port; ++ ++ // If we have a range, assume rtp: ++ // loport must be even, hiport must be loport+1 ++ if ((prtspexp->loport & 0x0001) != 0 || ++ prtspexp->hiport != prtspexp->loport+1) { ++ DEBUGP("incorrect range: %hu-%hu, correcting\n", ++ prtspexp->loport, prtspexp->hiport); ++ prtspexp->loport &= 0xfffe; ++ prtspexp->hiport = prtspexp->loport+1; ++ } ++ } else if (ptran[off] == '/') { ++ off++; ++ numlen = nf_strtou16(ptran+off, &port); ++ off += numlen; ++ prtspexp->pbtype = pb_discon; ++ prtspexp->hiport = port; ++ } ++ rc = 1; ++ } ++ } ++ ++ /* ++ * Note we don't look for the destination parameter here. ++ * If we are using NAT, the NAT module will handle it. If not, ++ * and the client is sending packets elsewhere, the expectation ++ * will quietly time out. ++ */ ++ ++ off = nextfieldoff; ++ } ++ ++ off = nextparamoff; ++ } ++ ++ return rc; ++} ++ ++void expected(struct nf_conn *ct, struct nf_conntrack_expect *exp) ++{ ++ if(nf_nat_rtsp_hook_expectfn) { ++ nf_nat_rtsp_hook_expectfn(ct,exp); ++ } ++} ++ ++/*** conntrack functions ***/ ++ ++/* outbound packet: client->server */ ++ ++static inline int ++help_out(struct sk_buff *skb, unsigned char *rb_ptr, unsigned int datalen, ++ struct nf_conn *ct, enum ip_conntrack_info ctinfo) ++{ ++ struct ip_ct_rtsp_expect expinfo; ++ ++ int dir = CTINFO2DIR(ctinfo); /* = IP_CT_DIR_ORIGINAL */ ++ //struct tcphdr* tcph = (void*)iph + iph->ihl * 4; ++ //uint tcplen = pktlen - iph->ihl * 4; ++ char* pdata = rb_ptr; ++ //uint datalen = tcplen - tcph->doff * 4; ++ uint dataoff = 0; ++ int ret = NF_ACCEPT; ++ ++ struct nf_conntrack_expect *exp; ++ ++ __be16 be_loport; ++ ++ memset(&expinfo, 0, sizeof(expinfo)); ++ ++ while (dataoff < datalen) { ++ uint cmdoff = dataoff; ++ uint hdrsoff = 0; ++ uint hdrslen = 0; ++ uint cseqoff = 0; ++ uint cseqlen = 0; ++ uint transoff = 0; ++ uint translen = 0; ++ uint off; ++ ++ if (!rtsp_parse_message(pdata, datalen, &dataoff, ++ &hdrsoff, &hdrslen, ++ &cseqoff, &cseqlen, ++ &transoff, &translen)) ++ break; /* not a valid message */ ++ ++ if (strncmp(pdata+cmdoff, "SETUP ", 6) != 0) ++ continue; /* not a SETUP message */ ++ DEBUGP("found a setup message\n"); ++ ++ off = 0; ++ if(translen) { ++ rtsp_parse_transport(pdata+transoff, translen, &expinfo); ++ } ++ ++ if (expinfo.loport == 0) { ++ DEBUGP("no udp transports found\n"); ++ continue; /* no udp transports found */ ++ } ++ ++ DEBUGP("udp transport found, ports=(%d,%hu,%hu)\n", ++ (int)expinfo.pbtype, expinfo.loport, expinfo.hiport); ++ ++ exp = nf_ct_expect_alloc(ct); ++ if (!exp) { ++ ret = NF_DROP; ++ goto out; ++ } ++ ++ be_loport = htons(expinfo.loport); ++ ++ nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, ++ ct->tuplehash[!dir].tuple.src.l3num, ++ &ct->tuplehash[!dir].tuple.src.u3, &ct->tuplehash[!dir].tuple.dst.u3, ++ IPPROTO_UDP, NULL, &be_loport); ++ ++ exp->master = ct; ++ ++ exp->expectfn = expected; ++ exp->flags = 0; ++ ++ if (expinfo.pbtype == pb_range) { ++ DEBUGP("Changing expectation mask to handle multiple ports\n"); ++ exp->mask.src.u.udp.port = 0xfffe; ++ } ++ ++ DEBUGP("expect_related %u.%u.%u.%u:%u-%u.%u.%u.%u:%u\n", ++ NIPQUAD(exp->tuple.src.u3.ip), ++ ntohs(exp->tuple.src.u.udp.port), ++ NIPQUAD(exp->tuple.dst.u3.ip), ++ ntohs(exp->tuple.dst.u.udp.port)); ++ ++ if (nf_nat_rtsp_hook) ++ /* pass the request off to the nat helper */ ++ ret = nf_nat_rtsp_hook(skb, ctinfo, hdrsoff, hdrslen, &expinfo, exp); ++ else if (nf_ct_expect_related(exp) != 0) { ++ INFOP("nf_ct_expect_related failed\n"); ++ ret = NF_DROP; ++ } ++ nf_ct_expect_put(exp); ++ goto out; ++ } ++out: ++ ++ return ret; ++} ++ ++ ++static inline int ++help_in(struct sk_buff *skb, size_t pktlen, ++ struct nf_conn* ct, enum ip_conntrack_info ctinfo) ++{ ++ return NF_ACCEPT; ++} ++ ++static int help(struct sk_buff *skb, unsigned int protoff, ++ struct nf_conn *ct, enum ip_conntrack_info ctinfo) ++{ ++ struct tcphdr _tcph, *th; ++ unsigned int dataoff, datalen; ++ char *rb_ptr; ++ int ret = NF_DROP; ++ ++ /* Until there's been traffic both ways, don't look in packets. */ ++ if (ctinfo != IP_CT_ESTABLISHED && ++ ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) { ++ DEBUGP("conntrackinfo = %u\n", ctinfo); ++ return NF_ACCEPT; ++ } ++ ++ /* Not whole TCP header? */ ++ th = skb_header_pointer(skb, protoff, sizeof(_tcph), &_tcph); ++ ++ if (!th) ++ return NF_ACCEPT; ++ ++ /* No data ? */ ++ dataoff = protoff + th->doff*4; ++ datalen = skb->len - dataoff; ++ if (dataoff >= skb->len) ++ return NF_ACCEPT; ++ ++ spin_lock_bh(&rtsp_buffer_lock); ++ rb_ptr = skb_header_pointer(skb, dataoff, ++ skb->len - dataoff, rtsp_buffer); ++ BUG_ON(rb_ptr == NULL); ++ ++#if 0 ++ /* Checksum invalid? Ignore. */ ++ /* FIXME: Source route IP option packets --RR */ ++ if (tcp_v4_check(tcph, tcplen, iph->saddr, iph->daddr, ++ csum_partial((char*)tcph, tcplen, 0))) ++ { ++ DEBUGP("bad csum: %p %u %u.%u.%u.%u %u.%u.%u.%u\n", ++ tcph, tcplen, NIPQUAD(iph->saddr), NIPQUAD(iph->daddr)); ++ return NF_ACCEPT; ++ } ++#endif ++ ++ switch (CTINFO2DIR(ctinfo)) { ++ case IP_CT_DIR_ORIGINAL: ++ ret = help_out(skb, rb_ptr, datalen, ct, ctinfo); ++ break; ++ case IP_CT_DIR_REPLY: ++ DEBUGP("IP_CT_DIR_REPLY\n"); ++ /* inbound packet: server->client */ ++ ret = NF_ACCEPT; ++ break; ++ } ++ ++ spin_unlock_bh(&rtsp_buffer_lock); ++ ++ return ret; ++} ++ ++static struct nf_conntrack_helper rtsp_helpers[MAX_PORTS]; ++static char rtsp_names[MAX_PORTS][10]; ++static struct nf_conntrack_expect_policy rtsp_expect_policy; ++ ++/* This function is intentionally _NOT_ defined as __exit */ ++static void ++fini(void) ++{ ++ int i; ++ for (i = 0; i < num_ports; i++) { ++ DEBUGP("unregistering port %d\n", ports[i]); ++ nf_conntrack_helper_unregister(&rtsp_helpers[i]); ++ } ++ kfree(rtsp_buffer); ++} ++ ++static int __init ++init(void) ++{ ++ int i, ret; ++ struct nf_conntrack_helper *hlpr; ++ char *tmpname; ++ ++ printk("nf_conntrack_rtsp v" IP_NF_RTSP_VERSION " loading\n"); ++ ++ if (max_outstanding < 1) { ++ printk("nf_conntrack_rtsp: max_outstanding must be a positive integer\n"); ++ return -EBUSY; ++ } ++ if (setup_timeout < 0) { ++ printk("nf_conntrack_rtsp: setup_timeout must be a positive integer\n"); ++ return -EBUSY; ++ } ++ ++ rtsp_expect_policy.max_expected = max_outstanding; ++ rtsp_expect_policy.timeout = setup_timeout; ++ ++ rtsp_buffer = kmalloc(65536, GFP_KERNEL); ++ if (!rtsp_buffer) ++ return -ENOMEM; ++ ++ /* If no port given, default to standard rtsp port */ ++ if (ports[0] == 0) { ++ ports[0] = RTSP_PORT; ++ } ++ ++ for (i = 0; (i < MAX_PORTS) && ports[i]; i++) { ++ hlpr = &rtsp_helpers[i]; ++ memset(hlpr, 0, sizeof(struct nf_conntrack_helper)); ++ hlpr->tuple.src.u.tcp.port = htons(ports[i]); ++ hlpr->tuple.dst.protonum = IPPROTO_TCP; ++ hlpr->expect_policy = &rtsp_expect_policy; ++ hlpr->me = THIS_MODULE; ++ hlpr->help = help; ++ ++ tmpname = &rtsp_names[i][0]; ++ if (ports[i] == RTSP_PORT) { ++ sprintf(tmpname, "rtsp"); ++ } else { ++ sprintf(tmpname, "rtsp-%d", i); ++ } ++ hlpr->name = tmpname; ++ ++ DEBUGP("port #%d: %d\n", i, ports[i]); ++ ++ ret = nf_conntrack_helper_register(hlpr); ++ ++ if (ret) { ++ printk("nf_conntrack_rtsp: ERROR registering port %d\n", ports[i]); ++ fini(); ++ return -EBUSY; ++ } ++ num_ports++; ++ } ++ return 0; ++} ++ ++module_init(init); ++module_exit(fini); ++ ++EXPORT_SYMBOL(nf_nat_rtsp_hook_expectfn); ++ +--- /dev/null ++++ b/net/ipv4/netfilter/nf_nat_rtsp.c +@@ -0,0 +1,496 @@ ++/* ++ * RTSP extension for TCP NAT alteration ++ * (C) 2003 by Tom Marshall ++ * based on ip_nat_irc.c ++ * ++ * 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 of the License, or (at your option) any later version. ++ * ++ * Module load syntax: ++ * insmod nf_nat_rtsp.o ports=port1,port2,...port ++ * stunaddr=
++ * destaction=[auto|strip|none] ++ * ++ * If no ports are specified, the default will be port 554 only. ++ * ++ * stunaddr specifies the address used to detect that a client is using STUN. ++ * If this address is seen in the destination parameter, it is assumed that ++ * the client has already punched a UDP hole in the firewall, so we don't ++ * mangle the client_port. If none is specified, it is autodetected. It ++ * only needs to be set if you have multiple levels of NAT. It should be ++ * set to the external address that the STUN clients detect. Note that in ++ * this case, it will not be possible for clients to use UDP with servers ++ * between the NATs. ++ * ++ * If no destaction is specified, auto is used. ++ * destaction=auto: strip destination parameter if it is not stunaddr. ++ * destaction=strip: always strip destination parameter (not recommended). ++ * destaction=none: do not touch destination parameter (not recommended). ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#define NF_NEED_STRNCASECMP ++#define NF_NEED_STRTOU16 ++#include ++#define NF_NEED_MIME_NEXTLINE ++#include ++ ++#define INFOP(fmt, args...) printk(KERN_INFO "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args) ++#if 0 ++#define DEBUGP(fmt, args...) printk(KERN_DEBUG "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args) ++#else ++#define DEBUGP(fmt, args...) ++#endif ++ ++#define MAX_PORTS 8 ++#define DSTACT_AUTO 0 ++#define DSTACT_STRIP 1 ++#define DSTACT_NONE 2 ++ ++static char* stunaddr = NULL; ++static char* destaction = NULL; ++ ++static u_int32_t extip = 0; ++static int dstact = 0; ++ ++MODULE_AUTHOR("Tom Marshall "); ++MODULE_DESCRIPTION("RTSP network address translation module"); ++MODULE_LICENSE("GPL"); ++module_param(stunaddr, charp, 0644); ++MODULE_PARM_DESC(stunaddr, "Address for detecting STUN"); ++module_param(destaction, charp, 0644); ++MODULE_PARM_DESC(destaction, "Action for destination parameter (auto/strip/none)"); ++ ++#define SKIP_WSPACE(ptr,len,off) while(off < len && isspace(*(ptr+off))) { off++; } ++ ++/*** helper functions ***/ ++ ++static void ++get_skb_tcpdata(struct sk_buff* skb, char** pptcpdata, uint* ptcpdatalen) ++{ ++ struct iphdr* iph = ip_hdr(skb); ++ struct tcphdr* tcph = (void *)iph + ip_hdrlen(skb); ++ ++ *pptcpdata = (char*)tcph + tcph->doff*4; ++ *ptcpdatalen = ((char*)skb_transport_header(skb) + skb->len) - *pptcpdata; ++} ++ ++/*** nat functions ***/ ++ ++/* ++ * Mangle the "Transport:" header: ++ * - Replace all occurences of "client_port=" ++ * - Handle destination parameter ++ * ++ * In: ++ * ct, ctinfo = conntrack context ++ * skb = packet ++ * tranoff = Transport header offset from TCP data ++ * tranlen = Transport header length (incl. CRLF) ++ * rport_lo = replacement low port (host endian) ++ * rport_hi = replacement high port (host endian) ++ * ++ * Returns packet size difference. ++ * ++ * Assumes that a complete transport header is present, ending with CR or LF ++ */ ++static int ++rtsp_mangle_tran(enum ip_conntrack_info ctinfo, ++ struct nf_conntrack_expect* exp, ++ struct ip_ct_rtsp_expect* prtspexp, ++ struct sk_buff* skb, uint tranoff, uint tranlen) ++{ ++ char* ptcp; ++ uint tcplen; ++ char* ptran; ++ char rbuf1[16]; /* Replacement buffer (one port) */ ++ uint rbuf1len; /* Replacement len (one port) */ ++ char rbufa[16]; /* Replacement buffer (all ports) */ ++ uint rbufalen; /* Replacement len (all ports) */ ++ u_int32_t newip; ++ u_int16_t loport, hiport; ++ uint off = 0; ++ uint diff; /* Number of bytes we removed */ ++ ++ struct nf_conn *ct = exp->master; ++ struct nf_conntrack_tuple *t; ++ ++ char szextaddr[15+1]; ++ uint extaddrlen; ++ int is_stun; ++ ++ get_skb_tcpdata(skb, &ptcp, &tcplen); ++ ptran = ptcp+tranoff; ++ ++ if (tranoff+tranlen > tcplen || tcplen-tranoff < tranlen || ++ tranlen < 10 || !iseol(ptran[tranlen-1]) || ++ nf_strncasecmp(ptran, "Transport:", 10) != 0) ++ { ++ INFOP("sanity check failed\n"); ++ return 0; ++ } ++ off += 10; ++ SKIP_WSPACE(ptcp+tranoff, tranlen, off); ++ ++ newip = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip; ++ t = &exp->tuple; ++ t->dst.u3.ip = newip; ++ ++ extaddrlen = extip ? sprintf(szextaddr, "%u.%u.%u.%u", NIPQUAD(extip)) ++ : sprintf(szextaddr, "%u.%u.%u.%u", NIPQUAD(newip)); ++ DEBUGP("stunaddr=%s (%s)\n", szextaddr, (extip?"forced":"auto")); ++ ++ rbuf1len = rbufalen = 0; ++ switch (prtspexp->pbtype) ++ { ++ case pb_single: ++ for (loport = prtspexp->loport; loport != 0; loport++) /* XXX: improper wrap? */ ++ { ++ t->dst.u.udp.port = htons(loport); ++ if (nf_ct_expect_related(exp) == 0) ++ { ++ DEBUGP("using port %hu\n", loport); ++ break; ++ } ++ } ++ if (loport != 0) ++ { ++ rbuf1len = sprintf(rbuf1, "%hu", loport); ++ rbufalen = sprintf(rbufa, "%hu", loport); ++ } ++ break; ++ case pb_range: ++ for (loport = prtspexp->loport; loport != 0; loport += 2) /* XXX: improper wrap? */ ++ { ++ t->dst.u.udp.port = htons(loport); ++ if (nf_ct_expect_related(exp) == 0) ++ { ++ hiport = loport + ~exp->mask.src.u.udp.port; ++ DEBUGP("using ports %hu-%hu\n", loport, hiport); ++ break; ++ } ++ } ++ if (loport != 0) ++ { ++ rbuf1len = sprintf(rbuf1, "%hu", loport); ++ rbufalen = sprintf(rbufa, "%hu-%hu", loport, loport+1); ++ } ++ break; ++ case pb_discon: ++ for (loport = prtspexp->loport; loport != 0; loport++) /* XXX: improper wrap? */ ++ { ++ t->dst.u.udp.port = htons(loport); ++ if (nf_ct_expect_related(exp) == 0) ++ { ++ DEBUGP("using port %hu (1 of 2)\n", loport); ++ break; ++ } ++ } ++ for (hiport = prtspexp->hiport; hiport != 0; hiport++) /* XXX: improper wrap? */ ++ { ++ t->dst.u.udp.port = htons(hiport); ++ if (nf_ct_expect_related(exp) == 0) ++ { ++ DEBUGP("using port %hu (2 of 2)\n", hiport); ++ break; ++ } ++ } ++ if (loport != 0 && hiport != 0) ++ { ++ rbuf1len = sprintf(rbuf1, "%hu", loport); ++ if (hiport == loport+1) ++ { ++ rbufalen = sprintf(rbufa, "%hu-%hu", loport, hiport); ++ } ++ else ++ { ++ rbufalen = sprintf(rbufa, "%hu/%hu", loport, hiport); ++ } ++ } ++ break; ++ } ++ ++ if (rbuf1len == 0) ++ { ++ return 0; /* cannot get replacement port(s) */ ++ } ++ ++ /* Transport: tran;field;field=val,tran;field;field=val,... */ ++ while (off < tranlen) ++ { ++ uint saveoff; ++ const char* pparamend; ++ uint nextparamoff; ++ ++ pparamend = memchr(ptran+off, ',', tranlen-off); ++ pparamend = (pparamend == NULL) ? ptran+tranlen : pparamend+1; ++ nextparamoff = pparamend-ptcp; ++ ++ /* ++ * We pass over each param twice. On the first pass, we look for a ++ * destination= field. It is handled by the security policy. If it ++ * is present, allowed, and equal to our external address, we assume ++ * that STUN is being used and we leave the client_port= field alone. ++ */ ++ is_stun = 0; ++ saveoff = off; ++ while (off < nextparamoff) ++ { ++ const char* pfieldend; ++ uint nextfieldoff; ++ ++ pfieldend = memchr(ptran+off, ';', nextparamoff-off); ++ nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1; ++ ++ if (dstact != DSTACT_NONE && strncmp(ptran+off, "destination=", 12) == 0) ++ { ++ if (strncmp(ptran+off+12, szextaddr, extaddrlen) == 0) ++ { ++ is_stun = 1; ++ } ++ if (dstact == DSTACT_STRIP || (dstact == DSTACT_AUTO && !is_stun)) ++ { ++ diff = nextfieldoff-off; ++ if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo, ++ off, diff, NULL, 0)) ++ { ++ /* mangle failed, all we can do is bail */ ++ nf_ct_unexpect_related(exp); ++ return 0; ++ } ++ get_skb_tcpdata(skb, &ptcp, &tcplen); ++ ptran = ptcp+tranoff; ++ tranlen -= diff; ++ nextparamoff -= diff; ++ nextfieldoff -= diff; ++ } ++ } ++ ++ off = nextfieldoff; ++ } ++ if (is_stun) ++ { ++ continue; ++ } ++ off = saveoff; ++ while (off < nextparamoff) ++ { ++ const char* pfieldend; ++ uint nextfieldoff; ++ ++ pfieldend = memchr(ptran+off, ';', nextparamoff-off); ++ nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1; ++ ++ if (strncmp(ptran+off, "client_port=", 12) == 0) ++ { ++ u_int16_t port; ++ uint numlen; ++ uint origoff; ++ uint origlen; ++ char* rbuf = rbuf1; ++ uint rbuflen = rbuf1len; ++ ++ off += 12; ++ origoff = (ptran-ptcp)+off; ++ origlen = 0; ++ numlen = nf_strtou16(ptran+off, &port); ++ off += numlen; ++ origlen += numlen; ++ if (port != prtspexp->loport) ++ { ++ DEBUGP("multiple ports found, port %hu ignored\n", port); ++ } ++ else ++ { ++ if (ptran[off] == '-' || ptran[off] == '/') ++ { ++ off++; ++ origlen++; ++ numlen = nf_strtou16(ptran+off, &port); ++ off += numlen; ++ origlen += numlen; ++ rbuf = rbufa; ++ rbuflen = rbufalen; ++ } ++ ++ /* ++ * note we cannot just memcpy() if the sizes are the same. ++ * the mangle function does skb resizing, checks for a ++ * cloned skb, and updates the checksums. ++ * ++ * parameter 4 below is offset from start of tcp data. ++ */ ++ diff = origlen-rbuflen; ++ if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo, ++ origoff, origlen, rbuf, rbuflen)) ++ { ++ /* mangle failed, all we can do is bail */ ++ nf_ct_unexpect_related(exp); ++ return 0; ++ } ++ get_skb_tcpdata(skb, &ptcp, &tcplen); ++ ptran = ptcp+tranoff; ++ tranlen -= diff; ++ nextparamoff -= diff; ++ nextfieldoff -= diff; ++ } ++ } ++ ++ off = nextfieldoff; ++ } ++ ++ off = nextparamoff; ++ } ++ ++ return 1; ++} ++ ++static uint ++help_out(struct sk_buff *skb, enum ip_conntrack_info ctinfo, ++ unsigned int matchoff, unsigned int matchlen, struct ip_ct_rtsp_expect* prtspexp, ++ struct nf_conntrack_expect* exp) ++{ ++ char* ptcp; ++ uint tcplen; ++ uint hdrsoff; ++ uint hdrslen; ++ uint lineoff; ++ uint linelen; ++ uint off; ++ ++ //struct iphdr* iph = (struct iphdr*)skb->nh.iph; ++ //struct tcphdr* tcph = (struct tcphdr*)((void*)iph + iph->ihl*4); ++ ++ get_skb_tcpdata(skb, &ptcp, &tcplen); ++ hdrsoff = matchoff;//exp->seq - ntohl(tcph->seq); ++ hdrslen = matchlen; ++ off = hdrsoff; ++ DEBUGP("NAT rtsp help_out\n"); ++ ++ while (nf_mime_nextline(ptcp, hdrsoff+hdrslen, &off, &lineoff, &linelen)) ++ { ++ if (linelen == 0) ++ { ++ break; ++ } ++ if (off > hdrsoff+hdrslen) ++ { ++ INFOP("!! overrun !!"); ++ break; ++ } ++ DEBUGP("hdr: len=%u, %.*s", linelen, (int)linelen, ptcp+lineoff); ++ ++ if (nf_strncasecmp(ptcp+lineoff, "Transport:", 10) == 0) ++ { ++ uint oldtcplen = tcplen; ++ DEBUGP("hdr: Transport\n"); ++ if (!rtsp_mangle_tran(ctinfo, exp, prtspexp, skb, lineoff, linelen)) ++ { ++ DEBUGP("hdr: Transport mangle failed"); ++ break; ++ } ++ get_skb_tcpdata(skb, &ptcp, &tcplen); ++ hdrslen -= (oldtcplen-tcplen); ++ off -= (oldtcplen-tcplen); ++ lineoff -= (oldtcplen-tcplen); ++ linelen -= (oldtcplen-tcplen); ++ DEBUGP("rep: len=%u, %.*s", linelen, (int)linelen, ptcp+lineoff); ++ } ++ } ++ ++ return NF_ACCEPT; ++} ++ ++static unsigned int ++help(struct sk_buff *skb, enum ip_conntrack_info ctinfo, ++ unsigned int matchoff, unsigned int matchlen, struct ip_ct_rtsp_expect* prtspexp, ++ struct nf_conntrack_expect* exp) ++{ ++ int dir = CTINFO2DIR(ctinfo); ++ int rc = NF_ACCEPT; ++ ++ switch (dir) ++ { ++ case IP_CT_DIR_ORIGINAL: ++ rc = help_out(skb, ctinfo, matchoff, matchlen, prtspexp, exp); ++ break; ++ case IP_CT_DIR_REPLY: ++ DEBUGP("unmangle ! %u\n", ctinfo); ++ /* XXX: unmangle */ ++ rc = NF_ACCEPT; ++ break; ++ } ++ //UNLOCK_BH(&ip_rtsp_lock); ++ ++ return rc; ++} ++ ++static void expected(struct nf_conn* ct, struct nf_conntrack_expect *exp) ++{ ++ struct nf_nat_multi_range_compat mr; ++ u_int32_t newdstip, newsrcip, newip; ++ ++ struct nf_conn *master = ct->master; ++ ++ newdstip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip; ++ newsrcip = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip; ++ //FIXME (how to port that ?) ++ //code from 2.4 : newip = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC) ? newsrcip : newdstip; ++ newip = newdstip; ++ ++ DEBUGP("newsrcip=%u.%u.%u.%u, newdstip=%u.%u.%u.%u, newip=%u.%u.%u.%u\n", ++ NIPQUAD(newsrcip), NIPQUAD(newdstip), NIPQUAD(newip)); ++ ++ mr.rangesize = 1; ++ // We don't want to manip the per-protocol, just the IPs. ++ mr.range[0].flags = IP_NAT_RANGE_MAP_IPS; ++ mr.range[0].min_ip = mr.range[0].max_ip = newip; ++ ++ nf_nat_setup_info(ct, &mr.range[0], IP_NAT_MANIP_DST); ++} ++ ++ ++static void __exit fini(void) ++{ ++ nf_nat_rtsp_hook = NULL; ++ nf_nat_rtsp_hook_expectfn = NULL; ++ synchronize_net(); ++} ++ ++static int __init init(void) ++{ ++ printk("nf_nat_rtsp v" IP_NF_RTSP_VERSION " loading\n"); ++ ++ BUG_ON(nf_nat_rtsp_hook); ++ nf_nat_rtsp_hook = help; ++ nf_nat_rtsp_hook_expectfn = &expected; ++ ++ if (stunaddr != NULL) ++ extip = in_aton(stunaddr); ++ ++ if (destaction != NULL) { ++ if (strcmp(destaction, "auto") == 0) ++ dstact = DSTACT_AUTO; ++ ++ if (strcmp(destaction, "strip") == 0) ++ dstact = DSTACT_STRIP; ++ ++ if (strcmp(destaction, "none") == 0) ++ dstact = DSTACT_NONE; ++ } ++ ++ return 0; ++} ++ ++module_init(init); ++module_exit(fini); diff --git a/target/linux/generic-2.6/patches-2.6.32/200-sched_esfq.patch b/target/linux/generic-2.6/patches-2.6.32/200-sched_esfq.patch new file mode 100644 index 000000000..fb28e9085 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/200-sched_esfq.patch @@ -0,0 +1,793 @@ +--- a/include/linux/pkt_sched.h ++++ b/include/linux/pkt_sched.h +@@ -182,8 +182,37 @@ struct tc_sfq_xstats + * + * The only reason for this is efficiency, it is possible + * to change these parameters in compile time. ++ * ++ * If you need to play with these values, use esfq instead. + */ + ++/* ESFQ section */ ++ ++enum ++{ ++ /* traditional */ ++ TCA_SFQ_HASH_CLASSIC, ++ TCA_SFQ_HASH_DST, ++ TCA_SFQ_HASH_SRC, ++ TCA_SFQ_HASH_FWMARK, ++ /* conntrack */ ++ TCA_SFQ_HASH_CTORIGDST, ++ TCA_SFQ_HASH_CTORIGSRC, ++ TCA_SFQ_HASH_CTREPLDST, ++ TCA_SFQ_HASH_CTREPLSRC, ++ TCA_SFQ_HASH_CTNATCHG, ++}; ++ ++struct tc_esfq_qopt ++{ ++ unsigned quantum; /* Bytes per round allocated to flow */ ++ int perturb_period; /* Period of hash perturbation */ ++ __u32 limit; /* Maximal packets in queue */ ++ unsigned divisor; /* Hash divisor */ ++ unsigned flows; /* Maximal number of flows */ ++ unsigned hash_kind; /* Hash function to use for flow identification */ ++}; ++ + /* RED section */ + + enum +--- a/net/sched/Kconfig ++++ b/net/sched/Kconfig +@@ -137,6 +137,37 @@ config NET_SCH_SFQ + To compile this code as a module, choose M here: the + module will be called sch_sfq. + ++config NET_SCH_ESFQ ++ tristate "Enhanced Stochastic Fairness Queueing (ESFQ)" ++ ---help--- ++ Say Y here if you want to use the Enhanced Stochastic Fairness ++ Queueing (ESFQ) packet scheduling algorithm for some of your network ++ devices or as a leaf discipline for a classful qdisc such as HTB or ++ CBQ (see the top of for details and ++ references to the SFQ algorithm). ++ ++ This is an enchanced SFQ version which allows you to control some ++ hardcoded values in the SFQ scheduler. ++ ++ ESFQ also adds control of the hash function used to identify packet ++ flows. The original SFQ discipline hashes by connection; ESFQ add ++ several other hashing methods, such as by src IP or by dst IP, which ++ can be more fair to users in some networking situations. ++ ++ To compile this code as a module, choose M here: the ++ module will be called sch_esfq. ++ ++config NET_SCH_ESFQ_NFCT ++ bool "Connection Tracking Hash Types" ++ depends on NET_SCH_ESFQ && NF_CONNTRACK ++ ---help--- ++ Say Y here to enable support for hashing based on netfilter connection ++ tracking information. This is useful for a router that is also using ++ NAT to connect privately-addressed hosts to the Internet. If you want ++ to provide fair distribution of upstream bandwidth, ESFQ must use ++ connection tracking information, since all outgoing packets will share ++ the same source address. ++ + config NET_SCH_TEQL + tristate "True Link Equalizer (TEQL)" + ---help--- +--- a/net/sched/Makefile ++++ b/net/sched/Makefile +@@ -24,6 +24,7 @@ obj-$(CONFIG_NET_SCH_GRED) += sch_gred.o + obj-$(CONFIG_NET_SCH_INGRESS) += sch_ingress.o + obj-$(CONFIG_NET_SCH_DSMARK) += sch_dsmark.o + obj-$(CONFIG_NET_SCH_SFQ) += sch_sfq.o ++obj-$(CONFIG_NET_SCH_ESFQ) += sch_esfq.o + obj-$(CONFIG_NET_SCH_TBF) += sch_tbf.o + obj-$(CONFIG_NET_SCH_TEQL) += sch_teql.o + obj-$(CONFIG_NET_SCH_PRIO) += sch_prio.o +--- /dev/null ++++ b/net/sched/sch_esfq.c +@@ -0,0 +1,700 @@ ++/* ++ * net/sched/sch_esfq.c Extended Stochastic Fairness Queueing discipline. ++ * ++ * 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 of the License, or (at your option) any later version. ++ * ++ * Authors: Alexey Kuznetsov, ++ * ++ * Changes: Alexander Atanasov, ++ * Added dynamic depth,limit,divisor,hash_kind options. ++ * Added dst and src hashes. ++ * ++ * Alexander Clouter, ++ * Ported ESFQ to Linux 2.6. ++ * ++ * Corey Hickey, ++ * Maintenance of the Linux 2.6 port. ++ * Added fwmark hash (thanks to Robert Kurjata). ++ * Added usage of jhash. ++ * Added conntrack support. ++ * Added ctnatchg hash (thanks to Ben Pfountz). ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* Stochastic Fairness Queuing algorithm. ++ For more comments look at sch_sfq.c. ++ The difference is that you can change limit, depth, ++ hash table size and choose alternate hash types. ++ ++ classic: same as in sch_sfq.c ++ dst: destination IP address ++ src: source IP address ++ fwmark: netfilter mark value ++ ctorigdst: original destination IP address ++ ctorigsrc: original source IP address ++ ctrepldst: reply destination IP address ++ ctreplsrc: reply source IP ++ ++*/ ++ ++#define ESFQ_HEAD 0 ++#define ESFQ_TAIL 1 ++ ++/* This type should contain at least SFQ_DEPTH*2 values */ ++typedef unsigned int esfq_index; ++ ++struct esfq_head ++{ ++ esfq_index next; ++ esfq_index prev; ++}; ++ ++struct esfq_sched_data ++{ ++/* Parameters */ ++ int perturb_period; ++ unsigned quantum; /* Allotment per round: MUST BE >= MTU */ ++ int limit; ++ unsigned depth; ++ unsigned hash_divisor; ++ unsigned hash_kind; ++/* Variables */ ++ struct timer_list perturb_timer; ++ int perturbation; ++ esfq_index tail; /* Index of current slot in round */ ++ esfq_index max_depth; /* Maximal depth */ ++ ++ esfq_index *ht; /* Hash table */ ++ esfq_index *next; /* Active slots link */ ++ short *allot; /* Current allotment per slot */ ++ unsigned short *hash; /* Hash value indexed by slots */ ++ struct sk_buff_head *qs; /* Slot queue */ ++ struct esfq_head *dep; /* Linked list of slots, indexed by depth */ ++}; ++ ++/* This contains the info we will hash. */ ++struct esfq_packet_info ++{ ++ u32 proto; /* protocol or port */ ++ u32 src; /* source from packet header */ ++ u32 dst; /* destination from packet header */ ++ u32 ctorigsrc; /* original source from conntrack */ ++ u32 ctorigdst; /* original destination from conntrack */ ++ u32 ctreplsrc; /* reply source from conntrack */ ++ u32 ctrepldst; /* reply destination from conntrack */ ++ u32 mark; /* netfilter mark (fwmark) */ ++}; ++ ++static __inline__ unsigned esfq_jhash_1word(struct esfq_sched_data *q,u32 a) ++{ ++ return jhash_1word(a, q->perturbation) & (q->hash_divisor-1); ++} ++ ++static __inline__ unsigned esfq_jhash_2words(struct esfq_sched_data *q, u32 a, u32 b) ++{ ++ return jhash_2words(a, b, q->perturbation) & (q->hash_divisor-1); ++} ++ ++static __inline__ unsigned esfq_jhash_3words(struct esfq_sched_data *q, u32 a, u32 b, u32 c) ++{ ++ return jhash_3words(a, b, c, q->perturbation) & (q->hash_divisor-1); ++} ++ ++static unsigned esfq_hash(struct esfq_sched_data *q, struct sk_buff *skb) ++{ ++ struct esfq_packet_info info; ++#ifdef CONFIG_NET_SCH_ESFQ_NFCT ++ enum ip_conntrack_info ctinfo; ++ struct nf_conn *ct = nf_ct_get(skb, &ctinfo); ++#endif ++ ++ switch (skb->protocol) { ++ case __constant_htons(ETH_P_IP): ++ { ++ struct iphdr *iph = ip_hdr(skb); ++ info.dst = iph->daddr; ++ info.src = iph->saddr; ++ if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) && ++ (iph->protocol == IPPROTO_TCP || ++ iph->protocol == IPPROTO_UDP || ++ iph->protocol == IPPROTO_SCTP || ++ iph->protocol == IPPROTO_DCCP || ++ iph->protocol == IPPROTO_ESP)) ++ info.proto = *(((u32*)iph) + iph->ihl); ++ else ++ info.proto = iph->protocol; ++ break; ++ } ++ case __constant_htons(ETH_P_IPV6): ++ { ++ struct ipv6hdr *iph = ipv6_hdr(skb); ++ /* Hash ipv6 addresses into a u32. This isn't ideal, ++ * but the code is simple. */ ++ info.dst = jhash2(iph->daddr.s6_addr32, 4, q->perturbation); ++ info.src = jhash2(iph->saddr.s6_addr32, 4, q->perturbation); ++ if (iph->nexthdr == IPPROTO_TCP || ++ iph->nexthdr == IPPROTO_UDP || ++ iph->nexthdr == IPPROTO_SCTP || ++ iph->nexthdr == IPPROTO_DCCP || ++ iph->nexthdr == IPPROTO_ESP) ++ info.proto = *(u32*)&iph[1]; ++ else ++ info.proto = iph->nexthdr; ++ break; ++ } ++ default: ++ info.dst = (u32)(unsigned long)skb_dst(skb); ++ info.src = (u32)(unsigned long)skb->sk; ++ info.proto = skb->protocol; ++ } ++ ++ info.mark = skb->mark; ++ ++#ifdef CONFIG_NET_SCH_ESFQ_NFCT ++ /* defaults if there is no conntrack info */ ++ info.ctorigsrc = info.src; ++ info.ctorigdst = info.dst; ++ info.ctreplsrc = info.dst; ++ info.ctrepldst = info.src; ++ /* collect conntrack info */ ++ if (ct && ct != &nf_conntrack_untracked) { ++ if (skb->protocol == __constant_htons(ETH_P_IP)) { ++ info.ctorigsrc = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip; ++ info.ctorigdst = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u3.ip; ++ info.ctreplsrc = ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3.ip; ++ info.ctrepldst = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip; ++ } ++ else if (skb->protocol == __constant_htons(ETH_P_IPV6)) { ++ /* Again, hash ipv6 addresses into a single u32. */ ++ info.ctorigsrc = jhash2(ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip6, 4, q->perturbation); ++ info.ctorigdst = jhash2(ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u3.ip6, 4, q->perturbation); ++ info.ctreplsrc = jhash2(ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3.ip6, 4, q->perturbation); ++ info.ctrepldst = jhash2(ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip6, 4, q->perturbation); ++ } ++ ++ } ++#endif ++ ++ switch(q->hash_kind) { ++ case TCA_SFQ_HASH_CLASSIC: ++ return esfq_jhash_3words(q, info.dst, info.src, info.proto); ++ case TCA_SFQ_HASH_DST: ++ return esfq_jhash_1word(q, info.dst); ++ case TCA_SFQ_HASH_SRC: ++ return esfq_jhash_1word(q, info.src); ++ case TCA_SFQ_HASH_FWMARK: ++ return esfq_jhash_1word(q, info.mark); ++#ifdef CONFIG_NET_SCH_ESFQ_NFCT ++ case TCA_SFQ_HASH_CTORIGDST: ++ return esfq_jhash_1word(q, info.ctorigdst); ++ case TCA_SFQ_HASH_CTORIGSRC: ++ return esfq_jhash_1word(q, info.ctorigsrc); ++ case TCA_SFQ_HASH_CTREPLDST: ++ return esfq_jhash_1word(q, info.ctrepldst); ++ case TCA_SFQ_HASH_CTREPLSRC: ++ return esfq_jhash_1word(q, info.ctreplsrc); ++ case TCA_SFQ_HASH_CTNATCHG: ++ { ++ if (info.ctorigdst == info.ctreplsrc) ++ return esfq_jhash_1word(q, info.ctorigsrc); ++ return esfq_jhash_1word(q, info.ctreplsrc); ++ } ++#endif ++ default: ++ if (net_ratelimit()) ++ printk(KERN_WARNING "ESFQ: Unknown hash method. Falling back to classic.\n"); ++ } ++ return esfq_jhash_3words(q, info.dst, info.src, info.proto); ++} ++ ++static inline void esfq_link(struct esfq_sched_data *q, esfq_index x) ++{ ++ esfq_index p, n; ++ int d = q->qs[x].qlen + q->depth; ++ ++ p = d; ++ n = q->dep[d].next; ++ q->dep[x].next = n; ++ q->dep[x].prev = p; ++ q->dep[p].next = q->dep[n].prev = x; ++} ++ ++static inline void esfq_dec(struct esfq_sched_data *q, esfq_index x) ++{ ++ esfq_index p, n; ++ ++ n = q->dep[x].next; ++ p = q->dep[x].prev; ++ q->dep[p].next = n; ++ q->dep[n].prev = p; ++ ++ if (n == p && q->max_depth == q->qs[x].qlen + 1) ++ q->max_depth--; ++ ++ esfq_link(q, x); ++} ++ ++static inline void esfq_inc(struct esfq_sched_data *q, esfq_index x) ++{ ++ esfq_index p, n; ++ int d; ++ ++ n = q->dep[x].next; ++ p = q->dep[x].prev; ++ q->dep[p].next = n; ++ q->dep[n].prev = p; ++ d = q->qs[x].qlen; ++ if (q->max_depth < d) ++ q->max_depth = d; ++ ++ esfq_link(q, x); ++} ++ ++static unsigned int esfq_drop(struct Qdisc *sch) ++{ ++ struct esfq_sched_data *q = qdisc_priv(sch); ++ esfq_index d = q->max_depth; ++ struct sk_buff *skb; ++ unsigned int len; ++ ++ /* Queue is full! Find the longest slot and ++ drop a packet from it */ ++ ++ if (d > 1) { ++ esfq_index x = q->dep[d+q->depth].next; ++ skb = q->qs[x].prev; ++ len = skb->len; ++ __skb_unlink(skb, &q->qs[x]); ++ kfree_skb(skb); ++ esfq_dec(q, x); ++ sch->q.qlen--; ++ sch->qstats.drops++; ++ sch->qstats.backlog -= len; ++ return len; ++ } ++ ++ if (d == 1) { ++ /* It is difficult to believe, but ALL THE SLOTS HAVE LENGTH 1. */ ++ d = q->next[q->tail]; ++ q->next[q->tail] = q->next[d]; ++ q->allot[q->next[d]] += q->quantum; ++ skb = q->qs[d].prev; ++ len = skb->len; ++ __skb_unlink(skb, &q->qs[d]); ++ kfree_skb(skb); ++ esfq_dec(q, d); ++ sch->q.qlen--; ++ q->ht[q->hash[d]] = q->depth; ++ sch->qstats.drops++; ++ sch->qstats.backlog -= len; ++ return len; ++ } ++ ++ return 0; ++} ++ ++static void esfq_q_enqueue(struct sk_buff *skb, struct esfq_sched_data *q, unsigned int end) ++{ ++ unsigned hash = esfq_hash(q, skb); ++ unsigned depth = q->depth; ++ esfq_index x; ++ ++ x = q->ht[hash]; ++ if (x == depth) { ++ q->ht[hash] = x = q->dep[depth].next; ++ q->hash[x] = hash; ++ } ++ ++ if (end == ESFQ_TAIL) ++ __skb_queue_tail(&q->qs[x], skb); ++ else ++ __skb_queue_head(&q->qs[x], skb); ++ ++ esfq_inc(q, x); ++ if (q->qs[x].qlen == 1) { /* The flow is new */ ++ if (q->tail == depth) { /* It is the first flow */ ++ q->tail = x; ++ q->next[x] = x; ++ q->allot[x] = q->quantum; ++ } else { ++ q->next[x] = q->next[q->tail]; ++ q->next[q->tail] = x; ++ q->tail = x; ++ } ++ } ++} ++ ++static int esfq_enqueue(struct sk_buff *skb, struct Qdisc* sch) ++{ ++ struct esfq_sched_data *q = qdisc_priv(sch); ++ esfq_q_enqueue(skb, q, ESFQ_TAIL); ++ sch->qstats.backlog += skb->len; ++ if (++sch->q.qlen < q->limit-1) { ++ sch->bstats.bytes += skb->len; ++ sch->bstats.packets++; ++ return 0; ++ } ++ ++ sch->qstats.drops++; ++ esfq_drop(sch); ++ return NET_XMIT_CN; ++} ++ ++static struct sk_buff *esfq_peek(struct Qdisc* sch) ++{ ++ struct esfq_sched_data *q = qdisc_priv(sch); ++ esfq_index a; ++ ++ /* No active slots */ ++ if (q->tail == q->depth) ++ return NULL; ++ ++ a = q->next[q->tail]; ++ return skb_peek(&q->qs[a]); ++} ++ ++static struct sk_buff *esfq_q_dequeue(struct esfq_sched_data *q) ++{ ++ struct sk_buff *skb; ++ unsigned depth = q->depth; ++ esfq_index a, old_a; ++ ++ /* No active slots */ ++ if (q->tail == depth) ++ return NULL; ++ ++ a = old_a = q->next[q->tail]; ++ ++ /* Grab packet */ ++ skb = __skb_dequeue(&q->qs[a]); ++ esfq_dec(q, a); ++ ++ /* Is the slot empty? */ ++ if (q->qs[a].qlen == 0) { ++ q->ht[q->hash[a]] = depth; ++ a = q->next[a]; ++ if (a == old_a) { ++ q->tail = depth; ++ return skb; ++ } ++ q->next[q->tail] = a; ++ q->allot[a] += q->quantum; ++ } else if ((q->allot[a] -= skb->len) <= 0) { ++ q->tail = a; ++ a = q->next[a]; ++ q->allot[a] += q->quantum; ++ } ++ ++ return skb; ++} ++ ++static struct sk_buff *esfq_dequeue(struct Qdisc* sch) ++{ ++ struct esfq_sched_data *q = qdisc_priv(sch); ++ struct sk_buff *skb; ++ ++ skb = esfq_q_dequeue(q); ++ if (skb == NULL) ++ return NULL; ++ sch->q.qlen--; ++ sch->qstats.backlog -= skb->len; ++ return skb; ++} ++ ++static void esfq_q_destroy(struct esfq_sched_data *q) ++{ ++ del_timer(&q->perturb_timer); ++ if(q->ht) ++ kfree(q->ht); ++ if(q->dep) ++ kfree(q->dep); ++ if(q->next) ++ kfree(q->next); ++ if(q->allot) ++ kfree(q->allot); ++ if(q->hash) ++ kfree(q->hash); ++ if(q->qs) ++ kfree(q->qs); ++} ++ ++static void esfq_destroy(struct Qdisc *sch) ++{ ++ struct esfq_sched_data *q = qdisc_priv(sch); ++ esfq_q_destroy(q); ++} ++ ++ ++static void esfq_reset(struct Qdisc* sch) ++{ ++ struct sk_buff *skb; ++ ++ while ((skb = esfq_dequeue(sch)) != NULL) ++ kfree_skb(skb); ++} ++ ++static void esfq_perturbation(unsigned long arg) ++{ ++ struct Qdisc *sch = (struct Qdisc*)arg; ++ struct esfq_sched_data *q = qdisc_priv(sch); ++ ++ q->perturbation = net_random()&0x1F; ++ ++ if (q->perturb_period) { ++ q->perturb_timer.expires = jiffies + q->perturb_period; ++ add_timer(&q->perturb_timer); ++ } ++} ++ ++static unsigned int esfq_check_hash(unsigned int kind) ++{ ++ switch (kind) { ++ case TCA_SFQ_HASH_CTORIGDST: ++ case TCA_SFQ_HASH_CTORIGSRC: ++ case TCA_SFQ_HASH_CTREPLDST: ++ case TCA_SFQ_HASH_CTREPLSRC: ++ case TCA_SFQ_HASH_CTNATCHG: ++#ifndef CONFIG_NET_SCH_ESFQ_NFCT ++ { ++ if (net_ratelimit()) ++ printk(KERN_WARNING "ESFQ: Conntrack hash types disabled in kernel config. Falling back to classic.\n"); ++ return TCA_SFQ_HASH_CLASSIC; ++ } ++#endif ++ case TCA_SFQ_HASH_CLASSIC: ++ case TCA_SFQ_HASH_DST: ++ case TCA_SFQ_HASH_SRC: ++ case TCA_SFQ_HASH_FWMARK: ++ return kind; ++ default: ++ { ++ if (net_ratelimit()) ++ printk(KERN_WARNING "ESFQ: Unknown hash type. Falling back to classic.\n"); ++ return TCA_SFQ_HASH_CLASSIC; ++ } ++ } ++} ++ ++static int esfq_q_init(struct esfq_sched_data *q, struct nlattr *opt) ++{ ++ struct tc_esfq_qopt *ctl = nla_data(opt); ++ esfq_index p = ~0U/2; ++ int i; ++ ++ if (opt && opt->nla_len < nla_attr_size(sizeof(*ctl))) ++ return -EINVAL; ++ ++ q->perturbation = 0; ++ q->hash_kind = TCA_SFQ_HASH_CLASSIC; ++ q->max_depth = 0; ++ if (opt == NULL) { ++ q->perturb_period = 0; ++ q->hash_divisor = 1024; ++ q->tail = q->limit = q->depth = 128; ++ ++ } else { ++ struct tc_esfq_qopt *ctl = nla_data(opt); ++ if (ctl->quantum) ++ q->quantum = ctl->quantum; ++ q->perturb_period = ctl->perturb_period*HZ; ++ q->hash_divisor = ctl->divisor ? : 1024; ++ q->tail = q->limit = q->depth = ctl->flows ? : 128; ++ ++ if ( q->depth > p - 1 ) ++ return -EINVAL; ++ ++ if (ctl->limit) ++ q->limit = min_t(u32, ctl->limit, q->depth); ++ ++ if (ctl->hash_kind) { ++ q->hash_kind = esfq_check_hash(ctl->hash_kind); ++ } ++ } ++ ++ q->ht = kmalloc(q->hash_divisor*sizeof(esfq_index), GFP_KERNEL); ++ if (!q->ht) ++ goto err_case; ++ q->dep = kmalloc((1+q->depth*2)*sizeof(struct esfq_head), GFP_KERNEL); ++ if (!q->dep) ++ goto err_case; ++ q->next = kmalloc(q->depth*sizeof(esfq_index), GFP_KERNEL); ++ if (!q->next) ++ goto err_case; ++ q->allot = kmalloc(q->depth*sizeof(short), GFP_KERNEL); ++ if (!q->allot) ++ goto err_case; ++ q->hash = kmalloc(q->depth*sizeof(unsigned short), GFP_KERNEL); ++ if (!q->hash) ++ goto err_case; ++ q->qs = kmalloc(q->depth*sizeof(struct sk_buff_head), GFP_KERNEL); ++ if (!q->qs) ++ goto err_case; ++ ++ for (i=0; i< q->hash_divisor; i++) ++ q->ht[i] = q->depth; ++ for (i=0; idepth; i++) { ++ skb_queue_head_init(&q->qs[i]); ++ q->dep[i+q->depth].next = i+q->depth; ++ q->dep[i+q->depth].prev = i+q->depth; ++ } ++ ++ for (i=0; idepth; i++) ++ esfq_link(q, i); ++ return 0; ++err_case: ++ esfq_q_destroy(q); ++ return -ENOBUFS; ++} ++ ++static int esfq_init(struct Qdisc *sch, struct nlattr *opt) ++{ ++ struct esfq_sched_data *q = qdisc_priv(sch); ++ int err; ++ ++ q->quantum = psched_mtu(qdisc_dev(sch)); /* default */ ++ if ((err = esfq_q_init(q, opt))) ++ return err; ++ ++ init_timer(&q->perturb_timer); ++ q->perturb_timer.data = (unsigned long)sch; ++ q->perturb_timer.function = esfq_perturbation; ++ if (q->perturb_period) { ++ q->perturb_timer.expires = jiffies + q->perturb_period; ++ add_timer(&q->perturb_timer); ++ } ++ ++ return 0; ++} ++ ++static int esfq_change(struct Qdisc *sch, struct nlattr *opt) ++{ ++ struct esfq_sched_data *q = qdisc_priv(sch); ++ struct esfq_sched_data new; ++ struct sk_buff *skb; ++ int err; ++ ++ /* set up new queue */ ++ memset(&new, 0, sizeof(struct esfq_sched_data)); ++ new.quantum = psched_mtu(qdisc_dev(sch)); /* default */ ++ if ((err = esfq_q_init(&new, opt))) ++ return err; ++ ++ /* copy all packets from the old queue to the new queue */ ++ sch_tree_lock(sch); ++ while ((skb = esfq_q_dequeue(q)) != NULL) ++ esfq_q_enqueue(skb, &new, ESFQ_TAIL); ++ ++ /* clean up the old queue */ ++ esfq_q_destroy(q); ++ ++ /* copy elements of the new queue into the old queue */ ++ q->perturb_period = new.perturb_period; ++ q->quantum = new.quantum; ++ q->limit = new.limit; ++ q->depth = new.depth; ++ q->hash_divisor = new.hash_divisor; ++ q->hash_kind = new.hash_kind; ++ q->tail = new.tail; ++ q->max_depth = new.max_depth; ++ q->ht = new.ht; ++ q->dep = new.dep; ++ q->next = new.next; ++ q->allot = new.allot; ++ q->hash = new.hash; ++ q->qs = new.qs; ++ ++ /* finish up */ ++ if (q->perturb_period) { ++ q->perturb_timer.expires = jiffies + q->perturb_period; ++ add_timer(&q->perturb_timer); ++ } else { ++ q->perturbation = 0; ++ } ++ sch_tree_unlock(sch); ++ return 0; ++} ++ ++static int esfq_dump(struct Qdisc *sch, struct sk_buff *skb) ++{ ++ struct esfq_sched_data *q = qdisc_priv(sch); ++ unsigned char *b = skb_tail_pointer(skb); ++ struct tc_esfq_qopt opt; ++ ++ opt.quantum = q->quantum; ++ opt.perturb_period = q->perturb_period/HZ; ++ ++ opt.limit = q->limit; ++ opt.divisor = q->hash_divisor; ++ opt.flows = q->depth; ++ opt.hash_kind = q->hash_kind; ++ ++ NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt); ++ ++ return skb->len; ++ ++nla_put_failure: ++ nlmsg_trim(skb, b); ++ return -1; ++} ++ ++static struct Qdisc_ops esfq_qdisc_ops = ++{ ++ .next = NULL, ++ .cl_ops = NULL, ++ .id = "esfq", ++ .priv_size = sizeof(struct esfq_sched_data), ++ .enqueue = esfq_enqueue, ++ .dequeue = esfq_dequeue, ++ .peek = esfq_peek, ++ .drop = esfq_drop, ++ .init = esfq_init, ++ .reset = esfq_reset, ++ .destroy = esfq_destroy, ++ .change = esfq_change, ++ .dump = esfq_dump, ++ .owner = THIS_MODULE, ++}; ++ ++static int __init esfq_module_init(void) ++{ ++ return register_qdisc(&esfq_qdisc_ops); ++} ++static void __exit esfq_module_exit(void) ++{ ++ unregister_qdisc(&esfq_qdisc_ops); ++} ++module_init(esfq_module_init) ++module_exit(esfq_module_exit) ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic-2.6/patches-2.6.32/201-jhash3.patch b/target/linux/generic-2.6/patches-2.6.32/201-jhash3.patch new file mode 100644 index 000000000..0218fa19c --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/201-jhash3.patch @@ -0,0 +1,227 @@ +--- a/include/linux/jhash.h ++++ b/include/linux/jhash.h +@@ -3,80 +3,95 @@ + + /* jhash.h: Jenkins hash support. + * +- * Copyright (C) 1996 Bob Jenkins (bob_jenkins@burtleburtle.net) ++ * Copyright (C) 2006. Bob Jenkins (bob_jenkins@burtleburtle.net) + * + * http://burtleburtle.net/bob/hash/ + * + * These are the credits from Bob's sources: + * +- * lookup2.c, by Bob Jenkins, December 1996, Public Domain. +- * hash(), hash2(), hash3, and mix() are externally useful functions. +- * Routines to test the hash are included if SELF_TEST is defined. +- * You can use this free for any purpose. It has no warranty. ++ * lookup3.c, by Bob Jenkins, May 2006, Public Domain. + * +- * Copyright (C) 2003 David S. Miller (davem@redhat.com) ++ * These are functions for producing 32-bit hashes for hash table lookup. ++ * hashword(), hashlittle(), hashlittle2(), hashbig(), mix(), and final() ++ * are externally useful functions. Routines to test the hash are included ++ * if SELF_TEST is defined. You can use this free for any purpose. It's in ++ * the public domain. It has no warranty. ++ * ++ * Copyright (C) 2009 Jozsef Kadlecsik (kadlec@blackhole.kfki.hu) + * + * I've modified Bob's hash to be useful in the Linux kernel, and +- * any bugs present are surely my fault. -DaveM ++ * any bugs present are my fault. Jozsef + */ + +-/* NOTE: Arguments are modified. */ +-#define __jhash_mix(a, b, c) \ ++#define __rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) ++ ++/* __jhash_mix - mix 3 32-bit values reversibly. */ ++#define __jhash_mix(a,b,c) \ ++{ \ ++ a -= c; a ^= __rot(c, 4); c += b; \ ++ b -= a; b ^= __rot(a, 6); a += c; \ ++ c -= b; c ^= __rot(b, 8); b += a; \ ++ a -= c; a ^= __rot(c,16); c += b; \ ++ b -= a; b ^= __rot(a,19); a += c; \ ++ c -= b; c ^= __rot(b, 4); b += a; \ ++} ++ ++/* __jhash_final - final mixing of 3 32-bit values (a,b,c) into c */ ++#define __jhash_final(a,b,c) \ + { \ +- a -= b; a -= c; a ^= (c>>13); \ +- b -= c; b -= a; b ^= (a<<8); \ +- c -= a; c -= b; c ^= (b>>13); \ +- a -= b; a -= c; a ^= (c>>12); \ +- b -= c; b -= a; b ^= (a<<16); \ +- c -= a; c -= b; c ^= (b>>5); \ +- a -= b; a -= c; a ^= (c>>3); \ +- b -= c; b -= a; b ^= (a<<10); \ +- c -= a; c -= b; c ^= (b>>15); \ ++ c ^= b; c -= __rot(b,14); \ ++ a ^= c; a -= __rot(c,11); \ ++ b ^= a; b -= __rot(a,25); \ ++ c ^= b; c -= __rot(b,16); \ ++ a ^= c; a -= __rot(c,4); \ ++ b ^= a; b -= __rot(a,14); \ ++ c ^= b; c -= __rot(b,24); \ + } + +-/* The golden ration: an arbitrary value */ +-#define JHASH_GOLDEN_RATIO 0x9e3779b9 ++/* An arbitrary initial parameter */ ++#define JHASH_GOLDEN_RATIO 0xdeadbeef + + /* The most generic version, hashes an arbitrary sequence + * of bytes. No alignment or length assumptions are made about +- * the input key. ++ * the input key. The result depends on endianness. + */ + static inline u32 jhash(const void *key, u32 length, u32 initval) + { +- u32 a, b, c, len; ++ u32 a,b,c; + const u8 *k = key; + +- len = length; +- a = b = JHASH_GOLDEN_RATIO; +- c = initval; +- +- while (len >= 12) { +- a += (k[0] +((u32)k[1]<<8) +((u32)k[2]<<16) +((u32)k[3]<<24)); +- b += (k[4] +((u32)k[5]<<8) +((u32)k[6]<<16) +((u32)k[7]<<24)); +- c += (k[8] +((u32)k[9]<<8) +((u32)k[10]<<16)+((u32)k[11]<<24)); +- +- __jhash_mix(a,b,c); ++ /* Set up the internal state */ ++ a = b = c = JHASH_GOLDEN_RATIO + length + initval; + ++ /* all but the last block: affect some 32 bits of (a,b,c) */ ++ while (length > 12) { ++ a += (k[0] + ((u32)k[1]<<8) + ((u32)k[2]<<16) + ((u32)k[3]<<24)); ++ b += (k[4] + ((u32)k[5]<<8) + ((u32)k[6]<<16) + ((u32)k[7]<<24)); ++ c += (k[8] + ((u32)k[9]<<8) + ((u32)k[10]<<16) + ((u32)k[11]<<24)); ++ __jhash_mix(a, b, c); ++ length -= 12; + k += 12; +- len -= 12; + } + +- c += length; +- switch (len) { +- case 11: c += ((u32)k[10]<<24); +- case 10: c += ((u32)k[9]<<16); +- case 9 : c += ((u32)k[8]<<8); +- case 8 : b += ((u32)k[7]<<24); +- case 7 : b += ((u32)k[6]<<16); +- case 6 : b += ((u32)k[5]<<8); ++ /* last block: affect all 32 bits of (c) */ ++ /* all the case statements fall through */ ++ switch (length) { ++ case 12: c += (u32)k[11]<<24; ++ case 11: c += (u32)k[10]<<16; ++ case 10: c += (u32)k[9]<<8; ++ case 9 : c += k[8]; ++ case 8 : b += (u32)k[7]<<24; ++ case 7 : b += (u32)k[6]<<16; ++ case 6 : b += (u32)k[5]<<8; + case 5 : b += k[4]; +- case 4 : a += ((u32)k[3]<<24); +- case 3 : a += ((u32)k[2]<<16); +- case 2 : a += ((u32)k[1]<<8); ++ case 4 : a += (u32)k[3]<<24; ++ case 3 : a += (u32)k[2]<<16; ++ case 2 : a += (u32)k[1]<<8; + case 1 : a += k[0]; +- }; +- +- __jhash_mix(a,b,c); ++ __jhash_final(a, b, c); ++ case 0 : ++ break; ++ } + + return c; + } +@@ -86,58 +101,57 @@ static inline u32 jhash(const void *key, + */ + static inline u32 jhash2(const u32 *k, u32 length, u32 initval) + { +- u32 a, b, c, len; ++ u32 a, b, c; + +- a = b = JHASH_GOLDEN_RATIO; +- c = initval; +- len = length; ++ /* Set up the internal state */ ++ a = b = c = JHASH_GOLDEN_RATIO + (length<<2) + initval; + +- while (len >= 3) { ++ /* handle most of the key */ ++ while (length > 3) { + a += k[0]; + b += k[1]; + c += k[2]; + __jhash_mix(a, b, c); +- k += 3; len -= 3; ++ length -= 3; ++ k += 3; + } + +- c += length * 4; +- +- switch (len) { +- case 2 : b += k[1]; +- case 1 : a += k[0]; +- }; +- +- __jhash_mix(a,b,c); ++ /* handle the last 3 u32's */ ++ /* all the case statements fall through */ ++ switch (length) { ++ case 3: c += k[2]; ++ case 2: b += k[1]; ++ case 1: a += k[0]; ++ __jhash_final(a, b, c); ++ case 0: /* case 0: nothing left to add */ ++ break; ++ } + + return c; + } + +- + /* A special ultra-optimized versions that knows they are hashing exactly + * 3, 2 or 1 word(s). +- * +- * NOTE: In partilar the "c += length; __jhash_mix(a,b,c);" normally +- * done at the end is not done here. + */ + static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval) + { +- a += JHASH_GOLDEN_RATIO; +- b += JHASH_GOLDEN_RATIO; +- c += initval; ++ a += JHASH_GOLDEN_RATIO + initval; ++ b += JHASH_GOLDEN_RATIO + initval; ++ c += JHASH_GOLDEN_RATIO + initval; + +- __jhash_mix(a, b, c); ++ __jhash_final(a, b, c); + + return c; + } + + static inline u32 jhash_2words(u32 a, u32 b, u32 initval) + { +- return jhash_3words(a, b, 0, initval); ++ return jhash_3words(0, a, b, initval); + } + + static inline u32 jhash_1word(u32 a, u32 initval) + { +- return jhash_3words(a, 0, 0, initval); ++ return jhash_3words(0, 0, a, initval); + } + + #endif /* _LINUX_JHASH_H */ diff --git a/target/linux/generic-2.6/patches-2.6.32/202-mips-freestanding.patch b/target/linux/generic-2.6/patches-2.6.32/202-mips-freestanding.patch new file mode 100644 index 000000000..0c6d58508 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/202-mips-freestanding.patch @@ -0,0 +1,12 @@ +--- a/arch/mips/Makefile ++++ b/arch/mips/Makefile +@@ -624,6 +624,9 @@ else + load-$(CONFIG_CPU_CAVIUM_OCTEON) += 0xffffffff81100000 + endif + ++# temporary until string.h is fixed ++cflags-y += -ffreestanding ++ + cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic + drivers-$(CONFIG_PCI) += arch/mips/pci/ + diff --git a/target/linux/generic-2.6/patches-2.6.32/203-slab_maxsize.patch b/target/linux/generic-2.6/patches-2.6.32/203-slab_maxsize.patch new file mode 100644 index 000000000..0c1ae72a4 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/203-slab_maxsize.patch @@ -0,0 +1,13 @@ +--- a/include/linux/slab.h ++++ b/include/linux/slab.h +@@ -124,8 +124,8 @@ int kmem_ptr_validate(struct kmem_cache + * to do various tricks to work around compiler limitations in order to + * ensure proper constant folding. + */ +-#define KMALLOC_SHIFT_HIGH ((MAX_ORDER + PAGE_SHIFT - 1) <= 25 ? \ +- (MAX_ORDER + PAGE_SHIFT - 1) : 25) ++#define KMALLOC_SHIFT_HIGH ((MAX_ORDER + PAGE_SHIFT - 1) <= 17 ? \ ++ (MAX_ORDER + PAGE_SHIFT - 1) : 17) + + #define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_HIGH) + #define KMALLOC_MAX_ORDER (KMALLOC_SHIFT_HIGH - PAGE_SHIFT) diff --git a/target/linux/generic-2.6/patches-2.6.32/204-jffs2_eofdetect.patch b/target/linux/generic-2.6/patches-2.6.32/204-jffs2_eofdetect.patch new file mode 100644 index 000000000..16d3e1f8e --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/204-jffs2_eofdetect.patch @@ -0,0 +1,132 @@ +--- a/fs/jffs2/build.c ++++ b/fs/jffs2/build.c +@@ -111,6 +111,17 @@ static int jffs2_build_filesystem(struct + dbg_fsbuild("scanned flash completely\n"); + jffs2_dbg_dump_block_lists_nolock(c); + ++ if (c->flags & (1 << 7)) { ++ printk("%s(): unlocking the mtd device... ", __func__); ++ if (c->mtd->unlock) ++ c->mtd->unlock(c->mtd, 0, c->mtd->size); ++ printk("done.\n"); ++ ++ printk("%s(): erasing all blocks after the end marker... ", __func__); ++ jffs2_erase_pending_blocks(c, -1); ++ printk("done.\n"); ++ } ++ + dbg_fsbuild("pass 1 starting\n"); + c->flags |= JFFS2_SB_FLAG_BUILDING; + /* Now scan the directory tree, increasing nlink according to every dirent found. */ +--- a/fs/jffs2/scan.c ++++ b/fs/jffs2/scan.c +@@ -72,7 +72,7 @@ static int file_dirty(struct jffs2_sb_in + return ret; + if ((ret = jffs2_scan_dirty_space(c, jeb, jeb->free_size))) + return ret; +- /* Turned wasted size into dirty, since we apparently ++ /* Turned wasted size into dirty, since we apparently + think it's recoverable now. */ + jeb->dirty_size += jeb->wasted_size; + c->dirty_size += jeb->wasted_size; +@@ -144,8 +144,11 @@ int jffs2_scan_medium(struct jffs2_sb_in + /* reset summary info for next eraseblock scan */ + jffs2_sum_reset_collected(s); + +- ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset), +- buf_size, s); ++ if (c->flags & (1 << 7)) ++ ret = BLK_STATE_ALLFF; ++ else ++ ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset), ++ buf_size, s); + + if (ret < 0) + goto out; +@@ -400,7 +403,7 @@ static int jffs2_scan_xref_node(struct j + if (!ref) + return -ENOMEM; + +- /* BEFORE jffs2_build_xattr_subsystem() called, ++ /* BEFORE jffs2_build_xattr_subsystem() called, + * and AFTER xattr_ref is marked as a dead xref, + * ref->xid is used to store 32bit xid, xd is not used + * ref->ino is used to store 32bit inode-number, ic is not used +@@ -473,7 +476,7 @@ static int jffs2_scan_eraseblock (struct + struct jffs2_sum_marker *sm; + void *sumptr = NULL; + uint32_t sumlen; +- ++ + if (!buf_size) { + /* XIP case. Just look, point at the summary if it's there */ + sm = (void *)buf + c->sector_size - sizeof(*sm); +@@ -489,9 +492,9 @@ static int jffs2_scan_eraseblock (struct + buf_len = sizeof(*sm); + + /* Read as much as we want into the _end_ of the preallocated buffer */ +- err = jffs2_fill_scan_buf(c, buf + buf_size - buf_len, ++ err = jffs2_fill_scan_buf(c, buf + buf_size - buf_len, + jeb->offset + c->sector_size - buf_len, +- buf_len); ++ buf_len); + if (err) + return err; + +@@ -510,9 +513,9 @@ static int jffs2_scan_eraseblock (struct + } + if (buf_len < sumlen) { + /* Need to read more so that the entire summary node is present */ +- err = jffs2_fill_scan_buf(c, sumptr, ++ err = jffs2_fill_scan_buf(c, sumptr, + jeb->offset + c->sector_size - sumlen, +- sumlen - buf_len); ++ sumlen - buf_len); + if (err) + return err; + } +@@ -525,7 +528,7 @@ static int jffs2_scan_eraseblock (struct + + if (buf_size && sumlen > buf_size) + kfree(sumptr); +- /* If it returns with a real error, bail. ++ /* If it returns with a real error, bail. + If it returns positive, that's a block classification + (i.e. BLK_STATE_xxx) so return that too. + If it returns zero, fall through to full scan. */ +@@ -546,6 +549,17 @@ static int jffs2_scan_eraseblock (struct + return err; + } + ++ if ((buf[0] == 0xde) && ++ (buf[1] == 0xad) && ++ (buf[2] == 0xc0) && ++ (buf[3] == 0xde)) { ++ /* end of filesystem. erase everything after this point */ ++ printk("%s(): End of filesystem marker found at 0x%x\n", __func__, jeb->offset); ++ c->flags |= (1 << 7); ++ ++ return BLK_STATE_ALLFF; ++ } ++ + /* We temporarily use 'ofs' as a pointer into the buffer/jeb */ + ofs = 0; + +@@ -671,7 +685,7 @@ scan_more: + scan_end = buf_len; + goto more_empty; + } +- ++ + /* See how much more there is to read in this eraseblock... */ + buf_len = min_t(uint32_t, buf_size, jeb->offset + c->sector_size - ofs); + if (!buf_len) { +@@ -907,7 +921,7 @@ scan_more: + + D1(printk(KERN_DEBUG "Block at 0x%08x: free 0x%08x, dirty 0x%08x, unchecked 0x%08x, used 0x%08x, wasted 0x%08x\n", + jeb->offset,jeb->free_size, jeb->dirty_size, jeb->unchecked_size, jeb->used_size, jeb->wasted_size)); +- ++ + /* mark_node_obsolete can add to wasted !! */ + if (jeb->wasted_size) { + jeb->dirty_size += jeb->wasted_size; diff --git a/target/linux/generic-2.6/patches-2.6.32/205-skb_padding.patch b/target/linux/generic-2.6/patches-2.6.32/205-skb_padding.patch new file mode 100644 index 000000000..948c0b2d4 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/205-skb_padding.patch @@ -0,0 +1,56 @@ +--- a/include/linux/skbuff.h ++++ b/include/linux/skbuff.h +@@ -1383,11 +1383,18 @@ static inline int skb_network_offset(con + * + * Various parts of the networking layer expect at least 32 bytes of + * headroom, you should not reduce this. ++ * ++ * This has been changed to 64 to acommodate for routing between ethernet ++ * and wireless, but only for new allocations + */ + #ifndef NET_SKB_PAD + #define NET_SKB_PAD 32 + #endif + ++#ifndef NET_SKB_PAD_ALLOC ++#define NET_SKB_PAD_ALLOC 64 ++#endif ++ + extern int ___pskb_trim(struct sk_buff *skb, unsigned int len); + + static inline void __skb_trim(struct sk_buff *skb, unsigned int len) +@@ -1477,9 +1484,9 @@ static inline void __skb_queue_purge(str + static inline struct sk_buff *__dev_alloc_skb(unsigned int length, + gfp_t gfp_mask) + { +- struct sk_buff *skb = alloc_skb(length + NET_SKB_PAD, gfp_mask); ++ struct sk_buff *skb = alloc_skb(length + NET_SKB_PAD_ALLOC, gfp_mask); + if (likely(skb)) +- skb_reserve(skb, NET_SKB_PAD); ++ skb_reserve(skb, NET_SKB_PAD_ALLOC); + return skb; + } + +@@ -1552,7 +1559,7 @@ static inline int __skb_cow(struct sk_bu + delta = headroom - skb_headroom(skb); + + if (delta || cloned) +- return pskb_expand_head(skb, ALIGN(delta, NET_SKB_PAD), 0, ++ return pskb_expand_head(skb, ALIGN(delta, NET_SKB_PAD_ALLOC), 0, + GFP_ATOMIC); + return 0; + } +--- a/net/core/skbuff.c ++++ b/net/core/skbuff.c +@@ -336,9 +336,9 @@ struct sk_buff *__netdev_alloc_skb(struc + int node = dev->dev.parent ? dev_to_node(dev->dev.parent) : -1; + struct sk_buff *skb; + +- skb = __alloc_skb(length + NET_SKB_PAD, gfp_mask, 0, node); ++ skb = __alloc_skb(length + NET_SKB_PAD_ALLOC, gfp_mask, 0, node); + if (likely(skb)) { +- skb_reserve(skb, NET_SKB_PAD); ++ skb_reserve(skb, NET_SKB_PAD_ALLOC); + skb->dev = dev; + } + return skb; diff --git a/target/linux/generic-2.6/patches-2.6.32/207-powerpc_asm_segment_h.patch b/target/linux/generic-2.6/patches-2.6.32/207-powerpc_asm_segment_h.patch new file mode 100644 index 000000000..1272e82c7 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/207-powerpc_asm_segment_h.patch @@ -0,0 +1,9 @@ +--- /dev/null ++++ b/include/asm-powerpc/segment.h +@@ -0,0 +1,6 @@ ++#ifndef _ASM_SEGMENT_H ++#define _ASM_SEGMENT_H ++ ++/* Only here because we have some old header files that expect it.. */ ++ ++#endif /* _ASM_SEGMENT_H */ diff --git a/target/linux/generic-2.6/patches-2.6.32/209-mini_fo.patch b/target/linux/generic-2.6/patches-2.6.32/209-mini_fo.patch new file mode 100644 index 000000000..0b4091c64 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/209-mini_fo.patch @@ -0,0 +1,7780 @@ +--- a/fs/Kconfig ++++ b/fs/Kconfig +@@ -180,6 +180,7 @@ source "fs/ubifs/Kconfig" + source "fs/cramfs/Kconfig" + source "fs/squashfs/Kconfig" + source "fs/freevxfs/Kconfig" ++source "fs/mini_fo/Kconfig" + source "fs/minix/Kconfig" + source "fs/omfs/Kconfig" + source "fs/hpfs/Kconfig" +--- a/fs/Makefile ++++ b/fs/Makefile +@@ -77,6 +77,7 @@ obj-$(CONFIG_SQUASHFS) += squashfs/ + obj-y += ramfs/ + obj-$(CONFIG_HUGETLBFS) += hugetlbfs/ + obj-$(CONFIG_CODA_FS) += coda/ ++obj-$(CONFIG_MINI_FO) += mini_fo/ + obj-$(CONFIG_MINIX_FS) += minix/ + obj-$(CONFIG_FAT_FS) += fat/ + obj-$(CONFIG_BFS_FS) += bfs/ +--- /dev/null ++++ b/fs/mini_fo/aux.c +@@ -0,0 +1,577 @@ ++/* ++ * Copyright (c) 1997-2003 Erez Zadok ++ * Copyright (c) 2001-2003 Stony Brook University ++ * ++ * For specific licensing information, see the COPYING file distributed with ++ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING. ++ * ++ * This Copyright notice must be kept intact and distributed with all ++ * fistgen sources INCLUDING sources generated by fistgen. ++ */ ++/* ++ * Copyright (C) 2004, 2005 Markus Klotzbuecher ++ * ++ * 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 of the License, or (at your option) any later version. ++ */ ++/* ++ * $Id$ ++ */ ++ ++#ifdef HAVE_CONFIG_H ++# include ++#endif ++ ++#include "fist.h" ++#include "mini_fo.h" ++ ++/* check if file exists in storage */ ++int exists_in_storage(dentry_t *dentry) ++{ ++ check_mini_fo_dentry(dentry); ++ if(dtost(dentry) == MODIFIED || dtost(dentry) == CREATED || dtost(dentry) == DEL_REWRITTEN) ++ return 1; ++ return 0; ++} ++ ++/* check if dentry is in an existing state */ ++int is_mini_fo_existant(dentry_t *dentry) ++{ ++ check_mini_fo_dentry(dentry); ++ ++ if(dtost(dentry) == DELETED || dtost(dentry) == NON_EXISTANT) ++ return 0; ++ else ++ return 1; ++} ++ ++/* ++ * This function will create a negative storage dentry for ++ * dentry, what is required for many create like options. ++ * It will create the storage structure if necessary. ++ */ ++int get_neg_sto_dentry(dentry_t *dentry) ++{ ++ int err = 0; ++ unsigned int len; ++ const unsigned char *name; ++ ++ if(!dentry || ++ !dtopd(dentry) || ++ !(dtost(dentry) == UNMODIFIED || ++ dtost(dentry) == NON_EXISTANT || ++ dtost(dentry) == DELETED)) { ++ printk(KERN_CRIT "mini_fo: get_neg_sto_dentry: invalid dentry passed.\n"); ++ err = -1; ++ goto out; ++ } ++ /* Have we got a neg. dentry already? */ ++ if(dtohd2(dentry)) { ++ err = 0; ++ goto out; ++ } ++ if(dtost(dentry->d_parent) == UNMODIFIED) { ++ /* build sto struct */ ++ err = build_sto_structure(dentry->d_parent->d_parent, dentry->d_parent); ++ if(err || ++ dtost(dentry->d_parent) != MODIFIED) { ++ printk(KERN_CRIT "mini_fo: get_neg_sto_dentry: ERROR building sto structure.\n"); ++ err = -1; ++ goto out; ++ } ++ } ++ ++ len = dentry->d_name.len; ++ name = dentry->d_name.name; ++ ++ dtohd2(dentry) = ++ lookup_one_len(name, dtohd2(dentry->d_parent), len); ++ ++ out: ++ return err; ++} ++ ++int check_mini_fo_dentry(dentry_t *dentry) ++{ ++ ASSERT(dentry != NULL); ++ ASSERT(dtopd(dentry) != NULL); ++ ASSERT((dtohd(dentry) != NULL) || (dtohd2(dentry) != NULL)); ++ ++/* if(dtost(dentry) == MODIFIED) { */ ++/* ASSERT(dentry->d_inode != NULL); */ ++/* ASSERT(dtohd(dentry) != NULL); */ ++/* ASSERT(dtohd(dentry)->d_inode != NULL); */ ++/* ASSERT(dtohd2(dentry) != NULL); */ ++/* ASSERT(dtohd2(dentry)->d_inode != NULL); */ ++/* } */ ++/* else if(dtost(dentry) == UNMODIFIED) { */ ++/* ASSERT(dentry->d_inode != NULL); */ ++/* ASSERT( */ ++/* } */ ++ return 0; ++} ++ ++int check_mini_fo_file(file_t *file) ++{ ++ ASSERT(file != NULL); ++ ASSERT(ftopd(file) != NULL); ++ ASSERT(file->f_dentry != NULL); ++ ++ /* violent checking, check depending of state and type ++ * if(S_ISDIR(file->f_dentry->d_inode->i_mode)) {} ++ */ ++ ASSERT((ftohf(file) != NULL) || (ftohf2(file) != NULL)); ++ return 0; ++} ++ ++int check_mini_fo_inode(inode_t *inode) ++{ ++ ASSERT(inode != NULL); ++ ASSERT(itopd(inode) != NULL); ++ ASSERT((itohi(inode) != NULL) || (itohi2(inode) != NULL)); ++ return 0; ++} ++ ++/* ++ * will walk a base path as provided by get_mini_fo_bpath and return ++ * the (hopefully ;-) ) positive dentry of the renamed base dir. ++ * ++ * This does some work of path_init. ++ */ ++dentry_t *bpath_walk(super_block_t *sb, char *bpath) ++{ ++ int err; ++ struct vfsmount *mnt; ++ struct nameidata nd; ++ ++ /* be paranoid */ ++ if(!bpath || bpath[0] != '/') { ++ printk(KERN_CRIT "mini_fo: bpath_walk: Invalid string.\n"); ++ return NULL; ++ } ++ if(!sb || !stopd(sb)) { ++ printk(KERN_CRIT "mini_fo: bpath_walk: Invalid sb.\n"); ++ return NULL; ++ } ++ ++ /* fix this: how do I reach this lock? ++ * read_lock(¤t->fs->lock); */ ++ mnt = mntget(stopd(sb)->hidden_mnt); ++ /* read_unlock(¤t->fs->lock); */ ++ ++ err = vfs_path_lookup(mnt->mnt_root, mnt, bpath+1, 0, &nd); ++ ++ /* validate */ ++ if (err || !nd.dentry || !nd.dentry->d_inode) { ++ printk(KERN_CRIT "mini_fo: bpath_walk: path_walk failed.\n"); ++ return NULL; ++ } ++ return nd.dentry; ++} ++ ++ ++/* returns the full path of the basefile incl. its name */ ++int get_mini_fo_bpath(dentry_t *dentry, char **bpath, int *bpath_len) ++{ ++ char *buf_walker; ++ int len = 0; ++ dentry_t *sky_walker; ++ ++ if(!dentry || !dtohd(dentry)) { ++ printk(KERN_CRIT "mini_fo: get_mini_fo_bpath: invalid dentry passed.\n"); ++ return -1; ++ } ++ sky_walker = dtohd(dentry); ++ ++ do { ++ len += sky_walker->d_name.len + 1 ; /* 1 for '/' */ ++ sky_walker = sky_walker->d_parent; ++ } while(sky_walker != stopd(dentry->d_inode->i_sb)->base_dir_dentry); ++ ++ /* 1 to oil the loop */ ++ *bpath = (char*) kmalloc(len + 1, GFP_KERNEL); ++ if(!*bpath) { ++ printk(KERN_CRIT "mini_fo: get_mini_fo_bpath: out of mem.\n"); ++ return -1; ++ } ++ buf_walker = *bpath+len; /* put it on last char */ ++ *buf_walker = '\n'; ++ sky_walker = dtohd(dentry); ++ ++ do { ++ buf_walker -= sky_walker->d_name.len; ++ strncpy(buf_walker, ++ sky_walker->d_name.name, ++ sky_walker->d_name.len); ++ *(--buf_walker) = '/'; ++ sky_walker = sky_walker->d_parent; ++ } while(sky_walker != stopd(dentry->d_inode->i_sb)->base_dir_dentry); ++ ++ /* bpath_len doesn't count newline! */ ++ *bpath_len = len; ++ return 0; ++} ++ ++int mini_fo_cp_cont(dentry_t *tgt_dentry, struct vfsmount *tgt_mnt, ++ dentry_t *src_dentry, struct vfsmount *src_mnt) ++{ ++ void *buf; ++ mm_segment_t old_fs; ++ file_t *tgt_file; ++ file_t *src_file; ++ int bytes, len, tmp, err; ++ err = 0; ++ ++ if(!(tgt_dentry->d_inode && src_dentry->d_inode)) { ++ printk(KERN_CRIT "mini_fo_cp_cont: ERROR, neg. dentry passed.\n"); ++ err = -EINVAL; ++ goto out; ++ } ++ ++ dget(tgt_dentry); ++ dget(src_dentry); ++ mntget(tgt_mnt); ++ mntget(src_mnt); ++ ++ /* open file write only */ ++ tgt_file = dentry_open(tgt_dentry, tgt_mnt, 0x1); ++ if(!tgt_file || IS_ERR(tgt_file)) { ++ printk(KERN_CRIT "mini_fo_cp_cont: ERROR opening target file.\n"); ++ err = PTR_ERR(tgt_file); ++ goto out_err; ++ } ++ ++ /* open file read only */ ++ src_file = dentry_open(src_dentry, src_mnt, 0x0); ++ if(!src_file || IS_ERR(src_file)) { ++ printk(KERN_CRIT "mini_fo_cp_cont: ERROR opening source file.\n"); ++ err = PTR_ERR(src_file); ++ ++ /* close target file */ ++ fput(tgt_file); ++ goto out_err; ++ } ++ ++ /* check if the filesystem(s) support read respective write */ ++ if(!src_file->f_op->read || !tgt_file->f_op->write) { ++ printk(KERN_CRIT "mini_fo_cp_cont: ERROR, no fs read or write support.\n"); ++ err = -EPERM; ++ goto out_close; ++ } ++ ++ /* allocate a page for transfering the data */ ++ buf = (void *) __get_free_page(GFP_KERNEL); ++ if(!buf) { ++ printk(KERN_CRIT "mini_fo_cp_cont: ERROR, out of kernel mem.\n"); ++ goto out_err; ++ } ++ ++ tgt_file->f_pos = 0; ++ src_file->f_pos = 0; ++ ++ old_fs = get_fs(); ++ set_fs(KERNEL_DS); ++ ++ /* Doing this I assume that a read operation will return a full ++ * buffer while there is still data to read, and a less than ++ * full buffer when all data has been read. ++ */ ++ bytes = len = PAGE_SIZE; ++ while(bytes == len) { ++ bytes = src_file->f_op->read(src_file, buf, len, ++ &src_file->f_pos); ++ tmp = tgt_file->f_op->write(tgt_file, buf, bytes, ++ &tgt_file->f_pos); ++ if(tmp != bytes) { ++ printk(KERN_CRIT "mini_fo_cp_cont: ERROR writing.\n"); ++ goto out_close_unset; ++ } ++ } ++ ++ free_page((unsigned long) buf); ++ set_fs(old_fs); ++ fput(tgt_file); ++ fput(src_file); ++ goto out; ++ ++ out_close_unset: ++ free_page((unsigned long) buf); ++ set_fs(old_fs); ++ ++ out_close: ++ fput(tgt_file); ++ fput(src_file); ++ ++ out_err: ++ dput(tgt_dentry); ++ dput(src_dentry); ++ ++ /* mk: not sure if this need to be done */ ++ mntput(tgt_mnt); ++ mntput(src_mnt); ++ ++ out: ++ return err; ++} ++ ++/* mk: ++ * ndl (no-duplicate list) stuff ++ * This is used in mini_fo_readdir, to save the storage directory contents ++ * and later when reading base, match them against the list in order ++ * to avoid duplicates. ++ */ ++ ++/* add a file specified by name and len to the ndl ++ * Return values: 0 on success, <0 on failure. ++ */ ++int ndl_add_entry(struct readdir_data *rd, const char *name, int len) ++{ ++ struct ndl_entry *tmp_entry; ++ ++ tmp_entry = (struct ndl_entry *) ++ kmalloc(sizeof(struct ndl_entry), GFP_KERNEL); ++ if(!tmp_entry) { ++ printk(KERN_CRIT "mini_fo: ndl_add_entry: out of mem.\n"); ++ return -ENOMEM; ++ } ++ tmp_entry->name = (char*) kmalloc(len, GFP_KERNEL); ++ if(!tmp_entry->name) { ++ printk(KERN_CRIT "mini_fo: ndl_add_entry: out of mem.\n"); ++ return -ENOMEM; ++ } ++ strncpy(tmp_entry->name, name, len); ++ tmp_entry->len = len; ++ ++ list_add(&tmp_entry->list, &rd->ndl_list); ++ rd->ndl_size++; ++ return 0; ++} ++ ++/* delete all list entries and free memory */ ++void ndl_put_list(struct readdir_data *rd) ++{ ++ struct list_head *tmp; ++ struct ndl_entry *tmp_entry; ++ ++ if(rd->ndl_size <= 0) ++ return; ++ while(!list_empty(&rd->ndl_list)) { ++ tmp = rd->ndl_list.next; ++ list_del(tmp); ++ tmp_entry = list_entry(tmp, struct ndl_entry, list); ++ kfree(tmp_entry->name); ++ kfree(tmp_entry); ++ } ++ rd->ndl_size = 0; ++} ++ ++/* Check if a file specified by name and len is in the ndl ++ * Return value: 0 if not in list, 1 if file is found in ndl. ++ */ ++int ndl_check_entry(struct readdir_data *rd, const char *name, int len) ++{ ++ struct list_head *tmp; ++ struct ndl_entry *tmp_entry; ++ ++ if(rd->ndl_size <= 0) ++ return 0; ++ ++ list_for_each(tmp, &rd->ndl_list) { ++ tmp_entry = list_entry(tmp, struct ndl_entry, list); ++ if(tmp_entry->len != len) ++ continue; ++ if(!strncmp(tmp_entry->name, name, len)) ++ return 1; ++ } ++ return 0; ++} ++ ++/* mk: ++ * Recursive function to create corresponding directorys in the storage fs. ++ * The function will build the storage directorys up to dentry. ++ */ ++int build_sto_structure(dentry_t *dir, dentry_t *dentry) ++{ ++ int err; ++ dentry_t *hidden_sto_dentry; ++ dentry_t *hidden_sto_dir_dentry; ++ ++ if(dentry->d_parent != dir) { ++ printk(KERN_CRIT "mini_fo: build_sto_structure: invalid parameter or meta data corruption [1].\n"); ++ return 1; ++ } ++ ++ if(dtost(dir) != MODIFIED) { ++ err = build_sto_structure(dir->d_parent, dentry->d_parent); ++ if(err) ++ return err; ++ } ++ ++ /* ok, coming back again. */ ++ check_mini_fo_dentry(dentry); ++ hidden_sto_dentry = dtohd2(dentry); ++ ++ if(!hidden_sto_dentry) { ++ /* ++ * This is the case after creating the first ++ * hidden_sto_dentry. ++ * After one negative storage_dentry, all pointers to ++ * hidden_storage dentries are set to NULL. We need to ++ * create the negative dentry before we create the storage ++ * file. ++ */ ++ unsigned int len; ++ const unsigned char *name; ++ len = dtohd(dentry)->d_name.len; ++ name = dtohd(dentry)->d_name.name; ++ hidden_sto_dentry = lookup_one_len(name, dtohd2(dir), len); ++ dtohd2(dentry) = hidden_sto_dentry; ++ } ++ ++ /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */ ++ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ down(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ /* lets be safe */ ++ if(dtohd2(dir) != hidden_sto_dir_dentry) { ++ printk(KERN_CRIT "mini_fo: build_sto_structure: invalid parameter or meta data corruption [2].\n"); ++ return 1; ++ } ++ ++ /* check for errors in lock_parent */ ++ err = PTR_ERR(hidden_sto_dir_dentry); ++ if(IS_ERR(hidden_sto_dir_dentry)) { ++ printk(KERN_CRIT "mini_fo: build_sto_structure: lock_parent failed.\n"); ++ return err; ++ } ++ ++ err = vfs_mkdir(hidden_sto_dir_dentry->d_inode, ++ hidden_sto_dentry, ++ dir->d_inode->i_mode); ++ ++ if(err) { ++ printk(KERN_CRIT "mini_fo: build_sto_structure: failed to create storage dir [1].\n"); ++ /* was: unlock_dir(dir); */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&dir->d_inode->i_mutex); ++#else ++ up(&dir->d_inode->i_sem); ++#endif ++ dput(dir); ++ return err; ++ } ++ ++ /* everything ok! */ ++ if(!dtohd2(dentry)->d_inode) { ++ printk(KERN_CRIT "mini_fo: build_sto_structure: failed to create storage dir [2].\n"); ++ /* was: unlock_dir(dir); */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&dir->d_inode->i_mutex); ++#else ++ up(&dir->d_inode->i_sem); ++#endif ++ dput(dir); ++ return 1; ++ } ++ ++ /* interpose the new inode and set new state */ ++ itohi2(dentry->d_inode) = igrab(dtohd2(dentry)->d_inode); ++ dtopd(dentry)->state = MODIFIED; ++ ++ /* initalize the wol list */ ++ itopd(dentry->d_inode)->deleted_list_size = -1; ++ itopd(dentry->d_inode)->renamed_list_size = -1; ++ meta_build_lists(dentry); ++ ++ fist_copy_attr_all(dentry->d_inode, itohi2(dentry->d_inode)); ++ fist_copy_attr_timesizes(dir->d_inode, ++ hidden_sto_dir_dentry->d_inode); ++ dir->d_inode->i_nlink++; ++ /* was: unlock_dir(hidden_sto_dir_dentry); */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ dput(hidden_sto_dir_dentry); ++ return 0; ++} ++ ++ ++#if 0 /* unused */ ++ ++/* ++ * Read "len" bytes from "filename" into "buf". ++ * "buf" is in kernel space. ++ */ ++int ++mini_fo_read_file(const char *filename, void *buf, int len) ++{ ++ file_t *filp; ++ mm_segment_t oldfs; ++ int bytes; ++ /* Chroot? Maybe NULL isn't right here */ ++ filp = filp_open(filename, O_RDONLY, 0); ++ if (!filp || IS_ERR(filp)) { ++ printk("mini_fo_read_file err %d\n", (int) PTR_ERR(filp)); ++ return -1; /* or do something else */ ++ } ++ ++ if (!filp->f_op->read) ++ return -2; /* file(system) doesn't allow reads */ ++ ++ /* now read len bytes from offset 0 */ ++ filp->f_pos = 0; /* start offset */ ++ oldfs = get_fs(); ++ set_fs(KERNEL_DS); ++ bytes = filp->f_op->read(filp, buf, len, &filp->f_pos); ++ set_fs(oldfs); ++ ++ /* close the file */ ++ fput(filp); ++ ++ return bytes; ++} ++ ++ ++ ++/* ++ * Write "len" bytes from "buf" to "filename" ++ * "buf" is in kernel space. ++ */ ++int ++mini_fo_write_file(const char *filename, void *buf, int len) ++{ ++ file_t *filp; ++ mm_segment_t oldfs; ++ int bytes; ++ /* Chroot? Maybe NULL isn't right here */ ++ filp = filp_open(filename, O_RDWR|O_CREAT, 0640); ++ if (!filp || IS_ERR(filp)) { ++ printk("mini_fo_write_file err %d\n", (int) PTR_ERR(filp)); ++ return -1; /* or do something else */ ++ } ++ ++ if (!filp->f_op->write) ++ return -2; /* file(system) doesn't allow writes */ ++ ++ /* now write len bytes from offset 0 */ ++ filp->f_pos = 0; /* start offset */ ++ oldfs = get_fs(); ++ set_fs(KERNEL_DS); ++ bytes = filp->f_op->write(filp, buf, len, &filp->f_pos); ++ set_fs(oldfs); ++ ++ /* close the file */ ++ fput(filp); ++ ++ return bytes; ++} ++ ++#endif /* unused */ ++ +--- /dev/null ++++ b/fs/mini_fo/ChangeLog +@@ -0,0 +1,281 @@ ++2006-01-24 Markus Klotzbuecher ++ ++ * Add tons of ugly ifdefs to Ed L. Cashin's mutex patch to ++ retain backwards compatibility. ++ ++2006-01-24 Ed L. Cashin ++ ++ * Support for the new mutex infrastructure ++ (7892f2f48d165a34b0b8130c8a195dfd807b8cb6) ++ ++2005-10-15 Markus Klotzbuecher ++ ++ * Bugfix for a serious memory leak in mini_fo_follow_link. ++ ++2005-09-21 Markus Klotzbuecher ++ ++ * new release 0.6.1 ++ ++ * fix of a compiler warning due to changes in 2.6.13 ++ ++2005-09-21 Klaus Wenninger ++ ++ * file.c: readdir: fix for a bug that caused directory entries ++ to show up twice when using storage filesystems such as ++ minixfs or pramfs. ++ ++2005-06-30 Eric Lammerts ++ ++ * fix for an oops when overwriting a binary thats beeing ++ executed. ++ ++2005-06-09 ++ ++ * Renamed overlay to mini_fo-overlay. ++ ++ * Added mini_fo-merge script to allow merging of storage and base ++ after making modifications. ++ ++2005-05-22 root ++ ++ * Added overlay script that allows to easily mount mini_fo ontop ++ of a given base directory ++ ++2005-05-10 ++ ++ * inode.c: xattr functions return -EOPNOSUPP instead of ++ -ENOSUPP, what confuses "ls -l" ++ ++ * Changed license from LGPL to GPL. ++ ++2005-05-08 root ++ ++ * Makefile: clean it up and added make install and make ++ uninstall. ++ ++2005-05-06 ++ ++ * merged devel branch back to main. [v0-6-0-pre3] ++ ++ * removed unused files print.c and fist_ioctl. [devel-0-0-18] ++ ++ * ioctl: removed fist_ioctl stuff, that is not needed for ++ now. ++ ++2005-05-03 ++ ++ * file.c: simplified mini_fo_open and mini_fo_setattr using ++ new state changing functions. [devel-0-0-17] ++ ++ * inode.c: Fixed getattr state bug (see below) in 2.4 function ++ mini_fo_inode revalidate. ++ ++ * inode.c: found an other bug in mini_fo_getattr. States are not ++ reliable in this function, as a file can be opened, unlinked and ++ the getattr function called. This results in a deleted dentry ++ with an inode. Fix is to ignore states and simply use the inode ++ available. ++ ++2005-04-29 ++ ++ * file.c: Bugfix and cleanup in fasync and fsync. [devel-0-0-16] ++ ++ * file.c: do not use mini_fo_lock so the generic version is ++ used (I guess). ++ ++ * inode.c: getattr, never call getattr on lower files, as this ++ will cause the inum to change. ++ ++ * inode.c: rename_reg_file renamed to rename_nondir, as it ++ doesn't matter as long it't not a dir. Removed all ++ rename_dev_file etc. ++ ++ * tagged as devel-0-0-15 ++ ++ * inode.c: added support for chosing support for extended ++ attrs at compile time by XATTR define in mini_fo.h . ++ ++ * inode.c: fixed mini_fo_getattr to use mini_fo inode and not ++ lower again, what avoids inode number changes that confused ++ rm again. This is the proper solution. ++ ++2005-04-24 ++ ++ * all files: updated Copyright notive to 2005. [devel-0-0-14] ++ ++ * inode.c: fixed mini_fo_getattr to not change the inode ++ number, even if lower files change. ++ ++ * super.c: fixed a bug that caused deleted base file to show ++ up suddenly after some time, or after creating a special ++ file. The problem was that after some time or after special ++ file creating sync_sb_inodes is called by the vfs, that ++ called our mini_fo_put_inode. There was (wrongly) called ++ __meta_put_lists, that nuked the lists, although the inode ++ was going to continue its life. Moving __meta_put_lists to ++ mini_fo_clear_inode, where an inode is really destroyed, ++ solved the problem. ++ ++ ++2005-04-23 ++ ++ * state.c, aux.c: more cleaning up and ++ simplifications. [devel-0-0-13] ++ ++ * inode.c: implemented mini_fo_getattr, that was required for ++ 2.6 because inode_revalidate has been remove there, and the ++ old "du" bug returned. ++ ++ ++2005-04-20 ++ ++ * aux.c: get_neg_sto_dentry(): allow to be called for dentries ++ in state UNMODIFIED, NON_EXISTANT _and_ DELETED. ++ ++2005-04-19 ++ ++ * Fixed a bug under 2.6 that caused files deleted via mini_fo ++ not to be deleted properly and therefore the fs filled up ++ untill no memory was left. [devel-0-0-12] ++ ++ * Added basic hard link support. This means that creating ++ hardlinks will work, but existing ones will be treated as ++ individual files. [devel-0-0-11] ++ ++2005-04-17 ++ ++ * Bugfixes ++ ++2005-04-13 root ++ ++ * Added file state.c for the state transition ++ functions. Doesn't work very well yet, though... ++ ++2005-04-12 ++ ++ * Porting to 2.6 started, which is easier than expected, also ++ due to Olivier previous work. ++ ++2005-04-08 ++ ++ * Fixed the bug that caused du to return invalid sizes of ++ directory trees. The problem was that ++ mini_fo_inode_revalidate didn't always copy the attributes ++ from the base inode properly. ++ ++2005-04-01 Markus Klotzbuecher ++ ++ * Merged devel branch back to main trunk and updated the ++ RELEASE notes. This will be 0-6-0-pre1. ++ ++2005-03-31 Markus Klotzbuecher ++ ++ * Fixed some bugs in rename_reg_file, that only showed up in ++ the kernel compile test. Kernel compiles cleanly ontop of ++ mini_fo, now also make mrproper etc. work. Seems pretty stable. ++ ++2005-03-28 Markus Klotzbuecher ++ ++ * Many, many directory renaming bugfixes and a lot of other ++ cleanup. Dir renaming seems to work relatively stable. ++ ++2005-03-22 Markus Klotzbuecher ++ ++ * Finished implementing lightweight directory renaming. Some ++ basic testing indicates it works fine. ++ Next is to implement testcases for the testsuite and confirm ++ everything is really working ok. ++ ++2005-03-18 Markus Klotzbuecher ++ ++ * Finished implementing meta.c stuff required for directory ++ renaming. ++ ++2005-03-17 Markus Klotzbuecher ++ ++ * Fixed all compile warnings + an extremly old bug that ++ somehow crept in while reworking the wol stuff to the META ++ system. Turning on -Werror again... :-) ++ ++ * Fixed some bugs in the new rename_reg_file function. ++ ++ * Rewrote mini_fo rename and split it into several ++ subfunctions, that handle the different types ++ seperately. Rewrote the regular file function aswell, as it ++ was implemented somewhat inefficient. ++ ++2005-03-16 Markus Klotzbuecher ++ ++ * Implemented new META subsystem, removed old WOL stuff in favor ++ if it. ++ ++ * After some basic testing everything seems ok... ++ ++2005-03-11 Markus Klotzbuecher ++ ++ * Renaming a non regular file caused trouble because I always ++ tried to copy the contents. Now I only do this for regular ++ files. mini_fo_rename still isn't implemented properly, renaming ++ of device files, symlinks etc. results in a empty regular file ++ instead of the proper type. ++ ++ * Directory renaming suddenly works! What a surprise! I guess ++ this is because renaming is implemented as making a copy and ++ removing the original. Still this might not work ++ everywhere... ++ ++2005-03-09 Markus Klotzbuecher ++ ++ * Bugfix, when a mini_fo directory that exists in storage ++ (state: MODIFIED, CREATED and DEL_REWRITTEN) is deleted, a ++ possibly existing WOL file contained in it needs to be ++ deleted too. ++ ++ * Starting cleanup: defined state names in order to get rid of ++ the state numbers. ++ ++2005-03-08 Markus Klotzbuecher ++ ++ * Makefile fix, fist_ioctl was built against wrong sources if ARCH=um ++ ++ * Fixed a bug in dentry.c, mini_fo_d_hash. In state 4 = ++ DEL_REWRITTEN the hash was calculated from the base dentry, ++ which was wrong and and caused assertions in ++ __mini_fo_hidden_dentry to fail. ++ ++2005-02-21 ++ ++ * Implemented directory deleting (inode.c) ++ ++ * main.c: made mini_fo_parse_options a little more robust. ++ ++2004-12-22 ++ ++ * Makefile cleanup and uml stuff, removed unneccessary files ++ ++ * Created a new and hopefully more informative README ++ ++ * CHANGELOG: created a new CHANGELOG and added old entries reversely ++ ++ ++2004-10-24 Gleb Natapov ++ ++ * Fix: owner and group where not correctly copied from base to ++ storage. ++ ++ ++2004-10-05 Gleb Natapov ++ ++ * Implementation of fsync, fasync and lock mini_fo functions. ++ ++ ++2004-09-29 Bob Lee ++ ++ * Fix of a serious pointer bug ++ ++ ++2004-09-28 Gleb Natapov ++ ++ * Implementation of mini_fo_mknod and mini_fo_rename, support ++ for device files. ++ +--- /dev/null ++++ b/fs/mini_fo/dentry.c +@@ -0,0 +1,244 @@ ++/* ++ * Copyright (c) 1997-2003 Erez Zadok ++ * Copyright (c) 2001-2003 Stony Brook University ++ * ++ * For specific licensing information, see the COPYING file distributed with ++ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING. ++ * ++ * This Copyright notice must be kept intact and distributed with all ++ * fistgen sources INCLUDING sources generated by fistgen. ++ */ ++/* ++ * Copyright (C) 2004, 2005 Markus Klotzbuecher ++ * ++ * 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 of the License, or (at your option) any later version. ++ */ ++ ++/* ++ * $Id$ ++ */ ++ ++#ifdef HAVE_CONFIG_H ++# include ++#endif ++ ++#include "fist.h" ++#include "mini_fo.h" ++ ++/* ++ * THIS IS A BOOLEAN FUNCTION: returns 1 if valid, 0 otherwise. ++ */ ++STATIC int ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++mini_fo_d_revalidate(dentry_t *dentry, struct nameidata *nd) ++#else ++mini_fo_d_revalidate(dentry_t *dentry, int flags) ++#endif ++{ ++ int err1 = 1; /* valid = 1, invalid = 0 */ ++ int err2 = 1; ++ dentry_t *hidden_dentry; ++ dentry_t *hidden_sto_dentry; ++ ++ ++ check_mini_fo_dentry(dentry); ++ ++ hidden_dentry = dtohd(dentry); ++ hidden_sto_dentry = dtohd2(dentry); ++ ++ if(hidden_dentry && ++ hidden_dentry->d_op && ++ hidden_dentry->d_op->d_revalidate) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++ err1 = hidden_dentry->d_op->d_revalidate(hidden_dentry, nd); ++#else ++ err1 = hidden_dentry->d_op->d_revalidate(hidden_dentry, flags); ++#endif ++ } ++ if(hidden_sto_dentry && ++ hidden_sto_dentry->d_op && ++ hidden_sto_dentry->d_op->d_revalidate) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++ err2 = hidden_sto_dentry->d_op->d_revalidate(hidden_sto_dentry, ++ nd); ++#else ++ err2 = hidden_sto_dentry->d_op->d_revalidate(hidden_sto_dentry, ++ flags); ++#endif ++ } ++ ++ /* mk: if one of the lower level dentries are valid, ++ * the mini_fo dentry is too. ++ */ ++ return (err1 || err2); ++} ++ ++ ++STATIC int ++mini_fo_d_hash(dentry_t *dentry, qstr_t *name) ++{ ++ int err = 0; ++ dentry_t *hidden_dentry; ++ dentry_t *hidden_sto_dentry; ++ ++ /* hidden_dentry = mini_fo_hidden_dentry(dentry); ++ * hidden_sto_dentry = mini_fo_hidden_sto_dentry(dentry); */ ++ ++ /* state 1, 3, 4, 5: build the hash for the storage dentry */ ++ if((dtopd(dentry)->state == MODIFIED) || ++ (dtopd(dentry)->state == CREATED) || ++ (dtopd(dentry)->state == DEL_REWRITTEN) || ++ (dtopd(dentry)->state == DELETED)) { ++ hidden_sto_dentry = dtohd2(dentry); ++ if(hidden_sto_dentry && ++ hidden_sto_dentry->d_op && ++ hidden_sto_dentry->d_op->d_hash) { ++ err = hidden_sto_dentry->d_op->d_hash(hidden_sto_dentry, name); ++ } ++ goto out; ++ } ++ /* state 2: build the hash for the base dentry */ ++ if(dtopd(dentry)->state == UNMODIFIED) { ++ hidden_dentry = dtohd(dentry); ++ if(hidden_dentry && ++ hidden_dentry->d_op && ++ hidden_dentry->d_op->d_hash) { ++ err = hidden_dentry->d_op->d_hash(hidden_dentry, name); ++ } ++ goto out; ++ } ++ /* state 6: build hash for the dentry that exists */ ++ if(dtopd(dentry)->state == NON_EXISTANT) { ++ hidden_sto_dentry = dtohd2(dentry); ++ if(hidden_sto_dentry && ++ hidden_sto_dentry->d_op && ++ hidden_sto_dentry->d_op->d_hash) { ++ err = hidden_sto_dentry->d_op->d_hash(hidden_sto_dentry, name); ++ goto out; ++ } ++ hidden_dentry = dtohd(dentry); ++ if(hidden_dentry && ++ hidden_dentry->d_op && ++ hidden_dentry->d_op->d_hash) { ++ err = hidden_dentry->d_op->d_hash(hidden_dentry, name); ++ goto out; ++ } ++ } ++ ++ printk(KERN_CRIT "mini_fo: d_hash: invalid state detected.\n"); ++ ++ out: ++ return err; ++} ++ ++ ++STATIC int ++mini_fo_d_compare(dentry_t *dentry, qstr_t *a, qstr_t *b) ++{ ++ int err; ++ dentry_t *hidden_dentry=NULL; ++ ++ /* hidden_dentry = mini_fo_hidden_dentry(dentry); */ ++ if(dtohd2(dentry)) ++ hidden_dentry = dtohd2(dentry); ++ else if(dtohd(dentry)) ++ hidden_dentry = dtohd(dentry); ++ ++ if (hidden_dentry && hidden_dentry->d_op && hidden_dentry->d_op->d_compare) { ++ err = hidden_dentry->d_op->d_compare(hidden_dentry, a, b); ++ } else { ++ err = ((a->len != b->len) || memcmp(a->name, b->name, b->len)); ++ } ++ ++ return err; ++} ++ ++ ++int ++mini_fo_d_delete(dentry_t *dentry) ++{ ++ dentry_t *hidden_dentry; ++ dentry_t *hidden_sto_dentry; ++ int err = 0; ++ ++ /* this could be a negative dentry, so check first */ ++ if (!dtopd(dentry)) { ++ printk(KERN_CRIT "mini_fo_d_delete: negative dentry passed.\n"); ++ goto out; ++ } ++ hidden_dentry = dtohd(dentry); ++ hidden_sto_dentry = dtohd2(dentry); ++ ++ if(hidden_dentry) { ++ if(hidden_dentry->d_op && ++ hidden_dentry->d_op->d_delete) { ++ err = hidden_dentry->d_op->d_delete(hidden_dentry); ++ } ++ } ++ if(hidden_sto_dentry) { ++ if(hidden_sto_dentry->d_op && ++ hidden_sto_dentry->d_op->d_delete) { ++ err = hidden_sto_dentry->d_op->d_delete(hidden_sto_dentry); ++ } ++ } ++ ++ out: ++ return err; ++} ++ ++ ++void ++mini_fo_d_release(dentry_t *dentry) ++{ ++ dentry_t *hidden_dentry; ++ dentry_t *hidden_sto_dentry; ++ ++ ++ /* this could be a negative dentry, so check first */ ++ if (!dtopd(dentry)) { ++ printk(KERN_CRIT "mini_fo_d_release: no private data.\n"); ++ goto out; ++ } ++ hidden_dentry = dtohd(dentry); ++ hidden_sto_dentry = dtohd2(dentry); ++ ++ if(hidden_dentry) { ++ /* decrement hidden dentry's counter and free its inode */ ++ dput(hidden_dentry); ++ } ++ if(hidden_sto_dentry) { ++ /* decrement hidden dentry's counter and free its inode */ ++ dput(hidden_sto_dentry); ++ } ++ ++ /* free private data (mini_fo_dentry_info) here */ ++ kfree(dtopd(dentry)); ++ __dtopd(dentry) = NULL; /* just to be safe */ ++ out: ++ return; ++} ++ ++ ++/* ++ * we don't really need mini_fo_d_iput, because dentry_iput will call iput() if ++ * mini_fo_d_iput is not defined. We left this implemented for ease of ++ * tracing/debugging. ++ */ ++void ++mini_fo_d_iput(dentry_t *dentry, inode_t *inode) ++{ ++ iput(inode); ++} ++ ++ ++struct dentry_operations mini_fo_dops = { ++ d_revalidate: mini_fo_d_revalidate, ++ d_hash: mini_fo_d_hash, ++ d_compare: mini_fo_d_compare, ++ d_release: mini_fo_d_release, ++ d_delete: mini_fo_d_delete, ++ d_iput: mini_fo_d_iput, ++}; +--- /dev/null ++++ b/fs/mini_fo/file.c +@@ -0,0 +1,713 @@ ++/* ++ * Copyright (c) 1997-2003 Erez Zadok ++ * Copyright (c) 2001-2003 Stony Brook University ++ * ++ * For specific licensing information, see the COPYING file distributed with ++ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING. ++ * ++ * This Copyright notice must be kept intact and distributed with all ++ * fistgen sources INCLUDING sources generated by fistgen. ++ */ ++/* ++ * Copyright (C) 2004, 2005 Markus Klotzbuecher ++ * ++ * 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 of the License, or (at your option) any later version. ++ */ ++ ++/* ++ * $Id$ ++ */ ++ ++#ifdef HAVE_CONFIG_H ++# include ++#endif ++ ++#include "fist.h" ++#include "mini_fo.h" ++#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1)) ++ ++/******************* ++ * File Operations * ++ *******************/ ++ ++STATIC loff_t ++mini_fo_llseek(file_t *file, loff_t offset, int origin) ++{ ++ loff_t err; ++ file_t *hidden_file = NULL; ++ ++ if(S_ISDIR(file->f_dentry->d_inode->i_mode)) { ++ /* Check if trying to llseek from a directory */ ++ err = -EISDIR; ++ goto out; ++ } ++ if (ftopd(file) != NULL) { ++ if(ftohf2(file)) { ++ hidden_file = ftohf2(file); ++ } else { ++ hidden_file = ftohf(file); ++ } ++ } ++ ++ /* always set hidden position to this one */ ++ hidden_file->f_pos = file->f_pos; ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++ memcpy(&(hidden_file->f_ra), ++ &(file->f_ra), ++ sizeof(struct file_ra_state)); ++#else ++ if (file->f_reada) { /* update readahead information if needed */ ++ hidden_file->f_reada = file->f_reada; ++ hidden_file->f_ramax = file->f_ramax; ++ hidden_file->f_raend = file->f_raend; ++ hidden_file->f_ralen = file->f_ralen; ++ hidden_file->f_rawin = file->f_rawin; ++ } ++#endif ++ if (hidden_file->f_op && hidden_file->f_op->llseek) ++ err = hidden_file->f_op->llseek(hidden_file, offset, origin); ++ else ++ err = generic_file_llseek(hidden_file, offset, origin); ++ ++ if (err < 0) ++ goto out; ++ ++ if (err != file->f_pos) { ++ file->f_pos = err; ++ // ION maybe this? ++ // file->f_pos = hidden_file->f_pos; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ++ file->f_reada = 0; ++#endif ++ file->f_version++; ++ } ++ ++ out: ++ return err; ++} ++ ++ ++/* mk: fanout capable */ ++STATIC ssize_t ++mini_fo_read(file_t *file, char *buf, size_t count, loff_t *ppos) ++{ ++ int err = -EINVAL; ++ file_t *hidden_file = NULL; ++ loff_t pos = *ppos; ++ ++ if(S_ISDIR(file->f_dentry->d_inode->i_mode)) { ++ /* Check if trying to read from a directory */ ++ /* printk(KERN_CRIT "mini_fo_read: ERROR: trying to read data from a directory.\n"); */ ++ err = -EISDIR; ++ goto out; ++ } ++ ++ if (ftopd(file) != NULL) { ++ if(ftohf2(file)) { ++ hidden_file = ftohf2(file); ++ } else { ++ hidden_file = ftohf(file); ++ } ++ } ++ ++ if (!hidden_file->f_op || !hidden_file->f_op->read) ++ goto out; ++ ++ err = hidden_file->f_op->read(hidden_file, buf, count, &pos); ++ *ppos = pos; ++ ++ if (err >= 0) { ++ /* atime should also be updated for reads of size zero or more */ ++ fist_copy_attr_atime(file->f_dentry->d_inode, ++ hidden_file->f_dentry->d_inode); ++ } ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ++ /* ++ * MAJOR HACK ++ * because pread() does not have any way to tell us that it is ++ * our caller, then we don't know for sure if we have to update ++ * the file positions. This hack relies on read() having passed us ++ * the "real" pointer of its struct file's f_pos field. ++ */ ++ if (ppos == &file->f_pos) ++ hidden_file->f_pos = *ppos = pos; ++ if (hidden_file->f_reada) { /* update readahead information if needed */ ++ file->f_reada = hidden_file->f_reada; ++ file->f_ramax = hidden_file->f_ramax; ++ file->f_raend = hidden_file->f_raend; ++ file->f_ralen = hidden_file->f_ralen; ++ file->f_rawin = hidden_file->f_rawin; ++ } ++#else ++ memcpy(&(file->f_ra),&(hidden_file->f_ra),sizeof(struct file_ra_state)); ++#endif ++ ++ out: ++ return err; ++} ++ ++ ++/* this mini_fo_write() does not modify data pages! */ ++STATIC ssize_t ++mini_fo_write(file_t *file, const char *buf, size_t count, loff_t *ppos) ++{ ++ int err = -EINVAL; ++ file_t *hidden_file = NULL; ++ inode_t *inode; ++ inode_t *hidden_inode; ++ loff_t pos = *ppos; ++ ++ /* mk: fan out: */ ++ if (ftopd(file) != NULL) { ++ if(ftohf2(file)) { ++ hidden_file = ftohf2(file); ++ } else { ++ /* This is bad! We have no storage file to write to. This ++ * should never happen because if a file is opened for ++ * writing, a copy should have been made earlier. ++ */ ++ printk(KERN_CRIT "mini_fo: write : ERROR, no storage file to write.\n"); ++ err = -EINVAL; ++ goto out; ++ } ++ } ++ ++ inode = file->f_dentry->d_inode; ++ hidden_inode = itohi2(inode); ++ if(!hidden_inode) { ++ printk(KERN_CRIT "mini_fo: write: no sto inode found, not good.\n"); ++ goto out; ++ } ++ ++ if (!hidden_file->f_op || !hidden_file->f_op->write) ++ goto out; ++ ++ /* adjust for append -- seek to the end of the file */ ++ if (file->f_flags & O_APPEND) ++ pos = inode->i_size; ++ ++ err = hidden_file->f_op->write(hidden_file, buf, count, &pos); ++ ++ /* ++ * copy ctime and mtime from lower layer attributes ++ * atime is unchanged for both layers ++ */ ++ if (err >= 0) ++ fist_copy_attr_times(inode, hidden_inode); ++ ++ *ppos = pos; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ++ /* ++ * XXX: MAJOR HACK ++ * ++ * because pwrite() does not have any way to tell us that it is ++ * our caller, then we don't know for sure if we have to update ++ * the file positions. This hack relies on write() having passed us ++ * the "real" pointer of its struct file's f_pos field. ++ */ ++ if (ppos == &file->f_pos) ++ hidden_file->f_pos = *ppos = pos; ++#endif ++ /* update this inode's size */ ++ if (pos > inode->i_size) ++ inode->i_size = pos; ++ ++ out: ++ return err; ++} ++ ++/* Global variable to hold a file_t pointer. ++ * This serves to allow mini_fo_filldir function to know which file is ++ * beeing read, which is required for two reasons: ++ * ++ * - be able to call wol functions in order to avoid listing deleted ++ * base files. ++ * - if we're reading a directory which is in state 1, we need to ++ * maintain a list (in mini_fo_filldir) of which files allready ++ * have been copied to userspace,to detect files existing in base ++ * and storage and not list them twice. ++ */ ++filldir_t mini_fo_filldir_orig; ++file_t *mini_fo_filldir_file; ++ ++/* mainly copied from fs/readdir.c */ ++STATIC int ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) ++mini_fo_filldir(void * __buf, const char * name, int namlen, loff_t offset, ++ u64 ino, unsigned int d_type) ++#else ++mini_fo_filldir(void * __buf, const char * name, int namlen, loff_t offset, ++ ino_t ino, unsigned int d_type) ++#endif ++{ ++ struct getdents_callback * buf = (struct getdents_callback *) __buf; ++ file_t* file = mini_fo_filldir_file; ++ ++ /* In theses states we filter meta files in storage (WOL) */ ++ if(file && (dtopd(file->f_dentry)->state == MODIFIED || ++ dtopd(file->f_dentry)->state == CREATED || ++ dtopd(file->f_dentry)->state == DEL_REWRITTEN)) { ++ ++ int tmp = strlen(META_FILENAME); ++ if(tmp == namlen) { ++ if(!strncmp(name, META_FILENAME, namlen)) ++ return 0; ++ } ++ } ++ ++ /* check if we are merging the contents of storage and base */ ++ if(file && dtopd(file->f_dentry)->state == MODIFIED) { ++ /* check if we are still reading storage contents, if ++ * yes, we just save the name of the file for duplicate ++ * checking later. */ ++ ++ if(!ftopd(file)->rd.sto_done) { ++ /* put file into ndl list */ ++ if(ndl_add_entry(&ftopd(file)->rd, name, namlen)) ++ printk(KERN_CRIT "mini_fo_filldir: Error adding to ndl.\n"); ++ } else { ++ /* check if file has been deleted */ ++ if(meta_check_d_entry(file->f_dentry, name, namlen)) ++ return 0; ++ ++ /* do duplicate checking */ ++ if(ndl_check_entry(&ftopd(file)->rd, name, namlen)) ++ return 0; ++ } ++ } ++ ++ return mini_fo_filldir_orig(buf, name, namlen, offset, ino, d_type); ++} ++ ++ ++STATIC int ++mini_fo_readdir(file_t *file, void *dirent, filldir_t filldir) ++{ ++ int err = 0;/* mk: ??? -ENOTDIR; */ ++ file_t *hidden_file = NULL; ++ file_t *hidden_sto_file = NULL; ++ inode_t *inode; ++ struct getdents_callback *buf; ++ int oldcount; ++ ++#if defined(FIST_FILTER_NAME) || defined(FIST_FILTER_SCA) ++ struct mini_fo_getdents_callback buf; ++#endif /* FIST_FILTER_NAME || FIST_FILTER_SCA */ ++ ++ buf = (struct getdents_callback *) dirent; ++ oldcount = buf->count; ++ inode = file->f_dentry->d_inode; ++ mini_fo_filldir_file = file; ++ mini_fo_filldir_orig = filldir; ++ ++ ftopd(file)->rd.sto_done = 0; ++ do { ++ if (ftopd(file) != NULL) { ++ if(ftohf2(file)) { ++ hidden_sto_file = ftohf2(file); ++ err = vfs_readdir(hidden_sto_file, mini_fo_filldir, dirent); ++ file->f_pos = hidden_sto_file->f_pos; ++ if (err > 0) ++ fist_copy_attr_atime(inode, hidden_sto_file->f_dentry->d_inode); ++ /* not finshed yet, we'll be called again */ ++ if (buf->count != oldcount) ++ break; ++ } ++ ++ ftopd(file)->rd.sto_done = 1; ++ ++ if(ftohf(file)) { ++ hidden_file = ftohf(file); ++ err = vfs_readdir(hidden_file, mini_fo_filldir, dirent); ++ file->f_pos = hidden_file->f_pos; ++ if (err > 0) ++ fist_copy_attr_atime(inode, hidden_file->f_dentry->d_inode); ++ } ++ ++ } ++ } while (0); ++ ++ /* mk: ++ * we need to check if all the directory data has been copied to userspace, ++ * or if we will be called again by userspace to complete the operation. ++ */ ++ if(buf->count == oldcount) { ++ ndl_put_list(&ftopd(file)->rd); ++ } ++ ++ /* unset this, safe */ ++ mini_fo_filldir_file = NULL; ++ return err; ++} ++ ++ ++STATIC unsigned int ++mini_fo_poll(file_t *file, poll_table *wait) ++{ ++ unsigned int mask = DEFAULT_POLLMASK; ++ file_t *hidden_file = NULL; ++ ++ if (ftopd(file) != NULL) { ++ if(ftohf2(file)) { ++ hidden_file = ftohf2(file); ++ } else { ++ hidden_file = ftohf(file); ++ } ++ } ++ ++ if (!hidden_file->f_op || !hidden_file->f_op->poll) ++ goto out; ++ ++ mask = hidden_file->f_op->poll(hidden_file, wait); ++ ++ out: ++ return mask; ++} ++ ++/* FIST-LITE special version of mmap */ ++STATIC int ++mini_fo_mmap(file_t *file, vm_area_t *vma) ++{ ++ int err = 0; ++ file_t *hidden_file = NULL; ++ ++ /* fanout capability */ ++ if (ftopd(file) != NULL) { ++ if(ftohf2(file)) { ++ hidden_file = ftohf2(file); ++ } else { ++ hidden_file = ftohf(file); ++ } ++ } ++ ++ ASSERT(hidden_file != NULL); ++ ASSERT(hidden_file->f_op != NULL); ++ ASSERT(hidden_file->f_op->mmap != NULL); ++ ++ vma->vm_file = hidden_file; ++ err = hidden_file->f_op->mmap(hidden_file, vma); ++ get_file(hidden_file); /* make sure it doesn't get freed on us */ ++ fput(file); /* no need to keep extra ref on ours */ ++ ++ return err; ++} ++ ++ ++ ++STATIC int ++mini_fo_open(inode_t *inode, file_t *file) ++{ ++ int err = 0; ++ int hidden_flags; ++ file_t *hidden_file = NULL; ++ dentry_t *hidden_dentry = NULL; ++ ++ /* fanout stuff */ ++ file_t *hidden_sto_file = NULL; ++ dentry_t *hidden_sto_dentry = NULL; ++ ++ __ftopd(file) = ++ kmalloc(sizeof(struct mini_fo_file_info), GFP_KERNEL); ++ if (!ftopd(file)) { ++ err = -ENOMEM; ++ goto out; ++ } ++ ++ /* init the readdir_helper structure */ ++ INIT_LIST_HEAD(&ftopd(file)->rd.ndl_list); ++ ftopd(file)->rd.ndl_size = 0; ++ ++ /* In certain paths this could stay uninitalized and cause trouble */ ++ ftohf(file) = NULL; ++ ftohf2(file) = NULL; ++ hidden_flags = file->f_flags; ++ ++ /* create storage files? */ ++ if(dtost(file->f_dentry) == UNMODIFIED) { ++ if(!IS_WRITE_FLAG(file->f_flags)) { ++ hidden_dentry = dtohd(file->f_dentry); ++ dget(hidden_dentry); ++ /* dentry_open will decrement mnt refcnt if err. ++ * otherwise fput() will do an mntput() for us upon file close. */ ++ mntget(stopd(inode->i_sb)->hidden_mnt); ++ hidden_file = dentry_open(hidden_dentry, ++ stopd(inode->i_sb)->hidden_mnt, ++ hidden_flags); ++ if (IS_ERR(hidden_file)) { ++ err = PTR_ERR(hidden_file); ++ dput(hidden_dentry); ++ goto out; ++ } ++ ftohf(file) = hidden_file; /* link two files */ ++ goto out; ++ } ++ else { ++ if(S_ISDIR(file->f_dentry->d_inode->i_mode)) { ++ err = dir_unmod_to_mod(file->f_dentry); ++ } else ++ err = nondir_unmod_to_mod(file->f_dentry, 1); ++ ++ if (err) { ++ printk("mini_fo_open: ERROR creating storage file.\n"); ++ goto out; ++ } ++ } ++ } ++ hidden_sto_dentry = dtohd2(file->f_dentry); ++ dget(hidden_sto_dentry); ++ ++ if(dtopd(file->f_dentry)->state == MODIFIED) { ++ /* Directorys are special, interpose on both lower level files */ ++ if(S_ISDIR(itohi(inode)->i_mode)) { ++ /* check for invalid file types of lower level files */ ++ if(!(S_ISDIR(itohi(inode)->i_mode) && S_ISDIR(itohi2(inode)->i_mode))) { ++ printk(KERN_CRIT "mini_fo_open: meta data corruption detected.\n"); ++ dput(hidden_sto_dentry); ++ err = -EINVAL; ++ goto out; ++ } ++ ++ /* lower level directorys are ok, open the base file */ ++ hidden_dentry = dtohd(file->f_dentry); ++ dget(hidden_dentry); ++ ++ mntget(stopd(inode->i_sb)->hidden_mnt); ++ hidden_file = dentry_open(hidden_dentry, ++ stopd(inode->i_sb)->hidden_mnt, ++ hidden_flags); ++ if (IS_ERR(hidden_file)) { ++ err = PTR_ERR(hidden_file); ++ dput(hidden_dentry); ++ dput(hidden_sto_dentry); ++ goto out; ++ } ++ ftohf(file) = hidden_file; /* link the two files */ ++ } ++ } ++ ++ if(!exists_in_storage(file->f_dentry)) { ++ printk(KERN_CRIT "mini_fo_open: invalid file state detected.\n"); ++ err = -EINVAL; ++ dput(hidden_sto_dentry); ++ ++ /* If the base file has been opened, we need to close it here */ ++ if(ftohf(file)) { ++ if (hidden_file->f_op && hidden_file->f_op->flush) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) ++ hidden_file->f_op->flush(hidden_file, NULL); ++#else ++ hidden_file->f_op->flush(hidden_file); ++#endif ++ dput(hidden_dentry); ++ } ++ goto out; ++ } ++ ++ /* ok, now we can safely open the storage file */ ++ mntget(stopd(inode->i_sb)->hidden_mnt2); ++ hidden_sto_file = dentry_open(hidden_sto_dentry, ++ stopd(inode->i_sb)->hidden_mnt2, ++ hidden_flags); ++ ++ /* dentry_open dputs the dentry if it fails */ ++ if (IS_ERR(hidden_sto_file)) { ++ err = PTR_ERR(hidden_sto_file); ++ /* close base file if open */ ++ if(ftohf(file)) { ++ if (hidden_file->f_op && hidden_file->f_op->flush) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) ++ hidden_file->f_op->flush(hidden_file, NULL); ++#else ++ hidden_file->f_op->flush(hidden_file); ++#endif ++ dput(hidden_dentry); ++ } ++ goto out; ++ } ++ ftohf2(file) = hidden_sto_file; /* link storage file */ ++ ++ out: ++ if (err < 0 && ftopd(file)) { ++ kfree(ftopd(file)); ++ } ++ return err; ++} ++ ++STATIC int ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) ++mini_fo_flush(file_t *file, fl_owner_t id) ++#else ++mini_fo_flush(file_t *file) ++#endif ++{ ++ int err1 = 0; /* assume ok (see open.c:close_fp) */ ++ int err2 = 0; ++ file_t *hidden_file = NULL; ++ ++ check_mini_fo_file(file); ++ ++ /* mk: we don't do any state checking here, as its not worth the time. ++ * Just flush the lower level files if they exist. ++ */ ++ if(ftopd(file) != NULL) { ++ if(ftohf(file) != NULL) { ++ hidden_file = ftohf(file); ++ if (hidden_file->f_op && hidden_file->f_op->flush) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) ++ err1 = hidden_file->f_op->flush(hidden_file, id); ++#else ++ err1 = hidden_file->f_op->flush(hidden_file); ++#endif ++ } ++ if(ftohf2(file) != NULL) { ++ hidden_file = ftohf2(file); ++ if (hidden_file->f_op && hidden_file->f_op->flush) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) ++ err2 = hidden_file->f_op->flush(hidden_file, id); ++#else ++ err2 = hidden_file->f_op->flush(hidden_file); ++#endif ++ } ++ } ++ return (err1 | err2); ++} ++ ++ ++STATIC int ++mini_fo_release(inode_t *inode, file_t *file) ++{ ++ int err = 0; ++ file_t *hidden_file = NULL; ++ ++ if (ftopd(file) != NULL) { ++ if(ftohf(file)) { ++ hidden_file = ftohf(file); ++ fput(hidden_file); ++ } ++ if(ftohf2(file)) { ++ hidden_file = ftohf2(file); ++ fput(hidden_file); ++ } ++ kfree(ftopd(file)); ++ } ++ return err; ++} ++ ++STATIC int ++mini_fo_fsync(file_t *file, dentry_t *dentry, int datasync) ++{ ++ int err1 = 0; ++ int err2 = 0; ++ file_t *hidden_file = NULL; ++ dentry_t *hidden_dentry; ++ ++ check_mini_fo_file(file); ++ ++ if ((hidden_file = ftohf(file)) != NULL) { ++ hidden_dentry = dtohd(dentry); ++ if (hidden_file->f_op && hidden_file->f_op->fsync) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_dentry->d_inode->i_mutex); ++#else ++ down(&hidden_dentry->d_inode->i_sem); ++#endif ++ err1 = hidden_file->f_op->fsync(hidden_file, hidden_dentry, datasync); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_dentry->d_inode->i_mutex); ++#else ++ up(&hidden_dentry->d_inode->i_sem); ++#endif ++ } ++ } ++ ++ if ((hidden_file = ftohf2(file)) != NULL) { ++ hidden_dentry = dtohd2(dentry); ++ if (hidden_file->f_op && hidden_file->f_op->fsync) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_dentry->d_inode->i_mutex); ++#else ++ down(&hidden_dentry->d_inode->i_sem); ++#endif ++ err2 = hidden_file->f_op->fsync(hidden_file, hidden_dentry, datasync); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_dentry->d_inode->i_mutex); ++#else ++ up(&hidden_dentry->d_inode->i_sem); ++#endif ++ } ++ } ++ else ++ goto err; ++ ++err: ++ return (err1 || err2); ++} ++ ++ ++STATIC int ++mini_fo_fasync(int fd, file_t *file, int flag) ++{ ++ int err1 = 0; ++ int err2 = 0; ++ ++ file_t *hidden_file = NULL; ++ ++ check_mini_fo_file(file); ++ ++ if((hidden_file = ftohf(file)) != NULL) { ++ err1 = hidden_file->f_op->fasync(fd, hidden_file, flag); ++ } ++ if((hidden_file = ftohf2(file)) != NULL) { ++ err2 = hidden_file->f_op->fasync(fd, hidden_file, flag); ++ } ++ ++ return (err1 || err2); ++} ++ ++ ++ ++struct file_operations mini_fo_dir_fops = ++ { ++ read: generic_read_dir, ++ write: mini_fo_write, ++ readdir: mini_fo_readdir, ++ poll: mini_fo_poll, ++ /* ioctl: mini_fo_ioctl, */ ++ mmap: mini_fo_mmap, ++ open: mini_fo_open, ++ flush: mini_fo_flush, ++ release: mini_fo_release, ++ fsync: mini_fo_fsync, ++ fasync: mini_fo_fasync, ++ /* not needed lock: mini_fo_lock, */ ++ /* not needed: readv */ ++ /* not needed: writev */ ++ /* not implemented: sendpage */ ++ /* not implemented: get_unmapped_area */ ++ }; ++ ++struct file_operations mini_fo_main_fops = ++ { ++ llseek: mini_fo_llseek, ++ read: mini_fo_read, ++ write: mini_fo_write, ++ readdir: mini_fo_readdir, ++ poll: mini_fo_poll, ++ /* ioctl: mini_fo_ioctl, */ ++ mmap: mini_fo_mmap, ++ open: mini_fo_open, ++ flush: mini_fo_flush, ++ release: mini_fo_release, ++ fsync: mini_fo_fsync, ++ fasync: mini_fo_fasync, ++ /* not needed: lock: mini_fo_lock, */ ++ /* not needed: readv */ ++ /* not needed: writev */ ++ /* not implemented: sendpage */ ++ /* not implemented: get_unmapped_area */ ++ }; +--- /dev/null ++++ b/fs/mini_fo/fist.h +@@ -0,0 +1,252 @@ ++/* ++ * Copyright (c) 1997-2003 Erez Zadok ++ * Copyright (c) 2001-2003 Stony Brook University ++ * ++ * For specific licensing information, see the COPYING file distributed with ++ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING. ++ * ++ * This Copyright notice must be kept intact and distributed with all ++ * fistgen sources INCLUDING sources generated by fistgen. ++ */ ++/* ++ * Copyright (C) 2004, 2005 Markus Klotzbuecher ++ * ++ * 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 of the License, or (at your option) any later version. ++ */ ++ ++ ++/* ++ * $Id$ ++ */ ++ ++#ifndef __FIST_H_ ++#define __FIST_H_ ++ ++/* ++ * KERNEL ONLY CODE: ++ */ ++#ifdef __KERNEL__ ++#include ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) ++#include ++#else ++#include ++#endif ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ++#ifdef CONFIG_MODVERSIONS ++# define MODVERSIONS ++# include ++#endif /* CONFIG_MODVERSIONS */ ++#endif /* KERNEL_VERSION < 2.6.0 */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ++#include ++#else ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#endif ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20) ++#include ++#endif ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++#include ++#endif ++ ++#include ++ ++#include ++/* #include */ ++#include ++#include ++ ++/* ++ * MACROS: ++ */ ++ ++/* those mapped to ATTR_* were copied from linux/fs.h */ ++#define FA_MODE ATTR_MODE ++#define FA_UID ATTR_UID ++#define FA_GID ATTR_GID ++#define FA_SIZE ATTR_SIZE ++#define FA_ATIME ATTR_ATIME ++#define FA_MTIME ATTR_MTIME ++#define FA_CTIME ATTR_CTIME ++#define FA_ATIME_SET ATTR_ATIME_SET ++#define FA_MTIME_SET ATTR_MTIME_SET ++#define FA_FORCE ATTR_FORCE ++#define FA_ATTR_FLAGS ATTR_ATTR_FLAG ++ ++/* must be greater than all other ATTR_* flags! */ ++#define FA_NLINK 2048 ++#define FA_BLKSIZE 4096 ++#define FA_BLOCKS 8192 ++#define FA_TIMES (FA_ATIME|FA_MTIME|FA_CTIME) ++#define FA_ALL 0 ++ ++/* macros to manage changes between kernels */ ++#define INODE_DATA(i) (&(i)->i_data) ++ ++#define MIN(x,y) ((x < y) ? (x) : (y)) ++#define MAX(x,y) ((x > y) ? (x) : (y)) ++#define MAXPATHLEN PATH_MAX ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,5) ++# define lookup_one_len(a,b,c) lookup_one(a,b) ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,4,5) */ ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,8) ++# define generic_file_llseek default_llseek ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,4,8) */ ++ ++#ifndef SEEK_SET ++# define SEEK_SET 0 ++#endif /* not SEEK_SET */ ++ ++#ifndef SEEK_CUR ++# define SEEK_CUR 1 ++#endif /* not SEEK_CUR */ ++ ++#ifndef SEEK_END ++# define SEEK_END 2 ++#endif /* not SEEK_END */ ++ ++#ifndef DEFAULT_POLLMASK ++# define DEFAULT_POLLMASK (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM) ++#endif /* not DEFAULT_POLLMASK */ ++ ++/* XXX: fix this so fistgen generates kfree() code directly */ ++#define kfree_s(a,b) kfree(a) ++ ++/* ++ * TYPEDEFS: ++ */ ++typedef struct dentry dentry_t; ++typedef struct file file_t; ++typedef struct inode inode_t; ++typedef inode_t vnode_t; ++typedef struct page page_t; ++typedef struct qstr qstr_t; ++typedef struct super_block super_block_t; ++typedef super_block_t vfs_t; ++typedef struct vm_area_struct vm_area_t; ++ ++ ++/* ++ * EXTERNALS: ++ */ ++ ++#define FPPF(str,page) printk("PPF %s 0x%x/%d: Lck:%d Err:%d Ref:%d Upd:%d Other::%d:%d:%d:%d:\n", \ ++ str, \ ++ (int) page, \ ++ (int) page->index, \ ++ (PageLocked(page) ? 1 : 0), \ ++ (PageError(page) ? 1 : 0), \ ++ (PageReferenced(page) ? 1 : 0), \ ++ (Page_Uptodate(page) ? 1 : 0), \ ++ (PageDecrAfter(page) ? 1 : 0), \ ++ (PageSlab(page) ? 1 : 0), \ ++ (PageSwapCache(page) ? 1 : 0), \ ++ (PageReserved(page) ? 1 : 0) \ ++ ) ++#define EZKDBG printk("EZK %s:%d:%s\n",__FILE__,__LINE__,__FUNCTION__) ++#if 0 ++# define EZKDBG1 printk("EZK %s:%d\n",__FILE__,__LINE__) ++#else ++# define EZKDBG1 ++#endif ++ ++extern int fist_get_debug_value(void); ++extern int fist_set_debug_value(int val); ++#if 0 /* mini_fo doesn't need these */ ++extern void fist_dprint_internal(int level, char *str,...); ++extern void fist_print_dentry(char *str, const dentry_t *dentry); ++extern void fist_print_inode(char *str, const inode_t *inode); ++extern void fist_print_file(char *str, const file_t *file); ++extern void fist_print_buffer_flags(char *str, struct buffer_head *buffer); ++extern void fist_print_page_flags(char *str, page_t *page); ++extern void fist_print_page_bytes(char *str, page_t *page); ++extern void fist_print_pte_flags(char *str, const page_t *page); ++extern void fist_checkinode(inode_t *inode, char *msg); ++extern void fist_print_sb(char *str, const super_block_t *sb); ++ ++/* §$% by mk: special debug functions */ ++extern void fist_mk_print_dentry(char *str, const dentry_t *dentry); ++extern void fist_mk_print_inode(char *str, const inode_t *inode); ++ ++extern char *add_indent(void); ++extern char *del_indent(void); ++#endif/* mini_fo doesn't need these */ ++ ++ ++#define STATIC ++#define ASSERT(EX) \ ++do { \ ++ if (!(EX)) { \ ++ printk(KERN_CRIT "ASSERTION FAILED: %s at %s:%d (%s)\n", #EX, \ ++ __FILE__, __LINE__, __FUNCTION__); \ ++ (*((char *)0))=0; \ ++ } \ ++} while (0) ++/* same ASSERT, but tell me who was the caller of the function */ ++#define ASSERT2(EX) \ ++do { \ ++ if (!(EX)) { \ ++ printk(KERN_CRIT "ASSERTION FAILED (caller): %s at %s:%d (%s)\n", #EX, \ ++ file, line, func); \ ++ (*((char *)0))=0; \ ++ } \ ++} while (0) ++ ++#if 0 /* mini_fo doesn't need these */ ++#define dprintk(format, args...) printk(KERN_DEBUG format, ##args) ++#define fist_dprint(level, str, args...) fist_dprint_internal(level, KERN_DEBUG str, ## args) ++#define print_entry_location() fist_dprint(4, "%sIN: %s %s:%d\n", add_indent(), __FUNCTION__, __FILE__, __LINE__) ++#define print_exit_location() fist_dprint(4, "%s OUT: %s %s:%d\n", del_indent(), __FUNCTION__, __FILE__, __LINE__) ++#define print_exit_status(status) fist_dprint(4, "%s OUT: %s %s:%d, STATUS: %d\n", del_indent(), __FUNCTION__, __FILE__, __LINE__, status) ++#define print_exit_pointer(status) \ ++do { \ ++ if (IS_ERR(status)) \ ++ fist_dprint(4, "%s OUT: %s %s:%d, RESULT: %ld\n", del_indent(), __FUNCTION__, __FILE__, __LINE__, PTR_ERR(status)); \ ++ else \ ++ fist_dprint(4, "%s OUT: %s %s:%d, RESULT: 0x%x\n", del_indent(), __FUNCTION__, __FILE__, __LINE__, PTR_ERR(status)); \ ++} while (0) ++#endif/* mini_fo doesn't need these */ ++ ++#endif /* __KERNEL__ */ ++ ++ ++/* ++ * DEFINITIONS FOR USER AND KERNEL CODE: ++ * (Note: ioctl numbers 1--9 are reserved for fistgen, the rest ++ * are auto-generated automatically based on the user's .fist file.) ++ */ ++# define FIST_IOCTL_GET_DEBUG_VALUE _IOR(0x15, 1, int) ++# define FIST_IOCTL_SET_DEBUG_VALUE _IOW(0x15, 2, int) ++ ++#endif /* not __FIST_H_ */ +--- /dev/null ++++ b/fs/mini_fo/inode.c +@@ -0,0 +1,1564 @@ ++/* ++ * Copyright (c) 1997-2003 Erez Zadok ++ * Copyright (c) 2001-2003 Stony Brook University ++ * ++ * For specific licensing information, see the COPYING file distributed with ++ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING. ++ * ++ * This Copyright notice must be kept intact and distributed with all ++ * fistgen sources INCLUDING sources generated by fistgen. ++ */ ++/* ++ * Copyright (C) 2004, 2005 Markus Klotzbuecher ++ * ++ * 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 of the License, or (at your option) any later version. ++ */ ++ ++/* ++ * $Id$ ++ */ ++ ++#ifdef HAVE_CONFIG_H ++# include ++#endif ++ ++#include "fist.h" ++#include "mini_fo.h" ++ ++STATIC int ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++mini_fo_create(inode_t *dir, dentry_t *dentry, int mode, struct nameidata *nd) ++#else ++mini_fo_create(inode_t *dir, dentry_t *dentry, int mode) ++#endif ++{ ++ int err = 0; ++ ++ check_mini_fo_dentry(dentry); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++ err = create_sto_reg_file(dentry, mode, nd); ++#else ++ err = create_sto_reg_file(dentry, mode); ++#endif ++ check_mini_fo_dentry(dentry); ++ return err; ++} ++ ++ ++STATIC dentry_t * ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++mini_fo_lookup(inode_t *dir, dentry_t *dentry, struct nameidata* nd) ++#else ++mini_fo_lookup(inode_t *dir, dentry_t *dentry) ++#endif ++{ ++ int err = 0; ++ dentry_t *hidden_dir_dentry; ++ dentry_t *hidden_dentry = NULL; ++ ++ dentry_t *hidden_sto_dir_dentry; ++ dentry_t *hidden_sto_dentry = NULL; ++ ++ /* whiteout flag */ ++ int del_flag = 0; ++ char *bpath = NULL; ++ ++ const char *name; ++ unsigned int namelen; ++ ++ /* Don't allow lookups of META-files */ ++ namelen = strlen(META_FILENAME); ++ if(namelen == dentry->d_name.len) { ++ if(!strncmp(dentry->d_name.name, META_FILENAME, namelen)) { ++ err = -ENOENT; ++ goto out; ++ } ++ } ++ ++ hidden_dir_dentry = dtohd(dentry->d_parent); ++ hidden_sto_dir_dentry = dtohd2(dentry->d_parent); ++ ++ name = dentry->d_name.name; ++ namelen = dentry->d_name.len; ++ ++ /* must initialize dentry operations */ ++ dentry->d_op = &mini_fo_dops; ++ ++ /* setup the del_flag */ ++ del_flag = __meta_check_d_entry(dir, name, namelen); ++ bpath = __meta_check_r_entry(dir, name, namelen); ++ ++ /* perform the lookups of base and storage files: ++ * ++ * This caused some serious trouble, as a lookup_one_len passing ++ * a negative dentry oopses. Solution is to only do the lookup ++ * if the dentry is positive, else we set it to NULL ++ * More trouble, who said a *_dir_dentry can't be NULL? ++ */ ++ if(bpath) { ++ /* Cross-Interposing (C), yeah! */ ++ hidden_dentry = bpath_walk(dir->i_sb, bpath); ++ if(!hidden_dentry || !hidden_dentry->d_inode) { ++ printk(KERN_CRIT "mini_fo_lookup: bpath_walk failed.\n"); ++ err= -EINVAL; ++ goto out; ++ } ++ ++ /* this can be set up safely without fear of spaghetti ++ * interposing as it is only used for copying times */ ++ hidden_dir_dentry = hidden_dentry->d_parent; ++ kfree(bpath); ++ } ++ else if(hidden_dir_dentry && hidden_dir_dentry->d_inode) ++ hidden_dentry = ++ lookup_one_len(name, hidden_dir_dentry, namelen); ++ else ++ hidden_dentry = NULL; ++ ++ if(hidden_sto_dir_dentry && hidden_sto_dir_dentry->d_inode) ++ hidden_sto_dentry = ++ lookup_one_len(name, hidden_sto_dir_dentry, namelen); ++ else ++ hidden_sto_dentry = NULL; ++ ++ /* catch error in lookup */ ++ if (IS_ERR(hidden_dentry) || IS_ERR(hidden_sto_dentry)) { ++ /* mk: we need to call dput on the dentry, whose ++ * lookup_one_len operation failed, in order to avoid ++ * unmount trouble. ++ */ ++ if(IS_ERR(hidden_dentry)) { ++ printk(KERN_CRIT "mini_fo_lookup: ERR from base dentry, lookup failed.\n"); ++ err = PTR_ERR(hidden_dentry); ++ } else { ++ dput(hidden_dentry); ++ } ++ if(IS_ERR(hidden_sto_dentry)) { ++ printk(KERN_CRIT "mini_fo_lookup: ERR from storage dentry, lookup failed.\n"); ++ err = PTR_ERR(hidden_sto_dentry); ++ } else { ++ dput(hidden_sto_dentry); ++ } ++ goto out; ++ } ++ ++ /* allocate dentry private data */ ++ __dtopd(dentry) = (struct mini_fo_dentry_info *) ++ kmalloc(sizeof(struct mini_fo_dentry_info), GFP_KERNEL); ++ ++ if (!dtopd(dentry)) { ++ err = -ENOMEM; ++ goto out_dput; ++ } ++ ++ /* check for different states of the mini_fo file to be looked up. */ ++ ++ /* state 1, file has been modified */ ++ if(hidden_dentry && hidden_sto_dentry && ++ hidden_dentry->d_inode && hidden_sto_dentry->d_inode && !del_flag) { ++ ++ /* update parent directory's atime */ ++ fist_copy_attr_atime(dir, hidden_sto_dir_dentry->d_inode); ++ ++ dtopd(dentry)->state = MODIFIED; ++ dtohd(dentry) = hidden_dentry; ++ dtohd2(dentry) = hidden_sto_dentry; ++ ++ err = mini_fo_tri_interpose(hidden_dentry, ++ hidden_sto_dentry, ++ dentry, dir->i_sb, 1); ++ if (err) { ++ printk(KERN_CRIT "mini_fo_lookup: error interposing (state1).\n"); ++ goto out_free; ++ } ++ goto out; ++ } ++ /* state 2, file is unmodified */ ++ if(hidden_dentry && hidden_dentry->d_inode && !del_flag) { ++ ++ fist_copy_attr_atime(dir, hidden_dir_dentry->d_inode); ++ ++ dtopd(dentry)->state = UNMODIFIED; ++ dtohd(dentry) = hidden_dentry; ++ dtohd2(dentry) = hidden_sto_dentry; /* could be negative */ ++ ++ err = mini_fo_tri_interpose(hidden_dentry, ++ hidden_sto_dentry, ++ dentry, dir->i_sb, 1); ++ if (err) { ++ printk(KERN_CRIT "mini_fo_lookup: error interposing (state2).\n"); ++ goto out_free; ++ } ++ goto out; ++ } ++ /* state 3, file has been newly created */ ++ if(hidden_sto_dentry && hidden_sto_dentry->d_inode && !del_flag) { ++ ++ fist_copy_attr_atime(dir, hidden_sto_dir_dentry->d_inode); ++ dtopd(dentry)->state = CREATED; ++ dtohd(dentry) = hidden_dentry; /* could be negative */ ++ dtohd2(dentry) = hidden_sto_dentry; ++ ++ err = mini_fo_tri_interpose(hidden_dentry, ++ hidden_sto_dentry, ++ dentry, dir->i_sb, 1); ++ if (err) { ++ printk(KERN_CRIT "mini_fo_lookup: error interposing (state3).\n"); ++ goto out_free; ++ } ++ goto out; ++ } ++ ++ /* state 4, file has deleted and created again. */ ++ if(hidden_dentry && hidden_sto_dentry && ++ hidden_dentry->d_inode && ++ hidden_sto_dentry->d_inode && del_flag) { ++ ++ fist_copy_attr_atime(dir, hidden_sto_dir_dentry->d_inode); ++ dtopd(dentry)->state = DEL_REWRITTEN; ++ dtohd(dentry) = NULL; ++ dtohd2(dentry) = hidden_sto_dentry; ++ ++ err = mini_fo_tri_interpose(NULL, ++ hidden_sto_dentry, ++ dentry, dir->i_sb, 1); ++ if (err) { ++ printk(KERN_CRIT "mini_fo_lookup: error interposing (state4).\n"); ++ goto out_free; ++ } ++ /* We will never need this dentry again, as the file has been ++ * deleted from base */ ++ dput(hidden_dentry); ++ goto out; ++ } ++ /* state 5, file has been deleted in base */ ++ if(hidden_dentry && hidden_sto_dentry && ++ hidden_dentry->d_inode && ++ !hidden_sto_dentry->d_inode && del_flag) { ++ ++ /* check which parents atime we need for updating */ ++ if(hidden_sto_dir_dentry->d_inode) ++ fist_copy_attr_atime(dir, ++ hidden_sto_dir_dentry->d_inode); ++ else ++ fist_copy_attr_atime(dir, ++ hidden_dir_dentry->d_inode); ++ ++ dtopd(dentry)->state = DELETED; ++ dtohd(dentry) = NULL; ++ dtohd2(dentry) = hidden_sto_dentry; ++ ++ /* add negative dentry to dcache to speed up lookups */ ++ d_add(dentry, NULL); ++ dput(hidden_dentry); ++ goto out; ++ } ++ /* state 6, file does not exist */ ++ if(((hidden_dentry && !hidden_dentry->d_inode) || ++ (hidden_sto_dentry && !hidden_sto_dentry->d_inode)) && !del_flag) ++ { ++ /* check which parents atime we need for updating */ ++ if(hidden_sto_dir_dentry && hidden_sto_dir_dentry->d_inode) ++ fist_copy_attr_atime(dir, hidden_sto_dir_dentry->d_inode); ++ else ++ fist_copy_attr_atime(dir, hidden_dir_dentry->d_inode); ++ ++ dtopd(dentry)->state = NON_EXISTANT; ++ dtohd(dentry) = hidden_dentry; ++ dtohd2(dentry) = hidden_sto_dentry; ++ d_add(dentry, NULL); ++ goto out; ++ } ++ ++ /* if we get to here, were in an invalid state. bad. */ ++ printk(KERN_CRIT "mini_fo_lookup: ERROR, meta data corruption detected.\n"); ++ ++ /* end state checking */ ++ out_free: ++ d_drop(dentry); /* so that our bad dentry will get destroyed */ ++ kfree(dtopd(dentry)); ++ __dtopd(dentry) = NULL; /* be safe */ ++ ++ out_dput: ++ if(hidden_dentry) ++ dput(hidden_dentry); ++ if(hidden_sto_dentry) ++ dput(hidden_sto_dentry); /* drops usage count and marks for release */ ++ ++ out: ++ /* initalize wol if file exists and is directory */ ++ if(dentry->d_inode) { ++ if(S_ISDIR(dentry->d_inode->i_mode)) { ++ itopd(dentry->d_inode)->deleted_list_size = -1; ++ itopd(dentry->d_inode)->renamed_list_size = -1; ++ meta_build_lists(dentry); ++ } ++ } ++ return ERR_PTR(err); ++} ++ ++ ++STATIC int ++mini_fo_link(dentry_t *old_dentry, inode_t *dir, dentry_t *new_dentry) ++{ ++ int err; ++ dentry_t *hidden_old_dentry; ++ dentry_t *hidden_new_dentry; ++ dentry_t *hidden_dir_dentry; ++ ++ ++ check_mini_fo_dentry(old_dentry); ++ check_mini_fo_dentry(new_dentry); ++ check_mini_fo_inode(dir); ++ ++ /* no links to directorys and existing targets target allowed */ ++ if(S_ISDIR(old_dentry->d_inode->i_mode) || ++ is_mini_fo_existant(new_dentry)) { ++ err = -EPERM; ++ goto out; ++ } ++ ++ /* bring it directly from unmod to del_rew */ ++ if(dtost(old_dentry) == UNMODIFIED) { ++ err = nondir_unmod_to_mod(old_dentry, 1); ++ if(err) { ++ err = -EINVAL; ++ goto out; ++ } ++ err = meta_add_d_entry(old_dentry->d_parent, ++ old_dentry->d_name.name, ++ old_dentry->d_name.len); ++ if(err) { ++ err = -EINVAL; ++ goto out; ++ } ++ dput(dtohd(old_dentry)); ++ dtohd(old_dentry) = NULL; ++ dtost(old_dentry) = DEL_REWRITTEN; ++ } ++ ++ err = get_neg_sto_dentry(new_dentry); ++ if(err) { ++ err = -EINVAL; ++ goto out; ++ } ++ ++ hidden_old_dentry = dtohd2(old_dentry); ++ hidden_new_dentry = dtohd2(new_dentry); ++ ++ dget(hidden_old_dentry); ++ dget(hidden_new_dentry); ++ ++ /* was: hidden_dir_dentry = lock_parent(hidden_new_dentry); */ ++ hidden_dir_dentry = dget(hidden_new_dentry->d_parent); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_dir_dentry->d_inode->i_mutex); ++#else ++ down(&hidden_dir_dentry->d_inode->i_sem); ++#endif ++ ++ err = vfs_link(hidden_old_dentry, ++ hidden_dir_dentry->d_inode, ++ hidden_new_dentry); ++ if (err || !hidden_new_dentry->d_inode) ++ goto out_lock; ++ ++ dtost(new_dentry) = CREATED; ++ err = mini_fo_tri_interpose(NULL, hidden_new_dentry, new_dentry, dir->i_sb, 0); ++ if (err) ++ goto out_lock; ++ ++ fist_copy_attr_timesizes(dir, hidden_new_dentry->d_inode); ++ /* propagate number of hard-links */ ++ old_dentry->d_inode->i_nlink = itohi2(old_dentry->d_inode)->i_nlink; ++ ++ out_lock: ++ /* was: unlock_dir(hidden_dir_dentry); */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_dir_dentry->d_inode->i_mutex); ++#else ++ up(&hidden_dir_dentry->d_inode->i_sem); ++#endif ++ dput(hidden_dir_dentry); ++ ++ dput(hidden_new_dentry); ++ dput(hidden_old_dentry); ++ if (!new_dentry->d_inode) ++ d_drop(new_dentry); ++ ++ out: ++ return err; ++} ++ ++ ++STATIC int ++mini_fo_unlink(inode_t *dir, dentry_t *dentry) ++{ ++ int err = 0; ++ ++ dget(dentry); ++ if(dtopd(dentry)->state == MODIFIED) { ++ err = nondir_mod_to_del(dentry); ++ goto out; ++ } ++ else if(dtopd(dentry)->state == UNMODIFIED) { ++ err = nondir_unmod_to_del(dentry); ++ goto out; ++ } ++ else if(dtopd(dentry)->state == CREATED) { ++ err = nondir_creat_to_del(dentry); ++ goto out; ++ } ++ else if(dtopd(dentry)->state == DEL_REWRITTEN) { ++ err = nondir_del_rew_to_del(dentry); ++ goto out; ++ } ++ ++ printk(KERN_CRIT "mini_fo_unlink: ERROR, invalid state detected.\n"); ++ ++ out: ++ fist_copy_attr_times(dir, itohi2(dentry->d_parent->d_inode)); ++ ++ if(!err) { ++ /* is this causing my pain? d_delete(dentry); */ ++ d_drop(dentry); ++ } ++ ++ dput(dentry); ++ return err; ++} ++ ++ ++STATIC int ++mini_fo_symlink(inode_t *dir, dentry_t *dentry, const char *symname) ++{ ++ int err=0; ++ dentry_t *hidden_sto_dentry; ++ dentry_t *hidden_sto_dir_dentry; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++ umode_t mode; ++#endif ++ ++ /* Fail if the symlink file exists */ ++ if(!(dtost(dentry) == DELETED || ++ dtost(dentry) == NON_EXISTANT)) { ++ err = -EEXIST; ++ goto out; ++ } ++ ++ err = get_neg_sto_dentry(dentry); ++ if(err) { ++ err = -EINVAL; ++ goto out; ++ } ++ hidden_sto_dentry = dtohd2(dentry); ++ ++ dget(hidden_sto_dentry); ++ /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */ ++ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ down(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++ mode = S_IALLUGO; ++ err = vfs_symlink(hidden_sto_dir_dentry->d_inode, ++ hidden_sto_dentry, symname, mode); ++#else ++ err = vfs_symlink(hidden_sto_dir_dentry->d_inode, ++ hidden_sto_dentry, ++ symname); ++#endif ++ if (err || !hidden_sto_dentry->d_inode) ++ goto out_lock; ++ ++ if(dtost(dentry) == DELETED) { ++ dtost(dentry) = DEL_REWRITTEN; ++ err = mini_fo_tri_interpose(NULL, hidden_sto_dentry, dentry, dir->i_sb, 0); ++ if(err) ++ goto out_lock; ++ } else if(dtost(dentry) == NON_EXISTANT) { ++ dtost(dentry) = CREATED; ++ err = mini_fo_tri_interpose(dtohd(dentry), hidden_sto_dentry, dentry, dir->i_sb, 0); ++ if(err) ++ goto out_lock; ++ } ++ fist_copy_attr_timesizes(dir, hidden_sto_dir_dentry->d_inode); ++ ++ out_lock: ++ /* was: unlock_dir(hidden_sto_dir_dentry); */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ dput(hidden_sto_dir_dentry); ++ ++ dput(hidden_sto_dentry); ++ if (!dentry->d_inode) ++ d_drop(dentry); ++ out: ++ return err; ++} ++ ++STATIC int ++mini_fo_mkdir(inode_t *dir, dentry_t *dentry, int mode) ++{ ++ int err; ++ ++ err = create_sto_dir(dentry, mode); ++ ++ check_mini_fo_dentry(dentry); ++ ++ return err; ++} ++ ++ ++STATIC int ++mini_fo_rmdir(inode_t *dir, dentry_t *dentry) ++{ ++ int err = 0; ++ ++ dentry_t *hidden_sto_dentry; ++ dentry_t *hidden_sto_dir_dentry; ++ dentry_t *meta_dentry; ++ inode_t *hidden_sto_dir = NULL; ++ ++ check_mini_fo_dentry(dentry); ++ check_mini_fo_inode(dir); ++ ++ dget(dentry); ++ if(dtopd(dentry)->state == MODIFIED) { ++ /* XXX: disabled, because it does not bother to check files on ++ * the original filesystem - just a hack, but better than simply ++ * removing it without testing */ ++ err = -EINVAL; ++ goto out; ++ ++ hidden_sto_dir = itohi2(dir); ++ hidden_sto_dentry = dtohd2(dentry); ++ ++ /* was:hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */ ++ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ down(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ ++ /* Delete an old WOL file contained in the storage dir */ ++ meta_dentry = lookup_one_len(META_FILENAME, ++ hidden_sto_dentry, ++ strlen(META_FILENAME)); ++ if(meta_dentry->d_inode) { ++ err = vfs_unlink(hidden_sto_dentry->d_inode, meta_dentry); ++ dput(meta_dentry); ++ if(!err) ++ d_delete(meta_dentry); ++ } ++ ++ err = vfs_rmdir(hidden_sto_dir, hidden_sto_dentry); ++ dput(hidden_sto_dentry); ++ if(!err) ++ d_delete(hidden_sto_dentry); ++ ++ /* propagate number of hard-links */ ++ dentry->d_inode->i_nlink = itohi2(dentry->d_inode)->i_nlink; ++ ++ dput(dtohd(dentry)); ++ ++ dtohd(dentry) = NULL; ++ dtopd(dentry)->state = DELETED; ++ ++ /* carefull with R files */ ++ if( __meta_is_r_entry(dir, ++ dentry->d_name.name, ++ dentry->d_name.len) == 1) { ++ err = meta_remove_r_entry(dentry->d_parent, ++ dentry->d_name.name, ++ dentry->d_name.len); ++ if(err) { ++ printk(KERN_CRIT "mini_fo: rmdir: meta_remove_r_entry failed.\n"); ++ goto out; ++ } ++ } ++ else { ++ /* ok, add deleted file to META */ ++ meta_add_d_entry(dentry->d_parent, ++ dentry->d_name.name, ++ dentry->d_name.len); ++ } ++ /* was: unlock_dir(hidden_sto_dir_dentry); */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ dput(hidden_sto_dir_dentry); ++ goto out; ++ } ++ else if(dtopd(dentry)->state == UNMODIFIED) { ++ /* XXX: simply adding it to the delete list here is fscking dangerous! ++ * as a temporary hack, i will disable rmdir on unmodified directories ++ * for now. ++ */ ++ err = -EINVAL; ++ goto out; ++ ++ err = get_neg_sto_dentry(dentry); ++ if(err) { ++ err = -EINVAL; ++ goto out; ++ } ++ ++ /* dput base dentry, this will relase the inode and free the ++ * dentry, as we will never need it again. */ ++ dput(dtohd(dentry)); ++ dtohd(dentry) = NULL; ++ dtopd(dentry)->state = DELETED; ++ ++ /* add deleted file to META-file */ ++ meta_add_d_entry(dentry->d_parent, ++ dentry->d_name.name, ++ dentry->d_name.len); ++ goto out; ++ } ++ else if(dtopd(dentry)->state == CREATED) { ++ hidden_sto_dir = itohi2(dir); ++ hidden_sto_dentry = dtohd2(dentry); ++ ++ /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry);*/ ++ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ down(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ ++ /* Delete an old WOL file contained in the storage dir */ ++ meta_dentry = lookup_one_len(META_FILENAME, ++ hidden_sto_dentry, ++ strlen(META_FILENAME)); ++ if(meta_dentry->d_inode) { ++ /* is this necessary? dget(meta_dentry); */ ++ err = vfs_unlink(hidden_sto_dentry->d_inode, ++ meta_dentry); ++ dput(meta_dentry); ++ if(!err) ++ d_delete(meta_dentry); ++ } ++ ++ err = vfs_rmdir(hidden_sto_dir, hidden_sto_dentry); ++ dput(hidden_sto_dentry); ++ if(!err) ++ d_delete(hidden_sto_dentry); ++ ++ /* propagate number of hard-links */ ++ dentry->d_inode->i_nlink = itohi2(dentry->d_inode)->i_nlink; ++ dtopd(dentry)->state = NON_EXISTANT; ++ ++ /* was: unlock_dir(hidden_sto_dir_dentry); */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ dput(hidden_sto_dir_dentry); ++ ++ goto out; ++ } ++ else if(dtopd(dentry)->state == DEL_REWRITTEN) { ++ hidden_sto_dir = itohi2(dir); ++ hidden_sto_dentry = dtohd2(dentry); ++ ++ /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry);*/ ++ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ down(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ ++ /* Delete an old WOL file contained in the storage dir */ ++ meta_dentry = lookup_one_len(META_FILENAME, ++ hidden_sto_dentry, ++ strlen(META_FILENAME)); ++ if(meta_dentry->d_inode) { ++ /* is this necessary? dget(meta_dentry); */ ++ err = vfs_unlink(hidden_sto_dentry->d_inode, ++ meta_dentry); ++ dput(meta_dentry); ++ if(!err) ++ d_delete(meta_dentry); ++ } ++ ++ err = vfs_rmdir(hidden_sto_dir, hidden_sto_dentry); ++ dput(hidden_sto_dentry); ++ if(!err) ++ d_delete(hidden_sto_dentry); ++ ++ /* propagate number of hard-links */ ++ dentry->d_inode->i_nlink = itohi2(dentry->d_inode)->i_nlink; ++ dtopd(dentry)->state = DELETED; ++ /* was: unlock_dir(hidden_sto_dir_dentry); */ ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ dput(hidden_sto_dir_dentry); ++ goto out; ++ } ++ ++ printk(KERN_CRIT "mini_fo_rmdir: ERROR, invalid state detected.\n"); ++ ++ out: ++ if(!err) { ++ d_drop(dentry); ++ } ++ ++ fist_copy_attr_times(dir, itohi2(dentry->d_parent->d_inode)); ++ dput(dentry); ++ ++ return err; ++} ++ ++ ++STATIC int ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++mini_fo_mknod(inode_t *dir, dentry_t *dentry, int mode, dev_t dev) ++#else ++mini_fo_mknod(inode_t *dir, dentry_t *dentry, int mode, int dev) ++#endif ++{ ++ int err = 0; ++ ++ check_mini_fo_dentry(dentry); ++ ++ err = create_sto_nod(dentry, mode, dev); ++ if(err) { ++ printk(KERN_CRIT "mini_fo_mknod: creating sto nod failed.\n"); ++ err = -EINVAL; ++ } ++ ++ check_mini_fo_dentry(dentry); ++ return err; ++} ++ ++ ++STATIC int ++mini_fo_rename(inode_t *old_dir, dentry_t *old_dentry, ++ inode_t *new_dir, dentry_t *new_dentry) ++{ ++ /* dispatch */ ++ if(S_ISDIR(old_dentry->d_inode->i_mode)) ++ return rename_directory(old_dir, old_dentry, new_dir, new_dentry); ++ return rename_nondir(old_dir, old_dentry, new_dir, new_dentry); ++ ++} ++ ++int rename_directory(inode_t *old_dir, dentry_t *old_dentry, ++ inode_t *new_dir, dentry_t *new_dentry) ++{ ++ int err, bpath_len; ++ char *bpath; ++ ++ dentry_t *hidden_old_dentry; ++ dentry_t *hidden_new_dentry; ++ dentry_t *hidden_old_dir_dentry; ++ dentry_t *hidden_new_dir_dentry; ++ ++ err = 0; ++ bpath = NULL; ++ bpath_len = 0; ++ ++ /* this is a test, chuck out if it works */ ++ if(!(dtopd(new_dentry)->state == DELETED || ++ dtopd(new_dentry)->state == NON_EXISTANT)) { ++ printk(KERN_CRIT "mini_fo: rename_directory: \ ++ uh, ah, new_dentry not negative.\n"); ++ /* return -1; */ ++ } ++ ++ /* state = UNMODIFIED */ ++ if(dtopd(old_dentry)->state == UNMODIFIED) { ++ err = dir_unmod_to_mod(old_dentry); ++ if (err) ++ goto out; ++ } ++ ++ /* state = MODIFIED */ ++ if(dtopd(old_dentry)->state == MODIFIED) { ++ bpath = meta_check_r_entry(old_dentry->d_parent, ++ old_dentry->d_name.name, ++ old_dentry->d_name.len); ++ if(bpath) { ++ err = meta_remove_r_entry(old_dentry->d_parent, ++ old_dentry->d_name.name, ++ old_dentry->d_name.len); ++ if(err) { ++ printk(KERN_CRIT "mini_fo: rename_directory:\ ++ meta_remove_r_entry \ ++ failed.\n"); ++ goto out; ++ } ++ err = meta_add_r_entry(new_dentry->d_parent, ++ bpath, ++ strlen(bpath), ++ new_dentry->d_name.name, ++ new_dentry->d_name.len); ++ kfree(bpath); ++ } ++ else {/* wol it */ ++ err = meta_add_d_entry(old_dentry->d_parent, ++ old_dentry->d_name.name, ++ old_dentry->d_name.len); ++ if (err) ++ goto out; ++ /* put it on rename list */ ++ err = get_mini_fo_bpath(old_dentry, ++ &bpath, ++ &bpath_len); ++ if (err) ++ goto out; ++ err = meta_add_r_entry(new_dentry->d_parent, ++ bpath, bpath_len, ++ new_dentry->d_name.name, ++ new_dentry->d_name.len); ++ if (err) ++ goto out; ++ } ++ /* no state change, MODIFIED stays MODIFIED */ ++ } ++ /* state = CREATED */ ++ if(dtopd(old_dentry)->state == CREATED || ++ dtopd(old_dentry)->state == DEL_REWRITTEN) { ++ if(dtohd(old_dentry)) ++ dput(dtohd(old_dentry)); ++ ++ if(dtopd(new_dentry)->state == DELETED) { ++ dtopd(old_dentry)->state = DEL_REWRITTEN; ++ dtohd(old_dentry) = NULL; ++ } ++ else if(dtopd(new_dentry)->state == NON_EXISTANT) { ++ dtopd(old_dentry)->state = CREATED; ++ /* steal new dentry's neg. base dentry */ ++ dtohd(old_dentry) = dtohd(new_dentry); ++ dtohd(new_dentry) = NULL; ++ } ++ } ++ if(dtopd(new_dentry)->state == UNMODIFIED || ++ dtopd(new_dentry)->state == NON_EXISTANT) { ++ err = get_neg_sto_dentry(new_dentry); ++ if(err) ++ goto out; ++ } ++ ++ /* now move sto file */ ++ hidden_old_dentry = dtohd2(old_dentry); ++ hidden_new_dentry = dtohd2(new_dentry); ++ ++ dget(hidden_old_dentry); ++ dget(hidden_new_dentry); ++ ++ hidden_old_dir_dentry = dget(hidden_old_dentry->d_parent); ++ hidden_new_dir_dentry = dget(hidden_new_dentry->d_parent); ++ double_lock(hidden_old_dir_dentry, hidden_new_dir_dentry); ++ ++ err = vfs_rename(hidden_old_dir_dentry->d_inode, hidden_old_dentry, ++ hidden_new_dir_dentry->d_inode, hidden_new_dentry); ++ if(err) ++ goto out_lock; ++ ++ fist_copy_attr_all(new_dir, hidden_new_dir_dentry->d_inode); ++ if (new_dir != old_dir) ++ fist_copy_attr_all(old_dir, ++ hidden_old_dir_dentry->d_inode); ++ ++ out_lock: ++ /* double_unlock will dput the new/old parent dentries ++ * whose refcnts were incremented via get_parent above. */ ++ double_unlock(hidden_old_dir_dentry, hidden_new_dir_dentry); ++ dput(hidden_new_dentry); ++ dput(hidden_old_dentry); ++ ++ out: ++ return err; ++} ++ ++int rename_nondir(inode_t *old_dir, dentry_t *old_dentry, ++ inode_t *new_dir, dentry_t *new_dentry) ++{ ++ int err=0; ++ ++ check_mini_fo_dentry(old_dentry); ++ check_mini_fo_dentry(new_dentry); ++ check_mini_fo_inode(old_dir); ++ check_mini_fo_inode(new_dir); ++ ++ /* state: UNMODIFIED */ ++ if(dtost(old_dentry) == UNMODIFIED) { ++ err = nondir_unmod_to_mod(old_dentry, 1); ++ if(err) { ++ err = -EINVAL; ++ goto out; ++ } ++ } ++ ++ /* the easy states */ ++ if(exists_in_storage(old_dentry)) { ++ ++ dentry_t *hidden_old_dentry; ++ dentry_t *hidden_new_dentry; ++ dentry_t *hidden_old_dir_dentry; ++ dentry_t *hidden_new_dir_dentry; ++ ++ /* if old file is MODIFIED, add it to the deleted_list */ ++ if(dtopd(old_dentry)->state == MODIFIED) { ++ meta_add_d_entry(old_dentry->d_parent, ++ old_dentry->d_name.name, ++ old_dentry->d_name.len); ++ ++ dput(dtohd(old_dentry)); ++ } ++ /* if old file is CREATED, we only release the base dentry */ ++ if(dtopd(old_dentry)->state == CREATED) { ++ if(dtohd(old_dentry)) ++ dput(dtohd(old_dentry)); ++ } ++ ++ /* now setup the new states (depends on new_dentry state) */ ++ /* new dentry state = MODIFIED */ ++ if(dtopd(new_dentry)->state == MODIFIED) { ++ meta_add_d_entry(new_dentry->d_parent, ++ new_dentry->d_name.name, ++ new_dentry->d_name.len); ++ ++ /* new dentry will be d_put'ed later by the vfs ++ * so don't do it here ++ * dput(dtohd(new_dentry)); ++ */ ++ dtohd(old_dentry) = NULL; ++ dtopd(old_dentry)->state = DEL_REWRITTEN; ++ } ++ /* new dentry state = UNMODIFIED */ ++ else if(dtopd(new_dentry)->state == UNMODIFIED) { ++ if(get_neg_sto_dentry(new_dentry)) ++ return -EINVAL; ++ ++ meta_add_d_entry(new_dentry->d_parent, ++ new_dentry->d_name.name, ++ new_dentry->d_name.len); ++ ++ /* is this right??? */ ++ /*dput(dtohd(new_dentry));*/ ++ dtohd(old_dentry) = NULL; ++ dtopd(old_dentry)->state = DEL_REWRITTEN; ++ } ++ /* new dentry state = CREATED */ ++ else if(dtopd(new_dentry)->state == CREATED) { ++ /* we keep the neg. base dentry (if exists) */ ++ dtohd(old_dentry) = dtohd(new_dentry); ++ /* ...and set it to Null, or we'll get ++ * dcache.c:345 if it gets dput twice... */ ++ dtohd(new_dentry) = NULL; ++ dtopd(old_dentry)->state = CREATED; ++ } ++ /* new dentry state = NON_EXISTANT */ ++ else if(dtopd(new_dentry)->state == NON_EXISTANT) { ++ if(get_neg_sto_dentry(new_dentry)) ++ return -EINVAL; ++ ++ /* we keep the neg. base dentry (if exists) */ ++ dtohd(old_dentry) = dtohd(new_dentry); ++ /* ...and set it to Null, or we'll get ++ * Dr. dcache.c:345 if it gets dput twice... */ ++ dtohd(new_dentry) = NULL; ++ dtopd(old_dentry)->state = CREATED; ++ } ++ /* new dentry state = DEL_REWRITTEN or DELETED */ ++ else if(dtopd(new_dentry)->state == DEL_REWRITTEN || ++ dtopd(new_dentry)->state == DELETED) { ++ dtohd(old_dentry) = NULL; ++ dtopd(old_dentry)->state = DEL_REWRITTEN; ++ } ++ else { /* not possible, uhh, ahh */ ++ printk(KERN_CRIT ++ "mini_fo: rename_reg_file: invalid state detected [1].\n"); ++ return -1; ++ } ++ ++ /* now we definitely have a sto file */ ++ hidden_old_dentry = dtohd2(old_dentry); ++ hidden_new_dentry = dtohd2(new_dentry); ++ ++ dget(hidden_old_dentry); ++ dget(hidden_new_dentry); ++ ++ hidden_old_dir_dentry = dget(hidden_old_dentry->d_parent); ++ hidden_new_dir_dentry = dget(hidden_new_dentry->d_parent); ++ double_lock(hidden_old_dir_dentry, hidden_new_dir_dentry); ++ ++ err = vfs_rename(hidden_old_dir_dentry->d_inode, ++ hidden_old_dentry, ++ hidden_new_dir_dentry->d_inode, ++ hidden_new_dentry); ++ if(err) ++ goto out_lock; ++ ++ fist_copy_attr_all(new_dir, hidden_new_dir_dentry->d_inode); ++ if (new_dir != old_dir) ++ fist_copy_attr_all(old_dir, hidden_old_dir_dentry->d_inode); ++ ++ out_lock: ++ /* double_unlock will dput the new/old parent dentries ++ * whose refcnts were incremented via get_parent above. ++ */ ++ double_unlock(hidden_old_dir_dentry, hidden_new_dir_dentry); ++ dput(hidden_new_dentry); ++ dput(hidden_old_dentry); ++ out: ++ return err; ++ } ++ else { /* invalid state */ ++ printk(KERN_CRIT "mini_fo: rename_reg_file: ERROR: invalid state detected [2].\n"); ++ return -1; ++ } ++} ++ ++ ++STATIC int ++mini_fo_readlink(dentry_t *dentry, char *buf, int bufsiz) ++{ ++ int err=0; ++ dentry_t *hidden_dentry = NULL; ++ ++ if(dtohd2(dentry) && dtohd2(dentry)->d_inode) { ++ hidden_dentry = dtohd2(dentry); ++ } else if(dtohd(dentry) && dtohd(dentry)->d_inode) { ++ hidden_dentry = dtohd(dentry); ++ } else { ++ goto out; ++ } ++ ++ if (!hidden_dentry->d_inode->i_op || ++ !hidden_dentry->d_inode->i_op->readlink) { ++ err = -EINVAL; goto out; ++ } ++ ++ err = hidden_dentry->d_inode->i_op->readlink(hidden_dentry, ++ buf, ++ bufsiz); ++ if (err > 0) ++ fist_copy_attr_atime(dentry->d_inode, hidden_dentry->d_inode); ++ ++ out: ++ return err; ++} ++ ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) ++static int mini_fo_follow_link(dentry_t *dentry, struct nameidata *nd) ++#else ++static void* mini_fo_follow_link(dentry_t *dentry, struct nameidata *nd) ++#endif ++{ ++ char *buf; ++ int len = PAGE_SIZE, err; ++ mm_segment_t old_fs; ++ ++ /* in 2.6 this is freed by mini_fo_put_link called by __do_follow_link */ ++ buf = kmalloc(len, GFP_KERNEL); ++ if (!buf) { ++ err = -ENOMEM; ++ goto out; ++ } ++ ++ /* read the symlink, and then we will follow it */ ++ old_fs = get_fs(); ++ set_fs(KERNEL_DS); ++ err = dentry->d_inode->i_op->readlink(dentry, buf, len); ++ set_fs(old_fs); ++ if (err < 0) { ++ kfree(buf); ++ buf = NULL; ++ goto out; ++ } ++ buf[err] = 0; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++ nd_set_link(nd, buf); ++ err = 0; ++#else ++ err = vfs_follow_link(nd, buf); ++#endif ++ ++ out: ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ++ kfree(buf); ++#endif ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) ++ return err; ++#else ++ return ERR_PTR(err); ++#endif ++} ++ ++STATIC ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) ++void mini_fo_put_link(struct dentry *dentry, struct nameidata *nd) ++#else ++void mini_fo_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie) ++#endif ++{ ++ char *link; ++ link = nd_get_link(nd); ++ kfree(link); ++} ++#endif ++ ++STATIC int ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++mini_fo_permission(inode_t *inode, int mask, struct nameidata *nd) ++#else ++mini_fo_permission(inode_t *inode, int mask) ++#endif ++{ ++ inode_t *hidden_inode; ++ int mode; ++ int err; ++ ++ if(itohi2(inode)) { ++ hidden_inode = itohi2(inode); ++ } else { ++ hidden_inode = itohi(inode); ++ } ++ mode = inode->i_mode; ++ ++ /* not really needed, as permission handles everything: ++ * err = vfs_permission(inode, mask); ++ * if (err) ++ * goto out; ++ */ ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++ err = permission(hidden_inode, mask, nd); ++#else ++ err = permission(hidden_inode, mask); ++#endif ++ ++ /* out: */ ++ return err; ++} ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ++STATIC int ++mini_fo_inode_revalidate(dentry_t *dentry) ++{ ++ int err = 0; ++ dentry_t *hidden_dentry; ++ inode_t *hidden_inode; ++ ++ ASSERT(dentry->d_inode); ++ ASSERT(itopd(dentry->d_inode)); ++ ++ if(itohi2(dentry->d_inode)) { ++ hidden_dentry = dtohd2(dentry); ++ hidden_inode = hidden_dentry->d_inode; ++ } else if(itohi(dentry->d_inode)) { ++ hidden_dentry = dtohd(dentry); ++ hidden_inode = hidden_dentry->d_inode; ++ } else { ++ printk(KERN_CRIT "mini_fo_inode_revalidate: ERROR, invalid state detected.\n"); ++ err = -ENOENT; ++ goto out; ++ } ++ if (hidden_inode && hidden_inode->i_op && hidden_inode->i_op->revalidate){ ++ err = hidden_inode->i_op->revalidate(hidden_dentry); ++ if (err) ++ goto out; ++ } ++ fist_copy_attr_all(dentry->d_inode, hidden_inode); ++ out: ++ return err; ++} ++#endif ++ ++STATIC int ++mini_fo_setattr(dentry_t *dentry, struct iattr *ia) ++{ ++ int err = 0; ++ ++ check_mini_fo_dentry(dentry); ++ ++ if(!is_mini_fo_existant(dentry)) { ++ printk(KERN_CRIT "mini_fo_setattr: ERROR, invalid state detected [1].\n"); ++ goto out; ++ } ++ ++ if(dtost(dentry) == UNMODIFIED) { ++ if(!IS_COPY_FLAG(ia->ia_valid)) ++ goto out; /* we ignore these changes to base */ ++ ++ if(S_ISDIR(dentry->d_inode->i_mode)) { ++ err = dir_unmod_to_mod(dentry); ++ } else { ++ /* we copy contents if file is not beeing truncated */ ++ if(S_ISREG(dentry->d_inode->i_mode) && ++ !(ia->ia_size == 0 && (ia->ia_valid & ATTR_SIZE))) { ++ err = nondir_unmod_to_mod(dentry, 1); ++ } else ++ err = nondir_unmod_to_mod(dentry, 0); ++ } ++ if(err) { ++ err = -EINVAL; ++ printk(KERN_CRIT "mini_fo_setattr: ERROR changing states.\n"); ++ goto out; ++ } ++ } ++ if(!exists_in_storage(dentry)) { ++ printk(KERN_CRIT "mini_fo_setattr: ERROR, invalid state detected [2].\n"); ++ err = -EINVAL; ++ goto out; ++ } ++ ASSERT(dentry->d_inode); ++ ASSERT(dtohd2(dentry)); ++ ASSERT(itopd(dentry->d_inode)); ++ ASSERT(itohi2(dentry->d_inode)); ++ ++ err = notify_change(dtohd2(dentry), ia); ++ fist_copy_attr_all(dentry->d_inode, itohi2(dentry->d_inode)); ++ out: ++ return err; ++} ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++STATIC int ++mini_fo_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) ++{ ++ int err = 0; ++ dentry_t *hidden_dentry; ++ ++ ASSERT(dentry->d_inode); ++ ASSERT(itopd(dentry->d_inode)); ++ ++ if(itohi2(dentry->d_inode)) { ++ hidden_dentry = dtohd2(dentry); ++ } else if(itohi(dentry->d_inode)) { ++ hidden_dentry = dtohd(dentry); ++ } else { ++ printk(KERN_CRIT "mini_fo_getattr: ERROR, invalid state detected.\n"); ++ err = -ENOENT; ++ goto out; ++ } ++ fist_copy_attr_all(dentry->d_inode, hidden_dentry->d_inode); ++ ++ ASSERT(hidden_dentry); ++ ASSERT(hidden_dentry->d_inode); ++ ASSERT(hidden_dentry->d_inode->i_op); ++ ++ generic_fillattr(dentry->d_inode, stat); ++ if (!stat->blksize) { ++ struct super_block *s = hidden_dentry->d_inode->i_sb; ++ unsigned blocks; ++ blocks = (stat->size+s->s_blocksize-1) >> s->s_blocksize_bits; ++ stat->blocks = (s->s_blocksize / 512) * blocks; ++ stat->blksize = s->s_blocksize; ++ } ++ out: ++ return err; ++} ++#endif ++ ++#if defined(XATTR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)) ++#if 0 /* no xattr_alloc() and xattr_free() */ ++/* This is lifted from fs/xattr.c */ ++static void * ++xattr_alloc(size_t size, size_t limit) ++{ ++ void *ptr; ++ ++ if (size > limit) ++ return ERR_PTR(-E2BIG); ++ ++ if (!size) /* size request, no buffer is needed */ ++ return NULL; ++ else if (size <= PAGE_SIZE) ++ ptr = kmalloc((unsigned long) size, GFP_KERNEL); ++ else ++ ptr = vmalloc((unsigned long) size); ++ if (!ptr) ++ return ERR_PTR(-ENOMEM); ++ return ptr; ++} ++ ++static void ++xattr_free(void *ptr, size_t size) ++{ ++ if (!size) /* size request, no buffer was needed */ ++ return; ++ else if (size <= PAGE_SIZE) ++ kfree(ptr); ++ else ++ vfree(ptr); ++} ++#endif /* no xattr_alloc() and xattr_free() */ ++ ++/* BKL held by caller. ++ * dentry->d_inode->i_sem down ++ */ ++STATIC int ++mini_fo_getxattr(struct dentry *dentry, const char *name, void *value, size_t size) { ++ struct dentry *hidden_dentry = NULL; ++ int err = -EOPNOTSUPP; ++ /* Define these anyway so we don't need as much ifdef'ed code. */ ++ char *encoded_name = NULL; ++ char *encoded_value = NULL; ++ ++ check_mini_fo_dentry(dentry); ++ ++ if(exists_in_storage(dentry)) ++ hidden_dentry = dtohd2(dentry); ++ else ++ hidden_dentry = dtohd(dentry); ++ ++ ASSERT(hidden_dentry); ++ ASSERT(hidden_dentry->d_inode); ++ ASSERT(hidden_dentry->d_inode->i_op); ++ ++ if (hidden_dentry->d_inode->i_op->getxattr) { ++ encoded_name = (char *)name; ++ encoded_value = (char *)value; ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_dentry->d_inode->i_mutex); ++#else ++ down(&hidden_dentry->d_inode->i_sem); ++#endif ++ /* lock_kernel() already done by caller. */ ++ err = hidden_dentry->d_inode->i_op->getxattr(hidden_dentry, encoded_name, encoded_value, size); ++ /* unlock_kernel() will be done by caller. */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_dentry->d_inode->i_mutex); ++#else ++ up(&hidden_dentry->d_inode->i_sem); ++#endif ++ } ++ return err; ++} ++ ++/* BKL held by caller. ++ * dentry->d_inode->i_sem down ++ */ ++STATIC int ++#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,21) \ ++ && LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,23)) \ ++ || LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) ++mini_fo_setxattr(struct dentry *dentry, const char *name, ++ const void *value, size_t size, int flags) ++#else ++mini_fo_setxattr(struct dentry *dentry, const char *name, ++ void *value, size_t size, int flags) ++#endif ++ ++{ ++ struct dentry *hidden_dentry = NULL; ++ int err = -EOPNOTSUPP; ++ ++ /* Define these anyway, so we don't have as much ifdef'ed code. */ ++ char *encoded_value = NULL; ++ char *encoded_name = NULL; ++ ++ check_mini_fo_dentry(dentry); ++ ++ if(exists_in_storage(dentry)) ++ hidden_dentry = dtohd2(dentry); ++ else ++ hidden_dentry = dtohd(dentry); ++ ++ ASSERT(hidden_dentry); ++ ASSERT(hidden_dentry->d_inode); ++ ASSERT(hidden_dentry->d_inode->i_op); ++ ++ if (hidden_dentry->d_inode->i_op->setxattr) { ++ encoded_name = (char *)name; ++ encoded_value = (char *)value; ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_dentry->d_inode->i_mutex); ++#else ++ down(&hidden_dentry->d_inode->i_sem); ++#endif ++ /* lock_kernel() already done by caller. */ ++ err = hidden_dentry->d_inode->i_op->setxattr(hidden_dentry, encoded_name, encoded_value, size, flags); ++ /* unlock_kernel() will be done by caller. */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_dentry->d_inode->i_mutex); ++#else ++ up(&hidden_dentry->d_inode->i_sem); ++#endif ++ } ++ return err; ++} ++ ++/* BKL held by caller. ++ * dentry->d_inode->i_sem down ++ */ ++STATIC int ++mini_fo_removexattr(struct dentry *dentry, const char *name) { ++ struct dentry *hidden_dentry = NULL; ++ int err = -EOPNOTSUPP; ++ char *encoded_name; ++ ++ check_mini_fo_dentry(dentry); ++ ++ if(exists_in_storage(dentry)) ++ hidden_dentry = dtohd2(dentry); ++ else ++ hidden_dentry = dtohd(dentry); ++ ++ ASSERT(hidden_dentry); ++ ASSERT(hidden_dentry->d_inode); ++ ASSERT(hidden_dentry->d_inode->i_op); ++ ++ if (hidden_dentry->d_inode->i_op->removexattr) { ++ encoded_name = (char *)name; ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_dentry->d_inode->i_mutex); ++#else ++ down(&hidden_dentry->d_inode->i_sem); ++#endif ++ /* lock_kernel() already done by caller. */ ++ err = hidden_dentry->d_inode->i_op->removexattr(hidden_dentry, encoded_name); ++ /* unlock_kernel() will be done by caller. */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_dentry->d_inode->i_mutex); ++#else ++ up(&hidden_dentry->d_inode->i_sem); ++#endif ++ } ++ return err; ++} ++ ++/* BKL held by caller. ++ * dentry->d_inode->i_sem down ++ */ ++STATIC int ++mini_fo_listxattr(struct dentry *dentry, char *list, size_t size) { ++ struct dentry *hidden_dentry = NULL; ++ int err = -EOPNOTSUPP; ++ char *encoded_list = NULL; ++ ++ check_mini_fo_dentry(dentry); ++ ++ if(exists_in_storage(dentry)) ++ hidden_dentry = dtohd2(dentry); ++ else ++ hidden_dentry = dtohd(dentry); ++ ++ ASSERT(hidden_dentry); ++ ASSERT(hidden_dentry->d_inode); ++ ASSERT(hidden_dentry->d_inode->i_op); ++ ++ if (hidden_dentry->d_inode->i_op->listxattr) { ++ encoded_list = list; ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_dentry->d_inode->i_mutex); ++#else ++ down(&hidden_dentry->d_inode->i_sem); ++#endif ++ /* lock_kernel() already done by caller. */ ++ err = hidden_dentry->d_inode->i_op->listxattr(hidden_dentry, encoded_list, size); ++ /* unlock_kernel() will be done by caller. */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_dentry->d_inode->i_mutex); ++#else ++ up(&hidden_dentry->d_inode->i_sem); ++#endif ++ } ++ return err; ++} ++# endif /* defined(XATTR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)) */ ++ ++struct inode_operations mini_fo_symlink_iops = ++ { ++ readlink: mini_fo_readlink, ++ follow_link: mini_fo_follow_link, ++ /* mk: permission: mini_fo_permission, */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ++ revalidate: mini_fo_inode_revalidate, ++#endif ++ setattr: mini_fo_setattr, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++ getattr: mini_fo_getattr, ++ put_link: mini_fo_put_link, ++#endif ++ ++#if defined(XATTR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)) ++ setxattr: mini_fo_setxattr, ++ getxattr: mini_fo_getxattr, ++ listxattr: mini_fo_listxattr, ++ removexattr: mini_fo_removexattr ++# endif /* defined(XATTR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)) */ ++ }; ++ ++struct inode_operations mini_fo_dir_iops = ++ { ++ create: mini_fo_create, ++ lookup: mini_fo_lookup, ++ link: mini_fo_link, ++ unlink: mini_fo_unlink, ++ symlink: mini_fo_symlink, ++ mkdir: mini_fo_mkdir, ++ rmdir: mini_fo_rmdir, ++ mknod: mini_fo_mknod, ++ rename: mini_fo_rename, ++ /* no readlink/follow_link for non-symlinks */ ++ // off because we have setattr ++ // truncate: mini_fo_truncate, ++ /* mk:permission: mini_fo_permission, */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ++ revalidate: mini_fo_inode_revalidate, ++#endif ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++ getattr: mini_fo_getattr, ++#endif ++ setattr: mini_fo_setattr, ++#if defined(XATTR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)) ++ setxattr: mini_fo_setxattr, ++ getxattr: mini_fo_getxattr, ++ listxattr: mini_fo_listxattr, ++ removexattr: mini_fo_removexattr ++# endif /* XATTR && LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20) */ ++ }; ++ ++struct inode_operations mini_fo_main_iops = ++ { ++ /* permission: mini_fo_permission, */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ++ revalidate: mini_fo_inode_revalidate, ++#endif ++ setattr: mini_fo_setattr, ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++ getattr: mini_fo_getattr, ++#endif ++#if defined(XATTR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)) ++ setxattr: mini_fo_setxattr, ++ getxattr: mini_fo_getxattr, ++ listxattr: mini_fo_listxattr, ++ removexattr: mini_fo_removexattr ++# endif /* XATTR && LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20) */ ++ }; +--- /dev/null ++++ b/fs/mini_fo/main.c +@@ -0,0 +1,423 @@ ++/* ++ * Copyright (c) 1997-2003 Erez Zadok ++ * Copyright (c) 2001-2003 Stony Brook University ++ * ++ * For specific licensing information, see the COPYING file distributed with ++ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING. ++ * ++ * This Copyright notice must be kept intact and distributed with all ++ * fistgen sources INCLUDING sources generated by fistgen. ++ */ ++/* ++ * Copyright (C) 2004, 2005 Markus Klotzbuecher ++ * ++ * 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 of the License, or (at your option) any later version. ++ */ ++ ++/* ++ * $Id$ ++ */ ++ ++#ifdef HAVE_CONFIG_H ++# include ++#endif ++ ++#include "fist.h" ++#include "mini_fo.h" ++#include ++ ++/* This definition must only appear after we include */ ++#ifndef MODULE_LICENSE ++# define MODULE_LICENSE(bison) ++#endif /* not MODULE_LICENSE */ ++ ++/* ++ * This is the mini_fo tri interpose function, which extends the ++ * functionality of the regular interpose by interposing a higher ++ * level inode on top of two lower level ones: the base filesystem ++ * inode and the storage filesystem inode. ++ * ++ * sb we pass is mini_fo's super_block ++ */ ++int ++mini_fo_tri_interpose(dentry_t *hidden_dentry, ++ dentry_t *hidden_sto_dentry, ++ dentry_t *dentry, super_block_t *sb, int flag) ++{ ++ inode_t *hidden_inode = NULL; ++ inode_t *hidden_sto_inode = NULL; /* store corresponding storage inode */ ++ int err = 0; ++ inode_t *inode; ++ ++ /* Pointer to hidden_sto_inode if exists, else to hidden_inode. ++ * This is used to copy the attributes of the correct inode. */ ++ inode_t *master_inode; ++ ++ if(hidden_dentry) ++ hidden_inode = hidden_dentry->d_inode; ++ if(hidden_sto_dentry) ++ hidden_sto_inode = hidden_sto_dentry->d_inode; ++ ++ ASSERT(dentry->d_inode == NULL); ++ ++ /* mk: One of the inodes associated with the dentrys is likely to ++ * be NULL, so carefull: ++ */ ++ ASSERT((hidden_inode != NULL) || (hidden_sto_inode != NULL)); ++ ++ if(hidden_sto_inode) ++ master_inode = hidden_sto_inode; ++ else ++ master_inode = hidden_inode; ++ ++ /* ++ * We allocate our new inode below, by calling iget. ++ * iget will call our read_inode which will initialize some ++ * of the new inode's fields ++ */ ++ ++ /* ++ * original: inode = iget(sb, hidden_inode->i_ino); ++ */ ++ inode = iget(sb, iunique(sb, 25)); ++ if (!inode) { ++ err = -EACCES; /* should be impossible??? */ ++ goto out; ++ } ++ ++ /* ++ * interpose the inode if not already interposed ++ * this is possible if the inode is being reused ++ * XXX: what happens if we get_empty_inode() but there's another already? ++ * for now, ASSERT() that this can't happen; fix later. ++ */ ++ if (itohi(inode) != NULL) { ++ printk(KERN_CRIT "mini_fo_tri_interpose: itohi(inode) != NULL.\n"); ++ } ++ if (itohi2(inode) != NULL) { ++ printk(KERN_CRIT "mini_fo_tri_interpose: itohi2(inode) != NULL.\n"); ++ } ++ ++ /* mk: Carefull, igrab can't handle NULL inodes (ok, why should it?), so ++ * we need to check here: ++ */ ++ if(hidden_inode) ++ itohi(inode) = igrab(hidden_inode); ++ else ++ itohi(inode) = NULL; ++ ++ if(hidden_sto_inode) ++ itohi2(inode) = igrab(hidden_sto_inode); ++ else ++ itohi2(inode) = NULL; ++ ++ ++ /* Use different set of inode ops for symlinks & directories*/ ++ if (S_ISLNK(master_inode->i_mode)) ++ inode->i_op = &mini_fo_symlink_iops; ++ else if (S_ISDIR(master_inode->i_mode)) ++ inode->i_op = &mini_fo_dir_iops; ++ ++ /* Use different set of file ops for directories */ ++ if (S_ISDIR(master_inode->i_mode)) ++ inode->i_fop = &mini_fo_dir_fops; ++ ++ /* properly initialize special inodes */ ++ if (S_ISBLK(master_inode->i_mode) || S_ISCHR(master_inode->i_mode) || ++ S_ISFIFO(master_inode->i_mode) || S_ISSOCK(master_inode->i_mode)) { ++ init_special_inode(inode, master_inode->i_mode, master_inode->i_rdev); ++ } ++ ++ /* Fix our inode's address operations to that of the lower inode */ ++ if (inode->i_mapping->a_ops != master_inode->i_mapping->a_ops) { ++ inode->i_mapping->a_ops = master_inode->i_mapping->a_ops; ++ } ++ ++ /* only (our) lookup wants to do a d_add */ ++ if (flag) ++ d_add(dentry, inode); ++ else ++ d_instantiate(dentry, inode); ++ ++ ASSERT(dtopd(dentry) != NULL); ++ ++ /* all well, copy inode attributes */ ++ fist_copy_attr_all(inode, master_inode); ++ ++ out: ++ return err; ++} ++ ++/* parse mount options "base=" and "sto=" */ ++dentry_t * ++mini_fo_parse_options(super_block_t *sb, char *options) ++{ ++ dentry_t *hidden_root = ERR_PTR(-EINVAL); ++ dentry_t *hidden_root2 = ERR_PTR(-EINVAL); ++ struct nameidata nd, nd2; ++ char *name, *tmp, *end; ++ int err = 0; ++ ++ /* We don't want to go off the end of our arguments later on. */ ++ for (end = options; *end; end++); ++ ++ while (options < end) { ++ tmp = options; ++ while (*tmp && *tmp != ',') ++ tmp++; ++ *tmp = '\0'; ++ if (!strncmp("base=", options, 5)) { ++ name = options + 5; ++ printk(KERN_INFO "mini_fo: using base directory: %s\n", name); ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ++ if (path_init(name, LOOKUP_FOLLOW, &nd)) ++ err = path_walk(name, &nd); ++#else ++ err = path_lookup(name, LOOKUP_FOLLOW, &nd); ++#endif ++ if (err) { ++ printk(KERN_CRIT "mini_fo: error accessing hidden directory '%s'\n", name); ++ hidden_root = ERR_PTR(err); ++ goto out; ++ } ++ hidden_root = nd.dentry; ++ stopd(sb)->base_dir_dentry = nd.dentry; ++ stopd(sb)->hidden_mnt = nd.mnt; ++ ++ } else if(!strncmp("sto=", options, 4)) { ++ /* parse the storage dir */ ++ name = options + 4; ++ printk(KERN_INFO "mini_fo: using storage directory: %s\n", name); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ++ if(path_init(name, LOOKUP_FOLLOW, &nd2)) ++ err = path_walk(name, &nd2); ++#else ++ err = path_lookup(name, LOOKUP_FOLLOW, &nd2); ++#endif ++ if(err) { ++ printk(KERN_CRIT "mini_fo: error accessing hidden storage directory '%s'\n", name); ++ ++ hidden_root2 = ERR_PTR(err); ++ goto out; ++ } ++ hidden_root2 = nd2.dentry; ++ stopd(sb)->storage_dir_dentry = nd2.dentry; ++ stopd(sb)->hidden_mnt2 = nd2.mnt; ++ stohs2(sb) = hidden_root2->d_sb; ++ ++ /* validate storage dir, this is done in ++ * mini_fo_read_super for the base directory. ++ */ ++ if (IS_ERR(hidden_root2)) { ++ printk(KERN_WARNING "mini_fo_parse_options: storage dentry lookup failed (err = %ld)\n", PTR_ERR(hidden_root2)); ++ goto out; ++ } ++ if (!hidden_root2->d_inode) { ++ printk(KERN_WARNING "mini_fo_parse_options: no storage dir to interpose on.\n"); ++ goto out; ++ } ++ stohs2(sb) = hidden_root2->d_sb; ++ } else { ++ printk(KERN_WARNING "mini_fo: unrecognized option '%s'\n", options); ++ hidden_root = ERR_PTR(-EINVAL); ++ goto out; ++ } ++ options = tmp + 1; ++ } ++ ++ out: ++ if(IS_ERR(hidden_root2)) ++ return hidden_root2; ++ return hidden_root; ++} ++ ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++static int ++#else ++super_block_t * ++#endif ++mini_fo_read_super(super_block_t *sb, void *raw_data, int silent) ++{ ++ dentry_t *hidden_root; ++ int err = 0; ++ ++ if (!raw_data) { ++ printk(KERN_WARNING "mini_fo_read_super: missing argument\n"); ++ err = -EINVAL; ++ goto out; ++ } ++ /* ++ * Allocate superblock private data ++ */ ++ __stopd(sb) = kmalloc(sizeof(struct mini_fo_sb_info), GFP_KERNEL); ++ if (!stopd(sb)) { ++ printk(KERN_WARNING "%s: out of memory\n", __FUNCTION__); ++ err = -ENOMEM; ++ goto out; ++ } ++ stohs(sb) = NULL; ++ ++ hidden_root = mini_fo_parse_options(sb, raw_data); ++ if (IS_ERR(hidden_root)) { ++ printk(KERN_WARNING "mini_fo_read_super: lookup_dentry failed (err = %ld)\n", PTR_ERR(hidden_root)); ++ err = PTR_ERR(hidden_root); ++ goto out_free; ++ } ++ if (!hidden_root->d_inode) { ++ printk(KERN_WARNING "mini_fo_read_super: no directory to interpose on\n"); ++ goto out_free; ++ } ++ stohs(sb) = hidden_root->d_sb; ++ ++ /* ++ * Linux 2.4.2-ac3 and beyond has code in ++ * mm/filemap.c:generic_file_write() that requires sb->s_maxbytes ++ * to be populated. If not set, all write()s under that sb will ++ * return 0. ++ * ++ * Linux 2.4.4+ automatically sets s_maxbytes to MAX_NON_LFS; ++ * the filesystem should override it only if it supports LFS. ++ */ ++ /* non-SCA code is good to go with LFS */ ++ sb->s_maxbytes = hidden_root->d_sb->s_maxbytes; ++ ++ sb->s_op = &mini_fo_sops; ++ /* ++ * we can't use d_alloc_root if we want to use ++ * our own interpose function unchanged, ++ * so we simply replicate *most* of the code in d_alloc_root here ++ */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ++ sb->s_root = d_alloc(NULL, &(const struct qstr) { "/", 1, 0 }); ++#else ++ sb->s_root = d_alloc(NULL, &(const struct qstr){hash: 0, name: "/", len : 1}); ++#endif ++ if (IS_ERR(sb->s_root)) { ++ printk(KERN_WARNING "mini_fo_read_super: d_alloc failed\n"); ++ err = -ENOMEM; ++ goto out_dput; ++ } ++ ++ sb->s_root->d_op = &mini_fo_dops; ++ sb->s_root->d_sb = sb; ++ sb->s_root->d_parent = sb->s_root; ++ ++ /* link the upper and lower dentries */ ++ __dtopd(sb->s_root) = (struct mini_fo_dentry_info *) ++ kmalloc(sizeof(struct mini_fo_dentry_info), GFP_KERNEL); ++ if (!dtopd(sb->s_root)) { ++ err = -ENOMEM; ++ goto out_dput2; ++ } ++ dtopd(sb->s_root)->state = MODIFIED; ++ dtohd(sb->s_root) = hidden_root; ++ ++ /* fanout relevant, interpose on storage root dentry too */ ++ dtohd2(sb->s_root) = stopd(sb)->storage_dir_dentry; ++ ++ /* ...and call tri-interpose to interpose root dir inodes ++ * if (mini_fo_interpose(hidden_root, sb->s_root, sb, 0)) ++ */ ++ if(mini_fo_tri_interpose(hidden_root, dtohd2(sb->s_root), sb->s_root, sb, 0)) ++ goto out_dput2; ++ ++ /* initalize the wol list */ ++ itopd(sb->s_root->d_inode)->deleted_list_size = -1; ++ itopd(sb->s_root->d_inode)->renamed_list_size = -1; ++ meta_build_lists(sb->s_root); ++ ++ goto out; ++ ++ out_dput2: ++ dput(sb->s_root); ++ out_dput: ++ dput(hidden_root); ++ dput(dtohd2(sb->s_root)); /* release the hidden_sto_dentry too */ ++ out_free: ++ kfree(stopd(sb)); ++ __stopd(sb) = NULL; ++ out: ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++ return err; ++#else ++ if (err) { ++ return ERR_PTR(err); ++ } else { ++ return sb; ++ } ++#endif ++} ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) ++static int mini_fo_get_sb(struct file_system_type *fs_type, ++ int flags, const char *dev_name, ++ void *raw_data, struct vfsmount *mnt) ++{ ++ return get_sb_nodev(fs_type, flags, raw_data, mini_fo_read_super, mnt); ++} ++#else ++static struct super_block *mini_fo_get_sb(struct file_system_type *fs_type, ++ int flags, const char *dev_name, ++ void *raw_data) ++{ ++ return get_sb_nodev(fs_type, flags, raw_data, mini_fo_read_super); ++} ++#endif ++ ++void mini_fo_kill_block_super(struct super_block *sb) ++{ ++ generic_shutdown_super(sb); ++ /* ++ * XXX: BUG: Halcrow: Things get unstable sometime after this point: ++ * lib/rwsem-spinlock.c:127: spin_is_locked on uninitialized ++ * fs/fs-writeback.c:402: spin_lock(fs/super.c:a0381828) already ++ * locked by fs/fs-writeback.c/402 ++ * ++ * Apparently, someone's not releasing a lock on sb_lock... ++ */ ++} ++ ++static struct file_system_type mini_fo_fs_type = { ++ .owner = THIS_MODULE, ++ .name = "mini_fo", ++ .get_sb = mini_fo_get_sb, ++ .kill_sb = mini_fo_kill_block_super, ++ .fs_flags = 0, ++}; ++ ++ ++#else ++static DECLARE_FSTYPE(mini_fo_fs_type, "mini_fo", mini_fo_read_super, 0); ++#endif ++ ++static int __init init_mini_fo_fs(void) ++{ ++ printk("Registering mini_fo version $Id$\n"); ++ return register_filesystem(&mini_fo_fs_type); ++} ++static void __exit exit_mini_fo_fs(void) ++{ ++ printk("Unregistering mini_fo version $Id$\n"); ++ unregister_filesystem(&mini_fo_fs_type); ++} ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ++EXPORT_NO_SYMBOLS; ++#endif ++ ++MODULE_AUTHOR("Erez Zadok "); ++MODULE_DESCRIPTION("FiST-generated mini_fo filesystem"); ++MODULE_LICENSE("GPL"); ++ ++/* MODULE_PARM(fist_debug_var, "i"); */ ++/* MODULE_PARM_DESC(fist_debug_var, "Debug level"); */ ++ ++module_init(init_mini_fo_fs) ++module_exit(exit_mini_fo_fs) +--- /dev/null ++++ b/fs/mini_fo/Makefile +@@ -0,0 +1,17 @@ ++# ++# Makefile for mini_fo 2.4 and 2.6 Linux kernels ++# ++# Copyright (C) 2004, 2005 Markus Klotzbuecher ++# ++# 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 of the License, or (at your option) any later version. ++# ++ ++obj-$(CONFIG_MINI_FO) := mini_fo.o ++mini_fo-objs := meta.o dentry.o file.o inode.o main.o super.o state.o aux.o ++ ++# dependencies ++${mini_fo-objs}: mini_fo.h fist.h ++ +--- /dev/null ++++ b/fs/mini_fo/meta.c +@@ -0,0 +1,1000 @@ ++/* ++ * Copyright (C) 2004, 2005 Markus Klotzbuecher ++ * ++ * 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 of the License, or (at your option) any later version. ++ */ ++ ++#ifdef HAVE_CONFIG_H ++# include ++#endif /* HAVE_CONFIG_H */ ++#include "fist.h" ++#include "mini_fo.h" ++ ++int meta_build_lists(dentry_t *dentry) ++{ ++ struct mini_fo_inode_info *inode_info; ++ ++ dentry_t *meta_dentry = 0; ++ file_t *meta_file = 0; ++ mm_segment_t old_fs; ++ void *buf; ++ ++ int bytes, len; ++ struct vfsmount *meta_mnt; ++ char *entry; ++ ++ inode_info = itopd(dentry->d_inode); ++ if(!(inode_info->deleted_list_size == -1 && ++ inode_info->renamed_list_size == -1)) { ++ printk(KERN_CRIT "mini_fo: meta_build_lists: \ ++ Error, list(s) not virgin.\n"); ++ return -1; ++ } ++ ++ /* init our meta lists */ ++ INIT_LIST_HEAD(&inode_info->deleted_list); ++ inode_info->deleted_list_size = 0; ++ ++ INIT_LIST_HEAD(&inode_info->renamed_list); ++ inode_info->renamed_list_size = 0; ++ ++ /* might there be a META-file? */ ++ if(dtohd2(dentry) && dtohd2(dentry)->d_inode) { ++ meta_dentry = lookup_one_len(META_FILENAME, ++ dtohd2(dentry), ++ strlen(META_FILENAME)); ++ if(!meta_dentry->d_inode) { ++ dput(meta_dentry); ++ goto out_ok; ++ } ++ /* $%& err, is this correct? */ ++ meta_mnt = stopd(dentry->d_inode->i_sb)->hidden_mnt2; ++ mntget(meta_mnt); ++ ++ ++ /* open META-file for reading */ ++ meta_file = dentry_open(meta_dentry, meta_mnt, 0x0); ++ if(!meta_file || IS_ERR(meta_file)) { ++ printk(KERN_CRIT "mini_fo: meta_build_lists: \ ++ ERROR opening META file.\n"); ++ goto out_err; ++ } ++ ++ /* check if fs supports reading */ ++ if(!meta_file->f_op->read) { ++ printk(KERN_CRIT "mini_fo: meta_build_lists: \ ++ ERROR, fs does not support reading.\n"); ++ goto out_err_close; ++ } ++ ++ /* allocate a page for transfering the data */ ++ buf = (void *) __get_free_page(GFP_KERNEL); ++ if(!buf) { ++ printk(KERN_CRIT "mini_fo: meta_build_lists: \ ++ ERROR, out of mem.\n"); ++ goto out_err_close; ++ } ++ meta_file->f_pos = 0; ++ old_fs = get_fs(); ++ set_fs(KERNEL_DS); ++ do { ++ char *c; ++ bytes = meta_file->f_op->read(meta_file, buf, PAGE_SIZE, &meta_file->f_pos); ++ if(bytes == PAGE_SIZE) { ++ /* trim a cut off filename and adjust f_pos to get it next time */ ++ for(c = (char*) buf+PAGE_SIZE; ++ *c != '\n'; ++ c--, bytes--, meta_file->f_pos--); ++ } ++ entry = (char *) buf; ++ while(entry < (char *) buf+bytes) { ++ ++ char *old_path; ++ char *dir_name; ++ int old_len, new_len; ++ ++ /* len without '\n'*/ ++ len = (int) (strchr(entry, '\n') - entry); ++ switch (*entry) { ++ case 'D': ++ /* format: "D filename" */ ++ meta_list_add_d_entry(dentry, ++ entry+2, ++ len-2); ++ break; ++ case 'R': ++ /* format: "R path/xy/dir newDir" */ ++ old_path = entry+2; ++ dir_name = strchr(old_path, ' ') + 1; ++ old_len = dir_name - old_path - 1; ++ new_len = ((int) entry) + len - ((int ) dir_name); ++ meta_list_add_r_entry(dentry, ++ old_path, ++ old_len, ++ dir_name, ++ new_len); ++ break; ++ default: ++ /* unknown entry type detected */ ++ break; ++ } ++ entry += len+1; ++ } ++ ++ } while(meta_file->f_pos < meta_dentry->d_inode->i_size); ++ ++ free_page((unsigned long) buf); ++ set_fs(old_fs); ++ fput(meta_file); ++ } ++ goto out_ok; ++ ++ out_err_close: ++ fput(meta_file); ++ out_err: ++ mntput(meta_mnt); ++ dput(meta_dentry); ++ return -1; ++ out_ok: ++ return 1; /* check this!!! inode_info->wol_size; */ ++} ++ ++/* cleanups up all lists and free's the mem by dentry */ ++int meta_put_lists(dentry_t *dentry) ++{ ++ if(!dentry || !dentry->d_inode) { ++ printk("mini_fo: meta_put_lists: invalid dentry passed.\n"); ++ return -1; ++ } ++ return __meta_put_lists(dentry->d_inode); ++} ++ ++/* cleanups up all lists and free's the mem by inode */ ++int __meta_put_lists(inode_t *inode) ++{ ++ int err = 0; ++ if(!inode || !itopd(inode)) { ++ printk("mini_fo: __meta_put_lists: invalid inode passed.\n"); ++ return -1; ++ } ++ err = __meta_put_d_list(inode); ++ err |= __meta_put_r_list(inode); ++ return err; ++} ++ ++int meta_sync_lists(dentry_t *dentry) ++{ ++ int err = 0; ++ if(!dentry || !dentry->d_inode) { ++ printk("mini_fo: meta_sync_lists: \ ++ invalid dentry passed.\n"); ++ return -1; ++ } ++ err = meta_sync_d_list(dentry, 0); ++ err |= meta_sync_r_list(dentry, 1); ++ return err; ++} ++ ++ ++/* remove all D entries from the renamed list and free the mem */ ++int __meta_put_d_list(inode_t *inode) ++{ ++ struct list_head *tmp; ++ struct deleted_entry *del_entry; ++ struct mini_fo_inode_info *inode_info; ++ ++ if(!inode || !itopd(inode)) { ++ printk(KERN_CRIT "mini_fo: __meta_put_d_list: \ ++ invalid inode passed.\n"); ++ return -1; ++ } ++ inode_info = itopd(inode); ++ ++ /* nuke the DELETED-list */ ++ if(inode_info->deleted_list_size <= 0) ++ return 0; ++ ++ while(!list_empty(&inode_info->deleted_list)) { ++ tmp = inode_info->deleted_list.next; ++ list_del(tmp); ++ del_entry = list_entry(tmp, struct deleted_entry, list); ++ kfree(del_entry->name); ++ kfree(del_entry); ++ } ++ inode_info->deleted_list_size = 0; ++ ++ return 0; ++} ++ ++/* remove all R entries from the renamed list and free the mem */ ++int __meta_put_r_list(inode_t *inode) ++{ ++ struct list_head *tmp; ++ struct renamed_entry *ren_entry; ++ struct mini_fo_inode_info *inode_info; ++ ++ if(!inode || !itopd(inode)) { ++ printk(KERN_CRIT "mini_fo: meta_put_r_list: invalid inode.\n"); ++ return -1; ++ } ++ inode_info = itopd(inode); ++ ++ /* nuke the RENAMED-list */ ++ if(inode_info->renamed_list_size <= 0) ++ return 0; ++ ++ while(!list_empty(&inode_info->renamed_list)) { ++ tmp = inode_info->renamed_list.next; ++ list_del(tmp); ++ ren_entry = list_entry(tmp, struct renamed_entry, list); ++ kfree(ren_entry->new_name); ++ kfree(ren_entry->old_name); ++ kfree(ren_entry); ++ } ++ inode_info->renamed_list_size = 0; ++ ++ return 0; ++} ++ ++int meta_add_d_entry(dentry_t *dentry, const char *name, int len) ++{ ++ int err = 0; ++ err = meta_list_add_d_entry(dentry, name, len); ++ err |= meta_write_d_entry(dentry,name,len); ++ return err; ++} ++ ++/* add a D entry to the deleted list */ ++int meta_list_add_d_entry(dentry_t *dentry, const char *name, int len) ++{ ++ struct deleted_entry *del_entry; ++ struct mini_fo_inode_info *inode_info; ++ ++ if(!dentry || !dentry->d_inode) { ++ printk(KERN_CRIT "mini_fo: meta_list_add_d_entry: \ ++ invalid dentry passed.\n"); ++ return -1; ++ } ++ inode_info = itopd(dentry->d_inode); ++ ++ if(inode_info->deleted_list_size < 0) ++ return -1; ++ ++ del_entry = (struct deleted_entry *) ++ kmalloc(sizeof(struct deleted_entry), GFP_KERNEL); ++ del_entry->name = (char*) kmalloc(len, GFP_KERNEL); ++ if(!del_entry || !del_entry->name) { ++ printk(KERN_CRIT "mini_fo: meta_list_add_d_entry: \ ++ out of mem.\n"); ++ kfree(del_entry->name); ++ kfree(del_entry); ++ return -ENOMEM; ++ } ++ ++ strncpy(del_entry->name, name, len); ++ del_entry->len = len; ++ ++ list_add(&del_entry->list, &inode_info->deleted_list); ++ inode_info->deleted_list_size++; ++ return 0; ++} ++ ++int meta_add_r_entry(dentry_t *dentry, ++ const char *old_name, int old_len, ++ const char *new_name, int new_len) ++{ ++ int err = 0; ++ err = meta_list_add_r_entry(dentry, ++ old_name, old_len, ++ new_name, new_len); ++ err |= meta_write_r_entry(dentry, ++ old_name, old_len, ++ new_name, new_len); ++ return err; ++} ++ ++/* add a R entry to the renamed list */ ++int meta_list_add_r_entry(dentry_t *dentry, ++ const char *old_name, int old_len, ++ const char *new_name, int new_len) ++{ ++ struct renamed_entry *ren_entry; ++ struct mini_fo_inode_info *inode_info; ++ ++ if(!dentry || !dentry->d_inode) { ++ printk(KERN_CRIT "mini_fo: meta_list_add_r_entry: \ ++ invalid dentry passed.\n"); ++ return -1; ++ } ++ inode_info = itopd(dentry->d_inode); ++ ++ if(inode_info->renamed_list_size < 0) ++ return -1; ++ ++ ren_entry = (struct renamed_entry *) ++ kmalloc(sizeof(struct renamed_entry), GFP_KERNEL); ++ ren_entry->old_name = (char*) kmalloc(old_len, GFP_KERNEL); ++ ren_entry->new_name = (char*) kmalloc(new_len, GFP_KERNEL); ++ ++ if(!ren_entry || !ren_entry->old_name || !ren_entry->new_name) { ++ printk(KERN_CRIT "mini_fo: meta_list_add_r_entry: \ ++ out of mem.\n"); ++ kfree(ren_entry->new_name); ++ kfree(ren_entry->old_name); ++ kfree(ren_entry); ++ return -ENOMEM; ++ } ++ ++ strncpy(ren_entry->old_name, old_name, old_len); ++ ren_entry->old_len = old_len; ++ strncpy(ren_entry->new_name, new_name, new_len); ++ ren_entry->new_len = new_len; ++ ++ list_add(&ren_entry->list, &inode_info->renamed_list); ++ inode_info->renamed_list_size++; ++ return 0; ++} ++ ++ ++int meta_remove_r_entry(dentry_t *dentry, const char *name, int len) ++{ ++ int err = 0; ++ if(!dentry || !dentry->d_inode) { ++ printk(KERN_CRIT ++ "mini_fo: meta_remove_r_entry: \ ++ invalid dentry passed.\n"); ++ return -1; ++ } ++ ++ err = meta_list_remove_r_entry(dentry, name, len); ++ err |= meta_sync_lists(dentry); ++ return err; ++} ++ ++int meta_list_remove_r_entry(dentry_t *dentry, const char *name, int len) ++{ ++ if(!dentry || !dentry->d_inode) { ++ printk(KERN_CRIT ++ "mini_fo: meta_list_remove_r_entry: \ ++ invalid dentry passed.\n"); ++ return -1; ++ } ++ return __meta_list_remove_r_entry(dentry->d_inode, name, len); ++} ++ ++int __meta_list_remove_r_entry(inode_t *inode, const char *name, int len) ++{ ++ struct list_head *tmp; ++ struct renamed_entry *ren_entry; ++ struct mini_fo_inode_info *inode_info; ++ ++ if(!inode || !itopd(inode)) ++ printk(KERN_CRIT ++ "mini_fo: __meta_list_remove_r_entry: \ ++ invalid inode passed.\n"); ++ inode_info = itopd(inode); ++ ++ if(inode_info->renamed_list_size < 0) ++ return -1; ++ if(inode_info->renamed_list_size == 0) ++ return 1; ++ ++ list_for_each(tmp, &inode_info->renamed_list) { ++ ren_entry = list_entry(tmp, struct renamed_entry, list); ++ if(ren_entry->new_len != len) ++ continue; ++ ++ if(!strncmp(ren_entry->new_name, name, len)) { ++ list_del(tmp); ++ kfree(ren_entry->new_name); ++ kfree(ren_entry->old_name); ++ kfree(ren_entry); ++ inode_info->renamed_list_size--; ++ return 0; ++ } ++ } ++ return 1; ++} ++ ++ ++/* append a single D entry to the meta file */ ++int meta_write_d_entry(dentry_t *dentry, const char *name, int len) ++{ ++ dentry_t *meta_dentry = 0; ++ file_t *meta_file = 0; ++ mm_segment_t old_fs; ++ ++ int bytes, err; ++ struct vfsmount *meta_mnt = 0; ++ char *buf; ++ ++ err = 0; ++ ++ if(itopd(dentry->d_inode)->deleted_list_size < 0) { ++ err = -1; ++ goto out; ++ } ++ ++ if(dtopd(dentry)->state == UNMODIFIED) { ++ err = build_sto_structure(dentry->d_parent, dentry); ++ if(err) { ++ printk(KERN_CRIT "mini_fo: meta_write_d_entry: \ ++ build_sto_structure failed.\n"); ++ goto out; ++ } ++ } ++ meta_dentry = lookup_one_len(META_FILENAME, ++ dtohd2(dentry), strlen (META_FILENAME)); ++ ++ /* We need to create a META-file */ ++ if(!meta_dentry->d_inode) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++ vfs_create(dtohd2(dentry)->d_inode, ++ meta_dentry, ++ S_IRUSR | S_IWUSR, ++ NULL); ++#else ++ vfs_create(dtohd2(dentry)->d_inode, ++ meta_dentry, ++ S_IRUSR | S_IWUSR); ++#endif ++ } ++ /* open META-file for writing */ ++ meta_file = dentry_open(meta_dentry, meta_mnt, 0x1); ++ if(!meta_file || IS_ERR(meta_file)) { ++ printk(KERN_CRIT "mini_fo: meta_write_d_entry: \ ++ ERROR opening meta file.\n"); ++ mntput(meta_mnt); /* $%& is this necessary? */ ++ dput(meta_dentry); ++ err = -1; ++ goto out; ++ } ++ ++ /* check if fs supports writing */ ++ if(!meta_file->f_op->write) { ++ printk(KERN_CRIT "mini_fo: meta_write_d_entry: \ ++ ERROR, fs does not support writing.\n"); ++ goto out_err_close; ++ } ++ ++ meta_file->f_pos = meta_dentry->d_inode->i_size; /* append */ ++ old_fs = get_fs(); ++ set_fs(KERNEL_DS); ++ ++ /* size: len for name, 1 for \n and 2 for "D " */ ++ buf = (char *) kmalloc(len+3, GFP_KERNEL); ++ if (!buf) { ++ printk(KERN_CRIT "mini_fo: meta_write_d_entry: \ ++ out of mem.\n"); ++ return -ENOMEM; ++ } ++ ++ buf[0] = 'D'; ++ buf[1] = ' '; ++ strncpy(buf+2, name, len); ++ buf[len+2] = '\n'; ++ bytes = meta_file->f_op->write(meta_file, buf, len+3, ++ &meta_file->f_pos); ++ if(bytes != len+3) { ++ printk(KERN_CRIT "mini_fo: meta_write_d_entry: \ ++ ERROR writing.\n"); ++ err = -1; ++ } ++ kfree(buf); ++ set_fs(old_fs); ++ ++ out_err_close: ++ fput(meta_file); ++ out: ++ return err; ++} ++ ++/* append a single R entry to the meta file */ ++int meta_write_r_entry(dentry_t *dentry, ++ const char *old_name, int old_len, ++ const char *new_name, int new_len) ++{ ++ dentry_t *meta_dentry = 0; ++ file_t *meta_file = 0; ++ mm_segment_t old_fs; ++ ++ int bytes, err, buf_len; ++ struct vfsmount *meta_mnt = 0; ++ char *buf; ++ ++ ++ err = 0; ++ ++ if(itopd(dentry->d_inode)->renamed_list_size < 0) { ++ err = -1; ++ goto out; ++ } ++ ++ /* build the storage structure? */ ++ if(dtopd(dentry)->state == UNMODIFIED) { ++ err = build_sto_structure(dentry->d_parent, dentry); ++ if(err) { ++ printk(KERN_CRIT "mini_fo: meta_write_r_entry: \ ++ build_sto_structure failed.\n"); ++ goto out; ++ } ++ } ++ meta_dentry = lookup_one_len(META_FILENAME, ++ dtohd2(dentry), ++ strlen (META_FILENAME)); ++ if(!meta_dentry->d_inode) { ++ /* We need to create a META-file */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++ vfs_create(dtohd2(dentry)->d_inode, ++ meta_dentry, S_IRUSR | S_IWUSR, NULL); ++#else ++ vfs_create(dtohd2(dentry)->d_inode, ++ meta_dentry, S_IRUSR | S_IWUSR); ++#endif ++ } ++ /* open META-file for writing */ ++ meta_file = dentry_open(meta_dentry, meta_mnt, 0x1); ++ if(!meta_file || IS_ERR(meta_file)) { ++ printk(KERN_CRIT "mini_fo: meta_write_r_entry: \ ++ ERROR opening meta file.\n"); ++ mntput(meta_mnt); ++ dput(meta_dentry); ++ err = -1; ++ goto out; ++ } ++ ++ /* check if fs supports writing */ ++ if(!meta_file->f_op->write) { ++ printk(KERN_CRIT "mini_fo: meta_write_r_entry: \ ++ ERROR, fs does not support writing.\n"); ++ goto out_err_close; ++ } ++ ++ meta_file->f_pos = meta_dentry->d_inode->i_size; /* append */ ++ old_fs = get_fs(); ++ set_fs(KERNEL_DS); ++ ++ /* size: 2 for "R ", old_len+new_len for names, 1 blank+1 \n */ ++ buf_len = old_len + new_len + 4; ++ buf = (char *) kmalloc(buf_len, GFP_KERNEL); ++ if (!buf) { ++ printk(KERN_CRIT "mini_fo: meta_write_r_entry: out of mem.\n"); ++ return -ENOMEM; ++ } ++ ++ buf[0] = 'R'; ++ buf[1] = ' '; ++ strncpy(buf + 2, old_name, old_len); ++ buf[old_len + 2] = ' '; ++ strncpy(buf + old_len + 3, new_name, new_len); ++ buf[buf_len -1] = '\n'; ++ bytes = meta_file->f_op->write(meta_file, buf, buf_len, &meta_file->f_pos); ++ if(bytes != buf_len) { ++ printk(KERN_CRIT "mini_fo: meta_write_r_entry: ERROR writing.\n"); ++ err = -1; ++ } ++ ++ kfree(buf); ++ set_fs(old_fs); ++ ++ out_err_close: ++ fput(meta_file); ++ out: ++ return err; ++} ++ ++/* sync D list to disk, append data if app_flag is 1 */ ++/* check the meta_mnt, which seems not to be used (properly) */ ++ ++int meta_sync_d_list(dentry_t *dentry, int app_flag) ++{ ++ dentry_t *meta_dentry; ++ file_t *meta_file; ++ mm_segment_t old_fs; ++ ++ int bytes, err; ++ struct vfsmount *meta_mnt; ++ char *buf; ++ ++ struct list_head *tmp; ++ struct deleted_entry *del_entry; ++ struct mini_fo_inode_info *inode_info; ++ ++ err = 0; ++ meta_file=0; ++ meta_mnt=0; ++ ++ if(!dentry || !dentry->d_inode) { ++ printk(KERN_CRIT "mini_fo: meta_sync_d_list: \ ++ invalid inode passed.\n"); ++ err = -1; ++ goto out; ++ } ++ inode_info = itopd(dentry->d_inode); ++ ++ if(inode_info->deleted_list_size < 0) { ++ err = -1; ++ goto out; ++ } ++ ++ /* ok, there is something to sync */ ++ ++ /* build the storage structure? */ ++ if(!dtohd2(dentry) && !itohi2(dentry->d_inode)) { ++ err = build_sto_structure(dentry->d_parent, dentry); ++ if(err) { ++ printk(KERN_CRIT "mini_fo: meta_sync_d_list: \ ++ build_sto_structure failed.\n"); ++ goto out; ++ } ++ } ++ meta_dentry = lookup_one_len(META_FILENAME, ++ dtohd2(dentry), ++ strlen(META_FILENAME)); ++ if(!meta_dentry->d_inode) { ++ /* We need to create a META-file */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++ vfs_create(dtohd2(dentry)->d_inode, ++ meta_dentry, S_IRUSR | S_IWUSR, NULL); ++#else ++ vfs_create(dtohd2(dentry)->d_inode, ++ meta_dentry, S_IRUSR | S_IWUSR); ++#endif ++ app_flag = 0; ++ } ++ /* need we truncate the meta file? */ ++ if(!app_flag) { ++ struct iattr newattrs; ++ newattrs.ia_size = 0; ++ newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&meta_dentry->d_inode->i_mutex); ++#else ++ down(&meta_dentry->d_inode->i_sem); ++#endif ++ err = notify_change(meta_dentry, &newattrs); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&meta_dentry->d_inode->i_mutex); ++#else ++ up(&meta_dentry->d_inode->i_sem); ++#endif ++ ++ if(err || meta_dentry->d_inode->i_size != 0) { ++ printk(KERN_CRIT "mini_fo: meta_sync_d_list: \ ++ ERROR truncating meta file.\n"); ++ goto out_err_close; ++ } ++ } ++ ++ /* open META-file for writing */ ++ meta_file = dentry_open(meta_dentry, meta_mnt, 0x1); ++ if(!meta_file || IS_ERR(meta_file)) { ++ printk(KERN_CRIT "mini_fo: meta_sync_d_list: \ ++ ERROR opening meta file.\n"); ++ /* we don't mntget so we dont't mntput (for now) ++ * mntput(meta_mnt); ++ */ ++ dput(meta_dentry); ++ err = -1; ++ goto out; ++ } ++ ++ /* check if fs supports writing */ ++ if(!meta_file->f_op->write) { ++ printk(KERN_CRIT "mini_fo: meta_sync_d_list: \ ++ ERROR, fs does not support writing.\n"); ++ goto out_err_close; ++ } ++ ++ meta_file->f_pos = meta_dentry->d_inode->i_size; /* append */ ++ old_fs = get_fs(); ++ set_fs(KERNEL_DS); ++ ++ /* here we go... */ ++ list_for_each(tmp, &inode_info->deleted_list) { ++ del_entry = list_entry(tmp, struct deleted_entry, list); ++ ++ /* size: len for name, 1 for \n and 2 for "D " */ ++ buf = (char *) kmalloc(del_entry->len+3, GFP_KERNEL); ++ if (!buf) { ++ printk(KERN_CRIT "mini_fo: meta_sync_d_list: \ ++ out of mem.\n"); ++ return -ENOMEM; ++ } ++ ++ buf[0] = 'D'; ++ buf[1] = ' '; ++ strncpy(buf+2, del_entry->name, del_entry->len); ++ buf[del_entry->len+2] = '\n'; ++ bytes = meta_file->f_op->write(meta_file, buf, ++ del_entry->len+3, ++ &meta_file->f_pos); ++ if(bytes != del_entry->len+3) { ++ printk(KERN_CRIT "mini_fo: meta_sync_d_list: \ ++ ERROR writing.\n"); ++ err |= -1; ++ } ++ kfree(buf); ++ } ++ set_fs(old_fs); ++ ++ out_err_close: ++ fput(meta_file); ++ out: ++ return err; ++ ++} ++ ++int meta_sync_r_list(dentry_t *dentry, int app_flag) ++{ ++ dentry_t *meta_dentry; ++ file_t *meta_file; ++ mm_segment_t old_fs; ++ ++ int bytes, err, buf_len; ++ struct vfsmount *meta_mnt; ++ char *buf; ++ ++ struct list_head *tmp; ++ struct renamed_entry *ren_entry; ++ struct mini_fo_inode_info *inode_info; ++ ++ err = 0; ++ meta_file=0; ++ meta_mnt=0; ++ ++ if(!dentry || !dentry->d_inode) { ++ printk(KERN_CRIT "mini_fo: meta_sync_r_list: \ ++ invalid dentry passed.\n"); ++ err = -1; ++ goto out; ++ } ++ inode_info = itopd(dentry->d_inode); ++ ++ if(inode_info->deleted_list_size < 0) { ++ err = -1; ++ goto out; ++ } ++ ++ /* ok, there is something to sync */ ++ ++ /* build the storage structure? */ ++ if(!dtohd2(dentry) && !itohi2(dentry->d_inode)) { ++ err = build_sto_structure(dentry->d_parent, dentry); ++ if(err) { ++ printk(KERN_CRIT "mini_fo: meta_sync_r_list: \ ++ build_sto_structure failed.\n"); ++ goto out; ++ } ++ } ++ meta_dentry = lookup_one_len(META_FILENAME, ++ dtohd2(dentry), ++ strlen(META_FILENAME)); ++ if(!meta_dentry->d_inode) { ++ /* We need to create a META-file */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++ vfs_create(dtohd2(dentry)->d_inode, ++ meta_dentry, S_IRUSR | S_IWUSR, NULL); ++#else ++ vfs_create(dtohd2(dentry)->d_inode, ++ meta_dentry, S_IRUSR | S_IWUSR); ++#endif ++ app_flag = 0; ++ } ++ /* need we truncate the meta file? */ ++ if(!app_flag) { ++ struct iattr newattrs; ++ newattrs.ia_size = 0; ++ newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&meta_dentry->d_inode->i_mutex); ++#else ++ down(&meta_dentry->d_inode->i_sem); ++#endif ++ err = notify_change(meta_dentry, &newattrs); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&meta_dentry->d_inode->i_mutex); ++#else ++ up(&meta_dentry->d_inode->i_sem); ++#endif ++ if(err || meta_dentry->d_inode->i_size != 0) { ++ printk(KERN_CRIT "mini_fo: meta_sync_r_list: \ ++ ERROR truncating meta file.\n"); ++ goto out_err_close; ++ } ++ } ++ ++ /* open META-file for writing */ ++ meta_file = dentry_open(meta_dentry, meta_mnt, 0x1); ++ if(!meta_file || IS_ERR(meta_file)) { ++ printk(KERN_CRIT "mini_fo: meta_sync_r_list: \ ++ ERROR opening meta file.\n"); ++ /* we don't mntget so we dont't mntput (for now) ++ * mntput(meta_mnt); ++ */ ++ dput(meta_dentry); ++ err = -1; ++ goto out; ++ } ++ ++ /* check if fs supports writing */ ++ if(!meta_file->f_op->write) { ++ printk(KERN_CRIT "mini_fo: meta_sync_r_list: \ ++ ERROR, fs does not support writing.\n"); ++ goto out_err_close; ++ } ++ ++ meta_file->f_pos = meta_dentry->d_inode->i_size; /* append */ ++ old_fs = get_fs(); ++ set_fs(KERNEL_DS); ++ ++ /* here we go... */ ++ list_for_each(tmp, &inode_info->renamed_list) { ++ ren_entry = list_entry(tmp, struct renamed_entry, list); ++ /* size: ++ * 2 for "R ", old_len+new_len for names, 1 blank+1 \n */ ++ buf_len = ren_entry->old_len + ren_entry->new_len + 4; ++ buf = (char *) kmalloc(buf_len, GFP_KERNEL); ++ if (!buf) { ++ printk(KERN_CRIT "mini_fo: meta_sync_r_list: \ ++ out of mem.\n"); ++ return -ENOMEM; ++ } ++ buf[0] = 'R'; ++ buf[1] = ' '; ++ strncpy(buf + 2, ren_entry->old_name, ren_entry->old_len); ++ buf[ren_entry->old_len + 2] = ' '; ++ strncpy(buf + ren_entry->old_len + 3, ++ ren_entry->new_name, ren_entry->new_len); ++ buf[buf_len - 1] = '\n'; ++ bytes = meta_file->f_op->write(meta_file, buf, ++ buf_len, &meta_file->f_pos); ++ if(bytes != buf_len) { ++ printk(KERN_CRIT "mini_fo: meta_sync_r_list: \ ++ ERROR writing.\n"); ++ err |= -1; ++ } ++ kfree(buf); ++ } ++ set_fs(old_fs); ++ ++ out_err_close: ++ fput(meta_file); ++ out: ++ return err; ++} ++ ++int meta_check_d_entry(dentry_t *dentry, const char *name, int len) ++{ ++ if(!dentry || !dentry->d_inode) ++ printk(KERN_CRIT "mini_fo: meta_check_d_dentry: \ ++ invalid dentry passed.\n"); ++ return __meta_check_d_entry(dentry->d_inode, name, len); ++} ++ ++int __meta_check_d_entry(inode_t *inode, const char *name, int len) ++{ ++ struct list_head *tmp; ++ struct deleted_entry *del_entry; ++ struct mini_fo_inode_info *inode_info; ++ ++ if(!inode || !itopd(inode)) ++ printk(KERN_CRIT "mini_fo: __meta_check_d_dentry: \ ++ invalid inode passed.\n"); ++ ++ inode_info = itopd(inode); ++ ++ if(inode_info->deleted_list_size <= 0) ++ return 0; ++ ++ list_for_each(tmp, &inode_info->deleted_list) { ++ del_entry = list_entry(tmp, struct deleted_entry, list); ++ if(del_entry->len != len) ++ continue; ++ ++ if(!strncmp(del_entry->name, name, len)) ++ return 1; ++ } ++ return 0; ++} ++ ++/* ++ * check if file has been renamed and return path to orig. base dir. ++ * Implements no error return values so far, what of course sucks. ++ * String is null terminated.' ++ */ ++char* meta_check_r_entry(dentry_t *dentry, const char *name, int len) ++{ ++ if(!dentry || !dentry->d_inode) { ++ printk(KERN_CRIT "mini_fo: meta_check_r_dentry: \ ++ invalid dentry passed.\n"); ++ return NULL; ++ } ++ return __meta_check_r_entry(dentry->d_inode, name, len); ++} ++ ++char* __meta_check_r_entry(inode_t *inode, const char *name, int len) ++{ ++ struct list_head *tmp; ++ struct renamed_entry *ren_entry; ++ struct mini_fo_inode_info *inode_info; ++ char *old_path; ++ ++ if(!inode || !itopd(inode)) { ++ printk(KERN_CRIT "mini_fo: meta_check_r_dentry: \ ++ invalid inode passed.\n"); ++ return NULL; ++ } ++ inode_info = itopd(inode); ++ ++ if(inode_info->renamed_list_size <= 0) ++ return NULL; ++ ++ list_for_each(tmp, &inode_info->renamed_list) { ++ ren_entry = list_entry(tmp, struct renamed_entry, list); ++ if(ren_entry->new_len != len) ++ continue; ++ ++ if(!strncmp(ren_entry->new_name, name, len)) { ++ old_path = (char *) ++ kmalloc(ren_entry->old_len+1, GFP_KERNEL); ++ strncpy(old_path, ++ ren_entry->old_name, ++ ren_entry->old_len); ++ old_path[ren_entry->old_len]='\0'; ++ return old_path; ++ } ++ } ++ return NULL; ++} ++ ++/* ++ * This version only checks if entry exists and return: ++ * 1 if exists, ++ * 0 if not, ++ * -1 if error. ++ */ ++int meta_is_r_entry(dentry_t *dentry, const char *name, int len) ++{ ++ if(!dentry || !dentry->d_inode) { ++ printk(KERN_CRIT "mini_fo: meta_check_r_dentry [2]: \ ++ invalid dentry passed.\n"); ++ return -1; ++ } ++ return __meta_is_r_entry(dentry->d_inode, name, len); ++} ++ ++int __meta_is_r_entry(inode_t *inode, const char *name, int len) ++{ ++ struct list_head *tmp; ++ struct renamed_entry *ren_entry; ++ struct mini_fo_inode_info *inode_info; ++ ++ if(!inode || !itopd(inode)) { ++ printk(KERN_CRIT "mini_fo: meta_check_r_dentry [2]: \ ++ invalid inode passed.\n"); ++ return -1; ++ } ++ inode_info = itopd(inode); ++ ++ if(inode_info->renamed_list_size <= 0) ++ return -1; ++ ++ list_for_each(tmp, &inode_info->renamed_list) { ++ ren_entry = list_entry(tmp, struct renamed_entry, list); ++ if(ren_entry->new_len != len) ++ continue; ++ ++ if(!strncmp(ren_entry->new_name, name, len)) ++ return 1; ++ } ++ return 0; ++} ++ +--- /dev/null ++++ b/fs/mini_fo/mini_fo.h +@@ -0,0 +1,510 @@ ++/* ++ * Copyright (c) 1997-2003 Erez Zadok ++ * Copyright (c) 2001-2003 Stony Brook University ++ * ++ * For specific licensing information, see the COPYING file distributed with ++ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING. ++ * ++ * This Copyright notice must be kept intact and distributed with all ++ * fistgen sources INCLUDING sources generated by fistgen. ++ */ ++/* ++ * Copyright (C) 2004, 2005 Markus Klotzbuecher ++ * ++ * 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 of the License, or (at your option) any later version. ++ */ ++ ++/* ++ * $Id$ ++ */ ++ ++#ifndef __MINI_FO_H_ ++#define __MINI_FO_H_ ++ ++#ifdef __KERNEL__ ++ ++/* META stuff */ ++#define META_FILENAME "META_dAfFgHE39ktF3HD2sr" ++ ++/* use xattrs? */ ++#define XATTR ++ ++/* File attributes that when changed, result in a file beeing copied to storage */ ++#define COPY_FLAGS ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_SIZE ++ ++/* ++ * mini_fo filestates ++ */ ++#define MODIFIED 1 ++#define UNMODIFIED 2 ++#define CREATED 3 ++#define DEL_REWRITTEN 4 ++#define DELETED 5 ++#define NON_EXISTANT 6 ++ ++/* fist file systems superblock magic */ ++# define MINI_FO_SUPER_MAGIC 0xf15f ++ ++/* ++ * STRUCTURES: ++ */ ++ ++/* mini_fo inode data in memory */ ++struct mini_fo_inode_info { ++ inode_t *wii_inode; ++ inode_t *wii_inode2; /* pointer to storage inode */ ++ ++ /* META-data lists */ ++ /* deleted list, ex wol */ ++ struct list_head deleted_list; ++ int deleted_list_size; ++ ++ /* renamed list */ ++ struct list_head renamed_list; ++ int renamed_list_size; ++ ++ /* add other lists here ... */ ++}; ++ ++/* mini_fo dentry data in memory */ ++struct mini_fo_dentry_info { ++ dentry_t *wdi_dentry; ++ dentry_t *wdi_dentry2; /* pointer to storage dentry */ ++ unsigned int state; /* state of the mini_fo dentry */ ++}; ++ ++ ++/* mini_fo super-block data in memory */ ++struct mini_fo_sb_info { ++ super_block_t *wsi_sb, *wsi_sb2; /* mk: might point to the same sb */ ++ struct vfsmount *hidden_mnt, *hidden_mnt2; ++ dentry_t *base_dir_dentry; ++ dentry_t *storage_dir_dentry; ++ ; ++}; ++ ++/* readdir_data, readdir helper struct */ ++struct readdir_data { ++ struct list_head ndl_list; /* linked list head ptr */ ++ int ndl_size; /* list size */ ++ int sto_done; /* flag to show that the storage dir entries have ++ * all been read an now follow base entries */ ++}; ++ ++/* file private data. */ ++struct mini_fo_file_info { ++ struct file *wfi_file; ++ struct file *wfi_file2; /* pointer to storage file */ ++ struct readdir_data rd; ++}; ++ ++/* struct ndl_entry */ ++struct ndl_entry { ++ struct list_head list; ++ char *name; ++ int len; ++}; ++ ++/******************************** ++ * META-data structures ++ ********************************/ ++ ++/* deleted entry */ ++struct deleted_entry { ++ struct list_head list; ++ char *name; ++ int len; ++}; ++ ++/* renamed entry */ ++struct renamed_entry { ++ struct list_head list; ++ char *old_name; /* old directory with full path */ ++ int old_len; /* length of above string */ ++ char *new_name; /* new directory name */ ++ int new_len; /* length of above string */ ++}; ++ ++/* attr_change entry */ ++struct attr_change_entry { ++ struct list_head list; ++ char *name; ++ int len; ++}; ++ ++/* link entry */ ++struct link_entry { ++ struct list_head list; ++ int links_moved; ++ int inum_base; ++ int inum_sto; ++ char *weird_name; ++ int weird_name_len; ++}; ++ ++ ++/* Some other stuff required for mini_fo_filldir64, copied from ++ * fs/readdir.c ++ */ ++ ++#define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1)) ++#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de))) ++ ++ ++struct linux_dirent64 { ++ u64 d_ino; ++ s64 d_off; ++ unsigned short d_reclen; ++ unsigned char d_type; ++ char d_name[0]; ++}; ++ ++ ++struct getdents_callback64 { ++ struct linux_dirent64 * current_dir; ++ struct linux_dirent64 * previous; ++ int count; ++ int error; ++}; ++ ++struct linux_dirent { ++ unsigned long d_ino; ++ unsigned long d_off; ++ unsigned short d_reclen; ++ char d_name[1]; ++}; ++ ++struct getdents_callback { ++ struct linux_dirent * current_dir; ++ struct linux_dirent * previous; ++ int count; ++ int error; ++}; ++ ++ ++/* ++ * MACROS: ++ */ ++ ++/* file TO private_data */ ++# define ftopd(file) ((struct mini_fo_file_info *)((file)->private_data)) ++# define __ftopd(file) ((file)->private_data) ++/* file TO hidden_file */ ++# define ftohf(file) ((ftopd(file))->wfi_file) ++# define ftohf2(file) ((ftopd(file))->wfi_file2) ++ ++/* inode TO private_data */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) ++# define itopd(ino) ((struct mini_fo_inode_info *)(ino)->i_private) ++# define __itopd(ino) ((ino)->i_private) ++#else ++# define itopd(ino) ((struct mini_fo_inode_info *)(ino)->u.generic_ip) ++# define __itopd(ino) ((ino)->u.generic_ip) ++#endif ++/* inode TO hidden_inode */ ++# define itohi(ino) (itopd(ino)->wii_inode) ++# define itohi2(ino) (itopd(ino)->wii_inode2) ++ ++/* superblock TO private_data */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++# define stopd(super) ((struct mini_fo_sb_info *)(super)->s_fs_info) ++# define __stopd(super) ((super)->s_fs_info) ++#else ++# define stopd(super) ((struct mini_fo_sb_info *)(super)->u.generic_sbp) ++# define __stopd(super) ((super)->u.generic_sbp) ++#endif ++ ++/* unused? # define vfs2priv stopd */ ++/* superblock TO hidden_superblock */ ++ ++# define stohs(super) (stopd(super)->wsi_sb) ++# define stohs2(super) (stopd(super)->wsi_sb2) ++ ++/* dentry TO private_data */ ++# define dtopd(dentry) ((struct mini_fo_dentry_info *)(dentry)->d_fsdata) ++# define __dtopd(dentry) ((dentry)->d_fsdata) ++/* dentry TO hidden_dentry */ ++# define dtohd(dent) (dtopd(dent)->wdi_dentry) ++# define dtohd2(dent) (dtopd(dent)->wdi_dentry2) ++ ++/* dentry to state */ ++# define dtost(dent) (dtopd(dent)->state) ++# define sbt(sb) ((sb)->s_type->name) ++ ++#define IS_WRITE_FLAG(flag) (flag & (O_RDWR | O_WRONLY | O_APPEND)) ++#define IS_COPY_FLAG(flag) (flag & (COPY_FLAGS)) ++ ++/* macros to simplify non-SCA code */ ++# define MALLOC_PAGE_POINTERS(hidden_pages, num_hidden_pages) ++# define MALLOC_PAGEDATA_POINTERS(hidden_pages_data, num_hidden_pages) ++# define FREE_PAGE_POINTERS(hidden_pages, num) ++# define FREE_PAGEDATA_POINTERS(hidden_pages_data, num) ++# define FOR_EACH_PAGE ++# define CURRENT_HIDDEN_PAGE hidden_page ++# define CURRENT_HIDDEN_PAGEDATA hidden_page_data ++# define CURRENT_HIDDEN_PAGEINDEX page->index ++ ++/* ++ * EXTERNALS: ++ */ ++extern struct file_operations mini_fo_main_fops; ++extern struct file_operations mini_fo_dir_fops; ++extern struct inode_operations mini_fo_main_iops; ++extern struct inode_operations mini_fo_dir_iops; ++extern struct inode_operations mini_fo_symlink_iops; ++extern struct super_operations mini_fo_sops; ++extern struct dentry_operations mini_fo_dops; ++extern struct vm_operations_struct mini_fo_shared_vmops; ++extern struct vm_operations_struct mini_fo_private_vmops; ++extern struct address_space_operations mini_fo_aops; ++ ++#if 0 /* unused by mini_fo */ ++extern int mini_fo_interpose(dentry_t *hidden_dentry, dentry_t *this_dentry, super_block_t *sb, int flag); ++#if defined(FIST_FILTER_DATA) || defined(FIST_FILTER_SCA) ++extern page_t *mini_fo_get1page(file_t *file, int index); ++extern int mini_fo_fill_zeros(file_t *file, page_t *page, unsigned from); ++# endif /* FIST_FILTER_DATA || FIST_FILTER_SCA */ ++ ++ ++# define mini_fo_hidden_dentry(d) __mini_fo_hidden_dentry(__FILE__,__FUNCTION__,__LINE__,(d)) ++# define mini_fo_hidden_sto_dentry(d) __mini_fo_hidden_sto_dentry(__FILE__,__FUNCTION__,__LINE__,(d)) ++ ++extern dentry_t *__mini_fo_hidden_dentry(char *file, char *func, int line, dentry_t *this_dentry); ++extern dentry_t *__mini_fo_hidden_sto_dentry(char *file, char *func, int line, dentry_t *this_dentry); ++ ++extern int mini_fo_read_file(const char *filename, void *buf, int len); ++extern int mini_fo_write_file(const char *filename, void *buf, int len); ++extern dentry_t *fist_lookup(dentry_t *dir, const char *name, vnode_t **out, uid_t uid, gid_t gid); ++#endif /* unused by mini_fo */ ++ ++/* state transition functions */ ++extern int nondir_unmod_to_mod(dentry_t *dentry, int cp_flag); ++extern int nondir_del_rew_to_del(dentry_t *dentry); ++extern int nondir_creat_to_del(dentry_t *dentry); ++extern int nondir_mod_to_del(dentry_t *dentry); ++extern int nondir_unmod_to_del(dentry_t *dentry); ++ ++extern int dir_unmod_to_mod(dentry_t *dentry); ++ ++/* rename specials */ ++extern int rename_directory(inode_t *old_dir, dentry_t *old_dentry, inode_t *new_dir, dentry_t *new_dentry); ++extern int rename_nondir(inode_t *old_dir, dentry_t *old_dentry, inode_t *new_dir, dentry_t *new_dentry); ++ ++/* misc stuff */ ++extern int mini_fo_tri_interpose(dentry_t *hidden_dentry, ++ dentry_t *hidden_sto_dentry, ++ dentry_t *dentry, ++ super_block_t *sb, int flag); ++ ++extern int mini_fo_cp_cont(dentry_t *tgt_dentry, struct vfsmount *tgt_mnt, ++ dentry_t *src_dentry, struct vfsmount *src_mnt); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++extern int mini_fo_create(inode_t *dir, dentry_t *dentry, int mode, struct nameidata *nd); ++ ++extern int create_sto_nod(dentry_t *dentry, int mode, dev_t dev); ++extern int create_sto_reg_file(dentry_t *dentry, int mode, struct nameidata *nd); ++#else ++extern int mini_fo_create(inode_t *dir, dentry_t *dentry, int mode); ++ ++extern int create_sto_nod(dentry_t *dentry, int mode, int dev); ++extern int create_sto_reg_file(dentry_t *dentry, int mode); ++#endif ++ ++extern int create_sto_dir(dentry_t *dentry, int mode); ++ ++extern int exists_in_storage(dentry_t *dentry); ++extern int is_mini_fo_existant(dentry_t *dentry); ++extern int get_neg_sto_dentry(dentry_t *dentry); ++extern int build_sto_structure(dentry_t *dir, dentry_t *dentry); ++extern int get_mini_fo_bpath(dentry_t *dentry, char **bpath, int *bpath_len); ++extern dentry_t *bpath_walk(super_block_t *sb, char *bpath); ++extern int bpath_put(dentry_t *dentry); ++ ++/* check_mini_fo types functions */ ++extern int check_mini_fo_dentry(dentry_t *dentry); ++extern int check_mini_fo_file(file_t *file); ++extern int check_mini_fo_inode(inode_t *inode); ++ ++/* General meta functions, can be called from outside of meta.c */ ++extern int meta_build_lists(dentry_t *dentry); ++extern int meta_put_lists(dentry_t *dentry); ++extern int __meta_put_lists(inode_t *inode); ++ ++extern int meta_add_d_entry(dentry_t *dentry, const char *name, int len); ++extern int meta_add_r_entry(dentry_t *dentry, ++ const char *old_name, int old_len, ++ const char *new_name, int new_len); ++ ++extern int meta_remove_r_entry(dentry_t *dentry, const char *name, int len); ++ ++extern int meta_check_d_entry(dentry_t *dentry, const char *name, int len); ++extern int __meta_check_d_entry(inode_t *inode, const char *name, int len); ++ ++extern char* meta_check_r_entry(dentry_t *dentry, const char *name, int len); ++extern char* __meta_check_r_entry(inode_t *inode, const char *name, int len); ++extern int meta_is_r_entry(dentry_t *dentry, const char *name, int len); ++extern int __meta_is_r_entry(inode_t *inode, const char *name, int len); ++ ++/* Specific meta functions, should be called only inside meta.c */ ++extern int __meta_put_d_list(inode_t *inode); ++extern int __meta_put_r_list(inode_t *inode); ++ ++extern int meta_list_add_d_entry(dentry_t *dentry, ++ const char *name, int len); ++extern int meta_list_add_r_entry(dentry_t *dentry, ++ const char *old_name, int old_len, ++ const char *new_name, int new_len); ++ ++extern int meta_list_remove_r_entry(dentry_t *dentry, ++ const char *name, int len); ++ ++extern int __meta_list_remove_r_entry(inode_t *inode, ++ const char *name, int len); ++ ++extern int meta_write_d_entry(dentry_t *dentry, const char *name, int len); ++extern int meta_write_r_entry(dentry_t *dentry, ++ const char *old_name, int old_len, ++ const char *new_name, int new_len); ++ ++extern int meta_sync_lists(dentry_t *dentry); ++extern int meta_sync_d_list(dentry_t *dentry, int app_flag); ++extern int meta_sync_r_list(dentry_t *dentry, int app_flag); ++ ++/* ndl stuff */ ++extern int ndl_add_entry(struct readdir_data *rd, const char *name, int len); ++extern void ndl_put_list(struct readdir_data *rd); ++extern int ndl_check_entry(struct readdir_data *rd, ++ const char *name, int len); ++ ++ ++# define copy_inode_size(dst, src) \ ++ dst->i_size = src->i_size; \ ++ dst->i_blocks = src->i_blocks; ++ ++static inline void ++fist_copy_attr_atime(inode_t *dest, const inode_t *src) ++{ ++ ASSERT(dest != NULL); ++ ASSERT(src != NULL); ++ dest->i_atime = src->i_atime; ++} ++static inline void ++fist_copy_attr_times(inode_t *dest, const inode_t *src) ++{ ++ ASSERT(dest != NULL); ++ ASSERT(src != NULL); ++ dest->i_atime = src->i_atime; ++ dest->i_mtime = src->i_mtime; ++ dest->i_ctime = src->i_ctime; ++} ++static inline void ++fist_copy_attr_timesizes(inode_t *dest, const inode_t *src) ++{ ++ ASSERT(dest != NULL); ++ ASSERT(src != NULL); ++ dest->i_atime = src->i_atime; ++ dest->i_mtime = src->i_mtime; ++ dest->i_ctime = src->i_ctime; ++ copy_inode_size(dest, src); ++} ++static inline void ++fist_copy_attr_all(inode_t *dest, const inode_t *src) ++{ ++ ASSERT(dest != NULL); ++ ASSERT(src != NULL); ++ dest->i_mode = src->i_mode; ++ dest->i_nlink = src->i_nlink; ++ dest->i_uid = src->i_uid; ++ dest->i_gid = src->i_gid; ++ dest->i_rdev = src->i_rdev; ++ dest->i_atime = src->i_atime; ++ dest->i_mtime = src->i_mtime; ++ dest->i_ctime = src->i_ctime; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) ++ dest->i_blksize = src->i_blksize; ++#endif ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,12) ++ dest->i_blkbits = src->i_blkbits; ++# endif /* linux 2.4.12 and newer */ ++ copy_inode_size(dest, src); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ++ dest->i_attr_flags = src->i_attr_flags; ++#else ++ dest->i_flags = src->i_flags; ++#endif ++} ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++/* copied from linux/fs.h */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++static inline void double_lock(struct dentry *d1, struct dentry *d2) ++{ ++ struct mutex *m1 = &d1->d_inode->i_mutex; ++ struct mutex *m2 = &d2->d_inode->i_mutex; ++ if (m1 != m2) { ++ if ((unsigned long) m1 < (unsigned long) m2) { ++ struct mutex *tmp = m2; ++ m2 = m1; m1 = tmp; ++ } ++ mutex_lock(m1); ++ } ++ mutex_lock(m2); ++} ++ ++static inline void double_unlock(struct dentry *d1, struct dentry *d2) ++{ ++ struct mutex *m1 = &d1->d_inode->i_mutex; ++ struct mutex *m2 = &d2->d_inode->i_mutex; ++ mutex_unlock(m1); ++ if (m1 != m2) ++ mutex_unlock(m2); ++ dput(d1); ++ dput(d2); ++} ++ ++#else ++static inline void double_down(struct semaphore *s1, struct semaphore *s2) ++{ ++ if (s1 != s2) { ++ if ((unsigned long) s1 < (unsigned long) s2) { ++ struct semaphore *tmp = s2; ++ s2 = s1; s1 = tmp; ++ } ++ down(s1); ++ } ++ down(s2); ++} ++ ++static inline void double_up(struct semaphore *s1, struct semaphore *s2) ++{ ++ up(s1); ++ if (s1 != s2) ++ up(s2); ++} ++ ++static inline void double_lock(struct dentry *d1, struct dentry *d2) ++{ ++ double_down(&d1->d_inode->i_sem, &d2->d_inode->i_sem); ++} ++ ++static inline void double_unlock(struct dentry *d1, struct dentry *d2) ++{ ++ double_up(&d1->d_inode->i_sem,&d2->d_inode->i_sem); ++ dput(d1); ++ dput(d2); ++} ++#endif /* if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) */ ++#endif /* if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */ ++#endif /* __KERNEL__ */ ++ ++/* ++ * Definitions for user and kernel code ++ */ ++ ++/* ioctls */ ++ ++#endif /* not __MINI_FO_H_ */ +--- /dev/null ++++ b/fs/mini_fo/mini_fo-merge +@@ -0,0 +1,180 @@ ++#!/bin/bash ++# ++# Copyright (C) 2005 Markus Klotzbuecher ++# 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 of the License, or (at your option) any later version. ++# ++ ++BASE= ++STO= ++HELP= ++DRYRUN= ++VERBOSE= ++TMP="/tmp/" ++META_NAME="META_dAfFgHE39ktF3HD2sr" ++SKIP_DEL_LIST="skip-delete-list.mini_fo-merge" ++ ++COMMAND= ++exec_command() ++{ ++ if [ x$DRYRUN == "xset" ]; then ++ echo " would run: $COMMAND" ++ elif ! [ x$DRYRUN == "xset" ]; then ++ if [ x$VERBOSE == "xset" ]; then ++ echo " running: $COMMAND" ++ fi ++ eval $COMMAND ++ fi ++} ++ ++usage() ++{ ++cat < -s ++Version 0.1 ++ ++This script merges the contents of a mini_fo storage file system back ++to the base file system. ++ ++!!! Warning: This will modify the base filesystem and can destroy data ++ if used wrongly. ++ ++Options: ++ -b ++ the directory of the base file system. ++ ++ -s ++ the directory of the storage file system. ++ ++ -d dry run, will not change anything and print the commands that ++ would be executed. ++ ++ -t tmp dir for storing temporary file. default: $TMP ++ ++ -v show what operations are performed. ++ ++ -h displays this message. ++ ++EOF ++} ++ ++# parse parameters ++while getopts hdvt:b:s: OPTS ++ do ++ case $OPTS in ++ h) HELP="set";; ++ d) DRYRUN="set";; ++ v) VERBOSE="set";; ++ b) BASE="$OPTARG";; ++ s) STO="$OPTARG";; ++ t) TMP="$OPTARG";; ++ ?) usage ++ exit 1;; ++ esac ++done ++ ++if [ "x$HELP" == "xset" ]; then ++ usage ++ exit -1 ++fi ++ ++if ! [ -d "$BASE" ] || ! [ -d "$STO" ]; then ++ echo -e "$0:\n Error, -s and/or -b argument missing. type $0 -h for help." ++ exit -1; ++fi ++ ++# get full paths ++pushd $STO; STO=`pwd`; popd ++pushd $BASE; BASE=`pwd`; popd ++TMP=${TMP%/} ++ ++ ++cat< /dev/null ++find . -name $META_NAME -type f -print0 | xargs -0 -e grep -e '^R ' | tr -s ':R' ' ' | while read ENTRY; do ++ echo "entry: $ENTRY" ++ META_FILE=`echo $ENTRY | cut -d ' ' -f 1` ++ OLD_B_DIR=`echo $ENTRY | cut -d ' ' -f 2 | sed -e 's/\///'` ++ NEW_NAME=`echo $ENTRY | cut -d ' ' -f 3` ++ NEW_B_DIR=`echo $META_FILE | sed -e "s/$META_NAME/$NEW_NAME/" | sed -e 's/^\.\///'` ++ echo "META_FILE: $META_FILE" ++ echo "OLD_B_DIR: $OLD_B_DIR" ++ echo "NEW_NAME: $NEW_NAME" ++ echo "NEW_B_DIR: $NEW_B_DIR" ++ ++ pushd $BASE &> /dev/null ++ # remove an existing dir in storage ++ COMMAND="rm -rf $NEW_B_DIR"; exec_command ++ COMMAND="cp -R $OLD_B_DIR $NEW_B_DIR"; exec_command ++ echo "" ++ popd &> /dev/null ++ ++ # remember this dir to exclude it from deleting later ++ echo $NEW_B_DIR >> $TMP/$SKIP_DEL_LIST ++done ++ ++# delete all whiteouted files from base ++echo -e "\nDeleting whiteout'ed files from base file system..." ++find . -name $META_NAME -type f -print0 | xargs -0 -e grep -e '^D ' | sed -e 's/:D//' | while read ENTRY; do ++ META_FILE=`echo $ENTRY | cut -d ' ' -f 1` ++ DEL_NAME=`echo $ENTRY | cut -d ' ' -f 2` ++ DEL_FILE=`echo $META_FILE | sed -e "s/$META_NAME/$DEL_NAME/" | sed -e 's/^\.\///'` ++ grep -x $DEL_FILE $TMP/$SKIP_DEL_LIST &> /dev/null ++ if [ $? -ne 0 ]; then ++ pushd $BASE &> /dev/null ++ COMMAND="rm -rf $DEL_FILE"; exec_command ++ popd &> /dev/null ++ else ++ echo " excluding: $DEL_FILE as in skip-del-list." ++ fi ++done ++ ++# create all dirs and update permissions ++echo -e "\nSetting up directory structures in base file system..." ++find . -type d | sed -e 's/^\.\///' | while read DIR; do ++ PERMS=`stat -c %a $DIR` ++ DIR_UID=`stat -c %u $DIR` ++ DIR_GID=`stat -c %g $DIR` ++ pushd $BASE &> /dev/null ++ if ! [ -d $DIR ]; then ++ COMMAND="mkdir -p $DIR"; exec_command ++ fi ++ COMMAND="chmod $PERMS $DIR"; exec_command ++ COMMAND="chown $DIR_UID:$DIR_GID $DIR"; exec_command ++ popd &> /dev/null ++done ++ ++# merge all non-directory files ++echo -e "\nMerging all non-directory files...." ++for i in b c p f l s; do ++ find . -type $i | sed -e 's/^\.\///' | grep -v "$META_NAME" | while read FILE; do ++ pushd $BASE #&> /dev/null ++ COMMAND="cp -df $STO/$FILE $BASE/$FILE"; exec_command ++ popd &> /dev/null ++ done ++done ++popd &> /dev/null ++ ++#rm $TMP/$SKIP_DEL_LIST ++ ++echo "Done!" +--- /dev/null ++++ b/fs/mini_fo/mini_fo-overlay +@@ -0,0 +1,130 @@ ++#!/bin/bash ++# ++# Copyright (C) 2005 Markus Klotzbuecher ++# 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 of the License, or (at your option) any later version. ++# ++ ++HELP= ++SUFF= ++MNTP= ++MNT_DIR="/mnt" ++STO= ++STO_DIR="/tmp" ++BASE= ++ ++usage() ++{ ++cat <" in $STO_DIR, ++and mount point "mini_fo-" in $MNT_DIR. ++ ++Options: ++ -s ++ add given suffix to storage directory and the mount ++ point. This is usefull for overlaying one base directory ++ several times and avoiding conflicts with storage directory ++ names and mount points. ++ ++ -d ++ change the directory in which the storage directory will be ++ created (default is currently "$STO_DIR". ++ ++ -m ++ use an alternative directory to create the mini_fo ++ mountpoint (default is currently "$MNT_DIR". ++ ++ -h displays this message. ++ ++EOF ++exit 1; ++} ++ ++while getopts hm:s:d: OPTS ++ do ++ case $OPTS in ++ s) SUFF="$OPTARG";; ++ d) STO_DIR="$OPTARG";; ++ m) MNT_DIR="$OPTARG";; ++ h) HELP="set";; ++ ?) usage ++ exit 1;; ++ esac ++done ++shift $(($OPTIND - 1)) ++ ++BASE="$1" ++ ++if [ "x$HELP" == "xset" ]; then ++ usage ++ exit -1 ++fi ++ ++# fix suffix ++if [ "x$SUFF" != "x" ]; then ++ SUFF="-$SUFF" ++fi ++ ++# kill trailing slashes ++MNT_DIR=${MNT_DIR%/} ++STO_DIR=${STO_DIR%/} ++BASE=${BASE%/} ++ ++ ++if ! [ -d "$BASE" ]; then ++ echo "invalid base dir $BASE, run $0 -h for help." ++ exit -1 ++fi ++ ++# check opts ++if ! [ -d "$MNT_DIR" ]; then ++ echo "invalid mount dir $MNT_DIR, run $0 -h for help." ++ exit -1 ++fi ++ ++if ! [ -d "$STO_DIR" ]; then ++ echo "invalid sto_dir_dir $STO_DIR, run $0 -h for help." ++ exit -1 ++fi ++ ++MNTP="$MNT_DIR/mini_fo-`basename $BASE`$SUFF" ++STO="$STO_DIR/sto-`basename $BASE`$SUFF" ++ ++# create the mount point if it doesn't exist ++mkdir -p $MNTP ++if [ $? -ne 0 ]; then ++ echo "Error, failed to create mount point $MNTP" ++fi ++ ++mkdir -p $STO ++if [ $? -ne 0 ]; then ++ echo "Error, failed to create storage dir $STO" ++fi ++ ++# check if fs is already mounted ++mount | grep mini_fo | grep $MNTP &> /dev/null ++if [ $? -eq 0 ]; then ++ echo "Error, existing mini_fo mount at $MNTP." ++ exit -1 ++fi ++ ++mount | grep mini_fo | grep $STO &> /dev/null ++if [ $? -eq 0 ]; then ++ echo "Error, $STO seems to be used already." ++ exit -1 ++fi ++ ++# mount ++mount -t mini_fo -o base=$BASE,sto=$STO $BASE $MNTP ++ ++if [ $? -ne 0 ]; then ++ echo "Error, mounting failed, maybe no permisson to mount?" ++fi +--- /dev/null ++++ b/fs/mini_fo/mmap.c +@@ -0,0 +1,637 @@ ++/* ++ * Copyright (c) 1997-2003 Erez Zadok ++ * Copyright (c) 2001-2003 Stony Brook University ++ * ++ * For specific licensing information, see the COPYING file distributed with ++ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING. ++ * ++ * This Copyright notice must be kept intact and distributed with all ++ * fistgen sources INCLUDING sources generated by fistgen. ++ */ ++/* ++ * Copyright (C) 2004, 2005 Markus Klotzbuecher ++ * ++ * 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 of the License, or (at your option) any later version. ++ */ ++ ++/* ++ * $Id$ ++ */ ++ ++#ifdef HAVE_CONFIG_H ++# include ++#endif /* HAVE_CONFIG_H */ ++ ++#include "fist.h" ++#include "mini_fo.h" ++ ++ ++#ifdef FIST_COUNT_WRITES ++/* for counting writes in the middle vs. regular writes */ ++unsigned long count_writes = 0, count_writes_middle = 0; ++#endif /* FIST_COUNT_WRITES */ ++ ++/* forward declaration of commit write and prepare write */ ++STATIC int mini_fo_commit_write(file_t *file, page_t *page, unsigned from, unsigned to); ++STATIC int mini_fo_prepare_write(file_t *file, page_t *page, unsigned from, unsigned to); ++ ++ ++/* ++ * Function for handling creation of holes when lseek-ing past the ++ * end of the file and then writing some data. ++ */ ++int ++mini_fo_fill_zeros(file_t* file, page_t *page, unsigned from) ++{ ++ int err = 0; ++ dentry_t *dentry = file->f_dentry; ++ inode_t *inode = dentry->d_inode; ++ page_t *tmp_page; ++ int index; ++ ++ print_entry_location(); ++ ++ for (index = inode->i_size >> PAGE_CACHE_SHIFT; index < page->index; index++) { ++ tmp_page = mini_fo_get1page(file, index); ++ if (IS_ERR(tmp_page)) { ++ err = PTR_ERR(tmp_page); ++ goto out; ++ } ++ ++ /* ++ * zero out rest of the contents of the page between the appropriate ++ * offsets. ++ */ ++ memset((char*)page_address(tmp_page) + (inode->i_size & ~PAGE_CACHE_MASK), 0, PAGE_CACHE_SIZE - (inode->i_size & ~PAGE_CACHE_MASK)); ++ ++ if (! (err = mini_fo_prepare_write(file, tmp_page, 0, PAGE_CACHE_SIZE))) ++ err = mini_fo_commit_write(file, tmp_page, 0, PAGE_CACHE_SIZE); ++ ++ page_cache_release(tmp_page); ++ if (err < 0) ++ goto out; ++ if (current->need_resched) ++ schedule(); ++ } ++ ++ /* zero out appropriate parts of last page */ ++ ++ /* ++ * if the encoding type is block, then adjust the 'from' (where the ++ * zeroing will start) offset appropriately ++ */ ++ from = from & (~(FIST_ENCODING_BLOCKSIZE - 1)); ++ ++ if ((from - (inode->i_size & ~PAGE_CACHE_MASK)) > 0) { ++ ++ memset((char*)page_address(page) + (inode->i_size & ~PAGE_CACHE_MASK), 0, from - (inode->i_size & ~PAGE_CACHE_MASK)); ++ if (! (err = mini_fo_prepare_write(file, page, 0, PAGE_CACHE_SIZE))) ++ err = mini_fo_commit_write(file, page, 0, PAGE_CACHE_SIZE); ++ ++ if (err < 0) ++ goto out; ++ if (current->need_resched) ++ schedule(); ++ } ++ ++ out: ++ print_exit_status(err); ++ return err; ++} ++ ++ ++ ++STATIC int ++mini_fo_writepage(page_t *page) ++{ ++ int err = -EIO; ++ inode_t *inode; ++ inode_t *hidden_inode; ++ page_t *hidden_page; ++ char *kaddr, *hidden_kaddr; ++ ++ print_entry_location(); ++ ++ inode = page->mapping->host; ++ hidden_inode = itohi(inode); ++ ++ /* ++ * writepage is called when shared mmap'ed files need to write ++ * their pages, while prepare/commit_write are called from the ++ * non-paged write() interface. (However, in 2.3 the two interfaces ++ * share the same cache, while in 2.2 they didn't.) ++ * ++ * So we pretty much have to duplicate much of what commit_write does. ++ */ ++ ++ /* find lower page (returns a locked page) */ ++ hidden_page = grab_cache_page(hidden_inode->i_mapping, page->index); ++ if (!hidden_page) ++ goto out; ++ ++ /* get page address, and encode it */ ++ kaddr = (char *) kmap(page); ++ hidden_kaddr = (char*) kmap(hidden_page); ++ mini_fo_encode_block(kaddr, hidden_kaddr, PAGE_CACHE_SIZE, inode, inode->i_sb, page->index); ++ /* if encode_block could fail, then return error */ ++ kunmap(page); ++ kunmap(hidden_page); ++ ++ /* call lower writepage (expects locked page) */ ++ err = hidden_inode->i_mapping->a_ops->writepage(hidden_page); ++ ++ /* ++ * update mtime and ctime of lower level file system ++ * mini_fo' mtime and ctime are updated by generic_file_write ++ */ ++ hidden_inode->i_mtime = hidden_inode->i_ctime = CURRENT_TIME; ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,1) ++ UnlockPage(hidden_page); /* b/c grab_cache_page locked it */ ++# endif /* kernel older than 2.4.1 */ ++ page_cache_release(hidden_page); /* b/c grab_cache_page increased refcnt */ ++ ++ if (err) ++ ClearPageUptodate(page); ++ else ++ SetPageUptodate(page); ++ out: ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,1) ++ UnlockPage(page); ++# endif /* kernel 2.4.1 and newer */ ++ print_exit_status(err); ++ return err; ++} ++ ++ ++/* ++ * get one page from cache or lower f/s, return error otherwise. ++ * returns unlocked, up-to-date page (if ok), with increased refcnt. ++ */ ++page_t * ++mini_fo_get1page(file_t *file, int index) ++{ ++ page_t *page; ++ dentry_t *dentry; ++ inode_t *inode; ++ struct address_space *mapping; ++ int err; ++ ++ print_entry_location(); ++ ++ dentry = file->f_dentry; /* CPW: Moved below print_entry_location */ ++ inode = dentry->d_inode; ++ mapping = inode->i_mapping; ++ ++ fist_dprint(8, "%s: read page index %d pid %d\n", __FUNCTION__, index, current->pid); ++ if (index < 0) { ++ printk("%s BUG: index=%d\n", __FUNCTION__, index); ++ page = ERR_PTR(-EIO); ++ goto out; ++ } ++ page = read_cache_page(mapping, ++ index, ++ (filler_t *) mapping->a_ops->readpage, ++ (void *) file); ++ if (IS_ERR(page)) ++ goto out; ++ wait_on_page(page); ++ if (!Page_Uptodate(page)) { ++ lock_page(page); ++ err = mapping->a_ops->readpage(file, page); ++ if (err) { ++ page = ERR_PTR(err); ++ goto out; ++ } ++ wait_on_page(page); ++ if (!Page_Uptodate(page)) { ++ page = ERR_PTR(-EIO); ++ goto out; ++ } ++ } ++ ++ out: ++ print_exit_pointer(page); ++ return page; ++} ++ ++ ++/* ++ * get one page from cache or lower f/s, return error otherwise. ++ * similar to get1page, but doesn't guarantee that it will return ++ * an unlocked page. ++ */ ++page_t * ++mini_fo_get1page_cached(file_t *file, int index) ++{ ++ page_t *page; ++ dentry_t *dentry; ++ inode_t *inode; ++ struct address_space *mapping; ++ int err; ++ ++ print_entry_location(); ++ ++ dentry = file->f_dentry; /* CPW: Moved below print_entry_location */ ++ inode = dentry->d_inode; ++ mapping = inode->i_mapping; ++ ++ fist_dprint(8, "%s: read page index %d pid %d\n", __FUNCTION__, index, current->pid); ++ if (index < 0) { ++ printk("%s BUG: index=%d\n", __FUNCTION__, index); ++ page = ERR_PTR(-EIO); ++ goto out; ++ } ++ page = read_cache_page(mapping, ++ index, ++ (filler_t *) mapping->a_ops->readpage, ++ (void *) file); ++ if (IS_ERR(page)) ++ goto out; ++ ++ out: ++ print_exit_pointer(page); ++ return page; ++} ++ ++ ++/* ++ * readpage is called from generic_page_read and the fault handler. ++ * If your file system uses generic_page_read for the read op, it ++ * must implement readpage. ++ * ++ * Readpage expects a locked page, and must unlock it. ++ */ ++STATIC int ++mini_fo_do_readpage(file_t *file, page_t *page) ++{ ++ int err = -EIO; ++ dentry_t *dentry; ++ file_t *hidden_file = NULL; ++ dentry_t *hidden_dentry; ++ inode_t *inode; ++ inode_t *hidden_inode; ++ char *page_data; ++ page_t *hidden_page; ++ char *hidden_page_data; ++ int real_size; ++ ++ print_entry_location(); ++ ++ dentry = file->f_dentry; /* CPW: Moved below print_entry_location */ ++ if (ftopd(file) != NULL) ++ hidden_file = ftohf(file); ++ hidden_dentry = dtohd(dentry); ++ inode = dentry->d_inode; ++ hidden_inode = itohi(inode); ++ ++ fist_dprint(7, "%s: requesting page %d from file %s\n", __FUNCTION__, page->index, dentry->d_name.name); ++ ++ MALLOC_PAGE_POINTERS(hidden_pages, num_hidden_pages); ++ MALLOC_PAGEDATA_POINTERS(hidden_pages_data, num_hidden_pages); ++ FOR_EACH_PAGE ++ CURRENT_HIDDEN_PAGE = NULL; ++ ++ /* find lower page (returns a locked page) */ ++ FOR_EACH_PAGE { ++ fist_dprint(8, "%s: Current page index = %d\n", __FUNCTION__, CURRENT_HIDDEN_PAGEINDEX); ++ CURRENT_HIDDEN_PAGE = read_cache_page(hidden_inode->i_mapping, ++ CURRENT_HIDDEN_PAGEINDEX, ++ (filler_t *) hidden_inode->i_mapping->a_ops->readpage, ++ (void *) hidden_file); ++ if (IS_ERR(CURRENT_HIDDEN_PAGE)) { ++ err = PTR_ERR(CURRENT_HIDDEN_PAGE); ++ CURRENT_HIDDEN_PAGE = NULL; ++ goto out_release; ++ } ++ } ++ ++ /* ++ * wait for the page data to show up ++ * (signaled by readpage as unlocking the page) ++ */ ++ FOR_EACH_PAGE { ++ wait_on_page(CURRENT_HIDDEN_PAGE); ++ if (!Page_Uptodate(CURRENT_HIDDEN_PAGE)) { ++ /* ++ * call readpage() again if we returned from wait_on_page with a ++ * page that's not up-to-date; that can happen when a partial ++ * page has a few buffers which are ok, but not the whole ++ * page. ++ */ ++ lock_page(CURRENT_HIDDEN_PAGE); ++ err = hidden_inode->i_mapping->a_ops->readpage(hidden_file, ++ CURRENT_HIDDEN_PAGE); ++ if (err) { ++ CURRENT_HIDDEN_PAGE = NULL; ++ goto out_release; ++ } ++ wait_on_page(CURRENT_HIDDEN_PAGE); ++ if (!Page_Uptodate(CURRENT_HIDDEN_PAGE)) { ++ err = -EIO; ++ goto out_release; ++ } ++ } ++ } ++ ++ /* map pages, get their addresses */ ++ page_data = (char *) kmap(page); ++ FOR_EACH_PAGE ++ CURRENT_HIDDEN_PAGEDATA = (char *) kmap(CURRENT_HIDDEN_PAGE); ++ ++ /* if decode_block could fail, then return error */ ++ err = 0; ++ real_size = hidden_inode->i_size - (page->index << PAGE_CACHE_SHIFT); ++ if (real_size <= 0) ++ memset(page_data, 0, PAGE_CACHE_SIZE); ++ else if (real_size < PAGE_CACHE_SIZE) { ++ mini_fo_decode_block(hidden_page_data, page_data, real_size, inode, inode->i_sb, page->index); ++ memset(page_data + real_size, 0, PAGE_CACHE_SIZE - real_size); ++ } else ++ mini_fo_decode_block(hidden_page_data, page_data, PAGE_CACHE_SIZE, inode, inode->i_sb, page->index); ++ ++ FOR_EACH_PAGE ++ kunmap(CURRENT_HIDDEN_PAGE); ++ kunmap(page); ++ ++ out_release: ++ FOR_EACH_PAGE ++ if (CURRENT_HIDDEN_PAGE) ++ page_cache_release(CURRENT_HIDDEN_PAGE); /* undo read_cache_page */ ++ ++ FREE_PAGE_POINTERS(hidden_pages, num_hidden_pages); ++ FREE_PAGEDATA_POINTERS(hidden_pages_data, num_hidden_pages); ++ ++ out: ++ if (err == 0) ++ SetPageUptodate(page); ++ else ++ ClearPageUptodate(page); ++ ++ print_exit_status(err); ++ return err; ++} ++ ++ ++STATIC int ++mini_fo_readpage(file_t *file, page_t *page) ++{ ++ int err; ++ print_entry_location(); ++ ++ err = mini_fo_do_readpage(file, page); ++ ++ /* ++ * we have to unlock our page, b/c we _might_ have gotten a locked page. ++ * but we no longer have to wakeup on our page here, b/c UnlockPage does ++ * it ++ */ ++ UnlockPage(page); ++ ++ print_exit_status(err); ++ return err; ++} ++ ++ ++STATIC int ++mini_fo_prepare_write(file_t *file, page_t *page, unsigned from, unsigned to) ++{ ++ int err = 0; ++ ++ print_entry_location(); ++ ++ /* ++ * we call kmap(page) only here, and do the kunmap ++ * and the actual downcalls, including unlockpage and uncache ++ * in commit_write. ++ */ ++ kmap(page); ++ ++ /* fast path for whole page writes */ ++ if (from == 0 && to == PAGE_CACHE_SIZE) ++ goto out; ++ /* read the page to "revalidate" our data */ ++ /* call the helper function which doesn't unlock the page */ ++ if (!Page_Uptodate(page)) ++ err = mini_fo_do_readpage(file, page); ++ ++ out: ++ print_exit_status(err); ++ return err; ++} ++ ++ ++ ++STATIC int ++mini_fo_commit_write(file_t *file, page_t *page, unsigned from, unsigned to) ++{ ++ int err = -ENOMEM; ++ inode_t *inode; ++ inode_t *hidden_inode; ++ page_t *hidden_page; ++ file_t *hidden_file = NULL; ++ loff_t pos; ++ unsigned bytes = to - from; ++ unsigned hidden_from, hidden_to, hidden_bytes; ++ ++ print_entry_location(); ++ ++ inode = page->mapping->host; /* CPW: Moved below print_entry_location */ ++ hidden_inode = itohi(inode); ++ ++ ASSERT(file != NULL); ++ /* ++ * here we have a kmapped page, with data from the user copied ++ * into it. we need to encode_block it, and then call the lower ++ * commit_write. We also need to simulate same behavior of ++ * generic_file_write, and call prepare_write on the lower f/s first. ++ */ ++#ifdef FIST_COUNT_WRITES ++ count_writes++; ++# endif /* FIST_COUNT_WRITES */ ++ ++ /* this is append and/or extend -- we can't have holes so fill them in */ ++ if (page->index > (hidden_inode->i_size >> PAGE_CACHE_SHIFT)) { ++ page_t *tmp_page; ++ int index; ++ for (index = hidden_inode->i_size >> PAGE_CACHE_SHIFT; index < page->index; index++) { ++ tmp_page = mini_fo_get1page(file, index); ++ if (IS_ERR(tmp_page)) { ++ err = PTR_ERR(tmp_page); ++ goto out; ++ } ++ /* zero out the contents of the page at the appropriate offsets */ ++ memset((char*)page_address(tmp_page) + (inode->i_size & ~PAGE_CACHE_MASK), 0, PAGE_CACHE_SIZE - (inode->i_size & ~PAGE_CACHE_MASK)); ++ if (!(err = mini_fo_prepare_write(file, tmp_page, 0, PAGE_CACHE_SIZE))) ++ err = mini_fo_commit_write(file, tmp_page, 0, PAGE_CACHE_SIZE); ++ page_cache_release(tmp_page); ++ if (err < 0) ++ goto out; ++ if (current->need_resched) ++ schedule(); ++ } ++ } ++ ++ if (ftopd(file) != NULL) ++ hidden_file = ftohf(file); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_inode->i_mutex); ++#else ++ down(&hidden_inode->i_sem); ++#endif ++ /* find lower page (returns a locked page) */ ++ hidden_page = grab_cache_page(hidden_inode->i_mapping, page->index); ++ if (!hidden_page) ++ goto out; ++ ++#if FIST_ENCODING_BLOCKSIZE > 1 ++# error encoding_blocksize greater than 1 is not yet supported ++# endif /* FIST_ENCODING_BLOCKSIZE > 1 */ ++ ++ hidden_from = from & (~(FIST_ENCODING_BLOCKSIZE - 1)); ++ hidden_to = ((to + FIST_ENCODING_BLOCKSIZE - 1) & (~(FIST_ENCODING_BLOCKSIZE - 1))); ++ if ((page->index << PAGE_CACHE_SHIFT) + to > hidden_inode->i_size) { ++ ++ /* ++ * if this call to commit_write had introduced holes and the code ++ * for handling holes was invoked, then the beginning of this page ++ * must be zeroed out ++ * zero out bytes from 'size_of_file%pagesize' to 'from'. ++ */ ++ if ((hidden_from - (inode->i_size & ~PAGE_CACHE_MASK)) > 0) ++ memset((char*)page_address(page) + (inode->i_size & ~PAGE_CACHE_MASK), 0, hidden_from - (inode->i_size & ~PAGE_CACHE_MASK)); ++ ++ } ++ hidden_bytes = hidden_to - hidden_from; ++ ++ /* call lower prepare_write */ ++ err = -EINVAL; ++ if (hidden_inode->i_mapping && ++ hidden_inode->i_mapping->a_ops && ++ hidden_inode->i_mapping->a_ops->prepare_write) ++ err = hidden_inode->i_mapping->a_ops->prepare_write(hidden_file, ++ hidden_page, ++ hidden_from, ++ hidden_to); ++ if (err) ++ /* don't leave locked pages behind, esp. on an ENOSPC */ ++ goto out_unlock; ++ ++ fist_dprint(8, "%s: encoding %d bytes\n", __FUNCTION__, hidden_bytes); ++ mini_fo_encode_block((char *) page_address(page) + hidden_from, (char*) page_address(hidden_page) + hidden_from, hidden_bytes, inode, inode->i_sb, page->index); ++ /* if encode_block could fail, then goto unlock and return error */ ++ ++ /* call lower commit_write */ ++ err = hidden_inode->i_mapping->a_ops->commit_write(hidden_file, ++ hidden_page, ++ hidden_from, ++ hidden_to); ++ ++ if (err < 0) ++ goto out_unlock; ++ ++ err = bytes; /* convert error to no. of bytes */ ++ ++ inode->i_blocks = hidden_inode->i_blocks; ++ /* we may have to update i_size */ ++ pos = (page->index << PAGE_CACHE_SHIFT) + to; ++ if (pos > inode->i_size) ++ inode->i_size = pos; ++ ++ /* ++ * update mtime and ctime of lower level file system ++ * mini_fo' mtime and ctime are updated by generic_file_write ++ */ ++ hidden_inode->i_mtime = hidden_inode->i_ctime = CURRENT_TIME; ++ ++ mark_inode_dirty_sync(inode); ++ ++ out_unlock: ++ UnlockPage(hidden_page); ++ page_cache_release(hidden_page); ++ kunmap(page); /* kmap was done in prepare_write */ ++ out: ++ /* we must set our page as up-to-date */ ++ if (err < 0) ++ ClearPageUptodate(page); ++ else ++ SetPageUptodate(page); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_inode->i_mutex); ++#else ++ up(&hidden_inode->i_sem); ++#endif ++ print_exit_status(err); ++ return err; /* assume all is ok */ ++} ++ ++ ++STATIC int ++mini_fo_bmap(struct address_space *mapping, long block) ++{ ++ int err = 0; ++ inode_t *inode; ++ inode_t *hidden_inode; ++ ++ print_entry_location(); ++ ++ inode = (inode_t *) mapping->host; ++ hidden_inode = itohi(inode); ++ ++ if (hidden_inode->i_mapping->a_ops->bmap) ++ err = hidden_inode->i_mapping->a_ops->bmap(hidden_inode->i_mapping, block); ++ print_exit_location(); ++ return err; ++} ++ ++ ++/* ++ * This function is copied verbatim from mm/filemap.c. ++ * XXX: It should be simply moved to some header file instead -- bug Al about it! ++ */ ++static inline int sync_page(struct page *page) ++{ ++ struct address_space *mapping = page->mapping; ++ ++ if (mapping && mapping->a_ops && mapping->a_ops->sync_page) ++ return mapping->a_ops->sync_page(page); ++ return 0; ++} ++ ++ ++/* ++ * XXX: we may not need this function if not FIST_FILTER_DATA. ++ * FIXME: for FIST_FILTER_SCA, get all lower pages and sync them each. ++ */ ++STATIC int ++mini_fo_sync_page(page_t *page) ++{ ++ int err = 0; ++ inode_t *inode; ++ inode_t *hidden_inode; ++ page_t *hidden_page; ++ ++ print_entry_location(); ++ ++ inode = page->mapping->host; /* CPW: Moved below print_entry_location */ ++ hidden_inode = itohi(inode); ++ ++ /* find lower page (returns a locked page) */ ++ hidden_page = grab_cache_page(hidden_inode->i_mapping, page->index); ++ if (!hidden_page) ++ goto out; ++ ++ err = sync_page(hidden_page); ++ ++ UnlockPage(hidden_page); /* b/c grab_cache_page locked it */ ++ page_cache_release(hidden_page); /* b/c grab_cache_page increased refcnt */ ++ ++ out: ++ print_exit_status(err); ++ return err; ++} +--- /dev/null ++++ b/fs/mini_fo/README +@@ -0,0 +1,163 @@ ++README for the mini_fo overlay file system ++========================================= ++ ++ ++WHAT IS MINI_FO? ++---------------- ++ ++mini_fo is a virtual kernel file system that can make read-only ++file systems writable. This is done by redirecting modifying operations ++to a writeable location called "storage directory", and leaving the ++original data in the "base directory" untouched. When reading, the ++file system merges the modifed and original data so that only the ++newest versions will appear. This occurs transparently to the user, ++who can access the data like on any other read-write file system. ++ ++Base and storage directories may be located on the same or on ++different partitions and may be of different file system types. While ++the storage directory obviously needs to be writable, the base may or ++may not be writable, what doesn't matter as it will no be modified ++anyway. ++ ++ ++WHAT IS GOOD FOR? ++----------------- ++ ++The primary purpose of the mini_fo file system is to allow easy ++software updates to embedded systems, that often store their root ++file system in a read-only flash file system, but there are many ++more as for example sandboxing, or for allowing live-cds to ++permanently store information. ++ ++ ++BUILDING ++-------- ++This should be simple. Adjust the Makefile to point to the correct ++kernel headers you want to build the module for. Then: ++ ++ # make ++ ++should build "mini_fo.o" for a 2.4 kernel or "mini_fo.ko" for a 2.6 ++kernel. ++ ++If you are building the module for you current kernel, you can install ++the module (as root): ++ ++ # make install ++ ++or uninstall with ++ ++ # make uninstall ++ ++ ++USING THE FILE SYSTEM ++-------------------- ++ ++the general mount syntax is: ++ ++ mount -t mini_fo -o base=,sto=\ ++ ++ ++Example: ++ ++You have mounted a cdrom to /mnt/cdrom and want to modifiy some files ++on it: ++ ++load the module (as root) ++ ++ # insmod mini_fo.o for a 2.4 kernel or ++ ++ # insmod mini_fo.ko for a 2.6 kernel ++ ++ ++create a storage dir in tmp and a mountpoint for mini_fo: ++ ++ # mkdir /tmp/sto ++ # mkdir /mnt/mini_fo ++ ++and mount the mini_fo file system: ++ ++ # mount -t mini_fo -o base=/mnt/cdrom,sto=/tmp/sto /mnt/cdrom /mnt/mini_fo ++ ++ ++Now the data stored on the cd can be accessed via the mini_fo ++mountpoint just like any read-write file system, files can be modified ++and deleted, new ones can be created and so on. When done unmount the ++file system: ++ ++ # unmount /mnt/mini_fo ++ ++Note that if the file system is mounted again using the same storage ++file system, of course it will appear in the modified state again. If ++you remount it using an new empty storage directory, it will be ++unmodified. Therefore by executing: ++ ++ # cd /tmp/sto ++ # rm -rf * ++ ++you can nuke all the changes you made to the original file system. But ++ remember NEVER do this while the mini_fo file system is mounted! ++ ++ ++Alternatively you can use the mini_fo-overlay bash script, that ++simplifies managing mini_fo mounts. See TOOLS Section. ++ ++ ++TOOLS ++----- ++ ++mini_fo-merge (experimental): ++ ++This is a bash script that will merge changes contained in the storage ++directory back to the base directory. This allows mini_fo to function ++as a cache file system by overlaying a slow (network, ...) file system ++and using a fast (ramdisk, ...) as storage. When done, changes can be ++merged back to the (slow) base with mini_fo-merge. See "mini_fo-merge ++-h" for details. ++ ++It can be usefull for merging changes back after a successfull test ++(patches, software updates...) ++ ++ ++mini_fo-overlay: ++ ++This bash script simplifies managing one or more mini_fo mounts. For ++overlaying a directory called "basedir1", you can just call: ++ ++ # mini_fo-overlay basedir1 ++ ++This will mount mini_fo with "basedir1" as base, "/tmp/sto-basedir1/" ++as storage to "/mnt/mini_fo-basedir1/". It has more options though, ++type "mini_fo-overlay -h" for details. ++ ++ ++DOCUMENTATION, REPORTING BUGS, GETTING HELP ++------------------------------------------- ++ ++Please visit the mini_fo project page at: ++ ++http://www.denx.de/twiki/bin/view/Know/MiniFOHome ++ ++ ++WARNINGS ++-------- ++ ++Never modify the base or the storage directorys while the mini_fo ++file system is mounted, or you might crash you system. Simply accessing ++and reading should not cause any trouble. ++ ++Exporting a mini_fo mount point via NFS has not been tested, and may ++or may not work. ++ ++Check the RELEASE_NOTES for details on bugs and features. ++ ++ ++ ++Copyright (C) 2004, 2005 Markus Klotzbuecher ++ ++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 of the License, or (at your option) any later version. ++ ++ +--- /dev/null ++++ b/fs/mini_fo/RELEASE_NOTES +@@ -0,0 +1,111 @@ ++Release: mini_fo-0.6.1 (v0-6-1) ++Date: 21.09.2005 ++ ++ ++Changes: ++-------- ++v0-6-1: ++ ++- bugfixes (see ChangeLog) ++ ++- two helper scripts "mini_fo_merge" and "mini_fo_overlay" (see ++ README for details). ++ ++v0-6-0: ++ ++- Support for 2.4 and 2.6 (see Makefile) ++ ++- Partial hard link support (creating works as expected, but already ++ existing links in the base file system will be treated as if they ++ were individual files). ++ ++- Various bugfixes and cleanups. ++ ++ ++v0-6-0-pre1: ++ ++- This is mini_fo-0-6-0-pre1! This release is a complete rewrite of ++ many vital mini_fo parts such as the old whiteout list code which ++ has been replaced by the new META subsystem. ++ ++- Light weight directory renaming implemented. This means if a ++ directory is renamed via the mini_fo filesystem this will no longer ++ result in a complete copy in storage, instead only one empty ++ directory will be created. All base filed contained in the original ++ directory stay there until modified. ++ ++- Special files (creating, renaming, deleting etc.) now working. ++ ++- Many bugfixes and cleanup, mini_fo is now a lot more stable. ++ ++ ++v0-5-10: ++ ++- Final release of the 0-5-* versions. Next will be a complete rewrite ++ of many features. This release contains several bugfixes related to ++ directory renaming. ++ ++ ++v0-5-10-pre6: ++ ++- Lots of cleanup and several bugfixes related to directory deleting ++ ++- Directory renaming suddenly works, what is most likely due to the ++ fact tha that "mv" is smart: if the classic rename doesn't work it ++ will assume that source and target file are on different fs and will ++ copy the directory and try to remove the source directory. Until ++ directory removing wasn't implemented, it would fail to do this and ++ rollback. ++ So, directory renaming works for now, but it doesn't yet do what you ++ would expect from a overlay fs, so use with care. ++ ++ ++v0-5-10-pre5: ++ ++- implemented directory deleting ++- made parsing of mount options more stable ++- New format of mount options! (See README) ++- I can't reproduce the unknown panic with 2.4.25 anymore, so I'll ++ happily assume it never existed! ++ ++ ++Implemented features: ++--------------------- ++ ++- creating hard links (see BUGS on already existing hard links) ++- lightweight directory renaming ++- renaming device files, pipes, sockets, etc. ++- creating, renaming, deleting of special files ++- deleting directorys ++- general directory reading (simple "ls" ) ++- creating files in existing directorys ++- creating directorys ++- renaming files. ++- reading and writing files (involves opening) ++- appending to files (creates copy in storage) ++- deleting files ++- llseek works too, what allows editors to work ++- persistency (a deleted file stay deleted over remounts) ++- use of symbolic links ++- creating of device files ++ ++ ++Not (yet) implemented features: ++------------------------------- ++ ++- full hard link support. ++ ++ ++ ++BUGS: ++----- ++ ++Hard links in the base file system will be treated as individual ++files, not as links to one inode. ++ ++The main problem with hard links isn't allowing to create them, but ++their pure existence. If you modify a base hard link, the changes made ++will only show up on this link, the other link will remain in the ++original state. I hope to fix this someday. Please note that this does ++not effect the special hard links '.' and '..', that are handled ++seperately by the lower fs. +--- /dev/null ++++ b/fs/mini_fo/state.c +@@ -0,0 +1,620 @@ ++/* ++ * Copyright (C) 2005 Markus Klotzbuecher ++ * ++ * 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 of the License, or (at your option) any later version. ++ */ ++ ++#ifdef HAVE_CONFIG_H ++# include ++#endif /* HAVE_CONFIG_H */ ++ ++#include "fist.h" ++#include "mini_fo.h" ++ ++ ++/* create the storage file, setup new states */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++int create_sto_reg_file(dentry_t *dentry, int mode, struct nameidata *nd) ++#else ++int create_sto_reg_file(dentry_t *dentry, int mode) ++#endif ++{ ++ int err = 0; ++ inode_t *dir; ++ dentry_t *hidden_sto_dentry; ++ dentry_t *hidden_sto_dir_dentry; ++ ++ if(exists_in_storage(dentry)) { ++ printk(KERN_CRIT "mini_fo: create_sto_file: wrong type or state.\n"); ++ err = -EINVAL; ++ goto out; ++ } ++ err = get_neg_sto_dentry(dentry); ++ ++ if (err) { ++ printk(KERN_CRIT "mini_fo: create_sto_file: ERROR getting neg. sto dentry.\n"); ++ goto out; ++ } ++ ++ dir = dentry->d_parent->d_inode; ++ hidden_sto_dentry = dtohd2(dentry); ++ ++ /* lock parent */ ++ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ down(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ ++ err = PTR_ERR(hidden_sto_dir_dentry); ++ if (IS_ERR(hidden_sto_dir_dentry)) ++ goto out; ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++ err = vfs_create(hidden_sto_dir_dentry->d_inode, ++ hidden_sto_dentry, ++ mode, nd); ++#else ++ err = vfs_create(hidden_sto_dir_dentry->d_inode, ++ hidden_sto_dentry, ++ mode); ++#endif ++ if(err) { ++ printk(KERN_CRIT "mini_fo: create_sto_file: ERROR creating sto file.\n"); ++ goto out_lock; ++ } ++ ++ if(!dtohd2(dentry)->d_inode) { ++ printk(KERN_CRIT "mini_fo: create_sto_file: ERROR creating sto file [2].\n"); ++ err = -EINVAL; ++ goto out_lock; ++ } ++ ++ /* interpose the new inode */ ++ if(dtost(dentry) == DELETED) { ++ dtost(dentry) = DEL_REWRITTEN; ++ err = mini_fo_tri_interpose(NULL, hidden_sto_dentry, dentry, dir->i_sb, 0); ++ if(err) ++ goto out_lock; ++ } ++ else if(dtost(dentry) == NON_EXISTANT) { ++ dtost(dentry) = CREATED; ++ err = mini_fo_tri_interpose(dtohd(dentry), hidden_sto_dentry, dentry, dir->i_sb, 0); ++ if(err) ++ goto out_lock; ++ } ++ else if(dtost(dentry) == UNMODIFIED) { ++ dtost(dentry) = MODIFIED; ++ /* interpose on new inode */ ++ if(itohi2(dentry->d_inode) != NULL) { ++ printk(KERN_CRIT "mini_fo: create_sto_file: invalid inode detected.\n"); ++ err = -EINVAL; ++ goto out_lock; ++ } ++ itohi2(dentry->d_inode) = igrab(dtohd2(dentry)->d_inode); ++ } ++ fist_copy_attr_timesizes(dentry->d_parent->d_inode, ++ hidden_sto_dir_dentry->d_inode); ++ ++ out_lock: ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ dput(hidden_sto_dir_dentry); ++ out: ++ return err; ++} ++ ++/* create the sto dir, setup states */ ++int create_sto_dir(dentry_t *dentry, int mode) ++{ ++ int err = 0; ++ inode_t *dir; ++ dentry_t *hidden_sto_dentry; ++ dentry_t *hidden_sto_dir_dentry; ++ ++ /* had to take the "!S_ISDIR(mode))" check out, because it failed */ ++ if(exists_in_storage(dentry)) { ++ printk(KERN_CRIT "mini_fo: create_sto_dir: wrong type or state.\\ ++n"); ++ err = -EINVAL; ++ goto out; ++ } ++ ++ err = get_neg_sto_dentry(dentry); ++ if(err) { ++ err = -EINVAL; ++ goto out; ++ } ++ ++ dir = dentry->d_parent->d_inode; ++ hidden_sto_dentry = dtohd2(dentry); ++ ++ /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */ ++ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ down(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ ++ err = PTR_ERR(hidden_sto_dir_dentry); ++ if (IS_ERR(hidden_sto_dir_dentry)) ++ goto out; ++ ++ err = vfs_mkdir(hidden_sto_dir_dentry->d_inode, ++ hidden_sto_dentry, ++ mode); ++ if(err) { ++ printk(KERN_CRIT "mini_fo: create_sto_dir: ERROR creating sto dir.\n"); ++ goto out_lock; ++ } ++ ++ if(!dtohd2(dentry)->d_inode) { ++ printk(KERN_CRIT "mini_fo: create_sto_dir: ERROR creating sto dir [2].\n"); ++ err = -EINVAL; ++ goto out_lock; ++ } ++ ++ /* interpose the new inode */ ++ if(dtost(dentry) == DELETED) { ++ dtost(dentry) = DEL_REWRITTEN; ++ err = mini_fo_tri_interpose(NULL, hidden_sto_dentry, dentry, dir->i_sb, 0); ++ if(err) ++ goto out_lock; ++ } ++ else if(dtopd(dentry)->state == NON_EXISTANT) { ++ dtopd(dentry)->state = CREATED; ++ err = mini_fo_tri_interpose(dtohd(dentry), hidden_sto_dentry, dentry, dir->i_sb, 0); ++ if(err) ++ goto out_lock; ++ } ++ else if(dtopd(dentry)->state == UNMODIFIED) { ++ dtopd(dentry)->state = MODIFIED; ++ /* interpose on new inode */ ++ if(itohi2(dentry->d_inode) != NULL) { ++ printk(KERN_CRIT "mini_fo: create_sto_dir: ERROR, invalid inode detected.\n"); ++ err = -EINVAL; ++ goto out_lock; ++ } ++ itohi2(dentry->d_inode) = igrab(dtohd2(dentry)->d_inode); ++ } ++ ++ fist_copy_attr_timesizes(dir, hidden_sto_dir_dentry->d_inode); ++ ++ /* initalize the wol list */ ++ itopd(dentry->d_inode)->deleted_list_size = -1; ++ itopd(dentry->d_inode)->renamed_list_size = -1; ++ meta_build_lists(dentry); ++ ++ ++ out_lock: ++ /* was: unlock_dir(hidden_sto_dir_dentry); */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ dput(hidden_sto_dir_dentry); ++ out: ++ return err; ++} ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++int create_sto_nod(dentry_t *dentry, int mode, dev_t dev) ++#else ++int create_sto_nod(dentry_t *dentry, int mode, int dev) ++#endif ++{ ++ int err = 0; ++ inode_t *dir; ++ dentry_t *hidden_sto_dentry; ++ dentry_t *hidden_sto_dir_dentry; ++ ++ if(exists_in_storage(dentry)) { ++ err = -EEXIST; ++ goto out; ++ } ++ err = get_neg_sto_dentry(dentry); ++ ++ if (err) { ++ printk(KERN_CRIT "mini_fo: create_sto_nod: ERROR getting neg. sto dentry.\n"); ++ goto out; ++ } ++ ++ dir = dentry->d_parent->d_inode; ++ hidden_sto_dentry = dtohd2(dentry); ++ ++ /* lock parent */ ++ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ down(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ ++ err = PTR_ERR(hidden_sto_dir_dentry); ++ if (IS_ERR(hidden_sto_dir_dentry)) ++ goto out; ++ ++ err = vfs_mknod(hidden_sto_dir_dentry->d_inode, hidden_sto_dentry, mode, dev); ++ if(err) ++ goto out_lock; ++ ++ if(!dtohd2(dentry)->d_inode) { ++ printk(KERN_CRIT "mini_fo: create_sto_nod: creating storage inode failed [1].\n"); ++ err = -EINVAL; /* return something indicating failure */ ++ goto out_lock; ++ } ++ ++ /* interpose the new inode */ ++ if(dtost(dentry) == DELETED) { ++ dtost(dentry) = DEL_REWRITTEN; ++ err = mini_fo_tri_interpose(NULL, hidden_sto_dentry, dentry, dir->i_sb, 0); ++ if(err) ++ goto out_lock; ++ } ++ else if(dtost(dentry) == NON_EXISTANT) { ++ dtost(dentry) = CREATED; ++ err = mini_fo_tri_interpose(dtohd(dentry), hidden_sto_dentry, dentry, dir->i_sb, 0); ++ if(err) ++ goto out_lock; ++ } ++ else if(dtost(dentry) == UNMODIFIED) { ++ dtost(dentry) = MODIFIED; ++ /* interpose on new inode */ ++ if(itohi2(dentry->d_inode) != NULL) { ++ printk(KERN_CRIT "mini_fo: create_sto_nod: error, invalid inode detected.\n"); ++ err = -EINVAL; ++ goto out_lock; ++ } ++ itohi2(dentry->d_inode) = igrab(dtohd2(dentry)->d_inode); ++ } ++ ++ fist_copy_attr_timesizes(dir, hidden_sto_dir_dentry->d_inode); ++ ++ out_lock: ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ dput(hidden_sto_dir_dentry); ++ out: ++ return err; ++} ++ ++ ++/* unimplemented (and possibly not usefull): ++ ++ nondir-del_to_del_rew ++ nondir-non_exist_to_creat ++ ++ dir-unmod_to_del ++ dir-mod_to_del ++ dir-creat_to_del ++ dir-del_rew_to_del ++ dir-del_to_del_rew ++ dir-non_exist_to_creat ++*/ ++ ++ ++/* bring a file of any type from state UNMODIFIED to MODIFIED */ ++int nondir_unmod_to_mod(dentry_t *dentry, int cp_flag) ++{ ++ int err = 0; ++ struct vfsmount *tgt_mnt; ++ struct vfsmount *src_mnt; ++ dentry_t *tgt_dentry; ++ dentry_t *src_dentry; ++ dentry_t *hidden_sto_dentry; ++ dentry_t *hidden_sto_dir_dentry; ++ ++ check_mini_fo_dentry(dentry); ++ ++ if((dtost(dentry) != UNMODIFIED) || ++ S_ISDIR(dentry->d_inode->i_mode)) { ++ printk(KERN_CRIT "mini_fo: nondir_unmod_to_mod: \ ++ wrong type or state.\n"); ++ err = -1; ++ goto out; ++ } ++ err = get_neg_sto_dentry(dentry); ++ ++ if (err) { ++ printk(KERN_CRIT "mini_fo: nondir_unmod_to_mod: \ ++ ERROR getting neg. sto dentry.\n"); ++ goto out; ++ } ++ ++ /* create sto file */ ++ hidden_sto_dentry = dtohd2(dentry); ++ ++ /* lock parent */ ++ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ down(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ ++ err = PTR_ERR(hidden_sto_dir_dentry); ++ if (IS_ERR(hidden_sto_dir_dentry)) ++ goto out; ++ ++ /* handle different types of nondirs */ ++ if(S_ISCHR(dentry->d_inode->i_mode) || ++ S_ISBLK(dentry->d_inode->i_mode)) { ++ err = vfs_mknod(hidden_sto_dir_dentry->d_inode, ++ hidden_sto_dentry, ++ dtohd(dentry)->d_inode->i_mode, ++ dtohd(dentry)->d_inode->i_rdev); ++ } ++ ++ else if(S_ISREG(dentry->d_inode->i_mode)) { ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++ err = vfs_create(hidden_sto_dir_dentry->d_inode, ++ hidden_sto_dentry, ++ dtohd(dentry)->d_inode->i_mode, NULL); ++#else ++ err = vfs_create(hidden_sto_dir_dentry->d_inode, ++ hidden_sto_dentry, ++ dtohd(dentry)->d_inode->i_mode); ++#endif ++ } ++ if(err) { ++ printk(KERN_CRIT "mini_fo: nondir_unmod_to_mod: \ ++ ERROR creating sto file.\n"); ++ goto out_lock; ++ } ++ ++ /* interpose on new inode */ ++ if(itohi2(dentry->d_inode) != NULL) { ++ printk(KERN_CRIT "mini_fo: nondir_unmod_to_mod: \ ++ ERROR, invalid inode detected.\n"); ++ err = -EINVAL; ++ goto out_lock; ++ } ++ ++ itohi2(dentry->d_inode) = igrab(dtohd2(dentry)->d_inode); ++ ++ fist_copy_attr_timesizes(dentry->d_parent->d_inode, ++ hidden_sto_dir_dentry->d_inode); ++ dtost(dentry) = MODIFIED; ++ ++ /* copy contents if regular file and cp_flag = 1 */ ++ if((cp_flag == 1) && S_ISREG(dentry->d_inode->i_mode)) { ++ ++ /* unlock first */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ ++ dput(hidden_sto_dir_dentry); ++ ++ tgt_dentry = dtohd2(dentry); ++ tgt_mnt = stopd(dentry->d_inode->i_sb)->hidden_mnt2; ++ src_dentry = dtohd(dentry); ++ src_mnt = stopd(dentry->d_inode->i_sb)->hidden_mnt; ++ ++ err = mini_fo_cp_cont(tgt_dentry, tgt_mnt, ++ src_dentry, src_mnt); ++ if(err) { ++ printk(KERN_CRIT "mini_fo: nondir_unmod_to_mod: \ ++ ERROR copying contents.\n"); ++ } ++ goto out; ++ } ++ ++ out_lock: ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ dput(hidden_sto_dir_dentry); ++ out: ++ return err; ++} ++ ++/* this function is currently identical to nondir_creat_to_del */ ++int nondir_del_rew_to_del(dentry_t *dentry) ++{ ++ return nondir_creat_to_del(dentry); ++} ++ ++int nondir_creat_to_del(dentry_t *dentry) ++{ ++ int err = 0; ++ ++ inode_t *hidden_sto_dir_inode; ++ dentry_t *hidden_sto_dir_dentry; ++ dentry_t *hidden_sto_dentry; ++ ++ check_mini_fo_dentry(dentry); ++ ++ /* for now this function serves for both state DEL_REWRITTEN and ++ * CREATED */ ++ if(!(dtost(dentry) == CREATED || (dtost(dentry) == DEL_REWRITTEN)) || ++ S_ISDIR(dentry->d_inode->i_mode)) { ++ printk(KERN_CRIT "mini_fo: nondir_mod_to_del/del_rew_to_del: \ ++ wrong type or state.\n"); ++ err = -1; ++ goto out; ++ } ++ ++ hidden_sto_dir_inode = itohi2(dentry->d_parent->d_inode); ++ hidden_sto_dentry = dtohd2(dentry); ++ ++ /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry);*/ ++ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ down(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ ++ /* avoid destroying the hidden inode if the file is in use */ ++ dget(hidden_sto_dentry); ++ err = vfs_unlink(hidden_sto_dir_inode, hidden_sto_dentry); ++ dput(hidden_sto_dentry); ++ if(!err) ++ d_delete(hidden_sto_dentry); ++ ++ /* propagate number of hard-links */ ++ dentry->d_inode->i_nlink = itohi2(dentry->d_inode)->i_nlink; ++ ++ dtost(dentry) = NON_EXISTANT; ++ ++ /* was: unlock_dir(hidden_sto_dir_dentry); */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ dput(hidden_sto_dir_dentry); ++ ++ out: ++ return err; ++} ++ ++int nondir_mod_to_del(dentry_t *dentry) ++{ ++ int err; ++ dentry_t *hidden_sto_dentry; ++ inode_t *hidden_sto_dir_inode; ++ dentry_t *hidden_sto_dir_dentry; ++ ++ check_mini_fo_dentry(dentry); ++ ++ if(dtost(dentry) != MODIFIED || ++ S_ISDIR(dentry->d_inode->i_mode)) { ++ printk(KERN_CRIT "mini_fo: nondir_mod_to_del: \ ++ wrong type or state.\n"); ++ err = -1; ++ goto out; ++ } ++ ++ hidden_sto_dir_inode = itohi2(dentry->d_parent->d_inode); ++ hidden_sto_dentry = dtohd2(dentry); ++ ++ /* was hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */ ++ hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ down(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ ++ /* avoid destroying the hidden inode if the file is in use */ ++ dget(hidden_sto_dentry); ++ err = vfs_unlink(hidden_sto_dir_inode, hidden_sto_dentry); ++ dput(hidden_sto_dentry); ++ if(!err) ++ d_delete(hidden_sto_dentry); ++ ++ /* propagate number of hard-links */ ++ dentry->d_inode->i_nlink = itohi2(dentry->d_inode)->i_nlink; ++ ++ /* dput base dentry, this will relase the inode and free the ++ * dentry, as we will never need it again. */ ++ dput(dtohd(dentry)); ++ dtohd(dentry) = NULL; ++ dtost(dentry) = DELETED; ++ ++ /* add deleted file to META-file */ ++ meta_add_d_entry(dentry->d_parent, ++ dentry->d_name.name, ++ dentry->d_name.len); ++ ++ /* was: unlock_dir(hidden_sto_dir_dentry); */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else ++ up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ dput(hidden_sto_dir_dentry); ++ ++ out: ++ return err; ++} ++ ++int nondir_unmod_to_del(dentry_t *dentry) ++{ ++ int err = 0; ++ ++ check_mini_fo_dentry(dentry); ++ ++ if(dtost(dentry) != UNMODIFIED || ++ S_ISDIR(dentry->d_inode->i_mode)) { ++ printk(KERN_CRIT "mini_fo: nondir_unmod_to_del: \ ++ wrong type or state.\n"); ++ err = -1; ++ goto out; ++ } ++ ++ /* next we have to get a negative dentry for the storage file */ ++ err = get_neg_sto_dentry(dentry); ++ ++ if(err) ++ goto out; ++ ++ /* add deleted file to META lists */ ++ err = meta_add_d_entry(dentry->d_parent, ++ dentry->d_name.name, ++ dentry->d_name.len); ++ ++ if(err) ++ goto out; ++ ++ /* dput base dentry, this will relase the inode and free the ++ * dentry, as we will never need it again. */ ++ dput(dtohd(dentry)); ++ dtohd(dentry) = NULL; ++ dtost(dentry) = DELETED; ++ ++ out: ++ return err; ++} ++ ++/* bring a dir from state UNMODIFIED to MODIFIED */ ++int dir_unmod_to_mod(dentry_t *dentry) ++{ ++ int err; ++ ++ check_mini_fo_dentry(dentry); ++ ++ if(dtost(dentry) != UNMODIFIED || ++ !S_ISDIR(dentry->d_inode->i_mode)) { ++ printk(KERN_CRIT "mini_fo: dir_unmod_to_mod: \ ++ wrong type or state.\n"); ++ err = -1; ++ goto out; ++ } ++ ++ /* this creates our dir incl. sto. structure */ ++ err = build_sto_structure(dentry->d_parent, dentry); ++ if(err) { ++ printk(KERN_CRIT "mini_fo: dir_unmod_to_mod: \ ++ build_sto_structure failed.\n"); ++ goto out; ++ } ++ out: ++ return err; ++} ++ +--- /dev/null ++++ b/fs/mini_fo/super.c +@@ -0,0 +1,281 @@ ++/* ++ * Copyright (c) 1997-2003 Erez Zadok ++ * Copyright (c) 2001-2003 Stony Brook University ++ * ++ * For specific licensing information, see the COPYING file distributed with ++ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING. ++ * ++ * This Copyright notice must be kept intact and distributed with all ++ * fistgen sources INCLUDING sources generated by fistgen. ++ */ ++/* ++ * Copyright (C) 2004, 2005 Markus Klotzbuecher ++ * ++ * 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 of the License, or (at your option) any later version. ++ */ ++ ++/* ++ * $Id$ ++ */ ++ ++#ifdef HAVE_CONFIG_H ++# include ++#endif ++ ++#include "fist.h" ++#include "mini_fo.h" ++ ++ ++STATIC void ++mini_fo_read_inode(inode_t *inode) ++{ ++ static struct address_space_operations mini_fo_empty_aops; ++ ++ __itopd(inode) = kmalloc(sizeof(struct mini_fo_inode_info), GFP_KERNEL); ++ if (!itopd(inode)) { ++ printk("<0>%s:%s:%d: No kernel memory!\n", __FILE__, __FUNCTION__, __LINE__); ++ ASSERT(NULL); ++ } ++ itohi(inode) = NULL; ++ itohi2(inode) = NULL; ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++ inode->i_version++; ++#else ++ inode->i_version = ++event; /* increment inode version */ ++#endif ++ inode->i_op = &mini_fo_main_iops; ++ inode->i_fop = &mini_fo_main_fops; ++#if 0 ++ /* ++ * XXX: To export a file system via NFS, it has to have the ++ * FS_REQUIRES_DEV flag, so turn it on. But should we inherit it from ++ * the lower file system, or can we allow our file system to be exported ++ * even if the lower one cannot be natively exported. ++ */ ++ inode->i_sb->s_type->fs_flags |= FS_REQUIRES_DEV; ++ /* ++ * OK, the above was a hack, which is now turned off because it may ++ * cause a panic/oops on some systems. The correct way to export a ++ * "nodev" filesystem is via using nfs-utils > 1.0 and the "fsid=" export ++ * parameter, which requires 2.4.20 or later. ++ */ ++#endif ++ /* I don't think ->a_ops is ever allowed to be NULL */ ++ inode->i_mapping->a_ops = &mini_fo_empty_aops; ++} ++ ++ ++#if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) ++/* ++ * No need to call write_inode() on the lower inode, as it ++ * will have been marked 'dirty' anyway. But we might need ++ * to write some of our own stuff to disk. ++ */ ++STATIC void ++mini_fo_write_inode(inode_t *inode, int sync) ++{ ++ print_entry_location(); ++ print_exit_location(); ++} ++#endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */ ++ ++ ++STATIC void ++mini_fo_put_inode(inode_t *inode) ++{ ++ /* ++ * This is really funky stuff: ++ * Basically, if i_count == 1, iput will then decrement it and this inode will be destroyed. ++ * It is currently holding a reference to the hidden inode. ++ * Therefore, it needs to release that reference by calling iput on the hidden inode. ++ * iput() _will_ do it for us (by calling our clear_inode), but _only_ if i_nlink == 0. ++ * The problem is, NFS keeps i_nlink == 1 for silly_rename'd files. ++ * So we must for our i_nlink to 0 here to trick iput() into calling our clear_inode. ++ */ ++ if (atomic_read(&inode->i_count) == 1) ++ inode->i_nlink = 0; ++} ++ ++ ++#if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) ++/* ++ * we now define delete_inode, because there are two VFS paths that may ++ * destroy an inode: one of them calls clear inode before doing everything ++ * else that's needed, and the other is fine. This way we truncate the inode ++ * size (and its pages) and then clear our own inode, which will do an iput ++ * on our and the lower inode. ++ */ ++STATIC void ++mini_fo_delete_inode(inode_t *inode) ++{ ++ print_entry_location(); ++ ++ fist_checkinode(inode, "mini_fo_delete_inode IN"); ++ inode->i_size = 0; /* every f/s seems to do that */ ++ clear_inode(inode); ++ ++ print_exit_location(); ++} ++#endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */ ++ ++ ++/* final actions when unmounting a file system */ ++STATIC void ++mini_fo_put_super(super_block_t *sb) ++{ ++ if (stopd(sb)) { ++ mntput(stopd(sb)->hidden_mnt); ++ mntput(stopd(sb)->hidden_mnt2); ++ ++ /* mk: no! dput(stopd(sb)->base_dir_dentry); ++ dput(stopd(sb)->storage_dir_dentry); */ ++ ++ kfree(stopd(sb)); ++ __stopd(sb) = NULL; ++ } ++} ++ ++ ++#ifdef NOT_NEEDED ++/* ++ * This is called in do_umount before put_super. ++ * The superblock lock is not held yet. ++ * We probably do not need to define this or call write_super ++ * on the hidden_sb, because sync_supers() will get to hidden_sb ++ * sooner or later. But it is also called from file_fsync()... ++ */ ++STATIC void ++mini_fo_write_super(super_block_t *sb) ++{ ++ return; ++} ++#endif /* NOT_NEEDED */ ++ ++ ++STATIC int ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) ++mini_fo_statfs(struct dentry *d, struct kstatfs *buf) ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++mini_fo_statfs(super_block_t *sb, struct kstatfs *buf) ++#else ++mini_fo_statfs(super_block_t *sb, struct statfs *buf) ++#endif ++{ ++ int err = 0; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) ++ struct dentry *hidden_d; ++ ++ hidden_d = dtohd(d); ++ err = vfs_statfs(hidden_d, buf); ++#else ++ super_block_t *hidden_sb; ++ ++ hidden_sb = stohs(sb); ++ err = vfs_statfs(hidden_sb, buf); ++#endif ++ ++ return err; ++} ++ ++ ++/* ++ * XXX: not implemented. This is not allowed yet. ++ * Should we call this on the hidden_sb? Probably not. ++ */ ++STATIC int ++mini_fo_remount_fs(super_block_t *sb, int *flags, char *data) ++{ ++ //printk(KERN_CRIT "mini_fo_remount_fs: WARNING, this function is umimplemented.\n"); ++ return -ENOSYS; ++} ++ ++ ++/* ++ * Called by iput() when the inode reference count reached zero ++ * and the inode is not hashed anywhere. Used to clear anything ++ * that needs to be, before the inode is completely destroyed and put ++ * on the inode free list. ++ */ ++STATIC void ++mini_fo_clear_inode(inode_t *inode) ++{ ++ /* ++ * Decrement a reference to a hidden_inode, which was incremented ++ * by our read_inode when it was created initially. ++ */ ++ ++ /* release the wol_list */ ++ if(S_ISDIR(inode->i_mode)) { ++ __meta_put_lists(inode); ++ } ++ ++ /* mk: fan out fun */ ++ if(itohi(inode)) ++ iput(itohi(inode)); ++ if(itohi2(inode)) ++ iput(itohi2(inode)); ++ ++ // XXX: why this assertion fails? ++ // because it doesn't like us ++ // ASSERT((inode->i_state & I_DIRTY) == 0); ++ kfree(itopd(inode)); ++ __itopd(inode) = NULL; ++} ++ ++ ++/* ++ * Called in do_umount() if the MNT_FORCE flag was used and this ++ * function is defined. See comment in linux/fs/super.c:do_umount(). ++ * Used only in nfs, to kill any pending RPC tasks, so that subsequent ++ * code can actually succeed and won't leave tasks that need handling. ++ * ++ * PS. I wonder if this is somehow useful to undo damage that was ++ * left in the kernel after a user level file server (such as amd) ++ * dies. ++ */ ++STATIC void ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) ++mini_fo_umount_begin(struct vfsmount *mnt, int flags) ++{ ++ struct vfsmount *hidden_mnt; ++ ++ hidden_mnt = stopd(mnt->mnt_sb)->hidden_mnt; ++ ++ if (hidden_mnt->mnt_sb->s_op->umount_begin) ++ hidden_mnt->mnt_sb->s_op->umount_begin(hidden_mnt, flags); ++ ++} ++#else ++mini_fo_umount_begin(super_block_t *sb) ++{ ++ super_block_t *hidden_sb; ++ ++ hidden_sb = stohs(sb); ++ ++ if (hidden_sb->s_op->umount_begin) ++ hidden_sb->s_op->umount_begin(hidden_sb); ++ ++} ++#endif ++ ++ ++struct super_operations mini_fo_sops = ++{ ++ read_inode: mini_fo_read_inode, ++#if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) ++ write_inode: mini_fo_write_inode, ++#endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */ ++ put_inode: mini_fo_put_inode, ++#if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) ++ delete_inode: mini_fo_delete_inode, ++#endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */ ++ put_super: mini_fo_put_super, ++ statfs: mini_fo_statfs, ++ remount_fs: mini_fo_remount_fs, ++ clear_inode: mini_fo_clear_inode, ++ umount_begin: mini_fo_umount_begin, ++}; +--- /dev/null ++++ b/fs/mini_fo/Kconfig +@@ -0,0 +1,3 @@ ++config MINI_FO ++ tristate "Mini fanout overlay filesystem" ++ diff --git a/target/linux/generic-2.6/patches-2.6.32/210-mini_fo_2.6.25_fixes.patch b/target/linux/generic-2.6/patches-2.6.32/210-mini_fo_2.6.25_fixes.patch new file mode 100644 index 000000000..d71e3b6fa --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/210-mini_fo_2.6.25_fixes.patch @@ -0,0 +1,143 @@ +--- a/fs/mini_fo/main.c ++++ b/fs/mini_fo/main.c +@@ -79,6 +79,7 @@ mini_fo_tri_interpose(dentry_t *hidden_d + * of the new inode's fields + */ + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) + /* + * original: inode = iget(sb, hidden_inode->i_ino); + */ +@@ -87,6 +88,13 @@ mini_fo_tri_interpose(dentry_t *hidden_d + err = -EACCES; /* should be impossible??? */ + goto out; + } ++#else ++ inode = mini_fo_iget(sb, iunique(sb, 25)); ++ if (IS_ERR(inode)) { ++ err = PTR_ERR(inode); ++ goto out; ++ } ++#endif + + /* + * interpose the inode if not already interposed +@@ -184,9 +192,9 @@ mini_fo_parse_options(super_block_t *sb, + hidden_root = ERR_PTR(err); + goto out; + } +- hidden_root = nd.dentry; +- stopd(sb)->base_dir_dentry = nd.dentry; +- stopd(sb)->hidden_mnt = nd.mnt; ++ hidden_root = nd_get_dentry(&nd); ++ stopd(sb)->base_dir_dentry = nd_get_dentry(&nd); ++ stopd(sb)->hidden_mnt = nd_get_mnt(&nd); + + } else if(!strncmp("sto=", options, 4)) { + /* parse the storage dir */ +@@ -204,9 +212,9 @@ mini_fo_parse_options(super_block_t *sb, + hidden_root2 = ERR_PTR(err); + goto out; + } +- hidden_root2 = nd2.dentry; +- stopd(sb)->storage_dir_dentry = nd2.dentry; +- stopd(sb)->hidden_mnt2 = nd2.mnt; ++ hidden_root2 = nd_get_dentry(&nd2); ++ stopd(sb)->storage_dir_dentry = nd_get_dentry(&nd2); ++ stopd(sb)->hidden_mnt2 = nd_get_mnt(&nd2); + stohs2(sb) = hidden_root2->d_sb; + + /* validate storage dir, this is done in +--- a/fs/mini_fo/mini_fo.h ++++ b/fs/mini_fo/mini_fo.h +@@ -302,6 +302,10 @@ extern int mini_fo_tri_interpose(dentry_ + extern int mini_fo_cp_cont(dentry_t *tgt_dentry, struct vfsmount *tgt_mnt, + dentry_t *src_dentry, struct vfsmount *src_mnt); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) ++extern struct inode *mini_fo_iget(struct super_block *sb, unsigned long ino); ++#endif ++ + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + extern int mini_fo_create(inode_t *dir, dentry_t *dentry, int mode, struct nameidata *nd); + +@@ -501,6 +505,29 @@ static inline void double_unlock(struct + #endif /* if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */ + #endif /* __KERNEL__ */ + ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) ++static inline dentry_t *nd_get_dentry(struct nameidata *nd) ++{ ++ return (nd->path.dentry); ++} ++ ++static inline struct vfsmount *nd_get_mnt(struct nameidata *nd) ++{ ++ return (nd->path.mnt); ++} ++#else ++static inline dentry_t *nd_get_dentry(struct nameidata *nd) ++{ ++ return (nd->dentry); ++} ++ ++static inline struct vfsmount *nd_get_mnt(struct nameidata *nd) ++{ ++ return (nd->mnt); ++} ++#endif ++ + /* + * Definitions for user and kernel code + */ +--- a/fs/mini_fo/super.c ++++ b/fs/mini_fo/super.c +@@ -262,10 +262,31 @@ mini_fo_umount_begin(super_block_t *sb) + } + #endif + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) ++struct inode * ++mini_fo_iget(struct super_block *sb, unsigned long ino) ++{ ++ struct inode *inode; ++ ++ inode = iget_locked(sb, ino); ++ if (!inode) ++ return ERR_PTR(-ENOMEM); ++ ++ if (!(inode->i_state & I_NEW)) ++ return inode; ++ ++ mini_fo_read_inode(inode); ++ ++ unlock_new_inode(inode); ++ return inode; ++} ++#endif /* if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) */ + + struct super_operations mini_fo_sops = + { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) + read_inode: mini_fo_read_inode, ++#endif + #if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) + write_inode: mini_fo_write_inode, + #endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */ +--- a/fs/mini_fo/aux.c ++++ b/fs/mini_fo/aux.c +@@ -164,11 +164,11 @@ dentry_t *bpath_walk(super_block_t *sb, + err = vfs_path_lookup(mnt->mnt_root, mnt, bpath+1, 0, &nd); + + /* validate */ +- if (err || !nd.dentry || !nd.dentry->d_inode) { ++ if (err || !nd_get_dentry(&nd) || !nd_get_dentry(&nd)->d_inode) { + printk(KERN_CRIT "mini_fo: bpath_walk: path_walk failed.\n"); + return NULL; + } +- return nd.dentry; ++ return nd_get_dentry(&nd); + } + + diff --git a/target/linux/generic-2.6/patches-2.6.32/211-mini_fo_2.6.25_dentry_open_war.patch b/target/linux/generic-2.6/patches-2.6.32/211-mini_fo_2.6.25_dentry_open_war.patch new file mode 100644 index 000000000..48a19429b --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/211-mini_fo_2.6.25_dentry_open_war.patch @@ -0,0 +1,66 @@ +--- a/fs/mini_fo/meta.c ++++ b/fs/mini_fo/meta.c +@@ -442,6 +442,11 @@ int meta_write_d_entry(dentry_t *dentry, + S_IRUSR | S_IWUSR); + #endif + } ++ ++ /* $%& err, is this correct? */ ++ meta_mnt = stopd(dentry->d_inode->i_sb)->hidden_mnt2; ++ mntget(meta_mnt); ++ + /* open META-file for writing */ + meta_file = dentry_open(meta_dentry, meta_mnt, 0x1); + if(!meta_file || IS_ERR(meta_file)) { +@@ -535,6 +540,11 @@ int meta_write_r_entry(dentry_t *dentry, + meta_dentry, S_IRUSR | S_IWUSR); + #endif + } ++ ++ /* $%& err, is this correct? */ ++ meta_mnt = stopd(dentry->d_inode->i_sb)->hidden_mnt2; ++ mntget(meta_mnt); ++ + /* open META-file for writing */ + meta_file = dentry_open(meta_dentry, meta_mnt, 0x1); + if(!meta_file || IS_ERR(meta_file)) { +@@ -671,14 +681,16 @@ int meta_sync_d_list(dentry_t *dentry, i + } + } + ++ /* $%& err, is this correct? */ ++ meta_mnt = stopd(dentry->d_inode->i_sb)->hidden_mnt2; ++ mntget(meta_mnt); ++ + /* open META-file for writing */ + meta_file = dentry_open(meta_dentry, meta_mnt, 0x1); + if(!meta_file || IS_ERR(meta_file)) { + printk(KERN_CRIT "mini_fo: meta_sync_d_list: \ + ERROR opening meta file.\n"); +- /* we don't mntget so we dont't mntput (for now) +- * mntput(meta_mnt); +- */ ++ mntput(meta_mnt); + dput(meta_dentry); + err = -1; + goto out; +@@ -811,14 +823,16 @@ int meta_sync_r_list(dentry_t *dentry, i + } + } + ++ /* $%& err, is this correct? */ ++ meta_mnt = stopd(dentry->d_inode->i_sb)->hidden_mnt2; ++ mntget(meta_mnt); ++ + /* open META-file for writing */ + meta_file = dentry_open(meta_dentry, meta_mnt, 0x1); + if(!meta_file || IS_ERR(meta_file)) { + printk(KERN_CRIT "mini_fo: meta_sync_r_list: \ + ERROR opening meta file.\n"); +- /* we don't mntget so we dont't mntput (for now) +- * mntput(meta_mnt); +- */ ++ mntput(meta_mnt); + dput(meta_dentry); + err = -1; + goto out; diff --git a/target/linux/generic-2.6/patches-2.6.32/212-mini_fo_2.6.26_fixes.patch b/target/linux/generic-2.6/patches-2.6.32/212-mini_fo_2.6.26_fixes.patch new file mode 100644 index 000000000..8bd9ba324 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/212-mini_fo_2.6.26_fixes.patch @@ -0,0 +1,37 @@ +--- a/fs/mini_fo/super.c ++++ b/fs/mini_fo/super.c +@@ -84,6 +84,7 @@ mini_fo_write_inode(inode_t *inode, int + #endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */ + + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) + STATIC void + mini_fo_put_inode(inode_t *inode) + { +@@ -99,6 +100,7 @@ mini_fo_put_inode(inode_t *inode) + if (atomic_read(&inode->i_count) == 1) + inode->i_nlink = 0; + } ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) */ + + + #if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) +@@ -238,7 +240,7 @@ mini_fo_clear_inode(inode_t *inode) + * dies. + */ + STATIC void +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) + mini_fo_umount_begin(struct vfsmount *mnt, int flags) + { + struct vfsmount *hidden_mnt; +@@ -290,7 +292,9 @@ struct super_operations mini_fo_sops = + #if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) + write_inode: mini_fo_write_inode, + #endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) + put_inode: mini_fo_put_inode, ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) */ + #if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) + delete_inode: mini_fo_delete_inode, + #endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */ diff --git a/target/linux/generic-2.6/patches-2.6.32/213-mini_fo_2.6.27_fixes.patch b/target/linux/generic-2.6/patches-2.6.32/213-mini_fo_2.6.27_fixes.patch new file mode 100644 index 000000000..f92c18b25 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/213-mini_fo_2.6.27_fixes.patch @@ -0,0 +1,41 @@ +--- a/fs/mini_fo/inode.c ++++ b/fs/mini_fo/inode.c +@@ -439,7 +439,7 @@ mini_fo_symlink(inode_t *dir, dentry_t * + int err=0; + dentry_t *hidden_sto_dentry; + dentry_t *hidden_sto_dir_dentry; +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) + umode_t mode; + #endif + +@@ -466,7 +466,7 @@ mini_fo_symlink(inode_t *dir, dentry_t * + down(&hidden_sto_dir_dentry->d_inode->i_sem); + #endif + +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) + mode = S_IALLUGO; + err = vfs_symlink(hidden_sto_dir_dentry->d_inode, + hidden_sto_dentry, symname, mode); +@@ -1128,7 +1128,7 @@ void mini_fo_put_link(struct dentry *den + #endif + + STATIC int +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) + mini_fo_permission(inode_t *inode, int mask, struct nameidata *nd) + #else + mini_fo_permission(inode_t *inode, int mask) +@@ -1150,8 +1150,9 @@ mini_fo_permission(inode_t *inode, int m + * if (err) + * goto out; + */ +- +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) ++ err = inode_permission(hidden_inode, mask); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + err = permission(hidden_inode, mask, nd); + #else + err = permission(hidden_inode, mask); diff --git a/target/linux/generic-2.6/patches-2.6.32/214-mini_fo_2.6.29.patch b/target/linux/generic-2.6/patches-2.6.32/214-mini_fo_2.6.29.patch new file mode 100644 index 000000000..63d704bf5 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/214-mini_fo_2.6.29.patch @@ -0,0 +1,96 @@ +--- a/fs/mini_fo/aux.c ++++ b/fs/mini_fo/aux.c +@@ -236,7 +236,7 @@ int mini_fo_cp_cont(dentry_t *tgt_dentry + mntget(src_mnt); + + /* open file write only */ +- tgt_file = dentry_open(tgt_dentry, tgt_mnt, 0x1); ++ tgt_file = dentry_open(tgt_dentry, tgt_mnt, 0x1, current_cred()); + if(!tgt_file || IS_ERR(tgt_file)) { + printk(KERN_CRIT "mini_fo_cp_cont: ERROR opening target file.\n"); + err = PTR_ERR(tgt_file); +@@ -244,7 +244,7 @@ int mini_fo_cp_cont(dentry_t *tgt_dentry + } + + /* open file read only */ +- src_file = dentry_open(src_dentry, src_mnt, 0x0); ++ src_file = dentry_open(src_dentry, src_mnt, 0x0, current_cred()); + if(!src_file || IS_ERR(src_file)) { + printk(KERN_CRIT "mini_fo_cp_cont: ERROR opening source file.\n"); + err = PTR_ERR(src_file); +--- a/fs/mini_fo/file.c ++++ b/fs/mini_fo/file.c +@@ -437,7 +437,7 @@ mini_fo_open(inode_t *inode, file_t *fil + mntget(stopd(inode->i_sb)->hidden_mnt); + hidden_file = dentry_open(hidden_dentry, + stopd(inode->i_sb)->hidden_mnt, +- hidden_flags); ++ hidden_flags, file->f_cred); + if (IS_ERR(hidden_file)) { + err = PTR_ERR(hidden_file); + dput(hidden_dentry); +@@ -479,7 +479,7 @@ mini_fo_open(inode_t *inode, file_t *fil + mntget(stopd(inode->i_sb)->hidden_mnt); + hidden_file = dentry_open(hidden_dentry, + stopd(inode->i_sb)->hidden_mnt, +- hidden_flags); ++ hidden_flags, file->f_cred); + if (IS_ERR(hidden_file)) { + err = PTR_ERR(hidden_file); + dput(hidden_dentry); +@@ -512,7 +512,7 @@ mini_fo_open(inode_t *inode, file_t *fil + mntget(stopd(inode->i_sb)->hidden_mnt2); + hidden_sto_file = dentry_open(hidden_sto_dentry, + stopd(inode->i_sb)->hidden_mnt2, +- hidden_flags); ++ hidden_flags, file->f_cred); + + /* dentry_open dputs the dentry if it fails */ + if (IS_ERR(hidden_sto_file)) { +--- a/fs/mini_fo/meta.c ++++ b/fs/mini_fo/meta.c +@@ -56,7 +56,7 @@ int meta_build_lists(dentry_t *dentry) + + + /* open META-file for reading */ +- meta_file = dentry_open(meta_dentry, meta_mnt, 0x0); ++ meta_file = dentry_open(meta_dentry, meta_mnt, 0x0, current_cred()); + if(!meta_file || IS_ERR(meta_file)) { + printk(KERN_CRIT "mini_fo: meta_build_lists: \ + ERROR opening META file.\n"); +@@ -448,7 +448,7 @@ int meta_write_d_entry(dentry_t *dentry, + mntget(meta_mnt); + + /* open META-file for writing */ +- meta_file = dentry_open(meta_dentry, meta_mnt, 0x1); ++ meta_file = dentry_open(meta_dentry, meta_mnt, 0x1, current_cred()); + if(!meta_file || IS_ERR(meta_file)) { + printk(KERN_CRIT "mini_fo: meta_write_d_entry: \ + ERROR opening meta file.\n"); +@@ -546,7 +546,7 @@ int meta_write_r_entry(dentry_t *dentry, + mntget(meta_mnt); + + /* open META-file for writing */ +- meta_file = dentry_open(meta_dentry, meta_mnt, 0x1); ++ meta_file = dentry_open(meta_dentry, meta_mnt, 0x1, current_cred()); + if(!meta_file || IS_ERR(meta_file)) { + printk(KERN_CRIT "mini_fo: meta_write_r_entry: \ + ERROR opening meta file.\n"); +@@ -686,7 +686,7 @@ int meta_sync_d_list(dentry_t *dentry, i + mntget(meta_mnt); + + /* open META-file for writing */ +- meta_file = dentry_open(meta_dentry, meta_mnt, 0x1); ++ meta_file = dentry_open(meta_dentry, meta_mnt, 0x1, current_cred()); + if(!meta_file || IS_ERR(meta_file)) { + printk(KERN_CRIT "mini_fo: meta_sync_d_list: \ + ERROR opening meta file.\n"); +@@ -828,7 +828,7 @@ int meta_sync_r_list(dentry_t *dentry, i + mntget(meta_mnt); + + /* open META-file for writing */ +- meta_file = dentry_open(meta_dentry, meta_mnt, 0x1); ++ meta_file = dentry_open(meta_dentry, meta_mnt, 0x1, current_cred()); + if(!meta_file || IS_ERR(meta_file)) { + printk(KERN_CRIT "mini_fo: meta_sync_r_list: \ + ERROR opening meta file.\n"); diff --git a/target/linux/generic-2.6/patches-2.6.32/215-mini_fo_2.6.30.patch b/target/linux/generic-2.6/patches-2.6.32/215-mini_fo_2.6.30.patch new file mode 100644 index 000000000..2d2092061 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/215-mini_fo_2.6.30.patch @@ -0,0 +1,157 @@ +--- a/fs/mini_fo/aux.c ++++ b/fs/mini_fo/aux.c +@@ -86,8 +86,10 @@ int get_neg_sto_dentry(dentry_t *dentry) + len = dentry->d_name.len; + name = dentry->d_name.name; + ++ mutex_lock(&dtohd2(dentry->d_parent)->d_inode->i_mutex); + dtohd2(dentry) = + lookup_one_len(name, dtohd2(dentry->d_parent), len); ++ mutex_unlock(&dtohd2(dentry->d_parent)->d_inode->i_mutex); + + out: + return err; +@@ -426,7 +428,9 @@ int build_sto_structure(dentry_t *dir, d + const unsigned char *name; + len = dtohd(dentry)->d_name.len; + name = dtohd(dentry)->d_name.name; ++ mutex_lock(&dtohd2(dir)->d_inode->i_mutex); + hidden_sto_dentry = lookup_one_len(name, dtohd2(dir), len); ++ mutex_unlock(&dtohd2(dir)->d_inode->i_mutex); + dtohd2(dentry) = hidden_sto_dentry; + } + +--- a/fs/mini_fo/inode.c ++++ b/fs/mini_fo/inode.c +@@ -113,17 +113,23 @@ mini_fo_lookup(inode_t *dir, dentry_t *d + hidden_dir_dentry = hidden_dentry->d_parent; + kfree(bpath); + } +- else if(hidden_dir_dentry && hidden_dir_dentry->d_inode) ++ else if(hidden_dir_dentry && hidden_dir_dentry->d_inode) { ++ mutex_lock(&hidden_dir_dentry->d_inode->i_mutex); + hidden_dentry = + lookup_one_len(name, hidden_dir_dentry, namelen); +- else ++ mutex_unlock(&hidden_dir_dentry->d_inode->i_mutex); ++ } else { + hidden_dentry = NULL; ++ } + +- if(hidden_sto_dir_dentry && hidden_sto_dir_dentry->d_inode) ++ if(hidden_sto_dir_dentry && hidden_sto_dir_dentry->d_inode) { ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); + hidden_sto_dentry = + lookup_one_len(name, hidden_sto_dir_dentry, namelen); +- else ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++ } else { + hidden_sto_dentry = NULL; ++ } + + /* catch error in lookup */ + if (IS_ERR(hidden_dentry) || IS_ERR(hidden_sto_dentry)) { +@@ -553,9 +559,11 @@ mini_fo_rmdir(inode_t *dir, dentry_t *de + #endif + + /* Delete an old WOL file contained in the storage dir */ ++ mutex_lock(&hidden_sto_dentry->d_inode->i_mutex); + meta_dentry = lookup_one_len(META_FILENAME, + hidden_sto_dentry, + strlen(META_FILENAME)); ++ mutex_unlock(&hidden_sto_dentry->d_inode->i_mutex); + if(meta_dentry->d_inode) { + err = vfs_unlink(hidden_sto_dentry->d_inode, meta_dentry); + dput(meta_dentry); +@@ -643,9 +651,11 @@ mini_fo_rmdir(inode_t *dir, dentry_t *de + #endif + + /* Delete an old WOL file contained in the storage dir */ ++ mutex_lock(&hidden_sto_dentry->d_inode->i_mutex); + meta_dentry = lookup_one_len(META_FILENAME, + hidden_sto_dentry, + strlen(META_FILENAME)); ++ mutex_unlock(&hidden_sto_dentry->d_inode->i_mutex); + if(meta_dentry->d_inode) { + /* is this necessary? dget(meta_dentry); */ + err = vfs_unlink(hidden_sto_dentry->d_inode, +@@ -688,9 +698,11 @@ mini_fo_rmdir(inode_t *dir, dentry_t *de + #endif + + /* Delete an old WOL file contained in the storage dir */ ++ mutex_lock(&hidden_sto_dentry->d_inode->i_mutex); + meta_dentry = lookup_one_len(META_FILENAME, + hidden_sto_dentry, + strlen(META_FILENAME)); ++ mutex_unlock(&hidden_sto_dentry->d_inode->i_mutex); + if(meta_dentry->d_inode) { + /* is this necessary? dget(meta_dentry); */ + err = vfs_unlink(hidden_sto_dentry->d_inode, +--- a/fs/mini_fo/meta.c ++++ b/fs/mini_fo/meta.c +@@ -43,9 +43,11 @@ int meta_build_lists(dentry_t *dentry) + + /* might there be a META-file? */ + if(dtohd2(dentry) && dtohd2(dentry)->d_inode) { ++ mutex_lock(&dtohd2(dentry)->d_inode->i_mutex); + meta_dentry = lookup_one_len(META_FILENAME, + dtohd2(dentry), + strlen(META_FILENAME)); ++ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex); + if(!meta_dentry->d_inode) { + dput(meta_dentry); + goto out_ok; +@@ -426,8 +428,11 @@ int meta_write_d_entry(dentry_t *dentry, + goto out; + } + } ++ ++ mutex_lock(&dtohd2(dentry)->d_inode->i_mutex); + meta_dentry = lookup_one_len(META_FILENAME, + dtohd2(dentry), strlen (META_FILENAME)); ++ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex); + + /* We need to create a META-file */ + if(!meta_dentry->d_inode) { +@@ -527,9 +532,13 @@ int meta_write_r_entry(dentry_t *dentry, + goto out; + } + } ++ ++ mutex_lock(&dtohd2(dentry)->d_inode->i_mutex); + meta_dentry = lookup_one_len(META_FILENAME, + dtohd2(dentry), + strlen (META_FILENAME)); ++ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex); ++ + if(!meta_dentry->d_inode) { + /* We need to create a META-file */ + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) +@@ -641,9 +650,13 @@ int meta_sync_d_list(dentry_t *dentry, i + goto out; + } + } ++ ++ mutex_lock(&dtohd2(dentry)->d_inode->i_mutex); + meta_dentry = lookup_one_len(META_FILENAME, + dtohd2(dentry), + strlen(META_FILENAME)); ++ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex); ++ + if(!meta_dentry->d_inode) { + /* We need to create a META-file */ + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) +@@ -784,9 +797,13 @@ int meta_sync_r_list(dentry_t *dentry, i + goto out; + } + } ++ ++ mutex_lock(&dtohd2(dentry)->d_inode->i_mutex); + meta_dentry = lookup_one_len(META_FILENAME, + dtohd2(dentry), + strlen(META_FILENAME)); ++ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex); ++ + if(!meta_dentry->d_inode) { + /* We need to create a META-file */ + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) diff --git a/target/linux/generic-2.6/patches-2.6.32/219-kobject_uevent.patch b/target/linux/generic-2.6/patches-2.6.32/219-kobject_uevent.patch new file mode 100644 index 000000000..7e00b224c --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/219-kobject_uevent.patch @@ -0,0 +1,42 @@ +--- a/lib/kobject_uevent.c ++++ b/lib/kobject_uevent.c +@@ -29,7 +29,8 @@ u64 uevent_seqnum; + char uevent_helper[UEVENT_HELPER_PATH_LEN] = CONFIG_UEVENT_HELPER_PATH; + static DEFINE_SPINLOCK(sequence_lock); + #if defined(CONFIG_NET) +-static struct sock *uevent_sock; ++struct sock *uevent_sock = NULL; ++EXPORT_SYMBOL_GPL(uevent_sock); + #endif + + /* the strings here must match the enum in include/linux/kobject.h */ +@@ -42,6 +43,18 @@ static const char *kobject_actions[] = { + [KOBJ_OFFLINE] = "offline", + }; + ++u64 uevent_next_seqnum(void) ++{ ++ u64 seq; ++ ++ spin_lock(&sequence_lock); ++ seq = ++uevent_seqnum; ++ spin_unlock(&sequence_lock); ++ ++ return seq; ++} ++EXPORT_SYMBOL_GPL(uevent_next_seqnum); ++ + /** + * kobject_action_type - translate action string to numeric type + * +@@ -201,9 +214,7 @@ int kobject_uevent_env(struct kobject *k + kobj->state_remove_uevent_sent = 1; + + /* we will send an event, so request a new sequence number */ +- spin_lock(&sequence_lock); +- seq = ++uevent_seqnum; +- spin_unlock(&sequence_lock); ++ seq = uevent_next_seqnum(); + retval = add_uevent_var(env, "SEQNUM=%llu", (unsigned long long)seq); + if (retval) + goto exit; diff --git a/target/linux/generic-2.6/patches-2.6.32/220-sound_kconfig.patch b/target/linux/generic-2.6/patches-2.6.32/220-sound_kconfig.patch new file mode 100644 index 000000000..f374009a6 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/220-sound_kconfig.patch @@ -0,0 +1,11 @@ +--- a/sound/core/Kconfig ++++ b/sound/core/Kconfig +@@ -7,7 +7,7 @@ config SND_PCM + select SND_TIMER + + config SND_HWDEP +- tristate ++ tristate "Sound hardware support" + + config SND_RAWMIDI + tristate diff --git a/target/linux/generic-2.6/patches-2.6.32/221-binfmt_elf_gcc4.1.patch b/target/linux/generic-2.6/patches-2.6.32/221-binfmt_elf_gcc4.1.patch new file mode 100644 index 000000000..fa891e0f3 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/221-binfmt_elf_gcc4.1.patch @@ -0,0 +1,11 @@ +--- a/fs/binfmt_elf.c ++++ b/fs/binfmt_elf.c +@@ -1193,7 +1193,7 @@ static unsigned long vma_dump_size(struc + if (FILTER(ELF_HEADERS) && + vma->vm_pgoff == 0 && (vma->vm_flags & VM_READ)) { + u32 __user *header = (u32 __user *) vma->vm_start; +- u32 word; ++ u32 word = 0; + mm_segment_t fs = get_fs(); + /* + * Doing it this way gets the constant folded by GCC. diff --git a/target/linux/generic-2.6/patches-2.6.32/222-partial_eraseblock_write.patch b/target/linux/generic-2.6/patches-2.6.32/222-partial_eraseblock_write.patch new file mode 100644 index 000000000..0c7672e8b --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/222-partial_eraseblock_write.patch @@ -0,0 +1,146 @@ +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -21,6 +21,8 @@ + #include + #include + ++#define MTD_ERASE_PARTIAL 0x8000 /* partition only covers parts of an erase block */ ++ + /* Our partition linked list */ + static LIST_HEAD(mtd_partitions); + +@@ -226,13 +228,60 @@ static int part_erase(struct mtd_info *m + return -EROFS; + if (instr->addr >= mtd->size) + return -EINVAL; ++ ++ instr->partial_start = false; ++ if (mtd->flags & MTD_ERASE_PARTIAL) { ++ size_t readlen = 0; ++ u64 mtd_ofs; ++ ++ instr->erase_buf = kmalloc(part->master->erasesize, GFP_ATOMIC); ++ if (!instr->erase_buf) ++ return -ENOMEM; ++ ++ mtd_ofs = part->offset + instr->addr; ++ instr->erase_buf_ofs = do_div(mtd_ofs, part->master->erasesize); ++ ++ if (instr->erase_buf_ofs > 0) { ++ instr->addr -= instr->erase_buf_ofs; ++ ret = part->master->read(part->master, ++ instr->addr + part->offset, ++ part->master->erasesize, ++ &readlen, instr->erase_buf); ++ ++ instr->partial_start = true; ++ } else { ++ mtd_ofs = part->offset + part->mtd.size; ++ instr->erase_buf_ofs = part->master->erasesize - ++ do_div(mtd_ofs, part->master->erasesize); ++ ++ if (instr->erase_buf_ofs > 0) { ++ instr->len += instr->erase_buf_ofs; ++ ret = part->master->read(part->master, ++ part->offset + instr->addr + ++ instr->len - part->master->erasesize, ++ part->master->erasesize, &readlen, ++ instr->erase_buf); ++ } else { ++ ret = 0; ++ } ++ } ++ if (ret < 0) { ++ kfree(instr->erase_buf); ++ return ret; ++ } ++ ++ } ++ + instr->addr += part->offset; + ret = part->master->erase(part->master, instr); + if (ret) { + if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) + instr->fail_addr -= part->offset; + instr->addr -= part->offset; ++ if (mtd->flags & MTD_ERASE_PARTIAL) ++ kfree(instr->erase_buf); + } ++ + return ret; + } + +@@ -240,7 +289,25 @@ void mtd_erase_callback(struct erase_inf + { + if (instr->mtd->erase == part_erase) { + struct mtd_part *part = PART(instr->mtd); ++ size_t wrlen = 0; + ++ if (instr->mtd->flags & MTD_ERASE_PARTIAL) { ++ if (instr->partial_start) { ++ part->master->write(part->master, ++ instr->addr, instr->erase_buf_ofs, ++ &wrlen, instr->erase_buf); ++ instr->addr += instr->erase_buf_ofs; ++ } else { ++ instr->len -= instr->erase_buf_ofs; ++ part->master->write(part->master, ++ instr->addr + instr->len, ++ instr->erase_buf_ofs, &wrlen, ++ instr->erase_buf + ++ part->master->erasesize - ++ instr->erase_buf_ofs); ++ } ++ kfree(instr->erase_buf); ++ } + if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) + instr->fail_addr -= part->offset; + instr->addr -= part->offset; +@@ -473,18 +540,24 @@ static struct mtd_part *add_one_partitio + if ((slave->mtd.flags & MTD_WRITEABLE) && + mtd_mod_by_eb(slave->offset, &slave->mtd)) { + /* Doesn't start on a boundary of major erase size */ +- /* FIXME: Let it be writable if it is on a boundary of +- * _minor_ erase size though */ +- slave->mtd.flags &= ~MTD_WRITEABLE; +- printk(KERN_WARNING"mtd: partition \"%s\" doesn't start on an erase block boundary -- force read-only\n", +- part->name); ++ slave->mtd.flags |= MTD_ERASE_PARTIAL; ++ if (((u32) slave->mtd.size) > master->erasesize) ++ slave->mtd.flags &= ~MTD_WRITEABLE; ++ else ++ slave->mtd.erasesize = slave->mtd.size; + } + if ((slave->mtd.flags & MTD_WRITEABLE) && +- mtd_mod_by_eb(slave->mtd.size, &slave->mtd)) { +- slave->mtd.flags &= ~MTD_WRITEABLE; +- printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase block -- force read-only\n", +- part->name); +- } ++ mtd_mod_by_eb(slave->offset + slave->mtd.size, &slave->mtd)) { ++ slave->mtd.flags |= MTD_ERASE_PARTIAL; ++ ++ if ((u32) slave->mtd.size > master->erasesize) ++ slave->mtd.flags &= ~MTD_WRITEABLE; ++ else ++ slave->mtd.erasesize = slave->mtd.size; ++ } ++ if ((slave->mtd.flags & (MTD_ERASE_PARTIAL|MTD_WRITEABLE)) == MTD_ERASE_PARTIAL) ++ printk(KERN_WARNING"mtd: partition \"%s\" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only\n", ++ part->name); + + slave->mtd.ecclayout = master->ecclayout; + if (master->block_isbad) { +--- a/include/linux/mtd/mtd.h ++++ b/include/linux/mtd/mtd.h +@@ -46,6 +46,10 @@ struct erase_info { + u_long priv; + u_char state; + struct erase_info *next; ++ ++ u8 *erase_buf; ++ u32 erase_buf_ofs; ++ bool partial_start; + }; + + struct mtd_erase_region_info { diff --git a/target/linux/generic-2.6/patches-2.6.32/230-union_mounts.patch b/target/linux/generic-2.6/patches-2.6.32/230-union_mounts.patch new file mode 100644 index 000000000..23236a07c --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/230-union_mounts.patch @@ -0,0 +1,5203 @@ +--- /dev/null ++++ b/Documentation/filesystems/union-mounts.txt +@@ -0,0 +1,187 @@ ++VFS based Union Mounts ++---------------------- ++ ++ 1. What are "Union Mounts" ++ 2. The Union Stack ++ 3. Whiteouts, Opaque Directories, and Fallthrus ++ 4. Copy-up ++ 5. Directory Reading ++ 6. Known Problems ++ 7. References ++ ++------------------------------------------------------------------------------- ++ ++1. What are "Union Mounts" ++========================== ++ ++Please note: this is NOT about UnionFS and it is NOT derived work! ++ ++Traditionally the mount operation is opaque, which means that the content of ++the mount point, the directory where the file system is mounted on, is hidden ++by the content of the mounted file system's root directory until the file ++system is unmounted again. Unlike the traditional UNIX mount mechanism, that ++hides the contents of the mount point, a union mount presents a view as if ++both filesystems are merged together. Although only the topmost layer of the ++mount stack can be altered, it appears as if transparent file system mounts ++allow any file to be created, modified or deleted. ++ ++Most people know the concepts and features of union mounts from other ++operating systems like Sun's Translucent Filesystem, Plan9 or BSD. For an ++in-depth review of union mounts and other unioning file systems, see: ++ ++http://lwn.net/Articles/324291/ ++http://lwn.net/Articles/325369/ ++http://lwn.net/Articles/327738/ ++ ++Here are the key features of this implementation: ++- completely VFS based ++- does not change the namespace stacking ++- directory listings have duplicate entries removed in the kernel ++- writable unions: only the topmost file system layer may be writable ++- writable unions: new whiteout filetype handled inside the kernel ++ ++------------------------------------------------------------------------------- ++ ++2. The Union Stack ++================== ++ ++The mounted file systems are organized in the "file system hierarchy" (tree of ++vfsmount structures), which keeps track about the stacking of file systems ++upon each other. The per-directory view on the file system hierarchy is called ++"mount stack" and reflects the order of file systems, which are mounted on a ++specific directory. ++ ++Union mounts present a single unified view of the contents of two or more file ++systems as if they are merged together. Since the information which file ++system objects are part of a unified view is not directly available from the ++file system hierarchy there is a need for a new structure. The file system ++objects, which are part of a unified view are ordered in a so-called "union ++stack". Only directories can be part of a unified view. ++ ++The link between two layers of the union stack is maintained using the ++union_mount structure (#include ): ++ ++struct union_mount { ++ atomic_t u_count; /* reference count */ ++ struct mutex u_mutex; ++ struct list_head u_unions; /* list head for d_unions */ ++ struct hlist_node u_hash; /* list head for searching */ ++ struct hlist_node u_rhash; /* list head for reverse searching */ ++ ++ struct path u_this; /* this is me */ ++ struct path u_next; /* this is what I overlay */ ++}; ++ ++The union_mount structure holds a reference (dget,mntget) to the next lower ++layer of the union stack. Since a dentry can be part of multiple unions ++(e.g. with bind mounts) they are tied together via the d_unions field of the ++dentry structure. ++ ++All union_mount structures are cached in two hash tables, one for lookups of ++the next lower layer of the union stack and one for reverse lookups of the ++next upper layer of the union stack. The reverse lookup is necessary to ++resolve CWD relative path lookups. For calculation of the hash value, the ++(dentry,vfsmount) pair is used. The u_this field is used for the hash table ++which is used in forward lookups and the u_next field for the reverse lookups. ++ ++During every new mount (or mount propagation), a new union_mount structure is ++allocated. A reference to the mountpoint's vfsmount and dentry is taken and ++stored in the u_next field. In almost the same manner an union_mount ++structure is created during the first time lookup of a directory within a ++union mount point. In this case the lookup proceeds to all lower layers of the ++union. Therefore the complete union stack is constructed during lookups. ++ ++The union_mount structures of a dentry are destroyed when the dentry itself is ++destroyed. Therefore the dentry cache is indirectly driving the union_mount ++cache like this is done for inodes too. Please note that lower layer ++union_mount structures are kept in memory until the topmost dentry is ++destroyed. ++ ++------------------------------------------------------------------------------- ++ ++3. Whiteouts, Opaque Directories, and Fallthrus ++=========================================================== ++ ++The whiteout filetype isn't new. It has been there for quite some time now ++but Linux's VFS hasn't used it yet. With the availability of union mount code ++inside the VFS the whiteout filetype is getting important to support writable ++union mounts. For read-only union mounts, support for whiteouts or ++copy-on-open is not necessary. ++ ++The whiteout filetype has the same function as negative dentries: they ++describe a filename which isn't there. The creation of whiteouts needs ++lowlevel filesystem support. At the time of writing this, there is whiteout ++support for tmpfs, ext2 and ext3 available. The VFS is extended to make the ++whiteout handling transparent to all its users. The whiteouts are not ++visible to user-space. ++ ++What happens when we create a directory that was previously whited-out? We ++don't want the directory entries from underlying filesystems to suddenly appear ++in the newly created directory. So we mark the directory opaque (the file ++system must support storage of the opaque flag). ++ ++Fallthrus are directory entries that override the opaque flag on a directory ++for that specific directory entry name (the lookup "falls through" to the next ++layer of the union mount). Fallthrus are mainly useful for implementing ++readdir(). ++ ++------------------------------------------------------------------------------- ++ ++4. Copy-up ++=========== ++ ++Any write to an object on any layer other than the topmost triggers a copy-up ++of the object to the topmost file system. For regular files, the copy-up ++happens when it is opened in writable mode. ++ ++Directories are copied up on open, regardless of intent to write, to simplify ++copy-up of any object located below it in the namespace. Otherwise we have to ++walk the entire pathname to create intermediate directories whenever we do a ++copy-up. This is the same approach as BSD union mounts and uses a negigible ++amount of disk space. Note that the actual directory entries themselves are ++not copied-up from the lower levels until (a) the directory is written to, or ++(b) the first readdir() of the directory (more on that later). ++ ++Rename across different levels of the union is implemented as a copy-up ++operation for regular files. Rename of directories simply returns EXDEV, the ++same as if we tried to rename across different mounts. Most applications have ++to handle this case anyway. Some applications do not expect EXDEV on ++rename operations within the same directory, but these applications will also ++be broken with bind mounts. ++ ++------------------------------------------------------------------------------- ++ ++5. Directory Reading ++==================== ++ ++readdir() is somewhat difficult to implement in a unioning file system. We must ++eliminate duplicates, apply whiteouts, and start up readdir() where we left ++off, given a single f_pos value. Our solution is to copy up all the directory ++entries to the topmost directory the first time readdir() is called on a ++directory. During this copy-up, we skip duplicates and entries covered by ++whiteouts, and then create fallthru entries for each remaining visible dentry. ++Then we mark the whole directory opaque. From then on, we just use the topmost ++file system's normal readdir() operation. ++ ++------------------------------------------------------------------------------- ++ ++6. Known Problems ++================= ++ ++- copyup() for other filetypes that reg and dir (e.g. for chown() on devices) ++- symlinks are untested ++ ++------------------------------------------------------------------------------- ++ ++7. References ++============= ++ ++[1] http://marc.info/?l=linux-fsdevel&m=96035682927821&w=2 ++[2] http://marc.info/?l=linux-fsdevel&m=117681527820133&w=2 ++[3] http://marc.info/?l=linux-fsdevel&m=117913503200362&w=2 ++[4] http://marc.info/?l=linux-fsdevel&m=118231827024394&w=2 ++ ++Authors: ++Jan Blunck ++Bharata B Rao ++Valerie Aurora +--- a/fs/autofs4/autofs_i.h ++++ b/fs/autofs4/autofs_i.h +@@ -130,6 +130,7 @@ struct autofs_sb_info { + int reghost_enabled; + int needs_reghost; + struct super_block *sb; ++ struct vfsmount *mnt; + struct mutex wq_mutex; + spinlock_t fs_lock; + struct autofs_wait_queue *queues; /* Wait queue pointer */ +--- a/fs/autofs4/init.c ++++ b/fs/autofs4/init.c +@@ -17,7 +17,16 @@ + static int autofs_get_sb(struct file_system_type *fs_type, + int flags, const char *dev_name, void *data, struct vfsmount *mnt) + { +- return get_sb_nodev(fs_type, flags, data, autofs4_fill_super, mnt); ++ struct autofs_sb_info *sbi; ++ int ret; ++ ++ ret = get_sb_nodev(fs_type, flags, data, autofs4_fill_super, mnt); ++ if (ret) ++ return ret; ++ ++ sbi = autofs4_sbi(mnt->mnt_sb); ++ sbi->mnt = mnt; ++ return 0; + } + + static struct file_system_type autofs_fs_type = { +--- a/fs/autofs4/root.c ++++ b/fs/autofs4/root.c +@@ -179,6 +179,12 @@ static void *autofs4_follow_link(struct + DPRINTK("dentry=%p %.*s oz_mode=%d nd->flags=%d", + dentry, dentry->d_name.len, dentry->d_name.name, oz_mode, + nd->flags); ++ ++ dput(nd->path.dentry); ++ mntput(nd->path.mnt); ++ nd->path.mnt = mntget(sbi->mnt); ++ nd->path.dentry = dget(dentry); ++ + /* + * For an expire of a covered direct or offset mount we need + * to break out of follow_down() at the autofs mount trigger +--- a/fs/compat.c ++++ b/fs/compat.c +@@ -840,6 +840,9 @@ static int compat_fillonedir(void *__buf + struct compat_old_linux_dirent __user *dirent; + compat_ulong_t d_ino; + ++ if (d_type == DT_WHT) ++ return 0; ++ + if (buf->result) + return -EINVAL; + d_ino = ino; +@@ -911,6 +914,9 @@ static int compat_filldir(void *__buf, c + compat_ulong_t d_ino; + int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 2, sizeof(compat_long_t)); + ++ if (d_type == DT_WHT) ++ return 0; ++ + buf->error = -EINVAL; /* only used if we fail.. */ + if (reclen > buf->count) + return -EINVAL; +@@ -1000,6 +1006,9 @@ static int compat_filldir64(void * __buf + int reclen = ALIGN(jj + namlen + 1, sizeof(u64)); + u64 off; + ++ if (d_type == DT_WHT) ++ return 0; ++ + buf->error = -EINVAL; /* only used if we fail.. */ + if (reclen > buf->count) + return -EINVAL; +--- a/fs/dcache.c ++++ b/fs/dcache.c +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -158,14 +159,19 @@ static void dentry_lru_del_init(struct d + } + + /** +- * d_kill - kill dentry and return parent ++ * __d_kill - kill dentry and return parent + * @dentry: dentry to kill ++ * @list: kill list ++ * @greedy: return parent instead of putting it on the kill list + * + * The dentry must already be unhashed and removed from the LRU. + * +- * If this is the root of the dentry tree, return NULL. ++ * If this is the root of the dentry tree, return NULL. If greedy is zero, we ++ * put the parent of this dentry on the kill list instead. The callers must ++ * make sure that __d_kill_final() is called on all dentries on the kill list. + */ +-static struct dentry *d_kill(struct dentry *dentry) ++static struct dentry *__d_kill(struct dentry *dentry, struct list_head *list, ++ int greedy) + __releases(dentry->d_lock) + __releases(dcache_lock) + { +@@ -173,13 +179,78 @@ static struct dentry *d_kill(struct dent + + list_del(&dentry->d_u.d_child); + dentry_stat.nr_dentry--; /* For d_free, below */ +- /*drops the locks, at that point nobody can reach this dentry */ ++ ++ /* ++ * If we are not greedy we just put this on a list for later processing ++ * (follow up to parent, releasing of inode and freeing dentry memory). ++ */ ++ if (!greedy) { ++ list_del_init(&dentry->d_alias); ++ /* at this point nobody can reach this dentry */ ++ list_add(&dentry->d_lru, list); ++ spin_unlock(&dentry->d_lock); ++ spin_unlock(&dcache_lock); ++ __shrink_d_unions(dentry, list); ++ return NULL; ++ } ++ ++ /* drops the locks, at that point nobody can reach this dentry */ + dentry_iput(dentry); ++ /* If the dentry was in an union delete them */ ++ __shrink_d_unions(dentry, list); ++ if (IS_ROOT(dentry)) ++ parent = NULL; ++ else ++ parent = dentry->d_parent; ++ d_free(dentry); ++ return parent; ++} ++ ++void __dput(struct dentry *, struct list_head *, int); ++ ++static void __d_kill_final(struct dentry *dentry, struct list_head *list) ++{ ++ struct dentry *parent; ++ struct inode *inode = dentry->d_inode; ++ ++ if (inode) { ++ dentry->d_inode = NULL; ++ if (!inode->i_nlink) ++ fsnotify_inoderemove(inode); ++ if (dentry->d_op && dentry->d_op->d_iput) ++ dentry->d_op->d_iput(dentry, inode); ++ else ++ iput(inode); ++ } ++ + if (IS_ROOT(dentry)) + parent = NULL; + else + parent = dentry->d_parent; + d_free(dentry); ++ __dput(parent, list, 1); ++} ++ ++/** ++ * d_kill - kill dentry and return parent ++ * @dentry: dentry to kill ++ * ++ * The dentry must already be unhashed and removed from the LRU. ++ * ++ * If this is the root of the dentry tree, return NULL. ++ */ ++static struct dentry *d_kill(struct dentry *dentry) ++{ ++ LIST_HEAD(mortuary); ++ struct dentry *parent; ++ ++ parent = __d_kill(dentry, &mortuary, 1); ++ while (!list_empty(&mortuary)) { ++ dentry = list_entry(mortuary.next, struct dentry, d_lru); ++ list_del(&dentry->d_lru); ++ __d_kill_final(dentry, &mortuary); ++ } ++ + return parent; + } + +@@ -200,19 +271,24 @@ static struct dentry *d_kill(struct dent + * Real recursion would eat up our stack space. + */ + +-/* +- * dput - release a dentry +- * @dentry: dentry to release ++/** ++ * __dput - release a dentry ++ * @dentry: dentry to release ++ * @list: kill list argument for __d_kill() ++ * @greedy: greedy argument for __d_kill() + * + * Release a dentry. This will drop the usage count and if appropriate + * call the dentry unlink method as well as removing it from the queues and + * releasing its resources. If the parent dentries were scheduled for release +- * they too may now get deleted. ++ * they too may now get deleted if @greedy is not zero. Otherwise parent is ++ * added to the kill list. The callers must make sure that __d_kill_final() is ++ * called on all dentries on the kill list. ++ * ++ * You probably want to use dput() instead. + * + * no dcache lock, please. + */ +- +-void dput(struct dentry *dentry) ++void __dput(struct dentry *dentry, struct list_head *list, int greedy) + { + if (!dentry) + return; +@@ -253,12 +329,35 @@ unhash_it: + kill_it: + /* if dentry was on the d_lru list delete it from there */ + dentry_lru_del(dentry); +- dentry = d_kill(dentry); ++ dentry = __d_kill(dentry, list, greedy); + if (dentry) + goto repeat; + } + + /** ++ * dput - release a dentry ++ * @dentry: dentry to release ++ * ++ * Release a dentry. This will drop the usage count and if appropriate ++ * call the dentry unlink method as well as removing it from the queues and ++ * releasing its resources. If the parent dentries were scheduled for release ++ * they too may now get deleted. ++ * ++ * no dcache lock, please. ++ */ ++void dput(struct dentry *dentry) ++{ ++ LIST_HEAD(mortuary); ++ ++ __dput(dentry, &mortuary, 1); ++ while (!list_empty(&mortuary)) { ++ dentry = list_entry(mortuary.next, struct dentry, d_lru); ++ list_del(&dentry->d_lru); ++ __d_kill_final(dentry, &mortuary); ++ } ++} ++ ++/** + * d_invalidate - invalidate a dentry + * @dentry: dentry to invalidate + * +@@ -690,6 +789,7 @@ static void shrink_dcache_for_umount_sub + iput(inode); + } + ++ shrink_d_unions(dentry); + d_free(dentry); + + /* finished when we fall off the top of the tree, +@@ -952,6 +1052,10 @@ struct dentry *d_alloc(struct dentry * p + INIT_LIST_HEAD(&dentry->d_lru); + INIT_LIST_HEAD(&dentry->d_subdirs); + INIT_LIST_HEAD(&dentry->d_alias); ++#ifdef CONFIG_UNION_MOUNT ++ INIT_LIST_HEAD(&dentry->d_unions); ++ dentry->d_unionized = 0; ++#endif + + if (parent) { + dentry->d_parent = dget(parent); +@@ -982,8 +1086,10 @@ struct dentry *d_alloc_name(struct dentr + /* the caller must hold dcache_lock */ + static void __d_instantiate(struct dentry *dentry, struct inode *inode) + { +- if (inode) ++ if (inode) { ++ dentry->d_flags &= ~(DCACHE_WHITEOUT|DCACHE_FALLTHRU); + list_add(&dentry->d_alias, &inode->i_dentry); ++ } + dentry->d_inode = inode; + fsnotify_d_instantiate(dentry, inode); + } +@@ -1514,7 +1620,9 @@ void d_delete(struct dentry * dentry) + spin_lock(&dentry->d_lock); + isdir = S_ISDIR(dentry->d_inode->i_mode); + if (atomic_read(&dentry->d_count) == 1) { ++ __d_drop_unions(dentry); + dentry_iput(dentry); ++ shrink_d_unions(dentry); + fsnotify_nameremove(dentry, isdir); + return; + } +@@ -1525,14 +1633,14 @@ void d_delete(struct dentry * dentry) + spin_unlock(&dentry->d_lock); + spin_unlock(&dcache_lock); + ++ shrink_d_unions(dentry); + fsnotify_nameremove(dentry, isdir); + } + + static void __d_rehash(struct dentry * entry, struct hlist_head *list) + { +- +- entry->d_flags &= ~DCACHE_UNHASHED; +- hlist_add_head_rcu(&entry->d_hash, list); ++ entry->d_flags &= ~DCACHE_UNHASHED; ++ hlist_add_head_rcu(&entry->d_hash, list); + } + + static void _d_rehash(struct dentry * entry) +@@ -1551,6 +1659,7 @@ void d_rehash(struct dentry * entry) + { + spin_lock(&dcache_lock); + spin_lock(&entry->d_lock); ++ BUG_ON(!d_unhashed(entry)); + _d_rehash(entry); + spin_unlock(&entry->d_lock); + spin_unlock(&dcache_lock); +@@ -2183,7 +2292,9 @@ resume: + struct list_head *tmp = next; + struct dentry *dentry = list_entry(tmp, struct dentry, d_u.d_child); + next = tmp->next; +- if (d_unhashed(dentry)||!dentry->d_inode) ++ if (d_unhashed(dentry)||(!dentry->d_inode && ++ !d_is_whiteout(dentry) && ++ !d_is_fallthru(dentry))) + continue; + if (!list_empty(&dentry->d_subdirs)) { + this_parent = dentry; +--- a/fs/ext2/dir.c ++++ b/fs/ext2/dir.c +@@ -219,7 +219,8 @@ static inline int ext2_match (int len, c + { + if (len != de->name_len) + return 0; +- if (!de->inode) ++ if (!de->inode && ((de->file_type != EXT2_FT_WHT) && ++ (de->file_type != EXT2_FT_FALLTHRU))) + return 0; + return !memcmp(name, de->name, len); + } +@@ -255,6 +256,8 @@ static unsigned char ext2_filetype_table + [EXT2_FT_FIFO] = DT_FIFO, + [EXT2_FT_SOCK] = DT_SOCK, + [EXT2_FT_SYMLINK] = DT_LNK, ++ [EXT2_FT_WHT] = DT_WHT, ++ [EXT2_FT_FALLTHRU] = DT_UNKNOWN, + }; + + #define S_SHIFT 12 +@@ -341,6 +344,18 @@ ext2_readdir (struct file * filp, void * + ext2_put_page(page); + return 0; + } ++ } else if (de->file_type == EXT2_FT_FALLTHRU) { ++ int over; ++ unsigned char d_type = DT_UNKNOWN; ++ ++ offset = (char *)de - kaddr; ++ over = filldir(dirent, de->name, de->name_len, ++ (n<f_pos += ext2_rec_len_from_disk(de->rec_len); + } +@@ -448,6 +463,30 @@ ino_t ext2_inode_by_name(struct inode *d + return res; + } + ++/* Special version for filetype based whiteout support */ ++ino_t ext2_inode_by_dentry(struct inode *dir, struct dentry *dentry) ++{ ++ ino_t res = 0; ++ struct ext2_dir_entry_2 *de; ++ struct page *page; ++ ++ de = ext2_find_entry (dir, &dentry->d_name, &page); ++ if (de) { ++ res = le32_to_cpu(de->inode); ++ if (!res && de->file_type == EXT2_FT_WHT) { ++ spin_lock(&dentry->d_lock); ++ dentry->d_flags |= DCACHE_WHITEOUT; ++ spin_unlock(&dentry->d_lock); ++ } else if(!res && de->file_type == EXT2_FT_FALLTHRU) { ++ spin_lock(&dentry->d_lock); ++ dentry->d_flags |= DCACHE_FALLTHRU; ++ spin_unlock(&dentry->d_lock); ++ } ++ ext2_put_page(page); ++ } ++ return res; ++} ++ + /* Releases the page */ + void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de, + struct page *page, struct inode *inode, int update_times) +@@ -472,9 +511,10 @@ void ext2_set_link(struct inode *dir, st + } + + /* +- * Parent is locked. ++ * Find or append a given dentry to the parent directory + */ +-int ext2_add_link (struct dentry *dentry, struct inode *inode) ++static ext2_dirent * ext2_append_entry(struct dentry * dentry, ++ struct page ** page) + { + struct inode *dir = dentry->d_parent->d_inode; + const char *name = dentry->d_name.name; +@@ -482,13 +522,10 @@ int ext2_add_link (struct dentry *dentry + unsigned chunk_size = ext2_chunk_size(dir); + unsigned reclen = EXT2_DIR_REC_LEN(namelen); + unsigned short rec_len, name_len; +- struct page *page = NULL; +- ext2_dirent * de; ++ ext2_dirent * de = NULL; + unsigned long npages = dir_pages(dir); + unsigned long n; + char *kaddr; +- loff_t pos; +- int err; + + /* + * We take care of directory expansion in the same loop. +@@ -498,55 +535,97 @@ int ext2_add_link (struct dentry *dentry + for (n = 0; n <= npages; n++) { + char *dir_end; + +- page = ext2_get_page(dir, n, 0); +- err = PTR_ERR(page); +- if (IS_ERR(page)) ++ *page = ext2_get_page(dir, n, 0); ++ de = ERR_PTR(PTR_ERR(*page)); ++ if (IS_ERR(*page)) + goto out; +- lock_page(page); +- kaddr = page_address(page); ++ lock_page(*page); ++ kaddr = page_address(*page); + dir_end = kaddr + ext2_last_byte(dir, n); + de = (ext2_dirent *)kaddr; + kaddr += PAGE_CACHE_SIZE - reclen; + while ((char *)de <= kaddr) { + if ((char *)de == dir_end) { + /* We hit i_size */ +- name_len = 0; +- rec_len = chunk_size; ++ de->name_len = 0; + de->rec_len = ext2_rec_len_to_disk(chunk_size); + de->inode = 0; ++ de->file_type = 0; + goto got_it; + } + if (de->rec_len == 0) { + ext2_error(dir->i_sb, __func__, + "zero-length directory entry"); +- err = -EIO; ++ de = ERR_PTR(-EIO); + goto out_unlock; + } +- err = -EEXIST; + if (ext2_match (namelen, name, de)) +- goto out_unlock; ++ goto got_it; + name_len = EXT2_DIR_REC_LEN(de->name_len); + rec_len = ext2_rec_len_from_disk(de->rec_len); +- if (!de->inode && rec_len >= reclen) ++ if (!de->inode && (de->file_type != EXT2_FT_WHT) && ++ (de->file_type != EXT2_FT_FALLTHRU) && ++ (rec_len >= reclen)) + goto got_it; + if (rec_len >= name_len + reclen) + goto got_it; + de = (ext2_dirent *) ((char *) de + rec_len); + } +- unlock_page(page); +- ext2_put_page(page); ++ unlock_page(*page); ++ ext2_put_page(*page); + } ++ + BUG(); +- return -EINVAL; + + got_it: ++ return de; ++ /* OFFSET_CACHE */ ++out_unlock: ++ unlock_page(*page); ++ ext2_put_page(*page); ++out: ++ return de; ++} ++ ++/* ++ * Parent is locked. ++ */ ++int ext2_add_link (struct dentry *dentry, struct inode *inode) ++{ ++ struct inode *dir = dentry->d_parent->d_inode; ++ const char *name = dentry->d_name.name; ++ int namelen = dentry->d_name.len; ++ unsigned short rec_len, name_len; ++ ext2_dirent * de; ++ struct page *page; ++ loff_t pos; ++ int err; ++ ++ de = ext2_append_entry(dentry, &page); ++ if (IS_ERR(de)) ++ return PTR_ERR(de); ++ ++ err = -EEXIST; ++ if (ext2_match (namelen, name, de)) { ++ if ((de->file_type == EXT2_FT_WHT) || ++ (de->file_type == EXT2_FT_FALLTHRU)) ++ goto got_it; ++ goto out_unlock; ++ } ++ ++got_it: ++ name_len = EXT2_DIR_REC_LEN(de->name_len); ++ rec_len = ext2_rec_len_from_disk(de->rec_len); ++ + pos = page_offset(page) + + (char*)de - (char*)page_address(page); + err = __ext2_write_begin(NULL, page->mapping, pos, rec_len, 0, + &page, NULL); + if (err) + goto out_unlock; +- if (de->inode) { ++ if (de->inode || (((de->file_type == EXT2_FT_WHT) || ++ (de->file_type == EXT2_FT_FALLTHRU)) && ++ !ext2_match (namelen, name, de))) { + ext2_dirent *de1 = (ext2_dirent *) ((char *) de + name_len); + de1->rec_len = ext2_rec_len_to_disk(rec_len - name_len); + de->rec_len = ext2_rec_len_to_disk(name_len); +@@ -563,7 +642,60 @@ got_it: + /* OFFSET_CACHE */ + out_put: + ext2_put_page(page); +-out: ++ return err; ++out_unlock: ++ unlock_page(page); ++ goto out_put; ++} ++ ++/* ++ * Create a fallthru entry. ++ */ ++int ext2_fallthru_entry (struct inode *dir, struct dentry *dentry) ++{ ++ const char *name = dentry->d_name.name; ++ int namelen = dentry->d_name.len; ++ unsigned short rec_len, name_len; ++ ext2_dirent * de; ++ struct page *page; ++ loff_t pos; ++ int err; ++ ++ de = ext2_append_entry(dentry, &page); ++ if (IS_ERR(de)) ++ return PTR_ERR(de); ++ ++ err = -EEXIST; ++ if (ext2_match (namelen, name, de)) ++ goto out_unlock; ++ ++ name_len = EXT2_DIR_REC_LEN(de->name_len); ++ rec_len = ext2_rec_len_from_disk(de->rec_len); ++ ++ pos = page_offset(page) + ++ (char*)de - (char*)page_address(page); ++ err = __ext2_write_begin(NULL, page->mapping, pos, rec_len, 0, ++ &page, NULL); ++ if (err) ++ goto out_unlock; ++ if (de->inode || (de->file_type == EXT2_FT_WHT) || ++ (de->file_type == EXT2_FT_FALLTHRU)) { ++ ext2_dirent *de1 = (ext2_dirent *) ((char *) de + name_len); ++ de1->rec_len = ext2_rec_len_to_disk(rec_len - name_len); ++ de->rec_len = ext2_rec_len_to_disk(name_len); ++ de = de1; ++ } ++ de->name_len = namelen; ++ memcpy(de->name, name, namelen); ++ de->inode = 0; ++ de->file_type = EXT2_FT_FALLTHRU; ++ err = ext2_commit_chunk(page, pos, rec_len); ++ dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; ++ EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL; ++ mark_inode_dirty(dir); ++ /* OFFSET_CACHE */ ++out_put: ++ ext2_put_page(page); + return err; + out_unlock: + unlock_page(page); +@@ -616,6 +748,70 @@ out: + return err; + } + ++int ext2_whiteout_entry (struct inode * dir, struct dentry * dentry, ++ struct ext2_dir_entry_2 * de, struct page * page) ++{ ++ const char *name = dentry->d_name.name; ++ int namelen = dentry->d_name.len; ++ unsigned short rec_len, name_len; ++ loff_t pos; ++ int err; ++ ++ if (!de) { ++ de = ext2_append_entry(dentry, &page); ++ BUG_ON(!de); ++ } ++ ++ err = -EEXIST; ++ if (ext2_match (namelen, name, de) && ++ (de->file_type == EXT2_FT_WHT)) { ++ ext2_error(dir->i_sb, __func__, ++ "entry is already a whiteout in directory #%lu", ++ dir->i_ino); ++ goto out_unlock; ++ } ++ ++ name_len = EXT2_DIR_REC_LEN(de->name_len); ++ rec_len = ext2_rec_len_from_disk(de->rec_len); ++ ++ pos = page_offset(page) + ++ (char*)de - (char*)page_address(page); ++ err = __ext2_write_begin(NULL, page->mapping, pos, rec_len, 0, ++ &page, NULL); ++ if (err) ++ goto out_unlock; ++ /* ++ * We whiteout an existing entry. Do what ext2_delete_entry() would do, ++ * except that we don't need to merge with the previous entry since ++ * we are going to reuse it. ++ */ ++ if (ext2_match (namelen, name, de)) ++ de->inode = 0; ++ if (de->inode || (((de->file_type == EXT2_FT_WHT) || ++ (de->file_type == EXT2_FT_FALLTHRU)) && ++ !ext2_match (namelen, name, de))) { ++ ext2_dirent *de1 = (ext2_dirent *) ((char *) de + name_len); ++ de1->rec_len = ext2_rec_len_to_disk(rec_len - name_len); ++ de->rec_len = ext2_rec_len_to_disk(name_len); ++ de = de1; ++ } ++ de->name_len = namelen; ++ memcpy(de->name, name, namelen); ++ de->inode = 0; ++ de->file_type = EXT2_FT_WHT; ++ err = ext2_commit_chunk(page, pos, rec_len); ++ dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; ++ EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL; ++ mark_inode_dirty(dir); ++ /* OFFSET_CACHE */ ++out_put: ++ ext2_put_page(page); ++ return err; ++out_unlock: ++ unlock_page(page); ++ goto out_put; ++} ++ + /* + * Set the first fragment of directory. + */ +--- a/fs/ext2/ext2.h ++++ b/fs/ext2/ext2.h +@@ -102,9 +102,13 @@ extern void ext2_rsv_window_add(struct s + /* dir.c */ + extern int ext2_add_link (struct dentry *, struct inode *); + extern ino_t ext2_inode_by_name(struct inode *, struct qstr *); ++extern ino_t ext2_inode_by_dentry(struct inode *, struct dentry *); + extern int ext2_make_empty(struct inode *, struct inode *); + extern struct ext2_dir_entry_2 * ext2_find_entry (struct inode *,struct qstr *, struct page **); + extern int ext2_delete_entry (struct ext2_dir_entry_2 *, struct page *); ++extern int ext2_whiteout_entry (struct inode *, struct dentry *, ++ struct ext2_dir_entry_2 *, struct page *); ++extern int ext2_fallthru_entry (struct inode *, struct dentry *); + extern int ext2_empty_dir (struct inode *); + extern struct ext2_dir_entry_2 * ext2_dotdot (struct inode *, struct page **); + extern void ext2_set_link(struct inode *, struct ext2_dir_entry_2 *, struct page *, struct inode *, int); +--- a/fs/ext2/inode.c ++++ b/fs/ext2/inode.c +@@ -1178,7 +1178,8 @@ void ext2_set_inode_flags(struct inode * + { + unsigned int flags = EXT2_I(inode)->i_flags; + +- inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC); ++ inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC| ++ S_OPAQUE); + if (flags & EXT2_SYNC_FL) + inode->i_flags |= S_SYNC; + if (flags & EXT2_APPEND_FL) +@@ -1189,6 +1190,8 @@ void ext2_set_inode_flags(struct inode * + inode->i_flags |= S_NOATIME; + if (flags & EXT2_DIRSYNC_FL) + inode->i_flags |= S_DIRSYNC; ++ if (flags & EXT2_OPAQUE_FL) ++ inode->i_flags |= S_OPAQUE; + } + + /* Propagate flags from i_flags to EXT2_I(inode)->i_flags */ +@@ -1196,8 +1199,8 @@ void ext2_get_inode_flags(struct ext2_in + { + unsigned int flags = ei->vfs_inode.i_flags; + +- ei->i_flags &= ~(EXT2_SYNC_FL|EXT2_APPEND_FL| +- EXT2_IMMUTABLE_FL|EXT2_NOATIME_FL|EXT2_DIRSYNC_FL); ++ ei->i_flags &= ~(EXT2_SYNC_FL|EXT2_APPEND_FL|EXT2_IMMUTABLE_FL| ++ EXT2_NOATIME_FL|EXT2_DIRSYNC_FL|EXT2_OPAQUE_FL); + if (flags & S_SYNC) + ei->i_flags |= EXT2_SYNC_FL; + if (flags & S_APPEND) +@@ -1208,6 +1211,8 @@ void ext2_get_inode_flags(struct ext2_in + ei->i_flags |= EXT2_NOATIME_FL; + if (flags & S_DIRSYNC) + ei->i_flags |= EXT2_DIRSYNC_FL; ++ if (flags & S_OPAQUE) ++ ei->i_flags |= EXT2_OPAQUE_FL; + } + + struct inode *ext2_iget (struct super_block *sb, unsigned long ino) +--- a/fs/ext2/namei.c ++++ b/fs/ext2/namei.c +@@ -54,15 +54,16 @@ static inline int ext2_add_nondir(struct + * Methods themselves. + */ + +-static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, struct nameidata *nd) ++static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, ++ struct nameidata *nd) + { + struct inode * inode; + ino_t ino; +- ++ + if (dentry->d_name.len > EXT2_NAME_LEN) + return ERR_PTR(-ENAMETOOLONG); + +- ino = ext2_inode_by_name(dir, &dentry->d_name); ++ ino = ext2_inode_by_dentry(dir, dentry); + inode = NULL; + if (ino) { + inode = ext2_iget(dir->i_sb, ino); +@@ -230,6 +231,10 @@ static int ext2_mkdir(struct inode * dir + else + inode->i_mapping->a_ops = &ext2_aops; + ++ /* if we call mkdir on a whiteout create an opaque directory */ ++ if (dentry->d_flags & DCACHE_WHITEOUT) ++ inode->i_flags |= S_OPAQUE; ++ + inode_inc_link_count(inode); + + err = ext2_make_empty(inode, dir); +@@ -293,6 +298,78 @@ static int ext2_rmdir (struct inode * di + return err; + } + ++/* ++ * Create a whiteout for the dentry ++ */ ++static int ext2_whiteout(struct inode *dir, struct dentry *dentry, ++ struct dentry *new_dentry) ++{ ++ struct inode * inode = dentry->d_inode; ++ struct ext2_dir_entry_2 * de = NULL; ++ struct page * page; ++ int err = -ENOTEMPTY; ++ ++ if (!EXT2_HAS_INCOMPAT_FEATURE(dir->i_sb, ++ EXT2_FEATURE_INCOMPAT_FILETYPE)) { ++ ext2_error (dir->i_sb, "ext2_whiteout", ++ "can't set whiteout filetype"); ++ err = -EPERM; ++ goto out; ++ } ++ ++ if (inode) { ++ if (S_ISDIR(inode->i_mode) && !ext2_empty_dir(inode)) ++ goto out; ++ ++ err = -ENOENT; ++ de = ext2_find_entry (dir, &dentry->d_name, &page); ++ if (!de) ++ goto out; ++ lock_page(page); ++ } ++ ++ err = ext2_whiteout_entry (dir, dentry, de, page); ++ if (err) ++ goto out; ++ ++ spin_lock(&new_dentry->d_lock); ++ new_dentry->d_flags &= ~DCACHE_FALLTHRU; ++ new_dentry->d_flags |= DCACHE_WHITEOUT; ++ spin_unlock(&new_dentry->d_lock); ++ d_add(new_dentry, NULL); ++ ++ if (inode) { ++ inode->i_ctime = dir->i_ctime; ++ inode_dec_link_count(inode); ++ if (S_ISDIR(inode->i_mode)) { ++ inode->i_size = 0; ++ inode_dec_link_count(inode); ++ inode_dec_link_count(dir); ++ } ++ } ++ err = 0; ++out: ++ return err; ++} ++ ++/* ++ * Create a fallthru entry. ++ */ ++static int ext2_fallthru (struct inode *dir, struct dentry *dentry) ++{ ++ int err; ++ ++ err = ext2_fallthru_entry(dir, dentry); ++ if (err) ++ return err; ++ ++ d_instantiate(dentry, NULL); ++ spin_lock(&dentry->d_lock); ++ dentry->d_flags |= DCACHE_FALLTHRU; ++ spin_unlock(&dentry->d_lock); ++ return 0; ++} ++ + static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, + struct inode * new_dir, struct dentry * new_dentry ) + { +@@ -392,6 +469,8 @@ const struct inode_operations ext2_dir_i + .mkdir = ext2_mkdir, + .rmdir = ext2_rmdir, + .mknod = ext2_mknod, ++ .whiteout = ext2_whiteout, ++ .fallthru = ext2_fallthru, + .rename = ext2_rename, + #ifdef CONFIG_EXT2_FS_XATTR + .setxattr = generic_setxattr, +--- a/fs/ext2/super.c ++++ b/fs/ext2/super.c +@@ -1062,6 +1062,13 @@ static int ext2_fill_super(struct super_ + if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) + ext2_warning(sb, __func__, + "mounting ext3 filesystem as ext2"); ++ ++ /* ++ * Whiteouts (and fallthrus) require explicit whiteout support. ++ */ ++ if (EXT2_HAS_INCOMPAT_FEATURE(sb, EXT2_FEATURE_INCOMPAT_WHITEOUT)) ++ sb->s_flags |= MS_WHITEOUT; ++ + ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY); + return 0; + +--- a/fs/Kconfig ++++ b/fs/Kconfig +@@ -59,6 +59,14 @@ source "fs/notify/Kconfig" + + source "fs/quota/Kconfig" + ++config UNION_MOUNT ++ bool "Union mount support (EXPERIMENTAL)" ++ depends on EXPERIMENTAL ++ ---help--- ++ If you say Y here, you will be able to mount file systems as ++ union mount stacks. This is a VFS based implementation and ++ should work with all file systems. If unsure, say N. ++ + source "fs/autofs/Kconfig" + source "fs/autofs4/Kconfig" + source "fs/fuse/Kconfig" +--- a/fs/libfs.c ++++ b/fs/libfs.c +@@ -133,6 +133,7 @@ int dcache_readdir(struct file * filp, v + struct dentry *cursor = filp->private_data; + struct list_head *p, *q = &cursor->d_u.d_child; + ino_t ino; ++ int d_type; + int i = filp->f_pos; + + switch (i) { +@@ -158,14 +159,25 @@ int dcache_readdir(struct file * filp, v + for (p=q->next; p != &dentry->d_subdirs; p=p->next) { + struct dentry *next; + next = list_entry(p, struct dentry, d_u.d_child); +- if (d_unhashed(next) || !next->d_inode) ++ if (d_unhashed(next) || (!next->d_inode && !d_is_fallthru(next))) + continue; + ++ if (d_is_fallthru(next)) { ++ /* XXX Make up things we can ++ * only get out of the inode. ++ * Should probably really do a ++ * lookup instead. */ ++ ino = 100; /* XXX Made up number of no significance */ ++ d_type = DT_UNKNOWN; ++ } else { ++ ino = next->d_inode->i_ino; ++ d_type = dt_type(next->d_inode); ++ } ++ + spin_unlock(&dcache_lock); + if (filldir(dirent, next->d_name.name, + next->d_name.len, filp->f_pos, +- next->d_inode->i_ino, +- dt_type(next->d_inode)) < 0) ++ ino, d_type) < 0) + return 0; + spin_lock(&dcache_lock); + /* next is still alive */ +--- a/fs/Makefile ++++ b/fs/Makefile +@@ -52,6 +52,7 @@ obj-$(CONFIG_NFS_COMMON) += nfs_common/ + obj-$(CONFIG_GENERIC_ACL) += generic_acl.o + + obj-y += quota/ ++obj-$(CONFIG_UNION_MOUNT) += union.o + + obj-$(CONFIG_PROC_FS) += proc/ + obj-y += partitions/ +--- a/fs/namei.c ++++ b/fs/namei.c +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + #include + + #define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE]) +@@ -242,16 +243,17 @@ int generic_permission(struct inode *ino + } + + /** +- * inode_permission - check for access rights to a given inode ++ * __inode_permission - check for access rights to a given inode + * @inode: inode to check permission on + * @mask: right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC) ++ * @rofs: check for read-only fs + * + * Used to check for read/write/execute permissions on an inode. + * We use "fsuid" for this, letting us set arbitrary permissions + * for filesystem access without changing the "normal" uids which + * are used for other things. + */ +-int inode_permission(struct inode *inode, int mask) ++int __inode_permission(struct inode *inode, int mask, int rofs) + { + int retval; + +@@ -261,7 +263,7 @@ int inode_permission(struct inode *inode + /* + * Nobody gets write access to a read-only fs. + */ +- if (IS_RDONLY(inode) && ++ if ((rofs & IS_RDONLY(inode)) && + (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode))) + return -EROFS; + +@@ -289,6 +291,18 @@ int inode_permission(struct inode *inode + } + + /** ++ * inode_permission - check for access rights to a given inode ++ * @inode: inode to check permission on ++ * @mask: right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC) ++ * ++ * This version pays attention to the MS_RDONLY flag on the fs. ++ */ ++int inode_permission(struct inode *inode, int mask) ++{ ++ return __inode_permission(inode, mask, 1); ++} ++ ++/** + * file_permission - check for additional access rights to a given file + * @file: file to check access rights for + * @mask: right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC) +@@ -417,15 +431,10 @@ do_revalidate(struct dentry *dentry, str + * Internal lookup() using the new generic dcache. + * SMP-safe + */ +-static struct dentry * cached_lookup(struct dentry * parent, struct qstr * name, struct nameidata *nd) ++static struct dentry *cache_lookup(struct dentry *parent, struct qstr *name, ++ struct nameidata *nd) + { +- struct dentry * dentry = __d_lookup(parent, name); +- +- /* lockess __d_lookup may fail due to concurrent d_move() +- * in some unrelated directory, so try with d_lookup +- */ +- if (!dentry) +- dentry = d_lookup(parent, name); ++ struct dentry *dentry = d_lookup(parent, name); + + if (dentry && dentry->d_op && dentry->d_op->d_revalidate) + dentry = do_revalidate(dentry, nd); +@@ -434,6 +443,208 @@ static struct dentry * cached_lookup(str + } + + /* ++ * Theory of operation for opaque, whiteout, and fallthru: ++ * ++ * whiteout: Unconditionally stop lookup here - ENOENT ++ * ++ * opaque: Don't lookup in directories lower in the union stack ++ * ++ * fallthru: While looking up an entry, ignore the opaque flag for the ++ * current directory only. ++ * ++ * A union stack is a linked list of directory dentries which appear ++ * in the same place in the namespace. When constructing the union ++ * stack, we include directories below opaque directories so that we ++ * can properly handle fallthrus. All non-fallthru lookups have to ++ * check for the opaque flag on the parent directory and obey it. ++ * ++ * In general, the code pattern is to lookup the the topmost entry ++ * first (either the first visible non-negative dentry or a negative ++ * dentry in the topmost layer of the union), then build the union ++ * stack for the newly looked-up entry (if it is a directory). ++ */ ++ ++/** ++ * __cache_lookup_topmost - lookup the topmost (non-)negative dentry ++ * ++ * @nd - parent's nameidata ++ * @name - pathname part to lookup ++ * @path - found dentry for pathname part ++ * ++ * This is used for union mount lookups from dcache. The first non-negative ++ * dentry is searched on all layers of the union stack. Otherwise the topmost ++ * negative dentry is returned. ++ */ ++static int __cache_lookup_topmost(struct nameidata *nd, struct qstr *name, ++ struct path *path) ++{ ++ struct dentry *dentry; ++ ++ dentry = d_lookup(nd->path.dentry, name); ++ if (dentry && dentry->d_op && dentry->d_op->d_revalidate) ++ dentry = do_revalidate(dentry, nd); ++ ++ /* ++ * Remember the topmost negative dentry in case we don't find anything ++ */ ++ path->dentry = dentry; ++ path->mnt = dentry ? nd->path.mnt : NULL; ++ ++ if (!dentry || (dentry->d_inode || d_is_whiteout(dentry))) ++ return !dentry; ++ ++ /* Keep going through opaque directories if we found a fallthru */ ++ if (IS_OPAQUE(nd->path.dentry->d_inode) && !d_is_fallthru(dentry)) ++ return !dentry; ++ ++ /* look for the first non-negative or whiteout dentry */ ++ ++ while (follow_union_down(&nd->path)) { ++ dentry = d_hash_and_lookup(nd->path.dentry, name); ++ ++ /* ++ * If parts of the union stack are not in the dcache we need ++ * to do a real lookup ++ */ ++ if (!dentry) ++ goto out_dput; ++ ++ /* ++ * If parts of the union don't survive the revalidation we ++ * need to do a real lookup ++ */ ++ if (dentry->d_op && dentry->d_op->d_revalidate) { ++ dentry = do_revalidate(dentry, nd); ++ if (!dentry) ++ goto out_dput; ++ } ++ ++ if (dentry->d_inode || d_is_whiteout(dentry)) ++ goto out_dput; ++ ++ /* Stop the lookup on opaque parent and non-fallthru child */ ++ if (IS_OPAQUE(nd->path.dentry->d_inode) && !d_is_fallthru(dentry)) ++ goto out_dput; ++ ++ dput(dentry); ++ } ++ ++ return !dentry; ++ ++out_dput: ++ dput(path->dentry); ++ path->dentry = dentry; ++ path->mnt = dentry ? mntget(nd->path.mnt) : NULL; ++ return !dentry; ++} ++ ++/** ++ * __cache_lookup_build_union - build the union stack for this part, ++ * cached version ++ * ++ * This is called after you have the topmost dentry in @path. ++ */ ++static int __cache_lookup_build_union(struct nameidata *nd, struct qstr *name, ++ struct path *path) ++{ ++ struct path last = *path; ++ struct dentry *dentry; ++ ++ while (follow_union_down(&nd->path)) { ++ dentry = d_hash_and_lookup(nd->path.dentry, name); ++ if (!dentry) ++ return 1; ++ ++ if (dentry->d_op && dentry->d_op->d_revalidate) { ++ dentry = do_revalidate(dentry, nd); ++ if (!dentry) ++ return 1; ++ } ++ ++ if (d_is_whiteout(dentry)) { ++ dput(dentry); ++ break; ++ } ++ ++ if (!dentry->d_inode) { ++ dput(dentry); ++ continue; ++ } ++ ++ /* only directories can be part of a union stack */ ++ if (!S_ISDIR(dentry->d_inode->i_mode)) { ++ dput(dentry); ++ break; ++ } ++ ++ /* Add the newly discovered dir to the union stack */ ++ append_to_union(last.mnt, last.dentry, nd->path.mnt, dentry); ++ ++ if (last.dentry != path->dentry) ++ path_put(&last); ++ last.dentry = dentry; ++ last.mnt = mntget(nd->path.mnt); ++ } ++ ++ if (last.dentry != path->dentry) ++ path_put(&last); ++ ++ return 0; ++} ++ ++/** ++ * cache_lookup_union - lookup a single pathname part from dcache ++ * ++ * This is a union mount capable version of what d_lookup() & revalidate() ++ * would do. This function returns a valid (union) dentry on success. ++ * ++ * Remember: On failure it means that parts of the union aren't cached. You ++ * should call real_lookup() afterwards to find the proper (union) dentry. ++ */ ++static int cache_lookup_union(struct nameidata *nd, struct qstr *name, ++ struct path *path) ++{ ++ int res ; ++ ++ if (!IS_MNT_UNION(nd->path.mnt)) { ++ path->dentry = cache_lookup(nd->path.dentry, name, nd); ++ path->mnt = path->dentry ? nd->path.mnt : NULL; ++ res = path->dentry ? 0 : 1; ++ } else { ++ struct path safe = { ++ .dentry = nd->path.dentry, ++ .mnt = nd->path.mnt ++ }; ++ ++ path_get(&safe); ++ res = __cache_lookup_topmost(nd, name, path); ++ if (res) ++ goto out; ++ ++ /* only directories can be part of a union stack */ ++ if (!path->dentry->d_inode || ++ !S_ISDIR(path->dentry->d_inode->i_mode)) ++ goto out; ++ ++ /* Build the union stack for this part */ ++ res = __cache_lookup_build_union(nd, name, path); ++ if (res) { ++ dput(path->dentry); ++ if (path->mnt != safe.mnt) ++ mntput(path->mnt); ++ goto out; ++ } ++ ++out: ++ path_put(&nd->path); ++ nd->path.dentry = safe.dentry; ++ nd->path.mnt = safe.mnt; ++ } ++ ++ return res; ++} ++ ++/* + * Short-cut version of permission(), for calling by + * path_walk(), when dcache lock is held. Combines parts + * of permission() and generic_permission(), and tests ONLY for +@@ -473,10 +684,11 @@ ok: + * make sure that nobody added the entry to the dcache in the meantime.. + * SMP-safe + */ +-static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, struct nameidata *nd) ++static int real_lookup(struct nameidata *nd, struct qstr *name, ++ struct path *path) + { +- struct dentry * result; +- struct inode *dir = parent->d_inode; ++ struct inode *dir = nd->path.dentry->d_inode; ++ int res = 0; + + mutex_lock(&dir->i_mutex); + /* +@@ -493,27 +705,36 @@ static struct dentry * real_lookup(struc + * + * so doing d_lookup() (with seqlock), instead of lockfree __d_lookup + */ +- result = d_lookup(parent, name); +- if (!result) { ++ path->dentry = d_lookup(nd->path.dentry, name); ++ path->mnt = nd->path.mnt; ++ if (!path->dentry) { + struct dentry *dentry; + + /* Don't create child dentry for a dead directory. */ +- result = ERR_PTR(-ENOENT); +- if (IS_DEADDIR(dir)) ++ if (IS_DEADDIR(dir)) { ++ res = -ENOENT; + goto out_unlock; ++ } + +- dentry = d_alloc(parent, name); +- result = ERR_PTR(-ENOMEM); ++ dentry = d_alloc(nd->path.dentry, name); + if (dentry) { +- result = dir->i_op->lookup(dir, dentry, nd); +- if (result) ++ path->dentry = dir->i_op->lookup(dir, dentry, nd); ++ if (path->dentry) { + dput(dentry); +- else +- result = dentry; ++ if (IS_ERR(path->dentry)) { ++ res = PTR_ERR(path->dentry); ++ path->dentry = NULL; ++ path->mnt = NULL; ++ } ++ } else ++ path->dentry = dentry; ++ } else { ++ res = -ENOMEM; ++ path->mnt = NULL; + } + out_unlock: + mutex_unlock(&dir->i_mutex); +- return result; ++ return res; + } + + /* +@@ -521,12 +742,170 @@ out_unlock: + * we waited on the semaphore. Need to revalidate. + */ + mutex_unlock(&dir->i_mutex); +- if (result->d_op && result->d_op->d_revalidate) { +- result = do_revalidate(result, nd); +- if (!result) +- result = ERR_PTR(-ENOENT); ++ if (path->dentry->d_op && path->dentry->d_op->d_revalidate) { ++ path->dentry = do_revalidate(path->dentry, nd); ++ if (!path->dentry) { ++ res = -ENOENT; ++ path->mnt = NULL; ++ } ++ if (IS_ERR(path->dentry)) { ++ res = PTR_ERR(path->dentry); ++ path->dentry = NULL; ++ path->mnt = NULL; ++ } + } +- return result; ++ ++ return res; ++} ++ ++/** ++ * __real_lookup_topmost - lookup topmost dentry, non-cached version ++ * ++ * If we reach a dentry with restricted access, we just stop the lookup ++ * because we shouldn't see through that dentry. Same thing for dentry ++ * type mismatch and whiteouts. ++ * ++ * FIXME: ++ * - handle union stacks in use ++ * - handle union stacks mounted upon union stacks ++ * - avoid unnecessary allocations of union locks ++ */ ++static int __real_lookup_topmost(struct nameidata *nd, struct qstr *name, ++ struct path *path) ++{ ++ struct path next; ++ int err; ++ ++ err = real_lookup(nd, name, path); ++ if (err) ++ return err; ++ ++ if (path->dentry->d_inode || d_is_whiteout(path->dentry)) ++ return 0; ++ ++ if (IS_OPAQUE(nd->path.dentry->d_inode) && !d_is_fallthru(path->dentry)) ++ return 0; ++ ++ while (follow_union_down(&nd->path)) { ++ name->hash = full_name_hash(name->name, name->len); ++ if (nd->path.dentry->d_op && nd->path.dentry->d_op->d_hash) { ++ err = nd->path.dentry->d_op->d_hash(nd->path.dentry, ++ name); ++ if (err < 0) ++ goto out; ++ } ++ ++ err = real_lookup(nd, name, &next); ++ if (err) ++ goto out; ++ ++ if (next.dentry->d_inode || d_is_whiteout(next.dentry)) { ++ dput(path->dentry); ++ mntget(next.mnt); ++ *path = next; ++ goto out; ++ } ++ ++ if (IS_OPAQUE(nd->path.dentry->d_inode) && !d_is_fallthru(next.dentry)) ++ goto out; ++ ++ dput(next.dentry); ++ } ++out: ++ if (err) ++ dput(path->dentry); ++ return err; ++} ++ ++/** ++ * __real_lookup_build_union: build the union stack for this pathname ++ * part, non-cached version ++ * ++ * Called when not all parts of the union stack are in cache ++ */ ++ ++static int __real_lookup_build_union(struct nameidata *nd, struct qstr *name, ++ struct path *path) ++{ ++ struct path last = *path; ++ struct path next; ++ int err = 0; ++ ++ while (follow_union_down(&nd->path)) { ++ /* We need to recompute the hash for lower layer lookups */ ++ name->hash = full_name_hash(name->name, name->len); ++ if (nd->path.dentry->d_op && nd->path.dentry->d_op->d_hash) { ++ err = nd->path.dentry->d_op->d_hash(nd->path.dentry, ++ name); ++ if (err < 0) ++ goto out; ++ } ++ ++ err = real_lookup(nd, name, &next); ++ if (err) ++ goto out; ++ ++ if (d_is_whiteout(next.dentry)) { ++ dput(next.dentry); ++ break; ++ } ++ ++ if (!next.dentry->d_inode) { ++ dput(next.dentry); ++ continue; ++ } ++ ++ /* only directories can be part of a union stack */ ++ if (!S_ISDIR(next.dentry->d_inode->i_mode)) { ++ dput(next.dentry); ++ break; ++ } ++ ++ /* now we know we found something "real" */ ++ append_to_union(last.mnt, last.dentry, next.mnt, next.dentry); ++ ++ if (last.dentry != path->dentry) ++ path_put(&last); ++ last.dentry = next.dentry; ++ last.mnt = mntget(next.mnt); ++ } ++ ++ if (last.dentry != path->dentry) ++ path_put(&last); ++out: ++ return err; ++} ++ ++static int real_lookup_union(struct nameidata *nd, struct qstr *name, ++ struct path *path) ++{ ++ struct path safe = { .dentry = nd->path.dentry, .mnt = nd->path.mnt }; ++ int res ; ++ ++ path_get(&safe); ++ res = __real_lookup_topmost(nd, name, path); ++ if (res) ++ goto out; ++ ++ /* only directories can be part of a union stack */ ++ if (!path->dentry->d_inode || ++ !S_ISDIR(path->dentry->d_inode->i_mode)) ++ goto out; ++ ++ /* Build the union stack for this part */ ++ res = __real_lookup_build_union(nd, name, path); ++ if (res) { ++ dput(path->dentry); ++ if (path->mnt != safe.mnt) ++ mntput(path->mnt); ++ goto out; ++ } ++ ++out: ++ path_put(&nd->path); ++ nd->path.dentry = safe.dentry; ++ nd->path.mnt = safe.mnt; ++ return res; + } + + /* +@@ -629,11 +1008,8 @@ static __always_inline int __do_follow_l + touch_atime(path->mnt, dentry); + nd_set_link(nd, NULL); + +- if (path->mnt != nd->path.mnt) { +- path_to_nameidata(path, nd); +- dget(dentry); +- } +- mntget(path->mnt); ++ if (path->mnt == nd->path.mnt) ++ mntget(nd->path.mnt); + cookie = dentry->d_inode->i_op->follow_link(dentry, nd); + error = PTR_ERR(cookie); + if (!IS_ERR(cookie)) { +@@ -721,7 +1097,7 @@ static int __follow_mount(struct path *p + return res; + } + +-static void follow_mount(struct path *path) ++void follow_mount(struct path *path) + { + while (d_mountpoint(path->dentry)) { + struct vfsmount *mounted = lookup_mnt(path); +@@ -786,6 +1162,7 @@ static __always_inline void follow_dotdo + nd->path.mnt = parent; + } + follow_mount(&nd->path); ++ follow_union_mount(&nd->path); + } + + /* +@@ -796,35 +1173,55 @@ static __always_inline void follow_dotdo + static int do_lookup(struct nameidata *nd, struct qstr *name, + struct path *path) + { +- struct vfsmount *mnt = nd->path.mnt; +- struct dentry *dentry = __d_lookup(nd->path.dentry, name); ++ int err; ++ ++ if (IS_MNT_UNION(nd->path.mnt)) ++ goto need_union_lookup; + +- if (!dentry) ++ path->dentry = __d_lookup(nd->path.dentry, name); ++ path->mnt = nd->path.mnt; ++ if (!path->dentry) + goto need_lookup; +- if (dentry->d_op && dentry->d_op->d_revalidate) ++ if (path->dentry->d_op && path->dentry->d_op->d_revalidate) + goto need_revalidate; ++ + done: +- path->mnt = mnt; +- path->dentry = dentry; +- __follow_mount(path); ++ if (nd->path.mnt != path->mnt) { ++ nd->um_flags |= LAST_LOWLEVEL; ++ follow_mount(path); ++ } else ++ __follow_mount(path); ++ follow_union_mount(path); + return 0; + + need_lookup: +- dentry = real_lookup(nd->path.dentry, name, nd); +- if (IS_ERR(dentry)) ++ err = real_lookup(nd, name, path); ++ if (err) ++ goto fail; ++ goto done; ++ ++need_union_lookup: ++ err = cache_lookup_union(nd, name, path); ++ if (!err && path->dentry) ++ goto done; ++ ++ err = real_lookup_union(nd, name, path); ++ if (err) + goto fail; + goto done; + + need_revalidate: +- dentry = do_revalidate(dentry, nd); +- if (!dentry) ++ path->dentry = do_revalidate(path->dentry, nd); ++ if (!path->dentry) + goto need_lookup; +- if (IS_ERR(dentry)) ++ if (IS_ERR(path->dentry)) { ++ err = PTR_ERR(path->dentry); + goto fail; ++ } + goto done; + + fail: +- return PTR_ERR(dentry); ++ return err; + } + + /* +@@ -851,6 +1248,8 @@ static int __link_path_walk(const char * + if (nd->depth) + lookup_flags = LOOKUP_FOLLOW | (nd->flags & LOOKUP_CONTINUE); + ++ follow_union_mount(&nd->path); ++ + /* At this point we know we have a real path component. */ + for(;;) { + unsigned long hash; +@@ -913,6 +1312,44 @@ static int __link_path_walk(const char * + if (err) + break; + ++ /* ++ * We want to create this element on the top level ++ * file system in two cases: ++ * ++ * - We are specifically told to - LOOKUP_TOPMOST. ++ * - This is a directory, and it does not yet exist on ++ * the top level. Various tricks only work if ++ * directories always exist on the top level. ++ * ++ * In either case, only create this element on the top ++ * level if the last element is located on the lower ++ * level. If the last element is located on the top ++ * level, then every single element in the path ++ * already exists on the top level. ++ * ++ * Note that we can assume that the parent is on the ++ * top level since we always create the directory on ++ * the top level. ++ */ ++ ++ if ((nd->um_flags & LAST_LOWLEVEL) && ++ ((next.dentry->d_inode && ++ S_ISDIR(next.dentry->d_inode->i_mode) && ++ (nd->path.mnt != next.mnt)) || ++ (nd->flags & LOOKUP_TOPMOST))) { ++ struct dentry *dentry; ++ ++ dentry = union_create_topmost(nd, &this, &next); ++ if (IS_ERR(dentry)) { ++ err = PTR_ERR(dentry); ++ goto out_dput; ++ } ++ path_put_conditional(&next, nd); ++ next.mnt = nd->path.mnt; ++ next.dentry = dentry; ++ nd->um_flags &= ~LAST_LOWLEVEL; ++ } ++ + err = -ENOENT; + inode = next.dentry->d_inode; + if (!inode) +@@ -962,6 +1399,25 @@ last_component: + err = do_lookup(nd, &this, &next); + if (err) + break; ++ ++ if ((nd->um_flags & LAST_LOWLEVEL) && ++ ((next.dentry->d_inode && ++ S_ISDIR(next.dentry->d_inode->i_mode) && ++ (nd->path.mnt != next.mnt)) || ++ (nd->flags & LOOKUP_TOPMOST))) { ++ struct dentry *dentry; ++ ++ dentry = union_create_topmost(nd, &this, &next); ++ if (IS_ERR(dentry)) { ++ err = PTR_ERR(dentry); ++ goto out_dput; ++ } ++ path_put_conditional(&next, nd); ++ next.mnt = nd->path.mnt; ++ next.dentry = dentry; ++ nd->um_flags &= ~LAST_LOWLEVEL; ++ } ++ + inode = next.dentry->d_inode; + if ((lookup_flags & LOOKUP_FOLLOW) + && inode && inode->i_op->follow_link) { +@@ -1029,6 +1485,7 @@ static int path_init(int dfd, const char + + nd->last_type = LAST_ROOT; /* if there are only slashes... */ + nd->flags = flags; ++ nd->um_flags = 0; + nd->depth = 0; + nd->root.mnt = NULL; + +@@ -1172,61 +1629,437 @@ static int path_lookup_open(int dfd, con + } + + static struct dentry *__lookup_hash(struct qstr *name, +- struct dentry *base, struct nameidata *nd) ++ struct dentry *base, struct nameidata *nd) ++{ ++ struct dentry *dentry; ++ struct inode *inode; ++ int err; ++ ++ inode = base->d_inode; ++ ++ /* ++ * See if the low-level filesystem might want ++ * to use its own hash.. ++ */ ++ if (base->d_op && base->d_op->d_hash) { ++ err = base->d_op->d_hash(base, name); ++ dentry = ERR_PTR(err); ++ if (err < 0) ++ goto out; ++ } ++ ++ dentry = cache_lookup(base, name, nd); ++ if (!dentry) { ++ struct dentry *new; ++ ++ /* Don't create child dentry for a dead directory. */ ++ dentry = ERR_PTR(-ENOENT); ++ if (IS_DEADDIR(inode)) ++ goto out; ++ ++ new = d_alloc(base, name); ++ dentry = ERR_PTR(-ENOMEM); ++ if (!new) ++ goto out; ++ dentry = inode->i_op->lookup(inode, new, nd); ++ if (!dentry) ++ dentry = new; ++ else ++ dput(new); ++ } ++out: ++ return dentry; ++} ++ ++/* ++ * Restricted form of lookup. Doesn't follow links, single-component only, ++ * needs parent already locked. Doesn't follow mounts. ++ * SMP-safe. ++ */ ++static int lookup_hash(struct nameidata *nd, struct qstr *name, ++ struct path *path) ++{ ++ int err; ++ ++ err = inode_permission(nd->path.dentry->d_inode, MAY_EXEC); ++ if (err) ++ return err; ++ path->mnt = nd->path.mnt; ++ path->dentry = __lookup_hash(name, nd->path.dentry, nd); ++ if (IS_ERR(path->dentry)) { ++ err = PTR_ERR(path->dentry); ++ path->dentry = NULL; ++ path->mnt = NULL; ++ } ++ return err; ++} ++ ++static int __hash_lookup_topmost(struct nameidata *nd, struct qstr *name, ++ struct path *path) ++{ ++ struct path next; ++ int err; ++ ++ err = lookup_hash(nd, name, path); ++ if (err) ++ return err; ++ ++ if (path->dentry->d_inode || d_is_whiteout(path->dentry)) ++ return 0; ++ ++ if (IS_OPAQUE(nd->path.dentry->d_inode) && !d_is_fallthru(path->dentry)) ++ return 0; ++ ++ while (follow_union_down(&nd->path)) { ++ name->hash = full_name_hash(name->name, name->len); ++ if (nd->path.dentry->d_op && nd->path.dentry->d_op->d_hash) { ++ err = nd->path.dentry->d_op->d_hash(nd->path.dentry, ++ name); ++ if (err < 0) ++ goto out; ++ } ++ ++ mutex_lock(&nd->path.dentry->d_inode->i_mutex); ++ err = lookup_hash(nd, name, &next); ++ mutex_unlock(&nd->path.dentry->d_inode->i_mutex); ++ if (err) ++ goto out; ++ ++ if (next.dentry->d_inode || d_is_whiteout(next.dentry)) { ++ dput(path->dentry); ++ mntget(next.mnt); ++ *path = next; ++ goto out; ++ } ++ ++ if (IS_OPAQUE(nd->path.dentry->d_inode) && !d_is_fallthru(next.dentry)) ++ goto out; ++ ++ dput(next.dentry); ++ } ++out: ++ if (err) ++ dput(path->dentry); ++ return err; ++} ++ ++static int __hash_lookup_build_union(struct nameidata *nd, struct qstr *name, ++ struct path *path) ++{ ++ struct path last = *path; ++ struct path next; ++ int err = 0; ++ ++ while (follow_union_down(&nd->path)) { ++ /* We need to recompute the hash for lower layer lookups */ ++ name->hash = full_name_hash(name->name, name->len); ++ if (nd->path.dentry->d_op && nd->path.dentry->d_op->d_hash) { ++ err = nd->path.dentry->d_op->d_hash(nd->path.dentry, ++ name); ++ if (err < 0) ++ goto out; ++ } ++ ++ mutex_lock(&nd->path.dentry->d_inode->i_mutex); ++ err = lookup_hash(nd, name, &next); ++ mutex_unlock(&nd->path.dentry->d_inode->i_mutex); ++ if (err) ++ goto out; ++ ++ if (d_is_whiteout(next.dentry)) { ++ dput(next.dentry); ++ break; ++ } ++ ++ if (!next.dentry->d_inode) { ++ dput(next.dentry); ++ continue; ++ } ++ ++ /* only directories can be part of a union stack */ ++ if (!S_ISDIR(next.dentry->d_inode->i_mode)) { ++ dput(next.dentry); ++ break; ++ } ++ ++ /* now we know we found something "real" */ ++ append_to_union(last.mnt, last.dentry, next.mnt, next.dentry); ++ ++ if (last.dentry != path->dentry) ++ path_put(&last); ++ last.dentry = next.dentry; ++ last.mnt = mntget(next.mnt); ++ } ++ ++ if (last.dentry != path->dentry) ++ path_put(&last); ++out: ++ return err; ++} ++ ++int hash_lookup_union(struct nameidata *nd, struct qstr *name, ++ struct path *path) ++{ ++ struct path safe = { .dentry = nd->path.dentry, .mnt = nd->path.mnt }; ++ int res ; ++ ++ path_get(&safe); ++ res = __hash_lookup_topmost(nd, name, path); ++ if (res) ++ goto out; ++ ++ /* only directories can be part of a union stack */ ++ if (!path->dentry->d_inode || ++ !S_ISDIR(path->dentry->d_inode->i_mode)) ++ goto out; ++ ++ /* Build the union stack for this part */ ++ res = __hash_lookup_build_union(nd, name, path); ++ if (res) { ++ dput(path->dentry); ++ if (path->mnt != safe.mnt) ++ mntput(path->mnt); ++ goto out; ++ } ++ ++out: ++ path_put(&nd->path); ++ nd->path.dentry = safe.dentry; ++ nd->path.mnt = safe.mnt; ++ return res; ++} ++ ++/** ++ * do_union_hash_lookup() - walk down the union stack and lookup_hash() ++ * @nd: nameidata of parent to lookup from ++ * @name: pathname component to lookup ++ * @path: path to store result of lookup in ++ * ++ * Walk down the union stack and search for single pathname component name. It ++ * is assumed that the caller already did a lookup_hash() in the topmost parent ++ * that gave negative lookup result. Therefore this does call lookup_hash() in ++ * every lower layer (!) of the union stack. If a directory is found the union ++ * stack for that is assembled as well. ++ * ++ * Note: ++ * The caller needs to take care of holding a valid reference to the topmost ++ * parent. ++ * On error we leave @path untouched as well as when we don't find anything. ++ */ ++static int do_union_hash_lookup(struct nameidata *nd, struct qstr *name, ++ struct path *path) ++{ ++ struct path next; ++ int err = 0; ++ ++ while (follow_union_down(&nd->path)) { ++ /* rehash because of d_op->d_hash() by the previous layer */ ++ name->hash = full_name_hash(name->name, name->len); ++ ++ mutex_lock(&nd->path.dentry->d_inode->i_mutex); ++ err = lookup_hash(nd, name, &next); ++ mutex_unlock(&nd->path.dentry->d_inode->i_mutex); ++ ++ if (err) ++ break; ++ ++ if (next.dentry->d_inode) { ++ mntget(next.mnt); ++ if (!S_ISDIR(next.dentry->d_inode->i_mode)) { ++ *path = next; ++ break; ++ } ++ err = __hash_lookup_build_union(nd, name, &next); ++ if (err) ++ path_put(&next); ++ else ++ *path = next; ++ break; ++ } ++ ++ path_put_conditional(&next, nd); ++ ++ if ((IS_OPAQUE(nd->path.dentry->d_inode) && ++ !d_is_fallthru(next.dentry)) || ++ d_is_whiteout(next.dentry)) ++ break; ++ } ++ ++ return err; ++} ++ ++/** ++ * _hash_lookup_union() - lookup single pathname component ++ * @nd: nameidata of parent to lookup from ++ * @name: pathname component to lookup ++ * @path: path to store result of lookup in ++ * ++ * Returns the topmost parent locked and the target dentry found in the union ++ * or the topmost negative target dentry otherwise. ++ * ++ * Note: ++ * Returns topmost parent locked even on error. ++ */ ++static int _hash_lookup_union(struct nameidata *nd, struct qstr *name, ++ struct path *path) ++{ ++ struct path parent = nd->path; ++ struct path topmost; ++ int err; ++ ++ mutex_lock(&nd->path.dentry->d_inode->i_mutex); ++ err = lookup_hash(nd, name, path); ++ if (err) ++ return err; ++ ++ /* return if we found something and it isn't a directory we are done */ ++ if (path->dentry->d_inode && !S_ISDIR(path->dentry->d_inode->i_mode)) ++ return 0; ++ ++ /* stop lookup if the parent directory is marked opaque */ ++ if ((IS_OPAQUE(nd->path.dentry->d_inode) && ++ !d_is_fallthru(path->dentry)) || ++ d_is_whiteout(path->dentry)) ++ return 0; ++ ++ if (!strcmp(path->mnt->mnt_sb->s_type->name, "proc") || ++ !strcmp(path->mnt->mnt_sb->s_type->name, "sysfs")) ++ return 0; ++ ++ mutex_unlock(&nd->path.dentry->d_inode->i_mutex); ++ ++ /* ++ * safe a reference to the topmost parent for walking the union stack ++ */ ++ path_get(&parent); ++ topmost = *path; ++ ++ if (path->dentry->d_inode && S_ISDIR(path->dentry->d_inode->i_mode)) { ++ err = __hash_lookup_build_union(nd, name, path); ++ if (err) ++ goto err_lock_parent; ++ goto out_lock_and_revalidate_parent; ++ } ++ ++ err = do_union_hash_lookup(nd, name, path); ++ if (err) ++ goto err_lock_parent; ++ ++out_lock_and_revalidate_parent: ++ /* seems that we haven't found anything, so return the topmost */ ++ path_to_nameidata(&parent, nd); ++ mutex_lock(&nd->path.dentry->d_inode->i_mutex); ++ ++ if (topmost.dentry == path->dentry) { ++ spin_lock(&path->dentry->d_lock); ++ if (nd->path.dentry != path->dentry->d_parent) { ++ spin_unlock(&path->dentry->d_lock); ++ dput(path->dentry); ++ name->hash = full_name_hash(name->name, name->len); ++ err = lookup_hash(nd, name, path); ++ if (err) ++ return err; ++ /* FIXME: What if we find a directory here ... */ ++ return err; ++ } ++ spin_unlock(&path->dentry->d_lock); ++ } else ++ dput(topmost.dentry); ++ ++ return 0; ++ ++err_lock_parent: ++ path_to_nameidata(&parent, nd); ++ path_put_conditional(path, nd); ++ mutex_lock(&nd->path.dentry->d_inode->i_mutex); ++ return err; ++} ++ ++/** ++ * lookup_rename_source() - lookup the source used by rename ++ * ++ * This is a special version of _hash_lookup_union() which becomes necessary ++ * for finding the source of a rename on union mounts. ++ * ++ * See comment for _hash_lookup_union() above. ++ */ ++static int lookup_rename_source(struct nameidata *oldnd, ++ struct nameidata *newnd, ++ struct dentry **trap, struct qstr *name, ++ struct path *old) + { +- struct dentry *dentry; +- struct inode *inode; ++ struct path parent = oldnd->path; ++ struct path topmost; + int err; + +- inode = base->d_inode; ++ err = lookup_hash(oldnd, name, old); ++ if (err) ++ return err; ++ ++ /* return if we found something and it isn't a directory we are done */ ++ if (old->dentry->d_inode && !S_ISDIR(old->dentry->d_inode->i_mode)) ++ return 0; ++ ++ /* stop lookup if the parent directory is marked opaque */ ++ if ((IS_OPAQUE(oldnd->path.dentry->d_inode) && ++ !d_is_fallthru(old->dentry)) || ++ d_is_whiteout(old->dentry)) ++ return 0; ++ ++ if (!strcmp(old->mnt->mnt_sb->s_type->name, "proc") || ++ !strcmp(old->mnt->mnt_sb->s_type->name, "sysfs")) ++ return 0; ++ ++ unlock_rename(oldnd->path.dentry, newnd->path.dentry); + + /* +- * See if the low-level filesystem might want +- * to use its own hash.. ++ * safe a reference to the topmost parent for walking the union stack + */ +- if (base->d_op && base->d_op->d_hash) { +- err = base->d_op->d_hash(base, name); +- dentry = ERR_PTR(err); +- if (err < 0) +- goto out; ++ path_get(&parent); ++ topmost = *old; ++ ++ if (old->dentry->d_inode && S_ISDIR(old->dentry->d_inode->i_mode)) { ++ err = __hash_lookup_build_union(oldnd, name, old); ++ if (err) ++ goto err_lock; ++ goto out_lock_and_revalidate_parent; + } + +- dentry = cached_lookup(base, name, nd); +- if (!dentry) { +- struct dentry *new; ++ err = do_union_hash_lookup(oldnd, name, old); ++ if (err) ++ goto err_lock; + +- /* Don't create child dentry for a dead directory. */ +- dentry = ERR_PTR(-ENOENT); +- if (IS_DEADDIR(inode)) +- goto out; ++out_lock_and_revalidate_parent: ++ path_to_nameidata(&parent, oldnd); ++ *trap = lock_rename(oldnd->path.dentry, newnd->path.dentry); + +- new = d_alloc(base, name); +- dentry = ERR_PTR(-ENOMEM); +- if (!new) +- goto out; +- dentry = inode->i_op->lookup(inode, new, nd); +- if (!dentry) +- dentry = new; +- else +- dput(new); +- } +-out: +- return dentry; +-} ++ /* ++ * If we return the topmost dentry we have to make sure that it has not ++ * been moved away while we gave up the topmost parents i_mutex lock. ++ */ ++ if (topmost.dentry == old->dentry) { ++ spin_lock(&old->dentry->d_lock); ++ if (oldnd->path.dentry != old->dentry->d_parent) { ++ spin_unlock(&old->dentry->d_lock); ++ dput(old->dentry); ++ name->hash = full_name_hash(name->name, name->len); ++ err = lookup_hash(oldnd, name, old); ++ if (err) ++ return err; ++ /* FIXME: What if we find a directory here ... */ ++ return err; ++ } ++ spin_unlock(&old->dentry->d_lock); ++ } else ++ dput(topmost.dentry); + +-/* +- * Restricted form of lookup. Doesn't follow links, single-component only, +- * needs parent already locked. Doesn't follow mounts. +- * SMP-safe. +- */ +-static struct dentry *lookup_hash(struct nameidata *nd) +-{ +- int err; ++ return 0; + +- err = inode_permission(nd->path.dentry->d_inode, MAY_EXEC); +- if (err) +- return ERR_PTR(err); +- return __lookup_hash(&nd->last, nd->path.dentry, nd); ++err_lock: ++ path_to_nameidata(&parent, oldnd); ++ path_put_conditional(old, oldnd); ++ *trap = lock_rename(oldnd->path.dentry, newnd->path.dentry); ++ return err; + } + + static int __lookup_one_len(const char *name, struct qstr *this, +@@ -1502,8 +2335,9 @@ int vfs_create(struct inode *dir, struct + return error; + } + +-int may_open(struct path *path, int acc_mode, int flag) ++int may_open(struct nameidata *nd, int acc_mode, int flag) + { ++ struct path *path = &nd->path; + struct dentry *dentry = path->dentry; + struct inode *inode = dentry->d_inode; + int error; +@@ -1529,7 +2363,7 @@ int may_open(struct path *path, int acc_ + break; + } + +- error = inode_permission(inode, acc_mode); ++ error = union_permission(path, acc_mode); + if (error) + return error; + +@@ -1577,6 +2411,9 @@ int may_open(struct path *path, int acc_ + if (!error) + error = security_path_truncate(path, 0, + ATTR_MTIME|ATTR_CTIME|ATTR_OPEN); ++ /* XXX don't copy up file data */ ++ if (is_unionized(path->dentry, path->mnt)) ++ error = union_copyup(nd, flag /* XXX not used */); + if (!error) { + vfs_dq_init(inode); + +@@ -1623,7 +2460,7 @@ out_unlock: + if (error) + return error; + /* Don't check for write permission, don't truncate */ +- return may_open(&nd->path, 0, flag & ~O_TRUNC); ++ return may_open(nd, 0, flag & ~O_TRUNC); + } + + /* +@@ -1738,12 +2575,10 @@ struct file *do_filp_open(int dfd, const + if (flag & O_EXCL) + nd.flags |= LOOKUP_EXCL; + mutex_lock(&dir->d_inode->i_mutex); +- path.dentry = lookup_hash(&nd); +- path.mnt = nd.path.mnt; ++ error = hash_lookup_union(&nd, &nd.last, &path); + + do_last: +- error = PTR_ERR(path.dentry); +- if (IS_ERR(path.dentry)) { ++ if (error) { + mutex_unlock(&dir->d_inode->i_mutex); + goto exit; + } +@@ -1803,10 +2638,23 @@ do_last: + if (path.dentry->d_inode->i_op->follow_link) + goto do_link; + +- path_to_nameidata(&path, &nd); + error = -EISDIR; + if (path.dentry->d_inode && S_ISDIR(path.dentry->d_inode->i_mode)) +- goto exit; ++ goto exit_dput; ++ ++ /* ++ * If this file is on a lower layer of the union stack, copy it to the ++ * topmost layer before opening it ++ */ ++ if (path.dentry->d_inode && ++ (path.dentry->d_parent != dir) && ++ S_ISREG(path.dentry->d_inode->i_mode)) { ++ error = __union_copyup(&path, &nd, &path); ++ if (error) ++ goto exit_dput; ++ } ++ ++ path_to_nameidata(&path, &nd); + ok: + /* + * Consider: +@@ -1824,12 +2672,18 @@ ok: + if (error) + goto exit; + } +- error = may_open(&nd.path, acc_mode, flag); ++ error = may_open(&nd, acc_mode, flag); + if (error) { + if (will_write) + mnt_drop_write(nd.path.mnt); + goto exit; + } ++ /* Okay, all permissions go, now copy up */ ++ if (!(flag & O_CREAT) && (flag & FMODE_WRITE)) { ++ error = union_copyup(&nd, flag /* XXX not used */); ++ if (error) ++ goto exit; ++ } + filp = nameidata_to_filp(&nd, open_flag); + if (IS_ERR(filp)) + ima_counts_put(&nd.path, +@@ -1904,8 +2758,7 @@ do_link: + } + dir = nd.path.dentry; + mutex_lock(&dir->d_inode->i_mutex); +- path.dentry = lookup_hash(&nd); +- path.mnt = nd.path.mnt; ++ error = hash_lookup_union(&nd, &nd.last, &path); + __putname(nd.last.name); + goto do_last; + } +@@ -1939,7 +2792,8 @@ EXPORT_SYMBOL(filp_open); + */ + struct dentry *lookup_create(struct nameidata *nd, int is_dir) + { +- struct dentry *dentry = ERR_PTR(-EEXIST); ++ struct path path = { .dentry = ERR_PTR(-EEXIST) } ; ++ int err; + + mutex_lock_nested(&nd->path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); + /* +@@ -1955,11 +2809,13 @@ struct dentry *lookup_create(struct name + /* + * Do the final lookup. + */ +- dentry = lookup_hash(nd); +- if (IS_ERR(dentry)) ++ err = hash_lookup_union(nd, &nd->last, &path); ++ if (err) { ++ path.dentry = ERR_PTR(err); + goto fail; ++ } + +- if (dentry->d_inode) ++ if (path.dentry->d_inode) + goto eexist; + /* + * Special case - lookup gave negative, but... we had foo/bar/ +@@ -1968,15 +2824,17 @@ struct dentry *lookup_create(struct name + * been asking for (non-existent) directory. -ENOENT for you. + */ + if (unlikely(!is_dir && nd->last.name[nd->last.len])) { +- dput(dentry); +- dentry = ERR_PTR(-ENOENT); ++ path_put_conditional(&path, nd); ++ path.dentry = ERR_PTR(-ENOENT); + } +- return dentry; ++ if (nd->path.mnt != path.mnt) ++ mntput(path.mnt); ++ return path.dentry; + eexist: +- dput(dentry); +- dentry = ERR_PTR(-EEXIST); ++ path_put_conditional(&path, nd); ++ path.dentry = ERR_PTR(-EEXIST); + fail: +- return dentry; ++ return path.dentry; + } + EXPORT_SYMBOL_GPL(lookup_create); + +@@ -2088,6 +2946,7 @@ SYSCALL_DEFINE3(mknod, const char __user + int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) + { + int error = may_create(dir, dentry); ++ int opaque = 0; + + if (error) + return error; +@@ -2101,9 +2960,18 @@ int vfs_mkdir(struct inode *dir, struct + return error; + + vfs_dq_init(dir); ++ ++ if (d_is_whiteout(dentry)) ++ opaque = 1; ++ + error = dir->i_op->mkdir(dir, dentry, mode); +- if (!error) ++ if (!error) { + fsnotify_mkdir(dir, dentry); ++ if (opaque) { ++ dentry->d_inode->i_flags |= S_OPAQUE; ++ mark_inode_dirty(dentry->d_inode); ++ } ++ } + return error; + } + +@@ -2149,6 +3017,212 @@ SYSCALL_DEFINE2(mkdir, const char __user + return sys_mkdirat(AT_FDCWD, pathname, mode); + } + ++ ++/* Checks on the victim for whiteout */ ++static inline int may_whiteout(struct inode *dir, struct dentry *victim, ++ int isdir) ++{ ++ int err; ++ ++ /* from may_create() */ ++ if (IS_DEADDIR(dir)) ++ return -ENOENT; ++ err = inode_permission(dir, MAY_WRITE | MAY_EXEC); ++ if (err) ++ return err; ++ ++ /* from may_delete() */ ++ if (IS_APPEND(dir)) ++ return -EPERM; ++ if (!victim->d_inode) ++ return 0; ++ if (check_sticky(dir, victim->d_inode) || ++ IS_APPEND(victim->d_inode) || ++ IS_IMMUTABLE(victim->d_inode)) ++ return -EPERM; ++ if (isdir) { ++ if (!S_ISDIR(victim->d_inode->i_mode)) ++ return -ENOTDIR; ++ if (IS_ROOT(victim)) ++ return -EBUSY; ++ } else if (S_ISDIR(victim->d_inode->i_mode)) ++ return -EISDIR; ++ if (victim->d_flags & DCACHE_NFSFS_RENAMED) ++ return -EBUSY; ++ return 0; ++} ++ ++/** ++ * vfs_whiteout: creates a white-out for the given directory entry ++ * @dir: parent inode ++ * @dentry: directory entry to white-out ++ * ++ * Simply white-out a given directory entry. This functionality is usually used ++ * in the sense of unlink. Therefore the given dentry can still be in-use and ++ * contains an in-use inode. The filesystem has to do what unlink or rmdir ++ * would in that case. Since the dentry still might be in-use we have to ++ * provide a fresh unhashed dentry that whiteout can fill the new inode into. ++ * In that case the given dentry is dropped and the fresh dentry containing the ++ * whiteout is rehashed instead. If the given dentry is unused, the whiteout ++ * inode is instantiated into it instead. ++ * ++ * After this returns with success, don't make any assumptions about the inode. ++ * Just dput() it dentry. ++ */ ++static int vfs_whiteout(struct inode *dir, struct dentry *dentry, int isdir) ++{ ++ int err; ++ struct inode *old_inode = dentry->d_inode; ++ struct dentry *parent, *whiteout; ++ ++ err = may_whiteout(dir, dentry, isdir); ++ if (err) ++ return err; ++ ++ BUG_ON(dentry->d_parent->d_inode != dir); ++ ++ if (!dir->i_op || !dir->i_op->whiteout) ++ return -EOPNOTSUPP; ++ ++ if (old_inode) { ++ vfs_dq_init(dir); ++ ++ mutex_lock(&old_inode->i_mutex); ++ if (isdir) ++ dentry_unhash(dentry); ++ if (d_mountpoint(dentry)) ++ err = -EBUSY; ++ else { ++ if (isdir) ++ err = security_inode_rmdir(dir, dentry); ++ else ++ err = security_inode_unlink(dir, dentry); ++ } ++ } ++ ++ parent = dget_parent(dentry); ++ whiteout = d_alloc_name(parent, dentry->d_name.name); ++ ++ if (!err) ++ err = dir->i_op->whiteout(dir, dentry, whiteout); ++ ++ if (old_inode) { ++ mutex_unlock(&old_inode->i_mutex); ++ if (!err) { ++ fsnotify_link_count(old_inode); ++ d_delete(dentry); ++ } ++ if (isdir) ++ dput(dentry); ++ } ++ ++ dput(whiteout); ++ dput(parent); ++ return err; ++} ++ ++int path_whiteout(struct path *dir_path, struct dentry *dentry, int isdir) ++{ ++ int error = mnt_want_write(dir_path->mnt); ++ ++ if (!error) { ++ error = vfs_whiteout(dir_path->dentry->d_inode, dentry, isdir); ++ mnt_drop_write(dir_path->mnt); ++ } ++ ++ return error; ++} ++EXPORT_SYMBOL(path_whiteout); ++ ++/* ++ * This is abusing readdir to check if a union directory is logically empty. ++ * Al Viro barfed when he saw this, but Val said: "Well, at this point I'm ++ * aiming for working, pretty can come later" ++ */ ++static int filldir_is_empty(void *__buf, const char *name, int namlen, ++ loff_t offset, u64 ino, unsigned int d_type) ++{ ++ int *is_empty = (int *)__buf; ++ ++ switch (namlen) { ++ case 2: ++ if (name[1] != '.') ++ break; ++ case 1: ++ if (name[0] != '.') ++ break; ++ return 0; ++ } ++ ++ if (d_type == DT_WHT) ++ return 0; ++ ++ (*is_empty) = 0; ++ return 0; ++} ++ ++static int directory_is_empty(struct dentry *dentry, struct vfsmount *mnt) ++{ ++ struct file *file; ++ int err; ++ int is_empty = 1; ++ ++ BUG_ON(!S_ISDIR(dentry->d_inode->i_mode)); ++ ++ /* references for the file pointer */ ++ dget(dentry); ++ mntget(mnt); ++ ++ file = dentry_open(dentry, mnt, O_RDONLY, current_cred()); ++ if (IS_ERR(file)) ++ return 0; ++ ++ err = vfs_readdir(file, filldir_is_empty, &is_empty); ++ ++ fput(file); ++ return is_empty; ++} ++ ++static int do_whiteout(struct nameidata *nd, struct path *path, int isdir) ++{ ++ struct path safe = { .dentry = dget(nd->path.dentry), ++ .mnt = mntget(nd->path.mnt) }; ++ struct dentry *dentry = path->dentry; ++ int err; ++ ++ err = may_whiteout(nd->path.dentry->d_inode, dentry, isdir); ++ if (err) ++ goto out; ++ ++ err = -ENOENT; ++ if (!dentry->d_inode) ++ goto out; ++ ++ err = -ENOTEMPTY; ++ if (isdir && !directory_is_empty(path->dentry, path->mnt)) ++ goto out; ++ ++ if (nd->path.dentry != dentry->d_parent) { ++ dentry = __lookup_hash(&path->dentry->d_name, nd->path.dentry, ++ nd); ++ err = PTR_ERR(dentry); ++ if (IS_ERR(dentry)) ++ goto out; ++ ++ dput(path->dentry); ++ if (path->mnt != safe.mnt) ++ mntput(path->mnt); ++ path->mnt = nd->path.mnt; ++ path->dentry = dentry; ++ } ++ ++ err = vfs_whiteout(nd->path.dentry->d_inode, dentry, isdir); ++ ++out: ++ path_put(&safe); ++ return err; ++} ++ + /* + * We try to drop the dentry early: we should have + * a usage count of 2 if we're the only user of this +@@ -2213,7 +3287,7 @@ static long do_rmdir(int dfd, const char + { + int error = 0; + char * name; +- struct dentry *dentry; ++ struct path path; + struct nameidata nd; + + error = user_path_parent(dfd, pathname, &nd, &name); +@@ -2235,21 +3309,24 @@ static long do_rmdir(int dfd, const char + nd.flags &= ~LOOKUP_PARENT; + + mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); +- dentry = lookup_hash(&nd); +- error = PTR_ERR(dentry); +- if (IS_ERR(dentry)) ++ error = hash_lookup_union(&nd, &nd.last, &path); ++ if (error) + goto exit2; ++ if (is_unionized(nd.path.dentry, nd.path.mnt)) { ++ error = do_whiteout(&nd, &path, 1); ++ goto exit3; ++ } + error = mnt_want_write(nd.path.mnt); + if (error) + goto exit3; +- error = security_path_rmdir(&nd.path, dentry); ++ error = security_path_rmdir(&nd.path, path.dentry); + if (error) + goto exit4; +- error = vfs_rmdir(nd.path.dentry->d_inode, dentry); ++ error = vfs_rmdir(nd.path.dentry->d_inode, path.dentry); + exit4: + mnt_drop_write(nd.path.mnt); + exit3: +- dput(dentry); ++ path_put_conditional(&path, &nd); + exit2: + mutex_unlock(&nd.path.dentry->d_inode->i_mutex); + exit1: +@@ -2304,7 +3381,7 @@ static long do_unlinkat(int dfd, const c + { + int error; + char *name; +- struct dentry *dentry; ++ struct path path; + struct nameidata nd; + struct inode *inode = NULL; + +@@ -2319,26 +3396,29 @@ static long do_unlinkat(int dfd, const c + nd.flags &= ~LOOKUP_PARENT; + + mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); +- dentry = lookup_hash(&nd); +- error = PTR_ERR(dentry); +- if (!IS_ERR(dentry)) { ++ error = hash_lookup_union(&nd, &nd.last, &path); ++ if (!error) { + /* Why not before? Because we want correct error value */ + if (nd.last.name[nd.last.len]) + goto slashes; +- inode = dentry->d_inode; ++ inode = path.dentry->d_inode; + if (inode) + atomic_inc(&inode->i_count); ++ if (is_unionized(nd.path.dentry, nd.path.mnt)) { ++ error = do_whiteout(&nd, &path, 0); ++ goto exit2; ++ } + error = mnt_want_write(nd.path.mnt); + if (error) + goto exit2; +- error = security_path_unlink(&nd.path, dentry); ++ error = security_path_unlink(&nd.path, path.dentry); + if (error) + goto exit3; +- error = vfs_unlink(nd.path.dentry->d_inode, dentry); ++ error = vfs_unlink(nd.path.dentry->d_inode, path.dentry); + exit3: + mnt_drop_write(nd.path.mnt); + exit2: +- dput(dentry); ++ path_put_conditional(&path, &nd); + } + mutex_unlock(&nd.path.dentry->d_inode->i_mutex); + if (inode) +@@ -2349,8 +3429,8 @@ exit1: + return error; + + slashes: +- error = !dentry->d_inode ? -ENOENT : +- S_ISDIR(dentry->d_inode->i_mode) ? -EISDIR : -ENOTDIR; ++ error = !path.dentry->d_inode ? -ENOENT : ++ S_ISDIR(path.dentry->d_inode->i_mode) ? -EISDIR : -ENOTDIR; + goto exit2; + } + +@@ -2686,11 +3766,96 @@ int vfs_rename(struct inode *old_dir, st + return error; + } + ++static int vfs_rename_union(struct nameidata *oldnd, struct path *old, ++ struct nameidata *newnd, struct path *new) ++{ ++ struct inode *old_dir = oldnd->path.dentry->d_inode; ++ struct inode *new_dir = newnd->path.dentry->d_inode; ++ struct qstr old_name; ++ char *name; ++ struct dentry *dentry; ++ int error; ++ ++ if (old->dentry->d_inode == new->dentry->d_inode) ++ return 0; ++ error = may_whiteout(old_dir, old->dentry, 0); ++ if (error) ++ return error; ++ if (!old_dir->i_op || !old_dir->i_op->whiteout) ++ return -EPERM; ++ ++ if (!new->dentry->d_inode) ++ error = may_create(new_dir, new->dentry); ++ else ++ error = may_delete(new_dir, new->dentry, 0); ++ if (error) ++ return error; ++ ++ vfs_dq_init(old_dir); ++ vfs_dq_init(new_dir); ++ ++ error = -EBUSY; ++ if (d_mountpoint(old->dentry) || d_mountpoint(new->dentry)) ++ return error; ++ ++ error = -ENOMEM; ++ name = kmalloc(old->dentry->d_name.len, GFP_KERNEL); ++ if (!name) ++ return error; ++ strncpy(name, old->dentry->d_name.name, old->dentry->d_name.len); ++ name[old->dentry->d_name.len] = 0; ++ old_name.len = old->dentry->d_name.len; ++ old_name.hash = old->dentry->d_name.hash; ++ old_name.name = name; ++ ++ /* possibly delete the existing new file */ ++ if ((newnd->path.dentry == new->dentry->d_parent) && ++ new->dentry->d_inode) { ++ /* FIXME: inode may be truncated while we hold a lock */ ++ error = vfs_unlink(new_dir, new->dentry); ++ if (error) ++ goto freename; ++ ++ dentry = __lookup_hash(&new->dentry->d_name, ++ newnd->path.dentry, newnd); ++ if (IS_ERR(dentry)) ++ goto freename; ++ ++ dput(new->dentry); ++ new->dentry = dentry; ++ } ++ ++ /* copyup to the new file */ ++ error = __union_copyup(old, newnd, new); ++ if (error) ++ goto freename; ++ ++ /* whiteout the old file */ ++ dentry = __lookup_hash(&old_name, oldnd->path.dentry, oldnd); ++ error = PTR_ERR(dentry); ++ if (IS_ERR(dentry)) ++ goto freename; ++ error = vfs_whiteout(old_dir, dentry, 0); ++ dput(dentry); ++ ++ /* FIXME: This is acutally unlink() && create() ... */ ++/* ++ if (!error) { ++ const char *new_name = old_dentry->d_name.name; ++ fsnotify_move(old_dir, new_dir, old_name.name, new_name, 0, ++ new_dentry->d_inode, old_dentry->d_inode); ++ } ++*/ ++freename: ++ kfree(old_name.name); ++ return error; ++} ++ + SYSCALL_DEFINE4(renameat, int, olddfd, const char __user *, oldname, + int, newdfd, const char __user *, newname) + { + struct dentry *old_dir, *new_dir; +- struct dentry *old_dentry, *new_dentry; ++ struct path old, new; + struct dentry *trap; + struct nameidata oldnd, newnd; + char *from; +@@ -2724,16 +3889,28 @@ SYSCALL_DEFINE4(renameat, int, olddfd, c + + trap = lock_rename(new_dir, old_dir); + +- old_dentry = lookup_hash(&oldnd); +- error = PTR_ERR(old_dentry); +- if (IS_ERR(old_dentry)) ++ /* ++ * For union mounts we need to call a giant lookup_rename_source() ++ * instead. ++ * First lock_rename() and look on the topmost fs like you would do in ++ * the normal rename, if you find something which is not a directory, ++ * go ahead and lookup target and do normal rename. ++ * If you find a negative dentry, unlock_rename() and continue as ++ * _hash_lookup_union() would do without locking the topmost parent ++ * at the end. After that do lock_rename() of the source parent and the ++ * target parent and do a copyup with additional whiteout creation at ++ * the end. ++ */ ++// error = hash_lookup_union(&oldnd, &oldnd.last, &old); ++ error = lookup_rename_source(&oldnd, &newnd, &trap, &oldnd.last, &old); ++ if (error) + goto exit3; + /* source must exist */ + error = -ENOENT; +- if (!old_dentry->d_inode) ++ if (!old.dentry->d_inode) + goto exit4; + /* unless the source is a directory trailing slashes give -ENOTDIR */ +- if (!S_ISDIR(old_dentry->d_inode->i_mode)) { ++ if (!S_ISDIR(old.dentry->d_inode->i_mode)) { + error = -ENOTDIR; + if (oldnd.last.name[oldnd.last.len]) + goto exit4; +@@ -2742,32 +3919,44 @@ SYSCALL_DEFINE4(renameat, int, olddfd, c + } + /* source should not be ancestor of target */ + error = -EINVAL; +- if (old_dentry == trap) ++ if (old.dentry == trap) + goto exit4; +- new_dentry = lookup_hash(&newnd); +- error = PTR_ERR(new_dentry); +- if (IS_ERR(new_dentry)) ++ /* target is always on topmost fs, even with unions */ ++ error = lookup_hash(&newnd, &newnd.last, &new); ++ if (error) + goto exit4; + /* target should not be an ancestor of source */ + error = -ENOTEMPTY; +- if (new_dentry == trap) ++ if (new.dentry == trap) ++ goto exit5; ++ /* renaming of directories on unions is done by the user-space */ ++ error = -EXDEV; ++ if (is_unionized(oldnd.path.dentry, oldnd.path.mnt) && ++ S_ISDIR(old.dentry->d_inode->i_mode)) + goto exit5; ++// if (is_unionized(newnd.path.dentry, newnd.path.mnt)) ++// goto exit5; + + error = mnt_want_write(oldnd.path.mnt); + if (error) + goto exit5; +- error = security_path_rename(&oldnd.path, old_dentry, +- &newnd.path, new_dentry); ++ error = security_path_rename(&oldnd.path, old.dentry, ++ &newnd.path, new.dentry); + if (error) + goto exit6; +- error = vfs_rename(old_dir->d_inode, old_dentry, +- new_dir->d_inode, new_dentry); ++ if (is_unionized(oldnd.path.dentry, oldnd.path.mnt) && ++ (old.dentry->d_parent != oldnd.path.dentry)) { ++ error = vfs_rename_union(&oldnd, &old, &newnd, &new); ++ goto exit6; ++ } ++ error = vfs_rename(old_dir->d_inode, old.dentry, ++ new_dir->d_inode, new.dentry); + exit6: + mnt_drop_write(oldnd.path.mnt); + exit5: +- dput(new_dentry); ++ path_put_conditional(&new, &newnd); + exit4: +- dput(old_dentry); ++ path_put_conditional(&old, &oldnd); + exit3: + unlock_rename(new_dir, old_dir); + exit2: +--- a/fs/namespace.c ++++ b/fs/namespace.c +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + #include + #include + #include "pnode.h" +@@ -150,6 +151,9 @@ struct vfsmount *alloc_vfsmnt(const char + INIT_LIST_HEAD(&mnt->mnt_share); + INIT_LIST_HEAD(&mnt->mnt_slave_list); + INIT_LIST_HEAD(&mnt->mnt_slave); ++#ifdef CONFIG_UNION_MOUNT ++ INIT_LIST_HEAD(&mnt->mnt_unions); ++#endif + #ifdef CONFIG_SMP + mnt->mnt_writers = alloc_percpu(int); + if (!mnt->mnt_writers) +@@ -469,6 +473,7 @@ static void __touch_mnt_namespace(struct + + static void detach_mnt(struct vfsmount *mnt, struct path *old_path) + { ++ detach_mnt_union(mnt); + old_path->dentry = mnt->mnt_mountpoint; + old_path->mnt = mnt->mnt_parent; + mnt->mnt_parent = mnt; +@@ -492,6 +497,7 @@ static void attach_mnt(struct vfsmount * + list_add_tail(&mnt->mnt_hash, mount_hashtable + + hash(path->mnt, path->dentry)); + list_add_tail(&mnt->mnt_child, &path->mnt->mnt_mounts); ++ attach_mnt_union(mnt, path->mnt, path->dentry); + } + + /* +@@ -514,6 +520,7 @@ static void commit_tree(struct vfsmount + list_add_tail(&mnt->mnt_hash, mount_hashtable + + hash(parent, mnt->mnt_mountpoint)); + list_add_tail(&mnt->mnt_child, &parent->mnt_mounts); ++ attach_mnt_union(mnt, mnt->mnt_parent, mnt->mnt_mountpoint); + touch_mnt_namespace(n); + } + +@@ -770,6 +777,7 @@ static void show_mnt_opts(struct seq_fil + { MNT_NODIRATIME, ",nodiratime" }, + { MNT_RELATIME, ",relatime" }, + { MNT_STRICTATIME, ",strictatime" }, ++ { MNT_UNION, ",union" }, + { 0, NULL } + }; + const struct proc_fs_info *fs_infop; +@@ -984,6 +992,7 @@ void release_mounts(struct list_head *he + struct dentry *dentry; + struct vfsmount *m; + spin_lock(&vfsmount_lock); ++ detach_mnt_union(mnt); + dentry = mnt->mnt_mountpoint; + m = mnt->mnt_parent; + mnt->mnt_mountpoint = mnt->mnt_root; +@@ -1102,6 +1111,11 @@ static int do_umount(struct vfsmount *mn + spin_unlock(&vfsmount_lock); + if (retval) + security_sb_umount_busy(mnt); ++ /* If this was a union mount, we are no longer a read-only ++ * user on the underlying mount */ ++ if (mnt->mnt_flags & MNT_UNION) ++ mnt->mnt_parent->mnt_sb->s_readonly_users--; ++ + up_write(&namespace_sem); + release_mounts(&umount_list); + return retval; +@@ -1426,6 +1440,10 @@ static int do_change_type(struct path *p + if (path->dentry != path->mnt->mnt_root) + return -EINVAL; + ++ /* Don't change the type of union mounts */ ++ if (IS_MNT_UNION(path->mnt)) ++ return -EINVAL; ++ + down_write(&namespace_sem); + if (type == MS_SHARED) { + err = invent_group_ids(mnt, recurse); +@@ -1444,10 +1462,65 @@ static int do_change_type(struct path *p + } + + /* ++ * Mount-time check of upper and lower layer file systems to see if we ++ * can union mount one on the other. ++ * ++ * Union mounts must follow these rules: ++ * ++ * - The lower layer must be read-only. This avoids lots of nasty ++ * unsolvable races where file system structures disappear suddenly. ++ * XXX - Checking the vfsmnt for read-only is a temporary hack; the ++ * file system could be mounted read-write elsewhere. We need to ++ * enforce read-only at the superblock level (patches coming). ++ * ++ * - The upper layer must be writable. This isn't an absolute ++ * requirement; right now we need it to make readdir() work since we ++ * copy up directory entries to the top level. A possible ++ * workaround is to mount a tmpfs file system transparently over the ++ * top. ++ * ++ * - The upper layer must support whiteouts and fallthrus (if it is ++ * writeable). ++ * ++ * - The lower layer must not also be a union mount. This is just to ++ * make life simpler for now, there is no inherent limitation on the ++ * number of layers. ++ * ++ * XXX - Check other mount flags for incompatibilities - I'm sure ++ * there are some. ++ */ ++ ++static int ++check_union_mnt(struct path *mntpnt, struct vfsmount *top_mnt, int mnt_flags) ++{ ++ struct vfsmount *lower_mnt = mntpnt->mnt; ++ ++ /* Is this even a union mount? */ ++ if (!(mnt_flags & MNT_UNION)) ++ return 0; ++ ++ /* Lower layer must be read-only and not a union mount */ ++ if (!(lower_mnt->mnt_sb->s_flags & MS_RDONLY) || ++ (lower_mnt->mnt_flags & MNT_UNION)) ++ return -EBUSY; ++ ++ /* Upper layer must be writable */ ++ if (mnt_flags & MNT_READONLY) ++ return -EROFS; ++ ++ /* Upper layer must support whiteouts and fallthrus */ ++ if (!(top_mnt->mnt_sb->s_flags & MS_WHITEOUT)) ++ return -EINVAL; ++ ++ /* All good! */ ++ return 0; ++} ++ ++/* + * do loopback mount. + */ +-static int do_loopback(struct path *path, char *old_name, +- int recurse) ++static int do_loopback(struct path *path, char *old_name, int recurse, ++ int mnt_flags) + { + struct path old_path; + struct vfsmount *mnt = NULL; +@@ -1477,6 +1550,13 @@ static int do_loopback(struct path *path + if (!mnt) + goto out; + ++ err = check_union_mnt(&old_path, mnt, mnt_flags); ++ if (err) ++ goto out; ++ ++ if (mnt_flags & MNT_UNION) ++ mnt->mnt_flags |= MNT_UNION; ++ + err = graft_tree(mnt, path); + if (err) { + LIST_HEAD(umount_list); +@@ -1486,6 +1566,10 @@ static int do_loopback(struct path *path + release_mounts(&umount_list); + } + ++ /* If this is a union mount, add ourselves to the readonly users */ ++ if (mnt_flags & MNT_UNION) ++ mnt->mnt_parent->mnt_sb->s_readonly_users++; ++ + out: + up_write(&namespace_sem); + path_put(&old_path); +@@ -1570,6 +1654,13 @@ static int do_move_mount(struct path *pa + if (err) + return err; + ++ /* moving to or from a union mount is not supported */ ++ err = -EINVAL; ++ if (IS_MNT_UNION(path->mnt)) ++ goto exit; ++ if (IS_MNT_UNION(old_path.mnt)) ++ goto exit; ++ + down_write(&namespace_sem); + while (d_mountpoint(path->dentry) && + follow_down(path)) +@@ -1627,6 +1718,7 @@ out: + up_write(&namespace_sem); + if (!err) + path_put(&parent_path); ++exit: + path_put(&old_path); + return err; + } +@@ -1684,10 +1776,18 @@ int do_add_mount(struct vfsmount *newmnt + if (S_ISLNK(newmnt->mnt_root->d_inode->i_mode)) + goto unlock; + ++ err = check_union_mnt(path, newmnt, mnt_flags); ++ if (err) ++ goto unlock; ++ + newmnt->mnt_flags = mnt_flags; + if ((err = graft_tree(newmnt, path))) + goto unlock; + ++ /* If this is a union mount, add ourselves to the readonly users */ ++ if (mnt_flags & MNT_UNION) ++ newmnt->mnt_parent->mnt_sb->s_readonly_users++; ++ + if (fslist) /* add to the specified expiration list */ + list_add_tail(&newmnt->mnt_expire, fslist); + +@@ -1940,10 +2040,12 @@ long do_mount(char *dev_name, char *dir_ + mnt_flags &= ~(MNT_RELATIME | MNT_NOATIME); + if (flags & MS_RDONLY) + mnt_flags |= MNT_READONLY; ++ if (flags & MS_UNION) ++ mnt_flags |= MNT_UNION; + + flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | + MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT | +- MS_STRICTATIME); ++ MS_STRICTATIME | MS_UNION); + + /* ... and get the mountpoint */ + retval = kern_path(dir_name, LOOKUP_FOLLOW, &path); +@@ -1959,7 +2061,8 @@ long do_mount(char *dev_name, char *dir_ + retval = do_remount(&path, flags & ~MS_REMOUNT, mnt_flags, + data_page); + else if (flags & MS_BIND) +- retval = do_loopback(&path, dev_name, flags & MS_REC); ++ retval = do_loopback(&path, dev_name, flags & MS_REC, ++ mnt_flags); + else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE)) + retval = do_change_type(&path, flags); + else if (flags & MS_MOVE) +@@ -2196,6 +2299,8 @@ SYSCALL_DEFINE2(pivot_root, const char _ + if (d_unlinked(old.dentry)) + goto out2; + error = -EBUSY; ++ follow_union_down(&new); ++ follow_union_down(&root); + if (new.mnt == root.mnt || + old.mnt == root.mnt) + goto out2; /* loop, on the same file system */ +--- a/fs/nfsctl.c ++++ b/fs/nfsctl.c +@@ -38,10 +38,10 @@ static struct file *do_open(char *name, + return ERR_PTR(error); + + if (flags == O_RDWR) +- error = may_open(&nd.path, MAY_READ|MAY_WRITE, +- FMODE_READ|FMODE_WRITE); ++ error = may_open(&nd, MAY_READ|MAY_WRITE, ++ FMODE_READ|FMODE_WRITE); + else +- error = may_open(&nd.path, MAY_WRITE, FMODE_WRITE); ++ error = may_open(&nd, MAY_WRITE, FMODE_WRITE); + + if (!error) + return dentry_open(nd.path.dentry, nd.path.mnt, flags, +--- a/fs/nfsd/nfs3xdr.c ++++ b/fs/nfsd/nfs3xdr.c +@@ -898,6 +898,11 @@ encode_entry(struct readdir_cd *ccd, con + int elen; /* estimated entry length in words */ + int num_entry_words = 0; /* actual number of words */ + ++ if (d_type == DT_WHT) { ++ cd->common.err = nfs_ok; ++ return 0; ++ } ++ + if (cd->offset) { + u64 offset64 = offset; + +--- a/fs/nfsd/nfs4xdr.c ++++ b/fs/nfsd/nfs4xdr.c +@@ -2261,7 +2261,7 @@ nfsd4_encode_dirent(void *ccdv, const ch + __be32 nfserr = nfserr_toosmall; + + /* In nfsv4, "." and ".." never make it onto the wire.. */ +- if (name && isdotent(name, namlen)) { ++ if (d_type == DT_WHT || (name && isdotent(name, namlen))) { + cd->common.err = nfs_ok; + return 0; + } +--- a/fs/nfsd/nfsxdr.c ++++ b/fs/nfsd/nfsxdr.c +@@ -513,6 +513,10 @@ nfssvc_encode_entry(void *ccdv, const ch + namlen, name, offset, ino); + */ + ++ if (d_type == DT_WHT) { ++ cd->common.err = nfs_ok; ++ return 0; ++ } + if (offset > ~((u32) 0)) { + cd->common.err = nfserr_fbig; + return -EINVAL; +--- a/fs/open.c ++++ b/fs/open.c +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + + int vfs_statfs(struct dentry *dentry, struct kstatfs *buf) + { +@@ -224,69 +225,69 @@ int do_truncate(struct dentry *dentry, l + return ret; + } + +-static long do_sys_truncate(const char __user *pathname, loff_t length) ++static int __do_ftruncate(struct file *file, unsigned long length, int small) + { +- struct path path; +- struct inode *inode; ++ struct inode * inode; ++ struct dentry *dentry; + int error; + + error = -EINVAL; +- if (length < 0) /* sorry, but loff_t says... */ ++ if (length < 0) + goto out; ++ /* explicitly opened as large or we are on 64-bit box */ ++ if (file->f_flags & O_LARGEFILE) ++ small = 0; + +- error = user_path(pathname, &path); +- if (error) ++ dentry = file->f_path.dentry; ++ inode = dentry->d_inode; ++ error = -EINVAL; ++ if (!S_ISREG(inode->i_mode) || !(file->f_mode & FMODE_WRITE)) + goto out; +- inode = path.dentry->d_inode; +- +- /* For directories it's -EISDIR, for other non-regulars - -EINVAL */ +- error = -EISDIR; +- if (S_ISDIR(inode->i_mode)) +- goto dput_and_out; + + error = -EINVAL; +- if (!S_ISREG(inode->i_mode)) +- goto dput_and_out; +- +- error = mnt_want_write(path.mnt); +- if (error) +- goto dput_and_out; ++ /* Cannot ftruncate over 2^31 bytes without large file support */ ++ if (small && length > MAX_NON_LFS) + +- error = inode_permission(inode, MAY_WRITE); +- if (error) +- goto mnt_drop_write_and_out; ++ goto out; + + error = -EPERM; + if (IS_APPEND(inode)) +- goto mnt_drop_write_and_out; ++ goto out; + +- error = get_write_access(inode); +- if (error) +- goto mnt_drop_write_and_out; ++ error = locks_verify_truncate(inode, file, length); ++ if (!error) ++ error = security_path_truncate(&file->f_path, length, ++ ATTR_MTIME|ATTR_CTIME); ++ if (!error) ++ /* Already copied up for union, opened with write */ ++ error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file); ++out: ++ return error; ++} + +- /* +- * Make sure that there are no leases. get_write_access() protects +- * against the truncate racing with a lease-granting setlease(). +- */ +- error = break_lease(inode, FMODE_WRITE); +- if (error) +- goto put_write_and_out; ++static long do_sys_truncate(const char __user *pathname, loff_t length) ++{ ++ struct file *file; ++ char *tmp; ++ int error; + +- error = locks_verify_truncate(inode, NULL, length); +- if (!error) +- error = security_path_truncate(&path, length, 0); +- if (!error) { +- vfs_dq_init(inode); +- error = do_truncate(path.dentry, length, 0, NULL); +- } ++ error = -EINVAL; ++ if (length < 0) /* sorry, but loff_t says... */ ++ return error; + +-put_write_and_out: +- put_write_access(inode); +-mnt_drop_write_and_out: +- mnt_drop_write(path.mnt); +-dput_and_out: +- path_put(&path); +-out: ++ tmp = getname(pathname); ++ if (IS_ERR(tmp)) ++ return PTR_ERR(tmp); ++ ++ file = filp_open(tmp, O_RDWR | O_LARGEFILE, 0); ++ putname(tmp); ++ ++ if (IS_ERR(file)) ++ return PTR_ERR(file); ++ ++ error = __do_ftruncate(file, length, 0); ++ ++ fput(file); + return error; + } + +@@ -297,45 +298,16 @@ SYSCALL_DEFINE2(truncate, const char __u + + static long do_sys_ftruncate(unsigned int fd, loff_t length, int small) + { +- struct inode * inode; +- struct dentry *dentry; + struct file * file; + int error; + +- error = -EINVAL; +- if (length < 0) +- goto out; + error = -EBADF; + file = fget(fd); + if (!file) + goto out; + +- /* explicitly opened as large or we are on 64-bit box */ +- if (file->f_flags & O_LARGEFILE) +- small = 0; +- +- dentry = file->f_path.dentry; +- inode = dentry->d_inode; +- error = -EINVAL; +- if (!S_ISREG(inode->i_mode) || !(file->f_mode & FMODE_WRITE)) +- goto out_putf; +- +- error = -EINVAL; +- /* Cannot ftruncate over 2^31 bytes without large file support */ +- if (small && length > MAX_NON_LFS) +- goto out_putf; ++ error = __do_ftruncate(file, length, small); + +- error = -EPERM; +- if (IS_APPEND(inode)) +- goto out_putf; +- +- error = locks_verify_truncate(inode, file, length); +- if (!error) +- error = security_path_truncate(&file->f_path, length, +- ATTR_MTIME|ATTR_CTIME); +- if (!error) +- error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file); +-out_putf: + fput(file); + out: + return error; +@@ -494,7 +466,8 @@ SYSCALL_DEFINE3(faccessat, int, dfd, con + goto out_path_release; + } + +- res = inode_permission(inode, mode | MAY_ACCESS); ++ res = union_permission(&path, mode | MAY_ACCESS); ++ + /* SuS v2 requires we report a read only fs too */ + if (res || !(mode & S_IWOTH) || special_file(inode->i_mode)) + goto out_path_release; +@@ -508,7 +481,8 @@ SYSCALL_DEFINE3(faccessat, int, dfd, con + * inherently racy and know that the fs may change + * state before we even see this result. + */ +- if (__mnt_is_readonly(path.mnt)) ++ if ((!is_unionized(path.dentry, path.mnt) && ++ (__mnt_is_readonly(path.mnt)))) + res = -EROFS; + + out_path_release: +@@ -554,20 +528,19 @@ SYSCALL_DEFINE1(fchdir, unsigned int, fd + error = -EBADF; + file = fget(fd); + if (!file) +- goto out; ++ return error; + + inode = file->f_path.dentry->d_inode; + + error = -ENOTDIR; + if (!S_ISDIR(inode->i_mode)) +- goto out_putf; ++ goto out; + + error = inode_permission(inode, MAY_EXEC | MAY_ACCESS); + if (!error) + set_fs_pwd(current->fs, &file->f_path); +-out_putf: +- fput(file); + out: ++ fput(file); + return error; + } + +--- a/fs/readdir.c ++++ b/fs/readdir.c +@@ -16,6 +16,7 @@ + #include + #include + #include ++#include + + #include + +@@ -36,9 +37,24 @@ int vfs_readdir(struct file *file, filld + + res = -ENOENT; + if (!IS_DEADDIR(inode)) { ++ /* ++ * XXX Think harder about locking for ++ * union_copyup_dir. Currently we lock the topmost ++ * directory and hold that lock while sequentially ++ * acquiring and dropping locks for the directories ++ * below this one in the union stack. ++ */ ++ if (is_unionized(file->f_path.dentry, file->f_path.mnt) && ++ !IS_OPAQUE(inode)) { ++ res = union_copyup_dir(&file->f_path); ++ if (res) ++ goto out_unlock; ++ } ++ + res = file->f_op->readdir(file, buf, filler); + file_accessed(file); + } ++out_unlock: + mutex_unlock(&inode->i_mutex); + out: + return res; +@@ -77,6 +93,9 @@ static int fillonedir(void * __buf, cons + struct old_linux_dirent __user * dirent; + unsigned long d_ino; + ++ if (d_type == DT_WHT) ++ return 0; ++ + if (buf->result) + return -EINVAL; + d_ino = ino; +@@ -154,6 +173,9 @@ static int filldir(void * __buf, const c + unsigned long d_ino; + int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 2, sizeof(long)); + ++ if (d_type == DT_WHT) ++ return 0; ++ + buf->error = -EINVAL; /* only used if we fail.. */ + if (reclen > buf->count) + return -EINVAL; +@@ -239,6 +261,9 @@ static int filldir64(void * __buf, const + struct getdents_callback64 * buf = (struct getdents_callback64 *) __buf; + int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(u64)); + ++ if (d_type == DT_WHT) ++ return 0; ++ + buf->error = -EINVAL; /* only used if we fail.. */ + if (reclen > buf->count) + return -EINVAL; +--- a/fs/super.c ++++ b/fs/super.c +@@ -596,6 +596,15 @@ int do_remount_sb(struct super_block *sb + } + remount_rw = !(flags & MS_RDONLY) && (sb->s_flags & MS_RDONLY); + ++ /* If we are remounting read/write, make sure that none of the ++ users require read-only for correct operation (such as ++ union mounts). */ ++ if (remount_rw && sb->s_readonly_users) { ++ printk(KERN_INFO "%s: In use by %d read-only user(s)\n", ++ sb->s_id, sb->s_readonly_users); ++ return -EROFS; ++ } ++ + if (sb->s_op->remount_fs) { + retval = sb->s_op->remount_fs(sb, &flags, data); + if (retval) +@@ -953,6 +962,11 @@ vfs_kern_mount(struct file_system_type * + WARN((mnt->mnt_sb->s_maxbytes < 0), "%s set sb->s_maxbytes to " + "negative value (%lld)\n", type->name, mnt->mnt_sb->s_maxbytes); + ++ error = -EROFS; ++ if (!(flags & MS_RDONLY) && ++ (mnt->mnt_sb->s_readonly_users)) ++ goto out_sb; ++ + mnt->mnt_mountpoint = mnt->mnt_root; + mnt->mnt_parent = mnt; + up_write(&mnt->mnt_sb->s_umount); +--- /dev/null ++++ b/fs/union.c +@@ -0,0 +1,981 @@ ++/* ++ * VFS based union mount for Linux ++ * ++ * Copyright (C) 2004-2007 IBM Corporation, IBM Deutschland Entwicklung GmbH. ++ * Copyright (C) 2007-2009 Novell Inc. ++ * ++ * Author(s): Jan Blunck (j.blunck@tu-harburg.de) ++ * Valerie Aurora ++ * ++ * 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 of the License, or (at your option) ++ * any later version. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* ++ * This is borrowed from fs/inode.c. The hashtable for lookups. Somebody ++ * should try to make this good - I've just made it work. ++ */ ++static unsigned int union_hash_mask __read_mostly; ++static unsigned int union_hash_shift __read_mostly; ++static struct hlist_head *union_hashtable __read_mostly; ++static unsigned int union_rhash_mask __read_mostly; ++static unsigned int union_rhash_shift __read_mostly; ++static struct hlist_head *union_rhashtable __read_mostly; ++ ++/* ++ * Locking Rules: ++ * - dcache_lock (for union_rlookup() only) ++ * - union_lock ++ */ ++DEFINE_SPINLOCK(union_lock); ++ ++static struct kmem_cache *union_cache __read_mostly; ++ ++static unsigned long hash(struct dentry *dentry, struct vfsmount *mnt) ++{ ++ unsigned long tmp; ++ ++ tmp = ((unsigned long)mnt * (unsigned long)dentry) ^ ++ (GOLDEN_RATIO_PRIME + (unsigned long)mnt) / L1_CACHE_BYTES; ++ tmp = tmp ^ ((tmp ^ GOLDEN_RATIO_PRIME) >> union_hash_shift); ++ return tmp & union_hash_mask; ++} ++ ++static __initdata unsigned long union_hash_entries; ++ ++static int __init set_union_hash_entries(char *str) ++{ ++ if (!str) ++ return 0; ++ union_hash_entries = simple_strtoul(str, &str, 0); ++ return 1; ++} ++ ++__setup("union_hash_entries=", set_union_hash_entries); ++ ++static int __init init_union(void) ++{ ++ int loop; ++ ++ union_cache = KMEM_CACHE(union_mount, SLAB_PANIC | SLAB_MEM_SPREAD); ++ union_hashtable = alloc_large_system_hash("Union-cache", ++ sizeof(struct hlist_head), ++ union_hash_entries, ++ 14, ++ 0, ++ &union_hash_shift, ++ &union_hash_mask, ++ 0); ++ ++ for (loop = 0; loop < (1 << union_hash_shift); loop++) ++ INIT_HLIST_HEAD(&union_hashtable[loop]); ++ ++ ++ union_rhashtable = alloc_large_system_hash("rUnion-cache", ++ sizeof(struct hlist_head), ++ union_hash_entries, ++ 14, ++ 0, ++ &union_rhash_shift, ++ &union_rhash_mask, ++ 0); ++ ++ for (loop = 0; loop < (1 << union_rhash_shift); loop++) ++ INIT_HLIST_HEAD(&union_rhashtable[loop]); ++ ++ return 0; ++} ++ ++fs_initcall(init_union); ++ ++struct union_mount *union_alloc(struct dentry *this, struct vfsmount *this_mnt, ++ struct dentry *next, struct vfsmount *next_mnt) ++{ ++ struct union_mount *um; ++ ++ BUG_ON(!S_ISDIR(this->d_inode->i_mode)); ++ BUG_ON(!S_ISDIR(next->d_inode->i_mode)); ++ ++ um = kmem_cache_alloc(union_cache, GFP_ATOMIC); ++ if (!um) ++ return NULL; ++ ++ atomic_set(&um->u_count, 1); ++ INIT_LIST_HEAD(&um->u_unions); ++ INIT_LIST_HEAD(&um->u_list); ++ INIT_HLIST_NODE(&um->u_hash); ++ INIT_HLIST_NODE(&um->u_rhash); ++ ++ um->u_this.mnt = this_mnt; ++ um->u_this.dentry = this; ++ um->u_next.mnt = mntget(next_mnt); ++ um->u_next.dentry = dget(next); ++ ++ return um; ++} ++ ++struct union_mount *union_get(struct union_mount *um) ++{ ++ BUG_ON(!atomic_read(&um->u_count)); ++ atomic_inc(&um->u_count); ++ return um; ++} ++ ++static int __union_put(struct union_mount *um) ++{ ++ if (!atomic_dec_and_test(&um->u_count)) ++ return 0; ++ ++ BUG_ON(!hlist_unhashed(&um->u_hash)); ++ BUG_ON(!hlist_unhashed(&um->u_rhash)); ++ ++ kmem_cache_free(union_cache, um); ++ return 1; ++} ++ ++void union_put(struct union_mount *um) ++{ ++ struct path tmp = um->u_next; ++ ++ if (__union_put(um)) ++ path_put(&tmp); ++} ++ ++static void __union_hash(struct union_mount *um) ++{ ++ hlist_add_head(&um->u_hash, union_hashtable + ++ hash(um->u_this.dentry, um->u_this.mnt)); ++ hlist_add_head(&um->u_rhash, union_rhashtable + ++ hash(um->u_next.dentry, um->u_next.mnt)); ++} ++ ++static void __union_unhash(struct union_mount *um) ++{ ++ hlist_del_init(&um->u_hash); ++ hlist_del_init(&um->u_rhash); ++} ++ ++struct union_mount *union_lookup(struct dentry *dentry, struct vfsmount *mnt) ++{ ++ struct hlist_head *head = union_hashtable + hash(dentry, mnt); ++ struct hlist_node *node; ++ struct union_mount *um; ++ ++ hlist_for_each_entry(um, node, head, u_hash) { ++ if ((um->u_this.dentry == dentry) && ++ (um->u_this.mnt == mnt)) ++ return um; ++ } ++ ++ return NULL; ++} ++ ++struct union_mount *union_rlookup(struct dentry *dentry, struct vfsmount *mnt) ++{ ++ struct hlist_head *head = union_rhashtable + hash(dentry, mnt); ++ struct hlist_node *node; ++ struct union_mount *um; ++ ++ hlist_for_each_entry(um, node, head, u_rhash) { ++ if ((um->u_next.dentry == dentry) && ++ (um->u_next.mnt == mnt)) ++ return um; ++ } ++ ++ return NULL; ++} ++ ++/* ++ * is_unionized - check if a dentry lives on a union mounted file system ++ * ++ * This tests if a dentry is living on an union mounted file system by walking ++ * the file system hierarchy. ++ */ ++int is_unionized(struct dentry *dentry, struct vfsmount *mnt) ++{ ++ struct path this = { .mnt = mntget(mnt), ++ .dentry = dget(dentry) }; ++ struct vfsmount *tmp; ++ ++ do { ++ /* check if there is an union mounted on top of us */ ++ spin_lock(&vfsmount_lock); ++ list_for_each_entry(tmp, &this.mnt->mnt_mounts, mnt_child) { ++ if (!(tmp->mnt_flags & MNT_UNION)) ++ continue; ++ /* Isn't this a bug? */ ++ if (this.dentry->d_sb != tmp->mnt_mountpoint->d_sb) ++ continue; ++ if (is_subdir(this.dentry, tmp->mnt_mountpoint)) { ++ spin_unlock(&vfsmount_lock); ++ path_put(&this); ++ return 1; ++ } ++ } ++ spin_unlock(&vfsmount_lock); ++ ++ /* check our mountpoint next */ ++ tmp = mntget(this.mnt->mnt_parent); ++ dput(this.dentry); ++ this.dentry = dget(this.mnt->mnt_mountpoint); ++ mntput(this.mnt); ++ this.mnt = tmp; ++ } while (this.mnt != this.mnt->mnt_parent); ++ ++ path_put(&this); ++ return 0; ++} ++ ++int append_to_union(struct vfsmount *mnt, struct dentry *dentry, ++ struct vfsmount *dest_mnt, struct dentry *dest_dentry) ++{ ++ struct union_mount *this, *um; ++ ++ BUG_ON(!IS_MNT_UNION(mnt)); ++ ++ this = union_alloc(dentry, mnt, dest_dentry, dest_mnt); ++ if (!this) ++ return -ENOMEM; ++ ++ spin_lock(&union_lock); ++ um = union_lookup(dentry, mnt); ++ if (um) { ++ BUG_ON((um->u_next.dentry != dest_dentry) || ++ (um->u_next.mnt != dest_mnt)); ++ spin_unlock(&union_lock); ++ union_put(this); ++ return 0; ++ } ++ list_add(&this->u_list, &mnt->mnt_unions); ++ list_add(&this->u_unions, &dentry->d_unions); ++ dest_dentry->d_unionized++; ++ __union_hash(this); ++ spin_unlock(&union_lock); ++ return 0; ++} ++ ++/* ++ * follow_union_down - follow the union stack one layer down ++ * ++ * This is called to traverse the union stack from one layer to the next ++ * overlayed one. follow_union_down() is called by various lookup functions ++ * that are aware of union mounts. ++ * ++ * Returns non-zero if followed to the next layer, zero otherwise. ++ */ ++int follow_union_down(struct path *path) ++{ ++ struct union_mount *um; ++ ++ if (!IS_MNT_UNION(path->mnt)) ++ return 0; ++ ++ spin_lock(&union_lock); ++ um = union_lookup(path->dentry, path->mnt); ++ spin_unlock(&union_lock); ++ if (um) { ++ path_get(&um->u_next); ++ dput(path->dentry); ++ path->dentry = um->u_next.dentry; ++ mntput(path->mnt); ++ path->mnt = um->u_next.mnt; ++ return 1; ++ } ++ return 0; ++} ++ ++/* ++ * follow_union_mount - follow the union stack to the topmost layer ++ * ++ * This is called to traverse the union stack to the topmost layer. This is ++ * necessary for following parent pointers in an union mount. ++ * ++ * Returns none zero if followed to the topmost layer, zero otherwise. ++ */ ++int follow_union_mount(struct path *path) ++{ ++ struct union_mount *um; ++ int res = 0; ++ ++ while (IS_UNION(path->dentry)) { ++ spin_lock(&dcache_lock); ++ spin_lock(&union_lock); ++ um = union_rlookup(path->dentry, path->mnt); ++ if (um) ++ path_get(&um->u_this); ++ spin_unlock(&union_lock); ++ spin_unlock(&dcache_lock); ++ ++ /* ++ * Q: Aaargh, how do I validate the topmost dentry pointer? ++ * A: Eeeeasy! We took the dcache_lock and union_lock. Since ++ * this protects from any dput'ng going on, we know that the ++ * dentry is valid since the union is unhashed under ++ * dcache_lock too. ++ */ ++ if (!um) ++ break; ++ dput(path->dentry); ++ path->dentry = um->u_this.dentry; ++ mntput(path->mnt); ++ path->mnt = um->u_this.mnt; ++ res = 1; ++ } ++ ++ return res; ++} ++ ++/* ++ * Union mount copyup support ++ */ ++ ++extern int hash_lookup_union(struct nameidata *, struct qstr *, struct path *); ++extern void follow_mount(struct path *); ++ ++/* ++ * union_relookup_topmost - lookup and create the topmost path to dentry ++ * @nd: pointer to nameidata ++ * @flags: lookup flags ++ */ ++static int union_relookup_topmost(struct nameidata *nd, int flags) ++{ ++ int err; ++ char *kbuf, *name; ++ struct nameidata this; ++ ++ kbuf = (char *)__get_free_page(GFP_KERNEL); ++ if (!kbuf) ++ return -ENOMEM; ++ ++ name = d_path(&nd->path, kbuf, PAGE_SIZE); ++ err = PTR_ERR(name); ++ if (IS_ERR(name)) ++ goto free_page; ++ ++ err = path_lookup(name, flags|LOOKUP_CREATE|LOOKUP_TOPMOST, &this); ++ if (err) ++ goto free_page; ++ ++ path_put(&nd->path); ++ nd->path.dentry = this.path.dentry; ++ nd->path.mnt = this.path.mnt; ++ ++ /* ++ * the nd->flags should be unchanged ++ */ ++ BUG_ON(this.um_flags & LAST_LOWLEVEL); ++ nd->um_flags &= ~LAST_LOWLEVEL; ++ free_page: ++ free_page((unsigned long)kbuf); ++ return err; ++} ++ ++static void __update_fs_pwd(struct path *path, struct dentry *dentry, ++ struct vfsmount *mnt) ++{ ++ struct path old = { NULL, NULL }; ++ ++ write_lock(¤t->fs->lock); ++ if (current->fs->pwd.dentry == path->dentry) { ++ old = current->fs->pwd; ++ path_get(¤t->fs->pwd); ++ } ++ write_unlock(¤t->fs->lock); ++ ++ if (old.dentry) ++ path_put(&old); ++ ++ return; ++} ++ ++/** ++ * union_permission - check for access rights to a given inode ++ * @inode: inode to check permission on ++ * @mask: right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC) ++ * ++ * In a union mount, the top layer is always read-write and the bottom ++ * is always read-only. Ignore the read-only flag on the lower fs. ++ * ++ * Only need for certain activities, like checking to see if write ++ * access is ok. ++ */ ++ ++int union_permission(struct path *path, int mask) ++{ ++ struct inode *inode = path->dentry->d_inode; ++ ++ if (!is_unionized(path->dentry, path->mnt)) ++ return inode_permission(inode, mask); ++ ++ /* Tell __inode_permission to ignore MS_RDONLY */ ++ return __inode_permission(inode, mask, 0); ++} ++ ++/* ++ * union_create_topmost - create the topmost path component ++ * @nd: pointer to nameidata of the base directory ++ * @name: pointer to file name ++ * @path: pointer to path of the overlaid file ++ * ++ * This is called by __link_path_walk() to create the directories on a path ++ * when it is called with LOOKUP_TOPMOST. ++ */ ++struct dentry *union_create_topmost(struct nameidata *nd, struct qstr *name, ++ struct path *path) ++{ ++ struct dentry *dentry, *parent = nd->path.dentry; ++ int res, mode = path->dentry->d_inode->i_mode; ++ ++ if (parent->d_sb == path->dentry->d_sb) ++ return ERR_PTR(-EEXIST); ++ ++ mutex_lock(&parent->d_inode->i_mutex); ++ dentry = lookup_one_len(name->name, nd->path.dentry, name->len); ++ if (IS_ERR(dentry)) ++ goto out_unlock; ++ ++ switch (mode & S_IFMT) { ++ case S_IFREG: ++ /* ++ * FIXME: Does this make any sense in this case? ++ * Special case - lookup gave negative, but... we had foo/bar/ ++ * From the vfs_mknod() POV we just have a negative dentry - ++ * all is fine. Let's be bastards - you had / on the end,you've ++ * been asking for (non-existent) directory. -ENOENT for you. ++ */ ++ if (name->name[name->len] && !dentry->d_inode) { ++ dput(dentry); ++ dentry = ERR_PTR(-ENOENT); ++ goto out_unlock; ++ } ++ ++ res = vfs_create(parent->d_inode, dentry, mode, nd); ++ if (res) { ++ dput(dentry); ++ dentry = ERR_PTR(res); ++ goto out_unlock; ++ } ++ break; ++ case S_IFDIR: ++ res = vfs_mkdir(parent->d_inode, dentry, mode); ++ if (res) { ++ dput(dentry); ++ dentry = ERR_PTR(res); ++ goto out_unlock; ++ } ++ ++ res = append_to_union(nd->path.mnt, dentry, path->mnt, ++ path->dentry); ++ if (res) { ++ dput(dentry); ++ dentry = ERR_PTR(res); ++ goto out_unlock; ++ } ++ break; ++ default: ++ dput(dentry); ++ dentry = ERR_PTR(-EINVAL); ++ goto out_unlock; ++ } ++ ++ /* FIXME: Really necessary ??? */ ++/* __update_fs_pwd(path, dentry, nd->path.mnt); */ ++ ++ out_unlock: ++ mutex_unlock(&parent->d_inode->i_mutex); ++ return dentry; ++} ++ ++static int union_copy_file(struct dentry *old_dentry, struct vfsmount *old_mnt, ++ struct dentry *new_dentry, struct vfsmount *new_mnt) ++{ ++ int ret; ++ size_t size; ++ loff_t offset; ++ struct file *old_file, *new_file; ++ const struct cred *cred = current_cred(); ++ ++ dget(old_dentry); ++ mntget(old_mnt); ++ old_file = dentry_open(old_dentry, old_mnt, O_RDONLY, cred); ++ if (IS_ERR(old_file)) ++ return PTR_ERR(old_file); ++ ++ dget(new_dentry); ++ mntget(new_mnt); ++ new_file = dentry_open(new_dentry, new_mnt, O_WRONLY, cred); ++ ret = PTR_ERR(new_file); ++ if (IS_ERR(new_file)) ++ goto fput_old; ++ ++ /* XXX be smart by using a length param, which indicates max ++ * data we'll want (e.g., we are about to truncate to 0 or 10 ++ * bytes or something */ ++ size = i_size_read(old_file->f_path.dentry->d_inode); ++ if (((size_t)size != size) || ((ssize_t)size != size)) { ++ ret = -EFBIG; ++ goto fput_new; ++ } ++ ++ offset = 0; ++ ret = do_splice_direct(old_file, &offset, new_file, size, ++ SPLICE_F_MOVE); ++ if (ret >= 0) ++ ret = 0; ++ fput_new: ++ fput(new_file); ++ fput_old: ++ fput(old_file); ++ return ret; ++} ++ ++/** ++ * __union_copyup - copy a file to the topmost directory ++ * @old: pointer to path of the old file name ++ * @new_nd: pointer to nameidata of the topmost directory ++ * @new: pointer to path of the new file name ++ * ++ * The topmost directory @new_nd must already be locked. Creates the topmost ++ * file if it doesn't exist yet. ++ */ ++int __union_copyup(struct path *old, struct nameidata *new_nd, ++ struct path *new) ++{ ++ struct dentry *dentry; ++ int error; ++ ++ /* Maybe this should be -EINVAL */ ++ if (S_ISDIR(old->dentry->d_inode->i_mode)) ++ return -EISDIR; ++ ++ if (new_nd->path.dentry != new->dentry->d_parent) { ++ mutex_lock(&new_nd->path.dentry->d_inode->i_mutex); ++ dentry = lookup_one_len(new->dentry->d_name.name, ++ new_nd->path.dentry, ++ new->dentry->d_name.len); ++ mutex_unlock(&new_nd->path.dentry->d_inode->i_mutex); ++ if (IS_ERR(dentry)) ++ return PTR_ERR(dentry); ++ error = -EEXIST; ++ if (dentry->d_inode) ++ goto out_dput; ++ } else ++ dentry = dget(new->dentry); ++ ++ if (!dentry->d_inode) { ++ error = vfs_create(new_nd->path.dentry->d_inode, dentry, ++ old->dentry->d_inode->i_mode, new_nd); ++ if (error) ++ goto out_dput; ++ } ++ ++ BUG_ON(!S_ISREG(old->dentry->d_inode->i_mode)); ++ error = union_copy_file(old->dentry, old->mnt, dentry, ++ new_nd->path.mnt); ++ if (error) { ++ /* FIXME: are there return value we should not ++ * BUG() on ? */ ++ BUG_ON(vfs_unlink(new_nd->path.dentry->d_inode, ++ dentry)); ++ goto out_dput; ++ } ++ ++ dput(new->dentry); ++ new->dentry = dentry; ++ if (new->mnt != new_nd->path.mnt) ++ mntput(new->mnt); ++ new->mnt = new_nd->path.mnt; ++ return error; ++ ++out_dput: ++ dput(dentry); ++ return error; ++} ++ ++/* ++ * union_copyup - copy a file to the topmost layer of the union stack ++ * @nd: nameidata pointer to the file ++ * @flags: flags given to open_namei ++ */ ++int union_copyup(struct nameidata *nd, int flags /* XXX not used */) ++{ ++ struct qstr this; ++ char *name; ++ struct dentry *dir; ++ struct path path; ++ int err; ++ ++ if (!is_unionized(nd->path.dentry, nd->path.mnt)) ++ return 0; ++ if (!S_ISREG(nd->path.dentry->d_inode->i_mode)) ++ return 0; ++ ++ /* safe the name for hash_lookup_union() */ ++ this.len = nd->path.dentry->d_name.len; ++ this.hash = nd->path.dentry->d_name.hash; ++ name = kmalloc(this.len + 1, GFP_KERNEL); ++ if (!name) ++ return -ENOMEM; ++ this.name = name; ++ memcpy(name, nd->path.dentry->d_name.name, nd->path.dentry->d_name.len); ++ name[this.len] = 0; ++ ++ err = union_relookup_topmost(nd, nd->flags|LOOKUP_PARENT); ++ if (err) { ++ kfree(name); ++ return err; ++ } ++ nd->flags &= ~LOOKUP_PARENT; ++ ++ dir = nd->path.dentry; ++ mutex_lock(&dir->d_inode->i_mutex); ++ err = hash_lookup_union(nd, &this, &path); ++ mutex_unlock(&dir->d_inode->i_mutex); ++ kfree(name); ++ if (err) ++ return err; ++ ++ err = -ENOENT; ++ if (!path.dentry->d_inode) ++ goto exit_dput; ++ ++ /* Necessary?! I guess not ... */ ++ follow_mount(&path); ++ ++ err = -ENOENT; ++ if (!path.dentry->d_inode) ++ goto exit_dput; ++ ++ err = -EISDIR; ++ if (!S_ISREG(path.dentry->d_inode->i_mode)) ++ goto exit_dput; ++ ++ if (path.dentry->d_parent != nd->path.dentry) { ++ err = __union_copyup(&path, nd, &path); ++ if (err) ++ goto exit_dput; ++ } ++ ++ dput(nd->path.dentry); ++ if (nd->path.mnt != path.mnt) ++ mntput(nd->path.mnt); ++ nd->path = path; ++ return 0; ++ ++exit_dput: ++ dput(path.dentry); ++ if (path.mnt != nd->path.mnt) ++ mntput(path.mnt); ++ return err; ++} ++ ++/* ++ * This must be called when unhashing a dentry. This is called with dcache_lock ++ * and unhashes all unions this dentry is in. ++ */ ++void __d_drop_unions(struct dentry *dentry) ++{ ++ struct union_mount *this, *next; ++ ++ spin_lock(&union_lock); ++ list_for_each_entry_safe(this, next, &dentry->d_unions, u_unions) ++ __union_unhash(this); ++ spin_unlock(&union_lock); ++} ++EXPORT_SYMBOL_GPL(__d_drop_unions); ++ ++/* ++ * This must be called after __d_drop_unions() without holding any locks. ++ * Note: The dentry might still be reachable via a lookup but at that time it ++ * already a negative dentry. Otherwise it would be unhashed. The union_mount ++ * structure itself is still reachable through mnt->mnt_unions (which we ++ * protect against with union_lock). ++ */ ++void shrink_d_unions(struct dentry *dentry) ++{ ++ struct union_mount *this, *next; ++ ++repeat: ++ spin_lock(&union_lock); ++ list_for_each_entry_safe(this, next, &dentry->d_unions, u_unions) { ++ BUG_ON(!hlist_unhashed(&this->u_hash)); ++ BUG_ON(!hlist_unhashed(&this->u_rhash)); ++ list_del(&this->u_list); ++ list_del(&this->u_unions); ++ this->u_next.dentry->d_unionized--; ++ spin_unlock(&union_lock); ++ union_put(this); ++ goto repeat; ++ } ++ spin_unlock(&union_lock); ++} ++ ++extern void __dput(struct dentry *, struct list_head *, int); ++ ++/* ++ * This is the special variant for use in dput() only. ++ */ ++void __shrink_d_unions(struct dentry *dentry, struct list_head *list) ++{ ++ struct union_mount *this, *next; ++ ++ BUG_ON(!d_unhashed(dentry)); ++ ++repeat: ++ spin_lock(&union_lock); ++ list_for_each_entry_safe(this, next, &dentry->d_unions, u_unions) { ++ struct dentry *n_dentry = this->u_next.dentry; ++ struct vfsmount *n_mnt = this->u_next.mnt; ++ ++ BUG_ON(!hlist_unhashed(&this->u_hash)); ++ BUG_ON(!hlist_unhashed(&this->u_rhash)); ++ list_del(&this->u_list); ++ list_del(&this->u_unions); ++ this->u_next.dentry->d_unionized--; ++ spin_unlock(&union_lock); ++ if (__union_put(this)) { ++ __dput(n_dentry, list, 0); ++ mntput(n_mnt); ++ } ++ goto repeat; ++ } ++ spin_unlock(&union_lock); ++} ++ ++/* ++ * Remove all union_mounts structures belonging to this vfsmount from the ++ * union lookup hashtable and so on ... ++ */ ++void shrink_mnt_unions(struct vfsmount *mnt) ++{ ++ struct union_mount *this, *next; ++ ++repeat: ++ spin_lock(&union_lock); ++ list_for_each_entry_safe(this, next, &mnt->mnt_unions, u_list) { ++ if (this->u_this.dentry == mnt->mnt_root) ++ continue; ++ __union_unhash(this); ++ list_del(&this->u_list); ++ list_del(&this->u_unions); ++ this->u_next.dentry->d_unionized--; ++ spin_unlock(&union_lock); ++ union_put(this); ++ goto repeat; ++ } ++ spin_unlock(&union_lock); ++} ++ ++int attach_mnt_union(struct vfsmount *mnt, struct vfsmount *dest_mnt, ++ struct dentry *dest_dentry) ++{ ++ if (!IS_MNT_UNION(mnt)) ++ return 0; ++ ++ return append_to_union(mnt, mnt->mnt_root, dest_mnt, dest_dentry); ++} ++ ++void detach_mnt_union(struct vfsmount *mnt) ++{ ++ struct union_mount *um; ++ ++ if (!IS_MNT_UNION(mnt)) ++ return; ++ ++ shrink_mnt_unions(mnt); ++ ++ spin_lock(&union_lock); ++ um = union_lookup(mnt->mnt_root, mnt); ++ __union_unhash(um); ++ list_del(&um->u_list); ++ list_del(&um->u_unions); ++ um->u_next.dentry->d_unionized--; ++ spin_unlock(&union_lock); ++ union_put(um); ++ return; ++} ++ ++/** ++ * union_copyup_dir_one - copy up a single directory entry ++ * ++ * Individual directory entry copyup function for union_copyup_dir. ++ * We get the entries from higher level layers first. ++ */ ++ ++static int union_copyup_dir_one(void *buf, const char *name, int namlen, ++ loff_t offset, u64 ino, unsigned int d_type) ++{ ++ struct dentry *topmost_dentry = (struct dentry *) buf; ++ struct dentry *dentry; ++ int err = 0; ++ ++ switch (namlen) { ++ case 2: ++ if (name[1] != '.') ++ break; ++ case 1: ++ if (name[0] != '.') ++ break; ++ return 0; ++ } ++ ++ /* Lookup this entry in the topmost directory */ ++ dentry = lookup_one_len(name, topmost_dentry, namlen); ++ ++ if (IS_ERR(dentry)) { ++ printk(KERN_INFO "error looking up %s\n", dentry->d_name.name); ++ goto out; ++ } ++ ++ /* ++ * If the entry already exists, one of the following is true: ++ * it was already copied up (due to an earlier lookup), an ++ * entry with the same name already exists on the topmost file ++ * system, it is a whiteout, or it is a fallthru. In each ++ * case, the top level entry masks any entries from lower file ++ * systems, so don't copy up this entry. ++ */ ++ if (dentry->d_inode || d_is_whiteout(dentry) || ++ d_is_fallthru(dentry)) { ++ printk(KERN_INFO "skipping copy of %s\n", dentry->d_name.name); ++ goto out_dput; ++ } ++ ++ /* ++ * If the entry doesn't exist, create a fallthru entry in the ++ * topmost file system. All possible directory types are ++ * used, so each file system must implement its own way of ++ * storing a fallthru entry. ++ */ ++ printk(KERN_INFO "creating fallthru for %s\n", dentry->d_name.name); ++ err = topmost_dentry->d_inode->i_op->fallthru(topmost_dentry->d_inode, ++ dentry); ++ /* FIXME */ ++ BUG_ON(err); ++ /* ++ * At this point, we have a negative dentry marked as fallthru ++ * in the cache. We could potentially lookup the entry lower ++ * level file system and turn this into a positive dentry ++ * right now, but it is not clear that would be a performance ++ * win and adds more opportunities to fail. ++ */ ++out_dput: ++ dput(dentry); ++out: ++ return 0; ++} ++ ++/** ++ * union_copyup_dir - copy up low-level directory entries to topmost dir ++ * ++ * readdir() is difficult to support on union file systems for two ++ * reasons: We must eliminate duplicates and apply whiteouts, and we ++ * must return something in f_pos that lets us restart in the same ++ * place when we return. Our solution is to, on first readdir() of ++ * the directory, copy up all visible entries from the low-level file ++ * systems and mark the entries that refer to low-level file system ++ * objects as "fallthru" entries. ++ */ ++ ++int union_copyup_dir(struct path *topmost_path) ++{ ++ struct dentry *topmost_dentry = topmost_path->dentry; ++ struct path path = *topmost_path; ++ int res = 0; ++ ++ /* ++ * Skip opaque dirs. ++ */ ++ if (IS_OPAQUE(topmost_dentry->d_inode)) ++ return 0; ++ ++ /* ++ * Mark this dir opaque to show that we have already copied up ++ * the lower entries. Only fallthru entries pass through to ++ * the underlying file system. ++ * ++ * XXX Deal with the lower file system changing. This could ++ * be through running a tool over the top level file system to ++ * make directories transparent again, or we could check the ++ * mtime of the underlying directory. ++ */ ++ ++ topmost_dentry->d_inode->i_flags |= S_OPAQUE; ++ mark_inode_dirty(topmost_dentry->d_inode); ++ ++ /* ++ * Loop through each dir on each level copying up the entries ++ * to the topmost. ++ */ ++ ++ /* Don't drop the caller's reference to the topmost path */ ++ path_get(&path); ++ while (follow_union_down(&path)) { ++ struct file * ftmp; ++ struct inode * inode; ++ ++ /* XXX Permit fallthrus on lower-level? Would need to ++ * pass in opaque flag to union_copyup_dir_one() and ++ * only copy up fallthru entries there. We allow ++ * fallthrus in lower level opaque directories on ++ * lookup, so for consistency we should do one or the ++ * other in both places. */ ++ if (IS_OPAQUE(path.dentry->d_inode)) ++ break; ++ ++ /* dentry_open() doesn't get a path reference itself */ ++ path_get(&path); ++ ftmp = dentry_open(path.dentry, path.mnt, ++ O_RDONLY | O_DIRECTORY | O_NOATIME, ++ current_cred()); ++ if (IS_ERR(ftmp)) { ++ printk (KERN_ERR "unable to open dir %s for " ++ "directory copyup: %ld\n", ++ path.dentry->d_name.name, PTR_ERR(ftmp)); ++ continue; ++ } ++ ++ inode = path.dentry->d_inode; ++ mutex_lock(&inode->i_mutex); ++ ++ res = -ENOENT; ++ if (IS_DEADDIR(inode)) ++ goto out_fput; ++ /* ++ * Read the whole directory, calling our directory ++ * entry copyup function on each entry. Pass in the ++ * topmost dentry as our private data so we can create ++ * new entries in the topmost directory. ++ */ ++ res = ftmp->f_op->readdir(ftmp, topmost_dentry, ++ union_copyup_dir_one); ++out_fput: ++ mutex_unlock(&inode->i_mutex); ++ fput(ftmp); ++ ++ if (res) ++ break; ++ } ++ path_put(&path); ++ return res; ++} +--- a/include/linux/dcache.h ++++ b/include/linux/dcache.h +@@ -101,6 +101,15 @@ struct dentry { + struct dentry *d_parent; /* parent directory */ + struct qstr d_name; + ++#ifdef CONFIG_UNION_MOUNT ++ /* ++ * The following fields are used by the VFS based union mount ++ * implementation. Both are protected by union_lock! ++ */ ++ struct list_head d_unions; /* list of union_mount's */ ++ unsigned int d_unionized; /* unions referencing this dentry */ ++#endif ++ + struct list_head d_lru; /* LRU list */ + /* + * d_child and d_rcu can share memory +@@ -186,6 +195,9 @@ d_iput: no no no yes + + #define DCACHE_FSNOTIFY_PARENT_WATCHED 0x0080 /* Parent inode is watched by some fsnotify listener */ + ++#define DCACHE_WHITEOUT 0x0100 /* This negative dentry is a whiteout */ ++#define DCACHE_FALLTHRU 0x0200 /* Keep looking in the file system below */ ++ + extern spinlock_t dcache_lock; + extern seqlock_t rename_lock; + +@@ -205,12 +217,20 @@ extern seqlock_t rename_lock; + * __d_drop requires dentry->d_lock. + */ + ++#ifdef CONFIG_UNION_MOUNT ++extern void __d_drop_unions(struct dentry *); ++#endif ++ + static inline void __d_drop(struct dentry *dentry) + { + if (!(dentry->d_flags & DCACHE_UNHASHED)) { + dentry->d_flags |= DCACHE_UNHASHED; + hlist_del_rcu(&dentry->d_hash); + } ++#ifdef CONFIG_UNION_MOUNT ++ /* remove dentry from the union hashtable */ ++ __d_drop_unions(dentry); ++#endif + } + + static inline void d_drop(struct dentry *dentry) +@@ -358,6 +378,16 @@ static inline int d_unlinked(struct dent + return d_unhashed(dentry) && !IS_ROOT(dentry); + } + ++static inline int d_is_whiteout(struct dentry *dentry) ++{ ++ return (dentry->d_flags & DCACHE_WHITEOUT); ++} ++ ++static inline int d_is_fallthru(struct dentry *dentry) ++{ ++ return (dentry->d_flags & DCACHE_FALLTHRU); ++} ++ + static inline struct dentry *dget_parent(struct dentry *dentry) + { + struct dentry *ret; +--- a/include/linux/ext2_fs.h ++++ b/include/linux/ext2_fs.h +@@ -189,6 +189,7 @@ struct ext2_group_desc + #define EXT2_NOTAIL_FL FS_NOTAIL_FL /* file tail should not be merged */ + #define EXT2_DIRSYNC_FL FS_DIRSYNC_FL /* dirsync behaviour (directories only) */ + #define EXT2_TOPDIR_FL FS_TOPDIR_FL /* Top of directory hierarchies*/ ++#define EXT2_OPAQUE_FL 0x00040000 + #define EXT2_RESERVED_FL FS_RESERVED_FL /* reserved for ext2 lib */ + + #define EXT2_FL_USER_VISIBLE FS_FL_USER_VISIBLE /* User visible flags */ +@@ -503,10 +504,12 @@ struct ext2_super_block { + #define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 + #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 + #define EXT2_FEATURE_INCOMPAT_META_BG 0x0010 ++#define EXT2_FEATURE_INCOMPAT_WHITEOUT 0x0020 + #define EXT2_FEATURE_INCOMPAT_ANY 0xffffffff + + #define EXT2_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR + #define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \ ++ EXT2_FEATURE_INCOMPAT_WHITEOUT| \ + EXT2_FEATURE_INCOMPAT_META_BG) + #define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \ + EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \ +@@ -573,6 +576,8 @@ enum { + EXT2_FT_FIFO, + EXT2_FT_SOCK, + EXT2_FT_SYMLINK, ++ EXT2_FT_WHT, ++ EXT2_FT_FALLTHRU, + EXT2_FT_MAX + }; + +--- a/include/linux/fs.h ++++ b/include/linux/fs.h +@@ -188,6 +188,7 @@ struct inodes_stat_t { + #define MS_REMOUNT 32 /* Alter flags of a mounted FS */ + #define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ + #define MS_DIRSYNC 128 /* Directory modifications are synchronous */ ++#define MS_UNION 256 + #define MS_NOATIME 1024 /* Do not update access times. */ + #define MS_NODIRATIME 2048 /* Do not update directory access times */ + #define MS_BIND 4096 +@@ -205,6 +206,7 @@ struct inodes_stat_t { + #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ + #define MS_I_VERSION (1<<23) /* Update inode I_version field */ + #define MS_STRICTATIME (1<<24) /* Always perform atime updates */ ++#define MS_WHITEOUT (1<<26) /* fs does support white-out filetype */ + #define MS_ACTIVE (1<<30) + #define MS_NOUSER (1<<31) + +@@ -231,6 +233,7 @@ struct inodes_stat_t { + #define S_NOCMTIME 128 /* Do not update file c/mtime */ + #define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */ + #define S_PRIVATE 512 /* Inode is fs-internal */ ++#define S_OPAQUE 1024 /* Directory is opaque */ + + /* + * Note that nosuid etc flags are inode-specific: setting some file-system +@@ -266,6 +269,8 @@ struct inodes_stat_t { + #define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE) + #define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE) + ++#define IS_OPAQUE(inode) ((inode)->i_flags & S_OPAQUE) ++ + /* the read-only stuff doesn't really belong here, but any other place is + probably as bad and I don't want to create yet another include file. */ + +@@ -1380,6 +1385,11 @@ struct super_block { + * generic_show_options() + */ + char *s_options; ++ ++ /* ++ * Users who require read-only access - e.g., union mounts ++ */ ++ int s_readonly_users; + }; + + extern struct timespec current_fs_time(struct super_block *sb); +@@ -1517,6 +1527,8 @@ struct inode_operations { + int (*mkdir) (struct inode *,struct dentry *,int); + int (*rmdir) (struct inode *,struct dentry *); + int (*mknod) (struct inode *,struct dentry *,int,dev_t); ++ int (*whiteout) (struct inode *, struct dentry *, struct dentry *); ++ int (*fallthru) (struct inode *, struct dentry *); + int (*rename) (struct inode *, struct dentry *, + struct inode *, struct dentry *); + int (*readlink) (struct dentry *, char __user *,int); +@@ -2108,6 +2120,7 @@ extern void emergency_remount(void); + extern sector_t bmap(struct inode *, sector_t); + #endif + extern int notify_change(struct dentry *, struct iattr *); ++extern int __inode_permission(struct inode *inode, int mask, int rofs); + extern int inode_permission(struct inode *, int); + extern int generic_permission(struct inode *, int, + int (*check_acl)(struct inode *, int)); +@@ -2135,7 +2148,7 @@ extern void free_write_pipe(struct file + + extern struct file *do_filp_open(int dfd, const char *pathname, + int open_flag, int mode, int acc_mode); +-extern int may_open(struct path *, int, int); ++extern int may_open(struct nameidata *, int, int); + + extern int kernel_read(struct file *, loff_t, char *, unsigned long); + extern struct file * open_exec(const char *); +--- a/include/linux/mount.h ++++ b/include/linux/mount.h +@@ -35,6 +35,7 @@ struct mnt_namespace; + #define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */ + #define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */ + #define MNT_PNODE_MASK 0x3000 /* propagation flag mask */ ++#define MNT_UNION 0x4000 /* if the vfsmount is a union mount */ + + struct vfsmount { + struct list_head mnt_hash; +@@ -53,6 +54,9 @@ struct vfsmount { + struct list_head mnt_slave_list;/* list of slave mounts */ + struct list_head mnt_slave; /* slave list entry */ + struct vfsmount *mnt_master; /* slave is on master->mnt_slave_list */ ++#ifdef CONFIG_UNION_MOUNT ++ struct list_head mnt_unions; /* list of union_mount structures */ ++#endif + struct mnt_namespace *mnt_ns; /* containing namespace */ + int mnt_id; /* mount identifier */ + int mnt_group_id; /* peer group identifier */ +--- a/include/linux/namei.h ++++ b/include/linux/namei.h +@@ -20,6 +20,7 @@ struct nameidata { + struct qstr last; + struct path root; + unsigned int flags; ++ unsigned int um_flags; + int last_type; + unsigned depth; + char *saved_names[MAX_NESTED_LINKS + 1]; +@@ -35,6 +36,9 @@ struct nameidata { + */ + enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND}; + ++#define LAST_UNION 0x01 ++#define LAST_LOWLEVEL 0x02 ++ + /* + * The bitmask for a lookup event: + * - follow links at the end +@@ -49,6 +53,8 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LA + #define LOOKUP_CONTINUE 4 + #define LOOKUP_PARENT 16 + #define LOOKUP_REVAL 64 ++#define LOOKUP_TOPMOST 128 ++ + /* + * Intent data + */ +--- /dev/null ++++ b/include/linux/union.h +@@ -0,0 +1,84 @@ ++/* ++ * VFS based union mount for Linux ++ * ++ * Copyright (C) 2004-2007 IBM Corporation, IBM Deutschland Entwicklung GmbH. ++ * Copyright (C) 2007 Novell Inc. ++ * Author(s): Jan Blunck (j.blunck@tu-harburg.de) ++ * ++ * 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 of the License, or (at your option) ++ * any later version. ++ * ++ */ ++#ifndef __LINUX_UNION_H ++#define __LINUX_UNION_H ++#ifdef __KERNEL__ ++ ++#include ++#include ++ ++struct dentry; ++struct vfsmount; ++ ++#ifdef CONFIG_UNION_MOUNT ++ ++/* ++ * The new union mount structure. ++ */ ++struct union_mount { ++ atomic_t u_count; /* reference count */ ++ struct mutex u_mutex; ++ struct list_head u_unions; /* list head for d_unions */ ++ struct list_head u_list; /* list head for mnt_unions */ ++ struct hlist_node u_hash; /* list head for seaching */ ++ struct hlist_node u_rhash; /* list head for reverse seaching */ ++ ++ struct path u_this; /* this is me */ ++ struct path u_next; /* this is what I overlay */ ++}; ++ ++#define IS_UNION(dentry) (!list_empty(&(dentry)->d_unions) || \ ++ (dentry)->d_unionized) ++#define IS_MNT_UNION(mnt) ((mnt)->mnt_flags & MNT_UNION) ++ ++extern int is_unionized(struct dentry *, struct vfsmount *); ++extern int append_to_union(struct vfsmount *, struct dentry *, ++ struct vfsmount *, struct dentry *); ++extern int follow_union_down(struct path *); ++extern int follow_union_mount(struct path *); ++extern void __d_drop_unions(struct dentry *); ++extern void shrink_d_unions(struct dentry *); ++extern void __shrink_d_unions(struct dentry *, struct list_head *); ++extern int attach_mnt_union(struct vfsmount *, struct vfsmount *, ++ struct dentry *); ++extern void detach_mnt_union(struct vfsmount *); ++extern struct dentry *union_create_topmost(struct nameidata *, struct qstr *, ++ struct path *); ++extern int __union_copyup(struct path *, struct nameidata *, struct path *); ++extern int union_copyup(struct nameidata *, int); ++extern int union_copyup_dir(struct path *path); ++extern int union_permission(struct path *, int); ++ ++#else /* CONFIG_UNION_MOUNT */ ++ ++#define IS_UNION(x) (0) ++#define IS_MNT_UNION(x) (0) ++#define is_unionized(x, y) (0) ++#define append_to_union(x1, y1, x2, y2) ({ BUG(); (0); }) ++#define follow_union_down(x) ({ (0); }) ++#define follow_union_mount(x) ({ (0); }) ++#define __d_drop_unions(x) do { } while (0) ++#define shrink_d_unions(x) do { } while (0) ++#define __shrink_d_unions(x,y) do { } while (0) ++#define attach_mnt_union(x, y, z) do { } while (0) ++#define detach_mnt_union(x) do { } while (0) ++#define union_create_topmost(x, y, z) ({ BUG(); (NULL); }) ++#define __union_copyup(x, y, z) ({ BUG(); (0); }) ++#define union_copyup(x, y) ({ (0); }) ++#define union_copyup_dir(x) ({ BUG(); (0); }) ++#define union_permission(x, y) inode_permission(x->dentry->d_inode, y) ++ ++#endif /* CONFIG_UNION_MOUNT */ ++#endif /* __KERNEL__ */ ++#endif /* __LINUX_UNION_H */ +--- a/mm/shmem.c ++++ b/mm/shmem.c +@@ -1798,6 +1798,118 @@ static int shmem_statfs(struct dentry *d + return 0; + } + ++static int shmem_rmdir(struct inode *dir, struct dentry *dentry); ++static int shmem_unlink(struct inode *dir, struct dentry *dentry); ++ ++/* ++ * Create a dentry to signify a whiteout. ++ */ ++static int shmem_whiteout(struct inode *dir, struct dentry *old_dentry, ++ struct dentry *new_dentry) ++{ ++ struct shmem_sb_info *sbinfo = SHMEM_SB(dir->i_sb); ++ struct dentry *dentry; ++ ++ if (!(dir->i_sb->s_flags & MS_WHITEOUT)) ++ return -EPERM; ++ ++ /* This gives us a proper initialized negative dentry */ ++ dentry = simple_lookup(dir, new_dentry, NULL); ++ if (dentry && IS_ERR(dentry)) ++ return PTR_ERR(dentry); ++ ++ /* ++ * No ordinary (disk based) filesystem counts whiteouts as inodes; ++ * but each new link needs a new dentry, pinning lowmem, and ++ * tmpfs dentries cannot be pruned until they are unlinked. ++ */ ++ if (sbinfo->max_inodes) { ++ spin_lock(&sbinfo->stat_lock); ++ if (!sbinfo->free_inodes) { ++ spin_unlock(&sbinfo->stat_lock); ++ return -ENOSPC; ++ } ++ sbinfo->free_inodes--; ++ spin_unlock(&sbinfo->stat_lock); ++ } ++ ++ if (old_dentry->d_inode || d_is_fallthru(old_dentry)) { ++ if (old_dentry->d_inode && S_ISDIR(old_dentry->d_inode->i_mode)) ++ shmem_rmdir(dir, old_dentry); ++ else ++ shmem_unlink(dir, old_dentry); ++ } ++ ++ dir->i_size += BOGO_DIRENT_SIZE; ++ dir->i_ctime = dir->i_mtime = CURRENT_TIME; ++ /* Extra pinning count for the created dentry */ ++ dget(new_dentry); ++ spin_lock(&new_dentry->d_lock); ++ new_dentry->d_flags |= DCACHE_WHITEOUT; ++ spin_unlock(&new_dentry->d_lock); ++ return 0; ++} ++ ++static void shmem_d_instantiate(struct inode *dir, struct dentry *dentry, ++ struct inode *inode); ++ ++/* ++ * Create a dentry to signify a fallthru. A fallthru lets us read the ++ * low-level dentries into the dcache once on the first readdir() and ++ * then ++ */ ++static int shmem_fallthru(struct inode *dir, struct dentry *dentry) ++{ ++ struct shmem_sb_info *sbinfo = SHMEM_SB(dir->i_sb); ++ ++ /* FIXME: this is stupid */ ++ if (!(dir->i_sb->s_flags & MS_WHITEOUT)) ++ return -EPERM; ++ ++ if (dentry->d_inode || d_is_fallthru(dentry) || d_is_whiteout(dentry)) ++ return -EEXIST; ++ ++ /* ++ * Each new link needs a new dentry, pinning lowmem, and tmpfs ++ * dentries cannot be pruned until they are unlinked. ++ */ ++ if (sbinfo->max_inodes) { ++ spin_lock(&sbinfo->stat_lock); ++ if (!sbinfo->free_inodes) { ++ spin_unlock(&sbinfo->stat_lock); ++ return -ENOSPC; ++ } ++ sbinfo->free_inodes--; ++ spin_unlock(&sbinfo->stat_lock); ++ } ++ ++ shmem_d_instantiate(dir, dentry, NULL); ++ dir->i_ctime = dir->i_mtime = CURRENT_TIME; ++ ++ spin_lock(&dentry->d_lock); ++ dentry->d_flags |= DCACHE_FALLTHRU; ++ spin_unlock(&dentry->d_lock); ++ return 0; ++} ++ ++static void shmem_d_instantiate(struct inode *dir, struct dentry *dentry, ++ struct inode *inode) ++{ ++ if (d_is_whiteout(dentry)) { ++ /* Re-using an existing whiteout */ ++ shmem_free_inode(dir->i_sb); ++ if (S_ISDIR(inode->i_mode)) ++ inode->i_mode |= S_OPAQUE; ++ } else if (d_is_fallthru(dentry)) { ++ shmem_free_inode(dir->i_sb); ++ } else { ++ /* New dentry */ ++ dir->i_size += BOGO_DIRENT_SIZE; ++ dget(dentry); /* Extra count - pin the dentry in core */ ++ } ++ /* Will clear DCACHE_WHITEOUT and DCACHE_FALLTHRU flags */ ++ d_instantiate(dentry, inode); ++} + /* + * File creation. Allocate an inode, and we're done.. + */ +@@ -1822,15 +1934,16 @@ shmem_mknod(struct inode *dir, struct de + iput(inode); + return error; + } ++ + if (dir->i_mode & S_ISGID) { + inode->i_gid = dir->i_gid; + if (S_ISDIR(mode)) + inode->i_mode |= S_ISGID; + } +- dir->i_size += BOGO_DIRENT_SIZE; ++ ++ shmem_d_instantiate(dir, dentry, inode); ++ + dir->i_ctime = dir->i_mtime = CURRENT_TIME; +- d_instantiate(dentry, inode); +- dget(dentry); /* Extra count - pin the dentry in core */ + } + return error; + } +@@ -1868,12 +1981,11 @@ static int shmem_link(struct dentry *old + if (ret) + goto out; + +- dir->i_size += BOGO_DIRENT_SIZE; ++ shmem_d_instantiate(dir, dentry, inode); ++ + inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; + inc_nlink(inode); + atomic_inc(&inode->i_count); /* New dentry reference */ +- dget(dentry); /* Extra pinning count for the created dentry */ +- d_instantiate(dentry, inode); + out: + return ret; + } +@@ -1882,21 +1994,63 @@ static int shmem_unlink(struct inode *di + { + struct inode *inode = dentry->d_inode; + +- if (inode->i_nlink > 1 && !S_ISDIR(inode->i_mode)) +- shmem_free_inode(inode->i_sb); ++ if (d_is_whiteout(dentry) || d_is_fallthru(dentry) || ++ (inode->i_nlink > 1 && !S_ISDIR(inode->i_mode))) ++ shmem_free_inode(dir->i_sb); + ++ if (inode) { ++ inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; ++ drop_nlink(inode); ++ } + dir->i_size -= BOGO_DIRENT_SIZE; +- inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; +- drop_nlink(inode); + dput(dentry); /* Undo the count from "create" - this does all the work */ + return 0; + } + ++static void shmem_dir_unlink_whiteouts(struct inode *dir, struct dentry *dentry) ++{ ++ if (!dentry->d_inode) ++ return; ++ ++ /* Remove whiteouts from logical empty directory */ ++ if (S_ISDIR(dentry->d_inode->i_mode) && ++ dentry->d_inode->i_sb->s_flags & MS_WHITEOUT) { ++ struct dentry *child, *next; ++ LIST_HEAD(list); ++ ++ spin_lock(&dcache_lock); ++ list_for_each_entry(child, &dentry->d_subdirs, d_u.d_child) { ++ spin_lock(&child->d_lock); ++ /* Unlink fallthrus too */ ++ if (d_is_whiteout(child) || d_is_fallthru(child)) { ++ __d_drop(child); ++ if (!list_empty(&child->d_lru)) { ++ list_del(&child->d_lru); ++ dentry_stat.nr_unused--; ++ } ++ list_add(&child->d_lru, &list); ++ } ++ spin_unlock(&child->d_lock); ++ } ++ spin_unlock(&dcache_lock); ++ ++ list_for_each_entry_safe(child, next, &list, d_lru) { ++ spin_lock(&child->d_lock); ++ list_del_init(&child->d_lru); ++ spin_unlock(&child->d_lock); ++ ++ shmem_unlink(dentry->d_inode, child); ++ } ++ } ++} ++ + static int shmem_rmdir(struct inode *dir, struct dentry *dentry) + { + if (!simple_empty(dentry)) + return -ENOTEMPTY; + ++ /* Remove whiteouts from logical empty directory */ ++ shmem_dir_unlink_whiteouts(dir, dentry); + drop_nlink(dentry->d_inode); + drop_nlink(dir); + return shmem_unlink(dir, dentry); +@@ -1905,7 +2059,7 @@ static int shmem_rmdir(struct inode *dir + /* + * The VFS layer already does all the dentry stuff for rename, + * we just have to decrement the usage count for the target if +- * it exists so that the VFS layer correctly free's it when it ++ * it exists so that the VFS layer correctly frees it when it + * gets overwritten. + */ + static int shmem_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry) +@@ -1916,7 +2070,12 @@ static int shmem_rename(struct inode *ol + if (!simple_empty(new_dentry)) + return -ENOTEMPTY; + ++ if (d_is_whiteout(new_dentry)) ++ shmem_unlink(new_dir, new_dentry); ++ + if (new_dentry->d_inode) { ++ /* Remove whiteouts from logical empty directory */ ++ shmem_dir_unlink_whiteouts(new_dir, new_dentry); + (void) shmem_unlink(new_dir, new_dentry); + if (they_are_dirs) + drop_nlink(old_dir); +@@ -1981,12 +2140,12 @@ static int shmem_symlink(struct inode *d + unlock_page(page); + page_cache_release(page); + } ++ ++ shmem_d_instantiate(dir, dentry, inode); ++ + if (dir->i_mode & S_ISGID) + inode->i_gid = dir->i_gid; +- dir->i_size += BOGO_DIRENT_SIZE; + dir->i_ctime = dir->i_mtime = CURRENT_TIME; +- d_instantiate(dentry, inode); +- dget(dentry); + return 0; + } + +@@ -2363,6 +2522,12 @@ int shmem_fill_super(struct super_block + if (!root) + goto failed_iput; + sb->s_root = root; ++ ++#ifdef CONFIG_TMPFS ++ if (!(sb->s_flags & MS_NOUSER)) ++ sb->s_flags |= MS_WHITEOUT; ++#endif ++ + return 0; + + failed_iput: +@@ -2463,6 +2628,8 @@ static const struct inode_operations shm + .rmdir = shmem_rmdir, + .mknod = shmem_mknod, + .rename = shmem_rename, ++ .whiteout = shmem_whiteout, ++ .fallthru = shmem_fallthru, + #endif + #ifdef CONFIG_TMPFS_POSIX_ACL + .setattr = shmem_notify_change, diff --git a/target/linux/generic-2.6/patches-2.6.32/231-union_mounts_bind_fix.patch b/target/linux/generic-2.6/patches-2.6.32/231-union_mounts_bind_fix.patch new file mode 100644 index 000000000..4bd3f7351 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/231-union_mounts_bind_fix.patch @@ -0,0 +1,11 @@ +--- a/fs/namespace.c ++++ b/fs/namespace.c +@@ -1550,7 +1550,7 @@ static int do_loopback(struct path *path + if (!mnt) + goto out; + +- err = check_union_mnt(&old_path, mnt, mnt_flags); ++ err = check_union_mnt(path, mnt, mnt_flags); + if (err) + goto out; + diff --git a/target/linux/generic-2.6/patches-2.6.32/232-union_mounts_compile_fix.patch b/target/linux/generic-2.6/patches-2.6.32/232-union_mounts_compile_fix.patch new file mode 100644 index 000000000..b20b845aa --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/232-union_mounts_compile_fix.patch @@ -0,0 +1,11 @@ +--- a/include/linux/union.h ++++ b/include/linux/union.h +@@ -77,7 +77,7 @@ extern int union_permission(struct path + #define __union_copyup(x, y, z) ({ BUG(); (0); }) + #define union_copyup(x, y) ({ (0); }) + #define union_copyup_dir(x) ({ BUG(); (0); }) +-#define union_permission(x, y) inode_permission(x->dentry->d_inode, y) ++#define union_permission(x, y) inode_permission((x)->dentry->d_inode, y) + + #endif /* CONFIG_UNION_MOUNT */ + #endif /* __KERNEL__ */ diff --git a/target/linux/generic-2.6/patches-2.6.32/233-jffs2_whiteout_support.patch b/target/linux/generic-2.6/patches-2.6.32/233-jffs2_whiteout_support.patch new file mode 100644 index 000000000..6583ac3d9 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/233-jffs2_whiteout_support.patch @@ -0,0 +1,186 @@ +--- a/fs/jffs2/dir.c ++++ b/fs/jffs2/dir.c +@@ -34,6 +34,9 @@ static int jffs2_mknod (struct inode *,s + static int jffs2_rename (struct inode *, struct dentry *, + struct inode *, struct dentry *); + ++static int jffs2_whiteout (struct inode *, struct dentry *, struct dentry *); ++static int jffs2_fallthru (struct inode *, struct dentry *); ++ + const struct file_operations jffs2_dir_operations = + { + .read = generic_read_dir, +@@ -55,6 +58,8 @@ const struct inode_operations jffs2_dir_ + .rmdir = jffs2_rmdir, + .mknod = jffs2_mknod, + .rename = jffs2_rename, ++ .fallthru = jffs2_fallthru, ++ .whiteout = jffs2_whiteout, + .check_acl = jffs2_check_acl, + .setattr = jffs2_setattr, + .setxattr = jffs2_setxattr, +@@ -98,8 +103,21 @@ static struct dentry *jffs2_lookup(struc + fd = fd_list; + } + } +- if (fd) +- ino = fd->ino; ++ if (fd) { ++ spin_lock(&target->d_lock); ++ switch(fd->type) { ++ case DT_WHT: ++ target->d_flags |= DCACHE_WHITEOUT; ++ break; ++ case DT_UNKNOWN: ++ target->d_flags |= DCACHE_FALLTHRU; ++ break; ++ default: ++ ino = fd->ino; ++ break; ++ } ++ spin_unlock(&target->d_lock); ++ } + mutex_unlock(&dir_f->sem); + if (ino) { + inode = jffs2_iget(dir_i->i_sb, ino); +@@ -155,7 +173,9 @@ static int jffs2_readdir(struct file *fi + fd->name, fd->ino, fd->type, curofs, offset)); + continue; + } +- if (!fd->ino) { ++ if (fd->type == DT_UNKNOWN) ++ fd->ino = 100; /* XXX: arbitrary */ ++ else if (!fd->ino && (fd->type != DT_WHT)) { + D2(printk(KERN_DEBUG "Skipping deletion dirent \"%s\"\n", fd->name)); + offset++; + continue; +@@ -498,6 +518,11 @@ static int jffs2_mkdir (struct inode *di + return PTR_ERR(inode); + } + ++ if (dentry->d_flags & DCACHE_WHITEOUT) { ++ inode->i_flags |= S_OPAQUE; ++ ri->flags = cpu_to_je16(JFFS2_INO_FLAG_OPAQUE); ++ } ++ + inode->i_op = &jffs2_dir_inode_operations; + inode->i_fop = &jffs2_dir_operations; + +@@ -779,6 +804,82 @@ static int jffs2_mknod (struct inode *di + return 0; + } + ++static int jffs2_fallthru (struct inode *dir, struct dentry *dentry) ++{ ++ struct jffs2_sb_info *c = JFFS2_SB_INFO(dir->i_sb); ++ uint32_t now; ++ int ret; ++ ++ now = get_seconds(); ++ ret = jffs2_do_link(c, JFFS2_INODE_INFO(dir), 0, DT_UNKNOWN, ++ dentry->d_name.name, dentry->d_name.len, now); ++ if (ret) ++ return ret; ++ ++ d_instantiate(dentry, NULL); ++ spin_lock(&dentry->d_lock); ++ dentry->d_flags |= DCACHE_FALLTHRU; ++ spin_unlock(&dentry->d_lock); ++ ++ return 0; ++} ++ ++static int jffs2_whiteout (struct inode *dir, struct dentry *old_dentry, ++ struct dentry *new_dentry) ++{ ++ struct jffs2_sb_info *c = JFFS2_SB_INFO(dir->i_sb); ++ struct jffs2_inode_info *victim_f = NULL; ++ uint32_t now; ++ int ret; ++ ++ /* If it's a directory, then check whether it is really empty ++ */ ++ if (new_dentry->d_inode) { ++ victim_f = JFFS2_INODE_INFO(old_dentry->d_inode); ++ if (S_ISDIR(old_dentry->d_inode->i_mode)) { ++ struct jffs2_full_dirent *fd; ++ ++ mutex_lock(&victim_f->sem); ++ for (fd = victim_f->dents; fd; fd = fd->next) { ++ if (fd->ino) { ++ mutex_unlock(&victim_f->sem); ++ return -ENOTEMPTY; ++ } ++ } ++ mutex_unlock(&victim_f->sem); ++ } ++ } ++ ++ now = get_seconds(); ++ ret = jffs2_do_link(c, JFFS2_INODE_INFO(dir), 0, DT_WHT, ++ new_dentry->d_name.name, new_dentry->d_name.len, now); ++ if (ret) ++ return ret; ++ ++ spin_lock(&new_dentry->d_lock); ++ new_dentry->d_flags &= ~DCACHE_FALLTHRU; ++ new_dentry->d_flags |= DCACHE_WHITEOUT; ++ spin_unlock(&new_dentry->d_lock); ++ d_add(new_dentry, NULL); ++ ++ if (victim_f) { ++ /* There was a victim. Kill it off nicely */ ++ drop_nlink(old_dentry->d_inode); ++ /* Don't oops if the victim was a dirent pointing to an ++ inode which didn't exist. */ ++ if (victim_f->inocache) { ++ mutex_lock(&victim_f->sem); ++ if (S_ISDIR(old_dentry->d_inode->i_mode)) ++ victim_f->inocache->pino_nlink = 0; ++ else ++ victim_f->inocache->pino_nlink--; ++ mutex_unlock(&victim_f->sem); ++ } ++ } ++ ++ return 0; ++} ++ + static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, + struct inode *new_dir_i, struct dentry *new_dentry) + { +--- a/fs/jffs2/fs.c ++++ b/fs/jffs2/fs.c +@@ -301,6 +301,10 @@ struct inode *jffs2_iget(struct super_bl + + inode->i_op = &jffs2_dir_inode_operations; + inode->i_fop = &jffs2_dir_operations; ++ ++ if (je16_to_cpu(latest_node.flags) & JFFS2_INO_FLAG_OPAQUE) ++ inode->i_flags |= S_OPAQUE; ++ + break; + } + case S_IFREG: +--- a/fs/jffs2/super.c ++++ b/fs/jffs2/super.c +@@ -172,7 +172,7 @@ static int jffs2_fill_super(struct super + + sb->s_op = &jffs2_super_operations; + sb->s_export_op = &jffs2_export_ops; +- sb->s_flags = sb->s_flags | MS_NOATIME; ++ sb->s_flags = sb->s_flags | MS_NOATIME | MS_WHITEOUT; + sb->s_xattr = jffs2_xattr_handlers; + #ifdef CONFIG_JFFS2_FS_POSIX_ACL + sb->s_flags |= MS_POSIXACL; +--- a/include/linux/jffs2.h ++++ b/include/linux/jffs2.h +@@ -87,6 +87,8 @@ + #define JFFS2_INO_FLAG_USERCOMPR 2 /* User has requested a specific + compression type */ + ++#define JFFS2_INO_FLAG_OPAQUE 4 /* Directory is opaque (for union mounts) */ ++ + + /* These can go once we've made sure we've caught all uses without + byteswapping */ diff --git a/target/linux/generic-2.6/patches-2.6.32/234-union_mounts_no_debug.patch b/target/linux/generic-2.6/patches-2.6.32/234-union_mounts_no_debug.patch new file mode 100644 index 000000000..deabd4304 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/234-union_mounts_no_debug.patch @@ -0,0 +1,30 @@ +--- a/fs/union.c ++++ b/fs/union.c +@@ -842,10 +842,8 @@ static int union_copyup_dir_one(void *bu + /* Lookup this entry in the topmost directory */ + dentry = lookup_one_len(name, topmost_dentry, namlen); + +- if (IS_ERR(dentry)) { +- printk(KERN_INFO "error looking up %s\n", dentry->d_name.name); ++ if (IS_ERR(dentry)) + goto out; +- } + + /* + * If the entry already exists, one of the following is true: +@@ -857,7 +855,6 @@ static int union_copyup_dir_one(void *bu + */ + if (dentry->d_inode || d_is_whiteout(dentry) || + d_is_fallthru(dentry)) { +- printk(KERN_INFO "skipping copy of %s\n", dentry->d_name.name); + goto out_dput; + } + +@@ -867,7 +864,6 @@ static int union_copyup_dir_one(void *bu + * used, so each file system must implement its own way of + * storing a fallthru entry. + */ +- printk(KERN_INFO "creating fallthru for %s\n", dentry->d_name.name); + err = topmost_dentry->d_inode->i_op->fallthru(topmost_dentry->d_inode, + dentry); + /* FIXME */ diff --git a/target/linux/generic-2.6/patches-2.6.32/235-union_mount_fixes.patch b/target/linux/generic-2.6/patches-2.6.32/235-union_mount_fixes.patch new file mode 100644 index 000000000..ff1fba01b --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/235-union_mount_fixes.patch @@ -0,0 +1,117 @@ +--- a/fs/namespace.c ++++ b/fs/namespace.c +@@ -1656,8 +1656,10 @@ static int do_move_mount(struct path *pa + + /* moving to or from a union mount is not supported */ + err = -EINVAL; ++#if 0 + if (IS_MNT_UNION(path->mnt)) + goto exit; ++#endif + if (IS_MNT_UNION(old_path.mnt)) + goto exit; + +--- a/fs/union.c ++++ b/fs/union.c +@@ -260,8 +260,6 @@ int append_to_union(struct vfsmount *mnt + spin_lock(&union_lock); + um = union_lookup(dentry, mnt); + if (um) { +- BUG_ON((um->u_next.dentry != dest_dentry) || +- (um->u_next.mnt != dest_mnt)); + spin_unlock(&union_lock); + union_put(this); + return 0; +@@ -274,6 +272,23 @@ int append_to_union(struct vfsmount *mnt + return 0; + } + ++int follow_union_mountpoint(struct path *path) ++{ ++ struct path new_path = *path; ++ ++ path_get(&new_path); ++ while (follow_union_down(&new_path)) { ++ if (new_path.dentry != new_path.mnt->mnt_root) ++ continue; ++ ++ path_put(path); ++ *path = new_path; ++ return 1; ++ } ++ path_put(&new_path); ++ return 0; ++} ++ + /* + * follow_union_down - follow the union stack one layer down + * +--- a/include/linux/union.h ++++ b/include/linux/union.h +@@ -47,6 +47,7 @@ extern int append_to_union(struct vfsmou + struct vfsmount *, struct dentry *); + extern int follow_union_down(struct path *); + extern int follow_union_mount(struct path *); ++extern int follow_union_mountpoint(struct path *path); + extern void __d_drop_unions(struct dentry *); + extern void shrink_d_unions(struct dentry *); + extern void __shrink_d_unions(struct dentry *, struct list_head *); +@@ -68,6 +69,7 @@ extern int union_permission(struct path + #define append_to_union(x1, y1, x2, y2) ({ BUG(); (0); }) + #define follow_union_down(x) ({ (0); }) + #define follow_union_mount(x) ({ (0); }) ++#define follow_union_mountpoint(x) ({ (0); }) + #define __d_drop_unions(x) do { } while (0) + #define shrink_d_unions(x) do { } while (0) + #define __shrink_d_unions(x,y) do { } while (0) +--- a/fs/namei.c ++++ b/fs/namei.c +@@ -626,6 +626,9 @@ static int cache_lookup_union(struct nam + !S_ISDIR(path->dentry->d_inode->i_mode)) + goto out; + ++ if (follow_union_mountpoint(path)) ++ goto out; ++ + /* Build the union stack for this part */ + res = __cache_lookup_build_union(nd, name, path); + if (res) { +@@ -892,6 +895,9 @@ static int real_lookup_union(struct name + !S_ISDIR(path->dentry->d_inode->i_mode)) + goto out; + ++ if (follow_union_mountpoint(path)) ++ goto out; ++ + /* Build the union stack for this part */ + res = __real_lookup_build_union(nd, name, path); + if (res) { +@@ -1813,6 +1819,9 @@ int hash_lookup_union(struct nameidata * + !S_ISDIR(path->dentry->d_inode->i_mode)) + goto out; + ++ if (follow_union_mountpoint(path)) ++ goto out; ++ + /* Build the union stack for this part */ + res = __hash_lookup_build_union(nd, name, path); + if (res) { +--- a/fs/readdir.c ++++ b/fs/readdir.c +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include + + #include + +@@ -45,7 +46,7 @@ int vfs_readdir(struct file *file, filld + * below this one in the union stack. + */ + if (is_unionized(file->f_path.dentry, file->f_path.mnt) && +- !IS_OPAQUE(inode)) { ++ !IS_OPAQUE(inode) && IS_MNT_UNION(file->f_path.mnt)) { + res = union_copyup_dir(&file->f_path); + if (res) + goto out_unlock; diff --git a/target/linux/generic-2.6/patches-2.6.32/240-packet_socket_type.patch b/target/linux/generic-2.6/patches-2.6.32/240-packet_socket_type.patch new file mode 100644 index 000000000..42fcb9315 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/240-packet_socket_type.patch @@ -0,0 +1,132 @@ +This patch allows the user to specify desired packet types (outgoing, +broadcast, unicast, etc.) on packet sockets via setsockopt. +This can reduce the load in situations where only a limited number +of packet types are necessary + +Signed-off-by: Felix Fietkau + +--- a/include/linux/if_packet.h ++++ b/include/linux/if_packet.h +@@ -31,6 +31,8 @@ struct sockaddr_ll + /* These ones are invisible by user level */ + #define PACKET_LOOPBACK 5 /* MC/BRD frame looped back */ + #define PACKET_FASTROUTE 6 /* Fastrouted frame */ ++#define PACKET_MASK_ANY 0xffffffff /* mask for packet type bits */ ++ + + /* Packet socket options */ + +@@ -48,6 +50,7 @@ struct sockaddr_ll + #define PACKET_RESERVE 12 + #define PACKET_TX_RING 13 + #define PACKET_LOSS 14 ++#define PACKET_RECV_TYPE 15 + + struct tpacket_stats + { +--- a/net/packet/af_packet.c ++++ b/net/packet/af_packet.c +@@ -204,6 +204,7 @@ struct packet_sock { + unsigned int tp_reserve; + unsigned int tp_loss:1; + #endif ++ unsigned int pkt_type; + }; + + struct packet_skb_cb { +@@ -342,6 +343,7 @@ static int packet_rcv_spkt(struct sk_buf + { + struct sock *sk; + struct sockaddr_pkt *spkt; ++ struct packet_sock *po; + + /* + * When we registered the protocol we saved the socket in the data +@@ -349,6 +351,7 @@ static int packet_rcv_spkt(struct sk_buf + */ + + sk = pt->af_packet_priv; ++ po = pkt_sk(sk); + + /* + * Yank back the headers [hope the device set this +@@ -361,7 +364,7 @@ static int packet_rcv_spkt(struct sk_buf + * so that this procedure is noop. + */ + +- if (skb->pkt_type == PACKET_LOOPBACK) ++ if (!(po->pkt_type & (1 << skb->pkt_type))) + goto out; + + if (dev_net(dev) != sock_net(sk)) +@@ -545,12 +548,12 @@ static int packet_rcv(struct sk_buff *sk + int skb_len = skb->len; + unsigned int snaplen, res; + +- if (skb->pkt_type == PACKET_LOOPBACK) +- goto drop; +- + sk = pt->af_packet_priv; + po = pkt_sk(sk); + ++ if (!(po->pkt_type & (1 << skb->pkt_type))) ++ goto drop; ++ + if (dev_net(dev) != sock_net(sk)) + goto drop; + +@@ -667,12 +670,12 @@ static int tpacket_rcv(struct sk_buff *s + struct timeval tv; + struct timespec ts; + +- if (skb->pkt_type == PACKET_LOOPBACK) +- goto drop; +- + sk = pt->af_packet_priv; + po = pkt_sk(sk); + ++ if (!(po->pkt_type & (1 << skb->pkt_type))) ++ goto drop; ++ + if (dev_net(dev) != sock_net(sk)) + goto drop; + +@@ -1384,6 +1387,7 @@ static int packet_create(struct net *net + spin_lock_init(&po->bind_lock); + mutex_init(&po->pg_vec_lock); + po->prot_hook.func = packet_rcv; ++ po->pkt_type = PACKET_MASK_ANY & ~(1 << PACKET_LOOPBACK); + + if (sock->type == SOCK_PACKET) + po->prot_hook.func = packet_rcv_spkt; +@@ -1731,6 +1735,16 @@ packet_setsockopt(struct socket *sock, i + ret = packet_mc_drop(sk, &mreq); + return ret; + } ++ case PACKET_RECV_TYPE: ++ { ++ unsigned int val; ++ if (optlen != sizeof(val)) ++ return -EINVAL; ++ if (copy_from_user(&val, optval, sizeof(val))) ++ return -EFAULT; ++ po->pkt_type = val & ~PACKET_LOOPBACK; ++ return 0; ++ } + + #ifdef CONFIG_PACKET_MMAP + case PACKET_RX_RING: +@@ -1876,6 +1890,13 @@ static int packet_getsockopt(struct sock + + data = &val; + break; ++ case PACKET_RECV_TYPE: ++ if (len > sizeof(unsigned int)) ++ len = sizeof(unsigned int); ++ val = po->pkt_type; ++ ++ data = &val; ++ break; + #ifdef CONFIG_PACKET_MMAP + case PACKET_VERSION: + if (len > sizeof(int)) diff --git a/target/linux/generic-2.6/patches-2.6.32/250-pppoe_header_pad.patch b/target/linux/generic-2.6/patches-2.6.32/250-pppoe_header_pad.patch new file mode 100644 index 000000000..042546f31 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/250-pppoe_header_pad.patch @@ -0,0 +1,20 @@ +--- a/drivers/net/pppoe.c ++++ b/drivers/net/pppoe.c +@@ -863,7 +863,7 @@ static int pppoe_sendmsg(struct kiocb *i + goto end; + + +- skb = sock_wmalloc(sk, total_len + dev->hard_header_len + 32, ++ skb = sock_wmalloc(sk, total_len + dev->hard_header_len + 32 + NET_SKB_PAD, + 0, GFP_KERNEL); + if (!skb) { + error = -ENOMEM; +@@ -871,7 +871,7 @@ static int pppoe_sendmsg(struct kiocb *i + } + + /* Reserve space for headers. */ +- skb_reserve(skb, dev->hard_header_len); ++ skb_reserve(skb, dev->hard_header_len + NET_SKB_PAD); + skb_reset_network_header(skb); + + skb->dev = dev; diff --git a/target/linux/generic-2.6/patches-2.6.32/260-extend_pfifo_fast.patch b/target/linux/generic-2.6/patches-2.6.32/260-extend_pfifo_fast.patch new file mode 100644 index 000000000..f306e861f --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/260-extend_pfifo_fast.patch @@ -0,0 +1,144 @@ +--- a/net/sched/sch_generic.c ++++ b/net/sched/sch_generic.c +@@ -391,16 +391,50 @@ static const u8 prio2band[TC_PRIO_MAX+1] + + #define PFIFO_FAST_BANDS 3 + ++struct pfifo_fast_sched_data { ++ struct tcf_proto *filter_list; ++ struct sk_buff_head list[PFIFO_FAST_BANDS]; ++}; ++ + static inline struct sk_buff_head *prio2list(struct sk_buff *skb, + struct Qdisc *qdisc) + { +- struct sk_buff_head *list = qdisc_priv(qdisc); ++ struct pfifo_fast_sched_data *q = qdisc_priv(qdisc); ++ struct sk_buff_head *list = q->list; + return list + prio2band[skb->priority & TC_PRIO_MAX]; + } + ++static int pfifo_fast_filter(struct sk_buff *skb, struct Qdisc* qdisc) ++{ ++#ifdef CONFIG_NET_CLS_ACT ++ struct pfifo_fast_sched_data *q = qdisc_priv(qdisc); ++ int result = 0, ret = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN; ++ struct tcf_result res; ++ ++ if (q->filter_list != NULL) ++ result = tc_classify(skb, q->filter_list, &res); ++ if (result >= 0) { ++ switch (result) { ++ case TC_ACT_STOLEN: ++ case TC_ACT_QUEUED: ++ ret = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN; ++ case TC_ACT_SHOT: ++ kfree_skb(skb); ++ return ret; ++ } ++ } ++#endif ++ return 0; ++} ++ + static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc* qdisc) + { + struct sk_buff_head *list = prio2list(skb, qdisc); ++ int ret; ++ ++ ret = pfifo_fast_filter(skb, qdisc); ++ if (ret) ++ return ret; + + if (skb_queue_len(list) < qdisc_dev(qdisc)->tx_queue_len) { + qdisc->q.qlen++; +@@ -412,8 +446,9 @@ static int pfifo_fast_enqueue(struct sk_ + + static struct sk_buff *pfifo_fast_dequeue(struct Qdisc* qdisc) + { ++ struct pfifo_fast_sched_data *q = qdisc_priv(qdisc); ++ struct sk_buff_head *list = q->list; + int prio; +- struct sk_buff_head *list = qdisc_priv(qdisc); + + for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) { + if (!skb_queue_empty(list + prio)) { +@@ -440,8 +475,9 @@ static struct sk_buff *pfifo_fast_peek(s + + static void pfifo_fast_reset(struct Qdisc* qdisc) + { ++ struct pfifo_fast_sched_data *q = qdisc_priv(qdisc); ++ struct sk_buff_head *list = q->list; + int prio; +- struct sk_buff_head *list = qdisc_priv(qdisc); + + for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) + __qdisc_reset_queue(qdisc, list + prio); +@@ -464,8 +500,9 @@ nla_put_failure: + + static int pfifo_fast_init(struct Qdisc *qdisc, struct nlattr *opt) + { ++ struct pfifo_fast_sched_data *q = qdisc_priv(qdisc); ++ struct sk_buff_head *list = q->list; + int prio; +- struct sk_buff_head *list = qdisc_priv(qdisc); + + for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) + skb_queue_head_init(list + prio); +@@ -473,9 +510,36 @@ static int pfifo_fast_init(struct Qdisc + return 0; + } + ++static int pfifo_fast_change_class(struct Qdisc *qdisc, u32 classid, u32 parentid, ++ struct nlattr **tca, unsigned long *arg) ++{ ++ return -EOPNOTSUPP; ++} ++ ++static unsigned long pfifo_fast_get(struct Qdisc *qdisc, u32 classid) ++{ ++ return 0; ++} ++ ++static struct tcf_proto **pfifo_fast_find_tcf(struct Qdisc *qdisc, unsigned long cl) ++{ ++ struct pfifo_fast_sched_data *q = qdisc_priv(qdisc); ++ ++ if (cl) ++ return NULL; ++ return &q->filter_list; ++} ++ ++static const struct Qdisc_class_ops pfifo_fast_class_ops = { ++ .get = pfifo_fast_get, ++ .change = pfifo_fast_change_class, ++ .tcf_chain = pfifo_fast_find_tcf, ++}; ++ + static struct Qdisc_ops pfifo_fast_ops __read_mostly = { + .id = "pfifo_fast", +- .priv_size = PFIFO_FAST_BANDS * sizeof(struct sk_buff_head), ++ .cl_ops = &pfifo_fast_class_ops, ++ .priv_size = sizeof(struct pfifo_fast_sched_data), + .enqueue = pfifo_fast_enqueue, + .dequeue = pfifo_fast_dequeue, + .peek = pfifo_fast_peek, +@@ -757,3 +821,18 @@ void dev_shutdown(struct net_device *dev + shutdown_scheduler_queue(dev, &dev->rx_queue, &noop_qdisc); + WARN_ON(timer_pending(&dev->watchdog_timer)); + } ++ ++#ifdef CONFIG_NET_SCHED ++static int __init sch_generic_init(void) ++{ ++ return register_qdisc(&pfifo_fast_ops); ++} ++ ++static void __exit sch_generic_exit(void) ++{ ++ unregister_qdisc(&pfifo_fast_ops); ++} ++ ++module_init(sch_generic_init) ++module_exit(sch_generic_exit) ++#endif diff --git a/target/linux/generic-2.6/patches-2.6.32/400-ledtrig_morse.patch b/target/linux/generic-2.6/patches-2.6.32/400-ledtrig_morse.patch new file mode 100644 index 000000000..1892eb5bd --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/400-ledtrig_morse.patch @@ -0,0 +1,18 @@ +--- a/drivers/leds/Kconfig ++++ b/drivers/leds/Kconfig +@@ -304,4 +304,8 @@ config LEDS_TRIGGER_DEFAULT_ON + comment "iptables trigger is under Netfilter config (LED target)" + depends on LEDS_TRIGGERS + ++config LEDS_TRIGGER_MORSE ++ tristate "LED Morse Trigger" ++ depends on LEDS_TRIGGERS ++ + endif # NEW_LEDS +--- a/drivers/leds/Makefile ++++ b/drivers/leds/Makefile +@@ -40,3 +40,4 @@ obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT) += + obj-$(CONFIG_LEDS_TRIGGER_BACKLIGHT) += ledtrig-backlight.o + obj-$(CONFIG_LEDS_TRIGGER_GPIO) += ledtrig-gpio.o + obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o ++obj-$(CONFIG_LEDS_TRIGGER_MORSE) += ledtrig-morse.o diff --git a/target/linux/generic-2.6/patches-2.6.32/402-ledtrig_netdev.patch b/target/linux/generic-2.6/patches-2.6.32/402-ledtrig_netdev.patch new file mode 100644 index 000000000..d6f7353dc --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/402-ledtrig_netdev.patch @@ -0,0 +1,21 @@ +--- a/drivers/leds/Kconfig ++++ b/drivers/leds/Kconfig +@@ -308,4 +308,11 @@ config LEDS_TRIGGER_MORSE + tristate "LED Morse Trigger" + depends on LEDS_TRIGGERS + ++config LEDS_TRIGGER_NETDEV ++ tristate "LED Netdev Trigger" ++ depends on LEDS_TRIGGERS ++ help ++ This allows LEDs to be controlled by network device activity. ++ If unsure, say Y. ++ + endif # NEW_LEDS +--- a/drivers/leds/Makefile ++++ b/drivers/leds/Makefile +@@ -41,3 +41,4 @@ obj-$(CONFIG_LEDS_TRIGGER_BACKLIGHT) += + obj-$(CONFIG_LEDS_TRIGGER_GPIO) += ledtrig-gpio.o + obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o + obj-$(CONFIG_LEDS_TRIGGER_MORSE) += ledtrig-morse.o ++obj-$(CONFIG_LEDS_TRIGGER_NETDEV) += ledtrig-netdev.o diff --git a/target/linux/generic-2.6/patches-2.6.32/410-gpio_buttons.patch b/target/linux/generic-2.6/patches-2.6.32/410-gpio_buttons.patch new file mode 100644 index 000000000..95987ce48 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/410-gpio_buttons.patch @@ -0,0 +1,31 @@ +--- a/drivers/input/misc/Kconfig ++++ b/drivers/input/misc/Kconfig +@@ -316,4 +316,20 @@ config INPUT_PCAP + To compile this driver as a module, choose M here: the + module will be called pcap_keys. + ++config INPUT_GPIO_BUTTONS ++ tristate "Polled GPIO buttons interface" ++ depends on GENERIC_GPIO ++ select INPUT_POLLDEV ++ help ++ This driver implements support for buttons connected ++ to GPIO pins of various CPUs (and some other chips). ++ ++ Say Y here if your device has buttons connected ++ directly to such GPIO pins. Your board-specific ++ setup logic must also provide a platform device, ++ with configuration data saying which GPIOs are used. ++ ++ To compile this driver as a module, choose M here: the ++ module will be called gpio-buttons. ++ + endif +--- a/drivers/input/misc/Makefile ++++ b/drivers/input/misc/Makefile +@@ -30,4 +30,5 @@ obj-$(CONFIG_INPUT_WINBOND_CIR) += winb + obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o + obj-$(CONFIG_INPUT_WM831X_ON) += wm831x-on.o + obj-$(CONFIG_INPUT_YEALINK) += yealink.o ++obj-$(CONFIG_INPUT_GPIO_BUTTONS) += gpio_buttons.o + diff --git a/target/linux/generic-2.6/patches-2.6.32/420-gpiodev.patch b/target/linux/generic-2.6/patches-2.6.32/420-gpiodev.patch new file mode 100644 index 000000000..7e4b85b25 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/420-gpiodev.patch @@ -0,0 +1,27 @@ +--- a/drivers/char/Kconfig ++++ b/drivers/char/Kconfig +@@ -1029,6 +1029,14 @@ config CS5535_GPIO + + If compiled as a module, it will be called cs5535_gpio. + ++config GPIO_DEVICE ++ tristate "GPIO device support" ++ depends on GENERIC_GPIO ++ help ++ Say Y to enable Linux GPIO device support. This allows control of ++ GPIO pins using a character device ++ ++ + config RAW_DRIVER + tristate "RAW driver (/dev/raw/rawN)" + depends on BLOCK +--- a/drivers/char/Makefile ++++ b/drivers/char/Makefile +@@ -96,6 +96,7 @@ obj-$(CONFIG_SCx200_GPIO) += scx200_gpio + obj-$(CONFIG_PC8736x_GPIO) += pc8736x_gpio.o + obj-$(CONFIG_NSC_GPIO) += nsc_gpio.o + obj-$(CONFIG_CS5535_GPIO) += cs5535_gpio.o ++obj-$(CONFIG_GPIO_DEVICE) += gpio_dev.o + obj-$(CONFIG_GPIO_TB0219) += tb0219.o + obj-$(CONFIG_TELCLOCK) += tlclk.o + diff --git a/target/linux/generic-2.6/patches-2.6.32/430-scsi_header_fix.patch b/target/linux/generic-2.6/patches-2.6.32/430-scsi_header_fix.patch new file mode 100644 index 000000000..adbd38391 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/430-scsi_header_fix.patch @@ -0,0 +1,17 @@ +--- a/include/scsi/scsi.h ++++ b/include/scsi/scsi.h +@@ -145,10 +145,10 @@ struct scsi_cmnd; + + /* defined in T10 SCSI Primary Commands-2 (SPC2) */ + struct scsi_varlen_cdb_hdr { +- u8 opcode; /* opcode always == VARIABLE_LENGTH_CMD */ +- u8 control; +- u8 misc[5]; +- u8 additional_cdb_length; /* total cdb length - 8 */ ++ __u8 opcode; /* opcode always == VARIABLE_LENGTH_CMD */ ++ __u8 control; ++ __u8 misc[5]; ++ __u8 additional_cdb_length; /* total cdb length - 8 */ + __be16 service_action; + /* service specific data follows */ + }; diff --git a/target/linux/generic-2.6/patches-2.6.32/510-yaffs_support.patch b/target/linux/generic-2.6/patches-2.6.32/510-yaffs_support.patch new file mode 100644 index 000000000..fe549c30c --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/510-yaffs_support.patch @@ -0,0 +1,17 @@ +--- a/fs/Kconfig ++++ b/fs/Kconfig +@@ -44,6 +44,7 @@ source "fs/gfs2/Kconfig" + source "fs/ocfs2/Kconfig" + source "fs/btrfs/Kconfig" + source "fs/nilfs2/Kconfig" ++source "fs/yaffs2/Kconfig" + + endif # BLOCK + +--- a/fs/Makefile ++++ b/fs/Makefile +@@ -126,3 +126,4 @@ obj-$(CONFIG_OCFS2_FS) += ocfs2/ + obj-$(CONFIG_BTRFS_FS) += btrfs/ + obj-$(CONFIG_GFS2_FS) += gfs2/ + obj-$(CONFIG_EXOFS_FS) += exofs/ ++obj-$(CONFIG_YAFFS_FS) += yaffs2/ diff --git a/target/linux/generic-2.6/patches-2.6.32/511-yaffs-cvs-2009-04-24.patch b/target/linux/generic-2.6/patches-2.6.32/511-yaffs-cvs-2009-04-24.patch new file mode 100644 index 000000000..5c70e79a0 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/511-yaffs-cvs-2009-04-24.patch @@ -0,0 +1,12344 @@ +--- a/fs/yaffs2/devextras.h ++++ b/fs/yaffs2/devextras.h +@@ -14,194 +14,135 @@ + */ + + /* +- * This file is just holds extra declarations used during development. +- * Most of these are from kernel includes placed here so we can use them in +- * applications. ++ * This file is just holds extra declarations of macros that would normally ++ * be providesd in the Linux kernel. These macros have been written from ++ * scratch but are functionally equivalent to the Linux ones. + * + */ + + #ifndef __EXTRAS_H__ + #define __EXTRAS_H__ + +-#if defined WIN32 +-#define __inline__ __inline +-#define new newHack +-#endif +- +-#if !(defined __KERNEL__) || (defined WIN32) + +-/* User space defines */ ++#if !(defined __KERNEL__) + ++/* Definition of types */ + typedef unsigned char __u8; + typedef unsigned short __u16; + typedef unsigned __u32; + ++#endif ++ + /* +- * Simple doubly linked list implementation. +- * +- * Some of the internal functions ("__xxx") are useful when +- * manipulating whole lists rather than single entries, as +- * sometimes we already know the next/prev entries and we can +- * generate better code by using them directly rather than +- * using the generic single-entry routines. ++ * This is a simple doubly linked list implementation that matches the ++ * way the Linux kernel doubly linked list implementation works. + */ + +-#define prefetch(x) 1 +- +-struct list_head { +- struct list_head *next, *prev; ++struct ylist_head { ++ struct ylist_head *next; /* next in chain */ ++ struct ylist_head *prev; /* previous in chain */ + }; + +-#define LIST_HEAD_INIT(name) { &(name), &(name) } + +-#define LIST_HEAD(name) \ +- struct list_head name = LIST_HEAD_INIT(name) ++/* Initialise a static list */ ++#define YLIST_HEAD(name) \ ++struct ylist_head name = { &(name), &(name)} ++ + +-#define INIT_LIST_HEAD(ptr) do { \ +- (ptr)->next = (ptr); (ptr)->prev = (ptr); \ ++ ++/* Initialise a list head to an empty list */ ++#define YINIT_LIST_HEAD(p) \ ++do { \ ++ (p)->next = (p);\ ++ (p)->prev = (p); \ + } while (0) + +-/* +- * Insert a new entry between two known consecutive entries. +- * +- * This is only for internal list manipulation where we know +- * the prev/next entries already! +- */ +-static __inline__ void __list_add(struct list_head *new, +- struct list_head *prev, +- struct list_head *next) +-{ +- next->prev = new; +- new->next = next; +- new->prev = prev; +- prev->next = new; +-} + +-/** +- * list_add - add a new entry +- * @new: new entry to be added +- * @head: list head to add it after +- * +- * Insert a new entry after the specified head. +- * This is good for implementing stacks. +- */ +-static __inline__ void list_add(struct list_head *new, struct list_head *head) ++/* Add an element to a list */ ++static __inline__ void ylist_add(struct ylist_head *newEntry, ++ struct ylist_head *list) + { +- __list_add(new, head, head->next); +-} ++ struct ylist_head *listNext = list->next; ++ ++ list->next = newEntry; ++ newEntry->prev = list; ++ newEntry->next = listNext; ++ listNext->prev = newEntry; + +-/** +- * list_add_tail - add a new entry +- * @new: new entry to be added +- * @head: list head to add it before +- * +- * Insert a new entry before the specified head. +- * This is useful for implementing queues. +- */ +-static __inline__ void list_add_tail(struct list_head *new, +- struct list_head *head) +-{ +- __list_add(new, head->prev, head); + } + +-/* +- * Delete a list entry by making the prev/next entries +- * point to each other. +- * +- * This is only for internal list manipulation where we know +- * the prev/next entries already! +- */ +-static __inline__ void __list_del(struct list_head *prev, +- struct list_head *next) ++static __inline__ void ylist_add_tail(struct ylist_head *newEntry, ++ struct ylist_head *list) + { +- next->prev = prev; +- prev->next = next; ++ struct ylist_head *listPrev = list->prev; ++ ++ list->prev = newEntry; ++ newEntry->next = list; ++ newEntry->prev = listPrev; ++ listPrev->next = newEntry; ++ + } + +-/** +- * list_del - deletes entry from list. +- * @entry: the element to delete from the list. +- * Note: list_empty on entry does not return true after this, the entry is +- * in an undefined state. +- */ +-static __inline__ void list_del(struct list_head *entry) ++ ++/* Take an element out of its current list, with or without ++ * reinitialising the links.of the entry*/ ++static __inline__ void ylist_del(struct ylist_head *entry) + { +- __list_del(entry->prev, entry->next); ++ struct ylist_head *listNext = entry->next; ++ struct ylist_head *listPrev = entry->prev; ++ ++ listNext->prev = listPrev; ++ listPrev->next = listNext; ++ + } + +-/** +- * list_del_init - deletes entry from list and reinitialize it. +- * @entry: the element to delete from the list. +- */ +-static __inline__ void list_del_init(struct list_head *entry) ++static __inline__ void ylist_del_init(struct ylist_head *entry) + { +- __list_del(entry->prev, entry->next); +- INIT_LIST_HEAD(entry); ++ ylist_del(entry); ++ entry->next = entry->prev = entry; + } + +-/** +- * list_empty - tests whether a list is empty +- * @head: the list to test. +- */ +-static __inline__ int list_empty(struct list_head *head) ++ ++/* Test if the list is empty */ ++static __inline__ int ylist_empty(struct ylist_head *entry) + { +- return head->next == head; ++ return (entry->next == entry); + } + +-/** +- * list_splice - join two lists +- * @list: the new list to add. +- * @head: the place to add it in the first list. ++ ++/* ylist_entry takes a pointer to a list entry and offsets it to that ++ * we can find a pointer to the object it is embedded in. + */ +-static __inline__ void list_splice(struct list_head *list, +- struct list_head *head) +-{ +- struct list_head *first = list->next; + +- if (first != list) { +- struct list_head *last = list->prev; +- struct list_head *at = head->next; +- +- first->prev = head; +- head->next = first; +- +- last->next = at; +- at->prev = last; +- } +-} + +-/** +- * list_entry - get the struct for this entry +- * @ptr: the &struct list_head pointer. +- * @type: the type of the struct this is embedded in. +- * @member: the name of the list_struct within the struct. +- */ +-#define list_entry(ptr, type, member) \ +- ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) +- +-/** +- * list_for_each - iterate over a list +- * @pos: the &struct list_head to use as a loop counter. +- * @head: the head for your list. +- */ +-#define list_for_each(pos, head) \ +- for (pos = (head)->next, prefetch(pos->next); pos != (head); \ +- pos = pos->next, prefetch(pos->next)) +- +-/** +- * list_for_each_safe - iterate over a list safe against removal +- * of list entry +- * @pos: the &struct list_head to use as a loop counter. +- * @n: another &struct list_head to use as temporary storage +- * @head: the head for your list. +- */ +-#define list_for_each_safe(pos, n, head) \ +- for (pos = (head)->next, n = pos->next; pos != (head); \ +- pos = n, n = pos->next) ++#define ylist_entry(entry, type, member) \ ++ ((type *)((char *)(entry)-(unsigned long)(&((type *)NULL)->member))) + +-/* +- * File types ++ ++/* ylist_for_each and list_for_each_safe iterate over lists. ++ * ylist_for_each_safe uses temporary storage to make the list delete safe + */ ++ ++#define ylist_for_each(itervar, list) \ ++ for (itervar = (list)->next; itervar != (list); itervar = itervar->next) ++ ++#define ylist_for_each_safe(itervar, saveVar, list) \ ++ for (itervar = (list)->next, saveVar = (list)->next->next; \ ++ itervar != (list); itervar = saveVar, saveVar = saveVar->next) ++ ++ ++#if !(defined __KERNEL__) ++ ++ ++#ifndef WIN32 ++#include ++#endif ++ ++ ++#ifdef CONFIG_YAFFS_PROVIDE_DEFS ++/* File types */ ++ ++ + #define DT_UNKNOWN 0 + #define DT_FIFO 1 + #define DT_CHR 2 +@@ -212,6 +153,7 @@ static __inline__ void list_splice(struc + #define DT_SOCK 12 + #define DT_WHT 14 + ++ + #ifndef WIN32 + #include + #endif +@@ -227,10 +169,6 @@ static __inline__ void list_splice(struc + #define ATTR_ATIME 16 + #define ATTR_MTIME 32 + #define ATTR_CTIME 64 +-#define ATTR_ATIME_SET 128 +-#define ATTR_MTIME_SET 256 +-#define ATTR_FORCE 512 /* Not a change, but a change it */ +-#define ATTR_ATTR_FLAG 1024 + + struct iattr { + unsigned int ia_valid; +@@ -244,21 +182,15 @@ struct iattr { + unsigned int ia_attr_flags; + }; + +-#define KERN_DEBUG ++#endif + + #else + +-#ifndef WIN32 + #include +-#include + #include + #include +-#endif + + #endif + +-#if defined WIN32 +-#undef new +-#endif + + #endif +--- a/fs/yaffs2/Kconfig ++++ b/fs/yaffs2/Kconfig +@@ -5,7 +5,7 @@ + config YAFFS_FS + tristate "YAFFS2 file system support" + default n +- depends on MTD ++ depends on MTD_BLOCK + select YAFFS_YAFFS1 + select YAFFS_YAFFS2 + help +@@ -43,7 +43,8 @@ config YAFFS_9BYTE_TAGS + format that you need to continue to support. New data written + also uses the older-style format. Note: Use of this option + generally requires that MTD's oob layout be adjusted to use the +- older-style format. See notes on tags formats and MTD versions. ++ older-style format. See notes on tags formats and MTD versions ++ in yaffs_mtdif1.c. + + If unsure, say N. + +@@ -109,26 +110,6 @@ config YAFFS_DISABLE_LAZY_LOAD + + If unsure, say N. + +-config YAFFS_CHECKPOINT_RESERVED_BLOCKS +- int "Reserved blocks for checkpointing" +- depends on YAFFS_YAFFS2 +- default 10 +- help +- Give the number of Blocks to reserve for checkpointing. +- Checkpointing saves the state at unmount so that mounting is +- much faster as a scan of all the flash to regenerate this state +- is not needed. These Blocks are reserved per partition, so if +- you have very small partitions the default (10) may be a mess +- for you. You can set this value to 0, but that does not mean +- checkpointing is disabled at all. There only won't be any +- specially reserved blocks for checkpointing, so if there is +- enough free space on the filesystem, it will be used for +- checkpointing. +- +- If unsure, leave at default (10), but don't wonder if there are +- always 2MB used on your large page device partition (10 x 2k +- pagesize). When using small partitions or when being very small +- on space, you probably want to set this to zero. + + config YAFFS_DISABLE_WIDE_TNODES + bool "Turn off wide tnodes" +--- a/fs/yaffs2/Makefile ++++ b/fs/yaffs2/Makefile +@@ -5,7 +5,6 @@ + obj-$(CONFIG_YAFFS_FS) += yaffs.o + + yaffs-y := yaffs_ecc.o yaffs_fs.o yaffs_guts.o yaffs_checkptrw.o +-yaffs-y += yaffs_packedtags2.o yaffs_nand.o yaffs_qsort.o ++yaffs-y += yaffs_packedtags1.o yaffs_packedtags2.o yaffs_nand.o yaffs_qsort.o + yaffs-y += yaffs_tagscompat.o yaffs_tagsvalidity.o +-yaffs-y += yaffs_mtdif1.o yaffs_packedtags1.o +-yaffs-y += yaffs_mtdif.o yaffs_mtdif2.o ++yaffs-y += yaffs_mtdif.o yaffs_mtdif1.o yaffs_mtdif2.o +--- a/fs/yaffs2/moduleconfig.h ++++ b/fs/yaffs2/moduleconfig.h +@@ -27,12 +27,12 @@ + + /* Default: Not selected */ + /* Meaning: Yaffs does its own ECC, rather than using MTD ECC */ +-//#define CONFIG_YAFFS_DOES_ECC ++/* #define CONFIG_YAFFS_DOES_ECC */ + + /* Default: Not selected */ + /* Meaning: ECC byte order is 'wrong'. Only meaningful if */ + /* CONFIG_YAFFS_DOES_ECC is set */ +-//#define CONFIG_YAFFS_ECC_WRONG_ORDER ++/* #define CONFIG_YAFFS_ECC_WRONG_ORDER */ + + /* Default: Selected */ + /* Meaning: Disables testing whether chunks are erased before writing to them*/ +@@ -54,11 +54,11 @@ that you need to continue to support. N + older-style format. + Note: Use of this option generally requires that MTD's oob layout be + adjusted to use the older-style format. See notes on tags formats and +-MTD versions. ++MTD versions in yaffs_mtdif1.c. + */ + /* Default: Not selected */ + /* Meaning: Use older-style on-NAND data format with pageStatus byte */ +-#define CONFIG_YAFFS_9BYTE_TAGS ++/* #define CONFIG_YAFFS_9BYTE_TAGS */ + + #endif /* YAFFS_OUT_OF_TREE */ + +--- a/fs/yaffs2/yaffs_checkptrw.c ++++ b/fs/yaffs2/yaffs_checkptrw.c +@@ -12,48 +12,43 @@ + */ + + const char *yaffs_checkptrw_c_version = +- "$Id: yaffs_checkptrw.c,v 1.14 2007-05-15 20:07:40 charles Exp $"; ++ "$Id: yaffs_checkptrw.c,v 1.18 2009-03-06 17:20:49 wookey Exp $"; + + + #include "yaffs_checkptrw.h" +- ++#include "yaffs_getblockinfo.h" + + static int yaffs_CheckpointSpaceOk(yaffs_Device *dev) + { +- + int blocksAvailable = dev->nErasedBlocks - dev->nReservedBlocks; + + T(YAFFS_TRACE_CHECKPOINT, + (TSTR("checkpt blocks available = %d" TENDSTR), + blocksAvailable)); + +- + return (blocksAvailable <= 0) ? 0 : 1; + } + + + static int yaffs_CheckpointErase(yaffs_Device *dev) + { +- + int i; + +- +- if(!dev->eraseBlockInNAND) ++ if (!dev->eraseBlockInNAND) + return 0; +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("checking blocks %d to %d"TENDSTR), +- dev->internalStartBlock,dev->internalEndBlock)); ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("checking blocks %d to %d"TENDSTR), ++ dev->internalStartBlock, dev->internalEndBlock)); + +- for(i = dev->internalStartBlock; i <= dev->internalEndBlock; i++) { +- yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev,i); +- if(bi->blockState == YAFFS_BLOCK_STATE_CHECKPOINT){ +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("erasing checkpt block %d"TENDSTR),i)); +- if(dev->eraseBlockInNAND(dev,i- dev->blockOffset /* realign */)){ ++ for (i = dev->internalStartBlock; i <= dev->internalEndBlock; i++) { ++ yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev, i); ++ if (bi->blockState == YAFFS_BLOCK_STATE_CHECKPOINT) { ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("erasing checkpt block %d"TENDSTR), i)); ++ if (dev->eraseBlockInNAND(dev, i - dev->blockOffset /* realign */)) { + bi->blockState = YAFFS_BLOCK_STATE_EMPTY; + dev->nErasedBlocks++; + dev->nFreeChunks += dev->nChunksPerBlock; +- } +- else { +- dev->markNANDBlockBad(dev,i); ++ } else { ++ dev->markNANDBlockBad(dev, i); + bi->blockState = YAFFS_BLOCK_STATE_DEAD; + } + } +@@ -71,23 +66,23 @@ static void yaffs_CheckpointFindNextEras + int blocksAvailable = dev->nErasedBlocks - dev->nReservedBlocks; + T(YAFFS_TRACE_CHECKPOINT, + (TSTR("allocating checkpt block: erased %d reserved %d avail %d next %d "TENDSTR), +- dev->nErasedBlocks,dev->nReservedBlocks,blocksAvailable,dev->checkpointNextBlock)); ++ dev->nErasedBlocks, dev->nReservedBlocks, blocksAvailable, dev->checkpointNextBlock)); + +- if(dev->checkpointNextBlock >= 0 && +- dev->checkpointNextBlock <= dev->internalEndBlock && +- blocksAvailable > 0){ +- +- for(i = dev->checkpointNextBlock; i <= dev->internalEndBlock; i++){ +- yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev,i); +- if(bi->blockState == YAFFS_BLOCK_STATE_EMPTY){ ++ if (dev->checkpointNextBlock >= 0 && ++ dev->checkpointNextBlock <= dev->internalEndBlock && ++ blocksAvailable > 0) { ++ ++ for (i = dev->checkpointNextBlock; i <= dev->internalEndBlock; i++) { ++ yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev, i); ++ if (bi->blockState == YAFFS_BLOCK_STATE_EMPTY) { + dev->checkpointNextBlock = i + 1; + dev->checkpointCurrentBlock = i; +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("allocating checkpt block %d"TENDSTR),i)); ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("allocating checkpt block %d"TENDSTR), i)); + return; + } + } + } +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("out of checkpt blocks"TENDSTR))); ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("out of checkpt blocks"TENDSTR))); + + dev->checkpointNextBlock = -1; + dev->checkpointCurrentBlock = -1; +@@ -98,30 +93,31 @@ static void yaffs_CheckpointFindNextChec + int i; + yaffs_ExtendedTags tags; + +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("find next checkpt block: start: blocks %d next %d" TENDSTR), ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("find next checkpt block: start: blocks %d next %d" TENDSTR), + dev->blocksInCheckpoint, dev->checkpointNextBlock)); + +- if(dev->blocksInCheckpoint < dev->checkpointMaxBlocks) +- for(i = dev->checkpointNextBlock; i <= dev->internalEndBlock; i++){ ++ if (dev->blocksInCheckpoint < dev->checkpointMaxBlocks) ++ for (i = dev->checkpointNextBlock; i <= dev->internalEndBlock; i++) { + int chunk = i * dev->nChunksPerBlock; + int realignedChunk = chunk - dev->chunkOffset; + +- dev->readChunkWithTagsFromNAND(dev,realignedChunk,NULL,&tags); +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("find next checkpt block: search: block %d oid %d seq %d eccr %d" TENDSTR), +- i, tags.objectId,tags.sequenceNumber,tags.eccResult)); ++ dev->readChunkWithTagsFromNAND(dev, realignedChunk, ++ NULL, &tags); ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("find next checkpt block: search: block %d oid %d seq %d eccr %d" TENDSTR), ++ i, tags.objectId, tags.sequenceNumber, tags.eccResult)); + +- if(tags.sequenceNumber == YAFFS_SEQUENCE_CHECKPOINT_DATA){ ++ if (tags.sequenceNumber == YAFFS_SEQUENCE_CHECKPOINT_DATA) { + /* Right kind of block */ + dev->checkpointNextBlock = tags.objectId; + dev->checkpointCurrentBlock = i; + dev->checkpointBlockList[dev->blocksInCheckpoint] = i; + dev->blocksInCheckpoint++; +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("found checkpt block %d"TENDSTR),i)); ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("found checkpt block %d"TENDSTR), i)); + return; + } + } + +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("found no more checkpt blocks"TENDSTR))); ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("found no more checkpt blocks"TENDSTR))); + + dev->checkpointNextBlock = -1; + dev->checkpointCurrentBlock = -1; +@@ -133,17 +129,17 @@ int yaffs_CheckpointOpen(yaffs_Device *d + + /* Got the functions we need? */ + if (!dev->writeChunkWithTagsToNAND || +- !dev->readChunkWithTagsFromNAND || +- !dev->eraseBlockInNAND || +- !dev->markNANDBlockBad) ++ !dev->readChunkWithTagsFromNAND || ++ !dev->eraseBlockInNAND || ++ !dev->markNANDBlockBad) + return 0; + +- if(forWriting && !yaffs_CheckpointSpaceOk(dev)) ++ if (forWriting && !yaffs_CheckpointSpaceOk(dev)) + return 0; + +- if(!dev->checkpointBuffer) +- dev->checkpointBuffer = YMALLOC_DMA(dev->nDataBytesPerChunk); +- if(!dev->checkpointBuffer) ++ if (!dev->checkpointBuffer) ++ dev->checkpointBuffer = YMALLOC_DMA(dev->totalBytesPerChunk); ++ if (!dev->checkpointBuffer) + return 0; + + +@@ -159,12 +155,10 @@ int yaffs_CheckpointOpen(yaffs_Device *d + dev->checkpointNextBlock = dev->internalStartBlock; + + /* Erase all the blocks in the checkpoint area */ +- if(forWriting){ +- memset(dev->checkpointBuffer,0,dev->nDataBytesPerChunk); ++ if (forWriting) { ++ memset(dev->checkpointBuffer, 0, dev->nDataBytesPerChunk); + dev->checkpointByteOffset = 0; + return yaffs_CheckpointErase(dev); +- +- + } else { + int i; + /* Set to a value that will kick off a read */ +@@ -174,7 +168,7 @@ int yaffs_CheckpointOpen(yaffs_Device *d + dev->blocksInCheckpoint = 0; + dev->checkpointMaxBlocks = (dev->internalEndBlock - dev->internalStartBlock)/16 + 2; + dev->checkpointBlockList = YMALLOC(sizeof(int) * dev->checkpointMaxBlocks); +- for(i = 0; i < dev->checkpointMaxBlocks; i++) ++ for (i = 0; i < dev->checkpointMaxBlocks; i++) + dev->checkpointBlockList[i] = -1; + } + +@@ -191,18 +185,17 @@ int yaffs_GetCheckpointSum(yaffs_Device + + static int yaffs_CheckpointFlushBuffer(yaffs_Device *dev) + { +- + int chunk; + int realignedChunk; + + yaffs_ExtendedTags tags; + +- if(dev->checkpointCurrentBlock < 0){ ++ if (dev->checkpointCurrentBlock < 0) { + yaffs_CheckpointFindNextErasedBlock(dev); + dev->checkpointCurrentChunk = 0; + } + +- if(dev->checkpointCurrentBlock < 0) ++ if (dev->checkpointCurrentBlock < 0) + return 0; + + tags.chunkDeleted = 0; +@@ -210,10 +203,10 @@ static int yaffs_CheckpointFlushBuffer(y + tags.chunkId = dev->checkpointPageSequence + 1; + tags.sequenceNumber = YAFFS_SEQUENCE_CHECKPOINT_DATA; + tags.byteCount = dev->nDataBytesPerChunk; +- if(dev->checkpointCurrentChunk == 0){ ++ if (dev->checkpointCurrentChunk == 0) { + /* First chunk we write for the block? Set block state to + checkpoint */ +- yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev,dev->checkpointCurrentBlock); ++ yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev, dev->checkpointCurrentBlock); + bi->blockState = YAFFS_BLOCK_STATE_CHECKPOINT; + dev->blocksInCheckpoint++; + } +@@ -221,28 +214,29 @@ static int yaffs_CheckpointFlushBuffer(y + chunk = dev->checkpointCurrentBlock * dev->nChunksPerBlock + dev->checkpointCurrentChunk; + + +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("checkpoint wite buffer nand %d(%d:%d) objid %d chId %d" TENDSTR), +- chunk, dev->checkpointCurrentBlock, dev->checkpointCurrentChunk,tags.objectId,tags.chunkId)); ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("checkpoint wite buffer nand %d(%d:%d) objid %d chId %d" TENDSTR), ++ chunk, dev->checkpointCurrentBlock, dev->checkpointCurrentChunk, tags.objectId, tags.chunkId)); + + realignedChunk = chunk - dev->chunkOffset; + +- dev->writeChunkWithTagsToNAND(dev,realignedChunk,dev->checkpointBuffer,&tags); ++ dev->writeChunkWithTagsToNAND(dev, realignedChunk, ++ dev->checkpointBuffer, &tags); + dev->checkpointByteOffset = 0; + dev->checkpointPageSequence++; + dev->checkpointCurrentChunk++; +- if(dev->checkpointCurrentChunk >= dev->nChunksPerBlock){ ++ if (dev->checkpointCurrentChunk >= dev->nChunksPerBlock) { + dev->checkpointCurrentChunk = 0; + dev->checkpointCurrentBlock = -1; + } +- memset(dev->checkpointBuffer,0,dev->nDataBytesPerChunk); ++ memset(dev->checkpointBuffer, 0, dev->nDataBytesPerChunk); + + return 1; + } + + +-int yaffs_CheckpointWrite(yaffs_Device *dev,const void *data, int nBytes) ++int yaffs_CheckpointWrite(yaffs_Device *dev, const void *data, int nBytes) + { +- int i=0; ++ int i = 0; + int ok = 1; + + +@@ -250,17 +244,14 @@ int yaffs_CheckpointWrite(yaffs_Device * + + + +- if(!dev->checkpointBuffer) ++ if (!dev->checkpointBuffer) + return 0; + +- if(!dev->checkpointOpenForWrite) ++ if (!dev->checkpointOpenForWrite) + return -1; + +- while(i < nBytes && ok) { +- +- +- +- dev->checkpointBuffer[dev->checkpointByteOffset] = *dataBytes ; ++ while (i < nBytes && ok) { ++ dev->checkpointBuffer[dev->checkpointByteOffset] = *dataBytes; + dev->checkpointSum += *dataBytes; + dev->checkpointXor ^= *dataBytes; + +@@ -270,18 +261,17 @@ int yaffs_CheckpointWrite(yaffs_Device * + dev->checkpointByteCount++; + + +- if(dev->checkpointByteOffset < 0 || ++ if (dev->checkpointByteOffset < 0 || + dev->checkpointByteOffset >= dev->nDataBytesPerChunk) + ok = yaffs_CheckpointFlushBuffer(dev); +- + } + +- return i; ++ return i; + } + + int yaffs_CheckpointRead(yaffs_Device *dev, void *data, int nBytes) + { +- int i=0; ++ int i = 0; + int ok = 1; + yaffs_ExtendedTags tags; + +@@ -291,52 +281,54 @@ int yaffs_CheckpointRead(yaffs_Device *d + + __u8 *dataBytes = (__u8 *)data; + +- if(!dev->checkpointBuffer) ++ if (!dev->checkpointBuffer) + return 0; + +- if(dev->checkpointOpenForWrite) ++ if (dev->checkpointOpenForWrite) + return -1; + +- while(i < nBytes && ok) { ++ while (i < nBytes && ok) { + + +- if(dev->checkpointByteOffset < 0 || +- dev->checkpointByteOffset >= dev->nDataBytesPerChunk) { ++ if (dev->checkpointByteOffset < 0 || ++ dev->checkpointByteOffset >= dev->nDataBytesPerChunk) { + +- if(dev->checkpointCurrentBlock < 0){ ++ if (dev->checkpointCurrentBlock < 0) { + yaffs_CheckpointFindNextCheckpointBlock(dev); + dev->checkpointCurrentChunk = 0; + } + +- if(dev->checkpointCurrentBlock < 0) ++ if (dev->checkpointCurrentBlock < 0) + ok = 0; + else { +- +- chunk = dev->checkpointCurrentBlock * dev->nChunksPerBlock + +- dev->checkpointCurrentChunk; ++ chunk = dev->checkpointCurrentBlock * ++ dev->nChunksPerBlock + ++ dev->checkpointCurrentChunk; + + realignedChunk = chunk - dev->chunkOffset; + +- /* read in the next chunk */ +- /* printf("read checkpoint page %d\n",dev->checkpointPage); */ +- dev->readChunkWithTagsFromNAND(dev, realignedChunk, +- dev->checkpointBuffer, +- &tags); +- +- if(tags.chunkId != (dev->checkpointPageSequence + 1) || +- tags.sequenceNumber != YAFFS_SEQUENCE_CHECKPOINT_DATA) +- ok = 0; ++ /* read in the next chunk */ ++ /* printf("read checkpoint page %d\n",dev->checkpointPage); */ ++ dev->readChunkWithTagsFromNAND(dev, ++ realignedChunk, ++ dev->checkpointBuffer, ++ &tags); ++ ++ if (tags.chunkId != (dev->checkpointPageSequence + 1) || ++ tags.eccResult > YAFFS_ECC_RESULT_FIXED || ++ tags.sequenceNumber != YAFFS_SEQUENCE_CHECKPOINT_DATA) ++ ok = 0; + + dev->checkpointByteOffset = 0; + dev->checkpointPageSequence++; + dev->checkpointCurrentChunk++; + +- if(dev->checkpointCurrentChunk >= dev->nChunksPerBlock) ++ if (dev->checkpointCurrentChunk >= dev->nChunksPerBlock) + dev->checkpointCurrentBlock = -1; + } + } + +- if(ok){ ++ if (ok) { + *dataBytes = dev->checkpointBuffer[dev->checkpointByteOffset]; + dev->checkpointSum += *dataBytes; + dev->checkpointXor ^= *dataBytes; +@@ -353,17 +345,17 @@ int yaffs_CheckpointRead(yaffs_Device *d + int yaffs_CheckpointClose(yaffs_Device *dev) + { + +- if(dev->checkpointOpenForWrite){ +- if(dev->checkpointByteOffset != 0) ++ if (dev->checkpointOpenForWrite) { ++ if (dev->checkpointByteOffset != 0) + yaffs_CheckpointFlushBuffer(dev); + } else { + int i; +- for(i = 0; i < dev->blocksInCheckpoint && dev->checkpointBlockList[i] >= 0; i++){ +- yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev,dev->checkpointBlockList[i]); +- if(bi->blockState == YAFFS_BLOCK_STATE_EMPTY) ++ for (i = 0; i < dev->blocksInCheckpoint && dev->checkpointBlockList[i] >= 0; i++) { ++ yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev, dev->checkpointBlockList[i]); ++ if (bi->blockState == YAFFS_BLOCK_STATE_EMPTY) + bi->blockState = YAFFS_BLOCK_STATE_CHECKPOINT; + else { +- // Todo this looks odd... ++ /* Todo this looks odd... */ + } + } + YFREE(dev->checkpointBlockList); +@@ -374,27 +366,25 @@ int yaffs_CheckpointClose(yaffs_Device * + dev->nErasedBlocks -= dev->blocksInCheckpoint; + + +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("checkpoint byte count %d" TENDSTR), ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("checkpoint byte count %d" TENDSTR), + dev->checkpointByteCount)); + +- if(dev->checkpointBuffer){ ++ if (dev->checkpointBuffer) { + /* free the buffer */ + YFREE(dev->checkpointBuffer); + dev->checkpointBuffer = NULL; + return 1; +- } +- else ++ } else + return 0; +- + } + + int yaffs_CheckpointInvalidateStream(yaffs_Device *dev) + { + /* Erase the first checksum block */ + +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("checkpoint invalidate"TENDSTR))); ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("checkpoint invalidate"TENDSTR))); + +- if(!yaffs_CheckpointSpaceOk(dev)) ++ if (!yaffs_CheckpointSpaceOk(dev)) + return 0; + + return yaffs_CheckpointErase(dev); +--- a/fs/yaffs2/yaffs_checkptrw.h ++++ b/fs/yaffs2/yaffs_checkptrw.h +@@ -20,9 +20,9 @@ + + int yaffs_CheckpointOpen(yaffs_Device *dev, int forWriting); + +-int yaffs_CheckpointWrite(yaffs_Device *dev,const void *data, int nBytes); ++int yaffs_CheckpointWrite(yaffs_Device *dev, const void *data, int nBytes); + +-int yaffs_CheckpointRead(yaffs_Device *dev,void *data, int nBytes); ++int yaffs_CheckpointRead(yaffs_Device *dev, void *data, int nBytes); + + int yaffs_GetCheckpointSum(yaffs_Device *dev, __u32 *sum); + +--- a/fs/yaffs2/yaffs_ecc.c ++++ b/fs/yaffs2/yaffs_ecc.c +@@ -29,7 +29,7 @@ + */ + + const char *yaffs_ecc_c_version = +- "$Id: yaffs_ecc.c,v 1.9 2007-02-14 01:09:06 wookey Exp $"; ++ "$Id: yaffs_ecc.c,v 1.11 2009-03-06 17:20:50 wookey Exp $"; + + #include "yportenv.h" + +@@ -109,12 +109,10 @@ void yaffs_ECCCalculate(const unsigned c + b = column_parity_table[*data++]; + col_parity ^= b; + +- if (b & 0x01) // odd number of bits in the byte +- { ++ if (b & 0x01) { /* odd number of bits in the byte */ + line_parity ^= i; + line_parity_prime ^= ~i; + } +- + } + + ecc[2] = (~col_parity) | 0x03; +@@ -158,7 +156,7 @@ void yaffs_ECCCalculate(const unsigned c + ecc[0] = ~t; + + #ifdef CONFIG_YAFFS_ECC_WRONG_ORDER +- // Swap the bytes into the wrong order ++ /* Swap the bytes into the wrong order */ + t = ecc[0]; + ecc[0] = ecc[1]; + ecc[1] = t; +@@ -189,7 +187,7 @@ int yaffs_ECCCorrect(unsigned char *data + unsigned bit; + + #ifdef CONFIG_YAFFS_ECC_WRONG_ORDER +- // swap the bytes to correct for the wrong order ++ /* swap the bytes to correct for the wrong order */ + unsigned char t; + + t = d0; +@@ -251,7 +249,7 @@ int yaffs_ECCCorrect(unsigned char *data + * ECCxxxOther does ECC calcs on arbitrary n bytes of data + */ + void yaffs_ECCCalculateOther(const unsigned char *data, unsigned nBytes, +- yaffs_ECCOther * eccOther) ++ yaffs_ECCOther *eccOther) + { + unsigned int i; + +@@ -278,8 +276,8 @@ void yaffs_ECCCalculateOther(const unsig + } + + int yaffs_ECCCorrectOther(unsigned char *data, unsigned nBytes, +- yaffs_ECCOther * read_ecc, +- const yaffs_ECCOther * test_ecc) ++ yaffs_ECCOther *read_ecc, ++ const yaffs_ECCOther *test_ecc) + { + unsigned char cDelta; /* column parity delta */ + unsigned lDelta; /* line parity delta */ +@@ -294,8 +292,7 @@ int yaffs_ECCCorrectOther(unsigned char + return 0; /* no error */ + + if (lDelta == ~lDeltaPrime && +- (((cDelta ^ (cDelta >> 1)) & 0x15) == 0x15)) +- { ++ (((cDelta ^ (cDelta >> 1)) & 0x15) == 0x15)) { + /* Single bit (recoverable) error in data */ + + bit = 0; +@@ -307,7 +304,7 @@ int yaffs_ECCCorrectOther(unsigned char + if (cDelta & 0x02) + bit |= 0x01; + +- if(lDelta >= nBytes) ++ if (lDelta >= nBytes) + return -1; + + data[lDelta] ^= (1 << bit); +@@ -316,7 +313,7 @@ int yaffs_ECCCorrectOther(unsigned char + } + + if ((yaffs_CountBits32(lDelta) + yaffs_CountBits32(lDeltaPrime) + +- yaffs_CountBits(cDelta)) == 1) { ++ yaffs_CountBits(cDelta)) == 1) { + /* Reccoverable error in ecc */ + + *read_ecc = *test_ecc; +@@ -326,6 +323,4 @@ int yaffs_ECCCorrectOther(unsigned char + /* Unrecoverable error */ + + return -1; +- + } +- +--- a/fs/yaffs2/yaffs_ecc.h ++++ b/fs/yaffs2/yaffs_ecc.h +@@ -13,15 +13,15 @@ + * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. + */ + +- /* +- * This code implements the ECC algorithm used in SmartMedia. +- * +- * The ECC comprises 22 bits of parity information and is stuffed into 3 bytes. +- * The two unused bit are set to 1. +- * The ECC can correct single bit errors in a 256-byte page of data. Thus, two such ECC +- * blocks are used on a 512-byte NAND page. +- * +- */ ++/* ++ * This code implements the ECC algorithm used in SmartMedia. ++ * ++ * The ECC comprises 22 bits of parity information and is stuffed into 3 bytes. ++ * The two unused bit are set to 1. ++ * The ECC can correct single bit errors in a 256-byte page of data. Thus, two such ECC ++ * blocks are used on a 512-byte NAND page. ++ * ++ */ + + #ifndef __YAFFS_ECC_H__ + #define __YAFFS_ECC_H__ +@@ -34,11 +34,11 @@ typedef struct { + + void yaffs_ECCCalculate(const unsigned char *data, unsigned char *ecc); + int yaffs_ECCCorrect(unsigned char *data, unsigned char *read_ecc, +- const unsigned char *test_ecc); ++ const unsigned char *test_ecc); + + void yaffs_ECCCalculateOther(const unsigned char *data, unsigned nBytes, +- yaffs_ECCOther * ecc); ++ yaffs_ECCOther *ecc); + int yaffs_ECCCorrectOther(unsigned char *data, unsigned nBytes, +- yaffs_ECCOther * read_ecc, +- const yaffs_ECCOther * test_ecc); ++ yaffs_ECCOther *read_ecc, ++ const yaffs_ECCOther *test_ecc); + #endif +--- a/fs/yaffs2/yaffs_fs.c ++++ b/fs/yaffs2/yaffs_fs.c +@@ -1,7 +1,7 @@ + /* + * YAFFS: Yet Another Flash File System. A NAND-flash specific file system. + * +- * Copyright (C) 2002-2007 Aleph One Ltd. ++ * Copyright (C) 2002-2009 Aleph One Ltd. + * for Toby Churchill Ltd and Brightstar Engineering + * + * Created by Charles Manning +@@ -32,18 +32,17 @@ + */ + + const char *yaffs_fs_c_version = +- "$Id: yaffs_fs.c,v 1.63 2007-09-19 20:35:40 imcd Exp $"; ++ "$Id: yaffs_fs.c,v 1.79 2009-03-17 01:12:00 wookey Exp $"; + extern const char *yaffs_guts_c_version; + + #include +-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)) + #include + #endif + #include + #include + #include + #include +-#include + #include + #include + #include +@@ -53,10 +52,12 @@ extern const char *yaffs_guts_c_version; + #include + #include + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) ++#include "asm/div64.h" ++ ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + + #include /* Added NCB 15-8-2003 */ +-#include ++#include + #define UnlockPage(p) unlock_page(p) + #define Page_Uptodate(page) test_bit(PG_uptodate, &(page)->flags) + +@@ -69,22 +70,45 @@ extern const char *yaffs_guts_c_version; + #define BDEVNAME_SIZE 0 + #define yaffs_devname(sb, buf) kdevname(sb->s_dev) + +-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)) + /* added NCB 26/5/2006 for 2.4.25-vrs2-tcl1 kernel */ + #define __user + #endif + + #endif + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)) ++#define YPROC_ROOT (&proc_root) ++#else ++#define YPROC_ROOT NULL ++#endif ++ ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) + #define WRITE_SIZE_STR "writesize" +-#define WRITE_SIZE(mtd) (mtd)->writesize ++#define WRITE_SIZE(mtd) ((mtd)->writesize) + #else + #define WRITE_SIZE_STR "oobblock" +-#define WRITE_SIZE(mtd) (mtd)->oobblock ++#define WRITE_SIZE(mtd) ((mtd)->oobblock) + #endif + +-#include ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 27)) ++#define YAFFS_USE_WRITE_BEGIN_END 1 ++#else ++#define YAFFS_USE_WRITE_BEGIN_END 0 ++#endif ++ ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 28)) ++static uint32_t YCALCBLOCKS(uint64_t partition_size, uint32_t block_size) ++{ ++ uint64_t result = partition_size; ++ do_div(result, block_size); ++ return (uint32_t)result; ++} ++#else ++#define YCALCBLOCKS(s, b) ((s)/(b)) ++#endif ++ ++#include + + #include "yportenv.h" + #include "yaffs_guts.h" +@@ -96,28 +120,44 @@ extern const char *yaffs_guts_c_version; + + unsigned int yaffs_traceMask = YAFFS_TRACE_BAD_BLOCKS; + unsigned int yaffs_wr_attempts = YAFFS_WR_ATTEMPTS; ++unsigned int yaffs_auto_checkpoint = 1; + + /* Module Parameters */ +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) +-module_param(yaffs_traceMask,uint,0644); +-module_param(yaffs_wr_attempts,uint,0644); ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) ++module_param(yaffs_traceMask, uint, 0644); ++module_param(yaffs_wr_attempts, uint, 0644); ++module_param(yaffs_auto_checkpoint, uint, 0644); ++#else ++MODULE_PARM(yaffs_traceMask, "i"); ++MODULE_PARM(yaffs_wr_attempts, "i"); ++MODULE_PARM(yaffs_auto_checkpoint, "i"); ++#endif ++ ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)) ++/* use iget and read_inode */ ++#define Y_IGET(sb, inum) iget((sb), (inum)) ++static void yaffs_read_inode(struct inode *inode); ++ + #else +-MODULE_PARM(yaffs_traceMask,"i"); +-MODULE_PARM(yaffs_wr_attempts,"i"); ++/* Call local equivalent */ ++#define YAFFS_USE_OWN_IGET ++#define Y_IGET(sb, inum) yaffs_iget((sb), (inum)) ++ ++static struct inode *yaffs_iget(struct super_block *sb, unsigned long ino); + #endif + + /*#define T(x) printk x */ + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)) +-#define yaffs_InodeToObjectLV(iptr) (iptr)->i_private ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 18)) ++#define yaffs_InodeToObjectLV(iptr) ((iptr)->i_private) + #else +-#define yaffs_InodeToObjectLV(iptr) (iptr)->u.generic_ip ++#define yaffs_InodeToObjectLV(iptr) ((iptr)->u.generic_ip) + #endif + + #define yaffs_InodeToObject(iptr) ((yaffs_Object *)(yaffs_InodeToObjectLV(iptr))) + #define yaffs_DentryToObject(dptr) yaffs_InodeToObject((dptr)->d_inode) + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + #define yaffs_SuperToDevice(sb) ((yaffs_Device *)sb->s_fs_info) + #else + #define yaffs_SuperToDevice(sb) ((yaffs_Device *)sb->u.generic_sbp) +@@ -126,47 +166,49 @@ MODULE_PARM(yaffs_wr_attempts,"i"); + static void yaffs_put_super(struct super_block *sb); + + static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n, +- loff_t * pos); ++ loff_t *pos); ++static ssize_t yaffs_hold_space(struct file *f); ++static void yaffs_release_space(struct file *f); + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) + static int yaffs_file_flush(struct file *file, fl_owner_t id); + #else + static int yaffs_file_flush(struct file *file); + #endif + + static int yaffs_sync_object(struct file *file, struct dentry *dentry, +- int datasync); ++ int datasync); + + static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir); + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode, + struct nameidata *n); + static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry, +- struct nameidata *n); ++ struct nameidata *n); + #else + static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode); + static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry); + #endif + static int yaffs_link(struct dentry *old_dentry, struct inode *dir, +- struct dentry *dentry); ++ struct dentry *dentry); + static int yaffs_unlink(struct inode *dir, struct dentry *dentry); + static int yaffs_symlink(struct inode *dir, struct dentry *dentry, +- const char *symname); ++ const char *symname); + static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, int mode); + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode, +- dev_t dev); ++ dev_t dev); + #else + static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode, +- int dev); ++ int dev); + #endif + static int yaffs_rename(struct inode *old_dir, struct dentry *old_dentry, + struct inode *new_dir, struct dentry *new_dentry); + static int yaffs_setattr(struct dentry *dentry, struct iattr *attr); + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) + static int yaffs_sync_fs(struct super_block *sb, int wait); + static void yaffs_write_super(struct super_block *sb); + #else +@@ -174,33 +216,47 @@ static int yaffs_sync_fs(struct super_bl + static int yaffs_write_super(struct super_block *sb); + #endif + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) + static int yaffs_statfs(struct dentry *dentry, struct kstatfs *buf); +-#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) ++#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + static int yaffs_statfs(struct super_block *sb, struct kstatfs *buf); + #else + static int yaffs_statfs(struct super_block *sb, struct statfs *buf); + #endif +-static void yaffs_read_inode(struct inode *inode); + ++#ifdef YAFFS_HAS_PUT_INODE + static void yaffs_put_inode(struct inode *inode); ++#endif ++ + static void yaffs_delete_inode(struct inode *); + static void yaffs_clear_inode(struct inode *); + + static int yaffs_readpage(struct file *file, struct page *page); +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + static int yaffs_writepage(struct page *page, struct writeback_control *wbc); + #else + static int yaffs_writepage(struct page *page); + #endif ++ ++ ++#if (YAFFS_USE_WRITE_BEGIN_END != 0) ++static int yaffs_write_begin(struct file *filp, struct address_space *mapping, ++ loff_t pos, unsigned len, unsigned flags, ++ struct page **pagep, void **fsdata); ++static int yaffs_write_end(struct file *filp, struct address_space *mapping, ++ loff_t pos, unsigned len, unsigned copied, ++ struct page *pg, void *fsdadata); ++#else + static int yaffs_prepare_write(struct file *f, struct page *pg, +- unsigned offset, unsigned to); ++ unsigned offset, unsigned to); + static int yaffs_commit_write(struct file *f, struct page *pg, unsigned offset, +- unsigned to); ++ unsigned to); + +-static int yaffs_readlink(struct dentry *dentry, char __user * buffer, +- int buflen); +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)) ++#endif ++ ++static int yaffs_readlink(struct dentry *dentry, char __user *buffer, ++ int buflen); ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 13)) + static void *yaffs_follow_link(struct dentry *dentry, struct nameidata *nd); + #else + static int yaffs_follow_link(struct dentry *dentry, struct nameidata *nd); +@@ -209,12 +265,17 @@ static int yaffs_follow_link(struct dent + static struct address_space_operations yaffs_file_address_operations = { + .readpage = yaffs_readpage, + .writepage = yaffs_writepage, ++#if (YAFFS_USE_WRITE_BEGIN_END > 0) ++ .write_begin = yaffs_write_begin, ++ .write_end = yaffs_write_end, ++#else + .prepare_write = yaffs_prepare_write, + .commit_write = yaffs_commit_write, ++#endif + }; + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,22)) +-static struct file_operations yaffs_file_operations = { ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22)) ++static const struct file_operations yaffs_file_operations = { + .read = do_sync_read, + .write = do_sync_write, + .aio_read = generic_file_aio_read, +@@ -224,11 +285,12 @@ static struct file_operations yaffs_file + .fsync = yaffs_sync_object, + .splice_read = generic_file_splice_read, + .splice_write = generic_file_splice_write, ++ .llseek = generic_file_llseek, + }; + +-#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)) ++#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 18)) + +-static struct file_operations yaffs_file_operations = { ++static const struct file_operations yaffs_file_operations = { + .read = do_sync_read, + .write = do_sync_write, + .aio_read = generic_file_aio_read, +@@ -241,29 +303,29 @@ static struct file_operations yaffs_file + + #else + +-static struct file_operations yaffs_file_operations = { ++static const struct file_operations yaffs_file_operations = { + .read = generic_file_read, + .write = generic_file_write, + .mmap = generic_file_mmap, + .flush = yaffs_file_flush, + .fsync = yaffs_sync_object, +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + .sendfile = generic_file_sendfile, + #endif + }; + #endif + +-static struct inode_operations yaffs_file_inode_operations = { ++static const struct inode_operations yaffs_file_inode_operations = { + .setattr = yaffs_setattr, + }; + +-static struct inode_operations yaffs_symlink_inode_operations = { ++static const struct inode_operations yaffs_symlink_inode_operations = { + .readlink = yaffs_readlink, + .follow_link = yaffs_follow_link, + .setattr = yaffs_setattr, + }; + +-static struct inode_operations yaffs_dir_inode_operations = { ++static const struct inode_operations yaffs_dir_inode_operations = { + .create = yaffs_create, + .lookup = yaffs_lookup, + .link = yaffs_link, +@@ -276,16 +338,21 @@ static struct inode_operations yaffs_dir + .setattr = yaffs_setattr, + }; + +-static struct file_operations yaffs_dir_operations = { ++static const struct file_operations yaffs_dir_operations = { + .read = generic_read_dir, + .readdir = yaffs_readdir, + .fsync = yaffs_sync_object, + }; + +-static struct super_operations yaffs_super_ops = { ++static const struct super_operations yaffs_super_ops = { + .statfs = yaffs_statfs, ++ ++#ifndef YAFFS_USE_OWN_IGET + .read_inode = yaffs_read_inode, ++#endif ++#ifdef YAFFS_HAS_PUT_INODE + .put_inode = yaffs_put_inode, ++#endif + .put_super = yaffs_put_super, + .delete_inode = yaffs_delete_inode, + .clear_inode = yaffs_clear_inode, +@@ -293,22 +360,21 @@ static struct super_operations yaffs_sup + .write_super = yaffs_write_super, + }; + +-static void yaffs_GrossLock(yaffs_Device * dev) ++static void yaffs_GrossLock(yaffs_Device *dev) + { +- T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs locking\n")); +- ++ T(YAFFS_TRACE_OS, ("yaffs locking %p\n", current)); + down(&dev->grossLock); ++ T(YAFFS_TRACE_OS, ("yaffs locked %p\n", current)); + } + +-static void yaffs_GrossUnlock(yaffs_Device * dev) ++static void yaffs_GrossUnlock(yaffs_Device *dev) + { +- T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs unlocking\n")); ++ T(YAFFS_TRACE_OS, ("yaffs unlocking %p\n", current)); + up(&dev->grossLock); +- + } + +-static int yaffs_readlink(struct dentry *dentry, char __user * buffer, +- int buflen) ++static int yaffs_readlink(struct dentry *dentry, char __user *buffer, ++ int buflen) + { + unsigned char *alias; + int ret; +@@ -329,7 +395,7 @@ static int yaffs_readlink(struct dentry + return ret; + } + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 13)) + static void *yaffs_follow_link(struct dentry *dentry, struct nameidata *nd) + #else + static int yaffs_follow_link(struct dentry *dentry, struct nameidata *nd) +@@ -345,32 +411,31 @@ static int yaffs_follow_link(struct dent + + yaffs_GrossUnlock(dev); + +- if (!alias) +- { ++ if (!alias) { + ret = -ENOMEM; + goto out; +- } ++ } + + ret = vfs_follow_link(nd, alias); + kfree(alias); + out: +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)) +- return ERR_PTR (ret); ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 13)) ++ return ERR_PTR(ret); + #else + return ret; + #endif + } + + struct inode *yaffs_get_inode(struct super_block *sb, int mode, int dev, +- yaffs_Object * obj); ++ yaffs_Object *obj); + + /* + * Lookup is used to find objects in the fs + */ +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + + static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry, +- struct nameidata *n) ++ struct nameidata *n) + #else + static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry) + #endif +@@ -383,12 +448,11 @@ static struct dentry *yaffs_lookup(struc + yaffs_GrossLock(dev); + + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_lookup for %d:%s\n", +- yaffs_InodeToObject(dir)->objectId, dentry->d_name.name)); ++ ("yaffs_lookup for %d:%s\n", ++ yaffs_InodeToObject(dir)->objectId, dentry->d_name.name)); + +- obj = +- yaffs_FindObjectByName(yaffs_InodeToObject(dir), +- dentry->d_name.name); ++ obj = yaffs_FindObjectByName(yaffs_InodeToObject(dir), ++ dentry->d_name.name); + + obj = yaffs_GetEquivalentObject(obj); /* in case it was a hardlink */ + +@@ -397,13 +461,13 @@ static struct dentry *yaffs_lookup(struc + + if (obj) { + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_lookup found %d\n", obj->objectId)); ++ ("yaffs_lookup found %d\n", obj->objectId)); + + inode = yaffs_get_inode(dir->i_sb, obj->yst_mode, 0, obj); + + if (inode) { + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_loookup dentry \n")); ++ ("yaffs_loookup dentry \n")); + /* #if 0 asserted by NCB for 2.5/6 compatability - falls through to + * d_add even if NULL inode */ + #if 0 +@@ -416,7 +480,7 @@ static struct dentry *yaffs_lookup(struc + } + + } else { +- T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_lookup not found\n")); ++ T(YAFFS_TRACE_OS, ("yaffs_lookup not found\n")); + + } + +@@ -425,20 +489,22 @@ static struct dentry *yaffs_lookup(struc + d_add(dentry, inode); + + return NULL; +- /* return (ERR_PTR(-EIO)); */ +- + } + ++ ++#ifdef YAFFS_HAS_PUT_INODE ++ + /* For now put inode is just for debugging + * Put inode is called when the inode **structure** is put. + */ + static void yaffs_put_inode(struct inode *inode) + { + T(YAFFS_TRACE_OS, +- ("yaffs_put_inode: ino %d, count %d\n", (int)inode->i_ino, +- atomic_read(&inode->i_count))); ++ ("yaffs_put_inode: ino %d, count %d\n", (int)inode->i_ino, ++ atomic_read(&inode->i_count))); + + } ++#endif + + /* clear is called to tell the fs to release any per-inode data it holds */ + static void yaffs_clear_inode(struct inode *inode) +@@ -449,9 +515,9 @@ static void yaffs_clear_inode(struct ino + obj = yaffs_InodeToObject(inode); + + T(YAFFS_TRACE_OS, +- ("yaffs_clear_inode: ino %d, count %d %s\n", (int)inode->i_ino, +- atomic_read(&inode->i_count), +- obj ? "object exists" : "null object")); ++ ("yaffs_clear_inode: ino %d, count %d %s\n", (int)inode->i_ino, ++ atomic_read(&inode->i_count), ++ obj ? "object exists" : "null object")); + + if (obj) { + dev = obj->myDev; +@@ -486,23 +552,23 @@ static void yaffs_delete_inode(struct in + yaffs_Device *dev; + + T(YAFFS_TRACE_OS, +- ("yaffs_delete_inode: ino %d, count %d %s\n", (int)inode->i_ino, +- atomic_read(&inode->i_count), +- obj ? "object exists" : "null object")); ++ ("yaffs_delete_inode: ino %d, count %d %s\n", (int)inode->i_ino, ++ atomic_read(&inode->i_count), ++ obj ? "object exists" : "null object")); + + if (obj) { + dev = obj->myDev; + yaffs_GrossLock(dev); +- yaffs_DeleteFile(obj); ++ yaffs_DeleteObject(obj); + yaffs_GrossUnlock(dev); + } +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)) +- truncate_inode_pages (&inode->i_data, 0); ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 13)) ++ truncate_inode_pages(&inode->i_data, 0); + #endif + clear_inode(inode); + } + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) + static int yaffs_file_flush(struct file *file, fl_owner_t id) + #else + static int yaffs_file_flush(struct file *file) +@@ -513,8 +579,8 @@ static int yaffs_file_flush(struct file + yaffs_Device *dev = obj->myDev; + + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_file_flush object %d (%s)\n", obj->objectId, +- obj->dirty ? "dirty" : "clean")); ++ ("yaffs_file_flush object %d (%s)\n", obj->objectId, ++ obj->dirty ? "dirty" : "clean")); + + yaffs_GrossLock(dev); + +@@ -535,15 +601,15 @@ static int yaffs_readpage_nolock(struct + + yaffs_Device *dev; + +- T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_readpage at %08x, size %08x\n", +- (unsigned)(pg->index << PAGE_CACHE_SHIFT), +- (unsigned)PAGE_CACHE_SIZE)); ++ T(YAFFS_TRACE_OS, ("yaffs_readpage at %08x, size %08x\n", ++ (unsigned)(pg->index << PAGE_CACHE_SHIFT), ++ (unsigned)PAGE_CACHE_SIZE)); + + obj = yaffs_DentryToObject(f->f_dentry); + + dev = obj->myDev; + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + BUG_ON(!PageLocked(pg)); + #else + if (!PageLocked(pg)) +@@ -555,9 +621,9 @@ static int yaffs_readpage_nolock(struct + + yaffs_GrossLock(dev); + +- ret = +- yaffs_ReadDataFromFile(obj, pg_buf, pg->index << PAGE_CACHE_SHIFT, +- PAGE_CACHE_SIZE); ++ ret = yaffs_ReadDataFromFile(obj, pg_buf, ++ pg->index << PAGE_CACHE_SHIFT, ++ PAGE_CACHE_SIZE); + + yaffs_GrossUnlock(dev); + +@@ -575,7 +641,7 @@ static int yaffs_readpage_nolock(struct + flush_dcache_page(pg); + kunmap(pg); + +- T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_readpage done\n")); ++ T(YAFFS_TRACE_OS, ("yaffs_readpage done\n")); + return ret; + } + +@@ -593,7 +659,7 @@ static int yaffs_readpage(struct file *f + + /* writepage inspired by/stolen from smbfs */ + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + static int yaffs_writepage(struct page *page, struct writeback_control *wbc) + #else + static int yaffs_writepage(struct page *page) +@@ -616,12 +682,11 @@ static int yaffs_writepage(struct page * + + if (offset > inode->i_size) { + T(YAFFS_TRACE_OS, +- (KERN_DEBUG +- "yaffs_writepage at %08x, inode size = %08x!!!\n", +- (unsigned)(page->index << PAGE_CACHE_SHIFT), +- (unsigned)inode->i_size)); ++ ("yaffs_writepage at %08x, inode size = %08x!!!\n", ++ (unsigned)(page->index << PAGE_CACHE_SHIFT), ++ (unsigned)inode->i_size)); + T(YAFFS_TRACE_OS, +- (KERN_DEBUG " -> don't care!!\n")); ++ (" -> don't care!!\n")); + unlock_page(page); + return 0; + } +@@ -629,11 +694,10 @@ static int yaffs_writepage(struct page * + end_index = inode->i_size >> PAGE_CACHE_SHIFT; + + /* easy case */ +- if (page->index < end_index) { ++ if (page->index < end_index) + nBytes = PAGE_CACHE_SIZE; +- } else { ++ else + nBytes = inode->i_size & (PAGE_CACHE_SIZE - 1); +- } + + get_page(page); + +@@ -643,19 +707,18 @@ static int yaffs_writepage(struct page * + yaffs_GrossLock(obj->myDev); + + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_writepage at %08x, size %08x\n", +- (unsigned)(page->index << PAGE_CACHE_SHIFT), nBytes)); ++ ("yaffs_writepage at %08x, size %08x\n", ++ (unsigned)(page->index << PAGE_CACHE_SHIFT), nBytes)); + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "writepag0: obj = %05x, ino = %05x\n", +- (int)obj->variant.fileVariant.fileSize, (int)inode->i_size)); ++ ("writepag0: obj = %05x, ino = %05x\n", ++ (int)obj->variant.fileVariant.fileSize, (int)inode->i_size)); + +- nWritten = +- yaffs_WriteDataToFile(obj, buffer, page->index << PAGE_CACHE_SHIFT, +- nBytes, 0); ++ nWritten = yaffs_WriteDataToFile(obj, buffer, ++ page->index << PAGE_CACHE_SHIFT, nBytes, 0); + + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "writepag1: obj = %05x, ino = %05x\n", +- (int)obj->variant.fileVariant.fileSize, (int)inode->i_size)); ++ ("writepag1: obj = %05x, ino = %05x\n", ++ (int)obj->variant.fileVariant.fileSize, (int)inode->i_size)); + + yaffs_GrossUnlock(obj->myDev); + +@@ -667,100 +730,207 @@ static int yaffs_writepage(struct page * + return (nWritten == nBytes) ? 0 : -ENOSPC; + } + ++ ++#if (YAFFS_USE_WRITE_BEGIN_END > 0) ++static int yaffs_write_begin(struct file *filp, struct address_space *mapping, ++ loff_t pos, unsigned len, unsigned flags, ++ struct page **pagep, void **fsdata) ++{ ++ struct page *pg = NULL; ++ pgoff_t index = pos >> PAGE_CACHE_SHIFT; ++ uint32_t offset = pos & (PAGE_CACHE_SIZE - 1); ++ uint32_t to = offset + len; ++ ++ int ret = 0; ++ int space_held = 0; ++ ++ T(YAFFS_TRACE_OS, ("start yaffs_write_begin\n")); ++ /* Get a page */ ++#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 28) ++ pg = grab_cache_page_write_begin(mapping, index, flags); ++#else ++ pg = __grab_cache_page(mapping, index); ++#endif ++ ++ *pagep = pg; ++ if (!pg) { ++ ret = -ENOMEM; ++ goto out; ++ } ++ /* Get fs space */ ++ space_held = yaffs_hold_space(filp); ++ ++ if (!space_held) { ++ ret = -ENOSPC; ++ goto out; ++ } ++ ++ /* Update page if required */ ++ ++ if (!Page_Uptodate(pg) && (offset || to < PAGE_CACHE_SIZE)) ++ ret = yaffs_readpage_nolock(filp, pg); ++ ++ if (ret) ++ goto out; ++ ++ /* Happy path return */ ++ T(YAFFS_TRACE_OS, ("end yaffs_write_begin - ok\n")); ++ ++ return 0; ++ ++out: ++ T(YAFFS_TRACE_OS, ("end yaffs_write_begin fail returning %d\n", ret)); ++ if (space_held) ++ yaffs_release_space(filp); ++ if (pg) { ++ unlock_page(pg); ++ page_cache_release(pg); ++ } ++ return ret; ++} ++ ++#else ++ + static int yaffs_prepare_write(struct file *f, struct page *pg, +- unsigned offset, unsigned to) ++ unsigned offset, unsigned to) + { ++ T(YAFFS_TRACE_OS, ("yaffs_prepair_write\n")); + +- T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_prepair_write\n")); + if (!Page_Uptodate(pg) && (offset || to < PAGE_CACHE_SIZE)) + return yaffs_readpage_nolock(f, pg); +- + return 0; ++} ++#endif ++ ++#if (YAFFS_USE_WRITE_BEGIN_END > 0) ++static int yaffs_write_end(struct file *filp, struct address_space *mapping, ++ loff_t pos, unsigned len, unsigned copied, ++ struct page *pg, void *fsdadata) ++{ ++ int ret = 0; ++ void *addr, *kva; ++ uint32_t offset_into_page = pos & (PAGE_CACHE_SIZE - 1); ++ ++ kva = kmap(pg); ++ addr = kva + offset_into_page; ++ ++ T(YAFFS_TRACE_OS, ++ ("yaffs_write_end addr %x pos %x nBytes %d\n", ++ (unsigned) addr, ++ (int)pos, copied)); ++ ++ ret = yaffs_file_write(filp, addr, copied, &pos); ++ ++ if (ret != copied) { ++ T(YAFFS_TRACE_OS, ++ ("yaffs_write_end not same size ret %d copied %d\n", ++ ret, copied)); ++ SetPageError(pg); ++ ClearPageUptodate(pg); ++ } else { ++ SetPageUptodate(pg); ++ } ++ ++ kunmap(pg); + ++ yaffs_release_space(filp); ++ unlock_page(pg); ++ page_cache_release(pg); ++ return ret; + } ++#else + + static int yaffs_commit_write(struct file *f, struct page *pg, unsigned offset, +- unsigned to) ++ unsigned to) + { ++ void *addr, *kva; + +- void *addr = page_address(pg) + offset; + loff_t pos = (((loff_t) pg->index) << PAGE_CACHE_SHIFT) + offset; + int nBytes = to - offset; + int nWritten; + + unsigned spos = pos; +- unsigned saddr = (unsigned)addr; ++ unsigned saddr; ++ ++ kva = kmap(pg); ++ addr = kva + offset; ++ ++ saddr = (unsigned) addr; + + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_commit_write addr %x pos %x nBytes %d\n", saddr, +- spos, nBytes)); ++ ("yaffs_commit_write addr %x pos %x nBytes %d\n", ++ saddr, spos, nBytes)); + + nWritten = yaffs_file_write(f, addr, nBytes, &pos); + + if (nWritten != nBytes) { + T(YAFFS_TRACE_OS, +- (KERN_DEBUG +- "yaffs_commit_write not same size nWritten %d nBytes %d\n", +- nWritten, nBytes)); ++ ("yaffs_commit_write not same size nWritten %d nBytes %d\n", ++ nWritten, nBytes)); + SetPageError(pg); + ClearPageUptodate(pg); + } else { + SetPageUptodate(pg); + } + ++ kunmap(pg); ++ + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_commit_write returning %d\n", +- nWritten == nBytes ? 0 : nWritten)); ++ ("yaffs_commit_write returning %d\n", ++ nWritten == nBytes ? 0 : nWritten)); + + return nWritten == nBytes ? 0 : nWritten; +- + } ++#endif ++ + +-static void yaffs_FillInodeFromObject(struct inode *inode, yaffs_Object * obj) ++static void yaffs_FillInodeFromObject(struct inode *inode, yaffs_Object *obj) + { + if (inode && obj) { + + + /* Check mode against the variant type and attempt to repair if broken. */ +- __u32 mode = obj->yst_mode; +- switch( obj->variantType ){ +- case YAFFS_OBJECT_TYPE_FILE : +- if( ! S_ISREG(mode) ){ +- obj->yst_mode &= ~S_IFMT; +- obj->yst_mode |= S_IFREG; +- } +- +- break; +- case YAFFS_OBJECT_TYPE_SYMLINK : +- if( ! S_ISLNK(mode) ){ +- obj->yst_mode &= ~S_IFMT; +- obj->yst_mode |= S_IFLNK; +- } +- +- break; +- case YAFFS_OBJECT_TYPE_DIRECTORY : +- if( ! S_ISDIR(mode) ){ +- obj->yst_mode &= ~S_IFMT; +- obj->yst_mode |= S_IFDIR; +- } +- +- break; +- case YAFFS_OBJECT_TYPE_UNKNOWN : +- case YAFFS_OBJECT_TYPE_HARDLINK : +- case YAFFS_OBJECT_TYPE_SPECIAL : +- default: +- /* TODO? */ +- break; +- } ++ __u32 mode = obj->yst_mode; ++ switch (obj->variantType) { ++ case YAFFS_OBJECT_TYPE_FILE: ++ if (!S_ISREG(mode)) { ++ obj->yst_mode &= ~S_IFMT; ++ obj->yst_mode |= S_IFREG; ++ } ++ ++ break; ++ case YAFFS_OBJECT_TYPE_SYMLINK: ++ if (!S_ISLNK(mode)) { ++ obj->yst_mode &= ~S_IFMT; ++ obj->yst_mode |= S_IFLNK; ++ } ++ ++ break; ++ case YAFFS_OBJECT_TYPE_DIRECTORY: ++ if (!S_ISDIR(mode)) { ++ obj->yst_mode &= ~S_IFMT; ++ obj->yst_mode |= S_IFDIR; ++ } ++ ++ break; ++ case YAFFS_OBJECT_TYPE_UNKNOWN: ++ case YAFFS_OBJECT_TYPE_HARDLINK: ++ case YAFFS_OBJECT_TYPE_SPECIAL: ++ default: ++ /* TODO? */ ++ break; ++ } ++ ++ inode->i_flags |= S_NOATIME; + + inode->i_ino = obj->objectId; + inode->i_mode = obj->yst_mode; + inode->i_uid = obj->yst_uid; + inode->i_gid = obj->yst_gid; +-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)) + inode->i_blksize = inode->i_sb->s_blocksize; + #endif +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + + inode->i_rdev = old_decode_dev(obj->yst_rdev); + inode->i_atime.tv_sec = (time_t) (obj->yst_atime); +@@ -781,26 +951,25 @@ static void yaffs_FillInodeFromObject(st + inode->i_nlink = yaffs_GetObjectLinkCount(obj); + + T(YAFFS_TRACE_OS, +- (KERN_DEBUG +- "yaffs_FillInode mode %x uid %d gid %d size %d count %d\n", +- inode->i_mode, inode->i_uid, inode->i_gid, +- (int)inode->i_size, atomic_read(&inode->i_count))); ++ ("yaffs_FillInode mode %x uid %d gid %d size %d count %d\n", ++ inode->i_mode, inode->i_uid, inode->i_gid, ++ (int)inode->i_size, atomic_read(&inode->i_count))); + + switch (obj->yst_mode & S_IFMT) { + default: /* fifo, device or socket */ +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + init_special_inode(inode, obj->yst_mode, +- old_decode_dev(obj->yst_rdev)); ++ old_decode_dev(obj->yst_rdev)); + #else + init_special_inode(inode, obj->yst_mode, +- (dev_t) (obj->yst_rdev)); ++ (dev_t) (obj->yst_rdev)); + #endif + break; + case S_IFREG: /* file */ + inode->i_op = &yaffs_file_inode_operations; + inode->i_fop = &yaffs_file_operations; + inode->i_mapping->a_ops = +- &yaffs_file_address_operations; ++ &yaffs_file_address_operations; + break; + case S_IFDIR: /* directory */ + inode->i_op = &yaffs_dir_inode_operations; +@@ -817,34 +986,36 @@ static void yaffs_FillInodeFromObject(st + + } else { + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_FileInode invalid parameters\n")); ++ ("yaffs_FileInode invalid parameters\n")); + } + + } + + struct inode *yaffs_get_inode(struct super_block *sb, int mode, int dev, +- yaffs_Object * obj) ++ yaffs_Object *obj) + { + struct inode *inode; + + if (!sb) { + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_get_inode for NULL super_block!!\n")); ++ ("yaffs_get_inode for NULL super_block!!\n")); + return NULL; + + } + + if (!obj) { + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_get_inode for NULL object!!\n")); ++ ("yaffs_get_inode for NULL object!!\n")); + return NULL; + + } + + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_get_inode for object %d\n", obj->objectId)); ++ ("yaffs_get_inode for object %d\n", obj->objectId)); + +- inode = iget(sb, obj->objectId); ++ inode = Y_IGET(sb, obj->objectId); ++ if (IS_ERR(inode)) ++ return NULL; + + /* NB Side effect: iget calls back to yaffs_read_inode(). */ + /* iget also increments the inode's i_count */ +@@ -854,7 +1025,7 @@ struct inode *yaffs_get_inode(struct sup + } + + static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n, +- loff_t * pos) ++ loff_t *pos) + { + yaffs_Object *obj; + int nWritten, ipos; +@@ -869,28 +1040,26 @@ static ssize_t yaffs_file_write(struct f + + inode = f->f_dentry->d_inode; + +- if (!S_ISBLK(inode->i_mode) && f->f_flags & O_APPEND) { ++ if (!S_ISBLK(inode->i_mode) && f->f_flags & O_APPEND) + ipos = inode->i_size; +- } else { ++ else + ipos = *pos; +- } + +- if (!obj) { ++ if (!obj) + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_file_write: hey obj is null!\n")); +- } else { ++ ("yaffs_file_write: hey obj is null!\n")); ++ else + T(YAFFS_TRACE_OS, +- (KERN_DEBUG +- "yaffs_file_write about to write writing %d bytes" +- "to object %d at %d\n", +- n, obj->objectId, ipos)); +- } ++ ("yaffs_file_write about to write writing %zu bytes" ++ "to object %d at %d\n", ++ n, obj->objectId, ipos)); + + nWritten = yaffs_WriteDataToFile(obj, buf, ipos, n, 0); + + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_file_write writing %d bytes, %d written at %d\n", +- n, nWritten, ipos)); ++ ("yaffs_file_write writing %zu bytes, %d written at %d\n", ++ n, nWritten, ipos)); ++ + if (nWritten > 0) { + ipos += nWritten; + *pos = ipos; +@@ -899,10 +1068,9 @@ static ssize_t yaffs_file_write(struct f + inode->i_blocks = (ipos + 511) >> 9; + + T(YAFFS_TRACE_OS, +- (KERN_DEBUG +- "yaffs_file_write size updated to %d bytes, " +- "%d blocks\n", +- ipos, (int)(inode->i_blocks))); ++ ("yaffs_file_write size updated to %d bytes, " ++ "%d blocks\n", ++ ipos, (int)(inode->i_blocks))); + } + + } +@@ -910,13 +1078,54 @@ static ssize_t yaffs_file_write(struct f + return nWritten == 0 ? -ENOSPC : nWritten; + } + ++/* Space holding and freeing is done to ensure we have space available for write_begin/end */ ++/* For now we just assume few parallel writes and check against a small number. */ ++/* Todo: need to do this with a counter to handle parallel reads better */ ++ ++static ssize_t yaffs_hold_space(struct file *f) ++{ ++ yaffs_Object *obj; ++ yaffs_Device *dev; ++ ++ int nFreeChunks; ++ ++ ++ obj = yaffs_DentryToObject(f->f_dentry); ++ ++ dev = obj->myDev; ++ ++ yaffs_GrossLock(dev); ++ ++ nFreeChunks = yaffs_GetNumberOfFreeChunks(dev); ++ ++ yaffs_GrossUnlock(dev); ++ ++ return (nFreeChunks > 20) ? 1 : 0; ++} ++ ++static void yaffs_release_space(struct file *f) ++{ ++ yaffs_Object *obj; ++ yaffs_Device *dev; ++ ++ ++ obj = yaffs_DentryToObject(f->f_dentry); ++ ++ dev = obj->myDev; ++ ++ yaffs_GrossLock(dev); ++ ++ ++ yaffs_GrossUnlock(dev); ++} ++ + static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir) + { + yaffs_Object *obj; + yaffs_Device *dev; + struct inode *inode = f->f_dentry->d_inode; + unsigned long offset, curoffs; +- struct list_head *i; ++ struct ylist_head *i; + yaffs_Object *l; + + char name[YAFFS_MAX_NAME_LENGTH + 1]; +@@ -932,24 +1141,20 @@ static int yaffs_readdir(struct file *f, + + if (offset == 0) { + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_readdir: entry . ino %d \n", +- (int)inode->i_ino)); +- if (filldir(dirent, ".", 1, offset, inode->i_ino, DT_DIR) +- < 0) { ++ ("yaffs_readdir: entry . ino %d \n", ++ (int)inode->i_ino)); ++ if (filldir(dirent, ".", 1, offset, inode->i_ino, DT_DIR) < 0) + goto out; +- } + offset++; + f->f_pos++; + } + if (offset == 1) { + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_readdir: entry .. ino %d \n", +- (int)f->f_dentry->d_parent->d_inode->i_ino)); +- if (filldir +- (dirent, "..", 2, offset, +- f->f_dentry->d_parent->d_inode->i_ino, DT_DIR) < 0) { ++ ("yaffs_readdir: entry .. ino %d \n", ++ (int)f->f_dentry->d_parent->d_inode->i_ino)); ++ if (filldir(dirent, "..", 2, offset, ++ f->f_dentry->d_parent->d_inode->i_ino, DT_DIR) < 0) + goto out; +- } + offset++; + f->f_pos++; + } +@@ -965,35 +1170,32 @@ static int yaffs_readdir(struct file *f, + f->f_version = inode->i_version; + } + +- list_for_each(i, &obj->variant.directoryVariant.children) { ++ ylist_for_each(i, &obj->variant.directoryVariant.children) { + curoffs++; + if (curoffs >= offset) { +- l = list_entry(i, yaffs_Object, siblings); ++ l = ylist_entry(i, yaffs_Object, siblings); + + yaffs_GetObjectName(l, name, + YAFFS_MAX_NAME_LENGTH + 1); + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_readdir: %s inode %d\n", name, ++ ("yaffs_readdir: %s inode %d\n", name, + yaffs_GetObjectInode(l))); + + if (filldir(dirent, +- name, +- strlen(name), +- offset, +- yaffs_GetObjectInode(l), +- yaffs_GetObjectType(l)) +- < 0) { ++ name, ++ strlen(name), ++ offset, ++ yaffs_GetObjectInode(l), ++ yaffs_GetObjectType(l)) < 0) + goto up_and_out; +- } + + offset++; + f->f_pos++; + } + } + +- up_and_out: +- out: +- ++up_and_out: ++out: + yaffs_GrossUnlock(dev); + + return 0; +@@ -1002,12 +1204,19 @@ static int yaffs_readdir(struct file *f, + /* + * File creation. Allocate an inode, and we're done.. + */ +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) ++#define YCRED(x) x ++#else ++#define YCRED(x) (x->cred) ++#endif ++ ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode, +- dev_t rdev) ++ dev_t rdev) + #else + static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode, +- int rdev) ++ int rdev) + #endif + { + struct inode *inode; +@@ -1018,25 +1227,25 @@ static int yaffs_mknod(struct inode *dir + yaffs_Object *parent = yaffs_InodeToObject(dir); + + int error = -ENOSPC; +- uid_t uid = current->fsuid; +- gid_t gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid; ++ uid_t uid = YCRED(current)->fsuid; ++ gid_t gid = (dir->i_mode & S_ISGID) ? dir->i_gid : YCRED(current)->fsgid; + +- if((dir->i_mode & S_ISGID) && S_ISDIR(mode)) ++ if ((dir->i_mode & S_ISGID) && S_ISDIR(mode)) + mode |= S_ISGID; + + if (parent) { + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_mknod: parent object %d type %d\n", +- parent->objectId, parent->variantType)); ++ ("yaffs_mknod: parent object %d type %d\n", ++ parent->objectId, parent->variantType)); + } else { + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_mknod: could not get parent object\n")); ++ ("yaffs_mknod: could not get parent object\n")); + return -EPERM; + } + + T(YAFFS_TRACE_OS, ("yaffs_mknod: making oject for %s, " +- "mode %x dev %x\n", +- dentry->d_name.name, mode, rdev)); ++ "mode %x dev %x\n", ++ dentry->d_name.name, mode, rdev)); + + dev = parent->myDev; + +@@ -1045,33 +1254,28 @@ static int yaffs_mknod(struct inode *dir + switch (mode & S_IFMT) { + default: + /* Special (socket, fifo, device...) */ +- T(YAFFS_TRACE_OS, (KERN_DEBUG +- "yaffs_mknod: making special\n")); +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) +- obj = +- yaffs_MknodSpecial(parent, dentry->d_name.name, mode, uid, +- gid, old_encode_dev(rdev)); +-#else +- obj = +- yaffs_MknodSpecial(parent, dentry->d_name.name, mode, uid, +- gid, rdev); ++ T(YAFFS_TRACE_OS, ("yaffs_mknod: making special\n")); ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) ++ obj = yaffs_MknodSpecial(parent, dentry->d_name.name, mode, uid, ++ gid, old_encode_dev(rdev)); ++#else ++ obj = yaffs_MknodSpecial(parent, dentry->d_name.name, mode, uid, ++ gid, rdev); + #endif + break; + case S_IFREG: /* file */ +- T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_mknod: making file\n")); +- obj = +- yaffs_MknodFile(parent, dentry->d_name.name, mode, uid, +- gid); ++ T(YAFFS_TRACE_OS, ("yaffs_mknod: making file\n")); ++ obj = yaffs_MknodFile(parent, dentry->d_name.name, mode, uid, ++ gid); + break; + case S_IFDIR: /* directory */ + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_mknod: making directory\n")); +- obj = +- yaffs_MknodDirectory(parent, dentry->d_name.name, mode, +- uid, gid); ++ ("yaffs_mknod: making directory\n")); ++ obj = yaffs_MknodDirectory(parent, dentry->d_name.name, mode, ++ uid, gid); + break; + case S_IFLNK: /* symlink */ +- T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_mknod: making file\n")); ++ T(YAFFS_TRACE_OS, ("yaffs_mknod: making symlink\n")); + obj = NULL; /* Do we ever get here? */ + break; + } +@@ -1083,12 +1287,12 @@ static int yaffs_mknod(struct inode *dir + inode = yaffs_get_inode(dir->i_sb, mode, rdev, obj); + d_instantiate(dentry, inode); + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_mknod created object %d count = %d\n", +- obj->objectId, atomic_read(&inode->i_count))); ++ ("yaffs_mknod created object %d count = %d\n", ++ obj->objectId, atomic_read(&inode->i_count))); + error = 0; + } else { + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_mknod failed making object\n")); ++ ("yaffs_mknod failed making object\n")); + error = -ENOMEM; + } + +@@ -1098,25 +1302,19 @@ static int yaffs_mknod(struct inode *dir + static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, int mode) + { + int retVal; +- T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_mkdir\n")); ++ T(YAFFS_TRACE_OS, ("yaffs_mkdir\n")); + retVal = yaffs_mknod(dir, dentry, mode | S_IFDIR, 0); +-#if 0 +- /* attempt to fix dir bug - didn't work */ +- if (!retVal) { +- dget(dentry); +- } +-#endif + return retVal; + } + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode, + struct nameidata *n) + #else + static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode) + #endif + { +- T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_create\n")); ++ T(YAFFS_TRACE_OS, ("yaffs_create\n")); + return yaffs_mknod(dir, dentry, mode | S_IFREG, 0); + } + +@@ -1127,8 +1325,8 @@ static int yaffs_unlink(struct inode *di + yaffs_Device *dev; + + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_unlink %d:%s\n", (int)(dir->i_ino), +- dentry->d_name.name)); ++ ("yaffs_unlink %d:%s\n", (int)(dir->i_ino), ++ dentry->d_name.name)); + + dev = yaffs_InodeToObject(dir)->myDev; + +@@ -1151,82 +1349,74 @@ static int yaffs_unlink(struct inode *di + * Create a link... + */ + static int yaffs_link(struct dentry *old_dentry, struct inode *dir, +- struct dentry *dentry) ++ struct dentry *dentry) + { + struct inode *inode = old_dentry->d_inode; + yaffs_Object *obj = NULL; + yaffs_Object *link = NULL; + yaffs_Device *dev; + +- T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_link\n")); ++ T(YAFFS_TRACE_OS, ("yaffs_link\n")); + + obj = yaffs_InodeToObject(inode); + dev = obj->myDev; + + yaffs_GrossLock(dev); + +- if (!S_ISDIR(inode->i_mode)) /* Don't link directories */ +- { +- link = +- yaffs_Link(yaffs_InodeToObject(dir), dentry->d_name.name, +- obj); +- } ++ if (!S_ISDIR(inode->i_mode)) /* Don't link directories */ ++ link = yaffs_Link(yaffs_InodeToObject(dir), dentry->d_name.name, ++ obj); + + if (link) { + old_dentry->d_inode->i_nlink = yaffs_GetObjectLinkCount(obj); + d_instantiate(dentry, old_dentry->d_inode); + atomic_inc(&old_dentry->d_inode->i_count); + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_link link count %d i_count %d\n", +- old_dentry->d_inode->i_nlink, +- atomic_read(&old_dentry->d_inode->i_count))); +- ++ ("yaffs_link link count %d i_count %d\n", ++ old_dentry->d_inode->i_nlink, ++ atomic_read(&old_dentry->d_inode->i_count))); + } + + yaffs_GrossUnlock(dev); + +- if (link) { +- ++ if (link) + return 0; +- } + + return -EPERM; + } + + static int yaffs_symlink(struct inode *dir, struct dentry *dentry, +- const char *symname) ++ const char *symname) + { + yaffs_Object *obj; + yaffs_Device *dev; +- uid_t uid = current->fsuid; +- gid_t gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid; ++ uid_t uid = YCRED(current)->fsuid; ++ gid_t gid = (dir->i_mode & S_ISGID) ? dir->i_gid : YCRED(current)->fsgid; + +- T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_symlink\n")); ++ T(YAFFS_TRACE_OS, ("yaffs_symlink\n")); + + dev = yaffs_InodeToObject(dir)->myDev; + yaffs_GrossLock(dev); + obj = yaffs_MknodSymLink(yaffs_InodeToObject(dir), dentry->d_name.name, +- S_IFLNK | S_IRWXUGO, uid, gid, symname); ++ S_IFLNK | S_IRWXUGO, uid, gid, symname); + yaffs_GrossUnlock(dev); + + if (obj) { +- + struct inode *inode; + + inode = yaffs_get_inode(dir->i_sb, obj->yst_mode, 0, obj); + d_instantiate(dentry, inode); +- T(YAFFS_TRACE_OS, (KERN_DEBUG "symlink created OK\n")); ++ T(YAFFS_TRACE_OS, ("symlink created OK\n")); + return 0; + } else { +- T(YAFFS_TRACE_OS, (KERN_DEBUG "symlink not created\n")); +- ++ T(YAFFS_TRACE_OS, ("symlink not created\n")); + } + + return -ENOMEM; + } + + static int yaffs_sync_object(struct file *file, struct dentry *dentry, +- int datasync) ++ int datasync) + { + + yaffs_Object *obj; +@@ -1236,7 +1426,7 @@ static int yaffs_sync_object(struct file + + dev = obj->myDev; + +- T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_sync_object\n")); ++ T(YAFFS_TRACE_OS, ("yaffs_sync_object\n")); + yaffs_GrossLock(dev); + yaffs_FlushFile(obj, 1); + yaffs_GrossUnlock(dev); +@@ -1255,41 +1445,36 @@ static int yaffs_rename(struct inode *ol + int retVal = YAFFS_FAIL; + yaffs_Object *target; + +- T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_rename\n")); ++ T(YAFFS_TRACE_OS, ("yaffs_rename\n")); + dev = yaffs_InodeToObject(old_dir)->myDev; + + yaffs_GrossLock(dev); + + /* Check if the target is an existing directory that is not empty. */ +- target = +- yaffs_FindObjectByName(yaffs_InodeToObject(new_dir), +- new_dentry->d_name.name); ++ target = yaffs_FindObjectByName(yaffs_InodeToObject(new_dir), ++ new_dentry->d_name.name); + + + +- if (target && +- target->variantType == YAFFS_OBJECT_TYPE_DIRECTORY && +- !list_empty(&target->variant.directoryVariant.children)) { ++ if (target && target->variantType == YAFFS_OBJECT_TYPE_DIRECTORY && ++ !ylist_empty(&target->variant.directoryVariant.children)) { + +- T(YAFFS_TRACE_OS, (KERN_DEBUG "target is non-empty dir\n")); ++ T(YAFFS_TRACE_OS, ("target is non-empty dir\n")); + + retVal = YAFFS_FAIL; + } else { +- + /* Now does unlinking internally using shadowing mechanism */ +- T(YAFFS_TRACE_OS, (KERN_DEBUG "calling yaffs_RenameObject\n")); +- +- retVal = +- yaffs_RenameObject(yaffs_InodeToObject(old_dir), +- old_dentry->d_name.name, +- yaffs_InodeToObject(new_dir), +- new_dentry->d_name.name); ++ T(YAFFS_TRACE_OS, ("calling yaffs_RenameObject\n")); + ++ retVal = yaffs_RenameObject(yaffs_InodeToObject(old_dir), ++ old_dentry->d_name.name, ++ yaffs_InodeToObject(new_dir), ++ new_dentry->d_name.name); + } + yaffs_GrossUnlock(dev); + + if (retVal == YAFFS_OK) { +- if(target) { ++ if (target) { + new_dentry->d_inode->i_nlink--; + mark_inode_dirty(new_dentry->d_inode); + } +@@ -1298,7 +1483,6 @@ static int yaffs_rename(struct inode *ol + } else { + return -ENOTEMPTY; + } +- + } + + static int yaffs_setattr(struct dentry *dentry, struct iattr *attr) +@@ -1308,15 +1492,15 @@ static int yaffs_setattr(struct dentry * + yaffs_Device *dev; + + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_setattr of object %d\n", +- yaffs_InodeToObject(inode)->objectId)); +- +- if ((error = inode_change_ok(inode, attr)) == 0) { ++ ("yaffs_setattr of object %d\n", ++ yaffs_InodeToObject(inode)->objectId)); + ++ error = inode_change_ok(inode, attr); ++ if (error == 0) { + dev = yaffs_InodeToObject(inode)->myDev; + yaffs_GrossLock(dev); + if (yaffs_SetAttributes(yaffs_InodeToObject(inode), attr) == +- YAFFS_OK) { ++ YAFFS_OK) { + error = 0; + } else { + error = -EPERM; +@@ -1328,12 +1512,12 @@ static int yaffs_setattr(struct dentry * + return error; + } + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) + static int yaffs_statfs(struct dentry *dentry, struct kstatfs *buf) + { + yaffs_Device *dev = yaffs_DentryToObject(dentry)->myDev; + struct super_block *sb = dentry->d_sb; +-#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) ++#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + static int yaffs_statfs(struct super_block *sb, struct kstatfs *buf) + { + yaffs_Device *dev = yaffs_SuperToDevice(sb); +@@ -1343,32 +1527,53 @@ static int yaffs_statfs(struct super_blo + yaffs_Device *dev = yaffs_SuperToDevice(sb); + #endif + +- T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_statfs\n")); ++ T(YAFFS_TRACE_OS, ("yaffs_statfs\n")); + + yaffs_GrossLock(dev); + + buf->f_type = YAFFS_MAGIC; + buf->f_bsize = sb->s_blocksize; + buf->f_namelen = 255; +- if (sb->s_blocksize > dev->nDataBytesPerChunk) { ++ ++ if (dev->nDataBytesPerChunk & (dev->nDataBytesPerChunk - 1)) { ++ /* Do this if chunk size is not a power of 2 */ ++ ++ uint64_t bytesInDev; ++ uint64_t bytesFree; ++ ++ bytesInDev = ((uint64_t)((dev->endBlock - dev->startBlock + 1))) * ++ ((uint64_t)(dev->nChunksPerBlock * dev->nDataBytesPerChunk)); ++ ++ do_div(bytesInDev, sb->s_blocksize); /* bytesInDev becomes the number of blocks */ ++ buf->f_blocks = bytesInDev; ++ ++ bytesFree = ((uint64_t)(yaffs_GetNumberOfFreeChunks(dev))) * ++ ((uint64_t)(dev->nDataBytesPerChunk)); ++ ++ do_div(bytesFree, sb->s_blocksize); ++ ++ buf->f_bfree = bytesFree; ++ ++ } else if (sb->s_blocksize > dev->nDataBytesPerChunk) { + + buf->f_blocks = +- (dev->endBlock - dev->startBlock + +- 1) * dev->nChunksPerBlock / (sb->s_blocksize / +- dev->nDataBytesPerChunk); ++ (dev->endBlock - dev->startBlock + 1) * ++ dev->nChunksPerBlock / ++ (sb->s_blocksize / dev->nDataBytesPerChunk); + buf->f_bfree = +- yaffs_GetNumberOfFreeChunks(dev) / (sb->s_blocksize / +- dev->nDataBytesPerChunk); ++ yaffs_GetNumberOfFreeChunks(dev) / ++ (sb->s_blocksize / dev->nDataBytesPerChunk); + } else { +- + buf->f_blocks = +- (dev->endBlock - dev->startBlock + +- 1) * dev->nChunksPerBlock * (dev->nDataBytesPerChunk / +- sb->s_blocksize); ++ (dev->endBlock - dev->startBlock + 1) * ++ dev->nChunksPerBlock * ++ (dev->nDataBytesPerChunk / sb->s_blocksize); ++ + buf->f_bfree = +- yaffs_GetNumberOfFreeChunks(dev) * (dev->nDataBytesPerChunk / +- sb->s_blocksize); ++ yaffs_GetNumberOfFreeChunks(dev) * ++ (dev->nDataBytesPerChunk / sb->s_blocksize); + } ++ + buf->f_files = 0; + buf->f_ffree = 0; + buf->f_bavail = buf->f_bfree; +@@ -1378,18 +1583,19 @@ static int yaffs_statfs(struct super_blo + } + + +-/** + static int yaffs_do_sync_fs(struct super_block *sb) + { + + yaffs_Device *dev = yaffs_SuperToDevice(sb); +- T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_do_sync_fs\n")); ++ T(YAFFS_TRACE_OS, ("yaffs_do_sync_fs\n")); + +- if(sb->s_dirt) { ++ if (sb->s_dirt) { + yaffs_GrossLock(dev); + +- if(dev) ++ if (dev) { ++ yaffs_FlushEntireDeviceCache(dev); + yaffs_CheckpointSave(dev); ++ } + + yaffs_GrossUnlock(dev); + +@@ -1397,35 +1603,73 @@ static int yaffs_do_sync_fs(struct super + } + return 0; + } +-**/ + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) ++ ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) + static void yaffs_write_super(struct super_block *sb) + #else + static int yaffs_write_super(struct super_block *sb) + #endif + { + +- T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_write_super\n")); +-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) +- return 0; /* yaffs_do_sync_fs(sb);*/ ++ T(YAFFS_TRACE_OS, ("yaffs_write_super\n")); ++ if (yaffs_auto_checkpoint >= 2) ++ yaffs_do_sync_fs(sb); ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)) ++ return 0; + #endif + } + + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) + static int yaffs_sync_fs(struct super_block *sb, int wait) + #else + static int yaffs_sync_fs(struct super_block *sb) + #endif + { ++ T(YAFFS_TRACE_OS, ("yaffs_sync_fs\n")); ++ ++ if (yaffs_auto_checkpoint >= 1) ++ yaffs_do_sync_fs(sb); ++ ++ return 0; ++} ++ ++#ifdef YAFFS_USE_OWN_IGET ++ ++static struct inode *yaffs_iget(struct super_block *sb, unsigned long ino) ++{ ++ struct inode *inode; ++ yaffs_Object *obj; ++ yaffs_Device *dev = yaffs_SuperToDevice(sb); ++ ++ T(YAFFS_TRACE_OS, ++ ("yaffs_iget for %lu\n", ino)); + +- T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_sync_fs\n")); ++ inode = iget_locked(sb, ino); ++ if (!inode) ++ return ERR_PTR(-ENOMEM); ++ if (!(inode->i_state & I_NEW)) ++ return inode; ++ ++ /* NB This is called as a side effect of other functions, but ++ * we had to release the lock to prevent deadlocks, so ++ * need to lock again. ++ */ + +- return 0; /* yaffs_do_sync_fs(sb);*/ ++ yaffs_GrossLock(dev); + ++ obj = yaffs_FindObjectByNumber(dev, inode->i_ino); ++ ++ yaffs_FillInodeFromObject(inode, obj); ++ ++ yaffs_GrossUnlock(dev); ++ ++ unlock_new_inode(inode); ++ return inode; + } + ++#else + + static void yaffs_read_inode(struct inode *inode) + { +@@ -1438,7 +1682,7 @@ static void yaffs_read_inode(struct inod + yaffs_Device *dev = yaffs_SuperToDevice(inode->i_sb); + + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_read_inode for %d\n", (int)inode->i_ino)); ++ ("yaffs_read_inode for %d\n", (int)inode->i_ino)); + + yaffs_GrossLock(dev); + +@@ -1449,18 +1693,20 @@ static void yaffs_read_inode(struct inod + yaffs_GrossUnlock(dev); + } + +-static LIST_HEAD(yaffs_dev_list); ++#endif ++ ++static YLIST_HEAD(yaffs_dev_list); + +-#if 0 // not used ++#if 0 /* not used */ + static int yaffs_remount_fs(struct super_block *sb, int *flags, char *data) + { + yaffs_Device *dev = yaffs_SuperToDevice(sb); + +- if( *flags & MS_RDONLY ) { ++ if (*flags & MS_RDONLY) { + struct mtd_info *mtd = yaffs_SuperToDevice(sb)->genericDevice; + + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_remount_fs: %s: RO\n", dev->name )); ++ ("yaffs_remount_fs: %s: RO\n", dev->name)); + + yaffs_GrossLock(dev); + +@@ -1472,10 +1718,9 @@ static int yaffs_remount_fs(struct super + mtd->sync(mtd); + + yaffs_GrossUnlock(dev); +- } +- else { ++ } else { + T(YAFFS_TRACE_OS, +- (KERN_DEBUG "yaffs_remount_fs: %s: RW\n", dev->name )); ++ ("yaffs_remount_fs: %s: RW\n", dev->name)); + } + + return 0; +@@ -1486,7 +1731,7 @@ static void yaffs_put_super(struct super + { + yaffs_Device *dev = yaffs_SuperToDevice(sb); + +- T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_put_super\n")); ++ T(YAFFS_TRACE_OS, ("yaffs_put_super\n")); + + yaffs_GrossLock(dev); + +@@ -1494,18 +1739,17 @@ static void yaffs_put_super(struct super + + yaffs_CheckpointSave(dev); + +- if (dev->putSuperFunc) { ++ if (dev->putSuperFunc) + dev->putSuperFunc(sb); +- } + + yaffs_Deinitialise(dev); + + yaffs_GrossUnlock(dev); + + /* we assume this is protected by lock_kernel() in mount/umount */ +- list_del(&dev->devList); ++ ylist_del(&dev->devList); + +- if(dev->spareBuffer){ ++ if (dev->spareBuffer) { + YFREE(dev->spareBuffer); + dev->spareBuffer = NULL; + } +@@ -1516,12 +1760,10 @@ static void yaffs_put_super(struct super + + static void yaffs_MTDPutSuper(struct super_block *sb) + { +- + struct mtd_info *mtd = yaffs_SuperToDevice(sb)->genericDevice; + +- if (mtd->sync) { ++ if (mtd->sync) + mtd->sync(mtd); +- } + + put_mtd_device(mtd); + } +@@ -1531,9 +1773,9 @@ static void yaffs_MarkSuperBlockDirty(vo + { + struct super_block *sb = (struct super_block *)vsb; + +- T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_MarkSuperBlockDirty() sb = %p\n",sb)); +-// if(sb) +-// sb->s_dirt = 1; ++ T(YAFFS_TRACE_OS, ("yaffs_MarkSuperBlockDirty() sb = %p\n", sb)); ++ if (sb) ++ sb->s_dirt = 1; + } + + typedef struct { +@@ -1546,48 +1788,48 @@ typedef struct { + #define MAX_OPT_LEN 20 + static int yaffs_parse_options(yaffs_options *options, const char *options_str) + { +- char cur_opt[MAX_OPT_LEN+1]; ++ char cur_opt[MAX_OPT_LEN + 1]; + int p; + int error = 0; + + /* Parse through the options which is a comma seperated list */ + +- while(options_str && *options_str && !error){ +- memset(cur_opt,0,MAX_OPT_LEN+1); ++ while (options_str && *options_str && !error) { ++ memset(cur_opt, 0, MAX_OPT_LEN + 1); + p = 0; + +- while(*options_str && *options_str != ','){ +- if(p < MAX_OPT_LEN){ ++ while (*options_str && *options_str != ',') { ++ if (p < MAX_OPT_LEN) { + cur_opt[p] = *options_str; + p++; + } + options_str++; + } + +- if(!strcmp(cur_opt,"inband-tags")) ++ if (!strcmp(cur_opt, "inband-tags")) + options->inband_tags = 1; +- else if(!strcmp(cur_opt,"no-cache")) ++ else if (!strcmp(cur_opt, "no-cache")) + options->no_cache = 1; +- else if(!strcmp(cur_opt,"no-checkpoint-read")) ++ else if (!strcmp(cur_opt, "no-checkpoint-read")) + options->skip_checkpoint_read = 1; +- else if(!strcmp(cur_opt,"no-checkpoint-write")) ++ else if (!strcmp(cur_opt, "no-checkpoint-write")) + options->skip_checkpoint_write = 1; +- else if(!strcmp(cur_opt,"no-checkpoint")){ ++ else if (!strcmp(cur_opt, "no-checkpoint")) { + options->skip_checkpoint_read = 1; + options->skip_checkpoint_write = 1; + } else { +- printk(KERN_INFO "yaffs: Bad mount option \"%s\"\n",cur_opt); ++ printk(KERN_INFO "yaffs: Bad mount option \"%s\"\n", ++ cur_opt); + error = 1; + } +- + } + + return error; + } + + static struct super_block *yaffs_internal_read_super(int yaffsVersion, +- struct super_block *sb, +- void *data, int silent) ++ struct super_block *sb, ++ void *data, int silent) + { + int nBlocks; + struct inode *inode = NULL; +@@ -1602,6 +1844,7 @@ static struct super_block *yaffs_interna + + sb->s_magic = YAFFS_MAGIC; + sb->s_op = &yaffs_super_ops; ++ sb->s_flags |= MS_NOATIME; + + if (!sb) + printk(KERN_INFO "yaffs: sb is NULL\n"); +@@ -1614,14 +1857,14 @@ static struct super_block *yaffs_interna + sb->s_dev, + yaffs_devname(sb, devname_buf)); + +- if(!data_str) ++ if (!data_str) + data_str = ""; + +- printk(KERN_INFO "yaffs: passed flags \"%s\"\n",data_str); ++ printk(KERN_INFO "yaffs: passed flags \"%s\"\n", data_str); + +- memset(&options,0,sizeof(options)); ++ memset(&options, 0, sizeof(options)); + +- if(yaffs_parse_options(&options,data_str)){ ++ if (yaffs_parse_options(&options, data_str)) { + /* Option parsing failed */ + return NULL; + } +@@ -1645,9 +1888,9 @@ static struct super_block *yaffs_interna + yaffs_devname(sb, devname_buf))); + + /* Check it's an mtd device..... */ +- if (MAJOR(sb->s_dev) != MTD_BLOCK_MAJOR) { ++ if (MAJOR(sb->s_dev) != MTD_BLOCK_MAJOR) + return NULL; /* This isn't an mtd device */ +- } ++ + /* Get the device */ + mtd = get_mtd_device(NULL, MINOR(sb->s_dev)); + if (!mtd) { +@@ -1673,29 +1916,23 @@ static struct super_block *yaffs_interna + T(YAFFS_TRACE_OS, (" %s %d\n", WRITE_SIZE_STR, WRITE_SIZE(mtd))); + T(YAFFS_TRACE_OS, (" oobsize %d\n", mtd->oobsize)); + T(YAFFS_TRACE_OS, (" erasesize %d\n", mtd->erasesize)); +- T(YAFFS_TRACE_OS, (" size %d\n", mtd->size)); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) ++ T(YAFFS_TRACE_OS, (" size %u\n", mtd->size)); ++#else ++ T(YAFFS_TRACE_OS, (" size %lld\n", mtd->size)); ++#endif + + #ifdef CONFIG_YAFFS_AUTO_YAFFS2 + +- if (yaffsVersion == 1 && +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) +- mtd->writesize >= 2048) { +-#else +- mtd->oobblock >= 2048) { +-#endif +- T(YAFFS_TRACE_ALWAYS,("yaffs: auto selecting yaffs2\n")); +- yaffsVersion = 2; ++ if (yaffsVersion == 1 && WRITE_SIZE(mtd) >= 2048) { ++ T(YAFFS_TRACE_ALWAYS, ("yaffs: auto selecting yaffs2\n")); ++ yaffsVersion = 2; + } + + /* Added NCB 26/5/2006 for completeness */ +- if (yaffsVersion == 2 && +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) +- mtd->writesize == 512) { +-#else +- mtd->oobblock == 512) { +-#endif +- T(YAFFS_TRACE_ALWAYS,("yaffs: auto selecting yaffs1\n")); +- yaffsVersion = 1; ++ if (yaffsVersion == 2 && !options.inband_tags && WRITE_SIZE(mtd) == 512) { ++ T(YAFFS_TRACE_ALWAYS, ("yaffs: auto selecting yaffs1\n")); ++ yaffsVersion = 1; + } + + #endif +@@ -1707,7 +1944,7 @@ static struct super_block *yaffs_interna + !mtd->block_markbad || + !mtd->read || + !mtd->write || +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) + !mtd->read_oob || !mtd->write_oob) { + #else + !mtd->write_ecc || +@@ -1719,12 +1956,9 @@ static struct super_block *yaffs_interna + return NULL; + } + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) +- if (mtd->writesize < YAFFS_MIN_YAFFS2_CHUNK_SIZE || +-#else +- if (mtd->oobblock < YAFFS_MIN_YAFFS2_CHUNK_SIZE || +-#endif +- mtd->oobsize < YAFFS_MIN_YAFFS2_SPARE_SIZE) { ++ if ((WRITE_SIZE(mtd) < YAFFS_MIN_YAFFS2_CHUNK_SIZE || ++ mtd->oobsize < YAFFS_MIN_YAFFS2_SPARE_SIZE) && ++ !options.inband_tags) { + T(YAFFS_TRACE_ALWAYS, + ("yaffs: MTD device does not have the " + "right page sizes\n")); +@@ -1735,7 +1969,7 @@ static struct super_block *yaffs_interna + if (!mtd->erase || + !mtd->read || + !mtd->write || +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) + !mtd->read_oob || !mtd->write_oob) { + #else + !mtd->write_ecc || +@@ -1761,7 +1995,7 @@ static struct super_block *yaffs_interna + * Set the yaffs_Device up for mtd + */ + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + sb->s_fs_info = dev = kmalloc(sizeof(yaffs_Device), GFP_KERNEL); + #else + sb->u.generic_sbp = dev = kmalloc(sizeof(yaffs_Device), GFP_KERNEL); +@@ -1780,13 +2014,15 @@ static struct super_block *yaffs_interna + + /* Set up the memory size parameters.... */ + +- nBlocks = mtd->size / (YAFFS_CHUNKS_PER_BLOCK * YAFFS_BYTES_PER_CHUNK); ++ nBlocks = YCALCBLOCKS(mtd->size, (YAFFS_CHUNKS_PER_BLOCK * YAFFS_BYTES_PER_CHUNK)); ++ + dev->startBlock = 0; + dev->endBlock = nBlocks - 1; + dev->nChunksPerBlock = YAFFS_CHUNKS_PER_BLOCK; +- dev->nDataBytesPerChunk = YAFFS_BYTES_PER_CHUNK; ++ dev->totalBytesPerChunk = YAFFS_BYTES_PER_CHUNK; + dev->nReservedBlocks = 5; + dev->nShortOpCaches = (options.no_cache) ? 0 : 10; ++ dev->inbandTags = options.inband_tags; + + /* ... and the functions. */ + if (yaffsVersion == 2) { +@@ -1798,20 +2034,19 @@ static struct super_block *yaffs_interna + dev->queryNANDBlock = nandmtd2_QueryNANDBlock; + dev->spareBuffer = YMALLOC(mtd->oobsize); + dev->isYaffs2 = 1; +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) +- dev->nDataBytesPerChunk = mtd->writesize; ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) ++ dev->totalBytesPerChunk = mtd->writesize; + dev->nChunksPerBlock = mtd->erasesize / mtd->writesize; + #else +- dev->nDataBytesPerChunk = mtd->oobblock; ++ dev->totalBytesPerChunk = mtd->oobblock; + dev->nChunksPerBlock = mtd->erasesize / mtd->oobblock; + #endif +- nBlocks = mtd->size / mtd->erasesize; ++ nBlocks = YCALCBLOCKS(mtd->size, mtd->erasesize); + +- dev->nCheckpointReservedBlocks = CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS; + dev->startBlock = 0; + dev->endBlock = nBlocks - 1; + } else { +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) + /* use the MTD interface in yaffs_mtdif1.c */ + dev->writeChunkWithTagsToNAND = + nandmtd1_WriteChunkWithTagsToNAND; +@@ -1847,7 +2082,7 @@ static struct super_block *yaffs_interna + dev->skipCheckpointWrite = options.skip_checkpoint_write; + + /* we assume this is protected by lock_kernel() in mount/umount */ +- list_add_tail(&dev->devList, &yaffs_dev_list); ++ ylist_add_tail(&dev->devList, &yaffs_dev_list); + + init_MUTEX(&dev->grossLock); + +@@ -1884,20 +2119,23 @@ static struct super_block *yaffs_interna + return NULL; + } + sb->s_root = root; ++ sb->s_dirt = !dev->isCheckpointed; ++ T(YAFFS_TRACE_ALWAYS, ++ ("yaffs_read_super: isCheckpointed %d\n", dev->isCheckpointed)); + + T(YAFFS_TRACE_OS, ("yaffs_read_super: done\n")); + return sb; + } + + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + static int yaffs_internal_read_super_mtd(struct super_block *sb, void *data, + int silent) + { + return yaffs_internal_read_super(1, sb, data, silent) ? 0 : -EINVAL; + } + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) + static int yaffs_read_super(struct file_system_type *fs, + int flags, const char *dev_name, + void *data, struct vfsmount *mnt) +@@ -1938,14 +2176,14 @@ static DECLARE_FSTYPE(yaffs_fs_type, "ya + + #ifdef CONFIG_YAFFS_YAFFS2 + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + static int yaffs2_internal_read_super_mtd(struct super_block *sb, void *data, + int silent) + { + return yaffs_internal_read_super(2, sb, data, silent) ? 0 : -EINVAL; + } + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) + static int yaffs2_read_super(struct file_system_type *fs, + int flags, const char *dev_name, void *data, + struct vfsmount *mnt) +@@ -1990,12 +2228,12 @@ static char *yaffs_dump_dev(char *buf, y + { + buf += sprintf(buf, "startBlock......... %d\n", dev->startBlock); + buf += sprintf(buf, "endBlock........... %d\n", dev->endBlock); ++ buf += sprintf(buf, "totalBytesPerChunk. %d\n", dev->totalBytesPerChunk); + buf += sprintf(buf, "nDataBytesPerChunk. %d\n", dev->nDataBytesPerChunk); + buf += sprintf(buf, "chunkGroupBits..... %d\n", dev->chunkGroupBits); + buf += sprintf(buf, "chunkGroupSize..... %d\n", dev->chunkGroupSize); + buf += sprintf(buf, "nErasedBlocks...... %d\n", dev->nErasedBlocks); + buf += sprintf(buf, "nReservedBlocks.... %d\n", dev->nReservedBlocks); +- buf += sprintf(buf, "nCheckptResBlocks.. %d\n", dev->nCheckpointReservedBlocks); + buf += sprintf(buf, "blocksInCheckpoint. %d\n", dev->blocksInCheckpoint); + buf += sprintf(buf, "nTnodesCreated..... %d\n", dev->nTnodesCreated); + buf += sprintf(buf, "nFreeTnodes........ %d\n", dev->nFreeTnodes); +@@ -2006,10 +2244,8 @@ static char *yaffs_dump_dev(char *buf, y + buf += sprintf(buf, "nPageReads......... %d\n", dev->nPageReads); + buf += sprintf(buf, "nBlockErasures..... %d\n", dev->nBlockErasures); + buf += sprintf(buf, "nGCCopies.......... %d\n", dev->nGCCopies); +- buf += +- sprintf(buf, "garbageCollections. %d\n", dev->garbageCollections); +- buf += +- sprintf(buf, "passiveGCs......... %d\n", ++ buf += sprintf(buf, "garbageCollections. %d\n", dev->garbageCollections); ++ buf += sprintf(buf, "passiveGCs......... %d\n", + dev->passiveGarbageCollections); + buf += sprintf(buf, "nRetriedWrites..... %d\n", dev->nRetriedWrites); + buf += sprintf(buf, "nShortOpCaches..... %d\n", dev->nShortOpCaches); +@@ -2025,6 +2261,7 @@ static char *yaffs_dump_dev(char *buf, y + sprintf(buf, "nBackgroudDeletions %d\n", dev->nBackgroundDeletions); + buf += sprintf(buf, "useNANDECC......... %d\n", dev->useNANDECC); + buf += sprintf(buf, "isYaffs2........... %d\n", dev->isYaffs2); ++ buf += sprintf(buf, "inbandTags......... %d\n", dev->inbandTags); + + return buf; + } +@@ -2033,7 +2270,7 @@ static int yaffs_proc_read(char *page, + char **start, + off_t offset, int count, int *eof, void *data) + { +- struct list_head *item; ++ struct ylist_head *item; + char *buf = page; + int step = offset; + int n = 0; +@@ -2057,8 +2294,8 @@ static int yaffs_proc_read(char *page, + lock_kernel(); + + /* Locate and print the Nth entry. Order N-squared but N is small. */ +- list_for_each(item, &yaffs_dev_list) { +- yaffs_Device *dev = list_entry(item, yaffs_Device, devList); ++ ylist_for_each(item, &yaffs_dev_list) { ++ yaffs_Device *dev = ylist_entry(item, yaffs_Device, devList); + if (n < step) { + n++; + continue; +@@ -2119,7 +2356,7 @@ static int yaffs_proc_write(struct file + char *end; + char *mask_name; + const char *x; +- char substring[MAX_MASK_NAME_LENGTH+1]; ++ char substring[MAX_MASK_NAME_LENGTH + 1]; + int i; + int done = 0; + int add, len = 0; +@@ -2129,9 +2366,8 @@ static int yaffs_proc_write(struct file + + while (!done && (pos < count)) { + done = 1; +- while ((pos < count) && isspace(buf[pos])) { ++ while ((pos < count) && isspace(buf[pos])) + pos++; +- } + + switch (buf[pos]) { + case '+': +@@ -2148,20 +2384,21 @@ static int yaffs_proc_write(struct file + mask_name = NULL; + + mask_bitfield = simple_strtoul(buf + pos, &end, 0); ++ + if (end > buf + pos) { + mask_name = "numeral"; + len = end - (buf + pos); + pos += len; + done = 0; + } else { +- for(x = buf + pos, i = 0; +- (*x == '_' || (*x >='a' && *x <= 'z')) && +- i = 'a' && *x <= 'z')) && ++ i < MAX_MASK_NAME_LENGTH; x++, i++, pos++) ++ substring[i] = *x; + substring[i] = '\0'; + + for (i = 0; mask_flags[i].mask_name != NULL; i++) { +- if(strcmp(substring,mask_flags[i].mask_name) == 0){ ++ if (strcmp(substring, mask_flags[i].mask_name) == 0) { + mask_name = mask_flags[i].mask_name; + mask_bitfield = mask_flags[i].mask_bitfield; + done = 0; +@@ -2172,7 +2409,7 @@ static int yaffs_proc_write(struct file + + if (mask_name != NULL) { + done = 0; +- switch(add) { ++ switch (add) { + case '-': + rg &= ~mask_bitfield; + break; +@@ -2191,13 +2428,13 @@ static int yaffs_proc_write(struct file + + yaffs_traceMask = rg | YAFFS_TRACE_ALWAYS; + +- printk("new trace = 0x%08X\n",yaffs_traceMask); ++ printk(KERN_DEBUG "new trace = 0x%08X\n", yaffs_traceMask); + + if (rg & YAFFS_TRACE_ALWAYS) { + for (i = 0; mask_flags[i].mask_name != NULL; i++) { + char flag; + flag = ((rg & mask_flags[i].mask_bitfield) == mask_flags[i].mask_bitfield) ? '+' : '-'; +- printk("%c%s\n", flag, mask_flags[i].mask_name); ++ printk(KERN_DEBUG "%c%s\n", flag, mask_flags[i].mask_name); + } + } + +@@ -2211,12 +2448,8 @@ struct file_system_to_install { + }; + + static struct file_system_to_install fs_to_install[] = { +-//#ifdef CONFIG_YAFFS_YAFFS1 + {&yaffs_fs_type, 0}, +-//#endif +-//#ifdef CONFIG_YAFFS_YAFFS2 + {&yaffs2_fs_type, 0}, +-//#endif + {NULL, 0} + }; + +@@ -2231,15 +2464,14 @@ static int __init init_yaffs_fs(void) + /* Install the proc_fs entry */ + my_proc_entry = create_proc_entry("yaffs", + S_IRUGO | S_IFREG, +- &proc_root); ++ YPROC_ROOT); + + if (my_proc_entry) { + my_proc_entry->write_proc = yaffs_proc_write; + my_proc_entry->read_proc = yaffs_proc_read; + my_proc_entry->data = NULL; +- } else { ++ } else + return -ENOMEM; +- } + + /* Now add the file system entries */ + +@@ -2247,9 +2479,8 @@ static int __init init_yaffs_fs(void) + + while (fsinst->fst && !error) { + error = register_filesystem(fsinst->fst); +- if (!error) { ++ if (!error) + fsinst->installed = 1; +- } + fsinst++; + } + +@@ -2277,7 +2508,7 @@ static void __exit exit_yaffs_fs(void) + T(YAFFS_TRACE_ALWAYS, ("yaffs " __DATE__ " " __TIME__ + " removing. \n")); + +- remove_proc_entry("yaffs", &proc_root); ++ remove_proc_entry("yaffs", YPROC_ROOT); + + fsinst = fs_to_install; + +@@ -2288,7 +2519,6 @@ static void __exit exit_yaffs_fs(void) + } + fsinst++; + } +- + } + + module_init(init_yaffs_fs) +--- /dev/null ++++ b/fs/yaffs2/yaffs_getblockinfo.h +@@ -0,0 +1,34 @@ ++/* ++ * YAFFS: Yet another Flash File System . A NAND-flash specific file system. ++ * ++ * Copyright (C) 2002-2007 Aleph One Ltd. ++ * for Toby Churchill Ltd and Brightstar Engineering ++ * ++ * Created by Charles Manning ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License version 2.1 as ++ * published by the Free Software Foundation. ++ * ++ * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. ++ */ ++ ++#ifndef __YAFFS_GETBLOCKINFO_H__ ++#define __YAFFS_GETBLOCKINFO_H__ ++ ++#include "yaffs_guts.h" ++ ++/* Function to manipulate block info */ ++static Y_INLINE yaffs_BlockInfo *yaffs_GetBlockInfo(yaffs_Device * dev, int blk) ++{ ++ if (blk < dev->internalStartBlock || blk > dev->internalEndBlock) { ++ T(YAFFS_TRACE_ERROR, ++ (TSTR ++ ("**>> yaffs: getBlockInfo block %d is not valid" TENDSTR), ++ blk)); ++ YBUG(); ++ } ++ return &dev->blockInfo[blk - dev->internalStartBlock]; ++} ++ ++#endif +--- a/fs/yaffs2/yaffs_guts.c ++++ b/fs/yaffs2/yaffs_guts.c +@@ -12,16 +12,17 @@ + */ + + const char *yaffs_guts_c_version = +- "$Id: yaffs_guts.c,v 1.49 2007-05-15 20:07:40 charles Exp $"; ++ "$Id: yaffs_guts.c,v 1.82 2009-03-09 04:24:17 charles Exp $"; + + #include "yportenv.h" + + #include "yaffsinterface.h" + #include "yaffs_guts.h" + #include "yaffs_tagsvalidity.h" ++#include "yaffs_getblockinfo.h" + + #include "yaffs_tagscompat.h" +-#ifndef CONFIG_YAFFS_USE_OWN_SORT ++#ifndef CONFIG_YAFFS_USE_OWN_SORT + #include "yaffs_qsort.h" + #endif + #include "yaffs_nand.h" +@@ -32,116 +33,116 @@ const char *yaffs_guts_c_version = + #include "yaffs_packedtags2.h" + + +-#ifdef CONFIG_YAFFS_WINCE +-void yfsd_LockYAFFS(BOOL fsLockOnly); +-void yfsd_UnlockYAFFS(BOOL fsLockOnly); +-#endif +- + #define YAFFS_PASSIVE_GC_CHUNKS 2 + + #include "yaffs_ecc.h" + + + /* Robustification (if it ever comes about...) */ +-static void yaffs_RetireBlock(yaffs_Device * dev, int blockInNAND); +-static void yaffs_HandleWriteChunkError(yaffs_Device * dev, int chunkInNAND, int erasedOk); +-static void yaffs_HandleWriteChunkOk(yaffs_Device * dev, int chunkInNAND, +- const __u8 * data, +- const yaffs_ExtendedTags * tags); +-static void yaffs_HandleUpdateChunk(yaffs_Device * dev, int chunkInNAND, +- const yaffs_ExtendedTags * tags); ++static void yaffs_RetireBlock(yaffs_Device *dev, int blockInNAND); ++static void yaffs_HandleWriteChunkError(yaffs_Device *dev, int chunkInNAND, ++ int erasedOk); ++static void yaffs_HandleWriteChunkOk(yaffs_Device *dev, int chunkInNAND, ++ const __u8 *data, ++ const yaffs_ExtendedTags *tags); ++static void yaffs_HandleUpdateChunk(yaffs_Device *dev, int chunkInNAND, ++ const yaffs_ExtendedTags *tags); + + /* Other local prototypes */ +-static int yaffs_UnlinkObject( yaffs_Object *obj); ++static int yaffs_UnlinkObject(yaffs_Object *obj); + static int yaffs_ObjectHasCachedWriteData(yaffs_Object *obj); + + static void yaffs_HardlinkFixup(yaffs_Device *dev, yaffs_Object *hardList); + +-static int yaffs_WriteNewChunkWithTagsToNAND(yaffs_Device * dev, +- const __u8 * buffer, +- yaffs_ExtendedTags * tags, +- int useReserve); +-static int yaffs_PutChunkIntoFile(yaffs_Object * in, int chunkInInode, +- int chunkInNAND, int inScan); +- +-static yaffs_Object *yaffs_CreateNewObject(yaffs_Device * dev, int number, +- yaffs_ObjectType type); +-static void yaffs_AddObjectToDirectory(yaffs_Object * directory, +- yaffs_Object * obj); +-static int yaffs_UpdateObjectHeader(yaffs_Object * in, const YCHAR * name, +- int force, int isShrink, int shadows); +-static void yaffs_RemoveObjectFromDirectory(yaffs_Object * obj); ++static int yaffs_WriteNewChunkWithTagsToNAND(yaffs_Device *dev, ++ const __u8 *buffer, ++ yaffs_ExtendedTags *tags, ++ int useReserve); ++static int yaffs_PutChunkIntoFile(yaffs_Object *in, int chunkInInode, ++ int chunkInNAND, int inScan); ++ ++static yaffs_Object *yaffs_CreateNewObject(yaffs_Device *dev, int number, ++ yaffs_ObjectType type); ++static void yaffs_AddObjectToDirectory(yaffs_Object *directory, ++ yaffs_Object *obj); ++static int yaffs_UpdateObjectHeader(yaffs_Object *in, const YCHAR *name, ++ int force, int isShrink, int shadows); ++static void yaffs_RemoveObjectFromDirectory(yaffs_Object *obj); + static int yaffs_CheckStructures(void); +-static int yaffs_DeleteWorker(yaffs_Object * in, yaffs_Tnode * tn, __u32 level, +- int chunkOffset, int *limit); +-static int yaffs_DoGenericObjectDeletion(yaffs_Object * in); +- +-static yaffs_BlockInfo *yaffs_GetBlockInfo(yaffs_Device * dev, int blockNo); +- +-static __u8 *yaffs_GetTempBuffer(yaffs_Device * dev, int lineNo); +-static void yaffs_ReleaseTempBuffer(yaffs_Device * dev, __u8 * buffer, +- int lineNo); ++static int yaffs_DeleteWorker(yaffs_Object *in, yaffs_Tnode *tn, __u32 level, ++ int chunkOffset, int *limit); ++static int yaffs_DoGenericObjectDeletion(yaffs_Object *in); ++ ++static yaffs_BlockInfo *yaffs_GetBlockInfo(yaffs_Device *dev, int blockNo); + +-static int yaffs_CheckChunkErased(struct yaffs_DeviceStruct *dev, +- int chunkInNAND); + +-static int yaffs_UnlinkWorker(yaffs_Object * obj); +-static void yaffs_DestroyObject(yaffs_Object * obj); ++static int yaffs_CheckChunkErased(struct yaffs_DeviceStruct *dev, ++ int chunkInNAND); + +-static int yaffs_TagsMatch(const yaffs_ExtendedTags * tags, int objectId, +- int chunkInObject); ++static int yaffs_UnlinkWorker(yaffs_Object *obj); + +-loff_t yaffs_GetFileSize(yaffs_Object * obj); ++static int yaffs_TagsMatch(const yaffs_ExtendedTags *tags, int objectId, ++ int chunkInObject); + +-static int yaffs_AllocateChunk(yaffs_Device * dev, int useReserve, yaffs_BlockInfo **blockUsedPtr); ++static int yaffs_AllocateChunk(yaffs_Device *dev, int useReserve, ++ yaffs_BlockInfo **blockUsedPtr); + +-static void yaffs_VerifyFreeChunks(yaffs_Device * dev); ++static void yaffs_VerifyFreeChunks(yaffs_Device *dev); + + static void yaffs_CheckObjectDetailsLoaded(yaffs_Object *in); + ++static void yaffs_VerifyDirectory(yaffs_Object *directory); + #ifdef YAFFS_PARANOID +-static int yaffs_CheckFileSanity(yaffs_Object * in); ++static int yaffs_CheckFileSanity(yaffs_Object *in); + #else + #define yaffs_CheckFileSanity(in) + #endif + +-static void yaffs_InvalidateWholeChunkCache(yaffs_Object * in); +-static void yaffs_InvalidateChunkCache(yaffs_Object * object, int chunkId); ++static void yaffs_InvalidateWholeChunkCache(yaffs_Object *in); ++static void yaffs_InvalidateChunkCache(yaffs_Object *object, int chunkId); + + static void yaffs_InvalidateCheckpoint(yaffs_Device *dev); + +-static int yaffs_FindChunkInFile(yaffs_Object * in, int chunkInInode, +- yaffs_ExtendedTags * tags); ++static int yaffs_FindChunkInFile(yaffs_Object *in, int chunkInInode, ++ yaffs_ExtendedTags *tags); + +-static __u32 yaffs_GetChunkGroupBase(yaffs_Device *dev, yaffs_Tnode *tn, unsigned pos); +-static yaffs_Tnode *yaffs_FindLevel0Tnode(yaffs_Device * dev, +- yaffs_FileStructure * fStruct, +- __u32 chunkId); ++static __u32 yaffs_GetChunkGroupBase(yaffs_Device *dev, yaffs_Tnode *tn, ++ unsigned pos); ++static yaffs_Tnode *yaffs_FindLevel0Tnode(yaffs_Device *dev, ++ yaffs_FileStructure *fStruct, ++ __u32 chunkId); + + + /* Function to calculate chunk and offset */ + +-static void yaffs_AddrToChunk(yaffs_Device *dev, loff_t addr, __u32 *chunk, __u32 *offset) ++static void yaffs_AddrToChunk(yaffs_Device *dev, loff_t addr, int *chunkOut, ++ __u32 *offsetOut) + { +- if(dev->chunkShift){ +- /* Easy-peasy power of 2 case */ +- *chunk = (__u32)(addr >> dev->chunkShift); +- *offset = (__u32)(addr & dev->chunkMask); +- } +- else if(dev->crumbsPerChunk) +- { +- /* Case where we're using "crumbs" */ +- *offset = (__u32)(addr & dev->crumbMask); +- addr >>= dev->crumbShift; +- *chunk = ((__u32)addr)/dev->crumbsPerChunk; +- *offset += ((addr - (*chunk * dev->crumbsPerChunk)) << dev->crumbShift); ++ int chunk; ++ __u32 offset; ++ ++ chunk = (__u32)(addr >> dev->chunkShift); ++ ++ if (dev->chunkDiv == 1) { ++ /* easy power of 2 case */ ++ offset = (__u32)(addr & dev->chunkMask); ++ } else { ++ /* Non power-of-2 case */ ++ ++ loff_t chunkBase; ++ ++ chunk /= dev->chunkDiv; ++ ++ chunkBase = ((loff_t)chunk) * dev->nDataBytesPerChunk; ++ offset = (__u32)(addr - chunkBase); + } +- else +- YBUG(); ++ ++ *chunkOut = chunk; ++ *offsetOut = offset; + } + +-/* Function to return the number of shifts for a power of 2 greater than or equal +- * to the given number ++/* Function to return the number of shifts for a power of 2 greater than or ++ * equal to the given number + * Note we don't try to cater for all possible numbers and this does not have to + * be hellishly efficient. + */ +@@ -153,13 +154,14 @@ static __u32 ShiftsGE(__u32 x) + + nShifts = extraBits = 0; + +- while(x>1){ +- if(x & 1) extraBits++; +- x>>=1; ++ while (x > 1) { ++ if (x & 1) ++ extraBits++; ++ x >>= 1; + nShifts++; + } + +- if(extraBits) ++ if (extraBits) + nShifts++; + + return nShifts; +@@ -168,16 +170,17 @@ static __u32 ShiftsGE(__u32 x) + /* Function to return the number of shifts to get a 1 in bit 0 + */ + +-static __u32 ShiftDiv(__u32 x) ++static __u32 Shifts(__u32 x) + { + int nShifts; + + nShifts = 0; + +- if(!x) return 0; ++ if (!x) ++ return 0; + +- while( !(x&1)){ +- x>>=1; ++ while (!(x&1)) { ++ x >>= 1; + nShifts++; + } + +@@ -195,21 +198,25 @@ static int yaffs_InitialiseTempBuffers(y + int i; + __u8 *buf = (__u8 *)1; + +- memset(dev->tempBuffer,0,sizeof(dev->tempBuffer)); ++ memset(dev->tempBuffer, 0, sizeof(dev->tempBuffer)); + + for (i = 0; buf && i < YAFFS_N_TEMP_BUFFERS; i++) { + dev->tempBuffer[i].line = 0; /* not in use */ + dev->tempBuffer[i].buffer = buf = +- YMALLOC_DMA(dev->nDataBytesPerChunk); ++ YMALLOC_DMA(dev->totalBytesPerChunk); + } + + return buf ? YAFFS_OK : YAFFS_FAIL; +- + } + +-static __u8 *yaffs_GetTempBuffer(yaffs_Device * dev, int lineNo) ++__u8 *yaffs_GetTempBuffer(yaffs_Device *dev, int lineNo) + { + int i, j; ++ ++ dev->tempInUse++; ++ if (dev->tempInUse > dev->maxTemp) ++ dev->maxTemp = dev->tempInUse; ++ + for (i = 0; i < YAFFS_N_TEMP_BUFFERS; i++) { + if (dev->tempBuffer[i].line == 0) { + dev->tempBuffer[i].line = lineNo; +@@ -227,9 +234,9 @@ static __u8 *yaffs_GetTempBuffer(yaffs_D + T(YAFFS_TRACE_BUFFERS, + (TSTR("Out of temp buffers at line %d, other held by lines:"), + lineNo)); +- for (i = 0; i < YAFFS_N_TEMP_BUFFERS; i++) { ++ for (i = 0; i < YAFFS_N_TEMP_BUFFERS; i++) + T(YAFFS_TRACE_BUFFERS, (TSTR(" %d "), dev->tempBuffer[i].line)); +- } ++ + T(YAFFS_TRACE_BUFFERS, (TSTR(" " TENDSTR))); + + /* +@@ -242,10 +249,13 @@ static __u8 *yaffs_GetTempBuffer(yaffs_D + + } + +-static void yaffs_ReleaseTempBuffer(yaffs_Device * dev, __u8 * buffer, ++void yaffs_ReleaseTempBuffer(yaffs_Device *dev, __u8 *buffer, + int lineNo) + { + int i; ++ ++ dev->tempInUse--; ++ + for (i = 0; i < YAFFS_N_TEMP_BUFFERS; i++) { + if (dev->tempBuffer[i].buffer == buffer) { + dev->tempBuffer[i].line = 0; +@@ -267,27 +277,26 @@ static void yaffs_ReleaseTempBuffer(yaff + /* + * Determine if we have a managed buffer. + */ +-int yaffs_IsManagedTempBuffer(yaffs_Device * dev, const __u8 * buffer) ++int yaffs_IsManagedTempBuffer(yaffs_Device *dev, const __u8 *buffer) + { + int i; ++ + for (i = 0; i < YAFFS_N_TEMP_BUFFERS; i++) { + if (dev->tempBuffer[i].buffer == buffer) + return 1; ++ } + ++ for (i = 0; i < dev->nShortOpCaches; i++) { ++ if (dev->srCache[i].data == buffer) ++ return 1; + } + +- for (i = 0; i < dev->nShortOpCaches; i++) { +- if( dev->srCache[i].data == buffer ) +- return 1; +- +- } +- +- if (buffer == dev->checkpointBuffer) +- return 1; +- +- T(YAFFS_TRACE_ALWAYS, +- (TSTR("yaffs: unmaged buffer detected.\n" TENDSTR))); +- return 0; ++ if (buffer == dev->checkpointBuffer) ++ return 1; ++ ++ T(YAFFS_TRACE_ALWAYS, ++ (TSTR("yaffs: unmaged buffer detected.\n" TENDSTR))); ++ return 0; + } + + +@@ -296,62 +305,63 @@ int yaffs_IsManagedTempBuffer(yaffs_Devi + * Chunk bitmap manipulations + */ + +-static Y_INLINE __u8 *yaffs_BlockBits(yaffs_Device * dev, int blk) ++static Y_INLINE __u8 *yaffs_BlockBits(yaffs_Device *dev, int blk) + { + if (blk < dev->internalStartBlock || blk > dev->internalEndBlock) { + T(YAFFS_TRACE_ERROR, +- (TSTR("**>> yaffs: BlockBits block %d is not valid" TENDSTR), +- blk)); ++ (TSTR("**>> yaffs: BlockBits block %d is not valid" TENDSTR), ++ blk)); + YBUG(); + } + return dev->chunkBits + +- (dev->chunkBitmapStride * (blk - dev->internalStartBlock)); ++ (dev->chunkBitmapStride * (blk - dev->internalStartBlock)); + } + + static Y_INLINE void yaffs_VerifyChunkBitId(yaffs_Device *dev, int blk, int chunk) + { +- if(blk < dev->internalStartBlock || blk > dev->internalEndBlock || +- chunk < 0 || chunk >= dev->nChunksPerBlock) { +- T(YAFFS_TRACE_ERROR, +- (TSTR("**>> yaffs: Chunk Id (%d:%d) invalid"TENDSTR),blk,chunk)); +- YBUG(); ++ if (blk < dev->internalStartBlock || blk > dev->internalEndBlock || ++ chunk < 0 || chunk >= dev->nChunksPerBlock) { ++ T(YAFFS_TRACE_ERROR, ++ (TSTR("**>> yaffs: Chunk Id (%d:%d) invalid"TENDSTR), ++ blk, chunk)); ++ YBUG(); + } + } + +-static Y_INLINE void yaffs_ClearChunkBits(yaffs_Device * dev, int blk) ++static Y_INLINE void yaffs_ClearChunkBits(yaffs_Device *dev, int blk) + { + __u8 *blkBits = yaffs_BlockBits(dev, blk); + + memset(blkBits, 0, dev->chunkBitmapStride); + } + +-static Y_INLINE void yaffs_ClearChunkBit(yaffs_Device * dev, int blk, int chunk) ++static Y_INLINE void yaffs_ClearChunkBit(yaffs_Device *dev, int blk, int chunk) + { + __u8 *blkBits = yaffs_BlockBits(dev, blk); + +- yaffs_VerifyChunkBitId(dev,blk,chunk); ++ yaffs_VerifyChunkBitId(dev, blk, chunk); + + blkBits[chunk / 8] &= ~(1 << (chunk & 7)); + } + +-static Y_INLINE void yaffs_SetChunkBit(yaffs_Device * dev, int blk, int chunk) ++static Y_INLINE void yaffs_SetChunkBit(yaffs_Device *dev, int blk, int chunk) + { + __u8 *blkBits = yaffs_BlockBits(dev, blk); + +- yaffs_VerifyChunkBitId(dev,blk,chunk); ++ yaffs_VerifyChunkBitId(dev, blk, chunk); + + blkBits[chunk / 8] |= (1 << (chunk & 7)); + } + +-static Y_INLINE int yaffs_CheckChunkBit(yaffs_Device * dev, int blk, int chunk) ++static Y_INLINE int yaffs_CheckChunkBit(yaffs_Device *dev, int blk, int chunk) + { + __u8 *blkBits = yaffs_BlockBits(dev, blk); +- yaffs_VerifyChunkBitId(dev,blk,chunk); ++ yaffs_VerifyChunkBitId(dev, blk, chunk); + + return (blkBits[chunk / 8] & (1 << (chunk & 7))) ? 1 : 0; + } + +-static Y_INLINE int yaffs_StillSomeChunkBits(yaffs_Device * dev, int blk) ++static Y_INLINE int yaffs_StillSomeChunkBits(yaffs_Device *dev, int blk) + { + __u8 *blkBits = yaffs_BlockBits(dev, blk); + int i; +@@ -363,17 +373,17 @@ static Y_INLINE int yaffs_StillSomeChunk + return 0; + } + +-static int yaffs_CountChunkBits(yaffs_Device * dev, int blk) ++static int yaffs_CountChunkBits(yaffs_Device *dev, int blk) + { + __u8 *blkBits = yaffs_BlockBits(dev, blk); + int i; + int n = 0; + for (i = 0; i < dev->chunkBitmapStride; i++) { + __u8 x = *blkBits; +- while(x){ +- if(x & 1) ++ while (x) { ++ if (x & 1) + n++; +- x >>=1; ++ x >>= 1; + } + + blkBits++; +@@ -400,7 +410,7 @@ static int yaffs_SkipNANDVerification(ya + return !(yaffs_traceMask & (YAFFS_TRACE_VERIFY_NAND)); + } + +-static const char * blockStateName[] = { ++static const char *blockStateName[] = { + "Unknown", + "Needs scanning", + "Scanning", +@@ -413,64 +423,65 @@ static const char * blockStateName[] = { + "Dead" + }; + +-static void yaffs_VerifyBlock(yaffs_Device *dev,yaffs_BlockInfo *bi,int n) ++static void yaffs_VerifyBlock(yaffs_Device *dev, yaffs_BlockInfo *bi, int n) + { + int actuallyUsed; + int inUse; + +- if(yaffs_SkipVerification(dev)) ++ if (yaffs_SkipVerification(dev)) + return; + + /* Report illegal runtime states */ +- if(bi->blockState <0 || bi->blockState >= YAFFS_NUMBER_OF_BLOCK_STATES) +- T(YAFFS_TRACE_VERIFY,(TSTR("Block %d has undefined state %d"TENDSTR),n,bi->blockState)); ++ if (bi->blockState >= YAFFS_NUMBER_OF_BLOCK_STATES) ++ T(YAFFS_TRACE_VERIFY, (TSTR("Block %d has undefined state %d"TENDSTR), n, bi->blockState)); + +- switch(bi->blockState){ +- case YAFFS_BLOCK_STATE_UNKNOWN: +- case YAFFS_BLOCK_STATE_SCANNING: +- case YAFFS_BLOCK_STATE_NEEDS_SCANNING: +- T(YAFFS_TRACE_VERIFY,(TSTR("Block %d has bad run-state %s"TENDSTR), +- n,blockStateName[bi->blockState])); ++ switch (bi->blockState) { ++ case YAFFS_BLOCK_STATE_UNKNOWN: ++ case YAFFS_BLOCK_STATE_SCANNING: ++ case YAFFS_BLOCK_STATE_NEEDS_SCANNING: ++ T(YAFFS_TRACE_VERIFY, (TSTR("Block %d has bad run-state %s"TENDSTR), ++ n, blockStateName[bi->blockState])); + } + + /* Check pages in use and soft deletions are legal */ + + actuallyUsed = bi->pagesInUse - bi->softDeletions; + +- if(bi->pagesInUse < 0 || bi->pagesInUse > dev->nChunksPerBlock || ++ if (bi->pagesInUse < 0 || bi->pagesInUse > dev->nChunksPerBlock || + bi->softDeletions < 0 || bi->softDeletions > dev->nChunksPerBlock || + actuallyUsed < 0 || actuallyUsed > dev->nChunksPerBlock) +- T(YAFFS_TRACE_VERIFY,(TSTR("Block %d has illegal values pagesInUsed %d softDeletions %d"TENDSTR), +- n,bi->pagesInUse,bi->softDeletions)); ++ T(YAFFS_TRACE_VERIFY, (TSTR("Block %d has illegal values pagesInUsed %d softDeletions %d"TENDSTR), ++ n, bi->pagesInUse, bi->softDeletions)); + + + /* Check chunk bitmap legal */ +- inUse = yaffs_CountChunkBits(dev,n); +- if(inUse != bi->pagesInUse) +- T(YAFFS_TRACE_VERIFY,(TSTR("Block %d has inconsistent values pagesInUse %d counted chunk bits %d"TENDSTR), +- n,bi->pagesInUse,inUse)); ++ inUse = yaffs_CountChunkBits(dev, n); ++ if (inUse != bi->pagesInUse) ++ T(YAFFS_TRACE_VERIFY, (TSTR("Block %d has inconsistent values pagesInUse %d counted chunk bits %d"TENDSTR), ++ n, bi->pagesInUse, inUse)); + + /* Check that the sequence number is valid. + * Ten million is legal, but is very unlikely + */ +- if(dev->isYaffs2 && ++ if (dev->isYaffs2 && + (bi->blockState == YAFFS_BLOCK_STATE_ALLOCATING || bi->blockState == YAFFS_BLOCK_STATE_FULL) && +- (bi->sequenceNumber < YAFFS_LOWEST_SEQUENCE_NUMBER || bi->sequenceNumber > 10000000 )) +- T(YAFFS_TRACE_VERIFY,(TSTR("Block %d has suspect sequence number of %d"TENDSTR), +- n,bi->sequenceNumber)); +- ++ (bi->sequenceNumber < YAFFS_LOWEST_SEQUENCE_NUMBER || bi->sequenceNumber > 10000000)) ++ T(YAFFS_TRACE_VERIFY, (TSTR("Block %d has suspect sequence number of %d"TENDSTR), ++ n, bi->sequenceNumber)); + } + +-static void yaffs_VerifyCollectedBlock(yaffs_Device *dev,yaffs_BlockInfo *bi,int n) ++static void yaffs_VerifyCollectedBlock(yaffs_Device *dev, yaffs_BlockInfo *bi, ++ int n) + { +- yaffs_VerifyBlock(dev,bi,n); ++ yaffs_VerifyBlock(dev, bi, n); + + /* After collection the block should be in the erased state */ +- /* TODO: This will need to change if we do partial gc */ ++ /* This will need to change if we do partial gc */ + +- if(bi->blockState != YAFFS_BLOCK_STATE_EMPTY){ +- T(YAFFS_TRACE_ERROR,(TSTR("Block %d is in state %d after gc, should be erased"TENDSTR), +- n,bi->blockState)); ++ if (bi->blockState != YAFFS_BLOCK_STATE_COLLECTING && ++ bi->blockState != YAFFS_BLOCK_STATE_EMPTY) { ++ T(YAFFS_TRACE_ERROR, (TSTR("Block %d is in state %d after gc, should be erased"TENDSTR), ++ n, bi->blockState)); + } + } + +@@ -480,52 +491,49 @@ static void yaffs_VerifyBlocks(yaffs_Dev + int nBlocksPerState[YAFFS_NUMBER_OF_BLOCK_STATES]; + int nIllegalBlockStates = 0; + +- +- if(yaffs_SkipVerification(dev)) ++ if (yaffs_SkipVerification(dev)) + return; + +- memset(nBlocksPerState,0,sizeof(nBlocksPerState)); +- ++ memset(nBlocksPerState, 0, sizeof(nBlocksPerState)); + +- for(i = dev->internalStartBlock; i <= dev->internalEndBlock; i++){ +- yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev,i); +- yaffs_VerifyBlock(dev,bi,i); ++ for (i = dev->internalStartBlock; i <= dev->internalEndBlock; i++) { ++ yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev, i); ++ yaffs_VerifyBlock(dev, bi, i); + +- if(bi->blockState >=0 && bi->blockState < YAFFS_NUMBER_OF_BLOCK_STATES) ++ if (bi->blockState < YAFFS_NUMBER_OF_BLOCK_STATES) + nBlocksPerState[bi->blockState]++; + else + nIllegalBlockStates++; +- + } + +- T(YAFFS_TRACE_VERIFY,(TSTR(""TENDSTR))); +- T(YAFFS_TRACE_VERIFY,(TSTR("Block summary"TENDSTR))); ++ T(YAFFS_TRACE_VERIFY, (TSTR(""TENDSTR))); ++ T(YAFFS_TRACE_VERIFY, (TSTR("Block summary"TENDSTR))); + +- T(YAFFS_TRACE_VERIFY,(TSTR("%d blocks have illegal states"TENDSTR),nIllegalBlockStates)); +- if(nBlocksPerState[YAFFS_BLOCK_STATE_ALLOCATING] > 1) +- T(YAFFS_TRACE_VERIFY,(TSTR("Too many allocating blocks"TENDSTR))); ++ T(YAFFS_TRACE_VERIFY, (TSTR("%d blocks have illegal states"TENDSTR), nIllegalBlockStates)); ++ if (nBlocksPerState[YAFFS_BLOCK_STATE_ALLOCATING] > 1) ++ T(YAFFS_TRACE_VERIFY, (TSTR("Too many allocating blocks"TENDSTR))); + +- for(i = 0; i < YAFFS_NUMBER_OF_BLOCK_STATES; i++) ++ for (i = 0; i < YAFFS_NUMBER_OF_BLOCK_STATES; i++) + T(YAFFS_TRACE_VERIFY, + (TSTR("%s %d blocks"TENDSTR), +- blockStateName[i],nBlocksPerState[i])); ++ blockStateName[i], nBlocksPerState[i])); + +- if(dev->blocksInCheckpoint != nBlocksPerState[YAFFS_BLOCK_STATE_CHECKPOINT]) ++ if (dev->blocksInCheckpoint != nBlocksPerState[YAFFS_BLOCK_STATE_CHECKPOINT]) + T(YAFFS_TRACE_VERIFY, + (TSTR("Checkpoint block count wrong dev %d count %d"TENDSTR), + dev->blocksInCheckpoint, nBlocksPerState[YAFFS_BLOCK_STATE_CHECKPOINT])); + +- if(dev->nErasedBlocks != nBlocksPerState[YAFFS_BLOCK_STATE_EMPTY]) ++ if (dev->nErasedBlocks != nBlocksPerState[YAFFS_BLOCK_STATE_EMPTY]) + T(YAFFS_TRACE_VERIFY, + (TSTR("Erased block count wrong dev %d count %d"TENDSTR), + dev->nErasedBlocks, nBlocksPerState[YAFFS_BLOCK_STATE_EMPTY])); + +- if(nBlocksPerState[YAFFS_BLOCK_STATE_COLLECTING] > 1) ++ if (nBlocksPerState[YAFFS_BLOCK_STATE_COLLECTING] > 1) + T(YAFFS_TRACE_VERIFY, + (TSTR("Too many collecting blocks %d (max is 1)"TENDSTR), + nBlocksPerState[YAFFS_BLOCK_STATE_COLLECTING])); + +- T(YAFFS_TRACE_VERIFY,(TSTR(""TENDSTR))); ++ T(YAFFS_TRACE_VERIFY, (TSTR(""TENDSTR))); + + } + +@@ -535,26 +543,26 @@ static void yaffs_VerifyBlocks(yaffs_Dev + */ + static void yaffs_VerifyObjectHeader(yaffs_Object *obj, yaffs_ObjectHeader *oh, yaffs_ExtendedTags *tags, int parentCheck) + { +- if(yaffs_SkipVerification(obj->myDev)) ++ if (obj && yaffs_SkipVerification(obj->myDev)) + return; + +- if(!(tags && obj && oh)){ +- T(YAFFS_TRACE_VERIFY, +- (TSTR("Verifying object header tags %x obj %x oh %x"TENDSTR), +- (__u32)tags,(__u32)obj,(__u32)oh)); ++ if (!(tags && obj && oh)) { ++ T(YAFFS_TRACE_VERIFY, ++ (TSTR("Verifying object header tags %x obj %x oh %x"TENDSTR), ++ (__u32)tags, (__u32)obj, (__u32)oh)); + return; + } + +- if(oh->type <= YAFFS_OBJECT_TYPE_UNKNOWN || +- oh->type > YAFFS_OBJECT_TYPE_MAX) +- T(YAFFS_TRACE_VERIFY, +- (TSTR("Obj %d header type is illegal value 0x%x"TENDSTR), +- tags->objectId, oh->type)); +- +- if(tags->objectId != obj->objectId) +- T(YAFFS_TRACE_VERIFY, +- (TSTR("Obj %d header mismatch objectId %d"TENDSTR), +- tags->objectId, obj->objectId)); ++ if (oh->type <= YAFFS_OBJECT_TYPE_UNKNOWN || ++ oh->type > YAFFS_OBJECT_TYPE_MAX) ++ T(YAFFS_TRACE_VERIFY, ++ (TSTR("Obj %d header type is illegal value 0x%x"TENDSTR), ++ tags->objectId, oh->type)); ++ ++ if (tags->objectId != obj->objectId) ++ T(YAFFS_TRACE_VERIFY, ++ (TSTR("Obj %d header mismatch objectId %d"TENDSTR), ++ tags->objectId, obj->objectId)); + + + /* +@@ -563,46 +571,43 @@ static void yaffs_VerifyObjectHeader(yaf + * Tests do not apply to the root object. + */ + +- if(parentCheck && tags->objectId > 1 && !obj->parent) +- T(YAFFS_TRACE_VERIFY, +- (TSTR("Obj %d header mismatch parentId %d obj->parent is NULL"TENDSTR), +- tags->objectId, oh->parentObjectId)); +- +- +- if(parentCheck && obj->parent && +- oh->parentObjectId != obj->parent->objectId && +- (oh->parentObjectId != YAFFS_OBJECTID_UNLINKED || +- obj->parent->objectId != YAFFS_OBJECTID_DELETED)) +- T(YAFFS_TRACE_VERIFY, +- (TSTR("Obj %d header mismatch parentId %d parentObjectId %d"TENDSTR), +- tags->objectId, oh->parentObjectId, obj->parent->objectId)); ++ if (parentCheck && tags->objectId > 1 && !obj->parent) ++ T(YAFFS_TRACE_VERIFY, ++ (TSTR("Obj %d header mismatch parentId %d obj->parent is NULL"TENDSTR), ++ tags->objectId, oh->parentObjectId)); + ++ if (parentCheck && obj->parent && ++ oh->parentObjectId != obj->parent->objectId && ++ (oh->parentObjectId != YAFFS_OBJECTID_UNLINKED || ++ obj->parent->objectId != YAFFS_OBJECTID_DELETED)) ++ T(YAFFS_TRACE_VERIFY, ++ (TSTR("Obj %d header mismatch parentId %d parentObjectId %d"TENDSTR), ++ tags->objectId, oh->parentObjectId, obj->parent->objectId)); + +- if(tags->objectId > 1 && oh->name[0] == 0) /* Null name */ ++ if (tags->objectId > 1 && oh->name[0] == 0) /* Null name */ + T(YAFFS_TRACE_VERIFY, +- (TSTR("Obj %d header name is NULL"TENDSTR), +- obj->objectId)); ++ (TSTR("Obj %d header name is NULL"TENDSTR), ++ obj->objectId)); + +- if(tags->objectId > 1 && ((__u8)(oh->name[0])) == 0xff) /* Trashed name */ ++ if (tags->objectId > 1 && ((__u8)(oh->name[0])) == 0xff) /* Trashed name */ + T(YAFFS_TRACE_VERIFY, +- (TSTR("Obj %d header name is 0xFF"TENDSTR), +- obj->objectId)); ++ (TSTR("Obj %d header name is 0xFF"TENDSTR), ++ obj->objectId)); + } + + + +-static int yaffs_VerifyTnodeWorker(yaffs_Object * obj, yaffs_Tnode * tn, +- __u32 level, int chunkOffset) ++static int yaffs_VerifyTnodeWorker(yaffs_Object *obj, yaffs_Tnode *tn, ++ __u32 level, int chunkOffset) + { + int i; + yaffs_Device *dev = obj->myDev; + int ok = 1; +- int nTnodeBytes = (dev->tnodeWidth * YAFFS_NTNODES_LEVEL0)/8; + + if (tn) { + if (level > 0) { + +- for (i = 0; i < YAFFS_NTNODES_INTERNAL && ok; i++){ ++ for (i = 0; i < YAFFS_NTNODES_INTERNAL && ok; i++) { + if (tn->internal[i]) { + ok = yaffs_VerifyTnodeWorker(obj, + tn->internal[i], +@@ -611,20 +616,19 @@ static int yaffs_VerifyTnodeWorker(yaffs + } + } + } else if (level == 0) { +- int i; + yaffs_ExtendedTags tags; + __u32 objectId = obj->objectId; + + chunkOffset <<= YAFFS_TNODES_LEVEL0_BITS; + +- for(i = 0; i < YAFFS_NTNODES_LEVEL0; i++){ +- __u32 theChunk = yaffs_GetChunkGroupBase(dev,tn,i); ++ for (i = 0; i < YAFFS_NTNODES_LEVEL0; i++) { ++ __u32 theChunk = yaffs_GetChunkGroupBase(dev, tn, i); + +- if(theChunk > 0){ ++ if (theChunk > 0) { + /* T(~0,(TSTR("verifying (%d:%d) %d"TENDSTR),tags.objectId,tags.chunkId,theChunk)); */ +- yaffs_ReadChunkWithTagsFromNAND(dev,theChunk,NULL, &tags); +- if(tags.objectId != objectId || tags.chunkId != chunkOffset){ +- T(~0,(TSTR("Object %d chunkId %d NAND mismatch chunk %d tags (%d:%d)"TENDSTR), ++ yaffs_ReadChunkWithTagsFromNAND(dev, theChunk, NULL, &tags); ++ if (tags.objectId != objectId || tags.chunkId != chunkOffset) { ++ T(~0, (TSTR("Object %d chunkId %d NAND mismatch chunk %d tags (%d:%d)"TENDSTR), + objectId, chunkOffset, theChunk, + tags.objectId, tags.chunkId)); + } +@@ -646,13 +650,15 @@ static void yaffs_VerifyFile(yaffs_Objec + __u32 lastChunk; + __u32 x; + __u32 i; +- int ok; + yaffs_Device *dev; + yaffs_ExtendedTags tags; + yaffs_Tnode *tn; + __u32 objectId; + +- if(obj && yaffs_SkipVerification(obj->myDev)) ++ if (!obj) ++ return; ++ ++ if (yaffs_SkipVerification(obj->myDev)) + return; + + dev = obj->myDev; +@@ -662,17 +668,17 @@ static void yaffs_VerifyFile(yaffs_Objec + lastChunk = obj->variant.fileVariant.fileSize / dev->nDataBytesPerChunk + 1; + x = lastChunk >> YAFFS_TNODES_LEVEL0_BITS; + requiredTallness = 0; +- while (x> 0) { ++ while (x > 0) { + x >>= YAFFS_TNODES_INTERNAL_BITS; + requiredTallness++; + } + + actualTallness = obj->variant.fileVariant.topLevel; + +- if(requiredTallness > actualTallness ) ++ if (requiredTallness > actualTallness) + T(YAFFS_TRACE_VERIFY, + (TSTR("Obj %d had tnode tallness %d, needs to be %d"TENDSTR), +- obj->objectId,actualTallness, requiredTallness)); ++ obj->objectId, actualTallness, requiredTallness)); + + + /* Check that the chunks in the tnode tree are all correct. +@@ -680,39 +686,31 @@ static void yaffs_VerifyFile(yaffs_Objec + * checking the tags for every chunk match. + */ + +- if(yaffs_SkipNANDVerification(dev)) ++ if (yaffs_SkipNANDVerification(dev)) + return; + +- for(i = 1; i <= lastChunk; i++){ +- tn = yaffs_FindLevel0Tnode(dev, &obj->variant.fileVariant,i); ++ for (i = 1; i <= lastChunk; i++) { ++ tn = yaffs_FindLevel0Tnode(dev, &obj->variant.fileVariant, i); + + if (tn) { +- __u32 theChunk = yaffs_GetChunkGroupBase(dev,tn,i); +- if(theChunk > 0){ ++ __u32 theChunk = yaffs_GetChunkGroupBase(dev, tn, i); ++ if (theChunk > 0) { + /* T(~0,(TSTR("verifying (%d:%d) %d"TENDSTR),objectId,i,theChunk)); */ +- yaffs_ReadChunkWithTagsFromNAND(dev,theChunk,NULL, &tags); +- if(tags.objectId != objectId || tags.chunkId != i){ +- T(~0,(TSTR("Object %d chunkId %d NAND mismatch chunk %d tags (%d:%d)"TENDSTR), ++ yaffs_ReadChunkWithTagsFromNAND(dev, theChunk, NULL, &tags); ++ if (tags.objectId != objectId || tags.chunkId != i) { ++ T(~0, (TSTR("Object %d chunkId %d NAND mismatch chunk %d tags (%d:%d)"TENDSTR), + objectId, i, theChunk, + tags.objectId, tags.chunkId)); + } + } + } +- + } +- + } + +-static void yaffs_VerifyDirectory(yaffs_Object *obj) +-{ +- if(obj && yaffs_SkipVerification(obj->myDev)) +- return; +- +-} + + static void yaffs_VerifyHardLink(yaffs_Object *obj) + { +- if(obj && yaffs_SkipVerification(obj->myDev)) ++ if (obj && yaffs_SkipVerification(obj->myDev)) + return; + + /* Verify sane equivalent object */ +@@ -720,7 +718,7 @@ static void yaffs_VerifyHardLink(yaffs_O + + static void yaffs_VerifySymlink(yaffs_Object *obj) + { +- if(obj && yaffs_SkipVerification(obj->myDev)) ++ if (obj && yaffs_SkipVerification(obj->myDev)) + return; + + /* Verify symlink string */ +@@ -728,7 +726,7 @@ static void yaffs_VerifySymlink(yaffs_Ob + + static void yaffs_VerifySpecial(yaffs_Object *obj) + { +- if(obj && yaffs_SkipVerification(obj->myDev)) ++ if (obj && yaffs_SkipVerification(obj->myDev)) + return; + } + +@@ -740,14 +738,19 @@ static void yaffs_VerifyObject(yaffs_Obj + __u32 chunkMax; + + __u32 chunkIdOk; +- __u32 chunkIsLive; ++ __u32 chunkInRange; ++ __u32 chunkShouldNotBeDeleted; ++ __u32 chunkValid; ++ ++ if (!obj) ++ return; + +- if(!obj) ++ if (obj->beingCreated) + return; + + dev = obj->myDev; + +- if(yaffs_SkipVerification(dev)) ++ if (yaffs_SkipVerification(dev)) + return; + + /* Check sane object header chunk */ +@@ -755,50 +758,54 @@ static void yaffs_VerifyObject(yaffs_Obj + chunkMin = dev->internalStartBlock * dev->nChunksPerBlock; + chunkMax = (dev->internalEndBlock+1) * dev->nChunksPerBlock - 1; + +- chunkIdOk = (obj->chunkId >= chunkMin && obj->chunkId <= chunkMax); +- chunkIsLive = chunkIdOk && ++ chunkInRange = (((unsigned)(obj->hdrChunk)) >= chunkMin && ((unsigned)(obj->hdrChunk)) <= chunkMax); ++ chunkIdOk = chunkInRange || obj->hdrChunk == 0; ++ chunkValid = chunkInRange && + yaffs_CheckChunkBit(dev, +- obj->chunkId / dev->nChunksPerBlock, +- obj->chunkId % dev->nChunksPerBlock); +- if(!obj->fake && +- (!chunkIdOk || !chunkIsLive)) { +- T(YAFFS_TRACE_VERIFY, +- (TSTR("Obj %d has chunkId %d %s %s"TENDSTR), +- obj->objectId,obj->chunkId, +- chunkIdOk ? "" : ",out of range", +- chunkIsLive || !chunkIdOk ? "" : ",marked as deleted")); ++ obj->hdrChunk / dev->nChunksPerBlock, ++ obj->hdrChunk % dev->nChunksPerBlock); ++ chunkShouldNotBeDeleted = chunkInRange && !chunkValid; ++ ++ if (!obj->fake && ++ (!chunkIdOk || chunkShouldNotBeDeleted)) { ++ T(YAFFS_TRACE_VERIFY, ++ (TSTR("Obj %d has chunkId %d %s %s"TENDSTR), ++ obj->objectId, obj->hdrChunk, ++ chunkIdOk ? "" : ",out of range", ++ chunkShouldNotBeDeleted ? ",marked as deleted" : "")); + } + +- if(chunkIdOk && chunkIsLive &&!yaffs_SkipNANDVerification(dev)) { ++ if (chunkValid && !yaffs_SkipNANDVerification(dev)) { + yaffs_ExtendedTags tags; + yaffs_ObjectHeader *oh; +- __u8 *buffer = yaffs_GetTempBuffer(dev,__LINE__); ++ __u8 *buffer = yaffs_GetTempBuffer(dev, __LINE__); + + oh = (yaffs_ObjectHeader *)buffer; + +- yaffs_ReadChunkWithTagsFromNAND(dev, obj->chunkId,buffer, &tags); ++ yaffs_ReadChunkWithTagsFromNAND(dev, obj->hdrChunk, buffer, ++ &tags); + +- yaffs_VerifyObjectHeader(obj,oh,&tags,1); ++ yaffs_VerifyObjectHeader(obj, oh, &tags, 1); + +- yaffs_ReleaseTempBuffer(dev,buffer,__LINE__); ++ yaffs_ReleaseTempBuffer(dev, buffer, __LINE__); + } + + /* Verify it has a parent */ +- if(obj && !obj->fake && +- (!obj->parent || obj->parent->myDev != dev)){ +- T(YAFFS_TRACE_VERIFY, +- (TSTR("Obj %d has parent pointer %p which does not look like an object"TENDSTR), +- obj->objectId,obj->parent)); ++ if (obj && !obj->fake && ++ (!obj->parent || obj->parent->myDev != dev)) { ++ T(YAFFS_TRACE_VERIFY, ++ (TSTR("Obj %d has parent pointer %p which does not look like an object"TENDSTR), ++ obj->objectId, obj->parent)); + } + + /* Verify parent is a directory */ +- if(obj->parent && obj->parent->variantType != YAFFS_OBJECT_TYPE_DIRECTORY){ +- T(YAFFS_TRACE_VERIFY, +- (TSTR("Obj %d's parent is not a directory (type %d)"TENDSTR), +- obj->objectId,obj->parent->variantType)); ++ if (obj->parent && obj->parent->variantType != YAFFS_OBJECT_TYPE_DIRECTORY) { ++ T(YAFFS_TRACE_VERIFY, ++ (TSTR("Obj %d's parent is not a directory (type %d)"TENDSTR), ++ obj->objectId, obj->parent->variantType)); + } + +- switch(obj->variantType){ ++ switch (obj->variantType) { + case YAFFS_OBJECT_TYPE_FILE: + yaffs_VerifyFile(obj); + break; +@@ -818,33 +825,30 @@ static void yaffs_VerifyObject(yaffs_Obj + default: + T(YAFFS_TRACE_VERIFY, + (TSTR("Obj %d has illegaltype %d"TENDSTR), +- obj->objectId,obj->variantType)); ++ obj->objectId, obj->variantType)); + break; + } +- +- + } + + static void yaffs_VerifyObjects(yaffs_Device *dev) + { + yaffs_Object *obj; + int i; +- struct list_head *lh; ++ struct ylist_head *lh; + +- if(yaffs_SkipVerification(dev)) ++ if (yaffs_SkipVerification(dev)) + return; + + /* Iterate through the objects in each hash entry */ + +- for(i = 0; i < YAFFS_NOBJECT_BUCKETS; i++){ +- list_for_each(lh, &dev->objectBucket[i].list) { ++ for (i = 0; i < YAFFS_NOBJECT_BUCKETS; i++) { ++ ylist_for_each(lh, &dev->objectBucket[i].list) { + if (lh) { +- obj = list_entry(lh, yaffs_Object, hashLink); ++ obj = ylist_entry(lh, yaffs_Object, hashLink); + yaffs_VerifyObject(obj); + } + } +- } +- ++ } + } + + +@@ -855,19 +859,20 @@ static void yaffs_VerifyObjects(yaffs_De + static Y_INLINE int yaffs_HashFunction(int n) + { + n = abs(n); +- return (n % YAFFS_NOBJECT_BUCKETS); ++ return n % YAFFS_NOBJECT_BUCKETS; + } + + /* +- * Access functions to useful fake objects ++ * Access functions to useful fake objects. ++ * Note that root might have a presence in NAND if permissions are set. + */ + +-yaffs_Object *yaffs_Root(yaffs_Device * dev) ++yaffs_Object *yaffs_Root(yaffs_Device *dev) + { + return dev->rootDir; + } + +-yaffs_Object *yaffs_LostNFound(yaffs_Device * dev) ++yaffs_Object *yaffs_LostNFound(yaffs_Device *dev) + { + return dev->lostNFoundDir; + } +@@ -877,7 +882,7 @@ yaffs_Object *yaffs_LostNFound(yaffs_Dev + * Erased NAND checking functions + */ + +-int yaffs_CheckFF(__u8 * buffer, int nBytes) ++int yaffs_CheckFF(__u8 *buffer, int nBytes) + { + /* Horrible, slow implementation */ + while (nBytes--) { +@@ -889,9 +894,8 @@ int yaffs_CheckFF(__u8 * buffer, int nBy + } + + static int yaffs_CheckChunkErased(struct yaffs_DeviceStruct *dev, +- int chunkInNAND) ++ int chunkInNAND) + { +- + int retval = YAFFS_OK; + __u8 *data = yaffs_GetTempBuffer(dev, __LINE__); + yaffs_ExtendedTags tags; +@@ -899,10 +903,9 @@ static int yaffs_CheckChunkErased(struct + + result = yaffs_ReadChunkWithTagsFromNAND(dev, chunkInNAND, data, &tags); + +- if(tags.eccResult > YAFFS_ECC_RESULT_NO_ERROR) ++ if (tags.eccResult > YAFFS_ECC_RESULT_NO_ERROR) + retval = YAFFS_FAIL; + +- + if (!yaffs_CheckFF(data, dev->nDataBytesPerChunk) || tags.chunkUsed) { + T(YAFFS_TRACE_NANDACCESS, + (TSTR("Chunk %d not erased" TENDSTR), chunkInNAND)); +@@ -915,11 +918,10 @@ static int yaffs_CheckChunkErased(struct + + } + +- + static int yaffs_WriteNewChunkWithTagsToNAND(struct yaffs_DeviceStruct *dev, +- const __u8 * data, +- yaffs_ExtendedTags * tags, +- int useReserve) ++ const __u8 *data, ++ yaffs_ExtendedTags *tags, ++ int useReserve) + { + int attempts = 0; + int writeOk = 0; +@@ -972,7 +974,7 @@ static int yaffs_WriteNewChunkWithTagsTo + erasedOk = yaffs_CheckChunkErased(dev, chunk); + if (erasedOk != YAFFS_OK) { + T(YAFFS_TRACE_ERROR, +- (TSTR ("**>> yaffs chunk %d was not erased" ++ (TSTR("**>> yaffs chunk %d was not erased" + TENDSTR), chunk)); + + /* try another chunk */ +@@ -992,7 +994,11 @@ static int yaffs_WriteNewChunkWithTagsTo + /* Copy the data into the robustification buffer */ + yaffs_HandleWriteChunkOk(dev, chunk, data, tags); + +- } while (writeOk != YAFFS_OK && attempts < yaffs_wr_attempts); ++ } while (writeOk != YAFFS_OK && ++ (yaffs_wr_attempts <= 0 || attempts <= yaffs_wr_attempts)); ++ ++ if (!writeOk) ++ chunk = -1; + + if (attempts > 1) { + T(YAFFS_TRACE_ERROR, +@@ -1009,13 +1015,35 @@ static int yaffs_WriteNewChunkWithTagsTo + * Block retiring for handling a broken block. + */ + +-static void yaffs_RetireBlock(yaffs_Device * dev, int blockInNAND) ++static void yaffs_RetireBlock(yaffs_Device *dev, int blockInNAND) + { + yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev, blockInNAND); + + yaffs_InvalidateCheckpoint(dev); + +- yaffs_MarkBlockBad(dev, blockInNAND); ++ if (yaffs_MarkBlockBad(dev, blockInNAND) != YAFFS_OK) { ++ if (yaffs_EraseBlockInNAND(dev, blockInNAND) != YAFFS_OK) { ++ T(YAFFS_TRACE_ALWAYS, (TSTR( ++ "yaffs: Failed to mark bad and erase block %d" ++ TENDSTR), blockInNAND)); ++ } else { ++ yaffs_ExtendedTags tags; ++ int chunkId = blockInNAND * dev->nChunksPerBlock; ++ ++ __u8 *buffer = yaffs_GetTempBuffer(dev, __LINE__); ++ ++ memset(buffer, 0xff, dev->nDataBytesPerChunk); ++ yaffs_InitialiseTags(&tags); ++ tags.sequenceNumber = YAFFS_SEQUENCE_BAD_BLOCK; ++ if (dev->writeChunkWithTagsToNAND(dev, chunkId - ++ dev->chunkOffset, buffer, &tags) != YAFFS_OK) ++ T(YAFFS_TRACE_ALWAYS, (TSTR("yaffs: Failed to " ++ TCONT("write bad block marker to block %d") ++ TENDSTR), blockInNAND)); ++ ++ yaffs_ReleaseTempBuffer(dev, buffer, __LINE__); ++ } ++ } + + bi->blockState = YAFFS_BLOCK_STATE_DEAD; + bi->gcPrioritise = 0; +@@ -1029,49 +1057,45 @@ static void yaffs_RetireBlock(yaffs_Devi + * + */ + +-static void yaffs_HandleWriteChunkOk(yaffs_Device * dev, int chunkInNAND, +- const __u8 * data, +- const yaffs_ExtendedTags * tags) ++static void yaffs_HandleWriteChunkOk(yaffs_Device *dev, int chunkInNAND, ++ const __u8 *data, ++ const yaffs_ExtendedTags *tags) + { + } + +-static void yaffs_HandleUpdateChunk(yaffs_Device * dev, int chunkInNAND, +- const yaffs_ExtendedTags * tags) ++static void yaffs_HandleUpdateChunk(yaffs_Device *dev, int chunkInNAND, ++ const yaffs_ExtendedTags *tags) + { + } + + void yaffs_HandleChunkError(yaffs_Device *dev, yaffs_BlockInfo *bi) + { +- if(!bi->gcPrioritise){ ++ if (!bi->gcPrioritise) { + bi->gcPrioritise = 1; + dev->hasPendingPrioritisedGCs = 1; +- bi->chunkErrorStrikes ++; ++ bi->chunkErrorStrikes++; + +- if(bi->chunkErrorStrikes > 3){ ++ if (bi->chunkErrorStrikes > 3) { + bi->needsRetiring = 1; /* Too many stikes, so retire this */ + T(YAFFS_TRACE_ALWAYS, (TSTR("yaffs: Block struck out" TENDSTR))); + + } +- + } + } + +-static void yaffs_HandleWriteChunkError(yaffs_Device * dev, int chunkInNAND, int erasedOk) ++static void yaffs_HandleWriteChunkError(yaffs_Device *dev, int chunkInNAND, ++ int erasedOk) + { +- + int blockInNAND = chunkInNAND / dev->nChunksPerBlock; + yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev, blockInNAND); + +- yaffs_HandleChunkError(dev,bi); ++ yaffs_HandleChunkError(dev, bi); + +- +- if(erasedOk ) { ++ if (erasedOk) { + /* Was an actual write failure, so mark the block for retirement */ + bi->needsRetiring = 1; + T(YAFFS_TRACE_ERROR | YAFFS_TRACE_BAD_BLOCKS, + (TSTR("**>> Block %d needs retiring" TENDSTR), blockInNAND)); +- +- + } + + /* Delete the chunk */ +@@ -1081,12 +1105,12 @@ static void yaffs_HandleWriteChunkError( + + /*---------------- Name handling functions ------------*/ + +-static __u16 yaffs_CalcNameSum(const YCHAR * name) ++static __u16 yaffs_CalcNameSum(const YCHAR *name) + { + __u16 sum = 0; + __u16 i = 1; + +- YUCHAR *bname = (YUCHAR *) name; ++ const YUCHAR *bname = (const YUCHAR *) name; + if (bname) { + while ((*bname) && (i < (YAFFS_MAX_NAME_LENGTH/2))) { + +@@ -1102,14 +1126,14 @@ static __u16 yaffs_CalcNameSum(const YCH + return sum; + } + +-static void yaffs_SetObjectName(yaffs_Object * obj, const YCHAR * name) ++static void yaffs_SetObjectName(yaffs_Object *obj, const YCHAR *name) + { + #ifdef CONFIG_YAFFS_SHORT_NAMES_IN_RAM +- if (name && yaffs_strlen(name) <= YAFFS_SHORT_NAME_LENGTH) { ++ memset(obj->shortName, 0, sizeof(YCHAR) * (YAFFS_SHORT_NAME_LENGTH+1)); ++ if (name && yaffs_strlen(name) <= YAFFS_SHORT_NAME_LENGTH) + yaffs_strcpy(obj->shortName, name); +- } else { ++ else + obj->shortName[0] = _Y('\0'); +- } + #endif + obj->sum = yaffs_CalcNameSum(name); + } +@@ -1126,7 +1150,7 @@ static void yaffs_SetObjectName(yaffs_Ob + * Don't use this function directly + */ + +-static int yaffs_CreateTnodes(yaffs_Device * dev, int nTnodes) ++static int yaffs_CreateTnodes(yaffs_Device *dev, int nTnodes) + { + int i; + int tnodeSize; +@@ -1143,6 +1167,9 @@ static int yaffs_CreateTnodes(yaffs_Devi + * Must be a multiple of 32-bits */ + tnodeSize = (dev->tnodeWidth * YAFFS_NTNODES_LEVEL0)/8; + ++ if (tnodeSize < sizeof(yaffs_Tnode)) ++ tnodeSize = sizeof(yaffs_Tnode); ++ + /* make these things */ + + newTnodes = YMALLOC(nTnodes * tnodeSize); +@@ -1150,7 +1177,7 @@ static int yaffs_CreateTnodes(yaffs_Devi + + if (!newTnodes) { + T(YAFFS_TRACE_ERROR, +- (TSTR("yaffs: Could not allocate Tnodes" TENDSTR))); ++ (TSTR("yaffs: Could not allocate Tnodes" TENDSTR))); + return YAFFS_FAIL; + } + +@@ -1170,7 +1197,7 @@ static int yaffs_CreateTnodes(yaffs_Devi + dev->freeTnodes = newTnodes; + #else + /* New hookup for wide tnodes */ +- for(i = 0; i < nTnodes -1; i++) { ++ for (i = 0; i < nTnodes - 1; i++) { + curr = (yaffs_Tnode *) &mem[i * tnodeSize]; + next = (yaffs_Tnode *) &mem[(i+1) * tnodeSize]; + curr->internal[0] = next; +@@ -1197,7 +1224,6 @@ static int yaffs_CreateTnodes(yaffs_Devi + (TSTR + ("yaffs: Could not add tnodes to management list" TENDSTR))); + return YAFFS_FAIL; +- + } else { + tnl->tnodes = newTnodes; + tnl->next = dev->allocatedTnodeList; +@@ -1211,14 +1237,13 @@ static int yaffs_CreateTnodes(yaffs_Devi + + /* GetTnode gets us a clean tnode. Tries to make allocate more if we run out */ + +-static yaffs_Tnode *yaffs_GetTnodeRaw(yaffs_Device * dev) ++static yaffs_Tnode *yaffs_GetTnodeRaw(yaffs_Device *dev) + { + yaffs_Tnode *tn = NULL; + + /* If there are none left make more */ +- if (!dev->freeTnodes) { ++ if (!dev->freeTnodes) + yaffs_CreateTnodes(dev, YAFFS_ALLOCATION_NTNODES); +- } + + if (dev->freeTnodes) { + tn = dev->freeTnodes; +@@ -1233,21 +1258,27 @@ static yaffs_Tnode *yaffs_GetTnodeRaw(ya + dev->nFreeTnodes--; + } + ++ dev->nCheckpointBlocksRequired = 0; /* force recalculation*/ ++ + return tn; + } + +-static yaffs_Tnode *yaffs_GetTnode(yaffs_Device * dev) ++static yaffs_Tnode *yaffs_GetTnode(yaffs_Device *dev) + { + yaffs_Tnode *tn = yaffs_GetTnodeRaw(dev); ++ int tnodeSize = (dev->tnodeWidth * YAFFS_NTNODES_LEVEL0)/8; + +- if(tn) +- memset(tn, 0, (dev->tnodeWidth * YAFFS_NTNODES_LEVEL0)/8); ++ if (tnodeSize < sizeof(yaffs_Tnode)) ++ tnodeSize = sizeof(yaffs_Tnode); ++ ++ if (tn) ++ memset(tn, 0, tnodeSize); + + return tn; + } + + /* FreeTnode frees up a tnode and puts it back on the free list */ +-static void yaffs_FreeTnode(yaffs_Device * dev, yaffs_Tnode * tn) ++static void yaffs_FreeTnode(yaffs_Device *dev, yaffs_Tnode *tn) + { + if (tn) { + #ifdef CONFIG_YAFFS_TNODE_LIST_DEBUG +@@ -1262,9 +1293,10 @@ static void yaffs_FreeTnode(yaffs_Device + dev->freeTnodes = tn; + dev->nFreeTnodes++; + } ++ dev->nCheckpointBlocksRequired = 0; /* force recalculation*/ + } + +-static void yaffs_DeinitialiseTnodes(yaffs_Device * dev) ++static void yaffs_DeinitialiseTnodes(yaffs_Device *dev) + { + /* Free the list of allocated tnodes */ + yaffs_TnodeList *tmp; +@@ -1282,71 +1314,72 @@ static void yaffs_DeinitialiseTnodes(yaf + dev->nFreeTnodes = 0; + } + +-static void yaffs_InitialiseTnodes(yaffs_Device * dev) ++static void yaffs_InitialiseTnodes(yaffs_Device *dev) + { + dev->allocatedTnodeList = NULL; + dev->freeTnodes = NULL; + dev->nFreeTnodes = 0; + dev->nTnodesCreated = 0; +- + } + + +-void yaffs_PutLevel0Tnode(yaffs_Device *dev, yaffs_Tnode *tn, unsigned pos, unsigned val) ++void yaffs_PutLevel0Tnode(yaffs_Device *dev, yaffs_Tnode *tn, unsigned pos, ++ unsigned val) + { +- __u32 *map = (__u32 *)tn; +- __u32 bitInMap; +- __u32 bitInWord; +- __u32 wordInMap; +- __u32 mask; ++ __u32 *map = (__u32 *)tn; ++ __u32 bitInMap; ++ __u32 bitInWord; ++ __u32 wordInMap; ++ __u32 mask; + +- pos &= YAFFS_TNODES_LEVEL0_MASK; +- val >>= dev->chunkGroupBits; ++ pos &= YAFFS_TNODES_LEVEL0_MASK; ++ val >>= dev->chunkGroupBits; + +- bitInMap = pos * dev->tnodeWidth; +- wordInMap = bitInMap /32; +- bitInWord = bitInMap & (32 -1); ++ bitInMap = pos * dev->tnodeWidth; ++ wordInMap = bitInMap / 32; ++ bitInWord = bitInMap & (32 - 1); + +- mask = dev->tnodeMask << bitInWord; ++ mask = dev->tnodeMask << bitInWord; + +- map[wordInMap] &= ~mask; +- map[wordInMap] |= (mask & (val << bitInWord)); ++ map[wordInMap] &= ~mask; ++ map[wordInMap] |= (mask & (val << bitInWord)); + +- if(dev->tnodeWidth > (32-bitInWord)) { +- bitInWord = (32 - bitInWord); +- wordInMap++;; +- mask = dev->tnodeMask >> (/*dev->tnodeWidth -*/ bitInWord); +- map[wordInMap] &= ~mask; +- map[wordInMap] |= (mask & (val >> bitInWord)); +- } ++ if (dev->tnodeWidth > (32 - bitInWord)) { ++ bitInWord = (32 - bitInWord); ++ wordInMap++;; ++ mask = dev->tnodeMask >> (/*dev->tnodeWidth -*/ bitInWord); ++ map[wordInMap] &= ~mask; ++ map[wordInMap] |= (mask & (val >> bitInWord)); ++ } + } + +-static __u32 yaffs_GetChunkGroupBase(yaffs_Device *dev, yaffs_Tnode *tn, unsigned pos) ++static __u32 yaffs_GetChunkGroupBase(yaffs_Device *dev, yaffs_Tnode *tn, ++ unsigned pos) + { +- __u32 *map = (__u32 *)tn; +- __u32 bitInMap; +- __u32 bitInWord; +- __u32 wordInMap; +- __u32 val; ++ __u32 *map = (__u32 *)tn; ++ __u32 bitInMap; ++ __u32 bitInWord; ++ __u32 wordInMap; ++ __u32 val; + +- pos &= YAFFS_TNODES_LEVEL0_MASK; ++ pos &= YAFFS_TNODES_LEVEL0_MASK; + +- bitInMap = pos * dev->tnodeWidth; +- wordInMap = bitInMap /32; +- bitInWord = bitInMap & (32 -1); ++ bitInMap = pos * dev->tnodeWidth; ++ wordInMap = bitInMap / 32; ++ bitInWord = bitInMap & (32 - 1); + +- val = map[wordInMap] >> bitInWord; ++ val = map[wordInMap] >> bitInWord; + +- if(dev->tnodeWidth > (32-bitInWord)) { +- bitInWord = (32 - bitInWord); +- wordInMap++;; +- val |= (map[wordInMap] << bitInWord); +- } ++ if (dev->tnodeWidth > (32 - bitInWord)) { ++ bitInWord = (32 - bitInWord); ++ wordInMap++;; ++ val |= (map[wordInMap] << bitInWord); ++ } + +- val &= dev->tnodeMask; +- val <<= dev->chunkGroupBits; ++ val &= dev->tnodeMask; ++ val <<= dev->chunkGroupBits; + +- return val; ++ return val; + } + + /* ------------------- End of individual tnode manipulation -----------------*/ +@@ -1357,24 +1390,21 @@ static __u32 yaffs_GetChunkGroupBase(yaf + */ + + /* FindLevel0Tnode finds the level 0 tnode, if one exists. */ +-static yaffs_Tnode *yaffs_FindLevel0Tnode(yaffs_Device * dev, +- yaffs_FileStructure * fStruct, +- __u32 chunkId) ++static yaffs_Tnode *yaffs_FindLevel0Tnode(yaffs_Device *dev, ++ yaffs_FileStructure *fStruct, ++ __u32 chunkId) + { +- + yaffs_Tnode *tn = fStruct->top; + __u32 i; + int requiredTallness; + int level = fStruct->topLevel; + + /* Check sane level and chunk Id */ +- if (level < 0 || level > YAFFS_TNODES_MAX_LEVEL) { ++ if (level < 0 || level > YAFFS_TNODES_MAX_LEVEL) + return NULL; +- } + +- if (chunkId > YAFFS_MAX_CHUNK_ID) { ++ if (chunkId > YAFFS_MAX_CHUNK_ID) + return NULL; +- } + + /* First check we're tall enough (ie enough topLevel) */ + +@@ -1385,22 +1415,17 @@ static yaffs_Tnode *yaffs_FindLevel0Tnod + requiredTallness++; + } + +- if (requiredTallness > fStruct->topLevel) { +- /* Not tall enough, so we can't find it, return NULL. */ +- return NULL; +- } ++ if (requiredTallness > fStruct->topLevel) ++ return NULL; /* Not tall enough, so we can't find it */ + + /* Traverse down to level 0 */ + while (level > 0 && tn) { +- tn = tn-> +- internal[(chunkId >> +- ( YAFFS_TNODES_LEVEL0_BITS + +- (level - 1) * +- YAFFS_TNODES_INTERNAL_BITS) +- ) & +- YAFFS_TNODES_INTERNAL_MASK]; ++ tn = tn->internal[(chunkId >> ++ (YAFFS_TNODES_LEVEL0_BITS + ++ (level - 1) * ++ YAFFS_TNODES_INTERNAL_BITS)) & ++ YAFFS_TNODES_INTERNAL_MASK]; + level--; +- + } + + return tn; +@@ -1417,12 +1442,11 @@ static yaffs_Tnode *yaffs_FindLevel0Tnod + * be plugged into the ttree. + */ + +-static yaffs_Tnode *yaffs_AddOrFindLevel0Tnode(yaffs_Device * dev, +- yaffs_FileStructure * fStruct, +- __u32 chunkId, +- yaffs_Tnode *passedTn) ++static yaffs_Tnode *yaffs_AddOrFindLevel0Tnode(yaffs_Device *dev, ++ yaffs_FileStructure *fStruct, ++ __u32 chunkId, ++ yaffs_Tnode *passedTn) + { +- + int requiredTallness; + int i; + int l; +@@ -1432,13 +1456,11 @@ static yaffs_Tnode *yaffs_AddOrFindLevel + + + /* Check sane level and page Id */ +- if (fStruct->topLevel < 0 || fStruct->topLevel > YAFFS_TNODES_MAX_LEVEL) { ++ if (fStruct->topLevel < 0 || fStruct->topLevel > YAFFS_TNODES_MAX_LEVEL) + return NULL; +- } + +- if (chunkId > YAFFS_MAX_CHUNK_ID) { ++ if (chunkId > YAFFS_MAX_CHUNK_ID) + return NULL; +- } + + /* First check we're tall enough (ie enough topLevel) */ + +@@ -1451,7 +1473,7 @@ static yaffs_Tnode *yaffs_AddOrFindLevel + + + if (requiredTallness > fStruct->topLevel) { +- /* Not tall enough,gotta make the tree taller */ ++ /* Not tall enough, gotta make the tree taller */ + for (i = fStruct->topLevel; i < requiredTallness; i++) { + + tn = yaffs_GetTnode(dev); +@@ -1473,27 +1495,27 @@ static yaffs_Tnode *yaffs_AddOrFindLevel + l = fStruct->topLevel; + tn = fStruct->top; + +- if(l > 0) { ++ if (l > 0) { + while (l > 0 && tn) { + x = (chunkId >> +- ( YAFFS_TNODES_LEVEL0_BITS + ++ (YAFFS_TNODES_LEVEL0_BITS + + (l - 1) * YAFFS_TNODES_INTERNAL_BITS)) & + YAFFS_TNODES_INTERNAL_MASK; + + +- if((l>1) && !tn->internal[x]){ ++ if ((l > 1) && !tn->internal[x]) { + /* Add missing non-level-zero tnode */ + tn->internal[x] = yaffs_GetTnode(dev); + +- } else if(l == 1) { ++ } else if (l == 1) { + /* Looking from level 1 at level 0 */ +- if (passedTn) { ++ if (passedTn) { + /* If we already have one, then release it.*/ +- if(tn->internal[x]) +- yaffs_FreeTnode(dev,tn->internal[x]); ++ if (tn->internal[x]) ++ yaffs_FreeTnode(dev, tn->internal[x]); + tn->internal[x] = passedTn; + +- } else if(!tn->internal[x]) { ++ } else if (!tn->internal[x]) { + /* Don't have one, none passed in */ + tn->internal[x] = yaffs_GetTnode(dev); + } +@@ -1504,31 +1526,29 @@ static yaffs_Tnode *yaffs_AddOrFindLevel + } + } else { + /* top is level 0 */ +- if(passedTn) { +- memcpy(tn,passedTn,(dev->tnodeWidth * YAFFS_NTNODES_LEVEL0)/8); +- yaffs_FreeTnode(dev,passedTn); ++ if (passedTn) { ++ memcpy(tn, passedTn, (dev->tnodeWidth * YAFFS_NTNODES_LEVEL0)/8); ++ yaffs_FreeTnode(dev, passedTn); + } + } + + return tn; + } + +-static int yaffs_FindChunkInGroup(yaffs_Device * dev, int theChunk, +- yaffs_ExtendedTags * tags, int objectId, +- int chunkInInode) ++static int yaffs_FindChunkInGroup(yaffs_Device *dev, int theChunk, ++ yaffs_ExtendedTags *tags, int objectId, ++ int chunkInInode) + { + int j; + + for (j = 0; theChunk && j < dev->chunkGroupSize; j++) { +- if (yaffs_CheckChunkBit +- (dev, theChunk / dev->nChunksPerBlock, +- theChunk % dev->nChunksPerBlock)) { ++ if (yaffs_CheckChunkBit(dev, theChunk / dev->nChunksPerBlock, ++ theChunk % dev->nChunksPerBlock)) { + yaffs_ReadChunkWithTagsFromNAND(dev, theChunk, NULL, + tags); + if (yaffs_TagsMatch(tags, objectId, chunkInInode)) { + /* found it; */ + return theChunk; +- + } + } + theChunk++; +@@ -1543,7 +1563,7 @@ static int yaffs_FindChunkInGroup(yaffs_ + * Returns 0 if it stopped early due to hitting the limit and the delete is incomplete. + */ + +-static int yaffs_DeleteWorker(yaffs_Object * in, yaffs_Tnode * tn, __u32 level, ++static int yaffs_DeleteWorker(yaffs_Object *in, yaffs_Tnode *tn, __u32 level, + int chunkOffset, int *limit) + { + int i; +@@ -1557,7 +1577,6 @@ static int yaffs_DeleteWorker(yaffs_Obje + + if (tn) { + if (level > 0) { +- + for (i = YAFFS_NTNODES_INTERNAL - 1; allDone && i >= 0; + i--) { + if (tn->internal[i]) { +@@ -1565,17 +1584,17 @@ static int yaffs_DeleteWorker(yaffs_Obje + allDone = 0; + } else { + allDone = +- yaffs_DeleteWorker(in, +- tn-> +- internal +- [i], +- level - +- 1, +- (chunkOffset ++ yaffs_DeleteWorker(in, ++ tn-> ++ internal ++ [i], ++ level - ++ 1, ++ (chunkOffset + << + YAFFS_TNODES_INTERNAL_BITS) +- + i, +- limit); ++ + i, ++ limit); + } + if (allDone) { + yaffs_FreeTnode(dev, +@@ -1584,27 +1603,25 @@ static int yaffs_DeleteWorker(yaffs_Obje + tn->internal[i] = NULL; + } + } +- + } + return (allDone) ? 1 : 0; + } else if (level == 0) { + int hitLimit = 0; + + for (i = YAFFS_NTNODES_LEVEL0 - 1; i >= 0 && !hitLimit; +- i--) { +- theChunk = yaffs_GetChunkGroupBase(dev,tn,i); ++ i--) { ++ theChunk = yaffs_GetChunkGroupBase(dev, tn, i); + if (theChunk) { + +- chunkInInode = +- (chunkOffset << +- YAFFS_TNODES_LEVEL0_BITS) + i; ++ chunkInInode = (chunkOffset << ++ YAFFS_TNODES_LEVEL0_BITS) + i; + + foundChunk = +- yaffs_FindChunkInGroup(dev, +- theChunk, +- &tags, +- in->objectId, +- chunkInInode); ++ yaffs_FindChunkInGroup(dev, ++ theChunk, ++ &tags, ++ in->objectId, ++ chunkInInode); + + if (foundChunk > 0) { + yaffs_DeleteChunk(dev, +@@ -1613,14 +1630,13 @@ static int yaffs_DeleteWorker(yaffs_Obje + in->nDataChunks--; + if (limit) { + *limit = *limit - 1; +- if (*limit <= 0) { ++ if (*limit <= 0) + hitLimit = 1; +- } + } + + } + +- yaffs_PutLevel0Tnode(dev,tn,i,0); ++ yaffs_PutLevel0Tnode(dev, tn, i, 0); + } + + } +@@ -1634,9 +1650,8 @@ static int yaffs_DeleteWorker(yaffs_Obje + + } + +-static void yaffs_SoftDeleteChunk(yaffs_Device * dev, int chunk) ++static void yaffs_SoftDeleteChunk(yaffs_Device *dev, int chunk) + { +- + yaffs_BlockInfo *theBlock; + + T(YAFFS_TRACE_DELETION, (TSTR("soft delete chunk %d" TENDSTR), chunk)); +@@ -1654,7 +1669,7 @@ static void yaffs_SoftDeleteChunk(yaffs_ + * Thus, essentially this is the same as DeleteWorker except that the chunks are soft deleted. + */ + +-static int yaffs_SoftDeleteWorker(yaffs_Object * in, yaffs_Tnode * tn, ++static int yaffs_SoftDeleteWorker(yaffs_Object *in, yaffs_Tnode *tn, + __u32 level, int chunkOffset) + { + int i; +@@ -1691,14 +1706,14 @@ static int yaffs_SoftDeleteWorker(yaffs_ + } else if (level == 0) { + + for (i = YAFFS_NTNODES_LEVEL0 - 1; i >= 0; i--) { +- theChunk = yaffs_GetChunkGroupBase(dev,tn,i); ++ theChunk = yaffs_GetChunkGroupBase(dev, tn, i); + if (theChunk) { + /* Note this does not find the real chunk, only the chunk group. + * We make an assumption that a chunk group is not larger than + * a block. + */ + yaffs_SoftDeleteChunk(dev, theChunk); +- yaffs_PutLevel0Tnode(dev,tn,i,0); ++ yaffs_PutLevel0Tnode(dev, tn, i, 0); + } + + } +@@ -1712,7 +1727,7 @@ static int yaffs_SoftDeleteWorker(yaffs_ + + } + +-static void yaffs_SoftDeleteFile(yaffs_Object * obj) ++static void yaffs_SoftDeleteFile(yaffs_Object *obj) + { + if (obj->deleted && + obj->variantType == YAFFS_OBJECT_TYPE_FILE && !obj->softDeleted) { +@@ -1746,8 +1761,8 @@ static void yaffs_SoftDeleteFile(yaffs_O + * by a special case. + */ + +-static yaffs_Tnode *yaffs_PruneWorker(yaffs_Device * dev, yaffs_Tnode * tn, +- __u32 level, int del0) ++static yaffs_Tnode *yaffs_PruneWorker(yaffs_Device *dev, yaffs_Tnode *tn, ++ __u32 level, int del0) + { + int i; + int hasData; +@@ -1763,9 +1778,8 @@ static yaffs_Tnode *yaffs_PruneWorker(ya + (i == 0) ? del0 : 1); + } + +- if (tn->internal[i]) { ++ if (tn->internal[i]) + hasData++; +- } + } + + if (hasData == 0 && del0) { +@@ -1781,8 +1795,8 @@ static yaffs_Tnode *yaffs_PruneWorker(ya + + } + +-static int yaffs_PruneFileStructure(yaffs_Device * dev, +- yaffs_FileStructure * fStruct) ++static int yaffs_PruneFileStructure(yaffs_Device *dev, ++ yaffs_FileStructure *fStruct) + { + int i; + int hasData; +@@ -1805,9 +1819,8 @@ static int yaffs_PruneFileStructure(yaff + + hasData = 0; + for (i = 1; i < YAFFS_NTNODES_INTERNAL; i++) { +- if (tn->internal[i]) { ++ if (tn->internal[i]) + hasData++; +- } + } + + if (!hasData) { +@@ -1828,7 +1841,7 @@ static int yaffs_PruneFileStructure(yaff + /* yaffs_CreateFreeObjects creates a bunch more objects and + * adds them to the object free list. + */ +-static int yaffs_CreateFreeObjects(yaffs_Device * dev, int nObjects) ++static int yaffs_CreateFreeObjects(yaffs_Device *dev, int nObjects) + { + int i; + yaffs_Object *newObjects; +@@ -1842,9 +1855,9 @@ static int yaffs_CreateFreeObjects(yaffs + list = YMALLOC(sizeof(yaffs_ObjectList)); + + if (!newObjects || !list) { +- if(newObjects) ++ if (newObjects) + YFREE(newObjects); +- if(list) ++ if (list) + YFREE(list); + T(YAFFS_TRACE_ALLOCATE, + (TSTR("yaffs: Could not allocate more objects" TENDSTR))); +@@ -1854,7 +1867,7 @@ static int yaffs_CreateFreeObjects(yaffs + /* Hook them into the free list */ + for (i = 0; i < nObjects - 1; i++) { + newObjects[i].siblings.next = +- (struct list_head *)(&newObjects[i + 1]); ++ (struct ylist_head *)(&newObjects[i + 1]); + } + + newObjects[nObjects - 1].siblings.next = (void *)dev->freeObjects; +@@ -1873,85 +1886,109 @@ static int yaffs_CreateFreeObjects(yaffs + + + /* AllocateEmptyObject gets us a clean Object. Tries to make allocate more if we run out */ +-static yaffs_Object *yaffs_AllocateEmptyObject(yaffs_Device * dev) ++static yaffs_Object *yaffs_AllocateEmptyObject(yaffs_Device *dev) + { + yaffs_Object *tn = NULL; + ++#ifdef VALGRIND_TEST ++ tn = YMALLOC(sizeof(yaffs_Object)); ++#else + /* If there are none left make more */ +- if (!dev->freeObjects) { ++ if (!dev->freeObjects) + yaffs_CreateFreeObjects(dev, YAFFS_ALLOCATION_NOBJECTS); +- } + + if (dev->freeObjects) { + tn = dev->freeObjects; + dev->freeObjects = +- (yaffs_Object *) (dev->freeObjects->siblings.next); ++ (yaffs_Object *) (dev->freeObjects->siblings.next); + dev->nFreeObjects--; +- ++ } ++#endif ++ if (tn) { + /* Now sweeten it up... */ + + memset(tn, 0, sizeof(yaffs_Object)); ++ tn->beingCreated = 1; ++ + tn->myDev = dev; +- tn->chunkId = -1; ++ tn->hdrChunk = 0; + tn->variantType = YAFFS_OBJECT_TYPE_UNKNOWN; +- INIT_LIST_HEAD(&(tn->hardLinks)); +- INIT_LIST_HEAD(&(tn->hashLink)); +- INIT_LIST_HEAD(&tn->siblings); ++ YINIT_LIST_HEAD(&(tn->hardLinks)); ++ YINIT_LIST_HEAD(&(tn->hashLink)); ++ YINIT_LIST_HEAD(&tn->siblings); ++ ++ ++ /* Now make the directory sane */ ++ if (dev->rootDir) { ++ tn->parent = dev->rootDir; ++ ylist_add(&(tn->siblings), &dev->rootDir->variant.directoryVariant.children); ++ } + + /* Add it to the lost and found directory. + * NB Can't put root or lostNFound in lostNFound so + * check if lostNFound exists first + */ +- if (dev->lostNFoundDir) { ++ if (dev->lostNFoundDir) + yaffs_AddObjectToDirectory(dev->lostNFoundDir, tn); +- } ++ ++ tn->beingCreated = 0; + } + ++ dev->nCheckpointBlocksRequired = 0; /* force recalculation*/ ++ + return tn; + } + +-static yaffs_Object *yaffs_CreateFakeDirectory(yaffs_Device * dev, int number, ++static yaffs_Object *yaffs_CreateFakeDirectory(yaffs_Device *dev, int number, + __u32 mode) + { + + yaffs_Object *obj = + yaffs_CreateNewObject(dev, number, YAFFS_OBJECT_TYPE_DIRECTORY); + if (obj) { +- obj->fake = 1; /* it is fake so it has no NAND presence... */ ++ obj->fake = 1; /* it is fake so it might have no NAND presence... */ + obj->renameAllowed = 0; /* ... and we're not allowed to rename it... */ + obj->unlinkAllowed = 0; /* ... or unlink it */ + obj->deleted = 0; + obj->unlinked = 0; + obj->yst_mode = mode; + obj->myDev = dev; +- obj->chunkId = 0; /* Not a valid chunk. */ ++ obj->hdrChunk = 0; /* Not a valid chunk. */ + } + + return obj; + + } + +-static void yaffs_UnhashObject(yaffs_Object * tn) ++static void yaffs_UnhashObject(yaffs_Object *tn) + { + int bucket; + yaffs_Device *dev = tn->myDev; + + /* If it is still linked into the bucket list, free from the list */ +- if (!list_empty(&tn->hashLink)) { +- list_del_init(&tn->hashLink); ++ if (!ylist_empty(&tn->hashLink)) { ++ ylist_del_init(&tn->hashLink); + bucket = yaffs_HashFunction(tn->objectId); + dev->objectBucket[bucket].count--; + } +- + } + + /* FreeObject frees up a Object and puts it back on the free list */ +-static void yaffs_FreeObject(yaffs_Object * tn) ++static void yaffs_FreeObject(yaffs_Object *tn) + { +- + yaffs_Device *dev = tn->myDev; + +-#ifdef __KERNEL__ ++#ifdef __KERNEL__ ++ T(YAFFS_TRACE_OS, (TSTR("FreeObject %p inode %p"TENDSTR), tn, tn->myInode)); ++#endif ++ ++ if (tn->parent) ++ YBUG(); ++ if (!ylist_empty(&tn->siblings)) ++ YBUG(); ++ ++ ++#ifdef __KERNEL__ + if (tn->myInode) { + /* We're still hooked up to a cached inode. + * Don't delete now, but mark for later deletion +@@ -1963,24 +2000,28 @@ static void yaffs_FreeObject(yaffs_Objec + + yaffs_UnhashObject(tn); + ++#ifdef VALGRIND_TEST ++ YFREE(tn); ++#else + /* Link into the free list. */ +- tn->siblings.next = (struct list_head *)(dev->freeObjects); ++ tn->siblings.next = (struct ylist_head *)(dev->freeObjects); + dev->freeObjects = tn; + dev->nFreeObjects++; ++#endif ++ dev->nCheckpointBlocksRequired = 0; /* force recalculation*/ + } + + #ifdef __KERNEL__ + +-void yaffs_HandleDeferedFree(yaffs_Object * obj) ++void yaffs_HandleDeferedFree(yaffs_Object *obj) + { +- if (obj->deferedFree) { ++ if (obj->deferedFree) + yaffs_FreeObject(obj); +- } + } + + #endif + +-static void yaffs_DeinitialiseObjects(yaffs_Device * dev) ++static void yaffs_DeinitialiseObjects(yaffs_Device *dev) + { + /* Free the list of allocated Objects */ + +@@ -1998,7 +2039,7 @@ static void yaffs_DeinitialiseObjects(ya + dev->nFreeObjects = 0; + } + +-static void yaffs_InitialiseObjects(yaffs_Device * dev) ++static void yaffs_InitialiseObjects(yaffs_Device *dev) + { + int i; + +@@ -2007,15 +2048,14 @@ static void yaffs_InitialiseObjects(yaff + dev->nFreeObjects = 0; + + for (i = 0; i < YAFFS_NOBJECT_BUCKETS; i++) { +- INIT_LIST_HEAD(&dev->objectBucket[i].list); ++ YINIT_LIST_HEAD(&dev->objectBucket[i].list); + dev->objectBucket[i].count = 0; + } +- + } + +-static int yaffs_FindNiceObjectBucket(yaffs_Device * dev) ++static int yaffs_FindNiceObjectBucket(yaffs_Device *dev) + { +- static int x = 0; ++ static int x; + int i; + int l = 999; + int lowest = 999999; +@@ -2049,7 +2089,7 @@ static int yaffs_FindNiceObjectBucket(ya + return l; + } + +-static int yaffs_CreateNewObjectNumber(yaffs_Device * dev) ++static int yaffs_CreateNewObjectNumber(yaffs_Device *dev) + { + int bucket = yaffs_FindNiceObjectBucket(dev); + +@@ -2058,7 +2098,7 @@ static int yaffs_CreateNewObjectNumber(y + */ + + int found = 0; +- struct list_head *i; ++ struct ylist_head *i; + + __u32 n = (__u32) bucket; + +@@ -2068,41 +2108,38 @@ static int yaffs_CreateNewObjectNumber(y + found = 1; + n += YAFFS_NOBJECT_BUCKETS; + if (1 || dev->objectBucket[bucket].count > 0) { +- list_for_each(i, &dev->objectBucket[bucket].list) { ++ ylist_for_each(i, &dev->objectBucket[bucket].list) { + /* If there is already one in the list */ +- if (i +- && list_entry(i, yaffs_Object, +- hashLink)->objectId == n) { ++ if (i && ylist_entry(i, yaffs_Object, ++ hashLink)->objectId == n) { + found = 0; + } + } + } + } + +- + return n; + } + +-static void yaffs_HashObject(yaffs_Object * in) ++static void yaffs_HashObject(yaffs_Object *in) + { + int bucket = yaffs_HashFunction(in->objectId); + yaffs_Device *dev = in->myDev; + +- list_add(&in->hashLink, &dev->objectBucket[bucket].list); ++ ylist_add(&in->hashLink, &dev->objectBucket[bucket].list); + dev->objectBucket[bucket].count++; +- + } + +-yaffs_Object *yaffs_FindObjectByNumber(yaffs_Device * dev, __u32 number) ++yaffs_Object *yaffs_FindObjectByNumber(yaffs_Device *dev, __u32 number) + { + int bucket = yaffs_HashFunction(number); +- struct list_head *i; ++ struct ylist_head *i; + yaffs_Object *in; + +- list_for_each(i, &dev->objectBucket[bucket].list) { ++ ylist_for_each(i, &dev->objectBucket[bucket].list) { + /* Look if it is in the list */ + if (i) { +- in = list_entry(i, yaffs_Object, hashLink); ++ in = ylist_entry(i, yaffs_Object, hashLink); + if (in->objectId == number) { + #ifdef __KERNEL__ + /* Don't tell the VFS about this one if it is defered free */ +@@ -2118,31 +2155,27 @@ yaffs_Object *yaffs_FindObjectByNumber(y + return NULL; + } + +-yaffs_Object *yaffs_CreateNewObject(yaffs_Device * dev, int number, ++yaffs_Object *yaffs_CreateNewObject(yaffs_Device *dev, int number, + yaffs_ObjectType type) + { +- + yaffs_Object *theObject; +- yaffs_Tnode *tn; ++ yaffs_Tnode *tn = NULL; + +- if (number < 0) { ++ if (number < 0) + number = yaffs_CreateNewObjectNumber(dev); +- } + + theObject = yaffs_AllocateEmptyObject(dev); +- if(!theObject) ++ if (!theObject) + return NULL; + +- if(type == YAFFS_OBJECT_TYPE_FILE){ ++ if (type == YAFFS_OBJECT_TYPE_FILE) { + tn = yaffs_GetTnode(dev); +- if(!tn){ ++ if (!tn) { + yaffs_FreeObject(theObject); + return NULL; + } + } + +- +- + if (theObject) { + theObject->fake = 0; + theObject->renameAllowed = 1; +@@ -2171,8 +2204,8 @@ yaffs_Object *yaffs_CreateNewObject(yaff + theObject->variant.fileVariant.top = tn; + break; + case YAFFS_OBJECT_TYPE_DIRECTORY: +- INIT_LIST_HEAD(&theObject->variant.directoryVariant. +- children); ++ YINIT_LIST_HEAD(&theObject->variant.directoryVariant. ++ children); + break; + case YAFFS_OBJECT_TYPE_SYMLINK: + case YAFFS_OBJECT_TYPE_HARDLINK: +@@ -2188,32 +2221,30 @@ yaffs_Object *yaffs_CreateNewObject(yaff + return theObject; + } + +-static yaffs_Object *yaffs_FindOrCreateObjectByNumber(yaffs_Device * dev, ++static yaffs_Object *yaffs_FindOrCreateObjectByNumber(yaffs_Device *dev, + int number, + yaffs_ObjectType type) + { + yaffs_Object *theObject = NULL; + +- if (number > 0) { ++ if (number > 0) + theObject = yaffs_FindObjectByNumber(dev, number); +- } + +- if (!theObject) { ++ if (!theObject) + theObject = yaffs_CreateNewObject(dev, number, type); +- } + + return theObject; + + } + + +-static YCHAR *yaffs_CloneString(const YCHAR * str) ++static YCHAR *yaffs_CloneString(const YCHAR *str) + { + YCHAR *newStr = NULL; + + if (str && *str) { + newStr = YMALLOC((yaffs_strlen(str) + 1) * sizeof(YCHAR)); +- if(newStr) ++ if (newStr) + yaffs_strcpy(newStr, str); + } + +@@ -2229,29 +2260,31 @@ static YCHAR *yaffs_CloneString(const YC + */ + + static yaffs_Object *yaffs_MknodObject(yaffs_ObjectType type, +- yaffs_Object * parent, +- const YCHAR * name, ++ yaffs_Object *parent, ++ const YCHAR *name, + __u32 mode, + __u32 uid, + __u32 gid, +- yaffs_Object * equivalentObject, +- const YCHAR * aliasString, __u32 rdev) ++ yaffs_Object *equivalentObject, ++ const YCHAR *aliasString, __u32 rdev) + { + yaffs_Object *in; +- YCHAR *str; ++ YCHAR *str = NULL; + + yaffs_Device *dev = parent->myDev; + + /* Check if the entry exists. If it does then fail the call since we don't want a dup.*/ +- if (yaffs_FindObjectByName(parent, name)) { ++ if (yaffs_FindObjectByName(parent, name)) + return NULL; +- } + + in = yaffs_CreateNewObject(dev, -1, type); + +- if(type == YAFFS_OBJECT_TYPE_SYMLINK){ ++ if (!in) ++ return YAFFS_FAIL; ++ ++ if (type == YAFFS_OBJECT_TYPE_SYMLINK) { + str = yaffs_CloneString(aliasString); +- if(!str){ ++ if (!str) { + yaffs_FreeObject(in); + return NULL; + } +@@ -2260,7 +2293,7 @@ static yaffs_Object *yaffs_MknodObject(y + + + if (in) { +- in->chunkId = -1; ++ in->hdrChunk = 0; + in->valid = 1; + in->variantType = type; + +@@ -2293,10 +2326,10 @@ static yaffs_Object *yaffs_MknodObject(y + break; + case YAFFS_OBJECT_TYPE_HARDLINK: + in->variant.hardLinkVariant.equivalentObject = +- equivalentObject; ++ equivalentObject; + in->variant.hardLinkVariant.equivalentObjectId = +- equivalentObject->objectId; +- list_add(&in->hardLinks, &equivalentObject->hardLinks); ++ equivalentObject->objectId; ++ ylist_add(&in->hardLinks, &equivalentObject->hardLinks); + break; + case YAFFS_OBJECT_TYPE_FILE: + case YAFFS_OBJECT_TYPE_DIRECTORY: +@@ -2308,7 +2341,7 @@ static yaffs_Object *yaffs_MknodObject(y + + if (yaffs_UpdateObjectHeader(in, name, 0, 0, 0) < 0) { + /* Could not create the object header, fail the creation */ +- yaffs_DestroyObject(in); ++ yaffs_DeleteObject(in); + in = NULL; + } + +@@ -2317,38 +2350,38 @@ static yaffs_Object *yaffs_MknodObject(y + return in; + } + +-yaffs_Object *yaffs_MknodFile(yaffs_Object * parent, const YCHAR * name, +- __u32 mode, __u32 uid, __u32 gid) ++yaffs_Object *yaffs_MknodFile(yaffs_Object *parent, const YCHAR *name, ++ __u32 mode, __u32 uid, __u32 gid) + { + return yaffs_MknodObject(YAFFS_OBJECT_TYPE_FILE, parent, name, mode, +- uid, gid, NULL, NULL, 0); ++ uid, gid, NULL, NULL, 0); + } + +-yaffs_Object *yaffs_MknodDirectory(yaffs_Object * parent, const YCHAR * name, +- __u32 mode, __u32 uid, __u32 gid) ++yaffs_Object *yaffs_MknodDirectory(yaffs_Object *parent, const YCHAR *name, ++ __u32 mode, __u32 uid, __u32 gid) + { + return yaffs_MknodObject(YAFFS_OBJECT_TYPE_DIRECTORY, parent, name, + mode, uid, gid, NULL, NULL, 0); + } + +-yaffs_Object *yaffs_MknodSpecial(yaffs_Object * parent, const YCHAR * name, +- __u32 mode, __u32 uid, __u32 gid, __u32 rdev) ++yaffs_Object *yaffs_MknodSpecial(yaffs_Object *parent, const YCHAR *name, ++ __u32 mode, __u32 uid, __u32 gid, __u32 rdev) + { + return yaffs_MknodObject(YAFFS_OBJECT_TYPE_SPECIAL, parent, name, mode, + uid, gid, NULL, NULL, rdev); + } + +-yaffs_Object *yaffs_MknodSymLink(yaffs_Object * parent, const YCHAR * name, +- __u32 mode, __u32 uid, __u32 gid, +- const YCHAR * alias) ++yaffs_Object *yaffs_MknodSymLink(yaffs_Object *parent, const YCHAR *name, ++ __u32 mode, __u32 uid, __u32 gid, ++ const YCHAR *alias) + { + return yaffs_MknodObject(YAFFS_OBJECT_TYPE_SYMLINK, parent, name, mode, +- uid, gid, NULL, alias, 0); ++ uid, gid, NULL, alias, 0); + } + + /* yaffs_Link returns the object id of the equivalent object.*/ +-yaffs_Object *yaffs_Link(yaffs_Object * parent, const YCHAR * name, +- yaffs_Object * equivalentObject) ++yaffs_Object *yaffs_Link(yaffs_Object *parent, const YCHAR *name, ++ yaffs_Object *equivalentObject) + { + /* Get the real object in case we were fed a hard link as an equivalent object */ + equivalentObject = yaffs_GetEquivalentObject(equivalentObject); +@@ -2363,33 +2396,31 @@ yaffs_Object *yaffs_Link(yaffs_Object * + + } + +-static int yaffs_ChangeObjectName(yaffs_Object * obj, yaffs_Object * newDir, +- const YCHAR * newName, int force, int shadows) ++static int yaffs_ChangeObjectName(yaffs_Object *obj, yaffs_Object *newDir, ++ const YCHAR *newName, int force, int shadows) + { + int unlinkOp; + int deleteOp; + + yaffs_Object *existingTarget; + +- if (newDir == NULL) { ++ if (newDir == NULL) + newDir = obj->parent; /* use the old directory */ +- } + + if (newDir->variantType != YAFFS_OBJECT_TYPE_DIRECTORY) { + T(YAFFS_TRACE_ALWAYS, + (TSTR +- ("tragendy: yaffs_ChangeObjectName: newDir is not a directory" ++ ("tragedy: yaffs_ChangeObjectName: newDir is not a directory" + TENDSTR))); + YBUG(); + } + + /* TODO: Do we need this different handling for YAFFS2 and YAFFS1?? */ +- if (obj->myDev->isYaffs2) { ++ if (obj->myDev->isYaffs2) + unlinkOp = (newDir == obj->myDev->unlinkedDir); +- } else { ++ else + unlinkOp = (newDir == obj->myDev->unlinkedDir + && obj->variantType == YAFFS_OBJECT_TYPE_FILE); +- } + + deleteOp = (newDir == obj->myDev->deletedDir); + +@@ -2415,40 +2446,40 @@ static int yaffs_ChangeObjectName(yaffs_ + obj->unlinked = 1; + + /* If it is a deletion then we mark it as a shrink for gc purposes. */ +- if (yaffs_UpdateObjectHeader(obj, newName, 0, deleteOp, shadows)>= 0) ++ if (yaffs_UpdateObjectHeader(obj, newName, 0, deleteOp, shadows) >= 0) + return YAFFS_OK; + } + + return YAFFS_FAIL; + } + +-int yaffs_RenameObject(yaffs_Object * oldDir, const YCHAR * oldName, +- yaffs_Object * newDir, const YCHAR * newName) ++int yaffs_RenameObject(yaffs_Object *oldDir, const YCHAR *oldName, ++ yaffs_Object *newDir, const YCHAR *newName) + { +- yaffs_Object *obj; +- yaffs_Object *existingTarget; ++ yaffs_Object *obj = NULL; ++ yaffs_Object *existingTarget = NULL; + int force = 0; + ++ ++ if (!oldDir || oldDir->variantType != YAFFS_OBJECT_TYPE_DIRECTORY) ++ YBUG(); ++ if (!newDir || newDir->variantType != YAFFS_OBJECT_TYPE_DIRECTORY) ++ YBUG(); ++ + #ifdef CONFIG_YAFFS_CASE_INSENSITIVE + /* Special case for case insemsitive systems (eg. WinCE). + * While look-up is case insensitive, the name isn't. + * Therefore we might want to change x.txt to X.txt + */ +- if (oldDir == newDir && yaffs_strcmp(oldName, newName) == 0) { ++ if (oldDir == newDir && yaffs_strcmp(oldName, newName) == 0) + force = 1; +- } + #endif + ++ else if (yaffs_strlen(newName) > YAFFS_MAX_NAME_LENGTH) ++ /* ENAMETOOLONG */ ++ return YAFFS_FAIL; ++ + obj = yaffs_FindObjectByName(oldDir, oldName); +- /* Check new name to long. */ +- if (obj->variantType == YAFFS_OBJECT_TYPE_SYMLINK && +- yaffs_strlen(newName) > YAFFS_MAX_ALIAS_LENGTH) +- /* ENAMETOOLONG */ +- return YAFFS_FAIL; +- else if (obj->variantType != YAFFS_OBJECT_TYPE_SYMLINK && +- yaffs_strlen(newName) > YAFFS_MAX_NAME_LENGTH) +- /* ENAMETOOLONG */ +- return YAFFS_FAIL; + + if (obj && obj->renameAllowed) { + +@@ -2456,8 +2487,8 @@ int yaffs_RenameObject(yaffs_Object * ol + + existingTarget = yaffs_FindObjectByName(newDir, newName); + if (existingTarget && +- existingTarget->variantType == YAFFS_OBJECT_TYPE_DIRECTORY && +- !list_empty(&existingTarget->variant.directoryVariant.children)) { ++ existingTarget->variantType == YAFFS_OBJECT_TYPE_DIRECTORY && ++ !ylist_empty(&existingTarget->variant.directoryVariant.children)) { + /* There is a target that is a non-empty directory, so we fail */ + return YAFFS_FAIL; /* EEXIST or ENOTEMPTY */ + } else if (existingTarget && existingTarget != obj) { +@@ -2465,7 +2496,7 @@ int yaffs_RenameObject(yaffs_Object * ol + * but only if it isn't the same object + */ + yaffs_ChangeObjectName(obj, newDir, newName, force, +- existingTarget->objectId); ++ existingTarget->objectId); + yaffs_UnlinkObject(existingTarget); + } + +@@ -2476,7 +2507,7 @@ int yaffs_RenameObject(yaffs_Object * ol + + /*------------------------- Block Management and Page Allocation ----------------*/ + +-static int yaffs_InitialiseBlocks(yaffs_Device * dev) ++static int yaffs_InitialiseBlocks(yaffs_Device *dev) + { + int nBlocks = dev->internalEndBlock - dev->internalStartBlock + 1; + +@@ -2487,23 +2518,20 @@ static int yaffs_InitialiseBlocks(yaffs_ + + /* If the first allocation strategy fails, thry the alternate one */ + dev->blockInfo = YMALLOC(nBlocks * sizeof(yaffs_BlockInfo)); +- if(!dev->blockInfo){ ++ if (!dev->blockInfo) { + dev->blockInfo = YMALLOC_ALT(nBlocks * sizeof(yaffs_BlockInfo)); + dev->blockInfoAlt = 1; +- } +- else ++ } else + dev->blockInfoAlt = 0; + +- if(dev->blockInfo){ +- ++ if (dev->blockInfo) { + /* Set up dynamic blockinfo stuff. */ + dev->chunkBitmapStride = (dev->nChunksPerBlock + 7) / 8; /* round up bytes */ + dev->chunkBits = YMALLOC(dev->chunkBitmapStride * nBlocks); +- if(!dev->chunkBits){ ++ if (!dev->chunkBits) { + dev->chunkBits = YMALLOC_ALT(dev->chunkBitmapStride * nBlocks); + dev->chunkBitsAlt = 1; +- } +- else ++ } else + dev->chunkBitsAlt = 0; + } + +@@ -2514,30 +2542,29 @@ static int yaffs_InitialiseBlocks(yaffs_ + } + + return YAFFS_FAIL; +- + } + +-static void yaffs_DeinitialiseBlocks(yaffs_Device * dev) ++static void yaffs_DeinitialiseBlocks(yaffs_Device *dev) + { +- if(dev->blockInfoAlt && dev->blockInfo) ++ if (dev->blockInfoAlt && dev->blockInfo) + YFREE_ALT(dev->blockInfo); +- else if(dev->blockInfo) ++ else if (dev->blockInfo) + YFREE(dev->blockInfo); + + dev->blockInfoAlt = 0; + + dev->blockInfo = NULL; + +- if(dev->chunkBitsAlt && dev->chunkBits) ++ if (dev->chunkBitsAlt && dev->chunkBits) + YFREE_ALT(dev->chunkBits); +- else if(dev->chunkBits) ++ else if (dev->chunkBits) + YFREE(dev->chunkBits); + dev->chunkBitsAlt = 0; + dev->chunkBits = NULL; + } + +-static int yaffs_BlockNotDisqualifiedFromGC(yaffs_Device * dev, +- yaffs_BlockInfo * bi) ++static int yaffs_BlockNotDisqualifiedFromGC(yaffs_Device *dev, ++ yaffs_BlockInfo *bi) + { + int i; + __u32 seq; +@@ -2556,7 +2583,7 @@ static int yaffs_BlockNotDisqualifiedFro + seq = dev->sequenceNumber; + + for (i = dev->internalStartBlock; i <= dev->internalEndBlock; +- i++) { ++ i++) { + b = yaffs_GetBlockInfo(dev, i); + if (b->blockState == YAFFS_BLOCK_STATE_FULL && + (b->pagesInUse - b->softDeletions) < +@@ -2571,38 +2598,36 @@ static int yaffs_BlockNotDisqualifiedFro + * discarded pages. + */ + return (bi->sequenceNumber <= dev->oldestDirtySequence); +- + } + + /* FindDiretiestBlock is used to select the dirtiest block (or close enough) + * for garbage collection. + */ + +-static int yaffs_FindBlockForGarbageCollection(yaffs_Device * dev, +- int aggressive) ++static int yaffs_FindBlockForGarbageCollection(yaffs_Device *dev, ++ int aggressive) + { +- + int b = dev->currentDirtyChecker; + + int i; + int iterations; + int dirtiest = -1; + int pagesInUse = 0; +- int prioritised=0; ++ int prioritised = 0; + yaffs_BlockInfo *bi; + int pendingPrioritisedExist = 0; + + /* First let's see if we need to grab a prioritised block */ +- if(dev->hasPendingPrioritisedGCs){ +- for(i = dev->internalStartBlock; i < dev->internalEndBlock && !prioritised; i++){ ++ if (dev->hasPendingPrioritisedGCs) { ++ for (i = dev->internalStartBlock; i < dev->internalEndBlock && !prioritised; i++) { + + bi = yaffs_GetBlockInfo(dev, i); +- //yaffs_VerifyBlock(dev,bi,i); ++ /* yaffs_VerifyBlock(dev,bi,i); */ + +- if(bi->gcPrioritise) { ++ if (bi->gcPrioritise) { + pendingPrioritisedExist = 1; +- if(bi->blockState == YAFFS_BLOCK_STATE_FULL && +- yaffs_BlockNotDisqualifiedFromGC(dev, bi)){ ++ if (bi->blockState == YAFFS_BLOCK_STATE_FULL && ++ yaffs_BlockNotDisqualifiedFromGC(dev, bi)) { + pagesInUse = (bi->pagesInUse - bi->softDeletions); + dirtiest = i; + prioritised = 1; +@@ -2611,7 +2636,7 @@ static int yaffs_FindBlockForGarbageColl + } + } + +- if(!pendingPrioritisedExist) /* None found, so we can clear this */ ++ if (!pendingPrioritisedExist) /* None found, so we can clear this */ + dev->hasPendingPrioritisedGCs = 0; + } + +@@ -2623,31 +2648,28 @@ static int yaffs_FindBlockForGarbageColl + + dev->nonAggressiveSkip--; + +- if (!aggressive && (dev->nonAggressiveSkip > 0)) { ++ if (!aggressive && (dev->nonAggressiveSkip > 0)) + return -1; +- } + +- if(!prioritised) ++ if (!prioritised) + pagesInUse = +- (aggressive) ? dev->nChunksPerBlock : YAFFS_PASSIVE_GC_CHUNKS + 1; ++ (aggressive) ? dev->nChunksPerBlock : YAFFS_PASSIVE_GC_CHUNKS + 1; + +- if (aggressive) { ++ if (aggressive) + iterations = + dev->internalEndBlock - dev->internalStartBlock + 1; +- } else { ++ else { + iterations = + dev->internalEndBlock - dev->internalStartBlock + 1; + iterations = iterations / 16; +- if (iterations > 200) { ++ if (iterations > 200) + iterations = 200; +- } + } + + for (i = 0; i <= iterations && pagesInUse > 0 && !prioritised; i++) { + b++; +- if (b < dev->internalStartBlock || b > dev->internalEndBlock) { ++ if (b < dev->internalStartBlock || b > dev->internalEndBlock) + b = dev->internalStartBlock; +- } + + if (b < dev->internalStartBlock || b > dev->internalEndBlock) { + T(YAFFS_TRACE_ERROR, +@@ -2657,17 +2679,9 @@ static int yaffs_FindBlockForGarbageColl + + bi = yaffs_GetBlockInfo(dev, b); + +-#if 0 +- if (bi->blockState == YAFFS_BLOCK_STATE_CHECKPOINT) { +- dirtiest = b; +- pagesInUse = 0; +- } +- else +-#endif +- + if (bi->blockState == YAFFS_BLOCK_STATE_FULL && +- (bi->pagesInUse - bi->softDeletions) < pagesInUse && +- yaffs_BlockNotDisqualifiedFromGC(dev, bi)) { ++ (bi->pagesInUse - bi->softDeletions) < pagesInUse && ++ yaffs_BlockNotDisqualifiedFromGC(dev, bi)) { + dirtiest = b; + pagesInUse = (bi->pagesInUse - bi->softDeletions); + } +@@ -2678,19 +2692,18 @@ static int yaffs_FindBlockForGarbageColl + if (dirtiest > 0) { + T(YAFFS_TRACE_GC, + (TSTR("GC Selected block %d with %d free, prioritised:%d" TENDSTR), dirtiest, +- dev->nChunksPerBlock - pagesInUse,prioritised)); ++ dev->nChunksPerBlock - pagesInUse, prioritised)); + } + + dev->oldestDirtySequence = 0; + +- if (dirtiest > 0) { ++ if (dirtiest > 0) + dev->nonAggressiveSkip = 4; +- } + + return dirtiest; + } + +-static void yaffs_BlockBecameDirty(yaffs_Device * dev, int blockNo) ++static void yaffs_BlockBecameDirty(yaffs_Device *dev, int blockNo) + { + yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev, blockNo); + +@@ -2752,7 +2765,7 @@ static void yaffs_BlockBecameDirty(yaffs + } + } + +-static int yaffs_FindBlockForAllocation(yaffs_Device * dev) ++static int yaffs_FindBlockForAllocation(yaffs_Device *dev) + { + int i; + +@@ -2763,7 +2776,7 @@ static int yaffs_FindBlockForAllocation( + * Can't get space to gc + */ + T(YAFFS_TRACE_ERROR, +- (TSTR("yaffs tragedy: no more eraased blocks" TENDSTR))); ++ (TSTR("yaffs tragedy: no more erased blocks" TENDSTR))); + + return -1; + } +@@ -2794,31 +2807,74 @@ static int yaffs_FindBlockForAllocation( + + T(YAFFS_TRACE_ALWAYS, + (TSTR +- ("yaffs tragedy: no more eraased blocks, but there should have been %d" ++ ("yaffs tragedy: no more erased blocks, but there should have been %d" + TENDSTR), dev->nErasedBlocks)); + + return -1; + } + + +-// Check if there's space to allocate... +-// Thinks.... do we need top make this ths same as yaffs_GetFreeChunks()? +-static int yaffs_CheckSpaceForAllocation(yaffs_Device * dev) ++ ++static int yaffs_CalcCheckpointBlocksRequired(yaffs_Device *dev) ++{ ++ if (!dev->nCheckpointBlocksRequired && ++ dev->isYaffs2) { ++ /* Not a valid value so recalculate */ ++ int nBytes = 0; ++ int nBlocks; ++ int devBlocks = (dev->endBlock - dev->startBlock + 1); ++ int tnodeSize; ++ ++ tnodeSize = (dev->tnodeWidth * YAFFS_NTNODES_LEVEL0)/8; ++ ++ if (tnodeSize < sizeof(yaffs_Tnode)) ++ tnodeSize = sizeof(yaffs_Tnode); ++ ++ nBytes += sizeof(yaffs_CheckpointValidity); ++ nBytes += sizeof(yaffs_CheckpointDevice); ++ nBytes += devBlocks * sizeof(yaffs_BlockInfo); ++ nBytes += devBlocks * dev->chunkBitmapStride; ++ nBytes += (sizeof(yaffs_CheckpointObject) + sizeof(__u32)) * (dev->nObjectsCreated - dev->nFreeObjects); ++ nBytes += (tnodeSize + sizeof(__u32)) * (dev->nTnodesCreated - dev->nFreeTnodes); ++ nBytes += sizeof(yaffs_CheckpointValidity); ++ nBytes += sizeof(__u32); /* checksum*/ ++ ++ /* Round up and add 2 blocks to allow for some bad blocks, so add 3 */ ++ ++ nBlocks = (nBytes/(dev->nDataBytesPerChunk * dev->nChunksPerBlock)) + 3; ++ ++ dev->nCheckpointBlocksRequired = nBlocks; ++ } ++ ++ return dev->nCheckpointBlocksRequired; ++} ++ ++/* ++ * Check if there's space to allocate... ++ * Thinks.... do we need top make this ths same as yaffs_GetFreeChunks()? ++ */ ++static int yaffs_CheckSpaceForAllocation(yaffs_Device *dev) + { + int reservedChunks; + int reservedBlocks = dev->nReservedBlocks; + int checkpointBlocks; + +- checkpointBlocks = dev->nCheckpointReservedBlocks - dev->blocksInCheckpoint; +- if(checkpointBlocks < 0) ++ if (dev->isYaffs2) { ++ checkpointBlocks = yaffs_CalcCheckpointBlocksRequired(dev) - ++ dev->blocksInCheckpoint; ++ if (checkpointBlocks < 0) ++ checkpointBlocks = 0; ++ } else { + checkpointBlocks = 0; ++ } + + reservedChunks = ((reservedBlocks + checkpointBlocks) * dev->nChunksPerBlock); + + return (dev->nFreeChunks > reservedChunks); + } + +-static int yaffs_AllocateChunk(yaffs_Device * dev, int useReserve, yaffs_BlockInfo **blockUsedPtr) ++static int yaffs_AllocateChunk(yaffs_Device *dev, int useReserve, ++ yaffs_BlockInfo **blockUsedPtr) + { + int retVal; + yaffs_BlockInfo *bi; +@@ -2835,7 +2891,7 @@ static int yaffs_AllocateChunk(yaffs_Dev + } + + if (dev->nErasedBlocks < dev->nReservedBlocks +- && dev->allocationPage == 0) { ++ && dev->allocationPage == 0) { + T(YAFFS_TRACE_ALLOCATE, (TSTR("Allocating reserve" TENDSTR))); + } + +@@ -2844,10 +2900,10 @@ static int yaffs_AllocateChunk(yaffs_Dev + bi = yaffs_GetBlockInfo(dev, dev->allocationBlock); + + retVal = (dev->allocationBlock * dev->nChunksPerBlock) + +- dev->allocationPage; ++ dev->allocationPage; + bi->pagesInUse++; + yaffs_SetChunkBit(dev, dev->allocationBlock, +- dev->allocationPage); ++ dev->allocationPage); + + dev->allocationPage++; + +@@ -2859,43 +2915,43 @@ static int yaffs_AllocateChunk(yaffs_Dev + dev->allocationBlock = -1; + } + +- if(blockUsedPtr) ++ if (blockUsedPtr) + *blockUsedPtr = bi; + + return retVal; + } + + T(YAFFS_TRACE_ERROR, +- (TSTR("!!!!!!!!! Allocator out !!!!!!!!!!!!!!!!!" TENDSTR))); ++ (TSTR("!!!!!!!!! Allocator out !!!!!!!!!!!!!!!!!" TENDSTR))); + + return -1; + } + +-static int yaffs_GetErasedChunks(yaffs_Device * dev) ++static int yaffs_GetErasedChunks(yaffs_Device *dev) + { + int n; + + n = dev->nErasedBlocks * dev->nChunksPerBlock; + +- if (dev->allocationBlock > 0) { ++ if (dev->allocationBlock > 0) + n += (dev->nChunksPerBlock - dev->allocationPage); +- } + + return n; + + } + +-static int yaffs_GarbageCollectBlock(yaffs_Device * dev, int block) ++static int yaffs_GarbageCollectBlock(yaffs_Device *dev, int block, ++ int wholeBlock) + { + int oldChunk; + int newChunk; +- int chunkInBlock; + int markNAND; + int retVal = YAFFS_OK; + int cleanups = 0; + int i; + int isCheckpointBlock; + int matchingChunk; ++ int maxCopies; + + int chunksBefore = yaffs_GetErasedChunks(dev); + int chunksAfter; +@@ -2911,8 +2967,11 @@ static int yaffs_GarbageCollectBlock(yaf + bi->blockState = YAFFS_BLOCK_STATE_COLLECTING; + + T(YAFFS_TRACE_TRACING, +- (TSTR("Collecting block %d, in use %d, shrink %d, " TENDSTR), block, +- bi->pagesInUse, bi->hasShrinkHeader)); ++ (TSTR("Collecting block %d, in use %d, shrink %d, wholeBlock %d" TENDSTR), ++ block, ++ bi->pagesInUse, ++ bi->hasShrinkHeader, ++ wholeBlock)); + + /*yaffs_VerifyFreeChunks(dev); */ + +@@ -2926,26 +2985,33 @@ static int yaffs_GarbageCollectBlock(yaf + dev->isDoingGC = 1; + + if (isCheckpointBlock || +- !yaffs_StillSomeChunkBits(dev, block)) { ++ !yaffs_StillSomeChunkBits(dev, block)) { + T(YAFFS_TRACE_TRACING, +- (TSTR +- ("Collecting block %d that has no chunks in use" TENDSTR), +- block)); ++ (TSTR ++ ("Collecting block %d that has no chunks in use" TENDSTR), ++ block)); + yaffs_BlockBecameDirty(dev, block); + } else { + + __u8 *buffer = yaffs_GetTempBuffer(dev, __LINE__); + +- yaffs_VerifyBlock(dev,bi,block); ++ yaffs_VerifyBlock(dev, bi, block); + +- for (chunkInBlock = 0, oldChunk = block * dev->nChunksPerBlock; +- chunkInBlock < dev->nChunksPerBlock +- && yaffs_StillSomeChunkBits(dev, block); +- chunkInBlock++, oldChunk++) { +- if (yaffs_CheckChunkBit(dev, block, chunkInBlock)) { ++ maxCopies = (wholeBlock) ? dev->nChunksPerBlock : 10; ++ oldChunk = block * dev->nChunksPerBlock + dev->gcChunk; ++ ++ for (/* init already done */; ++ retVal == YAFFS_OK && ++ dev->gcChunk < dev->nChunksPerBlock && ++ (bi->blockState == YAFFS_BLOCK_STATE_COLLECTING) && ++ maxCopies > 0; ++ dev->gcChunk++, oldChunk++) { ++ if (yaffs_CheckChunkBit(dev, block, dev->gcChunk)) { + + /* This page is in use and might need to be copied off */ + ++ maxCopies--; ++ + markNAND = 1; + + yaffs_InitialiseTags(&tags); +@@ -2959,22 +3025,22 @@ static int yaffs_GarbageCollectBlock(yaf + + T(YAFFS_TRACE_GC_DETAIL, + (TSTR +- ("Collecting page %d, %d %d %d " TENDSTR), +- chunkInBlock, tags.objectId, tags.chunkId, ++ ("Collecting chunk in block %d, %d %d %d " TENDSTR), ++ dev->gcChunk, tags.objectId, tags.chunkId, + tags.byteCount)); + +- if(object && !yaffs_SkipVerification(dev)){ +- if(tags.chunkId == 0) +- matchingChunk = object->chunkId; +- else if(object->softDeleted) ++ if (object && !yaffs_SkipVerification(dev)) { ++ if (tags.chunkId == 0) ++ matchingChunk = object->hdrChunk; ++ else if (object->softDeleted) + matchingChunk = oldChunk; /* Defeat the test */ + else +- matchingChunk = yaffs_FindChunkInFile(object,tags.chunkId,NULL); ++ matchingChunk = yaffs_FindChunkInFile(object, tags.chunkId, NULL); + +- if(oldChunk != matchingChunk) ++ if (oldChunk != matchingChunk) + T(YAFFS_TRACE_ERROR, + (TSTR("gc: page in gc mismatch: %d %d %d %d"TENDSTR), +- oldChunk,matchingChunk,tags.objectId, tags.chunkId)); ++ oldChunk, matchingChunk, tags.objectId, tags.chunkId)); + + } + +@@ -2986,9 +3052,11 @@ static int yaffs_GarbageCollectBlock(yaf + tags.objectId, tags.chunkId, tags.byteCount)); + } + +- if (object && object->deleted +- && tags.chunkId != 0) { +- /* Data chunk in a deleted file, throw it away ++ if (object && ++ object->deleted && ++ object->softDeleted && ++ tags.chunkId != 0) { ++ /* Data chunk in a soft deleted file, throw it away + * It's a soft deleted data chunk, + * No need to copy this, just forget about it and + * fix up the object. +@@ -3003,13 +3071,12 @@ static int yaffs_GarbageCollectBlock(yaf + cleanups++; + } + markNAND = 0; +- } else if (0 +- /* Todo object && object->deleted && object->nDataChunks == 0 */ +- ) { ++ } else if (0) { ++ /* Todo object && object->deleted && object->nDataChunks == 0 */ + /* Deleted object header with no data chunks. + * Can be discarded and the file deleted. + */ +- object->chunkId = 0; ++ object->hdrChunk = 0; + yaffs_FreeTnode(object->myDev, + object->variant. + fileVariant.top); +@@ -3031,17 +3098,14 @@ static int yaffs_GarbageCollectBlock(yaf + * We need to nuke the shrinkheader flags first + * We no longer want the shrinkHeader flag since its work is done + * and if it is left in place it will mess up scanning. +- * Also, clear out any shadowing stuff + */ + + yaffs_ObjectHeader *oh; + oh = (yaffs_ObjectHeader *)buffer; + oh->isShrink = 0; +- oh->shadowsObject = -1; +- tags.extraShadows = 0; + tags.extraIsShrinkHeader = 0; + +- yaffs_VerifyObjectHeader(object,oh,&tags,1); ++ yaffs_VerifyObjectHeader(object, oh, &tags, 1); + } + + newChunk = +@@ -3055,7 +3119,7 @@ static int yaffs_GarbageCollectBlock(yaf + + if (tags.chunkId == 0) { + /* It's a header */ +- object->chunkId = newChunk; ++ object->hdrChunk = newChunk; + object->serial = tags.serialNumber; + } else { + /* It's a data chunk */ +@@ -3067,7 +3131,8 @@ static int yaffs_GarbageCollectBlock(yaf + } + } + +- yaffs_DeleteChunk(dev, oldChunk, markNAND, __LINE__); ++ if (retVal == YAFFS_OK) ++ yaffs_DeleteChunk(dev, oldChunk, markNAND, __LINE__); + + } + } +@@ -3098,18 +3163,25 @@ static int yaffs_GarbageCollectBlock(yaf + + } + +- yaffs_VerifyCollectedBlock(dev,bi,block); ++ yaffs_VerifyCollectedBlock(dev, bi, block); + +- if (chunksBefore >= (chunksAfter = yaffs_GetErasedChunks(dev))) { ++ chunksAfter = yaffs_GetErasedChunks(dev); ++ if (chunksBefore >= chunksAfter) { + T(YAFFS_TRACE_GC, + (TSTR + ("gc did not increase free chunks before %d after %d" + TENDSTR), chunksBefore, chunksAfter)); + } + ++ /* If the gc completed then clear the current gcBlock so that we find another. */ ++ if (bi->blockState != YAFFS_BLOCK_STATE_COLLECTING) { ++ dev->gcBlock = -1; ++ dev->gcChunk = 0; ++ } ++ + dev->isDoingGC = 0; + +- return YAFFS_OK; ++ return retVal; + } + + /* New garbage collector +@@ -3121,7 +3193,7 @@ static int yaffs_GarbageCollectBlock(yaf + * The idea is to help clear out space in a more spread-out manner. + * Dunno if it really does anything useful. + */ +-static int yaffs_CheckGarbageCollection(yaffs_Device * dev) ++static int yaffs_CheckGarbageCollection(yaffs_Device *dev) + { + int block; + int aggressive; +@@ -3142,8 +3214,8 @@ static int yaffs_CheckGarbageCollection( + do { + maxTries++; + +- checkpointBlockAdjust = (dev->nCheckpointReservedBlocks - dev->blocksInCheckpoint); +- if(checkpointBlockAdjust < 0) ++ checkpointBlockAdjust = yaffs_CalcCheckpointBlocksRequired(dev) - dev->blocksInCheckpoint; ++ if (checkpointBlockAdjust < 0) + checkpointBlockAdjust = 0; + + if (dev->nErasedBlocks < (dev->nReservedBlocks + checkpointBlockAdjust + 2)) { +@@ -3154,20 +3226,24 @@ static int yaffs_CheckGarbageCollection( + aggressive = 0; + } + +- block = yaffs_FindBlockForGarbageCollection(dev, aggressive); ++ if (dev->gcBlock <= 0) { ++ dev->gcBlock = yaffs_FindBlockForGarbageCollection(dev, aggressive); ++ dev->gcChunk = 0; ++ } ++ ++ block = dev->gcBlock; + + if (block > 0) { + dev->garbageCollections++; +- if (!aggressive) { ++ if (!aggressive) + dev->passiveGarbageCollections++; +- } + + T(YAFFS_TRACE_GC, + (TSTR + ("yaffs: GC erasedBlocks %d aggressive %d" TENDSTR), + dev->nErasedBlocks, aggressive)); + +- gcOk = yaffs_GarbageCollectBlock(dev, block); ++ gcOk = yaffs_GarbageCollectBlock(dev, block, aggressive); + } + + if (dev->nErasedBlocks < (dev->nReservedBlocks) && block > 0) { +@@ -3176,15 +3252,16 @@ static int yaffs_CheckGarbageCollection( + ("yaffs: GC !!!no reclaim!!! erasedBlocks %d after try %d block %d" + TENDSTR), dev->nErasedBlocks, maxTries, block)); + } +- } while ((dev->nErasedBlocks < dev->nReservedBlocks) && (block > 0) +- && (maxTries < 2)); ++ } while ((dev->nErasedBlocks < dev->nReservedBlocks) && ++ (block > 0) && ++ (maxTries < 2)); + + return aggressive ? gcOk : YAFFS_OK; + } + + /*------------------------- TAGS --------------------------------*/ + +-static int yaffs_TagsMatch(const yaffs_ExtendedTags * tags, int objectId, ++static int yaffs_TagsMatch(const yaffs_ExtendedTags *tags, int objectId, + int chunkInObject) + { + return (tags->chunkId == chunkInObject && +@@ -3195,8 +3272,8 @@ static int yaffs_TagsMatch(const yaffs_E + + /*-------------------- Data file manipulation -----------------*/ + +-static int yaffs_FindChunkInFile(yaffs_Object * in, int chunkInInode, +- yaffs_ExtendedTags * tags) ++static int yaffs_FindChunkInFile(yaffs_Object *in, int chunkInInode, ++ yaffs_ExtendedTags *tags) + { + /*Get the Tnode, then get the level 0 offset chunk offset */ + yaffs_Tnode *tn; +@@ -3214,7 +3291,7 @@ static int yaffs_FindChunkInFile(yaffs_O + tn = yaffs_FindLevel0Tnode(dev, &in->variant.fileVariant, chunkInInode); + + if (tn) { +- theChunk = yaffs_GetChunkGroupBase(dev,tn,chunkInInode); ++ theChunk = yaffs_GetChunkGroupBase(dev, tn, chunkInInode); + + retVal = + yaffs_FindChunkInGroup(dev, theChunk, tags, in->objectId, +@@ -3223,8 +3300,8 @@ static int yaffs_FindChunkInFile(yaffs_O + return retVal; + } + +-static int yaffs_FindAndDeleteChunkInFile(yaffs_Object * in, int chunkInInode, +- yaffs_ExtendedTags * tags) ++static int yaffs_FindAndDeleteChunkInFile(yaffs_Object *in, int chunkInInode, ++ yaffs_ExtendedTags *tags) + { + /* Get the Tnode, then get the level 0 offset chunk offset */ + yaffs_Tnode *tn; +@@ -3243,29 +3320,23 @@ static int yaffs_FindAndDeleteChunkInFil + + if (tn) { + +- theChunk = yaffs_GetChunkGroupBase(dev,tn,chunkInInode); ++ theChunk = yaffs_GetChunkGroupBase(dev, tn, chunkInInode); + + retVal = + yaffs_FindChunkInGroup(dev, theChunk, tags, in->objectId, + chunkInInode); + + /* Delete the entry in the filestructure (if found) */ +- if (retVal != -1) { +- yaffs_PutLevel0Tnode(dev,tn,chunkInInode,0); +- } +- } else { +- /*T(("No level 0 found for %d\n", chunkInInode)); */ ++ if (retVal != -1) ++ yaffs_PutLevel0Tnode(dev, tn, chunkInInode, 0); + } + +- if (retVal == -1) { +- /* T(("Could not find %d to delete\n",chunkInInode)); */ +- } + return retVal; + } + + #ifdef YAFFS_PARANOID + +-static int yaffs_CheckFileSanity(yaffs_Object * in) ++static int yaffs_CheckFileSanity(yaffs_Object *in) + { + int chunk; + int nChunks; +@@ -3278,10 +3349,8 @@ static int yaffs_CheckFileSanity(yaffs_O + int theChunk; + int chunkDeleted; + +- if (in->variantType != YAFFS_OBJECT_TYPE_FILE) { +- /* T(("Object not a file\n")); */ ++ if (in->variantType != YAFFS_OBJECT_TYPE_FILE) + return YAFFS_FAIL; +- } + + objId = in->objectId; + fSize = in->variant.fileVariant.fileSize; +@@ -3294,7 +3363,7 @@ static int yaffs_CheckFileSanity(yaffs_O + + if (tn) { + +- theChunk = yaffs_GetChunkGroupBase(dev,tn,chunk); ++ theChunk = yaffs_GetChunkGroupBase(dev, tn, chunk); + + if (yaffs_CheckChunkBits + (dev, theChunk / dev->nChunksPerBlock, +@@ -3323,7 +3392,7 @@ static int yaffs_CheckFileSanity(yaffs_O + + #endif + +-static int yaffs_PutChunkIntoFile(yaffs_Object * in, int chunkInInode, ++static int yaffs_PutChunkIntoFile(yaffs_Object *in, int chunkInInode, + int chunkInNAND, int inScan) + { + /* NB inScan is zero unless scanning. +@@ -3358,11 +3427,10 @@ static int yaffs_PutChunkIntoFile(yaffs_ + &in->variant.fileVariant, + chunkInInode, + NULL); +- if (!tn) { ++ if (!tn) + return YAFFS_FAIL; +- } + +- existingChunk = yaffs_GetChunkGroupBase(dev,tn,chunkInInode); ++ existingChunk = yaffs_GetChunkGroupBase(dev, tn, chunkInInode); + + if (inScan != 0) { + /* If we're scanning then we need to test for duplicates +@@ -3374,7 +3442,7 @@ static int yaffs_PutChunkIntoFile(yaffs_ + * Update: For backward scanning we don't need to re-read tags so this is quite cheap. + */ + +- if (existingChunk != 0) { ++ if (existingChunk > 0) { + /* NB Right now existing chunk will not be real chunkId if the device >= 32MB + * thus we have to do a FindChunkInFile to get the real chunk id. + * +@@ -3411,8 +3479,10 @@ static int yaffs_PutChunkIntoFile(yaffs_ + * not be loaded during a scan + */ + +- newSerial = newTags.serialNumber; +- existingSerial = existingTags.serialNumber; ++ if (inScan > 0) { ++ newSerial = newTags.serialNumber; ++ existingSerial = existingTags.serialNumber; ++ } + + if ((inScan > 0) && + (in->myDev->isYaffs2 || +@@ -3437,24 +3507,23 @@ static int yaffs_PutChunkIntoFile(yaffs_ + + } + +- if (existingChunk == 0) { ++ if (existingChunk == 0) + in->nDataChunks++; +- } + +- yaffs_PutLevel0Tnode(dev,tn,chunkInInode,chunkInNAND); ++ yaffs_PutLevel0Tnode(dev, tn, chunkInInode, chunkInNAND); + + return YAFFS_OK; + } + +-static int yaffs_ReadChunkDataFromObject(yaffs_Object * in, int chunkInInode, +- __u8 * buffer) ++static int yaffs_ReadChunkDataFromObject(yaffs_Object *in, int chunkInInode, ++ __u8 *buffer) + { + int chunkInNAND = yaffs_FindChunkInFile(in, chunkInInode, NULL); + +- if (chunkInNAND >= 0) { ++ if (chunkInNAND >= 0) + return yaffs_ReadChunkWithTagsFromNAND(in->myDev, chunkInNAND, +- buffer,NULL); +- } else { ++ buffer, NULL); ++ else { + T(YAFFS_TRACE_NANDACCESS, + (TSTR("Chunk %d not found zero instead" TENDSTR), + chunkInNAND)); +@@ -3465,7 +3534,7 @@ static int yaffs_ReadChunkDataFromObject + + } + +-void yaffs_DeleteChunk(yaffs_Device * dev, int chunkId, int markNAND, int lyn) ++void yaffs_DeleteChunk(yaffs_Device *dev, int chunkId, int markNAND, int lyn) + { + int block; + int page; +@@ -3475,16 +3544,15 @@ void yaffs_DeleteChunk(yaffs_Device * de + if (chunkId <= 0) + return; + +- + dev->nDeletions++; + block = chunkId / dev->nChunksPerBlock; + page = chunkId % dev->nChunksPerBlock; + + +- if(!yaffs_CheckChunkBit(dev,block,page)) ++ if (!yaffs_CheckChunkBit(dev, block, page)) + T(YAFFS_TRACE_VERIFY, +- (TSTR("Deleting invalid chunk %d"TENDSTR), +- chunkId)); ++ (TSTR("Deleting invalid chunk %d"TENDSTR), ++ chunkId)); + + bi = yaffs_GetBlockInfo(dev, block); + +@@ -3524,14 +3592,12 @@ void yaffs_DeleteChunk(yaffs_Device * de + yaffs_BlockBecameDirty(dev, block); + } + +- } else { +- /* T(("Bad news deleting chunk %d\n",chunkId)); */ + } + + } + +-static int yaffs_WriteChunkDataToObject(yaffs_Object * in, int chunkInInode, +- const __u8 * buffer, int nBytes, ++static int yaffs_WriteChunkDataToObject(yaffs_Object *in, int chunkInInode, ++ const __u8 *buffer, int nBytes, + int useReserve) + { + /* Find old chunk Need to do this to get serial number +@@ -3561,6 +3627,12 @@ static int yaffs_WriteChunkDataToObject( + (prevChunkId >= 0) ? prevTags.serialNumber + 1 : 1; + newTags.byteCount = nBytes; + ++ if (nBytes < 1 || nBytes > dev->totalBytesPerChunk) { ++ T(YAFFS_TRACE_ERROR, ++ (TSTR("Writing %d bytes to chunk!!!!!!!!!" TENDSTR), nBytes)); ++ YBUG(); ++ } ++ + newChunkId = + yaffs_WriteNewChunkWithTagsToNAND(dev, buffer, &newTags, + useReserve); +@@ -3568,11 +3640,9 @@ static int yaffs_WriteChunkDataToObject( + if (newChunkId >= 0) { + yaffs_PutChunkIntoFile(in, chunkInInode, newChunkId, 0); + +- if (prevChunkId >= 0) { ++ if (prevChunkId >= 0) + yaffs_DeleteChunk(dev, prevChunkId, 1, __LINE__); + +- } +- + yaffs_CheckFileSanity(in); + } + return newChunkId; +@@ -3582,7 +3652,7 @@ static int yaffs_WriteChunkDataToObject( + /* UpdateObjectHeader updates the header on NAND for an object. + * If name is not NULL, then that new name is used. + */ +-int yaffs_UpdateObjectHeader(yaffs_Object * in, const YCHAR * name, int force, ++int yaffs_UpdateObjectHeader(yaffs_Object *in, const YCHAR *name, int force, + int isShrink, int shadows) + { + +@@ -3603,9 +3673,12 @@ int yaffs_UpdateObjectHeader(yaffs_Objec + + yaffs_ObjectHeader *oh = NULL; + +- yaffs_strcpy(oldName,"silly old name"); ++ yaffs_strcpy(oldName, _Y("silly old name")); + +- if (!in->fake || force) { ++ ++ if (!in->fake || ++ in == dev->rootDir || /* The rootDir should also be saved */ ++ force) { + + yaffs_CheckGarbageCollection(dev); + yaffs_CheckObjectDetailsLoaded(in); +@@ -3613,13 +3686,13 @@ int yaffs_UpdateObjectHeader(yaffs_Objec + buffer = yaffs_GetTempBuffer(in->myDev, __LINE__); + oh = (yaffs_ObjectHeader *) buffer; + +- prevChunkId = in->chunkId; ++ prevChunkId = in->hdrChunk; + +- if (prevChunkId >= 0) { ++ if (prevChunkId > 0) { + result = yaffs_ReadChunkWithTagsFromNAND(dev, prevChunkId, + buffer, &oldTags); + +- yaffs_VerifyObjectHeader(in,oh,&oldTags,0); ++ yaffs_VerifyObjectHeader(in, oh, &oldTags, 0); + + memcpy(oldName, oh->name, sizeof(oh->name)); + } +@@ -3628,7 +3701,7 @@ int yaffs_UpdateObjectHeader(yaffs_Objec + + oh->type = in->variantType; + oh->yst_mode = in->yst_mode; +- oh->shadowsObject = shadows; ++ oh->shadowsObject = oh->inbandShadowsObject = shadows; + + #ifdef CONFIG_YAFFS_WINCE + oh->win_atime[0] = in->win_atime[0]; +@@ -3645,20 +3718,18 @@ int yaffs_UpdateObjectHeader(yaffs_Objec + oh->yst_ctime = in->yst_ctime; + oh->yst_rdev = in->yst_rdev; + #endif +- if (in->parent) { ++ if (in->parent) + oh->parentObjectId = in->parent->objectId; +- } else { ++ else + oh->parentObjectId = 0; +- } + + if (name && *name) { + memset(oh->name, 0, sizeof(oh->name)); + yaffs_strncpy(oh->name, name, YAFFS_MAX_NAME_LENGTH); +- } else if (prevChunkId>=0) { ++ } else if (prevChunkId >= 0) + memcpy(oh->name, oldName, sizeof(oh->name)); +- } else { ++ else + memset(oh->name, 0, sizeof(oh->name)); +- } + + oh->isShrink = isShrink; + +@@ -3708,7 +3779,7 @@ int yaffs_UpdateObjectHeader(yaffs_Objec + newTags.extraShadows = (oh->shadowsObject > 0) ? 1 : 0; + newTags.extraObjectType = in->variantType; + +- yaffs_VerifyObjectHeader(in,oh,&newTags,1); ++ yaffs_VerifyObjectHeader(in, oh, &newTags, 1); + + /* Create new chunk in NAND */ + newChunkId = +@@ -3717,20 +3788,20 @@ int yaffs_UpdateObjectHeader(yaffs_Objec + + if (newChunkId >= 0) { + +- in->chunkId = newChunkId; ++ in->hdrChunk = newChunkId; + + if (prevChunkId >= 0) { + yaffs_DeleteChunk(dev, prevChunkId, 1, + __LINE__); + } + +- if(!yaffs_ObjectHasCachedWriteData(in)) ++ if (!yaffs_ObjectHasCachedWriteData(in)) + in->dirty = 0; + + /* If this was a shrink, then mark the block that the chunk lives on */ + if (isShrink) { + bi = yaffs_GetBlockInfo(in->myDev, +- newChunkId /in->myDev-> nChunksPerBlock); ++ newChunkId / in->myDev->nChunksPerBlock); + bi->hasShrinkHeader = 1; + } + +@@ -3766,7 +3837,7 @@ static int yaffs_ObjectHasCachedWriteDat + yaffs_ChunkCache *cache; + int nCaches = obj->myDev->nShortOpCaches; + +- for(i = 0; i < nCaches; i++){ ++ for (i = 0; i < nCaches; i++) { + cache = &dev->srCache[i]; + if (cache->object == obj && + cache->dirty) +@@ -3777,7 +3848,7 @@ static int yaffs_ObjectHasCachedWriteDat + } + + +-static void yaffs_FlushFilesChunkCache(yaffs_Object * obj) ++static void yaffs_FlushFilesChunkCache(yaffs_Object *obj) + { + yaffs_Device *dev = obj->myDev; + int lowest = -99; /* Stop compiler whining. */ +@@ -3844,16 +3915,16 @@ void yaffs_FlushEntireDeviceCache(yaffs_ + */ + do { + obj = NULL; +- for( i = 0; i < nCaches && !obj; i++) { ++ for (i = 0; i < nCaches && !obj; i++) { + if (dev->srCache[i].object && + dev->srCache[i].dirty) + obj = dev->srCache[i].object; + + } +- if(obj) ++ if (obj) + yaffs_FlushFilesChunkCache(obj); + +- } while(obj); ++ } while (obj); + + } + +@@ -3863,41 +3934,21 @@ void yaffs_FlushEntireDeviceCache(yaffs_ + * Then look for the least recently used non-dirty one. + * Then look for the least recently used dirty one...., flush and look again. + */ +-static yaffs_ChunkCache *yaffs_GrabChunkCacheWorker(yaffs_Device * dev) ++static yaffs_ChunkCache *yaffs_GrabChunkCacheWorker(yaffs_Device *dev) + { + int i; +- int usage; +- int theOne; + + if (dev->nShortOpCaches > 0) { + for (i = 0; i < dev->nShortOpCaches; i++) { + if (!dev->srCache[i].object) + return &dev->srCache[i]; + } ++ } + +- return NULL; ++ return NULL; ++} + +- theOne = -1; +- usage = 0; /* just to stop the compiler grizzling */ +- +- for (i = 0; i < dev->nShortOpCaches; i++) { +- if (!dev->srCache[i].dirty && +- ((dev->srCache[i].lastUse < usage && theOne >= 0) || +- theOne < 0)) { +- usage = dev->srCache[i].lastUse; +- theOne = i; +- } +- } +- +- +- return theOne >= 0 ? &dev->srCache[theOne] : NULL; +- } else { +- return NULL; +- } +- +-} +- +-static yaffs_ChunkCache *yaffs_GrabChunkCache(yaffs_Device * dev) ++static yaffs_ChunkCache *yaffs_GrabChunkCache(yaffs_Device *dev) + { + yaffs_ChunkCache *cache; + yaffs_Object *theObj; +@@ -3927,8 +3978,7 @@ static yaffs_ChunkCache *yaffs_GrabChunk + for (i = 0; i < dev->nShortOpCaches; i++) { + if (dev->srCache[i].object && + !dev->srCache[i].locked && +- (dev->srCache[i].lastUse < usage || !cache)) +- { ++ (dev->srCache[i].lastUse < usage || !cache)) { + usage = dev->srCache[i].lastUse; + theObj = dev->srCache[i].object; + cache = &dev->srCache[i]; +@@ -3950,7 +4000,7 @@ static yaffs_ChunkCache *yaffs_GrabChunk + } + + /* Find a cached chunk */ +-static yaffs_ChunkCache *yaffs_FindChunkCache(const yaffs_Object * obj, ++static yaffs_ChunkCache *yaffs_FindChunkCache(const yaffs_Object *obj, + int chunkId) + { + yaffs_Device *dev = obj->myDev; +@@ -3969,7 +4019,7 @@ static yaffs_ChunkCache *yaffs_FindChunk + } + + /* Mark the chunk for the least recently used algorithym */ +-static void yaffs_UseChunkCache(yaffs_Device * dev, yaffs_ChunkCache * cache, ++static void yaffs_UseChunkCache(yaffs_Device *dev, yaffs_ChunkCache *cache, + int isAWrite) + { + +@@ -3977,9 +4027,9 @@ static void yaffs_UseChunkCache(yaffs_De + if (dev->srLastUse < 0 || dev->srLastUse > 100000000) { + /* Reset the cache usages */ + int i; +- for (i = 1; i < dev->nShortOpCaches; i++) { ++ for (i = 1; i < dev->nShortOpCaches; i++) + dev->srCache[i].lastUse = 0; +- } ++ + dev->srLastUse = 0; + } + +@@ -3987,9 +4037,8 @@ static void yaffs_UseChunkCache(yaffs_De + + cache->lastUse = dev->srLastUse; + +- if (isAWrite) { ++ if (isAWrite) + cache->dirty = 1; +- } + } + } + +@@ -3997,21 +4046,20 @@ static void yaffs_UseChunkCache(yaffs_De + * Do this when a whole page gets written, + * ie the short cache for this page is no longer valid. + */ +-static void yaffs_InvalidateChunkCache(yaffs_Object * object, int chunkId) ++static void yaffs_InvalidateChunkCache(yaffs_Object *object, int chunkId) + { + if (object->myDev->nShortOpCaches > 0) { + yaffs_ChunkCache *cache = yaffs_FindChunkCache(object, chunkId); + +- if (cache) { ++ if (cache) + cache->object = NULL; +- } + } + } + + /* Invalidate all the cache pages associated with this object + * Do this whenever ther file is deleted or resized. + */ +-static void yaffs_InvalidateWholeChunkCache(yaffs_Object * in) ++static void yaffs_InvalidateWholeChunkCache(yaffs_Object *in) + { + int i; + yaffs_Device *dev = in->myDev; +@@ -4019,9 +4067,8 @@ static void yaffs_InvalidateWholeChunkCa + if (dev->nShortOpCaches > 0) { + /* Invalidate it. */ + for (i = 0; i < dev->nShortOpCaches; i++) { +- if (dev->srCache[i].object == in) { ++ if (dev->srCache[i].object == in) + dev->srCache[i].object = NULL; +- } + } + } + } +@@ -4029,18 +4076,18 @@ static void yaffs_InvalidateWholeChunkCa + /*--------------------- Checkpointing --------------------*/ + + +-static int yaffs_WriteCheckpointValidityMarker(yaffs_Device *dev,int head) ++static int yaffs_WriteCheckpointValidityMarker(yaffs_Device *dev, int head) + { + yaffs_CheckpointValidity cp; + +- memset(&cp,0,sizeof(cp)); ++ memset(&cp, 0, sizeof(cp)); + + cp.structType = sizeof(cp); + cp.magic = YAFFS_MAGIC; + cp.version = YAFFS_CHECKPOINT_VERSION; + cp.head = (head) ? 1 : 0; + +- return (yaffs_CheckpointWrite(dev,&cp,sizeof(cp)) == sizeof(cp))? ++ return (yaffs_CheckpointWrite(dev, &cp, sizeof(cp)) == sizeof(cp)) ? + 1 : 0; + } + +@@ -4049,9 +4096,9 @@ static int yaffs_ReadCheckpointValidityM + yaffs_CheckpointValidity cp; + int ok; + +- ok = (yaffs_CheckpointRead(dev,&cp,sizeof(cp)) == sizeof(cp)); ++ ok = (yaffs_CheckpointRead(dev, &cp, sizeof(cp)) == sizeof(cp)); + +- if(ok) ++ if (ok) + ok = (cp.structType == sizeof(cp)) && + (cp.magic == YAFFS_MAGIC) && + (cp.version == YAFFS_CHECKPOINT_VERSION) && +@@ -4100,21 +4147,21 @@ static int yaffs_WriteCheckpointDevice(y + int ok; + + /* Write device runtime values*/ +- yaffs_DeviceToCheckpointDevice(&cp,dev); ++ yaffs_DeviceToCheckpointDevice(&cp, dev); + cp.structType = sizeof(cp); + +- ok = (yaffs_CheckpointWrite(dev,&cp,sizeof(cp)) == sizeof(cp)); ++ ok = (yaffs_CheckpointWrite(dev, &cp, sizeof(cp)) == sizeof(cp)); + + /* Write block info */ +- if(ok) { ++ if (ok) { + nBytes = nBlocks * sizeof(yaffs_BlockInfo); +- ok = (yaffs_CheckpointWrite(dev,dev->blockInfo,nBytes) == nBytes); ++ ok = (yaffs_CheckpointWrite(dev, dev->blockInfo, nBytes) == nBytes); + } + + /* Write chunk bits */ +- if(ok) { ++ if (ok) { + nBytes = nBlocks * dev->chunkBitmapStride; +- ok = (yaffs_CheckpointWrite(dev,dev->chunkBits,nBytes) == nBytes); ++ ok = (yaffs_CheckpointWrite(dev, dev->chunkBits, nBytes) == nBytes); + } + return ok ? 1 : 0; + +@@ -4128,25 +4175,25 @@ static int yaffs_ReadCheckpointDevice(ya + + int ok; + +- ok = (yaffs_CheckpointRead(dev,&cp,sizeof(cp)) == sizeof(cp)); +- if(!ok) ++ ok = (yaffs_CheckpointRead(dev, &cp, sizeof(cp)) == sizeof(cp)); ++ if (!ok) + return 0; + +- if(cp.structType != sizeof(cp)) ++ if (cp.structType != sizeof(cp)) + return 0; + + +- yaffs_CheckpointDeviceToDevice(dev,&cp); ++ yaffs_CheckpointDeviceToDevice(dev, &cp); + + nBytes = nBlocks * sizeof(yaffs_BlockInfo); + +- ok = (yaffs_CheckpointRead(dev,dev->blockInfo,nBytes) == nBytes); ++ ok = (yaffs_CheckpointRead(dev, dev->blockInfo, nBytes) == nBytes); + +- if(!ok) ++ if (!ok) + return 0; + nBytes = nBlocks * dev->chunkBitmapStride; + +- ok = (yaffs_CheckpointRead(dev,dev->chunkBits,nBytes) == nBytes); ++ ok = (yaffs_CheckpointRead(dev, dev->chunkBits, nBytes) == nBytes); + + return ok ? 1 : 0; + } +@@ -4157,7 +4204,7 @@ static void yaffs_ObjectToCheckpointObje + + cp->objectId = obj->objectId; + cp->parentId = (obj->parent) ? obj->parent->objectId : 0; +- cp->chunkId = obj->chunkId; ++ cp->hdrChunk = obj->hdrChunk; + cp->variantType = obj->variantType; + cp->deleted = obj->deleted; + cp->softDeleted = obj->softDeleted; +@@ -4168,20 +4215,28 @@ static void yaffs_ObjectToCheckpointObje + cp->serial = obj->serial; + cp->nDataChunks = obj->nDataChunks; + +- if(obj->variantType == YAFFS_OBJECT_TYPE_FILE) ++ if (obj->variantType == YAFFS_OBJECT_TYPE_FILE) + cp->fileSizeOrEquivalentObjectId = obj->variant.fileVariant.fileSize; +- else if(obj->variantType == YAFFS_OBJECT_TYPE_HARDLINK) ++ else if (obj->variantType == YAFFS_OBJECT_TYPE_HARDLINK) + cp->fileSizeOrEquivalentObjectId = obj->variant.hardLinkVariant.equivalentObjectId; + } + +-static void yaffs_CheckpointObjectToObject( yaffs_Object *obj,yaffs_CheckpointObject *cp) ++static int yaffs_CheckpointObjectToObject(yaffs_Object *obj, yaffs_CheckpointObject *cp) + { + + yaffs_Object *parent; + ++ if (obj->variantType != cp->variantType) { ++ T(YAFFS_TRACE_ERROR, (TSTR("Checkpoint read object %d type %d " ++ TCONT("chunk %d does not match existing object type %d") ++ TENDSTR), cp->objectId, cp->variantType, cp->hdrChunk, ++ obj->variantType)); ++ return 0; ++ } ++ + obj->objectId = cp->objectId; + +- if(cp->parentId) ++ if (cp->parentId) + parent = yaffs_FindOrCreateObjectByNumber( + obj->myDev, + cp->parentId, +@@ -4189,10 +4244,19 @@ static void yaffs_CheckpointObjectToObje + else + parent = NULL; + +- if(parent) ++ if (parent) { ++ if (parent->variantType != YAFFS_OBJECT_TYPE_DIRECTORY) { ++ T(YAFFS_TRACE_ALWAYS, (TSTR("Checkpoint read object %d parent %d type %d" ++ TCONT(" chunk %d Parent type, %d, not directory") ++ TENDSTR), ++ cp->objectId, cp->parentId, cp->variantType, ++ cp->hdrChunk, parent->variantType)); ++ return 0; ++ } + yaffs_AddObjectToDirectory(parent, obj); ++ } + +- obj->chunkId = cp->chunkId; ++ obj->hdrChunk = cp->hdrChunk; + obj->variantType = cp->variantType; + obj->deleted = cp->deleted; + obj->softDeleted = cp->softDeleted; +@@ -4203,29 +4267,34 @@ static void yaffs_CheckpointObjectToObje + obj->serial = cp->serial; + obj->nDataChunks = cp->nDataChunks; + +- if(obj->variantType == YAFFS_OBJECT_TYPE_FILE) ++ if (obj->variantType == YAFFS_OBJECT_TYPE_FILE) + obj->variant.fileVariant.fileSize = cp->fileSizeOrEquivalentObjectId; +- else if(obj->variantType == YAFFS_OBJECT_TYPE_HARDLINK) ++ else if (obj->variantType == YAFFS_OBJECT_TYPE_HARDLINK) + obj->variant.hardLinkVariant.equivalentObjectId = cp->fileSizeOrEquivalentObjectId; + +- if(obj->objectId >= YAFFS_NOBJECT_BUCKETS) ++ if (obj->hdrChunk > 0) + obj->lazyLoaded = 1; ++ return 1; + } + + + +-static int yaffs_CheckpointTnodeWorker(yaffs_Object * in, yaffs_Tnode * tn, +- __u32 level, int chunkOffset) ++static int yaffs_CheckpointTnodeWorker(yaffs_Object *in, yaffs_Tnode *tn, ++ __u32 level, int chunkOffset) + { + int i; + yaffs_Device *dev = in->myDev; + int ok = 1; +- int nTnodeBytes = (dev->tnodeWidth * YAFFS_NTNODES_LEVEL0)/8; ++ int tnodeSize = (dev->tnodeWidth * YAFFS_NTNODES_LEVEL0)/8; ++ ++ if (tnodeSize < sizeof(yaffs_Tnode)) ++ tnodeSize = sizeof(yaffs_Tnode); ++ + + if (tn) { + if (level > 0) { + +- for (i = 0; i < YAFFS_NTNODES_INTERNAL && ok; i++){ ++ for (i = 0; i < YAFFS_NTNODES_INTERNAL && ok; i++) { + if (tn->internal[i]) { + ok = yaffs_CheckpointTnodeWorker(in, + tn->internal[i], +@@ -4235,10 +4304,9 @@ static int yaffs_CheckpointTnodeWorker(y + } + } else if (level == 0) { + __u32 baseOffset = chunkOffset << YAFFS_TNODES_LEVEL0_BITS; +- /* printf("write tnode at %d\n",baseOffset); */ +- ok = (yaffs_CheckpointWrite(dev,&baseOffset,sizeof(baseOffset)) == sizeof(baseOffset)); +- if(ok) +- ok = (yaffs_CheckpointWrite(dev,tn,nTnodeBytes) == nTnodeBytes); ++ ok = (yaffs_CheckpointWrite(dev, &baseOffset, sizeof(baseOffset)) == sizeof(baseOffset)); ++ if (ok) ++ ok = (yaffs_CheckpointWrite(dev, tn, tnodeSize) == tnodeSize); + } + } + +@@ -4251,13 +4319,13 @@ static int yaffs_WriteCheckpointTnodes(y + __u32 endMarker = ~0; + int ok = 1; + +- if(obj->variantType == YAFFS_OBJECT_TYPE_FILE){ ++ if (obj->variantType == YAFFS_OBJECT_TYPE_FILE) { + ok = yaffs_CheckpointTnodeWorker(obj, + obj->variant.fileVariant.top, + obj->variant.fileVariant.topLevel, + 0); +- if(ok) +- ok = (yaffs_CheckpointWrite(obj->myDev,&endMarker,sizeof(endMarker)) == ++ if (ok) ++ ok = (yaffs_CheckpointWrite(obj->myDev, &endMarker, sizeof(endMarker)) == + sizeof(endMarker)); + } + +@@ -4272,38 +4340,38 @@ static int yaffs_ReadCheckpointTnodes(ya + yaffs_FileStructure *fileStructPtr = &obj->variant.fileVariant; + yaffs_Tnode *tn; + int nread = 0; ++ int tnodeSize = (dev->tnodeWidth * YAFFS_NTNODES_LEVEL0)/8; + +- ok = (yaffs_CheckpointRead(dev,&baseChunk,sizeof(baseChunk)) == sizeof(baseChunk)); ++ if (tnodeSize < sizeof(yaffs_Tnode)) ++ tnodeSize = sizeof(yaffs_Tnode); + +- while(ok && (~baseChunk)){ ++ ok = (yaffs_CheckpointRead(dev, &baseChunk, sizeof(baseChunk)) == sizeof(baseChunk)); ++ ++ while (ok && (~baseChunk)) { + nread++; + /* Read level 0 tnode */ + + +- /* printf("read tnode at %d\n",baseChunk); */ + tn = yaffs_GetTnodeRaw(dev); +- if(tn) +- ok = (yaffs_CheckpointRead(dev,tn,(dev->tnodeWidth * YAFFS_NTNODES_LEVEL0)/8) == +- (dev->tnodeWidth * YAFFS_NTNODES_LEVEL0)/8); ++ if (tn) ++ ok = (yaffs_CheckpointRead(dev, tn, tnodeSize) == tnodeSize); + else + ok = 0; + +- if(tn && ok){ ++ if (tn && ok) + ok = yaffs_AddOrFindLevel0Tnode(dev, +- fileStructPtr, +- baseChunk, +- tn) ? 1 : 0; ++ fileStructPtr, ++ baseChunk, ++ tn) ? 1 : 0; + +- } +- +- if(ok) +- ok = (yaffs_CheckpointRead(dev,&baseChunk,sizeof(baseChunk)) == sizeof(baseChunk)); ++ if (ok) ++ ok = (yaffs_CheckpointRead(dev, &baseChunk, sizeof(baseChunk)) == sizeof(baseChunk)); + + } + +- T(YAFFS_TRACE_CHECKPOINT,( ++ T(YAFFS_TRACE_CHECKPOINT, ( + TSTR("Checkpoint read tnodes %d records, last %d. ok %d" TENDSTR), +- nread,baseChunk,ok)); ++ nread, baseChunk, ok)); + + return ok ? 1 : 0; + } +@@ -4315,41 +4383,40 @@ static int yaffs_WriteCheckpointObjects( + yaffs_CheckpointObject cp; + int i; + int ok = 1; +- struct list_head *lh; ++ struct ylist_head *lh; + + + /* Iterate through the objects in each hash entry, + * dumping them to the checkpointing stream. + */ + +- for(i = 0; ok && i < YAFFS_NOBJECT_BUCKETS; i++){ +- list_for_each(lh, &dev->objectBucket[i].list) { ++ for (i = 0; ok && i < YAFFS_NOBJECT_BUCKETS; i++) { ++ ylist_for_each(lh, &dev->objectBucket[i].list) { + if (lh) { +- obj = list_entry(lh, yaffs_Object, hashLink); ++ obj = ylist_entry(lh, yaffs_Object, hashLink); + if (!obj->deferedFree) { +- yaffs_ObjectToCheckpointObject(&cp,obj); ++ yaffs_ObjectToCheckpointObject(&cp, obj); + cp.structType = sizeof(cp); + +- T(YAFFS_TRACE_CHECKPOINT,( ++ T(YAFFS_TRACE_CHECKPOINT, ( + TSTR("Checkpoint write object %d parent %d type %d chunk %d obj addr %x" TENDSTR), +- cp.objectId,cp.parentId,cp.variantType,cp.chunkId,(unsigned) obj)); ++ cp.objectId, cp.parentId, cp.variantType, cp.hdrChunk, (unsigned) obj)); + +- ok = (yaffs_CheckpointWrite(dev,&cp,sizeof(cp)) == sizeof(cp)); ++ ok = (yaffs_CheckpointWrite(dev, &cp, sizeof(cp)) == sizeof(cp)); + +- if(ok && obj->variantType == YAFFS_OBJECT_TYPE_FILE){ ++ if (ok && obj->variantType == YAFFS_OBJECT_TYPE_FILE) + ok = yaffs_WriteCheckpointTnodes(obj); +- } + } + } + } +- } ++ } + +- /* Dump end of list */ +- memset(&cp,0xFF,sizeof(yaffs_CheckpointObject)); ++ /* Dump end of list */ ++ memset(&cp, 0xFF, sizeof(yaffs_CheckpointObject)); + cp.structType = sizeof(cp); + +- if(ok) +- ok = (yaffs_CheckpointWrite(dev,&cp,sizeof(cp)) == sizeof(cp)); ++ if (ok) ++ ok = (yaffs_CheckpointWrite(dev, &cp, sizeof(cp)) == sizeof(cp)); + + return ok ? 1 : 0; + } +@@ -4362,38 +4429,39 @@ static int yaffs_ReadCheckpointObjects(y + int done = 0; + yaffs_Object *hardList = NULL; + +- while(ok && !done) { +- ok = (yaffs_CheckpointRead(dev,&cp,sizeof(cp)) == sizeof(cp)); +- if(cp.structType != sizeof(cp)) { +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("struct size %d instead of %d ok %d"TENDSTR), +- cp.structType,sizeof(cp),ok)); ++ while (ok && !done) { ++ ok = (yaffs_CheckpointRead(dev, &cp, sizeof(cp)) == sizeof(cp)); ++ if (cp.structType != sizeof(cp)) { ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("struct size %d instead of %d ok %d"TENDSTR), ++ cp.structType, sizeof(cp), ok)); + ok = 0; + } + +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("Checkpoint read object %d parent %d type %d chunk %d " TENDSTR), +- cp.objectId,cp.parentId,cp.variantType,cp.chunkId)); ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("Checkpoint read object %d parent %d type %d chunk %d " TENDSTR), ++ cp.objectId, cp.parentId, cp.variantType, cp.hdrChunk)); + +- if(ok && cp.objectId == ~0) ++ if (ok && cp.objectId == ~0) + done = 1; +- else if(ok){ +- obj = yaffs_FindOrCreateObjectByNumber(dev,cp.objectId, cp.variantType); +- if(obj) { +- yaffs_CheckpointObjectToObject(obj,&cp); +- if(obj->variantType == YAFFS_OBJECT_TYPE_FILE) { ++ else if (ok) { ++ obj = yaffs_FindOrCreateObjectByNumber(dev, cp.objectId, cp.variantType); ++ if (obj) { ++ ok = yaffs_CheckpointObjectToObject(obj, &cp); ++ if (!ok) ++ break; ++ if (obj->variantType == YAFFS_OBJECT_TYPE_FILE) { + ok = yaffs_ReadCheckpointTnodes(obj); +- } else if(obj->variantType == YAFFS_OBJECT_TYPE_HARDLINK) { ++ } else if (obj->variantType == YAFFS_OBJECT_TYPE_HARDLINK) { + obj->hardLinks.next = +- (struct list_head *) +- hardList; ++ (struct ylist_head *) hardList; + hardList = obj; + } +- +- } ++ } else ++ ok = 0; + } + } + +- if(ok) +- yaffs_HardlinkFixup(dev,hardList); ++ if (ok) ++ yaffs_HardlinkFixup(dev, hardList); + + return ok ? 1 : 0; + } +@@ -4403,11 +4471,11 @@ static int yaffs_WriteCheckpointSum(yaff + __u32 checkpointSum; + int ok; + +- yaffs_GetCheckpointSum(dev,&checkpointSum); ++ yaffs_GetCheckpointSum(dev, &checkpointSum); + +- ok = (yaffs_CheckpointWrite(dev,&checkpointSum,sizeof(checkpointSum)) == sizeof(checkpointSum)); ++ ok = (yaffs_CheckpointWrite(dev, &checkpointSum, sizeof(checkpointSum)) == sizeof(checkpointSum)); + +- if(!ok) ++ if (!ok) + return 0; + + return 1; +@@ -4419,14 +4487,14 @@ static int yaffs_ReadCheckpointSum(yaffs + __u32 checkpointSum1; + int ok; + +- yaffs_GetCheckpointSum(dev,&checkpointSum0); ++ yaffs_GetCheckpointSum(dev, &checkpointSum0); + +- ok = (yaffs_CheckpointRead(dev,&checkpointSum1,sizeof(checkpointSum1)) == sizeof(checkpointSum1)); ++ ok = (yaffs_CheckpointRead(dev, &checkpointSum1, sizeof(checkpointSum1)) == sizeof(checkpointSum1)); + +- if(!ok) ++ if (!ok) + return 0; + +- if(checkpointSum0 != checkpointSum1) ++ if (checkpointSum0 != checkpointSum1) + return 0; + + return 1; +@@ -4435,46 +4503,43 @@ static int yaffs_ReadCheckpointSum(yaffs + + static int yaffs_WriteCheckpointData(yaffs_Device *dev) + { +- + int ok = 1; + +- if(dev->skipCheckpointWrite || !dev->isYaffs2){ +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("skipping checkpoint write" TENDSTR))); ++ if (dev->skipCheckpointWrite || !dev->isYaffs2) { ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("skipping checkpoint write" TENDSTR))); + ok = 0; + } + +- if(ok) +- ok = yaffs_CheckpointOpen(dev,1); ++ if (ok) ++ ok = yaffs_CheckpointOpen(dev, 1); + +- if(ok){ +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("write checkpoint validity" TENDSTR))); +- ok = yaffs_WriteCheckpointValidityMarker(dev,1); ++ if (ok) { ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("write checkpoint validity" TENDSTR))); ++ ok = yaffs_WriteCheckpointValidityMarker(dev, 1); + } +- if(ok){ +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("write checkpoint device" TENDSTR))); ++ if (ok) { ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("write checkpoint device" TENDSTR))); + ok = yaffs_WriteCheckpointDevice(dev); + } +- if(ok){ +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("write checkpoint objects" TENDSTR))); ++ if (ok) { ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("write checkpoint objects" TENDSTR))); + ok = yaffs_WriteCheckpointObjects(dev); + } +- if(ok){ +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("write checkpoint validity" TENDSTR))); +- ok = yaffs_WriteCheckpointValidityMarker(dev,0); ++ if (ok) { ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("write checkpoint validity" TENDSTR))); ++ ok = yaffs_WriteCheckpointValidityMarker(dev, 0); + } + +- if(ok){ ++ if (ok) + ok = yaffs_WriteCheckpointSum(dev); +- } +- + +- if(!yaffs_CheckpointClose(dev)) +- ok = 0; ++ if (!yaffs_CheckpointClose(dev)) ++ ok = 0; + +- if(ok) +- dev->isCheckpointed = 1; +- else +- dev->isCheckpointed = 0; ++ if (ok) ++ dev->isCheckpointed = 1; ++ else ++ dev->isCheckpointed = 0; + + return dev->isCheckpointed; + } +@@ -4483,43 +4548,43 @@ static int yaffs_ReadCheckpointData(yaff + { + int ok = 1; + +- if(dev->skipCheckpointRead || !dev->isYaffs2){ +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("skipping checkpoint read" TENDSTR))); ++ if (dev->skipCheckpointRead || !dev->isYaffs2) { ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("skipping checkpoint read" TENDSTR))); + ok = 0; + } + +- if(ok) +- ok = yaffs_CheckpointOpen(dev,0); /* open for read */ ++ if (ok) ++ ok = yaffs_CheckpointOpen(dev, 0); /* open for read */ + +- if(ok){ +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("read checkpoint validity" TENDSTR))); +- ok = yaffs_ReadCheckpointValidityMarker(dev,1); ++ if (ok) { ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("read checkpoint validity" TENDSTR))); ++ ok = yaffs_ReadCheckpointValidityMarker(dev, 1); + } +- if(ok){ +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("read checkpoint device" TENDSTR))); ++ if (ok) { ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("read checkpoint device" TENDSTR))); + ok = yaffs_ReadCheckpointDevice(dev); + } +- if(ok){ +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("read checkpoint objects" TENDSTR))); ++ if (ok) { ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("read checkpoint objects" TENDSTR))); + ok = yaffs_ReadCheckpointObjects(dev); + } +- if(ok){ +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("read checkpoint validity" TENDSTR))); +- ok = yaffs_ReadCheckpointValidityMarker(dev,0); ++ if (ok) { ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("read checkpoint validity" TENDSTR))); ++ ok = yaffs_ReadCheckpointValidityMarker(dev, 0); + } + +- if(ok){ ++ if (ok) { + ok = yaffs_ReadCheckpointSum(dev); +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("read checkpoint checksum %d" TENDSTR),ok)); ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("read checkpoint checksum %d" TENDSTR), ok)); + } + +- if(!yaffs_CheckpointClose(dev)) ++ if (!yaffs_CheckpointClose(dev)) + ok = 0; + +- if(ok) +- dev->isCheckpointed = 1; +- else +- dev->isCheckpointed = 0; ++ if (ok) ++ dev->isCheckpointed = 1; ++ else ++ dev->isCheckpointed = 0; + + return ok ? 1 : 0; + +@@ -4527,11 +4592,11 @@ static int yaffs_ReadCheckpointData(yaff + + static void yaffs_InvalidateCheckpoint(yaffs_Device *dev) + { +- if(dev->isCheckpointed || +- dev->blocksInCheckpoint > 0){ ++ if (dev->isCheckpointed || ++ dev->blocksInCheckpoint > 0) { + dev->isCheckpointed = 0; + yaffs_CheckpointInvalidateStream(dev); +- if(dev->superBlock && dev->markSuperBlockDirty) ++ if (dev->superBlock && dev->markSuperBlockDirty) + dev->markSuperBlockDirty(dev->superBlock); + } + } +@@ -4540,18 +4605,18 @@ static void yaffs_InvalidateCheckpoint(y + int yaffs_CheckpointSave(yaffs_Device *dev) + { + +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("save entry: isCheckpointed %d"TENDSTR),dev->isCheckpointed)); ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("save entry: isCheckpointed %d"TENDSTR), dev->isCheckpointed)); + + yaffs_VerifyObjects(dev); + yaffs_VerifyBlocks(dev); + yaffs_VerifyFreeChunks(dev); + +- if(!dev->isCheckpointed) { ++ if (!dev->isCheckpointed) { + yaffs_InvalidateCheckpoint(dev); + yaffs_WriteCheckpointData(dev); + } + +- T(YAFFS_TRACE_ALWAYS,(TSTR("save exit: isCheckpointed %d"TENDSTR),dev->isCheckpointed)); ++ T(YAFFS_TRACE_ALWAYS, (TSTR("save exit: isCheckpointed %d"TENDSTR), dev->isCheckpointed)); + + return dev->isCheckpointed; + } +@@ -4559,17 +4624,17 @@ int yaffs_CheckpointSave(yaffs_Device *d + int yaffs_CheckpointRestore(yaffs_Device *dev) + { + int retval; +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("restore entry: isCheckpointed %d"TENDSTR),dev->isCheckpointed)); ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("restore entry: isCheckpointed %d"TENDSTR), dev->isCheckpointed)); + + retval = yaffs_ReadCheckpointData(dev); + +- if(dev->isCheckpointed){ ++ if (dev->isCheckpointed) { + yaffs_VerifyObjects(dev); + yaffs_VerifyBlocks(dev); + yaffs_VerifyFreeChunks(dev); + } + +- T(YAFFS_TRACE_CHECKPOINT,(TSTR("restore exit: isCheckpointed %d"TENDSTR),dev->isCheckpointed)); ++ T(YAFFS_TRACE_CHECKPOINT, (TSTR("restore exit: isCheckpointed %d"TENDSTR), dev->isCheckpointed)); + + return retval; + } +@@ -4584,12 +4649,12 @@ int yaffs_CheckpointRestore(yaffs_Device + * Curve-balls: the first chunk might also be the last chunk. + */ + +-int yaffs_ReadDataFromFile(yaffs_Object * in, __u8 * buffer, loff_t offset, +- int nBytes) ++int yaffs_ReadDataFromFile(yaffs_Object *in, __u8 *buffer, loff_t offset, ++ int nBytes) + { + + int chunk; +- int start; ++ __u32 start; + int nToCopy; + int n = nBytes; + int nDone = 0; +@@ -4600,27 +4665,26 @@ int yaffs_ReadDataFromFile(yaffs_Object + dev = in->myDev; + + while (n > 0) { +- //chunk = offset / dev->nDataBytesPerChunk + 1; +- //start = offset % dev->nDataBytesPerChunk; +- yaffs_AddrToChunk(dev,offset,&chunk,&start); ++ /* chunk = offset / dev->nDataBytesPerChunk + 1; */ ++ /* start = offset % dev->nDataBytesPerChunk; */ ++ yaffs_AddrToChunk(dev, offset, &chunk, &start); + chunk++; + + /* OK now check for the curveball where the start and end are in + * the same chunk. + */ +- if ((start + n) < dev->nDataBytesPerChunk) { ++ if ((start + n) < dev->nDataBytesPerChunk) + nToCopy = n; +- } else { ++ else + nToCopy = dev->nDataBytesPerChunk - start; +- } + + cache = yaffs_FindChunkCache(in, chunk); + + /* If the chunk is already in the cache or it is less than a whole chunk +- * then use the cache (if there is caching) ++ * or we're using inband tags then use the cache (if there is caching) + * else bypass the cache. + */ +- if (cache || nToCopy != dev->nDataBytesPerChunk) { ++ if (cache || nToCopy != dev->nDataBytesPerChunk || dev->inbandTags) { + if (dev->nShortOpCaches > 0) { + + /* If we can't find the data in the cache, then load it up. */ +@@ -4641,14 +4705,9 @@ int yaffs_ReadDataFromFile(yaffs_Object + + cache->locked = 1; + +-#ifdef CONFIG_YAFFS_WINCE +- yfsd_UnlockYAFFS(TRUE); +-#endif ++ + memcpy(buffer, &cache->data[start], nToCopy); + +-#ifdef CONFIG_YAFFS_WINCE +- yfsd_LockYAFFS(TRUE); +-#endif + cache->locked = 0; + } else { + /* Read into the local buffer then copy..*/ +@@ -4657,41 +4716,19 @@ int yaffs_ReadDataFromFile(yaffs_Object + yaffs_GetTempBuffer(dev, __LINE__); + yaffs_ReadChunkDataFromObject(in, chunk, + localBuffer); +-#ifdef CONFIG_YAFFS_WINCE +- yfsd_UnlockYAFFS(TRUE); +-#endif ++ + memcpy(buffer, &localBuffer[start], nToCopy); + +-#ifdef CONFIG_YAFFS_WINCE +- yfsd_LockYAFFS(TRUE); +-#endif ++ + yaffs_ReleaseTempBuffer(dev, localBuffer, + __LINE__); + } + + } else { +-#ifdef CONFIG_YAFFS_WINCE +- __u8 *localBuffer = yaffs_GetTempBuffer(dev, __LINE__); +- +- /* Under WinCE can't do direct transfer. Need to use a local buffer. +- * This is because we otherwise screw up WinCE's memory mapper +- */ +- yaffs_ReadChunkDataFromObject(in, chunk, localBuffer); +- +-#ifdef CONFIG_YAFFS_WINCE +- yfsd_UnlockYAFFS(TRUE); +-#endif +- memcpy(buffer, localBuffer, dev->nDataBytesPerChunk); + +-#ifdef CONFIG_YAFFS_WINCE +- yfsd_LockYAFFS(TRUE); +- yaffs_ReleaseTempBuffer(dev, localBuffer, __LINE__); +-#endif +- +-#else + /* A full chunk. Read directly into the supplied buffer. */ + yaffs_ReadChunkDataFromObject(in, chunk, buffer); +-#endif ++ + } + + n -= nToCopy; +@@ -4704,28 +4741,37 @@ int yaffs_ReadDataFromFile(yaffs_Object + return nDone; + } + +-int yaffs_WriteDataToFile(yaffs_Object * in, const __u8 * buffer, loff_t offset, +- int nBytes, int writeThrough) ++int yaffs_WriteDataToFile(yaffs_Object *in, const __u8 *buffer, loff_t offset, ++ int nBytes, int writeThrough) + { + + int chunk; +- int start; ++ __u32 start; + int nToCopy; + int n = nBytes; + int nDone = 0; + int nToWriteBack; + int startOfWrite = offset; + int chunkWritten = 0; +- int nBytesRead; ++ __u32 nBytesRead; ++ __u32 chunkStart; + + yaffs_Device *dev; + + dev = in->myDev; + + while (n > 0 && chunkWritten >= 0) { +- //chunk = offset / dev->nDataBytesPerChunk + 1; +- //start = offset % dev->nDataBytesPerChunk; +- yaffs_AddrToChunk(dev,offset,&chunk,&start); ++ /* chunk = offset / dev->nDataBytesPerChunk + 1; */ ++ /* start = offset % dev->nDataBytesPerChunk; */ ++ yaffs_AddrToChunk(dev, offset, &chunk, &start); ++ ++ if (chunk * dev->nDataBytesPerChunk + start != offset || ++ start >= dev->nDataBytesPerChunk) { ++ T(YAFFS_TRACE_ERROR, ( ++ TSTR("AddrToChunk of offset %d gives chunk %d start %d" ++ TENDSTR), ++ (int)offset, chunk, start)); ++ } + chunk++; + + /* OK now check for the curveball where the start and end are in +@@ -4740,25 +4786,32 @@ int yaffs_WriteDataToFile(yaffs_Object * + * we need to write back as much as was there before. + */ + +- nBytesRead = +- in->variant.fileVariant.fileSize - +- ((chunk - 1) * dev->nDataBytesPerChunk); ++ chunkStart = ((chunk - 1) * dev->nDataBytesPerChunk); ++ ++ if (chunkStart > in->variant.fileVariant.fileSize) ++ nBytesRead = 0; /* Past end of file */ ++ else ++ nBytesRead = in->variant.fileVariant.fileSize - chunkStart; + +- if (nBytesRead > dev->nDataBytesPerChunk) { ++ if (nBytesRead > dev->nDataBytesPerChunk) + nBytesRead = dev->nDataBytesPerChunk; +- } + + nToWriteBack = + (nBytesRead > + (start + n)) ? nBytesRead : (start + n); + ++ if (nToWriteBack < 0 || nToWriteBack > dev->nDataBytesPerChunk) ++ YBUG(); ++ + } else { + nToCopy = dev->nDataBytesPerChunk - start; + nToWriteBack = dev->nDataBytesPerChunk; + } + +- if (nToCopy != dev->nDataBytesPerChunk) { +- /* An incomplete start or end chunk (or maybe both start and end chunk) */ ++ if (nToCopy != dev->nDataBytesPerChunk || dev->inbandTags) { ++ /* An incomplete start or end chunk (or maybe both start and end chunk), ++ * or we're using inband tags, so we want to use the cache buffers. ++ */ + if (dev->nShortOpCaches > 0) { + yaffs_ChunkCache *cache; + /* If we can't find the data in the cache, then load the cache */ +@@ -4775,10 +4828,9 @@ int yaffs_WriteDataToFile(yaffs_Object * + yaffs_ReadChunkDataFromObject(in, chunk, + cache-> + data); +- } +- else if(cache && +- !cache->dirty && +- !yaffs_CheckSpaceForAllocation(in->myDev)){ ++ } else if (cache && ++ !cache->dirty && ++ !yaffs_CheckSpaceForAllocation(in->myDev)) { + /* Drop the cache if it was a read cache item and + * no space check has been made for it. + */ +@@ -4788,16 +4840,12 @@ int yaffs_WriteDataToFile(yaffs_Object * + if (cache) { + yaffs_UseChunkCache(dev, cache, 1); + cache->locked = 1; +-#ifdef CONFIG_YAFFS_WINCE +- yfsd_UnlockYAFFS(TRUE); +-#endif ++ + + memcpy(&cache->data[start], buffer, + nToCopy); + +-#ifdef CONFIG_YAFFS_WINCE +- yfsd_LockYAFFS(TRUE); +-#endif ++ + cache->locked = 0; + cache->nBytes = nToWriteBack; + +@@ -4825,15 +4873,10 @@ int yaffs_WriteDataToFile(yaffs_Object * + yaffs_ReadChunkDataFromObject(in, chunk, + localBuffer); + +-#ifdef CONFIG_YAFFS_WINCE +- yfsd_UnlockYAFFS(TRUE); +-#endif ++ + + memcpy(&localBuffer[start], buffer, nToCopy); + +-#ifdef CONFIG_YAFFS_WINCE +- yfsd_LockYAFFS(TRUE); +-#endif + chunkWritten = + yaffs_WriteChunkDataToObject(in, chunk, + localBuffer, +@@ -4846,31 +4889,15 @@ int yaffs_WriteDataToFile(yaffs_Object * + } + + } else { +- +-#ifdef CONFIG_YAFFS_WINCE +- /* Under WinCE can't do direct transfer. Need to use a local buffer. +- * This is because we otherwise screw up WinCE's memory mapper +- */ +- __u8 *localBuffer = yaffs_GetTempBuffer(dev, __LINE__); +-#ifdef CONFIG_YAFFS_WINCE +- yfsd_UnlockYAFFS(TRUE); +-#endif +- memcpy(localBuffer, buffer, dev->nDataBytesPerChunk); +-#ifdef CONFIG_YAFFS_WINCE +- yfsd_LockYAFFS(TRUE); +-#endif +- chunkWritten = +- yaffs_WriteChunkDataToObject(in, chunk, localBuffer, +- dev->nDataBytesPerChunk, +- 0); +- yaffs_ReleaseTempBuffer(dev, localBuffer, __LINE__); +-#else + /* A full chunk. Write directly from the supplied buffer. */ ++ ++ ++ + chunkWritten = + yaffs_WriteChunkDataToObject(in, chunk, buffer, + dev->nDataBytesPerChunk, + 0); +-#endif ++ + /* Since we've overwritten the cached data, we better invalidate it. */ + yaffs_InvalidateChunkCache(in, chunk); + } +@@ -4886,9 +4913,8 @@ int yaffs_WriteDataToFile(yaffs_Object * + + /* Update file object */ + +- if ((startOfWrite + nDone) > in->variant.fileVariant.fileSize) { ++ if ((startOfWrite + nDone) > in->variant.fileVariant.fileSize) + in->variant.fileVariant.fileSize = (startOfWrite + nDone); +- } + + in->dirty = 1; + +@@ -4898,7 +4924,7 @@ int yaffs_WriteDataToFile(yaffs_Object * + + /* ---------------------- File resizing stuff ------------------ */ + +-static void yaffs_PruneResizedChunks(yaffs_Object * in, int newSize) ++static void yaffs_PruneResizedChunks(yaffs_Object *in, int newSize) + { + + yaffs_Device *dev = in->myDev; +@@ -4939,11 +4965,11 @@ static void yaffs_PruneResizedChunks(yaf + + } + +-int yaffs_ResizeFile(yaffs_Object * in, loff_t newSize) ++int yaffs_ResizeFile(yaffs_Object *in, loff_t newSize) + { + + int oldFileSize = in->variant.fileVariant.fileSize; +- int newSizeOfPartialChunk; ++ __u32 newSizeOfPartialChunk; + int newFullChunks; + + yaffs_Device *dev = in->myDev; +@@ -4955,13 +4981,11 @@ int yaffs_ResizeFile(yaffs_Object * in, + + yaffs_CheckGarbageCollection(dev); + +- if (in->variantType != YAFFS_OBJECT_TYPE_FILE) { +- return yaffs_GetFileSize(in); +- } ++ if (in->variantType != YAFFS_OBJECT_TYPE_FILE) ++ return YAFFS_FAIL; + +- if (newSize == oldFileSize) { +- return oldFileSize; +- } ++ if (newSize == oldFileSize) ++ return YAFFS_OK; + + if (newSize < oldFileSize) { + +@@ -4994,21 +5018,20 @@ int yaffs_ResizeFile(yaffs_Object * in, + } + + +- + /* Write a new object header. + * show we've shrunk the file, if need be + * Do this only if the file is not in the deleted directories. + */ +- if (in->parent->objectId != YAFFS_OBJECTID_UNLINKED && +- in->parent->objectId != YAFFS_OBJECTID_DELETED) { ++ if (in->parent && ++ in->parent->objectId != YAFFS_OBJECTID_UNLINKED && ++ in->parent->objectId != YAFFS_OBJECTID_DELETED) + yaffs_UpdateObjectHeader(in, NULL, 0, + (newSize < oldFileSize) ? 1 : 0, 0); +- } + +- return newSize; ++ return YAFFS_OK; + } + +-loff_t yaffs_GetFileSize(yaffs_Object * obj) ++loff_t yaffs_GetFileSize(yaffs_Object *obj) + { + obj = yaffs_GetEquivalentObject(obj); + +@@ -5024,7 +5047,7 @@ loff_t yaffs_GetFileSize(yaffs_Object * + + + +-int yaffs_FlushFile(yaffs_Object * in, int updateTime) ++int yaffs_FlushFile(yaffs_Object *in, int updateTime) + { + int retVal; + if (in->dirty) { +@@ -5039,9 +5062,8 @@ int yaffs_FlushFile(yaffs_Object * in, i + #endif + } + +- retVal = +- (yaffs_UpdateObjectHeader(in, NULL, 0, 0, 0) >= +- 0) ? YAFFS_OK : YAFFS_FAIL; ++ retVal = (yaffs_UpdateObjectHeader(in, NULL, 0, 0, 0) >= ++ 0) ? YAFFS_OK : YAFFS_FAIL; + } else { + retVal = YAFFS_OK; + } +@@ -5050,7 +5072,7 @@ int yaffs_FlushFile(yaffs_Object * in, i + + } + +-static int yaffs_DoGenericObjectDeletion(yaffs_Object * in) ++static int yaffs_DoGenericObjectDeletion(yaffs_Object *in) + { + + /* First off, invalidate the file's data in the cache, without flushing. */ +@@ -5058,13 +5080,13 @@ static int yaffs_DoGenericObjectDeletion + + if (in->myDev->isYaffs2 && (in->parent != in->myDev->deletedDir)) { + /* Move to the unlinked directory so we have a record that it was deleted. */ +- yaffs_ChangeObjectName(in, in->myDev->deletedDir,"deleted", 0, 0); ++ yaffs_ChangeObjectName(in, in->myDev->deletedDir, _Y("deleted"), 0, 0); + + } + + yaffs_RemoveObjectFromDirectory(in); +- yaffs_DeleteChunk(in->myDev, in->chunkId, 1, __LINE__); +- in->chunkId = -1; ++ yaffs_DeleteChunk(in->myDev, in->hdrChunk, 1, __LINE__); ++ in->hdrChunk = 0; + + yaffs_FreeObject(in); + return YAFFS_OK; +@@ -5075,62 +5097,63 @@ static int yaffs_DoGenericObjectDeletion + * and the inode associated with the file. + * It does not delete the links associated with the file. + */ +-static int yaffs_UnlinkFile(yaffs_Object * in) ++static int yaffs_UnlinkFileIfNeeded(yaffs_Object *in) + { + + int retVal; + int immediateDeletion = 0; + +- if (1) { + #ifdef __KERNEL__ +- if (!in->myInode) { +- immediateDeletion = 1; +- +- } ++ if (!in->myInode) ++ immediateDeletion = 1; + #else +- if (in->inUse <= 0) { +- immediateDeletion = 1; +- +- } ++ if (in->inUse <= 0) ++ immediateDeletion = 1; + #endif +- if (immediateDeletion) { +- retVal = +- yaffs_ChangeObjectName(in, in->myDev->deletedDir, +- "deleted", 0, 0); +- T(YAFFS_TRACE_TRACING, +- (TSTR("yaffs: immediate deletion of file %d" TENDSTR), +- in->objectId)); +- in->deleted = 1; +- in->myDev->nDeletedFiles++; +- if (0 && in->myDev->isYaffs2) { +- yaffs_ResizeFile(in, 0); +- } +- yaffs_SoftDeleteFile(in); +- } else { +- retVal = +- yaffs_ChangeObjectName(in, in->myDev->unlinkedDir, +- "unlinked", 0, 0); +- } + ++ if (immediateDeletion) { ++ retVal = ++ yaffs_ChangeObjectName(in, in->myDev->deletedDir, ++ _Y("deleted"), 0, 0); ++ T(YAFFS_TRACE_TRACING, ++ (TSTR("yaffs: immediate deletion of file %d" TENDSTR), ++ in->objectId)); ++ in->deleted = 1; ++ in->myDev->nDeletedFiles++; ++ if (1 || in->myDev->isYaffs2) ++ yaffs_ResizeFile(in, 0); ++ yaffs_SoftDeleteFile(in); ++ } else { ++ retVal = ++ yaffs_ChangeObjectName(in, in->myDev->unlinkedDir, ++ _Y("unlinked"), 0, 0); + } ++ ++ + return retVal; + } + +-int yaffs_DeleteFile(yaffs_Object * in) ++int yaffs_DeleteFile(yaffs_Object *in) + { + int retVal = YAFFS_OK; ++ int deleted = in->deleted; ++ ++ yaffs_ResizeFile(in, 0); + + if (in->nDataChunks > 0) { +- /* Use soft deletion if there is data in the file */ +- if (!in->unlinked) { +- retVal = yaffs_UnlinkFile(in); +- } ++ /* Use soft deletion if there is data in the file. ++ * That won't be the case if it has been resized to zero. ++ */ ++ if (!in->unlinked) ++ retVal = yaffs_UnlinkFileIfNeeded(in); ++ + if (retVal == YAFFS_OK && in->unlinked && !in->deleted) { + in->deleted = 1; ++ deleted = 1; + in->myDev->nDeletedFiles++; + yaffs_SoftDeleteFile(in); + } +- return in->deleted ? YAFFS_OK : YAFFS_FAIL; ++ return deleted ? YAFFS_OK : YAFFS_FAIL; + } else { + /* The file has no data chunks so we toss it immediately */ + yaffs_FreeTnode(in->myDev, in->variant.fileVariant.top); +@@ -5141,62 +5164,75 @@ int yaffs_DeleteFile(yaffs_Object * in) + } + } + +-static int yaffs_DeleteDirectory(yaffs_Object * in) ++static int yaffs_DeleteDirectory(yaffs_Object *in) + { + /* First check that the directory is empty. */ +- if (list_empty(&in->variant.directoryVariant.children)) { ++ if (ylist_empty(&in->variant.directoryVariant.children)) + return yaffs_DoGenericObjectDeletion(in); +- } + + return YAFFS_FAIL; + + } + +-static int yaffs_DeleteSymLink(yaffs_Object * in) ++static int yaffs_DeleteSymLink(yaffs_Object *in) + { + YFREE(in->variant.symLinkVariant.alias); + + return yaffs_DoGenericObjectDeletion(in); + } + +-static int yaffs_DeleteHardLink(yaffs_Object * in) ++static int yaffs_DeleteHardLink(yaffs_Object *in) + { + /* remove this hardlink from the list assocaited with the equivalent + * object + */ +- list_del(&in->hardLinks); ++ ylist_del_init(&in->hardLinks); + return yaffs_DoGenericObjectDeletion(in); + } + +-static void yaffs_DestroyObject(yaffs_Object * obj) ++int yaffs_DeleteObject(yaffs_Object *obj) + { ++int retVal = -1; + switch (obj->variantType) { + case YAFFS_OBJECT_TYPE_FILE: +- yaffs_DeleteFile(obj); ++ retVal = yaffs_DeleteFile(obj); + break; + case YAFFS_OBJECT_TYPE_DIRECTORY: +- yaffs_DeleteDirectory(obj); ++ return yaffs_DeleteDirectory(obj); + break; + case YAFFS_OBJECT_TYPE_SYMLINK: +- yaffs_DeleteSymLink(obj); ++ retVal = yaffs_DeleteSymLink(obj); + break; + case YAFFS_OBJECT_TYPE_HARDLINK: +- yaffs_DeleteHardLink(obj); ++ retVal = yaffs_DeleteHardLink(obj); + break; + case YAFFS_OBJECT_TYPE_SPECIAL: +- yaffs_DoGenericObjectDeletion(obj); ++ retVal = yaffs_DoGenericObjectDeletion(obj); + break; + case YAFFS_OBJECT_TYPE_UNKNOWN: ++ retVal = 0; + break; /* should not happen. */ + } ++ ++ return retVal; + } + +-static int yaffs_UnlinkWorker(yaffs_Object * obj) ++static int yaffs_UnlinkWorker(yaffs_Object *obj) + { + ++ int immediateDeletion = 0; ++ ++#ifdef __KERNEL__ ++ if (!obj->myInode) ++ immediateDeletion = 1; ++#else ++ if (obj->inUse <= 0) ++ immediateDeletion = 1; ++#endif ++ + if (obj->variantType == YAFFS_OBJECT_TYPE_HARDLINK) { + return yaffs_DeleteHardLink(obj); +- } else if (!list_empty(&obj->hardLinks)) { ++ } else if (!ylist_empty(&obj->hardLinks)) { + /* Curve ball: We're unlinking an object that has a hardlink. + * + * This problem arises because we are not strictly following +@@ -5215,24 +5251,24 @@ static int yaffs_UnlinkWorker(yaffs_Obje + int retVal; + YCHAR name[YAFFS_MAX_NAME_LENGTH + 1]; + +- hl = list_entry(obj->hardLinks.next, yaffs_Object, hardLinks); ++ hl = ylist_entry(obj->hardLinks.next, yaffs_Object, hardLinks); + +- list_del_init(&hl->hardLinks); +- list_del_init(&hl->siblings); ++ ylist_del_init(&hl->hardLinks); ++ ylist_del_init(&hl->siblings); + + yaffs_GetObjectName(hl, name, YAFFS_MAX_NAME_LENGTH + 1); + + retVal = yaffs_ChangeObjectName(obj, hl->parent, name, 0, 0); + +- if (retVal == YAFFS_OK) { ++ if (retVal == YAFFS_OK) + retVal = yaffs_DoGenericObjectDeletion(hl); +- } ++ + return retVal; + +- } else { ++ } else if (immediateDeletion) { + switch (obj->variantType) { + case YAFFS_OBJECT_TYPE_FILE: +- return yaffs_UnlinkFile(obj); ++ return yaffs_DeleteFile(obj); + break; + case YAFFS_OBJECT_TYPE_DIRECTORY: + return yaffs_DeleteDirectory(obj); +@@ -5248,21 +5284,22 @@ static int yaffs_UnlinkWorker(yaffs_Obje + default: + return YAFFS_FAIL; + } +- } ++ } else ++ return yaffs_ChangeObjectName(obj, obj->myDev->unlinkedDir, ++ _Y("unlinked"), 0, 0); + } + + +-static int yaffs_UnlinkObject( yaffs_Object *obj) ++static int yaffs_UnlinkObject(yaffs_Object *obj) + { + +- if (obj && obj->unlinkAllowed) { ++ if (obj && obj->unlinkAllowed) + return yaffs_UnlinkWorker(obj); +- } + + return YAFFS_FAIL; + + } +-int yaffs_Unlink(yaffs_Object * dir, const YCHAR * name) ++int yaffs_Unlink(yaffs_Object *dir, const YCHAR *name) + { + yaffs_Object *obj; + +@@ -5272,8 +5309,8 @@ int yaffs_Unlink(yaffs_Object * dir, con + + /*----------------------- Initialisation Scanning ---------------------- */ + +-static void yaffs_HandleShadowedObject(yaffs_Device * dev, int objId, +- int backwardScanning) ++static void yaffs_HandleShadowedObject(yaffs_Device *dev, int objId, ++ int backwardScanning) + { + yaffs_Object *obj; + +@@ -5286,9 +5323,8 @@ static void yaffs_HandleShadowedObject(y + /* Handle YAFFS2 case (backward scanning) + * If the shadowed object exists then ignore. + */ +- if (yaffs_FindObjectByNumber(dev, objId)) { ++ if (yaffs_FindObjectByNumber(dev, objId)) + return; +- } + } + + /* Let's create it (if it does not exist) assuming it is a file so that it can do shrinking etc. +@@ -5297,6 +5333,8 @@ static void yaffs_HandleShadowedObject(y + obj = + yaffs_FindOrCreateObjectByNumber(dev, objId, + YAFFS_OBJECT_TYPE_FILE); ++ if (!obj) ++ return; + yaffs_AddObjectToDirectory(dev->unlinkedDir, obj); + obj->variant.fileVariant.shrinkSize = 0; + obj->valid = 1; /* So that we don't read any other info for this file */ +@@ -5325,44 +5363,77 @@ static void yaffs_HardlinkFixup(yaffs_De + if (in) { + /* Add the hardlink pointers */ + hl->variant.hardLinkVariant.equivalentObject = in; +- list_add(&hl->hardLinks, &in->hardLinks); ++ ylist_add(&hl->hardLinks, &in->hardLinks); + } else { + /* Todo Need to report/handle this better. + * Got a problem... hardlink to a non-existant object + */ + hl->variant.hardLinkVariant.equivalentObject = NULL; +- INIT_LIST_HEAD(&hl->hardLinks); ++ YINIT_LIST_HEAD(&hl->hardLinks); + + } +- + } ++} ++ ++ + ++ ++ ++static int ybicmp(const void *a, const void *b) ++{ ++ register int aseq = ((yaffs_BlockIndex *)a)->seq; ++ register int bseq = ((yaffs_BlockIndex *)b)->seq; ++ register int ablock = ((yaffs_BlockIndex *)a)->block; ++ register int bblock = ((yaffs_BlockIndex *)b)->block; ++ if (aseq == bseq) ++ return ablock - bblock; ++ else ++ return aseq - bseq; + } + + ++struct yaffs_ShadowFixerStruct { ++ int objectId; ++ int shadowedId; ++ struct yaffs_ShadowFixerStruct *next; ++}; ++ + ++static void yaffs_StripDeletedObjects(yaffs_Device *dev) ++{ ++ /* ++ * Sort out state of unlinked and deleted objects after scanning. ++ */ ++ struct ylist_head *i; ++ struct ylist_head *n; ++ yaffs_Object *l; + ++ /* Soft delete all the unlinked files */ ++ ylist_for_each_safe(i, n, ++ &dev->unlinkedDir->variant.directoryVariant.children) { ++ if (i) { ++ l = ylist_entry(i, yaffs_Object, siblings); ++ yaffs_DeleteObject(l); ++ } ++ } + +-static int ybicmp(const void *a, const void *b){ +- register int aseq = ((yaffs_BlockIndex *)a)->seq; +- register int bseq = ((yaffs_BlockIndex *)b)->seq; +- register int ablock = ((yaffs_BlockIndex *)a)->block; +- register int bblock = ((yaffs_BlockIndex *)b)->block; +- if( aseq == bseq ) +- return ablock - bblock; +- else +- return aseq - bseq; ++ ylist_for_each_safe(i, n, ++ &dev->deletedDir->variant.directoryVariant.children) { ++ if (i) { ++ l = ylist_entry(i, yaffs_Object, siblings); ++ yaffs_DeleteObject(l); ++ } ++ } + + } + +-static int yaffs_Scan(yaffs_Device * dev) ++static int yaffs_Scan(yaffs_Device *dev) + { + yaffs_ExtendedTags tags; + int blk; + int blockIterator; + int startIterator; + int endIterator; +- int nBlocksToScan = 0; + int result; + + int chunk; +@@ -5371,26 +5442,19 @@ static int yaffs_Scan(yaffs_Device * dev + yaffs_BlockState state; + yaffs_Object *hardList = NULL; + yaffs_BlockInfo *bi; +- int sequenceNumber; ++ __u32 sequenceNumber; + yaffs_ObjectHeader *oh; + yaffs_Object *in; + yaffs_Object *parent; +- int nBlocks = dev->internalEndBlock - dev->internalStartBlock + 1; + + int alloc_failed = 0; + ++ struct yaffs_ShadowFixerStruct *shadowFixerList = NULL; ++ + + __u8 *chunkData; + +- yaffs_BlockIndex *blockIndex = NULL; + +- if (dev->isYaffs2) { +- T(YAFFS_TRACE_SCAN, +- (TSTR("yaffs_Scan is not for YAFFS2!" TENDSTR))); +- return YAFFS_FAIL; +- } +- +- //TODO Throw all the yaffs2 stuuf out of yaffs_Scan since it is only for yaffs1 format. + + T(YAFFS_TRACE_SCAN, + (TSTR("yaffs_Scan starts intstartblk %d intendblk %d..." TENDSTR), +@@ -5400,12 +5464,6 @@ static int yaffs_Scan(yaffs_Device * dev + + dev->sequenceNumber = YAFFS_LOWEST_SEQUENCE_NUMBER; + +- if (dev->isYaffs2) { +- blockIndex = YMALLOC(nBlocks * sizeof(yaffs_BlockIndex)); +- if(!blockIndex) +- return YAFFS_FAIL; +- } +- + /* Scan all the blocks to determine their state */ + for (blk = dev->internalStartBlock; blk <= dev->internalEndBlock; blk++) { + bi = yaffs_GetBlockInfo(dev, blk); +@@ -5418,6 +5476,9 @@ static int yaffs_Scan(yaffs_Device * dev + bi->blockState = state; + bi->sequenceNumber = sequenceNumber; + ++ if (bi->sequenceNumber == YAFFS_SEQUENCE_BAD_BLOCK) ++ bi->blockState = state = YAFFS_BLOCK_STATE_DEAD; ++ + T(YAFFS_TRACE_SCAN_DEBUG, + (TSTR("Block scanning block %d state %d seq %d" TENDSTR), blk, + state, sequenceNumber)); +@@ -5430,70 +5491,21 @@ static int yaffs_Scan(yaffs_Device * dev + (TSTR("Block empty " TENDSTR))); + dev->nErasedBlocks++; + dev->nFreeChunks += dev->nChunksPerBlock; +- } else if (state == YAFFS_BLOCK_STATE_NEEDS_SCANNING) { +- +- /* Determine the highest sequence number */ +- if (dev->isYaffs2 && +- sequenceNumber >= YAFFS_LOWEST_SEQUENCE_NUMBER && +- sequenceNumber < YAFFS_HIGHEST_SEQUENCE_NUMBER) { +- +- blockIndex[nBlocksToScan].seq = sequenceNumber; +- blockIndex[nBlocksToScan].block = blk; +- +- nBlocksToScan++; +- +- if (sequenceNumber >= dev->sequenceNumber) { +- dev->sequenceNumber = sequenceNumber; +- } +- } else if (dev->isYaffs2) { +- /* TODO: Nasty sequence number! */ +- T(YAFFS_TRACE_SCAN, +- (TSTR +- ("Block scanning block %d has bad sequence number %d" +- TENDSTR), blk, sequenceNumber)); +- +- } + } + } + +- /* Sort the blocks +- * Dungy old bubble sort for now... +- */ +- if (dev->isYaffs2) { +- yaffs_BlockIndex temp; +- int i; +- int j; +- +- for (i = 0; i < nBlocksToScan; i++) +- for (j = i + 1; j < nBlocksToScan; j++) +- if (blockIndex[i].seq > blockIndex[j].seq) { +- temp = blockIndex[j]; +- blockIndex[j] = blockIndex[i]; +- blockIndex[i] = temp; +- } +- } +- +- /* Now scan the blocks looking at the data. */ +- if (dev->isYaffs2) { +- startIterator = 0; +- endIterator = nBlocksToScan - 1; +- T(YAFFS_TRACE_SCAN_DEBUG, +- (TSTR("%d blocks to be scanned" TENDSTR), nBlocksToScan)); +- } else { +- startIterator = dev->internalStartBlock; +- endIterator = dev->internalEndBlock; +- } ++ startIterator = dev->internalStartBlock; ++ endIterator = dev->internalEndBlock; + + /* For each block.... */ + for (blockIterator = startIterator; !alloc_failed && blockIterator <= endIterator; + blockIterator++) { + +- if (dev->isYaffs2) { +- /* get the block to scan in the correct order */ +- blk = blockIndex[blockIterator].block; +- } else { +- blk = blockIterator; +- } ++ YYIELD(); ++ ++ YYIELD(); ++ ++ blk = blockIterator; + + bi = yaffs_GetBlockInfo(dev, blk); + state = bi->blockState; +@@ -5511,7 +5523,7 @@ static int yaffs_Scan(yaffs_Device * dev + + /* Let's have a good look at this chunk... */ + +- if (!dev->isYaffs2 && tags.chunkDeleted) { ++ if (tags.eccResult == YAFFS_ECC_RESULT_UNFIXED || tags.chunkDeleted) { + /* YAFFS1 only... + * A deleted chunk + */ +@@ -5540,18 +5552,6 @@ static int yaffs_Scan(yaffs_Device * dev + dev->allocationBlockFinder = blk; + /* Set it to here to encourage the allocator to go forth from here. */ + +- /* Yaffs2 sanity check: +- * This should be the one with the highest sequence number +- */ +- if (dev->isYaffs2 +- && (dev->sequenceNumber != +- bi->sequenceNumber)) { +- T(YAFFS_TRACE_ALWAYS, +- (TSTR +- ("yaffs: Allocation block %d was not highest sequence id:" +- " block seq = %d, dev seq = %d" +- TENDSTR), blk,bi->sequenceNumber,dev->sequenceNumber)); +- } + } + + dev->nFreeChunks += (dev->nChunksPerBlock - c); +@@ -5570,11 +5570,11 @@ static int yaffs_Scan(yaffs_Device * dev + * the same chunkId). + */ + +- if(!in) ++ if (!in) + alloc_failed = 1; + +- if(in){ +- if(!yaffs_PutChunkIntoFile(in, tags.chunkId, chunk,1)) ++ if (in) { ++ if (!yaffs_PutChunkIntoFile(in, tags.chunkId, chunk, 1)) + alloc_failed = 1; + } + +@@ -5617,7 +5617,7 @@ static int yaffs_Scan(yaffs_Device * dev + * deleted, and worse still it has changed type. Delete the old object. + */ + +- yaffs_DestroyObject(in); ++ yaffs_DeleteObject(in); + + in = 0; + } +@@ -5627,14 +5627,20 @@ static int yaffs_Scan(yaffs_Device * dev + objectId, + oh->type); + +- if(!in) ++ if (!in) + alloc_failed = 1; + + if (in && oh->shadowsObject > 0) { +- yaffs_HandleShadowedObject(dev, +- oh-> +- shadowsObject, +- 0); ++ ++ struct yaffs_ShadowFixerStruct *fixer; ++ fixer = YMALLOC(sizeof(struct yaffs_ShadowFixerStruct)); ++ if (fixer) { ++ fixer->next = shadowFixerList; ++ shadowFixerList = fixer; ++ fixer->objectId = tags.objectId; ++ fixer->shadowedId = oh->shadowsObject; ++ } ++ + } + + if (in && in->valid) { +@@ -5643,12 +5649,10 @@ static int yaffs_Scan(yaffs_Device * dev + unsigned existingSerial = in->serial; + unsigned newSerial = tags.serialNumber; + +- if (dev->isYaffs2 || +- ((existingSerial + 1) & 3) == +- newSerial) { ++ if (((existingSerial + 1) & 3) == newSerial) { + /* Use new one - destroy the exisiting one */ + yaffs_DeleteChunk(dev, +- in->chunkId, ++ in->hdrChunk, + 1, __LINE__); + in->valid = 0; + } else { +@@ -5681,7 +5685,8 @@ static int yaffs_Scan(yaffs_Device * dev + in->yst_ctime = oh->yst_ctime; + in->yst_rdev = oh->yst_rdev; + #endif +- in->chunkId = chunk; ++ in->hdrChunk = chunk; ++ in->serial = tags.serialNumber; + + } else if (in && !in->valid) { + /* we need to load this info */ +@@ -5705,7 +5710,8 @@ static int yaffs_Scan(yaffs_Device * dev + in->yst_ctime = oh->yst_ctime; + in->yst_rdev = oh->yst_rdev; + #endif +- in->chunkId = chunk; ++ in->hdrChunk = chunk; ++ in->serial = tags.serialNumber; + + yaffs_SetObjectName(in, oh->name); + in->dirty = 0; +@@ -5718,25 +5724,25 @@ static int yaffs_Scan(yaffs_Device * dev + yaffs_FindOrCreateObjectByNumber + (dev, oh->parentObjectId, + YAFFS_OBJECT_TYPE_DIRECTORY); +- if (parent->variantType == ++ if (!parent) ++ alloc_failed = 1; ++ if (parent && parent->variantType == + YAFFS_OBJECT_TYPE_UNKNOWN) { + /* Set up as a directory */ + parent->variantType = +- YAFFS_OBJECT_TYPE_DIRECTORY; +- INIT_LIST_HEAD(&parent->variant. +- directoryVariant. +- children); +- } else if (parent->variantType != +- YAFFS_OBJECT_TYPE_DIRECTORY) +- { ++ YAFFS_OBJECT_TYPE_DIRECTORY; ++ YINIT_LIST_HEAD(&parent->variant. ++ directoryVariant. ++ children); ++ } else if (!parent || parent->variantType != ++ YAFFS_OBJECT_TYPE_DIRECTORY) { + /* Hoosterman, another problem.... + * We're trying to use a non-directory as a directory + */ + + T(YAFFS_TRACE_ERROR, + (TSTR +- ("yaffs tragedy: attempting to use non-directory as" +- " a directory in scan. Put in lost+found." ++ ("yaffs tragedy: attempting to use non-directory as a directory in scan. Put in lost+found." + TENDSTR))); + parent = dev->lostNFoundDir; + } +@@ -5760,15 +5766,6 @@ static int yaffs_Scan(yaffs_Device * dev + /* Todo got a problem */ + break; + case YAFFS_OBJECT_TYPE_FILE: +- if (dev->isYaffs2 +- && oh->isShrink) { +- /* Prune back the shrunken chunks */ +- yaffs_PruneResizedChunks +- (in, oh->fileSize); +- /* Mark the block as having a shrinkHeader */ +- bi->hasShrinkHeader = 1; +- } +- + if (dev->useHeaderFileSize) + + in->variant.fileVariant. +@@ -5778,11 +5775,11 @@ static int yaffs_Scan(yaffs_Device * dev + break; + case YAFFS_OBJECT_TYPE_HARDLINK: + in->variant.hardLinkVariant. +- equivalentObjectId = +- oh->equivalentObjectId; ++ equivalentObjectId = ++ oh->equivalentObjectId; + in->hardLinks.next = +- (struct list_head *) +- hardList; ++ (struct ylist_head *) ++ hardList; + hardList = in; + break; + case YAFFS_OBJECT_TYPE_DIRECTORY: +@@ -5794,15 +5791,17 @@ static int yaffs_Scan(yaffs_Device * dev + case YAFFS_OBJECT_TYPE_SYMLINK: + in->variant.symLinkVariant.alias = + yaffs_CloneString(oh->alias); +- if(!in->variant.symLinkVariant.alias) ++ if (!in->variant.symLinkVariant.alias) + alloc_failed = 1; + break; + } + ++/* + if (parent == dev->deletedDir) { + yaffs_DestroyObject(in); + bi->hasShrinkHeader = 1; + } ++*/ + } + } + } +@@ -5823,10 +5822,6 @@ static int yaffs_Scan(yaffs_Device * dev + + } + +- if (blockIndex) { +- YFREE(blockIndex); +- } +- + + /* Ok, we've done all the scanning. + * Fix up the hard link chains. +@@ -5834,32 +5829,36 @@ static int yaffs_Scan(yaffs_Device * dev + * hardlinks. + */ + +- yaffs_HardlinkFixup(dev,hardList); ++ yaffs_HardlinkFixup(dev, hardList); + +- /* Handle the unlinked files. Since they were left in an unlinked state we should +- * just delete them. +- */ ++ /* Fix up any shadowed objects */ + { +- struct list_head *i; +- struct list_head *n; ++ struct yaffs_ShadowFixerStruct *fixer; ++ yaffs_Object *obj; + +- yaffs_Object *l; +- /* Soft delete all the unlinked files */ +- list_for_each_safe(i, n, +- &dev->unlinkedDir->variant.directoryVariant. +- children) { +- if (i) { +- l = list_entry(i, yaffs_Object, siblings); +- yaffs_DestroyObject(l); +- } ++ while (shadowFixerList) { ++ fixer = shadowFixerList; ++ shadowFixerList = fixer->next; ++ /* Complete the rename transaction by deleting the shadowed object ++ * then setting the object header to unshadowed. ++ */ ++ obj = yaffs_FindObjectByNumber(dev, fixer->shadowedId); ++ if (obj) ++ yaffs_DeleteObject(obj); ++ ++ obj = yaffs_FindObjectByNumber(dev, fixer->objectId); ++ ++ if (obj) ++ yaffs_UpdateObjectHeader(obj, NULL, 1, 0, 0); ++ ++ YFREE(fixer); + } + } + + yaffs_ReleaseTempBuffer(dev, chunkData, __LINE__); + +- if(alloc_failed){ ++ if (alloc_failed) + return YAFFS_FAIL; +- } + + T(YAFFS_TRACE_SCAN, (TSTR("yaffs_Scan ends" TENDSTR))); + +@@ -5871,25 +5870,27 @@ static void yaffs_CheckObjectDetailsLoad + { + __u8 *chunkData; + yaffs_ObjectHeader *oh; +- yaffs_Device *dev = in->myDev; ++ yaffs_Device *dev; + yaffs_ExtendedTags tags; + int result; + int alloc_failed = 0; + +- if(!in) ++ if (!in) + return; + ++ dev = in->myDev; ++ + #if 0 +- T(YAFFS_TRACE_SCAN,(TSTR("details for object %d %s loaded" TENDSTR), ++ T(YAFFS_TRACE_SCAN, (TSTR("details for object %d %s loaded" TENDSTR), + in->objectId, + in->lazyLoaded ? "not yet" : "already")); + #endif + +- if(in->lazyLoaded){ ++ if (in->lazyLoaded && in->hdrChunk > 0) { + in->lazyLoaded = 0; + chunkData = yaffs_GetTempBuffer(dev, __LINE__); + +- result = yaffs_ReadChunkWithTagsFromNAND(dev,in->chunkId,chunkData,&tags); ++ result = yaffs_ReadChunkWithTagsFromNAND(dev, in->hdrChunk, chunkData, &tags); + oh = (yaffs_ObjectHeader *) chunkData; + + in->yst_mode = oh->yst_mode; +@@ -5911,18 +5912,18 @@ static void yaffs_CheckObjectDetailsLoad + #endif + yaffs_SetObjectName(in, oh->name); + +- if(in->variantType == YAFFS_OBJECT_TYPE_SYMLINK){ +- in->variant.symLinkVariant.alias = ++ if (in->variantType == YAFFS_OBJECT_TYPE_SYMLINK) { ++ in->variant.symLinkVariant.alias = + yaffs_CloneString(oh->alias); +- if(!in->variant.symLinkVariant.alias) ++ if (!in->variant.symLinkVariant.alias) + alloc_failed = 1; /* Not returned to caller */ + } + +- yaffs_ReleaseTempBuffer(dev,chunkData, __LINE__); ++ yaffs_ReleaseTempBuffer(dev, chunkData, __LINE__); + } + } + +-static int yaffs_ScanBackwards(yaffs_Device * dev) ++static int yaffs_ScanBackwards(yaffs_Device *dev) + { + yaffs_ExtendedTags tags; + int blk; +@@ -5938,7 +5939,7 @@ static int yaffs_ScanBackwards(yaffs_Dev + yaffs_BlockState state; + yaffs_Object *hardList = NULL; + yaffs_BlockInfo *bi; +- int sequenceNumber; ++ __u32 sequenceNumber; + yaffs_ObjectHeader *oh; + yaffs_Object *in; + yaffs_Object *parent; +@@ -5972,12 +5973,12 @@ static int yaffs_ScanBackwards(yaffs_Dev + + blockIndex = YMALLOC(nBlocks * sizeof(yaffs_BlockIndex)); + +- if(!blockIndex) { ++ if (!blockIndex) { + blockIndex = YMALLOC_ALT(nBlocks * sizeof(yaffs_BlockIndex)); + altBlockIndex = 1; + } + +- if(!blockIndex) { ++ if (!blockIndex) { + T(YAFFS_TRACE_SCAN, + (TSTR("yaffs_Scan() could not allocate block index!" TENDSTR))); + return YAFFS_FAIL; +@@ -5999,15 +6000,17 @@ static int yaffs_ScanBackwards(yaffs_Dev + bi->blockState = state; + bi->sequenceNumber = sequenceNumber; + +- if(bi->sequenceNumber == YAFFS_SEQUENCE_CHECKPOINT_DATA) ++ if (bi->sequenceNumber == YAFFS_SEQUENCE_CHECKPOINT_DATA) + bi->blockState = state = YAFFS_BLOCK_STATE_CHECKPOINT; ++ if (bi->sequenceNumber == YAFFS_SEQUENCE_BAD_BLOCK) ++ bi->blockState = state = YAFFS_BLOCK_STATE_DEAD; + + T(YAFFS_TRACE_SCAN_DEBUG, + (TSTR("Block scanning block %d state %d seq %d" TENDSTR), blk, + state, sequenceNumber)); + + +- if(state == YAFFS_BLOCK_STATE_CHECKPOINT){ ++ if (state == YAFFS_BLOCK_STATE_CHECKPOINT) { + dev->blocksInCheckpoint++; + + } else if (state == YAFFS_BLOCK_STATE_DEAD) { +@@ -6021,8 +6024,7 @@ static int yaffs_ScanBackwards(yaffs_Dev + } else if (state == YAFFS_BLOCK_STATE_NEEDS_SCANNING) { + + /* Determine the highest sequence number */ +- if (dev->isYaffs2 && +- sequenceNumber >= YAFFS_LOWEST_SEQUENCE_NUMBER && ++ if (sequenceNumber >= YAFFS_LOWEST_SEQUENCE_NUMBER && + sequenceNumber < YAFFS_HIGHEST_SEQUENCE_NUMBER) { + + blockIndex[nBlocksToScan].seq = sequenceNumber; +@@ -6030,10 +6032,9 @@ static int yaffs_ScanBackwards(yaffs_Dev + + nBlocksToScan++; + +- if (sequenceNumber >= dev->sequenceNumber) { ++ if (sequenceNumber >= dev->sequenceNumber) + dev->sequenceNumber = sequenceNumber; +- } +- } else if (dev->isYaffs2) { ++ } else { + /* TODO: Nasty sequence number! */ + T(YAFFS_TRACE_SCAN, + (TSTR +@@ -6053,11 +6054,13 @@ static int yaffs_ScanBackwards(yaffs_Dev + + /* Sort the blocks */ + #ifndef CONFIG_YAFFS_USE_OWN_SORT +- yaffs_qsort(blockIndex, nBlocksToScan, +- sizeof(yaffs_BlockIndex), ybicmp); ++ { ++ /* Use qsort now. */ ++ yaffs_qsort(blockIndex, nBlocksToScan, sizeof(yaffs_BlockIndex), ybicmp); ++ } + #else + { +- /* Dungy old bubble sort... */ ++ /* Dungy old bubble sort... */ + + yaffs_BlockIndex temp; + int i; +@@ -6075,7 +6078,7 @@ static int yaffs_ScanBackwards(yaffs_Dev + + YYIELD(); + +- T(YAFFS_TRACE_SCAN, (TSTR("...done" TENDSTR))); ++ T(YAFFS_TRACE_SCAN, (TSTR("...done" TENDSTR))); + + /* Now scan the blocks looking at the data. */ + startIterator = 0; +@@ -6085,10 +6088,10 @@ static int yaffs_ScanBackwards(yaffs_Dev + + /* For each block.... backwards */ + for (blockIterator = endIterator; !alloc_failed && blockIterator >= startIterator; +- blockIterator--) { +- /* Cooperative multitasking! This loop can run for so ++ blockIterator--) { ++ /* Cooperative multitasking! This loop can run for so + long that watchdog timers expire. */ +- YYIELD(); ++ YYIELD(); + + /* get the block to scan in the correct order */ + blk = blockIndex[blockIterator].block; +@@ -6127,10 +6130,8 @@ static int yaffs_ScanBackwards(yaffs_Dev + * this is the one being allocated from + */ + +- if(foundChunksInBlock) +- { ++ if (foundChunksInBlock) { + /* This is a chunk that was skipped due to failing the erased check */ +- + } else if (c == 0) { + /* We're looking at the first chunk in the block so the block is unused */ + state = YAFFS_BLOCK_STATE_EMPTY; +@@ -6138,7 +6139,7 @@ static int yaffs_ScanBackwards(yaffs_Dev + } else { + if (state == YAFFS_BLOCK_STATE_NEEDS_SCANNING || + state == YAFFS_BLOCK_STATE_ALLOCATING) { +- if(dev->sequenceNumber == bi->sequenceNumber) { ++ if (dev->sequenceNumber == bi->sequenceNumber) { + /* this is the block being allocated from */ + + T(YAFFS_TRACE_SCAN, +@@ -6150,27 +6151,31 @@ static int yaffs_ScanBackwards(yaffs_Dev + dev->allocationBlock = blk; + dev->allocationPage = c; + dev->allocationBlockFinder = blk; +- } +- else { ++ } else { + /* This is a partially written block that is not + * the current allocation block. This block must have + * had a write failure, so set up for retirement. + */ + +- bi->needsRetiring = 1; ++ /* bi->needsRetiring = 1; ??? TODO */ + bi->gcPrioritise = 1; + + T(YAFFS_TRACE_ALWAYS, +- (TSTR("Partially written block %d being set for retirement" TENDSTR), ++ (TSTR("Partially written block %d detected" TENDSTR), + blk)); + } +- + } +- + } + + dev->nFreeChunks++; + ++ } else if (tags.eccResult == YAFFS_ECC_RESULT_UNFIXED) { ++ T(YAFFS_TRACE_SCAN, ++ (TSTR(" Unfixed ECC in chunk(%d:%d), chunk ignored"TENDSTR), ++ blk, c)); ++ ++ dev->nFreeChunks++; ++ + } else if (tags.chunkId > 0) { + /* chunkId > 0 so it is a data chunk... */ + unsigned int endpos; +@@ -6187,7 +6192,7 @@ static int yaffs_ScanBackwards(yaffs_Dev + tags. + objectId, + YAFFS_OBJECT_TYPE_FILE); +- if(!in){ ++ if (!in) { + /* Out of memory */ + alloc_failed = 1; + } +@@ -6197,8 +6202,8 @@ static int yaffs_ScanBackwards(yaffs_Dev + && chunkBase < + in->variant.fileVariant.shrinkSize) { + /* This has not been invalidated by a resize */ +- if(!yaffs_PutChunkIntoFile(in, tags.chunkId, +- chunk, -1)){ ++ if (!yaffs_PutChunkIntoFile(in, tags.chunkId, ++ chunk, -1)) { + alloc_failed = 1; + } + +@@ -6221,7 +6226,7 @@ static int yaffs_ScanBackwards(yaffs_Dev + scannedFileSize; + } + +- } else if(in) { ++ } else if (in) { + /* This chunk has been invalidated by a resize, so delete */ + yaffs_DeleteChunk(dev, chunk, 1, __LINE__); + +@@ -6242,6 +6247,8 @@ static int yaffs_ScanBackwards(yaffs_Dev + in = yaffs_FindOrCreateObjectByNumber + (dev, tags.objectId, + tags.extraObjectType); ++ if (!in) ++ alloc_failed = 1; + } + + if (!in || +@@ -6251,8 +6258,7 @@ static int yaffs_ScanBackwards(yaffs_Dev + tags.extraShadows || + (!in->valid && + (tags.objectId == YAFFS_OBJECTID_ROOT || +- tags.objectId == YAFFS_OBJECTID_LOSTNFOUND)) +- ) { ++ tags.objectId == YAFFS_OBJECTID_LOSTNFOUND))) { + + /* If we don't have valid info then we need to read the chunk + * TODO In future we can probably defer reading the chunk and +@@ -6266,8 +6272,17 @@ static int yaffs_ScanBackwards(yaffs_Dev + + oh = (yaffs_ObjectHeader *) chunkData; + +- if (!in) ++ if (dev->inbandTags) { ++ /* Fix up the header if they got corrupted by inband tags */ ++ oh->shadowsObject = oh->inbandShadowsObject; ++ oh->isShrink = oh->inbandIsShrink; ++ } ++ ++ if (!in) { + in = yaffs_FindOrCreateObjectByNumber(dev, tags.objectId, oh->type); ++ if (!in) ++ alloc_failed = 1; ++ } + + } + +@@ -6275,10 +6290,9 @@ static int yaffs_ScanBackwards(yaffs_Dev + /* TODO Hoosterman we have a problem! */ + T(YAFFS_TRACE_ERROR, + (TSTR +- ("yaffs tragedy: Could not make object for object %d " +- "at chunk %d during scan" ++ ("yaffs tragedy: Could not make object for object %d at chunk %d during scan" + TENDSTR), tags.objectId, chunk)); +- ++ continue; + } + + if (in->valid) { +@@ -6289,10 +6303,9 @@ static int yaffs_ScanBackwards(yaffs_Dev + + if ((in->variantType == YAFFS_OBJECT_TYPE_FILE) && + ((oh && +- oh-> type == YAFFS_OBJECT_TYPE_FILE)|| ++ oh->type == YAFFS_OBJECT_TYPE_FILE) || + (tags.extraHeaderInfoAvailable && +- tags.extraObjectType == YAFFS_OBJECT_TYPE_FILE)) +- ) { ++ tags.extraObjectType == YAFFS_OBJECT_TYPE_FILE))) { + __u32 thisSize = + (oh) ? oh->fileSize : tags. + extraFileLength; +@@ -6300,7 +6313,9 @@ static int yaffs_ScanBackwards(yaffs_Dev + (oh) ? oh-> + parentObjectId : tags. + extraParentObjectId; +- unsigned isShrink = ++ ++ ++ isShrink = + (oh) ? oh->isShrink : tags. + extraIsShrinkHeader; + +@@ -6323,9 +6338,8 @@ static int yaffs_ScanBackwards(yaffs_Dev + thisSize; + } + +- if (isShrink) { ++ if (isShrink) + bi->hasShrinkHeader = 1; +- } + + } + /* Use existing - destroy this one. */ +@@ -6333,6 +6347,17 @@ static int yaffs_ScanBackwards(yaffs_Dev + + } + ++ if (!in->valid && in->variantType != ++ (oh ? oh->type : tags.extraObjectType)) ++ T(YAFFS_TRACE_ERROR, ( ++ TSTR("yaffs tragedy: Bad object type, " ++ TCONT("%d != %d, for object %d at chunk ") ++ TCONT("%d during scan") ++ TENDSTR), oh ? ++ oh->type : tags.extraObjectType, ++ in->variantType, tags.objectId, ++ chunk)); ++ + if (!in->valid && + (tags.objectId == YAFFS_OBJECTID_ROOT || + tags.objectId == +@@ -6340,7 +6365,7 @@ static int yaffs_ScanBackwards(yaffs_Dev + /* We only load some info, don't fiddle with directory structure */ + in->valid = 1; + +- if(oh) { ++ if (oh) { + in->variantType = oh->type; + + in->yst_mode = oh->yst_mode; +@@ -6365,15 +6390,15 @@ static int yaffs_ScanBackwards(yaffs_Dev + in->lazyLoaded = 1; + } + +- in->chunkId = chunk; ++ in->hdrChunk = chunk; + + } else if (!in->valid) { + /* we need to load this info */ + + in->valid = 1; +- in->chunkId = chunk; ++ in->hdrChunk = chunk; + +- if(oh) { ++ if (oh) { + in->variantType = oh->type; + + in->yst_mode = oh->yst_mode; +@@ -6403,20 +6428,19 @@ static int yaffs_ScanBackwards(yaffs_Dev + yaffs_SetObjectName(in, oh->name); + parent = + yaffs_FindOrCreateObjectByNumber +- (dev, oh->parentObjectId, +- YAFFS_OBJECT_TYPE_DIRECTORY); ++ (dev, oh->parentObjectId, ++ YAFFS_OBJECT_TYPE_DIRECTORY); + + fileSize = oh->fileSize; +- isShrink = oh->isShrink; ++ isShrink = oh->isShrink; + equivalentObjectId = oh->equivalentObjectId; + +- } +- else { ++ } else { + in->variantType = tags.extraObjectType; + parent = + yaffs_FindOrCreateObjectByNumber +- (dev, tags.extraParentObjectId, +- YAFFS_OBJECT_TYPE_DIRECTORY); ++ (dev, tags.extraParentObjectId, ++ YAFFS_OBJECT_TYPE_DIRECTORY); + fileSize = tags.extraFileLength; + isShrink = tags.extraIsShrinkHeader; + equivalentObjectId = tags.extraEquivalentObjectId; +@@ -6425,29 +6449,30 @@ static int yaffs_ScanBackwards(yaffs_Dev + } + in->dirty = 0; + ++ if (!parent) ++ alloc_failed = 1; ++ + /* directory stuff... + * hook up to parent + */ + +- if (parent->variantType == ++ if (parent && parent->variantType == + YAFFS_OBJECT_TYPE_UNKNOWN) { + /* Set up as a directory */ + parent->variantType = +- YAFFS_OBJECT_TYPE_DIRECTORY; +- INIT_LIST_HEAD(&parent->variant. +- directoryVariant. +- children); +- } else if (parent->variantType != +- YAFFS_OBJECT_TYPE_DIRECTORY) +- { ++ YAFFS_OBJECT_TYPE_DIRECTORY; ++ YINIT_LIST_HEAD(&parent->variant. ++ directoryVariant. ++ children); ++ } else if (!parent || parent->variantType != ++ YAFFS_OBJECT_TYPE_DIRECTORY) { + /* Hoosterman, another problem.... + * We're trying to use a non-directory as a directory + */ + + T(YAFFS_TRACE_ERROR, + (TSTR +- ("yaffs tragedy: attempting to use non-directory as" +- " a directory in scan. Put in lost+found." ++ ("yaffs tragedy: attempting to use non-directory as a directory in scan. Put in lost+found." + TENDSTR))); + parent = dev->lostNFoundDir; + } +@@ -6494,12 +6519,12 @@ static int yaffs_ScanBackwards(yaffs_Dev + + break; + case YAFFS_OBJECT_TYPE_HARDLINK: +- if(!itsUnlinked) { +- in->variant.hardLinkVariant.equivalentObjectId = +- equivalentObjectId; +- in->hardLinks.next = +- (struct list_head *) hardList; +- hardList = in; ++ if (!itsUnlinked) { ++ in->variant.hardLinkVariant.equivalentObjectId = ++ equivalentObjectId; ++ in->hardLinks.next = ++ (struct ylist_head *) hardList; ++ hardList = in; + } + break; + case YAFFS_OBJECT_TYPE_DIRECTORY: +@@ -6509,12 +6534,11 @@ static int yaffs_ScanBackwards(yaffs_Dev + /* Do nothing */ + break; + case YAFFS_OBJECT_TYPE_SYMLINK: +- if(oh){ +- in->variant.symLinkVariant.alias = +- yaffs_CloneString(oh-> +- alias); +- if(!in->variant.symLinkVariant.alias) +- alloc_failed = 1; ++ if (oh) { ++ in->variant.symLinkVariant.alias = ++ yaffs_CloneString(oh->alias); ++ if (!in->variant.symLinkVariant.alias) ++ alloc_failed = 1; + } + break; + } +@@ -6551,75 +6575,129 @@ static int yaffs_ScanBackwards(yaffs_Dev + * We should now have scanned all the objects, now it's time to add these + * hardlinks. + */ +- yaffs_HardlinkFixup(dev,hardList); ++ yaffs_HardlinkFixup(dev, hardList); + + +- /* +- * Sort out state of unlinked and deleted objects. +- */ +- { +- struct list_head *i; +- struct list_head *n; ++ yaffs_ReleaseTempBuffer(dev, chunkData, __LINE__); + +- yaffs_Object *l; ++ if (alloc_failed) ++ return YAFFS_FAIL; + +- /* Soft delete all the unlinked files */ +- list_for_each_safe(i, n, +- &dev->unlinkedDir->variant.directoryVariant. +- children) { +- if (i) { +- l = list_entry(i, yaffs_Object, siblings); +- yaffs_DestroyObject(l); +- } +- } ++ T(YAFFS_TRACE_SCAN, (TSTR("yaffs_ScanBackwards ends" TENDSTR))); + +- /* Soft delete all the deletedDir files */ +- list_for_each_safe(i, n, +- &dev->deletedDir->variant.directoryVariant. +- children) { +- if (i) { +- l = list_entry(i, yaffs_Object, siblings); +- yaffs_DestroyObject(l); ++ return YAFFS_OK; ++} + +- } ++/*------------------------------ Directory Functions ----------------------------- */ ++ ++static void yaffs_VerifyObjectInDirectory(yaffs_Object *obj) ++{ ++ struct ylist_head *lh; ++ yaffs_Object *listObj; ++ ++ int count = 0; ++ ++ if (!obj) { ++ T(YAFFS_TRACE_ALWAYS, (TSTR("No object to verify" TENDSTR))); ++ YBUG(); ++ return; ++ } ++ ++ if (yaffs_SkipVerification(obj->myDev)) ++ return; ++ ++ if (!obj->parent) { ++ T(YAFFS_TRACE_ALWAYS, (TSTR("Object does not have parent" TENDSTR))); ++ YBUG(); ++ return; ++ } ++ ++ if (obj->parent->variantType != YAFFS_OBJECT_TYPE_DIRECTORY) { ++ T(YAFFS_TRACE_ALWAYS, (TSTR("Parent is not directory" TENDSTR))); ++ YBUG(); ++ } ++ ++ /* Iterate through the objects in each hash entry */ ++ ++ ylist_for_each(lh, &obj->parent->variant.directoryVariant.children) { ++ if (lh) { ++ listObj = ylist_entry(lh, yaffs_Object, siblings); ++ yaffs_VerifyObject(listObj); ++ if (obj == listObj) ++ count++; + } ++ } ++ ++ if (count != 1) { ++ T(YAFFS_TRACE_ALWAYS, (TSTR("Object in directory %d times" TENDSTR), count)); ++ YBUG(); + } ++} + +- yaffs_ReleaseTempBuffer(dev, chunkData, __LINE__); ++static void yaffs_VerifyDirectory(yaffs_Object *directory) ++{ ++ struct ylist_head *lh; ++ yaffs_Object *listObj; + +- if(alloc_failed){ +- return YAFFS_FAIL; ++ if (!directory) { ++ YBUG(); ++ return; + } + +- T(YAFFS_TRACE_SCAN, (TSTR("yaffs_ScanBackwards ends" TENDSTR))); ++ if (yaffs_SkipFullVerification(directory->myDev)) ++ return; + +- return YAFFS_OK; ++ if (directory->variantType != YAFFS_OBJECT_TYPE_DIRECTORY) { ++ T(YAFFS_TRACE_ALWAYS, (TSTR("Directory has wrong type: %d" TENDSTR), directory->variantType)); ++ YBUG(); ++ } ++ ++ /* Iterate through the objects in each hash entry */ ++ ++ ylist_for_each(lh, &directory->variant.directoryVariant.children) { ++ if (lh) { ++ listObj = ylist_entry(lh, yaffs_Object, siblings); ++ if (listObj->parent != directory) { ++ T(YAFFS_TRACE_ALWAYS, (TSTR("Object in directory list has wrong parent %p" TENDSTR), listObj->parent)); ++ YBUG(); ++ } ++ yaffs_VerifyObjectInDirectory(listObj); ++ } ++ } + } + +-/*------------------------------ Directory Functions ----------------------------- */ + +-static void yaffs_RemoveObjectFromDirectory(yaffs_Object * obj) ++static void yaffs_RemoveObjectFromDirectory(yaffs_Object *obj) + { + yaffs_Device *dev = obj->myDev; ++ yaffs_Object *parent; ++ ++ yaffs_VerifyObjectInDirectory(obj); ++ parent = obj->parent; ++ ++ yaffs_VerifyDirectory(parent); + +- if(dev && dev->removeObjectCallback) ++ if (dev && dev->removeObjectCallback) + dev->removeObjectCallback(obj); + +- list_del_init(&obj->siblings); ++ ++ ylist_del_init(&obj->siblings); + obj->parent = NULL; ++ ++ yaffs_VerifyDirectory(parent); + } + + +-static void yaffs_AddObjectToDirectory(yaffs_Object * directory, +- yaffs_Object * obj) ++static void yaffs_AddObjectToDirectory(yaffs_Object *directory, ++ yaffs_Object *obj) + { +- + if (!directory) { + T(YAFFS_TRACE_ALWAYS, + (TSTR + ("tragedy: Trying to add an object to a null pointer directory" + TENDSTR))); + YBUG(); ++ return; + } + if (directory->variantType != YAFFS_OBJECT_TYPE_DIRECTORY) { + T(YAFFS_TRACE_ALWAYS, +@@ -6631,37 +6709,42 @@ static void yaffs_AddObjectToDirectory(y + + if (obj->siblings.prev == NULL) { + /* Not initialised */ +- INIT_LIST_HEAD(&obj->siblings); +- +- } else if (!list_empty(&obj->siblings)) { +- /* If it is holed up somewhere else, un hook it */ +- yaffs_RemoveObjectFromDirectory(obj); ++ YBUG(); + } ++ ++ ++ yaffs_VerifyDirectory(directory); ++ ++ yaffs_RemoveObjectFromDirectory(obj); ++ ++ + /* Now add it */ +- list_add(&obj->siblings, &directory->variant.directoryVariant.children); ++ ylist_add(&obj->siblings, &directory->variant.directoryVariant.children); + obj->parent = directory; + + if (directory == obj->myDev->unlinkedDir +- || directory == obj->myDev->deletedDir) { ++ || directory == obj->myDev->deletedDir) { + obj->unlinked = 1; + obj->myDev->nUnlinkedFiles++; + obj->renameAllowed = 0; + } ++ ++ yaffs_VerifyDirectory(directory); ++ yaffs_VerifyObjectInDirectory(obj); + } + +-yaffs_Object *yaffs_FindObjectByName(yaffs_Object * directory, +- const YCHAR * name) ++yaffs_Object *yaffs_FindObjectByName(yaffs_Object *directory, ++ const YCHAR *name) + { + int sum; + +- struct list_head *i; ++ struct ylist_head *i; + YCHAR buffer[YAFFS_MAX_NAME_LENGTH + 1]; + + yaffs_Object *l; + +- if (!name) { ++ if (!name) + return NULL; +- } + + if (!directory) { + T(YAFFS_TRACE_ALWAYS, +@@ -6669,6 +6752,7 @@ yaffs_Object *yaffs_FindObjectByName(yaf + ("tragedy: yaffs_FindObjectByName: null pointer directory" + TENDSTR))); + YBUG(); ++ return NULL; + } + if (directory->variantType != YAFFS_OBJECT_TYPE_DIRECTORY) { + T(YAFFS_TRACE_ALWAYS, +@@ -6679,28 +6763,27 @@ yaffs_Object *yaffs_FindObjectByName(yaf + + sum = yaffs_CalcNameSum(name); + +- list_for_each(i, &directory->variant.directoryVariant.children) { ++ ylist_for_each(i, &directory->variant.directoryVariant.children) { + if (i) { +- l = list_entry(i, yaffs_Object, siblings); ++ l = ylist_entry(i, yaffs_Object, siblings); ++ ++ if (l->parent != directory) ++ YBUG(); + + yaffs_CheckObjectDetailsLoaded(l); + + /* Special case for lost-n-found */ + if (l->objectId == YAFFS_OBJECTID_LOSTNFOUND) { +- if (yaffs_strcmp(name, YAFFS_LOSTNFOUND_NAME) == 0) { ++ if (yaffs_strcmp(name, YAFFS_LOSTNFOUND_NAME) == 0) + return l; +- } +- } else if (yaffs_SumCompare(l->sum, sum) || l->chunkId <= 0) +- { +- /* LostnFound cunk called Objxxx ++ } else if (yaffs_SumCompare(l->sum, sum) || l->hdrChunk <= 0) { ++ /* LostnFound chunk called Objxxx + * Do a real check + */ + yaffs_GetObjectName(l, buffer, + YAFFS_MAX_NAME_LENGTH); +- if (yaffs_strncmp(name, buffer,YAFFS_MAX_NAME_LENGTH) == 0) { ++ if (yaffs_strncmp(name, buffer, YAFFS_MAX_NAME_LENGTH) == 0) + return l; +- } +- + } + } + } +@@ -6710,10 +6793,10 @@ yaffs_Object *yaffs_FindObjectByName(yaf + + + #if 0 +-int yaffs_ApplyToDirectoryChildren(yaffs_Object * theDir, +- int (*fn) (yaffs_Object *)) ++int yaffs_ApplyToDirectoryChildren(yaffs_Object *theDir, ++ int (*fn) (yaffs_Object *)) + { +- struct list_head *i; ++ struct ylist_head *i; + yaffs_Object *l; + + if (!theDir) { +@@ -6722,20 +6805,21 @@ int yaffs_ApplyToDirectoryChildren(yaffs + ("tragedy: yaffs_FindObjectByName: null pointer directory" + TENDSTR))); + YBUG(); ++ return YAFFS_FAIL; + } + if (theDir->variantType != YAFFS_OBJECT_TYPE_DIRECTORY) { + T(YAFFS_TRACE_ALWAYS, + (TSTR + ("tragedy: yaffs_FindObjectByName: non-directory" TENDSTR))); + YBUG(); ++ return YAFFS_FAIL; + } + +- list_for_each(i, &theDir->variant.directoryVariant.children) { ++ ylist_for_each(i, &theDir->variant.directoryVariant.children) { + if (i) { +- l = list_entry(i, yaffs_Object, siblings); +- if (l && !fn(l)) { ++ l = ylist_entry(i, yaffs_Object, siblings); ++ if (l && !fn(l)) + return YAFFS_FAIL; +- } + } + } + +@@ -6748,7 +6832,7 @@ int yaffs_ApplyToDirectoryChildren(yaffs + * actual object. + */ + +-yaffs_Object *yaffs_GetEquivalentObject(yaffs_Object * obj) ++yaffs_Object *yaffs_GetEquivalentObject(yaffs_Object *obj) + { + if (obj && obj->variantType == YAFFS_OBJECT_TYPE_HARDLINK) { + /* We want the object id of the equivalent object, not this one */ +@@ -6756,10 +6840,9 @@ yaffs_Object *yaffs_GetEquivalentObject( + yaffs_CheckObjectDetailsLoaded(obj); + } + return obj; +- + } + +-int yaffs_GetObjectName(yaffs_Object * obj, YCHAR * name, int buffSize) ++int yaffs_GetObjectName(yaffs_Object *obj, YCHAR *name, int buffSize) + { + memset(name, 0, buffSize * sizeof(YCHAR)); + +@@ -6767,18 +6850,26 @@ int yaffs_GetObjectName(yaffs_Object * o + + if (obj->objectId == YAFFS_OBJECTID_LOSTNFOUND) { + yaffs_strncpy(name, YAFFS_LOSTNFOUND_NAME, buffSize - 1); +- } else if (obj->chunkId <= 0) { ++ } else if (obj->hdrChunk <= 0) { + YCHAR locName[20]; ++ YCHAR numString[20]; ++ YCHAR *x = &numString[19]; ++ unsigned v = obj->objectId; ++ numString[19] = 0; ++ while (v > 0) { ++ x--; ++ *x = '0' + (v % 10); ++ v /= 10; ++ } + /* make up a name */ +- yaffs_sprintf(locName, _Y("%s%d"), YAFFS_LOSTNFOUND_PREFIX, +- obj->objectId); ++ yaffs_strcpy(locName, YAFFS_LOSTNFOUND_PREFIX); ++ yaffs_strcat(locName, x); + yaffs_strncpy(name, locName, buffSize - 1); + + } + #ifdef CONFIG_YAFFS_SHORT_NAMES_IN_RAM +- else if (obj->shortName[0]) { ++ else if (obj->shortName[0]) + yaffs_strcpy(name, obj->shortName); +- } + #endif + else { + int result; +@@ -6788,9 +6879,9 @@ int yaffs_GetObjectName(yaffs_Object * o + + memset(buffer, 0, obj->myDev->nDataBytesPerChunk); + +- if (obj->chunkId >= 0) { ++ if (obj->hdrChunk > 0) { + result = yaffs_ReadChunkWithTagsFromNAND(obj->myDev, +- obj->chunkId, buffer, ++ obj->hdrChunk, buffer, + NULL); + } + yaffs_strncpy(name, oh->name, buffSize - 1); +@@ -6801,46 +6892,43 @@ int yaffs_GetObjectName(yaffs_Object * o + return yaffs_strlen(name); + } + +-int yaffs_GetObjectFileLength(yaffs_Object * obj) ++int yaffs_GetObjectFileLength(yaffs_Object *obj) + { +- + /* Dereference any hard linking */ + obj = yaffs_GetEquivalentObject(obj); + +- if (obj->variantType == YAFFS_OBJECT_TYPE_FILE) { ++ if (obj->variantType == YAFFS_OBJECT_TYPE_FILE) + return obj->variant.fileVariant.fileSize; +- } +- if (obj->variantType == YAFFS_OBJECT_TYPE_SYMLINK) { ++ if (obj->variantType == YAFFS_OBJECT_TYPE_SYMLINK) + return yaffs_strlen(obj->variant.symLinkVariant.alias); +- } else { ++ else { + /* Only a directory should drop through to here */ + return obj->myDev->nDataBytesPerChunk; + } + } + +-int yaffs_GetObjectLinkCount(yaffs_Object * obj) ++int yaffs_GetObjectLinkCount(yaffs_Object *obj) + { + int count = 0; +- struct list_head *i; ++ struct ylist_head *i; + +- if (!obj->unlinked) { +- count++; /* the object itself */ +- } +- list_for_each(i, &obj->hardLinks) { +- count++; /* add the hard links; */ +- } +- return count; ++ if (!obj->unlinked) ++ count++; /* the object itself */ ++ ++ ylist_for_each(i, &obj->hardLinks) ++ count++; /* add the hard links; */ + ++ return count; + } + +-int yaffs_GetObjectInode(yaffs_Object * obj) ++int yaffs_GetObjectInode(yaffs_Object *obj) + { + obj = yaffs_GetEquivalentObject(obj); + + return obj->objectId; + } + +-unsigned yaffs_GetObjectType(yaffs_Object * obj) ++unsigned yaffs_GetObjectType(yaffs_Object *obj) + { + obj = yaffs_GetEquivalentObject(obj); + +@@ -6872,19 +6960,18 @@ unsigned yaffs_GetObjectType(yaffs_Objec + } + } + +-YCHAR *yaffs_GetSymlinkAlias(yaffs_Object * obj) ++YCHAR *yaffs_GetSymlinkAlias(yaffs_Object *obj) + { + obj = yaffs_GetEquivalentObject(obj); +- if (obj->variantType == YAFFS_OBJECT_TYPE_SYMLINK) { ++ if (obj->variantType == YAFFS_OBJECT_TYPE_SYMLINK) + return yaffs_CloneString(obj->variant.symLinkVariant.alias); +- } else { ++ else + return yaffs_CloneString(_Y("")); +- } + } + + #ifndef CONFIG_YAFFS_WINCE + +-int yaffs_SetAttributes(yaffs_Object * obj, struct iattr *attr) ++int yaffs_SetAttributes(yaffs_Object *obj, struct iattr *attr) + { + unsigned int valid = attr->ia_valid; + +@@ -6910,7 +6997,7 @@ int yaffs_SetAttributes(yaffs_Object * o + return YAFFS_OK; + + } +-int yaffs_GetAttributes(yaffs_Object * obj, struct iattr *attr) ++int yaffs_GetAttributes(yaffs_Object *obj, struct iattr *attr) + { + unsigned int valid = 0; + +@@ -6934,13 +7021,12 @@ int yaffs_GetAttributes(yaffs_Object * o + attr->ia_valid = valid; + + return YAFFS_OK; +- + } + + #endif + + #if 0 +-int yaffs_DumpObject(yaffs_Object * obj) ++int yaffs_DumpObject(yaffs_Object *obj) + { + YCHAR name[257]; + +@@ -6951,7 +7037,7 @@ int yaffs_DumpObject(yaffs_Object * obj) + ("Object %d, inode %d \"%s\"\n dirty %d valid %d serial %d sum %d" + " chunk %d type %d size %d\n" + TENDSTR), obj->objectId, yaffs_GetObjectInode(obj), name, +- obj->dirty, obj->valid, obj->serial, obj->sum, obj->chunkId, ++ obj->dirty, obj->valid, obj->serial, obj->sum, obj->hdrChunk, + yaffs_GetObjectType(obj), yaffs_GetObjectFileLength(obj))); + + return YAFFS_OK; +@@ -6960,7 +7046,7 @@ int yaffs_DumpObject(yaffs_Object * obj) + + /*---------------------------- Initialisation code -------------------------------------- */ + +-static int yaffs_CheckDevFunctions(const yaffs_Device * dev) ++static int yaffs_CheckDevFunctions(const yaffs_Device *dev) + { + + /* Common functions, gotta have */ +@@ -7011,7 +7097,7 @@ static int yaffs_CreateInitialDirectorie + yaffs_CreateFakeDirectory(dev, YAFFS_OBJECTID_LOSTNFOUND, + YAFFS_LOSTNFOUND_MODE | S_IFDIR); + +- if(dev->lostNFoundDir && dev->rootDir && dev->unlinkedDir && dev->deletedDir){ ++ if (dev->lostNFoundDir && dev->rootDir && dev->unlinkedDir && dev->deletedDir) { + yaffs_AddObjectToDirectory(dev->rootDir, dev->lostNFoundDir); + return YAFFS_OK; + } +@@ -7019,7 +7105,7 @@ static int yaffs_CreateInitialDirectorie + return YAFFS_FAIL; + } + +-int yaffs_GutsInitialise(yaffs_Device * dev) ++int yaffs_GutsInitialise(yaffs_Device *dev) + { + int init_failed = 0; + unsigned x; +@@ -7040,6 +7126,8 @@ int yaffs_GutsInitialise(yaffs_Device * + dev->chunkOffset = 0; + dev->nFreeChunks = 0; + ++ dev->gcBlock = -1; ++ + if (dev->startBlock == 0) { + dev->internalStartBlock = dev->startBlock + 1; + dev->internalEndBlock = dev->endBlock + 1; +@@ -7049,18 +7137,18 @@ int yaffs_GutsInitialise(yaffs_Device * + + /* Check geometry parameters. */ + +- if ((dev->isYaffs2 && dev->nDataBytesPerChunk < 1024) || +- (!dev->isYaffs2 && dev->nDataBytesPerChunk != 512) || ++ if ((!dev->inbandTags && dev->isYaffs2 && dev->totalBytesPerChunk < 1024) || ++ (!dev->isYaffs2 && dev->totalBytesPerChunk < 512) || ++ (dev->inbandTags && !dev->isYaffs2) || + dev->nChunksPerBlock < 2 || + dev->nReservedBlocks < 2 || + dev->internalStartBlock <= 0 || + dev->internalEndBlock <= 0 || +- dev->internalEndBlock <= (dev->internalStartBlock + dev->nReservedBlocks + 2) // otherwise it is too small +- ) { ++ dev->internalEndBlock <= (dev->internalStartBlock + dev->nReservedBlocks + 2)) { /* otherwise it is too small */ + T(YAFFS_TRACE_ALWAYS, + (TSTR +- ("yaffs: NAND geometry problems: chunk size %d, type is yaffs%s " +- TENDSTR), dev->nDataBytesPerChunk, dev->isYaffs2 ? "2" : "")); ++ ("yaffs: NAND geometry problems: chunk size %d, type is yaffs%s, inbandTags %d " ++ TENDSTR), dev->totalBytesPerChunk, dev->isYaffs2 ? "2" : "", dev->inbandTags)); + return YAFFS_FAIL; + } + +@@ -7070,6 +7158,12 @@ int yaffs_GutsInitialise(yaffs_Device * + return YAFFS_FAIL; + } + ++ /* Sort out space for inband tags, if required */ ++ if (dev->inbandTags) ++ dev->nDataBytesPerChunk = dev->totalBytesPerChunk - sizeof(yaffs_PackedTags2TagsPart); ++ else ++ dev->nDataBytesPerChunk = dev->totalBytesPerChunk; ++ + /* Got the right mix of functions? */ + if (!yaffs_CheckDevFunctions(dev)) { + /* Function missing */ +@@ -7097,31 +7191,18 @@ int yaffs_GutsInitialise(yaffs_Device * + + dev->isMounted = 1; + +- +- + /* OK now calculate a few things for the device */ + + /* + * Calculate all the chunk size manipulation numbers: + */ +- /* Start off assuming it is a power of 2 */ +- dev->chunkShift = ShiftDiv(dev->nDataBytesPerChunk); +- dev->chunkMask = (1<chunkShift) - 1; +- +- if(dev->nDataBytesPerChunk == (dev->chunkMask + 1)){ +- /* Yes it is a power of 2, disable crumbs */ +- dev->crumbMask = 0; +- dev->crumbShift = 0; +- dev->crumbsPerChunk = 0; +- } else { +- /* Not a power of 2, use crumbs instead */ +- dev->crumbShift = ShiftDiv(sizeof(yaffs_PackedTags2TagsPart)); +- dev->crumbMask = (1<crumbShift)-1; +- dev->crumbsPerChunk = dev->nDataBytesPerChunk/(1 << dev->crumbShift); +- dev->chunkShift = 0; +- dev->chunkMask = 0; +- } +- ++ x = dev->nDataBytesPerChunk; ++ /* We always use dev->chunkShift and dev->chunkDiv */ ++ dev->chunkShift = Shifts(x); ++ x >>= dev->chunkShift; ++ dev->chunkDiv = x; ++ /* We only use chunk mask if chunkDiv is 1 */ ++ dev->chunkMask = (1<chunkShift) - 1; + + /* + * Calculate chunkGroupBits. +@@ -7133,16 +7214,15 @@ int yaffs_GutsInitialise(yaffs_Device * + bits = ShiftsGE(x); + + /* Set up tnode width if wide tnodes are enabled. */ +- if(!dev->wideTnodesDisabled){ ++ if (!dev->wideTnodesDisabled) { + /* bits must be even so that we end up with 32-bit words */ +- if(bits & 1) ++ if (bits & 1) + bits++; +- if(bits < 16) ++ if (bits < 16) + dev->tnodeWidth = 16; + else + dev->tnodeWidth = bits; +- } +- else ++ } else + dev->tnodeWidth = 16; + + dev->tnodeMask = (1<tnodeWidth)-1; +@@ -7193,7 +7273,7 @@ int yaffs_GutsInitialise(yaffs_Device * + dev->hasPendingPrioritisedGCs = 1; /* Assume the worst for now, will get fixed on first GC */ + + /* Initialise temporary buffers and caches. */ +- if(!yaffs_InitialiseTempBuffers(dev)) ++ if (!yaffs_InitialiseTempBuffers(dev)) + init_failed = 1; + + dev->srCache = NULL; +@@ -7203,25 +7283,26 @@ int yaffs_GutsInitialise(yaffs_Device * + if (!init_failed && + dev->nShortOpCaches > 0) { + int i; +- __u8 *buf; ++ void *buf; + int srCacheBytes = dev->nShortOpCaches * sizeof(yaffs_ChunkCache); + +- if (dev->nShortOpCaches > YAFFS_MAX_SHORT_OP_CACHES) { ++ if (dev->nShortOpCaches > YAFFS_MAX_SHORT_OP_CACHES) + dev->nShortOpCaches = YAFFS_MAX_SHORT_OP_CACHES; +- } + +- buf = dev->srCache = YMALLOC(srCacheBytes); ++ dev->srCache = YMALLOC(srCacheBytes); + +- if(dev->srCache) +- memset(dev->srCache,0,srCacheBytes); ++ buf = (__u8 *) dev->srCache; ++ ++ if (dev->srCache) ++ memset(dev->srCache, 0, srCacheBytes); + + for (i = 0; i < dev->nShortOpCaches && buf; i++) { + dev->srCache[i].object = NULL; + dev->srCache[i].lastUse = 0; + dev->srCache[i].dirty = 0; +- dev->srCache[i].data = buf = YMALLOC_DMA(dev->nDataBytesPerChunk); ++ dev->srCache[i].data = buf = YMALLOC_DMA(dev->totalBytesPerChunk); + } +- if(!buf) ++ if (!buf) + init_failed = 1; + + dev->srLastUse = 0; +@@ -7229,29 +7310,30 @@ int yaffs_GutsInitialise(yaffs_Device * + + dev->cacheHits = 0; + +- if(!init_failed){ ++ if (!init_failed) { + dev->gcCleanupList = YMALLOC(dev->nChunksPerBlock * sizeof(__u32)); +- if(!dev->gcCleanupList) ++ if (!dev->gcCleanupList) + init_failed = 1; + } + +- if (dev->isYaffs2) { ++ if (dev->isYaffs2) + dev->useHeaderFileSize = 1; +- } +- if(!init_failed && !yaffs_InitialiseBlocks(dev)) ++ ++ if (!init_failed && !yaffs_InitialiseBlocks(dev)) + init_failed = 1; + + yaffs_InitialiseTnodes(dev); + yaffs_InitialiseObjects(dev); + +- if(!init_failed && !yaffs_CreateInitialDirectories(dev)) ++ if (!init_failed && !yaffs_CreateInitialDirectories(dev)) + init_failed = 1; + + +- if(!init_failed){ ++ if (!init_failed) { + /* Now scan the flash. */ + if (dev->isYaffs2) { +- if(yaffs_CheckpointRestore(dev)) { ++ if (yaffs_CheckpointRestore(dev)) { ++ yaffs_CheckObjectDetailsLoaded(dev->rootDir); + T(YAFFS_TRACE_ALWAYS, + (TSTR("yaffs: restored from checkpoint" TENDSTR))); + } else { +@@ -7273,24 +7355,25 @@ int yaffs_GutsInitialise(yaffs_Device * + dev->nBackgroundDeletions = 0; + dev->oldestDirtySequence = 0; + +- if(!init_failed && !yaffs_InitialiseBlocks(dev)) ++ if (!init_failed && !yaffs_InitialiseBlocks(dev)) + init_failed = 1; + + yaffs_InitialiseTnodes(dev); + yaffs_InitialiseObjects(dev); + +- if(!init_failed && !yaffs_CreateInitialDirectories(dev)) ++ if (!init_failed && !yaffs_CreateInitialDirectories(dev)) + init_failed = 1; + +- if(!init_failed && !yaffs_ScanBackwards(dev)) ++ if (!init_failed && !yaffs_ScanBackwards(dev)) + init_failed = 1; + } +- }else +- if(!yaffs_Scan(dev)) ++ } else if (!yaffs_Scan(dev)) + init_failed = 1; ++ ++ yaffs_StripDeletedObjects(dev); + } + +- if(init_failed){ ++ if (init_failed) { + /* Clean up the mess */ + T(YAFFS_TRACE_TRACING, + (TSTR("yaffs: yaffs_GutsInitialise() aborted.\n" TENDSTR))); +@@ -7318,7 +7401,7 @@ int yaffs_GutsInitialise(yaffs_Device * + + } + +-void yaffs_Deinitialise(yaffs_Device * dev) ++void yaffs_Deinitialise(yaffs_Device *dev) + { + if (dev->isMounted) { + int i; +@@ -7330,7 +7413,7 @@ void yaffs_Deinitialise(yaffs_Device * d + dev->srCache) { + + for (i = 0; i < dev->nShortOpCaches; i++) { +- if(dev->srCache[i].data) ++ if (dev->srCache[i].data) + YFREE(dev->srCache[i].data); + dev->srCache[i].data = NULL; + } +@@ -7341,16 +7424,17 @@ void yaffs_Deinitialise(yaffs_Device * d + + YFREE(dev->gcCleanupList); + +- for (i = 0; i < YAFFS_N_TEMP_BUFFERS; i++) { ++ for (i = 0; i < YAFFS_N_TEMP_BUFFERS; i++) + YFREE(dev->tempBuffer[i].buffer); +- } + + dev->isMounted = 0; +- } + ++ if (dev->deinitialiseNAND) ++ dev->deinitialiseNAND(dev); ++ } + } + +-static int yaffs_CountFreeChunks(yaffs_Device * dev) ++static int yaffs_CountFreeChunks(yaffs_Device *dev) + { + int nFree; + int b; +@@ -7358,7 +7442,7 @@ static int yaffs_CountFreeChunks(yaffs_D + yaffs_BlockInfo *blk; + + for (nFree = 0, b = dev->internalStartBlock; b <= dev->internalEndBlock; +- b++) { ++ b++) { + blk = yaffs_GetBlockInfo(dev, b); + + switch (blk->blockState) { +@@ -7373,19 +7457,19 @@ static int yaffs_CountFreeChunks(yaffs_D + default: + break; + } +- + } + + return nFree; + } + +-int yaffs_GetNumberOfFreeChunks(yaffs_Device * dev) ++int yaffs_GetNumberOfFreeChunks(yaffs_Device *dev) + { + /* This is what we report to the outside world */ + + int nFree; + int nDirtyCacheChunks; + int blocksForCheckpoint; ++ int i; + + #if 1 + nFree = dev->nFreeChunks; +@@ -7397,12 +7481,9 @@ int yaffs_GetNumberOfFreeChunks(yaffs_De + + /* Now count the number of dirty chunks in the cache and subtract those */ + +- { +- int i; +- for (nDirtyCacheChunks = 0, i = 0; i < dev->nShortOpCaches; i++) { +- if (dev->srCache[i].dirty) +- nDirtyCacheChunks++; +- } ++ for (nDirtyCacheChunks = 0, i = 0; i < dev->nShortOpCaches; i++) { ++ if (dev->srCache[i].dirty) ++ nDirtyCacheChunks++; + } + + nFree -= nDirtyCacheChunks; +@@ -7410,8 +7491,8 @@ int yaffs_GetNumberOfFreeChunks(yaffs_De + nFree -= ((dev->nReservedBlocks + 1) * dev->nChunksPerBlock); + + /* Now we figure out how much to reserve for the checkpoint and report that... */ +- blocksForCheckpoint = dev->nCheckpointReservedBlocks - dev->blocksInCheckpoint; +- if(blocksForCheckpoint < 0) ++ blocksForCheckpoint = yaffs_CalcCheckpointBlocksRequired(dev) - dev->blocksInCheckpoint; ++ if (blocksForCheckpoint < 0) + blocksForCheckpoint = 0; + + nFree -= (blocksForCheckpoint * dev->nChunksPerBlock); +@@ -7425,12 +7506,12 @@ int yaffs_GetNumberOfFreeChunks(yaffs_De + + static int yaffs_freeVerificationFailures; + +-static void yaffs_VerifyFreeChunks(yaffs_Device * dev) ++static void yaffs_VerifyFreeChunks(yaffs_Device *dev) + { + int counted; + int difference; + +- if(yaffs_SkipVerification(dev)) ++ if (yaffs_SkipVerification(dev)) + return; + + counted = yaffs_CountFreeChunks(dev); +@@ -7447,23 +7528,25 @@ static void yaffs_VerifyFreeChunks(yaffs + + /*---------------------------------------- YAFFS test code ----------------------*/ + +-#define yaffs_CheckStruct(structure,syze, name) \ +- if(sizeof(structure) != syze) \ +- { \ +- T(YAFFS_TRACE_ALWAYS,(TSTR("%s should be %d but is %d\n" TENDSTR),\ +- name,syze,sizeof(structure))); \ +- return YAFFS_FAIL; \ +- } ++#define yaffs_CheckStruct(structure, syze, name) \ ++ do { \ ++ if (sizeof(structure) != syze) { \ ++ T(YAFFS_TRACE_ALWAYS, (TSTR("%s should be %d but is %d\n" TENDSTR),\ ++ name, syze, sizeof(structure))); \ ++ return YAFFS_FAIL; \ ++ } \ ++ } while (0) + + static int yaffs_CheckStructures(void) + { +-/* yaffs_CheckStruct(yaffs_Tags,8,"yaffs_Tags") */ +-/* yaffs_CheckStruct(yaffs_TagsUnion,8,"yaffs_TagsUnion") */ +-/* yaffs_CheckStruct(yaffs_Spare,16,"yaffs_Spare") */ ++/* yaffs_CheckStruct(yaffs_Tags,8,"yaffs_Tags"); */ ++/* yaffs_CheckStruct(yaffs_TagsUnion,8,"yaffs_TagsUnion"); */ ++/* yaffs_CheckStruct(yaffs_Spare,16,"yaffs_Spare"); */ + #ifndef CONFIG_YAFFS_TNODE_LIST_DEBUG +- yaffs_CheckStruct(yaffs_Tnode, 2 * YAFFS_NTNODES_LEVEL0, "yaffs_Tnode") ++ yaffs_CheckStruct(yaffs_Tnode, 2 * YAFFS_NTNODES_LEVEL0, "yaffs_Tnode"); + #endif +- yaffs_CheckStruct(yaffs_ObjectHeader, 512, "yaffs_ObjectHeader") +- +- return YAFFS_OK; ++#ifndef CONFIG_YAFFS_WINCE ++ yaffs_CheckStruct(yaffs_ObjectHeader, 512, "yaffs_ObjectHeader"); ++#endif ++ return YAFFS_OK; + } +--- a/fs/yaffs2/yaffs_guts.h ++++ b/fs/yaffs2/yaffs_guts.h +@@ -90,7 +90,7 @@ + + #define YAFFS_MAX_SHORT_OP_CACHES 20 + +-#define YAFFS_N_TEMP_BUFFERS 4 ++#define YAFFS_N_TEMP_BUFFERS 6 + + /* We limit the number attempts at sucessfully saving a chunk of data. + * Small-page devices have 32 pages per block; large-page devices have 64. +@@ -108,6 +108,9 @@ + #define YAFFS_LOWEST_SEQUENCE_NUMBER 0x00001000 + #define YAFFS_HIGHEST_SEQUENCE_NUMBER 0xEFFFFF00 + ++/* Special sequence number for bad block that failed to be marked bad */ ++#define YAFFS_SEQUENCE_BAD_BLOCK 0xFFFF0000 ++ + /* ChunkCache is used for short read/write operations.*/ + typedef struct { + struct yaffs_ObjectStruct *object; +@@ -134,11 +137,10 @@ typedef struct { + typedef struct { + unsigned chunkId:20; + unsigned serialNumber:2; +- unsigned byteCount:10; ++ unsigned byteCountLSB:10; + unsigned objectId:18; + unsigned ecc:12; +- unsigned unusedStuff:2; +- ++ unsigned byteCountMSB:2; + } yaffs_Tags; + + typedef union { +@@ -277,13 +279,13 @@ typedef struct { + + int softDeletions:10; /* number of soft deleted pages */ + int pagesInUse:10; /* number of pages in use */ +- yaffs_BlockState blockState:4; /* One of the above block states */ ++ unsigned blockState:4; /* One of the above block states. NB use unsigned because enum is sometimes an int */ + __u32 needsRetiring:1; /* Data has failed on this block, need to get valid data off */ +- /* and retire the block. */ +- __u32 skipErasedCheck: 1; /* If this is set we can skip the erased check on this block */ +- __u32 gcPrioritise: 1; /* An ECC check or blank check has failed on this block. ++ /* and retire the block. */ ++ __u32 skipErasedCheck:1; /* If this is set we can skip the erased check on this block */ ++ __u32 gcPrioritise:1; /* An ECC check or blank check has failed on this block. + It should be prioritised for GC */ +- __u32 chunkErrorStrikes:3; /* How many times we've had ecc etc failures on this block and tried to reuse it */ ++ __u32 chunkErrorStrikes:3; /* How many times we've had ecc etc failures on this block and tried to reuse it */ + + #ifdef CONFIG_YAFFS_YAFFS2 + __u32 hasShrinkHeader:1; /* This block has at least one shrink object header */ +@@ -300,11 +302,11 @@ typedef struct { + + /* Apply to everything */ + int parentObjectId; +- __u16 sum__NoLongerUsed; /* checksum of name. No longer used */ ++ __u16 sum__NoLongerUsed; /* checksum of name. No longer used */ + YCHAR name[YAFFS_MAX_NAME_LENGTH + 1]; + +- /* Thes following apply to directories, files, symlinks - not hard links */ +- __u32 yst_mode; /* protection */ ++ /* The following apply to directories, files, symlinks - not hard links */ ++ __u32 yst_mode; /* protection */ + + #ifdef CONFIG_YAFFS_WINCE + __u32 notForWinCE[5]; +@@ -331,11 +333,14 @@ typedef struct { + __u32 win_ctime[2]; + __u32 win_atime[2]; + __u32 win_mtime[2]; +- __u32 roomToGrow[4]; + #else +- __u32 roomToGrow[10]; ++ __u32 roomToGrow[6]; ++ + #endif ++ __u32 inbandShadowsObject; ++ __u32 inbandIsShrink; + ++ __u32 reservedSpace[2]; + int shadowsObject; /* This object header shadows the specified object if > 0 */ + + /* isShrink applies to object headers written when we shrink the file (ie resize) */ +@@ -381,7 +386,7 @@ typedef struct { + } yaffs_FileStructure; + + typedef struct { +- struct list_head children; /* list of child links */ ++ struct ylist_head children; /* list of child links */ + } yaffs_DirectoryStructure; + + typedef struct { +@@ -418,23 +423,24 @@ struct yaffs_ObjectStruct { + * still in the inode cache. Free of object is defered. + * until the inode is released. + */ ++ __u8 beingCreated:1; /* This object is still being created so skip some checks. */ + + __u8 serial; /* serial number of chunk in NAND. Cached here */ + __u16 sum; /* sum of the name to speed searching */ + +- struct yaffs_DeviceStruct *myDev; /* The device I'm on */ ++ struct yaffs_DeviceStruct *myDev; /* The device I'm on */ + +- struct list_head hashLink; /* list of objects in this hash bucket */ ++ struct ylist_head hashLink; /* list of objects in this hash bucket */ + +- struct list_head hardLinks; /* all the equivalent hard linked objects */ ++ struct ylist_head hardLinks; /* all the equivalent hard linked objects */ + + /* directory structure stuff */ + /* also used for linking up the free list */ + struct yaffs_ObjectStruct *parent; +- struct list_head siblings; ++ struct ylist_head siblings; + + /* Where's my object header in NAND? */ +- int chunkId; ++ int hdrChunk; + + int nDataChunks; /* Number of data chunks attached to the file. */ + +@@ -485,7 +491,7 @@ struct yaffs_ObjectList_struct { + typedef struct yaffs_ObjectList_struct yaffs_ObjectList; + + typedef struct { +- struct list_head list; ++ struct ylist_head list; + int count; + } yaffs_ObjectBucket; + +@@ -495,11 +501,10 @@ typedef struct { + */ + + typedef struct { +- int structType; ++ int structType; + __u32 objectId; + __u32 parentId; +- int chunkId; +- ++ int hdrChunk; + yaffs_ObjectType variantType:3; + __u8 deleted:1; + __u8 softDeleted:1; +@@ -511,8 +516,7 @@ typedef struct { + + int nDataChunks; + __u32 fileSizeOrEquivalentObjectId; +- +-}yaffs_CheckpointObject; ++} yaffs_CheckpointObject; + + /*--------------------- Temporary buffers ---------------- + * +@@ -528,13 +532,13 @@ typedef struct { + /*----------------- Device ---------------------------------*/ + + struct yaffs_DeviceStruct { +- struct list_head devList; ++ struct ylist_head devList; + const char *name; + + /* Entry parameters set up way early. Yaffs sets up the rest.*/ + int nDataBytesPerChunk; /* Should be a power of 2 >= 512 */ + int nChunksPerBlock; /* does not need to be a power of 2 */ +- int nBytesPerSpare; /* spare area size */ ++ int spareBytesPerChunk; /* spare area size */ + int startBlock; /* Start block we're allowed to use */ + int endBlock; /* End block we're allowed to use */ + int nReservedBlocks; /* We want this tuneable so that we can reduce */ +@@ -544,9 +548,7 @@ struct yaffs_DeviceStruct { + /* Stuff used by the shared space checkpointing mechanism */ + /* If this value is zero, then this mechanism is disabled */ + +- int nCheckpointReservedBlocks; /* Blocks to reserve for checkpoint data */ +- +- ++/* int nCheckpointReservedBlocks; */ /* Blocks to reserve for checkpoint data */ + + + int nShortOpCaches; /* If <= 0, then short op caching is disabled, else +@@ -560,30 +562,31 @@ struct yaffs_DeviceStruct { + void *genericDevice; /* Pointer to device context + * On an mtd this holds the mtd pointer. + */ +- void *superBlock; ++ void *superBlock; + + /* NAND access functions (Must be set before calling YAFFS)*/ + +- int (*writeChunkToNAND) (struct yaffs_DeviceStruct * dev, +- int chunkInNAND, const __u8 * data, +- const yaffs_Spare * spare); +- int (*readChunkFromNAND) (struct yaffs_DeviceStruct * dev, +- int chunkInNAND, __u8 * data, +- yaffs_Spare * spare); +- int (*eraseBlockInNAND) (struct yaffs_DeviceStruct * dev, +- int blockInNAND); +- int (*initialiseNAND) (struct yaffs_DeviceStruct * dev); ++ int (*writeChunkToNAND) (struct yaffs_DeviceStruct *dev, ++ int chunkInNAND, const __u8 *data, ++ const yaffs_Spare *spare); ++ int (*readChunkFromNAND) (struct yaffs_DeviceStruct *dev, ++ int chunkInNAND, __u8 *data, ++ yaffs_Spare *spare); ++ int (*eraseBlockInNAND) (struct yaffs_DeviceStruct *dev, ++ int blockInNAND); ++ int (*initialiseNAND) (struct yaffs_DeviceStruct *dev); ++ int (*deinitialiseNAND) (struct yaffs_DeviceStruct *dev); + + #ifdef CONFIG_YAFFS_YAFFS2 +- int (*writeChunkWithTagsToNAND) (struct yaffs_DeviceStruct * dev, +- int chunkInNAND, const __u8 * data, +- const yaffs_ExtendedTags * tags); +- int (*readChunkWithTagsFromNAND) (struct yaffs_DeviceStruct * dev, +- int chunkInNAND, __u8 * data, +- yaffs_ExtendedTags * tags); +- int (*markNANDBlockBad) (struct yaffs_DeviceStruct * dev, int blockNo); +- int (*queryNANDBlock) (struct yaffs_DeviceStruct * dev, int blockNo, +- yaffs_BlockState * state, int *sequenceNumber); ++ int (*writeChunkWithTagsToNAND) (struct yaffs_DeviceStruct *dev, ++ int chunkInNAND, const __u8 *data, ++ const yaffs_ExtendedTags *tags); ++ int (*readChunkWithTagsFromNAND) (struct yaffs_DeviceStruct *dev, ++ int chunkInNAND, __u8 *data, ++ yaffs_ExtendedTags *tags); ++ int (*markNANDBlockBad) (struct yaffs_DeviceStruct *dev, int blockNo); ++ int (*queryNANDBlock) (struct yaffs_DeviceStruct *dev, int blockNo, ++ yaffs_BlockState *state, __u32 *sequenceNumber); + #endif + + int isYaffs2; +@@ -595,10 +598,12 @@ struct yaffs_DeviceStruct { + void (*removeObjectCallback)(struct yaffs_ObjectStruct *obj); + + /* Callback to mark the superblock dirsty */ +- void (*markSuperBlockDirty)(void * superblock); ++ void (*markSuperBlockDirty)(void *superblock); + + int wideTnodesDisabled; /* Set to disable wide tnodes */ + ++ YCHAR *pathDividers; /* String of legal path dividers */ ++ + + /* End of stuff that must be set before initialisation. */ + +@@ -615,16 +620,14 @@ struct yaffs_DeviceStruct { + __u32 tnodeWidth; + __u32 tnodeMask; + +- /* Stuff to support various file offses to chunk/offset translations */ +- /* "Crumbs" for nDataBytesPerChunk not being a power of 2 */ +- __u32 crumbMask; +- __u32 crumbShift; +- __u32 crumbsPerChunk; +- +- /* Straight shifting for nDataBytesPerChunk being a power of 2 */ +- __u32 chunkShift; +- __u32 chunkMask; +- ++ /* Stuff for figuring out file offset to chunk conversions */ ++ __u32 chunkShift; /* Shift value */ ++ __u32 chunkDiv; /* Divisor after shifting: 1 for power-of-2 sizes */ ++ __u32 chunkMask; /* Mask to use for power-of-2 case */ ++ ++ /* Stuff to handle inband tags */ ++ int inbandTags; ++ __u32 totalBytesPerChunk; + + #ifdef __KERNEL__ + +@@ -633,7 +636,7 @@ struct yaffs_DeviceStruct { + __u8 *spareBuffer; /* For mtdif2 use. Don't know the size of the buffer + * at compile time so we have to allocate it. + */ +- void (*putSuperFunc) (struct super_block * sb); ++ void (*putSuperFunc) (struct super_block *sb); + #endif + + int isMounted; +@@ -663,6 +666,8 @@ struct yaffs_DeviceStruct { + __u32 checkpointSum; + __u32 checkpointXor; + ++ int nCheckpointBlocksRequired; /* Number of blocks needed to store current checkpoint set */ ++ + /* Block Info */ + yaffs_BlockInfo *blockInfo; + __u8 *chunkBits; /* bitmap of chunks in use */ +@@ -684,11 +689,15 @@ struct yaffs_DeviceStruct { + yaffs_TnodeList *allocatedTnodeList; + + int isDoingGC; ++ int gcBlock; ++ int gcChunk; + + int nObjectsCreated; + yaffs_Object *freeObjects; + int nFreeObjects; + ++ int nHardLinks; ++ + yaffs_ObjectList *allocatedObjectList; + + yaffs_ObjectBucket objectBucket[YAFFS_NOBJECT_BUCKETS]; +@@ -745,8 +754,10 @@ struct yaffs_DeviceStruct { + int nBackgroundDeletions; /* Count of background deletions. */ + + ++ /* Temporary buffer management */ + yaffs_TempBuffer tempBuffer[YAFFS_N_TEMP_BUFFERS]; + int maxTemp; ++ int tempInUse; + int unmanagedTempAllocations; + int unmanagedTempDeallocations; + +@@ -758,9 +769,9 @@ struct yaffs_DeviceStruct { + + typedef struct yaffs_DeviceStruct yaffs_Device; + +-/* The static layout of bllock usage etc is stored in the super block header */ ++/* The static layout of block usage etc is stored in the super block header */ + typedef struct { +- int StructType; ++ int StructType; + int version; + int checkpointStartBlock; + int checkpointEndBlock; +@@ -773,7 +784,7 @@ typedef struct { + * must be preserved over unmount/mount cycles. + */ + typedef struct { +- int structType; ++ int structType; + int nErasedBlocks; + int allocationBlock; /* Current block being allocated off */ + __u32 allocationPage; +@@ -791,57 +802,45 @@ typedef struct { + + + typedef struct { +- int structType; +- __u32 magic; +- __u32 version; +- __u32 head; ++ int structType; ++ __u32 magic; ++ __u32 version; ++ __u32 head; + } yaffs_CheckpointValidity; + +-/* Function to manipulate block info */ +-static Y_INLINE yaffs_BlockInfo *yaffs_GetBlockInfo(yaffs_Device * dev, int blk) +-{ +- if (blk < dev->internalStartBlock || blk > dev->internalEndBlock) { +- T(YAFFS_TRACE_ERROR, +- (TSTR +- ("**>> yaffs: getBlockInfo block %d is not valid" TENDSTR), +- blk)); +- YBUG(); +- } +- return &dev->blockInfo[blk - dev->internalStartBlock]; +-} + + /*----------------------- YAFFS Functions -----------------------*/ + +-int yaffs_GutsInitialise(yaffs_Device * dev); +-void yaffs_Deinitialise(yaffs_Device * dev); ++int yaffs_GutsInitialise(yaffs_Device *dev); ++void yaffs_Deinitialise(yaffs_Device *dev); + +-int yaffs_GetNumberOfFreeChunks(yaffs_Device * dev); ++int yaffs_GetNumberOfFreeChunks(yaffs_Device *dev); + +-int yaffs_RenameObject(yaffs_Object * oldDir, const YCHAR * oldName, +- yaffs_Object * newDir, const YCHAR * newName); ++int yaffs_RenameObject(yaffs_Object *oldDir, const YCHAR *oldName, ++ yaffs_Object *newDir, const YCHAR *newName); + +-int yaffs_Unlink(yaffs_Object * dir, const YCHAR * name); +-int yaffs_DeleteFile(yaffs_Object * obj); ++int yaffs_Unlink(yaffs_Object *dir, const YCHAR *name); ++int yaffs_DeleteObject(yaffs_Object *obj); + +-int yaffs_GetObjectName(yaffs_Object * obj, YCHAR * name, int buffSize); +-int yaffs_GetObjectFileLength(yaffs_Object * obj); +-int yaffs_GetObjectInode(yaffs_Object * obj); +-unsigned yaffs_GetObjectType(yaffs_Object * obj); +-int yaffs_GetObjectLinkCount(yaffs_Object * obj); ++int yaffs_GetObjectName(yaffs_Object *obj, YCHAR *name, int buffSize); ++int yaffs_GetObjectFileLength(yaffs_Object *obj); ++int yaffs_GetObjectInode(yaffs_Object *obj); ++unsigned yaffs_GetObjectType(yaffs_Object *obj); ++int yaffs_GetObjectLinkCount(yaffs_Object *obj); + +-int yaffs_SetAttributes(yaffs_Object * obj, struct iattr *attr); +-int yaffs_GetAttributes(yaffs_Object * obj, struct iattr *attr); ++int yaffs_SetAttributes(yaffs_Object *obj, struct iattr *attr); ++int yaffs_GetAttributes(yaffs_Object *obj, struct iattr *attr); + + /* File operations */ +-int yaffs_ReadDataFromFile(yaffs_Object * obj, __u8 * buffer, loff_t offset, +- int nBytes); +-int yaffs_WriteDataToFile(yaffs_Object * obj, const __u8 * buffer, loff_t offset, +- int nBytes, int writeThrough); +-int yaffs_ResizeFile(yaffs_Object * obj, loff_t newSize); +- +-yaffs_Object *yaffs_MknodFile(yaffs_Object * parent, const YCHAR * name, +- __u32 mode, __u32 uid, __u32 gid); +-int yaffs_FlushFile(yaffs_Object * obj, int updateTime); ++int yaffs_ReadDataFromFile(yaffs_Object *obj, __u8 *buffer, loff_t offset, ++ int nBytes); ++int yaffs_WriteDataToFile(yaffs_Object *obj, const __u8 *buffer, loff_t offset, ++ int nBytes, int writeThrough); ++int yaffs_ResizeFile(yaffs_Object *obj, loff_t newSize); ++ ++yaffs_Object *yaffs_MknodFile(yaffs_Object *parent, const YCHAR *name, ++ __u32 mode, __u32 uid, __u32 gid); ++int yaffs_FlushFile(yaffs_Object *obj, int updateTime); + + /* Flushing and checkpointing */ + void yaffs_FlushEntireDeviceCache(yaffs_Device *dev); +@@ -850,33 +849,33 @@ int yaffs_CheckpointSave(yaffs_Device *d + int yaffs_CheckpointRestore(yaffs_Device *dev); + + /* Directory operations */ +-yaffs_Object *yaffs_MknodDirectory(yaffs_Object * parent, const YCHAR * name, +- __u32 mode, __u32 uid, __u32 gid); +-yaffs_Object *yaffs_FindObjectByName(yaffs_Object * theDir, const YCHAR * name); +-int yaffs_ApplyToDirectoryChildren(yaffs_Object * theDir, ++yaffs_Object *yaffs_MknodDirectory(yaffs_Object *parent, const YCHAR *name, ++ __u32 mode, __u32 uid, __u32 gid); ++yaffs_Object *yaffs_FindObjectByName(yaffs_Object *theDir, const YCHAR *name); ++int yaffs_ApplyToDirectoryChildren(yaffs_Object *theDir, + int (*fn) (yaffs_Object *)); + +-yaffs_Object *yaffs_FindObjectByNumber(yaffs_Device * dev, __u32 number); ++yaffs_Object *yaffs_FindObjectByNumber(yaffs_Device *dev, __u32 number); + + /* Link operations */ +-yaffs_Object *yaffs_Link(yaffs_Object * parent, const YCHAR * name, +- yaffs_Object * equivalentObject); ++yaffs_Object *yaffs_Link(yaffs_Object *parent, const YCHAR *name, ++ yaffs_Object *equivalentObject); + +-yaffs_Object *yaffs_GetEquivalentObject(yaffs_Object * obj); ++yaffs_Object *yaffs_GetEquivalentObject(yaffs_Object *obj); + + /* Symlink operations */ +-yaffs_Object *yaffs_MknodSymLink(yaffs_Object * parent, const YCHAR * name, ++yaffs_Object *yaffs_MknodSymLink(yaffs_Object *parent, const YCHAR *name, + __u32 mode, __u32 uid, __u32 gid, +- const YCHAR * alias); +-YCHAR *yaffs_GetSymlinkAlias(yaffs_Object * obj); ++ const YCHAR *alias); ++YCHAR *yaffs_GetSymlinkAlias(yaffs_Object *obj); + + /* Special inodes (fifos, sockets and devices) */ +-yaffs_Object *yaffs_MknodSpecial(yaffs_Object * parent, const YCHAR * name, ++yaffs_Object *yaffs_MknodSpecial(yaffs_Object *parent, const YCHAR *name, + __u32 mode, __u32 uid, __u32 gid, __u32 rdev); + + /* Special directories */ +-yaffs_Object *yaffs_Root(yaffs_Device * dev); +-yaffs_Object *yaffs_LostNFound(yaffs_Device * dev); ++yaffs_Object *yaffs_Root(yaffs_Device *dev); ++yaffs_Object *yaffs_LostNFound(yaffs_Device *dev); + + #ifdef CONFIG_YAFFS_WINCE + /* CONFIG_YAFFS_WINCE special stuff */ +@@ -885,18 +884,21 @@ void yfsd_WinFileTimeNow(__u32 target[2] + + #ifdef __KERNEL__ + +-void yaffs_HandleDeferedFree(yaffs_Object * obj); ++void yaffs_HandleDeferedFree(yaffs_Object *obj); + #endif + + /* Debug dump */ +-int yaffs_DumpObject(yaffs_Object * obj); ++int yaffs_DumpObject(yaffs_Object *obj); + +-void yaffs_GutsTest(yaffs_Device * dev); ++void yaffs_GutsTest(yaffs_Device *dev); + + /* A few useful functions */ +-void yaffs_InitialiseTags(yaffs_ExtendedTags * tags); +-void yaffs_DeleteChunk(yaffs_Device * dev, int chunkId, int markNAND, int lyn); +-int yaffs_CheckFF(__u8 * buffer, int nBytes); ++void yaffs_InitialiseTags(yaffs_ExtendedTags *tags); ++void yaffs_DeleteChunk(yaffs_Device *dev, int chunkId, int markNAND, int lyn); ++int yaffs_CheckFF(__u8 *buffer, int nBytes); + void yaffs_HandleChunkError(yaffs_Device *dev, yaffs_BlockInfo *bi); + ++__u8 *yaffs_GetTempBuffer(yaffs_Device *dev, int lineNo); ++void yaffs_ReleaseTempBuffer(yaffs_Device *dev, __u8 *buffer, int lineNo); ++ + #endif +--- a/fs/yaffs2/yaffs_mtdif1.c ++++ b/fs/yaffs2/yaffs_mtdif1.c +@@ -26,7 +26,7 @@ + #include "yportenv.h" + #include "yaffs_guts.h" + #include "yaffs_packedtags1.h" +-#include "yaffs_tagscompat.h" // for yaffs_CalcTagsECC ++#include "yaffs_tagscompat.h" /* for yaffs_CalcTagsECC */ + + #include "linux/kernel.h" + #include "linux/version.h" +@@ -34,9 +34,9 @@ + #include "linux/mtd/mtd.h" + + /* Don't compile this module if we don't have MTD's mtd_oob_ops interface */ +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) ++#if (MTD_VERSION_CODE > MTD_VERSION(2, 6, 17)) + +-const char *yaffs_mtdif1_c_version = "$Id: yaffs_mtdif1.c,v 1.3 2007/05/15 20:16:11 ian Exp $"; ++const char *yaffs_mtdif1_c_version = "$Id: yaffs_mtdif1.c,v 1.10 2009-03-09 07:41:10 charles Exp $"; + + #ifndef CONFIG_YAFFS_9BYTE_TAGS + # define YTAG1_SIZE 8 +@@ -89,9 +89,9 @@ static struct nand_ecclayout nand_oob_16 + * Returns YAFFS_OK or YAFFS_FAIL. + */ + int nandmtd1_WriteChunkWithTagsToNAND(yaffs_Device *dev, +- int chunkInNAND, const __u8 * data, const yaffs_ExtendedTags * etags) ++ int chunkInNAND, const __u8 *data, const yaffs_ExtendedTags *etags) + { +- struct mtd_info * mtd = dev->genericDevice; ++ struct mtd_info *mtd = dev->genericDevice; + int chunkBytes = dev->nDataBytesPerChunk; + loff_t addr = ((loff_t)chunkInNAND) * chunkBytes; + struct mtd_oob_ops ops; +@@ -146,7 +146,7 @@ int nandmtd1_WriteChunkWithTagsToNAND(ya + + /* Return with empty ExtendedTags but add eccResult. + */ +-static int rettags(yaffs_ExtendedTags * etags, int eccResult, int retval) ++static int rettags(yaffs_ExtendedTags *etags, int eccResult, int retval) + { + if (etags) { + memset(etags, 0, sizeof(*etags)); +@@ -169,9 +169,9 @@ static int rettags(yaffs_ExtendedTags * + * Returns YAFFS_OK or YAFFS_FAIL. + */ + int nandmtd1_ReadChunkWithTagsFromNAND(yaffs_Device *dev, +- int chunkInNAND, __u8 * data, yaffs_ExtendedTags * etags) ++ int chunkInNAND, __u8 *data, yaffs_ExtendedTags *etags) + { +- struct mtd_info * mtd = dev->genericDevice; ++ struct mtd_info *mtd = dev->genericDevice; + int chunkBytes = dev->nDataBytesPerChunk; + loff_t addr = ((loff_t)chunkInNAND) * chunkBytes; + int eccres = YAFFS_ECC_RESULT_NO_ERROR; +@@ -189,7 +189,7 @@ int nandmtd1_ReadChunkWithTagsFromNAND(y + ops.datbuf = data; + ops.oobbuf = (__u8 *)&pt1; + +-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) ++#if (MTD_VERSION_CODE < MTD_VERSION(2, 6, 20)) + /* In MTD 2.6.18 to 2.6.19 nand_base.c:nand_do_read_oob() has a bug; + * help it out with ops.len = ops.ooblen when ops.datbuf == NULL. + */ +@@ -284,11 +284,11 @@ int nandmtd1_ReadChunkWithTagsFromNAND(y + */ + int nandmtd1_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo) + { +- struct mtd_info * mtd = dev->genericDevice; ++ struct mtd_info *mtd = dev->genericDevice; + int blocksize = dev->nChunksPerBlock * dev->nDataBytesPerChunk; + int retval; + +- yaffs_trace(YAFFS_TRACE_BAD_BLOCKS, "marking block %d bad", blockNo); ++ yaffs_trace(YAFFS_TRACE_BAD_BLOCKS, "marking block %d bad\n", blockNo); + + retval = mtd->block_markbad(mtd, (loff_t)blocksize * blockNo); + return (retval) ? YAFFS_FAIL : YAFFS_OK; +@@ -298,7 +298,7 @@ int nandmtd1_MarkNANDBlockBad(struct yaf + * + * Returns YAFFS_OK or YAFFS_FAIL. + */ +-static int nandmtd1_TestPrerequists(struct mtd_info * mtd) ++static int nandmtd1_TestPrerequists(struct mtd_info *mtd) + { + /* 2.6.18 has mtd->ecclayout->oobavail */ + /* 2.6.21 has mtd->ecclayout->oobavail and mtd->oobavail */ +@@ -323,10 +323,11 @@ static int nandmtd1_TestPrerequists(stru + * Always returns YAFFS_OK. + */ + int nandmtd1_QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockNo, +- yaffs_BlockState * pState, int *pSequenceNumber) ++ yaffs_BlockState *pState, __u32 *pSequenceNumber) + { +- struct mtd_info * mtd = dev->genericDevice; ++ struct mtd_info *mtd = dev->genericDevice; + int chunkNo = blockNo * dev->nChunksPerBlock; ++ loff_t addr = (loff_t)chunkNo * dev->nDataBytesPerChunk; + yaffs_ExtendedTags etags; + int state = YAFFS_BLOCK_STATE_DEAD; + int seqnum = 0; +@@ -335,21 +336,22 @@ int nandmtd1_QueryNANDBlock(struct yaffs + /* We don't yet have a good place to test for MTD config prerequists. + * Do it here as we are called during the initial scan. + */ +- if (nandmtd1_TestPrerequists(mtd) != YAFFS_OK) { ++ if (nandmtd1_TestPrerequists(mtd) != YAFFS_OK) + return YAFFS_FAIL; +- } + + retval = nandmtd1_ReadChunkWithTagsFromNAND(dev, chunkNo, NULL, &etags); ++ etags.blockBad = (mtd->block_isbad)(mtd, addr); + if (etags.blockBad) { + yaffs_trace(YAFFS_TRACE_BAD_BLOCKS, +- "block %d is marked bad", blockNo); ++ "block %d is marked bad\n", blockNo); + state = YAFFS_BLOCK_STATE_DEAD; +- } +- else if (etags.chunkUsed) { ++ } else if (etags.eccResult != YAFFS_ECC_RESULT_NO_ERROR) { ++ /* bad tags, need to look more closely */ ++ state = YAFFS_BLOCK_STATE_NEEDS_SCANNING; ++ } else if (etags.chunkUsed) { + state = YAFFS_BLOCK_STATE_NEEDS_SCANNING; + seqnum = etags.sequenceNumber; +- } +- else { ++ } else { + state = YAFFS_BLOCK_STATE_EMPTY; + } + +@@ -360,4 +362,4 @@ int nandmtd1_QueryNANDBlock(struct yaffs + return YAFFS_OK; + } + +-#endif /*KERNEL_VERSION*/ ++#endif /*MTD_VERSION*/ +--- a/fs/yaffs2/yaffs_mtdif1.h ++++ b/fs/yaffs2/yaffs_mtdif1.h +@@ -14,15 +14,15 @@ + #ifndef __YAFFS_MTDIF1_H__ + #define __YAFFS_MTDIF1_H__ + +-int nandmtd1_WriteChunkWithTagsToNAND(yaffs_Device * dev, int chunkInNAND, +- const __u8 * data, const yaffs_ExtendedTags * tags); ++int nandmtd1_WriteChunkWithTagsToNAND(yaffs_Device *dev, int chunkInNAND, ++ const __u8 *data, const yaffs_ExtendedTags *tags); + +-int nandmtd1_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND, +- __u8 * data, yaffs_ExtendedTags * tags); ++int nandmtd1_ReadChunkWithTagsFromNAND(yaffs_Device *dev, int chunkInNAND, ++ __u8 *data, yaffs_ExtendedTags *tags); + + int nandmtd1_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo); + + int nandmtd1_QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockNo, +- yaffs_BlockState * state, int *sequenceNumber); ++ yaffs_BlockState *state, __u32 *sequenceNumber); + + #endif +--- a/fs/yaffs2/yaffs_mtdif2.c ++++ b/fs/yaffs2/yaffs_mtdif2.c +@@ -14,7 +14,7 @@ + /* mtd interface for YAFFS2 */ + + const char *yaffs_mtdif2_c_version = +- "$Id: yaffs_mtdif2.c,v 1.17 2007-02-14 01:09:06 wookey Exp $"; ++ "$Id: yaffs_mtdif2.c,v 1.23 2009-03-06 17:20:53 wookey Exp $"; + + #include "yportenv.h" + +@@ -27,19 +27,23 @@ const char *yaffs_mtdif2_c_version = + + #include "yaffs_packedtags2.h" + +-int nandmtd2_WriteChunkWithTagsToNAND(yaffs_Device * dev, int chunkInNAND, +- const __u8 * data, +- const yaffs_ExtendedTags * tags) ++/* NB For use with inband tags.... ++ * We assume that the data buffer is of size totalBytersPerChunk so that we can also ++ * use it to load the tags. ++ */ ++int nandmtd2_WriteChunkWithTagsToNAND(yaffs_Device *dev, int chunkInNAND, ++ const __u8 *data, ++ const yaffs_ExtendedTags *tags) + { + struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice); +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) ++#if (MTD_VERSION_CODE > MTD_VERSION(2, 6, 17)) + struct mtd_oob_ops ops; + #else + size_t dummy; + #endif + int retval = 0; + +- loff_t addr = ((loff_t) chunkInNAND) * dev->nDataBytesPerChunk; ++ loff_t addr; + + yaffs_PackedTags2 pt; + +@@ -48,46 +52,40 @@ int nandmtd2_WriteChunkWithTagsToNAND(ya + ("nandmtd2_WriteChunkWithTagsToNAND chunk %d data %p tags %p" + TENDSTR), chunkInNAND, data, tags)); + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) +- if (tags) +- yaffs_PackTags2(&pt, tags); +- else +- BUG(); /* both tags and data should always be present */ + +- if (data) { +- ops.mode = MTD_OOB_AUTO; +- ops.ooblen = sizeof(pt); +- ops.len = dev->nDataBytesPerChunk; +- ops.ooboffs = 0; +- ops.datbuf = (__u8 *)data; +- ops.oobbuf = (void *)&pt; +- retval = mtd->write_oob(mtd, addr, &ops); ++ addr = ((loff_t) chunkInNAND) * dev->totalBytesPerChunk; ++ ++ /* For yaffs2 writing there must be both data and tags. ++ * If we're using inband tags, then the tags are stuffed into ++ * the end of the data buffer. ++ */ ++ if (!data || !tags) ++ BUG(); ++ else if (dev->inbandTags) { ++ yaffs_PackedTags2TagsPart *pt2tp; ++ pt2tp = (yaffs_PackedTags2TagsPart *)(data + dev->nDataBytesPerChunk); ++ yaffs_PackTags2TagsPart(pt2tp, tags); + } else +- BUG(); /* both tags and data should always be present */ +-#else +- if (tags) { + yaffs_PackTags2(&pt, tags); +- } + +- if (data && tags) { +- if (dev->useNANDECC) +- retval = +- mtd->write_ecc(mtd, addr, dev->nDataBytesPerChunk, +- &dummy, data, (__u8 *) & pt, NULL); +- else +- retval = +- mtd->write_ecc(mtd, addr, dev->nDataBytesPerChunk, +- &dummy, data, (__u8 *) & pt, NULL); +- } else { +- if (data) +- retval = +- mtd->write(mtd, addr, dev->nDataBytesPerChunk, &dummy, +- data); +- if (tags) +- retval = +- mtd->write_oob(mtd, addr, mtd->oobsize, &dummy, +- (__u8 *) & pt); ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) ++ ops.mode = MTD_OOB_AUTO; ++ ops.ooblen = (dev->inbandTags) ? 0 : sizeof(pt); ++ ops.len = dev->totalBytesPerChunk; ++ ops.ooboffs = 0; ++ ops.datbuf = (__u8 *)data; ++ ops.oobbuf = (dev->inbandTags) ? NULL : (void *)&pt; ++ retval = mtd->write_oob(mtd, addr, &ops); + ++#else ++ if (!dev->inbandTags) { ++ retval = ++ mtd->write_ecc(mtd, addr, dev->nDataBytesPerChunk, ++ &dummy, data, (__u8 *) &pt, NULL); ++ } else { ++ retval = ++ mtd->write(mtd, addr, dev->totalBytesPerChunk, &dummy, ++ data); + } + #endif + +@@ -97,17 +95,18 @@ int nandmtd2_WriteChunkWithTagsToNAND(ya + return YAFFS_FAIL; + } + +-int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND, +- __u8 * data, yaffs_ExtendedTags * tags) ++int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_Device *dev, int chunkInNAND, ++ __u8 *data, yaffs_ExtendedTags *tags) + { + struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice); +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) ++#if (MTD_VERSION_CODE > MTD_VERSION(2, 6, 17)) + struct mtd_oob_ops ops; + #endif + size_t dummy; + int retval = 0; ++ int localData = 0; + +- loff_t addr = ((loff_t) chunkInNAND) * dev->nDataBytesPerChunk; ++ loff_t addr = ((loff_t) chunkInNAND) * dev->totalBytesPerChunk; + + yaffs_PackedTags2 pt; + +@@ -116,9 +115,20 @@ int nandmtd2_ReadChunkWithTagsFromNAND(y + ("nandmtd2_ReadChunkWithTagsFromNAND chunk %d data %p tags %p" + TENDSTR), chunkInNAND, data, tags)); + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) +- if (data && !tags) +- retval = mtd->read(mtd, addr, dev->nDataBytesPerChunk, ++ if (dev->inbandTags) { ++ ++ if (!data) { ++ localData = 1; ++ data = yaffs_GetTempBuffer(dev, __LINE__); ++ } ++ ++ ++ } ++ ++ ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) ++ if (dev->inbandTags || (data && !tags)) ++ retval = mtd->read(mtd, addr, dev->totalBytesPerChunk, + &dummy, data); + else if (tags) { + ops.mode = MTD_OOB_AUTO; +@@ -130,38 +140,42 @@ int nandmtd2_ReadChunkWithTagsFromNAND(y + retval = mtd->read_oob(mtd, addr, &ops); + } + #else +- if (data && tags) { +- if (dev->useNANDECC) { +- retval = +- mtd->read_ecc(mtd, addr, dev->nDataBytesPerChunk, +- &dummy, data, dev->spareBuffer, +- NULL); +- } else { +- retval = +- mtd->read_ecc(mtd, addr, dev->nDataBytesPerChunk, ++ if (!dev->inbandTags && data && tags) { ++ ++ retval = mtd->read_ecc(mtd, addr, dev->nDataBytesPerChunk, + &dummy, data, dev->spareBuffer, + NULL); +- } + } else { + if (data) + retval = + mtd->read(mtd, addr, dev->nDataBytesPerChunk, &dummy, + data); +- if (tags) ++ if (!dev->inbandTags && tags) + retval = + mtd->read_oob(mtd, addr, mtd->oobsize, &dummy, + dev->spareBuffer); + } + #endif + +- memcpy(&pt, dev->spareBuffer, sizeof(pt)); + +- if (tags) +- yaffs_UnpackTags2(tags, &pt); ++ if (dev->inbandTags) { ++ if (tags) { ++ yaffs_PackedTags2TagsPart *pt2tp; ++ pt2tp = (yaffs_PackedTags2TagsPart *)&data[dev->nDataBytesPerChunk]; ++ yaffs_UnpackTags2TagsPart(tags, pt2tp); ++ } ++ } else { ++ if (tags) { ++ memcpy(&pt, dev->spareBuffer, sizeof(pt)); ++ yaffs_UnpackTags2(tags, &pt); ++ } ++ } + +- if(tags && retval == -EBADMSG && tags->eccResult == YAFFS_ECC_RESULT_NO_ERROR) +- tags->eccResult = YAFFS_ECC_RESULT_UNFIXED; ++ if (localData) ++ yaffs_ReleaseTempBuffer(dev, data, __LINE__); + ++ if (tags && retval == -EBADMSG && tags->eccResult == YAFFS_ECC_RESULT_NO_ERROR) ++ tags->eccResult = YAFFS_ECC_RESULT_UNFIXED; + if (retval == 0) + return YAFFS_OK; + else +@@ -178,7 +192,7 @@ int nandmtd2_MarkNANDBlockBad(struct yaf + retval = + mtd->block_markbad(mtd, + blockNo * dev->nChunksPerBlock * +- dev->nDataBytesPerChunk); ++ dev->totalBytesPerChunk); + + if (retval == 0) + return YAFFS_OK; +@@ -188,7 +202,7 @@ int nandmtd2_MarkNANDBlockBad(struct yaf + } + + int nandmtd2_QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockNo, +- yaffs_BlockState * state, int *sequenceNumber) ++ yaffs_BlockState *state, __u32 *sequenceNumber) + { + struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice); + int retval; +@@ -198,7 +212,7 @@ int nandmtd2_QueryNANDBlock(struct yaffs + retval = + mtd->block_isbad(mtd, + blockNo * dev->nChunksPerBlock * +- dev->nDataBytesPerChunk); ++ dev->totalBytesPerChunk); + + if (retval) { + T(YAFFS_TRACE_MTD, (TSTR("block is bad" TENDSTR))); +--- a/fs/yaffs2/yaffs_mtdif2.h ++++ b/fs/yaffs2/yaffs_mtdif2.h +@@ -17,13 +17,13 @@ + #define __YAFFS_MTDIF2_H__ + + #include "yaffs_guts.h" +-int nandmtd2_WriteChunkWithTagsToNAND(yaffs_Device * dev, int chunkInNAND, +- const __u8 * data, +- const yaffs_ExtendedTags * tags); +-int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND, +- __u8 * data, yaffs_ExtendedTags * tags); ++int nandmtd2_WriteChunkWithTagsToNAND(yaffs_Device *dev, int chunkInNAND, ++ const __u8 *data, ++ const yaffs_ExtendedTags *tags); ++int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_Device *dev, int chunkInNAND, ++ __u8 *data, yaffs_ExtendedTags *tags); + int nandmtd2_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo); + int nandmtd2_QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockNo, +- yaffs_BlockState * state, int *sequenceNumber); ++ yaffs_BlockState *state, __u32 *sequenceNumber); + + #endif +--- a/fs/yaffs2/yaffs_mtdif.c ++++ b/fs/yaffs2/yaffs_mtdif.c +@@ -12,7 +12,7 @@ + */ + + const char *yaffs_mtdif_c_version = +- "$Id: yaffs_mtdif.c,v 1.19 2007-02-14 01:09:06 wookey Exp $"; ++ "$Id: yaffs_mtdif.c,v 1.22 2009-03-06 17:20:51 wookey Exp $"; + + #include "yportenv.h" + +@@ -24,7 +24,7 @@ const char *yaffs_mtdif_c_version = + #include "linux/time.h" + #include "linux/mtd/nand.h" + +-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) ++#if (MTD_VERSION_CODE < MTD_VERSION(2, 6, 18)) + static struct nand_oobinfo yaffs_oobinfo = { + .useecc = 1, + .eccbytes = 6, +@@ -36,7 +36,7 @@ static struct nand_oobinfo yaffs_noeccin + }; + #endif + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) ++#if (MTD_VERSION_CODE > MTD_VERSION(2, 6, 17)) + static inline void translate_spare2oob(const yaffs_Spare *spare, __u8 *oob) + { + oob[0] = spare->tagByte0; +@@ -45,8 +45,8 @@ static inline void translate_spare2oob(c + oob[3] = spare->tagByte3; + oob[4] = spare->tagByte4; + oob[5] = spare->tagByte5 & 0x3f; +- oob[5] |= spare->blockStatus == 'Y' ? 0: 0x80; +- oob[5] |= spare->pageStatus == 0 ? 0: 0x40; ++ oob[5] |= spare->blockStatus == 'Y' ? 0 : 0x80; ++ oob[5] |= spare->pageStatus == 0 ? 0 : 0x40; + oob[6] = spare->tagByte6; + oob[7] = spare->tagByte7; + } +@@ -71,18 +71,18 @@ static inline void translate_oob2spare(y + } + #endif + +-int nandmtd_WriteChunkToNAND(yaffs_Device * dev, int chunkInNAND, +- const __u8 * data, const yaffs_Spare * spare) ++int nandmtd_WriteChunkToNAND(yaffs_Device *dev, int chunkInNAND, ++ const __u8 *data, const yaffs_Spare *spare) + { + struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice); +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) ++#if (MTD_VERSION_CODE > MTD_VERSION(2, 6, 17)) + struct mtd_oob_ops ops; + #endif + size_t dummy; + int retval = 0; + + loff_t addr = ((loff_t) chunkInNAND) * dev->nDataBytesPerChunk; +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) ++#if (MTD_VERSION_CODE > MTD_VERSION(2, 6, 17)) + __u8 spareAsBytes[8]; /* OOB */ + + if (data && !spare) +@@ -135,18 +135,18 @@ int nandmtd_WriteChunkToNAND(yaffs_Devic + return YAFFS_FAIL; + } + +-int nandmtd_ReadChunkFromNAND(yaffs_Device * dev, int chunkInNAND, __u8 * data, +- yaffs_Spare * spare) ++int nandmtd_ReadChunkFromNAND(yaffs_Device *dev, int chunkInNAND, __u8 *data, ++ yaffs_Spare *spare) + { + struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice); +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) ++#if (MTD_VERSION_CODE > MTD_VERSION(2, 6, 17)) + struct mtd_oob_ops ops; + #endif + size_t dummy; + int retval = 0; + + loff_t addr = ((loff_t) chunkInNAND) * dev->nDataBytesPerChunk; +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) ++#if (MTD_VERSION_CODE > MTD_VERSION(2, 6, 17)) + __u8 spareAsBytes[8]; /* OOB */ + + if (data && !spare) +@@ -205,7 +205,7 @@ int nandmtd_ReadChunkFromNAND(yaffs_Devi + return YAFFS_FAIL; + } + +-int nandmtd_EraseBlockInNAND(yaffs_Device * dev, int blockNumber) ++int nandmtd_EraseBlockInNAND(yaffs_Device *dev, int blockNumber) + { + struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice); + __u32 addr = +@@ -234,7 +234,7 @@ int nandmtd_EraseBlockInNAND(yaffs_Devic + return YAFFS_FAIL; + } + +-int nandmtd_InitialiseNAND(yaffs_Device * dev) ++int nandmtd_InitialiseNAND(yaffs_Device *dev) + { + return YAFFS_OK; + } +--- a/fs/yaffs2/yaffs_mtdif.h ++++ b/fs/yaffs2/yaffs_mtdif.h +@@ -18,10 +18,15 @@ + + #include "yaffs_guts.h" + +-int nandmtd_WriteChunkToNAND(yaffs_Device * dev, int chunkInNAND, +- const __u8 * data, const yaffs_Spare * spare); +-int nandmtd_ReadChunkFromNAND(yaffs_Device * dev, int chunkInNAND, __u8 * data, +- yaffs_Spare * spare); +-int nandmtd_EraseBlockInNAND(yaffs_Device * dev, int blockNumber); +-int nandmtd_InitialiseNAND(yaffs_Device * dev); ++#if (MTD_VERSION_CODE < MTD_VERSION(2, 6, 18)) ++extern struct nand_oobinfo yaffs_oobinfo; ++extern struct nand_oobinfo yaffs_noeccinfo; ++#endif ++ ++int nandmtd_WriteChunkToNAND(yaffs_Device *dev, int chunkInNAND, ++ const __u8 *data, const yaffs_Spare *spare); ++int nandmtd_ReadChunkFromNAND(yaffs_Device *dev, int chunkInNAND, __u8 *data, ++ yaffs_Spare *spare); ++int nandmtd_EraseBlockInNAND(yaffs_Device *dev, int blockNumber); ++int nandmtd_InitialiseNAND(yaffs_Device *dev); + #endif +--- a/fs/yaffs2/yaffs_nand.c ++++ b/fs/yaffs2/yaffs_nand.c +@@ -12,16 +12,17 @@ + */ + + const char *yaffs_nand_c_version = +- "$Id: yaffs_nand.c,v 1.7 2007-02-14 01:09:06 wookey Exp $"; ++ "$Id: yaffs_nand.c,v 1.10 2009-03-06 17:20:54 wookey Exp $"; + + #include "yaffs_nand.h" + #include "yaffs_tagscompat.h" + #include "yaffs_tagsvalidity.h" + ++#include "yaffs_getblockinfo.h" + +-int yaffs_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND, +- __u8 * buffer, +- yaffs_ExtendedTags * tags) ++int yaffs_ReadChunkWithTagsFromNAND(yaffs_Device *dev, int chunkInNAND, ++ __u8 *buffer, ++ yaffs_ExtendedTags *tags) + { + int result; + yaffs_ExtendedTags localTags; +@@ -29,7 +30,7 @@ int yaffs_ReadChunkWithTagsFromNAND(yaff + int realignedChunkInNAND = chunkInNAND - dev->chunkOffset; + + /* If there are no tags provided, use local tags to get prioritised gc working */ +- if(!tags) ++ if (!tags) + tags = &localTags; + + if (dev->readChunkWithTagsFromNAND) +@@ -40,20 +41,20 @@ int yaffs_ReadChunkWithTagsFromNAND(yaff + realignedChunkInNAND, + buffer, + tags); +- if(tags && +- tags->eccResult > YAFFS_ECC_RESULT_NO_ERROR){ ++ if (tags && ++ tags->eccResult > YAFFS_ECC_RESULT_NO_ERROR) { + + yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev, chunkInNAND/dev->nChunksPerBlock); +- yaffs_HandleChunkError(dev,bi); ++ yaffs_HandleChunkError(dev, bi); + } + + return result; + } + +-int yaffs_WriteChunkWithTagsToNAND(yaffs_Device * dev, ++int yaffs_WriteChunkWithTagsToNAND(yaffs_Device *dev, + int chunkInNAND, +- const __u8 * buffer, +- yaffs_ExtendedTags * tags) ++ const __u8 *buffer, ++ yaffs_ExtendedTags *tags) + { + chunkInNAND -= dev->chunkOffset; + +@@ -84,7 +85,7 @@ int yaffs_WriteChunkWithTagsToNAND(yaffs + tags); + } + +-int yaffs_MarkBlockBad(yaffs_Device * dev, int blockNo) ++int yaffs_MarkBlockBad(yaffs_Device *dev, int blockNo) + { + blockNo -= dev->blockOffset; + +@@ -95,10 +96,10 @@ int yaffs_MarkBlockBad(yaffs_Device * de + return yaffs_TagsCompatabilityMarkNANDBlockBad(dev, blockNo); + } + +-int yaffs_QueryInitialBlockState(yaffs_Device * dev, ++int yaffs_QueryInitialBlockState(yaffs_Device *dev, + int blockNo, +- yaffs_BlockState * state, +- unsigned *sequenceNumber) ++ yaffs_BlockState *state, ++ __u32 *sequenceNumber) + { + blockNo -= dev->blockOffset; + +--- a/fs/yaffs2/yaffs_nandemul2k.h ++++ b/fs/yaffs2/yaffs_nandemul2k.h +@@ -21,14 +21,14 @@ + #include "yaffs_guts.h" + + int nandemul2k_WriteChunkWithTagsToNAND(struct yaffs_DeviceStruct *dev, +- int chunkInNAND, const __u8 * data, +- yaffs_ExtendedTags * tags); ++ int chunkInNAND, const __u8 *data, ++ const yaffs_ExtendedTags *tags); + int nandemul2k_ReadChunkWithTagsFromNAND(struct yaffs_DeviceStruct *dev, +- int chunkInNAND, __u8 * data, +- yaffs_ExtendedTags * tags); ++ int chunkInNAND, __u8 *data, ++ yaffs_ExtendedTags *tags); + int nandemul2k_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo); + int nandemul2k_QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockNo, +- yaffs_BlockState * state, int *sequenceNumber); ++ yaffs_BlockState *state, __u32 *sequenceNumber); + int nandemul2k_EraseBlockInNAND(struct yaffs_DeviceStruct *dev, + int blockInNAND); + int nandemul2k_InitialiseNAND(struct yaffs_DeviceStruct *dev); +--- a/fs/yaffs2/yaffs_nand.h ++++ b/fs/yaffs2/yaffs_nand.h +@@ -19,21 +19,21 @@ + + + +-int yaffs_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND, +- __u8 * buffer, +- yaffs_ExtendedTags * tags); +- +-int yaffs_WriteChunkWithTagsToNAND(yaffs_Device * dev, +- int chunkInNAND, +- const __u8 * buffer, +- yaffs_ExtendedTags * tags); +- +-int yaffs_MarkBlockBad(yaffs_Device * dev, int blockNo); +- +-int yaffs_QueryInitialBlockState(yaffs_Device * dev, +- int blockNo, +- yaffs_BlockState * state, +- unsigned *sequenceNumber); ++int yaffs_ReadChunkWithTagsFromNAND(yaffs_Device *dev, int chunkInNAND, ++ __u8 *buffer, ++ yaffs_ExtendedTags *tags); ++ ++int yaffs_WriteChunkWithTagsToNAND(yaffs_Device *dev, ++ int chunkInNAND, ++ const __u8 *buffer, ++ yaffs_ExtendedTags *tags); ++ ++int yaffs_MarkBlockBad(yaffs_Device *dev, int blockNo); ++ ++int yaffs_QueryInitialBlockState(yaffs_Device *dev, ++ int blockNo, ++ yaffs_BlockState *state, ++ unsigned *sequenceNumber); + + int yaffs_EraseBlockInNAND(struct yaffs_DeviceStruct *dev, + int blockInNAND); +--- a/fs/yaffs2/yaffs_packedtags1.c ++++ b/fs/yaffs2/yaffs_packedtags1.c +@@ -14,7 +14,7 @@ + #include "yaffs_packedtags1.h" + #include "yportenv.h" + +-void yaffs_PackTags1(yaffs_PackedTags1 * pt, const yaffs_ExtendedTags * t) ++void yaffs_PackTags1(yaffs_PackedTags1 *pt, const yaffs_ExtendedTags *t) + { + pt->chunkId = t->chunkId; + pt->serialNumber = t->serialNumber; +@@ -27,7 +27,7 @@ void yaffs_PackTags1(yaffs_PackedTags1 * + + } + +-void yaffs_UnpackTags1(yaffs_ExtendedTags * t, const yaffs_PackedTags1 * pt) ++void yaffs_UnpackTags1(yaffs_ExtendedTags *t, const yaffs_PackedTags1 *pt) + { + static const __u8 allFF[] = + { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +@@ -35,9 +35,8 @@ void yaffs_UnpackTags1(yaffs_ExtendedTag + + if (memcmp(allFF, pt, sizeof(yaffs_PackedTags1))) { + t->blockBad = 0; +- if (pt->shouldBeFF != 0xFFFFFFFF) { ++ if (pt->shouldBeFF != 0xFFFFFFFF) + t->blockBad = 1; +- } + t->chunkUsed = 1; + t->objectId = pt->objectId; + t->chunkId = pt->chunkId; +@@ -47,6 +46,5 @@ void yaffs_UnpackTags1(yaffs_ExtendedTag + t->serialNumber = pt->serialNumber; + } else { + memset(t, 0, sizeof(yaffs_ExtendedTags)); +- + } + } +--- a/fs/yaffs2/yaffs_packedtags1.h ++++ b/fs/yaffs2/yaffs_packedtags1.h +@@ -32,6 +32,6 @@ typedef struct { + + } yaffs_PackedTags1; + +-void yaffs_PackTags1(yaffs_PackedTags1 * pt, const yaffs_ExtendedTags * t); +-void yaffs_UnpackTags1(yaffs_ExtendedTags * t, const yaffs_PackedTags1 * pt); ++void yaffs_PackTags1(yaffs_PackedTags1 *pt, const yaffs_ExtendedTags *t); ++void yaffs_UnpackTags1(yaffs_ExtendedTags *t, const yaffs_PackedTags1 *pt); + #endif +--- a/fs/yaffs2/yaffs_packedtags2.c ++++ b/fs/yaffs2/yaffs_packedtags2.c +@@ -37,60 +37,68 @@ + #define EXTRA_OBJECT_TYPE_SHIFT (28) + #define EXTRA_OBJECT_TYPE_MASK ((0x0F) << EXTRA_OBJECT_TYPE_SHIFT) + +-static void yaffs_DumpPackedTags2(const yaffs_PackedTags2 * pt) ++ ++static void yaffs_DumpPackedTags2TagsPart(const yaffs_PackedTags2TagsPart *ptt) + { + T(YAFFS_TRACE_MTD, + (TSTR("packed tags obj %d chunk %d byte %d seq %d" TENDSTR), +- pt->t.objectId, pt->t.chunkId, pt->t.byteCount, +- pt->t.sequenceNumber)); ++ ptt->objectId, ptt->chunkId, ptt->byteCount, ++ ptt->sequenceNumber)); ++} ++static void yaffs_DumpPackedTags2(const yaffs_PackedTags2 *pt) ++{ ++ yaffs_DumpPackedTags2TagsPart(&pt->t); + } + +-static void yaffs_DumpTags2(const yaffs_ExtendedTags * t) ++static void yaffs_DumpTags2(const yaffs_ExtendedTags *t) + { + T(YAFFS_TRACE_MTD, + (TSTR +- ("ext.tags eccres %d blkbad %d chused %d obj %d chunk%d byte " +- "%d del %d ser %d seq %d" ++ ("ext.tags eccres %d blkbad %d chused %d obj %d chunk%d byte %d del %d ser %d seq %d" + TENDSTR), t->eccResult, t->blockBad, t->chunkUsed, t->objectId, + t->chunkId, t->byteCount, t->chunkDeleted, t->serialNumber, + t->sequenceNumber)); + + } + +-void yaffs_PackTags2(yaffs_PackedTags2 * pt, const yaffs_ExtendedTags * t) ++void yaffs_PackTags2TagsPart(yaffs_PackedTags2TagsPart *ptt, ++ const yaffs_ExtendedTags *t) + { +- pt->t.chunkId = t->chunkId; +- pt->t.sequenceNumber = t->sequenceNumber; +- pt->t.byteCount = t->byteCount; +- pt->t.objectId = t->objectId; ++ ptt->chunkId = t->chunkId; ++ ptt->sequenceNumber = t->sequenceNumber; ++ ptt->byteCount = t->byteCount; ++ ptt->objectId = t->objectId; + + if (t->chunkId == 0 && t->extraHeaderInfoAvailable) { + /* Store the extra header info instead */ + /* We save the parent object in the chunkId */ +- pt->t.chunkId = EXTRA_HEADER_INFO_FLAG ++ ptt->chunkId = EXTRA_HEADER_INFO_FLAG + | t->extraParentObjectId; +- if (t->extraIsShrinkHeader) { +- pt->t.chunkId |= EXTRA_SHRINK_FLAG; +- } +- if (t->extraShadows) { +- pt->t.chunkId |= EXTRA_SHADOWS_FLAG; +- } ++ if (t->extraIsShrinkHeader) ++ ptt->chunkId |= EXTRA_SHRINK_FLAG; ++ if (t->extraShadows) ++ ptt->chunkId |= EXTRA_SHADOWS_FLAG; + +- pt->t.objectId &= ~EXTRA_OBJECT_TYPE_MASK; +- pt->t.objectId |= ++ ptt->objectId &= ~EXTRA_OBJECT_TYPE_MASK; ++ ptt->objectId |= + (t->extraObjectType << EXTRA_OBJECT_TYPE_SHIFT); + +- if (t->extraObjectType == YAFFS_OBJECT_TYPE_HARDLINK) { +- pt->t.byteCount = t->extraEquivalentObjectId; +- } else if (t->extraObjectType == YAFFS_OBJECT_TYPE_FILE) { +- pt->t.byteCount = t->extraFileLength; +- } else { +- pt->t.byteCount = 0; +- } ++ if (t->extraObjectType == YAFFS_OBJECT_TYPE_HARDLINK) ++ ptt->byteCount = t->extraEquivalentObjectId; ++ else if (t->extraObjectType == YAFFS_OBJECT_TYPE_FILE) ++ ptt->byteCount = t->extraFileLength; ++ else ++ ptt->byteCount = 0; + } + +- yaffs_DumpPackedTags2(pt); ++ yaffs_DumpPackedTags2TagsPart(ptt); + yaffs_DumpTags2(t); ++} ++ ++ ++void yaffs_PackTags2(yaffs_PackedTags2 *pt, const yaffs_ExtendedTags *t) ++{ ++ yaffs_PackTags2TagsPart(&pt->t, t); + + #ifndef YAFFS_IGNORE_TAGS_ECC + { +@@ -101,82 +109,98 @@ void yaffs_PackTags2(yaffs_PackedTags2 * + #endif + } + +-void yaffs_UnpackTags2(yaffs_ExtendedTags * t, yaffs_PackedTags2 * pt) ++ ++void yaffs_UnpackTags2TagsPart(yaffs_ExtendedTags *t, ++ yaffs_PackedTags2TagsPart *ptt) + { + + memset(t, 0, sizeof(yaffs_ExtendedTags)); + + yaffs_InitialiseTags(t); + +- if (pt->t.sequenceNumber != 0xFFFFFFFF) { +- /* Page is in use */ +-#ifdef YAFFS_IGNORE_TAGS_ECC +- { +- t->eccResult = YAFFS_ECC_RESULT_NO_ERROR; +- } +-#else +- { +- yaffs_ECCOther ecc; +- int result; +- yaffs_ECCCalculateOther((unsigned char *)&pt->t, +- sizeof +- (yaffs_PackedTags2TagsPart), +- &ecc); +- result = +- yaffs_ECCCorrectOther((unsigned char *)&pt->t, +- sizeof +- (yaffs_PackedTags2TagsPart), +- &pt->ecc, &ecc); +- switch(result){ +- case 0: +- t->eccResult = YAFFS_ECC_RESULT_NO_ERROR; +- break; +- case 1: +- t->eccResult = YAFFS_ECC_RESULT_FIXED; +- break; +- case -1: +- t->eccResult = YAFFS_ECC_RESULT_UNFIXED; +- break; +- default: +- t->eccResult = YAFFS_ECC_RESULT_UNKNOWN; +- } +- } +-#endif ++ if (ptt->sequenceNumber != 0xFFFFFFFF) { + t->blockBad = 0; + t->chunkUsed = 1; +- t->objectId = pt->t.objectId; +- t->chunkId = pt->t.chunkId; +- t->byteCount = pt->t.byteCount; ++ t->objectId = ptt->objectId; ++ t->chunkId = ptt->chunkId; ++ t->byteCount = ptt->byteCount; + t->chunkDeleted = 0; + t->serialNumber = 0; +- t->sequenceNumber = pt->t.sequenceNumber; ++ t->sequenceNumber = ptt->sequenceNumber; + + /* Do extra header info stuff */ + +- if (pt->t.chunkId & EXTRA_HEADER_INFO_FLAG) { ++ if (ptt->chunkId & EXTRA_HEADER_INFO_FLAG) { + t->chunkId = 0; + t->byteCount = 0; + + t->extraHeaderInfoAvailable = 1; + t->extraParentObjectId = +- pt->t.chunkId & (~(ALL_EXTRA_FLAGS)); ++ ptt->chunkId & (~(ALL_EXTRA_FLAGS)); + t->extraIsShrinkHeader = +- (pt->t.chunkId & EXTRA_SHRINK_FLAG) ? 1 : 0; ++ (ptt->chunkId & EXTRA_SHRINK_FLAG) ? 1 : 0; + t->extraShadows = +- (pt->t.chunkId & EXTRA_SHADOWS_FLAG) ? 1 : 0; ++ (ptt->chunkId & EXTRA_SHADOWS_FLAG) ? 1 : 0; + t->extraObjectType = +- pt->t.objectId >> EXTRA_OBJECT_TYPE_SHIFT; ++ ptt->objectId >> EXTRA_OBJECT_TYPE_SHIFT; + t->objectId &= ~EXTRA_OBJECT_TYPE_MASK; + +- if (t->extraObjectType == YAFFS_OBJECT_TYPE_HARDLINK) { +- t->extraEquivalentObjectId = pt->t.byteCount; +- } else { +- t->extraFileLength = pt->t.byteCount; ++ if (t->extraObjectType == YAFFS_OBJECT_TYPE_HARDLINK) ++ t->extraEquivalentObjectId = ptt->byteCount; ++ else ++ t->extraFileLength = ptt->byteCount; ++ } ++ } ++ ++ yaffs_DumpPackedTags2TagsPart(ptt); ++ yaffs_DumpTags2(t); ++ ++} ++ ++ ++void yaffs_UnpackTags2(yaffs_ExtendedTags *t, yaffs_PackedTags2 *pt) ++{ ++ ++ yaffs_ECCResult eccResult = YAFFS_ECC_RESULT_NO_ERROR; ++ ++ if (pt->t.sequenceNumber != 0xFFFFFFFF) { ++ /* Page is in use */ ++#ifndef YAFFS_IGNORE_TAGS_ECC ++ { ++ yaffs_ECCOther ecc; ++ int result; ++ yaffs_ECCCalculateOther((unsigned char *)&pt->t, ++ sizeof ++ (yaffs_PackedTags2TagsPart), ++ &ecc); ++ result = ++ yaffs_ECCCorrectOther((unsigned char *)&pt->t, ++ sizeof ++ (yaffs_PackedTags2TagsPart), ++ &pt->ecc, &ecc); ++ switch (result) { ++ case 0: ++ eccResult = YAFFS_ECC_RESULT_NO_ERROR; ++ break; ++ case 1: ++ eccResult = YAFFS_ECC_RESULT_FIXED; ++ break; ++ case -1: ++ eccResult = YAFFS_ECC_RESULT_UNFIXED; ++ break; ++ default: ++ eccResult = YAFFS_ECC_RESULT_UNKNOWN; + } + } ++#endif + } + ++ yaffs_UnpackTags2TagsPart(t, &pt->t); ++ ++ t->eccResult = eccResult; ++ + yaffs_DumpPackedTags2(pt); + yaffs_DumpTags2(t); + + } ++ +--- a/fs/yaffs2/yaffs_packedtags2.h ++++ b/fs/yaffs2/yaffs_packedtags2.h +@@ -33,6 +33,11 @@ typedef struct { + yaffs_ECCOther ecc; + } yaffs_PackedTags2; + +-void yaffs_PackTags2(yaffs_PackedTags2 * pt, const yaffs_ExtendedTags * t); +-void yaffs_UnpackTags2(yaffs_ExtendedTags * t, yaffs_PackedTags2 * pt); ++/* Full packed tags with ECC, used for oob tags */ ++void yaffs_PackTags2(yaffs_PackedTags2 *pt, const yaffs_ExtendedTags *t); ++void yaffs_UnpackTags2(yaffs_ExtendedTags *t, yaffs_PackedTags2 *pt); ++ ++/* Only the tags part (no ECC for use with inband tags */ ++void yaffs_PackTags2TagsPart(yaffs_PackedTags2TagsPart *pt, const yaffs_ExtendedTags *t); ++void yaffs_UnpackTags2TagsPart(yaffs_ExtendedTags *t, yaffs_PackedTags2TagsPart *pt); + #endif +--- a/fs/yaffs2/yaffs_qsort.c ++++ b/fs/yaffs2/yaffs_qsort.c +@@ -28,12 +28,12 @@ + */ + + #include "yportenv.h" +-//#include ++/* #include */ + + /* + * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function". + */ +-#define swapcode(TYPE, parmi, parmj, n) { \ ++#define swapcode(TYPE, parmi, parmj, n) do { \ + long i = (n) / sizeof (TYPE); \ + register TYPE *pi = (TYPE *) (parmi); \ + register TYPE *pj = (TYPE *) (parmj); \ +@@ -41,28 +41,29 @@ + register TYPE t = *pi; \ + *pi++ = *pj; \ + *pj++ = t; \ +- } while (--i > 0); \ +-} ++ } while (--i > 0); \ ++} while (0) + + #define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \ +- es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1; ++ es % sizeof(long) ? 2 : es == sizeof(long) ? 0 : 1; + + static __inline void + swapfunc(char *a, char *b, int n, int swaptype) + { + if (swaptype <= 1) +- swapcode(long, a, b, n) ++ swapcode(long, a, b, n); + else +- swapcode(char, a, b, n) ++ swapcode(char, a, b, n); + } + +-#define swap(a, b) \ ++#define yswap(a, b) do { \ + if (swaptype == 0) { \ + long t = *(long *)(a); \ + *(long *)(a) = *(long *)(b); \ + *(long *)(b) = t; \ + } else \ +- swapfunc(a, b, es, swaptype) ++ swapfunc(a, b, es, swaptype); \ ++} while (0) + + #define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype) + +@@ -70,12 +71,12 @@ static __inline char * + med3(char *a, char *b, char *c, int (*cmp)(const void *, const void *)) + { + return cmp(a, b) < 0 ? +- (cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a )) +- :(cmp(b, c) > 0 ? b : (cmp(a, c) < 0 ? a : c )); ++ (cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a)) ++ : (cmp(b, c) > 0 ? b : (cmp(a, c) < 0 ? a : c)); + } + + #ifndef min +-#define min(a,b) (((a) < (b)) ? (a) : (b)) ++#define min(a, b) (((a) < (b)) ? (a) : (b)) + #endif + + void +@@ -92,7 +93,7 @@ loop: SWAPINIT(a, es); + for (pm = (char *)a + es; pm < (char *) a + n * es; pm += es) + for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0; + pl -= es) +- swap(pl, pl - es); ++ yswap(pl, pl - es); + return; + } + pm = (char *)a + (n / 2) * es; +@@ -107,7 +108,7 @@ loop: SWAPINIT(a, es); + } + pm = med3(pl, pm, pn, cmp); + } +- swap(a, pm); ++ yswap(a, pm); + pa = pb = (char *)a + es; + + pc = pd = (char *)a + (n - 1) * es; +@@ -115,7 +116,7 @@ loop: SWAPINIT(a, es); + while (pb <= pc && (r = cmp(pb, a)) <= 0) { + if (r == 0) { + swap_cnt = 1; +- swap(pa, pb); ++ yswap(pa, pb); + pa += es; + } + pb += es; +@@ -123,14 +124,14 @@ loop: SWAPINIT(a, es); + while (pb <= pc && (r = cmp(pc, a)) >= 0) { + if (r == 0) { + swap_cnt = 1; +- swap(pc, pd); ++ yswap(pc, pd); + pd -= es; + } + pc -= es; + } + if (pb > pc) + break; +- swap(pb, pc); ++ yswap(pb, pc); + swap_cnt = 1; + pb += es; + pc -= es; +@@ -139,7 +140,7 @@ loop: SWAPINIT(a, es); + for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es) + for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0; + pl -= es) +- swap(pl, pl - es); ++ yswap(pl, pl - es); + return; + } + +@@ -148,9 +149,11 @@ loop: SWAPINIT(a, es); + vecswap(a, pb - r, r); + r = min((long)(pd - pc), (long)(pn - pd - es)); + vecswap(pb, pn - r, r); +- if ((r = pb - pa) > es) ++ r = pb - pa; ++ if (r > es) + yaffs_qsort(a, r / es, es, cmp); +- if ((r = pd - pc) > es) { ++ r = pd - pc; ++ if (r > es) { + /* Iterate rather than recurse to save stack space */ + a = pn - r; + n = r / es; +--- a/fs/yaffs2/yaffs_qsort.h ++++ b/fs/yaffs2/yaffs_qsort.h +@@ -17,7 +17,7 @@ + #ifndef __YAFFS_QSORT_H__ + #define __YAFFS_QSORT_H__ + +-extern void yaffs_qsort (void *const base, size_t total_elems, size_t size, +- int (*cmp)(const void *, const void *)); ++extern void yaffs_qsort(void *const base, size_t total_elems, size_t size, ++ int (*cmp)(const void *, const void *)); + + #endif +--- a/fs/yaffs2/yaffs_tagscompat.c ++++ b/fs/yaffs2/yaffs_tagscompat.c +@@ -14,16 +14,17 @@ + #include "yaffs_guts.h" + #include "yaffs_tagscompat.h" + #include "yaffs_ecc.h" ++#include "yaffs_getblockinfo.h" + +-static void yaffs_HandleReadDataError(yaffs_Device * dev, int chunkInNAND); ++static void yaffs_HandleReadDataError(yaffs_Device *dev, int chunkInNAND); + #ifdef NOTYET +-static void yaffs_CheckWrittenBlock(yaffs_Device * dev, int chunkInNAND); +-static void yaffs_HandleWriteChunkOk(yaffs_Device * dev, int chunkInNAND, +- const __u8 * data, +- const yaffs_Spare * spare); +-static void yaffs_HandleUpdateChunk(yaffs_Device * dev, int chunkInNAND, +- const yaffs_Spare * spare); +-static void yaffs_HandleWriteChunkError(yaffs_Device * dev, int chunkInNAND); ++static void yaffs_CheckWrittenBlock(yaffs_Device *dev, int chunkInNAND); ++static void yaffs_HandleWriteChunkOk(yaffs_Device *dev, int chunkInNAND, ++ const __u8 *data, ++ const yaffs_Spare *spare); ++static void yaffs_HandleUpdateChunk(yaffs_Device *dev, int chunkInNAND, ++ const yaffs_Spare *spare); ++static void yaffs_HandleWriteChunkError(yaffs_Device *dev, int chunkInNAND); + #endif + + static const char yaffs_countBitsTable[256] = { +@@ -54,13 +55,13 @@ int yaffs_CountBits(__u8 x) + + /********** Tags ECC calculations *********/ + +-void yaffs_CalcECC(const __u8 * data, yaffs_Spare * spare) ++void yaffs_CalcECC(const __u8 *data, yaffs_Spare *spare) + { + yaffs_ECCCalculate(data, spare->ecc1); + yaffs_ECCCalculate(&data[256], spare->ecc2); + } + +-void yaffs_CalcTagsECC(yaffs_Tags * tags) ++void yaffs_CalcTagsECC(yaffs_Tags *tags) + { + /* Calculate an ecc */ + +@@ -74,9 +75,8 @@ void yaffs_CalcTagsECC(yaffs_Tags * tags + for (i = 0; i < 8; i++) { + for (j = 1; j & 0xff; j <<= 1) { + bit++; +- if (b[i] & j) { ++ if (b[i] & j) + ecc ^= bit; +- } + } + } + +@@ -84,7 +84,7 @@ void yaffs_CalcTagsECC(yaffs_Tags * tags + + } + +-int yaffs_CheckECCOnTags(yaffs_Tags * tags) ++int yaffs_CheckECCOnTags(yaffs_Tags *tags) + { + unsigned ecc = tags->ecc; + +@@ -115,8 +115,8 @@ int yaffs_CheckECCOnTags(yaffs_Tags * ta + + /********** Tags **********/ + +-static void yaffs_LoadTagsIntoSpare(yaffs_Spare * sparePtr, +- yaffs_Tags * tagsPtr) ++static void yaffs_LoadTagsIntoSpare(yaffs_Spare *sparePtr, ++ yaffs_Tags *tagsPtr) + { + yaffs_TagsUnion *tu = (yaffs_TagsUnion *) tagsPtr; + +@@ -132,8 +132,8 @@ static void yaffs_LoadTagsIntoSpare(yaff + sparePtr->tagByte7 = tu->asBytes[7]; + } + +-static void yaffs_GetTagsFromSpare(yaffs_Device * dev, yaffs_Spare * sparePtr, +- yaffs_Tags * tagsPtr) ++static void yaffs_GetTagsFromSpare(yaffs_Device *dev, yaffs_Spare *sparePtr, ++ yaffs_Tags *tagsPtr) + { + yaffs_TagsUnion *tu = (yaffs_TagsUnion *) tagsPtr; + int result; +@@ -148,21 +148,20 @@ static void yaffs_GetTagsFromSpare(yaffs + tu->asBytes[7] = sparePtr->tagByte7; + + result = yaffs_CheckECCOnTags(tagsPtr); +- if (result > 0) { ++ if (result > 0) + dev->tagsEccFixed++; +- } else if (result < 0) { ++ else if (result < 0) + dev->tagsEccUnfixed++; +- } + } + +-static void yaffs_SpareInitialise(yaffs_Spare * spare) ++static void yaffs_SpareInitialise(yaffs_Spare *spare) + { + memset(spare, 0xFF, sizeof(yaffs_Spare)); + } + + static int yaffs_WriteChunkToNAND(struct yaffs_DeviceStruct *dev, +- int chunkInNAND, const __u8 * data, +- yaffs_Spare * spare) ++ int chunkInNAND, const __u8 *data, ++ yaffs_Spare *spare) + { + if (chunkInNAND < dev->startBlock * dev->nChunksPerBlock) { + T(YAFFS_TRACE_ERROR, +@@ -177,9 +176,9 @@ static int yaffs_WriteChunkToNAND(struct + + static int yaffs_ReadChunkFromNAND(struct yaffs_DeviceStruct *dev, + int chunkInNAND, +- __u8 * data, +- yaffs_Spare * spare, +- yaffs_ECCResult * eccResult, ++ __u8 *data, ++ yaffs_Spare *spare, ++ yaffs_ECCResult *eccResult, + int doErrorCorrection) + { + int retVal; +@@ -252,9 +251,11 @@ static int yaffs_ReadChunkFromNAND(struc + /* Must allocate enough memory for spare+2*sizeof(int) */ + /* for ecc results from device. */ + struct yaffs_NANDSpare nspare; +- retVal = +- dev->readChunkFromNAND(dev, chunkInNAND, data, +- (yaffs_Spare *) & nspare); ++ ++ memset(&nspare, 0, sizeof(nspare)); ++ ++ retVal = dev->readChunkFromNAND(dev, chunkInNAND, data, ++ (yaffs_Spare *) &nspare); + memcpy(spare, &nspare, sizeof(yaffs_Spare)); + if (data && doErrorCorrection) { + if (nspare.eccres1 > 0) { +@@ -302,8 +303,7 @@ static int yaffs_ReadChunkFromNAND(struc + static int yaffs_CheckChunkErased(struct yaffs_DeviceStruct *dev, + int chunkInNAND) + { +- +- static int init = 0; ++ static int init; + static __u8 cmpbuf[YAFFS_BYTES_PER_CHUNK]; + static __u8 data[YAFFS_BYTES_PER_CHUNK]; + /* Might as well always allocate the larger size for */ +@@ -331,12 +331,12 @@ static int yaffs_CheckChunkErased(struct + * Functions for robustisizing + */ + +-static void yaffs_HandleReadDataError(yaffs_Device * dev, int chunkInNAND) ++static void yaffs_HandleReadDataError(yaffs_Device *dev, int chunkInNAND) + { + int blockInNAND = chunkInNAND / dev->nChunksPerBlock; + + /* Mark the block for retirement */ +- yaffs_GetBlockInfo(dev, blockInNAND)->needsRetiring = 1; ++ yaffs_GetBlockInfo(dev, blockInNAND + dev->blockOffset)->needsRetiring = 1; + T(YAFFS_TRACE_ERROR | YAFFS_TRACE_BAD_BLOCKS, + (TSTR("**>>Block %d marked for retirement" TENDSTR), blockInNAND)); + +@@ -348,22 +348,22 @@ static void yaffs_HandleReadDataError(ya + } + + #ifdef NOTYET +-static void yaffs_CheckWrittenBlock(yaffs_Device * dev, int chunkInNAND) ++static void yaffs_CheckWrittenBlock(yaffs_Device *dev, int chunkInNAND) + { + } + +-static void yaffs_HandleWriteChunkOk(yaffs_Device * dev, int chunkInNAND, +- const __u8 * data, +- const yaffs_Spare * spare) ++static void yaffs_HandleWriteChunkOk(yaffs_Device *dev, int chunkInNAND, ++ const __u8 *data, ++ const yaffs_Spare *spare) + { + } + +-static void yaffs_HandleUpdateChunk(yaffs_Device * dev, int chunkInNAND, +- const yaffs_Spare * spare) ++static void yaffs_HandleUpdateChunk(yaffs_Device *dev, int chunkInNAND, ++ const yaffs_Spare *spare) + { + } + +-static void yaffs_HandleWriteChunkError(yaffs_Device * dev, int chunkInNAND) ++static void yaffs_HandleWriteChunkError(yaffs_Device *dev, int chunkInNAND) + { + int blockInNAND = chunkInNAND / dev->nChunksPerBlock; + +@@ -373,8 +373,8 @@ static void yaffs_HandleWriteChunkError( + yaffs_DeleteChunk(dev, chunkInNAND, 1, __LINE__); + } + +-static int yaffs_VerifyCompare(const __u8 * d0, const __u8 * d1, +- const yaffs_Spare * s0, const yaffs_Spare * s1) ++static int yaffs_VerifyCompare(const __u8 *d0, const __u8 *d1, ++ const yaffs_Spare *s0, const yaffs_Spare *s1) + { + + if (memcmp(d0, d1, YAFFS_BYTES_PER_CHUNK) != 0 || +@@ -398,28 +398,35 @@ static int yaffs_VerifyCompare(const __u + } + #endif /* NOTYET */ + +-int yaffs_TagsCompatabilityWriteChunkWithTagsToNAND(yaffs_Device * dev, +- int chunkInNAND, +- const __u8 * data, +- const yaffs_ExtendedTags * +- eTags) ++int yaffs_TagsCompatabilityWriteChunkWithTagsToNAND(yaffs_Device *dev, ++ int chunkInNAND, ++ const __u8 *data, ++ const yaffs_ExtendedTags *eTags) + { + yaffs_Spare spare; + yaffs_Tags tags; + + yaffs_SpareInitialise(&spare); + +- if (eTags->chunkDeleted) { ++ if (eTags->chunkDeleted) + spare.pageStatus = 0; +- } else { ++ else { + tags.objectId = eTags->objectId; + tags.chunkId = eTags->chunkId; +- tags.byteCount = eTags->byteCount; ++ ++ tags.byteCountLSB = eTags->byteCount & 0x3ff; ++ ++ if (dev->nDataBytesPerChunk >= 1024) ++ tags.byteCountMSB = (eTags->byteCount >> 10) & 3; ++ else ++ tags.byteCountMSB = 3; ++ ++ + tags.serialNumber = eTags->serialNumber; + +- if (!dev->useNANDECC && data) { ++ if (!dev->useNANDECC && data) + yaffs_CalcECC(data, &spare); +- } ++ + yaffs_LoadTagsIntoSpare(&spare, &tags); + + } +@@ -427,15 +434,15 @@ int yaffs_TagsCompatabilityWriteChunkWit + return yaffs_WriteChunkToNAND(dev, chunkInNAND, data, &spare); + } + +-int yaffs_TagsCompatabilityReadChunkWithTagsFromNAND(yaffs_Device * dev, ++int yaffs_TagsCompatabilityReadChunkWithTagsFromNAND(yaffs_Device *dev, + int chunkInNAND, +- __u8 * data, +- yaffs_ExtendedTags * eTags) ++ __u8 *data, ++ yaffs_ExtendedTags *eTags) + { + + yaffs_Spare spare; + yaffs_Tags tags; +- yaffs_ECCResult eccResult; ++ yaffs_ECCResult eccResult = YAFFS_ECC_RESULT_UNKNOWN; + + static yaffs_Spare spareFF; + static int init; +@@ -466,7 +473,11 @@ int yaffs_TagsCompatabilityReadChunkWith + + eTags->objectId = tags.objectId; + eTags->chunkId = tags.chunkId; +- eTags->byteCount = tags.byteCount; ++ eTags->byteCount = tags.byteCountLSB; ++ ++ if (dev->nDataBytesPerChunk >= 1024) ++ eTags->byteCount |= (((unsigned) tags.byteCountMSB) << 10); ++ + eTags->serialNumber = tags.serialNumber; + } + } +@@ -497,9 +508,9 @@ int yaffs_TagsCompatabilityMarkNANDBlock + } + + int yaffs_TagsCompatabilityQueryNANDBlock(struct yaffs_DeviceStruct *dev, +- int blockNo, yaffs_BlockState * +- state, +- int *sequenceNumber) ++ int blockNo, ++ yaffs_BlockState *state, ++ __u32 *sequenceNumber) + { + + yaffs_Spare spare0, spare1; +--- a/fs/yaffs2/yaffs_tagscompat.h ++++ b/fs/yaffs2/yaffs_tagscompat.h +@@ -17,24 +17,23 @@ + #define __YAFFS_TAGSCOMPAT_H__ + + #include "yaffs_guts.h" +-int yaffs_TagsCompatabilityWriteChunkWithTagsToNAND(yaffs_Device * dev, +- int chunkInNAND, +- const __u8 * data, +- const yaffs_ExtendedTags * +- tags); +-int yaffs_TagsCompatabilityReadChunkWithTagsFromNAND(yaffs_Device * dev, +- int chunkInNAND, +- __u8 * data, +- yaffs_ExtendedTags * +- tags); ++int yaffs_TagsCompatabilityWriteChunkWithTagsToNAND(yaffs_Device *dev, ++ int chunkInNAND, ++ const __u8 *data, ++ const yaffs_ExtendedTags *tags); ++int yaffs_TagsCompatabilityReadChunkWithTagsFromNAND(yaffs_Device *dev, ++ int chunkInNAND, ++ __u8 *data, ++ yaffs_ExtendedTags *tags); + int yaffs_TagsCompatabilityMarkNANDBlockBad(struct yaffs_DeviceStruct *dev, + int blockNo); + int yaffs_TagsCompatabilityQueryNANDBlock(struct yaffs_DeviceStruct *dev, +- int blockNo, yaffs_BlockState * +- state, int *sequenceNumber); ++ int blockNo, ++ yaffs_BlockState *state, ++ __u32 *sequenceNumber); + +-void yaffs_CalcTagsECC(yaffs_Tags * tags); +-int yaffs_CheckECCOnTags(yaffs_Tags * tags); ++void yaffs_CalcTagsECC(yaffs_Tags *tags); ++int yaffs_CheckECCOnTags(yaffs_Tags *tags); + int yaffs_CountBits(__u8 byte); + + #endif +--- a/fs/yaffs2/yaffs_tagsvalidity.c ++++ b/fs/yaffs2/yaffs_tagsvalidity.c +@@ -13,14 +13,14 @@ + + #include "yaffs_tagsvalidity.h" + +-void yaffs_InitialiseTags(yaffs_ExtendedTags * tags) ++void yaffs_InitialiseTags(yaffs_ExtendedTags *tags) + { + memset(tags, 0, sizeof(yaffs_ExtendedTags)); + tags->validMarker0 = 0xAAAAAAAA; + tags->validMarker1 = 0x55555555; + } + +-int yaffs_ValidateTags(yaffs_ExtendedTags * tags) ++int yaffs_ValidateTags(yaffs_ExtendedTags *tags) + { + return (tags->validMarker0 == 0xAAAAAAAA && + tags->validMarker1 == 0x55555555); +--- a/fs/yaffs2/yaffs_tagsvalidity.h ++++ b/fs/yaffs2/yaffs_tagsvalidity.h +@@ -19,6 +19,6 @@ + + #include "yaffs_guts.h" + +-void yaffs_InitialiseTags(yaffs_ExtendedTags * tags); +-int yaffs_ValidateTags(yaffs_ExtendedTags * tags); ++void yaffs_InitialiseTags(yaffs_ExtendedTags *tags); ++int yaffs_ValidateTags(yaffs_ExtendedTags *tags); + #endif +--- a/fs/yaffs2/yportenv.h ++++ b/fs/yaffs2/yportenv.h +@@ -17,17 +17,28 @@ + #ifndef __YPORTENV_H__ + #define __YPORTENV_H__ + ++/* ++ * Define the MTD version in terms of Linux Kernel versions ++ * This allows yaffs to be used independantly of the kernel ++ * as well as with it. ++ */ ++ ++#define MTD_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) ++ + #if defined CONFIG_YAFFS_WINCE + + #include "ywinceenv.h" + +-#elif defined __KERNEL__ ++#elif defined __KERNEL__ + + #include "moduleconfig.h" + + /* Linux kernel */ ++ + #include +-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) ++#define MTD_VERSION_CODE LINUX_VERSION_CODE ++ ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)) + #include + #endif + #include +@@ -40,12 +51,13 @@ + #define YCHAR char + #define YUCHAR unsigned char + #define _Y(x) x +-#define yaffs_strcpy(a,b) strcpy(a,b) +-#define yaffs_strncpy(a,b,c) strncpy(a,b,c) +-#define yaffs_strncmp(a,b,c) strncmp(a,b,c) +-#define yaffs_strlen(s) strlen(s) +-#define yaffs_sprintf sprintf +-#define yaffs_toupper(a) toupper(a) ++#define yaffs_strcat(a, b) strcat(a, b) ++#define yaffs_strcpy(a, b) strcpy(a, b) ++#define yaffs_strncpy(a, b, c) strncpy(a, b, c) ++#define yaffs_strncmp(a, b, c) strncmp(a, b, c) ++#define yaffs_strlen(s) strlen(s) ++#define yaffs_sprintf sprintf ++#define yaffs_toupper(a) toupper(a) + + #define Y_INLINE inline + +@@ -53,19 +65,19 @@ + #define YAFFS_LOSTNFOUND_PREFIX "obj" + + /* #define YPRINTF(x) printk x */ +-#define YMALLOC(x) kmalloc(x,GFP_KERNEL) ++#define YMALLOC(x) kmalloc(x, GFP_NOFS) + #define YFREE(x) kfree(x) + #define YMALLOC_ALT(x) vmalloc(x) + #define YFREE_ALT(x) vfree(x) + #define YMALLOC_DMA(x) YMALLOC(x) + +-// KR - added for use in scan so processes aren't blocked indefinitely. ++/* KR - added for use in scan so processes aren't blocked indefinitely. */ + #define YYIELD() schedule() + + #define YAFFS_ROOT_MODE 0666 + #define YAFFS_LOSTNFOUND_MODE 0666 + +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) + #define Y_CURRENT_TIME CURRENT_TIME.tv_sec + #define Y_TIME_CONVERT(x) (x).tv_sec + #else +@@ -73,11 +85,12 @@ + #define Y_TIME_CONVERT(x) (x) + #endif + +-#define yaffs_SumCompare(x,y) ((x) == (y)) +-#define yaffs_strcmp(a,b) strcmp(a,b) ++#define yaffs_SumCompare(x, y) ((x) == (y)) ++#define yaffs_strcmp(a, b) strcmp(a, b) + + #define TENDSTR "\n" + #define TSTR(x) KERN_WARNING x ++#define TCONT(x) x + #define TOUT(p) printk p + + #define yaffs_trace(mask, fmt, args...) \ +@@ -90,6 +103,8 @@ + + #elif defined CONFIG_YAFFS_DIRECT + ++#define MTD_VERSION_CODE MTD_VERSION(2, 6, 22) ++ + /* Direct interface */ + #include "ydirectenv.h" + +@@ -111,11 +126,12 @@ + #define YCHAR char + #define YUCHAR unsigned char + #define _Y(x) x +-#define yaffs_strcpy(a,b) strcpy(a,b) +-#define yaffs_strncpy(a,b,c) strncpy(a,b,c) +-#define yaffs_strlen(s) strlen(s) +-#define yaffs_sprintf sprintf +-#define yaffs_toupper(a) toupper(a) ++#define yaffs_strcat(a, b) strcat(a, b) ++#define yaffs_strcpy(a, b) strcpy(a, b) ++#define yaffs_strncpy(a, b, c) strncpy(a, b, c) ++#define yaffs_strlen(s) strlen(s) ++#define yaffs_sprintf sprintf ++#define yaffs_toupper(a) toupper(a) + + #define Y_INLINE inline + +@@ -133,8 +149,8 @@ + #define YAFFS_ROOT_MODE 0666 + #define YAFFS_LOSTNFOUND_MODE 0666 + +-#define yaffs_SumCompare(x,y) ((x) == (y)) +-#define yaffs_strcmp(a,b) strcmp(a,b) ++#define yaffs_SumCompare(x, y) ((x) == (y)) ++#define yaffs_strcmp(a, b) strcmp(a, b) + + #else + /* Should have specified a configuration type */ +@@ -178,10 +194,10 @@ extern unsigned int yaffs_wr_attempts; + #define YAFFS_TRACE_ALWAYS 0xF0000000 + + +-#define T(mask,p) do{ if((mask) & (yaffs_traceMask | YAFFS_TRACE_ALWAYS)) TOUT(p);} while(0) ++#define T(mask, p) do { if ((mask) & (yaffs_traceMask | YAFFS_TRACE_ALWAYS)) TOUT(p); } while (0) + +-#ifndef CONFIG_YAFFS_WINCE +-#define YBUG() T(YAFFS_TRACE_BUG,(TSTR("==>> yaffs bug: " __FILE__ " %d" TENDSTR),__LINE__)) ++#ifndef YBUG ++#define YBUG() do {T(YAFFS_TRACE_BUG, (TSTR("==>> yaffs bug: " __FILE__ " %d" TENDSTR), __LINE__)); } while (0) + #endif + + #endif diff --git a/target/linux/generic-2.6/patches-2.6.32/600-phy_extension.patch b/target/linux/generic-2.6/patches-2.6.32/600-phy_extension.patch new file mode 100644 index 000000000..f3841012a --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/600-phy_extension.patch @@ -0,0 +1,83 @@ +--- a/drivers/net/phy/phy.c ++++ b/drivers/net/phy/phy.c +@@ -299,6 +299,50 @@ int phy_ethtool_gset(struct phy_device * + } + EXPORT_SYMBOL(phy_ethtool_gset); + ++int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr) ++{ ++ u32 cmd; ++ int tmp; ++ struct ethtool_cmd ecmd = { ETHTOOL_GSET }; ++ struct ethtool_value edata = { ETHTOOL_GLINK }; ++ ++ if (get_user(cmd, (u32 *) useraddr)) ++ return -EFAULT; ++ ++ switch (cmd) { ++ case ETHTOOL_GSET: ++ phy_ethtool_gset(phydev, &ecmd); ++ if (copy_to_user(useraddr, &ecmd, sizeof(ecmd))) ++ return -EFAULT; ++ return 0; ++ ++ case ETHTOOL_SSET: ++ if (copy_from_user(&ecmd, useraddr, sizeof(ecmd))) ++ return -EFAULT; ++ return phy_ethtool_sset(phydev, &ecmd); ++ ++ case ETHTOOL_NWAY_RST: ++ /* if autoneg is off, it's an error */ ++ tmp = phy_read(phydev, MII_BMCR); ++ if (tmp & BMCR_ANENABLE) { ++ tmp |= (BMCR_ANRESTART); ++ phy_write(phydev, MII_BMCR, tmp); ++ return 0; ++ } ++ return -EINVAL; ++ ++ case ETHTOOL_GLINK: ++ edata.data = (phy_read(phydev, ++ MII_BMSR) & BMSR_LSTATUS) ? 1 : 0; ++ if (copy_to_user(useraddr, &edata, sizeof(edata))) ++ return -EFAULT; ++ return 0; ++ } ++ ++ return -EOPNOTSUPP; ++} ++EXPORT_SYMBOL(phy_ethtool_ioctl); ++ + /** + * phy_mii_ioctl - generic PHY MII ioctl interface + * @phydev: the phy_device struct +@@ -352,8 +396,8 @@ int phy_mii_ioctl(struct phy_device *phy + } + + phy_write(phydev, mii_data->reg_num, val); +- +- if (mii_data->reg_num == MII_BMCR ++ ++ if (mii_data->reg_num == MII_BMCR + && val & BMCR_RESET + && phydev->drv->config_init) { + phy_scan_fixups(phydev); +@@ -468,7 +512,7 @@ static void phy_force_reduction(struct p + int idx; + + idx = phy_find_setting(phydev->speed, phydev->duplex); +- ++ + idx++; + + idx = phy_find_valid(idx, phydev->supported); +--- a/include/linux/phy.h ++++ b/include/linux/phy.h +@@ -489,6 +489,7 @@ void phy_start_machine(struct phy_device + void phy_stop_machine(struct phy_device *phydev); + int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd); + int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd); ++int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr); + int phy_mii_ioctl(struct phy_device *phydev, + struct mii_ioctl_data *mii_data, int cmd); + int phy_start_interrupts(struct phy_device *phydev); diff --git a/target/linux/generic-2.6/patches-2.6.32/620-phy_adm6996.patch b/target/linux/generic-2.6/patches-2.6.32/620-phy_adm6996.patch new file mode 100644 index 000000000..b3e469a8d --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/620-phy_adm6996.patch @@ -0,0 +1,24 @@ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -88,6 +88,11 @@ config LSI_ET1011C_PHY + ---help--- + Supports the LSI ET1011C PHY. + ++config ADM6996_PHY ++ tristate "Driver for ADM6996 switches" ++ ---help--- ++ Currently supports the ADM6996F switch ++ + config FIXED_PHY + bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" + depends on PHYLIB=y +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -13,6 +13,7 @@ obj-$(CONFIG_VITESSE_PHY) += vitesse.o + obj-$(CONFIG_BROADCOM_PHY) += broadcom.o + obj-$(CONFIG_BCM63XX_PHY) += bcm63xx.o + obj-$(CONFIG_ICPLUS_PHY) += icplus.o ++obj-$(CONFIG_ADM6996_PHY) += adm6996.o + obj-$(CONFIG_REALTEK_PHY) += realtek.o + obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o + obj-$(CONFIG_FIXED_PHY) += fixed.o diff --git a/target/linux/generic-2.6/patches-2.6.32/630-phy_packets.patch b/target/linux/generic-2.6/patches-2.6.32/630-phy_packets.patch new file mode 100644 index 000000000..fdfdac7c2 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/630-phy_packets.patch @@ -0,0 +1,63 @@ +--- a/drivers/net/phy/phy_device.c ++++ b/drivers/net/phy/phy_device.c +@@ -146,6 +146,18 @@ int phy_scan_fixups(struct phy_device *p + } + EXPORT_SYMBOL(phy_scan_fixups); + ++static int generic_receive_skb(struct sk_buff *skb) ++{ ++ skb->protocol = eth_type_trans(skb, skb->dev); ++ return netif_receive_skb(skb); ++} ++ ++static int generic_rx(struct sk_buff *skb) ++{ ++ skb->protocol = eth_type_trans(skb, skb->dev); ++ return netif_rx(skb); ++} ++ + struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) + { + struct phy_device *dev; +@@ -175,6 +187,8 @@ struct phy_device* phy_device_create(str + dev_set_name(&dev->dev, PHY_ID_FMT, bus->id, addr); + + dev->state = PHY_DOWN; ++ dev->netif_receive_skb = &generic_receive_skb; ++ dev->netif_rx = &generic_rx; + + mutex_init(&dev->lock); + +--- a/include/linux/phy.h ++++ b/include/linux/phy.h +@@ -325,6 +325,20 @@ struct phy_device { + void (*adjust_link)(struct net_device *dev); + + void (*adjust_state)(struct net_device *dev); ++ ++ /* ++ * By default these point to the original functions ++ * with the same name. adding them to the phy_device ++ * allows the phy driver to override them for packet ++ * mangling if the ethernet driver supports it ++ * This is required to support some really horrible ++ * switches such as the Marvell 88E6060 ++ */ ++ int (*netif_receive_skb)(struct sk_buff *skb); ++ int (*netif_rx)(struct sk_buff *skb); ++ ++ /* alignment offset for packets */ ++ int pkt_align; + }; + #define to_phy_device(d) container_of(d, struct phy_device, dev) + +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h +@@ -807,6 +807,7 @@ struct net_device + void *ax25_ptr; /* AX.25 specific data */ + struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data, + assign before registering */ ++ void *phy_ptr; /* PHY device specific data */ + + /* + * Cache line mostly used on receive path (including eth_type_trans()) diff --git a/target/linux/generic-2.6/patches-2.6.32/650-swconfig.patch b/target/linux/generic-2.6/patches-2.6.32/650-swconfig.patch new file mode 100644 index 000000000..6825037ce --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/650-swconfig.patch @@ -0,0 +1,25 @@ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -13,6 +13,12 @@ menuconfig PHYLIB + + if PHYLIB + ++config SWCONFIG ++ tristate "Switch configuration API" ++ ---help--- ++ Switch configuration API using netlink. This allows ++ you to configure the VLAN features of certain switches. ++ + comment "MII PHY device drivers" + + config MARVELL_PHY +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -3,6 +3,7 @@ + libphy-objs := phy.o phy_device.o mdio_bus.o + + obj-$(CONFIG_PHYLIB) += libphy.o ++obj-$(CONFIG_SWCONFIG) += swconfig.o + obj-$(CONFIG_MARVELL_PHY) += marvell.o + obj-$(CONFIG_DAVICOM_PHY) += davicom.o + obj-$(CONFIG_CICADA_PHY) += cicada.o diff --git a/target/linux/generic-2.6/patches-2.6.32/660-phy_mvswitch.patch b/target/linux/generic-2.6/patches-2.6.32/660-phy_mvswitch.patch new file mode 100644 index 000000000..36551fd57 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/660-phy_mvswitch.patch @@ -0,0 +1,22 @@ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -99,6 +99,9 @@ config ADM6996_PHY + ---help--- + Currently supports the ADM6996F switch + ++config MVSWITCH_PHY ++ tristate "Driver for Marvell 88E6060 switches" ++ + config FIXED_PHY + bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" + depends on PHYLIB=y +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -15,6 +15,7 @@ obj-$(CONFIG_BROADCOM_PHY) += broadcom.o + obj-$(CONFIG_BCM63XX_PHY) += bcm63xx.o + obj-$(CONFIG_ICPLUS_PHY) += icplus.o + obj-$(CONFIG_ADM6996_PHY) += adm6996.o ++obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o + obj-$(CONFIG_REALTEK_PHY) += realtek.o + obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o + obj-$(CONFIG_FIXED_PHY) += fixed.o diff --git a/target/linux/generic-2.6/patches-2.6.32/670-phy_ip175c.patch b/target/linux/generic-2.6/patches-2.6.32/670-phy_ip175c.patch new file mode 100644 index 000000000..862868c8d --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/670-phy_ip175c.patch @@ -0,0 +1,23 @@ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -102,6 +102,10 @@ config ADM6996_PHY + config MVSWITCH_PHY + tristate "Driver for Marvell 88E6060 switches" + ++config IP175C_PHY ++ tristate "Driver for IC+ IP175C/IP178C switches" ++ select SWCONFIG ++ + config FIXED_PHY + bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" + depends on PHYLIB=y +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -16,6 +16,7 @@ obj-$(CONFIG_BCM63XX_PHY) += bcm63xx.o + obj-$(CONFIG_ICPLUS_PHY) += icplus.o + obj-$(CONFIG_ADM6996_PHY) += adm6996.o + obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o ++obj-$(CONFIG_IP175C_PHY) += ip175c.o + obj-$(CONFIG_REALTEK_PHY) += realtek.o + obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o + obj-$(CONFIG_FIXED_PHY) += fixed.o diff --git a/target/linux/generic-2.6/patches-2.6.32/680-phy_ar8216.patch b/target/linux/generic-2.6/patches-2.6.32/680-phy_ar8216.patch new file mode 100644 index 000000000..00372aae0 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/680-phy_ar8216.patch @@ -0,0 +1,23 @@ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -106,6 +106,10 @@ config IP175C_PHY + tristate "Driver for IC+ IP175C/IP178C switches" + select SWCONFIG + ++config AR8216_PHY ++ tristate "Driver for Atheros AR8216 switches" ++ select SWCONFIG ++ + config FIXED_PHY + bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" + depends on PHYLIB=y +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -18,6 +18,7 @@ obj-$(CONFIG_ADM6996_PHY) += adm6996.o + obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o + obj-$(CONFIG_IP175C_PHY) += ip175c.o + obj-$(CONFIG_REALTEK_PHY) += realtek.o ++obj-$(CONFIG_AR8216_PHY) += ar8216.o + obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o + obj-$(CONFIG_FIXED_PHY) += fixed.o + obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic-2.6/patches-2.6.32/690-phy_rtl8306.patch b/target/linux/generic-2.6/patches-2.6.32/690-phy_rtl8306.patch new file mode 100644 index 000000000..a4793cb63 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/690-phy_rtl8306.patch @@ -0,0 +1,23 @@ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -110,6 +110,10 @@ config AR8216_PHY + tristate "Driver for Atheros AR8216 switches" + select SWCONFIG + ++config RTL8306_PHY ++ tristate "Driver for Realtek RTL8306S switches" ++ select SWCONFIG ++ + config FIXED_PHY + bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" + depends on PHYLIB=y +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -19,6 +19,7 @@ obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o + obj-$(CONFIG_IP175C_PHY) += ip175c.o + obj-$(CONFIG_REALTEK_PHY) += realtek.o + obj-$(CONFIG_AR8216_PHY) += ar8216.o ++obj-$(CONFIG_RTL8306_PHY) += rtl8306.o + obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o + obj-$(CONFIG_FIXED_PHY) += fixed.o + obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic-2.6/patches-2.6.32/700-rtc7301.patch b/target/linux/generic-2.6/patches-2.6.32/700-rtc7301.patch new file mode 100644 index 000000000..dfaad429f --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/700-rtc7301.patch @@ -0,0 +1,250 @@ +--- a/drivers/rtc/Kconfig ++++ b/drivers/rtc/Kconfig +@@ -574,6 +574,15 @@ config RTC_DRV_AB3100 + support. This chip contains a battery- and capacitor-backed RTC. + + ++config RTC_DRV_RTC7301 ++ tristate "Epson RTC-7301 SF/DG" ++ help ++ If you say Y here you will get support for the ++ Epson RTC-7301 SF/DG RTC chips. ++ ++ This driver can also be built as a module. If so, the module ++ will be called rtc-7301. ++ + comment "on-CPU RTC drivers" + + config RTC_DRV_OMAP +--- a/drivers/rtc/Makefile ++++ b/drivers/rtc/Makefile +@@ -67,6 +67,7 @@ obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701 + obj-$(CONFIG_RTC_DRV_RS5C313) += rtc-rs5c313.o + obj-$(CONFIG_RTC_DRV_RS5C348) += rtc-rs5c348.o + obj-$(CONFIG_RTC_DRV_RS5C372) += rtc-rs5c372.o ++obj-$(CONFIG_RTC_DRV_RTC7301) += rtc-rtc7301.o + obj-$(CONFIG_RTC_DRV_RX8025) += rtc-rx8025.o + obj-$(CONFIG_RTC_DRV_RX8581) += rtc-rx8581.o + obj-$(CONFIG_RTC_DRV_S35390A) += rtc-s35390a.o +--- /dev/null ++++ b/drivers/rtc/rtc-rtc7301.c +@@ -0,0 +1,219 @@ ++/* ++ * Driver for Epson RTC-7301SF/DG ++ * ++ * Copyright (C) 2009 Jose Vasconcellos ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define RTC_NAME "rtc7301" ++#define RTC_VERSION "0.1" ++ ++/* Epson RTC-7301 register addresses */ ++#define RTC7301_SEC 0x00 ++#define RTC7301_SEC10 0x01 ++#define RTC7301_MIN 0x02 ++#define RTC7301_MIN10 0x03 ++#define RTC7301_HOUR 0x04 ++#define RTC7301_HOUR10 0x05 ++#define RTC7301_WEEKDAY 0x06 ++#define RTC7301_DAY 0x07 ++#define RTC7301_DAY10 0x08 ++#define RTC7301_MON 0x09 ++#define RTC7301_MON10 0x0A ++#define RTC7301_YEAR 0x0B ++#define RTC7301_YEAR10 0x0C ++#define RTC7301_YEAR100 0x0D ++#define RTC7301_YEAR1000 0x0E ++#define RTC7301_CTRLREG 0x0F ++ ++static uint8_t __iomem *rtc7301_base; ++ ++#define read_reg(offset) (readb(rtc7301_base + offset) & 0xf) ++#define write_reg(offset, data) writeb(data, rtc7301_base + (offset)) ++ ++#define rtc7301_isbusy() (read_reg(RTC7301_CTRLREG) & 1) ++ ++static void rtc7301_init_settings(void) ++{ ++ int i; ++ ++ write_reg(RTC7301_CTRLREG, 2); ++ write_reg(RTC7301_YEAR1000, 2); ++ udelay(122); ++ ++ /* bank 1 */ ++ write_reg(RTC7301_CTRLREG, 6); ++ for (i=0; i<15; i++) ++ write_reg(i, 0); ++ ++ /* bank 2 */ ++ write_reg(RTC7301_CTRLREG, 14); ++ for (i=0; i<15; i++) ++ write_reg(i, 0); ++ write_reg(RTC7301_CTRLREG, 0); ++} ++ ++static int rtc7301_get_datetime(struct device *dev, struct rtc_time *dt) ++{ ++ int cnt; ++ uint8_t buf[16]; ++ ++ cnt = 0; ++ while (rtc7301_isbusy()) { ++ udelay(244); ++ if (cnt++ > 100) { ++ dev_err(dev, "%s: timeout error %x\n", __func__, rtc7301_base[RTC7301_CTRLREG]); ++ return -EIO; ++ } ++ } ++ ++ for (cnt=0; cnt<16; cnt++) ++ buf[cnt] = read_reg(cnt); ++ ++ if (buf[RTC7301_SEC10] & 8) { ++ dev_err(dev, "%s: RTC not set\n", __func__); ++ return -EINVAL; ++ } ++ ++ memset(dt, 0, sizeof(*dt)); ++ ++ dt->tm_sec = buf[RTC7301_SEC] + buf[RTC7301_SEC10]*10; ++ dt->tm_min = buf[RTC7301_MIN] + buf[RTC7301_MIN10]*10; ++ dt->tm_hour = buf[RTC7301_HOUR] + buf[RTC7301_HOUR10]*10; ++ ++ dt->tm_mday = buf[RTC7301_DAY] + buf[RTC7301_DAY10]*10; ++ dt->tm_mon = buf[RTC7301_MON] + buf[RTC7301_MON10]*10 - 1; ++ dt->tm_year = buf[RTC7301_YEAR] + buf[RTC7301_YEAR10]*10 + ++ buf[RTC7301_YEAR100]*100 + ++ ((buf[RTC7301_YEAR1000] & 3)*1000) - 1900; ++ ++ /* the rtc device may contain illegal values on power up ++ * according to the data sheet. make sure they are valid. ++ */ ++ ++ return rtc_valid_tm(dt); ++} ++ ++static int rtc7301_set_datetime(struct device *dev, struct rtc_time *dt) ++{ ++ int data; ++ ++ data = dt->tm_year + 1900; ++ if (data >= 2100 || data < 1900) ++ return -EINVAL; ++ ++ write_reg(RTC7301_CTRLREG, 2); ++ udelay(122); ++ ++ data = bin2bcd(dt->tm_sec); ++ write_reg(RTC7301_SEC, data); ++ write_reg(RTC7301_SEC10, (data >> 4)); ++ ++ data = bin2bcd(dt->tm_min); ++ write_reg(RTC7301_MIN, data ); ++ write_reg(RTC7301_MIN10, (data >> 4)); ++ ++ data = bin2bcd(dt->tm_hour); ++ write_reg(RTC7301_HOUR, data); ++ write_reg(RTC7301_HOUR10, (data >> 4)); ++ ++ data = bin2bcd(dt->tm_mday); ++ write_reg(RTC7301_DAY, data); ++ write_reg(RTC7301_DAY10, (data>> 4)); ++ ++ data = bin2bcd(dt->tm_mon + 1); ++ write_reg(RTC7301_MON, data); ++ write_reg(RTC7301_MON10, (data >> 4)); ++ ++ data = bin2bcd(dt->tm_year % 100); ++ write_reg(RTC7301_YEAR, data); ++ write_reg(RTC7301_YEAR10, (data >> 4)); ++ data = bin2bcd((1900 + dt->tm_year) / 100); ++ write_reg(RTC7301_YEAR100, data); ++ ++ data = bin2bcd(dt->tm_wday); ++ write_reg(RTC7301_WEEKDAY, data); ++ ++ write_reg(RTC7301_CTRLREG, 0); ++ ++ return 0; ++} ++ ++static const struct rtc_class_ops rtc7301_rtc_ops = { ++ .read_time = rtc7301_get_datetime, ++ .set_time = rtc7301_set_datetime, ++}; ++ ++static int __devinit rtc7301_probe(struct platform_device *pdev) ++{ ++ struct rtc_device *rtc; ++ struct resource *res; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (!res) ++ return -ENOENT; ++ ++ rtc7301_base = ioremap_nocache(res->start, 0x1000 /*res->end - res->start + 1*/); ++ if (!rtc7301_base) ++ return -EINVAL; ++ ++ rtc = rtc_device_register(RTC_NAME, &pdev->dev, ++ &rtc7301_rtc_ops, THIS_MODULE); ++ if (IS_ERR(rtc)) { ++ iounmap(rtc7301_base); ++ return PTR_ERR(rtc); ++ } ++ ++ platform_set_drvdata(pdev, rtc); ++ ++ rtc7301_init_settings(); ++ return 0; ++} ++ ++static int __devexit rtc7301_remove(struct platform_device *pdev) ++{ ++ struct rtc_device *rtc = platform_get_drvdata(pdev); ++ ++ if (rtc) ++ rtc_device_unregister(rtc); ++ if (rtc7301_base) ++ iounmap(rtc7301_base); ++ return 0; ++} ++ ++static struct platform_driver rtc7301_driver = { ++ .driver = { ++ .name = RTC_NAME, ++ .owner = THIS_MODULE, ++ }, ++ .probe = rtc7301_probe, ++ .remove = __devexit_p(rtc7301_remove), ++}; ++ ++static __init int rtc7301_init(void) ++{ ++ return platform_driver_register(&rtc7301_driver); ++} ++module_init(rtc7301_init); ++ ++static __exit void rtc7301_exit(void) ++{ ++ platform_driver_unregister(&rtc7301_driver); ++} ++module_exit(rtc7301_exit); ++ ++MODULE_DESCRIPTION("Epson 7301 RTC driver"); ++MODULE_AUTHOR("Jose Vasconcellos "); ++MODULE_LICENSE("GPL"); ++MODULE_ALIAS("platform:" RTC_NAME); ++MODULE_VERSION(RTC_VERSION); diff --git a/target/linux/generic-2.6/patches-2.6.32/750-glamo-headers.patch b/target/linux/generic-2.6/patches-2.6.32/750-glamo-headers.patch new file mode 100644 index 000000000..419d98a42 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/750-glamo-headers.patch @@ -0,0 +1,21 @@ +--- a/include/linux/fb.h ++++ b/include/linux/fb.h +@@ -124,6 +124,7 @@ struct dentry; + #define FB_ACCEL_TRIDENT_BLADE3D 52 /* Trident Blade3D */ + #define FB_ACCEL_TRIDENT_BLADEXP 53 /* Trident BladeXP */ + #define FB_ACCEL_CIRRUS_ALPINE 53 /* Cirrus Logic 543x/544x/5480 */ ++#define FB_ACCEL_GLAMO 50 /* SMedia Glamo */ + #define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */ + #define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */ + #define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */ +--- a/include/linux/Kbuild ++++ b/include/linux/Kbuild +@@ -76,6 +76,8 @@ header-y += genetlink.h + header-y += gen_stats.h + header-y += gfs2_ondisk.h + header-y += gigaset_dev.h ++header-y += glamofb.h ++header-y += glamo-engine.h + header-y += hysdn_if.h + header-y += i2o-dev.h + header-y += i8k.h diff --git a/target/linux/generic-2.6/patches-2.6.32/801-usb_serial_endpoint_size.patch b/target/linux/generic-2.6/patches-2.6.32/801-usb_serial_endpoint_size.patch new file mode 100644 index 000000000..fea67c49f --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/801-usb_serial_endpoint_size.patch @@ -0,0 +1,25 @@ +--- a/drivers/usb/serial/usb-serial.c ++++ b/drivers/usb/serial/usb-serial.c +@@ -61,6 +61,7 @@ static struct usb_driver usb_serial_driv + drivers depend on it. + */ + ++static ushort maxSize = 0; + static int debug; + /* initially all NULL */ + static struct usb_serial *serial_table[SERIAL_TTY_MINORS]; +@@ -942,7 +943,7 @@ int usb_serial_probe(struct usb_interfac + dev_err(&interface->dev, "No free urbs available\n"); + goto probe_error; + } +- buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); ++ buffer_size = (endpoint->wMaxPacketSize > maxSize) ? endpoint->wMaxPacketSize : maxSize; + port->bulk_in_size = buffer_size; + port->bulk_in_endpointAddress = endpoint->bEndpointAddress; + port->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL); +@@ -1386,3 +1387,5 @@ MODULE_LICENSE("GPL"); + + module_param(debug, bool, S_IRUGO | S_IWUSR); + MODULE_PARM_DESC(debug, "Debug enabled or not"); ++module_param(maxSize, ushort,0); ++MODULE_PARM_DESC(maxSize,"User specified USB endpoint size"); diff --git a/target/linux/generic-2.6/patches-2.6.32/840-unable_to_open_console.patch b/target/linux/generic-2.6/patches-2.6.32/840-unable_to_open_console.patch new file mode 100644 index 000000000..3925b7791 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/840-unable_to_open_console.patch @@ -0,0 +1,11 @@ +--- a/init/main.c ++++ b/init/main.c +@@ -819,7 +819,7 @@ static noinline int init_post(void) + printk(KERN_INFO"Running BFS CPU scheduler v0.302 by Con Kolivas.\n"); + + if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) +- printk(KERN_WARNING "Warning: unable to open an initial console.\n"); ++ printk(KERN_WARNING "Please be patient, while OpenWrt loads ...\n"); + + (void) sys_dup(0); + (void) sys_dup(0); diff --git a/target/linux/generic-2.6/patches-2.6.32/902-darwin_scripts_include.patch b/target/linux/generic-2.6/patches-2.6.32/902-darwin_scripts_include.patch new file mode 100644 index 000000000..6d4b08cbc --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/902-darwin_scripts_include.patch @@ -0,0 +1,102 @@ +--- a/scripts/genksyms/parse.c_shipped ++++ b/scripts/genksyms/parse.c_shipped +@@ -160,7 +160,9 @@ + + + #include ++#ifndef __APPLE__ + #include ++#endif + #include "genksyms.h" + + static int is_typedef; +--- a/scripts/genksyms/parse.y ++++ b/scripts/genksyms/parse.y +@@ -24,7 +24,9 @@ + %{ + + #include ++#ifndef __APPLE__ + #include ++#endif + #include "genksyms.h" + + static int is_typedef; +--- a/scripts/kallsyms.c ++++ b/scripts/kallsyms.c +@@ -22,6 +22,35 @@ + #include + #include + #include ++#ifdef __APPLE__ ++/* Darwin has no memmem implementation, this one is ripped of the uClibc-0.9.28 source */ ++void *memmem (const void *haystack, size_t haystack_len, ++ const void *needle, size_t needle_len) ++{ ++ const char *begin; ++ const char *const last_possible ++ = (const char *) haystack + haystack_len - needle_len; ++ ++ if (needle_len == 0) ++ /* The first occurrence of the empty string is deemed to occur at ++ the beginning of the string. */ ++ return (void *) haystack; ++ ++ /* Sanity check, otherwise the loop might search through the whole ++ memory. */ ++ if (__builtin_expect (haystack_len < needle_len, 0)) ++ return NULL; ++ ++ for (begin = (const char *) haystack; begin <= last_possible; ++begin) ++ if (begin[0] == ((const char *) needle)[0] && ++ !memcmp ((const void *) &begin[1], ++ (const void *) ((const char *) needle + 1), ++ needle_len - 1)) ++ return (void *) begin; ++ ++ return NULL; ++} ++#endif + + #ifndef ARRAY_SIZE + #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) +--- a/scripts/kconfig/Makefile ++++ b/scripts/kconfig/Makefile +@@ -129,6 +129,9 @@ check-lxdialog := $(srctree)/$(src)/lxd + # we really need to do so. (Do not call gcc as part of make mrproper) + HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) + HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) ++ifeq ($(shell uname -s),Darwin) ++HOST_LOADLIBES += -lncurses ++endif + + HOST_EXTRACFLAGS += -DLOCALE + +--- a/scripts/mod/mk_elfconfig.c ++++ b/scripts/mod/mk_elfconfig.c +@@ -1,7 +1,11 @@ + #include + #include + #include ++#ifndef __APPLE__ + #include ++#else ++#include "../../../../../tools/sstrip/include/elf.h" ++#endif + + int + main(int argc, char **argv) +--- a/scripts/mod/modpost.h ++++ b/scripts/mod/modpost.h +@@ -7,7 +7,11 @@ + #include + #include + #include ++#if !(defined(__APPLE__) || defined(__CYGWIN__)) + #include ++#else ++#include "../../../../../tools/sstrip/include/elf.h" ++#endif + + #include "elfconfig.h" + diff --git a/target/linux/generic-2.6/patches-2.6.32/903-hostap_txpower.patch b/target/linux/generic-2.6/patches-2.6.32/903-hostap_txpower.patch new file mode 100644 index 000000000..7552ceb33 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/903-hostap_txpower.patch @@ -0,0 +1,154 @@ +--- a/drivers/net/wireless/hostap/hostap_ap.c ++++ b/drivers/net/wireless/hostap/hostap_ap.c +@@ -2335,13 +2335,13 @@ int prism2_ap_get_sta_qual(local_info_t + addr[count].sa_family = ARPHRD_ETHER; + memcpy(addr[count].sa_data, sta->addr, ETH_ALEN); + if (sta->last_rx_silence == 0) +- qual[count].qual = sta->last_rx_signal < 27 ? +- 0 : (sta->last_rx_signal - 27) * 92 / 127; ++ qual[count].qual = (sta->last_rx_signal - 156) == 0 ? ++ 0 : (sta->last_rx_signal - 156) * 92 / 64; + else +- qual[count].qual = sta->last_rx_signal - +- sta->last_rx_silence - 35; +- qual[count].level = HFA384X_LEVEL_TO_dBm(sta->last_rx_signal); +- qual[count].noise = HFA384X_LEVEL_TO_dBm(sta->last_rx_silence); ++ qual[count].qual = (sta->last_rx_signal - ++ sta->last_rx_silence) * 92 / 64; ++ qual[count].level = sta->last_rx_signal; ++ qual[count].noise = sta->last_rx_silence; + qual[count].updated = sta->last_rx_updated; + + sta->last_rx_updated = IW_QUAL_DBM; +@@ -2407,13 +2407,13 @@ int prism2_ap_translate_scan(struct net_ + memset(&iwe, 0, sizeof(iwe)); + iwe.cmd = IWEVQUAL; + if (sta->last_rx_silence == 0) +- iwe.u.qual.qual = sta->last_rx_signal < 27 ? +- 0 : (sta->last_rx_signal - 27) * 92 / 127; ++ iwe.u.qual.qual = (sta->last_rx_signal -156) == 0 ? ++ 0 : (sta->last_rx_signal - 156) * 92 / 64; + else +- iwe.u.qual.qual = sta->last_rx_signal - +- sta->last_rx_silence - 35; +- iwe.u.qual.level = HFA384X_LEVEL_TO_dBm(sta->last_rx_signal); +- iwe.u.qual.noise = HFA384X_LEVEL_TO_dBm(sta->last_rx_silence); ++ iwe.u.qual.qual = (sta->last_rx_signal - ++ sta->last_rx_silence) * 92 / 64; ++ iwe.u.qual.level = sta->last_rx_signal; ++ iwe.u.qual.noise = sta->last_rx_silence; + iwe.u.qual.updated = sta->last_rx_updated; + iwe.len = IW_EV_QUAL_LEN; + current_ev = iwe_stream_add_event(info, current_ev, end_buf, +--- a/drivers/net/wireless/hostap/hostap_config.h ++++ b/drivers/net/wireless/hostap/hostap_config.h +@@ -45,4 +45,9 @@ + */ + /* #define PRISM2_NO_STATION_MODES */ + ++/* Enable TX power Setting functions ++ * (min att = -128 , max att = 127) ++ */ ++#define RAW_TXPOWER_SETTING ++ + #endif /* HOSTAP_CONFIG_H */ +--- a/drivers/net/wireless/hostap/hostap.h ++++ b/drivers/net/wireless/hostap/hostap.h +@@ -90,6 +90,7 @@ extern const struct iw_handler_def hosta + extern const struct ethtool_ops prism2_ethtool_ops; + + int hostap_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); ++int hostap_restore_power(struct net_device *dev); + + + #endif /* HOSTAP_H */ +--- a/drivers/net/wireless/hostap/hostap_hw.c ++++ b/drivers/net/wireless/hostap/hostap_hw.c +@@ -932,6 +932,7 @@ static int hfa384x_set_rid(struct net_de + prism2_hw_reset(dev); + } + ++ hostap_restore_power(dev); + return res; + } + +--- a/drivers/net/wireless/hostap/hostap_info.c ++++ b/drivers/net/wireless/hostap/hostap_info.c +@@ -432,6 +432,11 @@ static void handle_info_queue_linkstatus + } + + /* Get BSSID if we have a valid AP address */ ++ ++ if ( val == HFA384X_LINKSTATUS_CONNECTED || ++ val == HFA384X_LINKSTATUS_DISCONNECTED ) ++ hostap_restore_power(local->dev); ++ + if (connected) { + netif_carrier_on(local->dev); + netif_carrier_on(local->ddev); +--- a/drivers/net/wireless/hostap/hostap_ioctl.c ++++ b/drivers/net/wireless/hostap/hostap_ioctl.c +@@ -1476,23 +1476,20 @@ static int prism2_txpower_hfa386x_to_dBm + val = 255; + + tmp = val; +- tmp >>= 2; + +- return -12 - tmp; ++ return tmp; + } + + static u16 prism2_txpower_dBm_to_hfa386x(int val) + { + signed char tmp; + +- if (val > 20) +- return 128; +- else if (val < -43) ++ if (val > 127) + return 127; ++ else if (val < -128) ++ return 128; + + tmp = val; +- tmp = -12 - tmp; +- tmp <<= 2; + + return (unsigned char) tmp; + } +@@ -4056,3 +4053,35 @@ int hostap_ioctl(struct net_device *dev, + + return ret; + } ++ ++/* BUG FIX: Restore power setting value when lost due to F/W bug */ ++ ++int hostap_restore_power(struct net_device *dev) ++{ ++ struct hostap_interface *iface = netdev_priv(dev); ++ local_info_t *local = iface->local; ++ ++ u16 val; ++ int ret = 0; ++ ++ if (local->txpower_type == PRISM2_TXPOWER_OFF) { ++ val = 0xff; /* use all standby and sleep modes */ ++ ret = local->func->cmd(dev, HFA384X_CMDCODE_WRITEMIF, ++ HFA386X_CR_A_D_TEST_MODES2, ++ &val, NULL); ++ } ++ ++#ifdef RAW_TXPOWER_SETTING ++ if (local->txpower_type == PRISM2_TXPOWER_FIXED) { ++ val = HFA384X_TEST_CFG_BIT_ALC; ++ local->func->cmd(dev, HFA384X_CMDCODE_TEST | ++ (HFA384X_TEST_CFG_BITS << 8), 0, &val, NULL); ++ val = prism2_txpower_dBm_to_hfa386x(local->txpower); ++ ret = (local->func->cmd(dev, HFA384X_CMDCODE_WRITEMIF, ++ HFA386X_CR_MANUAL_TX_POWER, &val, NULL)); ++ } ++#endif /* RAW_TXPOWER_SETTING */ ++ return (ret ? -EOPNOTSUPP : 0); ++} ++ ++EXPORT_SYMBOL(hostap_restore_power); diff --git a/target/linux/generic-2.6/patches-2.6.32/903-stddef_include.patch b/target/linux/generic-2.6/patches-2.6.32/903-stddef_include.patch new file mode 100644 index 000000000..7fe248d8d --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/903-stddef_include.patch @@ -0,0 +1,17 @@ +--- a/include/linux/stddef.h ++++ b/include/linux/stddef.h +@@ -16,6 +16,7 @@ enum { + false = 0, + true = 1 + }; ++#endif /* __KERNEL__ */ + + #undef offsetof + #ifdef __compiler_offsetof +@@ -23,6 +24,5 @@ enum { + #else + #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) + #endif +-#endif /* __KERNEL__ */ + + #endif diff --git a/target/linux/generic-2.6/patches-2.6.32/905-i386_build.patch b/target/linux/generic-2.6/patches-2.6.32/905-i386_build.patch new file mode 100644 index 000000000..c701fdaa9 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/905-i386_build.patch @@ -0,0 +1,10 @@ +--- a/arch/x86/boot/tools/build.c ++++ b/arch/x86/boot/tools/build.c +@@ -29,7 +29,6 @@ + #include + #include + #include +-#include + #include + #include + #include diff --git a/target/linux/generic-2.6/patches-2.6.32/920-01-hotpluggable-spi-gpio.patch b/target/linux/generic-2.6/patches-2.6.32/920-01-hotpluggable-spi-gpio.patch new file mode 100644 index 000000000..b10bc9a65 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/920-01-hotpluggable-spi-gpio.patch @@ -0,0 +1,60 @@ +Fix spi-gpio for hotplug. + +--mb + + + +--- a/drivers/spi/spi_gpio.c ++++ b/drivers/spi/spi_gpio.c +@@ -218,7 +218,7 @@ static void spi_gpio_cleanup(struct spi_ + spi_bitbang_cleanup(spi); + } + +-static int __init spi_gpio_alloc(unsigned pin, const char *label, bool is_in) ++static int __devinit spi_gpio_alloc(unsigned pin, const char *label, bool is_in) + { + int value; + +@@ -232,7 +232,7 @@ static int __init spi_gpio_alloc(unsigne + return value; + } + +-static int __init ++static int __devinit + spi_gpio_request(struct spi_gpio_platform_data *pdata, const char *label) + { + int value; +@@ -261,7 +261,7 @@ done: + return value; + } + +-static int __init spi_gpio_probe(struct platform_device *pdev) ++static int __devinit spi_gpio_probe(struct platform_device *pdev) + { + int status; + struct spi_master *master; +@@ -317,7 +317,7 @@ gpio_free: + return status; + } + +-static int __exit spi_gpio_remove(struct platform_device *pdev) ++static int __devexit spi_gpio_remove(struct platform_device *pdev) + { + struct spi_gpio *spi_gpio; + struct spi_gpio_platform_data *pdata; +@@ -344,12 +344,13 @@ MODULE_ALIAS("platform:" DRIVER_NAME); + static struct platform_driver spi_gpio_driver = { + .driver.name = DRIVER_NAME, + .driver.owner = THIS_MODULE, +- .remove = __exit_p(spi_gpio_remove), ++ .probe = spi_gpio_probe, ++ .remove = __devexit_p(spi_gpio_remove), + }; + + static int __init spi_gpio_init(void) + { +- return platform_driver_probe(&spi_gpio_driver, spi_gpio_probe); ++ return platform_driver_register(&spi_gpio_driver); + } + module_init(spi_gpio_init); + diff --git a/target/linux/generic-2.6/patches-2.6.32/920-04-spi-gpio-implement-spi-delay.patch b/target/linux/generic-2.6/patches-2.6.32/920-04-spi-gpio-implement-spi-delay.patch new file mode 100644 index 000000000..19032881b --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/920-04-spi-gpio-implement-spi-delay.patch @@ -0,0 +1,58 @@ +Implement the SPI-GPIO delay function for busses that need speed limitation. + +--mb + + + +--- a/drivers/spi/spi_gpio.c ++++ b/drivers/spi/spi_gpio.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -69,6 +70,7 @@ struct spi_gpio { + * #define SPI_MOSI_GPIO 120 + * #define SPI_SCK_GPIO 121 + * #define SPI_N_CHIPSEL 4 ++ * #undef NEED_SPIDELAY + * #include "spi_gpio.c" + */ + +@@ -76,6 +78,7 @@ struct spi_gpio { + #define DRIVER_NAME "spi_gpio" + + #define GENERIC_BITBANG /* vs tight inlines */ ++#define NEED_SPIDELAY 1 + + /* all functions referencing these symbols must define pdata */ + #define SPI_MISO_GPIO ((pdata)->miso) +@@ -120,12 +123,20 @@ static inline int getmiso(const struct s + #undef pdata + + /* +- * NOTE: this clocks "as fast as we can". It "should" be a function of the +- * requested device clock. Software overhead means we usually have trouble +- * reaching even one Mbit/sec (except when we can inline bitops), so for now +- * we'll just assume we never need additional per-bit slowdowns. ++ * NOTE: to clock "as fast as we can", set spi_device.max_speed_hz ++ * and spi_transfer.speed_hz to 0. ++ * Otherwise this is a function of the requested device clock. ++ * Software overhead means we usually have trouble ++ * reaching even one Mbit/sec (except when we can inline bitops). So on small ++ * embedded devices with fast SPI slaves you usually don't need a delay. + */ +-#define spidelay(nsecs) do {} while (0) ++static inline void spidelay(unsigned nsecs) ++{ ++#ifdef NEED_SPIDELAY ++ if (unlikely(nsecs)) ++ ndelay(nsecs); ++#endif /* NEED_SPIDELAY */ ++} + + #define EXPAND_BITBANG_TXRX + #include diff --git a/target/linux/generic-2.6/patches-2.6.32/921-gpio_spi_driver.patch b/target/linux/generic-2.6/patches-2.6.32/921-gpio_spi_driver.patch new file mode 100644 index 000000000..73563f233 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/921-gpio_spi_driver.patch @@ -0,0 +1,366 @@ +THIS CODE IS DEPRECATED. + +Please use the new mainline SPI-GPIO driver, as of 2.6.29. + +--mb + + + +--- /dev/null ++++ b/include/linux/spi/spi_gpio_old.h +@@ -0,0 +1,73 @@ ++/* ++ * spi_gpio interface to platform code ++ * ++ * Copyright (c) 2008 Piotr Skamruk ++ * Copyright (c) 2008 Michael Buesch ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++#ifndef _LINUX_SPI_SPI_GPIO ++#define _LINUX_SPI_SPI_GPIO ++ ++#include ++#include ++ ++ ++/** ++ * struct spi_gpio_platform_data - Data definitions for a SPI-GPIO device. ++ * ++ * This structure holds information about a GPIO-based SPI device. ++ * ++ * @pin_clk: The GPIO pin number of the CLOCK pin. ++ * ++ * @pin_miso: The GPIO pin number of the MISO pin. ++ * ++ * @pin_mosi: The GPIO pin number of the MOSI pin. ++ * ++ * @pin_cs: The GPIO pin number of the CHIPSELECT pin. ++ * ++ * @cs_activelow: If true, the chip is selected when the CS line is low. ++ * ++ * @no_spi_delay: If true, no delay is done in the lowlevel bitbanging. ++ * Note that doing no delay is not standards compliant, ++ * but it might be needed to speed up transfers on some ++ * slow embedded machines. ++ * ++ * @boardinfo_setup: This callback is called after the ++ * SPI master device was registered, but before the ++ * device is registered. ++ * @boardinfo_setup_data: Data argument passed to boardinfo_setup(). ++ */ ++struct spi_gpio_platform_data { ++ unsigned int pin_clk; ++ unsigned int pin_miso; ++ unsigned int pin_mosi; ++ unsigned int pin_cs; ++ bool cs_activelow; ++ bool no_spi_delay; ++ int (*boardinfo_setup)(struct spi_board_info *bi, ++ struct spi_master *master, ++ void *data); ++ void *boardinfo_setup_data; ++}; ++ ++/** ++ * SPI_GPIO_PLATDEV_NAME - The platform device name string. ++ * ++ * The name string that has to be used for platform_device_alloc ++ * when allocating a spi-gpio device. ++ */ ++#define SPI_GPIO_PLATDEV_NAME "spi-gpio" ++ ++/** ++ * spi_gpio_next_id - Get another platform device ID number. ++ * ++ * This returns the next platform device ID number that has to be used ++ * for platform_device_alloc. The ID is opaque and should not be used for ++ * anything else. ++ */ ++int spi_gpio_next_id(void); ++ ++#endif /* _LINUX_SPI_SPI_GPIO */ +--- /dev/null ++++ b/drivers/spi/spi_gpio_old.c +@@ -0,0 +1,251 @@ ++/* ++ * Bitbanging SPI bus driver using GPIO API ++ * ++ * Copyright (c) 2008 Piotr Skamruk ++ * Copyright (c) 2008 Michael Buesch ++ * ++ * based on spi_s3c2410_gpio.c ++ * Copyright (c) 2006 Ben Dooks ++ * Copyright (c) 2006 Simtec Electronics ++ * and on i2c-gpio.c ++ * Copyright (C) 2007 Atmel Corporation ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++ ++struct spi_gpio { ++ struct spi_bitbang bitbang; ++ struct spi_gpio_platform_data *info; ++ struct platform_device *pdev; ++ struct spi_board_info bi; ++}; ++ ++ ++static inline struct spi_gpio *spidev_to_sg(struct spi_device *dev) ++{ ++ return dev->controller_data; ++} ++ ++static inline void setsck(struct spi_device *dev, int val) ++{ ++ struct spi_gpio *sp = spidev_to_sg(dev); ++ gpio_set_value(sp->info->pin_clk, val ? 1 : 0); ++} ++ ++static inline void setmosi(struct spi_device *dev, int val) ++{ ++ struct spi_gpio *sp = spidev_to_sg(dev); ++ gpio_set_value(sp->info->pin_mosi, val ? 1 : 0); ++} ++ ++static inline u32 getmiso(struct spi_device *dev) ++{ ++ struct spi_gpio *sp = spidev_to_sg(dev); ++ return gpio_get_value(sp->info->pin_miso) ? 1 : 0; ++} ++ ++static inline void do_spidelay(struct spi_device *dev, unsigned nsecs) ++{ ++ struct spi_gpio *sp = spidev_to_sg(dev); ++ ++ if (!sp->info->no_spi_delay) ++ ndelay(nsecs); ++} ++ ++#define spidelay(nsecs) do { \ ++ /* Steal the spi_device pointer from our caller. \ ++ * The bitbang-API should probably get fixed here... */ \ ++ do_spidelay(spi, nsecs); \ ++ } while (0) ++ ++#define EXPAND_BITBANG_TXRX ++#include ++ ++static u32 spi_gpio_txrx_mode0(struct spi_device *spi, ++ unsigned nsecs, u32 word, u8 bits) ++{ ++ return bitbang_txrx_be_cpha0(spi, nsecs, 0, word, bits); ++} ++ ++static u32 spi_gpio_txrx_mode1(struct spi_device *spi, ++ unsigned nsecs, u32 word, u8 bits) ++{ ++ return bitbang_txrx_be_cpha1(spi, nsecs, 0, word, bits); ++} ++ ++static u32 spi_gpio_txrx_mode2(struct spi_device *spi, ++ unsigned nsecs, u32 word, u8 bits) ++{ ++ return bitbang_txrx_be_cpha0(spi, nsecs, 1, word, bits); ++} ++ ++static u32 spi_gpio_txrx_mode3(struct spi_device *spi, ++ unsigned nsecs, u32 word, u8 bits) ++{ ++ return bitbang_txrx_be_cpha1(spi, nsecs, 1, word, bits); ++} ++ ++static void spi_gpio_chipselect(struct spi_device *dev, int on) ++{ ++ struct spi_gpio *sp = spidev_to_sg(dev); ++ ++ if (sp->info->cs_activelow) ++ on = !on; ++ gpio_set_value(sp->info->pin_cs, on ? 1 : 0); ++} ++ ++static int spi_gpio_probe(struct platform_device *pdev) ++{ ++ struct spi_master *master; ++ struct spi_gpio_platform_data *pdata; ++ struct spi_gpio *sp; ++ struct spi_device *spidev; ++ int err; ++ ++ pdata = pdev->dev.platform_data; ++ if (!pdata) ++ return -ENXIO; ++ ++ err = -ENOMEM; ++ master = spi_alloc_master(&pdev->dev, sizeof(struct spi_gpio)); ++ if (!master) ++ goto err_alloc_master; ++ ++ sp = spi_master_get_devdata(master); ++ platform_set_drvdata(pdev, sp); ++ sp->info = pdata; ++ ++ err = gpio_request(pdata->pin_clk, "spi_clock"); ++ if (err) ++ goto err_request_clk; ++ err = gpio_request(pdata->pin_mosi, "spi_mosi"); ++ if (err) ++ goto err_request_mosi; ++ err = gpio_request(pdata->pin_miso, "spi_miso"); ++ if (err) ++ goto err_request_miso; ++ err = gpio_request(pdata->pin_cs, "spi_cs"); ++ if (err) ++ goto err_request_cs; ++ ++ sp->bitbang.master = spi_master_get(master); ++ sp->bitbang.master->bus_num = -1; ++ sp->bitbang.master->num_chipselect = 1; ++ sp->bitbang.chipselect = spi_gpio_chipselect; ++ sp->bitbang.txrx_word[SPI_MODE_0] = spi_gpio_txrx_mode0; ++ sp->bitbang.txrx_word[SPI_MODE_1] = spi_gpio_txrx_mode1; ++ sp->bitbang.txrx_word[SPI_MODE_2] = spi_gpio_txrx_mode2; ++ sp->bitbang.txrx_word[SPI_MODE_3] = spi_gpio_txrx_mode3; ++ ++ gpio_direction_output(pdata->pin_clk, 0); ++ gpio_direction_output(pdata->pin_mosi, 0); ++ gpio_direction_output(pdata->pin_cs, ++ pdata->cs_activelow ? 1 : 0); ++ gpio_direction_input(pdata->pin_miso); ++ ++ err = spi_bitbang_start(&sp->bitbang); ++ if (err) ++ goto err_no_bitbang; ++ err = pdata->boardinfo_setup(&sp->bi, master, ++ pdata->boardinfo_setup_data); ++ if (err) ++ goto err_bi_setup; ++ sp->bi.controller_data = sp; ++ spidev = spi_new_device(master, &sp->bi); ++ if (!spidev) ++ goto err_new_dev; ++ ++ return 0; ++ ++err_new_dev: ++err_bi_setup: ++ spi_bitbang_stop(&sp->bitbang); ++err_no_bitbang: ++ spi_master_put(sp->bitbang.master); ++ gpio_free(pdata->pin_cs); ++err_request_cs: ++ gpio_free(pdata->pin_miso); ++err_request_miso: ++ gpio_free(pdata->pin_mosi); ++err_request_mosi: ++ gpio_free(pdata->pin_clk); ++err_request_clk: ++ kfree(master); ++ ++err_alloc_master: ++ return err; ++} ++ ++static int __devexit spi_gpio_remove(struct platform_device *pdev) ++{ ++ struct spi_gpio *sp; ++ struct spi_gpio_platform_data *pdata; ++ ++ pdata = pdev->dev.platform_data; ++ sp = platform_get_drvdata(pdev); ++ ++ gpio_free(pdata->pin_clk); ++ gpio_free(pdata->pin_mosi); ++ gpio_free(pdata->pin_miso); ++ gpio_free(pdata->pin_cs); ++ spi_bitbang_stop(&sp->bitbang); ++ spi_master_put(sp->bitbang.master); ++ ++ return 0; ++} ++ ++static struct platform_driver spi_gpio_driver = { ++ .driver = { ++ .name = SPI_GPIO_PLATDEV_NAME, ++ .owner = THIS_MODULE, ++ }, ++ .probe = spi_gpio_probe, ++ .remove = __devexit_p(spi_gpio_remove), ++}; ++ ++int spi_gpio_next_id(void) ++{ ++ static atomic_t counter = ATOMIC_INIT(-1); ++ ++ return atomic_inc_return(&counter); ++} ++EXPORT_SYMBOL(spi_gpio_next_id); ++ ++static int __init spi_gpio_init(void) ++{ ++ int err; ++ ++ err = platform_driver_register(&spi_gpio_driver); ++ if (err) ++ printk(KERN_ERR "spi-gpio: register failed: %d\n", err); ++ ++ return err; ++} ++module_init(spi_gpio_init); ++ ++static void __exit spi_gpio_exit(void) ++{ ++ platform_driver_unregister(&spi_gpio_driver); ++} ++module_exit(spi_gpio_exit); ++ ++MODULE_AUTHOR("Piot Skamruk "); ++MODULE_AUTHOR("Michael Buesch"); ++MODULE_DESCRIPTION("Platform independent GPIO bitbanging SPI driver"); ++MODULE_LICENSE("GPL v2"); +--- a/drivers/spi/Kconfig ++++ b/drivers/spi/Kconfig +@@ -116,6 +116,15 @@ config SPI_GPIO + GPIO operations, you should be able to leverage that for better + speed with a custom version of this driver; see the source code. + ++config SPI_GPIO_OLD ++ tristate "Old GPIO API based bitbanging SPI controller (DEPRECATED)" ++ depends on SPI_MASTER && GENERIC_GPIO ++ select SPI_BITBANG ++ help ++ This code is deprecated. Please use the new mainline SPI-GPIO driver. ++ ++ If unsure, say N. ++ + config SPI_IMX + tristate "Freescale i.MX SPI controllers" + depends on ARCH_MXC +--- a/drivers/spi/Makefile ++++ b/drivers/spi/Makefile +@@ -17,6 +17,7 @@ obj-$(CONFIG_SPI_BITBANG) += spi_bitban + obj-$(CONFIG_SPI_AU1550) += au1550_spi.o + obj-$(CONFIG_SPI_BUTTERFLY) += spi_butterfly.o + obj-$(CONFIG_SPI_GPIO) += spi_gpio.o ++obj-$(CONFIG_SPI_GPIO_OLD) += spi_gpio_old.o + obj-$(CONFIG_SPI_IMX) += spi_imx.o + obj-$(CONFIG_SPI_LM70_LLP) += spi_lm70llp.o + obj-$(CONFIG_SPI_PXA2XX) += pxa2xx_spi.o diff --git a/target/linux/generic-2.6/patches-2.6.32/922-gpiommc.patch b/target/linux/generic-2.6/patches-2.6.32/922-gpiommc.patch new file mode 100644 index 000000000..4fdf7bbc6 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/922-gpiommc.patch @@ -0,0 +1,843 @@ +--- /dev/null ++++ b/drivers/mmc/host/gpiommc.c +@@ -0,0 +1,608 @@ ++/* ++ * Driver an MMC/SD card on a bitbanging GPIO SPI bus. ++ * This module hooks up the mmc_spi and spi_gpio modules and also ++ * provides a configfs interface. ++ * ++ * Copyright 2008 Michael Buesch ++ * ++ * Licensed under the GNU/GPL. See COPYING for details. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++ ++#define PFX "gpio-mmc: " ++ ++ ++struct gpiommc_device { ++ struct platform_device *pdev; ++ struct platform_device *spi_pdev; ++ struct spi_board_info boardinfo; ++}; ++ ++ ++MODULE_DESCRIPTION("GPIO based MMC driver"); ++MODULE_AUTHOR("Michael Buesch"); ++MODULE_LICENSE("GPL"); ++ ++ ++static int gpiommc_boardinfo_setup(struct spi_board_info *bi, ++ struct spi_master *master, ++ void *data) ++{ ++ struct gpiommc_device *d = data; ++ struct gpiommc_platform_data *pdata = d->pdev->dev.platform_data; ++ ++ /* Bind the SPI master to the MMC-SPI host driver. */ ++ strlcpy(bi->modalias, "mmc_spi", sizeof(bi->modalias)); ++ ++ bi->max_speed_hz = pdata->max_bus_speed; ++ bi->bus_num = master->bus_num; ++ bi->mode = pdata->mode; ++ ++ return 0; ++} ++ ++static int gpiommc_probe(struct platform_device *pdev) ++{ ++ struct gpiommc_platform_data *mmc_pdata = pdev->dev.platform_data; ++ struct spi_gpio_platform_data spi_pdata; ++ struct gpiommc_device *d; ++ int err; ++ ++ err = -ENXIO; ++ if (!mmc_pdata) ++ goto error; ++ ++#ifdef CONFIG_MMC_SPI_MODULE ++ err = request_module("mmc_spi"); ++ if (err) { ++ printk(KERN_WARNING PFX ++ "Failed to request mmc_spi module.\n"); ++ } ++#endif /* CONFIG_MMC_SPI_MODULE */ ++ ++ /* Allocate the GPIO-MMC device */ ++ err = -ENOMEM; ++ d = kzalloc(sizeof(*d), GFP_KERNEL); ++ if (!d) ++ goto error; ++ d->pdev = pdev; ++ ++ /* Create the SPI-GPIO device */ ++ d->spi_pdev = platform_device_alloc(SPI_GPIO_PLATDEV_NAME, ++ spi_gpio_next_id()); ++ if (!d->spi_pdev) ++ goto err_free_d; ++ ++ memset(&spi_pdata, 0, sizeof(spi_pdata)); ++ spi_pdata.pin_clk = mmc_pdata->pins.gpio_clk; ++ spi_pdata.pin_miso = mmc_pdata->pins.gpio_do; ++ spi_pdata.pin_mosi = mmc_pdata->pins.gpio_di; ++ spi_pdata.pin_cs = mmc_pdata->pins.gpio_cs; ++ spi_pdata.cs_activelow = mmc_pdata->pins.cs_activelow; ++ spi_pdata.no_spi_delay = mmc_pdata->no_spi_delay; ++ spi_pdata.boardinfo_setup = gpiommc_boardinfo_setup; ++ spi_pdata.boardinfo_setup_data = d; ++ ++ err = platform_device_add_data(d->spi_pdev, &spi_pdata, ++ sizeof(spi_pdata)); ++ if (err) ++ goto err_free_pdev; ++ err = platform_device_add(d->spi_pdev); ++ if (err) ++ goto err_free_pdata; ++ platform_set_drvdata(pdev, d); ++ ++ printk(KERN_INFO PFX "MMC-Card \"%s\" " ++ "attached to GPIO pins di=%u, do=%u, clk=%u, cs=%u\n", ++ mmc_pdata->name, mmc_pdata->pins.gpio_di, ++ mmc_pdata->pins.gpio_do, ++ mmc_pdata->pins.gpio_clk, ++ mmc_pdata->pins.gpio_cs); ++ ++ return 0; ++ ++err_free_pdata: ++ kfree(d->spi_pdev->dev.platform_data); ++ d->spi_pdev->dev.platform_data = NULL; ++err_free_pdev: ++ platform_device_put(d->spi_pdev); ++err_free_d: ++ kfree(d); ++error: ++ return err; ++} ++ ++static int gpiommc_remove(struct platform_device *pdev) ++{ ++ struct gpiommc_device *d = platform_get_drvdata(pdev); ++ struct gpiommc_platform_data *pdata = d->pdev->dev.platform_data; ++ ++ platform_device_unregister(d->spi_pdev); ++ printk(KERN_INFO PFX "GPIO based MMC-Card \"%s\" removed\n", ++ pdata->name); ++ platform_device_put(d->spi_pdev); ++ ++ return 0; ++} ++ ++#ifdef CONFIG_GPIOMMC_CONFIGFS ++ ++/* A device that was created through configfs */ ++struct gpiommc_configfs_device { ++ struct config_item item; ++ /* The platform device, after registration. */ ++ struct platform_device *pdev; ++ /* The configuration */ ++ struct gpiommc_platform_data pdata; ++}; ++ ++#define GPIO_INVALID -1 ++ ++static inline bool gpiommc_is_registered(struct gpiommc_configfs_device *dev) ++{ ++ return (dev->pdev != NULL); ++} ++ ++static inline struct gpiommc_configfs_device *ci_to_gpiommc(struct config_item *item) ++{ ++ return item ? container_of(item, struct gpiommc_configfs_device, item) : NULL; ++} ++ ++static struct configfs_attribute gpiommc_attr_DI = { ++ .ca_owner = THIS_MODULE, ++ .ca_name = "gpio_data_in", ++ .ca_mode = S_IRUGO | S_IWUSR, ++}; ++ ++static struct configfs_attribute gpiommc_attr_DO = { ++ .ca_owner = THIS_MODULE, ++ .ca_name = "gpio_data_out", ++ .ca_mode = S_IRUGO | S_IWUSR, ++}; ++ ++static struct configfs_attribute gpiommc_attr_CLK = { ++ .ca_owner = THIS_MODULE, ++ .ca_name = "gpio_clock", ++ .ca_mode = S_IRUGO | S_IWUSR, ++}; ++ ++static struct configfs_attribute gpiommc_attr_CS = { ++ .ca_owner = THIS_MODULE, ++ .ca_name = "gpio_chipselect", ++ .ca_mode = S_IRUGO | S_IWUSR, ++}; ++ ++static struct configfs_attribute gpiommc_attr_CS_activelow = { ++ .ca_owner = THIS_MODULE, ++ .ca_name = "gpio_chipselect_activelow", ++ .ca_mode = S_IRUGO | S_IWUSR, ++}; ++ ++static struct configfs_attribute gpiommc_attr_spimode = { ++ .ca_owner = THIS_MODULE, ++ .ca_name = "spi_mode", ++ .ca_mode = S_IRUGO | S_IWUSR, ++}; ++ ++static struct configfs_attribute gpiommc_attr_spidelay = { ++ .ca_owner = THIS_MODULE, ++ .ca_name = "spi_delay", ++ .ca_mode = S_IRUGO | S_IWUSR, ++}; ++ ++static struct configfs_attribute gpiommc_attr_max_bus_speed = { ++ .ca_owner = THIS_MODULE, ++ .ca_name = "max_bus_speed", ++ .ca_mode = S_IRUGO | S_IWUSR, ++}; ++ ++static struct configfs_attribute gpiommc_attr_register = { ++ .ca_owner = THIS_MODULE, ++ .ca_name = "register", ++ .ca_mode = S_IRUGO | S_IWUSR, ++}; ++ ++static struct configfs_attribute *gpiommc_config_attrs[] = { ++ &gpiommc_attr_DI, ++ &gpiommc_attr_DO, ++ &gpiommc_attr_CLK, ++ &gpiommc_attr_CS, ++ &gpiommc_attr_CS_activelow, ++ &gpiommc_attr_spimode, ++ &gpiommc_attr_spidelay, ++ &gpiommc_attr_max_bus_speed, ++ &gpiommc_attr_register, ++ NULL, ++}; ++ ++static ssize_t gpiommc_config_attr_show(struct config_item *item, ++ struct configfs_attribute *attr, ++ char *page) ++{ ++ struct gpiommc_configfs_device *dev = ci_to_gpiommc(item); ++ ssize_t count = 0; ++ unsigned int gpio; ++ int err = 0; ++ ++ if (attr == &gpiommc_attr_DI) { ++ gpio = dev->pdata.pins.gpio_di; ++ if (gpio == GPIO_INVALID) ++ count = snprintf(page, PAGE_SIZE, "not configured\n"); ++ else ++ count = snprintf(page, PAGE_SIZE, "%u\n", gpio); ++ goto out; ++ } ++ if (attr == &gpiommc_attr_DO) { ++ gpio = dev->pdata.pins.gpio_do; ++ if (gpio == GPIO_INVALID) ++ count = snprintf(page, PAGE_SIZE, "not configured\n"); ++ else ++ count = snprintf(page, PAGE_SIZE, "%u\n", gpio); ++ goto out; ++ } ++ if (attr == &gpiommc_attr_CLK) { ++ gpio = dev->pdata.pins.gpio_clk; ++ if (gpio == GPIO_INVALID) ++ count = snprintf(page, PAGE_SIZE, "not configured\n"); ++ else ++ count = snprintf(page, PAGE_SIZE, "%u\n", gpio); ++ goto out; ++ } ++ if (attr == &gpiommc_attr_CS) { ++ gpio = dev->pdata.pins.gpio_cs; ++ if (gpio == GPIO_INVALID) ++ count = snprintf(page, PAGE_SIZE, "not configured\n"); ++ else ++ count = snprintf(page, PAGE_SIZE, "%u\n", gpio); ++ goto out; ++ } ++ if (attr == &gpiommc_attr_CS_activelow) { ++ count = snprintf(page, PAGE_SIZE, "%u\n", ++ dev->pdata.pins.cs_activelow); ++ goto out; ++ } ++ if (attr == &gpiommc_attr_spimode) { ++ count = snprintf(page, PAGE_SIZE, "%u\n", ++ dev->pdata.mode); ++ goto out; ++ } ++ if (attr == &gpiommc_attr_spidelay) { ++ count = snprintf(page, PAGE_SIZE, "%u\n", ++ !dev->pdata.no_spi_delay); ++ goto out; ++ } ++ if (attr == &gpiommc_attr_max_bus_speed) { ++ count = snprintf(page, PAGE_SIZE, "%u\n", ++ dev->pdata.max_bus_speed); ++ goto out; ++ } ++ if (attr == &gpiommc_attr_register) { ++ count = snprintf(page, PAGE_SIZE, "%u\n", ++ gpiommc_is_registered(dev)); ++ goto out; ++ } ++ WARN_ON(1); ++ err = -ENOSYS; ++out: ++ return err ? err : count; ++} ++ ++static int gpiommc_do_register(struct gpiommc_configfs_device *dev, ++ const char *name) ++{ ++ int err; ++ ++ if (gpiommc_is_registered(dev)) ++ return 0; ++ ++ if (!gpio_is_valid(dev->pdata.pins.gpio_di) || ++ !gpio_is_valid(dev->pdata.pins.gpio_do) || ++ !gpio_is_valid(dev->pdata.pins.gpio_clk) || ++ !gpio_is_valid(dev->pdata.pins.gpio_cs)) { ++ printk(KERN_ERR PFX ++ "configfs: Invalid GPIO pin number(s)\n"); ++ return -EINVAL; ++ } ++ ++ strlcpy(dev->pdata.name, name, ++ sizeof(dev->pdata.name)); ++ ++ dev->pdev = platform_device_alloc(GPIOMMC_PLATDEV_NAME, ++ gpiommc_next_id()); ++ if (!dev->pdev) ++ return -ENOMEM; ++ err = platform_device_add_data(dev->pdev, &dev->pdata, ++ sizeof(dev->pdata)); ++ if (err) { ++ platform_device_put(dev->pdev); ++ return err; ++ } ++ err = platform_device_add(dev->pdev); ++ if (err) { ++ platform_device_put(dev->pdev); ++ return err; ++ } ++ ++ return 0; ++} ++ ++static void gpiommc_do_unregister(struct gpiommc_configfs_device *dev) ++{ ++ if (!gpiommc_is_registered(dev)) ++ return; ++ ++ platform_device_unregister(dev->pdev); ++ dev->pdev = NULL; ++} ++ ++static ssize_t gpiommc_config_attr_store(struct config_item *item, ++ struct configfs_attribute *attr, ++ const char *page, size_t count) ++{ ++ struct gpiommc_configfs_device *dev = ci_to_gpiommc(item); ++ int err = -EINVAL; ++ unsigned long data; ++ ++ if (attr == &gpiommc_attr_register) { ++ err = strict_strtoul(page, 10, &data); ++ if (err) ++ goto out; ++ err = -EINVAL; ++ if (data == 1) ++ err = gpiommc_do_register(dev, item->ci_name); ++ if (data == 0) { ++ gpiommc_do_unregister(dev); ++ err = 0; ++ } ++ goto out; ++ } ++ ++ if (gpiommc_is_registered(dev)) { ++ /* The rest of the config parameters can only be set ++ * as long as the device is not registered, yet. */ ++ err = -EBUSY; ++ goto out; ++ } ++ ++ if (attr == &gpiommc_attr_DI) { ++ err = strict_strtoul(page, 10, &data); ++ if (err) ++ goto out; ++ err = -EINVAL; ++ if (!gpio_is_valid(data)) ++ goto out; ++ dev->pdata.pins.gpio_di = data; ++ err = 0; ++ goto out; ++ } ++ if (attr == &gpiommc_attr_DO) { ++ err = strict_strtoul(page, 10, &data); ++ if (err) ++ goto out; ++ err = -EINVAL; ++ if (!gpio_is_valid(data)) ++ goto out; ++ dev->pdata.pins.gpio_do = data; ++ err = 0; ++ goto out; ++ } ++ if (attr == &gpiommc_attr_CLK) { ++ err = strict_strtoul(page, 10, &data); ++ if (err) ++ goto out; ++ err = -EINVAL; ++ if (!gpio_is_valid(data)) ++ goto out; ++ dev->pdata.pins.gpio_clk = data; ++ err = 0; ++ goto out; ++ } ++ if (attr == &gpiommc_attr_CS) { ++ err = strict_strtoul(page, 10, &data); ++ if (err) ++ goto out; ++ err = -EINVAL; ++ if (!gpio_is_valid(data)) ++ goto out; ++ dev->pdata.pins.gpio_cs = data; ++ err = 0; ++ goto out; ++ } ++ if (attr == &gpiommc_attr_CS_activelow) { ++ err = strict_strtoul(page, 10, &data); ++ if (err) ++ goto out; ++ err = -EINVAL; ++ if (data != 0 && data != 1) ++ goto out; ++ dev->pdata.pins.cs_activelow = data; ++ err = 0; ++ goto out; ++ } ++ if (attr == &gpiommc_attr_spimode) { ++ err = strict_strtoul(page, 10, &data); ++ if (err) ++ goto out; ++ err = -EINVAL; ++ switch (data) { ++ case 0: ++ dev->pdata.mode = SPI_MODE_0; ++ break; ++ case 1: ++ dev->pdata.mode = SPI_MODE_1; ++ break; ++ case 2: ++ dev->pdata.mode = SPI_MODE_2; ++ break; ++ case 3: ++ dev->pdata.mode = SPI_MODE_3; ++ break; ++ default: ++ goto out; ++ } ++ err = 0; ++ goto out; ++ } ++ if (attr == &gpiommc_attr_spidelay) { ++ err = strict_strtoul(page, 10, &data); ++ if (err) ++ goto out; ++ err = -EINVAL; ++ if (data != 0 && data != 1) ++ goto out; ++ dev->pdata.no_spi_delay = !data; ++ err = 0; ++ goto out; ++ } ++ if (attr == &gpiommc_attr_max_bus_speed) { ++ err = strict_strtoul(page, 10, &data); ++ if (err) ++ goto out; ++ err = -EINVAL; ++ if (data > UINT_MAX) ++ goto out; ++ dev->pdata.max_bus_speed = data; ++ err = 0; ++ goto out; ++ } ++ WARN_ON(1); ++ err = -ENOSYS; ++out: ++ return err ? err : count; ++} ++ ++static void gpiommc_config_item_release(struct config_item *item) ++{ ++ struct gpiommc_configfs_device *dev = ci_to_gpiommc(item); ++ ++ kfree(dev); ++} ++ ++static struct configfs_item_operations gpiommc_config_item_ops = { ++ .release = gpiommc_config_item_release, ++ .show_attribute = gpiommc_config_attr_show, ++ .store_attribute = gpiommc_config_attr_store, ++}; ++ ++static struct config_item_type gpiommc_dev_ci_type = { ++ .ct_item_ops = &gpiommc_config_item_ops, ++ .ct_attrs = gpiommc_config_attrs, ++ .ct_owner = THIS_MODULE, ++}; ++ ++static struct config_item *gpiommc_make_item(struct config_group *group, ++ const char *name) ++{ ++ struct gpiommc_configfs_device *dev; ++ ++ if (strlen(name) > GPIOMMC_MAX_NAMELEN) { ++ printk(KERN_ERR PFX "configfs: device name too long\n"); ++ return NULL; ++ } ++ ++ dev = kzalloc(sizeof(*dev), GFP_KERNEL); ++ if (!dev) ++ return NULL; ++ ++ config_item_init_type_name(&dev->item, name, ++ &gpiommc_dev_ci_type); ++ ++ /* Assign default configuration */ ++ dev->pdata.pins.gpio_di = GPIO_INVALID; ++ dev->pdata.pins.gpio_do = GPIO_INVALID; ++ dev->pdata.pins.gpio_clk = GPIO_INVALID; ++ dev->pdata.pins.gpio_cs = GPIO_INVALID; ++ dev->pdata.pins.cs_activelow = 1; ++ dev->pdata.mode = SPI_MODE_0; ++ dev->pdata.no_spi_delay = 0; ++ dev->pdata.max_bus_speed = 5000000; /* 5 MHz */ ++ ++ return &(dev->item); ++} ++ ++static void gpiommc_drop_item(struct config_group *group, ++ struct config_item *item) ++{ ++ struct gpiommc_configfs_device *dev = ci_to_gpiommc(item); ++ ++ gpiommc_do_unregister(dev); ++ kfree(dev); ++} ++ ++static struct configfs_group_operations gpiommc_ct_group_ops = { ++ .make_item = gpiommc_make_item, ++ .drop_item = gpiommc_drop_item, ++}; ++ ++static struct config_item_type gpiommc_ci_type = { ++ .ct_group_ops = &gpiommc_ct_group_ops, ++ .ct_owner = THIS_MODULE, ++}; ++ ++static struct configfs_subsystem gpiommc_subsys = { ++ .su_group = { ++ .cg_item = { ++ .ci_namebuf = GPIOMMC_PLATDEV_NAME, ++ .ci_type = &gpiommc_ci_type, ++ }, ++ }, ++ .su_mutex = __MUTEX_INITIALIZER(gpiommc_subsys.su_mutex), ++}; ++ ++#endif /* CONFIG_GPIOMMC_CONFIGFS */ ++ ++static struct platform_driver gpiommc_plat_driver = { ++ .probe = gpiommc_probe, ++ .remove = gpiommc_remove, ++ .driver = { ++ .name = GPIOMMC_PLATDEV_NAME, ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++int gpiommc_next_id(void) ++{ ++ static atomic_t counter = ATOMIC_INIT(-1); ++ ++ return atomic_inc_return(&counter); ++} ++EXPORT_SYMBOL(gpiommc_next_id); ++ ++static int __init gpiommc_modinit(void) ++{ ++ int err; ++ ++ err = platform_driver_register(&gpiommc_plat_driver); ++ if (err) ++ return err; ++ ++#ifdef CONFIG_GPIOMMC_CONFIGFS ++ config_group_init(&gpiommc_subsys.su_group); ++ err = configfs_register_subsystem(&gpiommc_subsys); ++ if (err) { ++ platform_driver_unregister(&gpiommc_plat_driver); ++ return err; ++ } ++#endif /* CONFIG_GPIOMMC_CONFIGFS */ ++ ++ return 0; ++} ++module_init(gpiommc_modinit); ++ ++static void __exit gpiommc_modexit(void) ++{ ++#ifdef CONFIG_GPIOMMC_CONFIGFS ++ configfs_unregister_subsystem(&gpiommc_subsys); ++#endif ++ platform_driver_unregister(&gpiommc_plat_driver); ++} ++module_exit(gpiommc_modexit); +--- a/drivers/mmc/host/Kconfig ++++ b/drivers/mmc/host/Kconfig +@@ -334,6 +334,31 @@ config MMC_TMIO + This provides support for the SD/MMC cell found in TC6393XB, + T7L66XB and also HTC ASIC3 + ++config GPIOMMC ++ tristate "MMC/SD over GPIO-based SPI" ++ depends on MMC && MMC_SPI && SPI_GPIO ++ help ++ This driver hooks up the mmc_spi and spi_gpio modules so that ++ MMC/SD cards can be used on a GPIO based bus by bitbanging ++ the SPI protocol in software. ++ ++ This driver provides a configfs interface to dynamically create ++ and destroy GPIO-based MMC/SD card devices. It also provides ++ a platform device interface API. ++ See Documentation/gpiommc.txt for details. ++ ++ The module will be called gpiommc. ++ ++ If unsure, say N. ++ ++config GPIOMMC_CONFIGFS ++ bool ++ depends on GPIOMMC && CONFIGFS_FS ++ default y ++ help ++ This option automatically enables configfs support for gpiommc ++ if configfs is available. ++ + config MMC_CB710 + tristate "ENE CB710 MMC/SD Interface support" + depends on PCI +--- a/drivers/mmc/host/Makefile ++++ b/drivers/mmc/host/Makefile +@@ -34,6 +34,7 @@ obj-$(CONFIG_MMC_SDRICOH_CS) += sdricoh_ + obj-$(CONFIG_MMC_TMIO) += tmio_mmc.o + obj-$(CONFIG_MMC_CB710) += cb710-mmc.o + obj-$(CONFIG_MMC_VIA_SDMMC) += via-sdmmc.o ++obj-$(CONFIG_GPIOMMC) += gpiommc.o + + ifeq ($(CONFIG_CB710_DEBUG),y) + CFLAGS-cb710-mmc += -DDEBUG +--- /dev/null ++++ b/include/linux/mmc/gpiommc.h +@@ -0,0 +1,71 @@ ++/* ++ * Device driver for MMC/SD cards driven over a GPIO bus. ++ * ++ * Copyright (c) 2008 Michael Buesch ++ * ++ * Licensed under the GNU/GPL version 2. ++ */ ++#ifndef LINUX_GPIOMMC_H_ ++#define LINUX_GPIOMMC_H_ ++ ++#include ++ ++ ++#define GPIOMMC_MAX_NAMELEN 15 ++#define GPIOMMC_MAX_NAMELEN_STR __stringify(GPIOMMC_MAX_NAMELEN) ++ ++/** ++ * struct gpiommc_pins - Hardware pin assignments ++ * ++ * @gpio_di: The GPIO number of the DATA IN pin ++ * @gpio_do: The GPIO number of the DATA OUT pin ++ * @gpio_clk: The GPIO number of the CLOCK pin ++ * @gpio_cs: The GPIO number of the CHIPSELECT pin ++ * @cs_activelow: If true, the chip is considered selected if @gpio_cs is low. ++ */ ++struct gpiommc_pins { ++ unsigned int gpio_di; ++ unsigned int gpio_do; ++ unsigned int gpio_clk; ++ unsigned int gpio_cs; ++ bool cs_activelow; ++}; ++ ++/** ++ * struct gpiommc_platform_data - Platform data for a MMC-over-SPI-GPIO device. ++ * ++ * @name: The unique name string of the device. ++ * @pins: The hardware pin assignments. ++ * @mode: The hardware mode. This is either SPI_MODE_0, ++ * SPI_MODE_1, SPI_MODE_2 or SPI_MODE_3. See the SPI documentation. ++ * @no_spi_delay: Do not use delays in the lowlevel SPI bitbanging code. ++ * This is not standards compliant, but may be required for some ++ * embedded machines to gain reasonable speed. ++ * @max_bus_speed: The maximum speed of the SPI bus, in Hertz. ++ */ ++struct gpiommc_platform_data { ++ char name[GPIOMMC_MAX_NAMELEN + 1]; ++ struct gpiommc_pins pins; ++ u8 mode; ++ bool no_spi_delay; ++ unsigned int max_bus_speed; ++}; ++ ++/** ++ * GPIOMMC_PLATDEV_NAME - The platform device name string. ++ * ++ * The name string that has to be used for platform_device_alloc ++ * when allocating a gpiommc device. ++ */ ++#define GPIOMMC_PLATDEV_NAME "gpiommc" ++ ++/** ++ * gpiommc_next_id - Get another platform device ID number. ++ * ++ * This returns the next platform device ID number that has to be used ++ * for platform_device_alloc. The ID is opaque and should not be used for ++ * anything else. ++ */ ++int gpiommc_next_id(void); ++ ++#endif /* LINUX_GPIOMMC_H_ */ +--- /dev/null ++++ b/Documentation/gpiommc.txt +@@ -0,0 +1,97 @@ ++GPIOMMC - Driver for an MMC/SD card on a bitbanging GPIO SPI bus ++================================================================ ++ ++The gpiommc module hooks up the mmc_spi and spi_gpio modules for running an ++MMC or SD card on GPIO pins. ++ ++Two interfaces for registering a new MMC/SD card device are provided: ++A static platform-device based mechanism and a dynamic configfs based interface. ++ ++ ++Registering devices via platform-device ++======================================= ++ ++The platform-device interface is used for registering MMC/SD devices that are ++part of the hardware platform. This is most useful only for embedded machines ++with MMC/SD devices statically connected to the platform GPIO bus. ++ ++The data structures are declared in . ++ ++To register a new device, define an instance of struct gpiommc_platform_data. ++This structure holds any information about how the device is hooked up to the ++GPIO pins and what hardware modes the device supports. See the docbook-style ++documentation in the header file for more information on the struct fields. ++ ++Then allocate a new instance of a platform device by doing: ++ ++ pdev = platform_device_alloc(GPIOMMC_PLATDEV_NAME, gpiommc_next_id()); ++ ++This will allocate the platform device data structures and hook it up to the ++gpiommc driver. ++Then add the gpiommc_platform_data to the platform device. ++ ++ err = platform_device_add_data(pdev, pdata, sizeof(struct gpiommc_platform_data)); ++ ++You may free the local instance of struct gpiommc_platform_data now. (So the ++struct may be allocated on the stack, too). ++Now simply register the platform device. ++ ++ err = platform_device_add(pdev); ++ ++Done. The gpiommc probe routine will be invoked now and you should see a kernel ++log message for the added device. ++ ++ ++Registering devices via configfs ++================================ ++ ++MMC/SD cards connected via GPIO often are a pretty dynamic thing, as for example ++selfmade hacks for soldering an MMC/SD card to standard GPIO pins on embedded ++hardware are a common situation. ++So we provide a dynamic interface to conveniently handle adding and removing ++devices from userspace, without the need to recompile the kernel. ++ ++The "gpiommc" subdirectory at the configfs mountpoint is used for handling ++the dynamic configuration. ++ ++To create a new device, it must first be allocated with mkdir. ++The following command will allocate a device named "my_mmc": ++ mkdir /config/gpiommc/my_mmc ++ ++There are several configuration files available in the new ++/config/gpiommc/my_mmc/ directory: ++ ++gpio_data_in = The SPI data-IN GPIO pin number. ++gpio_data_out = The SPI data-OUT GPIO pin number. ++gpio_clock = The SPI Clock GPIO pin number. ++gpio_chipselect = The SPI Chipselect GPIO pin number. ++gpio_chipselect_activelow = Boolean. If 0, Chipselect is active-HIGH. ++ If 1, Chipselect is active-LOW. ++spi_mode = The SPI data mode. Can be 0-3. ++spi_delay = Enable all delays in the lowlevel bitbanging. ++max_bus_speed = The maximum SPI bus speed. In Hertz. ++ ++register = Not a configuration parameter. ++ Used to register the configured card ++ with the kernel. ++ ++The device must first get configured and then registered by writing "1" to ++the "register" file. ++The configuration parameters "gpio_data_in", "gpio_data_out", "gpio_clock" ++and "gpio_chipselect" are essential and _must_ be configured before writing ++"1" to the "register" file. The registration will fail, otherwise. ++ ++The default values for the other parameters are: ++gpio_chipselect_activelow = 1 (CS active-LOW) ++spi_mode = 0 (SPI_MODE_0) ++spi_delay = 1 (enabled) ++max_bus_speed = 5000000 (5 Mhz) ++ ++Configuration values can not be changed after registration. To unregister ++the device, write a "0" to the "register" file. The configuration can be ++changed again after unregistering. ++ ++To completely remove the device, simply rmdir the directory ++(/config/gpiommc/my_mmc in this example). ++There's no need to first unregister the device before removing it. That will ++be done automatically. +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -2354,6 +2354,11 @@ T: git git://git.kernel.org/pub/scm/linu + S: Maintained + F: drivers/media/video/gspca/ + ++GPIOMMC DRIVER ++P: Michael Buesch ++M: mb@bu3sch.de ++S: Maintained ++ + HARDWARE MONITORING + L: lm-sensors@lm-sensors.org + W: http://www.lm-sensors.org/ diff --git a/target/linux/generic-2.6/patches-2.6.32/923-gpiommc-configfs-locking.patch b/target/linux/generic-2.6/patches-2.6.32/923-gpiommc-configfs-locking.patch new file mode 100644 index 000000000..2e4e820b2 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/923-gpiommc-configfs-locking.patch @@ -0,0 +1,58 @@ +The gpiommc configfs context structure needs locking, as configfs +does not lock access between files. + +--- a/drivers/mmc/host/gpiommc.c ++++ b/drivers/mmc/host/gpiommc.c +@@ -143,6 +143,8 @@ struct gpiommc_configfs_device { + struct platform_device *pdev; + /* The configuration */ + struct gpiommc_platform_data pdata; ++ /* Mutex to protect this structure */ ++ struct mutex mutex; + }; + + #define GPIO_INVALID -1 +@@ -233,6 +235,8 @@ static ssize_t gpiommc_config_attr_show( + unsigned int gpio; + int err = 0; + ++ mutex_lock(&dev->mutex); ++ + if (attr == &gpiommc_attr_DI) { + gpio = dev->pdata.pins.gpio_di; + if (gpio == GPIO_INVALID) +@@ -293,6 +297,8 @@ static ssize_t gpiommc_config_attr_show( + WARN_ON(1); + err = -ENOSYS; + out: ++ mutex_unlock(&dev->mutex); ++ + return err ? err : count; + } + +@@ -352,6 +358,8 @@ static ssize_t gpiommc_config_attr_store + int err = -EINVAL; + unsigned long data; + ++ mutex_lock(&dev->mutex); ++ + if (attr == &gpiommc_attr_register) { + err = strict_strtoul(page, 10, &data); + if (err) +@@ -477,6 +485,8 @@ static ssize_t gpiommc_config_attr_store + WARN_ON(1); + err = -ENOSYS; + out: ++ mutex_unlock(&dev->mutex); ++ + return err ? err : count; + } + +@@ -513,6 +523,7 @@ static struct config_item *gpiommc_make_ + if (!dev) + return NULL; + ++ mutex_init(&dev->mutex); + config_item_init_type_name(&dev->item, name, + &gpiommc_dev_ci_type); + diff --git a/target/linux/generic-2.6/patches-2.6.32/924-cs5535_gpio.patch b/target/linux/generic-2.6/patches-2.6.32/924-cs5535_gpio.patch new file mode 100644 index 000000000..453affe58 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/924-cs5535_gpio.patch @@ -0,0 +1,102 @@ +--- a/drivers/char/cs5535_gpio.c ++++ b/drivers/char/cs5535_gpio.c +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -48,6 +49,7 @@ static struct pci_device_id divil_pci[] + MODULE_DEVICE_TABLE(pci, divil_pci); + + static struct cdev cs5535_gpio_cdev; ++static struct class *cs5535_gpio_class; + + /* reserve 32 entries even though some aren't usable */ + #define CS5535_GPIO_COUNT 32 +@@ -66,9 +68,14 @@ static struct gpio_regmap rm[] = + { 0x30, 0x00, '1', '0' }, /* GPIOx_READ_BACK / GPIOx_OUT_VAL */ + { 0x20, 0x20, 'I', 'i' }, /* GPIOx_IN_EN */ + { 0x04, 0x04, 'O', 'o' }, /* GPIOx_OUT_EN */ ++ { 0x10, 0x10, 'A', 'a' }, /* GPIOx_OUT_AUX1_SEL */ ++ { 0x14, 0x14, 'B', 'b' }, /* GPIOx_OUT_AUX2_SEL */ + { 0x08, 0x08, 't', 'T' }, /* GPIOx_OUT_OD_EN */ + { 0x18, 0x18, 'P', 'p' }, /* GPIOx_OUT_PU_EN */ + { 0x1c, 0x1c, 'D', 'd' }, /* GPIOx_OUT_PD_EN */ ++ { 0x24, 0x24, 'N', 'n' }, /* GPIOx_IN_INV_EN */ ++ { 0x0c, 0x0c, 'X', 'x' }, /* GPIOx_OUT_INV_EN */ ++ { 0x00, 0x00, 'H', 'L' }, /* GPIOx_OUT_VAL */ + }; + + +@@ -177,7 +184,7 @@ static int __init cs5535_gpio_init(void) + { + dev_t dev_id; + u32 low, hi; +- int retval; ++ int retval, i; + + if (pci_dev_present(divil_pci) == 0) { + printk(KERN_WARNING NAME ": DIVIL not found\n"); +@@ -232,23 +239,54 @@ static int __init cs5535_gpio_init(void) + major = MAJOR(dev_id); + } + +- if (retval) { +- release_region(gpio_base, CS5535_GPIO_SIZE); +- return -1; +- } ++ if (retval) ++ goto error; + + printk(KERN_DEBUG NAME ": base=%#x mask=%#lx major=%d\n", + gpio_base, mask, major); + + cdev_init(&cs5535_gpio_cdev, &cs5535_gpio_fops); +- cdev_add(&cs5535_gpio_cdev, dev_id, CS5535_GPIO_COUNT); ++ retval = cdev_add(&cs5535_gpio_cdev, dev_id, CS5535_GPIO_COUNT); ++ if (retval) { ++ kobject_put(&cs5535_gpio_cdev.kobj); ++ goto error_region; ++ } ++ ++ cs5535_gpio_class = class_create(THIS_MODULE, "cs5535_gpio"); ++ if (IS_ERR(cs5535_gpio_class)) { ++ printk(KERN_ERR "Error creating cs5535_gpio class\n"); ++ cdev_del(&cs5535_gpio_cdev); ++ retval = PTR_ERR(cs5535_gpio_class); ++ goto error_region; ++ } ++ ++ for (i = 0; i < CS5535_GPIO_COUNT; i++) { ++ if (mask & (1< +- +- .file "crtsavres.S" +- .section ".text" +- +-#ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE +- +-/* Routines for saving integer registers, called by the compiler. */ +-/* Called with r11 pointing to the stack header word of the caller of the */ +-/* function, just beyond the end of the integer save area. */ +- +-_GLOBAL(_savegpr_14) +-_GLOBAL(_save32gpr_14) +- stw 14,-72(11) /* save gp registers */ +-_GLOBAL(_savegpr_15) +-_GLOBAL(_save32gpr_15) +- stw 15,-68(11) +-_GLOBAL(_savegpr_16) +-_GLOBAL(_save32gpr_16) +- stw 16,-64(11) +-_GLOBAL(_savegpr_17) +-_GLOBAL(_save32gpr_17) +- stw 17,-60(11) +-_GLOBAL(_savegpr_18) +-_GLOBAL(_save32gpr_18) +- stw 18,-56(11) +-_GLOBAL(_savegpr_19) +-_GLOBAL(_save32gpr_19) +- stw 19,-52(11) +-_GLOBAL(_savegpr_20) +-_GLOBAL(_save32gpr_20) +- stw 20,-48(11) +-_GLOBAL(_savegpr_21) +-_GLOBAL(_save32gpr_21) +- stw 21,-44(11) +-_GLOBAL(_savegpr_22) +-_GLOBAL(_save32gpr_22) +- stw 22,-40(11) +-_GLOBAL(_savegpr_23) +-_GLOBAL(_save32gpr_23) +- stw 23,-36(11) +-_GLOBAL(_savegpr_24) +-_GLOBAL(_save32gpr_24) +- stw 24,-32(11) +-_GLOBAL(_savegpr_25) +-_GLOBAL(_save32gpr_25) +- stw 25,-28(11) +-_GLOBAL(_savegpr_26) +-_GLOBAL(_save32gpr_26) +- stw 26,-24(11) +-_GLOBAL(_savegpr_27) +-_GLOBAL(_save32gpr_27) +- stw 27,-20(11) +-_GLOBAL(_savegpr_28) +-_GLOBAL(_save32gpr_28) +- stw 28,-16(11) +-_GLOBAL(_savegpr_29) +-_GLOBAL(_save32gpr_29) +- stw 29,-12(11) +-_GLOBAL(_savegpr_30) +-_GLOBAL(_save32gpr_30) +- stw 30,-8(11) +-_GLOBAL(_savegpr_31) +-_GLOBAL(_save32gpr_31) +- stw 31,-4(11) +- blr +- +-/* Routines for restoring integer registers, called by the compiler. */ +-/* Called with r11 pointing to the stack header word of the caller of the */ +-/* function, just beyond the end of the integer restore area. */ +- +-_GLOBAL(_restgpr_14) +-_GLOBAL(_rest32gpr_14) +- lwz 14,-72(11) /* restore gp registers */ +-_GLOBAL(_restgpr_15) +-_GLOBAL(_rest32gpr_15) +- lwz 15,-68(11) +-_GLOBAL(_restgpr_16) +-_GLOBAL(_rest32gpr_16) +- lwz 16,-64(11) +-_GLOBAL(_restgpr_17) +-_GLOBAL(_rest32gpr_17) +- lwz 17,-60(11) +-_GLOBAL(_restgpr_18) +-_GLOBAL(_rest32gpr_18) +- lwz 18,-56(11) +-_GLOBAL(_restgpr_19) +-_GLOBAL(_rest32gpr_19) +- lwz 19,-52(11) +-_GLOBAL(_restgpr_20) +-_GLOBAL(_rest32gpr_20) +- lwz 20,-48(11) +-_GLOBAL(_restgpr_21) +-_GLOBAL(_rest32gpr_21) +- lwz 21,-44(11) +-_GLOBAL(_restgpr_22) +-_GLOBAL(_rest32gpr_22) +- lwz 22,-40(11) +-_GLOBAL(_restgpr_23) +-_GLOBAL(_rest32gpr_23) +- lwz 23,-36(11) +-_GLOBAL(_restgpr_24) +-_GLOBAL(_rest32gpr_24) +- lwz 24,-32(11) +-_GLOBAL(_restgpr_25) +-_GLOBAL(_rest32gpr_25) +- lwz 25,-28(11) +-_GLOBAL(_restgpr_26) +-_GLOBAL(_rest32gpr_26) +- lwz 26,-24(11) +-_GLOBAL(_restgpr_27) +-_GLOBAL(_rest32gpr_27) +- lwz 27,-20(11) +-_GLOBAL(_restgpr_28) +-_GLOBAL(_rest32gpr_28) +- lwz 28,-16(11) +-_GLOBAL(_restgpr_29) +-_GLOBAL(_rest32gpr_29) +- lwz 29,-12(11) +-_GLOBAL(_restgpr_30) +-_GLOBAL(_rest32gpr_30) +- lwz 30,-8(11) +-_GLOBAL(_restgpr_31) +-_GLOBAL(_rest32gpr_31) +- lwz 31,-4(11) +- blr +- +-/* Routines for restoring integer registers, called by the compiler. */ +-/* Called with r11 pointing to the stack header word of the caller of the */ +-/* function, just beyond the end of the integer restore area. */ +- +-_GLOBAL(_restgpr_14_x) +-_GLOBAL(_rest32gpr_14_x) +- lwz 14,-72(11) /* restore gp registers */ +-_GLOBAL(_restgpr_15_x) +-_GLOBAL(_rest32gpr_15_x) +- lwz 15,-68(11) +-_GLOBAL(_restgpr_16_x) +-_GLOBAL(_rest32gpr_16_x) +- lwz 16,-64(11) +-_GLOBAL(_restgpr_17_x) +-_GLOBAL(_rest32gpr_17_x) +- lwz 17,-60(11) +-_GLOBAL(_restgpr_18_x) +-_GLOBAL(_rest32gpr_18_x) +- lwz 18,-56(11) +-_GLOBAL(_restgpr_19_x) +-_GLOBAL(_rest32gpr_19_x) +- lwz 19,-52(11) +-_GLOBAL(_restgpr_20_x) +-_GLOBAL(_rest32gpr_20_x) +- lwz 20,-48(11) +-_GLOBAL(_restgpr_21_x) +-_GLOBAL(_rest32gpr_21_x) +- lwz 21,-44(11) +-_GLOBAL(_restgpr_22_x) +-_GLOBAL(_rest32gpr_22_x) +- lwz 22,-40(11) +-_GLOBAL(_restgpr_23_x) +-_GLOBAL(_rest32gpr_23_x) +- lwz 23,-36(11) +-_GLOBAL(_restgpr_24_x) +-_GLOBAL(_rest32gpr_24_x) +- lwz 24,-32(11) +-_GLOBAL(_restgpr_25_x) +-_GLOBAL(_rest32gpr_25_x) +- lwz 25,-28(11) +-_GLOBAL(_restgpr_26_x) +-_GLOBAL(_rest32gpr_26_x) +- lwz 26,-24(11) +-_GLOBAL(_restgpr_27_x) +-_GLOBAL(_rest32gpr_27_x) +- lwz 27,-20(11) +-_GLOBAL(_restgpr_28_x) +-_GLOBAL(_rest32gpr_28_x) +- lwz 28,-16(11) +-_GLOBAL(_restgpr_29_x) +-_GLOBAL(_rest32gpr_29_x) +- lwz 29,-12(11) +-_GLOBAL(_restgpr_30_x) +-_GLOBAL(_rest32gpr_30_x) +- lwz 30,-8(11) +-_GLOBAL(_restgpr_31_x) +-_GLOBAL(_rest32gpr_31_x) +- lwz 0,4(11) +- lwz 31,-4(11) +- mtlr 0 +- mr 1,11 +- blr +-#endif +--- a/arch/powerpc/lib/Makefile ++++ b/arch/powerpc/lib/Makefile +@@ -13,7 +13,7 @@ CFLAGS_REMOVE_feature-fixups.o = -pg + + obj-y := string.o alloc.o \ + checksum_$(CONFIG_WORD_SIZE).o +-obj-$(CONFIG_PPC32) += div64.o copy_32.o crtsavres.o ++obj-$(CONFIG_PPC32) += div64.o copy_32.o + obj-$(CONFIG_HAS_IOMEM) += devres.o + + obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \ +--- a/arch/powerpc/Makefile ++++ b/arch/powerpc/Makefile +@@ -92,8 +92,6 @@ endif + else + KBUILD_CFLAGS += $(call cc-option,-mtune=power4) + endif +-else +-LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o + endif + + ifeq ($(CONFIG_TUNE_CELL),y) diff --git a/target/linux/generic-2.6/patches-2.6.32/960-arm_lzma_loader.patch b/target/linux/generic-2.6/patches-2.6.32/960-arm_lzma_loader.patch new file mode 100644 index 000000000..5f4f28757 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/960-arm_lzma_loader.patch @@ -0,0 +1,710 @@ +--- a/arch/arm/boot/compressed/Makefile ++++ b/arch/arm/boot/compressed/Makefile +@@ -63,7 +63,7 @@ endif + + SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ + +-targets := vmlinux vmlinux.lds piggy.gz piggy.o font.o font.c \ ++targets := vmlinux vmlinux.lds piggy.lzma piggy.o font.o font.c \ + head.o misc.o $(OBJS) + + ifeq ($(CONFIG_FUNCTION_TRACER),y) +@@ -99,10 +99,10 @@ $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj + $(call if_changed,ld) + @: + +-$(obj)/piggy.gz: $(obj)/../Image FORCE +- $(call if_changed,gzip) ++$(obj)/piggy.lzma: $(obj)/../Image FORCE ++ $(call if_changed,lzma) + +-$(obj)/piggy.o: $(obj)/piggy.gz FORCE ++$(obj)/piggy.o: $(obj)/piggy.lzma FORCE + + CFLAGS_font.o := -Dstatic= + +--- a/arch/arm/boot/compressed/misc.c ++++ b/arch/arm/boot/compressed/misc.c +@@ -185,36 +185,10 @@ static inline __ptr_t memcpy(__ptr_t __d + return __dest; + } + +-/* +- * gzip delarations +- */ +-#define OF(args) args +-#define STATIC static +- +-typedef unsigned char uch; +-typedef unsigned short ush; +-typedef unsigned long ulg; +- +-#define WSIZE 0x8000 /* Window size must be at least 32k, */ ++#define WSIZE 0x20000 /* Window size must be at least 128k, */ + /* and a power of two */ + +-static uch *inbuf; /* input buffer */ +-static uch window[WSIZE]; /* Sliding window buffer */ +- +-static unsigned insize; /* valid bytes in inbuf */ +-static unsigned inptr; /* index of next byte to be processed in inbuf */ +-static unsigned outcnt; /* bytes in output buffer */ +- +-/* gzip flag byte */ +-#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ +-#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ +-#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ +-#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ +-#define COMMENT 0x10 /* bit 4 set: file comment present */ +-#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ +-#define RESERVED 0xC0 /* bit 6,7: reserved */ +- +-#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf()) ++static u8 window[WSIZE]; /* Sliding window buffer */ + + /* Diagnostic functions */ + #ifdef DEBUG +@@ -233,24 +207,21 @@ static unsigned outcnt; /* bytes in out + # define Tracecv(c,x) + #endif + +-static int fill_inbuf(void); +-static void flush_window(void); + static void error(char *m); + + extern char input_data[]; + extern char input_data_end[]; + +-static uch *output_data; +-static ulg output_ptr; +-static ulg bytes_out; ++static unsigned long output_ptr; ++static unsigned long bytes_out; + + static void error(char *m); + + static void putstr(const char *); + + extern int end; +-static ulg free_mem_ptr; +-static ulg free_mem_end_ptr; ++static unsigned long free_mem_ptr; ++static unsigned long free_mem_end_ptr; + + #ifdef STANDALONE_DEBUG + #define NO_INFLATE_MALLOC +@@ -258,50 +229,10 @@ static ulg free_mem_end_ptr; + + #define ARCH_HAS_DECOMP_WDOG + +-#include "../../../../lib/inflate.c" +- +-/* =========================================================================== +- * Fill the input buffer. This is called only when the buffer is empty +- * and at least one byte is really needed. +- */ +-int fill_inbuf(void) +-{ +- if (insize != 0) +- error("ran out of input data"); +- +- inbuf = input_data; +- insize = &input_data_end[0] - &input_data[0]; +- +- inptr = 1; +- return inbuf[0]; +-} +- +-/* =========================================================================== +- * Write the output window window[0..outcnt-1] and update crc and bytes_out. +- * (Used for the decompressed data only.) +- */ +-void flush_window(void) +-{ +- ulg c = crc; +- unsigned n; +- uch *in, *out, ch; +- +- in = window; +- out = &output_data[output_ptr]; +- for (n = 0; n < outcnt; n++) { +- ch = *out++ = *in++; +- c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); +- } +- crc = c; +- bytes_out += (ulg)outcnt; +- output_ptr += (ulg)outcnt; +- outcnt = 0; +- putstr("."); +-} +- + #ifndef arch_error + #define arch_error(x) + #endif ++#include "unlzma.c" + + static void error(char *x) + { +@@ -316,20 +247,16 @@ static void error(char *x) + + #ifndef STANDALONE_DEBUG + +-ulg +-decompress_kernel(ulg output_start, ulg free_mem_ptr_p, ulg free_mem_ptr_end_p, ++unsigned long ++decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p, unsigned long free_mem_ptr_end_p, + int arch_id) + { +- output_data = (uch *)output_start; /* Points to kernel start */ +- free_mem_ptr = free_mem_ptr_p; +- free_mem_end_ptr = free_mem_ptr_end_p; + __machine_arch_type = arch_id; + + arch_decomp_setup(); + +- makecrc(); + putstr("Uncompressing Linux..."); +- gunzip(); ++ output_ptr += unlzma((u8 *) output_start, input_data, window); + putstr(" done, booting the kernel.\n"); + return output_ptr; + } +@@ -339,11 +266,8 @@ char output_buffer[1500*1024]; + + int main() + { +- output_data = output_buffer; +- +- makecrc(); + putstr("Uncompressing Linux..."); +- gunzip(); ++ unlzma((u8 *) output_buffer, input_data, window); + putstr("done.\n"); + return 0; + } +--- a/arch/arm/boot/compressed/piggy.S ++++ b/arch/arm/boot/compressed/piggy.S +@@ -1,6 +1,6 @@ + .section .piggydata,#alloc + .globl input_data + input_data: +- .incbin "arch/arm/boot/compressed/piggy.gz" ++ .incbin "arch/arm/boot/compressed/piggy.lzma" + .globl input_data_end + input_data_end: +--- /dev/null ++++ b/arch/arm/boot/compressed/unlzma.c +@@ -0,0 +1,429 @@ ++/* ++ * Copyright (c) 2009 Felix Fietkau ++ * ++ * 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, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * uncompress.c ++ */ ++ ++#include ++#include ++#include "unlzma.h" ++ ++struct unlzma_ctx { ++ const u8 *next_in; ++ u8 *next_out; ++ u8 *outbuf; ++ ++ /* reader state */ ++ u32 code; ++ u32 range; ++ u32 bound; ++ ++ /* writer state */ ++ u8 previous_byte; ++ ssize_t pos; ++ ++ /* cstate */ ++ int state; ++ u32 rep0, rep1, rep2, rep3; ++ ++ void *workspace; ++} ctx; ++ ++static int inbs = 0; ++static inline u8 ++rc_read(void) ++{ ++#if 0 ++ if (unlikely(++inbs > 16 * 1024)) { ++ putstr("."); ++ inbs = 0; ++ } ++#endif ++ return *(ctx.next_in++); ++} ++ ++ ++static inline void ++rc_get_code(void) ++{ ++ ctx.code = (ctx.code << 8) | rc_read(); ++} ++ ++static inline void ++rc_normalize(void) ++{ ++ if (ctx.range < (1 << RC_TOP_BITS)) { ++ ctx.range <<= 8; ++ rc_get_code(); ++ } ++} ++ ++static inline int ++rc_is_bit_0(u16 *p) ++{ ++ rc_normalize(); ++ ctx.bound = *p * (ctx.range >> RC_MODEL_TOTAL_BITS); ++ return ctx.code < ctx.bound; ++} ++ ++static inline void ++rc_update_bit_0(u16 *p) ++{ ++ ctx.range = ctx.bound; ++ *p += ((1 << RC_MODEL_TOTAL_BITS) - *p) >> RC_MOVE_BITS; ++} ++ ++static inline void ++rc_update_bit_1(u16 *p) ++{ ++ ctx.range -= ctx.bound; ++ ctx.code -= ctx.bound; ++ *p -= *p >> RC_MOVE_BITS; ++} ++ ++static inline bool ++rc_get_bit(u16 *p, int *symbol) ++{ ++ if (rc_is_bit_0(p)) { ++ rc_update_bit_0(p); ++ *symbol *= 2; ++ return 0; ++ } else { ++ rc_update_bit_1(p); ++ *symbol = *symbol * 2 + 1; ++ return 1; ++ } ++} ++ ++static inline int ++rc_direct_bit(void) ++{ ++ rc_normalize(); ++ ctx.range >>= 1; ++ if (ctx.code >= ctx.range) { ++ ctx.code -= ctx.range; ++ return 1; ++ } ++ return 0; ++} ++ ++static inline void ++rc_bit_tree_decode(u16 *p, int num_levels, int *symbol) ++{ ++ int i = num_levels; ++ ++ *symbol = 1; ++ while (i--) ++ rc_get_bit(p + *symbol, symbol); ++ *symbol -= 1 << num_levels; ++} ++ ++static inline u8 ++peek_old_byte(u32 offs) ++{ ++ u32 pos = ctx.pos - offs; ++ return ctx.outbuf[pos]; ++} ++ ++static inline void ++write_byte(u8 byte) ++{ ++ ctx.previous_byte = byte; ++ *(ctx.next_out++) = byte; ++ ctx.pos++; ++} ++ ++ ++static inline void ++copy_byte(u32 offs) ++{ ++ write_byte(peek_old_byte(offs)); ++} ++ ++static inline void ++copy_bytes(u32 rep0, int len) ++{ ++ do { ++ copy_byte(rep0); ++ len--; ++ } while (len != 0); ++} ++ ++static inline void ++process_bit0(u16 *p, int pos_state, u16 *prob, ++ int lc, u32 literal_pos_mask) ++{ ++ int mi = 1; ++ rc_update_bit_0(prob); ++ prob = (p + LZMA_LITERAL + ++ (LZMA_LIT_SIZE ++ * (((ctx.pos & literal_pos_mask) << lc) ++ + (ctx.previous_byte >> (8 - lc)))) ++ ); ++ ++ if (ctx.state >= LZMA_NUM_LIT_STATES) { ++ int match_byte = peek_old_byte(ctx.rep0); ++ do { ++ u16 bit; ++ u16 *prob_lit; ++ ++ match_byte <<= 1; ++ bit = match_byte & 0x100; ++ prob_lit = prob + 0x100 + bit + mi; ++ if (rc_get_bit(prob_lit, &mi) != !!bit) ++ break; ++ } while (mi < 0x100); ++ } ++ while (mi < 0x100) { ++ u16 *prob_lit = prob + mi; ++ rc_get_bit(prob_lit, &mi); ++ } ++ write_byte(mi); ++ if (ctx.state < 4) ++ ctx.state = 0; ++ else if (ctx.state < 10) ++ ctx.state -= 3; ++ else ++ ctx.state -= 6; ++} ++ ++static inline void ++process_bit1(u16 *p, int pos_state, u16 *prob) ++{ ++ int offset; ++ u16 *prob_len; ++ int num_bits; ++ int len; ++ ++ rc_update_bit_1(prob); ++ prob = p + LZMA_IS_REP + ctx.state; ++ if (rc_is_bit_0(prob)) { ++ rc_update_bit_0(prob); ++ ctx.rep3 = ctx.rep2; ++ ctx.rep2 = ctx.rep1; ++ ctx.rep1 = ctx.rep0; ++ ctx.state = ctx.state < LZMA_NUM_LIT_STATES ? 0 : 3; ++ prob = p + LZMA_LEN_CODER; ++ } else { ++ rc_update_bit_1(prob); ++ prob = p + LZMA_IS_REP_G0 + ctx.state; ++ if (rc_is_bit_0(prob)) { ++ rc_update_bit_0(prob); ++ prob = (p + LZMA_IS_REP_0_LONG ++ + (ctx.state << ++ LZMA_NUM_POS_BITS_MAX) + ++ pos_state); ++ if (rc_is_bit_0(prob)) { ++ rc_update_bit_0(prob); ++ ++ ctx.state = ctx.state < LZMA_NUM_LIT_STATES ? ++ 9 : 11; ++ copy_byte(ctx.rep0); ++ return; ++ } else { ++ rc_update_bit_1(prob); ++ } ++ } else { ++ u32 distance; ++ ++ rc_update_bit_1(prob); ++ prob = p + LZMA_IS_REP_G1 + ctx.state; ++ if (rc_is_bit_0(prob)) { ++ rc_update_bit_0(prob); ++ distance = ctx.rep1; ++ } else { ++ rc_update_bit_1(prob); ++ prob = p + LZMA_IS_REP_G2 + ctx.state; ++ if (rc_is_bit_0(prob)) { ++ rc_update_bit_0(prob); ++ distance = ctx.rep2; ++ } else { ++ rc_update_bit_1(prob); ++ distance = ctx.rep3; ++ ctx.rep3 = ctx.rep2; ++ } ++ ctx.rep2 = ctx.rep1; ++ } ++ ctx.rep1 = ctx.rep0; ++ ctx.rep0 = distance; ++ } ++ ctx.state = ctx.state < LZMA_NUM_LIT_STATES ? 8 : 11; ++ prob = p + LZMA_REP_LEN_CODER; ++ } ++ ++ prob_len = prob + LZMA_LEN_CHOICE; ++ if (rc_is_bit_0(prob_len)) { ++ rc_update_bit_0(prob_len); ++ prob_len = (prob + LZMA_LEN_LOW ++ + (pos_state << ++ LZMA_LEN_NUM_LOW_BITS)); ++ offset = 0; ++ num_bits = LZMA_LEN_NUM_LOW_BITS; ++ } else { ++ rc_update_bit_1(prob_len); ++ prob_len = prob + LZMA_LEN_CHOICE_2; ++ if (rc_is_bit_0(prob_len)) { ++ rc_update_bit_0(prob_len); ++ prob_len = (prob + LZMA_LEN_MID ++ + (pos_state << ++ LZMA_LEN_NUM_MID_BITS)); ++ offset = 1 << LZMA_LEN_NUM_LOW_BITS; ++ num_bits = LZMA_LEN_NUM_MID_BITS; ++ } else { ++ rc_update_bit_1(prob_len); ++ prob_len = prob + LZMA_LEN_HIGH; ++ offset = ((1 << LZMA_LEN_NUM_LOW_BITS) ++ + (1 << LZMA_LEN_NUM_MID_BITS)); ++ num_bits = LZMA_LEN_NUM_HIGH_BITS; ++ } ++ } ++ ++ rc_bit_tree_decode(prob_len, num_bits, &len); ++ len += offset; ++ ++ if (ctx.state < 4) { ++ int pos_slot; ++ ++ ctx.state += LZMA_NUM_LIT_STATES; ++ prob = ++ p + LZMA_POS_SLOT + ++ ((len < ++ LZMA_NUM_LEN_TO_POS_STATES ? len : ++ LZMA_NUM_LEN_TO_POS_STATES - 1) ++ << LZMA_NUM_POS_SLOT_BITS); ++ rc_bit_tree_decode(prob, ++ LZMA_NUM_POS_SLOT_BITS, ++ &pos_slot); ++ if (pos_slot >= LZMA_START_POS_MODEL_INDEX) { ++ int i, mi; ++ num_bits = (pos_slot >> 1) - 1; ++ ctx.rep0 = 2 | (pos_slot & 1); ++ if (pos_slot < LZMA_END_POS_MODEL_INDEX) { ++ ctx.rep0 <<= num_bits; ++ prob = p + LZMA_SPEC_POS + ++ ctx.rep0 - pos_slot - 1; ++ } else { ++ num_bits -= LZMA_NUM_ALIGN_BITS; ++ while (num_bits--) ++ ctx.rep0 = (ctx.rep0 << 1) | ++ rc_direct_bit(); ++ prob = p + LZMA_ALIGN; ++ ctx.rep0 <<= LZMA_NUM_ALIGN_BITS; ++ num_bits = LZMA_NUM_ALIGN_BITS; ++ } ++ i = 1; ++ mi = 1; ++ while (num_bits--) { ++ if (rc_get_bit(prob + mi, &mi)) ++ ctx.rep0 |= i; ++ i <<= 1; ++ } ++ } else ++ ctx.rep0 = pos_slot; ++ if (++(ctx.rep0) == 0) ++ return; ++ } ++ ++ len += LZMA_MATCH_MIN_LEN; ++ ++ copy_bytes(ctx.rep0, len); ++} ++ ++ ++static int ++do_unlzma(void) ++{ ++ u8 hdr_buf[sizeof(struct lzma_header)]; ++ struct lzma_header *header = (struct lzma_header *)hdr_buf; ++ u32 pos_state_mask; ++ u32 literal_pos_mask; ++ int lc, pb, lp; ++ int num_probs; ++ int i, mi; ++ u16 *p; ++ ++ for (i = 0; i < sizeof(struct lzma_header); i++) { ++ hdr_buf[i] = rc_read(); ++ } ++ ++ ctx.pos = 0; ++ ctx.state = 0; ++ ctx.rep0 = ctx.rep1 = ctx.rep2 = ctx.rep3 = 1; ++ ++ ctx.previous_byte = 0; ++ ctx.code = 0; ++ ctx.range = 0xFFFFFFFF; ++ ++ if (header->pos >= (9 * 5 * 5)) ++ return -1; ++ ++ mi = 0; ++ lc = header->pos; ++ while (lc >= 9) { ++ mi++; ++ lc -= 9; ++ } ++ pb = 0; ++ lp = mi; ++ while (lp >= 5) { ++ pb++; ++ lp -= 5; ++ } ++ pos_state_mask = (1 << pb) - 1; ++ literal_pos_mask = (1 << lp) - 1; ++ ++ p = (u16 *) ctx.workspace; ++ if (!p) ++ return -1; ++ ++ num_probs = LZMA_LITERAL + (LZMA_LIT_SIZE << (lc + lp)); ++ for (i = 0; i < num_probs; i++) ++ p[i] = (1 << RC_MODEL_TOTAL_BITS) >> 1; ++ ++ for (i = 0; i < 5; i++) ++ rc_get_code(); ++ ++ while (1) { ++ int pos_state = ctx.pos & pos_state_mask; ++ u16 *prob = p + LZMA_IS_MATCH + ++ (ctx.state << LZMA_NUM_POS_BITS_MAX) + pos_state; ++ if (rc_is_bit_0(prob)) ++ process_bit0(p, pos_state, prob, ++ lc, literal_pos_mask); ++ else { ++ process_bit1(p, pos_state, prob); ++ if (ctx.rep0 == 0) ++ break; ++ } ++ } ++ ++ return ctx.pos; ++} ++ ++ ++static int unlzma(unsigned char *dest, const unsigned char *src, unsigned char *workspace) ++{ ++ memset(&ctx, 0, sizeof(ctx)); ++ ctx.outbuf = dest; ++ ctx.next_in = src; ++ ctx.next_out = dest; ++ ctx.workspace = workspace; ++ ++ return do_unlzma(); ++} ++ ++ +--- /dev/null ++++ b/arch/arm/boot/compressed/unlzma.h +@@ -0,0 +1,81 @@ ++/* LZMA uncompresion module for pcomp ++ * Copyright (C) 2009 Felix Fietkau ++ * ++ * Based on: ++ * Initial Linux kernel adaptation ++ * Copyright (C) 2006 Alain < alain@knaff.lu > ++ * ++ * Based on small lzma deflate implementation/Small range coder ++ * implementation for lzma. ++ * Copyright (C) 2006 Aurelien Jacobs < aurel@gnuage.org > ++ * ++ * Based on LzmaDecode.c from the LZMA SDK 4.22 (http://www.7-zip.org/) ++ * Copyright (C) 1999-2005 Igor Pavlov ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ */ ++#ifndef __UNLZMA_H ++#define __UNLZMA_H ++ ++struct lzma_header { ++ __u8 pos; ++ __le32 dict_size; ++ __le64 uncompr_size; ++} __attribute__ ((packed)); ++ ++ ++#define RC_TOP_BITS 24 ++#define RC_MOVE_BITS 5 ++#define RC_MODEL_TOTAL_BITS 11 ++ ++#define LZMA_BASE_SIZE 1846 ++#define LZMA_LIT_SIZE 768 ++ ++#define LZMA_NUM_POS_BITS_MAX 4 ++ ++#define LZMA_LEN_NUM_LOW_BITS 3 ++#define LZMA_LEN_NUM_MID_BITS 3 ++#define LZMA_LEN_NUM_HIGH_BITS 8 ++ ++#define LZMA_LEN_CHOICE 0 ++#define LZMA_LEN_CHOICE_2 (LZMA_LEN_CHOICE + 1) ++#define LZMA_LEN_LOW (LZMA_LEN_CHOICE_2 + 1) ++#define LZMA_LEN_MID (LZMA_LEN_LOW \ ++ + (1 << (LZMA_NUM_POS_BITS_MAX + LZMA_LEN_NUM_LOW_BITS))) ++#define LZMA_LEN_HIGH (LZMA_LEN_MID \ ++ +(1 << (LZMA_NUM_POS_BITS_MAX + LZMA_LEN_NUM_MID_BITS))) ++#define LZMA_NUM_LEN_PROBS (LZMA_LEN_HIGH + (1 << LZMA_LEN_NUM_HIGH_BITS)) ++ ++#define LZMA_NUM_STATES 12 ++#define LZMA_NUM_LIT_STATES 7 ++ ++#define LZMA_START_POS_MODEL_INDEX 4 ++#define LZMA_END_POS_MODEL_INDEX 14 ++#define LZMA_NUM_FULL_DISTANCES (1 << (LZMA_END_POS_MODEL_INDEX >> 1)) ++ ++#define LZMA_NUM_POS_SLOT_BITS 6 ++#define LZMA_NUM_LEN_TO_POS_STATES 4 ++ ++#define LZMA_NUM_ALIGN_BITS 4 ++ ++#define LZMA_MATCH_MIN_LEN 2 ++ ++#define LZMA_IS_MATCH 0 ++#define LZMA_IS_REP (LZMA_IS_MATCH + (LZMA_NUM_STATES << LZMA_NUM_POS_BITS_MAX)) ++#define LZMA_IS_REP_G0 (LZMA_IS_REP + LZMA_NUM_STATES) ++#define LZMA_IS_REP_G1 (LZMA_IS_REP_G0 + LZMA_NUM_STATES) ++#define LZMA_IS_REP_G2 (LZMA_IS_REP_G1 + LZMA_NUM_STATES) ++#define LZMA_IS_REP_0_LONG (LZMA_IS_REP_G2 + LZMA_NUM_STATES) ++#define LZMA_POS_SLOT (LZMA_IS_REP_0_LONG \ ++ + (LZMA_NUM_STATES << LZMA_NUM_POS_BITS_MAX)) ++#define LZMA_SPEC_POS (LZMA_POS_SLOT \ ++ +(LZMA_NUM_LEN_TO_POS_STATES << LZMA_NUM_POS_SLOT_BITS)) ++#define LZMA_ALIGN (LZMA_SPEC_POS \ ++ + LZMA_NUM_FULL_DISTANCES - LZMA_END_POS_MODEL_INDEX) ++#define LZMA_LEN_CODER (LZMA_ALIGN + (1 << LZMA_NUM_ALIGN_BITS)) ++#define LZMA_REP_LEN_CODER (LZMA_LEN_CODER + LZMA_NUM_LEN_PROBS) ++#define LZMA_LITERAL (LZMA_REP_LEN_CODER + LZMA_NUM_LEN_PROBS) ++ ++#endif diff --git a/target/linux/generic-2.6/patches-2.6.32/970-ocf_kbuild_integration.patch b/target/linux/generic-2.6/patches-2.6.32/970-ocf_kbuild_integration.patch new file mode 100644 index 000000000..09ad25236 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/970-ocf_kbuild_integration.patch @@ -0,0 +1,25 @@ +--- a/crypto/Kconfig ++++ b/crypto/Kconfig +@@ -810,6 +810,8 @@ config CRYPTO_ANSI_CPRNG + ANSI X9.31 A.2.4. Not this option must be enabled if CRYPTO_FIPS + is selected + ++source "crypto/ocf/Kconfig" ++ + source "drivers/crypto/Kconfig" + + endif # if CRYPTO +--- a/crypto/Makefile ++++ b/crypto/Makefile +@@ -86,6 +86,11 @@ obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o + obj-$(CONFIG_CRYPTO_GHASH) += ghash-generic.o + + # ++# OCF ++# ++obj-$(CONFIG_OCF_OCF) += ocf/ ++ ++# + # generic algorithms and the async_tx api + # + obj-$(CONFIG_XOR_BLOCKS) += xor.o diff --git a/target/linux/generic-2.6/patches-2.6.32/971-ocf_20080917.patch b/target/linux/generic-2.6/patches-2.6.32/971-ocf_20080917.patch new file mode 100644 index 000000000..669be1a6f --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/971-ocf_20080917.patch @@ -0,0 +1,152 @@ +--- a/drivers/char/random.c ++++ b/drivers/char/random.c +@@ -129,6 +129,9 @@ + * unsigned int value); + * void add_interrupt_randomness(int irq); + * ++ * void random_input_words(__u32 *buf, size_t wordcount, int ent_count) ++ * int random_input_wait(void); ++ * + * add_input_randomness() uses the input layer interrupt timing, as well as + * the event type information from the hardware. + * +@@ -140,6 +143,13 @@ + * a better measure, since the timing of the disk interrupts are more + * unpredictable. + * ++ * random_input_words() just provides a raw block of entropy to the input ++ * pool, such as from a hardware entropy generator. ++ * ++ * random_input_wait() suspends the caller until such time as the ++ * entropy pool falls below the write threshold, and returns a count of how ++ * much entropy (in bits) is needed to sustain the pool. ++ * + * All of these routines try to estimate how many bits of randomness a + * particular randomness source. They do this by keeping track of the + * first and second order deltas of the event timings. +@@ -714,6 +724,61 @@ void add_disk_randomness(struct gendisk + } + #endif + ++/* ++ * random_input_words - add bulk entropy to pool ++ * ++ * @buf: buffer to add ++ * @wordcount: number of __u32 words to add ++ * @ent_count: total amount of entropy (in bits) to credit ++ * ++ * this provides bulk input of entropy to the input pool ++ * ++ */ ++void random_input_words(__u32 *buf, size_t wordcount, int ent_count) ++{ ++ mix_pool_bytes(&input_pool, buf, wordcount*4); ++ ++ credit_entropy_bits(&input_pool, ent_count); ++ ++ DEBUG_ENT("crediting %d bits => %d\n", ++ ent_count, input_pool.entropy_count); ++ /* ++ * Wake up waiting processes if we have enough ++ * entropy. ++ */ ++ if (input_pool.entropy_count >= random_read_wakeup_thresh) ++ wake_up_interruptible(&random_read_wait); ++} ++EXPORT_SYMBOL(random_input_words); ++ ++/* ++ * random_input_wait - wait until random needs entropy ++ * ++ * this function sleeps until the /dev/random subsystem actually ++ * needs more entropy, and then return the amount of entropy ++ * that it would be nice to have added to the system. ++ */ ++int random_input_wait(void) ++{ ++ int count; ++ ++ wait_event_interruptible(random_write_wait, ++ input_pool.entropy_count < random_write_wakeup_thresh); ++ ++ count = random_write_wakeup_thresh - input_pool.entropy_count; ++ ++ /* likely we got woken up due to a signal */ ++ if (count <= 0) count = random_read_wakeup_thresh; ++ ++ DEBUG_ENT("requesting %d bits from input_wait()er %d<%d\n", ++ count, ++ input_pool.entropy_count, random_write_wakeup_thresh); ++ ++ return count; ++} ++EXPORT_SYMBOL(random_input_wait); ++ ++ + #define EXTRACT_SIZE 10 + + /********************************************************************* +--- a/fs/fcntl.c ++++ b/fs/fcntl.c +@@ -141,6 +141,7 @@ SYSCALL_DEFINE1(dup, unsigned int, filde + } + return ret; + } ++EXPORT_SYMBOL(sys_dup); + + #define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | O_DIRECT | O_NOATIME) + +--- a/include/linux/miscdevice.h ++++ b/include/linux/miscdevice.h +@@ -12,6 +12,7 @@ + #define APOLLO_MOUSE_MINOR 7 + #define PC110PAD_MINOR 9 + /*#define ADB_MOUSE_MINOR 10 FIXME OBSOLETE */ ++#define CRYPTODEV_MINOR 70 /* /dev/crypto */ + #define WATCHDOG_MINOR 130 /* Watchdog timer */ + #define TEMP_MINOR 131 /* Temperature Sensor */ + #define RTC_MINOR 135 +--- a/include/linux/random.h ++++ b/include/linux/random.h +@@ -34,6 +34,30 @@ + /* Clear the entropy pool and associated counters. (Superuser only.) */ + #define RNDCLEARPOOL _IO( 'R', 0x06 ) + ++#ifdef CONFIG_FIPS_RNG ++ ++/* Size of seed value - equal to AES blocksize */ ++#define AES_BLOCK_SIZE_BYTES 16 ++#define SEED_SIZE_BYTES AES_BLOCK_SIZE_BYTES ++/* Size of AES key */ ++#define KEY_SIZE_BYTES 16 ++ ++/* ioctl() structure used by FIPS 140-2 Tests */ ++struct rand_fips_test { ++ unsigned char key[KEY_SIZE_BYTES]; /* Input */ ++ unsigned char datetime[SEED_SIZE_BYTES]; /* Input */ ++ unsigned char seed[SEED_SIZE_BYTES]; /* Input */ ++ unsigned char result[SEED_SIZE_BYTES]; /* Output */ ++}; ++ ++/* FIPS 140-2 RNG Variable Seed Test. (Superuser only.) */ ++#define RNDFIPSVST _IOWR('R', 0x10, struct rand_fips_test) ++ ++/* FIPS 140-2 RNG Monte Carlo Test. (Superuser only.) */ ++#define RNDFIPSMCT _IOWR('R', 0x11, struct rand_fips_test) ++ ++#endif /* #ifdef CONFIG_FIPS_RNG */ ++ + struct rand_pool_info { + int entropy_count; + int buf_size; +@@ -50,6 +74,10 @@ extern void add_input_randomness(unsigne + unsigned int value); + extern void add_interrupt_randomness(int irq); + ++extern void random_input_words(__u32 *buf, size_t wordcount, int ent_count); ++extern int random_input_wait(void); ++#define HAS_RANDOM_INPUT_WAIT 1 ++ + extern void get_random_bytes(void *buf, int nbytes); + void generate_random_uuid(unsigned char uuid_out[16]); + diff --git a/target/linux/generic-2.6/patches-2.6.32/972-ocf_compile_fix.patch b/target/linux/generic-2.6/patches-2.6.32/972-ocf_compile_fix.patch new file mode 100644 index 000000000..a3fa22681 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/972-ocf_compile_fix.patch @@ -0,0 +1,11 @@ +--- a/crypto/ocf/cryptosoft.c ++++ b/crypto/ocf/cryptosoft.c +@@ -47,7 +47,7 @@ + #include + #include + #include +-#include ++#include + + #include + #include diff --git a/target/linux/generic-2.6/patches-2.6.32/973-ocf_2.6.27_fix.patch b/target/linux/generic-2.6/patches-2.6.32/973-ocf_2.6.27_fix.patch new file mode 100644 index 000000000..ecb9bef51 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/973-ocf_2.6.27_fix.patch @@ -0,0 +1,197 @@ +--- a/crypto/ocf/random.c ++++ b/crypto/ocf/random.c +@@ -49,6 +49,7 @@ + #include + #include + #include ++#include + #include + + #ifdef CONFIG_OCF_FIPS +@@ -81,7 +82,7 @@ struct random_op { + + static int random_proc(void *arg); + +-static pid_t randomproc = (pid_t) -1; ++static struct task_struct *random_task; + static spinlock_t random_lock; + + /* +@@ -141,13 +142,18 @@ crypto_rregister( + spin_lock_irqsave(&random_lock, flags); + list_add_tail(&rops->random_list, &random_ops); + if (!started) { +- randomproc = kernel_thread(random_proc, NULL, CLONE_FS|CLONE_FILES); +- if (randomproc < 0) { +- ret = randomproc; ++ struct task_struct *t; ++ ++ t = kthread_create(random_proc, NULL, "ocf-random"); ++ if (IS_ERR(t)) { ++ ret = PTR_ERR(t); + printk("crypto: crypto_rregister cannot start random thread; " + "error %d", ret); +- } else ++ } else { ++ random_task = t; ++ wake_up_process(t); + started = 1; ++ } + } + spin_unlock_irqrestore(&random_lock, flags); + +@@ -172,7 +178,7 @@ crypto_runregister_all(u_int32_t driveri + + spin_lock_irqsave(&random_lock, flags); + if (list_empty(&random_ops) && started) +- kill_proc(randomproc, SIGKILL, 1); ++ send_sig(SIGKILL, random_task, 1); + spin_unlock_irqrestore(&random_lock, flags); + return(0); + } +@@ -308,7 +314,7 @@ random_proc(void *arg) + + bad_alloc: + spin_lock_irq(&random_lock); +- randomproc = (pid_t) -1; ++ random_task = NULL; + started = 0; + spin_unlock_irq(&random_lock); + +--- a/crypto/ocf/crypto.c ++++ b/crypto/ocf/crypto.c +@@ -74,6 +74,7 @@ __FBSDID("$FreeBSD: src/sys/opencrypto/c + #include + #include + #include ++#include + #include + + /* +@@ -255,10 +256,10 @@ module_param(crypto_devallowsoft, int, 0 + MODULE_PARM_DESC(crypto_devallowsoft, + "Enable/disable use of software crypto support"); + +-static pid_t cryptoproc = (pid_t) -1; ++static struct task_struct *crypto_task; + static struct completion cryptoproc_exited; + static DECLARE_WAIT_QUEUE_HEAD(cryptoproc_wait); +-static pid_t cryptoretproc = (pid_t) -1; ++static struct task_struct *cryptoret_task; + static struct completion cryptoretproc_exited; + static DECLARE_WAIT_QUEUE_HEAD(cryptoretproc_wait); + +@@ -1401,7 +1402,7 @@ crypto_proc(void *arg) + wait_event_interruptible(cryptoproc_wait, + !(list_empty(&crp_q) || crypto_all_qblocked) || + !(list_empty(&crp_kq) || crypto_all_kqblocked) || +- cryptoproc == (pid_t) -1); ++ crypto_task == NULL); + crp_sleep = 0; + if (signal_pending (current)) { + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) +@@ -1414,7 +1415,7 @@ crypto_proc(void *arg) + } + CRYPTO_Q_LOCK(); + dprintk("%s - awake\n", __FUNCTION__); +- if (cryptoproc == (pid_t) -1) ++ if (crypto_task == NULL) + break; + cryptostats.cs_intrs++; + } +@@ -1470,7 +1471,7 @@ crypto_ret_proc(void *arg) + dprintk("%s - sleeping\n", __FUNCTION__); + CRYPTO_RETQ_UNLOCK(); + wait_event_interruptible(cryptoretproc_wait, +- cryptoretproc == (pid_t) -1 || ++ cryptoret_task == NULL || + !list_empty(&crp_ret_q) || + !list_empty(&crp_ret_kq)); + if (signal_pending (current)) { +@@ -1484,7 +1485,7 @@ crypto_ret_proc(void *arg) + } + CRYPTO_RETQ_LOCK(); + dprintk("%s - awake\n", __FUNCTION__); +- if (cryptoretproc == (pid_t) -1) { ++ if (cryptoret_task == NULL) { + dprintk("%s - EXITING!\n", __FUNCTION__); + break; + } +@@ -1597,6 +1598,7 @@ DB_SHOW_COMMAND(kcrypto, db_show_kcrypto + static int + crypto_init(void) + { ++ struct task_struct *t; + int error; + + dprintk("%s(0x%x)\n", __FUNCTION__, (int) crypto_init); +@@ -1643,23 +1645,27 @@ crypto_init(void) + init_completion(&cryptoproc_exited); + init_completion(&cryptoretproc_exited); + +- cryptoproc = 0; /* to avoid race condition where proc runs first */ +- cryptoproc = kernel_thread(crypto_proc, NULL, CLONE_FS|CLONE_FILES); +- if (cryptoproc < 0) { +- error = cryptoproc; ++ crypto_task = NULL; /* to avoid race condition where proc runs first */ ++ t = kthread_create(crypto_proc, NULL, "ocf-crypto"); ++ if (IS_ERR(t)) { ++ error = PTR_ERR(t); + printk("crypto: crypto_init cannot start crypto thread; error %d", + error); + goto bad; + } ++ wake_up_process(t); ++ crypto_task = t; + +- cryptoretproc = 0; /* to avoid race condition where proc runs first */ +- cryptoretproc = kernel_thread(crypto_ret_proc, NULL, CLONE_FS|CLONE_FILES); +- if (cryptoretproc < 0) { +- error = cryptoretproc; ++ cryptoret_task = NULL; /* to avoid race condition where proc runs first */ ++ t = kthread_create(crypto_ret_proc, NULL, "ocf-cryptoret"); ++ if (IS_ERR(t)) { ++ error = PTR_ERR(t); + printk("crypto: crypto_init cannot start cryptoret thread; error %d", + error); + goto bad; + } ++ wake_up_process(t); ++ cryptoret_task = t; + + return 0; + bad: +@@ -1671,7 +1677,7 @@ bad: + static void + crypto_exit(void) + { +- pid_t p; ++ struct task_struct *t; + unsigned long d_flags; + + dprintk("%s()\n", __FUNCTION__); +@@ -1681,18 +1687,18 @@ crypto_exit(void) + */ + + CRYPTO_DRIVER_LOCK(); +- p = cryptoproc; +- cryptoproc = (pid_t) -1; +- kill_proc(p, SIGTERM, 1); ++ t = crypto_task; ++ crypto_task = NULL; ++ send_sig(SIGTERM, t, 1); + wake_up_interruptible(&cryptoproc_wait); + CRYPTO_DRIVER_UNLOCK(); + + wait_for_completion(&cryptoproc_exited); + + CRYPTO_DRIVER_LOCK(); +- p = cryptoretproc; +- cryptoretproc = (pid_t) -1; +- kill_proc(p, SIGTERM, 1); ++ t = cryptoret_task; ++ cryptoret_task = NULL; ++ send_sig(SIGTERM, t, 1); + wake_up_interruptible(&cryptoretproc_wait); + CRYPTO_DRIVER_UNLOCK(); + diff --git a/target/linux/generic-2.6/patches-2.6.32/974-ssb_b43_default_on.patch b/target/linux/generic-2.6/patches-2.6.32/974-ssb_b43_default_on.patch new file mode 100644 index 000000000..98dde2a3c --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/974-ssb_b43_default_on.patch @@ -0,0 +1,11 @@ +--- a/drivers/ssb/Kconfig ++++ b/drivers/ssb/Kconfig +@@ -49,7 +49,7 @@ config SSB_PCIHOST + config SSB_B43_PCI_BRIDGE + bool + depends on SSB_PCIHOST +- default n ++ default y + + config SSB_PCMCIAHOST_POSSIBLE + bool diff --git a/target/linux/generic-2.6/patches-2.6.32/977-textsearch_kconfig_hacks.patch b/target/linux/generic-2.6/patches-2.6.32/977-textsearch_kconfig_hacks.patch new file mode 100644 index 000000000..97fad7dfe --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/977-textsearch_kconfig_hacks.patch @@ -0,0 +1,23 @@ +--- a/lib/Kconfig ++++ b/lib/Kconfig +@@ -148,16 +148,16 @@ config REED_SOLOMON_DEC16 + # Textsearch support is select'ed if needed + # + config TEXTSEARCH +- boolean ++ boolean "Textsearch support" + + config TEXTSEARCH_KMP +- tristate ++ tristate "Textsearch KMP" + + config TEXTSEARCH_BM +- tristate ++ tristate "Textsearch BM" + + config TEXTSEARCH_FSM +- tristate ++ tristate "Textsearch FSM" + + config HAS_IOMEM + boolean diff --git a/target/linux/generic-2.6/patches-2.6.32/978-lib80211_kconfig_hacks.patch b/target/linux/generic-2.6/patches-2.6.32/978-lib80211_kconfig_hacks.patch new file mode 100644 index 000000000..e0dc6365f --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/978-lib80211_kconfig_hacks.patch @@ -0,0 +1,19 @@ +--- a/net/wireless/Kconfig ++++ b/net/wireless/Kconfig +@@ -127,13 +127,13 @@ config LIB80211 + you want this built into your kernel. + + config LIB80211_CRYPT_WEP +- tristate ++ tristate "LIB80211_CRYPT_WEP" + + config LIB80211_CRYPT_CCMP +- tristate ++ tristate "LIB80211_CRYPT_CCMP" + + config LIB80211_CRYPT_TKIP +- tristate ++ tristate "LIB80211_CRYPT_TKIP" + + config LIB80211_DEBUG + bool "lib80211 debugging messages" diff --git a/target/linux/generic-2.6/patches-2.6.32/979-crypto_add_kconfig_prompts.patch b/target/linux/generic-2.6/patches-2.6.32/979-crypto_add_kconfig_prompts.patch new file mode 100644 index 000000000..b40b2cea9 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/979-crypto_add_kconfig_prompts.patch @@ -0,0 +1,47 @@ +--- a/crypto/Kconfig ++++ b/crypto/Kconfig +@@ -32,7 +32,7 @@ config CRYPTO_FIPS + option is selected + + config CRYPTO_ALGAPI +- tristate ++ tristate "ALGAPI" + select CRYPTO_ALGAPI2 + help + This option provides the API for cryptographic algorithms. +@@ -41,7 +41,7 @@ config CRYPTO_ALGAPI2 + tristate + + config CRYPTO_AEAD +- tristate ++ tristate "AEAD" + select CRYPTO_AEAD2 + select CRYPTO_ALGAPI + +@@ -50,7 +50,7 @@ config CRYPTO_AEAD2 + select CRYPTO_ALGAPI2 + + config CRYPTO_BLKCIPHER +- tristate ++ tristate "BLKCIPHER" + select CRYPTO_BLKCIPHER2 + select CRYPTO_ALGAPI + +@@ -61,7 +61,7 @@ config CRYPTO_BLKCIPHER2 + select CRYPTO_WORKQUEUE + + config CRYPTO_HASH +- tristate ++ tristate "HASH" + select CRYPTO_HASH2 + select CRYPTO_ALGAPI + +@@ -70,7 +70,7 @@ config CRYPTO_HASH2 + select CRYPTO_ALGAPI2 + + config CRYPTO_RNG +- tristate ++ tristate "RNG" + select CRYPTO_RNG2 + select CRYPTO_ALGAPI + diff --git a/target/linux/generic-2.6/patches-2.6.32/980-vm_exports.patch b/target/linux/generic-2.6/patches-2.6.32/980-vm_exports.patch new file mode 100644 index 000000000..4c3b56147 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/980-vm_exports.patch @@ -0,0 +1,134 @@ +--- a/mm/shmem.c ++++ b/mm/shmem.c +@@ -2775,6 +2775,16 @@ int shmem_lock(struct file *file, int lo + + /* common code */ + ++void shmem_set_file(struct vm_area_struct *vma, struct file *file) ++{ ++ ima_counts_get(file); ++ if (vma->vm_file) ++ fput(vma->vm_file); ++ vma->vm_file = file; ++ vma->vm_ops = &shmem_vm_ops; ++} ++EXPORT_SYMBOL_GPL(shmem_set_file); ++ + /** + * shmem_file_setup - get an unlinked file living in tmpfs + * @name: name for dentry (to be seen in /proc//maps +@@ -2854,9 +2864,6 @@ int shmem_zero_setup(struct vm_area_stru + if (IS_ERR(file)) + return PTR_ERR(file); + +- if (vma->vm_file) +- fput(vma->vm_file); +- vma->vm_file = file; +- vma->vm_ops = &shmem_vm_ops; ++ shmem_set_file(vma, file); + return 0; + } +--- a/fs/file.c ++++ b/fs/file.c +@@ -271,6 +271,7 @@ int expand_files(struct files_struct *fi + /* All good, so we try */ + return expand_fdtable(files, nr); + } ++EXPORT_SYMBOL_GPL(expand_files); + + static int count_open_files(struct fdtable *fdt) + { +--- a/kernel/exit.c ++++ b/kernel/exit.c +@@ -510,6 +510,7 @@ struct files_struct *get_files_struct(st + + return files; + } ++EXPORT_SYMBOL_GPL(get_files_struct); + + void put_files_struct(struct files_struct *files) + { +@@ -529,6 +530,7 @@ void put_files_struct(struct files_struc + free_fdtable(fdt); + } + } ++EXPORT_SYMBOL_GPL(put_files_struct); + + void reset_files_struct(struct files_struct *files) + { +--- a/kernel/fork.c ++++ b/kernel/fork.c +@@ -168,6 +168,7 @@ void __put_task_struct(struct task_struc + if (!profile_handoff_task(tsk)) + free_task(tsk); + } ++EXPORT_SYMBOL_GPL(__put_task_struct); + + /* + * macro override instead of weak attribute alias, to workaround +--- a/kernel/sched.c ++++ b/kernel/sched.c +@@ -6046,6 +6046,7 @@ int can_nice(const struct task_struct *p + return (nice_rlim <= p->signal->rlim[RLIMIT_NICE].rlim_cur || + capable(CAP_SYS_NICE)); + } ++EXPORT_SYMBOL_GPL(can_nice); + + #ifdef __ARCH_WANT_SYS_NICE + +--- a/mm/memory.c ++++ b/mm/memory.c +@@ -1097,6 +1097,7 @@ unsigned long zap_page_range(struct vm_a + tlb_finish_mmu(tlb, address, end); + return end; + } ++EXPORT_SYMBOL_GPL(zap_page_range); + + /** + * zap_vma_ptes - remove ptes mapping the vma +@@ -2483,6 +2484,7 @@ int vmtruncate_range(struct inode *inode + + return 0; + } ++EXPORT_SYMBOL_GPL(vmtruncate_range); + + /* + * We enter with non-exclusive mmap_sem (to exclude vma changes, +--- a/mm/vmalloc.c ++++ b/mm/vmalloc.c +@@ -1113,6 +1113,7 @@ void unmap_kernel_range(unsigned long ad + vunmap_page_range(addr, end); + flush_tlb_kernel_range(addr, end); + } ++EXPORT_SYMBOL_GPL(unmap_kernel_range); + + int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages) + { +@@ -1228,6 +1229,7 @@ struct vm_struct *get_vm_area(unsigned l + return __get_vm_area_node(size, 1, flags, VMALLOC_START, VMALLOC_END, + -1, GFP_KERNEL, __builtin_return_address(0)); + } ++EXPORT_SYMBOL_GPL(get_vm_area); + + struct vm_struct *get_vm_area_caller(unsigned long size, unsigned long flags, + void *caller) +--- a/include/linux/mm.h ++++ b/include/linux/mm.h +@@ -713,6 +713,7 @@ extern void show_free_areas(void); + + int shmem_lock(struct file *file, int lock, struct user_struct *user); + struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags); ++void shmem_set_file(struct vm_area_struct *vma, struct file *file); + int shmem_zero_setup(struct vm_area_struct *); + + #ifndef CONFIG_MMU +--- a/kernel/signal.c ++++ b/kernel/signal.c +@@ -1069,6 +1069,7 @@ struct sighand_struct *lock_task_sighand + + return sighand; + } ++EXPORT_SYMBOL(lock_task_sighand); + + /* + * send signal info to all the members of a group diff --git a/target/linux/generic-2.6/patches-2.6.32/985-cris-headers.patch b/target/linux/generic-2.6/patches-2.6.32/985-cris-headers.patch new file mode 100644 index 000000000..73ede933b --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/985-cris-headers.patch @@ -0,0 +1,27 @@ +--- a/arch/cris/include/arch-v10/arch/Kbuild ++++ b/arch/cris/include/arch-v10/arch/Kbuild +@@ -1,3 +1,5 @@ ++header-y += elf.h ++header-y += ptrace.h + header-y += user.h + header-y += svinto.h + header-y += sv_addr_ag.h +--- a/arch/cris/include/asm/Kbuild ++++ b/arch/cris/include/asm/Kbuild +@@ -1,11 +1,14 @@ + include include/asm-generic/Kbuild.asm + +-header-y += arch-v10/ +-header-y += arch-v32/ ++header-y += ../arch-v10/arch/ ++header-y += ../arch-v32/arch/ + ++header-y += elf.h + header-y += ethernet.h ++header-y += page.h + header-y += rtc.h + header-y += sync_serial.h ++header-y += user.h + + unifdef-y += etraxgpio.h + unifdef-y += rs485.h diff --git a/target/linux/generic-2.6/patches-2.6.32/991-ppc4xx_optimization.patch b/target/linux/generic-2.6/patches-2.6.32/991-ppc4xx_optimization.patch new file mode 100644 index 000000000..0efb77780 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/991-ppc4xx_optimization.patch @@ -0,0 +1,31 @@ +Upstream doesn't optimize the kernel and bootwrappers for ppc44x because +they still want to support gcc 3.3 -- well, we don't. + +--- a/arch/powerpc/Makefile ++++ b/arch/powerpc/Makefile +@@ -123,7 +123,8 @@ ifeq ($(CONFIG_FUNCTION_TRACER),y) + KBUILD_CFLAGS += -mno-sched-epilog + endif + +-cpu-as-$(CONFIG_4xx) += -Wa,-m405 ++cpu-as-$(CONFIG_40x) += -Wa,-m405 ++cpu-as-$(CONFIG_44x) += -Wa,-m440 + cpu-as-$(CONFIG_6xx) += -Wa,-maltivec + cpu-as-$(CONFIG_POWER4) += -Wa,-maltivec + cpu-as-$(CONFIG_E500) += -Wa,-me500 +--- a/arch/powerpc/boot/Makefile ++++ b/arch/powerpc/boot/Makefile +@@ -38,10 +38,10 @@ BOOTCFLAGS += -I$(obj) -I$(srctree)/$(ob + DTS_FLAGS ?= -p 1024 + + $(obj)/4xx.o: BOOTCFLAGS += -mcpu=405 +-$(obj)/ebony.o: BOOTCFLAGS += -mcpu=405 ++$(obj)/ebony.o: BOOTCFLAGS += -mcpu=440 + $(obj)/cuboot-hotfoot.o: BOOTCFLAGS += -mcpu=405 +-$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=405 +-$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=405 ++$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=440 ++$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=440 + $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405 + $(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405 + $(obj)/virtex405-head.o: BOOTAFLAGS += -mcpu=405 diff --git a/target/linux/generic-2.6/patches-2.6.32/998-openwrt_lzma_options.patch b/target/linux/generic-2.6/patches-2.6.32/998-openwrt_lzma_options.patch new file mode 100644 index 000000000..f9108f271 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/998-openwrt_lzma_options.patch @@ -0,0 +1,42 @@ +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -228,5 +228,5 @@ cmd_bzip2 = (cat $(filter-out FORCE,$^) + + quiet_cmd_lzma = LZMA $@ + cmd_lzma = (cat $(filter-out FORCE,$^) | \ +- lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ ++ lzma e -lc1 -lp2 -pb2 -eos -si -so && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ + (rm -f $@ ; false) +--- a/scripts/gen_initramfs_list.sh ++++ b/scripts/gen_initramfs_list.sh +@@ -225,7 +225,7 @@ cpio_list= + output="/dev/stdout" + output_file="" + is_cpio_compressed= +-compr="gzip -9 -f" ++compr="gzip -9 -f -" + + arg="$1" + case "$arg" in +@@ -239,9 +239,9 @@ case "$arg" in + output_file="$1" + cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)" + output=${cpio_list} +- echo "$output_file" | grep -q "\.gz$" && compr="gzip -9 -f" +- echo "$output_file" | grep -q "\.bz2$" && compr="bzip2 -9 -f" +- echo "$output_file" | grep -q "\.lzma$" && compr="lzma -9 -f" ++ echo "$output_file" | grep -q "\.gz$" && compr="gzip -9 -f -" ++ echo "$output_file" | grep -q "\.bz2$" && compr="bzip2 -9 -f -" ++ echo "$output_file" | grep -q "\.lzma$" && compr="lzma e -lc1 -lp2 -pb2 -eos -si -so" + echo "$output_file" | grep -q "\.cpio$" && compr="cat" + shift + ;; +@@ -292,7 +292,7 @@ if [ ! -z ${output_file} ]; then + if [ "${is_cpio_compressed}" = "compressed" ]; then + cat ${cpio_tfile} > ${output_file} + else +- (cat ${cpio_tfile} | ${compr} - > ${output_file}) \ ++ (cat ${cpio_tfile} | ${compr} > ${output_file}) \ + || (rm -f ${output_file} ; false) + fi + [ -z ${cpio_file} ] && rm ${cpio_tfile} diff --git a/target/linux/generic-2.6/patches-2.6.32/999-use_preinit_as_init.patch b/target/linux/generic-2.6/patches-2.6.32/999-use_preinit_as_init.patch new file mode 100644 index 000000000..8887afa78 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/999-use_preinit_as_init.patch @@ -0,0 +1,14 @@ +--- a/init/main.c ++++ b/init/main.c +@@ -843,10 +843,7 @@ static noinline int init_post(void) + printk(KERN_WARNING "Failed to execute %s. Attempting " + "defaults...\n", execute_command); + } +- run_init_process("/sbin/init"); +- run_init_process("/etc/init"); +- run_init_process("/bin/init"); +- run_init_process("/bin/sh"); ++ run_init_process("/etc/preinit"); + + panic("No init found. Try passing init= option to kernel."); + } diff --git a/target/linux/ixp4xx/config-2.6.32 b/target/linux/ixp4xx/config-2.6.32 new file mode 100644 index 000000000..79bb193f6 --- /dev/null +++ b/target/linux/ixp4xx/config-2.6.32 @@ -0,0 +1,157 @@ +# CONFIG_AEABI is not set +CONFIG_ALIGNMENT_TRAP=y +# CONFIG_ARCH_ADI_COYOTE is not set +CONFIG_ARCH_IXCDP1100=y +CONFIG_ARCH_IXDP425=y +CONFIG_ARCH_IXDP4XX=y +CONFIG_ARCH_IXP4XX=y +# CONFIG_ARCH_PRPMC1100 is not set +CONFIG_ARCH_REQUIRE_GPIOLIB=y +# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set +# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set +CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y +# CONFIG_ARCH_SUPPORTS_MSI is not set +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARM=y +# CONFIG_ARM_THUMB is not set +# CONFIG_ARPD is not set +CONFIG_BASE_SMALL=0 +CONFIG_BITREVERSE=y +CONFIG_BOUNCE=y +CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200" +CONFIG_CPU_32=y +CONFIG_CPU_32v5=y +CONFIG_CPU_ABRT_EV5T=y +CONFIG_CPU_BIG_ENDIAN=y +CONFIG_CPU_CACHE_VIVT=y +CONFIG_CPU_CP15=y +CONFIG_CPU_CP15_MMU=y +CONFIG_CPU_ENDIAN_BE32=y +# CONFIG_CPU_ENDIAN_BE8 is not set +CONFIG_CPU_IXP43X=y +CONFIG_CPU_IXP46X=y +CONFIG_CPU_PABRT_NOIFAR=y +CONFIG_CPU_TLB_V4WBI=y +CONFIG_CPU_XSCALE=y +CONFIG_CRC16=y +# CONFIG_DEBUG_BUGVERBOSE is not set +# CONFIG_DEBUG_USER is not set +CONFIG_DECOMPRESS_LZMA=y +CONFIG_DEVPORT=y +# CONFIG_DM9000 is not set +CONFIG_DMABOUNCE=y +CONFIG_DNOTIFY=y +CONFIG_EEPROM_AT24=y +# CONFIG_FPE_FASTFPE is not set +# CONFIG_FPE_NWFPE is not set +CONFIG_FRAME_POINTER=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_FIND_LAST_BIT=y +CONFIG_GENERIC_GPIO=y +CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVICE=y +CONFIG_GPIO_GW_I2C_PLD=y +CONFIG_GPIO_SYSFS=y +# CONFIG_HAMRADIO is not set +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +CONFIG_HAVE_AOUT=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_IDE=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_HAVE_MTD_OTP=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HWMON=y +# CONFIG_HWMON_DEBUG_CHIP is not set +CONFIG_HWMON_VID=y +CONFIG_HW_RANDOM=y +CONFIG_HW_RANDOM_IXP4XX=y +CONFIG_I2C=y +CONFIG_I2C_ALGOBIT=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_GPIO=y +# CONFIG_I2C_IOP3XX is not set +CONFIG_INITRAMFS_SOURCE="" +CONFIG_IP_PIMSM_V1=y +CONFIG_IP_PIMSM_V2=y +# CONFIG_ISDN is not set +# CONFIG_IWMMXT is not set +CONFIG_IXP4XX_ETH=y +# CONFIG_IXP4XX_INDIRECT_PCI is not set +CONFIG_IXP4XX_LEGACY_DMABOUNCE=y +CONFIG_IXP4XX_NPE=y +CONFIG_IXP4XX_QMGR=y +CONFIG_IXP4XX_WATCHDOG=y +CONFIG_LEDS_FSG=y +CONFIG_LEDS_GPIO=y +CONFIG_LEDS_LATCH=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_MACH_AP1000=y +CONFIG_MACH_AVILA=y +CONFIG_MACH_CAMBRIA=y +CONFIG_MACH_COMPEX=y +CONFIG_MACH_DSMG600=y +CONFIG_MACH_FSG=y +CONFIG_MACH_GATEWAY7001=y +# CONFIG_MACH_GORAMO_MLR is not set +# CONFIG_MACH_GTWX5715 is not set +# CONFIG_MACH_IXDP465 is not set +CONFIG_MACH_IXDPG425=y +# CONFIG_MACH_KIXRP435 is not set +CONFIG_MACH_LOFT=y +CONFIG_MACH_MI424WR=y +CONFIG_MACH_NAS100D=y +CONFIG_MACH_NSLU2=y +CONFIG_MACH_PRONGHORN=y +CONFIG_MACH_PRONGHORNMETRO=y +CONFIG_MACH_SIDEWINDER=y +CONFIG_MACH_TW5334=y +CONFIG_MACH_USR8200=y +CONFIG_MACH_WG302V1=y +CONFIG_MACH_WG302V2=y +CONFIG_MACH_WRT300NV2=y +CONFIG_MTD_CFI_ADV_OPTIONS=y +# CONFIG_MTD_CFI_GEOMETRY is not set +CONFIG_MTD_IXP4XX=y +CONFIG_MTD_OTP=y +CONFIG_MTD_REDBOOT_PARTS=y +# CONFIG_NATSEMI is not set +# CONFIG_NVRAM is not set +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PAGE_OFFSET=0xC0000000 +CONFIG_PCI=y +CONFIG_PCI_SYSCALL=y +CONFIG_PHYLIB=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_DRV_DS1672=y +CONFIG_RTC_DRV_ISL1208=y +CONFIG_RTC_DRV_PCF8563=y +CONFIG_RTC_DRV_X1205=y +# CONFIG_SCSI_DMA is not set +CONFIG_SENSORS_AD7418=y +CONFIG_SENSORS_MAX6650=y +CONFIG_SENSORS_W83781D=y +# CONFIG_SERIAL_8250_EXTENDED is not set +CONFIG_SERIAL_8250_NR_UARTS=4 +CONFIG_SERIAL_8250_RUNTIME_UARTS=4 +CONFIG_SPLIT_PTLOCK_CPUS=4096 +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +CONFIG_TICK_ONESHOT=y +CONFIG_UID16=y +CONFIG_USB_SUPPORT=y +CONFIG_VECTORS_BASE=0xffff0000 +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_WATCHDOG_NOWAYOUT=y +CONFIG_XSCALE_PMU=y +CONFIG_ZBOOT_ROM_BSS=0x0 +CONFIG_ZBOOT_ROM_TEXT=0x0 diff --git a/target/linux/ixp4xx/patches-2.6.32/010-ixp43x_pci_fixup.patch b/target/linux/ixp4xx/patches-2.6.32/010-ixp43x_pci_fixup.patch new file mode 100644 index 000000000..35af7f4fa --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/010-ixp43x_pci_fixup.patch @@ -0,0 +1,11 @@ +--- a/arch/arm/mach-ixp4xx/include/mach/hardware.h ++++ b/arch/arm/mach-ixp4xx/include/mach/hardware.h +@@ -18,7 +18,7 @@ + #define __ASM_ARCH_HARDWARE_H__ + + #define PCIBIOS_MIN_IO 0x00001000 +-#define PCIBIOS_MIN_MEM (cpu_is_ixp43x() ? 0x40000000 : 0x48000000) ++#define PCIBIOS_MIN_MEM 0x48000000 + + /* + * We override the standard dma-mask routines for bouncing. diff --git a/target/linux/ixp4xx/patches-2.6.32/020-gateworks_i2c_pld.patch b/target/linux/ixp4xx/patches-2.6.32/020-gateworks_i2c_pld.patch new file mode 100644 index 000000000..a09a3bece --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/020-gateworks_i2c_pld.patch @@ -0,0 +1,421 @@ +--- /dev/null ++++ b/drivers/gpio/gw_i2c_pld.c +@@ -0,0 +1,371 @@ ++/* ++ * Gateworks I2C PLD GPIO expander ++ * ++ * Copyright (C) 2009 Gateworks Corporation ++ * ++ * 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 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static const struct i2c_device_id gw_i2c_pld_id[] = { ++ { "gw_i2c_pld", 8 }, ++ { } ++}; ++MODULE_DEVICE_TABLE(i2c, gw_i2c_pld_id); ++ ++/* ++ * The Gateworks I2C PLD chip only expose one read and one ++ * write register. Writing a "one" bit (to match the reset state) lets ++ * that pin be used as an input. It is an open-drain model. ++ */ ++ ++struct gw_i2c_pld { ++ struct gpio_chip chip; ++ struct i2c_client *client; ++ unsigned out; /* software latch */ ++}; ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* ++ * The Gateworks I2C PLD chip does not properly send the acknowledge bit ++ * thus we cannot use standard i2c_smbus functions. We have recreated ++ * our own here, but we still use the mutex_lock to lock the i2c_bus ++ * as the device still exists on the I2C bus. ++*/ ++ ++#define PLD_SCL_GPIO 6 ++#define PLD_SDA_GPIO 7 ++ ++#define SCL_LO() gpio_line_set(PLD_SCL_GPIO, IXP4XX_GPIO_LOW) ++#define SCL_HI() gpio_line_set(PLD_SCL_GPIO, IXP4XX_GPIO_HIGH) ++#define SCL_EN() gpio_line_config(PLD_SCL_GPIO, IXP4XX_GPIO_OUT) ++#define SDA_LO() gpio_line_set(PLD_SDA_GPIO, IXP4XX_GPIO_LOW) ++#define SDA_HI() gpio_line_set(PLD_SDA_GPIO, IXP4XX_GPIO_HIGH) ++#define SDA_EN() gpio_line_config(PLD_SDA_GPIO, IXP4XX_GPIO_OUT) ++#define SDA_DIS() gpio_line_config(PLD_SDA_GPIO, IXP4XX_GPIO_IN) ++#define SDA_IN(x) gpio_line_get(PLD_SDA_GPIO, &x); ++ ++static int i2c_pld_write_byte(int address, int byte) ++{ ++ int i; ++ ++ address = (address << 1) & ~0x1; ++ ++ SDA_HI(); ++ SDA_EN(); ++ SCL_EN(); ++ SCL_HI(); ++ SDA_LO(); ++ SCL_LO(); ++ ++ for (i = 7; i >= 0; i--) ++ { ++ if (address & (1 << i)) ++ SDA_HI(); ++ else ++ SDA_LO(); ++ ++ SCL_HI(); ++ SCL_LO(); ++ } ++ ++ SDA_DIS(); ++ SCL_HI(); ++ SDA_IN(i); ++ SCL_LO(); ++ SDA_EN(); ++ ++ for (i = 7; i >= 0; i--) ++ { ++ if (byte & (1 << i)) ++ SDA_HI(); ++ else ++ SDA_LO(); ++ SCL_HI(); ++ SCL_LO(); ++ } ++ ++ SDA_DIS(); ++ SCL_HI(); ++ SDA_IN(i); ++ SCL_LO(); ++ ++ SDA_HI(); ++ SDA_EN(); ++ ++ SDA_LO(); ++ SCL_HI(); ++ SDA_HI(); ++ SCL_LO(); ++ SCL_HI(); ++ ++ return 0; ++} ++ ++static unsigned int i2c_pld_read_byte(int address) ++{ ++ int i = 0, byte = 0; ++ int bit; ++ ++ address = (address << 1) | 0x1; ++ ++ SDA_HI(); ++ SDA_EN(); ++ SCL_EN(); ++ SCL_HI(); ++ SDA_LO(); ++ SCL_LO(); ++ ++ for (i = 7; i >= 0; i--) ++ { ++ if (address & (1 << i)) ++ SDA_HI(); ++ else ++ SDA_LO(); ++ ++ SCL_HI(); ++ SCL_LO(); ++ } ++ ++ SDA_DIS(); ++ SCL_HI(); ++ SDA_IN(i); ++ SCL_LO(); ++ SDA_EN(); ++ ++ SDA_DIS(); ++ for (i = 7; i >= 0; i--) ++ { ++ SCL_HI(); ++ SDA_IN(bit); ++ byte |= bit << i; ++ SCL_LO(); ++ } ++ ++ SDA_LO(); ++ SCL_HI(); ++ SDA_HI(); ++ SCL_LO(); ++ SCL_HI(); ++ ++ return byte; ++} ++ ++ ++static int gw_i2c_pld_input8(struct gpio_chip *chip, unsigned offset) ++{ ++ int ret; ++ struct gw_i2c_pld *gpio = container_of(chip, struct gw_i2c_pld, chip); ++ struct i2c_adapter *adap = gpio->client->adapter; ++ ++ if (in_atomic() || irqs_disabled()) { ++ ret = mutex_trylock(&adap->bus_lock); ++ if (!ret) ++ /* I2C activity is ongoing. */ ++ return -EAGAIN; ++ } else { ++ mutex_lock_nested(&adap->bus_lock, adap->level); ++ } ++ ++ gpio->out |= (1 << offset); ++ ++ ret = i2c_pld_write_byte(gpio->client->addr, gpio->out); ++ ++ mutex_unlock(&adap->bus_lock); ++ ++ return ret; ++} ++ ++static int gw_i2c_pld_get8(struct gpio_chip *chip, unsigned offset) ++{ ++ int ret; ++ s32 value; ++ struct gw_i2c_pld *gpio = container_of(chip, struct gw_i2c_pld, chip); ++ struct i2c_adapter *adap = gpio->client->adapter; ++ ++ if (in_atomic() || irqs_disabled()) { ++ ret = mutex_trylock(&adap->bus_lock); ++ if (!ret) ++ /* I2C activity is ongoing. */ ++ return -EAGAIN; ++ } else { ++ mutex_lock_nested(&adap->bus_lock, adap->level); ++ } ++ ++ value = i2c_pld_read_byte(gpio->client->addr); ++ ++ mutex_unlock(&adap->bus_lock); ++ ++ return (value < 0) ? 0 : (value & (1 << offset)); ++} ++ ++static int gw_i2c_pld_output8(struct gpio_chip *chip, unsigned offset, int value) ++{ ++ int ret; ++ ++ struct gw_i2c_pld *gpio = container_of(chip, struct gw_i2c_pld, chip); ++ struct i2c_adapter *adap = gpio->client->adapter; ++ ++ unsigned bit = 1 << offset; ++ ++ if (in_atomic() || irqs_disabled()) { ++ ret = mutex_trylock(&adap->bus_lock); ++ if (!ret) ++ /* I2C activity is ongoing. */ ++ return -EAGAIN; ++ } else { ++ mutex_lock_nested(&adap->bus_lock, adap->level); ++ } ++ ++ ++ if (value) ++ gpio->out |= bit; ++ else ++ gpio->out &= ~bit; ++ ++ ret = i2c_pld_write_byte(gpio->client->addr, gpio->out); ++ ++ mutex_unlock(&adap->bus_lock); ++ ++ return ret; ++} ++ ++static void gw_i2c_pld_set8(struct gpio_chip *chip, unsigned offset, int value) ++{ ++ gw_i2c_pld_output8(chip, offset, value); ++} ++ ++/*-------------------------------------------------------------------------*/ ++ ++static int gw_i2c_pld_probe(struct i2c_client *client, ++ const struct i2c_device_id *id) ++{ ++ struct gw_i2c_pld_platform_data *pdata; ++ struct gw_i2c_pld *gpio; ++ int status; ++ ++ pdata = client->dev.platform_data; ++ if (!pdata) ++ return -ENODEV; ++ ++ /* Allocate, initialize, and register this gpio_chip. */ ++ gpio = kzalloc(sizeof *gpio, GFP_KERNEL); ++ if (!gpio) ++ return -ENOMEM; ++ ++ gpio->chip.base = pdata->gpio_base; ++ gpio->chip.can_sleep = 1; ++ gpio->chip.dev = &client->dev; ++ gpio->chip.owner = THIS_MODULE; ++ ++ gpio->chip.ngpio = pdata->nr_gpio; ++ gpio->chip.direction_input = gw_i2c_pld_input8; ++ gpio->chip.get = gw_i2c_pld_get8; ++ gpio->chip.direction_output = gw_i2c_pld_output8; ++ gpio->chip.set = gw_i2c_pld_set8; ++ ++ gpio->chip.label = client->name; ++ ++ gpio->client = client; ++ i2c_set_clientdata(client, gpio); ++ ++ gpio->out = 0xFF; ++ ++ status = gpiochip_add(&gpio->chip); ++ if (status < 0) ++ goto fail; ++ ++ dev_info(&client->dev, "gpios %d..%d on a %s%s\n", ++ gpio->chip.base, ++ gpio->chip.base + gpio->chip.ngpio - 1, ++ client->name, ++ client->irq ? " (irq ignored)" : ""); ++ ++ /* Let platform code set up the GPIOs and their users. ++ * Now is the first time anyone could use them. ++ */ ++ if (pdata->setup) { ++ status = pdata->setup(client, ++ gpio->chip.base, gpio->chip.ngpio, ++ pdata->context); ++ if (status < 0) ++ dev_warn(&client->dev, "setup --> %d\n", status); ++ } ++ ++ return 0; ++ ++fail: ++ dev_dbg(&client->dev, "probe error %d for '%s'\n", ++ status, client->name); ++ kfree(gpio); ++ return status; ++} ++ ++static int gw_i2c_pld_remove(struct i2c_client *client) ++{ ++ struct gw_i2c_pld_platform_data *pdata = client->dev.platform_data; ++ struct gw_i2c_pld *gpio = i2c_get_clientdata(client); ++ int status = 0; ++ ++ if (pdata->teardown) { ++ status = pdata->teardown(client, ++ gpio->chip.base, gpio->chip.ngpio, ++ pdata->context); ++ if (status < 0) { ++ dev_err(&client->dev, "%s --> %d\n", ++ "teardown", status); ++ return status; ++ } ++ } ++ ++ status = gpiochip_remove(&gpio->chip); ++ if (status == 0) ++ kfree(gpio); ++ else ++ dev_err(&client->dev, "%s --> %d\n", "remove", status); ++ return status; ++} ++ ++static struct i2c_driver gw_i2c_pld_driver = { ++ .driver = { ++ .name = "gw_i2c_pld", ++ .owner = THIS_MODULE, ++ }, ++ .probe = gw_i2c_pld_probe, ++ .remove = gw_i2c_pld_remove, ++ .id_table = gw_i2c_pld_id, ++}; ++ ++static int __init gw_i2c_pld_init(void) ++{ ++ return i2c_add_driver(&gw_i2c_pld_driver); ++} ++module_init(gw_i2c_pld_init); ++ ++static void __exit gw_i2c_pld_exit(void) ++{ ++ i2c_del_driver(&gw_i2c_pld_driver); ++} ++module_exit(gw_i2c_pld_exit); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Chris Lang"); +--- a/drivers/gpio/Kconfig ++++ b/drivers/gpio/Kconfig +@@ -196,6 +196,14 @@ config GPIO_LANGWELL + help + Say Y here to support Intel Moorestown platform GPIO. + ++config GPIO_GW_I2C_PLD ++ tristate "Gateworks I2C PLD GPIO Expander" ++ depends on I2C ++ help ++ Say yes here to provide access to the Gateworks I2C PLD GPIO ++ Expander. This is used at least on the GW2358-4. ++ ++ + comment "SPI GPIO expanders:" + + config GPIO_MAX7301 +--- a/drivers/gpio/Makefile ++++ b/drivers/gpio/Makefile +@@ -19,3 +19,4 @@ obj-$(CONFIG_GPIO_XILINX) += xilinx_gpio + obj-$(CONFIG_GPIO_BT8XX) += bt8xxgpio.o + obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.o + obj-$(CONFIG_GPIO_WM831X) += wm831x-gpio.o ++obj-$(CONFIG_GPIO_GW_I2C_PLD) += gw_i2c_pld.o +--- /dev/null ++++ b/include/linux/i2c/gw_i2c_pld.h +@@ -0,0 +1,20 @@ ++#ifndef __LINUX_GW_I2C_PLD_H ++#define __LINUX_GW_I2C_PLD_H ++ ++/** ++ * The Gateworks I2C PLD Implements an additional 8 bits of GPIO through the PLD ++ */ ++ ++struct gw_i2c_pld_platform_data { ++ unsigned gpio_base; ++ unsigned nr_gpio; ++ int (*setup)(struct i2c_client *client, ++ int gpio, unsigned ngpio, ++ void *context); ++ int (*teardown)(struct i2c_client *client, ++ int gpio, unsigned ngpio, ++ void *context); ++ void *context; ++}; ++ ++#endif /* __LINUX_GW_I2C_PLD_H */ diff --git a/target/linux/ixp4xx/patches-2.6.32/050-disable_dmabounce.patch b/target/linux/ixp4xx/patches-2.6.32/050-disable_dmabounce.patch new file mode 100644 index 000000000..9e1c02304 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/050-disable_dmabounce.patch @@ -0,0 +1,164 @@ +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -415,7 +415,6 @@ config ARCH_IXP4XX + select GENERIC_GPIO + select GENERIC_TIME + select GENERIC_CLOCKEVENTS +- select DMABOUNCE if PCI + help + Support for Intel's IXP4XX (XScale) family of processors. + +--- a/arch/arm/mach-ixp4xx/Kconfig ++++ b/arch/arm/mach-ixp4xx/Kconfig +@@ -199,6 +199,45 @@ config IXP4XX_INDIRECT_PCI + need to use the indirect method instead. If you don't know + what you need, leave this option unselected. + ++config IXP4XX_LEGACY_DMABOUNCE ++ bool "legacy PCI DMA bounce support" ++ depends on PCI ++ default n ++ select DMABOUNCE ++ help ++ The IXP4xx is limited to a 64MB window for PCI DMA, which ++ requires that PCI accesses above 64MB are bounced via buffers ++ below 64MB. Furthermore the IXP4xx has an erratum where PCI ++ read prefetches just below the 64MB limit can trigger lockups. ++ ++ The kernel has traditionally handled these two issue by using ++ ARM specific DMA bounce support code for all accesses >= 64MB. ++ That code causes problems of its own, so it is desirable to ++ disable it. As the kernel now has a workaround for the PCI read ++ prefetch erratum, it no longer requires the ARM bounce code. ++ ++ Enabling this option makes IXP4xx continue to use the problematic ++ ARM DMA bounce code. Disabling this option makes IXP4xx use the ++ kernel's generic bounce code. ++ ++ Say 'N'. ++ ++config IXP4XX_ZONE_DMA ++ bool "Support > 64MB RAM" ++ depends on !IXP4XX_LEGACY_DMABOUNCE ++ default y ++ select ZONE_DMA ++ help ++ The IXP4xx is limited to a 64MB window for PCI DMA, which ++ requires that PCI accesses above 64MB are bounced via buffers ++ below 64MB. ++ ++ Disabling this option allows you to omit the support code for ++ DMA-able memory allocations and DMA bouncing, but the kernel ++ will then not work properly if more than 64MB of RAM is present. ++ ++ Say 'Y' unless your platform is limited to <= 64MB of RAM. ++ + config IXP4XX_QMGR + tristate "IXP4xx Queue Manager support" + help +--- a/arch/arm/mach-ixp4xx/common-pci.c ++++ b/arch/arm/mach-ixp4xx/common-pci.c +@@ -321,27 +321,38 @@ static int abort_handler(unsigned long a + */ + static int ixp4xx_pci_platform_notify(struct device *dev) + { +- if(dev->bus == &pci_bus_type) { +- *dev->dma_mask = SZ_64M - 1; ++ if (dev->bus == &pci_bus_type) { ++ *dev->dma_mask = SZ_64M - 1; + dev->coherent_dma_mask = SZ_64M - 1; ++#ifdef CONFIG_DMABOUNCE + dmabounce_register_dev(dev, 2048, 4096); ++#endif + } + return 0; + } + + static int ixp4xx_pci_platform_notify_remove(struct device *dev) + { +- if(dev->bus == &pci_bus_type) { ++#ifdef CONFIG_DMABOUNCE ++ if (dev->bus == &pci_bus_type) + dmabounce_unregister_dev(dev); +- } ++#endif + return 0; + } + ++#ifdef CONFIG_DMABOUNCE + int dma_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t size) + { ++ /* Note that this returns true for the last page below 64M due to ++ * IXP4xx erratum 15 (SCR 1289), which states that PCI prefetches ++ * can cross the boundary between valid memory and a reserved region ++ * causing AHB bus errors and a lock-up. ++ */ + return (dev->bus == &pci_bus_type ) && ((dma_addr + size) >= SZ_64M); + } ++#endif + ++#ifdef CONFIG_ZONE_DMA + /* + * Only first 64MB of memory can be accessed via PCI. + * We use GFP_DMA to allocate safe buffers to do map/unmap. +@@ -364,6 +375,7 @@ void __init ixp4xx_adjust_zones(int node + zhole_size[1] = zhole_size[0]; + zhole_size[0] = 0; + } ++#endif + + void __init ixp4xx_pci_preinit(void) + { +@@ -517,19 +529,35 @@ struct pci_bus * __devinit ixp4xx_scan_b + int + pci_set_dma_mask(struct pci_dev *dev, u64 mask) + { +- if (mask >= SZ_64M - 1 ) ++#ifdef CONFIG_DMABOUNCE ++ if (mask >= SZ_64M - 1) + return 0; + + return -EIO; ++#else ++ /* Only honour masks < SZ_64M. Silently ignore masks >= SZ_64M ++ as generic drivers do not know about IXP4xx PCI DMA quirks. */ ++ if (mask < SZ_64M) ++ dev->dma_mask = mask; ++ return 0; ++#endif + } + + int + pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) + { +- if (mask >= SZ_64M - 1 ) ++#ifdef CONFIG_DMABOUNCE ++ if (mask >= SZ_64M - 1) + return 0; + + return -EIO; ++#else ++ /* Only honour masks < SZ_64M. Silently ignore masks >= SZ_64M ++ as generic drivers do not know about IXP4xx PCI DMA quirks. */ ++ if (mask < SZ_64M) ++ dev->dev.coherent_dma_mask = mask; ++ return 0; ++#endif + } + + EXPORT_SYMBOL(ixp4xx_pci_read); +--- a/arch/arm/mach-ixp4xx/include/mach/memory.h ++++ b/arch/arm/mach-ixp4xx/include/mach/memory.h +@@ -16,10 +16,12 @@ + + #if !defined(__ASSEMBLY__) && defined(CONFIG_PCI) + ++#ifdef CONFIG_ZONE_DMA + void ixp4xx_adjust_zones(int node, unsigned long *size, unsigned long *holes); + + #define arch_adjust_zones(node, size, holes) \ + ixp4xx_adjust_zones(node, size, holes) ++#endif + + #define ISA_DMA_THRESHOLD (SZ_64M - 1) + #define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_64M) diff --git a/target/linux/ixp4xx/patches-2.6.32/090-increase_entropy_pools.patch b/target/linux/ixp4xx/patches-2.6.32/090-increase_entropy_pools.patch new file mode 100644 index 000000000..f67b9b0e7 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/090-increase_entropy_pools.patch @@ -0,0 +1,15 @@ +--- a/drivers/char/random.c ++++ b/drivers/char/random.c +@@ -264,9 +264,9 @@ + /* + * Configuration information + */ +-#define INPUT_POOL_WORDS 128 +-#define OUTPUT_POOL_WORDS 32 +-#define SEC_XFER_SIZE 512 ++#define INPUT_POOL_WORDS 256 ++#define OUTPUT_POOL_WORDS 64 ++#define SEC_XFER_SIZE 1024 + + /* + * The minimum number of bits of entropy before we wake up a read on diff --git a/target/linux/ixp4xx/patches-2.6.32/100-wg302v2_gateway7001_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.32/100-wg302v2_gateway7001_mac_plat_info.patch new file mode 100644 index 000000000..a19a4085a --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/100-wg302v2_gateway7001_mac_plat_info.patch @@ -0,0 +1,68 @@ +--- a/arch/arm/mach-ixp4xx/gateway7001-setup.c ++++ b/arch/arm/mach-ixp4xx/gateway7001-setup.c +@@ -76,9 +76,35 @@ static struct platform_device gateway700 + .resource = &gateway7001_uart_resource, + }; + ++static struct eth_plat_info gateway7001_plat_eth[] = { ++ { ++ .phy = 1, ++ .rxq = 3, ++ .txreadyq = 20, ++ }, { ++ .phy = 2, ++ .rxq = 4, ++ .txreadyq = 21, ++ } ++}; ++ ++static struct platform_device gateway7001_eth[] = { ++ { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEB, ++ .dev.platform_data = gateway7001_plat_eth, ++ }, { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEC, ++ .dev.platform_data = gateway7001_plat_eth + 1, ++ } ++}; ++ + static struct platform_device *gateway7001_devices[] __initdata = { + &gateway7001_flash, +- &gateway7001_uart ++ &gateway7001_uart, ++ &gateway7001_eth[0], ++ &gateway7001_eth[1], + }; + + static void __init gateway7001_init(void) +--- a/arch/arm/mach-ixp4xx/wg302v2-setup.c ++++ b/arch/arm/mach-ixp4xx/wg302v2-setup.c +@@ -77,9 +77,26 @@ static struct platform_device wg302v2_ua + .resource = &wg302v2_uart_resource, + }; + ++static struct eth_plat_info wg302v2_plat_eth[] = { ++ { ++ .phy = 8, ++ .rxq = 3, ++ .txreadyq = 20, ++ } ++}; ++ ++static struct platform_device wg302v2_eth[] = { ++ { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEB, ++ .dev.platform_data = wg302v2_plat_eth, ++ } ++}; ++ + static struct platform_device *wg302v2_devices[] __initdata = { + &wg302v2_flash, + &wg302v2_uart, ++ &wg302v2_eth[0], + }; + + static void __init wg302v2_init(void) diff --git a/target/linux/ixp4xx/patches-2.6.32/105-wg302v1_support.patch b/target/linux/ixp4xx/patches-2.6.32/105-wg302v1_support.patch new file mode 100644 index 000000000..e8b4342e7 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/105-wg302v1_support.patch @@ -0,0 +1,257 @@ +--- a/arch/arm/configs/ixp4xx_defconfig ++++ b/arch/arm/configs/ixp4xx_defconfig +@@ -155,6 +155,7 @@ CONFIG_MACH_AVILA=y + CONFIG_MACH_LOFT=y + CONFIG_ARCH_ADI_COYOTE=y + CONFIG_MACH_GATEWAY7001=y ++CONFIG_MACH_WG302V1=y + CONFIG_MACH_WG302V2=y + CONFIG_ARCH_IXDP425=y + CONFIG_MACH_IXDPG425=y +--- a/arch/arm/mach-ixp4xx/Kconfig ++++ b/arch/arm/mach-ixp4xx/Kconfig +@@ -49,6 +49,14 @@ config MACH_GATEWAY7001 + 7001 Access Point. For more information on this platform, + see http://openwrt.org + ++config MACH_WG302V1 ++ bool "Netgear WG302 v1 / WAG302 v1" ++ select PCI ++ help ++ Say 'Y' here if you want your kernel to support Netgear's ++ WG302 v1 or WAG302 v1 Access Points. For more information ++ on this platform, see http://openwrt.org ++ + config MACH_WG302V2 + bool "Netgear WG302 v2 / WAG302 v2" + select PCI +--- a/arch/arm/mach-ixp4xx/Makefile ++++ b/arch/arm/mach-ixp4xx/Makefile +@@ -14,6 +14,7 @@ obj-pci-$(CONFIG_MACH_NSLU2) += nslu2-p + obj-pci-$(CONFIG_MACH_NAS100D) += nas100d-pci.o + obj-pci-$(CONFIG_MACH_DSMG600) += dsmg600-pci.o + obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o ++obj-pci-$(CONFIG_MACH_WG302V1) += wg302v1-pci.o + obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o + obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o + +@@ -28,6 +29,7 @@ obj-$(CONFIG_MACH_NSLU2) += nslu2-setup. + obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o + obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o + obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o ++obj-$(CONFIG_MACH_WG302V1) += wg302v1-setup.o + obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o + obj-$(CONFIG_MACH_FSG) += fsg-setup.o + obj-$(CONFIG_MACH_GORAMO_MLR) += goramo_mlr.o +--- /dev/null ++++ b/arch/arm/mach-ixp4xx/wg302v1-pci.c +@@ -0,0 +1,64 @@ ++/* ++ * arch/arch/mach-ixp4xx/wg302v1-pci.c ++ * ++ * PCI setup routines for the Netgear WG302 v1 and WAG302 v1 ++ * ++ * Copyright (C) 2008 Imre Kaloz ++ * ++ * based on coyote-pci.c: ++ * Copyright (C) 2002 Jungo Software Technologies. ++ * Copyright (C) 2003 MontaVista Software, Inc. ++ * ++ * Maintainer: Imre Kaloz ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include ++ ++void __init wg302v1_pci_preinit(void) ++{ ++ set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_LEVEL_LOW); ++ set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW); ++ ++ ixp4xx_pci_preinit(); ++} ++ ++static int __init wg302v1_map_irq(struct pci_dev *dev, u8 slot, u8 pin) ++{ ++ if (slot == 1) ++ return IRQ_IXP4XX_GPIO8; ++ else if (slot == 2) ++ return IRQ_IXP4XX_GPIO10; ++ else ++ return -1; ++} ++ ++struct hw_pci wg302v1_pci __initdata = { ++ .nr_controllers = 1, ++ .preinit = wg302v1_pci_preinit, ++ .swizzle = pci_std_swizzle, ++ .setup = ixp4xx_setup, ++ .scan = ixp4xx_scan_bus, ++ .map_irq = wg302v1_map_irq, ++}; ++ ++int __init wg302v1_pci_init(void) ++{ ++ if (machine_is_wg302v1()) ++ pci_common_init(&wg302v1_pci); ++ return 0; ++} ++ ++subsys_initcall(wg302v1_pci_init); +--- /dev/null ++++ b/arch/arm/mach-ixp4xx/wg302v1-setup.c +@@ -0,0 +1,142 @@ ++/* ++ * arch/arm/mach-ixp4xx/wg302v1-setup.c ++ * ++ * Board setup for the Netgear WG302 v1 and WAG302 v1 ++ * ++ * Copyright (C) 2008 Imre Kaloz ++ * ++ * based on coyote-setup.c: ++ * Copyright (C) 2003-2005 MontaVista Software, Inc. ++ * ++ * Author: Imre Kaloz ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static struct flash_platform_data wg302v1_flash_data = { ++ .map_name = "cfi_probe", ++ .width = 2, ++}; ++ ++static struct resource wg302v1_flash_resource = { ++ .flags = IORESOURCE_MEM, ++}; ++ ++static struct platform_device wg302v1_flash = { ++ .name = "IXP4XX-Flash", ++ .id = 0, ++ .dev = { ++ .platform_data = &wg302v1_flash_data, ++ }, ++ .num_resources = 1, ++ .resource = &wg302v1_flash_resource, ++}; ++ ++static struct resource wg302v1_uart_resources[] = { ++ { ++ .start = IXP4XX_UART1_BASE_PHYS, ++ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, ++ .flags = IORESOURCE_MEM, ++ }, ++ { ++ .start = IXP4XX_UART2_BASE_PHYS, ++ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, ++ .flags = IORESOURCE_MEM, ++ } ++}; ++ ++static struct plat_serial8250_port wg302v1_uart_data[] = { ++ { ++ .mapbase = IXP4XX_UART1_BASE_PHYS, ++ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, ++ .irq = IRQ_IXP4XX_UART1, ++ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, ++ .iotype = UPIO_MEM, ++ .regshift = 2, ++ .uartclk = IXP4XX_UART_XTAL, ++ }, ++ { ++ .mapbase = IXP4XX_UART2_BASE_PHYS, ++ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, ++ .irq = IRQ_IXP4XX_UART2, ++ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, ++ .iotype = UPIO_MEM, ++ .regshift = 2, ++ .uartclk = IXP4XX_UART_XTAL, ++ }, ++ { }, ++}; ++ ++static struct platform_device wg302v1_uart = { ++ .name = "serial8250", ++ .id = PLAT8250_DEV_PLATFORM, ++ .dev = { ++ .platform_data = wg302v1_uart_data, ++ }, ++ .num_resources = 2, ++ .resource = wg302v1_uart_resources, ++}; ++ ++static struct eth_plat_info wg302v1_plat_eth[] = { ++ { ++ .phy = 30, ++ .rxq = 3, ++ .txreadyq = 20, ++ } ++}; ++ ++static struct platform_device wg302v1_eth[] = { ++ { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEB, ++ .dev.platform_data = wg302v1_plat_eth, ++ } ++}; ++ ++static struct platform_device *wg302v1_devices[] __initdata = { ++ &wg302v1_flash, ++ &wg302v1_uart, ++ &wg302v1_eth[0], ++}; ++ ++static void __init wg302v1_init(void) ++{ ++ ixp4xx_sys_init(); ++ ++ wg302v1_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); ++ wg302v1_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; ++ ++ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; ++ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; ++ ++ platform_add_devices(wg302v1_devices, ARRAY_SIZE(wg302v1_devices)); ++} ++ ++#ifdef CONFIG_MACH_WG302V1 ++MACHINE_START(WG302V1, "Netgear WG302 v1 / WAG302 v1") ++ /* Maintainer: Imre Kaloz */ ++ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, ++ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, ++ .map_io = ixp4xx_map_io, ++ .init_irq = ixp4xx_init_irq, ++ .timer = &ixp4xx_timer, ++ .boot_params = 0x0100, ++ .init_machine = wg302v1_init, ++MACHINE_END ++#endif diff --git a/target/linux/ixp4xx/patches-2.6.32/110-pronghorn_series_support.patch b/target/linux/ixp4xx/patches-2.6.32/110-pronghorn_series_support.patch new file mode 100644 index 000000000..c03869226 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/110-pronghorn_series_support.patch @@ -0,0 +1,387 @@ +--- a/arch/arm/configs/ixp4xx_defconfig ++++ b/arch/arm/configs/ixp4xx_defconfig +@@ -157,6 +157,8 @@ CONFIG_ARCH_ADI_COYOTE=y + CONFIG_MACH_GATEWAY7001=y + CONFIG_MACH_WG302V1=y + CONFIG_MACH_WG302V2=y ++CONFIG_MACH_PRONGHORN=y ++CONFIG_MACH_PRONGHORNMETRO=y + CONFIG_ARCH_IXDP425=y + CONFIG_MACH_IXDPG425=y + CONFIG_MACH_IXDP465=y +--- a/arch/arm/mach-ixp4xx/Kconfig ++++ b/arch/arm/mach-ixp4xx/Kconfig +@@ -65,6 +65,22 @@ config MACH_WG302V2 + WG302 v2 or WAG302 v2 Access Points. For more information + on this platform, see http://openwrt.org + ++config MACH_PRONGHORN ++ bool "ADI Pronghorn series" ++ select PCI ++ help ++ Say 'Y' here if you want your kernel to support the ADI ++ Engineering Pronghorn series. For more ++ information on this platform, see http://www.adiengineering.com ++ ++# ++# There're only minimal differences kernel-wise between the Pronghorn and ++# Pronghorn Metro boards - they use different chip selects to drive the ++# CF slot connected to the expansion bus, so we just enable them together. ++# ++config MACH_PRONGHORNMETRO ++ def_bool MACH_PRONGHORN ++ + config ARCH_IXDP425 + bool "IXDP425" + help +--- a/arch/arm/mach-ixp4xx/Makefile ++++ b/arch/arm/mach-ixp4xx/Makefile +@@ -17,6 +17,7 @@ obj-pci-$(CONFIG_MACH_GATEWAY7001) += ga + obj-pci-$(CONFIG_MACH_WG302V1) += wg302v1-pci.o + obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o + obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o ++obj-pci-$(CONFIG_MACH_PRONGHORN) += pronghorn-pci.o + + obj-y += common.o + +@@ -33,6 +34,7 @@ obj-$(CONFIG_MACH_WG302V1) += wg302v1-se + obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o + obj-$(CONFIG_MACH_FSG) += fsg-setup.o + obj-$(CONFIG_MACH_GORAMO_MLR) += goramo_mlr.o ++obj-$(CONFIG_MACH_PRONGHORN) += pronghorn-setup.o + + obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o + obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o +--- /dev/null ++++ b/arch/arm/mach-ixp4xx/pronghorn-pci.c +@@ -0,0 +1,70 @@ ++/* ++ * arch/arch/mach-ixp4xx/pronghorn-pci.c ++ * ++ * PCI setup routines for ADI Engineering Pronghorn series ++ * ++ * Copyright (C) 2008 Imre Kaloz ++ * ++ * based on coyote-pci.c: ++ * Copyright (C) 2002 Jungo Software Technologies. ++ * Copyright (C) 2003 MontaVista Softwrae, Inc. ++ * ++ * Maintainer: Imre Kaloz ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include ++ ++void __init pronghorn_pci_preinit(void) ++{ ++ set_irq_type(IRQ_IXP4XX_GPIO4, IRQ_TYPE_LEVEL_LOW); ++ set_irq_type(IRQ_IXP4XX_GPIO6, IRQ_TYPE_LEVEL_LOW); ++ set_irq_type(IRQ_IXP4XX_GPIO11, IRQ_TYPE_LEVEL_LOW); ++ set_irq_type(IRQ_IXP4XX_GPIO1, IRQ_TYPE_LEVEL_LOW); ++ ++ ixp4xx_pci_preinit(); ++} ++ ++static int __init pronghorn_map_irq(struct pci_dev *dev, u8 slot, u8 pin) ++{ ++ if (slot == 13) ++ return IRQ_IXP4XX_GPIO4; ++ else if (slot == 14) ++ return IRQ_IXP4XX_GPIO6; ++ else if (slot == 15) ++ return IRQ_IXP4XX_GPIO11; ++ else if (slot == 16) ++ return IRQ_IXP4XX_GPIO1; ++ else ++ return -1; ++} ++ ++struct hw_pci pronghorn_pci __initdata = { ++ .nr_controllers = 1, ++ .preinit = pronghorn_pci_preinit, ++ .swizzle = pci_std_swizzle, ++ .setup = ixp4xx_setup, ++ .scan = ixp4xx_scan_bus, ++ .map_irq = pronghorn_map_irq, ++}; ++ ++int __init pronghorn_pci_init(void) ++{ ++ if (machine_is_pronghorn() || machine_is_pronghorn_metro()) ++ pci_common_init(&pronghorn_pci); ++ return 0; ++} ++ ++subsys_initcall(pronghorn_pci_init); +--- /dev/null ++++ b/arch/arm/mach-ixp4xx/pronghorn-setup.c +@@ -0,0 +1,245 @@ ++/* ++ * arch/arm/mach-ixp4xx/pronghorn-setup.c ++ * ++ * Board setup for the ADI Engineering Pronghorn series ++ * ++ * Copyright (C) 2008 Imre Kaloz ++ * ++ * based on coyote-setup.c: ++ * Copyright (C) 2003-2005 MontaVista Software, Inc. ++ * ++ * Author: Imre Kaloz ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static struct flash_platform_data pronghorn_flash_data = { ++ .map_name = "cfi_probe", ++ .width = 2, ++}; ++ ++static struct resource pronghorn_flash_resource = { ++ .flags = IORESOURCE_MEM, ++}; ++ ++static struct platform_device pronghorn_flash = { ++ .name = "IXP4XX-Flash", ++ .id = 0, ++ .dev = { ++ .platform_data = &pronghorn_flash_data, ++ }, ++ .num_resources = 1, ++ .resource = &pronghorn_flash_resource, ++}; ++ ++static struct resource pronghorn_uart_resources [] = { ++ { ++ .start = IXP4XX_UART1_BASE_PHYS, ++ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, ++ .flags = IORESOURCE_MEM ++ }, ++ { ++ .start = IXP4XX_UART2_BASE_PHYS, ++ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, ++ .flags = IORESOURCE_MEM ++ } ++}; ++ ++static struct plat_serial8250_port pronghorn_uart_data[] = { ++ { ++ .mapbase = IXP4XX_UART1_BASE_PHYS, ++ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, ++ .irq = IRQ_IXP4XX_UART1, ++ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, ++ .iotype = UPIO_MEM, ++ .regshift = 2, ++ .uartclk = IXP4XX_UART_XTAL, ++ }, ++ { ++ .mapbase = IXP4XX_UART2_BASE_PHYS, ++ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, ++ .irq = IRQ_IXP4XX_UART2, ++ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, ++ .iotype = UPIO_MEM, ++ .regshift = 2, ++ .uartclk = IXP4XX_UART_XTAL, ++ }, ++ { }, ++}; ++ ++static struct platform_device pronghorn_uart = { ++ .name = "serial8250", ++ .id = PLAT8250_DEV_PLATFORM, ++ .dev = { ++ .platform_data = pronghorn_uart_data, ++ }, ++ .num_resources = 2, ++ .resource = pronghorn_uart_resources, ++}; ++ ++static struct i2c_gpio_platform_data pronghorn_i2c_gpio_data = { ++ .sda_pin = 9, ++ .scl_pin = 10, ++}; ++ ++static struct platform_device pronghorn_i2c_gpio = { ++ .name = "i2c-gpio", ++ .id = 0, ++ .dev = { ++ .platform_data = &pronghorn_i2c_gpio_data, ++ }, ++}; ++ ++static struct gpio_led pronghorn_led_pin[] = { ++ { ++ .name = "pronghorn:green:status", ++ .gpio = 7, ++ } ++}; ++ ++static struct gpio_led_platform_data pronghorn_led_data = { ++ .num_leds = 1, ++ .leds = pronghorn_led_pin, ++}; ++ ++static struct platform_device pronghorn_led = { ++ .name = "leds-gpio", ++ .id = -1, ++ .dev.platform_data = &pronghorn_led_data, ++}; ++ ++static struct resource pronghorn_pata_resources[] = { ++ { ++ .flags = IORESOURCE_MEM ++ }, ++ { ++ .flags = IORESOURCE_MEM, ++ }, ++ { ++ .name = "intrq", ++ .start = IRQ_IXP4XX_GPIO0, ++ .end = IRQ_IXP4XX_GPIO0, ++ .flags = IORESOURCE_IRQ, ++ }, ++}; ++ ++static struct ixp4xx_pata_data pronghorn_pata_data = { ++ .cs0_bits = 0xbfff0043, ++ .cs1_bits = 0xbfff0043, ++}; ++ ++static struct platform_device pronghorn_pata = { ++ .name = "pata_ixp4xx_cf", ++ .id = 0, ++ .dev.platform_data = &pronghorn_pata_data, ++ .num_resources = ARRAY_SIZE(pronghorn_pata_resources), ++ .resource = pronghorn_pata_resources, ++}; ++ ++static struct eth_plat_info pronghorn_plat_eth[] = { ++ { ++ .phy = 0, ++ .rxq = 3, ++ .txreadyq = 20, ++ }, { ++ .phy = 1, ++ .rxq = 4, ++ .txreadyq = 21, ++ } ++}; ++ ++static struct platform_device pronghorn_eth[] = { ++ { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEB, ++ .dev.platform_data = pronghorn_plat_eth, ++ }, { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEC, ++ .dev.platform_data = pronghorn_plat_eth + 1, ++ } ++}; ++ ++static struct platform_device *pronghorn_devices[] __initdata = { ++ &pronghorn_flash, ++ &pronghorn_uart, ++ &pronghorn_led, ++ &pronghorn_eth[0], ++ &pronghorn_eth[1], ++}; ++ ++static void __init pronghorn_init(void) ++{ ++ ixp4xx_sys_init(); ++ ++ pronghorn_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); ++ pronghorn_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; ++ ++ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; ++ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; ++ ++ platform_add_devices(pronghorn_devices, ARRAY_SIZE(pronghorn_devices)); ++ ++ if (machine_is_pronghorn()) { ++ pronghorn_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(2); ++ pronghorn_pata_resources[0].end = IXP4XX_EXP_BUS_END(2); ++ ++ pronghorn_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(3); ++ pronghorn_pata_resources[1].end = IXP4XX_EXP_BUS_END(3); ++ ++ pronghorn_pata_data.cs0_cfg = IXP4XX_EXP_CS2; ++ pronghorn_pata_data.cs1_cfg = IXP4XX_EXP_CS3; ++ } else { ++ pronghorn_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(3); ++ pronghorn_pata_resources[0].end = IXP4XX_EXP_BUS_END(3); ++ ++ pronghorn_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(4); ++ pronghorn_pata_resources[1].end = IXP4XX_EXP_BUS_END(4); ++ ++ pronghorn_pata_data.cs0_cfg = IXP4XX_EXP_CS3; ++ pronghorn_pata_data.cs1_cfg = IXP4XX_EXP_CS4; ++ ++ platform_device_register(&pronghorn_i2c_gpio); ++ } ++ ++ platform_device_register(&pronghorn_pata); ++} ++ ++MACHINE_START(PRONGHORN, "ADI Engineering Pronghorn") ++ /* Maintainer: Imre Kaloz */ ++ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, ++ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, ++ .map_io = ixp4xx_map_io, ++ .init_irq = ixp4xx_init_irq, ++ .timer = &ixp4xx_timer, ++ .boot_params = 0x0100, ++ .init_machine = pronghorn_init, ++MACHINE_END ++ ++MACHINE_START(PRONGHORNMETRO, "ADI Engineering Pronghorn Metro") ++ /* Maintainer: Imre Kaloz */ ++ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, ++ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, ++ .map_io = ixp4xx_map_io, ++ .init_irq = ixp4xx_init_irq, ++ .timer = &ixp4xx_timer, ++ .boot_params = 0x0100, ++ .init_machine = pronghorn_init, ++MACHINE_END +--- a/arch/arm/mach-ixp4xx/include/mach/uncompress.h ++++ b/arch/arm/mach-ixp4xx/include/mach/uncompress.h +@@ -41,7 +41,8 @@ static __inline__ void __arch_decomp_set + * Some boards are using UART2 as console + */ + if (machine_is_adi_coyote() || machine_is_gtwx5715() || +- machine_is_gateway7001() || machine_is_wg302v2()) ++ machine_is_gateway7001() || machine_is_wg302v2() || ++ machine_is_pronghorn() || machine_is_pronghorn_metro()) + uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS; + else + uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS; diff --git a/target/linux/ixp4xx/patches-2.6.32/111-pronghorn_swap_uarts.patch b/target/linux/ixp4xx/patches-2.6.32/111-pronghorn_swap_uarts.patch new file mode 100644 index 000000000..b9fa50768 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/111-pronghorn_swap_uarts.patch @@ -0,0 +1,44 @@ +--- a/arch/arm/mach-ixp4xx/pronghorn-setup.c ++++ b/arch/arm/mach-ixp4xx/pronghorn-setup.c +@@ -51,31 +51,31 @@ static struct platform_device pronghorn_ + + static struct resource pronghorn_uart_resources [] = { + { +- .start = IXP4XX_UART1_BASE_PHYS, +- .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, ++ .start = IXP4XX_UART2_BASE_PHYS, ++ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM + }, + { +- .start = IXP4XX_UART2_BASE_PHYS, +- .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, ++ .start = IXP4XX_UART1_BASE_PHYS, ++ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM + } + }; + + static struct plat_serial8250_port pronghorn_uart_data[] = { + { +- .mapbase = IXP4XX_UART1_BASE_PHYS, +- .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, +- .irq = IRQ_IXP4XX_UART1, ++ .mapbase = IXP4XX_UART2_BASE_PHYS, ++ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, ++ .irq = IRQ_IXP4XX_UART2, + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, + .iotype = UPIO_MEM, + .regshift = 2, + .uartclk = IXP4XX_UART_XTAL, + }, + { +- .mapbase = IXP4XX_UART2_BASE_PHYS, +- .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, +- .irq = IRQ_IXP4XX_UART2, ++ .mapbase = IXP4XX_UART1_BASE_PHYS, ++ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, ++ .irq = IRQ_IXP4XX_UART1, + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, + .iotype = UPIO_MEM, + .regshift = 2, diff --git a/target/linux/ixp4xx/patches-2.6.32/115-sidewinder_support.patch b/target/linux/ixp4xx/patches-2.6.32/115-sidewinder_support.patch new file mode 100644 index 000000000..bad0826c8 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/115-sidewinder_support.patch @@ -0,0 +1,282 @@ +From 60bdaaaf3446b4237566c6e04855186fc7bd766b Mon Sep 17 00:00:00 2001 +From: Imre Kaloz +Date: Sun, 13 Jul 2008 22:46:45 +0200 +Subject: [PATCH] Add support for the ADI Sidewinder + +Signed-off-by: Imre Kaloz +--- + arch/arm/mach-ixp4xx/Kconfig | 10 ++- + arch/arm/mach-ixp4xx/Makefile | 2 + + arch/arm/mach-ixp4xx/sidewinder-pci.c | 68 ++++++++++++++ + arch/arm/mach-ixp4xx/sidewinder-setup.c | 151 +++++++++++++++++++++++++++++++ + 4 files changed, 230 insertions(+), 1 deletions(-) + create mode 100644 arch/arm/mach-ixp4xx/sidewinder-pci.c + create mode 100644 arch/arm/mach-ixp4xx/sidewinder-setup.c + +--- a/arch/arm/mach-ixp4xx/Kconfig ++++ b/arch/arm/mach-ixp4xx/Kconfig +@@ -81,6 +81,14 @@ config MACH_PRONGHORN + config MACH_PRONGHORNMETRO + def_bool MACH_PRONGHORN + ++config MACH_SIDEWINDER ++ bool "ADI Sidewinder" ++ select PCI ++ help ++ Say 'Y' here if you want your kernel to support the ADI ++ Engineering Sidewinder board. For more information on this ++ platform, see http://www.adiengineering.com ++ + config ARCH_IXDP425 + bool "IXDP425" + help +@@ -169,7 +177,7 @@ config MACH_FSG + # + config CPU_IXP46X + bool +- depends on MACH_IXDP465 ++ depends on MACH_IXDP465 || MACH_SIDEWINDER + default y + + config CPU_IXP43X +--- a/arch/arm/mach-ixp4xx/Makefile ++++ b/arch/arm/mach-ixp4xx/Makefile +@@ -18,6 +18,7 @@ obj-pci-$(CONFIG_MACH_WG302V1) += wg302 + obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o + obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o + obj-pci-$(CONFIG_MACH_PRONGHORN) += pronghorn-pci.o ++obj-pci-$(CONFIG_MACH_SIDEWINDER) += sidewinder-pci.o + + obj-y += common.o + +@@ -35,6 +36,7 @@ obj-$(CONFIG_MACH_WG302V2) += wg302v2-se + obj-$(CONFIG_MACH_FSG) += fsg-setup.o + obj-$(CONFIG_MACH_GORAMO_MLR) += goramo_mlr.o + obj-$(CONFIG_MACH_PRONGHORN) += pronghorn-setup.o ++obj-$(CONFIG_MACH_SIDEWINDER) += sidewinder-setup.o + + obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o + obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o +--- /dev/null ++++ b/arch/arm/mach-ixp4xx/sidewinder-pci.c +@@ -0,0 +1,68 @@ ++/* ++ * arch/arch/mach-ixp4xx/pronghornmetro-pci.c ++ * ++ * PCI setup routines for ADI Engineering Sidewinder ++ * ++ * Copyright (C) 2008 Imre Kaloz ++ * ++ * based on coyote-pci.c: ++ * Copyright (C) 2002 Jungo Software Technologies. ++ * Copyright (C) 2003 MontaVista Softwrae, Inc. ++ * ++ * Maintainer: Imre Kaloz ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#include ++ ++void __init sidewinder_pci_preinit(void) ++{ ++ set_irq_type(IRQ_IXP4XX_GPIO11, IRQ_TYPE_LEVEL_LOW); ++ set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW); ++ set_irq_type(IRQ_IXP4XX_GPIO9, IRQ_TYPE_LEVEL_LOW); ++ ++ ixp4xx_pci_preinit(); ++} ++ ++static int __init sidewinder_map_irq(struct pci_dev *dev, u8 slot, u8 pin) ++{ ++ if (slot == 1) ++ return IRQ_IXP4XX_GPIO11; ++ else if (slot == 2) ++ return IRQ_IXP4XX_GPIO10; ++ else if (slot == 3) ++ return IRQ_IXP4XX_GPIO9; ++ else ++ return -1; ++} ++ ++struct hw_pci sidewinder_pci __initdata = { ++ .nr_controllers = 1, ++ .preinit = sidewinder_pci_preinit, ++ .swizzle = pci_std_swizzle, ++ .setup = ixp4xx_setup, ++ .scan = ixp4xx_scan_bus, ++ .map_irq = sidewinder_map_irq, ++}; ++ ++int __init sidewinder_pci_init(void) ++{ ++ if (machine_is_sidewinder()) ++ pci_common_init(&sidewinder_pci); ++ return 0; ++} ++ ++subsys_initcall(sidewinder_pci_init); +--- /dev/null ++++ b/arch/arm/mach-ixp4xx/sidewinder-setup.c +@@ -0,0 +1,149 @@ ++/* ++ * arch/arm/mach-ixp4xx/sidewinder-setup.c ++ * ++ * Board setup for the ADI Engineering Sidewinder ++ * ++ * Copyright (C) 2008 Imre Kaloz ++ * ++ * based on coyote-setup.c: ++ * Copyright (C) 2003-2005 MontaVista Software, Inc. ++ * ++ * Author: Imre Kaloz ++ */ ++ ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++static struct flash_platform_data sidewinder_flash_data = { ++ .map_name = "cfi_probe", ++ .width = 2, ++}; ++ ++static struct resource sidewinder_flash_resource = { ++ .flags = IORESOURCE_MEM, ++}; ++ ++static struct platform_device sidewinder_flash = { ++ .name = "IXP4XX-Flash", ++ .id = 0, ++ .dev = { ++ .platform_data = &sidewinder_flash_data, ++ }, ++ .num_resources = 1, ++ .resource = &sidewinder_flash_resource, ++}; ++ ++static struct resource sidewinder_uart_resources[] = { ++ { ++ .start = IXP4XX_UART1_BASE_PHYS, ++ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, ++ .flags = IORESOURCE_MEM, ++ }, ++ { ++ .start = IXP4XX_UART2_BASE_PHYS, ++ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, ++ .flags = IORESOURCE_MEM, ++ } ++}; ++ ++static struct plat_serial8250_port sidewinder_uart_data[] = { ++ { ++ .mapbase = IXP4XX_UART1_BASE_PHYS, ++ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, ++ .irq = IRQ_IXP4XX_UART1, ++ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, ++ .iotype = UPIO_MEM, ++ .regshift = 2, ++ .uartclk = IXP4XX_UART_XTAL, ++ }, ++ { ++ .mapbase = IXP4XX_UART2_BASE_PHYS, ++ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, ++ .irq = IRQ_IXP4XX_UART2, ++ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, ++ .iotype = UPIO_MEM, ++ .regshift = 2, ++ .uartclk = IXP4XX_UART_XTAL, ++ }, ++ { }, ++}; ++ ++static struct platform_device sidewinder_uart = { ++ .name = "serial8250", ++ .id = PLAT8250_DEV_PLATFORM, ++ .dev = { ++ .platform_data = sidewinder_uart_data, ++ }, ++ .num_resources = ARRAY_SIZE(sidewinder_uart_resources), ++ .resource = sidewinder_uart_resources, ++}; ++ ++static struct eth_plat_info sidewinder_plat_eth[] = { ++ { ++ .phy = 5, ++ .rxq = 3, ++ .txreadyq = 20, ++ }, { ++ .phy = IXP4XX_ETH_PHY_MAX_ADDR, ++ .phy_mask = 0x1e, ++ .rxq = 4, ++ .txreadyq = 21, ++ }, { ++ .phy = 31, ++ .rxq = 2, ++ .txreadyq = 19, ++ } ++}; ++ ++static struct platform_device sidewinder_eth[] = { ++ { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEB, ++ .dev.platform_data = sidewinder_plat_eth, ++ }, { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEC, ++ .dev.platform_data = sidewinder_plat_eth + 1, ++ }, { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEA, ++ .dev.platform_data = sidewinder_plat_eth + 2, ++ } ++}; ++ ++static struct platform_device *sidewinder_devices[] __initdata = { ++ &sidewinder_flash, ++ &sidewinder_uart, ++ &sidewinder_eth[0], ++ &sidewinder_eth[1], ++ &sidewinder_eth[2], ++}; ++ ++static void __init sidewinder_init(void) ++{ ++ ixp4xx_sys_init(); ++ ++ sidewinder_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); ++ sidewinder_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_64M - 1; ++ ++ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; ++ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; ++ ++ platform_add_devices(sidewinder_devices, ARRAY_SIZE(sidewinder_devices)); ++} ++ ++MACHINE_START(SIDEWINDER, "ADI Engineering Sidewinder") ++ /* Maintainer: Imre Kaloz */ ++ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, ++ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, ++ .map_io = ixp4xx_map_io, ++ .init_irq = ixp4xx_init_irq, ++ .timer = &ixp4xx_timer, ++ .boot_params = 0x0100, ++ .init_machine = sidewinder_init, ++MACHINE_END diff --git a/target/linux/ixp4xx/patches-2.6.32/116-sidewinder_fis_location.patch b/target/linux/ixp4xx/patches-2.6.32/116-sidewinder_fis_location.patch new file mode 100644 index 000000000..1d0a98398 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/116-sidewinder_fis_location.patch @@ -0,0 +1,30 @@ +--- a/drivers/mtd/redboot.c ++++ b/drivers/mtd/redboot.c +@@ -13,6 +13,8 @@ + + #define BOARD_CONFIG_PART "boardconfig" + ++#include ++ + struct fis_image_desc { + unsigned char name[16]; // Null terminated name + uint32_t flash_base; // Address within FLASH of image +@@ -30,7 +32,8 @@ struct fis_list { + struct fis_list *next; + }; + +-static int directory = CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK; ++int directory = CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK; ++ + module_param(directory, int, 0); + + static inline int redboot_checksum(struct fis_image_desc *img) +@@ -59,6 +62,8 @@ static int parse_redboot_partitions(stru + #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED + static char nullstring[] = "unallocated"; + #endif ++ if (machine_is_sidewinder()) ++ directory = -5; + + if ( directory < 0 ) { + offset = master->size + directory * master->erasesize; diff --git a/target/linux/ixp4xx/patches-2.6.32/120-compex_support.patch b/target/linux/ixp4xx/patches-2.6.32/120-compex_support.patch new file mode 100644 index 000000000..ccac8cc78 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/120-compex_support.patch @@ -0,0 +1,212 @@ +From 24025a2dcf1248079dd3019fac6ed955252d277f Mon Sep 17 00:00:00 2001 +From: Imre Kaloz +Date: Mon, 14 Jul 2008 21:56:34 +0200 +Subject: [PATCH] Add support for the Compex WP18 / NP18A boards + +Signed-off-by: Imre Kaloz +--- + arch/arm/mach-ixp4xx/Kconfig | 8 ++ + arch/arm/mach-ixp4xx/Makefile | 2 + + arch/arm/mach-ixp4xx/compex-setup.c | 136 +++++++++++++++++++++++++++++++++++ + arch/arm/mach-ixp4xx/ixdp425-pci.c | 3 +- + arch/arm/tools/mach-types | 2 +- + 5 files changed, 149 insertions(+), 2 deletions(-) + create mode 100644 arch/arm/mach-ixp4xx/compex-setup.c + +--- a/arch/arm/mach-ixp4xx/Kconfig ++++ b/arch/arm/mach-ixp4xx/Kconfig +@@ -89,6 +89,14 @@ config MACH_SIDEWINDER + Engineering Sidewinder board. For more information on this + platform, see http://www.adiengineering.com + ++config MACH_COMPEX ++ bool "Compex WP18 / NP18A" ++ select PCI ++ help ++ Say 'Y' here if you want your kernel to support Compex' ++ WP18 or NP18A boards. For more information on this ++ platform, see http://www.compex.com.sg/home/OEM/product_ap.htm ++ + config ARCH_IXDP425 + bool "IXDP425" + help +--- a/arch/arm/mach-ixp4xx/Makefile ++++ b/arch/arm/mach-ixp4xx/Makefile +@@ -19,6 +19,7 @@ obj-pci-$(CONFIG_MACH_WG302V2) += wg302 + obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o + obj-pci-$(CONFIG_MACH_PRONGHORN) += pronghorn-pci.o + obj-pci-$(CONFIG_MACH_SIDEWINDER) += sidewinder-pci.o ++obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o + + obj-y += common.o + +@@ -37,6 +38,7 @@ obj-$(CONFIG_MACH_FSG) += fsg-setup.o + obj-$(CONFIG_MACH_GORAMO_MLR) += goramo_mlr.o + obj-$(CONFIG_MACH_PRONGHORN) += pronghorn-setup.o + obj-$(CONFIG_MACH_SIDEWINDER) += sidewinder-setup.o ++obj-$(CONFIG_MACH_COMPEX) += compex-setup.o + + obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o + obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o +--- /dev/null ++++ b/arch/arm/mach-ixp4xx/compex-setup.c +@@ -0,0 +1,136 @@ ++/* ++ * arch/arm/mach-ixp4xx/compex-setup.c ++ * ++ * Compex WP18 / NP18A board-setup ++ * ++ * Copyright (C) 2008 Imre Kaloz ++ * ++ * based on coyote-setup.c: ++ * Copyright (C) 2003-2005 MontaVista Software, Inc. ++ * ++ * Author: Imre Kaloz ++ */ ++ ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++static struct flash_platform_data compex_flash_data = { ++ .map_name = "cfi_probe", ++ .width = 2, ++}; ++ ++static struct resource compex_flash_resource = { ++ .flags = IORESOURCE_MEM, ++}; ++ ++static struct platform_device compex_flash = { ++ .name = "IXP4XX-Flash", ++ .id = 0, ++ .dev = { ++ .platform_data = &compex_flash_data, ++ }, ++ .num_resources = 1, ++ .resource = &compex_flash_resource, ++}; ++ ++static struct resource compex_uart_resources[] = { ++ { ++ .start = IXP4XX_UART1_BASE_PHYS, ++ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, ++ .flags = IORESOURCE_MEM ++ }, ++ { ++ .start = IXP4XX_UART2_BASE_PHYS, ++ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, ++ .flags = IORESOURCE_MEM ++ } ++}; ++ ++static struct plat_serial8250_port compex_uart_data[] = { ++ { ++ .mapbase = IXP4XX_UART1_BASE_PHYS, ++ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, ++ .irq = IRQ_IXP4XX_UART1, ++ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, ++ .iotype = UPIO_MEM, ++ .regshift = 2, ++ .uartclk = IXP4XX_UART_XTAL, ++ }, ++ { ++ .mapbase = IXP4XX_UART2_BASE_PHYS, ++ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, ++ .irq = IRQ_IXP4XX_UART2, ++ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, ++ .iotype = UPIO_MEM, ++ .regshift = 2, ++ .uartclk = IXP4XX_UART_XTAL, ++ }, ++ { }, ++}; ++ ++static struct platform_device compex_uart = { ++ .name = "serial8250", ++ .id = PLAT8250_DEV_PLATFORM, ++ .dev.platform_data = compex_uart_data, ++ .num_resources = 2, ++ .resource = compex_uart_resources, ++}; ++ ++static struct eth_plat_info compex_plat_eth[] = { ++ { ++ .phy = IXP4XX_ETH_PHY_MAX_ADDR, ++ .phy_mask = 0xf0000, ++ .rxq = 3, ++ .txreadyq = 20, ++ }, { ++ .phy = 3, ++ .rxq = 4, ++ .txreadyq = 21, ++ } ++}; ++ ++static struct platform_device compex_eth[] = { ++ { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEB, ++ .dev.platform_data = compex_plat_eth, ++ }, { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEC, ++ .dev.platform_data = compex_plat_eth + 1, ++ } ++}; ++ ++static struct platform_device *compex_devices[] __initdata = { ++ &compex_flash, ++ &compex_uart, ++ &compex_eth[0], ++ &compex_eth[1], ++}; ++ ++static void __init compex_init(void) ++{ ++ ixp4xx_sys_init(); ++ ++ compex_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); ++ compex_flash_resource.end = ++ IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; ++ ++ platform_add_devices(compex_devices, ARRAY_SIZE(compex_devices)); ++} ++ ++MACHINE_START(COMPEX, "Compex WP18 / NP18A") ++ /* Maintainer: Imre Kaloz */ ++ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, ++ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, ++ .map_io = ixp4xx_map_io, ++ .init_irq = ixp4xx_init_irq, ++ .timer = &ixp4xx_timer, ++ .boot_params = 0x0100, ++ .init_machine = compex_init, ++MACHINE_END +--- a/arch/arm/mach-ixp4xx/ixdp425-pci.c ++++ b/arch/arm/mach-ixp4xx/ixdp425-pci.c +@@ -66,7 +66,8 @@ struct hw_pci ixdp425_pci __initdata = { + int __init ixdp425_pci_init(void) + { + if (machine_is_ixdp425() || machine_is_ixcdp1100() || +- machine_is_ixdp465() || machine_is_kixrp435()) ++ machine_is_ixdp465() || machine_is_kixrp435() || ++ machine_is_compex()) + pci_common_init(&ixdp425_pci); + return 0; + } +--- a/arch/arm/tools/mach-types ++++ b/arch/arm/tools/mach-types +@@ -1273,7 +1273,7 @@ oiab MACH_OIAB OIAB 1269 + smdk6400 MACH_SMDK6400 SMDK6400 1270 + nokia_n800 MACH_NOKIA_N800 NOKIA_N800 1271 + greenphone MACH_GREENPHONE GREENPHONE 1272 +-compex42x MACH_COMPEXWP18 COMPEXWP18 1273 ++compex MACH_COMPEX COMPEX 1273 + xmate MACH_XMATE XMATE 1274 + energizer MACH_ENERGIZER ENERGIZER 1275 + ime1 MACH_IME1 IME1 1276 diff --git a/target/linux/ixp4xx/patches-2.6.32/130-wrt300nv2_support.patch b/target/linux/ixp4xx/patches-2.6.32/130-wrt300nv2_support.patch new file mode 100644 index 000000000..c184a6c6c --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/130-wrt300nv2_support.patch @@ -0,0 +1,225 @@ +--- a/arch/arm/mach-ixp4xx/Kconfig ++++ b/arch/arm/mach-ixp4xx/Kconfig +@@ -97,6 +97,14 @@ config MACH_COMPEX + WP18 or NP18A boards. For more information on this + platform, see http://www.compex.com.sg/home/OEM/product_ap.htm + ++config MACH_WRT300NV2 ++ bool "Linksys WRT300N v2" ++ select PCI ++ help ++ Say 'Y' here if you want your kernel to support Linksys' ++ WRT300N v2 router. For more information on this ++ platform, see http://openwrt.org ++ + config ARCH_IXDP425 + bool "IXDP425" + help +--- a/arch/arm/mach-ixp4xx/Makefile ++++ b/arch/arm/mach-ixp4xx/Makefile +@@ -20,6 +20,7 @@ obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o + obj-pci-$(CONFIG_MACH_PRONGHORN) += pronghorn-pci.o + obj-pci-$(CONFIG_MACH_SIDEWINDER) += sidewinder-pci.o + obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o ++obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o + + obj-y += common.o + +@@ -39,6 +40,7 @@ obj-$(CONFIG_MACH_GORAMO_MLR) += goramo_ + obj-$(CONFIG_MACH_PRONGHORN) += pronghorn-setup.o + obj-$(CONFIG_MACH_SIDEWINDER) += sidewinder-setup.o + obj-$(CONFIG_MACH_COMPEX) += compex-setup.o ++obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o + + obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o + obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o +--- /dev/null ++++ b/arch/arm/mach-ixp4xx/wrt300nv2-pci.c +@@ -0,0 +1,65 @@ ++/* ++ * arch/arch/mach-ixp4xx/wrt300nv2-pci.c ++ * ++ * PCI setup routines for Linksys WRT300N v2 ++ * ++ * Copyright (C) 2007 Imre Kaloz ++ * ++ * based on coyote-pci.c: ++ * Copyright (C) 2002 Jungo Software Technologies. ++ * Copyright (C) 2003 MontaVista Softwrae, Inc. ++ * ++ * Maintainer: Imre Kaloz ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#include ++ ++extern void ixp4xx_pci_preinit(void); ++extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); ++extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys); ++ ++void __init wrt300nv2_pci_preinit(void) ++{ ++ set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_LEVEL_LOW); ++ ++ ixp4xx_pci_preinit(); ++} ++ ++static int __init wrt300nv2_map_irq(struct pci_dev *dev, u8 slot, u8 pin) ++{ ++ if (slot == 1) ++ return IRQ_IXP4XX_GPIO8; ++ else return -1; ++} ++ ++struct hw_pci wrt300nv2_pci __initdata = { ++ .nr_controllers = 1, ++ .preinit = wrt300nv2_pci_preinit, ++ .swizzle = pci_std_swizzle, ++ .setup = ixp4xx_setup, ++ .scan = ixp4xx_scan_bus, ++ .map_irq = wrt300nv2_map_irq, ++}; ++ ++int __init wrt300nv2_pci_init(void) ++{ ++ if (machine_is_wrt300nv2()) ++ pci_common_init(&wrt300nv2_pci); ++ return 0; ++} ++ ++subsys_initcall(wrt300nv2_pci_init); +--- /dev/null ++++ b/arch/arm/mach-ixp4xx/wrt300nv2-setup.c +@@ -0,0 +1,108 @@ ++/* ++ * arch/arm/mach-ixp4xx/wrt300nv2-setup.c ++ * ++ * Board setup for the Linksys WRT300N v2 ++ * ++ * Copyright (C) 2007 Imre Kaloz ++ * ++ * based on coyote-setup.c: ++ * Copyright (C) 2003-2005 MontaVista Software, Inc. ++ * ++ * Author: Imre Kaloz ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static struct flash_platform_data wrt300nv2_flash_data = { ++ .map_name = "cfi_probe", ++ .width = 2, ++}; ++ ++static struct resource wrt300nv2_flash_resource = { ++ .flags = IORESOURCE_MEM, ++}; ++ ++static struct platform_device wrt300nv2_flash = { ++ .name = "IXP4XX-Flash", ++ .id = 0, ++ .dev = { ++ .platform_data = &wrt300nv2_flash_data, ++ }, ++ .num_resources = 1, ++ .resource = &wrt300nv2_flash_resource, ++}; ++ ++static struct resource wrt300nv2_uart_resource = { ++ .start = IXP4XX_UART2_BASE_PHYS, ++ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, ++ .flags = IORESOURCE_MEM, ++}; ++ ++static struct plat_serial8250_port wrt300nv2_uart_data[] = { ++ { ++ .mapbase = IXP4XX_UART2_BASE_PHYS, ++ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, ++ .irq = IRQ_IXP4XX_UART2, ++ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, ++ .iotype = UPIO_MEM, ++ .regshift = 2, ++ .uartclk = IXP4XX_UART_XTAL, ++ }, ++ { }, ++}; ++ ++static struct platform_device wrt300nv2_uart = { ++ .name = "serial8250", ++ .id = PLAT8250_DEV_PLATFORM, ++ .dev = { ++ .platform_data = wrt300nv2_uart_data, ++ }, ++ .num_resources = 1, ++ .resource = &wrt300nv2_uart_resource, ++}; ++ ++static struct platform_device *wrt300nv2_devices[] __initdata = { ++ &wrt300nv2_flash, ++ &wrt300nv2_uart ++}; ++ ++static void __init wrt300nv2_init(void) ++{ ++ ixp4xx_sys_init(); ++ ++ wrt300nv2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); ++ wrt300nv2_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; ++ ++ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; ++ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; ++ ++ platform_add_devices(wrt300nv2_devices, ARRAY_SIZE(wrt300nv2_devices)); ++} ++ ++#ifdef CONFIG_MACH_WRT300NV2 ++MACHINE_START(WRT300NV2, "Linksys WRT300N v2") ++ /* Maintainer: Imre Kaloz */ ++ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, ++ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, ++ .map_io = ixp4xx_map_io, ++ .init_irq = ixp4xx_init_irq, ++ .timer = &ixp4xx_timer, ++ .boot_params = 0x0100, ++ .init_machine = wrt300nv2_init, ++MACHINE_END ++#endif +--- a/arch/arm/mach-ixp4xx/include/mach/uncompress.h ++++ b/arch/arm/mach-ixp4xx/include/mach/uncompress.h +@@ -42,7 +42,7 @@ static __inline__ void __arch_decomp_set + */ + if (machine_is_adi_coyote() || machine_is_gtwx5715() || + machine_is_gateway7001() || machine_is_wg302v2() || +- machine_is_pronghorn() || machine_is_pronghorn_metro()) ++ machine_is_pronghorn() || machine_is_pronghorn_metro() || machine_is_wrt300nv2()) + uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS; + else + uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS; diff --git a/target/linux/ixp4xx/patches-2.6.32/131-wrt300nv2_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.32/131-wrt300nv2_mac_plat_info.patch new file mode 100644 index 000000000..3ab68c4f3 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/131-wrt300nv2_mac_plat_info.patch @@ -0,0 +1,40 @@ +--- a/arch/arm/mach-ixp4xx/wrt300nv2-setup.c ++++ b/arch/arm/mach-ixp4xx/wrt300nv2-setup.c +@@ -76,9 +76,36 @@ static struct platform_device wrt300nv2_ + .resource = &wrt300nv2_uart_resource, + }; + ++/* Built-in 10/100 Ethernet MAC interfaces */ ++static struct eth_plat_info wrt300nv2_plat_eth[] = { ++ { ++ .phy = -1, ++ .rxq = 3, ++ .txreadyq = 20, ++ }, { ++ .phy = 1, ++ .rxq = 4, ++ .txreadyq = 21, ++ } ++}; ++ ++static struct platform_device wrt300nv2_eth[] = { ++ { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEB, ++ .dev.platform_data = wrt300nv2_plat_eth, ++ }, { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEC, ++ .dev.platform_data = wrt300nv2_plat_eth + 1, ++ } ++}; ++ + static struct platform_device *wrt300nv2_devices[] __initdata = { + &wrt300nv2_flash, +- &wrt300nv2_uart ++ &wrt300nv2_uart, ++ &wrt300nv2_eth[0], ++ &wrt300nv2_eth[1], + }; + + static void __init wrt300nv2_init(void) diff --git a/target/linux/ixp4xx/patches-2.6.32/150-lanready_ap1000_support.patch b/target/linux/ixp4xx/patches-2.6.32/150-lanready_ap1000_support.patch new file mode 100644 index 000000000..378786e27 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/150-lanready_ap1000_support.patch @@ -0,0 +1,200 @@ +--- /dev/null ++++ b/arch/arm/mach-ixp4xx/ap1000-setup.c +@@ -0,0 +1,151 @@ ++/* ++ * arch/arm/mach-ixp4xx/ap1000-setup.c ++ * ++ * Lanready AP-1000 ++ * ++ * Copyright (C) 2007 Imre Kaloz ++ * ++ * based on ixdp425-setup.c: ++ * Copyright (C) 2003-2005 MontaVista Software, Inc. ++ * ++ * Author: Imre Kaloz ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static struct flash_platform_data ap1000_flash_data = { ++ .map_name = "cfi_probe", ++ .width = 2, ++}; ++ ++static struct resource ap1000_flash_resource = { ++ .flags = IORESOURCE_MEM, ++}; ++ ++static struct platform_device ap1000_flash = { ++ .name = "IXP4XX-Flash", ++ .id = 0, ++ .dev = { ++ .platform_data = &ap1000_flash_data, ++ }, ++ .num_resources = 1, ++ .resource = &ap1000_flash_resource, ++}; ++ ++static struct resource ap1000_uart_resources[] = { ++ { ++ .start = IXP4XX_UART1_BASE_PHYS, ++ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, ++ .flags = IORESOURCE_MEM ++ }, ++ { ++ .start = IXP4XX_UART2_BASE_PHYS, ++ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, ++ .flags = IORESOURCE_MEM ++ } ++}; ++ ++static struct plat_serial8250_port ap1000_uart_data[] = { ++ { ++ .mapbase = IXP4XX_UART1_BASE_PHYS, ++ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, ++ .irq = IRQ_IXP4XX_UART1, ++ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, ++ .iotype = UPIO_MEM, ++ .regshift = 2, ++ .uartclk = IXP4XX_UART_XTAL, ++ }, ++ { ++ .mapbase = IXP4XX_UART2_BASE_PHYS, ++ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, ++ .irq = IRQ_IXP4XX_UART2, ++ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, ++ .iotype = UPIO_MEM, ++ .regshift = 2, ++ .uartclk = IXP4XX_UART_XTAL, ++ }, ++ { }, ++}; ++ ++static struct platform_device ap1000_uart = { ++ .name = "serial8250", ++ .id = PLAT8250_DEV_PLATFORM, ++ .dev.platform_data = ap1000_uart_data, ++ .num_resources = 2, ++ .resource = ap1000_uart_resources ++}; ++ ++static struct platform_device *ap1000_devices[] __initdata = { ++ &ap1000_flash, ++ &ap1000_uart ++}; ++ ++static char ap1000_mem_fixup[] __initdata = "mem=64M "; ++ ++static void __init ap1000_fixup(struct machine_desc *desc, ++ struct tag *tags, char **cmdline, struct meminfo *mi) ++ ++{ ++ struct tag *t = tags; ++ char *p = *cmdline; ++ ++ /* Find the end of the tags table, taking note of any cmdline tag. */ ++ for (; t->hdr.size; t = tag_next(t)) { ++ if (t->hdr.tag == ATAG_CMDLINE) { ++ p = t->u.cmdline.cmdline; ++ } ++ } ++ ++ /* Overwrite the end of the table with a new cmdline tag. */ ++ t->hdr.tag = ATAG_CMDLINE; ++ t->hdr.size = (sizeof (struct tag_header) + ++ strlen(ap1000_mem_fixup) + strlen(p) + 1 + 4) >> 2; ++ strlcpy(t->u.cmdline.cmdline, ap1000_mem_fixup, COMMAND_LINE_SIZE); ++ strlcpy(t->u.cmdline.cmdline + strlen(ap1000_mem_fixup), p, ++ COMMAND_LINE_SIZE - strlen(ap1000_mem_fixup)); ++ ++ /* Terminate the table. */ ++ t = tag_next(t); ++ t->hdr.tag = ATAG_NONE; ++ t->hdr.size = 0; ++} ++ ++static void __init ap1000_init(void) ++{ ++ ixp4xx_sys_init(); ++ ++ ap1000_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); ++ ap1000_flash_resource.end = ++ IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; ++ ++ platform_add_devices(ap1000_devices, ARRAY_SIZE(ap1000_devices)); ++} ++ ++#ifdef CONFIG_MACH_AP1000 ++MACHINE_START(AP1000, "Lanready AP-1000") ++ /* Maintainer: Imre Kaloz */ ++ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, ++ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, ++ .fixup = ap1000_fixup, ++ .map_io = ixp4xx_map_io, ++ .init_irq = ixp4xx_init_irq, ++ .timer = &ixp4xx_timer, ++ .boot_params = 0x0100, ++ .init_machine = ap1000_init, ++MACHINE_END ++#endif +--- a/arch/arm/mach-ixp4xx/ixdp425-pci.c ++++ b/arch/arm/mach-ixp4xx/ixdp425-pci.c +@@ -67,7 +67,7 @@ int __init ixdp425_pci_init(void) + { + if (machine_is_ixdp425() || machine_is_ixcdp1100() || + machine_is_ixdp465() || machine_is_kixrp435() || +- machine_is_compex()) ++ machine_is_compex() || machine_is_ap1000()) + pci_common_init(&ixdp425_pci); + return 0; + } +--- a/arch/arm/mach-ixp4xx/Kconfig ++++ b/arch/arm/mach-ixp4xx/Kconfig +@@ -105,6 +105,14 @@ config MACH_WRT300NV2 + WRT300N v2 router. For more information on this + platform, see http://openwrt.org + ++config MACH_AP1000 ++ bool "Lanready AP-1000" ++ select PCI ++ help ++ Say 'Y' here if you want your kernel to support Lanready's ++ AP1000 board. For more information on this ++ platform, see http://openwrt.org ++ + config ARCH_IXDP425 + bool "IXDP425" + help +--- a/arch/arm/mach-ixp4xx/Makefile ++++ b/arch/arm/mach-ixp4xx/Makefile +@@ -21,6 +21,7 @@ obj-pci-$(CONFIG_MACH_PRONGHORN) += pron + obj-pci-$(CONFIG_MACH_SIDEWINDER) += sidewinder-pci.o + obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o + obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o ++obj-pci-$(CONFIG_MACH_AP1000) += ixdp425-pci.o + + obj-y += common.o + +@@ -41,6 +42,7 @@ obj-$(CONFIG_MACH_PRONGHORN) += pronghor + obj-$(CONFIG_MACH_SIDEWINDER) += sidewinder-setup.o + obj-$(CONFIG_MACH_COMPEX) += compex-setup.o + obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o ++obj-$(CONFIG_MACH_AP1000) += ap1000-setup.o + + obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o + obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o diff --git a/target/linux/ixp4xx/patches-2.6.32/151-lanready_ap1000_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.32/151-lanready_ap1000_mac_plat_info.patch new file mode 100644 index 000000000..a1214d567 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/151-lanready_ap1000_mac_plat_info.patch @@ -0,0 +1,41 @@ +--- a/arch/arm/mach-ixp4xx/ap1000-setup.c ++++ b/arch/arm/mach-ixp4xx/ap1000-setup.c +@@ -90,9 +90,37 @@ static struct platform_device ap1000_uar + .resource = ap1000_uart_resources + }; + ++/* Built-in 10/100 Ethernet MAC interfaces */ ++static struct eth_plat_info ap1000_plat_eth[] = { ++ { ++ .phy = IXP4XX_ETH_PHY_MAX_ADDR, ++ .phy_mask = 0x1e, ++ .rxq = 3, ++ .txreadyq = 20, ++ }, { ++ .phy = 5, ++ .rxq = 4, ++ .txreadyq = 21, ++ } ++}; ++ ++static struct platform_device ap1000_eth[] = { ++ { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEB, ++ .dev.platform_data = ap1000_plat_eth, ++ }, { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEC, ++ .dev.platform_data = ap1000_plat_eth + 1, ++ } ++}; ++ + static struct platform_device *ap1000_devices[] __initdata = { + &ap1000_flash, +- &ap1000_uart ++ &ap1000_uart, ++ &ap1000_eth[0], ++ &ap1000_eth[1], + }; + + static char ap1000_mem_fixup[] __initdata = "mem=64M "; diff --git a/target/linux/ixp4xx/patches-2.6.32/162-wg302v1_mem_fixup.patch b/target/linux/ixp4xx/patches-2.6.32/162-wg302v1_mem_fixup.patch new file mode 100644 index 000000000..684db4475 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/162-wg302v1_mem_fixup.patch @@ -0,0 +1,47 @@ +--- a/arch/arm/mach-ixp4xx/wg302v1-setup.c ++++ b/arch/arm/mach-ixp4xx/wg302v1-setup.c +@@ -115,6 +115,36 @@ static struct platform_device *wg302v1_d + &wg302v1_eth[0], + }; + ++static char wg302v1_mem_fixup[] __initdata = "mem=32M "; ++ ++static void __init wg302v1_fixup(struct machine_desc *desc, ++ struct tag *tags, char **cmdline, struct meminfo *mi) ++ ++{ ++ struct tag *t = tags; ++ char *p = *cmdline; ++ ++ /* Find the end of the tags table, taking note of any cmdline tag. */ ++ for (; t->hdr.size; t = tag_next(t)) { ++ if (t->hdr.tag == ATAG_CMDLINE) { ++ p = t->u.cmdline.cmdline; ++ } ++ } ++ ++ /* Overwrite the end of the table with a new cmdline tag. */ ++ t->hdr.tag = ATAG_CMDLINE; ++ t->hdr.size = (sizeof (struct tag_header) + ++ strlen(wg302v1_mem_fixup) + strlen(p) + 1 + 4) >> 2; ++ strlcpy(t->u.cmdline.cmdline, wg302v1_mem_fixup, COMMAND_LINE_SIZE); ++ strlcpy(t->u.cmdline.cmdline + strlen(wg302v1_mem_fixup), p, ++ COMMAND_LINE_SIZE - strlen(wg302v1_mem_fixup)); ++ ++ /* Terminate the table. */ ++ t = tag_next(t); ++ t->hdr.tag = ATAG_NONE; ++ t->hdr.size = 0; ++} ++ + static void __init wg302v1_init(void) + { + ixp4xx_sys_init(); +@@ -133,6 +163,7 @@ MACHINE_START(WG302V1, "Netgear WG302 v1 + /* Maintainer: Imre Kaloz */ + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, ++ .fixup = wg302v1_fixup, + .map_io = ixp4xx_map_io, + .init_irq = ixp4xx_init_irq, + .timer = &ixp4xx_timer, diff --git a/target/linux/ixp4xx/patches-2.6.32/170-ixdpg425_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.32/170-ixdpg425_mac_plat_info.patch new file mode 100644 index 000000000..772b697aa --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/170-ixdpg425_mac_plat_info.patch @@ -0,0 +1,41 @@ +--- a/arch/arm/mach-ixp4xx/coyote-setup.c ++++ b/arch/arm/mach-ixp4xx/coyote-setup.c +@@ -73,9 +73,37 @@ static struct platform_device coyote_uar + .resource = &coyote_uart_resource, + }; + ++/* Built-in 10/100 Ethernet MAC interfaces */ ++static struct eth_plat_info ixdpg425_plat_eth[] = { ++ { ++ .phy = 5, ++ .rxq = 3, ++ .txreadyq = 20, ++ }, { ++ .phy = 4, ++ .rxq = 4, ++ .txreadyq = 21, ++ } ++}; ++ ++static struct platform_device ixdpg425_eth[] = { ++ { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEB, ++ .dev.platform_data = ixdpg425_plat_eth, ++ }, { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEC, ++ .dev.platform_data = ixdpg425_plat_eth + 1, ++ } ++}; ++ ++ + static struct platform_device *coyote_devices[] __initdata = { + &coyote_flash, +- &coyote_uart ++ &coyote_uart, ++ &ixdpg425_eth[0], ++ &ixdpg425_eth[1], + }; + + static void __init coyote_init(void) diff --git a/target/linux/ixp4xx/patches-2.6.32/180-tw5334_support.patch b/target/linux/ixp4xx/patches-2.6.32/180-tw5334_support.patch new file mode 100644 index 000000000..f59792a53 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/180-tw5334_support.patch @@ -0,0 +1,284 @@ +--- a/arch/arm/mach-ixp4xx/Kconfig ++++ b/arch/arm/mach-ixp4xx/Kconfig +@@ -164,6 +164,14 @@ config ARCH_PRPMC1100 + PrPCM1100 Processor Mezanine Module. For more information on + this platform, see . + ++config MACH_TW5334 ++ bool "Titan Wireless TW-533-4" ++ select PCI ++ help ++ Say 'Y' here if you want your kernel to support the Titan ++ Wireless TW533-4. For more information on this platform, ++ see http://openwrt.org ++ + config MACH_NAS100D + bool + prompt "NAS100D" +--- a/arch/arm/mach-ixp4xx/Makefile ++++ b/arch/arm/mach-ixp4xx/Makefile +@@ -22,6 +22,7 @@ obj-pci-$(CONFIG_MACH_SIDEWINDER) += sid + obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o + obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o + obj-pci-$(CONFIG_MACH_AP1000) += ixdp425-pci.o ++obj-pci-$(CONFIG_MACH_TW5334) += tw5334-pci.o + + obj-y += common.o + +@@ -43,6 +44,7 @@ obj-$(CONFIG_MACH_SIDEWINDER) += sidewin + obj-$(CONFIG_MACH_COMPEX) += compex-setup.o + obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o + obj-$(CONFIG_MACH_AP1000) += ap1000-setup.o ++obj-$(CONFIG_MACH_TW5334) += tw5334-setup.o + + obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o + obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o +--- /dev/null ++++ b/arch/arm/mach-ixp4xx/tw5334-setup.c +@@ -0,0 +1,162 @@ ++/* ++ * arch/arm/mach-ixp4xx/tw5334-setup.c ++ * ++ * Board setup for the Titan Wireless TW-533-4 ++ * ++ * Copyright (C) 2008 Imre Kaloz ++ * ++ * based on coyote-setup.c: ++ * Copyright (C) 2003-2005 MontaVista Software, Inc. ++ * ++ * Author: Imre Kaloz ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static struct flash_platform_data tw5334_flash_data = { ++ .map_name = "cfi_probe", ++ .width = 2, ++}; ++ ++static struct resource tw5334_flash_resource = { ++ .flags = IORESOURCE_MEM, ++}; ++ ++static struct platform_device tw5334_flash = { ++ .name = "IXP4XX-Flash", ++ .id = 0, ++ .dev = { ++ .platform_data = &tw5334_flash_data, ++ }, ++ .num_resources = 1, ++ .resource = &tw5334_flash_resource, ++}; ++ ++static struct resource tw5334_uart_resource = { ++ .start = IXP4XX_UART2_BASE_PHYS, ++ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, ++ .flags = IORESOURCE_MEM, ++}; ++ ++static struct plat_serial8250_port tw5334_uart_data[] = { ++ { ++ .mapbase = IXP4XX_UART2_BASE_PHYS, ++ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, ++ .irq = IRQ_IXP4XX_UART2, ++ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, ++ .iotype = UPIO_MEM, ++ .regshift = 2, ++ .uartclk = IXP4XX_UART_XTAL, ++ }, ++ { }, ++}; ++ ++static struct platform_device tw5334_uart = { ++ .name = "serial8250", ++ .id = PLAT8250_DEV_PLATFORM, ++ .dev = { ++ .platform_data = tw5334_uart_data, ++ }, ++ .num_resources = 1, ++ .resource = &tw5334_uart_resource, ++}; ++ ++/* Built-in 10/100 Ethernet MAC interfaces */ ++static struct eth_plat_info tw5334_plat_eth[] = { ++ { ++ .phy = 0, ++ .rxq = 3, ++ .txreadyq = 20, ++ }, { ++ .phy = 1, ++ .rxq = 4, ++ .txreadyq = 21, ++ } ++}; ++ ++static struct platform_device tw5334_eth[] = { ++ { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEB, ++ .dev.platform_data = tw5334_plat_eth, ++ }, { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEC, ++ .dev.platform_data = tw5334_plat_eth + 1, ++ } ++}; ++ ++static struct platform_device *tw5334_devices[] __initdata = { ++ &tw5334_flash, ++ &tw5334_uart, ++ &tw5334_eth[0], ++ &tw5334_eth[1], ++}; ++ ++static void __init tw5334_init(void) ++{ ++ DECLARE_MAC_BUF(mac_buf); ++ uint8_t __iomem *f; ++ int i; ++ ++ ixp4xx_sys_init(); ++ ++ tw5334_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); ++ tw5334_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; ++ ++ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; ++ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; ++ ++ platform_add_devices(tw5334_devices, ARRAY_SIZE(tw5334_devices)); ++ ++ /* ++ * Map in a portion of the flash and read the MAC addresses. ++ * Since it is stored in BE in the flash itself, we need to ++ * byteswap it if we're in LE mode. ++ */ ++ f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x1000000); ++ if (f) { ++ for (i = 0; i < 6; i++) ++#ifdef __ARMEB__ ++ tw5334_plat_eth[0].hwaddr[i] = readb(f + 0xFC0422 + i); ++ tw5334_plat_eth[1].hwaddr[i] = readb(f + 0xFC043B + i); ++#else ++ tw5334_plat_eth[0].hwaddr[i] = readb(f + 0xFC0422 + (i^3)); ++ tw5334_plat_eth[1].hwaddr[i] = readb(f + 0xFC043B + (i^3)); ++#endif ++ iounmap(f); ++ } ++ printk(KERN_INFO "TW-533-4: Using MAC address %s for port 0\n", ++ print_mac(mac_buf, tw5334_plat_eth[0].hwaddr)); ++ printk(KERN_INFO "TW-533-4: Using MAC address %s for port 1\n", ++ print_mac(mac_buf, tw5334_plat_eth[1].hwaddr)); ++} ++ ++#ifdef CONFIG_MACH_TW5334 ++MACHINE_START(TW5334, "Titan Wireless TW-533-4") ++ /* Maintainer: Imre Kaloz */ ++ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, ++ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, ++ .map_io = ixp4xx_map_io, ++ .init_irq = ixp4xx_init_irq, ++ .timer = &ixp4xx_timer, ++ .boot_params = 0x0100, ++ .init_machine = tw5334_init, ++MACHINE_END ++#endif +--- /dev/null ++++ b/arch/arm/mach-ixp4xx/tw5334-pci.c +@@ -0,0 +1,69 @@ ++/* ++ * arch/arch/mach-ixp4xx/tw5334-pci.c ++ * ++ * PCI setup routines for the Titan Wireless TW-533-4 ++ * ++ * Copyright (C) 2008 Imre Kaloz ++ * ++ * based on coyote-pci.c: ++ * Copyright (C) 2002 Jungo Software Technologies. ++ * Copyright (C) 2003 MontaVista Softwrae, Inc. ++ * ++ * Maintainer: Imre Kaloz ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include ++ ++void __init tw5334_pci_preinit(void) ++{ ++ set_irq_type(IRQ_IXP4XX_GPIO6, IRQ_TYPE_LEVEL_LOW); ++ set_irq_type(IRQ_IXP4XX_GPIO2, IRQ_TYPE_LEVEL_LOW); ++ set_irq_type(IRQ_IXP4XX_GPIO1, IRQ_TYPE_LEVEL_LOW); ++ set_irq_type(IRQ_IXP4XX_GPIO0, IRQ_TYPE_LEVEL_LOW); ++ ++ ixp4xx_pci_preinit(); ++} ++ ++static int __init tw5334_map_irq(struct pci_dev *dev, u8 slot, u8 pin) ++{ ++ if (slot == 12) ++ return IRQ_IXP4XX_GPIO6; ++ else if (slot == 13) ++ return IRQ_IXP4XX_GPIO2; ++ else if (slot == 14) ++ return IRQ_IXP4XX_GPIO1; ++ else if (slot == 15) ++ return IRQ_IXP4XX_GPIO0; ++ else return -1; ++} ++ ++struct hw_pci tw5334_pci __initdata = { ++ .nr_controllers = 1, ++ .preinit = tw5334_pci_preinit, ++ .swizzle = pci_std_swizzle, ++ .setup = ixp4xx_setup, ++ .scan = ixp4xx_scan_bus, ++ .map_irq = tw5334_map_irq, ++}; ++ ++int __init tw5334_pci_init(void) ++{ ++ if (machine_is_tw5334()) ++ pci_common_init(&tw5334_pci); ++ return 0; ++} ++ ++subsys_initcall(tw5334_pci_init); +--- a/arch/arm/mach-ixp4xx/include/mach/uncompress.h ++++ b/arch/arm/mach-ixp4xx/include/mach/uncompress.h +@@ -42,7 +42,8 @@ static __inline__ void __arch_decomp_set + */ + if (machine_is_adi_coyote() || machine_is_gtwx5715() || + machine_is_gateway7001() || machine_is_wg302v2() || +- machine_is_pronghorn() || machine_is_pronghorn_metro() || machine_is_wrt300nv2()) ++ machine_is_pronghorn() || machine_is_pronghorn_metro() || machine_is_wrt300nv2() || ++ machine_is_tw5334()) + uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS; + else + uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS; diff --git a/target/linux/ixp4xx/patches-2.6.32/185-mi424wr_support.patch b/target/linux/ixp4xx/patches-2.6.32/185-mi424wr_support.patch new file mode 100644 index 000000000..1b8ee89c9 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/185-mi424wr_support.patch @@ -0,0 +1,465 @@ +--- /dev/null ++++ b/arch/arm/mach-ixp4xx/mi424wr-pci.c +@@ -0,0 +1,71 @@ ++/* ++ * arch/arm/mach-ixp4xx/mi424wr-pci.c ++ * ++ * Actiontec MI424WR board-level PCI initialization ++ * ++ * Copyright (C) 2008 Jose Vasconcellos ++ * ++ * Maintainer: Jose Vasconcellos ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++/* PCI controller GPIO to IRQ pin mappings ++ * This information was obtained from Actiontec's GPL release. ++ * ++ * INTA INTB ++ * SLOT 13 8 6 ++ * SLOT 14 7 8 ++ * SLOT 15 6 7 ++ */ ++ ++void __init mi424wr_pci_preinit(void) ++{ ++ set_irq_type(IRQ_IXP4XX_GPIO6, IRQ_TYPE_LEVEL_LOW); ++ set_irq_type(IRQ_IXP4XX_GPIO7, IRQ_TYPE_LEVEL_LOW); ++ set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_LEVEL_LOW); ++ ++ ixp4xx_pci_preinit(); ++} ++ ++static int __init mi424wr_map_irq(struct pci_dev *dev, u8 slot, u8 pin) ++{ ++ if (slot == 13) ++ return IRQ_IXP4XX_GPIO8; ++ if (slot == 14) ++ return IRQ_IXP4XX_GPIO7; ++ if (slot == 15) ++ return IRQ_IXP4XX_GPIO6; ++ ++ return -1; ++} ++ ++struct hw_pci mi424wr_pci __initdata = { ++ .nr_controllers = 1, ++ .preinit = mi424wr_pci_preinit, ++ .swizzle = pci_std_swizzle, ++ .setup = ixp4xx_setup, ++ .scan = ixp4xx_scan_bus, ++ .map_irq = mi424wr_map_irq, ++}; ++ ++int __init mi424wr_pci_init(void) ++{ ++ if (machine_is_mi424wr()) ++ pci_common_init(&mi424wr_pci); ++ return 0; ++} ++ ++subsys_initcall(mi424wr_pci_init); ++ +--- /dev/null ++++ b/arch/arm/mach-ixp4xx/mi424wr-setup.c +@@ -0,0 +1,344 @@ ++/* ++ * arch/arm/mach-ixp4xx/mi424wr-setup.c ++ * ++ * Actiontec MI424-WR board setup ++ * Copyright (c) 2008 Jose Vasconcellos ++ * ++ * Based on Gemtek GTWX5715 by ++ * Copyright (C) 2004 George T. Joseph ++ * Derived from Coyote ++ * ++ * 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 ++ * of the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* ++ * GPIO 2,3,4 and 9 are hard wired to the Micrel/Kendin KS8995M Switch ++ * and operate as an SPI type interface. The details of the interface ++ * are available on Kendin/Micrel's web site. ++ */ ++ ++#define MI424WR_KSSPI_SELECT 9 ++#define MI424WR_KSSPI_TXD 4 ++#define MI424WR_KSSPI_CLOCK 2 ++#define MI424WR_KSSPI_RXD 3 ++ ++/* ++ * The "reset" button is wired to GPIO 10. ++ * The GPIO is brought "low" when the button is pushed. ++ */ ++ ++#define MI424WR_BUTTON_GPIO 10 ++#define MI424WR_BUTTON_IRQ IRQ_IXP4XX_GPIO10 ++ ++#define MI424WR_MOCA_WAN_LED 11 ++ ++/* Latch on CS1 - taken from Actiontec's 2.4 source code ++ * ++ * default latch value ++ * 0 - power alarm led (red) 0 (off) ++ * 1 - power led (green) 0 (off) ++ * 2 - wireless led (green) 1 (off) ++ * 3 - no internet led (red) 0 (off) ++ * 4 - internet ok led (green) 0 (off) ++ * 5 - moca LAN 0 (off) ++ * 6 - WAN alarm led (red) 0 (off) ++ * 7 - PCI reset 1 (not reset) ++ * 8 - IP phone 1 led (green) 1 (off) ++ * 9 - IP phone 2 led (green) 1 (off) ++ * 10 - VOIP ready led (green) 1 (off) ++ * 11 - PSTN relay 1 control 0 (PSTN) ++ * 12 - PSTN relay 1 control 0 (PSTN) ++ * 13 - N/A ++ * 14 - N/A ++ * 15 - N/A ++ */ ++ ++#define MI424WR_LATCH_MASK 0x04 ++#define MI424WR_LATCH_DEFAULT 0x1f86 ++ ++#define MI424WR_LATCH_ALARM_LED 0x00 ++#define MI424WR_LATCH_POWER_LED 0x01 ++#define MI424WR_LATCH_WIRELESS_LED 0x02 ++#define MI424WR_LATCH_INET_DOWN_LED 0x03 ++#define MI424WR_LATCH_INET_OK_LED 0x04 ++#define MI424WR_LATCH_MOCA_LAN_LED 0x05 ++#define MI424WR_LATCH_WAN_ALARM_LED 0x06 ++#define MI424WR_LATCH_PCI_RESET 0x07 ++#define MI424WR_LATCH_PHONE1_LED 0x08 ++#define MI424WR_LATCH_PHONE2_LED 0x09 ++#define MI424WR_LATCH_VOIP_LED 0x10 ++#define MI424WR_LATCH_PSTN_RELAY1 0x11 ++#define MI424WR_LATCH_PSTN_RELAY2 0x12 ++ ++/* initialize CS1 to default timings, Intel style, 16-bit bus */ ++#define MI424WR_CS1_CONFIG 0x80000002 ++ ++/* Define both UARTs but they are not easily accessible. ++ */ ++ ++static struct resource mi424wr_uart_resources[] = { ++ { ++ .start = IXP4XX_UART1_BASE_PHYS, ++ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, ++ .flags = IORESOURCE_MEM, ++ }, ++ { ++ .start = IXP4XX_UART2_BASE_PHYS, ++ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, ++ .flags = IORESOURCE_MEM, ++ } ++}; ++ ++ ++static struct plat_serial8250_port mi424wr_uart_platform_data[] = { ++ { ++ .mapbase = IXP4XX_UART1_BASE_PHYS, ++ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, ++ .irq = IRQ_IXP4XX_UART1, ++ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, ++ .iotype = UPIO_MEM, ++ .regshift = 2, ++ .uartclk = IXP4XX_UART_XTAL, ++ }, ++ { ++ .mapbase = IXP4XX_UART2_BASE_PHYS, ++ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, ++ .irq = IRQ_IXP4XX_UART2, ++ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, ++ .iotype = UPIO_MEM, ++ .regshift = 2, ++ .uartclk = IXP4XX_UART_XTAL, ++ }, ++ { }, ++}; ++ ++static struct platform_device mi424wr_uart_device = { ++ .name = "serial8250", ++ .id = PLAT8250_DEV_PLATFORM, ++ .dev.platform_data = mi424wr_uart_platform_data, ++ .num_resources = ARRAY_SIZE(mi424wr_uart_resources), ++ .resource = mi424wr_uart_resources, ++}; ++ ++static struct flash_platform_data mi424wr_flash_data = { ++ .map_name = "cfi_probe", ++ .width = 2, ++}; ++ ++static struct resource mi424wr_flash_resource = { ++ .flags = IORESOURCE_MEM, ++}; ++ ++static struct platform_device mi424wr_flash = { ++ .name = "IXP4XX-Flash", ++ .id = 0, ++ .dev.platform_data = &mi424wr_flash_data, ++ .num_resources = 1, ++ .resource = &mi424wr_flash_resource, ++}; ++ ++static int mi424wr_spi_boardinfo_setup(struct spi_board_info *bi, ++ struct spi_master *master, void *data) ++{ ++ ++ strlcpy(bi->modalias, "spi-ks8995", sizeof(bi->modalias)); ++ ++ bi->max_speed_hz = 5000000 /* Hz */; ++ bi->bus_num = master->bus_num; ++ bi->mode = SPI_MODE_0; ++ ++ return 0; ++} ++ ++static struct spi_gpio_platform_data mi424wr_spi_bus_data = { ++ .pin_cs = MI424WR_KSSPI_SELECT, ++ .pin_clk = MI424WR_KSSPI_CLOCK, ++ .pin_miso = MI424WR_KSSPI_RXD, ++ .pin_mosi = MI424WR_KSSPI_TXD, ++ .cs_activelow = 1, ++ .no_spi_delay = 1, ++ .boardinfo_setup = mi424wr_spi_boardinfo_setup, ++}; ++ ++static struct gpio_led mi424wr_gpio_led[] = { ++ { ++ .name = "moca-wan", /* green led */ ++ .gpio = MI424WR_MOCA_WAN_LED, ++ .active_low = 0, ++ } ++}; ++ ++static struct gpio_led_platform_data mi424wr_gpio_leds_data = { ++ .num_leds = 1, ++ .leds = mi424wr_gpio_led, ++}; ++ ++static struct platform_device mi424wr_gpio_leds = { ++ .name = "leds-gpio", ++ .id = -1, ++ .dev.platform_data = &mi424wr_gpio_leds_data, ++}; ++ ++static uint16_t latch_value = MI424WR_LATCH_DEFAULT; ++static uint16_t __iomem *iobase; ++ ++static void mi424wr_latch_set_led(u8 bit, enum led_brightness value) ++{ ++ ++ if (((MI424WR_LATCH_MASK >> bit) & 1) ^ (value == LED_OFF)) ++ latch_value &= ~(0x1 << bit); ++ else ++ latch_value |= (0x1 << bit); ++ ++ __raw_writew(latch_value, iobase); ++ ++} ++ ++static struct latch_led mi424wr_latch_led[] = { ++ { ++ .name = "power-alarm", ++ .bit = MI424WR_LATCH_ALARM_LED, ++ }, ++ { ++ .name = "power-ok", ++ .bit = MI424WR_LATCH_POWER_LED, ++ }, ++ { ++ .name = "wireless", /* green led */ ++ .bit = MI424WR_LATCH_WIRELESS_LED, ++ }, ++ { ++ .name = "inet-down", /* red led */ ++ .bit = MI424WR_LATCH_INET_DOWN_LED, ++ }, ++ { ++ .name = "inet-up", /* green led */ ++ .bit = MI424WR_LATCH_INET_OK_LED, ++ }, ++ { ++ .name = "moca-lan", /* green led */ ++ .bit = MI424WR_LATCH_MOCA_LAN_LED, ++ }, ++ { ++ .name = "wan-alarm", /* red led */ ++ .bit = MI424WR_LATCH_WAN_ALARM_LED, ++ } ++}; ++ ++static struct latch_led_platform_data mi424wr_latch_leds_data = { ++ .num_leds = ARRAY_SIZE(mi424wr_latch_led), ++ .mem = 0x51000000, ++ .leds = mi424wr_latch_led, ++ .set_led = mi424wr_latch_set_led, ++}; ++ ++static struct platform_device mi424wr_latch_leds = { ++ .name = "leds-latch", ++ .id = -1, ++ .dev.platform_data = &mi424wr_latch_leds_data, ++}; ++ ++static struct platform_device mi424wr_spi_bus = { ++ .name = "spi-gpio", ++ .id = 0, ++ .dev.platform_data = &mi424wr_spi_bus_data, ++}; ++ ++static struct eth_plat_info mi424wr_npeb_data = { ++ .phy = 17, /* KS8721 */ ++ .rxq = 3, ++ .txreadyq = 20, ++}; ++ ++static struct eth_plat_info mi424wr_npec_data = { ++ .phy = IXP4XX_ETH_PHY_MAX_ADDR, ++ .phy_mask = 0x1e, /* ports 1-4 of the KS8995 switch */ ++ .rxq = 4, ++ .txreadyq = 21, ++}; ++ ++static struct platform_device mi424wr_npe_devices[] = { ++ { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEC, ++ .dev.platform_data = &mi424wr_npec_data, ++ }, { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEB, ++ .dev.platform_data = &mi424wr_npeb_data, ++ } ++}; ++ ++static struct platform_device *mi424wr_devices[] __initdata = { ++ &mi424wr_uart_device, ++ &mi424wr_flash, ++ &mi424wr_gpio_leds, ++ &mi424wr_latch_leds, ++ &mi424wr_spi_bus, ++ &mi424wr_npe_devices[0], ++ &mi424wr_npe_devices[1], ++}; ++ ++static void __init mi424wr_init(void) ++{ ++ ixp4xx_sys_init(); ++ ++ mi424wr_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); ++ mi424wr_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_8M - 1; ++ ++ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; ++ *IXP4XX_EXP_CS1 = MI424WR_CS1_CONFIG; ++ ++ /* configure button as input ++ */ ++ gpio_line_config(MI424WR_BUTTON_GPIO, IXP4XX_GPIO_IN); ++ ++ /* Initialize LEDs and enables PCI bus. ++ */ ++ iobase = ioremap_nocache(IXP4XX_EXP_BUS_BASE(1), 0x1000); ++ __raw_writew(latch_value, iobase); ++ ++ platform_add_devices(mi424wr_devices, ARRAY_SIZE(mi424wr_devices)); ++} ++ ++ ++MACHINE_START(MI424WR, "Actiontec MI424WR") ++ /* Maintainer: Jose Vasconcellos */ ++ .phys_io = IXP4XX_UART2_BASE_PHYS, ++ .io_pg_offst = ((IXP4XX_UART2_BASE_VIRT) >> 18) & 0xfffc, ++ .map_io = ixp4xx_map_io, ++ .init_irq = ixp4xx_init_irq, ++ .timer = &ixp4xx_timer, ++ .boot_params = 0x0100, ++ .init_machine = mi424wr_init, ++MACHINE_END ++ +--- a/arch/arm/mach-ixp4xx/Makefile ++++ b/arch/arm/mach-ixp4xx/Makefile +@@ -23,6 +23,7 @@ obj-pci-$(CONFIG_MACH_COMPEX) += ixdp42 + obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o + obj-pci-$(CONFIG_MACH_AP1000) += ixdp425-pci.o + obj-pci-$(CONFIG_MACH_TW5334) += tw5334-pci.o ++obj-pci-$(CONFIG_MACH_MI424WR) += mi424wr-pci.o + + obj-y += common.o + +@@ -45,6 +46,7 @@ obj-$(CONFIG_MACH_COMPEX) += compex-setu + obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o + obj-$(CONFIG_MACH_AP1000) += ap1000-setup.o + obj-$(CONFIG_MACH_TW5334) += tw5334-setup.o ++obj-$(CONFIG_MACH_MI424WR) += mi424wr-setup.o + + obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o + obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o +--- a/arch/arm/mach-ixp4xx/Kconfig ++++ b/arch/arm/mach-ixp4xx/Kconfig +@@ -235,6 +235,13 @@ config MACH_GTWX5715 + "High Speed" UART is n/c (as far as I can tell) + 20 Pin ARM/Xscale JTAG interface on J2 + ++config MACH_MI424WR ++ bool "Actiontec MI424WR" ++ depends on ARCH_IXP4XX ++ select PCI ++ help ++ Add support for the Actiontec MI424-WR. ++ + comment "IXP4xx Options" + + config IXP4XX_INDIRECT_PCI +--- a/arch/arm/configs/ixp4xx_defconfig ++++ b/arch/arm/configs/ixp4xx_defconfig +@@ -172,6 +172,7 @@ CONFIG_MACH_FSG=y + CONFIG_CPU_IXP46X=y + CONFIG_CPU_IXP43X=y + CONFIG_MACH_GTWX5715=y ++CONFIG_MACH_MI424WR=y + + # + # IXP4xx Options diff --git a/target/linux/ixp4xx/patches-2.6.32/190-cambria_support.patch b/target/linux/ixp4xx/patches-2.6.32/190-cambria_support.patch new file mode 100644 index 000000000..c3791c690 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/190-cambria_support.patch @@ -0,0 +1,553 @@ +--- /dev/null ++++ b/arch/arm/mach-ixp4xx/cambria-pci.c +@@ -0,0 +1,74 @@ ++/* ++ * arch/arch/mach-ixp4xx/cambria-pci.c ++ * ++ * PCI setup routines for Gateworks Cambria series ++ * ++ * Copyright (C) 2008 Imre Kaloz ++ * ++ * based on coyote-pci.c: ++ * Copyright (C) 2002 Jungo Software Technologies. ++ * Copyright (C) 2003 MontaVista Softwrae, Inc. ++ * ++ * Maintainer: Imre Kaloz ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#include ++ ++extern void ixp4xx_pci_preinit(void); ++extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); ++extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys); ++ ++void __init cambria_pci_preinit(void) ++{ ++ set_irq_type(IRQ_IXP4XX_GPIO11, IRQ_TYPE_LEVEL_LOW); ++ set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW); ++ set_irq_type(IRQ_IXP4XX_GPIO9, IRQ_TYPE_LEVEL_LOW); ++ set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_LEVEL_LOW); ++ ++ ixp4xx_pci_preinit(); ++} ++ ++static int __init cambria_map_irq(struct pci_dev *dev, u8 slot, u8 pin) ++{ ++ if (slot == 1) ++ return IRQ_IXP4XX_GPIO11; ++ else if (slot == 2) ++ return IRQ_IXP4XX_GPIO10; ++ else if (slot == 3) ++ return IRQ_IXP4XX_GPIO9; ++ else if (slot == 4) ++ return IRQ_IXP4XX_GPIO8; ++ else return -1; ++} ++ ++struct hw_pci cambria_pci __initdata = { ++ .nr_controllers = 1, ++ .preinit = cambria_pci_preinit, ++ .swizzle = pci_std_swizzle, ++ .setup = ixp4xx_setup, ++ .scan = ixp4xx_scan_bus, ++ .map_irq = cambria_map_irq, ++}; ++ ++int __init cambria_pci_init(void) ++{ ++ if (machine_is_cambria()) ++ pci_common_init(&cambria_pci); ++ return 0; ++} ++ ++subsys_initcall(cambria_pci_init); +--- /dev/null ++++ b/arch/arm/mach-ixp4xx/cambria-setup.c +@@ -0,0 +1,429 @@ ++/* ++ * arch/arm/mach-ixp4xx/cambria-setup.c ++ * ++ * Board setup for the Gateworks Cambria series ++ * ++ * Copyright (C) 2008 Imre Kaloz ++ * ++ * based on coyote-setup.c: ++ * Copyright (C) 2003-2005 MontaVista Software, Inc. ++ * ++ * Author: Imre Kaloz ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++struct cambria_board_info { ++ unsigned char *model; ++ void (*setup)(void); ++}; ++ ++static struct cambria_board_info *cambria_info __initdata; ++ ++static struct flash_platform_data cambria_flash_data = { ++ .map_name = "cfi_probe", ++ .width = 2, ++}; ++ ++static struct resource cambria_flash_resource = { ++ .flags = IORESOURCE_MEM, ++}; ++ ++static struct platform_device cambria_flash = { ++ .name = "IXP4XX-Flash", ++ .id = 0, ++ .dev = { ++ .platform_data = &cambria_flash_data, ++ }, ++ .num_resources = 1, ++ .resource = &cambria_flash_resource, ++}; ++ ++static struct i2c_gpio_platform_data cambria_i2c_gpio_data = { ++ .sda_pin = 7, ++ .scl_pin = 6, ++}; ++ ++static struct platform_device cambria_i2c_gpio = { ++ .name = "i2c-gpio", ++ .id = 0, ++ .dev = { ++ .platform_data = &cambria_i2c_gpio_data, ++ }, ++}; ++ ++static struct eth_plat_info cambria_npec_data = { ++ .phy = 1, ++ .rxq = 4, ++ .txreadyq = 21, ++}; ++ ++static struct eth_plat_info cambria_npea_data = { ++ .phy = 2, ++ .rxq = 2, ++ .txreadyq = 19, ++}; ++ ++static struct platform_device cambria_npec_device = { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEC, ++ .dev.platform_data = &cambria_npec_data, ++}; ++ ++static struct platform_device cambria_npea_device = { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEA, ++ .dev.platform_data = &cambria_npea_data, ++}; ++ ++static struct resource cambria_uart_resource = { ++ .start = IXP4XX_UART1_BASE_PHYS, ++ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, ++ .flags = IORESOURCE_MEM, ++}; ++ ++static struct plat_serial8250_port cambria_uart_data[] = { ++ { ++ .mapbase = IXP4XX_UART1_BASE_PHYS, ++ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, ++ .irq = IRQ_IXP4XX_UART1, ++ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, ++ .iotype = UPIO_MEM, ++ .regshift = 2, ++ .uartclk = IXP4XX_UART_XTAL, ++ }, ++ { }, ++}; ++ ++static struct platform_device cambria_uart = { ++ .name = "serial8250", ++ .id = PLAT8250_DEV_PLATFORM, ++ .dev = { ++ .platform_data = cambria_uart_data, ++ }, ++ .num_resources = 1, ++ .resource = &cambria_uart_resource, ++}; ++ ++static struct resource cambria_pata_resources[] = { ++ { ++ .flags = IORESOURCE_MEM ++ }, ++ { ++ .flags = IORESOURCE_MEM, ++ }, ++ { ++ .name = "intrq", ++ .start = IRQ_IXP4XX_GPIO12, ++ .end = IRQ_IXP4XX_GPIO12, ++ .flags = IORESOURCE_IRQ, ++ }, ++}; ++ ++static struct ixp4xx_pata_data cambria_pata_data = { ++ .cs0_bits = 0xbfff3c03, ++ .cs1_bits = 0xbfff3c03, ++}; ++ ++static struct platform_device cambria_pata = { ++ .name = "pata_ixp4xx_cf", ++ .id = 0, ++ .dev.platform_data = &cambria_pata_data, ++ .num_resources = ARRAY_SIZE(cambria_pata_resources), ++ .resource = cambria_pata_resources, ++}; ++ ++static struct gpio_led cambria_gpio_leds[] = { ++ { ++ .name = "user", /* green led */ ++ .gpio = 5, ++ .active_low = 1, ++ } ++}; ++ ++static struct gpio_led_platform_data cambria_gpio_leds_data = { ++ .num_leds = 1, ++ .leds = cambria_gpio_leds, ++}; ++ ++static struct platform_device cambria_gpio_leds_device = { ++ .name = "leds-gpio", ++ .id = -1, ++ .dev.platform_data = &cambria_gpio_leds_data, ++}; ++ ++static struct latch_led cambria_latch_leds[] = { ++ { ++ .name = "ledA", /* green led */ ++ .bit = 0, ++ }, ++ { ++ .name = "ledB", /* green led */ ++ .bit = 1, ++ }, ++ { ++ .name = "ledC", /* green led */ ++ .bit = 2, ++ }, ++ { ++ .name = "ledD", /* green led */ ++ .bit = 3, ++ }, ++ { ++ .name = "ledE", /* green led */ ++ .bit = 4, ++ }, ++ { ++ .name = "ledF", /* green led */ ++ .bit = 5, ++ }, ++ { ++ .name = "ledG", /* green led */ ++ .bit = 6, ++ }, ++ { ++ .name = "ledH", /* green led */ ++ .bit = 7, ++ } ++}; ++ ++static struct latch_led_platform_data cambria_latch_leds_data = { ++ .num_leds = 8, ++ .leds = cambria_latch_leds, ++ .mem = 0x53F40000, ++}; ++ ++static struct platform_device cambria_latch_leds_device = { ++ .name = "leds-latch", ++ .id = -1, ++ .dev.platform_data = &cambria_latch_leds_data, ++}; ++ ++static struct resource cambria_usb0_resources[] = { ++ { ++ .start = 0xCD000000, ++ .end = 0xCD000300, ++ .flags = IORESOURCE_MEM, ++ }, ++ { ++ .start = 32, ++ .flags = IORESOURCE_IRQ, ++ }, ++}; ++ ++static struct resource cambria_usb1_resources[] = { ++ { ++ .start = 0xCE000000, ++ .end = 0xCE000300, ++ .flags = IORESOURCE_MEM, ++ }, ++ { ++ .start = 33, ++ .flags = IORESOURCE_IRQ, ++ }, ++}; ++ ++static u64 ehci_dma_mask = ~(u32)0; ++ ++static struct platform_device cambria_usb0_device = { ++ .name = "ixp4xx-ehci", ++ .id = 0, ++ .resource = cambria_usb0_resources, ++ .num_resources = ARRAY_SIZE(cambria_usb0_resources), ++ .dev = { ++ .dma_mask = &ehci_dma_mask, ++ .coherent_dma_mask = 0xffffffff, ++ }, ++}; ++ ++static struct platform_device cambria_usb1_device = { ++ .name = "ixp4xx-ehci", ++ .id = 1, ++ .resource = cambria_usb1_resources, ++ .num_resources = ARRAY_SIZE(cambria_usb1_resources), ++ .dev = { ++ .dma_mask = &ehci_dma_mask, ++ .coherent_dma_mask = 0xffffffff, ++ }, ++}; ++ ++static struct platform_device *cambria_devices[] __initdata = { ++ &cambria_i2c_gpio, ++ &cambria_flash, ++ &cambria_uart, ++}; ++ ++static void __init cambria_gw23xx_setup(void) ++{ ++ platform_device_register(&cambria_npec_device); ++ platform_device_register(&cambria_npea_device); ++} ++ ++static void __init cambria_gw2350_setup(void) ++{ ++ platform_device_register(&cambria_npec_device); ++ platform_device_register(&cambria_npea_device); ++ ++ platform_device_register(&cambria_usb0_device); ++ platform_device_register(&cambria_usb1_device); ++ ++ platform_device_register(&cambria_gpio_leds_device); ++} ++ ++static void __init cambria_gw2358_setup(void) ++{ ++ platform_device_register(&cambria_npec_device); ++ platform_device_register(&cambria_npea_device); ++ ++ platform_device_register(&cambria_usb0_device); ++ platform_device_register(&cambria_usb1_device); ++ ++ platform_device_register(&cambria_pata); ++ ++ platform_device_register(&cambria_latch_leds_device); ++} ++ ++static struct cambria_board_info cambria_boards[] __initdata = { ++ { ++ .model = "GW2350", ++ .setup = cambria_gw2350_setup, ++ }, { ++ .model = "GW2358", ++ .setup = cambria_gw2358_setup, ++ } ++}; ++ ++static struct cambria_board_info * __init cambria_find_board_info(char *model) ++{ ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(cambria_boards); i++) { ++ struct cambria_board_info *info = &cambria_boards[i]; ++ if (strcmp(info->model, model) == 0) ++ return info; ++ } ++ ++ return NULL; ++} ++ ++static struct memory_accessor *at24_mem_acc; ++ ++static int at24_setup(struct memory_accessor *mem_acc, void *context) ++{ ++ char mac_addr[ETH_ALEN]; ++ char model[6]; ++ ++ at24_mem_acc = mem_acc; ++ ++ /* Read MAC addresses */ ++ if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x0, 6) == 6) { ++ memcpy(&cambria_npec_data.hwaddr, mac_addr, ETH_ALEN); ++ } ++ if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x6, 6) == 6) { ++ memcpy(&cambria_npea_data.hwaddr, mac_addr, ETH_ALEN); ++ } ++ ++ /* Read the first 6 bytes of the model number */ ++ if (at24_mem_acc->read(at24_mem_acc, model, 0x20, 6) == 6) { ++ cambria_info = cambria_find_board_info(model); ++ } ++ ++ return 0; ++} ++ ++static struct at24_platform_data cambria_eeprom_info = { ++ .byte_len = 1024, ++ .page_size = 16, ++ .flags = AT24_FLAG_READONLY, ++ .setup = at24_setup, ++}; ++ ++static struct i2c_board_info __initdata cambria_i2c_board_info[] = { ++ { ++ I2C_BOARD_INFO("ds1672", 0x68), ++ }, ++ { ++ I2C_BOARD_INFO("ad7418", 0x28), ++ }, ++ { ++ I2C_BOARD_INFO("24c08", 0x51), ++ .platform_data = &cambria_eeprom_info ++ }, ++}; ++ ++static void __init cambria_init(void) ++{ ++ ixp4xx_sys_init(); ++ ++ cambria_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); ++ cambria_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; ++ ++ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; ++ *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; ++ ++ platform_add_devices(cambria_devices, ARRAY_SIZE(cambria_devices)); ++ ++ cambria_pata_resources[0].start = 0x53e00000; ++ cambria_pata_resources[0].end = 0x53e3ffff; ++ ++ cambria_pata_resources[1].start = 0x53e40000; ++ cambria_pata_resources[1].end = 0x53e7ffff; ++ ++ cambria_pata_data.cs0_cfg = IXP4XX_EXP_CS3; ++ cambria_pata_data.cs1_cfg = IXP4XX_EXP_CS3; ++ ++ i2c_register_board_info(0, cambria_i2c_board_info, ++ ARRAY_SIZE(cambria_i2c_board_info)); ++} ++ ++static int __init cambria_model_setup(void) ++{ ++ if (!machine_is_cambria()) ++ return 0; ++ ++ if (cambria_info) { ++ printk(KERN_DEBUG "Running on Gateworks Cambria %s\n", ++ cambria_info->model); ++ cambria_info->setup(); ++ } else { ++ printk(KERN_INFO "Unknown/missing Cambria model number" ++ " -- defaults will be used\n"); ++ cambria_gw23xx_setup(); ++ } ++ ++ return 0; ++} ++late_initcall(cambria_model_setup); ++ ++MACHINE_START(CAMBRIA, "Gateworks Cambria series") ++ /* Maintainer: Imre Kaloz */ ++ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, ++ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, ++ .map_io = ixp4xx_map_io, ++ .init_irq = ixp4xx_init_irq, ++ .timer = &ixp4xx_timer, ++ .boot_params = 0x0100, ++ .init_machine = cambria_init, ++MACHINE_END +--- a/arch/arm/mach-ixp4xx/Kconfig ++++ b/arch/arm/mach-ixp4xx/Kconfig +@@ -25,6 +25,14 @@ config MACH_AVILA + Avila Network Platform. For more information on this platform, + see . + ++config MACH_CAMBRIA ++ bool "Cambria" ++ select PCI ++ help ++ Say 'Y' here if you want your kernel to support the Gateworks ++ Cambria series. For more information on this platform, ++ see . ++ + config MACH_LOFT + bool "Loft" + depends on MACH_AVILA +@@ -214,7 +222,7 @@ config CPU_IXP46X + + config CPU_IXP43X + bool +- depends on MACH_KIXRP435 ++ depends on MACH_KIXRP435 || MACH_CAMBRIA + default y + + config MACH_GTWX5715 +--- a/arch/arm/mach-ixp4xx/Makefile ++++ b/arch/arm/mach-ixp4xx/Makefile +@@ -7,6 +7,7 @@ obj-pci-n := + + obj-pci-$(CONFIG_ARCH_IXDP4XX) += ixdp425-pci.o + obj-pci-$(CONFIG_MACH_AVILA) += avila-pci.o ++obj-pci-$(CONFIG_MACH_CAMBRIA) += cambria-pci.o + obj-pci-$(CONFIG_MACH_IXDPG425) += ixdpg425-pci.o + obj-pci-$(CONFIG_ARCH_ADI_COYOTE) += coyote-pci.o + obj-pci-$(CONFIG_MACH_GTWX5715) += gtwx5715-pci.o +@@ -29,6 +30,7 @@ obj-y += common.o + + obj-$(CONFIG_ARCH_IXDP4XX) += ixdp425-setup.o + obj-$(CONFIG_MACH_AVILA) += avila-setup.o ++obj-$(CONFIG_MACH_CAMBRIA) += cambria-setup.o + obj-$(CONFIG_MACH_IXDPG425) += coyote-setup.o + obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-setup.o + obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-setup.o diff --git a/target/linux/ixp4xx/patches-2.6.32/191-cambria_optional_uart.patch b/target/linux/ixp4xx/patches-2.6.32/191-cambria_optional_uart.patch new file mode 100644 index 000000000..e41b7e1ad --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/191-cambria_optional_uart.patch @@ -0,0 +1,217 @@ +--- a/arch/arm/mach-ixp4xx/cambria-setup.c ++++ b/arch/arm/mach-ixp4xx/cambria-setup.c +@@ -34,6 +34,7 @@ + #include + #include + #include ++#include + + struct cambria_board_info { + unsigned char *model; +@@ -127,6 +128,45 @@ static struct platform_device cambria_ua + .resource = &cambria_uart_resource, + }; + ++static struct resource cambria_optional_uart_resources[] = { ++ { ++ .start = 0x52000000, ++ .end = 0x52000fff, ++ .flags = IORESOURCE_MEM ++ }, ++ { ++ .start = 0x53000000, ++ .end = 0x53000fff, ++ .flags = IORESOURCE_MEM ++ } ++}; ++ ++static struct plat_serial8250_port cambria_optional_uart_data[] = { ++ { ++ .flags = UPF_BOOT_AUTOCONF, ++ .iotype = UPIO_MEM_DELAY, ++ .regshift = 0, ++ .uartclk = 1843200, ++ .rw_delay = 2, ++ }, ++ { ++ .flags = UPF_BOOT_AUTOCONF, ++ .iotype = UPIO_MEM_DELAY, ++ .regshift = 0, ++ .uartclk = 1843200, ++ .rw_delay = 2, ++ }, ++ { }, ++}; ++ ++static struct platform_device cambria_optional_uart = { ++ .name = "serial8250", ++ .id = PLAT8250_DEV_PLATFORM1, ++ .dev.platform_data = cambria_optional_uart_data, ++ .num_resources = 2, ++ .resource = cambria_optional_uart_resources, ++}; ++ + static struct resource cambria_pata_resources[] = { + { + .flags = IORESOURCE_MEM +@@ -283,6 +323,19 @@ static void __init cambria_gw23xx_setup( + + static void __init cambria_gw2350_setup(void) + { ++ *IXP4XX_EXP_CS2 = 0xBFFF3C43; ++ set_irq_type(IRQ_IXP4XX_GPIO3, IRQ_TYPE_EDGE_RISING); ++ cambria_optional_uart_data[0].mapbase = 0x52FF0000; ++ cambria_optional_uart_data[0].membase = (void __iomem *)ioremap(0x52FF0000, 0x0fff); ++ cambria_optional_uart_data[0].irq = IRQ_IXP4XX_GPIO3; ++ ++ *IXP4XX_EXP_CS3 = 0xBFFF3C43; ++ set_irq_type(IRQ_IXP4XX_GPIO4, IRQ_TYPE_EDGE_RISING); ++ cambria_optional_uart_data[1].mapbase = 0x53FF0000; ++ cambria_optional_uart_data[1].membase = (void __iomem *)ioremap(0x53FF0000, 0x0fff); ++ cambria_optional_uart_data[1].irq = IRQ_IXP4XX_GPIO4; ++ ++ platform_device_register(&cambria_optional_uart); + platform_device_register(&cambria_npec_device); + platform_device_register(&cambria_npea_device); + +@@ -294,6 +347,19 @@ static void __init cambria_gw2350_setup( + + static void __init cambria_gw2358_setup(void) + { ++ *IXP4XX_EXP_CS3 = 0xBFFF3C43; ++ set_irq_type(IRQ_IXP4XX_GPIO3, IRQ_TYPE_EDGE_RISING); ++ cambria_optional_uart_data[0].mapbase = 0x53FC0000; ++ cambria_optional_uart_data[0].membase = (void __iomem *)ioremap(0x53FC0000, 0x0fff); ++ cambria_optional_uart_data[0].irq = IRQ_IXP4XX_GPIO3; ++ ++ set_irq_type(IRQ_IXP4XX_GPIO4, IRQ_TYPE_EDGE_RISING); ++ cambria_optional_uart_data[1].mapbase = 0x53F80000; ++ cambria_optional_uart_data[1].membase = (void __iomem *)ioremap(0x53F80000, 0x0fff); ++ cambria_optional_uart_data[1].irq = IRQ_IXP4XX_GPIO4; ++ ++ platform_device_register(&cambria_optional_uart); ++ + platform_device_register(&cambria_npec_device); + platform_device_register(&cambria_npea_device); + +--- a/include/linux/serial_8250.h ++++ b/include/linux/serial_8250.h +@@ -27,6 +27,7 @@ struct plat_serial8250_port { + void *private_data; + unsigned char regshift; /* register shift */ + unsigned char iotype; /* UPIO_* */ ++ unsigned int rw_delay; /* udelay for slower busses IXP4XX Expansion Bus */ + unsigned char hub6; + upf_t flags; /* UPF_* flags */ + unsigned int type; /* If UPF_FIXED_TYPE */ +--- a/include/linux/serial_core.h ++++ b/include/linux/serial_core.h +@@ -285,6 +285,7 @@ struct uart_port { + #define UPIO_TSI (5) /* Tsi108/109 type IO */ + #define UPIO_DWAPB (6) /* DesignWare APB UART */ + #define UPIO_RM9000 (7) /* RM9000 type IO */ ++#define UPIO_MEM_DELAY (8) + + unsigned int read_status_mask; /* driver specific */ + unsigned int ignore_status_mask; /* driver specific */ +@@ -327,6 +328,7 @@ struct uart_port { + + unsigned int mctrl; /* current modem ctrl settings */ + unsigned int timeout; /* character-based timeout */ ++ unsigned int rw_delay; /* udelay for slow busses, IXP4XX Expansion Bus */ + unsigned int type; /* port type */ + const struct uart_ops *ops; + unsigned int custom_divisor; +--- a/drivers/serial/8250.c ++++ b/drivers/serial/8250.c +@@ -406,6 +406,20 @@ static void mem_serial_out(struct uart_p + writeb(value, p->membase + offset); + } + ++static unsigned int memdelay_serial_in(struct uart_port *p, int offset) ++{ ++ struct uart_8250_port *up = (struct uart_8250_port *)p; ++ udelay(up->port.rw_delay); ++ return mem_serial_in(p, offset); ++} ++ ++static void memdelay_serial_out(struct uart_port *p, int offset, int value) ++{ ++ struct uart_8250_port *up = (struct uart_8250_port *)p; ++ udelay(up->port.rw_delay); ++ mem_serial_out(p, offset, value); ++} ++ + static void mem32_serial_out(struct uart_port *p, int offset, int value) + { + offset = map_8250_out_reg(p, offset) << p->regshift; +@@ -499,6 +513,11 @@ static void set_io_from_upio(struct uart + p->serial_out = mem32_serial_out; + break; + ++ case UPIO_MEM_DELAY: ++ p->serial_in = memdelay_serial_in; ++ p->serial_out = memdelay_serial_out; ++ break; ++ + #ifdef CONFIG_SERIAL_8250_AU1X00 + case UPIO_AU: + p->serial_in = au_serial_in; +@@ -531,6 +550,7 @@ serial_out_sync(struct uart_8250_port *u + switch (p->iotype) { + case UPIO_MEM: + case UPIO_MEM32: ++ case UPIO_MEM_DELAY: + #ifdef CONFIG_SERIAL_8250_AU1X00 + case UPIO_AU: + #endif +@@ -2451,6 +2471,7 @@ static int serial8250_request_std_resour + case UPIO_MEM32: + case UPIO_MEM: + case UPIO_DWAPB: ++ case UPIO_MEM_DELAY: + if (!up->port.mapbase) + break; + +@@ -2488,6 +2509,7 @@ static void serial8250_release_std_resou + case UPIO_MEM32: + case UPIO_MEM: + case UPIO_DWAPB: ++ case UPIO_MEM_DELAY: + if (!up->port.mapbase) + break; + +@@ -2960,6 +2982,7 @@ static int __devinit serial8250_probe(st + port.serial_in = p->serial_in; + port.serial_out = p->serial_out; + port.dev = &dev->dev; ++ port.rw_delay = p->rw_delay; + if (share_irqs) + port.irqflags |= IRQF_SHARED; + ret = serial8250_register_port(&port); +@@ -3110,6 +3133,7 @@ int serial8250_register_port(struct uart + uart->port.iotype = port->iotype; + uart->port.flags = port->flags | UPF_BOOT_AUTOCONF; + uart->port.mapbase = port->mapbase; ++ uart->port.rw_delay = port->rw_delay; + uart->port.private_data = port->private_data; + if (port->dev) + uart->port.dev = port->dev; +--- a/drivers/serial/serial_core.c ++++ b/drivers/serial/serial_core.c +@@ -2161,6 +2161,7 @@ uart_report_port(struct uart_driver *drv + snprintf(address, sizeof(address), + "I/O 0x%lx offset 0x%x", port->iobase, port->hub6); + break; ++ case UPIO_MEM_DELAY: + case UPIO_MEM: + case UPIO_MEM32: + case UPIO_AU: +@@ -2573,6 +2574,7 @@ int uart_match_port(struct uart_port *po + case UPIO_HUB6: + return (port1->iobase == port2->iobase) && + (port1->hub6 == port2->hub6); ++ case UPIO_MEM_DELAY: + case UPIO_MEM: + case UPIO_MEM32: + case UPIO_AU: diff --git a/target/linux/ixp4xx/patches-2.6.32/192-cambria_gpio_device.patch b/target/linux/ixp4xx/patches-2.6.32/192-cambria_gpio_device.patch new file mode 100644 index 000000000..d785c3a8c --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/192-cambria_gpio_device.patch @@ -0,0 +1,46 @@ +--- a/arch/arm/mach-ixp4xx/cambria-setup.c ++++ b/arch/arm/mach-ixp4xx/cambria-setup.c +@@ -214,6 +214,20 @@ static struct platform_device cambria_gp + .dev.platform_data = &cambria_gpio_leds_data, + }; + ++static struct resource cambria_gpio_resources[] = { ++ { ++ .name = "gpio", ++ .flags = 0, ++ }, ++}; ++ ++static struct platform_device cambria_gpio = { ++ .name = "GPIODEV", ++ .id = -1, ++ .num_resources = ARRAY_SIZE(cambria_gpio_resources), ++ .resource = cambria_gpio_resources, ++}; ++ + static struct latch_led cambria_latch_leds[] = { + { + .name = "ledA", /* green led */ +@@ -335,6 +349,11 @@ static void __init cambria_gw2350_setup( + cambria_optional_uart_data[1].membase = (void __iomem *)ioremap(0x53FF0000, 0x0fff); + cambria_optional_uart_data[1].irq = IRQ_IXP4XX_GPIO4; + ++ cambria_gpio_resources[0].start = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) |\ ++ (1 << 5) | (1 << 8) | (1 << 9) | (1 << 12); ++ cambria_gpio_resources[0].end = cambria_gpio_resources[0].start; ++ ++ platform_device_register(&cambria_gpio); + platform_device_register(&cambria_optional_uart); + platform_device_register(&cambria_npec_device); + platform_device_register(&cambria_npea_device); +@@ -358,6 +377,10 @@ static void __init cambria_gw2358_setup( + cambria_optional_uart_data[1].membase = (void __iomem *)ioremap(0x53F80000, 0x0fff); + cambria_optional_uart_data[1].irq = IRQ_IXP4XX_GPIO4; + ++ cambria_gpio_resources[0].start = (1 << 14); ++ cambria_gpio_resources[0].end = cambria_gpio_resources[0].start; ++ ++ platform_device_register(&cambria_gpio); + platform_device_register(&cambria_optional_uart); + + platform_device_register(&cambria_npec_device); diff --git a/target/linux/ixp4xx/patches-2.6.32/193-cambria_pld_gpio.patch b/target/linux/ixp4xx/patches-2.6.32/193-cambria_pld_gpio.patch new file mode 100644 index 000000000..299630f17 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/193-cambria_pld_gpio.patch @@ -0,0 +1,107 @@ +--- a/arch/arm/mach-ixp4xx/cambria-setup.c ++++ b/arch/arm/mach-ixp4xx/cambria-setup.c +@@ -12,11 +12,14 @@ + */ + + #include ++#include + #include + #include + #include ++#include + #include + #include ++#include + #include + #include + #include +@@ -323,6 +326,39 @@ static struct platform_device cambria_us + }, + }; + ++static struct gw_i2c_pld_platform_data gw_i2c_pld_data0 = { ++ .gpio_base = 16, ++ .nr_gpio = 8, ++}; ++ ++static struct gw_i2c_pld_platform_data gw_i2c_pld_data1 = { ++ .gpio_base = 24, ++ .nr_gpio = 2, ++}; ++ ++ ++static struct gpio_button cambria_gpio_buttons[] = { ++ { ++ .desc = "user", ++ .type = EV_KEY, ++ .code = BTN_0, ++ .threshold = 2, ++ .gpio = 25, ++ } ++}; ++ ++static struct gpio_buttons_platform_data cambria_gpio_buttons_data = { ++ .poll_interval = 500, ++ .nbuttons = 1, ++ .buttons = cambria_gpio_buttons, ++}; ++ ++static struct platform_device cambria_gpio_buttons_device = { ++ .name = "gpio-buttons", ++ .id = -1, ++ .dev.platform_data = &cambria_gpio_buttons_data, ++}; ++ + static struct platform_device *cambria_devices[] __initdata = { + &cambria_i2c_gpio, + &cambria_flash, +@@ -331,6 +367,11 @@ static struct platform_device *cambria_d + + static void __init cambria_gw23xx_setup(void) + { ++ cambria_gpio_resources[0].start = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) |\ ++ (1 << 5) | (1 << 8) | (1 << 9) | (1 << 12); ++ cambria_gpio_resources[0].end = cambria_gpio_resources[0].start; ++ ++ platform_device_register(&cambria_gpio); + platform_device_register(&cambria_npec_device); + platform_device_register(&cambria_npea_device); + } +@@ -377,7 +418,8 @@ static void __init cambria_gw2358_setup( + cambria_optional_uart_data[1].membase = (void __iomem *)ioremap(0x53F80000, 0x0fff); + cambria_optional_uart_data[1].irq = IRQ_IXP4XX_GPIO4; + +- cambria_gpio_resources[0].start = (1 << 14); ++ cambria_gpio_resources[0].start = (1 << 14) | (1 << 16) | (1 << 17) | (1 << 18) |\ ++ (1 << 19) | (1 << 20) | (1 << 24) | (1 << 25); + cambria_gpio_resources[0].end = cambria_gpio_resources[0].start; + + platform_device_register(&cambria_gpio); +@@ -391,7 +433,12 @@ static void __init cambria_gw2358_setup( + + platform_device_register(&cambria_pata); + ++ cambria_gpio_leds[0].gpio = 24; ++ platform_device_register(&cambria_gpio_leds_device); ++ + platform_device_register(&cambria_latch_leds_device); ++ ++ platform_device_register(&cambria_gpio_buttons_device); + } + + static struct cambria_board_info cambria_boards[] __initdata = { +@@ -460,6 +507,14 @@ static struct i2c_board_info __initdata + I2C_BOARD_INFO("24c08", 0x51), + .platform_data = &cambria_eeprom_info + }, ++ { ++ I2C_BOARD_INFO("gw_i2c_pld", 0x56), ++ .platform_data = &gw_i2c_pld_data0, ++ }, ++ { ++ I2C_BOARD_INFO("gw_i2c_pld", 0x57), ++ .platform_data = &gw_i2c_pld_data1, ++ }, + }; + + static void __init cambria_init(void) diff --git a/target/linux/ixp4xx/patches-2.6.32/201-npe_driver_print_license_location.patch b/target/linux/ixp4xx/patches-2.6.32/201-npe_driver_print_license_location.patch new file mode 100644 index 000000000..b97dd77dc --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/201-npe_driver_print_license_location.patch @@ -0,0 +1,11 @@ +--- a/arch/arm/mach-ixp4xx/ixp4xx_npe.c ++++ b/arch/arm/mach-ixp4xx/ixp4xx_npe.c +@@ -583,6 +583,8 @@ int npe_load_firmware(struct npe *npe, c + npe_reset(npe); + #endif + ++ print_npe(KERN_INFO, npe, "firmware's license can be found in /usr/share/doc/LICENSE.IPL\n"); ++ + print_npe(KERN_INFO, npe, "firmware functionality 0x%X, " + "revision 0x%X:%X\n", (image->id >> 16) & 0xFF, + (image->id >> 8) & 0xFF, image->id & 0xFF); diff --git a/target/linux/ixp4xx/patches-2.6.32/203-npe_driver_mask_phy_features.patch b/target/linux/ixp4xx/patches-2.6.32/203-npe_driver_mask_phy_features.patch new file mode 100644 index 000000000..eacf35d07 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/203-npe_driver_mask_phy_features.patch @@ -0,0 +1,13 @@ +--- a/drivers/net/arm/ixp4xx_eth.c ++++ b/drivers/net/arm/ixp4xx_eth.c +@@ -1217,6 +1217,10 @@ static int __devinit eth_init_one(struct + if ((err = IS_ERR(port->phydev))) + goto err_free_mem; + ++ /* mask with MAC supported features */ ++ port->phydev->supported &= PHY_BASIC_FEATURES; ++ port->phydev->advertising = port->phydev->supported; ++ + port->phydev->irq = PHY_POLL; + + if ((err = register_netdev(dev))) diff --git a/target/linux/ixp4xx/patches-2.6.32/205-npe_driver_separate_phy_functions.patch b/target/linux/ixp4xx/patches-2.6.32/205-npe_driver_separate_phy_functions.patch new file mode 100644 index 000000000..b9835a012 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/205-npe_driver_separate_phy_functions.patch @@ -0,0 +1,119 @@ +--- a/drivers/net/arm/ixp4xx_eth.c ++++ b/drivers/net/arm/ixp4xx_eth.c +@@ -396,6 +396,50 @@ static void ixp4xx_adjust_link(struct ne + dev->name, port->speed, port->duplex ? "full" : "half"); + } + ++static int ixp4xx_phy_connect(struct net_device *dev) ++{ ++ struct port *port = netdev_priv(dev); ++ struct eth_plat_info *plat = port->plat; ++ char phy_id[MII_BUS_ID_SIZE + 3]; ++ ++ snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, "0", plat->phy); ++ port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0, ++ PHY_INTERFACE_MODE_MII); ++ if (IS_ERR(port->phydev)) { ++ printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); ++ return PTR_ERR(port->phydev); ++ } ++ ++ /* mask with MAC supported features */ ++ port->phydev->supported &= PHY_BASIC_FEATURES; ++ port->phydev->advertising = port->phydev->supported; ++ ++ port->phydev->irq = PHY_POLL; ++ ++ return 0; ++} ++ ++static void ixp4xx_phy_disconnect(struct net_device *dev) ++{ ++ struct port *port = netdev_priv(dev); ++ ++ phy_disconnect(port->phydev); ++} ++ ++static void ixp4xx_phy_start(struct net_device *dev) ++{ ++ struct port *port = netdev_priv(dev); ++ ++ port->speed = 0; /* force "link up" message */ ++ phy_start(port->phydev); ++} ++ ++static void ixp4xx_phy_stop(struct net_device *dev) ++{ ++ struct port *port = netdev_priv(dev); ++ ++ phy_stop(port->phydev); ++} + + static inline void debug_pkt(struct net_device *dev, const char *func, + u8 *data, int len) +@@ -1005,8 +1049,7 @@ static int eth_open(struct net_device *d + return err; + } + +- port->speed = 0; /* force "link up" message */ +- phy_start(port->phydev); ++ ixp4xx_phy_start(dev); + + for (i = 0; i < ETH_ALEN; i++) + __raw_writel(dev->dev_addr[i], &port->regs->hw_addr[i]); +@@ -1127,7 +1170,7 @@ static int eth_close(struct net_device * + printk(KERN_CRIT "%s: unable to disable loopback\n", + dev->name); + +- phy_stop(port->phydev); ++ ixp4xx_phy_stop(dev); + + if (!ports_open) + qmgr_disable_irq(TXDONE_QUEUE); +@@ -1153,7 +1196,6 @@ static int __devinit eth_init_one(struct + struct net_device *dev; + struct eth_plat_info *plat = pdev->dev.platform_data; + u32 regs_phys; +- char phy_id[MII_BUS_ID_SIZE + 3]; + int err; + + if (!(dev = alloc_etherdev(sizeof(struct port)))) +@@ -1211,18 +1253,10 @@ static int __devinit eth_init_one(struct + __raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control); + udelay(50); + +- snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, "0", plat->phy); +- port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0, +- PHY_INTERFACE_MODE_MII); +- if ((err = IS_ERR(port->phydev))) ++ err = ixp4xx_phy_connect(dev); ++ if (err) + goto err_free_mem; + +- /* mask with MAC supported features */ +- port->phydev->supported &= PHY_BASIC_FEATURES; +- port->phydev->advertising = port->phydev->supported; +- +- port->phydev->irq = PHY_POLL; +- + if ((err = register_netdev(dev))) + goto err_phy_dis; + +@@ -1232,7 +1266,7 @@ static int __devinit eth_init_one(struct + return 0; + + err_phy_dis: +- phy_disconnect(port->phydev); ++ ixp4xx_phy_disconnect(port->phydev); + err_free_mem: + npe_port_tab[NPE_ID(port->id)] = NULL; + platform_set_drvdata(pdev, NULL); +@@ -1250,7 +1284,7 @@ static int __devexit eth_remove_one(stru + struct port *port = netdev_priv(dev); + + unregister_netdev(dev); +- phy_disconnect(port->phydev); ++ ixp4xx_phy_disconnect(dev); + npe_port_tab[NPE_ID(port->id)] = NULL; + platform_set_drvdata(pdev, NULL); + npe_release(port->npe); diff --git a/target/linux/ixp4xx/patches-2.6.32/206-npe_driver_add_update_link_function.patch b/target/linux/ixp4xx/patches-2.6.32/206-npe_driver_add_update_link_function.patch new file mode 100644 index 000000000..419ec4cdb --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/206-npe_driver_add_update_link_function.patch @@ -0,0 +1,98 @@ +--- a/drivers/net/arm/ixp4xx_eth.c ++++ b/drivers/net/arm/ixp4xx_eth.c +@@ -168,7 +168,7 @@ struct port { + struct desc *desc_tab; /* coherent */ + u32 desc_tab_phys; + int id; /* logical port ID */ +- int speed, duplex; ++ int link, speed, duplex; + u8 firmware[4]; + }; + +@@ -365,37 +365,52 @@ static void ixp4xx_mdio_remove(void) + mdiobus_free(mdio_bus); + } + +- +-static void ixp4xx_adjust_link(struct net_device *dev) ++static void ixp4xx_update_link(struct net_device *dev) + { + struct port *port = netdev_priv(dev); +- struct phy_device *phydev = port->phydev; + +- if (!phydev->link) { +- if (port->speed) { +- port->speed = 0; +- printk(KERN_INFO "%s: link down\n", dev->name); +- } ++ if (!port->link) { ++ netif_carrier_off(dev); ++ printk(KERN_INFO "%s: link down\n", dev->name); + return; + } + +- if (port->speed == phydev->speed && port->duplex == phydev->duplex) +- return; +- +- port->speed = phydev->speed; +- port->duplex = phydev->duplex; +- +- if (port->duplex) ++ if (port->duplex == DUPLEX_FULL) + __raw_writel(DEFAULT_TX_CNTRL0 & ~TX_CNTRL0_HALFDUPLEX, + &port->regs->tx_control[0]); + else + __raw_writel(DEFAULT_TX_CNTRL0 | TX_CNTRL0_HALFDUPLEX, + &port->regs->tx_control[0]); + ++ netif_carrier_on(dev); + printk(KERN_INFO "%s: link up, speed %u Mb/s, %s duplex\n", + dev->name, port->speed, port->duplex ? "full" : "half"); + } + ++static void ixp4xx_adjust_link(struct net_device *dev) ++{ ++ struct port *port = netdev_priv(dev); ++ struct phy_device *phydev = port->phydev; ++ int status_change = 0; ++ ++ if (phydev->link) { ++ if (port->duplex != phydev->duplex ++ || port->speed != phydev->speed) { ++ status_change = 1; ++ } ++ } ++ ++ if (phydev->link != port->link) ++ status_change = 1; ++ ++ port->link = phydev->link; ++ port->speed = phydev->speed; ++ port->duplex = phydev->duplex; ++ ++ if (status_change) ++ ixp4xx_update_link(dev); ++} ++ + static int ixp4xx_phy_connect(struct net_device *dev) + { + struct port *port = netdev_priv(dev); +@@ -430,7 +445,6 @@ static void ixp4xx_phy_start(struct net_ + { + struct port *port = netdev_priv(dev); + +- port->speed = 0; /* force "link up" message */ + phy_start(port->phydev); + } + +@@ -1260,6 +1274,10 @@ static int __devinit eth_init_one(struct + if ((err = register_netdev(dev))) + goto err_phy_dis; + ++ port->link = 0; ++ port->speed = 0; ++ port->duplex = -1; ++ + printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy, + npe_name(port->npe)); + diff --git a/target/linux/ixp4xx/patches-2.6.32/207-npe_driver_multiphy_support.patch b/target/linux/ixp4xx/patches-2.6.32/207-npe_driver_multiphy_support.patch new file mode 100644 index 000000000..afcf7e156 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/207-npe_driver_multiphy_support.patch @@ -0,0 +1,155 @@ +TODO: take care of additional PHYs through the PHY abstraction layer + +--- a/arch/arm/mach-ixp4xx/include/mach/platform.h ++++ b/arch/arm/mach-ixp4xx/include/mach/platform.h +@@ -72,7 +72,7 @@ extern unsigned long ixp4xx_exp_bus_size + /* + * Clock Speed Definitions. + */ +-#define IXP4XX_PERIPHERAL_BUS_CLOCK (66) /* 66Mhzi APB BUS */ ++#define IXP4XX_PERIPHERAL_BUS_CLOCK (66) /* 66Mhzi APB BUS */ + #define IXP4XX_UART_XTAL 14745600 + + /* +@@ -95,12 +95,23 @@ struct sys_timer; + #define IXP4XX_ETH_NPEB 0x10 + #define IXP4XX_ETH_NPEC 0x20 + ++#define IXP4XX_ETH_PHY_MAX_ADDR 32 ++ + /* Information about built-in Ethernet MAC interfaces */ + struct eth_plat_info { + u8 phy; /* MII PHY ID, 0 - 31 */ + u8 rxq; /* configurable, currently 0 - 31 only */ + u8 txreadyq; + u8 hwaddr[6]; ++ ++ u32 phy_mask; ++#if 0 ++ int speed; ++ int duplex; ++#else ++ int speed_10; ++ int half_duplex; ++#endif + }; + + /* Information about built-in HSS (synchronous serial) interfaces */ +--- a/drivers/net/arm/ixp4xx_eth.c ++++ b/drivers/net/arm/ixp4xx_eth.c +@@ -417,6 +417,37 @@ static int ixp4xx_phy_connect(struct net + struct eth_plat_info *plat = port->plat; + char phy_id[MII_BUS_ID_SIZE + 3]; + ++ if (plat->phy == IXP4XX_ETH_PHY_MAX_ADDR) { ++#if 0 ++ switch (plat->speed) { ++ case SPEED_10: ++ case SPEED_100: ++ break; ++ default: ++ printk(KERN_ERR "%s: invalid speed (%d)\n", ++ dev->name, plat->speed); ++ return -EINVAL; ++ } ++ ++ switch (plat->duplex) { ++ case DUPLEX_HALF: ++ case DUPLEX_FULL: ++ break; ++ default: ++ printk(KERN_ERR "%s: invalid duplex mode (%d)\n", ++ dev->name, plat->duplex); ++ return -EINVAL; ++ } ++ port->speed = plat->speed; ++ port->duplex = plat->duplex; ++#else ++ port->speed = plat->speed_10 ? SPEED_10 : SPEED_100; ++ port->duplex = plat->half_duplex ? DUPLEX_HALF : DUPLEX_FULL; ++#endif ++ ++ return 0; ++ } ++ + snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, "0", plat->phy); + port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0, + PHY_INTERFACE_MODE_MII); +@@ -438,21 +469,32 @@ static void ixp4xx_phy_disconnect(struct + { + struct port *port = netdev_priv(dev); + +- phy_disconnect(port->phydev); ++ if (port->phydev) ++ phy_disconnect(port->phydev); + } + + static void ixp4xx_phy_start(struct net_device *dev) + { + struct port *port = netdev_priv(dev); + +- phy_start(port->phydev); ++ if (port->phydev) { ++ phy_start(port->phydev); ++ } else { ++ port->link = 1; ++ ixp4xx_update_link(dev); ++ } + } + + static void ixp4xx_phy_stop(struct net_device *dev) + { + struct port *port = netdev_priv(dev); + +- phy_stop(port->phydev); ++ if (port->phydev) { ++ phy_stop(port->phydev); ++ } else { ++ port->link = 0; ++ ixp4xx_update_link(dev); ++ } + } + + static inline void debug_pkt(struct net_device *dev, const char *func, +@@ -826,6 +868,10 @@ static int eth_ioctl(struct net_device * + + if (!netif_running(dev)) + return -EINVAL; ++ ++ if (!port->phydev) ++ return -EOPNOTSUPP; ++ + return phy_mii_ioctl(port->phydev, if_mii(req), cmd); + } + +@@ -845,18 +891,30 @@ static void ixp4xx_get_drvinfo(struct ne + static int ixp4xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) + { + struct port *port = netdev_priv(dev); ++ ++ if (!port->phydev) ++ return -EOPNOTSUPP; ++ + return phy_ethtool_gset(port->phydev, cmd); + } + + static int ixp4xx_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) + { + struct port *port = netdev_priv(dev); ++ ++ if (!port->phydev) ++ return -EOPNOTSUPP; ++ + return phy_ethtool_sset(port->phydev, cmd); + } + + static int ixp4xx_nway_reset(struct net_device *dev) + { + struct port *port = netdev_priv(dev); ++ ++ if (!port->phydev) ++ return -EOPNOTSUPP; ++ + return phy_start_aneg(port->phydev); + } + diff --git a/target/linux/ixp4xx/patches-2.6.32/295-latch_led_driver.patch b/target/linux/ixp4xx/patches-2.6.32/295-latch_led_driver.patch new file mode 100644 index 000000000..853636d31 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/295-latch_led_driver.patch @@ -0,0 +1,200 @@ +--- a/drivers/leds/Kconfig ++++ b/drivers/leds/Kconfig +@@ -157,6 +157,13 @@ config LEDS_LP3944 + To compile this driver as a module, choose M here: the + module will be called leds-lp3944. + ++config LEDS_LATCH ++ tristate "LED Support for Memory Latched LEDs" ++ depends on LEDS_CLASS ++ help ++ -- To Do -- ++ ++ + config LEDS_CLEVO_MAIL + tristate "Mail LED on Clevo notebook" + depends on LEDS_CLASS && X86 && SERIO_I8042 && DMI +--- /dev/null ++++ b/drivers/leds/leds-latch.c +@@ -0,0 +1,149 @@ ++/* ++ * LEDs driver for Memory Latched Devices ++ * ++ * Copyright (C) 2008 Gateworks Corp. ++ * Chris Lang ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static unsigned int mem_keep = 0xFF; ++static spinlock_t mem_lock; ++static unsigned char *iobase; ++ ++struct latch_led_data { ++ struct led_classdev cdev; ++ struct work_struct work; ++ u8 new_level; ++ u8 bit; ++ void (*set_led)(u8 bit, enum led_brightness value); ++}; ++ ++static void latch_set_led(u8 bit, enum led_brightness value) ++{ ++ if (value == LED_OFF) ++ mem_keep |= (0x1 << bit); ++ else ++ mem_keep &= ~(0x1 << bit); ++ ++ writeb(mem_keep, iobase); ++} ++ ++static void latch_led_set(struct led_classdev *led_cdev, ++ enum led_brightness value) ++{ ++ struct latch_led_data *led_dat = ++ container_of(led_cdev, struct latch_led_data, cdev); ++ ++ spin_lock(mem_lock); ++ ++ led_dat->set_led(led_dat->bit, value); ++ ++ spin_unlock(mem_lock); ++} ++ ++static int latch_led_probe(struct platform_device *pdev) ++{ ++ struct latch_led_platform_data *pdata = pdev->dev.platform_data; ++ struct latch_led *cur_led; ++ struct latch_led_data *leds_data, *led_dat; ++ int i, ret = 0; ++ ++ if (!pdata) ++ return -EBUSY; ++ ++ leds_data = kzalloc(sizeof(struct latch_led_data) * pdata->num_leds, ++ GFP_KERNEL); ++ if (!leds_data) ++ return -ENOMEM; ++ ++ for (i = 0; i < pdata->num_leds; i++) { ++ cur_led = &pdata->leds[i]; ++ led_dat = &leds_data[i]; ++ ++ led_dat->cdev.name = cur_led->name; ++ led_dat->cdev.default_trigger = cur_led->default_trigger; ++ led_dat->cdev.brightness_set = latch_led_set; ++ led_dat->cdev.brightness = LED_OFF; ++ led_dat->bit = cur_led->bit; ++ led_dat->set_led = pdata->set_led ? pdata->set_led : latch_set_led; ++ ++ ret = led_classdev_register(&pdev->dev, &led_dat->cdev); ++ if (ret < 0) { ++ goto err; ++ } ++ } ++ ++ if (!pdata->set_led) { ++ iobase = ioremap_nocache(pdata->mem, 0x1000); ++ writeb(0xFF, iobase); ++ } ++ platform_set_drvdata(pdev, leds_data); ++ ++ return 0; ++ ++err: ++ if (i > 0) { ++ for (i = i - 1; i >= 0; i--) { ++ led_classdev_unregister(&leds_data[i].cdev); ++ } ++ } ++ ++ kfree(leds_data); ++ ++ return ret; ++} ++ ++static int __devexit latch_led_remove(struct platform_device *pdev) ++{ ++ int i; ++ struct latch_led_platform_data *pdata = pdev->dev.platform_data; ++ struct latch_led_data *leds_data; ++ ++ leds_data = platform_get_drvdata(pdev); ++ ++ for (i = 0; i < pdata->num_leds; i++) { ++ led_classdev_unregister(&leds_data[i].cdev); ++ cancel_work_sync(&leds_data[i].work); ++ } ++ ++ kfree(leds_data); ++ ++ return 0; ++} ++ ++static struct platform_driver latch_led_driver = { ++ .probe = latch_led_probe, ++ .remove = __devexit_p(latch_led_remove), ++ .driver = { ++ .name = "leds-latch", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static int __init latch_led_init(void) ++{ ++ return platform_driver_register(&latch_led_driver); ++} ++ ++static void __exit latch_led_exit(void) ++{ ++ platform_driver_unregister(&latch_led_driver); ++} ++ ++module_init(latch_led_init); ++module_exit(latch_led_exit); ++ ++MODULE_AUTHOR("Chris Lang "); ++MODULE_DESCRIPTION("Latch LED driver"); ++MODULE_LICENSE("GPL"); +--- a/drivers/leds/Makefile ++++ b/drivers/leds/Makefile +@@ -20,6 +20,7 @@ obj-$(CONFIG_LEDS_COBALT_RAQ) += leds-c + obj-$(CONFIG_LEDS_SUNFIRE) += leds-sunfire.o + obj-$(CONFIG_LEDS_PCA9532) += leds-pca9532.o + obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o ++obj-$(CONFIG_LEDS_LATCH) += leds-latch.o + obj-$(CONFIG_LEDS_LP3944) += leds-lp3944.o + obj-$(CONFIG_LEDS_CLEVO_MAIL) += leds-clevo-mail.o + obj-$(CONFIG_LEDS_HP6XX) += leds-hp6xx.o +--- a/include/linux/leds.h ++++ b/include/linux/leds.h +@@ -161,5 +161,19 @@ struct gpio_led_platform_data { + unsigned long *delay_off); + }; + ++/* For the leds-latch driver */ ++struct latch_led { ++ const char *name; ++ char *default_trigger; ++ unsigned bit; ++}; ++ ++struct latch_led_platform_data { ++ int num_leds; ++ u32 mem; ++ struct latch_led *leds; ++ void (*set_led)(u8 bit, enum led_brightness value); ++}; ++ + + #endif /* __LINUX_LEDS_H_INCLUDED */ diff --git a/target/linux/ixp4xx/patches-2.6.32/300-avila_fetch_mac.patch b/target/linux/ixp4xx/patches-2.6.32/300-avila_fetch_mac.patch new file mode 100644 index 000000000..ca8cae12c --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/300-avila_fetch_mac.patch @@ -0,0 +1,244 @@ +--- a/arch/arm/mach-ixp4xx/avila-setup.c ++++ b/arch/arm/mach-ixp4xx/avila-setup.c +@@ -14,10 +14,16 @@ + #include + #include + #include ++#include ++#include ++#include + #include + #include + #include + #include ++#include ++#include ++ + #include + + #include +@@ -29,6 +35,13 @@ + #include + #include + ++struct avila_board_info { ++ unsigned char *model; ++ void (*setup)(void); ++}; ++ ++static struct avila_board_info *avila_info __initdata; ++ + static struct flash_platform_data avila_flash_data = { + .map_name = "cfi_probe", + .width = 2, +@@ -132,16 +145,181 @@ static struct platform_device avila_pata + .resource = avila_pata_resources, + }; + ++/* Built-in 10/100 Ethernet MAC interfaces */ ++static struct eth_plat_info avila_npeb_data = { ++ .phy = 0, ++ .rxq = 3, ++ .txreadyq = 20, ++}; ++ ++static struct eth_plat_info avila_npec_data = { ++ .phy = 1, ++ .rxq = 4, ++ .txreadyq = 21, ++}; ++ ++static struct platform_device avila_npeb_device = { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEB, ++ .dev.platform_data = &avila_npeb_data, ++}; ++ ++static struct platform_device avila_npec_device = { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEC, ++ .dev.platform_data = &avila_npec_data, ++}; ++ + static struct platform_device *avila_devices[] __initdata = { + &avila_i2c_gpio, + &avila_flash, + &avila_uart + }; + ++static void __init avila_gw23xx_setup(void) ++{ ++ platform_device_register(&avila_npeb_device); ++ platform_device_register(&avila_npec_device); ++} ++ ++static void __init avila_gw2342_setup(void) ++{ ++ platform_device_register(&avila_npeb_device); ++ platform_device_register(&avila_npec_device); ++} ++ ++static void __init avila_gw2345_setup(void) ++{ ++ avila_npeb_data.phy = IXP4XX_ETH_PHY_MAX_ADDR; ++ avila_npeb_data.phy_mask = 0x1e; /* ports 1-4 of the KS8995 switch */ ++ platform_device_register(&avila_npeb_device); ++ ++ avila_npec_data.phy = 5; /* port 5 of the KS8995 switch */ ++ platform_device_register(&avila_npec_device); ++} ++ ++static void __init avila_gw2347_setup(void) ++{ ++ platform_device_register(&avila_npeb_device); ++} ++ ++static void __init avila_gw2348_setup(void) ++{ ++ platform_device_register(&avila_npeb_device); ++ platform_device_register(&avila_npec_device); ++} ++ ++static void __init avila_gw2353_setup(void) ++{ ++ platform_device_register(&avila_npeb_device); ++} ++ ++static void __init avila_gw2355_setup(void) ++{ ++ avila_npeb_data.phy = IXP4XX_ETH_PHY_MAX_ADDR; ++ avila_npeb_data.phy_mask = 0x1e; /* ports 1-4 of the KS8995 switch */ ++ platform_device_register(&avila_npeb_device); ++ ++ avila_npec_data.phy = 16; ++ platform_device_register(&avila_npec_device); ++} ++ ++static void __init avila_gw2357_setup(void) ++{ ++ platform_device_register(&avila_npeb_device); ++} ++ ++static struct avila_board_info avila_boards[] __initdata = { ++ { ++ .model = "GW2342", ++ .setup = avila_gw2342_setup, ++ }, { ++ .model = "GW2345", ++ .setup = avila_gw2345_setup, ++ }, { ++ .model = "GW2347", ++ .setup = avila_gw2347_setup, ++ }, { ++ .model = "GW2348", ++ .setup = avila_gw2348_setup, ++ }, { ++ .model = "GW2353", ++ .setup = avila_gw2353_setup, ++ }, { ++ .model = "GW2355", ++ .setup = avila_gw2355_setup, ++ }, { ++ .model = "GW2357", ++ .setup = avila_gw2357_setup, ++ } ++}; ++ ++static struct avila_board_info * __init avila_find_board_info(char *model) ++{ ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(avila_boards); i++) { ++ struct avila_board_info *info = &avila_boards[i]; ++ if (strcmp(info->model, model) == 0) ++ return info; ++ } ++ ++ return NULL; ++} ++ ++static struct memory_accessor *at24_mem_acc; ++ ++static int at24_setup(struct memory_accessor *mem_acc, void *context) ++{ ++ char mac_addr[ETH_ALEN]; ++ char model[6]; ++ ++ at24_mem_acc = mem_acc; ++ ++ /* Read MAC addresses */ ++ if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x0, 6) == 6) { ++ memcpy(&avila_npeb_data.hwaddr, mac_addr, ETH_ALEN); ++ } ++ if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x6, 6) == 6) { ++ memcpy(&avila_npec_data.hwaddr, mac_addr, ETH_ALEN); ++ } ++ ++ /* Read the first 6 bytes of the model number */ ++ if (at24_mem_acc->read(at24_mem_acc, model, 0x20, 6) == 6) { ++ avila_info = avila_find_board_info(model); ++ } ++ ++ return 0; ++} ++ ++static struct at24_platform_data avila_eeprom_info = { ++ .byte_len = 1024, ++ .page_size = 16, ++ .flags = AT24_FLAG_READONLY, ++ .setup = at24_setup, ++}; ++ ++static struct i2c_board_info __initdata avila_i2c_board_info[] = { ++ { ++ I2C_BOARD_INFO("ds1672", 0x68), ++ }, ++ { ++ I2C_BOARD_INFO("ad7418", 0x28), ++ }, ++ { ++ I2C_BOARD_INFO("24c08", 0x51), ++ .platform_data = &avila_eeprom_info ++ }, ++}; ++ + static void __init avila_init(void) + { + ixp4xx_sys_init(); + ++ /* ++ * These devices are present on all Avila models and don't need any ++ * model specific setup. ++ */ + avila_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); + avila_flash_resource.end = + IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; +@@ -159,7 +337,28 @@ static void __init avila_init(void) + + platform_device_register(&avila_pata); + ++ i2c_register_board_info(0, avila_i2c_board_info, ++ ARRAY_SIZE(avila_i2c_board_info)); ++} ++ ++static int __init avila_model_setup(void) ++{ ++ if (!machine_is_avila()) ++ return 0; ++ ++ if (avila_info) { ++ printk(KERN_DEBUG "Running on Gateworks Avila %s\n", ++ avila_info->model); ++ avila_info->setup(); ++ } else { ++ printk(KERN_INFO "Unknown/missing Avila model number" ++ " -- defaults will be used\n"); ++ avila_gw23xx_setup(); ++ } ++ ++ return 0; + } ++late_initcall(avila_model_setup); + + MACHINE_START(AVILA, "Gateworks Avila Network Platform") + /* Maintainer: Deepak Saxena */ diff --git a/target/linux/ixp4xx/patches-2.6.32/301-avila_led.patch b/target/linux/ixp4xx/patches-2.6.32/301-avila_led.patch new file mode 100644 index 000000000..2bd0e1609 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/301-avila_led.patch @@ -0,0 +1,171 @@ +--- a/arch/arm/mach-ixp4xx/avila-setup.c ++++ b/arch/arm/mach-ixp4xx/avila-setup.c +@@ -24,6 +24,7 @@ + #include + #include + ++#include + #include + + #include +@@ -170,6 +171,72 @@ static struct platform_device avila_npec + .dev.platform_data = &avila_npec_data, + }; + ++static struct gpio_led avila_gpio_leds[] = { ++ { ++ .name = "user", /* green led */ ++ .gpio = AVILA_GW23XX_LED_USER_GPIO, ++ .active_low = 1, ++ } ++}; ++ ++static struct gpio_led_platform_data avila_gpio_leds_data = { ++ .num_leds = 1, ++ .leds = avila_gpio_leds, ++}; ++ ++static struct platform_device avila_gpio_leds_device = { ++ .name = "leds-gpio", ++ .id = -1, ++ .dev.platform_data = &avila_gpio_leds_data, ++}; ++ ++static struct latch_led avila_latch_leds[] = { ++ { ++ .name = "led0", /* green led */ ++ .bit = 0, ++ }, ++ { ++ .name = "led1", /* green led */ ++ .bit = 1, ++ }, ++ { ++ .name = "led2", /* green led */ ++ .bit = 2, ++ }, ++ { ++ .name = "led3", /* green led */ ++ .bit = 3, ++ }, ++ { ++ .name = "led4", /* green led */ ++ .bit = 4, ++ }, ++ { ++ .name = "led5", /* green led */ ++ .bit = 5, ++ }, ++ { ++ .name = "led6", /* green led */ ++ .bit = 6, ++ }, ++ { ++ .name = "led7", /* green led */ ++ .bit = 7, ++ } ++}; ++ ++static struct latch_led_platform_data avila_latch_leds_data = { ++ .num_leds = 8, ++ .leds = avila_latch_leds, ++ .mem = 0x51000000, ++}; ++ ++static struct platform_device avila_latch_leds_device = { ++ .name = "leds-latch", ++ .id = -1, ++ .dev.platform_data = &avila_latch_leds_data, ++}; ++ + static struct platform_device *avila_devices[] __initdata = { + &avila_i2c_gpio, + &avila_flash, +@@ -180,12 +247,16 @@ static void __init avila_gw23xx_setup(vo + { + platform_device_register(&avila_npeb_device); + platform_device_register(&avila_npec_device); ++ ++ platform_device_register(&avila_gpio_leds_device); + } + + static void __init avila_gw2342_setup(void) + { + platform_device_register(&avila_npeb_device); + platform_device_register(&avila_npec_device); ++ ++ platform_device_register(&avila_gpio_leds_device); + } + + static void __init avila_gw2345_setup(void) +@@ -196,22 +267,30 @@ static void __init avila_gw2345_setup(vo + + avila_npec_data.phy = 5; /* port 5 of the KS8995 switch */ + platform_device_register(&avila_npec_device); ++ ++ platform_device_register(&avila_gpio_leds_device); + } + + static void __init avila_gw2347_setup(void) + { + platform_device_register(&avila_npeb_device); ++ ++ avila_gpio_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO; ++ platform_device_register(&avila_gpio_leds_device); + } + + static void __init avila_gw2348_setup(void) + { + platform_device_register(&avila_npeb_device); + platform_device_register(&avila_npec_device); ++ ++ platform_device_register(&avila_gpio_leds_device); + } + + static void __init avila_gw2353_setup(void) + { + platform_device_register(&avila_npeb_device); ++ platform_device_register(&avila_gpio_leds_device); + } + + static void __init avila_gw2355_setup(void) +@@ -222,11 +301,29 @@ static void __init avila_gw2355_setup(vo + + avila_npec_data.phy = 16; + platform_device_register(&avila_npec_device); ++ ++ platform_device_register(&avila_gpio_leds_device); ++ ++ *IXP4XX_EXP_CS4 |= 0xbfff3c03; ++ avila_latch_leds[0].name = "RXD"; ++ avila_latch_leds[1].name = "TXD"; ++ avila_latch_leds[2].name = "POL"; ++ avila_latch_leds[3].name = "LNK"; ++ avila_latch_leds[4].name = "ERR"; ++ avila_latch_leds_data.num_leds = 5; ++ avila_latch_leds_data.mem = 0x54000000; ++ platform_device_register(&avila_latch_leds_device); + } + + static void __init avila_gw2357_setup(void) + { + platform_device_register(&avila_npeb_device); ++ ++ avila_gpio_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO; ++ platform_device_register(&avila_gpio_leds_device); ++ ++ *IXP4XX_EXP_CS1 |= 0xbfff3c03; ++ platform_device_register(&avila_latch_leds_device); + } + + static struct avila_board_info avila_boards[] __initdata = { +--- a/arch/arm/mach-ixp4xx/include/mach/avila.h ++++ b/arch/arm/mach-ixp4xx/include/mach/avila.h +@@ -36,4 +36,6 @@ + #define AVILA_PCI_INTC_PIN 9 + #define AVILA_PCI_INTD_PIN 8 + +- ++/* User LEDs */ ++#define AVILA_GW23XX_LED_USER_GPIO 3 ++#define AVILA_GW23X7_LED_USER_GPIO 4 diff --git a/target/linux/ixp4xx/patches-2.6.32/302-avila_gpio_device.patch b/target/linux/ixp4xx/patches-2.6.32/302-avila_gpio_device.patch new file mode 100644 index 000000000..3b75a59f7 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/302-avila_gpio_device.patch @@ -0,0 +1,41 @@ +--- a/arch/arm/mach-ixp4xx/avila-setup.c ++++ b/arch/arm/mach-ixp4xx/avila-setup.c +@@ -237,10 +237,28 @@ static struct platform_device avila_latc + .dev.platform_data = &avila_latch_leds_data, + }; + ++static struct resource avila_gpio_resources[] = { ++ { ++ .name = "gpio", ++ /* FIXME: gpio mask should be model specific */ ++ .start = AVILA_GPIO_MASK, ++ .end = AVILA_GPIO_MASK, ++ .flags = 0, ++ }, ++}; ++ ++static struct platform_device avila_gpio = { ++ .name = "GPIODEV", ++ .id = -1, ++ .num_resources = ARRAY_SIZE(avila_gpio_resources), ++ .resource = avila_gpio_resources, ++}; ++ + static struct platform_device *avila_devices[] __initdata = { + &avila_i2c_gpio, + &avila_flash, +- &avila_uart ++ &avila_uart, ++ &avila_gpio, + }; + + static void __init avila_gw23xx_setup(void) +--- a/arch/arm/mach-ixp4xx/include/mach/avila.h ++++ b/arch/arm/mach-ixp4xx/include/mach/avila.h +@@ -39,3 +39,6 @@ + /* User LEDs */ + #define AVILA_GW23XX_LED_USER_GPIO 3 + #define AVILA_GW23X7_LED_USER_GPIO 4 ++ ++/* gpio mask used by platform device */ ++#define AVILA_GPIO_MASK (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9) diff --git a/target/linux/ixp4xx/patches-2.6.32/304-ixp4xx_eth_jumboframe.patch b/target/linux/ixp4xx/patches-2.6.32/304-ixp4xx_eth_jumboframe.patch new file mode 100644 index 000000000..a9cbddcf5 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/304-ixp4xx_eth_jumboframe.patch @@ -0,0 +1,80 @@ +--- a/drivers/net/arm/ixp4xx_eth.c ++++ b/drivers/net/arm/ixp4xx_eth.c +@@ -52,7 +52,7 @@ + + #define POOL_ALLOC_SIZE (sizeof(struct desc) * (RX_DESCS + TX_DESCS)) + #define REGS_SIZE 0x1000 +-#define MAX_MRU 1536 /* 0x600 */ ++#define MAX_MRU (14320 - ETH_HLEN - ETH_FCS_LEN) + #define RX_BUFF_SIZE ALIGN((NET_IP_ALIGN) + MAX_MRU, 4) + + #define NAPI_WEIGHT 16 +@@ -1061,6 +1061,32 @@ static void destroy_queues(struct port * + } + } + ++static int eth_do_change_mtu(struct net_device *dev, int mtu) ++{ ++ struct port *port; ++ struct msg msg; ++ /* adjust for ethernet headers */ ++ int framesize = mtu + ETH_HLEN + ETH_FCS_LEN; ++ ++ port = netdev_priv(dev); ++ ++ memset(&msg, 0, sizeof(msg)); ++ msg.cmd = NPE_SETMAXFRAMELENGTHS; ++ msg.eth_id = port->id; ++ ++ /* max rx/tx 64 byte blocks */ ++ msg.byte2 = ((framesize + 63) / 64) << 8; ++ msg.byte3 = ((framesize + 63) / 64) << 8; ++ ++ msg.byte4 = msg.byte6 = framesize >> 8; ++ msg.byte5 = msg.byte7 = framesize & 0xff; ++ ++ if (npe_send_recv_message(port->npe, &msg, "ETH_SET_MAX_FRAME_LENGTH")) ++ return -EIO; ++ ++ return 0; ++} ++ + static int eth_open(struct net_device *dev) + { + struct port *port = netdev_priv(dev); +@@ -1112,6 +1138,8 @@ static int eth_open(struct net_device *d + if (npe_send_recv_message(port->npe, &msg, "ETH_SET_FIREWALL_MODE")) + return -EIO; + ++ eth_do_change_mtu(dev, dev->mtu); ++ + if ((err = request_queues(port)) != 0) + return err; + +@@ -1251,7 +1279,26 @@ static int eth_close(struct net_device * + return 0; + } + ++static int ixp_eth_change_mtu(struct net_device *dev, int mtu) ++{ ++ int ret; ++ ++ if (mtu > MAX_MRU) ++ return -EINVAL; ++ ++ if (dev->flags & IFF_UP) { ++ ret = eth_do_change_mtu(dev, mtu); ++ if (ret < 0) ++ return ret; ++ } ++ ++ dev->mtu = mtu; ++ ++ return 0; ++} ++ + static const struct net_device_ops ixp4xx_netdev_ops = { ++ .ndo_change_mtu = ixp_eth_change_mtu, + .ndo_open = eth_open, + .ndo_stop = eth_close, + .ndo_start_xmit = eth_xmit, diff --git a/target/linux/ixp4xx/patches-2.6.32/310-gtwx5717_spi_bus.patch b/target/linux/ixp4xx/patches-2.6.32/310-gtwx5717_spi_bus.patch new file mode 100644 index 000000000..e6013d758 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/310-gtwx5717_spi_bus.patch @@ -0,0 +1,53 @@ +--- a/arch/arm/mach-ixp4xx/gtwx5715-setup.c ++++ b/arch/arm/mach-ixp4xx/gtwx5715-setup.c +@@ -29,6 +29,8 @@ + #include + #include + ++#include ++ + #include + #include + #include +@@ -121,9 +123,41 @@ static struct platform_device gtwx5715_f + .resource = >wx5715_flash_resource, + }; + ++static int gtwx5715_spi_boardinfo_setup(struct spi_board_info *bi, ++ struct spi_master *master, void *data) ++{ ++ ++ strlcpy(bi->modalias, "spi-ks8995", sizeof(bi->modalias)); ++ ++ bi->max_speed_hz = 5000000 /* Hz */; ++ bi->bus_num = master->bus_num; ++ bi->mode = SPI_MODE_0; ++ ++ return 0; ++} ++ ++static struct spi_gpio_platform_data gtwx5715_spi_bus_data = { ++ .pin_cs = GTWX5715_KSSPI_SELECT, ++ .pin_clk = GTWX5715_KSSPI_CLOCK, ++ .pin_miso = GTWX5715_KSSPI_RXD, ++ .pin_mosi = GTWX5715_KSSPI_TXD, ++ .cs_activelow = 1, ++ .no_spi_delay = 1, ++ .boardinfo_setup = gtwx5715_spi_boardinfo_setup, ++}; ++ ++static struct platform_device gtwx5715_spi_bus = { ++ .name = "spi-gpio", ++ .id = 0, ++ .dev = { ++ .platform_data = >wx5715_spi_bus_data, ++ }, ++}; ++ + static struct platform_device *gtwx5715_devices[] __initdata = { + >wx5715_uart_device, + >wx5715_flash, ++ >wx5715_spi_bus, + }; + + static void __init gtwx5715_init(void) diff --git a/target/linux/ixp4xx/patches-2.6.32/311-gtwx5717_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.32/311-gtwx5717_mac_plat_info.patch new file mode 100644 index 000000000..29f329017 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/311-gtwx5717_mac_plat_info.patch @@ -0,0 +1,40 @@ +--- a/arch/arm/mach-ixp4xx/gtwx5715-setup.c ++++ b/arch/arm/mach-ixp4xx/gtwx5715-setup.c +@@ -154,10 +154,37 @@ static struct platform_device gtwx5715_s + }, + }; + ++static struct eth_plat_info gtwx5715_npeb_data = { ++ .phy = IXP4XX_ETH_PHY_MAX_ADDR, ++ .phy_mask = 0x1e, /* ports 1-4 of the KS8995 switch */ ++ .rxq = 3, ++ .txreadyq = 20, ++}; ++ ++static struct eth_plat_info gtwx5715_npec_data = { ++ .phy = 5, /* port 5 of the KS8995 switch */ ++ .rxq = 4, ++ .txreadyq = 21, ++}; ++ ++static struct platform_device gtwx5715_npeb_device = { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEB, ++ .dev.platform_data = >wx5715_npeb_data, ++}; ++ ++static struct platform_device gtwx5715_npec_device = { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEC, ++ .dev.platform_data = >wx5715_npec_data, ++}; ++ + static struct platform_device *gtwx5715_devices[] __initdata = { + >wx5715_uart_device, + >wx5715_flash, + >wx5715_spi_bus, ++ >wx5715_npeb_device, ++ >wx5715_npec_device, + }; + + static void __init gtwx5715_init(void) diff --git a/target/linux/ixp4xx/patches-2.6.32/312-ixp4xx_pata_optimization.patch b/target/linux/ixp4xx/patches-2.6.32/312-ixp4xx_pata_optimization.patch new file mode 100644 index 000000000..3bf1b7497 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/312-ixp4xx_pata_optimization.patch @@ -0,0 +1,137 @@ +--- a/drivers/ata/pata_ixp4xx_cf.c ++++ b/drivers/ata/pata_ixp4xx_cf.c +@@ -24,16 +24,58 @@ + #include + + #define DRV_NAME "pata_ixp4xx_cf" +-#define DRV_VERSION "0.2" ++#define DRV_VERSION "0.3" + + static int ixp4xx_set_mode(struct ata_link *link, struct ata_device **error) + { + struct ata_device *dev; ++ struct ixp4xx_pata_data *data = link->ap->host->dev->platform_data; ++ unsigned int pio_mask; + + ata_for_each_dev(dev, link, ENABLED) { +- ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n"); +- dev->pio_mode = XFER_PIO_0; +- dev->xfer_mode = XFER_PIO_0; ++ if (dev->id[ATA_ID_FIELD_VALID] & (1 << 1)) { ++ pio_mask = dev->id[ATA_ID_PIO_MODES] & 0x03; ++ if (pio_mask & (1 << 1)) { ++ pio_mask = 4; ++ } else { ++ pio_mask = 3; ++ } ++ } else { ++ pio_mask = (dev->id[ATA_ID_OLD_PIO_MODES] >> 8); ++ } ++ ++ switch (pio_mask){ ++ case 0: ++ ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n"); ++ dev->pio_mode = XFER_PIO_0; ++ dev->xfer_mode = XFER_PIO_0; ++ *data->cs0_cfg = 0x8a473c03; ++ break; ++ case 1: ++ ata_dev_printk(dev, KERN_INFO, "configured for PIO1\n"); ++ dev->pio_mode = XFER_PIO_1; ++ dev->xfer_mode = XFER_PIO_1; ++ *data->cs0_cfg = 0x86433c03; ++ break; ++ case 2: ++ ata_dev_printk(dev, KERN_INFO, "configured for PIO2\n"); ++ dev->pio_mode = XFER_PIO_2; ++ dev->xfer_mode = XFER_PIO_2; ++ *data->cs0_cfg = 0x82413c03; ++ break; ++ case 3: ++ ata_dev_printk(dev, KERN_INFO, "configured for PIO3\n"); ++ dev->pio_mode = XFER_PIO_3; ++ dev->xfer_mode = XFER_PIO_3; ++ *data->cs0_cfg = 0x80823c03; ++ break; ++ case 4: ++ ata_dev_printk(dev, KERN_INFO, "configured for PIO4\n"); ++ dev->pio_mode = XFER_PIO_4; ++ dev->xfer_mode = XFER_PIO_4; ++ *data->cs0_cfg = 0x80403c03; ++ break; ++ } + dev->xfer_shift = ATA_SHIFT_PIO; + dev->flags |= ATA_DFLAG_PIO; + } +@@ -46,6 +88,7 @@ static unsigned int ixp4xx_mmio_data_xfe + unsigned int i; + unsigned int words = buflen >> 1; + u16 *buf16 = (u16 *) buf; ++ unsigned int pio_mask; + struct ata_port *ap = dev->link->ap; + void __iomem *mmio = ap->ioaddr.data_addr; + struct ixp4xx_pata_data *data = ap->host->dev->platform_data; +@@ -53,8 +96,34 @@ static unsigned int ixp4xx_mmio_data_xfe + /* set the expansion bus in 16bit mode and restore + * 8 bit mode after the transaction. + */ +- *data->cs0_cfg &= ~(0x01); +- udelay(100); ++ if (dev->id[ATA_ID_FIELD_VALID] & (1 << 1)){ ++ pio_mask = dev->id[ATA_ID_PIO_MODES] & 0x03; ++ if (pio_mask & (1 << 1)){ ++ pio_mask = 4; ++ }else{ ++ pio_mask = 3; ++ } ++ }else{ ++ pio_mask = (dev->id[ATA_ID_OLD_PIO_MODES] >> 8); ++ } ++ switch (pio_mask){ ++ case 0: ++ *data->cs0_cfg = 0xa9643c42; ++ break; ++ case 1: ++ *data->cs0_cfg = 0x85033c42; ++ break; ++ case 2: ++ *data->cs0_cfg = 0x80b23c42; ++ break; ++ case 3: ++ *data->cs0_cfg = 0x80823c42; ++ break; ++ case 4: ++ *data->cs0_cfg = 0x80403c42; ++ break; ++ } ++ udelay(5); + + /* Transfer multiple of 2 bytes */ + if (rw == READ) +@@ -79,8 +148,24 @@ static unsigned int ixp4xx_mmio_data_xfe + words++; + } + +- udelay(100); +- *data->cs0_cfg |= 0x01; ++ udelay(5); ++ switch (pio_mask){ ++ case 0: ++ *data->cs0_cfg = 0x8a473c03; ++ break; ++ case 1: ++ *data->cs0_cfg = 0x86433c03; ++ break; ++ case 2: ++ *data->cs0_cfg = 0x82413c03; ++ break; ++ case 3: ++ *data->cs0_cfg = 0x80823c03; ++ break; ++ case 4: ++ *data->cs0_cfg = 0x80403c03; ++ break; ++ } + + return words << 1; + } diff --git a/target/linux/ixp4xx/patches-2.6.32/401-avila_pci_dev.patch b/target/linux/ixp4xx/patches-2.6.32/401-avila_pci_dev.patch new file mode 100644 index 000000000..3e5087f34 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/401-avila_pci_dev.patch @@ -0,0 +1,11 @@ +--- a/arch/arm/mach-ixp4xx/include/mach/avila.h ++++ b/arch/arm/mach-ixp4xx/include/mach/avila.h +@@ -25,7 +25,7 @@ + /* + * AVILA PCI IRQs + */ +-#define AVILA_PCI_MAX_DEV 4 ++#define AVILA_PCI_MAX_DEV 6 + #define LOFT_PCI_MAX_DEV 6 + #define AVILA_PCI_IRQ_LINES 4 + diff --git a/target/linux/ixp4xx/patches-2.6.32/402-ixp4xx_gpiolib.patch b/target/linux/ixp4xx/patches-2.6.32/402-ixp4xx_gpiolib.patch new file mode 100644 index 000000000..631703432 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/402-ixp4xx_gpiolib.patch @@ -0,0 +1,125 @@ +--- a/arch/arm/mach-ixp4xx/common.c ++++ b/arch/arm/mach-ixp4xx/common.c +@@ -36,6 +36,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -375,12 +376,39 @@ static struct platform_device *ixp46x_de + unsigned long ixp4xx_exp_bus_size; + EXPORT_SYMBOL(ixp4xx_exp_bus_size); + ++static int ixp4xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) ++{ ++ gpio_line_config(gpio, IXP4XX_GPIO_IN); ++ return 0; ++} ++EXPORT_SYMBOL(ixp4xx_gpio_direction_input); ++ ++static int ixp4xx_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, int level) ++{ ++ gpio_line_set(gpio, level); ++ gpio_line_config(gpio, IXP4XX_GPIO_OUT); ++ return 0; ++} ++EXPORT_SYMBOL(ixp4xx_gpio_direction_output); ++ ++static struct gpio_chip ixp4xx_gpio_chip = { ++ .label = "IXP4XX_GPIO_CHIP", ++ .direction_input = ixp4xx_gpio_direction_input, ++ .direction_output = ixp4xx_gpio_direction_output, ++ .get = gpio_get_value, ++ .set = gpio_set_value, ++ .base = 0, ++ .ngpio = 16, ++}; ++ + void __init ixp4xx_sys_init(void) + { + ixp4xx_exp_bus_size = SZ_16M; + + platform_add_devices(ixp4xx_devices, ARRAY_SIZE(ixp4xx_devices)); + ++ gpiochip_add(&ixp4xx_gpio_chip); ++ + if (cpu_is_ixp46x()) { + int region; + +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -415,6 +415,7 @@ config ARCH_IXP4XX + select GENERIC_GPIO + select GENERIC_TIME + select GENERIC_CLOCKEVENTS ++ select ARCH_REQUIRE_GPIOLIB + help + Support for Intel's IXP4XX (XScale) family of processors. + +--- a/arch/arm/mach-ixp4xx/include/mach/gpio.h ++++ b/arch/arm/mach-ixp4xx/include/mach/gpio.h +@@ -27,47 +27,31 @@ + + #include + #include ++#include /* cansleep wrappers */ + +-static inline int gpio_request(unsigned gpio, const char *label) +-{ +- return 0; +-} +- +-static inline void gpio_free(unsigned gpio) +-{ +- might_sleep(); +- +- return; +-} +- +-static inline int gpio_direction_input(unsigned gpio) +-{ +- gpio_line_config(gpio, IXP4XX_GPIO_IN); +- return 0; +-} +- +-static inline int gpio_direction_output(unsigned gpio, int level) +-{ +- gpio_line_set(gpio, level); +- gpio_line_config(gpio, IXP4XX_GPIO_OUT); +- return 0; +-} ++#define NR_BUILTIN_GPIO 16 + + static inline int gpio_get_value(unsigned gpio) + { +- int value; +- +- gpio_line_get(gpio, &value); +- +- return value; ++ if (gpio < NR_BUILTIN_GPIO) ++ { ++ int value; ++ gpio_line_get(gpio, &value); ++ return value; ++ } ++ else ++ return __gpio_get_value(gpio); + } + + static inline void gpio_set_value(unsigned gpio, int value) + { +- gpio_line_set(gpio, value); ++ if (gpio < NR_BUILTIN_GPIO) ++ gpio_line_set(gpio, value); ++ else ++ __gpio_set_value(gpio, value); + } + +-#include /* cansleep wrappers */ ++#define gpio_cansleep __gpio_cansleep + + extern int gpio_to_irq(int gpio); + extern int irq_to_gpio(int gpio); diff --git a/target/linux/ixp4xx/patches-2.6.32/500-usr8200_support.patch b/target/linux/ixp4xx/patches-2.6.32/500-usr8200_support.patch new file mode 100644 index 000000000..2d78425f4 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.32/500-usr8200_support.patch @@ -0,0 +1,342 @@ +--- a/arch/arm/mach-ixp4xx/Kconfig ++++ b/arch/arm/mach-ixp4xx/Kconfig +@@ -97,6 +97,14 @@ config MACH_SIDEWINDER + Engineering Sidewinder board. For more information on this + platform, see http://www.adiengineering.com + ++config MACH_USR8200 ++ bool "USRobotics USR8200" ++ select PCI ++ help ++ Say 'Y' here if you want your kernel to support the USRobotics ++ USR8200 router board. For more information on this platform, see ++ http://openwrt.org ++ + config MACH_COMPEX + bool "Compex WP18 / NP18A" + select PCI +--- a/arch/arm/mach-ixp4xx/Makefile ++++ b/arch/arm/mach-ixp4xx/Makefile +@@ -25,6 +25,7 @@ obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt + obj-pci-$(CONFIG_MACH_AP1000) += ixdp425-pci.o + obj-pci-$(CONFIG_MACH_TW5334) += tw5334-pci.o + obj-pci-$(CONFIG_MACH_MI424WR) += mi424wr-pci.o ++obj-pci-$(CONFIG_MACH_USR8200) += usr8200-pci.o + + obj-y += common.o + +@@ -49,6 +50,7 @@ obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv + obj-$(CONFIG_MACH_AP1000) += ap1000-setup.o + obj-$(CONFIG_MACH_TW5334) += tw5334-setup.o + obj-$(CONFIG_MACH_MI424WR) += mi424wr-setup.o ++obj-$(CONFIG_MACH_USR8200) += usr8200-setup.o + + obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o + obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o +--- /dev/null ++++ b/arch/arm/mach-ixp4xx/usr8200-pci.c +@@ -0,0 +1,78 @@ ++/* ++ * arch/arch/mach-ixp4xx/usr8200-pci.c ++ * ++ * PCI setup routines for USRobotics USR8200 ++ * ++ * Copyright (C) 2008 Peter Denison ++ * ++ * based on pronghorn-pci.c ++ * Copyright (C) 2008 Imre Kaloz ++ * based on coyote-pci.c: ++ * Copyright (C) 2002 Jungo Software Technologies. ++ * Copyright (C) 2003 MontaVista Softwrae, Inc. ++ * ++ * Maintainer: Peter Denison ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include ++ ++void __init usr8200_pci_preinit(void) ++{ ++ set_irq_type(IRQ_IXP4XX_GPIO7, IRQ_TYPE_LEVEL_LOW); ++ set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_LEVEL_LOW); ++ set_irq_type(IRQ_IXP4XX_GPIO9, IRQ_TYPE_LEVEL_LOW); ++ set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW); ++ set_irq_type(IRQ_IXP4XX_GPIO11, IRQ_TYPE_LEVEL_LOW); ++ ++ ixp4xx_pci_preinit(); ++} ++ ++static int __init usr8200_map_irq(struct pci_dev *dev, u8 slot, u8 pin) ++{ ++ if (slot == 14) ++ return IRQ_IXP4XX_GPIO7; ++ else if (slot == 15) ++ return IRQ_IXP4XX_GPIO8; ++ else if (slot == 16) { ++ if (pin == 1) ++ return IRQ_IXP4XX_GPIO11; ++ else if (pin == 2) ++ return IRQ_IXP4XX_GPIO10; ++ else if (pin == 3) ++ return IRQ_IXP4XX_GPIO9; ++ else ++ return -1; ++ } else ++ return -1; ++} ++ ++struct hw_pci usr8200_pci __initdata = { ++ .nr_controllers = 1, ++ .preinit = usr8200_pci_preinit, ++ .swizzle = pci_std_swizzle, ++ .setup = ixp4xx_setup, ++ .scan = ixp4xx_scan_bus, ++ .map_irq = usr8200_map_irq, ++}; ++ ++int __init usr8200_pci_init(void) ++{ ++ if (machine_is_usr8200()) ++ pci_common_init(&usr8200_pci); ++ return 0; ++} ++ ++subsys_initcall(usr8200_pci_init); +--- /dev/null ++++ b/arch/arm/mach-ixp4xx/usr8200-setup.c +@@ -0,0 +1,212 @@ ++/* ++ * arch/arm/mach-ixp4xx/usr8200-setup.c ++ * ++ * Board setup for the USRobotics USR8200 ++ * ++ * Copyright (C) 2008 Peter Denison ++ * ++ * based on pronghorn-setup.c: ++ * Copyright (C) 2008 Imre Kaloz ++ * based on coyote-setup.c: ++ * Copyright (C) 2003-2005 MontaVista Software, Inc. ++ * ++ * Author: Peter Denison ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static struct flash_platform_data usr8200_flash_data = { ++ .map_name = "cfi_probe", ++ .width = 2, ++}; ++ ++static struct resource usr8200_flash_resource = { ++ .flags = IORESOURCE_MEM, ++}; ++ ++static struct platform_device usr8200_flash = { ++ .name = "IXP4XX-Flash", ++ .id = 0, ++ .dev = { ++ .platform_data = &usr8200_flash_data, ++ }, ++ .num_resources = 1, ++ .resource = &usr8200_flash_resource, ++}; ++ ++static struct resource usr8200_uart_resources [] = { ++ { ++ .start = IXP4XX_UART2_BASE_PHYS, ++ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, ++ .flags = IORESOURCE_MEM ++ }, ++ { ++ .start = IXP4XX_UART1_BASE_PHYS, ++ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, ++ .flags = IORESOURCE_MEM ++ } ++}; ++ ++static struct plat_serial8250_port usr8200_uart_data[] = { ++ { ++ .mapbase = IXP4XX_UART2_BASE_PHYS, ++ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, ++ .irq = IRQ_IXP4XX_UART2, ++ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, ++ .iotype = UPIO_MEM, ++ .regshift = 2, ++ .uartclk = IXP4XX_UART_XTAL, ++ }, ++ { ++ .mapbase = IXP4XX_UART1_BASE_PHYS, ++ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, ++ .irq = IRQ_IXP4XX_UART1, ++ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, ++ .iotype = UPIO_MEM, ++ .regshift = 2, ++ .uartclk = IXP4XX_UART_XTAL, ++ }, ++ { }, ++}; ++ ++static struct platform_device usr8200_uart = { ++ .name = "serial8250", ++ .id = PLAT8250_DEV_PLATFORM, ++ .dev = { ++ .platform_data = usr8200_uart_data, ++ }, ++ .num_resources = 2, ++ .resource = usr8200_uart_resources, ++}; ++ ++static struct gpio_led usr8200_led_pin[] = { ++ { ++ .name = "usr8200:usb1", ++ .gpio = 0, ++ .active_low = 1, ++ }, ++ { ++ .name = "usr8200:usb2", ++ .gpio = 1, ++ .active_low = 1, ++ }, ++ { ++ .name = "usr8200:ieee1394", ++ .gpio = 2, ++ .active_low = 1, ++ }, ++ { ++ .name = "usr8200:internal", ++ .gpio = 3, ++ .active_low = 1, ++ }, ++ { ++ .name = "usr8200:power", ++ .gpio = 14, ++ } ++}; ++ ++static struct gpio_led_platform_data usr8200_led_data = { ++ .num_leds = ARRAY_SIZE(usr8200_led_pin), ++ .leds = usr8200_led_pin, ++}; ++ ++static struct platform_device usr8200_led = { ++ .name = "leds-gpio", ++ .id = -1, ++ .dev.platform_data = &usr8200_led_data, ++}; ++ ++static struct eth_plat_info usr8200_plat_eth[] = { ++ { /* NPEC - LAN with Marvell 88E6060 switch */ ++ .phy = IXP4XX_ETH_PHY_MAX_ADDR, ++ .phy_mask = 0x0F0000, ++ .rxq = 4, ++ .txreadyq = 21, ++ }, { /* NPEB - WAN */ ++ .phy = 9, ++ .rxq = 3, ++ .txreadyq = 20, ++ } ++}; ++ ++static struct platform_device usr8200_eth[] = { ++ { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEC, ++ .dev.platform_data = usr8200_plat_eth, ++ }, { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEB, ++ .dev.platform_data = usr8200_plat_eth + 1, ++ } ++}; ++ ++static struct resource usr8200_rtc_resources = { ++ .flags = IORESOURCE_MEM ++}; ++ ++static struct platform_device usr8200_rtc = { ++ .name = "rtc7301", ++ .id = 0, ++ .num_resources = 1, ++ .resource = &usr8200_rtc_resources, ++}; ++ ++static struct platform_device *usr8200_devices[] __initdata = { ++ &usr8200_flash, ++ &usr8200_uart, ++ &usr8200_led, ++ &usr8200_eth[0], ++ &usr8200_eth[1], ++ &usr8200_rtc, ++}; ++ ++static void __init usr8200_init(void) ++{ ++ ixp4xx_sys_init(); ++ ++ usr8200_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); ++ usr8200_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_16M - 1; ++ ++ usr8200_rtc_resources.start = IXP4XX_EXP_BUS_BASE(2); ++ usr8200_rtc_resources.end = IXP4XX_EXP_BUS_BASE(2) + 0x01ff; ++ ++ *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; ++ *IXP4XX_EXP_CS2 = 0x3fff000 | IXP4XX_EXP_BUS_SIZE(0) | IXP4XX_EXP_BUS_WR_EN | ++ IXP4XX_EXP_BUS_CS_EN | IXP4XX_EXP_BUS_BYTE_EN; ++ *IXP4XX_GPIO_GPCLKR = 0x01100000; ++ ++ /* configure button as input */ ++ gpio_line_config(12, IXP4XX_GPIO_IN); ++ ++ platform_add_devices(usr8200_devices, ARRAY_SIZE(usr8200_devices)); ++} ++ ++MACHINE_START(USR8200, "USRobotics USR8200") ++ /* Maintainer: Peter Denison */ ++ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, ++ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, ++ .map_io = ixp4xx_map_io, ++ .init_irq = ixp4xx_init_irq, ++ .timer = &ixp4xx_timer, ++ .boot_params = 0x0100, ++ .init_machine = usr8200_init, ++MACHINE_END +--- a/arch/arm/mach-ixp4xx/include/mach/uncompress.h ++++ b/arch/arm/mach-ixp4xx/include/mach/uncompress.h +@@ -43,7 +43,7 @@ static __inline__ void __arch_decomp_set + if (machine_is_adi_coyote() || machine_is_gtwx5715() || + machine_is_gateway7001() || machine_is_wg302v2() || + machine_is_pronghorn() || machine_is_pronghorn_metro() || machine_is_wrt300nv2() || +- machine_is_tw5334()) ++ machine_is_tw5334() || machine_is_usr8200()) + uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS; + else + uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS; From fdd46a4e0231f7f030bf539558f8c416300df9d7 Mon Sep 17 00:00:00 2001 From: kaloz Date: Tue, 3 Nov 2009 11:12:17 +0000 Subject: [PATCH 072/288] temporary remove the pfifo fast patch from 2.6.32, too git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18284 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../260-extend_pfifo_fast.patch | 144 ------------------ 1 file changed, 144 deletions(-) delete mode 100644 target/linux/generic-2.6/patches-2.6.32/260-extend_pfifo_fast.patch diff --git a/target/linux/generic-2.6/patches-2.6.32/260-extend_pfifo_fast.patch b/target/linux/generic-2.6/patches-2.6.32/260-extend_pfifo_fast.patch deleted file mode 100644 index f306e861f..000000000 --- a/target/linux/generic-2.6/patches-2.6.32/260-extend_pfifo_fast.patch +++ /dev/null @@ -1,144 +0,0 @@ ---- a/net/sched/sch_generic.c -+++ b/net/sched/sch_generic.c -@@ -391,16 +391,50 @@ static const u8 prio2band[TC_PRIO_MAX+1] - - #define PFIFO_FAST_BANDS 3 - -+struct pfifo_fast_sched_data { -+ struct tcf_proto *filter_list; -+ struct sk_buff_head list[PFIFO_FAST_BANDS]; -+}; -+ - static inline struct sk_buff_head *prio2list(struct sk_buff *skb, - struct Qdisc *qdisc) - { -- struct sk_buff_head *list = qdisc_priv(qdisc); -+ struct pfifo_fast_sched_data *q = qdisc_priv(qdisc); -+ struct sk_buff_head *list = q->list; - return list + prio2band[skb->priority & TC_PRIO_MAX]; - } - -+static int pfifo_fast_filter(struct sk_buff *skb, struct Qdisc* qdisc) -+{ -+#ifdef CONFIG_NET_CLS_ACT -+ struct pfifo_fast_sched_data *q = qdisc_priv(qdisc); -+ int result = 0, ret = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN; -+ struct tcf_result res; -+ -+ if (q->filter_list != NULL) -+ result = tc_classify(skb, q->filter_list, &res); -+ if (result >= 0) { -+ switch (result) { -+ case TC_ACT_STOLEN: -+ case TC_ACT_QUEUED: -+ ret = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN; -+ case TC_ACT_SHOT: -+ kfree_skb(skb); -+ return ret; -+ } -+ } -+#endif -+ return 0; -+} -+ - static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc* qdisc) - { - struct sk_buff_head *list = prio2list(skb, qdisc); -+ int ret; -+ -+ ret = pfifo_fast_filter(skb, qdisc); -+ if (ret) -+ return ret; - - if (skb_queue_len(list) < qdisc_dev(qdisc)->tx_queue_len) { - qdisc->q.qlen++; -@@ -412,8 +446,9 @@ static int pfifo_fast_enqueue(struct sk_ - - static struct sk_buff *pfifo_fast_dequeue(struct Qdisc* qdisc) - { -+ struct pfifo_fast_sched_data *q = qdisc_priv(qdisc); -+ struct sk_buff_head *list = q->list; - int prio; -- struct sk_buff_head *list = qdisc_priv(qdisc); - - for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) { - if (!skb_queue_empty(list + prio)) { -@@ -440,8 +475,9 @@ static struct sk_buff *pfifo_fast_peek(s - - static void pfifo_fast_reset(struct Qdisc* qdisc) - { -+ struct pfifo_fast_sched_data *q = qdisc_priv(qdisc); -+ struct sk_buff_head *list = q->list; - int prio; -- struct sk_buff_head *list = qdisc_priv(qdisc); - - for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) - __qdisc_reset_queue(qdisc, list + prio); -@@ -464,8 +500,9 @@ nla_put_failure: - - static int pfifo_fast_init(struct Qdisc *qdisc, struct nlattr *opt) - { -+ struct pfifo_fast_sched_data *q = qdisc_priv(qdisc); -+ struct sk_buff_head *list = q->list; - int prio; -- struct sk_buff_head *list = qdisc_priv(qdisc); - - for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) - skb_queue_head_init(list + prio); -@@ -473,9 +510,36 @@ static int pfifo_fast_init(struct Qdisc - return 0; - } - -+static int pfifo_fast_change_class(struct Qdisc *qdisc, u32 classid, u32 parentid, -+ struct nlattr **tca, unsigned long *arg) -+{ -+ return -EOPNOTSUPP; -+} -+ -+static unsigned long pfifo_fast_get(struct Qdisc *qdisc, u32 classid) -+{ -+ return 0; -+} -+ -+static struct tcf_proto **pfifo_fast_find_tcf(struct Qdisc *qdisc, unsigned long cl) -+{ -+ struct pfifo_fast_sched_data *q = qdisc_priv(qdisc); -+ -+ if (cl) -+ return NULL; -+ return &q->filter_list; -+} -+ -+static const struct Qdisc_class_ops pfifo_fast_class_ops = { -+ .get = pfifo_fast_get, -+ .change = pfifo_fast_change_class, -+ .tcf_chain = pfifo_fast_find_tcf, -+}; -+ - static struct Qdisc_ops pfifo_fast_ops __read_mostly = { - .id = "pfifo_fast", -- .priv_size = PFIFO_FAST_BANDS * sizeof(struct sk_buff_head), -+ .cl_ops = &pfifo_fast_class_ops, -+ .priv_size = sizeof(struct pfifo_fast_sched_data), - .enqueue = pfifo_fast_enqueue, - .dequeue = pfifo_fast_dequeue, - .peek = pfifo_fast_peek, -@@ -757,3 +821,18 @@ void dev_shutdown(struct net_device *dev - shutdown_scheduler_queue(dev, &dev->rx_queue, &noop_qdisc); - WARN_ON(timer_pending(&dev->watchdog_timer)); - } -+ -+#ifdef CONFIG_NET_SCHED -+static int __init sch_generic_init(void) -+{ -+ return register_qdisc(&pfifo_fast_ops); -+} -+ -+static void __exit sch_generic_exit(void) -+{ -+ unregister_qdisc(&pfifo_fast_ops); -+} -+ -+module_init(sch_generic_init) -+module_exit(sch_generic_exit) -+#endif From a1fd86c13e33ce51666418d851f14d752e5e3f50 Mon Sep 17 00:00:00 2001 From: nbd Date: Tue, 3 Nov 2009 15:38:04 +0000 Subject: [PATCH 073/288] unbreak brcm-2.4 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18287 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- include/image.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/image.mk b/include/image.mk index c6d5e2649..a722086a0 100644 --- a/include/image.mk +++ b/include/image.mk @@ -23,7 +23,7 @@ JFFS2OPTS := --pad --big-endian --squash SQUASHFS_OPTS := -be endif -ifneq ($(CONFIG_LINUX_2_6_21)$(CONFIG_LINUX_2_6_25)$(CONFIG_LINUX_2_6_28),) +ifneq ($(CONFIG_LINUX_2_4)$(CONFIG_LINUX_2_6_21)$(CONFIG_LINUX_2_6_25)$(CONFIG_LINUX_2_6_28),) USE_SQUASHFS3 := y endif From 47ef97e2e3398247c85c1267ff2ed04dfa068e95 Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 3 Nov 2009 19:59:04 +0000 Subject: [PATCH 074/288] [brcm63xx] images without tagid now fallback to the untouched partition layout (#6093) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18288 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../brcm63xx/files/drivers/mtd/maps/bcm963xx-flash.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/target/linux/brcm63xx/files/drivers/mtd/maps/bcm963xx-flash.c b/target/linux/brcm63xx/files/drivers/mtd/maps/bcm963xx-flash.c index de373b22b..e24a08110 100644 --- a/target/linux/brcm63xx/files/drivers/mtd/maps/bcm963xx-flash.c +++ b/target/linux/brcm63xx/files/drivers/mtd/maps/bcm963xx-flash.c @@ -199,8 +199,15 @@ static int parse_cfe_partitions( struct mtd_info *master, struct mtd_partition * } if (!tagid_match) { - printk(KERN_ERR PFX "Failed to find a valid tag id\n"); - return -EIO; + tagid = "bcram"; + sscanf(buf->bccfe.rootAddress,"%u", &rootfsaddr); + sscanf(buf->bccfe.rootLength, "%u", &rootfslen); + sscanf(buf->bccfe.kernelAddress, "%u", &kerneladdr); + sscanf(buf->bccfe.kernelLength, "%u", &kernellen); + sscanf(buf->bccfe.totalLength, "%u", &totallen); + tagidcrc = *(uint32_t *)&(buf->bccfe.tagIdCRC[0]); + tagversion = &(buf->bccfe.tagVersion[0]); + boardid = &(buf->bccfe.boardid[0]); } printk(KERN_INFO PFX "CFE boot tag found with version %s, board type %s, and tagid %s.\n",tagversion,boardid,tagid); From 2fbb0f0be3175485b7a37af4bdb070da9ff42f2d Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 3 Nov 2009 20:35:37 +0000 Subject: [PATCH 075/288] [package] fix breakage on wl500gp after r18214, thanks sn9 (#6084) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18289 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/switch/src/switch-robo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/switch/src/switch-robo.c b/package/switch/src/switch-robo.c index 481bb76a5..9f0689602 100644 --- a/package/switch/src/switch-robo.c +++ b/package/switch/src/switch-robo.c @@ -500,8 +500,8 @@ static int handle_enable_vlan_write(void *driver, char *buf, int nr) robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL0, disable ? 0 : (1 << 7) /* 802.1Q VLAN */ | (3 << 5) /* mac check and hash */); robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL1, disable ? 0 : - (robo.devid == ROBO_DEVICE_ID_5325 ? (1 << 1) : 0) | /* RSV multicast */ - robo_read16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL0) | (1 << 2) | (1 << 3)); + (robo.devid == ROBO_DEVICE_ID_5325 ? (1 << 1) : + 0) | (1 << 2) | (1 << 3)); /* RSV multicast */ if (robo.devid != ROBO_DEVICE_ID_5325) return 0; From 875a24be1f84f391fe4e7f75c37c80e5804617e5 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 4 Nov 2009 00:05:56 +0000 Subject: [PATCH 076/288] madwifi: fix a crash bug related to refcounting of bss nodes git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18290 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/madwifi/patches/451-ibss_race_fix.patch | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/package/madwifi/patches/451-ibss_race_fix.patch b/package/madwifi/patches/451-ibss_race_fix.patch index 9be3311fd..d25d3cc88 100644 --- a/package/madwifi/patches/451-ibss_race_fix.patch +++ b/package/madwifi/patches/451-ibss_race_fix.patch @@ -194,17 +194,6 @@ } IEEE80211_ADDR_COPY(ni->ni_bssid, vap->iv_myaddr); -@@ -429,8 +425,8 @@ ieee80211_reset_bss(struct ieee80211vap - __func__, ni, MAC_ADDR(vap->iv_myaddr)); - KASSERT(ni != NULL, ("unable to setup inital BSS node")); - -- vap->iv_bss = ieee80211_ref_node(ni); -- KASSERT((atomic_read(&vap->iv_bss->ni_refcnt) == 3), -+ vap->iv_bss = ni; -+ KASSERT((atomic_read(&vap->iv_bss->ni_refcnt) == 2), - ("wrong refcount for new node.")); - - if (obss != NULL) { @@ -647,7 +643,7 @@ ieee80211_sta_join1(struct ieee80211_nod (vap->iv_state == IEEE80211_S_RUN) && bssid_equal(obss, selbs)); */ vap->iv_bss = selbs; From 2394d9072728a39d0b72dbe62a4815fe0b2fc759 Mon Sep 17 00:00:00 2001 From: jow Date: Wed, 4 Nov 2009 16:51:43 +0000 Subject: [PATCH 077/288] [feeds] LuCI main repo is down due to server crash, switch to repo mirror git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18292 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- feeds.conf.default | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feeds.conf.default b/feeds.conf.default index 511eb9b52..853dcadb4 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,6 +1,6 @@ src-svn packages svn://svn.openwrt.org/openwrt/packages src-svn xwrt http://x-wrt.googlecode.com/svn/trunk/package -src-svn luci http://svn.luci.subsignal.org/luci/branches/luci-0.9/contrib/package +src-svn luci http://svn2.luci.freifunk-halle.net/luci/branches/luci-0.9/contrib/package #src-svn phone svn://svn.openwrt.org/openwrt/feeds/phone #src-svn efl svn://svn.openwrt.org/openwrt/feeds/efl #src-svn desktop svn://svn.openwrt.org/openwrt/feeds/desktop From 244e2944c6b2f4efaf7d4375951ae2cf503823cd Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 4 Nov 2009 21:53:49 +0000 Subject: [PATCH 078/288] mac80211: fill some important capabilities into ht_capab in the hostapd config git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18293 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/hostapd/files/hostapd.sh | 3 +++ package/mac80211/files/lib/wifi/mac80211.sh | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/package/hostapd/files/hostapd.sh b/package/hostapd/files/hostapd.sh index 0db5e0648..2210a46af 100644 --- a/package/hostapd/files/hostapd.sh +++ b/package/hostapd/files/hostapd.sh @@ -89,6 +89,9 @@ hostapd_setup_vif() { [ -n "$hwmode_11n" ] && { hwmode="$hwmode_11n" config_get ht_capab "$device" ht_capab + [ -n "$ht_capab" -a -n "${ht_capab%%\[*}" ] && { + ht_capab=`echo "[$ht_capab]" | sed -e 's, ,][,g'` + } } } cat > /var/run/hostapd-$ifname.conf < Date: Wed, 4 Nov 2009 21:54:47 +0000 Subject: [PATCH 079/288] mac80211: update to 2009-11-03 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18294 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/Makefile | 4 +- ...c80211_fix_incorrect_seq_num_hostapd.patch | 44 - .../201-ath5k-WAR-for-AR71xx-PCI-bug.patch | 2 +- .../301-rt2x00-Add-rt2x00soc-bus-module.patch | 249 - ...2x00-Implement-support-for-rt2800pci.patch | 5225 ----------------- ...h9k-fix-invalid-mac-address-handling.patch | 2 +- .../patches/404-ath_regd_optional.patch | 4 +- .../mac80211/patches/405-compile_fix.patch | 20 - package/mac80211/patches/406-ibss_fix.patch | 11 - .../patches/407-ath5k_compat_fix.patch | 22 - 10 files changed, 6 insertions(+), 5577 deletions(-) delete mode 100644 package/mac80211/patches/200-mac80211_fix_incorrect_seq_num_hostapd.patch delete mode 100644 package/mac80211/patches/301-rt2x00-Add-rt2x00soc-bus-module.patch delete mode 100644 package/mac80211/patches/302-rt2x00-Implement-support-for-rt2800pci.patch delete mode 100644 package/mac80211/patches/405-compile_fix.patch delete mode 100644 package/mac80211/patches/406-ibss_fix.patch delete mode 100644 package/mac80211/patches/407-ath5k_compat_fix.patch diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile index 1367d9a24..1766628bf 100644 --- a/package/mac80211/Makefile +++ b/package/mac80211/Makefile @@ -10,12 +10,12 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=2009-10-09 +PKG_VERSION:=2009-11-03 PKG_RELEASE:=1 PKG_SOURCE_URL:= \ http://www.orbit-lab.org/kernel/compat-wireless-2.6/2009/10 \ http://wireless.kernel.org/download/compat-wireless-2.6 -PKG_MD5SUM:=15c310560765cbc35ed930fb0e815284 +PKG_MD5SUM:=f8434790c9552abb9c98926d7ae616fe PKG_SOURCE:=compat-wireless-$(PKG_VERSION).tar.bz2 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION) diff --git a/package/mac80211/patches/200-mac80211_fix_incorrect_seq_num_hostapd.patch b/package/mac80211/patches/200-mac80211_fix_incorrect_seq_num_hostapd.patch deleted file mode 100644 index 5762c101f..000000000 --- a/package/mac80211/patches/200-mac80211_fix_incorrect_seq_num_hostapd.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 9b1ce526eb917c8b5c8497c327768130ee683392 Mon Sep 17 00:00:00 2001 -From: =?utf8?q?Bj=C3=B6rn=20Smedman?= -Date: Sat, 24 Oct 2009 20:55:09 +0200 -Subject: [PATCH] mac80211: fix for incorrect sequence number on hostapd injected frames -MIME-Version: 1.0 -Content-Type: text/plain; charset=utf8 -Content-Transfer-Encoding: 8bit - -When hostapd injects a frame, e.g. an authentication or association -response, mac80211 looks for a suitable access point virtual interface -to associate the frame with based on its source address. This makes it -possible e.g. to correctly assign sequence numbers to the frames. - -A small typo in the ethernet address comparison statement caused a -failure to find a suitable ap interface. Sequence numbers on such -frames where therefore left unassigned causing some clients -(especially windows-based 11b/g clients) to reject them and fail to -authenticate or associate with the access point. This patch fixes the -typo in the address comparison statement. - -Signed-off-by: Björn Smedman -Reviewed-by: Johannes Berg -Cc: stable@kernel.org -Signed-off-by: John W. Linville ---- - net/mac80211/tx.c | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c -index db4bda6..eaa4118 100644 ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -1445,7 +1445,7 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, - if (tmp_sdata->vif.type != NL80211_IFTYPE_AP) - continue; - if (compare_ether_addr(tmp_sdata->dev->dev_addr, -- hdr->addr2)) { -+ hdr->addr2) == 0) { - dev_hold(tmp_sdata->dev); - dev_put(sdata->dev); - sdata = tmp_sdata; --- -1.6.5.1 - diff --git a/package/mac80211/patches/201-ath5k-WAR-for-AR71xx-PCI-bug.patch b/package/mac80211/patches/201-ath5k-WAR-for-AR71xx-PCI-bug.patch index 90fba05ef..25e6f3ddd 100644 --- a/package/mac80211/patches/201-ath5k-WAR-for-AR71xx-PCI-bug.patch +++ b/package/mac80211/patches/201-ath5k-WAR-for-AR71xx-PCI-bug.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath5k/reset.c +++ b/drivers/net/wireless/ath/ath5k/reset.c -@@ -1372,10 +1372,18 @@ int ath5k_hw_reset(struct ath5k_hw *ah, +@@ -1357,10 +1357,18 @@ int ath5k_hw_reset(struct ath5k_hw *ah, * guess we can tweak it and see how it goes ;-) */ if (ah->ah_version != AR5K_AR5210) { diff --git a/package/mac80211/patches/301-rt2x00-Add-rt2x00soc-bus-module.patch b/package/mac80211/patches/301-rt2x00-Add-rt2x00soc-bus-module.patch deleted file mode 100644 index 570943216..000000000 --- a/package/mac80211/patches/301-rt2x00-Add-rt2x00soc-bus-module.patch +++ /dev/null @@ -1,249 +0,0 @@ -From 671e062837669b6d4a5e75d7d08ff485a7510e80 Mon Sep 17 00:00:00 2001 -From: Ivo van Doorn -Date: Sat, 8 Aug 2009 23:42:51 +0200 -Subject: [PATCH 1/3] rt2x00: Add rt2x00soc bus module - -Add new library module for SoC drivers. -This is needed to fully support the platform -driver part of rt2800pci. - -Based on original patch from Felix. - -Signed-off-by: Felix Fietkau -Signed-off-by: Ivo van Doorn ---- - drivers/net/wireless/rt2x00/Kconfig | 4 + - drivers/net/wireless/rt2x00/Makefile | 1 + - drivers/net/wireless/rt2x00/rt2x00soc.c | 159 +++++++++++++++++++++++++++++++ - drivers/net/wireless/rt2x00/rt2x00soc.h | 52 ++++++++++ - 4 files changed, 216 insertions(+), 0 deletions(-) - create mode 100644 drivers/net/wireless/rt2x00/rt2x00soc.c - create mode 100644 drivers/net/wireless/rt2x00/rt2x00soc.h - ---- a/drivers/net/wireless/rt2x00/Makefile -+++ b/drivers/net/wireless/rt2x00/Makefile -@@ -11,6 +11,7 @@ rt2x00lib-$(CONFIG_RT2X00_LIB_HT) += rt2 - - obj-$(CONFIG_RT2X00_LIB) += rt2x00lib.o - obj-$(CONFIG_RT2X00_LIB_PCI) += rt2x00pci.o -+obj-$(CONFIG_RT2X00_LIB_SOC) += rt2x00soc.o - obj-$(CONFIG_RT2X00_LIB_USB) += rt2x00usb.o - obj-$(CONFIG_RT2400PCI) += rt2400pci.o - obj-$(CONFIG_RT2500PCI) += rt2500pci.o ---- /dev/null -+++ b/drivers/net/wireless/rt2x00/rt2x00soc.c -@@ -0,0 +1,159 @@ -+/* -+ Copyright (C) 2004 - 2009 rt2x00 SourceForge Project -+ -+ -+ 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 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the -+ Free Software Foundation, Inc., -+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ */ -+ -+/* -+ Module: rt2x00soc -+ Abstract: rt2x00 generic soc device routines. -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include "rt2x00.h" -+#include "rt2x00soc.h" -+ -+static void rt2x00soc_free_reg(struct rt2x00_dev *rt2x00dev) -+{ -+ kfree(rt2x00dev->rf); -+ rt2x00dev->rf = NULL; -+ -+ kfree(rt2x00dev->eeprom); -+ rt2x00dev->eeprom = NULL; -+} -+ -+static int rt2x00soc_alloc_reg(struct rt2x00_dev *rt2x00dev) -+{ -+ struct platform_device *pdev = to_platform_device(rt2x00dev->dev); -+ struct resource *res; -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (!res) -+ return -ENODEV; -+ -+ rt2x00dev->csr.base = (void __iomem *)KSEG1ADDR(res->start); -+ if (!rt2x00dev->csr.base) -+ goto exit; -+ -+ rt2x00dev->eeprom = kzalloc(rt2x00dev->ops->eeprom_size, GFP_KERNEL); -+ if (!rt2x00dev->eeprom) -+ goto exit; -+ -+ rt2x00dev->rf = kzalloc(rt2x00dev->ops->rf_size, GFP_KERNEL); -+ if (!rt2x00dev->rf) -+ goto exit; -+ -+ return 0; -+ -+exit: -+ ERROR_PROBE("Failed to allocate registers.\n"); -+ rt2x00soc_free_reg(rt2x00dev); -+ -+ return -ENOMEM; -+} -+ -+int rt2x00soc_probe(struct platform_device *pdev, -+ const unsigned short chipset, -+ const struct rt2x00_ops *ops) -+{ -+ struct ieee80211_hw *hw; -+ struct rt2x00_dev *rt2x00dev; -+ int retval; -+ -+ hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw); -+ if (!hw) { -+ ERROR_PROBE("Failed to allocate hardware.\n"); -+ return -ENOMEM; -+ } -+ -+ platform_set_drvdata(pdev, hw); -+ -+ rt2x00dev = hw->priv; -+ rt2x00dev->dev = &pdev->dev; -+ rt2x00dev->ops = ops; -+ rt2x00dev->hw = hw; -+ rt2x00dev->irq = platform_get_irq(pdev, 0); -+ rt2x00dev->name = pdev->dev.driver->name; -+ -+ rt2x00_set_chip_rt(rt2x00dev, chipset); -+ -+ retval = rt2x00soc_alloc_reg(rt2x00dev); -+ if (retval) -+ goto exit_free_device; -+ -+ retval = rt2x00lib_probe_dev(rt2x00dev); -+ if (retval) -+ goto exit_free_reg; -+ -+ return 0; -+ -+exit_free_reg: -+ rt2x00soc_free_reg(rt2x00dev); -+ -+exit_free_device: -+ ieee80211_free_hw(hw); -+ -+ return retval; -+} -+ -+int rt2x00soc_remove(struct platform_device *pdev) -+{ -+ struct ieee80211_hw *hw = platform_get_drvdata(pdev); -+ struct rt2x00_dev *rt2x00dev = hw->priv; -+ -+ /* -+ * Free all allocated data. -+ */ -+ rt2x00lib_remove_dev(rt2x00dev); -+ rt2x00soc_free_reg(rt2x00dev); -+ ieee80211_free_hw(hw); -+ -+ return 0; -+} -+EXPORT_SYMBOL_GPL(rt2x00soc_remove); -+ -+#ifdef CONFIG_PM -+int rt2x00soc_suspend(struct platform_device *pdev, pm_message_t state) -+{ -+ struct ieee80211_hw *hw = platform_get_drvdata(pdev); -+ struct rt2x00_dev *rt2x00dev = hw->priv; -+ -+ return rt2x00lib_suspend(rt2x00dev, state); -+} -+EXPORT_SYMBOL_GPL(rt2x00soc_suspend); -+ -+int rt2x00soc_resume(struct platform_device *pdev) -+{ -+ struct ieee80211_hw *hw = platform_get_drvdata(pdev); -+ struct rt2x00_dev *rt2x00dev = hw->priv; -+ -+ return rt2x00lib_resume(rt2x00dev); -+} -+EXPORT_SYMBOL_GPL(rt2x00soc_resume); -+#endif /* CONFIG_PM */ -+ -+/* -+ * rt2x00soc module information. -+ */ -+MODULE_AUTHOR(DRV_PROJECT); -+MODULE_VERSION(DRV_VERSION); -+MODULE_DESCRIPTION("rt2x00 soc library"); -+MODULE_LICENSE("GPL"); ---- /dev/null -+++ b/drivers/net/wireless/rt2x00/rt2x00soc.h -@@ -0,0 +1,52 @@ -+/* -+ Copyright (C) 2004 - 2009 rt2x00 SourceForge Project -+ -+ -+ 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 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the -+ Free Software Foundation, Inc., -+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ */ -+ -+/* -+ Module: rt2x00soc -+ Abstract: Data structures for the rt2x00soc module. -+ */ -+ -+#ifndef RT2X00SOC_H -+#define RT2X00SOC_H -+ -+#define KSEG1ADDR(__ptr) __ptr -+ -+#define __rt2x00soc_probe(__chipset, __ops) \ -+static int __rt2x00soc_probe(struct platform_device *pdev) \ -+{ \ -+ return rt2x00soc_probe(pdev, (__chipset), (__ops)); \ -+} -+ -+/* -+ * SoC driver handlers. -+ */ -+int rt2x00soc_probe(struct platform_device *pdev, -+ const unsigned short chipset, -+ const struct rt2x00_ops *ops); -+int rt2x00soc_remove(struct platform_device *pdev); -+#ifdef CONFIG_PM -+int rt2x00soc_suspend(struct platform_device *pdev, pm_message_t state); -+int rt2x00soc_resume(struct platform_device *pdev); -+#else -+#define rt2x00soc_suspend NULL -+#define rt2x00soc_resume NULL -+#endif /* CONFIG_PM */ -+ -+#endif /* RT2X00SOC_H */ diff --git a/package/mac80211/patches/302-rt2x00-Implement-support-for-rt2800pci.patch b/package/mac80211/patches/302-rt2x00-Implement-support-for-rt2800pci.patch deleted file mode 100644 index 80ff246cf..000000000 --- a/package/mac80211/patches/302-rt2x00-Implement-support-for-rt2800pci.patch +++ /dev/null @@ -1,5225 +0,0 @@ -From 8dff6729a634d7cf223679d9a29a3df77927540c Mon Sep 17 00:00:00 2001 -From: Ivo van Doorn -Date: Sat, 8 Aug 2009 23:47:53 +0200 -Subject: [PATCH 2/3] rt2x00: Implement support for rt2800pci - -Add support for the rt2800pci chipset. - -Includes various patches from Luis, Mattias, Mark, Felix and Xose. - -Signed-off-by: Xose Vazquez Perez -Signed-off-by: Mattias Nissler -Signed-off-by: Mark Asselstine -Signed-off-by: Felix Fietkau -Signed-off-by: Luis Correia -Signed-off-by: Ivo van Doorn ---- - drivers/net/wireless/rt2x00/Kconfig | 26 + - drivers/net/wireless/rt2x00/Makefile | 1 + - drivers/net/wireless/rt2x00/rt2800pci.c | 3243 +++++++++++++++++++++++++++++++ - drivers/net/wireless/rt2x00/rt2800pci.h | 1929 ++++++++++++++++++ - drivers/net/wireless/rt2x00/rt2x00.h | 6 + - 5 files changed, 5205 insertions(+), 0 deletions(-) - create mode 100644 drivers/net/wireless/rt2x00/rt2800pci.c - create mode 100644 drivers/net/wireless/rt2x00/rt2800pci.h - ---- a/drivers/net/wireless/rt2x00/Makefile -+++ b/drivers/net/wireless/rt2x00/Makefile -@@ -16,6 +16,7 @@ obj-$(CONFIG_RT2X00_LIB_USB) += rt2x00u - obj-$(CONFIG_RT2400PCI) += rt2400pci.o - obj-$(CONFIG_RT2500PCI) += rt2500pci.o - obj-$(CONFIG_RT61PCI) += rt61pci.o -+obj-$(CONFIG_RT2800PCI) += rt2800pci.o - obj-$(CONFIG_RT2500USB) += rt2500usb.o - obj-$(CONFIG_RT73USB) += rt73usb.o - obj-$(CONFIG_RT2800USB) += rt2800usb.o ---- /dev/null -+++ b/drivers/net/wireless/rt2x00/rt2800pci.c -@@ -0,0 +1,3240 @@ -+/* -+ Copyright (C) 2004 - 2009 rt2x00 SourceForge Project -+ -+ -+ 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 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the -+ Free Software Foundation, Inc., -+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ */ -+ -+/* -+ Module: rt2800pci -+ Abstract: rt2800pci device specific routines. -+ Supported chipsets: RT2800E & RT2800ED. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "rt2x00.h" -+#include "rt2x00pci.h" -+#include "rt2x00soc.h" -+#include "rt2800pci.h" -+ -+#ifdef CONFIG_RT2800PCI_PCI_MODULE -+#define CONFIG_RT2800PCI_PCI -+#endif -+ -+#ifdef CONFIG_RT2800PCI_WISOC_MODULE -+#define CONFIG_RT2800PCI_WISOC -+#endif -+ -+/* -+ * Allow hardware encryption to be disabled. -+ */ -+static int modparam_nohwcrypt = 0; -+module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); -+MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); -+ -+/* -+ * Register access. -+ * BBP and RF register require indirect register access, -+ * and use the CSR registers PHY_CSR3 and PHY_CSR4 to achieve this. -+ * These indirect registers work with busy bits, -+ * and we will try maximal REGISTER_BUSY_COUNT times to access -+ * the register while taking a REGISTER_BUSY_DELAY us delay -+ * between each attampt. When the busy bit is still set at that time, -+ * the access attempt is considered to have failed, -+ * and we will print an error. -+ */ -+#define WAIT_FOR_BBP(__dev, __reg) \ -+ rt2x00pci_regbusy_read((__dev), BBP_CSR_CFG, BBP_CSR_CFG_BUSY, (__reg)) -+#define WAIT_FOR_RFCSR(__dev, __reg) \ -+ rt2x00pci_regbusy_read((__dev), RF_CSR_CFG, RF_CSR_CFG_BUSY, (__reg)) -+#define WAIT_FOR_RF(__dev, __reg) \ -+ rt2x00pci_regbusy_read((__dev), RF_CSR_CFG0, RF_CSR_CFG0_BUSY, (__reg)) -+#define WAIT_FOR_MCU(__dev, __reg) \ -+ rt2x00pci_regbusy_read((__dev), H2M_MAILBOX_CSR, \ -+ H2M_MAILBOX_CSR_OWNER, (__reg)) -+ -+static void rt2800pci_bbp_write(struct rt2x00_dev *rt2x00dev, -+ const unsigned int word, const u8 value) -+{ -+ u32 reg; -+ -+ mutex_lock(&rt2x00dev->csr_mutex); -+ -+ /* -+ * Wait until the BBP becomes available, afterwards we -+ * can safely write the new data into the register. -+ */ -+ if (WAIT_FOR_BBP(rt2x00dev, ®)) { -+ reg = 0; -+ rt2x00_set_field32(®, BBP_CSR_CFG_VALUE, value); -+ rt2x00_set_field32(®, BBP_CSR_CFG_REGNUM, word); -+ rt2x00_set_field32(®, BBP_CSR_CFG_BUSY, 1); -+ rt2x00_set_field32(®, BBP_CSR_CFG_READ_CONTROL, 0); -+ rt2x00_set_field32(®, BBP_CSR_CFG_BBP_RW_MODE, 1); -+ -+ rt2x00pci_register_write(rt2x00dev, BBP_CSR_CFG, reg); -+ } -+ -+ mutex_unlock(&rt2x00dev->csr_mutex); -+} -+ -+static void rt2800pci_bbp_read(struct rt2x00_dev *rt2x00dev, -+ const unsigned int word, u8 *value) -+{ -+ u32 reg; -+ -+ mutex_lock(&rt2x00dev->csr_mutex); -+ -+ /* -+ * Wait until the BBP becomes available, afterwards we -+ * can safely write the read request into the register. -+ * After the data has been written, we wait until hardware -+ * returns the correct value, if at any time the register -+ * doesn't become available in time, reg will be 0xffffffff -+ * which means we return 0xff to the caller. -+ */ -+ if (WAIT_FOR_BBP(rt2x00dev, ®)) { -+ reg = 0; -+ rt2x00_set_field32(®, BBP_CSR_CFG_REGNUM, word); -+ rt2x00_set_field32(®, BBP_CSR_CFG_BUSY, 1); -+ rt2x00_set_field32(®, BBP_CSR_CFG_READ_CONTROL, 1); -+ rt2x00_set_field32(®, BBP_CSR_CFG_BBP_RW_MODE, 1); -+ -+ rt2x00pci_register_write(rt2x00dev, BBP_CSR_CFG, reg); -+ -+ WAIT_FOR_BBP(rt2x00dev, ®); -+ } -+ -+ *value = rt2x00_get_field32(reg, BBP_CSR_CFG_VALUE); -+ -+ mutex_unlock(&rt2x00dev->csr_mutex); -+} -+ -+static void rt2800pci_rfcsr_write(struct rt2x00_dev *rt2x00dev, -+ const unsigned int word, const u8 value) -+{ -+ u32 reg; -+ -+ mutex_lock(&rt2x00dev->csr_mutex); -+ -+ /* -+ * Wait until the RFCSR becomes available, afterwards we -+ * can safely write the new data into the register. -+ */ -+ if (WAIT_FOR_RFCSR(rt2x00dev, ®)) { -+ reg = 0; -+ rt2x00_set_field32(®, RF_CSR_CFG_DATA, value); -+ rt2x00_set_field32(®, RF_CSR_CFG_REGNUM, word); -+ rt2x00_set_field32(®, RF_CSR_CFG_WRITE, 1); -+ rt2x00_set_field32(®, RF_CSR_CFG_BUSY, 1); -+ -+ rt2x00pci_register_write(rt2x00dev, RF_CSR_CFG, reg); -+ } -+ -+ mutex_unlock(&rt2x00dev->csr_mutex); -+} -+ -+static void rt2800pci_rfcsr_read(struct rt2x00_dev *rt2x00dev, -+ const unsigned int word, u8 *value) -+{ -+ u32 reg; -+ -+ mutex_lock(&rt2x00dev->csr_mutex); -+ -+ /* -+ * Wait until the RFCSR becomes available, afterwards we -+ * can safely write the read request into the register. -+ * After the data has been written, we wait until hardware -+ * returns the correct value, if at any time the register -+ * doesn't become available in time, reg will be 0xffffffff -+ * which means we return 0xff to the caller. -+ */ -+ if (WAIT_FOR_RFCSR(rt2x00dev, ®)) { -+ reg = 0; -+ rt2x00_set_field32(®, RF_CSR_CFG_REGNUM, word); -+ rt2x00_set_field32(®, RF_CSR_CFG_WRITE, 0); -+ rt2x00_set_field32(®, RF_CSR_CFG_BUSY, 1); -+ -+ rt2x00pci_register_write(rt2x00dev, RF_CSR_CFG, reg); -+ -+ WAIT_FOR_RFCSR(rt2x00dev, ®); -+ } -+ -+ *value = rt2x00_get_field32(reg, RF_CSR_CFG_DATA); -+ -+ mutex_unlock(&rt2x00dev->csr_mutex); -+} -+ -+static void rt2800pci_rf_write(struct rt2x00_dev *rt2x00dev, -+ const unsigned int word, const u32 value) -+{ -+ u32 reg; -+ -+ mutex_lock(&rt2x00dev->csr_mutex); -+ -+ /* -+ * Wait until the RF becomes available, afterwards we -+ * can safely write the new data into the register. -+ */ -+ if (WAIT_FOR_RF(rt2x00dev, ®)) { -+ reg = 0; -+ rt2x00_set_field32(®, RF_CSR_CFG0_REG_VALUE_BW, value); -+ rt2x00_set_field32(®, RF_CSR_CFG0_STANDBYMODE, 0); -+ rt2x00_set_field32(®, RF_CSR_CFG0_SEL, 0); -+ rt2x00_set_field32(®, RF_CSR_CFG0_BUSY, 1); -+ -+ rt2x00pci_register_write(rt2x00dev, RF_CSR_CFG0, reg); -+ rt2x00_rf_write(rt2x00dev, word, value); -+ } -+ -+ mutex_unlock(&rt2x00dev->csr_mutex); -+} -+ -+static void rt2800pci_mcu_request(struct rt2x00_dev *rt2x00dev, -+ const u8 command, const u8 token, -+ const u8 arg0, const u8 arg1) -+{ -+ u32 reg; -+ -+ /* -+ * RT2880 and RT3052 don't support MCU requests. -+ */ -+ if (rt2x00_rt(&rt2x00dev->chip, RT2880) || -+ rt2x00_rt(&rt2x00dev->chip, RT3052)) -+ return; -+ -+ mutex_lock(&rt2x00dev->csr_mutex); -+ -+ /* -+ * Wait until the MCU becomes available, afterwards we -+ * can safely write the new data into the register. -+ */ -+ if (WAIT_FOR_MCU(rt2x00dev, ®)) { -+ rt2x00_set_field32(®, H2M_MAILBOX_CSR_OWNER, 1); -+ rt2x00_set_field32(®, H2M_MAILBOX_CSR_CMD_TOKEN, token); -+ rt2x00_set_field32(®, H2M_MAILBOX_CSR_ARG0, arg0); -+ rt2x00_set_field32(®, H2M_MAILBOX_CSR_ARG1, arg1); -+ rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CSR, reg); -+ -+ reg = 0; -+ rt2x00_set_field32(®, HOST_CMD_CSR_HOST_COMMAND, command); -+ rt2x00pci_register_write(rt2x00dev, HOST_CMD_CSR, reg); -+ } -+ -+ mutex_unlock(&rt2x00dev->csr_mutex); -+} -+ -+static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token) -+{ -+ unsigned int i; -+ u32 reg; -+ -+ for (i = 0; i < 200; i++) { -+ rt2x00pci_register_read(rt2x00dev, H2M_MAILBOX_CID, ®); -+ -+ if ((rt2x00_get_field32(reg, H2M_MAILBOX_CID_CMD0) == token) || -+ (rt2x00_get_field32(reg, H2M_MAILBOX_CID_CMD1) == token) || -+ (rt2x00_get_field32(reg, H2M_MAILBOX_CID_CMD2) == token) || -+ (rt2x00_get_field32(reg, H2M_MAILBOX_CID_CMD3) == token)) -+ break; -+ -+ udelay(REGISTER_BUSY_DELAY); -+ } -+ -+ if (i == 200) -+ ERROR(rt2x00dev, "MCU request failed, no response from hardware\n"); -+ -+ rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); -+ rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); -+} -+ -+#ifdef CONFIG_RT2800PCI_WISOC -+static void rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) -+{ -+ u32 *base_addr = (u32 *) KSEG1ADDR(0x1F040000); /* XXX for RT3052 */ -+ -+ memcpy_fromio(rt2x00dev->eeprom, base_addr, EEPROM_SIZE); -+} -+#else -+static inline void rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) -+{ -+} -+#endif /* CONFIG_RT2800PCI_WISOC */ -+ -+#ifdef CONFIG_RT2800PCI_PCI -+static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom) -+{ -+ struct rt2x00_dev *rt2x00dev = eeprom->data; -+ u32 reg; -+ -+ rt2x00pci_register_read(rt2x00dev, E2PROM_CSR, ®); -+ -+ eeprom->reg_data_in = !!rt2x00_get_field32(reg, E2PROM_CSR_DATA_IN); -+ eeprom->reg_data_out = !!rt2x00_get_field32(reg, E2PROM_CSR_DATA_OUT); -+ eeprom->reg_data_clock = -+ !!rt2x00_get_field32(reg, E2PROM_CSR_DATA_CLOCK); -+ eeprom->reg_chip_select = -+ !!rt2x00_get_field32(reg, E2PROM_CSR_CHIP_SELECT); -+} -+ -+static void rt2800pci_eepromregister_write(struct eeprom_93cx6 *eeprom) -+{ -+ struct rt2x00_dev *rt2x00dev = eeprom->data; -+ u32 reg = 0; -+ -+ rt2x00_set_field32(®, E2PROM_CSR_DATA_IN, !!eeprom->reg_data_in); -+ rt2x00_set_field32(®, E2PROM_CSR_DATA_OUT, !!eeprom->reg_data_out); -+ rt2x00_set_field32(®, E2PROM_CSR_DATA_CLOCK, -+ !!eeprom->reg_data_clock); -+ rt2x00_set_field32(®, E2PROM_CSR_CHIP_SELECT, -+ !!eeprom->reg_chip_select); -+ -+ rt2x00pci_register_write(rt2x00dev, E2PROM_CSR, reg); -+} -+ -+static void rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev) -+{ -+ struct eeprom_93cx6 eeprom; -+ u32 reg; -+ -+ rt2x00pci_register_read(rt2x00dev, E2PROM_CSR, ®); -+ -+ eeprom.data = rt2x00dev; -+ eeprom.register_read = rt2800pci_eepromregister_read; -+ eeprom.register_write = rt2800pci_eepromregister_write; -+ eeprom.width = !rt2x00_get_field32(reg, E2PROM_CSR_TYPE) ? -+ PCI_EEPROM_WIDTH_93C46 : PCI_EEPROM_WIDTH_93C66; -+ eeprom.reg_data_in = 0; -+ eeprom.reg_data_out = 0; -+ eeprom.reg_data_clock = 0; -+ eeprom.reg_chip_select = 0; -+ -+ eeprom_93cx6_multiread(&eeprom, EEPROM_BASE, rt2x00dev->eeprom, -+ EEPROM_SIZE / sizeof(u16)); -+} -+#else -+static inline void rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev) -+{ -+} -+#endif /* CONFIG_RT2800PCI_PCI */ -+ -+#ifdef CONFIG_RT2X00_LIB_DEBUGFS -+static const struct rt2x00debug rt2800pci_rt2x00debug = { -+ .owner = THIS_MODULE, -+ .csr = { -+ .read = rt2x00pci_register_read, -+ .write = rt2x00pci_register_write, -+ .flags = RT2X00DEBUGFS_OFFSET, -+ .word_base = CSR_REG_BASE, -+ .word_size = sizeof(u32), -+ .word_count = CSR_REG_SIZE / sizeof(u32), -+ }, -+ .eeprom = { -+ .read = rt2x00_eeprom_read, -+ .write = rt2x00_eeprom_write, -+ .word_base = EEPROM_BASE, -+ .word_size = sizeof(u16), -+ .word_count = EEPROM_SIZE / sizeof(u16), -+ }, -+ .bbp = { -+ .read = rt2800pci_bbp_read, -+ .write = rt2800pci_bbp_write, -+ .word_base = BBP_BASE, -+ .word_size = sizeof(u8), -+ .word_count = BBP_SIZE / sizeof(u8), -+ }, -+ .rf = { -+ .read = rt2x00_rf_read, -+ .write = rt2800pci_rf_write, -+ .word_base = RF_BASE, -+ .word_size = sizeof(u32), -+ .word_count = RF_SIZE / sizeof(u32), -+ }, -+}; -+#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ -+ -+static int rt2800pci_rfkill_poll(struct rt2x00_dev *rt2x00dev) -+{ -+ u32 reg; -+ -+ rt2x00pci_register_read(rt2x00dev, GPIO_CTRL_CFG, ®); -+ return rt2x00_get_field32(reg, GPIO_CTRL_CFG_BIT2); -+} -+ -+#ifdef CONFIG_RT2X00_LIB_LEDS -+static void rt2800pci_brightness_set(struct led_classdev *led_cdev, -+ enum led_brightness brightness) -+{ -+ struct rt2x00_led *led = -+ container_of(led_cdev, struct rt2x00_led, led_dev); -+ unsigned int enabled = brightness != LED_OFF; -+ unsigned int bg_mode = -+ (enabled && led->rt2x00dev->curr_band == IEEE80211_BAND_2GHZ); -+ unsigned int polarity = -+ rt2x00_get_field16(led->rt2x00dev->led_mcu_reg, -+ EEPROM_FREQ_LED_POLARITY); -+ unsigned int ledmode = -+ rt2x00_get_field16(led->rt2x00dev->led_mcu_reg, -+ EEPROM_FREQ_LED_MODE); -+ -+ if (led->type == LED_TYPE_RADIO) { -+ rt2800pci_mcu_request(led->rt2x00dev, MCU_LED, 0xff, ledmode, -+ enabled ? 0x20 : 0); -+ } else if (led->type == LED_TYPE_ASSOC) { -+ rt2800pci_mcu_request(led->rt2x00dev, MCU_LED, 0xff, ledmode, -+ enabled ? (bg_mode ? 0x60 : 0xa0) : 0x20); -+ } else if (led->type == LED_TYPE_QUALITY) { -+ /* -+ * The brightness is divided into 6 levels (0 - 5), -+ * The specs tell us the following levels: -+ * 0, 1 ,3, 7, 15, 31 -+ * to determine the level in a simple way we can simply -+ * work with bitshifting: -+ * (1 << level) - 1 -+ */ -+ rt2800pci_mcu_request(led->rt2x00dev, MCU_LED_STRENGTH, 0xff, -+ (1 << brightness / (LED_FULL / 6)) - 1, -+ polarity); -+ } -+} -+ -+static int rt2800pci_blink_set(struct led_classdev *led_cdev, -+ unsigned long *delay_on, -+ unsigned long *delay_off) -+{ -+ struct rt2x00_led *led = -+ container_of(led_cdev, struct rt2x00_led, led_dev); -+ u32 reg; -+ -+ rt2x00pci_register_read(led->rt2x00dev, LED_CFG, ®); -+ rt2x00_set_field32(®, LED_CFG_ON_PERIOD, *delay_on); -+ rt2x00_set_field32(®, LED_CFG_OFF_PERIOD, *delay_off); -+ rt2x00_set_field32(®, LED_CFG_SLOW_BLINK_PERIOD, 3); -+ rt2x00_set_field32(®, LED_CFG_R_LED_MODE, 3); -+ rt2x00_set_field32(®, LED_CFG_G_LED_MODE, 12); -+ rt2x00_set_field32(®, LED_CFG_Y_LED_MODE, 3); -+ rt2x00_set_field32(®, LED_CFG_LED_POLAR, 1); -+ rt2x00pci_register_write(led->rt2x00dev, LED_CFG, reg); -+ -+ return 0; -+} -+ -+static void rt2800pci_init_led(struct rt2x00_dev *rt2x00dev, -+ struct rt2x00_led *led, -+ enum led_type type) -+{ -+ led->rt2x00dev = rt2x00dev; -+ led->type = type; -+ led->led_dev.brightness_set = rt2800pci_brightness_set; -+ led->led_dev.blink_set = rt2800pci_blink_set; -+ led->flags = LED_INITIALIZED; -+} -+#endif /* CONFIG_RT2X00_LIB_LEDS */ -+ -+/* -+ * Configuration handlers. -+ */ -+static void rt2800pci_config_wcid_attr(struct rt2x00_dev *rt2x00dev, -+ struct rt2x00lib_crypto *crypto, -+ struct ieee80211_key_conf *key) -+{ -+ struct mac_wcid_entry wcid_entry; -+ struct mac_iveiv_entry iveiv_entry; -+ u32 offset; -+ u32 reg; -+ -+ offset = MAC_WCID_ATTR_ENTRY(key->hw_key_idx); -+ -+ rt2x00pci_register_read(rt2x00dev, offset, ®); -+ rt2x00_set_field32(®, MAC_WCID_ATTRIBUTE_KEYTAB, -+ !!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)); -+ rt2x00_set_field32(®, MAC_WCID_ATTRIBUTE_CIPHER, -+ (crypto->cmd == SET_KEY) * crypto->cipher); -+ rt2x00_set_field32(®, MAC_WCID_ATTRIBUTE_BSS_IDX, -+ (crypto->cmd == SET_KEY) * crypto->bssidx); -+ rt2x00_set_field32(®, MAC_WCID_ATTRIBUTE_RX_WIUDF, crypto->cipher); -+ rt2x00pci_register_write(rt2x00dev, offset, reg); -+ -+ offset = MAC_IVEIV_ENTRY(key->hw_key_idx); -+ -+ memset(&iveiv_entry, 0, sizeof(iveiv_entry)); -+ if ((crypto->cipher == CIPHER_TKIP) || -+ (crypto->cipher == CIPHER_TKIP_NO_MIC) || -+ (crypto->cipher == CIPHER_AES)) -+ iveiv_entry.iv[3] |= 0x20; -+ iveiv_entry.iv[3] |= key->keyidx << 6; -+ rt2x00pci_register_multiwrite(rt2x00dev, offset, -+ &iveiv_entry, sizeof(iveiv_entry)); -+ -+ offset = MAC_WCID_ENTRY(key->hw_key_idx); -+ -+ memset(&wcid_entry, 0, sizeof(wcid_entry)); -+ if (crypto->cmd == SET_KEY) -+ memcpy(&wcid_entry, crypto->address, ETH_ALEN); -+ rt2x00pci_register_multiwrite(rt2x00dev, offset, -+ &wcid_entry, sizeof(wcid_entry)); -+} -+ -+static int rt2800pci_config_shared_key(struct rt2x00_dev *rt2x00dev, -+ struct rt2x00lib_crypto *crypto, -+ struct ieee80211_key_conf *key) -+{ -+ struct hw_key_entry key_entry; -+ struct rt2x00_field32 field; -+ u32 offset; -+ u32 reg; -+ -+ if (crypto->cmd == SET_KEY) { -+ key->hw_key_idx = (4 * crypto->bssidx) + key->keyidx; -+ -+ memcpy(key_entry.key, crypto->key, -+ sizeof(key_entry.key)); -+ memcpy(key_entry.tx_mic, crypto->tx_mic, -+ sizeof(key_entry.tx_mic)); -+ memcpy(key_entry.rx_mic, crypto->rx_mic, -+ sizeof(key_entry.rx_mic)); -+ -+ offset = SHARED_KEY_ENTRY(key->hw_key_idx); -+ rt2x00pci_register_multiwrite(rt2x00dev, offset, -+ &key_entry, sizeof(key_entry)); -+ } -+ -+ /* -+ * The cipher types are stored over multiple registers -+ * starting with SHARED_KEY_MODE_BASE each word will have -+ * 32 bits and contains the cipher types for 2 bssidx each. -+ * Using the correct defines correctly will cause overhead, -+ * so just calculate the correct offset. -+ */ -+ field.bit_offset = 4 * (key->hw_key_idx % 8); -+ field.bit_mask = 0x7 << field.bit_offset; -+ -+ offset = SHARED_KEY_MODE_ENTRY(key->hw_key_idx / 8); -+ -+ rt2x00pci_register_read(rt2x00dev, offset, ®); -+ rt2x00_set_field32(®, field, -+ (crypto->cmd == SET_KEY) * crypto->cipher); -+ rt2x00pci_register_write(rt2x00dev, offset, reg); -+ -+ /* -+ * Update WCID information -+ */ -+ rt2800pci_config_wcid_attr(rt2x00dev, crypto, key); -+ -+ return 0; -+} -+ -+static int rt2800pci_config_pairwise_key(struct rt2x00_dev *rt2x00dev, -+ struct rt2x00lib_crypto *crypto, -+ struct ieee80211_key_conf *key) -+{ -+ struct hw_key_entry key_entry; -+ u32 offset; -+ -+ if (crypto->cmd == SET_KEY) { -+ /* -+ * 1 pairwise key is possible per AID, this means that the AID -+ * equals our hw_key_idx. Make sure the WCID starts _after_ the -+ * last possible shared key entry. -+ */ -+ if (crypto->aid > (256 - 32)) -+ return -ENOSPC; -+ -+ key->hw_key_idx = 32 + crypto->aid; -+ -+ -+ memcpy(key_entry.key, crypto->key, -+ sizeof(key_entry.key)); -+ memcpy(key_entry.tx_mic, crypto->tx_mic, -+ sizeof(key_entry.tx_mic)); -+ memcpy(key_entry.rx_mic, crypto->rx_mic, -+ sizeof(key_entry.rx_mic)); -+ -+ offset = PAIRWISE_KEY_ENTRY(key->hw_key_idx); -+ rt2x00pci_register_multiwrite(rt2x00dev, offset, -+ &key_entry, sizeof(key_entry)); -+ } -+ -+ /* -+ * Update WCID information -+ */ -+ rt2800pci_config_wcid_attr(rt2x00dev, crypto, key); -+ -+ return 0; -+} -+ -+static void rt2800pci_config_filter(struct rt2x00_dev *rt2x00dev, -+ const unsigned int filter_flags) -+{ -+ u32 reg; -+ -+ /* -+ * Start configuration steps. -+ * Note that the version error will always be dropped -+ * and broadcast frames will always be accepted since -+ * there is no filter for it at this time. -+ */ -+ rt2x00pci_register_read(rt2x00dev, RX_FILTER_CFG, ®); -+ rt2x00_set_field32(®, RX_FILTER_CFG_DROP_CRC_ERROR, -+ !(filter_flags & FIF_FCSFAIL)); -+ rt2x00_set_field32(®, RX_FILTER_CFG_DROP_PHY_ERROR, -+ !(filter_flags & FIF_PLCPFAIL)); -+ rt2x00_set_field32(®, RX_FILTER_CFG_DROP_NOT_TO_ME, -+ !(filter_flags & FIF_PROMISC_IN_BSS)); -+ rt2x00_set_field32(®, RX_FILTER_CFG_DROP_NOT_MY_BSSD, 0); -+ rt2x00_set_field32(®, RX_FILTER_CFG_DROP_VER_ERROR, 1); -+ rt2x00_set_field32(®, RX_FILTER_CFG_DROP_MULTICAST, -+ !(filter_flags & FIF_ALLMULTI)); -+ rt2x00_set_field32(®, RX_FILTER_CFG_DROP_BROADCAST, 0); -+ rt2x00_set_field32(®, RX_FILTER_CFG_DROP_DUPLICATE, 1); -+ rt2x00_set_field32(®, RX_FILTER_CFG_DROP_CF_END_ACK, -+ !(filter_flags & FIF_CONTROL)); -+ rt2x00_set_field32(®, RX_FILTER_CFG_DROP_CF_END, -+ !(filter_flags & FIF_CONTROL)); -+ rt2x00_set_field32(®, RX_FILTER_CFG_DROP_ACK, -+ !(filter_flags & FIF_CONTROL)); -+ rt2x00_set_field32(®, RX_FILTER_CFG_DROP_CTS, -+ !(filter_flags & FIF_CONTROL)); -+ rt2x00_set_field32(®, RX_FILTER_CFG_DROP_RTS, -+ !(filter_flags & FIF_CONTROL)); -+ rt2x00_set_field32(®, RX_FILTER_CFG_DROP_PSPOLL, -+ !(filter_flags & FIF_PSPOLL)); -+ rt2x00_set_field32(®, RX_FILTER_CFG_DROP_BA, 1); -+ rt2x00_set_field32(®, RX_FILTER_CFG_DROP_BAR, 0); -+ rt2x00_set_field32(®, RX_FILTER_CFG_DROP_CNTL, -+ !(filter_flags & FIF_CONTROL)); -+ rt2x00pci_register_write(rt2x00dev, RX_FILTER_CFG, reg); -+} -+ -+static void rt2800pci_config_intf(struct rt2x00_dev *rt2x00dev, -+ struct rt2x00_intf *intf, -+ struct rt2x00intf_conf *conf, -+ const unsigned int flags) -+{ -+ unsigned int beacon_base; -+ u32 reg; -+ -+ if (flags & CONFIG_UPDATE_TYPE) { -+ /* -+ * Clear current synchronisation setup. -+ * For the Beacon base registers we only need to clear -+ * the first byte since that byte contains the VALID and OWNER -+ * bits which (when set to 0) will invalidate the entire beacon. -+ */ -+ beacon_base = HW_BEACON_OFFSET(intf->beacon->entry_idx); -+ rt2x00pci_register_write(rt2x00dev, beacon_base, 0); -+ -+ /* -+ * Enable synchronisation. -+ */ -+ rt2x00pci_register_read(rt2x00dev, BCN_TIME_CFG, ®); -+ rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 1); -+ rt2x00_set_field32(®, BCN_TIME_CFG_TSF_SYNC, conf->sync); -+ rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 1); -+ rt2x00pci_register_write(rt2x00dev, BCN_TIME_CFG, reg); -+ } -+ -+ if (flags & CONFIG_UPDATE_MAC) { -+ reg = le32_to_cpu(conf->mac[1]); -+ rt2x00_set_field32(®, MAC_ADDR_DW1_UNICAST_TO_ME_MASK, 0xff); -+ conf->mac[1] = cpu_to_le32(reg); -+ -+ rt2x00pci_register_multiwrite(rt2x00dev, MAC_ADDR_DW0, -+ conf->mac, sizeof(conf->mac)); -+ } -+ -+ if (flags & CONFIG_UPDATE_BSSID) { -+ reg = le32_to_cpu(conf->bssid[1]); -+ rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_ID_MASK, 0); -+ rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_BCN_NUM, 0); -+ conf->bssid[1] = cpu_to_le32(reg); -+ -+ rt2x00pci_register_multiwrite(rt2x00dev, MAC_BSSID_DW0, -+ conf->bssid, sizeof(conf->bssid)); -+ } -+} -+ -+static void rt2800pci_config_erp(struct rt2x00_dev *rt2x00dev, -+ struct rt2x00lib_erp *erp) -+{ -+ u32 reg; -+ -+ rt2x00pci_register_read(rt2x00dev, TX_TIMEOUT_CFG, ®); -+ rt2x00_set_field32(®, TX_TIMEOUT_CFG_RX_ACK_TIMEOUT, 0x20); -+ rt2x00pci_register_write(rt2x00dev, TX_TIMEOUT_CFG, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, AUTO_RSP_CFG, ®); -+ rt2x00_set_field32(®, AUTO_RSP_CFG_BAC_ACK_POLICY, -+ !!erp->short_preamble); -+ rt2x00_set_field32(®, AUTO_RSP_CFG_AR_PREAMBLE, -+ !!erp->short_preamble); -+ rt2x00pci_register_write(rt2x00dev, AUTO_RSP_CFG, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, OFDM_PROT_CFG, ®); -+ rt2x00_set_field32(®, OFDM_PROT_CFG_PROTECT_CTRL, -+ erp->cts_protection ? 2 : 0); -+ rt2x00pci_register_write(rt2x00dev, OFDM_PROT_CFG, reg); -+ -+ rt2x00pci_register_write(rt2x00dev, LEGACY_BASIC_RATE, -+ erp->basic_rates); -+ rt2x00pci_register_write(rt2x00dev, HT_BASIC_RATE, 0x00008003); -+ -+ rt2x00pci_register_read(rt2x00dev, BKOFF_SLOT_CFG, ®); -+ rt2x00_set_field32(®, BKOFF_SLOT_CFG_SLOT_TIME, erp->slot_time); -+ rt2x00_set_field32(®, BKOFF_SLOT_CFG_CC_DELAY_TIME, 2); -+ rt2x00pci_register_write(rt2x00dev, BKOFF_SLOT_CFG, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, XIFS_TIME_CFG, ®); -+ rt2x00_set_field32(®, XIFS_TIME_CFG_CCKM_SIFS_TIME, erp->sifs); -+ rt2x00_set_field32(®, XIFS_TIME_CFG_OFDM_SIFS_TIME, erp->sifs); -+ rt2x00_set_field32(®, XIFS_TIME_CFG_OFDM_XIFS_TIME, 4); -+ rt2x00_set_field32(®, XIFS_TIME_CFG_EIFS, erp->eifs); -+ rt2x00_set_field32(®, XIFS_TIME_CFG_BB_RXEND_ENABLE, 1); -+ rt2x00pci_register_write(rt2x00dev, XIFS_TIME_CFG, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, BCN_TIME_CFG, ®); -+ rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_INTERVAL, -+ erp->beacon_int * 16); -+ rt2x00pci_register_write(rt2x00dev, BCN_TIME_CFG, reg); -+} -+ -+static void rt2800pci_config_ant(struct rt2x00_dev *rt2x00dev, -+ struct antenna_setup *ant) -+{ -+ u8 r1; -+ u8 r3; -+ -+ rt2800pci_bbp_read(rt2x00dev, 1, &r1); -+ rt2800pci_bbp_read(rt2x00dev, 3, &r3); -+ -+ /* -+ * Configure the TX antenna. -+ */ -+ switch ((int)ant->tx) { -+ case 1: -+ rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 0); -+ rt2x00_set_field8(&r3, BBP3_RX_ANTENNA, 0); -+ break; -+ case 2: -+ rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 2); -+ break; -+ case 3: -+ /* Do nothing */ -+ break; -+ } -+ -+ /* -+ * Configure the RX antenna. -+ */ -+ switch ((int)ant->rx) { -+ case 1: -+ rt2x00_set_field8(&r3, BBP3_RX_ANTENNA, 0); -+ break; -+ case 2: -+ rt2x00_set_field8(&r3, BBP3_RX_ANTENNA, 1); -+ break; -+ case 3: -+ rt2x00_set_field8(&r3, BBP3_RX_ANTENNA, 2); -+ break; -+ } -+ -+ rt2800pci_bbp_write(rt2x00dev, 3, r3); -+ rt2800pci_bbp_write(rt2x00dev, 1, r1); -+} -+ -+static void rt2800pci_config_lna_gain(struct rt2x00_dev *rt2x00dev, -+ struct rt2x00lib_conf *libconf) -+{ -+ u16 eeprom; -+ short lna_gain; -+ -+ if (libconf->rf.channel <= 14) { -+ rt2x00_eeprom_read(rt2x00dev, EEPROM_LNA, &eeprom); -+ lna_gain = rt2x00_get_field16(eeprom, EEPROM_LNA_BG); -+ } else if (libconf->rf.channel <= 64) { -+ rt2x00_eeprom_read(rt2x00dev, EEPROM_LNA, &eeprom); -+ lna_gain = rt2x00_get_field16(eeprom, EEPROM_LNA_A0); -+ } else if (libconf->rf.channel <= 128) { -+ rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &eeprom); -+ lna_gain = rt2x00_get_field16(eeprom, EEPROM_RSSI_BG2_LNA_A1); -+ } else { -+ rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &eeprom); -+ lna_gain = rt2x00_get_field16(eeprom, EEPROM_RSSI_A2_LNA_A2); -+ } -+ -+ rt2x00dev->lna_gain = lna_gain; -+} -+ -+static void rt2800pci_config_channel_rt2x(struct rt2x00_dev *rt2x00dev, -+ struct ieee80211_conf *conf, -+ struct rf_channel *rf, -+ struct channel_info *info) -+{ -+ rt2x00_set_field32(&rf->rf4, RF4_FREQ_OFFSET, rt2x00dev->freq_offset); -+ -+ if (rt2x00dev->default_ant.tx == 1) -+ rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_TX1, 1); -+ -+ if (rt2x00dev->default_ant.rx == 1) { -+ rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_RX1, 1); -+ rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_RX2, 1); -+ } else if (rt2x00dev->default_ant.rx == 2) -+ rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_RX2, 1); -+ -+ if (rf->channel > 14) { -+ /* -+ * When TX power is below 0, we should increase it by 7 to -+ * make it a positive value (Minumum value is -7). -+ * However this means that values between 0 and 7 have -+ * double meaning, and we should set a 7DBm boost flag. -+ */ -+ rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A_7DBM_BOOST, -+ (info->tx_power1 >= 0)); -+ -+ if (info->tx_power1 < 0) -+ info->tx_power1 += 7; -+ -+ rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A, -+ TXPOWER_A_TO_DEV(info->tx_power1)); -+ -+ rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A_7DBM_BOOST, -+ (info->tx_power2 >= 0)); -+ -+ if (info->tx_power2 < 0) -+ info->tx_power2 += 7; -+ -+ rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A, -+ TXPOWER_A_TO_DEV(info->tx_power2)); -+ } else { -+ rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_G, -+ TXPOWER_G_TO_DEV(info->tx_power1)); -+ rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_G, -+ TXPOWER_G_TO_DEV(info->tx_power2)); -+ } -+ -+ rt2x00_set_field32(&rf->rf4, RF4_HT40, conf_is_ht40(conf)); -+ -+ rt2800pci_rf_write(rt2x00dev, 1, rf->rf1); -+ rt2800pci_rf_write(rt2x00dev, 2, rf->rf2); -+ rt2800pci_rf_write(rt2x00dev, 3, rf->rf3 & ~0x00000004); -+ rt2800pci_rf_write(rt2x00dev, 4, rf->rf4); -+ -+ udelay(200); -+ -+ rt2800pci_rf_write(rt2x00dev, 1, rf->rf1); -+ rt2800pci_rf_write(rt2x00dev, 2, rf->rf2); -+ rt2800pci_rf_write(rt2x00dev, 3, rf->rf3 | 0x00000004); -+ rt2800pci_rf_write(rt2x00dev, 4, rf->rf4); -+ -+ udelay(200); -+ -+ rt2800pci_rf_write(rt2x00dev, 1, rf->rf1); -+ rt2800pci_rf_write(rt2x00dev, 2, rf->rf2); -+ rt2800pci_rf_write(rt2x00dev, 3, rf->rf3 & ~0x00000004); -+ rt2800pci_rf_write(rt2x00dev, 4, rf->rf4); -+} -+ -+static void rt2800pci_config_channel_rt3x(struct rt2x00_dev *rt2x00dev, -+ struct ieee80211_conf *conf, -+ struct rf_channel *rf, -+ struct channel_info *info) -+{ -+ u8 rfcsr; -+ -+ rt2800pci_rfcsr_write(rt2x00dev, 2, rf->rf1); -+ rt2800pci_rfcsr_write(rt2x00dev, 2, rf->rf3); -+ -+ rt2800pci_rfcsr_read(rt2x00dev, 6, &rfcsr); -+ rt2x00_set_field8(&rfcsr, RFCSR6_R, rf->rf2); -+ rt2800pci_rfcsr_write(rt2x00dev, 6, rfcsr); -+ -+ rt2800pci_rfcsr_read(rt2x00dev, 12, &rfcsr); -+ rt2x00_set_field8(&rfcsr, RFCSR12_TX_POWER, -+ TXPOWER_G_TO_DEV(info->tx_power1)); -+ rt2800pci_rfcsr_write(rt2x00dev, 12, rfcsr); -+ -+ rt2800pci_rfcsr_read(rt2x00dev, 23, &rfcsr); -+ rt2x00_set_field8(&rfcsr, RFCSR23_FREQ_OFFSET, rt2x00dev->freq_offset); -+ rt2800pci_rfcsr_write(rt2x00dev, 23, rfcsr); -+ -+ rt2800pci_rfcsr_write(rt2x00dev, 24, -+ rt2x00dev->calibration[conf_is_ht40(conf)]); -+ -+ rt2800pci_rfcsr_read(rt2x00dev, 23, &rfcsr); -+ rt2x00_set_field8(&rfcsr, RFCSR7_RF_TUNING, 1); -+ rt2800pci_rfcsr_write(rt2x00dev, 23, rfcsr); -+} -+ -+static void rt2800pci_config_channel(struct rt2x00_dev *rt2x00dev, -+ struct ieee80211_conf *conf, -+ struct rf_channel *rf, -+ struct channel_info *info) -+{ -+ u32 reg; -+ unsigned int tx_pin; -+ u8 bbp; -+ -+ if (rt2x00_rev(&rt2x00dev->chip) != RT3070_VERSION) -+ rt2800pci_config_channel_rt2x(rt2x00dev, conf, rf, info); -+ else -+ rt2800pci_config_channel_rt3x(rt2x00dev, conf, rf, info); -+ -+ /* -+ * Change BBP settings -+ */ -+ rt2800pci_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); -+ rt2800pci_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); -+ rt2800pci_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); -+ rt2800pci_bbp_write(rt2x00dev, 86, 0); -+ -+ if (rf->channel <= 14) { -+ if (test_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags)) { -+ rt2800pci_bbp_write(rt2x00dev, 82, 0x62); -+ rt2800pci_bbp_write(rt2x00dev, 75, 0x46); -+ } else { -+ rt2800pci_bbp_write(rt2x00dev, 82, 0x84); -+ rt2800pci_bbp_write(rt2x00dev, 75, 0x50); -+ } -+ } else { -+ rt2800pci_bbp_write(rt2x00dev, 82, 0xf2); -+ -+ if (test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags)) -+ rt2800pci_bbp_write(rt2x00dev, 75, 0x46); -+ else -+ rt2800pci_bbp_write(rt2x00dev, 75, 0x50); -+ } -+ -+ rt2x00pci_register_read(rt2x00dev, TX_BAND_CFG, ®); -+ rt2x00_set_field32(®, TX_BAND_CFG_HT40_PLUS, conf_is_ht40_plus(conf)); -+ rt2x00_set_field32(®, TX_BAND_CFG_A, rf->channel > 14); -+ rt2x00_set_field32(®, TX_BAND_CFG_BG, rf->channel <= 14); -+ rt2x00pci_register_write(rt2x00dev, TX_BAND_CFG, reg); -+ -+ tx_pin = 0; -+ -+ /* Turn on unused PA or LNA when not using 1T or 1R */ -+ if (rt2x00dev->default_ant.tx != 1) { -+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A1_EN, 1); -+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN, 1); -+ } -+ -+ /* Turn on unused PA or LNA when not using 1T or 1R */ -+ if (rt2x00dev->default_ant.rx != 1) { -+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1); -+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1); -+ } -+ -+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1); -+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1); -+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1); -+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1); -+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN, rf->channel <= 14); -+ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A0_EN, rf->channel > 14); -+ -+ rt2x00pci_register_write(rt2x00dev, TX_PIN_CFG, tx_pin); -+ -+ rt2800pci_bbp_read(rt2x00dev, 4, &bbp); -+ rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf)); -+ rt2800pci_bbp_write(rt2x00dev, 4, bbp); -+ -+ rt2800pci_bbp_read(rt2x00dev, 3, &bbp); -+ rt2x00_set_field8(&bbp, BBP3_HT40_PLUS, conf_is_ht40_plus(conf)); -+ rt2800pci_bbp_write(rt2x00dev, 3, bbp); -+ -+ if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION) { -+ if (conf_is_ht40(conf)) { -+ rt2800pci_bbp_write(rt2x00dev, 69, 0x1a); -+ rt2800pci_bbp_write(rt2x00dev, 70, 0x0a); -+ rt2800pci_bbp_write(rt2x00dev, 73, 0x16); -+ } else { -+ rt2800pci_bbp_write(rt2x00dev, 69, 0x16); -+ rt2800pci_bbp_write(rt2x00dev, 70, 0x08); -+ rt2800pci_bbp_write(rt2x00dev, 73, 0x11); -+ } -+ } -+ -+ msleep(1); -+} -+ -+static void rt2800pci_config_txpower(struct rt2x00_dev *rt2x00dev, -+ const int txpower) -+{ -+ u32 reg; -+ u32 value = TXPOWER_G_TO_DEV(txpower); -+ u8 r1; -+ -+ rt2800pci_bbp_read(rt2x00dev, 1, &r1); -+ rt2x00_set_field8(®, BBP1_TX_POWER, 0); -+ rt2800pci_bbp_write(rt2x00dev, 1, r1); -+ -+ rt2x00pci_register_read(rt2x00dev, TX_PWR_CFG_0, ®); -+ rt2x00_set_field32(®, TX_PWR_CFG_0_1MBS, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_0_2MBS, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_0_55MBS, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_0_11MBS, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_0_6MBS, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_0_9MBS, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_0_12MBS, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_0_18MBS, value); -+ rt2x00pci_register_write(rt2x00dev, TX_PWR_CFG_0, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, TX_PWR_CFG_1, ®); -+ rt2x00_set_field32(®, TX_PWR_CFG_1_24MBS, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_1_36MBS, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_1_48MBS, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_1_54MBS, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_1_MCS0, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_1_MCS1, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_1_MCS2, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_1_MCS3, value); -+ rt2x00pci_register_write(rt2x00dev, TX_PWR_CFG_1, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, TX_PWR_CFG_2, ®); -+ rt2x00_set_field32(®, TX_PWR_CFG_2_MCS4, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_2_MCS5, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_2_MCS6, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_2_MCS7, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_2_MCS8, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_2_MCS9, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_2_MCS10, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_2_MCS11, value); -+ rt2x00pci_register_write(rt2x00dev, TX_PWR_CFG_2, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, TX_PWR_CFG_3, ®); -+ rt2x00_set_field32(®, TX_PWR_CFG_3_MCS12, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_3_MCS13, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_3_MCS14, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_3_MCS15, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_3_UKNOWN1, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_3_UKNOWN2, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_3_UKNOWN3, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_3_UKNOWN4, value); -+ rt2x00pci_register_write(rt2x00dev, TX_PWR_CFG_3, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, TX_PWR_CFG_4, ®); -+ rt2x00_set_field32(®, TX_PWR_CFG_4_UKNOWN5, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_4_UKNOWN6, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_4_UKNOWN7, value); -+ rt2x00_set_field32(®, TX_PWR_CFG_4_UKNOWN8, value); -+ rt2x00pci_register_write(rt2x00dev, TX_PWR_CFG_4, reg); -+} -+ -+static void rt2800pci_config_retry_limit(struct rt2x00_dev *rt2x00dev, -+ struct rt2x00lib_conf *libconf) -+{ -+ u32 reg; -+ -+ rt2x00pci_register_read(rt2x00dev, TX_RTY_CFG, ®); -+ rt2x00_set_field32(®, TX_RTY_CFG_SHORT_RTY_LIMIT, -+ libconf->conf->short_frame_max_tx_count); -+ rt2x00_set_field32(®, TX_RTY_CFG_LONG_RTY_LIMIT, -+ libconf->conf->long_frame_max_tx_count); -+ rt2x00_set_field32(®, TX_RTY_CFG_LONG_RTY_THRE, 2000); -+ rt2x00_set_field32(®, TX_RTY_CFG_NON_AGG_RTY_MODE, 0); -+ rt2x00_set_field32(®, TX_RTY_CFG_AGG_RTY_MODE, 0); -+ rt2x00_set_field32(®, TX_RTY_CFG_TX_AUTO_FB_ENABLE, 1); -+ rt2x00pci_register_write(rt2x00dev, TX_RTY_CFG, reg); -+} -+ -+static void rt2800pci_config_ps(struct rt2x00_dev *rt2x00dev, -+ struct rt2x00lib_conf *libconf) -+{ -+ enum dev_state state = -+ (libconf->conf->flags & IEEE80211_CONF_PS) ? -+ STATE_SLEEP : STATE_AWAKE; -+ u32 reg; -+ -+ if (state == STATE_SLEEP) { -+ rt2x00pci_register_write(rt2x00dev, AUTOWAKEUP_CFG, 0); -+ -+ rt2x00pci_register_read(rt2x00dev, AUTOWAKEUP_CFG, ®); -+ rt2x00_set_field32(®, AUTOWAKEUP_CFG_AUTO_LEAD_TIME, 5); -+ rt2x00_set_field32(®, AUTOWAKEUP_CFG_TBCN_BEFORE_WAKE, -+ libconf->conf->listen_interval - 1); -+ rt2x00_set_field32(®, AUTOWAKEUP_CFG_AUTOWAKE, 1); -+ rt2x00pci_register_write(rt2x00dev, AUTOWAKEUP_CFG, reg); -+ -+ rt2x00dev->ops->lib->set_device_state(rt2x00dev, state); -+ } else { -+ rt2x00dev->ops->lib->set_device_state(rt2x00dev, state); -+ -+ rt2x00pci_register_read(rt2x00dev, AUTOWAKEUP_CFG, ®); -+ rt2x00_set_field32(®, AUTOWAKEUP_CFG_AUTO_LEAD_TIME, 0); -+ rt2x00_set_field32(®, AUTOWAKEUP_CFG_TBCN_BEFORE_WAKE, 0); -+ rt2x00_set_field32(®, AUTOWAKEUP_CFG_AUTOWAKE, 0); -+ rt2x00pci_register_write(rt2x00dev, AUTOWAKEUP_CFG, reg); -+ } -+} -+ -+static void rt2800pci_config(struct rt2x00_dev *rt2x00dev, -+ struct rt2x00lib_conf *libconf, -+ const unsigned int flags) -+{ -+ /* Always recalculate LNA gain before changing configuration */ -+ rt2800pci_config_lna_gain(rt2x00dev, libconf); -+ -+ if (flags & IEEE80211_CONF_CHANGE_CHANNEL) -+ rt2800pci_config_channel(rt2x00dev, libconf->conf, -+ &libconf->rf, &libconf->channel); -+ if (flags & IEEE80211_CONF_CHANGE_POWER) -+ rt2800pci_config_txpower(rt2x00dev, libconf->conf->power_level); -+ if (flags & IEEE80211_CONF_CHANGE_RETRY_LIMITS) -+ rt2800pci_config_retry_limit(rt2x00dev, libconf); -+ if (flags & IEEE80211_CONF_CHANGE_PS) -+ rt2800pci_config_ps(rt2x00dev, libconf); -+} -+ -+/* -+ * Link tuning -+ */ -+static void rt2800pci_link_stats(struct rt2x00_dev *rt2x00dev, -+ struct link_qual *qual) -+{ -+ u32 reg; -+ -+ /* -+ * Update FCS error count from register. -+ */ -+ rt2x00pci_register_read(rt2x00dev, RX_STA_CNT0, ®); -+ qual->rx_failed = rt2x00_get_field32(reg, RX_STA_CNT0_CRC_ERR); -+} -+ -+static u8 rt2800pci_get_default_vgc(struct rt2x00_dev *rt2x00dev) -+{ -+ if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) -+ return 0x2e + rt2x00dev->lna_gain; -+ -+ if (!test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags)) -+ return 0x32 + (rt2x00dev->lna_gain * 5) / 3; -+ else -+ return 0x3a + (rt2x00dev->lna_gain * 5) / 3; -+} -+ -+static inline void rt2800pci_set_vgc(struct rt2x00_dev *rt2x00dev, -+ struct link_qual *qual, u8 vgc_level) -+{ -+ if (qual->vgc_level != vgc_level) { -+ rt2800pci_bbp_write(rt2x00dev, 66, vgc_level); -+ qual->vgc_level = vgc_level; -+ qual->vgc_level_reg = vgc_level; -+ } -+} -+ -+static void rt2800pci_reset_tuner(struct rt2x00_dev *rt2x00dev, -+ struct link_qual *qual) -+{ -+ rt2800pci_set_vgc(rt2x00dev, qual, -+ rt2800pci_get_default_vgc(rt2x00dev)); -+} -+ -+static void rt2800pci_link_tuner(struct rt2x00_dev *rt2x00dev, -+ struct link_qual *qual, const u32 count) -+{ -+ if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION) -+ return; -+ -+ /* -+ * When RSSI is better then -80 increase VGC level with 0x10 -+ */ -+ rt2800pci_set_vgc(rt2x00dev, qual, -+ rt2800pci_get_default_vgc(rt2x00dev) + -+ ((qual->rssi > -80) * 0x10)); -+} -+ -+/* -+ * Firmware functions -+ */ -+static char *rt2800pci_get_firmware_name(struct rt2x00_dev *rt2x00dev) -+{ -+ return FIRMWARE_RT2860; -+} -+ -+static int rt2800pci_check_firmware(struct rt2x00_dev *rt2x00dev, -+ const u8 *data, const size_t len) -+{ -+ u16 fw_crc; -+ u16 crc; -+ -+ /* -+ * Only support 8kb firmware files. -+ */ -+ if (len != 8192) -+ return FW_BAD_LENGTH; -+ -+ /* -+ * The last 2 bytes in the firmware array are the crc checksum itself, -+ * this means that we should never pass those 2 bytes to the crc -+ * algorithm. -+ */ -+ fw_crc = (data[len - 2] << 8 | data[len - 1]); -+ -+ /* -+ * Use the crc ccitt algorithm. -+ * This will return the same value as the legacy driver which -+ * used bit ordering reversion on the both the firmware bytes -+ * before input input as well as on the final output. -+ * Obviously using crc ccitt directly is much more efficient. -+ */ -+ crc = crc_ccitt(~0, data, len - 2); -+ -+ /* -+ * There is a small difference between the crc-itu-t + bitrev and -+ * the crc-ccitt crc calculation. In the latter method the 2 bytes -+ * will be swapped, use swab16 to convert the crc to the correct -+ * value. -+ */ -+ crc = swab16(crc); -+ -+ return (fw_crc == crc) ? FW_OK : FW_BAD_CRC; -+} -+ -+static int rt2800pci_load_firmware(struct rt2x00_dev *rt2x00dev, -+ const u8 *data, const size_t len) -+{ -+ unsigned int i; -+ u32 reg; -+ -+ /* -+ * Wait for stable hardware. -+ */ -+ for (i = 0; i < REGISTER_BUSY_COUNT; i++) { -+ rt2x00pci_register_read(rt2x00dev, MAC_CSR0, ®); -+ if (reg && reg != ~0) -+ break; -+ msleep(1); -+ } -+ -+ if (i == REGISTER_BUSY_COUNT) { -+ ERROR(rt2x00dev, "Unstable hardware.\n"); -+ return -EBUSY; -+ } -+ -+ rt2x00pci_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000002); -+ rt2x00pci_register_write(rt2x00dev, AUTOWAKEUP_CFG, 0x00000000); -+ -+ /* -+ * Disable DMA, will be reenabled later when enabling -+ * the radio. -+ */ -+ rt2x00pci_register_read(rt2x00dev, WPDMA_GLO_CFG, ®); -+ rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0); -+ rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_DMA_BUSY, 0); -+ rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0); -+ rt2x00_set_field32(®, WPDMA_GLO_CFG_RX_DMA_BUSY, 0); -+ rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1); -+ rt2x00pci_register_write(rt2x00dev, WPDMA_GLO_CFG, reg); -+ -+ /* -+ * enable Host program ram write selection -+ */ -+ reg = 0; -+ rt2x00_set_field32(®, PBF_SYS_CTRL_HOST_RAM_WRITE, 1); -+ rt2x00pci_register_write(rt2x00dev, PBF_SYS_CTRL, reg); -+ -+ /* -+ * Write firmware to device. -+ */ -+ rt2x00pci_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, -+ data, len); -+ -+ rt2x00pci_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000); -+ rt2x00pci_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00001); -+ -+ /* -+ * Wait for device to stabilize. -+ */ -+ for (i = 0; i < REGISTER_BUSY_COUNT; i++) { -+ rt2x00pci_register_read(rt2x00dev, PBF_SYS_CTRL, ®); -+ if (rt2x00_get_field32(reg, PBF_SYS_CTRL_READY)) -+ break; -+ msleep(1); -+ } -+ -+ if (i == REGISTER_BUSY_COUNT) { -+ ERROR(rt2x00dev, "PBF system register not ready.\n"); -+ return -EBUSY; -+ } -+ -+ /* -+ * Disable interrupts -+ */ -+ rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_IRQ_OFF); -+ -+ /* -+ * Initialize BBP R/W access agent -+ */ -+ rt2x00pci_register_write(rt2x00dev, H2M_BBP_AGENT, 0); -+ rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); -+ -+ return 0; -+} -+ -+/* -+ * Initialization functions. -+ */ -+static bool rt2800pci_get_entry_state(struct queue_entry *entry) -+{ -+ struct queue_entry_priv_pci *entry_priv = entry->priv_data; -+ u32 word; -+ -+ if (entry->queue->qid == QID_RX) { -+ rt2x00_desc_read(entry_priv->desc, 1, &word); -+ -+ return (!rt2x00_get_field32(word, RXD_W1_DMA_DONE)); -+ } else { -+ rt2x00_desc_read(entry_priv->desc, 1, &word); -+ -+ return (!rt2x00_get_field32(word, TXD_W1_DMA_DONE)); -+ } -+} -+ -+static void rt2800pci_clear_entry(struct queue_entry *entry) -+{ -+ struct queue_entry_priv_pci *entry_priv = entry->priv_data; -+ struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); -+ u32 word; -+ -+ if (entry->queue->qid == QID_RX) { -+ rt2x00_desc_read(entry_priv->desc, 0, &word); -+ rt2x00_set_field32(&word, RXD_W0_SDP0, skbdesc->skb_dma); -+ rt2x00_desc_write(entry_priv->desc, 0, word); -+ -+ rt2x00_desc_read(entry_priv->desc, 1, &word); -+ rt2x00_set_field32(&word, RXD_W1_DMA_DONE, 0); -+ rt2x00_desc_write(entry_priv->desc, 1, word); -+ } else { -+ rt2x00_desc_read(entry_priv->desc, 1, &word); -+ rt2x00_set_field32(&word, TXD_W1_DMA_DONE, 1); -+ rt2x00_desc_write(entry_priv->desc, 1, word); -+ } -+} -+ -+static int rt2800pci_init_queues(struct rt2x00_dev *rt2x00dev) -+{ -+ struct queue_entry_priv_pci *entry_priv; -+ u32 reg; -+ -+ /* -+ * Initialize registers. -+ */ -+ entry_priv = rt2x00dev->tx[0].entries[0].priv_data; -+ rt2x00pci_register_write(rt2x00dev, TX_BASE_PTR0, entry_priv->desc_dma); -+ rt2x00pci_register_write(rt2x00dev, TX_MAX_CNT0, rt2x00dev->tx[0].limit); -+ rt2x00pci_register_write(rt2x00dev, TX_CTX_IDX0, 0); -+ rt2x00pci_register_write(rt2x00dev, TX_DTX_IDX0, 0); -+ -+ entry_priv = rt2x00dev->tx[1].entries[0].priv_data; -+ rt2x00pci_register_write(rt2x00dev, TX_BASE_PTR1, entry_priv->desc_dma); -+ rt2x00pci_register_write(rt2x00dev, TX_MAX_CNT1, rt2x00dev->tx[1].limit); -+ rt2x00pci_register_write(rt2x00dev, TX_CTX_IDX1, 0); -+ rt2x00pci_register_write(rt2x00dev, TX_DTX_IDX1, 0); -+ -+ entry_priv = rt2x00dev->tx[2].entries[0].priv_data; -+ rt2x00pci_register_write(rt2x00dev, TX_BASE_PTR2, entry_priv->desc_dma); -+ rt2x00pci_register_write(rt2x00dev, TX_MAX_CNT2, rt2x00dev->tx[2].limit); -+ rt2x00pci_register_write(rt2x00dev, TX_CTX_IDX2, 0); -+ rt2x00pci_register_write(rt2x00dev, TX_DTX_IDX2, 0); -+ -+ entry_priv = rt2x00dev->tx[3].entries[0].priv_data; -+ rt2x00pci_register_write(rt2x00dev, TX_BASE_PTR3, entry_priv->desc_dma); -+ rt2x00pci_register_write(rt2x00dev, TX_MAX_CNT3, rt2x00dev->tx[3].limit); -+ rt2x00pci_register_write(rt2x00dev, TX_CTX_IDX3, 0); -+ rt2x00pci_register_write(rt2x00dev, TX_DTX_IDX3, 0); -+ -+ entry_priv = rt2x00dev->rx->entries[0].priv_data; -+ rt2x00pci_register_write(rt2x00dev, RX_BASE_PTR, entry_priv->desc_dma); -+ rt2x00pci_register_write(rt2x00dev, RX_MAX_CNT, rt2x00dev->rx[0].limit); -+ rt2x00pci_register_write(rt2x00dev, RX_CRX_IDX, rt2x00dev->rx[0].limit - 1); -+ rt2x00pci_register_write(rt2x00dev, RX_DRX_IDX, 0); -+ -+ /* -+ * Enable global DMA configuration -+ */ -+ rt2x00pci_register_read(rt2x00dev, WPDMA_GLO_CFG, ®); -+ rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0); -+ rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0); -+ rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1); -+ rt2x00pci_register_write(rt2x00dev, WPDMA_GLO_CFG, reg); -+ -+ rt2x00pci_register_write(rt2x00dev, DELAY_INT_CFG, 0); -+ -+ return 0; -+} -+ -+static int rt2800pci_init_registers(struct rt2x00_dev *rt2x00dev) -+{ -+ u32 reg; -+ unsigned int i; -+ -+ rt2x00pci_register_read(rt2x00dev, WPDMA_RST_IDX, ®); -+ rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX0, 1); -+ rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX1, 1); -+ rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX2, 1); -+ rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX3, 1); -+ rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX4, 1); -+ rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX5, 1); -+ rt2x00_set_field32(®, WPDMA_RST_IDX_DRX_IDX0, 1); -+ rt2x00pci_register_write(rt2x00dev, WPDMA_RST_IDX, reg); -+ -+ rt2x00pci_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e1f); -+ rt2x00pci_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e00); -+ -+ rt2x00pci_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003); -+ -+ rt2x00pci_register_read(rt2x00dev, MAC_SYS_CTRL, ®); -+ rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_CSR, 1); -+ rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_BBP, 1); -+ rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, reg); -+ -+ rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00000000); -+ -+ rt2x00pci_register_read(rt2x00dev, BCN_OFFSET0, ®); -+ rt2x00_set_field32(®, BCN_OFFSET0_BCN0, 0xe0); /* 0x3800 */ -+ rt2x00_set_field32(®, BCN_OFFSET0_BCN1, 0xe8); /* 0x3a00 */ -+ rt2x00_set_field32(®, BCN_OFFSET0_BCN2, 0xf0); /* 0x3c00 */ -+ rt2x00_set_field32(®, BCN_OFFSET0_BCN3, 0xf8); /* 0x3e00 */ -+ rt2x00pci_register_write(rt2x00dev, BCN_OFFSET0, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, BCN_OFFSET1, ®); -+ rt2x00_set_field32(®, BCN_OFFSET1_BCN4, 0xc8); /* 0x3200 */ -+ rt2x00_set_field32(®, BCN_OFFSET1_BCN5, 0xd0); /* 0x3400 */ -+ rt2x00_set_field32(®, BCN_OFFSET1_BCN6, 0x77); /* 0x1dc0 */ -+ rt2x00_set_field32(®, BCN_OFFSET1_BCN7, 0x6f); /* 0x1bc0 */ -+ rt2x00pci_register_write(rt2x00dev, BCN_OFFSET1, reg); -+ -+ rt2x00pci_register_write(rt2x00dev, LEGACY_BASIC_RATE, 0x0000013f); -+ rt2x00pci_register_write(rt2x00dev, HT_BASIC_RATE, 0x00008003); -+ -+ rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00000000); -+ -+ rt2x00pci_register_read(rt2x00dev, BCN_TIME_CFG, ®); -+ rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_INTERVAL, 0); -+ rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 0); -+ rt2x00_set_field32(®, BCN_TIME_CFG_TSF_SYNC, 0); -+ rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 0); -+ rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 0); -+ rt2x00_set_field32(®, BCN_TIME_CFG_TX_TIME_COMPENSATE, 0); -+ rt2x00pci_register_write(rt2x00dev, BCN_TIME_CFG, reg); -+ -+ rt2x00pci_register_write(rt2x00dev, TX_SW_CFG0, 0x00000000); -+ rt2x00pci_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606); -+ -+ rt2x00pci_register_read(rt2x00dev, TX_LINK_CFG, ®); -+ rt2x00_set_field32(®, TX_LINK_CFG_REMOTE_MFB_LIFETIME, 32); -+ rt2x00_set_field32(®, TX_LINK_CFG_MFB_ENABLE, 0); -+ rt2x00_set_field32(®, TX_LINK_CFG_REMOTE_UMFS_ENABLE, 0); -+ rt2x00_set_field32(®, TX_LINK_CFG_TX_MRQ_EN, 0); -+ rt2x00_set_field32(®, TX_LINK_CFG_TX_RDG_EN, 0); -+ rt2x00_set_field32(®, TX_LINK_CFG_TX_CF_ACK_EN, 1); -+ rt2x00_set_field32(®, TX_LINK_CFG_REMOTE_MFB, 0); -+ rt2x00_set_field32(®, TX_LINK_CFG_REMOTE_MFS, 0); -+ rt2x00pci_register_write(rt2x00dev, TX_LINK_CFG, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, TX_TIMEOUT_CFG, ®); -+ rt2x00_set_field32(®, TX_TIMEOUT_CFG_MPDU_LIFETIME, 9); -+ rt2x00_set_field32(®, TX_TIMEOUT_CFG_TX_OP_TIMEOUT, 10); -+ rt2x00pci_register_write(rt2x00dev, TX_TIMEOUT_CFG, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, MAX_LEN_CFG, ®); -+ rt2x00_set_field32(®, MAX_LEN_CFG_MAX_MPDU, AGGREGATION_SIZE); -+ if (rt2x00_rev(&rt2x00dev->chip) >= RT2880E_VERSION && -+ rt2x00_rev(&rt2x00dev->chip) < RT3070_VERSION) -+ rt2x00_set_field32(®, MAX_LEN_CFG_MAX_PSDU, 2); -+ else -+ rt2x00_set_field32(®, MAX_LEN_CFG_MAX_PSDU, 1); -+ rt2x00_set_field32(®, MAX_LEN_CFG_MIN_PSDU, 0); -+ rt2x00_set_field32(®, MAX_LEN_CFG_MIN_MPDU, 0); -+ rt2x00pci_register_write(rt2x00dev, MAX_LEN_CFG, reg); -+ -+ rt2x00pci_register_write(rt2x00dev, PBF_MAX_PCNT, 0x1f3fbf9f); -+ -+ rt2x00pci_register_read(rt2x00dev, AUTO_RSP_CFG, ®); -+ rt2x00_set_field32(®, AUTO_RSP_CFG_AUTORESPONDER, 1); -+ rt2x00_set_field32(®, AUTO_RSP_CFG_CTS_40_MMODE, 0); -+ rt2x00_set_field32(®, AUTO_RSP_CFG_CTS_40_MREF, 0); -+ rt2x00_set_field32(®, AUTO_RSP_CFG_DUAL_CTS_EN, 0); -+ rt2x00_set_field32(®, AUTO_RSP_CFG_ACK_CTS_PSM_BIT, 0); -+ rt2x00pci_register_write(rt2x00dev, AUTO_RSP_CFG, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, CCK_PROT_CFG, ®); -+ rt2x00_set_field32(®, CCK_PROT_CFG_PROTECT_RATE, 8); -+ rt2x00_set_field32(®, CCK_PROT_CFG_PROTECT_CTRL, 0); -+ rt2x00_set_field32(®, CCK_PROT_CFG_PROTECT_NAV, 1); -+ rt2x00_set_field32(®, CCK_PROT_CFG_TX_OP_ALLOW_CCK, 1); -+ rt2x00_set_field32(®, CCK_PROT_CFG_TX_OP_ALLOW_OFDM, 1); -+ rt2x00_set_field32(®, CCK_PROT_CFG_TX_OP_ALLOW_MM20, 1); -+ rt2x00_set_field32(®, CCK_PROT_CFG_TX_OP_ALLOW_MM40, 1); -+ rt2x00_set_field32(®, CCK_PROT_CFG_TX_OP_ALLOW_GF20, 1); -+ rt2x00_set_field32(®, CCK_PROT_CFG_TX_OP_ALLOW_GF40, 1); -+ rt2x00pci_register_write(rt2x00dev, CCK_PROT_CFG, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, OFDM_PROT_CFG, ®); -+ rt2x00_set_field32(®, OFDM_PROT_CFG_PROTECT_RATE, 8); -+ rt2x00_set_field32(®, OFDM_PROT_CFG_PROTECT_CTRL, 0); -+ rt2x00_set_field32(®, OFDM_PROT_CFG_PROTECT_NAV, 1); -+ rt2x00_set_field32(®, OFDM_PROT_CFG_TX_OP_ALLOW_CCK, 1); -+ rt2x00_set_field32(®, OFDM_PROT_CFG_TX_OP_ALLOW_OFDM, 1); -+ rt2x00_set_field32(®, OFDM_PROT_CFG_TX_OP_ALLOW_MM20, 1); -+ rt2x00_set_field32(®, OFDM_PROT_CFG_TX_OP_ALLOW_MM40, 1); -+ rt2x00_set_field32(®, OFDM_PROT_CFG_TX_OP_ALLOW_GF20, 1); -+ rt2x00_set_field32(®, OFDM_PROT_CFG_TX_OP_ALLOW_GF40, 1); -+ rt2x00pci_register_write(rt2x00dev, OFDM_PROT_CFG, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, MM20_PROT_CFG, ®); -+ rt2x00_set_field32(®, MM20_PROT_CFG_PROTECT_RATE, 0x4004); -+ rt2x00_set_field32(®, MM20_PROT_CFG_PROTECT_CTRL, 0); -+ rt2x00_set_field32(®, MM20_PROT_CFG_PROTECT_NAV, 1); -+ rt2x00_set_field32(®, MM20_PROT_CFG_TX_OP_ALLOW_CCK, 1); -+ rt2x00_set_field32(®, MM20_PROT_CFG_TX_OP_ALLOW_OFDM, 1); -+ rt2x00_set_field32(®, MM20_PROT_CFG_TX_OP_ALLOW_MM20, 1); -+ rt2x00_set_field32(®, MM20_PROT_CFG_TX_OP_ALLOW_MM40, 0); -+ rt2x00_set_field32(®, MM20_PROT_CFG_TX_OP_ALLOW_GF20, 1); -+ rt2x00_set_field32(®, MM20_PROT_CFG_TX_OP_ALLOW_GF40, 0); -+ rt2x00pci_register_write(rt2x00dev, MM20_PROT_CFG, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, MM40_PROT_CFG, ®); -+ rt2x00_set_field32(®, MM40_PROT_CFG_PROTECT_RATE, 0x4084); -+ rt2x00_set_field32(®, MM40_PROT_CFG_PROTECT_CTRL, 0); -+ rt2x00_set_field32(®, MM40_PROT_CFG_PROTECT_NAV, 1); -+ rt2x00_set_field32(®, MM40_PROT_CFG_TX_OP_ALLOW_CCK, 1); -+ rt2x00_set_field32(®, MM40_PROT_CFG_TX_OP_ALLOW_OFDM, 1); -+ rt2x00_set_field32(®, MM40_PROT_CFG_TX_OP_ALLOW_MM20, 1); -+ rt2x00_set_field32(®, MM40_PROT_CFG_TX_OP_ALLOW_MM40, 1); -+ rt2x00_set_field32(®, MM40_PROT_CFG_TX_OP_ALLOW_GF20, 1); -+ rt2x00_set_field32(®, MM40_PROT_CFG_TX_OP_ALLOW_GF40, 1); -+ rt2x00pci_register_write(rt2x00dev, MM40_PROT_CFG, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, GF20_PROT_CFG, ®); -+ rt2x00_set_field32(®, GF20_PROT_CFG_PROTECT_RATE, 0x4004); -+ rt2x00_set_field32(®, GF20_PROT_CFG_PROTECT_CTRL, 0); -+ rt2x00_set_field32(®, GF20_PROT_CFG_PROTECT_NAV, 1); -+ rt2x00_set_field32(®, GF20_PROT_CFG_TX_OP_ALLOW_CCK, 1); -+ rt2x00_set_field32(®, GF20_PROT_CFG_TX_OP_ALLOW_OFDM, 1); -+ rt2x00_set_field32(®, GF20_PROT_CFG_TX_OP_ALLOW_MM20, 1); -+ rt2x00_set_field32(®, GF20_PROT_CFG_TX_OP_ALLOW_MM40, 0); -+ rt2x00_set_field32(®, GF20_PROT_CFG_TX_OP_ALLOW_GF20, 1); -+ rt2x00_set_field32(®, GF20_PROT_CFG_TX_OP_ALLOW_GF40, 0); -+ rt2x00pci_register_write(rt2x00dev, GF20_PROT_CFG, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, GF40_PROT_CFG, ®); -+ rt2x00_set_field32(®, GF40_PROT_CFG_PROTECT_RATE, 0x4084); -+ rt2x00_set_field32(®, GF40_PROT_CFG_PROTECT_CTRL, 0); -+ rt2x00_set_field32(®, GF40_PROT_CFG_PROTECT_NAV, 1); -+ rt2x00_set_field32(®, GF40_PROT_CFG_TX_OP_ALLOW_CCK, 1); -+ rt2x00_set_field32(®, GF40_PROT_CFG_TX_OP_ALLOW_OFDM, 1); -+ rt2x00_set_field32(®, GF40_PROT_CFG_TX_OP_ALLOW_MM20, 1); -+ rt2x00_set_field32(®, GF40_PROT_CFG_TX_OP_ALLOW_MM40, 1); -+ rt2x00_set_field32(®, GF40_PROT_CFG_TX_OP_ALLOW_GF20, 1); -+ rt2x00_set_field32(®, GF40_PROT_CFG_TX_OP_ALLOW_GF40, 1); -+ rt2x00pci_register_write(rt2x00dev, GF40_PROT_CFG, reg); -+ -+ rt2x00pci_register_write(rt2x00dev, TXOP_CTRL_CFG, 0x0000583f); -+ rt2x00pci_register_write(rt2x00dev, TXOP_HLDR_ET, 0x00000002); -+ -+ rt2x00pci_register_read(rt2x00dev, TX_RTS_CFG, ®); -+ rt2x00_set_field32(®, TX_RTS_CFG_AUTO_RTS_RETRY_LIMIT, 32); -+ rt2x00_set_field32(®, TX_RTS_CFG_RTS_THRES, -+ IEEE80211_MAX_RTS_THRESHOLD); -+ rt2x00_set_field32(®, TX_RTS_CFG_RTS_FBK_EN, 0); -+ rt2x00pci_register_write(rt2x00dev, TX_RTS_CFG, reg); -+ -+ rt2x00pci_register_write(rt2x00dev, EXP_ACK_TIME, 0x002400ca); -+ rt2x00pci_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003); -+ -+ /* -+ * ASIC will keep garbage value after boot, clear encryption keys. -+ */ -+ for (i = 0; i < 256; i++) { -+ u32 wcid[2] = { 0xffffffff, 0x00ffffff }; -+ rt2x00pci_register_multiwrite(rt2x00dev, MAC_WCID_ENTRY(i), -+ wcid, sizeof(wcid)); -+ -+ rt2x00pci_register_write(rt2x00dev, MAC_WCID_ATTR_ENTRY(i), 1); -+ rt2x00pci_register_write(rt2x00dev, MAC_IVEIV_ENTRY(i), 0); -+ } -+ -+ for (i = 0; i < 16; i++) -+ rt2x00pci_register_write(rt2x00dev, -+ SHARED_KEY_MODE_ENTRY(i), 0); -+ -+ /* -+ * Clear all beacons -+ * For the Beacon base registers we only need to clear -+ * the first byte since that byte contains the VALID and OWNER -+ * bits which (when set to 0) will invalidate the entire beacon. -+ */ -+ rt2x00pci_register_write(rt2x00dev, HW_BEACON_BASE0, 0); -+ rt2x00pci_register_write(rt2x00dev, HW_BEACON_BASE1, 0); -+ rt2x00pci_register_write(rt2x00dev, HW_BEACON_BASE2, 0); -+ rt2x00pci_register_write(rt2x00dev, HW_BEACON_BASE3, 0); -+ rt2x00pci_register_write(rt2x00dev, HW_BEACON_BASE4, 0); -+ rt2x00pci_register_write(rt2x00dev, HW_BEACON_BASE5, 0); -+ rt2x00pci_register_write(rt2x00dev, HW_BEACON_BASE6, 0); -+ rt2x00pci_register_write(rt2x00dev, HW_BEACON_BASE7, 0); -+ -+ rt2x00pci_register_read(rt2x00dev, HT_FBK_CFG0, ®); -+ rt2x00_set_field32(®, HT_FBK_CFG0_HTMCS0FBK, 0); -+ rt2x00_set_field32(®, HT_FBK_CFG0_HTMCS1FBK, 0); -+ rt2x00_set_field32(®, HT_FBK_CFG0_HTMCS2FBK, 1); -+ rt2x00_set_field32(®, HT_FBK_CFG0_HTMCS3FBK, 2); -+ rt2x00_set_field32(®, HT_FBK_CFG0_HTMCS4FBK, 3); -+ rt2x00_set_field32(®, HT_FBK_CFG0_HTMCS5FBK, 4); -+ rt2x00_set_field32(®, HT_FBK_CFG0_HTMCS6FBK, 5); -+ rt2x00_set_field32(®, HT_FBK_CFG0_HTMCS7FBK, 6); -+ rt2x00pci_register_write(rt2x00dev, HT_FBK_CFG0, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, HT_FBK_CFG1, ®); -+ rt2x00_set_field32(®, HT_FBK_CFG1_HTMCS8FBK, 8); -+ rt2x00_set_field32(®, HT_FBK_CFG1_HTMCS9FBK, 8); -+ rt2x00_set_field32(®, HT_FBK_CFG1_HTMCS10FBK, 9); -+ rt2x00_set_field32(®, HT_FBK_CFG1_HTMCS11FBK, 10); -+ rt2x00_set_field32(®, HT_FBK_CFG1_HTMCS12FBK, 11); -+ rt2x00_set_field32(®, HT_FBK_CFG1_HTMCS13FBK, 12); -+ rt2x00_set_field32(®, HT_FBK_CFG1_HTMCS14FBK, 13); -+ rt2x00_set_field32(®, HT_FBK_CFG1_HTMCS15FBK, 14); -+ rt2x00pci_register_write(rt2x00dev, HT_FBK_CFG1, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, LG_FBK_CFG0, ®); -+ rt2x00_set_field32(®, LG_FBK_CFG0_OFDMMCS0FBK, 8); -+ rt2x00_set_field32(®, LG_FBK_CFG0_OFDMMCS1FBK, 8); -+ rt2x00_set_field32(®, LG_FBK_CFG0_OFDMMCS2FBK, 3); -+ rt2x00_set_field32(®, LG_FBK_CFG0_OFDMMCS3FBK, 10); -+ rt2x00_set_field32(®, LG_FBK_CFG0_OFDMMCS4FBK, 11); -+ rt2x00_set_field32(®, LG_FBK_CFG0_OFDMMCS5FBK, 12); -+ rt2x00_set_field32(®, LG_FBK_CFG0_OFDMMCS6FBK, 13); -+ rt2x00_set_field32(®, LG_FBK_CFG0_OFDMMCS7FBK, 14); -+ rt2x00pci_register_write(rt2x00dev, LG_FBK_CFG0, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, LG_FBK_CFG1, ®); -+ rt2x00_set_field32(®, LG_FBK_CFG0_CCKMCS0FBK, 0); -+ rt2x00_set_field32(®, LG_FBK_CFG0_CCKMCS1FBK, 0); -+ rt2x00_set_field32(®, LG_FBK_CFG0_CCKMCS2FBK, 1); -+ rt2x00_set_field32(®, LG_FBK_CFG0_CCKMCS3FBK, 2); -+ rt2x00pci_register_write(rt2x00dev, LG_FBK_CFG1, reg); -+ -+ /* -+ * We must clear the error counters. -+ * These registers are cleared on read, -+ * so we may pass a useless variable to store the value. -+ */ -+ rt2x00pci_register_read(rt2x00dev, RX_STA_CNT0, ®); -+ rt2x00pci_register_read(rt2x00dev, RX_STA_CNT1, ®); -+ rt2x00pci_register_read(rt2x00dev, RX_STA_CNT2, ®); -+ rt2x00pci_register_read(rt2x00dev, TX_STA_CNT0, ®); -+ rt2x00pci_register_read(rt2x00dev, TX_STA_CNT1, ®); -+ rt2x00pci_register_read(rt2x00dev, TX_STA_CNT2, ®); -+ -+ return 0; -+} -+ -+static int rt2800pci_wait_bbp_rf_ready(struct rt2x00_dev *rt2x00dev) -+{ -+ unsigned int i; -+ u32 reg; -+ -+ for (i = 0; i < REGISTER_BUSY_COUNT; i++) { -+ rt2x00pci_register_read(rt2x00dev, MAC_STATUS_CFG, ®); -+ if (!rt2x00_get_field32(reg, MAC_STATUS_CFG_BBP_RF_BUSY)) -+ return 0; -+ -+ udelay(REGISTER_BUSY_DELAY); -+ } -+ -+ ERROR(rt2x00dev, "BBP/RF register access failed, aborting.\n"); -+ return -EACCES; -+} -+ -+static int rt2800pci_wait_bbp_ready(struct rt2x00_dev *rt2x00dev) -+{ -+ unsigned int i; -+ u8 value; -+ -+ /* -+ * BBP was enabled after firmware was loaded, -+ * but we need to reactivate it now. -+ */ -+ rt2x00pci_register_write(rt2x00dev, H2M_BBP_AGENT, 0); -+ rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); -+ msleep(1); -+ -+ for (i = 0; i < REGISTER_BUSY_COUNT; i++) { -+ rt2800pci_bbp_read(rt2x00dev, 0, &value); -+ if ((value != 0xff) && (value != 0x00)) -+ return 0; -+ udelay(REGISTER_BUSY_DELAY); -+ } -+ -+ ERROR(rt2x00dev, "BBP register access failed, aborting.\n"); -+ return -EACCES; -+} -+ -+static int rt2800pci_init_bbp(struct rt2x00_dev *rt2x00dev) -+{ -+ unsigned int i; -+ u16 eeprom; -+ u8 reg_id; -+ u8 value; -+ -+ if (unlikely(rt2800pci_wait_bbp_rf_ready(rt2x00dev) || -+ rt2800pci_wait_bbp_ready(rt2x00dev))) -+ return -EACCES; -+ -+ rt2800pci_bbp_write(rt2x00dev, 65, 0x2c); -+ rt2800pci_bbp_write(rt2x00dev, 66, 0x38); -+ rt2800pci_bbp_write(rt2x00dev, 69, 0x12); -+ rt2800pci_bbp_write(rt2x00dev, 70, 0x0a); -+ rt2800pci_bbp_write(rt2x00dev, 73, 0x10); -+ rt2800pci_bbp_write(rt2x00dev, 81, 0x37); -+ rt2800pci_bbp_write(rt2x00dev, 82, 0x62); -+ rt2800pci_bbp_write(rt2x00dev, 83, 0x6a); -+ rt2800pci_bbp_write(rt2x00dev, 84, 0x99); -+ rt2800pci_bbp_write(rt2x00dev, 86, 0x00); -+ rt2800pci_bbp_write(rt2x00dev, 91, 0x04); -+ rt2800pci_bbp_write(rt2x00dev, 92, 0x00); -+ rt2800pci_bbp_write(rt2x00dev, 103, 0x00); -+ rt2800pci_bbp_write(rt2x00dev, 105, 0x05); -+ -+ if (rt2x00_rev(&rt2x00dev->chip) == RT2860C_VERSION) { -+ rt2800pci_bbp_write(rt2x00dev, 69, 0x16); -+ rt2800pci_bbp_write(rt2x00dev, 73, 0x12); -+ } -+ -+ if (rt2x00_rev(&rt2x00dev->chip) > RT2860D_VERSION) -+ rt2800pci_bbp_write(rt2x00dev, 84, 0x19); -+ -+ if (rt2x00_rt(&rt2x00dev->chip, RT3052)) { -+ rt2800pci_bbp_write(rt2x00dev, 31, 0x08); -+ rt2800pci_bbp_write(rt2x00dev, 78, 0x0e); -+ rt2800pci_bbp_write(rt2x00dev, 80, 0x08); -+ } -+ -+ for (i = 0; i < EEPROM_BBP_SIZE; i++) { -+ rt2x00_eeprom_read(rt2x00dev, EEPROM_BBP_START + i, &eeprom); -+ -+ if (eeprom != 0xffff && eeprom != 0x0000) { -+ reg_id = rt2x00_get_field16(eeprom, EEPROM_BBP_REG_ID); -+ value = rt2x00_get_field16(eeprom, EEPROM_BBP_VALUE); -+ rt2800pci_bbp_write(rt2x00dev, reg_id, value); -+ } -+ } -+ -+ return 0; -+} -+ -+static u8 rt2800pci_init_rx_filter(struct rt2x00_dev *rt2x00dev, -+ bool bw40, u8 rfcsr24, u8 filter_target) -+{ -+ unsigned int i; -+ u8 bbp; -+ u8 rfcsr; -+ u8 passband; -+ u8 stopband; -+ u8 overtuned = 0; -+ -+ rt2800pci_rfcsr_write(rt2x00dev, 24, rfcsr24); -+ -+ rt2800pci_bbp_read(rt2x00dev, 4, &bbp); -+ rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * bw40); -+ rt2800pci_bbp_write(rt2x00dev, 4, bbp); -+ -+ rt2800pci_rfcsr_read(rt2x00dev, 22, &rfcsr); -+ rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 1); -+ rt2800pci_rfcsr_write(rt2x00dev, 22, rfcsr); -+ -+ /* -+ * Set power & frequency of passband test tone -+ */ -+ rt2800pci_bbp_write(rt2x00dev, 24, 0); -+ -+ for (i = 0; i < 100; i++) { -+ rt2800pci_bbp_write(rt2x00dev, 25, 0x90); -+ msleep(1); -+ -+ rt2800pci_bbp_read(rt2x00dev, 55, &passband); -+ if (passband) -+ break; -+ } -+ -+ /* -+ * Set power & frequency of stopband test tone -+ */ -+ rt2800pci_bbp_write(rt2x00dev, 24, 0x06); -+ -+ for (i = 0; i < 100; i++) { -+ rt2800pci_bbp_write(rt2x00dev, 25, 0x90); -+ msleep(1); -+ -+ rt2800pci_bbp_read(rt2x00dev, 55, &stopband); -+ -+ if ((passband - stopband) <= filter_target) { -+ rfcsr24++; -+ overtuned += ((passband - stopband) == filter_target); -+ } else -+ break; -+ -+ rt2800pci_rfcsr_write(rt2x00dev, 24, rfcsr24); -+ } -+ -+ rfcsr24 -= !!overtuned; -+ -+ rt2800pci_rfcsr_write(rt2x00dev, 24, rfcsr24); -+ return rfcsr24; -+} -+ -+static int rt2800pci_init_rfcsr(struct rt2x00_dev *rt2x00dev) -+{ -+ u8 rfcsr; -+ u8 bbp; -+ -+ if (!rt2x00_rf(&rt2x00dev->chip, RF3020) && -+ !rt2x00_rf(&rt2x00dev->chip, RF3021) && -+ !rt2x00_rf(&rt2x00dev->chip, RF3022)) -+ return 0; -+ -+ /* -+ * Init RF calibration. -+ */ -+ rt2800pci_rfcsr_read(rt2x00dev, 30, &rfcsr); -+ rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 1); -+ rt2800pci_rfcsr_write(rt2x00dev, 30, rfcsr); -+ msleep(1); -+ rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 0); -+ rt2800pci_rfcsr_write(rt2x00dev, 30, rfcsr); -+ -+ rt2800pci_rfcsr_write(rt2x00dev, 0, 0x50); -+ rt2800pci_rfcsr_write(rt2x00dev, 1, 0x01); -+ rt2800pci_rfcsr_write(rt2x00dev, 2, 0xf7); -+ rt2800pci_rfcsr_write(rt2x00dev, 3, 0x75); -+ rt2800pci_rfcsr_write(rt2x00dev, 4, 0x40); -+ rt2800pci_rfcsr_write(rt2x00dev, 5, 0x03); -+ rt2800pci_rfcsr_write(rt2x00dev, 6, 0x02); -+ rt2800pci_rfcsr_write(rt2x00dev, 7, 0x50); -+ rt2800pci_rfcsr_write(rt2x00dev, 8, 0x39); -+ rt2800pci_rfcsr_write(rt2x00dev, 9, 0x0f); -+ rt2800pci_rfcsr_write(rt2x00dev, 10, 0x60); -+ rt2800pci_rfcsr_write(rt2x00dev, 11, 0x21); -+ rt2800pci_rfcsr_write(rt2x00dev, 12, 0x75); -+ rt2800pci_rfcsr_write(rt2x00dev, 13, 0x75); -+ rt2800pci_rfcsr_write(rt2x00dev, 14, 0x90); -+ rt2800pci_rfcsr_write(rt2x00dev, 15, 0x58); -+ rt2800pci_rfcsr_write(rt2x00dev, 16, 0xb3); -+ rt2800pci_rfcsr_write(rt2x00dev, 17, 0x92); -+ rt2800pci_rfcsr_write(rt2x00dev, 18, 0x2c); -+ rt2800pci_rfcsr_write(rt2x00dev, 19, 0x02); -+ rt2800pci_rfcsr_write(rt2x00dev, 20, 0xba); -+ rt2800pci_rfcsr_write(rt2x00dev, 21, 0xdb); -+ rt2800pci_rfcsr_write(rt2x00dev, 22, 0x00); -+ rt2800pci_rfcsr_write(rt2x00dev, 23, 0x31); -+ rt2800pci_rfcsr_write(rt2x00dev, 24, 0x08); -+ rt2800pci_rfcsr_write(rt2x00dev, 25, 0x01); -+ rt2800pci_rfcsr_write(rt2x00dev, 26, 0x25); -+ rt2800pci_rfcsr_write(rt2x00dev, 27, 0x23); -+ rt2800pci_rfcsr_write(rt2x00dev, 28, 0x13); -+ rt2800pci_rfcsr_write(rt2x00dev, 29, 0x83); -+ -+ /* -+ * Set RX Filter calibration for 20MHz and 40MHz -+ */ -+ rt2x00dev->calibration[0] = -+ rt2800pci_init_rx_filter(rt2x00dev, false, 0x07, 0x16); -+ rt2x00dev->calibration[1] = -+ rt2800pci_init_rx_filter(rt2x00dev, true, 0x27, 0x19); -+ -+ /* -+ * Set back to initial state -+ */ -+ rt2800pci_bbp_write(rt2x00dev, 24, 0); -+ -+ rt2800pci_rfcsr_read(rt2x00dev, 22, &rfcsr); -+ rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 0); -+ rt2800pci_rfcsr_write(rt2x00dev, 22, rfcsr); -+ -+ /* -+ * set BBP back to BW20 -+ */ -+ rt2800pci_bbp_read(rt2x00dev, 4, &bbp); -+ rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 0); -+ rt2800pci_bbp_write(rt2x00dev, 4, bbp); -+ -+ return 0; -+} -+ -+/* -+ * Device state switch handlers. -+ */ -+static void rt2800pci_toggle_rx(struct rt2x00_dev *rt2x00dev, -+ enum dev_state state) -+{ -+ u32 reg; -+ -+ rt2x00pci_register_read(rt2x00dev, MAC_SYS_CTRL, ®); -+ rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, -+ (state == STATE_RADIO_RX_ON) || -+ (state == STATE_RADIO_RX_ON_LINK)); -+ rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, reg); -+} -+ -+static void rt2800pci_toggle_irq(struct rt2x00_dev *rt2x00dev, -+ enum dev_state state) -+{ -+ int mask = (state == STATE_RADIO_IRQ_ON); -+ u32 reg; -+ -+ /* -+ * When interrupts are being enabled, the interrupt registers -+ * should clear the register to assure a clean state. -+ */ -+ if (state == STATE_RADIO_IRQ_ON) { -+ rt2x00pci_register_read(rt2x00dev, INT_SOURCE_CSR, ®); -+ rt2x00pci_register_write(rt2x00dev, INT_SOURCE_CSR, reg); -+ } -+ -+ rt2x00pci_register_read(rt2x00dev, INT_MASK_CSR, ®); -+ rt2x00_set_field32(®, INT_MASK_CSR_RXDELAYINT, mask); -+ rt2x00_set_field32(®, INT_MASK_CSR_TXDELAYINT, mask); -+ rt2x00_set_field32(®, INT_MASK_CSR_RX_DONE, mask); -+ rt2x00_set_field32(®, INT_MASK_CSR_AC0_DMA_DONE, mask); -+ rt2x00_set_field32(®, INT_MASK_CSR_AC1_DMA_DONE, mask); -+ rt2x00_set_field32(®, INT_MASK_CSR_AC2_DMA_DONE, mask); -+ rt2x00_set_field32(®, INT_MASK_CSR_AC3_DMA_DONE, mask); -+ rt2x00_set_field32(®, INT_MASK_CSR_HCCA_DMA_DONE, mask); -+ rt2x00_set_field32(®, INT_MASK_CSR_MGMT_DMA_DONE, mask); -+ rt2x00_set_field32(®, INT_MASK_CSR_MCU_COMMAND, mask); -+ rt2x00_set_field32(®, INT_MASK_CSR_RXTX_COHERENT, mask); -+ rt2x00_set_field32(®, INT_MASK_CSR_TBTT, mask); -+ rt2x00_set_field32(®, INT_MASK_CSR_PRE_TBTT, mask); -+ rt2x00_set_field32(®, INT_MASK_CSR_TX_FIFO_STATUS, mask); -+ rt2x00_set_field32(®, INT_MASK_CSR_AUTO_WAKEUP, mask); -+ rt2x00_set_field32(®, INT_MASK_CSR_GPTIMER, mask); -+ rt2x00_set_field32(®, INT_MASK_CSR_RX_COHERENT, mask); -+ rt2x00_set_field32(®, INT_MASK_CSR_TX_COHERENT, mask); -+ rt2x00pci_register_write(rt2x00dev, INT_MASK_CSR, reg); -+} -+ -+static int rt2800pci_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev) -+{ -+ unsigned int i; -+ u32 reg; -+ -+ for (i = 0; i < REGISTER_BUSY_COUNT; i++) { -+ rt2x00pci_register_read(rt2x00dev, WPDMA_GLO_CFG, ®); -+ if (!rt2x00_get_field32(reg, WPDMA_GLO_CFG_TX_DMA_BUSY) && -+ !rt2x00_get_field32(reg, WPDMA_GLO_CFG_RX_DMA_BUSY)) -+ return 0; -+ -+ msleep(1); -+ } -+ -+ ERROR(rt2x00dev, "WPDMA TX/RX busy, aborting.\n"); -+ return -EACCES; -+} -+ -+static int rt2800pci_enable_radio(struct rt2x00_dev *rt2x00dev) -+{ -+ u32 reg; -+ u16 word; -+ -+ /* -+ * Initialize all registers. -+ */ -+ if (unlikely(rt2800pci_wait_wpdma_ready(rt2x00dev) || -+ rt2800pci_init_queues(rt2x00dev) || -+ rt2800pci_init_registers(rt2x00dev) || -+ rt2800pci_wait_wpdma_ready(rt2x00dev) || -+ rt2800pci_init_bbp(rt2x00dev) || -+ rt2800pci_init_rfcsr(rt2x00dev))) -+ return -EIO; -+ -+ /* -+ * Send signal to firmware during boot time. -+ */ -+ rt2800pci_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0xff, 0, 0); -+ -+ /* -+ * Enable RX. -+ */ -+ rt2x00pci_register_read(rt2x00dev, MAC_SYS_CTRL, ®); -+ rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_TX, 1); -+ rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 0); -+ rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, WPDMA_GLO_CFG, ®); -+ rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_TX_DMA, 1); -+ rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_RX_DMA, 1); -+ rt2x00_set_field32(®, WPDMA_GLO_CFG_WP_DMA_BURST_SIZE, 2); -+ rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1); -+ rt2x00pci_register_write(rt2x00dev, WPDMA_GLO_CFG, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, MAC_SYS_CTRL, ®); -+ rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_TX, 1); -+ rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 1); -+ rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, reg); -+ -+ /* -+ * Initialize LED control -+ */ -+ rt2x00_eeprom_read(rt2x00dev, EEPROM_LED1, &word); -+ rt2800pci_mcu_request(rt2x00dev, MCU_LED_1, 0xff, -+ word & 0xff, (word >> 8) & 0xff); -+ -+ rt2x00_eeprom_read(rt2x00dev, EEPROM_LED2, &word); -+ rt2800pci_mcu_request(rt2x00dev, MCU_LED_2, 0xff, -+ word & 0xff, (word >> 8) & 0xff); -+ -+ rt2x00_eeprom_read(rt2x00dev, EEPROM_LED3, &word); -+ rt2800pci_mcu_request(rt2x00dev, MCU_LED_3, 0xff, -+ word & 0xff, (word >> 8) & 0xff); -+ -+ return 0; -+} -+ -+static void rt2800pci_disable_radio(struct rt2x00_dev *rt2x00dev) -+{ -+ u32 reg; -+ -+ rt2x00pci_register_read(rt2x00dev, WPDMA_GLO_CFG, ®); -+ rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0); -+ rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_DMA_BUSY, 0); -+ rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0); -+ rt2x00_set_field32(®, WPDMA_GLO_CFG_RX_DMA_BUSY, 0); -+ rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1); -+ rt2x00pci_register_write(rt2x00dev, WPDMA_GLO_CFG, reg); -+ -+ rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, 0); -+ rt2x00pci_register_write(rt2x00dev, PWR_PIN_CFG, 0); -+ rt2x00pci_register_write(rt2x00dev, TX_PIN_CFG, 0); -+ -+ rt2x00pci_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00001280); -+ -+ /* Wait for DMA, ignore error */ -+ rt2800pci_wait_wpdma_ready(rt2x00dev); -+} -+ -+static int rt2800pci_set_state(struct rt2x00_dev *rt2x00dev, -+ enum dev_state state) -+{ -+ /* -+ * Always put the device to sleep (even when we intend to wakeup!) -+ * if the device is booting and wasn't asleep it will return -+ * failure when attempting to wakeup. -+ */ -+ rt2800pci_mcu_request(rt2x00dev, MCU_SLEEP, 0xff, 0, 2); -+ -+ if (state == STATE_AWAKE) { -+ rt2800pci_mcu_request(rt2x00dev, MCU_WAKEUP, TOKEN_WAKUP, 0, 0); -+ rt2800pci_mcu_status(rt2x00dev, TOKEN_WAKUP); -+ } -+ -+ return 0; -+} -+ -+static int rt2800pci_set_device_state(struct rt2x00_dev *rt2x00dev, -+ enum dev_state state) -+{ -+ int retval = 0; -+ -+ switch (state) { -+ case STATE_RADIO_ON: -+ /* -+ * Before the radio can be enabled, the device first has -+ * to be woken up. After that it needs a bit of time -+ * to be fully awake and then the radio can be enabled. -+ */ -+ rt2800pci_set_state(rt2x00dev, STATE_AWAKE); -+ msleep(1); -+ retval = rt2800pci_enable_radio(rt2x00dev); -+ break; -+ case STATE_RADIO_OFF: -+ /* -+ * After the radio has been disabled, the device should -+ * be put to sleep for powersaving. -+ */ -+ rt2800pci_disable_radio(rt2x00dev); -+ rt2800pci_set_state(rt2x00dev, STATE_SLEEP); -+ break; -+ case STATE_RADIO_RX_ON: -+ case STATE_RADIO_RX_ON_LINK: -+ case STATE_RADIO_RX_OFF: -+ case STATE_RADIO_RX_OFF_LINK: -+ rt2800pci_toggle_rx(rt2x00dev, state); -+ break; -+ case STATE_RADIO_IRQ_ON: -+ case STATE_RADIO_IRQ_OFF: -+ rt2800pci_toggle_irq(rt2x00dev, state); -+ break; -+ case STATE_DEEP_SLEEP: -+ case STATE_SLEEP: -+ case STATE_STANDBY: -+ case STATE_AWAKE: -+ retval = rt2800pci_set_state(rt2x00dev, state); -+ break; -+ default: -+ retval = -ENOTSUPP; -+ break; -+ } -+ -+ if (unlikely(retval)) -+ ERROR(rt2x00dev, "Device failed to enter state %d (%d).\n", -+ state, retval); -+ -+ return retval; -+} -+ -+/* -+ * TX descriptor initialization -+ */ -+static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, -+ struct sk_buff *skb, -+ struct txentry_desc *txdesc) -+{ -+ struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); -+ __le32 *txd = skbdesc->desc; -+ __le32 *txwi = (__le32 *)(skb->data - rt2x00dev->hw->extra_tx_headroom); -+ u32 word; -+ -+ /* -+ * Initialize TX Info descriptor -+ */ -+ rt2x00_desc_read(txwi, 0, &word); -+ rt2x00_set_field32(&word, TXWI_W0_FRAG, -+ test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); -+ rt2x00_set_field32(&word, TXWI_W0_MIMO_PS, 0); -+ rt2x00_set_field32(&word, TXWI_W0_CF_ACK, 0); -+ rt2x00_set_field32(&word, TXWI_W0_TS, -+ test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); -+ rt2x00_set_field32(&word, TXWI_W0_AMPDU, -+ test_bit(ENTRY_TXD_HT_AMPDU, &txdesc->flags)); -+ rt2x00_set_field32(&word, TXWI_W0_MPDU_DENSITY, txdesc->mpdu_density); -+ rt2x00_set_field32(&word, TXWI_W0_TX_OP, txdesc->ifs); -+ rt2x00_set_field32(&word, TXWI_W0_MCS, txdesc->mcs); -+ rt2x00_set_field32(&word, TXWI_W0_BW, -+ test_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags)); -+ rt2x00_set_field32(&word, TXWI_W0_SHORT_GI, -+ test_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags)); -+ rt2x00_set_field32(&word, TXWI_W0_STBC, txdesc->stbc); -+ rt2x00_set_field32(&word, TXWI_W0_PHYMODE, txdesc->rate_mode); -+ rt2x00_desc_write(txwi, 0, word); -+ -+ rt2x00_desc_read(txwi, 1, &word); -+ rt2x00_set_field32(&word, TXWI_W1_ACK, -+ test_bit(ENTRY_TXD_ACK, &txdesc->flags)); -+ rt2x00_set_field32(&word, TXWI_W1_NSEQ, -+ test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags)); -+ rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size); -+ rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID, -+ test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ? -+ txdesc->key_idx : 0xff); -+ rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, -+ skb->len - txdesc->l2pad); -+ rt2x00_set_field32(&word, TXWI_W1_PACKETID, -+ skbdesc->entry->queue->qid); -+ rt2x00_desc_write(txwi, 1, word); -+ -+ /* -+ * Always write 0 to IV/EIV fields, hardware will insert the IV -+ * from the IVEIV register when ENTRY_TXD_ENCRYPT_IV is set to 0. -+ * When ENTRY_TXD_ENCRYPT_IV is set to 1 it will use the IV data -+ * from the descriptor. The TXWI_W1_WIRELESS_CLI_ID indicates which -+ * crypto entry in the registers should be used to encrypt the frame. -+ */ -+ _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */); -+ _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */); -+ -+ /* -+ * Initialize TX descriptor -+ */ -+ rt2x00_desc_read(txd, 0, &word); -+ rt2x00_set_field32(&word, TXD_W0_SD_PTR0, skbdesc->skb_dma); -+ rt2x00_desc_write(txd, 0, word); -+ -+ rt2x00_desc_read(txd, 1, &word); -+ rt2x00_set_field32(&word, TXD_W1_SD_LEN1, skb->len); -+ rt2x00_set_field32(&word, TXD_W1_LAST_SEC1, 1); -+ rt2x00_set_field32(&word, TXD_W1_BURST, -+ test_bit(ENTRY_TXD_BURST, &txdesc->flags)); -+ rt2x00_set_field32(&word, TXD_W1_SD_LEN0, -+ rt2x00dev->hw->extra_tx_headroom); -+ rt2x00_set_field32(&word, TXD_W1_LAST_SEC0, -+ !test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); -+ rt2x00_set_field32(&word, TXD_W1_DMA_DONE, 0); -+ rt2x00_desc_write(txd, 1, word); -+ -+ rt2x00_desc_read(txd, 2, &word); -+ rt2x00_set_field32(&word, TXD_W2_SD_PTR1, -+ skbdesc->skb_dma + rt2x00dev->hw->extra_tx_headroom); -+ rt2x00_desc_write(txd, 2, word); -+ -+ rt2x00_desc_read(txd, 3, &word); -+ rt2x00_set_field32(&word, TXD_W3_WIV, -+ !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags)); -+ rt2x00_set_field32(&word, TXD_W3_QSEL, 2); -+ rt2x00_desc_write(txd, 3, word); -+} -+ -+/* -+ * TX data initialization -+ */ -+static void rt2800pci_write_beacon(struct queue_entry *entry) -+{ -+ struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; -+ struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); -+ unsigned int beacon_base; -+ u32 reg; -+ -+ /* -+ * Disable beaconing while we are reloading the beacon data, -+ * otherwise we might be sending out invalid data. -+ */ -+ rt2x00pci_register_read(rt2x00dev, BCN_TIME_CFG, ®); -+ rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 0); -+ rt2x00pci_register_write(rt2x00dev, BCN_TIME_CFG, reg); -+ -+ /* -+ * Write entire beacon with descriptor to register. -+ */ -+ beacon_base = HW_BEACON_OFFSET(entry->entry_idx); -+ rt2x00pci_register_multiwrite(rt2x00dev, -+ beacon_base, -+ skbdesc->desc, skbdesc->desc_len); -+ rt2x00pci_register_multiwrite(rt2x00dev, -+ beacon_base + skbdesc->desc_len, -+ entry->skb->data, entry->skb->len); -+ -+ /* -+ * Clean up beacon skb. -+ */ -+ dev_kfree_skb_any(entry->skb); -+ entry->skb = NULL; -+} -+ -+static void rt2800pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, -+ const enum data_queue_qid queue_idx) -+{ -+ struct data_queue *queue; -+ unsigned int idx, qidx = 0; -+ u32 reg; -+ -+ if (queue_idx == QID_BEACON) { -+ rt2x00pci_register_read(rt2x00dev, BCN_TIME_CFG, ®); -+ if (!rt2x00_get_field32(reg, BCN_TIME_CFG_BEACON_GEN)) { -+ rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 1); -+ rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 1); -+ rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); -+ rt2x00pci_register_write(rt2x00dev, BCN_TIME_CFG, reg); -+ } -+ return; -+ } -+ -+ if (queue_idx > QID_HCCA && queue_idx != QID_MGMT) -+ return; -+ -+ queue = rt2x00queue_get_queue(rt2x00dev, queue_idx); -+ idx = queue->index[Q_INDEX]; -+ -+ if (queue_idx == QID_MGMT) -+ qidx = 5; -+ else -+ qidx = queue_idx; -+ -+ rt2x00pci_register_write(rt2x00dev, TX_CTX_IDX(qidx), idx); -+} -+ -+static void rt2800pci_kill_tx_queue(struct rt2x00_dev *rt2x00dev, -+ const enum data_queue_qid qid) -+{ -+ u32 reg; -+ -+ if (qid == QID_BEACON) { -+ rt2x00pci_register_write(rt2x00dev, BCN_TIME_CFG, 0); -+ return; -+ } -+ -+ rt2x00pci_register_read(rt2x00dev, WPDMA_RST_IDX, ®); -+ rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX0, (qid == QID_AC_BE)); -+ rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX1, (qid == QID_AC_BK)); -+ rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX2, (qid == QID_AC_VI)); -+ rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX3, (qid == QID_AC_VO)); -+ rt2x00pci_register_write(rt2x00dev, WPDMA_RST_IDX, reg); -+} -+ -+/* -+ * RX control handlers -+ */ -+static void rt2800pci_fill_rxdone(struct queue_entry *entry, -+ struct rxdone_entry_desc *rxdesc) -+{ -+ struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; -+ struct queue_entry_priv_pci *entry_priv = entry->priv_data; -+ __le32 *rxd = entry_priv->desc; -+ __le32 *rxwi = (__le32 *)entry->skb->data; -+ u32 rxd3; -+ u32 rxwi0; -+ u32 rxwi1; -+ u32 rxwi2; -+ u32 rxwi3; -+ -+ rt2x00_desc_read(rxd, 3, &rxd3); -+ rt2x00_desc_read(rxwi, 0, &rxwi0); -+ rt2x00_desc_read(rxwi, 1, &rxwi1); -+ rt2x00_desc_read(rxwi, 2, &rxwi2); -+ rt2x00_desc_read(rxwi, 3, &rxwi3); -+ -+ if (rt2x00_get_field32(rxd3, RXD_W3_CRC_ERROR)) -+ rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; -+ -+ if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) { -+ /* -+ * Unfortunately we don't know the cipher type used during -+ * decryption. This prevents us from correct providing -+ * correct statistics through debugfs. -+ */ -+ rxdesc->cipher = rt2x00_get_field32(rxwi0, RXWI_W0_UDF); -+ rxdesc->cipher_status = -+ rt2x00_get_field32(rxd3, RXD_W3_CIPHER_ERROR); -+ } -+ -+ if (rt2x00_get_field32(rxd3, RXD_W3_DECRYPTED)) { -+ /* -+ * Hardware has stripped IV/EIV data from 802.11 frame during -+ * decryption. Unfortunately the descriptor doesn't contain -+ * any fields with the EIV/IV data either, so they can't -+ * be restored by rt2x00lib. -+ */ -+ rxdesc->flags |= RX_FLAG_IV_STRIPPED; -+ -+ if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) -+ rxdesc->flags |= RX_FLAG_DECRYPTED; -+ else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) -+ rxdesc->flags |= RX_FLAG_MMIC_ERROR; -+ } -+ -+ if (rt2x00_get_field32(rxd3, RXD_W3_MY_BSS)) -+ rxdesc->dev_flags |= RXDONE_MY_BSS; -+ -+ if (rt2x00_get_field32(rxd3, RXD_W3_L2PAD)) -+ rxdesc->dev_flags |= RXDONE_L2PAD; -+ -+ if (rt2x00_get_field32(rxwi1, RXWI_W1_SHORT_GI)) -+ rxdesc->flags |= RX_FLAG_SHORT_GI; -+ -+ if (rt2x00_get_field32(rxwi1, RXWI_W1_BW)) -+ rxdesc->flags |= RX_FLAG_40MHZ; -+ -+ /* -+ * Detect RX rate, always use MCS as signal type. -+ */ -+ rxdesc->dev_flags |= RXDONE_SIGNAL_MCS; -+ rxdesc->rate_mode = rt2x00_get_field32(rxwi1, RXWI_W1_PHYMODE); -+ rxdesc->signal = rt2x00_get_field32(rxwi1, RXWI_W1_MCS); -+ -+ /* -+ * Mask of 0x8 bit to remove the short preamble flag. -+ */ -+ if (rxdesc->rate_mode == RATE_MODE_CCK) -+ rxdesc->signal &= ~0x8; -+ -+ rxdesc->rssi = -+ (rt2x00_get_field32(rxwi2, RXWI_W2_RSSI0) + -+ rt2x00_get_field32(rxwi2, RXWI_W2_RSSI1)) / 2; -+ -+ rxdesc->noise = -+ (rt2x00_get_field32(rxwi3, RXWI_W3_SNR0) + -+ rt2x00_get_field32(rxwi3, RXWI_W3_SNR1)) / 2; -+ -+ rxdesc->size = rt2x00_get_field32(rxwi0, RXWI_W0_MPDU_TOTAL_BYTE_COUNT); -+ -+ /* -+ * Set RX IDX in register to inform hardware that we have handled -+ * this entry and it is available for reuse again. -+ */ -+ rt2x00pci_register_write(rt2x00dev, RX_CRX_IDX, entry->entry_idx); -+ -+ /* -+ * Remove TXWI descriptor from start of buffer. -+ */ -+ skb_pull(entry->skb, RXWI_DESC_SIZE); -+ skb_trim(entry->skb, rxdesc->size); -+} -+ -+/* -+ * Interrupt functions. -+ */ -+static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev) -+{ -+ struct data_queue *queue; -+ struct queue_entry *entry; -+ struct queue_entry *entry_done; -+ struct queue_entry_priv_pci *entry_priv; -+ struct txdone_entry_desc txdesc; -+ u32 word; -+ u32 reg; -+ u32 old_reg; -+ int type; -+ int index; -+ -+ /* -+ * During each loop we will compare the freshly read -+ * TX_STA_FIFO register value with the value read from -+ * the previous loop. If the 2 values are equal then -+ * we should stop processing because the chance it -+ * quite big that the device has been unplugged and -+ * we risk going into an endless loop. -+ */ -+ old_reg = 0; -+ -+ while (1) { -+ rt2x00pci_register_read(rt2x00dev, TX_STA_FIFO, ®); -+ if (!rt2x00_get_field32(reg, TX_STA_FIFO_VALID)) -+ break; -+ -+ if (old_reg == reg) -+ break; -+ old_reg = reg; -+ -+ /* -+ * Skip this entry when it contains an invalid -+ * queue identication number. -+ */ -+ type = rt2x00_get_field32(reg, TX_STA_FIFO_PID_TYPE); -+ queue = rt2x00queue_get_queue(rt2x00dev, type); -+ if (unlikely(!queue)) -+ continue; -+ -+ /* -+ * Skip this entry when it contains an invalid -+ * index number. -+ */ -+ index = rt2x00_get_field32(reg, TX_STA_FIFO_WCID); -+ if (unlikely(index >= queue->limit)) -+ continue; -+ -+ entry = &queue->entries[index]; -+ entry_priv = entry->priv_data; -+ rt2x00_desc_read((__le32 *)entry->skb->data, 0, &word); -+ -+ entry_done = rt2x00queue_get_entry(queue, Q_INDEX_DONE); -+ while (entry != entry_done) { -+ /* -+ * Catch up. -+ * Just report any entries we missed as failed. -+ */ -+ WARNING(rt2x00dev, -+ "TX status report missed for entry %d\n", -+ entry_done->entry_idx); -+ -+ txdesc.flags = 0; -+ __set_bit(TXDONE_UNKNOWN, &txdesc.flags); -+ txdesc.retry = 0; -+ -+ rt2x00lib_txdone(entry_done, &txdesc); -+ entry_done = rt2x00queue_get_entry(queue, Q_INDEX_DONE); -+ } -+ -+ /* -+ * Obtain the status about this packet. -+ */ -+ txdesc.flags = 0; -+ if (rt2x00_get_field32(reg, TX_STA_FIFO_TX_SUCCESS)) -+ __set_bit(TXDONE_SUCCESS, &txdesc.flags); -+ else -+ __set_bit(TXDONE_FAILURE, &txdesc.flags); -+ txdesc.retry = rt2x00_get_field32(word, TXWI_W0_MCS); -+ -+ rt2x00lib_txdone(entry, &txdesc); -+ } -+} -+ -+static irqreturn_t rt2800pci_interrupt(int irq, void *dev_instance) -+{ -+ struct rt2x00_dev *rt2x00dev = dev_instance; -+ u32 reg; -+ -+ /* Read status and ACK all interrupts */ -+ rt2x00pci_register_read(rt2x00dev, INT_SOURCE_CSR, ®); -+ rt2x00pci_register_write(rt2x00dev, INT_SOURCE_CSR, reg); -+ -+ if (!reg) -+ return IRQ_NONE; -+ -+ if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) -+ return IRQ_HANDLED; -+ -+ /* -+ * 1 - Rx ring done interrupt. -+ */ -+ if (rt2x00_get_field32(reg, INT_SOURCE_CSR_RX_DONE)) -+ rt2x00pci_rxdone(rt2x00dev); -+ -+ if (rt2x00_get_field32(reg, INT_SOURCE_CSR_TX_FIFO_STATUS)) -+ rt2800pci_txdone(rt2x00dev); -+ -+ return IRQ_HANDLED; -+} -+ -+/* -+ * Device probe functions. -+ */ -+static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev) -+{ -+ u16 word; -+ u8 *mac; -+ u8 default_lna_gain; -+ -+ /* -+ * Read EEPROM into buffer -+ */ -+ switch(rt2x00dev->chip.rt) { -+ case RT2880: -+ case RT3052: -+ rt2800pci_read_eeprom_soc(rt2x00dev); -+ break; -+ default: -+ rt2800pci_read_eeprom_pci(rt2x00dev); -+ break; -+ } -+ -+ /* -+ * Start validation of the data that has been read. -+ */ -+ mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0); -+ if (!is_valid_ether_addr(mac)) { -+ DECLARE_MAC_BUF(macbuf); -+ -+ random_ether_addr(mac); -+ EEPROM(rt2x00dev, "MAC: %s\n", print_mac(macbuf, mac)); -+ } -+ -+ rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &word); -+ if (word == 0xffff) { -+ rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2); -+ rt2x00_set_field16(&word, EEPROM_ANTENNA_TXPATH, 1); -+ rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2820); -+ rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word); -+ EEPROM(rt2x00dev, "Antenna: 0x%04x\n", word); -+ } else if (rt2x00_rev(&rt2x00dev->chip) < RT2883_VERSION) { -+ /* -+ * There is a max of 2 RX streams for RT2860 series -+ */ -+ if (rt2x00_get_field16(word, EEPROM_ANTENNA_RXPATH) > 2) -+ rt2x00_set_field16(&word, EEPROM_ANTENNA_RXPATH, 2); -+ rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word); -+ } -+ -+ rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word); -+ if (word == 0xffff) { -+ rt2x00_set_field16(&word, EEPROM_NIC_HW_RADIO, 0); -+ rt2x00_set_field16(&word, EEPROM_NIC_DYNAMIC_TX_AGC, 0); -+ rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_BG, 0); -+ rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_A, 0); -+ rt2x00_set_field16(&word, EEPROM_NIC_CARDBUS_ACCEL, 0); -+ rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_BG, 0); -+ rt2x00_set_field16(&word, EEPROM_NIC_BW40M_SB_A, 0); -+ rt2x00_set_field16(&word, EEPROM_NIC_WPS_PBC, 0); -+ rt2x00_set_field16(&word, EEPROM_NIC_BW40M_BG, 0); -+ rt2x00_set_field16(&word, EEPROM_NIC_BW40M_A, 0); -+ rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC, word); -+ EEPROM(rt2x00dev, "NIC: 0x%04x\n", word); -+ } -+ -+ rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &word); -+ if ((word & 0x00ff) == 0x00ff) { -+ rt2x00_set_field16(&word, EEPROM_FREQ_OFFSET, 0); -+ rt2x00_set_field16(&word, EEPROM_FREQ_LED_MODE, -+ LED_MODE_TXRX_ACTIVITY); -+ rt2x00_set_field16(&word, EEPROM_FREQ_LED_POLARITY, 0); -+ rt2x00_eeprom_write(rt2x00dev, EEPROM_FREQ, word); -+ rt2x00_eeprom_write(rt2x00dev, EEPROM_LED1, 0x5555); -+ rt2x00_eeprom_write(rt2x00dev, EEPROM_LED2, 0x2221); -+ rt2x00_eeprom_write(rt2x00dev, EEPROM_LED3, 0xa9f8); -+ EEPROM(rt2x00dev, "Freq: 0x%04x\n", word); -+ } -+ -+ /* -+ * During the LNA validation we are going to use -+ * lna0 as correct value. Note that EEPROM_LNA -+ * is never validated. -+ */ -+ rt2x00_eeprom_read(rt2x00dev, EEPROM_LNA, &word); -+ default_lna_gain = rt2x00_get_field16(word, EEPROM_LNA_A0); -+ -+ rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG, &word); -+ if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG_OFFSET0)) > 10) -+ rt2x00_set_field16(&word, EEPROM_RSSI_BG_OFFSET0, 0); -+ if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG_OFFSET1)) > 10) -+ rt2x00_set_field16(&word, EEPROM_RSSI_BG_OFFSET1, 0); -+ rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG, word); -+ -+ rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &word); -+ if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10) -+ rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0); -+ if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 || -+ rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff) -+ rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1, -+ default_lna_gain); -+ rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG2, word); -+ -+ rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A, &word); -+ if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A_OFFSET0)) > 10) -+ rt2x00_set_field16(&word, EEPROM_RSSI_A_OFFSET0, 0); -+ if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A_OFFSET1)) > 10) -+ rt2x00_set_field16(&word, EEPROM_RSSI_A_OFFSET1, 0); -+ rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A, word); -+ -+ rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &word); -+ if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10) -+ rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0); -+ if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 || -+ rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff) -+ rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2, -+ default_lna_gain); -+ rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word); -+ -+ return 0; -+} -+ -+static int rt2800pci_init_eeprom(struct rt2x00_dev *rt2x00dev) -+{ -+ u32 reg; -+ u16 value; -+ u16 eeprom; -+ -+ /* -+ * Read EEPROM word for configuration. -+ */ -+ rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom); -+ -+ /* -+ * Identify RF chipset. -+ */ -+ value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); -+ rt2x00pci_register_read(rt2x00dev, MAC_CSR0, ®); -+ rt2x00_set_chip_rf(rt2x00dev, value, reg); -+ -+ if (!rt2x00_rf(&rt2x00dev->chip, RF2820) && -+ !rt2x00_rf(&rt2x00dev->chip, RF2850) && -+ !rt2x00_rf(&rt2x00dev->chip, RF2720) && -+ !rt2x00_rf(&rt2x00dev->chip, RF2750) && -+ !rt2x00_rf(&rt2x00dev->chip, RF3020) && -+ !rt2x00_rf(&rt2x00dev->chip, RF2020) && -+ !rt2x00_rf(&rt2x00dev->chip, RF3021) && -+ !rt2x00_rf(&rt2x00dev->chip, RF3022)) { -+ ERROR(rt2x00dev, "Invalid RF chipset detected.\n"); -+ return -ENODEV; -+ } -+ -+ /* -+ * Identify default antenna configuration. -+ */ -+ rt2x00dev->default_ant.tx = -+ rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH); -+ rt2x00dev->default_ant.rx = -+ rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH); -+ -+ /* -+ * Read frequency offset and RF programming sequence. -+ */ -+ rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom); -+ rt2x00dev->freq_offset = rt2x00_get_field16(eeprom, EEPROM_FREQ_OFFSET); -+ -+ /* -+ * Read external LNA informations. -+ */ -+ rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom); -+ -+ if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_A)) -+ __set_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags); -+ if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_BG)) -+ __set_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags); -+ -+ /* -+ * Detect if this device has an hardware controlled radio. -+ */ -+ if (rt2x00_get_field16(eeprom, EEPROM_NIC_HW_RADIO)) -+ __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); -+ -+ /* -+ * Store led settings, for correct led behaviour. -+ */ -+#ifdef CONFIG_RT2X00_LIB_LEDS -+ rt2800pci_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO); -+ rt2800pci_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC); -+ rt2800pci_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY); -+ -+ rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &rt2x00dev->led_mcu_reg); -+#endif /* CONFIG_RT2X00_LIB_LEDS */ -+ -+ return 0; -+} -+ -+/* -+ * RF value list for rt2860 -+ * Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750) -+ */ -+static const struct rf_channel rf_vals[] = { -+ { 1, 0x18402ecc, 0x184c0786, 0x1816b455, 0x1800510b }, -+ { 2, 0x18402ecc, 0x184c0786, 0x18168a55, 0x1800519f }, -+ { 3, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800518b }, -+ { 4, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800519f }, -+ { 5, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800518b }, -+ { 6, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800519f }, -+ { 7, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800518b }, -+ { 8, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800519f }, -+ { 9, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800518b }, -+ { 10, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800519f }, -+ { 11, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800518b }, -+ { 12, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800519f }, -+ { 13, 0x18402ecc, 0x184c079e, 0x18168a55, 0x1800518b }, -+ { 14, 0x18402ecc, 0x184c07a2, 0x18168a55, 0x18005193 }, -+ -+ /* 802.11 UNI / HyperLan 2 */ -+ { 36, 0x18402ecc, 0x184c099a, 0x18158a55, 0x180ed1a3 }, -+ { 38, 0x18402ecc, 0x184c099e, 0x18158a55, 0x180ed193 }, -+ { 40, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed183 }, -+ { 44, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed1a3 }, -+ { 46, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed18b }, -+ { 48, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed19b }, -+ { 52, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed193 }, -+ { 54, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed1a3 }, -+ { 56, 0x18402ec8, 0x184c068e, 0x18158a55, 0x180ed18b }, -+ { 60, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed183 }, -+ { 62, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed193 }, -+ { 64, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed1a3 }, -+ -+ /* 802.11 HyperLan 2 */ -+ { 100, 0x18402ec8, 0x184c06b2, 0x18178a55, 0x180ed783 }, -+ { 102, 0x18402ec8, 0x184c06b2, 0x18578a55, 0x180ed793 }, -+ { 104, 0x18402ec8, 0x185c06b2, 0x18578a55, 0x180ed1a3 }, -+ { 108, 0x18402ecc, 0x185c0a32, 0x18578a55, 0x180ed193 }, -+ { 110, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed183 }, -+ { 112, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed19b }, -+ { 116, 0x18402ecc, 0x184c0a3a, 0x18178a55, 0x180ed1a3 }, -+ { 118, 0x18402ecc, 0x184c0a3e, 0x18178a55, 0x180ed193 }, -+ { 120, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed183 }, -+ { 124, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed193 }, -+ { 126, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed15b }, -+ { 128, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed1a3 }, -+ { 132, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed18b }, -+ { 134, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed193 }, -+ { 136, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed19b }, -+ { 140, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed183 }, -+ -+ /* 802.11 UNII */ -+ { 149, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed1a7 }, -+ { 151, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed187 }, -+ { 153, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed18f }, -+ { 157, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed19f }, -+ { 159, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed1a7 }, -+ { 161, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed187 }, -+ { 165, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed197 }, -+ -+ /* 802.11 Japan */ -+ { 184, 0x15002ccc, 0x1500491e, 0x1509be55, 0x150c0a0b }, -+ { 188, 0x15002ccc, 0x15004922, 0x1509be55, 0x150c0a13 }, -+ { 192, 0x15002ccc, 0x15004926, 0x1509be55, 0x150c0a1b }, -+ { 196, 0x15002ccc, 0x1500492a, 0x1509be55, 0x150c0a23 }, -+ { 208, 0x15002ccc, 0x1500493a, 0x1509be55, 0x150c0a13 }, -+ { 212, 0x15002ccc, 0x1500493e, 0x1509be55, 0x150c0a1b }, -+ { 216, 0x15002ccc, 0x15004982, 0x1509be55, 0x150c0a23 }, -+}; -+ -+static int rt2800pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) -+{ -+ struct hw_mode_spec *spec = &rt2x00dev->spec; -+ struct channel_info *info; -+ char *tx_power1; -+ char *tx_power2; -+ unsigned int i; -+ u16 eeprom; -+ -+ /* -+ * Initialize all hw fields. -+ */ -+ rt2x00dev->hw->flags = -+ IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | -+ IEEE80211_HW_SIGNAL_DBM | -+ IEEE80211_HW_SUPPORTS_PS | -+ IEEE80211_HW_PS_NULLFUNC_STACK; -+ rt2x00dev->hw->extra_tx_headroom = TXWI_DESC_SIZE; -+ -+ SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev); -+ SET_IEEE80211_PERM_ADDR(rt2x00dev->hw, -+ rt2x00_eeprom_addr(rt2x00dev, -+ EEPROM_MAC_ADDR_0)); -+ -+ rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom); -+ -+ /* -+ * Initialize hw_mode information. -+ */ -+ spec->supported_bands = SUPPORT_BAND_2GHZ; -+ spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; -+ -+ if (rt2x00_rf(&rt2x00dev->chip, RF2820) || -+ rt2x00_rf(&rt2x00dev->chip, RF2720) || -+ rt2x00_rf(&rt2x00dev->chip, RF3021) || -+ rt2x00_rf(&rt2x00dev->chip, RF3022)) { -+ spec->num_channels = 14; -+ spec->channels = rf_vals; -+ } else if (rt2x00_rf(&rt2x00dev->chip, RF2850) || -+ rt2x00_rf(&rt2x00dev->chip, RF2750)) { -+ spec->supported_bands |= SUPPORT_BAND_5GHZ; -+ spec->num_channels = ARRAY_SIZE(rf_vals); -+ spec->channels = rf_vals; -+ } -+ -+ /* -+ * Initialize HT information. -+ */ -+ spec->ht.ht_supported = true; -+ spec->ht.cap = -+ IEEE80211_HT_CAP_SUP_WIDTH_20_40 | -+ IEEE80211_HT_CAP_GRN_FLD | -+ IEEE80211_HT_CAP_SGI_20 | -+ IEEE80211_HT_CAP_SGI_40 | -+ IEEE80211_HT_CAP_TX_STBC | -+ IEEE80211_HT_CAP_RX_STBC | -+ IEEE80211_HT_CAP_PSMP_SUPPORT; -+ spec->ht.ampdu_factor = 3; -+ spec->ht.ampdu_density = 4; -+ spec->ht.mcs.tx_params = -+ IEEE80211_HT_MCS_TX_DEFINED | -+ IEEE80211_HT_MCS_TX_RX_DIFF | -+ ((rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TXPATH) - 1) << -+ IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT); -+ -+ switch (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RXPATH)) { -+ case 3: -+ spec->ht.mcs.rx_mask[2] = 0xff; -+ case 2: -+ spec->ht.mcs.rx_mask[1] = 0xff; -+ case 1: -+ spec->ht.mcs.rx_mask[0] = 0xff; -+ spec->ht.mcs.rx_mask[4] = 0x1; /* MCS32 */ -+ break; -+ } -+ -+ /* -+ * Create channel information array -+ */ -+ info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL); -+ if (!info) -+ return -ENOMEM; -+ -+ spec->channels_info = info; -+ -+ tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1); -+ tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2); -+ -+ for (i = 0; i < 14; i++) { -+ info[i].tx_power1 = TXPOWER_G_FROM_DEV(tx_power1[i]); -+ info[i].tx_power2 = TXPOWER_G_FROM_DEV(tx_power2[i]); -+ } -+ -+ if (spec->num_channels > 14) { -+ tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A1); -+ tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2); -+ -+ for (i = 14; i < spec->num_channels; i++) { -+ info[i].tx_power1 = TXPOWER_A_FROM_DEV(tx_power1[i]); -+ info[i].tx_power2 = TXPOWER_A_FROM_DEV(tx_power2[i]); -+ } -+ } -+ -+ return 0; -+} -+ -+static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev) -+{ -+ int retval; -+ -+ /* -+ * Allocate eeprom data. -+ */ -+ retval = rt2800pci_validate_eeprom(rt2x00dev); -+ if (retval) -+ return retval; -+ -+ retval = rt2800pci_init_eeprom(rt2x00dev); -+ if (retval) -+ return retval; -+ -+ /* -+ * Initialize hw specifications. -+ */ -+ retval = rt2800pci_probe_hw_mode(rt2x00dev); -+ if (retval) -+ return retval; -+ -+ /* -+ * This device has multiple filters for control frames -+ * and has a separate filter for PS Poll frames. -+ */ -+ __set_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags); -+ __set_bit(DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL, &rt2x00dev->flags); -+ -+ /* -+ * This device requires firmware. -+ */ -+ if (!rt2x00_rt(&rt2x00dev->chip, RT2880) && -+ !rt2x00_rt(&rt2x00dev->chip, RT3052)) -+ __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags); -+ __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags); -+ __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags); -+ if (!modparam_nohwcrypt) -+ __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags); -+ -+ /* -+ * Set the rssi offset. -+ */ -+ rt2x00dev->rssi_offset = DEFAULT_RSSI_OFFSET; -+ -+ return 0; -+} -+ -+/* -+ * IEEE80211 stack callback functions. -+ */ -+static void rt2800pci_get_tkip_seq(struct ieee80211_hw *hw, u8 hw_key_idx, -+ u32 *iv32, u16 *iv16) -+{ -+ struct rt2x00_dev *rt2x00dev = hw->priv; -+ struct mac_iveiv_entry iveiv_entry; -+ u32 offset; -+ -+ offset = MAC_IVEIV_ENTRY(hw_key_idx); -+ rt2x00pci_register_multiread(rt2x00dev, offset, -+ &iveiv_entry, sizeof(iveiv_entry)); -+ -+ memcpy(&iveiv_entry.iv[0], iv16, sizeof(iv16)); -+ memcpy(&iveiv_entry.iv[4], iv32, sizeof(iv32)); -+} -+ -+static int rt2800pci_set_rts_threshold(struct ieee80211_hw *hw, u32 value) -+{ -+ struct rt2x00_dev *rt2x00dev = hw->priv; -+ u32 reg; -+ bool enabled = (value < IEEE80211_MAX_RTS_THRESHOLD); -+ -+ rt2x00pci_register_read(rt2x00dev, TX_RTS_CFG, ®); -+ rt2x00_set_field32(®, TX_RTS_CFG_RTS_THRES, value); -+ rt2x00pci_register_write(rt2x00dev, TX_RTS_CFG, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, CCK_PROT_CFG, ®); -+ rt2x00_set_field32(®, CCK_PROT_CFG_RTS_TH_EN, enabled); -+ rt2x00pci_register_write(rt2x00dev, CCK_PROT_CFG, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, OFDM_PROT_CFG, ®); -+ rt2x00_set_field32(®, OFDM_PROT_CFG_RTS_TH_EN, enabled); -+ rt2x00pci_register_write(rt2x00dev, OFDM_PROT_CFG, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, MM20_PROT_CFG, ®); -+ rt2x00_set_field32(®, MM20_PROT_CFG_RTS_TH_EN, enabled); -+ rt2x00pci_register_write(rt2x00dev, MM20_PROT_CFG, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, MM40_PROT_CFG, ®); -+ rt2x00_set_field32(®, MM40_PROT_CFG_RTS_TH_EN, enabled); -+ rt2x00pci_register_write(rt2x00dev, MM40_PROT_CFG, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, GF20_PROT_CFG, ®); -+ rt2x00_set_field32(®, GF20_PROT_CFG_RTS_TH_EN, enabled); -+ rt2x00pci_register_write(rt2x00dev, GF20_PROT_CFG, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, GF40_PROT_CFG, ®); -+ rt2x00_set_field32(®, GF40_PROT_CFG_RTS_TH_EN, enabled); -+ rt2x00pci_register_write(rt2x00dev, GF40_PROT_CFG, reg); -+ -+ return 0; -+} -+ -+static int rt2800pci_conf_tx(struct ieee80211_hw *hw, u16 queue_idx, -+ const struct ieee80211_tx_queue_params *params) -+{ -+ struct rt2x00_dev *rt2x00dev = hw->priv; -+ struct data_queue *queue; -+ struct rt2x00_field32 field; -+ int retval; -+ u32 reg; -+ u32 offset; -+ -+ /* -+ * First pass the configuration through rt2x00lib, that will -+ * update the queue settings and validate the input. After that -+ * we are free to update the registers based on the value -+ * in the queue parameter. -+ */ -+ retval = rt2x00mac_conf_tx(hw, queue_idx, params); -+ if (retval) -+ return retval; -+ -+ /* -+ * We only need to perform additional register initialization -+ * for WMM queues/ -+ */ -+ if (queue_idx >= 4) -+ return 0; -+ -+ queue = rt2x00queue_get_queue(rt2x00dev, queue_idx); -+ -+ /* Update WMM TXOP register */ -+ offset = WMM_TXOP0_CFG + (sizeof(u32) * (!!(queue_idx & 2))); -+ field.bit_offset = (queue_idx & 1) * 16; -+ field.bit_mask = 0xffff << field.bit_offset; -+ -+ rt2x00pci_register_read(rt2x00dev, offset, ®); -+ rt2x00_set_field32(®, field, queue->txop); -+ rt2x00pci_register_write(rt2x00dev, offset, reg); -+ -+ /* Update WMM registers */ -+ field.bit_offset = queue_idx * 4; -+ field.bit_mask = 0xf << field.bit_offset; -+ -+ rt2x00pci_register_read(rt2x00dev, WMM_AIFSN_CFG, ®); -+ rt2x00_set_field32(®, field, queue->aifs); -+ rt2x00pci_register_write(rt2x00dev, WMM_AIFSN_CFG, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, WMM_CWMIN_CFG, ®); -+ rt2x00_set_field32(®, field, queue->cw_min); -+ rt2x00pci_register_write(rt2x00dev, WMM_CWMIN_CFG, reg); -+ -+ rt2x00pci_register_read(rt2x00dev, WMM_CWMAX_CFG, ®); -+ rt2x00_set_field32(®, field, queue->cw_max); -+ rt2x00pci_register_write(rt2x00dev, WMM_CWMAX_CFG, reg); -+ -+ /* Update EDCA registers */ -+ offset = EDCA_AC0_CFG + (sizeof(u32) * queue_idx); -+ -+ rt2x00pci_register_read(rt2x00dev, offset, ®); -+ rt2x00_set_field32(®, EDCA_AC0_CFG_TX_OP, queue->txop); -+ rt2x00_set_field32(®, EDCA_AC0_CFG_AIFSN, queue->aifs); -+ rt2x00_set_field32(®, EDCA_AC0_CFG_CWMIN, queue->cw_min); -+ rt2x00_set_field32(®, EDCA_AC0_CFG_CWMAX, queue->cw_max); -+ rt2x00pci_register_write(rt2x00dev, offset, reg); -+ -+ return 0; -+} -+ -+static u64 rt2800pci_get_tsf(struct ieee80211_hw *hw) -+{ -+ struct rt2x00_dev *rt2x00dev = hw->priv; -+ u64 tsf; -+ u32 reg; -+ -+ rt2x00pci_register_read(rt2x00dev, TSF_TIMER_DW1, ®); -+ tsf = (u64) rt2x00_get_field32(reg, TSF_TIMER_DW1_HIGH_WORD) << 32; -+ rt2x00pci_register_read(rt2x00dev, TSF_TIMER_DW0, ®); -+ tsf |= rt2x00_get_field32(reg, TSF_TIMER_DW0_LOW_WORD); -+ -+ return tsf; -+} -+ -+static const struct ieee80211_ops rt2800pci_mac80211_ops = { -+ .tx = rt2x00mac_tx, -+ .start = rt2x00mac_start, -+ .stop = rt2x00mac_stop, -+ .add_interface = rt2x00mac_add_interface, -+ .remove_interface = rt2x00mac_remove_interface, -+ .config = rt2x00mac_config, -+ .configure_filter = rt2x00mac_configure_filter, -+ .set_key = rt2x00mac_set_key, -+ .get_stats = rt2x00mac_get_stats, -+ .get_tkip_seq = rt2800pci_get_tkip_seq, -+ .set_rts_threshold = rt2800pci_set_rts_threshold, -+ .bss_info_changed = rt2x00mac_bss_info_changed, -+ .conf_tx = rt2800pci_conf_tx, -+ .get_tx_stats = rt2x00mac_get_tx_stats, -+ .get_tsf = rt2800pci_get_tsf, -+ .rfkill_poll = rt2x00mac_rfkill_poll, -+}; -+ -+static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = { -+ .irq_handler = rt2800pci_interrupt, -+ .probe_hw = rt2800pci_probe_hw, -+ .get_firmware_name = rt2800pci_get_firmware_name, -+ .check_firmware = rt2800pci_check_firmware, -+ .load_firmware = rt2800pci_load_firmware, -+ .initialize = rt2x00pci_initialize, -+ .uninitialize = rt2x00pci_uninitialize, -+ .get_entry_state = rt2800pci_get_entry_state, -+ .clear_entry = rt2800pci_clear_entry, -+ .set_device_state = rt2800pci_set_device_state, -+ .rfkill_poll = rt2800pci_rfkill_poll, -+ .link_stats = rt2800pci_link_stats, -+ .reset_tuner = rt2800pci_reset_tuner, -+ .link_tuner = rt2800pci_link_tuner, -+ .write_tx_desc = rt2800pci_write_tx_desc, -+ .write_tx_data = rt2x00pci_write_tx_data, -+ .write_beacon = rt2800pci_write_beacon, -+ .kick_tx_queue = rt2800pci_kick_tx_queue, -+ .kill_tx_queue = rt2800pci_kill_tx_queue, -+ .fill_rxdone = rt2800pci_fill_rxdone, -+ .config_shared_key = rt2800pci_config_shared_key, -+ .config_pairwise_key = rt2800pci_config_pairwise_key, -+ .config_filter = rt2800pci_config_filter, -+ .config_intf = rt2800pci_config_intf, -+ .config_erp = rt2800pci_config_erp, -+ .config_ant = rt2800pci_config_ant, -+ .config = rt2800pci_config, -+}; -+ -+static const struct data_queue_desc rt2800pci_queue_rx = { -+ .entry_num = RX_ENTRIES, -+ .data_size = AGGREGATION_SIZE, -+ .desc_size = RXD_DESC_SIZE, -+ .priv_size = sizeof(struct queue_entry_priv_pci), -+}; -+ -+static const struct data_queue_desc rt2800pci_queue_tx = { -+ .entry_num = TX_ENTRIES, -+ .data_size = AGGREGATION_SIZE, -+ .desc_size = TXD_DESC_SIZE, -+ .priv_size = sizeof(struct queue_entry_priv_pci), -+}; -+ -+static const struct data_queue_desc rt2800pci_queue_bcn = { -+ .entry_num = 8 * BEACON_ENTRIES, -+ .data_size = 0, /* No DMA required for beacons */ -+ .desc_size = TXWI_DESC_SIZE, -+ .priv_size = sizeof(struct queue_entry_priv_pci), -+}; -+ -+static const struct rt2x00_ops rt2800pci_ops = { -+ .name = KBUILD_MODNAME, -+ .max_sta_intf = 1, -+ .max_ap_intf = 8, -+ .eeprom_size = EEPROM_SIZE, -+ .rf_size = RF_SIZE, -+ .tx_queues = NUM_TX_QUEUES, -+ .rx = &rt2800pci_queue_rx, -+ .tx = &rt2800pci_queue_tx, -+ .bcn = &rt2800pci_queue_bcn, -+ .lib = &rt2800pci_rt2x00_ops, -+ .hw = &rt2800pci_mac80211_ops, -+#ifdef CONFIG_RT2X00_LIB_DEBUGFS -+ .debugfs = &rt2800pci_rt2x00debug, -+#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ -+}; -+ -+/* -+ * RT2800pci module information. -+ */ -+static struct pci_device_id rt2800pci_device_table[] = { -+ /* Edimax */ -+ { PCI_DEVICE(0x1432, 0x7708), PCI_DEVICE_DATA(&rt2800pci_ops) }, -+ { PCI_DEVICE(0x1432, 0x7727), PCI_DEVICE_DATA(&rt2800pci_ops) }, -+ { PCI_DEVICE(0x1432, 0x7728), PCI_DEVICE_DATA(&rt2800pci_ops) }, -+ { PCI_DEVICE(0x1432, 0x7738), PCI_DEVICE_DATA(&rt2800pci_ops) }, -+ { PCI_DEVICE(0x1432, 0x7748), PCI_DEVICE_DATA(&rt2800pci_ops) }, -+ { PCI_DEVICE(0x1432, 0x7758), PCI_DEVICE_DATA(&rt2800pci_ops) }, -+ { PCI_DEVICE(0x1432, 0x7768), PCI_DEVICE_DATA(&rt2800pci_ops) }, -+ { PCI_DEVICE(0x1814, 0x0601), PCI_DEVICE_DATA(&rt2800pci_ops) }, -+ { PCI_DEVICE(0x1814, 0x0681), PCI_DEVICE_DATA(&rt2800pci_ops) }, -+ { PCI_DEVICE(0x1814, 0x0701), PCI_DEVICE_DATA(&rt2800pci_ops) }, -+ { PCI_DEVICE(0x1814, 0x0781), PCI_DEVICE_DATA(&rt2800pci_ops) }, -+ { PCI_DEVICE(0x1814, 0x3062), PCI_DEVICE_DATA(&rt2800pci_ops) }, -+ { PCI_DEVICE(0x1814, 0x3090), PCI_DEVICE_DATA(&rt2800pci_ops) }, -+ { PCI_DEVICE(0x1814, 0x3091), PCI_DEVICE_DATA(&rt2800pci_ops) }, -+ { PCI_DEVICE(0x1814, 0x3092), PCI_DEVICE_DATA(&rt2800pci_ops) }, -+ { PCI_DEVICE(0x1814, 0x3562), PCI_DEVICE_DATA(&rt2800pci_ops) }, -+ { PCI_DEVICE(0x1814, 0x3592), PCI_DEVICE_DATA(&rt2800pci_ops) }, -+ /* Awt */ -+ { PCI_DEVICE(0x1a3b, 0x1059), PCI_DEVICE_DATA(&rt2800pci_ops) }, -+ { 0, } -+}; -+ -+MODULE_AUTHOR(DRV_PROJECT); -+MODULE_VERSION(DRV_VERSION); -+MODULE_DESCRIPTION("Ralink RT2800 PCI & PCMCIA Wireless LAN driver."); -+MODULE_SUPPORTED_DEVICE("Ralink RT2860 PCI & PCMCIA chipset based cards"); -+#ifdef CONFIG_RT2800PCI_PCI -+MODULE_FIRMWARE(FIRMWARE_RT2860); -+MODULE_DEVICE_TABLE(pci, rt2800pci_device_table); -+#endif /* CONFIG_RT2800PCI_PCI */ -+MODULE_LICENSE("GPL"); -+ -+#ifdef CONFIG_RT2800PCI_WISOC -+#if defined(CONFIG_RALINK_RT288X) -+__rt2x00soc_probe(RT2880, &rt2800pci_ops); -+#elif defined(CONFIG_RALINK_RT305X) -+__rt2x00soc_probe(RT3052, &rt2800pci_ops); -+#endif -+ -+static struct platform_driver rt2800soc_driver = { -+ .driver = { -+ .name = "rt2800_wmac", -+ .owner = THIS_MODULE, -+ .mod_name = KBUILD_MODNAME, -+ }, -+ .probe = __rt2x00soc_probe, -+ .remove = __devexit_p(rt2x00soc_remove), -+ .suspend = rt2x00soc_suspend, -+ .resume = rt2x00soc_resume, -+}; -+#endif /* CONFIG_RT2800PCI_WISOC */ -+ -+#ifdef CONFIG_RT2800PCI_PCI -+static struct pci_driver rt2800pci_driver = { -+ .name = KBUILD_MODNAME, -+ .id_table = rt2800pci_device_table, -+ .probe = rt2x00pci_probe, -+ .remove = __devexit_p(rt2x00pci_remove), -+ .suspend = rt2x00pci_suspend, -+ .resume = rt2x00pci_resume, -+}; -+#endif /* CONFIG_RT2800PCI_PCI */ -+ -+static int __init rt2800pci_init(void) -+{ -+ int ret = 0; -+ -+#ifdef CONFIG_RT2800PCI_WISOC -+ ret = platform_driver_register(&rt2800soc_driver); -+ if (ret) -+ return ret; -+#endif -+#ifdef CONFIG_RT2800PCI_PCI -+ ret = pci_register_driver(&rt2800pci_driver); -+ if (ret) { -+#ifdef CONFIG_RT2800PCI_WISOC -+ platform_driver_unregister(&rt2800soc_driver); -+#endif -+ return ret; -+ } -+#endif -+ -+ return ret; -+} -+ -+static void __exit rt2800pci_exit(void) -+{ -+#ifdef CONFIG_RT2800PCI_PCI -+ pci_unregister_driver(&rt2800pci_driver); -+#endif -+#ifdef CONFIG_RT2800PCI_WISOC -+ platform_driver_unregister(&rt2800soc_driver); -+#endif -+} -+ -+module_init(rt2800pci_init); -+module_exit(rt2800pci_exit); ---- /dev/null -+++ b/drivers/net/wireless/rt2x00/rt2800pci.h -@@ -0,0 +1,1929 @@ -+/* -+ Copyright (C) 2004 - 2009 rt2x00 SourceForge Project -+ -+ -+ 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 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the -+ Free Software Foundation, Inc., -+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ */ -+ -+/* -+ Module: rt2800pci -+ Abstract: Data structures and registers for the rt2800pci module. -+ Supported chipsets: RT2800E & RT2800ED. -+ */ -+ -+#ifndef RT2800PCI_H -+#define RT2800PCI_H -+ -+/* -+ * RF chip defines. -+ * -+ * RF2820 2.4G 2T3R -+ * RF2850 2.4G/5G 2T3R -+ * RF2720 2.4G 1T2R -+ * RF2750 2.4G/5G 1T2R -+ * RF3020 2.4G 1T1R -+ * RF2020 2.4G B/G -+ * RF3021 2.4G 1T2R -+ * RF3022 2.4G 2T2R -+ */ -+#define RF2820 0x0001 -+#define RF2850 0x0002 -+#define RF2720 0x0003 -+#define RF2750 0x0004 -+#define RF3020 0x0005 -+#define RF2020 0x0006 -+#define RF3021 0x0007 -+#define RF3022 0x0008 -+ -+/* -+ * RT2860 version -+ */ -+#define RT2860C_VERSION 0x28600100 -+#define RT2860D_VERSION 0x28600101 -+#define RT2880E_VERSION 0x28720200 -+#define RT2883_VERSION 0x28830300 -+#define RT3070_VERSION 0x30700200 -+ -+/* -+ * Signal information. -+ * Default offset is required for RSSI <-> dBm conversion. -+ */ -+#define DEFAULT_RSSI_OFFSET 120 /* FIXME */ -+ -+/* -+ * Register layout information. -+ */ -+#define CSR_REG_BASE 0x1000 -+#define CSR_REG_SIZE 0x0800 -+#define EEPROM_BASE 0x0000 -+#define EEPROM_SIZE 0x0110 -+#define BBP_BASE 0x0000 -+#define BBP_SIZE 0x0080 -+#define RF_BASE 0x0004 -+#define RF_SIZE 0x0010 -+ -+/* -+ * Number of TX queues. -+ */ -+#define NUM_TX_QUEUES 4 -+ -+/* -+ * PCI registers. -+ */ -+ -+/* -+ * E2PROM_CSR: EEPROM control register. -+ * RELOAD: Write 1 to reload eeprom content. -+ * TYPE: 0: 93c46, 1:93c66. -+ * LOAD_STATUS: 1:loading, 0:done. -+ */ -+#define E2PROM_CSR 0x0004 -+#define E2PROM_CSR_DATA_CLOCK FIELD32(0x00000001) -+#define E2PROM_CSR_CHIP_SELECT FIELD32(0x00000002) -+#define E2PROM_CSR_DATA_IN FIELD32(0x00000004) -+#define E2PROM_CSR_DATA_OUT FIELD32(0x00000008) -+#define E2PROM_CSR_TYPE FIELD32(0x00000030) -+#define E2PROM_CSR_LOAD_STATUS FIELD32(0x00000040) -+#define E2PROM_CSR_RELOAD FIELD32(0x00000080) -+ -+/* -+ * HOST-MCU shared memory -+ */ -+#define HOST_CMD_CSR 0x0404 -+#define HOST_CMD_CSR_HOST_COMMAND FIELD32(0x000000ff) -+ -+/* -+ * INT_SOURCE_CSR: Interrupt source register. -+ * Write one to clear corresponding bit. -+ * TX_FIFO_STATUS: FIFO Statistics is full, sw should read 0x171c -+ */ -+#define INT_SOURCE_CSR 0x0200 -+#define INT_SOURCE_CSR_RXDELAYINT FIELD32(0x00000001) -+#define INT_SOURCE_CSR_TXDELAYINT FIELD32(0x00000002) -+#define INT_SOURCE_CSR_RX_DONE FIELD32(0x00000004) -+#define INT_SOURCE_CSR_AC0_DMA_DONE FIELD32(0x00000008) -+#define INT_SOURCE_CSR_AC1_DMA_DONE FIELD32(0x00000010) -+#define INT_SOURCE_CSR_AC2_DMA_DONE FIELD32(0x00000020) -+#define INT_SOURCE_CSR_AC3_DMA_DONE FIELD32(0x00000040) -+#define INT_SOURCE_CSR_HCCA_DMA_DONE FIELD32(0x00000080) -+#define INT_SOURCE_CSR_MGMT_DMA_DONE FIELD32(0x00000100) -+#define INT_SOURCE_CSR_MCU_COMMAND FIELD32(0x00000200) -+#define INT_SOURCE_CSR_RXTX_COHERENT FIELD32(0x00000400) -+#define INT_SOURCE_CSR_TBTT FIELD32(0x00000800) -+#define INT_SOURCE_CSR_PRE_TBTT FIELD32(0x00001000) -+#define INT_SOURCE_CSR_TX_FIFO_STATUS FIELD32(0x00002000) -+#define INT_SOURCE_CSR_AUTO_WAKEUP FIELD32(0x00004000) -+#define INT_SOURCE_CSR_GPTIMER FIELD32(0x00008000) -+#define INT_SOURCE_CSR_RX_COHERENT FIELD32(0x00010000) -+#define INT_SOURCE_CSR_TX_COHERENT FIELD32(0x00020000) -+ -+/* -+ * INT_MASK_CSR: Interrupt MASK register. 1: the interrupt is mask OFF. -+ */ -+#define INT_MASK_CSR 0x0204 -+#define INT_MASK_CSR_RXDELAYINT FIELD32(0x00000001) -+#define INT_MASK_CSR_TXDELAYINT FIELD32(0x00000002) -+#define INT_MASK_CSR_RX_DONE FIELD32(0x00000004) -+#define INT_MASK_CSR_AC0_DMA_DONE FIELD32(0x00000008) -+#define INT_MASK_CSR_AC1_DMA_DONE FIELD32(0x00000010) -+#define INT_MASK_CSR_AC2_DMA_DONE FIELD32(0x00000020) -+#define INT_MASK_CSR_AC3_DMA_DONE FIELD32(0x00000040) -+#define INT_MASK_CSR_HCCA_DMA_DONE FIELD32(0x00000080) -+#define INT_MASK_CSR_MGMT_DMA_DONE FIELD32(0x00000100) -+#define INT_MASK_CSR_MCU_COMMAND FIELD32(0x00000200) -+#define INT_MASK_CSR_RXTX_COHERENT FIELD32(0x00000400) -+#define INT_MASK_CSR_TBTT FIELD32(0x00000800) -+#define INT_MASK_CSR_PRE_TBTT FIELD32(0x00001000) -+#define INT_MASK_CSR_TX_FIFO_STATUS FIELD32(0x00002000) -+#define INT_MASK_CSR_AUTO_WAKEUP FIELD32(0x00004000) -+#define INT_MASK_CSR_GPTIMER FIELD32(0x00008000) -+#define INT_MASK_CSR_RX_COHERENT FIELD32(0x00010000) -+#define INT_MASK_CSR_TX_COHERENT FIELD32(0x00020000) -+ -+/* -+ * WPDMA_GLO_CFG -+ */ -+#define WPDMA_GLO_CFG 0x0208 -+#define WPDMA_GLO_CFG_ENABLE_TX_DMA FIELD32(0x00000001) -+#define WPDMA_GLO_CFG_TX_DMA_BUSY FIELD32(0x00000002) -+#define WPDMA_GLO_CFG_ENABLE_RX_DMA FIELD32(0x00000004) -+#define WPDMA_GLO_CFG_RX_DMA_BUSY FIELD32(0x00000008) -+#define WPDMA_GLO_CFG_WP_DMA_BURST_SIZE FIELD32(0x00000030) -+#define WPDMA_GLO_CFG_TX_WRITEBACK_DONE FIELD32(0x00000040) -+#define WPDMA_GLO_CFG_BIG_ENDIAN FIELD32(0x00000080) -+#define WPDMA_GLO_CFG_RX_HDR_SCATTER FIELD32(0x0000ff00) -+#define WPDMA_GLO_CFG_HDR_SEG_LEN FIELD32(0xffff0000) -+ -+/* -+ * WPDMA_RST_IDX -+ */ -+#define WPDMA_RST_IDX 0x020c -+#define WPDMA_RST_IDX_DTX_IDX0 FIELD32(0x00000001) -+#define WPDMA_RST_IDX_DTX_IDX1 FIELD32(0x00000002) -+#define WPDMA_RST_IDX_DTX_IDX2 FIELD32(0x00000004) -+#define WPDMA_RST_IDX_DTX_IDX3 FIELD32(0x00000008) -+#define WPDMA_RST_IDX_DTX_IDX4 FIELD32(0x00000010) -+#define WPDMA_RST_IDX_DTX_IDX5 FIELD32(0x00000020) -+#define WPDMA_RST_IDX_DRX_IDX0 FIELD32(0x00010000) -+ -+/* -+ * DELAY_INT_CFG -+ */ -+#define DELAY_INT_CFG 0x0210 -+#define DELAY_INT_CFG_RXMAX_PTIME FIELD32(0x000000ff) -+#define DELAY_INT_CFG_RXMAX_PINT FIELD32(0x00007f00) -+#define DELAY_INT_CFG_RXDLY_INT_EN FIELD32(0x00008000) -+#define DELAY_INT_CFG_TXMAX_PTIME FIELD32(0x00ff0000) -+#define DELAY_INT_CFG_TXMAX_PINT FIELD32(0x7f000000) -+#define DELAY_INT_CFG_TXDLY_INT_EN FIELD32(0x80000000) -+ -+/* -+ * WMM_AIFSN_CFG: Aifsn for each EDCA AC -+ * AIFSN0: AC_BE -+ * AIFSN1: AC_BK -+ * AIFSN1: AC_VI -+ * AIFSN1: AC_VO -+ */ -+#define WMM_AIFSN_CFG 0x0214 -+#define WMM_AIFSN_CFG_AIFSN0 FIELD32(0x0000000f) -+#define WMM_AIFSN_CFG_AIFSN1 FIELD32(0x000000f0) -+#define WMM_AIFSN_CFG_AIFSN2 FIELD32(0x00000f00) -+#define WMM_AIFSN_CFG_AIFSN3 FIELD32(0x0000f000) -+ -+/* -+ * WMM_CWMIN_CSR: CWmin for each EDCA AC -+ * CWMIN0: AC_BE -+ * CWMIN1: AC_BK -+ * CWMIN1: AC_VI -+ * CWMIN1: AC_VO -+ */ -+#define WMM_CWMIN_CFG 0x0218 -+#define WMM_CWMIN_CFG_CWMIN0 FIELD32(0x0000000f) -+#define WMM_CWMIN_CFG_CWMIN1 FIELD32(0x000000f0) -+#define WMM_CWMIN_CFG_CWMIN2 FIELD32(0x00000f00) -+#define WMM_CWMIN_CFG_CWMIN3 FIELD32(0x0000f000) -+ -+/* -+ * WMM_CWMAX_CSR: CWmax for each EDCA AC -+ * CWMAX0: AC_BE -+ * CWMAX1: AC_BK -+ * CWMAX1: AC_VI -+ * CWMAX1: AC_VO -+ */ -+#define WMM_CWMAX_CFG 0x021c -+#define WMM_CWMAX_CFG_CWMAX0 FIELD32(0x0000000f) -+#define WMM_CWMAX_CFG_CWMAX1 FIELD32(0x000000f0) -+#define WMM_CWMAX_CFG_CWMAX2 FIELD32(0x00000f00) -+#define WMM_CWMAX_CFG_CWMAX3 FIELD32(0x0000f000) -+ -+/* -+ * AC_TXOP0: AC_BK/AC_BE TXOP register -+ * AC0TXOP: AC_BK in unit of 32us -+ * AC1TXOP: AC_BE in unit of 32us -+ */ -+#define WMM_TXOP0_CFG 0x0220 -+#define WMM_TXOP0_CFG_AC0TXOP FIELD32(0x0000ffff) -+#define WMM_TXOP0_CFG_AC1TXOP FIELD32(0xffff0000) -+ -+/* -+ * AC_TXOP1: AC_VO/AC_VI TXOP register -+ * AC2TXOP: AC_VI in unit of 32us -+ * AC3TXOP: AC_VO in unit of 32us -+ */ -+#define WMM_TXOP1_CFG 0x0224 -+#define WMM_TXOP1_CFG_AC2TXOP FIELD32(0x0000ffff) -+#define WMM_TXOP1_CFG_AC3TXOP FIELD32(0xffff0000) -+ -+/* -+ * GPIO_CTRL_CFG: -+ */ -+#define GPIO_CTRL_CFG 0x0228 -+#define GPIO_CTRL_CFG_BIT0 FIELD32(0x00000001) -+#define GPIO_CTRL_CFG_BIT1 FIELD32(0x00000002) -+#define GPIO_CTRL_CFG_BIT2 FIELD32(0x00000004) -+#define GPIO_CTRL_CFG_BIT3 FIELD32(0x00000008) -+#define GPIO_CTRL_CFG_BIT4 FIELD32(0x00000010) -+#define GPIO_CTRL_CFG_BIT5 FIELD32(0x00000020) -+#define GPIO_CTRL_CFG_BIT6 FIELD32(0x00000040) -+#define GPIO_CTRL_CFG_BIT7 FIELD32(0x00000080) -+#define GPIO_CTRL_CFG_BIT8 FIELD32(0x00000100) -+ -+/* -+ * MCU_CMD_CFG -+ */ -+#define MCU_CMD_CFG 0x022c -+ -+/* -+ * AC_BK register offsets -+ */ -+#define TX_BASE_PTR0 0x0230 -+#define TX_MAX_CNT0 0x0234 -+#define TX_CTX_IDX0 0x0238 -+#define TX_DTX_IDX0 0x023c -+ -+/* -+ * AC_BE register offsets -+ */ -+#define TX_BASE_PTR1 0x0240 -+#define TX_MAX_CNT1 0x0244 -+#define TX_CTX_IDX1 0x0248 -+#define TX_DTX_IDX1 0x024c -+ -+/* -+ * AC_VI register offsets -+ */ -+#define TX_BASE_PTR2 0x0250 -+#define TX_MAX_CNT2 0x0254 -+#define TX_CTX_IDX2 0x0258 -+#define TX_DTX_IDX2 0x025c -+ -+/* -+ * AC_VO register offsets -+ */ -+#define TX_BASE_PTR3 0x0260 -+#define TX_MAX_CNT3 0x0264 -+#define TX_CTX_IDX3 0x0268 -+#define TX_DTX_IDX3 0x026c -+ -+/* -+ * HCCA register offsets -+ */ -+#define TX_BASE_PTR4 0x0270 -+#define TX_MAX_CNT4 0x0274 -+#define TX_CTX_IDX4 0x0278 -+#define TX_DTX_IDX4 0x027c -+ -+/* -+ * MGMT register offsets -+ */ -+#define TX_BASE_PTR5 0x0280 -+#define TX_MAX_CNT5 0x0284 -+#define TX_CTX_IDX5 0x0288 -+#define TX_DTX_IDX5 0x028c -+ -+/* -+ * Queue register offset macros -+ */ -+#define TX_QUEUE_REG_OFFSET 0x10 -+#define TX_BASE_PTR(__x) TX_BASE_PTR0 + ((__x) * TX_QUEUE_REG_OFFSET) -+#define TX_MAX_CNT(__x) TX_MAX_CNT0 + ((__x) * TX_QUEUE_REG_OFFSET) -+#define TX_CTX_IDX(__x) TX_CTX_IDX0 + ((__x) * TX_QUEUE_REG_OFFSET) -+#define TX_DTX_IDX(__x) TX_DTX_IDX0 + ((__x) * TX_QUEUE_REG_OFFSET) -+ -+/* -+ * RX register offsets -+ */ -+#define RX_BASE_PTR 0x0290 -+#define RX_MAX_CNT 0x0294 -+#define RX_CRX_IDX 0x0298 -+#define RX_DRX_IDX 0x029c -+ -+/* -+ * PBF_SYS_CTRL -+ * HOST_RAM_WRITE: enable Host program ram write selection -+ */ -+#define PBF_SYS_CTRL 0x0400 -+#define PBF_SYS_CTRL_READY FIELD32(0x00000080) -+#define PBF_SYS_CTRL_HOST_RAM_WRITE FIELD32(0x00010000) -+ -+/* -+ * PBF registers -+ * Most are for debug. Driver doesn't touch PBF register. -+ */ -+#define PBF_CFG 0x0408 -+#define PBF_MAX_PCNT 0x040c -+#define PBF_CTRL 0x0410 -+#define PBF_INT_STA 0x0414 -+#define PBF_INT_ENA 0x0418 -+ -+/* -+ * BCN_OFFSET0: -+ */ -+#define BCN_OFFSET0 0x042c -+#define BCN_OFFSET0_BCN0 FIELD32(0x000000ff) -+#define BCN_OFFSET0_BCN1 FIELD32(0x0000ff00) -+#define BCN_OFFSET0_BCN2 FIELD32(0x00ff0000) -+#define BCN_OFFSET0_BCN3 FIELD32(0xff000000) -+ -+/* -+ * BCN_OFFSET1: -+ */ -+#define BCN_OFFSET1 0x0430 -+#define BCN_OFFSET1_BCN4 FIELD32(0x000000ff) -+#define BCN_OFFSET1_BCN5 FIELD32(0x0000ff00) -+#define BCN_OFFSET1_BCN6 FIELD32(0x00ff0000) -+#define BCN_OFFSET1_BCN7 FIELD32(0xff000000) -+ -+/* -+ * PBF registers -+ * Most are for debug. Driver doesn't touch PBF register. -+ */ -+#define TXRXQ_PCNT 0x0438 -+#define PBF_DBG 0x043c -+ -+/* -+ * RF registers -+ */ -+#define RF_CSR_CFG 0x0500 -+#define RF_CSR_CFG_DATA FIELD32(0x000000ff) -+#define RF_CSR_CFG_REGNUM FIELD32(0x00001f00) -+#define RF_CSR_CFG_WRITE FIELD32(0x00010000) -+#define RF_CSR_CFG_BUSY FIELD32(0x00020000) -+ -+/* -+ * MAC Control/Status Registers(CSR). -+ * Some values are set in TU, whereas 1 TU == 1024 us. -+ */ -+ -+/* -+ * MAC_CSR0: ASIC revision number. -+ * ASIC_REV: 0 -+ * ASIC_VER: 2860 -+ */ -+#define MAC_CSR0 0x1000 -+#define MAC_CSR0_ASIC_REV FIELD32(0x0000ffff) -+#define MAC_CSR0_ASIC_VER FIELD32(0xffff0000) -+ -+/* -+ * MAC_SYS_CTRL: -+ */ -+#define MAC_SYS_CTRL 0x1004 -+#define MAC_SYS_CTRL_RESET_CSR FIELD32(0x00000001) -+#define MAC_SYS_CTRL_RESET_BBP FIELD32(0x00000002) -+#define MAC_SYS_CTRL_ENABLE_TX FIELD32(0x00000004) -+#define MAC_SYS_CTRL_ENABLE_RX FIELD32(0x00000008) -+#define MAC_SYS_CTRL_CONTINUOUS_TX FIELD32(0x00000010) -+#define MAC_SYS_CTRL_LOOPBACK FIELD32(0x00000020) -+#define MAC_SYS_CTRL_WLAN_HALT FIELD32(0x00000040) -+#define MAC_SYS_CTRL_RX_TIMESTAMP FIELD32(0x00000080) -+ -+/* -+ * MAC_ADDR_DW0: STA MAC register 0 -+ */ -+#define MAC_ADDR_DW0 0x1008 -+#define MAC_ADDR_DW0_BYTE0 FIELD32(0x000000ff) -+#define MAC_ADDR_DW0_BYTE1 FIELD32(0x0000ff00) -+#define MAC_ADDR_DW0_BYTE2 FIELD32(0x00ff0000) -+#define MAC_ADDR_DW0_BYTE3 FIELD32(0xff000000) -+ -+/* -+ * MAC_ADDR_DW1: STA MAC register 1 -+ * UNICAST_TO_ME_MASK: -+ * Used to mask off bits from byte 5 of the MAC address -+ * to determine the UNICAST_TO_ME bit for RX frames. -+ * The full mask is complemented by BSS_ID_MASK: -+ * MASK = BSS_ID_MASK & UNICAST_TO_ME_MASK -+ */ -+#define MAC_ADDR_DW1 0x100c -+#define MAC_ADDR_DW1_BYTE4 FIELD32(0x000000ff) -+#define MAC_ADDR_DW1_BYTE5 FIELD32(0x0000ff00) -+#define MAC_ADDR_DW1_UNICAST_TO_ME_MASK FIELD32(0x00ff0000) -+ -+/* -+ * MAC_BSSID_DW0: BSSID register 0 -+ */ -+#define MAC_BSSID_DW0 0x1010 -+#define MAC_BSSID_DW0_BYTE0 FIELD32(0x000000ff) -+#define MAC_BSSID_DW0_BYTE1 FIELD32(0x0000ff00) -+#define MAC_BSSID_DW0_BYTE2 FIELD32(0x00ff0000) -+#define MAC_BSSID_DW0_BYTE3 FIELD32(0xff000000) -+ -+/* -+ * MAC_BSSID_DW1: BSSID register 1 -+ * BSS_ID_MASK: -+ * 0: 1-BSSID mode (BSS index = 0) -+ * 1: 2-BSSID mode (BSS index: Byte5, bit 0) -+ * 2: 4-BSSID mode (BSS index: byte5, bit 0 - 1) -+ * 3: 8-BSSID mode (BSS index: byte5, bit 0 - 2) -+ * This mask is used to mask off bits 0, 1 and 2 of byte 5 of the -+ * BSSID. This will make sure that those bits will be ignored -+ * when determining the MY_BSS of RX frames. -+ */ -+#define MAC_BSSID_DW1 0x1014 -+#define MAC_BSSID_DW1_BYTE4 FIELD32(0x000000ff) -+#define MAC_BSSID_DW1_BYTE5 FIELD32(0x0000ff00) -+#define MAC_BSSID_DW1_BSS_ID_MASK FIELD32(0x00030000) -+#define MAC_BSSID_DW1_BSS_BCN_NUM FIELD32(0x001c0000) -+ -+/* -+ * MAX_LEN_CFG: Maximum frame length register. -+ * MAX_MPDU: rt2860b max 16k bytes -+ * MAX_PSDU: Maximum PSDU length -+ * (power factor) 0:2^13, 1:2^14, 2:2^15, 3:2^16 -+ */ -+#define MAX_LEN_CFG 0x1018 -+#define MAX_LEN_CFG_MAX_MPDU FIELD32(0x00000fff) -+#define MAX_LEN_CFG_MAX_PSDU FIELD32(0x00003000) -+#define MAX_LEN_CFG_MIN_PSDU FIELD32(0x0000c000) -+#define MAX_LEN_CFG_MIN_MPDU FIELD32(0x000f0000) -+ -+/* -+ * BBP_CSR_CFG: BBP serial control register -+ * VALUE: Register value to program into BBP -+ * REG_NUM: Selected BBP register -+ * READ_CONTROL: 0 write BBP, 1 read BBP -+ * BUSY: ASIC is busy executing BBP commands -+ * BBP_PAR_DUR: 0 4 MAC clocks, 1 8 MAC clocks -+ * BBP_RW_MODE: 0 serial, 1 paralell -+ */ -+#define BBP_CSR_CFG 0x101c -+#define BBP_CSR_CFG_VALUE FIELD32(0x000000ff) -+#define BBP_CSR_CFG_REGNUM FIELD32(0x0000ff00) -+#define BBP_CSR_CFG_READ_CONTROL FIELD32(0x00010000) -+#define BBP_CSR_CFG_BUSY FIELD32(0x00020000) -+#define BBP_CSR_CFG_BBP_PAR_DUR FIELD32(0x00040000) -+#define BBP_CSR_CFG_BBP_RW_MODE FIELD32(0x00080000) -+ -+/* -+ * RF_CSR_CFG0: RF control register -+ * REGID_AND_VALUE: Register value to program into RF -+ * BITWIDTH: Selected RF register -+ * STANDBYMODE: 0 high when standby, 1 low when standby -+ * SEL: 0 RF_LE0 activate, 1 RF_LE1 activate -+ * BUSY: ASIC is busy executing RF commands -+ */ -+#define RF_CSR_CFG0 0x1020 -+#define RF_CSR_CFG0_REGID_AND_VALUE FIELD32(0x00ffffff) -+#define RF_CSR_CFG0_BITWIDTH FIELD32(0x1f000000) -+#define RF_CSR_CFG0_REG_VALUE_BW FIELD32(0x1fffffff) -+#define RF_CSR_CFG0_STANDBYMODE FIELD32(0x20000000) -+#define RF_CSR_CFG0_SEL FIELD32(0x40000000) -+#define RF_CSR_CFG0_BUSY FIELD32(0x80000000) -+ -+/* -+ * RF_CSR_CFG1: RF control register -+ * REGID_AND_VALUE: Register value to program into RF -+ * RFGAP: Gap between BB_CONTROL_RF and RF_LE -+ * 0: 3 system clock cycle (37.5usec) -+ * 1: 5 system clock cycle (62.5usec) -+ */ -+#define RF_CSR_CFG1 0x1024 -+#define RF_CSR_CFG1_REGID_AND_VALUE FIELD32(0x00ffffff) -+#define RF_CSR_CFG1_RFGAP FIELD32(0x1f000000) -+ -+/* -+ * RF_CSR_CFG2: RF control register -+ * VALUE: Register value to program into RF -+ * RFGAP: Gap between BB_CONTROL_RF and RF_LE -+ * 0: 3 system clock cycle (37.5usec) -+ * 1: 5 system clock cycle (62.5usec) -+ */ -+#define RF_CSR_CFG2 0x1028 -+#define RF_CSR_CFG2_VALUE FIELD32(0x00ffffff) -+ -+/* -+ * LED_CFG: LED control -+ * color LED's: -+ * 0: off -+ * 1: blinking upon TX2 -+ * 2: periodic slow blinking -+ * 3: always on -+ * LED polarity: -+ * 0: active low -+ * 1: active high -+ */ -+#define LED_CFG 0x102c -+#define LED_CFG_ON_PERIOD FIELD32(0x000000ff) -+#define LED_CFG_OFF_PERIOD FIELD32(0x0000ff00) -+#define LED_CFG_SLOW_BLINK_PERIOD FIELD32(0x003f0000) -+#define LED_CFG_R_LED_MODE FIELD32(0x03000000) -+#define LED_CFG_G_LED_MODE FIELD32(0x0c000000) -+#define LED_CFG_Y_LED_MODE FIELD32(0x30000000) -+#define LED_CFG_LED_POLAR FIELD32(0x40000000) -+ -+/* -+ * XIFS_TIME_CFG: MAC timing -+ * CCKM_SIFS_TIME: unit 1us. Applied after CCK RX/TX -+ * OFDM_SIFS_TIME: unit 1us. Applied after OFDM RX/TX -+ * OFDM_XIFS_TIME: unit 1us. Applied after OFDM RX -+ * when MAC doesn't reference BBP signal BBRXEND -+ * EIFS: unit 1us -+ * BB_RXEND_ENABLE: reference RXEND signal to begin XIFS defer -+ * -+ */ -+#define XIFS_TIME_CFG 0x1100 -+#define XIFS_TIME_CFG_CCKM_SIFS_TIME FIELD32(0x000000ff) -+#define XIFS_TIME_CFG_OFDM_SIFS_TIME FIELD32(0x0000ff00) -+#define XIFS_TIME_CFG_OFDM_XIFS_TIME FIELD32(0x000f0000) -+#define XIFS_TIME_CFG_EIFS FIELD32(0x1ff00000) -+#define XIFS_TIME_CFG_BB_RXEND_ENABLE FIELD32(0x20000000) -+ -+/* -+ * BKOFF_SLOT_CFG: -+ */ -+#define BKOFF_SLOT_CFG 0x1104 -+#define BKOFF_SLOT_CFG_SLOT_TIME FIELD32(0x000000ff) -+#define BKOFF_SLOT_CFG_CC_DELAY_TIME FIELD32(0x0000ff00) -+ -+/* -+ * NAV_TIME_CFG: -+ */ -+#define NAV_TIME_CFG 0x1108 -+#define NAV_TIME_CFG_SIFS FIELD32(0x000000ff) -+#define NAV_TIME_CFG_SLOT_TIME FIELD32(0x0000ff00) -+#define NAV_TIME_CFG_EIFS FIELD32(0x01ff0000) -+#define NAV_TIME_ZERO_SIFS FIELD32(0x02000000) -+ -+/* -+ * CH_TIME_CFG: count as channel busy -+ */ -+#define CH_TIME_CFG 0x110c -+ -+/* -+ * PBF_LIFE_TIMER: TX/RX MPDU timestamp timer (free run) Unit: 1us -+ */ -+#define PBF_LIFE_TIMER 0x1110 -+ -+/* -+ * BCN_TIME_CFG: -+ * BEACON_INTERVAL: in unit of 1/16 TU -+ * TSF_TICKING: Enable TSF auto counting -+ * TSF_SYNC: Enable TSF sync, 00: disable, 01: infra mode, 10: ad-hoc mode -+ * BEACON_GEN: Enable beacon generator -+ */ -+#define BCN_TIME_CFG 0x1114 -+#define BCN_TIME_CFG_BEACON_INTERVAL FIELD32(0x0000ffff) -+#define BCN_TIME_CFG_TSF_TICKING FIELD32(0x00010000) -+#define BCN_TIME_CFG_TSF_SYNC FIELD32(0x00060000) -+#define BCN_TIME_CFG_TBTT_ENABLE FIELD32(0x00080000) -+#define BCN_TIME_CFG_BEACON_GEN FIELD32(0x00100000) -+#define BCN_TIME_CFG_TX_TIME_COMPENSATE FIELD32(0xf0000000) -+ -+/* -+ * TBTT_SYNC_CFG: -+ */ -+#define TBTT_SYNC_CFG 0x1118 -+ -+/* -+ * TSF_TIMER_DW0: Local lsb TSF timer, read-only -+ */ -+#define TSF_TIMER_DW0 0x111c -+#define TSF_TIMER_DW0_LOW_WORD FIELD32(0xffffffff) -+ -+/* -+ * TSF_TIMER_DW1: Local msb TSF timer, read-only -+ */ -+#define TSF_TIMER_DW1 0x1120 -+#define TSF_TIMER_DW1_HIGH_WORD FIELD32(0xffffffff) -+ -+/* -+ * TBTT_TIMER: TImer remains till next TBTT, read-only -+ */ -+#define TBTT_TIMER 0x1124 -+ -+/* -+ * INT_TIMER_CFG: -+ */ -+#define INT_TIMER_CFG 0x1128 -+ -+/* -+ * INT_TIMER_EN: GP-timer and pre-tbtt Int enable -+ */ -+#define INT_TIMER_EN 0x112c -+ -+/* -+ * CH_IDLE_STA: channel idle time -+ */ -+#define CH_IDLE_STA 0x1130 -+ -+/* -+ * CH_BUSY_STA: channel busy time -+ */ -+#define CH_BUSY_STA 0x1134 -+ -+/* -+ * MAC_STATUS_CFG: -+ * BBP_RF_BUSY: When set to 0, BBP and RF are stable. -+ * if 1 or higher one of the 2 registers is busy. -+ */ -+#define MAC_STATUS_CFG 0x1200 -+#define MAC_STATUS_CFG_BBP_RF_BUSY FIELD32(0x00000003) -+ -+/* -+ * PWR_PIN_CFG: -+ */ -+#define PWR_PIN_CFG 0x1204 -+ -+/* -+ * AUTOWAKEUP_CFG: Manual power control / status register -+ * TBCN_BEFORE_WAKE: ForceWake has high privilege than PutToSleep when both set -+ * AUTOWAKE: 0:sleep, 1:awake -+ */ -+#define AUTOWAKEUP_CFG 0x1208 -+#define AUTOWAKEUP_CFG_AUTO_LEAD_TIME FIELD32(0x000000ff) -+#define AUTOWAKEUP_CFG_TBCN_BEFORE_WAKE FIELD32(0x00007f00) -+#define AUTOWAKEUP_CFG_AUTOWAKE FIELD32(0x00008000) -+ -+/* -+ * EDCA_AC0_CFG: -+ */ -+#define EDCA_AC0_CFG 0x1300 -+#define EDCA_AC0_CFG_TX_OP FIELD32(0x000000ff) -+#define EDCA_AC0_CFG_AIFSN FIELD32(0x00000f00) -+#define EDCA_AC0_CFG_CWMIN FIELD32(0x0000f000) -+#define EDCA_AC0_CFG_CWMAX FIELD32(0x000f0000) -+ -+/* -+ * EDCA_AC1_CFG: -+ */ -+#define EDCA_AC1_CFG 0x1304 -+#define EDCA_AC1_CFG_TX_OP FIELD32(0x000000ff) -+#define EDCA_AC1_CFG_AIFSN FIELD32(0x00000f00) -+#define EDCA_AC1_CFG_CWMIN FIELD32(0x0000f000) -+#define EDCA_AC1_CFG_CWMAX FIELD32(0x000f0000) -+ -+/* -+ * EDCA_AC2_CFG: -+ */ -+#define EDCA_AC2_CFG 0x1308 -+#define EDCA_AC2_CFG_TX_OP FIELD32(0x000000ff) -+#define EDCA_AC2_CFG_AIFSN FIELD32(0x00000f00) -+#define EDCA_AC2_CFG_CWMIN FIELD32(0x0000f000) -+#define EDCA_AC2_CFG_CWMAX FIELD32(0x000f0000) -+ -+/* -+ * EDCA_AC3_CFG: -+ */ -+#define EDCA_AC3_CFG 0x130c -+#define EDCA_AC3_CFG_TX_OP FIELD32(0x000000ff) -+#define EDCA_AC3_CFG_AIFSN FIELD32(0x00000f00) -+#define EDCA_AC3_CFG_CWMIN FIELD32(0x0000f000) -+#define EDCA_AC3_CFG_CWMAX FIELD32(0x000f0000) -+ -+/* -+ * EDCA_TID_AC_MAP: -+ */ -+#define EDCA_TID_AC_MAP 0x1310 -+ -+/* -+ * TX_PWR_CFG_0: -+ */ -+#define TX_PWR_CFG_0 0x1314 -+#define TX_PWR_CFG_0_1MBS FIELD32(0x0000000f) -+#define TX_PWR_CFG_0_2MBS FIELD32(0x000000f0) -+#define TX_PWR_CFG_0_55MBS FIELD32(0x00000f00) -+#define TX_PWR_CFG_0_11MBS FIELD32(0x0000f000) -+#define TX_PWR_CFG_0_6MBS FIELD32(0x000f0000) -+#define TX_PWR_CFG_0_9MBS FIELD32(0x00f00000) -+#define TX_PWR_CFG_0_12MBS FIELD32(0x0f000000) -+#define TX_PWR_CFG_0_18MBS FIELD32(0xf0000000) -+ -+/* -+ * TX_PWR_CFG_1: -+ */ -+#define TX_PWR_CFG_1 0x1318 -+#define TX_PWR_CFG_1_24MBS FIELD32(0x0000000f) -+#define TX_PWR_CFG_1_36MBS FIELD32(0x000000f0) -+#define TX_PWR_CFG_1_48MBS FIELD32(0x00000f00) -+#define TX_PWR_CFG_1_54MBS FIELD32(0x0000f000) -+#define TX_PWR_CFG_1_MCS0 FIELD32(0x000f0000) -+#define TX_PWR_CFG_1_MCS1 FIELD32(0x00f00000) -+#define TX_PWR_CFG_1_MCS2 FIELD32(0x0f000000) -+#define TX_PWR_CFG_1_MCS3 FIELD32(0xf0000000) -+ -+/* -+ * TX_PWR_CFG_2: -+ */ -+#define TX_PWR_CFG_2 0x131c -+#define TX_PWR_CFG_2_MCS4 FIELD32(0x0000000f) -+#define TX_PWR_CFG_2_MCS5 FIELD32(0x000000f0) -+#define TX_PWR_CFG_2_MCS6 FIELD32(0x00000f00) -+#define TX_PWR_CFG_2_MCS7 FIELD32(0x0000f000) -+#define TX_PWR_CFG_2_MCS8 FIELD32(0x000f0000) -+#define TX_PWR_CFG_2_MCS9 FIELD32(0x00f00000) -+#define TX_PWR_CFG_2_MCS10 FIELD32(0x0f000000) -+#define TX_PWR_CFG_2_MCS11 FIELD32(0xf0000000) -+ -+/* -+ * TX_PWR_CFG_3: -+ */ -+#define TX_PWR_CFG_3 0x1320 -+#define TX_PWR_CFG_3_MCS12 FIELD32(0x0000000f) -+#define TX_PWR_CFG_3_MCS13 FIELD32(0x000000f0) -+#define TX_PWR_CFG_3_MCS14 FIELD32(0x00000f00) -+#define TX_PWR_CFG_3_MCS15 FIELD32(0x0000f000) -+#define TX_PWR_CFG_3_UKNOWN1 FIELD32(0x000f0000) -+#define TX_PWR_CFG_3_UKNOWN2 FIELD32(0x00f00000) -+#define TX_PWR_CFG_3_UKNOWN3 FIELD32(0x0f000000) -+#define TX_PWR_CFG_3_UKNOWN4 FIELD32(0xf0000000) -+ -+/* -+ * TX_PWR_CFG_4: -+ */ -+#define TX_PWR_CFG_4 0x1324 -+#define TX_PWR_CFG_4_UKNOWN5 FIELD32(0x0000000f) -+#define TX_PWR_CFG_4_UKNOWN6 FIELD32(0x000000f0) -+#define TX_PWR_CFG_4_UKNOWN7 FIELD32(0x00000f00) -+#define TX_PWR_CFG_4_UKNOWN8 FIELD32(0x0000f000) -+ -+/* -+ * TX_PIN_CFG: -+ */ -+#define TX_PIN_CFG 0x1328 -+#define TX_PIN_CFG_PA_PE_A0_EN FIELD32(0x00000001) -+#define TX_PIN_CFG_PA_PE_G0_EN FIELD32(0x00000002) -+#define TX_PIN_CFG_PA_PE_A1_EN FIELD32(0x00000004) -+#define TX_PIN_CFG_PA_PE_G1_EN FIELD32(0x00000008) -+#define TX_PIN_CFG_PA_PE_A0_POL FIELD32(0x00000010) -+#define TX_PIN_CFG_PA_PE_G0_POL FIELD32(0x00000020) -+#define TX_PIN_CFG_PA_PE_A1_POL FIELD32(0x00000040) -+#define TX_PIN_CFG_PA_PE_G1_POL FIELD32(0x00000080) -+#define TX_PIN_CFG_LNA_PE_A0_EN FIELD32(0x00000100) -+#define TX_PIN_CFG_LNA_PE_G0_EN FIELD32(0x00000200) -+#define TX_PIN_CFG_LNA_PE_A1_EN FIELD32(0x00000400) -+#define TX_PIN_CFG_LNA_PE_G1_EN FIELD32(0x00000800) -+#define TX_PIN_CFG_LNA_PE_A0_POL FIELD32(0x00001000) -+#define TX_PIN_CFG_LNA_PE_G0_POL FIELD32(0x00002000) -+#define TX_PIN_CFG_LNA_PE_A1_POL FIELD32(0x00004000) -+#define TX_PIN_CFG_LNA_PE_G1_POL FIELD32(0x00008000) -+#define TX_PIN_CFG_RFTR_EN FIELD32(0x00010000) -+#define TX_PIN_CFG_RFTR_POL FIELD32(0x00020000) -+#define TX_PIN_CFG_TRSW_EN FIELD32(0x00040000) -+#define TX_PIN_CFG_TRSW_POL FIELD32(0x00080000) -+ -+/* -+ * TX_BAND_CFG: 0x1 use upper 20MHz, 0x0 use lower 20MHz -+ */ -+#define TX_BAND_CFG 0x132c -+#define TX_BAND_CFG_HT40_PLUS FIELD32(0x00000001) -+#define TX_BAND_CFG_A FIELD32(0x00000002) -+#define TX_BAND_CFG_BG FIELD32(0x00000004) -+ -+/* -+ * TX_SW_CFG0: -+ */ -+#define TX_SW_CFG0 0x1330 -+ -+/* -+ * TX_SW_CFG1: -+ */ -+#define TX_SW_CFG1 0x1334 -+ -+/* -+ * TX_SW_CFG2: -+ */ -+#define TX_SW_CFG2 0x1338 -+ -+/* -+ * TXOP_THRES_CFG: -+ */ -+#define TXOP_THRES_CFG 0x133c -+ -+/* -+ * TXOP_CTRL_CFG: -+ */ -+#define TXOP_CTRL_CFG 0x1340 -+ -+/* -+ * TX_RTS_CFG: -+ * RTS_THRES: unit:byte -+ * RTS_FBK_EN: enable rts rate fallback -+ */ -+#define TX_RTS_CFG 0x1344 -+#define TX_RTS_CFG_AUTO_RTS_RETRY_LIMIT FIELD32(0x000000ff) -+#define TX_RTS_CFG_RTS_THRES FIELD32(0x00ffff00) -+#define TX_RTS_CFG_RTS_FBK_EN FIELD32(0x01000000) -+ -+/* -+ * TX_TIMEOUT_CFG: -+ * MPDU_LIFETIME: expiration time = 2^(9+MPDU LIFE TIME) us -+ * RX_ACK_TIMEOUT: unit:slot. Used for TX procedure -+ * TX_OP_TIMEOUT: TXOP timeout value for TXOP truncation. -+ * it is recommended that: -+ * (SLOT_TIME) > (TX_OP_TIMEOUT) > (RX_ACK_TIMEOUT) -+ */ -+#define TX_TIMEOUT_CFG 0x1348 -+#define TX_TIMEOUT_CFG_MPDU_LIFETIME FIELD32(0x000000f0) -+#define TX_TIMEOUT_CFG_RX_ACK_TIMEOUT FIELD32(0x0000ff00) -+#define TX_TIMEOUT_CFG_TX_OP_TIMEOUT FIELD32(0x00ff0000) -+ -+/* -+ * TX_RTY_CFG: -+ * SHORT_RTY_LIMIT: short retry limit -+ * LONG_RTY_LIMIT: long retry limit -+ * LONG_RTY_THRE: Long retry threshoold -+ * NON_AGG_RTY_MODE: Non-Aggregate MPDU retry mode -+ * 0:expired by retry limit, 1: expired by mpdu life timer -+ * AGG_RTY_MODE: Aggregate MPDU retry mode -+ * 0:expired by retry limit, 1: expired by mpdu life timer -+ * TX_AUTO_FB_ENABLE: Tx retry PHY rate auto fallback enable -+ */ -+#define TX_RTY_CFG 0x134c -+#define TX_RTY_CFG_SHORT_RTY_LIMIT FIELD32(0x000000ff) -+#define TX_RTY_CFG_LONG_RTY_LIMIT FIELD32(0x0000ff00) -+#define TX_RTY_CFG_LONG_RTY_THRE FIELD32(0x0fff0000) -+#define TX_RTY_CFG_NON_AGG_RTY_MODE FIELD32(0x10000000) -+#define TX_RTY_CFG_AGG_RTY_MODE FIELD32(0x20000000) -+#define TX_RTY_CFG_TX_AUTO_FB_ENABLE FIELD32(0x40000000) -+ -+/* -+ * TX_LINK_CFG: -+ * REMOTE_MFB_LIFETIME: remote MFB life time. unit: 32us -+ * MFB_ENABLE: TX apply remote MFB 1:enable -+ * REMOTE_UMFS_ENABLE: remote unsolicit MFB enable -+ * 0: not apply remote remote unsolicit (MFS=7) -+ * TX_MRQ_EN: MCS request TX enable -+ * TX_RDG_EN: RDG TX enable -+ * TX_CF_ACK_EN: Piggyback CF-ACK enable -+ * REMOTE_MFB: remote MCS feedback -+ * REMOTE_MFS: remote MCS feedback sequence number -+ */ -+#define TX_LINK_CFG 0x1350 -+#define TX_LINK_CFG_REMOTE_MFB_LIFETIME FIELD32(0x000000ff) -+#define TX_LINK_CFG_MFB_ENABLE FIELD32(0x00000100) -+#define TX_LINK_CFG_REMOTE_UMFS_ENABLE FIELD32(0x00000200) -+#define TX_LINK_CFG_TX_MRQ_EN FIELD32(0x00000400) -+#define TX_LINK_CFG_TX_RDG_EN FIELD32(0x00000800) -+#define TX_LINK_CFG_TX_CF_ACK_EN FIELD32(0x00001000) -+#define TX_LINK_CFG_REMOTE_MFB FIELD32(0x00ff0000) -+#define TX_LINK_CFG_REMOTE_MFS FIELD32(0xff000000) -+ -+/* -+ * HT_FBK_CFG0: -+ */ -+#define HT_FBK_CFG0 0x1354 -+#define HT_FBK_CFG0_HTMCS0FBK FIELD32(0x0000000f) -+#define HT_FBK_CFG0_HTMCS1FBK FIELD32(0x000000f0) -+#define HT_FBK_CFG0_HTMCS2FBK FIELD32(0x00000f00) -+#define HT_FBK_CFG0_HTMCS3FBK FIELD32(0x0000f000) -+#define HT_FBK_CFG0_HTMCS4FBK FIELD32(0x000f0000) -+#define HT_FBK_CFG0_HTMCS5FBK FIELD32(0x00f00000) -+#define HT_FBK_CFG0_HTMCS6FBK FIELD32(0x0f000000) -+#define HT_FBK_CFG0_HTMCS7FBK FIELD32(0xf0000000) -+ -+/* -+ * HT_FBK_CFG1: -+ */ -+#define HT_FBK_CFG1 0x1358 -+#define HT_FBK_CFG1_HTMCS8FBK FIELD32(0x0000000f) -+#define HT_FBK_CFG1_HTMCS9FBK FIELD32(0x000000f0) -+#define HT_FBK_CFG1_HTMCS10FBK FIELD32(0x00000f00) -+#define HT_FBK_CFG1_HTMCS11FBK FIELD32(0x0000f000) -+#define HT_FBK_CFG1_HTMCS12FBK FIELD32(0x000f0000) -+#define HT_FBK_CFG1_HTMCS13FBK FIELD32(0x00f00000) -+#define HT_FBK_CFG1_HTMCS14FBK FIELD32(0x0f000000) -+#define HT_FBK_CFG1_HTMCS15FBK FIELD32(0xf0000000) -+ -+/* -+ * LG_FBK_CFG0: -+ */ -+#define LG_FBK_CFG0 0x135c -+#define LG_FBK_CFG0_OFDMMCS0FBK FIELD32(0x0000000f) -+#define LG_FBK_CFG0_OFDMMCS1FBK FIELD32(0x000000f0) -+#define LG_FBK_CFG0_OFDMMCS2FBK FIELD32(0x00000f00) -+#define LG_FBK_CFG0_OFDMMCS3FBK FIELD32(0x0000f000) -+#define LG_FBK_CFG0_OFDMMCS4FBK FIELD32(0x000f0000) -+#define LG_FBK_CFG0_OFDMMCS5FBK FIELD32(0x00f00000) -+#define LG_FBK_CFG0_OFDMMCS6FBK FIELD32(0x0f000000) -+#define LG_FBK_CFG0_OFDMMCS7FBK FIELD32(0xf0000000) -+ -+/* -+ * LG_FBK_CFG1: -+ */ -+#define LG_FBK_CFG1 0x1360 -+#define LG_FBK_CFG0_CCKMCS0FBK FIELD32(0x0000000f) -+#define LG_FBK_CFG0_CCKMCS1FBK FIELD32(0x000000f0) -+#define LG_FBK_CFG0_CCKMCS2FBK FIELD32(0x00000f00) -+#define LG_FBK_CFG0_CCKMCS3FBK FIELD32(0x0000f000) -+ -+/* -+ * CCK_PROT_CFG: CCK Protection -+ * PROTECT_RATE: Protection control frame rate for CCK TX(RTS/CTS/CFEnd) -+ * PROTECT_CTRL: Protection control frame type for CCK TX -+ * 0:none, 1:RTS/CTS, 2:CTS-to-self -+ * PROTECT_NAV: TXOP protection type for CCK TX -+ * 0:none, 1:ShortNAVprotect, 2:LongNAVProtect -+ * TX_OP_ALLOW_CCK: CCK TXOP allowance, 0:disallow -+ * TX_OP_ALLOW_OFDM: CCK TXOP allowance, 0:disallow -+ * TX_OP_ALLOW_MM20: CCK TXOP allowance, 0:disallow -+ * TX_OP_ALLOW_MM40: CCK TXOP allowance, 0:disallow -+ * TX_OP_ALLOW_GF20: CCK TXOP allowance, 0:disallow -+ * TX_OP_ALLOW_GF40: CCK TXOP allowance, 0:disallow -+ * RTS_TH_EN: RTS threshold enable on CCK TX -+ */ -+#define CCK_PROT_CFG 0x1364 -+#define CCK_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff) -+#define CCK_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000) -+#define CCK_PROT_CFG_PROTECT_NAV FIELD32(0x000c0000) -+#define CCK_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000) -+#define CCK_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000) -+#define CCK_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000) -+#define CCK_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000) -+#define CCK_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000) -+#define CCK_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000) -+#define CCK_PROT_CFG_RTS_TH_EN FIELD32(0x04000000) -+ -+/* -+ * OFDM_PROT_CFG: OFDM Protection -+ */ -+#define OFDM_PROT_CFG 0x1368 -+#define OFDM_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff) -+#define OFDM_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000) -+#define OFDM_PROT_CFG_PROTECT_NAV FIELD32(0x000c0000) -+#define OFDM_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000) -+#define OFDM_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000) -+#define OFDM_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000) -+#define OFDM_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000) -+#define OFDM_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000) -+#define OFDM_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000) -+#define OFDM_PROT_CFG_RTS_TH_EN FIELD32(0x04000000) -+ -+/* -+ * MM20_PROT_CFG: MM20 Protection -+ */ -+#define MM20_PROT_CFG 0x136c -+#define MM20_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff) -+#define MM20_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000) -+#define MM20_PROT_CFG_PROTECT_NAV FIELD32(0x000c0000) -+#define MM20_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000) -+#define MM20_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000) -+#define MM20_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000) -+#define MM20_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000) -+#define MM20_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000) -+#define MM20_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000) -+#define MM20_PROT_CFG_RTS_TH_EN FIELD32(0x04000000) -+ -+/* -+ * MM40_PROT_CFG: MM40 Protection -+ */ -+#define MM40_PROT_CFG 0x1370 -+#define MM40_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff) -+#define MM40_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000) -+#define MM40_PROT_CFG_PROTECT_NAV FIELD32(0x000c0000) -+#define MM40_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000) -+#define MM40_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000) -+#define MM40_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000) -+#define MM40_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000) -+#define MM40_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000) -+#define MM40_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000) -+#define MM40_PROT_CFG_RTS_TH_EN FIELD32(0x04000000) -+ -+/* -+ * GF20_PROT_CFG: GF20 Protection -+ */ -+#define GF20_PROT_CFG 0x1374 -+#define GF20_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff) -+#define GF20_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000) -+#define GF20_PROT_CFG_PROTECT_NAV FIELD32(0x000c0000) -+#define GF20_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000) -+#define GF20_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000) -+#define GF20_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000) -+#define GF20_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000) -+#define GF20_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000) -+#define GF20_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000) -+#define GF20_PROT_CFG_RTS_TH_EN FIELD32(0x04000000) -+ -+/* -+ * GF40_PROT_CFG: GF40 Protection -+ */ -+#define GF40_PROT_CFG 0x1378 -+#define GF40_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff) -+#define GF40_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000) -+#define GF40_PROT_CFG_PROTECT_NAV FIELD32(0x000c0000) -+#define GF40_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000) -+#define GF40_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000) -+#define GF40_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000) -+#define GF40_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000) -+#define GF40_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000) -+#define GF40_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000) -+#define GF40_PROT_CFG_RTS_TH_EN FIELD32(0x04000000) -+ -+/* -+ * EXP_CTS_TIME: -+ */ -+#define EXP_CTS_TIME 0x137c -+ -+/* -+ * EXP_ACK_TIME: -+ */ -+#define EXP_ACK_TIME 0x1380 -+ -+/* -+ * RX_FILTER_CFG: RX configuration register. -+ */ -+#define RX_FILTER_CFG 0x1400 -+#define RX_FILTER_CFG_DROP_CRC_ERROR FIELD32(0x00000001) -+#define RX_FILTER_CFG_DROP_PHY_ERROR FIELD32(0x00000002) -+#define RX_FILTER_CFG_DROP_NOT_TO_ME FIELD32(0x00000004) -+#define RX_FILTER_CFG_DROP_NOT_MY_BSSD FIELD32(0x00000008) -+#define RX_FILTER_CFG_DROP_VER_ERROR FIELD32(0x00000010) -+#define RX_FILTER_CFG_DROP_MULTICAST FIELD32(0x00000020) -+#define RX_FILTER_CFG_DROP_BROADCAST FIELD32(0x00000040) -+#define RX_FILTER_CFG_DROP_DUPLICATE FIELD32(0x00000080) -+#define RX_FILTER_CFG_DROP_CF_END_ACK FIELD32(0x00000100) -+#define RX_FILTER_CFG_DROP_CF_END FIELD32(0x00000200) -+#define RX_FILTER_CFG_DROP_ACK FIELD32(0x00000400) -+#define RX_FILTER_CFG_DROP_CTS FIELD32(0x00000800) -+#define RX_FILTER_CFG_DROP_RTS FIELD32(0x00001000) -+#define RX_FILTER_CFG_DROP_PSPOLL FIELD32(0x00002000) -+#define RX_FILTER_CFG_DROP_BA FIELD32(0x00004000) -+#define RX_FILTER_CFG_DROP_BAR FIELD32(0x00008000) -+#define RX_FILTER_CFG_DROP_CNTL FIELD32(0x00010000) -+ -+/* -+ * AUTO_RSP_CFG: -+ * AUTORESPONDER: 0: disable, 1: enable -+ * BAC_ACK_POLICY: 0:long, 1:short preamble -+ * CTS_40_MMODE: Response CTS 40MHz duplicate mode -+ * CTS_40_MREF: Response CTS 40MHz duplicate mode -+ * AR_PREAMBLE: Auto responder preamble 0:long, 1:short preamble -+ * DUAL_CTS_EN: Power bit value in control frame -+ * ACK_CTS_PSM_BIT:Power bit value in control frame -+ */ -+#define AUTO_RSP_CFG 0x1404 -+#define AUTO_RSP_CFG_AUTORESPONDER FIELD32(0x00000001) -+#define AUTO_RSP_CFG_BAC_ACK_POLICY FIELD32(0x00000002) -+#define AUTO_RSP_CFG_CTS_40_MMODE FIELD32(0x00000004) -+#define AUTO_RSP_CFG_CTS_40_MREF FIELD32(0x00000008) -+#define AUTO_RSP_CFG_AR_PREAMBLE FIELD32(0x00000010) -+#define AUTO_RSP_CFG_DUAL_CTS_EN FIELD32(0x00000040) -+#define AUTO_RSP_CFG_ACK_CTS_PSM_BIT FIELD32(0x00000080) -+ -+/* -+ * LEGACY_BASIC_RATE: -+ */ -+#define LEGACY_BASIC_RATE 0x1408 -+ -+/* -+ * HT_BASIC_RATE: -+ */ -+#define HT_BASIC_RATE 0x140c -+ -+/* -+ * HT_CTRL_CFG: -+ */ -+#define HT_CTRL_CFG 0x1410 -+ -+/* -+ * SIFS_COST_CFG: -+ */ -+#define SIFS_COST_CFG 0x1414 -+ -+/* -+ * RX_PARSER_CFG: -+ * Set NAV for all received frames -+ */ -+#define RX_PARSER_CFG 0x1418 -+ -+/* -+ * TX_SEC_CNT0: -+ */ -+#define TX_SEC_CNT0 0x1500 -+ -+/* -+ * RX_SEC_CNT0: -+ */ -+#define RX_SEC_CNT0 0x1504 -+ -+/* -+ * CCMP_FC_MUTE: -+ */ -+#define CCMP_FC_MUTE 0x1508 -+ -+/* -+ * TXOP_HLDR_ADDR0: -+ */ -+#define TXOP_HLDR_ADDR0 0x1600 -+ -+/* -+ * TXOP_HLDR_ADDR1: -+ */ -+#define TXOP_HLDR_ADDR1 0x1604 -+ -+/* -+ * TXOP_HLDR_ET: -+ */ -+#define TXOP_HLDR_ET 0x1608 -+ -+/* -+ * QOS_CFPOLL_RA_DW0: -+ */ -+#define QOS_CFPOLL_RA_DW0 0x160c -+ -+/* -+ * QOS_CFPOLL_RA_DW1: -+ */ -+#define QOS_CFPOLL_RA_DW1 0x1610 -+ -+/* -+ * QOS_CFPOLL_QC: -+ */ -+#define QOS_CFPOLL_QC 0x1614 -+ -+/* -+ * RX_STA_CNT0: RX PLCP error count & RX CRC error count -+ */ -+#define RX_STA_CNT0 0x1700 -+#define RX_STA_CNT0_CRC_ERR FIELD32(0x0000ffff) -+#define RX_STA_CNT0_PHY_ERR FIELD32(0xffff0000) -+ -+/* -+ * RX_STA_CNT1: RX False CCA count & RX LONG frame count -+ */ -+#define RX_STA_CNT1 0x1704 -+#define RX_STA_CNT1_FALSE_CCA FIELD32(0x0000ffff) -+#define RX_STA_CNT1_PLCP_ERR FIELD32(0xffff0000) -+ -+/* -+ * RX_STA_CNT2: -+ */ -+#define RX_STA_CNT2 0x1708 -+#define RX_STA_CNT2_RX_DUPLI_COUNT FIELD32(0x0000ffff) -+#define RX_STA_CNT2_RX_FIFO_OVERFLOW FIELD32(0xffff0000) -+ -+/* -+ * TX_STA_CNT0: TX Beacon count -+ */ -+#define TX_STA_CNT0 0x170c -+#define TX_STA_CNT0_TX_FAIL_COUNT FIELD32(0x0000ffff) -+#define TX_STA_CNT0_TX_BEACON_COUNT FIELD32(0xffff0000) -+ -+/* -+ * TX_STA_CNT1: TX tx count -+ */ -+#define TX_STA_CNT1 0x1710 -+#define TX_STA_CNT1_TX_SUCCESS FIELD32(0x0000ffff) -+#define TX_STA_CNT1_TX_RETRANSMIT FIELD32(0xffff0000) -+ -+/* -+ * TX_STA_CNT2: TX tx count -+ */ -+#define TX_STA_CNT2 0x1714 -+#define TX_STA_CNT2_TX_ZERO_LEN_COUNT FIELD32(0x0000ffff) -+#define TX_STA_CNT2_TX_UNDER_FLOW_COUNT FIELD32(0xffff0000) -+ -+/* -+ * TX_STA_FIFO: TX Result for specific PID status fifo register -+ */ -+#define TX_STA_FIFO 0x1718 -+#define TX_STA_FIFO_VALID FIELD32(0x00000001) -+#define TX_STA_FIFO_PID_TYPE FIELD32(0x0000001e) -+#define TX_STA_FIFO_TX_SUCCESS FIELD32(0x00000020) -+#define TX_STA_FIFO_TX_AGGRE FIELD32(0x00000040) -+#define TX_STA_FIFO_TX_ACK_REQUIRED FIELD32(0x00000080) -+#define TX_STA_FIFO_WCID FIELD32(0x0000ff00) -+#define TX_STA_FIFO_SUCCESS_RATE FIELD32(0xffff0000) -+ -+/* -+ * TX_AGG_CNT: Debug counter -+ */ -+#define TX_AGG_CNT 0x171c -+#define TX_AGG_CNT_NON_AGG_TX_COUNT FIELD32(0x0000ffff) -+#define TX_AGG_CNT_AGG_TX_COUNT FIELD32(0xffff0000) -+ -+/* -+ * TX_AGG_CNT0: -+ */ -+#define TX_AGG_CNT0 0x1720 -+#define TX_AGG_CNT0_AGG_SIZE_1_COUNT FIELD32(0x0000ffff) -+#define TX_AGG_CNT0_AGG_SIZE_2_COUNT FIELD32(0xffff0000) -+ -+/* -+ * TX_AGG_CNT1: -+ */ -+#define TX_AGG_CNT1 0x1724 -+#define TX_AGG_CNT1_AGG_SIZE_3_COUNT FIELD32(0x0000ffff) -+#define TX_AGG_CNT1_AGG_SIZE_4_COUNT FIELD32(0xffff0000) -+ -+/* -+ * TX_AGG_CNT2: -+ */ -+#define TX_AGG_CNT2 0x1728 -+#define TX_AGG_CNT2_AGG_SIZE_5_COUNT FIELD32(0x0000ffff) -+#define TX_AGG_CNT2_AGG_SIZE_6_COUNT FIELD32(0xffff0000) -+ -+/* -+ * TX_AGG_CNT3: -+ */ -+#define TX_AGG_CNT3 0x172c -+#define TX_AGG_CNT3_AGG_SIZE_7_COUNT FIELD32(0x0000ffff) -+#define TX_AGG_CNT3_AGG_SIZE_8_COUNT FIELD32(0xffff0000) -+ -+/* -+ * TX_AGG_CNT4: -+ */ -+#define TX_AGG_CNT4 0x1730 -+#define TX_AGG_CNT4_AGG_SIZE_9_COUNT FIELD32(0x0000ffff) -+#define TX_AGG_CNT4_AGG_SIZE_10_COUNT FIELD32(0xffff0000) -+ -+/* -+ * TX_AGG_CNT5: -+ */ -+#define TX_AGG_CNT5 0x1734 -+#define TX_AGG_CNT5_AGG_SIZE_11_COUNT FIELD32(0x0000ffff) -+#define TX_AGG_CNT5_AGG_SIZE_12_COUNT FIELD32(0xffff0000) -+ -+/* -+ * TX_AGG_CNT6: -+ */ -+#define TX_AGG_CNT6 0x1738 -+#define TX_AGG_CNT6_AGG_SIZE_13_COUNT FIELD32(0x0000ffff) -+#define TX_AGG_CNT6_AGG_SIZE_14_COUNT FIELD32(0xffff0000) -+ -+/* -+ * TX_AGG_CNT7: -+ */ -+#define TX_AGG_CNT7 0x173c -+#define TX_AGG_CNT7_AGG_SIZE_15_COUNT FIELD32(0x0000ffff) -+#define TX_AGG_CNT7_AGG_SIZE_16_COUNT FIELD32(0xffff0000) -+ -+/* -+ * MPDU_DENSITY_CNT: -+ * TX_ZERO_DEL: TX zero length delimiter count -+ * RX_ZERO_DEL: RX zero length delimiter count -+ */ -+#define MPDU_DENSITY_CNT 0x1740 -+#define MPDU_DENSITY_CNT_TX_ZERO_DEL FIELD32(0x0000ffff) -+#define MPDU_DENSITY_CNT_RX_ZERO_DEL FIELD32(0xffff0000) -+ -+/* -+ * Security key table memory. -+ * MAC_WCID_BASE: 8-bytes (use only 6 bytes) * 256 entry -+ * PAIRWISE_KEY_TABLE_BASE: 32-byte * 256 entry -+ * MAC_IVEIV_TABLE_BASE: 8-byte * 256-entry -+ * MAC_WCID_ATTRIBUTE_BASE: 4-byte * 256-entry -+ * SHARED_KEY_TABLE_BASE: 32-byte * 16-entry -+ * SHARED_KEY_MODE_BASE: 4-byte * 16-entry -+ */ -+#define MAC_WCID_BASE 0x1800 -+#define PAIRWISE_KEY_TABLE_BASE 0x4000 -+#define MAC_IVEIV_TABLE_BASE 0x6000 -+#define MAC_WCID_ATTRIBUTE_BASE 0x6800 -+#define SHARED_KEY_TABLE_BASE 0x6c00 -+#define SHARED_KEY_MODE_BASE 0x7000 -+ -+#define MAC_WCID_ENTRY(__idx) \ -+ ( MAC_WCID_BASE + ((__idx) * sizeof(struct mac_wcid_entry)) ) -+#define PAIRWISE_KEY_ENTRY(__idx) \ -+ ( PAIRWISE_KEY_TABLE_BASE + ((__idx) * sizeof(struct hw_key_entry)) ) -+#define MAC_IVEIV_ENTRY(__idx) \ -+ ( MAC_IVEIV_TABLE_BASE + ((__idx) & sizeof(struct mac_iveiv_entry)) ) -+#define MAC_WCID_ATTR_ENTRY(__idx) \ -+ ( MAC_WCID_ATTRIBUTE_BASE + ((__idx) * sizeof(u32)) ) -+#define SHARED_KEY_ENTRY(__idx) \ -+ ( SHARED_KEY_TABLE_BASE + ((__idx) * sizeof(struct hw_key_entry)) ) -+#define SHARED_KEY_MODE_ENTRY(__idx) \ -+ ( SHARED_KEY_MODE_BASE + ((__idx) * sizeof(u32)) ) -+ -+struct mac_wcid_entry { -+ u8 mac[6]; -+ u8 reserved[2]; -+} __attribute__ ((packed)); -+ -+struct hw_key_entry { -+ u8 key[16]; -+ u8 tx_mic[8]; -+ u8 rx_mic[8]; -+} __attribute__ ((packed)); -+ -+struct mac_iveiv_entry { -+ u8 iv[8]; -+} __attribute__ ((packed)); -+ -+/* -+ * MAC_WCID_ATTRIBUTE: -+ */ -+#define MAC_WCID_ATTRIBUTE_KEYTAB FIELD32(0x00000001) -+#define MAC_WCID_ATTRIBUTE_CIPHER FIELD32(0x0000000e) -+#define MAC_WCID_ATTRIBUTE_BSS_IDX FIELD32(0x00000070) -+#define MAC_WCID_ATTRIBUTE_RX_WIUDF FIELD32(0x00000380) -+ -+/* -+ * SHARED_KEY_MODE: -+ */ -+#define SHARED_KEY_MODE_BSS0_KEY0 FIELD32(0x00000007) -+#define SHARED_KEY_MODE_BSS0_KEY1 FIELD32(0x00000070) -+#define SHARED_KEY_MODE_BSS0_KEY2 FIELD32(0x00000700) -+#define SHARED_KEY_MODE_BSS0_KEY3 FIELD32(0x00007000) -+#define SHARED_KEY_MODE_BSS1_KEY0 FIELD32(0x00070000) -+#define SHARED_KEY_MODE_BSS1_KEY1 FIELD32(0x00700000) -+#define SHARED_KEY_MODE_BSS1_KEY2 FIELD32(0x07000000) -+#define SHARED_KEY_MODE_BSS1_KEY3 FIELD32(0x70000000) -+ -+/* -+ * HOST-MCU communication -+ */ -+ -+/* -+ * H2M_MAILBOX_CSR: Host-to-MCU Mailbox. -+ */ -+#define H2M_MAILBOX_CSR 0x7010 -+#define H2M_MAILBOX_CSR_ARG0 FIELD32(0x000000ff) -+#define H2M_MAILBOX_CSR_ARG1 FIELD32(0x0000ff00) -+#define H2M_MAILBOX_CSR_CMD_TOKEN FIELD32(0x00ff0000) -+#define H2M_MAILBOX_CSR_OWNER FIELD32(0xff000000) -+ -+/* -+ * H2M_MAILBOX_CID: -+ */ -+#define H2M_MAILBOX_CID 0x7014 -+#define H2M_MAILBOX_CID_CMD0 FIELD32(0x000000ff) -+#define H2M_MAILBOX_CID_CMD1 FIELD32(0x0000ff00) -+#define H2M_MAILBOX_CID_CMD2 FIELD32(0x00ff0000) -+#define H2M_MAILBOX_CID_CMD3 FIELD32(0xff000000) -+ -+/* -+ * H2M_MAILBOX_STATUS: -+ */ -+#define H2M_MAILBOX_STATUS 0x701c -+ -+/* -+ * H2M_INT_SRC: -+ */ -+#define H2M_INT_SRC 0x7024 -+ -+/* -+ * H2M_BBP_AGENT: -+ */ -+#define H2M_BBP_AGENT 0x7028 -+ -+/* -+ * MCU_LEDCS: LED control for MCU Mailbox. -+ */ -+#define MCU_LEDCS_LED_MODE FIELD8(0x1f) -+#define MCU_LEDCS_POLARITY FIELD8(0x01) -+ -+/* -+ * HW_CS_CTS_BASE: -+ * Carrier-sense CTS frame base address. -+ * It's where mac stores carrier-sense frame for carrier-sense function. -+ */ -+#define HW_CS_CTS_BASE 0x7700 -+ -+/* -+ * HW_DFS_CTS_BASE: -+ * FS CTS frame base address. It's where mac stores CTS frame for DFS. -+ */ -+#define HW_DFS_CTS_BASE 0x7780 -+ -+/* -+ * TXRX control registers - base address 0x3000 -+ */ -+ -+/* -+ * TXRX_CSR1: -+ * rt2860b UNKNOWN reg use R/O Reg Addr 0x77d0 first.. -+ */ -+#define TXRX_CSR1 0x77d0 -+ -+/* -+ * HW_DEBUG_SETTING_BASE: -+ * since NULL frame won't be that long (256 byte) -+ * We steal 16 tail bytes to save debugging settings -+ */ -+#define HW_DEBUG_SETTING_BASE 0x77f0 -+#define HW_DEBUG_SETTING_BASE2 0x7770 -+ -+/* -+ * HW_BEACON_BASE -+ * In order to support maximum 8 MBSS and its maximum length -+ * is 512 bytes for each beacon -+ * Three section discontinue memory segments will be used. -+ * 1. The original region for BCN 0~3 -+ * 2. Extract memory from FCE table for BCN 4~5 -+ * 3. Extract memory from Pair-wise key table for BCN 6~7 -+ * It occupied those memory of wcid 238~253 for BCN 6 -+ * and wcid 222~237 for BCN 7 -+ * -+ * IMPORTANT NOTE: Not sure why legacy driver does this, -+ * but HW_BEACON_BASE7 is 0x0200 bytes below HW_BEACON_BASE6. -+ */ -+#define HW_BEACON_BASE0 0x7800 -+#define HW_BEACON_BASE1 0x7a00 -+#define HW_BEACON_BASE2 0x7c00 -+#define HW_BEACON_BASE3 0x7e00 -+#define HW_BEACON_BASE4 0x7200 -+#define HW_BEACON_BASE5 0x7400 -+#define HW_BEACON_BASE6 0x5dc0 -+#define HW_BEACON_BASE7 0x5bc0 -+ -+#define HW_BEACON_OFFSET(__index) \ -+ ( ((__index) < 4) ? ( HW_BEACON_BASE0 + (__index * 0x0200) ) : \ -+ (((__index) < 6) ? ( HW_BEACON_BASE4 + ((__index - 4) * 0x0200) ) : \ -+ (HW_BEACON_BASE6 - ((__index - 6) * 0x0200))) ) -+ -+/* -+ * 8051 firmware image. -+ */ -+#define FIRMWARE_RT2860 "rt2860.bin" -+#define FIRMWARE_IMAGE_BASE 0x2000 -+ -+/* -+ * BBP registers. -+ * The wordsize of the BBP is 8 bits. -+ */ -+ -+/* -+ * BBP 1: TX Antenna -+ */ -+#define BBP1_TX_POWER FIELD8(0x07) -+#define BBP1_TX_ANTENNA FIELD8(0x18) -+ -+/* -+ * BBP 3: RX Antenna -+ */ -+#define BBP3_RX_ANTENNA FIELD8(0x18) -+#define BBP3_HT40_PLUS FIELD8(0x20) -+ -+/* -+ * BBP 4: Bandwidth -+ */ -+#define BBP4_TX_BF FIELD8(0x01) -+#define BBP4_BANDWIDTH FIELD8(0x18) -+ -+/* -+ * RFCSR registers -+ * The wordsize of the RFCSR is 8 bits. -+ */ -+ -+/* -+ * RFCSR 6: -+ */ -+#define RFCSR6_R FIELD8(0x03) -+ -+/* -+ * RFCSR 7: -+ */ -+#define RFCSR7_RF_TUNING FIELD8(0x01) -+ -+/* -+ * RFCSR 12: -+ */ -+#define RFCSR12_TX_POWER FIELD8(0x1f) -+ -+/* -+ * RFCSR 22: -+ */ -+#define RFCSR22_BASEBAND_LOOPBACK FIELD8(0x01) -+ -+/* -+ * RFCSR 23: -+ */ -+#define RFCSR23_FREQ_OFFSET FIELD8(0x7f) -+ -+/* -+ * RFCSR 30: -+ */ -+#define RFCSR30_RF_CALIBRATION FIELD8(0x80) -+ -+/* -+ * RF registers -+ */ -+ -+/* -+ * RF 2 -+ */ -+#define RF2_ANTENNA_RX2 FIELD32(0x00000040) -+#define RF2_ANTENNA_TX1 FIELD32(0x00004000) -+#define RF2_ANTENNA_RX1 FIELD32(0x00020000) -+ -+/* -+ * RF 3 -+ */ -+#define RF3_TXPOWER_G FIELD32(0x00003e00) -+#define RF3_TXPOWER_A_7DBM_BOOST FIELD32(0x00000200) -+#define RF3_TXPOWER_A FIELD32(0x00003c00) -+ -+/* -+ * RF 4 -+ */ -+#define RF4_TXPOWER_G FIELD32(0x000007c0) -+#define RF4_TXPOWER_A_7DBM_BOOST FIELD32(0x00000040) -+#define RF4_TXPOWER_A FIELD32(0x00000780) -+#define RF4_FREQ_OFFSET FIELD32(0x001f8000) -+#define RF4_HT40 FIELD32(0x00200000) -+ -+/* -+ * EEPROM content. -+ * The wordsize of the EEPROM is 16 bits. -+ */ -+ -+/* -+ * EEPROM Version -+ */ -+#define EEPROM_VERSION 0x0001 -+#define EEPROM_VERSION_FAE FIELD16(0x00ff) -+#define EEPROM_VERSION_VERSION FIELD16(0xff00) -+ -+/* -+ * HW MAC address. -+ */ -+#define EEPROM_MAC_ADDR_0 0x0002 -+#define EEPROM_MAC_ADDR_BYTE0 FIELD16(0x00ff) -+#define EEPROM_MAC_ADDR_BYTE1 FIELD16(0xff00) -+#define EEPROM_MAC_ADDR_1 0x0003 -+#define EEPROM_MAC_ADDR_BYTE2 FIELD16(0x00ff) -+#define EEPROM_MAC_ADDR_BYTE3 FIELD16(0xff00) -+#define EEPROM_MAC_ADDR_2 0x0004 -+#define EEPROM_MAC_ADDR_BYTE4 FIELD16(0x00ff) -+#define EEPROM_MAC_ADDR_BYTE5 FIELD16(0xff00) -+ -+/* -+ * EEPROM ANTENNA config -+ * RXPATH: 1: 1R, 2: 2R, 3: 3R -+ * TXPATH: 1: 1T, 2: 2T -+ */ -+#define EEPROM_ANTENNA 0x001a -+#define EEPROM_ANTENNA_RXPATH FIELD16(0x000f) -+#define EEPROM_ANTENNA_TXPATH FIELD16(0x00f0) -+#define EEPROM_ANTENNA_RF_TYPE FIELD16(0x0f00) -+ -+/* -+ * EEPROM NIC config -+ * CARDBUS_ACCEL: 0 - enable, 1 - disable -+ */ -+#define EEPROM_NIC 0x001b -+#define EEPROM_NIC_HW_RADIO FIELD16(0x0001) -+#define EEPROM_NIC_DYNAMIC_TX_AGC FIELD16(0x0002) -+#define EEPROM_NIC_EXTERNAL_LNA_BG FIELD16(0x0004) -+#define EEPROM_NIC_EXTERNAL_LNA_A FIELD16(0x0008) -+#define EEPROM_NIC_CARDBUS_ACCEL FIELD16(0x0010) -+#define EEPROM_NIC_BW40M_SB_BG FIELD16(0x0020) -+#define EEPROM_NIC_BW40M_SB_A FIELD16(0x0040) -+#define EEPROM_NIC_WPS_PBC FIELD16(0x0080) -+#define EEPROM_NIC_BW40M_BG FIELD16(0x0100) -+#define EEPROM_NIC_BW40M_A FIELD16(0x0200) -+ -+/* -+ * EEPROM frequency -+ */ -+#define EEPROM_FREQ 0x001d -+#define EEPROM_FREQ_OFFSET FIELD16(0x00ff) -+#define EEPROM_FREQ_LED_MODE FIELD16(0x7f00) -+#define EEPROM_FREQ_LED_POLARITY FIELD16(0x1000) -+ -+/* -+ * EEPROM LED -+ * POLARITY_RDY_G: Polarity RDY_G setting. -+ * POLARITY_RDY_A: Polarity RDY_A setting. -+ * POLARITY_ACT: Polarity ACT setting. -+ * POLARITY_GPIO_0: Polarity GPIO0 setting. -+ * POLARITY_GPIO_1: Polarity GPIO1 setting. -+ * POLARITY_GPIO_2: Polarity GPIO2 setting. -+ * POLARITY_GPIO_3: Polarity GPIO3 setting. -+ * POLARITY_GPIO_4: Polarity GPIO4 setting. -+ * LED_MODE: Led mode. -+ */ -+#define EEPROM_LED1 0x001e -+#define EEPROM_LED2 0x001f -+#define EEPROM_LED3 0x0020 -+#define EEPROM_LED_POLARITY_RDY_BG FIELD16(0x0001) -+#define EEPROM_LED_POLARITY_RDY_A FIELD16(0x0002) -+#define EEPROM_LED_POLARITY_ACT FIELD16(0x0004) -+#define EEPROM_LED_POLARITY_GPIO_0 FIELD16(0x0008) -+#define EEPROM_LED_POLARITY_GPIO_1 FIELD16(0x0010) -+#define EEPROM_LED_POLARITY_GPIO_2 FIELD16(0x0020) -+#define EEPROM_LED_POLARITY_GPIO_3 FIELD16(0x0040) -+#define EEPROM_LED_POLARITY_GPIO_4 FIELD16(0x0080) -+#define EEPROM_LED_LED_MODE FIELD16(0x1f00) -+ -+/* -+ * EEPROM LNA -+ */ -+#define EEPROM_LNA 0x0022 -+#define EEPROM_LNA_BG FIELD16(0x00ff) -+#define EEPROM_LNA_A0 FIELD16(0xff00) -+ -+/* -+ * EEPROM RSSI BG offset -+ */ -+#define EEPROM_RSSI_BG 0x0023 -+#define EEPROM_RSSI_BG_OFFSET0 FIELD16(0x00ff) -+#define EEPROM_RSSI_BG_OFFSET1 FIELD16(0xff00) -+ -+/* -+ * EEPROM RSSI BG2 offset -+ */ -+#define EEPROM_RSSI_BG2 0x0024 -+#define EEPROM_RSSI_BG2_OFFSET2 FIELD16(0x00ff) -+#define EEPROM_RSSI_BG2_LNA_A1 FIELD16(0xff00) -+ -+/* -+ * EEPROM RSSI A offset -+ */ -+#define EEPROM_RSSI_A 0x0025 -+#define EEPROM_RSSI_A_OFFSET0 FIELD16(0x00ff) -+#define EEPROM_RSSI_A_OFFSET1 FIELD16(0xff00) -+ -+/* -+ * EEPROM RSSI A2 offset -+ */ -+#define EEPROM_RSSI_A2 0x0026 -+#define EEPROM_RSSI_A2_OFFSET2 FIELD16(0x00ff) -+#define EEPROM_RSSI_A2_LNA_A2 FIELD16(0xff00) -+ -+/* -+ * EEPROM TXpower delta: 20MHZ AND 40 MHZ use different power. -+ * This is delta in 40MHZ. -+ * VALUE: Tx Power dalta value (MAX=4) -+ * TYPE: 1: Plus the delta value, 0: minus the delta value -+ * TXPOWER: Enable: -+ */ -+#define EEPROM_TXPOWER_DELTA 0x0028 -+#define EEPROM_TXPOWER_DELTA_VALUE FIELD16(0x003f) -+#define EEPROM_TXPOWER_DELTA_TYPE FIELD16(0x0040) -+#define EEPROM_TXPOWER_DELTA_TXPOWER FIELD16(0x0080) -+ -+/* -+ * EEPROM TXPOWER 802.11BG -+ */ -+#define EEPROM_TXPOWER_BG1 0x0029 -+#define EEPROM_TXPOWER_BG2 0x0030 -+#define EEPROM_TXPOWER_BG_SIZE 7 -+#define EEPROM_TXPOWER_BG_1 FIELD16(0x00ff) -+#define EEPROM_TXPOWER_BG_2 FIELD16(0xff00) -+ -+/* -+ * EEPROM TXPOWER 802.11A -+ */ -+#define EEPROM_TXPOWER_A1 0x003c -+#define EEPROM_TXPOWER_A2 0x0053 -+#define EEPROM_TXPOWER_A_SIZE 6 -+#define EEPROM_TXPOWER_A_1 FIELD16(0x00ff) -+#define EEPROM_TXPOWER_A_2 FIELD16(0xff00) -+ -+/* -+ * EEPROM TXpower byrate: 20MHZ power -+ */ -+#define EEPROM_TXPOWER_BYRATE 0x006f -+ -+/* -+ * EEPROM BBP. -+ */ -+#define EEPROM_BBP_START 0x0078 -+#define EEPROM_BBP_SIZE 16 -+#define EEPROM_BBP_VALUE FIELD16(0x00ff) -+#define EEPROM_BBP_REG_ID FIELD16(0xff00) -+ -+/* -+ * MCU mailbox commands. -+ */ -+#define MCU_SLEEP 0x30 -+#define MCU_WAKEUP 0x31 -+#define MCU_RADIO_OFF 0x35 -+#define MCU_CURRENT 0x36 -+#define MCU_LED 0x50 -+#define MCU_LED_STRENGTH 0x51 -+#define MCU_LED_1 0x52 -+#define MCU_LED_2 0x53 -+#define MCU_LED_3 0x54 -+#define MCU_RADAR 0x60 -+#define MCU_BOOT_SIGNAL 0x72 -+#define MCU_BBP_SIGNAL 0x80 -+#define MCU_POWER_SAVE 0x83 -+ -+/* -+ * MCU mailbox tokens -+ */ -+#define TOKEN_WAKUP 3 -+ -+/* -+ * DMA descriptor defines. -+ */ -+#define TXD_DESC_SIZE ( 4 * sizeof(__le32) ) -+#define TXWI_DESC_SIZE ( 4 * sizeof(__le32) ) -+#define RXD_DESC_SIZE ( 4 * sizeof(__le32) ) -+#define RXWI_DESC_SIZE ( 4 * sizeof(__le32) ) -+ -+/* -+ * TX descriptor format for TX, PRIO and Beacon Ring. -+ */ -+ -+/* -+ * Word0 -+ */ -+#define TXD_W0_SD_PTR0 FIELD32(0xffffffff) -+ -+/* -+ * Word1 -+ */ -+#define TXD_W1_SD_LEN1 FIELD32(0x00003fff) -+#define TXD_W1_LAST_SEC1 FIELD32(0x00004000) -+#define TXD_W1_BURST FIELD32(0x00008000) -+#define TXD_W1_SD_LEN0 FIELD32(0x3fff0000) -+#define TXD_W1_LAST_SEC0 FIELD32(0x40000000) -+#define TXD_W1_DMA_DONE FIELD32(0x80000000) -+ -+/* -+ * Word2 -+ */ -+#define TXD_W2_SD_PTR1 FIELD32(0xffffffff) -+ -+/* -+ * Word3 -+ * WIV: Wireless Info Valid. 1: Driver filled WI, 0: DMA needs to copy WI -+ * QSEL: Select on-chip FIFO ID for 2nd-stage output scheduler. -+ * 0:MGMT, 1:HCCA 2:EDCA -+ */ -+#define TXD_W3_WIV FIELD32(0x01000000) -+#define TXD_W3_QSEL FIELD32(0x06000000) -+#define TXD_W3_TCO FIELD32(0x20000000) -+#define TXD_W3_UCO FIELD32(0x40000000) -+#define TXD_W3_ICO FIELD32(0x80000000) -+ -+/* -+ * TX WI structure -+ */ -+ -+/* -+ * Word0 -+ * FRAG: 1 To inform TKIP engine this is a fragment. -+ * MIMO_PS: The remote peer is in dynamic MIMO-PS mode -+ * TX_OP: 0:HT TXOP rule , 1:PIFS TX ,2:Backoff, 3:sifs -+ * BW: Channel bandwidth 20MHz or 40 MHz -+ * STBC: 1: STBC support MCS =0-7, 2,3 : RESERVED -+ */ -+#define TXWI_W0_FRAG FIELD32(0x00000001) -+#define TXWI_W0_MIMO_PS FIELD32(0x00000002) -+#define TXWI_W0_CF_ACK FIELD32(0x00000004) -+#define TXWI_W0_TS FIELD32(0x00000008) -+#define TXWI_W0_AMPDU FIELD32(0x00000010) -+#define TXWI_W0_MPDU_DENSITY FIELD32(0x000000e0) -+#define TXWI_W0_TX_OP FIELD32(0x00000300) -+#define TXWI_W0_MCS FIELD32(0x007f0000) -+#define TXWI_W0_BW FIELD32(0x00800000) -+#define TXWI_W0_SHORT_GI FIELD32(0x01000000) -+#define TXWI_W0_STBC FIELD32(0x06000000) -+#define TXWI_W0_IFS FIELD32(0x08000000) -+#define TXWI_W0_PHYMODE FIELD32(0xc0000000) -+ -+/* -+ * Word1 -+ */ -+#define TXWI_W1_ACK FIELD32(0x00000001) -+#define TXWI_W1_NSEQ FIELD32(0x00000002) -+#define TXWI_W1_BW_WIN_SIZE FIELD32(0x000000fc) -+#define TXWI_W1_WIRELESS_CLI_ID FIELD32(0x0000ff00) -+#define TXWI_W1_MPDU_TOTAL_BYTE_COUNT FIELD32(0x0fff0000) -+#define TXWI_W1_PACKETID FIELD32(0xf0000000) -+ -+/* -+ * Word2 -+ */ -+#define TXWI_W2_IV FIELD32(0xffffffff) -+ -+/* -+ * Word3 -+ */ -+#define TXWI_W3_EIV FIELD32(0xffffffff) -+ -+/* -+ * RX descriptor format for RX Ring. -+ */ -+ -+/* -+ * Word0 -+ */ -+#define RXD_W0_SDP0 FIELD32(0xffffffff) -+ -+/* -+ * Word1 -+ */ -+#define RXD_W1_SDL1 FIELD32(0x00003fff) -+#define RXD_W1_SDL0 FIELD32(0x3fff0000) -+#define RXD_W1_LS0 FIELD32(0x40000000) -+#define RXD_W1_DMA_DONE FIELD32(0x80000000) -+ -+/* -+ * Word2 -+ */ -+#define RXD_W2_SDP1 FIELD32(0xffffffff) -+ -+/* -+ * Word3 -+ * AMSDU: RX with 802.3 header, not 802.11 header. -+ * DECRYPTED: This frame is being decrypted. -+ */ -+#define RXD_W3_BA FIELD32(0x00000001) -+#define RXD_W3_DATA FIELD32(0x00000002) -+#define RXD_W3_NULLDATA FIELD32(0x00000004) -+#define RXD_W3_FRAG FIELD32(0x00000008) -+#define RXD_W3_UNICAST_TO_ME FIELD32(0x00000010) -+#define RXD_W3_MULTICAST FIELD32(0x00000020) -+#define RXD_W3_BROADCAST FIELD32(0x00000040) -+#define RXD_W3_MY_BSS FIELD32(0x00000080) -+#define RXD_W3_CRC_ERROR FIELD32(0x00000100) -+#define RXD_W3_CIPHER_ERROR FIELD32(0x00000600) -+#define RXD_W3_AMSDU FIELD32(0x00000800) -+#define RXD_W3_HTC FIELD32(0x00001000) -+#define RXD_W3_RSSI FIELD32(0x00002000) -+#define RXD_W3_L2PAD FIELD32(0x00004000) -+#define RXD_W3_AMPDU FIELD32(0x00008000) -+#define RXD_W3_DECRYPTED FIELD32(0x00010000) -+#define RXD_W3_PLCP_SIGNAL FIELD32(0x00020000) -+#define RXD_W3_PLCP_RSSI FIELD32(0x00040000) -+ -+/* -+ * RX WI structure -+ */ -+ -+/* -+ * Word0 -+ */ -+#define RXWI_W0_WIRELESS_CLI_ID FIELD32(0x000000ff) -+#define RXWI_W0_KEY_INDEX FIELD32(0x00000300) -+#define RXWI_W0_BSSID FIELD32(0x00001c00) -+#define RXWI_W0_UDF FIELD32(0x0000e000) -+#define RXWI_W0_MPDU_TOTAL_BYTE_COUNT FIELD32(0x0fff0000) -+#define RXWI_W0_TID FIELD32(0xf0000000) -+ -+/* -+ * Word1 -+ */ -+#define RXWI_W1_FRAG FIELD32(0x0000000f) -+#define RXWI_W1_SEQUENCE FIELD32(0x0000fff0) -+#define RXWI_W1_MCS FIELD32(0x007f0000) -+#define RXWI_W1_BW FIELD32(0x00800000) -+#define RXWI_W1_SHORT_GI FIELD32(0x01000000) -+#define RXWI_W1_STBC FIELD32(0x06000000) -+#define RXWI_W1_PHYMODE FIELD32(0xc0000000) -+ -+/* -+ * Word2 -+ */ -+#define RXWI_W2_RSSI0 FIELD32(0x000000ff) -+#define RXWI_W2_RSSI1 FIELD32(0x0000ff00) -+#define RXWI_W2_RSSI2 FIELD32(0x00ff0000) -+ -+/* -+ * Word3 -+ */ -+#define RXWI_W3_SNR0 FIELD32(0x000000ff) -+#define RXWI_W3_SNR1 FIELD32(0x0000ff00) -+ -+/* -+ * Macros for converting txpower from EEPROM to mac80211 value -+ * and from mac80211 value to register value. -+ */ -+#define MIN_G_TXPOWER 0 -+#define MIN_A_TXPOWER -7 -+#define MAX_G_TXPOWER 31 -+#define MAX_A_TXPOWER 15 -+#define DEFAULT_TXPOWER 5 -+ -+#define TXPOWER_G_FROM_DEV(__txpower) \ -+ ((__txpower) > MAX_G_TXPOWER) ? DEFAULT_TXPOWER : (__txpower) -+ -+#define TXPOWER_G_TO_DEV(__txpower) \ -+ clamp_t(char, __txpower, MIN_G_TXPOWER, MAX_G_TXPOWER) -+ -+#define TXPOWER_A_FROM_DEV(__txpower) \ -+ ((__txpower) > MAX_A_TXPOWER) ? DEFAULT_TXPOWER : (__txpower) -+ -+#define TXPOWER_A_TO_DEV(__txpower) \ -+ clamp_t(char, __txpower, MIN_A_TXPOWER, MAX_A_TXPOWER) -+ -+#endif /* RT2800PCI_H */ ---- a/drivers/net/wireless/rt2x00/rt2x00.h -+++ b/drivers/net/wireless/rt2x00/rt2x00.h -@@ -158,6 +158,12 @@ struct rt2x00_chip { - #define RT2561 0x0302 - #define RT2661 0x0401 - #define RT2571 0x1300 -+#define RT2860 0x0601 /* 2.4GHz PCI/CB */ -+#define RT2860D 0x0681 /* 2.4GHz, 5GHz PCI/CB */ -+#define RT2890 0x0701 /* 2.4GHz PCIe */ -+#define RT2890D 0x0781 /* 2.4GHz, 5GHz PCIe */ -+#define RT2880 0x2880 /* WSOC */ -+#define RT3052 0x3052 /* WSOC */ - #define RT2870 0x1600 - - u16 rf; diff --git a/package/mac80211/patches/403-ath9k-fix-invalid-mac-address-handling.patch b/package/mac80211/patches/403-ath9k-fix-invalid-mac-address-handling.patch index 9d9d3a48b..1780fc7b3 100644 --- a/package/mac80211/patches/403-ath9k-fix-invalid-mac-address-handling.patch +++ b/package/mac80211/patches/403-ath9k-fix-invalid-mac-address-handling.patch @@ -8,7 +8,7 @@ #include #include "hw.h" -@@ -511,8 +512,18 @@ static int ath9k_hw_init_macaddr(struct +@@ -494,8 +495,18 @@ static int ath9k_hw_init_macaddr(struct common->macaddr[2 * i] = eeval >> 8; common->macaddr[2 * i + 1] = eeval & 0xff; } diff --git a/package/mac80211/patches/404-ath_regd_optional.patch b/package/mac80211/patches/404-ath_regd_optional.patch index 6b2613a44..58ed4bdbe 100644 --- a/package/mac80211/patches/404-ath_regd_optional.patch +++ b/package/mac80211/patches/404-ath_regd_optional.patch @@ -18,7 +18,7 @@ +#endif --- a/drivers/net/wireless/ath/regd.h +++ b/drivers/net/wireless/ath/regd.h -@@ -242,6 +242,41 @@ enum CountryCode { +@@ -250,6 +250,41 @@ enum CountryCode { CTRY_BELGIUM2 = 5002 }; @@ -60,7 +60,7 @@ bool ath_is_world_regd(struct ath_regulatory *reg); int ath_regd_init(struct ath_regulatory *reg, struct wiphy *wiphy, int (*reg_notifier)(struct wiphy *wiphy, -@@ -253,3 +288,5 @@ int ath_reg_notifier_apply(struct wiphy +@@ -261,3 +296,5 @@ int ath_reg_notifier_apply(struct wiphy struct ath_regulatory *reg); #endif diff --git a/package/mac80211/patches/405-compile_fix.patch b/package/mac80211/patches/405-compile_fix.patch deleted file mode 100644 index 10855d41c..000000000 --- a/package/mac80211/patches/405-compile_fix.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/ahb.c -+++ b/drivers/net/wireless/ath/ath9k/ahb.c -@@ -29,15 +29,13 @@ static void ath_ahb_read_cachesize(struc - - static void ath_ahb_cleanup(struct ath_common *common) - { -- struct ath_hw *ah = (struct ath_hw *) common->ah; -- struct ath_softc *sc = ah->ah_sc; -+ struct ath_softc *sc = (struct ath_softc *) common->priv; - iounmap(sc->mem); - } - - static bool ath_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data) - { -- struct ath_hw *ah = (struct ath_hw *) common->ah; -- struct ath_softc *sc = ah->ah_sc; -+ struct ath_softc *sc = (struct ath_softc *) common->priv; - struct platform_device *pdev = to_platform_device(sc->dev); - struct ath9k_platform_data *pdata; - diff --git a/package/mac80211/patches/406-ibss_fix.patch b/package/mac80211/patches/406-ibss_fix.patch deleted file mode 100644 index 847451fc2..000000000 --- a/package/mac80211/patches/406-ibss_fix.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/mac80211/ibss.c -+++ b/net/mac80211/ibss.c -@@ -544,7 +544,7 @@ static void ieee80211_sta_find_ibss(stru - "%pM\n", bss->cbss.bssid, ifibss->bssid); - #endif /* CONFIG_MAC80211_IBSS_DEBUG */ - -- if (bss && memcmp(ifibss->bssid, bss->cbss.bssid, ETH_ALEN)) { -+ if (bss && !memcmp(ifibss->bssid, bss->cbss.bssid, ETH_ALEN)) { - printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM" - " based on configured SSID\n", - sdata->dev->name, bss->cbss.bssid); diff --git a/package/mac80211/patches/407-ath5k_compat_fix.patch b/package/mac80211/patches/407-ath5k_compat_fix.patch deleted file mode 100644 index a214343fb..000000000 --- a/package/mac80211/patches/407-ath5k_compat_fix.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/drivers/net/wireless/ath/ath5k/base.c -+++ b/drivers/net/wireless/ath/ath5k/base.c -@@ -238,7 +238,7 @@ static struct pci_driver ath5k_pci_drive - .remove = __devexit_p(ath5k_pci_remove), - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - .driver.pm = ATH5K_PM_OPS, --#else -+#elif defined(CONFIG_PM) - .suspend = ath5k_pci_suspend_compat, - .resume = ath5k_pci_resume_compat, - #endif ---- a/compat/patches/11-dev-pm-ops.patch -+++ b/compat/patches/11-dev-pm-ops.patch -@@ -49,7 +49,7 @@ calls on compat code with only slight mo - .remove = __devexit_p(ath5k_pci_remove), - +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - .driver.pm = ATH5K_PM_OPS, --+#else -++#elif defined(CONFIG_PM) - + .suspend = ath5k_pci_suspend_compat, - + .resume = ath5k_pci_resume_compat, - +#endif From 80f27f1a42c6c9eabbd838a6f50b33d2c7968e7a Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 4 Nov 2009 21:54:53 +0000 Subject: [PATCH 080/288] fix platform specific overrides for kernel modules, fixes lp on brcm-2.4 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18295 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- include/kernel.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/kernel.mk b/include/kernel.mk index 9e6431602..db0790007 100644 --- a/include/kernel.mk +++ b/include/kernel.mk @@ -113,7 +113,7 @@ define KernelPackage VERSION:=$(LINUX_VERSION)$(if $(PKG_VERSION),+$(PKG_VERSION))-$(if $(PKG_RELEASE),$(PKG_RELEASE),$(LINUX_RELEASE)) $(call KernelPackage/$(1)) $(call KernelPackage/$(1)/$(KERNEL)) - $(call KernelPackage/$(1)/$(BOARD)-$(KERNEL)) + $(call KernelPackage/$(1)/$(BOARD)) endef ifdef KernelPackage/$(1)/description From 4592820242d88f68dde98c07d982ff04f29a6532 Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 4 Nov 2009 22:21:13 +0000 Subject: [PATCH 081/288] [kernel] add missing ledtrig-netdev dependency on the networking stack git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18297 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../linux/generic-2.6/patches-2.6.30/402-ledtrig_netdev.patch | 2 +- .../linux/generic-2.6/patches-2.6.31/402-ledtrig_netdev.patch | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/generic-2.6/patches-2.6.30/402-ledtrig_netdev.patch b/target/linux/generic-2.6/patches-2.6.30/402-ledtrig_netdev.patch index 8a8c97442..c41fecfea 100644 --- a/target/linux/generic-2.6/patches-2.6.30/402-ledtrig_netdev.patch +++ b/target/linux/generic-2.6/patches-2.6.30/402-ledtrig_netdev.patch @@ -6,7 +6,7 @@ +config LEDS_TRIGGER_NETDEV + tristate "LED Netdev Trigger" -+ depends on LEDS_TRIGGERS ++ depends on NET && LEDS_TRIGGERS + help + This allows LEDs to be controlled by network device activity. + If unsure, say Y. diff --git a/target/linux/generic-2.6/patches-2.6.31/402-ledtrig_netdev.patch b/target/linux/generic-2.6/patches-2.6.31/402-ledtrig_netdev.patch index 16d80030f..0f5478e0d 100644 --- a/target/linux/generic-2.6/patches-2.6.31/402-ledtrig_netdev.patch +++ b/target/linux/generic-2.6/patches-2.6.31/402-ledtrig_netdev.patch @@ -6,7 +6,7 @@ +config LEDS_TRIGGER_NETDEV + tristate "LED Netdev Trigger" -+ depends on LEDS_TRIGGERS ++ depends on NET && LEDS_TRIGGERS + help + This allows LEDs to be controlled by network device activity. + If unsure, say Y. From 82ab0c04a1a516cece326786990322c4db56f007 Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 4 Nov 2009 22:43:05 +0000 Subject: [PATCH 082/288] [rdc] make rdc321-wdt become a package, saves some space in the kernel git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18298 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/kernel/modules/other.mk | 15 +++++++++++++++ target/linux/rdc/config-2.6.28 | 1 - 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/package/kernel/modules/other.mk b/package/kernel/modules/other.mk index 28ba41469..bf26beffa 100644 --- a/package/kernel/modules/other.mk +++ b/package/kernel/modules/other.mk @@ -419,6 +419,21 @@ endef $(eval $(call KernelPackage,softdog)) +define KernelPackage/rdc321x-wdt + SUBMENU:=$(OTHER_MENU) + TITLE:=RDC321x watchdog + DEPENDS:=@TARGET_rdc + KCONFIG:=CONFIG_RDC321X_WDT + FILES:=$(LINUX_DIR)/drivers/$(WATCHDOG_DIR)/rdc321x_wdt.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoLoad,50,rdc321_wdt) +endef + +define KernelPackage/rdc321x-wdt/description + RDC-321x watchdog driver +endef + +$(eval $(call KernelPackage,rdc321x-wdt)) + define KernelPackage/leds-gpio SUBMENU:=$(OTHER_MENU) diff --git a/target/linux/rdc/config-2.6.28 b/target/linux/rdc/config-2.6.28 index 7fec13148..a8561b787 100644 --- a/target/linux/rdc/config-2.6.28 +++ b/target/linux/rdc/config-2.6.28 @@ -217,7 +217,6 @@ CONFIG_PHYSICAL_START=0x100000 # CONFIG_PROCESSOR_SELECT is not set # CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set # CONFIG_R6040 is not set -CONFIG_RDC321X_WDT=y # CONFIG_RD_BZIP2 is not set CONFIG_RD_GZIP=y # CONFIG_RD_LZMA is not set From 9eea540afb7dadcc5a8dba5ba7d8eac2492027cf Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 4 Nov 2009 22:43:34 +0000 Subject: [PATCH 083/288] [rdc] include kmod-rdc321x-wdt by default git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18299 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/rdc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/rdc/Makefile b/target/linux/rdc/Makefile index 69e5abce4..185b67a21 100644 --- a/target/linux/rdc/Makefile +++ b/target/linux/rdc/Makefile @@ -16,7 +16,7 @@ LINUX_VERSION:=2.6.28.10 include $(INCLUDE_DIR)/target.mk -DEFAULT_PACKAGES += hostapd-mini +DEFAULT_PACKAGES += hostapd-mini kmod-rdc321x-wdt define Target/Description Build firmware images for RDC321x based routers From f11fdcc214e89c283199749b3adf3493ac59fcf0 Mon Sep 17 00:00:00 2001 From: agb Date: Wed, 4 Nov 2009 22:44:02 +0000 Subject: [PATCH 084/288] [rdc] 2.6.28: add flashmap and image support for the sitecom wl-176. Thanks Daniel Gimpelevich git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18300 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/rdc/config/profile-wl153 | 7 +-- target/linux/rdc/image/Makefile | 25 ++++++++-- .../patches-2.6.28/002-platform_support.patch | 50 ++++++++++++++----- 3 files changed, 59 insertions(+), 23 deletions(-) diff --git a/target/linux/rdc/config/profile-wl153 b/target/linux/rdc/config/profile-wl153 index a532c20a6..3e18b0e67 100644 --- a/target/linux/rdc/config/profile-wl153 +++ b/target/linux/rdc/config/profile-wl153 @@ -1,6 +1 @@ -CONFIG_MTD_RDC3210=y -CONFIG_MTD_RDC3210_ALLOW_JFFS2=y -CONFIG_MTD_RDC3210_BUSWIDTH=2 -# CONFIG_MTD_RDC3210_FACTORY_PRESENT is not set -CONFIG_MTD_RDC3210_SIZE=0x200000 -# CONFIG_MTD_RDC3210_STATIC_MAP is not set +# CONFIG_BLK_DEV_INITRD is not set diff --git a/target/linux/rdc/image/Makefile b/target/linux/rdc/image/Makefile index 3c7f476da..6d3825312 100644 --- a/target/linux/rdc/image/Makefile +++ b/target/linux/rdc/image/Makefile @@ -1,5 +1,5 @@ -# -# Copyright (C) 2006 OpenWrt.org +# +# Copyright (C) 2006-2009 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -21,6 +21,10 @@ define trxalign/squashfs bs=1024 endef +define Image/Prepare/squashfs + $(call prepare_generic_squashfs,$(KDIR)/root.squashfs) +endef + define Image/Build/ar525w touch $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img touch $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2)-web.img @@ -30,15 +34,24 @@ define Image/Build/ar525w $(STAGING_DIR_HOST)/bin/airlink -e -b 1 -j $(shell bash -c 'echo $$[$(3)]') $(KDIR)/bzImage $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2)-web.img endef +define Image/Prepare/wl153/squashfs + dd if=/dev/null of=$(KDIR)/root.tmp seek=1 bs=32k + echo -n "0123456789abcdef0123" >> $(KDIR)/root.tmp + cat $(KDIR)/bzImage $(KDIR)/root.squashfs >> $(KDIR)/root.tmp + dd if=$(KDIR)/root.tmp of=$(KDIR)/root2.tmp bs=64k conv=sync + dd if=$(KDIR)/root2.tmp of=$(KDIR)/root.squashfs bs=1 skip=$$$$[0x$$$$(cat $(KDIR)/bzSize) + 0x8014] + $(call add_jffs2_mark,$(KDIR)/root.squashfs) +endef + define Image/Build/wl153 ls -l $(KDIR)/bzImage | sed -r 's/^[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+([^[:blank:]]+).+$$$$/\1/' | xargs printf '%.8x' > $(KDIR)/bzSize - gzip -9c $(KDIR)/root.$(1) > $(KDIR)/root.$(1).gz - ls -l $(KDIR)/root.$(1).gz | sed -r 's/^[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+([^[:blank:]]+).+$$$$/\1/' | xargs printf '%.8x' > $(KDIR)/rdSize + $(call Image/Prepare/wl153/$(1)) + ls -l $(KDIR)/root.$(1) | sed -r 's/^[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+([^[:blank:]]+).+$$$$/\1/' | xargs printf '%.8x' > $(KDIR)/rdSize echo -ne "\x$$$$(cut -c 7,8 < $(KDIR)/bzSize)\x$$$$(cut -c 5,6 < $(KDIR)/bzSize)\x$$$$(cut -c 3,4 < $(KDIR)/bzSize)\x$$$$(cut -c 1,2 < $(KDIR)/bzSize)" > $(KDIR)/bzSize.tmp echo -n 'CSYS' > $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img cat $(KDIR)/bzSize.tmp >> $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img echo -ne "\x$$$$(cut -c 7,8 < $(KDIR)/rdSize)\x$$$$(cut -c 5,6 < $(KDIR)/rdSize)\x$$$$(cut -c 3,4 < $(KDIR)/rdSize)\x$$$$(cut -c 1,2 < $(KDIR)/rdSize)WRRM" >> $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img - cat $(KDIR)/bzSize.tmp $(KDIR)/bzImage $(KDIR)/root.$(1).gz >> $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img + cat $(KDIR)/bzSize.tmp $(KDIR)/bzImage $(KDIR)/root.$(1) >> $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img $(RM) $(KDIR)/bzSize.tmp $(KDIR)/bzSize $(KDIR)/rdSize if [ `ls -l $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img | sed -r 's/^[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+([^[:blank:]]+).+$$$$/\1/'` -gt $$$$((0xffff0000-0xffe08000)) ]; then mv $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img.too_big; echo "#ERR image too big"; fi endef @@ -51,6 +64,7 @@ define Image/Build/dir450 endef define Image/Build/g570s + $(call Image/Prepare/$(1)) mv $(KDIR)/root.$(1) $(KDIR)/root.tmp dd of=$(KDIR)/root.$(1) if=$(KDIR)/root.tmp $(call trxalign/$(1)) conv=sync $(CP) $(KDIR)/bzImage $(BIN_DIR)/openwrt-tftp-$(BOARD)-$(1)-$(2).img @@ -62,6 +76,7 @@ define Image/Build/g570s endef define Image/Build/amit + $(call Image/Prepare/$(1)) if [ ! -x $(STAGING_DIR_HOST)/bin/amit_makebin ]; then echo "#ERR Please copy the AMIT \"makebin\" tool from http://mgb111.pradnik.net/ as $(STAGING_DIR_HOST)/bin/amit_makebin to build."; fi sh -c "mkdir -p $(KDIR)/amit.tmp/linux_src/arch/i386/boot $(KDIR)/amit.tmp/rom_disk && cd $(KDIR)/amit.tmp && ln -s ../../root.$(1) rom_disk/fs.img && ln -s ../../../../../bzImage linux_src/arch/i386/boot && $(STAGING_DIR_HOST)/bin/amit_makebin && mv upgrade.img $(BIN_DIR)/openwrt-$(BOARD)-$(1)-anas350.bin" || : $(RM) -r $(KDIR)/amit.tmp diff --git a/target/linux/rdc/patches-2.6.28/002-platform_support.patch b/target/linux/rdc/patches-2.6.28/002-platform_support.patch index e42052ecb..bb2c7cb3a 100644 --- a/target/linux/rdc/patches-2.6.28/002-platform_support.patch +++ b/target/linux/rdc/patches-2.6.28/002-platform_support.patch @@ -1,7 +1,7 @@ Index: linux-2.6.28.10/arch/x86/mach-rdc321x/gpio.c =================================================================== ---- linux-2.6.28.10.orig/arch/x86/mach-rdc321x/gpio.c 2009-05-02 11:54:43.000000000 -0700 -+++ linux-2.6.28.10/arch/x86/mach-rdc321x/gpio.c 2009-10-30 22:24:23.779705091 -0700 +--- linux-2.6.28.10.orig/arch/x86/mach-rdc321x/gpio.c 2009-11-03 21:01:29.800401126 -0800 ++++ linux-2.6.28.10/arch/x86/mach-rdc321x/gpio.c 2009-11-03 21:01:32.164401226 -0800 @@ -26,7 +26,7 @@ #include #include @@ -39,8 +39,8 @@ Index: linux-2.6.28.10/arch/x86/mach-rdc321x/gpio.c +arch_initcall(rdc321x_gpio_setup); Index: linux-2.6.28.10/arch/x86/mach-rdc321x/platform.c =================================================================== ---- linux-2.6.28.10.orig/arch/x86/mach-rdc321x/platform.c 2009-05-02 11:54:43.000000000 -0700 -+++ linux-2.6.28.10/arch/x86/mach-rdc321x/platform.c 2009-10-30 22:37:01.595670310 -0700 +--- linux-2.6.28.10.orig/arch/x86/mach-rdc321x/platform.c 2009-11-03 21:01:29.836402559 -0800 ++++ linux-2.6.28.10/arch/x86/mach-rdc321x/platform.c 2009-11-03 21:13:27.212398945 -0800 @@ -1,7 +1,9 @@ /* * Generic RDC321x platform devices @@ -113,7 +113,7 @@ Index: linux-2.6.28.10/arch/x86/mach-rdc321x/platform.c }; static struct gpio_led_platform_data rdc321x_led_data = { -@@ -54,16 +102,163 @@ +@@ -54,16 +102,189 @@ .num_resources = 0, }; @@ -174,7 +174,7 @@ Index: linux-2.6.28.10/arch/x86/mach-rdc321x/platform.c - rdc321x_gpio_setup(); +#ifndef CONFIG_MTD_RDC3210 + struct map_info rdc_map_info; -+ u32 the_header[4]; ++ u32 the_header[8]; + ROOT_DEV = 0; + rdc_map_info.name = rdc_flash_device.name; @@ -198,10 +198,36 @@ Index: linux-2.6.28.10/arch/x86/mach-rdc321x/platform.c + the_header[2] = ((u32 *)rdc_map_info.virt)[2]; + the_header[3] = ((u32 *)rdc_map_info.virt)[3]; + iounmap(rdc_map_info.virt); ++ rdc_map_info.virt = ioremap_nocache(rdc_map_info.phys + 0x8000, 0x10); ++ if (rdc_map_info.virt == NULL) ++ panic("Could not ioremap to read device magic!"); ++ the_header[4] = ((u32 *)rdc_map_info.virt)[0]; ++ the_header[5] = ((u32 *)rdc_map_info.virt)[1]; ++ the_header[6] = ((u32 *)rdc_map_info.virt)[2]; ++ the_header[7] = ((u32 *)rdc_map_info.virt)[3]; ++ iounmap(rdc_map_info.virt); + if (!memcmp(the_header, "GMTK", 4)) { /* Gemtek */ + /* TODO */ -+ } else if (!memcmp(the_header, "CSYS", 4)) { /* Sitecom */ -+ /* TODO */ ++ } else if (!memcmp(the_header + 4, "CSYS", 4)) { /* Sitecom */ ++ rdc_flash_parts[0].name = "system"; ++ rdc_flash_parts[0].offset = 0; ++ rdc_flash_parts[0].size = rdc_map_info.size - 0x10000; ++ rdc_flash_parts[1].name = "config"; ++ rdc_flash_parts[1].offset = 0; ++ rdc_flash_parts[1].size = 0x8000; ++ rdc_flash_parts[2].name = "magic"; ++ rdc_flash_parts[2].offset = 0x8000; ++ rdc_flash_parts[2].size = 0x14; ++ rdc_flash_parts[3].name = "kernel"; ++ rdc_flash_parts[3].offset = 0x8014; ++ rdc_flash_parts[3].size = the_header[5]; ++ rdc_flash_parts[4].name = "rootfs"; ++ rdc_flash_parts[4].offset = 0x8014 + the_header[5]; ++ rdc_flash_parts[4].size = rdc_flash_parts[0].size - rdc_flash_parts[4].offset; ++ rdc_flash_parts[5].name = "bootloader"; ++ rdc_flash_parts[5].offset = rdc_flash_parts[0].size; ++ rdc_flash_parts[5].size = 0x10000; ++ rdc_flash_data.nr_parts = 6; + } else if (!memcmp(((u8 *)the_header) + 14, "Li", 2)) { /* AMIT */ + rdc_flash_parts[0].name = "kernel_parthdr"; + rdc_flash_parts[0].offset = 0; @@ -281,8 +307,8 @@ Index: linux-2.6.28.10/arch/x86/mach-rdc321x/platform.c +#endif Index: linux-2.6.28.10/arch/x86/Makefile =================================================================== ---- linux-2.6.28.10.orig/arch/x86/Makefile 2009-05-02 11:54:43.000000000 -0700 -+++ linux-2.6.28.10/arch/x86/Makefile 2009-10-30 22:04:55.444672426 -0700 +--- linux-2.6.28.10.orig/arch/x86/Makefile 2009-11-03 21:01:29.756400281 -0800 ++++ linux-2.6.28.10/arch/x86/Makefile 2009-11-03 21:01:32.164401226 -0800 @@ -113,6 +113,10 @@ mflags-$(CONFIG_X86_VOYAGER) := -Iarch/x86/include/asm/mach-voyager mcore-$(CONFIG_X86_VOYAGER) := arch/x86/mach-voyager/ @@ -296,8 +322,8 @@ Index: linux-2.6.28.10/arch/x86/Makefile fcore-$(CONFIG_X86_GENERICARCH) += arch/x86/mach-generic/ Index: linux-2.6.28.10/arch/x86/include/asm/mach-rdc321x/gpio.h =================================================================== ---- linux-2.6.28.10.orig/arch/x86/include/asm/mach-rdc321x/gpio.h 2009-10-30 22:31:04.680702348 -0700 -+++ linux-2.6.28.10/arch/x86/include/asm/mach-rdc321x/gpio.h 2009-10-30 22:34:24.024670851 -0700 +--- linux-2.6.28.10.orig/arch/x86/include/asm/mach-rdc321x/gpio.h 2009-11-03 21:01:29.784401606 -0800 ++++ linux-2.6.28.10/arch/x86/include/asm/mach-rdc321x/gpio.h 2009-11-03 21:01:32.164401226 -0800 @@ -9,7 +9,6 @@ extern int rdc_gpio_direction_output(unsigned gpio, int value); extern int rdc_gpio_request(unsigned gpio, const char *label); From 64dc8b1d34714ae583e3166f85bacb95e1929f15 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 4 Nov 2009 22:51:07 +0000 Subject: [PATCH 085/288] fix one more instance of r18295 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18301 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- include/kernel.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/kernel.mk b/include/kernel.mk index db0790007..ee4d4b8dc 100644 --- a/include/kernel.mk +++ b/include/kernel.mk @@ -102,7 +102,7 @@ define KernelPackage $(eval $(call KernelPackage/Defaults)) $(eval $(call KernelPackage/$(1))) $(eval $(call KernelPackage/$(1)/$(KERNEL))) - $(eval $(call KernelPackage/$(1)/$(BOARD)-$(KERNEL))) + $(eval $(call KernelPackage/$(1)/$(BOARD))) define Package/kmod-$(1) TITLE:=$(TITLE) From e0ac739a84089bbc8c9331b0119b5b88aca2fdbe Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 4 Nov 2009 23:07:56 +0000 Subject: [PATCH 086/288] [rdc] remove useless configuration options git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18303 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/rdc/config-2.6.28 | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/target/linux/rdc/config-2.6.28 b/target/linux/rdc/config-2.6.28 index a8561b787..af7b12312 100644 --- a/target/linux/rdc/config-2.6.28 +++ b/target/linux/rdc/config-2.6.28 @@ -26,7 +26,6 @@ CONFIG_BASE_SMALL=0 # CONFIG_BINFMT_AOUT is not set CONFIG_BITREVERSE=y CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BOUNCE=y @@ -39,12 +38,12 @@ CONFIG_CMDLINE_BOOL=y # CONFIG_COMPAT_VDSO is not set # CONFIG_CPU5_WDT is not set # CONFIG_CPU_FREQ is not set -CONFIG_CPU_SUP_AMD=y -CONFIG_CPU_SUP_CENTAUR_32=y +# CONFIG_CPU_SUP_AMD is not set +# CONFIG_CPU_SUP_CENTAUR_32 is not set CONFIG_CPU_SUP_CYRIX_32=y -CONFIG_CPU_SUP_INTEL=y -CONFIG_CPU_SUP_TRANSMETA_32=y -CONFIG_CPU_SUP_UMC_32=y +# CONFIG_CPU_SUP_INTEL is not set +# CONFIG_CPU_SUP_TRANSMETA_32 is not set +# CONFIG_CPU_SUP_UMC_32 is not set # CONFIG_CS5535_GPIO is not set # CONFIG_DCDBAS is not set # CONFIG_DEBUG_BUGVERBOSE is not set @@ -116,8 +115,6 @@ CONFIG_HZ_250=y # CONFIG_I8K is not set # CONFIG_IB700_WDT is not set # CONFIG_IBMASR is not set -# CONFIG_IBM_ASM is not set -CONFIG_ICPLUS_PHY=y # CONFIG_IDE is not set CONFIG_INITRAMFS_SOURCE="" # CONFIG_IOMMU_HELPER is not set @@ -138,11 +135,11 @@ CONFIG_ISA_DMA_API=y # CONFIG_KERNEL_BZIP2 is not set # CONFIG_KERNEL_GZIP is not set CONFIG_KERNEL_LZMA=y -CONFIG_KEXEC=y CONFIG_KTIME_SCALAR=y -# CONFIG_KVM is not set CONFIG_LBD=y -# CONFIG_LGUEST is not set +# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set +# CONFIG_LEDS_TRIGGER_NETDEV is not set +# CONFIG_LEDS_TRIGGER_TIMER is not set CONFIG_LSF=y # CONFIG_M386 is not set CONFIG_M486=y @@ -211,12 +208,12 @@ CONFIG_PCI_GOANY=y # CONFIG_PCI_GOMMCONFIG is not set # CONFIG_PCI_GOOLPC is not set # CONFIG_PCSPKR_PLATFORM is not set -CONFIG_PHYLIB=y CONFIG_PHYSICAL_ALIGN=0x100000 CONFIG_PHYSICAL_START=0x100000 -# CONFIG_PROCESSOR_SELECT is not set +CONFIG_PROCESSOR_SELECT=y # CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set # CONFIG_R6040 is not set +# CONFIG_RDC321X_WDT is not set # CONFIG_RD_BZIP2 is not set CONFIG_RD_GZIP=y # CONFIG_RD_LZMA is not set @@ -245,9 +242,6 @@ CONFIG_UID16=y CONFIG_USB_SUPPORT=y # CONFIG_VGASTATE is not set # CONFIG_VIA_RHINE is not set -# CONFIG_VIRTIO_BALLOON is not set -# CONFIG_VIRTIO_PCI is not set -CONFIG_VIRTUALIZATION=y # CONFIG_VM86 is not set # CONFIG_VMSPLIT_2G_OPT is not set # CONFIG_VMSPLIT_3G_OPT is not set @@ -263,7 +257,7 @@ CONFIG_X86_BSWAP=y # CONFIG_X86_CHECK_BIOS_CORRUPTION is not set CONFIG_X86_CMPXCHG=y CONFIG_X86_CPU=y -CONFIG_X86_CPUID=y +# CONFIG_X86_CPUID is not set # CONFIG_X86_ELAN is not set CONFIG_X86_F00F_BUG=y # CONFIG_X86_GENERIC is not set @@ -272,14 +266,14 @@ CONFIG_X86_INVLPG=y CONFIG_X86_L1_CACHE_SHIFT=4 # CONFIG_X86_MCE is not set CONFIG_X86_MINIMUM_CPU_FAMILY=4 -CONFIG_X86_MSR=y +# CONFIG_X86_MSR is not set # CONFIG_X86_PAE is not set CONFIG_X86_PC=y CONFIG_X86_POPAD_OK=y -CONFIG_X86_PPRO_FENCE=y +# CONFIG_X86_PPRO_FENCE is not set CONFIG_X86_RDC321X=y CONFIG_X86_REBOOTFIXUPS=y -CONFIG_X86_RESERVE_LOW_64K=y +# CONFIG_X86_RESERVE_LOW_64K is not set # CONFIG_X86_UP_APIC is not set CONFIG_X86_VERBOSE_BOOTUP=y # CONFIG_X86_VOYAGER is not set From ea4600ff65ca71a211a2b820dfecc114790aef4a Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 5 Nov 2009 01:24:30 +0000 Subject: [PATCH 087/288] metadata: process dependencies for targets that have subtargets as well - hides the ramips target unless the user has requested to play with broken packages/targets (related to #6051) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18306 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- scripts/metadata.pl | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/scripts/metadata.pl b/scripts/metadata.pl index 2da885117..ca00fcae6 100755 --- a/scripts/metadata.pl +++ b/scripts/metadata.pl @@ -225,25 +225,26 @@ EOF } if (@{$target->{subtargets}} > 0) { $confstr .= "\tselect HAS_SUBTARGETS\n"; - } else { - $confstr .= "\tselect $target->{arch}\n"; - foreach my $dep (@{$target->{depends}}) { - my $mode = "depends"; - my $flags; - my $name; - - $dep =~ /^([@\+\-]+)(.+)$/; - $flags = $1; - $name = $2; - - next if $name =~ /:/; - $flags =~ /-/ and $mode = "deselect"; - $flags =~ /\+/ and $mode = "select"; - $flags =~ /@/ and $confstr .= "\t$mode $name\n"; - } - $confstr .= $features; } + if ($target->{arch} =~ /\w/) { + $confstr .= "\tselect $target->{arch}\n"; + } + foreach my $dep (@{$target->{depends}}) { + my $mode = "depends"; + my $flags; + my $name; + + $dep =~ /^([@\+\-]+)(.+)$/; + $flags = $1; + $name = $2; + + next if $name =~ /:/; + $flags =~ /-/ and $mode = "deselect"; + $flags =~ /\+/ and $mode = "select"; + $flags =~ /@/ and $confstr .= "\t$mode $name\n"; + } + $confstr .= $features; $confstr .= "$help\n\n"; print $confstr; } From 92b9209394cdd729c9b967efbb739c89da6d28ec Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 5 Nov 2009 01:49:20 +0000 Subject: [PATCH 088/288] binutils: fix build errors in 2.20 (patch from #6094) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18307 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../binutils/patches/2.20/200-mips_non_pic.patch | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/toolchain/binutils/patches/2.20/200-mips_non_pic.patch b/toolchain/binutils/patches/2.20/200-mips_non_pic.patch index 71799ff1f..56891432e 100644 --- a/toolchain/binutils/patches/2.20/200-mips_non_pic.patch +++ b/toolchain/binutils/patches/2.20/200-mips_non_pic.patch @@ -179,11 +179,18 @@ if (! bfd_set_arch_mach (stdoutput, bfd_arch_mips, file_mips_arch)) as_warn (_("Could not set architecture and machine")); -@@ -11359,6 +11365,8 @@ struct option md_longopts[] = +@@ -11264,6 +11264,7 @@ + OPTION_PDR, + OPTION_NO_PDR, + OPTION_MVXWORKS_PIC, ++ OPTION_NON_PIC_ABICALLS, + #endif /* OBJ_ELF */ + OPTION_END_OF_ENUM + }; +@@ -11365,6 +11372,7 @@ struct option md_longopts[] = {"mpdr", no_argument, NULL, OPTION_PDR}, {"mno-pdr", no_argument, NULL, OPTION_NO_PDR}, {"mvxworks-pic", no_argument, NULL, OPTION_MVXWORKS_PIC}, -+#define OPTION_NON_PIC_ABICALLS (OPTION_ELF_BASE + 13) + {"mnon-pic-abicalls", no_argument, NULL, OPTION_NON_PIC_ABICALLS}, #endif /* OBJ_ELF */ From 09076810f3a83e34f11ccd85ee575e630738fb9e Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 5 Nov 2009 11:06:23 +0000 Subject: [PATCH 089/288] add missing CONFIG_MEDIA_SUPPORT symbol for v4l (fixes #6108) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18309 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/kernel/modules/video.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/package/kernel/modules/video.mk b/package/kernel/modules/video.mk index 5bcdbe63e..f1ee75a85 100644 --- a/package/kernel/modules/video.mk +++ b/package/kernel/modules/video.mk @@ -13,6 +13,7 @@ define KernelPackage/video-core TITLE=Video4Linux support DEPENDS:=@PCI_SUPPORT||USB_SUPPORT KCONFIG:= \ + CONFIG_MEDIA_SUPPORT=m \ CONFIG_VIDEO_DEV \ CONFIG_VIDEO_V4L1=y \ CONFIG_VIDEO_CAPTURE_DRIVERS=y \ From 18fbe1a18b0ded009ca3f460f5ea0fb0d2c892b8 Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 5 Nov 2009 11:16:20 +0000 Subject: [PATCH 090/288] Don't build gmp and mpfr when using external toolchains (based on patch from #6035) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18310 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- tools/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/Makefile b/tools/Makefile index 8a5f36c28..1456c0d17 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -10,7 +10,9 @@ curdir:=tools # subdirectories to descend into tools-y := +ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) tools-$(CONFIG_GCC_VERSION_4_3)$(CONFIG_GCC_VERSION_4_4) += gmp mpfr +endif tools-y += m4 autoconf automake bison pkg-config sed mklibs tools-y += sstrip ipkg-utils genext2fs squashfs squashfs4 mtd-utils lzma-old mkimage tools-y += firmware-utils patch-cmdline quilt yaffs2 From 99867b24bf6a8beb6b4198e6c514bcfaa974ff4d Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 5 Nov 2009 11:55:00 +0000 Subject: [PATCH 091/288] Pass TARGET_CFLAGS using and external variable instead a sed expression that can fail when TARGET_CFLAGS contains the ":" symbol. Signed-off: Luigi 'Comio' Mantellini git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18311 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/iproute2/Makefile | 5 ++--- package/iproute2/patches/110-extra-ccopts.patch | 11 +++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 package/iproute2/patches/110-extra-ccopts.patch diff --git a/package/iproute2/Makefile b/package/iproute2/Makefile index da18b4b0f..b36b95bc9 100644 --- a/package/iproute2/Makefile +++ b/package/iproute2/Makefile @@ -41,7 +41,6 @@ $(call Package/iproute2/Default) endef define Build/Configure - $(SED) "s:-O2:${TARGET_CFLAGS}:g" $(PKG_BUILD_DIR)/Makefile $(SED) "s,-I/usr/include/db3,," $(PKG_BUILD_DIR)/Makefile $(SED) "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \ $(PKG_BUILD_DIR)/Makefile @@ -53,8 +52,8 @@ define Build/Configure endef define Build/Compile - $(MAKE) -C $(PKG_BUILD_DIR)/netem HOSTCC="$(HOSTCC)" CFLAGS="-D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -I ../include -DRESOLVE_HOSTNAMES" - $(MAKE) -C $(PKG_BUILD_DIR) $(TARGET_CONFIGURE_OPTS) KERNEL_INCLUDE=$(LINUX_DIR)/include all tc/tc ip/ip + $(MAKE) -C $(PKG_BUILD_DIR)/netem HOSTCC="$(HOSTCC)" EXTRA_CCOPTS="$(TARGET_CFLAGS)" CFLAGS="-D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -I ../include -DRESOLVE_HOSTNAMES" + $(MAKE) -C $(PKG_BUILD_DIR) $(TARGET_CONFIGURE_OPTS) EXTRA_CCOPTS="$(TARGET_CFLAGS)" KERNEL_INCLUDE=$(LINUX_DIR)/include all tc/tc ip/ip endef define Build/InstallDev diff --git a/package/iproute2/patches/110-extra-ccopts.patch b/package/iproute2/patches/110-extra-ccopts.patch new file mode 100644 index 000000000..b1edc6a96 --- /dev/null +++ b/package/iproute2/patches/110-extra-ccopts.patch @@ -0,0 +1,11 @@ +--- ./Makefile.old 2009-10-18 21:14:18.344641842 +0200 ++++ ./Makefile 2009-10-18 21:14:33.558618672 +0200 +@@ -22,7 +22,7 @@ + + CC = gcc + HOSTCC = gcc +-CCOPTS = -D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall ++CCOPTS = -D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall $(EXTRA_CCOPTS) + CFLAGS = $(CCOPTS) -I../include $(DEFINES) + YACCFLAGS = -d -t -v + From 7954e8f37c0d339b04f72dc5a57ede96d9ecb168 Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 5 Nov 2009 12:10:17 +0000 Subject: [PATCH 092/288] enable multicast routing for linux 2.4 (#6037) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18312 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic-2.4/config-default | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/linux/generic-2.4/config-default b/target/linux/generic-2.4/config-default index dc7033357..c35d75a99 100644 --- a/target/linux/generic-2.4/config-default +++ b/target/linux/generic-2.4/config-default @@ -217,7 +217,7 @@ CONFIG_IPSEC_NAT_TRAVERSAL=y CONFIG_IPV6=m # CONFIG_IPX is not set CONFIG_IP_ADVANCED_ROUTER=y -# CONFIG_IP_MROUTE is not set +CONFIG_IP_MROUTE=y CONFIG_IP_MULTICAST=y CONFIG_IP_MULTIPLE_TABLES=y CONFIG_IP_NF_AMANDA=m @@ -308,6 +308,8 @@ CONFIG_IP_NF_TARGET_TOS=m CONFIG_IP_NF_TARGET_TTL=m CONFIG_IP_NF_TARGET_ULOG=m CONFIG_IP_NF_TFTP=m +# CONFIG_IP_PIMSM_V1 is not set +# CONFIG_IP_PIMSM_V2 is not set # CONFIG_IP_PNP is not set CONFIG_IP_ROUTE_FWMARK=y CONFIG_IP_ROUTE_MULTIPATH=y From 1f00501340724f423cb88cb9601d09907a92a09e Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 5 Nov 2009 13:21:55 +0000 Subject: [PATCH 093/288] [rdc] remove some other useless configuration items git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18314 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/rdc/config-2.6.28 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/linux/rdc/config-2.6.28 b/target/linux/rdc/config-2.6.28 index af7b12312..f155061d0 100644 --- a/target/linux/rdc/config-2.6.28 +++ b/target/linux/rdc/config-2.6.28 @@ -50,8 +50,7 @@ CONFIG_CPU_SUP_CYRIX_32=y CONFIG_DEFAULT_IO_DELAY_TYPE=0 # CONFIG_DELL_RBU is not set CONFIG_DEVPORT=y -CONFIG_DMI=y -CONFIG_DMIID=y +# CONFIG_DMI is not set CONFIG_DOUBLEFAULT=y CONFIG_EARLY_PRINTK=y # CONFIG_EARLY_PRINTK_DBGP is not set @@ -275,7 +274,7 @@ CONFIG_X86_RDC321X=y CONFIG_X86_REBOOTFIXUPS=y # CONFIG_X86_RESERVE_LOW_64K is not set # CONFIG_X86_UP_APIC is not set -CONFIG_X86_VERBOSE_BOOTUP=y +# CONFIG_X86_VERBOSE_BOOTUP is not set # CONFIG_X86_VOYAGER is not set # CONFIG_X86_VSMP is not set CONFIG_X86_WP_WORKS_OK=y From 498ec579dda3dc8f721ea3b89e57b8118f5e7204 Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 5 Nov 2009 14:21:05 +0000 Subject: [PATCH 094/288] [package] remove the patch dir hack in iptables when building with an external tree, this did not work at all. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18315 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/iptables/Makefile | 6 ------ 1 file changed, 6 deletions(-) diff --git a/package/iptables/Makefile b/package/iptables/Makefile index 1e3202213..6590d990e 100644 --- a/package/iptables/Makefile +++ b/package/iptables/Makefile @@ -19,12 +19,6 @@ PKG_SOURCE_URL:=http://www.netfilter.org/projects/iptables/files \ ftp://ftp.de.netfilter.org/pub/netfilter/iptables/ \ ftp://ftp.no.netfilter.org/pub/netfilter/iptables/ -ifeq ($(CONFIG_EXTERNAL_KERNEL_TREE),) -PATCH_DIR:= -else -PATCH_DIR:=./patches/$(PKG_VERSION) -endif - PKG_FIXUP = libtool include $(INCLUDE_DIR)/package.mk From 290c36378fcbb6529db08abc63cfed3187416987 Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 5 Nov 2009 14:35:36 +0000 Subject: [PATCH 095/288] [package] fix breakage introduced with r18315 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18316 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/iptables/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/iptables/Makefile b/package/iptables/Makefile index 6590d990e..f4d59abd9 100644 --- a/package/iptables/Makefile +++ b/package/iptables/Makefile @@ -19,6 +19,8 @@ PKG_SOURCE_URL:=http://www.netfilter.org/projects/iptables/files \ ftp://ftp.de.netfilter.org/pub/netfilter/iptables/ \ ftp://ftp.no.netfilter.org/pub/netfilter/iptables/ +PATCH_DIR:=./patches/$(PKG_VERSION) + PKG_FIXUP = libtool include $(INCLUDE_DIR)/package.mk From d71b9a7d99a588219c49d460663749d5fb2897d4 Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 5 Nov 2009 16:05:52 +0000 Subject: [PATCH 096/288] fix up the download location for the updated mac80211 version (thx, swalker) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18317 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile index 1766628bf..5e99342b7 100644 --- a/package/mac80211/Makefile +++ b/package/mac80211/Makefile @@ -13,7 +13,7 @@ PKG_NAME:=mac80211 PKG_VERSION:=2009-11-03 PKG_RELEASE:=1 PKG_SOURCE_URL:= \ - http://www.orbit-lab.org/kernel/compat-wireless-2.6/2009/10 \ + http://www.orbit-lab.org/kernel/compat-wireless-2.6/2009/11 \ http://wireless.kernel.org/download/compat-wireless-2.6 PKG_MD5SUM:=f8434790c9552abb9c98926d7ae616fe From 5b4f77876dd835a71005991d39e6790c8225f80c Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 5 Nov 2009 16:11:45 +0000 Subject: [PATCH 097/288] fix kmod-leds-alix (#6079, #6105) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18318 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/kernel/modules/other.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kernel/modules/other.mk b/package/kernel/modules/other.mk index bf26beffa..9a5c6dafa 100644 --- a/package/kernel/modules/other.mk +++ b/package/kernel/modules/other.mk @@ -504,8 +504,8 @@ define KernelPackage/leds-alix SUBMENU:=$(OTHER_MENU) TITLE:=PCengines ALIX LED support DEPENDS:=@TARGET_x86 - KCONFIG:=CONFIG_LEDS_ALIX - FILES:=$(LINUX_DIR)/drivers/leds/leds-alix.$(LINUX_KMOD_SUFFIX) + KCONFIG:=CONFIG_LEDS_ALIX2 + FILES:=$(LINUX_DIR)/drivers/leds/leds-alix2.$(LINUX_KMOD_SUFFIX) AUTOLOAD:=$(call AutoLoad,50,leds-alix) endef From 57967352ad441b719b9840f0ace0180393d03ef1 Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 5 Nov 2009 16:12:11 +0000 Subject: [PATCH 098/288] oops, forgot the autoload git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18319 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/kernel/modules/other.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/modules/other.mk b/package/kernel/modules/other.mk index 9a5c6dafa..2116dd0cb 100644 --- a/package/kernel/modules/other.mk +++ b/package/kernel/modules/other.mk @@ -506,7 +506,7 @@ define KernelPackage/leds-alix DEPENDS:=@TARGET_x86 KCONFIG:=CONFIG_LEDS_ALIX2 FILES:=$(LINUX_DIR)/drivers/leds/leds-alix2.$(LINUX_KMOD_SUFFIX) - AUTOLOAD:=$(call AutoLoad,50,leds-alix) + AUTOLOAD:=$(call AutoLoad,50,leds-alix2) endef define KernelPackage/leds-alix/description From b9eaff23ad23d6fbbd8a5388f4855995c50f693a Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 5 Nov 2009 16:16:32 +0000 Subject: [PATCH 099/288] remove the old alix led junk which was replaced by upstream code git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18320 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../files-2.6.25/drivers/leds/leds-alix.c | 172 ------------------ .../files-2.6.28/drivers/leds/leds-alix.c | 172 ------------------ .../files-2.6.30/drivers/leds/leds-alix.c | 172 ------------------ .../files-2.6.31/drivers/leds/leds-alix.c | 172 ------------------ .../files-2.6.32/drivers/leds/leds-alix.c | 172 ------------------ .../patches-2.6.25/401-led_alix.patch | 25 --- .../402-ledtrig_default_on.patch | 4 +- .../patches-2.6.28/401-led_alix.patch | 25 --- .../patches-2.6.28/402-ledtrig_netdev.patch | 4 +- 9 files changed, 4 insertions(+), 914 deletions(-) delete mode 100644 target/linux/generic-2.6/files-2.6.25/drivers/leds/leds-alix.c delete mode 100644 target/linux/generic-2.6/files-2.6.28/drivers/leds/leds-alix.c delete mode 100644 target/linux/generic-2.6/files-2.6.30/drivers/leds/leds-alix.c delete mode 100644 target/linux/generic-2.6/files-2.6.31/drivers/leds/leds-alix.c delete mode 100644 target/linux/generic-2.6/files-2.6.32/drivers/leds/leds-alix.c delete mode 100644 target/linux/generic-2.6/patches-2.6.25/401-led_alix.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.28/401-led_alix.patch diff --git a/target/linux/generic-2.6/files-2.6.25/drivers/leds/leds-alix.c b/target/linux/generic-2.6/files-2.6.25/drivers/leds/leds-alix.c deleted file mode 100644 index 103ca7dfa..000000000 --- a/target/linux/generic-2.6/files-2.6.25/drivers/leds/leds-alix.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * LEDs driver for PCEngines ALIX 2/3 series - * - * Copyright (C) 2007 Petr Liebman - * - * Based on leds-wrap.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include - -#define DRVNAME "alix-led" - -#define ALIX_LED1_PORT (0x6100) -#define ALIX_LED1_ON (1<<22) -#define ALIX_LED1_OFF (1<<6) - -#define ALIX_LED2_PORT (0x6180) -#define ALIX_LED2_ON (1<<25) -#define ALIX_LED2_OFF (1<<9) - -#define ALIX_LED3_PORT (0x6180) -#define ALIX_LED3_ON (1<<27) -#define ALIX_LED3_OFF (1<<11) - - -static struct platform_device *pdev; - -static void alix_led_set_1(struct led_classdev *led_cdev, - enum led_brightness value) -{ - if (value) - outl(ALIX_LED1_ON, ALIX_LED1_PORT); - else - outl(ALIX_LED1_OFF, ALIX_LED1_PORT); -} - -static void alix_led_set_2(struct led_classdev *led_cdev, - enum led_brightness value) -{ - if (value) - outl(ALIX_LED2_ON, ALIX_LED2_PORT); - else - outl(ALIX_LED2_OFF, ALIX_LED2_PORT); -} - -static void alix_led_set_3(struct led_classdev *led_cdev, - enum led_brightness value) -{ - if (value) - outl(ALIX_LED3_ON, ALIX_LED3_PORT); - else - outl(ALIX_LED3_OFF, ALIX_LED3_PORT); -} - -static struct led_classdev alix_led_1 = { - .name = "alix:1", - .brightness_set = alix_led_set_1, -}; - -static struct led_classdev alix_led_2 = { - .name = "alix:2", - .brightness_set = alix_led_set_2, -}; - -static struct led_classdev alix_led_3 = { - .name = "alix:3", - .brightness_set = alix_led_set_3, -}; - - -#ifdef CONFIG_PM -static int alix_led_suspend(struct platform_device *dev, - pm_message_t state) -{ - led_classdev_suspend(&alix_led_1); - led_classdev_suspend(&alix_led_2); - led_classdev_suspend(&alix_led_3); - return 0; -} - -static int alix_led_resume(struct platform_device *dev) -{ - led_classdev_resume(&alix_led_1); - led_classdev_resume(&alix_led_2); - led_classdev_resume(&alix_led_3); - return 0; -} -#else -#define alix_led_suspend NULL -#define alix_led_resume NULL -#endif - -static int alix_led_probe(struct platform_device *pdev) -{ - int ret; - - ret = led_classdev_register(&pdev->dev, &alix_led_1); - if (ret >= 0) - { - ret = led_classdev_register(&pdev->dev, &alix_led_2); - if (ret >= 0) - { - ret = led_classdev_register(&pdev->dev, &alix_led_3); - if (ret < 0) - led_classdev_unregister(&alix_led_2); - } - if (ret < 0) - led_classdev_unregister(&alix_led_1); - } - return ret; -} - -static int alix_led_remove(struct platform_device *pdev) -{ - led_classdev_unregister(&alix_led_1); - led_classdev_unregister(&alix_led_2); - led_classdev_unregister(&alix_led_3); - return 0; -} - -static struct platform_driver alix_led_driver = { - .probe = alix_led_probe, - .remove = alix_led_remove, - .suspend = alix_led_suspend, - .resume = alix_led_resume, - .driver = { - .name = DRVNAME, - .owner = THIS_MODULE, - }, -}; - -static int __init alix_led_init(void) -{ - int ret; - - ret = platform_driver_register(&alix_led_driver); - if (ret < 0) - goto out; - - pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); - if (IS_ERR(pdev)) { - ret = PTR_ERR(pdev); - platform_driver_unregister(&alix_led_driver); - goto out; - } - -out: - return ret; -} - -static void __exit alix_led_exit(void) -{ - platform_device_unregister(pdev); - platform_driver_unregister(&alix_led_driver); -} - -module_init(alix_led_init); -module_exit(alix_led_exit); - -MODULE_AUTHOR("Petr Liebman"); -MODULE_DESCRIPTION("PCEngines ALIX LED driver"); -MODULE_LICENSE("GPL"); - diff --git a/target/linux/generic-2.6/files-2.6.28/drivers/leds/leds-alix.c b/target/linux/generic-2.6/files-2.6.28/drivers/leds/leds-alix.c deleted file mode 100644 index 103ca7dfa..000000000 --- a/target/linux/generic-2.6/files-2.6.28/drivers/leds/leds-alix.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * LEDs driver for PCEngines ALIX 2/3 series - * - * Copyright (C) 2007 Petr Liebman - * - * Based on leds-wrap.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include - -#define DRVNAME "alix-led" - -#define ALIX_LED1_PORT (0x6100) -#define ALIX_LED1_ON (1<<22) -#define ALIX_LED1_OFF (1<<6) - -#define ALIX_LED2_PORT (0x6180) -#define ALIX_LED2_ON (1<<25) -#define ALIX_LED2_OFF (1<<9) - -#define ALIX_LED3_PORT (0x6180) -#define ALIX_LED3_ON (1<<27) -#define ALIX_LED3_OFF (1<<11) - - -static struct platform_device *pdev; - -static void alix_led_set_1(struct led_classdev *led_cdev, - enum led_brightness value) -{ - if (value) - outl(ALIX_LED1_ON, ALIX_LED1_PORT); - else - outl(ALIX_LED1_OFF, ALIX_LED1_PORT); -} - -static void alix_led_set_2(struct led_classdev *led_cdev, - enum led_brightness value) -{ - if (value) - outl(ALIX_LED2_ON, ALIX_LED2_PORT); - else - outl(ALIX_LED2_OFF, ALIX_LED2_PORT); -} - -static void alix_led_set_3(struct led_classdev *led_cdev, - enum led_brightness value) -{ - if (value) - outl(ALIX_LED3_ON, ALIX_LED3_PORT); - else - outl(ALIX_LED3_OFF, ALIX_LED3_PORT); -} - -static struct led_classdev alix_led_1 = { - .name = "alix:1", - .brightness_set = alix_led_set_1, -}; - -static struct led_classdev alix_led_2 = { - .name = "alix:2", - .brightness_set = alix_led_set_2, -}; - -static struct led_classdev alix_led_3 = { - .name = "alix:3", - .brightness_set = alix_led_set_3, -}; - - -#ifdef CONFIG_PM -static int alix_led_suspend(struct platform_device *dev, - pm_message_t state) -{ - led_classdev_suspend(&alix_led_1); - led_classdev_suspend(&alix_led_2); - led_classdev_suspend(&alix_led_3); - return 0; -} - -static int alix_led_resume(struct platform_device *dev) -{ - led_classdev_resume(&alix_led_1); - led_classdev_resume(&alix_led_2); - led_classdev_resume(&alix_led_3); - return 0; -} -#else -#define alix_led_suspend NULL -#define alix_led_resume NULL -#endif - -static int alix_led_probe(struct platform_device *pdev) -{ - int ret; - - ret = led_classdev_register(&pdev->dev, &alix_led_1); - if (ret >= 0) - { - ret = led_classdev_register(&pdev->dev, &alix_led_2); - if (ret >= 0) - { - ret = led_classdev_register(&pdev->dev, &alix_led_3); - if (ret < 0) - led_classdev_unregister(&alix_led_2); - } - if (ret < 0) - led_classdev_unregister(&alix_led_1); - } - return ret; -} - -static int alix_led_remove(struct platform_device *pdev) -{ - led_classdev_unregister(&alix_led_1); - led_classdev_unregister(&alix_led_2); - led_classdev_unregister(&alix_led_3); - return 0; -} - -static struct platform_driver alix_led_driver = { - .probe = alix_led_probe, - .remove = alix_led_remove, - .suspend = alix_led_suspend, - .resume = alix_led_resume, - .driver = { - .name = DRVNAME, - .owner = THIS_MODULE, - }, -}; - -static int __init alix_led_init(void) -{ - int ret; - - ret = platform_driver_register(&alix_led_driver); - if (ret < 0) - goto out; - - pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); - if (IS_ERR(pdev)) { - ret = PTR_ERR(pdev); - platform_driver_unregister(&alix_led_driver); - goto out; - } - -out: - return ret; -} - -static void __exit alix_led_exit(void) -{ - platform_device_unregister(pdev); - platform_driver_unregister(&alix_led_driver); -} - -module_init(alix_led_init); -module_exit(alix_led_exit); - -MODULE_AUTHOR("Petr Liebman"); -MODULE_DESCRIPTION("PCEngines ALIX LED driver"); -MODULE_LICENSE("GPL"); - diff --git a/target/linux/generic-2.6/files-2.6.30/drivers/leds/leds-alix.c b/target/linux/generic-2.6/files-2.6.30/drivers/leds/leds-alix.c deleted file mode 100644 index 103ca7dfa..000000000 --- a/target/linux/generic-2.6/files-2.6.30/drivers/leds/leds-alix.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * LEDs driver for PCEngines ALIX 2/3 series - * - * Copyright (C) 2007 Petr Liebman - * - * Based on leds-wrap.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include - -#define DRVNAME "alix-led" - -#define ALIX_LED1_PORT (0x6100) -#define ALIX_LED1_ON (1<<22) -#define ALIX_LED1_OFF (1<<6) - -#define ALIX_LED2_PORT (0x6180) -#define ALIX_LED2_ON (1<<25) -#define ALIX_LED2_OFF (1<<9) - -#define ALIX_LED3_PORT (0x6180) -#define ALIX_LED3_ON (1<<27) -#define ALIX_LED3_OFF (1<<11) - - -static struct platform_device *pdev; - -static void alix_led_set_1(struct led_classdev *led_cdev, - enum led_brightness value) -{ - if (value) - outl(ALIX_LED1_ON, ALIX_LED1_PORT); - else - outl(ALIX_LED1_OFF, ALIX_LED1_PORT); -} - -static void alix_led_set_2(struct led_classdev *led_cdev, - enum led_brightness value) -{ - if (value) - outl(ALIX_LED2_ON, ALIX_LED2_PORT); - else - outl(ALIX_LED2_OFF, ALIX_LED2_PORT); -} - -static void alix_led_set_3(struct led_classdev *led_cdev, - enum led_brightness value) -{ - if (value) - outl(ALIX_LED3_ON, ALIX_LED3_PORT); - else - outl(ALIX_LED3_OFF, ALIX_LED3_PORT); -} - -static struct led_classdev alix_led_1 = { - .name = "alix:1", - .brightness_set = alix_led_set_1, -}; - -static struct led_classdev alix_led_2 = { - .name = "alix:2", - .brightness_set = alix_led_set_2, -}; - -static struct led_classdev alix_led_3 = { - .name = "alix:3", - .brightness_set = alix_led_set_3, -}; - - -#ifdef CONFIG_PM -static int alix_led_suspend(struct platform_device *dev, - pm_message_t state) -{ - led_classdev_suspend(&alix_led_1); - led_classdev_suspend(&alix_led_2); - led_classdev_suspend(&alix_led_3); - return 0; -} - -static int alix_led_resume(struct platform_device *dev) -{ - led_classdev_resume(&alix_led_1); - led_classdev_resume(&alix_led_2); - led_classdev_resume(&alix_led_3); - return 0; -} -#else -#define alix_led_suspend NULL -#define alix_led_resume NULL -#endif - -static int alix_led_probe(struct platform_device *pdev) -{ - int ret; - - ret = led_classdev_register(&pdev->dev, &alix_led_1); - if (ret >= 0) - { - ret = led_classdev_register(&pdev->dev, &alix_led_2); - if (ret >= 0) - { - ret = led_classdev_register(&pdev->dev, &alix_led_3); - if (ret < 0) - led_classdev_unregister(&alix_led_2); - } - if (ret < 0) - led_classdev_unregister(&alix_led_1); - } - return ret; -} - -static int alix_led_remove(struct platform_device *pdev) -{ - led_classdev_unregister(&alix_led_1); - led_classdev_unregister(&alix_led_2); - led_classdev_unregister(&alix_led_3); - return 0; -} - -static struct platform_driver alix_led_driver = { - .probe = alix_led_probe, - .remove = alix_led_remove, - .suspend = alix_led_suspend, - .resume = alix_led_resume, - .driver = { - .name = DRVNAME, - .owner = THIS_MODULE, - }, -}; - -static int __init alix_led_init(void) -{ - int ret; - - ret = platform_driver_register(&alix_led_driver); - if (ret < 0) - goto out; - - pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); - if (IS_ERR(pdev)) { - ret = PTR_ERR(pdev); - platform_driver_unregister(&alix_led_driver); - goto out; - } - -out: - return ret; -} - -static void __exit alix_led_exit(void) -{ - platform_device_unregister(pdev); - platform_driver_unregister(&alix_led_driver); -} - -module_init(alix_led_init); -module_exit(alix_led_exit); - -MODULE_AUTHOR("Petr Liebman"); -MODULE_DESCRIPTION("PCEngines ALIX LED driver"); -MODULE_LICENSE("GPL"); - diff --git a/target/linux/generic-2.6/files-2.6.31/drivers/leds/leds-alix.c b/target/linux/generic-2.6/files-2.6.31/drivers/leds/leds-alix.c deleted file mode 100644 index 103ca7dfa..000000000 --- a/target/linux/generic-2.6/files-2.6.31/drivers/leds/leds-alix.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * LEDs driver for PCEngines ALIX 2/3 series - * - * Copyright (C) 2007 Petr Liebman - * - * Based on leds-wrap.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include - -#define DRVNAME "alix-led" - -#define ALIX_LED1_PORT (0x6100) -#define ALIX_LED1_ON (1<<22) -#define ALIX_LED1_OFF (1<<6) - -#define ALIX_LED2_PORT (0x6180) -#define ALIX_LED2_ON (1<<25) -#define ALIX_LED2_OFF (1<<9) - -#define ALIX_LED3_PORT (0x6180) -#define ALIX_LED3_ON (1<<27) -#define ALIX_LED3_OFF (1<<11) - - -static struct platform_device *pdev; - -static void alix_led_set_1(struct led_classdev *led_cdev, - enum led_brightness value) -{ - if (value) - outl(ALIX_LED1_ON, ALIX_LED1_PORT); - else - outl(ALIX_LED1_OFF, ALIX_LED1_PORT); -} - -static void alix_led_set_2(struct led_classdev *led_cdev, - enum led_brightness value) -{ - if (value) - outl(ALIX_LED2_ON, ALIX_LED2_PORT); - else - outl(ALIX_LED2_OFF, ALIX_LED2_PORT); -} - -static void alix_led_set_3(struct led_classdev *led_cdev, - enum led_brightness value) -{ - if (value) - outl(ALIX_LED3_ON, ALIX_LED3_PORT); - else - outl(ALIX_LED3_OFF, ALIX_LED3_PORT); -} - -static struct led_classdev alix_led_1 = { - .name = "alix:1", - .brightness_set = alix_led_set_1, -}; - -static struct led_classdev alix_led_2 = { - .name = "alix:2", - .brightness_set = alix_led_set_2, -}; - -static struct led_classdev alix_led_3 = { - .name = "alix:3", - .brightness_set = alix_led_set_3, -}; - - -#ifdef CONFIG_PM -static int alix_led_suspend(struct platform_device *dev, - pm_message_t state) -{ - led_classdev_suspend(&alix_led_1); - led_classdev_suspend(&alix_led_2); - led_classdev_suspend(&alix_led_3); - return 0; -} - -static int alix_led_resume(struct platform_device *dev) -{ - led_classdev_resume(&alix_led_1); - led_classdev_resume(&alix_led_2); - led_classdev_resume(&alix_led_3); - return 0; -} -#else -#define alix_led_suspend NULL -#define alix_led_resume NULL -#endif - -static int alix_led_probe(struct platform_device *pdev) -{ - int ret; - - ret = led_classdev_register(&pdev->dev, &alix_led_1); - if (ret >= 0) - { - ret = led_classdev_register(&pdev->dev, &alix_led_2); - if (ret >= 0) - { - ret = led_classdev_register(&pdev->dev, &alix_led_3); - if (ret < 0) - led_classdev_unregister(&alix_led_2); - } - if (ret < 0) - led_classdev_unregister(&alix_led_1); - } - return ret; -} - -static int alix_led_remove(struct platform_device *pdev) -{ - led_classdev_unregister(&alix_led_1); - led_classdev_unregister(&alix_led_2); - led_classdev_unregister(&alix_led_3); - return 0; -} - -static struct platform_driver alix_led_driver = { - .probe = alix_led_probe, - .remove = alix_led_remove, - .suspend = alix_led_suspend, - .resume = alix_led_resume, - .driver = { - .name = DRVNAME, - .owner = THIS_MODULE, - }, -}; - -static int __init alix_led_init(void) -{ - int ret; - - ret = platform_driver_register(&alix_led_driver); - if (ret < 0) - goto out; - - pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); - if (IS_ERR(pdev)) { - ret = PTR_ERR(pdev); - platform_driver_unregister(&alix_led_driver); - goto out; - } - -out: - return ret; -} - -static void __exit alix_led_exit(void) -{ - platform_device_unregister(pdev); - platform_driver_unregister(&alix_led_driver); -} - -module_init(alix_led_init); -module_exit(alix_led_exit); - -MODULE_AUTHOR("Petr Liebman"); -MODULE_DESCRIPTION("PCEngines ALIX LED driver"); -MODULE_LICENSE("GPL"); - diff --git a/target/linux/generic-2.6/files-2.6.32/drivers/leds/leds-alix.c b/target/linux/generic-2.6/files-2.6.32/drivers/leds/leds-alix.c deleted file mode 100644 index 103ca7dfa..000000000 --- a/target/linux/generic-2.6/files-2.6.32/drivers/leds/leds-alix.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * LEDs driver for PCEngines ALIX 2/3 series - * - * Copyright (C) 2007 Petr Liebman - * - * Based on leds-wrap.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include - -#define DRVNAME "alix-led" - -#define ALIX_LED1_PORT (0x6100) -#define ALIX_LED1_ON (1<<22) -#define ALIX_LED1_OFF (1<<6) - -#define ALIX_LED2_PORT (0x6180) -#define ALIX_LED2_ON (1<<25) -#define ALIX_LED2_OFF (1<<9) - -#define ALIX_LED3_PORT (0x6180) -#define ALIX_LED3_ON (1<<27) -#define ALIX_LED3_OFF (1<<11) - - -static struct platform_device *pdev; - -static void alix_led_set_1(struct led_classdev *led_cdev, - enum led_brightness value) -{ - if (value) - outl(ALIX_LED1_ON, ALIX_LED1_PORT); - else - outl(ALIX_LED1_OFF, ALIX_LED1_PORT); -} - -static void alix_led_set_2(struct led_classdev *led_cdev, - enum led_brightness value) -{ - if (value) - outl(ALIX_LED2_ON, ALIX_LED2_PORT); - else - outl(ALIX_LED2_OFF, ALIX_LED2_PORT); -} - -static void alix_led_set_3(struct led_classdev *led_cdev, - enum led_brightness value) -{ - if (value) - outl(ALIX_LED3_ON, ALIX_LED3_PORT); - else - outl(ALIX_LED3_OFF, ALIX_LED3_PORT); -} - -static struct led_classdev alix_led_1 = { - .name = "alix:1", - .brightness_set = alix_led_set_1, -}; - -static struct led_classdev alix_led_2 = { - .name = "alix:2", - .brightness_set = alix_led_set_2, -}; - -static struct led_classdev alix_led_3 = { - .name = "alix:3", - .brightness_set = alix_led_set_3, -}; - - -#ifdef CONFIG_PM -static int alix_led_suspend(struct platform_device *dev, - pm_message_t state) -{ - led_classdev_suspend(&alix_led_1); - led_classdev_suspend(&alix_led_2); - led_classdev_suspend(&alix_led_3); - return 0; -} - -static int alix_led_resume(struct platform_device *dev) -{ - led_classdev_resume(&alix_led_1); - led_classdev_resume(&alix_led_2); - led_classdev_resume(&alix_led_3); - return 0; -} -#else -#define alix_led_suspend NULL -#define alix_led_resume NULL -#endif - -static int alix_led_probe(struct platform_device *pdev) -{ - int ret; - - ret = led_classdev_register(&pdev->dev, &alix_led_1); - if (ret >= 0) - { - ret = led_classdev_register(&pdev->dev, &alix_led_2); - if (ret >= 0) - { - ret = led_classdev_register(&pdev->dev, &alix_led_3); - if (ret < 0) - led_classdev_unregister(&alix_led_2); - } - if (ret < 0) - led_classdev_unregister(&alix_led_1); - } - return ret; -} - -static int alix_led_remove(struct platform_device *pdev) -{ - led_classdev_unregister(&alix_led_1); - led_classdev_unregister(&alix_led_2); - led_classdev_unregister(&alix_led_3); - return 0; -} - -static struct platform_driver alix_led_driver = { - .probe = alix_led_probe, - .remove = alix_led_remove, - .suspend = alix_led_suspend, - .resume = alix_led_resume, - .driver = { - .name = DRVNAME, - .owner = THIS_MODULE, - }, -}; - -static int __init alix_led_init(void) -{ - int ret; - - ret = platform_driver_register(&alix_led_driver); - if (ret < 0) - goto out; - - pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); - if (IS_ERR(pdev)) { - ret = PTR_ERR(pdev); - platform_driver_unregister(&alix_led_driver); - goto out; - } - -out: - return ret; -} - -static void __exit alix_led_exit(void) -{ - platform_device_unregister(pdev); - platform_driver_unregister(&alix_led_driver); -} - -module_init(alix_led_init); -module_exit(alix_led_exit); - -MODULE_AUTHOR("Petr Liebman"); -MODULE_DESCRIPTION("PCEngines ALIX LED driver"); -MODULE_LICENSE("GPL"); - diff --git a/target/linux/generic-2.6/patches-2.6.25/401-led_alix.patch b/target/linux/generic-2.6/patches-2.6.25/401-led_alix.patch deleted file mode 100644 index b65dce85a..000000000 --- a/target/linux/generic-2.6/patches-2.6.25/401-led_alix.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/drivers/leds/Kconfig -+++ b/drivers/leds/Kconfig -@@ -79,6 +79,12 @@ config LEDS_WRAP - help - This option enables support for the PCEngines WRAP programmable LEDs. - -+config LEDS_ALIX -+ tristate "LED Support for the ALIX 2/3 boards" -+ depends on LEDS_CLASS -+ help -+ This option enables support for the three LEDs on the PCEngines ALIX 2/3 boards. -+ - config LEDS_H1940 - tristate "LED Support for iPAQ H1940 device" - depends on LEDS_CLASS && ARCH_H1940 ---- a/drivers/leds/Makefile -+++ b/drivers/leds/Makefile -@@ -14,6 +14,7 @@ obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c2 - obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o - obj-$(CONFIG_LEDS_NET48XX) += leds-net48xx.o - obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o -+obj-$(CONFIG_LEDS_ALIX) += leds-alix.o - obj-$(CONFIG_LEDS_H1940) += leds-h1940.o - obj-$(CONFIG_LEDS_COBALT_QUBE) += leds-cobalt-qube.o - obj-$(CONFIG_LEDS_COBALT_RAQ) += leds-cobalt-raq.o diff --git a/target/linux/generic-2.6/patches-2.6.25/402-ledtrig_default_on.patch b/target/linux/generic-2.6/patches-2.6.25/402-ledtrig_default_on.patch index 3697ff7fa..d20eb5eae 100644 --- a/target/linux/generic-2.6/patches-2.6.25/402-ledtrig_default_on.patch +++ b/target/linux/generic-2.6/patches-2.6.25/402-ledtrig_default_on.patch @@ -1,6 +1,6 @@ --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig -@@ -191,4 +191,11 @@ config LEDS_TRIGGER_MORSE +@@ -185,4 +185,11 @@ config LEDS_TRIGGER_MORSE tristate "LED Morse Trigger" depends on LEDS_TRIGGERS @@ -14,7 +14,7 @@ endif # NEW_LEDS --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile -@@ -28,3 +28,4 @@ obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledt +@@ -27,3 +27,4 @@ obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledt obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK) += ledtrig-ide-disk.o obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT) += ledtrig-heartbeat.o obj-$(CONFIG_LEDS_TRIGGER_MORSE) += ledtrig-morse.o diff --git a/target/linux/generic-2.6/patches-2.6.28/401-led_alix.patch b/target/linux/generic-2.6/patches-2.6.28/401-led_alix.patch deleted file mode 100644 index 1601ac0c9..000000000 --- a/target/linux/generic-2.6/patches-2.6.28/401-led_alix.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/drivers/leds/Kconfig -+++ b/drivers/leds/Kconfig -@@ -63,6 +63,12 @@ config LEDS_WRAP - help - This option enables support for the PCEngines WRAP programmable LEDs. - -+config LEDS_ALIX -+ tristate "LED Support for the ALIX 2/3 boards" -+ depends on LEDS_CLASS -+ help -+ This option enables support for the three LEDs on the PCEngines ALIX 2/3 boards. -+ - config LEDS_H1940 - tristate "LED Support for iPAQ H1940 device" - depends on LEDS_CLASS && ARCH_H1940 ---- a/drivers/leds/Makefile -+++ b/drivers/leds/Makefile -@@ -11,6 +11,7 @@ obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c2 - obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o - obj-$(CONFIG_LEDS_NET48XX) += leds-net48xx.o - obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o -+obj-$(CONFIG_LEDS_ALIX) += leds-alix.o - obj-$(CONFIG_LEDS_H1940) += leds-h1940.o - obj-$(CONFIG_LEDS_COBALT_QUBE) += leds-cobalt-qube.o - obj-$(CONFIG_LEDS_COBALT_RAQ) += leds-cobalt-raq.o diff --git a/target/linux/generic-2.6/patches-2.6.28/402-ledtrig_netdev.patch b/target/linux/generic-2.6/patches-2.6.28/402-ledtrig_netdev.patch index 06ea4ac20..105698013 100644 --- a/target/linux/generic-2.6/patches-2.6.28/402-ledtrig_netdev.patch +++ b/target/linux/generic-2.6/patches-2.6.28/402-ledtrig_netdev.patch @@ -1,6 +1,6 @@ --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig -@@ -227,4 +227,11 @@ config LEDS_TRIGGER_MORSE +@@ -221,4 +221,11 @@ config LEDS_TRIGGER_MORSE tristate "LED Morse Trigger" depends on LEDS_TRIGGERS @@ -14,7 +14,7 @@ endif # NEW_LEDS --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile -@@ -32,3 +32,4 @@ obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT) += +@@ -31,3 +31,4 @@ obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT) += obj-$(CONFIG_LEDS_TRIGGER_BACKLIGHT) += ledtrig-backlight.o obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o obj-$(CONFIG_LEDS_TRIGGER_MORSE) += ledtrig-morse.o From 0b7968af0202bda39b480e943d4467272596a32f Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 5 Nov 2009 21:25:31 +0000 Subject: [PATCH 100/288] uboot-ifxmips: fix compile errors with the cs toolchain due to non-PIC code git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18321 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches/110-compile_fix.patch | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 package/uboot-ifxmips/patches/110-compile_fix.patch diff --git a/package/uboot-ifxmips/patches/110-compile_fix.patch b/package/uboot-ifxmips/patches/110-compile_fix.patch new file mode 100644 index 000000000..34d0ac6e5 --- /dev/null +++ b/package/uboot-ifxmips/patches/110-compile_fix.patch @@ -0,0 +1,25 @@ +--- a/cpu/mips/Makefile ++++ b/cpu/mips/Makefile +@@ -36,6 +36,9 @@ START := $(addprefix $(obj),$(START)) + + all: $(obj).depend $(START) $(LIB) + ++start.o: start.S ++ $(CC) $(AFLAGS) -fPIC -c -o $@ $< ++ + $(LIB): $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +--- a/Makefile ++++ b/Makefile +@@ -185,8 +185,8 @@ include $(TOPDIR)/config.mk + OBJS = cpu/$(CPU)/start.o + OBJS_BOOTSTRAP = cpu/$(CPU)/start_bootstrap.o + +-cpu/$(CPU)/start_bootstrap.S: cpu/$(CPU)/start.S +- ln -s start.S cpu/$(CPU)/start_bootstrap.S ++cpu/$(CPU)/start_bootstrap.o: cpu/$(CPU)/start.S ++ $(CC) $(AFLAGS) -fPIC -DCFG_BOOTSTRAP_CODE -c -o $@ $< + + ifeq ($(CPU),i386) + OBJS += cpu/$(CPU)/start16.o From 69c0ee58e91049cead2cd5878b0fe132c3ea9fbb Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 5 Nov 2009 22:29:14 +0000 Subject: [PATCH 101/288] iproute2: compile the static libraries with $(FPIC), as they are reused by other packages for inclusion into shared libraries should fix collectd build failures on mips git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18323 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/iproute2/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/package/iproute2/Makefile b/package/iproute2/Makefile index b36b95bc9..a3b5f471c 100644 --- a/package/iproute2/Makefile +++ b/package/iproute2/Makefile @@ -51,9 +51,15 @@ define Build/Configure $(SED) "s, misc,," $(PKG_BUILD_DIR)/Makefile endef +MAKE_FLAGS += \ + EXTRA_CCOPTS="$(TARGET_CFLAGS)" \ + KERNEL_INCLUDE="$(LINUX_DIR)/include" \ + FPIC="$(FPIC)" \ + all tc/tc ip/ip + define Build/Compile $(MAKE) -C $(PKG_BUILD_DIR)/netem HOSTCC="$(HOSTCC)" EXTRA_CCOPTS="$(TARGET_CFLAGS)" CFLAGS="-D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -I ../include -DRESOLVE_HOSTNAMES" - $(MAKE) -C $(PKG_BUILD_DIR) $(TARGET_CONFIGURE_OPTS) EXTRA_CCOPTS="$(TARGET_CFLAGS)" KERNEL_INCLUDE=$(LINUX_DIR)/include all tc/tc ip/ip + $(Build/Compile/Default) endef define Build/InstallDev From 30d1329e802aab85af636daa4eaf6d81d3c66bc2 Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 5 Nov 2009 23:40:12 +0000 Subject: [PATCH 102/288] [rdc] strip down even more the kernel configuration git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18324 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/rdc/config-2.6.30 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/target/linux/rdc/config-2.6.30 b/target/linux/rdc/config-2.6.30 index ff48509ae..5c2a715e0 100644 --- a/target/linux/rdc/config-2.6.30 +++ b/target/linux/rdc/config-2.6.30 @@ -53,6 +53,7 @@ CONFIG_CMDLINE_BOOL=y # CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEBUG_FS is not set CONFIG_DECOMPRESS_GZIP=y +CONFIG_DECOMPRESS_LZMA=y CONFIG_DEFAULT_IO_DELAY_TYPE=0 # CONFIG_DELL_RBU is not set CONFIG_DEVPORT=y @@ -157,6 +158,9 @@ CONFIG_KERNEL_LZMA=y CONFIG_KTIME_SCALAR=y CONFIG_LBD=y # CONFIG_LEDS_ALIX2 is not set +# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set +# CONFIG_LEDS_TRIGGER_NETDEV is not set +# CONFIG_LEDS_TRIGGER_TIMER is not set # CONFIG_M386 is not set CONFIG_M486=y # CONFIG_M586 is not set @@ -165,7 +169,7 @@ CONFIG_M486=y # CONFIG_M686 is not set # CONFIG_MACHZ_WDT is not set # CONFIG_MACINTOSH_DRIVERS is not set -# CONFIG_MATH_EMULATION is not set +CONFIG_MATH_EMULATION=y # CONFIG_MCA is not set # CONFIG_MCORE2 is not set # CONFIG_MCRUSOE is not set @@ -206,7 +210,7 @@ CONFIG_MTD_RDC3210_SIZE=0x400000 CONFIG_NOHIGHMEM=y CONFIG_NR_CPUS=1 # CONFIG_NSC_GPIO is not set -CONFIG_NVRAM=y +# CONFIG_NVRAM is not set # CONFIG_OLPC is not set # CONFIG_OPTIMIZE_INLINING is not set CONFIG_PAGEFLAGS_EXTENDED=y @@ -232,7 +236,7 @@ CONFIG_PHYSICAL_START=0x100000 # CONFIG_POWER_TRACER is not set CONFIG_PROCESSOR_SELECT=y # CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set -CONFIG_RDC321X_WDT=y +CONFIG_RDC321X_WDT=m CONFIG_RD_GZIP=y # CONFIG_RD_LZMA is not set # CONFIG_RELOCATABLE is not set From 91681580d6d108aa1957ca9c459564cf54d3749a Mon Sep 17 00:00:00 2001 From: florian Date: Fri, 6 Nov 2009 08:42:41 +0000 Subject: [PATCH 103/288] [rdc] use host-side lzma decompression tool, lzma-4.32 from openwrt produces non-working bzImages, switch to 2.6.30, strip down kernel configuration git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18325 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/rdc/Makefile | 2 +- target/linux/rdc/config-2.6.30 | 5 ++--- target/linux/rdc/patches-2.6.30/011-use_host_lzma.patch | 8 ++++++++ 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 target/linux/rdc/patches-2.6.30/011-use_host_lzma.patch diff --git a/target/linux/rdc/Makefile b/target/linux/rdc/Makefile index 185b67a21..9936b687c 100644 --- a/target/linux/rdc/Makefile +++ b/target/linux/rdc/Makefile @@ -12,7 +12,7 @@ BOARDNAME:=RDC 321x FEATURES:=squashfs jffs2 pci usb CFLAGS:=-Os -pipe -march=i486 -funit-at-a-time -LINUX_VERSION:=2.6.28.10 +LINUX_VERSION:=2.6.30.9 include $(INCLUDE_DIR)/target.mk diff --git a/target/linux/rdc/config-2.6.30 b/target/linux/rdc/config-2.6.30 index 5c2a715e0..c83aaa5ae 100644 --- a/target/linux/rdc/config-2.6.30 +++ b/target/linux/rdc/config-2.6.30 @@ -60,8 +60,7 @@ CONFIG_DEVPORT=y # CONFIG_DMA_API_DEBUG is not set # CONFIG_DMI is not set CONFIG_DOUBLEFAULT=y -CONFIG_EARLY_PRINTK=y -# CONFIG_EARLY_PRINTK_DBGP is not set +# CONFIG_EARLY_PRINTK is not set # CONFIG_EDAC is not set # CONFIG_EDD is not set # CONFIG_EUROTECH_WDT is not set @@ -302,7 +301,7 @@ CONFIG_X86_RDC321X=y CONFIG_X86_REBOOTFIXUPS=y # CONFIG_X86_RESERVE_LOW_64K is not set # CONFIG_X86_UP_APIC is not set -CONFIG_X86_VERBOSE_BOOTUP=y +# CONFIG_X86_VERBOSE_BOOTUP is not set CONFIG_X86_WP_WORKS_OK=y CONFIG_X86_XADD=y # CONFIG_ZONE_DMA32 is not set diff --git a/target/linux/rdc/patches-2.6.30/011-use_host_lzma.patch b/target/linux/rdc/patches-2.6.30/011-use_host_lzma.patch new file mode 100644 index 000000000..5def7393f --- /dev/null +++ b/target/linux/rdc/patches-2.6.30/011-use_host_lzma.patch @@ -0,0 +1,8 @@ +--- a/scripts/Makefile.lib 2009-11-06 08:55:20.000000000 +0100 ++++ b/scripts/Makefile.lib 2009-11-06 09:08:45.000000000 +0100 +@@ -204,4 +204,4 @@ + # --------------------------------------------------------------------------- + + quiet_cmd_lzma = LZMA $@ +-cmd_lzma = lzma e $< $@ -lc1 -lp2 -pb2 -eos ++cmd_lzma = (/usr/bin/lzma -9 -c $< ; $(size_append) $<) >$@ || (rm -f $@ ; false) From 80bb9da84fa3724e61a6e4589cdaf458fbeabf4f Mon Sep 17 00:00:00 2001 From: florian Date: Fri, 6 Nov 2009 08:47:28 +0000 Subject: [PATCH 104/288] [rdc] add the prereq-check on lzma git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18326 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/rdc/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/linux/rdc/Makefile b/target/linux/rdc/Makefile index 9936b687c..0abff0039 100644 --- a/target/linux/rdc/Makefile +++ b/target/linux/rdc/Makefile @@ -24,3 +24,7 @@ define Target/Description endef $(eval $(call BuildTarget)) + +$(eval $(call RequireCommand,lzma, \ + Please install lzma-4.4x. \ +)) From 68323377400b38d226d2173798ee18023e8e55a6 Mon Sep 17 00:00:00 2001 From: florian Date: Fri, 6 Nov 2009 10:53:15 +0000 Subject: [PATCH 105/288] [rdc] provide the correct flash mapping on non airlink devices, remove the rootfs_type hacks, patch from sn9 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18327 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/rdc/config-2.6.30 | 10 ++---- .../arch/x86/mach-rdc321x/platform.c | 36 ++++++++++++++++--- .../rdc/patches-2.6.30/003-rootfstype.patch | 11 ------ 3 files changed, 34 insertions(+), 23 deletions(-) delete mode 100644 target/linux/rdc/patches-2.6.30/003-rootfstype.patch diff --git a/target/linux/rdc/config-2.6.30 b/target/linux/rdc/config-2.6.30 index c83aaa5ae..6dc046afe 100644 --- a/target/linux/rdc/config-2.6.30 +++ b/target/linux/rdc/config-2.6.30 @@ -35,7 +35,7 @@ CONFIG_BOUNCE=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y # CONFIG_CC_STACKPROTECTOR is not set CONFIG_CLOCKSOURCE_WATCHDOG=y -CONFIG_CMDLINE="console=ttyS0,38400" +CONFIG_CMDLINE="console=ttyS0,38400 rootfstype=squashfs,jffs2" CONFIG_CMDLINE_BOOL=y # CONFIG_CMDLINE_OVERRIDE is not set # CONFIG_COMPAT_NET_DEV_OPS is not set @@ -191,13 +191,9 @@ CONFIG_MODULE_FORCE_UNLOAD=y # CONFIG_MTD_CFI_INTELEXT is not set # CONFIG_MTD_COMPLEX_MAPPINGS is not set # CONFIG_MTD_NETSC520 is not set +CONFIG_MTD_PHYSMAP=y # CONFIG_MTD_R8610 is not set -CONFIG_MTD_RDC3210=y -CONFIG_MTD_RDC3210_ALLOW_JFFS2=y -CONFIG_MTD_RDC3210_BUSWIDTH=2 -# CONFIG_MTD_RDC3210_FACTORY_PRESENT is not set -CONFIG_MTD_RDC3210_SIZE=0x400000 -# CONFIG_MTD_RDC3210_STATIC_MAP is not set +# CONFIG_MTD_RDC3210 is not set # CONFIG_MTD_TS5500 is not set # CONFIG_MTRR is not set # CONFIG_MVIAC3_2 is not set diff --git a/target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/platform.c b/target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/platform.c index 9eb08c8dd..539399634 100644 --- a/target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/platform.c +++ b/target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/platform.c @@ -1,9 +1,9 @@ /* * Generic RDC321x platform devices * - * Copyright (C) 2007-2008 OpenWrt.org + * Copyright (C) 2007-2009 OpenWrt.org * Copyright (C) 2007 Florian Fainelli - * Copyright (C) 2008 Daniel Gimpelevich + * Copyright (C) 2008-2009 Daniel Gimpelevich * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -157,7 +157,7 @@ static int __init rdc_board_setup(void) { #ifndef CONFIG_MTD_RDC3210 struct map_info rdc_map_info; - u32 the_header[4]; + u32 the_header[8]; ROOT_DEV = 0; rdc_map_info.name = rdc_flash_device.name; @@ -181,10 +181,36 @@ static int __init rdc_board_setup(void) the_header[2] = ((u32 *)rdc_map_info.virt)[2]; the_header[3] = ((u32 *)rdc_map_info.virt)[3]; iounmap(rdc_map_info.virt); + rdc_map_info.virt = ioremap_nocache(rdc_map_info.phys + 0x8000, 0x10); + if (rdc_map_info.virt == NULL) + panic("Could not ioremap to read device magic!"); + the_header[4] = ((u32 *)rdc_map_info.virt)[0]; + the_header[5] = ((u32 *)rdc_map_info.virt)[1]; + the_header[6] = ((u32 *)rdc_map_info.virt)[2]; + the_header[7] = ((u32 *)rdc_map_info.virt)[3]; + iounmap(rdc_map_info.virt); if (!memcmp(the_header, "GMTK", 4)) { /* Gemtek */ /* TODO */ - } else if (!memcmp(the_header, "CSYS", 4)) { /* Sitecom */ - /* TODO */ + } else if (!memcmp(the_header + 4, "CSYS", 4)) { /* Sitecom */ + rdc_flash_parts[0].name = "system"; + rdc_flash_parts[0].offset = 0; + rdc_flash_parts[0].size = rdc_map_info.size - 0x10000; + rdc_flash_parts[1].name = "config"; + rdc_flash_parts[1].offset = 0; + rdc_flash_parts[1].size = 0x8000; + rdc_flash_parts[2].name = "magic"; + rdc_flash_parts[2].offset = 0x8000; + rdc_flash_parts[2].size = 0x14; + rdc_flash_parts[3].name = "kernel"; + rdc_flash_parts[3].offset = 0x8014; + rdc_flash_parts[3].size = the_header[5]; + rdc_flash_parts[4].name = "rootfs"; + rdc_flash_parts[4].offset = 0x8014 + the_header[5]; + rdc_flash_parts[4].size = rdc_flash_parts[0].size - rdc_flash_parts[4].offset; + rdc_flash_parts[5].name = "bootloader"; + rdc_flash_parts[5].offset = rdc_flash_parts[0].size; + rdc_flash_parts[5].size = 0x10000; + rdc_flash_data.nr_parts = 6; } else if (!memcmp(((u8 *)the_header) + 14, "Li", 2)) { /* AMIT */ rdc_flash_parts[0].name = "kernel_parthdr"; rdc_flash_parts[0].offset = 0; diff --git a/target/linux/rdc/patches-2.6.30/003-rootfstype.patch b/target/linux/rdc/patches-2.6.30/003-rootfstype.patch deleted file mode 100644 index e7ed527ca..000000000 --- a/target/linux/rdc/patches-2.6.30/003-rootfstype.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/init/do_mounts.c -+++ b/init/do_mounts.c -@@ -191,6 +191,8 @@ static void __init get_fs_names(char *pa - { - char *s = page; - -+ if (!root_fs_names) -+ root_fs_names = "squashfs,jffs2"; - if (root_fs_names) { - strcpy(page, root_fs_names); - while (*s++) { From b5b5bb874270fee1813197aad9453016a8f4d95d Mon Sep 17 00:00:00 2001 From: jow Date: Sat, 7 Nov 2009 00:09:53 +0000 Subject: [PATCH 106/288] [feeds] switch back to LuCI main repo git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18328 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- feeds.conf.default | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feeds.conf.default b/feeds.conf.default index 853dcadb4..511eb9b52 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,6 +1,6 @@ src-svn packages svn://svn.openwrt.org/openwrt/packages src-svn xwrt http://x-wrt.googlecode.com/svn/trunk/package -src-svn luci http://svn2.luci.freifunk-halle.net/luci/branches/luci-0.9/contrib/package +src-svn luci http://svn.luci.subsignal.org/luci/branches/luci-0.9/contrib/package #src-svn phone svn://svn.openwrt.org/openwrt/feeds/phone #src-svn efl svn://svn.openwrt.org/openwrt/feeds/efl #src-svn desktop svn://svn.openwrt.org/openwrt/feeds/desktop From bbd135050c78c9ae217a66f263d22fb3bf9ea99b Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 7 Nov 2009 12:16:31 +0000 Subject: [PATCH 107/288] [x86] the olpc config that was merged from the olpc port is a 2.6.30 config git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18332 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/x86/olpc/{config-default => config-2.6.30} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename target/linux/x86/olpc/{config-default => config-2.6.30} (100%) diff --git a/target/linux/x86/olpc/config-default b/target/linux/x86/olpc/config-2.6.30 similarity index 100% rename from target/linux/x86/olpc/config-default rename to target/linux/x86/olpc/config-2.6.30 From 90c331955e27db6451a576297b3ae055a7d7699f Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 7 Nov 2009 12:32:25 +0000 Subject: [PATCH 108/288] [x86] add olpc 2.6.31 configuration, forward port the block2mtd patch, refresh patches git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18333 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/x86/olpc/config-2.6.31 | 557 ++++++++++++++++++ .../patches-2.6.31/100-pata_sc1200-wrap.patch | 8 +- .../patches-2.6.31/300-block2mtd_init.patch | 186 ++++++ 3 files changed, 746 insertions(+), 5 deletions(-) create mode 100644 target/linux/x86/olpc/config-2.6.31 create mode 100644 target/linux/x86/patches-2.6.31/300-block2mtd_init.patch diff --git a/target/linux/x86/olpc/config-2.6.31 b/target/linux/x86/olpc/config-2.6.31 new file mode 100644 index 000000000..54f037ae0 --- /dev/null +++ b/target/linux/x86/olpc/config-2.6.31 @@ -0,0 +1,557 @@ +CONFIG_4KSTACKS=y +# CONFIG_64BIT is not set +CONFIG_ACPI=y +CONFIG_ACPI_AC=y +# CONFIG_ACPI_ASUS is not set +CONFIG_ACPI_BATTERY=y +CONFIG_ACPI_BLACKLIST_YEAR=0 +CONFIG_ACPI_BUTTON=y +# CONFIG_ACPI_CONTAINER is not set +# CONFIG_ACPI_CUSTOM_DSDT is not set +# CONFIG_ACPI_DEBUG is not set +# CONFIG_ACPI_DOCK is not set +CONFIG_ACPI_FAN=y +# CONFIG_ACPI_PCI_SLOT is not set +CONFIG_ACPI_PROCESSOR=y +# CONFIG_ACPI_PROCFS is not set +CONFIG_ACPI_PROCFS_POWER=y +CONFIG_ACPI_PROC_EVENT=y +# CONFIG_ACPI_SBS is not set +CONFIG_ACPI_SLEEP=y +CONFIG_ACPI_SYSFS_POWER=y +CONFIG_ACPI_THERMAL=y +# CONFIG_ACPI_TOSHIBA is not set +# CONFIG_ACPI_WMI is not set +# CONFIG_AGP is not set +# CONFIG_APM is not set +CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" +CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y +CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y +CONFIG_ARCH_HAS_CPU_RELAX=y +CONFIG_ARCH_HAS_DEFAULT_IDLE=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_MAY_HAVE_PC_FDC=y +# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set +CONFIG_ARCH_POPULATES_NODE_MAP=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y +CONFIG_ARCH_SUPPORTS_MSI=y +CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_WANT_FRAME_POINTERS=y +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +# CONFIG_ASUS_LAPTOP is not set +CONFIG_ATA=y +CONFIG_ATA_GENERIC=y +# CONFIG_ATA_NONSTANDARD is not set +CONFIG_ATA_PIIX=y +# CONFIG_AUDIT_ARCH is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +CONFIG_BACKLIGHT_GENERIC=y +CONFIG_BACKLIGHT_LCD_SUPPORT=y +# CONFIG_BACKLIGHT_MBP_NVIDIA is not set +# CONFIG_BACKLIGHT_PROGEAR is not set +# CONFIG_BACKLIGHT_SAHARA is not set +# CONFIG_BACKTRACE_SELF_TEST is not set +CONFIG_BASE_SMALL=0 +CONFIG_BATTERY_OLPC=y +CONFIG_BINARY_PRINTF=y +CONFIG_BINFMT_MISC=y +CONFIG_BITREVERSE=y +# CONFIG_BLK_DEV is not set +CONFIG_BLK_DEV_SD=y +CONFIG_BLK_DEV_SR=y +CONFIG_BLK_DEV_SR_VENDOR=y +# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set +CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 +# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set +CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 +# CONFIG_BOOT_PRINTK_DELAY is not set +CONFIG_BOUNCE=y +CONFIG_CAN_PM_TRACE=y +# CONFIG_CC_STACKPROTECTOR is not set +CONFIG_CHR_DEV_SG=y +CONFIG_CLOCKSOURCE_WATCHDOG=y +# CONFIG_CMDLINE_BOOL is not set +# CONFIG_COMPAL_LAPTOP is not set +CONFIG_COMPAT_VDSO=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_CONTEXT_SWITCH_TRACER=y +# CONFIG_CPA_DEBUG is not set +CONFIG_CPU_FREQ=y +# CONFIG_CPU_FREQ_DEBUG is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set +# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set +# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_GOV_USERSPACE is not set +CONFIG_CPU_FREQ_STAT=y +# CONFIG_CPU_FREQ_STAT_DETAILS is not set +CONFIG_CPU_FREQ_TABLE=y +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_LADDER=y +CONFIG_CPU_IDLE_GOV_MENU=y +CONFIG_CPU_SUP_AMD=y +CONFIG_CPU_SUP_CENTAUR=y +CONFIG_CPU_SUP_CYRIX_32=y +CONFIG_CPU_SUP_INTEL=y +CONFIG_CPU_SUP_TRANSMETA_32=y +CONFIG_CPU_SUP_UMC_32=y +# CONFIG_CS5535_GPIO is not set +# CONFIG_DCDBAS is not set +# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +# CONFIG_DEBUG_BOOT_PARAMS is not set +CONFIG_DEBUG_BUGVERBOSE=y +# CONFIG_DEBUG_DEVRES is not set +# CONFIG_DEBUG_DRIVER is not set +# CONFIG_DEBUG_INFO is not set +CONFIG_DEBUG_KERNEL=y +# CONFIG_DEBUG_KMEMLEAK is not set +# CONFIG_DEBUG_KOBJECT is not set +# CONFIG_DEBUG_LIST is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +CONFIG_DEBUG_MEMORY_INIT=y +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_NOTIFIERS is not set +# CONFIG_DEBUG_NX_TEST is not set +# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_DEBUG_PAGEALLOC is not set +# CONFIG_DEBUG_RODATA is not set +# CONFIG_DEBUG_RT_MUTEXES is not set +# CONFIG_DEBUG_SG is not set +# CONFIG_DEBUG_SHIRQ is not set +# CONFIG_DEBUG_SPINLOCK is not set +# CONFIG_DEBUG_SPINLOCK_SLEEP is not set +# CONFIG_DEBUG_STACKOVERFLOW is not set +# CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_DEBUG_VIRTUAL is not set +# CONFIG_DEBUG_VM is not set +# CONFIG_DEBUG_WRITECOUNT is not set +CONFIG_DECOMPRESS_BZIP2=y +CONFIG_DECOMPRESS_GZIP=y +CONFIG_DECOMPRESS_LZMA=y +CONFIG_DEFAULT_IO_DELAY_TYPE=0 +# CONFIG_DELL_RBU is not set +CONFIG_DETECT_HUNG_TASK=y +CONFIG_DETECT_SOFTLOCKUP=y +CONFIG_DEVPORT=y +CONFIG_DISPLAY_SUPPORT=y +# CONFIG_DMA_API_DEBUG is not set +CONFIG_DMI=y +CONFIG_DMIID=y +CONFIG_DNOTIFY=y +CONFIG_DOUBLEFAULT=y +CONFIG_DUMMY_CONSOLE=y +CONFIG_EARLY_PRINTK=y +# CONFIG_EARLY_PRINTK_DBGP is not set +# CONFIG_EDAC is not set +# CONFIG_EDD is not set +# CONFIG_EFI is not set +CONFIG_ELF_CORE=y +# CONFIG_EMBEDDED is not set +CONFIG_EVENT_PROFILE=y +CONFIG_EVENT_TRACING=y +CONFIG_EXT2_FS=y +CONFIG_FAST_CMPXCHG_LOCAL=y +# CONFIG_FAULT_INJECTION is not set +CONFIG_FB=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB_GEODE=y +# CONFIG_FB_GEODE_GX is not set +# CONFIG_FB_GEODE_GX1 is not set +CONFIG_FB_GEODE_LX=y +# CONFIG_FB_HGA is not set +# CONFIG_FB_LE80578 is not set +# CONFIG_FB_N411 is not set +# CONFIG_FB_UDL is not set +# CONFIG_FB_VESA is not set +# CONFIG_FIRMWARE_EDID is not set +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_FIRMWARE_MEMMAP=y +CONFIG_FIX_EARLYCON_MEM=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x16=y +CONFIG_FONT_8x8=y +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y +# CONFIG_FRAME_POINTER is not set +CONFIG_FREEZER=y +# CONFIG_FUJITSU_LAPTOP is not set +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CMOS_UPDATE=y +# CONFIG_GENERIC_CPU is not set +CONFIG_GENERIC_FIND_FIRST_BIT=y +CONFIG_GENERIC_FIND_LAST_BIT=y +CONFIG_GENERIC_FIND_NEXT_BIT=y +CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y +CONFIG_GENERIC_IOMAP=y +CONFIG_GENERIC_ISA_DMA=y +# CONFIG_GENERIC_TIME_VSYSCALL is not set +CONFIG_GEODE_MFGPT_TIMER=y +# CONFIG_HAMRADIO is not set +# CONFIG_HANGCHECK_TIMER is not set +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +CONFIG_HAVE_AOUT=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_KMEMCHECK=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_ATOMIC_IOMAP=y +# CONFIG_HAVE_CPUMASK_OF_CPU_MAP is not set +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_DYNAMIC_PER_CPU_AREA=y +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FTRACE_SYSCALLS=y +CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_IDE=y +CONFIG_HAVE_IOREMAP_PROT=y +CONFIG_HAVE_KERNEL_BZIP2=y +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_KVM=y +CONFIG_HAVE_KVM_IRQCHIP=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_HAVE_MMIOTRACE_SUPPORT=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_PERF_COUNTERS=y +CONFIG_HAVE_SETUP_PER_CPU_AREA=y +CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y +CONFIG_HIBERNATION=y +CONFIG_HIBERNATION_NVS=y +CONFIG_HID=y +CONFIG_HID_SUPPORT=y +# CONFIG_HIGHMEM4G is not set +# CONFIG_HIGHMEM64G is not set +# CONFIG_HIGH_RES_TIMERS is not set +# CONFIG_HPET is not set +CONFIG_HPET_EMULATE_RTC=y +CONFIG_HPET_TIMER=y +CONFIG_HT_IRQ=y +# CONFIG_HUGETLBFS is not set +CONFIG_HW_CONSOLE=y +CONFIG_HW_RANDOM=y +CONFIG_HW_RANDOM_GEODE=y +CONFIG_HW_RANDOM_VIA=y +# CONFIG_I2C is not set +# CONFIG_I8K is not set +# CONFIG_IMA is not set +CONFIG_INITRAMFS_SOURCE="" +CONFIG_INPUT=y +CONFIG_INPUT_EVDEV=y +CONFIG_INPUT_KEYBOARD=y +CONFIG_INPUT_MOUSE=y +CONFIG_INPUT_MOUSEDEV=y +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1200 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=900 +# CONFIG_INPUT_YEALINK is not set +# CONFIG_INTEL_MENLOW is not set +# CONFIG_IOMMU_API is not set +# CONFIG_IOMMU_HELPER is not set +# CONFIG_IOMMU_STRESS is not set +CONFIG_IO_DELAY_0X80=y +# CONFIG_IO_DELAY_0XED is not set +# CONFIG_IO_DELAY_NONE is not set +CONFIG_IO_DELAY_TYPE_0X80=0 +CONFIG_IO_DELAY_TYPE_0XED=1 +CONFIG_IO_DELAY_TYPE_NONE=3 +CONFIG_IO_DELAY_TYPE_UDELAY=2 +# CONFIG_IO_DELAY_UDELAY is not set +# CONFIG_ISA is not set +CONFIG_ISA_DMA_API=y +# CONFIG_ISCSI_IBFT_FIND is not set +# CONFIG_ISDN is not set +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +# CONFIG_KERNEL_BZIP2 is not set +CONFIG_KERNEL_GZIP=y +# CONFIG_KERNEL_LZMA is not set +CONFIG_KEXEC=y +# CONFIG_KEXEC_JUMP is not set +CONFIG_KEYBOARD_ATKBD=y +# CONFIG_KEYBOARD_LKKBD is not set +# CONFIG_KEYBOARD_NEWTON is not set +# CONFIG_KEYBOARD_STOWAWAY is not set +# CONFIG_KEYBOARD_SUNKBD is not set +# CONFIG_KEYBOARD_XTKBD is not set +# CONFIG_KGDB is not set +CONFIG_KTIME_SCALAR=y +CONFIG_LCD_CLASS_DEVICE=y +# CONFIG_LCD_ILI9320 is not set +# CONFIG_LCD_PLATFORM is not set +# CONFIG_LEDS_ALIX2 is not set +# CONFIG_LEDS_CLEVO_MAIL is not set +# CONFIG_LOCK_STAT is not set +# CONFIG_LOGO is not set +# CONFIG_M386 is not set +# CONFIG_M486 is not set +# CONFIG_M586 is not set +# CONFIG_M586MMX is not set +# CONFIG_M586TSC is not set +# CONFIG_M686 is not set +CONFIG_MAC80211_DEFAULT_PS_VALUE=0 +# CONFIG_MACINTOSH_DRIVERS is not set +CONFIG_MARKERS=y +# CONFIG_MATH_EMULATION is not set +# CONFIG_MCA is not set +# CONFIG_MCORE2 is not set +# CONFIG_MCRUSOE is not set +# CONFIG_MCYRIXIII is not set +# CONFIG_MEFFICEON is not set +# CONFIG_MEMTEST is not set +# CONFIG_MGEODEGX1 is not set +CONFIG_MGEODE_LX=y +# CONFIG_MICROCODE is not set +# CONFIG_MISC_DEVICES is not set +# CONFIG_MK6 is not set +# CONFIG_MK7 is not set +# CONFIG_MK8 is not set +CONFIG_MMC=y +CONFIG_MMC_BLOCK=y +CONFIG_MMC_SDHCI=y +# CONFIG_MMC_SDHCI_PCI is not set +# CONFIG_MMC_SDHCI_PLTFM is not set +# CONFIG_MMC_TIFM_SD is not set +# CONFIG_MMC_WBSD is not set +# CONFIG_MOUSE_BCM5974 is not set +CONFIG_MOUSE_PS2=y +CONFIG_MOUSE_PS2_ALPS=y +# CONFIG_MOUSE_PS2_ELANTECH is not set +CONFIG_MOUSE_PS2_LIFEBOOK=y +CONFIG_MOUSE_PS2_LOGIPS2PP=y +CONFIG_MOUSE_PS2_OLPC=y +CONFIG_MOUSE_PS2_SYNAPTICS=y +# CONFIG_MOUSE_PS2_TOUCHKIT is not set +CONFIG_MOUSE_PS2_TRACKPOINT=y +# CONFIG_MOUSE_SERIAL is not set +# CONFIG_MOUSE_VSXXXAA is not set +# CONFIG_MPENTIUM4 is not set +# CONFIG_MPENTIUMII is not set +# CONFIG_MPENTIUMIII is not set +# CONFIG_MPENTIUMM is not set +# CONFIG_MPSC is not set +# CONFIG_MSI_LAPTOP is not set +CONFIG_MTD_BLOCK2MTD=y +# CONFIG_MTD_CFI is not set +CONFIG_MTD_CMDLINE_PARTS=y +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +# CONFIG_MTD_TS5500 is not set +# CONFIG_MTRR is not set +# CONFIG_MVIAC3_2 is not set +# CONFIG_MVIAC7 is not set +# CONFIG_MWINCHIP3D is not set +# CONFIG_MWINCHIPC6 is not set +CONFIG_NAMESPACES=y +# CONFIG_NETDEV_1000 is not set +# CONFIG_NETWORK_FILESYSTEMS is not set +# CONFIG_NET_DROP_MONITOR is not set +# CONFIG_NET_ETHERNET is not set +# CONFIG_NET_NS is not set +CONFIG_NLS=y +CONFIG_NOHIGHMEM=y +CONFIG_NOP_TRACER=y +CONFIG_NO_HZ=y +CONFIG_NR_CPUS=1 +# CONFIG_NSC_GPIO is not set +CONFIG_NVRAM=y +CONFIG_OLPC=y +CONFIG_OPROFILE=y +# CONFIG_OPTIMIZE_INLINING is not set +CONFIG_OUTPUT_FORMAT="elf32-i386" +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PAGE_OFFSET=0xC0000000 +# CONFIG_PANASONIC_LAPTOP is not set +# CONFIG_PARAVIRT_GUEST is not set +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_PATA_AMD=y +CONFIG_PATA_MPIIX=y +CONFIG_PATA_OLDPIIX=y +CONFIG_PATA_SC1200=y +CONFIG_PATA_VIA=y +# CONFIG_PC8736x_GPIO is not set +CONFIG_PCI=y +# CONFIG_PCIEPORTBUS is not set +# CONFIG_PCI_DEBUG is not set +CONFIG_PCI_DIRECT=y +CONFIG_PCI_DOMAINS=y +# CONFIG_PCI_GOANY is not set +# CONFIG_PCI_GOBIOS is not set +# CONFIG_PCI_GODIRECT is not set +# CONFIG_PCI_GOMMCONFIG is not set +CONFIG_PCI_GOOLPC=y +CONFIG_PCI_OLPC=y +CONFIG_PCSPKR_PLATFORM=y +# CONFIG_PDA_POWER is not set +CONFIG_PERF_COUNTERS=y +CONFIG_PHYSICAL_ALIGN=0x100000 +CONFIG_PHYSICAL_START=0x1000000 +CONFIG_PM=y +CONFIG_PM_DEBUG=y +CONFIG_PM_SLEEP=y +CONFIG_PM_STD_PARTITION="" +# CONFIG_PM_TRACE_RTC is not set +# CONFIG_PM_VERBOSE is not set +CONFIG_PNP=y +CONFIG_PNPACPI=y +CONFIG_PNP_DEBUG_MESSAGES=y +CONFIG_POWER_SUPPLY=y +# CONFIG_POWER_SUPPLY_DEBUG is not set +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_VOLUNTARY=y +CONFIG_PROC_PAGE_MONITOR=y +CONFIG_PROFILING=y +# CONFIG_PROVE_LOCKING is not set +# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set +# CONFIG_RCU_TORTURE_TEST is not set +CONFIG_RD_BZIP2=y +CONFIG_RD_GZIP=y +CONFIG_RELAY=y +# CONFIG_RELOCATABLE is not set +CONFIG_RING_BUFFER=y +CONFIG_RTC=y +# CONFIG_RT_MUTEX_TESTER is not set +# CONFIG_RWSEM_GENERIC_SPINLOCK is not set +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_SCHEDSTATS=y +CONFIG_SCHED_DEBUG=y +# CONFIG_SCHED_HRTICK is not set +CONFIG_SCHED_OMIT_FRAME_POINTER=y +CONFIG_SCSI=y +# CONFIG_SCSI_LOWLEVEL is not set +# CONFIG_SCx200 is not set +# CONFIG_SDIO_UART is not set +# CONFIG_SERIAL_8250_EXTENDED is not set +CONFIG_SERIAL_8250_PCI=y +CONFIG_SERIAL_8250_PNP=y +CONFIG_SERIO=y +# CONFIG_SERIO_CT82C710 is not set +CONFIG_SERIO_I8042=y +CONFIG_SERIO_LIBPS2=y +# CONFIG_SERIO_PCIPS2 is not set +# CONFIG_SERIO_RAW is not set +CONFIG_SERIO_SERPORT=y +# CONFIG_SLAB is not set +CONFIG_SLUB=y +CONFIG_SLUB_DEBUG=y +# CONFIG_SLUB_DEBUG_ON is not set +# CONFIG_SLUB_STATS is not set +# CONFIG_SMP is not set +CONFIG_SPARSEMEM_STATIC=y +# CONFIG_SPARSE_IRQ is not set +CONFIG_STACKTRACE=y +CONFIG_STRICT_DEVMEM=y +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +# CONFIG_TC1100_WMI is not set +# CONFIG_TELCLOCK is not set +CONFIG_THERMAL=y +# CONFIG_THINKPAD_ACPI is not set +CONFIG_TICK_ONESHOT=y +CONFIG_TIMER_STATS=y +# CONFIG_TOSHIBA is not set +CONFIG_TRACEPOINTS=y +CONFIG_TRACING=y +CONFIG_UID16=y +CONFIG_USB=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_TT_NEWSCHED=y +# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set +# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set +CONFIG_USB_OHCI_HCD=y +CONFIG_USB_STORAGE=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_SUSPEND=y +CONFIG_USB_UHCI_HCD=y +# CONFIG_USER_NS is not set +CONFIG_USER_STACKTRACE_SUPPORT=y +CONFIG_VGACON_SOFT_SCROLLBACK=y +CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=64 +CONFIG_VGA_CONSOLE=y +CONFIG_VM86=y +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +# CONFIG_VT_HW_CONSOLE_BINDING is not set +# CONFIG_WATCHDOG is not set +CONFIG_X86=y +CONFIG_X86_32=y +CONFIG_X86_32_LAZY_GS=y +# CONFIG_X86_64 is not set +# CONFIG_X86_ACPI_CPUFREQ is not set +# CONFIG_X86_ANCIENT_MCE is not set +CONFIG_X86_BSWAP=y +# CONFIG_X86_CHECK_BIOS_CORRUPTION is not set +CONFIG_X86_CMPXCHG=y +CONFIG_X86_CPU=y +# CONFIG_X86_CPUFREQ_NFORCE2 is not set +# CONFIG_X86_CPUID is not set +# CONFIG_X86_CPU_DEBUG is not set +CONFIG_X86_DEBUGCTLMSR=y +# CONFIG_X86_DS is not set +# CONFIG_X86_ELAN is not set +CONFIG_X86_EXTENDED_PLATFORM=y +# CONFIG_X86_E_POWERSAVER is not set +CONFIG_X86_GENERIC=y +# CONFIG_X86_GX_SUSPMOD is not set +CONFIG_X86_INTEL_USERCOPY=y +CONFIG_X86_INTERNODE_CACHE_BYTES=64 +CONFIG_X86_INVLPG=y +CONFIG_X86_IO_APIC=y +CONFIG_X86_L1_CACHE_BYTES=64 +CONFIG_X86_L1_CACHE_SHIFT=5 +CONFIG_X86_LOCAL_APIC=y +# CONFIG_X86_LONGHAUL is not set +# CONFIG_X86_LONGRUN is not set +# CONFIG_X86_MCE is not set +CONFIG_X86_MINIMUM_CPU_FAMILY=4 +CONFIG_X86_MPPARSE=y +# CONFIG_X86_MSR is not set +# CONFIG_X86_P4_CLOCKMOD is not set +# CONFIG_X86_PAE is not set +CONFIG_X86_PLATFORM_DEVICES=y +CONFIG_X86_PM_TIMER=y +CONFIG_X86_POPAD_OK=y +# CONFIG_X86_POWERNOW_K6 is not set +# CONFIG_X86_POWERNOW_K7 is not set +# CONFIG_X86_POWERNOW_K8 is not set +# CONFIG_X86_PTDUMP is not set +# CONFIG_X86_RDC321X is not set +# CONFIG_X86_REBOOTFIXUPS is not set +# CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS is not set +# CONFIG_X86_RESERVE_LOW_64K is not set +# CONFIG_X86_SPEEDSTEP_CENTRINO is not set +# CONFIG_X86_SPEEDSTEP_ICH is not set +# CONFIG_X86_SPEEDSTEP_LIB is not set +# CONFIG_X86_SPEEDSTEP_SMI is not set +CONFIG_X86_TSC=y +CONFIG_X86_UP_APIC=y +CONFIG_X86_UP_IOAPIC=y +CONFIG_X86_USE_3DNOW=y +CONFIG_X86_USE_PPRO_CHECKSUM=y +CONFIG_X86_VERBOSE_BOOTUP=y +CONFIG_X86_WP_WORKS_OK=y +CONFIG_X86_XADD=y +# CONFIG_ZONE_DMA32 is not set diff --git a/target/linux/x86/patches-2.6.31/100-pata_sc1200-wrap.patch b/target/linux/x86/patches-2.6.31/100-pata_sc1200-wrap.patch index edd925fbe..066694b35 100644 --- a/target/linux/x86/patches-2.6.31/100-pata_sc1200-wrap.patch +++ b/target/linux/x86/patches-2.6.31/100-pata_sc1200-wrap.patch @@ -1,8 +1,6 @@ -Index: linux-2.6.31.5/drivers/ata/pata_sc1200.c -=================================================================== ---- linux-2.6.31.5.orig/drivers/ata/pata_sc1200.c 2009-10-23 00:57:56.000000000 +0200 -+++ linux-2.6.31.5/drivers/ata/pata_sc1200.c 2009-10-23 12:45:54.000000000 +0200 -@@ -236,7 +236,7 @@ +--- a/drivers/ata/pata_sc1200.c ++++ b/drivers/ata/pata_sc1200.c +@@ -236,7 +236,7 @@ static int sc1200_init_one(struct pci_de .port_ops = &sc1200_port_ops }; /* Can't enable port 2 yet, see top comments */ diff --git a/target/linux/x86/patches-2.6.31/300-block2mtd_init.patch b/target/linux/x86/patches-2.6.31/300-block2mtd_init.patch new file mode 100644 index 000000000..8458eef77 --- /dev/null +++ b/target/linux/x86/patches-2.6.31/300-block2mtd_init.patch @@ -0,0 +1,186 @@ +--- a/drivers/mtd/devices/block2mtd.c ++++ b/drivers/mtd/devices/block2mtd.c +@@ -18,10 +18,18 @@ + #include + #include + #include ++#include ++#include + + #define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args) + #define INFO(fmt, args...) printk(KERN_INFO "block2mtd: " fmt "\n" , ## args) + ++struct retry { ++ struct list_head list; ++ const char *val; ++}; ++ ++static LIST_HEAD(retry_list); + + /* Info for the block device */ + struct block2mtd_dev { +@@ -33,10 +41,34 @@ struct block2mtd_dev { + char devname[0]; + }; + ++static int block2mtd_setup2(const char *val); + + /* Static info about the MTD, used in cleanup_module */ + static LIST_HEAD(blkmtd_device_list); + ++static int add_retry(const char *val) { ++ struct retry *r = kmalloc(sizeof(struct retry), GFP_KERNEL); ++ ++ INIT_LIST_HEAD(&r->list); ++ r->val = val; ++ list_add(&r->list, &retry_list); ++ ++ return 0; ++} ++ ++static int __init process_retries(void) { ++ struct list_head *p, *tmp; ++ ++ list_for_each_safe(p, tmp, &retry_list) { ++ struct retry *r = list_entry(p, struct retry, list); ++ block2mtd_setup2(r->val); ++ msleep(100); ++ list_del(p); ++ kfree(r); ++ } ++ return 0; ++} ++rootfs_initcall(process_retries); + + static struct page *page_read(struct address_space *mapping, int index) + { +@@ -511,7 +543,9 @@ static int block2mtd_setup2(const char * + if (token[2] && (strlen(token[2]) + 1 > 80)) + parse_err("mtd device name too long"); + +- add_device(name, erase_size, token[2]); ++ if (add_device(name, erase_size, token[2]) == NULL) { ++ add_retry(val); ++ } + + return 0; + } +--- a/include/asm-generic/vmlinux.lds.h ++++ b/include/asm-generic/vmlinux.lds.h +@@ -622,12 +622,14 @@ + *(.initcall4s.init) \ + *(.initcall5.init) \ + *(.initcall5s.init) \ +- *(.initcallrootfs.init) \ + *(.initcall6.init) \ + *(.initcall6s.init) \ + *(.initcall7.init) \ + *(.initcall7s.init) + ++#define INITCALLS_ROOT \ ++ *(.initcallrootfs.init) ++ + #define INIT_CALLS \ + VMLINUX_SYMBOL(__initcall_start) = .; \ + INITCALLS \ +--- a/init/do_mounts.c ++++ b/init/do_mounts.c +@@ -176,16 +176,8 @@ static int __init fs_names_setup(char *s + return 1; + } + +-static unsigned int __initdata root_delay; +-static int __init root_delay_setup(char *str) +-{ +- root_delay = simple_strtoul(str, NULL, 0); +- return 1; +-} +- + __setup("rootflags=", root_data_setup); + __setup("rootfstype=", fs_names_setup); +-__setup("rootdelay=", root_delay_setup); + + static void __init get_fs_names(char *page) + { +@@ -366,23 +358,6 @@ void __init prepare_namespace(void) + { + int is_floppy; + +- if (root_delay) { +- printk(KERN_INFO "Waiting %dsec before mounting root device...\n", +- root_delay); +- ssleep(root_delay); +- } +- +- /* +- * wait for the known devices to complete their probing +- * +- * Note: this is a potential source of long boot delays. +- * For example, it is not atypical to wait 5 seconds here +- * for the touchpad of a laptop to initialize. +- */ +- wait_for_device_probe(); +- +- md_run_setup(); +- + if (saved_root_name[0]) { + root_device_name = saved_root_name; + if (!strncmp(root_device_name, "mtd", 3) || +--- a/init/main.c ++++ b/init/main.c +@@ -79,6 +79,7 @@ + #ifdef CONFIG_X86_LOCAL_APIC + #include + #endif ++#include "do_mounts.h" + + static int kernel_init(void *); + +@@ -784,12 +785,13 @@ int do_one_initcall(initcall_t fn) + + + extern initcall_t __initcall_start[], __initcall_end[], __early_initcall_end[]; ++extern initcall_t __root_initcall_start[], __root_initcall_end[]; + +-static void __init do_initcalls(void) ++static void __init do_initcalls(initcall_t *start, initcall_t *end) + { + initcall_t *call; + +- for (call = __early_initcall_end; call < __initcall_end; call++) ++ for (call = start; call < end; call++) + do_one_initcall(*call); + + /* Make sure there is no pending stuff from the initcall sequence */ +@@ -873,6 +875,13 @@ static noinline int init_post(void) + panic("No init found. Try passing init= option to kernel."); + } + ++static unsigned int __initdata root_delay; ++static int __init root_delay_setup(char *str) ++{ ++ root_delay = simple_strtoul(str, NULL, 0); ++ return 1; ++} ++__setup("rootdelay=", root_delay_setup); + static int __init kernel_init(void * unused) + { + lock_kernel(); +@@ -917,7 +926,16 @@ static int __init kernel_init(void * unu + + if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) { + ramdisk_execute_command = NULL; +- prepare_namespace(); ++ if (root_delay) { ++ printk(KERN_INFO "Waiting %desc before mounting root device...\n", ++ root_delay); ++ ssleep(root_delay); ++ } ++ while (driver_probe_done() != 0) ++ msleep(100); ++ md_run_setup(); ++ do_initcalls(__root_initcall_start, __root_initcall_end); ++ prepare_namespace(); + } + + /* From a8a51aaf290d9bb58af3331c4fc56267fcff5c5b Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 7 Nov 2009 12:45:41 +0000 Subject: [PATCH 109/288] [kernel] refresh 2.6.31 patches git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18334 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches-2.6.31/032-mips_vmlinux_lds.patch | 12 +++++------- .../082-mtd_info_move_forward_decl.patch | 6 +++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/target/linux/generic-2.6/patches-2.6.31/032-mips_vmlinux_lds.patch b/target/linux/generic-2.6/patches-2.6.31/032-mips_vmlinux_lds.patch index cfe2a4d6c..2ecf89dde 100644 --- a/target/linux/generic-2.6/patches-2.6.31/032-mips_vmlinux_lds.patch +++ b/target/linux/generic-2.6/patches-2.6.31/032-mips_vmlinux_lds.patch @@ -1,6 +1,5 @@ -diff -Nru linux-2.6.31.5/arch/mips/kernel/Makefile linux-2.6.31.5.new/arch/mips/kernel/Makefile ---- linux-2.6.31.5/arch/mips/kernel/Makefile 2009-10-25 12:35:46.137368384 +0200 -+++ linux-2.6.31.5.new/arch/mips/kernel/Makefile 2009-10-25 15:24:04.713493469 +0200 +--- a/arch/mips/kernel/Makefile ++++ b/arch/mips/kernel/Makefile @@ -2,6 +2,8 @@ # Makefile for the Linux/MIPS kernel. # @@ -10,10 +9,9 @@ diff -Nru linux-2.6.31.5/arch/mips/kernel/Makefile linux-2.6.31.5.new/arch/mips/ extra-y := head.o init_task.o vmlinux.lds obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \ -diff -Nru linux-2.6.31.5/arch/mips/kernel/vmlinux.lds.S linux-2.6.31.5.new/arch/mips/kernel/vmlinux.lds.S ---- linux-2.6.31.5/arch/mips/kernel/vmlinux.lds.S 2009-10-23 01:57:56.000000000 +0300 -+++ linux-2.6.31.5.new/arch/mips/kernel/vmlinux.lds.S 2009-10-25 15:26:11.631618513 +0200 -@@ -10,15 +10,15 @@ +--- a/arch/mips/kernel/vmlinux.lds.S ++++ b/arch/mips/kernel/vmlinux.lds.S +@@ -10,15 +10,15 @@ PHDRS { note PT_NOTE FLAGS(4); /* R__ */ } diff --git a/target/linux/generic-2.6/patches-2.6.31/082-mtd_info_move_forward_decl.patch b/target/linux/generic-2.6/patches-2.6.31/082-mtd_info_move_forward_decl.patch index fc69082ec..13f0a217d 100644 --- a/target/linux/generic-2.6/patches-2.6.31/082-mtd_info_move_forward_decl.patch +++ b/target/linux/generic-2.6/patches-2.6.31/082-mtd_info_move_forward_decl.patch @@ -1,5 +1,5 @@ ---- a/include/linux/mtd/partitions.h 2009-10-29 11:24:29.000000000 +0100 -+++ b/include/linux/mtd/partitions.h 2009-10-29 11:26:35.000000000 +0100 +--- a/include/linux/mtd/partitions.h ++++ b/include/linux/mtd/partitions.h @@ -33,6 +33,7 @@ * Note: writeable partitions require their size and offset be * erasesize aligned (e.g. use MTDPART_OFS_NEXTBLK). @@ -8,7 +8,7 @@ struct mtd_partition; struct mtd_partition { -@@ -49,7 +50,6 @@ +@@ -49,7 +50,6 @@ struct mtd_partition { #define MTDPART_SIZ_FULL (0) From 4a5b5bdb004cab22268204b587809d019ad146af Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 7 Nov 2009 12:48:17 +0000 Subject: [PATCH 110/288] [brcm63xx] merge upstream fixes on mdio loop git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18335 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches-2.6.30/060-bcm63xx_enet_upstream_fixes.patch | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/target/linux/brcm63xx/patches-2.6.30/060-bcm63xx_enet_upstream_fixes.patch b/target/linux/brcm63xx/patches-2.6.30/060-bcm63xx_enet_upstream_fixes.patch index 0271aa6c9..e4c8026b3 100644 --- a/target/linux/brcm63xx/patches-2.6.30/060-bcm63xx_enet_upstream_fixes.patch +++ b/target/linux/brcm63xx/patches-2.6.30/060-bcm63xx_enet_upstream_fixes.patch @@ -8,6 +8,15 @@ #include #include "bcm63xx_enet.h" +@@ -91,7 +90,7 @@ + if (enet_readl(priv, ENET_IR_REG) & ENET_IR_MII) + break; + udelay(1); +- } while (limit-- >= 0); ++ } while (limit-- > 0); + + return (limit < 0) ? 1 : 0; + } @@ -321,7 +320,7 @@ if (len < copybreak) { struct sk_buff *nskb; From d076b120523ade34705f4a5dd19ca3c63c413532 Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 7 Nov 2009 13:03:10 +0000 Subject: [PATCH 111/288] [x86] add missing hunk in the block2mtd patch git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18336 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches-2.6.31/300-block2mtd_init.patch | 47 +++++++++++++------ 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/target/linux/x86/patches-2.6.31/300-block2mtd_init.patch b/target/linux/x86/patches-2.6.31/300-block2mtd_init.patch index 8458eef77..54cae9d0a 100644 --- a/target/linux/x86/patches-2.6.31/300-block2mtd_init.patch +++ b/target/linux/x86/patches-2.6.31/300-block2mtd_init.patch @@ -1,5 +1,7 @@ ---- a/drivers/mtd/devices/block2mtd.c -+++ b/drivers/mtd/devices/block2mtd.c +Index: linux-2.6.31.5/drivers/mtd/devices/block2mtd.c +=================================================================== +--- linux-2.6.31.5.orig/drivers/mtd/devices/block2mtd.c 2009-11-07 13:52:05.000000000 +0100 ++++ linux-2.6.31.5/drivers/mtd/devices/block2mtd.c 2009-11-07 13:52:17.000000000 +0100 @@ -18,10 +18,18 @@ #include #include @@ -19,7 +21,7 @@ /* Info for the block device */ struct block2mtd_dev { -@@ -33,10 +41,34 @@ struct block2mtd_dev { +@@ -33,10 +41,34 @@ char devname[0]; }; @@ -54,7 +56,7 @@ static struct page *page_read(struct address_space *mapping, int index) { -@@ -511,7 +543,9 @@ static int block2mtd_setup2(const char * +@@ -511,7 +543,9 @@ if (token[2] && (strlen(token[2]) + 1 > 80)) parse_err("mtd device name too long"); @@ -65,8 +67,10 @@ return 0; } ---- a/include/asm-generic/vmlinux.lds.h -+++ b/include/asm-generic/vmlinux.lds.h +Index: linux-2.6.31.5/include/asm-generic/vmlinux.lds.h +=================================================================== +--- linux-2.6.31.5.orig/include/asm-generic/vmlinux.lds.h 2009-11-07 13:52:04.000000000 +0100 ++++ linux-2.6.31.5/include/asm-generic/vmlinux.lds.h 2009-11-07 13:52:17.000000000 +0100 @@ -622,12 +622,14 @@ *(.initcall4s.init) \ *(.initcall5.init) \ @@ -83,9 +87,11 @@ #define INIT_CALLS \ VMLINUX_SYMBOL(__initcall_start) = .; \ INITCALLS \ ---- a/init/do_mounts.c -+++ b/init/do_mounts.c -@@ -176,16 +176,8 @@ static int __init fs_names_setup(char *s +Index: linux-2.6.31.5/init/do_mounts.c +=================================================================== +--- linux-2.6.31.5.orig/init/do_mounts.c 2009-10-23 00:57:56.000000000 +0200 ++++ linux-2.6.31.5/init/do_mounts.c 2009-11-07 13:52:17.000000000 +0100 +@@ -176,16 +176,8 @@ return 1; } @@ -102,7 +108,7 @@ static void __init get_fs_names(char *page) { -@@ -366,23 +358,6 @@ void __init prepare_namespace(void) +@@ -366,23 +358,6 @@ { int is_floppy; @@ -126,8 +132,10 @@ if (saved_root_name[0]) { root_device_name = saved_root_name; if (!strncmp(root_device_name, "mtd", 3) || ---- a/init/main.c -+++ b/init/main.c +Index: linux-2.6.31.5/init/main.c +=================================================================== +--- linux-2.6.31.5.orig/init/main.c 2009-11-07 13:52:16.000000000 +0100 ++++ linux-2.6.31.5/init/main.c 2009-11-07 14:00:29.000000000 +0100 @@ -79,6 +79,7 @@ #ifdef CONFIG_X86_LOCAL_APIC #include @@ -136,7 +144,7 @@ static int kernel_init(void *); -@@ -784,12 +785,13 @@ int do_one_initcall(initcall_t fn) +@@ -784,12 +785,13 @@ extern initcall_t __initcall_start[], __initcall_end[], __early_initcall_end[]; @@ -152,7 +160,16 @@ do_one_initcall(*call); /* Make sure there is no pending stuff from the initcall sequence */ -@@ -873,6 +875,13 @@ static noinline int init_post(void) +@@ -812,7 +814,7 @@ + driver_init(); + init_irq_proc(); + do_ctors(); +- do_initcalls(); ++ do_initcalls(__early_initcall_end, __initcall_end); + } + + static void __init do_pre_smp_initcalls(void) +@@ -873,6 +875,13 @@ panic("No init found. Try passing init= option to kernel."); } @@ -166,7 +183,7 @@ static int __init kernel_init(void * unused) { lock_kernel(); -@@ -917,7 +926,16 @@ static int __init kernel_init(void * unu +@@ -917,7 +926,16 @@ if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) { ramdisk_execute_command = NULL; From 1fa447544a76ee4941a7861adafdc5ed24a74cb6 Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 7 Nov 2009 13:36:32 +0000 Subject: [PATCH 112/288] [x86] add again missing hunk in vmlinux.lds.S git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18337 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches-2.6.31/300-block2mtd_init.patch | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/target/linux/x86/patches-2.6.31/300-block2mtd_init.patch b/target/linux/x86/patches-2.6.31/300-block2mtd_init.patch index 54cae9d0a..29e4037c8 100644 --- a/target/linux/x86/patches-2.6.31/300-block2mtd_init.patch +++ b/target/linux/x86/patches-2.6.31/300-block2mtd_init.patch @@ -1,7 +1,24 @@ +Index: linux-2.6.31.5/arch/x86/kernel/vmlinux.lds.S +=================================================================== +--- linux-2.6.31.5.orig/arch/x86/kernel/vmlinux.lds.S 2009-10-23 00:57:56.000000000 +0200 ++++ linux-2.6.31.5/arch/x86/kernel/vmlinux.lds.S 2009-11-07 14:31:54.000000000 +0100 +@@ -244,6 +244,12 @@ + __initcall_end = .; + } + ++ .root_initcall.init : AT(ADDR(.root_initcall.init) - LOAD_OFFSET) { ++ __root_initcall_start = .; ++ INITCALLS_ROOT ++ __root_initcall_end = .; ++ } ++ + .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) { + __con_initcall_start = .; + *(.con_initcall.init) Index: linux-2.6.31.5/drivers/mtd/devices/block2mtd.c =================================================================== ---- linux-2.6.31.5.orig/drivers/mtd/devices/block2mtd.c 2009-11-07 13:52:05.000000000 +0100 -+++ linux-2.6.31.5/drivers/mtd/devices/block2mtd.c 2009-11-07 13:52:17.000000000 +0100 +--- linux-2.6.31.5.orig/drivers/mtd/devices/block2mtd.c 2009-11-07 14:30:57.000000000 +0100 ++++ linux-2.6.31.5/drivers/mtd/devices/block2mtd.c 2009-11-07 14:31:19.000000000 +0100 @@ -18,10 +18,18 @@ #include #include @@ -69,8 +86,8 @@ Index: linux-2.6.31.5/drivers/mtd/devices/block2mtd.c } Index: linux-2.6.31.5/include/asm-generic/vmlinux.lds.h =================================================================== ---- linux-2.6.31.5.orig/include/asm-generic/vmlinux.lds.h 2009-11-07 13:52:04.000000000 +0100 -+++ linux-2.6.31.5/include/asm-generic/vmlinux.lds.h 2009-11-07 13:52:17.000000000 +0100 +--- linux-2.6.31.5.orig/include/asm-generic/vmlinux.lds.h 2009-11-07 14:30:57.000000000 +0100 ++++ linux-2.6.31.5/include/asm-generic/vmlinux.lds.h 2009-11-07 14:31:19.000000000 +0100 @@ -622,12 +622,14 @@ *(.initcall4s.init) \ *(.initcall5.init) \ @@ -90,7 +107,7 @@ Index: linux-2.6.31.5/include/asm-generic/vmlinux.lds.h Index: linux-2.6.31.5/init/do_mounts.c =================================================================== --- linux-2.6.31.5.orig/init/do_mounts.c 2009-10-23 00:57:56.000000000 +0200 -+++ linux-2.6.31.5/init/do_mounts.c 2009-11-07 13:52:17.000000000 +0100 ++++ linux-2.6.31.5/init/do_mounts.c 2009-11-07 14:31:19.000000000 +0100 @@ -176,16 +176,8 @@ return 1; } @@ -134,8 +151,8 @@ Index: linux-2.6.31.5/init/do_mounts.c if (!strncmp(root_device_name, "mtd", 3) || Index: linux-2.6.31.5/init/main.c =================================================================== ---- linux-2.6.31.5.orig/init/main.c 2009-11-07 13:52:16.000000000 +0100 -+++ linux-2.6.31.5/init/main.c 2009-11-07 14:00:29.000000000 +0100 +--- linux-2.6.31.5.orig/init/main.c 2009-11-07 14:30:59.000000000 +0100 ++++ linux-2.6.31.5/init/main.c 2009-11-07 14:31:19.000000000 +0100 @@ -79,6 +79,7 @@ #ifdef CONFIG_X86_LOCAL_APIC #include From da02086104984438513c27ab0ff21fff81b5ea07 Mon Sep 17 00:00:00 2001 From: nbd Date: Sat, 7 Nov 2009 17:40:52 +0000 Subject: [PATCH 113/288] b43: work around a locking issue, might fix #5996 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18338 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches/405-b43_locking_fix.patch | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 package/mac80211/patches/405-b43_locking_fix.patch diff --git a/package/mac80211/patches/405-b43_locking_fix.patch b/package/mac80211/patches/405-b43_locking_fix.patch new file mode 100644 index 000000000..c90890a7a --- /dev/null +++ b/package/mac80211/patches/405-b43_locking_fix.patch @@ -0,0 +1,23 @@ +Subject: [PATCH] b43: work around a locking issue in ->set_tim() + +ops->set_tim() must be atomic, so b43 trying to acquire a mutex leads +to a kernel crash. This patch trades an easy to trigger crash in AP +mode for an unlikely race condition. According to Michael, the real +fix would be to allow set_tim() callbacks to sleep, since b43 is +not the only driver that needs to sleep in all callbacks. + +Signed-off-by: Felix Fietkau + +--- a/drivers/net/wireless/b43/main.c ++++ b/drivers/net/wireless/b43/main.c +@@ -4534,9 +4534,8 @@ static int b43_op_beacon_set_tim(struct + { + struct b43_wl *wl = hw_to_b43_wl(hw); + +- mutex_lock(&wl->mutex); ++ /* FIXME: add locking */ + b43_update_templates(wl); +- mutex_unlock(&wl->mutex); + + return 0; + } From c8e4b6534aac076a168135d2d4f78880f8bc836d Mon Sep 17 00:00:00 2001 From: hauke Date: Sun, 8 Nov 2009 21:56:59 +0000 Subject: [PATCH 114/288] [amazon] Add some build fixes for kernel 2.6.21 and the infineon amazon target. Now it compiles with the new toolchain. These are mostly backports from mainline linux and newer linux kernels from openwrt. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18345 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/amazon/config-2.6.21 | 1 + .../patches-2.6.21/024-mips_disable_fpu.patch | 150 ++++++++++++++++++ .../patches-2.6.21/150-netfilter_imq.patch | 2 +- .../patches-2.6.21/160-netfilter_route.patch | 8 +- .../30-fix_conflicting_getline.patch | 29 ++++ .../patches-2.6.21/31-use_kbuild.h.patch | 21 +++ .../32-time_fix_timespec_add_ns.patch | 17 ++ .../900-headers_type_and_time.patch | 2 +- 8 files changed, 224 insertions(+), 6 deletions(-) create mode 100644 target/linux/generic-2.6/patches-2.6.21/024-mips_disable_fpu.patch create mode 100644 target/linux/generic-2.6/patches-2.6.21/30-fix_conflicting_getline.patch create mode 100644 target/linux/generic-2.6/patches-2.6.21/31-use_kbuild.h.patch create mode 100644 target/linux/generic-2.6/patches-2.6.21/32-time_fix_timespec_add_ns.patch diff --git a/target/linux/amazon/config-2.6.21 b/target/linux/amazon/config-2.6.21 index c406070b1..6d830e1d7 100644 --- a/target/linux/amazon/config-2.6.21 +++ b/target/linux/amazon/config-2.6.21 @@ -74,6 +74,7 @@ CONFIG_MIPS=y # CONFIG_MIPS_DB1500 is not set # CONFIG_MIPS_DB1550 is not set # CONFIG_MIPS_EV64120 is not set +# CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MALTA is not set # CONFIG_MIPS_MIRAGE is not set diff --git a/target/linux/generic-2.6/patches-2.6.21/024-mips_disable_fpu.patch b/target/linux/generic-2.6/patches-2.6.21/024-mips_disable_fpu.patch new file mode 100644 index 000000000..477506962 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.21/024-mips_disable_fpu.patch @@ -0,0 +1,150 @@ +MIPS: allow disabling the kernel FPU emulator + +This patch allows turning off the in-kernel Algorithmics +FPU emulator support, which allows one to save a couple of +precious blocks on an embedded system. + +Signed-off-by: Florian Fainelli + +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -938,6 +938,17 @@ config LIMITED_DMA + config MIPS_BONITO64 + bool + ++config MIPS_FPU_EMU ++ bool ++ default n ++ help ++ This option allows building a kernel with or without the Algorithmics ++ FPU emulator enabled. Turning off this option results in a kernel which ++ does not catch floating operations exceptions. Make sure that your toolchain ++ is configured to enable software floating point emulation in that case. ++ ++ If unsure say Y here. ++ + config MIPS_MSC + bool + +--- a/arch/mips/math-emu/Makefile ++++ b/arch/mips/math-emu/Makefile +@@ -1,11 +1,12 @@ + # + # Makefile for the Linux/MIPS kernel FPU emulation. + # ++obj-y := kernel_linkage.o dsemul.o cp1emu.o + +-obj-y := cp1emu.o ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \ ++obj-$(CONFIG_MIPS_FPU_EMU) += ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \ + ieee754xcpt.o dp_frexp.o dp_modf.o dp_div.o dp_mul.o dp_sub.o \ + dp_add.o dp_fsp.o dp_cmp.o dp_logb.o dp_scalb.o dp_simple.o \ + dp_tint.o dp_fint.o dp_tlong.o dp_flong.o sp_frexp.o sp_modf.o \ + sp_div.o sp_mul.o sp_sub.o sp_add.o sp_fdp.o sp_cmp.o sp_logb.o \ + sp_scalb.o sp_simple.o sp_tint.o sp_fint.o sp_tlong.o sp_flong.o \ +- dp_sqrt.o sp_sqrt.o kernel_linkage.o dsemul.o ++ dp_sqrt.o sp_sqrt.o +--- a/arch/mips/math-emu/cp1emu.c ++++ b/arch/mips/math-emu/cp1emu.c +@@ -56,6 +56,12 @@ + #endif + #define __mips 4 + ++/* Further private data for which no space exists in mips_fpu_struct */ ++ ++struct mips_fpu_emulator_stats fpuemustats; ++ ++#ifdef CONFIG_MIPS_FPU_EMU ++ + /* Function which emulates a floating point instruction. */ + + static int fpu_emu(struct pt_regs *, struct mips_fpu_struct *, +@@ -66,10 +72,6 @@ static int fpux_emu(struct pt_regs *, + struct mips_fpu_struct *, mips_instruction); + #endif + +-/* Further private data for which no space exists in mips_fpu_struct */ +- +-struct mips_fpu_emulator_stats fpuemustats; +- + /* Control registers */ + + #define FPCREG_RID 0 /* $0 = revision id */ +@@ -1277,3 +1279,10 @@ int fpu_emulator_cop1Handler(struct pt_r + + return sig; + } ++#else ++int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx, ++ int has_fpu) ++{ ++ return 0; ++} ++#endif /* CONFIG_MIPS_FPU_EMU */ +--- a/arch/mips/math-emu/dsemul.c ++++ b/arch/mips/math-emu/dsemul.c +@@ -112,6 +112,7 @@ int mips_dsemul(struct pt_regs *regs, mi + return SIGILL; /* force out of emulation loop */ + } + ++#ifdef CONFIG_MIPS_FPU_EMU + int do_dsemulret(struct pt_regs *xcp) + { + struct emuframe *fr; +@@ -167,3 +168,9 @@ int do_dsemulret(struct pt_regs *xcp) + + return 1; + } ++#else ++int do_dsemulret(struct pt_regs *xcp) ++{ ++ return 0; ++} ++#endif /* CONFIG_MIPS_FPU_EMU */ +--- a/arch/mips/math-emu/kernel_linkage.c ++++ b/arch/mips/math-emu/kernel_linkage.c +@@ -28,6 +28,7 @@ + + #define SIGNALLING_NAN 0x7ff800007ff80000LL + ++#ifdef CONFIG_MIPS_FPU_EMU + void fpu_emulator_init_fpu(void) + { + static int first = 1; +@@ -111,4 +112,36 @@ int fpu_emulator_restore_context32(struc + + return err; + } +-#endif ++#endif /* CONFIG_64BIT */ ++#else ++ ++void fpu_emulator_init_fpu(void) ++{ ++ printk(KERN_INFO "FPU emulator disabled, make sure your toolchain" ++ "was compiled with software floating point support (soft-float)\n"); ++ return; ++} ++ ++int fpu_emulator_save_context(struct sigcontext __user *sc) ++{ ++ return 0; ++} ++ ++int fpu_emulator_restore_context(struct sigcontext __user *sc) ++{ ++ return 0; ++} ++ ++int fpu_emulator_save_context32(struct sigcontext32 __user *sc) ++{ ++ return 0; ++} ++ ++int fpu_emulator_restore_context32(struct sigcontext32 __user *sc) ++{ ++ return 0; ++} ++ ++#ifdef CONFIG_64BIT ++#endif /* CONFIG_64BIT */ ++#endif /* CONFIG_MIPS_FPU_EMU */ diff --git a/target/linux/generic-2.6/patches-2.6.21/150-netfilter_imq.patch b/target/linux/generic-2.6/patches-2.6.21/150-netfilter_imq.patch index b3ba77b0a..f57dd5b8f 100644 --- a/target/linux/generic-2.6/patches-2.6.21/150-netfilter_imq.patch +++ b/target/linux/generic-2.6/patches-2.6.21/150-netfilter_imq.patch @@ -735,7 +735,7 @@ depends on IP_NF_MANGLE --- a/net/ipv4/netfilter/Makefile +++ b/net/ipv4/netfilter/Makefile -@@ -98,6 +98,7 @@ obj-$(CONFIG_IP_NF_MATCH_ADDRTYPE) += ip +@@ -97,6 +97,7 @@ obj-$(CONFIG_IP_NF_MATCH_ADDRTYPE) += ip obj-$(CONFIG_IP_NF_TARGET_REJECT) += ipt_REJECT.o obj-$(CONFIG_IP_NF_TARGET_TOS) += ipt_TOS.o obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o diff --git a/target/linux/generic-2.6/patches-2.6.21/160-netfilter_route.patch b/target/linux/generic-2.6/patches-2.6.21/160-netfilter_route.patch index 0d305e3dd..8fcec08fc 100644 --- a/target/linux/generic-2.6/patches-2.6.21/160-netfilter_route.patch +++ b/target/linux/generic-2.6/patches-2.6.21/160-netfilter_route.patch @@ -538,9 +538,9 @@ +module_exit(fini); --- a/net/ipv4/netfilter/Kconfig +++ b/net/ipv4/netfilter/Kconfig -@@ -825,5 +825,22 @@ config IP_NF_TARGET_SET - To compile it as a module, choose M here. If unsure, say N. - +@@ -684,5 +684,22 @@ config IP_NF_ARP_MANGLE + Allows altering the ARP packet payload: source and destination + hardware and network addresses. +config IP_NF_TARGET_ROUTE + tristate 'ROUTE target support' @@ -563,7 +563,7 @@ --- a/net/ipv4/netfilter/Makefile +++ b/net/ipv4/netfilter/Makefile -@@ -101,6 +101,7 @@ obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_EC +@@ -100,6 +100,7 @@ obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_EC obj-$(CONFIG_IP_NF_TARGET_IMQ) += ipt_IMQ.o obj-$(CONFIG_IP_NF_TARGET_MASQUERADE) += ipt_MASQUERADE.o obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o diff --git a/target/linux/generic-2.6/patches-2.6.21/30-fix_conflicting_getline.patch b/target/linux/generic-2.6/patches-2.6.21/30-fix_conflicting_getline.patch new file mode 100644 index 000000000..0a68134f7 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.21/30-fix_conflicting_getline.patch @@ -0,0 +1,29 @@ +--- a/scripts/unifdef.c ++++ b/scripts/unifdef.c +@@ -206,7 +206,7 @@ static void done(void); + static void error(const char *); + static int findsym(const char *); + static void flushline(bool); +-static Linetype getline(void); ++static Linetype get_line(void); + static Linetype ifeval(const char **); + static void ignoreoff(void); + static void ignoreon(void); +@@ -512,7 +512,7 @@ process(void) + + for (;;) { + linenum++; +- lineval = getline(); ++ lineval = get_line(); + trans_table[ifstate[depth]][lineval](); + debug("process %s -> %s depth %d", + linetype_name[lineval], +@@ -526,7 +526,7 @@ process(void) + * help from skipcomment(). + */ + static Linetype +-getline(void) ++get_line(void) + { + const char *cp; + int cursym; diff --git a/target/linux/generic-2.6/patches-2.6.21/31-use_kbuild.h.patch b/target/linux/generic-2.6/patches-2.6.21/31-use_kbuild.h.patch new file mode 100644 index 000000000..45c753b55 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.21/31-use_kbuild.h.patch @@ -0,0 +1,21 @@ +[MIPS] Fix computation of {PGD,PMD,PTE}_T_LOG2. + +For the generation of asm-offset.h to work these need to be evaulatable +by gcc as a constant expression. This issue did exist for a while but +didn't bite because they're only in asm-offset.h for debugging purposes. + +--- a/include/asm-mips/pgtable.h ++++ b/include/asm-mips/pgtable.h +@@ -168,9 +168,9 @@ static inline void pte_clear(struct mm_s + #define set_pud(pudptr, pudval) do { *(pudptr) = (pudval); } while(0) + #endif + +-#define PGD_T_LOG2 ffz(~sizeof(pgd_t)) +-#define PMD_T_LOG2 ffz(~sizeof(pmd_t)) +-#define PTE_T_LOG2 ffz(~sizeof(pte_t)) ++#define PGD_T_LOG2 (__builtin_ffs(sizeof(pgd_t)) - 1) ++#define PMD_T_LOG2 (__builtin_ffs(sizeof(pmd_t)) - 1) ++#define PTE_T_LOG2 (__builtin_ffs(sizeof(pte_t)) - 1) + + extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; + diff --git a/target/linux/generic-2.6/patches-2.6.21/32-time_fix_timespec_add_ns.patch b/target/linux/generic-2.6/patches-2.6.21/32-time_fix_timespec_add_ns.patch new file mode 100644 index 000000000..378ee28ed --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.21/32-time_fix_timespec_add_ns.patch @@ -0,0 +1,17 @@ +time: prevent the loop in timespec_add_ns() from being optimised away + +Since some architectures don't support __udivdi3(). + +--- a/include/linux/time.h ++++ b/include/linux/time.h +@@ -170,6 +170,10 @@ static inline void timespec_add_ns(struc + { + ns += a->tv_nsec; + while(unlikely(ns >= NSEC_PER_SEC)) { ++ /* The following asm() prevents the compiler from ++ * optimising this loop into a modulo operation. */ ++ asm("" : "+r"(ns)); ++ + ns -= NSEC_PER_SEC; + a->tv_sec++; + } diff --git a/target/linux/generic-2.6/patches-2.6.21/900-headers_type_and_time.patch b/target/linux/generic-2.6/patches-2.6.21/900-headers_type_and_time.patch index ed812eef3..8d748598e 100644 --- a/target/linux/generic-2.6/patches-2.6.21/900-headers_type_and_time.patch +++ b/target/linux/generic-2.6/patches-2.6.21/900-headers_type_and_time.patch @@ -11,7 +11,7 @@ #include #ifdef __KERNEL__ -@@ -224,4 +228,6 @@ struct itimerval { +@@ -228,4 +232,6 @@ struct itimerval { */ #define TIMER_ABSTIME 0x01 From 010506fafcb5f82fc9a5f40eac45a5dc53b5239a Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 8 Nov 2009 22:48:19 +0000 Subject: [PATCH 115/288] [rdc] make sure rdc321x specific patches apply (CONFIG_X86_RDC321X), patch from sn9 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18346 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/rdc/patches-2.6.30/004-yenta_mystery.patch | 2 +- target/linux/rdc/patches-2.6.30/005-fix_amit_breakage.patch | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target/linux/rdc/patches-2.6.30/004-yenta_mystery.patch b/target/linux/rdc/patches-2.6.30/004-yenta_mystery.patch index 4c2e2face..92589ea54 100644 --- a/target/linux/rdc/patches-2.6.30/004-yenta_mystery.patch +++ b/target/linux/rdc/patches-2.6.30/004-yenta_mystery.patch @@ -4,7 +4,7 @@ /* We must finish initialization here */ -+#ifdef CONFIG_X86_RDC ++#ifdef CONFIG_X86_RDC321X +/* #define YO_TI1510_DATASHEET_GUY_EXPLAIN_THIS_JUNK 0x0044f044 */ +#define YO_TI1510_DATASHEET_GUY_EXPLAIN_THIS_JUNK 0x0844b060 +/* #define YO_TI1510_DATASHEET_GUY_EXPLAIN_THIS_JUNK 0x0044d044 */ diff --git a/target/linux/rdc/patches-2.6.30/005-fix_amit_breakage.patch b/target/linux/rdc/patches-2.6.30/005-fix_amit_breakage.patch index 92bce802b..552e5f7eb 100644 --- a/target/linux/rdc/patches-2.6.30/005-fix_amit_breakage.patch +++ b/target/linux/rdc/patches-2.6.30/005-fix_amit_breakage.patch @@ -15,8 +15,8 @@ #include "boot.h" #include -+#ifdef CONFIG_X86_RDC -+#include ++#ifdef CONFIG_X86_RDC321X ++#include +#endif /* @@ -25,7 +25,7 @@ die(); } -+#ifdef CONFIG_X86_RDC ++#ifdef CONFIG_X86_RDC321X + { + u32 bootctl; + From bda4e4e698ba7747d4ca210d99e7c26710e17029 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 8 Nov 2009 22:49:28 +0000 Subject: [PATCH 116/288] [rdc] move headers to arch/x86/include/asm/, patch from sn9 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18347 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../arch/x86/include/asm/mach-rdc321x/rdc321x_defs.h | 12 ------------ .../asm/{mach-rdc321x/gpio.h => rdc321x_gpio.h} | 0 .../rdc/files-2.6.30/arch/x86/mach-rdc321x/gpio.c | 4 ++-- .../files-2.6.30/arch/x86/mach-rdc321x/platform.c | 2 +- .../rdc/patches-2.6.30/002-platform_support.patch | 9 +++++---- 5 files changed, 8 insertions(+), 19 deletions(-) delete mode 100644 target/linux/rdc/files-2.6.30/arch/x86/include/asm/mach-rdc321x/rdc321x_defs.h rename target/linux/rdc/files-2.6.30/arch/x86/include/asm/{mach-rdc321x/gpio.h => rdc321x_gpio.h} (100%) diff --git a/target/linux/rdc/files-2.6.30/arch/x86/include/asm/mach-rdc321x/rdc321x_defs.h b/target/linux/rdc/files-2.6.30/arch/x86/include/asm/mach-rdc321x/rdc321x_defs.h deleted file mode 100644 index c8e9c8bed..000000000 --- a/target/linux/rdc/files-2.6.30/arch/x86/include/asm/mach-rdc321x/rdc321x_defs.h +++ /dev/null @@ -1,12 +0,0 @@ -#define PFX "rdc321x: " - -/* General purpose configuration and data registers */ -#define RDC3210_CFGREG_ADDR 0x0CF8 -#define RDC3210_CFGREG_DATA 0x0CFC - -#define RDC321X_GPIO_CTRL_REG1 0x48 -#define RDC321X_GPIO_CTRL_REG2 0x84 -#define RDC321X_GPIO_DATA_REG1 0x4c -#define RDC321X_GPIO_DATA_REG2 0x88 - -#define RDC321X_MAX_GPIO 58 diff --git a/target/linux/rdc/files-2.6.30/arch/x86/include/asm/mach-rdc321x/gpio.h b/target/linux/rdc/files-2.6.30/arch/x86/include/asm/rdc321x_gpio.h similarity index 100% rename from target/linux/rdc/files-2.6.30/arch/x86/include/asm/mach-rdc321x/gpio.h rename to target/linux/rdc/files-2.6.30/arch/x86/include/asm/rdc321x_gpio.h diff --git a/target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/gpio.c b/target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/gpio.c index c7eff5d2c..92df2201d 100644 --- a/target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/gpio.c +++ b/target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/gpio.c @@ -26,8 +26,8 @@ #include #include -#include -#include +#include +#include /* spin lock to protect our private copy of GPIO data register plus diff --git a/target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/platform.c b/target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/platform.c index 539399634..e319c02b3 100644 --- a/target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/platform.c +++ b/target/linux/rdc/files-2.6.30/arch/x86/mach-rdc321x/platform.c @@ -36,7 +36,7 @@ #include #include -#include +#include /* Flash */ #ifdef CONFIG_MTD_R8610 diff --git a/target/linux/rdc/patches-2.6.30/002-platform_support.patch b/target/linux/rdc/patches-2.6.30/002-platform_support.patch index 74fa95dbe..3e6394fb2 100644 --- a/target/linux/rdc/patches-2.6.30/002-platform_support.patch +++ b/target/linux/rdc/patches-2.6.30/002-platform_support.patch @@ -1,11 +1,12 @@ ---- a/arch/x86/Makefile -+++ b/arch/x86/Makefile -@@ -124,6 +124,10 @@ core-y += $(fcore-y) +Index: linux-2.6.30.9/arch/x86/Makefile +=================================================================== +--- linux-2.6.30.9.orig/arch/x86/Makefile 2009-11-06 07:29:13.739468521 -0800 ++++ linux-2.6.30.9/arch/x86/Makefile 2009-11-06 07:30:29.383510569 -0800 +@@ -124,6 +124,9 @@ # Xen paravirtualization support core-$(CONFIG_XEN) += arch/x86/xen/ +# RDC R-321X support -+cflags-$(CONFIG_X86_RDC321X) := -Iarch/x86/include/asm/mach-rdc321x +core-$(CONFIG_X86_RDC321X) += arch/x86/mach-rdc321x/ + # lguest paravirtualization support From 5a632e0fb1eaafb688187e2ed970740eb3d3fa93 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 8 Nov 2009 22:55:44 +0000 Subject: [PATCH 117/288] [rdc] also support pcmcia git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18349 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/rdc/Makefile | 2 +- target/linux/rdc/config-2.6.30 | 5 +---- target/linux/rdc/config/profile-wl153 | 1 - target/linux/rdc/image/Makefile | 31 +++++++++++++++++---------- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/target/linux/rdc/Makefile b/target/linux/rdc/Makefile index 0abff0039..09b81c8ab 100644 --- a/target/linux/rdc/Makefile +++ b/target/linux/rdc/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk ARCH:=i386 BOARD:=rdc BOARDNAME:=RDC 321x -FEATURES:=squashfs jffs2 pci usb +FEATURES:=squashfs jffs2 pci usb pcmcia CFLAGS:=-Os -pipe -march=i486 -funit-at-a-time LINUX_VERSION:=2.6.30.9 diff --git a/target/linux/rdc/config-2.6.30 b/target/linux/rdc/config-2.6.30 index 6dc046afe..81ec1c57a 100644 --- a/target/linux/rdc/config-2.6.30 +++ b/target/linux/rdc/config-2.6.30 @@ -28,6 +28,7 @@ CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y CONFIG_BASE_SMALL=1 # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y +# CONFIG_BLK_DEV_INITRD is not set CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=4096 @@ -52,7 +53,6 @@ CONFIG_CMDLINE_BOOL=y # CONFIG_DCDBAS is not set # CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEBUG_FS is not set -CONFIG_DECOMPRESS_GZIP=y CONFIG_DECOMPRESS_LZMA=y CONFIG_DEFAULT_IO_DELAY_TYPE=0 # CONFIG_DELL_RBU is not set @@ -132,7 +132,6 @@ CONFIG_HZ_250=y # CONFIG_I8K is not set # CONFIG_IB700_WDT is not set # CONFIG_IBMASR is not set -CONFIG_INITRAMFS_SOURCE="" # CONFIG_IOMMU_API is not set # CONFIG_IOMMU_HELPER is not set CONFIG_IO_DELAY_0X80=y @@ -232,8 +231,6 @@ CONFIG_PHYSICAL_START=0x100000 CONFIG_PROCESSOR_SELECT=y # CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set CONFIG_RDC321X_WDT=m -CONFIG_RD_GZIP=y -# CONFIG_RD_LZMA is not set # CONFIG_RELOCATABLE is not set # CONFIG_RTC is not set # CONFIG_RWSEM_GENERIC_SPINLOCK is not set diff --git a/target/linux/rdc/config/profile-wl153 b/target/linux/rdc/config/profile-wl153 index 3e18b0e67..e69de29bb 100644 --- a/target/linux/rdc/config/profile-wl153 +++ b/target/linux/rdc/config/profile-wl153 @@ -1 +0,0 @@ -# CONFIG_BLK_DEV_INITRD is not set diff --git a/target/linux/rdc/image/Makefile b/target/linux/rdc/image/Makefile index 6d3825312..315d91747 100644 --- a/target/linux/rdc/image/Makefile +++ b/target/linux/rdc/image/Makefile @@ -39,21 +39,21 @@ define Image/Prepare/wl153/squashfs echo -n "0123456789abcdef0123" >> $(KDIR)/root.tmp cat $(KDIR)/bzImage $(KDIR)/root.squashfs >> $(KDIR)/root.tmp dd if=$(KDIR)/root.tmp of=$(KDIR)/root2.tmp bs=64k conv=sync - dd if=$(KDIR)/root2.tmp of=$(KDIR)/root.squashfs bs=1 skip=$$$$[0x$$$$(cat $(KDIR)/bzSize) + 0x8014] + dd if=$(KDIR)/root2.tmp of=$(KDIR)/root.squashfs bs=1 skip=$$$$(perl -we 'print((-s"$(KDIR)/bzImage")+0x8014)') + $(RM) $(KDIR)/root.tmp $(KDIR)/root2.tmp $(call add_jffs2_mark,$(KDIR)/root.squashfs) endef define Image/Build/wl153 - ls -l $(KDIR)/bzImage | sed -r 's/^[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+([^[:blank:]]+).+$$$$/\1/' | xargs printf '%.8x' > $(KDIR)/bzSize + echo -ne "\0\0" >> $(KDIR)/bzImage + dd if=$(KDIR)/bzImage of=$(KDIR)/bzImage.tmp bs=4 conv=sync + dd if=$(KDIR)/bzImage.tmp of=$(KDIR)/bzImage bs=1 count=$$$$(perl -we 'print((-s"$(KDIR)/bzImage.tmp")-2)') + perl -we 'while(<>){$$$$i.=$$$$_}print pack"v",-(unpack"%v*",$$$$i)' < $(KDIR)/bzImage.tmp >> $(KDIR)/bzImage + $(RM) $(KDIR)/bzImage.tmp $(call Image/Prepare/wl153/$(1)) - ls -l $(KDIR)/root.$(1) | sed -r 's/^[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+([^[:blank:]]+).+$$$$/\1/' | xargs printf '%.8x' > $(KDIR)/rdSize - echo -ne "\x$$$$(cut -c 7,8 < $(KDIR)/bzSize)\x$$$$(cut -c 5,6 < $(KDIR)/bzSize)\x$$$$(cut -c 3,4 < $(KDIR)/bzSize)\x$$$$(cut -c 1,2 < $(KDIR)/bzSize)" > $(KDIR)/bzSize.tmp - echo -n 'CSYS' > $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img - cat $(KDIR)/bzSize.tmp >> $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img - echo -ne "\x$$$$(cut -c 7,8 < $(KDIR)/rdSize)\x$$$$(cut -c 5,6 < $(KDIR)/rdSize)\x$$$$(cut -c 3,4 < $(KDIR)/rdSize)\x$$$$(cut -c 1,2 < $(KDIR)/rdSize)WRRM" >> $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img - cat $(KDIR)/bzSize.tmp $(KDIR)/bzImage $(KDIR)/root.$(1) >> $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img - $(RM) $(KDIR)/bzSize.tmp $(KDIR)/bzSize $(KDIR)/rdSize - if [ `ls -l $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img | sed -r 's/^[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+([^[:blank:]]+).+$$$$/\1/'` -gt $$$$((0xffff0000-0xffe08000)) ]; then mv $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img.too_big; echo "#ERR image too big"; fi + perl -we 'print "CSYS",pack("V",-s"$(KDIR)/bzImage"),pack("V",-s"$(KDIR)/root.$(1)"),"WRRM",pack("V",-s"$(KDIR)/bzImage")' > $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img + cat $(KDIR)/bzImage $(KDIR)/root.$(1) >> $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img + if [ `perl -we 'print -s"$(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img"'` -gt $$$$((0xffff0000-0xffe08000)) ]; then mv $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img.too_big; echo "#ERR image too big"; fi endef define Image/Build/dir450 @@ -75,8 +75,17 @@ define Image/Build/g570s $(RM) -r $(KDIR)/zyxel.tmp endef +define Image/Prepare/amit/squashfs + echo -n "0123456789abcdef" > $(KDIR)/root.tmp + cat $(KDIR)/root.squashfs >> $(KDIR)/root.tmp + dd if=$(KDIR)/root.tmp of=$(KDIR)/root2.tmp bs=64k conv=sync + dd if=$(KDIR)/root2.tmp of=$(KDIR)/root.squashfs bs=1 skip=16 + $(RM) $(KDIR)/root.tmp $(KDIR)/root2.tmp + $(call add_jffs2_mark,$(KDIR)/root.squashfs) +endef + define Image/Build/amit - $(call Image/Prepare/$(1)) + $(call Image/Prepare/amit/$(1)) if [ ! -x $(STAGING_DIR_HOST)/bin/amit_makebin ]; then echo "#ERR Please copy the AMIT \"makebin\" tool from http://mgb111.pradnik.net/ as $(STAGING_DIR_HOST)/bin/amit_makebin to build."; fi sh -c "mkdir -p $(KDIR)/amit.tmp/linux_src/arch/i386/boot $(KDIR)/amit.tmp/rom_disk && cd $(KDIR)/amit.tmp && ln -s ../../root.$(1) rom_disk/fs.img && ln -s ../../../../../bzImage linux_src/arch/i386/boot && $(STAGING_DIR_HOST)/bin/amit_makebin && mv upgrade.img $(BIN_DIR)/openwrt-$(BOARD)-$(1)-anas350.bin" || : $(RM) -r $(KDIR)/amit.tmp From 4cf096967491782591ed315ded243de2b86c618e Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 8 Nov 2009 23:01:29 +0000 Subject: [PATCH 118/288] [rdc] remove empty wl153 profile after r18349 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18350 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/rdc/config/profile-wl153 | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 target/linux/rdc/config/profile-wl153 diff --git a/target/linux/rdc/config/profile-wl153 b/target/linux/rdc/config/profile-wl153 deleted file mode 100644 index e69de29bb..000000000 From cb9259e18635bc21bca7b240cc30bfb5a75ea122 Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 9 Nov 2009 00:58:39 +0000 Subject: [PATCH 119/288] mac80211: fix wifi detect with 11n cards that have multiple bands git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18351 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/files/lib/wifi/mac80211.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/package/mac80211/files/lib/wifi/mac80211.sh b/package/mac80211/files/lib/wifi/mac80211.sh index bae9fb6d7..5af7a9a26 100644 --- a/package/mac80211/files/lib/wifi/mac80211.sh +++ b/package/mac80211/files/lib/wifi/mac80211.sh @@ -293,9 +293,12 @@ detect_mac80211() { done mode_11n="" mode_band="g" - ht_cap="$(iw phy "$dev" info | grep 'HT capabilities' | cut -d: -f2)" + ht_cap=0 + for cap in $(iw phy "$dev" info | grep 'HT capabilities' | cut -d: -f2); do + ht_cap="$(($ht_cap | $cap))" + done ht_capab=""; - [ -n "$ht_cap" ] && { + [ "$ht_cap" -gt 0 ] && { mode_11n="n" list=" list ht_capab" [ "$(($ht_cap & 2))" -eq 1 ] && append ht_capab "$list LDPC" "$N" From 8b71343ecdf405f73f7a189928c17358ce15aa33 Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 9 Nov 2009 00:58:44 +0000 Subject: [PATCH 120/288] backport a recent version of vsprintf to linux 2.6.28 to fix mac80211 wifi interface detection git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18352 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../981-vsprintf_backport.patch | 888 ++++++++++++++++++ 1 file changed, 888 insertions(+) create mode 100644 target/linux/generic-2.6/patches-2.6.28/981-vsprintf_backport.patch diff --git a/target/linux/generic-2.6/patches-2.6.28/981-vsprintf_backport.patch b/target/linux/generic-2.6/patches-2.6.28/981-vsprintf_backport.patch new file mode 100644 index 000000000..37589b188 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.28/981-vsprintf_backport.patch @@ -0,0 +1,888 @@ +--- a/lib/vsprintf.c ++++ b/lib/vsprintf.c +@@ -170,6 +170,8 @@ int strict_strtoul(const char *cp, unsig + return -EINVAL; + + val = simple_strtoul(cp, &tail, base); ++ if (tail == cp) ++ return -EINVAL; + if ((*tail == '\0') || + ((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) { + *res = val; +@@ -241,6 +243,8 @@ int strict_strtoull(const char *cp, unsi + return -EINVAL; + + val = simple_strtoull(cp, &tail, base); ++ if (tail == cp) ++ return -EINVAL; + if ((*tail == '\0') || + ((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) { + *res = val; +@@ -392,7 +396,38 @@ static noinline char* put_dec(char *buf, + #define SMALL 32 /* Must be 32 == 0x20 */ + #define SPECIAL 64 /* 0x */ + +-static char *number(char *buf, char *end, unsigned long long num, int base, int size, int precision, int type) ++enum format_type { ++ FORMAT_TYPE_NONE, /* Just a string part */ ++ FORMAT_TYPE_WIDTH, ++ FORMAT_TYPE_PRECISION, ++ FORMAT_TYPE_CHAR, ++ FORMAT_TYPE_STR, ++ FORMAT_TYPE_PTR, ++ FORMAT_TYPE_PERCENT_CHAR, ++ FORMAT_TYPE_INVALID, ++ FORMAT_TYPE_LONG_LONG, ++ FORMAT_TYPE_ULONG, ++ FORMAT_TYPE_LONG, ++ FORMAT_TYPE_USHORT, ++ FORMAT_TYPE_SHORT, ++ FORMAT_TYPE_UINT, ++ FORMAT_TYPE_INT, ++ FORMAT_TYPE_NRCHARS, ++ FORMAT_TYPE_SIZE_T, ++ FORMAT_TYPE_PTRDIFF ++}; ++ ++struct printf_spec { ++ enum format_type type; ++ int flags; /* flags to number() */ ++ int field_width; /* width of output field */ ++ int base; ++ int precision; /* # of digits/chars */ ++ int qualifier; ++}; ++ ++static char *number(char *buf, char *end, unsigned long long num, ++ struct printf_spec spec) + { + /* we are called with base 8, 10 or 16, only, thus don't need "G..." */ + static const char digits[16] = "0123456789ABCDEF"; /* "GHIJKLMNOPQRSTUVWXYZ"; */ +@@ -400,32 +435,32 @@ static char *number(char *buf, char *end + char tmp[66]; + char sign; + char locase; +- int need_pfx = ((type & SPECIAL) && base != 10); ++ int need_pfx = ((spec.flags & SPECIAL) && spec.base != 10); + int i; + + /* locase = 0 or 0x20. ORing digits or letters with 'locase' + * produces same digits or (maybe lowercased) letters */ +- locase = (type & SMALL); +- if (type & LEFT) +- type &= ~ZEROPAD; ++ locase = (spec.flags & SMALL); ++ if (spec.flags & LEFT) ++ spec.flags &= ~ZEROPAD; + sign = 0; +- if (type & SIGN) { ++ if (spec.flags & SIGN) { + if ((signed long long) num < 0) { + sign = '-'; + num = - (signed long long) num; +- size--; +- } else if (type & PLUS) { ++ spec.field_width--; ++ } else if (spec.flags & PLUS) { + sign = '+'; +- size--; +- } else if (type & SPACE) { ++ spec.field_width--; ++ } else if (spec.flags & SPACE) { + sign = ' '; +- size--; ++ spec.field_width--; + } + } + if (need_pfx) { +- size--; +- if (base == 16) +- size--; ++ spec.field_width--; ++ if (spec.base == 16) ++ spec.field_width--; + } + + /* generate full string in tmp[], in reverse order */ +@@ -437,10 +472,10 @@ static char *number(char *buf, char *end + tmp[i++] = (digits[do_div(num,base)] | locase); + } while (num != 0); + */ +- else if (base != 10) { /* 8 or 16 */ +- int mask = base - 1; ++ else if (spec.base != 10) { /* 8 or 16 */ ++ int mask = spec.base - 1; + int shift = 3; +- if (base == 16) shift = 4; ++ if (spec.base == 16) shift = 4; + do { + tmp[i++] = (digits[((unsigned char)num) & mask] | locase); + num >>= shift; +@@ -450,12 +485,12 @@ static char *number(char *buf, char *end + } + + /* printing 100 using %2d gives "100", not "00" */ +- if (i > precision) +- precision = i; ++ if (i > spec.precision) ++ spec.precision = i; + /* leading space padding */ +- size -= precision; +- if (!(type & (ZEROPAD+LEFT))) { +- while(--size >= 0) { ++ spec.field_width -= spec.precision; ++ if (!(spec.flags & (ZEROPAD+LEFT))) { ++ while(--spec.field_width >= 0) { + if (buf < end) + *buf = ' '; + ++buf; +@@ -472,23 +507,23 @@ static char *number(char *buf, char *end + if (buf < end) + *buf = '0'; + ++buf; +- if (base == 16) { ++ if (spec.base == 16) { + if (buf < end) + *buf = ('X' | locase); + ++buf; + } + } + /* zero or space padding */ +- if (!(type & LEFT)) { +- char c = (type & ZEROPAD) ? '0' : ' '; +- while (--size >= 0) { ++ if (!(spec.flags & LEFT)) { ++ char c = (spec.flags & ZEROPAD) ? '0' : ' '; ++ while (--spec.field_width >= 0) { + if (buf < end) + *buf = c; + ++buf; + } + } + /* hmm even more zero padding? */ +- while (i <= --precision) { ++ while (i <= --spec.precision) { + if (buf < end) + *buf = '0'; + ++buf; +@@ -500,7 +535,7 @@ static char *number(char *buf, char *end + ++buf; + } + /* trailing space padding */ +- while (--size >= 0) { ++ while (--spec.field_width >= 0) { + if (buf < end) + *buf = ' '; + ++buf; +@@ -508,17 +543,17 @@ static char *number(char *buf, char *end + return buf; + } + +-static char *string(char *buf, char *end, char *s, int field_width, int precision, int flags) ++static char *string(char *buf, char *end, char *s, struct printf_spec spec) + { + int len, i; + + if ((unsigned long)s < PAGE_SIZE) + s = ""; + +- len = strnlen(s, precision); ++ len = strnlen(s, spec.precision); + +- if (!(flags & LEFT)) { +- while (len < field_width--) { ++ if (!(spec.flags & LEFT)) { ++ while (len < spec.field_width--) { + if (buf < end) + *buf = ' '; + ++buf; +@@ -529,7 +564,7 @@ static char *string(char *buf, char *end + *buf = *s; + ++buf; ++s; + } +- while (len < field_width--) { ++ while (len < spec.field_width--) { + if (buf < end) + *buf = ' '; + ++buf; +@@ -537,21 +572,24 @@ static char *string(char *buf, char *end + return buf; + } + +-static char *symbol_string(char *buf, char *end, void *ptr, int field_width, int precision, int flags) ++static char *symbol_string(char *buf, char *end, void *ptr, ++ struct printf_spec spec) + { + unsigned long value = (unsigned long) ptr; + #ifdef CONFIG_KALLSYMS + char sym[KSYM_SYMBOL_LEN]; + sprint_symbol(sym, value); +- return string(buf, end, sym, field_width, precision, flags); ++ return string(buf, end, sym, spec); + #else +- field_width = 2*sizeof(void *); +- flags |= SPECIAL | SMALL | ZEROPAD; +- return number(buf, end, value, 16, field_width, precision, flags); ++ spec.field_width = 2*sizeof(void *); ++ spec.flags |= SPECIAL | SMALL | ZEROPAD; ++ spec.base = 16; ++ return number(buf, end, value, spec); + #endif + } + +-static char *resource_string(char *buf, char *end, struct resource *res, int field_width, int precision, int flags) ++static char *resource_string(char *buf, char *end, struct resource *res, ++ struct printf_spec spec) + { + #ifndef IO_RSRC_PRINTK_SIZE + #define IO_RSRC_PRINTK_SIZE 4 +@@ -560,7 +598,11 @@ static char *resource_string(char *buf, + #ifndef MEM_RSRC_PRINTK_SIZE + #define MEM_RSRC_PRINTK_SIZE 8 + #endif +- ++ struct printf_spec num_spec = { ++ .base = 16, ++ .precision = -1, ++ .flags = SPECIAL | SMALL | ZEROPAD, ++ }; + /* room for the actual numbers, the two "0x", -, [, ] and the final zero */ + char sym[4*sizeof(resource_size_t) + 8]; + char *p = sym, *pend = sym + sizeof(sym); +@@ -572,13 +614,73 @@ static char *resource_string(char *buf, + size = MEM_RSRC_PRINTK_SIZE; + + *p++ = '['; +- p = number(p, pend, res->start, 16, size, -1, SPECIAL | SMALL | ZEROPAD); ++ num_spec.field_width = size; ++ p = number(p, pend, res->start, num_spec); + *p++ = '-'; +- p = number(p, pend, res->end, 16, size, -1, SPECIAL | SMALL | ZEROPAD); ++ p = number(p, pend, res->end, num_spec); + *p++ = ']'; + *p = 0; + +- return string(buf, end, sym, field_width, precision, flags); ++ return string(buf, end, sym, spec); ++} ++ ++static char *mac_address_string(char *buf, char *end, u8 *addr, ++ struct printf_spec spec) ++{ ++ char mac_addr[6 * 3]; /* (6 * 2 hex digits), 5 colons and trailing zero */ ++ char *p = mac_addr; ++ int i; ++ ++ for (i = 0; i < 6; i++) { ++ p = pack_hex_byte(p, addr[i]); ++ if (!(spec.flags & SPECIAL) && i != 5) ++ *p++ = ':'; ++ } ++ *p = '\0'; ++ spec.flags &= ~SPECIAL; ++ ++ return string(buf, end, mac_addr, spec); ++} ++ ++static char *ip6_addr_string(char *buf, char *end, u8 *addr, ++ struct printf_spec spec) ++{ ++ char ip6_addr[8 * 5]; /* (8 * 4 hex digits), 7 colons and trailing zero */ ++ char *p = ip6_addr; ++ int i; ++ ++ for (i = 0; i < 8; i++) { ++ p = pack_hex_byte(p, addr[2 * i]); ++ p = pack_hex_byte(p, addr[2 * i + 1]); ++ if (!(spec.flags & SPECIAL) && i != 7) ++ *p++ = ':'; ++ } ++ *p = '\0'; ++ spec.flags &= ~SPECIAL; ++ ++ return string(buf, end, ip6_addr, spec); ++} ++ ++static char *ip4_addr_string(char *buf, char *end, u8 *addr, ++ struct printf_spec spec) ++{ ++ char ip4_addr[4 * 4]; /* (4 * 3 decimal digits), 3 dots and trailing zero */ ++ char temp[3]; /* hold each IP quad in reverse order */ ++ char *p = ip4_addr; ++ int i, digits; ++ ++ for (i = 0; i < 4; i++) { ++ digits = put_dec_trunc(temp, addr[i]) - temp; ++ /* reverse the digits in the quad */ ++ while (digits--) ++ *p++ = temp[digits]; ++ if (i != 3) ++ *p++ = '.'; ++ } ++ *p = '\0'; ++ spec.flags &= ~SPECIAL; ++ ++ return string(buf, end, ip4_addr, spec); + } + + /* +@@ -592,28 +694,244 @@ static char *resource_string(char *buf, + * - 'S' For symbolic direct pointers + * - 'R' For a struct resource pointer, it prints the range of + * addresses (not the name nor the flags) ++ * - 'M' For a 6-byte MAC address, it prints the address in the ++ * usual colon-separated hex notation ++ * - 'I' [46] for IPv4/IPv6 addresses printed in the usual way (dot-separated ++ * decimal for v4 and colon separated network-order 16 bit hex for v6) ++ * - 'i' [46] for 'raw' IPv4/IPv6 addresses, IPv6 omits the colons, IPv4 is ++ * currently the same + * + * Note: The difference between 'S' and 'F' is that on ia64 and ppc64 + * function pointers are really function descriptors, which contain a + * pointer to the real address. + */ +-static char *pointer(const char *fmt, char *buf, char *end, void *ptr, int field_width, int precision, int flags) ++static char *pointer(const char *fmt, char *buf, char *end, void *ptr, ++ struct printf_spec spec) + { ++ if (!ptr) ++ return string(buf, end, "(null)", spec); ++ + switch (*fmt) { + case 'F': + ptr = dereference_function_descriptor(ptr); + /* Fallthrough */ + case 'S': +- return symbol_string(buf, end, ptr, field_width, precision, flags); ++ return symbol_string(buf, end, ptr, spec); + case 'R': +- return resource_string(buf, end, ptr, field_width, precision, flags); ++ return resource_string(buf, end, ptr, spec); ++ case 'm': ++ spec.flags |= SPECIAL; ++ /* Fallthrough */ ++ case 'M': ++ return mac_address_string(buf, end, ptr, spec); ++ case 'i': ++ spec.flags |= SPECIAL; ++ /* Fallthrough */ ++ case 'I': ++ if (fmt[1] == '6') ++ return ip6_addr_string(buf, end, ptr, spec); ++ if (fmt[1] == '4') ++ return ip4_addr_string(buf, end, ptr, spec); ++ spec.flags &= ~SPECIAL; ++ break; + } +- flags |= SMALL; +- if (field_width == -1) { +- field_width = 2*sizeof(void *); +- flags |= ZEROPAD; ++ spec.flags |= SMALL; ++ if (spec.field_width == -1) { ++ spec.field_width = 2*sizeof(void *); ++ spec.flags |= ZEROPAD; + } +- return number(buf, end, (unsigned long) ptr, 16, field_width, precision, flags); ++ spec.base = 16; ++ ++ return number(buf, end, (unsigned long) ptr, spec); ++} ++ ++/* ++ * Helper function to decode printf style format. ++ * Each call decode a token from the format and return the ++ * number of characters read (or likely the delta where it wants ++ * to go on the next call). ++ * The decoded token is returned through the parameters ++ * ++ * 'h', 'l', or 'L' for integer fields ++ * 'z' support added 23/7/1999 S.H. ++ * 'z' changed to 'Z' --davidm 1/25/99 ++ * 't' added for ptrdiff_t ++ * ++ * @fmt: the format string ++ * @type of the token returned ++ * @flags: various flags such as +, -, # tokens.. ++ * @field_width: overwritten width ++ * @base: base of the number (octal, hex, ...) ++ * @precision: precision of a number ++ * @qualifier: qualifier of a number (long, size_t, ...) ++ */ ++static int format_decode(const char *fmt, struct printf_spec *spec) ++{ ++ const char *start = fmt; ++ ++ /* we finished early by reading the field width */ ++ if (spec->type == FORMAT_TYPE_WIDTH) { ++ if (spec->field_width < 0) { ++ spec->field_width = -spec->field_width; ++ spec->flags |= LEFT; ++ } ++ spec->type = FORMAT_TYPE_NONE; ++ goto precision; ++ } ++ ++ /* we finished early by reading the precision */ ++ if (spec->type == FORMAT_TYPE_PRECISION) { ++ if (spec->precision < 0) ++ spec->precision = 0; ++ ++ spec->type = FORMAT_TYPE_NONE; ++ goto qualifier; ++ } ++ ++ /* By default */ ++ spec->type = FORMAT_TYPE_NONE; ++ ++ for (; *fmt ; ++fmt) { ++ if (*fmt == '%') ++ break; ++ } ++ ++ /* Return the current non-format string */ ++ if (fmt != start || !*fmt) ++ return fmt - start; ++ ++ /* Process flags */ ++ spec->flags = 0; ++ ++ while (1) { /* this also skips first '%' */ ++ bool found = true; ++ ++ ++fmt; ++ ++ switch (*fmt) { ++ case '-': spec->flags |= LEFT; break; ++ case '+': spec->flags |= PLUS; break; ++ case ' ': spec->flags |= SPACE; break; ++ case '#': spec->flags |= SPECIAL; break; ++ case '0': spec->flags |= ZEROPAD; break; ++ default: found = false; ++ } ++ ++ if (!found) ++ break; ++ } ++ ++ /* get field width */ ++ spec->field_width = -1; ++ ++ if (isdigit(*fmt)) ++ spec->field_width = skip_atoi(&fmt); ++ else if (*fmt == '*') { ++ /* it's the next argument */ ++ spec->type = FORMAT_TYPE_WIDTH; ++ return ++fmt - start; ++ } ++ ++precision: ++ /* get the precision */ ++ spec->precision = -1; ++ if (*fmt == '.') { ++ ++fmt; ++ if (isdigit(*fmt)) { ++ spec->precision = skip_atoi(&fmt); ++ if (spec->precision < 0) ++ spec->precision = 0; ++ } else if (*fmt == '*') { ++ /* it's the next argument */ ++ spec->type = FORMAT_TYPE_PRECISION; ++ return ++fmt - start; ++ } ++ } ++ ++qualifier: ++ /* get the conversion qualifier */ ++ spec->qualifier = -1; ++ if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || ++ *fmt == 'Z' || *fmt == 'z' || *fmt == 't') { ++ spec->qualifier = *fmt; ++ ++fmt; ++ if (spec->qualifier == 'l' && *fmt == 'l') { ++ spec->qualifier = 'L'; ++ ++fmt; ++ } ++ } ++ ++ /* default base */ ++ spec->base = 10; ++ switch (*fmt) { ++ case 'c': ++ spec->type = FORMAT_TYPE_CHAR; ++ return ++fmt - start; ++ ++ case 's': ++ spec->type = FORMAT_TYPE_STR; ++ return ++fmt - start; ++ ++ case 'p': ++ spec->type = FORMAT_TYPE_PTR; ++ return fmt - start; ++ /* skip alnum */ ++ ++ case 'n': ++ spec->type = FORMAT_TYPE_NRCHARS; ++ return ++fmt - start; ++ ++ case '%': ++ spec->type = FORMAT_TYPE_PERCENT_CHAR; ++ return ++fmt - start; ++ ++ /* integer number formats - set up the flags and "break" */ ++ case 'o': ++ spec->base = 8; ++ break; ++ ++ case 'x': ++ spec->flags |= SMALL; ++ ++ case 'X': ++ spec->base = 16; ++ break; ++ ++ case 'd': ++ case 'i': ++ spec->flags |= SIGN; ++ case 'u': ++ break; ++ ++ default: ++ spec->type = FORMAT_TYPE_INVALID; ++ return fmt - start; ++ } ++ ++ if (spec->qualifier == 'L') ++ spec->type = FORMAT_TYPE_LONG_LONG; ++ else if (spec->qualifier == 'l') { ++ if (spec->flags & SIGN) ++ spec->type = FORMAT_TYPE_LONG; ++ else ++ spec->type = FORMAT_TYPE_ULONG; ++ } else if (spec->qualifier == 'Z' || spec->qualifier == 'z') { ++ spec->type = FORMAT_TYPE_SIZE_T; ++ } else if (spec->qualifier == 't') { ++ spec->type = FORMAT_TYPE_PTRDIFF; ++ } else if (spec->qualifier == 'h') { ++ if (spec->flags & SIGN) ++ spec->type = FORMAT_TYPE_SHORT; ++ else ++ spec->type = FORMAT_TYPE_USHORT; ++ } else { ++ if (spec->flags & SIGN) ++ spec->type = FORMAT_TYPE_INT; ++ else ++ spec->type = FORMAT_TYPE_UINT; ++ } ++ ++ return ++fmt - start; + } + + /** +@@ -642,18 +960,9 @@ static char *pointer(const char *fmt, ch + int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) + { + unsigned long long num; +- int base; + char *str, *end, c; +- +- int flags; /* flags to number() */ +- +- int field_width; /* width of output field */ +- int precision; /* min. # of digits for integers; max +- number of chars for from string */ +- int qualifier; /* 'h', 'l', or 'L' for integer fields */ +- /* 'z' support added 23/7/1999 S.H. */ +- /* 'z' changed to 'Z' --davidm 1/25/99 */ +- /* 't' added for ptrdiff_t */ ++ int read; ++ struct printf_spec spec = {0}; + + /* Reject out-of-range values early. Large positive sizes are + used for unknown buffer sizes. */ +@@ -674,184 +983,137 @@ int vsnprintf(char *buf, size_t size, co + size = end - buf; + } + +- for (; *fmt ; ++fmt) { +- if (*fmt != '%') { +- if (str < end) +- *str = *fmt; +- ++str; +- continue; +- } ++ while (*fmt) { ++ const char *old_fmt = fmt; + +- /* process flags */ +- flags = 0; +- repeat: +- ++fmt; /* this also skips first '%' */ +- switch (*fmt) { +- case '-': flags |= LEFT; goto repeat; +- case '+': flags |= PLUS; goto repeat; +- case ' ': flags |= SPACE; goto repeat; +- case '#': flags |= SPECIAL; goto repeat; +- case '0': flags |= ZEROPAD; goto repeat; +- } ++ read = format_decode(fmt, &spec); + +- /* get field width */ +- field_width = -1; +- if (isdigit(*fmt)) +- field_width = skip_atoi(&fmt); +- else if (*fmt == '*') { +- ++fmt; +- /* it's the next argument */ +- field_width = va_arg(args, int); +- if (field_width < 0) { +- field_width = -field_width; +- flags |= LEFT; +- } +- } ++ fmt += read; + +- /* get the precision */ +- precision = -1; +- if (*fmt == '.') { +- ++fmt; +- if (isdigit(*fmt)) +- precision = skip_atoi(&fmt); +- else if (*fmt == '*') { +- ++fmt; +- /* it's the next argument */ +- precision = va_arg(args, int); ++ switch (spec.type) { ++ case FORMAT_TYPE_NONE: { ++ int copy = read; ++ if (str < end) { ++ if (copy > end - str) ++ copy = end - str; ++ memcpy(str, old_fmt, copy); + } +- if (precision < 0) +- precision = 0; ++ str += read; ++ break; + } + +- /* get the conversion qualifier */ +- qualifier = -1; +- if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || +- *fmt =='Z' || *fmt == 'z' || *fmt == 't') { +- qualifier = *fmt; +- ++fmt; +- if (qualifier == 'l' && *fmt == 'l') { +- qualifier = 'L'; +- ++fmt; +- } +- } ++ case FORMAT_TYPE_WIDTH: ++ spec.field_width = va_arg(args, int); ++ break; + +- /* default base */ +- base = 10; ++ case FORMAT_TYPE_PRECISION: ++ spec.precision = va_arg(args, int); ++ break; + +- switch (*fmt) { +- case 'c': +- if (!(flags & LEFT)) { +- while (--field_width > 0) { +- if (str < end) +- *str = ' '; +- ++str; +- } +- } +- c = (unsigned char) va_arg(args, int); +- if (str < end) +- *str = c; +- ++str; +- while (--field_width > 0) { ++ case FORMAT_TYPE_CHAR: ++ if (!(spec.flags & LEFT)) { ++ while (--spec.field_width > 0) { + if (str < end) + *str = ' '; + ++str; +- } +- continue; +- +- case 's': +- str = string(str, end, va_arg(args, char *), field_width, precision, flags); +- continue; +- +- case 'p': +- str = pointer(fmt+1, str, end, +- va_arg(args, void *), +- field_width, precision, flags); +- /* Skip all alphanumeric pointer suffixes */ +- while (isalnum(fmt[1])) +- fmt++; +- continue; + +- case 'n': +- /* FIXME: +- * What does C99 say about the overflow case here? */ +- if (qualifier == 'l') { +- long * ip = va_arg(args, long *); +- *ip = (str - buf); +- } else if (qualifier == 'Z' || qualifier == 'z') { +- size_t * ip = va_arg(args, size_t *); +- *ip = (str - buf); +- } else { +- int * ip = va_arg(args, int *); +- *ip = (str - buf); + } +- continue; +- +- case '%': ++ } ++ c = (unsigned char) va_arg(args, int); ++ if (str < end) ++ *str = c; ++ ++str; ++ while (--spec.field_width > 0) { + if (str < end) +- *str = '%'; ++ *str = ' '; + ++str; +- continue; ++ } ++ break; + +- /* integer number formats - set up the flags and "break" */ +- case 'o': +- base = 8; +- break; ++ case FORMAT_TYPE_STR: ++ str = string(str, end, va_arg(args, char *), spec); ++ break; + +- case 'x': +- flags |= SMALL; +- case 'X': +- base = 16; +- break; ++ case FORMAT_TYPE_PTR: ++ str = pointer(fmt+1, str, end, va_arg(args, void *), ++ spec); ++ while (isalnum(*fmt)) ++ fmt++; ++ break; + +- case 'd': +- case 'i': +- flags |= SIGN; +- case 'u': +- break; ++ case FORMAT_TYPE_PERCENT_CHAR: ++ if (str < end) ++ *str = '%'; ++ ++str; ++ break; + +- default: +- if (str < end) +- *str = '%'; +- ++str; +- if (*fmt) { +- if (str < end) +- *str = *fmt; +- ++str; +- } else { +- --fmt; +- } +- continue; ++ case FORMAT_TYPE_INVALID: ++ if (str < end) ++ *str = '%'; ++ ++str; ++ break; ++ ++ case FORMAT_TYPE_NRCHARS: { ++ int qualifier = spec.qualifier; ++ ++ if (qualifier == 'l') { ++ long *ip = va_arg(args, long *); ++ *ip = (str - buf); ++ } else if (qualifier == 'Z' || ++ qualifier == 'z') { ++ size_t *ip = va_arg(args, size_t *); ++ *ip = (str - buf); ++ } else { ++ int *ip = va_arg(args, int *); ++ *ip = (str - buf); ++ } ++ break; + } +- if (qualifier == 'L') +- num = va_arg(args, long long); +- else if (qualifier == 'l') { +- num = va_arg(args, unsigned long); +- if (flags & SIGN) +- num = (signed long) num; +- } else if (qualifier == 'Z' || qualifier == 'z') { +- num = va_arg(args, size_t); +- } else if (qualifier == 't') { +- num = va_arg(args, ptrdiff_t); +- } else if (qualifier == 'h') { +- num = (unsigned short) va_arg(args, int); +- if (flags & SIGN) +- num = (signed short) num; +- } else { +- num = va_arg(args, unsigned int); +- if (flags & SIGN) +- num = (signed int) num; ++ ++ default: ++ switch (spec.type) { ++ case FORMAT_TYPE_LONG_LONG: ++ num = va_arg(args, long long); ++ break; ++ case FORMAT_TYPE_ULONG: ++ num = va_arg(args, unsigned long); ++ break; ++ case FORMAT_TYPE_LONG: ++ num = va_arg(args, long); ++ break; ++ case FORMAT_TYPE_SIZE_T: ++ num = va_arg(args, size_t); ++ break; ++ case FORMAT_TYPE_PTRDIFF: ++ num = va_arg(args, ptrdiff_t); ++ break; ++ case FORMAT_TYPE_USHORT: ++ num = (unsigned short) va_arg(args, int); ++ break; ++ case FORMAT_TYPE_SHORT: ++ num = (short) va_arg(args, int); ++ break; ++ case FORMAT_TYPE_INT: ++ num = (int) va_arg(args, int); ++ break; ++ default: ++ num = va_arg(args, unsigned int); ++ } ++ ++ str = number(str, end, num, spec); + } +- str = number(str, end, num, base, +- field_width, precision, flags); + } ++ + if (size > 0) { + if (str < end) + *str = '\0'; + else + end[-1] = '\0'; + } ++ + /* the trailing null byte doesn't count towards the total */ + return str-buf; ++ + } + EXPORT_SYMBOL(vsnprintf); + From 8179e8082c5f97103430d93c6539bcc1e7564120 Mon Sep 17 00:00:00 2001 From: kaloz Date: Mon, 9 Nov 2009 11:45:04 +0000 Subject: [PATCH 121/288] add preliminary MPC83xx support git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18353 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/kernel/modules/netdevices.mk | 2 +- target/linux/mpc83xx/Makefile | 25 + target/linux/mpc83xx/base-files/etc/inittab | 4 + target/linux/mpc83xx/config-default | 235 +++ target/linux/mpc83xx/image/Makefile | 31 + target/linux/mpc83xx/patches/001-rb600.patch | 1976 ++++++++++++++++++ 6 files changed, 2272 insertions(+), 1 deletion(-) create mode 100644 target/linux/mpc83xx/Makefile create mode 100644 target/linux/mpc83xx/base-files/etc/inittab create mode 100644 target/linux/mpc83xx/config-default create mode 100644 target/linux/mpc83xx/image/Makefile create mode 100644 target/linux/mpc83xx/patches/001-rb600.patch diff --git a/package/kernel/modules/netdevices.mk b/package/kernel/modules/netdevices.mk index b6a7ababc..c5d008d9d 100644 --- a/package/kernel/modules/netdevices.mk +++ b/package/kernel/modules/netdevices.mk @@ -113,7 +113,7 @@ $(eval $(call KernelPackage,via-rhine)) define KernelPackage/via-velocity SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=VIA Velocity Gigabit Ethernet Adapter kernel support - DEPENDS:=@TARGET_ixp4xx||TARGET_x86 + DEPENDS:=@TARGET_ixp4xx||TARGET_mpc83xx||TARGET_x86 KCONFIG:=CONFIG_VIA_VELOCITY FILES:=$(LINUX_DIR)/drivers/net/via-velocity.$(LINUX_KMOD_SUFFIX) AUTOLOAD:=$(call AutoLoad,50,via-velocity) diff --git a/target/linux/mpc83xx/Makefile b/target/linux/mpc83xx/Makefile new file mode 100644 index 000000000..4dca6165e --- /dev/null +++ b/target/linux/mpc83xx/Makefile @@ -0,0 +1,25 @@ +# +# Copyright (C) 2007-2009 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +ARCH:=powerpc +BOARD:=mpc83xx +BOARDNAME:=Freescale MPC83xx +FEATURES:=tgz broken + +LINUX_VERSION:=2.6.30.9 +LINUX_KARCH:=powerpc + +include $(INCLUDE_DIR)/target.mk + +DEFAULT_PACKAGES += kmod-via-velocity + +define Target/Description + Build firmware images for Freescale MPC83xx based boards (eg. RouterBoard 600). +endef + +$(eval $(call BuildTarget)) diff --git a/target/linux/mpc83xx/base-files/etc/inittab b/target/linux/mpc83xx/base-files/etc/inittab new file mode 100644 index 000000000..7989a7f60 --- /dev/null +++ b/target/linux/mpc83xx/base-files/etc/inittab @@ -0,0 +1,4 @@ +::sysinit:/etc/init.d/rcS S boot +::shutdown:/etc/init.d/rcS K stop +ttyS0::askfirst:/bin/ash --login +ttyS1::askfirst:/bin/ash --login diff --git a/target/linux/mpc83xx/config-default b/target/linux/mpc83xx/config-default new file mode 100644 index 000000000..a380b00e6 --- /dev/null +++ b/target/linux/mpc83xx/config-default @@ -0,0 +1,235 @@ +# CONFIG_40x is not set +# CONFIG_44x is not set +CONFIG_6xx=y +# CONFIG_8xxx_WDT is not set +# CONFIG_ADVANCED_OPTIONS is not set +# CONFIG_AGP is not set +# CONFIG_ALTIVEC is not set +# CONFIG_AMIGAONE is not set +CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y +CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y +CONFIG_ARCH_HAS_ILOG2_U32=y +CONFIG_ARCH_HAS_WALK_MEMORY=y +CONFIG_ARCH_MAY_HAVE_PC_FDC=y +# CONFIG_ARCH_NO_VIRT_TO_BUS is not set +# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set +CONFIG_ARCH_POPULATES_NODE_MAP=y +CONFIG_ARCH_REQUIRE_GPIOLIB=y +CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y +CONFIG_ARCH_SUPPORTS_MSI=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +# CONFIG_ASP834x is not set +CONFIG_ATA=y +# CONFIG_ATA_NONSTANDARD is not set +# CONFIG_ATA_PIIX is not set +CONFIG_ATA_SFF=y +CONFIG_AUDIT_ARCH=y +CONFIG_BASE_SMALL=0 +# CONFIG_BINARY_PRINTF is not set +CONFIG_BITREVERSE=y +# CONFIG_BOOTX_TEXT is not set +CONFIG_BOUNCE=y +# CONFIG_BRIQ_PANEL is not set +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_CMDLINE="console=ttyS0,115200" +CONFIG_CMDLINE_BOOL=y +# CONFIG_CPU_FREQ is not set +# CONFIG_CRASH_DUMP is not set +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_MANAGER2=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_WORKQUEUE=y +# CONFIG_DEBUG_BUGVERBOSE is not set +CONFIG_DECOMPRESS_LZMA=y +CONFIG_DEFAULT_UIMAGE=y +CONFIG_DEVPORT=y +CONFIG_DTC=y +# CONFIG_E200 is not set +CONFIG_EARLY_PRINTK=y +# CONFIG_EDAC is not set +# CONFIG_EMBEDDED6xx is not set +CONFIG_FORCE_MAX_ZONEORDER=11 +# CONFIG_FSL_EMB_PERFMON is not set +CONFIG_FSL_PCI=y +CONFIG_FSL_PQ_MDIO=y +CONFIG_FSL_SOC=y +# CONFIG_FSL_ULI1575 is not set +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CMOS_UPDATE=y +CONFIG_GENERIC_FIND_LAST_BIT=y +CONFIG_GENERIC_FIND_NEXT_BIT=y +CONFIG_GENERIC_GPIO=y +# CONFIG_GENERIC_IOMAP is not set +CONFIG_GENERIC_ISA_DMA=y +CONFIG_GENERIC_NVRAM=y +# CONFIG_GENERIC_TBSYNC is not set +CONFIG_GENERIC_TIME_VSYSCALL=y +# CONFIG_GEN_RTC is not set +CONFIG_GIANFAR=y +CONFIG_GPIOLIB=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +# CONFIG_HAS_RAPIDIO is not set +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set +CONFIG_HAVE_IDE=y +CONFIG_HAVE_IOREMAP_PROT=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_HAVE_LMB=y +CONFIG_HAVE_MLOCK=y +CONFIG_HAVE_OPROFILE=y +# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set +# CONFIG_HVC_RTAS is not set +# CONFIG_HVC_UDBG is not set +CONFIG_HW_RANDOM=y +CONFIG_HZ=250 +# CONFIG_HZ_100 is not set +CONFIG_HZ_250=y +# CONFIG_I2C is not set +CONFIG_INITRAMFS_SOURCE="" +# CONFIG_IOMMU_HELPER is not set +CONFIG_IPIC=y +# CONFIG_IRQSTACKS is not set +CONFIG_IRQ_PER_CPU=y +# CONFIG_ISA is not set +CONFIG_ISA_DMA_API=y +# CONFIG_JFFS2_FS is not set +CONFIG_KERNEL_START=0xc0000000 +# CONFIG_LEDS_GPIO is not set +CONFIG_LOWMEM_SIZE=0x30000000 +# CONFIG_MACINTOSH_DRIVERS is not set +# CONFIG_MMIO_NVRAM is not set +# CONFIG_MPC5121_ADS is not set +# CONFIG_MPC5121_GENERIC is not set +# CONFIG_MPC831x_RDB is not set +# CONFIG_MPC832x_MDS is not set +# CONFIG_MPC832x_RDB is not set +# CONFIG_MPC834x_ITX is not set +# CONFIG_MPC834x_MDS is not set +# CONFIG_MPC836x_MDS is not set +# CONFIG_MPC836x_RDK is not set +# CONFIG_MPC837x_MDS is not set +# CONFIG_MPC837x_RDB is not set +# CONFIG_MPC8xxx_GPIO is not set +CONFIG_MPIC=y +# CONFIG_MPIC_WEIRD is not set +# CONFIG_MTD_CFI is not set +CONFIG_MTD_NAND=y +# CONFIG_MTD_NAND_FSL_ELBC is not set +# CONFIG_MTD_NAND_FSL_UPM is not set +CONFIG_MTD_NAND_RB_PPC=y +# CONFIG_MTD_OF_PARTS is not set +# CONFIG_NATSEMI is not set +# CONFIG_NVRAM is not set +CONFIG_OF=y +CONFIG_OF_DEVICE=y +CONFIG_OF_GPIO=y +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PAGE_OFFSET=0xc0000000 +CONFIG_PATA_RB_PPC=m +# CONFIG_PATA_SCH is not set +CONFIG_PCI=y +# CONFIG_PCIEPORTBUS is not set +CONFIG_PCI_DISABLE_COMMON_QUIRKS=y +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_SYSCALL=y +CONFIG_PCSPKR_PLATFORM=y +CONFIG_PHYLIB=y +CONFIG_PHYSICAL_START=0x00000000 +CONFIG_PPC=y +CONFIG_PPC32=y +# CONFIG_PPC64 is not set +# CONFIG_PPC_16K_PAGES is not set +# CONFIG_PPC_256K_PAGES is not set +CONFIG_PPC_4K_PAGES=y +# CONFIG_PPC_64K_PAGES is not set +# CONFIG_PPC_82xx is not set +CONFIG_PPC_83xx=y +# CONFIG_PPC_85xx is not set +# CONFIG_PPC_86xx is not set +# CONFIG_PPC_8xx is not set +# CONFIG_PPC_970_NAP is not set +CONFIG_PPC_BOOK3S=y +# CONFIG_PPC_CELL is not set +# CONFIG_PPC_CELL_NATIVE is not set +CONFIG_PPC_CHRP=y +# CONFIG_PPC_CLOCK is not set +# CONFIG_PPC_DCR_MMIO is not set +# CONFIG_PPC_DCR_NATIVE is not set +# CONFIG_PPC_EARLY_DEBUG is not set +CONFIG_PPC_FPU=y +CONFIG_PPC_I8259=y +# CONFIG_PPC_INDIRECT_IO is not set +CONFIG_PPC_INDIRECT_PCI=y +CONFIG_PPC_LIB_RHEAP=y +# CONFIG_PPC_MM_SLICES is not set +CONFIG_PPC_MPC106=y +# CONFIG_PPC_MPC52xx is not set +CONFIG_PPC_MPC834x=y +CONFIG_PPC_NATIVE=y +CONFIG_PPC_OF=y +CONFIG_PPC_OF_BOOT_TRAMPOLINE=y +CONFIG_PPC_PCI_CHOICE=y +# CONFIG_PPC_PMAC is not set +CONFIG_PPC_RTAS=y +CONFIG_PPC_STD_MMU=y +CONFIG_PPC_STD_MMU_32=y +CONFIG_PPC_UDBG_16550=y +# CONFIG_PQ2ADS is not set +CONFIG_PRINT_STACK_DEPTH=64 +CONFIG_PROC_DEVICETREE=y +CONFIG_QE_GPIO=y +CONFIG_QUICC_ENGINE=y +CONFIG_RB_IOMAP=y +CONFIG_RB_PPC=y +# CONFIG_RTAS_ERROR_LOGGING is not set +CONFIG_RTAS_PROC=y +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +# CONFIG_SATA_FSL is not set +# CONFIG_SBC834x is not set +CONFIG_SCHED_HRTICK=y +CONFIG_SCHED_OMIT_FRAME_POINTER=y +CONFIG_SCSI=y +# CONFIG_SERIAL_8250_DETECT_IRQ is not set +CONFIG_SERIAL_8250_EXTENDED=y +# CONFIG_SERIAL_8250_MANY_PORTS is not set +# CONFIG_SERIAL_8250_RSA is not set +CONFIG_SERIAL_8250_SHARE_IRQ=y +CONFIG_SERIAL_OF_PLATFORM=y +# CONFIG_SERIAL_QE is not set +# CONFIG_SIMPLE_GPIO is not set +# CONFIG_SLOW_WORK is not set +# CONFIG_SMP is not set +# CONFIG_SQUASHFS is not set +CONFIG_TASK_SIZE=0xc0000000 +# CONFIG_TAU is not set +CONFIG_TICK_ONESHOT=y +CONFIG_TRACING_SUPPORT=y +# CONFIG_UCC_GETH is not set +# CONFIG_UDBG_RTAS_CONSOLE is not set +# CONFIG_WATCHDOG_RTAS is not set +CONFIG_WORD_SIZE=32 +# CONFIG_YAFFS_9BYTE_TAGS is not set +# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set +CONFIG_YAFFS_AUTO_YAFFS2=y +# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set +# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set +# CONFIG_YAFFS_DOES_ECC is not set +CONFIG_YAFFS_FS=y +CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y +CONFIG_YAFFS_YAFFS1=y +CONFIG_YAFFS_YAFFS2=y diff --git a/target/linux/mpc83xx/image/Makefile b/target/linux/mpc83xx/image/Makefile new file mode 100644 index 000000000..1483786e8 --- /dev/null +++ b/target/linux/mpc83xx/image/Makefile @@ -0,0 +1,31 @@ +# +# Copyright (C) 2009 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + + +define Image/Prepare +endef + +define Image/BuildKernel + cp $(LINUX_DIR)/arch/powerpc/boot/dtbImage.rb600.elf $(BIN_DIR)/openwrt-$(BOARD)-rb600.elf +endef + +define Image/Build + $(call Image/Build/$(1),$(1)) +endef + +define Image/Build/squashfs + $(call prepare_generic_squashfs,$(KDIR)/root.squashfs) + ( \ + dd if=$(LINUX_DIR)/arch/powerpc/boot/uImage bs=1920k conv=sync; \ + dd if=$(KDIR)/openwrt-canyonlands.dtb bs=128k conv=sync; \ + dd if=$(KDIR)/root.$(1) bs=256k conv=sync; \ + ) > $(BIN_DIR)/openwrt-$(BOARD)-canyonlands-$(1).img +endef + +$(eval $(call BuildImage)) diff --git a/target/linux/mpc83xx/patches/001-rb600.patch b/target/linux/mpc83xx/patches/001-rb600.patch new file mode 100644 index 000000000..233723090 --- /dev/null +++ b/target/linux/mpc83xx/patches/001-rb600.patch @@ -0,0 +1,1976 @@ +--- /dev/null ++++ b/arch/powerpc/boot/dts/rb600.dts +@@ -0,0 +1,242 @@ ++/* ++ * RouterBOARD 600 series Device Tree Source ++ * ++ * Copyright 2009 Michael Guntsche ++ * ++ * 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 of the License, or (at your ++ * option) any later version. ++ */ ++ ++/dts-v1/; ++ ++/ { ++ model = "RB600"; ++ compatible = "MPC83xx"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ aliases { ++ ethernet0 = &enet0; ++ ethernet1 = &enet1; ++ }; ++ ++ chosen { ++ linux,stdout-path = "/soc8343@e0000000/serial@4500"; ++ }; ++ ++ cpus { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ PowerPC,8343E@0 { ++ device_type = "cpu"; ++ reg = <0x0>; ++ d-cache-line-size = <0x20>; ++ i-cache-line-size = <0x20>; ++ d-cache-size = <0x8000>; ++ i-cache-size = <0x8000>; ++ timebase-frequency = <0x0000000>; // filled by the bootwrapper from the firmware blob ++ clock-frequency = <0x00000000>; // filled by the bootwrapper from the firmware blob ++ }; ++ }; ++ ++ memory { ++ device_type = "memory"; ++ reg = <0x0 0x0000000>; // filled by the bootwrapper from the firmware blob ++ }; ++ ++ cf@f9200000 { ++ lb-timings = <0x5dc 0x3e8 0x1194 0x5dc 0x2af8>; ++ interrupt-at-level = <0x0>; ++ interrupt-parent = <&ipic>; ++ interrupts = <0x16 0x8>; ++ lbc_extra_divider = <0x1>; ++ reg = <0xf9200000 0x200000>; ++ device_type = "rb,cf"; ++ }; ++ ++ cf@f9000000 { ++ lb-timings = <0x5dc 0x3e8 0x1194 0x5dc 0x2af8>; ++ interrupt-at-level = <0x0>; ++ interrupt-parent = <&ipic>; ++ interrupts = <0x14 0x8>; ++ lbc_extra_divider = <0x1>; ++ reg = <0xf9000000 0x200000>; ++ device_type = "rb,cf"; ++ }; ++ ++ flash { ++ reg = <0xff800000 0x20000>; ++ }; ++ ++ nnand { ++ reg = <0xf0000000 0x1000>; ++ }; ++ ++ nand { ++ ale = <&gpio 0x6>; ++ cle = <&gpio 0x5>; ++ nce = <&gpio 0x4>; ++ rdy = <&gpio 0x3>; ++ reg = <0xf8000000 0x1000>; ++ device_type = "rb,nand"; ++ }; ++ ++ fancon { ++ interrupt-parent = <&ipic>; ++ interrupts = <0x17 0x8>; ++ sense = <&gpio 0x7>; ++ fan_on = <&gpio 0x9>; ++ }; ++ ++ pci0: pci@e0008500 { ++ device_type = "pci"; ++ compatible = "fsl,mpc8349-pci"; ++ reg = <0xe0008500 0x100 0xe0008300 0x8>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ #interrupt-cells = <1>; ++ ranges = <0x2000000 0x0 0x80000000 0x80000000 0x0 0x20000000 0x1000000 0x0 0x0 0xd0000000 0x0 0x4000000>; ++ bus-range = <0x0 0x0>; ++ interrupt-map = < ++ 0x5800 0x0 0x0 0x1 &ipic 0x15 0x8 ++ 0x6000 0x0 0x0 0x1 &ipic 0x30 0x8 ++ 0x6000 0x0 0x0 0x2 &ipic 0x11 0x8 ++ 0x6800 0x0 0x0 0x1 &ipic 0x11 0x8 ++ 0x6800 0x0 0x0 0x2 &ipic 0x12 0x8 ++ 0x7000 0x0 0x0 0x1 &ipic 0x12 0x8 ++ 0x7000 0x0 0x0 0x2 &ipic 0x13 0x8 ++ 0x7800 0x0 0x0 0x1 &ipic 0x13 0x8 ++ 0x7800 0x0 0x0 0x2 &ipic 0x30 0x8 ++ 0x8000 0x0 0x0 0x1 &ipic 0x30 0x8 ++ 0x8000 0x0 0x0 0x2 &ipic 0x12 0x8 ++ 0x8000 0x0 0x0 0x3 &ipic 0x11 0x8 ++ 0x8000 0x0 0x0 0x4 &ipic 0x13 0x8 ++ 0xa000 0x0 0x0 0x1 &ipic 0x30 0x8 ++ 0xa000 0x0 0x0 0x2 &ipic 0x11 0x8 ++ 0xa000 0x0 0x0 0x3 &ipic 0x12 0x8 ++ 0xa000 0x0 0x0 0x4 &ipic 0x13 0x8 ++ 0xa800 0x0 0x0 0x1 &ipic 0x11 0x8 ++ 0xa800 0x0 0x0 0x2 &ipic 0x12 0x8 ++ 0xa800 0x0 0x0 0x3 &ipic 0x13 0x8 ++ 0xa800 0x0 0x0 0x4 &ipic 0x30 0x8>; ++ interrupt-map-mask = <0xf800 0x0 0x0 0x7>; ++ interrupt-parent = <&ipic>; ++ }; ++ ++ soc8343@e0000000 { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ device_type = "soc"; ++ compatible = "simple-bus"; ++ ranges = <0x0 0xe0000000 0x100000>; ++ reg = <0xe0000000 0x200>; ++ bus-frequency = <0x1>; ++ ++ led { ++ user_led = <0x400 0x8>; ++ }; ++ ++ beeper { ++ reg = <0x500 0x100>; ++ }; ++ ++ gpio: gpio@0 { ++ reg = <0xc08 0x4>; ++ device-id = <0x0>; ++ compatible = "gpio"; ++ device_type = "gpio"; ++ }; ++ ++ enet0: ethernet@25000 { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ cell-index = <0>; ++ phy-handle = <&phy0>; ++ tbi-handle = <&tbi0>; ++ interrupt-parent = <&ipic>; ++ interrupts = <0x23 0x8 0x24 0x8 0x25 0x8>; ++ local-mac-address = [00 00 00 00 00 00]; ++ reg = <0x25000 0x1000>; ++ ranges = <0x0 0x25000 0x1000>; ++ compatible = "gianfar"; ++ model = "TSEC"; ++ device_type = "network"; ++ ++ mdio@520 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "fsl,gianfar-tbi"; ++ reg = <0x520 0x20>; ++ ++ tbi0: tbi-phy@11 { ++ reg = <0x11>; ++ device_type = "tbi-phy"; ++ }; ++ }; ++ }; ++ ++ enet1: ethernet@24000 { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ cell-index = <1>; ++ phy-handle = <&phy1>; ++ tbi-handle = <&tbi1>; ++ interrupt-parent = <&ipic>; ++ interrupts = <0x20 0x8 0x21 0x8 0x22 0x8>; ++ local-mac-address = [00 00 00 00 00 00]; ++ reg = <0x24000 0x1000>; ++ ranges = <0x0 0x24000 0x1000>; ++ compatible = "gianfar"; ++ model = "TSEC"; ++ device_type = "network"; ++ ++ mdio@520 { ++ #size-cells = <0x0>; ++ #address-cells = <0x1>; ++ reg = <0x520 0x20>; ++ compatible = "fsl,gianfar-mdio"; ++ ++ phy0: ethernet-phy@0 { ++ device_type = "ethernet-phy"; ++ reg = <0x0>; ++ }; ++ ++ phy1: ethernet-phy@1 { ++ device_type = "ethernet-phy"; ++ reg = <0x1>; ++ }; ++ ++ tbi1: tbi-phy@11 { ++ reg = <0x11>; ++ device_type = "tbi-phy"; ++ }; ++ }; ++ }; ++ ++ ipic: pic@700 { ++ interrupt-controller; ++ #address-cells = <0>; ++ #interrupt-cells = <2>; ++ reg = <0x700 0x100>; ++ device_type = "ipic"; ++ }; ++ ++ serial@4500 { ++ interrupt-parent = <&ipic>; ++ interrupts = <0x9 0x8>; ++ clock-frequency = <0xfe4f840>; ++ reg = <0x4500 0x100>; ++ compatible = "ns16550"; ++ device_type = "serial"; ++ }; ++ ++ wdt@200 { ++ reg = <0x200 0x100>; ++ compatible = "mpc83xx_wdt"; ++ device_type = "watchdog"; ++ }; ++ }; ++}; +--- a/arch/powerpc/boot/Makefile ++++ b/arch/powerpc/boot/Makefile +@@ -72,7 +72,7 @@ src-plat := of.c cuboot-52xx.c cuboot-82 + cuboot-pq2.c cuboot-sequoia.c treeboot-walnut.c \ + cuboot-bamboo.c cuboot-mpc7448hpc2.c cuboot-taishan.c \ + fixed-head.S ep88xc.c ep405.c cuboot-c2k.c \ +- cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \ ++ cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c rb600.c \ + cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \ + virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \ + cuboot-acadia.c cuboot-amigaone.c +@@ -229,6 +229,7 @@ image-$(CONFIG_MPC834x_ITX) += cuImage. + image-$(CONFIG_MPC834x_MDS) += cuImage.mpc834x_mds + image-$(CONFIG_MPC836x_MDS) += cuImage.mpc836x_mds + image-$(CONFIG_ASP834x) += dtbImage.asp834x-redboot ++image-$(CONFIG_RB_PPC) += dtbImage.rb600 + + # Board ports in arch/powerpc/platform/85xx/Kconfig + image-$(CONFIG_MPC8540_ADS) += cuImage.mpc8540ads +--- /dev/null ++++ b/arch/powerpc/boot/rb600.c +@@ -0,0 +1,80 @@ ++/* ++ * The RouterBOARD platform -- for booting RB600(A) RouterBOARDs. ++ * ++ * Author: Michael Guntsche ++ * ++ * Copyright (c) 2009 Michael Guntsche ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ */ ++ ++#include "ops.h" ++#include "types.h" ++#include "io.h" ++#include "stdio.h" ++#include ++ ++BSS_STACK(4*1024); ++ ++u64 memsize64; ++const void *fw_dtb; ++ ++static void rb600_fixups(void) ++{ ++ const u32 *reg, *timebase, *clock; ++ int node, size; ++ void *chosen; ++ const char* bootargs; ++ ++ dt_fixup_memory(0, memsize64); ++ ++ /* Set the MAC addresses. */ ++ node = fdt_path_offset(fw_dtb, "/soc8343@e0000000/ethernet@24000"); ++ reg = fdt_getprop(fw_dtb, node, "mac-address", &size); ++ dt_fixup_mac_address_by_alias("ethernet1", (const u8 *)reg); ++ ++ node = fdt_path_offset(fw_dtb, "/soc8343@e0000000/ethernet@25000"); ++ reg = fdt_getprop(fw_dtb, node, "mac-address", &size); ++ dt_fixup_mac_address_by_alias("ethernet0", (const u8 *)reg); ++ ++ /* Find the CPU timebase and clock frequencies. */ ++ node = fdt_node_offset_by_prop_value(fw_dtb, -1, "device_type", "cpu", sizeof("cpu")); ++ timebase = fdt_getprop(fw_dtb, node, "timebase-frequency", &size); ++ clock = fdt_getprop(fw_dtb, node, "clock-frequency", &size); ++ dt_fixup_cpu_clocks(*clock, *timebase, 0); ++ ++ /* Fixup chosen ++ * The bootloader reads the kernelparm segment and adds the content to ++ * bootargs. This is needed to specify root and other boot flags. ++ */ ++ chosen = finddevice("/chosen"); ++ node = fdt_path_offset(fw_dtb, "/chosen"); ++ bootargs = fdt_getprop(fw_dtb, node, "bootargs", &size); ++ setprop_str(chosen, "bootargs", bootargs); ++} ++ ++void platform_init(unsigned long r3, unsigned long r4, unsigned long r5, ++ unsigned long r6, unsigned long r7) ++{ ++ const u32 *reg; ++ int node, size; ++ ++ fw_dtb = (const void *)r3; ++ ++ /* Find the memory range. */ ++ node = fdt_node_offset_by_prop_value(fw_dtb, -1, "device_type", "memory", sizeof("memory")); ++ reg = fdt_getprop(fw_dtb, node, "reg", &size); ++ memsize64 = reg[1]; ++ ++ /* Now we have the memory size; initialize the heap. */ ++ simple_alloc_init(_end, memsize64 - (unsigned long)_end, 32, 64); ++ ++ /* Prepare the device tree and find the console. */ ++ fdt_init(_dtb_start); ++ serial_console_init(); ++ ++ /* Remaining fixups... */ ++ platform_ops.fixups = rb600_fixups; ++} +--- a/arch/powerpc/boot/wrapper ++++ b/arch/powerpc/boot/wrapper +@@ -201,7 +201,7 @@ ps3) + isection=.kernel:initrd + link_address='' + ;; +-ep88xc|ep405|ep8248e) ++ep88xc|ep405|ep8248e|rb600) + platformo="$object/fixed-head.o $object/$platform.o" + binary=y + ;; +--- a/arch/powerpc/kernel/Makefile ++++ b/arch/powerpc/kernel/Makefile +@@ -97,9 +97,11 @@ obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += f + + obj-$(CONFIG_8XX_MINIMAL_FPEMU) += softemu8xx.o + ++ifneq ($(CONFIG_RB_IOMAP),y) + ifneq ($(CONFIG_PPC_INDIRECT_IO),y) + obj-y += iomap.o + endif ++endif + + obj-$(CONFIG_PPC64) += $(obj64-y) + +--- a/arch/powerpc/platforms/83xx/Kconfig ++++ b/arch/powerpc/platforms/83xx/Kconfig +@@ -30,6 +30,15 @@ config MPC832x_RDB + help + This option enables support for the MPC8323 RDB board. + ++config RB_PPC ++ bool "MikroTik RouterBOARD 600 series" ++ select DEFAULT_UIMAGE ++ select QUICC_ENGINE ++ select PPC_MPC834x ++ select RB_IOMAP ++ help ++ This option enables support for MikroTik RouterBOARD 600 series boards. ++ + config MPC834x_MDS + bool "Freescale MPC834x MDS" + select DEFAULT_UIMAGE +--- a/arch/powerpc/platforms/83xx/Makefile ++++ b/arch/powerpc/platforms/83xx/Makefile +@@ -6,6 +6,7 @@ obj-$(CONFIG_SUSPEND) += suspend.o susp + obj-$(CONFIG_MCU_MPC8349EMITX) += mcu_mpc8349emitx.o + obj-$(CONFIG_MPC831x_RDB) += mpc831x_rdb.o + obj-$(CONFIG_MPC832x_RDB) += mpc832x_rdb.o ++obj-$(CONFIG_RB_PPC) += rbppc.o + obj-$(CONFIG_MPC834x_MDS) += mpc834x_mds.o + obj-$(CONFIG_MPC834x_ITX) += mpc834x_itx.o + obj-$(CONFIG_MPC836x_MDS) += mpc836x_mds.o +--- /dev/null ++++ b/arch/powerpc/platforms/83xx/rbppc.c +@@ -0,0 +1,316 @@ ++/* ++ * Copyright (C) 2008-2009 Noah Fontes ++ * Copyright (C) 2009 Michael Guntsche ++ * Copyright (C) Mikrotik 2007 ++ * ++ * 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 of the License, or (at your ++ * option) any later version. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "mpc83xx.h" ++ ++#define SYSCTL 0x100 ++#define SICRL 0x014 ++ ++#define GTCFR2 0x04 ++#define GTMDR4 0x22 ++#define GTRFR4 0x26 ++#define GTCNR4 0x2e ++#define GTVER4 0x36 ++#define GTPSR4 0x3e ++ ++#define GTCFR_BCM 0x40 ++#define GTCFR_STP4 0x20 ++#define GTCFR_RST4 0x10 ++#define GTCFR_STP3 0x02 ++#define GTCFR_RST3 0x01 ++ ++#define GTMDR_ORI 0x10 ++#define GTMDR_FRR 0x08 ++#define GTMDR_ICLK16 0x04 ++ ++extern int par_io_data_set(u8 port, u8 pin, u8 val); ++extern int par_io_config_pin(u8 port, u8 pin, int dir, int open_drain, ++ int assignment, int has_irq); ++ ++static unsigned timer_freq; ++static void *gtm; ++ ++static int beeper_irq; ++static unsigned beeper_gpio_pin[2]; ++ ++irqreturn_t rbppc_timer_irq(int irq, void *ptr) ++{ ++ static int toggle = 0; ++ ++ par_io_data_set(beeper_gpio_pin[0], beeper_gpio_pin[1], toggle); ++ toggle = !toggle; ++ ++ /* ack interrupt */ ++ out_be16(gtm + GTVER4, 3); ++ ++ return IRQ_HANDLED; ++} ++ ++void rbppc_beep(unsigned freq) ++{ ++ unsigned gtmdr; ++ ++ if (freq > 5000) freq = 5000; ++ ++ if (!gtm) ++ return; ++ if (!freq) { ++ out_8(gtm + GTCFR2, GTCFR_STP4 | GTCFR_STP3); ++ return; ++ } ++ ++ out_8(gtm + GTCFR2, GTCFR_RST4 | GTCFR_STP3); ++ out_be16(gtm + GTPSR4, 255); ++ gtmdr = GTMDR_FRR | GTMDR_ICLK16; ++ if (beeper_irq != NO_IRQ) gtmdr |= GTMDR_ORI; ++ out_be16(gtm + GTMDR4, gtmdr); ++ out_be16(gtm + GTVER4, 3); ++ ++ out_be16(gtm + GTRFR4, timer_freq / 16 / 256 / freq / 2); ++ out_be16(gtm + GTCNR4, 0); ++} ++EXPORT_SYMBOL(rbppc_beep); ++ ++static void __init rbppc_setup_arch(void) ++{ ++ struct device_node *np; ++ ++ np = of_find_node_by_type(NULL, "cpu"); ++ if (np) { ++ const unsigned *fp = of_get_property(np, "clock-frequency", NULL); ++ loops_per_jiffy = fp ? *fp / HZ : 0; ++ ++ of_node_put(np); ++ } ++ ++ np = of_find_node_by_name(NULL, "serial"); ++ if (np) { ++ timer_freq = ++ *(unsigned *) of_get_property(np, "clock-frequency", NULL); ++ of_node_put(np); ++ } ++ ++#ifdef CONFIG_PCI ++ np = of_find_node_by_type(NULL, "pci"); ++ if (np) { ++ mpc83xx_add_bridge(np); ++ } ++#endif ++ ++#ifdef CONFIG_QUICC_ENGINE ++ np = of_find_node_by_name(np, "par_io"); ++ if (np) { ++ qe_reset(); ++ par_io_init(np); ++ of_node_put(np); ++ ++ np = NULL; ++ while (1) { ++ np = of_find_node_by_name(np, "ucc"); ++ if (!np) break; ++ ++ par_io_of_config(np); ++ } ++ } ++#endif ++ ++} ++ ++void __init rbppc_init_IRQ(void) ++{ ++ struct device_node *np; ++ ++ np = of_find_node_by_type(NULL, "ipic"); ++ if (np) { ++ ipic_init(np, 0); ++ ipic_set_default_priority(); ++ of_node_put(np); ++ } ++ ++#ifdef CONFIG_QUICC_ENGINE ++ np = of_find_node_by_type(NULL, "qeic"); ++ if (np) { ++ qe_ic_init(np, 0, qe_ic_cascade_low_ipic, qe_ic_cascade_high_ipic); ++ of_node_put(np); ++ } ++#endif ++} ++ ++static int __init rbppc_probe(void) ++{ ++ char *model; ++ ++ model = of_get_flat_dt_prop(of_get_flat_dt_root(), "model", NULL); ++ ++ if (!model) ++ return 0; ++ ++ if (strcmp(model, "RB600") == 0) ++ return 1; ++ ++ return 0; ++} ++ ++static void __init rbppc_beeper_init(struct device_node *beeper) ++{ ++ struct resource res; ++ struct device_node *gpio; ++ const unsigned *pin; ++ const unsigned *gpio_id; ++ ++ if (of_address_to_resource(beeper, 0, &res)) { ++ printk(KERN_ERR "rbppc_beeper_init(%s): Beeper error: No region specified\n", beeper->full_name); ++ return; ++ } ++ ++ pin = of_get_property(beeper, "gpio", NULL); ++ if (pin) { ++ gpio = of_find_node_by_phandle(pin[0]); ++ ++ if (!gpio) { ++ printk(KERN_ERR "rbppc_beeper_init(%s): Beeper error: GPIO handle %x not found\n", beeper->full_name, pin[0]); ++ return; ++ } ++ ++ gpio_id = of_get_property(gpio, "device-id", NULL); ++ if (!gpio_id) { ++ printk(KERN_ERR "rbppc_beeper_init(%s): Beeper error: No device-id specified in GPIO\n", beeper->full_name); ++ return; ++ } ++ ++ beeper_gpio_pin[0] = *gpio_id; ++ beeper_gpio_pin[1] = pin[1]; ++ ++ par_io_config_pin(*gpio_id, pin[1], 1, 0, 0, 0); ++ } else { ++ void *sysctl; ++ ++ sysctl = ioremap_nocache(get_immrbase() + SYSCTL, 0x100); ++ out_be32(sysctl + SICRL, ++ in_be32(sysctl + SICRL) | (1 << (31 - 19))); ++ iounmap(sysctl); ++ } ++ ++ gtm = ioremap_nocache(res.start, res.end - res.start + 1); ++ ++ beeper_irq = irq_of_parse_and_map(beeper, 0); ++ if (beeper_irq != NO_IRQ) { ++ int e = request_irq(beeper_irq, rbppc_timer_irq, 0, "beeper", NULL); ++ if (e) { ++ printk(KERN_ERR "rbppc_beeper_init(%s): Request of beeper irq failed!\n", beeper->full_name); ++ } ++ } ++} ++ ++#define SBIT(x) (0x80000000 >> (x)) ++#define DBIT(x, y) ((y) << (32 - (((x % 16) + 1) * 2))) ++ ++#define SICRL_RB600(x) ((x) + (0x114 >> 2)) ++#define GPIO_DIR_RB600(x) ((x) + (0xc00 >> 2)) ++#define GPIO_DATA_RB600(x) ((x) + (0xc08 >> 2)) ++ ++static void rbppc_restart(char *cmd) ++{ ++ __be32 __iomem *reg; ++ ++ reg = ioremap(get_immrbase(), 0x1000); ++ local_irq_disable(); ++ out_be32(SICRL_RB600(reg), in_be32(SICRL_RB600(reg)) & ~0x00800000); ++ out_be32(GPIO_DIR_RB600(reg), in_be32(GPIO_DIR_RB600(reg)) | SBIT(2)); ++ out_be32(GPIO_DATA_RB600(reg), in_be32(GPIO_DATA_RB600(reg)) & ~SBIT(2)); ++ ++ while (1); ++} ++ ++static void rbppc_halt(void) ++{ ++ while (1); ++} ++ ++static struct of_device_id rbppc_ids[] = { ++ { .type = "soc", }, ++ { .compatible = "soc", }, ++ { .compatible = "simple-bus", }, ++ { .compatible = "gianfar", }, ++ { }, ++}; ++ ++static int __init rbppc_declare_of_platform_devices(void) ++{ ++ struct device_node *np; ++ unsigned idx; ++ ++ of_platform_bus_probe(NULL, rbppc_ids, NULL); ++ ++ np = of_find_node_by_type(NULL, "mdio"); ++ if (np) { ++ unsigned len; ++ unsigned *res; ++ const unsigned *eres; ++ struct device_node *ep; ++ ++ ep = of_find_compatible_node(NULL, "network", "ucc_geth"); ++ if (ep) { ++ eres = of_get_property(ep, "reg", &len); ++ res = (unsigned *) of_get_property(np, "reg", &len); ++ if (res && eres) { ++ res[0] = eres[0] + 0x120; ++ } ++ } ++ } ++ ++ np = of_find_node_by_name(NULL, "nand"); ++ if (np) { ++ of_platform_device_create(np, "nand", NULL); ++ } ++ ++ idx = 0; ++ for_each_node_by_type(np, "rb,cf") { ++ char dev_name[12]; ++ snprintf(dev_name, sizeof(dev_name), "cf.%u", idx); ++ of_platform_device_create(np, dev_name, NULL); ++ ++idx; ++ } ++ ++ np = of_find_node_by_name(NULL, "beeper"); ++ if (np) { ++ rbppc_beeper_init(np); ++ } ++ ++ return 0; ++} ++device_initcall(rbppc_declare_of_platform_devices); ++ ++define_machine(rb600) { ++ .name = "MikroTik RouterBOARD 600 series", ++ .probe = rbppc_probe, ++ .setup_arch = rbppc_setup_arch, ++ .init_IRQ = rbppc_init_IRQ, ++ .get_irq = ipic_get_irq, ++ .restart = rbppc_restart, ++ .halt = rbppc_halt, ++ .time_init = mpc83xx_time_init, ++ .calibrate_decr = generic_calibrate_decr, ++}; +--- a/arch/powerpc/platforms/Kconfig ++++ b/arch/powerpc/platforms/Kconfig +@@ -142,6 +142,10 @@ config GENERIC_IOMAP + bool + default n + ++config RB_IOMAP ++ bool ++ default y if RB_PPC ++ + source "drivers/cpufreq/Kconfig" + + menu "CPU Frequency drivers" +--- a/arch/powerpc/sysdev/Makefile ++++ b/arch/powerpc/sysdev/Makefile +@@ -50,3 +50,5 @@ obj-$(CONFIG_UCODE_PATCH) += micropatch. + ifeq ($(CONFIG_SUSPEND),y) + obj-$(CONFIG_6xx) += 6xx-suspend.o + endif ++ ++obj-$(CONFIG_RB_IOMAP) += rb_iomap.o +--- /dev/null ++++ b/arch/powerpc/sysdev/rb_iomap.c +@@ -0,0 +1,223 @@ ++#include ++#include ++#include ++#include ++ ++#define LOCALBUS_START 0x40000000 ++#define LOCALBUS_MASK 0x007fffff ++#define LOCALBUS_REGMASK 0x001fffff ++ ++static void __iomem *localbus_base; ++ ++static inline int is_localbus(void __iomem *addr) ++{ ++ return ((unsigned) addr & ~LOCALBUS_MASK) == LOCALBUS_START; ++} ++ ++static inline unsigned localbus_regoff(unsigned reg) { ++ return (reg << 16) | (((reg ^ 8) & 8) << 17); ++} ++ ++static inline void __iomem *localbus_addr(void __iomem *addr) ++{ ++ return localbus_base ++ + ((unsigned) addr & LOCALBUS_MASK & ~LOCALBUS_REGMASK) ++ + localbus_regoff((unsigned) addr & LOCALBUS_REGMASK); ++} ++ ++unsigned int ioread8(void __iomem *addr) ++{ ++ if (is_localbus(addr)) ++ return in_be16(localbus_addr(addr)) >> 8; ++ return readb(addr); ++} ++EXPORT_SYMBOL(ioread8); ++ ++unsigned int ioread16(void __iomem *addr) ++{ ++ if (is_localbus(addr)) ++ return le16_to_cpu(in_be16(localbus_addr(addr))); ++ return readw(addr); ++} ++EXPORT_SYMBOL(ioread16); ++ ++unsigned int ioread16be(void __iomem *addr) ++{ ++ return in_be16(addr); ++} ++EXPORT_SYMBOL(ioread16be); ++ ++unsigned int ioread32(void __iomem *addr) ++{ ++ return readl(addr); ++} ++EXPORT_SYMBOL(ioread32); ++ ++unsigned int ioread32be(void __iomem *addr) ++{ ++ return in_be32(addr); ++} ++EXPORT_SYMBOL(ioread32be); ++ ++void iowrite8(u8 val, void __iomem *addr) ++{ ++ if (is_localbus(addr)) ++ out_be16(localbus_addr(addr), ((u16) val) << 8); ++ else ++ writeb(val, addr); ++} ++EXPORT_SYMBOL(iowrite8); ++ ++void iowrite16(u16 val, void __iomem *addr) ++{ ++ if (is_localbus(addr)) ++ out_be16(localbus_addr(addr), cpu_to_le16(val)); ++ else ++ writew(val, addr); ++} ++EXPORT_SYMBOL(iowrite16); ++ ++void iowrite16be(u16 val, void __iomem *addr) ++{ ++ out_be16(addr, val); ++} ++EXPORT_SYMBOL(iowrite16be); ++ ++void iowrite32(u32 val, void __iomem *addr) ++{ ++ writel(val, addr); ++} ++EXPORT_SYMBOL(iowrite32); ++ ++void iowrite32be(u32 val, void __iomem *addr) ++{ ++ out_be32(addr, val); ++} ++EXPORT_SYMBOL(iowrite32be); ++ ++void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) ++{ ++ if (is_localbus(addr)) { ++ unsigned i; ++ void *laddr = localbus_addr(addr); ++ u8 *buf = dst; ++ ++ for (i = 0; i < count; ++i) { ++ *buf++ = in_be16(laddr) >> 8; ++ } ++ } else { ++ _insb((u8 __iomem *) addr, dst, count); ++ } ++} ++EXPORT_SYMBOL(ioread8_rep); ++ ++void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) ++{ ++ if (is_localbus(addr)) { ++ unsigned i; ++ void *laddr = localbus_addr(addr); ++ u16 *buf = dst; ++ ++ for (i = 0; i < count; ++i) { ++ *buf++ = in_be16(laddr); ++ } ++ } else { ++ _insw_ns((u16 __iomem *) addr, dst, count); ++ } ++} ++EXPORT_SYMBOL(ioread16_rep); ++ ++void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) ++{ ++ _insl_ns((u32 __iomem *) addr, dst, count); ++} ++EXPORT_SYMBOL(ioread32_rep); ++ ++void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) ++{ ++ if (is_localbus(addr)) { ++ unsigned i; ++ void *laddr = localbus_addr(addr); ++ const u8 *buf = src; ++ ++ for (i = 0; i < count; ++i) { ++ out_be16(laddr, ((u16) *buf++) << 8); ++ } ++ } else { ++ _outsb((u8 __iomem *) addr, src, count); ++ } ++} ++EXPORT_SYMBOL(iowrite8_rep); ++ ++void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) ++{ ++ if (is_localbus(addr)) { ++ unsigned i; ++ void *laddr = localbus_addr(addr); ++ const u16 *buf = src; ++ ++ for (i = 0; i < count; ++i) { ++ out_be16(laddr, *buf++); ++ } ++ } else { ++ _outsw_ns((u16 __iomem *) addr, src, count); ++ } ++} ++EXPORT_SYMBOL(iowrite16_rep); ++ ++void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) ++{ ++ _outsl_ns((u32 __iomem *) addr, src, count); ++} ++EXPORT_SYMBOL(iowrite32_rep); ++ ++void __iomem *ioport_map(unsigned long port, unsigned int len) ++{ ++ return (void __iomem *) (port + _IO_BASE); ++} ++EXPORT_SYMBOL(ioport_unmap); ++ ++void ioport_unmap(void __iomem *addr) ++{ ++ /* Nothing to do */ ++} ++EXPORT_SYMBOL(ioport_map); ++ ++void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) ++{ ++ unsigned long start = pci_resource_start(dev, bar); ++ unsigned long len = pci_resource_len(dev, bar); ++ unsigned long flags = pci_resource_flags(dev, bar); ++ ++ if (!len) ++ return NULL; ++ if (max && len > max) ++ len = max; ++ if (flags & IORESOURCE_IO) ++ return ioport_map(start, len); ++ if (flags & IORESOURCE_MEM) ++ return ioremap(start, len); ++ /* What? */ ++ return NULL; ++} ++EXPORT_SYMBOL(pci_iomap); ++ ++void pci_iounmap(struct pci_dev *dev, void __iomem *addr) ++{ ++ /* Nothing to do */ ++} ++EXPORT_SYMBOL(pci_iounmap); ++ ++void __iomem *localbus_map(unsigned long addr, unsigned int len) ++{ ++ if (!localbus_base) ++ localbus_base = ioremap(addr & ~LOCALBUS_MASK, ++ LOCALBUS_MASK + 1); ++ return (void *) (LOCALBUS_START + (addr & LOCALBUS_MASK)); ++} ++EXPORT_SYMBOL(localbus_map); ++ ++void localbus_unmap(void __iomem *addr) ++{ ++} ++EXPORT_SYMBOL(localbus_unmap); +--- a/drivers/ata/Kconfig ++++ b/drivers/ata/Kconfig +@@ -734,5 +734,12 @@ config PATA_BF54X + + If unsure, say N. + ++config PATA_RB_PPC ++ tristate "MikroTik RB600 PATA support" ++ depends on RB_PPC ++ help ++ This option enables support for PATA devices on MikroTik RouterBOARD ++ 600 series boards. ++ + endif # ATA_SFF + endif # ATA +--- a/drivers/ata/Makefile ++++ b/drivers/ata/Makefile +@@ -73,6 +73,7 @@ obj-$(CONFIG_PATA_OCTEON_CF) += pata_oct + obj-$(CONFIG_PATA_PLATFORM) += pata_platform.o + obj-$(CONFIG_PATA_OF_PLATFORM) += pata_of_platform.o + obj-$(CONFIG_PATA_ICSIDE) += pata_icside.o ++obj-$(CONFIG_PATA_RB_PPC) += pata_rbppc_cf.o + # Should be last but two libata driver + obj-$(CONFIG_PATA_ACPI) += pata_acpi.o + # Should be last but one libata driver +--- /dev/null ++++ b/drivers/ata/pata_rbppc_cf.c +@@ -0,0 +1,701 @@ ++/* ++ * Copyright (C) 2008-2009 Noah Fontes ++ * Copyright (C) Mikrotik 2007 ++ * ++ * 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 of the License, or (at your ++ * option) any later version. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define DEBUG_UPM 0 ++ ++#define DRV_NAME "pata_rbppc_cf" ++#define DRV_VERSION "0.0.2" ++ ++#define DEV2SEL_OFFSET 0x00100000 ++ ++#define IMMR_LBCFG_OFFSET 0x00005000 ++#define IMMR_LBCFG_SIZE 0x00001000 ++ ++#define LOCAL_BUS_MCMR 0x00000078 ++#define MxMR_OP_MASK 0x30000000 ++#define MxMR_OP_NORMAL 0x00000000 ++#define MxMR_OP_WRITE 0x10000000 ++#define MxMR_OP_READ 0x20000000 ++#define MxMR_OP_RUN 0x30000000 ++#define MxMR_LUPWAIT_LOW 0x08000000 ++#define MxMR_LUPWAIT_HIGH 0x00000000 ++#define MxMR_LUPWAIT_ENABLE 0x00040000 ++#define MxMR_RLF_MASK 0x0003c000 ++#define MxMR_RLF_SHIFT 14 ++#define MxMR_WLF_MASK 0x00003c00 ++#define MxMR_WLF_SHIFT 10 ++#define MxMR_MAD_MASK 0x0000003f ++#define LOCAL_BUS_MDR 0x00000088 ++#define LOCAL_BUS_LCRR 0x000000D4 ++#define LCRR_CLKDIV_MASK 0x0000000f ++ ++#define LOOP_SIZE 4 ++ ++#define UPM_READ_SINGLE_OFFSET 0x00 ++#define UPM_WRITE_SINGLE_OFFSET 0x18 ++#define UPM_DATA_SIZE 0x40 ++ ++#define LBT_CPUIN_MIN 0 ++#define LBT_CPUOUT_MIN 1 ++#define LBT_CPUOUT_MAX 2 ++#define LBT_EXTDEL_MIN 3 ++#define LBT_EXTDEL_MAX 4 ++#define LBT_SIZE 5 ++ ++/* UPM machine configuration bits */ ++#define N_BASE 0x00f00000 ++#define N_CS 0xf0000000 ++#define N_CS_H1 0xc0000000 ++#define N_CS_H2 0x30000000 ++#define N_WE 0x0f000000 ++#define N_WE_H1 0x0c000000 ++#define N_WE_H2 0x03000000 ++#define N_OE 0x00030000 ++#define N_OE_H1 0x00020000 ++#define N_OE_H2 0x00010000 ++#define WAEN 0x00001000 ++#define REDO_2 0x00000100 ++#define REDO_3 0x00000200 ++#define REDO_4 0x00000300 ++#define LOOP 0x00000080 ++#define NA 0x00000008 ++#define UTA 0x00000004 ++#define LAST 0x00000001 ++ ++#define REDO_VAL(mult) (REDO_2 * ((mult) - 1)) ++#define REDO_MAX_MULT 4 ++ ++#define READ_BASE (N_BASE | N_WE) ++#define WRITE_BASE (N_BASE | N_OE) ++#define EMPTY (N_BASE | N_CS | N_OE | N_WE | LAST) ++ ++#define EOF_UPM_SETTINGS 0 ++#define ANOTHER_TIMING 1 ++ ++#define OA_CPUIN_MIN 0x01 ++#define OA_CPUOUT_MAX 0x02 ++#define OD_CPUOUT_MIN 0x04 ++#define OA_CPUOUT_DELTA 0x06 ++#define OA_EXTDEL_MAX 0x08 ++#define OD_EXTDEL_MIN 0x10 ++#define OA_EXTDEL_DELTA 0x18 ++#define O_MIN_CYCLE_TIME 0x20 ++#define O_MINUS_PREV 0x40 ++#define O_HALF_CYCLE 0x80 ++ ++extern void __iomem *localbus_map(unsigned long addr, unsigned int len); ++extern void localbus_unmap(void __iomem *addr); ++ ++struct rbppc_cf_info { ++ unsigned lbcfg_addr; ++ unsigned clk_time_ps; ++ int cur_mode; ++ u32 lb_timings[LBT_SIZE]; ++}; ++static struct rbppc_cf_info *rbinfo = NULL; ++ ++struct upm_setting { ++ unsigned value; ++ unsigned ns[7]; ++ unsigned clk_minus; ++ unsigned group_size; ++ unsigned options; ++}; ++ ++static const struct upm_setting cfUpmReadSingle[] = { ++ { READ_BASE | N_OE, ++ /* t1 - ADDR setup time */ ++ { 70, 50, 30, 30, 25, 15, 10 }, 0, 0, (OA_CPUOUT_DELTA | ++ OA_EXTDEL_MAX) }, ++ { READ_BASE | N_OE_H1, ++ { 0, 0, 0, 0, 0, 0, 0 }, 0, 0, O_HALF_CYCLE }, ++ { READ_BASE, ++ /* t2 - OE0 time */ ++ { 290, 290, 290, 80, 70, 65, 55 }, 0, 2, (OA_CPUOUT_MAX | ++ OA_CPUIN_MIN) }, ++ { READ_BASE | WAEN, ++ { 1, 1, 1, 1, 1, 0, 0 }, 0, 0, 0 }, ++ { READ_BASE | UTA, ++ { 1, 1, 1, 1, 1, 1, 1 }, 0, 0, 0 }, ++ { READ_BASE | N_OE, ++ /* t9 - ADDR hold time */ ++ { 20, 15, 10, 10, 10, 10, 10 }, 0, 0, (OA_CPUOUT_DELTA | ++ OD_EXTDEL_MIN) }, ++ { READ_BASE | N_OE | N_CS_H2, ++ { 0, 0, 0, 0, 0, 0, 0 }, 0, 0, O_HALF_CYCLE }, ++ { READ_BASE | N_OE | N_CS, ++ /* t6Z -IORD data tristate */ ++ { 30, 30, 30, 30, 30, 20, 20 }, 1, 1, O_MINUS_PREV }, ++ { ANOTHER_TIMING, ++ /* t2i -IORD recovery time */ ++ { 0, 0, 0, 70, 25, 25, 20 }, 2, 0, 0 }, ++ { ANOTHER_TIMING, ++ /* CS 0 -> 1 MAX */ ++ { 0, 0, 0, 0, 0, 0, 0 }, 1, 0, (OA_CPUOUT_DELTA | ++ OA_EXTDEL_MAX) }, ++ { READ_BASE | N_OE | N_CS | LAST, ++ { 1, 1, 1, 1, 1, 1, 1 }, 0, 0, 0 }, ++ { EOF_UPM_SETTINGS, ++ /* min total cycle time - includes turnaround and ALE cycle */ ++ { 600, 383, 240, 180, 120, 100, 80 }, 2, 0, O_MIN_CYCLE_TIME }, ++}; ++ ++static const struct upm_setting cfUpmWriteSingle[] = { ++ { WRITE_BASE | N_WE, ++ /* t1 - ADDR setup time */ ++ { 70, 50, 30, 30, 25, 15, 10 }, 0, 0, (OA_CPUOUT_DELTA | ++ OA_EXTDEL_MAX) }, ++ { WRITE_BASE | N_WE_H1, ++ { 0, 0, 0, 0, 0, 0, 0 }, 0, 0, O_HALF_CYCLE }, ++ { WRITE_BASE, ++ /* t2 - WE0 time */ ++ { 290, 290, 290, 80, 70, 65, 55 }, 0, 1, OA_CPUOUT_DELTA }, ++ { WRITE_BASE | WAEN, ++ { 1, 1, 1, 1, 1, 0, 0 }, 0, 0, 0 }, ++ { WRITE_BASE | N_WE, ++ /* t9 - ADDR hold time */ ++ { 20, 15, 10, 10, 10, 10, 10 }, 0, 0, (OA_CPUOUT_DELTA | ++ OD_EXTDEL_MIN) }, ++ { WRITE_BASE | N_WE | N_CS_H2, ++ { 0, 0, 0, 0, 0, 0, 0 }, 0, 0, O_HALF_CYCLE }, ++ { WRITE_BASE | N_WE | N_CS, ++ /* t4 - DATA hold time */ ++ { 30, 20, 15, 10, 10, 10, 10 }, 0, 1, O_MINUS_PREV }, ++ { ANOTHER_TIMING, ++ /* t2i -IOWR recovery time */ ++ { 0, 0, 0, 70, 25, 25, 20 }, 1, 0, 0 }, ++ { ANOTHER_TIMING, ++ /* CS 0 -> 1 MAX */ ++ { 0, 0, 0, 0, 0, 0, 0 }, 0, 0, (OA_CPUOUT_DELTA | ++ OA_EXTDEL_MAX) }, ++ { WRITE_BASE | N_WE | N_CS | UTA | LAST, ++ { 1, 1, 1, 1, 1, 1, 1 }, 0, 0, 0 }, ++ /* min total cycle time - includes ALE cycle */ ++ { EOF_UPM_SETTINGS, ++ { 600, 383, 240, 180, 120, 100, 80 }, 1, 0, O_MIN_CYCLE_TIME }, ++}; ++ ++static u8 rbppc_cf_check_status(struct ata_port *ap) { ++ u8 val = ioread8(ap->ioaddr.status_addr); ++ if (val == 0xF9) ++ val = 0x7F; ++ return val; ++} ++ ++static u8 rbppc_cf_check_altstatus(struct ata_port *ap) { ++ u8 val = ioread8(ap->ioaddr.altstatus_addr); ++ if (val == 0xF9) ++ val = 0x7F; ++ return val; ++} ++ ++static void rbppc_cf_dummy_noret(struct ata_port *ap) { } ++static int rbppc_cf_dummy_ret0(struct ata_port *ap) { return 0; } ++ ++static int ps2clk(int ps, unsigned clk_time_ps) { ++ int psMaxOver; ++ if (ps <= 0) return 0; ++ ++ /* round down if <= 2% over clk border, but no more than 1/4 clk cycle */ ++ psMaxOver = ps * 2 / 100; ++ if (4 * psMaxOver > clk_time_ps) { ++ psMaxOver = clk_time_ps / 4; ++ } ++ return (ps + clk_time_ps - 1 - psMaxOver) / clk_time_ps; ++} ++ ++static int upm_gen_ps_table(const struct upm_setting *upm, ++ int mode, struct rbppc_cf_info *info, ++ int *psFinal) { ++ int uidx; ++ int lastUpmValIdx = 0; ++ int group_start_idx = -1; ++ int group_left_num = -1; ++ int clk_time_ps = info->clk_time_ps; ++ ++ for (uidx = 0; upm[uidx].value != EOF_UPM_SETTINGS; ++uidx) { ++ const struct upm_setting *us = upm + uidx; ++ unsigned opt = us->options; ++ int ps = us->ns[mode] * 1000 - us->clk_minus * clk_time_ps; ++ ++ if (opt & OA_CPUIN_MIN) ps += info->lb_timings[LBT_CPUIN_MIN]; ++ if (opt & OD_CPUOUT_MIN) ps -= info->lb_timings[LBT_CPUOUT_MIN]; ++ if (opt & OA_CPUOUT_MAX) ps += info->lb_timings[LBT_CPUOUT_MAX]; ++ if (opt & OD_EXTDEL_MIN) ps -= info->lb_timings[LBT_EXTDEL_MIN]; ++ if (opt & OA_EXTDEL_MAX) ps += info->lb_timings[LBT_EXTDEL_MAX]; ++ ++ if (us->value == ANOTHER_TIMING) { ++ /* use longest timing from alternatives */ ++ if (psFinal[lastUpmValIdx] < ps) { ++ psFinal[lastUpmValIdx] = ps; ++ } ++ ps = 0; ++ } ++ else { ++ if (us->group_size) { ++ group_start_idx = uidx; ++ group_left_num = us->group_size; ++ } ++ else if (group_left_num > 0) { ++ /* group time is divided on all group members */ ++ int clk = ps2clk(ps, clk_time_ps); ++ psFinal[group_start_idx] -= clk * clk_time_ps; ++ --group_left_num; ++ } ++ if ((opt & O_MINUS_PREV) && lastUpmValIdx > 0) { ++ int clk = ps2clk(psFinal[lastUpmValIdx], ++ clk_time_ps); ++ ps -= clk * clk_time_ps; ++ } ++ lastUpmValIdx = uidx; ++ } ++ psFinal[uidx] = ps; ++ } ++ return uidx; ++} ++ ++static int free_half(int ps, int clk, int clk_time_ps) { ++ if (clk < 2) return 0; ++ return (clk * clk_time_ps - ps) * 2 >= clk_time_ps; ++} ++ ++static void upm_gen_clk_table(const struct upm_setting *upm, ++ int mode, int clk_time_ps, ++ int max_uidx, const int *psFinal, int *clkFinal) { ++ int clk_cycle_time; ++ int clk_total; ++ int uidx; ++ ++ /* convert picoseconds to clocks */ ++ clk_total = 0; ++ for (uidx = 0; uidx < max_uidx; ++uidx) { ++ int clk = ps2clk(psFinal[uidx], clk_time_ps); ++ clkFinal[uidx] = clk; ++ clk_total += clk; ++ } ++ ++ /* check possibility of half cycle usage */ ++ for (uidx = 1; uidx < max_uidx - 1; ++uidx) { ++ if ((upm[uidx].options & O_HALF_CYCLE) && ++ free_half(psFinal[uidx - 1], clkFinal[uidx - 1], ++ clk_time_ps) && ++ free_half(psFinal[uidx + 1], clkFinal[uidx + 1], ++ clk_time_ps)) { ++ ++clkFinal[uidx]; ++ --clkFinal[uidx - 1]; ++ --clkFinal[uidx + 1]; ++ } ++ } ++ ++ if ((upm[max_uidx].options & O_MIN_CYCLE_TIME) == 0) return; ++ ++ /* check cycle time, adjust timings if needed */ ++ clk_cycle_time = (ps2clk(upm[max_uidx].ns[mode] * 1000, clk_time_ps) - ++ upm[max_uidx].clk_minus); ++ uidx = 0; ++ while (clk_total < clk_cycle_time) { ++ /* extend all timings in round-robin to match cycle time */ ++ if (clkFinal[uidx]) { ++#if DEBUG_UPM ++ printk(KERN_INFO "extending %u by 1 clk\n", uidx); ++#endif ++ ++clkFinal[uidx]; ++ ++clk_total; ++ } ++ ++uidx; ++ if (uidx == max_uidx) uidx = 0; ++ } ++} ++ ++static void add_data_val(unsigned val, int *clkLeft, int maxClk, ++ unsigned *data, int *dataIdx) { ++ if (*clkLeft == 0) return; ++ ++ if (maxClk == 0 && *clkLeft >= LOOP_SIZE * 2) { ++ int times; ++ int times1; ++ int times2; ++ ++ times = *clkLeft / LOOP_SIZE; ++ if (times > REDO_MAX_MULT * 2) times = REDO_MAX_MULT * 2; ++ times1 = times / 2; ++ times2 = times - times1; ++ ++ val |= LOOP; ++ data[*dataIdx] = val | REDO_VAL(times1); ++ ++(*dataIdx); ++ data[*dataIdx] = val | REDO_VAL(times2); ++ ++(*dataIdx); ++ ++ *clkLeft -= times * LOOP_SIZE; ++ return; ++ } ++ ++ if (maxClk < 1 || maxClk > REDO_MAX_MULT) maxClk = REDO_MAX_MULT; ++ if (*clkLeft < maxClk) maxClk = *clkLeft; ++ ++ *clkLeft -= maxClk; ++ val |= REDO_VAL(maxClk); ++ ++ data[*dataIdx] = val; ++ ++(*dataIdx); ++} ++ ++static int upm_gen_final_data(const struct upm_setting *upm, ++ int max_uidx, int *clkFinal, unsigned *data) { ++ int dataIdx; ++ int uidx; ++ ++ dataIdx = 0; ++ for (uidx = 0; uidx < max_uidx; ++uidx) { ++ int clk = clkFinal[uidx]; ++ while (clk > 0) { ++ add_data_val(upm[uidx].value, &clk, 0, ++ data, &dataIdx); ++ } ++ } ++ return dataIdx; ++} ++ ++static int conv_upm_table(const struct upm_setting *upm, ++ int mode, struct rbppc_cf_info *info, ++ unsigned *data) { ++#if DEBUG_UPM ++ int uidx; ++#endif ++ int psFinal[32]; ++ int clkFinal[32]; ++ int max_uidx; ++ int data_len; ++ ++ max_uidx = upm_gen_ps_table(upm, mode, info, psFinal); ++ ++ upm_gen_clk_table(upm, mode, info->clk_time_ps, max_uidx, ++ psFinal, clkFinal); ++ ++#if DEBUG_UPM ++ /* dump out debug info */ ++ for (uidx = 0; uidx < max_uidx; ++uidx) { ++ if (clkFinal[uidx]) { ++ printk(KERN_INFO "idx %d val %08x clk %d ps %d\n", ++ uidx, upm[uidx].value, ++ clkFinal[uidx], psFinal[uidx]); ++ } ++ } ++#endif ++ ++ data_len = upm_gen_final_data(upm, max_uidx, clkFinal, data); ++ ++#if DEBUG_UPM ++ for (uidx = 0; uidx < data_len; ++uidx) { ++ printk(KERN_INFO "cf UPM x result: idx %d val %08x\n", ++ uidx, data[uidx]); ++ } ++#endif ++ return 0; ++} ++ ++static int gen_upm_data(int mode, struct rbppc_cf_info *info, unsigned *data) { ++ int i; ++ ++ for (i = 0; i < UPM_DATA_SIZE; ++i) { ++ data[i] = EMPTY; ++ } ++ ++ if (conv_upm_table(cfUpmReadSingle, mode, info, data + UPM_READ_SINGLE_OFFSET)) { ++ return -1; ++ } ++ if (conv_upm_table(cfUpmWriteSingle, mode, info, data + UPM_WRITE_SINGLE_OFFSET)) { ++ return -1; ++ } ++ return 0; ++} ++ ++static void rbppc_cf_program_upm(void *upmMemAddr, volatile void *lbcfg_mxmr, volatile void *lbcfg_mdr, const unsigned *upmData, unsigned offset, unsigned len) { ++ unsigned i; ++ unsigned mxmr; ++ ++ mxmr = in_be32(lbcfg_mxmr); ++ mxmr &= ~(MxMR_OP_MASK | MxMR_MAD_MASK); ++ mxmr |= (MxMR_OP_WRITE | offset); ++ out_be32(lbcfg_mxmr, mxmr); ++ in_be32(lbcfg_mxmr); /* flush MxMR write */ ++ ++ for (i = 0; i < len; ++i) { ++ int to; ++ unsigned data = upmData[i + offset]; ++ out_be32(lbcfg_mdr, data); ++ in_be32(lbcfg_mdr); /* flush MDR write */ ++ ++ iowrite8(1, upmMemAddr); /* dummy write to any CF addr */ ++ ++ /* wait for dummy write to complete */ ++ for (to = 10000; to >= 0; --to) { ++ mxmr = in_be32(lbcfg_mxmr); ++ if (((mxmr ^ (i + 1)) & MxMR_MAD_MASK) == 0) { ++ break; ++ } ++ if (to == 0) { ++ printk(KERN_ERR "rbppc_cf_program_upm: UPMx program error at 0x%x: Timeout\n", i); ++ } ++ } ++ } ++ mxmr &= ~(MxMR_OP_MASK | MxMR_RLF_MASK | MxMR_WLF_MASK); ++ mxmr |= (MxMR_OP_NORMAL | (LOOP_SIZE << MxMR_RLF_SHIFT) | (LOOP_SIZE << MxMR_WLF_SHIFT)); ++ out_be32(lbcfg_mxmr, mxmr); ++} ++ ++static int rbppc_cf_update_piomode(struct ata_port *ap, int mode) { ++ struct rbppc_cf_info *info = (struct rbppc_cf_info *)ap->host->private_data; ++ void *lbcfgBase; ++ unsigned upmData[UPM_DATA_SIZE]; ++ ++ if (gen_upm_data(mode, info, upmData)) { ++ return -1; ++ } ++ ++ lbcfgBase = ioremap_nocache(info->lbcfg_addr, IMMR_LBCFG_SIZE); ++ ++ rbppc_cf_program_upm(ap->ioaddr.cmd_addr, ((char *)lbcfgBase) + LOCAL_BUS_MCMR, ((char *)lbcfgBase) + LOCAL_BUS_MDR, upmData, 0, UPM_DATA_SIZE); ++ iounmap(lbcfgBase); ++ return 0; ++} ++ ++static void rbppc_cf_set_piomode(struct ata_port *ap, struct ata_device *adev) ++{ ++ struct rbppc_cf_info *info = (struct rbppc_cf_info *)ap->host->private_data; ++ int mode = adev->pio_mode - XFER_PIO_0; ++ ++ DPRINTK("rbppc_cf_set_piomode: PIO %d\n", mode); ++ if (mode < 0) mode = 0; ++ if (mode > 6) mode = 6; ++ ++ if (info->cur_mode < 0 || info->cur_mode > mode) { ++ if (rbppc_cf_update_piomode(ap, mode) == 0) { ++ printk(KERN_INFO "rbppc_cf_set_piomode: PIO mode changed to %d\n", mode); ++ info->cur_mode = mode; ++ } ++ } ++} ++ ++static struct scsi_host_template rbppc_cf_sht = { ++ ATA_BASE_SHT(DRV_NAME), ++}; ++ ++static struct ata_port_operations rbppc_cf_port_ops = { ++ .inherits = &ata_bmdma_port_ops, ++ ++ .sff_check_status = rbppc_cf_check_status, ++ .sff_check_altstatus = rbppc_cf_check_altstatus, ++ ++ .set_piomode = rbppc_cf_set_piomode, ++ ++ .port_start = rbppc_cf_dummy_ret0, ++ ++ .sff_irq_clear = rbppc_cf_dummy_noret, ++}; ++ ++static int rbppc_cf_init_info(struct of_device *pdev, struct rbppc_cf_info *info) { ++ struct device_node *np; ++ struct resource res; ++ const u32 *u32ptr; ++ void *lbcfgBase; ++ void *lbcfg_lcrr; ++ unsigned lbc_clk_khz; ++ unsigned lbc_extra_divider = 1; ++ unsigned ccb_freq_hz; ++ unsigned lb_div; ++ ++ u32ptr = of_get_property(pdev->node, "lbc_extra_divider", NULL); ++ if (u32ptr && *u32ptr) { ++ lbc_extra_divider = *u32ptr; ++#if DEBUG_UPM ++ printk(KERN_INFO "rbppc_cf_init_info: LBC extra divider %u\n", ++ lbc_extra_divider); ++#endif ++ } ++ ++ np = of_find_node_by_type(NULL, "serial"); ++ if (!np) { ++ printk(KERN_ERR "rbppc_cf_init_info: No serial node found\n"); ++ return -1; ++ } ++ u32ptr = of_get_property(np, "clock-frequency", NULL); ++ if (u32ptr == 0 || *u32ptr == 0) { ++ printk(KERN_ERR "rbppc_cf_init_info: Serial does not have clock-frequency\n"); ++ of_node_put(np); ++ return -1; ++ } ++ ccb_freq_hz = *u32ptr; ++ of_node_put(np); ++ ++ np = of_find_node_by_type(NULL, "soc"); ++ if (!np) { ++ printk(KERN_ERR "rbppc_cf_init_info: No soc node found\n"); ++ return -1; ++ } ++ if (of_address_to_resource(np, 0, &res)) { ++ printk(KERN_ERR "rbppc_cf_init_info: soc does not have resource\n"); ++ of_node_put(np); ++ return -1; ++ } ++ info->lbcfg_addr = res.start + IMMR_LBCFG_OFFSET; ++ of_node_put(np); ++ ++ lbcfgBase = ioremap_nocache(info->lbcfg_addr, IMMR_LBCFG_SIZE); ++ lbcfg_lcrr = ((char*)lbcfgBase) + LOCAL_BUS_LCRR; ++ lb_div = (in_be32(lbcfg_lcrr) & LCRR_CLKDIV_MASK) * lbc_extra_divider; ++ iounmap(lbcfgBase); ++ ++ lbc_clk_khz = ccb_freq_hz / (1000 * lb_div); ++ info->clk_time_ps = 1000000000 / lbc_clk_khz; ++ printk(KERN_INFO "rbppc_cf_init_info: Using Local-Bus clock %u kHz %u ps\n", ++ lbc_clk_khz, info->clk_time_ps); ++ ++ u32ptr = of_get_property(pdev->node, "lb-timings", NULL); ++ if (u32ptr) { ++ memcpy(info->lb_timings, u32ptr, LBT_SIZE * sizeof(*u32ptr)); ++#if DEBUG_UPM ++ printk(KERN_INFO "rbppc_cf_init_info: Got LB timings <%u %u %u %u %u>\n", ++ u32ptr[0], u32ptr[1], u32ptr[2], u32ptr[3], u32ptr[4]); ++#endif ++ } ++ info->cur_mode = -1; ++ return 0; ++} ++ ++static int rbppc_cf_probe(struct of_device *pdev, ++ const struct of_device_id *match) ++{ ++ struct ata_host *host; ++ struct ata_port *ap; ++ struct rbppc_cf_info *info = NULL; ++ struct resource res; ++ void *baddr; ++ const u32 *u32ptr; ++ int irq_level = 0; ++ int err = -ENOMEM; ++ ++ printk(KERN_INFO "rbppc_cf_probe: MikroTik RouterBOARD 600 series Compact Flash PATA driver, version " DRV_VERSION "\n"); ++ ++ if (rbinfo == NULL) { ++ info = kmalloc(sizeof(*info), GFP_KERNEL); ++ if (info == NULL) { ++ printk(KERN_ERR "rbppc_cf_probe: Out of memory\n"); ++ goto err_info; ++ } ++ memset(info, 0, sizeof(*info)); ++ ++ if (rbppc_cf_init_info(pdev, info)) { ++ goto err_info; ++ } ++ rbinfo = info; ++ } ++ ++ u32ptr = of_get_property(pdev->node, "interrupt-at-level", NULL); ++ if (u32ptr) { ++ irq_level = *u32ptr; ++ printk(KERN_INFO "rbppc_cf_probe: IRQ level %u\n", irq_level); ++ } ++ ++ if (of_address_to_resource(pdev->node, 0, &res)) { ++ printk(KERN_ERR "rbppc_cf_probe: No reg property found\n"); ++ goto err_info; ++ } ++ ++ host = ata_host_alloc(&pdev->dev, 1); ++ if (!host) ++ goto err_info; ++ ++ baddr = localbus_map(res.start, res.end - res.start + 1); ++ host->iomap = baddr; ++ host->private_data = rbinfo; ++ ++ ap = host->ports[0]; ++ ap->ops = &rbppc_cf_port_ops; ++ ap->pio_mask = 0x7F; /* PIO modes 0-6 */ ++ ap->flags = ATA_FLAG_NO_LEGACY; ++ ap->mwdma_mask = 0; ++ ++ ap->ioaddr.cmd_addr = baddr; ++ ata_sff_std_ports(&ap->ioaddr); ++ ap->ioaddr.ctl_addr = ap->ioaddr.cmd_addr + 14; ++ ap->ioaddr.altstatus_addr = ap->ioaddr.ctl_addr; ++ ap->ioaddr.bmdma_addr = 0; ++ ++ err = ata_host_activate( ++ host, ++ irq_of_parse_and_map(pdev->node, 0), ata_sff_interrupt, ++ irq_level ? IRQF_TRIGGER_HIGH : IRQF_TRIGGER_LOW, ++ &rbppc_cf_sht); ++ if (!err) return 0; ++ ++ localbus_unmap(baddr); ++err_info: ++ if (info) { ++ kfree(info); ++ rbinfo = NULL; ++ } ++ return err; ++} ++ ++static int rbppc_cf_remove(struct of_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct ata_host *host = dev_get_drvdata(dev); ++ ++ if (host == NULL) return -1; ++ ++ ata_host_detach(host); ++ return 0; ++} ++ ++static struct of_device_id rbppc_cf_ids[] = { ++ { .name = "cf", }, ++ { }, ++}; ++ ++static struct of_platform_driver rbppc_cf_driver = { ++ .name = "cf", ++ .probe = rbppc_cf_probe, ++ .remove = rbppc_cf_remove, ++ .match_table = rbppc_cf_ids, ++ .driver = { ++ .name = "rbppc-cf", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static int __init rbppc_init(void) ++{ ++ return of_register_platform_driver(&rbppc_cf_driver); ++} ++ ++static void __exit rbppc_exit(void) ++{ ++ of_unregister_platform_driver(&rbppc_cf_driver); ++} ++ ++MODULE_AUTHOR("Mikrotikls SIA"); ++MODULE_AUTHOR("Noah Fontes"); ++MODULE_DESCRIPTION("MikroTik RouterBOARD 600 series Compact Flash PATA driver"); ++MODULE_LICENSE("GPL"); ++MODULE_VERSION(DRV_VERSION); ++ ++module_init(rbppc_init); ++module_exit(rbppc_exit); +--- a/drivers/mtd/nand/Kconfig ++++ b/drivers/mtd/nand/Kconfig +@@ -380,6 +380,13 @@ config MTD_NAND_PLATFORM + devices. You will need to provide platform-specific functions + via platform_data. + ++config MTD_NAND_RB_PPC ++ tristate "MikroTik RB600 NAND support" ++ depends on MTD_NAND && MTD_PARTITIONS && RB_PPC ++ help ++ This option enables support for the NAND device on MikroTik ++ RouterBOARD 600 series boards. ++ + config MTD_ALAUDA + tristate "MTD driver for Olympus MAUSB-10 and Fujifilm DPC-R1" + depends on MTD_NAND && USB +--- a/drivers/mtd/nand/Makefile ++++ b/drivers/mtd/nand/Makefile +@@ -30,6 +30,7 @@ obj-$(CONFIG_MTD_NAND_BASLER_EXCITE) += + obj-$(CONFIG_MTD_NAND_PXA3xx) += pxa3xx_nand.o + obj-$(CONFIG_MTD_NAND_TMIO) += tmio_nand.o + obj-$(CONFIG_MTD_NAND_PLATFORM) += plat_nand.o ++obj-$(CONFIG_MTD_NAND_RB_PPC) += rbppc_nand.o + obj-$(CONFIG_MTD_ALAUDA) += alauda.o + obj-$(CONFIG_MTD_NAND_PASEMI) += pasemi_nand.o + obj-$(CONFIG_MTD_NAND_ORION) += orion_nand.o +--- /dev/null ++++ b/drivers/mtd/nand/rbppc_nand.c +@@ -0,0 +1,252 @@ ++/* ++ * Copyright (C) 2008-2009 Noah Fontes ++ * Copyright (C) 2009 Michael Guntsche ++ * Copyright (C) Mikrotik 2007 ++ * ++ * 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 of the License, or (at your ++ * option) any later version. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define DRV_NAME "rbppc_nand" ++#define DRV_VERSION "0.0.2" ++ ++static struct mtd_info rmtd; ++static struct nand_chip rnand; ++ ++struct rbppc_nand_info { ++ void *gpi; ++ void *gpo; ++ void *localbus; ++ ++ unsigned gpio_rdy; ++ unsigned gpio_nce; ++ unsigned gpio_cle; ++ unsigned gpio_ale; ++ unsigned gpio_ctrls; ++}; ++ ++/* We must use the OOB layout from yaffs 1 if we want this to be recognized ++ * properly. Borrowed from the OpenWRT patches for the RB532. ++ * ++ * See for more details. ++ */ ++static struct nand_ecclayout rbppc_nand_oob_16 = { ++ .eccbytes = 6, ++ .eccpos = { 8, 9, 10, 13, 14, 15 }, ++ .oobavail = 9, ++ .oobfree = { { 0, 4 }, { 6, 2 }, { 11, 2 }, { 4, 1 } } ++}; ++ ++static struct mtd_partition rbppc_nand_partition_info[] = { ++ { ++ name: "RouterBOARD NAND Boot", ++ offset: 0, ++ size: 4 * 1024 * 1024, ++ }, ++ { ++ name: "RouterBOARD NAND Main", ++ offset: MTDPART_OFS_NXTBLK, ++ size: MTDPART_SIZ_FULL, ++ }, ++}; ++ ++static int rbppc_nand_dev_ready(struct mtd_info *mtd) { ++ struct nand_chip *chip = mtd->priv; ++ struct rbppc_nand_info *priv = chip->priv; ++ ++ return in_be32(priv->gpi) & priv->gpio_rdy; ++} ++ ++static void rbppc_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) { ++ struct nand_chip *chip = mtd->priv; ++ struct rbppc_nand_info *priv = chip->priv; ++ ++ if (ctrl & NAND_CTRL_CHANGE) { ++ unsigned val = in_be32(priv->gpo); ++ if (!(val & priv->gpio_nce)) { ++ /* make sure Local Bus has done NAND operations */ ++ readb(priv->localbus); ++ } ++ ++ if (ctrl & NAND_CLE) { ++ val |= priv->gpio_cle; ++ } else { ++ val &= ~priv->gpio_cle; ++ } ++ if (ctrl & NAND_ALE) { ++ val |= priv->gpio_ale; ++ } else { ++ val &= ~priv->gpio_ale; ++ } ++ if (!(ctrl & NAND_NCE)) { ++ val |= priv->gpio_nce; ++ } else { ++ val &= ~priv->gpio_nce; ++ } ++ out_be32(priv->gpo, val); ++ ++ /* make sure GPIO output has changed */ ++ val ^= in_be32(priv->gpo); ++ if (val & priv->gpio_ctrls) { ++ printk(KERN_ERR "rbppc_nand_hwcontrol: NAND GPO change failed 0x%08x\n", val); ++ } ++ } ++ ++ if (cmd != NAND_CMD_NONE) writeb(cmd, chip->IO_ADDR_W); ++} ++ ++static void rbppc_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) ++{ ++ struct nand_chip *chip = mtd->priv; ++ memcpy(buf, chip->IO_ADDR_R, len); ++} ++ ++static unsigned init_ok = 0; ++ ++static int rbppc_nand_probe(struct of_device *pdev, ++ const struct of_device_id *match) ++{ ++ struct device_node *gpio; ++ struct device_node *nnand; ++ struct resource res; ++ struct rbppc_nand_info *info; ++ void *baddr; ++ const unsigned *rdy, *nce, *cle, *ale; ++ ++ printk(KERN_INFO "rbppc_nand_probe: MikroTik RouterBOARD 600 series NAND driver, version " DRV_VERSION "\n"); ++ ++ info = kmalloc(sizeof(*info), GFP_KERNEL); ++ ++ rdy = of_get_property(pdev->node, "rdy", NULL); ++ nce = of_get_property(pdev->node, "nce", NULL); ++ cle = of_get_property(pdev->node, "cle", NULL); ++ ale = of_get_property(pdev->node, "ale", NULL); ++ ++ if (!rdy || !nce || !cle || !ale) { ++ printk(KERN_ERR "rbppc_nand_probe: GPIO properties are missing\n"); ++ goto err; ++ } ++ if (rdy[0] != nce[0] || rdy[0] != cle[0] || rdy[0] != ale[0]) { ++ printk(KERN_ERR "rbppc_nand_probe: Different GPIOs are not supported\n"); ++ goto err; ++ } ++ ++ gpio = of_find_node_by_phandle(rdy[0]); ++ if (!gpio) { ++ printk(KERN_ERR "rbppc_nand_probe: No GPIO<%x> node found\n", *rdy); ++ goto err; ++ } ++ if (of_address_to_resource(gpio, 0, &res)) { ++ printk(KERN_ERR "rbppc_nand_probe: No reg property in GPIO found\n"); ++ goto err; ++ } ++ info->gpo = ioremap_nocache(res.start, res.end - res.start + 1); ++ ++ if (!of_address_to_resource(gpio, 1, &res)) { ++ info->gpi = ioremap_nocache(res.start, res.end - res.start + 1); ++ } else { ++ info->gpi = info->gpo; ++ } ++ of_node_put(gpio); ++ ++ info->gpio_rdy = 1 << (31 - rdy[1]); ++ info->gpio_nce = 1 << (31 - nce[1]); ++ info->gpio_cle = 1 << (31 - cle[1]); ++ info->gpio_ale = 1 << (31 - ale[1]); ++ info->gpio_ctrls = info->gpio_nce | info->gpio_cle | info->gpio_ale; ++ ++ nnand = of_find_node_by_name(NULL, "nnand"); ++ if (!nnand) { ++ printk("rbppc_nand_probe: No nNAND found\n"); ++ goto err; ++ } ++ if (of_address_to_resource(nnand, 0, &res)) { ++ printk("rbppc_nand_probe: No reg property in nNAND found\n"); ++ goto err; ++ } ++ of_node_put(nnand); ++ info->localbus = ioremap_nocache(res.start, res.end - res.start + 1); ++ ++ if (of_address_to_resource(pdev->node, 0, &res)) { ++ printk("rbppc_nand_probe: No reg property found\n"); ++ goto err; ++ } ++ baddr = ioremap_nocache(res.start, res.end - res.start + 1); ++ ++ memset(&rnand, 0, sizeof(rnand)); ++ rnand.cmd_ctrl = rbppc_nand_cmd_ctrl; ++ rnand.dev_ready = rbppc_nand_dev_ready; ++ rnand.read_buf = rbppc_nand_read_buf; ++ rnand.IO_ADDR_W = baddr; ++ rnand.IO_ADDR_R = baddr; ++ rnand.priv = info; ++ ++ memset(&rmtd, 0, sizeof(rmtd)); ++ rnand.ecc.mode = NAND_ECC_SOFT; ++ rnand.ecc.layout = &rbppc_nand_oob_16; ++ rnand.chip_delay = 25; ++ rnand.options |= NAND_NO_AUTOINCR; ++ rmtd.priv = &rnand; ++ rmtd.owner = THIS_MODULE; ++ ++ if (nand_scan(&rmtd, 1) && nand_scan(&rmtd, 1) && nand_scan(&rmtd, 1) && nand_scan(&rmtd, 1)) { ++ printk(KERN_ERR "rbppc_nand_probe: RouterBOARD NAND device not found\n"); ++ return -ENXIO; ++ } ++ ++ add_mtd_partitions(&rmtd, rbppc_nand_partition_info, 2); ++ init_ok = 1; ++ return 0; ++ ++err: ++ kfree(info); ++ return -1; ++} ++ ++static struct of_device_id rbppc_nand_ids[] = { ++ { .name = "nand", }, ++ { }, ++}; ++ ++static struct of_platform_driver rbppc_nand_driver = { ++ .name = "nand", ++ .probe = rbppc_nand_probe, ++ .match_table = rbppc_nand_ids, ++ .driver = { ++ .name = "rbppc-nand", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++static int __init rbppc_nand_init(void) ++{ ++ return of_register_platform_driver(&rbppc_nand_driver); ++} ++ ++static void __exit rbppc_nand_exit(void) ++{ ++ of_unregister_platform_driver(&rbppc_nand_driver); ++} ++ ++MODULE_AUTHOR("Mikrotikls SIA"); ++MODULE_AUTHOR("Noah Fontes"); ++MODULE_AUTHOR("Michael Guntsche"); ++MODULE_DESCRIPTION("MikroTik RouterBOARD 600 series NAND driver"); ++MODULE_LICENSE("GPL"); ++MODULE_VERSION(DRV_VERSION); ++ ++module_init(rbppc_nand_init); ++module_exit(rbppc_nand_exit); From 860aac31e7b9162a68e051491b7a92be76d4a3ed Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 10 Nov 2009 00:22:07 +0000 Subject: [PATCH 122/288] [rdc] convert profiles to become subtargets, compile tested only git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18354 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/rdc/Makefile | 3 +- target/linux/rdc/amit/config-2.6.30 | 300 ++++++++++++++ target/linux/rdc/amit/target.mk | 2 + target/linux/rdc/ar525w/config-2.6.30 | 305 ++++++++++++++ target/linux/rdc/ar525w/target.mk | 2 + target/linux/rdc/config/profile-ar525w | 6 - target/linux/rdc/config/profile-dir450 | 532 ------------------------- target/linux/rdc/config/profile-r8610 | 8 - target/linux/rdc/dir-450/config-2.6.30 | 300 ++++++++++++++ target/linux/rdc/dir-450/target.mk | 2 + target/linux/rdc/profiles/AMIT.mk | 13 - target/linux/rdc/profiles/AR525W.mk | 13 - target/linux/rdc/profiles/DIR-450.mk | 17 - target/linux/rdc/profiles/G-570S.mk | 13 - target/linux/rdc/profiles/R8610.mk | 16 - target/linux/rdc/profiles/WL-153.mk | 13 - target/linux/rdc/r8610/config-2.6.30 | 300 ++++++++++++++ target/linux/rdc/r8610/target.mk | 5 + 18 files changed, 1218 insertions(+), 632 deletions(-) create mode 100644 target/linux/rdc/amit/config-2.6.30 create mode 100644 target/linux/rdc/amit/target.mk create mode 100644 target/linux/rdc/ar525w/config-2.6.30 create mode 100644 target/linux/rdc/ar525w/target.mk delete mode 100644 target/linux/rdc/config/profile-ar525w delete mode 100644 target/linux/rdc/config/profile-dir450 delete mode 100644 target/linux/rdc/config/profile-r8610 create mode 100644 target/linux/rdc/dir-450/config-2.6.30 create mode 100644 target/linux/rdc/dir-450/target.mk delete mode 100644 target/linux/rdc/profiles/AMIT.mk delete mode 100644 target/linux/rdc/profiles/AR525W.mk delete mode 100644 target/linux/rdc/profiles/DIR-450.mk delete mode 100644 target/linux/rdc/profiles/G-570S.mk delete mode 100644 target/linux/rdc/profiles/R8610.mk delete mode 100644 target/linux/rdc/profiles/WL-153.mk create mode 100644 target/linux/rdc/r8610/config-2.6.30 create mode 100644 target/linux/rdc/r8610/target.mk diff --git a/target/linux/rdc/Makefile b/target/linux/rdc/Makefile index 09b81c8ab..c4bfd66c0 100644 --- a/target/linux/rdc/Makefile +++ b/target/linux/rdc/Makefile @@ -11,12 +11,13 @@ BOARD:=rdc BOARDNAME:=RDC 321x FEATURES:=squashfs jffs2 pci usb pcmcia CFLAGS:=-Os -pipe -march=i486 -funit-at-a-time +SUBTARGETS:=amit ar525w r8610 dir-450 LINUX_VERSION:=2.6.30.9 include $(INCLUDE_DIR)/target.mk -DEFAULT_PACKAGES += hostapd-mini kmod-rdc321x-wdt +DEFAULT_PACKAGES += hostapd-mini kmod-rdc321x-wdt kmod-r6040 define Target/Description Build firmware images for RDC321x based routers diff --git a/target/linux/rdc/amit/config-2.6.30 b/target/linux/rdc/amit/config-2.6.30 new file mode 100644 index 000000000..81ec1c57a --- /dev/null +++ b/target/linux/rdc/amit/config-2.6.30 @@ -0,0 +1,300 @@ +# CONFIG_4KSTACKS is not set +# CONFIG_60XX_WDT is not set +# CONFIG_64BIT is not set +# CONFIG_ACQUIRE_WDT is not set +# CONFIG_ADVANTECH_WDT is not set +# CONFIG_AGP is not set +# CONFIG_ALIM1535_WDT is not set +CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" +CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y +CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y +CONFIG_ARCH_HAS_CPU_RELAX=y +CONFIG_ARCH_HAS_DEFAULT_IDLE=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_MAY_HAVE_PC_FDC=y +# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set +CONFIG_ARCH_POPULATES_NODE_MAP=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y +# CONFIG_ARCH_SUPPORTS_MSI is not set +CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_WANT_FRAME_POINTERS=y +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +# CONFIG_ARPD is not set +# CONFIG_AUDIT_ARCH is not set +# CONFIG_BASE_FULL is not set +CONFIG_BASE_SMALL=1 +# CONFIG_BINARY_PRINTF is not set +CONFIG_BITREVERSE=y +# CONFIG_BLK_DEV_INITRD is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=16 +CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_BOUNCE=y +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +# CONFIG_CC_STACKPROTECTOR is not set +CONFIG_CLOCKSOURCE_WATCHDOG=y +CONFIG_CMDLINE="console=ttyS0,38400 rootfstype=squashfs,jffs2" +CONFIG_CMDLINE_BOOL=y +# CONFIG_CMDLINE_OVERRIDE is not set +# CONFIG_COMPAT_NET_DEV_OPS is not set +# CONFIG_COMPAT_VDSO is not set +# CONFIG_CPU5_WDT is not set +# CONFIG_CPU_FREQ is not set +# CONFIG_CPU_SUP_AMD is not set +# CONFIG_CPU_SUP_CENTAUR is not set +# CONFIG_CPU_SUP_CYRIX_32 is not set +# CONFIG_CPU_SUP_INTEL is not set +# CONFIG_CPU_SUP_TRANSMETA_32 is not set +# CONFIG_CPU_SUP_UMC_32 is not set +# CONFIG_CS5535_GPIO is not set +# CONFIG_DCDBAS is not set +# CONFIG_DEBUG_BUGVERBOSE is not set +# CONFIG_DEBUG_FS is not set +CONFIG_DECOMPRESS_LZMA=y +CONFIG_DEFAULT_IO_DELAY_TYPE=0 +# CONFIG_DELL_RBU is not set +CONFIG_DEVPORT=y +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_DMI is not set +CONFIG_DOUBLEFAULT=y +# CONFIG_EARLY_PRINTK is not set +# CONFIG_EDAC is not set +# CONFIG_EDD is not set +# CONFIG_EUROTECH_WDT is not set +CONFIG_FAST_CMPXCHG_LOCAL=y +# CONFIG_FIRMWARE_MEMMAP is not set +CONFIG_FIX_EARLYCON_MEM=y +# CONFIG_FRAME_POINTER is not set +# CONFIG_FTRACE_SYSCALLS is not set +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CMOS_UPDATE=y +# CONFIG_GENERIC_CPU is not set +CONFIG_GENERIC_FIND_FIRST_BIT=y +CONFIG_GENERIC_FIND_LAST_BIT=y +CONFIG_GENERIC_FIND_NEXT_BIT=y +CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y +CONFIG_GENERIC_IOMAP=y +CONFIG_GENERIC_ISA_DMA=y +# CONFIG_GENERIC_TIME_VSYSCALL is not set +# CONFIG_GEN_RTC is not set +# CONFIG_HAMRADIO is not set +# CONFIG_HANGCHECK_TIMER is not set +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +CONFIG_HAVE_AOUT=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_ATOMIC_IOMAP=y +# CONFIG_HAVE_CPUMASK_OF_CPU_MAP is not set +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_DYNAMIC_PER_CPU_AREA=y +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FTRACE_SYSCALLS=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_IDE=y +CONFIG_HAVE_IOREMAP_PROT=y +CONFIG_HAVE_KERNEL_BZIP2=y +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_KVM=y +CONFIG_HAVE_KVM_IRQCHIP=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_HAVE_MLOCK=y +CONFIG_HAVE_MMIOTRACE_SUPPORT=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_SETUP_PER_CPU_AREA=y +CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y +# CONFIG_HIGHMEM4G is not set +# CONFIG_HIGHMEM64G is not set +# CONFIG_HIGH_RES_TIMERS is not set +# CONFIG_HPET_TIMER is not set +# CONFIG_HP_WATCHDOG is not set +# CONFIG_HUGETLBFS is not set +# CONFIG_HW_RANDOM is not set +CONFIG_HZ=250 +# CONFIG_HZ_100 is not set +CONFIG_HZ_250=y +# CONFIG_I2C is not set +# CONFIG_I6300ESB_WDT is not set +# CONFIG_I8K is not set +# CONFIG_IB700_WDT is not set +# CONFIG_IBMASR is not set +# CONFIG_IOMMU_API is not set +# CONFIG_IOMMU_HELPER is not set +CONFIG_IO_DELAY_0X80=y +# CONFIG_IO_DELAY_0XED is not set +# CONFIG_IO_DELAY_NONE is not set +CONFIG_IO_DELAY_TYPE_0X80=0 +CONFIG_IO_DELAY_TYPE_0XED=1 +CONFIG_IO_DELAY_TYPE_NONE=3 +CONFIG_IO_DELAY_TYPE_UDELAY=2 +# CONFIG_IO_DELAY_UDELAY is not set +# CONFIG_IP_MROUTE is not set +# CONFIG_ISA is not set +CONFIG_ISA_DMA_API=y +# CONFIG_ISCSI_IBFT_FIND is not set +# CONFIG_IT8712F_WDT is not set +# CONFIG_IT87_WDT is not set +# CONFIG_ITCO_WDT is not set +# CONFIG_JFFS2_SUMMARY is not set +# CONFIG_KERNEL_BZIP2 is not set +# CONFIG_KERNEL_GZIP is not set +CONFIG_KERNEL_LZMA=y +CONFIG_KTIME_SCALAR=y +CONFIG_LBD=y +# CONFIG_LEDS_ALIX2 is not set +# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set +# CONFIG_LEDS_TRIGGER_NETDEV is not set +# CONFIG_LEDS_TRIGGER_TIMER is not set +# CONFIG_M386 is not set +CONFIG_M486=y +# CONFIG_M586 is not set +# CONFIG_M586MMX is not set +# CONFIG_M586TSC is not set +# CONFIG_M686 is not set +# CONFIG_MACHZ_WDT is not set +# CONFIG_MACINTOSH_DRIVERS is not set +CONFIG_MATH_EMULATION=y +# CONFIG_MCA is not set +# CONFIG_MCORE2 is not set +# CONFIG_MCRUSOE is not set +# CONFIG_MCYRIXIII is not set +# CONFIG_MEFFICEON is not set +# CONFIG_MEMTEST is not set +# CONFIG_MGEODEGX1 is not set +# CONFIG_MGEODE_LX is not set +# CONFIG_MICROCODE is not set +# CONFIG_MK6 is not set +# CONFIG_MK7 is not set +# CONFIG_MK8 is not set +# CONFIG_MMIOTRACE is not set +CONFIG_MODULE_FORCE_UNLOAD=y +# CONFIG_MPENTIUM4 is not set +# CONFIG_MPENTIUMII is not set +# CONFIG_MPENTIUMIII is not set +# CONFIG_MPENTIUMM is not set +# CONFIG_MPSC is not set +# CONFIG_MTD_CFI_INTELEXT is not set +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +# CONFIG_MTD_NETSC520 is not set +CONFIG_MTD_PHYSMAP=y +# CONFIG_MTD_R8610 is not set +# CONFIG_MTD_RDC3210 is not set +# CONFIG_MTD_TS5500 is not set +# CONFIG_MTRR is not set +# CONFIG_MVIAC3_2 is not set +# CONFIG_MVIAC7 is not set +# CONFIG_MWINCHIP3D is not set +# CONFIG_MWINCHIPC6 is not set +# CONFIG_NATSEMI is not set +# CONFIG_NETDEV_1000 is not set +CONFIG_NOHIGHMEM=y +CONFIG_NR_CPUS=1 +# CONFIG_NSC_GPIO is not set +# CONFIG_NVRAM is not set +# CONFIG_OLPC is not set +# CONFIG_OPTIMIZE_INLINING is not set +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PAGE_OFFSET=0xC0000000 +# CONFIG_PARAVIRT_GUEST is not set +# CONFIG_PC8736x_GPIO is not set +# CONFIG_PC87413_WDT is not set +CONFIG_PCI=y +# CONFIG_PCIEPORTBUS is not set +CONFIG_PCI_BIOS=y +CONFIG_PCI_DIRECT=y +CONFIG_PCI_DISABLE_COMMON_QUIRKS=y +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_GOANY=y +# CONFIG_PCI_GOBIOS is not set +# CONFIG_PCI_GODIRECT is not set +# CONFIG_PCI_GOMMCONFIG is not set +# CONFIG_PCI_GOOLPC is not set +# CONFIG_PCI_QUIRKS is not set +# CONFIG_PCSPKR_PLATFORM is not set +CONFIG_PHYSICAL_ALIGN=0x100000 +CONFIG_PHYSICAL_START=0x100000 +# CONFIG_POWER_TRACER is not set +CONFIG_PROCESSOR_SELECT=y +# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set +CONFIG_RDC321X_WDT=m +# CONFIG_RELOCATABLE is not set +# CONFIG_RTC is not set +# CONFIG_RWSEM_GENERIC_SPINLOCK is not set +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +# CONFIG_SBC7240_WDT is not set +# CONFIG_SBC8360_WDT is not set +# CONFIG_SBC_EPX_C3_WATCHDOG is not set +# CONFIG_SC1200_WDT is not set +# CONFIG_SC520_WDT is not set +# CONFIG_SCHED_HRTICK is not set +CONFIG_SCHED_OMIT_FRAME_POINTER=y +# CONFIG_SCSI_DMA is not set +# CONFIG_SCx200 is not set +# CONFIG_SERIAL_8250_EXTENDED is not set +# CONFIG_SHMEM is not set +# CONFIG_SLOW_WORK is not set +# CONFIG_SMP is not set +# CONFIG_SMSC37B787_WDT is not set +# CONFIG_SMSC_SCH311X_WDT is not set +CONFIG_SPARSEMEM_STATIC=y +# CONFIG_STRICT_DEVMEM is not set +# CONFIG_SYSPROF_TRACER is not set +# CONFIG_TELCLOCK is not set +# CONFIG_TOSHIBA is not set +CONFIG_TRACING_SUPPORT=y +CONFIG_UID16=y +CONFIG_USB_SUPPORT=y +CONFIG_USER_STACKTRACE_SUPPORT=y +# CONFIG_VM86 is not set +# CONFIG_VMSPLIT_2G_OPT is not set +# CONFIG_VMSPLIT_3G_OPT is not set +# CONFIG_W83697UG_WDT is not set +# CONFIG_WAFER_WDT is not set +CONFIG_X86=y +CONFIG_X86_32=y +CONFIG_X86_32_LAZY_GS=y +# CONFIG_X86_64 is not set +CONFIG_X86_ALIGNMENT_16=y +CONFIG_X86_BSWAP=y +# CONFIG_X86_CHECK_BIOS_CORRUPTION is not set +CONFIG_X86_CMPXCHG=y +CONFIG_X86_CPU=y +# CONFIG_X86_CPUID is not set +# CONFIG_X86_CPU_DEBUG is not set +# CONFIG_X86_ELAN is not set +CONFIG_X86_EXTENDED_PLATFORM=y +CONFIG_X86_F00F_BUG=y +# CONFIG_X86_GENERIC is not set +CONFIG_X86_INTERNODE_CACHE_BYTES=64 +CONFIG_X86_INVLPG=y +CONFIG_X86_L1_CACHE_BYTES=64 +CONFIG_X86_L1_CACHE_SHIFT=4 +# CONFIG_X86_MCE is not set +CONFIG_X86_MINIMUM_CPU_FAMILY=4 +# CONFIG_X86_MSR is not set +# CONFIG_X86_PAE is not set +# CONFIG_X86_PLATFORM_DEVICES is not set +CONFIG_X86_POPAD_OK=y +# CONFIG_X86_PPRO_FENCE is not set +CONFIG_X86_RDC321X=y +CONFIG_X86_REBOOTFIXUPS=y +# CONFIG_X86_RESERVE_LOW_64K is not set +# CONFIG_X86_UP_APIC is not set +# CONFIG_X86_VERBOSE_BOOTUP is not set +CONFIG_X86_WP_WORKS_OK=y +CONFIG_X86_XADD=y +# CONFIG_ZONE_DMA32 is not set diff --git a/target/linux/rdc/amit/target.mk b/target/linux/rdc/amit/target.mk new file mode 100644 index 000000000..36fb97e1c --- /dev/null +++ b/target/linux/rdc/amit/target.mk @@ -0,0 +1,2 @@ +BOARDNAME:=Devices from AMIT +DEFAULT_PACKAGE+= kmod-usb-core kmod-usb-ohci kmod-usb2 diff --git a/target/linux/rdc/ar525w/config-2.6.30 b/target/linux/rdc/ar525w/config-2.6.30 new file mode 100644 index 000000000..c3ec46426 --- /dev/null +++ b/target/linux/rdc/ar525w/config-2.6.30 @@ -0,0 +1,305 @@ +# CONFIG_4KSTACKS is not set +# CONFIG_60XX_WDT is not set +# CONFIG_64BIT is not set +# CONFIG_ACQUIRE_WDT is not set +# CONFIG_ADVANTECH_WDT is not set +# CONFIG_AGP is not set +# CONFIG_ALIM1535_WDT is not set +CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" +CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y +CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y +CONFIG_ARCH_HAS_CPU_RELAX=y +CONFIG_ARCH_HAS_DEFAULT_IDLE=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_MAY_HAVE_PC_FDC=y +# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set +CONFIG_ARCH_POPULATES_NODE_MAP=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y +# CONFIG_ARCH_SUPPORTS_MSI is not set +CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_WANT_FRAME_POINTERS=y +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +# CONFIG_ARPD is not set +# CONFIG_AUDIT_ARCH is not set +# CONFIG_BASE_FULL is not set +CONFIG_BASE_SMALL=1 +# CONFIG_BINARY_PRINTF is not set +CONFIG_BITREVERSE=y +# CONFIG_BLK_DEV_INITRD is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=16 +CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_BOUNCE=y +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +# CONFIG_CC_STACKPROTECTOR is not set +CONFIG_CLOCKSOURCE_WATCHDOG=y +CONFIG_CMDLINE="console=ttyS0,38400 rootfstype=squashfs,jffs2" +CONFIG_CMDLINE_BOOL=y +# CONFIG_CMDLINE_OVERRIDE is not set +# CONFIG_COMPAT_NET_DEV_OPS is not set +# CONFIG_COMPAT_VDSO is not set +# CONFIG_CPU5_WDT is not set +# CONFIG_CPU_FREQ is not set +# CONFIG_CPU_SUP_AMD is not set +# CONFIG_CPU_SUP_CENTAUR is not set +# CONFIG_CPU_SUP_CYRIX_32 is not set +# CONFIG_CPU_SUP_INTEL is not set +# CONFIG_CPU_SUP_TRANSMETA_32 is not set +# CONFIG_CPU_SUP_UMC_32 is not set +# CONFIG_CS5535_GPIO is not set +# CONFIG_DCDBAS is not set +# CONFIG_DEBUG_BUGVERBOSE is not set +# CONFIG_DEBUG_FS is not set +CONFIG_DECOMPRESS_LZMA=y +CONFIG_DEFAULT_IO_DELAY_TYPE=0 +# CONFIG_DELL_RBU is not set +CONFIG_DEVPORT=y +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_DMI is not set +CONFIG_DOUBLEFAULT=y +# CONFIG_EARLY_PRINTK is not set +# CONFIG_EDAC is not set +# CONFIG_EDD is not set +# CONFIG_EUROTECH_WDT is not set +CONFIG_FAST_CMPXCHG_LOCAL=y +# CONFIG_FIRMWARE_MEMMAP is not set +CONFIG_FIX_EARLYCON_MEM=y +# CONFIG_FRAME_POINTER is not set +# CONFIG_FTRACE_SYSCALLS is not set +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CMOS_UPDATE=y +# CONFIG_GENERIC_CPU is not set +CONFIG_GENERIC_FIND_FIRST_BIT=y +CONFIG_GENERIC_FIND_LAST_BIT=y +CONFIG_GENERIC_FIND_NEXT_BIT=y +CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y +CONFIG_GENERIC_IOMAP=y +CONFIG_GENERIC_ISA_DMA=y +# CONFIG_GENERIC_TIME_VSYSCALL is not set +# CONFIG_GEN_RTC is not set +# CONFIG_HAMRADIO is not set +# CONFIG_HANGCHECK_TIMER is not set +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +CONFIG_HAVE_AOUT=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_ATOMIC_IOMAP=y +# CONFIG_HAVE_CPUMASK_OF_CPU_MAP is not set +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_DYNAMIC_PER_CPU_AREA=y +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FTRACE_SYSCALLS=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_IDE=y +CONFIG_HAVE_IOREMAP_PROT=y +CONFIG_HAVE_KERNEL_BZIP2=y +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_KVM=y +CONFIG_HAVE_KVM_IRQCHIP=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_HAVE_MLOCK=y +CONFIG_HAVE_MMIOTRACE_SUPPORT=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_SETUP_PER_CPU_AREA=y +CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y +# CONFIG_HIGHMEM4G is not set +# CONFIG_HIGHMEM64G is not set +# CONFIG_HIGH_RES_TIMERS is not set +# CONFIG_HPET_TIMER is not set +# CONFIG_HP_WATCHDOG is not set +# CONFIG_HUGETLBFS is not set +# CONFIG_HW_RANDOM is not set +CONFIG_HZ=250 +# CONFIG_HZ_100 is not set +CONFIG_HZ_250=y +# CONFIG_I2C is not set +# CONFIG_I6300ESB_WDT is not set +# CONFIG_I8K is not set +# CONFIG_IB700_WDT is not set +# CONFIG_IBMASR is not set +# CONFIG_IOMMU_API is not set +# CONFIG_IOMMU_HELPER is not set +CONFIG_IO_DELAY_0X80=y +# CONFIG_IO_DELAY_0XED is not set +# CONFIG_IO_DELAY_NONE is not set +CONFIG_IO_DELAY_TYPE_0X80=0 +CONFIG_IO_DELAY_TYPE_0XED=1 +CONFIG_IO_DELAY_TYPE_NONE=3 +CONFIG_IO_DELAY_TYPE_UDELAY=2 +# CONFIG_IO_DELAY_UDELAY is not set +# CONFIG_IP_MROUTE is not set +# CONFIG_ISA is not set +CONFIG_ISA_DMA_API=y +# CONFIG_ISCSI_IBFT_FIND is not set +# CONFIG_IT8712F_WDT is not set +# CONFIG_IT87_WDT is not set +# CONFIG_ITCO_WDT is not set +# CONFIG_JFFS2_SUMMARY is not set +# CONFIG_KERNEL_BZIP2 is not set +# CONFIG_KERNEL_GZIP is not set +CONFIG_KERNEL_LZMA=y +CONFIG_KTIME_SCALAR=y +CONFIG_LBD=y +# CONFIG_LEDS_ALIX2 is not set +# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set +# CONFIG_LEDS_TRIGGER_NETDEV is not set +# CONFIG_LEDS_TRIGGER_TIMER is not set +# CONFIG_M386 is not set +CONFIG_M486=y +# CONFIG_M586 is not set +# CONFIG_M586MMX is not set +# CONFIG_M586TSC is not set +# CONFIG_M686 is not set +# CONFIG_MACHZ_WDT is not set +# CONFIG_MACINTOSH_DRIVERS is not set +CONFIG_MATH_EMULATION=y +# CONFIG_MCA is not set +# CONFIG_MCORE2 is not set +# CONFIG_MCRUSOE is not set +# CONFIG_MCYRIXIII is not set +# CONFIG_MEFFICEON is not set +# CONFIG_MEMTEST is not set +# CONFIG_MGEODEGX1 is not set +# CONFIG_MGEODE_LX is not set +# CONFIG_MICROCODE is not set +# CONFIG_MK6 is not set +# CONFIG_MK7 is not set +# CONFIG_MK8 is not set +# CONFIG_MMIOTRACE is not set +CONFIG_MODULE_FORCE_UNLOAD=y +# CONFIG_MPENTIUM4 is not set +# CONFIG_MPENTIUMII is not set +# CONFIG_MPENTIUMIII is not set +# CONFIG_MPENTIUMM is not set +# CONFIG_MPSC is not set +# CONFIG_MTD_CFI_INTELEXT is not set +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +# CONFIG_MTD_NETSC520 is not set +# CONFIG_MTD_PHYSMAP is not set +# CONFIG_MTD_R8610 is not set +CONFIG_MTD_RDC3210=y +CONFIG_MTD_RDC3210_ALLOW_JFFS2=y +CONFIG_MTD_RDC3210_BUSWIDTH=2 +# CONFIG_MTD_RDC3210_FACTORY_PRESENT is not set +CONFIG_MTD_RDC3210_SIZE=0x400000 +# CONFIG_MTD_RDC3210_STATIC_MAP is not set +# CONFIG_MTD_TS5500 is not set +# CONFIG_MTRR is not set +# CONFIG_MVIAC3_2 is not set +# CONFIG_MVIAC7 is not set +# CONFIG_MWINCHIP3D is not set +# CONFIG_MWINCHIPC6 is not set +# CONFIG_NATSEMI is not set +# CONFIG_NETDEV_1000 is not set +CONFIG_NOHIGHMEM=y +CONFIG_NR_CPUS=1 +# CONFIG_NSC_GPIO is not set +# CONFIG_NVRAM is not set +# CONFIG_OLPC is not set +# CONFIG_OPTIMIZE_INLINING is not set +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PAGE_OFFSET=0xC0000000 +# CONFIG_PARAVIRT_GUEST is not set +# CONFIG_PC8736x_GPIO is not set +# CONFIG_PC87413_WDT is not set +CONFIG_PCI=y +# CONFIG_PCIEPORTBUS is not set +CONFIG_PCI_BIOS=y +CONFIG_PCI_DIRECT=y +CONFIG_PCI_DISABLE_COMMON_QUIRKS=y +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_GOANY=y +# CONFIG_PCI_GOBIOS is not set +# CONFIG_PCI_GODIRECT is not set +# CONFIG_PCI_GOMMCONFIG is not set +# CONFIG_PCI_GOOLPC is not set +# CONFIG_PCI_QUIRKS is not set +# CONFIG_PCSPKR_PLATFORM is not set +CONFIG_PHYSICAL_ALIGN=0x100000 +CONFIG_PHYSICAL_START=0x100000 +# CONFIG_POWER_TRACER is not set +CONFIG_PROCESSOR_SELECT=y +# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set +CONFIG_RDC321X_WDT=m +# CONFIG_RELOCATABLE is not set +# CONFIG_RTC is not set +# CONFIG_RWSEM_GENERIC_SPINLOCK is not set +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +# CONFIG_SBC7240_WDT is not set +# CONFIG_SBC8360_WDT is not set +# CONFIG_SBC_EPX_C3_WATCHDOG is not set +# CONFIG_SC1200_WDT is not set +# CONFIG_SC520_WDT is not set +# CONFIG_SCHED_HRTICK is not set +CONFIG_SCHED_OMIT_FRAME_POINTER=y +# CONFIG_SCSI_DMA is not set +# CONFIG_SCx200 is not set +# CONFIG_SERIAL_8250_EXTENDED is not set +# CONFIG_SHMEM is not set +# CONFIG_SLOW_WORK is not set +# CONFIG_SMP is not set +# CONFIG_SMSC37B787_WDT is not set +# CONFIG_SMSC_SCH311X_WDT is not set +CONFIG_SPARSEMEM_STATIC=y +# CONFIG_STRICT_DEVMEM is not set +# CONFIG_SYSPROF_TRACER is not set +# CONFIG_TELCLOCK is not set +# CONFIG_TOSHIBA is not set +CONFIG_TRACING_SUPPORT=y +CONFIG_UID16=y +CONFIG_USB_SUPPORT=y +CONFIG_USER_STACKTRACE_SUPPORT=y +# CONFIG_VM86 is not set +# CONFIG_VMSPLIT_2G_OPT is not set +# CONFIG_VMSPLIT_3G_OPT is not set +# CONFIG_W83697UG_WDT is not set +# CONFIG_WAFER_WDT is not set +CONFIG_X86=y +CONFIG_X86_32=y +CONFIG_X86_32_LAZY_GS=y +# CONFIG_X86_64 is not set +CONFIG_X86_ALIGNMENT_16=y +CONFIG_X86_BSWAP=y +# CONFIG_X86_CHECK_BIOS_CORRUPTION is not set +CONFIG_X86_CMPXCHG=y +CONFIG_X86_CPU=y +# CONFIG_X86_CPUID is not set +# CONFIG_X86_CPU_DEBUG is not set +# CONFIG_X86_ELAN is not set +CONFIG_X86_EXTENDED_PLATFORM=y +CONFIG_X86_F00F_BUG=y +# CONFIG_X86_GENERIC is not set +CONFIG_X86_INTERNODE_CACHE_BYTES=64 +CONFIG_X86_INVLPG=y +CONFIG_X86_L1_CACHE_BYTES=64 +CONFIG_X86_L1_CACHE_SHIFT=4 +# CONFIG_X86_MCE is not set +CONFIG_X86_MINIMUM_CPU_FAMILY=4 +# CONFIG_X86_MSR is not set +# CONFIG_X86_PAE is not set +# CONFIG_X86_PLATFORM_DEVICES is not set +CONFIG_X86_POPAD_OK=y +# CONFIG_X86_PPRO_FENCE is not set +CONFIG_X86_RDC321X=y +CONFIG_X86_REBOOTFIXUPS=y +# CONFIG_X86_RESERVE_LOW_64K is not set +# CONFIG_X86_UP_APIC is not set +# CONFIG_X86_VERBOSE_BOOTUP is not set +CONFIG_X86_WP_WORKS_OK=y +CONFIG_X86_XADD=y +# CONFIG_ZONE_DMA32 is not set diff --git a/target/linux/rdc/ar525w/target.mk b/target/linux/rdc/ar525w/target.mk new file mode 100644 index 000000000..b3a61ef43 --- /dev/null +++ b/target/linux/rdc/ar525w/target.mk @@ -0,0 +1,2 @@ +BOARDNAME:=Airlink AR525W +DEFAULT_PACKAGES += kmod-rt61-pci diff --git a/target/linux/rdc/config/profile-ar525w b/target/linux/rdc/config/profile-ar525w deleted file mode 100644 index 2fb8e7db3..000000000 --- a/target/linux/rdc/config/profile-ar525w +++ /dev/null @@ -1,6 +0,0 @@ -CONFIG_MTD_RDC3210=y -CONFIG_MTD_RDC3210_ALLOW_JFFS2=y -CONFIG_MTD_RDC3210_BUSWIDTH=2 -# CONFIG_MTD_RDC3210_FACTORY_PRESENT is not set -CONFIG_MTD_RDC3210_SIZE=0x400000 -# CONFIG_MTD_RDC3210_STATIC_MAP is not set diff --git a/target/linux/rdc/config/profile-dir450 b/target/linux/rdc/config/profile-dir450 deleted file mode 100644 index b2e5791a0..000000000 --- a/target/linux/rdc/config/profile-dir450 +++ /dev/null @@ -1,532 +0,0 @@ -# -# PCCARD (PCMCIA/CardBus) support -# -CONFIG_PCCARD=y -# CONFIG_PCMCIA_DEBUG is not set -CONFIG_PCMCIA=y -CONFIG_PCMCIA_LOAD_CIS=y -CONFIG_PCMCIA_IOCTL=y -CONFIG_CARDBUS=y - -# -# PC-card bridges -# -CONFIG_YENTA=y -CONFIG_YENTA_O2=y -CONFIG_YENTA_RICOH=y -CONFIG_YENTA_TI=y -CONFIG_YENTA_ENE_TUNE=y -CONFIG_YENTA_TOSHIBA=y -# CONFIG_PD6729 is not set -# CONFIG_I82092 is not set -# CONFIG_I82365 is not set -# CONFIG_TCIC is not set -CONFIG_PCMCIA_PROBE=y -CONFIG_PCCARD_NONSTATIC=y - -# -# Memory Technology Devices (MTD) -# -CONFIG_MTD=y -CONFIG_MTD_DEBUG=y -# CONFIG_MTD_DEBUG is not set -CONFIG_MTD_CONCAT=y -CONFIG_MTD_PARTITIONS=y -CONFIG_MTD_REDBOOT_PARTS=y -CONFIG_MTD_CMDLINE_PARTS=y -# CONFIG_MTD_REDBOOT_PARTS is not set -# CONFIG_MTD_CMDLINE_PARTS is not set - -# -# User Modules And Translation Layers -# -CONFIG_MTD_CHAR=y -CONFIG_MTD_BLOCK=y -CONFIG_FTL=y -# CONFIG_NFTL is not set -# CONFIG_INFTL is not set -# CONFIG_RFD_FTL is not set - -# -# RAM/ROM/Flash chip drivers -# -CONFIG_MTD_CFI=y -CONFIG_MTD_JEDECPROBE=y -CONFIG_MTD_GEN_PROBE=y -# CONFIG_MTD_CFI_ADV_OPTIONS is not set -CONFIG_MTD_MAP_BANK_WIDTH_1=y -CONFIG_MTD_MAP_BANK_WIDTH_2=y -CONFIG_MTD_MAP_BANK_WIDTH_4=y -# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set -CONFIG_MTD_CFI_I1=y -CONFIG_MTD_CFI_I2=y -# CONFIG_MTD_CFI_I4 is not set -# CONFIG_MTD_CFI_I8 is not set -CONFIG_MTD_CFI_INTELEXT=y -CONFIG_MTD_CFI_AMDSTD=y -CONFIG_MTD_CFI_STAA=y -CONFIG_MTD_CFI_UTIL=y -# CONFIG_MTD_RAM is not set -CONFIG_MTD_RDC3210=y -CONFIG_MTD_RDC3210_ALLOW_JFFS2=y -CONFIG_MTD_RDC3210_BUSWIDTH=2 -# CONFIG_MTD_RDC3210_FACTORY_PRESENT is not set -CONFIG_MTD_RDC3210_SIZE=0x800000 -CONFIG_MTD_RDC3210_STATIC_MAP=y -# CONFIG_MTD_REDBOOT_PARTS is not set -# -# CONFIG_MTD_ROM is not set -# CONFIG_MTD_ABSENT is not set -# CONFIG_MTD_OBSOLETE_CHIPS is not set - -# -# Mapping drivers for chip access -# -CONFIG_MTD_COMPLEX_MAPPINGS=y -CONFIG_MTD_PHYSMAP=y -CONFIG_MTD_PHYSMAP_START=0xFF800000 -CONFIG_MTD_PHYSMAP_LEN=0x00800000 -CONFIG_MTD_PHYSMAP_BANKWIDTH=2 -# CONFIG_MTD_PNC2000 is not set -# CONFIG_MTD_SC520CDP is not set -# CONFIG_MTD_NETSC520 is not set -# CONFIG_MTD_TS5500 is not set -# CONFIG_MTD_SBC_GXX is not set -# CONFIG_MTD_AMD76XROM is not set -# CONFIG_MTD_ICHXROM is not set -# CONFIG_MTD_SCB2_FLASH is not set -# CONFIG_MTD_NETtel is not set -# CONFIG_MTD_DILNETPC is not set -# CONFIG_MTD_L440GX is not set -# CONFIG_MTD_PCI is not set -# CONFIG_MTD_PLATRAM is not set - -# -# Self-contained MTD device drivers -# -# CONFIG_MTD_PMC551 is not set -# CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_PHRAM is not set -# CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_BLOCK2MTD is not set - -# -# Disk-On-Chip Device Drivers -# -# CONFIG_MTD_DOC2000 is not set -# CONFIG_MTD_DOC2001 is not set -# CONFIG_MTD_DOC2001PLUS is not set - -# -# NAND Flash Device Drivers -# -# CONFIG_MTD_NAND is not set - -# -# OneNAND Flash Device Drivers -# -# CONFIG_MTD_ONENAND is not set - -# -# Parallel port support -# -# CONFIG_PARPORT is not set - -# -# Plug and Play support -# -# CONFIG_PNP is not set - -# -# Block devices -# -# CONFIG_BLK_DEV_FD is not set -# CONFIG_BLK_DEV_XD is not set -# CONFIG_BLK_CPQ_DA is not set -# CONFIG_BLK_CPQ_CISS_DA is not set -# CONFIG_BLK_DEV_DAC960 is not set -# CONFIG_BLK_DEV_UMEM is not set -# CONFIG_BLK_DEV_COW_COMMON is not set -CONFIG_BLK_DEV_LOOP=y -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -CONFIG_BLK_DEV_NBD=y -# CONFIG_BLK_DEV_SX8 is not set -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=16 -CONFIG_BLK_DEV_RAM_SIZE=32000 -CONFIG_BLK_DEV_INITRD=y -# CONFIG_CDROM_PKTCDVD is not set -# CONFIG_ATA_OVER_ETH is not set - -# -# I2O device support -# -CONFIG_I2O=y -CONFIG_I2O_LCT_NOTIFY_ON_CHANGES=y -CONFIG_I2O_EXT_ADAPTEC=y -CONFIG_I2O_CONFIG=y -CONFIG_I2O_CONFIG_OLD_IOCTL=y -CONFIG_I2O_BUS=y -CONFIG_I2O_BLOCK=y -CONFIG_I2O_PROC=y - -# -# Network device support -# -CONFIG_R6040=y -CONFIG_NETDEVICES=y -# CONFIG_DUMMY is not set -# CONFIG_BONDING is not set -# CONFIG_EQUALIZER is not set -# CONFIG_TUN is not set - -# -# ARCnet devices -# -# CONFIG_ARCNET is not set - -# -# PHY device support -# -CONFIG_PHYLIB=m - -# -# MII PHY device drivers -# -CONFIG_MARVELL_PHY=m -CONFIG_DAVICOM_PHY=m -CONFIG_QSEMI_PHY=m -CONFIG_LXT_PHY=m -CONFIG_CICADA_PHY=m - -# -# Ethernet (10 or 100Mbit) -# -CONFIG_NET_ETHERNET=y -CONFIG_MII=y -# CONFIG_HAPPYMEAL is not set -# CONFIG_SUNGEM is not set -# CONFIG_CASSINI is not set -# CONFIG_NET_VENDOR_3COM is not set -# CONFIG_LANCE is not set -# CONFIG_NET_VENDOR_SMC is not set -# CONFIG_NET_VENDOR_RACAL is not set - -# -# Tulip family network device support -# -CONFIG_NET_TULIP=y -CONFIG_DE2104X=m -CONFIG_TULIP=m -# CONFIG_TULIP_MWI is not set -CONFIG_TULIP_MMIO=y -# CONFIG_TULIP_NAPI is not set -CONFIG_DE4X5=m -CONFIG_WINBOND_840=m -CONFIG_DM9102=m -CONFIG_ULI526X=m -CONFIG_PCMCIA_XIRCOM=m -# CONFIG_PCMCIA_XIRTULIP is not set -# CONFIG_AT1700 is not set -# CONFIG_DEPCA is not set -# CONFIG_HP100 is not set -# CONFIG_NET_ISA is not set -CONFIG_NET_PCI=y -# CONFIG_PCNET32 is not set -# CONFIG_AMD8111_ETH is not set -# CONFIG_ADAPTEC_STARFIRE is not set -# CONFIG_AC3200 is not set -# CONFIG_APRICOT is not set -# CONFIG_B44 is not set -# CONFIG_FORCEDETH is not set -# CONFIG_CS89x0 is not set -# CONFIG_DGRS is not set -# CONFIG_EEPRO100 is not set -# CONFIG_E100 is not set -# CONFIG_FEALNX is not set -# CONFIG_NATSEMI is not set -# CONFIG_NE2K_PCI is not set -# CONFIG_8139CP is not set -# CONFIG_8139TOO is not set -# CONFIG_SIS900 is not set -# CONFIG_EPIC100 is not set -# CONFIG_SUNDANCE is not set -# CONFIG_TLAN is not set -# CONFIG_VIA_RHINE is not set - -CONFIG_WAN=y -# -# Input device support -# -CONFIG_INPUT=y - -# -# Userland interfaces -# -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_JOYDEV is not set -# CONFIG_INPUT_TSDEV is not set -# CONFIG_INPUT_EVDEV is not set -# CONFIG_INPUT_EVBUG is not set - -# -# Input Device Drivers -# -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_MOUSE is not set -# CONFIG_INPUT_JOYSTICK is not set -# CONFIG_INPUT_TOUCHSCREEN is not set -# CONFIG_INPUT_MISC is not set - -# -# Hardware I/O ports -# -CONFIG_SERIO=y -CONFIG_SERIO_I8042=y -CONFIG_SERIO_SERPORT=y -# -CONFIG_SERIO_CT82C710=y -CONFIG_SERIO_PCIPS2=y -CONFIG_SERIO_LIBPS2=y -CONFIG_SERIO_RAW=y -# CONFIG_GAMEPORT is not set - -# -# Character devices -# -CONFIG_VT=y -CONFIG_VT_CONSOLE=y -CONFIG_HW_CONSOLE=y -CONFIG_SERIAL_NONSTANDARD=y - -# -# Serial drivers -# -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_CONSOLE=y -CONFIG_SERIAL_8250_PCI=y -CONFIG_SERIAL_8250_CS=m -CONFIG_SERIAL_8250_NR_UARTS=32 -CONFIG_SERIAL_8250_RUNTIME_UARTS=4 -CONFIG_SERIAL_8250_EXTENDED=y -CONFIG_SERIAL_8250_MANY_PORTS=y -CONFIG_SERIAL_8250_SHARE_IRQ=y -CONFIG_SERIAL_8250_DETECT_IRQ=y -CONFIG_SERIAL_8250_RSA=y -# CONFIG_SERIAL_8250_FOURPORT is not set -# CONFIG_SERIAL_8250_ACCENT is not set -# CONFIG_SERIAL_8250_BOCA is not set -# CONFIG_SERIAL_8250_HUB6 is not set -CONFIG_SERIAL_8250_FOURPORT=y -CONFIG_SERIAL_8250_ACCENT=y -CONFIG_SERIAL_8250_BOCA=y -CONFIG_SERIAL_8250_HUB6=y - -# -# Non-8250 serial port support -# -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -# CONFIG_SERIAL_JSM is not set -CONFIG_SERIAL_JSM=y -CONFIG_UNIX98_PTYS=y -CONFIG_LEGACY_PTYS=y -CONFIG_LEGACY_PTY_COUNT=4 - -# -# CONFIG_VGA_CONSOLE is not set -# CONFIG_MDA_CONSOLE is not set -CONFIG_DUMMY_CONSOLE=y - -# -# USB support -# -CONFIG_USB_ARCH_HAS_HCD=y -CONFIG_USB_ARCH_HAS_OHCI=y -CONFIG_USB_ARCH_HAS_EHCI=y -# CONFIG_USB is not set - -# -# File systems -# -CONFIG_EXT2_FS=y -CONFIG_EXT2_FS_XATTR=y -CONFIG_EXT2_FS_POSIX_ACL=y -CONFIG_EXT2_FS_SECURITY=y -# CONFIG_EXT2_FS_XIP is not set -CONFIG_EXT3_FS=y -CONFIG_EXT3_FS_XATTR=y -CONFIG_EXT3_FS_POSIX_ACL=y -CONFIG_EXT3_FS_SECURITY=y -CONFIG_JBD=y -# CONFIG_JBD_DEBUG is not set -CONFIG_FS_MBCACHE=y -# CONFIG_REISERFS_FS is not set -# CONFIG_JFS_FS is not set -CONFIG_FS_POSIX_ACL=y -# CONFIG_XFS_FS is not set -# CONFIG_OCFS2_FS is not set -# CONFIG_MINIX_FS is not set -CONFIG_ROMFS_FS=y -CONFIG_INOTIFY=y -# CONFIG_QUOTA is not set -CONFIG_DNOTIFY=y -CONFIG_AUTOFS_FS=y -CONFIG_AUTOFS4_FS=y -# CONFIG_FUSE_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -CONFIG_PROC_KCORE=y -CONFIG_SYSFS=y -CONFIG_TMPFS=y -CONFIG_HUGETLBFS=y -CONFIG_HUGETLB_PAGE=y -CONFIG_RAMFS=y -CONFIG_CONFIGFS_FS=m - -# -# Miscellaneous filesystems -# -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_HFS_FS is not set -# CONFIG_HFSPLUS_FS is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -# CONFIG_JFFS_FS is not set -CONFIG_JFFS2_FS=m -CONFIG_JFFS2_FS_DEBUG=0 -# CONFIG_JFFS2_FS_WRITEBUFFER is not set -# CONFIG_JFFS2_SUMMARY is not set -# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set -CONFIG_JFFS2_ZLIB=y -CONFIG_JFFS2_RTIME=y -# CONFIG_JFFS2_RUBIN is not set -CONFIG_CRAMFS=y -# CONFIG_VXFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set - -# -# Partition Types -# -CONFIG_PARTITION_ADVANCED=y -# CONFIG_ACORN_PARTITION is not set -# CONFIG_OSF_PARTITION is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_ATARI_PARTITION is not set -# CONFIG_MAC_PARTITION is not set -CONFIG_MSDOS_PARTITION=y -# CONFIG_BSD_DISKLABEL is not set -# CONFIG_MINIX_SUBPARTITION is not set -# CONFIG_SOLARIS_X86_PARTITION is not set -# CONFIG_UNIXWARE_DISKLABEL is not set -# CONFIG_LDM_PARTITION is not set -# CONFIG_SGI_PARTITION is not set -# CONFIG_ULTRIX_PARTITION is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_KARMA_PARTITION is not set -# CONFIG_EFI_PARTITION is not set - -# -# Native Language Support -# -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="iso8895-1" -CONFIG_NLS_CODEPAGE_437=y -# CONFIG_NLS_CODEPAGE_737 is not set -# CONFIG_NLS_CODEPAGE_775 is not set -CONFIG_NLS_CODEPAGE_850=y -# CONFIG_NLS_CODEPAGE_852 is not set -# CONFIG_NLS_CODEPAGE_855 is not set -# CONFIG_NLS_CODEPAGE_857 is not set -# CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set -# CONFIG_NLS_CODEPAGE_862 is not set -# CONFIG_NLS_CODEPAGE_863 is not set -# CONFIG_NLS_CODEPAGE_864 is not set -# CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set -# CONFIG_NLS_CODEPAGE_869 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_874 is not set -# CONFIG_NLS_ISO8859_8 is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -# CONFIG_NLS_ASCII is not set -CONFIG_NLS_ISO8859_1=y -# CONFIG_NLS_ISO8859_2 is not set -# CONFIG_NLS_ISO8859_3 is not set -# CONFIG_NLS_ISO8859_4 is not set -# CONFIG_NLS_ISO8859_5 is not set -# CONFIG_NLS_ISO8859_6 is not set -# CONFIG_NLS_ISO8859_7 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_ISO8859_13 is not set -# CONFIG_NLS_ISO8859_14 is not set -# CONFIG_NLS_ISO8859_15 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U is not set -# CONFIG_NLS_UTF8 is not set - -# Kernel hacking -# -# CONFIG_PRINTK_TIME is not set -# CONFIG_MAGIC_SYSRQ is not set -# CONFIG_DEBUG_KERNEL is not set -CONFIG_LOG_BUF_SHIFT=14 -# CONFIG_DEBUG_BUGVERBOSE is not set -# CONFIG_DEBUG_FS is not set -# CONFIG_UNWIND_INFO is not set -CONFIG_EARLY_PRINTK=y -CONFIG_STACK_BACKTRACE_COLS=2 -CONFIG_X86_FIND_SMP_CONFIG=y -CONFIG_X86_MPPARSE=y -# CONFIG_DOUBLEFAULT is not set - -# -# Security options -# -# CONFIG_KEYS is not set -# CONFIG_SECURITY is not set - -# -# Cryptographic options -# -CONFIG_CRYPTO=y -CONFIG_CRYPTO_HMAC=y -# CONFIG_CRYPTO_NULL is not set -# CONFIG_CRYPTO_MD4 is not set -CONFIG_CRYPTO_MD5=y -CONFIG_CRYPTO_SHA1=y -# CONFIG_CRYPTO_SHA256 is not set -# CONFIG_CRYPTO_SHA512 is not set -# CONFIG_CRYPTO_WP512 is not set -# CONFIG_CRYPTO_TGR192 is not set -CONFIG_CRYPTO_DES=y -# CONFIG_CRYPTO_BLOWFISH is not set -# CONFIG_CRYPTO_TWOFISH is not set -# CONFIG_CRYPTO_SERPENT is not set -# CONFIG_CRYPTO_AES is not set -# CONFIG_CRYPTO_AES_586 is not set -# CONFIG_CRYPTO_CAST5 is not set -# CONFIG_CRYPTO_CAST6 is not set -# CONFIG_CRYPTO_TEA is not set -CONFIG_CRYPTO_ARC4=y -# CONFIG_CRYPTO_KHAZAD is not set -# CONFIG_CRYPTO_ANUBIS is not set -CONFIG_CRYPTO_DEFLATE=y -# CONFIG_CRYPTO_MICHAEL_MIC is not set -# CONFIG_CRYPTO_CRC32C is not set -# CONFIG_CRYPTO_TEST is not set diff --git a/target/linux/rdc/config/profile-r8610 b/target/linux/rdc/config/profile-r8610 deleted file mode 100644 index ba98397f6..000000000 --- a/target/linux/rdc/config/profile-r8610 +++ /dev/null @@ -1,8 +0,0 @@ -CONFIG_MTD_R8610=y -# CONFIG_MTD_RDC3210 is not set -CONFIG_MTD_RDC3210_BUSWIDTH=2 -# CONFIG_MTD_RDC3210_FACTORY_PRESENT is not set -CONFIG_MTD_RDC3210_SIZE=0x400000 -# CONFIG_MTD_RDC3210_STATIC_MAP is not set -CONFIG_RTC_CLASS=y -CONFIG_RTC_DRV_M48T86=y diff --git a/target/linux/rdc/dir-450/config-2.6.30 b/target/linux/rdc/dir-450/config-2.6.30 new file mode 100644 index 000000000..81ec1c57a --- /dev/null +++ b/target/linux/rdc/dir-450/config-2.6.30 @@ -0,0 +1,300 @@ +# CONFIG_4KSTACKS is not set +# CONFIG_60XX_WDT is not set +# CONFIG_64BIT is not set +# CONFIG_ACQUIRE_WDT is not set +# CONFIG_ADVANTECH_WDT is not set +# CONFIG_AGP is not set +# CONFIG_ALIM1535_WDT is not set +CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" +CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y +CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y +CONFIG_ARCH_HAS_CPU_RELAX=y +CONFIG_ARCH_HAS_DEFAULT_IDLE=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_MAY_HAVE_PC_FDC=y +# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set +CONFIG_ARCH_POPULATES_NODE_MAP=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y +# CONFIG_ARCH_SUPPORTS_MSI is not set +CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_WANT_FRAME_POINTERS=y +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +# CONFIG_ARPD is not set +# CONFIG_AUDIT_ARCH is not set +# CONFIG_BASE_FULL is not set +CONFIG_BASE_SMALL=1 +# CONFIG_BINARY_PRINTF is not set +CONFIG_BITREVERSE=y +# CONFIG_BLK_DEV_INITRD is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=16 +CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_BOUNCE=y +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +# CONFIG_CC_STACKPROTECTOR is not set +CONFIG_CLOCKSOURCE_WATCHDOG=y +CONFIG_CMDLINE="console=ttyS0,38400 rootfstype=squashfs,jffs2" +CONFIG_CMDLINE_BOOL=y +# CONFIG_CMDLINE_OVERRIDE is not set +# CONFIG_COMPAT_NET_DEV_OPS is not set +# CONFIG_COMPAT_VDSO is not set +# CONFIG_CPU5_WDT is not set +# CONFIG_CPU_FREQ is not set +# CONFIG_CPU_SUP_AMD is not set +# CONFIG_CPU_SUP_CENTAUR is not set +# CONFIG_CPU_SUP_CYRIX_32 is not set +# CONFIG_CPU_SUP_INTEL is not set +# CONFIG_CPU_SUP_TRANSMETA_32 is not set +# CONFIG_CPU_SUP_UMC_32 is not set +# CONFIG_CS5535_GPIO is not set +# CONFIG_DCDBAS is not set +# CONFIG_DEBUG_BUGVERBOSE is not set +# CONFIG_DEBUG_FS is not set +CONFIG_DECOMPRESS_LZMA=y +CONFIG_DEFAULT_IO_DELAY_TYPE=0 +# CONFIG_DELL_RBU is not set +CONFIG_DEVPORT=y +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_DMI is not set +CONFIG_DOUBLEFAULT=y +# CONFIG_EARLY_PRINTK is not set +# CONFIG_EDAC is not set +# CONFIG_EDD is not set +# CONFIG_EUROTECH_WDT is not set +CONFIG_FAST_CMPXCHG_LOCAL=y +# CONFIG_FIRMWARE_MEMMAP is not set +CONFIG_FIX_EARLYCON_MEM=y +# CONFIG_FRAME_POINTER is not set +# CONFIG_FTRACE_SYSCALLS is not set +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CMOS_UPDATE=y +# CONFIG_GENERIC_CPU is not set +CONFIG_GENERIC_FIND_FIRST_BIT=y +CONFIG_GENERIC_FIND_LAST_BIT=y +CONFIG_GENERIC_FIND_NEXT_BIT=y +CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y +CONFIG_GENERIC_IOMAP=y +CONFIG_GENERIC_ISA_DMA=y +# CONFIG_GENERIC_TIME_VSYSCALL is not set +# CONFIG_GEN_RTC is not set +# CONFIG_HAMRADIO is not set +# CONFIG_HANGCHECK_TIMER is not set +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +CONFIG_HAVE_AOUT=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_ATOMIC_IOMAP=y +# CONFIG_HAVE_CPUMASK_OF_CPU_MAP is not set +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_DYNAMIC_PER_CPU_AREA=y +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FTRACE_SYSCALLS=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_IDE=y +CONFIG_HAVE_IOREMAP_PROT=y +CONFIG_HAVE_KERNEL_BZIP2=y +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_KVM=y +CONFIG_HAVE_KVM_IRQCHIP=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_HAVE_MLOCK=y +CONFIG_HAVE_MMIOTRACE_SUPPORT=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_SETUP_PER_CPU_AREA=y +CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y +# CONFIG_HIGHMEM4G is not set +# CONFIG_HIGHMEM64G is not set +# CONFIG_HIGH_RES_TIMERS is not set +# CONFIG_HPET_TIMER is not set +# CONFIG_HP_WATCHDOG is not set +# CONFIG_HUGETLBFS is not set +# CONFIG_HW_RANDOM is not set +CONFIG_HZ=250 +# CONFIG_HZ_100 is not set +CONFIG_HZ_250=y +# CONFIG_I2C is not set +# CONFIG_I6300ESB_WDT is not set +# CONFIG_I8K is not set +# CONFIG_IB700_WDT is not set +# CONFIG_IBMASR is not set +# CONFIG_IOMMU_API is not set +# CONFIG_IOMMU_HELPER is not set +CONFIG_IO_DELAY_0X80=y +# CONFIG_IO_DELAY_0XED is not set +# CONFIG_IO_DELAY_NONE is not set +CONFIG_IO_DELAY_TYPE_0X80=0 +CONFIG_IO_DELAY_TYPE_0XED=1 +CONFIG_IO_DELAY_TYPE_NONE=3 +CONFIG_IO_DELAY_TYPE_UDELAY=2 +# CONFIG_IO_DELAY_UDELAY is not set +# CONFIG_IP_MROUTE is not set +# CONFIG_ISA is not set +CONFIG_ISA_DMA_API=y +# CONFIG_ISCSI_IBFT_FIND is not set +# CONFIG_IT8712F_WDT is not set +# CONFIG_IT87_WDT is not set +# CONFIG_ITCO_WDT is not set +# CONFIG_JFFS2_SUMMARY is not set +# CONFIG_KERNEL_BZIP2 is not set +# CONFIG_KERNEL_GZIP is not set +CONFIG_KERNEL_LZMA=y +CONFIG_KTIME_SCALAR=y +CONFIG_LBD=y +# CONFIG_LEDS_ALIX2 is not set +# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set +# CONFIG_LEDS_TRIGGER_NETDEV is not set +# CONFIG_LEDS_TRIGGER_TIMER is not set +# CONFIG_M386 is not set +CONFIG_M486=y +# CONFIG_M586 is not set +# CONFIG_M586MMX is not set +# CONFIG_M586TSC is not set +# CONFIG_M686 is not set +# CONFIG_MACHZ_WDT is not set +# CONFIG_MACINTOSH_DRIVERS is not set +CONFIG_MATH_EMULATION=y +# CONFIG_MCA is not set +# CONFIG_MCORE2 is not set +# CONFIG_MCRUSOE is not set +# CONFIG_MCYRIXIII is not set +# CONFIG_MEFFICEON is not set +# CONFIG_MEMTEST is not set +# CONFIG_MGEODEGX1 is not set +# CONFIG_MGEODE_LX is not set +# CONFIG_MICROCODE is not set +# CONFIG_MK6 is not set +# CONFIG_MK7 is not set +# CONFIG_MK8 is not set +# CONFIG_MMIOTRACE is not set +CONFIG_MODULE_FORCE_UNLOAD=y +# CONFIG_MPENTIUM4 is not set +# CONFIG_MPENTIUMII is not set +# CONFIG_MPENTIUMIII is not set +# CONFIG_MPENTIUMM is not set +# CONFIG_MPSC is not set +# CONFIG_MTD_CFI_INTELEXT is not set +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +# CONFIG_MTD_NETSC520 is not set +CONFIG_MTD_PHYSMAP=y +# CONFIG_MTD_R8610 is not set +# CONFIG_MTD_RDC3210 is not set +# CONFIG_MTD_TS5500 is not set +# CONFIG_MTRR is not set +# CONFIG_MVIAC3_2 is not set +# CONFIG_MVIAC7 is not set +# CONFIG_MWINCHIP3D is not set +# CONFIG_MWINCHIPC6 is not set +# CONFIG_NATSEMI is not set +# CONFIG_NETDEV_1000 is not set +CONFIG_NOHIGHMEM=y +CONFIG_NR_CPUS=1 +# CONFIG_NSC_GPIO is not set +# CONFIG_NVRAM is not set +# CONFIG_OLPC is not set +# CONFIG_OPTIMIZE_INLINING is not set +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PAGE_OFFSET=0xC0000000 +# CONFIG_PARAVIRT_GUEST is not set +# CONFIG_PC8736x_GPIO is not set +# CONFIG_PC87413_WDT is not set +CONFIG_PCI=y +# CONFIG_PCIEPORTBUS is not set +CONFIG_PCI_BIOS=y +CONFIG_PCI_DIRECT=y +CONFIG_PCI_DISABLE_COMMON_QUIRKS=y +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_GOANY=y +# CONFIG_PCI_GOBIOS is not set +# CONFIG_PCI_GODIRECT is not set +# CONFIG_PCI_GOMMCONFIG is not set +# CONFIG_PCI_GOOLPC is not set +# CONFIG_PCI_QUIRKS is not set +# CONFIG_PCSPKR_PLATFORM is not set +CONFIG_PHYSICAL_ALIGN=0x100000 +CONFIG_PHYSICAL_START=0x100000 +# CONFIG_POWER_TRACER is not set +CONFIG_PROCESSOR_SELECT=y +# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set +CONFIG_RDC321X_WDT=m +# CONFIG_RELOCATABLE is not set +# CONFIG_RTC is not set +# CONFIG_RWSEM_GENERIC_SPINLOCK is not set +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +# CONFIG_SBC7240_WDT is not set +# CONFIG_SBC8360_WDT is not set +# CONFIG_SBC_EPX_C3_WATCHDOG is not set +# CONFIG_SC1200_WDT is not set +# CONFIG_SC520_WDT is not set +# CONFIG_SCHED_HRTICK is not set +CONFIG_SCHED_OMIT_FRAME_POINTER=y +# CONFIG_SCSI_DMA is not set +# CONFIG_SCx200 is not set +# CONFIG_SERIAL_8250_EXTENDED is not set +# CONFIG_SHMEM is not set +# CONFIG_SLOW_WORK is not set +# CONFIG_SMP is not set +# CONFIG_SMSC37B787_WDT is not set +# CONFIG_SMSC_SCH311X_WDT is not set +CONFIG_SPARSEMEM_STATIC=y +# CONFIG_STRICT_DEVMEM is not set +# CONFIG_SYSPROF_TRACER is not set +# CONFIG_TELCLOCK is not set +# CONFIG_TOSHIBA is not set +CONFIG_TRACING_SUPPORT=y +CONFIG_UID16=y +CONFIG_USB_SUPPORT=y +CONFIG_USER_STACKTRACE_SUPPORT=y +# CONFIG_VM86 is not set +# CONFIG_VMSPLIT_2G_OPT is not set +# CONFIG_VMSPLIT_3G_OPT is not set +# CONFIG_W83697UG_WDT is not set +# CONFIG_WAFER_WDT is not set +CONFIG_X86=y +CONFIG_X86_32=y +CONFIG_X86_32_LAZY_GS=y +# CONFIG_X86_64 is not set +CONFIG_X86_ALIGNMENT_16=y +CONFIG_X86_BSWAP=y +# CONFIG_X86_CHECK_BIOS_CORRUPTION is not set +CONFIG_X86_CMPXCHG=y +CONFIG_X86_CPU=y +# CONFIG_X86_CPUID is not set +# CONFIG_X86_CPU_DEBUG is not set +# CONFIG_X86_ELAN is not set +CONFIG_X86_EXTENDED_PLATFORM=y +CONFIG_X86_F00F_BUG=y +# CONFIG_X86_GENERIC is not set +CONFIG_X86_INTERNODE_CACHE_BYTES=64 +CONFIG_X86_INVLPG=y +CONFIG_X86_L1_CACHE_BYTES=64 +CONFIG_X86_L1_CACHE_SHIFT=4 +# CONFIG_X86_MCE is not set +CONFIG_X86_MINIMUM_CPU_FAMILY=4 +# CONFIG_X86_MSR is not set +# CONFIG_X86_PAE is not set +# CONFIG_X86_PLATFORM_DEVICES is not set +CONFIG_X86_POPAD_OK=y +# CONFIG_X86_PPRO_FENCE is not set +CONFIG_X86_RDC321X=y +CONFIG_X86_REBOOTFIXUPS=y +# CONFIG_X86_RESERVE_LOW_64K is not set +# CONFIG_X86_UP_APIC is not set +# CONFIG_X86_VERBOSE_BOOTUP is not set +CONFIG_X86_WP_WORKS_OK=y +CONFIG_X86_XADD=y +# CONFIG_ZONE_DMA32 is not set diff --git a/target/linux/rdc/dir-450/target.mk b/target/linux/rdc/dir-450/target.mk new file mode 100644 index 000000000..2b1bffb01 --- /dev/null +++ b/target/linux/rdc/dir-450/target.mk @@ -0,0 +1,2 @@ +BOARDNAME:=D-Link DIR-450 +DEFAULT_PACKAGES+= kmod-madwifi kmod-pcmcia-core kmod-nozomi diff --git a/target/linux/rdc/profiles/AMIT.mk b/target/linux/rdc/profiles/AMIT.mk deleted file mode 100644 index 2e3d87384..000000000 --- a/target/linux/rdc/profiles/AMIT.mk +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (C) 2008 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/amit - NAME:=Devices from AMIT - PACKAGES:=kmod-r6040 kmod-usb-core kmod-usb-ohci kmod-usb2 -endef -$(eval $(call Profile,amit)) - diff --git a/target/linux/rdc/profiles/AR525W.mk b/target/linux/rdc/profiles/AR525W.mk deleted file mode 100644 index 5c01554d4..000000000 --- a/target/linux/rdc/profiles/AR525W.mk +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (C) 2006 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/ar525w - NAME:=AirLink101 AR525W - PACKAGES:=kmod-rt61-pci kmod-r6040 -endef -$(eval $(call Profile,ar525w)) - diff --git a/target/linux/rdc/profiles/DIR-450.mk b/target/linux/rdc/profiles/DIR-450.mk deleted file mode 100644 index 0015928a5..000000000 --- a/target/linux/rdc/profiles/DIR-450.mk +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright (C) 2007 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/dir450 - NAME:=D-Link DIR-450 - PACKAGES:=kmod-madwifi kmod-pcmcia-core kmod-nozomi -endef - -define Profile/dir450/description - Packages set compatible with the D-Link DIR-450 3G router -endef - -$(eval $(call Profile,dir450)) diff --git a/target/linux/rdc/profiles/G-570S.mk b/target/linux/rdc/profiles/G-570S.mk deleted file mode 100644 index 4cb9bd9a9..000000000 --- a/target/linux/rdc/profiles/G-570S.mk +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (C) 2008 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/g570s - NAME:=ZyXEL G-570S - PACKAGES:=kmod-madwifi kmod-r6040 -endef -$(eval $(call Profile,g570s)) - diff --git a/target/linux/rdc/profiles/R8610.mk b/target/linux/rdc/profiles/R8610.mk deleted file mode 100644 index afa927b13..000000000 --- a/target/linux/rdc/profiles/R8610.mk +++ /dev/null @@ -1,16 +0,0 @@ -# -# Copyright (C) 2009 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/r8610 - NAME:=RDC R8610 Evaluation board - PACKAGES:=kmod-r6040 kmod-usb-core kmod-usb-ohci kmod-usb2 \ - kmod-hwmon-core kmod-hwmon-w83627hf kmod-ide-core kmod-ide-it821x \ - kmod-rtc-core kmod-rtc-m48t86 \ - kmod-fs-ext2 kmod-fs-ext3 -endef -$(eval $(call Profile,r8610)) - diff --git a/target/linux/rdc/profiles/WL-153.mk b/target/linux/rdc/profiles/WL-153.mk deleted file mode 100644 index f030455b2..000000000 --- a/target/linux/rdc/profiles/WL-153.mk +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (C) 2007 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/wl153 - NAME:=Sitecom WL-153 - PACKAGES:=kmod-rt61-pci kmod-r6040 -endef -$(eval $(call Profile,wl153)) - diff --git a/target/linux/rdc/r8610/config-2.6.30 b/target/linux/rdc/r8610/config-2.6.30 new file mode 100644 index 000000000..81ec1c57a --- /dev/null +++ b/target/linux/rdc/r8610/config-2.6.30 @@ -0,0 +1,300 @@ +# CONFIG_4KSTACKS is not set +# CONFIG_60XX_WDT is not set +# CONFIG_64BIT is not set +# CONFIG_ACQUIRE_WDT is not set +# CONFIG_ADVANTECH_WDT is not set +# CONFIG_AGP is not set +# CONFIG_ALIM1535_WDT is not set +CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" +CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y +CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y +CONFIG_ARCH_HAS_CPU_RELAX=y +CONFIG_ARCH_HAS_DEFAULT_IDLE=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_MAY_HAVE_PC_FDC=y +# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set +CONFIG_ARCH_POPULATES_NODE_MAP=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y +# CONFIG_ARCH_SUPPORTS_MSI is not set +CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_WANT_FRAME_POINTERS=y +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +# CONFIG_ARPD is not set +# CONFIG_AUDIT_ARCH is not set +# CONFIG_BASE_FULL is not set +CONFIG_BASE_SMALL=1 +# CONFIG_BINARY_PRINTF is not set +CONFIG_BITREVERSE=y +# CONFIG_BLK_DEV_INITRD is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=16 +CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_BOUNCE=y +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +# CONFIG_CC_STACKPROTECTOR is not set +CONFIG_CLOCKSOURCE_WATCHDOG=y +CONFIG_CMDLINE="console=ttyS0,38400 rootfstype=squashfs,jffs2" +CONFIG_CMDLINE_BOOL=y +# CONFIG_CMDLINE_OVERRIDE is not set +# CONFIG_COMPAT_NET_DEV_OPS is not set +# CONFIG_COMPAT_VDSO is not set +# CONFIG_CPU5_WDT is not set +# CONFIG_CPU_FREQ is not set +# CONFIG_CPU_SUP_AMD is not set +# CONFIG_CPU_SUP_CENTAUR is not set +# CONFIG_CPU_SUP_CYRIX_32 is not set +# CONFIG_CPU_SUP_INTEL is not set +# CONFIG_CPU_SUP_TRANSMETA_32 is not set +# CONFIG_CPU_SUP_UMC_32 is not set +# CONFIG_CS5535_GPIO is not set +# CONFIG_DCDBAS is not set +# CONFIG_DEBUG_BUGVERBOSE is not set +# CONFIG_DEBUG_FS is not set +CONFIG_DECOMPRESS_LZMA=y +CONFIG_DEFAULT_IO_DELAY_TYPE=0 +# CONFIG_DELL_RBU is not set +CONFIG_DEVPORT=y +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_DMI is not set +CONFIG_DOUBLEFAULT=y +# CONFIG_EARLY_PRINTK is not set +# CONFIG_EDAC is not set +# CONFIG_EDD is not set +# CONFIG_EUROTECH_WDT is not set +CONFIG_FAST_CMPXCHG_LOCAL=y +# CONFIG_FIRMWARE_MEMMAP is not set +CONFIG_FIX_EARLYCON_MEM=y +# CONFIG_FRAME_POINTER is not set +# CONFIG_FTRACE_SYSCALLS is not set +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CMOS_UPDATE=y +# CONFIG_GENERIC_CPU is not set +CONFIG_GENERIC_FIND_FIRST_BIT=y +CONFIG_GENERIC_FIND_LAST_BIT=y +CONFIG_GENERIC_FIND_NEXT_BIT=y +CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y +CONFIG_GENERIC_IOMAP=y +CONFIG_GENERIC_ISA_DMA=y +# CONFIG_GENERIC_TIME_VSYSCALL is not set +# CONFIG_GEN_RTC is not set +# CONFIG_HAMRADIO is not set +# CONFIG_HANGCHECK_TIMER is not set +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +CONFIG_HAVE_AOUT=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_ATOMIC_IOMAP=y +# CONFIG_HAVE_CPUMASK_OF_CPU_MAP is not set +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_DYNAMIC_PER_CPU_AREA=y +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FTRACE_SYSCALLS=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_IDE=y +CONFIG_HAVE_IOREMAP_PROT=y +CONFIG_HAVE_KERNEL_BZIP2=y +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_KVM=y +CONFIG_HAVE_KVM_IRQCHIP=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_HAVE_MLOCK=y +CONFIG_HAVE_MMIOTRACE_SUPPORT=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_SETUP_PER_CPU_AREA=y +CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y +# CONFIG_HIGHMEM4G is not set +# CONFIG_HIGHMEM64G is not set +# CONFIG_HIGH_RES_TIMERS is not set +# CONFIG_HPET_TIMER is not set +# CONFIG_HP_WATCHDOG is not set +# CONFIG_HUGETLBFS is not set +# CONFIG_HW_RANDOM is not set +CONFIG_HZ=250 +# CONFIG_HZ_100 is not set +CONFIG_HZ_250=y +# CONFIG_I2C is not set +# CONFIG_I6300ESB_WDT is not set +# CONFIG_I8K is not set +# CONFIG_IB700_WDT is not set +# CONFIG_IBMASR is not set +# CONFIG_IOMMU_API is not set +# CONFIG_IOMMU_HELPER is not set +CONFIG_IO_DELAY_0X80=y +# CONFIG_IO_DELAY_0XED is not set +# CONFIG_IO_DELAY_NONE is not set +CONFIG_IO_DELAY_TYPE_0X80=0 +CONFIG_IO_DELAY_TYPE_0XED=1 +CONFIG_IO_DELAY_TYPE_NONE=3 +CONFIG_IO_DELAY_TYPE_UDELAY=2 +# CONFIG_IO_DELAY_UDELAY is not set +# CONFIG_IP_MROUTE is not set +# CONFIG_ISA is not set +CONFIG_ISA_DMA_API=y +# CONFIG_ISCSI_IBFT_FIND is not set +# CONFIG_IT8712F_WDT is not set +# CONFIG_IT87_WDT is not set +# CONFIG_ITCO_WDT is not set +# CONFIG_JFFS2_SUMMARY is not set +# CONFIG_KERNEL_BZIP2 is not set +# CONFIG_KERNEL_GZIP is not set +CONFIG_KERNEL_LZMA=y +CONFIG_KTIME_SCALAR=y +CONFIG_LBD=y +# CONFIG_LEDS_ALIX2 is not set +# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set +# CONFIG_LEDS_TRIGGER_NETDEV is not set +# CONFIG_LEDS_TRIGGER_TIMER is not set +# CONFIG_M386 is not set +CONFIG_M486=y +# CONFIG_M586 is not set +# CONFIG_M586MMX is not set +# CONFIG_M586TSC is not set +# CONFIG_M686 is not set +# CONFIG_MACHZ_WDT is not set +# CONFIG_MACINTOSH_DRIVERS is not set +CONFIG_MATH_EMULATION=y +# CONFIG_MCA is not set +# CONFIG_MCORE2 is not set +# CONFIG_MCRUSOE is not set +# CONFIG_MCYRIXIII is not set +# CONFIG_MEFFICEON is not set +# CONFIG_MEMTEST is not set +# CONFIG_MGEODEGX1 is not set +# CONFIG_MGEODE_LX is not set +# CONFIG_MICROCODE is not set +# CONFIG_MK6 is not set +# CONFIG_MK7 is not set +# CONFIG_MK8 is not set +# CONFIG_MMIOTRACE is not set +CONFIG_MODULE_FORCE_UNLOAD=y +# CONFIG_MPENTIUM4 is not set +# CONFIG_MPENTIUMII is not set +# CONFIG_MPENTIUMIII is not set +# CONFIG_MPENTIUMM is not set +# CONFIG_MPSC is not set +# CONFIG_MTD_CFI_INTELEXT is not set +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +# CONFIG_MTD_NETSC520 is not set +CONFIG_MTD_PHYSMAP=y +# CONFIG_MTD_R8610 is not set +# CONFIG_MTD_RDC3210 is not set +# CONFIG_MTD_TS5500 is not set +# CONFIG_MTRR is not set +# CONFIG_MVIAC3_2 is not set +# CONFIG_MVIAC7 is not set +# CONFIG_MWINCHIP3D is not set +# CONFIG_MWINCHIPC6 is not set +# CONFIG_NATSEMI is not set +# CONFIG_NETDEV_1000 is not set +CONFIG_NOHIGHMEM=y +CONFIG_NR_CPUS=1 +# CONFIG_NSC_GPIO is not set +# CONFIG_NVRAM is not set +# CONFIG_OLPC is not set +# CONFIG_OPTIMIZE_INLINING is not set +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PAGE_OFFSET=0xC0000000 +# CONFIG_PARAVIRT_GUEST is not set +# CONFIG_PC8736x_GPIO is not set +# CONFIG_PC87413_WDT is not set +CONFIG_PCI=y +# CONFIG_PCIEPORTBUS is not set +CONFIG_PCI_BIOS=y +CONFIG_PCI_DIRECT=y +CONFIG_PCI_DISABLE_COMMON_QUIRKS=y +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_GOANY=y +# CONFIG_PCI_GOBIOS is not set +# CONFIG_PCI_GODIRECT is not set +# CONFIG_PCI_GOMMCONFIG is not set +# CONFIG_PCI_GOOLPC is not set +# CONFIG_PCI_QUIRKS is not set +# CONFIG_PCSPKR_PLATFORM is not set +CONFIG_PHYSICAL_ALIGN=0x100000 +CONFIG_PHYSICAL_START=0x100000 +# CONFIG_POWER_TRACER is not set +CONFIG_PROCESSOR_SELECT=y +# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set +CONFIG_RDC321X_WDT=m +# CONFIG_RELOCATABLE is not set +# CONFIG_RTC is not set +# CONFIG_RWSEM_GENERIC_SPINLOCK is not set +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +# CONFIG_SBC7240_WDT is not set +# CONFIG_SBC8360_WDT is not set +# CONFIG_SBC_EPX_C3_WATCHDOG is not set +# CONFIG_SC1200_WDT is not set +# CONFIG_SC520_WDT is not set +# CONFIG_SCHED_HRTICK is not set +CONFIG_SCHED_OMIT_FRAME_POINTER=y +# CONFIG_SCSI_DMA is not set +# CONFIG_SCx200 is not set +# CONFIG_SERIAL_8250_EXTENDED is not set +# CONFIG_SHMEM is not set +# CONFIG_SLOW_WORK is not set +# CONFIG_SMP is not set +# CONFIG_SMSC37B787_WDT is not set +# CONFIG_SMSC_SCH311X_WDT is not set +CONFIG_SPARSEMEM_STATIC=y +# CONFIG_STRICT_DEVMEM is not set +# CONFIG_SYSPROF_TRACER is not set +# CONFIG_TELCLOCK is not set +# CONFIG_TOSHIBA is not set +CONFIG_TRACING_SUPPORT=y +CONFIG_UID16=y +CONFIG_USB_SUPPORT=y +CONFIG_USER_STACKTRACE_SUPPORT=y +# CONFIG_VM86 is not set +# CONFIG_VMSPLIT_2G_OPT is not set +# CONFIG_VMSPLIT_3G_OPT is not set +# CONFIG_W83697UG_WDT is not set +# CONFIG_WAFER_WDT is not set +CONFIG_X86=y +CONFIG_X86_32=y +CONFIG_X86_32_LAZY_GS=y +# CONFIG_X86_64 is not set +CONFIG_X86_ALIGNMENT_16=y +CONFIG_X86_BSWAP=y +# CONFIG_X86_CHECK_BIOS_CORRUPTION is not set +CONFIG_X86_CMPXCHG=y +CONFIG_X86_CPU=y +# CONFIG_X86_CPUID is not set +# CONFIG_X86_CPU_DEBUG is not set +# CONFIG_X86_ELAN is not set +CONFIG_X86_EXTENDED_PLATFORM=y +CONFIG_X86_F00F_BUG=y +# CONFIG_X86_GENERIC is not set +CONFIG_X86_INTERNODE_CACHE_BYTES=64 +CONFIG_X86_INVLPG=y +CONFIG_X86_L1_CACHE_BYTES=64 +CONFIG_X86_L1_CACHE_SHIFT=4 +# CONFIG_X86_MCE is not set +CONFIG_X86_MINIMUM_CPU_FAMILY=4 +# CONFIG_X86_MSR is not set +# CONFIG_X86_PAE is not set +# CONFIG_X86_PLATFORM_DEVICES is not set +CONFIG_X86_POPAD_OK=y +# CONFIG_X86_PPRO_FENCE is not set +CONFIG_X86_RDC321X=y +CONFIG_X86_REBOOTFIXUPS=y +# CONFIG_X86_RESERVE_LOW_64K is not set +# CONFIG_X86_UP_APIC is not set +# CONFIG_X86_VERBOSE_BOOTUP is not set +CONFIG_X86_WP_WORKS_OK=y +CONFIG_X86_XADD=y +# CONFIG_ZONE_DMA32 is not set diff --git a/target/linux/rdc/r8610/target.mk b/target/linux/rdc/r8610/target.mk new file mode 100644 index 000000000..f2c7f0d33 --- /dev/null +++ b/target/linux/rdc/r8610/target.mk @@ -0,0 +1,5 @@ +BOARDNAME:=RDC R8160 Evaluation Board +DEFAULT_PACKAGES += kmod-r6040 kmod-usb-core kmod-usb-ohci kmod-usb2 \ + kmod-hwmon-core kmod-hwmon-w83627hf kmod-ide-core kmod-ide-it821x \ + kmod-rtc-core kmod-rtc-m48t86 \ + kmod-fs-ext2 kmod-fs-ext3 From a4df146bd6ed63724e81f1f2f761430e036e4875 Mon Sep 17 00:00:00 2001 From: nbd Date: Tue, 10 Nov 2009 19:27:13 +0000 Subject: [PATCH 123/288] mac80211: fix wpa in client mode git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18355 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/files/lib/wifi/mac80211.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/mac80211/files/lib/wifi/mac80211.sh b/package/mac80211/files/lib/wifi/mac80211.sh index 5af7a9a26..ccd4d2c38 100644 --- a/package/mac80211/files/lib/wifi/mac80211.sh +++ b/package/mac80211/files/lib/wifi/mac80211.sh @@ -248,7 +248,8 @@ enable_mac80211() { fi fi ;; - wpa) + wpa*|psk*) + config_get key "$vif" key if eval "type wpa_supplicant_setup_vif" 2>/dev/null >/dev/null; then wpa_supplicant_setup_vif "$vif" wext || { echo "enable_mac80211($device): Failed to set up wpa_supplicant for interface $ifname" >&2 From 3b3a36db385168971075d15fbf76a27920a7b888 Mon Sep 17 00:00:00 2001 From: nbd Date: Tue, 10 Nov 2009 19:27:19 +0000 Subject: [PATCH 124/288] mac80211: implement wds sta support (wds ap support work in progress, needs hostapd changes) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18356 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/iw/patches/000-upstream.patch | 155 +++++++++++ package/iw/patches/100-4addr.patch | 76 +++++ package/iw/patches/110-sta_vlan.patch | 69 +++++ package/mac80211/files/lib/wifi/mac80211.sh | 5 +- .../mac80211/patches/500-nl80211_4addr.patch | 69 +++++ .../patches/510-mac80211_4addr_vlan.patch | 260 ++++++++++++++++++ 6 files changed, 633 insertions(+), 1 deletion(-) create mode 100644 package/iw/patches/000-upstream.patch create mode 100644 package/iw/patches/100-4addr.patch create mode 100644 package/iw/patches/110-sta_vlan.patch create mode 100644 package/mac80211/patches/500-nl80211_4addr.patch create mode 100644 package/mac80211/patches/510-mac80211_4addr_vlan.patch diff --git a/package/iw/patches/000-upstream.patch b/package/iw/patches/000-upstream.patch new file mode 100644 index 000000000..8aee7758a --- /dev/null +++ b/package/iw/patches/000-upstream.patch @@ -0,0 +1,155 @@ +--- a/Makefile ++++ b/Makefile +@@ -3,7 +3,7 @@ + MAKEFLAGS += --no-print-directory + + PREFIX ?= /usr +-BINDIR ?= $(PREFIX)/bin ++SBINDIR ?= $(PREFIX)/sbin + MANDIR ?= $(PREFIX)/share/man + PKG_CONFIG ?= pkg-config + +@@ -85,8 +85,8 @@ check: + + install: iw iw.8.gz + @$(NQ) ' INST iw' +- $(Q)$(MKDIR) $(DESTDIR)$(BINDIR) +- $(Q)$(INSTALL) -m 755 -t $(DESTDIR)$(BINDIR) iw ++ $(Q)$(MKDIR) $(DESTDIR)$(SBINDIR) ++ $(Q)$(INSTALL) -m 755 -t $(DESTDIR)$(SBINDIR) iw + @$(NQ) ' INST iw.8' + $(Q)$(MKDIR) $(DESTDIR)$(MANDIR)/man8/ + $(Q)$(INSTALL) -m 644 -t $(DESTDIR)$(MANDIR)/man8/ iw.8.gz +--- a/iw.c ++++ b/iw.c +@@ -223,9 +223,12 @@ static int phy_lookup(char *name) + if (fd < 0) + return -1; + pos = read(fd, buf, sizeof(buf) - 1); +- if (pos < 0) ++ if (pos < 0) { ++ close(fd); + return -1; ++ } + buf[pos] = '\0'; ++ close(fd); + return atoi(buf); + } + +--- a/nl80211.h ++++ b/nl80211.h +@@ -262,6 +262,9 @@ + * reasons, for this the %NL80211_ATTR_DISCONNECTED_BY_AP and + * %NL80211_ATTR_REASON_CODE attributes are used. + * ++ * @NL80211_CMD_SET_WIPHY_NETNS: Set a wiphy's netns. Note that all devices ++ * associated with this wiphy must be down and will follow. ++ * + * @NL80211_CMD_MAX: highest used command number + * @__NL80211_CMD_AFTER_LAST: internal use + */ +@@ -336,6 +339,8 @@ enum nl80211_commands { + NL80211_CMD_ROAM, + NL80211_CMD_DISCONNECT, + ++ NL80211_CMD_SET_WIPHY_NETNS, ++ + /* add new commands above here */ + + /* used to define NL80211_CMD_MAX below */ +@@ -475,10 +480,6 @@ enum nl80211_commands { + * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz) + * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive + * scanning and include a zero-length SSID (wildcard) for wildcard scan +- * @NL80211_ATTR_SCAN_GENERATION: the scan generation increases whenever the +- * scan result list changes (BSS expired or added) so that applications +- * can verify that they got a single, consistent snapshot (when all dump +- * messages carried the same generation number) + * @NL80211_ATTR_BSS: scan result BSS + * + * @NL80211_ATTR_REG_INITIATOR: indicates who requested the regulatory domain +@@ -573,6 +574,16 @@ enum nl80211_commands { + * and join_ibss(), key information is in a nested attribute each + * with %NL80211_KEY_* sub-attributes + * ++ * @NL80211_ATTR_PID: Process ID of a network namespace. ++ * ++ * @NL80211_ATTR_GENERATION: Used to indicate consistent snapshots for ++ * dumps. This number increases whenever the object list being ++ * dumped changes, and as such userspace can verify that it has ++ * obtained a complete and consistent snapshot by verifying that ++ * all dump messages contain the same generation number. If it ++ * changed then the list changed and the dump should be repeated ++ * completely from scratch. ++ * + * @NL80211_ATTR_MAX: highest attribute number currently defined + * @__NL80211_ATTR_AFTER_LAST: internal use + */ +@@ -644,7 +655,7 @@ enum nl80211_attrs { + + NL80211_ATTR_SCAN_FREQUENCIES, + NL80211_ATTR_SCAN_SSIDS, +- NL80211_ATTR_SCAN_GENERATION, ++ NL80211_ATTR_GENERATION, /* replaces old SCAN_GENERATION */ + NL80211_ATTR_BSS, + + NL80211_ATTR_REG_INITIATOR, +@@ -701,12 +712,17 @@ enum nl80211_attrs { + NL80211_ATTR_KEY, + NL80211_ATTR_KEYS, + ++ NL80211_ATTR_PID, ++ + /* add attributes here, update the policy in nl80211.c */ + + __NL80211_ATTR_AFTER_LAST, + NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 + }; + ++/* source-level API compatibility */ ++#define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION ++ + /* + * Allow user space programs to use #ifdef on new attributes by defining them + * here +--- a/phy.c ++++ b/phy.c +@@ -140,3 +140,27 @@ static int handle_rts(struct nl80211_sta + COMMAND(set, rts, "", + NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_rts, + "Set rts threshold."); ++ ++static int handle_netns(struct nl80211_state *state, ++ struct nl_cb *cb, ++ struct nl_msg *msg, ++ int argc, char **argv) ++{ ++ char *end; ++ ++ if (argc != 1) ++ return 1; ++ ++ NLA_PUT_U32(msg, NL80211_ATTR_PID, ++ strtoul(argv[0], &end, 10)); ++ ++ if (*end != '\0') ++ return 1; ++ ++ return 0; ++ nla_put_failure: ++ return -ENOBUFS; ++} ++COMMAND(set, netns, "", ++ NL80211_CMD_SET_WIPHY_NETNS, 0, CIB_PHY, handle_netns, ++ "Put this wireless device into a different network namespace"); +--- a/station.c ++++ b/station.c +@@ -127,7 +127,7 @@ static int print_sta_handler(struct nl_m + printf("\n\tmesh plid:\t%d", + nla_get_u16(sinfo[NL80211_STA_INFO_PLID])); + if (sinfo[NL80211_STA_INFO_PLINK_STATE]) { +- switch (nla_get_u16(sinfo[NL80211_STA_INFO_PLINK_STATE])) { ++ switch (nla_get_u8(sinfo[NL80211_STA_INFO_PLINK_STATE])) { + case LISTEN: + strcpy(state_name, "LISTEN"); + break; diff --git a/package/iw/patches/100-4addr.patch b/package/iw/patches/100-4addr.patch new file mode 100644 index 000000000..db6b88010 --- /dev/null +++ b/package/iw/patches/100-4addr.patch @@ -0,0 +1,76 @@ +--- a/interface.c ++++ b/interface.c +@@ -137,6 +137,20 @@ static int get_if_type(int *argc, char * + return 2; + } + ++static int parse_wds_flag(const char *value, struct nl_msg *msg) ++{ ++ if (strcmp(value, "on") == 0) ++ NLA_PUT_U8(msg, NL80211_ATTR_4ADDR, 1); ++ else if (strcmp(value, "off") == 0) ++ NLA_PUT_U8(msg, NL80211_ATTR_4ADDR, 0); ++ else ++ return 1; ++ return 0; ++ ++nla_put_failure: ++ return 1; ++} ++ + static int handle_interface_add(struct nl80211_state *state, + struct nl_cb *cb, + struct nl_msg *msg, +@@ -168,6 +182,15 @@ static int handle_interface_add(struct n + mesh_id = argv[0]; + argc--; + argv++; ++ } else if (strcmp(argv[0], "wds") == 0) { ++ argc--; ++ argv++; ++ if (parse_wds_flag(argv[0], msg)) { ++ fprintf(stderr, "wds error\n"); ++ return 2; ++ } ++ argc--; ++ argv++; + } else if (strcmp(argv[0], "flags") == 0) { + argc--; + argv++; +@@ -192,14 +215,14 @@ static int handle_interface_add(struct n + nla_put_failure: + return -ENOBUFS; + } +-COMMAND(interface, add, " type [mesh_id ] [flags *]", ++COMMAND(interface, add, " type [mesh_id ] [wds on|off] [flags *]", + NL80211_CMD_NEW_INTERFACE, 0, CIB_PHY, handle_interface_add, + "Add a new virtual interface with the given configuration.\n" + IFACE_TYPES "\n\n" + "The flags are only used for monitor interfaces, valid flags are:\n" + VALID_FLAGS "\n\n" + "The mesh_id is used only for mesh mode."); +-COMMAND(interface, add, " type [mesh_id ] [flags *]", ++COMMAND(interface, add, " type [mesh_id ] [wds on|off] [flags *]", + NL80211_CMD_NEW_INTERFACE, 0, CIB_NETDEV, handle_interface_add, NULL); + + static int handle_interface_del(struct nl80211_state *state, +--- a/nl80211.h ++++ b/nl80211.h +@@ -584,6 +584,8 @@ enum nl80211_commands { + * changed then the list changed and the dump should be repeated + * completely from scratch. + * ++ * @NL80211_ATTR_4ADDR: Use 4-address frames on a virtual interface ++ * + * @NL80211_ATTR_MAX: highest attribute number currently defined + * @__NL80211_ATTR_AFTER_LAST: internal use + */ +@@ -714,6 +716,8 @@ enum nl80211_attrs { + + NL80211_ATTR_PID, + ++ NL80211_ATTR_4ADDR, ++ + /* add attributes here, update the policy in nl80211.c */ + + __NL80211_ATTR_AFTER_LAST, diff --git a/package/iw/patches/110-sta_vlan.patch b/package/iw/patches/110-sta_vlan.patch new file mode 100644 index 000000000..913c698bb --- /dev/null +++ b/package/iw/patches/110-sta_vlan.patch @@ -0,0 +1,69 @@ +--- a/station.c ++++ b/station.c +@@ -196,7 +196,7 @@ COMMAND(station, del, "", + NL80211_CMD_DEL_STATION, 0, CIB_NETDEV, handle_station_get, + "Remove the given station entry (use with caution!)"); + +-static int handle_station_set(struct nl80211_state *state, ++static int handle_station_set_plink(struct nl80211_state *state, + struct nl_cb *cb, + struct nl_msg *msg, + int argc, char **argv) +@@ -241,9 +241,56 @@ static int handle_station_set(struct nl8 + return -ENOBUFS; + } + COMMAND(station, set, " plink_action ", +- NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set, ++ NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_plink, + "Set mesh peer link action for this station (peer)."); + ++static int handle_station_set_vlan(struct nl80211_state *state, ++ struct nl_cb *cb, ++ struct nl_msg *msg, ++ int argc, char **argv) ++{ ++ unsigned char mac_addr[ETH_ALEN]; ++ unsigned long sta_vlan = 0; ++ char *err = NULL; ++ ++ if (argc < 3) ++ return 1; ++ ++ if (mac_addr_a2n(mac_addr, argv[0])) { ++ fprintf(stderr, "invalid mac address\n"); ++ return 2; ++ } ++ argc--; ++ argv++; ++ ++ if (strcmp("vlan", argv[0]) != 0) ++ return 1; ++ argc--; ++ argv++; ++ ++ sta_vlan = strtoul(argv[0], &err, 0); ++ if (err && *err) { ++ fprintf(stderr, "invalid vlan id\n"); ++ return 2; ++ } ++ argc--; ++ argv++; ++ ++ if (argc) ++ return 1; ++ ++ NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr); ++ NLA_PUT_U32(msg, NL80211_ATTR_STA_VLAN, sta_vlan); ++ ++ return 0; ++ nla_put_failure: ++ return -ENOBUFS; ++} ++COMMAND(station, set, " vlan ", ++ NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_vlan, ++ "Set an AP VLAN for this station."); ++ ++ + static int handle_station_dump(struct nl80211_state *state, + struct nl_cb *cb, + struct nl_msg *msg, diff --git a/package/mac80211/files/lib/wifi/mac80211.sh b/package/mac80211/files/lib/wifi/mac80211.sh index ccd4d2c38..027749e57 100644 --- a/package/mac80211/files/lib/wifi/mac80211.sh +++ b/package/mac80211/files/lib/wifi/mac80211.sh @@ -104,6 +104,7 @@ enable_mac80211() { config_get enc "$vif" encryption config_get mode "$vif" mode config_get ssid "$vif" ssid + config_get_bool wds "$vif" wds 0 # It is far easier to delete and create the desired interface case "$mode" in @@ -123,7 +124,9 @@ enable_mac80211() { iw phy "$phy" interface add "$ifname" type monitor ;; sta) - iw phy "$phy" interface add "$ifname" type managed + local wdsflag + [ "$wds" -gt 0 ] && wdsflag="wds on" + iw phy "$phy" interface add "$ifname" type managed $wdsflag ;; esac diff --git a/package/mac80211/patches/500-nl80211_4addr.patch b/package/mac80211/patches/500-nl80211_4addr.patch new file mode 100644 index 000000000..de3b78fdb --- /dev/null +++ b/package/mac80211/patches/500-nl80211_4addr.patch @@ -0,0 +1,69 @@ +--- a/include/linux/nl80211.h ++++ b/include/linux/nl80211.h +@@ -584,6 +584,8 @@ enum nl80211_commands { + * changed then the list changed and the dump should be repeated + * completely from scratch. + * ++ * @NL80211_ATTR_4ADDR: Use 4-address frames on a virtual interface ++ * + * @NL80211_ATTR_MAX: highest attribute number currently defined + * @__NL80211_ATTR_AFTER_LAST: internal use + */ +@@ -714,6 +716,8 @@ enum nl80211_attrs { + + NL80211_ATTR_PID, + ++ NL80211_ATTR_4ADDR, ++ + /* add attributes here, update the policy in nl80211.c */ + + __NL80211_ATTR_AFTER_LAST, +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -207,10 +207,12 @@ struct ieee80211_supported_band { + * struct vif_params - describes virtual interface parameters + * @mesh_id: mesh ID to use + * @mesh_id_len: length of the mesh ID ++ * @use_4addr: use 4-address frames + */ + struct vif_params { + u8 *mesh_id; + int mesh_id_len; ++ int use_4addr; + }; + + /** +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -140,6 +140,7 @@ static struct nla_policy nl80211_policy[ + [NL80211_ATTR_CIPHER_SUITE_GROUP] = { .type = NLA_U32 }, + [NL80211_ATTR_WPA_VERSIONS] = { .type = NLA_U32 }, + [NL80211_ATTR_PID] = { .type = NLA_U32 }, ++ [NL80211_ATTR_4ADDR] = { .type = NLA_U8 }, + }; + + /* policy for the attributes */ +@@ -989,6 +990,13 @@ static int nl80211_set_interface(struct + change = true; + } + ++ if (info->attrs[NL80211_ATTR_4ADDR]) { ++ params.use_4addr = !!nla_get_u8(info->attrs[NL80211_ATTR_4ADDR]); ++ change = true; ++ } else { ++ params.use_4addr = -1; ++ } ++ + if (info->attrs[NL80211_ATTR_MNTR_FLAGS]) { + if (ntype != NL80211_IFTYPE_MONITOR) { + err = -EINVAL; +@@ -1055,6 +1063,9 @@ static int nl80211_new_interface(struct + params.mesh_id_len = nla_len(info->attrs[NL80211_ATTR_MESH_ID]); + } + ++ if (info->attrs[NL80211_ATTR_4ADDR]) ++ params.use_4addr = !!nla_get_u8(info->attrs[NL80211_ATTR_4ADDR]); ++ + err = parse_monitor_flags(type == NL80211_IFTYPE_MONITOR ? + info->attrs[NL80211_ATTR_MNTR_FLAGS] : NULL, + &flags); diff --git a/package/mac80211/patches/510-mac80211_4addr_vlan.patch b/package/mac80211/patches/510-mac80211_4addr_vlan.patch new file mode 100644 index 000000000..ac92fe54b --- /dev/null +++ b/package/mac80211/patches/510-mac80211_4addr_vlan.patch @@ -0,0 +1,260 @@ +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -208,6 +208,9 @@ struct ieee80211_if_wds { + + struct ieee80211_if_vlan { + struct list_head list; ++ ++ /* used for all tx if the VLAN is configured to 4-addr mode */ ++ struct sta_info *sta; + }; + + struct mesh_stats { +@@ -457,6 +460,8 @@ struct ieee80211_sub_if_data { + int force_unicast_rateidx; /* forced TX rateidx for unicast frames */ + int max_ratectrl_rateidx; /* max TX rateidx for rate control */ + ++ bool use_4addr; /* use 4-address frames */ ++ + union { + struct ieee80211_if_ap ap; + struct ieee80211_if_wds wds; +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -36,6 +36,24 @@ static bool nl80211_type_check(enum nl80 + } + } + ++static bool nl80211_params_check(enum nl80211_iftype type, ++ struct vif_params *params) ++{ ++ if (!nl80211_type_check(type)) ++ return false; ++ ++ if (params->use_4addr > 0) { ++ switch(type) { ++ case NL80211_IFTYPE_AP_VLAN: ++ case NL80211_IFTYPE_STATION: ++ break; ++ default: ++ return false; ++ } ++ } ++ return true; ++} ++ + static int ieee80211_add_iface(struct wiphy *wiphy, char *name, + enum nl80211_iftype type, u32 *flags, + struct vif_params *params) +@@ -45,7 +63,7 @@ static int ieee80211_add_iface(struct wi + struct ieee80211_sub_if_data *sdata; + int err; + +- if (!nl80211_type_check(type)) ++ if (!nl80211_params_check(type, params)) + return -EINVAL; + + err = ieee80211_if_add(local, name, &dev, type, params); +@@ -75,7 +93,7 @@ static int ieee80211_change_iface(struct + if (netif_running(dev)) + return -EBUSY; + +- if (!nl80211_type_check(type)) ++ if (!nl80211_params_check(type, params)) + return -EINVAL; + + sdata = IEEE80211_DEV_TO_SUB_IF(dev); +@@ -89,6 +107,9 @@ static int ieee80211_change_iface(struct + params->mesh_id_len, + params->mesh_id); + ++ if (params->use_4addr >= 0) ++ sdata->use_4addr = !!params->use_4addr; ++ + if (sdata->vif.type != NL80211_IFTYPE_MONITOR || !flags) + return 0; + +@@ -806,6 +827,13 @@ static int ieee80211_change_station(stru + return -EINVAL; + } + ++ if (vlansdata->use_4addr) { ++ if (vlansdata->u.vlan.sta) ++ return -EBUSY; ++ ++ rcu_assign_pointer(vlansdata->u.vlan.sta, sta); ++ } ++ + sta->sdata = vlansdata; + ieee80211_send_layer2_update(sta); + } +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -489,6 +489,9 @@ static void __sta_info_unlink(struct sta + local->num_sta--; + local->sta_generation++; + ++ if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) ++ rcu_assign_pointer(sdata->u.vlan.sta, NULL); ++ + if (local->ops->sta_notify) { + if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) + sdata = container_of(sdata->bss, +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -1046,7 +1046,10 @@ ieee80211_tx_prepare(struct ieee80211_su + + hdr = (struct ieee80211_hdr *) skb->data; + +- tx->sta = sta_info_get(local, hdr->addr1); ++ if ((sdata->vif.type == NL80211_IFTYPE_AP_VLAN) && sdata->use_4addr) ++ tx->sta = rcu_dereference(sdata->u.vlan.sta); ++ if (!tx->sta) ++ tx->sta = sta_info_get(local, hdr->addr1); + + if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) && + (local->hw.flags & IEEE80211_HW_AMPDU_AGGREGATION)) { +@@ -1608,7 +1611,7 @@ netdev_tx_t ieee80211_subif_start_xmit(s + const u8 *encaps_data; + int encaps_len, skip_header_bytes; + int nh_pos, h_pos; +- struct sta_info *sta; ++ struct sta_info *sta = NULL; + u32 sta_flags = 0; + + if (unlikely(skb->len < ETH_HLEN)) { +@@ -1625,8 +1628,25 @@ netdev_tx_t ieee80211_subif_start_xmit(s + fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA); + + switch (sdata->vif.type) { +- case NL80211_IFTYPE_AP: + case NL80211_IFTYPE_AP_VLAN: ++ rcu_read_lock(); ++ if (sdata->use_4addr) ++ sta = rcu_dereference(sdata->u.vlan.sta); ++ if (sta) { ++ fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); ++ /* RA TA DA SA */ ++ memcpy(hdr.addr1, sta->sta.addr, ETH_ALEN); ++ memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN); ++ memcpy(hdr.addr3, skb->data, ETH_ALEN); ++ memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); ++ hdrlen = 30; ++ sta_flags = get_sta_flags(sta); ++ } ++ rcu_read_unlock(); ++ if (sta) ++ break; ++ /* fall through */ ++ case NL80211_IFTYPE_AP: + fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS); + /* DA BSSID SA */ + memcpy(hdr.addr1, skb->data, ETH_ALEN); +@@ -1700,12 +1720,21 @@ netdev_tx_t ieee80211_subif_start_xmit(s + break; + #endif + case NL80211_IFTYPE_STATION: +- fc |= cpu_to_le16(IEEE80211_FCTL_TODS); +- /* BSSID SA DA */ + memcpy(hdr.addr1, sdata->u.mgd.bssid, ETH_ALEN); +- memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); +- memcpy(hdr.addr3, skb->data, ETH_ALEN); +- hdrlen = 24; ++ if (sdata->use_4addr && ethertype != ETH_P_PAE) { ++ fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); ++ /* RA TA DA SA */ ++ memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN); ++ memcpy(hdr.addr3, skb->data, ETH_ALEN); ++ memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); ++ hdrlen = 30; ++ } else { ++ fc |= cpu_to_le16(IEEE80211_FCTL_TODS); ++ /* BSSID SA DA */ ++ memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); ++ memcpy(hdr.addr3, skb->data, ETH_ALEN); ++ hdrlen = 24; ++ } + break; + case NL80211_IFTYPE_ADHOC: + /* DA SA BSSID */ +--- a/net/mac80211/iface.c ++++ b/net/mac80211/iface.c +@@ -772,6 +772,7 @@ int ieee80211_if_change_type(struct ieee + ieee80211_mandatory_rates(sdata->local, + sdata->local->hw.conf.channel->band); + sdata->drop_unencrypted = 0; ++ sdata->use_4addr = 0; + + return 0; + } +@@ -853,6 +854,9 @@ int ieee80211_if_add(struct ieee80211_lo + params->mesh_id_len, + params->mesh_id); + ++ if (params && params->use_4addr >= 0) ++ sdata->use_4addr = !!params->use_4addr; ++ + mutex_lock(&local->iflist_mtx); + list_add_tail_rcu(&sdata->list, &local->interfaces); + mutex_unlock(&local->iflist_mtx); +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -1237,6 +1237,13 @@ __ieee80211_data_to_8023(struct ieee8021 + { + struct net_device *dev = rx->dev; + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); ++ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; ++ ++ if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && !sdata->use_4addr && ++ ieee80211_has_a4(hdr->frame_control)) ++ return -1; ++ if (sdata->use_4addr && is_multicast_ether_addr(hdr->addr1)) ++ return -1; + + return ieee80211_data_to_8023(rx->skb, dev->dev_addr, sdata->vif.type); + } +@@ -1590,6 +1597,7 @@ ieee80211_rx_h_data(struct ieee80211_rx_ + { + struct net_device *dev = rx->dev; + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; ++ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); + __le16 fc = hdr->frame_control; + int err; + +@@ -1599,6 +1607,14 @@ ieee80211_rx_h_data(struct ieee80211_rx_ + if (unlikely(!ieee80211_is_data_present(hdr->frame_control))) + return RX_DROP_MONITOR; + ++ /* ++ * Allow the cooked monitor interface of an AP to see 4-addr frames so ++ * that a 4-addr station can be detected and moved into a separate VLAN ++ */ ++ if (ieee80211_has_a4(hdr->frame_control) && ++ sdata->vif.type == NL80211_IFTYPE_AP) ++ return RX_DROP_MONITOR; ++ + err = __ieee80211_data_to_8023(rx); + if (unlikely(err)) + return RX_DROP_UNUSABLE; +@@ -2039,7 +2055,7 @@ static int prepare_for_handlers(struct i + + switch (sdata->vif.type) { + case NL80211_IFTYPE_STATION: +- if (!bssid) ++ if (!bssid && !sdata->use_4addr) + return 0; + if (!multicast && + compare_ether_addr(sdata->dev->dev_addr, hdr->addr1) != 0) { +--- a/net/wireless/util.c ++++ b/net/wireless/util.c +@@ -320,7 +320,9 @@ int ieee80211_data_to_8023(struct sk_buf + break; + case cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS): + if (unlikely(iftype != NL80211_IFTYPE_WDS && +- iftype != NL80211_IFTYPE_MESH_POINT)) ++ iftype != NL80211_IFTYPE_MESH_POINT && ++ iftype != NL80211_IFTYPE_AP_VLAN && ++ iftype != NL80211_IFTYPE_STATION)) + return -1; + if (iftype == NL80211_IFTYPE_MESH_POINT) { + struct ieee80211s_hdr *meshdr = From bc624321e8fb058c5ebce476d33d6d0e4dcfa9e3 Mon Sep 17 00:00:00 2001 From: nbd Date: Tue, 10 Nov 2009 22:00:54 +0000 Subject: [PATCH 125/288] build system: introduce a new feature called build variants. it allows building a package multiple times in one pass with different build dirs, based on the same build settings. replaces templating hacks like the one used in the hostapd package git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18357 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- include/package-defaults.mk | 1 + include/package-dumpinfo.mk | 3 ++- include/subdir.mk | 4 +++- scripts/metadata.pl | 3 +++ scripts/metadata.pm | 1 + 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/package-defaults.mk b/include/package-defaults.mk index 2b5cb8671..017a86d1e 100644 --- a/include/package-defaults.mk +++ b/include/package-defaults.mk @@ -37,6 +37,7 @@ define Package/Default KCONFIG:= BUILDONLY:= URL:= + VARIANT:= endef Build/Patch:=$(Build/Patch/Default) diff --git a/include/package-dumpinfo.mk b/include/package-dumpinfo.mk index f48f31507..5f9811b4f 100644 --- a/include/package-dumpinfo.mk +++ b/include/package-dumpinfo.mk @@ -32,7 +32,8 @@ $(if $(MENU),Menu: $(MENU) )Version: $(VERSION) Depends: $(DEPENDS) Provides: $(PROVIDES) -$(if $(PKG_BUILD_DEPENDS),Build-Depends: $(PKG_BUILD_DEPENDS) +$(if $(VARIANT),Build-Variant: $(VARIANT) +)$(if $(PKG_BUILD_DEPENDS),Build-Depends: $(PKG_BUILD_DEPENDS) )$(if $(HOST_BUILD_DEPENDS),Build-Depends/host: $(HOST_BUILD_DEPENDS) )$(if $(BUILD_TYPES),Build-Types: $(BUILD_TYPES) )Section: $(SECTION) diff --git a/include/subdir.mk b/include/subdir.mk index 3c1e3f9ca..b8094afb2 100644 --- a/include/subdir.mk +++ b/include/subdir.mk @@ -35,7 +35,9 @@ define subdir ) $(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(target): $(if $(QUILT),,$($(1)/$(bd)/$(target)) $(call $(1)//$(target),$(1)/$(bd)))) $(if $(BUILD_LOG),@mkdir -p $(BUILD_LOG_DIR)/$(1)/$(bd)) - +$(if $(BUILD_LOG),set -o pipefail;) $$(SUBMAKE) -C $(1)/$(bd) $(target) $(if $(BUILD_LOG),SILENT= 2>&1 | tee $(BUILD_LOG_DIR)/$(1)/$(bd)/$(target).txt) $(if $(findstring $(bd),$($(1)/builddirs-ignore-$(target))), || $(call MESSAGE, ERROR: $(1)/$(bd) failed to build.)) + $(foreach variant,$(if $(BUILD_VARIANT),$(BUILD_VARIANT),$(if $($(1)/$(bd)/variants),$($(1)/$(bd)/variants),__default)), + +$(if $(BUILD_LOG),set -o pipefail;) $$(SUBMAKE) -C $(1)/$(bd) $(target) BUILD_VARIANT="$(filter-out __default,$(variant))" $(if $(BUILD_LOG),SILENT= 2>&1 | tee $(BUILD_LOG_DIR)/$(1)/$(bd)/$(target).txt) $(if $(findstring $(bd),$($(1)/builddirs-ignore-$(target))), || $(call MESSAGE, ERROR: $(1)/$(bd) failed to build$(if $(filter-out __default,$(variant)), (build variant: $(variant))).)) + ) $$(if $(call debug,$(1)/$(bd),v),,.SILENT: $(1)/$(bd)/$(target)) # legacy targets diff --git a/scripts/metadata.pl b/scripts/metadata.pl index ca00fcae6..26d878cc9 100755 --- a/scripts/metadata.pl +++ b/scripts/metadata.pl @@ -620,6 +620,9 @@ sub gen_package_mk() { if ($config) { $pkg->{buildonly} and $config = ""; print "package-$config += $pkg->{subdir}$pkg->{src}\n"; + if ($pkg->{variant}) { + print "\$(curdir)/$pkg->{subdir}$pkg->{src}/variants += \$(if $config,$pkg->{variant})\n" + } $pkg->{prereq} and print "prereq-$config += $pkg->{subdir}$pkg->{src}\n"; } diff --git a/scripts/metadata.pm b/scripts/metadata.pm index 8302728be..b7a448b61 100644 --- a/scripts/metadata.pm +++ b/scripts/metadata.pm @@ -112,6 +112,7 @@ sub parse_package_metadata($) { } }; /^Depends: \s*(.+)\s*$/ and $pkg->{depends} = [ split /\s+/, $1 ]; + /^Build-Variant: \s*(\w+)\s*/ and $pkg->{variant} = $1; /^Build-Only: \s*(.+)\s*$/ and $pkg->{buildonly} = 1; /^Build-Depends: \s*(.+)\s*$/ and $pkg->{builddepends} = [ split /\s+/, $1 ]; /^Build-Depends\/(\w+): \s*(.+)\s*$/ and $pkg->{"builddepends/$1"} = [ split /\s+/, $2 ]; From bb92232db407f57f8991e6686846939c0d64da9c Mon Sep 17 00:00:00 2001 From: nbd Date: Tue, 10 Nov 2009 22:00:59 +0000 Subject: [PATCH 126/288] hostapd: use the new build variants feature to clean up the makefile git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18358 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/hostapd/Makefile | 89 ++++++------------- .../files/{default.config => full.config} | 0 2 files changed, 26 insertions(+), 63 deletions(-) rename package/hostapd/files/{default.config => full.config} (100%) diff --git a/package/hostapd/Makefile b/package/hostapd/Makefile index ddf21683b..d8a3ac8ac 100644 --- a/package/hostapd/Makefile +++ b/package/hostapd/Makefile @@ -29,6 +29,8 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_hostapd-mini \ CONFIG_PACKAGE_kmod-hostap +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + include $(INCLUDE_DIR)/package.mk DRIVER_MAKEOPTS= \ @@ -49,12 +51,9 @@ define Package/hostapd $(call Package/hostapd/Default) TITLE+= (full) DEPENDS+= +PACKAGE_hostapd:libopenssl + VARIANT:=full endef -#define Package/hostapd/conffiles -#/etc/hostapd.conf -#endef - define Package/hostapd/description This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS Authenticator. @@ -63,15 +62,11 @@ endef define Package/hostapd-mini $(call Package/hostapd/Default) TITLE+= (WPA-PSK only) + VARIANT:=mini endef -#define Package/hostapd-mini/conffiles -#/etc/hostapd.conf -#endef - define Package/hostapd-mini/description - This package contains a minimal IEEE 802.1x/WPA/EAP/RADIUS Authenticator - (WPA-PSK only). + This package contains a minimal IEEE 802.1x/WPA Authenticator (WPA-PSK only). endef define Package/hostapd-utils @@ -85,14 +80,8 @@ define Package/hostapd-utils/description IEEE 802.1x/WPA/EAP/RADIUS Authenticator. endef -define Build/ConfigureTarget - rm -rf $(PKG_BUILD_DIR)/hostapd.$(1) - mkdir -p $(PKG_BUILD_DIR)/hostapd.$(1) - $(CP) \ - $(PKG_BUILD_DIR)/hostapd \ - $(PKG_BUILD_DIR)/src \ - $(PKG_BUILD_DIR)/hostapd.$(1)/ - $(CP) ./files/$(1).config $(PKG_BUILD_DIR)/hostapd.$(1)/hostapd/.config +define Build/Configure + $(CP) ./files/$(BUILD_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config endef TARGET_CPPFLAGS := \ @@ -104,66 +93,40 @@ TARGET_CPPFLAGS := \ -DCONFIG_LIBNL20 \ -D_GNU_SOURCE -define Build/CompileTarget +ifdef CONFIG_PACKAGE_kmod-mac80211 + TARGET_LDFLAGS += -lm -lnl-tiny +endif +ifeq ($(BUILD_VARIANT),full) + TARGET_LDFLAGS += -lssl -lcrypto +endif + +define Build/Compile CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \ - $(MAKE) -C $(PKG_BUILD_DIR)/hostapd.$(1)/hostapd \ + $(MAKE) -C $(PKG_BUILD_DIR)/hostapd \ $(TARGET_CONFIGURE_OPTS) \ $(DRIVER_MAKEOPTS) \ - LIBS="$(TARGET_LDFLAGS) \ - $(if $(CONFIG_PACKAGE_kmod-mac80211),-lm -lnl-tiny) \ - $(if $(findstring default,$(1)),-lssl -lcrypto)" \ + LIBS="$(TARGET_LDFLAGS)" \ hostapd hostapd_cli - $(CP) $(PKG_BUILD_DIR)/hostapd.$(1)/hostapd/hostapd_cli $(PKG_BUILD_DIR)/ endef define Package/InstallTemplate - $(INSTALL_DIR) $$(1)/lib/wifi - $(INSTALL_DATA) ./files/hostapd.sh $$(1)/lib/wifi/hostapd.sh - $(INSTALL_DIR) $$(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd.$(2)/hostapd/hostapd $$(1)/usr/sbin/ -# config is managed through uci -# $(INSTALL_DIR) $$(1)/etc -# $(INSTALL_CONF) $(PKG_BUILD_DIR)/hostapd.$(2)/hostapd/hostapd.conf $$(1)/etc/hostapd.conf + $(INSTALL_DIR) $(1)/lib/wifi + $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/ endef -define Package/Template - ifneq ($(CONFIG_PACKAGE_$(1)),) - define Build/Configure/$(2) - $(call Build/ConfigureTarget,$(2)) - endef - define Build/Compile/$(2) - $(call Build/CompileTarget,$(2)) - endef - define Package/$(1)/install - $(call Package/InstallTemplate,$(1),$(2)) - endef - endif -endef - -define Build/Configure - rm -f $(PKG_BUILD_DIR)/.configured* - $(call Build/Configure/default) - $(call Build/Configure/mini) -endef - -define Build/Compile - $(call Build/Compile/default) - $(call Build/Compile/mini) -endef - -define Build/Clean - rm -rf $(PKG_BUILD_DIR)_default - rm -rf $(PKG_BUILD_DIR)_mini -endef +ifeq ($(BUILD_VARIANT),full) + Package/hostapd/install = $(Package/InstallTemplate) +else + Package/hostapd-mini/install = $(Package/InstallTemplate) +endif define Package/hostapd-utils/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd_cli $(1)/usr/sbin/ endef -$(eval $(call Package/Template,hostapd,default)) -$(eval $(call Package/Template,hostapd-mini,mini)) - $(eval $(call BuildPackage,hostapd)) $(eval $(call BuildPackage,hostapd-mini)) $(eval $(call BuildPackage,hostapd-utils)) diff --git a/package/hostapd/files/default.config b/package/hostapd/files/full.config similarity index 100% rename from package/hostapd/files/default.config rename to package/hostapd/files/full.config From be57a0a21b3b78381a5a000a9a0c3569796eb6c3 Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 10 Nov 2009 23:10:07 +0000 Subject: [PATCH 127/288] [rdc] cleanup subtarget kernel configurations to contain only what is required git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18359 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/rdc/amit/config-2.6.30 | 297 ------------------------- target/linux/rdc/ar525w/config-2.6.30 | 297 ------------------------- target/linux/rdc/dir-450/config-2.6.30 | 297 ------------------------- target/linux/rdc/r8610/config-2.6.30 | 297 ------------------------- 4 files changed, 1188 deletions(-) diff --git a/target/linux/rdc/amit/config-2.6.30 b/target/linux/rdc/amit/config-2.6.30 index 81ec1c57a..edda24234 100644 --- a/target/linux/rdc/amit/config-2.6.30 +++ b/target/linux/rdc/amit/config-2.6.30 @@ -1,300 +1,3 @@ -# CONFIG_4KSTACKS is not set -# CONFIG_60XX_WDT is not set -# CONFIG_64BIT is not set -# CONFIG_ACQUIRE_WDT is not set -# CONFIG_ADVANTECH_WDT is not set -# CONFIG_AGP is not set -# CONFIG_ALIM1535_WDT is not set -CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" -CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y -CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y -CONFIG_ARCH_HAS_CPU_RELAX=y -CONFIG_ARCH_HAS_DEFAULT_IDLE=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_MAY_HAVE_PC_FDC=y -# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set -CONFIG_ARCH_POPULATES_NODE_MAP=y -CONFIG_ARCH_SELECT_MEMORY_MODEL=y -CONFIG_ARCH_SPARSEMEM_ENABLE=y -CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y -# CONFIG_ARCH_SUPPORTS_MSI is not set -CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_WANT_FRAME_POINTERS=y -CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y -# CONFIG_ARPD is not set -# CONFIG_AUDIT_ARCH is not set -# CONFIG_BASE_FULL is not set -CONFIG_BASE_SMALL=1 -# CONFIG_BINARY_PRINTF is not set -CONFIG_BITREVERSE=y -# CONFIG_BLK_DEV_INITRD is not set -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=16 -CONFIG_BLK_DEV_RAM_SIZE=4096 -CONFIG_BOUNCE=y -CONFIG_CC_OPTIMIZE_FOR_SIZE=y -# CONFIG_CC_STACKPROTECTOR is not set -CONFIG_CLOCKSOURCE_WATCHDOG=y -CONFIG_CMDLINE="console=ttyS0,38400 rootfstype=squashfs,jffs2" -CONFIG_CMDLINE_BOOL=y -# CONFIG_CMDLINE_OVERRIDE is not set -# CONFIG_COMPAT_NET_DEV_OPS is not set -# CONFIG_COMPAT_VDSO is not set -# CONFIG_CPU5_WDT is not set -# CONFIG_CPU_FREQ is not set -# CONFIG_CPU_SUP_AMD is not set -# CONFIG_CPU_SUP_CENTAUR is not set -# CONFIG_CPU_SUP_CYRIX_32 is not set -# CONFIG_CPU_SUP_INTEL is not set -# CONFIG_CPU_SUP_TRANSMETA_32 is not set -# CONFIG_CPU_SUP_UMC_32 is not set -# CONFIG_CS5535_GPIO is not set -# CONFIG_DCDBAS is not set -# CONFIG_DEBUG_BUGVERBOSE is not set -# CONFIG_DEBUG_FS is not set -CONFIG_DECOMPRESS_LZMA=y -CONFIG_DEFAULT_IO_DELAY_TYPE=0 -# CONFIG_DELL_RBU is not set -CONFIG_DEVPORT=y -# CONFIG_DMA_API_DEBUG is not set -# CONFIG_DMI is not set -CONFIG_DOUBLEFAULT=y -# CONFIG_EARLY_PRINTK is not set -# CONFIG_EDAC is not set -# CONFIG_EDD is not set -# CONFIG_EUROTECH_WDT is not set -CONFIG_FAST_CMPXCHG_LOCAL=y -# CONFIG_FIRMWARE_MEMMAP is not set -CONFIG_FIX_EARLYCON_MEM=y -# CONFIG_FRAME_POINTER is not set -# CONFIG_FTRACE_SYSCALLS is not set -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_GENERIC_CMOS_UPDATE=y -# CONFIG_GENERIC_CPU is not set -CONFIG_GENERIC_FIND_FIRST_BIT=y -CONFIG_GENERIC_FIND_LAST_BIT=y -CONFIG_GENERIC_FIND_NEXT_BIT=y -CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y -CONFIG_GENERIC_IOMAP=y -CONFIG_GENERIC_ISA_DMA=y -# CONFIG_GENERIC_TIME_VSYSCALL is not set -# CONFIG_GEN_RTC is not set -# CONFIG_HAMRADIO is not set -# CONFIG_HANGCHECK_TIMER is not set -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT=y -CONFIG_HAVE_AOUT=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_ATOMIC_IOMAP=y -# CONFIG_HAVE_CPUMASK_OF_CPU_MAP is not set -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_DYNAMIC_PER_CPU_AREA=y -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FTRACE_SYSCALLS=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_HAVE_IDE=y -CONFIG_HAVE_IOREMAP_PROT=y -CONFIG_HAVE_KERNEL_BZIP2=y -CONFIG_HAVE_KERNEL_GZIP=y -CONFIG_HAVE_KERNEL_LZMA=y -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_KVM=y -CONFIG_HAVE_KVM_IRQCHIP=y -CONFIG_HAVE_LATENCYTOP_SUPPORT=y -CONFIG_HAVE_MLOCK=y -CONFIG_HAVE_MMIOTRACE_SUPPORT=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_SETUP_PER_CPU_AREA=y -CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y -# CONFIG_HIGHMEM4G is not set -# CONFIG_HIGHMEM64G is not set -# CONFIG_HIGH_RES_TIMERS is not set -# CONFIG_HPET_TIMER is not set -# CONFIG_HP_WATCHDOG is not set -# CONFIG_HUGETLBFS is not set -# CONFIG_HW_RANDOM is not set -CONFIG_HZ=250 -# CONFIG_HZ_100 is not set -CONFIG_HZ_250=y -# CONFIG_I2C is not set -# CONFIG_I6300ESB_WDT is not set -# CONFIG_I8K is not set -# CONFIG_IB700_WDT is not set -# CONFIG_IBMASR is not set -# CONFIG_IOMMU_API is not set -# CONFIG_IOMMU_HELPER is not set -CONFIG_IO_DELAY_0X80=y -# CONFIG_IO_DELAY_0XED is not set -# CONFIG_IO_DELAY_NONE is not set -CONFIG_IO_DELAY_TYPE_0X80=0 -CONFIG_IO_DELAY_TYPE_0XED=1 -CONFIG_IO_DELAY_TYPE_NONE=3 -CONFIG_IO_DELAY_TYPE_UDELAY=2 -# CONFIG_IO_DELAY_UDELAY is not set -# CONFIG_IP_MROUTE is not set -# CONFIG_ISA is not set -CONFIG_ISA_DMA_API=y -# CONFIG_ISCSI_IBFT_FIND is not set -# CONFIG_IT8712F_WDT is not set -# CONFIG_IT87_WDT is not set -# CONFIG_ITCO_WDT is not set -# CONFIG_JFFS2_SUMMARY is not set -# CONFIG_KERNEL_BZIP2 is not set -# CONFIG_KERNEL_GZIP is not set -CONFIG_KERNEL_LZMA=y -CONFIG_KTIME_SCALAR=y -CONFIG_LBD=y -# CONFIG_LEDS_ALIX2 is not set -# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set -# CONFIG_LEDS_TRIGGER_NETDEV is not set -# CONFIG_LEDS_TRIGGER_TIMER is not set -# CONFIG_M386 is not set -CONFIG_M486=y -# CONFIG_M586 is not set -# CONFIG_M586MMX is not set -# CONFIG_M586TSC is not set -# CONFIG_M686 is not set -# CONFIG_MACHZ_WDT is not set -# CONFIG_MACINTOSH_DRIVERS is not set -CONFIG_MATH_EMULATION=y -# CONFIG_MCA is not set -# CONFIG_MCORE2 is not set -# CONFIG_MCRUSOE is not set -# CONFIG_MCYRIXIII is not set -# CONFIG_MEFFICEON is not set -# CONFIG_MEMTEST is not set -# CONFIG_MGEODEGX1 is not set -# CONFIG_MGEODE_LX is not set -# CONFIG_MICROCODE is not set -# CONFIG_MK6 is not set -# CONFIG_MK7 is not set -# CONFIG_MK8 is not set -# CONFIG_MMIOTRACE is not set -CONFIG_MODULE_FORCE_UNLOAD=y -# CONFIG_MPENTIUM4 is not set -# CONFIG_MPENTIUMII is not set -# CONFIG_MPENTIUMIII is not set -# CONFIG_MPENTIUMM is not set -# CONFIG_MPSC is not set -# CONFIG_MTD_CFI_INTELEXT is not set -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -# CONFIG_MTD_NETSC520 is not set CONFIG_MTD_PHYSMAP=y # CONFIG_MTD_R8610 is not set # CONFIG_MTD_RDC3210 is not set -# CONFIG_MTD_TS5500 is not set -# CONFIG_MTRR is not set -# CONFIG_MVIAC3_2 is not set -# CONFIG_MVIAC7 is not set -# CONFIG_MWINCHIP3D is not set -# CONFIG_MWINCHIPC6 is not set -# CONFIG_NATSEMI is not set -# CONFIG_NETDEV_1000 is not set -CONFIG_NOHIGHMEM=y -CONFIG_NR_CPUS=1 -# CONFIG_NSC_GPIO is not set -# CONFIG_NVRAM is not set -# CONFIG_OLPC is not set -# CONFIG_OPTIMIZE_INLINING is not set -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PAGE_OFFSET=0xC0000000 -# CONFIG_PARAVIRT_GUEST is not set -# CONFIG_PC8736x_GPIO is not set -# CONFIG_PC87413_WDT is not set -CONFIG_PCI=y -# CONFIG_PCIEPORTBUS is not set -CONFIG_PCI_BIOS=y -CONFIG_PCI_DIRECT=y -CONFIG_PCI_DISABLE_COMMON_QUIRKS=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_GOANY=y -# CONFIG_PCI_GOBIOS is not set -# CONFIG_PCI_GODIRECT is not set -# CONFIG_PCI_GOMMCONFIG is not set -# CONFIG_PCI_GOOLPC is not set -# CONFIG_PCI_QUIRKS is not set -# CONFIG_PCSPKR_PLATFORM is not set -CONFIG_PHYSICAL_ALIGN=0x100000 -CONFIG_PHYSICAL_START=0x100000 -# CONFIG_POWER_TRACER is not set -CONFIG_PROCESSOR_SELECT=y -# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set -CONFIG_RDC321X_WDT=m -# CONFIG_RELOCATABLE is not set -# CONFIG_RTC is not set -# CONFIG_RWSEM_GENERIC_SPINLOCK is not set -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -# CONFIG_SBC7240_WDT is not set -# CONFIG_SBC8360_WDT is not set -# CONFIG_SBC_EPX_C3_WATCHDOG is not set -# CONFIG_SC1200_WDT is not set -# CONFIG_SC520_WDT is not set -# CONFIG_SCHED_HRTICK is not set -CONFIG_SCHED_OMIT_FRAME_POINTER=y -# CONFIG_SCSI_DMA is not set -# CONFIG_SCx200 is not set -# CONFIG_SERIAL_8250_EXTENDED is not set -# CONFIG_SHMEM is not set -# CONFIG_SLOW_WORK is not set -# CONFIG_SMP is not set -# CONFIG_SMSC37B787_WDT is not set -# CONFIG_SMSC_SCH311X_WDT is not set -CONFIG_SPARSEMEM_STATIC=y -# CONFIG_STRICT_DEVMEM is not set -# CONFIG_SYSPROF_TRACER is not set -# CONFIG_TELCLOCK is not set -# CONFIG_TOSHIBA is not set -CONFIG_TRACING_SUPPORT=y -CONFIG_UID16=y -CONFIG_USB_SUPPORT=y -CONFIG_USER_STACKTRACE_SUPPORT=y -# CONFIG_VM86 is not set -# CONFIG_VMSPLIT_2G_OPT is not set -# CONFIG_VMSPLIT_3G_OPT is not set -# CONFIG_W83697UG_WDT is not set -# CONFIG_WAFER_WDT is not set -CONFIG_X86=y -CONFIG_X86_32=y -CONFIG_X86_32_LAZY_GS=y -# CONFIG_X86_64 is not set -CONFIG_X86_ALIGNMENT_16=y -CONFIG_X86_BSWAP=y -# CONFIG_X86_CHECK_BIOS_CORRUPTION is not set -CONFIG_X86_CMPXCHG=y -CONFIG_X86_CPU=y -# CONFIG_X86_CPUID is not set -# CONFIG_X86_CPU_DEBUG is not set -# CONFIG_X86_ELAN is not set -CONFIG_X86_EXTENDED_PLATFORM=y -CONFIG_X86_F00F_BUG=y -# CONFIG_X86_GENERIC is not set -CONFIG_X86_INTERNODE_CACHE_BYTES=64 -CONFIG_X86_INVLPG=y -CONFIG_X86_L1_CACHE_BYTES=64 -CONFIG_X86_L1_CACHE_SHIFT=4 -# CONFIG_X86_MCE is not set -CONFIG_X86_MINIMUM_CPU_FAMILY=4 -# CONFIG_X86_MSR is not set -# CONFIG_X86_PAE is not set -# CONFIG_X86_PLATFORM_DEVICES is not set -CONFIG_X86_POPAD_OK=y -# CONFIG_X86_PPRO_FENCE is not set -CONFIG_X86_RDC321X=y -CONFIG_X86_REBOOTFIXUPS=y -# CONFIG_X86_RESERVE_LOW_64K is not set -# CONFIG_X86_UP_APIC is not set -# CONFIG_X86_VERBOSE_BOOTUP is not set -CONFIG_X86_WP_WORKS_OK=y -CONFIG_X86_XADD=y -# CONFIG_ZONE_DMA32 is not set diff --git a/target/linux/rdc/ar525w/config-2.6.30 b/target/linux/rdc/ar525w/config-2.6.30 index c3ec46426..aeed11632 100644 --- a/target/linux/rdc/ar525w/config-2.6.30 +++ b/target/linux/rdc/ar525w/config-2.6.30 @@ -1,195 +1,3 @@ -# CONFIG_4KSTACKS is not set -# CONFIG_60XX_WDT is not set -# CONFIG_64BIT is not set -# CONFIG_ACQUIRE_WDT is not set -# CONFIG_ADVANTECH_WDT is not set -# CONFIG_AGP is not set -# CONFIG_ALIM1535_WDT is not set -CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" -CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y -CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y -CONFIG_ARCH_HAS_CPU_RELAX=y -CONFIG_ARCH_HAS_DEFAULT_IDLE=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_MAY_HAVE_PC_FDC=y -# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set -CONFIG_ARCH_POPULATES_NODE_MAP=y -CONFIG_ARCH_SELECT_MEMORY_MODEL=y -CONFIG_ARCH_SPARSEMEM_ENABLE=y -CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y -# CONFIG_ARCH_SUPPORTS_MSI is not set -CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_WANT_FRAME_POINTERS=y -CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y -# CONFIG_ARPD is not set -# CONFIG_AUDIT_ARCH is not set -# CONFIG_BASE_FULL is not set -CONFIG_BASE_SMALL=1 -# CONFIG_BINARY_PRINTF is not set -CONFIG_BITREVERSE=y -# CONFIG_BLK_DEV_INITRD is not set -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=16 -CONFIG_BLK_DEV_RAM_SIZE=4096 -CONFIG_BOUNCE=y -CONFIG_CC_OPTIMIZE_FOR_SIZE=y -# CONFIG_CC_STACKPROTECTOR is not set -CONFIG_CLOCKSOURCE_WATCHDOG=y -CONFIG_CMDLINE="console=ttyS0,38400 rootfstype=squashfs,jffs2" -CONFIG_CMDLINE_BOOL=y -# CONFIG_CMDLINE_OVERRIDE is not set -# CONFIG_COMPAT_NET_DEV_OPS is not set -# CONFIG_COMPAT_VDSO is not set -# CONFIG_CPU5_WDT is not set -# CONFIG_CPU_FREQ is not set -# CONFIG_CPU_SUP_AMD is not set -# CONFIG_CPU_SUP_CENTAUR is not set -# CONFIG_CPU_SUP_CYRIX_32 is not set -# CONFIG_CPU_SUP_INTEL is not set -# CONFIG_CPU_SUP_TRANSMETA_32 is not set -# CONFIG_CPU_SUP_UMC_32 is not set -# CONFIG_CS5535_GPIO is not set -# CONFIG_DCDBAS is not set -# CONFIG_DEBUG_BUGVERBOSE is not set -# CONFIG_DEBUG_FS is not set -CONFIG_DECOMPRESS_LZMA=y -CONFIG_DEFAULT_IO_DELAY_TYPE=0 -# CONFIG_DELL_RBU is not set -CONFIG_DEVPORT=y -# CONFIG_DMA_API_DEBUG is not set -# CONFIG_DMI is not set -CONFIG_DOUBLEFAULT=y -# CONFIG_EARLY_PRINTK is not set -# CONFIG_EDAC is not set -# CONFIG_EDD is not set -# CONFIG_EUROTECH_WDT is not set -CONFIG_FAST_CMPXCHG_LOCAL=y -# CONFIG_FIRMWARE_MEMMAP is not set -CONFIG_FIX_EARLYCON_MEM=y -# CONFIG_FRAME_POINTER is not set -# CONFIG_FTRACE_SYSCALLS is not set -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_GENERIC_CMOS_UPDATE=y -# CONFIG_GENERIC_CPU is not set -CONFIG_GENERIC_FIND_FIRST_BIT=y -CONFIG_GENERIC_FIND_LAST_BIT=y -CONFIG_GENERIC_FIND_NEXT_BIT=y -CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y -CONFIG_GENERIC_IOMAP=y -CONFIG_GENERIC_ISA_DMA=y -# CONFIG_GENERIC_TIME_VSYSCALL is not set -# CONFIG_GEN_RTC is not set -# CONFIG_HAMRADIO is not set -# CONFIG_HANGCHECK_TIMER is not set -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT=y -CONFIG_HAVE_AOUT=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_ATOMIC_IOMAP=y -# CONFIG_HAVE_CPUMASK_OF_CPU_MAP is not set -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_DYNAMIC_PER_CPU_AREA=y -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FTRACE_SYSCALLS=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_HAVE_IDE=y -CONFIG_HAVE_IOREMAP_PROT=y -CONFIG_HAVE_KERNEL_BZIP2=y -CONFIG_HAVE_KERNEL_GZIP=y -CONFIG_HAVE_KERNEL_LZMA=y -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_KVM=y -CONFIG_HAVE_KVM_IRQCHIP=y -CONFIG_HAVE_LATENCYTOP_SUPPORT=y -CONFIG_HAVE_MLOCK=y -CONFIG_HAVE_MMIOTRACE_SUPPORT=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_SETUP_PER_CPU_AREA=y -CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y -# CONFIG_HIGHMEM4G is not set -# CONFIG_HIGHMEM64G is not set -# CONFIG_HIGH_RES_TIMERS is not set -# CONFIG_HPET_TIMER is not set -# CONFIG_HP_WATCHDOG is not set -# CONFIG_HUGETLBFS is not set -# CONFIG_HW_RANDOM is not set -CONFIG_HZ=250 -# CONFIG_HZ_100 is not set -CONFIG_HZ_250=y -# CONFIG_I2C is not set -# CONFIG_I6300ESB_WDT is not set -# CONFIG_I8K is not set -# CONFIG_IB700_WDT is not set -# CONFIG_IBMASR is not set -# CONFIG_IOMMU_API is not set -# CONFIG_IOMMU_HELPER is not set -CONFIG_IO_DELAY_0X80=y -# CONFIG_IO_DELAY_0XED is not set -# CONFIG_IO_DELAY_NONE is not set -CONFIG_IO_DELAY_TYPE_0X80=0 -CONFIG_IO_DELAY_TYPE_0XED=1 -CONFIG_IO_DELAY_TYPE_NONE=3 -CONFIG_IO_DELAY_TYPE_UDELAY=2 -# CONFIG_IO_DELAY_UDELAY is not set -# CONFIG_IP_MROUTE is not set -# CONFIG_ISA is not set -CONFIG_ISA_DMA_API=y -# CONFIG_ISCSI_IBFT_FIND is not set -# CONFIG_IT8712F_WDT is not set -# CONFIG_IT87_WDT is not set -# CONFIG_ITCO_WDT is not set -# CONFIG_JFFS2_SUMMARY is not set -# CONFIG_KERNEL_BZIP2 is not set -# CONFIG_KERNEL_GZIP is not set -CONFIG_KERNEL_LZMA=y -CONFIG_KTIME_SCALAR=y -CONFIG_LBD=y -# CONFIG_LEDS_ALIX2 is not set -# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set -# CONFIG_LEDS_TRIGGER_NETDEV is not set -# CONFIG_LEDS_TRIGGER_TIMER is not set -# CONFIG_M386 is not set -CONFIG_M486=y -# CONFIG_M586 is not set -# CONFIG_M586MMX is not set -# CONFIG_M586TSC is not set -# CONFIG_M686 is not set -# CONFIG_MACHZ_WDT is not set -# CONFIG_MACINTOSH_DRIVERS is not set -CONFIG_MATH_EMULATION=y -# CONFIG_MCA is not set -# CONFIG_MCORE2 is not set -# CONFIG_MCRUSOE is not set -# CONFIG_MCYRIXIII is not set -# CONFIG_MEFFICEON is not set -# CONFIG_MEMTEST is not set -# CONFIG_MGEODEGX1 is not set -# CONFIG_MGEODE_LX is not set -# CONFIG_MICROCODE is not set -# CONFIG_MK6 is not set -# CONFIG_MK7 is not set -# CONFIG_MK8 is not set -# CONFIG_MMIOTRACE is not set -CONFIG_MODULE_FORCE_UNLOAD=y -# CONFIG_MPENTIUM4 is not set -# CONFIG_MPENTIUMII is not set -# CONFIG_MPENTIUMIII is not set -# CONFIG_MPENTIUMM is not set -# CONFIG_MPSC is not set -# CONFIG_MTD_CFI_INTELEXT is not set -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -# CONFIG_MTD_NETSC520 is not set # CONFIG_MTD_PHYSMAP is not set # CONFIG_MTD_R8610 is not set CONFIG_MTD_RDC3210=y @@ -198,108 +6,3 @@ CONFIG_MTD_RDC3210_BUSWIDTH=2 # CONFIG_MTD_RDC3210_FACTORY_PRESENT is not set CONFIG_MTD_RDC3210_SIZE=0x400000 # CONFIG_MTD_RDC3210_STATIC_MAP is not set -# CONFIG_MTD_TS5500 is not set -# CONFIG_MTRR is not set -# CONFIG_MVIAC3_2 is not set -# CONFIG_MVIAC7 is not set -# CONFIG_MWINCHIP3D is not set -# CONFIG_MWINCHIPC6 is not set -# CONFIG_NATSEMI is not set -# CONFIG_NETDEV_1000 is not set -CONFIG_NOHIGHMEM=y -CONFIG_NR_CPUS=1 -# CONFIG_NSC_GPIO is not set -# CONFIG_NVRAM is not set -# CONFIG_OLPC is not set -# CONFIG_OPTIMIZE_INLINING is not set -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PAGE_OFFSET=0xC0000000 -# CONFIG_PARAVIRT_GUEST is not set -# CONFIG_PC8736x_GPIO is not set -# CONFIG_PC87413_WDT is not set -CONFIG_PCI=y -# CONFIG_PCIEPORTBUS is not set -CONFIG_PCI_BIOS=y -CONFIG_PCI_DIRECT=y -CONFIG_PCI_DISABLE_COMMON_QUIRKS=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_GOANY=y -# CONFIG_PCI_GOBIOS is not set -# CONFIG_PCI_GODIRECT is not set -# CONFIG_PCI_GOMMCONFIG is not set -# CONFIG_PCI_GOOLPC is not set -# CONFIG_PCI_QUIRKS is not set -# CONFIG_PCSPKR_PLATFORM is not set -CONFIG_PHYSICAL_ALIGN=0x100000 -CONFIG_PHYSICAL_START=0x100000 -# CONFIG_POWER_TRACER is not set -CONFIG_PROCESSOR_SELECT=y -# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set -CONFIG_RDC321X_WDT=m -# CONFIG_RELOCATABLE is not set -# CONFIG_RTC is not set -# CONFIG_RWSEM_GENERIC_SPINLOCK is not set -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -# CONFIG_SBC7240_WDT is not set -# CONFIG_SBC8360_WDT is not set -# CONFIG_SBC_EPX_C3_WATCHDOG is not set -# CONFIG_SC1200_WDT is not set -# CONFIG_SC520_WDT is not set -# CONFIG_SCHED_HRTICK is not set -CONFIG_SCHED_OMIT_FRAME_POINTER=y -# CONFIG_SCSI_DMA is not set -# CONFIG_SCx200 is not set -# CONFIG_SERIAL_8250_EXTENDED is not set -# CONFIG_SHMEM is not set -# CONFIG_SLOW_WORK is not set -# CONFIG_SMP is not set -# CONFIG_SMSC37B787_WDT is not set -# CONFIG_SMSC_SCH311X_WDT is not set -CONFIG_SPARSEMEM_STATIC=y -# CONFIG_STRICT_DEVMEM is not set -# CONFIG_SYSPROF_TRACER is not set -# CONFIG_TELCLOCK is not set -# CONFIG_TOSHIBA is not set -CONFIG_TRACING_SUPPORT=y -CONFIG_UID16=y -CONFIG_USB_SUPPORT=y -CONFIG_USER_STACKTRACE_SUPPORT=y -# CONFIG_VM86 is not set -# CONFIG_VMSPLIT_2G_OPT is not set -# CONFIG_VMSPLIT_3G_OPT is not set -# CONFIG_W83697UG_WDT is not set -# CONFIG_WAFER_WDT is not set -CONFIG_X86=y -CONFIG_X86_32=y -CONFIG_X86_32_LAZY_GS=y -# CONFIG_X86_64 is not set -CONFIG_X86_ALIGNMENT_16=y -CONFIG_X86_BSWAP=y -# CONFIG_X86_CHECK_BIOS_CORRUPTION is not set -CONFIG_X86_CMPXCHG=y -CONFIG_X86_CPU=y -# CONFIG_X86_CPUID is not set -# CONFIG_X86_CPU_DEBUG is not set -# CONFIG_X86_ELAN is not set -CONFIG_X86_EXTENDED_PLATFORM=y -CONFIG_X86_F00F_BUG=y -# CONFIG_X86_GENERIC is not set -CONFIG_X86_INTERNODE_CACHE_BYTES=64 -CONFIG_X86_INVLPG=y -CONFIG_X86_L1_CACHE_BYTES=64 -CONFIG_X86_L1_CACHE_SHIFT=4 -# CONFIG_X86_MCE is not set -CONFIG_X86_MINIMUM_CPU_FAMILY=4 -# CONFIG_X86_MSR is not set -# CONFIG_X86_PAE is not set -# CONFIG_X86_PLATFORM_DEVICES is not set -CONFIG_X86_POPAD_OK=y -# CONFIG_X86_PPRO_FENCE is not set -CONFIG_X86_RDC321X=y -CONFIG_X86_REBOOTFIXUPS=y -# CONFIG_X86_RESERVE_LOW_64K is not set -# CONFIG_X86_UP_APIC is not set -# CONFIG_X86_VERBOSE_BOOTUP is not set -CONFIG_X86_WP_WORKS_OK=y -CONFIG_X86_XADD=y -# CONFIG_ZONE_DMA32 is not set diff --git a/target/linux/rdc/dir-450/config-2.6.30 b/target/linux/rdc/dir-450/config-2.6.30 index 81ec1c57a..edda24234 100644 --- a/target/linux/rdc/dir-450/config-2.6.30 +++ b/target/linux/rdc/dir-450/config-2.6.30 @@ -1,300 +1,3 @@ -# CONFIG_4KSTACKS is not set -# CONFIG_60XX_WDT is not set -# CONFIG_64BIT is not set -# CONFIG_ACQUIRE_WDT is not set -# CONFIG_ADVANTECH_WDT is not set -# CONFIG_AGP is not set -# CONFIG_ALIM1535_WDT is not set -CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" -CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y -CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y -CONFIG_ARCH_HAS_CPU_RELAX=y -CONFIG_ARCH_HAS_DEFAULT_IDLE=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_MAY_HAVE_PC_FDC=y -# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set -CONFIG_ARCH_POPULATES_NODE_MAP=y -CONFIG_ARCH_SELECT_MEMORY_MODEL=y -CONFIG_ARCH_SPARSEMEM_ENABLE=y -CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y -# CONFIG_ARCH_SUPPORTS_MSI is not set -CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_WANT_FRAME_POINTERS=y -CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y -# CONFIG_ARPD is not set -# CONFIG_AUDIT_ARCH is not set -# CONFIG_BASE_FULL is not set -CONFIG_BASE_SMALL=1 -# CONFIG_BINARY_PRINTF is not set -CONFIG_BITREVERSE=y -# CONFIG_BLK_DEV_INITRD is not set -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=16 -CONFIG_BLK_DEV_RAM_SIZE=4096 -CONFIG_BOUNCE=y -CONFIG_CC_OPTIMIZE_FOR_SIZE=y -# CONFIG_CC_STACKPROTECTOR is not set -CONFIG_CLOCKSOURCE_WATCHDOG=y -CONFIG_CMDLINE="console=ttyS0,38400 rootfstype=squashfs,jffs2" -CONFIG_CMDLINE_BOOL=y -# CONFIG_CMDLINE_OVERRIDE is not set -# CONFIG_COMPAT_NET_DEV_OPS is not set -# CONFIG_COMPAT_VDSO is not set -# CONFIG_CPU5_WDT is not set -# CONFIG_CPU_FREQ is not set -# CONFIG_CPU_SUP_AMD is not set -# CONFIG_CPU_SUP_CENTAUR is not set -# CONFIG_CPU_SUP_CYRIX_32 is not set -# CONFIG_CPU_SUP_INTEL is not set -# CONFIG_CPU_SUP_TRANSMETA_32 is not set -# CONFIG_CPU_SUP_UMC_32 is not set -# CONFIG_CS5535_GPIO is not set -# CONFIG_DCDBAS is not set -# CONFIG_DEBUG_BUGVERBOSE is not set -# CONFIG_DEBUG_FS is not set -CONFIG_DECOMPRESS_LZMA=y -CONFIG_DEFAULT_IO_DELAY_TYPE=0 -# CONFIG_DELL_RBU is not set -CONFIG_DEVPORT=y -# CONFIG_DMA_API_DEBUG is not set -# CONFIG_DMI is not set -CONFIG_DOUBLEFAULT=y -# CONFIG_EARLY_PRINTK is not set -# CONFIG_EDAC is not set -# CONFIG_EDD is not set -# CONFIG_EUROTECH_WDT is not set -CONFIG_FAST_CMPXCHG_LOCAL=y -# CONFIG_FIRMWARE_MEMMAP is not set -CONFIG_FIX_EARLYCON_MEM=y -# CONFIG_FRAME_POINTER is not set -# CONFIG_FTRACE_SYSCALLS is not set -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_GENERIC_CMOS_UPDATE=y -# CONFIG_GENERIC_CPU is not set -CONFIG_GENERIC_FIND_FIRST_BIT=y -CONFIG_GENERIC_FIND_LAST_BIT=y -CONFIG_GENERIC_FIND_NEXT_BIT=y -CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y -CONFIG_GENERIC_IOMAP=y -CONFIG_GENERIC_ISA_DMA=y -# CONFIG_GENERIC_TIME_VSYSCALL is not set -# CONFIG_GEN_RTC is not set -# CONFIG_HAMRADIO is not set -# CONFIG_HANGCHECK_TIMER is not set -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT=y -CONFIG_HAVE_AOUT=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_ATOMIC_IOMAP=y -# CONFIG_HAVE_CPUMASK_OF_CPU_MAP is not set -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_DYNAMIC_PER_CPU_AREA=y -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FTRACE_SYSCALLS=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_HAVE_IDE=y -CONFIG_HAVE_IOREMAP_PROT=y -CONFIG_HAVE_KERNEL_BZIP2=y -CONFIG_HAVE_KERNEL_GZIP=y -CONFIG_HAVE_KERNEL_LZMA=y -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_KVM=y -CONFIG_HAVE_KVM_IRQCHIP=y -CONFIG_HAVE_LATENCYTOP_SUPPORT=y -CONFIG_HAVE_MLOCK=y -CONFIG_HAVE_MMIOTRACE_SUPPORT=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_SETUP_PER_CPU_AREA=y -CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y -# CONFIG_HIGHMEM4G is not set -# CONFIG_HIGHMEM64G is not set -# CONFIG_HIGH_RES_TIMERS is not set -# CONFIG_HPET_TIMER is not set -# CONFIG_HP_WATCHDOG is not set -# CONFIG_HUGETLBFS is not set -# CONFIG_HW_RANDOM is not set -CONFIG_HZ=250 -# CONFIG_HZ_100 is not set -CONFIG_HZ_250=y -# CONFIG_I2C is not set -# CONFIG_I6300ESB_WDT is not set -# CONFIG_I8K is not set -# CONFIG_IB700_WDT is not set -# CONFIG_IBMASR is not set -# CONFIG_IOMMU_API is not set -# CONFIG_IOMMU_HELPER is not set -CONFIG_IO_DELAY_0X80=y -# CONFIG_IO_DELAY_0XED is not set -# CONFIG_IO_DELAY_NONE is not set -CONFIG_IO_DELAY_TYPE_0X80=0 -CONFIG_IO_DELAY_TYPE_0XED=1 -CONFIG_IO_DELAY_TYPE_NONE=3 -CONFIG_IO_DELAY_TYPE_UDELAY=2 -# CONFIG_IO_DELAY_UDELAY is not set -# CONFIG_IP_MROUTE is not set -# CONFIG_ISA is not set -CONFIG_ISA_DMA_API=y -# CONFIG_ISCSI_IBFT_FIND is not set -# CONFIG_IT8712F_WDT is not set -# CONFIG_IT87_WDT is not set -# CONFIG_ITCO_WDT is not set -# CONFIG_JFFS2_SUMMARY is not set -# CONFIG_KERNEL_BZIP2 is not set -# CONFIG_KERNEL_GZIP is not set -CONFIG_KERNEL_LZMA=y -CONFIG_KTIME_SCALAR=y -CONFIG_LBD=y -# CONFIG_LEDS_ALIX2 is not set -# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set -# CONFIG_LEDS_TRIGGER_NETDEV is not set -# CONFIG_LEDS_TRIGGER_TIMER is not set -# CONFIG_M386 is not set -CONFIG_M486=y -# CONFIG_M586 is not set -# CONFIG_M586MMX is not set -# CONFIG_M586TSC is not set -# CONFIG_M686 is not set -# CONFIG_MACHZ_WDT is not set -# CONFIG_MACINTOSH_DRIVERS is not set -CONFIG_MATH_EMULATION=y -# CONFIG_MCA is not set -# CONFIG_MCORE2 is not set -# CONFIG_MCRUSOE is not set -# CONFIG_MCYRIXIII is not set -# CONFIG_MEFFICEON is not set -# CONFIG_MEMTEST is not set -# CONFIG_MGEODEGX1 is not set -# CONFIG_MGEODE_LX is not set -# CONFIG_MICROCODE is not set -# CONFIG_MK6 is not set -# CONFIG_MK7 is not set -# CONFIG_MK8 is not set -# CONFIG_MMIOTRACE is not set -CONFIG_MODULE_FORCE_UNLOAD=y -# CONFIG_MPENTIUM4 is not set -# CONFIG_MPENTIUMII is not set -# CONFIG_MPENTIUMIII is not set -# CONFIG_MPENTIUMM is not set -# CONFIG_MPSC is not set -# CONFIG_MTD_CFI_INTELEXT is not set -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -# CONFIG_MTD_NETSC520 is not set CONFIG_MTD_PHYSMAP=y # CONFIG_MTD_R8610 is not set # CONFIG_MTD_RDC3210 is not set -# CONFIG_MTD_TS5500 is not set -# CONFIG_MTRR is not set -# CONFIG_MVIAC3_2 is not set -# CONFIG_MVIAC7 is not set -# CONFIG_MWINCHIP3D is not set -# CONFIG_MWINCHIPC6 is not set -# CONFIG_NATSEMI is not set -# CONFIG_NETDEV_1000 is not set -CONFIG_NOHIGHMEM=y -CONFIG_NR_CPUS=1 -# CONFIG_NSC_GPIO is not set -# CONFIG_NVRAM is not set -# CONFIG_OLPC is not set -# CONFIG_OPTIMIZE_INLINING is not set -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PAGE_OFFSET=0xC0000000 -# CONFIG_PARAVIRT_GUEST is not set -# CONFIG_PC8736x_GPIO is not set -# CONFIG_PC87413_WDT is not set -CONFIG_PCI=y -# CONFIG_PCIEPORTBUS is not set -CONFIG_PCI_BIOS=y -CONFIG_PCI_DIRECT=y -CONFIG_PCI_DISABLE_COMMON_QUIRKS=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_GOANY=y -# CONFIG_PCI_GOBIOS is not set -# CONFIG_PCI_GODIRECT is not set -# CONFIG_PCI_GOMMCONFIG is not set -# CONFIG_PCI_GOOLPC is not set -# CONFIG_PCI_QUIRKS is not set -# CONFIG_PCSPKR_PLATFORM is not set -CONFIG_PHYSICAL_ALIGN=0x100000 -CONFIG_PHYSICAL_START=0x100000 -# CONFIG_POWER_TRACER is not set -CONFIG_PROCESSOR_SELECT=y -# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set -CONFIG_RDC321X_WDT=m -# CONFIG_RELOCATABLE is not set -# CONFIG_RTC is not set -# CONFIG_RWSEM_GENERIC_SPINLOCK is not set -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -# CONFIG_SBC7240_WDT is not set -# CONFIG_SBC8360_WDT is not set -# CONFIG_SBC_EPX_C3_WATCHDOG is not set -# CONFIG_SC1200_WDT is not set -# CONFIG_SC520_WDT is not set -# CONFIG_SCHED_HRTICK is not set -CONFIG_SCHED_OMIT_FRAME_POINTER=y -# CONFIG_SCSI_DMA is not set -# CONFIG_SCx200 is not set -# CONFIG_SERIAL_8250_EXTENDED is not set -# CONFIG_SHMEM is not set -# CONFIG_SLOW_WORK is not set -# CONFIG_SMP is not set -# CONFIG_SMSC37B787_WDT is not set -# CONFIG_SMSC_SCH311X_WDT is not set -CONFIG_SPARSEMEM_STATIC=y -# CONFIG_STRICT_DEVMEM is not set -# CONFIG_SYSPROF_TRACER is not set -# CONFIG_TELCLOCK is not set -# CONFIG_TOSHIBA is not set -CONFIG_TRACING_SUPPORT=y -CONFIG_UID16=y -CONFIG_USB_SUPPORT=y -CONFIG_USER_STACKTRACE_SUPPORT=y -# CONFIG_VM86 is not set -# CONFIG_VMSPLIT_2G_OPT is not set -# CONFIG_VMSPLIT_3G_OPT is not set -# CONFIG_W83697UG_WDT is not set -# CONFIG_WAFER_WDT is not set -CONFIG_X86=y -CONFIG_X86_32=y -CONFIG_X86_32_LAZY_GS=y -# CONFIG_X86_64 is not set -CONFIG_X86_ALIGNMENT_16=y -CONFIG_X86_BSWAP=y -# CONFIG_X86_CHECK_BIOS_CORRUPTION is not set -CONFIG_X86_CMPXCHG=y -CONFIG_X86_CPU=y -# CONFIG_X86_CPUID is not set -# CONFIG_X86_CPU_DEBUG is not set -# CONFIG_X86_ELAN is not set -CONFIG_X86_EXTENDED_PLATFORM=y -CONFIG_X86_F00F_BUG=y -# CONFIG_X86_GENERIC is not set -CONFIG_X86_INTERNODE_CACHE_BYTES=64 -CONFIG_X86_INVLPG=y -CONFIG_X86_L1_CACHE_BYTES=64 -CONFIG_X86_L1_CACHE_SHIFT=4 -# CONFIG_X86_MCE is not set -CONFIG_X86_MINIMUM_CPU_FAMILY=4 -# CONFIG_X86_MSR is not set -# CONFIG_X86_PAE is not set -# CONFIG_X86_PLATFORM_DEVICES is not set -CONFIG_X86_POPAD_OK=y -# CONFIG_X86_PPRO_FENCE is not set -CONFIG_X86_RDC321X=y -CONFIG_X86_REBOOTFIXUPS=y -# CONFIG_X86_RESERVE_LOW_64K is not set -# CONFIG_X86_UP_APIC is not set -# CONFIG_X86_VERBOSE_BOOTUP is not set -CONFIG_X86_WP_WORKS_OK=y -CONFIG_X86_XADD=y -# CONFIG_ZONE_DMA32 is not set diff --git a/target/linux/rdc/r8610/config-2.6.30 b/target/linux/rdc/r8610/config-2.6.30 index 81ec1c57a..edda24234 100644 --- a/target/linux/rdc/r8610/config-2.6.30 +++ b/target/linux/rdc/r8610/config-2.6.30 @@ -1,300 +1,3 @@ -# CONFIG_4KSTACKS is not set -# CONFIG_60XX_WDT is not set -# CONFIG_64BIT is not set -# CONFIG_ACQUIRE_WDT is not set -# CONFIG_ADVANTECH_WDT is not set -# CONFIG_AGP is not set -# CONFIG_ALIM1535_WDT is not set -CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" -CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y -CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y -CONFIG_ARCH_HAS_CPU_RELAX=y -CONFIG_ARCH_HAS_DEFAULT_IDLE=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_MAY_HAVE_PC_FDC=y -# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set -CONFIG_ARCH_POPULATES_NODE_MAP=y -CONFIG_ARCH_SELECT_MEMORY_MODEL=y -CONFIG_ARCH_SPARSEMEM_ENABLE=y -CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y -# CONFIG_ARCH_SUPPORTS_MSI is not set -CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_WANT_FRAME_POINTERS=y -CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y -# CONFIG_ARPD is not set -# CONFIG_AUDIT_ARCH is not set -# CONFIG_BASE_FULL is not set -CONFIG_BASE_SMALL=1 -# CONFIG_BINARY_PRINTF is not set -CONFIG_BITREVERSE=y -# CONFIG_BLK_DEV_INITRD is not set -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=16 -CONFIG_BLK_DEV_RAM_SIZE=4096 -CONFIG_BOUNCE=y -CONFIG_CC_OPTIMIZE_FOR_SIZE=y -# CONFIG_CC_STACKPROTECTOR is not set -CONFIG_CLOCKSOURCE_WATCHDOG=y -CONFIG_CMDLINE="console=ttyS0,38400 rootfstype=squashfs,jffs2" -CONFIG_CMDLINE_BOOL=y -# CONFIG_CMDLINE_OVERRIDE is not set -# CONFIG_COMPAT_NET_DEV_OPS is not set -# CONFIG_COMPAT_VDSO is not set -# CONFIG_CPU5_WDT is not set -# CONFIG_CPU_FREQ is not set -# CONFIG_CPU_SUP_AMD is not set -# CONFIG_CPU_SUP_CENTAUR is not set -# CONFIG_CPU_SUP_CYRIX_32 is not set -# CONFIG_CPU_SUP_INTEL is not set -# CONFIG_CPU_SUP_TRANSMETA_32 is not set -# CONFIG_CPU_SUP_UMC_32 is not set -# CONFIG_CS5535_GPIO is not set -# CONFIG_DCDBAS is not set -# CONFIG_DEBUG_BUGVERBOSE is not set -# CONFIG_DEBUG_FS is not set -CONFIG_DECOMPRESS_LZMA=y -CONFIG_DEFAULT_IO_DELAY_TYPE=0 -# CONFIG_DELL_RBU is not set -CONFIG_DEVPORT=y -# CONFIG_DMA_API_DEBUG is not set -# CONFIG_DMI is not set -CONFIG_DOUBLEFAULT=y -# CONFIG_EARLY_PRINTK is not set -# CONFIG_EDAC is not set -# CONFIG_EDD is not set -# CONFIG_EUROTECH_WDT is not set -CONFIG_FAST_CMPXCHG_LOCAL=y -# CONFIG_FIRMWARE_MEMMAP is not set -CONFIG_FIX_EARLYCON_MEM=y -# CONFIG_FRAME_POINTER is not set -# CONFIG_FTRACE_SYSCALLS is not set -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_GENERIC_CMOS_UPDATE=y -# CONFIG_GENERIC_CPU is not set -CONFIG_GENERIC_FIND_FIRST_BIT=y -CONFIG_GENERIC_FIND_LAST_BIT=y -CONFIG_GENERIC_FIND_NEXT_BIT=y -CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y -CONFIG_GENERIC_IOMAP=y -CONFIG_GENERIC_ISA_DMA=y -# CONFIG_GENERIC_TIME_VSYSCALL is not set -# CONFIG_GEN_RTC is not set -# CONFIG_HAMRADIO is not set -# CONFIG_HANGCHECK_TIMER is not set -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT=y -CONFIG_HAVE_AOUT=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_ATOMIC_IOMAP=y -# CONFIG_HAVE_CPUMASK_OF_CPU_MAP is not set -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_DYNAMIC_PER_CPU_AREA=y -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FTRACE_SYSCALLS=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_HAVE_IDE=y -CONFIG_HAVE_IOREMAP_PROT=y -CONFIG_HAVE_KERNEL_BZIP2=y -CONFIG_HAVE_KERNEL_GZIP=y -CONFIG_HAVE_KERNEL_LZMA=y -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_KVM=y -CONFIG_HAVE_KVM_IRQCHIP=y -CONFIG_HAVE_LATENCYTOP_SUPPORT=y -CONFIG_HAVE_MLOCK=y -CONFIG_HAVE_MMIOTRACE_SUPPORT=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_SETUP_PER_CPU_AREA=y -CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y -# CONFIG_HIGHMEM4G is not set -# CONFIG_HIGHMEM64G is not set -# CONFIG_HIGH_RES_TIMERS is not set -# CONFIG_HPET_TIMER is not set -# CONFIG_HP_WATCHDOG is not set -# CONFIG_HUGETLBFS is not set -# CONFIG_HW_RANDOM is not set -CONFIG_HZ=250 -# CONFIG_HZ_100 is not set -CONFIG_HZ_250=y -# CONFIG_I2C is not set -# CONFIG_I6300ESB_WDT is not set -# CONFIG_I8K is not set -# CONFIG_IB700_WDT is not set -# CONFIG_IBMASR is not set -# CONFIG_IOMMU_API is not set -# CONFIG_IOMMU_HELPER is not set -CONFIG_IO_DELAY_0X80=y -# CONFIG_IO_DELAY_0XED is not set -# CONFIG_IO_DELAY_NONE is not set -CONFIG_IO_DELAY_TYPE_0X80=0 -CONFIG_IO_DELAY_TYPE_0XED=1 -CONFIG_IO_DELAY_TYPE_NONE=3 -CONFIG_IO_DELAY_TYPE_UDELAY=2 -# CONFIG_IO_DELAY_UDELAY is not set -# CONFIG_IP_MROUTE is not set -# CONFIG_ISA is not set -CONFIG_ISA_DMA_API=y -# CONFIG_ISCSI_IBFT_FIND is not set -# CONFIG_IT8712F_WDT is not set -# CONFIG_IT87_WDT is not set -# CONFIG_ITCO_WDT is not set -# CONFIG_JFFS2_SUMMARY is not set -# CONFIG_KERNEL_BZIP2 is not set -# CONFIG_KERNEL_GZIP is not set -CONFIG_KERNEL_LZMA=y -CONFIG_KTIME_SCALAR=y -CONFIG_LBD=y -# CONFIG_LEDS_ALIX2 is not set -# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set -# CONFIG_LEDS_TRIGGER_NETDEV is not set -# CONFIG_LEDS_TRIGGER_TIMER is not set -# CONFIG_M386 is not set -CONFIG_M486=y -# CONFIG_M586 is not set -# CONFIG_M586MMX is not set -# CONFIG_M586TSC is not set -# CONFIG_M686 is not set -# CONFIG_MACHZ_WDT is not set -# CONFIG_MACINTOSH_DRIVERS is not set -CONFIG_MATH_EMULATION=y -# CONFIG_MCA is not set -# CONFIG_MCORE2 is not set -# CONFIG_MCRUSOE is not set -# CONFIG_MCYRIXIII is not set -# CONFIG_MEFFICEON is not set -# CONFIG_MEMTEST is not set -# CONFIG_MGEODEGX1 is not set -# CONFIG_MGEODE_LX is not set -# CONFIG_MICROCODE is not set -# CONFIG_MK6 is not set -# CONFIG_MK7 is not set -# CONFIG_MK8 is not set -# CONFIG_MMIOTRACE is not set -CONFIG_MODULE_FORCE_UNLOAD=y -# CONFIG_MPENTIUM4 is not set -# CONFIG_MPENTIUMII is not set -# CONFIG_MPENTIUMIII is not set -# CONFIG_MPENTIUMM is not set -# CONFIG_MPSC is not set -# CONFIG_MTD_CFI_INTELEXT is not set -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -# CONFIG_MTD_NETSC520 is not set CONFIG_MTD_PHYSMAP=y # CONFIG_MTD_R8610 is not set # CONFIG_MTD_RDC3210 is not set -# CONFIG_MTD_TS5500 is not set -# CONFIG_MTRR is not set -# CONFIG_MVIAC3_2 is not set -# CONFIG_MVIAC7 is not set -# CONFIG_MWINCHIP3D is not set -# CONFIG_MWINCHIPC6 is not set -# CONFIG_NATSEMI is not set -# CONFIG_NETDEV_1000 is not set -CONFIG_NOHIGHMEM=y -CONFIG_NR_CPUS=1 -# CONFIG_NSC_GPIO is not set -# CONFIG_NVRAM is not set -# CONFIG_OLPC is not set -# CONFIG_OPTIMIZE_INLINING is not set -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PAGE_OFFSET=0xC0000000 -# CONFIG_PARAVIRT_GUEST is not set -# CONFIG_PC8736x_GPIO is not set -# CONFIG_PC87413_WDT is not set -CONFIG_PCI=y -# CONFIG_PCIEPORTBUS is not set -CONFIG_PCI_BIOS=y -CONFIG_PCI_DIRECT=y -CONFIG_PCI_DISABLE_COMMON_QUIRKS=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_GOANY=y -# CONFIG_PCI_GOBIOS is not set -# CONFIG_PCI_GODIRECT is not set -# CONFIG_PCI_GOMMCONFIG is not set -# CONFIG_PCI_GOOLPC is not set -# CONFIG_PCI_QUIRKS is not set -# CONFIG_PCSPKR_PLATFORM is not set -CONFIG_PHYSICAL_ALIGN=0x100000 -CONFIG_PHYSICAL_START=0x100000 -# CONFIG_POWER_TRACER is not set -CONFIG_PROCESSOR_SELECT=y -# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set -CONFIG_RDC321X_WDT=m -# CONFIG_RELOCATABLE is not set -# CONFIG_RTC is not set -# CONFIG_RWSEM_GENERIC_SPINLOCK is not set -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -# CONFIG_SBC7240_WDT is not set -# CONFIG_SBC8360_WDT is not set -# CONFIG_SBC_EPX_C3_WATCHDOG is not set -# CONFIG_SC1200_WDT is not set -# CONFIG_SC520_WDT is not set -# CONFIG_SCHED_HRTICK is not set -CONFIG_SCHED_OMIT_FRAME_POINTER=y -# CONFIG_SCSI_DMA is not set -# CONFIG_SCx200 is not set -# CONFIG_SERIAL_8250_EXTENDED is not set -# CONFIG_SHMEM is not set -# CONFIG_SLOW_WORK is not set -# CONFIG_SMP is not set -# CONFIG_SMSC37B787_WDT is not set -# CONFIG_SMSC_SCH311X_WDT is not set -CONFIG_SPARSEMEM_STATIC=y -# CONFIG_STRICT_DEVMEM is not set -# CONFIG_SYSPROF_TRACER is not set -# CONFIG_TELCLOCK is not set -# CONFIG_TOSHIBA is not set -CONFIG_TRACING_SUPPORT=y -CONFIG_UID16=y -CONFIG_USB_SUPPORT=y -CONFIG_USER_STACKTRACE_SUPPORT=y -# CONFIG_VM86 is not set -# CONFIG_VMSPLIT_2G_OPT is not set -# CONFIG_VMSPLIT_3G_OPT is not set -# CONFIG_W83697UG_WDT is not set -# CONFIG_WAFER_WDT is not set -CONFIG_X86=y -CONFIG_X86_32=y -CONFIG_X86_32_LAZY_GS=y -# CONFIG_X86_64 is not set -CONFIG_X86_ALIGNMENT_16=y -CONFIG_X86_BSWAP=y -# CONFIG_X86_CHECK_BIOS_CORRUPTION is not set -CONFIG_X86_CMPXCHG=y -CONFIG_X86_CPU=y -# CONFIG_X86_CPUID is not set -# CONFIG_X86_CPU_DEBUG is not set -# CONFIG_X86_ELAN is not set -CONFIG_X86_EXTENDED_PLATFORM=y -CONFIG_X86_F00F_BUG=y -# CONFIG_X86_GENERIC is not set -CONFIG_X86_INTERNODE_CACHE_BYTES=64 -CONFIG_X86_INVLPG=y -CONFIG_X86_L1_CACHE_BYTES=64 -CONFIG_X86_L1_CACHE_SHIFT=4 -# CONFIG_X86_MCE is not set -CONFIG_X86_MINIMUM_CPU_FAMILY=4 -# CONFIG_X86_MSR is not set -# CONFIG_X86_PAE is not set -# CONFIG_X86_PLATFORM_DEVICES is not set -CONFIG_X86_POPAD_OK=y -# CONFIG_X86_PPRO_FENCE is not set -CONFIG_X86_RDC321X=y -CONFIG_X86_REBOOTFIXUPS=y -# CONFIG_X86_RESERVE_LOW_64K is not set -# CONFIG_X86_UP_APIC is not set -# CONFIG_X86_VERBOSE_BOOTUP is not set -CONFIG_X86_WP_WORKS_OK=y -CONFIG_X86_XADD=y -# CONFIG_ZONE_DMA32 is not set From cd60446ca1b23bf3fae38ba428de2d512e9d9e24 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 11 Nov 2009 00:34:42 +0000 Subject: [PATCH 128/288] hostapd: update to latest git, remove openssl dependency for hostapd-full, it works with internal crypto now git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18360 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/hostapd/Makefile | 15 +++++++-------- package/hostapd/files/full.config | 14 ++++++++++++++ package/hostapd/files/mini.config | 13 ++++++++++++- package/hostapd/patches/100-madwifi_fix.patch | 8 ++++---- ...countrycode.patch => 110-countrycode.patch} | 4 ++-- .../hostapd/patches/120-nl80211_ap_fix.patch | 16 ++++++++++++++++ package/hostapd/patches/130-libnl_update.patch | 18 ------------------ 7 files changed, 55 insertions(+), 33 deletions(-) rename package/hostapd/patches/{120-countrycode.patch => 110-countrycode.patch} (72%) create mode 100644 package/hostapd/patches/120-nl80211_ap_fix.patch delete mode 100644 package/hostapd/patches/130-libnl_update.patch diff --git a/package/hostapd/Makefile b/package/hostapd/Makefile index d8a3ac8ac..606ec6736 100644 --- a/package/hostapd/Makefile +++ b/package/hostapd/Makefile @@ -8,14 +8,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_VERSION:=0.6.9 +PKG_VERSION:=20091111 PKG_RELEASE:=1 +PKG_REV:=dc6d9ac250f793a62b21ca828445967fb484305f -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=http://hostap.epitest.fi/releases/ +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git PKG_SOURCE_SUBDIR:=hostapd-$(PKG_VERSION) PKG_SOURCE_VERSION:=$(PKG_REV) -PKG_MD5SUM:=83630d11fa66ade9091f1b304fccd74c +PKG_SOURCE_PROTO:=git PKG_BUILD_DEPENDS:= \ PACKAGE_kmod-madwifi:madwifi \ @@ -50,7 +51,6 @@ endef define Package/hostapd $(call Package/hostapd/Default) TITLE+= (full) - DEPENDS+= +PACKAGE_hostapd:libopenssl VARIANT:=full endef @@ -81,6 +81,8 @@ define Package/hostapd-utils/description endef define Build/Configure + rm -f $(PKG_BUILD_DIR)/hostapd/hostapd + rm -f $(PKG_BUILD_DIR)/src/drivers/drivers.o $(CP) ./files/$(BUILD_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config endef @@ -96,9 +98,6 @@ TARGET_CPPFLAGS := \ ifdef CONFIG_PACKAGE_kmod-mac80211 TARGET_LDFLAGS += -lm -lnl-tiny endif -ifeq ($(BUILD_VARIANT),full) - TARGET_LDFLAGS += -lssl -lcrypto -endif define Build/Compile CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \ diff --git a/package/hostapd/files/full.config b/package/hostapd/files/full.config index 8643a2b0a..07c924fe9 100644 --- a/package/hostapd/files/full.config +++ b/package/hostapd/files/full.config @@ -142,3 +142,17 @@ CONFIG_IEEE80211N=y # This can be used to reduce the size of the hostapd considerably if debugging # code is not needed. #CONFIG_NO_STDOUT_DEBUG=y + +# Remove support for RADIUS accounting +#CONFIG_NO_ACCOUNTING=y + +# Remove support for RADIUS +#CONFIG_NO_RADIUS=y + +# Remove support for VLANs +#CONFIG_NO_VLAN=y + +CONFIG_TLS=internal +CONFIG_INTERNAL_LIBTOMMATH=y +CONFIG_INTERNAL_AES=y +NEED_AES_DEC=y diff --git a/package/hostapd/files/mini.config b/package/hostapd/files/mini.config index 37f76d185..1720dddbf 100644 --- a/package/hostapd/files/mini.config +++ b/package/hostapd/files/mini.config @@ -40,7 +40,7 @@ CONFIG_DRIVER_NL80211=y #CONFIG_DRIVER_NONE=y # IEEE 802.11F/IAPP -CONFIG_IAPP=y +# CONFIG_IAPP=y # WPA2/IEEE 802.11i RSN pre-authentication CONFIG_RSN_PREAUTH=y @@ -142,3 +142,14 @@ CONFIG_IEEE80211N=y # This can be used to reduce the size of the hostapd considerably if debugging # code is not needed. #CONFIG_NO_STDOUT_DEBUG=y + +# Remove support for RADIUS accounting +CONFIG_NO_ACCOUNTING=y + +# Remove support for RADIUS +CONFIG_NO_RADIUS=y + +# Remove support for VLANs +#CONFIG_NO_VLAN=y + +CONFIG_TLS=internal diff --git a/package/hostapd/patches/100-madwifi_fix.patch b/package/hostapd/patches/100-madwifi_fix.patch index 8f8be442b..915b86a64 100644 --- a/package/hostapd/patches/100-madwifi_fix.patch +++ b/package/hostapd/patches/100-madwifi_fix.patch @@ -1,6 +1,6 @@ ---- a/hostapd/driver_madwifi.c -+++ b/hostapd/driver_madwifi.c -@@ -312,6 +312,7 @@ madwifi_set_iface_flags(void *priv, int +--- a/src/drivers/driver_madwifi.c ++++ b/src/drivers/driver_madwifi.c +@@ -318,6 +318,7 @@ madwifi_set_iface_flags(void *priv, int { struct madwifi_driver_data *drv = priv; struct ifreq ifr; @@ -8,7 +8,7 @@ wpa_printf(MSG_DEBUG, "%s: dev_up=%d", __func__, dev_up); -@@ -326,10 +327,14 @@ madwifi_set_iface_flags(void *priv, int +@@ -332,10 +333,14 @@ madwifi_set_iface_flags(void *priv, int return -1; } diff --git a/package/hostapd/patches/120-countrycode.patch b/package/hostapd/patches/110-countrycode.patch similarity index 72% rename from package/hostapd/patches/120-countrycode.patch rename to package/hostapd/patches/110-countrycode.patch index 8ffc65ca2..7c9d0219d 100644 --- a/package/hostapd/patches/120-countrycode.patch +++ b/package/hostapd/patches/110-countrycode.patch @@ -1,6 +1,6 @@ --- a/hostapd/hostapd.c +++ b/hostapd/hostapd.c -@@ -1546,10 +1546,8 @@ static int setup_interface(struct hostap +@@ -1344,10 +1344,8 @@ static int setup_interface(struct hostap if (hapd->iconf->country[0] && hapd->iconf->country[1]) { os_memcpy(country, hapd->iconf->country, 3); country[3] = '\0'; @@ -11,4 +11,4 @@ - } } - if (hapd->iconf->ieee80211d && + if (hapd->iconf->bridge_packets != INTERNAL_BRIDGE_DO_NOT_CONTROL && diff --git a/package/hostapd/patches/120-nl80211_ap_fix.patch b/package/hostapd/patches/120-nl80211_ap_fix.patch new file mode 100644 index 000000000..78475e87d --- /dev/null +++ b/package/hostapd/patches/120-nl80211_ap_fix.patch @@ -0,0 +1,16 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -4418,10 +4418,10 @@ static void *i802_init(struct hostapd_da + /* start listening for EAPOL on the default AP interface */ + add_ifidx(drv, drv->ifindex); + +- if (params->bssid) { +- if (hostapd_set_iface_flags(drv, drv->ifname, 0)) +- goto failed; ++ if (hostapd_set_iface_flags(drv, drv->ifname, 0)) ++ goto failed; + ++ if (params->bssid) { + if (set_ifhwaddr(drv, drv->ifname, params->bssid)) + goto failed; + } diff --git a/package/hostapd/patches/130-libnl_update.patch b/package/hostapd/patches/130-libnl_update.patch deleted file mode 100644 index 51bc58a08..000000000 --- a/package/hostapd/patches/130-libnl_update.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/hostapd/driver_nl80211.c -+++ b/hostapd/driver_nl80211.c -@@ -29,6 +29,7 @@ - #include "wireless_copy.h" - #include - #include -+#include - - #include "hostapd.h" - #include "driver.h" -@@ -45,6 +46,7 @@ - /* libnl 2.0 compatibility code */ - #define nl_handle_alloc_cb nl_socket_alloc_cb - #define nl_handle_destroy nl_socket_free -+#define nl_handle nl_sock - #endif /* CONFIG_LIBNL20 */ - - enum ieee80211_msg_type { From 7131b95c8c43e07dea4c5491458bb8ab40633357 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 11 Nov 2009 01:25:02 +0000 Subject: [PATCH 129/288] automatically adjust CONFIG_BLK_DEV_INITRD in the kernel config (thx, sn9) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18361 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- include/kernel-defaults.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk index cf3eb3105..35627f7bc 100644 --- a/include/kernel-defaults.mk +++ b/include/kernel-defaults.mk @@ -67,7 +67,8 @@ ifeq ($(KERNEL),2.6) ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) define Kernel/SetInitramfs mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old - grep -v -e INITRAMFS -e CONFIG_RD_ $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config + grep -v -e INITRAMFS -e CONFIG_RD_ -e CONFIG_BLK_DEV_INITRD $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config + echo 'CONFIG_BLK_DEV_INITRD=y' >> $(LINUX_DIR)/.config echo 'CONFIG_INITRAMFS_SOURCE="$(strip $(TARGET_DIR) $(INITRAMFS_EXTRA_FILES))"' >> $(LINUX_DIR)/.config echo 'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $(LINUX_DIR)/.config echo 'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $(LINUX_DIR)/.config From ad1ed217dc580c9c3a61248aae80dd05bbb79334 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 11 Nov 2009 01:25:06 +0000 Subject: [PATCH 130/288] merge target kernel config files with subtarget config files and add a variable override for editing the target kernel config file with make kernel_menuconfig in case the subtarget contains overrides (thx, sn9) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18362 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- include/kernel-build.mk | 3 ++- include/kernel-defaults.mk | 2 +- include/target.mk | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/kernel-build.mk b/include/kernel-build.mk index e3e446ba5..7c5d1fbe9 100644 --- a/include/kernel-build.mk +++ b/include/kernel-build.mk @@ -104,7 +104,8 @@ define BuildKernel $(LINUX_CONFCMD) > $(LINUX_DIR)/.config touch $(LINUX_CONFIG) $(_SINGLE)$(MAKE) -C $(LINUX_DIR) $(KERNEL_MAKEOPTS) $$@ - $(SCRIPT_DIR)/kconfig.pl '>' $(GENERIC_LINUX_CONFIG) $(LINUX_DIR)/.config > $(if $(LINUX_SUBCONFIG),$(LINUX_SUBCONFIG),$(LINUX_CONFIG)) + $(SCRIPT_DIR)/kconfig.pl '>' $(if $(LINUX_SUBCONFIG),'+' $(GENERIC_LINUX_CONFIG) $(LINUX_CONFIG),$(GENERIC_LINUX_CONFIG)) \ + $(LINUX_DIR)/.config > $(if $(LINUX_SUBCONFIG),$(LINUX_SUBCONFIG),$(LINUX_CONFIG)) $(Kernel/Configure) install: $(LINUX_DIR)/.image diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk index 35627f7bc..f49cbb93a 100644 --- a/include/kernel-defaults.mk +++ b/include/kernel-defaults.mk @@ -105,7 +105,7 @@ define Kernel/Configure/Default $(SED) 's,.*CONFIG_AEABI.*,$(if $(CONFIG_EABI_SUPPORT),CONFIG_AEABI=y,# CONFIG_AEABI is not set),' $(LINUX_DIR)/.config.target $(if $(CONFIG_EABI_SUPPORT),echo '# CONFIG_OABI_COMPAT is not set' >> $(LINUX_DIR)/.config.target) $(SCRIPT_DIR)/metadata.pl kconfig $(TMP_DIR)/.packageinfo $(TOPDIR)/.config > $(LINUX_DIR)/.config.override - $(SCRIPT_DIR)/kconfig.pl 'm+' $(LINUX_DIR)/.config.target $(LINUX_DIR)/.config.override > $(LINUX_DIR)/.config + $(SCRIPT_DIR)/kconfig.pl 'm+' '+' $(LINUX_DIR)/.config.target /dev/null $(LINUX_DIR)/.config.override > $(LINUX_DIR)/.config $(call Kernel/SetInitramfs) $(call Kernel/Configure/$(KERNEL)) rm -rf $(KERNEL_BUILD_DIR)/modules diff --git a/include/target.mk b/include/target.mk index b30be1032..2bfb70278 100644 --- a/include/target.mk +++ b/include/target.mk @@ -115,7 +115,7 @@ GENERIC_FILES_DIR := $(foreach dir,$(wildcard $(GENERIC_PLATFORM_DIR)/files $(GE GENERIC_LINUX_CONFIG?=$(firstword $(wildcard $(GENERIC_PLATFORM_DIR)/config-$(KERNEL_PATCHVER) $(GENERIC_PLATFORM_DIR)/config-default)) LINUX_CONFIG?=$(firstword $(wildcard $(foreach subdir,$(PLATFORM_DIR) $(PLATFORM_SUBDIR),$(subdir)/config-$(KERNEL_PATCHVER) $(subdir)/config-default)) $(PLATFORM_DIR)/config-$(KERNEL_PATCHVER)) -LINUX_SUBCONFIG?=$(firstword $(wildcard $(PLATFORM_SUBDIR)/config-$(KERNEL_PATCHVER) $(PLATFORM_SUBDIR)/config-default)) +LINUX_SUBCONFIG?=$(if $(SHARED_LINUX_CONFIG),,$(firstword $(wildcard $(PLATFORM_SUBDIR)/config-$(KERNEL_PATCHVER) $(PLATFORM_SUBDIR)/config-default))) ifeq ($(LINUX_CONFIG),$(LINUX_SUBCONFIG)) LINUX_SUBCONFIG:= endif From 513bbd2cdc9b0ac1c824048066d81ec97a68b640 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 11 Nov 2009 05:15:41 +0000 Subject: [PATCH 131/288] mac80211: fix a bug in broadcast handling of wds sta interfaces git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18363 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/patches/510-mac80211_4addr_vlan.patch | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/package/mac80211/patches/510-mac80211_4addr_vlan.patch b/package/mac80211/patches/510-mac80211_4addr_vlan.patch index ac92fe54b..d3d1e8293 100644 --- a/package/mac80211/patches/510-mac80211_4addr_vlan.patch +++ b/package/mac80211/patches/510-mac80211_4addr_vlan.patch @@ -213,6 +213,15 @@ return ieee80211_data_to_8023(rx->skb, dev->dev_addr, sdata->vif.type); } +@@ -1285,7 +1292,7 @@ ieee80211_deliver_skb(struct ieee80211_r + if ((sdata->vif.type == NL80211_IFTYPE_AP || + sdata->vif.type == NL80211_IFTYPE_AP_VLAN) && + !(sdata->flags & IEEE80211_SDATA_DONT_BRIDGE_PACKETS) && +- (rx->flags & IEEE80211_RX_RA_MATCH)) { ++ (rx->flags & IEEE80211_RX_RA_MATCH) && !rx->sdata->use_4addr) { + if (is_multicast_ether_addr(ehdr->h_dest)) { + /* + * send multicast frames both to higher layers in @@ -1590,6 +1597,7 @@ ieee80211_rx_h_data(struct ieee80211_rx_ { struct net_device *dev = rx->dev; From 4fa998189d49b137ca25b8d1aca136bed021e6bd Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 11 Nov 2009 05:15:51 +0000 Subject: [PATCH 132/288] hostapd: implement wds ap support git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18364 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/hostapd/files/hostapd.sh | 5 +- package/hostapd/patches/130-wds_ap.patch | 247 +++++++++++++++++++++++ 2 files changed, 251 insertions(+), 1 deletion(-) create mode 100644 package/hostapd/patches/130-wds_ap.patch diff --git a/package/hostapd/files/hostapd.sh b/package/hostapd/files/hostapd.sh index 2210a46af..4a13c19ab 100644 --- a/package/hostapd/files/hostapd.sh +++ b/package/hostapd/files/hostapd.sh @@ -77,7 +77,9 @@ hostapd_setup_vif() { config_get channel "$device" channel config_get hwmode "$device" hwmode config_get wpa_group_rekey "$vif" wpa_group_rekey - config_get ieee80211d "$vif" ieee80211d + config_get ieee80211d "$vif" ieee80211d + config_get_bool wds "$vif" wds 0 + [ "$wds" -gt 0 -a "$driver" = "nl80211" ] && wds="wds_sta=1" || wds="" case "$hwmode" in bg) hwmode=g;; esac @@ -109,6 +111,7 @@ ${hwmode_11n:+ieee80211n=1} ${ht_capab:+ht_capab=$ht_capab} ${wpa_group_rekey:+wpa_group_rekey=$wpa_group_rekey} ${ieee80211d:+ieee80211d=$ieee80211d} +$wds $hostapd_cfg EOF case "$driver" in diff --git a/package/hostapd/patches/130-wds_ap.patch b/package/hostapd/patches/130-wds_ap.patch new file mode 100644 index 000000000..019257599 --- /dev/null +++ b/package/hostapd/patches/130-wds_ap.patch @@ -0,0 +1,247 @@ +--- a/hostapd/config.c ++++ b/hostapd/config.c +@@ -1526,6 +1526,8 @@ struct hostapd_config * hostapd_config_r + line, pos); + errors++; + } ++ } else if (os_strcmp(buf, "wds_sta") == 0) { ++ bss->wds_sta = atoi(pos); + } else if (os_strcmp(buf, "ap_max_inactivity") == 0) { + bss->ap_max_inactivity = atoi(pos); + } else if (os_strcmp(buf, "country_code") == 0) { +--- a/hostapd/config.h ++++ b/hostapd/config.h +@@ -198,6 +198,7 @@ struct hostapd_bss_config { + int num_accept_mac; + struct mac_acl_entry *deny_mac; + int num_deny_mac; ++ int wds_sta; + + int auth_algs; /* bitfield of allowed IEEE 802.11 authentication + * algorithms, WPA_AUTH_ALG_{OPEN,SHARED,LEAP} */ +--- a/src/drivers/driver.h ++++ b/src/drivers/driver.h +@@ -1305,6 +1305,7 @@ struct wpa_driver_ops { + const char *ifname, const u8 *addr); + int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname, + int vlan_id); ++ int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val); + /** + * commit - Optional commit changes handler + * @priv: driver private data +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -2755,7 +2755,7 @@ static void nl80211_remove_iface(struct + static int nl80211_create_iface_once(struct wpa_driver_nl80211_data *drv, + const char *ifname, + enum nl80211_iftype iftype, +- const u8 *addr) ++ const u8 *addr, int wds) + { + struct nl_msg *msg, *flags = NULL; + int ifidx; +@@ -2786,6 +2786,8 @@ static int nl80211_create_iface_once(str + + if (err) + goto nla_put_failure; ++ } else if (wds) { ++ NLA_PUT_U8(msg, NL80211_ATTR_4ADDR, wds); + } + + ret = send_and_recv_msgs(drv, msg, NULL, NULL); +@@ -2816,11 +2818,11 @@ static int nl80211_create_iface_once(str + } + static int nl80211_create_iface(struct wpa_driver_nl80211_data *drv, + const char *ifname, enum nl80211_iftype iftype, +- const u8 *addr) ++ const u8 *addr, int wds) + { + int ret; + +- ret = nl80211_create_iface_once(drv, ifname, iftype, addr); ++ ret = nl80211_create_iface_once(drv, ifname, iftype, addr, wds); + + /* if error occured and interface exists already */ + if (ret == -ENFILE && if_nametoindex(ifname)) { +@@ -2830,7 +2832,7 @@ static int nl80211_create_iface(struct w + nl80211_remove_iface(drv, if_nametoindex(ifname)); + + /* Try to create the interface again */ +- ret = nl80211_create_iface_once(drv, ifname, iftype, addr); ++ ret = nl80211_create_iface_once(drv, ifname, iftype, addr, wds); + } + + return ret; +@@ -3055,7 +3057,7 @@ static struct sock_filter msock_filter_i + + #if 0 + /* +- * drop non-data frames, WDS frames ++ * drop non-data frames + */ + /* load the lower byte of the frame control field */ + BPF_STMT(BPF_LD | BPF_B | BPF_IND, 0), +@@ -3063,13 +3065,13 @@ static struct sock_filter msock_filter_i + BPF_STMT(BPF_ALU | BPF_AND | BPF_K, 0x0c), + /* drop non-data frames */ + BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 8, 0, FAIL), ++#endif + /* load the upper byte of the frame control field */ +- BPF_STMT(BPF_LD | BPF_B | BPF_IND, 0), ++ BPF_STMT(BPF_LD | BPF_B | BPF_IND, 1), + /* mask off toDS/fromDS */ + BPF_STMT(BPF_ALU | BPF_AND | BPF_K, 0x03), +- /* drop WDS frames */ +- BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 3, FAIL, 0), +-#endif ++ /* accept WDS frames */ ++ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 3, PASS, 0), + + /* + * add header length to index +@@ -3175,7 +3177,7 @@ nl80211_create_monitor_interface(struct + buf[IFNAMSIZ - 1] = '\0'; + + drv->monitor_ifidx = +- nl80211_create_iface(drv, buf, NL80211_IFTYPE_MONITOR, NULL); ++ nl80211_create_iface(drv, buf, NL80211_IFTYPE_MONITOR, NULL, 0); + + if (drv->monitor_ifidx < 0) + return -1; +@@ -4155,7 +4157,7 @@ static int i802_bss_add(void *priv, cons + if (bss == NULL) + return -1; + +- ifidx = nl80211_create_iface(priv, ifname, NL80211_IFTYPE_AP, bssid); ++ ifidx = nl80211_create_iface(priv, ifname, NL80211_IFTYPE_AP, bssid, 0); + if (ifidx < 0) { + os_free(bss); + return -1; +@@ -4264,7 +4266,7 @@ static int i802_if_add(const char *iface + enum hostapd_driver_if_type type, char *ifname, + const u8 *addr) + { +- if (nl80211_create_iface(priv, ifname, i802_if_type(type), addr) < 0) ++ if (nl80211_create_iface(priv, ifname, i802_if_type(type), addr, 0) < 0) + return -1; + return 0; + } +@@ -4310,6 +4312,21 @@ static int i802_set_sta_vlan(void *priv, + return -ENOBUFS; + } + ++static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val) ++{ ++ struct wpa_driver_nl80211_data *drv = priv; ++ char name[16]; ++ ++ sprintf(name, "%s.sta%d", drv->ifname, aid); ++ if (val) { ++ if (nl80211_create_iface(priv, name, NL80211_IFTYPE_AP_VLAN, NULL, 1) < 0) ++ return -1; ++ return i802_set_sta_vlan(priv, addr, name, 0); ++ } else { ++ i802_set_sta_vlan(priv, addr, drv->ifname, 0); ++ return i802_if_remove(priv, HOSTAPD_IF_VLAN, name, NULL); ++ } ++} + + static void handle_eapol(int sock, void *eloop_ctx, void *sock_ctx) + { +@@ -4536,5 +4553,6 @@ const struct wpa_driver_ops wpa_driver_n + .if_update = i802_if_update, + .if_remove = i802_if_remove, + .set_sta_vlan = i802_set_sta_vlan, ++ .set_wds_sta = i802_set_wds_sta, + #endif /* HOSTAPD */ + }; +--- a/hostapd/driver_i.h ++++ b/hostapd/driver_i.h +@@ -453,6 +453,14 @@ hostapd_set_sta_vlan(const char *ifname, + } + + static inline int ++hostapd_set_wds_sta(struct hostapd_data *hapd, const u8 *addr, int aid, int val) ++{ ++ if (hapd->driver == NULL || hapd->driver->set_wds_sta == NULL) ++ return 0; ++ return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val); ++} ++ ++static inline int + hostapd_driver_commit(struct hostapd_data *hapd) + { + if (hapd->driver == NULL || hapd->driver->commit == NULL) +--- a/hostapd/drv_callbacks.c ++++ b/hostapd/drv_callbacks.c +@@ -167,6 +167,7 @@ static const u8 * get_hdr_bssid(const st + if (len < 24) + return NULL; + switch (fc & (WLAN_FC_FROMDS | WLAN_FC_TODS)) { ++ case WLAN_FC_FROMDS|WLAN_FC_TODS: + case WLAN_FC_TODS: + return hdr->addr1; + case WLAN_FC_FROMDS: +@@ -213,6 +214,7 @@ void hostapd_rx_from_unknown_sta(struct + { + struct sta_info *sta; + const u8 *addr; ++ u16 fc = le_to_host16(hdr->frame_control); + + hapd = get_hapd_bssid(hapd->iface, get_hdr_bssid(hdr, len)); + if (hapd == NULL || hapd == HAPD_BROADCAST) +@@ -231,6 +233,14 @@ void hostapd_rx_from_unknown_sta(struct + hostapd_sta_deauth( + hapd, addr, + WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); ++ } else { ++ if (!sta->wds_sta) { ++ if ((fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) == ++ (WLAN_FC_TODS | WLAN_FC_FROMDS)) { ++ sta->wds_sta = 1; ++ hostapd_set_wds_sta(hapd, addr, sta->aid, 1); ++ } ++ } + } + } + +--- a/hostapd/sta_info.c ++++ b/hostapd/sta_info.c +@@ -120,6 +120,7 @@ void ap_free_sta(struct hostapd_data *ha + + accounting_sta_stop(hapd, sta); + ++ hostapd_set_wds_sta(hapd, sta->addr, sta->aid, 0); + if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC) && + !(sta->flags & WLAN_STA_PREAUTH)) + hostapd_sta_remove(hapd, sta->addr); +--- a/hostapd/sta_info.h ++++ b/hostapd/sta_info.h +@@ -78,6 +78,7 @@ struct sta_info { + struct hostapd_ssid *ssid_probe; /* SSID selection based on ProbeReq */ + + int vlan_id; ++ int wds_sta; + + #ifdef CONFIG_IEEE80211N + struct ht_cap_ie ht_capabilities; /* IEEE 802.11n capabilities */ +--- a/src/common/nl80211_copy.h ++++ b/src/common/nl80211_copy.h +@@ -584,6 +584,8 @@ enum nl80211_commands { + * changed then the list changed and the dump should be repeated + * completely from scratch. + * ++ * @NL80211_ATTR_4ADDR: Use 4-address frames on a virtual interface ++ * + * @NL80211_ATTR_MAX: highest attribute number currently defined + * @__NL80211_ATTR_AFTER_LAST: internal use + */ +@@ -714,6 +716,8 @@ enum nl80211_attrs { + + NL80211_ATTR_PID, + ++ NL80211_ATTR_4ADDR, ++ + /* add attributes here, update the policy in nl80211.c */ + + __NL80211_ATTR_AFTER_LAST, From 872cbfb521e1b97826cc65eb669b16a8c3a871af Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 11 Nov 2009 05:15:55 +0000 Subject: [PATCH 133/288] hostapd: automatically add wds sta interfaces of an ap to the right bridge git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18365 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/hostapd/Makefile | 2 ++ package/hostapd/files/hostapd.hotplug | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 package/hostapd/files/hostapd.hotplug diff --git a/package/hostapd/Makefile b/package/hostapd/Makefile index 606ec6736..a39b0e243 100644 --- a/package/hostapd/Makefile +++ b/package/hostapd/Makefile @@ -109,6 +109,8 @@ define Build/Compile endef define Package/InstallTemplate + $(INSTALL_DIR) $(1)/etc/hotplug.d/net + $(INSTALL_DATA) ./files/hostapd.hotplug $(1)/etc/hotplug.d/net/ $(INSTALL_DIR) $(1)/lib/wifi $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh $(INSTALL_DIR) $(1)/usr/sbin diff --git a/package/hostapd/files/hostapd.hotplug b/package/hostapd/files/hostapd.hotplug new file mode 100644 index 000000000..296422428 --- /dev/null +++ b/package/hostapd/files/hostapd.hotplug @@ -0,0 +1,12 @@ +if [ "$ACTION" = "add" -o "$ACTION" = "register" ]; then + case "$INTERFACE" in + wlan*.sta*) + local BASEIF="${INTERFACE%%\.*}" + + include /lib/network + scan_interfaces + local CONFIG="$(find_config "$BASEIF")" + [ -n "$CONFIG" ] && setup_interface "$INTERFACE" "$CONFIG" + ;; + esac +fi From 470ce7bd907ffa423208ebadc4c44f70fc26dc49 Mon Sep 17 00:00:00 2001 From: kaloz Date: Wed, 11 Nov 2009 09:07:22 +0000 Subject: [PATCH 134/288] move CONFIG_CRASH_DUMP to the generic configs git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18366 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic-2.6/config-2.6.31 | 1 + target/linux/generic-2.6/config-2.6.32 | 1 + target/linux/mpc52xx/config-2.6.30 | 1 - target/linux/mpc83xx/config-default | 1 - target/linux/ps3/config-2.6.30 | 1 - target/linux/pxcab/config-2.6.30 | 1 - target/linux/pxcab/config-2.6.31 | 1 - 7 files changed, 2 insertions(+), 5 deletions(-) diff --git a/target/linux/generic-2.6/config-2.6.31 b/target/linux/generic-2.6/config-2.6.31 index c2bac32f9..3f71c3dfd 100644 --- a/target/linux/generic-2.6/config-2.6.31 +++ b/target/linux/generic-2.6/config-2.6.31 @@ -337,6 +337,7 @@ CONFIG_CONSTRUCTORS=y # CONFIG_CPU_DCACHE_DISABLE is not set # CONFIG_CPU_IDLE is not set # CONFIG_CRAMFS is not set +# CONFIG_CRASH_DUMP is not set # CONFIG_CRC16 is not set CONFIG_CRC32=y # CONFIG_CRC7 is not set diff --git a/target/linux/generic-2.6/config-2.6.32 b/target/linux/generic-2.6/config-2.6.32 index 4d1aee1fe..b77bf0789 100644 --- a/target/linux/generic-2.6/config-2.6.32 +++ b/target/linux/generic-2.6/config-2.6.32 @@ -339,6 +339,7 @@ CONFIG_CONSTRUCTORS=y # CONFIG_CPU_DCACHE_DISABLE is not set # CONFIG_CPU_IDLE is not set # CONFIG_CRAMFS is not set +# CONFIG_CRASH_DUMP is not set # CONFIG_CRC16 is not set CONFIG_CRC32=y # CONFIG_CRC7 is not set diff --git a/target/linux/mpc52xx/config-2.6.30 b/target/linux/mpc52xx/config-2.6.30 index e038cff01..b048d6d17 100644 --- a/target/linux/mpc52xx/config-2.6.30 +++ b/target/linux/mpc52xx/config-2.6.30 @@ -32,7 +32,6 @@ CONFIG_CMDLINE="console=ttyPSC0,115200" CONFIG_CMDLINE_BOOL=y CONFIG_COMPAT_BRK=y # CONFIG_CPU_FREQ is not set -# CONFIG_CRASH_DUMP is not set CONFIG_CRYPTO_AEAD2=y CONFIG_CRYPTO_BLKCIPHER=y CONFIG_CRYPTO_BLKCIPHER2=y diff --git a/target/linux/mpc83xx/config-default b/target/linux/mpc83xx/config-default index a380b00e6..41fb24182 100644 --- a/target/linux/mpc83xx/config-default +++ b/target/linux/mpc83xx/config-default @@ -35,7 +35,6 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CMDLINE="console=ttyS0,115200" CONFIG_CMDLINE_BOOL=y # CONFIG_CPU_FREQ is not set -# CONFIG_CRASH_DUMP is not set CONFIG_CRYPTO_AEAD2=y CONFIG_CRYPTO_BLKCIPHER2=y CONFIG_CRYPTO_HASH2=y diff --git a/target/linux/ps3/config-2.6.30 b/target/linux/ps3/config-2.6.30 index c022b1d41..cd88b8099 100644 --- a/target/linux/ps3/config-2.6.30 +++ b/target/linux/ps3/config-2.6.30 @@ -41,7 +41,6 @@ CONFIG_COMPAT_BINFMT_ELF=y CONFIG_COMPAT_BRK=y CONFIG_CONSOLE_TRANSLATIONS=y # CONFIG_CPU_FREQ is not set -# CONFIG_CRASH_DUMP is not set CONFIG_CRC16=y # CONFIG_CRYPTO is not set # CONFIG_DEBUG_BUGVERBOSE is not set diff --git a/target/linux/pxcab/config-2.6.30 b/target/linux/pxcab/config-2.6.30 index fc9afe661..912a24859 100644 --- a/target/linux/pxcab/config-2.6.30 +++ b/target/linux/pxcab/config-2.6.30 @@ -68,7 +68,6 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_STAT=y # CONFIG_CPU_FREQ_STAT_DETAILS is not set CONFIG_CPU_FREQ_TABLE=y -# CONFIG_CRASH_DUMP is not set CONFIG_CRC16=y CONFIG_CRC_CCITT=m # CONFIG_CRYPTO is not set diff --git a/target/linux/pxcab/config-2.6.31 b/target/linux/pxcab/config-2.6.31 index f8259910d..d5c4c9bd0 100644 --- a/target/linux/pxcab/config-2.6.31 +++ b/target/linux/pxcab/config-2.6.31 @@ -68,7 +68,6 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_STAT=y # CONFIG_CPU_FREQ_STAT_DETAILS is not set CONFIG_CPU_FREQ_TABLE=y -# CONFIG_CRASH_DUMP is not set CONFIG_CRC16=y CONFIG_CRC_CCITT=m # CONFIG_CRYPTO is not set From 4388c9e2c1df2c4cdc33275552ad797cc0105353 Mon Sep 17 00:00:00 2001 From: kaloz Date: Wed, 11 Nov 2009 09:27:13 +0000 Subject: [PATCH 135/288] sort all target config files git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18367 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/adm5120/router_be/config-2.6.28 | 26 ++-- target/linux/adm5120/router_be/config-2.6.30 | 28 ++--- target/linux/adm5120/router_be/config-2.6.31 | 28 ++--- target/linux/adm5120/router_le/config-2.6.28 | 44 +++---- target/linux/adm5120/router_le/config-2.6.30 | 46 ++++---- target/linux/adm5120/router_le/config-2.6.31 | 46 ++++---- target/linux/amazon/config-2.6.21 | 16 +-- target/linux/ar7/config-2.6.27 | 10 +- target/linux/ar7/config-default | 14 +-- target/linux/ar71xx/config-2.6.28 | 20 ++-- target/linux/ar71xx/config-2.6.30 | 24 ++-- target/linux/ar71xx/config-2.6.31 | 26 ++-- target/linux/at91/config-2.6.25 | 34 +++--- target/linux/atheros/config-2.6.30 | 14 +-- target/linux/atheros/config-2.6.31 | 16 +-- target/linux/au1000/au1500/config-default | 14 +-- target/linux/au1000/au1550/config-default | 54 ++++----- target/linux/avr32/config-default | 4 +- target/linux/brcm-2.4/config-default | 72 +++++------ target/linux/brcm47xx/config-2.6.28 | 24 ++-- target/linux/brcm47xx/config-2.6.30 | 28 ++--- target/linux/brcm47xx/config-2.6.31 | 30 ++--- target/linux/brcm63xx/config-2.6.30 | 38 +++--- target/linux/cobalt/config-default | 36 +++--- target/linux/coldfire/config-default | 16 +-- target/linux/etrax/config-2.6.30 | 20 ++-- target/linux/gemini/config-default | 16 +-- target/linux/generic-2.4/config-default | 118 +++++++++---------- target/linux/generic-2.6/config-2.6.30 | 10 +- target/linux/generic-2.6/config-2.6.31 | 10 +- target/linux/goldfish/config-2.6.30 | 36 +++--- target/linux/ifxmips/config-2.6.30 | 16 +-- target/linux/ifxmips/nfs/config-2.6.26 | 4 +- target/linux/ifxmips/nfs/config-2.6.27 | 4 +- target/linux/ifxmips/nfs/config-2.6.28 | 10 +- target/linux/iop32x/config-default | 40 +++---- target/linux/ixp4xx/config-2.6.28 | 28 ++--- target/linux/ixp4xx/config-2.6.30 | 22 ++-- target/linux/ixp4xx/config-2.6.31 | 22 ++-- target/linux/ixp4xx/config-2.6.32 | 22 ++-- target/linux/ixp4xx/config-default | 42 +++---- target/linux/ixp4xx/harddisk/config-default | 18 +-- target/linux/mpc52xx/config-2.6.30 | 56 ++++----- target/linux/mpc83xx/config-default | 32 ++--- target/linux/octeon/config-default | 50 ++++---- target/linux/olpc/config-2.6.30 | 104 ++++++++-------- target/linux/orion/config-default | 50 ++++---- target/linux/orion/harddisk/config-default | 48 ++++---- target/linux/ppc40x/config-default | 26 ++-- target/linux/ppc44x/config-default | 36 +++--- target/linux/ps3/config-2.6.30 | 74 ++++++------ target/linux/pxa/config-default | 56 ++++----- target/linux/pxcab/config-2.6.30 | 104 ++++++++-------- target/linux/pxcab/config-2.6.31 | 110 ++++++++--------- target/linux/ramips/rt288x/config-2.6.30 | 12 +- target/linux/ramips/rt305x/config-2.6.30 | 10 +- target/linux/rb532/config-default | 22 ++-- target/linux/rdc/ar525w/config-2.6.30 | 2 +- target/linux/rdc/config-2.6.28 | 34 +++--- target/linux/rdc/config-2.6.30 | 32 ++--- target/linux/s3c24xx/config-2.6.30 | 104 ++++++++-------- target/linux/s3c24xx/config-2.6.31 | 100 ++++++++-------- target/linux/sibyte/config-default | 6 +- target/linux/ubicom32/config-2.6.28 | 36 +++--- target/linux/x86/config-2.6.28 | 76 ++++++------ target/linux/x86/config-2.6.30 | 80 ++++++------- target/linux/x86/config-2.6.31 | 84 ++++++------- target/linux/x86/olpc/config-2.6.30 | 104 ++++++++-------- target/linux/x86/olpc/config-2.6.31 | 114 +++++++++--------- 69 files changed, 1354 insertions(+), 1354 deletions(-) diff --git a/target/linux/adm5120/router_be/config-2.6.28 b/target/linux/adm5120/router_be/config-2.6.28 index dac488f5d..153421d1f 100644 --- a/target/linux/adm5120/router_be/config-2.6.28 +++ b/target/linux/adm5120/router_be/config-2.6.28 @@ -1,6 +1,5 @@ CONFIG_32BIT=y # CONFIG_64BIT is not set -CONFIG_ADM5120=y CONFIG_ADM5120_ENET=y # CONFIG_ADM5120_MACH_5GXI is not set CONFIG_ADM5120_MACH_P_334WT=y @@ -15,6 +14,7 @@ CONFIG_ADM5120_MACH_P_335=y CONFIG_ADM5120_OEM_ZYXEL=y CONFIG_ADM5120_SOC_BGA=y CONFIG_ADM5120_WDT=y +CONFIG_ADM5120=y # CONFIG_ARCH_HAS_ILOG2_U32 is not set # CONFIG_ARCH_HAS_ILOG2_U64 is not set CONFIG_ARCH_POPULATES_NODE_MAP=y @@ -37,9 +37,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y # CONFIG_CPU_LITTLE_ENDIAN is not set # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32_R1=y # CONFIG_CPU_MIPS32_R2 is not set +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR1=y @@ -71,8 +71,8 @@ CONFIG_ELF_CORE=y CONFIG_FIRMWARE_IN_KERNEL=y CONFIG_FS_POSIX_ACL=y CONFIG_GENERIC_ACL=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_NEXT_BIT=y CONFIG_GENERIC_GPIO=y @@ -87,28 +87,28 @@ CONFIG_HAVE_ARCH_KGDB=y # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set CONFIG_HAVE_IDE=y CONFIG_HAVE_OPROFILE=y -CONFIG_HID=m CONFIG_HID_COMPAT=y +CONFIG_HID=m CONFIG_HID_SUPPORT=y CONFIG_HW_HAS_PCI=y CONFIG_HW_RANDOM=y -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set # CONFIG_IDE is not set CONFIG_INITRAMFS_SOURCE="" -CONFIG_INOTIFY=y CONFIG_INOTIFY_USER=y -CONFIG_INPUT=m +CONFIG_INOTIFY=y # CONFIG_INPUT_GPIO_BUTTONS is not set +CONFIG_INPUT=m # CONFIG_INPUT_YEALINK is not set CONFIG_IRQ_CPU=y # CONFIG_ISDN is not set CONFIG_LEDS_GPIO=m CONFIG_LEDS_TRIGGER_ADM5120_SWITCH=m -CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LEGACY_PTYS=y # CONFIG_LEMOTE_FULONG is not set # CONFIG_MACH_ALCHEMY is not set # CONFIG_MACH_DECSTATION is not set @@ -119,7 +119,6 @@ CONFIG_LEGACY_PTY_COUNT=256 # CONFIG_MACH_VR41XX is not set CONFIG_MII=m # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set # CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 @@ -129,6 +128,7 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_MTD_ADM5120=y CONFIG_MTD_BLOCK2MTD=y @@ -142,9 +142,9 @@ CONFIG_MTD_TRXSPLIT=y # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PARTITION_ADVANCED is not set -CONFIG_PCI=y CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y +CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set @@ -154,18 +154,18 @@ CONFIG_PCI_DOMAINS=y CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y # CONFIG_SCSI_DMA is not set # CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_AMBA_PL010=y CONFIG_SERIAL_AMBA_PL010_CONSOLE=y CONFIG_SERIAL_AMBA_PL010_NUMPORTS=2 CONFIG_SERIAL_AMBA_PL010_PORTNAME="ttyS" +CONFIG_SERIAL_AMBA_PL010=y # CONFIG_SERIAL_AMBA_PL011 is not set -CONFIG_SERIO=y # CONFIG_SERIO_AMBAKMI is not set # CONFIG_SERIO_I8042 is not set # CONFIG_SERIO_LIBPS2 is not set # CONFIG_SERIO_PCIPS2 is not set # CONFIG_SERIO_RAW is not set CONFIG_SERIO_SERPORT=y +CONFIG_SERIO=y # CONFIG_SGI_IP22 is not set # CONFIG_SGI_IP27 is not set # CONFIG_SGI_IP28 is not set @@ -191,10 +191,10 @@ CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y CONFIG_TICK_ONESHOT=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TRAD_SIGNALS=y -CONFIG_USB=m CONFIG_USB_ADM5120_HCD=m CONFIG_USB_DEBUG=y CONFIG_USB_EHCI_HCD=m +CONFIG_USB=m # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set CONFIG_USB_OHCI_HCD=m diff --git a/target/linux/adm5120/router_be/config-2.6.30 b/target/linux/adm5120/router_be/config-2.6.30 index e954c7af3..71e4688c7 100644 --- a/target/linux/adm5120/router_be/config-2.6.30 +++ b/target/linux/adm5120/router_be/config-2.6.30 @@ -1,6 +1,5 @@ CONFIG_32BIT=y # CONFIG_64BIT is not set -CONFIG_ADM5120=y CONFIG_ADM5120_ENET=y CONFIG_ADM5120_MACH_5GXI=y CONFIG_ADM5120_MACH_P_334WT=y @@ -15,6 +14,7 @@ CONFIG_ADM5120_OEM_OSBRIDGE=y CONFIG_ADM5120_OEM_ZYXEL=y CONFIG_ADM5120_SOC_BGA=y CONFIG_ADM5120_WDT=y +CONFIG_ADM5120=y # CONFIG_ARCH_HAS_ILOG2_U32 is not set # CONFIG_ARCH_HAS_ILOG2_U64 is not set CONFIG_ARCH_POPULATES_NODE_MAP=y @@ -31,8 +31,8 @@ CONFIG_BITREVERSE=y # CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CEVT_R4K=y CONFIG_CEVT_R4K_LIB=y +CONFIG_CEVT_R4K=y CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,jffs2" CONFIG_CPU_BIG_ENDIAN=y # CONFIG_CPU_CAVIUM_OCTEON is not set @@ -41,9 +41,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y # CONFIG_CPU_LITTLE_ENDIAN is not set # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32_R1=y # CONFIG_CPU_MIPS32_R2 is not set +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR1=y @@ -65,8 +65,8 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y # CONFIG_CPU_TX39XX is not set # CONFIG_CPU_TX49XX is not set # CONFIG_CPU_VR41XX is not set -CONFIG_CSRC_R4K=y CONFIG_CSRC_R4K_LIB=y +CONFIG_CSRC_R4K=y CONFIG_DECOMPRESS_LZMA=y CONFIG_DEVPORT=y # CONFIG_DM9000 is not set @@ -77,8 +77,8 @@ CONFIG_ELF_CORE=y CONFIG_FIRMWARE_IN_KERNEL=y CONFIG_FS_POSIX_ACL=y CONFIG_GENERIC_ACL=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -99,22 +99,22 @@ CONFIG_HID=m CONFIG_HID_SUPPORT=y CONFIG_HW_HAS_PCI=y CONFIG_HW_RANDOM=y -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set CONFIG_INITRAMFS_SOURCE="" -CONFIG_INOTIFY=y CONFIG_INOTIFY_USER=y -CONFIG_INPUT=m +CONFIG_INOTIFY=y # CONFIG_INPUT_GPIO_BUTTONS is not set +CONFIG_INPUT=m # CONFIG_INPUT_YEALINK is not set CONFIG_IRQ_CPU=y # CONFIG_ISDN is not set CONFIG_LEDS_GPIO=m CONFIG_LEDS_TRIGGER_ADM5120_SWITCH=m -CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LEGACY_PTYS=y # CONFIG_LEMOTE_FULONG is not set # CONFIG_MACH_ALCHEMY is not set # CONFIG_MACH_DECSTATION is not set @@ -124,7 +124,6 @@ CONFIG_LEGACY_PTY_COUNT=256 # CONFIG_MACH_VR41XX is not set CONFIG_MII=m # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set # CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 @@ -134,6 +133,7 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_MTD_ADM5120=y CONFIG_MTD_BLOCK2MTD=y @@ -147,9 +147,9 @@ CONFIG_MTD_TRXSPLIT=y # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PARTITION_ADVANCED is not set -CONFIG_PCI=y CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y +CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set @@ -159,18 +159,18 @@ CONFIG_PCI_DOMAINS=y CONFIG_SCHED_OMIT_FRAME_POINTER=y # CONFIG_SCSI_DMA is not set # CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_AMBA_PL010=y CONFIG_SERIAL_AMBA_PL010_CONSOLE=y CONFIG_SERIAL_AMBA_PL010_NUMPORTS=2 CONFIG_SERIAL_AMBA_PL010_PORTNAME="ttyS" +CONFIG_SERIAL_AMBA_PL010=y # CONFIG_SERIAL_AMBA_PL011 is not set -CONFIG_SERIO=y # CONFIG_SERIO_AMBAKMI is not set # CONFIG_SERIO_I8042 is not set # CONFIG_SERIO_LIBPS2 is not set # CONFIG_SERIO_PCIPS2 is not set # CONFIG_SERIO_RAW is not set CONFIG_SERIO_SERPORT=y +CONFIG_SERIO=y # CONFIG_SGI_IP22 is not set # CONFIG_SGI_IP27 is not set # CONFIG_SGI_IP28 is not set @@ -198,10 +198,10 @@ CONFIG_TICK_ONESHOT=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TRACING_SUPPORT=y CONFIG_TRAD_SIGNALS=y -CONFIG_USB=m CONFIG_USB_ADM5120_HCD=m CONFIG_USB_DEBUG=y CONFIG_USB_EHCI_HCD=m +CONFIG_USB=m # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set CONFIG_USB_OHCI_HCD=m diff --git a/target/linux/adm5120/router_be/config-2.6.31 b/target/linux/adm5120/router_be/config-2.6.31 index cd7b7e984..0413c962e 100644 --- a/target/linux/adm5120/router_be/config-2.6.31 +++ b/target/linux/adm5120/router_be/config-2.6.31 @@ -1,6 +1,5 @@ CONFIG_32BIT=y # CONFIG_64BIT is not set -CONFIG_ADM5120=y CONFIG_ADM5120_ENET=y CONFIG_ADM5120_MACH_5GXI=y CONFIG_ADM5120_MACH_P_334WT=y @@ -15,6 +14,7 @@ CONFIG_ADM5120_OEM_OSBRIDGE=y CONFIG_ADM5120_OEM_ZYXEL=y CONFIG_ADM5120_SOC_BGA=y CONFIG_ADM5120_WDT=y +CONFIG_ADM5120=y # CONFIG_ALCHEMY_GPIO_INDIRECT is not set # CONFIG_AR7 is not set # CONFIG_ARCH_HAS_ILOG2_U32 is not set @@ -33,8 +33,8 @@ CONFIG_BITREVERSE=y # CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CEVT_R4K=y CONFIG_CEVT_R4K_LIB=y +CONFIG_CEVT_R4K=y CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,jffs2" CONFIG_CPU_BIG_ENDIAN=y # CONFIG_CPU_CAVIUM_OCTEON is not set @@ -43,9 +43,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y # CONFIG_CPU_LITTLE_ENDIAN is not set # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32_R1=y # CONFIG_CPU_MIPS32_R2 is not set +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR1=y @@ -67,8 +67,8 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y # CONFIG_CPU_TX39XX is not set # CONFIG_CPU_TX49XX is not set # CONFIG_CPU_VR41XX is not set -CONFIG_CSRC_R4K=y CONFIG_CSRC_R4K_LIB=y +CONFIG_CSRC_R4K=y CONFIG_DECOMPRESS_LZMA=y CONFIG_DEVPORT=y # CONFIG_DM9000 is not set @@ -79,8 +79,8 @@ CONFIG_ELF_CORE=y CONFIG_FIRMWARE_IN_KERNEL=y CONFIG_FS_POSIX_ACL=y CONFIG_GENERIC_ACL=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -101,22 +101,22 @@ CONFIG_HID=m CONFIG_HID_SUPPORT=y CONFIG_HW_HAS_PCI=y CONFIG_HW_RANDOM=y -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set CONFIG_INITRAMFS_SOURCE="" -CONFIG_INOTIFY=y CONFIG_INOTIFY_USER=y -CONFIG_INPUT=m +CONFIG_INOTIFY=y # CONFIG_INPUT_GPIO_BUTTONS is not set +CONFIG_INPUT=m # CONFIG_INPUT_YEALINK is not set CONFIG_IRQ_CPU=y # CONFIG_ISDN is not set CONFIG_LEDS_GPIO=m CONFIG_LEDS_TRIGGER_ADM5120_SWITCH=m -CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LEGACY_PTYS=y # CONFIG_LEMOTE_FULONG is not set CONFIG_MAC80211_DEFAULT_PS_VALUE=0 # CONFIG_MACH_ALCHEMY is not set @@ -127,7 +127,6 @@ CONFIG_MAC80211_DEFAULT_PS_VALUE=0 # CONFIG_MACH_VR41XX is not set CONFIG_MII=m # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set # CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 @@ -137,6 +136,7 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_MTD_ADM5120=y CONFIG_MTD_BLOCK2MTD=y @@ -151,9 +151,9 @@ CONFIG_NLS=m # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PARTITION_ADVANCED is not set -CONFIG_PCI=y CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y +CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set @@ -163,18 +163,18 @@ CONFIG_PCI_DOMAINS=y CONFIG_SCHED_OMIT_FRAME_POINTER=y # CONFIG_SCSI_DMA is not set # CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_AMBA_PL010=y CONFIG_SERIAL_AMBA_PL010_CONSOLE=y CONFIG_SERIAL_AMBA_PL010_NUMPORTS=2 CONFIG_SERIAL_AMBA_PL010_PORTNAME="ttyS" +CONFIG_SERIAL_AMBA_PL010=y # CONFIG_SERIAL_AMBA_PL011 is not set -CONFIG_SERIO=y # CONFIG_SERIO_AMBAKMI is not set # CONFIG_SERIO_I8042 is not set # CONFIG_SERIO_LIBPS2 is not set # CONFIG_SERIO_PCIPS2 is not set # CONFIG_SERIO_RAW is not set CONFIG_SERIO_SERPORT=y +CONFIG_SERIO=y # CONFIG_SGI_IP22 is not set # CONFIG_SGI_IP27 is not set # CONFIG_SGI_IP28 is not set @@ -200,10 +200,10 @@ CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y CONFIG_TICK_ONESHOT=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TRAD_SIGNALS=y -CONFIG_USB=m CONFIG_USB_ADM5120_HCD=m CONFIG_USB_DEBUG=y CONFIG_USB_EHCI_HCD=m +CONFIG_USB=m # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set CONFIG_USB_OHCI_HCD=m diff --git a/target/linux/adm5120/router_le/config-2.6.28 b/target/linux/adm5120/router_le/config-2.6.28 index 287feaa96..214294222 100644 --- a/target/linux/adm5120/router_le/config-2.6.28 +++ b/target/linux/adm5120/router_le/config-2.6.28 @@ -1,11 +1,10 @@ CONFIG_32BIT=y # CONFIG_64BIT is not set # CONFIG_8139TOO is not set -CONFIG_ADM5120=y CONFIG_ADM5120_ENET=y CONFIG_ADM5120_MACH_5GXI=y -CONFIG_ADM5120_MACH_BR_6104K=y CONFIG_ADM5120_MACH_BR_6104KP=y +CONFIG_ADM5120_MACH_BR_6104K=y CONFIG_ADM5120_MACH_BR_61X4WG=y CONFIG_ADM5120_MACH_CAS_771=y CONFIG_ADM5120_MACH_EASY5120P_ATA=y @@ -17,8 +16,8 @@ CONFIG_ADM5120_MACH_NP27G=y CONFIG_ADM5120_MACH_NP28G=y CONFIG_ADM5120_MACH_PMUGW=y CONFIG_ADM5120_MACH_RB_11X=y -CONFIG_ADM5120_MACH_RB_133=y CONFIG_ADM5120_MACH_RB_133C=y +CONFIG_ADM5120_MACH_RB_133=y CONFIG_ADM5120_MACH_RB_150=y CONFIG_ADM5120_MACH_RB_153=y CONFIG_ADM5120_MACH_RB_192=y @@ -33,6 +32,7 @@ CONFIG_ADM5120_OEM_OSBRIDGE=y # CONFIG_ADM5120_OEM_ZYXEL is not set CONFIG_ADM5120_SOC_BGA=y CONFIG_ADM5120_WDT=y +CONFIG_ADM5120=y # CONFIG_ARCH_HAS_ILOG2_U32 is not set # CONFIG_ARCH_HAS_ILOG2_U64 is not set CONFIG_ARCH_POPULATES_NODE_MAP=y @@ -58,9 +58,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y CONFIG_CPU_LITTLE_ENDIAN=y # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32_R1=y # CONFIG_CPU_MIPS32_R2 is not set +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR1=y @@ -83,15 +83,15 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y # CONFIG_CPU_TX49XX is not set # CONFIG_CPU_VR41XX is not set CONFIG_CRYPTO_AEAD2=m -CONFIG_CRYPTO_ALGAPI=m CONFIG_CRYPTO_ALGAPI2=m +CONFIG_CRYPTO_ALGAPI=m CONFIG_CRYPTO_ARC4=m -CONFIG_CRYPTO_BLKCIPHER=m CONFIG_CRYPTO_BLKCIPHER2=m +CONFIG_CRYPTO_BLKCIPHER=m CONFIG_CRYPTO_ECB=m CONFIG_CRYPTO_HASH2=m -CONFIG_CRYPTO_MANAGER=m CONFIG_CRYPTO_MANAGER2=m +CONFIG_CRYPTO_MANAGER=m CONFIG_CRYPTO_RNG2=m CONFIG_CSRC_R4K=y CONFIG_DEVPORT=y @@ -103,8 +103,8 @@ CONFIG_ELF_CORE=y CONFIG_FIRMWARE_IN_KERNEL=y CONFIG_FS_POSIX_ACL=y CONFIG_GENERIC_ACL=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_NEXT_BIT=y CONFIG_GENERIC_GPIO=y @@ -120,36 +120,36 @@ CONFIG_HAVE_ARCH_KGDB=y # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set CONFIG_HAVE_IDE=y CONFIG_HAVE_OPROFILE=y -CONFIG_HID=m CONFIG_HID_COMPAT=y +CONFIG_HID=m CONFIG_HID_SUPPORT=y -CONFIG_HOSTAP=m -CONFIG_HOSTAP_FIRMWARE=y # CONFIG_HOSTAP_FIRMWARE_NVRAM is not set +CONFIG_HOSTAP_FIRMWARE=y +CONFIG_HOSTAP=m CONFIG_HOSTAP_PCI=m CONFIG_HW_HAS_PCI=y CONFIG_HW_RANDOM=y -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set # CONFIG_IDE is not set -CONFIG_IEEE80211=m CONFIG_IEEE80211_CRYPT_WEP=m +CONFIG_IEEE80211=m CONFIG_IMAGE_CMDLINE_HACK=y CONFIG_INITRAMFS_SOURCE="" -CONFIG_INOTIFY=y CONFIG_INOTIFY_USER=y -CONFIG_INPUT=m +CONFIG_INOTIFY=y # CONFIG_INPUT_GPIO_BUTTONS is not set +CONFIG_INPUT=m # CONFIG_INPUT_YEALINK is not set CONFIG_IRQ_CPU=y # CONFIG_ISDN is not set CONFIG_KEXEC=y CONFIG_LEDS_GPIO=m CONFIG_LEDS_TRIGGER_ADM5120_SWITCH=m -CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LEGACY_PTYS=y # CONFIG_LEMOTE_FULONG is not set # CONFIG_MACH_ALCHEMY is not set # CONFIG_MACH_DECSTATION is not set @@ -160,7 +160,6 @@ CONFIG_LEGACY_PTY_COUNT=256 # CONFIG_MACH_VR41XX is not set CONFIG_MII=m # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set # CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 @@ -170,6 +169,7 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_MTD_ADM5120=y CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC=y @@ -177,8 +177,8 @@ CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC=y CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_JEDECPROBE=y CONFIG_MTD_MYLOADER_PARTS=y -CONFIG_MTD_NAND=y CONFIG_MTD_NAND_PLATFORM=y +CONFIG_MTD_NAND=y CONFIG_MTD_TRXSPLIT=y # CONFIG_NATSEMI is not set CONFIG_NO_HZ=y @@ -188,9 +188,9 @@ CONFIG_NO_HZ=y CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PARTITION_ADVANCED is not set CONFIG_PATA_RB153_CF=m -CONFIG_PCI=y CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y +CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set @@ -201,18 +201,18 @@ CONFIG_PCI_DOMAINS=y CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y CONFIG_SCSI=m # CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_AMBA_PL010=y CONFIG_SERIAL_AMBA_PL010_CONSOLE=y CONFIG_SERIAL_AMBA_PL010_NUMPORTS=2 CONFIG_SERIAL_AMBA_PL010_PORTNAME="ttyS" +CONFIG_SERIAL_AMBA_PL010=y # CONFIG_SERIAL_AMBA_PL011 is not set -CONFIG_SERIO=y # CONFIG_SERIO_AMBAKMI is not set # CONFIG_SERIO_I8042 is not set # CONFIG_SERIO_LIBPS2 is not set # CONFIG_SERIO_PCIPS2 is not set # CONFIG_SERIO_RAW is not set CONFIG_SERIO_SERPORT=y +CONFIG_SERIO=y # CONFIG_SGI_IP22 is not set # CONFIG_SGI_IP27 is not set # CONFIG_SGI_IP28 is not set @@ -239,9 +239,9 @@ CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y CONFIG_TICK_ONESHOT=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TRAD_SIGNALS=y -CONFIG_USB=m CONFIG_USB_ADM5120_HCD=m CONFIG_USB_EHCI_HCD=m +CONFIG_USB=m # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set CONFIG_USB_OHCI_HCD=m diff --git a/target/linux/adm5120/router_le/config-2.6.30 b/target/linux/adm5120/router_le/config-2.6.30 index 394b85ae2..2b8ab3431 100644 --- a/target/linux/adm5120/router_le/config-2.6.30 +++ b/target/linux/adm5120/router_le/config-2.6.30 @@ -1,10 +1,9 @@ CONFIG_32BIT=y # CONFIG_64BIT is not set -CONFIG_ADM5120=y CONFIG_ADM5120_ENET=y CONFIG_ADM5120_MACH_5GXI=y -CONFIG_ADM5120_MACH_BR_6104K=y CONFIG_ADM5120_MACH_BR_6104KP=y +CONFIG_ADM5120_MACH_BR_6104K=y CONFIG_ADM5120_MACH_BR_61X4WG=y CONFIG_ADM5120_MACH_CAS_771=y CONFIG_ADM5120_MACH_EASY5120P_ATA=y @@ -16,8 +15,8 @@ CONFIG_ADM5120_MACH_NP27G=y CONFIG_ADM5120_MACH_NP28G=y CONFIG_ADM5120_MACH_PMUGW=y CONFIG_ADM5120_MACH_RB_11X=y -CONFIG_ADM5120_MACH_RB_133=y CONFIG_ADM5120_MACH_RB_133C=y +CONFIG_ADM5120_MACH_RB_133=y CONFIG_ADM5120_MACH_RB_150=y CONFIG_ADM5120_MACH_RB_153=y CONFIG_ADM5120_MACH_RB_192=y @@ -32,6 +31,7 @@ CONFIG_ADM5120_OEM_OSBRIDGE=y # CONFIG_ADM5120_OEM_ZYXEL is not set CONFIG_ADM5120_SOC_BGA=y CONFIG_ADM5120_WDT=y +CONFIG_ADM5120=y # CONFIG_ARCH_HAS_ILOG2_U32 is not set # CONFIG_ARCH_HAS_ILOG2_U64 is not set CONFIG_ARCH_POPULATES_NODE_MAP=y @@ -51,8 +51,8 @@ CONFIG_BITREVERSE=y # CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CEVT_R4K=y CONFIG_CEVT_R4K_LIB=y +CONFIG_CEVT_R4K=y CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,yaffs2,jffs2" # CONFIG_CPU_BIG_ENDIAN is not set # CONFIG_CPU_CAVIUM_OCTEON is not set @@ -61,9 +61,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y CONFIG_CPU_LITTLE_ENDIAN=y # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32_R1=y # CONFIG_CPU_MIPS32_R2 is not set +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR1=y @@ -88,18 +88,18 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y CONFIG_CRYPTO_AEAD2=y CONFIG_CRYPTO_AES=m CONFIG_CRYPTO_ARC4=m -CONFIG_CRYPTO_BLKCIPHER=m CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_BLKCIPHER=m CONFIG_CRYPTO_ECB=m -CONFIG_CRYPTO_HASH=m CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_MANAGER=m +CONFIG_CRYPTO_HASH=m CONFIG_CRYPTO_MANAGER2=y +CONFIG_CRYPTO_MANAGER=m CONFIG_CRYPTO_MICHAEL_MIC=m CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_WORKQUEUE=y -CONFIG_CSRC_R4K=y CONFIG_CSRC_R4K_LIB=y +CONFIG_CSRC_R4K=y CONFIG_DECOMPRESS_LZMA=y CONFIG_DEVPORT=y # CONFIG_DM9000 is not set @@ -110,8 +110,8 @@ CONFIG_ELF_CORE=y CONFIG_FIRMWARE_IN_KERNEL=y CONFIG_FS_POSIX_ACL=y CONFIG_GENERIC_ACL=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -131,35 +131,35 @@ CONFIG_HAVE_MLOCK=y CONFIG_HAVE_OPROFILE=y CONFIG_HID=m CONFIG_HID_SUPPORT=y -CONFIG_HOSTAP=m -CONFIG_HOSTAP_FIRMWARE=y # CONFIG_HOSTAP_FIRMWARE_NVRAM is not set +CONFIG_HOSTAP_FIRMWARE=y +CONFIG_HOSTAP=m CONFIG_HOSTAP_PCI=m CONFIG_HW_HAS_PCI=y CONFIG_HW_RANDOM=y -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set CONFIG_IMAGE_CMDLINE_HACK=y CONFIG_INITRAMFS_SOURCE="" -CONFIG_INOTIFY=y CONFIG_INOTIFY_USER=y -CONFIG_INPUT=m +CONFIG_INOTIFY=y # CONFIG_INPUT_GPIO_BUTTONS is not set +CONFIG_INPUT=m # CONFIG_INPUT_YEALINK is not set CONFIG_IRQ_CPU=y # CONFIG_ISDN is not set CONFIG_KEXEC=y CONFIG_LEDS_GPIO=m CONFIG_LEDS_TRIGGER_ADM5120_SWITCH=m -CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LEGACY_PTYS=y # CONFIG_LEMOTE_FULONG is not set -CONFIG_LIB80211=m CONFIG_LIB80211_CRYPT_CCMP=m CONFIG_LIB80211_CRYPT_TKIP=m CONFIG_LIB80211_CRYPT_WEP=m +CONFIG_LIB80211=m # CONFIG_MACH_ALCHEMY is not set # CONFIG_MACH_DECSTATION is not set # CONFIG_MACH_JAZZ is not set @@ -168,7 +168,6 @@ CONFIG_LIB80211_CRYPT_WEP=m # CONFIG_MACH_VR41XX is not set CONFIG_MII=m # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set # CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 @@ -178,6 +177,7 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_MTD_ADM5120=y CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC=y @@ -185,8 +185,8 @@ CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC=y CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_JEDECPROBE=y CONFIG_MTD_MYLOADER_PARTS=y -CONFIG_MTD_NAND=y CONFIG_MTD_NAND_PLATFORM=y +CONFIG_MTD_NAND=y CONFIG_MTD_TRXSPLIT=y # CONFIG_NATSEMI is not set CONFIG_NO_HZ=y @@ -196,9 +196,9 @@ CONFIG_NO_HZ=y CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PARTITION_ADVANCED is not set CONFIG_PATA_RB153_CF=m -CONFIG_PCI=y CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y +CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set @@ -208,18 +208,18 @@ CONFIG_PCI_DOMAINS=y CONFIG_SCHED_OMIT_FRAME_POINTER=y CONFIG_SCSI=m # CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_AMBA_PL010=y CONFIG_SERIAL_AMBA_PL010_CONSOLE=y CONFIG_SERIAL_AMBA_PL010_NUMPORTS=2 CONFIG_SERIAL_AMBA_PL010_PORTNAME="ttyS" +CONFIG_SERIAL_AMBA_PL010=y # CONFIG_SERIAL_AMBA_PL011 is not set -CONFIG_SERIO=y # CONFIG_SERIO_AMBAKMI is not set # CONFIG_SERIO_I8042 is not set # CONFIG_SERIO_LIBPS2 is not set # CONFIG_SERIO_PCIPS2 is not set # CONFIG_SERIO_RAW is not set CONFIG_SERIO_SERPORT=y +CONFIG_SERIO=y # CONFIG_SGI_IP22 is not set # CONFIG_SGI_IP27 is not set # CONFIG_SGI_IP28 is not set @@ -248,9 +248,9 @@ CONFIG_TICK_ONESHOT=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TRACING_SUPPORT=y CONFIG_TRAD_SIGNALS=y -CONFIG_USB=m CONFIG_USB_ADM5120_HCD=m CONFIG_USB_EHCI_HCD=m +CONFIG_USB=m # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set CONFIG_USB_OHCI_HCD=m diff --git a/target/linux/adm5120/router_le/config-2.6.31 b/target/linux/adm5120/router_le/config-2.6.31 index 05926f1bd..612fbf0dd 100644 --- a/target/linux/adm5120/router_le/config-2.6.31 +++ b/target/linux/adm5120/router_le/config-2.6.31 @@ -1,10 +1,9 @@ CONFIG_32BIT=y # CONFIG_64BIT is not set -CONFIG_ADM5120=y CONFIG_ADM5120_ENET=y CONFIG_ADM5120_MACH_5GXI=y -CONFIG_ADM5120_MACH_BR_6104K=y CONFIG_ADM5120_MACH_BR_6104KP=y +CONFIG_ADM5120_MACH_BR_6104K=y CONFIG_ADM5120_MACH_BR_61X4WG=y CONFIG_ADM5120_MACH_CAS_771=y CONFIG_ADM5120_MACH_EASY5120P_ATA=y @@ -16,8 +15,8 @@ CONFIG_ADM5120_MACH_NP27G=y CONFIG_ADM5120_MACH_NP28G=y CONFIG_ADM5120_MACH_PMUGW=y CONFIG_ADM5120_MACH_RB_11X=y -CONFIG_ADM5120_MACH_RB_133=y CONFIG_ADM5120_MACH_RB_133C=y +CONFIG_ADM5120_MACH_RB_133=y CONFIG_ADM5120_MACH_RB_150=y CONFIG_ADM5120_MACH_RB_153=y CONFIG_ADM5120_MACH_RB_192=y @@ -32,6 +31,7 @@ CONFIG_ADM5120_OEM_OSBRIDGE=y # CONFIG_ADM5120_OEM_ZYXEL is not set CONFIG_ADM5120_SOC_BGA=y CONFIG_ADM5120_WDT=y +CONFIG_ADM5120=y # CONFIG_ALCHEMY_GPIO_INDIRECT is not set # CONFIG_AR7 is not set # CONFIG_ARCH_HAS_ILOG2_U32 is not set @@ -52,8 +52,8 @@ CONFIG_BITREVERSE=y # CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CEVT_R4K=y CONFIG_CEVT_R4K_LIB=y +CONFIG_CEVT_R4K=y CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,yaffs2,jffs2" # CONFIG_CPU_BIG_ENDIAN is not set # CONFIG_CPU_CAVIUM_OCTEON is not set @@ -62,9 +62,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y CONFIG_CPU_LITTLE_ENDIAN=y # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32_R1=y # CONFIG_CPU_MIPS32_R2 is not set +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR1=y @@ -89,18 +89,18 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y CONFIG_CRYPTO_AEAD2=y CONFIG_CRYPTO_AES=m CONFIG_CRYPTO_ARC4=m -CONFIG_CRYPTO_BLKCIPHER=m CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_BLKCIPHER=m CONFIG_CRYPTO_ECB=m -CONFIG_CRYPTO_HASH=m CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_MANAGER=m +CONFIG_CRYPTO_HASH=m CONFIG_CRYPTO_MANAGER2=y +CONFIG_CRYPTO_MANAGER=m CONFIG_CRYPTO_MICHAEL_MIC=m CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_WORKQUEUE=y -CONFIG_CSRC_R4K=y CONFIG_CSRC_R4K_LIB=y +CONFIG_CSRC_R4K=y CONFIG_DECOMPRESS_LZMA=y CONFIG_DEVPORT=y # CONFIG_DM9000 is not set @@ -111,8 +111,8 @@ CONFIG_ELF_CORE=y CONFIG_FIRMWARE_IN_KERNEL=y CONFIG_FS_POSIX_ACL=y CONFIG_GENERIC_ACL=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -132,35 +132,35 @@ CONFIG_HAVE_IDE=y CONFIG_HAVE_OPROFILE=y CONFIG_HID=m CONFIG_HID_SUPPORT=y -CONFIG_HOSTAP=m -CONFIG_HOSTAP_FIRMWARE=y # CONFIG_HOSTAP_FIRMWARE_NVRAM is not set +CONFIG_HOSTAP_FIRMWARE=y +CONFIG_HOSTAP=m CONFIG_HOSTAP_PCI=m CONFIG_HW_HAS_PCI=y CONFIG_HW_RANDOM=y -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set CONFIG_IMAGE_CMDLINE_HACK=y CONFIG_INITRAMFS_SOURCE="" -CONFIG_INOTIFY=y CONFIG_INOTIFY_USER=y -CONFIG_INPUT=m +CONFIG_INOTIFY=y # CONFIG_INPUT_GPIO_BUTTONS is not set +CONFIG_INPUT=m # CONFIG_INPUT_YEALINK is not set CONFIG_IRQ_CPU=y # CONFIG_ISDN is not set CONFIG_KEXEC=y CONFIG_LEDS_GPIO=m CONFIG_LEDS_TRIGGER_ADM5120_SWITCH=m -CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LEGACY_PTYS=y # CONFIG_LEMOTE_FULONG is not set -CONFIG_LIB80211=m CONFIG_LIB80211_CRYPT_CCMP=m CONFIG_LIB80211_CRYPT_TKIP=m CONFIG_LIB80211_CRYPT_WEP=m +CONFIG_LIB80211=m CONFIG_MAC80211_DEFAULT_PS_VALUE=0 # CONFIG_MACH_ALCHEMY is not set # CONFIG_MACH_DECSTATION is not set @@ -170,7 +170,6 @@ CONFIG_MAC80211_DEFAULT_PS_VALUE=0 # CONFIG_MACH_VR41XX is not set CONFIG_MII=m # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set # CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 @@ -180,6 +179,7 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_MTD_ADM5120=y CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC=y @@ -187,8 +187,8 @@ CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC=y CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_JEDECPROBE=y CONFIG_MTD_MYLOADER_PARTS=y -CONFIG_MTD_NAND=y CONFIG_MTD_NAND_PLATFORM=y +CONFIG_MTD_NAND=y CONFIG_MTD_TRXSPLIT=y # CONFIG_NATSEMI is not set CONFIG_NLS=m @@ -199,9 +199,9 @@ CONFIG_NO_HZ=y CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PARTITION_ADVANCED is not set CONFIG_PATA_RB153_CF=m -CONFIG_PCI=y CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y +CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set @@ -211,18 +211,18 @@ CONFIG_PCI_DOMAINS=y CONFIG_SCHED_OMIT_FRAME_POINTER=y CONFIG_SCSI=m # CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_AMBA_PL010=y CONFIG_SERIAL_AMBA_PL010_CONSOLE=y CONFIG_SERIAL_AMBA_PL010_NUMPORTS=2 CONFIG_SERIAL_AMBA_PL010_PORTNAME="ttyS" +CONFIG_SERIAL_AMBA_PL010=y # CONFIG_SERIAL_AMBA_PL011 is not set -CONFIG_SERIO=y # CONFIG_SERIO_AMBAKMI is not set # CONFIG_SERIO_I8042 is not set # CONFIG_SERIO_LIBPS2 is not set # CONFIG_SERIO_PCIPS2 is not set # CONFIG_SERIO_RAW is not set CONFIG_SERIO_SERPORT=y +CONFIG_SERIO=y # CONFIG_SGI_IP22 is not set # CONFIG_SGI_IP27 is not set # CONFIG_SGI_IP28 is not set @@ -249,9 +249,9 @@ CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y CONFIG_TICK_ONESHOT=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TRAD_SIGNALS=y -CONFIG_USB=m CONFIG_USB_ADM5120_HCD=m CONFIG_USB_EHCI_HCD=m +CONFIG_USB=m # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set CONFIG_USB_OHCI_HCD=m diff --git a/target/linux/amazon/config-2.6.21 b/target/linux/amazon/config-2.6.21 index 6d830e1d7..af8d1efca 100644 --- a/target/linux/amazon/config-2.6.21 +++ b/target/linux/amazon/config-2.6.21 @@ -2,12 +2,12 @@ CONFIG_32BIT=y # CONFIG_64BIT is not set # CONFIG_64BIT_PHYS_ADDR is not set CONFIG_ADM6996_SUPPORT=y -CONFIG_AMAZON=y CONFIG_AMAZON_ASC_UART=y CONFIG_AMAZON_MTD=y CONFIG_AMAZON_NET_SW=y CONFIG_AMAZON_PCI=y CONFIG_AMAZON_WDT=y +CONFIG_AMAZON=y # CONFIG_ARCH_HAS_ILOG2_U32 is not set # CONFIG_ARCH_HAS_ILOG2_U64 is not set CONFIG_BASE_SMALL=0 @@ -18,9 +18,9 @@ CONFIG_CPU_HAS_LLSC=y CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y # CONFIG_CPU_LITTLE_ENDIAN is not set -CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32_R1=y # CONFIG_CPU_MIPS32_R2 is not set +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR1=y @@ -59,12 +59,11 @@ CONFIG_HW_RANDOM=y # CONFIG_IDE is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_IRQ_CPU=y -CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_EXTRA_PASS is not set +CONFIG_KALLSYMS=y # CONFIG_MACH_DECSTATION is not set # CONFIG_MACH_JAZZ is not set # CONFIG_MACH_VR41XX is not set -CONFIG_MIPS=y # CONFIG_MIPS_ATLAS is not set # CONFIG_MIPS_BOSPORUS is not set # CONFIG_MIPS_COBALT is not set @@ -78,10 +77,10 @@ CONFIG_MIPS=y CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MALTA is not set # CONFIG_MIPS_MIRAGE is not set -# CONFIG_MIPS_MTX1 is not set CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set +# CONFIG_MIPS_MTX1 is not set # CONFIG_MIPS_PB1000 is not set # CONFIG_MIPS_PB1100 is not set # CONFIG_MIPS_PB1200 is not set @@ -91,11 +90,12 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_SIM is not set # CONFIG_MIPS_VPE_LOADER is not set # CONFIG_MIPS_XXS1500 is not set +CONFIG_MIPS=y # CONFIG_MOMENCO_JAGUAR_ATX is not set -# CONFIG_MOMENCO_OCELOT is not set # CONFIG_MOMENCO_OCELOT_3 is not set # CONFIG_MOMENCO_OCELOT_C is not set # CONFIG_MOMENCO_OCELOT_G is not set +# CONFIG_MOMENCO_OCELOT is not set CONFIG_MTD_AMAZON_BUS_WIDTH_16=y # CONFIG_MTD_AMAZON_BUS_WIDTH_32 is not set # CONFIG_MTD_AMAZON_BUS_WIDTH_8 is not set @@ -107,13 +107,13 @@ CONFIG_MTD_CFI_ADV_OPTIONS=y # CONFIG_MTD_CFI_GEOMETRY is not set # CONFIG_MTD_CFI_INTELEXT is not set # CONFIG_MTD_OBSOLETE_CHIPS is not set -CONFIG_MTD_PHYSMAP=y CONFIG_MTD_PHYSMAP_BANKWIDTH=0 CONFIG_MTD_PHYSMAP_LEN=0x0 CONFIG_MTD_PHYSMAP_START=0x0 +CONFIG_MTD_PHYSMAP=y CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-3 -CONFIG_MTD_REDBOOT_PARTS=y # CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set +CONFIG_MTD_REDBOOT_PARTS=y # CONFIG_NET_PCI is not set CONFIG_NET_SCH_FIFO=y # CONFIG_NET_VENDOR_3COM is not set diff --git a/target/linux/ar7/config-2.6.27 b/target/linux/ar7/config-2.6.27 index a64a00afc..2d74680c8 100644 --- a/target/linux/ar7/config-2.6.27 +++ b/target/linux/ar7/config-2.6.27 @@ -1,8 +1,8 @@ CONFIG_32BIT=y # CONFIG_64BIT is not set -CONFIG_AR7=y CONFIG_AR7_GPIO=y CONFIG_AR7_WDT=y +CONFIG_AR7=y # CONFIG_ARCH_HAS_ILOG2_U32 is not set # CONFIG_ARCH_HAS_ILOG2_U64 is not set CONFIG_ARCH_POPULATES_NODE_MAP=y @@ -23,9 +23,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y CONFIG_CPU_LITTLE_ENDIAN=y # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32_R1=y # CONFIG_CPU_MIPS32_R2 is not set +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR1=y @@ -52,8 +52,8 @@ CONFIG_DMA_NEED_PCI_MAP_STATE=y CONFIG_DMA_NONCOHERENT=y CONFIG_EARLY_PRINTK=y CONFIG_FIXED_PHY=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y # CONFIG_GENERIC_FIND_FIRST_BIT is not set CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -89,7 +89,6 @@ CONFIG_LEDS_GPIO=y # CONFIG_MACH_TX49XX is not set # CONFIG_MACH_VR41XX is not set # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MACHINE is not set @@ -98,12 +97,13 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y CONFIG_MTD_AR7_PARTS=y CONFIG_MTD_CFI_STAA=y -CONFIG_MTD_PHYSMAP=y CONFIG_MTD_PHYSMAP_BANKWIDTH=2 CONFIG_MTD_PHYSMAP_LEN=0 CONFIG_MTD_PHYSMAP_START=0x10000000 +CONFIG_MTD_PHYSMAP=y CONFIG_NO_EXCEPT_FILL=y # CONFIG_NO_IOPORT is not set CONFIG_PAGEFLAGS_EXTENDED=y diff --git a/target/linux/ar7/config-default b/target/linux/ar7/config-default index 00d898e71..9cd78ca2d 100644 --- a/target/linux/ar7/config-default +++ b/target/linux/ar7/config-default @@ -1,8 +1,9 @@ + CONFIG_32BIT=y # CONFIG_64BIT is not set -CONFIG_AR7=y CONFIG_AR7_GPIO=y CONFIG_AR7_WDT=y +CONFIG_AR7=y # CONFIG_ARCH_HAS_ILOG2_U32 is not set # CONFIG_ARCH_HAS_ILOG2_U64 is not set CONFIG_ARCH_POPULATES_NODE_MAP=y @@ -16,8 +17,8 @@ CONFIG_BITREVERSE=y CONFIG_BOOT_ELF32=y # CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set -CONFIG_CEVT_R4K=y CONFIG_CEVT_R4K_LIB=y +CONFIG_CEVT_R4K=y CONFIG_CMDLINE="rootfstype=squashfs,jffs2" CONFIG_CPMAC=y # CONFIG_CPU_BIG_ENDIAN is not set @@ -27,9 +28,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y CONFIG_CPU_LITTLE_ENDIAN=y # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32_R1=y # CONFIG_CPU_MIPS32_R2 is not set +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR1=y @@ -51,16 +52,16 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y # CONFIG_CPU_TX39XX is not set # CONFIG_CPU_TX49XX is not set # CONFIG_CPU_VR41XX is not set -CONFIG_CSRC_R4K=y CONFIG_CSRC_R4K_LIB=y +CONFIG_CSRC_R4K=y CONFIG_DECOMPRESS_LZMA=y # CONFIG_DM9000 is not set CONFIG_DMA_NEED_PCI_MAP_STATE=y CONFIG_DMA_NONCOHERENT=y CONFIG_EARLY_PRINTK=y CONFIG_FIXED_PHY=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -90,7 +91,6 @@ CONFIG_LEDS_GPIO=y # CONFIG_MACH_TX49XX is not set # CONFIG_MACH_VR41XX is not set # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set # CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 @@ -100,6 +100,7 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y CONFIG_MTD_AR7_PARTS=y CONFIG_MTD_CFI_STAA=y CONFIG_MTD_PHYSMAP=y @@ -115,7 +116,6 @@ CONFIG_PHYLIB=y # CONFIG_PNX8550_JBS is not set # CONFIG_PNX8550_STB810 is not set # CONFIG_PROBE_INITRD_HEADER is not set - CONFIG_SCHED_OMIT_FRAME_POINTER=y # CONFIG_SCSI_DMA is not set # CONFIG_SERIAL_8250_EXTENDED is not set diff --git a/target/linux/ar71xx/config-2.6.28 b/target/linux/ar71xx/config-2.6.28 index 539396ff6..885a04b57 100644 --- a/target/linux/ar71xx/config-2.6.28 +++ b/target/linux/ar71xx/config-2.6.28 @@ -1,9 +1,9 @@ CONFIG_32BIT=y # CONFIG_64BIT is not set # CONFIG_8139TOO is not set -CONFIG_AG71XX=y CONFIG_AG71XX_AR8216_SUPPORT=y # CONFIG_AG71XX_DEBUG is not set +CONFIG_AG71XX=y CONFIG_AR71XX_MACH_AP81=y CONFIG_AR71XX_MACH_AP83=y CONFIG_AR71XX_MACH_AW_NR580=y @@ -43,9 +43,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y # CONFIG_CPU_LITTLE_ENDIAN is not set # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS32_R1 is not set CONFIG_CPU_MIPS32_R2=y +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR2=y @@ -73,8 +73,8 @@ CONFIG_DEVPORT=y CONFIG_DMA_NEED_PCI_MAP_STATE=y CONFIG_DMA_NONCOHERENT=y CONFIG_EARLY_PRINTK=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_NEXT_BIT=y CONFIG_GENERIC_GPIO=y @@ -92,10 +92,10 @@ CONFIG_HAVE_IDE=y CONFIG_HAVE_OPROFILE=y CONFIG_HW_HAS_PCI=y # CONFIG_HW_RANDOM is not set -CONFIG_I2C=y CONFIG_I2C_ALGOBIT=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_GPIO=y +CONFIG_I2C=y CONFIG_ICPLUS_PHY=y # CONFIG_IDE is not set CONFIG_IMAGE_CMDLINE_HACK=y @@ -116,7 +116,6 @@ CONFIG_IRQ_CPU=y # CONFIG_MACH_VR41XX is not set CONFIG_MICREL_PHY=y # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set # CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 @@ -126,20 +125,20 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y CONFIG_MTD_AR91XX_FLASH=y -# CONFIG_MTD_CFI is not set # CONFIG_MTD_CFI_INTELEXT is not set +# CONFIG_MTD_CFI is not set CONFIG_MTD_JEDECPROBE=y CONFIG_MTD_M25P80=y CONFIG_MTD_MYLOADER_PARTS=y -CONFIG_MTD_NAND=y CONFIG_MTD_NAND_RB4XX=y +CONFIG_MTD_NAND=y CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-2 CONFIG_MTD_REDBOOT_PARTS=y CONFIG_MTD_WRT160NL_PARTS=y CONFIG_MYLOADER=y # CONFIG_NATSEMI is not set -CONFIG_NET_DSA=y CONFIG_NET_DSA_MV88E6060=y # CONFIG_NET_DSA_MV88E6123_61_65 is not set # CONFIG_NET_DSA_MV88E6131 is not set @@ -148,13 +147,14 @@ CONFIG_NET_DSA_MV88E6060=y # CONFIG_NET_DSA_TAG_DSA is not set # CONFIG_NET_DSA_TAG_EDSA is not set CONFIG_NET_DSA_TAG_TRAILER=y +CONFIG_NET_DSA=y # CONFIG_NO_IOPORT is not set # CONFIG_NXP_STB220 is not set # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PCI=y CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y +CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set @@ -183,7 +183,6 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=1 # CONFIG_SIBYTE_SWARM is not set # CONFIG_SLAB is not set CONFIG_SLUB=y -CONFIG_SPI=y CONFIG_SPI_AP83=y CONFIG_SPI_AR71XX=y CONFIG_SPI_BITBANG=y @@ -192,6 +191,7 @@ CONFIG_SPI_MASTER=y CONFIG_SPI_PB44=y # CONFIG_SPI_SPIDEV is not set # CONFIG_SPI_VSC7385 is not set +CONFIG_SPI=y CONFIG_SWCONFIG=y CONFIG_SYS_HAS_CPU_MIPS32_R1=y CONFIG_SYS_HAS_CPU_MIPS32_R2=y diff --git a/target/linux/ar71xx/config-2.6.30 b/target/linux/ar71xx/config-2.6.30 index 7e925b4b6..4434633f4 100644 --- a/target/linux/ar71xx/config-2.6.30 +++ b/target/linux/ar71xx/config-2.6.30 @@ -1,8 +1,8 @@ CONFIG_32BIT=y # CONFIG_64BIT is not set -CONFIG_AG71XX=y CONFIG_AG71XX_AR8216_SUPPORT=y # CONFIG_AG71XX_DEBUG is not set +CONFIG_AG71XX=y CONFIG_AR71XX_MACH_AP81=y CONFIG_AR71XX_MACH_AP83=y CONFIG_AR71XX_MACH_AW_NR580=y @@ -36,8 +36,8 @@ CONFIG_BITREVERSE=y # CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CEVT_R4K=y CONFIG_CEVT_R4K_LIB=y +CONFIG_CEVT_R4K=y CONFIG_CMDLINE="rootfstype=squashfs,yaffs,jffs2 noinitrd console=ttyS0,115200" CONFIG_CPU_BIG_ENDIAN=y # CONFIG_CPU_CAVIUM_OCTEON is not set @@ -46,9 +46,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y # CONFIG_CPU_LITTLE_ENDIAN is not set # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS32_R1 is not set CONFIG_CPU_MIPS32_R2=y +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR2=y @@ -70,16 +70,16 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y # CONFIG_CPU_TX39XX is not set # CONFIG_CPU_TX49XX is not set # CONFIG_CPU_VR41XX is not set -CONFIG_CSRC_R4K=y CONFIG_CSRC_R4K_LIB=y +CONFIG_CSRC_R4K=y CONFIG_DECOMPRESS_LZMA=y CONFIG_DEVPORT=y # CONFIG_DM9000 is not set CONFIG_DMA_NEED_PCI_MAP_STATE=y CONFIG_DMA_NONCOHERENT=y CONFIG_EARLY_PRINTK=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -99,10 +99,10 @@ CONFIG_HAVE_MLOCK=y CONFIG_HAVE_OPROFILE=y CONFIG_HW_HAS_PCI=y # CONFIG_HW_RANDOM is not set -CONFIG_I2C=y CONFIG_I2C_ALGOBIT=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_GPIO=y +CONFIG_I2C=y CONFIG_ICPLUS_PHY=y CONFIG_IMAGE_CMDLINE_HACK=y CONFIG_INITRAMFS_ROOT_GID=0 @@ -121,7 +121,6 @@ CONFIG_IRQ_CPU=y # CONFIG_MACH_VR41XX is not set CONFIG_MICREL_PHY=y # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set # CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 @@ -131,20 +130,20 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y CONFIG_MTD_AR91XX_FLASH=y -# CONFIG_MTD_CFI is not set # CONFIG_MTD_CFI_INTELEXT is not set +# CONFIG_MTD_CFI is not set CONFIG_MTD_JEDECPROBE=y CONFIG_MTD_M25P80=y CONFIG_MTD_MYLOADER_PARTS=y -CONFIG_MTD_NAND=y CONFIG_MTD_NAND_RB4XX=y +CONFIG_MTD_NAND=y CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-2 CONFIG_MTD_REDBOOT_PARTS=y CONFIG_MTD_WRT160NL_PARTS=y CONFIG_MYLOADER=y # CONFIG_NATSEMI is not set -CONFIG_NET_DSA=y CONFIG_NET_DSA_MV88E6060=y # CONFIG_NET_DSA_MV88E6123_61_65 is not set # CONFIG_NET_DSA_MV88E6131 is not set @@ -153,13 +152,14 @@ CONFIG_NET_DSA_MV88E6060=y # CONFIG_NET_DSA_TAG_DSA is not set # CONFIG_NET_DSA_TAG_EDSA is not set CONFIG_NET_DSA_TAG_TRAILER=y +CONFIG_NET_DSA=y # CONFIG_NO_IOPORT is not set # CONFIG_NXP_STB220 is not set # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PCI=y CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y +CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set @@ -188,7 +188,6 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=1 # CONFIG_SLAB is not set # CONFIG_SLOW_WORK is not set CONFIG_SLUB=y -CONFIG_SPI=y CONFIG_SPI_AP83=y CONFIG_SPI_AR71XX=y CONFIG_SPI_BITBANG=y @@ -197,6 +196,7 @@ CONFIG_SPI_MASTER=y CONFIG_SPI_PB44=y # CONFIG_SPI_SPIDEV is not set # CONFIG_SPI_VSC7385 is not set +CONFIG_SPI=y CONFIG_SWCONFIG=y CONFIG_SYS_HAS_CPU_MIPS32_R1=y CONFIG_SYS_HAS_CPU_MIPS32_R2=y diff --git a/target/linux/ar71xx/config-2.6.31 b/target/linux/ar71xx/config-2.6.31 index bc817fdc3..1c7809e2c 100644 --- a/target/linux/ar71xx/config-2.6.31 +++ b/target/linux/ar71xx/config-2.6.31 @@ -1,10 +1,9 @@ CONFIG_32BIT=y # CONFIG_64BIT is not set -CONFIG_AG71XX=y CONFIG_AG71XX_AR8216_SUPPORT=y # CONFIG_AG71XX_DEBUG is not set +CONFIG_AG71XX=y # CONFIG_ALCHEMY_GPIO_INDIRECT is not set -# CONFIG_AR7 is not set CONFIG_AR71XX_MACH_AP81=y CONFIG_AR71XX_MACH_AP83=y CONFIG_AR71XX_MACH_AW_NR580=y @@ -23,6 +22,7 @@ CONFIG_AR71XX_MACH_WP543=y CONFIG_AR71XX_MACH_WRT160NL=y CONFIG_AR71XX_MACH_WRT400N=y CONFIG_AR71XX_WDT=y +# CONFIG_AR7 is not set # CONFIG_ARCH_HAS_ILOG2_U32 is not set # CONFIG_ARCH_HAS_ILOG2_U64 is not set CONFIG_ARCH_HIBERNATION_POSSIBLE=y @@ -38,8 +38,8 @@ CONFIG_BITREVERSE=y # CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CEVT_R4K=y CONFIG_CEVT_R4K_LIB=y +CONFIG_CEVT_R4K=y CONFIG_CMDLINE="rootfstype=squashfs,yaffs,jffs2 noinitrd console=ttyS0,115200" CONFIG_CPU_BIG_ENDIAN=y # CONFIG_CPU_CAVIUM_OCTEON is not set @@ -48,9 +48,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y # CONFIG_CPU_LITTLE_ENDIAN is not set # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS32_R1 is not set CONFIG_CPU_MIPS32_R2=y +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR2=y @@ -72,8 +72,8 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y # CONFIG_CPU_TX39XX is not set # CONFIG_CPU_TX49XX is not set # CONFIG_CPU_VR41XX is not set -CONFIG_CSRC_R4K=y CONFIG_CSRC_R4K_LIB=y +CONFIG_CSRC_R4K=y CONFIG_DECOMPRESS_LZMA=y CONFIG_DEVPORT=y # CONFIG_DM9000 is not set @@ -81,8 +81,8 @@ CONFIG_DMA_NEED_PCI_MAP_STATE=y CONFIG_DMA_NONCOHERENT=y CONFIG_EARLY_PRINTK=y # CONFIG_FSNOTIFY is not set -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -101,10 +101,10 @@ CONFIG_HAVE_IDE=y CONFIG_HAVE_OPROFILE=y CONFIG_HW_HAS_PCI=y # CONFIG_HW_RANDOM is not set -CONFIG_I2C=y CONFIG_I2C_ALGOBIT=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_GPIO=y +CONFIG_I2C=y CONFIG_ICPLUS_PHY=y CONFIG_IMAGE_CMDLINE_HACK=y CONFIG_INITRAMFS_ROOT_GID=0 @@ -124,7 +124,6 @@ CONFIG_MAC80211_DEFAULT_PS_VALUE=0 # CONFIG_MACH_VR41XX is not set CONFIG_MICREL_PHY=y # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set # CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 @@ -134,20 +133,20 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y CONFIG_MTD_AR91XX_FLASH=y -# CONFIG_MTD_CFI is not set # CONFIG_MTD_CFI_INTELEXT is not set +# CONFIG_MTD_CFI is not set CONFIG_MTD_JEDECPROBE=y CONFIG_MTD_M25P80=y CONFIG_MTD_MYLOADER_PARTS=y -CONFIG_MTD_NAND=y CONFIG_MTD_NAND_RB4XX=y +CONFIG_MTD_NAND=y CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-2 CONFIG_MTD_REDBOOT_PARTS=y CONFIG_MTD_WRT160NL_PARTS=y CONFIG_MYLOADER=y # CONFIG_NATSEMI is not set -CONFIG_NET_DSA=y CONFIG_NET_DSA_MV88E6060=y # CONFIG_NET_DSA_MV88E6123_61_65 is not set # CONFIG_NET_DSA_MV88E6131 is not set @@ -156,13 +155,14 @@ CONFIG_NET_DSA_MV88E6060=y # CONFIG_NET_DSA_TAG_DSA is not set # CONFIG_NET_DSA_TAG_EDSA is not set CONFIG_NET_DSA_TAG_TRAILER=y +CONFIG_NET_DSA=y # CONFIG_NO_IOPORT is not set # CONFIG_NXP_STB220 is not set # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PCI=y CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y +CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set @@ -190,7 +190,6 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=1 # CONFIG_SIBYTE_SWARM is not set # CONFIG_SLAB is not set CONFIG_SLUB=y -CONFIG_SPI=y CONFIG_SPI_AP83=y CONFIG_SPI_AR71XX=y CONFIG_SPI_BITBANG=y @@ -199,6 +198,7 @@ CONFIG_SPI_MASTER=y CONFIG_SPI_PB44=y # CONFIG_SPI_SPIDEV is not set # CONFIG_SPI_VSC7385 is not set +CONFIG_SPI=y CONFIG_SWCONFIG=y CONFIG_SYS_HAS_CPU_MIPS32_R1=y CONFIG_SYS_HAS_CPU_MIPS32_R2=y diff --git a/target/linux/at91/config-2.6.25 b/target/linux/at91/config-2.6.25 index edac29bad..5d16c2f00 100644 --- a/target/linux/at91/config-2.6.25 +++ b/target/linux/at91/config-2.6.25 @@ -1,23 +1,23 @@ # CONFIG_AEABI is not set CONFIG_ALIGNMENT_TRAP=y -CONFIG_ARCH_AT91=y # CONFIG_ARCH_AT91CAP9 is not set -CONFIG_ARCH_AT91RM9200=y # CONFIG_ARCH_AT91RM9200DK is not set +CONFIG_ARCH_AT91RM9200=y # CONFIG_ARCH_AT91SAM9260 is not set # CONFIG_ARCH_AT91SAM9261 is not set # CONFIG_ARCH_AT91SAM9263 is not set # CONFIG_ARCH_AT91SAM9RL is not set # CONFIG_ARCH_AT91X40 is not set +CONFIG_ARCH_AT91=y # CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set # CONFIG_ARCH_HAS_ILOG2_U32 is not set # CONFIG_ARCH_HAS_ILOG2_U64 is not set CONFIG_ARCH_SUPPORTS_AOUT=y # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARM=y CONFIG_ARM_AT91_ETHER=y CONFIG_ARM_THUMB=y +CONFIG_ARM=y # CONFIG_ARPD is not set # CONFIG_ARTHUR is not set CONFIG_AT91_EARLY_DBGU=y @@ -29,8 +29,8 @@ CONFIG_AT91_EARLY_DBGU=y # CONFIG_AT91_EARLY_USART5 is not set CONFIG_AT91_PMC_UNIT=y # CONFIG_AT91_PROGRAMMABLE_CLOCKS is not set -CONFIG_AT91_SPI=y # CONFIG_AT91_SPIDEV is not set +CONFIG_AT91_SPI=y CONFIG_AT91_TIMER_HZ=128 CONFIG_AT91_VLIO=y # CONFIG_ATMEL_PWM is not set @@ -38,23 +38,23 @@ CONFIG_AT91_VLIO=y CONFIG_BASE_SMALL=0 # CONFIG_BINFMT_AOUT is not set CONFIG_BITREVERSE=y -CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_BLK_DEV_RAM=y # CONFIG_BLK_DEV_XIP is not set # CONFIG_BONDING is not set CONFIG_BOUNCE=y # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_CLASSIC_RCU=y -CONFIG_CPU_32=y CONFIG_CPU_32v4T=y +CONFIG_CPU_32=y CONFIG_CPU_ABRT_EV4T=y CONFIG_CPU_ARM920T=y CONFIG_CPU_CACHE_V4WT=y CONFIG_CPU_CACHE_VIVT=y CONFIG_CPU_COPY_V4WB=y -CONFIG_CPU_CP15=y CONFIG_CPU_CP15_MMU=y +CONFIG_CPU_CP15=y # CONFIG_CPU_DCACHE_DISABLE is not set # CONFIG_CPU_DCACHE_WRITETHROUGH is not set # CONFIG_CPU_ICACHE_DISABLE is not set @@ -67,12 +67,12 @@ CONFIG_DAVICOM_PHY=y CONFIG_DUMMY_CONSOLE=y # CONFIG_E1000E_ENABLED is not set # CONFIG_FPE_FASTFPE is not set -CONFIG_FPE_NWFPE=y # CONFIG_FPE_NWFPE_XP is not set +CONFIG_FPE_NWFPE=y CONFIG_FRAME_POINTER=y CONFIG_FS_POSIX_ACL=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_GPIO=y CONFIG_HARDIRQS_SW_RESEND=y CONFIG_HAS_DMA=y @@ -92,10 +92,10 @@ CONFIG_HZ=128 # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_INPUT=y -CONFIG_LEDS=y CONFIG_LEDS_CPU=y -CONFIG_LEGACY_PTYS=y +CONFIG_LEDS=y CONFIG_LEGACY_PTY_COUNT=32 +CONFIG_LEGACY_PTYS=y # CONFIG_LLC2 is not set # CONFIG_LZO_COMPRESS is not set # CONFIG_LZO_DECOMPRESS is not set @@ -136,21 +136,21 @@ CONFIG_MTD_CMDLINE_PARTS=y # CONFIG_OUTER_CACHE is not set # CONFIG_PCI_SYSCALL is not set CONFIG_PHYLIB=y +# CONFIG_PPP_MULTILINK is not set # CONFIG_PPPOATM is not set # CONFIG_PPPOL2TP is not set -# CONFIG_PPP_MULTILINK is not set # CONFIG_PPP_SYNC_TTY is not set # CONFIG_SCSI_WAIT_SCAN is not set # CONFIG_SDIO_UART is not set # CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_ATMEL=y CONFIG_SERIAL_ATMEL_CONSOLE=y CONFIG_SERIAL_ATMEL_PDC=y # CONFIG_SERIAL_ATMEL_TTYAT is not set -CONFIG_SERIO=y +CONFIG_SERIAL_ATMEL=y # CONFIG_SERIO_LIBPS2 is not set CONFIG_SERIO_RAW=y CONFIG_SERIO_SERPORT=y +CONFIG_SERIO=y CONFIG_SLABINFO=y # CONFIG_SMC91X is not set # CONFIG_SPI_AT91 is not set @@ -159,8 +159,8 @@ CONFIG_SPLIT_PTLOCK_CPUS=4096 CONFIG_SYS_SUPPORTS_APM_EMULATION=y CONFIG_TICK_ONESHOT=y CONFIG_UID16=y -# CONFIG_USB is not set # CONFIG_USB_ARCH_HAS_EHCI is not set +# CONFIG_USB is not set CONFIG_USB_LIBUSUAL=y # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set @@ -207,12 +207,12 @@ CONFIG_USB_LIBUSUAL=y CONFIG_USB_SUPPORT=y # CONFIG_USB_UEAGLEATM is not set CONFIG_VECTORS_BASE=0xffff0000 -# CONFIG_VGASTATE is not set # CONFIG_VGA_CONSOLE is not set +# CONFIG_VGASTATE is not set # CONFIG_VIDEO_DEV is not set -CONFIG_VT=y CONFIG_VT_CONSOLE=y # CONFIG_VT_HW_CONSOLE_BINDING is not set +CONFIG_VT=y # CONFIG_W1 is not set # CONFIG_WATCHDOG is not set # CONFIG_WLAN_80211 is not set diff --git a/target/linux/atheros/config-2.6.30 b/target/linux/atheros/config-2.6.30 index 7c9b881d6..8cbe05f75 100644 --- a/target/linux/atheros/config-2.6.30 +++ b/target/linux/atheros/config-2.6.30 @@ -9,8 +9,8 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ATHEROS_AR2315=y CONFIG_ATHEROS_AR2315_PCI=y +CONFIG_ATHEROS_AR2315=y CONFIG_ATHEROS_AR231X=y CONFIG_ATHEROS_AR5312=y CONFIG_ATHEROS_WDT=y @@ -20,8 +20,8 @@ CONFIG_BASE_SMALL=0 CONFIG_BITREVERSE=y # CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set -CONFIG_CEVT_R4K=y CONFIG_CEVT_R4K_LIB=y +CONFIG_CEVT_R4K=y CONFIG_CMDLINE="console=ttyS0,9600 rootfstype=squashfs,jffs2" # CONFIG_COMPAT_NET_DEV_OPS is not set CONFIG_CPU_BIG_ENDIAN=y @@ -31,9 +31,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y # CONFIG_CPU_LITTLE_ENDIAN is not set # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32_R1=y # CONFIG_CPU_MIPS32_R2 is not set +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR1=y @@ -55,15 +55,15 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y # CONFIG_CPU_TX39XX is not set # CONFIG_CPU_TX49XX is not set # CONFIG_CPU_VR41XX is not set -CONFIG_CSRC_R4K=y CONFIG_CSRC_R4K_LIB=y +CONFIG_CSRC_R4K=y CONFIG_DECOMPRESS_LZMA=y CONFIG_DEVPORT=y # CONFIG_DM9000 is not set CONFIG_DMA_NEED_PCI_MAP_STATE=y CONFIG_DMA_NONCOHERENT=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -95,7 +95,6 @@ CONFIG_IRQ_CPU=y # CONFIG_MACH_TX49XX is not set # CONFIG_MACH_VR41XX is not set # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set # CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 @@ -105,6 +104,7 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y CONFIG_MTD_AR2315=y CONFIG_MTD_CFI_ADV_OPTIONS=y # CONFIG_MTD_CFI_GEOMETRY is not set @@ -119,8 +119,8 @@ CONFIG_MVSWITCH_PHY=y # CONFIG_NXP_STB220 is not set # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PCI=y CONFIG_PCI_DOMAINS=y +CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set diff --git a/target/linux/atheros/config-2.6.31 b/target/linux/atheros/config-2.6.31 index 2b3d0bdfa..2961fded4 100644 --- a/target/linux/atheros/config-2.6.31 +++ b/target/linux/atheros/config-2.6.31 @@ -12,8 +12,8 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ATHEROS_AR2315=y CONFIG_ATHEROS_AR2315_PCI=y +CONFIG_ATHEROS_AR2315=y CONFIG_ATHEROS_AR231X=y CONFIG_ATHEROS_AR5312=y CONFIG_ATHEROS_WDT=y @@ -23,8 +23,8 @@ CONFIG_BASE_SMALL=0 CONFIG_BITREVERSE=y # CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set -CONFIG_CEVT_R4K=y CONFIG_CEVT_R4K_LIB=y +CONFIG_CEVT_R4K=y CONFIG_CMDLINE="console=ttyS0,9600 rootfstype=squashfs,jffs2" CONFIG_CONSTRUCTORS=y CONFIG_CPU_BIG_ENDIAN=y @@ -34,9 +34,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y # CONFIG_CPU_LITTLE_ENDIAN is not set # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32_R1=y # CONFIG_CPU_MIPS32_R2 is not set +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR1=y @@ -58,16 +58,16 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y # CONFIG_CPU_TX39XX is not set # CONFIG_CPU_TX49XX is not set # CONFIG_CPU_VR41XX is not set -CONFIG_CSRC_R4K=y CONFIG_CSRC_R4K_LIB=y +CONFIG_CSRC_R4K=y CONFIG_DECOMPRESS_LZMA=y CONFIG_DEVPORT=y # CONFIG_DM9000 is not set CONFIG_DMA_NEED_PCI_MAP_STATE=y CONFIG_DMA_NONCOHERENT=y # CONFIG_FSNOTIFY is not set -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -81,8 +81,8 @@ CONFIG_HAS_IOPORT=y CONFIG_HAVE_ARCH_KGDB=y # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set CONFIG_HAVE_IDE=y -CONFIG_HAVE_MLOCK=y CONFIG_HAVE_MLOCKED_PAGE_BIT=y +CONFIG_HAVE_MLOCK=y CONFIG_HAVE_OPROFILE=y CONFIG_HW_HAS_PCI=y CONFIG_HW_RANDOM=y @@ -101,7 +101,6 @@ CONFIG_MAC80211_DEFAULT_PS_VALUE=0 # CONFIG_MACH_TX49XX is not set # CONFIG_MACH_VR41XX is not set # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set # CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 @@ -111,6 +110,7 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y CONFIG_MTD_AR2315=y CONFIG_MTD_CFI_ADV_OPTIONS=y # CONFIG_MTD_CFI_GEOMETRY is not set @@ -125,8 +125,8 @@ CONFIG_MVSWITCH_PHY=y # CONFIG_NXP_STB220 is not set # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PCI=y CONFIG_PCI_DOMAINS=y +CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set diff --git a/target/linux/au1000/au1500/config-default b/target/linux/au1000/au1500/config-default index 4a2c78c6a..64aa6c03c 100644 --- a/target/linux/au1000/au1500/config-default +++ b/target/linux/au1000/au1500/config-default @@ -23,9 +23,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y CONFIG_CPU_LITTLE_ENDIAN=y # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32_R1=y # CONFIG_CPU_MIPS32_R2 is not set +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR1=y @@ -64,8 +64,8 @@ CONFIG_DMA_NEED_PCI_MAP_STATE=y CONFIG_DMA_NONCOHERENT=y CONFIG_DUMMY=m CONFIG_ELF_CORE=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -84,15 +84,15 @@ CONFIG_HAVE_MLOCK=y CONFIG_HAVE_OPROFILE=y CONFIG_HW_HAS_PCI=y CONFIG_HW_RANDOM=y -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y -CONFIG_I2C=m CONFIG_I2C_ALGOBIT=m CONFIG_I2C_ALGOPCA=m CONFIG_I2C_ALGOPCF=m CONFIG_I2C_BOARDINFO=y CONFIG_I2C_CHARDEV=m +CONFIG_I2C=m CONFIG_INITRAMFS_SOURCE="" CONFIG_IRQ_CPU=y CONFIG_KEXEC=y @@ -106,7 +106,6 @@ CONFIG_MACH_ALCHEMY=y # CONFIG_MACH_VR41XX is not set CONFIG_MAGIC_SYSRQ=y # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y CONFIG_MIPS_AU1X00_ENET=y # CONFIG_MIPS_BOSPORUS is not set # CONFIG_MIPS_COBALT is not set @@ -120,10 +119,10 @@ CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MACHINE is not set # CONFIG_MIPS_MALTA is not set # CONFIG_MIPS_MIRAGE is not set -CONFIG_MIPS_MTX1=y CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set +CONFIG_MIPS_MTX1=y # CONFIG_MIPS_PB1000 is not set # CONFIG_MIPS_PB1100 is not set # CONFIG_MIPS_PB1200 is not set @@ -131,6 +130,7 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_PB1550 is not set # CONFIG_MIPS_SIM is not set # CONFIG_MIPS_XXS1500 is not set +CONFIG_MIPS=y CONFIG_MODULE_FORCE_UNLOAD=y # CONFIG_MTD_ALCHEMY is not set # CONFIG_MTD_CFI_INTELEXT is not set @@ -142,8 +142,8 @@ CONFIG_MTD_PHYSMAP=y # CONFIG_NXP_STB220 is not set # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PCI=y CONFIG_PCI_DOMAINS=y +CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set diff --git a/target/linux/au1000/au1550/config-default b/target/linux/au1000/au1550/config-default index a3623adfe..d18be4cba 100644 --- a/target/linux/au1000/au1550/config-default +++ b/target/linux/au1000/au1550/config-default @@ -22,9 +22,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y CONFIG_CPU_LITTLE_ENDIAN=y # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32_R1=y # CONFIG_CPU_MIPS32_R2 is not set +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR1=y @@ -61,8 +61,8 @@ CONFIG_DMA_NEED_PCI_MAP_STATE=y CONFIG_DMA_NONCOHERENT=y CONFIG_DUMMY=m CONFIG_ELF_CORE=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y # CONFIG_GENERIC_FIND_FIRST_BIT is not set CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -82,20 +82,20 @@ CONFIG_HAVE_IDE=y # CONFIG_HAVE_KPROBES is not set # CONFIG_HAVE_KRETPROBES is not set CONFIG_HAVE_OPROFILE=y -CONFIG_HOSTAP=m CONFIG_HOSTAP_CS=m +CONFIG_HOSTAP=m CONFIG_HOSTAP_PCI=m CONFIG_HW_HAS_PCI=y CONFIG_HW_RANDOM=y -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set # CONFIG_IDE is not set -CONFIG_IEEE80211=m CONFIG_IEEE80211_CRYPT_CCMP=m CONFIG_IEEE80211_CRYPT_TKIP=m CONFIG_IEEE80211_CRYPT_WEP=m +CONFIG_IEEE80211=m CONFIG_IFB=m CONFIG_INET_DIAG=m CONFIG_INET_TCP_DIAG=m @@ -126,7 +126,6 @@ CONFIG_MAGIC_SYSRQ=y # CONFIG_MFD_CORE is not set # CONFIG_MFD_TMIO is not set # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y CONFIG_MIPS_AU1X00_ENET=y # CONFIG_MIPS_BOSPORUS is not set # CONFIG_MIPS_COBALT is not set @@ -139,10 +138,10 @@ CONFIG_MIPS_DISABLE_OBSOLETE_IDE=y CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MALTA is not set # CONFIG_MIPS_MIRAGE is not set -# CONFIG_MIPS_MTX1 is not set CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set +# CONFIG_MIPS_MTX1 is not set # CONFIG_MIPS_PB1000 is not set # CONFIG_MIPS_PB1100 is not set # CONFIG_MIPS_PB1200 is not set @@ -150,16 +149,29 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_PB1550 is not set # CONFIG_MIPS_SIM is not set # CONFIG_MIPS_XXS1500 is not set +CONFIG_MIPS=y CONFIG_MODULE_FORCE_UNLOAD=y # CONFIG_MTD_ALCHEMY is not set # CONFIG_MTD_CFI_INTELEXT is not set # CONFIG_MTD_COMPLEX_MAPPINGS is not set CONFIG_MTD_CONCAT=y -CONFIG_MTD_PHYSMAP=y CONFIG_MTD_PHYSMAP_BANKWIDTH=2 CONFIG_MTD_PHYSMAP_LEN=0 CONFIG_MTD_PHYSMAP_START=0x8000000 +CONFIG_MTD_PHYSMAP=y # CONFIG_NATSEMI is not set +CONFIG_NET_ACT_GACT=m +CONFIG_NET_ACT_IPT=m +CONFIG_NET_ACT_MIRRED=m +CONFIG_NET_ACT_PEDIT=m +CONFIG_NET_CLS_BASIC=m +CONFIG_NET_CLS_FLOW=m +CONFIG_NET_CLS_FW=m +CONFIG_NET_CLS_ROUTE4=m +CONFIG_NET_CLS_RSVP6=m +CONFIG_NET_CLS_RSVP=m +CONFIG_NET_CLS_TCINDEX=m +CONFIG_NET_CLS_U32=m CONFIG_NETFILTER_XTABLES=m CONFIG_NETFILTER_XT_MATCH_COMMENT=m CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m @@ -180,27 +192,15 @@ CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m CONFIG_NETFILTER_XT_TARGET_RATEEST=m CONFIG_NETFILTER_XT_TARGET_TCPMSS=m CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m -CONFIG_NET_ACT_GACT=m -CONFIG_NET_ACT_IPT=m -CONFIG_NET_ACT_MIRRED=m -CONFIG_NET_ACT_PEDIT=m -CONFIG_NET_CLS_BASIC=m -CONFIG_NET_CLS_FLOW=m -CONFIG_NET_CLS_FW=m -CONFIG_NET_CLS_ROUTE4=m -CONFIG_NET_CLS_RSVP=m -CONFIG_NET_CLS_RSVP6=m -CONFIG_NET_CLS_TCINDEX=m -CONFIG_NET_CLS_U32=m CONFIG_NET_SCH_CBQ=m -CONFIG_NF_CONNTRACK=m CONFIG_NF_CONNTRACK_FTP=m CONFIG_NF_CONNTRACK_IPV4=m CONFIG_NF_CONNTRACK_IRC=m +CONFIG_NF_CONNTRACK=m CONFIG_NF_CONNTRACK_TFTP=m -CONFIG_NF_NAT=m CONFIG_NF_NAT_FTP=m CONFIG_NF_NAT_IRC=m +CONFIG_NF_NAT=m CONFIG_NF_NAT_TFTP=m # CONFIG_NO_IOPORT is not set CONFIG_PAGEFLAGS_EXTENDED=y @@ -210,24 +210,24 @@ CONFIG_PAGE_SIZE_4KB=y # CONFIG_PAGE_SIZE_8KB is not set CONFIG_PCCARD=m CONFIG_PCCARD_NONSTATIC=m -CONFIG_PCI=y CONFIG_PCI_DOMAINS=y -CONFIG_PCMCIA=m +CONFIG_PCI=y CONFIG_PCMCIA_AU1X00=m CONFIG_PCMCIA_IOCTL=y CONFIG_PCMCIA_LOAD_CIS=y +CONFIG_PCMCIA=m CONFIG_PCSPKR_PLATFORM=y CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set # CONFIG_PNX8550_JBS is not set # CONFIG_PNX8550_STB810 is not set -CONFIG_PPP=m -CONFIG_PPPOE=m -CONFIG_PPPOL2TP=m CONFIG_PPP_ASYNC=m CONFIG_PPP_BSDCOMP=m CONFIG_PPP_DEFLATE=m +CONFIG_PPP=m +CONFIG_PPPOE=m +CONFIG_PPPOL2TP=m # CONFIG_PREVENT_FIRMWARE_BUILD is not set # CONFIG_PROBE_INITRD_HEADER is not set # CONFIG_R6040 is not set diff --git a/target/linux/avr32/config-default b/target/linux/avr32/config-default index b267c94f8..640cddb11 100644 --- a/target/linux/avr32/config-default +++ b/target/linux/avr32/config-default @@ -58,10 +58,10 @@ CONFIG_LEDS_GPIO=y CONFIG_LOAD_ADDRESS=0x10000000 CONFIG_LOADER_U_BOOT=y CONFIG_MACB=y -CONFIG_MMC=m -CONFIG_MMC_ATMELMCI=m # CONFIG_MMC_ATMELMCI_DMA is not set +CONFIG_MMC_ATMELMCI=m CONFIG_MMC_BLOCK=m +CONFIG_MMC=m # CONFIG_MTD_CFI_INTELEXT is not set CONFIG_MTD_CMDLINE_PARTS=y # CONFIG_MTD_COMPLEX_MAPPINGS is not set diff --git a/target/linux/brcm-2.4/config-default b/target/linux/brcm-2.4/config-default index ca963df4f..263e07948 100644 --- a/target/linux/brcm-2.4/config-default +++ b/target/linux/brcm-2.4/config-default @@ -1,24 +1,24 @@ # CONFIG_60XX_WDT is not set # CONFIG_6PACK is not set # CONFIG_8139CP is not set -# CONFIG_8139TOO is not set +# CONFIG_8139_OLD_RX_RESET is not set # CONFIG_8139TOO_8129 is not set +# CONFIG_8139TOO is not set # CONFIG_8139TOO_PIO is not set # CONFIG_8139TOO_TUNE_TWISTER is not set -# CONFIG_8139_OLD_RX_RESET is not set # CONFIG_ACQUIRE_WDT is not set # CONFIG_ADAPTEC_STARFIRE is not set # CONFIG_ADVANTECH_WDT is not set -# CONFIG_AIRO is not set # CONFIG_AIRO_CS is not set +# CONFIG_AIRO is not set # CONFIG_ALIM1535_WDT is not set # CONFIG_ALIM7101_WDT is not set # CONFIG_AMD74XX_OVERRIDE is not set # CONFIG_AMD8111_ETH is not set # CONFIG_APRICOT is not set # CONFIG_ATM is not set -CONFIG_AX25=m # CONFIG_AX25_DAMA_SLAVE is not set +CONFIG_AX25=m CONFIG_B44=y # CONFIG_BAYCOM_EPP is not set # CONFIG_BAYCOM_PAR is not set @@ -34,14 +34,14 @@ CONFIG_BCM947XX=y CONFIG_BLK_DEV_AEC62XX=m # CONFIG_BLK_DEV_ALI15X3 is not set # CONFIG_BLK_DEV_AMD74XX is not set -# CONFIG_BLK_DEV_ATARAID is not set # CONFIG_BLK_DEV_ATARAID_HPT is not set +# CONFIG_BLK_DEV_ATARAID is not set # CONFIG_BLK_DEV_ATARAID_MEDLEY is not set # CONFIG_BLK_DEV_ATARAID_PDC is not set # CONFIG_BLK_DEV_ATARAID_SII is not set # CONFIG_BLK_DEV_ATIIXP is not set -# CONFIG_BLK_DEV_CMD640 is not set # CONFIG_BLK_DEV_CMD640_ENHANCED is not set +# CONFIG_BLK_DEV_CMD640 is not set # CONFIG_BLK_DEV_CMD64X is not set # CONFIG_BLK_DEV_CS5530 is not set # CONFIG_BLK_DEV_CY82C693 is not set @@ -50,25 +50,25 @@ CONFIG_BLK_DEV_AEC62XX=m # CONFIG_BLK_DEV_HD_IDE is not set # CONFIG_BLK_DEV_HPT34X is not set # CONFIG_BLK_DEV_HPT366 is not set -CONFIG_BLK_DEV_IDE=m # CONFIG_BLK_DEV_IDECD is not set # CONFIG_BLK_DEV_IDECS is not set CONFIG_BLK_DEV_IDEDISK=m -CONFIG_BLK_DEV_IDEDMA=y # CONFIG_BLK_DEV_IDEDMA_FORCED is not set CONFIG_BLK_DEV_IDEDMA_PCI=y +CONFIG_BLK_DEV_IDEDMA=y # CONFIG_BLK_DEV_IDEFLOPPY is not set +CONFIG_BLK_DEV_IDE=m CONFIG_BLK_DEV_IDEPCI=y +# CONFIG_BLK_DEV_IDE_SATA is not set # CONFIG_BLK_DEV_IDESCSI is not set # CONFIG_BLK_DEV_IDETAPE is not set -# CONFIG_BLK_DEV_IDE_SATA is not set # CONFIG_BLK_DEV_ISAPNP is not set # CONFIG_BLK_DEV_NS87415 is not set CONFIG_BLK_DEV_OFFBOARD=y # CONFIG_BLK_DEV_OPTI621 is not set -CONFIG_BLK_DEV_PDC202XX=y # CONFIG_BLK_DEV_PDC202XX_NEW is not set CONFIG_BLK_DEV_PDC202XX_OLD=m +CONFIG_BLK_DEV_PDC202XX=y # CONFIG_BLK_DEV_PIIX is not set # CONFIG_BLK_DEV_RZ1000 is not set # CONFIG_BLK_DEV_SC1200 is not set @@ -79,7 +79,6 @@ CONFIG_BLK_DEV_PDC202XX_OLD=m # CONFIG_BLK_DEV_TRIFLEX is not set # CONFIG_BLK_DEV_TRM290 is not set # CONFIG_BLK_DEV_VIA82CXXX is not set -CONFIG_BLUEZ=m CONFIG_BLUEZ_BNEP=m CONFIG_BLUEZ_BNEP_MC_FILTER=y CONFIG_BLUEZ_BNEP_PROTO_FILTER=y @@ -88,21 +87,22 @@ CONFIG_BLUEZ_BNEP_PROTO_FILTER=y # CONFIG_BLUEZ_HCIBT3C is not set # CONFIG_BLUEZ_HCIBTUART is not set # CONFIG_BLUEZ_HCIDTL1 is not set -CONFIG_BLUEZ_HCIUART=m -CONFIG_BLUEZ_HCIUART_BCSP=y CONFIG_BLUEZ_HCIUART_BCSP_TXCRC=y +CONFIG_BLUEZ_HCIUART_BCSP=y CONFIG_BLUEZ_HCIUART_H4=y +CONFIG_BLUEZ_HCIUART=m CONFIG_BLUEZ_HCIUSB=m CONFIG_BLUEZ_HCIUSB_SCO=y # CONFIG_BLUEZ_HCIVHCI is not set CONFIG_BLUEZ_L2CAP=m +CONFIG_BLUEZ=m CONFIG_BLUEZ_RFCOMM=m CONFIG_BLUEZ_RFCOMM_TTY=y CONFIG_BLUEZ_SCO=m # CONFIG_BPQETHER is not set CONFIG_CARDBUS=y -CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 init=/etc/preinit noinitrd console=ttyS0,115200" # CONFIG_CMDLINE_BOOL is not set +CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 init=/etc/preinit noinitrd console=ttyS0,115200" CONFIG_CRC32=y # CONFIG_CS89x0 is not set # CONFIG_DE4X5 is not set @@ -123,8 +123,8 @@ CONFIG_HAMRADIO=y # CONFIG_HP100 is not set # CONFIG_HPT34X_AUTODMA is not set # CONFIG_I2C_PARPORT is not set -# CONFIG_I2O is not set # CONFIG_I2O_BLOCK is not set +# CONFIG_I2O is not set # CONFIG_I2O_LAN is not set # CONFIG_I2O_PCI is not set # CONFIG_I2O_PROC is not set @@ -133,7 +133,7 @@ CONFIG_HAMRADIO=y # CONFIG_I82092 is not set # CONFIG_I82365 is not set # CONFIG_IB700_WDT is not set -CONFIG_IDE=m +# CONFIG_IDE_CHIPSETS is not set # CONFIG_IDEDISK_MULTI_MODE is not set CONFIG_IDEDISK_STROKE=y CONFIG_IDEDMA_AUTO=y @@ -141,8 +141,8 @@ CONFIG_IDEDMA_IVB=y # CONFIG_IDEDMA_ONLYDISK is not set CONFIG_IDEDMA_PCI_AUTO=y # CONFIG_IDEDMA_PCI_WIP is not set +CONFIG_IDE=m # CONFIG_IDEPCI_SHARE_IRQ is not set -# CONFIG_IDE_CHIPSETS is not set # CONFIG_IDE_TASK_IOCTL is not set # CONFIG_IEEE1394 is not set # CONFIG_IP_VS is not set @@ -159,38 +159,38 @@ CONFIG_MIPS_BRCM=y CONFIG_MKISS=m CONFIG_MSDOS_FS=m CONFIG_MTD_BCM947XX=y -CONFIG_MTD_CFI_SSTSTD=y CONFIG_MTD_CFI_B1=y +CONFIG_MTD_CFI_SSTSTD=y CONFIG_MTD_SFLASH=y # CONFIG_NATSEMI is not set # CONFIG_NE2K_PCI is not set # CONFIG_NE3210 is not set -# CONFIG_NETROM is not set CONFIG_NET_PCI=y # CONFIG_NET_PCMCIA is not set +# CONFIG_NETROM is not set CONFIG_NET_SCH_ESFQ=m CONFIG_NET_WIRELESS=y CONFIG_NEW_IRQ=y CONFIG_NEW_TIME_C=y -CONFIG_PARPORT=m # CONFIG_PARPORT_1284 is not set # CONFIG_PARPORT_AMIGA is not set # CONFIG_PARPORT_ATARI is not set # CONFIG_PARPORT_GSC is not set # CONFIG_PARPORT_IP22 is not set +CONFIG_PARPORT=m # CONFIG_PARPORT_MFC3 is not set # CONFIG_PARPORT_OTHER is not set # CONFIG_PARPORT_PC is not set CONFIG_PARPORT_SPLINK=m # CONFIG_PARPORT_SUNBPP is not set -CONFIG_PCI=y CONFIG_PCI_AUTO=y # CONFIG_PCI_HERMES is not set # CONFIG_PCI_NAMES is not set # CONFIG_PCI_NEW is not set -CONFIG_PCMCIA=m +CONFIG_PCI=y # CONFIG_PCMCIA_ATMEL is not set # CONFIG_PCMCIA_HERMES is not set +CONFIG_PCMCIA=m CONFIG_PCMCIA_SERIAL_CS=m # CONFIG_PCNET32 is not set # CONFIG_PCWATCHDOG is not set @@ -218,13 +218,11 @@ CONFIG_PRINTER=m # CONFIG_SCSI_QLOGIC_1280 is not set # CONFIG_SCSI_QLOGIC_FC is not set # CONFIG_SCSI_QLOGIC_ISP is not set -# CONFIG_SCSI_SYM53C8XX is not set # CONFIG_SCSI_SYM53C8XX_2 is not set +# CONFIG_SCSI_SYM53C8XX is not set # CONFIG_SCx200_WDT is not set # CONFIG_SIS900 is not set CONFIG_SOFT_WATCHDOG=m -CONFIG_SOUND=m -# CONFIG_SOUNDMODEM is not set # CONFIG_SOUND_AD1980 is not set # CONFIG_SOUND_ALI5455 is not set # CONFIG_SOUND_BT878 is not set @@ -237,8 +235,10 @@ CONFIG_SOUND=m # CONFIG_SOUND_FORTE is not set # CONFIG_SOUND_FUSION is not set # CONFIG_SOUND_ICH is not set -# CONFIG_SOUND_MAESTRO is not set +CONFIG_SOUND=m # CONFIG_SOUND_MAESTRO3 is not set +# CONFIG_SOUND_MAESTRO is not set +# CONFIG_SOUNDMODEM is not set # CONFIG_SOUND_MSNDCLAS is not set # CONFIG_SOUND_MSNDPIN is not set # CONFIG_SOUND_OSS is not set @@ -257,7 +257,6 @@ CONFIG_SOUND=m # CONFIG_TMD_HERMES is not set # CONFIG_TULIP is not set # CONFIG_TUNER_3036 is not set -CONFIG_USB=m CONFIG_USB_ACM=m # CONFIG_USB_AIPTEK is not set CONFIG_USB_AUDIO=m @@ -273,9 +272,9 @@ CONFIG_USB_DEVICEFS=y # CONFIG_USB_DSBR is not set CONFIG_USB_EHCI_HCD=m # CONFIG_USB_EMI26 is not set -# CONFIG_USB_HID is not set # CONFIG_USB_HIDDEV is not set # CONFIG_USB_HIDINPUT is not set +# CONFIG_USB_HID is not set # CONFIG_USB_HPUSBSCSI is not set # CONFIG_USB_IBMCAM is not set # CONFIG_USB_KAWETH is not set @@ -283,6 +282,7 @@ CONFIG_USB_EHCI_HCD=m # CONFIG_USB_KBTAB is not set # CONFIG_USB_KONICAWC is not set # CONFIG_USB_LCD is not set +CONFIG_USB=m # CONFIG_USB_MDC800 is not set # CONFIG_USB_MICROTEK is not set # CONFIG_USB_MIDI is not set @@ -297,7 +297,6 @@ CONFIG_USB_PWC=m # CONFIG_USB_RTL8150 is not set # CONFIG_USB_SCANNER is not set # CONFIG_USB_SE401 is not set -CONFIG_USB_SERIAL=m CONFIG_USB_SERIAL_BELKIN=m # CONFIG_USB_SERIAL_CYBERJACK is not set # CONFIG_USB_SERIAL_DEBUG is not set @@ -313,18 +312,19 @@ CONFIG_USB_SERIAL_KEYSPAN=m CONFIG_USB_SERIAL_KEYSPAN_MPR=y # CONFIG_USB_SERIAL_KEYSPAN_PDA is not set CONFIG_USB_SERIAL_KEYSPAN_USA18X=y -CONFIG_USB_SERIAL_KEYSPAN_USA19=y CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y CONFIG_USB_SERIAL_KEYSPAN_USA19W=y -CONFIG_USB_SERIAL_KEYSPAN_USA28=y -CONFIG_USB_SERIAL_KEYSPAN_USA28X=y +CONFIG_USB_SERIAL_KEYSPAN_USA19=y CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y -CONFIG_USB_SERIAL_KEYSPAN_USA49W=y +CONFIG_USB_SERIAL_KEYSPAN_USA28X=y +CONFIG_USB_SERIAL_KEYSPAN_USA28=y CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y +CONFIG_USB_SERIAL_KEYSPAN_USA49W=y # CONFIG_USB_SERIAL_KLSI is not set # CONFIG_USB_SERIAL_KOBIL_SCT is not set +CONFIG_USB_SERIAL=m CONFIG_USB_SERIAL_MCT_U232=m # CONFIG_USB_SERIAL_OMNINET is not set CONFIG_USB_SERIAL_PL2303=m @@ -332,7 +332,6 @@ CONFIG_USB_SERIAL_PL2303=m CONFIG_USB_SERIAL_VISOR=m # CONFIG_USB_SERIAL_WHITEHEAT is not set # CONFIG_USB_SERIAL_XIRCOM is not set -CONFIG_USB_STORAGE=m CONFIG_USB_STORAGE_DATAFAB=y # CONFIG_USB_STORAGE_DEBUG is not set CONFIG_USB_STORAGE_DPCM=y @@ -340,12 +339,13 @@ CONFIG_USB_STORAGE_FREECOM=y CONFIG_USB_STORAGE_HP8200e=y # CONFIG_USB_STORAGE_ISD200 is not set CONFIG_USB_STORAGE_JUMPSHOT=y +CONFIG_USB_STORAGE=m CONFIG_USB_STORAGE_SDDR09=y CONFIG_USB_STORAGE_SDDR55=y # CONFIG_USB_STV680 is not set # CONFIG_USB_TIGL is not set -CONFIG_USB_UHCI=m CONFIG_USB_UHCI_ALT=m +CONFIG_USB_UHCI=m # CONFIG_USB_USS720 is not set # CONFIG_USB_VICAM is not set # CONFIG_USB_W9968CF is not set @@ -362,9 +362,9 @@ CONFIG_VIDEO_DEV=m CONFIG_VIDEO_PROC_FS=y # CONFIG_VIDEO_SAA5249 is not set # CONFIG_VIDEO_STRADIS is not set -# CONFIG_VIDEO_ZORAN is not set # CONFIG_VIDEO_ZORAN_BUZ is not set # CONFIG_VIDEO_ZORAN_DC10 is not set +# CONFIG_VIDEO_ZORAN is not set # CONFIG_VIDEO_ZORAN_LML33 is not set # CONFIG_VIDEO_ZR36120 is not set # CONFIG_W83877F_WDT is not set diff --git a/target/linux/brcm47xx/config-2.6.28 b/target/linux/brcm47xx/config-2.6.28 index 3c0d16506..389ae5e18 100644 --- a/target/linux/brcm47xx/config-2.6.28 +++ b/target/linux/brcm47xx/config-2.6.28 @@ -8,13 +8,13 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y # CONFIG_ARPD is not set -CONFIG_B44=y -CONFIG_B44_PCI=y -CONFIG_B44_PCICORE_AUTOSELECT=y CONFIG_B44_PCI_AUTOSELECT=y +CONFIG_B44_PCICORE_AUTOSELECT=y +CONFIG_B44_PCI=y +CONFIG_B44=y CONFIG_BASE_SMALL=0 -CONFIG_BCM47XX=y CONFIG_BCM47XX_WDT=y +CONFIG_BCM47XX=y CONFIG_BITREVERSE=y # CONFIG_BSD_DISKLABEL is not set # CONFIG_BSD_PROCESS_ACCT is not set @@ -28,9 +28,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y CONFIG_CPU_LITTLE_ENDIAN=y # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32_R1=y # CONFIG_CPU_MIPS32_R2 is not set +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR1=y @@ -57,8 +57,8 @@ CONFIG_DEVPORT=y # CONFIG_DM9000 is not set CONFIG_DMA_NEED_PCI_MAP_STATE=y CONFIG_DMA_NONCOHERENT=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_NEXT_BIT=y CONFIG_GENERIC_GPIO=y @@ -74,8 +74,8 @@ CONFIG_HAVE_IDE=y CONFIG_HAVE_OPROFILE=y CONFIG_HW_HAS_PCI=y CONFIG_HW_RANDOM=y -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set # CONFIG_IDE is not set @@ -94,7 +94,6 @@ CONFIG_LEDS_GPIO=y # CONFIG_MACH_TX49XX is not set # CONFIG_MACH_VR41XX is not set # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MACHINE is not set @@ -103,14 +102,15 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y CONFIG_MTD_BCM47XX=y # CONFIG_NATSEMI is not set # CONFIG_NO_IOPORT is not set # CONFIG_NXP_STB220 is not set # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PCI=y CONFIG_PCI_DOMAINS=y +CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set @@ -139,20 +139,20 @@ CONFIG_SERIAL_8250_SHARE_IRQ=y # CONFIG_SIBYTE_RHONE is not set # CONFIG_SIBYTE_SENTOSA is not set # CONFIG_SIBYTE_SWARM is not set -CONFIG_SSB=y CONFIG_SSB_B43_PCI_BRIDGE=y CONFIG_SSB_DEBUG=y CONFIG_SSB_DRIVER_EXTIF=y CONFIG_SSB_DRIVER_GIGE=y CONFIG_SSB_DRIVER_MIPS=y -CONFIG_SSB_DRIVER_PCICORE=y CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y +CONFIG_SSB_DRIVER_PCICORE=y CONFIG_SSB_EMBEDDED=y CONFIG_SSB_PCICORE_HOSTMODE=y -CONFIG_SSB_PCIHOST=y CONFIG_SSB_PCIHOST_POSSIBLE=y +CONFIG_SSB_PCIHOST=y CONFIG_SSB_SERIAL=y CONFIG_SSB_SPROM=y +CONFIG_SSB=y CONFIG_SYS_HAS_CPU_MIPS32_R1=y CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y diff --git a/target/linux/brcm47xx/config-2.6.30 b/target/linux/brcm47xx/config-2.6.30 index a6a16c6d1..8305f26e5 100644 --- a/target/linux/brcm47xx/config-2.6.30 +++ b/target/linux/brcm47xx/config-2.6.30 @@ -7,20 +7,20 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y # CONFIG_ARPD is not set -CONFIG_B44=y -CONFIG_B44_PCI=y -CONFIG_B44_PCICORE_AUTOSELECT=y CONFIG_B44_PCI_AUTOSELECT=y +CONFIG_B44_PCICORE_AUTOSELECT=y +CONFIG_B44_PCI=y +CONFIG_B44=y CONFIG_BASE_SMALL=0 -CONFIG_BCM47XX=y CONFIG_BCM47XX_WDT=y +CONFIG_BCM47XX=y # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y # CONFIG_BSD_PROCESS_ACCT is not set # CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set -CONFIG_CEVT_R4K=y CONFIG_CEVT_R4K_LIB=y +CONFIG_CEVT_R4K=y CONFIG_CFE=y CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200" # CONFIG_CPU_BIG_ENDIAN is not set @@ -30,9 +30,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y CONFIG_CPU_LITTLE_ENDIAN=y # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32_R1=y # CONFIG_CPU_MIPS32_R2 is not set +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR1=y @@ -60,15 +60,15 @@ CONFIG_CRYPTO_HASH2=y CONFIG_CRYPTO_MANAGER2=y CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_WORKQUEUE=y -CONFIG_CSRC_R4K=y CONFIG_CSRC_R4K_LIB=y +CONFIG_CSRC_R4K=y CONFIG_DECOMPRESS_LZMA=y CONFIG_DEVPORT=y # CONFIG_DM9000 is not set CONFIG_DMA_NEED_PCI_MAP_STATE=y CONFIG_DMA_NONCOHERENT=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -86,8 +86,8 @@ CONFIG_HAVE_MLOCK=y CONFIG_HAVE_OPROFILE=y CONFIG_HW_HAS_PCI=y CONFIG_HW_RANDOM=y -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set CONFIG_INITRAMFS_SOURCE="" @@ -104,7 +104,6 @@ CONFIG_LEDS_GPIO=y # CONFIG_MACH_TX49XX is not set # CONFIG_MACH_VR41XX is not set # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MACHINE is not set @@ -113,14 +112,15 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y CONFIG_MTD_BCM47XX=y # CONFIG_NATSEMI is not set # CONFIG_NO_IOPORT is not set # CONFIG_NXP_STB220 is not set # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PCI=y CONFIG_PCI_DOMAINS=y +CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set @@ -149,20 +149,20 @@ CONFIG_SERIAL_8250_SHARE_IRQ=y # CONFIG_SIBYTE_SENTOSA is not set # CONFIG_SIBYTE_SWARM is not set # CONFIG_SLOW_WORK is not set -CONFIG_SSB=y CONFIG_SSB_B43_PCI_BRIDGE=y CONFIG_SSB_DEBUG=y CONFIG_SSB_DRIVER_EXTIF=y CONFIG_SSB_DRIVER_GIGE=y CONFIG_SSB_DRIVER_MIPS=y -CONFIG_SSB_DRIVER_PCICORE=y CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y +CONFIG_SSB_DRIVER_PCICORE=y CONFIG_SSB_EMBEDDED=y CONFIG_SSB_PCICORE_HOSTMODE=y -CONFIG_SSB_PCIHOST=y CONFIG_SSB_PCIHOST_POSSIBLE=y +CONFIG_SSB_PCIHOST=y CONFIG_SSB_SERIAL=y CONFIG_SSB_SPROM=y +CONFIG_SSB=y CONFIG_SYS_HAS_CPU_MIPS32_R1=y CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y diff --git a/target/linux/brcm47xx/config-2.6.31 b/target/linux/brcm47xx/config-2.6.31 index 5bcf60ccc..e5bfa7e48 100644 --- a/target/linux/brcm47xx/config-2.6.31 +++ b/target/linux/brcm47xx/config-2.6.31 @@ -10,20 +10,20 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y # CONFIG_ARPD is not set -CONFIG_B44=y -CONFIG_B44_PCI=y -CONFIG_B44_PCICORE_AUTOSELECT=y CONFIG_B44_PCI_AUTOSELECT=y +CONFIG_B44_PCICORE_AUTOSELECT=y +CONFIG_B44_PCI=y +CONFIG_B44=y CONFIG_BASE_SMALL=0 -CONFIG_BCM47XX=y CONFIG_BCM47XX_WDT=y +CONFIG_BCM47XX=y # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y # CONFIG_BSD_PROCESS_ACCT is not set # CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set -CONFIG_CEVT_R4K=y CONFIG_CEVT_R4K_LIB=y +CONFIG_CEVT_R4K=y CONFIG_CFE=y CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200" CONFIG_CONSTRUCTORS=y @@ -34,9 +34,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y CONFIG_CPU_LITTLE_ENDIAN=y # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32_R1=y # CONFIG_CPU_MIPS32_R2 is not set +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR1=y @@ -58,16 +58,16 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y # CONFIG_CPU_TX39XX is not set # CONFIG_CPU_TX49XX is not set # CONFIG_CPU_VR41XX is not set -CONFIG_CSRC_R4K=y CONFIG_CSRC_R4K_LIB=y +CONFIG_CSRC_R4K=y CONFIG_DECOMPRESS_LZMA=y CONFIG_DEVPORT=y # CONFIG_DM9000 is not set CONFIG_DMA_NEED_PCI_MAP_STATE=y CONFIG_DMA_NONCOHERENT=y # CONFIG_FSNOTIFY is not set -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -81,13 +81,13 @@ CONFIG_HAS_IOPORT=y CONFIG_HAVE_ARCH_KGDB=y # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set CONFIG_HAVE_IDE=y -CONFIG_HAVE_MLOCK=y CONFIG_HAVE_MLOCKED_PAGE_BIT=y +CONFIG_HAVE_MLOCK=y CONFIG_HAVE_OPROFILE=y CONFIG_HW_HAS_PCI=y CONFIG_HW_RANDOM=y -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set CONFIG_INITRAMFS_SOURCE="" @@ -105,7 +105,6 @@ CONFIG_MAC80211_DEFAULT_PS_VALUE=0 # CONFIG_MACH_TX49XX is not set # CONFIG_MACH_VR41XX is not set # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set # CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 @@ -115,14 +114,15 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y CONFIG_MTD_BCM47XX=y # CONFIG_NATSEMI is not set # CONFIG_NO_IOPORT is not set # CONFIG_NXP_STB220 is not set # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PCI=y CONFIG_PCI_DOMAINS=y +CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set @@ -151,20 +151,20 @@ CONFIG_SERIAL_8250_SHARE_IRQ=y # CONFIG_SIBYTE_SENTOSA is not set # CONFIG_SIBYTE_SWARM is not set # CONFIG_SLOW_WORK is not set -CONFIG_SSB=y CONFIG_SSB_B43_PCI_BRIDGE=y CONFIG_SSB_DEBUG=y CONFIG_SSB_DRIVER_EXTIF=y CONFIG_SSB_DRIVER_GIGE=y CONFIG_SSB_DRIVER_MIPS=y -CONFIG_SSB_DRIVER_PCICORE=y CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y +CONFIG_SSB_DRIVER_PCICORE=y CONFIG_SSB_EMBEDDED=y CONFIG_SSB_PCICORE_HOSTMODE=y -CONFIG_SSB_PCIHOST=y CONFIG_SSB_PCIHOST_POSSIBLE=y +CONFIG_SSB_PCIHOST=y CONFIG_SSB_SERIAL=y CONFIG_SSB_SPROM=y +CONFIG_SSB=y CONFIG_SYS_HAS_CPU_MIPS32_R1=y CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y diff --git a/target/linux/brcm63xx/config-2.6.30 b/target/linux/brcm63xx/config-2.6.30 index 3e692652f..f02683b85 100644 --- a/target/linux/brcm63xx/config-2.6.30 +++ b/target/linux/brcm63xx/config-2.6.30 @@ -7,11 +7,10 @@ CONFIG_ARCH_REQUIRE_GPIOLIB=y # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_AUDIT=y CONFIG_AUDIT_GENERIC=y +CONFIG_AUDIT=y CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set -CONFIG_BCM63XX=y CONFIG_BCM63XX_CPU_6338=y CONFIG_BCM63XX_CPU_6345=y CONFIG_BCM63XX_CPU_6348=y @@ -19,6 +18,7 @@ CONFIG_BCM63XX_CPU_6358=y CONFIG_BCM63XX_ENET=y CONFIG_BCM63XX_PHY=y CONFIG_BCM63XX_WDT=y +CONFIG_BCM63XX=y CONFIG_BINARY_PRINTF=y CONFIG_BITREVERSE=y CONFIG_BLK_DEV_IO_TRACE=y @@ -28,8 +28,8 @@ CONFIG_BSD_PROCESS_ACCT_V3=y # CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CEVT_R4K=y CONFIG_CEVT_R4K_LIB=y +CONFIG_CEVT_R4K=y CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200" CONFIG_CPU_BIG_ENDIAN=y # CONFIG_CPU_CAVIUM_OCTEON is not set @@ -38,9 +38,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y # CONFIG_CPU_LITTLE_ENDIAN is not set # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32_R1=y # CONFIG_CPU_MIPS32_R2 is not set +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR1=y @@ -69,8 +69,8 @@ CONFIG_CRYPTO_HASH2=y CONFIG_CRYPTO_MANAGER2=y CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_WORKQUEUE=y -CONFIG_CSRC_R4K=y CONFIG_CSRC_R4K_LIB=y +CONFIG_CSRC_R4K=y CONFIG_DECOMPRESS_LZMA=y CONFIG_DEVPORT=y # CONFIG_DM9000 is not set @@ -80,15 +80,15 @@ CONFIG_EARLY_PRINTK=y CONFIG_ELF_CORE=y CONFIG_FIRMWARE_IN_KERNEL=y # CONFIG_FTRACE_STARTUP_TEST is not set -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y CONFIG_GENERIC_GPIO=y CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y -CONFIG_GPIOLIB=y CONFIG_GPIO_DEVICE=y +CONFIG_GPIOLIB=y CONFIG_GPIO_SYSFS=y # CONFIG_HAMRADIO is not set CONFIG_HARDWARE_WATCHPOINTS=y @@ -102,13 +102,13 @@ CONFIG_HAVE_MLOCK=y CONFIG_HAVE_OPROFILE=y CONFIG_HW_HAS_PCI=y CONFIG_HW_RANDOM=y -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set CONFIG_INITRAMFS_SOURCE="" -CONFIG_INOTIFY=y CONFIG_INOTIFY_USER=y +CONFIG_INOTIFY=y CONFIG_IP_PIMSM_V1=y CONFIG_IP_PIMSM_V2=y CONFIG_IRQ_CPU=y @@ -126,7 +126,6 @@ CONFIG_LEDS_GPIO=y # CONFIG_MACH_VR41XX is not set CONFIG_MAGIC_SYSRQ=y # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set # CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 @@ -136,6 +135,7 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y CONFIG_MODULE_FORCE_LOAD=y CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_MTD_BCM963XX=y @@ -148,33 +148,33 @@ CONFIG_MTD_CMDLINE_PARTS=y # CONFIG_MTD_COMPLEX_MAPPINGS is not set CONFIG_MTD_CONCAT=y CONFIG_MTD_JEDECPROBE=y -CONFIG_MTD_REDBOOT_PARTS=y CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED=y +CONFIG_MTD_REDBOOT_PARTS=y # CONFIG_NATSEMI is not set # CONFIG_NET_DROP_MONITOR is not set -CONFIG_NOP_TRACER=y # CONFIG_NO_IOPORT is not set +CONFIG_NOP_TRACER=y # CONFIG_NXP_STB220 is not set # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PCI=y CONFIG_PCI_DOMAINS=y +CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set # CONFIG_PNX8550_JBS is not set # CONFIG_PNX8550_STB810 is not set -CONFIG_POSIX_MQUEUE=y CONFIG_POSIX_MQUEUE_SYSCTL=y +CONFIG_POSIX_MQUEUE=y # CONFIG_PROBE_INITRD_HEADER is not set CONFIG_RELAY=y CONFIG_RING_BUFFER=y CONFIG_SCHED_OMIT_FRAME_POINTER=y # CONFIG_SCSI_DMA is not set # CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_BCM63XX=y CONFIG_SERIAL_BCM63XX_CONSOLE=y +CONFIG_SERIAL_BCM63XX=y # CONFIG_SGI_IP22 is not set # CONFIG_SGI_IP27 is not set # CONFIG_SGI_IP28 is not set @@ -189,14 +189,14 @@ CONFIG_SERIAL_BCM63XX_CONSOLE=y # CONFIG_SIBYTE_SWARM is not set # CONFIG_SLOW_WORK is not set CONFIG_SQUASHFS_EMBEDDED=y -CONFIG_SSB=y CONFIG_SSB_B43_PCI_BRIDGE=y # CONFIG_SSB_DRIVER_MIPS is not set -CONFIG_SSB_DRIVER_PCICORE=y CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y -CONFIG_SSB_PCIHOST=y +CONFIG_SSB_DRIVER_PCICORE=y CONFIG_SSB_PCIHOST_POSSIBLE=y +CONFIG_SSB_PCIHOST=y CONFIG_SSB_SPROM=y +CONFIG_SSB=y CONFIG_STACKTRACE=y CONFIG_SWAP_IO_SPACE=y CONFIG_SYS_HAS_CPU_MIPS32_R1=y @@ -207,8 +207,8 @@ CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y # CONFIG_TC35815 is not set CONFIG_TICK_ONESHOT=y CONFIG_TRACEPOINTS=y -CONFIG_TRACING=y CONFIG_TRACING_SUPPORT=y +CONFIG_TRACING=y CONFIG_TRAD_SIGNALS=y CONFIG_USB_EHCI_BIG_ENDIAN_MMIO=y CONFIG_USB_OHCI_BIG_ENDIAN_DESC=y diff --git a/target/linux/cobalt/config-default b/target/linux/cobalt/config-default index 2396808b9..bab68e219 100644 --- a/target/linux/cobalt/config-default +++ b/target/linux/cobalt/config-default @@ -7,10 +7,10 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y # CONFIG_ARPD is not set -CONFIG_ATA=y # CONFIG_ATA_NONSTANDARD is not set # CONFIG_ATA_PIIX is not set CONFIG_ATA_SFF=y +CONFIG_ATA=y CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set # CONFIG_BINARY_PRINTF is not set @@ -25,10 +25,10 @@ CONFIG_BLOCK_COMPAT=y # CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set CONFIG_CEVT_GT641XX=y -CONFIG_CEVT_R4K=y CONFIG_CEVT_R4K_LIB=y -CONFIG_COMPAT=y +CONFIG_CEVT_R4K=y CONFIG_COMPAT_BRK=y +CONFIG_COMPAT=y CONFIG_CONSOLE_TRANSLATIONS=y # CONFIG_CPU_BIG_ENDIAN is not set # CONFIG_CPU_CAVIUM_OCTEON is not set @@ -59,8 +59,8 @@ CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y # CONFIG_CPU_TX49XX is not set # CONFIG_CPU_VR41XX is not set CONFIG_CRC16=y -CONFIG_CSRC_R4K=y CONFIG_CSRC_R4K_LIB=y +CONFIG_CSRC_R4K=y CONFIG_DE2104X=y # CONFIG_DE4X5 is not set # CONFIG_DEBUG_FS is not set @@ -75,15 +75,15 @@ CONFIG_DUMMY_CONSOLE=y CONFIG_EARLY_PRINTK=y CONFIG_ELF_CORE=y CONFIG_ENABLE_MUST_CHECK=y -CONFIG_FB=y CONFIG_FB_COBALT=y +CONFIG_FB=y # CONFIG_FIRMWARE_EDID is not set CONFIG_FIRMWARE_IN_KERNEL=y # CONFIG_FRAMEBUFFER_CONSOLE is not set CONFIG_FS_POSIX_ACL=y CONFIG_GENERIC_ACL=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -104,18 +104,18 @@ CONFIG_HID_SUPPORT=y CONFIG_HW_CONSOLE=y CONFIG_HW_HAS_PCI=y # CONFIG_HW_RANDOM is not set -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set CONFIG_I8253=y CONFIG_I8259=y -CONFIG_INOTIFY=y CONFIG_INOTIFY_USER=y -CONFIG_INPUT=y +CONFIG_INOTIFY=y CONFIG_INPUT_COBALT_BTNS=y CONFIG_INPUT_EVDEV=y CONFIG_INPUT_POLLDEV=y +CONFIG_INPUT=y # CONFIG_INPUT_YEALINK is not set # CONFIG_IP_ADVANCED_ROUTER is not set # CONFIG_IP_MULTICAST is not set @@ -129,8 +129,8 @@ CONFIG_LEDS_COBALT_RAQ=y # CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set # CONFIG_LEDS_TRIGGER_TIMER is not set -CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LEGACY_PTYS=y # CONFIG_LEMOTE_FULONG is not set # CONFIG_LOGO is not set # CONFIG_MACH_ALCHEMY is not set @@ -141,7 +141,6 @@ CONFIG_LEGACY_PTY_COUNT=256 # CONFIG_MACH_VR41XX is not set # CONFIG_MII is not set # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y CONFIG_MIPS32_COMPAT=y CONFIG_MIPS32_N32=y CONFIG_MIPS32_O32=y @@ -154,11 +153,12 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y # CONFIG_MISC_DEVICES is not set # CONFIG_MTD_BLOCK is not set # CONFIG_MTD_BLOCK_RO is not set -# CONFIG_MTD_CFI is not set # CONFIG_MTD_CFI_INTELEXT is not set +# CONFIG_MTD_CFI is not set # CONFIG_MTD_COMPLEX_MAPPINGS is not set CONFIG_MTD_JEDECPROBE=y CONFIG_MTD_PHYSMAP=y @@ -172,11 +172,11 @@ CONFIG_NET_TULIP=y CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PARTITION_ADVANCED is not set CONFIG_PATA_VIA=y -CONFIG_PCI=y CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y CONFIG_PCI_GT64XXX_PCI0=y CONFIG_PCI_LEGACY=y +CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y CONFIG_PHYS_ADDR_T_64BIT=y # CONFIG_PMC_MSP is not set @@ -190,9 +190,9 @@ CONFIG_RTC_CLASS=y CONFIG_RTC_INTF_DEV_UIE_EMUL=y CONFIG_SATA_PMP=y CONFIG_SCHED_OMIT_FRAME_POINTER=y -CONFIG_SCSI=y # CONFIG_SCSI_LOWLEVEL is not set # CONFIG_SCSI_MULTI_LUN is not set +CONFIG_SCSI=y CONFIG_SECCOMP=y # CONFIG_SERIAL_8250_EXTENDED is not set CONFIG_SERIAL_8250_NR_UARTS=4 @@ -212,28 +212,28 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=4 # CONFIG_SLAB is not set # CONFIG_SLOW_WORK is not set CONFIG_SLUB=y -CONFIG_SYSVIPC_COMPAT=y CONFIG_SYS_HAS_CPU_NEVADA=y CONFIG_SYS_HAS_EARLY_PRINTK=y CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y +CONFIG_SYSVIPC_COMPAT=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TRACING_SUPPORT=y -CONFIG_TULIP=y CONFIG_TULIP_MMIO=y CONFIG_TULIP_MWI=y -CONFIG_TULIP_NAPI=y CONFIG_TULIP_NAPI_HW_MITIGATION=y +CONFIG_TULIP_NAPI=y +CONFIG_TULIP=y # CONFIG_ULI526X is not set CONFIG_USB_SUPPORT=y # CONFIG_VGA_CONSOLE is not set # CONFIG_VLAN_8021Q is not set CONFIG_VM_EVENT_COUNTERS=y -CONFIG_VT=y CONFIG_VT_CONSOLE=y CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_VT=y # CONFIG_WATCHDOG is not set # CONFIG_WINBOND_840 is not set # CONFIG_WLAN_80211 is not set diff --git a/target/linux/coldfire/config-default b/target/linux/coldfire/config-default index 5596fa995..c26ec6738 100644 --- a/target/linux/coldfire/config-default +++ b/target/linux/coldfire/config-default @@ -15,13 +15,13 @@ CONFIG_BITREVERSE=y CONFIG_BOUNCE=y CONFIG_CFV4E=y CONFIG_CLASSIC_RCU=y -CONFIG_COLDFIRE=y # CONFIG_COLDFIRE_EDMA is not set # CONFIG_COLDFIRE_WATCHDOG is not set +CONFIG_COLDFIRE=y # CONFIG_DEBUG_BUGVERBOSE is not set -CONFIG_FEC_548x=y CONFIG_FEC_548x_AUTO_NEGOTIATION=y CONFIG_FEC_548x_ENABLE_FEC2=y +CONFIG_FEC_548x=y # CONFIG_GENERIC_CLOCKEVENTS is not set CONFIG_GENERIC_IOMAP=y # CONFIG_GENERIC_TIME is not set @@ -46,8 +46,8 @@ CONFIG_INITRAMFS_SOURCE="" # CONFIG_M5475DFE is not set # CONFIG_M5475EFE is not set # CONFIG_M5475FFE is not set -# CONFIG_M547X is not set CONFIG_M547X_8X=y +# CONFIG_M547X is not set # CONFIG_M5485AFE is not set # CONFIG_M5485BFE is not set CONFIG_M5485CFE=y @@ -59,8 +59,8 @@ CONFIG_M548X=y # CONFIG_M68030 is not set # CONFIG_M68040 is not set # CONFIG_M68060 is not set -CONFIG_M68K=y # CONFIG_M68KFPU_EMU is not set +CONFIG_M68K=y # CONFIG_MAC is not set CONFIG_MCD_DMA=y CONFIG_MCFCLK=200000000 @@ -74,12 +74,12 @@ CONFIG_MTD_CFI_ADV_OPTIONS=y CONFIG_NEED_MULTIPLE_NODES=y # CONFIG_NETDEV_1000 is not set # CONFIG_NET_VENDOR_3COM is not set -CONFIG_NOR_FLASH_BASE=0xE0000000 # CONFIG_NO_DMA is not set # CONFIG_NO_IOPORT is not set -CONFIG_PCI=y -# CONFIG_PCIPCWATCHDOG is not set +CONFIG_NOR_FLASH_BASE=0xE0000000 CONFIG_PCI_LEGACY=y +# CONFIG_PCIPCWATCHDOG is not set +CONFIG_PCI=y # CONFIG_PROC_HARDWARE is not set # CONFIG_Q40 is not set # CONFIG_R6040 is not set @@ -88,8 +88,8 @@ CONFIG_PCI_LEGACY=y CONFIG_SDRAM_BASE=0x00000000 CONFIG_SDRAM_SIZE=0x04000000 # CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_COLDFIRE=y # CONFIG_SERIAL_COLDFIRE_IRDA is not set +CONFIG_SERIAL_COLDFIRE=y # CONFIG_SERIAL_CONSOLE is not set # CONFIG_SERIAL_MCF is not set CONFIG_SINGLE_MEMORY_CHUNK=y diff --git a/target/linux/etrax/config-2.6.30 b/target/linux/etrax/config-2.6.30 index 17aeeee91..e288d6217 100644 --- a/target/linux/etrax/config-2.6.30 +++ b/target/linux/etrax/config-2.6.30 @@ -7,11 +7,10 @@ CONFIG_BITREVERSE=y CONFIG_BOUNCE=y # CONFIG_BRIDGE is not set CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CRIS=y # CONFIG_CRIS_MACH_ARTPEC3 is not set +CONFIG_CRIS=y # CONFIG_ETRAX100LX is not set CONFIG_ETRAX100LX_V2=y -# CONFIG_ETRAXFS is not set CONFIG_ETRAX_ARCH_V10=y # CONFIG_ETRAX_ARCH_V32 is not set CONFIG_ETRAX_AXISFLASHMAP=y @@ -37,9 +36,10 @@ CONFIG_ETRAX_ETHERNET=y CONFIG_ETRAX_FAST_TIMER=y CONFIG_ETRAX_FLASH1_SIZE=0 CONFIG_ETRAX_FLASH_BUSWIDTH=2 +# CONFIG_ETRAXFS is not set CONFIG_ETRAX_GPIO=y -# CONFIG_ETRAX_I2C is not set # CONFIG_ETRAX_I2C_GVC is not set +# CONFIG_ETRAX_I2C is not set # CONFIG_ETRAX_KMALLOCED_MODULES is not set CONFIG_ETRAX_LED1G=2 CONFIG_ETRAX_LED1R=2 @@ -101,25 +101,23 @@ CONFIG_ETRAX_SER3_DTR_RI_DSR_CD_ON_NONE=y # CONFIG_ETRAX_SER3_DTR_RI_DSR_CD_ON_PB is not set CONFIG_ETRAX_SER3_RI_ON_PA_BIT=-1 CONFIG_ETRAX_SER3_RI_ON_PB_BIT=-1 -CONFIG_ETRAX_SERIAL=y # CONFIG_ETRAX_SERIAL_FAST_TIMER is not set # CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST is not set -CONFIG_ETRAX_SERIAL_PORT0=y # CONFIG_ETRAX_SERIAL_PORT0_DMA0_OUT is not set # CONFIG_ETRAX_SERIAL_PORT0_DMA1_IN is not set # CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT is not set # CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN is not set CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_IN=y CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_OUT=y +CONFIG_ETRAX_SERIAL_PORT0=y # CONFIG_ETRAX_SERIAL_PORT1 is not set -CONFIG_ETRAX_SERIAL_PORT2=y CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT=y CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN=y # CONFIG_ETRAX_SERIAL_PORT2_DMA6_OUT is not set # CONFIG_ETRAX_SERIAL_PORT2_DMA7_IN is not set # CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_IN is not set # CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_OUT is not set -CONFIG_ETRAX_SERIAL_PORT3=y +CONFIG_ETRAX_SERIAL_PORT2=y # CONFIG_ETRAX_SERIAL_PORT3_DMA2_OUT is not set # CONFIG_ETRAX_SERIAL_PORT3_DMA3_IN is not set CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT=y @@ -128,7 +126,9 @@ CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN=y # CONFIG_ETRAX_SERIAL_PORT3_DMA9_IN is not set # CONFIG_ETRAX_SERIAL_PORT3_NO_DMA_IN is not set # CONFIG_ETRAX_SERIAL_PORT3_NO_DMA_OUT is not set +CONFIG_ETRAX_SERIAL_PORT3=y CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS=5 +CONFIG_ETRAX_SERIAL=y # CONFIG_ETRAX_SOFT_SHUTDOWN is not set # CONFIG_ETRAX_SYNCHRONOUS_SERIAL is not set # CONFIG_ETRAX_USB_HOST is not set @@ -147,12 +147,12 @@ CONFIG_HAVE_IDE=y CONFIG_HAVE_MLOCK=y # CONFIG_HW_RANDOM is not set # CONFIG_I2C is not set -CONFIG_MTDRAM_ABS_POS=0 -CONFIG_MTDRAM_ERASE_SIZE=128 -CONFIG_MTDRAM_TOTAL_SIZE=0 # CONFIG_MTD_CFI_INTELEXT is not set CONFIG_MTD_CONCAT=y CONFIG_MTD_MTDRAM=y +CONFIG_MTDRAM_ABS_POS=0 +CONFIG_MTDRAM_ERASE_SIZE=128 +CONFIG_MTDRAM_TOTAL_SIZE=0 # CONFIG_NETDEV_1000 is not set CONFIG_NO_IOPORT=y # CONFIG_OOM_REBOOT is not set diff --git a/target/linux/gemini/config-default b/target/linux/gemini/config-default index 238720e12..c8c885640 100644 --- a/target/linux/gemini/config-default +++ b/target/linux/gemini/config-default @@ -18,15 +18,15 @@ CONFIG_BASE_SMALL=0 CONFIG_BITREVERSE=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,19200 mem=32M" -CONFIG_CPU_32=y CONFIG_CPU_32v4=y +CONFIG_CPU_32=y CONFIG_CPU_ABRT_EV4=y # CONFIG_CPU_BPREDICT_DISABLE is not set CONFIG_CPU_CACHE_FA=y CONFIG_CPU_CACHE_VIVT=y CONFIG_CPU_COPY_FA=y -CONFIG_CPU_CP15=y CONFIG_CPU_CP15_MMU=y +CONFIG_CPU_CP15=y # CONFIG_CPU_DCACHE_WRITETHROUGH is not set CONFIG_CPU_FA526=y # CONFIG_CPU_ICACHE_DISABLE is not set @@ -71,25 +71,25 @@ CONFIG_HAVE_KRETPROBES=y CONFIG_HAVE_LATENCYTOP_SUPPORT=y CONFIG_HAVE_MLOCK=y CONFIG_HAVE_OPROFILE=y -CONFIG_HDLC=m CONFIG_HDLC_CISCO=m CONFIG_HDLC_FR=m +CONFIG_HDLC=m CONFIG_HDLC_PPP=m CONFIG_HDLC_RAW=m -CONFIG_HWMON=y # CONFIG_HWMON_DEBUG_CHIP is not set +CONFIG_HWMON=y CONFIG_HW_RANDOM=y -CONFIG_I2C=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_CHARDEV=y +CONFIG_I2C=y CONFIG_INITRAMFS_SOURCE="" # CONFIG_IP_ADVANCED_ROUTER is not set CONFIG_IP_MROUTE=y CONFIG_IP_PIMSM_V1=y CONFIG_IP_PIMSM_V2=y # CONFIG_LEDS_GPIO is not set -CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LEGACY_PTYS=y # CONFIG_LIB80211 is not set # CONFIG_MACH_NAS4220B is not set # CONFIG_MACH_RUT100 is not set @@ -105,9 +105,9 @@ CONFIG_NLATTR=y # CONFIG_OUTER_CACHE is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xC0000000 -CONFIG_PCI=y # CONFIG_PCI_STUB is not set CONFIG_PCI_SYSCALL=y +CONFIG_PCI=y CONFIG_PHYLIB=y CONFIG_SCSI=m # CONFIG_SCSI_MULTI_LUN is not set @@ -117,8 +117,8 @@ CONFIG_SPLIT_PTLOCK_CPUS=4096 CONFIG_SYS_SUPPORTS_APM_EMULATION=y CONFIG_TRACING_SUPPORT=y CONFIG_UID16=y -CONFIG_USB=m # CONFIG_USB_EHCI_HCD is not set +CONFIG_USB=m CONFIG_USB_SUPPORT=y # CONFIG_USB_UHCI_HCD is not set CONFIG_VECTORS_BASE=0xffff0000 diff --git a/target/linux/generic-2.4/config-default b/target/linux/generic-2.4/config-default index c35d75a99..a087bb9dd 100644 --- a/target/linux/generic-2.4/config-default +++ b/target/linux/generic-2.4/config-default @@ -24,9 +24,9 @@ # CONFIG_BEFS_FS is not set # CONFIG_BFS_FS is not set # CONFIG_BINFMT_AOUT is not set -CONFIG_BINFMT_ELF=y # CONFIG_BINFMT_ELF32 is not set # CONFIG_BINFMT_ELF_AOUT is not set +CONFIG_BINFMT_ELF=y # CONFIG_BINFMT_MISC is not set # CONFIG_BLK_CPQ_CISS_DA is not set # CONFIG_BLK_CPQ_DA is not set @@ -88,7 +88,6 @@ CONFIG_CPU_MIPS32=y # CONFIG_CPU_VR41XX is not set # CONFIG_CRAMFS is not set CONFIG_CROSSCOMPILE=y -CONFIG_CRYPTO=y CONFIG_CRYPTO_AES=m CONFIG_CRYPTO_ANUBIS=m CONFIG_CRYPTO_ARC4=m @@ -111,6 +110,7 @@ CONFIG_CRYPTO_TEA=m CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_TWOFISH=m CONFIG_CRYPTO_WP512=m +CONFIG_CRYPTO=y # CONFIG_DDB5074 is not set # CONFIG_DDB5476 is not set # CONFIG_DDB5477 is not set @@ -139,27 +139,27 @@ CONFIG_FAT_FS=m # CONFIG_FDDI is not set # CONFIG_FTAPE is not set # CONFIG_FTL is not set -# CONFIG_FUSION is not set # CONFIG_FUSION_BOOT is not set # CONFIG_FUSION_CTL is not set # CONFIG_FUSION_ISENSE is not set +# CONFIG_FUSION is not set # CONFIG_FUSION_LAN is not set # CONFIG_FW_LOADER is not set # CONFIG_GDB_CONSOLE is not set # CONFIG_HAMACHI is not set # CONFIG_HERMES is not set -CONFIG_HFSPLUS_FS=m # CONFIG_HFS_FS is not set +CONFIG_HFSPLUS_FS=m # CONFIG_HIGHMEM is not set # CONFIG_HIPPI is not set -CONFIG_HOTPLUG=y -# CONFIG_HOTPLUG_PCI is not set # CONFIG_HOTPLUG_PCI_COMPAQ is not set # CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM is not set +# CONFIG_HOTPLUG_PCI is not set # CONFIG_HOTPLUG_PCI_PCIE is not set # CONFIG_HOTPLUG_PCI_PCIE_POLL_EVENT_MODE is not set # CONFIG_HOTPLUG_PCI_SHPC is not set # CONFIG_HOTPLUG_PCI_SHPC_POLL_EVENT_MODE is not set +CONFIG_HOTPLUG=y # CONFIG_HPFS_FS is not set # CONFIG_HP_LASERJET is not set # CONFIG_I2C is not set @@ -174,11 +174,11 @@ CONFIG_HOTPLUG=y # CONFIG_IEEE1394_VERBOSEDEBUG is not set # CONFIG_IEEE1394_VIDEO1394 is not set CONFIG_IMQ=m -CONFIG_INET=y # CONFIG_INET_ECN is not set -# CONFIG_INPUT is not set +CONFIG_INET=y # CONFIG_INPUT_EVDEV is not set # CONFIG_INPUT_GAMEPORT is not set +# CONFIG_INPUT is not set # CONFIG_INPUT_JOYDEV is not set # CONFIG_INPUT_KEYBDEV is not set # CONFIG_INPUT_MOUSEDEV is not set @@ -195,7 +195,6 @@ CONFIG_IP6_NF_MATCH_FRAG=m # CONFIG_IP6_NF_MATCH_IPV6HEADER is not set CONFIG_IP6_NF_MATCH_LENGTH=m CONFIG_IP6_NF_MATCH_LIMIT=m -CONFIG_IP_NF_MATCH_IPRANGE=m CONFIG_IP6_NF_MATCH_MAC=m CONFIG_IP6_NF_MATCH_MARK=m CONFIG_IP6_NF_MATCH_MULTIPORT=m @@ -208,22 +207,19 @@ CONFIG_IP6_NF_TARGET_IMQ=m CONFIG_IP6_NF_TARGET_LOG=m CONFIG_IP6_NF_TARGET_MARK=m CONFIG_IP6_NF_TARGET_REJECT=m +CONFIG_IP_ADVANCED_ROUTER=y # CONFIG_IPMI_DEVICE_INTERFACE is not set # CONFIG_IPMI_HANDLER is not set # CONFIG_IPMI_KCS is not set # CONFIG_IPMI_PANIC_EVENT is not set # CONFIG_IPMI_WATCHDOG is not set -CONFIG_IPSEC_NAT_TRAVERSAL=y -CONFIG_IPV6=m -# CONFIG_IPX is not set -CONFIG_IP_ADVANCED_ROUTER=y CONFIG_IP_MROUTE=y CONFIG_IP_MULTICAST=y CONFIG_IP_MULTIPLE_TABLES=y CONFIG_IP_NF_AMANDA=m CONFIG_IP_NF_ARPFILTER=m -CONFIG_IP_NF_ARPTABLES=m CONFIG_IP_NF_ARP_MANGLE=m +CONFIG_IP_NF_ARPTABLES=m # CONFIG_IP_NF_COMPAT_IPCHAINS is not set # CONFIG_IP_NF_COMPAT_IPFWADM is not set CONFIG_IP_NF_CONNTRACK=m @@ -245,8 +241,9 @@ CONFIG_IP_NF_MATCH_DSCP=m CONFIG_IP_NF_MATCH_ECN=m CONFIG_IP_NF_MATCH_HELPER=m CONFIG_IP_NF_MATCH_IPP2P=m -CONFIG_IP_NF_MATCH_LAYER7=m +CONFIG_IP_NF_MATCH_IPRANGE=m # CONFIG_IP_NF_MATCH_LAYER7_DEBUG is not set +CONFIG_IP_NF_MATCH_LAYER7=m CONFIG_IP_NF_MATCH_LENGTH=m CONFIG_IP_NF_MATCH_LIMIT=m CONFIG_IP_NF_MATCH_MAC=m @@ -266,11 +263,11 @@ CONFIG_IP_NF_MATCH_TOS=m CONFIG_IP_NF_MATCH_TTL=m CONFIG_IP_NF_MATCH_UNCLEAN=m CONFIG_IP_NF_MMS=m -CONFIG_IP_NF_NAT=m CONFIG_IP_NF_NAT_AMANDA=m CONFIG_IP_NF_NAT_FTP=m CONFIG_IP_NF_NAT_H323=m CONFIG_IP_NF_NAT_IRC=m +CONFIG_IP_NF_NAT=m CONFIG_IP_NF_NAT_MMS=m CONFIG_IP_NF_NAT_NEEDED=y CONFIG_IP_NF_NAT_PPTP=m @@ -281,19 +278,19 @@ CONFIG_IP_NF_NAT_TFTP=m CONFIG_IP_NF_PPTP=m CONFIG_IP_NF_QUEUE=m CONFIG_IP_NF_RTSP=m -CONFIG_IP_NF_SET=m CONFIG_IP_NF_SET_HASHSIZE=1024 CONFIG_IP_NF_SET_IPHASH=m CONFIG_IP_NF_SET_IPMAP=m CONFIG_IP_NF_SET_IPTREE=m +CONFIG_IP_NF_SET=m CONFIG_IP_NF_SET_MACIPMAP=m CONFIG_IP_NF_SET_MAX=256 CONFIG_IP_NF_SET_NETHASH=m CONFIG_IP_NF_SET_PORTMAP=m +CONFIG_IP_NF_TARGET_CLASSIFY=m CONFIG_IP_NF_TARGET_CONNMARK=m CONFIG_IP_NF_TARGET_DSCP=m CONFIG_IP_NF_TARGET_ECN=m -CONFIG_IP_NF_TARGET_CLASSIFY=m CONFIG_IP_NF_TARGET_IMQ=m CONFIG_IP_NF_TARGET_LOG=m CONFIG_IP_NF_TARGET_MARK=m @@ -317,20 +314,23 @@ CONFIG_IP_ROUTE_NAT=y CONFIG_IP_ROUTE_TOS=y # CONFIG_IP_ROUTE_VERBOSE is not set # CONFIG_IP_SCTP is not set +CONFIG_IPSEC_NAT_TRAVERSAL=y +CONFIG_IPV6=m +# CONFIG_IPX is not set # CONFIG_IRDA is not set # CONFIG_ISA is not set # CONFIG_ISAPNP is not set # CONFIG_ISDN is not set CONFIG_ISO9660_FS=m -CONFIG_JBD=m # CONFIG_JBD_DEBUG is not set +CONFIG_JBD=m # CONFIG_JFFS2_BBC_ARMLIB is not set CONFIG_JFFS2_BBC_LZARI=y # CONFIG_JFFS2_BBC_LZHD is not set # CONFIG_JFFS2_BBC_LZO is not set # CONFIG_JFFS2_BBC_LZSS is not set -CONFIG_JFFS2_FS=y CONFIG_JFFS2_FS_DEBUG=0 +CONFIG_JFFS2_FS=y # CONFIG_JFFS_FS is not set # CONFIG_JFS_DEBUG is not set # CONFIG_JFS_FS is not set @@ -356,13 +356,12 @@ CONFIG_MAGIC_SYSRQ=y # CONFIG_MD_RAID0 is not set # CONFIG_MD_RAID1 is not set # CONFIG_MD_RAID5 is not set -# CONFIG_MINIX_SUBPARTITION is not set CONFIG_MINI_FO=y -CONFIG_MIPS=y -CONFIG_MIPS32=y +# CONFIG_MINIX_SUBPARTITION is not set # CONFIG_MIPS32_COMPAT is not set # CONFIG_MIPS32_N32 is not set # CONFIG_MIPS32_O32 is not set +CONFIG_MIPS32=y # CONFIG_MIPS64 is not set # CONFIG_MIPS_ATLAS is not set # CONFIG_MIPS_AU1000 is not set @@ -391,21 +390,20 @@ CONFIG_MIPS32=y # CONFIG_MIPS_SEAD is not set # CONFIG_MIPS_UNCACHED is not set # CONFIG_MIPS_XXS1500 is not set +CONFIG_MIPS=y CONFIG_MODULES=y # CONFIG_MODVERSIONS is not set # CONFIG_MOMENCO_JAGUAR_ATX is not set -# CONFIG_MOMENCO_OCELOT is not set # CONFIG_MOMENCO_OCELOT_C is not set # CONFIG_MOMENCO_OCELOT_G is not set +# CONFIG_MOMENCO_OCELOT is not set # CONFIG_MOUSE is not set CONFIG_MSDOS_PARTITION=y -CONFIG_MTD=y # CONFIG_MTD_ABSENT is not set # CONFIG_MTD_AMDSTD is not set # CONFIG_MTD_BLKMTD is not set CONFIG_MTD_BLOCK=y # CONFIG_MTD_BOSPORUS is not set -CONFIG_MTD_CFI=y CONFIG_MTD_CFI_ADV_OPTIONS=y CONFIG_MTD_CFI_AMDSTD=y # CONFIG_MTD_CFI_B1 is not set @@ -422,6 +420,7 @@ CONFIG_MTD_CFI_INTELEXT=y # CONFIG_MTD_CFI_LE_BYTE_SWAP is not set CONFIG_MTD_CFI_NOSWAP=y # CONFIG_MTD_CFI_STAA is not set +CONFIG_MTD_CFI=y CONFIG_MTD_CHAR=y # CONFIG_MTD_CMDLINE_PARTS is not set # CONFIG_MTD_CONCAT is not set @@ -458,51 +457,51 @@ CONFIG_MTD_PARTITIONS=y # CONFIG_MTD_SHARP is not set # CONFIG_MTD_SLRAM is not set # CONFIG_MTD_XXS1500 is not set +CONFIG_MTD=y # CONFIG_MYRI_SBUS is not set # CONFIG_NCPFS_EXTRAS is not set # CONFIG_NCPFS_IOCTL_LOCKING is not set +# CONFIG_NCP_FS is not set # CONFIG_NCPFS_NFS_NS is not set # CONFIG_NCPFS_NLS is not set # CONFIG_NCPFS_OS2_NS is not set # CONFIG_NCPFS_PACKET_SIGNING is not set # CONFIG_NCPFS_SMALLDOS is not set # CONFIG_NCPFS_STRONG is not set -# CONFIG_NCP_FS is not set # CONFIG_NEC_EAGLE is not set # CONFIG_NEC_OSPREY is not set -CONFIG_NET=y -CONFIG_NETDEVICES=y -CONFIG_NETFILTER=y -# CONFIG_NETFILTER_DEBUG is not set -CONFIG_NETLINK_DEV=m -CONFIG_NET_CLS=y CONFIG_NET_CLS_FW=m CONFIG_NET_CLS_POLICE=y -CONFIG_NET_CLS_ROUTE=y CONFIG_NET_CLS_ROUTE4=m -CONFIG_NET_CLS_RSVP=m +CONFIG_NET_CLS_ROUTE=y CONFIG_NET_CLS_RSVP6=m +CONFIG_NET_CLS_RSVP=m CONFIG_NET_CLS_TCINDEX=m CONFIG_NET_CLS_U32=m +CONFIG_NET_CLS=y +CONFIG_NETDEVICES=y # CONFIG_NET_DIVERT is not set CONFIG_NET_ESTIMATOR=y CONFIG_NET_ETHERNET=y # CONFIG_NET_FASTROUTE is not set # CONFIG_NET_FC is not set +# CONFIG_NETFILTER_DEBUG is not set +CONFIG_NETFILTER=y # CONFIG_NET_HW_FLOWCONTROL is not set -CONFIG_NET_IPGRE=m # CONFIG_NET_IPGRE_BROADCAST is not set +CONFIG_NET_IPGRE=m CONFIG_NET_IPIP=m # CONFIG_NET_ISA is not set +CONFIG_NETLINK_DEV=m # CONFIG_NET_PKTGEN is not set # CONFIG_NET_POCKET is not set CONFIG_NET_QOS=y CONFIG_NET_RADIO=y CONFIG_NET_RANDOM=y -CONFIG_NET_SCHED=y CONFIG_NET_SCH_CBQ=m CONFIG_NET_SCH_CSZ=m CONFIG_NET_SCH_DSMARK=m +CONFIG_NET_SCHED=y CONFIG_NET_SCH_GRED=m CONFIG_NET_SCH_HFSC=m CONFIG_NET_SCH_HTB=m @@ -516,15 +515,15 @@ CONFIG_NET_SCH_TEQL=m # CONFIG_NET_VENDOR_3COM is not set # CONFIG_NET_VENDOR_RACAL is not set # CONFIG_NET_VENDOR_SMC is not set -CONFIG_NFSD=m -CONFIG_NFSD_V3=y -# CONFIG_NFSD_TCP is not set +CONFIG_NET=y # CONFIG_NFS_DIRECTIO is not set +CONFIG_NFSD=m +# CONFIG_NFSD_TCP is not set +CONFIG_NFSD_V3=y CONFIG_NFS_FS=m CONFIG_NFS_V3=y # CONFIG_NFTL is not set # CONFIG_NINO is not set -CONFIG_NLS=y CONFIG_NLS_CODEPAGE_1250=m # CONFIG_NLS_CODEPAGE_1251 is not set CONFIG_NLS_CODEPAGE_437=m @@ -548,10 +547,10 @@ CONFIG_NLS_CODEPAGE_850=m # CONFIG_NLS_CODEPAGE_949 is not set # CONFIG_NLS_CODEPAGE_950 is not set CONFIG_NLS_DEFAULT="iso8859-1" -CONFIG_NLS_ISO8859_1=m # CONFIG_NLS_ISO8859_13 is not set # CONFIG_NLS_ISO8859_14 is not set CONFIG_NLS_ISO8859_15=m +CONFIG_NLS_ISO8859_1=m # CONFIG_NLS_ISO8859_2 is not set # CONFIG_NLS_ISO8859_3 is not set # CONFIG_NLS_ISO8859_4 is not set @@ -563,6 +562,7 @@ CONFIG_NLS_ISO8859_15=m CONFIG_NLS_KOI8_R=m # CONFIG_NLS_KOI8_U is not set CONFIG_NLS_UTF8=m +CONFIG_NLS=y CONFIG_NONCOHERENT_IO=y # CONFIG_NS83820 is not set CONFIG_NTFS_FS=m @@ -571,8 +571,8 @@ CONFIG_NTFS_FS=m # CONFIG_OLIVETTI_M700 is not set # CONFIG_OOM_KILLER is not set # CONFIG_OSF_PARTITION is not set -CONFIG_PACKET=y CONFIG_PACKET_MMAP=y +CONFIG_PACKET=y # CONFIG_PAGE_SIZE_16KB is not set CONFIG_PAGE_SIZE_4KB=y # CONFIG_PAGE_SIZE_64KB is not set @@ -586,14 +586,14 @@ CONFIG_PARTITION_ADVANCED=y # CONFIG_PMC_STRETCH is not set # CONFIG_PMC_YOSEMITE is not set # CONFIG_PNP is not set -CONFIG_PPP=m -CONFIG_PPPOE=m CONFIG_PPP_ASYNC=m CONFIG_PPP_BSDCOMP=m CONFIG_PPP_DEFLATE=m CONFIG_PPP_FILTER=y +CONFIG_PPP=m CONFIG_PPP_MPPE_MPPC=m # CONFIG_PPP_MULTILINK is not set +CONFIG_PPPOE=m CONFIG_PPP_SYNC_TTY=m # CONFIG_PRISM54 is not set CONFIG_PROC_FS=y @@ -616,7 +616,6 @@ CONFIG_RAMFS=y CONFIG_RWSEM_GENERIC_SPINLOCK=y # CONFIG_RWSEM_XCHGADD_ALGORITHM is not set # CONFIG_SBUS is not set -CONFIG_SCSI=m # CONFIG_SCSI_7000FASST is not set # CONFIG_SCSI_AACRAID is not set # CONFIG_SCSI_ACARD is not set @@ -636,8 +635,8 @@ CONFIG_SCSI=m # CONFIG_SCSI_DMX3191D is not set # CONFIG_SCSI_DPT_I2O is not set # CONFIG_SCSI_DTC3280 is not set -# CONFIG_SCSI_EATA is not set # CONFIG_SCSI_EATA_DMA is not set +# CONFIG_SCSI_EATA is not set # CONFIG_SCSI_EATA_PIO is not set # CONFIG_SCSI_FUTURE_DOMAIN is not set # CONFIG_SCSI_GDTH is not set @@ -646,8 +645,9 @@ CONFIG_SCSI=m # CONFIG_SCSI_INIA100 is not set # CONFIG_SCSI_INITIO is not set # CONFIG_SCSI_LOGGING is not set -# CONFIG_SCSI_MEGARAID is not set +CONFIG_SCSI=m # CONFIG_SCSI_MEGARAID2 is not set +# CONFIG_SCSI_MEGARAID is not set CONFIG_SCSI_MULTI_LUN=y # CONFIG_SCSI_NCR53C406A is not set # CONFIG_SCSI_NCR53C7xx is not set @@ -657,8 +657,8 @@ CONFIG_SCSI_MULTI_LUN=y # CONFIG_SCSI_PCI2220I is not set # CONFIG_SCSI_PSI240I is not set # CONFIG_SCSI_QLOGIC_FAS is not set -# CONFIG_SCSI_SATA is not set # CONFIG_SCSI_SATA_AHCI is not set +# CONFIG_SCSI_SATA is not set # CONFIG_SCSI_SATA_NV is not set # CONFIG_SCSI_SATA_PROMISE is not set # CONFIG_SCSI_SATA_QSTOR is not set @@ -673,13 +673,13 @@ CONFIG_SCSI_MULTI_LUN=y # CONFIG_SCSI_SYM53C416 is not set # CONFIG_SCSI_T128 is not set # CONFIG_SCSI_U14_34F is not set -# CONFIG_SCx200 is not set # CONFIG_SCx200_GPIO is not set +# CONFIG_SCx200 is not set CONFIG_SD_EXTRA_DEVS=5 -CONFIG_SERIAL=y CONFIG_SERIAL_CONSOLE=y # CONFIG_SERIAL_EXTENDED is not set # CONFIG_SERIAL_NONSTANDARD is not set +CONFIG_SERIAL=y # CONFIG_SGI_IP22 is not set # CONFIG_SGI_IP27 is not set # CONFIG_SGI_PARTITION is not set @@ -693,19 +693,19 @@ CONFIG_SHAPER=m # CONFIG_SMB_NLS is not set # CONFIG_SNI_RM200_PCI is not set # CONFIG_SOLARIS_X86_PARTITION is not set -CONFIG_SQUASHFS=y # CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS=y # CONFIG_STRIP is not set # CONFIG_SUNBMAC is not set # CONFIG_SUNGEM is not set # CONFIG_SUNLANCE is not set +# CONFIG_SUN_PARTITION is not set # CONFIG_SUNQE is not set CONFIG_SUNRPC=m -# CONFIG_SUN_PARTITION is not set CONFIG_SYN_COOKIES=y CONFIG_SYSCTL=y -CONFIG_SYSVIPC=y # CONFIG_SYSV_FS is not set +CONFIG_SYSVIPC=y # CONFIG_TANBAC_TB0226 is not set # CONFIG_TANBAC_TB0229 is not set # CONFIG_TC is not set @@ -721,23 +721,23 @@ CONFIG_TUN=m # CONFIG_UFS_FS_WRITE is not set # CONFIG_ULTRIX_PARTITION is not set # CONFIG_UMSDOS_FS is not set -CONFIG_UNIX=y -CONFIG_UNIX98_PTYS=y CONFIG_UNIX98_PTY_COUNT=128 +CONFIG_UNIX98_PTYS=y # CONFIG_UNIXWARE_DISKLABEL is not set +CONFIG_UNIX=y # CONFIG_USB_BLUETOOTH is not set # CONFIG_USB_GADGET is not set CONFIG_USB_USBNET=m CONFIG_VFAT_FS=m # CONFIG_VICTOR_MPC30X is not set CONFIG_VLAN_8021Q=y -# CONFIG_VT is not set # CONFIG_VTAG_ICACHE is not set +# CONFIG_VT is not set # CONFIG_VXFS_FS is not set # CONFIG_WAN is not set CONFIG_WAN_ROUTER=m -CONFIG_WATCHDOG=y # CONFIG_WATCHDOG_NOWAYOUT is not set +CONFIG_WATCHDOG=y # CONFIG_WAVELAN is not set # CONFIG_WDT_W83627 is not set # CONFIG_X25 is not set @@ -748,7 +748,7 @@ CONFIG_XFS_FS=m # CONFIG_XFS_TRACE is not set # CONFIG_YELLOWFIN is not set # CONFIG_ZAO_CAPCELLA is not set -# CONFIG_ZISOFS is not set # CONFIG_ZISOFS_FS is not set +# CONFIG_ZISOFS is not set CONFIG_ZLIB_DEFLATE=y CONFIG_ZLIB_INFLATE=y diff --git a/target/linux/generic-2.6/config-2.6.30 b/target/linux/generic-2.6/config-2.6.30 index 6ab9a66bb..ce1861c2d 100644 --- a/target/linux/generic-2.6/config-2.6.30 +++ b/target/linux/generic-2.6/config-2.6.30 @@ -541,8 +541,8 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" # CONFIG_FB_VIRTUAL is not set # CONFIG_FB_VOODOO1 is not set # CONFIG_FB_VT8623 is not set -# CONFIG_FCOE is not set # CONFIG_FCOE_FNIC is not set +# CONFIG_FCOE is not set # CONFIG_FDDI is not set # CONFIG_FEALNX is not set CONFIG_FIB_RULES=y @@ -650,10 +650,10 @@ CONFIG_HOTPLUG=y # CONFIG_HVC_UDBG is not set # CONFIG_HWMON is not set # CONFIG_HWMON_VID is not set -# CONFIG_HW_RANDOM_TIMERIOMEM is not set -# CONFIG_HW_RANDOM_INTEL is not set # CONFIG_HW_RANDOM_AMD is not set # CONFIG_HW_RANDOM_GEODE is not set +# CONFIG_HW_RANDOM_INTEL is not set +# CONFIG_HW_RANDOM_TIMERIOMEM is not set # CONFIG_HW_RANDOM_VIA is not set CONFIG_HZ=100 # CONFIG_HZ_1000 is not set @@ -1007,10 +1007,10 @@ CONFIG_KMOD=y # CONFIG_LASAT is not set # CONFIG_LATENCYTOP is not set # CONFIG_LBD is not set -# CONFIG_LDM_PARTITION is not set # CONFIG_LCD_LTV350QV is not set # CONFIG_LCD_TDO24M is not set # CONFIG_LCD_VGG2432A4 is not set +# CONFIG_LDM_PARTITION is not set # CONFIG_LEDS_ALIX is not set # CONFIG_LEDS_BD2802 is not set CONFIG_LEDS_CLASS=y @@ -1832,8 +1832,8 @@ CONFIG_SELECT_MEMORY_MODEL=y # CONFIG_SENSORS_I5K_AMB is not set # CONFIG_SENSORS_IT87 is not set # CONFIG_SENSORS_K8TEMP is not set -# CONFIG_SENSORS_LIS3_SPI is not set # CONFIG_SENSORS_LIS3LV02D is not set +# CONFIG_SENSORS_LIS3_SPI is not set # CONFIG_SENSORS_LM63 is not set # CONFIG_SENSORS_LM70 is not set # CONFIG_SENSORS_LM75 is not set diff --git a/target/linux/generic-2.6/config-2.6.31 b/target/linux/generic-2.6/config-2.6.31 index 3f71c3dfd..ccc7adf60 100644 --- a/target/linux/generic-2.6/config-2.6.31 +++ b/target/linux/generic-2.6/config-2.6.31 @@ -558,8 +558,8 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" # CONFIG_FB_VIRTUAL is not set # CONFIG_FB_VOODOO1 is not set # CONFIG_FB_VT8623 is not set -# CONFIG_FCOE is not set # CONFIG_FCOE_FNIC is not set +# CONFIG_FCOE is not set # CONFIG_FDDI is not set # CONFIG_FEALNX is not set CONFIG_FIB_RULES=y @@ -672,10 +672,10 @@ CONFIG_HOTPLUG=y # CONFIG_HVC_UDBG is not set # CONFIG_HWMON is not set # CONFIG_HWMON_VID is not set -# CONFIG_HW_RANDOM_TIMERIOMEM is not set -# CONFIG_HW_RANDOM_INTEL is not set # CONFIG_HW_RANDOM_AMD is not set # CONFIG_HW_RANDOM_GEODE is not set +# CONFIG_HW_RANDOM_INTEL is not set +# CONFIG_HW_RANDOM_TIMERIOMEM is not set # CONFIG_HW_RANDOM_VIA is not set CONFIG_HZ=100 # CONFIG_HZ_1000 is not set @@ -1034,10 +1034,10 @@ CONFIG_KMOD=y # CONFIG_LATENCYTOP is not set # CONFIG_LBDAF is not set # CONFIG_LBD is not set -# CONFIG_LDM_PARTITION is not set # CONFIG_LCD_LTV350QV is not set # CONFIG_LCD_TDO24M is not set # CONFIG_LCD_VGG2432A4 is not set +# CONFIG_LDM_PARTITION is not set # CONFIG_LEDS_ALIX is not set # CONFIG_LEDS_BD2802 is not set CONFIG_LEDS_CLASS=y @@ -1875,8 +1875,8 @@ CONFIG_SELECT_MEMORY_MODEL=y # CONFIG_SENSORS_I5K_AMB is not set # CONFIG_SENSORS_IT87 is not set # CONFIG_SENSORS_K8TEMP is not set -# CONFIG_SENSORS_LIS3_SPI is not set # CONFIG_SENSORS_LIS3LV02D is not set +# CONFIG_SENSORS_LIS3_SPI is not set # CONFIG_SENSORS_LM63 is not set # CONFIG_SENSORS_LM70 is not set # CONFIG_SENSORS_LM75 is not set diff --git a/target/linux/goldfish/config-2.6.30 b/target/linux/goldfish/config-2.6.30 index 072a2413e..7e82d8af2 100644 --- a/target/linux/goldfish/config-2.6.30 +++ b/target/linux/goldfish/config-2.6.30 @@ -9,8 +9,8 @@ CONFIG_ARCH_GOLDFISH=y # CONFIG_ARCH_SPARSEMEM_DEFAULT is not set # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARM=y CONFIG_ARM_THUMB=y +CONFIG_ARM=y # CONFIG_BACKTRACE_SELF_TEST is not set CONFIG_BASE_SMALL=0 CONFIG_BATTERY_GOLDFISH=y @@ -22,15 +22,15 @@ CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 CONFIG_CMDLINE="console=/dev/ttyS0 root=mtdblock0 rootdelay=1 rootfstype=yaffs2" # CONFIG_CONSOLE_EARLYSUSPEND is not set CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_CPU_32=y CONFIG_CPU_32v5=y +CONFIG_CPU_32=y CONFIG_CPU_ABRT_EV5TJ=y CONFIG_CPU_ARM926T=y # CONFIG_CPU_CACHE_ROUND_ROBIN is not set CONFIG_CPU_CACHE_VIVT=y CONFIG_CPU_COPY_V4WB=y -CONFIG_CPU_CP15=y CONFIG_CPU_CP15_MMU=y +CONFIG_CPU_CP15=y # CONFIG_CPU_DCACHE_WRITETHROUGH is not set # CONFIG_CPU_ICACHE_DISABLE is not set CONFIG_CPU_PABRT_NOIFAR=y @@ -51,8 +51,8 @@ CONFIG_DEBUG_KERNEL=y # CONFIG_DEBUG_KOBJECT is not set # CONFIG_DEBUG_LIST is not set # CONFIG_DEBUG_LL is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_DEBUG_MUTEXES is not set # CONFIG_DEBUG_NOTIFIERS is not set # CONFIG_DEBUG_OBJECTS is not set @@ -73,7 +73,6 @@ CONFIG_DEVKMEM=y CONFIG_DUMMY_CONSOLE=y CONFIG_EARLYSUSPEND=y # CONFIG_FAULT_INJECTION is not set -CONFIG_FB=y CONFIG_FB_CFB_COPYAREA=y CONFIG_FB_CFB_FILLRECT=y CONFIG_FB_CFB_IMAGEBLIT=y @@ -81,17 +80,18 @@ CONFIG_FB_EARLYSUSPEND=y CONFIG_FB_GOLDFISH=y CONFIG_FB_MODE_HELPERS=y CONFIG_FB_TILEBLITTING=y +CONFIG_FB=y # CONFIG_FIRMWARE_EDID is not set -# CONFIG_FONTS is not set CONFIG_FONT_8x16=y CONFIG_FONT_8x8=y -CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FONTS is not set CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y +CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAME_POINTER=y CONFIG_FREEZER=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_FIND_LAST_BIT=y # CONFIG_GENERIC_GPIO is not set CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y @@ -113,22 +113,22 @@ CONFIG_HAVE_KRETPROBES=y CONFIG_HAVE_LATENCYTOP_SUPPORT=y CONFIG_HAVE_MLOCK=y CONFIG_HAVE_OPROFILE=y -CONFIG_HID=y CONFIG_HID_SUPPORT=y +CONFIG_HID=y CONFIG_HW_CONSOLE=y # CONFIG_HW_RANDOM is not set # CONFIG_I2C is not set CONFIG_INITRAMFS_SOURCE="" -CONFIG_INPUT=y CONFIG_INPUT_EVDEV=y CONFIG_INPUT_GPIO=y CONFIG_INPUT_KEYBOARD=y CONFIG_INPUT_KEYRESET=y -CONFIG_INPUT_MOUSEDEV=y CONFIG_INPUT_MOUSEDEV_PSAUX=y CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +CONFIG_INPUT_MOUSEDEV=y CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_INPUT=y # CONFIG_ISDN is not set # CONFIG_JFFS2_CMODE_PRIORITY is not set CONFIG_JFFS2_CMODE_SIZE=y @@ -149,11 +149,11 @@ CONFIG_MACH_GOLDFISH=y CONFIG_MTD_CONCAT=y CONFIG_MTD_GOLDFISH_NAND=y CONFIG_MTD_NAND=y -CONFIG_MTD_UBI=y CONFIG_MTD_UBI_BEB_RESERVE=1 # CONFIG_MTD_UBI_DEBUG is not set CONFIG_MTD_UBI_GLUEBI=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 +CONFIG_MTD_UBI=y # CONFIG_NETDEV_1000 is not set # CONFIG_NO_IOPORT is not set # CONFIG_NO_USER_SPACE_SCREEN_ACCESS_CONTROL is not set @@ -164,11 +164,11 @@ CONFIG_PAGE_OFFSET=0xC0000000 # CONFIG_PAGE_POISONING is not set # CONFIG_PCI_SYSCALL is not set # CONFIG_PDA_POWER is not set -CONFIG_PM=y # CONFIG_PM_DEBUG is not set CONFIG_PM_SLEEP=y -CONFIG_POWER_SUPPLY=y +CONFIG_PM=y # CONFIG_POWER_SUPPLY_DEBUG is not set +CONFIG_POWER_SUPPLY=y # CONFIG_PROVE_LOCKING is not set CONFIG_QEMU_TRACE=y # CONFIG_RCU_TORTURE_TEST is not set @@ -177,15 +177,15 @@ CONFIG_RTC_CLASS=y # CONFIG_RTC_DRV_CMOS is not set CONFIG_RTC_DRV_GOLDFISH=y # CONFIG_RT_MUTEX_TESTER is not set -# CONFIG_SCHEDSTATS is not set CONFIG_SCHED_DEBUG=y +# CONFIG_SCHEDSTATS is not set # CONFIG_SCSI_DMA is not set # CONFIG_SERIAL_8250 is not set # CONFIG_SLOW_WORK is not set CONFIG_SMC91X=y CONFIG_SPLIT_PTLOCK_CPUS=4096 -CONFIG_SUSPEND=y CONFIG_SUSPEND_FREEZER=y +CONFIG_SUSPEND=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y CONFIG_TICK_ONESHOT=y # CONFIG_TIMER_STATS is not set @@ -198,11 +198,11 @@ CONFIG_VECTORS_BASE=0xffff0000 CONFIG_VFP=y # CONFIG_VGA_CONSOLE is not set CONFIG_VIDEO_OUTPUT_CONTROL=y -CONFIG_VT=y CONFIG_VT_CONSOLE=y CONFIG_VT_HW_CONSOLE_BINDING=y -CONFIG_WAKELOCK=y +CONFIG_VT=y CONFIG_WAKELOCK_STAT=y +CONFIG_WAKELOCK=y # CONFIG_WATCHDOG is not set CONFIG_ZBOOT_ROM_BSS=0 CONFIG_ZBOOT_ROM_TEXT=0 diff --git a/target/linux/ifxmips/config-2.6.30 b/target/linux/ifxmips/config-2.6.30 index 67132b65a..49befd554 100644 --- a/target/linux/ifxmips/config-2.6.30 +++ b/target/linux/ifxmips/config-2.6.30 @@ -14,8 +14,8 @@ CONFIG_BASE_SMALL=0 CONFIG_BITREVERSE=y # CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set -CONFIG_CEVT_R4K=y CONFIG_CEVT_R4K_LIB=y +CONFIG_CEVT_R4K=y CONFIG_CMDLINE="console=ttyS0,9600 rootfstype=squashfs,jffs2" CONFIG_CPU_BIG_ENDIAN=y # CONFIG_CPU_CAVIUM_OCTEON is not set @@ -24,9 +24,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y # CONFIG_CPU_LITTLE_ENDIAN is not set # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS32_R1 is not set CONFIG_CPU_MIPS32_R2=y +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR2=y @@ -48,16 +48,16 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y # CONFIG_CPU_TX39XX is not set # CONFIG_CPU_TX49XX is not set # CONFIG_CPU_VR41XX is not set -CONFIG_CSRC_R4K=y CONFIG_CSRC_R4K_LIB=y +CONFIG_CSRC_R4K=y CONFIG_DECOMPRESS_LZMA=y CONFIG_DEVPORT=y # CONFIG_DM9000 is not set CONFIG_DMA_NEED_PCI_MAP_STATE=y CONFIG_DMA_NONCOHERENT=y CONFIG_EARLY_PRINTK=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -76,16 +76,16 @@ CONFIG_HAVE_STD_PC_SERIAL_PORT=y # CONFIG_HIGH_RES_TIMERS is not set CONFIG_HW_HAS_PCI=y CONFIG_HW_RANDOM=y -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set -CONFIG_IFXMIPS=y CONFIG_IFXMIPS_GPIO_RST_BTN=y CONFIG_IFXMIPS_MII0=y # CONFIG_IFXMIPS_PROM_ASC0 is not set CONFIG_IFXMIPS_PROM_ASC1=y CONFIG_IFXMIPS_WDT=y +CONFIG_IFXMIPS=y CONFIG_INITRAMFS_SOURCE="" CONFIG_IRQ_CPU=y CONFIG_KALLSYMS=y @@ -99,7 +99,6 @@ CONFIG_LEDS_IFXMIPS=y # CONFIG_MACH_TX49XX is not set # CONFIG_MACH_VR41XX is not set # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set # CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 @@ -110,6 +109,7 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set # CONFIG_MIPS_VPE_LOADER is not set +CONFIG_MIPS=y CONFIG_MTD_CFI_ADV_OPTIONS=y CONFIG_MTD_CFI_GEOMETRY=y # CONFIG_MTD_CFI_INTELEXT is not set @@ -122,8 +122,8 @@ CONFIG_MTD_IFXMIPS=y # CONFIG_NXP_STB220 is not set # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PCI=y CONFIG_PCI_DOMAINS=y +CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set diff --git a/target/linux/ifxmips/nfs/config-2.6.26 b/target/linux/ifxmips/nfs/config-2.6.26 index 137af82d4..19d7d2aa1 100644 --- a/target/linux/ifxmips/nfs/config-2.6.26 +++ b/target/linux/ifxmips/nfs/config-2.6.26 @@ -4,13 +4,13 @@ CONFIG_CRYPTO_CBC=y CONFIG_CRYPTO_DES=y CONFIG_CRYPTO_MANAGER=y CONFIG_CRYPTO_MD5=y -CONFIG_IP_PNP=y # CONFIG_IP_PNP_BOOTP is not set # CONFIG_IP_PNP_DHCP is not set # CONFIG_IP_PNP_RARP is not set +CONFIG_IP_PNP=y CONFIG_LOCKD=y CONFIG_NFS_FS=y CONFIG_ROOT_NFS=y CONFIG_RPCSEC_GSS_KRB5=y -CONFIG_SUNRPC=y CONFIG_SUNRPC_GSS=y +CONFIG_SUNRPC=y diff --git a/target/linux/ifxmips/nfs/config-2.6.27 b/target/linux/ifxmips/nfs/config-2.6.27 index 137af82d4..19d7d2aa1 100644 --- a/target/linux/ifxmips/nfs/config-2.6.27 +++ b/target/linux/ifxmips/nfs/config-2.6.27 @@ -4,13 +4,13 @@ CONFIG_CRYPTO_CBC=y CONFIG_CRYPTO_DES=y CONFIG_CRYPTO_MANAGER=y CONFIG_CRYPTO_MD5=y -CONFIG_IP_PNP=y # CONFIG_IP_PNP_BOOTP is not set # CONFIG_IP_PNP_DHCP is not set # CONFIG_IP_PNP_RARP is not set +CONFIG_IP_PNP=y CONFIG_LOCKD=y CONFIG_NFS_FS=y CONFIG_ROOT_NFS=y CONFIG_RPCSEC_GSS_KRB5=y -CONFIG_SUNRPC=y CONFIG_SUNRPC_GSS=y +CONFIG_SUNRPC=y diff --git a/target/linux/ifxmips/nfs/config-2.6.28 b/target/linux/ifxmips/nfs/config-2.6.28 index 097bcfd57..8e1884211 100644 --- a/target/linux/ifxmips/nfs/config-2.6.28 +++ b/target/linux/ifxmips/nfs/config-2.6.28 @@ -1,23 +1,23 @@ CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_ALGAPI=y CONFIG_CRYPTO_ALGAPI2=y -CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_ALGAPI=y CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_BLKCIPHER=y CONFIG_CRYPTO_CBC=y CONFIG_CRYPTO_DES=y CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_MANAGER=y CONFIG_CRYPTO_MANAGER2=y +CONFIG_CRYPTO_MANAGER=y CONFIG_CRYPTO_MD5=y CONFIG_CRYPTO_RNG2=y -CONFIG_IP_PNP=y # CONFIG_IP_PNP_BOOTP is not set # CONFIG_IP_PNP_DHCP is not set # CONFIG_IP_PNP_RARP is not set +CONFIG_IP_PNP=y CONFIG_LOCKD=y # CONFIG_NETFILTER is not set CONFIG_NFS_FS=y CONFIG_ROOT_NFS=y CONFIG_RPCSEC_GSS_KRB5=y -CONFIG_SUNRPC=y CONFIG_SUNRPC_GSS=y +CONFIG_SUNRPC=y diff --git a/target/linux/iop32x/config-default b/target/linux/iop32x/config-default index be0a64ffd..e737123d6 100644 --- a/target/linux/iop32x/config-default +++ b/target/linux/iop32x/config-default @@ -10,15 +10,15 @@ CONFIG_ARCH_IOP32X=y CONFIG_ARCH_SUPPORTS_AOUT=y # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARM=y # CONFIG_ARM_THUMB is not set +CONFIG_ARM=y # CONFIG_ARPD is not set # CONFIG_ARTHUR is not set CONFIG_ASYNC_CORE=y CONFIG_ATA=m # CONFIG_ATA_NONSTANDARD is not set -# CONFIG_ATM is not set # CONFIG_ATMEL is not set +# CONFIG_ATM is not set CONFIG_BASE_SMALL=0 # CONFIG_BINFMT_AOUT is not set CONFIG_BITREVERSE=y @@ -30,12 +30,12 @@ CONFIG_BOUNCE=y # CONFIG_CIFS_STATS is not set CONFIG_CLASSIC_RCU=y CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200" -CONFIG_CPU_32=y CONFIG_CPU_32v5=y +CONFIG_CPU_32=y CONFIG_CPU_ABRT_EV5T=y CONFIG_CPU_CACHE_VIVT=y -CONFIG_CPU_CP15=y CONFIG_CPU_CP15_MMU=y +CONFIG_CPU_CP15=y # CONFIG_CPU_DCACHE_DISABLE is not set CONFIG_CPU_PABRT_NOIFAR=y CONFIG_CPU_TLB_V4WBI=y @@ -52,11 +52,11 @@ CONFIG_DMADEVICES=y CONFIG_DMA_ENGINE=y CONFIG_DNOTIFY=y # CONFIG_DSCC4 is not set -# CONFIG_E100 is not set -CONFIG_E1000=y -# CONFIG_E1000E_ENABLED is not set # CONFIG_E1000_DISABLE_PACKET_SPLIT is not set +# CONFIG_E1000E_ENABLED is not set CONFIG_E1000_NAPI=y +CONFIG_E1000=y +# CONFIG_E100 is not set # CONFIG_FARSYNC is not set # CONFIG_FPE_FASTFPE is not set # CONFIG_FPE_NWFPE is not set @@ -77,20 +77,20 @@ CONFIG_HAVE_IDE=y CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y CONFIG_HAVE_OPROFILE=y -CONFIG_HDLC=m CONFIG_HDLC_CISCO=m CONFIG_HDLC_FR=m +CONFIG_HDLC=m CONFIG_HDLC_PPP=m -CONFIG_HDLC_RAW=m # CONFIG_HDLC_RAW_ETH is not set +CONFIG_HDLC_RAW=m # CONFIG_HERMES is not set -CONFIG_HWMON=y # CONFIG_HWMON_DEBUG_CHIP is not set +CONFIG_HWMON=y CONFIG_HW_RANDOM=y -CONFIG_I2C=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_CHARDEV=y # CONFIG_I2C_IOP3XX is not set +CONFIG_I2C=y # CONFIG_IDE is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_INTEL_IOP_ADMA=y @@ -103,8 +103,6 @@ CONFIG_INTEL_IOP_ADMA=y # CONFIG_IP6_NF_MATCH_OPTS is not set # CONFIG_IP6_NF_MATCH_RT is not set # CONFIG_IP6_NF_TARGET_LOG is not set -CONFIG_IPV6_NDISC_NODETYPE=y -# CONFIG_IPV6_ROUTER_PREF is not set # CONFIG_IP_ADVANCED_ROUTER is not set CONFIG_IP_MROUTE=y # CONFIG_IP_NF_ARPTABLES is not set @@ -120,19 +118,21 @@ CONFIG_IP_MROUTE=y # CONFIG_IP_NF_TARGET_ULOG is not set CONFIG_IP_PIMSM_V1=y CONFIG_IP_PIMSM_V2=y +CONFIG_IPV6_NDISC_NODETYPE=y +# CONFIG_IPV6_ROUTER_PREF is not set # CONFIG_IWLWIFI_LEDS is not set # CONFIG_IWMMXT is not set # CONFIG_LANMEDIA is not set -CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LEGACY_PTYS=y # CONFIG_LLC2 is not set CONFIG_LZO_COMPRESS=m CONFIG_LZO_DECOMPRESS=m # CONFIG_MACH_EM7210 is not set # CONFIG_MACH_GLANTANK is not set CONFIG_MACH_N2100=y -CONFIG_MEDIA_TUNER=m # CONFIG_MEDIA_TUNER_CUSTOMIZE is not set +CONFIG_MEDIA_TUNER=m CONFIG_MEDIA_TUNER_MT20XX=m CONFIG_MEDIA_TUNER_SIMPLE=m CONFIG_MEDIA_TUNER_TDA8290=m @@ -153,8 +153,8 @@ CONFIG_NET_DMA=y # CONFIG_NET_VENDOR_3COM is not set # CONFIG_NLS_CODEPAGE_437 is not set # CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_ISO8859_1 is not set # CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_ISO8859_1 is not set # CONFIG_NLS_KOI8_R is not set # CONFIG_NO_IDLE_HZ is not set # CONFIG_NO_IOPORT is not set @@ -164,17 +164,17 @@ CONFIG_NET_DMA=y # CONFIG_OUTER_CACHE is not set CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PC300 is not set -CONFIG_PCI=y # CONFIG_PCI200SYN is not set # CONFIG_PCIPCWATCHDOG is not set CONFIG_PCI_SYSCALL=y +CONFIG_PCI=y CONFIG_PLAT_IOP=y # CONFIG_PPP is not set # CONFIG_PRISM54 is not set # CONFIG_R6040 is not set -CONFIG_R8169=y CONFIG_R8169_NAPI=y CONFIG_R8169_VLAN=y +CONFIG_R8169=y CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_PCF8563=y CONFIG_RTC_DRV_X1205=y @@ -187,12 +187,12 @@ CONFIG_SPLIT_PTLOCK_CPUS=4096 CONFIG_SYS_SUPPORTS_APM_EMULATION=y # CONFIG_TICK_ONESHOT is not set CONFIG_UID16=y -CONFIG_USB=m # CONFIG_USB_ACM is not set # CONFIG_USB_CATC is not set CONFIG_USB_EHCI_HCD=m # CONFIG_USB_ISIGHTFW is not set # CONFIG_USB_KAWETH is not set +CONFIG_USB=m # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set CONFIG_USB_OHCI_HCD=m @@ -216,8 +216,8 @@ CONFIG_VECTORS_BASE=0xffff0000 # CONFIG_VIA_RHINE is not set CONFIG_VIDEO_MEDIA=m CONFIG_VM_EVENT_COUNTERS=y -CONFIG_WAN=y # CONFIG_WANXL is not set +CONFIG_WAN=y # CONFIG_XFS_FS is not set # CONFIG_XIP_KERNEL is not set CONFIG_XSCALE_PMU=y diff --git a/target/linux/ixp4xx/config-2.6.28 b/target/linux/ixp4xx/config-2.6.28 index 436f32ef3..eed45f2dd 100644 --- a/target/linux/ixp4xx/config-2.6.28 +++ b/target/linux/ixp4xx/config-2.6.28 @@ -15,8 +15,8 @@ CONFIG_ARCH_SUPPORTS_AOUT=y CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARM=y # CONFIG_ARM_THUMB is not set +CONFIG_ARM=y # CONFIG_ARPD is not set # CONFIG_ARTHUR is not set CONFIG_AT24=y @@ -24,8 +24,8 @@ CONFIG_AT24=y # CONFIG_ATA_NONSTANDARD is not set # CONFIG_ATA_PIIX is not set CONFIG_ATA_SFF=y -# CONFIG_ATM is not set # CONFIG_ATMEL is not set +# CONFIG_ATM is not set CONFIG_BASE_SMALL=0 # CONFIG_BINFMT_AOUT is not set CONFIG_BITREVERSE=y @@ -35,13 +35,13 @@ CONFIG_BOUNCE=y # CONFIG_CIFS_STATS is not set CONFIG_CLASSIC_RCU=y CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200" -CONFIG_CPU_32=y CONFIG_CPU_32v5=y +CONFIG_CPU_32=y CONFIG_CPU_ABRT_EV5T=y CONFIG_CPU_BIG_ENDIAN=y CONFIG_CPU_CACHE_VIVT=y -CONFIG_CPU_CP15=y CONFIG_CPU_CP15_MMU=y +CONFIG_CPU_CP15=y CONFIG_CPU_IXP43X=y CONFIG_CPU_IXP46X=y CONFIG_CPU_PABRT_NOIFAR=y @@ -52,15 +52,15 @@ CONFIG_CRC16=y # CONFIG_DEBUG_USER is not set CONFIG_DEVPORT=y # CONFIG_DM9000 is not set -CONFIG_DMABOUNCE=y CONFIG_DMABOUNCE_DEBUG=y +CONFIG_DMABOUNCE=y CONFIG_DNOTIFY=y # CONFIG_FPE_FASTFPE is not set # CONFIG_FPE_NWFPE is not set CONFIG_FRAME_POINTER=y CONFIG_FS_POSIX_ACL=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y # CONFIG_GENERIC_FIND_FIRST_BIT is not set # CONFIG_GENERIC_FIND_NEXT_BIT is not set CONFIG_GENERIC_GPIO=y @@ -90,18 +90,18 @@ CONFIG_HAVE_OPROFILE=y # CONFIG_HERMES is not set # CONFIG_HID is not set CONFIG_HID_SUPPORT=y -CONFIG_HWMON=y # CONFIG_HWMON_DEBUG_CHIP is not set CONFIG_HWMON_VID=y -CONFIG_HW_RANDOM=y +CONFIG_HWMON=y CONFIG_HW_RANDOM_IXP4XX=y -CONFIG_I2C=y +CONFIG_HW_RANDOM=y CONFIG_I2C_ALGOBIT=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_GPIO=y # CONFIG_I2C_IOP3XX is not set # CONFIG_I2C_ISCH is not set +CONFIG_I2C=y # CONFIG_IDE is not set CONFIG_INITRAMFS_SOURCE="" # CONFIG_INPUT is not set @@ -121,8 +121,8 @@ CONFIG_LEDS_GPIO=y CONFIG_LEDS_LATCH=y # CONFIG_LEDS_PCA9532 is not set # CONFIG_LEDS_PCA955X is not set -CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LEGACY_PTYS=y # CONFIG_LLC2 is not set CONFIG_MACH_AP1000=y CONFIG_MACH_AVILA=y @@ -139,8 +139,8 @@ CONFIG_MACH_LOFT=y CONFIG_MACH_MI424WR=y CONFIG_MACH_NAS100D=y CONFIG_MACH_NSLU2=y -CONFIG_MACH_PRONGHORN=y CONFIG_MACH_PRONGHORNMETRO=y +CONFIG_MACH_PRONGHORN=y CONFIG_MACH_SIDEWINDER=y CONFIG_MACH_TW5334=y CONFIG_MACH_USR8200=y @@ -165,8 +165,8 @@ CONFIG_MTD_REDBOOT_PARTS=y # CONFIG_NATSEMI is not set # CONFIG_NLS_CODEPAGE_437 is not set # CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_ISO8859_1 is not set # CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_ISO8859_1 is not set # CONFIG_NLS_KOI8_R is not set # CONFIG_NO_IOPORT is not set # CONFIG_NVRAM is not set @@ -175,8 +175,8 @@ CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PATA_ARTOP is not set # CONFIG_PATA_IXP4XX_CF is not set # CONFIG_PATA_SCH is not set -CONFIG_PCI=y CONFIG_PCI_SYSCALL=y +CONFIG_PCI=y # CONFIG_R6040 is not set CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_DS1672=y @@ -200,12 +200,12 @@ CONFIG_SPLIT_PTLOCK_CPUS=4096 CONFIG_SYS_SUPPORTS_APM_EMULATION=y CONFIG_TICK_ONESHOT=y CONFIG_UID16=y -# CONFIG_USB is not set CONFIG_USB_EHCI_BIG_ENDIAN_DESC=y CONFIG_USB_EHCI_BIG_ENDIAN_MMIO=y # CONFIG_USB_EHCI_HCD is not set CONFIG_USB_EHCI_ROOT_HUB_TT=y CONFIG_USB_EHCI_TT_NEWSCHED=y +# CONFIG_USB is not set # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set # CONFIG_USB_OHCI_HCD is not set diff --git a/target/linux/ixp4xx/config-2.6.30 b/target/linux/ixp4xx/config-2.6.30 index cf64c60fb..98fb4e1f8 100644 --- a/target/linux/ixp4xx/config-2.6.30 +++ b/target/linux/ixp4xx/config-2.6.30 @@ -15,20 +15,20 @@ CONFIG_ARCH_REQUIRE_GPIOLIB=y CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARM=y # CONFIG_ARM_THUMB is not set +CONFIG_ARM=y # CONFIG_ARPD is not set CONFIG_BASE_SMALL=0 CONFIG_BITREVERSE=y CONFIG_BOUNCE=y CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200" -CONFIG_CPU_32=y CONFIG_CPU_32v5=y +CONFIG_CPU_32=y CONFIG_CPU_ABRT_EV5T=y CONFIG_CPU_BIG_ENDIAN=y CONFIG_CPU_CACHE_VIVT=y -CONFIG_CPU_CP15=y CONFIG_CPU_CP15_MMU=y +CONFIG_CPU_CP15=y CONFIG_CPU_IXP43X=y CONFIG_CPU_IXP46X=y CONFIG_CPU_PABRT_NOIFAR=y @@ -48,14 +48,14 @@ CONFIG_EEPROM_AT24=y # CONFIG_FPE_FASTFPE is not set # CONFIG_FPE_NWFPE is not set CONFIG_FRAME_POINTER=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_GPIO=y CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y -CONFIG_GPIOLIB=y CONFIG_GPIO_DEVICE=y CONFIG_GPIO_GW_I2C_PLD=y +CONFIG_GPIOLIB=y CONFIG_GPIO_SYSFS=y # CONFIG_HAMRADIO is not set CONFIG_HARDIRQS_SW_RESEND=y @@ -72,17 +72,17 @@ CONFIG_HAVE_KRETPROBES=y CONFIG_HAVE_LATENCYTOP_SUPPORT=y CONFIG_HAVE_MTD_OTP=y CONFIG_HAVE_OPROFILE=y -CONFIG_HWMON=y # CONFIG_HWMON_DEBUG_CHIP is not set CONFIG_HWMON_VID=y -CONFIG_HW_RANDOM=y +CONFIG_HWMON=y CONFIG_HW_RANDOM_IXP4XX=y -CONFIG_I2C=y +CONFIG_HW_RANDOM=y CONFIG_I2C_ALGOBIT=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_GPIO=y # CONFIG_I2C_IOP3XX is not set +CONFIG_I2C=y CONFIG_INITRAMFS_SOURCE="" CONFIG_IP_MROUTE=y CONFIG_IP_PIMSM_V1=y @@ -99,8 +99,8 @@ CONFIG_IXP4XX_WATCHDOG=y CONFIG_LEDS_FSG=y CONFIG_LEDS_GPIO=y CONFIG_LEDS_LATCH=y -CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LEGACY_PTYS=y # CONFIG_LIB80211 is not set CONFIG_MACH_AP1000=y CONFIG_MACH_AVILA=y @@ -117,8 +117,8 @@ CONFIG_MACH_LOFT=y CONFIG_MACH_MI424WR=y CONFIG_MACH_NAS100D=y CONFIG_MACH_NSLU2=y -CONFIG_MACH_PRONGHORN=y CONFIG_MACH_PRONGHORNMETRO=y +CONFIG_MACH_PRONGHORN=y CONFIG_MACH_SIDEWINDER=y CONFIG_MACH_TW5334=y CONFIG_MACH_USR8200=y @@ -138,9 +138,9 @@ CONFIG_MTD_REDBOOT_PARTS=y # CONFIG_OUTER_CACHE is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xC0000000 -CONFIG_PCI=y # CONFIG_PCI_STUB is not set CONFIG_PCI_SYSCALL=y +CONFIG_PCI=y CONFIG_PHYLIB=y CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_DS1672=y diff --git a/target/linux/ixp4xx/config-2.6.31 b/target/linux/ixp4xx/config-2.6.31 index 79bb193f6..8a600a9a5 100644 --- a/target/linux/ixp4xx/config-2.6.31 +++ b/target/linux/ixp4xx/config-2.6.31 @@ -12,20 +12,20 @@ CONFIG_ARCH_REQUIRE_GPIOLIB=y CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARM=y # CONFIG_ARM_THUMB is not set +CONFIG_ARM=y # CONFIG_ARPD is not set CONFIG_BASE_SMALL=0 CONFIG_BITREVERSE=y CONFIG_BOUNCE=y CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200" -CONFIG_CPU_32=y CONFIG_CPU_32v5=y +CONFIG_CPU_32=y CONFIG_CPU_ABRT_EV5T=y CONFIG_CPU_BIG_ENDIAN=y CONFIG_CPU_CACHE_VIVT=y -CONFIG_CPU_CP15=y CONFIG_CPU_CP15_MMU=y +CONFIG_CPU_CP15=y CONFIG_CPU_ENDIAN_BE32=y # CONFIG_CPU_ENDIAN_BE8 is not set CONFIG_CPU_IXP43X=y @@ -45,14 +45,14 @@ CONFIG_EEPROM_AT24=y # CONFIG_FPE_FASTFPE is not set # CONFIG_FPE_NWFPE is not set CONFIG_FRAME_POINTER=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_GPIO=y CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y -CONFIG_GPIOLIB=y CONFIG_GPIO_DEVICE=y CONFIG_GPIO_GW_I2C_PLD=y +CONFIG_GPIOLIB=y CONFIG_GPIO_SYSFS=y # CONFIG_HAMRADIO is not set CONFIG_HARDIRQS_SW_RESEND=y @@ -69,17 +69,17 @@ CONFIG_HAVE_KRETPROBES=y CONFIG_HAVE_LATENCYTOP_SUPPORT=y CONFIG_HAVE_MTD_OTP=y CONFIG_HAVE_OPROFILE=y -CONFIG_HWMON=y # CONFIG_HWMON_DEBUG_CHIP is not set CONFIG_HWMON_VID=y -CONFIG_HW_RANDOM=y +CONFIG_HWMON=y CONFIG_HW_RANDOM_IXP4XX=y -CONFIG_I2C=y +CONFIG_HW_RANDOM=y CONFIG_I2C_ALGOBIT=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_GPIO=y # CONFIG_I2C_IOP3XX is not set +CONFIG_I2C=y CONFIG_INITRAMFS_SOURCE="" CONFIG_IP_PIMSM_V1=y CONFIG_IP_PIMSM_V2=y @@ -94,8 +94,8 @@ CONFIG_IXP4XX_WATCHDOG=y CONFIG_LEDS_FSG=y CONFIG_LEDS_GPIO=y CONFIG_LEDS_LATCH=y -CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LEGACY_PTYS=y CONFIG_MACH_AP1000=y CONFIG_MACH_AVILA=y CONFIG_MACH_CAMBRIA=y @@ -112,8 +112,8 @@ CONFIG_MACH_LOFT=y CONFIG_MACH_MI424WR=y CONFIG_MACH_NAS100D=y CONFIG_MACH_NSLU2=y -CONFIG_MACH_PRONGHORN=y CONFIG_MACH_PRONGHORNMETRO=y +CONFIG_MACH_PRONGHORN=y CONFIG_MACH_SIDEWINDER=y CONFIG_MACH_TW5334=y CONFIG_MACH_USR8200=y @@ -129,8 +129,8 @@ CONFIG_MTD_REDBOOT_PARTS=y # CONFIG_NVRAM is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xC0000000 -CONFIG_PCI=y CONFIG_PCI_SYSCALL=y +CONFIG_PCI=y CONFIG_PHYLIB=y CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_DS1672=y diff --git a/target/linux/ixp4xx/config-2.6.32 b/target/linux/ixp4xx/config-2.6.32 index 79bb193f6..8a600a9a5 100644 --- a/target/linux/ixp4xx/config-2.6.32 +++ b/target/linux/ixp4xx/config-2.6.32 @@ -12,20 +12,20 @@ CONFIG_ARCH_REQUIRE_GPIOLIB=y CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARM=y # CONFIG_ARM_THUMB is not set +CONFIG_ARM=y # CONFIG_ARPD is not set CONFIG_BASE_SMALL=0 CONFIG_BITREVERSE=y CONFIG_BOUNCE=y CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200" -CONFIG_CPU_32=y CONFIG_CPU_32v5=y +CONFIG_CPU_32=y CONFIG_CPU_ABRT_EV5T=y CONFIG_CPU_BIG_ENDIAN=y CONFIG_CPU_CACHE_VIVT=y -CONFIG_CPU_CP15=y CONFIG_CPU_CP15_MMU=y +CONFIG_CPU_CP15=y CONFIG_CPU_ENDIAN_BE32=y # CONFIG_CPU_ENDIAN_BE8 is not set CONFIG_CPU_IXP43X=y @@ -45,14 +45,14 @@ CONFIG_EEPROM_AT24=y # CONFIG_FPE_FASTFPE is not set # CONFIG_FPE_NWFPE is not set CONFIG_FRAME_POINTER=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_GPIO=y CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y -CONFIG_GPIOLIB=y CONFIG_GPIO_DEVICE=y CONFIG_GPIO_GW_I2C_PLD=y +CONFIG_GPIOLIB=y CONFIG_GPIO_SYSFS=y # CONFIG_HAMRADIO is not set CONFIG_HARDIRQS_SW_RESEND=y @@ -69,17 +69,17 @@ CONFIG_HAVE_KRETPROBES=y CONFIG_HAVE_LATENCYTOP_SUPPORT=y CONFIG_HAVE_MTD_OTP=y CONFIG_HAVE_OPROFILE=y -CONFIG_HWMON=y # CONFIG_HWMON_DEBUG_CHIP is not set CONFIG_HWMON_VID=y -CONFIG_HW_RANDOM=y +CONFIG_HWMON=y CONFIG_HW_RANDOM_IXP4XX=y -CONFIG_I2C=y +CONFIG_HW_RANDOM=y CONFIG_I2C_ALGOBIT=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_GPIO=y # CONFIG_I2C_IOP3XX is not set +CONFIG_I2C=y CONFIG_INITRAMFS_SOURCE="" CONFIG_IP_PIMSM_V1=y CONFIG_IP_PIMSM_V2=y @@ -94,8 +94,8 @@ CONFIG_IXP4XX_WATCHDOG=y CONFIG_LEDS_FSG=y CONFIG_LEDS_GPIO=y CONFIG_LEDS_LATCH=y -CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LEGACY_PTYS=y CONFIG_MACH_AP1000=y CONFIG_MACH_AVILA=y CONFIG_MACH_CAMBRIA=y @@ -112,8 +112,8 @@ CONFIG_MACH_LOFT=y CONFIG_MACH_MI424WR=y CONFIG_MACH_NAS100D=y CONFIG_MACH_NSLU2=y -CONFIG_MACH_PRONGHORN=y CONFIG_MACH_PRONGHORNMETRO=y +CONFIG_MACH_PRONGHORN=y CONFIG_MACH_SIDEWINDER=y CONFIG_MACH_TW5334=y CONFIG_MACH_USR8200=y @@ -129,8 +129,8 @@ CONFIG_MTD_REDBOOT_PARTS=y # CONFIG_NVRAM is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xC0000000 -CONFIG_PCI=y CONFIG_PCI_SYSCALL=y +CONFIG_PCI=y CONFIG_PHYLIB=y CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_DS1672=y diff --git a/target/linux/ixp4xx/config-default b/target/linux/ixp4xx/config-default index d1e165698..a548e666c 100644 --- a/target/linux/ixp4xx/config-default +++ b/target/linux/ixp4xx/config-default @@ -14,16 +14,16 @@ CONFIG_ARCH_SUPPORTS_AOUT=y CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARM=y # CONFIG_ARM_THUMB is not set +CONFIG_ARM=y # CONFIG_ARPD is not set # CONFIG_ARTHUR is not set CONFIG_ATA=m # CONFIG_ATA_NONSTANDARD is not set # CONFIG_ATA_PIIX is not set CONFIG_ATA_SFF=y -# CONFIG_ATM is not set # CONFIG_ATMEL is not set +# CONFIG_ATM is not set CONFIG_BASE_SMALL=0 # CONFIG_BINFMT_AOUT is not set CONFIG_BITREVERSE=y @@ -35,13 +35,13 @@ CONFIG_BOUNCE=y # CONFIG_CIFS_STATS is not set CONFIG_CLASSIC_RCU=y CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200" -CONFIG_CPU_32=y CONFIG_CPU_32v5=y +CONFIG_CPU_32=y CONFIG_CPU_ABRT_EV5T=y CONFIG_CPU_BIG_ENDIAN=y CONFIG_CPU_CACHE_VIVT=y -CONFIG_CPU_CP15=y CONFIG_CPU_CP15_MMU=y +CONFIG_CPU_CP15=y # CONFIG_CPU_DCACHE_DISABLE is not set CONFIG_CPU_IXP43X=y CONFIG_CPU_IXP46X=y @@ -55,19 +55,19 @@ CONFIG_DEVPORT=y CONFIG_DLCI=m CONFIG_DLCI_MAX=8 # CONFIG_DM9000 is not set -CONFIG_DMABOUNCE=y CONFIG_DMABOUNCE_DEBUG=y +CONFIG_DMABOUNCE=y CONFIG_DNOTIFY=y # CONFIG_DSCC4 is not set -# CONFIG_E100 is not set # CONFIG_E1000E_ENABLED is not set +# CONFIG_E100 is not set # CONFIG_FARSYNC is not set # CONFIG_FPE_FASTFPE is not set # CONFIG_FPE_NWFPE is not set CONFIG_FRAME_POINTER=y CONFIG_FS_POSIX_ACL=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y # CONFIG_GENERIC_FIND_FIRST_BIT is not set # CONFIG_GENERIC_FIND_NEXT_BIT is not set CONFIG_GENERIC_GPIO=y @@ -82,30 +82,30 @@ CONFIG_HAVE_IDE=y CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y CONFIG_HAVE_OPROFILE=y -CONFIG_HDLC=m CONFIG_HDLC_CISCO=m CONFIG_HDLC_FR=m +CONFIG_HDLC=m CONFIG_HDLC_PPP=m -CONFIG_HDLC_RAW=m # CONFIG_HDLC_RAW_ETH is not set +CONFIG_HDLC_RAW=m # CONFIG_HERMES is not set CONFIG_HID=m CONFIG_HID_SUPPORT=y -CONFIG_HWMON=y # CONFIG_HWMON_DEBUG_CHIP is not set CONFIG_HWMON_VID=y -CONFIG_HW_RANDOM=y +CONFIG_HWMON=y CONFIG_HW_RANDOM_IXP4XX=y -CONFIG_I2C=y +CONFIG_HW_RANDOM=y CONFIG_I2C_ALGOBIT=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_GPIO=y # CONFIG_I2C_IOP3XX is not set +CONFIG_I2C=y # CONFIG_IDE is not set CONFIG_INITRAMFS_SOURCE="" -CONFIG_INPUT=m # CONFIG_INPUT_IXP4XX_BEEPER is not set +CONFIG_INPUT=m # CONFIG_IP6_NF_MANGLE is not set # CONFIG_IP6_NF_MATCH_EUI64 is not set # CONFIG_IP6_NF_MATCH_FRAG is not set @@ -114,8 +114,6 @@ CONFIG_INPUT=m # CONFIG_IP6_NF_MATCH_OPTS is not set # CONFIG_IP6_NF_MATCH_RT is not set # CONFIG_IP6_NF_TARGET_LOG is not set -CONFIG_IPV6_NDISC_NODETYPE=y -# CONFIG_IPV6_ROUTER_PREF is not set # CONFIG_IP_ADVANCED_ROUTER is not set CONFIG_IP_MROUTE=y # CONFIG_IP_NF_ARPTABLES is not set @@ -131,6 +129,8 @@ CONFIG_IP_MROUTE=y # CONFIG_IP_NF_TARGET_ULOG is not set CONFIG_IP_PIMSM_V1=y CONFIG_IP_PIMSM_V2=y +CONFIG_IPV6_NDISC_NODETYPE=y +# CONFIG_IPV6_ROUTER_PREF is not set # CONFIG_IWLWIFI_LEDS is not set # CONFIG_IWMMXT is not set CONFIG_IXP4XX_ETH=y @@ -143,8 +143,8 @@ CONFIG_IXP4XX_WATCHDOG=y CONFIG_LEDS_FSG=y CONFIG_LEDS_GPIO=y CONFIG_LEDS_LATCH=y -CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LEGACY_PTYS=y # CONFIG_LLC2 is not set CONFIG_MACH_AP1000=y CONFIG_MACH_AVILA=y @@ -160,8 +160,8 @@ CONFIG_MACH_IXDPG425=y CONFIG_MACH_LOFT=y CONFIG_MACH_NAS100D=y CONFIG_MACH_NSLU2=y -CONFIG_MACH_PRONGHORN=y CONFIG_MACH_PRONGHORNMETRO=y +CONFIG_MACH_PRONGHORN=y CONFIG_MACH_SIDEWINDER=y CONFIG_MACH_TW5334=y CONFIG_MACH_USR8200=y @@ -191,8 +191,8 @@ CONFIG_MTD_REDBOOT_PARTS=y # CONFIG_NET_VENDOR_3COM is not set # CONFIG_NLS_CODEPAGE_437 is not set # CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_ISO8859_1 is not set # CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_ISO8859_1 is not set # CONFIG_NLS_KOI8_R is not set # CONFIG_NO_IOPORT is not set # CONFIG_NVRAM is not set @@ -202,10 +202,10 @@ CONFIG_PATA_ARTOP=m CONFIG_PATA_IXP4XX_CF=m # CONFIG_PATA_SCH is not set # CONFIG_PC300 is not set -CONFIG_PCI=y # CONFIG_PCI200SYN is not set # CONFIG_PCIPCWATCHDOG is not set CONFIG_PCI_SYSCALL=y +CONFIG_PCI=y # CONFIG_PRISM54 is not set # CONFIG_R6040 is not set CONFIG_RTC_CLASS=y @@ -227,12 +227,12 @@ CONFIG_SPLIT_PTLOCK_CPUS=4096 CONFIG_SYS_SUPPORTS_APM_EMULATION=y CONFIG_TICK_ONESHOT=y CONFIG_UID16=y -CONFIG_USB=m CONFIG_USB_EHCI_BIG_ENDIAN_DESC=y CONFIG_USB_EHCI_BIG_ENDIAN_MMIO=y CONFIG_USB_EHCI_HCD=m CONFIG_USB_EHCI_ROOT_HUB_TT=y CONFIG_USB_EHCI_TT_NEWSCHED=y +CONFIG_USB=m # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set CONFIG_USB_OHCI_HCD=m @@ -246,8 +246,8 @@ CONFIG_VECTORS_BASE=0xffff0000 CONFIG_VIA_VELOCITY=m CONFIG_VIDEO_MEDIA=m CONFIG_VM_EVENT_COUNTERS=y -CONFIG_WAN=y # CONFIG_WANXL is not set +CONFIG_WAN=y # CONFIG_XFS_FS is not set # CONFIG_XIP_KERNEL is not set CONFIG_XSCALE_PMU=y diff --git a/target/linux/ixp4xx/harddisk/config-default b/target/linux/ixp4xx/harddisk/config-default index ba39e85f0..ef9a47c7e 100644 --- a/target/linux/ixp4xx/harddisk/config-default +++ b/target/linux/ixp4xx/harddisk/config-default @@ -1,19 +1,19 @@ -CONFIG_CMDLINE="root=/dev/sda1 noinitrd console=ttyS0,115200" CONFIG_ATA=y +CONFIG_BLK_DEV_SD=y +CONFIG_CMDLINE="root=/dev/sda1 noinitrd console=ttyS0,115200" +CONFIG_EXT2_FS=y +CONFIG_EXT3_FS=y +CONFIG_JBD=y +CONFIG_REISERFS_FS=y CONFIG_SATA_VIA=y +CONFIG_USB_ARCH_HAS_EHCI=y CONFIG_USB_ARCH_HAS_HCD=y CONFIG_USB_ARCH_HAS_OHCI=y -CONFIG_USB_ARCH_HAS_EHCI=y -CONFIG_USB=y CONFIG_USB_EHCI_HCD=y -CONFIG_USB_EHCI_SPLIT_ISO=y CONFIG_USB_EHCI_ROOT_HUB_TT=y +CONFIG_USB_EHCI_SPLIT_ISO=y CONFIG_USB_EHCI_TT_NEWSCHED=y CONFIG_USB_OHCI_HCD=y CONFIG_USB_OHCI_LITTLE_ENDIAN=y CONFIG_USB_STORAGE=y -CONFIG_EXT2_FS=y -CONFIG_EXT3_FS=y -CONFIG_JBD=y -CONFIG_BLK_DEV_SD=y -CONFIG_REISERFS_FS=y +CONFIG_USB=y diff --git a/target/linux/mpc52xx/config-2.6.30 b/target/linux/mpc52xx/config-2.6.30 index b048d6d17..a74afc604 100644 --- a/target/linux/mpc52xx/config-2.6.30 +++ b/target/linux/mpc52xx/config-2.6.30 @@ -28,20 +28,20 @@ CONFIG_BOUNCE=y # CONFIG_BRIDGE is not set # CONFIG_BSD_PROCESS_ACCT is not set # CONFIG_CGROUP_SCHED is not set -CONFIG_CMDLINE="console=ttyPSC0,115200" CONFIG_CMDLINE_BOOL=y +CONFIG_CMDLINE="console=ttyPSC0,115200" CONFIG_COMPAT_BRK=y # CONFIG_CPU_FREQ is not set CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_BLKCIPHER=y CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_BLKCIPHER=y CONFIG_CRYPTO_CBC=y CONFIG_CRYPTO_DES=y -CONFIG_CRYPTO_HASH=y CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_HASH=y CONFIG_CRYPTO_HW=y -CONFIG_CRYPTO_MANAGER=y CONFIG_CRYPTO_MANAGER2=y +CONFIG_CRYPTO_MANAGER=y CONFIG_CRYPTO_MD5=y CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_WORKQUEUE=y @@ -63,15 +63,15 @@ CONFIG_ELF_CORE=y # CONFIG_EMBEDDED6xx is not set CONFIG_ENABLE_MUST_CHECK=y # CONFIG_EPOLL is not set -CONFIG_FEC_MPC52xx=y CONFIG_FEC_MPC52xx_MDIO=y +CONFIG_FEC_MPC52xx=y CONFIG_FORCE_MAX_ZONEORDER=11 CONFIG_FREEZER=y # CONFIG_FSL_ULI1575 is not set # CONFIG_FW_LOADER is not set CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -81,8 +81,8 @@ CONFIG_GENERIC_ISA_DMA=y CONFIG_GENERIC_NVRAM=y # CONFIG_GENERIC_TBSYNC is not set CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GEN_RTC=y # CONFIG_GEN_RTC_X is not set +CONFIG_GEN_RTC=y CONFIG_GPIOLIB=y CONFIG_GROUP_SCHED=y # CONFIG_HAMRADIO is not set @@ -105,39 +105,39 @@ CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y CONFIG_HAVE_LATENCYTOP_SUPPORT=y CONFIG_HAVE_LMB=y -CONFIG_HAVE_MLOCK=y CONFIG_HAVE_MLOCKED_PAGE_BIT=y +CONFIG_HAVE_MLOCK=y CONFIG_HAVE_OPROFILE=y # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set # CONFIG_HVC_RTAS is not set # CONFIG_HVC_UDBG is not set # CONFIG_HW_RANDOM is not set -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set CONFIG_INET_DIAG=y CONFIG_INET_TCP_DIAG=y CONFIG_INITRAMFS_SOURCE="" -CONFIG_INOTIFY=y CONFIG_INOTIFY_USER=y +CONFIG_INOTIFY=y # CONFIG_IOMMU_HELPER is not set CONFIG_IOSCHED_AS=y CONFIG_IOSCHED_CFQ=y -# CONFIG_IPIC is not set # CONFIG_IP_ADVANCED_ROUTER is not set +# CONFIG_IPIC is not set # CONFIG_IP_MROUTE is not set -CONFIG_IP_PNP=y CONFIG_IP_PNP_BOOTP=y CONFIG_IP_PNP_DHCP=y # CONFIG_IP_PNP_RARP is not set -# CONFIG_IRQSTACKS is not set +CONFIG_IP_PNP=y CONFIG_IRQ_PER_CPU=y +# CONFIG_IRQSTACKS is not set CONFIG_ISA_DMA_API=y # CONFIG_ISDN is not set CONFIG_KERNEL_START=0xc0000000 -CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LEGACY_PTYS=y CONFIG_LOWMEM_SIZE=0x30000000 CONFIG_LXT_PHY=y # CONFIG_MACINTOSH_DRIVERS is not set @@ -154,29 +154,28 @@ CONFIG_MIGRATION=y # CONFIG_NET_SCHED is not set # CONFIG_NEW_LEDS is not set # CONFIG_NVRAM is not set -CONFIG_OF=y CONFIG_OF_DEVICE=y CONFIG_OF_GPIO=y +CONFIG_OF=y # CONFIG_PACKET_MMAP is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xc0000000 # CONFIG_PARTITION_ADVANCED is not set -CONFIG_PCI=y -# CONFIG_PCIEPORTBUS is not set CONFIG_PCI_DOMAINS=y +# CONFIG_PCIEPORTBUS is not set CONFIG_PCI_LEGACY=y CONFIG_PCI_SYSCALL=y +CONFIG_PCI=y CONFIG_PHYLIB=y CONFIG_PHYSICAL_START=0x00000000 -CONFIG_PM=y # CONFIG_PM_DEBUG is not set CONFIG_PM_SLEEP=y -CONFIG_PPC=y -CONFIG_PPC32=y -# CONFIG_PPC64 is not set +CONFIG_PM=y # CONFIG_PPC_16K_PAGES is not set # CONFIG_PPC_256K_PAGES is not set +CONFIG_PPC32=y CONFIG_PPC_4K_PAGES=y +# CONFIG_PPC64 is not set # CONFIG_PPC_64K_PAGES is not set # CONFIG_PPC_82xx is not set # CONFIG_PPC_83xx is not set @@ -184,8 +183,8 @@ CONFIG_PPC_4K_PAGES=y # CONFIG_PPC_86xx is not set # CONFIG_PPC_8xx is not set # CONFIG_PPC_970_NAP is not set -CONFIG_PPC_BESTCOMM=y CONFIG_PPC_BESTCOMM_FEC=y +CONFIG_PPC_BESTCOMM=y CONFIG_PPC_BOOK3S=y # CONFIG_PPC_CELL is not set # CONFIG_PPC_CELL_NATIVE is not set @@ -209,14 +208,15 @@ CONFIG_PPC_MPC5200_GPIO=y # CONFIG_PPC_MPC5200_SIMPLE is not set CONFIG_PPC_MPC52xx=y CONFIG_PPC_NATIVE=y -CONFIG_PPC_OF=y CONFIG_PPC_OF_BOOT_TRAMPOLINE=y +CONFIG_PPC_OF=y CONFIG_PPC_PCI_CHOICE=y # CONFIG_PPC_PMAC is not set CONFIG_PPC_RTAS=y -CONFIG_PPC_STD_MMU=y CONFIG_PPC_STD_MMU_32=y +CONFIG_PPC_STD_MMU=y # CONFIG_PPC_UDBG_16550 is not set +CONFIG_PPC=y # CONFIG_PQ2ADS is not set CONFIG_PRINT_STACK_DEPTH=64 CONFIG_PROC_DEVICETREE=y @@ -231,9 +231,9 @@ CONFIG_SCHED_OMIT_FRAME_POINTER=y # CONFIG_SCSI_DMA is not set CONFIG_SECCOMP=y # CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_MPC52xx=y -CONFIG_SERIAL_MPC52xx_CONSOLE=y CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD=115200 +CONFIG_SERIAL_MPC52xx_CONSOLE=y +CONFIG_SERIAL_MPC52xx=y # CONFIG_SLAB is not set # CONFIG_SLOW_WORK is not set CONFIG_SLUB=y @@ -241,11 +241,11 @@ CONFIG_SLUB=y # CONFIG_SPI_MPC52xx_PSC is not set # CONFIG_SQUASHFS is not set # CONFIG_STRIP_ASM_SYMS is not set -CONFIG_SUSPEND=y CONFIG_SUSPEND_FREEZER=y +CONFIG_SUSPEND=y # CONFIG_SYSCTL_SYSCALL is not set -CONFIG_SYSFS_DEPRECATED=y CONFIG_SYSFS_DEPRECATED_V2=y +CONFIG_SYSFS_DEPRECATED=y CONFIG_TASK_SIZE=0xc0000000 # CONFIG_TAU is not set # CONFIG_TCP_CONG_ADVANCED is not set diff --git a/target/linux/mpc83xx/config-default b/target/linux/mpc83xx/config-default index 41fb24182..c37f3a631 100644 --- a/target/linux/mpc83xx/config-default +++ b/target/linux/mpc83xx/config-default @@ -20,10 +20,10 @@ CONFIG_ARCH_SUPPORTS_MSI=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y # CONFIG_ASP834x is not set -CONFIG_ATA=y # CONFIG_ATA_NONSTANDARD is not set # CONFIG_ATA_PIIX is not set CONFIG_ATA_SFF=y +CONFIG_ATA=y CONFIG_AUDIT_ARCH=y CONFIG_BASE_SMALL=0 # CONFIG_BINARY_PRINTF is not set @@ -32,8 +32,8 @@ CONFIG_BITREVERSE=y CONFIG_BOUNCE=y # CONFIG_BRIQ_PANEL is not set CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CMDLINE="console=ttyS0,115200" CONFIG_CMDLINE_BOOL=y +CONFIG_CMDLINE="console=ttyS0,115200" # CONFIG_CPU_FREQ is not set CONFIG_CRYPTO_AEAD2=y CONFIG_CRYPTO_BLKCIPHER2=y @@ -57,8 +57,8 @@ CONFIG_FSL_PQ_MDIO=y CONFIG_FSL_SOC=y # CONFIG_FSL_ULI1575 is not set CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -95,17 +95,17 @@ CONFIG_HAVE_OPROFILE=y # CONFIG_HVC_RTAS is not set # CONFIG_HVC_UDBG is not set CONFIG_HW_RANDOM=y -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set CONFIG_INITRAMFS_SOURCE="" # CONFIG_IOMMU_HELPER is not set CONFIG_IPIC=y -# CONFIG_IRQSTACKS is not set CONFIG_IRQ_PER_CPU=y -# CONFIG_ISA is not set +# CONFIG_IRQSTACKS is not set CONFIG_ISA_DMA_API=y +# CONFIG_ISA is not set # CONFIG_JFFS2_FS is not set CONFIG_KERNEL_START=0xc0000000 # CONFIG_LEDS_GPIO is not set @@ -124,37 +124,36 @@ CONFIG_LOWMEM_SIZE=0x30000000 # CONFIG_MPC837x_MDS is not set # CONFIG_MPC837x_RDB is not set # CONFIG_MPC8xxx_GPIO is not set -CONFIG_MPIC=y # CONFIG_MPIC_WEIRD is not set +CONFIG_MPIC=y # CONFIG_MTD_CFI is not set -CONFIG_MTD_NAND=y # CONFIG_MTD_NAND_FSL_ELBC is not set # CONFIG_MTD_NAND_FSL_UPM is not set CONFIG_MTD_NAND_RB_PPC=y +CONFIG_MTD_NAND=y # CONFIG_MTD_OF_PARTS is not set # CONFIG_NATSEMI is not set # CONFIG_NVRAM is not set -CONFIG_OF=y CONFIG_OF_DEVICE=y CONFIG_OF_GPIO=y +CONFIG_OF=y CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xc0000000 CONFIG_PATA_RB_PPC=m # CONFIG_PATA_SCH is not set -CONFIG_PCI=y -# CONFIG_PCIEPORTBUS is not set CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y +# CONFIG_PCIEPORTBUS is not set CONFIG_PCI_SYSCALL=y +CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y CONFIG_PHYLIB=y CONFIG_PHYSICAL_START=0x00000000 -CONFIG_PPC=y -CONFIG_PPC32=y -# CONFIG_PPC64 is not set # CONFIG_PPC_16K_PAGES is not set # CONFIG_PPC_256K_PAGES is not set +CONFIG_PPC32=y CONFIG_PPC_4K_PAGES=y +# CONFIG_PPC64 is not set # CONFIG_PPC_64K_PAGES is not set # CONFIG_PPC_82xx is not set CONFIG_PPC_83xx=y @@ -180,14 +179,15 @@ CONFIG_PPC_MPC106=y # CONFIG_PPC_MPC52xx is not set CONFIG_PPC_MPC834x=y CONFIG_PPC_NATIVE=y -CONFIG_PPC_OF=y CONFIG_PPC_OF_BOOT_TRAMPOLINE=y +CONFIG_PPC_OF=y CONFIG_PPC_PCI_CHOICE=y # CONFIG_PPC_PMAC is not set CONFIG_PPC_RTAS=y -CONFIG_PPC_STD_MMU=y CONFIG_PPC_STD_MMU_32=y +CONFIG_PPC_STD_MMU=y CONFIG_PPC_UDBG_16550=y +CONFIG_PPC=y # CONFIG_PQ2ADS is not set CONFIG_PRINT_STACK_DEPTH=64 CONFIG_PROC_DEVICETREE=y diff --git a/target/linux/octeon/config-default b/target/linux/octeon/config-default index 88960d400..c0cf4b424 100644 --- a/target/linux/octeon/config-default +++ b/target/linux/octeon/config-default @@ -1,9 +1,9 @@ # CONFIG_32BIT is not set -CONFIG_64BIT=y CONFIG_64BIT_PHYS_ADDR=y +CONFIG_64BIT=y # CONFIG_ALTERA_PCIE_CHDMA is not set -# CONFIG_ANDROID is not set # CONFIG_ANDROID_BINDER_IPC is not set +# CONFIG_ANDROID is not set # CONFIG_ANDROID_LOGGER is not set # CONFIG_ANDROID_LOW_MEMORY_KILLER is not set # CONFIG_ANDROID_RAM_CONSOLE is not set @@ -31,22 +31,22 @@ CONFIG_BSD_PROCESS_ACCT_V3=y # CONFIG_CAVIUM_OCTEON_2ND_KERNEL is not set CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE=2 CONFIG_CAVIUM_OCTEON_HW_FIX_UNALIGNED=y -CONFIG_CAVIUM_OCTEON_LOCK_L2=y CONFIG_CAVIUM_OCTEON_LOCK_L2_EXCEPTION=y CONFIG_CAVIUM_OCTEON_LOCK_L2_INTERRUPT=y CONFIG_CAVIUM_OCTEON_LOCK_L2_LOW_LEVEL_INTERRUPT=y CONFIG_CAVIUM_OCTEON_LOCK_L2_MEMCPY=y CONFIG_CAVIUM_OCTEON_LOCK_L2_TLB=y +CONFIG_CAVIUM_OCTEON_LOCK_L2=y CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD=y # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set CONFIG_CAVIUM_OCTEON_SPECIFIC_OPTIONS=y -CONFIG_CEVT_R4K=y CONFIG_CEVT_R4K_LIB=y +CONFIG_CEVT_R4K=y # CONFIG_CGROUP_SCHED is not set CONFIG_CMDLINE="console=ttyS0,115200" # CONFIG_COMEDI is not set -CONFIG_COMPAT=y CONFIG_COMPAT_BRK=y +CONFIG_COMPAT=y CONFIG_CPU_BIG_ENDIAN=y CONFIG_CPU_CAVIUM_OCTEON=y CONFIG_CPU_HAS_PREFETCH=y @@ -84,8 +84,8 @@ CONFIG_DEBUG_INFO=y CONFIG_DEBUG_KERNEL=y # CONFIG_DEBUG_KOBJECT is not set # CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_DEBUG_MUTEXES is not set # CONFIG_DEBUG_NOTIFIERS is not set # CONFIG_DEBUG_OBJECTS is not set @@ -93,8 +93,8 @@ CONFIG_DEBUG_KERNEL=y # CONFIG_DEBUG_SG is not set # CONFIG_DEBUG_SHIRQ is not set # CONFIG_DEBUG_SLAB is not set -CONFIG_DEBUG_SPINLOCK=y CONFIG_DEBUG_SPINLOCK_SLEEP=y +CONFIG_DEBUG_SPINLOCK=y # CONFIG_DEBUG_STACK_USAGE is not set # CONFIG_DEBUG_VM is not set # CONFIG_DEBUG_WRITECOUNT is not set @@ -117,8 +117,8 @@ CONFIG_FAIR_GROUP_SCHED=y # CONFIG_FLATMEM_MANUAL is not set CONFIG_FRAME_WARN=2048 # CONFIG_FW_LOADER is not set -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -133,32 +133,32 @@ CONFIG_HAVE_ARCH_KGDB=y # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set CONFIG_HAVE_IDE=y CONFIG_HAVE_MEMORY_PRESENT=y -CONFIG_HAVE_MLOCK=y CONFIG_HAVE_MLOCKED_PAGE_BIT=y +CONFIG_HAVE_MLOCK=y CONFIG_HAVE_OPROFILE=y CONFIG_HAVE_SYSCALL_WRAPPERS=y # CONFIG_HECI is not set # CONFIG_HIGH_RES_TIMERS is not set CONFIG_HW_HAS_PCI=y -CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_OCTEON=y -CONFIG_HZ=250 +CONFIG_HW_RANDOM=y # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set CONFIG_INITRAMFS_SOURCE="" -CONFIG_INOTIFY=y CONFIG_INOTIFY_USER=y -CONFIG_IRQ_CPU=y +CONFIG_INOTIFY=y CONFIG_IRQ_CPU_OCTEON=y +CONFIG_IRQ_CPU=y CONFIG_IRQ_PER_CPU=y # CONFIG_ISDN is not set -CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_ALL is not set +CONFIG_KALLSYMS=y CONFIG_KEXEC=y # CONFIG_KGDB is not set -CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LEGACY_PTYS=y # CONFIG_LEMOTE_FULONG is not set CONFIG_LOCK_KERNEL=y # CONFIG_LOCK_STAT is not set @@ -172,7 +172,6 @@ CONFIG_MAGIC_SYSRQ=y # CONFIG_ME4000 is not set # CONFIG_MEILHAUS is not set # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y CONFIG_MIPS32_COMPAT=y CONFIG_MIPS32_N32=y CONFIG_MIPS32_O32=y @@ -185,6 +184,7 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y # CONFIG_MISC_DEVICES is not set # CONFIG_MTD_CFI_INTELEXT is not set # CONFIG_MTD_COMPLEX_MAPPINGS is not set @@ -201,9 +201,9 @@ CONFIG_OCTEON_MGMT=y CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PAGE_POISONING is not set # CONFIG_PARTITION_ADVANCED is not set -CONFIG_PCI=y # CONFIG_PCI_DEBUG is not set CONFIG_PCI_DOMAINS=y +CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYS_ADDR_T_64BIT=y # CONFIG_PLAN9AUTH is not set @@ -212,20 +212,20 @@ CONFIG_PHYS_ADDR_T_64BIT=y # CONFIG_PNX8550_JBS is not set # CONFIG_PNX8550_STB810 is not set # CONFIG_POHMELFS is not set -CONFIG_POSIX_MQUEUE=y CONFIG_POSIX_MQUEUE_SYSCTL=y +CONFIG_POSIX_MQUEUE=y # CONFIG_PROBE_INITRD_HEADER is not set CONFIG_PROC_PAGE_MONITOR=y # CONFIG_PROVE_LOCKING is not set # CONFIG_RCU_TORTURE_TEST is not set CONFIG_RELAY=y -# CONFIG_RTL8187SE is not set # CONFIG_RT_GROUP_SCHED is not set +# CONFIG_RTL8187SE is not set # CONFIG_RT_MUTEX_TESTER is not set # CONFIG_RUNTIME_DEBUG is not set -# CONFIG_SCHEDSTATS is not set CONFIG_SCHED_DEBUG=y CONFIG_SCHED_OMIT_FRAME_POINTER=y +# CONFIG_SCHEDSTATS is not set # CONFIG_SCSI_DMA is not set CONFIG_SECCOMP=y # CONFIG_SERIAL_8250_EXTENDED is not set @@ -243,16 +243,15 @@ CONFIG_SECCOMP=y # CONFIG_SIBYTE_SWARM is not set # CONFIG_SLOW_WORK is not set CONFIG_SMP=y -CONFIG_SPARSEMEM=y CONFIG_SPARSEMEM_MANUAL=y CONFIG_SPARSEMEM_STATIC=y -CONFIG_STAGING=y +CONFIG_SPARSEMEM=y # CONFIG_STAGING_EXCLUDE_BUILD is not set +CONFIG_STAGING=y CONFIG_STOP_MACHINE=y CONFIG_SWAP_IO_SPACE=y -CONFIG_SYSFS_DEPRECATED=y CONFIG_SYSFS_DEPRECATED_V2=y -CONFIG_SYSVIPC_COMPAT=y +CONFIG_SYSFS_DEPRECATED=y CONFIG_SYS_HAS_CPU_CAVIUM_OCTEON=y CONFIG_SYS_HAS_EARLY_PRINTK=y CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y @@ -260,13 +259,14 @@ CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y CONFIG_SYS_SUPPORTS_HIGHMEM=y CONFIG_SYS_SUPPORTS_SMP=y +CONFIG_SYSVIPC_COMPAT=y # CONFIG_TC35815 is not set # CONFIG_TIMER_STATS is not set CONFIG_TRACING_SUPPORT=y CONFIG_UNEVICTABLE_LRU=y CONFIG_USB_SUPPORT=y -CONFIG_USER_SCHED=y CONFIG_USE_GENERIC_SMP_HELPERS=y +CONFIG_USER_SCHED=y # CONFIG_VLAN_8021Q is not set CONFIG_VM_EVENT_COUNTERS=y CONFIG_WEAK_ORDERING=y diff --git a/target/linux/olpc/config-2.6.30 b/target/linux/olpc/config-2.6.30 index f4f32e0a9..dac5ea2c1 100644 --- a/target/linux/olpc/config-2.6.30 +++ b/target/linux/olpc/config-2.6.30 @@ -1,6 +1,5 @@ CONFIG_4KSTACKS=y # CONFIG_64BIT is not set -CONFIG_ACPI=y CONFIG_ACPI_AC=y # CONFIG_ACPI_ASUS is not set CONFIG_ACPI_BATTERY=y @@ -13,15 +12,16 @@ CONFIG_ACPI_BUTTON=y CONFIG_ACPI_FAN=y # CONFIG_ACPI_PCI_SLOT is not set CONFIG_ACPI_PROCESSOR=y +CONFIG_ACPI_PROC_EVENT=y # CONFIG_ACPI_PROCFS is not set CONFIG_ACPI_PROCFS_POWER=y -CONFIG_ACPI_PROC_EVENT=y # CONFIG_ACPI_SBS is not set CONFIG_ACPI_SLEEP=y CONFIG_ACPI_SYSFS_POWER=y CONFIG_ACPI_THERMAL=y # CONFIG_ACPI_TOSHIBA is not set # CONFIG_ACPI_WMI is not set +CONFIG_ACPI=y # CONFIG_AGP is not set # CONFIG_APM is not set CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" @@ -57,8 +57,8 @@ CONFIG_BINFMT_MISC=y CONFIG_BITREVERSE=y # CONFIG_BLK_DEV is not set CONFIG_BLK_DEV_SD=y -CONFIG_BLK_DEV_SR=y CONFIG_BLK_DEV_SR_VENDOR=y +CONFIG_BLK_DEV_SR=y # CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set @@ -74,7 +74,6 @@ CONFIG_CLOCKSOURCE_WATCHDOG=y CONFIG_COMPAT_VDSO=y CONFIG_CONSOLE_TRANSLATIONS=y # CONFIG_CPA_DEBUG is not set -CONFIG_CPU_FREQ=y # CONFIG_CPU_FREQ_DEBUG is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set @@ -86,12 +85,13 @@ CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_GOV_PERFORMANCE=y # CONFIG_CPU_FREQ_GOV_POWERSAVE is not set # CONFIG_CPU_FREQ_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_STAT=y # CONFIG_CPU_FREQ_STAT_DETAILS is not set +CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_FREQ_TABLE=y -CONFIG_CPU_IDLE=y +CONFIG_CPU_FREQ=y CONFIG_CPU_IDLE_GOV_LADDER=y CONFIG_CPU_IDLE_GOV_MENU=y +CONFIG_CPU_IDLE=y CONFIG_CPU_SUP_AMD=y # CONFIG_CPU_SUP_CENTAUR is not set # CONFIG_CPU_SUP_CYRIX_32 is not set @@ -115,8 +115,8 @@ CONFIG_CRYPTO_WORKQUEUE=y CONFIG_DEBUG_KERNEL=y # CONFIG_DEBUG_KOBJECT is not set # CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_DEBUG_MUTEXES is not set # CONFIG_DEBUG_NOTIFIERS is not set # CONFIG_DEBUG_NX_TEST is not set @@ -142,12 +142,12 @@ CONFIG_DETECT_SOFTLOCKUP=y CONFIG_DEVPORT=y CONFIG_DISPLAY_SUPPORT=y # CONFIG_DMA_API_DEBUG is not set -CONFIG_DMI=y CONFIG_DMIID=y +CONFIG_DMI=y CONFIG_DOUBLEFAULT=y CONFIG_DUMMY_CONSOLE=y -CONFIG_EARLY_PRINTK=y # CONFIG_EARLY_PRINTK_DBGP is not set +CONFIG_EARLY_PRINTK=y # CONFIG_EDAC is not set # CONFIG_EDD is not set # CONFIG_EEEPC_LAPTOP is not set @@ -156,33 +156,33 @@ CONFIG_ELF_CORE=y CONFIG_EXT2_FS=y CONFIG_FAST_CMPXCHG_LOCAL=y # CONFIG_FAULT_INJECTION is not set -CONFIG_FB=y CONFIG_FB_CFB_COPYAREA=y CONFIG_FB_CFB_FILLRECT=y CONFIG_FB_CFB_IMAGEBLIT=y -CONFIG_FB_GEODE=y -# CONFIG_FB_GEODE_GX is not set # CONFIG_FB_GEODE_GX1 is not set +# CONFIG_FB_GEODE_GX is not set CONFIG_FB_GEODE_LX=y +CONFIG_FB_GEODE=y +CONFIG_FB=y # CONFIG_FCOE_FNIC is not set # CONFIG_FIRMWARE_EDID is not set # CONFIG_FIRMWARE_MEMMAP is not set CONFIG_FIX_EARLYCON_MEM=y -# CONFIG_FONTS is not set CONFIG_FONT_8x16=y CONFIG_FONT_8x8=y -CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FONTS is not set CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y +CONFIG_FRAMEBUFFER_CONSOLE=y # CONFIG_FRAME_POINTER is not set CONFIG_FREEZER=y # CONFIG_FTRACE_STARTUP_TEST is not set # CONFIG_FTRACE_SYSCALLS is not set # CONFIG_FUJITSU_LAPTOP is not set CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y # CONFIG_GENERIC_CPU is not set CONFIG_GENERIC_FIND_FIRST_BIT=y @@ -210,8 +210,8 @@ CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y CONFIG_HAVE_FTRACE_SYSCALLS=y CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y +CONFIG_HAVE_FUNCTION_TRACER=y CONFIG_HAVE_GENERIC_DMA_COHERENT=y CONFIG_HAVE_IDE=y CONFIG_HAVE_IOREMAP_PROT=y @@ -220,8 +220,8 @@ CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_LZMA=y CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_KVM=y CONFIG_HAVE_KVM_IRQCHIP=y +CONFIG_HAVE_KVM=y CONFIG_HAVE_LATENCYTOP_SUPPORT=y CONFIG_HAVE_MLOCK=y CONFIG_HAVE_MMIOTRACE_SUPPORT=y @@ -229,37 +229,35 @@ CONFIG_HAVE_OPROFILE=y CONFIG_HAVE_SETUP_PER_CPU_AREA=y CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y CONFIG_HIBERNATION=y -CONFIG_HID=y CONFIG_HID_SUPPORT=y +CONFIG_HID=y # CONFIG_HIGHMEM4G is not set # CONFIG_HIGHMEM64G is not set -# CONFIG_HPET is not set CONFIG_HPET_EMULATE_RTC=y +# CONFIG_HPET is not set CONFIG_HPET_TIMER=y CONFIG_HT_IRQ=y # CONFIG_HUGETLBFS is not set CONFIG_HW_CONSOLE=y -CONFIG_HW_RANDOM=y # CONFIG_HW_RANDOM_AMD is not set CONFIG_HW_RANDOM_GEODE=y # CONFIG_HW_RANDOM_INTEL is not set CONFIG_HW_RANDOM_VIA=y +CONFIG_HW_RANDOM=y # CONFIG_I2C is not set # CONFIG_I8K is not set # CONFIG_IMA is not set CONFIG_INITRAMFS_SOURCE="" -CONFIG_INPUT=y CONFIG_INPUT_EVDEV=y CONFIG_INPUT_KEYBOARD=y -CONFIG_INPUT_MOUSE=y -CONFIG_INPUT_MOUSEDEV=y # CONFIG_INPUT_MOUSEDEV_PSAUX is not set CONFIG_INPUT_MOUSEDEV_SCREEN_X=1200 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=900 +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT_MOUSE=y +CONFIG_INPUT=y # CONFIG_INPUT_YEALINK is not set # CONFIG_INTEL_MENLOW is not set -# CONFIG_IOMMU_API is not set -# CONFIG_IOMMU_HELPER is not set CONFIG_IO_DELAY_0X80=y # CONFIG_IO_DELAY_0XED is not set # CONFIG_IO_DELAY_NONE is not set @@ -268,17 +266,19 @@ CONFIG_IO_DELAY_TYPE_0XED=1 CONFIG_IO_DELAY_TYPE_NONE=3 CONFIG_IO_DELAY_TYPE_UDELAY=2 # CONFIG_IO_DELAY_UDELAY is not set -# CONFIG_ISA is not set +# CONFIG_IOMMU_API is not set +# CONFIG_IOMMU_HELPER is not set CONFIG_ISA_DMA_API=y +# CONFIG_ISA is not set # CONFIG_ISCSI_IBFT_FIND is not set # CONFIG_ISDN is not set -CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_ALL is not set +CONFIG_KALLSYMS=y # CONFIG_KERNEL_BZIP2 is not set CONFIG_KERNEL_GZIP=y # CONFIG_KERNEL_LZMA is not set -CONFIG_KEXEC=y # CONFIG_KEXEC_JUMP is not set +CONFIG_KEXEC=y CONFIG_KEYBOARD_ATKBD=y # CONFIG_KEYBOARD_LKKBD is not set # CONFIG_KEYBOARD_NEWTON is not set @@ -316,12 +316,11 @@ CONFIG_MGEODE_LX=y # CONFIG_MK6 is not set # CONFIG_MK7 is not set # CONFIG_MK8 is not set -CONFIG_MMC=y CONFIG_MMC_BLOCK=y CONFIG_MMC_SDHCI=y +CONFIG_MMC=y # CONFIG_MMIOTRACE is not set # CONFIG_MOUSE_BCM5974 is not set -CONFIG_MOUSE_PS2=y CONFIG_MOUSE_PS2_ALPS=y # CONFIG_MOUSE_PS2_ELANTECH is not set CONFIG_MOUSE_PS2_LIFEBOOK=y @@ -330,11 +329,12 @@ CONFIG_MOUSE_PS2_OLPC=y CONFIG_MOUSE_PS2_SYNAPTICS=y # CONFIG_MOUSE_PS2_TOUCHKIT is not set CONFIG_MOUSE_PS2_TRACKPOINT=y +CONFIG_MOUSE_PS2=y # CONFIG_MOUSE_SERIAL is not set # CONFIG_MOUSE_VSXXXAA is not set # CONFIG_MPENTIUM4 is not set -# CONFIG_MPENTIUMII is not set # CONFIG_MPENTIUMIII is not set +# CONFIG_MPENTIUMII is not set # CONFIG_MPENTIUMM is not set # CONFIG_MPSC is not set # CONFIG_MSI_LAPTOP is not set @@ -349,12 +349,12 @@ CONFIG_MTD_PCI=y # CONFIG_MWINCHIP3D is not set # CONFIG_MWINCHIPC6 is not set # CONFIG_NETDEV_1000 is not set -# CONFIG_NETWORK_FILESYSTEMS is not set # CONFIG_NET_DROP_MONITOR is not set # CONFIG_NET_ETHERNET is not set +# CONFIG_NETWORK_FILESYSTEMS is not set CONFIG_NOHIGHMEM=y -CONFIG_NOP_TRACER=y CONFIG_NO_HZ=y +CONFIG_NOP_TRACER=y CONFIG_NR_CPUS=1 # CONFIG_NSC_GPIO is not set CONFIG_NVRAM=y @@ -367,32 +367,32 @@ CONFIG_PAGE_OFFSET=0xC0000000 # CONFIG_PARAVIRT_GUEST is not set # CONFIG_PARTITION_ADVANCED is not set # CONFIG_PC8736x_GPIO is not set -CONFIG_PCI=y -# CONFIG_PCIEPORTBUS is not set # CONFIG_PCI_DEBUG is not set CONFIG_PCI_DIRECT=y CONFIG_PCI_DOMAINS=y +# CONFIG_PCIEPORTBUS is not set # CONFIG_PCI_GOANY is not set # CONFIG_PCI_GOBIOS is not set # CONFIG_PCI_GODIRECT is not set # CONFIG_PCI_GOMMCONFIG is not set CONFIG_PCI_GOOLPC=y CONFIG_PCI_OLPC=y +CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y # CONFIG_PDA_POWER is not set CONFIG_PHYSICAL_ALIGN=0x100000 CONFIG_PHYSICAL_START=0x100000 -CONFIG_PM=y CONFIG_PM_DEBUG=y CONFIG_PM_SLEEP=y CONFIG_PM_STD_PARTITION="" # CONFIG_PM_TRACE_RTC is not set # CONFIG_PM_VERBOSE is not set -CONFIG_PNP=y +CONFIG_PM=y CONFIG_PNPACPI=y CONFIG_PNP_DEBUG_MESSAGES=y -CONFIG_POWER_SUPPLY=y +CONFIG_PNP=y # CONFIG_POWER_SUPPLY_DEBUG is not set +CONFIG_POWER_SUPPLY=y # CONFIG_POWER_TRACER is not set # CONFIG_PREEMPT_NONE is not set CONFIG_PREEMPT_VOLUNTARY=y @@ -408,32 +408,32 @@ CONFIG_RTC=y # CONFIG_RT_MUTEX_TESTER is not set # CONFIG_RWSEM_GENERIC_SPINLOCK is not set CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_SCHEDSTATS=y CONFIG_SCHED_DEBUG=y CONFIG_SCHED_HRTICK=y CONFIG_SCHED_OMIT_FRAME_POINTER=y +CONFIG_SCHEDSTATS=y CONFIG_SCSI=y # CONFIG_SCx200 is not set # CONFIG_SDIO_UART is not set # CONFIG_SERIAL_8250_EXTENDED is not set CONFIG_SERIAL_8250_PCI=y CONFIG_SERIAL_8250_PNP=y -CONFIG_SERIO=y # CONFIG_SERIO_CT82C710 is not set CONFIG_SERIO_I8042=y CONFIG_SERIO_LIBPS2=y # CONFIG_SERIO_PCIPS2 is not set # CONFIG_SERIO_RAW is not set CONFIG_SERIO_SERPORT=y +CONFIG_SERIO=y # CONFIG_SLOW_WORK is not set # CONFIG_SMP is not set # CONFIG_SONYPI is not set -CONFIG_SPARSEMEM_STATIC=y # CONFIG_SPARSE_IRQ is not set +CONFIG_SPARSEMEM_STATIC=y CONFIG_STACKTRACE=y CONFIG_STRICT_DEVMEM=y -CONFIG_SUSPEND=y CONFIG_SUSPEND_FREEZER=y +CONFIG_SUSPEND=y # CONFIG_SYSPROF_TRACER is not set # CONFIG_TC1100_WMI is not set # CONFIG_TELCLOCK is not set @@ -443,10 +443,9 @@ CONFIG_TICK_ONESHOT=y CONFIG_TIMER_STATS=y # CONFIG_TOSHIBA is not set CONFIG_TRACEPOINTS=y -CONFIG_TRACING=y CONFIG_TRACING_SUPPORT=y +CONFIG_TRACING=y CONFIG_UID16=y -CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_TT_NEWSCHED=y # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set @@ -456,35 +455,35 @@ CONFIG_USB_STORAGE=y CONFIG_USB_SUPPORT=y CONFIG_USB_SUSPEND=y CONFIG_USB_UHCI_HCD=y +CONFIG_USB=y CONFIG_USER_STACKTRACE_SUPPORT=y -CONFIG_VGACON_SOFT_SCROLLBACK=y CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=64 +CONFIG_VGACON_SOFT_SCROLLBACK=y CONFIG_VGA_CONSOLE=y CONFIG_VM86=y +CONFIG_VM_EVENT_COUNTERS=y # CONFIG_VMSPLIT_2G_OPT is not set # CONFIG_VMSPLIT_3G_OPT is not set -CONFIG_VM_EVENT_COUNTERS=y -CONFIG_VT=y CONFIG_VT_CONSOLE=y # CONFIG_VT_HW_CONSOLE_BINDING is not set +CONFIG_VT=y # CONFIG_WATCHDOG is not set -CONFIG_X86=y -CONFIG_X86_32=y CONFIG_X86_32_LAZY_GS=y +CONFIG_X86_32=y # CONFIG_X86_64 is not set # CONFIG_X86_ACPI_CPUFREQ is not set CONFIG_X86_BSWAP=y # CONFIG_X86_CHECK_BIOS_CORRUPTION is not set CONFIG_X86_CMPXCHG=y -CONFIG_X86_CPU=y +# CONFIG_X86_CPU_DEBUG is not set # CONFIG_X86_CPUFREQ_NFORCE2 is not set # CONFIG_X86_CPUID is not set -# CONFIG_X86_CPU_DEBUG is not set +CONFIG_X86_CPU=y CONFIG_X86_DEBUGCTLMSR=y # CONFIG_X86_DS is not set # CONFIG_X86_ELAN is not set -CONFIG_X86_EXTENDED_PLATFORM=y # CONFIG_X86_E_POWERSAVER is not set +CONFIG_X86_EXTENDED_PLATFORM=y CONFIG_X86_GENERIC=y # CONFIG_X86_GX_SUSPMOD is not set CONFIG_X86_INTEL_USERCOPY=y @@ -525,4 +524,5 @@ CONFIG_X86_USE_PPRO_CHECKSUM=y CONFIG_X86_VERBOSE_BOOTUP=y CONFIG_X86_WP_WORKS_OK=y CONFIG_X86_XADD=y +CONFIG_X86=y # CONFIG_ZONE_DMA32 is not set diff --git a/target/linux/orion/config-default b/target/linux/orion/config-default index 09d0a2cc2..842e9faf6 100644 --- a/target/linux/orion/config-default +++ b/target/linux/orion/config-default @@ -8,16 +8,16 @@ CONFIG_ARCH_ORION5X=y CONFIG_ARCH_SUPPORTS_AOUT=y # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARM=y # CONFIG_ARM_THUMB is not set +CONFIG_ARM=y # CONFIG_ARPD is not set # CONFIG_ARTHUR is not set CONFIG_ATA=m # CONFIG_ATA_NONSTANDARD is not set # CONFIG_ATA_PIIX is not set CONFIG_ATA_SFF=y -# CONFIG_ATM is not set # CONFIG_ATMEL is not set +# CONFIG_ATM is not set CONFIG_BASE_SMALL=0 # CONFIG_BINFMT_AOUT is not set CONFIG_BITREVERSE=y @@ -29,16 +29,16 @@ CONFIG_BOUNCE=y # CONFIG_CIFS_STATS is not set CONFIG_CLASSIC_RCU=y CONFIG_CMDLINE="root=/dev/mtdblock1 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200" -CONFIG_CPU_32=y CONFIG_CPU_32v5=y +CONFIG_CPU_32=y CONFIG_CPU_ABRT_EV5T=y CONFIG_CPU_CACHE_VIVT=y CONFIG_CPU_COPY_FEROCEON=y -CONFIG_CPU_CP15=y CONFIG_CPU_CP15_MMU=y +CONFIG_CPU_CP15=y # CONFIG_CPU_DCACHE_DISABLE is not set -CONFIG_CPU_FEROCEON=y CONFIG_CPU_FEROCEON_OLD_ID=y +CONFIG_CPU_FEROCEON=y # CONFIG_CPU_ICACHE_DISABLE is not set CONFIG_CPU_PABRT_NOIFAR=y CONFIG_CPU_TLB_V4WBI=y @@ -52,15 +52,15 @@ CONFIG_DLCI_MAX=8 # CONFIG_DM9000 is not set CONFIG_DNOTIFY=y # CONFIG_DSCC4 is not set -# CONFIG_E100 is not set # CONFIG_E1000E_ENABLED is not set +# CONFIG_E100 is not set # CONFIG_FARSYNC is not set # CONFIG_FPE_FASTFPE is not set # CONFIG_FPE_NWFPE is not set CONFIG_FRAME_POINTER=y CONFIG_FS_POSIX_ACL=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y # CONFIG_GENERIC_FIND_FIRST_BIT is not set # CONFIG_GENERIC_FIND_NEXT_BIT is not set CONFIG_GENERIC_GPIO=y @@ -75,20 +75,20 @@ CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y CONFIG_HAVE_LATENCYTOP_SUPPORT=y CONFIG_HAVE_OPROFILE=y -CONFIG_HDLC=m CONFIG_HDLC_CISCO=m CONFIG_HDLC_FR=m +CONFIG_HDLC=m CONFIG_HDLC_PPP=m -CONFIG_HDLC_RAW=m # CONFIG_HDLC_RAW_ETH is not set +CONFIG_HDLC_RAW=m # CONFIG_HERMES is not set -CONFIG_HWMON=y # CONFIG_HWMON_DEBUG_CHIP is not set +CONFIG_HWMON=y CONFIG_HW_RANDOM=y -CONFIG_I2C=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_MV64XXX=y +CONFIG_I2C=y # CONFIG_IDE is not set CONFIG_INITRAMFS_SOURCE="" # CONFIG_IP6_NF_MANGLE is not set @@ -99,9 +99,6 @@ CONFIG_INITRAMFS_SOURCE="" # CONFIG_IP6_NF_MATCH_OPTS is not set # CONFIG_IP6_NF_MATCH_RT is not set # CONFIG_IP6_NF_TARGET_LOG is not set -# CONFIG_IPV6_MROUTE is not set -CONFIG_IPV6_NDISC_NODETYPE=y -# CONFIG_IPV6_ROUTER_PREF is not set # CONFIG_IP_ADVANCED_ROUTER is not set CONFIG_IP_MROUTE=y # CONFIG_IP_NF_ARPTABLES is not set @@ -117,11 +114,14 @@ CONFIG_IP_MROUTE=y # CONFIG_IP_NF_TARGET_ULOG is not set CONFIG_IP_PIMSM_V1=y CONFIG_IP_PIMSM_V2=y +# CONFIG_IPV6_MROUTE is not set +CONFIG_IPV6_NDISC_NODETYPE=y +# CONFIG_IPV6_ROUTER_PREF is not set # CONFIG_IWLWIFI_LEDS is not set # CONFIG_LANMEDIA is not set # CONFIG_LATENCYTOP is not set -CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LEGACY_PTYS=y # CONFIG_LLC2 is not set CONFIG_LZO_COMPRESS=m CONFIG_LZO_DECOMPRESS=m @@ -132,8 +132,8 @@ CONFIG_MACH_DT2=y # CONFIG_MACH_KUROBOX_PRO is not set # CONFIG_MACH_LINKSTATION_MINI is not set # CONFIG_MACH_LINKSTATION_PRO is not set -# CONFIG_MACH_MV2120 is not set # CONFIG_MACH_MSS2 is not set +# CONFIG_MACH_MV2120 is not set # CONFIG_MACH_RD88F5181L_FXO is not set # CONFIG_MACH_RD88F5181L_GE is not set # CONFIG_MACH_RD88F5182 is not set @@ -144,8 +144,8 @@ CONFIG_MACH_DT2=y # CONFIG_MACH_TS78XX is not set CONFIG_MACH_WNR854T=y CONFIG_MACH_WRT350N_V2=y -CONFIG_MEDIA_TUNER=m # CONFIG_MEDIA_TUNER_CUSTOMIZE is not set +CONFIG_MEDIA_TUNER=m CONFIG_MEDIA_TUNER_MT20XX=m CONFIG_MEDIA_TUNER_SIMPLE=m CONFIG_MEDIA_TUNER_TDA8290=m @@ -155,10 +155,10 @@ CONFIG_MEDIA_TUNER_TEA5767=m CONFIG_MEDIA_TUNER_XC2028=m CONFIG_MEDIA_TUNER_XC5000=m # CONFIG_MINIX_FS is not set -CONFIG_MTD_PHYSMAP=y CONFIG_MTD_PHYSMAP_BANKWIDTH=1 CONFIG_MTD_PHYSMAP_LEN=0 CONFIG_MTD_PHYSMAP_START=0xf0000000 +CONFIG_MTD_PHYSMAP=y # CONFIG_MTD_REDBOOT_PARTS is not set CONFIG_MV643XX_ETH=y # CONFIG_NATSEMI is not set @@ -173,8 +173,8 @@ CONFIG_NET_DSA=y # CONFIG_NET_VENDOR_3COM is not set # CONFIG_NLS_CODEPAGE_437 is not set # CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_ISO8859_1 is not set # CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_ISO8859_1 is not set # CONFIG_NLS_KOI8_R is not set # CONFIG_NO_IOPORT is not set # CONFIG_NVRAM is not set @@ -185,10 +185,10 @@ CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PATA_ARTOP=m # CONFIG_PATA_SCH is not set # CONFIG_PC300 is not set -CONFIG_PCI=y # CONFIG_PCI200SYN is not set # CONFIG_PCIPCWATCHDOG is not set CONFIG_PCI_SYSCALL=y +CONFIG_PCI=y CONFIG_PLAT_ORION=y # CONFIG_PPP is not set # CONFIG_PRISM54 is not set @@ -206,8 +206,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4096 CONFIG_SYS_SUPPORTS_APM_EMULATION=y CONFIG_TICK_ONESHOT=y CONFIG_UID16=y -CONFIG_USB=m -# CONFIG_USBPCWATCHDOG is not set # CONFIG_USB_ACM is not set # CONFIG_USB_C67X00_HCD is not set # CONFIG_USB_CATC is not set @@ -215,9 +213,11 @@ CONFIG_USB_EHCI_HCD=m # CONFIG_USB_ISIGHTFW is not set # CONFIG_USB_ISP1760_HCD is not set # CONFIG_USB_KAWETH is not set +CONFIG_USB=m # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set CONFIG_USB_OHCI_HCD=m +# CONFIG_USBPCWATCHDOG is not set # CONFIG_USB_PEGASUS is not set # CONFIG_USB_PRINTER is not set # CONFIG_USB_R8A66597_HCD is not set @@ -235,17 +235,17 @@ CONFIG_USB_OHCI_HCD=m CONFIG_USB_SUPPORT=y CONFIG_USB_UHCI_HCD=m # CONFIG_USB_USBNET is not set +# CONFIG_USB_VIDEO_CLASS is not set # CONFIG_USB_WDM is not set CONFIG_VECTORS_BASE=0xffff0000 # CONFIG_VFP is not set # CONFIG_VGASTATE is not set # CONFIG_VIA_RHINE is not set CONFIG_VIDEO_MEDIA=m -CONFIG_VM_EVENT_COUNTERS=y # CONFIG_VIDEO_SAA717X is not set -# CONFIG_USB_VIDEO_CLASS is not set -CONFIG_WAN=y +CONFIG_VM_EVENT_COUNTERS=y # CONFIG_WANXL is not set +CONFIG_WAN=y # CONFIG_XFS_FS is not set # CONFIG_XIP_KERNEL is not set CONFIG_ZBOOT_ROM_BSS=0x0 diff --git a/target/linux/orion/harddisk/config-default b/target/linux/orion/harddisk/config-default index 5f66c0312..d17044860 100644 --- a/target/linux/orion/harddisk/config-default +++ b/target/linux/orion/harddisk/config-default @@ -1,35 +1,35 @@ -CONFIG_SWAP=y -CONFIG_LBD=y -CONFIG_BLK_DEV_SD=y CONFIG_ATA=y -CONFIG_SATA_MV=y -CONFIG_MD=y -CONFIG_BLK_DEV_MD=y -CONFIG_MD_AUTODETECT=y -CONFIG_MD_LINEAR=y -CONFIG_MD_RAID0=y -CONFIG_MD_RAID1=y -# CONFIG_MD_RAID10 is not set -# CONFIG_MD_RAID456 is not set -# CONFIG_MD_MULTIPATH is not set -# CONFIG_MD_FAULTY is not set CONFIG_BLK_DEV_DM=y -# CONFIG_DM_DEBUG is not set +CONFIG_BLK_DEV_MD=y +CONFIG_BLK_DEV_SD=y # CONFIG_DM_CRYPT is not set -# CONFIG_DM_SNAPSHOT is not set -# CONFIG_DM_MIRROR is not set -# CONFIG_DM_ZERO is not set -# CONFIG_DM_MULTIPATH is not set +# CONFIG_DM_DEBUG is not set # CONFIG_DM_DELAY is not set +# CONFIG_DM_MIRROR is not set +# CONFIG_DM_MULTIPATH is not set +# CONFIG_DM_SNAPSHOT is not set # CONFIG_DM_UEVENT is not set +# CONFIG_DM_ZERO is not set +CONFIG_EXT2_FS=y +CONFIG_EXT3_FS=y +CONFIG_JBD=y +CONFIG_LBD=y +CONFIG_MD_AUTODETECT=y +# CONFIG_MD_FAULTY is not set +CONFIG_MD_LINEAR=y +# CONFIG_MD_MULTIPATH is not set +CONFIG_MD_RAID0=y +# CONFIG_MD_RAID10 is not set +CONFIG_MD_RAID1=y +# CONFIG_MD_RAID456 is not set +CONFIG_MD=y +CONFIG_SATA_MV=y +CONFIG_SWAP=y +CONFIG_USB_ARCH_HAS_EHCI=y CONFIG_USB_ARCH_HAS_HCD=y CONFIG_USB_ARCH_HAS_OHCI=y -CONFIG_USB_ARCH_HAS_EHCI=y -CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_ROOT_HUB_TT=y CONFIG_USB_EHCI_TT_NEWSCHED=y CONFIG_USB_STORAGE=y -CONFIG_EXT2_FS=y -CONFIG_EXT3_FS=y -CONFIG_JBD=y +CONFIG_USB=y diff --git a/target/linux/ppc40x/config-default b/target/linux/ppc40x/config-default index 5de51b042..7ac38dfd8 100644 --- a/target/linux/ppc40x/config-default +++ b/target/linux/ppc40x/config-default @@ -2,8 +2,8 @@ CONFIG_405EP=y CONFIG_405EX=y CONFIG_40x=y # CONFIG_44x is not set -CONFIG_4xx=y CONFIG_4xx_SOC=y +CONFIG_4xx=y # CONFIG_6xx is not set # CONFIG_ACADIA is not set # CONFIG_ADVANCED_OPTIONS is not set @@ -27,8 +27,8 @@ CONFIG_BITREVERSE=y # CONFIG_BOOKE_WDT is not set CONFIG_BOUNCE=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,jffs2 noinitrd" CONFIG_CMDLINE_BOOL=y +CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,jffs2 noinitrd" CONFIG_CONSISTENT_SIZE=0x00200000 # CONFIG_CPU_FREQ is not set CONFIG_CRYPTO_AEAD2=y @@ -50,8 +50,8 @@ CONFIG_EXTRA_TARGETS="uImage" CONFIG_FORCE_MAX_ZONEORDER=11 # CONFIG_FSL_ULI1575 is not set CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -86,11 +86,10 @@ CONFIG_HAVE_OPROFILE=y # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set # CONFIG_HCU4 is not set CONFIG_HW_RANDOM=y -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set -CONFIG_IBM_NEW_EMAC=y # CONFIG_IBM_NEW_EMAC_DEBUG is not set CONFIG_IBM_NEW_EMAC_EMAC4=y CONFIG_IBM_NEW_EMAC_POLL_WEIGHT=32 @@ -99,11 +98,12 @@ CONFIG_IBM_NEW_EMAC_RXB=256 CONFIG_IBM_NEW_EMAC_RX_COPY_THRESHOLD=256 CONFIG_IBM_NEW_EMAC_RX_SKB_HEADROOM=0 CONFIG_IBM_NEW_EMAC_TXB=256 +CONFIG_IBM_NEW_EMAC=y CONFIG_INITRAMFS_SOURCE="" # CONFIG_IOMMU_HELPER is not set # CONFIG_IPIC is not set -# CONFIG_IRQSTACKS is not set CONFIG_IRQ_PER_CPU=y +# CONFIG_IRQSTACKS is not set CONFIG_ISA_DMA_API=y CONFIG_KERNEL_START=0xc0000000 CONFIG_KILAUEA=y @@ -125,21 +125,20 @@ CONFIG_MTD_PHYSMAP_OF=y # CONFIG_NATSEMI is not set CONFIG_NOT_COHERENT_CACHE=y # CONFIG_NVRAM is not set -CONFIG_OF=y CONFIG_OF_DEVICE=y CONFIG_OF_GPIO=y +CONFIG_OF=y CONFIG_OPENRB=y CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xc0000000 -CONFIG_PCI=y -CONFIG_PCIEAER=y -CONFIG_PCIEPORTBUS=y CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y +CONFIG_PCIEAER=y +CONFIG_PCIEPORTBUS=y CONFIG_PCI_MSI=y CONFIG_PCI_SYSCALL=y +CONFIG_PCI=y CONFIG_PHYSICAL_START=0x00000000 -CONFIG_PPC=y CONFIG_PPC32=y CONFIG_PPC40x_SIMPLE=y CONFIG_PPC4xx_PCI_EXPRESS=y @@ -150,21 +149,22 @@ CONFIG_PPC4xx_PCI_EXPRESS=y # CONFIG_PPC_CELL is not set # CONFIG_PPC_CELL_NATIVE is not set # CONFIG_PPC_CLOCK is not set -CONFIG_PPC_DCR=y # CONFIG_PPC_DCR_MMIO is not set CONFIG_PPC_DCR_NATIVE=y +CONFIG_PPC_DCR=y # CONFIG_PPC_EARLY_DEBUG is not set # CONFIG_PPC_I8259 is not set # CONFIG_PPC_INDIRECT_IO is not set CONFIG_PPC_INDIRECT_PCI=y -CONFIG_PPC_MMU_NOHASH=y # CONFIG_PPC_MM_SLICES is not set +CONFIG_PPC_MMU_NOHASH=y # CONFIG_PPC_MPC106 is not set CONFIG_PPC_NEED_DMA_SYNC_OPS=y CONFIG_PPC_OF=y CONFIG_PPC_PCI_CHOICE=y # CONFIG_PPC_RTAS is not set CONFIG_PPC_UDBG_16550=y +CONFIG_PPC=y # CONFIG_PQ2ADS is not set CONFIG_PRINT_STACK_DEPTH=64 CONFIG_PROC_DEVICETREE=y diff --git a/target/linux/ppc44x/config-default b/target/linux/ppc44x/config-default index c9817d567..683e699af 100644 --- a/target/linux/ppc44x/config-default +++ b/target/linux/ppc44x/config-default @@ -2,15 +2,15 @@ CONFIG_440GX=y CONFIG_44x=y CONFIG_460EX=y -CONFIG_4xx=y CONFIG_4xx_SOC=y +CONFIG_4xx=y # CONFIG_6xx is not set # CONFIG_8139TOO is not set # CONFIG_ADVANCED_OPTIONS is not set # CONFIG_AGP is not set -# CONFIG_ARCHES is not set CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y +# CONFIG_ARCHES is not set CONFIG_ARCH_HAS_ILOG2_U32=y CONFIG_ARCH_HAS_WALK_MEMORY=y CONFIG_ARCH_MAY_HAVE_PC_FDC=y @@ -24,14 +24,14 @@ CONFIG_AUDIT_ARCH=y # CONFIG_BAMBOO is not set CONFIG_BASE_SMALL=0 CONFIG_BITREVERSE=y -CONFIG_BOOKE=y # CONFIG_BOOKE_WDT is not set +CONFIG_BOOKE=y CONFIG_BOUNCE=y CONFIG_CANYONLANDS=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CLASSIC_RCU=y -CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/mtdblock1 rootfstype=squashfs,jffs2 noinitrd" CONFIG_CMDLINE_BOOL=y +CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/mtdblock1 rootfstype=squashfs,jffs2 noinitrd" CONFIG_CONSISTENT_SIZE=0x00200000 CONFIG_CONSISTENT_START=0xff100000 # CONFIG_CPU_FREQ is not set @@ -46,8 +46,8 @@ CONFIG_EXTRA_TARGETS="uImage" CONFIG_FORCE_MAX_ZONEORDER=11 # CONFIG_FSL_ULI1575 is not set CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_NEXT_BIT=y CONFIG_GENERIC_GPIO=y @@ -77,11 +77,10 @@ CONFIG_HAVE_OPROFILE=y # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set # CONFIG_HIGHMEM is not set CONFIG_HW_RANDOM=y -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set -CONFIG_IBM_NEW_EMAC=y # CONFIG_IBM_NEW_EMAC_DEBUG is not set CONFIG_IBM_NEW_EMAC_EMAC4=y CONFIG_IBM_NEW_EMAC_POLL_WEIGHT=32 @@ -91,13 +90,14 @@ CONFIG_IBM_NEW_EMAC_RX_COPY_THRESHOLD=256 CONFIG_IBM_NEW_EMAC_RX_SKB_HEADROOM=0 CONFIG_IBM_NEW_EMAC_TAH=y CONFIG_IBM_NEW_EMAC_TXB=128 +CONFIG_IBM_NEW_EMAC=y CONFIG_IBM_NEW_EMAC_ZMII=y # CONFIG_IDE is not set CONFIG_INITRAMFS_SOURCE="" # CONFIG_IOMMU_HELPER is not set # CONFIG_IPIC is not set -# CONFIG_IRQSTACKS is not set CONFIG_IRQ_PER_CPU=y +# CONFIG_IRQSTACKS is not set CONFIG_ISA_DMA_API=y # CONFIG_KATMAI is not set CONFIG_KERNEL_START=0xc0000000 @@ -116,23 +116,22 @@ CONFIG_MTD_PHYSMAP_OF=y # CONFIG_NATSEMI is not set CONFIG_NOT_COHERENT_CACHE=y # CONFIG_NVRAM is not set -CONFIG_OF=y CONFIG_OF_DEVICE=y CONFIG_OF_GPIO=y +CONFIG_OF=y CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xc0000000 -CONFIG_PCI=y +CONFIG_PCI_DISABLE_COMMON_QUIRKS=y +CONFIG_PCI_DOMAINS=y CONFIG_PCIEAER=y # CONFIG_PCIEASPM is not set CONFIG_PCIEPORTBUS=y -CONFIG_PCI_DISABLE_COMMON_QUIRKS=y -CONFIG_PCI_DOMAINS=y CONFIG_PCI_MSI=y CONFIG_PCI_SYSCALL=y -CONFIG_PHYSICAL_START=0x00000000 +CONFIG_PCI=y CONFIG_PHYS_64BIT=y CONFIG_PHYS_ADDR_T_64BIT=y -CONFIG_PPC=y +CONFIG_PHYSICAL_START=0x00000000 CONFIG_PPC32=y CONFIG_PPC44x_SIMPLE=y CONFIG_PPC4xx_PCI_EXPRESS=y @@ -143,9 +142,9 @@ CONFIG_PPC4xx_PCI_EXPRESS=y # CONFIG_PPC_CELL is not set # CONFIG_PPC_CELL_NATIVE is not set # CONFIG_PPC_CLOCK is not set -CONFIG_PPC_DCR=y # CONFIG_PPC_DCR_MMIO is not set CONFIG_PPC_DCR_NATIVE=y +CONFIG_PPC_DCR=y # CONFIG_PPC_EARLY_DEBUG is not set CONFIG_PPC_FPU=y # CONFIG_PPC_I8259 is not set @@ -157,6 +156,7 @@ CONFIG_PPC_OF=y CONFIG_PPC_PCI_CHOICE=y # CONFIG_PPC_RTAS is not set CONFIG_PPC_UDBG_16550=y +CONFIG_PPC=y # CONFIG_PQ2ADS is not set CONFIG_PROC_DEVICETREE=y CONFIG_PTE_64BIT=y @@ -178,12 +178,12 @@ CONFIG_SERIAL_OF_PLATFORM=y CONFIG_TAISHAN=y CONFIG_TASK_SIZE=0xc0000000 CONFIG_TICK_ONESHOT=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_OHCI_HCD_PCI=y CONFIG_USB_EHCI_HCD_PPC_OF=y -CONFIG_USB_OHCI_HCD_PPC_OF=y +CONFIG_USB_OHCI_HCD_PCI=y CONFIG_USB_OHCI_HCD_PPC_OF_BE=y # CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set +CONFIG_USB_OHCI_HCD_PPC_OF=y +CONFIG_USB_SUPPORT=y # CONFIG_VGASTATE is not set # CONFIG_VIA_RHINE is not set # CONFIG_WARP is not set diff --git a/target/linux/ps3/config-2.6.30 b/target/linux/ps3/config-2.6.30 index cd88b8099..e937cb9ea 100644 --- a/target/linux/ps3/config-2.6.30 +++ b/target/linux/ps3/config-2.6.30 @@ -22,12 +22,12 @@ CONFIG_BASE_SMALL=0 # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=65535 +CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_SD=y -CONFIG_BLK_DEV_SR=y # CONFIG_BLK_DEV_SR_VENDOR is not set +CONFIG_BLK_DEV_SR=y CONFIG_BLOCK_COMPAT=y # CONFIG_BOOTX_TEXT is not set CONFIG_BOUNCE=y @@ -36,9 +36,9 @@ CONFIG_BOUNCE=y # CONFIG_CGROUP_SCHED is not set CONFIG_CMDLINE="" CONFIG_CMDLINE_BOOL=y -CONFIG_COMPAT=y CONFIG_COMPAT_BINFMT_ELF=y CONFIG_COMPAT_BRK=y +CONFIG_COMPAT=y CONFIG_CONSOLE_TRANSLATIONS=y # CONFIG_CPU_FREQ is not set CONFIG_CRC16=y @@ -57,33 +57,33 @@ CONFIG_ELF_CORE=y CONFIG_EXT2_FS=y CONFIG_EXT3_FS=y # CONFIG_EXT4DEV_COMPAT is not set -CONFIG_EXT4_FS=y # CONFIG_EXT4_FS_XATTR is not set +CONFIG_EXT4_FS=y CONFIG_FAIR_GROUP_SCHED=y CONFIG_FAT_FS=y -CONFIG_FB=y -CONFIG_FB_PS3=y CONFIG_FB_PS3_DEFAULT_SIZE_M=9 +CONFIG_FB_PS3=y CONFIG_FB_SYS_COPYAREA=y CONFIG_FB_SYS_FILLRECT=y CONFIG_FB_SYS_FOPS=y CONFIG_FB_SYS_IMAGEBLIT=y +CONFIG_FB=y # CONFIG_FIRMWARE_EDID is not set # CONFIG_FLATMEM_MANUAL is not set -# CONFIG_FONTS is not set CONFIG_FONT_8x16=y CONFIG_FONT_8x8=y +# CONFIG_FONTS is not set CONFIG_FORCE_MAX_ZONEORDER=13 -CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y +CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAME_WARN=2048 # CONFIG_FSL_ULI1575 is not set CONFIG_GELIC_NET=y # CONFIG_GELIC_WIRELESS is not set CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -119,7 +119,6 @@ CONFIG_HAVE_MLOCK=y CONFIG_HAVE_OPROFILE=y CONFIG_HAVE_SETUP_PER_CPU_AREA=y CONFIG_HAVE_SYSCALL_WRAPPERS=y -CONFIG_HID=y CONFIG_HID_APPLE=y CONFIG_HID_BELKIN=y CONFIG_HID_CHERRY=y @@ -129,39 +128,40 @@ CONFIG_HID_MICROSOFT=y CONFIG_HID_SONY=y CONFIG_HID_SUNPLUS=y CONFIG_HID_SUPPORT=y +CONFIG_HID=y # CONFIG_HIGH_RES_TIMERS is not set # CONFIG_HUGETLBFS is not set CONFIG_HW_CONSOLE=y # CONFIG_HW_RANDOM is not set -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set CONFIG_INITRAMFS_ROOT_GID=500 CONFIG_INITRAMFS_ROOT_UID=500 -CONFIG_INOTIFY=y CONFIG_INOTIFY_USER=y -CONFIG_INPUT=y +CONFIG_INOTIFY=y CONFIG_INPUT_EVDEV=y CONFIG_INPUT_JOYSTICK=y -CONFIG_INPUT_MOUSEDEV=y CONFIG_INPUT_MOUSEDEV_PSAUX=y CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT=y # CONFIG_INPUT_YEALINK is not set CONFIG_IOMMU_HELPER=y # CONFIG_IOMMU_VMERGE is not set -# CONFIG_IPIC is not set # CONFIG_IP_ADVANCED_ROUTER is not set +# CONFIG_IPIC is not set # CONFIG_IP_MULTICAST is not set -# CONFIG_IRQSTACKS is not set # CONFIG_IRQ_ALL_CPUS is not set CONFIG_IRQ_PER_CPU=y +# CONFIG_IRQSTACKS is not set CONFIG_ISA_DMA_API=y # CONFIG_ISDN is not set CONFIG_ISO9660_FS=y -CONFIG_JBD=y CONFIG_JBD2=y +CONFIG_JBD=y # CONFIG_JOYSTICK_A3D is not set # CONFIG_JOYSTICK_ADI is not set # CONFIG_JOYSTICK_ANALOG is not set @@ -187,11 +187,11 @@ CONFIG_KERNEL_START=0xc000000000000000 CONFIG_KEXEC=y # CONFIG_LEDS_TRIGGERS is not set CONFIG_LOCK_KERNEL=y -# CONFIG_LOGO is not set CONFIG_LOG_BUF_SHIFT=15 +# CONFIG_LOGO is not set # CONFIG_MACINTOSH_DRIVERS is not set -CONFIG_MEMORY_HOTPLUG=y CONFIG_MEMORY_HOTPLUG_SPARSE=y +CONFIG_MEMORY_HOTPLUG=y # CONFIG_MEMORY_HOTREMOVE is not set CONFIG_MIGRATION=y # CONFIG_MINI_FO is not set @@ -201,35 +201,34 @@ CONFIG_MIGRATION=y # CONFIG_MPIC_WEIRD is not set CONFIG_MSDOS_FS=y # CONFIG_MTD is not set +# CONFIG_NET_ETHERNET is not set # CONFIG_NETFILTER is not set # CONFIG_NETWORK_FILESYSTEMS is not set -# CONFIG_NET_ETHERNET is not set -CONFIG_NLS=y CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_ISO8859_1=y +CONFIG_NLS=y CONFIG_NR_CPUS=2 # CONFIG_NUMA is not set -CONFIG_OF=y CONFIG_OF_DEVICE=y +CONFIG_OF=y # CONFIG_PACKET_MMAP is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xc000000000000000 # CONFIG_PARTITION_ADVANCED is not set # CONFIG_PCI_DOMAINS is not set # CONFIG_PCI_SYSCALL is not set -CONFIG_PHYSICAL_START=0x00000000 CONFIG_PHYS_ADDR_T_64BIT=y +CONFIG_PHYSICAL_START=0x00000000 CONFIG_POWER3=y -CONFIG_POWER4=y # CONFIG_POWER4_ONLY is not set -CONFIG_PPC=y +CONFIG_POWER4=y CONFIG_PPC64=y # CONFIG_PPC_970_NAP is not set CONFIG_PPC_BOOK3S=y -CONFIG_PPC_CELL=y # CONFIG_PPC_CELLEB is not set # CONFIG_PPC_CELL_NATIVE is not set # CONFIG_PPC_CELL_QPACE is not set +CONFIG_PPC_CELL=y # CONFIG_PPC_CLOCK is not set # CONFIG_PPC_DCR_MMIO is not set # CONFIG_PPC_DCR_NATIVE is not set @@ -243,17 +242,18 @@ CONFIG_PPC_FPU=y # CONFIG_PPC_MAPLE is not set # CONFIG_PPC_MM_SLICES is not set # CONFIG_PPC_MPC106 is not set -CONFIG_PPC_OF=y # CONFIG_PPC_OF_BOOT_TRAMPOLINE is not set +CONFIG_PPC_OF=y # CONFIG_PPC_PASEMI is not set CONFIG_PPC_PCI_CHOICE=y # CONFIG_PPC_PMAC is not set CONFIG_PPC_PS3=y # CONFIG_PPC_PSERIES is not set # CONFIG_PPC_RTAS is not set -CONFIG_PPC_STD_MMU=y CONFIG_PPC_STD_MMU_64=y +CONFIG_PPC_STD_MMU=y # CONFIG_PPC_UDBG_16550 is not set +CONFIG_PPC=y # CONFIG_PQ2ADS is not set CONFIG_PRINT_STACK_DEPTH=64 CONFIG_PROC_DEVICETREE=y @@ -277,17 +277,17 @@ CONFIG_RWSEM_XCHGADD_ALGORITHM=y # CONFIG_SCHED_HRTICK is not set CONFIG_SCHED_OMIT_FRAME_POINTER=y # CONFIG_SCHED_SMT is not set -CONFIG_SCSI=y # CONFIG_SCSI_LOWLEVEL is not set # CONFIG_SCSI_PROC_FS is not set +CONFIG_SCSI=y # CONFIG_SERIAL_8250 is not set # CONFIG_SLOW_WORK is not set CONFIG_SMP=y -CONFIG_SPARSEMEM=y CONFIG_SPARSEMEM_EXTREME=y CONFIG_SPARSEMEM_MANUAL=y -# CONFIG_SPARSEMEM_VMEMMAP is not set CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +# CONFIG_SPARSEMEM_VMEMMAP is not set +CONFIG_SPARSEMEM=y # CONFIG_SPU_BASE is not set # CONFIG_SPU_FS is not set # CONFIG_SQUASHFS is not set @@ -299,18 +299,16 @@ CONFIG_SYSVIPC_COMPAT=y CONFIG_TRACING_SUPPORT=y CONFIG_TUNE_CELL=y # CONFIG_U3_DART is not set -CONFIG_USB=y # CONFIG_USB_DEVICEFS is not set CONFIG_USB_EHCI_BIG_ENDIAN_MMIO=y -CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_HCD_PPC_OF=y +CONFIG_USB_EHCI_HCD=y # CONFIG_USB_EHCI_ROOT_HUB_TT is not set CONFIG_USB_HID=y # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y -CONFIG_USB_OHCI_HCD=y # CONFIG_USB_OHCI_HCD_PPC_OF is not set -CONFIG_USB_STORAGE=y +CONFIG_USB_OHCI_HCD=y # CONFIG_USB_STORAGE_ALAUDA is not set # CONFIG_USB_STORAGE_DATAFAB is not set # CONFIG_USB_STORAGE_FREECOM is not set @@ -319,9 +317,11 @@ CONFIG_USB_STORAGE=y # CONFIG_USB_STORAGE_SDDR09 is not set # CONFIG_USB_STORAGE_SDDR55 is not set # CONFIG_USB_STORAGE_USBAT is not set +CONFIG_USB_STORAGE=y CONFIG_USB_SUPPORT=y -CONFIG_USER_SCHED=y +CONFIG_USB=y CONFIG_USE_GENERIC_SMP_HELPERS=y +CONFIG_USER_SCHED=y CONFIG_VFAT_FS=y # CONFIG_VGA_CONSOLE is not set CONFIG_VIDEO_OUTPUT_CONTROL=y @@ -329,9 +329,9 @@ CONFIG_VIRT_CPU_ACCOUNTING=y # CONFIG_VLAN_8021Q is not set CONFIG_VM_EVENT_COUNTERS=y # CONFIG_VSX is not set -CONFIG_VT=y CONFIG_VT_CONSOLE=y CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_VT=y # CONFIG_WATCHDOG is not set # CONFIG_WIRELESS is not set # CONFIG_WLAN_80211 is not set diff --git a/target/linux/pxa/config-default b/target/linux/pxa/config-default index 2bef8e371..fb9c9d7b0 100644 --- a/target/linux/pxa/config-default +++ b/target/linux/pxa/config-default @@ -5,18 +5,18 @@ CONFIG_ALIGNMENT_HANDLING=0x2 CONFIG_ALIGNMENT_TRAP=y CONFIG_APM_EMULATION=m # CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set -CONFIG_ARCH_GUMSTIX=y # CONFIG_ARCH_GUMSTIX_F is not set # CONFIG_ARCH_GUMSTIX_ORIG is not set CONFIG_ARCH_GUMSTIX_VERDEX=y +CONFIG_ARCH_GUMSTIX=y # CONFIG_ARCH_HAS_ILOG2_U32 is not set # CONFIG_ARCH_HAS_ILOG2_U64 is not set # CONFIG_ARCH_LUBBOCK is not set CONFIG_ARCH_MTD_XIP=y -CONFIG_ARCH_PXA=y # CONFIG_ARCH_PXA_IDP is not set -CONFIG_ARM=y +CONFIG_ARCH_PXA=y # CONFIG_ARM_THUMB is not set +CONFIG_ARM=y # CONFIG_ARPD is not set # CONFIG_ARTHUR is not set CONFIG_ATA=m @@ -27,10 +27,10 @@ CONFIG_BASE_SMALL=0 CONFIG_BITREVERSE=y # CONFIG_BLK_DEV_CRYPTOLOOP is not set # CONFIG_BLK_DEV_HD is not set -CONFIG_BLK_DEV_IDE=m CONFIG_BLK_DEV_IDECS=m CONFIG_BLK_DEV_IDEDISK=m # CONFIG_BLK_DEV_IDEDMA is not set +CONFIG_BLK_DEV_IDE=m # CONFIG_BLK_DEV_INITRD is not set # CONFIG_BONDING is not set # CONFIG_BSD_DISKLABEL is not set @@ -38,12 +38,12 @@ CONFIG_BLK_DEV_IDEDISK=m CONFIG_BT_GUMSTIX=m # CONFIG_CIFS is not set CONFIG_CMDLINE="console=ttyS0,115200n8" -CONFIG_CPU_32=y CONFIG_CPU_32v5=y +CONFIG_CPU_32=y CONFIG_CPU_ABRT_EV5T=y CONFIG_CPU_CACHE_VIVT=y -CONFIG_CPU_CP15=y CONFIG_CPU_CP15_MMU=y +CONFIG_CPU_CP15=y # CONFIG_CPU_DCACHE_DISABLE is not set # CONFIG_CPU_FREQ is not set CONFIG_CPU_TLB_V4WBI=y @@ -55,19 +55,18 @@ CONFIG_DUMMY_CONSOLE=y CONFIG_ENABLE_MUST_CHECK=y # CONFIG_EPOLL is not set # CONFIG_EXT2_FS is not set -CONFIG_FB=y CONFIG_FB_CFB_COPYAREA=y CONFIG_FB_CFB_FILLRECT=y CONFIG_FB_CFB_IMAGEBLIT=y -CONFIG_FB_PXA=y # CONFIG_FB_PXA_ALPS_CDOLLAR is not set # CONFIG_FB_PXA_NONEOFTHEABOVE is not set CONFIG_FB_PXA_PARAMETERS=y CONFIG_FB_PXA_SAMSUNG_LTE430WQ_F0C=y # CONFIG_FB_PXA_SHARP_LQ043_PSP is not set +CONFIG_FB_PXA=y CONFIG_FB_TILEBLITTING=y +CONFIG_FB=y # CONFIG_FIRMWARE_EDID is not set -CONFIG_FONTS=y # CONFIG_FONT_10x18 is not set CONFIG_FONT_6x11=y # CONFIG_FONT_7x14 is not set @@ -78,10 +77,11 @@ CONFIG_FONT_6x11=y # CONFIG_FONT_PEARL_8x8 is not set # CONFIG_FONT_SUN12x22 is not set # CONFIG_FONT_SUN8x16 is not set +CONFIG_FONTS=y # CONFIG_FPE_FASTFPE is not set # CONFIG_FPE_NWFPE is not set -CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y +CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAME_POINTER=y CONFIG_FS_POSIX_ACL=y CONFIG_GENERIC_GPIO=y @@ -90,31 +90,31 @@ CONFIG_HARDIRQS_SW_RESEND=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT=y # CONFIG_HERMES is not set -# CONFIG_HFSPLUS_FS is not set # CONFIG_HFS_FS is not set +# CONFIG_HFSPLUS_FS is not set CONFIG_HID=m CONFIG_HW_CONSOLE=y # CONFIG_HW_RANDOM is not set -CONFIG_I2C=m # CONFIG_I2C_ALGOBIT is not set CONFIG_I2C_CHARDEV=m +CONFIG_I2C=m CONFIG_I2C_PXA=m CONFIG_I2C_PXA_SLAVE=y -CONFIG_IDE=m # CONFIG_IDE_ARM is not set CONFIG_IDE_GENERIC=m +CONFIG_IDE=m # CONFIG_IEEE80211_SOFTMAC is not set # CONFIG_IFB is not set # CONFIG_INET_DIAG is not set -CONFIG_INOTIFY=y CONFIG_INOTIFY_USER=y -CONFIG_INPUT=y +CONFIG_INOTIFY=y CONFIG_INPUT_KEYBOARD=y CONFIG_INPUT_MOUSE=y CONFIG_INPUT_TOUCHSCREEN=y CONFIG_INPUT_TSDEV=m CONFIG_INPUT_TSDEV_SCREEN_X=480 CONFIG_INPUT_TSDEV_SCREEN_Y=272 +CONFIG_INPUT=y CONFIG_IP_NF_TARGET_MASQUERADE=m CONFIG_IP_NF_TARGET_REDIRECT=m # CONFIG_ISDN is not set @@ -128,18 +128,18 @@ CONFIG_KEYBOARD_ATKBD=m # CONFIG_KEYBOARD_SUNKBD is not set # CONFIG_KEYBOARD_XTKBD is not set # CONFIG_LLC2 is not set -CONFIG_LOGO=y CONFIG_LOGO_LINUX_CLUT224=y # CONFIG_LOGO_LINUX_MONO is not set # CONFIG_LOGO_LINUX_VGA16 is not set +CONFIG_LOGO=y # CONFIG_MACH_LOGICPD_PXA270 is not set # CONFIG_MACH_MAINSTONE is not set # CONFIG_MACH_TRIZEPS4 is not set CONFIG_MII=m # CONFIG_MINIX_FS is not set -CONFIG_MMC=y CONFIG_MMC_BLOCK=y CONFIG_MMC_PXA=y +CONFIG_MMC=y CONFIG_MOUSE_PS2=m # CONFIG_MOUSE_SERIAL is not set # CONFIG_MOUSE_VSXXXAA is not set @@ -163,41 +163,41 @@ CONFIG_NO_IDLE_HZ=y CONFIG_PATA_PCMCIA=m # CONFIG_PATA_PLATFORM is not set CONFIG_PCCARD=m -CONFIG_PCMCIA=m CONFIG_PCMCIA_LOAD_CIS=y +CONFIG_PCMCIA=m CONFIG_PCMCIA_PXA2XX=m -CONFIG_PM=y # CONFIG_PM_DEBUG is not set # CONFIG_PM_LEGACY is not set # CONFIG_PM_SYSFS_DEPRECATED is not set +CONFIG_PM=y # CONFIG_PNPACPI is not set -CONFIG_PROC_GPIO=m # CONFIG_PROC_GPIO_DEBUG is not set +CONFIG_PROC_GPIO=m CONFIG_PXA27x=y # CONFIG_PXA_SHARPSL is not set CONFIG_SA1100_WATCHDOG=m # CONFIG_SCSI_MULTI_LUN is not set # CONFIG_SCSI_PROC_FS is not set # CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_PXA=y CONFIG_SERIAL_PXA_CONSOLE=y -CONFIG_SERIO=m +CONFIG_SERIAL_PXA=y CONFIG_SERIO_LIBPS2=m +CONFIG_SERIO=m # CONFIG_SERIO_RAW is not set CONFIG_SERIO_SERPORT=m -CONFIG_SMC911X=m CONFIG_SMC911X_GUMSTIX=m -CONFIG_SMC91X=m +CONFIG_SMC911X=m CONFIG_SMC91X_GUMSTIX=m +CONFIG_SMC91X=m CONFIG_SND_AC97_CODEC=m CONFIG_SND_PXA2XX_AC97=m CONFIG_SND_PXA2XX_PCM=m -CONFIG_SND_PXA2XX_SOC=m CONFIG_SND_PXA2XX_SOC_AC97=m CONFIG_SND_PXA2XX_SOC_GUMSTIX=m -CONFIG_SND_SOC=m +CONFIG_SND_PXA2XX_SOC=m CONFIG_SND_SOC_AC97_BUS=y CONFIG_SND_SOC_AC97_CODEC=m +CONFIG_SND_SOC=m # CONFIG_SND_USB_AUDIO is not set # CONFIG_SND_VERBOSE_PROCFS is not set CONFIG_SPLIT_PTLOCK_CPUS=4096 @@ -208,7 +208,6 @@ CONFIG_TOUCHSCREEN_UCB1400=m CONFIG_UID16=y CONFIG_UNIX=m # CONFIG_UNUSED_SYMBOLS is not set -# CONFIG_USBPCWATCHDOG is not set # CONFIG_USB_ARCH_HAS_EHCI is not set # CONFIG_USB_CATC is not set # CONFIG_USB_GTCO is not set @@ -216,6 +215,7 @@ CONFIG_UNIX=m # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set CONFIG_USB_OHCI_HCD=m +# CONFIG_USBPCWATCHDOG is not set # CONFIG_USB_PEGASUS is not set # CONFIG_USB_SERIAL is not set # CONFIG_USB_STORAGE_ALAUDA is not set @@ -234,9 +234,9 @@ CONFIG_VECTORS_BASE=0xffff0000 # CONFIG_VGA_CONSOLE is not set # CONFIG_VIDEO_DEV is not set # CONFIG_VLAN_8021Q is not set -CONFIG_VT=y CONFIG_VT_CONSOLE=y CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_VT=y # CONFIG_XFRM_USER is not set # CONFIG_XFS_FS is not set # CONFIG_XIP_KERNEL is not set diff --git a/target/linux/pxcab/config-2.6.30 b/target/linux/pxcab/config-2.6.30 index 912a24859..c67ae8d9e 100644 --- a/target/linux/pxcab/config-2.6.30 +++ b/target/linux/pxcab/config-2.6.30 @@ -25,35 +25,34 @@ CONFIG_BASE_SMALL=0 # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=65535 +CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_SD=y -CONFIG_BLK_DEV_SR=y # CONFIG_BLK_DEV_SR_VENDOR is not set +CONFIG_BLK_DEV_SR=y CONFIG_BLOCK_COMPAT=y # CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 -# CONFIG_BOOTX_TEXT is not set # CONFIG_BOOT_PRINTK_DELAY is not set +# CONFIG_BOOTX_TEXT is not set CONFIG_BOUNCE=y # CONFIG_BRIDGE is not set # CONFIG_BSD_PROCESS_ACCT is not set -CONFIG_CBE_CPUFREQ=y # CONFIG_CBE_CPUFREQ_PMI_ENABLE is not set CONFIG_CBE_CPUFREQ_SPU_GOVERNOR=y +CONFIG_CBE_CPUFREQ=y CONFIG_CBE_RAS=y CONFIG_CBE_THERM=y # CONFIG_CGROUP_SCHED is not set CONFIG_CMDLINE_BOOL=y # CONFIG_CODE_PATCHING_SELFTEST is not set -CONFIG_COMPAT=y CONFIG_COMPAT_BINFMT_ELF=y CONFIG_COMPAT_BRK=y +CONFIG_COMPAT=y CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_CPU_FREQ=y # CONFIG_CPU_FREQ_DEBUG is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set @@ -65,9 +64,10 @@ CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_GOV_PERFORMANCE=y # CONFIG_CPU_FREQ_GOV_POWERSAVE is not set # CONFIG_CPU_FREQ_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_STAT=y # CONFIG_CPU_FREQ_STAT_DETAILS is not set +CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_FREQ_TABLE=y +CONFIG_CPU_FREQ=y CONFIG_CRC16=y CONFIG_CRC_CCITT=m # CONFIG_CRYPTO is not set @@ -80,8 +80,8 @@ CONFIG_DEBUG_INFO=y CONFIG_DEBUG_KERNEL=y # CONFIG_DEBUG_KOBJECT is not set # CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_DEBUG_MUTEXES is not set # CONFIG_DEBUG_NOTIFIERS is not set # CONFIG_DEBUG_OBJECTS is not set @@ -112,8 +112,8 @@ CONFIG_ELF_CORE=y CONFIG_EXT2_FS=y CONFIG_EXT3_FS=y # CONFIG_EXT4DEV_COMPAT is not set -CONFIG_EXT4_FS=y # CONFIG_EXT4_FS_XATTR is not set +CONFIG_EXT4_FS=y CONFIG_FAIR_GROUP_SCHED=y CONFIG_FAT_FS=y # CONFIG_FAULT_INJECTION is not set @@ -121,19 +121,19 @@ CONFIG_FB=y # CONFIG_FIRMWARE_EDID is not set CONFIG_FIRMWARE_IN_KERNEL=y # CONFIG_FLATMEM_MANUAL is not set -# CONFIG_FONTS is not set CONFIG_FONT_8x16=y CONFIG_FONT_8x8=y +# CONFIG_FONTS is not set CONFIG_FORCE_MAX_ZONEORDER=13 -CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y +CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAME_WARN=2048 # CONFIG_FSL_ULI1575 is not set # CONFIG_FTR_FIXUP_SELFTEST is not set CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -169,7 +169,6 @@ CONFIG_HAVE_MLOCK=y CONFIG_HAVE_OPROFILE=y CONFIG_HAVE_SETUP_PER_CPU_AREA=y CONFIG_HAVE_SYSCALL_WRAPPERS=y -CONFIG_HID=y CONFIG_HID_APPLE=y CONFIG_HID_BELKIN=y CONFIG_HID_CHERRY=y @@ -179,53 +178,54 @@ CONFIG_HID_MICROSOFT=y CONFIG_HID_SONY=y CONFIG_HID_SUNPLUS=y CONFIG_HID_SUPPORT=y +CONFIG_HID=y # CONFIG_HIGH_RES_TIMERS is not set # CONFIG_HUGETLBFS is not set -# CONFIG_HVCS is not set CONFIG_HVC_CONSOLE=y CONFIG_HVC_DRIVER=y CONFIG_HVC_IRQ=y # CONFIG_HVC_RTAS is not set +# CONFIG_HVCS is not set # CONFIG_HVC_UDBG is not set CONFIG_HW_CONSOLE=y # CONFIG_HW_RANDOM is not set -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set -# CONFIG_IBMEBUS is not set -CONFIG_IBMVIO=y # CONFIG_IBM_BSR is not set +# CONFIG_IBMEBUS is not set CONFIG_IBM_NEW_EMAC_EMAC4=y CONFIG_IBM_NEW_EMAC_RGMII=y CONFIG_IBM_NEW_EMAC_TAH=y CONFIG_IBM_NEW_EMAC_ZMII=y +CONFIG_IBMVIO=y CONFIG_INITRAMFS_ROOT_GID=500 CONFIG_INITRAMFS_ROOT_UID=500 CONFIG_INITRAMFS_SOURCE="/home/mita/scm/openwrt/build_dir/target-powerpc_uClibc-0.9.30.1/root-pxcab /home/mita/scm/openwrt/target/linux/generic-2.6/image/initramfs-base-files.txt" -CONFIG_INOTIFY=y CONFIG_INOTIFY_USER=y -CONFIG_INPUT=y +CONFIG_INOTIFY=y CONFIG_INPUT_EVDEV=y CONFIG_INPUT_JOYSTICK=y -CONFIG_INPUT_MOUSEDEV=y CONFIG_INPUT_MOUSEDEV_PSAUX=y CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT=y # CONFIG_INPUT_YEALINK is not set CONFIG_IOMMU_HELPER=y # CONFIG_IOMMU_VMERGE is not set -# CONFIG_IPIC is not set # CONFIG_IP_ADVANCED_ROUTER is not set +# CONFIG_IPIC is not set # CONFIG_IP_MULTICAST is not set -# CONFIG_IRQSTACKS is not set # CONFIG_IRQ_ALL_CPUS is not set CONFIG_IRQ_PER_CPU=y +# CONFIG_IRQSTACKS is not set CONFIG_ISA_DMA_API=y # CONFIG_ISDN is not set CONFIG_ISO9660_FS=y -CONFIG_JBD=y CONFIG_JBD2=y +CONFIG_JBD=y # CONFIG_JOYSTICK_A3D is not set # CONFIG_JOYSTICK_ADI is not set # CONFIG_JOYSTICK_ANALOG is not set @@ -247,78 +247,77 @@ CONFIG_JBD2=y # CONFIG_JOYSTICK_WARRIOR is not set # CONFIG_JOYSTICK_XPAD is not set # CONFIG_JOYSTICK_ZHENHUA is not set -CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_ALL is not set +CONFIG_KALLSYMS=y CONFIG_KERNEL_START=0xc000000000000000 CONFIG_KEXEC=y # CONFIG_KGDB is not set # CONFIG_LEDS_TRIGGERS is not set CONFIG_LOCK_KERNEL=y # CONFIG_LOCK_STAT is not set -# CONFIG_LOGO is not set CONFIG_LOG_BUF_SHIFT=15 +# CONFIG_LOGO is not set # CONFIG_LPARCFG is not set # CONFIG_MACINTOSH_DRIVERS is not set -CONFIG_MEMORY_HOTPLUG=y CONFIG_MEMORY_HOTPLUG_SPARSE=y +CONFIG_MEMORY_HOTPLUG=y # CONFIG_MEMORY_HOTREMOVE is not set CONFIG_MIGRATION=y # CONFIG_MINI_FO is not set # CONFIG_MISC_DEVICES is not set CONFIG_MMIO_NVRAM=y -CONFIG_MPIC=y # CONFIG_MPIC_WEIRD is not set +CONFIG_MPIC=y CONFIG_MSDOS_FS=y # CONFIG_MSI_BITMAP_SELFTEST is not set CONFIG_MTD_OF_PARTS=y CONFIG_MTD_PHYSMAP_OF=y CONFIG_NEED_MULTIPLE_NODES=y +# CONFIG_NET_ETHERNET is not set # CONFIG_NETFILTER is not set # CONFIG_NETWORK_FILESYSTEMS is not set -# CONFIG_NET_ETHERNET is not set -CONFIG_NLS=y CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_ISO8859_1=y +CONFIG_NLS=y CONFIG_NODES_SHIFT=4 CONFIG_NODES_SPAN_OTHER_NODES=y CONFIG_NR_CPUS=2 CONFIG_NUMA=y -CONFIG_OF=y CONFIG_OF_DEVICE=y +CONFIG_OF=y # CONFIG_PACKET_MMAP is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xc000000000000000 # CONFIG_PARTITION_ADVANCED is not set -CONFIG_PCI=y -# CONFIG_PCIEPORTBUS is not set # CONFIG_PCI_DEBUG is not set CONFIG_PCI_DOMAINS=y +# CONFIG_PCIEPORTBUS is not set CONFIG_PCI_SYSCALL=y +CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y CONFIG_PHYLIB=y # CONFIG_PHYP_DUMP is not set -CONFIG_PHYSICAL_START=0x00000000 CONFIG_PHYS_ADDR_T_64BIT=y +CONFIG_PHYSICAL_START=0x00000000 CONFIG_POWER3=y -CONFIG_POWER4=y # CONFIG_POWER4_ONLY is not set -CONFIG_PPC=y -CONFIG_PPC64=y +CONFIG_POWER4=y # CONFIG_PPC_16K_PAGES is not set # CONFIG_PPC_256K_PAGES is not set CONFIG_PPC_4K_PAGES=y # CONFIG_PPC_64K_PAGES is not set +CONFIG_PPC64=y # CONFIG_PPC_970_NAP is not set CONFIG_PPC_BOOK3S=y -CONFIG_PPC_CELL=y -# CONFIG_PPC_CELLEB is not set CONFIG_PPC_CELL_COMMON=y +# CONFIG_PPC_CELLEB is not set CONFIG_PPC_CELL_NATIVE=y # CONFIG_PPC_CELL_QPACE is not set +CONFIG_PPC_CELL=y # CONFIG_PPC_CLOCK is not set -CONFIG_PPC_DCR=y CONFIG_PPC_DCR_MMIO=y # CONFIG_PPC_DCR_NATIVE is not set +CONFIG_PPC_DCR=y # CONFIG_PPC_EARLY_DEBUG is not set CONFIG_PPC_FPU=y # CONFIG_PPC_HAS_HASH_64K is not set @@ -333,9 +332,9 @@ CONFIG_PPC_INDIRECT_IO=y # CONFIG_PPC_MM_SLICES is not set # CONFIG_PPC_MPC106 is not set CONFIG_PPC_NATIVE=y -CONFIG_PPC_OF=y CONFIG_PPC_OF_BOOT_TRAMPOLINE=y CONFIG_PPC_OF_PLATFORM_PCI=y +CONFIG_PPC_OF=y # CONFIG_PPC_PASEMI is not set CONFIG_PPC_PCI_CHOICE=y # CONFIG_PPC_PMAC is not set @@ -344,12 +343,13 @@ CONFIG_PPC_PSERIES=y CONFIG_PPC_RTAS=y # CONFIG_PPC_SMLPAR is not set # CONFIG_PPC_SPLPAR is not set -CONFIG_PPC_STD_MMU=y CONFIG_PPC_STD_MMU_64=y +CONFIG_PPC_STD_MMU=y CONFIG_PPC_UDBG_16550=y +CONFIG_PPC=y +CONFIG_PPP_ASYNC=m CONFIG_PPP=m CONFIG_PPPOE=m -CONFIG_PPP_ASYNC=m # CONFIG_PQ2ADS is not set CONFIG_PRINT_STACK_DEPTH=64 CONFIG_PROC_DEVICETREE=y @@ -364,14 +364,14 @@ CONFIG_RTAS_PROC=y # CONFIG_RT_MUTEX_TESTER is not set CONFIG_RWSEM_XCHGADD_ALGORITHM=y # CONFIG_SCANLOG is not set -# CONFIG_SCHEDSTATS is not set CONFIG_SCHED_DEBUG=y # CONFIG_SCHED_HRTICK is not set CONFIG_SCHED_OMIT_FRAME_POINTER=y # CONFIG_SCHED_SMT is not set -CONFIG_SCSI=y +# CONFIG_SCHEDSTATS is not set # CONFIG_SCSI_LOWLEVEL is not set # CONFIG_SCSI_PROC_FS is not set +CONFIG_SCSI=y # CONFIG_SERIAL_8250_EXTENDED is not set # CONFIG_SERIAL_ICOM is not set # CONFIG_SERIAL_OF_PLATFORM is not set @@ -382,11 +382,11 @@ CONFIG_SLHC=m # CONFIG_SLOW_WORK is not set CONFIG_SLUB=y CONFIG_SMP=y -CONFIG_SPARSEMEM=y CONFIG_SPARSEMEM_EXTREME=y CONFIG_SPARSEMEM_MANUAL=y -# CONFIG_SPARSEMEM_VMEMMAP is not set CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +# CONFIG_SPARSEMEM_VMEMMAP is not set +CONFIG_SPARSEMEM=y # CONFIG_SPIDER_NET is not set CONFIG_SPU_BASE=y CONFIG_SPU_FS=y @@ -403,17 +403,15 @@ CONFIG_TUNE_CELL=y # CONFIG_U3_DART is not set CONFIG_UDBG_RTAS_CONSOLE=y CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug2" -CONFIG_USB=y # CONFIG_USB_DEVICEFS is not set -CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_HCD_PPC_OF=y +CONFIG_USB_EHCI_HCD=y # CONFIG_USB_EHCI_ROOT_HUB_TT is not set CONFIG_USB_HID=y # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set -CONFIG_USB_OHCI_HCD=y # CONFIG_USB_OHCI_HCD_PPC_OF is not set -CONFIG_USB_STORAGE=y +CONFIG_USB_OHCI_HCD=y # CONFIG_USB_STORAGE_ALAUDA is not set # CONFIG_USB_STORAGE_DATAFAB is not set # CONFIG_USB_STORAGE_FREECOM is not set @@ -422,10 +420,12 @@ CONFIG_USB_STORAGE=y # CONFIG_USB_STORAGE_SDDR09 is not set # CONFIG_USB_STORAGE_SDDR55 is not set # CONFIG_USB_STORAGE_USBAT is not set +CONFIG_USB_STORAGE=y CONFIG_USB_SUPPORT=y # CONFIG_USB_UHCI_HCD is not set -CONFIG_USER_SCHED=y +CONFIG_USB=y CONFIG_USE_GENERIC_SMP_HELPERS=y +CONFIG_USER_SCHED=y CONFIG_VFAT_FS=y # CONFIG_VGA_CONSOLE is not set CONFIG_VIDEO_OUTPUT_CONTROL=y @@ -433,9 +433,9 @@ CONFIG_VIRT_CPU_ACCOUNTING=y # CONFIG_VLAN_8021Q is not set CONFIG_VM_EVENT_COUNTERS=y # CONFIG_VSX is not set -CONFIG_VT=y CONFIG_VT_CONSOLE=y CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_VT=y # CONFIG_WATCHDOG is not set # CONFIG_WIRELESS is not set # CONFIG_WLAN_80211 is not set diff --git a/target/linux/pxcab/config-2.6.31 b/target/linux/pxcab/config-2.6.31 index d5c4c9bd0..a2289ce04 100644 --- a/target/linux/pxcab/config-2.6.31 +++ b/target/linux/pxcab/config-2.6.31 @@ -25,12 +25,12 @@ CONFIG_BASE_SMALL=0 # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=65535 +CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_SD=y -CONFIG_BLK_DEV_SR=y # CONFIG_BLK_DEV_SR_VENDOR is not set +CONFIG_BLK_DEV_SR=y CONFIG_BLOCK_COMPAT=y # CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 @@ -39,21 +39,20 @@ CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 # CONFIG_BOOTX_TEXT is not set CONFIG_BOUNCE=y # CONFIG_BSD_PROCESS_ACCT is not set -CONFIG_CBE_CPUFREQ=y # CONFIG_CBE_CPUFREQ_PMI_ENABLE is not set CONFIG_CBE_CPUFREQ_SPU_GOVERNOR=y +CONFIG_CBE_CPUFREQ=y CONFIG_CBE_RAS=y CONFIG_CBE_THERM=y # CONFIG_CGROUP_SCHED is not set CONFIG_CMDLINE_BOOL=y # CONFIG_CNIC is not set # CONFIG_CODE_PATCHING_SELFTEST is not set -CONFIG_COMPAT=y CONFIG_COMPAT_BINFMT_ELF=y CONFIG_COMPAT_BRK=y +CONFIG_COMPAT=y CONFIG_CONSOLE_TRANSLATIONS=y CONFIG_CONSTRUCTORS=y -CONFIG_CPU_FREQ=y # CONFIG_CPU_FREQ_DEBUG is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set @@ -65,9 +64,10 @@ CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_GOV_PERFORMANCE=y # CONFIG_CPU_FREQ_GOV_POWERSAVE is not set # CONFIG_CPU_FREQ_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_STAT=y # CONFIG_CPU_FREQ_STAT_DETAILS is not set +CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_FREQ_TABLE=y +CONFIG_CPU_FREQ=y CONFIG_CRC16=y CONFIG_CRC_CCITT=m # CONFIG_CRYPTO is not set @@ -80,8 +80,8 @@ CONFIG_DEBUG_INFO=y CONFIG_DEBUG_KERNEL=y # CONFIG_DEBUG_KOBJECT is not set # CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_DEBUG_MUTEXES is not set # CONFIG_DEBUG_NOTIFIERS is not set # CONFIG_DEBUG_OBJECTS is not set @@ -113,8 +113,8 @@ CONFIG_ELF_CORE=y CONFIG_EXT2_FS=y CONFIG_EXT3_FS=y # CONFIG_EXT4DEV_COMPAT is not set -CONFIG_EXT4_FS=y # CONFIG_EXT4_FS_XATTR is not set +CONFIG_EXT4_FS=y CONFIG_FAIR_GROUP_SCHED=y CONFIG_FAT_FS=y # CONFIG_FAULT_INJECTION is not set @@ -122,20 +122,20 @@ CONFIG_FB=y # CONFIG_FIRMWARE_EDID is not set CONFIG_FIRMWARE_IN_KERNEL=y # CONFIG_FLATMEM_MANUAL is not set -# CONFIG_FONTS is not set CONFIG_FONT_8x16=y CONFIG_FONT_8x8=y +# CONFIG_FONTS is not set CONFIG_FORCE_MAX_ZONEORDER=13 -CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y +CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAME_WARN=2048 # CONFIG_FSL_ULI1575 is not set CONFIG_FSNOTIFY=y # CONFIG_FTR_FIXUP_SELFTEST is not set CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -168,13 +168,12 @@ CONFIG_HAVE_KRETPROBES=y CONFIG_HAVE_LATENCYTOP_SUPPORT=y CONFIG_HAVE_LMB=y CONFIG_HAVE_MEMORY_PRESENT=y -CONFIG_HAVE_MLOCK=y CONFIG_HAVE_MLOCKED_PAGE_BIT=y +CONFIG_HAVE_MLOCK=y CONFIG_HAVE_OPROFILE=y CONFIG_HAVE_PERF_COUNTERS=y CONFIG_HAVE_SETUP_PER_CPU_AREA=y CONFIG_HAVE_SYSCALL_WRAPPERS=y -CONFIG_HID=y CONFIG_HID_APPLE=y CONFIG_HID_BELKIN=y CONFIG_HID_CHERRY=y @@ -192,54 +191,55 @@ CONFIG_HID_SUNPLUS=y CONFIG_HID_SUPPORT=y # CONFIG_HID_THRUSTMASTER is not set # CONFIG_HID_TOPSEED is not set +CONFIG_HID=y # CONFIG_HID_ZEROPLUS is not set # CONFIG_HIGH_RES_TIMERS is not set # CONFIG_HUGETLBFS is not set -# CONFIG_HVCS is not set CONFIG_HVC_CONSOLE=y CONFIG_HVC_DRIVER=y CONFIG_HVC_IRQ=y # CONFIG_HVC_RTAS is not set +# CONFIG_HVCS is not set # CONFIG_HVC_UDBG is not set CONFIG_HW_CONSOLE=y # CONFIG_HW_RANDOM is not set -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set -# CONFIG_IBMEBUS is not set -CONFIG_IBMVIO=y # CONFIG_IBM_BSR is not set +# CONFIG_IBMEBUS is not set CONFIG_IBM_NEW_EMAC_EMAC4=y CONFIG_IBM_NEW_EMAC_RGMII=y CONFIG_IBM_NEW_EMAC_TAH=y CONFIG_IBM_NEW_EMAC_ZMII=y +CONFIG_IBMVIO=y # CONFIG_IEEE802154 is not set # CONFIG_INITRAMFS_COMPRESSION_NONE is not set CONFIG_INITRAMFS_SOURCE="" -CONFIG_INOTIFY=y CONFIG_INOTIFY_USER=y -CONFIG_INPUT=y +CONFIG_INOTIFY=y CONFIG_INPUT_EVDEV=y CONFIG_INPUT_JOYSTICK=y -CONFIG_INPUT_MOUSEDEV=y CONFIG_INPUT_MOUSEDEV_PSAUX=y CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT=y # CONFIG_INPUT_YEALINK is not set CONFIG_IOMMU_HELPER=y # CONFIG_IOMMU_VMERGE is not set -# CONFIG_IPIC is not set # CONFIG_IP_ADVANCED_ROUTER is not set +# CONFIG_IPIC is not set # CONFIG_IP_MULTICAST is not set -# CONFIG_IRQSTACKS is not set # CONFIG_IRQ_ALL_CPUS is not set CONFIG_IRQ_PER_CPU=y +# CONFIG_IRQSTACKS is not set CONFIG_ISA_DMA_API=y # CONFIG_ISDN is not set CONFIG_ISO9660_FS=y -CONFIG_JBD=y CONFIG_JBD2=y +CONFIG_JBD=y # CONFIG_JOYSTICK_A3D is not set # CONFIG_JOYSTICK_ADI is not set # CONFIG_JOYSTICK_ANALOG is not set @@ -261,8 +261,8 @@ CONFIG_JBD2=y # CONFIG_JOYSTICK_WARRIOR is not set # CONFIG_JOYSTICK_XPAD is not set # CONFIG_JOYSTICK_ZHENHUA is not set -CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_ALL is not set +CONFIG_KALLSYMS=y CONFIG_KERNEL_START=0xc000000000000000 CONFIG_KEXEC=y # CONFIG_KGDB is not set @@ -270,74 +270,73 @@ CONFIG_KEXEC=y # CONFIG_LEDS_TRIGGERS is not set CONFIG_LOCK_KERNEL=y # CONFIG_LOCK_STAT is not set -# CONFIG_LOGO is not set CONFIG_LOG_BUF_SHIFT=15 +# CONFIG_LOGO is not set # CONFIG_LPARCFG is not set # CONFIG_MACINTOSH_DRIVERS is not set # CONFIG_MEDIA_SUPPORT is not set -CONFIG_MEMORY_HOTPLUG=y CONFIG_MEMORY_HOTPLUG_SPARSE=y +CONFIG_MEMORY_HOTPLUG=y # CONFIG_MEMORY_HOTREMOVE is not set CONFIG_MIGRATION=y # CONFIG_MINI_FO is not set # CONFIG_MISC_DEVICES is not set CONFIG_MMIO_NVRAM=y -CONFIG_MPIC=y # CONFIG_MPIC_WEIRD is not set +CONFIG_MPIC=y CONFIG_MSDOS_FS=y # CONFIG_MSI_BITMAP_SELFTEST is not set CONFIG_MTD_OF_PARTS=y CONFIG_MTD_PHYSMAP_OF=y CONFIG_NEED_MULTIPLE_NODES=y +# CONFIG_NET_ETHERNET is not set # CONFIG_NETFILTER is not set # CONFIG_NETWORK_FILESYSTEMS is not set -# CONFIG_NET_ETHERNET is not set -CONFIG_NLS=y CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_ISO8859_1=y +CONFIG_NLS=y CONFIG_NODES_SHIFT=4 CONFIG_NODES_SPAN_OTHER_NODES=y CONFIG_NR_CPUS=2 CONFIG_NUMA=y -CONFIG_OF=y CONFIG_OF_DEVICE=y CONFIG_OF_MDIO=y +CONFIG_OF=y # CONFIG_PACKET_MMAP is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xc000000000000000 # CONFIG_PARTITION_ADVANCED is not set -CONFIG_PCI=y -# CONFIG_PCIEPORTBUS is not set # CONFIG_PCI_DEBUG is not set CONFIG_PCI_DOMAINS=y +# CONFIG_PCIEPORTBUS is not set CONFIG_PCI_SYSCALL=y +CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y # CONFIG_PERF_COUNTERS is not set CONFIG_PHYLIB=y # CONFIG_PHYP_DUMP is not set -CONFIG_PHYSICAL_START=0x00000000 CONFIG_PHYS_ADDR_T_64BIT=y +CONFIG_PHYSICAL_START=0x00000000 CONFIG_POWER3=y -CONFIG_POWER4=y # CONFIG_POWER4_ONLY is not set -CONFIG_PPC=y -CONFIG_PPC64=y +CONFIG_POWER4=y # CONFIG_PPC_16K_PAGES is not set # CONFIG_PPC_256K_PAGES is not set CONFIG_PPC_4K_PAGES=y # CONFIG_PPC_64K_PAGES is not set +CONFIG_PPC64=y # CONFIG_PPC_970_NAP is not set -CONFIG_PPC_BOOK3S=y CONFIG_PPC_BOOK3S_64=y -CONFIG_PPC_CELL=y -# CONFIG_PPC_CELLEB is not set +CONFIG_PPC_BOOK3S=y CONFIG_PPC_CELL_COMMON=y +# CONFIG_PPC_CELLEB is not set CONFIG_PPC_CELL_NATIVE=y # CONFIG_PPC_CELL_QPACE is not set +CONFIG_PPC_CELL=y # CONFIG_PPC_CLOCK is not set -CONFIG_PPC_DCR=y CONFIG_PPC_DCR_MMIO=y # CONFIG_PPC_DCR_NATIVE is not set +CONFIG_PPC_DCR=y # CONFIG_PPC_DISABLE_WERROR is not set # CONFIG_PPC_EARLY_DEBUG is not set CONFIG_PPC_FPU=y @@ -354,9 +353,9 @@ CONFIG_PPC_INDIRECT_IO=y # CONFIG_PPC_MM_SLICES is not set # CONFIG_PPC_MPC106 is not set CONFIG_PPC_NATIVE=y -CONFIG_PPC_OF=y CONFIG_PPC_OF_BOOT_TRAMPOLINE=y CONFIG_PPC_OF_PLATFORM_PCI=y +CONFIG_PPC_OF=y # CONFIG_PPC_PASEMI is not set CONFIG_PPC_PCI_CHOICE=y # CONFIG_PPC_PMAC is not set @@ -365,13 +364,14 @@ CONFIG_PPC_PSERIES=y CONFIG_PPC_RTAS=y # CONFIG_PPC_SMLPAR is not set # CONFIG_PPC_SPLPAR is not set -CONFIG_PPC_STD_MMU=y CONFIG_PPC_STD_MMU_64=y +CONFIG_PPC_STD_MMU=y CONFIG_PPC_UDBG_16550=y CONFIG_PPC_WERROR=y +CONFIG_PPC=y +CONFIG_PPP_ASYNC=m CONFIG_PPP=m CONFIG_PPPOE=m -CONFIG_PPP_ASYNC=m # CONFIG_PPS is not set # CONFIG_PQ2ADS is not set CONFIG_PRINT_STACK_DEPTH=64 @@ -383,19 +383,19 @@ CONFIG_PROC_PAGE_MONITOR=y CONFIG_RTAS_ERROR_LOGGING=y CONFIG_RTAS_FLASH=y CONFIG_RTAS_PROC=y -# CONFIG_RTL8306_PHY is not set # CONFIG_RT_GROUP_SCHED is not set +# CONFIG_RTL8306_PHY is not set # CONFIG_RT_MUTEX_TESTER is not set CONFIG_RWSEM_XCHGADD_ALGORITHM=y # CONFIG_SCANLOG is not set -# CONFIG_SCHEDSTATS is not set CONFIG_SCHED_DEBUG=y # CONFIG_SCHED_HRTICK is not set CONFIG_SCHED_OMIT_FRAME_POINTER=y # CONFIG_SCHED_SMT is not set -CONFIG_SCSI=y +# CONFIG_SCHEDSTATS is not set # CONFIG_SCSI_LOWLEVEL is not set # CONFIG_SCSI_PROC_FS is not set +CONFIG_SCSI=y # CONFIG_SERIAL_8250_EXTENDED is not set # CONFIG_SERIAL_ICOM is not set # CONFIG_SERIAL_OF_PLATFORM is not set @@ -406,11 +406,11 @@ CONFIG_SLHC=m # CONFIG_SLOW_WORK is not set CONFIG_SLUB=y CONFIG_SMP=y -CONFIG_SPARSEMEM=y CONFIG_SPARSEMEM_EXTREME=y CONFIG_SPARSEMEM_MANUAL=y -# CONFIG_SPARSEMEM_VMEMMAP is not set CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +# CONFIG_SPARSEMEM_VMEMMAP is not set +CONFIG_SPARSEMEM=y # CONFIG_SPIDER_NET is not set CONFIG_SPU_BASE=y CONFIG_SPU_FS=y @@ -428,19 +428,17 @@ CONFIG_TUNE_CELL=y # CONFIG_U3_DART is not set CONFIG_UDBG_RTAS_CONSOLE=y CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug2" -CONFIG_USB=y # CONFIG_USB_DEVICEFS is not set -CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_HCD_PPC_OF=y +CONFIG_USB_EHCI_HCD=y # CONFIG_USB_EHCI_ROOT_HUB_TT is not set CONFIG_USB_HID=y # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set -CONFIG_USB_OHCI_HCD=y -# CONFIG_USB_OHCI_HCD_PPC_OF is not set # CONFIG_USB_OHCI_HCD_PPC_OF_BE is not set +# CONFIG_USB_OHCI_HCD_PPC_OF is not set # CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set -CONFIG_USB_STORAGE=y +CONFIG_USB_OHCI_HCD=y # CONFIG_USB_STORAGE_ALAUDA is not set # CONFIG_USB_STORAGE_DATAFAB is not set # CONFIG_USB_STORAGE_FREECOM is not set @@ -449,11 +447,13 @@ CONFIG_USB_STORAGE=y # CONFIG_USB_STORAGE_SDDR09 is not set # CONFIG_USB_STORAGE_SDDR55 is not set # CONFIG_USB_STORAGE_USBAT is not set +CONFIG_USB_STORAGE=y CONFIG_USB_SUPPORT=y # CONFIG_USB_UHCI_HCD is not set # CONFIG_USB_XHCI_HCD is not set -CONFIG_USER_SCHED=y +CONFIG_USB=y CONFIG_USE_GENERIC_SMP_HELPERS=y +CONFIG_USER_SCHED=y CONFIG_VFAT_FS=y # CONFIG_VGA_CONSOLE is not set CONFIG_VIDEO_OUTPUT_CONTROL=y @@ -461,9 +461,9 @@ CONFIG_VIRT_CPU_ACCOUNTING=y # CONFIG_VLAN_8021Q is not set CONFIG_VM_EVENT_COUNTERS=y # CONFIG_VSX is not set -CONFIG_VT=y CONFIG_VT_CONSOLE=y CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_VT=y # CONFIG_WATCHDOG is not set # CONFIG_WIRELESS is not set # CONFIG_WLAN_80211 is not set diff --git a/target/linux/ramips/rt288x/config-2.6.30 b/target/linux/ramips/rt288x/config-2.6.30 index 6d61b34b7..1e4074802 100644 --- a/target/linux/ramips/rt288x/config-2.6.30 +++ b/target/linux/ramips/rt288x/config-2.6.30 @@ -14,8 +14,8 @@ CONFIG_BITREVERSE=y # CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CEVT_R4K=y CONFIG_CEVT_R4K_LIB=y +CONFIG_CEVT_R4K=y CONFIG_CMDLINE="console=ttyS1,57600 rootfstype=squashfs,jffs2" # CONFIG_CPU_BIG_ENDIAN is not set # CONFIG_CPU_CAVIUM_OCTEON is not set @@ -24,9 +24,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y CONFIG_CPU_LITTLE_ENDIAN=y # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS32_R1 is not set CONFIG_CPU_MIPS32_R2=y +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR2=y @@ -48,16 +48,16 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y # CONFIG_CPU_TX39XX is not set # CONFIG_CPU_TX49XX is not set # CONFIG_CPU_VR41XX is not set -CONFIG_CSRC_R4K=y CONFIG_CSRC_R4K_LIB=y +CONFIG_CSRC_R4K=y CONFIG_DECOMPRESS_LZMA=y CONFIG_DEVPORT=y # CONFIG_DM9000 is not set CONFIG_DMA_NEED_PCI_MAP_STATE=y CONFIG_DMA_NONCOHERENT=y CONFIG_EARLY_PRINTK=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -90,7 +90,6 @@ CONFIG_IRQ_CPU=y # CONFIG_MACH_VR41XX is not set # CONFIG_MII is not set # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set # CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=4 @@ -101,6 +100,7 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMTC is not set CONFIG_MIPS_RALINK=y # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y # CONFIG_MTD_CFI_INTELEXT is not set # CONFIG_MTD_COMPLEX_MAPPINGS is not set CONFIG_MTD_PHYSMAP=y @@ -109,8 +109,8 @@ CONFIG_MTD_PHYSMAP=y # CONFIG_NXP_STB220 is not set # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PCI=y CONFIG_PCI_DOMAINS=y +CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set diff --git a/target/linux/ramips/rt305x/config-2.6.30 b/target/linux/ramips/rt305x/config-2.6.30 index 026a22587..763c7a859 100644 --- a/target/linux/ramips/rt305x/config-2.6.30 +++ b/target/linux/ramips/rt305x/config-2.6.30 @@ -14,8 +14,8 @@ CONFIG_BITREVERSE=y # CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CEVT_R4K=y CONFIG_CEVT_R4K_LIB=y +CONFIG_CEVT_R4K=y CONFIG_CMDLINE="console=ttyS1,57600 rootfstype=squashfs,jffs2" # CONFIG_CPU_BIG_ENDIAN is not set # CONFIG_CPU_CAVIUM_OCTEON is not set @@ -24,9 +24,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y CONFIG_CPU_LITTLE_ENDIAN=y # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS32_R1 is not set CONFIG_CPU_MIPS32_R2=y +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR2=y @@ -48,15 +48,15 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y # CONFIG_CPU_TX39XX is not set # CONFIG_CPU_TX49XX is not set # CONFIG_CPU_VR41XX is not set -CONFIG_CSRC_R4K=y CONFIG_CSRC_R4K_LIB=y +CONFIG_CSRC_R4K=y CONFIG_DECOMPRESS_LZMA=y # CONFIG_DM9000 is not set CONFIG_DMA_NEED_PCI_MAP_STATE=y CONFIG_DMA_NONCOHERENT=y CONFIG_EARLY_PRINTK=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -88,7 +88,6 @@ CONFIG_IRQ_CPU=y # CONFIG_MACH_VR41XX is not set # CONFIG_MII is not set # CONFIG_MIKROTIK_RB532 is not set -CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set # CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 @@ -100,6 +99,7 @@ CONFIG_MIPS_MT_DISABLED=y CONFIG_MIPS_RALINK=y CONFIG_MIPS_RAMIPS_NET=y # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y # CONFIG_MTD_CFI_INTELEXT is not set CONFIG_MTD_PHYSMAP=y # CONFIG_NO_IOPORT is not set diff --git a/target/linux/rb532/config-default b/target/linux/rb532/config-default index c8f811ca0..27f76dcdb 100644 --- a/target/linux/rb532/config-default +++ b/target/linux/rb532/config-default @@ -7,10 +7,10 @@ CONFIG_ARCH_REQUIRE_GPIOLIB=y # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ATA=y # CONFIG_ATA_NONSTANDARD is not set # CONFIG_ATA_PIIX is not set CONFIG_ATA_SFF=y +CONFIG_ATA=y CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set # CONFIG_BINARY_PRINTF is not set @@ -20,8 +20,8 @@ CONFIG_BOOT_RAW=y # CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CEVT_R4K=y CONFIG_CEVT_R4K_LIB=y +CONFIG_CEVT_R4K=y # CONFIG_CPU_BIG_ENDIAN is not set # CONFIG_CPU_CAVIUM_OCTEON is not set CONFIG_CPU_HAS_LLSC=y @@ -29,9 +29,9 @@ CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_SYNC=y CONFIG_CPU_LITTLE_ENDIAN=y # CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32_R1=y # CONFIG_CPU_MIPS32_R2 is not set +CONFIG_CPU_MIPS32=y # CONFIG_CPU_MIPS64_R1 is not set # CONFIG_CPU_MIPS64_R2 is not set CONFIG_CPU_MIPSR1=y @@ -53,8 +53,8 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y # CONFIG_CPU_TX39XX is not set # CONFIG_CPU_TX49XX is not set # CONFIG_CPU_VR41XX is not set -CONFIG_CSRC_R4K=y CONFIG_CSRC_R4K_LIB=y +CONFIG_CSRC_R4K=y # CONFIG_DEBUG_FS is not set CONFIG_DECOMPRESS_LZMA=y CONFIG_DEVPORT=y @@ -63,8 +63,8 @@ CONFIG_DMA_NEED_PCI_MAP_STATE=y CONFIG_DMA_NONCOHERENT=y # CONFIG_ENABLE_WARN_DEPRECATED is not set CONFIG_EXT2_FS=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -84,8 +84,8 @@ CONFIG_HAVE_OPROFILE=y # CONFIG_HIGH_RES_TIMERS is not set CONFIG_HW_HAS_PCI=y CONFIG_HW_RANDOM=y -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set CONFIG_IMAGE_CMDLINE_HACK=y @@ -103,7 +103,6 @@ CONFIG_LEDS_MIKROTIK_RB532=y # CONFIG_MACH_TX49XX is not set # CONFIG_MACH_VR41XX is not set CONFIG_MIKROTIK_RB532=y -CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set # CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=4 @@ -113,15 +112,16 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set +CONFIG_MIPS=y CONFIG_MTD_BLOCK2MTD=y CONFIG_MTD_CFI_ADV_OPTIONS=y # CONFIG_MTD_CFI_AMDSTD is not set CONFIG_MTD_CFI_GEOMETRY=y # CONFIG_MTD_CFI_INTELEXT is not set # CONFIG_MTD_COMPLEX_MAPPINGS is not set -CONFIG_MTD_NAND=y CONFIG_MTD_NAND_PLATFORM=y CONFIG_MTD_NAND_VERIFY_WRITE=y +CONFIG_MTD_NAND=y CONFIG_MTD_PHYSMAP=y # CONFIG_MTD_ROOTFS_ROOT_DEV is not set # CONFIG_MTD_ROOTFS_SPLIT is not set @@ -133,8 +133,8 @@ CONFIG_NF_CT_ACCT=y # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PATA_RB532=y -CONFIG_PCI=y CONFIG_PCI_DOMAINS=y +CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set @@ -143,10 +143,10 @@ CONFIG_PCSPKR_PLATFORM=y # CONFIG_PROBE_INITRD_HEADER is not set CONFIG_RC32434_WDT=y CONFIG_SCHED_OMIT_FRAME_POINTER=y -CONFIG_SCSI=y # CONFIG_SCSI_LOWLEVEL is not set # CONFIG_SCSI_MULTI_LUN is not set # CONFIG_SCSI_PROC_FS is not set +CONFIG_SCSI=y # CONFIG_SERIAL_8250_EXTENDED is not set # CONFIG_SGI_IP22 is not set # CONFIG_SGI_IP27 is not set @@ -169,8 +169,8 @@ CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y # CONFIG_TC35815 is not set CONFIG_TRACING_SUPPORT=y CONFIG_TRAD_SIGNALS=y -CONFIG_VIA_RHINE=y CONFIG_VIA_RHINE_MMIO=y +CONFIG_VIA_RHINE=y CONFIG_YAFFS_9BYTE_TAGS=y # CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set CONFIG_YAFFS_AUTO_YAFFS2=y diff --git a/target/linux/rdc/ar525w/config-2.6.30 b/target/linux/rdc/ar525w/config-2.6.30 index aeed11632..109f9e064 100644 --- a/target/linux/rdc/ar525w/config-2.6.30 +++ b/target/linux/rdc/ar525w/config-2.6.30 @@ -1,8 +1,8 @@ # CONFIG_MTD_PHYSMAP is not set # CONFIG_MTD_R8610 is not set -CONFIG_MTD_RDC3210=y CONFIG_MTD_RDC3210_ALLOW_JFFS2=y CONFIG_MTD_RDC3210_BUSWIDTH=2 # CONFIG_MTD_RDC3210_FACTORY_PRESENT is not set CONFIG_MTD_RDC3210_SIZE=0x400000 # CONFIG_MTD_RDC3210_STATIC_MAP is not set +CONFIG_MTD_RDC3210=y diff --git a/target/linux/rdc/config-2.6.28 b/target/linux/rdc/config-2.6.28 index f155061d0..bab82f491 100644 --- a/target/linux/rdc/config-2.6.28 +++ b/target/linux/rdc/config-2.6.28 @@ -25,15 +25,15 @@ CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y CONFIG_BASE_SMALL=0 # CONFIG_BINFMT_AOUT is not set CONFIG_BITREVERSE=y -CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_BLK_DEV_RAM=y CONFIG_BOUNCE=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CLASSIC_RCU=y CONFIG_CLOCKSOURCE_WATCHDOG=y -CONFIG_CMDLINE="console=ttyS0,38400 rootfstype=squashfs,jffs2" CONFIG_CMDLINE_BOOL=y +CONFIG_CMDLINE="console=ttyS0,38400 rootfstype=squashfs,jffs2" # CONFIG_CMDLINE_OVERRIDE is not set # CONFIG_COMPAT_VDSO is not set # CONFIG_CPU5_WDT is not set @@ -52,8 +52,8 @@ CONFIG_DEFAULT_IO_DELAY_TYPE=0 CONFIG_DEVPORT=y # CONFIG_DMI is not set CONFIG_DOUBLEFAULT=y -CONFIG_EARLY_PRINTK=y # CONFIG_EARLY_PRINTK_DBGP is not set +CONFIG_EARLY_PRINTK=y # CONFIG_EDAC is not set # CONFIG_EDD is not set # CONFIG_EUROTECH_WDT is not set @@ -61,8 +61,8 @@ CONFIG_FAST_CMPXCHG_LOCAL=y CONFIG_FIRMWARE_MEMMAP=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y # CONFIG_GENERIC_CPU is not set CONFIG_GENERIC_FIND_FIRST_BIT=y @@ -101,13 +101,13 @@ CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y # CONFIG_HP_WATCHDOG is not set CONFIG_HUGETLBFS=y CONFIG_HUGETLB_PAGE=y -CONFIG_HW_RANDOM=y # CONFIG_HW_RANDOM_AMD is not set # CONFIG_HW_RANDOM_GEODE is not set # CONFIG_HW_RANDOM_INTEL is not set # CONFIG_HW_RANDOM_VIA is not set -CONFIG_HZ=250 +CONFIG_HW_RANDOM=y # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set # CONFIG_I6300ESB_WDT is not set @@ -116,7 +116,6 @@ CONFIG_HZ_250=y # CONFIG_IBMASR is not set # CONFIG_IDE is not set CONFIG_INITRAMFS_SOURCE="" -# CONFIG_IOMMU_HELPER is not set CONFIG_IO_DELAY_0X80=y # CONFIG_IO_DELAY_0XED is not set # CONFIG_IO_DELAY_NONE is not set @@ -125,8 +124,9 @@ CONFIG_IO_DELAY_TYPE_0XED=1 CONFIG_IO_DELAY_TYPE_NONE=3 CONFIG_IO_DELAY_TYPE_UDELAY=2 # CONFIG_IO_DELAY_UDELAY is not set -# CONFIG_ISA is not set +# CONFIG_IOMMU_HELPER is not set CONFIG_ISA_DMA_API=y +# CONFIG_ISA is not set # CONFIG_ISCSI_IBFT_FIND is not set # CONFIG_IT8712F_WDT is not set # CONFIG_IT87_WDT is not set @@ -163,8 +163,8 @@ CONFIG_MATH_EMULATION=y # CONFIG_MK8 is not set CONFIG_MODULE_FORCE_UNLOAD=y # CONFIG_MPENTIUM4 is not set -# CONFIG_MPENTIUMII is not set # CONFIG_MPENTIUMIII is not set +# CONFIG_MPENTIUMII is not set # CONFIG_MPENTIUMM is not set # CONFIG_MPSC is not set # CONFIG_MTD_CFI_INTELEXT is not set @@ -172,10 +172,10 @@ CONFIG_MTD_CMDLINE_PARTS=y # CONFIG_MTD_COMPLEX_MAPPINGS is not set CONFIG_MTD_CONCAT=y # CONFIG_MTD_NETSC520 is not set -CONFIG_MTD_PHYSMAP=y CONFIG_MTD_PHYSMAP_BANKWIDTH=2 CONFIG_MTD_PHYSMAP_LEN=0 CONFIG_MTD_PHYSMAP_START=0x8000000 +CONFIG_MTD_PHYSMAP=y # CONFIG_MTD_R8610 is not set # CONFIG_MTD_RDC3210 is not set # CONFIG_MTD_SC520CDP is not set @@ -196,24 +196,24 @@ CONFIG_PAGE_OFFSET=0xC0000000 # CONFIG_PARAVIRT_GUEST is not set # CONFIG_PC8736x_GPIO is not set # CONFIG_PC87413_WDT is not set -CONFIG_PCI=y -# CONFIG_PCIEPORTBUS is not set CONFIG_PCI_BIOS=y CONFIG_PCI_DIRECT=y CONFIG_PCI_DOMAINS=y +# CONFIG_PCIEPORTBUS is not set CONFIG_PCI_GOANY=y # CONFIG_PCI_GOBIOS is not set # CONFIG_PCI_GODIRECT is not set # CONFIG_PCI_GOMMCONFIG is not set # CONFIG_PCI_GOOLPC is not set +CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYSICAL_ALIGN=0x100000 CONFIG_PHYSICAL_START=0x100000 CONFIG_PROCESSOR_SELECT=y # CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set # CONFIG_R6040 is not set -# CONFIG_RDC321X_WDT is not set # CONFIG_RD_BZIP2 is not set +# CONFIG_RDC321X_WDT is not set CONFIG_RD_GZIP=y # CONFIG_RD_LZMA is not set # CONFIG_RELOCATABLE is not set @@ -242,12 +242,11 @@ CONFIG_USB_SUPPORT=y # CONFIG_VGASTATE is not set # CONFIG_VIA_RHINE is not set # CONFIG_VM86 is not set +CONFIG_VM_EVENT_COUNTERS=y # CONFIG_VMSPLIT_2G_OPT is not set # CONFIG_VMSPLIT_3G_OPT is not set -CONFIG_VM_EVENT_COUNTERS=y # CONFIG_W83697UG_WDT is not set # CONFIG_WAFER_WDT is not set -CONFIG_X86=y CONFIG_X86_32=y # CONFIG_X86_64 is not set CONFIG_X86_ALIGNMENT_16=y @@ -255,12 +254,12 @@ CONFIG_X86_BIOS_REBOOT=y CONFIG_X86_BSWAP=y # CONFIG_X86_CHECK_BIOS_CORRUPTION is not set CONFIG_X86_CMPXCHG=y -CONFIG_X86_CPU=y # CONFIG_X86_CPUID is not set +CONFIG_X86_CPU=y # CONFIG_X86_ELAN is not set CONFIG_X86_F00F_BUG=y -# CONFIG_X86_GENERIC is not set # CONFIG_X86_GENERICARCH is not set +# CONFIG_X86_GENERIC is not set CONFIG_X86_INVLPG=y CONFIG_X86_L1_CACHE_SHIFT=4 # CONFIG_X86_MCE is not set @@ -279,4 +278,5 @@ CONFIG_X86_REBOOTFIXUPS=y # CONFIG_X86_VSMP is not set CONFIG_X86_WP_WORKS_OK=y CONFIG_X86_XADD=y +CONFIG_X86=y # CONFIG_ZONE_DMA32 is not set diff --git a/target/linux/rdc/config-2.6.30 b/target/linux/rdc/config-2.6.30 index 81ec1c57a..a421e64e4 100644 --- a/target/linux/rdc/config-2.6.30 +++ b/target/linux/rdc/config-2.6.30 @@ -29,15 +29,15 @@ CONFIG_BASE_SMALL=1 # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y # CONFIG_BLK_DEV_INITRD is not set -CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_BLK_DEV_RAM=y CONFIG_BOUNCE=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y # CONFIG_CC_STACKPROTECTOR is not set CONFIG_CLOCKSOURCE_WATCHDOG=y -CONFIG_CMDLINE="console=ttyS0,38400 rootfstype=squashfs,jffs2" CONFIG_CMDLINE_BOOL=y +CONFIG_CMDLINE="console=ttyS0,38400 rootfstype=squashfs,jffs2" # CONFIG_CMDLINE_OVERRIDE is not set # CONFIG_COMPAT_NET_DEV_OPS is not set # CONFIG_COMPAT_VDSO is not set @@ -70,8 +70,8 @@ CONFIG_FIX_EARLYCON_MEM=y # CONFIG_FRAME_POINTER is not set # CONFIG_FTRACE_SYSCALLS is not set CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y # CONFIG_GENERIC_CPU is not set CONFIG_GENERIC_FIND_FIRST_BIT=y @@ -99,8 +99,8 @@ CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y CONFIG_HAVE_FTRACE_SYSCALLS=y CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y +CONFIG_HAVE_FUNCTION_TRACER=y CONFIG_HAVE_GENERIC_DMA_COHERENT=y CONFIG_HAVE_IDE=y CONFIG_HAVE_IOREMAP_PROT=y @@ -109,8 +109,8 @@ CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_LZMA=y CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_KVM=y CONFIG_HAVE_KVM_IRQCHIP=y +CONFIG_HAVE_KVM=y CONFIG_HAVE_LATENCYTOP_SUPPORT=y CONFIG_HAVE_MLOCK=y CONFIG_HAVE_MMIOTRACE_SUPPORT=y @@ -124,16 +124,14 @@ CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y # CONFIG_HP_WATCHDOG is not set # CONFIG_HUGETLBFS is not set # CONFIG_HW_RANDOM is not set -CONFIG_HZ=250 # CONFIG_HZ_100 is not set +CONFIG_HZ=250 CONFIG_HZ_250=y # CONFIG_I2C is not set # CONFIG_I6300ESB_WDT is not set # CONFIG_I8K is not set # CONFIG_IB700_WDT is not set # CONFIG_IBMASR is not set -# CONFIG_IOMMU_API is not set -# CONFIG_IOMMU_HELPER is not set CONFIG_IO_DELAY_0X80=y # CONFIG_IO_DELAY_0XED is not set # CONFIG_IO_DELAY_NONE is not set @@ -142,9 +140,11 @@ CONFIG_IO_DELAY_TYPE_0XED=1 CONFIG_IO_DELAY_TYPE_NONE=3 CONFIG_IO_DELAY_TYPE_UDELAY=2 # CONFIG_IO_DELAY_UDELAY is not set +# CONFIG_IOMMU_API is not set +# CONFIG_IOMMU_HELPER is not set # CONFIG_IP_MROUTE is not set -# CONFIG_ISA is not set CONFIG_ISA_DMA_API=y +# CONFIG_ISA is not set # CONFIG_ISCSI_IBFT_FIND is not set # CONFIG_IT8712F_WDT is not set # CONFIG_IT87_WDT is not set @@ -183,8 +183,8 @@ CONFIG_MATH_EMULATION=y # CONFIG_MMIOTRACE is not set CONFIG_MODULE_FORCE_UNLOAD=y # CONFIG_MPENTIUM4 is not set -# CONFIG_MPENTIUMII is not set # CONFIG_MPENTIUMIII is not set +# CONFIG_MPENTIUMII is not set # CONFIG_MPENTIUMM is not set # CONFIG_MPSC is not set # CONFIG_MTD_CFI_INTELEXT is not set @@ -212,18 +212,18 @@ CONFIG_PAGE_OFFSET=0xC0000000 # CONFIG_PARAVIRT_GUEST is not set # CONFIG_PC8736x_GPIO is not set # CONFIG_PC87413_WDT is not set -CONFIG_PCI=y -# CONFIG_PCIEPORTBUS is not set CONFIG_PCI_BIOS=y CONFIG_PCI_DIRECT=y CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y +# CONFIG_PCIEPORTBUS is not set CONFIG_PCI_GOANY=y # CONFIG_PCI_GOBIOS is not set # CONFIG_PCI_GODIRECT is not set # CONFIG_PCI_GOMMCONFIG is not set # CONFIG_PCI_GOOLPC is not set # CONFIG_PCI_QUIRKS is not set +CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYSICAL_ALIGN=0x100000 CONFIG_PHYSICAL_START=0x100000 @@ -264,17 +264,16 @@ CONFIG_USER_STACKTRACE_SUPPORT=y # CONFIG_VMSPLIT_3G_OPT is not set # CONFIG_W83697UG_WDT is not set # CONFIG_WAFER_WDT is not set -CONFIG_X86=y -CONFIG_X86_32=y CONFIG_X86_32_LAZY_GS=y +CONFIG_X86_32=y # CONFIG_X86_64 is not set CONFIG_X86_ALIGNMENT_16=y CONFIG_X86_BSWAP=y # CONFIG_X86_CHECK_BIOS_CORRUPTION is not set CONFIG_X86_CMPXCHG=y -CONFIG_X86_CPU=y -# CONFIG_X86_CPUID is not set # CONFIG_X86_CPU_DEBUG is not set +# CONFIG_X86_CPUID is not set +CONFIG_X86_CPU=y # CONFIG_X86_ELAN is not set CONFIG_X86_EXTENDED_PLATFORM=y CONFIG_X86_F00F_BUG=y @@ -297,4 +296,5 @@ CONFIG_X86_REBOOTFIXUPS=y # CONFIG_X86_VERBOSE_BOOTUP is not set CONFIG_X86_WP_WORKS_OK=y CONFIG_X86_XADD=y +CONFIG_X86=y # CONFIG_ZONE_DMA32 is not set diff --git a/target/linux/s3c24xx/config-2.6.30 b/target/linux/s3c24xx/config-2.6.30 index 1ec40be5d..ed34338fc 100644 --- a/target/linux/s3c24xx/config-2.6.30 +++ b/target/linux/s3c24xx/config-2.6.30 @@ -1,9 +1,9 @@ # CONFIG_AEABI is not set CONFIG_ALIGNMENT_TRAP=y # CONFIG_APM_EMULATION is not set -CONFIG_AR6000_WLAN=y # CONFIG_AR6000_WLAN_DEBUG is not set # CONFIG_AR6000_WLAN_RESET is not set +CONFIG_AR6000_WLAN=y # CONFIG_ARCH_BAST is not set CONFIG_ARCH_FLATMEM_HAS_HOLES=y # CONFIG_ARCH_H1940 is not set @@ -17,8 +17,8 @@ CONFIG_ARCH_S3C2410=y # CONFIG_ARCH_SPARSEMEM_DEFAULT is not set # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARM=y CONFIG_ARM_THUMB=y +CONFIG_ARM=y # CONFIG_ARPD is not set CONFIG_BACKLIGHT_CLASS_DEVICE=y CONFIG_BACKLIGHT_GENERIC=y @@ -28,30 +28,30 @@ CONFIG_BASE_SMALL=0 CONFIG_BATTERY_BQ27000_HDQ=y # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y -CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_BLK_DEV_RAM=y CONFIG_BRIDGE_NETFILTER=y # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_CHARGER_PCF50633=y CONFIG_CMDLINE="unused -- bootloader passes ATAG list" CONFIG_COMPAT_BRK=y CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_CPU_32=y CONFIG_CPU_32v4T=y +CONFIG_CPU_32=y CONFIG_CPU_ABRT_EV4T=y CONFIG_CPU_ARM920T=y CONFIG_CPU_CACHE_V4WT=y CONFIG_CPU_CACHE_VIVT=y CONFIG_CPU_COPY_V4WB=y -CONFIG_CPU_CP15=y CONFIG_CPU_CP15_MMU=y +CONFIG_CPU_CP15=y # CONFIG_CPU_DCACHE_WRITETHROUGH is not set # CONFIG_CPU_ICACHE_DISABLE is not set -CONFIG_CPU_IDLE=y CONFIG_CPU_IDLE_GOV_LADDER=y -CONFIG_CPU_LLSERIAL_S3C2440=y +CONFIG_CPU_IDLE=y CONFIG_CPU_LLSERIAL_S3C2440_ONLY=y +CONFIG_CPU_LLSERIAL_S3C2440=y CONFIG_CPU_PABRT_NOIFAR=y CONFIG_CPU_S3C2410_DMA=y CONFIG_CPU_S3C2442=y @@ -77,13 +77,12 @@ CONFIG_ELF_CORE=y # CONFIG_ENABLE_WARN_DEPRECATED is not set CONFIG_EXT2_FS=y CONFIG_EXT3_FS=y -CONFIG_FB=y CONFIG_FB_CFB_COPYAREA=y CONFIG_FB_CFB_FILLRECT=y CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB=y CONFIG_FIQ=y # CONFIG_FIRMWARE_EDID is not set -CONFIG_FONTS=y # CONFIG_FONT_10x18 is not set CONFIG_FONT_6x11=y # CONFIG_FONT_7x14 is not set @@ -94,12 +93,13 @@ CONFIG_FONT_6x11=y # CONFIG_FONT_PEARL_8x8 is not set # CONFIG_FONT_SUN12x22 is not set # CONFIG_FONT_SUN8x16 is not set +CONFIG_FONTS=y # CONFIG_FPE_FASTFPE is not set -CONFIG_FPE_NWFPE=y # CONFIG_FPE_NWFPE_XP is not set -CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FPE_NWFPE=y # CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set # CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAME_POINTER=y CONFIG_FREEZER=y # CONFIG_GENERIC_CLOCKEVENTS is not set @@ -107,8 +107,8 @@ CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_GPIO=y CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y # CONFIG_GENERIC_TIME is not set -CONFIG_GPIOLIB=y CONFIG_GPIO_DEVICE=y +CONFIG_GPIOLIB=y CONFIG_GPIO_SYSFS=y # CONFIG_HAMRADIO is not set CONFIG_HARDIRQS_SW_RESEND=y @@ -123,12 +123,11 @@ CONFIG_HAVE_IDE=y CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y CONFIG_HAVE_LATENCYTOP_SUPPORT=y -CONFIG_HAVE_MLOCK=y CONFIG_HAVE_MLOCKED_PAGE_BIT=y +CONFIG_HAVE_MLOCK=y CONFIG_HAVE_OPROFILE=y CONFIG_HAVE_PWM=y CONFIG_HDQ_GPIO_BITBANG=y -CONFIG_HID=y CONFIG_HID_A4TECH=y CONFIG_HID_APPLE=y CONFIG_HID_BELKIN=y @@ -150,34 +149,35 @@ CONFIG_HID_SONY=y CONFIG_HID_SUNPLUS=y CONFIG_HID_SUPPORT=y CONFIG_HID_TOPSEED=y +CONFIG_HID=y CONFIG_HW_CONSOLE=y # CONFIG_HW_RANDOM is not set CONFIG_HZ=200 -CONFIG_I2C=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_S3C2410=y +CONFIG_I2C=y CONFIG_INET_DIAG=y CONFIG_INET_TCP_DIAG=y CONFIG_INITRAMFS_SOURCE="" -CONFIG_INOTIFY=y CONFIG_INOTIFY_USER=y -CONFIG_INPUT=y +CONFIG_INOTIFY=y CONFIG_INPUT_EVDEV=y # CONFIG_INPUT_GPIO_BUTTONS is not set CONFIG_INPUT_KEYBOARD=y CONFIG_INPUT_LIS302DL=y -CONFIG_INPUT_MOUSEDEV=y # CONFIG_INPUT_MOUSEDEV_PSAUX is not set CONFIG_INPUT_MOUSEDEV_SCREEN_X=480 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=640 +CONFIG_INPUT_MOUSEDEV=y CONFIG_INPUT_PCF50633_PMU=y CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_INPUT=y # CONFIG_INPUT_YEALINK is not set -CONFIG_IP_PNP=y # CONFIG_IP_PNP_BOOTP is not set # CONFIG_IP_PNP_DHCP is not set # CONFIG_IP_PNP_RARP is not set +CONFIG_IP_PNP=y # CONFIG_IP_ROUTE_MULTIPATH is not set # CONFIG_IP_ROUTE_VERBOSE is not set # CONFIG_ISDN is not set @@ -204,19 +204,19 @@ CONFIG_LEDS_GTA02_VIBRATOR=y # CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set # CONFIG_LEDS_TRIGGER_NETDEV is not set CONFIG_LOCK_KERNEL=y -CONFIG_LOGO=y +CONFIG_LOG_BUF_SHIFT=18 # CONFIG_LOGO_LINUX_CLUT224 is not set # CONFIG_LOGO_LINUX_MONO is not set # CONFIG_LOGO_LINUX_VGA16 is not set CONFIG_LOGO_OPENWRT_CLUT224=y -CONFIG_LOG_BUF_SHIFT=18 +CONFIG_LOGO=y # CONFIG_MACH_AML_M5900 is not set # CONFIG_MACH_ANUBIS is not set # CONFIG_MACH_AT2440EVB is not set # CONFIG_MACH_JIVE is not set # CONFIG_MACH_N30 is not set -CONFIG_MACH_NEO1973=y CONFIG_MACH_NEO1973_GTA02=y +CONFIG_MACH_NEO1973=y # CONFIG_MACH_NEXCODER_2440 is not set # CONFIG_MACH_OSIRIS is not set # CONFIG_MACH_OTOM is not set @@ -229,37 +229,37 @@ CONFIG_MACH_NEO1973_GTA02=y # CONFIG_MACH_VR1000 is not set # CONFIG_MACH_VSTMS is not set CONFIG_MFD_CORE=y -CONFIG_MFD_GLAMO=y CONFIG_MFD_GLAMO_FB=y CONFIG_MFD_GLAMO_GPIO=y CONFIG_MFD_GLAMO_MCI=y +CONFIG_MFD_GLAMO=y CONFIG_MFD_PCF50633=y # CONFIG_MFD_T7L66XB is not set # CONFIG_MISC_DEVICES is not set -CONFIG_MMC=y CONFIG_MMC_BLOCK=y CONFIG_MMC_S3C=y +CONFIG_MMC=y CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_MTD_ABSENT=y # CONFIG_MTD_CFI_AMDSTD is not set CONFIG_MTD_CMDLINE_PARTS=y # CONFIG_MTD_COMPLEX_MAPPINGS is not set CONFIG_MTD_CONCAT=y -CONFIG_MTD_NAND=y # CONFIG_MTD_NAND_GPIO is not set -CONFIG_MTD_NAND_S3C2410=y # CONFIG_MTD_NAND_S3C2410_CLKSTOP is not set # CONFIG_MTD_NAND_S3C2410_DEBUG is not set CONFIG_MTD_NAND_S3C2410_HWECC=y +CONFIG_MTD_NAND_S3C2410=y CONFIG_MTD_NAND_VERIFY_WRITE=y +CONFIG_MTD_NAND=y CONFIG_MTD_PHYSMAP=y CONFIG_MTD_ROM=y CONFIG_NAMESPACES=y -# CONFIG_NETDEV_1000 is not set -# CONFIG_NETWORK_FILESYSTEMS is not set # CONFIG_NET_CLS_ACT is not set +# CONFIG_NETDEV_1000 is not set # CONFIG_NET_ETHERNET is not set # CONFIG_NET_NS is not set +# CONFIG_NETWORK_FILESYSTEMS is not set CONFIG_NLATTR=y CONFIG_NO_IOPORT=y CONFIG_NR_TTY_DEVICES=6 @@ -270,31 +270,31 @@ CONFIG_PCF50633_ADC=y CONFIG_PCF50633_GPIO=y # CONFIG_PCI_SYSCALL is not set # CONFIG_PDA_POWER is not set -CONFIG_PLAT_S3C=y CONFIG_PLAT_S3C24XX=y -CONFIG_PM=y +CONFIG_PLAT_S3C=y # CONFIG_PM_DEBUG is not set CONFIG_PM_SLEEP=y -CONFIG_POWER_SUPPLY=y +CONFIG_PM=y # CONFIG_POWER_SUPPLY_DEBUG is not set +CONFIG_POWER_SUPPLY=y CONFIG_PREEMPT=y CONFIG_PROC_PAGE_MONITOR=y CONFIG_RD_BZIP2=y CONFIG_RD_GZIP=y -CONFIG_REGULATOR=y # CONFIG_REGULATOR_DEBUG is not set CONFIG_REGULATOR_PCF50633=y +CONFIG_REGULATOR=y CONFIG_RTC_CLASS=y # CONFIG_RTC_DRV_CMOS is not set CONFIG_RTC_DRV_PCF50633=y CONFIG_RTC_DRV_S3C=y CONFIG_S3C2410_CLOCK=y -CONFIG_S3C2410_DMA=y # CONFIG_S3C2410_DMA_DEBUG is not set +CONFIG_S3C2410_DMA=y CONFIG_S3C2410_GPIO=y -CONFIG_S3C2410_PM=y # CONFIG_S3C2410_PM_CHECK is not set # CONFIG_S3C2410_PM_DEBUG is not set +CONFIG_S3C2410_PM=y CONFIG_S3C2410_WATCHDOG=y CONFIG_S3C2440_DMA=y # CONFIG_S3C24XX_ADC is not set @@ -315,76 +315,74 @@ CONFIG_S3C_PWM=y # CONFIG_SDIO_UART is not set # CONFIG_SERIAL_8250 is not set CONFIG_SERIAL_S3C2440=y -CONFIG_SERIAL_SAMSUNG=y CONFIG_SERIAL_SAMSUNG_CONSOLE=y CONFIG_SERIAL_SAMSUNG_UARTS=3 -CONFIG_SERIO=y +CONFIG_SERIAL_SAMSUNG=y # CONFIG_SERIO_RAW is not set # CONFIG_SERIO_SERPORT is not set +CONFIG_SERIO=y # CONFIG_SLOW_WORK is not set -CONFIG_SND=m # CONFIG_SND_ARM is not set # CONFIG_SND_DRIVERS is not set CONFIG_SND_JACK=y +CONFIG_SND=m CONFIG_SND_PCM=m -CONFIG_SND_S3C24XX_SOC=m CONFIG_SND_S3C24XX_SOC_I2S=m # CONFIG_SND_S3C24XX_SOC_LN2440SBC_ALC650 is not set +CONFIG_SND_S3C24XX_SOC=m CONFIG_SND_S3C24XX_SOC_NEO1973_GTA02_WM8753=m # CONFIG_SND_S3C24XX_SOC_S3C24XX_UDA134X is not set -CONFIG_SND_SOC=m # CONFIG_SND_SOC_ALL_CODECS is not set CONFIG_SND_SOC_I2C_AND_SPI=m +CONFIG_SND_SOC=m CONFIG_SND_SOC_WM8753=m CONFIG_SND_TIMER=m # CONFIG_SND_USB is not set # CONFIG_SND_VERBOSE_PROCFS is not set CONFIG_SOUND=m # CONFIG_SOUND_OSS_CORE is not set -CONFIG_SPI=y CONFIG_SPI_BITBANG=y CONFIG_SPI_GPIO=y CONFIG_SPI_MASTER=y -CONFIG_SPI_S3C24XX=y CONFIG_SPI_S3C24XX_GPIO=y +CONFIG_SPI_S3C24XX=y # CONFIG_SPI_SPIDEV is not set +CONFIG_SPI=y CONFIG_SPLIT_PTLOCK_CPUS=4096 # CONFIG_SQUASHFS is not set -CONFIG_SUSPEND=y CONFIG_SUSPEND_FREEZER=y +CONFIG_SUSPEND=y # CONFIG_SYSCTL_SYSCALL_CHECK is not set -CONFIG_SYSFS_DEPRECATED=y CONFIG_SYSFS_DEPRECATED_V2=y +CONFIG_SYSFS_DEPRECATED=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y CONFIG_TCP_MD5SIG=y -CONFIG_TOUCHSCREEN_FILTER=y CONFIG_TOUCHSCREEN_FILTER_GROUP=y CONFIG_TOUCHSCREEN_FILTER_LINEAR=y CONFIG_TOUCHSCREEN_FILTER_MEAN=y CONFIG_TOUCHSCREEN_FILTER_MEDIAN=y -CONFIG_TOUCHSCREEN_S3C2410=y +CONFIG_TOUCHSCREEN_FILTER=y # CONFIG_TOUCHSCREEN_S3C2410_DEBUG is not set +CONFIG_TOUCHSCREEN_S3C2410=y CONFIG_TRACING_SUPPORT=y CONFIG_UID16=y CONFIG_UNEVICTABLE_LRU=y -CONFIG_USB=y CONFIG_USB_ANNOUNCE_NEW_DEVICES=y # CONFIG_USB_ARCH_HAS_EHCI is not set # CONFIG_USB_CDC_COMPOSITE is not set # CONFIG_USB_DEVICEFS is not set -CONFIG_USB_ETH=y CONFIG_USB_ETH_RNDIS=y +CONFIG_USB_ETH=y # CONFIG_USB_FILE_STORAGE is not set -CONFIG_USB_GADGET=y -# CONFIG_USB_GADGETFS is not set -# CONFIG_USB_GADGET_DEBUG_FS is not set # CONFIG_USB_GADGET_AMD5536UDC is not set # CONFIG_USB_GADGET_AT91 is not set # CONFIG_USB_GADGET_ATMEL_USBA is not set # CONFIG_USB_GADGET_CI13XXX is not set # CONFIG_USB_GADGET_DEBUG_FILES is not set +# CONFIG_USB_GADGET_DEBUG_FS is not set # CONFIG_USB_GADGET_DUALSPEED is not set # CONFIG_USB_GADGET_DUMMY_HCD is not set +# CONFIG_USB_GADGETFS is not set # CONFIG_USB_GADGET_FSL_QE is not set # CONFIG_USB_GADGET_FSL_USB2 is not set # CONFIG_USB_GADGET_GOKU is not set @@ -399,6 +397,7 @@ CONFIG_USB_GADGET=y CONFIG_USB_GADGET_S3C2410=y CONFIG_USB_GADGET_SELECTED=y CONFIG_USB_GADGET_VBUS_DRAW=500 +CONFIG_USB_GADGET=y # CONFIG_USB_G_PRINTER is not set # CONFIG_USB_G_SERIAL is not set CONFIG_USB_HID=y @@ -407,10 +406,11 @@ CONFIG_USB_HID=y # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set CONFIG_USB_OHCI_HCD=y -CONFIG_USB_S3C2410=y # CONFIG_USB_S3C2410_DEBUG is not set +CONFIG_USB_S3C2410=y CONFIG_USB_SUPPORT=y CONFIG_USB_SUSPEND=y +CONFIG_USB=y # CONFIG_USB_ZERO is not set # CONFIG_USER_NS is not set CONFIG_VECTORS_BASE=0xffff0000 @@ -418,9 +418,9 @@ CONFIG_VECTORS_BASE=0xffff0000 CONFIG_VIDEO_OUTPUT_CONTROL=y # CONFIG_VLAN_8021Q is not set CONFIG_VM_EVENT_COUNTERS=y -CONFIG_VT=y CONFIG_VT_CONSOLE=y CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_VT=y # CONFIG_WLAN_80211 is not set CONFIG_ZBOOT_ROM_BSS=0x0 CONFIG_ZBOOT_ROM_TEXT=0x0 diff --git a/target/linux/s3c24xx/config-2.6.31 b/target/linux/s3c24xx/config-2.6.31 index dcfddbb21..ac7bdac3e 100644 --- a/target/linux/s3c24xx/config-2.6.31 +++ b/target/linux/s3c24xx/config-2.6.31 @@ -14,8 +14,8 @@ CONFIG_ARCH_S3C2410=y # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUSPEND_POSSIBLE=y # CONFIG_ARCH_U300 is not set -CONFIG_ARM=y CONFIG_ARM_THUMB=y +CONFIG_ARM=y # CONFIG_ARPD is not set CONFIG_BACKLIGHT_CLASS_DEVICE=y CONFIG_BACKLIGHT_GENERIC=y @@ -25,9 +25,9 @@ CONFIG_BASE_SMALL=0 CONFIG_BATTERY_BQ27000_HDQ=y # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y -CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_BLK_DEV_RAM=y CONFIG_BRIDGE_NETFILTER=y # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_CHARGER_PCF50633=y @@ -35,21 +35,21 @@ CONFIG_CMDLINE="unused -- bootloader passes ATAG list" CONFIG_COMPAT_BRK=y CONFIG_CONSOLE_TRANSLATIONS=y CONFIG_CONSTRUCTORS=y -CONFIG_CPU_32=y CONFIG_CPU_32v4T=y +CONFIG_CPU_32=y CONFIG_CPU_ABRT_EV4T=y CONFIG_CPU_ARM920T=y CONFIG_CPU_CACHE_V4WT=y CONFIG_CPU_CACHE_VIVT=y CONFIG_CPU_COPY_V4WB=y -CONFIG_CPU_CP15=y CONFIG_CPU_CP15_MMU=y +CONFIG_CPU_CP15=y # CONFIG_CPU_DCACHE_WRITETHROUGH is not set # CONFIG_CPU_ICACHE_DISABLE is not set -CONFIG_CPU_IDLE=y CONFIG_CPU_IDLE_GOV_LADDER=y -CONFIG_CPU_LLSERIAL_S3C2440=y +CONFIG_CPU_IDLE=y CONFIG_CPU_LLSERIAL_S3C2440_ONLY=y +CONFIG_CPU_LLSERIAL_S3C2440=y CONFIG_CPU_PABRT_NOIFAR=y CONFIG_CPU_S3C2410_DMA=y CONFIG_CPU_S3C2442=y @@ -60,8 +60,8 @@ CONFIG_CRC7=y CONFIG_CRC_CCITT=y CONFIG_CRC_ITU_T=y CONFIG_CRC_T10DIF=y -CONFIG_CRYPTO_HASH=y CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_HASH=y CONFIG_CRYPTO_MD5=y CONFIG_DEBUG_BUGVERBOSE=y # CONFIG_DEBUG_FS is not set @@ -76,13 +76,12 @@ CONFIG_DUMMY_CONSOLE=y CONFIG_ELF_CORE=y # CONFIG_EMBEDDED is not set # CONFIG_ENABLE_WARN_DEPRECATED is not set -CONFIG_FB=y CONFIG_FB_CFB_COPYAREA=y CONFIG_FB_CFB_FILLRECT=y CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB=y CONFIG_FIQ=y # CONFIG_FIRMWARE_EDID is not set -CONFIG_FONTS=y # CONFIG_FONT_10x18 is not set CONFIG_FONT_6x11=y # CONFIG_FONT_7x14 is not set @@ -93,12 +92,13 @@ CONFIG_FONT_6x11=y # CONFIG_FONT_PEARL_8x8 is not set # CONFIG_FONT_SUN12x22 is not set # CONFIG_FONT_SUN8x16 is not set +CONFIG_FONTS=y # CONFIG_FPE_FASTFPE is not set -CONFIG_FPE_NWFPE=y # CONFIG_FPE_NWFPE_XP is not set -CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FPE_NWFPE=y # CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set # CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAME_POINTER=y CONFIG_FREEZER=y # CONFIG_FSNOTIFY is not set @@ -120,12 +120,11 @@ CONFIG_HAVE_IDE=y CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y CONFIG_HAVE_LATENCYTOP_SUPPORT=y -CONFIG_HAVE_MLOCK=y CONFIG_HAVE_MLOCKED_PAGE_BIT=y +CONFIG_HAVE_MLOCK=y CONFIG_HAVE_OPROFILE=y CONFIG_HAVE_PWM=y CONFIG_HDQ_GPIO_BITBANG=y -CONFIG_HID=y CONFIG_HID_A4TECH=y CONFIG_HID_APPLE=y CONFIG_HID_BELKIN=y @@ -151,35 +150,36 @@ CONFIG_HID_SUNPLUS=y CONFIG_HID_SUPPORT=y CONFIG_HID_THRUSTMASTER=y CONFIG_HID_TOPSEED=y +CONFIG_HID=y CONFIG_HID_ZEROPLUS=y CONFIG_HW_CONSOLE=y # CONFIG_HW_RANDOM is not set CONFIG_HZ=200 -CONFIG_I2C=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_CHARDEV=y # CONFIG_I2C_DESIGNWARE is not set CONFIG_I2C_S3C2410=y +CONFIG_I2C=y CONFIG_INET_DIAG=y CONFIG_INET_TCP_DIAG=y CONFIG_INITRAMFS_SOURCE="" CONFIG_INOTIFY=y -CONFIG_INPUT=y CONFIG_INPUT_EVDEV=y # CONFIG_INPUT_GPIO_BUTTONS is not set CONFIG_INPUT_KEYBOARD=y CONFIG_INPUT_LIS302DL=y -CONFIG_INPUT_MOUSEDEV=y # CONFIG_INPUT_MOUSEDEV_PSAUX is not set CONFIG_INPUT_MOUSEDEV_SCREEN_X=480 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=640 +CONFIG_INPUT_MOUSEDEV=y CONFIG_INPUT_PCF50633_PMU=y CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_INPUT=y # CONFIG_INPUT_YEALINK is not set -CONFIG_IP_PNP=y # CONFIG_IP_PNP_BOOTP is not set # CONFIG_IP_PNP_DHCP is not set # CONFIG_IP_PNP_RARP is not set +CONFIG_IP_PNP=y # CONFIG_IP_ROUTE_MULTIPATH is not set # CONFIG_IP_ROUTE_VERBOSE is not set # CONFIG_ISDN is not set @@ -206,11 +206,11 @@ CONFIG_LEDS_GTA02_VIBRATOR=y # CONFIG_LEDS_S3C24XX is not set # CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set CONFIG_LOCK_KERNEL=y -CONFIG_LOGO=y +CONFIG_LOG_BUF_SHIFT=18 # CONFIG_LOGO_LINUX_CLUT224 is not set # CONFIG_LOGO_LINUX_MONO is not set # CONFIG_LOGO_LINUX_VGA16 is not set -CONFIG_LOG_BUF_SHIFT=18 +CONFIG_LOGO=y CONFIG_MAC80211_DEFAULT_PS_VALUE=0 # CONFIG_MACH_AML_M5900 is not set # CONFIG_MACH_ANUBIS is not set @@ -218,8 +218,8 @@ CONFIG_MAC80211_DEFAULT_PS_VALUE=0 # CONFIG_MACH_JIVE is not set # CONFIG_MACH_MINI2440 is not set # CONFIG_MACH_N30 is not set -CONFIG_MACH_NEO1973=y CONFIG_MACH_NEO1973_GTA02=y +CONFIG_MACH_NEO1973=y # CONFIG_MACH_NEXCODER_2440 is not set # CONFIG_MACH_OSIRIS is not set # CONFIG_MACH_OTOM is not set @@ -232,36 +232,36 @@ CONFIG_MACH_NEO1973_GTA02=y # CONFIG_MACH_VR1000 is not set # CONFIG_MACH_VSTMS is not set CONFIG_MFD_CORE=y -CONFIG_MFD_GLAMO=y CONFIG_MFD_GLAMO_FB=y CONFIG_MFD_GLAMO_GPIO=y # CONFIG_MFD_GLAMO_MCI is not set +CONFIG_MFD_GLAMO=y CONFIG_MFD_PCF50633=y # CONFIG_MFD_T7L66XB is not set # CONFIG_MG_DISK is not set # CONFIG_MISC_DEVICES is not set -CONFIG_MMC=y CONFIG_MMC_BLOCK=y +CONFIG_MMC=y CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_MTD_ABSENT=y # CONFIG_MTD_CFI_AMDSTD is not set CONFIG_MTD_CMDLINE_PARTS=y # CONFIG_MTD_COMPLEX_MAPPINGS is not set CONFIG_MTD_CONCAT=y -CONFIG_MTD_NAND=y -CONFIG_MTD_NAND_S3C2410=y # CONFIG_MTD_NAND_S3C2410_CLKSTOP is not set # CONFIG_MTD_NAND_S3C2410_DEBUG is not set CONFIG_MTD_NAND_S3C2410_HWECC=y +CONFIG_MTD_NAND_S3C2410=y CONFIG_MTD_NAND_VERIFY_WRITE=y +CONFIG_MTD_NAND=y CONFIG_MTD_PHYSMAP=y CONFIG_MTD_ROM=y CONFIG_NAMESPACES=y -# CONFIG_NETDEV_1000 is not set -# CONFIG_NETWORK_FILESYSTEMS is not set # CONFIG_NET_CLS_ACT is not set +# CONFIG_NETDEV_1000 is not set # CONFIG_NET_ETHERNET is not set # CONFIG_NET_NS is not set +# CONFIG_NETWORK_FILESYSTEMS is not set CONFIG_NLS=y CONFIG_NO_IOPORT=y CONFIG_NR_TTY_DEVICES=6 @@ -271,38 +271,38 @@ CONFIG_PCF50633_ADC=y CONFIG_PCF50633_GPIO=y # CONFIG_PCI_SYSCALL is not set # CONFIG_PDA_POWER is not set -CONFIG_PLAT_S3C=y CONFIG_PLAT_S3C24XX=y -CONFIG_PM=y +CONFIG_PLAT_S3C=y # CONFIG_PM_DEBUG is not set CONFIG_PM_SLEEP=y -CONFIG_POWER_SUPPLY=y +CONFIG_PM=y # CONFIG_POWER_SUPPLY_DEBUG is not set +CONFIG_POWER_SUPPLY=y CONFIG_PREEMPT=y CONFIG_PROC_PAGE_MONITOR=y CONFIG_RD_BZIP2=y CONFIG_RD_GZIP=y -CONFIG_REGULATOR=y # CONFIG_REGULATOR_DEBUG is not set # CONFIG_REGULATOR_LP3971 is not set # CONFIG_REGULATOR_MAX1586 is not set CONFIG_REGULATOR_PCF50633=y # CONFIG_REGULATOR_USERSPACE_CONSUMER is not set -CONFIG_RFKILL=y +CONFIG_REGULATOR=y CONFIG_RFKILL_INPUT=y CONFIG_RFKILL_LEDS=y +CONFIG_RFKILL=y CONFIG_RTC_CLASS=y # CONFIG_RTC_DRV_CMOS is not set CONFIG_RTC_DRV_PCF50633=y # CONFIG_RTC_DRV_RX8025 is not set CONFIG_RTC_DRV_S3C=y CONFIG_S3C2410_CLOCK=y -CONFIG_S3C2410_DMA=y # CONFIG_S3C2410_DMA_DEBUG is not set +CONFIG_S3C2410_DMA=y CONFIG_S3C2410_GPIO=y -CONFIG_S3C2410_PM=y # CONFIG_S3C2410_PM_CHECK is not set # CONFIG_S3C2410_PM_DEBUG is not set +CONFIG_S3C2410_PM=y CONFIG_S3C2410_WATCHDOG=y # CONFIG_S3C24XX_ADC is not set CONFIG_S3C24XX_GPIO_EXTRA=64 @@ -320,74 +320,71 @@ CONFIG_S3C_PWM=y # CONFIG_SDIO_UART is not set # CONFIG_SERIAL_8250 is not set CONFIG_SERIAL_S3C2440=y -CONFIG_SERIAL_SAMSUNG=y CONFIG_SERIAL_SAMSUNG_CONSOLE=y CONFIG_SERIAL_SAMSUNG_UARTS=3 -CONFIG_SERIO=y +CONFIG_SERIAL_SAMSUNG=y # CONFIG_SERIO_RAW is not set # CONFIG_SERIO_SERPORT is not set +CONFIG_SERIO=y # CONFIG_SLOW_WORK is not set # CONFIG_SMARTJOYPLUS_FF is not set -CONFIG_SND=m # CONFIG_SND_DRIVERS is not set # CONFIG_SND_EMU10K1_SEQ is not set CONFIG_SND_JACK=y +CONFIG_SND=m # CONFIG_SND_OPL3_LIB_SEQ is not set # CONFIG_SND_OPL4_LIB_SEQ is not set CONFIG_SND_PCM=m # CONFIG_SND_RAWMIDI_SEQ is not set -CONFIG_SND_S3C24XX_SOC=m CONFIG_SND_S3C24XX_SOC_I2S=m # CONFIG_SND_S3C24XX_SOC_LN2440SBC_ALC650 is not set +CONFIG_SND_S3C24XX_SOC=m CONFIG_SND_S3C24XX_SOC_NEO1973_GTA02_WM8753=m # CONFIG_SND_S3C24XX_SOC_S3C24XX_UDA134X is not set # CONFIG_SND_SBAWE_SEQ is not set -CONFIG_SND_SOC=m # CONFIG_SND_SOC_ALL_CODECS is not set CONFIG_SND_SOC_I2C_AND_SPI=m +CONFIG_SND_SOC=m CONFIG_SND_SOC_WM8753=m CONFIG_SND_TIMER=m # CONFIG_SND_USB is not set # CONFIG_SND_VERBOSE_PROCFS is not set CONFIG_SOUND=m # CONFIG_SOUND_OSS_CORE is not set -CONFIG_SPI=y CONFIG_SPI_BITBANG=y CONFIG_SPI_GPIO=y CONFIG_SPI_MASTER=y -CONFIG_SPI_S3C24XX=y CONFIG_SPI_S3C24XX_GPIO=y +CONFIG_SPI_S3C24XX=y # CONFIG_SPI_SPIDEV is not set +CONFIG_SPI=y CONFIG_SPLIT_PTLOCK_CPUS=4096 # CONFIG_SQUASHFS is not set -CONFIG_SUSPEND=y CONFIG_SUSPEND_FREEZER=y +CONFIG_SUSPEND=y # CONFIG_SYSCTL_SYSCALL_CHECK is not set -CONFIG_SYSFS_DEPRECATED=y CONFIG_SYSFS_DEPRECATED_V2=y +CONFIG_SYSFS_DEPRECATED=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y CONFIG_TCP_MD5SIG=y -CONFIG_TOUCHSCREEN_FILTER=y CONFIG_TOUCHSCREEN_FILTER_GROUP=y CONFIG_TOUCHSCREEN_FILTER_LINEAR=y CONFIG_TOUCHSCREEN_FILTER_MEAN=y CONFIG_TOUCHSCREEN_FILTER_MEDIAN=y -CONFIG_TOUCHSCREEN_S3C2410=y +CONFIG_TOUCHSCREEN_FILTER=y # CONFIG_TOUCHSCREEN_S3C2410_DEBUG is not set +CONFIG_TOUCHSCREEN_S3C2410=y CONFIG_TRACING_SUPPORT=y # CONFIG_UACCESS_WITH_MEMCPY is not set CONFIG_UID16=y -CONFIG_USB=y CONFIG_USB_ANNOUNCE_NEW_DEVICES=y # CONFIG_USB_ARCH_HAS_EHCI is not set # CONFIG_USB_AUDIO is not set # CONFIG_USB_CDC_COMPOSITE is not set # CONFIG_USB_DEVICEFS is not set -CONFIG_USB_ETH=y CONFIG_USB_ETH_RNDIS=y +CONFIG_USB_ETH=y # CONFIG_USB_FILE_STORAGE is not set -CONFIG_USB_GADGET=y -# CONFIG_USB_GADGETFS is not set # CONFIG_USB_GADGET_AMD5536UDC is not set # CONFIG_USB_GADGET_AT91 is not set # CONFIG_USB_GADGET_ATMEL_USBA is not set @@ -395,6 +392,7 @@ CONFIG_USB_GADGET=y # CONFIG_USB_GADGET_DEBUG_FILES is not set # CONFIG_USB_GADGET_DUALSPEED is not set # CONFIG_USB_GADGET_DUMMY_HCD is not set +# CONFIG_USB_GADGETFS is not set # CONFIG_USB_GADGET_FSL_QE is not set # CONFIG_USB_GADGET_FSL_USB2 is not set # CONFIG_USB_GADGET_GOKU is not set @@ -411,6 +409,7 @@ CONFIG_USB_GADGET_S3C2410=y # CONFIG_USB_GADGET_S3C_HSOTG is not set CONFIG_USB_GADGET_SELECTED=y CONFIG_USB_GADGET_VBUS_DRAW=500 +CONFIG_USB_GADGET=y # CONFIG_USB_G_PRINTER is not set # CONFIG_USB_G_SERIAL is not set CONFIG_USB_HID=y @@ -419,10 +418,11 @@ CONFIG_USB_HID=y # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set CONFIG_USB_OHCI_HCD=y -CONFIG_USB_S3C2410=y # CONFIG_USB_S3C2410_DEBUG is not set +CONFIG_USB_S3C2410=y CONFIG_USB_SUPPORT=y CONFIG_USB_SUSPEND=y +CONFIG_USB=y # CONFIG_USB_ZERO is not set # CONFIG_USER_NS is not set CONFIG_VECTORS_BASE=0xffff0000 @@ -430,9 +430,9 @@ CONFIG_VECTORS_BASE=0xffff0000 CONFIG_VIDEO_OUTPUT_CONTROL=y # CONFIG_VLAN_8021Q is not set CONFIG_VM_EVENT_COUNTERS=y -CONFIG_VT=y CONFIG_VT_CONSOLE=y CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_VT=y CONFIG_W1=m # CONFIG_WLAN_80211 is not set CONFIG_ZBOOT_ROM_BSS=0x0 diff --git a/target/linux/sibyte/config-default b/target/linux/sibyte/config-default index 6f8e4e57e..d87bc852f 100644 --- a/target/linux/sibyte/config-default +++ b/target/linux/sibyte/config-default @@ -1,6 +1,3 @@ -CONFIG_HWMON=y -CONFIG_SENSORS_LM90=y -CONFIG_HWMON_DEBUG_CHIP=y # CONFIG_32BIT is not set CONFIG_64BIT=y # CONFIG_ARCH_HAS_ILOG2_U32 is not set @@ -88,6 +85,8 @@ CONFIG_HAVE_IDE=y # CONFIG_HAVE_KRETPROBES is not set CONFIG_HAVE_OPROFILE=y CONFIG_HW_HAS_PCI=y +CONFIG_HWMON_DEBUG_CHIP=y +CONFIG_HWMON=y CONFIG_HW_RANDOM=m # CONFIG_HZ_100 is not set CONFIG_HZ=250 @@ -180,6 +179,7 @@ CONFIG_SB1250_MAC=y CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y # CONFIG_SCSI_DMA is not set # CONFIG_SCSI is not set +CONFIG_SENSORS_LM90=y # CONFIG_SERIAL_8250 is not set CONFIG_SERIAL_NONSTANDARD=y CONFIG_SERIAL_SB1250_DUART_CONSOLE=y diff --git a/target/linux/ubicom32/config-2.6.28 b/target/linux/ubicom32/config-2.6.28 index 8c1dae5dd..cea94dd64 100755 --- a/target/linux/ubicom32/config-2.6.28 +++ b/target/linux/ubicom32/config-2.6.28 @@ -10,31 +10,31 @@ CONFIG_BINFMT_FLAT=y # CONFIG_BINFMT_SHARED_FLAT is not set CONFIG_BINFMT_ZFLAT=y CONFIG_BITREVERSE=y -CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_BLK_DEV_RAM=y CONFIG_BRD_64MB=y # CONFIG_BSD_DISKLABEL is not set # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CLASSIC_RCU=y -CONFIG_CMDLINE="console=ttyUM0 console=ttyUS0 serdes=0x02004000,61,250000000" CONFIG_CMDLINE_BOOL=y +CONFIG_CMDLINE="console=ttyUM0 console=ttyUS0 serdes=0x02004000,61,250000000" # CONFIG_CMDLINE_OVERRIDE is not set CONFIG_CPU_BIG_ENDIAN=y CONFIG_CRC_CCITT=y CONFIG_CRYPTO_AEAD2=y CONFIG_CRYPTO_AES=y -CONFIG_CRYPTO_ALGAPI=y CONFIG_CRYPTO_ALGAPI2=y +CONFIG_CRYPTO_ALGAPI=y CONFIG_CRYPTO_ARC4=y -CONFIG_CRYPTO_BLKCIPHER=y CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_BLKCIPHER=y CONFIG_CRYPTO_ECB=y CONFIG_CRYPTO_HASH2=y CONFIG_CRYPTO_HW=y -CONFIG_CRYPTO_MANAGER=y CONFIG_CRYPTO_MANAGER2=y +CONFIG_CRYPTO_MANAGER=y CONFIG_CRYPTO_RNG2=y # CONFIG_CRYPTO_UBICOM32 is not set # CONFIG_DEBUG_FS is not set @@ -53,8 +53,8 @@ CONFIG_FORCE_MAX_ZONEORDER=14 # CONFIG_FPU is not set # CONFIG_FUTEX is not set # CONFIG_FW_LOADER is not set -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_FIND_NEXT_BIT=y CONFIG_GENERIC_GPIO=y # CONFIG_GEN_RTC is not set @@ -65,17 +65,17 @@ CONFIG_HAS_IOMEM=y CONFIG_HAVE_CLK=y # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set CONFIG_HAVE_OPROFILE=y -CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_UBICOM32=y +CONFIG_HW_RANDOM=y # CONFIG_I2C is not set CONFIG_INET_DIAG=y CONFIG_INET_TCP_DIAG=y CONFIG_INITRAMFS_ROOT_GID=0 CONFIG_INITRAMFS_ROOT_UID=0 CONFIG_INITRAMFS_SOURCE="../romfs ../vendors/Ubicom/RouterGateway/initramfs_list" -CONFIG_INPUT=y # CONFIG_INPUT_MISC is not set CONFIG_INPUT_POLLDEV=y +CONFIG_INPUT=y # CONFIG_IOSCHED_DEADLINE is not set # CONFIG_IP5160DEV is not set # CONFIG_IP5160EVAL is not set @@ -87,8 +87,8 @@ CONFIG_IP7160RGW=y # CONFIG_IP7500AV is not set # CONFIG_IP7500MEDIA is not set # CONFIG_IP7500MODULE is not set -# CONFIG_IRQSTACKS is not set CONFIG_IRQ_PER_CPU=y +# CONFIG_IRQSTACKS is not set # CONFIG_ISDN is not set # CONFIG_JFFS2_COMPRESSION_OPTIONS is not set # CONFIG_JFFS2_SUMMARY is not set @@ -97,8 +97,8 @@ CONFIG_LDM_DEBUG=y CONFIG_LDM_PARTITION=y CONFIG_LEDS_GPIO=y # CONFIG_LEDS_TRIGGERS is not set -CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LEGACY_PTYS=y CONFIG_LIBCRC32C=y # CONFIG_LINKER_RELAXATION is not set # CONFIG_MISC_DEVICES is not set @@ -119,9 +119,9 @@ CONFIG_OCM_MODULES_MAY_CONSUME_REMAINING_CODESPACE=y CONFIG_OCM_MODULES_RESERVATION=41 # CONFIG_PACKET_MMAP is not set CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PCI=y CONFIG_PCI_DEV0_IDSEL=0x001000000 CONFIG_PCI_DEV1_IDSEL=0x002000000 +CONFIG_PCI=y CONFIG_PRINTK_TIME=y CONFIG_PROTECT_KERNEL=y CONFIG_RAMBASE=0x40000000 @@ -131,37 +131,37 @@ CONFIG_RAMSIZE=0x4000000 CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y # CONFIG_SCSI_DMA is not set # CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_UBI32_MAILBOX=y CONFIG_SERIAL_UBI32_MAILBOX_CONSOLE=y +CONFIG_SERIAL_UBI32_MAILBOX=y # CONFIG_SERIAL_UBI32_SERDES is not set # CONFIG_SERIAL_UBI32_UARTTIO is not set # CONFIG_SIGNALFD is not set # CONFIG_SMP is not set -CONFIG_SPI=y CONFIG_SPI_BITBANG=y # CONFIG_SPI_GPIO is not set CONFIG_SPI_MASTER=y # CONFIG_SPI_SPIDEV is not set CONFIG_SPI_UBICOM32_GPIO=y +CONFIG_SPI=y # CONFIG_STOP_ON_BUG is not set # CONFIG_STOP_ON_TRAP is not set # CONFIG_SYSCTL_SYSCALL_CHECK is not set -CONFIG_SYSFS_DEPRECATED=y CONFIG_SYSFS_DEPRECATED_V2=y +CONFIG_SYSFS_DEPRECATED=y CONFIG_TICK_ONESHOT=y -# CONFIG_TIMERFD is not set -CONFIG_TIMER_EXTRA_ALLOC=0 CONFIG_TIME_LOW_RES=y +CONFIG_TIMER_EXTRA_ALLOC=0 +# CONFIG_TIMERFD is not set CONFIG_TINY_SHMEM=y CONFIG_UBI32_WDT=y -CONFIG_UBICOM32=y CONFIG_UBICOM32_GMAC=y CONFIG_UBICOM32_NAPI=y CONFIG_UBICOM32_OCM_FOR_SKB=y CONFIG_UBICOM32_V4=y +CONFIG_UBICOM32=y # CONFIG_UBICOM_HID is not set -CONFIG_UBICOM_INPUT=y # CONFIG_UBICOM_INPUT_I2C is not set +CONFIG_UBICOM_INPUT=y # CONFIG_UNALIGNED_ACCESS_DISABLED is not set CONFIG_UNALIGNED_ACCESS_ENABLED=y # CONFIG_UNALIGNED_ACCESS_USERSPACE_ONLY is not set diff --git a/target/linux/x86/config-2.6.28 b/target/linux/x86/config-2.6.28 index 6283ae09a..d7a0a6de2 100644 --- a/target/linux/x86/config-2.6.28 +++ b/target/linux/x86/config-2.6.28 @@ -36,9 +36,9 @@ CONFIG_BLK_DEV_AMD74XX=y # CONFIG_BLK_DEV_DTC2278 is not set CONFIG_BLK_DEV_GENERIC=y # CONFIG_BLK_DEV_HT6560B is not set -CONFIG_BLK_DEV_IDEDMA=y CONFIG_BLK_DEV_IDEDMA_PCI=y CONFIG_BLK_DEV_IDEDMA_SFF=y +CONFIG_BLK_DEV_IDEDMA=y CONFIG_BLK_DEV_IDEPCI=y CONFIG_BLK_DEV_PIIX=y # CONFIG_BLK_DEV_QD65XX is not set @@ -53,7 +53,6 @@ CONFIG_CLOCKSOURCE_WATCHDOG=y CONFIG_COMPAT_VDSO=y CONFIG_CONSOLE_TRANSLATIONS=y # CONFIG_CPU5_WDT is not set -CONFIG_CPU_FREQ=y # CONFIG_CPU_FREQ_DEBUG is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set @@ -65,9 +64,10 @@ CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_GOV_PERFORMANCE=y # CONFIG_CPU_FREQ_GOV_POWERSAVE is not set # CONFIG_CPU_FREQ_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_FREQ_STAT_DETAILS=y +CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_FREQ_TABLE=y +CONFIG_CPU_FREQ=y CONFIG_CPU_SUP_AMD=y CONFIG_CPU_SUP_CENTAUR_32=y CONFIG_CPU_SUP_CYRIX_32=y @@ -83,18 +83,18 @@ CONFIG_DEFAULT_IO_DELAY_TYPE=0 # CONFIG_DELL_RBU is not set # CONFIG_DEPCA is not set CONFIG_DEVPORT=y -CONFIG_DMI=y # CONFIG_DMIID is not set +CONFIG_DMI=y CONFIG_DNOTIFY=y CONFIG_DOUBLEFAULT=y CONFIG_DUMMY_CONSOLE=y -CONFIG_EARLY_PRINTK=y # CONFIG_EARLY_PRINTK_DBGP is not set +CONFIG_EARLY_PRINTK=y # CONFIG_EDAC is not set # CONFIG_EDD is not set # CONFIG_EISA is not set -# CONFIG_EL1 is not set # CONFIG_EL16 is not set +# CONFIG_EL1 is not set # CONFIG_EL2 is not set # CONFIG_EL3 is not set CONFIG_ELF_CORE=y @@ -107,9 +107,9 @@ CONFIG_FIRMWARE_IN_KERNEL=y CONFIG_FIRMWARE_MEMMAP=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y # CONFIG_GENERIC_CPU is not set CONFIG_GENERIC_FIND_FIRST_BIT=y @@ -140,9 +140,9 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y CONFIG_HAVE_OPROFILE=y # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y -CONFIG_HID=y CONFIG_HID_COMPAT=y CONFIG_HID_SUPPORT=y +CONFIG_HID=y # CONFIG_HIGHMEM4G is not set # CONFIG_HIGHMEM64G is not set # CONFIG_HIGH_RES_TIMERS is not set @@ -151,34 +151,33 @@ CONFIG_HID_SUPPORT=y CONFIG_HT_IRQ=y # CONFIG_HUGETLBFS is not set CONFIG_HW_CONSOLE=y -CONFIG_HW_RANDOM=y # CONFIG_HW_RANDOM_AMD is not set CONFIG_HW_RANDOM_GEODE=y # CONFIG_HW_RANDOM_INTEL is not set CONFIG_HW_RANDOM_VIA=y +CONFIG_HW_RANDOM=y # CONFIG_I2C is not set # CONFIG_I6300ESB_WDT is not set # CONFIG_I8K is not set # CONFIG_IB700_WDT is not set -# CONFIG_IBMASR is not set # CONFIG_IBM_ASM is not set -CONFIG_IDE=y -CONFIG_IDEPCI_PCIBUS_ORDER=y -CONFIG_IDE_GD=y -CONFIG_IDE_GD_ATA=y +# CONFIG_IBMASR is not set # CONFIG_IDE_GD_ATAPI is not set +CONFIG_IDE_GD_ATA=y +CONFIG_IDE_GD=y CONFIG_IDE_GENERIC=y +CONFIG_IDEPCI_PCIBUS_ORDER=y # CONFIG_IDE_PROC_FS is not set CONFIG_IDE_TIMINGS=y +CONFIG_IDE=y CONFIG_INITRAMFS_SOURCE="" -CONFIG_INPUT=y CONFIG_INPUT_KEYBOARD=y -CONFIG_INPUT_MOUSE=y -CONFIG_INPUT_MOUSEDEV=y CONFIG_INPUT_MOUSEDEV_PSAUX=y CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -# CONFIG_IOMMU_HELPER is not set +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT_MOUSE=y +CONFIG_INPUT=y CONFIG_IO_DELAY_0X80=y # CONFIG_IO_DELAY_0XED is not set # CONFIG_IO_DELAY_NONE is not set @@ -187,9 +186,10 @@ CONFIG_IO_DELAY_TYPE_0XED=1 CONFIG_IO_DELAY_TYPE_NONE=3 CONFIG_IO_DELAY_TYPE_UDELAY=2 # CONFIG_IO_DELAY_UDELAY is not set -CONFIG_ISA=y -CONFIG_ISAPNP=y +# CONFIG_IOMMU_HELPER is not set CONFIG_ISA_DMA_API=y +CONFIG_ISAPNP=y +CONFIG_ISA=y # CONFIG_ISCSI_IBFT_FIND is not set # CONFIG_IT8712F_WDT is not set # CONFIG_IT87_WDT is not set @@ -223,16 +223,15 @@ CONFIG_MATH_EMULATION=y # CONFIG_MEMTEST is not set # CONFIG_MGEODEGX1 is not set # CONFIG_MGEODE_LX is not set -CONFIG_MICROCODE=y # CONFIG_MICROCODE_AMD is not set CONFIG_MICROCODE_INTEL=y CONFIG_MICROCODE_OLD_INTERFACE=y +CONFIG_MICROCODE=y # CONFIG_MIXCOMWD is not set # CONFIG_MK6 is not set # CONFIG_MK7 is not set # CONFIG_MK8 is not set # CONFIG_MOUSE_BCM5974 is not set -CONFIG_MOUSE_PS2=y CONFIG_MOUSE_PS2_ALPS=y # CONFIG_MOUSE_PS2_ELANTECH is not set CONFIG_MOUSE_PS2_LIFEBOOK=y @@ -240,19 +239,20 @@ CONFIG_MOUSE_PS2_LOGIPS2PP=y CONFIG_MOUSE_PS2_SYNAPTICS=y # CONFIG_MOUSE_PS2_TOUCHKIT is not set CONFIG_MOUSE_PS2_TRACKPOINT=y +CONFIG_MOUSE_PS2=y # CONFIG_MOUSE_SERIAL is not set # CONFIG_MOUSE_VSXXXAA is not set # CONFIG_MPENTIUM4 is not set -# CONFIG_MPENTIUMII is not set # CONFIG_MPENTIUMIII is not set +# CONFIG_MPENTIUMII is not set # CONFIG_MPENTIUMM is not set # CONFIG_MPSC is not set CONFIG_MTD_BLOCK2MTD=y # CONFIG_MTD_CFI is not set # CONFIG_MTD_COMPLEX_MAPPINGS is not set # CONFIG_MTD_TS5500 is not set -CONFIG_MTRR=y # CONFIG_MTRR_SANITIZER is not set +CONFIG_MTRR=y # CONFIG_MVIAC3_2 is not set # CONFIG_MVIAC7 is not set # CONFIG_MWINCHIP3D is not set @@ -272,24 +272,24 @@ CONFIG_PAGE_OFFSET=0xC0000000 # CONFIG_PARAVIRT_GUEST is not set # CONFIG_PC8736x_GPIO is not set # CONFIG_PC87413_WDT is not set -CONFIG_PCI=y -# CONFIG_PCIEPORTBUS is not set CONFIG_PCI_BIOS=y CONFIG_PCI_DIRECT=y CONFIG_PCI_DOMAINS=y +# CONFIG_PCIEPORTBUS is not set CONFIG_PCI_GOANY=y # CONFIG_PCI_GOBIOS is not set # CONFIG_PCI_GODIRECT is not set # CONFIG_PCI_GOMMCONFIG is not set # CONFIG_PCI_GOOLPC is not set +CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y # CONFIG_PCWATCHDOG is not set CONFIG_PHYSICAL_ALIGN=0x100000 CONFIG_PHYSICAL_START=0x100000 -CONFIG_PNP=y # CONFIG_PNPACPI is not set # CONFIG_PNPBIOS is not set CONFIG_PNP_DEBUG_MESSAGES=y +CONFIG_PNP=y CONFIG_PROC_PAGE_MONITOR=y # CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set # CONFIG_R6040 is not set @@ -303,25 +303,25 @@ CONFIG_RTC=y # CONFIG_SCHED_HRTICK is not set CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y # CONFIG_SCSI_DMA is not set -CONFIG_SCx200=y -CONFIG_SCx200HR_TIMER=y # CONFIG_SCx200_GPIO is not set +CONFIG_SCx200HR_TIMER=y # CONFIG_SCx200_WDT is not set +CONFIG_SCx200=y # CONFIG_SERIAL_8250_EXTENDED is not set CONFIG_SERIAL_8250_PCI=y CONFIG_SERIAL_8250_PNP=y -CONFIG_SERIO=y # CONFIG_SERIO_CT82C710 is not set CONFIG_SERIO_I8042=y CONFIG_SERIO_LIBPS2=y # CONFIG_SERIO_PCIPS2 is not set # CONFIG_SERIO_RAW is not set CONFIG_SERIO_SERPORT=y +CONFIG_SERIO=y # CONFIG_SLAB is not set -CONFIG_SLUB=y -CONFIG_SLUB_DEBUG=y # CONFIG_SLUB_DEBUG_ON is not set +CONFIG_SLUB_DEBUG=y # CONFIG_SLUB_STATS is not set +CONFIG_SLUB=y # CONFIG_SMP is not set # CONFIG_SMSC37B787_WDT is not set # CONFIG_SONYPI is not set @@ -335,42 +335,41 @@ CONFIG_UID16=y CONFIG_USB_SUPPORT=y # CONFIG_USER_NS is not set # CONFIG_VGACON_SOFT_SCROLLBACK is not set -# CONFIG_VGASTATE is not set CONFIG_VGA_CONSOLE=y +# CONFIG_VGASTATE is not set # CONFIG_VIA_RHINE is not set CONFIG_VM86=y CONFIG_VM_EVENT_COUNTERS=y # CONFIG_VORTEX is not set -CONFIG_VT=y CONFIG_VT_CONSOLE=y # CONFIG_VT_HW_CONSOLE_BINDING is not set +CONFIG_VT=y # CONFIG_W83697UG_WDT is not set # CONFIG_WAFER_WDT is not set # CONFIG_WDT is not set -CONFIG_X86=y CONFIG_X86_32=y # CONFIG_X86_64 is not set CONFIG_X86_BIOS_REBOOT=y # CONFIG_X86_CHECK_BIOS_CORRUPTION is not set # CONFIG_X86_CMPXCHG is not set -CONFIG_X86_CPU=y # CONFIG_X86_CPUFREQ_NFORCE2 is not set # CONFIG_X86_CPUID is not set +CONFIG_X86_CPU=y # CONFIG_X86_ELAN is not set # CONFIG_X86_E_POWERSAVER is not set CONFIG_X86_F00F_BUG=y CONFIG_X86_FIND_SMP_CONFIG=y -CONFIG_X86_GENERIC=y # CONFIG_X86_GENERICARCH is not set +CONFIG_X86_GENERIC=y # CONFIG_X86_GX_SUSPMOD is not set CONFIG_X86_INTEL_USERCOPY=y CONFIG_X86_IO_APIC=y CONFIG_X86_L1_CACHE_SHIFT=7 CONFIG_X86_LOCAL_APIC=y # CONFIG_X86_LONGRUN is not set -CONFIG_X86_MCE=y # CONFIG_X86_MCE_NONFATAL is not set # CONFIG_X86_MCE_P4THERMAL is not set +CONFIG_X86_MCE=y CONFIG_X86_MINIMUM_CPU_FAMILY=3 CONFIG_X86_MPPARSE=y # CONFIG_X86_MSR is not set @@ -394,4 +393,5 @@ CONFIG_X86_UP_IOAPIC=y CONFIG_X86_VERBOSE_BOOTUP=y # CONFIG_X86_VOYAGER is not set # CONFIG_X86_VSMP is not set +CONFIG_X86=y # CONFIG_ZONE_DMA32 is not set diff --git a/target/linux/x86/config-2.6.30 b/target/linux/x86/config-2.6.30 index 6cc268590..36da392ed 100644 --- a/target/linux/x86/config-2.6.30 +++ b/target/linux/x86/config-2.6.30 @@ -26,11 +26,11 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_WANT_FRAME_POINTERS=y CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y # CONFIG_AT1700 is not set -CONFIG_ATA=y CONFIG_ATA_GENERIC=y # CONFIG_ATA_NONSTANDARD is not set CONFIG_ATA_PIIX=y CONFIG_ATA_SFF=y +CONFIG_ATA=y # CONFIG_AUDIT_ARCH is not set CONFIG_BASE_SMALL=0 # CONFIG_BINARY_PRINTF is not set @@ -45,7 +45,6 @@ CONFIG_CLOCKSOURCE_WATCHDOG=y CONFIG_COMPAT_VDSO=y CONFIG_CONSOLE_TRANSLATIONS=y # CONFIG_CPU5_WDT is not set -CONFIG_CPU_FREQ=y # CONFIG_CPU_FREQ_DEBUG is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set @@ -57,9 +56,10 @@ CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_GOV_PERFORMANCE=y # CONFIG_CPU_FREQ_GOV_POWERSAVE is not set # CONFIG_CPU_FREQ_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_FREQ_STAT_DETAILS=y +CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_FREQ_TABLE=y +CONFIG_CPU_FREQ=y CONFIG_CPU_SUP_AMD=y CONFIG_CPU_SUP_CENTAUR=y CONFIG_CPU_SUP_CYRIX_32=y @@ -79,18 +79,18 @@ CONFIG_DEFAULT_IO_DELAY_TYPE=0 # CONFIG_DEPCA is not set CONFIG_DEVPORT=y # CONFIG_DMA_API_DEBUG is not set -CONFIG_DMI=y # CONFIG_DMIID is not set +CONFIG_DMI=y CONFIG_DNOTIFY=y CONFIG_DOUBLEFAULT=y CONFIG_DUMMY_CONSOLE=y -CONFIG_EARLY_PRINTK=y # CONFIG_EARLY_PRINTK_DBGP is not set +CONFIG_EARLY_PRINTK=y # CONFIG_EDAC is not set # CONFIG_EDD is not set # CONFIG_EISA is not set -# CONFIG_EL1 is not set # CONFIG_EL16 is not set +# CONFIG_EL1 is not set # CONFIG_EL2 is not set # CONFIG_EL3 is not set CONFIG_ELF_CORE=y @@ -105,9 +105,9 @@ CONFIG_FIX_EARLYCON_MEM=y # CONFIG_FRAME_POINTER is not set # CONFIG_FTRACE_SYSCALLS is not set CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y # CONFIG_GENERIC_CPU is not set CONFIG_GENERIC_FIND_FIRST_BIT=y @@ -133,8 +133,8 @@ CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y CONFIG_HAVE_FTRACE_SYSCALLS=y CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y +CONFIG_HAVE_FUNCTION_TRACER=y CONFIG_HAVE_GENERIC_DMA_COHERENT=y CONFIG_HAVE_IDE=y CONFIG_HAVE_IOREMAP_PROT=y @@ -143,16 +143,16 @@ CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_LZMA=y CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_KVM=y CONFIG_HAVE_KVM_IRQCHIP=y +CONFIG_HAVE_KVM=y CONFIG_HAVE_LATENCYTOP_SUPPORT=y CONFIG_HAVE_MLOCK=y CONFIG_HAVE_MMIOTRACE_SUPPORT=y CONFIG_HAVE_OPROFILE=y CONFIG_HAVE_SETUP_PER_CPU_AREA=y CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y -CONFIG_HID=y CONFIG_HID_SUPPORT=y +CONFIG_HID=y # CONFIG_HIGHMEM4G is not set # CONFIG_HIGHMEM64G is not set # CONFIG_HIGH_RES_TIMERS is not set @@ -161,28 +161,26 @@ CONFIG_HID_SUPPORT=y CONFIG_HT_IRQ=y # CONFIG_HUGETLBFS is not set CONFIG_HW_CONSOLE=y -CONFIG_HW_RANDOM=y # CONFIG_HW_RANDOM_AMD is not set CONFIG_HW_RANDOM_GEODE=y # CONFIG_HW_RANDOM_INTEL is not set CONFIG_HW_RANDOM_VIA=y +CONFIG_HW_RANDOM=y # CONFIG_I2C is not set # CONFIG_I6300ESB_WDT is not set # CONFIG_I8K is not set # CONFIG_IB700_WDT is not set -# CONFIG_IBMASR is not set # CONFIG_IBM_ASM is not set +# CONFIG_IBMASR is not set CONFIG_INITRAMFS_SOURCE="" -CONFIG_INPUT=y CONFIG_INPUT_KEYBOARD=y -CONFIG_INPUT_MOUSE=y -CONFIG_INPUT_MOUSEDEV=y CONFIG_INPUT_MOUSEDEV_PSAUX=y CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT_MOUSE=y +CONFIG_INPUT=y # CONFIG_INPUT_YEALINK is not set -# CONFIG_IOMMU_API is not set -# CONFIG_IOMMU_HELPER is not set CONFIG_IO_DELAY_0X80=y # CONFIG_IO_DELAY_0XED is not set # CONFIG_IO_DELAY_NONE is not set @@ -191,9 +189,11 @@ CONFIG_IO_DELAY_TYPE_0XED=1 CONFIG_IO_DELAY_TYPE_NONE=3 CONFIG_IO_DELAY_TYPE_UDELAY=2 # CONFIG_IO_DELAY_UDELAY is not set -CONFIG_ISA=y -CONFIG_ISAPNP=y +# CONFIG_IOMMU_API is not set +# CONFIG_IOMMU_HELPER is not set CONFIG_ISA_DMA_API=y +CONFIG_ISAPNP=y +CONFIG_ISA=y # CONFIG_ISCSI_IBFT_FIND is not set # CONFIG_IT8712F_WDT is not set # CONFIG_IT87_WDT is not set @@ -231,17 +231,16 @@ CONFIG_MATH_EMULATION=y # CONFIG_MEMTEST is not set # CONFIG_MGEODEGX1 is not set # CONFIG_MGEODE_LX is not set -CONFIG_MICROCODE=y # CONFIG_MICROCODE_AMD is not set CONFIG_MICROCODE_INTEL=y CONFIG_MICROCODE_OLD_INTERFACE=y +CONFIG_MICROCODE=y # CONFIG_MIXCOMWD is not set # CONFIG_MK6 is not set # CONFIG_MK7 is not set # CONFIG_MK8 is not set # CONFIG_MMIOTRACE is not set # CONFIG_MOUSE_BCM5974 is not set -CONFIG_MOUSE_PS2=y CONFIG_MOUSE_PS2_ALPS=y # CONFIG_MOUSE_PS2_ELANTECH is not set CONFIG_MOUSE_PS2_LIFEBOOK=y @@ -249,19 +248,20 @@ CONFIG_MOUSE_PS2_LOGIPS2PP=y CONFIG_MOUSE_PS2_SYNAPTICS=y # CONFIG_MOUSE_PS2_TOUCHKIT is not set CONFIG_MOUSE_PS2_TRACKPOINT=y +CONFIG_MOUSE_PS2=y # CONFIG_MOUSE_SERIAL is not set # CONFIG_MOUSE_VSXXXAA is not set # CONFIG_MPENTIUM4 is not set -# CONFIG_MPENTIUMII is not set # CONFIG_MPENTIUMIII is not set +# CONFIG_MPENTIUMII is not set # CONFIG_MPENTIUMM is not set # CONFIG_MPSC is not set CONFIG_MTD_BLOCK2MTD=y # CONFIG_MTD_CFI is not set # CONFIG_MTD_COMPLEX_MAPPINGS is not set # CONFIG_MTD_TS5500 is not set -CONFIG_MTRR=y # CONFIG_MTRR_SANITIZER is not set +CONFIG_MTRR=y # CONFIG_MVIAC3_2 is not set # CONFIG_MVIAC7 is not set # CONFIG_MWINCHIP3D is not set @@ -289,24 +289,24 @@ CONFIG_PATA_SC1200=y CONFIG_PATA_VIA=y # CONFIG_PC8736x_GPIO is not set # CONFIG_PC87413_WDT is not set -CONFIG_PCI=y -# CONFIG_PCIEPORTBUS is not set CONFIG_PCI_BIOS=y CONFIG_PCI_DIRECT=y CONFIG_PCI_DOMAINS=y +# CONFIG_PCIEPORTBUS is not set CONFIG_PCI_GOANY=y # CONFIG_PCI_GOBIOS is not set # CONFIG_PCI_GODIRECT is not set # CONFIG_PCI_GOMMCONFIG is not set # CONFIG_PCI_GOOLPC is not set +CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y # CONFIG_PCWATCHDOG is not set CONFIG_PHYSICAL_ALIGN=0x100000 CONFIG_PHYSICAL_START=0x100000 -CONFIG_PNP=y # CONFIG_PNPACPI is not set # CONFIG_PNPBIOS is not set CONFIG_PNP_DEBUG_MESSAGES=y +CONFIG_PNP=y # CONFIG_POWER_TRACER is not set CONFIG_PROC_PAGE_MONITOR=y # CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set @@ -322,34 +322,34 @@ CONFIG_RTC=y # CONFIG_SC520_WDT is not set # CONFIG_SCHED_HRTICK is not set CONFIG_SCHED_OMIT_FRAME_POINTER=y -CONFIG_SCSI=y # CONFIG_SCSI_LOWLEVEL is not set -CONFIG_SCx200=y -CONFIG_SCx200HR_TIMER=y +CONFIG_SCSI=y # CONFIG_SCx200_GPIO is not set +CONFIG_SCx200HR_TIMER=y # CONFIG_SCx200_WDT is not set +CONFIG_SCx200=y # CONFIG_SERIAL_8250_EXTENDED is not set CONFIG_SERIAL_8250_PCI=y CONFIG_SERIAL_8250_PNP=y -CONFIG_SERIO=y # CONFIG_SERIO_CT82C710 is not set CONFIG_SERIO_I8042=y CONFIG_SERIO_LIBPS2=y # CONFIG_SERIO_PCIPS2 is not set # CONFIG_SERIO_RAW is not set CONFIG_SERIO_SERPORT=y +CONFIG_SERIO=y # CONFIG_SLAB is not set # CONFIG_SLOW_WORK is not set -CONFIG_SLUB=y -CONFIG_SLUB_DEBUG=y # CONFIG_SLUB_DEBUG_ON is not set +CONFIG_SLUB_DEBUG=y # CONFIG_SLUB_STATS is not set +CONFIG_SLUB=y # CONFIG_SMP is not set # CONFIG_SMSC37B787_WDT is not set # CONFIG_SMSC_SCH311X_WDT is not set # CONFIG_SONYPI is not set -CONFIG_SPARSEMEM_STATIC=y # CONFIG_SPARSE_IRQ is not set +CONFIG_SPARSEMEM_STATIC=y CONFIG_STRICT_DEVMEM=y # CONFIG_SYSPROF_TRACER is not set # CONFIG_TELCLOCK is not set @@ -365,25 +365,24 @@ CONFIG_VGA_CONSOLE=y CONFIG_VM86=y CONFIG_VM_EVENT_COUNTERS=y # CONFIG_VORTEX is not set -CONFIG_VT=y CONFIG_VT_CONSOLE=y # CONFIG_VT_HW_CONSOLE_BINDING is not set +CONFIG_VT=y # CONFIG_W83697UG_WDT is not set # CONFIG_WAFER_WDT is not set # CONFIG_WDT is not set -CONFIG_X86=y -CONFIG_X86_32=y CONFIG_X86_32_LAZY_GS=y +CONFIG_X86_32=y # CONFIG_X86_64 is not set # CONFIG_X86_CHECK_BIOS_CORRUPTION is not set # CONFIG_X86_CMPXCHG is not set -CONFIG_X86_CPU=y +# CONFIG_X86_CPU_DEBUG is not set # CONFIG_X86_CPUFREQ_NFORCE2 is not set # CONFIG_X86_CPUID is not set -# CONFIG_X86_CPU_DEBUG is not set +CONFIG_X86_CPU=y # CONFIG_X86_ELAN is not set -CONFIG_X86_EXTENDED_PLATFORM=y # CONFIG_X86_E_POWERSAVER is not set +CONFIG_X86_EXTENDED_PLATFORM=y CONFIG_X86_F00F_BUG=y CONFIG_X86_GENERIC=y # CONFIG_X86_GX_SUSPMOD is not set @@ -394,9 +393,9 @@ CONFIG_X86_L1_CACHE_BYTES=64 CONFIG_X86_L1_CACHE_SHIFT=4 CONFIG_X86_LOCAL_APIC=y # CONFIG_X86_LONGRUN is not set -CONFIG_X86_MCE=y # CONFIG_X86_MCE_NONFATAL is not set # CONFIG_X86_MCE_P4THERMAL is not set +CONFIG_X86_MCE=y CONFIG_X86_MINIMUM_CPU_FAMILY=3 CONFIG_X86_MPPARSE=y # CONFIG_X86_MSR is not set @@ -418,4 +417,5 @@ CONFIG_X86_RESERVE_LOW_64K=y CONFIG_X86_UP_APIC=y CONFIG_X86_UP_IOAPIC=y CONFIG_X86_VERBOSE_BOOTUP=y +CONFIG_X86=y # CONFIG_ZONE_DMA32 is not set diff --git a/target/linux/x86/config-2.6.31 b/target/linux/x86/config-2.6.31 index ce211009e..31c89fd03 100644 --- a/target/linux/x86/config-2.6.31 +++ b/target/linux/x86/config-2.6.31 @@ -26,11 +26,11 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_WANT_FRAME_POINTERS=y CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y # CONFIG_AT1700 is not set -CONFIG_ATA=y CONFIG_ATA_GENERIC=y # CONFIG_ATA_NONSTANDARD is not set CONFIG_ATA_PIIX=y CONFIG_ATA_SFF=y +CONFIG_ATA=y # CONFIG_AUDIT_ARCH is not set CONFIG_BASE_SMALL=0 # CONFIG_BINARY_PRINTF is not set @@ -46,7 +46,6 @@ CONFIG_COMPAT_VDSO=y CONFIG_CONSOLE_TRANSLATIONS=y CONFIG_CONSTRUCTORS=y # CONFIG_CPU5_WDT is not set -CONFIG_CPU_FREQ=y # CONFIG_CPU_FREQ_DEBUG is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set @@ -58,9 +57,10 @@ CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_GOV_PERFORMANCE=y # CONFIG_CPU_FREQ_GOV_POWERSAVE is not set # CONFIG_CPU_FREQ_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_FREQ_STAT_DETAILS=y +CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_FREQ_TABLE=y +CONFIG_CPU_FREQ=y CONFIG_CPU_SUP_AMD=y CONFIG_CPU_SUP_CENTAUR=y CONFIG_CPU_SUP_CYRIX_32=y @@ -80,18 +80,18 @@ CONFIG_DEFAULT_IO_DELAY_TYPE=0 # CONFIG_DEPCA is not set CONFIG_DEVPORT=y # CONFIG_DMA_API_DEBUG is not set -CONFIG_DMI=y # CONFIG_DMIID is not set +CONFIG_DMI=y CONFIG_DNOTIFY=y CONFIG_DOUBLEFAULT=y CONFIG_DUMMY_CONSOLE=y -CONFIG_EARLY_PRINTK=y # CONFIG_EARLY_PRINTK_DBGP is not set +CONFIG_EARLY_PRINTK=y # CONFIG_EDAC is not set # CONFIG_EDD is not set # CONFIG_EISA is not set -# CONFIG_EL1 is not set # CONFIG_EL16 is not set +# CONFIG_EL1 is not set # CONFIG_EL2 is not set # CONFIG_EL3 is not set CONFIG_ELF_CORE=y @@ -106,9 +106,9 @@ CONFIG_FIX_EARLYCON_MEM=y # CONFIG_FRAME_POINTER is not set CONFIG_FSNOTIFY=y CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y # CONFIG_GENERIC_CPU is not set CONFIG_GENERIC_FIND_FIRST_BIT=y @@ -137,8 +137,8 @@ CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y CONFIG_HAVE_FTRACE_SYSCALLS=y CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST=y CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y +CONFIG_HAVE_FUNCTION_TRACER=y CONFIG_HAVE_GENERIC_DMA_COHERENT=y CONFIG_HAVE_IDE=y CONFIG_HAVE_IOREMAP_PROT=y @@ -147,17 +147,17 @@ CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_LZMA=y CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_KVM=y CONFIG_HAVE_KVM_IRQCHIP=y +CONFIG_HAVE_KVM=y CONFIG_HAVE_LATENCYTOP_SUPPORT=y -CONFIG_HAVE_MLOCK=y CONFIG_HAVE_MLOCKED_PAGE_BIT=y +CONFIG_HAVE_MLOCK=y CONFIG_HAVE_MMIOTRACE_SUPPORT=y CONFIG_HAVE_OPROFILE=y CONFIG_HAVE_SETUP_PER_CPU_AREA=y CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y -CONFIG_HID=y CONFIG_HID_SUPPORT=y +CONFIG_HID=y # CONFIG_HIGHMEM4G is not set # CONFIG_HIGHMEM64G is not set # CONFIG_HIGH_RES_TIMERS is not set @@ -166,29 +166,26 @@ CONFIG_HID_SUPPORT=y CONFIG_HT_IRQ=y # CONFIG_HUGETLBFS is not set CONFIG_HW_CONSOLE=y -CONFIG_HW_RANDOM=y # CONFIG_HW_RANDOM_AMD is not set CONFIG_HW_RANDOM_GEODE=y # CONFIG_HW_RANDOM_INTEL is not set CONFIG_HW_RANDOM_VIA=y +CONFIG_HW_RANDOM=y # CONFIG_I2C is not set # CONFIG_I6300ESB_WDT is not set # CONFIG_I8K is not set # CONFIG_IB700_WDT is not set -# CONFIG_IBMASR is not set # CONFIG_IBM_ASM is not set +# CONFIG_IBMASR is not set CONFIG_INITRAMFS_SOURCE="" -CONFIG_INPUT=y CONFIG_INPUT_KEYBOARD=y -CONFIG_INPUT_MOUSE=y -CONFIG_INPUT_MOUSEDEV=y CONFIG_INPUT_MOUSEDEV_PSAUX=y CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT_MOUSE=y +CONFIG_INPUT=y # CONFIG_INPUT_YEALINK is not set -# CONFIG_IOMMU_API is not set -# CONFIG_IOMMU_HELPER is not set -# CONFIG_IOMMU_STRESS is not set CONFIG_IO_DELAY_0X80=y # CONFIG_IO_DELAY_0XED is not set # CONFIG_IO_DELAY_NONE is not set @@ -197,9 +194,12 @@ CONFIG_IO_DELAY_TYPE_0XED=1 CONFIG_IO_DELAY_TYPE_NONE=3 CONFIG_IO_DELAY_TYPE_UDELAY=2 # CONFIG_IO_DELAY_UDELAY is not set -CONFIG_ISA=y -CONFIG_ISAPNP=y +# CONFIG_IOMMU_API is not set +# CONFIG_IOMMU_HELPER is not set +# CONFIG_IOMMU_STRESS is not set CONFIG_ISA_DMA_API=y +CONFIG_ISAPNP=y +CONFIG_ISA=y # CONFIG_ISCSI_IBFT_FIND is not set # CONFIG_IT8712F_WDT is not set # CONFIG_IT87_WDT is not set @@ -238,16 +238,15 @@ CONFIG_MATH_EMULATION=y # CONFIG_MEMTEST is not set # CONFIG_MGEODEGX1 is not set # CONFIG_MGEODE_LX is not set -CONFIG_MICROCODE=y # CONFIG_MICROCODE_AMD is not set CONFIG_MICROCODE_INTEL=y CONFIG_MICROCODE_OLD_INTERFACE=y +CONFIG_MICROCODE=y # CONFIG_MIXCOMWD is not set # CONFIG_MK6 is not set # CONFIG_MK7 is not set # CONFIG_MK8 is not set # CONFIG_MOUSE_BCM5974 is not set -CONFIG_MOUSE_PS2=y CONFIG_MOUSE_PS2_ALPS=y # CONFIG_MOUSE_PS2_ELANTECH is not set CONFIG_MOUSE_PS2_LIFEBOOK=y @@ -255,19 +254,20 @@ CONFIG_MOUSE_PS2_LOGIPS2PP=y CONFIG_MOUSE_PS2_SYNAPTICS=y # CONFIG_MOUSE_PS2_TOUCHKIT is not set CONFIG_MOUSE_PS2_TRACKPOINT=y +CONFIG_MOUSE_PS2=y # CONFIG_MOUSE_SERIAL is not set # CONFIG_MOUSE_VSXXXAA is not set # CONFIG_MPENTIUM4 is not set -# CONFIG_MPENTIUMII is not set # CONFIG_MPENTIUMIII is not set +# CONFIG_MPENTIUMII is not set # CONFIG_MPENTIUMM is not set # CONFIG_MPSC is not set CONFIG_MTD_BLOCK2MTD=y # CONFIG_MTD_CFI is not set # CONFIG_MTD_COMPLEX_MAPPINGS is not set # CONFIG_MTD_TS5500 is not set -CONFIG_MTRR=y # CONFIG_MTRR_SANITIZER is not set +CONFIG_MTRR=y # CONFIG_MVIAC3_2 is not set # CONFIG_MVIAC7 is not set # CONFIG_MWINCHIP3D is not set @@ -296,24 +296,24 @@ CONFIG_PATA_SC1200=y CONFIG_PATA_VIA=y # CONFIG_PC8736x_GPIO is not set # CONFIG_PC87413_WDT is not set -CONFIG_PCI=y -# CONFIG_PCIEPORTBUS is not set CONFIG_PCI_BIOS=y CONFIG_PCI_DIRECT=y CONFIG_PCI_DOMAINS=y +# CONFIG_PCIEPORTBUS is not set CONFIG_PCI_GOANY=y # CONFIG_PCI_GOBIOS is not set # CONFIG_PCI_GODIRECT is not set # CONFIG_PCI_GOMMCONFIG is not set # CONFIG_PCI_GOOLPC is not set +CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y # CONFIG_PCWATCHDOG is not set CONFIG_PHYSICAL_ALIGN=0x100000 CONFIG_PHYSICAL_START=0x1000000 -CONFIG_PNP=y # CONFIG_PNPACPI is not set # CONFIG_PNPBIOS is not set CONFIG_PNP_DEBUG_MESSAGES=y +CONFIG_PNP=y CONFIG_PROC_PAGE_MONITOR=y # CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set CONFIG_RD_BZIP2=y @@ -328,34 +328,34 @@ CONFIG_RTC=y # CONFIG_SC520_WDT is not set # CONFIG_SCHED_HRTICK is not set CONFIG_SCHED_OMIT_FRAME_POINTER=y -CONFIG_SCSI=y # CONFIG_SCSI_LOWLEVEL is not set -CONFIG_SCx200=y -CONFIG_SCx200HR_TIMER=y +CONFIG_SCSI=y # CONFIG_SCx200_GPIO is not set +CONFIG_SCx200HR_TIMER=y # CONFIG_SCx200_WDT is not set +CONFIG_SCx200=y # CONFIG_SERIAL_8250_EXTENDED is not set CONFIG_SERIAL_8250_PCI=y CONFIG_SERIAL_8250_PNP=y -CONFIG_SERIO=y # CONFIG_SERIO_CT82C710 is not set CONFIG_SERIO_I8042=y CONFIG_SERIO_LIBPS2=y # CONFIG_SERIO_PCIPS2 is not set # CONFIG_SERIO_RAW is not set CONFIG_SERIO_SERPORT=y +CONFIG_SERIO=y # CONFIG_SLAB is not set # CONFIG_SLOW_WORK is not set -CONFIG_SLUB=y -CONFIG_SLUB_DEBUG=y # CONFIG_SLUB_DEBUG_ON is not set +CONFIG_SLUB_DEBUG=y # CONFIG_SLUB_STATS is not set +CONFIG_SLUB=y # CONFIG_SMP is not set # CONFIG_SMSC37B787_WDT is not set # CONFIG_SMSC_SCH311X_WDT is not set # CONFIG_SONYPI is not set -CONFIG_SPARSEMEM_STATIC=y # CONFIG_SPARSE_IRQ is not set +CONFIG_SPARSEMEM_STATIC=y CONFIG_STRICT_DEVMEM=y # CONFIG_TELCLOCK is not set # CONFIG_TOSHIBA is not set @@ -370,26 +370,25 @@ CONFIG_VGA_CONSOLE=y CONFIG_VM86=y CONFIG_VM_EVENT_COUNTERS=y # CONFIG_VORTEX is not set -CONFIG_VT=y CONFIG_VT_CONSOLE=y # CONFIG_VT_HW_CONSOLE_BINDING is not set +CONFIG_VT=y # CONFIG_W83697UG_WDT is not set # CONFIG_WAFER_WDT is not set # CONFIG_WDT is not set -CONFIG_X86=y -CONFIG_X86_32=y CONFIG_X86_32_LAZY_GS=y +CONFIG_X86_32=y # CONFIG_X86_64 is not set # CONFIG_X86_ANCIENT_MCE is not set # CONFIG_X86_CHECK_BIOS_CORRUPTION is not set # CONFIG_X86_CMPXCHG is not set -CONFIG_X86_CPU=y +# CONFIG_X86_CPU_DEBUG is not set # CONFIG_X86_CPUFREQ_NFORCE2 is not set # CONFIG_X86_CPUID is not set -# CONFIG_X86_CPU_DEBUG is not set +CONFIG_X86_CPU=y # CONFIG_X86_ELAN is not set -CONFIG_X86_EXTENDED_PLATFORM=y # CONFIG_X86_E_POWERSAVER is not set +CONFIG_X86_EXTENDED_PLATFORM=y CONFIG_X86_F00F_BUG=y CONFIG_X86_GENERIC=y # CONFIG_X86_GX_SUSPMOD is not set @@ -400,11 +399,11 @@ CONFIG_X86_L1_CACHE_BYTES=64 CONFIG_X86_L1_CACHE_SHIFT=4 CONFIG_X86_LOCAL_APIC=y # CONFIG_X86_LONGRUN is not set -CONFIG_X86_MCE=y CONFIG_X86_MCE_AMD=y # CONFIG_X86_MCE_INJECT is not set CONFIG_X86_MCE_INTEL=y CONFIG_X86_MCE_THRESHOLD=y +CONFIG_X86_MCE=y CONFIG_X86_MINIMUM_CPU_FAMILY=3 CONFIG_X86_MPPARSE=y # CONFIG_X86_MSR is not set @@ -429,4 +428,5 @@ CONFIG_X86_THERMAL_VECTOR=y CONFIG_X86_UP_APIC=y CONFIG_X86_UP_IOAPIC=y CONFIG_X86_VERBOSE_BOOTUP=y +CONFIG_X86=y # CONFIG_ZONE_DMA32 is not set diff --git a/target/linux/x86/olpc/config-2.6.30 b/target/linux/x86/olpc/config-2.6.30 index f4f32e0a9..dac5ea2c1 100644 --- a/target/linux/x86/olpc/config-2.6.30 +++ b/target/linux/x86/olpc/config-2.6.30 @@ -1,6 +1,5 @@ CONFIG_4KSTACKS=y # CONFIG_64BIT is not set -CONFIG_ACPI=y CONFIG_ACPI_AC=y # CONFIG_ACPI_ASUS is not set CONFIG_ACPI_BATTERY=y @@ -13,15 +12,16 @@ CONFIG_ACPI_BUTTON=y CONFIG_ACPI_FAN=y # CONFIG_ACPI_PCI_SLOT is not set CONFIG_ACPI_PROCESSOR=y +CONFIG_ACPI_PROC_EVENT=y # CONFIG_ACPI_PROCFS is not set CONFIG_ACPI_PROCFS_POWER=y -CONFIG_ACPI_PROC_EVENT=y # CONFIG_ACPI_SBS is not set CONFIG_ACPI_SLEEP=y CONFIG_ACPI_SYSFS_POWER=y CONFIG_ACPI_THERMAL=y # CONFIG_ACPI_TOSHIBA is not set # CONFIG_ACPI_WMI is not set +CONFIG_ACPI=y # CONFIG_AGP is not set # CONFIG_APM is not set CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" @@ -57,8 +57,8 @@ CONFIG_BINFMT_MISC=y CONFIG_BITREVERSE=y # CONFIG_BLK_DEV is not set CONFIG_BLK_DEV_SD=y -CONFIG_BLK_DEV_SR=y CONFIG_BLK_DEV_SR_VENDOR=y +CONFIG_BLK_DEV_SR=y # CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set @@ -74,7 +74,6 @@ CONFIG_CLOCKSOURCE_WATCHDOG=y CONFIG_COMPAT_VDSO=y CONFIG_CONSOLE_TRANSLATIONS=y # CONFIG_CPA_DEBUG is not set -CONFIG_CPU_FREQ=y # CONFIG_CPU_FREQ_DEBUG is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set @@ -86,12 +85,13 @@ CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_GOV_PERFORMANCE=y # CONFIG_CPU_FREQ_GOV_POWERSAVE is not set # CONFIG_CPU_FREQ_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_STAT=y # CONFIG_CPU_FREQ_STAT_DETAILS is not set +CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_FREQ_TABLE=y -CONFIG_CPU_IDLE=y +CONFIG_CPU_FREQ=y CONFIG_CPU_IDLE_GOV_LADDER=y CONFIG_CPU_IDLE_GOV_MENU=y +CONFIG_CPU_IDLE=y CONFIG_CPU_SUP_AMD=y # CONFIG_CPU_SUP_CENTAUR is not set # CONFIG_CPU_SUP_CYRIX_32 is not set @@ -115,8 +115,8 @@ CONFIG_CRYPTO_WORKQUEUE=y CONFIG_DEBUG_KERNEL=y # CONFIG_DEBUG_KOBJECT is not set # CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_DEBUG_MUTEXES is not set # CONFIG_DEBUG_NOTIFIERS is not set # CONFIG_DEBUG_NX_TEST is not set @@ -142,12 +142,12 @@ CONFIG_DETECT_SOFTLOCKUP=y CONFIG_DEVPORT=y CONFIG_DISPLAY_SUPPORT=y # CONFIG_DMA_API_DEBUG is not set -CONFIG_DMI=y CONFIG_DMIID=y +CONFIG_DMI=y CONFIG_DOUBLEFAULT=y CONFIG_DUMMY_CONSOLE=y -CONFIG_EARLY_PRINTK=y # CONFIG_EARLY_PRINTK_DBGP is not set +CONFIG_EARLY_PRINTK=y # CONFIG_EDAC is not set # CONFIG_EDD is not set # CONFIG_EEEPC_LAPTOP is not set @@ -156,33 +156,33 @@ CONFIG_ELF_CORE=y CONFIG_EXT2_FS=y CONFIG_FAST_CMPXCHG_LOCAL=y # CONFIG_FAULT_INJECTION is not set -CONFIG_FB=y CONFIG_FB_CFB_COPYAREA=y CONFIG_FB_CFB_FILLRECT=y CONFIG_FB_CFB_IMAGEBLIT=y -CONFIG_FB_GEODE=y -# CONFIG_FB_GEODE_GX is not set # CONFIG_FB_GEODE_GX1 is not set +# CONFIG_FB_GEODE_GX is not set CONFIG_FB_GEODE_LX=y +CONFIG_FB_GEODE=y +CONFIG_FB=y # CONFIG_FCOE_FNIC is not set # CONFIG_FIRMWARE_EDID is not set # CONFIG_FIRMWARE_MEMMAP is not set CONFIG_FIX_EARLYCON_MEM=y -# CONFIG_FONTS is not set CONFIG_FONT_8x16=y CONFIG_FONT_8x8=y -CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FONTS is not set CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y +CONFIG_FRAMEBUFFER_CONSOLE=y # CONFIG_FRAME_POINTER is not set CONFIG_FREEZER=y # CONFIG_FTRACE_STARTUP_TEST is not set # CONFIG_FTRACE_SYSCALLS is not set # CONFIG_FUJITSU_LAPTOP is not set CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y # CONFIG_GENERIC_CPU is not set CONFIG_GENERIC_FIND_FIRST_BIT=y @@ -210,8 +210,8 @@ CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y CONFIG_HAVE_FTRACE_SYSCALLS=y CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y +CONFIG_HAVE_FUNCTION_TRACER=y CONFIG_HAVE_GENERIC_DMA_COHERENT=y CONFIG_HAVE_IDE=y CONFIG_HAVE_IOREMAP_PROT=y @@ -220,8 +220,8 @@ CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_LZMA=y CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_KVM=y CONFIG_HAVE_KVM_IRQCHIP=y +CONFIG_HAVE_KVM=y CONFIG_HAVE_LATENCYTOP_SUPPORT=y CONFIG_HAVE_MLOCK=y CONFIG_HAVE_MMIOTRACE_SUPPORT=y @@ -229,37 +229,35 @@ CONFIG_HAVE_OPROFILE=y CONFIG_HAVE_SETUP_PER_CPU_AREA=y CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y CONFIG_HIBERNATION=y -CONFIG_HID=y CONFIG_HID_SUPPORT=y +CONFIG_HID=y # CONFIG_HIGHMEM4G is not set # CONFIG_HIGHMEM64G is not set -# CONFIG_HPET is not set CONFIG_HPET_EMULATE_RTC=y +# CONFIG_HPET is not set CONFIG_HPET_TIMER=y CONFIG_HT_IRQ=y # CONFIG_HUGETLBFS is not set CONFIG_HW_CONSOLE=y -CONFIG_HW_RANDOM=y # CONFIG_HW_RANDOM_AMD is not set CONFIG_HW_RANDOM_GEODE=y # CONFIG_HW_RANDOM_INTEL is not set CONFIG_HW_RANDOM_VIA=y +CONFIG_HW_RANDOM=y # CONFIG_I2C is not set # CONFIG_I8K is not set # CONFIG_IMA is not set CONFIG_INITRAMFS_SOURCE="" -CONFIG_INPUT=y CONFIG_INPUT_EVDEV=y CONFIG_INPUT_KEYBOARD=y -CONFIG_INPUT_MOUSE=y -CONFIG_INPUT_MOUSEDEV=y # CONFIG_INPUT_MOUSEDEV_PSAUX is not set CONFIG_INPUT_MOUSEDEV_SCREEN_X=1200 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=900 +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT_MOUSE=y +CONFIG_INPUT=y # CONFIG_INPUT_YEALINK is not set # CONFIG_INTEL_MENLOW is not set -# CONFIG_IOMMU_API is not set -# CONFIG_IOMMU_HELPER is not set CONFIG_IO_DELAY_0X80=y # CONFIG_IO_DELAY_0XED is not set # CONFIG_IO_DELAY_NONE is not set @@ -268,17 +266,19 @@ CONFIG_IO_DELAY_TYPE_0XED=1 CONFIG_IO_DELAY_TYPE_NONE=3 CONFIG_IO_DELAY_TYPE_UDELAY=2 # CONFIG_IO_DELAY_UDELAY is not set -# CONFIG_ISA is not set +# CONFIG_IOMMU_API is not set +# CONFIG_IOMMU_HELPER is not set CONFIG_ISA_DMA_API=y +# CONFIG_ISA is not set # CONFIG_ISCSI_IBFT_FIND is not set # CONFIG_ISDN is not set -CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_ALL is not set +CONFIG_KALLSYMS=y # CONFIG_KERNEL_BZIP2 is not set CONFIG_KERNEL_GZIP=y # CONFIG_KERNEL_LZMA is not set -CONFIG_KEXEC=y # CONFIG_KEXEC_JUMP is not set +CONFIG_KEXEC=y CONFIG_KEYBOARD_ATKBD=y # CONFIG_KEYBOARD_LKKBD is not set # CONFIG_KEYBOARD_NEWTON is not set @@ -316,12 +316,11 @@ CONFIG_MGEODE_LX=y # CONFIG_MK6 is not set # CONFIG_MK7 is not set # CONFIG_MK8 is not set -CONFIG_MMC=y CONFIG_MMC_BLOCK=y CONFIG_MMC_SDHCI=y +CONFIG_MMC=y # CONFIG_MMIOTRACE is not set # CONFIG_MOUSE_BCM5974 is not set -CONFIG_MOUSE_PS2=y CONFIG_MOUSE_PS2_ALPS=y # CONFIG_MOUSE_PS2_ELANTECH is not set CONFIG_MOUSE_PS2_LIFEBOOK=y @@ -330,11 +329,12 @@ CONFIG_MOUSE_PS2_OLPC=y CONFIG_MOUSE_PS2_SYNAPTICS=y # CONFIG_MOUSE_PS2_TOUCHKIT is not set CONFIG_MOUSE_PS2_TRACKPOINT=y +CONFIG_MOUSE_PS2=y # CONFIG_MOUSE_SERIAL is not set # CONFIG_MOUSE_VSXXXAA is not set # CONFIG_MPENTIUM4 is not set -# CONFIG_MPENTIUMII is not set # CONFIG_MPENTIUMIII is not set +# CONFIG_MPENTIUMII is not set # CONFIG_MPENTIUMM is not set # CONFIG_MPSC is not set # CONFIG_MSI_LAPTOP is not set @@ -349,12 +349,12 @@ CONFIG_MTD_PCI=y # CONFIG_MWINCHIP3D is not set # CONFIG_MWINCHIPC6 is not set # CONFIG_NETDEV_1000 is not set -# CONFIG_NETWORK_FILESYSTEMS is not set # CONFIG_NET_DROP_MONITOR is not set # CONFIG_NET_ETHERNET is not set +# CONFIG_NETWORK_FILESYSTEMS is not set CONFIG_NOHIGHMEM=y -CONFIG_NOP_TRACER=y CONFIG_NO_HZ=y +CONFIG_NOP_TRACER=y CONFIG_NR_CPUS=1 # CONFIG_NSC_GPIO is not set CONFIG_NVRAM=y @@ -367,32 +367,32 @@ CONFIG_PAGE_OFFSET=0xC0000000 # CONFIG_PARAVIRT_GUEST is not set # CONFIG_PARTITION_ADVANCED is not set # CONFIG_PC8736x_GPIO is not set -CONFIG_PCI=y -# CONFIG_PCIEPORTBUS is not set # CONFIG_PCI_DEBUG is not set CONFIG_PCI_DIRECT=y CONFIG_PCI_DOMAINS=y +# CONFIG_PCIEPORTBUS is not set # CONFIG_PCI_GOANY is not set # CONFIG_PCI_GOBIOS is not set # CONFIG_PCI_GODIRECT is not set # CONFIG_PCI_GOMMCONFIG is not set CONFIG_PCI_GOOLPC=y CONFIG_PCI_OLPC=y +CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y # CONFIG_PDA_POWER is not set CONFIG_PHYSICAL_ALIGN=0x100000 CONFIG_PHYSICAL_START=0x100000 -CONFIG_PM=y CONFIG_PM_DEBUG=y CONFIG_PM_SLEEP=y CONFIG_PM_STD_PARTITION="" # CONFIG_PM_TRACE_RTC is not set # CONFIG_PM_VERBOSE is not set -CONFIG_PNP=y +CONFIG_PM=y CONFIG_PNPACPI=y CONFIG_PNP_DEBUG_MESSAGES=y -CONFIG_POWER_SUPPLY=y +CONFIG_PNP=y # CONFIG_POWER_SUPPLY_DEBUG is not set +CONFIG_POWER_SUPPLY=y # CONFIG_POWER_TRACER is not set # CONFIG_PREEMPT_NONE is not set CONFIG_PREEMPT_VOLUNTARY=y @@ -408,32 +408,32 @@ CONFIG_RTC=y # CONFIG_RT_MUTEX_TESTER is not set # CONFIG_RWSEM_GENERIC_SPINLOCK is not set CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_SCHEDSTATS=y CONFIG_SCHED_DEBUG=y CONFIG_SCHED_HRTICK=y CONFIG_SCHED_OMIT_FRAME_POINTER=y +CONFIG_SCHEDSTATS=y CONFIG_SCSI=y # CONFIG_SCx200 is not set # CONFIG_SDIO_UART is not set # CONFIG_SERIAL_8250_EXTENDED is not set CONFIG_SERIAL_8250_PCI=y CONFIG_SERIAL_8250_PNP=y -CONFIG_SERIO=y # CONFIG_SERIO_CT82C710 is not set CONFIG_SERIO_I8042=y CONFIG_SERIO_LIBPS2=y # CONFIG_SERIO_PCIPS2 is not set # CONFIG_SERIO_RAW is not set CONFIG_SERIO_SERPORT=y +CONFIG_SERIO=y # CONFIG_SLOW_WORK is not set # CONFIG_SMP is not set # CONFIG_SONYPI is not set -CONFIG_SPARSEMEM_STATIC=y # CONFIG_SPARSE_IRQ is not set +CONFIG_SPARSEMEM_STATIC=y CONFIG_STACKTRACE=y CONFIG_STRICT_DEVMEM=y -CONFIG_SUSPEND=y CONFIG_SUSPEND_FREEZER=y +CONFIG_SUSPEND=y # CONFIG_SYSPROF_TRACER is not set # CONFIG_TC1100_WMI is not set # CONFIG_TELCLOCK is not set @@ -443,10 +443,9 @@ CONFIG_TICK_ONESHOT=y CONFIG_TIMER_STATS=y # CONFIG_TOSHIBA is not set CONFIG_TRACEPOINTS=y -CONFIG_TRACING=y CONFIG_TRACING_SUPPORT=y +CONFIG_TRACING=y CONFIG_UID16=y -CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_TT_NEWSCHED=y # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set @@ -456,35 +455,35 @@ CONFIG_USB_STORAGE=y CONFIG_USB_SUPPORT=y CONFIG_USB_SUSPEND=y CONFIG_USB_UHCI_HCD=y +CONFIG_USB=y CONFIG_USER_STACKTRACE_SUPPORT=y -CONFIG_VGACON_SOFT_SCROLLBACK=y CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=64 +CONFIG_VGACON_SOFT_SCROLLBACK=y CONFIG_VGA_CONSOLE=y CONFIG_VM86=y +CONFIG_VM_EVENT_COUNTERS=y # CONFIG_VMSPLIT_2G_OPT is not set # CONFIG_VMSPLIT_3G_OPT is not set -CONFIG_VM_EVENT_COUNTERS=y -CONFIG_VT=y CONFIG_VT_CONSOLE=y # CONFIG_VT_HW_CONSOLE_BINDING is not set +CONFIG_VT=y # CONFIG_WATCHDOG is not set -CONFIG_X86=y -CONFIG_X86_32=y CONFIG_X86_32_LAZY_GS=y +CONFIG_X86_32=y # CONFIG_X86_64 is not set # CONFIG_X86_ACPI_CPUFREQ is not set CONFIG_X86_BSWAP=y # CONFIG_X86_CHECK_BIOS_CORRUPTION is not set CONFIG_X86_CMPXCHG=y -CONFIG_X86_CPU=y +# CONFIG_X86_CPU_DEBUG is not set # CONFIG_X86_CPUFREQ_NFORCE2 is not set # CONFIG_X86_CPUID is not set -# CONFIG_X86_CPU_DEBUG is not set +CONFIG_X86_CPU=y CONFIG_X86_DEBUGCTLMSR=y # CONFIG_X86_DS is not set # CONFIG_X86_ELAN is not set -CONFIG_X86_EXTENDED_PLATFORM=y # CONFIG_X86_E_POWERSAVER is not set +CONFIG_X86_EXTENDED_PLATFORM=y CONFIG_X86_GENERIC=y # CONFIG_X86_GX_SUSPMOD is not set CONFIG_X86_INTEL_USERCOPY=y @@ -525,4 +524,5 @@ CONFIG_X86_USE_PPRO_CHECKSUM=y CONFIG_X86_VERBOSE_BOOTUP=y CONFIG_X86_WP_WORKS_OK=y CONFIG_X86_XADD=y +CONFIG_X86=y # CONFIG_ZONE_DMA32 is not set diff --git a/target/linux/x86/olpc/config-2.6.31 b/target/linux/x86/olpc/config-2.6.31 index 54f037ae0..1907d3469 100644 --- a/target/linux/x86/olpc/config-2.6.31 +++ b/target/linux/x86/olpc/config-2.6.31 @@ -1,6 +1,5 @@ CONFIG_4KSTACKS=y # CONFIG_64BIT is not set -CONFIG_ACPI=y CONFIG_ACPI_AC=y # CONFIG_ACPI_ASUS is not set CONFIG_ACPI_BATTERY=y @@ -13,15 +12,16 @@ CONFIG_ACPI_BUTTON=y CONFIG_ACPI_FAN=y # CONFIG_ACPI_PCI_SLOT is not set CONFIG_ACPI_PROCESSOR=y +CONFIG_ACPI_PROC_EVENT=y # CONFIG_ACPI_PROCFS is not set CONFIG_ACPI_PROCFS_POWER=y -CONFIG_ACPI_PROC_EVENT=y # CONFIG_ACPI_SBS is not set CONFIG_ACPI_SLEEP=y CONFIG_ACPI_SYSFS_POWER=y CONFIG_ACPI_THERMAL=y # CONFIG_ACPI_TOSHIBA is not set # CONFIG_ACPI_WMI is not set +CONFIG_ACPI=y # CONFIG_AGP is not set # CONFIG_APM is not set CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" @@ -42,10 +42,10 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_WANT_FRAME_POINTERS=y CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y # CONFIG_ASUS_LAPTOP is not set -CONFIG_ATA=y CONFIG_ATA_GENERIC=y # CONFIG_ATA_NONSTANDARD is not set CONFIG_ATA_PIIX=y +CONFIG_ATA=y # CONFIG_AUDIT_ARCH is not set CONFIG_BACKLIGHT_CLASS_DEVICE=y CONFIG_BACKLIGHT_GENERIC=y @@ -61,8 +61,8 @@ CONFIG_BINFMT_MISC=y CONFIG_BITREVERSE=y # CONFIG_BLK_DEV is not set CONFIG_BLK_DEV_SD=y -CONFIG_BLK_DEV_SR=y CONFIG_BLK_DEV_SR_VENDOR=y +CONFIG_BLK_DEV_SR=y # CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set @@ -79,7 +79,6 @@ CONFIG_COMPAT_VDSO=y CONFIG_CONSOLE_TRANSLATIONS=y CONFIG_CONTEXT_SWITCH_TRACER=y # CONFIG_CPA_DEBUG is not set -CONFIG_CPU_FREQ=y # CONFIG_CPU_FREQ_DEBUG is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set @@ -91,12 +90,13 @@ CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_GOV_PERFORMANCE=y # CONFIG_CPU_FREQ_GOV_POWERSAVE is not set # CONFIG_CPU_FREQ_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_STAT=y # CONFIG_CPU_FREQ_STAT_DETAILS is not set +CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_FREQ_TABLE=y -CONFIG_CPU_IDLE=y +CONFIG_CPU_FREQ=y CONFIG_CPU_IDLE_GOV_LADDER=y CONFIG_CPU_IDLE_GOV_MENU=y +CONFIG_CPU_IDLE=y CONFIG_CPU_SUP_AMD=y CONFIG_CPU_SUP_CENTAUR=y CONFIG_CPU_SUP_CYRIX_32=y @@ -115,8 +115,8 @@ CONFIG_DEBUG_KERNEL=y # CONFIG_DEBUG_KMEMLEAK is not set # CONFIG_DEBUG_KOBJECT is not set # CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set CONFIG_DEBUG_MEMORY_INIT=y # CONFIG_DEBUG_MUTEXES is not set # CONFIG_DEBUG_NOTIFIERS is not set @@ -144,13 +144,13 @@ CONFIG_DETECT_SOFTLOCKUP=y CONFIG_DEVPORT=y CONFIG_DISPLAY_SUPPORT=y # CONFIG_DMA_API_DEBUG is not set -CONFIG_DMI=y CONFIG_DMIID=y +CONFIG_DMI=y CONFIG_DNOTIFY=y CONFIG_DOUBLEFAULT=y CONFIG_DUMMY_CONSOLE=y -CONFIG_EARLY_PRINTK=y # CONFIG_EARLY_PRINTK_DBGP is not set +CONFIG_EARLY_PRINTK=y # CONFIG_EDAC is not set # CONFIG_EDD is not set # CONFIG_EFI is not set @@ -161,36 +161,36 @@ CONFIG_EVENT_TRACING=y CONFIG_EXT2_FS=y CONFIG_FAST_CMPXCHG_LOCAL=y # CONFIG_FAULT_INJECTION is not set -CONFIG_FB=y CONFIG_FB_CFB_COPYAREA=y CONFIG_FB_CFB_FILLRECT=y CONFIG_FB_CFB_IMAGEBLIT=y -CONFIG_FB_GEODE=y -# CONFIG_FB_GEODE_GX is not set # CONFIG_FB_GEODE_GX1 is not set +# CONFIG_FB_GEODE_GX is not set CONFIG_FB_GEODE_LX=y +CONFIG_FB_GEODE=y # CONFIG_FB_HGA is not set # CONFIG_FB_LE80578 is not set # CONFIG_FB_N411 is not set # CONFIG_FB_UDL is not set # CONFIG_FB_VESA is not set +CONFIG_FB=y # CONFIG_FIRMWARE_EDID is not set CONFIG_FIRMWARE_IN_KERNEL=y CONFIG_FIRMWARE_MEMMAP=y CONFIG_FIX_EARLYCON_MEM=y -# CONFIG_FONTS is not set CONFIG_FONT_8x16=y CONFIG_FONT_8x8=y -CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FONTS is not set CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y +CONFIG_FRAMEBUFFER_CONSOLE=y # CONFIG_FRAME_POINTER is not set CONFIG_FREEZER=y # CONFIG_FUJITSU_LAPTOP is not set CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y # CONFIG_GENERIC_CPU is not set CONFIG_GENERIC_FIND_FIRST_BIT=y @@ -221,8 +221,8 @@ CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y CONFIG_HAVE_FTRACE_SYSCALLS=y CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST=y CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y +CONFIG_HAVE_FUNCTION_TRACER=y CONFIG_HAVE_GENERIC_DMA_COHERENT=y CONFIG_HAVE_IDE=y CONFIG_HAVE_IOREMAP_PROT=y @@ -231,47 +231,44 @@ CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_LZMA=y CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_KVM=y CONFIG_HAVE_KVM_IRQCHIP=y +CONFIG_HAVE_KVM=y CONFIG_HAVE_LATENCYTOP_SUPPORT=y CONFIG_HAVE_MMIOTRACE_SUPPORT=y CONFIG_HAVE_OPROFILE=y CONFIG_HAVE_PERF_COUNTERS=y CONFIG_HAVE_SETUP_PER_CPU_AREA=y CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y -CONFIG_HIBERNATION=y CONFIG_HIBERNATION_NVS=y -CONFIG_HID=y +CONFIG_HIBERNATION=y CONFIG_HID_SUPPORT=y +CONFIG_HID=y # CONFIG_HIGHMEM4G is not set # CONFIG_HIGHMEM64G is not set # CONFIG_HIGH_RES_TIMERS is not set -# CONFIG_HPET is not set CONFIG_HPET_EMULATE_RTC=y +# CONFIG_HPET is not set CONFIG_HPET_TIMER=y CONFIG_HT_IRQ=y # CONFIG_HUGETLBFS is not set CONFIG_HW_CONSOLE=y -CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_GEODE=y CONFIG_HW_RANDOM_VIA=y +CONFIG_HW_RANDOM=y # CONFIG_I2C is not set # CONFIG_I8K is not set # CONFIG_IMA is not set CONFIG_INITRAMFS_SOURCE="" -CONFIG_INPUT=y CONFIG_INPUT_EVDEV=y CONFIG_INPUT_KEYBOARD=y -CONFIG_INPUT_MOUSE=y -CONFIG_INPUT_MOUSEDEV=y # CONFIG_INPUT_MOUSEDEV_PSAUX is not set CONFIG_INPUT_MOUSEDEV_SCREEN_X=1200 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=900 +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT_MOUSE=y +CONFIG_INPUT=y # CONFIG_INPUT_YEALINK is not set # CONFIG_INTEL_MENLOW is not set -# CONFIG_IOMMU_API is not set -# CONFIG_IOMMU_HELPER is not set -# CONFIG_IOMMU_STRESS is not set CONFIG_IO_DELAY_0X80=y # CONFIG_IO_DELAY_0XED is not set # CONFIG_IO_DELAY_NONE is not set @@ -280,17 +277,20 @@ CONFIG_IO_DELAY_TYPE_0XED=1 CONFIG_IO_DELAY_TYPE_NONE=3 CONFIG_IO_DELAY_TYPE_UDELAY=2 # CONFIG_IO_DELAY_UDELAY is not set -# CONFIG_ISA is not set +# CONFIG_IOMMU_API is not set +# CONFIG_IOMMU_HELPER is not set +# CONFIG_IOMMU_STRESS is not set CONFIG_ISA_DMA_API=y +# CONFIG_ISA is not set # CONFIG_ISCSI_IBFT_FIND is not set # CONFIG_ISDN is not set -CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_ALL is not set +CONFIG_KALLSYMS=y # CONFIG_KERNEL_BZIP2 is not set CONFIG_KERNEL_GZIP=y # CONFIG_KERNEL_LZMA is not set -CONFIG_KEXEC=y # CONFIG_KEXEC_JUMP is not set +CONFIG_KEXEC=y CONFIG_KEYBOARD_ATKBD=y # CONFIG_KEYBOARD_LKKBD is not set # CONFIG_KEYBOARD_NEWTON is not set @@ -329,15 +329,14 @@ CONFIG_MGEODE_LX=y # CONFIG_MK6 is not set # CONFIG_MK7 is not set # CONFIG_MK8 is not set -CONFIG_MMC=y CONFIG_MMC_BLOCK=y -CONFIG_MMC_SDHCI=y # CONFIG_MMC_SDHCI_PCI is not set # CONFIG_MMC_SDHCI_PLTFM is not set +CONFIG_MMC_SDHCI=y # CONFIG_MMC_TIFM_SD is not set # CONFIG_MMC_WBSD is not set +CONFIG_MMC=y # CONFIG_MOUSE_BCM5974 is not set -CONFIG_MOUSE_PS2=y CONFIG_MOUSE_PS2_ALPS=y # CONFIG_MOUSE_PS2_ELANTECH is not set CONFIG_MOUSE_PS2_LIFEBOOK=y @@ -346,11 +345,12 @@ CONFIG_MOUSE_PS2_OLPC=y CONFIG_MOUSE_PS2_SYNAPTICS=y # CONFIG_MOUSE_PS2_TOUCHKIT is not set CONFIG_MOUSE_PS2_TRACKPOINT=y +CONFIG_MOUSE_PS2=y # CONFIG_MOUSE_SERIAL is not set # CONFIG_MOUSE_VSXXXAA is not set # CONFIG_MPENTIUM4 is not set -# CONFIG_MPENTIUMII is not set # CONFIG_MPENTIUMIII is not set +# CONFIG_MPENTIUMII is not set # CONFIG_MPENTIUMM is not set # CONFIG_MPSC is not set # CONFIG_MSI_LAPTOP is not set @@ -366,14 +366,14 @@ CONFIG_MTD_CMDLINE_PARTS=y # CONFIG_MWINCHIPC6 is not set CONFIG_NAMESPACES=y # CONFIG_NETDEV_1000 is not set -# CONFIG_NETWORK_FILESYSTEMS is not set # CONFIG_NET_DROP_MONITOR is not set # CONFIG_NET_ETHERNET is not set # CONFIG_NET_NS is not set +# CONFIG_NETWORK_FILESYSTEMS is not set CONFIG_NLS=y CONFIG_NOHIGHMEM=y -CONFIG_NOP_TRACER=y CONFIG_NO_HZ=y +CONFIG_NOP_TRACER=y CONFIG_NR_CPUS=1 # CONFIG_NSC_GPIO is not set CONFIG_NVRAM=y @@ -392,33 +392,33 @@ CONFIG_PATA_OLDPIIX=y CONFIG_PATA_SC1200=y CONFIG_PATA_VIA=y # CONFIG_PC8736x_GPIO is not set -CONFIG_PCI=y -# CONFIG_PCIEPORTBUS is not set # CONFIG_PCI_DEBUG is not set CONFIG_PCI_DIRECT=y CONFIG_PCI_DOMAINS=y +# CONFIG_PCIEPORTBUS is not set # CONFIG_PCI_GOANY is not set # CONFIG_PCI_GOBIOS is not set # CONFIG_PCI_GODIRECT is not set # CONFIG_PCI_GOMMCONFIG is not set CONFIG_PCI_GOOLPC=y CONFIG_PCI_OLPC=y +CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y # CONFIG_PDA_POWER is not set CONFIG_PERF_COUNTERS=y CONFIG_PHYSICAL_ALIGN=0x100000 CONFIG_PHYSICAL_START=0x1000000 -CONFIG_PM=y CONFIG_PM_DEBUG=y CONFIG_PM_SLEEP=y CONFIG_PM_STD_PARTITION="" # CONFIG_PM_TRACE_RTC is not set # CONFIG_PM_VERBOSE is not set -CONFIG_PNP=y +CONFIG_PM=y CONFIG_PNPACPI=y CONFIG_PNP_DEBUG_MESSAGES=y -CONFIG_POWER_SUPPLY=y +CONFIG_PNP=y # CONFIG_POWER_SUPPLY_DEBUG is not set +CONFIG_POWER_SUPPLY=y # CONFIG_PREEMPT_NONE is not set CONFIG_PREEMPT_VOLUNTARY=y CONFIG_PROC_PAGE_MONITOR=y @@ -435,36 +435,36 @@ CONFIG_RTC=y # CONFIG_RT_MUTEX_TESTER is not set # CONFIG_RWSEM_GENERIC_SPINLOCK is not set CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_SCHEDSTATS=y CONFIG_SCHED_DEBUG=y # CONFIG_SCHED_HRTICK is not set CONFIG_SCHED_OMIT_FRAME_POINTER=y -CONFIG_SCSI=y +CONFIG_SCHEDSTATS=y # CONFIG_SCSI_LOWLEVEL is not set +CONFIG_SCSI=y # CONFIG_SCx200 is not set # CONFIG_SDIO_UART is not set # CONFIG_SERIAL_8250_EXTENDED is not set CONFIG_SERIAL_8250_PCI=y CONFIG_SERIAL_8250_PNP=y -CONFIG_SERIO=y # CONFIG_SERIO_CT82C710 is not set CONFIG_SERIO_I8042=y CONFIG_SERIO_LIBPS2=y # CONFIG_SERIO_PCIPS2 is not set # CONFIG_SERIO_RAW is not set CONFIG_SERIO_SERPORT=y +CONFIG_SERIO=y # CONFIG_SLAB is not set -CONFIG_SLUB=y -CONFIG_SLUB_DEBUG=y # CONFIG_SLUB_DEBUG_ON is not set +CONFIG_SLUB_DEBUG=y # CONFIG_SLUB_STATS is not set +CONFIG_SLUB=y # CONFIG_SMP is not set -CONFIG_SPARSEMEM_STATIC=y # CONFIG_SPARSE_IRQ is not set +CONFIG_SPARSEMEM_STATIC=y CONFIG_STACKTRACE=y CONFIG_STRICT_DEVMEM=y -CONFIG_SUSPEND=y CONFIG_SUSPEND_FREEZER=y +CONFIG_SUSPEND=y # CONFIG_TC1100_WMI is not set # CONFIG_TELCLOCK is not set CONFIG_THERMAL=y @@ -475,7 +475,6 @@ CONFIG_TIMER_STATS=y CONFIG_TRACEPOINTS=y CONFIG_TRACING=y CONFIG_UID16=y -CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_TT_NEWSCHED=y # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set @@ -485,35 +484,35 @@ CONFIG_USB_STORAGE=y CONFIG_USB_SUPPORT=y CONFIG_USB_SUSPEND=y CONFIG_USB_UHCI_HCD=y +CONFIG_USB=y # CONFIG_USER_NS is not set CONFIG_USER_STACKTRACE_SUPPORT=y -CONFIG_VGACON_SOFT_SCROLLBACK=y CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=64 +CONFIG_VGACON_SOFT_SCROLLBACK=y CONFIG_VGA_CONSOLE=y CONFIG_VM86=y CONFIG_VM_EVENT_COUNTERS=y -CONFIG_VT=y CONFIG_VT_CONSOLE=y # CONFIG_VT_HW_CONSOLE_BINDING is not set +CONFIG_VT=y # CONFIG_WATCHDOG is not set -CONFIG_X86=y -CONFIG_X86_32=y CONFIG_X86_32_LAZY_GS=y +CONFIG_X86_32=y # CONFIG_X86_64 is not set # CONFIG_X86_ACPI_CPUFREQ is not set # CONFIG_X86_ANCIENT_MCE is not set CONFIG_X86_BSWAP=y # CONFIG_X86_CHECK_BIOS_CORRUPTION is not set CONFIG_X86_CMPXCHG=y -CONFIG_X86_CPU=y +# CONFIG_X86_CPU_DEBUG is not set # CONFIG_X86_CPUFREQ_NFORCE2 is not set # CONFIG_X86_CPUID is not set -# CONFIG_X86_CPU_DEBUG is not set +CONFIG_X86_CPU=y CONFIG_X86_DEBUGCTLMSR=y # CONFIG_X86_DS is not set # CONFIG_X86_ELAN is not set -CONFIG_X86_EXTENDED_PLATFORM=y # CONFIG_X86_E_POWERSAVER is not set +CONFIG_X86_EXTENDED_PLATFORM=y CONFIG_X86_GENERIC=y # CONFIG_X86_GX_SUSPMOD is not set CONFIG_X86_INTEL_USERCOPY=y @@ -554,4 +553,5 @@ CONFIG_X86_USE_PPRO_CHECKSUM=y CONFIG_X86_VERBOSE_BOOTUP=y CONFIG_X86_WP_WORKS_OK=y CONFIG_X86_XADD=y +CONFIG_X86=y # CONFIG_ZONE_DMA32 is not set From 321cdf5b291bec35c60cbd69b8920cb3f9628038 Mon Sep 17 00:00:00 2001 From: kaloz Date: Wed, 11 Nov 2009 10:00:28 +0000 Subject: [PATCH 136/288] move CPUFREQ to generic configs git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18368 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/avr32/config-default | 1 - target/linux/generic-2.6/config-2.6.21 | 1 + target/linux/generic-2.6/config-2.6.25 | 1 + target/linux/generic-2.6/config-2.6.28 | 1 + target/linux/generic-2.6/config-2.6.30 | 1 + target/linux/generic-2.6/config-2.6.31 | 1 + target/linux/generic-2.6/config-2.6.32 | 1 + target/linux/mpc52xx/config-2.6.30 | 1 - target/linux/mpc83xx/config-default | 1 - target/linux/ppc40x/config-default | 1 - target/linux/ppc44x/config-default | 1 - target/linux/ps3/config-2.6.30 | 1 - target/linux/pxa/config-default | 1 - target/linux/rdc/config-2.6.28 | 1 - target/linux/rdc/config-2.6.30 | 1 - 15 files changed, 6 insertions(+), 9 deletions(-) diff --git a/target/linux/avr32/config-default b/target/linux/avr32/config-default index 640cddb11..2fd0e1320 100644 --- a/target/linux/avr32/config-default +++ b/target/linux/avr32/config-default @@ -29,7 +29,6 @@ CONFIG_BOARD_ATNGW100=y CONFIG_CLASSIC_RCU=y CONFIG_CPU_AT32AP7000=y CONFIG_CPU_AT32AP700X=y -# CONFIG_CPU_FREQ is not set # CONFIG_DEBUG_BUGVERBOSE is not set CONFIG_DMADEVICES=y CONFIG_DMA_ENGINE=y diff --git a/target/linux/generic-2.6/config-2.6.21 b/target/linux/generic-2.6/config-2.6.21 index 69e5a4b72..2aec24c6b 100644 --- a/target/linux/generic-2.6/config-2.6.21 +++ b/target/linux/generic-2.6/config-2.6.21 @@ -1,3 +1,4 @@ +# CONFIG_CPU_FREQ is not set # CONFIG_6PACK is not set # CONFIG_8139CP is not set # CONFIG_9P_FS is not set diff --git a/target/linux/generic-2.6/config-2.6.25 b/target/linux/generic-2.6/config-2.6.25 index 5be2b7766..df97842b5 100644 --- a/target/linux/generic-2.6/config-2.6.25 +++ b/target/linux/generic-2.6/config-2.6.25 @@ -1,3 +1,4 @@ +# CONFIG_CPU_FREQ is not set # CONFIG_6PACK is not set # CONFIG_8139CP is not set # CONFIG_9P_FS is not set diff --git a/target/linux/generic-2.6/config-2.6.28 b/target/linux/generic-2.6/config-2.6.28 index f82030c6a..a0546106e 100644 --- a/target/linux/generic-2.6/config-2.6.28 +++ b/target/linux/generic-2.6/config-2.6.28 @@ -1,3 +1,4 @@ +# CONFIG_CPU_FREQ is not set # CONFIG_6PACK is not set # CONFIG_8139CP is not set # CONFIG_9P_FS is not set diff --git a/target/linux/generic-2.6/config-2.6.30 b/target/linux/generic-2.6/config-2.6.30 index ce1861c2d..014842efe 100644 --- a/target/linux/generic-2.6/config-2.6.30 +++ b/target/linux/generic-2.6/config-2.6.30 @@ -1,3 +1,4 @@ +# CONFIG_CPU_FREQ is not set # CONFIG_6PACK is not set # CONFIG_8139CP is not set # CONFIG_8139TOO is not set diff --git a/target/linux/generic-2.6/config-2.6.31 b/target/linux/generic-2.6/config-2.6.31 index ccc7adf60..951619909 100644 --- a/target/linux/generic-2.6/config-2.6.31 +++ b/target/linux/generic-2.6/config-2.6.31 @@ -1,3 +1,4 @@ +# CONFIG_CPU_FREQ is not set # CONFIG_6PACK is not set # CONFIG_8139CP is not set # CONFIG_8139TOO is not set diff --git a/target/linux/generic-2.6/config-2.6.32 b/target/linux/generic-2.6/config-2.6.32 index b77bf0789..a5b2b868f 100644 --- a/target/linux/generic-2.6/config-2.6.32 +++ b/target/linux/generic-2.6/config-2.6.32 @@ -1,3 +1,4 @@ +# CONFIG_CPU_FREQ is not set # CONFIG_6PACK is not set # CONFIG_8139CP is not set # CONFIG_8139TOO is not set diff --git a/target/linux/mpc52xx/config-2.6.30 b/target/linux/mpc52xx/config-2.6.30 index a74afc604..fef5904da 100644 --- a/target/linux/mpc52xx/config-2.6.30 +++ b/target/linux/mpc52xx/config-2.6.30 @@ -31,7 +31,6 @@ CONFIG_BOUNCE=y CONFIG_CMDLINE_BOOL=y CONFIG_CMDLINE="console=ttyPSC0,115200" CONFIG_COMPAT_BRK=y -# CONFIG_CPU_FREQ is not set CONFIG_CRYPTO_AEAD2=y CONFIG_CRYPTO_BLKCIPHER2=y CONFIG_CRYPTO_BLKCIPHER=y diff --git a/target/linux/mpc83xx/config-default b/target/linux/mpc83xx/config-default index c37f3a631..8d2251228 100644 --- a/target/linux/mpc83xx/config-default +++ b/target/linux/mpc83xx/config-default @@ -34,7 +34,6 @@ CONFIG_BOUNCE=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CMDLINE_BOOL=y CONFIG_CMDLINE="console=ttyS0,115200" -# CONFIG_CPU_FREQ is not set CONFIG_CRYPTO_AEAD2=y CONFIG_CRYPTO_BLKCIPHER2=y CONFIG_CRYPTO_HASH2=y diff --git a/target/linux/ppc40x/config-default b/target/linux/ppc40x/config-default index 7ac38dfd8..0feb5260c 100644 --- a/target/linux/ppc40x/config-default +++ b/target/linux/ppc40x/config-default @@ -30,7 +30,6 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CMDLINE_BOOL=y CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,jffs2 noinitrd" CONFIG_CONSISTENT_SIZE=0x00200000 -# CONFIG_CPU_FREQ is not set CONFIG_CRYPTO_AEAD2=y CONFIG_CRYPTO_BLKCIPHER2=y CONFIG_CRYPTO_HASH2=y diff --git a/target/linux/ppc44x/config-default b/target/linux/ppc44x/config-default index 683e699af..0665c56d4 100644 --- a/target/linux/ppc44x/config-default +++ b/target/linux/ppc44x/config-default @@ -34,7 +34,6 @@ CONFIG_CMDLINE_BOOL=y CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/mtdblock1 rootfstype=squashfs,jffs2 noinitrd" CONFIG_CONSISTENT_SIZE=0x00200000 CONFIG_CONSISTENT_START=0xff100000 -# CONFIG_CPU_FREQ is not set # CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEFAULT_UIMAGE is not set CONFIG_DEVPORT=y diff --git a/target/linux/ps3/config-2.6.30 b/target/linux/ps3/config-2.6.30 index e937cb9ea..3459b5f4f 100644 --- a/target/linux/ps3/config-2.6.30 +++ b/target/linux/ps3/config-2.6.30 @@ -40,7 +40,6 @@ CONFIG_COMPAT_BINFMT_ELF=y CONFIG_COMPAT_BRK=y CONFIG_COMPAT=y CONFIG_CONSOLE_TRANSLATIONS=y -# CONFIG_CPU_FREQ is not set CONFIG_CRC16=y # CONFIG_CRYPTO is not set # CONFIG_DEBUG_BUGVERBOSE is not set diff --git a/target/linux/pxa/config-default b/target/linux/pxa/config-default index fb9c9d7b0..cae5cd275 100644 --- a/target/linux/pxa/config-default +++ b/target/linux/pxa/config-default @@ -45,7 +45,6 @@ CONFIG_CPU_CACHE_VIVT=y CONFIG_CPU_CP15_MMU=y CONFIG_CPU_CP15=y # CONFIG_CPU_DCACHE_DISABLE is not set -# CONFIG_CPU_FREQ is not set CONFIG_CPU_TLB_V4WBI=y CONFIG_CPU_XSCALE=y # CONFIG_DEBUG_BUGVERBOSE is not set diff --git a/target/linux/rdc/config-2.6.28 b/target/linux/rdc/config-2.6.28 index bab82f491..d491280c0 100644 --- a/target/linux/rdc/config-2.6.28 +++ b/target/linux/rdc/config-2.6.28 @@ -37,7 +37,6 @@ CONFIG_CMDLINE="console=ttyS0,38400 rootfstype=squashfs,jffs2" # CONFIG_CMDLINE_OVERRIDE is not set # CONFIG_COMPAT_VDSO is not set # CONFIG_CPU5_WDT is not set -# CONFIG_CPU_FREQ is not set # CONFIG_CPU_SUP_AMD is not set # CONFIG_CPU_SUP_CENTAUR_32 is not set CONFIG_CPU_SUP_CYRIX_32=y diff --git a/target/linux/rdc/config-2.6.30 b/target/linux/rdc/config-2.6.30 index a421e64e4..6f28ce29b 100644 --- a/target/linux/rdc/config-2.6.30 +++ b/target/linux/rdc/config-2.6.30 @@ -42,7 +42,6 @@ CONFIG_CMDLINE="console=ttyS0,38400 rootfstype=squashfs,jffs2" # CONFIG_COMPAT_NET_DEV_OPS is not set # CONFIG_COMPAT_VDSO is not set # CONFIG_CPU5_WDT is not set -# CONFIG_CPU_FREQ is not set # CONFIG_CPU_SUP_AMD is not set # CONFIG_CPU_SUP_CENTAUR is not set # CONFIG_CPU_SUP_CYRIX_32 is not set From 7d2dbfd7711b9b089d01cd1a028874ad8bd6c56f Mon Sep 17 00:00:00 2001 From: kaloz Date: Wed, 11 Nov 2009 11:38:02 +0000 Subject: [PATCH 137/288] we don't support the 2.6.27 kernels for a long time now git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18369 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar7/config-2.6.27 | 143 ------------------ .../patches-2.6.27/100-board_support.patch | 86 ----------- .../linux/ar7/patches-2.6.27/110-flash.patch | 26 ---- .../ar7/patches-2.6.27/120-gpio_chrdev.patch | 28 ---- .../linux/ar7/patches-2.6.27/130-vlynq.patch | 20 --- .../patches-2.6.27/140-watchdog_bootcr.patch | 29 ---- .../patches-2.6.27/150-cpmac_not_broken.patch | 11 -- .../160-cpmac_up_and_running.patch | 47 ------ .../patches-2.6.27/500-serial_kludge.patch | 40 ----- .../patches-2.6.27/900-cpmac_multiqueue.patch | 70 --------- .../patches-2.6.27/910-cpmac_fixed_phy.patch | 92 ----------- 11 files changed, 592 deletions(-) delete mode 100644 target/linux/ar7/config-2.6.27 delete mode 100644 target/linux/ar7/patches-2.6.27/100-board_support.patch delete mode 100644 target/linux/ar7/patches-2.6.27/110-flash.patch delete mode 100644 target/linux/ar7/patches-2.6.27/120-gpio_chrdev.patch delete mode 100644 target/linux/ar7/patches-2.6.27/130-vlynq.patch delete mode 100644 target/linux/ar7/patches-2.6.27/140-watchdog_bootcr.patch delete mode 100644 target/linux/ar7/patches-2.6.27/150-cpmac_not_broken.patch delete mode 100644 target/linux/ar7/patches-2.6.27/160-cpmac_up_and_running.patch delete mode 100644 target/linux/ar7/patches-2.6.27/500-serial_kludge.patch delete mode 100644 target/linux/ar7/patches-2.6.27/900-cpmac_multiqueue.patch delete mode 100644 target/linux/ar7/patches-2.6.27/910-cpmac_fixed_phy.patch diff --git a/target/linux/ar7/config-2.6.27 b/target/linux/ar7/config-2.6.27 deleted file mode 100644 index 2d74680c8..000000000 --- a/target/linux/ar7/config-2.6.27 +++ /dev/null @@ -1,143 +0,0 @@ -CONFIG_32BIT=y -# CONFIG_64BIT is not set -CONFIG_AR7_GPIO=y -CONFIG_AR7_WDT=y -CONFIG_AR7=y -# CONFIG_ARCH_HAS_ILOG2_U32 is not set -# CONFIG_ARCH_HAS_ILOG2_U64 is not set -CONFIG_ARCH_POPULATES_NODE_MAP=y -# CONFIG_ARCH_SUPPORTS_MSI is not set -CONFIG_ARCH_SUPPORTS_OPROFILE=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_BASE_SMALL=0 -# CONFIG_BCM47XX is not set -CONFIG_BITREVERSE=y -CONFIG_BOOT_ELF32=y -CONFIG_CEVT_R4K=y -CONFIG_CLASSIC_RCU=y -CONFIG_CMDLINE="rootfstype=squashfs,jffs2" -CONFIG_CPMAC=y -# CONFIG_CPU_BIG_ENDIAN is not set -CONFIG_CPU_HAS_LLSC=y -CONFIG_CPU_HAS_PREFETCH=y -CONFIG_CPU_HAS_SYNC=y -CONFIG_CPU_LITTLE_ENDIAN=y -# CONFIG_CPU_LOONGSON2 is not set -CONFIG_CPU_MIPS32_R1=y -# CONFIG_CPU_MIPS32_R2 is not set -CONFIG_CPU_MIPS32=y -# CONFIG_CPU_MIPS64_R1 is not set -# CONFIG_CPU_MIPS64_R2 is not set -CONFIG_CPU_MIPSR1=y -# CONFIG_CPU_NEVADA is not set -# CONFIG_CPU_R10000 is not set -# CONFIG_CPU_R3000 is not set -# CONFIG_CPU_R4300 is not set -# CONFIG_CPU_R4X00 is not set -# CONFIG_CPU_R5000 is not set -# CONFIG_CPU_R5432 is not set -# CONFIG_CPU_R6000 is not set -# CONFIG_CPU_R8000 is not set -# CONFIG_CPU_RM7000 is not set -# CONFIG_CPU_RM9000 is not set -# CONFIG_CPU_SB1 is not set -CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y -CONFIG_CPU_SUPPORTS_HIGHMEM=y -# CONFIG_CPU_TX39XX is not set -# CONFIG_CPU_TX49XX is not set -# CONFIG_CPU_VR41XX is not set -CONFIG_CSRC_R4K=y -# CONFIG_DM9000 is not set -CONFIG_DMA_NEED_PCI_MAP_STATE=y -CONFIG_DMA_NONCOHERENT=y -CONFIG_EARLY_PRINTK=y -CONFIG_FIXED_PHY=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CMOS_UPDATE=y -# CONFIG_GENERIC_FIND_FIRST_BIT is not set -CONFIG_GENERIC_FIND_NEXT_BIT=y -CONFIG_GENERIC_GPIO=y -CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT=y -CONFIG_HAVE_ARCH_KGDB=y -# CONFIG_HAVE_ARCH_TRACEHOOK is not set -# CONFIG_HAVE_CLK is not set -# CONFIG_HAVE_DMA_ATTRS is not set -# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set -# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set -CONFIG_HAVE_IDE=y -# CONFIG_HAVE_IOREMAP_PROT is not set -# CONFIG_HAVE_KPROBES is not set -# CONFIG_HAVE_KRETPROBES is not set -CONFIG_HAVE_OPROFILE=y -CONFIG_HW_RANDOM=y -# CONFIG_I2C is not set -# CONFIG_IDE is not set -CONFIG_INITRAMFS_SOURCE="" -CONFIG_IRQ_CPU=y -# CONFIG_ISDN is not set -CONFIG_KALLSYMS=y -CONFIG_LEDS_GPIO=y -# CONFIG_LEMOTE_FULONG is not set -# CONFIG_MACH_ALCHEMY is not set -# CONFIG_MACH_DECSTATION is not set -# CONFIG_MACH_JAZZ is not set -# CONFIG_MACH_TX39XX is not set -# CONFIG_MACH_TX49XX is not set -# CONFIG_MACH_VR41XX is not set -# CONFIG_MIKROTIK_RB532 is not set -# CONFIG_MIPS_COBALT is not set -CONFIG_MIPS_L1_CACHE_SHIFT=5 -# CONFIG_MIPS_MACHINE is not set -# CONFIG_MIPS_MALTA is not set -CONFIG_MIPS_MT_DISABLED=y -# CONFIG_MIPS_MT_SMP is not set -# CONFIG_MIPS_MT_SMTC is not set -# CONFIG_MIPS_SIM is not set -CONFIG_MIPS=y -CONFIG_MTD_AR7_PARTS=y -CONFIG_MTD_CFI_STAA=y -CONFIG_MTD_PHYSMAP_BANKWIDTH=2 -CONFIG_MTD_PHYSMAP_LEN=0 -CONFIG_MTD_PHYSMAP_START=0x10000000 -CONFIG_MTD_PHYSMAP=y -CONFIG_NO_EXCEPT_FILL=y -# CONFIG_NO_IOPORT is not set -CONFIG_PAGEFLAGS_EXTENDED=y -# CONFIG_PCSPKR_PLATFORM is not set -CONFIG_PHYLIB=y -# CONFIG_PMC_MSP is not set -# CONFIG_PMC_YOSEMITE is not set -# CONFIG_PNX8550_JBS is not set -# CONFIG_PNX8550_STB810 is not set -# CONFIG_PROBE_INITRD_HEADER is not set -CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y -# CONFIG_SCSI_DMA is not set -# CONFIG_SERIAL_8250_EXTENDED is not set -# CONFIG_SGI_IP22 is not set -# CONFIG_SGI_IP27 is not set -# CONFIG_SGI_IP28 is not set -# CONFIG_SGI_IP32 is not set -# CONFIG_SIBYTE_BIGSUR is not set -# CONFIG_SIBYTE_CARMEL is not set -# CONFIG_SIBYTE_CRHINE is not set -# CONFIG_SIBYTE_CRHONE is not set -# CONFIG_SIBYTE_LITTLESUR is not set -# CONFIG_SIBYTE_RHONE is not set -# CONFIG_SIBYTE_SENTOSA is not set -# CONFIG_SIBYTE_SWARM is not set -CONFIG_SWAP_IO_SPACE=y -CONFIG_SYS_HAS_CPU_MIPS32_R1=y -CONFIG_SYS_HAS_EARLY_PRINTK=y -CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y -CONFIG_SYS_SUPPORTS_ARBIT_HZ=y -CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y -CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y -CONFIG_TICK_ONESHOT=y -CONFIG_TRAD_SIGNALS=y -# CONFIG_VGASTATE is not set -CONFIG_VLYNQ=y -CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/ar7/patches-2.6.27/100-board_support.patch b/target/linux/ar7/patches-2.6.27/100-board_support.patch deleted file mode 100644 index 58bd909fb..000000000 --- a/target/linux/ar7/patches-2.6.27/100-board_support.patch +++ /dev/null @@ -1,86 +0,0 @@ ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -19,6 +19,24 @@ choice - prompt "System type" - default SGI_IP22 - -+config AR7 -+ bool "Texas Instruments AR7" -+ select BOOT_ELF32 -+ select DMA_NONCOHERENT -+ select CEVT_R4K -+ select CSRC_R4K -+ select IRQ_CPU -+ select NO_EXCEPT_FILL -+ select SWAP_IO_SPACE -+ select SYS_HAS_CPU_MIPS32_R1 -+ select SYS_HAS_EARLY_PRINTK -+ select SYS_SUPPORTS_32BIT_KERNEL -+ select SYS_SUPPORTS_KGDB -+ select SYS_SUPPORTS_LITTLE_ENDIAN -+ select SYS_SUPPORTS_BIG_ENDIAN -+ select GENERIC_GPIO -+ select GENERIC_HARDIRQS_NO__DO_IRQ -+ - config MACH_ALCHEMY - bool "Alchemy processor based machines" - ---- a/arch/mips/kernel/traps.c -+++ b/arch/mips/kernel/traps.c -@@ -1203,9 +1203,22 @@ void *set_except_vector(int n, void *add - - exception_handlers[n] = handler; - if (n == 0 && cpu_has_divec) { -- *(u32 *)(ebase + 0x200) = 0x08000000 | -- (0x03ffffff & (handler >> 2)); -- local_flush_icache_range(ebase + 0x200, ebase + 0x204); -+ if ((handler ^ (ebase + 4)) & 0xfc000000) { -+ /* lui k0, 0x0000 */ -+ *(u32 *)(ebase + 0x200) = 0x3c1a0000 | (handler >> 16); -+ /* ori k0, 0x0000 */ -+ *(u32 *)(ebase + 0x204) = -+ 0x375a0000 | (handler & 0xffff); -+ /* jr k0 */ -+ *(u32 *)(ebase + 0x208) = 0x03400008; -+ /* nop */ -+ *(u32 *)(ebase + 0x20C) = 0x00000000; -+ flush_icache_range(ebase + 0x200, ebase + 0x210); -+ } else { -+ *(u32 *)(ebase + 0x200) = -+ 0x08000000 | (0x03ffffff & (handler >> 2)); -+ flush_icache_range(ebase + 0x200, ebase + 0x204); -+ } - } - return (void *)old_handler; - } ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -167,6 +167,13 @@ libs-$(CONFIG_SIBYTE_CFE) += arch/mips/s - # - - # -+# Texas Instruments AR7 -+# -+core-$(CONFIG_AR7) += arch/mips/ar7/ -+cflags-$(CONFIG_AR7) += -Iinclude/asm-mips/ar7 -+load-$(CONFIG_AR7) += 0xffffffff94100000 -+ -+# - # Acer PICA 61, Mips Magnum 4000 and Olivetti M700. - # - core-$(CONFIG_MACH_JAZZ) += arch/mips/jazz/ ---- a/include/asm-mips/page.h -+++ b/include/asm-mips/page.h -@@ -182,8 +182,10 @@ typedef struct { unsigned long pgprot; } - #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) - --#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + UNCAC_BASE) --#define CAC_ADDR(addr) ((addr) - UNCAC_BASE + PAGE_OFFSET) -+#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + UNCAC_BASE + \ -+ PHYS_OFFSET) -+#define CAC_ADDR(addr) ((addr) - UNCAC_BASE + PAGE_OFFSET - \ -+ PHYS_OFFSET) - - #include - #include diff --git a/target/linux/ar7/patches-2.6.27/110-flash.patch b/target/linux/ar7/patches-2.6.27/110-flash.patch deleted file mode 100644 index 60c7f335d..000000000 --- a/target/linux/ar7/patches-2.6.27/110-flash.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -188,6 +188,12 @@ config MTD_MYLOADER_PARTS - You will still need the parsing functions to be called by the driver - for your particular device. It won't happen automatically. - -+config MTD_AR7_PARTS -+ tristate "TI AR7 partitioning support" -+ depends on MTD_PARTITIONS -+ ---help--- -+ TI AR7 partitioning support -+ - comment "User Modules And Translation Layers" - - config MTD_CHAR ---- a/drivers/mtd/maps/physmap.c -+++ b/drivers/mtd/maps/physmap.c -@@ -85,7 +85,7 @@ static int physmap_flash_remove(struct p - - static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", "map_rom", NULL }; - #ifdef CONFIG_MTD_PARTITIONS --static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL }; -+static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", "ar7part", NULL }; - #endif - - static int physmap_flash_probe(struct platform_device *dev) diff --git a/target/linux/ar7/patches-2.6.27/120-gpio_chrdev.patch b/target/linux/ar7/patches-2.6.27/120-gpio_chrdev.patch deleted file mode 100644 index 5df86ee6d..000000000 --- a/target/linux/ar7/patches-2.6.27/120-gpio_chrdev.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/drivers/char/Kconfig -+++ b/drivers/char/Kconfig -@@ -968,6 +968,15 @@ config MWAVE - To compile this driver as a module, choose M here: the - module will be called mwave. - -+config AR7_GPIO -+ tristate "TI AR7 GPIO Support" -+ depends on AR7 -+ help -+ Give userspace access to the GPIO pins on the Texas Instruments AR7 -+ processors. -+ -+ If compiled as a module, it will be called ar7_gpio. -+ - config SCx200_GPIO - tristate "NatSemi SCx200 GPIO Support" - depends on SCx200 ---- a/drivers/char/Makefile -+++ b/drivers/char/Makefile -@@ -90,6 +90,7 @@ obj-$(CONFIG_HW_RANDOM) += hw_random/ - obj-$(CONFIG_PPDEV) += ppdev.o - obj-$(CONFIG_NWBUTTON) += nwbutton.o - obj-$(CONFIG_NWFLASH) += nwflash.o -+obj-$(CONFIG_AR7_GPIO) += ar7_gpio.o - obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o - obj-$(CONFIG_PC8736x_GPIO) += pc8736x_gpio.o - obj-$(CONFIG_NSC_GPIO) += nsc_gpio.o diff --git a/target/linux/ar7/patches-2.6.27/130-vlynq.patch b/target/linux/ar7/patches-2.6.27/130-vlynq.patch deleted file mode 100644 index 9ab3638ea..000000000 --- a/target/linux/ar7/patches-2.6.27/130-vlynq.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/drivers/Kconfig -+++ b/drivers/Kconfig -@@ -100,5 +100,7 @@ source "drivers/auxdisplay/Kconfig" - - source "drivers/uio/Kconfig" - -+source "drivers/vlynq/Kconfig" -+ - source "drivers/xen/Kconfig" - endmenu ---- a/drivers/Makefile -+++ b/drivers/Makefile -@@ -96,6 +96,7 @@ obj-$(CONFIG_DCA) += dca/ - obj-$(CONFIG_HID) += hid/ - obj-$(CONFIG_PPC_PS3) += ps3/ - obj-$(CONFIG_OF) += of/ -+obj-$(CONFIG_VLYNQ) += vlynq/ - obj-$(CONFIG_SSB) += ssb/ - obj-$(CONFIG_VIRTIO) += virtio/ - obj-$(CONFIG_REGULATOR) += regulator/ diff --git a/target/linux/ar7/patches-2.6.27/140-watchdog_bootcr.patch b/target/linux/ar7/patches-2.6.27/140-watchdog_bootcr.patch deleted file mode 100644 index 95535def0..000000000 --- a/target/linux/ar7/patches-2.6.27/140-watchdog_bootcr.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/drivers/watchdog/ar7_wdt.c 2009-01-25 01:17:01.000000000 +1300 -+++ b/drivers/watchdog/ar7_wdt.c 2009-01-25 01:19:15.000000000 +1300 -@@ -293,12 +293,26 @@ - .fops = &ar7_wdt_fops, - }; - -+#define AR7_WDT_HARDWARE_ENABLE 0x10 -+ - static int __init ar7_wdt_init(void) - { - int rc; -+ u32 *bootcr; -+ u32 bootcr_value; - - ar7_wdt_get_regs(); - -+ /* arch/mips/ar7/clocks.c is the only other thing that reads this */ -+ bootcr = (u32 *)ioremap_nocache(AR7_REGS_DCL, 4); -+ bootcr_value = *bootcr; -+ iounmap(bootcr); -+ -+ if (!(bootcr_value & AR7_WDT_HARDWARE_ENABLE)) { -+ printk(KERN_INFO DRVNAME ": watchdog disabled in hardware (bootcr=%#x)\n", bootcr_value); -+ return -ENODEV; -+ } -+ - if (!request_mem_region(ar7_regs_wdt, sizeof(struct ar7_wdt), - LONGNAME)) { - printk(KERN_WARNING DRVNAME ": watchdog I/O region busy\n"); diff --git a/target/linux/ar7/patches-2.6.27/150-cpmac_not_broken.patch b/target/linux/ar7/patches-2.6.27/150-cpmac_not_broken.patch deleted file mode 100644 index e43369bde..000000000 --- a/target/linux/ar7/patches-2.6.27/150-cpmac_not_broken.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/drivers/net/Kconfig -+++ b/drivers/net/Kconfig -@@ -1823,7 +1823,7 @@ config SC92031 - - config CPMAC - tristate "TI AR7 CPMAC Ethernet support (EXPERIMENTAL)" -- depends on NET_ETHERNET && EXPERIMENTAL && AR7 && BROKEN -+ depends on NET_ETHERNET && EXPERIMENTAL && AR7 - select PHYLIB - help - TI AR7 CPMAC Ethernet support diff --git a/target/linux/ar7/patches-2.6.27/160-cpmac_up_and_running.patch b/target/linux/ar7/patches-2.6.27/160-cpmac_up_and_running.patch deleted file mode 100644 index d11bbf2e5..000000000 --- a/target/linux/ar7/patches-2.6.27/160-cpmac_up_and_running.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- a/arch/mips/ar7/platform.c -+++ b/arch/mips/ar7/platform.c -@@ -33,6 +33,8 @@ - #include - #include - #include -+#include -+#include - - #include - #include -@@ -205,6 +207,13 @@ - .width = 2, - }; - -+/* lets assume this is suitable for both high and low cpmacs links */ -+static struct fixed_phy_status fixed_phy_status __initdata = { -+ .link = 1, -+ .speed = 100, -+ .duplex = 1, -+}; -+ - static struct plat_cpmac_data cpmac_low_data = { - .reset_bit = 17, - .power_bit = 20, -@@ -506,6 +515,10 @@ - } - - if (ar7_has_high_cpmac()) { -+ res = fixed_phy_add(PHY_POLL, cpmac_high.id, &fixed_phy_status); -+ if (res && res != -ENODEV) -+ return res; -+ - cpmac_get_mac(1, cpmac_high_data.dev_addr); - res = platform_device_register(&cpmac_high); - if (res) -@@ -514,6 +527,10 @@ - cpmac_low_data.phy_mask = 0xffffffff; - } - -+ res = fixed_phy_add(PHY_POLL, cpmac_low.id, &fixed_phy_status); -+ if (res && res != -ENODEV) -+ return res; -+ - cpmac_get_mac(0, cpmac_low_data.dev_addr); - res = platform_device_register(&cpmac_low); - if (res) diff --git a/target/linux/ar7/patches-2.6.27/500-serial_kludge.patch b/target/linux/ar7/patches-2.6.27/500-serial_kludge.patch deleted file mode 100644 index e7a4b2447..000000000 --- a/target/linux/ar7/patches-2.6.27/500-serial_kludge.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- a/drivers/serial/8250.c -+++ b/drivers/serial/8250.c -@@ -264,6 +264,13 @@ static const struct serial8250_config ua - .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, - .flags = UART_CAP_FIFO, - }, -+ [PORT_AR7] = { -+ .name = "TI-AR7", -+ .fifo_size = 16, -+ .tx_loadsz = 16, -+ .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_00, -+ .flags = UART_CAP_FIFO | UART_CAP_AFE, -+ }, - }; - - #if defined (CONFIG_SERIAL_8250_AU1X00) -@@ -2552,7 +2559,11 @@ static void serial8250_console_putchar(s - { - struct uart_8250_port *up = (struct uart_8250_port *)port; - -+#ifdef CONFIG_AR7 -+ wait_for_xmitr(up, BOTH_EMPTY); -+#else - wait_for_xmitr(up, UART_LSR_THRE); -+#endif - serial_out(up, UART_TX, ch); - } - ---- a/include/linux/serial_core.h -+++ b/include/linux/serial_core.h -@@ -40,7 +40,8 @@ - #define PORT_NS16550A 14 - #define PORT_XSCALE 15 - #define PORT_RM9000 16 /* PMC-Sierra RM9xxx internal UART */ --#define PORT_MAX_8250 16 /* max port ID */ -+#define PORT_AR7 17 -+#define PORT_MAX_8250 17 /* max port ID */ - - /* - * ARM specific type numbers. These are not currently guaranteed diff --git a/target/linux/ar7/patches-2.6.27/900-cpmac_multiqueue.patch b/target/linux/ar7/patches-2.6.27/900-cpmac_multiqueue.patch deleted file mode 100644 index c604aa4c3..000000000 --- a/target/linux/ar7/patches-2.6.27/900-cpmac_multiqueue.patch +++ /dev/null @@ -1,70 +0,0 @@ -This patch fixes the network driver cpmac.c for compilation with -configuration option CONFIG_NETDEVICES_MULTIQUEUE. - -These compiler warnings are fixed by the patch: -drivers/net/cpmac.c: In function 'cpmac_end_xmit': -drivers/net/cpmac.c:630: warning: passing argument 2 of 'netif_subqueue_stopped' makes pointer from integer without a cast -drivers/net/cpmac.c:641: warning: passing argument 2 of 'netif_subqueue_stopped' makes pointer from integer without a cast -drivers/net/cpmac.c: In function 'cpmac_probe': -drivers/net/cpmac.c:1128: warning: unused variable 'i' - -During runtime, the unpatched driver raises a fatal runtime exception. -This is fixed by calling __netif_subqueue_stopped instead -of netif_subqueue_stopped, too. - -Two additional code parts were modified for CONFIG_NETDEVICES_MULTIQUEUE -because other drivers do it in the same way. - - Signed-off-by: Stefan Weil - ---- a/drivers/net/cpmac.c -+++ b/drivers/net/cpmac.c -@@ -621,13 +621,13 @@ static void cpmac_end_xmit(struct net_de - - dev_kfree_skb_irq(desc->skb); - desc->skb = NULL; -- if (netif_subqueue_stopped(dev, queue)) -+ if (__netif_subqueue_stopped(dev, queue)) - netif_wake_subqueue(dev, queue); - } else { - if (netif_msg_tx_err(priv) && net_ratelimit()) - printk(KERN_WARNING - "%s: end_xmit: spurious interrupt\n", dev->name); -- if (netif_subqueue_stopped(dev, queue)) -+ if (__netif_subqueue_stopped(dev, queue)) - netif_wake_subqueue(dev, queue); - } - } -@@ -737,7 +737,6 @@ static void cpmac_clear_tx(struct net_de - - static void cpmac_hw_error(struct work_struct *work) - { -- int i; - struct cpmac_priv *priv = - container_of(work, struct cpmac_priv, reset_work); - -@@ -824,7 +823,6 @@ static irqreturn_t cpmac_irq(int irq, vo - - static void cpmac_tx_timeout(struct net_device *dev) - { -- int i; - struct cpmac_priv *priv = netdev_priv(dev); - - spin_lock(&priv->lock); -@@ -1103,7 +1101,7 @@ static int external_switch; - - static int __devinit cpmac_probe(struct platform_device *pdev) - { -- int rc, phy_id, i; -+ int rc, phy_id; - char *mdio_bus_id = "0"; - struct resource *mem; - struct cpmac_priv *priv; -@@ -1132,6 +1130,7 @@ static int __devinit cpmac_probe(struct - } - - dev = alloc_etherdev_mq(sizeof(*priv), CPMAC_QUEUES); -+ //~ dev = alloc_etherdev(sizeof(*priv)); - - if (!dev) { - printk(KERN_ERR "cpmac: Unable to allocate net_device\n"); diff --git a/target/linux/ar7/patches-2.6.27/910-cpmac_fixed_phy.patch b/target/linux/ar7/patches-2.6.27/910-cpmac_fixed_phy.patch deleted file mode 100644 index dd4bb76a3..000000000 --- a/target/linux/ar7/patches-2.6.27/910-cpmac_fixed_phy.patch +++ /dev/null @@ -1,92 +0,0 @@ -This is a hack to make cpmac work with the external switch on a DG834 v3; it -should also work on other similar routers. It has not been tested on hardware -with multiple cpmac devices or with no external switch. It may be safer to -move external_switch to pdata rather than trying to detect it, and to set -phy_mask correctly rather than moving the phy search loop. - ---- a/drivers/net/cpmac.c 2008-11-11 06:18:24.000000000 +1100 -+++ b/drivers/net/cpmac.c 2009-04-11 10:58:58.000000000 +1000 -@@ -1124,8 +1124,8 @@ - - static int __devinit cpmac_probe(struct platform_device *pdev) - { - int rc, phy_id; -- char *mdio_bus_id = "0"; -+ char mdio_bus_id[BUS_ID_SIZE]; - struct resource *mem; - struct cpmac_priv *priv; - struct net_device *dev; -@@ -1134,22 +1134,23 @@ - - pdata = pdev->dev.platform_data; - -- for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) { -- if (!(pdata->phy_mask & (1 << phy_id))) -- continue; -- if (!cpmac_mii.phy_map[phy_id]) -- continue; -- break; -+ if (external_switch || dumb_switch) { -+ strncpy(mdio_bus_id, "0", BUS_ID_SIZE); /* fixed phys bus */ -+ phy_id = pdev->id; -+ } else { -+ for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) { -+ if (!(pdata->phy_mask & (1 << phy_id))) -+ continue; -+ if (!cpmac_mii.phy_map[phy_id]) -+ continue; -+ strncpy(mdio_bus_id, cpmac_mii.id, BUS_ID_SIZE); -+ break; -+ } - } - - if (phy_id == PHY_MAX_ADDR) { -- if (external_switch || dumb_switch) { -- mdio_bus_id = 0; /* fixed phys bus */ -- phy_id = pdev->id; -- } else { -- dev_err(&pdev->dev, "no PHY present\n"); -- return -ENODEV; -- } -+ dev_err(&pdev->dev, "no PHY present\n"); -+ return -ENODEV; - } - - #ifdef CONFIG_NETDEVICES_MULTIQUEUE -@@ -1189,9 +1190,11 @@ - priv->ring_size = 64; - priv->msg_enable = netif_msg_init(debug_level, 0xff); - memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr)); -+ -+ snprintf(priv->phy_name, BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id); - -- priv->phy = phy_connect(dev, cpmac_mii.phy_map[phy_id]->dev.bus_id, -- &cpmac_adjust_link, 0, PHY_INTERFACE_MODE_MII); -+ priv->phy = phy_connect(dev, priv->phy_name, &cpmac_adjust_link, 0, -+ PHY_INTERFACE_MODE_MII); - if (IS_ERR(priv->phy)) { - if (netif_msg_drv(priv)) - printk(KERN_ERR "%s: Could not attach to PHY\n", -@@ -1250,11 +1253,11 @@ - - cpmac_mii.reset(&cpmac_mii); - -- for (i = 0; i < 300000; i++) -+ for (i = 0; i < 300; i++) - if ((mask = cpmac_read(cpmac_mii.priv, CPMAC_MDIO_ALIVE))) - break; - else -- cpu_relax(); -+ msleep(10); - - mask &= 0x7fffffff; - if (mask & (mask - 1)) { -@@ -1267,7 +1270,7 @@ - } - - cpmac_mii.phy_mask = ~(mask | 0x80000000); -- snprintf(cpmac_mii.id, MII_BUS_ID_SIZE, "0"); -+ snprintf(cpmac_mii.id, MII_BUS_ID_SIZE, "1"); - - res = mdiobus_register(&cpmac_mii); - if (res) From 5ed0363af9f4edda4a63b02250c7822851e7e6f4 Mon Sep 17 00:00:00 2001 From: kaloz Date: Wed, 11 Nov 2009 11:42:24 +0000 Subject: [PATCH 138/288] another round of kernel config cleanups git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18370 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/adm5120/router_be/config-2.6.28 | 3 --- target/linux/adm5120/router_be/config-2.6.30 | 3 --- target/linux/adm5120/router_be/config-2.6.31 | 3 --- target/linux/adm5120/router_le/config-2.6.28 | 7 ------- target/linux/adm5120/router_le/config-2.6.30 | 7 ------- target/linux/adm5120/router_le/config-2.6.31 | 6 ------ target/linux/amazon/config-2.6.21 | 1 - target/linux/ar7/config-default | 3 +-- target/linux/ar71xx/config-2.6.28 | 4 ---- target/linux/ar71xx/config-2.6.30 | 4 ---- target/linux/ar71xx/config-2.6.31 | 4 ---- target/linux/at91/config-2.6.25 | 5 +---- target/linux/atheros/config-2.6.30 | 3 --- target/linux/atheros/config-2.6.31 | 3 --- target/linux/au1000/au1500/config-default | 4 ---- target/linux/au1000/au1550/config-default | 4 ---- target/linux/avr32/config-default | 4 +--- target/linux/brcm47xx/config-2.6.28 | 4 ---- target/linux/brcm47xx/config-2.6.30 | 4 ---- target/linux/brcm47xx/config-2.6.31 | 4 ---- target/linux/brcm63xx/config-2.6.30 | 4 ---- target/linux/cobalt/config-default | 5 ----- target/linux/coldfire/config-default | 4 ---- target/linux/etrax/config-2.6.30 | 2 +- target/linux/gemini/config-default | 5 ----- target/linux/generic-2.6/config-2.6.21 | 9 ++++++++- target/linux/generic-2.6/config-2.6.25 | 11 +++++++++-- target/linux/generic-2.6/config-2.6.28 | 12 +++++++++--- target/linux/generic-2.6/config-2.6.30 | 10 ++++++++-- target/linux/generic-2.6/config-2.6.31 | 10 ++++++++-- target/linux/generic-2.6/config-2.6.32 | 10 ++++++++-- target/linux/goldfish/config-2.6.30 | 3 +-- target/linux/ifxmips/config-2.6.30 | 3 --- target/linux/iop32x/config-default | 7 ------- target/linux/ixp4xx/config-2.6.28 | 10 ---------- target/linux/ixp4xx/config-2.6.30 | 6 ------ target/linux/ixp4xx/config-2.6.31 | 6 ------ target/linux/ixp4xx/config-2.6.32 | 6 ------ target/linux/ixp4xx/config-default | 10 ---------- target/linux/kirkwood/config-default | 10 ---------- target/linux/mpc52xx/config-2.6.30 | 5 ----- target/linux/mpc83xx/config-default | 10 ---------- target/linux/octeon/config-default | 3 --- target/linux/olpc/config-2.6.30 | 4 ---- target/linux/orion/config-default | 10 ---------- target/linux/ppc40x/config-default | 6 ------ target/linux/ppc44x/config-default | 6 ------ target/linux/ps3/config-2.6.30 | 3 +-- target/linux/pxa/config-default | 4 ---- target/linux/pxcab/config-2.6.30 | 2 -- target/linux/pxcab/config-2.6.31 | 2 -- target/linux/ramips/rt288x/config-2.6.30 | 4 ---- target/linux/ramips/rt305x/config-2.6.30 | 2 -- target/linux/rb532/config-default | 6 ------ target/linux/rdc/config-2.6.28 | 5 ----- target/linux/rdc/config-2.6.30 | 4 ---- target/linux/s3c24xx/config-2.6.30 | 2 +- target/linux/s3c24xx/config-2.6.31 | 2 +- target/linux/sibyte/config-default | 2 -- target/linux/ubicom32/config-2.6.28 | 3 --- target/linux/uml/config/i386 | 1 + target/linux/uml/config/x86_64 | 1 + target/linux/x86/config-2.6.28 | 3 --- target/linux/x86/config-2.6.30 | 5 ----- target/linux/x86/config-2.6.31 | 5 ----- target/linux/x86/olpc/config-2.6.30 | 4 ---- target/linux/x86/olpc/config-2.6.31 | 4 ---- 67 files changed, 60 insertions(+), 271 deletions(-) diff --git a/target/linux/adm5120/router_be/config-2.6.28 b/target/linux/adm5120/router_be/config-2.6.28 index 153421d1f..4e49f2bc0 100644 --- a/target/linux/adm5120/router_be/config-2.6.28 +++ b/target/linux/adm5120/router_be/config-2.6.28 @@ -23,7 +23,6 @@ CONFIG_ARCH_REQUIRE_GPIOLIB=y CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARM_AMBA=y -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set CONFIG_BINFMT_MISC=m CONFIG_BITREVERSE=y @@ -144,7 +143,6 @@ CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PARTITION_ADVANCED is not set CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set @@ -188,7 +186,6 @@ CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y -CONFIG_TICK_ONESHOT=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TRAD_SIGNALS=y CONFIG_USB_ADM5120_HCD=m diff --git a/target/linux/adm5120/router_be/config-2.6.30 b/target/linux/adm5120/router_be/config-2.6.30 index 71e4688c7..bca32648f 100644 --- a/target/linux/adm5120/router_be/config-2.6.30 +++ b/target/linux/adm5120/router_be/config-2.6.30 @@ -23,7 +23,6 @@ CONFIG_ARCH_REQUIRE_GPIOLIB=y CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARM_AMBA=y -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set # CONFIG_BINARY_PRINTF is not set CONFIG_BINFMT_MISC=m @@ -149,7 +148,6 @@ CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PARTITION_ADVANCED is not set CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set @@ -194,7 +192,6 @@ CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y -CONFIG_TICK_ONESHOT=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TRACING_SUPPORT=y CONFIG_TRAD_SIGNALS=y diff --git a/target/linux/adm5120/router_be/config-2.6.31 b/target/linux/adm5120/router_be/config-2.6.31 index 0413c962e..b060785c2 100644 --- a/target/linux/adm5120/router_be/config-2.6.31 +++ b/target/linux/adm5120/router_be/config-2.6.31 @@ -26,7 +26,6 @@ CONFIG_ARCH_REQUIRE_GPIOLIB=y CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARM_AMBA=y -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set CONFIG_BINFMT_MISC=m CONFIG_BITREVERSE=y @@ -153,7 +152,6 @@ CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PARTITION_ADVANCED is not set CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set @@ -197,7 +195,6 @@ CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y -CONFIG_TICK_ONESHOT=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TRAD_SIGNALS=y CONFIG_USB_ADM5120_HCD=m diff --git a/target/linux/adm5120/router_le/config-2.6.28 b/target/linux/adm5120/router_le/config-2.6.28 index 214294222..4448c9649 100644 --- a/target/linux/adm5120/router_le/config-2.6.28 +++ b/target/linux/adm5120/router_le/config-2.6.28 @@ -42,10 +42,6 @@ CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARM_AMBA=y CONFIG_ATA=m -# CONFIG_ATA_NONSTANDARD is not set -# CONFIG_ATA_PIIX is not set -CONFIG_ATA_SFF=y -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set CONFIG_BITREVERSE=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y @@ -180,7 +176,6 @@ CONFIG_MTD_MYLOADER_PARTS=y CONFIG_MTD_NAND_PLATFORM=y CONFIG_MTD_NAND=y CONFIG_MTD_TRXSPLIT=y -# CONFIG_NATSEMI is not set CONFIG_NO_HZ=y # CONFIG_NO_IOPORT is not set # CONFIG_NXP_STB220 is not set @@ -190,7 +185,6 @@ CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PATA_RB153_CF=m CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set @@ -236,7 +230,6 @@ CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y # CONFIG_TC35815 is not set -CONFIG_TICK_ONESHOT=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TRAD_SIGNALS=y CONFIG_USB_ADM5120_HCD=m diff --git a/target/linux/adm5120/router_le/config-2.6.30 b/target/linux/adm5120/router_le/config-2.6.30 index 2b8ab3431..a67b3de6b 100644 --- a/target/linux/adm5120/router_le/config-2.6.30 +++ b/target/linux/adm5120/router_le/config-2.6.30 @@ -41,10 +41,6 @@ CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARM_AMBA=y CONFIG_ATA=m -# CONFIG_ATA_NONSTANDARD is not set -# CONFIG_ATA_PIIX is not set -CONFIG_ATA_SFF=y -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y @@ -188,7 +184,6 @@ CONFIG_MTD_MYLOADER_PARTS=y CONFIG_MTD_NAND_PLATFORM=y CONFIG_MTD_NAND=y CONFIG_MTD_TRXSPLIT=y -# CONFIG_NATSEMI is not set CONFIG_NO_HZ=y # CONFIG_NO_IOPORT is not set # CONFIG_NXP_STB220 is not set @@ -198,7 +193,6 @@ CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PATA_RB153_CF=m CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set @@ -244,7 +238,6 @@ CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y # CONFIG_TC35815 is not set -CONFIG_TICK_ONESHOT=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TRACING_SUPPORT=y CONFIG_TRAD_SIGNALS=y diff --git a/target/linux/adm5120/router_le/config-2.6.31 b/target/linux/adm5120/router_le/config-2.6.31 index 612fbf0dd..f2556131d 100644 --- a/target/linux/adm5120/router_le/config-2.6.31 +++ b/target/linux/adm5120/router_le/config-2.6.31 @@ -44,9 +44,6 @@ CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARM_AMBA=y CONFIG_ATA=m -# CONFIG_ATA_NONSTANDARD is not set -# CONFIG_ATA_PIIX is not set -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set CONFIG_BITREVERSE=y # CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set @@ -190,7 +187,6 @@ CONFIG_MTD_MYLOADER_PARTS=y CONFIG_MTD_NAND_PLATFORM=y CONFIG_MTD_NAND=y CONFIG_MTD_TRXSPLIT=y -# CONFIG_NATSEMI is not set CONFIG_NLS=m CONFIG_NO_HZ=y # CONFIG_NO_IOPORT is not set @@ -201,7 +197,6 @@ CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PATA_RB153_CF=m CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set @@ -246,7 +241,6 @@ CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y # CONFIG_TC35815 is not set -CONFIG_TICK_ONESHOT=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TRAD_SIGNALS=y CONFIG_USB_ADM5120_HCD=m diff --git a/target/linux/amazon/config-2.6.21 b/target/linux/amazon/config-2.6.21 index af8d1efca..1e5b7c6d0 100644 --- a/target/linux/amazon/config-2.6.21 +++ b/target/linux/amazon/config-2.6.21 @@ -10,7 +10,6 @@ CONFIG_AMAZON_WDT=y CONFIG_AMAZON=y # CONFIG_ARCH_HAS_ILOG2_U32 is not set # CONFIG_ARCH_HAS_ILOG2_U64 is not set -CONFIG_BASE_SMALL=0 CONFIG_BITREVERSE=y CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,jffs2 init=/bin/sh" CONFIG_CPU_BIG_ENDIAN=y diff --git a/target/linux/ar7/config-default b/target/linux/ar7/config-default index 9cd78ca2d..666fad85b 100644 --- a/target/linux/ar7/config-default +++ b/target/linux/ar7/config-default @@ -10,7 +10,6 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y @@ -109,6 +108,7 @@ CONFIG_NO_EXCEPT_FILL=y # CONFIG_NXP_STB220 is not set # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y +# CONFIG_PCI is not set # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set @@ -139,7 +139,6 @@ CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y -CONFIG_TICK_ONESHOT=y CONFIG_TRACING_SUPPORT=y CONFIG_TRAD_SIGNALS=y CONFIG_VLYNQ=y diff --git a/target/linux/ar71xx/config-2.6.28 b/target/linux/ar71xx/config-2.6.28 index 885a04b57..9f7b3043d 100644 --- a/target/linux/ar71xx/config-2.6.28 +++ b/target/linux/ar71xx/config-2.6.28 @@ -30,7 +30,6 @@ CONFIG_ARCH_REQUIRE_GPIOLIB=y CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ATHEROS_AR71XX=y -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set CONFIG_BITREVERSE=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y @@ -138,7 +137,6 @@ CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-2 CONFIG_MTD_REDBOOT_PARTS=y CONFIG_MTD_WRT160NL_PARTS=y CONFIG_MYLOADER=y -# CONFIG_NATSEMI is not set CONFIG_NET_DSA_MV88E6060=y # CONFIG_NET_DSA_MV88E6123_61_65 is not set # CONFIG_NET_DSA_MV88E6131 is not set @@ -154,7 +152,6 @@ CONFIG_NET_DSA=y CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set @@ -200,7 +197,6 @@ CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y # CONFIG_TC35815 is not set -CONFIG_TICK_ONESHOT=y CONFIG_TRAD_SIGNALS=y CONFIG_USB_SUPPORT=y # CONFIG_VGASTATE is not set diff --git a/target/linux/ar71xx/config-2.6.30 b/target/linux/ar71xx/config-2.6.30 index 4434633f4..ed4385cf2 100644 --- a/target/linux/ar71xx/config-2.6.30 +++ b/target/linux/ar71xx/config-2.6.30 @@ -29,7 +29,6 @@ CONFIG_ARCH_REQUIRE_GPIOLIB=y CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ATHEROS_AR71XX=y -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y @@ -143,7 +142,6 @@ CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-2 CONFIG_MTD_REDBOOT_PARTS=y CONFIG_MTD_WRT160NL_PARTS=y CONFIG_MYLOADER=y -# CONFIG_NATSEMI is not set CONFIG_NET_DSA_MV88E6060=y # CONFIG_NET_DSA_MV88E6123_61_65 is not set # CONFIG_NET_DSA_MV88E6131 is not set @@ -159,7 +157,6 @@ CONFIG_NET_DSA=y CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set @@ -205,7 +202,6 @@ CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y # CONFIG_TC35815 is not set -CONFIG_TICK_ONESHOT=y CONFIG_TRACING_SUPPORT=y CONFIG_TRAD_SIGNALS=y CONFIG_USB_SUPPORT=y diff --git a/target/linux/ar71xx/config-2.6.31 b/target/linux/ar71xx/config-2.6.31 index 1c7809e2c..c063d16fb 100644 --- a/target/linux/ar71xx/config-2.6.31 +++ b/target/linux/ar71xx/config-2.6.31 @@ -32,7 +32,6 @@ CONFIG_ARCH_REQUIRE_GPIOLIB=y CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ATHEROS_AR71XX=y -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set CONFIG_BITREVERSE=y # CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set @@ -146,7 +145,6 @@ CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-2 CONFIG_MTD_REDBOOT_PARTS=y CONFIG_MTD_WRT160NL_PARTS=y CONFIG_MYLOADER=y -# CONFIG_NATSEMI is not set CONFIG_NET_DSA_MV88E6060=y # CONFIG_NET_DSA_MV88E6123_61_65 is not set # CONFIG_NET_DSA_MV88E6131 is not set @@ -162,7 +160,6 @@ CONFIG_NET_DSA=y CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set @@ -207,7 +204,6 @@ CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y # CONFIG_TC35815 is not set -CONFIG_TICK_ONESHOT=y CONFIG_TRAD_SIGNALS=y CONFIG_USB_SUPPORT=y CONFIG_YAFFS_9BYTE_TAGS=y diff --git a/target/linux/at91/config-2.6.25 b/target/linux/at91/config-2.6.25 index 5d16c2f00..b31b5b112 100644 --- a/target/linux/at91/config-2.6.25 +++ b/target/linux/at91/config-2.6.25 @@ -35,7 +35,6 @@ CONFIG_AT91_TIMER_HZ=128 CONFIG_AT91_VLIO=y # CONFIG_ATMEL_PWM is not set # CONFIG_ATMEL_SSC is not set -CONFIG_BASE_SMALL=0 # CONFIG_BINFMT_AOUT is not set CONFIG_BITREVERSE=y CONFIG_BLK_DEV_RAM_COUNT=16 @@ -61,7 +60,6 @@ CONFIG_CPU_CP15=y CONFIG_CPU_TLB_V4WBI=y # CONFIG_DATAFLASH_ALWAYS_ADD_DEVICE is not set CONFIG_DAVICOM_PHY=y -# CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEBUG_USER is not set # CONFIG_DM9000 is not set CONFIG_DUMMY_CONSOLE=y @@ -132,8 +130,8 @@ CONFIG_MTD_CMDLINE_PARTS=y # CONFIG_NF_NAT_RTSP is not set # CONFIG_NF_NAT_TFTP is not set # CONFIG_NO_IOPORT is not set -# CONFIG_NVRAM is not set # CONFIG_OUTER_CACHE is not set +# CONFIG_PCI is not set # CONFIG_PCI_SYSCALL is not set CONFIG_PHYLIB=y # CONFIG_PPP_MULTILINK is not set @@ -157,7 +155,6 @@ CONFIG_SLABINFO=y # CONFIG_SPI_ATMEL is not set CONFIG_SPLIT_PTLOCK_CPUS=4096 CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_TICK_ONESHOT=y CONFIG_UID16=y # CONFIG_USB_ARCH_HAS_EHCI is not set # CONFIG_USB is not set diff --git a/target/linux/atheros/config-2.6.30 b/target/linux/atheros/config-2.6.30 index 8cbe05f75..d77f84a7e 100644 --- a/target/linux/atheros/config-2.6.30 +++ b/target/linux/atheros/config-2.6.30 @@ -14,7 +14,6 @@ CONFIG_ATHEROS_AR2315=y CONFIG_ATHEROS_AR231X=y CONFIG_ATHEROS_AR5312=y CONFIG_ATHEROS_WDT=y -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y @@ -120,7 +119,6 @@ CONFIG_MVSWITCH_PHY=y # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set @@ -151,7 +149,6 @@ CONFIG_SYS_HAS_CPU_MIPS32_R1=y CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y -CONFIG_TICK_ONESHOT=y CONFIG_TRACING_SUPPORT=y CONFIG_TRAD_SIGNALS=y CONFIG_USB_SUPPORT=y diff --git a/target/linux/atheros/config-2.6.31 b/target/linux/atheros/config-2.6.31 index 2961fded4..a7cdf2d61 100644 --- a/target/linux/atheros/config-2.6.31 +++ b/target/linux/atheros/config-2.6.31 @@ -17,7 +17,6 @@ CONFIG_ATHEROS_AR2315=y CONFIG_ATHEROS_AR231X=y CONFIG_ATHEROS_AR5312=y CONFIG_ATHEROS_WDT=y -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y @@ -126,7 +125,6 @@ CONFIG_MVSWITCH_PHY=y # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set @@ -157,7 +155,6 @@ CONFIG_SYS_HAS_CPU_MIPS32_R1=y CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y -CONFIG_TICK_ONESHOT=y CONFIG_TRACING_SUPPORT=y CONFIG_TRAD_SIGNALS=y CONFIG_USB_SUPPORT=y diff --git a/target/linux/au1000/au1500/config-default b/target/linux/au1000/au1500/config-default index 64aa6c03c..74fad69dd 100644 --- a/target/linux/au1000/au1500/config-default +++ b/target/linux/au1000/au1500/config-default @@ -8,7 +8,6 @@ CONFIG_ARCH_REQUIRE_GPIOLIB=y # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y @@ -137,13 +136,11 @@ CONFIG_MODULE_FORCE_UNLOAD=y # CONFIG_MTD_COMPLEX_MAPPINGS is not set CONFIG_MTD_CONCAT=y CONFIG_MTD_PHYSMAP=y -# CONFIG_NATSEMI is not set # CONFIG_NO_IOPORT is not set # CONFIG_NXP_STB220 is not set # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set @@ -182,7 +179,6 @@ CONFIG_SYS_SUPPORTS_APM_EMULATION=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y # CONFIG_TC35815 is not set -CONFIG_TICK_ONESHOT=y CONFIG_TRACING_SUPPORT=y CONFIG_TRAD_SIGNALS=y CONFIG_USB_SUPPORT=y diff --git a/target/linux/au1000/au1550/config-default b/target/linux/au1000/au1550/config-default index d18be4cba..04f71dcae 100644 --- a/target/linux/au1000/au1550/config-default +++ b/target/linux/au1000/au1550/config-default @@ -9,7 +9,6 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ATMEL=m -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set CONFIG_BITREVERSE=y CONFIG_CEVT_R4K=y @@ -159,7 +158,6 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2 CONFIG_MTD_PHYSMAP_LEN=0 CONFIG_MTD_PHYSMAP_START=0x8000000 CONFIG_MTD_PHYSMAP=y -# CONFIG_NATSEMI is not set CONFIG_NET_ACT_GACT=m CONFIG_NET_ACT_IPT=m CONFIG_NET_ACT_MIRRED=m @@ -211,7 +209,6 @@ CONFIG_PAGE_SIZE_4KB=y CONFIG_PCCARD=m CONFIG_PCCARD_NONSTATIC=m CONFIG_PCI_DOMAINS=y -CONFIG_PCI=y CONFIG_PCMCIA_AU1X00=m CONFIG_PCMCIA_IOCTL=y CONFIG_PCMCIA_LOAD_CIS=y @@ -272,7 +269,6 @@ CONFIG_TCP_CONG_SCALABLE=m CONFIG_TCP_CONG_VENO=m CONFIG_TCP_CONG_WESTWOOD=m CONFIG_TCP_CONG_YEAH=m -CONFIG_TICK_ONESHOT=y CONFIG_TRAD_SIGNALS=y CONFIG_USB_SUPPORT=y # CONFIG_VGASTATE is not set diff --git a/target/linux/avr32/config-default b/target/linux/avr32/config-default index 2fd0e1320..42215f9d6 100644 --- a/target/linux/avr32/config-default +++ b/target/linux/avr32/config-default @@ -17,7 +17,6 @@ CONFIG_ATMEL_TCB_CLKSRC_BLOCK=0 CONFIG_ATMEL_TCB_CLKSRC=y CONFIG_ATMEL_TCLIB=y CONFIG_AVR32=y -CONFIG_BASE_SMALL=0 CONFIG_BITREVERSE=y # CONFIG_BOARD_ATNGW100_EVKLCD10X is not set CONFIG_BOARD_ATNGW100=y @@ -29,7 +28,6 @@ CONFIG_BOARD_ATNGW100=y CONFIG_CLASSIC_RCU=y CONFIG_CPU_AT32AP7000=y CONFIG_CPU_AT32AP700X=y -# CONFIG_DEBUG_BUGVERBOSE is not set CONFIG_DMADEVICES=y CONFIG_DMA_ENGINE=y CONFIG_DW_DMAC=y @@ -79,6 +77,7 @@ CONFIG_NO_HZ=y CONFIG_NR_QUICK=2 # CONFIG_OWNERSHIP_TRACE is not set CONFIG_PAGEFLAGS_EXTENDED=y +# CONFIG_PCI is not set CONFIG_PERFORMANCE_COUNTERS=y CONFIG_PHYLIB=y CONFIG_PHYS_OFFSET=0x10000000 @@ -101,6 +100,5 @@ CONFIG_SPI_MASTER=y # CONFIG_SPI_SPIDEV is not set CONFIG_SPI=y CONFIG_SUBARCH_AVR32B=y -CONFIG_TICK_ONESHOT=y # CONFIG_VGASTATE is not set CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/brcm47xx/config-2.6.28 b/target/linux/brcm47xx/config-2.6.28 index 389ae5e18..0eeb219ae 100644 --- a/target/linux/brcm47xx/config-2.6.28 +++ b/target/linux/brcm47xx/config-2.6.28 @@ -12,7 +12,6 @@ CONFIG_B44_PCI_AUTOSELECT=y CONFIG_B44_PCICORE_AUTOSELECT=y CONFIG_B44_PCI=y CONFIG_B44=y -CONFIG_BASE_SMALL=0 CONFIG_BCM47XX_WDT=y CONFIG_BCM47XX=y CONFIG_BITREVERSE=y @@ -104,13 +103,11 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_SIM is not set CONFIG_MIPS=y CONFIG_MTD_BCM47XX=y -# CONFIG_NATSEMI is not set # CONFIG_NO_IOPORT is not set # CONFIG_NXP_STB220 is not set # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set @@ -158,7 +155,6 @@ CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y # CONFIG_TC35815 is not set -CONFIG_TICK_ONESHOT=y CONFIG_TRAD_SIGNALS=y CONFIG_USB_EHCI_HCD_SSB=y CONFIG_USB_OHCI_HCD_SSB=y diff --git a/target/linux/brcm47xx/config-2.6.30 b/target/linux/brcm47xx/config-2.6.30 index 8305f26e5..41454d750 100644 --- a/target/linux/brcm47xx/config-2.6.30 +++ b/target/linux/brcm47xx/config-2.6.30 @@ -11,7 +11,6 @@ CONFIG_B44_PCI_AUTOSELECT=y CONFIG_B44_PCICORE_AUTOSELECT=y CONFIG_B44_PCI=y CONFIG_B44=y -CONFIG_BASE_SMALL=0 CONFIG_BCM47XX_WDT=y CONFIG_BCM47XX=y # CONFIG_BINARY_PRINTF is not set @@ -114,13 +113,11 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_SIM is not set CONFIG_MIPS=y CONFIG_MTD_BCM47XX=y -# CONFIG_NATSEMI is not set # CONFIG_NO_IOPORT is not set # CONFIG_NXP_STB220 is not set # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set @@ -168,7 +165,6 @@ CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y # CONFIG_TC35815 is not set -CONFIG_TICK_ONESHOT=y CONFIG_TRACING_SUPPORT=y CONFIG_TRAD_SIGNALS=y CONFIG_USB_EHCI_HCD_SSB=y diff --git a/target/linux/brcm47xx/config-2.6.31 b/target/linux/brcm47xx/config-2.6.31 index e5bfa7e48..5bc66ca5b 100644 --- a/target/linux/brcm47xx/config-2.6.31 +++ b/target/linux/brcm47xx/config-2.6.31 @@ -14,7 +14,6 @@ CONFIG_B44_PCI_AUTOSELECT=y CONFIG_B44_PCICORE_AUTOSELECT=y CONFIG_B44_PCI=y CONFIG_B44=y -CONFIG_BASE_SMALL=0 CONFIG_BCM47XX_WDT=y CONFIG_BCM47XX=y # CONFIG_BINARY_PRINTF is not set @@ -116,13 +115,11 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_SIM is not set CONFIG_MIPS=y CONFIG_MTD_BCM47XX=y -# CONFIG_NATSEMI is not set # CONFIG_NO_IOPORT is not set # CONFIG_NXP_STB220 is not set # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set @@ -170,7 +167,6 @@ CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y # CONFIG_TC35815 is not set -CONFIG_TICK_ONESHOT=y CONFIG_TRACING_SUPPORT=y CONFIG_TRAD_SIGNALS=y CONFIG_USB_SUPPORT=y diff --git a/target/linux/brcm63xx/config-2.6.30 b/target/linux/brcm63xx/config-2.6.30 index f02683b85..b95367a19 100644 --- a/target/linux/brcm63xx/config-2.6.30 +++ b/target/linux/brcm63xx/config-2.6.30 @@ -9,7 +9,6 @@ CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_AUDIT_GENERIC=y CONFIG_AUDIT=y -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set CONFIG_BCM63XX_CPU_6338=y CONFIG_BCM63XX_CPU_6345=y @@ -150,7 +149,6 @@ CONFIG_MTD_CONCAT=y CONFIG_MTD_JEDECPROBE=y CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED=y CONFIG_MTD_REDBOOT_PARTS=y -# CONFIG_NATSEMI is not set # CONFIG_NET_DROP_MONITOR is not set # CONFIG_NO_IOPORT is not set CONFIG_NOP_TRACER=y @@ -158,7 +156,6 @@ CONFIG_NOP_TRACER=y # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set @@ -205,7 +202,6 @@ CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y # CONFIG_TC35815 is not set -CONFIG_TICK_ONESHOT=y CONFIG_TRACEPOINTS=y CONFIG_TRACING_SUPPORT=y CONFIG_TRACING=y diff --git a/target/linux/cobalt/config-default b/target/linux/cobalt/config-default index bab68e219..282e8585b 100644 --- a/target/linux/cobalt/config-default +++ b/target/linux/cobalt/config-default @@ -7,11 +7,7 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y # CONFIG_ARPD is not set -# CONFIG_ATA_NONSTANDARD is not set -# CONFIG_ATA_PIIX is not set -CONFIG_ATA_SFF=y CONFIG_ATA=y -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set # CONFIG_BINARY_PRINTF is not set CONFIG_BINFMT_ELF32=y @@ -176,7 +172,6 @@ CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y CONFIG_PCI_GT64XXX_PCI0=y CONFIG_PCI_LEGACY=y -CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y CONFIG_PHYS_ADDR_T_64BIT=y # CONFIG_PMC_MSP is not set diff --git a/target/linux/coldfire/config-default b/target/linux/coldfire/config-default index c26ec6738..6f50ddb0c 100644 --- a/target/linux/coldfire/config-default +++ b/target/linux/coldfire/config-default @@ -8,7 +8,6 @@ CONFIG_ADVANCED=y CONFIG_ARCH_SUPPORTS_AOUT=y # CONFIG_ARCH_SUPPORTS_MSI is not set # CONFIG_ATARI is not set -CONFIG_BASE_SMALL=0 # CONFIG_BINFMT_AOUT is not set CONFIG_BITREVERSE=y # CONFIG_BOOTPARAM is not set @@ -18,7 +17,6 @@ CONFIG_CLASSIC_RCU=y # CONFIG_COLDFIRE_EDMA is not set # CONFIG_COLDFIRE_WATCHDOG is not set CONFIG_COLDFIRE=y -# CONFIG_DEBUG_BUGVERBOSE is not set CONFIG_FEC_548x_AUTO_NEGOTIATION=y CONFIG_FEC_548x_ENABLE_FEC2=y CONFIG_FEC_548x=y @@ -69,7 +67,6 @@ CONFIG_MCF_USER_HALT=y CONFIG_MMU_CFV4E=y CONFIG_MTD_CFI_ADV_OPTIONS=y # CONFIG_MTD_CFI_GEOMETRY is not set -# CONFIG_NATSEMI is not set # CONFIG_NE2K_PCI is not set CONFIG_NEED_MULTIPLE_NODES=y # CONFIG_NETDEV_1000 is not set @@ -79,7 +76,6 @@ CONFIG_NEED_MULTIPLE_NODES=y CONFIG_NOR_FLASH_BASE=0xE0000000 CONFIG_PCI_LEGACY=y # CONFIG_PCIPCWATCHDOG is not set -CONFIG_PCI=y # CONFIG_PROC_HARDWARE is not set # CONFIG_Q40 is not set # CONFIG_R6040 is not set diff --git a/target/linux/etrax/config-2.6.30 b/target/linux/etrax/config-2.6.30 index e288d6217..cd161ee34 100644 --- a/target/linux/etrax/config-2.6.30 +++ b/target/linux/etrax/config-2.6.30 @@ -1,6 +1,5 @@ # CONFIG_ARCH_HAS_ILOG2_U32 is not set # CONFIG_ARCH_HAS_ILOG2_U64 is not set -CONFIG_BASE_SMALL=0 # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y # CONFIG_BLK_DEV_INITRD is not set @@ -157,6 +156,7 @@ CONFIG_MTDRAM_TOTAL_SIZE=0 CONFIG_NO_IOPORT=y # CONFIG_OOM_REBOOT is not set CONFIG_PAGEFLAGS_EXTENDED=y +# CONFIG_PCI is not set # CONFIG_RTC is not set # CONFIG_SCSI_DMA is not set # CONFIG_SERIAL_8250 is not set diff --git a/target/linux/gemini/config-default b/target/linux/gemini/config-default index c8c885640..dab67c5f1 100644 --- a/target/linux/gemini/config-default +++ b/target/linux/gemini/config-default @@ -12,8 +12,6 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARM=y # CONFIG_ARPD is not set CONFIG_ATA=m -# CONFIG_ATA_NONSTANDARD is not set -CONFIG_BASE_SMALL=0 # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y @@ -33,7 +31,6 @@ CONFIG_CPU_FA526=y CONFIG_CPU_PABRT_NOIFAR=y CONFIG_CPU_TLB_FA=y CONFIG_CRC16=y -# CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEBUG_USER is not set CONFIG_DECOMPRESS_LZMA=y CONFIG_DEVPORT=y @@ -99,7 +96,6 @@ CONFIG_MDIO_GPIO=y # CONFIG_MG_DISK is not set CONFIG_MTD_PHYSMAP=y CONFIG_MTD_REDBOOT_PARTS=y -# CONFIG_NATSEMI is not set CONFIG_NLATTR=y # CONFIG_NO_IOPORT is not set # CONFIG_OUTER_CACHE is not set @@ -107,7 +103,6 @@ CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xC0000000 # CONFIG_PCI_STUB is not set CONFIG_PCI_SYSCALL=y -CONFIG_PCI=y CONFIG_PHYLIB=y CONFIG_SCSI=m # CONFIG_SCSI_MULTI_LUN is not set diff --git a/target/linux/generic-2.6/config-2.6.21 b/target/linux/generic-2.6/config-2.6.21 index 2aec24c6b..1eada9dda 100644 --- a/target/linux/generic-2.6/config-2.6.21 +++ b/target/linux/generic-2.6/config-2.6.21 @@ -1,4 +1,3 @@ -# CONFIG_CPU_FREQ is not set # CONFIG_6PACK is not set # CONFIG_8139CP is not set # CONFIG_9P_FS is not set @@ -58,8 +57,10 @@ CONFIG_ARPD=y CONFIG_ASK_IP_FIB_HASH=y # CONFIG_ATA is not set # CONFIG_ATALK is not set +# CONFIG_ATA_NONSTANDARD is not set # CONFIG_ATA_OVER_ETH is not set # CONFIG_ATARI_PARTITION is not set +CONFIG_ATA_SFF=y # CONFIG_ATL1 is not set # CONFIG_ATM_AMBASSADOR is not set CONFIG_ATM_BR2684_IPFILTER=y @@ -91,6 +92,7 @@ CONFIG_ATM_CLIP_NO_ICMP=y # CONFIG_B44 is not set # CONFIG_BACKLIGHT_LCD_SUPPORT is not set CONFIG_BASE_FULL=y +CONFIG_BASE_SMALL=0 # CONFIG_BASLER_EXCITE is not set # CONFIG_BAYCOM_EPP is not set # CONFIG_BAYCOM_PAR is not set @@ -245,6 +247,7 @@ CONFIG_CMDLINE="" # CONFIG_CODA_FS is not set # CONFIG_CONFIGFS_FS is not set # CONFIG_CONNECTOR is not set +# CONFIG_CPU_FREQ is not set # CONFIG_CRAMFS is not set # CONFIG_CRC16 is not set CONFIG_CRC32=y @@ -289,6 +292,7 @@ CONFIG_CROSSCOMPILE=y # CONFIG_CRYPTO_XCBC is not set CONFIG_CRYPTO=y # CONFIG_DAVICOM_PHY is not set +# CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEBUG_FS is not set # CONFIG_DEBUG_KERNEL is not set # CONFIG_DECNET is not set @@ -800,6 +804,7 @@ CONFIG_MTD_ROOTFS_SPLIT=y # CONFIG_MTD_SLRAM is not set CONFIG_MTD=y # CONFIG_MYRI10GE is not set +# CONFIG_NATSEMI is not set # CONFIG_NCP_FS is not set # CONFIG_NET_ACT_GACT is not set # CONFIG_NET_ACT_IPT is not set @@ -995,6 +1000,7 @@ CONFIG_NLS_DEFAULT="iso8859-1" # CONFIG_NTFS_DEBUG is not set # CONFIG_NTFS_FS is not set # CONFIG_NTFS_RW is not set +# CONFIG_NVRAM is not set # CONFIG_OCFS2_FS is not set # CONFIG_OSF_PARTITION is not set CONFIG_PACKET_MMAP=y @@ -1475,6 +1481,7 @@ CONFIG_TCP_CONG_WESTWOOD=y # CONFIG_TEXTSEARCH_FSM is not set # CONFIG_TEXTSEARCH_KMP is not set CONFIG_TEXTSEARCH=y +CONFIG_TICK_ONESHOT=y # CONFIG_TIFM_CORE is not set # CONFIG_TIGON3 is not set # CONFIG_TINY_SHMEM is not set diff --git a/target/linux/generic-2.6/config-2.6.25 b/target/linux/generic-2.6/config-2.6.25 index df97842b5..d277dd055 100644 --- a/target/linux/generic-2.6/config-2.6.25 +++ b/target/linux/generic-2.6/config-2.6.25 @@ -1,4 +1,3 @@ -# CONFIG_CPU_FREQ is not set # CONFIG_6PACK is not set # CONFIG_8139CP is not set # CONFIG_9P_FS is not set @@ -64,8 +63,10 @@ CONFIG_ASK_IP_FIB_HASH=y # CONFIG_ATA_GENERIC is not set # CONFIG_ATA is not set # CONFIG_ATALK is not set +# CONFIG_ATA_NONSTANDARD is not set # CONFIG_ATA_OVER_ETH is not set # CONFIG_ATARI_PARTITION is not set +CONFIG_ATA_SFF=y # CONFIG_ATL1 is not set # CONFIG_ATM_AMBASSADOR is not set CONFIG_ATM_BR2684_IPFILTER=y @@ -98,6 +99,7 @@ CONFIG_ATM_CLIP_NO_ICMP=y # CONFIG_B44 is not set # CONFIG_BACKLIGHT_LCD_SUPPORT is not set CONFIG_BASE_FULL=y +CONFIG_BASE_SMALL=0 # CONFIG_BASLER_EXCITE is not set # CONFIG_BAYCOM_EPP is not set # CONFIG_BAYCOM_PAR is not set @@ -272,6 +274,7 @@ CONFIG_CMDLINE="" # CONFIG_COMPAT_BRK is not set # CONFIG_CONFIGFS_FS is not set # CONFIG_CONNECTOR is not set +# CONFIG_CPU_FREQ is not set # CONFIG_CRAMFS is not set # CONFIG_CRC16 is not set CONFIG_CRC32=y @@ -330,6 +333,7 @@ CONFIG_CROSSCOMPILE=y CONFIG_CRYPTO=y # CONFIG_DAB is not set # CONFIG_DAVICOM_PHY is not set +# CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEBUG_FS is not set # CONFIG_DEBUG_KERNEL is not set # CONFIG_DECNET is not set @@ -898,6 +902,7 @@ CONFIG_MTD=y # CONFIG_MWAVE is not set # CONFIG_MYRI10GE is not set # CONFIG_NAMESPACES is not set +# CONFIG_NATSEMI is not set # CONFIG_NCP_FS is not set # CONFIG_NET_9P is not set # CONFIG_NET_ACT_GACT is not set @@ -1126,6 +1131,7 @@ CONFIG_NLS_DEFAULT="iso8859-1" # CONFIG_NTFS_DEBUG is not set # CONFIG_NTFS_FS is not set # CONFIG_NTFS_RW is not set +# CONFIG_NVRAM is not set # CONFIG_OCF_BENCH is not set # CONFIG_OCF_EP80579 is not set # CONFIG_OCF_HIFNHIPP is not set @@ -1195,9 +1201,9 @@ CONFIG_PARTITION_ADVANCED=y # CONFIG_PCF8575 is not set # CONFIG_PCI_ATMEL is not set # CONFIG_PCI_HERMES is not set -# CONFIG_PCI is not set # CONFIG_PCI_LEGACY is not set # CONFIG_PCI_MSI is not set +CONFIG_PCI=y # CONFIG_PCMCIA_AHA152X is not set # CONFIG_PCMCIA_ATMEL is not set # CONFIG_PCMCIA_DEBUG is not set @@ -1696,6 +1702,7 @@ CONFIG_TCP_CONG_WESTWOOD=y # CONFIG_TEXTSEARCH_KMP is not set CONFIG_TEXTSEARCH=y # CONFIG_THERMAL is not set +CONFIG_TICK_ONESHOT=y # CONFIG_TIFM_CORE is not set # CONFIG_TIGON3 is not set CONFIG_TIMERFD=y diff --git a/target/linux/generic-2.6/config-2.6.28 b/target/linux/generic-2.6/config-2.6.28 index a0546106e..04eb633cc 100644 --- a/target/linux/generic-2.6/config-2.6.28 +++ b/target/linux/generic-2.6/config-2.6.28 @@ -1,4 +1,3 @@ -# CONFIG_CPU_FREQ is not set # CONFIG_6PACK is not set # CONFIG_8139CP is not set # CONFIG_9P_FS is not set @@ -70,9 +69,10 @@ CONFIG_ASK_IP_FIB_HASH=y # CONFIG_ATA_GENERIC is not set # CONFIG_ATA is not set # CONFIG_ATALK is not set +# CONFIG_ATA_NONSTANDARD is not set # CONFIG_ATA_OVER_ETH is not set # CONFIG_ATARI_PARTITION is not set -# CONFIG_ATA_SFF is not set +CONFIG_ATA_SFF=y # CONFIG_ATH5K is not set # CONFIG_ATH9K is not set # CONFIG_ATL1E is not set @@ -112,6 +112,7 @@ CONFIG_ATM_CLIP_NO_ICMP=y # CONFIG_B44 is not set # CONFIG_BACKLIGHT_LCD_SUPPORT is not set CONFIG_BASE_FULL=y +CONFIG_BASE_SMALL=0 # CONFIG_BASLER_EXCITE is not set # CONFIG_BAYCOM_EPP is not set # CONFIG_BAYCOM_PAR is not set @@ -296,6 +297,7 @@ CONFIG_CMDLINE="" # CONFIG_CONTEXT_SWITCH_TRACER is not set # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set # CONFIG_CPU_DCACHE_DISABLE is not set +# CONFIG_CPU_FREQ is not set # CONFIG_CPU_IDLE is not set # CONFIG_CRAMFS is not set # CONFIG_CRC16 is not set @@ -372,6 +374,7 @@ CONFIG_CROSSCOMPILE=y CONFIG_CRYPTO=y # CONFIG_DAB is not set # CONFIG_DAVICOM_PHY is not set +# CONFIG_DEBUG_BUGVERBOSE is not set CONFIG_DEBUG_FS=y # CONFIG_DEBUG_KERNEL is not set # CONFIG_DEBUG_MEMORY_INIT is not set @@ -1040,6 +1043,7 @@ CONFIG_MTD=y # CONFIG_MWAVE is not set # CONFIG_MYRI10GE is not set # CONFIG_NAMESPACES is not set +# CONFIG_NATSEMI is not set # CONFIG_NCP_FS is not set # CONFIG_NE2K_PCI is not set # CONFIG_NET_9P is not set @@ -1278,6 +1282,7 @@ CONFIG_NLS_DEFAULT="iso8859-1" # CONFIG_NTFS_DEBUG is not set # CONFIG_NTFS_FS is not set # CONFIG_NTFS_RW is not set +# CONFIG_NVRAM is not set # CONFIG_OCF_BENCH is not set # CONFIG_OCF_EP80579 is not set # CONFIG_OCF_HIFNHIPP is not set @@ -1353,11 +1358,11 @@ CONFIG_PARTITION_ADVANCED=y # CONFIG_PCI_ATMEL is not set # CONFIG_PCI_DISABLE_COMMON_QUIRKS is not set # CONFIG_PCI_HERMES is not set -# CONFIG_PCI is not set # CONFIG_PCI_LEGACY is not set # CONFIG_PCI_MSI is not set # CONFIG_PCIPCWATCHDOG is not set CONFIG_PCI_QUIRKS=y +CONFIG_PCI=y # CONFIG_PCMCIA_AHA152X is not set # CONFIG_PCMCIA_ATMEL is not set # CONFIG_PCMCIA_DEBUG is not set @@ -1916,6 +1921,7 @@ CONFIG_TEXTSEARCH=y # CONFIG_THERMAL_HWMON is not set # CONFIG_THERMAL is not set # CONFIG_THRUSTMASTER_FF is not set +CONFIG_TICK_ONESHOT=y # CONFIG_TIFM_CORE is not set # CONFIG_TIGON3 is not set CONFIG_TIMERFD=y diff --git a/target/linux/generic-2.6/config-2.6.30 b/target/linux/generic-2.6/config-2.6.30 index 014842efe..db4c12b62 100644 --- a/target/linux/generic-2.6/config-2.6.30 +++ b/target/linux/generic-2.6/config-2.6.30 @@ -1,4 +1,3 @@ -# CONFIG_CPU_FREQ is not set # CONFIG_6PACK is not set # CONFIG_8139CP is not set # CONFIG_8139TOO is not set @@ -78,6 +77,7 @@ CONFIG_ASK_IP_FIB_HASH=y # CONFIG_ATA_GENERIC is not set # CONFIG_ATA is not set # CONFIG_ATALK is not set +# CONFIG_ATA_NONSTANDARD is not set # CONFIG_ATA_OVER_ETH is not set # CONFIG_ATARI_PARTITION is not set CONFIG_ATA_SFF=y @@ -123,6 +123,7 @@ CONFIG_ATM_CLIP_NO_ICMP=y # CONFIG_B44 is not set # CONFIG_BACKLIGHT_LCD_SUPPORT is not set CONFIG_BASE_FULL=y +CONFIG_BASE_SMALL=0 # CONFIG_BASLER_EXCITE is not set # CONFIG_BATTERY_BQ27000_HDQ is not set # CONFIG_BATTERY_BQ27x00 is not set @@ -319,6 +320,7 @@ CONFIG_COMPAT_NET_DEV_OPS=y # CONFIG_CONTEXT_SWITCH_TRACER is not set # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set # CONFIG_CPU_DCACHE_DISABLE is not set +# CONFIG_CPU_FREQ is not set # CONFIG_CPU_IDLE is not set # CONFIG_CRAMFS is not set # CONFIG_CRASH_DUMP is not set @@ -401,6 +403,7 @@ CONFIG_CRYPTO_ZLIB=y # CONFIG_DAB is not set # CONFIG_DAVICOM_PHY is not set # CONFIG_DCB is not set +# CONFIG_DEBUG_BUGVERBOSE is not set CONFIG_DEBUG_FS=y # CONFIG_DEBUG_KERNEL is not set # CONFIG_DEBUG_MEMORY_INIT is not set @@ -1206,6 +1209,7 @@ CONFIG_MTD=y # CONFIG_MYRI10GE is not set # CONFIG_NAMESPACES is not set # CONFIG_NATIONAL_PHY is not set +# CONFIG_NATSEMI is not set # CONFIG_NCP_FS is not set # CONFIG_NE2K_PCI is not set # CONFIG_NEC_MARKEINS is not set @@ -1453,6 +1457,7 @@ CONFIG_NLS_DEFAULT="iso8859-1" # CONFIG_NTFS_DEBUG is not set # CONFIG_NTFS_FS is not set # CONFIG_NTFS_RW is not set +# CONFIG_NVRAM is not set # CONFIG_OCF_BENCH is not set # CONFIG_OCF_EP80579 is not set # CONFIG_OCF_HIFNHIPP is not set @@ -1532,12 +1537,12 @@ CONFIG_PARTITION_ADVANCED=y # CONFIG_PCIEASPM is not set # CONFIG_PCI_HERMES is not set # CONFIG_PCI_IOV is not set -# CONFIG_PCI is not set # CONFIG_PCI_LEGACY is not set # CONFIG_PCI_MSI is not set # CONFIG_PCIPCWATCHDOG is not set CONFIG_PCI_QUIRKS=y # CONFIG_PCI_STUB is not set +CONFIG_PCI=y # CONFIG_PCMCIA_AHA152X is not set # CONFIG_PCMCIA_ATMEL is not set # CONFIG_PCMCIA_DEBUG is not set @@ -2135,6 +2140,7 @@ CONFIG_TEXTSEARCH=y # CONFIG_THERMAL_HWMON is not set # CONFIG_THERMAL is not set # CONFIG_THRUSTMASTER_FF is not set +CONFIG_TICK_ONESHOT=y # CONFIG_TIFM_CORE is not set # CONFIG_TIGON3 is not set CONFIG_TIMERFD=y diff --git a/target/linux/generic-2.6/config-2.6.31 b/target/linux/generic-2.6/config-2.6.31 index 951619909..545cecb16 100644 --- a/target/linux/generic-2.6/config-2.6.31 +++ b/target/linux/generic-2.6/config-2.6.31 @@ -1,4 +1,3 @@ -# CONFIG_CPU_FREQ is not set # CONFIG_6PACK is not set # CONFIG_8139CP is not set # CONFIG_8139TOO is not set @@ -83,6 +82,7 @@ CONFIG_ASK_IP_FIB_HASH=y # CONFIG_ATA_GENERIC is not set # CONFIG_ATA is not set # CONFIG_ATALK is not set +# CONFIG_ATA_NONSTANDARD is not set # CONFIG_ATA_OVER_ETH is not set # CONFIG_ATARI_PARTITION is not set CONFIG_ATA_SFF=y @@ -129,6 +129,7 @@ CONFIG_ATM_CLIP_NO_ICMP=y # CONFIG_B44 is not set # CONFIG_BACKLIGHT_LCD_SUPPORT is not set CONFIG_BASE_FULL=y +CONFIG_BASE_SMALL=0 # CONFIG_BASLER_EXCITE is not set # CONFIG_BATTERY_BQ27000_HDQ is not set # CONFIG_BATTERY_BQ27x00 is not set @@ -336,6 +337,7 @@ CONFIG_CONSTRUCTORS=y # CONFIG_CONTEXT_SWITCH_TRACER is not set # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set # CONFIG_CPU_DCACHE_DISABLE is not set +# CONFIG_CPU_FREQ is not set # CONFIG_CPU_IDLE is not set # CONFIG_CRAMFS is not set # CONFIG_CRASH_DUMP is not set @@ -419,6 +421,7 @@ CONFIG_CRYPTO_ZLIB=y # CONFIG_DAB is not set # CONFIG_DAVICOM_PHY is not set # CONFIG_DCB is not set +# CONFIG_DEBUG_BUGVERBOSE is not set CONFIG_DEBUG_FS=y # CONFIG_DEBUG_KERNEL is not set # CONFIG_DEBUG_MEMORY_INIT is not set @@ -1234,6 +1237,7 @@ CONFIG_MTD=y # CONFIG_MYRI10GE is not set # CONFIG_NAMESPACES is not set # CONFIG_NATIONAL_PHY is not set +# CONFIG_NATSEMI is not set # CONFIG_NCP_FS is not set # CONFIG_NE2K_PCI is not set # CONFIG_NEC_MARKEINS is not set @@ -1483,6 +1487,7 @@ CONFIG_NLS_DEFAULT="iso8859-1" # CONFIG_NTFS_DEBUG is not set # CONFIG_NTFS_FS is not set # CONFIG_NTFS_RW is not set +# CONFIG_NVRAM is not set # CONFIG_OCF_BENCH is not set # CONFIG_OCF_EP80579 is not set # CONFIG_OCF_HIFNHIPP is not set @@ -1562,12 +1567,12 @@ CONFIG_PARTITION_ADVANCED=y # CONFIG_PCIEASPM is not set # CONFIG_PCI_HERMES is not set # CONFIG_PCI_IOV is not set -# CONFIG_PCI is not set # CONFIG_PCI_LEGACY is not set # CONFIG_PCI_MSI is not set # CONFIG_PCIPCWATCHDOG is not set CONFIG_PCI_QUIRKS=y # CONFIG_PCI_STUB is not set +CONFIG_PCI=y # CONFIG_PCMCIA_AHA152X is not set # CONFIG_PCMCIA_ATMEL is not set # CONFIG_PCMCIA_DEBUG is not set @@ -2182,6 +2187,7 @@ CONFIG_TEXTSEARCH=y # CONFIG_THERMAL_HWMON is not set # CONFIG_THERMAL is not set # CONFIG_THRUSTMASTER_FF is not set +CONFIG_TICK_ONESHOT=y # CONFIG_TIFM_CORE is not set # CONFIG_TIGON3 is not set CONFIG_TIMERFD=y diff --git a/target/linux/generic-2.6/config-2.6.32 b/target/linux/generic-2.6/config-2.6.32 index a5b2b868f..c6a343424 100644 --- a/target/linux/generic-2.6/config-2.6.32 +++ b/target/linux/generic-2.6/config-2.6.32 @@ -1,4 +1,3 @@ -# CONFIG_CPU_FREQ is not set # CONFIG_6PACK is not set # CONFIG_8139CP is not set # CONFIG_8139TOO is not set @@ -85,6 +84,7 @@ CONFIG_ASK_IP_FIB_HASH=y # CONFIG_ATA_GENERIC is not set # CONFIG_ATA is not set # CONFIG_ATALK is not set +# CONFIG_ATA_NONSTANDARD is not set # CONFIG_ATA_OVER_ETH is not set # CONFIG_ATARI_PARTITION is not set CONFIG_ATA_SFF=y @@ -131,6 +131,7 @@ CONFIG_ATM_CLIP_NO_ICMP=y # CONFIG_B44 is not set # CONFIG_BACKLIGHT_LCD_SUPPORT is not set CONFIG_BASE_FULL=y +CONFIG_BASE_SMALL=0 # CONFIG_BASLER_EXCITE is not set # CONFIG_BATTERY_BQ27000_HDQ is not set # CONFIG_BATTERY_BQ27x00 is not set @@ -338,6 +339,7 @@ CONFIG_CONSTRUCTORS=y # CONFIG_CONTEXT_SWITCH_TRACER is not set # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set # CONFIG_CPU_DCACHE_DISABLE is not set +# CONFIG_CPU_FREQ is not set # CONFIG_CPU_IDLE is not set # CONFIG_CRAMFS is not set # CONFIG_CRASH_DUMP is not set @@ -423,6 +425,7 @@ CONFIG_CRYPTO_ZLIB=y # CONFIG_DAB is not set # CONFIG_DAVICOM_PHY is not set # CONFIG_DCB is not set +# CONFIG_DEBUG_BUGVERBOSE is not set CONFIG_DEBUG_FS=y # CONFIG_DEBUG_KERNEL is not set # CONFIG_DEBUG_MEMORY_INIT is not set @@ -1245,6 +1248,7 @@ CONFIG_MTD=y # CONFIG_MYRI10GE is not set # CONFIG_NAMESPACES is not set # CONFIG_NATIONAL_PHY is not set +# CONFIG_NATSEMI is not set # CONFIG_NCP_FS is not set # CONFIG_NE2K_PCI is not set # CONFIG_NEC_MARKEINS is not set @@ -1494,6 +1498,7 @@ CONFIG_NLS_DEFAULT="iso8859-1" # CONFIG_NTFS_DEBUG is not set # CONFIG_NTFS_FS is not set # CONFIG_NTFS_RW is not set +# CONFIG_NVRAM is not set # CONFIG_OCF_BENCH is not set # CONFIG_OCF_EP80579 is not set # CONFIG_OCF_HIFNHIPP is not set @@ -1573,12 +1578,12 @@ CONFIG_PARTITION_ADVANCED=y # CONFIG_PCIEASPM is not set # CONFIG_PCI_HERMES is not set # CONFIG_PCI_IOV is not set -# CONFIG_PCI is not set # CONFIG_PCI_LEGACY is not set # CONFIG_PCI_MSI is not set # CONFIG_PCIPCWATCHDOG is not set CONFIG_PCI_QUIRKS=y # CONFIG_PCI_STUB is not set +CONFIG_PCI=y # CONFIG_PCMCIA_AHA152X is not set # CONFIG_PCMCIA_ATMEL is not set # CONFIG_PCMCIA_DEBUG is not set @@ -2197,6 +2202,7 @@ CONFIG_TEXTSEARCH=y # CONFIG_THERMAL_HWMON is not set # CONFIG_THERMAL is not set # CONFIG_THRUSTMASTER_FF is not set +CONFIG_TICK_ONESHOT=y # CONFIG_TIFM_CORE is not set # CONFIG_TIGON3 is not set CONFIG_TIMERFD=y diff --git a/target/linux/goldfish/config-2.6.30 b/target/linux/goldfish/config-2.6.30 index 7e82d8af2..b6b4fd58e 100644 --- a/target/linux/goldfish/config-2.6.30 +++ b/target/linux/goldfish/config-2.6.30 @@ -12,7 +12,6 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARM_THUMB=y CONFIG_ARM=y # CONFIG_BACKTRACE_SELF_TEST is not set -CONFIG_BASE_SMALL=0 CONFIG_BATTERY_GOLDFISH=y # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y @@ -162,6 +161,7 @@ CONFIG_MTD_UBI=y CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xC0000000 # CONFIG_PAGE_POISONING is not set +# CONFIG_PCI is not set # CONFIG_PCI_SYSCALL is not set # CONFIG_PDA_POWER is not set # CONFIG_PM_DEBUG is not set @@ -187,7 +187,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4096 CONFIG_SUSPEND_FREEZER=y CONFIG_SUSPEND=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_TICK_ONESHOT=y # CONFIG_TIMER_STATS is not set CONFIG_TRACING_SUPPORT=y # CONFIG_UBIFS_FS is not set diff --git a/target/linux/ifxmips/config-2.6.30 b/target/linux/ifxmips/config-2.6.30 index 49befd554..8659e504d 100644 --- a/target/linux/ifxmips/config-2.6.30 +++ b/target/linux/ifxmips/config-2.6.30 @@ -8,7 +8,6 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y @@ -117,13 +116,11 @@ CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_IFXMIPS=y # CONFIG_MTD_MAP_BANK_WIDTH_1 is not set # CONFIG_MTD_MAP_BANK_WIDTH_4 is not set -# CONFIG_NATSEMI is not set # CONFIG_NO_IOPORT is not set # CONFIG_NXP_STB220 is not set # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set diff --git a/target/linux/iop32x/config-default b/target/linux/iop32x/config-default index e737123d6..fc558428f 100644 --- a/target/linux/iop32x/config-default +++ b/target/linux/iop32x/config-default @@ -16,10 +16,8 @@ CONFIG_ARM=y # CONFIG_ARTHUR is not set CONFIG_ASYNC_CORE=y CONFIG_ATA=m -# CONFIG_ATA_NONSTANDARD is not set # CONFIG_ATMEL is not set # CONFIG_ATM is not set -CONFIG_BASE_SMALL=0 # CONFIG_BINFMT_AOUT is not set CONFIG_BITREVERSE=y # CONFIG_BLK_DEV_CRYPTOLOOP is not set @@ -42,7 +40,6 @@ CONFIG_CPU_TLB_V4WBI=y CONFIG_CPU_XSCALE=y CONFIG_CRC16=y # CONFIG_CRC_CCITT is not set -# CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEBUG_USER is not set CONFIG_DEVPORT=y CONFIG_DLCI=m @@ -144,7 +141,6 @@ CONFIG_MEDIA_TUNER_XC5000=m # CONFIG_MINIX_FS is not set # CONFIG_MTD_CFI_AMDSTD is not set CONFIG_MTD_REDBOOT_PARTS=y -# CONFIG_NATSEMI is not set # CONFIG_NE2K_PCI is not set CONFIG_NET_DMA=y # CONFIG_NET_EMATCH is not set @@ -158,7 +154,6 @@ CONFIG_NET_DMA=y # CONFIG_NLS_KOI8_R is not set # CONFIG_NO_IDLE_HZ is not set # CONFIG_NO_IOPORT is not set -# CONFIG_NVRAM is not set # CONFIG_OABI_COMPAT is not set # CONFIG_OCF_OCF is not set # CONFIG_OUTER_CACHE is not set @@ -167,7 +162,6 @@ CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PCI200SYN is not set # CONFIG_PCIPCWATCHDOG is not set CONFIG_PCI_SYSCALL=y -CONFIG_PCI=y CONFIG_PLAT_IOP=y # CONFIG_PPP is not set # CONFIG_PRISM54 is not set @@ -185,7 +179,6 @@ CONFIG_SLABINFO=y # CONFIG_SMC91X is not set CONFIG_SPLIT_PTLOCK_CPUS=4096 CONFIG_SYS_SUPPORTS_APM_EMULATION=y -# CONFIG_TICK_ONESHOT is not set CONFIG_UID16=y # CONFIG_USB_ACM is not set # CONFIG_USB_CATC is not set diff --git a/target/linux/ixp4xx/config-2.6.28 b/target/linux/ixp4xx/config-2.6.28 index eed45f2dd..b0a2c5939 100644 --- a/target/linux/ixp4xx/config-2.6.28 +++ b/target/linux/ixp4xx/config-2.6.28 @@ -21,12 +21,8 @@ CONFIG_ARM=y # CONFIG_ARTHUR is not set CONFIG_AT24=y # CONFIG_ATA is not set -# CONFIG_ATA_NONSTANDARD is not set -# CONFIG_ATA_PIIX is not set -CONFIG_ATA_SFF=y # CONFIG_ATMEL is not set # CONFIG_ATM is not set -CONFIG_BASE_SMALL=0 # CONFIG_BINFMT_AOUT is not set CONFIG_BITREVERSE=y # CONFIG_BONDING is not set @@ -48,7 +44,6 @@ CONFIG_CPU_PABRT_NOIFAR=y CONFIG_CPU_TLB_V4WBI=y CONFIG_CPU_XSCALE=y CONFIG_CRC16=y -# CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEBUG_USER is not set CONFIG_DEVPORT=y # CONFIG_DM9000 is not set @@ -162,21 +157,17 @@ CONFIG_MTD_CFI_ADV_OPTIONS=y CONFIG_MTD_IXP4XX=y CONFIG_MTD_OTP=y CONFIG_MTD_REDBOOT_PARTS=y -# CONFIG_NATSEMI is not set # CONFIG_NLS_CODEPAGE_437 is not set # CONFIG_NLS_CODEPAGE_850 is not set # CONFIG_NLS_ISO8859_15 is not set # CONFIG_NLS_ISO8859_1 is not set # CONFIG_NLS_KOI8_R is not set # CONFIG_NO_IOPORT is not set -# CONFIG_NVRAM is not set # CONFIG_OUTER_CACHE is not set CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PATA_ARTOP is not set # CONFIG_PATA_IXP4XX_CF is not set -# CONFIG_PATA_SCH is not set CONFIG_PCI_SYSCALL=y -CONFIG_PCI=y # CONFIG_R6040 is not set CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_DS1672=y @@ -198,7 +189,6 @@ CONFIG_SLABINFO=y CONFIG_SND_USB=y CONFIG_SPLIT_PTLOCK_CPUS=4096 CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_TICK_ONESHOT=y CONFIG_UID16=y CONFIG_USB_EHCI_BIG_ENDIAN_DESC=y CONFIG_USB_EHCI_BIG_ENDIAN_MMIO=y diff --git a/target/linux/ixp4xx/config-2.6.30 b/target/linux/ixp4xx/config-2.6.30 index 98fb4e1f8..66feafe85 100644 --- a/target/linux/ixp4xx/config-2.6.30 +++ b/target/linux/ixp4xx/config-2.6.30 @@ -18,7 +18,6 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y # CONFIG_ARM_THUMB is not set CONFIG_ARM=y # CONFIG_ARPD is not set -CONFIG_BASE_SMALL=0 CONFIG_BITREVERSE=y CONFIG_BOUNCE=y CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200" @@ -36,7 +35,6 @@ CONFIG_CPU_TLB_V4WBI=y CONFIG_CPU_XSCALE=y CONFIG_CRC16=y # CONFIG_DCB is not set -# CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEBUG_USER is not set CONFIG_DEVPORT=y # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set @@ -131,16 +129,13 @@ CONFIG_MTD_CFI_ADV_OPTIONS=y CONFIG_MTD_IXP4XX=y CONFIG_MTD_OTP=y CONFIG_MTD_REDBOOT_PARTS=y -# CONFIG_NATSEMI is not set # CONFIG_NET_SCH_DRR is not set # CONFIG_NO_IOPORT is not set -# CONFIG_NVRAM is not set # CONFIG_OUTER_CACHE is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xC0000000 # CONFIG_PCI_STUB is not set CONFIG_PCI_SYSCALL=y -CONFIG_PCI=y CONFIG_PHYLIB=y CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_DS1672=y @@ -156,7 +151,6 @@ CONFIG_SERIAL_8250_NR_UARTS=4 CONFIG_SERIAL_8250_RUNTIME_UARTS=4 CONFIG_SPLIT_PTLOCK_CPUS=4096 CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_TICK_ONESHOT=y CONFIG_UID16=y CONFIG_USB_SUPPORT=y CONFIG_VECTORS_BASE=0xffff0000 diff --git a/target/linux/ixp4xx/config-2.6.31 b/target/linux/ixp4xx/config-2.6.31 index 8a600a9a5..8de080520 100644 --- a/target/linux/ixp4xx/config-2.6.31 +++ b/target/linux/ixp4xx/config-2.6.31 @@ -15,7 +15,6 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y # CONFIG_ARM_THUMB is not set CONFIG_ARM=y # CONFIG_ARPD is not set -CONFIG_BASE_SMALL=0 CONFIG_BITREVERSE=y CONFIG_BOUNCE=y CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200" @@ -34,7 +33,6 @@ CONFIG_CPU_PABRT_NOIFAR=y CONFIG_CPU_TLB_V4WBI=y CONFIG_CPU_XSCALE=y CONFIG_CRC16=y -# CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEBUG_USER is not set CONFIG_DECOMPRESS_LZMA=y CONFIG_DEVPORT=y @@ -125,12 +123,9 @@ CONFIG_MTD_CFI_ADV_OPTIONS=y CONFIG_MTD_IXP4XX=y CONFIG_MTD_OTP=y CONFIG_MTD_REDBOOT_PARTS=y -# CONFIG_NATSEMI is not set -# CONFIG_NVRAM is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xC0000000 CONFIG_PCI_SYSCALL=y -CONFIG_PCI=y CONFIG_PHYLIB=y CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_DS1672=y @@ -146,7 +141,6 @@ CONFIG_SERIAL_8250_NR_UARTS=4 CONFIG_SERIAL_8250_RUNTIME_UARTS=4 CONFIG_SPLIT_PTLOCK_CPUS=4096 CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_TICK_ONESHOT=y CONFIG_UID16=y CONFIG_USB_SUPPORT=y CONFIG_VECTORS_BASE=0xffff0000 diff --git a/target/linux/ixp4xx/config-2.6.32 b/target/linux/ixp4xx/config-2.6.32 index 8a600a9a5..8de080520 100644 --- a/target/linux/ixp4xx/config-2.6.32 +++ b/target/linux/ixp4xx/config-2.6.32 @@ -15,7 +15,6 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y # CONFIG_ARM_THUMB is not set CONFIG_ARM=y # CONFIG_ARPD is not set -CONFIG_BASE_SMALL=0 CONFIG_BITREVERSE=y CONFIG_BOUNCE=y CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200" @@ -34,7 +33,6 @@ CONFIG_CPU_PABRT_NOIFAR=y CONFIG_CPU_TLB_V4WBI=y CONFIG_CPU_XSCALE=y CONFIG_CRC16=y -# CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEBUG_USER is not set CONFIG_DECOMPRESS_LZMA=y CONFIG_DEVPORT=y @@ -125,12 +123,9 @@ CONFIG_MTD_CFI_ADV_OPTIONS=y CONFIG_MTD_IXP4XX=y CONFIG_MTD_OTP=y CONFIG_MTD_REDBOOT_PARTS=y -# CONFIG_NATSEMI is not set -# CONFIG_NVRAM is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xC0000000 CONFIG_PCI_SYSCALL=y -CONFIG_PCI=y CONFIG_PHYLIB=y CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_DS1672=y @@ -146,7 +141,6 @@ CONFIG_SERIAL_8250_NR_UARTS=4 CONFIG_SERIAL_8250_RUNTIME_UARTS=4 CONFIG_SPLIT_PTLOCK_CPUS=4096 CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_TICK_ONESHOT=y CONFIG_UID16=y CONFIG_USB_SUPPORT=y CONFIG_VECTORS_BASE=0xffff0000 diff --git a/target/linux/ixp4xx/config-default b/target/linux/ixp4xx/config-default index a548e666c..a4da85206 100644 --- a/target/linux/ixp4xx/config-default +++ b/target/linux/ixp4xx/config-default @@ -19,12 +19,8 @@ CONFIG_ARM=y # CONFIG_ARPD is not set # CONFIG_ARTHUR is not set CONFIG_ATA=m -# CONFIG_ATA_NONSTANDARD is not set -# CONFIG_ATA_PIIX is not set -CONFIG_ATA_SFF=y # CONFIG_ATMEL is not set # CONFIG_ATM is not set -CONFIG_BASE_SMALL=0 # CONFIG_BINFMT_AOUT is not set CONFIG_BITREVERSE=y # CONFIG_BLK_DEV_CRYPTOLOOP is not set @@ -49,7 +45,6 @@ CONFIG_CPU_PABRT_NOIFAR=y CONFIG_CPU_TLB_V4WBI=y CONFIG_CPU_XSCALE=y CONFIG_CRC16=y -# CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEBUG_USER is not set CONFIG_DEVPORT=y CONFIG_DLCI=m @@ -183,7 +178,6 @@ CONFIG_MTD_CFI_ADV_OPTIONS=y CONFIG_MTD_IXP4XX=y CONFIG_MTD_OTP=y CONFIG_MTD_REDBOOT_PARTS=y -# CONFIG_NATSEMI is not set # CONFIG_NE2K_PCI is not set # CONFIG_NET_EMATCH is not set # CONFIG_NET_IPIP is not set @@ -195,17 +189,14 @@ CONFIG_MTD_REDBOOT_PARTS=y # CONFIG_NLS_ISO8859_1 is not set # CONFIG_NLS_KOI8_R is not set # CONFIG_NO_IOPORT is not set -# CONFIG_NVRAM is not set # CONFIG_OUTER_CACHE is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PATA_ARTOP=m CONFIG_PATA_IXP4XX_CF=m -# CONFIG_PATA_SCH is not set # CONFIG_PC300 is not set # CONFIG_PCI200SYN is not set # CONFIG_PCIPCWATCHDOG is not set CONFIG_PCI_SYSCALL=y -CONFIG_PCI=y # CONFIG_PRISM54 is not set # CONFIG_R6040 is not set CONFIG_RTC_CLASS=y @@ -225,7 +216,6 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=4 # CONFIG_SMC91X is not set CONFIG_SPLIT_PTLOCK_CPUS=4096 CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_TICK_ONESHOT=y CONFIG_UID16=y CONFIG_USB_EHCI_BIG_ENDIAN_DESC=y CONFIG_USB_EHCI_BIG_ENDIAN_MMIO=y diff --git a/target/linux/kirkwood/config-default b/target/linux/kirkwood/config-default index ee0dfe2f2..02f439457 100644 --- a/target/linux/kirkwood/config-default +++ b/target/linux/kirkwood/config-default @@ -12,10 +12,6 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARM=y # CONFIG_ARPD is not set CONFIG_ATA=m -# CONFIG_ATA_NONSTANDARD is not set -# CONFIG_ATA_PIIX is not set -CONFIG_ATA_SFF=y -CONFIG_BASE_SMALL=0 CONFIG_BITREVERSE=y # CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH is not set CONFIG_CACHE_FEROCEON_L2=y @@ -37,7 +33,6 @@ CONFIG_CPU_PABRT_NOIFAR=y CONFIG_CPU_TLB_FEROCEON=y CONFIG_CRC16=y # CONFIG_DCB is not set -# CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEBUG_USER is not set CONFIG_DEVPORT=y # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set @@ -118,7 +113,6 @@ CONFIG_MTD_PHYSMAP=y # CONFIG_MTD_ROOTFS_ROOT_DEV is not set # CONFIG_MTD_ROOTFS_SPLIT is not set CONFIG_MV643XX_ETH=y -# CONFIG_NATSEMI is not set # CONFIG_NET_DSA_MV88E6060 is not set # CONFIG_NET_DSA_MV88E6123_61_65 is not set CONFIG_NET_DSA_MV88E6131=y @@ -130,15 +124,12 @@ CONFIG_NET_DSA_TAG_DSA=y CONFIG_NET_DSA=y # CONFIG_NET_SCH_DRR is not set # CONFIG_NO_IOPORT is not set -# CONFIG_NVRAM is not set CONFIG_OUTER_CACHE=y CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xC0000000 CONFIG_PATA_ARTOP=m -# CONFIG_PATA_SCH is not set # CONFIG_PCI_STUB is not set CONFIG_PCI_SYSCALL=y -CONFIG_PCI=y CONFIG_PHYLIB=y CONFIG_PLAT_ORION=y CONFIG_RTC_CLASS=y @@ -151,7 +142,6 @@ CONFIG_SCSI=m CONFIG_SPLIT_PTLOCK_CPUS=4096 CONFIG_SWAP=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_TICK_ONESHOT=y CONFIG_UID16=y CONFIG_USB_EHCI_HCD=m # CONFIG_USB_GPIO_VBUS is not set diff --git a/target/linux/mpc52xx/config-2.6.30 b/target/linux/mpc52xx/config-2.6.30 index fef5904da..9d6a5ddac 100644 --- a/target/linux/mpc52xx/config-2.6.30 +++ b/target/linux/mpc52xx/config-2.6.30 @@ -20,7 +20,6 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y # CONFIG_ARPD is not set CONFIG_AUDIT_ARCH=y -CONFIG_BASE_SMALL=0 # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y # CONFIG_BOOTX_TEXT is not set @@ -45,7 +44,6 @@ CONFIG_CRYPTO_MD5=y CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_WORKQUEUE=y # CONFIG_CRYPTO_ZLIB is not set -# CONFIG_DEBUG_BUGVERBOSE is not set CONFIG_DEFAULT_AS=y # CONFIG_DEFAULT_DEADLINE is not set CONFIG_DEFAULT_IOSCHED="anticipatory" @@ -152,7 +150,6 @@ CONFIG_MIGRATION=y # CONFIG_NET_PCI is not set # CONFIG_NET_SCHED is not set # CONFIG_NEW_LEDS is not set -# CONFIG_NVRAM is not set CONFIG_OF_DEVICE=y CONFIG_OF_GPIO=y CONFIG_OF=y @@ -164,7 +161,6 @@ CONFIG_PCI_DOMAINS=y # CONFIG_PCIEPORTBUS is not set CONFIG_PCI_LEGACY=y CONFIG_PCI_SYSCALL=y -CONFIG_PCI=y CONFIG_PHYLIB=y CONFIG_PHYSICAL_START=0x00000000 # CONFIG_PM_DEBUG is not set @@ -249,7 +245,6 @@ CONFIG_TASK_SIZE=0xc0000000 # CONFIG_TAU is not set # CONFIG_TCP_CONG_ADVANCED is not set CONFIG_TCP_CONG_CUBIC=y -CONFIG_TICK_ONESHOT=y CONFIG_TRACING_SUPPORT=y # CONFIG_UDBG_RTAS_CONSOLE is not set CONFIG_UNEVICTABLE_LRU=y diff --git a/target/linux/mpc83xx/config-default b/target/linux/mpc83xx/config-default index 8d2251228..aac94dd00 100644 --- a/target/linux/mpc83xx/config-default +++ b/target/linux/mpc83xx/config-default @@ -20,12 +20,8 @@ CONFIG_ARCH_SUPPORTS_MSI=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y # CONFIG_ASP834x is not set -# CONFIG_ATA_NONSTANDARD is not set -# CONFIG_ATA_PIIX is not set -CONFIG_ATA_SFF=y CONFIG_ATA=y CONFIG_AUDIT_ARCH=y -CONFIG_BASE_SMALL=0 # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y # CONFIG_BOOTX_TEXT is not set @@ -40,7 +36,6 @@ CONFIG_CRYPTO_HASH2=y CONFIG_CRYPTO_MANAGER2=y CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_WORKQUEUE=y -# CONFIG_DEBUG_BUGVERBOSE is not set CONFIG_DECOMPRESS_LZMA=y CONFIG_DEFAULT_UIMAGE=y CONFIG_DEVPORT=y @@ -131,20 +126,16 @@ CONFIG_MPIC=y CONFIG_MTD_NAND_RB_PPC=y CONFIG_MTD_NAND=y # CONFIG_MTD_OF_PARTS is not set -# CONFIG_NATSEMI is not set -# CONFIG_NVRAM is not set CONFIG_OF_DEVICE=y CONFIG_OF_GPIO=y CONFIG_OF=y CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xc0000000 CONFIG_PATA_RB_PPC=m -# CONFIG_PATA_SCH is not set CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y # CONFIG_PCIEPORTBUS is not set CONFIG_PCI_SYSCALL=y -CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y CONFIG_PHYLIB=y CONFIG_PHYSICAL_START=0x00000000 @@ -215,7 +206,6 @@ CONFIG_SERIAL_OF_PLATFORM=y # CONFIG_SQUASHFS is not set CONFIG_TASK_SIZE=0xc0000000 # CONFIG_TAU is not set -CONFIG_TICK_ONESHOT=y CONFIG_TRACING_SUPPORT=y # CONFIG_UCC_GETH is not set # CONFIG_UDBG_RTAS_CONSOLE is not set diff --git a/target/linux/octeon/config-default b/target/linux/octeon/config-default index c0cf4b424..d14570438 100644 --- a/target/linux/octeon/config-default +++ b/target/linux/octeon/config-default @@ -16,7 +16,6 @@ CONFIG_ARCH_SUPPORTS_OPROFILE=y # CONFIG_ARPD is not set # CONFIG_B3DFG is not set # CONFIG_BACKTRACE_SELF_TEST is not set -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set # CONFIG_BINARY_PRINTF is not set CONFIG_BINFMT_ELF32=y @@ -189,7 +188,6 @@ CONFIG_MIPS=y # CONFIG_MTD_CFI_INTELEXT is not set # CONFIG_MTD_COMPLEX_MAPPINGS is not set CONFIG_MTD_PHYSMAP=y -# CONFIG_NATSEMI is not set # CONFIG_NETWORK_FILESYSTEMS is not set # CONFIG_NO_IOPORT is not set CONFIG_NR_CPUS=16 @@ -203,7 +201,6 @@ CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PARTITION_ADVANCED is not set # CONFIG_PCI_DEBUG is not set CONFIG_PCI_DOMAINS=y -CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYS_ADDR_T_64BIT=y # CONFIG_PLAN9AUTH is not set diff --git a/target/linux/olpc/config-2.6.30 b/target/linux/olpc/config-2.6.30 index dac5ea2c1..20a6ef711 100644 --- a/target/linux/olpc/config-2.6.30 +++ b/target/linux/olpc/config-2.6.30 @@ -50,7 +50,6 @@ CONFIG_BACKLIGHT_LCD_SUPPORT=y # CONFIG_BACKLIGHT_PROGEAR is not set # CONFIG_BACKLIGHT_SAHARA is not set # CONFIG_BACKTRACE_SELF_TEST is not set -CONFIG_BASE_SMALL=0 CONFIG_BATTERY_OLPC=y CONFIG_BINARY_PRINTF=y CONFIG_BINFMT_MISC=y @@ -108,7 +107,6 @@ CONFIG_CRYPTO_WORKQUEUE=y # CONFIG_DCDBAS is not set # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set # CONFIG_DEBUG_BOOT_PARAMS is not set -# CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEBUG_DEVRES is not set # CONFIG_DEBUG_DRIVER is not set # CONFIG_DEBUG_INFO is not set @@ -377,7 +375,6 @@ CONFIG_PCI_DOMAINS=y # CONFIG_PCI_GOMMCONFIG is not set CONFIG_PCI_GOOLPC=y CONFIG_PCI_OLPC=y -CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y # CONFIG_PDA_POWER is not set CONFIG_PHYSICAL_ALIGN=0x100000 @@ -439,7 +436,6 @@ CONFIG_SUSPEND=y # CONFIG_TELCLOCK is not set CONFIG_THERMAL=y # CONFIG_THINKPAD_ACPI is not set -CONFIG_TICK_ONESHOT=y CONFIG_TIMER_STATS=y # CONFIG_TOSHIBA is not set CONFIG_TRACEPOINTS=y diff --git a/target/linux/orion/config-default b/target/linux/orion/config-default index 842e9faf6..61aab84ee 100644 --- a/target/linux/orion/config-default +++ b/target/linux/orion/config-default @@ -13,12 +13,8 @@ CONFIG_ARM=y # CONFIG_ARPD is not set # CONFIG_ARTHUR is not set CONFIG_ATA=m -# CONFIG_ATA_NONSTANDARD is not set -# CONFIG_ATA_PIIX is not set -CONFIG_ATA_SFF=y # CONFIG_ATMEL is not set # CONFIG_ATM is not set -CONFIG_BASE_SMALL=0 # CONFIG_BINFMT_AOUT is not set CONFIG_BITREVERSE=y # CONFIG_BLK_DEV_CRYPTOLOOP is not set @@ -44,7 +40,6 @@ CONFIG_CPU_PABRT_NOIFAR=y CONFIG_CPU_TLB_V4WBI=y CONFIG_CRC16=y # CONFIG_CRC_CCITT is not set -# CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEBUG_USER is not set CONFIG_DEVPORT=y CONFIG_DLCI=m @@ -161,7 +156,6 @@ CONFIG_MTD_PHYSMAP_START=0xf0000000 CONFIG_MTD_PHYSMAP=y # CONFIG_MTD_REDBOOT_PARTS is not set CONFIG_MV643XX_ETH=y -# CONFIG_NATSEMI is not set # CONFIG_NE2K_PCI is not set # CONFIG_NET_DSA_MV88E6060 is not set # CONFIG_NET_DSA_MV88E6123_61_65 is not set @@ -177,18 +171,15 @@ CONFIG_NET_DSA=y # CONFIG_NLS_ISO8859_1 is not set # CONFIG_NLS_KOI8_R is not set # CONFIG_NO_IOPORT is not set -# CONFIG_NVRAM is not set # CONFIG_OABI_COMPAT is not set # CONFIG_ORION5X_WATCHDOG is not set # CONFIG_OUTER_CACHE is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PATA_ARTOP=m -# CONFIG_PATA_SCH is not set # CONFIG_PC300 is not set # CONFIG_PCI200SYN is not set # CONFIG_PCIPCWATCHDOG is not set CONFIG_PCI_SYSCALL=y -CONFIG_PCI=y CONFIG_PLAT_ORION=y # CONFIG_PPP is not set # CONFIG_PRISM54 is not set @@ -204,7 +195,6 @@ CONFIG_SLABINFO=y # CONFIG_SOC_CAMERA is not set CONFIG_SPLIT_PTLOCK_CPUS=4096 CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_TICK_ONESHOT=y CONFIG_UID16=y # CONFIG_USB_ACM is not set # CONFIG_USB_C67X00_HCD is not set diff --git a/target/linux/ppc40x/config-default b/target/linux/ppc40x/config-default index 0feb5260c..9a86a9157 100644 --- a/target/linux/ppc40x/config-default +++ b/target/linux/ppc40x/config-default @@ -21,7 +21,6 @@ CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y CONFIG_ARCH_SUPPORTS_MSI=y CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y CONFIG_AUDIT_ARCH=y -CONFIG_BASE_SMALL=0 # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y # CONFIG_BOOKE_WDT is not set @@ -36,7 +35,6 @@ CONFIG_CRYPTO_HASH2=y CONFIG_CRYPTO_MANAGER2=y CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_WORKQUEUE=y -# CONFIG_DEBUG_BUGVERBOSE is not set CONFIG_DECOMPRESS_LZMA=y # CONFIG_DEFAULT_UIMAGE is not set CONFIG_DEVPORT=y @@ -121,9 +119,7 @@ CONFIG_MTD_CFI_ADV_OPTIONS=y # CONFIG_MTD_CFI_INTELEXT is not set CONFIG_MTD_OF_PARTS=y CONFIG_MTD_PHYSMAP_OF=y -# CONFIG_NATSEMI is not set CONFIG_NOT_COHERENT_CACHE=y -# CONFIG_NVRAM is not set CONFIG_OF_DEVICE=y CONFIG_OF_GPIO=y CONFIG_OF=y @@ -136,7 +132,6 @@ CONFIG_PCIEAER=y CONFIG_PCIEPORTBUS=y CONFIG_PCI_MSI=y CONFIG_PCI_SYSCALL=y -CONFIG_PCI=y CONFIG_PHYSICAL_START=0x00000000 CONFIG_PPC32=y CONFIG_PPC40x_SIMPLE=y @@ -181,7 +176,6 @@ CONFIG_SERIAL_OF_PLATFORM=y # CONFIG_SLOW_WORK is not set CONFIG_SLUB=y CONFIG_TASK_SIZE=0xc0000000 -CONFIG_TICK_ONESHOT=y CONFIG_TRACING_SUPPORT=y # CONFIG_WALNUT is not set CONFIG_WORD_SIZE=32 diff --git a/target/linux/ppc44x/config-default b/target/linux/ppc44x/config-default index 0665c56d4..5da5041f2 100644 --- a/target/linux/ppc44x/config-default +++ b/target/linux/ppc44x/config-default @@ -22,7 +22,6 @@ CONFIG_ARCH_SUPPORTS_MSI=y CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y CONFIG_AUDIT_ARCH=y # CONFIG_BAMBOO is not set -CONFIG_BASE_SMALL=0 CONFIG_BITREVERSE=y # CONFIG_BOOKE_WDT is not set CONFIG_BOOKE=y @@ -34,7 +33,6 @@ CONFIG_CMDLINE_BOOL=y CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/mtdblock1 rootfstype=squashfs,jffs2 noinitrd" CONFIG_CONSISTENT_SIZE=0x00200000 CONFIG_CONSISTENT_START=0xff100000 -# CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEFAULT_UIMAGE is not set CONFIG_DEVPORT=y # CONFIG_E200 is not set @@ -112,9 +110,7 @@ CONFIG_MTD_CFI_ADV_OPTIONS=y # CONFIG_MTD_CFI_GEOMETRY is not set CONFIG_MTD_OF_PARTS=y CONFIG_MTD_PHYSMAP_OF=y -# CONFIG_NATSEMI is not set CONFIG_NOT_COHERENT_CACHE=y -# CONFIG_NVRAM is not set CONFIG_OF_DEVICE=y CONFIG_OF_GPIO=y CONFIG_OF=y @@ -127,7 +123,6 @@ CONFIG_PCIEAER=y CONFIG_PCIEPORTBUS=y CONFIG_PCI_MSI=y CONFIG_PCI_SYSCALL=y -CONFIG_PCI=y CONFIG_PHYS_64BIT=y CONFIG_PHYS_ADDR_T_64BIT=y CONFIG_PHYSICAL_START=0x00000000 @@ -176,7 +171,6 @@ CONFIG_SERIAL_8250_SHARE_IRQ=y CONFIG_SERIAL_OF_PLATFORM=y CONFIG_TAISHAN=y CONFIG_TASK_SIZE=0xc0000000 -CONFIG_TICK_ONESHOT=y CONFIG_USB_EHCI_HCD_PPC_OF=y CONFIG_USB_OHCI_HCD_PCI=y CONFIG_USB_OHCI_HCD_PPC_OF_BE=y diff --git a/target/linux/ps3/config-2.6.30 b/target/linux/ps3/config-2.6.30 index 3459b5f4f..b942316a1 100644 --- a/target/linux/ps3/config-2.6.30 +++ b/target/linux/ps3/config-2.6.30 @@ -18,7 +18,6 @@ CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y # CONFIG_ARPD is not set CONFIG_AUDIT_ARCH=y -CONFIG_BASE_SMALL=0 # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y CONFIG_BLK_DEV_LOOP=y @@ -42,7 +41,6 @@ CONFIG_COMPAT=y CONFIG_CONSOLE_TRANSLATIONS=y CONFIG_CRC16=y # CONFIG_CRYPTO is not set -# CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEBUG_FS is not set # CONFIG_DEFAULT_UIMAGE is not set CONFIG_DEVKMEM=y @@ -215,6 +213,7 @@ CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xc000000000000000 # CONFIG_PARTITION_ADVANCED is not set # CONFIG_PCI_DOMAINS is not set +# CONFIG_PCI is not set # CONFIG_PCI_SYSCALL is not set CONFIG_PHYS_ADDR_T_64BIT=y CONFIG_PHYSICAL_START=0x00000000 diff --git a/target/linux/pxa/config-default b/target/linux/pxa/config-default index cae5cd275..f7056d672 100644 --- a/target/linux/pxa/config-default +++ b/target/linux/pxa/config-default @@ -20,9 +20,7 @@ CONFIG_ARM=y # CONFIG_ARPD is not set # CONFIG_ARTHUR is not set CONFIG_ATA=m -# CONFIG_ATA_NONSTANDARD is not set # CONFIG_ATM is not set -CONFIG_BASE_SMALL=0 # CONFIG_BINFMT_AOUT is not set CONFIG_BITREVERSE=y # CONFIG_BLK_DEV_CRYPTOLOOP is not set @@ -47,7 +45,6 @@ CONFIG_CPU_CP15=y # CONFIG_CPU_DCACHE_DISABLE is not set CONFIG_CPU_TLB_V4WBI=y CONFIG_CPU_XSCALE=y -# CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEBUG_USER is not set # CONFIG_DM9000 is not set CONFIG_DUMMY_CONSOLE=y @@ -156,7 +153,6 @@ CONFIG_MTD_GUMSTIX=y CONFIG_NET_SCH_FIFO=y CONFIG_NO_IDLE_HZ=y # CONFIG_NO_IOPORT is not set -# CONFIG_NVRAM is not set # CONFIG_OUTER_CACHE is not set # CONFIG_PACKET is not set CONFIG_PATA_PCMCIA=m diff --git a/target/linux/pxcab/config-2.6.30 b/target/linux/pxcab/config-2.6.30 index c67ae8d9e..ba641bfb6 100644 --- a/target/linux/pxcab/config-2.6.30 +++ b/target/linux/pxcab/config-2.6.30 @@ -21,7 +21,6 @@ CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y CONFIG_AUDIT_ARCH=y CONFIG_AXON_RAM=m # CONFIG_BACKTRACE_SELF_TEST is not set -CONFIG_BASE_SMALL=0 # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y CONFIG_BLK_DEV_LOOP=y @@ -293,7 +292,6 @@ CONFIG_PAGE_OFFSET=0xc000000000000000 CONFIG_PCI_DOMAINS=y # CONFIG_PCIEPORTBUS is not set CONFIG_PCI_SYSCALL=y -CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y CONFIG_PHYLIB=y # CONFIG_PHYP_DUMP is not set diff --git a/target/linux/pxcab/config-2.6.31 b/target/linux/pxcab/config-2.6.31 index a2289ce04..fd7b207df 100644 --- a/target/linux/pxcab/config-2.6.31 +++ b/target/linux/pxcab/config-2.6.31 @@ -21,7 +21,6 @@ CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y CONFIG_AUDIT_ARCH=y CONFIG_AXON_RAM=m # CONFIG_BACKTRACE_SELF_TEST is not set -CONFIG_BASE_SMALL=0 # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y CONFIG_BLK_DEV_LOOP=y @@ -310,7 +309,6 @@ CONFIG_PAGE_OFFSET=0xc000000000000000 CONFIG_PCI_DOMAINS=y # CONFIG_PCIEPORTBUS is not set CONFIG_PCI_SYSCALL=y -CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y # CONFIG_PERF_COUNTERS is not set CONFIG_PHYLIB=y diff --git a/target/linux/ramips/rt288x/config-2.6.30 b/target/linux/ramips/rt288x/config-2.6.30 index 1e4074802..2f5103fb6 100644 --- a/target/linux/ramips/rt288x/config-2.6.30 +++ b/target/linux/ramips/rt288x/config-2.6.30 @@ -7,7 +7,6 @@ CONFIG_ARCH_REQUIRE_GPIOLIB=y # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y @@ -104,13 +103,11 @@ CONFIG_MIPS=y # CONFIG_MTD_CFI_INTELEXT is not set # CONFIG_MTD_COMPLEX_MAPPINGS is not set CONFIG_MTD_PHYSMAP=y -# CONFIG_NATSEMI is not set # CONFIG_NO_IOPORT is not set # CONFIG_NXP_STB220 is not set # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set @@ -150,7 +147,6 @@ CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y # CONFIG_TC35815 is not set -CONFIG_TICK_ONESHOT=y CONFIG_TRACING_SUPPORT=y CONFIG_TRAD_SIGNALS=y CONFIG_USB_SUPPORT=y diff --git a/target/linux/ramips/rt305x/config-2.6.30 b/target/linux/ramips/rt305x/config-2.6.30 index 763c7a859..f1dc98c21 100644 --- a/target/linux/ramips/rt305x/config-2.6.30 +++ b/target/linux/ramips/rt305x/config-2.6.30 @@ -7,7 +7,6 @@ CONFIG_ARCH_REQUIRE_GPIOLIB=y # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y @@ -147,7 +146,6 @@ CONFIG_SYS_HAS_EARLY_PRINTK=y CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y -CONFIG_TICK_ONESHOT=y CONFIG_TRACING_SUPPORT=y CONFIG_TRAD_SIGNALS=y # CONFIG_USB_ARCH_HAS_EHCI is not set diff --git a/target/linux/rb532/config-default b/target/linux/rb532/config-default index 27f76dcdb..f22f4c5c6 100644 --- a/target/linux/rb532/config-default +++ b/target/linux/rb532/config-default @@ -7,11 +7,7 @@ CONFIG_ARCH_REQUIRE_GPIOLIB=y # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y -# CONFIG_ATA_NONSTANDARD is not set -# CONFIG_ATA_PIIX is not set -CONFIG_ATA_SFF=y CONFIG_ATA=y -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y @@ -125,7 +121,6 @@ CONFIG_MTD_NAND=y CONFIG_MTD_PHYSMAP=y # CONFIG_MTD_ROOTFS_ROOT_DEV is not set # CONFIG_MTD_ROOTFS_SPLIT is not set -# CONFIG_NATSEMI is not set CONFIG_NF_CONNTRACK=y CONFIG_NF_CT_ACCT=y # CONFIG_NO_IOPORT is not set @@ -134,7 +129,6 @@ CONFIG_NF_CT_ACCT=y CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PATA_RB532=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set diff --git a/target/linux/rdc/config-2.6.28 b/target/linux/rdc/config-2.6.28 index d491280c0..0eceed764 100644 --- a/target/linux/rdc/config-2.6.28 +++ b/target/linux/rdc/config-2.6.28 @@ -22,7 +22,6 @@ CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y # CONFIG_AUDIT_ARCH is not set -CONFIG_BASE_SMALL=0 # CONFIG_BINFMT_AOUT is not set CONFIG_BITREVERSE=y CONFIG_BLK_DEV_RAM_COUNT=16 @@ -45,7 +44,6 @@ CONFIG_CPU_SUP_CYRIX_32=y # CONFIG_CPU_SUP_UMC_32 is not set # CONFIG_CS5535_GPIO is not set # CONFIG_DCDBAS is not set -# CONFIG_DEBUG_BUGVERBOSE is not set CONFIG_DEFAULT_IO_DELAY_TYPE=0 # CONFIG_DELL_RBU is not set CONFIG_DEVPORT=y @@ -184,10 +182,8 @@ CONFIG_MTD_PHYSMAP=y # CONFIG_MVIAC7 is not set # CONFIG_MWINCHIP3D is not set # CONFIG_MWINCHIPC6 is not set -# CONFIG_NATSEMI is not set CONFIG_NOHIGHMEM=y # CONFIG_NSC_GPIO is not set -CONFIG_NVRAM=y # CONFIG_OLPC is not set # CONFIG_OPTIMIZE_INLINING is not set CONFIG_PAGEFLAGS_EXTENDED=y @@ -204,7 +200,6 @@ CONFIG_PCI_GOANY=y # CONFIG_PCI_GODIRECT is not set # CONFIG_PCI_GOMMCONFIG is not set # CONFIG_PCI_GOOLPC is not set -CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYSICAL_ALIGN=0x100000 CONFIG_PHYSICAL_START=0x100000 diff --git a/target/linux/rdc/config-2.6.30 b/target/linux/rdc/config-2.6.30 index 6f28ce29b..3c6b81897 100644 --- a/target/linux/rdc/config-2.6.30 +++ b/target/linux/rdc/config-2.6.30 @@ -50,7 +50,6 @@ CONFIG_CMDLINE="console=ttyS0,38400 rootfstype=squashfs,jffs2" # CONFIG_CPU_SUP_UMC_32 is not set # CONFIG_CS5535_GPIO is not set # CONFIG_DCDBAS is not set -# CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEBUG_FS is not set CONFIG_DECOMPRESS_LZMA=y CONFIG_DEFAULT_IO_DELAY_TYPE=0 @@ -198,12 +197,10 @@ CONFIG_MTD_PHYSMAP=y # CONFIG_MVIAC7 is not set # CONFIG_MWINCHIP3D is not set # CONFIG_MWINCHIPC6 is not set -# CONFIG_NATSEMI is not set # CONFIG_NETDEV_1000 is not set CONFIG_NOHIGHMEM=y CONFIG_NR_CPUS=1 # CONFIG_NSC_GPIO is not set -# CONFIG_NVRAM is not set # CONFIG_OLPC is not set # CONFIG_OPTIMIZE_INLINING is not set CONFIG_PAGEFLAGS_EXTENDED=y @@ -222,7 +219,6 @@ CONFIG_PCI_GOANY=y # CONFIG_PCI_GOMMCONFIG is not set # CONFIG_PCI_GOOLPC is not set # CONFIG_PCI_QUIRKS is not set -CONFIG_PCI=y # CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYSICAL_ALIGN=0x100000 CONFIG_PHYSICAL_START=0x100000 diff --git a/target/linux/s3c24xx/config-2.6.30 b/target/linux/s3c24xx/config-2.6.30 index ed34338fc..94441063b 100644 --- a/target/linux/s3c24xx/config-2.6.30 +++ b/target/linux/s3c24xx/config-2.6.30 @@ -24,7 +24,6 @@ CONFIG_BACKLIGHT_CLASS_DEVICE=y CONFIG_BACKLIGHT_GENERIC=y CONFIG_BACKLIGHT_LCD_SUPPORT=y # CONFIG_BACKLIGHT_PWM is not set -CONFIG_BASE_SMALL=0 CONFIG_BATTERY_BQ27000_HDQ=y # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y @@ -268,6 +267,7 @@ CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xC0000000 CONFIG_PCF50633_ADC=y CONFIG_PCF50633_GPIO=y +# CONFIG_PCI is not set # CONFIG_PCI_SYSCALL is not set # CONFIG_PDA_POWER is not set CONFIG_PLAT_S3C24XX=y diff --git a/target/linux/s3c24xx/config-2.6.31 b/target/linux/s3c24xx/config-2.6.31 index ac7bdac3e..9ab52c96e 100644 --- a/target/linux/s3c24xx/config-2.6.31 +++ b/target/linux/s3c24xx/config-2.6.31 @@ -21,7 +21,6 @@ CONFIG_BACKLIGHT_CLASS_DEVICE=y CONFIG_BACKLIGHT_GENERIC=y CONFIG_BACKLIGHT_LCD_SUPPORT=y # CONFIG_BACKLIGHT_PWM is not set -CONFIG_BASE_SMALL=0 CONFIG_BATTERY_BQ27000_HDQ=y # CONFIG_BINARY_PRINTF is not set CONFIG_BITREVERSE=y @@ -269,6 +268,7 @@ CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xC0000000 CONFIG_PCF50633_ADC=y CONFIG_PCF50633_GPIO=y +# CONFIG_PCI is not set # CONFIG_PCI_SYSCALL is not set # CONFIG_PDA_POWER is not set CONFIG_PLAT_S3C24XX=y diff --git a/target/linux/sibyte/config-default b/target/linux/sibyte/config-default index d87bc852f..905a57ddd 100644 --- a/target/linux/sibyte/config-default +++ b/target/linux/sibyte/config-default @@ -8,7 +8,6 @@ CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y # CONFIG_ARPD is not set # CONFIG_ATM is not set -CONFIG_BASE_SMALL=0 # CONFIG_BCM47XX is not set CONFIG_BINFMT_ELF32=y CONFIG_BITREVERSE=y @@ -217,7 +216,6 @@ CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y CONFIG_SYSVIPC_COMPAT=y -CONFIG_TICK_ONESHOT=y # CONFIG_TOSHIBA_JMR3927 is not set # CONFIG_TOSHIBA_RBTX4927 is not set # CONFIG_TOSHIBA_RBTX4938 is not set diff --git a/target/linux/ubicom32/config-2.6.28 b/target/linux/ubicom32/config-2.6.28 index cea94dd64..be7917605 100755 --- a/target/linux/ubicom32/config-2.6.28 +++ b/target/linux/ubicom32/config-2.6.28 @@ -4,7 +4,6 @@ CONFIG_ARCH_SUPPORTS_AOUT=y # CONFIG_ARCH_SUPPORTS_MSI is not set # CONFIG_ARPD is not set -CONFIG_BASE_SMALL=0 CONFIG_BINFMT_ELF_FDPIC=y CONFIG_BINFMT_FLAT=y # CONFIG_BINFMT_SHARED_FLAT is not set @@ -121,7 +120,6 @@ CONFIG_OCM_MODULES_RESERVATION=41 CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DEV0_IDSEL=0x001000000 CONFIG_PCI_DEV1_IDSEL=0x002000000 -CONFIG_PCI=y CONFIG_PRINTK_TIME=y CONFIG_PROTECT_KERNEL=y CONFIG_RAMBASE=0x40000000 @@ -148,7 +146,6 @@ CONFIG_SPI=y # CONFIG_SYSCTL_SYSCALL_CHECK is not set CONFIG_SYSFS_DEPRECATED_V2=y CONFIG_SYSFS_DEPRECATED=y -CONFIG_TICK_ONESHOT=y CONFIG_TIME_LOW_RES=y CONFIG_TIMER_EXTRA_ALLOC=0 # CONFIG_TIMERFD is not set diff --git a/target/linux/uml/config/i386 b/target/linux/uml/config/i386 index b8f78dc7e..748df034a 100644 --- a/target/linux/uml/config/i386 +++ b/target/linux/uml/config/i386 @@ -167,3 +167,4 @@ CONFIG_X86_WP_WORKS_OK=y CONFIG_X86_XADD=y CONFIG_XTERM_CHAN=y CONFIG_ZONE_DMA_FLAG=0 +# CONFIG_PCI is not set diff --git a/target/linux/uml/config/x86_64 b/target/linux/uml/config/x86_64 index 6df42ff3a..d667e8917 100644 --- a/target/linux/uml/config/x86_64 +++ b/target/linux/uml/config/x86_64 @@ -124,3 +124,4 @@ CONFIG_UML_X86=y CONFIG_VM_EVENT_COUNTERS=y CONFIG_XTERM_CHAN=y CONFIG_ZONE_DMA_FLAG=0 +# CONFIG_PCI is not set diff --git a/target/linux/x86/config-2.6.28 b/target/linux/x86/config-2.6.28 index d7a0a6de2..4aba3f1ef 100644 --- a/target/linux/x86/config-2.6.28 +++ b/target/linux/x86/config-2.6.28 @@ -26,7 +26,6 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y # CONFIG_AT1700 is not set # CONFIG_AUDIT_ARCH is not set -CONFIG_BASE_SMALL=0 # CONFIG_BINFMT_AOUT is not set CONFIG_BINFMT_MISC=y CONFIG_BITREVERSE=y @@ -258,7 +257,6 @@ CONFIG_MTRR=y # CONFIG_MWINCHIP3D is not set # CONFIG_MWINCHIPC6 is not set CONFIG_NAMESPACES=y -# CONFIG_NATSEMI is not set CONFIG_NET_VENDOR_3COM=y # CONFIG_NET_VENDOR_RACAL is not set # CONFIG_NET_VENDOR_SMC is not set @@ -281,7 +279,6 @@ CONFIG_PCI_GOANY=y # CONFIG_PCI_GODIRECT is not set # CONFIG_PCI_GOMMCONFIG is not set # CONFIG_PCI_GOOLPC is not set -CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y # CONFIG_PCWATCHDOG is not set CONFIG_PHYSICAL_ALIGN=0x100000 diff --git a/target/linux/x86/config-2.6.30 b/target/linux/x86/config-2.6.30 index 36da392ed..3014549fe 100644 --- a/target/linux/x86/config-2.6.30 +++ b/target/linux/x86/config-2.6.30 @@ -27,12 +27,9 @@ CONFIG_ARCH_WANT_FRAME_POINTERS=y CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y # CONFIG_AT1700 is not set CONFIG_ATA_GENERIC=y -# CONFIG_ATA_NONSTANDARD is not set CONFIG_ATA_PIIX=y -CONFIG_ATA_SFF=y CONFIG_ATA=y # CONFIG_AUDIT_ARCH is not set -CONFIG_BASE_SMALL=0 # CONFIG_BINARY_PRINTF is not set CONFIG_BINFMT_MISC=y CONFIG_BITREVERSE=y @@ -267,7 +264,6 @@ CONFIG_MTRR=y # CONFIG_MWINCHIP3D is not set # CONFIG_MWINCHIPC6 is not set CONFIG_NAMESPACES=y -# CONFIG_NATSEMI is not set # CONFIG_NET_NS is not set CONFIG_NET_VENDOR_3COM=y # CONFIG_NET_VENDOR_RACAL is not set @@ -298,7 +294,6 @@ CONFIG_PCI_GOANY=y # CONFIG_PCI_GODIRECT is not set # CONFIG_PCI_GOMMCONFIG is not set # CONFIG_PCI_GOOLPC is not set -CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y # CONFIG_PCWATCHDOG is not set CONFIG_PHYSICAL_ALIGN=0x100000 diff --git a/target/linux/x86/config-2.6.31 b/target/linux/x86/config-2.6.31 index 31c89fd03..7c281deed 100644 --- a/target/linux/x86/config-2.6.31 +++ b/target/linux/x86/config-2.6.31 @@ -27,12 +27,9 @@ CONFIG_ARCH_WANT_FRAME_POINTERS=y CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y # CONFIG_AT1700 is not set CONFIG_ATA_GENERIC=y -# CONFIG_ATA_NONSTANDARD is not set CONFIG_ATA_PIIX=y -CONFIG_ATA_SFF=y CONFIG_ATA=y # CONFIG_AUDIT_ARCH is not set -CONFIG_BASE_SMALL=0 # CONFIG_BINARY_PRINTF is not set CONFIG_BINFMT_MISC=y CONFIG_BITREVERSE=y @@ -273,7 +270,6 @@ CONFIG_MTRR=y # CONFIG_MWINCHIP3D is not set # CONFIG_MWINCHIPC6 is not set CONFIG_NAMESPACES=y -# CONFIG_NATSEMI is not set # CONFIG_NET_NS is not set CONFIG_NET_VENDOR_3COM=y # CONFIG_NET_VENDOR_RACAL is not set @@ -305,7 +301,6 @@ CONFIG_PCI_GOANY=y # CONFIG_PCI_GODIRECT is not set # CONFIG_PCI_GOMMCONFIG is not set # CONFIG_PCI_GOOLPC is not set -CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y # CONFIG_PCWATCHDOG is not set CONFIG_PHYSICAL_ALIGN=0x100000 diff --git a/target/linux/x86/olpc/config-2.6.30 b/target/linux/x86/olpc/config-2.6.30 index dac5ea2c1..20a6ef711 100644 --- a/target/linux/x86/olpc/config-2.6.30 +++ b/target/linux/x86/olpc/config-2.6.30 @@ -50,7 +50,6 @@ CONFIG_BACKLIGHT_LCD_SUPPORT=y # CONFIG_BACKLIGHT_PROGEAR is not set # CONFIG_BACKLIGHT_SAHARA is not set # CONFIG_BACKTRACE_SELF_TEST is not set -CONFIG_BASE_SMALL=0 CONFIG_BATTERY_OLPC=y CONFIG_BINARY_PRINTF=y CONFIG_BINFMT_MISC=y @@ -108,7 +107,6 @@ CONFIG_CRYPTO_WORKQUEUE=y # CONFIG_DCDBAS is not set # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set # CONFIG_DEBUG_BOOT_PARAMS is not set -# CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEBUG_DEVRES is not set # CONFIG_DEBUG_DRIVER is not set # CONFIG_DEBUG_INFO is not set @@ -377,7 +375,6 @@ CONFIG_PCI_DOMAINS=y # CONFIG_PCI_GOMMCONFIG is not set CONFIG_PCI_GOOLPC=y CONFIG_PCI_OLPC=y -CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y # CONFIG_PDA_POWER is not set CONFIG_PHYSICAL_ALIGN=0x100000 @@ -439,7 +436,6 @@ CONFIG_SUSPEND=y # CONFIG_TELCLOCK is not set CONFIG_THERMAL=y # CONFIG_THINKPAD_ACPI is not set -CONFIG_TICK_ONESHOT=y CONFIG_TIMER_STATS=y # CONFIG_TOSHIBA is not set CONFIG_TRACEPOINTS=y diff --git a/target/linux/x86/olpc/config-2.6.31 b/target/linux/x86/olpc/config-2.6.31 index 1907d3469..03dab2752 100644 --- a/target/linux/x86/olpc/config-2.6.31 +++ b/target/linux/x86/olpc/config-2.6.31 @@ -43,7 +43,6 @@ CONFIG_ARCH_WANT_FRAME_POINTERS=y CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y # CONFIG_ASUS_LAPTOP is not set CONFIG_ATA_GENERIC=y -# CONFIG_ATA_NONSTANDARD is not set CONFIG_ATA_PIIX=y CONFIG_ATA=y # CONFIG_AUDIT_ARCH is not set @@ -54,7 +53,6 @@ CONFIG_BACKLIGHT_LCD_SUPPORT=y # CONFIG_BACKLIGHT_PROGEAR is not set # CONFIG_BACKLIGHT_SAHARA is not set # CONFIG_BACKTRACE_SELF_TEST is not set -CONFIG_BASE_SMALL=0 CONFIG_BATTERY_OLPC=y CONFIG_BINARY_PRINTF=y CONFIG_BINFMT_MISC=y @@ -402,7 +400,6 @@ CONFIG_PCI_DOMAINS=y # CONFIG_PCI_GOMMCONFIG is not set CONFIG_PCI_GOOLPC=y CONFIG_PCI_OLPC=y -CONFIG_PCI=y CONFIG_PCSPKR_PLATFORM=y # CONFIG_PDA_POWER is not set CONFIG_PERF_COUNTERS=y @@ -469,7 +466,6 @@ CONFIG_SUSPEND=y # CONFIG_TELCLOCK is not set CONFIG_THERMAL=y # CONFIG_THINKPAD_ACPI is not set -CONFIG_TICK_ONESHOT=y CONFIG_TIMER_STATS=y # CONFIG_TOSHIBA is not set CONFIG_TRACEPOINTS=y From bda513685eb6902e43bff1fe13d361547768121d Mon Sep 17 00:00:00 2001 From: kaloz Date: Wed, 11 Nov 2009 11:52:41 +0000 Subject: [PATCH 139/288] some more Kconfig symbol move.. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18371 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/adm5120/router_be/config-2.6.28 | 2 -- target/linux/adm5120/router_be/config-2.6.30 | 2 -- target/linux/adm5120/router_be/config-2.6.31 | 2 -- target/linux/adm5120/router_le/config-2.6.28 | 2 -- target/linux/adm5120/router_le/config-2.6.30 | 2 -- target/linux/adm5120/router_le/config-2.6.31 | 2 -- target/linux/amazon/config-2.6.21 | 1 - target/linux/ar7/config-default | 2 -- target/linux/ar71xx/config-2.6.28 | 1 - target/linux/ar71xx/config-2.6.30 | 1 - target/linux/ar71xx/config-2.6.31 | 1 - target/linux/at91/config-2.6.25 | 1 - target/linux/atheros/config-2.6.30 | 2 -- target/linux/atheros/config-2.6.31 | 2 -- target/linux/au1000/au1550/config-default | 1 - target/linux/brcm47xx/config-2.6.28 | 2 -- target/linux/brcm47xx/config-2.6.30 | 2 -- target/linux/brcm47xx/config-2.6.31 | 2 -- target/linux/brcm63xx/config-2.6.30 | 2 -- target/linux/cobalt/config-default | 1 - target/linux/coldfire/config-default | 1 - target/linux/etrax/config-2.6.30 | 1 - target/linux/gemini/config-default | 1 - target/linux/generic-2.6/config-2.6.21 | 4 ++++ target/linux/generic-2.6/config-2.6.25 | 4 ++++ target/linux/generic-2.6/config-2.6.28 | 4 ++++ target/linux/generic-2.6/config-2.6.30 | 4 ++++ target/linux/generic-2.6/config-2.6.31 | 4 ++++ target/linux/generic-2.6/config-2.6.32 | 4 ++++ target/linux/goldfish/config-2.6.30 | 1 - target/linux/ifxmips/config-2.6.30 | 2 -- target/linux/iop32x/config-default | 1 - target/linux/ixp4xx/config-2.6.28 | 1 - target/linux/ixp4xx/config-2.6.30 | 1 - target/linux/ixp4xx/config-2.6.31 | 1 - target/linux/ixp4xx/config-2.6.32 | 1 - target/linux/ixp4xx/config-default | 1 - target/linux/kirkwood/config-default | 1 - target/linux/mpc52xx/config-2.6.30 | 3 --- target/linux/mpc83xx/config-default | 3 --- target/linux/octeon/config-default | 2 -- target/linux/olpc/config-2.6.30 | 2 -- target/linux/orion/config-default | 1 - target/linux/ppc40x/config-default | 2 -- target/linux/ppc44x/config-default | 2 -- target/linux/ps3/config-2.6.30 | 1 - target/linux/pxcab/config-2.6.30 | 2 -- target/linux/pxcab/config-2.6.31 | 2 -- target/linux/ramips/rt288x/config-2.6.30 | 2 -- target/linux/ramips/rt305x/config-2.6.30 | 2 -- target/linux/rb532/config-default | 1 - target/linux/rdc/config-2.6.28 | 3 --- target/linux/rdc/config-2.6.30 | 3 --- target/linux/sibyte/config-default | 2 -- target/linux/ubicom32/config-2.6.28 | 2 -- target/linux/x86/config-2.6.28 | 2 -- target/linux/x86/config-2.6.30 | 2 -- target/linux/x86/config-2.6.31 | 2 -- target/linux/x86/olpc/config-2.6.30 | 2 -- target/linux/x86/olpc/config-2.6.31 | 2 -- 60 files changed, 24 insertions(+), 91 deletions(-) diff --git a/target/linux/adm5120/router_be/config-2.6.28 b/target/linux/adm5120/router_be/config-2.6.28 index 4e49f2bc0..0ae8fac27 100644 --- a/target/linux/adm5120/router_be/config-2.6.28 +++ b/target/linux/adm5120/router_be/config-2.6.28 @@ -94,7 +94,6 @@ CONFIG_HW_RANDOM=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set # CONFIG_IDE is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_INOTIFY_USER=y @@ -143,7 +142,6 @@ CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PARTITION_ADVANCED is not set CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y -# CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set # CONFIG_PNX8550_JBS is not set diff --git a/target/linux/adm5120/router_be/config-2.6.30 b/target/linux/adm5120/router_be/config-2.6.30 index bca32648f..202c62f35 100644 --- a/target/linux/adm5120/router_be/config-2.6.30 +++ b/target/linux/adm5120/router_be/config-2.6.30 @@ -101,7 +101,6 @@ CONFIG_HW_RANDOM=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_INOTIFY_USER=y CONFIG_INOTIFY=y @@ -148,7 +147,6 @@ CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PARTITION_ADVANCED is not set CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y -# CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set # CONFIG_PNX8550_JBS is not set diff --git a/target/linux/adm5120/router_be/config-2.6.31 b/target/linux/adm5120/router_be/config-2.6.31 index b060785c2..32a5533fb 100644 --- a/target/linux/adm5120/router_be/config-2.6.31 +++ b/target/linux/adm5120/router_be/config-2.6.31 @@ -103,7 +103,6 @@ CONFIG_HW_RANDOM=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_INOTIFY_USER=y CONFIG_INOTIFY=y @@ -152,7 +151,6 @@ CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PARTITION_ADVANCED is not set CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y -# CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set # CONFIG_PNX8550_JBS is not set diff --git a/target/linux/adm5120/router_le/config-2.6.28 b/target/linux/adm5120/router_le/config-2.6.28 index 4448c9649..22ced5eaf 100644 --- a/target/linux/adm5120/router_le/config-2.6.28 +++ b/target/linux/adm5120/router_le/config-2.6.28 @@ -128,7 +128,6 @@ CONFIG_HW_RANDOM=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set # CONFIG_IDE is not set CONFIG_IEEE80211_CRYPT_WEP=m CONFIG_IEEE80211=m @@ -185,7 +184,6 @@ CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PATA_RB153_CF=m CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y -# CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set # CONFIG_PNX8550_JBS is not set diff --git a/target/linux/adm5120/router_le/config-2.6.30 b/target/linux/adm5120/router_le/config-2.6.30 index a67b3de6b..6ecb26914 100644 --- a/target/linux/adm5120/router_le/config-2.6.30 +++ b/target/linux/adm5120/router_le/config-2.6.30 @@ -136,7 +136,6 @@ CONFIG_HW_RANDOM=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set CONFIG_IMAGE_CMDLINE_HACK=y CONFIG_INITRAMFS_SOURCE="" CONFIG_INOTIFY_USER=y @@ -193,7 +192,6 @@ CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PATA_RB153_CF=m CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y -# CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set # CONFIG_PNX8550_JBS is not set diff --git a/target/linux/adm5120/router_le/config-2.6.31 b/target/linux/adm5120/router_le/config-2.6.31 index f2556131d..8507c4814 100644 --- a/target/linux/adm5120/router_le/config-2.6.31 +++ b/target/linux/adm5120/router_le/config-2.6.31 @@ -138,7 +138,6 @@ CONFIG_HW_RANDOM=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set CONFIG_IMAGE_CMDLINE_HACK=y CONFIG_INITRAMFS_SOURCE="" CONFIG_INOTIFY_USER=y @@ -197,7 +196,6 @@ CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PATA_RB153_CF=m CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y -# CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set # CONFIG_PNX8550_JBS is not set diff --git a/target/linux/amazon/config-2.6.21 b/target/linux/amazon/config-2.6.21 index 1e5b7c6d0..c1bb034fe 100644 --- a/target/linux/amazon/config-2.6.21 +++ b/target/linux/amazon/config-2.6.21 @@ -54,7 +54,6 @@ CONFIG_HAS_IOPORT=y CONFIG_HAVE_STD_PC_SERIAL_PORT=y CONFIG_HW_HAS_PCI=y CONFIG_HW_RANDOM=y -# CONFIG_I2C is not set # CONFIG_IDE is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_IRQ_CPU=y diff --git a/target/linux/ar7/config-default b/target/linux/ar7/config-default index 666fad85b..59a31d8f6 100644 --- a/target/linux/ar7/config-default +++ b/target/linux/ar7/config-default @@ -76,7 +76,6 @@ CONFIG_HAVE_IDE=y CONFIG_HAVE_MLOCK=y CONFIG_HAVE_OPROFILE=y CONFIG_HW_RANDOM=y -# CONFIG_I2C is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_IRQ_CPU=y # CONFIG_ISDN is not set @@ -109,7 +108,6 @@ CONFIG_NO_EXCEPT_FILL=y # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PCI is not set -# CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set diff --git a/target/linux/ar71xx/config-2.6.28 b/target/linux/ar71xx/config-2.6.28 index 9f7b3043d..137b10c74 100644 --- a/target/linux/ar71xx/config-2.6.28 +++ b/target/linux/ar71xx/config-2.6.28 @@ -152,7 +152,6 @@ CONFIG_NET_DSA=y CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y -# CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set diff --git a/target/linux/ar71xx/config-2.6.30 b/target/linux/ar71xx/config-2.6.30 index ed4385cf2..2c8895261 100644 --- a/target/linux/ar71xx/config-2.6.30 +++ b/target/linux/ar71xx/config-2.6.30 @@ -157,7 +157,6 @@ CONFIG_NET_DSA=y CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y -# CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set diff --git a/target/linux/ar71xx/config-2.6.31 b/target/linux/ar71xx/config-2.6.31 index c063d16fb..125ac99b0 100644 --- a/target/linux/ar71xx/config-2.6.31 +++ b/target/linux/ar71xx/config-2.6.31 @@ -160,7 +160,6 @@ CONFIG_NET_DSA=y CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y -# CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set diff --git a/target/linux/at91/config-2.6.25 b/target/linux/at91/config-2.6.25 index b31b5b112..196f2d104 100644 --- a/target/linux/at91/config-2.6.25 +++ b/target/linux/at91/config-2.6.25 @@ -83,7 +83,6 @@ CONFIG_HAVE_OPROFILE=y CONFIG_HW_CONSOLE=y # CONFIG_HW_RANDOM is not set CONFIG_HZ=128 -# CONFIG_I2C is not set # CONFIG_IEEE80211_CRYPT_CCMP is not set # CONFIG_IEEE80211_CRYPT_TKIP is not set # CONFIG_IEEE80211_SOFTMAC is not set diff --git a/target/linux/atheros/config-2.6.30 b/target/linux/atheros/config-2.6.30 index d77f84a7e..1cf297ee9 100644 --- a/target/linux/atheros/config-2.6.30 +++ b/target/linux/atheros/config-2.6.30 @@ -80,7 +80,6 @@ CONFIG_HAVE_MLOCK=y CONFIG_HAVE_OPROFILE=y CONFIG_HW_HAS_PCI=y CONFIG_HW_RANDOM=y -# CONFIG_I2C is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_IP175C_PHY=y CONFIG_IRQ_CPU=y @@ -119,7 +118,6 @@ CONFIG_MVSWITCH_PHY=y # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DOMAINS=y -# CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set diff --git a/target/linux/atheros/config-2.6.31 b/target/linux/atheros/config-2.6.31 index a7cdf2d61..e40f691a2 100644 --- a/target/linux/atheros/config-2.6.31 +++ b/target/linux/atheros/config-2.6.31 @@ -85,7 +85,6 @@ CONFIG_HAVE_MLOCK=y CONFIG_HAVE_OPROFILE=y CONFIG_HW_HAS_PCI=y CONFIG_HW_RANDOM=y -# CONFIG_I2C is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_IP175C_PHY=y CONFIG_IRQ_CPU=y @@ -125,7 +124,6 @@ CONFIG_MVSWITCH_PHY=y # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DOMAINS=y -# CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set diff --git a/target/linux/au1000/au1550/config-default b/target/linux/au1000/au1550/config-default index 04f71dcae..407a256d4 100644 --- a/target/linux/au1000/au1550/config-default +++ b/target/linux/au1000/au1550/config-default @@ -89,7 +89,6 @@ CONFIG_HW_RANDOM=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set # CONFIG_IDE is not set CONFIG_IEEE80211_CRYPT_CCMP=m CONFIG_IEEE80211_CRYPT_TKIP=m diff --git a/target/linux/brcm47xx/config-2.6.28 b/target/linux/brcm47xx/config-2.6.28 index 0eeb219ae..509384ef8 100644 --- a/target/linux/brcm47xx/config-2.6.28 +++ b/target/linux/brcm47xx/config-2.6.28 @@ -76,7 +76,6 @@ CONFIG_HW_RANDOM=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set # CONFIG_IDE is not set CONFIG_INITRAMFS_SOURCE="" # CONFIG_IP_ROUTE_VERBOSE is not set @@ -108,7 +107,6 @@ CONFIG_MTD_BCM47XX=y # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DOMAINS=y -# CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set diff --git a/target/linux/brcm47xx/config-2.6.30 b/target/linux/brcm47xx/config-2.6.30 index 41454d750..0c7a25f2d 100644 --- a/target/linux/brcm47xx/config-2.6.30 +++ b/target/linux/brcm47xx/config-2.6.30 @@ -88,7 +88,6 @@ CONFIG_HW_RANDOM=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set CONFIG_INITRAMFS_SOURCE="" # CONFIG_IP_ROUTE_VERBOSE is not set CONFIG_IRQ_CPU=y @@ -118,7 +117,6 @@ CONFIG_MTD_BCM47XX=y # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DOMAINS=y -# CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set diff --git a/target/linux/brcm47xx/config-2.6.31 b/target/linux/brcm47xx/config-2.6.31 index 5bc66ca5b..3432d26fc 100644 --- a/target/linux/brcm47xx/config-2.6.31 +++ b/target/linux/brcm47xx/config-2.6.31 @@ -88,7 +88,6 @@ CONFIG_HW_RANDOM=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set CONFIG_INITRAMFS_SOURCE="" # CONFIG_IP_ROUTE_VERBOSE is not set CONFIG_IRQ_CPU=y @@ -120,7 +119,6 @@ CONFIG_MTD_BCM47XX=y # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DOMAINS=y -# CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set diff --git a/target/linux/brcm63xx/config-2.6.30 b/target/linux/brcm63xx/config-2.6.30 index b95367a19..33c69df59 100644 --- a/target/linux/brcm63xx/config-2.6.30 +++ b/target/linux/brcm63xx/config-2.6.30 @@ -104,7 +104,6 @@ CONFIG_HW_RANDOM=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_INOTIFY_USER=y CONFIG_INOTIFY=y @@ -156,7 +155,6 @@ CONFIG_NOP_TRACER=y # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DOMAINS=y -# CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set diff --git a/target/linux/cobalt/config-default b/target/linux/cobalt/config-default index 282e8585b..ad4b48512 100644 --- a/target/linux/cobalt/config-default +++ b/target/linux/cobalt/config-default @@ -103,7 +103,6 @@ CONFIG_HW_HAS_PCI=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set CONFIG_I8253=y CONFIG_I8259=y CONFIG_INOTIFY_USER=y diff --git a/target/linux/coldfire/config-default b/target/linux/coldfire/config-default index 6f50ddb0c..245cd1cba 100644 --- a/target/linux/coldfire/config-default +++ b/target/linux/coldfire/config-default @@ -33,7 +33,6 @@ CONFIG_HAVE_IDE=y # CONFIG_HAVE_OPROFILE is not set # CONFIG_HP300 is not set CONFIG_HW_RANDOM=y -# CONFIG_I2C is not set # CONFIG_IDE is not set CONFIG_INITRAMFS_SOURCE="" # CONFIG_LEDS_ALIX is not set diff --git a/target/linux/etrax/config-2.6.30 b/target/linux/etrax/config-2.6.30 index cd161ee34..4b26517a9 100644 --- a/target/linux/etrax/config-2.6.30 +++ b/target/linux/etrax/config-2.6.30 @@ -145,7 +145,6 @@ CONFIG_HAS_IOMEM=y CONFIG_HAVE_IDE=y CONFIG_HAVE_MLOCK=y # CONFIG_HW_RANDOM is not set -# CONFIG_I2C is not set # CONFIG_MTD_CFI_INTELEXT is not set CONFIG_MTD_CONCAT=y CONFIG_MTD_MTDRAM=y diff --git a/target/linux/gemini/config-default b/target/linux/gemini/config-default index dab67c5f1..418ed2e11 100644 --- a/target/linux/gemini/config-default +++ b/target/linux/gemini/config-default @@ -102,7 +102,6 @@ CONFIG_NLATTR=y CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xC0000000 # CONFIG_PCI_STUB is not set -CONFIG_PCI_SYSCALL=y CONFIG_PHYLIB=y CONFIG_SCSI=m # CONFIG_SCSI_MULTI_LUN is not set diff --git a/target/linux/generic-2.6/config-2.6.21 b/target/linux/generic-2.6/config-2.6.21 index 1eada9dda..9ec23b5f1 100644 --- a/target/linux/generic-2.6/config-2.6.21 +++ b/target/linux/generic-2.6/config-2.6.21 @@ -429,6 +429,7 @@ CONFIG_HZ_100=y # CONFIG_I2C_ELEKTOR is not set # CONFIG_I2C_I801 is not set # CONFIG_I2C_I810 is not set +# CONFIG_I2C is not set # CONFIG_I2C_NFORCE2 is not set # CONFIG_I2C_OCORES is not set # CONFIG_I2C_PARPORT_LIGHT is not set @@ -1056,6 +1057,7 @@ CONFIG_PARTITION_ADVANCED=y # CONFIG_PCCARD is not set # CONFIG_PCI_ATMEL is not set # CONFIG_PCI_HERMES is not set +CONFIG_PCI_SYSCALL=y CONFIG_PCI=y # CONFIG_PCMCIA_AHA152X is not set # CONFIG_PCMCIA_ATMEL is not set @@ -1074,6 +1076,7 @@ CONFIG_PCI=y # CONFIG_PCMCIA_WAVELAN is not set # CONFIG_PCMCIA_WL3501 is not set # CONFIG_PCNET32 is not set +# CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PD6729 is not set # CONFIG_PHONE is not set # CONFIG_PHYLIB is not set @@ -1317,6 +1320,7 @@ CONFIG_SLAB=y # CONFIG_SLOB is not set # CONFIG_SMB_FS is not set # CONFIG_SMB_NLS_DEFAULT is not set +# CONFIG_SMP is not set # CONFIG_SND_AC97_POWER_SAVE is not set # CONFIG_SND_AD1816A is not set # CONFIG_SND_AD1848 is not set diff --git a/target/linux/generic-2.6/config-2.6.25 b/target/linux/generic-2.6/config-2.6.25 index d277dd055..276a48f68 100644 --- a/target/linux/generic-2.6/config-2.6.25 +++ b/target/linux/generic-2.6/config-2.6.25 @@ -479,6 +479,7 @@ CONFIG_HZ_100=y # CONFIG_I2C_I801 is not set # CONFIG_I2C_I810 is not set # CONFIG_I2C_IBM_IIC is not set +# CONFIG_I2C is not set # CONFIG_I2C_MPC is not set # CONFIG_I2C_NFORCE2 is not set # CONFIG_I2C_OCORES is not set @@ -1203,6 +1204,7 @@ CONFIG_PARTITION_ADVANCED=y # CONFIG_PCI_HERMES is not set # CONFIG_PCI_LEGACY is not set # CONFIG_PCI_MSI is not set +CONFIG_PCI_SYSCALL=y CONFIG_PCI=y # CONFIG_PCMCIA_AHA152X is not set # CONFIG_PCMCIA_ATMEL is not set @@ -1221,6 +1223,7 @@ CONFIG_PCI=y # CONFIG_PCMCIA_WAVELAN is not set # CONFIG_PCMCIA_WL3501 is not set # CONFIG_PCNET32 is not set +# CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PD6729 is not set # CONFIG_PDC_ADMA is not set # CONFIG_PHANTOM is not set @@ -1515,6 +1518,7 @@ CONFIG_SLAB=y # CONFIG_SLUB is not set # CONFIG_SMB_FS is not set # CONFIG_SMB_NLS_DEFAULT is not set +# CONFIG_SMP is not set # CONFIG_SMSC_PHY is not set # CONFIG_SND_AC97_POWER_SAVE is not set # CONFIG_SND_AD1816A is not set diff --git a/target/linux/generic-2.6/config-2.6.28 b/target/linux/generic-2.6/config-2.6.28 index 04eb633cc..2984dc31e 100644 --- a/target/linux/generic-2.6/config-2.6.28 +++ b/target/linux/generic-2.6/config-2.6.28 @@ -574,6 +574,7 @@ CONFIG_HZ_100=y # CONFIG_I2C_I810 is not set # CONFIG_I2C_IBM_IIC is not set # CONFIG_I2C_ISCH is not set +# CONFIG_I2C is not set # CONFIG_I2C_MPC is not set # CONFIG_I2C_NFORCE2 is not set # CONFIG_I2C_OCORES is not set @@ -1362,6 +1363,7 @@ CONFIG_PARTITION_ADVANCED=y # CONFIG_PCI_MSI is not set # CONFIG_PCIPCWATCHDOG is not set CONFIG_PCI_QUIRKS=y +CONFIG_PCI_SYSCALL=y CONFIG_PCI=y # CONFIG_PCMCIA_AHA152X is not set # CONFIG_PCMCIA_ATMEL is not set @@ -1380,6 +1382,7 @@ CONFIG_PCI=y # CONFIG_PCMCIA_WAVELAN is not set # CONFIG_PCMCIA_WL3501 is not set # CONFIG_PCNET32 is not set +# CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PD6729 is not set # CONFIG_PDC_ADMA is not set # CONFIG_PHANTOM is not set @@ -1713,6 +1716,7 @@ CONFIG_SLAB=y # CONFIG_SMB_NLS_DEFAULT is not set # CONFIG_SMC911X is not set # CONFIG_SMC91X is not set +# CONFIG_SMP is not set # CONFIG_SMSC_PHY is not set # CONFIG_SND_AC97_POWER_SAVE is not set # CONFIG_SND_AD1816A is not set diff --git a/target/linux/generic-2.6/config-2.6.30 b/target/linux/generic-2.6/config-2.6.30 index db4c12b62..76ce52c40 100644 --- a/target/linux/generic-2.6/config-2.6.30 +++ b/target/linux/generic-2.6/config-2.6.30 @@ -688,6 +688,7 @@ CONFIG_HZ_100=y # CONFIG_I2C_I810 is not set # CONFIG_I2C_IBM_IIC is not set # CONFIG_I2C_ISCH is not set +# CONFIG_I2C is not set # CONFIG_I2C_MPC is not set # CONFIG_I2C_NFORCE2 is not set # CONFIG_I2C_OCORES is not set @@ -1542,6 +1543,7 @@ CONFIG_PARTITION_ADVANCED=y # CONFIG_PCIPCWATCHDOG is not set CONFIG_PCI_QUIRKS=y # CONFIG_PCI_STUB is not set +CONFIG_PCI_SYSCALL=y CONFIG_PCI=y # CONFIG_PCMCIA_AHA152X is not set # CONFIG_PCMCIA_ATMEL is not set @@ -1560,6 +1562,7 @@ CONFIG_PCI=y # CONFIG_PCMCIA_WAVELAN is not set # CONFIG_PCMCIA_WL3501 is not set # CONFIG_PCNET32 is not set +# CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PD6729 is not set # CONFIG_PDC_ADMA is not set # CONFIG_PHANTOM is not set @@ -1920,6 +1923,7 @@ CONFIG_SLAB=y # CONFIG_SMB_NLS_DEFAULT is not set # CONFIG_SMC911X is not set # CONFIG_SMC91X is not set +# CONFIG_SMP is not set # CONFIG_SMSC911X is not set # CONFIG_SMSC9420 is not set # CONFIG_SMSC_PHY is not set diff --git a/target/linux/generic-2.6/config-2.6.31 b/target/linux/generic-2.6/config-2.6.31 index 545cecb16..86647470a 100644 --- a/target/linux/generic-2.6/config-2.6.31 +++ b/target/linux/generic-2.6/config-2.6.31 @@ -710,6 +710,7 @@ CONFIG_HZ_100=y # CONFIG_I2C_I810 is not set # CONFIG_I2C_IBM_IIC is not set # CONFIG_I2C_ISCH is not set +# CONFIG_I2C is not set # CONFIG_I2C_MPC is not set # CONFIG_I2C_NFORCE2 is not set # CONFIG_I2C_OCORES is not set @@ -1572,6 +1573,7 @@ CONFIG_PARTITION_ADVANCED=y # CONFIG_PCIPCWATCHDOG is not set CONFIG_PCI_QUIRKS=y # CONFIG_PCI_STUB is not set +CONFIG_PCI_SYSCALL=y CONFIG_PCI=y # CONFIG_PCMCIA_AHA152X is not set # CONFIG_PCMCIA_ATMEL is not set @@ -1590,6 +1592,7 @@ CONFIG_PCI=y # CONFIG_PCMCIA_WAVELAN is not set # CONFIG_PCMCIA_WL3501 is not set # CONFIG_PCNET32 is not set +# CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PD6729 is not set # CONFIG_PDC_ADMA is not set # CONFIG_PHANTOM is not set @@ -1967,6 +1970,7 @@ CONFIG_SLAB=y # CONFIG_SMB_NLS_DEFAULT is not set # CONFIG_SMC911X is not set # CONFIG_SMC91X is not set +# CONFIG_SMP is not set # CONFIG_SMSC911X is not set # CONFIG_SMSC9420 is not set # CONFIG_SMSC_PHY is not set diff --git a/target/linux/generic-2.6/config-2.6.32 b/target/linux/generic-2.6/config-2.6.32 index c6a343424..2da564028 100644 --- a/target/linux/generic-2.6/config-2.6.32 +++ b/target/linux/generic-2.6/config-2.6.32 @@ -718,6 +718,7 @@ CONFIG_HZ_100=y # CONFIG_I2C_I810 is not set # CONFIG_I2C_IBM_IIC is not set # CONFIG_I2C_ISCH is not set +# CONFIG_I2C is not set # CONFIG_I2C_MPC is not set # CONFIG_I2C_NFORCE2 is not set # CONFIG_I2C_OCORES is not set @@ -1583,6 +1584,7 @@ CONFIG_PARTITION_ADVANCED=y # CONFIG_PCIPCWATCHDOG is not set CONFIG_PCI_QUIRKS=y # CONFIG_PCI_STUB is not set +CONFIG_PCI_SYSCALL=y CONFIG_PCI=y # CONFIG_PCMCIA_AHA152X is not set # CONFIG_PCMCIA_ATMEL is not set @@ -1601,6 +1603,7 @@ CONFIG_PCI=y # CONFIG_PCMCIA_WAVELAN is not set # CONFIG_PCMCIA_WL3501 is not set # CONFIG_PCNET32 is not set +# CONFIG_PCSPKR_PLATFORM is not set # CONFIG_PD6729 is not set # CONFIG_PDC_ADMA is not set # CONFIG_PHANTOM is not set @@ -1983,6 +1986,7 @@ CONFIG_SLAB=y # CONFIG_SMB_NLS_DEFAULT is not set # CONFIG_SMC911X is not set # CONFIG_SMC91X is not set +# CONFIG_SMP is not set # CONFIG_SMSC911X is not set # CONFIG_SMSC9420 is not set # CONFIG_SMSC_PHY is not set diff --git a/target/linux/goldfish/config-2.6.30 b/target/linux/goldfish/config-2.6.30 index b6b4fd58e..41577f102 100644 --- a/target/linux/goldfish/config-2.6.30 +++ b/target/linux/goldfish/config-2.6.30 @@ -116,7 +116,6 @@ CONFIG_HID_SUPPORT=y CONFIG_HID=y CONFIG_HW_CONSOLE=y # CONFIG_HW_RANDOM is not set -# CONFIG_I2C is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_INPUT_EVDEV=y CONFIG_INPUT_GPIO=y diff --git a/target/linux/ifxmips/config-2.6.30 b/target/linux/ifxmips/config-2.6.30 index 8659e504d..3842dd526 100644 --- a/target/linux/ifxmips/config-2.6.30 +++ b/target/linux/ifxmips/config-2.6.30 @@ -78,7 +78,6 @@ CONFIG_HW_RANDOM=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set CONFIG_IFXMIPS_GPIO_RST_BTN=y CONFIG_IFXMIPS_MII0=y # CONFIG_IFXMIPS_PROM_ASC0 is not set @@ -121,7 +120,6 @@ CONFIG_MTD_IFXMIPS=y # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DOMAINS=y -# CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set diff --git a/target/linux/iop32x/config-default b/target/linux/iop32x/config-default index fc558428f..96830ae7e 100644 --- a/target/linux/iop32x/config-default +++ b/target/linux/iop32x/config-default @@ -161,7 +161,6 @@ CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PC300 is not set # CONFIG_PCI200SYN is not set # CONFIG_PCIPCWATCHDOG is not set -CONFIG_PCI_SYSCALL=y CONFIG_PLAT_IOP=y # CONFIG_PPP is not set # CONFIG_PRISM54 is not set diff --git a/target/linux/ixp4xx/config-2.6.28 b/target/linux/ixp4xx/config-2.6.28 index b0a2c5939..7311cae84 100644 --- a/target/linux/ixp4xx/config-2.6.28 +++ b/target/linux/ixp4xx/config-2.6.28 @@ -167,7 +167,6 @@ CONFIG_MTD_REDBOOT_PARTS=y CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PATA_ARTOP is not set # CONFIG_PATA_IXP4XX_CF is not set -CONFIG_PCI_SYSCALL=y # CONFIG_R6040 is not set CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_DS1672=y diff --git a/target/linux/ixp4xx/config-2.6.30 b/target/linux/ixp4xx/config-2.6.30 index 66feafe85..b569faa5e 100644 --- a/target/linux/ixp4xx/config-2.6.30 +++ b/target/linux/ixp4xx/config-2.6.30 @@ -135,7 +135,6 @@ CONFIG_MTD_REDBOOT_PARTS=y CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xC0000000 # CONFIG_PCI_STUB is not set -CONFIG_PCI_SYSCALL=y CONFIG_PHYLIB=y CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_DS1672=y diff --git a/target/linux/ixp4xx/config-2.6.31 b/target/linux/ixp4xx/config-2.6.31 index 8de080520..db9d9f88c 100644 --- a/target/linux/ixp4xx/config-2.6.31 +++ b/target/linux/ixp4xx/config-2.6.31 @@ -125,7 +125,6 @@ CONFIG_MTD_OTP=y CONFIG_MTD_REDBOOT_PARTS=y CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xC0000000 -CONFIG_PCI_SYSCALL=y CONFIG_PHYLIB=y CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_DS1672=y diff --git a/target/linux/ixp4xx/config-2.6.32 b/target/linux/ixp4xx/config-2.6.32 index 8de080520..db9d9f88c 100644 --- a/target/linux/ixp4xx/config-2.6.32 +++ b/target/linux/ixp4xx/config-2.6.32 @@ -125,7 +125,6 @@ CONFIG_MTD_OTP=y CONFIG_MTD_REDBOOT_PARTS=y CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xC0000000 -CONFIG_PCI_SYSCALL=y CONFIG_PHYLIB=y CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_DS1672=y diff --git a/target/linux/ixp4xx/config-default b/target/linux/ixp4xx/config-default index a4da85206..46dab9d90 100644 --- a/target/linux/ixp4xx/config-default +++ b/target/linux/ixp4xx/config-default @@ -196,7 +196,6 @@ CONFIG_PATA_IXP4XX_CF=m # CONFIG_PC300 is not set # CONFIG_PCI200SYN is not set # CONFIG_PCIPCWATCHDOG is not set -CONFIG_PCI_SYSCALL=y # CONFIG_PRISM54 is not set # CONFIG_R6040 is not set CONFIG_RTC_CLASS=y diff --git a/target/linux/kirkwood/config-default b/target/linux/kirkwood/config-default index 02f439457..b20ba2b7c 100644 --- a/target/linux/kirkwood/config-default +++ b/target/linux/kirkwood/config-default @@ -129,7 +129,6 @@ CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xC0000000 CONFIG_PATA_ARTOP=m # CONFIG_PCI_STUB is not set -CONFIG_PCI_SYSCALL=y CONFIG_PHYLIB=y CONFIG_PLAT_ORION=y CONFIG_RTC_CLASS=y diff --git a/target/linux/mpc52xx/config-2.6.30 b/target/linux/mpc52xx/config-2.6.30 index 9d6a5ddac..fb97478ef 100644 --- a/target/linux/mpc52xx/config-2.6.30 +++ b/target/linux/mpc52xx/config-2.6.30 @@ -112,7 +112,6 @@ CONFIG_HAVE_OPROFILE=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set CONFIG_INET_DIAG=y CONFIG_INET_TCP_DIAG=y CONFIG_INITRAMFS_SOURCE="" @@ -160,7 +159,6 @@ CONFIG_PAGE_OFFSET=0xc0000000 CONFIG_PCI_DOMAINS=y # CONFIG_PCIEPORTBUS is not set CONFIG_PCI_LEGACY=y -CONFIG_PCI_SYSCALL=y CONFIG_PHYLIB=y CONFIG_PHYSICAL_START=0x00000000 # CONFIG_PM_DEBUG is not set @@ -232,7 +230,6 @@ CONFIG_SERIAL_MPC52xx=y # CONFIG_SLAB is not set # CONFIG_SLOW_WORK is not set CONFIG_SLUB=y -# CONFIG_SMP is not set # CONFIG_SPI_MPC52xx_PSC is not set # CONFIG_SQUASHFS is not set # CONFIG_STRIP_ASM_SYMS is not set diff --git a/target/linux/mpc83xx/config-default b/target/linux/mpc83xx/config-default index aac94dd00..b1cf4feb0 100644 --- a/target/linux/mpc83xx/config-default +++ b/target/linux/mpc83xx/config-default @@ -92,7 +92,6 @@ CONFIG_HW_RANDOM=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set CONFIG_INITRAMFS_SOURCE="" # CONFIG_IOMMU_HELPER is not set CONFIG_IPIC=y @@ -135,7 +134,6 @@ CONFIG_PATA_RB_PPC=m CONFIG_PCI_DISABLE_COMMON_QUIRKS=y CONFIG_PCI_DOMAINS=y # CONFIG_PCIEPORTBUS is not set -CONFIG_PCI_SYSCALL=y CONFIG_PCSPKR_PLATFORM=y CONFIG_PHYLIB=y CONFIG_PHYSICAL_START=0x00000000 @@ -202,7 +200,6 @@ CONFIG_SERIAL_OF_PLATFORM=y # CONFIG_SERIAL_QE is not set # CONFIG_SIMPLE_GPIO is not set # CONFIG_SLOW_WORK is not set -# CONFIG_SMP is not set # CONFIG_SQUASHFS is not set CONFIG_TASK_SIZE=0xc0000000 # CONFIG_TAU is not set diff --git a/target/linux/octeon/config-default b/target/linux/octeon/config-default index d14570438..15ea51c6a 100644 --- a/target/linux/octeon/config-default +++ b/target/linux/octeon/config-default @@ -144,7 +144,6 @@ CONFIG_HW_RANDOM=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_INOTIFY_USER=y CONFIG_INOTIFY=y @@ -201,7 +200,6 @@ CONFIG_PAGEFLAGS_EXTENDED=y # CONFIG_PARTITION_ADVANCED is not set # CONFIG_PCI_DEBUG is not set CONFIG_PCI_DOMAINS=y -# CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYS_ADDR_T_64BIT=y # CONFIG_PLAN9AUTH is not set # CONFIG_PMC_MSP is not set diff --git a/target/linux/olpc/config-2.6.30 b/target/linux/olpc/config-2.6.30 index 20a6ef711..808d8ee7b 100644 --- a/target/linux/olpc/config-2.6.30 +++ b/target/linux/olpc/config-2.6.30 @@ -242,7 +242,6 @@ CONFIG_HW_RANDOM_GEODE=y # CONFIG_HW_RANDOM_INTEL is not set CONFIG_HW_RANDOM_VIA=y CONFIG_HW_RANDOM=y -# CONFIG_I2C is not set # CONFIG_I8K is not set # CONFIG_IMA is not set CONFIG_INITRAMFS_SOURCE="" @@ -423,7 +422,6 @@ CONFIG_SERIO_LIBPS2=y CONFIG_SERIO_SERPORT=y CONFIG_SERIO=y # CONFIG_SLOW_WORK is not set -# CONFIG_SMP is not set # CONFIG_SONYPI is not set # CONFIG_SPARSE_IRQ is not set CONFIG_SPARSEMEM_STATIC=y diff --git a/target/linux/orion/config-default b/target/linux/orion/config-default index 61aab84ee..0f9eb27f3 100644 --- a/target/linux/orion/config-default +++ b/target/linux/orion/config-default @@ -179,7 +179,6 @@ CONFIG_PATA_ARTOP=m # CONFIG_PC300 is not set # CONFIG_PCI200SYN is not set # CONFIG_PCIPCWATCHDOG is not set -CONFIG_PCI_SYSCALL=y CONFIG_PLAT_ORION=y # CONFIG_PPP is not set # CONFIG_PRISM54 is not set diff --git a/target/linux/ppc40x/config-default b/target/linux/ppc40x/config-default index 9a86a9157..a5a178b96 100644 --- a/target/linux/ppc40x/config-default +++ b/target/linux/ppc40x/config-default @@ -86,7 +86,6 @@ CONFIG_HW_RANDOM=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set # CONFIG_IBM_NEW_EMAC_DEBUG is not set CONFIG_IBM_NEW_EMAC_EMAC4=y CONFIG_IBM_NEW_EMAC_POLL_WEIGHT=32 @@ -131,7 +130,6 @@ CONFIG_PCI_DOMAINS=y CONFIG_PCIEAER=y CONFIG_PCIEPORTBUS=y CONFIG_PCI_MSI=y -CONFIG_PCI_SYSCALL=y CONFIG_PHYSICAL_START=0x00000000 CONFIG_PPC32=y CONFIG_PPC40x_SIMPLE=y diff --git a/target/linux/ppc44x/config-default b/target/linux/ppc44x/config-default index 5da5041f2..bff935350 100644 --- a/target/linux/ppc44x/config-default +++ b/target/linux/ppc44x/config-default @@ -77,7 +77,6 @@ CONFIG_HW_RANDOM=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set # CONFIG_IBM_NEW_EMAC_DEBUG is not set CONFIG_IBM_NEW_EMAC_EMAC4=y CONFIG_IBM_NEW_EMAC_POLL_WEIGHT=32 @@ -122,7 +121,6 @@ CONFIG_PCIEAER=y # CONFIG_PCIEASPM is not set CONFIG_PCIEPORTBUS=y CONFIG_PCI_MSI=y -CONFIG_PCI_SYSCALL=y CONFIG_PHYS_64BIT=y CONFIG_PHYS_ADDR_T_64BIT=y CONFIG_PHYSICAL_START=0x00000000 diff --git a/target/linux/ps3/config-2.6.30 b/target/linux/ps3/config-2.6.30 index b942316a1..565e807a7 100644 --- a/target/linux/ps3/config-2.6.30 +++ b/target/linux/ps3/config-2.6.30 @@ -133,7 +133,6 @@ CONFIG_HW_CONSOLE=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set CONFIG_INITRAMFS_ROOT_GID=500 CONFIG_INITRAMFS_ROOT_UID=500 CONFIG_INOTIFY_USER=y diff --git a/target/linux/pxcab/config-2.6.30 b/target/linux/pxcab/config-2.6.30 index ba641bfb6..0be347861 100644 --- a/target/linux/pxcab/config-2.6.30 +++ b/target/linux/pxcab/config-2.6.30 @@ -191,7 +191,6 @@ CONFIG_HW_CONSOLE=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set # CONFIG_IBM_BSR is not set # CONFIG_IBMEBUS is not set CONFIG_IBM_NEW_EMAC_EMAC4=y @@ -291,7 +290,6 @@ CONFIG_PAGE_OFFSET=0xc000000000000000 # CONFIG_PCI_DEBUG is not set CONFIG_PCI_DOMAINS=y # CONFIG_PCIEPORTBUS is not set -CONFIG_PCI_SYSCALL=y CONFIG_PCSPKR_PLATFORM=y CONFIG_PHYLIB=y # CONFIG_PHYP_DUMP is not set diff --git a/target/linux/pxcab/config-2.6.31 b/target/linux/pxcab/config-2.6.31 index fd7b207df..cea1d3c83 100644 --- a/target/linux/pxcab/config-2.6.31 +++ b/target/linux/pxcab/config-2.6.31 @@ -205,7 +205,6 @@ CONFIG_HW_CONSOLE=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set # CONFIG_IBM_BSR is not set # CONFIG_IBMEBUS is not set CONFIG_IBM_NEW_EMAC_EMAC4=y @@ -308,7 +307,6 @@ CONFIG_PAGE_OFFSET=0xc000000000000000 # CONFIG_PCI_DEBUG is not set CONFIG_PCI_DOMAINS=y # CONFIG_PCIEPORTBUS is not set -CONFIG_PCI_SYSCALL=y CONFIG_PCSPKR_PLATFORM=y # CONFIG_PERF_COUNTERS is not set CONFIG_PHYLIB=y diff --git a/target/linux/ramips/rt288x/config-2.6.30 b/target/linux/ramips/rt288x/config-2.6.30 index 2f5103fb6..03a679720 100644 --- a/target/linux/ramips/rt288x/config-2.6.30 +++ b/target/linux/ramips/rt288x/config-2.6.30 @@ -75,7 +75,6 @@ CONFIG_HAVE_MLOCK=y CONFIG_HAVE_OPROFILE=y CONFIG_HW_HAS_PCI=y CONFIG_HW_RANDOM=m -# CONFIG_I2C is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_IRQ_CPU=y # CONFIG_ISDN is not set @@ -108,7 +107,6 @@ CONFIG_MTD_PHYSMAP=y # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PCI_DOMAINS=y -# CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set diff --git a/target/linux/ramips/rt305x/config-2.6.30 b/target/linux/ramips/rt305x/config-2.6.30 index f1dc98c21..401665d24 100644 --- a/target/linux/ramips/rt305x/config-2.6.30 +++ b/target/linux/ramips/rt305x/config-2.6.30 @@ -73,7 +73,6 @@ CONFIG_HAVE_IDE=y CONFIG_HAVE_MLOCK=y CONFIG_HAVE_OPROFILE=y CONFIG_HW_RANDOM=m -# CONFIG_I2C is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_IRQ_CPU=y # CONFIG_ISDN is not set @@ -105,7 +104,6 @@ CONFIG_MTD_PHYSMAP=y # CONFIG_NXP_STB220 is not set # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y -# CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set diff --git a/target/linux/rb532/config-default b/target/linux/rb532/config-default index f22f4c5c6..2f95a18d7 100644 --- a/target/linux/rb532/config-default +++ b/target/linux/rb532/config-default @@ -83,7 +83,6 @@ CONFIG_HW_RANDOM=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set CONFIG_IMAGE_CMDLINE_HACK=y CONFIG_INITRAMFS_SOURCE="" CONFIG_IRQ_CPU=y diff --git a/target/linux/rdc/config-2.6.28 b/target/linux/rdc/config-2.6.28 index 0eceed764..3d5a66145 100644 --- a/target/linux/rdc/config-2.6.28 +++ b/target/linux/rdc/config-2.6.28 @@ -106,7 +106,6 @@ CONFIG_HW_RANDOM=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set # CONFIG_I6300ESB_WDT is not set # CONFIG_I8K is not set # CONFIG_IB700_WDT is not set @@ -200,7 +199,6 @@ CONFIG_PCI_GOANY=y # CONFIG_PCI_GODIRECT is not set # CONFIG_PCI_GOMMCONFIG is not set # CONFIG_PCI_GOOLPC is not set -# CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYSICAL_ALIGN=0x100000 CONFIG_PHYSICAL_START=0x100000 CONFIG_PROCESSOR_SELECT=y @@ -224,7 +222,6 @@ CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y # CONFIG_SCSI_DMA is not set # CONFIG_SCx200 is not set # CONFIG_SERIAL_8250_EXTENDED is not set -# CONFIG_SMP is not set # CONFIG_SMSC37B787_WDT is not set CONFIG_SPARSEMEM_STATIC=y # CONFIG_STRICT_DEVMEM is not set diff --git a/target/linux/rdc/config-2.6.30 b/target/linux/rdc/config-2.6.30 index 3c6b81897..0113a58db 100644 --- a/target/linux/rdc/config-2.6.30 +++ b/target/linux/rdc/config-2.6.30 @@ -125,7 +125,6 @@ CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y # CONFIG_HZ_100 is not set CONFIG_HZ=250 CONFIG_HZ_250=y -# CONFIG_I2C is not set # CONFIG_I6300ESB_WDT is not set # CONFIG_I8K is not set # CONFIG_IB700_WDT is not set @@ -219,7 +218,6 @@ CONFIG_PCI_GOANY=y # CONFIG_PCI_GOMMCONFIG is not set # CONFIG_PCI_GOOLPC is not set # CONFIG_PCI_QUIRKS is not set -# CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYSICAL_ALIGN=0x100000 CONFIG_PHYSICAL_START=0x100000 # CONFIG_POWER_TRACER is not set @@ -242,7 +240,6 @@ CONFIG_SCHED_OMIT_FRAME_POINTER=y # CONFIG_SERIAL_8250_EXTENDED is not set # CONFIG_SHMEM is not set # CONFIG_SLOW_WORK is not set -# CONFIG_SMP is not set # CONFIG_SMSC37B787_WDT is not set # CONFIG_SMSC_SCH311X_WDT is not set CONFIG_SPARSEMEM_STATIC=y diff --git a/target/linux/sibyte/config-default b/target/linux/sibyte/config-default index 905a57ddd..57df0bfbb 100644 --- a/target/linux/sibyte/config-default +++ b/target/linux/sibyte/config-default @@ -92,7 +92,6 @@ CONFIG_HZ=250 CONFIG_HZ_250=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_HELPER_AUTO=y -# CONFIG_I2C is not set CONFIG_I2C_SIBYTE=y CONFIG_I2C=y # CONFIG_IDE is not set @@ -154,7 +153,6 @@ CONFIG_MTD_PHYSMAP=y # CONFIG_NXP_STB220 is not set # CONFIG_NXP_STB225 is not set CONFIG_PAGEFLAGS_EXTENDED=y -# CONFIG_PCSPKR_PLATFORM is not set CONFIG_PHYLIB=y # CONFIG_PMC_MSP is not set # CONFIG_PMC_YOSEMITE is not set diff --git a/target/linux/ubicom32/config-2.6.28 b/target/linux/ubicom32/config-2.6.28 index be7917605..a3518a082 100755 --- a/target/linux/ubicom32/config-2.6.28 +++ b/target/linux/ubicom32/config-2.6.28 @@ -66,7 +66,6 @@ CONFIG_HAVE_CLK=y CONFIG_HAVE_OPROFILE=y CONFIG_HW_RANDOM_UBICOM32=y CONFIG_HW_RANDOM=y -# CONFIG_I2C is not set CONFIG_INET_DIAG=y CONFIG_INET_TCP_DIAG=y CONFIG_INITRAMFS_ROOT_GID=0 @@ -134,7 +133,6 @@ CONFIG_SERIAL_UBI32_MAILBOX=y # CONFIG_SERIAL_UBI32_SERDES is not set # CONFIG_SERIAL_UBI32_UARTTIO is not set # CONFIG_SIGNALFD is not set -# CONFIG_SMP is not set CONFIG_SPI_BITBANG=y # CONFIG_SPI_GPIO is not set CONFIG_SPI_MASTER=y diff --git a/target/linux/x86/config-2.6.28 b/target/linux/x86/config-2.6.28 index 4aba3f1ef..4473e7f0a 100644 --- a/target/linux/x86/config-2.6.28 +++ b/target/linux/x86/config-2.6.28 @@ -155,7 +155,6 @@ CONFIG_HW_RANDOM_GEODE=y # CONFIG_HW_RANDOM_INTEL is not set CONFIG_HW_RANDOM_VIA=y CONFIG_HW_RANDOM=y -# CONFIG_I2C is not set # CONFIG_I6300ESB_WDT is not set # CONFIG_I8K is not set # CONFIG_IB700_WDT is not set @@ -319,7 +318,6 @@ CONFIG_SERIO=y CONFIG_SLUB_DEBUG=y # CONFIG_SLUB_STATS is not set CONFIG_SLUB=y -# CONFIG_SMP is not set # CONFIG_SMSC37B787_WDT is not set # CONFIG_SONYPI is not set CONFIG_SPARSEMEM_STATIC=y diff --git a/target/linux/x86/config-2.6.30 b/target/linux/x86/config-2.6.30 index 3014549fe..5b2f1e64b 100644 --- a/target/linux/x86/config-2.6.30 +++ b/target/linux/x86/config-2.6.30 @@ -163,7 +163,6 @@ CONFIG_HW_RANDOM_GEODE=y # CONFIG_HW_RANDOM_INTEL is not set CONFIG_HW_RANDOM_VIA=y CONFIG_HW_RANDOM=y -# CONFIG_I2C is not set # CONFIG_I6300ESB_WDT is not set # CONFIG_I8K is not set # CONFIG_IB700_WDT is not set @@ -339,7 +338,6 @@ CONFIG_SERIO=y CONFIG_SLUB_DEBUG=y # CONFIG_SLUB_STATS is not set CONFIG_SLUB=y -# CONFIG_SMP is not set # CONFIG_SMSC37B787_WDT is not set # CONFIG_SMSC_SCH311X_WDT is not set # CONFIG_SONYPI is not set diff --git a/target/linux/x86/config-2.6.31 b/target/linux/x86/config-2.6.31 index 7c281deed..5cfc3e16f 100644 --- a/target/linux/x86/config-2.6.31 +++ b/target/linux/x86/config-2.6.31 @@ -168,7 +168,6 @@ CONFIG_HW_RANDOM_GEODE=y # CONFIG_HW_RANDOM_INTEL is not set CONFIG_HW_RANDOM_VIA=y CONFIG_HW_RANDOM=y -# CONFIG_I2C is not set # CONFIG_I6300ESB_WDT is not set # CONFIG_I8K is not set # CONFIG_IB700_WDT is not set @@ -345,7 +344,6 @@ CONFIG_SERIO=y CONFIG_SLUB_DEBUG=y # CONFIG_SLUB_STATS is not set CONFIG_SLUB=y -# CONFIG_SMP is not set # CONFIG_SMSC37B787_WDT is not set # CONFIG_SMSC_SCH311X_WDT is not set # CONFIG_SONYPI is not set diff --git a/target/linux/x86/olpc/config-2.6.30 b/target/linux/x86/olpc/config-2.6.30 index 20a6ef711..808d8ee7b 100644 --- a/target/linux/x86/olpc/config-2.6.30 +++ b/target/linux/x86/olpc/config-2.6.30 @@ -242,7 +242,6 @@ CONFIG_HW_RANDOM_GEODE=y # CONFIG_HW_RANDOM_INTEL is not set CONFIG_HW_RANDOM_VIA=y CONFIG_HW_RANDOM=y -# CONFIG_I2C is not set # CONFIG_I8K is not set # CONFIG_IMA is not set CONFIG_INITRAMFS_SOURCE="" @@ -423,7 +422,6 @@ CONFIG_SERIO_LIBPS2=y CONFIG_SERIO_SERPORT=y CONFIG_SERIO=y # CONFIG_SLOW_WORK is not set -# CONFIG_SMP is not set # CONFIG_SONYPI is not set # CONFIG_SPARSE_IRQ is not set CONFIG_SPARSEMEM_STATIC=y diff --git a/target/linux/x86/olpc/config-2.6.31 b/target/linux/x86/olpc/config-2.6.31 index 03dab2752..1da61fd9d 100644 --- a/target/linux/x86/olpc/config-2.6.31 +++ b/target/linux/x86/olpc/config-2.6.31 @@ -253,7 +253,6 @@ CONFIG_HW_CONSOLE=y CONFIG_HW_RANDOM_GEODE=y CONFIG_HW_RANDOM_VIA=y CONFIG_HW_RANDOM=y -# CONFIG_I2C is not set # CONFIG_I8K is not set # CONFIG_IMA is not set CONFIG_INITRAMFS_SOURCE="" @@ -455,7 +454,6 @@ CONFIG_SERIO=y CONFIG_SLUB_DEBUG=y # CONFIG_SLUB_STATS is not set CONFIG_SLUB=y -# CONFIG_SMP is not set # CONFIG_SPARSE_IRQ is not set CONFIG_SPARSEMEM_STATIC=y CONFIG_STACKTRACE=y From 8307a885978c1ac066e37d469abaedfd1c85bec8 Mon Sep 17 00:00:00 2001 From: kaloz Date: Wed, 11 Nov 2009 13:44:12 +0000 Subject: [PATCH 140/288] powerpc: use the in-kernel dtc compiler git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18374 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ppc40x/image/Makefile | 2 +- target/linux/ppc44x/image/Makefile | 2 +- tools/Makefile | 1 - tools/dtc/Makefile | 33 ------------------------------ 4 files changed, 2 insertions(+), 36 deletions(-) delete mode 100644 tools/dtc/Makefile diff --git a/target/linux/ppc40x/image/Makefile b/target/linux/ppc40x/image/Makefile index e03ffd93c..4544aff4f 100644 --- a/target/linux/ppc40x/image/Makefile +++ b/target/linux/ppc40x/image/Makefile @@ -11,7 +11,7 @@ JFFS2_BLOCKSIZE=128k 64k define Image/Prepare cp $(LINUX_DIR)/arch/powerpc/boot/uImage $(KDIR)/uImage - dtc -O dtb -R 4 -S 0x20000 $(LINUX_DIR)/arch/powerpc/boot/dts/kilauea.dts > $(KDIR)/openwrt-kilauea.dtb + $(LINUX_DIR)/scripts/dtc/dtc -O dtb -R 4 -S 0x20000 $(LINUX_DIR)/arch/powerpc/boot/dts/kilauea.dts > $(KDIR)/openwrt-kilauea.dtb endef define Image/BuildKernel diff --git a/target/linux/ppc44x/image/Makefile b/target/linux/ppc44x/image/Makefile index b8d5e9510..aa6851341 100644 --- a/target/linux/ppc44x/image/Makefile +++ b/target/linux/ppc44x/image/Makefile @@ -11,7 +11,7 @@ JFFS2_BLOCKSIZE=256k define Image/Prepare cp $(LINUX_DIR)/arch/powerpc/boot/cuImage.taishan $(KDIR)/uImage - dtc -O dtb -R 4 -S 0x20000 $(LINUX_DIR)/arch/powerpc/boot/dts/canyonlands.dts > $(KDIR)/openwrt-canyonlands.dtb + $(LINUX_DIR)/scripts/dtc/dtc -O dtb -R 4 -S 0x20000 $(LINUX_DIR)/arch/powerpc/boot/dts/canyonlands.dts > $(KDIR)/openwrt-canyonlands.dtb endef define Image/BuildKernel diff --git a/tools/Makefile b/tools/Makefile index 1456c0d17..6e5eb24cd 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -18,7 +18,6 @@ tools-y += sstrip ipkg-utils genext2fs squashfs squashfs4 mtd-utils lzma-old mki tools-y += firmware-utils patch-cmdline quilt yaffs2 tools-$(CONFIG_CCACHE) += ccache -tools-$(CONFIG_powerpc) += dtc tools-dep += lzma ifdef CONFIG_GCC_VERSION_4_4 diff --git a/tools/dtc/Makefile b/tools/dtc/Makefile deleted file mode 100644 index c686b204d..000000000 --- a/tools/dtc/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# -# Copyright (C) 2008 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=dtc -PKG_VERSION:=1.1.0 - -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz -PKG_SOURCE_URL:=http://www.jdl.com/software -PKG_MD5SUM:=6c84b01f500bc989b0b1ad6138fb93d5 -PKG_CAT:=zcat -HOST_BUILD_DIR=$(BUILD_DIR_HOST)/$(PKG_NAME) - -include $(INCLUDE_DIR)/host-build.mk - -define Host/Compile - $(MAKE) -C $(HOST_BUILD_DIR) -endef - -define Host/Install - $(INSTALL_BIN) $(HOST_BUILD_DIR)/dtc $(STAGING_DIR_HOST)/bin/ -endef - -define Host/Clean - rm -f $(STAGING_DIR_HOST)/bin/dtc -endef - -$(eval $(call HostBuild)) From 0452e1aa54ed02212990db3cfaf8264637c7405f Mon Sep 17 00:00:00 2001 From: kaloz Date: Wed, 11 Nov 2009 14:41:30 +0000 Subject: [PATCH 141/288] [2.6.30] export __cpuc_flush_dcache_page for ARM targets git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18375 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ...5-arm_export___cpu_flush_dcache_page.patch | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 target/linux/generic-2.6/patches-2.6.30/015-arm_export___cpu_flush_dcache_page.patch diff --git a/target/linux/generic-2.6/patches-2.6.30/015-arm_export___cpu_flush_dcache_page.patch b/target/linux/generic-2.6/patches-2.6.30/015-arm_export___cpu_flush_dcache_page.patch new file mode 100644 index 000000000..5b43c87a8 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.30/015-arm_export___cpu_flush_dcache_page.patch @@ -0,0 +1,33 @@ +From ba9b42e4ff5eb68f9c946378229d7e45299d7151 Mon Sep 17 00:00:00 2001 +From: Russell King +Date: Sun, 5 Jul 2009 10:50:37 +0100 +Subject: [PATCH] [ARM] export __cpu_flush_dcache_page + +Now required for libsas: + + Kernel: arch/arm/boot/Image is ready + Kernel: arch/arm/boot/zImage is ready + Building modules, stage 2. + MODPOST 1096 modules +ERROR: "xscale_flush_kern_dcache_page" [drivers/scsi/libsas/libsas.ko] undefined! + +Signed-off-by: Russell King +--- + arch/arm/mm/proc-syms.c | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/arch/arm/mm/proc-syms.c b/arch/arm/mm/proc-syms.c +index 195e48e..ac5c800 100644 +--- a/arch/arm/mm/proc-syms.c ++++ b/arch/arm/mm/proc-syms.c +@@ -27,6 +27,7 @@ EXPORT_SYMBOL(__cpuc_flush_kern_all); + EXPORT_SYMBOL(__cpuc_flush_user_all); + EXPORT_SYMBOL(__cpuc_flush_user_range); + EXPORT_SYMBOL(__cpuc_coherent_kern_range); ++EXPORT_SYMBOL(__cpuc_flush_dcache_page); + EXPORT_SYMBOL(dmac_inv_range); /* because of flush_ioremap_region() */ + #else + EXPORT_SYMBOL(cpu_cache); +-- +1.6.5.1 + From 35dc8491f05d1b3ef7252f2b73fd986cab687630 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 11 Nov 2009 16:30:33 +0000 Subject: [PATCH 142/288] e1000: depend on pci support instead of x86 target - some people have minipci cards with this chipset git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18376 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/kernel/modules/netdevices.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/modules/netdevices.mk b/package/kernel/modules/netdevices.mk index c5d008d9d..4f1f3cbd2 100644 --- a/package/kernel/modules/netdevices.mk +++ b/package/kernel/modules/netdevices.mk @@ -201,7 +201,7 @@ $(eval $(call KernelPackage,e100)) define KernelPackage/e1000 SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Intel(R) PRO/1000 PCI cards kernel support - DEPENDS:=@TARGET_x86 + DEPENDS:=@PCI_SUPPORT KCONFIG:=CONFIG_E1000 \ CONFIG_E1000_DISABLE_PACKET_SPLIT=n FILES:=$(LINUX_DIR)/drivers/net/e1000/e1000.$(LINUX_KMOD_SUFFIX) From 9afd422632c0bbe4d7d7ea324f9410cb67948551 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 11 Nov 2009 16:32:09 +0000 Subject: [PATCH 143/288] mac80211: fix a race condition when bringing up wds sta interfaces on the ap git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18377 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/hostapd/patches/130-wds_ap.patch | 5 +++-- .../patches/520-nl80211_vlan_add_fix.patch | 20 +++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 package/mac80211/patches/520-nl80211_vlan_add_fix.patch diff --git a/package/hostapd/patches/130-wds_ap.patch b/package/hostapd/patches/130-wds_ap.patch index 019257599..4624f88a1 100644 --- a/package/hostapd/patches/130-wds_ap.patch +++ b/package/hostapd/patches/130-wds_ap.patch @@ -126,7 +126,7 @@ return -1; return 0; } -@@ -4310,6 +4312,21 @@ static int i802_set_sta_vlan(void *priv, +@@ -4310,6 +4312,22 @@ static int i802_set_sta_vlan(void *priv, return -ENOBUFS; } @@ -139,6 +139,7 @@ + if (val) { + if (nl80211_create_iface(priv, name, NL80211_IFTYPE_AP_VLAN, NULL, 1) < 0) + return -1; ++ hostapd_set_iface_flags(drv, name, 1); + return i802_set_sta_vlan(priv, addr, name, 0); + } else { + i802_set_sta_vlan(priv, addr, drv->ifname, 0); @@ -148,7 +149,7 @@ static void handle_eapol(int sock, void *eloop_ctx, void *sock_ctx) { -@@ -4536,5 +4553,6 @@ const struct wpa_driver_ops wpa_driver_n +@@ -4536,5 +4554,6 @@ const struct wpa_driver_ops wpa_driver_n .if_update = i802_if_update, .if_remove = i802_if_remove, .set_sta_vlan = i802_set_sta_vlan, diff --git a/package/mac80211/patches/520-nl80211_vlan_add_fix.patch b/package/mac80211/patches/520-nl80211_vlan_add_fix.patch new file mode 100644 index 000000000..e0cdaead1 --- /dev/null +++ b/package/mac80211/patches/520-nl80211_vlan_add_fix.patch @@ -0,0 +1,20 @@ +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -1813,7 +1813,7 @@ static int nl80211_get_station(struct sk + } + + /* +- * Get vlan interface making sure it is on the right wiphy. ++ * Get vlan interface making sure it is running and on the right wiphy. + */ + static int get_vlan(struct genl_info *info, + struct cfg80211_registered_device *rdev, +@@ -1831,6 +1831,8 @@ static int get_vlan(struct genl_info *in + return -EINVAL; + if ((*vlan)->ieee80211_ptr->wiphy != &rdev->wiphy) + return -EINVAL; ++ if (!netif_running(*vlan)) ++ return -ENETDOWN; + } + return 0; + } From 26b8a4b21ca223a20d024568611c02847feaaefc Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 11 Nov 2009 16:59:31 +0000 Subject: [PATCH 144/288] wireless-tools: re-enable support for enabling/disabling powersave git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18378 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches/003-we_essential_def.patch | 26 +------------------ 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/package/wireless-tools/patches/003-we_essential_def.patch b/package/wireless-tools/patches/003-we_essential_def.patch index 6b28099aa..15c41e97f 100644 --- a/package/wireless-tools/patches/003-we_essential_def.patch +++ b/package/wireless-tools/patches/003-we_essential_def.patch @@ -103,22 +103,6 @@ /* Display encryption information */ /* Note : we display only the "current" key, use iwlist to list all keys */ -@@ -995,6 +995,7 @@ set_enc_info(int skfd, - return(i); - } - -+#ifndef WE_ESSENTIAL - /*------------------------------------------------------------------*/ - /* - * Set Power Management -@@ -1111,7 +1112,6 @@ set_power_info(int skfd, - return(i); - } - --#ifndef WE_ESSENTIAL - /*------------------------------------------------------------------*/ - /* - * Set Nickname @@ -1196,6 +1196,7 @@ set_nwid_info(int skfd, /* 1 arg */ return(1); @@ -151,15 +135,7 @@ /*------------------------------------------------------------------*/ /* * Set Modulation -@@ -1712,28 +1716,28 @@ static const struct iwconfig_entry iwcon - "Set Encode", "{NNNN-NNNN|off}" }, - { "key", set_enc_info, 1, SIOCSIWENCODE, - "Set Encode", "{NNNN-NNNN|off}" }, -+#ifndef WE_ESSENTIAL - { "power", set_power_info, 1, SIOCSIWPOWER, - "Set Power Management", "{period N|timeout N|saving N|off}" }, --#ifndef WE_ESSENTIAL - { "nickname", set_nick_info, 1, SIOCSIWNICKN, +@@ -1719,21 +1723,21 @@ static const struct iwconfig_entry iwcon "Set Nickname", "NNN" }, { "nwid", set_nwid_info, 1, SIOCSIWNWID, "Set NWID", "{NN|on|off}" }, From b87aea7e75784c62f709efe669098bb0b6ae6ffe Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 11 Nov 2009 16:59:36 +0000 Subject: [PATCH 145/288] mac80211: disable powersave on the sta by default (for performance reasons) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18379 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/files/lib/wifi/mac80211.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/mac80211/files/lib/wifi/mac80211.sh b/package/mac80211/files/lib/wifi/mac80211.sh index 027749e57..00a81393d 100644 --- a/package/mac80211/files/lib/wifi/mac80211.sh +++ b/package/mac80211/files/lib/wifi/mac80211.sh @@ -127,6 +127,9 @@ enable_mac80211() { local wdsflag [ "$wds" -gt 0 ] && wdsflag="wds on" iw phy "$phy" interface add "$ifname" type managed $wdsflag + config_get_bool powersave "$vif" powersave 0 + [ "$powersave" -gt 0 ] && powersave="on" || powersave="off" + iwconfig "$ifname" power "$powersave" ;; esac From 22d62275051ab60ec6bd275452331e5bf373facd Mon Sep 17 00:00:00 2001 From: jow Date: Wed, 11 Nov 2009 21:42:05 +0000 Subject: [PATCH 146/288] [package] opkg: bump to r284 - incorporates parsing improvements upstream - fixes a couple of memory leaks - fixes some null pointer dereferences - fixes possible crashes during removal of packages - various other corrections git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18380 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/opkg/Makefile | 4 +- .../opkg/patches/001-fix-double-parsing.patch | 12 - .../opkg/patches/003-fs_overlay_support.patch | 8 +- package/opkg/patches/004-host_cpu.patch | 4 +- .../opkg/patches/005-uninitialized_err.patch | 2 +- package/opkg/patches/007-force_static.patch | 19 +- .../patches/008-fix_parsing_insanity.patch | 931 ------------------ .../opkg/patches/009-remove-upgrade-all.patch | 8 +- package/opkg/patches/010-remove-flag.patch | 8 +- 9 files changed, 27 insertions(+), 969 deletions(-) delete mode 100644 package/opkg/patches/001-fix-double-parsing.patch delete mode 100644 package/opkg/patches/008-fix_parsing_insanity.patch diff --git a/package/opkg/Makefile b/package/opkg/Makefile index 9b67e3982..9c87e482c 100644 --- a/package/opkg/Makefile +++ b/package/opkg/Makefile @@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=opkg -PKG_REV:=215 +PKG_REV:=284 PKG_VERSION:=$(PKG_REV) -PKG_RELEASE:=3 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=svn PKG_SOURCE_VERSION:=$(PKG_REV) diff --git a/package/opkg/patches/001-fix-double-parsing.patch b/package/opkg/patches/001-fix-double-parsing.patch deleted file mode 100644 index a36ffa48c..000000000 --- a/package/opkg/patches/001-fix-double-parsing.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/libopkg/args.c -+++ b/libopkg/args.c -@@ -62,7 +62,7 @@ - if (conf_file_dir == NULL || conf_file_dir[0] == '\0') { - conf_file_dir = ARGS_DEFAULT_CONF_FILE_DIR; - } -- sprintf_alloc(&args->conf_file, "%s/%s", conf_file_dir, -+ sprintf_alloc(&args->conf_file, "%s/%s", OPKGETCDIR, - ARGS_DEFAULT_CONF_FILE_NAME); - - args->force_defaults = ARGS_DEFAULT_FORCE_DEFAULTS; - diff --git a/package/opkg/patches/003-fs_overlay_support.patch b/package/opkg/patches/003-fs_overlay_support.patch index 88a09d0a6..f84060ab1 100644 --- a/package/opkg/patches/003-fs_overlay_support.patch +++ b/package/opkg/patches/003-fs_overlay_support.patch @@ -6,7 +6,7 @@ Signed-off-by: Nicolas Thill --- a/libopkg/opkg_conf.c +++ b/libopkg/opkg_conf.c -@@ -70,6 +70,7 @@ int opkg_init_options_array(const opkg_c +@@ -72,6 +72,7 @@ { "offline_root_path", OPKG_OPT_TYPE_STRING, &conf->offline_root_path }, { "offline_root_post_script_cmd", OPKG_OPT_TYPE_STRING, &conf->offline_root_post_script_cmd }, { "offline_root_pre_script_cmd", OPKG_OPT_TYPE_STRING, &conf->offline_root_pre_script_cmd }, @@ -16,7 +16,7 @@ Signed-off-by: Nicolas Thill { "query-all", OPKG_OPT_TYPE_BOOL, &conf->query_all }, --- a/libopkg/opkg_conf.h +++ b/libopkg/opkg_conf.h -@@ -70,6 +70,7 @@ struct opkg_conf +@@ -70,6 +70,7 @@ char *offline_root_path; char *offline_root_pre_script_cmd; char *offline_root_post_script_cmd; @@ -26,7 +26,7 @@ Signed-off-by: Nicolas Thill int noaction; --- a/libopkg/opkg_install.c +++ b/libopkg/opkg_install.c -@@ -474,12 +474,15 @@ static int verify_pkg_installable(opkg_c +@@ -470,12 +470,15 @@ * my diddling with the .opk file size below isn't going to cut it. * 3) return a proper error code instead of 1 */ @@ -46,7 +46,7 @@ Signed-off-by: Nicolas Thill /* round up a blocks count without doing fancy-but-slow casting jazz */ --- a/libopkg/opkg_utils.c +++ b/libopkg/opkg_utils.c -@@ -30,10 +30,8 @@ long unsigned int get_available_blocks(c +@@ -31,10 +31,8 @@ { struct statfs sfs; diff --git a/package/opkg/patches/004-host_cpu.patch b/package/opkg/patches/004-host_cpu.patch index be4101eb8..ad1c74c58 100644 --- a/package/opkg/patches/004-host_cpu.patch +++ b/package/opkg/patches/004-host_cpu.patch @@ -12,9 +12,9 @@ +++ b/libopkg/Makefile.am @@ -1,5 +1,5 @@ - --AM_CFLAGS=-Wall -Werror -DHOST_CPU_STR=\"@host_cpu@\" -DBUILD_CPU=@build_cpu@ -DLIBDIR=\"@libdir@\" -DOPKGLIBDIR=\"@opkglibdir@\" -DOPKGETCDIR=\"@opkgetcdir@\" -DDATADIR=\"@datadir@\" -I$(top_srcdir) $(BIGENDIAN_CFLAGS) $(CURL_CFLAGS) $(GPGME_CFLAGS) +-AM_CFLAGS=-Wall -Werror -DHOST_CPU_STR=\"@host_cpu@\" -DBUILD_CPU=@build_cpu@ -DLIBDIR=\"@libdir@\" -DOPKGLIBDIR=\"@opkglibdir@\" -DOPKGETCDIR=\"@opkgetcdir@\" -DDATADIR=\"@datadir@\" -I$(top_srcdir) $(BIGENDIAN_CFLAGS) $(CURL_CFLAGS) $(GPGME_CFLAGS) $(PATHFINDER_CFLAGS) +HOST_CPU=@host_cpu@ -+AM_CFLAGS=-Wall -Werror -DHOST_CPU_STR=\"$(HOST_CPU)\" -DBUILD_CPU=@build_cpu@ -DLIBDIR=\"@libdir@\" -DOPKGLIBDIR=\"@opkglibdir@\" -DOPKGETCDIR=\"@opkgetcdir@\" -DDATADIR=\"@datadir@\" -I$(top_srcdir) $(BIGENDIAN_CFLAGS) $(CURL_CFLAGS) $(GPGME_CFLAGS) ++AM_CFLAGS=-Wall -Werror -DHOST_CPU_STR=\"$(HOST_CPU)\" -DBUILD_CPU=@build_cpu@ -DLIBDIR=\"@libdir@\" -DOPKGLIBDIR=\"@opkglibdir@\" -DOPKGETCDIR=\"@opkgetcdir@\" -DDATADIR=\"@datadir@\" -I$(top_srcdir) $(BIGENDIAN_CFLAGS) $(CURL_CFLAGS) $(GPGME_CFLAGS) $(PATHFINDER_CFLAGS) libopkg_includedir=$(includedir)/libopkg libopkg_include_HEADERS= opkg.h diff --git a/package/opkg/patches/005-uninitialized_err.patch b/package/opkg/patches/005-uninitialized_err.patch index 7cf769a32..0d3b6cf24 100644 --- a/package/opkg/patches/005-uninitialized_err.patch +++ b/package/opkg/patches/005-uninitialized_err.patch @@ -1,6 +1,6 @@ --- a/libopkg/pkg_hash.c +++ b/libopkg/pkg_hash.c -@@ -363,8 +363,11 @@ pkg_t *pkg_hash_fetch_best_installation_ +@@ -384,8 +384,11 @@ abstract_pkg_t *apkg = NULL; pkg_t *ret; diff --git a/package/opkg/patches/007-force_static.patch b/package/opkg/patches/007-force_static.patch index b433eed05..632250863 100644 --- a/package/opkg/patches/007-force_static.patch +++ b/package/opkg/patches/007-force_static.patch @@ -1,8 +1,8 @@ --- a/libopkg/Makefile.am +++ b/libopkg/Makefile.am -@@ -30,15 +30,10 @@ opkg_util_sources = file_util.c file_uti - sprintf_alloc.c sprintf_alloc.h str_util.c str_util.h \ - xregex.c xregex.h xsystem.c xsystem.h +@@ -36,16 +36,10 @@ + opkg_util_sources += sha256.c sha256.h + endif -lib_LTLIBRARIES = libopkg.la -libopkg_la_SOURCES = \ @@ -12,16 +12,17 @@ $(opkg_cmd_sources) $(opkg_db_sources) \ $(opkg_util_sources) $(opkg_list_sources) --libopkg_la_LIBADD = $(top_builddir)/libbb/libbb.la $(CURL_LIBS) $(GPGME_LIBS) +-libopkg_la_LIBADD = $(top_builddir)/libbb/libbb.la $(CURL_LIBS) $(GPGME_LIBS) $(OPENSSL_LIBS) $(PATHFINDER_LIBS) +- -# make sure we only export symbols that are for public use -libopkg_la_LDFLAGS = -export-symbols-regex "^opkg_.*" - - - -+libopkg_a_LIBADD = $(top_builddir)/libbb/libbb.a $(CURL_LIBS) $(GPGME_LIBS) ++libopkg_a_LIBADD = $(top_builddir)/libbb/libbb.a $(CURL_LIBS) $(GPGME_LIBS) $(OPENSSL_LIBS) $(PATHFINDER_LIBS) --- a/libbb/Makefile.am +++ b/libbb/Makefile.am -@@ -2,9 +2,9 @@ HOST_CPU=@host_cpu@ +@@ -2,9 +2,9 @@ BUILD_CPU=@build_cpu@ ALL_CFLAGS=-g -O -Wall -DHOST_CPU_STR=\"$(HOST_CPU)\" -DBUILD_CPU=@build_cpu@ @@ -35,17 +36,17 @@ wfopen.c \ --- a/src/Makefile.am +++ b/src/Makefile.am -@@ -2,5 +2,5 @@ AM_CFLAGS = -I${top_srcdir}/libopkg ${AL +@@ -2,5 +2,5 @@ bin_PROGRAMS = opkg-cl opkg_cl_SOURCES = opkg-frontend.c -opkg_cl_LDADD = $(top_builddir)/libopkg/libopkg.la \ - $(top_builddir)/libbb/libbb.la +opkg_cl_LDADD = $(top_builddir)/libopkg/libopkg.a \ -+ $(top_builddir)/libbb/libbb.a ++ $(top_builddir)/libbb/libbb.a --- a/tests/Makefile.am +++ b/tests/Makefile.am -@@ -16,7 +16,7 @@ noinst_PROGRAMS = libopkg_test +@@ -16,7 +16,7 @@ #opkg_active_list_test_SOURCES = opkg_active_list_test.c #opkg_active_list_test_CFLAGS = $(ALL_CFLAGS) -I$(top_srcdir) diff --git a/package/opkg/patches/008-fix_parsing_insanity.patch b/package/opkg/patches/008-fix_parsing_insanity.patch deleted file mode 100644 index 5e5c0085f..000000000 --- a/package/opkg/patches/008-fix_parsing_insanity.patch +++ /dev/null @@ -1,931 +0,0 @@ ---- a/libopkg/opkg_utils.c -+++ b/libopkg/opkg_utils.c -@@ -44,58 +44,6 @@ - return 0; - } - --char **read_raw_pkgs_from_file(const char *file_name) --{ -- FILE *fp; -- char **ret; -- -- if(!(fp = fopen(file_name, "r"))){ -- fprintf(stderr, "can't get %s open for read\n", file_name); -- return NULL; -- } -- -- ret = read_raw_pkgs_from_stream(fp); -- -- fclose(fp); -- -- return ret; --} -- --char **read_raw_pkgs_from_stream(FILE *fp) --{ -- char **raw = NULL, *buf, *scout; -- int count = 0; -- size_t size = 512; -- -- buf = calloc (1, size); -- -- while (fgets(buf, size, fp)) { -- while (strlen (buf) == (size - 1) -- && buf[size-2] != '\n') { -- size_t o = size - 1; -- size *= 2; -- buf = realloc (buf, size); -- if (fgets (buf + o, size - o, fp) == NULL) -- break; -- } -- -- if(!(count % 50)) -- raw = realloc(raw, (count + 50) * sizeof(char *)); -- -- if((scout = strchr(buf, '\n'))) -- *scout = '\0'; -- -- raw[count++] = strdup(buf); -- } -- -- raw = realloc(raw, (count + 1) * sizeof(char *)); -- raw[count] = NULL; -- -- free (buf); -- -- return raw; --} -- - /* something to remove whitespace, a hash pooper */ - char *trim_alloc(char *line) - { ---- a/libopkg/pkg.c -+++ b/libopkg/pkg.c -@@ -20,6 +20,8 @@ - #include - #include - #include -+#include -+#include - #include - - #include "pkg.h" -@@ -277,7 +279,6 @@ - int pkg_init_from_file(pkg_t *pkg, const char *filename) - { - int err; -- char **raw; - FILE *control_file; - - err = pkg_init(pkg); -@@ -290,8 +291,7 @@ - if (err) { return err; } - - rewind(control_file); -- raw = read_raw_pkgs_from_stream(control_file); -- pkg_parse_raw(pkg, &raw, NULL, NULL); -+ pkg_parse_fd(pkg, fileno(control_file), NULL, NULL, 0); - - fclose(control_file); - -@@ -459,8 +459,7 @@ - - void set_flags_from_control(opkg_conf_t *conf, pkg_t *pkg){ - char * temp_str; -- char **raw =NULL; -- char **raw_start=NULL; -+ int fd; - - size_t str_size = strlen(pkg->dest->info_dir)+strlen(pkg->name)+12; - temp_str = (char *) alloca (str_size); -@@ -471,28 +470,23 @@ - return; - } - sprintf( temp_str,"%s/%s.control",pkg->dest->info_dir,pkg->name); -- -- raw = raw_start = read_raw_pkgs_from_file(temp_str); -- if (raw == NULL ){ -- opkg_message(conf, OPKG_ERROR, "Unable to open the control file in %s\n", __FUNCTION__); -- return; -- } - -- while(*raw){ -- if (!pkg_valorize_other_field(pkg, &raw ) == 0) { -- opkg_message(conf, OPKG_DEBUG, "unable to read control file for %s. May be empty\n", pkg->name); -- } -- } -- raw = raw_start; -- while (*raw) { -- if (raw!=NULL) -- free(*raw++); -- } -+ if( (fd = open(temp_str, O_RDONLY)) > 0 ) -+ { -+ if( pkg_valorize_other_field(pkg, fd) ) -+ { -+ opkg_message(conf, OPKG_DEBUG, "unable to read control file for %s. May be empty\n", pkg->name); -+ } - -- free(raw_start); -+ close(fd); -+ } -+ else -+ { -+ opkg_message(conf, OPKG_ERROR, "Unable to open the control file in %s\n", __FUNCTION__); -+ return; -+ } - - return ; -- - } - - #define CHECK_BUFF_SIZE(buff, line, buf_size, page_size) do { \ ---- a/libopkg/pkg_hash.c -+++ b/libopkg/pkg_hash.c -@@ -20,6 +20,8 @@ - #include - #include - #include -+#include -+#include - - #include "hash_table.h" - #include "pkg.h" -@@ -110,45 +112,52 @@ - } - - int pkg_hash_add_from_file(opkg_conf_t *conf, const char *file_name, -- pkg_src_t *src, pkg_dest_t *dest, int is_status_file) -+ pkg_src_t *src, pkg_dest_t *dest, int is_status_file, int no_desc) - { -- hash_table_t *hash = &conf->pkg_hash; -- char **raw; -- char **raw_start; -- pkg_t *pkg; -- -- raw = raw_start = read_raw_pkgs_from_file(file_name); -- if (!raw) -- return -ENOMEM; -- -- while(*raw){ /* don't worry, we'll increment raw in the parsing function */ -- pkg = pkg_new(); -- if (!pkg) -- return -ENOMEM; -- -- if (pkg_parse_raw(pkg, &raw, src, dest) == 0) { -- if (!pkg->architecture) { -- char *version_str = pkg_version_str_alloc(pkg); -- pkg->architecture = pkg_get_default_arch(conf); -- opkg_message(conf, OPKG_ERROR, "Package %s version %s has no architecture specified, defaulting to %s.\n", -- pkg->name, version_str, pkg->architecture); -- free(version_str); -- } -- hash_insert_pkg(hash, pkg, is_status_file,conf); -- } else { -- pkg_deinit (pkg); -- free(pkg); -- } -- } -+ hash_table_t *hash = &conf->pkg_hash; -+ pkg_t *pkg; - -- /* XXX: CLEANUP: I'd like a cleaner interface for cleaning up -- memory after read_raw_pkgs_from_file */ -- raw = raw_start; -- while (*raw) { -- free(*raw++); -- } -- free(raw_start); -- return 0; -+ int fd; -+ int rv = 0; -+ -+ if( (fd = open(file_name, O_RDONLY)) > 0 ) -+ { -+ while(1) -+ { -+ pkg = pkg_new(); -+ if(!pkg) { -+ rv = -ENOMEM; -+ break; -+ } -+ -+ if (pkg_parse_fd(pkg, fd, src, dest, no_desc) == 0) { -+ if (!pkg->architecture) { -+ char *version_str = pkg_version_str_alloc(pkg); -+ pkg->architecture = pkg_get_default_arch(conf); -+ opkg_message(conf, OPKG_ERROR, "Package %s version %s has no architecture specified, defaulting to %s.\n", -+ pkg->name, version_str, pkg->architecture); -+ free(version_str); -+ } -+ -+ hash_insert_pkg(hash, pkg, is_status_file, conf); -+ } else { -+ pkg_deinit (pkg); -+ free(pkg); -+ break; -+ } -+ } -+ -+ close(fd); -+ } -+ else -+ { -+ opkg_message (conf, OPKG_ERROR, -+ "Unable to open package list %s\n", file_name); -+ -+ rv = -EINVAL; -+ } -+ -+ return rv; - } - - abstract_pkg_t * abstract_pkg_fetch_by_name(hash_table_t * hash, const char * pkg_name) ---- a/libopkg/pkg_parse.c -+++ b/libopkg/pkg_parse.c -@@ -191,214 +191,301 @@ - - } - --/* Some random thoughts from Carl: -- -- This function could be considerably simplified if we just kept -- an array of all the generic string-valued field names, and looped -- through those looking for a match. Also, these fields could perhaps -- be stored in the package as an array as well, (or, probably better, -- as an nv_pair_list_t). -- -- Fields which require special parsing or storage, (such as Depends: -- and Status:) could be handled as they are now. --*/ --/* XXX: FEATURE: The Suggests: field needs to be changed from a string -- to a dependency list. And, since we already have -- Depends/Pre-Depends and need to add Conflicts, Recommends, and -- Enhances, perhaps we could generalize all of these and save some -- code duplication. --*/ --int pkg_parse_raw(pkg_t *pkg, char ***raw, pkg_src_t *src, pkg_dest_t *dest) -+int pkg_parse_fd(pkg_t *pkg, int fd, pkg_src_t *src, pkg_dest_t *dest, int no_desc) - { -- int reading_conffiles, reading_description; -- int pkg_false_provides=1; -- char ** lines; -- char * provide=NULL; -- -- pkg->src = src; -- pkg->dest = dest; -- -- reading_conffiles = reading_description = 0; -- -- for (lines = *raw; *lines; lines++) { -- /* fprintf(stderr, "PARSING %s\n", *lines);*/ -- switch (**lines) { -- case 'P': -- if(isGenericFieldType("Package:", *lines)) -- pkg->name = parseGenericFieldType("Package", *lines); -- else if(isGenericFieldType("Priority:", *lines)) -- pkg->priority = parseGenericFieldType("Priority", *lines); -- else if(isGenericFieldType("Provides", *lines)){ --/* Here we add the internal_use to align the off by one problem between provides_str and provides */ -- provide = (char * ) calloc(1, strlen(*lines)+ 35 ); /* Preparing the space for the new opkg_internal_use_only */ -- if ( alterProvidesLine(*lines,provide) ){ -- return EINVAL; -- } -- pkg->provides_str = parseDependsString( provide, &pkg->provides_count); --/* Let's try to hack a bit here. -- The idea is that if a package has no Provides, we would add one generic, to permit the check of dependencies -- in alot of other places. We will remove it before writing down the status database */ -- pkg_false_provides=0; -- free(provide); -- } -- else if(isGenericFieldType("Pre-Depends", *lines)) -- pkg->pre_depends_str = parseDependsString(*lines, &pkg->pre_depends_count); -- break; -- -- case 'A': -- if(isGenericFieldType("Architecture:", *lines)) -- pkg->architecture = parseGenericFieldType("Architecture", *lines); -- else if(isGenericFieldType("Auto-Installed:", *lines)) { -- char *auto_installed_value; -- auto_installed_value = parseGenericFieldType("Auto-Installed:", *lines); -- if (strcmp(auto_installed_value, "yes") == 0) { -- pkg->auto_installed = 1; -- } -- free(auto_installed_value); -- } -- break; -- -- case 'F': -- if(isGenericFieldType("Filename:", *lines)) -- pkg->filename = parseGenericFieldType("Filename", *lines); -- break; -- -- case 'S': -- if(isGenericFieldType("Section:", *lines)) -- pkg->section = parseGenericFieldType("Section", *lines); -- else if(isGenericFieldType("Size:", *lines)) -- pkg->size = parseGenericFieldType("Size", *lines); -- else if(isGenericFieldType("Source:", *lines)) -- pkg->source = parseGenericFieldType("Source", *lines); -- else if(isGenericFieldType("Status", *lines)) -- parseStatus(pkg, *lines); -- else if(isGenericFieldType("Suggests", *lines)) -- pkg->suggests_str = parseDependsString(*lines, &pkg->suggests_count); -- break; -- -- case 'T': -- if(isGenericFieldType("Tags:", *lines)) -- pkg->tags = parseGenericFieldType("Tags", *lines); -- break; -- -- case 'M': -- if(isGenericFieldType("MD5sum:", *lines)) -- pkg->md5sum = parseGenericFieldType("MD5sum", *lines); -- /* The old opkg wrote out status files with the wrong case for MD5sum, -- let's parse it either way */ -- else if(isGenericFieldType("MD5Sum:", *lines)) -- pkg->md5sum = parseGenericFieldType("MD5Sum", *lines); -- else if(isGenericFieldType("Maintainer", *lines)) -- pkg->maintainer = parseGenericFieldType("Maintainer", *lines); -- break; -- -- case 'I': -- if(isGenericFieldType("Installed-Size:", *lines)) -- pkg->installed_size = parseGenericFieldType("Installed-Size", *lines); -- else if(isGenericFieldType("Installed-Time:", *lines)) { -- char *time_str = parseGenericFieldType("Installed-Time", *lines); -- pkg->installed_time = strtoul(time_str, NULL, 0); -- free (time_str); -- } -- break; -- -- case 'E': -- if(isGenericFieldType("Essential:", *lines)) { -- char *essential_value; -- essential_value = parseGenericFieldType("Essential", *lines); -- if (strcmp(essential_value, "yes") == 0) { -- pkg->essential = 1; -- } -- free(essential_value); -- } -- break; -- -- case 'V': -- if(isGenericFieldType("Version", *lines)) -- parseVersion(pkg, *lines); -- break; -- -- case 'C': -- if(isGenericFieldType("Conffiles", *lines)){ -- parseConffiles(pkg, *lines); -- reading_conffiles = 1; -- } -- else if(isGenericFieldType("Conflicts", *lines)) -- pkg->conflicts_str = parseDependsString(*lines, &pkg->conflicts_count); -- break; -- -- case 'D': -- if(isGenericFieldType("Description", *lines)) { -- pkg->description = parseGenericFieldType("Description", *lines); -- reading_conffiles = 0; -- reading_description = 1; -- } -- else if(isGenericFieldType("Depends", *lines)) -- pkg->depends_str = parseDependsString(*lines, &pkg->depends_count); -- break; -- -- case 'R': -- if(isGenericFieldType("Recommends", *lines)) -- pkg->recommends_str = parseDependsString(*lines, &pkg->recommends_count); -- else if(isGenericFieldType("Replaces", *lines)) -- pkg->replaces_str = parseDependsString(*lines, &pkg->replaces_count); -- -- break; -- -- case ' ': -- if(reading_description) { -- /* we already know it's not blank, so the rest of description */ -- pkg->description = realloc(pkg->description, -- strlen(pkg->description) -- + 1 + strlen(*lines) + 1); -- strcat(pkg->description, "\n"); -- strcat(pkg->description, (*lines)); -- } -- else if(reading_conffiles) -- parseConffiles(pkg, *lines); -- -- break; -- -- default: -- if(line_is_blank(*lines)) { -- lines++; -- goto out; -- } -+ char buf[4096]; -+ char line[4096]; -+ char *nl; -+ int bsz = 0; -+ int eof = 0; -+ int rv = EINVAL; -+ -+ int reading_conffiles, reading_description; -+ int pkg_false_provides=1; -+ char *provide = NULL; -+ -+ pkg->src = src; -+ pkg->dest = dest; -+ -+ reading_conffiles = reading_description = 0; -+ -+ memset(buf, 0, sizeof(buf)); -+ -+ while(!eof || (bsz > 0)) -+ { -+ if(!eof) -+ { -+ rv = read(fd, &buf[bsz], sizeof(buf) - bsz - 1); -+ -+ if( rv == 0 ) -+ { -+ eof = 1; -+ -+ if( bsz == 0 ) -+ { -+ rv = EINVAL; -+ break; -+ } -+ } -+ else if( rv < 0 ) -+ { -+ /*opkg_message(conf, OPKG_ERROR, "I/O error while parsing package list\n");*/ -+ printf("I/O error while parsing package list\n"); -+ rv = EINVAL; -+ break; -+ } -+ else -+ { -+ bsz += rv; -+ buf[bsz] = 0; -+ rv = 0; -+ } -+ } -+ -+ if( (nl = strchr(buf, '\n')) != NULL ) -+ { -+ bsz -= (int)(nl - buf) + 1; -+ -+ memset(line, 0, sizeof(line)); -+ memcpy(line, buf, (int)(nl - buf)); -+ memmove(buf, &buf[(int)(nl - buf) + 1], bsz); -+ -+ switch(line[0]) -+ { -+ case 'P': -+ if(isGenericFieldType("Package:", line)) -+ pkg->name = parseGenericFieldType("Package", line); -+ else if(isGenericFieldType("Priority:", line)) -+ pkg->priority = parseGenericFieldType("Priority", line); -+ else if(isGenericFieldType("Provides", line)){ -+ /* Here we add the internal_use to align the off by one problem between provides_str and provides */ -+ provide = (char * ) calloc(1, strlen(line)+ 35 ); /* Preparing the space for the new opkg_internal_use_only */ -+ if ( alterProvidesLine(line,provide) ){ -+ rv = EINVAL; -+ break; -+ } -+ pkg->provides_str = parseDependsString( provide, &pkg->provides_count); -+ /* Let's try to hack a bit here. -+ The idea is that if a package has no Provides, we would add one generic, to permit the check of dependencies -+ in alot of other places. We will remove it before writing down the status database */ -+ pkg_false_provides=0; -+ free(provide); -+ } -+ else if(isGenericFieldType("Pre-Depends", line)) -+ pkg->pre_depends_str = parseDependsString(line, &pkg->pre_depends_count); -+ break; -+ -+ case 'A': -+ if(isGenericFieldType("Architecture:", line)) -+ pkg->architecture = parseGenericFieldType("Architecture", line); -+ else if(isGenericFieldType("Auto-Installed:", line)) { -+ char *auto_installed_value; -+ auto_installed_value = parseGenericFieldType("Auto-Installed:", line); -+ if (strcmp(auto_installed_value, "yes") == 0) { -+ pkg->auto_installed = 1; -+ } -+ free(auto_installed_value); -+ } -+ break; -+ -+ case 'F': -+ if(isGenericFieldType("Filename:", line)) -+ pkg->filename = parseGenericFieldType("Filename", line); -+ break; -+ -+ case 'S': -+ if(isGenericFieldType("Section:", line) && !no_desc) -+ pkg->section = parseGenericFieldType("Section", line); -+ else if(isGenericFieldType("Size:", line)) -+ pkg->size = parseGenericFieldType("Size", line); -+ else if(isGenericFieldType("Source:", line) && !no_desc) -+ pkg->source = parseGenericFieldType("Source", line); -+ else if(isGenericFieldType("Status", line)) -+ parseStatus(pkg, line); -+ else if(isGenericFieldType("Suggests", line)) -+ pkg->suggests_str = parseDependsString(line, &pkg->suggests_count); -+ break; -+ -+ case 'T': -+ if(isGenericFieldType("Tags:", line)) -+ pkg->tags = parseGenericFieldType("Tags", line); -+ break; -+ -+ case 'M': -+ if(isGenericFieldType("MD5sum:", line)) -+ pkg->md5sum = parseGenericFieldType("MD5sum", line); -+ /* The old opkg wrote out status files with the wrong case for MD5sum, -+ let's parse it either way */ -+ else if(isGenericFieldType("MD5Sum:", line)) -+ pkg->md5sum = parseGenericFieldType("MD5Sum", line); -+ else if(isGenericFieldType("Maintainer", line) && !no_desc) -+ pkg->maintainer = parseGenericFieldType("Maintainer", line); -+ break; -+ -+ case 'I': -+ if(isGenericFieldType("Installed-Size:", line)) -+ pkg->installed_size = parseGenericFieldType("Installed-Size", line); -+ else if(isGenericFieldType("Installed-Time:", line)) { -+ char *time_str = parseGenericFieldType("Installed-Time", line); -+ pkg->installed_time = strtoul(time_str, NULL, 0); -+ free (time_str); -+ } -+ break; -+ -+ case 'E': -+ if(isGenericFieldType("Essential:", line)) { -+ char *essential_value; -+ essential_value = parseGenericFieldType("Essential", line); -+ if (strcmp(essential_value, "yes") == 0) { -+ pkg->essential = 1; -+ } -+ free(essential_value); -+ } -+ break; -+ -+ case 'V': -+ if(isGenericFieldType("Version", line)) -+ parseVersion(pkg, line); -+ break; -+ -+ case 'C': -+ if(isGenericFieldType("Conffiles", line)){ -+ parseConffiles(pkg, line); -+ reading_conffiles = 1; -+ } -+ else if(isGenericFieldType("Conflicts", line)) -+ pkg->conflicts_str = parseDependsString(line, &pkg->conflicts_count); -+ break; -+ -+ case 'D': -+ if(isGenericFieldType("Description", line)) { -+ if(!no_desc) -+ pkg->description = parseGenericFieldType("Description", line); -+ reading_conffiles = 0; -+ reading_description = 1; -+ } -+ else if(isGenericFieldType("Depends", line)) -+ pkg->depends_str = parseDependsString(line, &pkg->depends_count); -+ break; -+ -+ case 'R': -+ if(isGenericFieldType("Recommends", line)) -+ pkg->recommends_str = parseDependsString(line, &pkg->recommends_count); -+ else if(isGenericFieldType("Replaces", line)) -+ pkg->replaces_str = parseDependsString(line, &pkg->replaces_count); -+ break; -+ -+ case ' ': -+ if(reading_description) { -+ /* we already know it's not blank, so the rest of description */ -+ if(!no_desc) -+ { -+ pkg->description = realloc(pkg->description, -+ strlen(pkg->description) + 1 + strlen(line) + 1); -+ strcat(pkg->description, "\n"); -+ strcat(pkg->description, (line)); -+ } -+ } -+ else if(reading_conffiles) -+ parseConffiles(pkg, line); -+ break; -+ -+ default: -+ if(line_is_blank(line)) -+ goto out; -+ } -+ } -+ else -+ { -+ /*opkg_message(conf, OPKG_ERROR, "Buffer exceeded while parsing line:\n[%s]\n", buf);*/ -+ printf("Buffer exceeded while parsing line:\n[%s]\n", buf); -+ rv = EINVAL; -+ break; -+ } - } -- } --out:; -- -- *raw = lines; --/* If the opk has not a Provides line, we insert our false line */ -- if ( pkg_false_provides==1) -- { -- pkg->provides_count = 1; -- pkg->provides_str = calloc (1, sizeof (char*)); -- pkg->provides_str[0] = strdup ("opkg_internal_use_only"); -- } -- -- if (pkg->name) { -- return 0; -- } else { -- return EINVAL; -- } -+ -+ out: -+ -+ if (bsz) -+ lseek(fd, -(off_t)bsz, SEEK_CUR); -+ -+ if (!rv && pkg->name) -+ return 0; -+ else -+ return EINVAL; - } - --int pkg_valorize_other_field(pkg_t *pkg, char ***raw) -+int pkg_valorize_other_field(pkg_t *pkg, int fd) - { -- char ** lines; -+ char buf[4096]; -+ char line[4096]; -+ char *nl; -+ int bsz = 0; -+ int eof = 0; -+ int rv = EINVAL; -+ -+ memset(buf, 0, sizeof(buf)); -+ -+ while(!eof || (bsz > 0)) -+ { -+ if(!eof) -+ { -+ rv = read(fd, &buf[bsz], sizeof(buf) - bsz - 1); -+ -+ if( rv == 0 ) -+ { -+ eof = 1; -+ -+ if( bsz == 0 ) -+ { -+ rv = EINVAL; -+ break; -+ } -+ } -+ else if( rv < 0 ) -+ { -+ rv = EINVAL; -+ break; -+ } -+ else -+ { -+ bsz += rv; -+ buf[bsz] = 0; -+ rv = 0; -+ } -+ } - -- for (lines = *raw; *lines; lines++) { -- if(isGenericFieldType("Essential:", *lines)) { -- char *essential_value; -- essential_value = parseGenericFieldType("Essential", *lines); -- if (strcmp(essential_value, "yes") == 0) { -- pkg->essential = 1; -- } -- free(essential_value); -+ if( (nl = strchr(buf, '\n')) != NULL ) -+ { -+ bsz -= (int)(nl - buf) + 1; -+ -+ memset(line, 0, sizeof(line)); -+ memcpy(line, buf, (int)(nl - buf)); -+ memmove(buf, &buf[(int)(nl - buf) + 1], bsz); -+ -+ if(isGenericFieldType("Essential:", line)) -+ { -+ char *essential_value; -+ essential_value = parseGenericFieldType("Essential", line); -+ if (strcmp(essential_value, "yes") == 0) { -+ pkg->essential = 1; -+ } -+ free(essential_value); -+ } -+ } -+ else -+ { -+ rv = EINVAL; -+ break; -+ } - } -- } -- *raw = lines; - -- return 0; -+ if (bsz) -+ lseek(fd, -(off_t)bsz, SEEK_CUR); -+ -+ if (!rv && pkg->name) -+ return 0; -+ else -+ return EINVAL; - } -+ ---- a/libopkg/pkg_parse.h -+++ b/libopkg/pkg_parse.h -@@ -25,7 +25,7 @@ - char ** parseDependsString(char * raw, int * depends_count); - int parseVersion(pkg_t *pkg, char *raw); - void parseConffiles(pkg_t * pkg, char * raw); --int pkg_parse_raw(pkg_t *pkg, char ***raw, pkg_src_t *src, pkg_dest_t *dest); --int pkg_valorize_other_field(pkg_t *pkg, char ***raw); -+int pkg_parse_fd(pkg_t *pkg, int fd, pkg_src_t *src, pkg_dest_t *dest, int no_desc); -+int pkg_valorize_other_field(pkg_t *pkg, int fd); - - #endif ---- a/libopkg/opkg_utils.h -+++ b/libopkg/opkg_utils.h -@@ -26,8 +26,6 @@ - void free_error_list(); - - long unsigned int get_available_blocks(char * filesystem); --char **read_raw_pkgs_from_file(const char *file_name); --char **read_raw_pkgs_from_stream(FILE *fp); - char *trim_alloc(char * line); - int line_is_blank(const char *line); - ---- a/libopkg/libopkg.c -+++ b/libopkg/libopkg.c -@@ -88,6 +88,7 @@ - char *cmd_name; - opkg_cmd_t *cmd; - opkg_conf_t opkg_conf; -+ int no_desc = 1; - - args_init (&args); - -@@ -122,12 +123,18 @@ - !strcmp(cmd_name,"status") ) - args.noreadfeedsfile = 1; - -+ if( !strcmp(cmd_name,"list") || -+ !strcmp(cmd_name,"list-installed") || -+ !strcmp(cmd_name,"list_installed") || -+ !strcmp(cmd_name,"search") ) -+ no_desc = 0; -+ - opkg_cb_message = default_opkg_message_callback; - opkg_cb_response = default_opkg_response_callback; - opkg_cb_status = default_opkg_status_callback; - - -- err = opkg_conf_init (&opkg_conf, &args); -+ err = opkg_conf_init (&opkg_conf, &args, no_desc); - if (err) - { - opkg_print_error_list (&opkg_conf); ---- a/libopkg/opkg.c -+++ b/libopkg/opkg.c -@@ -205,7 +205,7 @@ - } - - opkg->conf = calloc (1, sizeof (opkg_conf_t)); -- err = opkg_conf_init (opkg->conf, opkg->args); -+ err = opkg_conf_init (opkg->conf, opkg->args, 0); - if (err) - { - free (opkg->conf); -@@ -286,7 +286,7 @@ - - /* throw away old opkg_conf and start again */ - opkg_conf_deinit (opkg->conf); -- opkg_conf_init (opkg->conf, opkg->args); -+ opkg_conf_init (opkg->conf, opkg->args, 0); - - free (opkg->options); - opkg_init_options_array (opkg->conf, &opkg->options); ---- a/libopkg/opkg_conf.c -+++ b/libopkg/opkg_conf.c -@@ -44,9 +44,9 @@ - static int opkg_conf_set_default_dest(opkg_conf_t *conf, - const char *default_dest_name); - static int set_and_load_pkg_src_list(opkg_conf_t *conf, -- pkg_src_list_t *nv_pair_list); -+ pkg_src_list_t *nv_pair_list, int no_desc); - static int set_and_load_pkg_dest_list(opkg_conf_t *conf, -- nv_pair_list_t *nv_pair_list, char * lists_dir); -+ nv_pair_list_t *nv_pair_list, char * lists_dir, int no_desc); - - int opkg_init_options_array(const opkg_conf_t *conf, opkg_option_t **options) - { -@@ -106,7 +106,7 @@ - } - } - --int opkg_conf_init(opkg_conf_t *conf, const args_t *args) -+int opkg_conf_init(opkg_conf_t *conf, const args_t *args, int no_desc) - { - int err; - char *tmp_dir_base; -@@ -294,12 +294,12 @@ - if ( !(args->nocheckfordirorfile)){ - /* need to run load the source list before dest list -Jamey */ - if ( !(args->noreadfeedsfile)) -- set_and_load_pkg_src_list(conf, &conf->pkg_src_list); -+ set_and_load_pkg_src_list(conf, &conf->pkg_src_list, no_desc); - - /* Now that we have resolved conf->offline_root, we can commit to - the directory names for the dests and load in all the package - lists. */ -- set_and_load_pkg_dest_list(conf, &tmp_dest_nv_pair_list,lists_dir); -+ set_and_load_pkg_dest_list(conf, &tmp_dest_nv_pair_list,lists_dir, no_desc); - - if (args->dest) { - err = opkg_conf_set_default_dest(conf, args->dest); -@@ -409,7 +409,7 @@ - return 1; - } - --static int set_and_load_pkg_src_list(opkg_conf_t *conf, pkg_src_list_t *pkg_src_list) -+static int set_and_load_pkg_src_list(opkg_conf_t *conf, pkg_src_list_t *pkg_src_list, int no_desc) - { - pkg_src_list_elt_t *iter; - pkg_src_t *src; -@@ -426,7 +426,7 @@ - src->name); - - if (file_exists(list_file)) { -- pkg_hash_add_from_file(conf, list_file, src, NULL, 0); -+ pkg_hash_add_from_file(conf, list_file, src, NULL, 0, no_desc); - } - free(list_file); - } -@@ -434,7 +434,7 @@ - return 0; - } - --static int set_and_load_pkg_dest_list(opkg_conf_t *conf, nv_pair_list_t *nv_pair_list, char *lists_dir ) -+static int set_and_load_pkg_dest_list(opkg_conf_t *conf, nv_pair_list_t *nv_pair_list, char *lists_dir, int no_desc) - { - nv_pair_list_elt_t *iter; - nv_pair_t *nv_pair; -@@ -459,7 +459,7 @@ - } - if (file_exists(dest->status_file_name)) { - pkg_hash_add_from_file(conf, dest->status_file_name, -- NULL, dest, 1); -+ NULL, dest, 1, no_desc); - } - } - ---- a/libopkg/opkg_conf.h -+++ b/libopkg/opkg_conf.h -@@ -102,7 +102,7 @@ - const void *value; - }; - --int opkg_conf_init(opkg_conf_t *conf, const args_t *args); -+int opkg_conf_init(opkg_conf_t *conf, const args_t *args, int no_desc); - void opkg_conf_deinit(opkg_conf_t *conf); - - int opkg_conf_write_status_files(opkg_conf_t *conf); ---- a/tests/opkg_hash_test.c -+++ b/tests/opkg_hash_test.c -@@ -33,8 +33,8 @@ - } - pkg_hash_init("test", hash, 1024); - -- pkg_hash_add_from_file(&conf, argv[1], NULL, NULL, 0); -- pkg_hash_add_from_file(&conf, argv[2], NULL, NULL, 0); -+ pkg_hash_add_from_file(&conf, argv[1], NULL, NULL, 0, 0); -+ pkg_hash_add_from_file(&conf, argv[2], NULL, NULL, 0, 0); - - if (argc < 4) { - pkg_print_info( pkg_hash_fetch_by_name_version(hash, "libc6", "2.2.3-2"), stdout); ---- a/libopkg/pkg_hash.h -+++ b/libopkg/pkg_hash.h -@@ -33,7 +33,7 @@ - void pkg_hash_fetch_available(hash_table_t *hash, pkg_vec_t *available); - - int pkg_hash_add_from_file(opkg_conf_t *conf, const char *file_name, -- pkg_src_t *src, pkg_dest_t *dest, int is_status_file); -+ pkg_src_t *src, pkg_dest_t *dest, int is_status_file, int no_desc); - pkg_t *hash_insert_pkg(hash_table_t *hash, pkg_t *pkg, int set_status,opkg_conf_t *conf); - - abstract_pkg_t * ensure_abstract_pkg_by_name(hash_table_t * hash, const char * pkg_name); diff --git a/package/opkg/patches/009-remove-upgrade-all.patch b/package/opkg/patches/009-remove-upgrade-all.patch index 320f71005..d2440e031 100644 --- a/package/opkg/patches/009-remove-upgrade-all.patch +++ b/package/opkg/patches/009-remove-upgrade-all.patch @@ -1,6 +1,6 @@ --- a/libopkg/args.c +++ b/libopkg/args.c -@@ -263,7 +263,7 @@ +@@ -259,7 +259,7 @@ printf("\nPackage Manipulation:\n"); printf("\tupdate Update list of available packages\n"); @@ -11,7 +11,7 @@ printf("\tconfigure [] Configure unpacked packages\n"); --- a/libopkg/opkg_cmd.c +++ b/libopkg/opkg_cmd.c -@@ -79,7 +79,7 @@ +@@ -75,7 +75,7 @@ array for easier maintenance */ static opkg_cmd_t cmds[] = { {"update", 0, (opkg_cmd_fun_t)opkg_update_cmd}, @@ -20,7 +20,7 @@ {"list", 0, (opkg_cmd_fun_t)opkg_list_cmd}, {"list_installed", 0, (opkg_cmd_fun_t)opkg_list_installed_cmd}, {"list_upgradable", 0, (opkg_cmd_fun_t)opkg_list_upgradable_cmd}, -@@ -640,17 +640,6 @@ +@@ -607,17 +607,6 @@ opkg_install_by_name(conf, arg); } } @@ -37,4 +37,4 @@ - pkg_vec_free(installed); } - /* recheck to verify that all dependences are satisfied */ + opkg_configure_packages(conf, NULL); diff --git a/package/opkg/patches/010-remove-flag.patch b/package/opkg/patches/010-remove-flag.patch index 20bebda4b..9b988b89e 100644 --- a/package/opkg/patches/010-remove-flag.patch +++ b/package/opkg/patches/010-remove-flag.patch @@ -1,6 +1,6 @@ --- a/libopkg/args.c +++ b/libopkg/args.c -@@ -268,8 +268,6 @@ +@@ -264,8 +264,6 @@ printf("\tinstall Install package \n"); printf("\tconfigure [] Configure unpacked packages\n"); printf("\tremove Remove package \n"); @@ -11,7 +11,7 @@ printf("\tlist List available packages and descriptions\n"); --- a/libopkg/opkg_cmd.c +++ b/libopkg/opkg_cmd.c -@@ -58,7 +58,6 @@ +@@ -54,7 +54,6 @@ static int opkg_list_upgradable_cmd(opkg_conf_t *conf, int argc, char **argv); static int opkg_remove_cmd(opkg_conf_t *conf, int argc, char **argv); static int opkg_purge_cmd(opkg_conf_t *conf, int argc, char **argv); @@ -19,7 +19,7 @@ static int opkg_files_cmd(opkg_conf_t *conf, int argc, char **argv); static int opkg_search_cmd(opkg_conf_t *conf, int argc, char **argv); static int opkg_download_cmd(opkg_conf_t *conf, int argc, char **argv); -@@ -84,7 +83,6 @@ +@@ -80,7 +79,6 @@ {"list_installed", 0, (opkg_cmd_fun_t)opkg_list_installed_cmd}, {"list_upgradable", 0, (opkg_cmd_fun_t)opkg_list_upgradable_cmd}, {"info", 0, (opkg_cmd_fun_t)opkg_info_cmd}, @@ -27,7 +27,7 @@ {"status", 0, (opkg_cmd_fun_t)opkg_status_cmd}, {"install_pending", 0, (opkg_cmd_fun_t)opkg_install_pending_cmd}, {"install", 1, (opkg_cmd_fun_t)opkg_install_cmd}, -@@ -1050,48 +1048,6 @@ +@@ -960,48 +958,6 @@ return 0; } From 25941ba23fb2a8ebcce9a2143007809c4136fba3 Mon Sep 17 00:00:00 2001 From: jow Date: Wed, 11 Nov 2009 22:13:10 +0000 Subject: [PATCH 147/288] [package] opkg: forgot to remove two obsolete patches in last commit git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18381 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/opkg/patches/006-fix_force_space.patch | 12 ------------ package/opkg/patches/011-fix_nullpointer_deref.patch | 11 ----------- 2 files changed, 23 deletions(-) delete mode 100644 package/opkg/patches/006-fix_force_space.patch delete mode 100644 package/opkg/patches/011-fix_nullpointer_deref.patch diff --git a/package/opkg/patches/006-fix_force_space.patch b/package/opkg/patches/006-fix_force_space.patch deleted file mode 100644 index 80406ba16..000000000 --- a/package/opkg/patches/006-fix_force_space.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/libopkg/opkg_conf.c -+++ b/libopkg/opkg_conf.c -@@ -252,6 +252,9 @@ int opkg_conf_init(opkg_conf_t *conf, co - if (args->force_downgrade) { - conf->force_downgrade = 1; - } -+ if (args->force_space) { -+ conf->force_space = 1; -+ } - if (args->force_reinstall) { - conf->force_reinstall = 1; - } diff --git a/package/opkg/patches/011-fix_nullpointer_deref.patch b/package/opkg/patches/011-fix_nullpointer_deref.patch deleted file mode 100644 index ed198af39..000000000 --- a/package/opkg/patches/011-fix_nullpointer_deref.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/libopkg/opkg_cmd.c -+++ b/libopkg/opkg_cmd.c -@@ -954,7 +954,7 @@ - pkg_to_remove = pkg_hash_fetch_installed_by_name(&conf->pkg_hash, pkg->name ); - } - -- if (pkg == NULL) { -+ if (pkg_to_remove == NULL) { - opkg_message(conf, OPKG_ERROR, "Package %s is not installed.\n", pkg->name); - continue; - } From 6e4aacf42ab90c882bbbdcc35f36e8853128d5df Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 12 Nov 2009 00:06:35 +0000 Subject: [PATCH 148/288] metadata.pl: fix menuconfig code for package features git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18386 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- scripts/metadata.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/metadata.pl b/scripts/metadata.pl index 26d878cc9..54ac06390 100755 --- a/scripts/metadata.pl +++ b/scripts/metadata.pl @@ -549,9 +549,10 @@ EOF print <{name} bool "$feature->{title}" - help -$feature->{description} EOF + $feature->{description} =~ /\w/ and do { + print "\t\thelp\n".$feature->{description}."\n"; + }; } print "endchoice\n" } From 26862c3e56fe9164f7a7a45305d99965145b975e Mon Sep 17 00:00:00 2001 From: kaloz Date: Thu, 12 Nov 2009 10:39:10 +0000 Subject: [PATCH 149/288] update openssl to 0.9.8l -- thanks puchu git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18398 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/openssl/Makefile | 6 +-- .../openssl/patches/900-CVE-2009-1377.patch | 53 +++++++++++++++++++ .../openssl/patches/900-CVE-2009-1378.patch | 24 +++++++++ .../openssl/patches/900-CVE-2009-1379.patch | 22 ++++++++ package/openssl/patches/901-remove_rej.patch | 20 +++++++ 5 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 package/openssl/patches/900-CVE-2009-1377.patch create mode 100644 package/openssl/patches/900-CVE-2009-1378.patch create mode 100644 package/openssl/patches/900-CVE-2009-1379.patch create mode 100644 package/openssl/patches/901-remove_rej.patch diff --git a/package/openssl/Makefile b/package/openssl/Makefile index e6788172d..23695fcc2 100644 --- a/package/openssl/Makefile +++ b/package/openssl/Makefile @@ -8,15 +8,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openssl -PKG_VERSION:=0.9.8k -PKG_RELEASE:=2 +PKG_VERSION:=0.9.8l +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.openssl.org/source/ \ ftp://ftp.funet.fi/pub/crypt/cryptography/libs/openssl/source/ \ ftp://ftp.webmonster.de/pub/openssl/source/ \ ftp://ftp.sunet.se/pub/security/tools/net/openssl/source/ -PKG_MD5SUM:=e555c6d58d276aec7fdc53363e338ab3 +PKG_MD5SUM:=05a0ece1372392a2cf310ebb96333025 PKG_BUILD_DEPENDS:=ocf-crypto-headers diff --git a/package/openssl/patches/900-CVE-2009-1377.patch b/package/openssl/patches/900-CVE-2009-1377.patch new file mode 100644 index 000000000..cc5a19fb4 --- /dev/null +++ b/package/openssl/patches/900-CVE-2009-1377.patch @@ -0,0 +1,53 @@ +http://rt.openssl.org/Ticket/Display.html?id=1931&user=guest&pass=guest + +Index: openssl/crypto/pqueue/pqueue.c +RCS File: /v/openssl/cvs/openssl/crypto/pqueue/pqueue.c,v +rcsdiff -q -kk '-r1.2.2.4' '-r1.2.2.5' -u '/v/openssl/cvs/openssl/crypto/pqueue/pqueue.c,v' 2>/dev/null +--- pqueue.c 2005/06/28 12:53:33 1.2.2.4 ++++ pqueue.c 2009/05/16 16:18:44 1.2.2.5 +@@ -234,3 +234,17 @@ + + return ret; + } ++ ++int ++pqueue_size(pqueue_s *pq) ++{ ++ pitem *item = pq->items; ++ int count = 0; ++ ++ while(item != NULL) ++ { ++ count++; ++ item = item->next; ++ } ++ return count; ++} +Index: openssl/crypto/pqueue/pqueue.h +RCS File: /v/openssl/cvs/openssl/crypto/pqueue/pqueue.h,v +rcsdiff -q -kk '-r1.2.2.1' '-r1.2.2.2' -u '/v/openssl/cvs/openssl/crypto/pqueue/pqueue.h,v' 2>/dev/null +--- pqueue.h 2005/05/30 22:34:27 1.2.2.1 ++++ pqueue.h 2009/05/16 16:18:44 1.2.2.2 +@@ -91,5 +91,6 @@ + pitem *pqueue_next(piterator *iter); + + void pqueue_print(pqueue pq); ++int pqueue_size(pqueue pq); + + #endif /* ! HEADER_PQUEUE_H */ +Index: openssl/ssl/d1_pkt.c +RCS File: /v/openssl/cvs/openssl/ssl/d1_pkt.c,v +rcsdiff -q -kk '-r1.4.2.17' '-r1.4.2.18' -u '/v/openssl/cvs/openssl/ssl/d1_pkt.c,v' 2>/dev/null +--- d1_pkt.c 2009/05/16 15:51:59 1.4.2.17 ++++ d1_pkt.c 2009/05/16 16:18:45 1.4.2.18 +@@ -167,6 +167,10 @@ + DTLS1_RECORD_DATA *rdata; + pitem *item; + ++ /* Limit the size of the queue to prevent DOS attacks */ ++ if (pqueue_size(queue->q) >= 100) ++ return 0; ++ + rdata = OPENSSL_malloc(sizeof(DTLS1_RECORD_DATA)); + item = pitem_new(priority, rdata); + if (rdata == NULL || item == NULL) diff --git a/package/openssl/patches/900-CVE-2009-1378.patch b/package/openssl/patches/900-CVE-2009-1378.patch new file mode 100644 index 000000000..50f51cd85 --- /dev/null +++ b/package/openssl/patches/900-CVE-2009-1378.patch @@ -0,0 +1,24 @@ +http://rt.openssl.org/Ticket/Display.html?id=1931&user=guest&pass=guest + +Index: openssl/ssl/d1_both.c +=================================================================== +--- d1_both.c.orig ++++ d1_both.c +@@ -561,7 +561,16 @@ dtls1_process_out_of_seq_message(SSL *s, + if ((msg_hdr->frag_off+frag_len) > msg_hdr->msg_len) + goto err; + +- if (msg_hdr->seq <= s->d1->handshake_read_seq) ++ /* Try to find item in queue, to prevent duplicate entries */ ++ pq_64bit_init(&seq64); ++ pq_64bit_assign_word(&seq64, msg_hdr->seq); ++ item = pqueue_find(s->d1->buffered_messages, seq64); ++ pq_64bit_free(&seq64); ++ ++ /* Discard the message if sequence number was already there, is ++ * too far in the future or the fragment is already in the queue */ ++ if (msg_hdr->seq <= s->d1->handshake_read_seq || ++ msg_hdr->seq > s->d1->handshake_read_seq + 10 || item != NULL) + { + unsigned char devnull [256]; + diff --git a/package/openssl/patches/900-CVE-2009-1379.patch b/package/openssl/patches/900-CVE-2009-1379.patch new file mode 100644 index 000000000..706732435 --- /dev/null +++ b/package/openssl/patches/900-CVE-2009-1379.patch @@ -0,0 +1,22 @@ +Index: openssl/ssl/d1_both.c +RCS File: /v/openssl/cvs/openssl/ssl/d1_both.c,v +rcsdiff -q -kk '-r1.14.2.6' '-r1.14.2.7' -u '/v/openssl/cvs/openssl/ssl/d1_both.c,v' 2>/dev/null +--- d1_both.c 2009/04/22 12:17:02 1.14.2.6 ++++ d1_both.c 2009/05/13 11:51:30 1.14.2.7 +@@ -519,6 +519,7 @@ + + if ( s->d1->handshake_read_seq == frag->msg_header.seq) + { ++ unsigned long frag_len = frag->msg_header.frag_len; + pqueue_pop(s->d1->buffered_messages); + + al=dtls1_preprocess_fragment(s,&frag->msg_header,max); +@@ -536,7 +537,7 @@ + if (al==0) + { + *ok = 1; +- return frag->msg_header.frag_len; ++ return frag_len; + } + + ssl3_send_alert(s,SSL3_AL_FATAL,al); diff --git a/package/openssl/patches/901-remove_rej.patch b/package/openssl/patches/901-remove_rej.patch new file mode 100644 index 000000000..a452c2704 --- /dev/null +++ b/package/openssl/patches/901-remove_rej.patch @@ -0,0 +1,20 @@ +diff -burN openssl-0.9.8l/Configure.rej openssl-0.9.8l.patched/Configure.rej +--- openssl-0.9.8l/Configure.rej 2009-11-05 13:07:06.000000000 +0100 ++++ openssl-0.9.8l.patched/Configure.rej 1970-01-01 01:00:00.000000000 +0100 +@@ -1,16 +0,0 @@ +-*************** +-*** 162,167 **** +- "debug-ben-openbsd","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", +- "debug-ben-openbsd-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", +- "debug-ben-debug", "gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -g3 -O2 -pipe::(unknown)::::::", +- "debug-ben-strict", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DCONST_STRICT -O2 -Wall -Wshadow -Werror -Wpointer-arith -Wcast-qual -Wwrite-strings -pipe::(unknown)::::::", +- "debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", +- "debug-bodo", "gcc:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -march=i486 -pedantic -Wshadow -Wall -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", +---- 162,168 ---- +- "debug-ben-openbsd","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", +- "debug-ben-openbsd-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", +- "debug-ben-debug", "gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -g3 -O2 -pipe::(unknown)::::::", +-+ "debug-ben-no-renegotiation", "gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -DNO_RENEGOTIATION -g3 -O2 -pipe::(unknown)::::::", +- "debug-ben-strict", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DCONST_STRICT -O2 -Wall -Wshadow -Werror -Wpointer-arith -Wcast-qual -Wwrite-strings -pipe::(unknown)::::::", +- "debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", +- "debug-bodo", "gcc:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -march=i486 -pedantic -Wshadow -Wall -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", From 62cade03b8f704f3f01ad1356c4bca1d197b39a4 Mon Sep 17 00:00:00 2001 From: kaloz Date: Thu, 12 Nov 2009 12:20:38 +0000 Subject: [PATCH 150/288] neither avr32 or coldfire has a shared libgcc git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18402 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 5e5066eea..8138f1cd4 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -156,7 +156,9 @@ define Package/libc/Default SECTION:=libs CATEGORY:=Base system VERSION:=$(LIBC_VERSION)-$(PKG_RELEASE) +ifneq ($(TARGET_avr32)$(TARGET_coldfire),) DEPENDS:=+libgcc +endif URL:=$(LIBC_URL) endef From 53d870958e2ad8d5f3478a639d17692991ed13fe Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 12 Nov 2009 13:42:07 +0000 Subject: [PATCH 151/288] gcc: add a config option for using the gcc graphite framework (disabled by default) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18403 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- toolchain/gcc/Config.in | 5 +++++ toolchain/gcc/Makefile | 2 +- tools/Makefile | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in index 6df266173..b19427be0 100644 --- a/toolchain/gcc/Config.in +++ b/toolchain/gcc/Config.in @@ -50,6 +50,11 @@ endif endchoice +config GCC_USE_GRAPHITE + bool + prompt "Compile in support for the new Graphite framework in GCC 4.4+" if TOOLCHAINOPTS + depends GCC_VERSION_4_4_1 || GCC_VERSION_4_4_2 + config EXTRA_GCC_CONFIG_OPTIONS string prompt "Additional gcc configure options" if TOOLCHAINOPTS diff --git a/toolchain/gcc/Makefile b/toolchain/gcc/Makefile index 9d865e94d..ea103c453 100644 --- a/toolchain/gcc/Makefile +++ b/toolchain/gcc/Makefile @@ -90,7 +90,7 @@ GCC_CONFIGURE:= \ --disable-libmudflap \ --disable-multilib \ --disable-nls \ - $(if $(CONFIG_GCC_VERSION_4_4),--with-host-libstdcxx=-lstdc++) \ + $(if $(CONFIG_GCC_USE_GRAPHITE),--with-host-libstdcxx=-lstdc++) \ $(SOFT_FLOAT_CONFIG_OPTION) \ $(call qstrip,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS)) \ $(if $(CONFIG_mips64)$(CONFIG_mips64el),--with-arch=mips64 --with-abi=64) \ diff --git a/tools/Makefile b/tools/Makefile index 6e5eb24cd..b7c7f43db 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -20,7 +20,7 @@ tools-y += firmware-utils patch-cmdline quilt yaffs2 tools-$(CONFIG_CCACHE) += ccache tools-dep += lzma -ifdef CONFIG_GCC_VERSION_4_4 +ifdef CONFIG_GCC_USE_GRAPHITE tools-y += ppl cloog $(curdir)/cloog/compile := $(curdir)/ppl/install endif @@ -82,5 +82,5 @@ $(curdir)//compile = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/.prepared $($( $(curdir)/ := .config prereq $(curdir)//install = $(1)/compile -$(eval $(call stampfile,$(curdir),tools,install,,CONFIG_CCACHE CONFIG_powerpc CONFIG_GCC_VERSION_4_3)) +$(eval $(call stampfile,$(curdir),tools,install,,CONFIG_CCACHE CONFIG_powerpc CONFIG_GCC_VERSION_4_3 CONFIG_GCC_USE_GRAPHITE)) $(eval $(call subdir,$(curdir))) From 714686487c579cd6434ccab19c3f9eb12e52603a Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 12 Nov 2009 14:15:09 +0000 Subject: [PATCH 152/288] hostapd: fix HT40 BSS scan checks git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18404 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/hostapd/patches/140-ht40_scan.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 package/hostapd/patches/140-ht40_scan.patch diff --git a/package/hostapd/patches/140-ht40_scan.patch b/package/hostapd/patches/140-ht40_scan.patch new file mode 100644 index 000000000..b8fa6e38f --- /dev/null +++ b/package/hostapd/patches/140-ht40_scan.patch @@ -0,0 +1,11 @@ +--- a/hostapd/hw_features.c ++++ b/hostapd/hw_features.c +@@ -329,7 +329,7 @@ static int ieee80211n_check_40mhz_5g(str + if (!match) { + for (i = 0; i < scan_res->num; i++) { + struct wpa_scan_res *bss = scan_res->res[i]; +- ieee80211n_get_pri_sec_chan(bss, &pri_chan, &sec_chan); ++ ieee80211n_get_pri_sec_chan(bss, &bss_pri_chan, &bss_sec_chan); + if (pri_chan == bss_sec_chan && + sec_chan == bss_pri_chan) { + wpa_printf(MSG_INFO, "Switch own primary and " From 2836c3f4f863778aea17e46ce4bb24671c314b22 Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 12 Nov 2009 14:15:13 +0000 Subject: [PATCH 153/288] hostapd: fix endian bugs in STA HT capability handling git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18405 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../hostapd/patches/150-ht_cap_endian.patch | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 package/hostapd/patches/150-ht_cap_endian.patch diff --git a/package/hostapd/patches/150-ht_cap_endian.patch b/package/hostapd/patches/150-ht_cap_endian.patch new file mode 100644 index 000000000..d8f3856ee --- /dev/null +++ b/package/hostapd/patches/150-ht_cap_endian.patch @@ -0,0 +1,33 @@ +--- a/hostapd/ieee802_11.c ++++ b/hostapd/ieee802_11.c +@@ -1586,24 +1586,16 @@ hostapd_get_ht_capab(struct hostapd_data + struct ht_cap_ie *ht_cap_ie, + struct ht_cap_ie *neg_ht_cap_ie) + { ++ u16 cap; + + os_memcpy(neg_ht_cap_ie, ht_cap_ie, sizeof(struct ht_cap_ie)); +- neg_ht_cap_ie->data.capabilities_info = +- ht_cap_ie->data.capabilities_info & hapd->iconf->ht_capab; +- +- neg_ht_cap_ie->data.capabilities_info &= ~HT_CAP_INFO_SMPS_DISABLED; +- if ((ht_cap_ie->data.capabilities_info & HT_CAP_INFO_SMPS_DISABLED) == +- (hapd->iconf->ht_capab & HT_CAP_INFO_SMPS_DISABLED)) +- neg_ht_cap_ie->data.capabilities_info |= +- hapd->iconf->ht_capab & HT_CAP_INFO_SMPS_DISABLED; +- else +- neg_ht_cap_ie->data.capabilities_info |= +- HT_CAP_INFO_SMPS_DISABLED; ++ cap = le_to_host16(neg_ht_cap_ie->data.capabilities_info); ++ cap &= hapd->iconf->ht_capab; ++ cap |= (hapd->iconf->ht_capab & HT_CAP_INFO_SMPS_DISABLED); + + /* FIXME: Rx STBC needs to be handled specially */ +- neg_ht_cap_ie->data.capabilities_info &= ~HT_CAP_INFO_RX_STBC_MASK; +- neg_ht_cap_ie->data.capabilities_info |= +- hapd->iconf->ht_capab & HT_CAP_INFO_RX_STBC_MASK; ++ cap |= (hapd->iconf->ht_capab & HT_CAP_INFO_RX_STBC_MASK); ++ neg_ht_cap_ie->data.capabilities_info = host_to_le16(cap); + } + #endif /* CONFIG_IEEE80211N */ + From 21c70e437b5f88567bc63dd57b3b3995eca862b6 Mon Sep 17 00:00:00 2001 From: juhosg Date: Fri, 13 Nov 2009 17:11:17 +0000 Subject: [PATCH 154/288] ar71xx: add profile for the TL-WR841ND v5 board git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18409 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/profiles/tp-link.mk | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/target/linux/ar71xx/profiles/tp-link.mk b/target/linux/ar71xx/profiles/tp-link.mk index 7b804e5b9..ab5ed54ca 100644 --- a/target/linux/ar71xx/profiles/tp-link.mk +++ b/target/linux/ar71xx/profiles/tp-link.mk @@ -26,6 +26,17 @@ endef $(eval $(call Profile,TLWR841NDV3)) +define Profile/TLWR841NDV5 + NAME:=TP-LINK TL-WR841ND v5 + PACKAGES:=kmod-ath9k hostapd-mini +endef + +define Profile/TLWR841NDV5/Description + Package set optimized for the TP-LINK TL-WR841ND v5. +endef + +$(eval $(call Profile,TLWR841NDV5)) + define Profile/TLWR941NDV2 NAME:=TP-LINK TL-WR941ND v2 PACKAGES:=kmod-ath9k hostapd-mini From d44b7090347b5ab4cc9c5b4307f528fb4161b47b Mon Sep 17 00:00:00 2001 From: juhosg Date: Fri, 13 Nov 2009 17:11:23 +0000 Subject: [PATCH 155/288] ar71xx: increase max size of RouterStation and RouterStation Pro firmware images Thanks to riskable! (closes #5860) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18410 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- tools/firmware-utils/src/mkfwimage.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/firmware-utils/src/mkfwimage.c b/tools/firmware-utils/src/mkfwimage.c index e726bef8a..83ce6cf3d 100644 --- a/tools/firmware-utils/src/mkfwimage.c +++ b/tools/firmware-utils/src/mkfwimage.c @@ -55,13 +55,13 @@ fw_layout_t fw_layout_data[] = { .name = "RS", .kern_start = 0xbf030000, .kern_entry = 0x80060000, - .firmware_max_length= 0x00640000, + .firmware_max_length= 0x00B00000, }, { .name = "RSPRO", .kern_start = 0xbf030000, .kern_entry = 0x80060000, - .firmware_max_length= 0x00640000, + .firmware_max_length= 0x00B00000, }, { .name = "LS-SR71", From dbba973c9f7507c4f71998835fa44cd660089d90 Mon Sep 17 00:00:00 2001 From: juhosg Date: Fri, 13 Nov 2009 17:11:29 +0000 Subject: [PATCH 156/288] ar71xx: add preliminary support for the Netgear WNDR3700 Based on patches by Marco Porsch from: https://forum.openwrt.org/viewtopic.php?id=22311 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18411 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 + target/linux/ar71xx/config-2.6.28 | 1 + target/linux/ar71xx/config-2.6.30 | 1 + target/linux/ar71xx/config-2.6.31 | 1 + .../ar71xx/files/arch/mips/ar71xx/Kconfig | 4 + .../ar71xx/files/arch/mips/ar71xx/Makefile | 1 + .../files/arch/mips/ar71xx/mach-wndr3700.c | 131 ++++++++++++++++++ .../ar71xx/files/arch/mips/ar71xx/prom.c | 3 + .../mips/include/asm/mach-ar71xx/ar71xx.h | 1 + target/linux/ar71xx/profiles/netgear.mk | 17 +++ 10 files changed, 163 insertions(+) create mode 100644 target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c create mode 100644 target/linux/ar71xx/profiles/netgear.mk diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index f8c46ac2b..5ff238871 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -67,6 +67,9 @@ ar71xx_board_name() { *WP543) name="wp543" ;; + *WNDR3700) + name"wndr3700" + ;; *WNR2000) name="wnr2000" ;; diff --git a/target/linux/ar71xx/config-2.6.28 b/target/linux/ar71xx/config-2.6.28 index 137b10c74..1a9ca7c77 100644 --- a/target/linux/ar71xx/config-2.6.28 +++ b/target/linux/ar71xx/config-2.6.28 @@ -17,6 +17,7 @@ CONFIG_AR71XX_MACH_TEW_632BRP=y CONFIG_AR71XX_MACH_TL_WR741ND=y CONFIG_AR71XX_MACH_TL_WR941ND=y CONFIG_AR71XX_MACH_UBNT=y +CONFIG_AR71XX_MACH_WNDR3700=y CONFIG_AR71XX_MACH_WNR2000=y CONFIG_AR71XX_MACH_WP543=y CONFIG_AR71XX_MACH_WRT160NL=y diff --git a/target/linux/ar71xx/config-2.6.30 b/target/linux/ar71xx/config-2.6.30 index 2c8895261..76c4829fd 100644 --- a/target/linux/ar71xx/config-2.6.30 +++ b/target/linux/ar71xx/config-2.6.30 @@ -16,6 +16,7 @@ CONFIG_AR71XX_MACH_TEW_632BRP=y CONFIG_AR71XX_MACH_TL_WR741ND=y CONFIG_AR71XX_MACH_TL_WR941ND=y CONFIG_AR71XX_MACH_UBNT=y +CONFIG_AR71XX_MACH_WNDR3700=y CONFIG_AR71XX_MACH_WNR2000=y CONFIG_AR71XX_MACH_WP543=y CONFIG_AR71XX_MACH_WRT160NL=y diff --git a/target/linux/ar71xx/config-2.6.31 b/target/linux/ar71xx/config-2.6.31 index 125ac99b0..9d92bec78 100644 --- a/target/linux/ar71xx/config-2.6.31 +++ b/target/linux/ar71xx/config-2.6.31 @@ -17,6 +17,7 @@ CONFIG_AR71XX_MACH_TEW_632BRP=y CONFIG_AR71XX_MACH_TL_WR741ND=y CONFIG_AR71XX_MACH_TL_WR941ND=y CONFIG_AR71XX_MACH_UBNT=y +CONFIG_AR71XX_MACH_WNDR3700=y CONFIG_AR71XX_MACH_WNR2000=y CONFIG_AR71XX_MACH_WP543=y CONFIG_AR71XX_MACH_WRT160NL=y diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig index fe8553f84..72c28b460 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig @@ -43,6 +43,10 @@ config AR71XX_MACH_RB_4XX bool "MikroTik RouterBOARD 4xx series support" default y +config AR71XX_MACH_WNDR3700 + bool "NETGEAR WNDR3700 board support" + default y + config AR71XX_MACH_WNR2000 bool "NETGEAR WNR2000 board support" default y diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile index ee439698a..71ba835dc 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile @@ -26,6 +26,7 @@ obj-$(CONFIG_AR71XX_MACH_TEW_632BRP) += mach-tew-632brp.o obj-$(CONFIG_AR71XX_MACH_TL_WR741ND) += mach-tl-wr741nd.o obj-$(CONFIG_AR71XX_MACH_TL_WR941ND) += mach-tl-wr941nd.o obj-$(CONFIG_AR71XX_MACH_UBNT) += mach-ubnt.o +obj-$(CONFIG_AR71XX_MACH_WNDR3700) += mach-wndr3700.o obj-$(CONFIG_AR71XX_MACH_WNR2000) += mach-wnr2000.o obj-$(CONFIG_AR71XX_MACH_WP543) += mach-wp543.o obj-$(CONFIG_AR71XX_MACH_WRT160NL) += mach-wrt160nl.o diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c new file mode 100644 index 000000000..aee68cb9f --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c @@ -0,0 +1,131 @@ +/* + * Netgear WNDR3700 board support + * + * Copyright (C) 2009 Marco Porsch + * Copyright (C) 2009 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "devices.h" + +#ifdef CONFIG_MTD_PARTITIONS +static struct mtd_partition wndr3700_partitions[] = { + { + .name = "uboot", + .offset = 0, + .size = 0x050000, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "env", + .offset = 0x050000, + .size = 0x020000, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "rootfs", + .offset = 0x070000, + .size = 0x720000, + } , { + .name = "config", + .offset = 0x790000, + .size = 0x010000, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "config_bak", + .offset = 0x7a0000, + .size = 0x010000, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "pot", + .offset = 0x7b0000, + .size = 0x010000, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "traffic_meter", + .offset = 0x7c0000, + .size = 0x010000, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "language", + .offset = 0x7d0000, + .size = 0x020000, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "caldata", + .offset = 0x7f0000, + .size = 0x010000, + .mask_flags = MTD_WRITEABLE, + } +}; +#endif /* CONFIG_MTD_PARTITIONS */ + +static struct flash_platform_data wndr3700_flash_data = { +#ifdef CONFIG_MTD_PARTITIONS + .parts = wndr3700_partitions, + .nr_parts = ARRAY_SIZE(wndr3700_partitions), +#endif +}; + +static struct ar71xx_pci_irq wndr3700_pci_irqs[] __initdata = { + { + .slot = 0, + .pin = 1, + .irq = AR71XX_PCI_IRQ_DEV0, + }, { + .slot = 1, + .pin = 1, + .irq = AR71XX_PCI_IRQ_DEV1, + } +}; + +static struct spi_board_info wndr3700_spi_info[] = { + { + .bus_num = 0, + .chip_select = 0, + .max_speed_hz = 25000000, + .modalias = "m25p80", + .platform_data = &wndr3700_flash_data, + } +}; + +static void __init wndr3700_setup(void) +{ + u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000); + + ar71xx_set_mac_base(mac); + ar71xx_add_device_mdio(0x0); + + ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; + ar71xx_eth0_data.phy_mask = 0xf; + ar71xx_eth0_data.speed = SPEED_1000; + ar71xx_eth0_data.duplex = DUPLEX_FULL; + + ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; + ar71xx_eth1_data.phy_mask = 0x10; + + ar71xx_add_device_eth(0); + ar71xx_add_device_eth(1); + + ar71xx_add_device_usb(); + + ar71xx_pci_init(ARRAY_SIZE(wndr3700_pci_irqs), wndr3700_pci_irqs); + + ar71xx_add_device_spi(NULL, wndr3700_spi_info, + ARRAY_SIZE(wndr3700_spi_info)); + + /* TODO: LEDs, buttons support */ +} + +MIPS_MACHINE(AR71XX_MACH_WNDR3700, "NETGEAR WNDR3700", wndr3700_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/prom.c b/target/linux/ar71xx/files/arch/mips/ar71xx/prom.c index ed6f4e993..43d663243 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/prom.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/prom.c @@ -85,6 +85,9 @@ static struct board_rec boards[] __initdata = { }, { .name = "UBNT-BM", .mach_type = AR71XX_MACH_UBNT_BULLET_M, + }, { + .name = "WNDR3700", + .mach_type = AR71XX_MACH_WNDR3700, }, { .name = "WNR2000", .mach_type = AR71XX_MACH_WNR2000, diff --git a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h index 4d2f7f216..2388acaba 100644 --- a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h +++ b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h @@ -142,6 +142,7 @@ enum ar71xx_mach_type { AR71XX_MACH_UBNT_RSPRO, /* Ubiquiti RouterStation Pro */ AR71XX_MACH_UBNT_BULLET_M, /* Ubiquiti Bullet M */ AR71XX_MACH_WNR2000, /* NETGEAR WNR2000 */ + AR71XX_MACH_WNDR3700, /* NETGEAR WNDR3700 */ AR71XX_MACH_WP543, /* Compex WP543 */ AR71XX_MACH_WRT160NL, /* Linksys WRT160NL */ AR71XX_MACH_WRT400N, /* Linksys WRT400N */ diff --git a/target/linux/ar71xx/profiles/netgear.mk b/target/linux/ar71xx/profiles/netgear.mk new file mode 100644 index 000000000..89deaaa84 --- /dev/null +++ b/target/linux/ar71xx/profiles/netgear.mk @@ -0,0 +1,17 @@ +# +# Copyright (C) 2009 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/WNDR3700 + NAME:=NETGEAR WNDR3700 + PACKAGES:=kmod-ath9k hostapd-mini kmod-usb-core kmod-usb-ohci kmod-usb2 +endef + +define Profile/WNDR3700/Description + Package set optimized for the NETGEAR WNDR3700 +endef + +$(eval $(call Profile,WNDR3700)) From fa989620af714ced8136c5a91c2495119f0ce0a3 Mon Sep 17 00:00:00 2001 From: juhosg Date: Fri, 13 Nov 2009 17:11:43 +0000 Subject: [PATCH 157/288] package/mac80211: add config option to enable Atheros wireless debugging git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18412 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/Makefile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile index 5e99342b7..13d1670a3 100644 --- a/package/mac80211/Makefile +++ b/package/mac80211/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 PKG_VERSION:=2009-11-03 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL:= \ http://www.orbit-lab.org/kernel/compat-wireless-2.6/2009/11 \ http://wireless.kernel.org/download/compat-wireless-2.6 @@ -278,10 +278,17 @@ config ATH_USER_REGD help Atheros' idea of regulatory handling is that the EEPROM of the card defines the regulatory limits and the user is only allowed to restrict the settings - even further, even if the country allows frequencies or power levels that + even further, even if the country allows frequencies or power levels that are forbidden by the EEPROM settings. Select this option if you want the driver to respect the user's decision about regulatory settings. + +config PACKAGE_ATH_DEBUG + bool "Atheros wireless debugging" + depends on PACKAGE_kmod-ath + help + Say Y, if you want to debug atheros wireless drivers. + Right now only ath9k makes use of this. endef define KernelPackage/ath @@ -492,6 +499,7 @@ BUILDFLAGS:= \ -DCONFIG_B43_HWRNG -DCONFIG_B43LEGACY_HWRNG \ $(if $(CONFIG_PACKAGE_MAC80211_DEBUGFS),-DCONFIG_MAC80211_DEBUGFS) \ $(if $(CONFIG_PACKAGE_ATH9K_DEBUG),-DCONFIG_ATH9K_DEBUG) \ + $(if $(CONFIG_PACKAGE_ATH_DEBUG),-DCONFIG_ATH_DEBUG) \ -D__CONFIG_MAC80211_RC_DEFAULT=minstrel \ $(if $(CONFIG_ATH_USER_REGD),-DATH_USER_REGD=1) @@ -518,6 +526,7 @@ MAKE_OPTS:= \ CONFIG_B43=$(if $(CONFIG_PACKAGE_kmod-b43),m) \ CONFIG_B43LEGACY=$(if $(CONFIG_PACKAGE_kmod-b43legacy),m) \ CONFIG_ATH_COMMON=$(if $(CONFIG_PACKAGE_kmod-ath),m) \ + CONFIG_ATH_DEBUG=$(if $(CONFIG_PACKAGE_ATH_DEBUG),y) \ CONFIG_ATH5K=$(if $(CONFIG_PACKAGE_kmod-ath5k),m) \ CONFIG_ATH9K=$(if $(CONFIG_PACKAGE_kmod-ath9k),m) \ CONFIG_ATH9K_DEBUG=$(if $(CONFIG_PACKAGE_ATH9K_DEBUG),y) \ From 3fb97947af0248bba15050c336496f6dace4ff2d Mon Sep 17 00:00:00 2001 From: hauke Date: Fri, 13 Nov 2009 20:32:47 +0000 Subject: [PATCH 158/288] [brcm47xx] fix problem with 128MB ram. This patch is out of broadcoms official source code git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18413 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../brcm-2.4/files/arch/mips/bcm947xx/prom.c | 9 +++++++++ .../patches-2.6.28/170-128MB_ram_bugfix.patch | 17 +++++++++++++++++ .../patches-2.6.30/170-128MB_ram_bugfix.patch | 17 +++++++++++++++++ .../patches-2.6.31/170-128MB_ram_bugfix.patch | 17 +++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 target/linux/brcm47xx/patches-2.6.28/170-128MB_ram_bugfix.patch create mode 100644 target/linux/brcm47xx/patches-2.6.30/170-128MB_ram_bugfix.patch create mode 100644 target/linux/brcm47xx/patches-2.6.31/170-128MB_ram_bugfix.patch diff --git a/target/linux/brcm-2.4/files/arch/mips/bcm947xx/prom.c b/target/linux/brcm-2.4/files/arch/mips/bcm947xx/prom.c index be628da62..f635b4a6c 100644 --- a/target/linux/brcm-2.4/files/arch/mips/bcm947xx/prom.c +++ b/target/linux/brcm-2.4/files/arch/mips/bcm947xx/prom.c @@ -31,6 +31,15 @@ prom_init(int argc, const char **argv) *(unsigned long *)(prom_init)) break; } + + /* Ignoring the last page when ddr size is 128M. Cached + * accesses to last page is causing the processor to prefetch + * using address above 128M stepping out of the ddr address + * space. + */ + if (mem == 0x8000000) + mem -= 0x1000; + add_memory_region(0, mem, BOOT_MEM_RAM); } diff --git a/target/linux/brcm47xx/patches-2.6.28/170-128MB_ram_bugfix.patch b/target/linux/brcm47xx/patches-2.6.28/170-128MB_ram_bugfix.patch new file mode 100644 index 000000000..e54e3de40 --- /dev/null +++ b/target/linux/brcm47xx/patches-2.6.28/170-128MB_ram_bugfix.patch @@ -0,0 +1,17 @@ +--- a/arch/mips/bcm47xx/prom.c ++++ b/arch/mips/bcm47xx/prom.c +@@ -141,6 +141,14 @@ static __init void prom_init_mem(void) + break; + } + ++ /* Ignoring the last page when ddr size is 128M. Cached ++ * accesses to last page is causing the processor to prefetch ++ * using address above 128M stepping out of the ddr address ++ * space. ++ */ ++ if (mem == 0x8000000) ++ mem -= 0x1000; ++ + add_memory_region(0, mem, BOOT_MEM_RAM); + } + diff --git a/target/linux/brcm47xx/patches-2.6.30/170-128MB_ram_bugfix.patch b/target/linux/brcm47xx/patches-2.6.30/170-128MB_ram_bugfix.patch new file mode 100644 index 000000000..e54e3de40 --- /dev/null +++ b/target/linux/brcm47xx/patches-2.6.30/170-128MB_ram_bugfix.patch @@ -0,0 +1,17 @@ +--- a/arch/mips/bcm47xx/prom.c ++++ b/arch/mips/bcm47xx/prom.c +@@ -141,6 +141,14 @@ static __init void prom_init_mem(void) + break; + } + ++ /* Ignoring the last page when ddr size is 128M. Cached ++ * accesses to last page is causing the processor to prefetch ++ * using address above 128M stepping out of the ddr address ++ * space. ++ */ ++ if (mem == 0x8000000) ++ mem -= 0x1000; ++ + add_memory_region(0, mem, BOOT_MEM_RAM); + } + diff --git a/target/linux/brcm47xx/patches-2.6.31/170-128MB_ram_bugfix.patch b/target/linux/brcm47xx/patches-2.6.31/170-128MB_ram_bugfix.patch new file mode 100644 index 000000000..e54e3de40 --- /dev/null +++ b/target/linux/brcm47xx/patches-2.6.31/170-128MB_ram_bugfix.patch @@ -0,0 +1,17 @@ +--- a/arch/mips/bcm47xx/prom.c ++++ b/arch/mips/bcm47xx/prom.c +@@ -141,6 +141,14 @@ static __init void prom_init_mem(void) + break; + } + ++ /* Ignoring the last page when ddr size is 128M. Cached ++ * accesses to last page is causing the processor to prefetch ++ * using address above 128M stepping out of the ddr address ++ * space. ++ */ ++ if (mem == 0x8000000) ++ mem -= 0x1000; ++ + add_memory_region(0, mem, BOOT_MEM_RAM); + } + From 5a76cd437c8b0271c03ade8ad07335b2e8f590a3 Mon Sep 17 00:00:00 2001 From: nbd Date: Fri, 13 Nov 2009 22:54:31 +0000 Subject: [PATCH 159/288] make fpu emulation support configurable through kernel_menuconfig by adding a prompt for it git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18414 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../generic-2.6/patches-2.6.21/024-mips_disable_fpu.patch | 4 ++-- .../generic-2.6/patches-2.6.28/024-mips_disable_fpu.patch | 4 ++-- .../generic-2.6/patches-2.6.30/025-mips_disable_fpu.patch | 4 ++-- .../generic-2.6/patches-2.6.31/025-mips_disable_fpu.patch | 4 ++-- .../generic-2.6/patches-2.6.32/025-mips_disable_fpu.patch | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/target/linux/generic-2.6/patches-2.6.21/024-mips_disable_fpu.patch b/target/linux/generic-2.6/patches-2.6.21/024-mips_disable_fpu.patch index 477506962..eabc3bfcc 100644 --- a/target/linux/generic-2.6/patches-2.6.21/024-mips_disable_fpu.patch +++ b/target/linux/generic-2.6/patches-2.6.21/024-mips_disable_fpu.patch @@ -13,8 +13,8 @@ Signed-off-by: Florian Fainelli bool +config MIPS_FPU_EMU -+ bool -+ default n ++ bool "Enable FPU emulation" ++ default y + help + This option allows building a kernel with or without the Algorithmics + FPU emulator enabled. Turning off this option results in a kernel which diff --git a/target/linux/generic-2.6/patches-2.6.28/024-mips_disable_fpu.patch b/target/linux/generic-2.6/patches-2.6.28/024-mips_disable_fpu.patch index dfa4ba2e0..718d08dc3 100644 --- a/target/linux/generic-2.6/patches-2.6.28/024-mips_disable_fpu.patch +++ b/target/linux/generic-2.6/patches-2.6.28/024-mips_disable_fpu.patch @@ -13,8 +13,8 @@ Signed-off-by: Florian Fainelli bool +config MIPS_FPU_EMU -+ bool -+ default n ++ bool "Enable FPU emulation" ++ default y + help + This option allows building a kernel with or without the Algorithmics + FPU emulator enabled. Turning off this option results in a kernel which diff --git a/target/linux/generic-2.6/patches-2.6.30/025-mips_disable_fpu.patch b/target/linux/generic-2.6/patches-2.6.30/025-mips_disable_fpu.patch index a8ffc230d..47ff7073d 100644 --- a/target/linux/generic-2.6/patches-2.6.30/025-mips_disable_fpu.patch +++ b/target/linux/generic-2.6/patches-2.6.30/025-mips_disable_fpu.patch @@ -13,8 +13,8 @@ Signed-off-by: Florian Fainelli bool +config MIPS_FPU_EMU -+ bool -+ default n ++ bool "Enable FPU emulation" ++ default y + help + This option allows building a kernel with or without the Algorithmics + FPU emulator enabled. Turning off this option results in a kernel which diff --git a/target/linux/generic-2.6/patches-2.6.31/025-mips_disable_fpu.patch b/target/linux/generic-2.6/patches-2.6.31/025-mips_disable_fpu.patch index 6a52adafe..37d64a95d 100644 --- a/target/linux/generic-2.6/patches-2.6.31/025-mips_disable_fpu.patch +++ b/target/linux/generic-2.6/patches-2.6.31/025-mips_disable_fpu.patch @@ -13,8 +13,8 @@ Signed-off-by: Florian Fainelli bool +config MIPS_FPU_EMU -+ bool -+ default n ++ bool "Enable FPU emulation" ++ default y + help + This option allows building a kernel with or without the Algorithmics + FPU emulator enabled. Turning off this option results in a kernel which diff --git a/target/linux/generic-2.6/patches-2.6.32/025-mips_disable_fpu.patch b/target/linux/generic-2.6/patches-2.6.32/025-mips_disable_fpu.patch index 087a9a96a..200b750af 100644 --- a/target/linux/generic-2.6/patches-2.6.32/025-mips_disable_fpu.patch +++ b/target/linux/generic-2.6/patches-2.6.32/025-mips_disable_fpu.patch @@ -13,8 +13,8 @@ Signed-off-by: Florian Fainelli bool +config MIPS_FPU_EMU -+ bool -+ default n ++ bool "Enable FPU emulation" ++ default y + help + This option allows building a kernel with or without the Algorithmics + FPU emulator enabled. Turning off this option results in a kernel which From 8349d8219a99f52668f370bdb484a1c409f5d443 Mon Sep 17 00:00:00 2001 From: nbd Date: Sat, 14 Nov 2009 02:35:04 +0000 Subject: [PATCH 160/288] mac80211: update to 2009-11-13 and add some of my new performance improvement patches. fixes excessive cpu usage of hostapd in ap mode, should also fix the ath9k memleak git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18415 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/Makefile | 9 +- .../mac80211/patches/002-disable_rfkill.patch | 21 +- ...09-remove_mac80211_module_dependence.patch | 2 +- package/mac80211/patches/010-b43_config.patch | 4 +- ...1-ath9k-dont-register-leds-on-ar9100.patch | 4 +- .../patches/405-b43_locking_fix.patch | 23 - .../patches/500-4addr_bcast_fix.patch | 11 + .../mac80211/patches/500-nl80211_4addr.patch | 69 --- .../patches/510-mac80211_4addr_vlan.patch | 269 ---------- ...x.patch => 510-nl80211_vlan_add_fix.patch} | 0 .../mac80211/patches/520-driver_flags.patch | 27 + .../mac80211/patches/530-ath9k_cleanup.patch | 460 ++++++++++++++++++ .../patches/540-monitor_tx_status.patch | 14 + 13 files changed, 528 insertions(+), 385 deletions(-) delete mode 100644 package/mac80211/patches/405-b43_locking_fix.patch create mode 100644 package/mac80211/patches/500-4addr_bcast_fix.patch delete mode 100644 package/mac80211/patches/500-nl80211_4addr.patch delete mode 100644 package/mac80211/patches/510-mac80211_4addr_vlan.patch rename package/mac80211/patches/{520-nl80211_vlan_add_fix.patch => 510-nl80211_vlan_add_fix.patch} (100%) create mode 100644 package/mac80211/patches/520-driver_flags.patch create mode 100644 package/mac80211/patches/530-ath9k_cleanup.patch create mode 100644 package/mac80211/patches/540-monitor_tx_status.patch diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile index 13d1670a3..e4e9b7b54 100644 --- a/package/mac80211/Makefile +++ b/package/mac80211/Makefile @@ -10,12 +10,12 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=2009-11-03 -PKG_RELEASE:=2 +PKG_VERSION:=2009-11-13 +PKG_RELEASE:=1 PKG_SOURCE_URL:= \ http://www.orbit-lab.org/kernel/compat-wireless-2.6/2009/11 \ http://wireless.kernel.org/download/compat-wireless-2.6 -PKG_MD5SUM:=f8434790c9552abb9c98926d7ae616fe +PKG_MD5SUM:=920c3bcfd1b4cd6079a8f9db4afe4e4f PKG_SOURCE:=compat-wireless-$(PKG_VERSION).tar.bz2 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION) @@ -323,9 +323,10 @@ define KernelPackage/ath9k URL:=http://linuxwireless.org/en/users/Drivers/ath9k DEPENDS+= +kmod-ath FILES:= \ + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.$(LINUX_KMOD_SUFFIX) \ $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.$(LINUX_KMOD_SUFFIX) \ $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.$(LINUX_KMOD_SUFFIX) - AUTOLOAD:=$(call AutoLoad,27,ath9k_hw ath9k) + AUTOLOAD:=$(call AutoLoad,27,ath9k_hw ath9k_common ath9k) endef define KernelPackage/ath9k/description diff --git a/package/mac80211/patches/002-disable_rfkill.patch b/package/mac80211/patches/002-disable_rfkill.patch index 0140ea264..3aab62970 100644 --- a/package/mac80211/patches/002-disable_rfkill.patch +++ b/package/mac80211/patches/002-disable_rfkill.patch @@ -1,6 +1,6 @@ --- a/config.mk +++ b/config.mk -@@ -145,7 +145,7 @@ ifneq ($(CONFIG_PCI),) +@@ -147,7 +147,7 @@ ifneq ($(CONFIG_PCI),) CONFIG_ATH5K=m # CONFIG_ATH5K_DEBUG=y @@ -8,8 +8,8 @@ +# CONFIG_ATH5K_RFKILL=y CONFIG_ATH9K_HW=m CONFIG_ATH9K=m - # CONFIG_ATH9K_DEBUG=y -@@ -153,7 +153,7 @@ CONFIG_ATH9K=m + # Note: once ath9k_htc is added we'll have to move +@@ -159,7 +159,7 @@ CONFIG_ATH9K_COMMON=m CONFIG_IWLWIFI=m CONFIG_IWLWIFI_LEDS=y @@ -18,7 +18,7 @@ CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT=y # CONFIG_IWLWIFI_DEBUG=y # CONFIG_IWLWIFI_DEBUGFS=y -@@ -173,7 +173,7 @@ CONFIG_B43_PCMCIA=y +@@ -179,7 +179,7 @@ CONFIG_B43_PCMCIA=y endif CONFIG_B43_PIO=y CONFIG_B43_LEDS=y @@ -27,7 +27,7 @@ CONFIG_B43_PHY_LP=y # CONFIG_B43_DEBUG=y # CONFIG_B43_FORCE_PIO=y -@@ -183,7 +183,7 @@ CONFIG_B43LEGACY_HWRNG=y +@@ -189,7 +189,7 @@ CONFIG_B43LEGACY_HWRNG=y CONFIG_B43LEGACY_PCI_AUTOSELECT=y CONFIG_B43LEGACY_PCICORE_AUTOSELECT=y CONFIG_B43LEGACY_LEDS=y @@ -36,16 +36,7 @@ # CONFIG_B43LEGACY_DEBUG=y CONFIG_B43LEGACY_DMA=y CONFIG_B43LEGACY_PIO=y -@@ -373,7 +373,7 @@ CONFIG_RT2X00_LIB=m - CONFIG_RT2X00_LIB_HT=y - CONFIG_RT2X00_LIB_FIRMWARE=y - CONFIG_RT2X00_LIB_CRYPTO=y --CONFIG_RT2X00_LIB_RFKILL=y -+# CONFIG_RT2X00_LIB_RFKILL=y - CONFIG_RT2X00_LIB_LEDS=y - # CONFIG_RT2X00_LIB_DEBUGFS=y - # CONFIG_RT2X00_DEBUG=y -@@ -415,8 +415,8 @@ endif +@@ -422,8 +422,8 @@ endif # We need the backported rfkill module on kernel < 2.6.31. # In more recent kernel versions use the in kernel rfkill module. ifdef CONFIG_COMPAT_WIRELESS_31 diff --git a/package/mac80211/patches/009-remove_mac80211_module_dependence.patch b/package/mac80211/patches/009-remove_mac80211_module_dependence.patch index d1c91594a..14d42904a 100644 --- a/package/mac80211/patches/009-remove_mac80211_module_dependence.patch +++ b/package/mac80211/patches/009-remove_mac80211_module_dependence.patch @@ -1,6 +1,6 @@ --- a/config.mk +++ b/config.mk -@@ -47,21 +47,6 @@ $(error "ERROR: Your 2.6.27 kernel has C +@@ -49,21 +49,6 @@ $(error "ERROR: Your 2.6.27 kernel has C endif endif diff --git a/package/mac80211/patches/010-b43_config.patch b/package/mac80211/patches/010-b43_config.patch index ba97e7602..9074ee787 100644 --- a/package/mac80211/patches/010-b43_config.patch +++ b/package/mac80211/patches/010-b43_config.patch @@ -1,6 +1,6 @@ --- a/config.mk +++ b/config.mk -@@ -154,12 +154,12 @@ CONFIG_B43_HWRNG=y +@@ -160,12 +160,12 @@ CONFIG_B43_HWRNG=y CONFIG_B43_PCI_AUTOSELECT=y CONFIG_B43_PCICORE_AUTOSELECT=y ifneq ($(CONFIG_PCMCIA),) @@ -16,7 +16,7 @@ # CONFIG_B43_DEBUG=y # CONFIG_B43_FORCE_PIO=y -@@ -208,8 +208,8 @@ CONFIG_SSB_PCIHOST_POSSIBLE=y +@@ -219,8 +219,8 @@ CONFIG_SSB_PCIHOST_POSSIBLE=y CONFIG_SSB_PCIHOST=y CONFIG_SSB_B43_PCI_BRIDGE=y ifneq ($(CONFIG_PCMCIA),) diff --git a/package/mac80211/patches/401-ath9k-dont-register-leds-on-ar9100.patch b/package/mac80211/patches/401-ath9k-dont-register-leds-on-ar9100.patch index b458dde6d..2a9bdc8b2 100644 --- a/package/mac80211/patches/401-ath9k-dont-register-leds-on-ar9100.patch +++ b/package/mac80211/patches/401-ath9k-dont-register-leds-on-ar9100.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -1135,6 +1135,9 @@ static void ath_unregister_led(struct at +@@ -1139,6 +1139,9 @@ static void ath_unregister_led(struct at static void ath_deinit_leds(struct ath_softc *sc) { @@ -10,7 +10,7 @@ ath_unregister_led(&sc->assoc_led); sc->sc_flags &= ~SC_OP_LED_ASSOCIATED; ath_unregister_led(&sc->tx_led); -@@ -1153,6 +1156,9 @@ static void ath_init_leds(struct ath_sof +@@ -1157,6 +1160,9 @@ static void ath_init_leds(struct ath_sof else sc->sc_ah->led_pin = ATH_LED_PIN_DEF; diff --git a/package/mac80211/patches/405-b43_locking_fix.patch b/package/mac80211/patches/405-b43_locking_fix.patch deleted file mode 100644 index c90890a7a..000000000 --- a/package/mac80211/patches/405-b43_locking_fix.patch +++ /dev/null @@ -1,23 +0,0 @@ -Subject: [PATCH] b43: work around a locking issue in ->set_tim() - -ops->set_tim() must be atomic, so b43 trying to acquire a mutex leads -to a kernel crash. This patch trades an easy to trigger crash in AP -mode for an unlikely race condition. According to Michael, the real -fix would be to allow set_tim() callbacks to sleep, since b43 is -not the only driver that needs to sleep in all callbacks. - -Signed-off-by: Felix Fietkau - ---- a/drivers/net/wireless/b43/main.c -+++ b/drivers/net/wireless/b43/main.c -@@ -4534,9 +4534,8 @@ static int b43_op_beacon_set_tim(struct - { - struct b43_wl *wl = hw_to_b43_wl(hw); - -- mutex_lock(&wl->mutex); -+ /* FIXME: add locking */ - b43_update_templates(wl); -- mutex_unlock(&wl->mutex); - - return 0; - } diff --git a/package/mac80211/patches/500-4addr_bcast_fix.patch b/package/mac80211/patches/500-4addr_bcast_fix.patch new file mode 100644 index 000000000..3143aaf8f --- /dev/null +++ b/package/mac80211/patches/500-4addr_bcast_fix.patch @@ -0,0 +1,11 @@ +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -1236,7 +1236,7 @@ ieee80211_deliver_skb(struct ieee80211_r + if ((sdata->vif.type == NL80211_IFTYPE_AP || + sdata->vif.type == NL80211_IFTYPE_AP_VLAN) && + !(sdata->flags & IEEE80211_SDATA_DONT_BRIDGE_PACKETS) && +- (rx->flags & IEEE80211_RX_RA_MATCH)) { ++ (rx->flags & IEEE80211_RX_RA_MATCH) && !rx->sdata->use_4addr) { + if (is_multicast_ether_addr(ehdr->h_dest)) { + /* + * send multicast frames both to higher layers in diff --git a/package/mac80211/patches/500-nl80211_4addr.patch b/package/mac80211/patches/500-nl80211_4addr.patch deleted file mode 100644 index de3b78fdb..000000000 --- a/package/mac80211/patches/500-nl80211_4addr.patch +++ /dev/null @@ -1,69 +0,0 @@ ---- a/include/linux/nl80211.h -+++ b/include/linux/nl80211.h -@@ -584,6 +584,8 @@ enum nl80211_commands { - * changed then the list changed and the dump should be repeated - * completely from scratch. - * -+ * @NL80211_ATTR_4ADDR: Use 4-address frames on a virtual interface -+ * - * @NL80211_ATTR_MAX: highest attribute number currently defined - * @__NL80211_ATTR_AFTER_LAST: internal use - */ -@@ -714,6 +716,8 @@ enum nl80211_attrs { - - NL80211_ATTR_PID, - -+ NL80211_ATTR_4ADDR, -+ - /* add attributes here, update the policy in nl80211.c */ - - __NL80211_ATTR_AFTER_LAST, ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -207,10 +207,12 @@ struct ieee80211_supported_band { - * struct vif_params - describes virtual interface parameters - * @mesh_id: mesh ID to use - * @mesh_id_len: length of the mesh ID -+ * @use_4addr: use 4-address frames - */ - struct vif_params { - u8 *mesh_id; - int mesh_id_len; -+ int use_4addr; - }; - - /** ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -140,6 +140,7 @@ static struct nla_policy nl80211_policy[ - [NL80211_ATTR_CIPHER_SUITE_GROUP] = { .type = NLA_U32 }, - [NL80211_ATTR_WPA_VERSIONS] = { .type = NLA_U32 }, - [NL80211_ATTR_PID] = { .type = NLA_U32 }, -+ [NL80211_ATTR_4ADDR] = { .type = NLA_U8 }, - }; - - /* policy for the attributes */ -@@ -989,6 +990,13 @@ static int nl80211_set_interface(struct - change = true; - } - -+ if (info->attrs[NL80211_ATTR_4ADDR]) { -+ params.use_4addr = !!nla_get_u8(info->attrs[NL80211_ATTR_4ADDR]); -+ change = true; -+ } else { -+ params.use_4addr = -1; -+ } -+ - if (info->attrs[NL80211_ATTR_MNTR_FLAGS]) { - if (ntype != NL80211_IFTYPE_MONITOR) { - err = -EINVAL; -@@ -1055,6 +1063,9 @@ static int nl80211_new_interface(struct - params.mesh_id_len = nla_len(info->attrs[NL80211_ATTR_MESH_ID]); - } - -+ if (info->attrs[NL80211_ATTR_4ADDR]) -+ params.use_4addr = !!nla_get_u8(info->attrs[NL80211_ATTR_4ADDR]); -+ - err = parse_monitor_flags(type == NL80211_IFTYPE_MONITOR ? - info->attrs[NL80211_ATTR_MNTR_FLAGS] : NULL, - &flags); diff --git a/package/mac80211/patches/510-mac80211_4addr_vlan.patch b/package/mac80211/patches/510-mac80211_4addr_vlan.patch deleted file mode 100644 index d3d1e8293..000000000 --- a/package/mac80211/patches/510-mac80211_4addr_vlan.patch +++ /dev/null @@ -1,269 +0,0 @@ ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -208,6 +208,9 @@ struct ieee80211_if_wds { - - struct ieee80211_if_vlan { - struct list_head list; -+ -+ /* used for all tx if the VLAN is configured to 4-addr mode */ -+ struct sta_info *sta; - }; - - struct mesh_stats { -@@ -457,6 +460,8 @@ struct ieee80211_sub_if_data { - int force_unicast_rateidx; /* forced TX rateidx for unicast frames */ - int max_ratectrl_rateidx; /* max TX rateidx for rate control */ - -+ bool use_4addr; /* use 4-address frames */ -+ - union { - struct ieee80211_if_ap ap; - struct ieee80211_if_wds wds; ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -36,6 +36,24 @@ static bool nl80211_type_check(enum nl80 - } - } - -+static bool nl80211_params_check(enum nl80211_iftype type, -+ struct vif_params *params) -+{ -+ if (!nl80211_type_check(type)) -+ return false; -+ -+ if (params->use_4addr > 0) { -+ switch(type) { -+ case NL80211_IFTYPE_AP_VLAN: -+ case NL80211_IFTYPE_STATION: -+ break; -+ default: -+ return false; -+ } -+ } -+ return true; -+} -+ - static int ieee80211_add_iface(struct wiphy *wiphy, char *name, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params) -@@ -45,7 +63,7 @@ static int ieee80211_add_iface(struct wi - struct ieee80211_sub_if_data *sdata; - int err; - -- if (!nl80211_type_check(type)) -+ if (!nl80211_params_check(type, params)) - return -EINVAL; - - err = ieee80211_if_add(local, name, &dev, type, params); -@@ -75,7 +93,7 @@ static int ieee80211_change_iface(struct - if (netif_running(dev)) - return -EBUSY; - -- if (!nl80211_type_check(type)) -+ if (!nl80211_params_check(type, params)) - return -EINVAL; - - sdata = IEEE80211_DEV_TO_SUB_IF(dev); -@@ -89,6 +107,9 @@ static int ieee80211_change_iface(struct - params->mesh_id_len, - params->mesh_id); - -+ if (params->use_4addr >= 0) -+ sdata->use_4addr = !!params->use_4addr; -+ - if (sdata->vif.type != NL80211_IFTYPE_MONITOR || !flags) - return 0; - -@@ -806,6 +827,13 @@ static int ieee80211_change_station(stru - return -EINVAL; - } - -+ if (vlansdata->use_4addr) { -+ if (vlansdata->u.vlan.sta) -+ return -EBUSY; -+ -+ rcu_assign_pointer(vlansdata->u.vlan.sta, sta); -+ } -+ - sta->sdata = vlansdata; - ieee80211_send_layer2_update(sta); - } ---- a/net/mac80211/sta_info.c -+++ b/net/mac80211/sta_info.c -@@ -489,6 +489,9 @@ static void __sta_info_unlink(struct sta - local->num_sta--; - local->sta_generation++; - -+ if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) -+ rcu_assign_pointer(sdata->u.vlan.sta, NULL); -+ - if (local->ops->sta_notify) { - if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) - sdata = container_of(sdata->bss, ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -1046,7 +1046,10 @@ ieee80211_tx_prepare(struct ieee80211_su - - hdr = (struct ieee80211_hdr *) skb->data; - -- tx->sta = sta_info_get(local, hdr->addr1); -+ if ((sdata->vif.type == NL80211_IFTYPE_AP_VLAN) && sdata->use_4addr) -+ tx->sta = rcu_dereference(sdata->u.vlan.sta); -+ if (!tx->sta) -+ tx->sta = sta_info_get(local, hdr->addr1); - - if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) && - (local->hw.flags & IEEE80211_HW_AMPDU_AGGREGATION)) { -@@ -1608,7 +1611,7 @@ netdev_tx_t ieee80211_subif_start_xmit(s - const u8 *encaps_data; - int encaps_len, skip_header_bytes; - int nh_pos, h_pos; -- struct sta_info *sta; -+ struct sta_info *sta = NULL; - u32 sta_flags = 0; - - if (unlikely(skb->len < ETH_HLEN)) { -@@ -1625,8 +1628,25 @@ netdev_tx_t ieee80211_subif_start_xmit(s - fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA); - - switch (sdata->vif.type) { -- case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_AP_VLAN: -+ rcu_read_lock(); -+ if (sdata->use_4addr) -+ sta = rcu_dereference(sdata->u.vlan.sta); -+ if (sta) { -+ fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); -+ /* RA TA DA SA */ -+ memcpy(hdr.addr1, sta->sta.addr, ETH_ALEN); -+ memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN); -+ memcpy(hdr.addr3, skb->data, ETH_ALEN); -+ memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); -+ hdrlen = 30; -+ sta_flags = get_sta_flags(sta); -+ } -+ rcu_read_unlock(); -+ if (sta) -+ break; -+ /* fall through */ -+ case NL80211_IFTYPE_AP: - fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS); - /* DA BSSID SA */ - memcpy(hdr.addr1, skb->data, ETH_ALEN); -@@ -1700,12 +1720,21 @@ netdev_tx_t ieee80211_subif_start_xmit(s - break; - #endif - case NL80211_IFTYPE_STATION: -- fc |= cpu_to_le16(IEEE80211_FCTL_TODS); -- /* BSSID SA DA */ - memcpy(hdr.addr1, sdata->u.mgd.bssid, ETH_ALEN); -- memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); -- memcpy(hdr.addr3, skb->data, ETH_ALEN); -- hdrlen = 24; -+ if (sdata->use_4addr && ethertype != ETH_P_PAE) { -+ fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); -+ /* RA TA DA SA */ -+ memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN); -+ memcpy(hdr.addr3, skb->data, ETH_ALEN); -+ memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); -+ hdrlen = 30; -+ } else { -+ fc |= cpu_to_le16(IEEE80211_FCTL_TODS); -+ /* BSSID SA DA */ -+ memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); -+ memcpy(hdr.addr3, skb->data, ETH_ALEN); -+ hdrlen = 24; -+ } - break; - case NL80211_IFTYPE_ADHOC: - /* DA SA BSSID */ ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -772,6 +772,7 @@ int ieee80211_if_change_type(struct ieee - ieee80211_mandatory_rates(sdata->local, - sdata->local->hw.conf.channel->band); - sdata->drop_unencrypted = 0; -+ sdata->use_4addr = 0; - - return 0; - } -@@ -853,6 +854,9 @@ int ieee80211_if_add(struct ieee80211_lo - params->mesh_id_len, - params->mesh_id); - -+ if (params && params->use_4addr >= 0) -+ sdata->use_4addr = !!params->use_4addr; -+ - mutex_lock(&local->iflist_mtx); - list_add_tail_rcu(&sdata->list, &local->interfaces); - mutex_unlock(&local->iflist_mtx); ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -1237,6 +1237,13 @@ __ieee80211_data_to_8023(struct ieee8021 - { - struct net_device *dev = rx->dev; - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); -+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; -+ -+ if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && !sdata->use_4addr && -+ ieee80211_has_a4(hdr->frame_control)) -+ return -1; -+ if (sdata->use_4addr && is_multicast_ether_addr(hdr->addr1)) -+ return -1; - - return ieee80211_data_to_8023(rx->skb, dev->dev_addr, sdata->vif.type); - } -@@ -1285,7 +1292,7 @@ ieee80211_deliver_skb(struct ieee80211_r - if ((sdata->vif.type == NL80211_IFTYPE_AP || - sdata->vif.type == NL80211_IFTYPE_AP_VLAN) && - !(sdata->flags & IEEE80211_SDATA_DONT_BRIDGE_PACKETS) && -- (rx->flags & IEEE80211_RX_RA_MATCH)) { -+ (rx->flags & IEEE80211_RX_RA_MATCH) && !rx->sdata->use_4addr) { - if (is_multicast_ether_addr(ehdr->h_dest)) { - /* - * send multicast frames both to higher layers in -@@ -1590,6 +1597,7 @@ ieee80211_rx_h_data(struct ieee80211_rx_ - { - struct net_device *dev = rx->dev; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; -+ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - __le16 fc = hdr->frame_control; - int err; - -@@ -1599,6 +1607,14 @@ ieee80211_rx_h_data(struct ieee80211_rx_ - if (unlikely(!ieee80211_is_data_present(hdr->frame_control))) - return RX_DROP_MONITOR; - -+ /* -+ * Allow the cooked monitor interface of an AP to see 4-addr frames so -+ * that a 4-addr station can be detected and moved into a separate VLAN -+ */ -+ if (ieee80211_has_a4(hdr->frame_control) && -+ sdata->vif.type == NL80211_IFTYPE_AP) -+ return RX_DROP_MONITOR; -+ - err = __ieee80211_data_to_8023(rx); - if (unlikely(err)) - return RX_DROP_UNUSABLE; -@@ -2039,7 +2055,7 @@ static int prepare_for_handlers(struct i - - switch (sdata->vif.type) { - case NL80211_IFTYPE_STATION: -- if (!bssid) -+ if (!bssid && !sdata->use_4addr) - return 0; - if (!multicast && - compare_ether_addr(sdata->dev->dev_addr, hdr->addr1) != 0) { ---- a/net/wireless/util.c -+++ b/net/wireless/util.c -@@ -320,7 +320,9 @@ int ieee80211_data_to_8023(struct sk_buf - break; - case cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS): - if (unlikely(iftype != NL80211_IFTYPE_WDS && -- iftype != NL80211_IFTYPE_MESH_POINT)) -+ iftype != NL80211_IFTYPE_MESH_POINT && -+ iftype != NL80211_IFTYPE_AP_VLAN && -+ iftype != NL80211_IFTYPE_STATION)) - return -1; - if (iftype == NL80211_IFTYPE_MESH_POINT) { - struct ieee80211s_hdr *meshdr = diff --git a/package/mac80211/patches/520-nl80211_vlan_add_fix.patch b/package/mac80211/patches/510-nl80211_vlan_add_fix.patch similarity index 100% rename from package/mac80211/patches/520-nl80211_vlan_add_fix.patch rename to package/mac80211/patches/510-nl80211_vlan_add_fix.patch diff --git a/package/mac80211/patches/520-driver_flags.patch b/package/mac80211/patches/520-driver_flags.patch new file mode 100644 index 000000000..2dc2092b1 --- /dev/null +++ b/package/mac80211/patches/520-driver_flags.patch @@ -0,0 +1,27 @@ +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -386,11 +386,12 @@ struct ieee80211_tx_rate { + * @flags: transmit info flags, defined above + * @band: the band to transmit on (use for checking for races) + * @antenna_sel_tx: antenna to use, 0 for automatic diversity ++ * @driver_flags: flags for internal driver use + * @pad: padding, ignore + * @control: union for control data + * @status: union for status data + * @driver_data: array of driver_data pointers +- * @ampdu_ack_len: number of aggregated frames. ++ * @ampdu_ack_len: number of acked aggregated frames. + * relevant only if IEEE80211_TX_STATUS_AMPDU was set. + * @ampdu_ack_map: block ack bit map for the aggregation. + * relevant only if IEEE80211_TX_STATUS_AMPDU was set. +@@ -403,8 +404,8 @@ struct ieee80211_tx_info { + + u8 antenna_sel_tx; + +- /* 2 byte hole */ +- u8 pad[2]; ++ u8 driver_flags; ++ u8 ampdu_len; + + union { + struct { diff --git a/package/mac80211/patches/530-ath9k_cleanup.patch b/package/mac80211/patches/530-ath9k_cleanup.patch new file mode 100644 index 000000000..49a1143ab --- /dev/null +++ b/package/mac80211/patches/530-ath9k_cleanup.patch @@ -0,0 +1,460 @@ +--- a/drivers/net/wireless/ath/ath9k/common.h ++++ b/drivers/net/wireless/ath/ath9k/common.h +@@ -81,6 +81,7 @@ struct ath_buf { + u16 bf_flags; + struct ath_buf_state bf_state; + dma_addr_t bf_dmacontext; ++ struct ath_wiphy *aphy; + }; + + struct ath_atx_tid { +--- a/drivers/net/wireless/ath/ath9k/rc.h ++++ b/drivers/net/wireless/ath/ath9k/rc.h +@@ -167,24 +167,18 @@ struct ath_rate_priv { + struct ath_rate_softc *asc; + }; + ++#define ATH_TX_INFO_FRAME_TYPE_INTERNAL (1 << 0) ++#define ATH_TX_INFO_FRAME_TYPE_PAUSE (1 << 1) ++#define ATH_TX_INFO_UPDATE_RC (1 << 2) ++#define ATH_TX_INFO_XRETRY (1 << 3) ++#define ATH_TX_INFO_UNDERRUN (1 << 4) ++ + enum ath9k_internal_frame_type { + ATH9K_NOT_INTERNAL, + ATH9K_INT_PAUSE, + ATH9K_INT_UNPAUSE + }; + +-struct ath_tx_info_priv { +- struct ath_wiphy *aphy; +- struct ath_tx_status tx; +- int n_frames; +- int n_bad_frames; +- bool update_rc; +- enum ath9k_internal_frame_type frame_type; +-}; +- +-#define ATH_TX_INFO_PRIV(tx_info) \ +- ((struct ath_tx_info_priv *)((tx_info)->rate_driver_data[0])) +- + void ath_rate_attach(struct ath_softc *sc); + u8 ath_rate_findrateix(struct ath_softc *sc, u8 dot11_rate); + int ath_rate_control_register(void); +--- a/drivers/net/wireless/ath/ath9k/virtual.c ++++ b/drivers/net/wireless/ath/ath9k/virtual.c +@@ -338,13 +338,11 @@ void ath9k_wiphy_chan_work(struct work_s + void ath9k_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) + { + struct ath_wiphy *aphy = hw->priv; +- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); +- struct ath_tx_info_priv *tx_info_priv = ATH_TX_INFO_PRIV(tx_info); + +- if (tx_info_priv && tx_info_priv->frame_type == ATH9K_INT_PAUSE && ++ if ((tx_info->driver_flags & ATH_TX_INFO_FRAME_TYPE_PAUSE) && + aphy->state == ATH_WIPHY_PAUSING) { +- if (!(info->flags & IEEE80211_TX_STAT_ACK)) { ++ if (!(tx_info->flags & IEEE80211_TX_STAT_ACK)) { + printk(KERN_DEBUG "ath9k: %s: no ACK for pause " + "frame\n", wiphy_name(hw->wiphy)); + /* +@@ -363,9 +361,6 @@ void ath9k_tx_status(struct ieee80211_hw + } + } + +- kfree(tx_info_priv); +- tx_info->rate_driver_data[0] = NULL; +- + dev_kfree_skb(skb); + } + +--- a/drivers/net/wireless/ath/ath9k/xmit.c ++++ b/drivers/net/wireless/ath/ath9k/xmit.c +@@ -251,6 +251,7 @@ static struct ath_buf* ath_clone_txbuf(s + + ATH_TXBUF_RESET(tbf); + ++ tbf->aphy = bf->aphy; + tbf->bf_mpdu = bf->bf_mpdu; + tbf->bf_buf_addr = bf->bf_buf_addr; + *(tbf->bf_desc) = *(bf->bf_desc); +@@ -270,7 +271,6 @@ static void ath_tx_complete_aggr(struct + struct ieee80211_hw *hw; + struct ieee80211_hdr *hdr; + struct ieee80211_tx_info *tx_info; +- struct ath_tx_info_priv *tx_info_priv; + struct ath_atx_tid *tid = NULL; + struct ath_buf *bf_next, *bf_last = bf->bf_lastbf; + struct ath_desc *ds = bf_last->bf_desc; +@@ -284,8 +284,7 @@ static void ath_tx_complete_aggr(struct + hdr = (struct ieee80211_hdr *)skb->data; + + tx_info = IEEE80211_SKB_CB(skb); +- tx_info_priv = (struct ath_tx_info_priv *) tx_info->rate_driver_data[0]; +- hw = tx_info_priv->aphy->hw; ++ hw = bf->aphy->hw; + + rcu_read_lock(); + +@@ -464,7 +463,6 @@ static u32 ath_lookup_rate(struct ath_so + struct sk_buff *skb; + struct ieee80211_tx_info *tx_info; + struct ieee80211_tx_rate *rates; +- struct ath_tx_info_priv *tx_info_priv; + u32 max_4ms_framelen, frmlen; + u16 aggr_limit, legacy = 0; + int i; +@@ -472,7 +470,6 @@ static u32 ath_lookup_rate(struct ath_so + skb = bf->bf_mpdu; + tx_info = IEEE80211_SKB_CB(skb); + rates = tx_info->control.rates; +- tx_info_priv = (struct ath_tx_info_priv *)tx_info->rate_driver_data[0]; + + /* + * Find the lowest frame length among the rate series that will have a +@@ -1560,21 +1557,26 @@ static int ath_tx_setup_buffer(struct ie + struct ath_softc *sc = aphy->sc; + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; +- struct ath_tx_info_priv *tx_info_priv; + int hdrlen; + __le16 fc; + +- tx_info_priv = kzalloc(sizeof(*tx_info_priv), GFP_ATOMIC); +- if (unlikely(!tx_info_priv)) +- return -ENOMEM; +- tx_info->rate_driver_data[0] = tx_info_priv; +- tx_info_priv->aphy = aphy; +- tx_info_priv->frame_type = txctl->frame_type; ++ tx_info->driver_flags = 0; ++ switch (txctl->frame_type) { ++ case ATH9K_NOT_INTERNAL: ++ break; ++ case ATH9K_INT_PAUSE: ++ tx_info->driver_flags |= ATH_TX_INFO_FRAME_TYPE_PAUSE; ++ /* fall through */ ++ case ATH9K_INT_UNPAUSE: ++ tx_info->driver_flags |= ATH_TX_INFO_FRAME_TYPE_INTERNAL; ++ break; ++ } + hdrlen = ieee80211_get_hdrlen_from_skb(skb); + fc = hdr->frame_control; + + ATH_TXBUF_RESET(bf); + ++ bf->aphy = aphy; + bf->bf_frmlen = skb->len + FCS_LEN - (hdrlen & 3); + + if (conf_is_ht(&hw->conf) && !is_pae(skb)) +@@ -1599,8 +1601,6 @@ static int ath_tx_setup_buffer(struct ie + skb->len, DMA_TO_DEVICE); + if (unlikely(dma_mapping_error(sc->dev, bf->bf_dmacontext))) { + bf->bf_mpdu = NULL; +- kfree(tx_info_priv); +- tx_info->rate_driver_data[0] = NULL; + ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, + "dma_mapping_error() on TX\n"); + return -ENOMEM; +@@ -1781,27 +1781,17 @@ exit: + /*****************/ + + static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, +- int tx_flags) ++ struct ath_wiphy *aphy, int tx_flags) + { + struct ieee80211_hw *hw = sc->hw; + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); +- struct ath_tx_info_priv *tx_info_priv = ATH_TX_INFO_PRIV(tx_info); + struct ath_common *common = ath9k_hw_common(sc->sc_ah); + int hdrlen, padsize; +- int frame_type = ATH9K_NOT_INTERNAL; + + ath_print(common, ATH_DBG_XMIT, "TX complete: skb: %p\n", skb); + +- if (tx_info_priv) { +- hw = tx_info_priv->aphy->hw; +- frame_type = tx_info_priv->frame_type; +- } +- +- if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK || +- tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) { +- kfree(tx_info_priv); +- tx_info->rate_driver_data[0] = NULL; +- } ++ if (aphy) ++ hw = aphy->hw; + + if (tx_flags & ATH_TX_BAR) + tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; +@@ -1833,10 +1823,10 @@ static void ath_tx_complete(struct ath_s + SC_OP_WAIT_FOR_TX_ACK)); + } + +- if (frame_type == ATH9K_NOT_INTERNAL) +- ieee80211_tx_status(hw, skb); +- else ++ if (unlikely(tx_info->driver_flags & ATH_TX_INFO_FRAME_TYPE_INTERNAL)) + ath9k_tx_status(hw, skb); ++ else ++ ieee80211_tx_status(hw, skb); + } + + static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, +@@ -1859,7 +1849,7 @@ static void ath_tx_complete_buf(struct a + } + + dma_unmap_single(sc->dev, bf->bf_dmacontext, skb->len, DMA_TO_DEVICE); +- ath_tx_complete(sc, skb, tx_flags); ++ ath_tx_complete(sc, skb, bf->aphy, tx_flags); + ath_debug_stat_tx(sc, txq, bf); + + /* +@@ -1907,8 +1897,7 @@ static void ath_tx_rc_status(struct ath_ + struct sk_buff *skb = bf->bf_mpdu; + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); +- struct ath_tx_info_priv *tx_info_priv = ATH_TX_INFO_PRIV(tx_info); +- struct ieee80211_hw *hw = tx_info_priv->aphy->hw; ++ struct ieee80211_hw *hw = bf->aphy->hw; + u8 i, tx_rateindex; + + if (txok) +@@ -1917,17 +1906,22 @@ static void ath_tx_rc_status(struct ath_ + tx_rateindex = ds->ds_txstat.ts_rateindex; + WARN_ON(tx_rateindex >= hw->max_rates); + +- tx_info_priv->update_rc = update_rc; ++ if (update_rc) ++ tx_info->driver_flags |= ATH_TX_INFO_UPDATE_RC; + if (ds->ds_txstat.ts_status & ATH9K_TXERR_FILT) + tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED; + + if ((ds->ds_txstat.ts_status & ATH9K_TXERR_FILT) == 0 && + (bf->bf_flags & ATH9K_TXDESC_NOACK) == 0 && update_rc) { + if (ieee80211_is_data(hdr->frame_control)) { +- memcpy(&tx_info_priv->tx, &ds->ds_txstat, +- sizeof(tx_info_priv->tx)); +- tx_info_priv->n_frames = bf->bf_nframes; +- tx_info_priv->n_bad_frames = nbad; ++ if (ds->ds_txstat.ts_flags & ++ (ATH9K_TX_DATA_UNDERRUN | ATH9K_TX_DELIM_UNDERRUN)) ++ tx_info->driver_flags |= ATH_TX_INFO_UNDERRUN; ++ if ((ds->ds_txstat.ts_status & ATH9K_TXERR_XRETRY) || ++ (ds->ds_txstat.ts_status & ATH9K_TXERR_FIFO)) ++ tx_info->driver_flags |= ATH_TX_INFO_XRETRY; ++ tx_info->ampdu_len = bf->bf_nframes; ++ tx_info->status.ampdu_ack_len = bf->bf_nframes - nbad; + } + } + +--- a/drivers/net/wireless/ath/ath9k/debug.c ++++ b/drivers/net/wireless/ath/ath9k/debug.c +@@ -257,14 +257,17 @@ static const struct file_operations fops + + void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb) + { +- struct ath_tx_info_priv *tx_info_priv = NULL; + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); + struct ieee80211_tx_rate *rates = tx_info->status.rates; +- int final_ts_idx, idx; ++ int final_ts_idx = 0, idx, i; + struct ath_rc_stats *stats; + +- tx_info_priv = ATH_TX_INFO_PRIV(tx_info); +- final_ts_idx = tx_info_priv->tx.ts_rateindex; ++ for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { ++ if (!rates[i].count) ++ break; ++ ++ final_ts_idx = i; ++ } + idx = rates[final_ts_idx].idx; + stats = &sc->debug.stats.rcstats[idx]; + stats->success++; +--- a/drivers/net/wireless/ath/ath9k/rc.c ++++ b/drivers/net/wireless/ath/ath9k/rc.c +@@ -859,12 +859,12 @@ static void ath_get_rate(void *priv, str + static bool ath_rc_update_per(struct ath_softc *sc, + const struct ath_rate_table *rate_table, + struct ath_rate_priv *ath_rc_priv, +- struct ath_tx_info_priv *tx_info_priv, ++ struct ieee80211_tx_info *tx_info, + int tx_rate, int xretries, int retries, + u32 now_msec) + { + bool state_change = false; +- int count; ++ int count, n_bad_frames; + u8 last_per; + static u32 nretry_to_per_lookup[10] = { + 100 * 0 / 1, +@@ -880,6 +880,7 @@ static bool ath_rc_update_per(struct ath + }; + + last_per = ath_rc_priv->per[tx_rate]; ++ n_bad_frames = tx_info->ampdu_len - tx_info->status.ampdu_ack_len; + + if (xretries) { + if (xretries == 1) { +@@ -907,7 +908,7 @@ static bool ath_rc_update_per(struct ath + if (retries >= count) + retries = count - 1; + +- if (tx_info_priv->n_bad_frames) { ++ if (n_bad_frames) { + /* new_PER = 7/8*old_PER + 1/8*(currentPER) + * Assuming that n_frames is not 0. The current PER + * from the retries is 100 * retries / (retries+1), +@@ -920,14 +921,14 @@ static bool ath_rc_update_per(struct ath + * the above PER. The expression below is a + * simplified version of the sum of these two terms. + */ +- if (tx_info_priv->n_frames > 0) { +- int n_frames, n_bad_frames; ++ if (tx_info->ampdu_len > 0) { ++ int n_frames, n_bad_tries; + u8 cur_per, new_per; + +- n_bad_frames = retries * tx_info_priv->n_frames + +- tx_info_priv->n_bad_frames; +- n_frames = tx_info_priv->n_frames * (retries + 1); +- cur_per = (100 * n_bad_frames / n_frames) >> 3; ++ n_bad_tries = retries * tx_info->ampdu_len + ++ n_bad_frames; ++ n_frames = tx_info->ampdu_len * (retries + 1); ++ cur_per = (100 * n_bad_tries / n_frames) >> 3; + new_per = (u8)(last_per - (last_per >> 3) + cur_per); + ath_rc_priv->per[tx_rate] = new_per; + } +@@ -943,8 +944,7 @@ static bool ath_rc_update_per(struct ath + * this was a probe. Otherwise, ignore the probe. + */ + if (ath_rc_priv->probe_rate && ath_rc_priv->probe_rate == tx_rate) { +- if (retries > 0 || 2 * tx_info_priv->n_bad_frames > +- tx_info_priv->n_frames) { ++ if (retries > 0 || 2 * n_bad_frames > tx_info->ampdu_len) { + /* + * Since we probed with just a single attempt, + * any retries means the probe failed. Also, +@@ -1003,7 +1003,7 @@ static bool ath_rc_update_per(struct ath + + static void ath_rc_update_ht(struct ath_softc *sc, + struct ath_rate_priv *ath_rc_priv, +- struct ath_tx_info_priv *tx_info_priv, ++ struct ieee80211_tx_info *tx_info, + int tx_rate, int xretries, int retries) + { + u32 now_msec = jiffies_to_msecs(jiffies); +@@ -1020,7 +1020,7 @@ static void ath_rc_update_ht(struct ath_ + + /* Update PER first */ + state_change = ath_rc_update_per(sc, rate_table, ath_rc_priv, +- tx_info_priv, tx_rate, xretries, ++ tx_info, tx_rate, xretries, + retries, now_msec); + + /* +@@ -1098,7 +1098,6 @@ static void ath_rc_tx_status(struct ath_ + struct ieee80211_tx_info *tx_info, + int final_ts_idx, int xretries, int long_retry) + { +- struct ath_tx_info_priv *tx_info_priv = ATH_TX_INFO_PRIV(tx_info); + const struct ath_rate_table *rate_table; + struct ieee80211_tx_rate *rates = tx_info->status.rates; + u8 flags; +@@ -1124,9 +1123,8 @@ static void ath_rc_tx_status(struct ath_ + return; + + rix = ath_rc_get_rateindex(rate_table, &rates[i]); +- ath_rc_update_ht(sc, ath_rc_priv, +- tx_info_priv, rix, +- xretries ? 1 : 2, ++ ath_rc_update_ht(sc, ath_rc_priv, tx_info, ++ rix, xretries ? 1 : 2, + rates[i].count); + } + } +@@ -1149,8 +1147,7 @@ static void ath_rc_tx_status(struct ath_ + return; + + rix = ath_rc_get_rateindex(rate_table, &rates[i]); +- ath_rc_update_ht(sc, ath_rc_priv, tx_info_priv, rix, +- xretries, long_retry); ++ ath_rc_update_ht(sc, ath_rc_priv, tx_info, rix, xretries, long_retry); + } + + static const +@@ -1301,23 +1298,30 @@ static void ath_tx_status(void *priv, st + { + struct ath_softc *sc = priv; + struct ath_rate_priv *ath_rc_priv = priv_sta; +- struct ath_tx_info_priv *tx_info_priv = NULL; + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); + struct ieee80211_hdr *hdr; +- int final_ts_idx, tx_status = 0, is_underrun = 0; ++ int final_ts_idx = 0, tx_status = 0, is_underrun = 0; ++ int long_retry = 0; + __le16 fc; ++ int i; + + hdr = (struct ieee80211_hdr *)skb->data; + fc = hdr->frame_control; +- tx_info_priv = ATH_TX_INFO_PRIV(tx_info); +- final_ts_idx = tx_info_priv->tx.ts_rateindex; ++ for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { ++ struct ieee80211_tx_rate *rate = &tx_info->status.rates[i]; ++ if (!rate->count) ++ break; ++ ++ final_ts_idx = i; ++ long_retry = rate->count - 1; ++ } + + if (!priv_sta || !ieee80211_is_data(fc) || +- !tx_info_priv->update_rc) +- goto exit; ++ !(tx_info->driver_flags & ATH_TX_INFO_UPDATE_RC)) ++ return; + +- if (tx_info_priv->tx.ts_status & ATH9K_TXERR_FILT) +- goto exit; ++ if (tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) ++ return; + + /* + * If underrun error is seen assume it as an excessive retry only +@@ -1325,20 +1329,17 @@ static void ath_tx_status(void *priv, st + * Adjust the long retry as if the frame was tried hw->max_rate_tries + * times. This affects how ratectrl updates PER for the failed rate. + */ +- if (tx_info_priv->tx.ts_flags & +- (ATH9K_TX_DATA_UNDERRUN | ATH9K_TX_DELIM_UNDERRUN) && +- ((sc->sc_ah->tx_trig_level) >= ath_rc_priv->tx_triglevel_max)) { ++ if ((tx_info->driver_flags & ATH_TX_INFO_UNDERRUN) && ++ (sc->sc_ah->tx_trig_level >= ath_rc_priv->tx_triglevel_max)) { + tx_status = 1; + is_underrun = 1; + } + +- if ((tx_info_priv->tx.ts_status & ATH9K_TXERR_XRETRY) || +- (tx_info_priv->tx.ts_status & ATH9K_TXERR_FIFO)) ++ if (tx_info->driver_flags & ATH_TX_INFO_XRETRY) + tx_status = 1; + + ath_rc_tx_status(sc, ath_rc_priv, tx_info, final_ts_idx, tx_status, +- (is_underrun) ? sc->hw->max_rate_tries : +- tx_info_priv->tx.ts_longretry); ++ (is_underrun) ? sc->hw->max_rate_tries : long_retry); + + /* Check if aggregation has to be enabled for this tid */ + if (conf_is_ht(&sc->hw->conf) && +@@ -1357,8 +1358,6 @@ static void ath_tx_status(void *priv, st + } + + ath_debug_stat_rc(sc, skb); +-exit: +- kfree(tx_info_priv); + } + + static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband, diff --git a/package/mac80211/patches/540-monitor_tx_status.patch b/package/mac80211/patches/540-monitor_tx_status.patch new file mode 100644 index 000000000..b2a35de85 --- /dev/null +++ b/package/mac80211/patches/540-monitor_tx_status.patch @@ -0,0 +1,14 @@ +--- a/net/mac80211/main.c ++++ b/net/mac80211/main.c +@@ -587,6 +587,11 @@ void ieee80211_tx_status(struct ieee8021 + if (!netif_running(sdata->dev)) + continue; + ++ if ((sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) && ++ !(info->flags & IEEE80211_TX_CTL_INJECTED) && ++ (type == IEEE80211_FTYPE_DATA)) ++ continue; ++ + if (prev_dev) { + skb2 = skb_clone(skb, GFP_ATOMIC); + if (skb2) { From 477d4a83b3aa0ba9eb04e09c042dacc15b02aa02 Mon Sep 17 00:00:00 2001 From: nbd Date: Sat, 14 Nov 2009 02:55:48 +0000 Subject: [PATCH 161/288] e1000: add CONFIG_E1000_NAPI=y for older kernels git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18416 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/kernel/modules/netdevices.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/kernel/modules/netdevices.mk b/package/kernel/modules/netdevices.mk index 4f1f3cbd2..6871216ef 100644 --- a/package/kernel/modules/netdevices.mk +++ b/package/kernel/modules/netdevices.mk @@ -203,7 +203,8 @@ define KernelPackage/e1000 TITLE:=Intel(R) PRO/1000 PCI cards kernel support DEPENDS:=@PCI_SUPPORT KCONFIG:=CONFIG_E1000 \ - CONFIG_E1000_DISABLE_PACKET_SPLIT=n + CONFIG_E1000_DISABLE_PACKET_SPLIT=n \ + CONFIG_E1000_NAPI=y FILES:=$(LINUX_DIR)/drivers/net/e1000/e1000.$(LINUX_KMOD_SUFFIX) AUTOLOAD:=$(call AutoLoad,50,e1000) endef From 56262cd51c612efb6a1bd0749d17183d9f912087 Mon Sep 17 00:00:00 2001 From: hauke Date: Sat, 14 Nov 2009 12:21:25 +0000 Subject: [PATCH 162/288] [hostapd-utils] fix build of hostapd-utils This fixes #6158. Thank you Will Dyson for your patch. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18417 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/hostapd/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/hostapd/Makefile b/package/hostapd/Makefile index a39b0e243..5e10ea27b 100644 --- a/package/hostapd/Makefile +++ b/package/hostapd/Makefile @@ -125,7 +125,7 @@ endif define Package/hostapd-utils/install $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd_cli $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd_cli $(1)/usr/sbin/ endef $(eval $(call BuildPackage,hostapd)) From db196bcbf961bcc074d5e74fd58add2d0aa06d4c Mon Sep 17 00:00:00 2001 From: nbd Date: Sat, 14 Nov 2009 17:51:32 +0000 Subject: [PATCH 163/288] Add a target (CONFIG_MAKE_CONFIG) that creates an exportable toolchain. The toolchain will zipped and saved under $(TOPDIR)/bin directory. Signed-off-by: Luigi 'Comio' Mantellini git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18419 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Config.in | 1 + target/Makefile | 4 +- target/toolchain/Config.in | 6 ++ target/toolchain/Makefile | 53 ++++++++++++++ target/toolchain/files/README.TOOLCHAIN | 2 + toolchain/gcc/Makefile | 6 ++ toolchain/gcc/files/wrapper.sh | 91 +++++++++++++++++++++++++ 7 files changed, 161 insertions(+), 2 deletions(-) create mode 100644 target/toolchain/Config.in create mode 100644 target/toolchain/Makefile create mode 100644 target/toolchain/files/README.TOOLCHAIN create mode 100755 toolchain/gcc/files/wrapper.sh diff --git a/Config.in b/Config.in index ae1ba9ffe..3e8475cc3 100644 --- a/Config.in +++ b/Config.in @@ -329,6 +329,7 @@ source "toolchain/Config.in" source "target/imagebuilder/Config.in" source "target/sdk/Config.in" +source "target/toolchain/Config.in" source "tmp/.config-package.in" diff --git a/target/Makefile b/target/Makefile index 3d36d2671..ff547f606 100644 --- a/target/Makefile +++ b/target/Makefile @@ -6,9 +6,9 @@ # curdir:=target -$(curdir)/builddirs:=linux sdk imagebuilder +$(curdir)/builddirs:=linux sdk imagebuilder toolchain $(curdir)/builddirs-default:=linux -$(curdir)/builddirs-install:=linux $(if $(CONFIG_SDK),sdk) $(if $(CONFIG_IB),imagebuilder) +$(curdir)/builddirs-install:=linux $(if $(CONFIG_SDK),sdk) $(if $(CONFIG_IB),imagebuilder) $(if $(CONFIG_MAKE_TOOLCHAIN),toolchain) $(curdir)/imagebuilder/prepare:=$(curdir)/linux/install diff --git a/target/toolchain/Config.in b/target/toolchain/Config.in new file mode 100644 index 000000000..18c3ab544 --- /dev/null +++ b/target/toolchain/Config.in @@ -0,0 +1,6 @@ +config MAKE_TOOLCHAIN + bool "Build the OpenWrt based Toolchain" + depends !EXTERNAL_TOOLCHAIN + help + This is essentially the toolchain created by OpenWrt. + diff --git a/target/toolchain/Makefile b/target/toolchain/Makefile new file mode 100644 index 000000000..e9b452ec7 --- /dev/null +++ b/target/toolchain/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (C) 2008-2009 Industrie Dial Face S.p.A. +# Luigi 'Comio' Mantellini +# Copyright (C) 2006-2008 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk +include $(INCLUDE_DIR)/host.mk + +override MAKEFLAGS= + +PKG_OS:=$(shell uname -s) +PKG_CPU:=$(shell uname -m) + +TOOLCHAIN_NAME:=OpenWrt-Toolchain-$(BOARD)-for-$(ARCH)-gcc-$(GCCV)_$(LIBC)-$(LIBCV) +TOOLCHAIN_BUILD_DIR:=$(BUILD_DIR)/$(TOOLCHAIN_NAME) +EXCLUDE_DIRS:=*/ccache \ + */stamp \ + */stampfiles \ + */man \ + */info + +all: compile + +$(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2: clean + mkdir -p $(TOOLCHAIN_BUILD_DIR) + $(TAR) -cf - -C $(TOPDIR)/staging_dir/ \ + $(foreach exclude,$(EXCLUDE_DIRS),--exclude="$(exclude)") \ + toolchain-$(ARCH)_gcc-$(GCCV)_$(LIBC)-$(LIBCV) | \ + $(TAR) -xf - -C $(TOOLCHAIN_BUILD_DIR) + + $(CP) $(TOPDIR)/LICENSE ./files/README.TOOLCHAIN \ + $(TOOLCHAIN_BUILD_DIR)/ + + echo REVISION:="$(REVISION)" > $(TOOLCHAIN_BUILD_DIR)/version.mk + find $(TOOLCHAIN_BUILD_DIR) -name .git | $(XARGS) rm -rf + find $(TOOLCHAIN_BUILD_DIR) -name .svn | $(XARGS) rm -rf + find $(TOOLCHAIN_BUILD_DIR) -name CVS | $(XARGS) rm -rf + (cd $(BUILD_DIR); \ + tar cfj $@ $(TOOLCHAIN_NAME); \ + ) + +download: +prepare: +compile: $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2 +install: compile + +clean: + rm -rf $(TOOLCHAIN_BUILD_DIR) $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2 diff --git a/target/toolchain/files/README.TOOLCHAIN b/target/toolchain/files/README.TOOLCHAIN new file mode 100644 index 000000000..40bfccceb --- /dev/null +++ b/target/toolchain/files/README.TOOLCHAIN @@ -0,0 +1,2 @@ +This is the OpenWrt SDK. It contains just the toolchain created +by buildroot. diff --git a/toolchain/gcc/Makefile b/toolchain/gcc/Makefile index ea103c453..955248e81 100644 --- a/toolchain/gcc/Makefile +++ b/toolchain/gcc/Makefile @@ -246,6 +246,8 @@ define Stage2/Install $(GCC_MAKE) -C $(HOST_BUILD_DIR2) install # Set up the symlinks to enable lying about target name. set -e; \ + $(CP) ./files/wrapper.sh $(TOOLCHAIN_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh + chmod +x $(TOOLCHAIN_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh (cd $(TOOLCHAIN_DIR)/usr; \ ln -sf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \ cd bin; \ @@ -253,6 +255,10 @@ define Stage2/Install ln -sf $$$${app} \ $(GNU_TARGET_NAME)$$$${app##$(REAL_GNU_TARGET_NAME)}; \ done; \ + for app in cc gcc g++ c++ cpp ld as ; do \ + [ -f $(REAL_GNU_TARGET_NAME)-$$$${app} ] && mv $(REAL_GNU_TARGET_NAME)-$$$${app} $(REAL_GNU_TARGET_NAME)-$$$${app}.bin ; \ + ln -sf $(REAL_GNU_TARGET_NAME)-wrapper.sh $(REAL_GNU_TARGET_NAME)-$$$${app} ; \ + done; \ ); $(if $(CONFIG_EXTRA_TARGET_ARCH),$(call SetupExtraArch)) endef diff --git a/toolchain/gcc/files/wrapper.sh b/toolchain/gcc/files/wrapper.sh new file mode 100755 index 000000000..19e1863c2 --- /dev/null +++ b/toolchain/gcc/files/wrapper.sh @@ -0,0 +1,91 @@ +#!/bin/bash + +# 2009 (C) Copyright Industrie Dial Face S.p.A. +# Luigi 'Comio' Mantellini +# +# Based on original idea from WindRiver +# +# Toolchain wrapper script. +# +# This script allows us to use a small number of GCC / binutils cross-tools +# (one toolchain per instruction set architecture) to implement a larger +# number of processor- or board-specific tools. The wrapper script is +# configured at install time with information covering basic CFLAGS, +# LD options and the toolchain triplet name. +# + +PROGNAME=$0 +REALNAME=`readlink -f $0` + +REALNAME_BASE=`basename $REALNAME` +REALNAME_DIR=`dirname $REALNAME` + +TARGET_FUNDAMENTAL_ASFLAGS='' +TARGET_FUNDAMENTAL_CFLAGS='' +TARGET_ROOTFS_CFLAGS='' +TARGET_FUNDAMENTAL_LDFLAGS='' +TARGET_TOOLCHAIN_TRIPLET=${REALNAME_BASE%-*} + +# Parse our tool name, splitting it at '-' characters. +BINARY=${PROGNAME##*-} + +# Parse our tool name, splitting it at '-' characters. +IFS=- read TOOLCHAIN_ARCH TOOLCHAIN_BUILDROOT TOOLCHAIN_OS TOOLCHAIN_PLATFORM PROGNAME << EOF +$REALNAME_BASE +EOF + +# +# We add the directory this was executed from to the PATH +# The toolchains (links) should be in this directory or in the users +# PATH. +# +TOOLCHAIN_BIN_DIR="$REALNAME_DIR/" + +# Set the PATH so that our run-time location is first +# (get_feature is run from the path, so this has to be set) +export PATH="$TOOLCHAIN_BIN_DIR":$PATH +export GCC_HONOUR_COPTS + +TOOLCHAIN_SYSROOT="$TOOLCHAIN_BIN_DIR/../.." +if [ ! -d "$TOOLCHAIN_SYSROOT" ]; then + echo "Error: Unable to determine sysroot (looking for $TOOLCHAIN_SYSROOT)!" >&2 + exit 1 +fi + +# -Wl,--dynamic-linker=$TOOLCHAIN_SYSROOT/lib/ld-uClibc.so.0 +# --dynamic-linker=$TOOLCHAIN_SYSROOT/lib/ld-uClibc.so.0 + +case $TOOLCHAIN_PLATFORM in + gnu|glibc|eglibc) + GCC_SYSROOT_FLAGS="--sysroot=$TOOLCHAIN_SYSROOT -Wl,-rpath=$TOOLCHAIN_SYSROOT/lib:$TOOLCHAIN_SYSROOT/usr/lib" + LD_SYSROOT_FLAGS="-rpath=$TOOLCHAIN_SYSROOT/lib:$TOOLCHAIN_SYSROOT/usr/lib" + ;; + uclibc) + GCC_SYSROOT_FLAGS="--sysroot=$TOOLCHAIN_SYSROOT -Wl,-rpath=$TOOLCHAIN_SYSROOT/lib:$TOOLCHAIN_SYSROOT/usr/lib" + LD_SYSROOT_FLAGS="-rpath=$TOOLCHAIN_SYSROOT/lib:$TOOLCHAIN_SYSROOT/usr/lib" + ;; + *) + GCC_SYSROOT_FLAGS="" + LD_SYSROOT_FLAGS="" + ;; +esac + +# +# Run the cross-tool. +# +case $BINARY in + cc|gcc|g++|c++|cpp) + exec $TARGET_TOOLCHAIN_TRIPLET-$BINARY.bin $GCC_SYSROOT_FLAGS $TARGET_FUNDAMENTAL_CFLAGS $TARGET_ROOTFS_CFLAGS "$@" + ;; + ld) + exec $TARGET_TOOLCHAIN_TRIPLET-$BINARY.bin $LD_SYSROOT_FLAGS $TARGET_FUNDAMENTAL_LDFLAGS "$@" + ;; + as) + exec $TARGET_TOOLCHAIN_TRIPLET-$BINARY.bin $TARGET_FUNDAMENTAL_ASFLAGS "$@" + ;; + *) + exec $TARGET_TOOLCHAIN_TRIPLET-$BINARY.bin "$@" + ;; +esac + +exit 0 From 9c1ef4da062c4e947bd02d6132d18974befeb6e0 Mon Sep 17 00:00:00 2001 From: jow Date: Sat, 14 Nov 2009 21:32:30 +0000 Subject: [PATCH 164/288] [package] iproute2: honour when building libnetlink.a, completes r18323 and fixes #6160 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18422 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/iproute2/patches/120-libnetlink-pic.patch | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 package/iproute2/patches/120-libnetlink-pic.patch diff --git a/package/iproute2/patches/120-libnetlink-pic.patch b/package/iproute2/patches/120-libnetlink-pic.patch new file mode 100644 index 000000000..8c0f2bd77 --- /dev/null +++ b/package/iproute2/patches/120-libnetlink-pic.patch @@ -0,0 +1,7 @@ +--- a/lib/Makefile ++++ b/lib/Makefile +@@ -1,3 +1,4 @@ ++CFLAGS+=$(FPIC) + + UTILOBJ=utils.o rt_names.o ll_types.o ll_proto.o ll_addr.o inet_proto.o + From 71a22dbb1b188e547da28ecd53a94f43760f01f0 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 15 Nov 2009 13:10:44 +0000 Subject: [PATCH 165/288] [rdc] fix image create after the conversion to subtargets git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18424 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/rdc/image/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/rdc/image/Makefile b/target/linux/rdc/image/Makefile index 315d91747..6f960ac56 100644 --- a/target/linux/rdc/image/Makefile +++ b/target/linux/rdc/image/Makefile @@ -98,7 +98,7 @@ endef define Image/Build $(CP) $(KDIR)/bzImage $(BIN_DIR)/openwrt-$(BOARD).bzImage - $(call Image/Build/$(PROFILE),$(1),$(PROFILE),$(patsubst jffs2-%k,%,$(1))) + $(call Image/Build/$(SUBTARGET),$(1),$(SUBTARGET),$(patsubst jffs2-%k,%,$(1))) ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) $(call Image/Build/Initramfs) endif From b74589690e9a124421651935d6713c408831b2a2 Mon Sep 17 00:00:00 2001 From: jow Date: Sun, 15 Nov 2009 18:43:46 +0000 Subject: [PATCH 166/288] [brcm-2.4] change switch config to swconfig style format to remain consistent accross platforms git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18425 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/switch/files/switch.sh | 55 ++++++++++--------- .../brcm-2.4/base-files/etc/init.d/netconfig | 18 ++++-- 2 files changed, 44 insertions(+), 29 deletions(-) diff --git a/package/switch/files/switch.sh b/package/switch/files/switch.sh index a787a8cf3..14bacadc5 100644 --- a/package/switch/files/switch.sh +++ b/package/switch/files/switch.sh @@ -1,33 +1,38 @@ #!/bin/sh -# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2006-2009 OpenWrt.org + +setup_switch_hw() { + local dev="$1" + local enable reset evlan + + config_get_bool enable "$dev" enable 1 + config_get_bool evlan "$dev" enable_vlan 1 + config_get_bool reset "$dev" reset 1 + + local proc="/proc/switch/$dev" + [ -d "$proc" ] && { + echo "$reset" > "$proc/reset" + echo "$evlan" > "$proc/enable_vlan" + echo "$enable" > "$proc/enable" + } +} setup_switch_vlan() { - DIR="/proc/switch/$CONFIG_SECTION/vlan/$1" - [ -d "$DIR" ] || return 0 - - config_get ports "$CONFIG_SECTION" "vlan$1" - echo "$ports" > "$DIR/ports" + local s="$1" + local dev vlan ports + + config_get dev "$s" device + config_get vlan "$s" vlan + config_get ports "$s" ports + + [ -n "$dev" ] && [ -n "$vlan" ] && { + local proc="/proc/switch/$dev/vlan/$vlan/ports" + [ -f "$proc" ] && echo "$ports" > "$proc" + } } setup_switch() { - config_cb() { - case "$1" in - switch) - [ -n "$2" -a -d "/proc/switch/$2" ] && { - echo 1 > "/proc/switch/$2/reset" - echo 1 > "/proc/switch/$2/enable" - echo 1 > "/proc/switch/$2/enable_vlan" - option_cb() { - case "$1" in - vlan*) setup_switch_vlan "${1##vlan}";; - esac - } - } - ;; - *) - option_cb() { return 0; } - ;; - esac - } config_load network + config_foreach setup_switch_hw switch + config_foreach setup_switch_vlan switch_vlan } diff --git a/target/linux/brcm-2.4/base-files/etc/init.d/netconfig b/target/linux/brcm-2.4/base-files/etc/init.d/netconfig index 09c7c286f..4d66962f9 100755 --- a/target/linux/brcm-2.4/base-files/etc/init.d/netconfig +++ b/target/linux/brcm-2.4/base-files/etc/init.d/netconfig @@ -20,6 +20,16 @@ start() { if (c[name] != "") print " option " cfgname " \"" c[name] "\"" } + function vlan(id, name) { + if (c[name] != "") { + print "config switch_vlan eth0_" id + print " option device \"eth0\"" + print " option vlan " id + print " option ports \"" c[name] "\"" + print "" + } + } + function macinc(mac, maca, i, result) { split(mac, maca, ":") for (i = 1; i <= 6; i++) maca[i] = "0x" maca[i] @@ -165,10 +175,10 @@ start() { if (c["vlan0ports"] || c["vlan1ports"]) { print "#### VLAN configuration " print "config switch eth0" - p("vlan0", "vlan0ports") - p("vlan1", "vlan1ports") - print "" - print "" + print " option enable 1" + print "" + vlan(0, "vlan0ports") + vlan(1, "vlan1ports") } print "#### Loopback configuration" print "config interface loopback" From 1300afab4c665f486b1a6e296f3290c2c25ca7c8 Mon Sep 17 00:00:00 2001 From: kaloz Date: Sun, 15 Nov 2009 20:25:29 +0000 Subject: [PATCH 167/288] make the lzma version kernel version dependent, and only build the one we do need git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18426 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- tools/Makefile | 8 ++++++-- tools/lzma/Makefile | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/Makefile b/tools/Makefile index b7c7f43db..e3e26f3c4 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -14,11 +14,15 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) tools-$(CONFIG_GCC_VERSION_4_3)$(CONFIG_GCC_VERSION_4_4) += gmp mpfr endif tools-y += m4 autoconf automake bison pkg-config sed mklibs -tools-y += sstrip ipkg-utils genext2fs squashfs squashfs4 mtd-utils lzma-old mkimage +tools-y += sstrip ipkg-utils genext2fs mtd-utils mkimage tools-y += firmware-utils patch-cmdline quilt yaffs2 +ifneq ($(CONFIG_LINUX_2_4)$(CONFIG_LINUX_2_6_21)$(CONFIG_LINUX_2_6_25)$(CONFIG_LINUX_2_6_28),) +tools-y += squashfs lzma-old +else +tools-y += squashfs4 lzma +endif tools-$(CONFIG_CCACHE) += ccache -tools-dep += lzma ifdef CONFIG_GCC_USE_GRAPHITE tools-y += ppl cloog diff --git a/tools/lzma/Makefile b/tools/lzma/Makefile index bebfbafd5..b39c8627e 100644 --- a/tools/lzma/Makefile +++ b/tools/lzma/Makefile @@ -27,6 +27,7 @@ endef define Host/Install $(INSTALL_DIR) $(STAGING_DIR_HOST)/lib $(STAGING_DIR_HOST)/include $(STAGING_DIR_HOST)/bin + $(INSTALL_BIN) $(HOST_BUILD_DIR)/CPP/7zip/Compress/LZMA_Alone/lzma_alone $(STAGING_DIR_HOST)/bin/lzma $(CP) $(HOST_BUILD_DIR)/C/*.h $(STAGING_DIR_HOST)/include/ $(CP) $(UTIL_DIR)/liblzma.a $(STAGING_DIR_HOST)/lib/ endef From b55e7ea676fa7ba74fc260785baec58bb7f2a58b Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 15 Nov 2009 21:21:47 +0000 Subject: [PATCH 168/288] mac80211: sync with changes to patches submitted upstream git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18427 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../mac80211/patches/520-driver_flags.patch | 24 +++++++++++++++---- .../mac80211/patches/530-ath9k_cleanup.patch | 12 +++++----- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/package/mac80211/patches/520-driver_flags.patch b/package/mac80211/patches/520-driver_flags.patch index 2dc2092b1..d27c502ec 100644 --- a/package/mac80211/patches/520-driver_flags.patch +++ b/package/mac80211/patches/520-driver_flags.patch @@ -1,6 +1,6 @@ --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -386,11 +386,12 @@ struct ieee80211_tx_rate { +@@ -386,14 +386,17 @@ struct ieee80211_tx_rate { * @flags: transmit info flags, defined above * @band: the band to transmit on (use for checking for races) * @antenna_sel_tx: antenna to use, 0 for automatic diversity @@ -10,18 +10,34 @@ * @status: union for status data * @driver_data: array of driver_data pointers - * @ampdu_ack_len: number of aggregated frames. +- * relevant only if IEEE80211_TX_STATUS_AMPDU was set. + * @ampdu_ack_len: number of acked aggregated frames. - * relevant only if IEEE80211_TX_STATUS_AMPDU was set. ++ * relevant only if ieee80211_tx_status_ampdu was set. * @ampdu_ack_map: block ack bit map for the aggregation. * relevant only if IEEE80211_TX_STATUS_AMPDU was set. -@@ -403,8 +404,8 @@ struct ieee80211_tx_info { ++ * @ampdu_len: number of aggregated frames. ++ * relevant only if ieee80211_tx_status_ampdu was set. + * @ack_signal: signal strength of the ACK frame + */ + struct ieee80211_tx_info { +@@ -403,8 +406,8 @@ struct ieee80211_tx_info { u8 antenna_sel_tx; - /* 2 byte hole */ - u8 pad[2]; + u8 driver_flags; -+ u8 ampdu_len; ++ u8 pad; union { struct { +@@ -428,7 +431,8 @@ struct ieee80211_tx_info { + u8 ampdu_ack_len; + u64 ampdu_ack_map; + int ack_signal; +- /* 8 bytes free */ ++ u8 ampdu_len; ++ /* 7 bytes free */ + } status; + struct { + struct ieee80211_tx_rate driver_rates[ diff --git a/package/mac80211/patches/530-ath9k_cleanup.patch b/package/mac80211/patches/530-ath9k_cleanup.patch index 49a1143ab..e16ccf1e2 100644 --- a/package/mac80211/patches/530-ath9k_cleanup.patch +++ b/package/mac80211/patches/530-ath9k_cleanup.patch @@ -243,7 +243,7 @@ + if ((ds->ds_txstat.ts_status & ATH9K_TXERR_XRETRY) || + (ds->ds_txstat.ts_status & ATH9K_TXERR_FIFO)) + tx_info->driver_flags |= ATH_TX_INFO_XRETRY; -+ tx_info->ampdu_len = bf->bf_nframes; ++ tx_info->status.ampdu_len = bf->bf_nframes; + tx_info->status.ampdu_ack_len = bf->bf_nframes - nbad; } } @@ -293,7 +293,7 @@ }; last_per = ath_rc_priv->per[tx_rate]; -+ n_bad_frames = tx_info->ampdu_len - tx_info->status.ampdu_ack_len; ++ n_bad_frames = tx_info->status.ampdu_len - tx_info->status.ampdu_ack_len; if (xretries) { if (xretries == 1) { @@ -312,7 +312,7 @@ */ - if (tx_info_priv->n_frames > 0) { - int n_frames, n_bad_frames; -+ if (tx_info->ampdu_len > 0) { ++ if (tx_info->status.ampdu_len > 0) { + int n_frames, n_bad_tries; u8 cur_per, new_per; @@ -320,9 +320,9 @@ - tx_info_priv->n_bad_frames; - n_frames = tx_info_priv->n_frames * (retries + 1); - cur_per = (100 * n_bad_frames / n_frames) >> 3; -+ n_bad_tries = retries * tx_info->ampdu_len + ++ n_bad_tries = retries * tx_info->status.ampdu_len + + n_bad_frames; -+ n_frames = tx_info->ampdu_len * (retries + 1); ++ n_frames = tx_info->status.ampdu_len * (retries + 1); + cur_per = (100 * n_bad_tries / n_frames) >> 3; new_per = (u8)(last_per - (last_per >> 3) + cur_per); ath_rc_priv->per[tx_rate] = new_per; @@ -333,7 +333,7 @@ if (ath_rc_priv->probe_rate && ath_rc_priv->probe_rate == tx_rate) { - if (retries > 0 || 2 * tx_info_priv->n_bad_frames > - tx_info_priv->n_frames) { -+ if (retries > 0 || 2 * n_bad_frames > tx_info->ampdu_len) { ++ if (retries > 0 || 2 * n_bad_frames > tx_info->status.ampdu_len) { /* * Since we probed with just a single attempt, * any retries means the probe failed. Also, From c2144c8c76196ce70297b5fab836095ab0e7f8ec Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 15 Nov 2009 21:21:52 +0000 Subject: [PATCH 169/288] ath9k: fix massive packet loss issue introduced by upstream cleanups git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18428 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/patches/550-ath9k_rx_fix.patch | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 package/mac80211/patches/550-ath9k_rx_fix.patch diff --git a/package/mac80211/patches/550-ath9k_rx_fix.patch b/package/mac80211/patches/550-ath9k_rx_fix.patch new file mode 100644 index 000000000..cdef13cf3 --- /dev/null +++ b/package/mac80211/patches/550-ath9k_rx_fix.patch @@ -0,0 +1,10 @@ +--- a/drivers/net/wireless/ath/ath9k/common.c ++++ b/drivers/net/wireless/ath/ath9k/common.c +@@ -203,6 +203,7 @@ int ath9k_cmn_rx_skb_preprocess(struct a + { + struct ath_hw *ah = common->ah; + ++ memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); + if (!ath9k_rx_accept(common, skb, rx_status, rx_stats, decrypt_error)) + return -EINVAL; + From 145bcd28bb290999535c39941493e8ddd5288fae Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 15 Nov 2009 21:21:56 +0000 Subject: [PATCH 170/288] ath9k: work-in-progress patch to adapt ath9k to the mac80211 rate control api git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18429 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches/560-ath9k_rate_control_api.patch | 1199 +++++++++++++++++ 1 file changed, 1199 insertions(+) create mode 100644 package/mac80211/patches/560-ath9k_rate_control_api.patch diff --git a/package/mac80211/patches/560-ath9k_rate_control_api.patch b/package/mac80211/patches/560-ath9k_rate_control_api.patch new file mode 100644 index 000000000..a9e4e5112 --- /dev/null +++ b/package/mac80211/patches/560-ath9k_rate_control_api.patch @@ -0,0 +1,1199 @@ +--- a/drivers/net/wireless/ath/ath9k/rc.c ++++ b/drivers/net/wireless/ath/ath9k/rc.c +@@ -19,133 +19,92 @@ + + static const struct ath_rate_table ar5416_11na_ratetable = { + 42, ++ 8, /* MCS start */ + { + { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ +- 5400, 0x0b, 0x00, 12, +- 0, 0, 0, 0, 0, 0 }, ++ 5400, 0, 12, 0, 0, 0, 0, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ +- 7800, 0x0f, 0x00, 18, +- 0, 1, 1, 1, 1, 0 }, ++ 7800, 1, 18, 0, 1, 1, 1, 1 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ +- 10000, 0x0a, 0x00, 24, +- 2, 2, 2, 2, 2, 0 }, ++ 10000, 2, 24, 2, 2, 2, 2, 2 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ +- 13900, 0x0e, 0x00, 36, +- 2, 3, 3, 3, 3, 0 }, ++ 13900, 3, 36, 2, 3, 3, 3, 3 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ +- 17300, 0x09, 0x00, 48, +- 4, 4, 4, 4, 4, 0 }, ++ 17300, 4, 48, 4, 4, 4, 4, 4 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ +- 23000, 0x0d, 0x00, 72, +- 4, 5, 5, 5, 5, 0 }, ++ 23000, 5, 72, 4, 5, 5, 5, 5 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ +- 27400, 0x08, 0x00, 96, +- 4, 6, 6, 6, 6, 0 }, ++ 27400, 6, 96, 4, 6, 6, 6, 6 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ +- 29300, 0x0c, 0x00, 108, +- 4, 7, 7, 7, 7, 0 }, ++ 29300, 7, 108, 4, 7, 7, 7, 7 }, + { VALID_2040, VALID_2040, WLAN_RC_PHY_HT_20_SS, 6500, /* 6.5 Mb */ +- 6400, 0x80, 0x00, 0, +- 0, 8, 24, 8, 24, 3216 }, ++ 6400, 0, 0, 0, 8, 24, 8, 24 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 13000, /* 13 Mb */ +- 12700, 0x81, 0x00, 1, +- 2, 9, 25, 9, 25, 6434 }, ++ 12700, 1, 1, 2, 9, 25, 9, 25 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 19500, /* 19.5 Mb */ +- 18800, 0x82, 0x00, 2, +- 2, 10, 26, 10, 26, 9650 }, ++ 18800, 2, 2, 2, 10, 26, 10, 26 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 26000, /* 26 Mb */ +- 25000, 0x83, 0x00, 3, +- 4, 11, 27, 11, 27, 12868 }, ++ 25000, 3, 3, 4, 11, 27, 11, 27 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 39000, /* 39 Mb */ +- 36700, 0x84, 0x00, 4, +- 4, 12, 28, 12, 28, 19304 }, ++ 36700, 4, 4, 4, 12, 28, 12, 28 }, + { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 52000, /* 52 Mb */ +- 48100, 0x85, 0x00, 5, +- 4, 13, 29, 13, 29, 25740 }, ++ 48100, 5, 5, 4, 13, 29, 13, 29 }, + { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 58500, /* 58.5 Mb */ +- 53500, 0x86, 0x00, 6, +- 4, 14, 30, 14, 30, 28956 }, ++ 53500, 6, 6, 4, 14, 30, 14, 30 }, + { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 65000, /* 65 Mb */ +- 59000, 0x87, 0x00, 7, +- 4, 15, 31, 15, 32, 32180 }, ++ 59000, 7, 7, 4, 15, 31, 15, 32 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 13000, /* 13 Mb */ +- 12700, 0x88, 0x00, +- 8, 3, 16, 33, 16, 33, 6430 }, ++ 12700, 8, 8, 3, 16, 33, 16, 33 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 26000, /* 26 Mb */ +- 24800, 0x89, 0x00, 9, +- 2, 17, 34, 17, 34, 12860 }, ++ 24800, 9, 9, 2, 17, 34, 17, 34 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 39000, /* 39 Mb */ +- 36600, 0x8a, 0x00, 10, +- 2, 18, 35, 18, 35, 19300 }, ++ 36600, 10, 10, 2, 18, 35, 18, 35 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 52000, /* 52 Mb */ +- 48100, 0x8b, 0x00, 11, +- 4, 19, 36, 19, 36, 25736 }, ++ 48100, 11, 11, 4, 19, 36, 19, 36 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 78000, /* 78 Mb */ +- 69500, 0x8c, 0x00, 12, +- 4, 20, 37, 20, 37, 38600 }, ++ 69500, 12, 12, 4, 20, 37, 20, 37 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 104000, /* 104 Mb */ +- 89500, 0x8d, 0x00, 13, +- 4, 21, 38, 21, 38, 51472 }, ++ 89500, 13, 13, 4, 21, 38, 21, 38 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 117000, /* 117 Mb */ +- 98900, 0x8e, 0x00, 14, +- 4, 22, 39, 22, 39, 57890 }, ++ 98900, 14, 14, 4, 22, 39, 22, 39 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 130000, /* 130 Mb */ +- 108300, 0x8f, 0x00, 15, +- 4, 23, 40, 23, 41, 64320 }, ++ 108300, 15, 15, 4, 23, 40, 23, 41 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 13500, /* 13.5 Mb */ +- 13200, 0x80, 0x00, 0, +- 0, 8, 24, 24, 24, 6684 }, ++ 13200, 0, 0, 0, 8, 24, 24, 24 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 27500, /* 27.0 Mb */ +- 25900, 0x81, 0x00, 1, +- 2, 9, 25, 25, 25, 13368 }, ++ 25900, 1, 1, 2, 9, 25, 25, 25 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 40500, /* 40.5 Mb */ +- 38600, 0x82, 0x00, 2, +- 2, 10, 26, 26, 26, 20052 }, ++ 38600, 2, 2, 2, 10, 26, 26, 26 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 54000, /* 54 Mb */ +- 49800, 0x83, 0x00, 3, +- 4, 11, 27, 27, 27, 26738 }, ++ 49800, 3, 3, 4, 11, 27, 27, 27 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 81500, /* 81 Mb */ +- 72200, 0x84, 0x00, 4, +- 4, 12, 28, 28, 28, 40104 }, ++ 72200, 4, 4, 4, 12, 28, 28, 28 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 108000, /* 108 Mb */ +- 92900, 0x85, 0x00, 5, +- 4, 13, 29, 29, 29, 53476 }, ++ 92900, 5, 5, 4, 13, 29, 29, 29 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 121500, /* 121.5 Mb */ +- 102700, 0x86, 0x00, 6, +- 4, 14, 30, 30, 30, 60156 }, ++ 102700, 6, 6, 4, 14, 30, 30, 30 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 135000, /* 135 Mb */ +- 112000, 0x87, 0x00, 7, +- 4, 15, 31, 32, 32, 66840 }, ++ 112000, 7, 7, 4, 15, 31, 32, 32 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, /* 150 Mb */ +- 122000, 0x87, 0x00, 7, +- 4, 15, 31, 32, 32, 74200 }, ++ 122000, 7, 7, 4, 15, 31, 32, 32 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 27000, /* 27 Mb */ +- 25800, 0x88, 0x00, 8, +- 0, 16, 33, 33, 33, 13360 }, ++ 25800, 8, 8, 0, 16, 33, 33, 33 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 54000, /* 54 Mb */ +- 49800, 0x89, 0x00, 9, +- 2, 17, 34, 34, 34, 26720 }, ++ 49800, 9, 9, 2, 17, 34, 34, 34 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 81000, /* 81 Mb */ +- 71900, 0x8a, 0x00, 10, +- 2, 18, 35, 35, 35, 40080 }, ++ 71900, 10, 10, 2, 18, 35, 35, 35 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 108000, /* 108 Mb */ +- 92500, 0x8b, 0x00, 11, +- 4, 19, 36, 36, 36, 53440 }, ++ 92500, 11, 11, 4, 19, 36, 36, 36 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 162000, /* 162 Mb */ +- 130300, 0x8c, 0x00, 12, +- 4, 20, 37, 37, 37, 80160 }, ++ 130300, 12, 12, 4, 20, 37, 37, 37 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 216000, /* 216 Mb */ +- 162800, 0x8d, 0x00, 13, +- 4, 21, 38, 38, 38, 106880 }, ++ 162800, 13, 13, 4, 21, 38, 38, 38 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 243000, /* 243 Mb */ +- 178200, 0x8e, 0x00, 14, +- 4, 22, 39, 39, 39, 120240 }, ++ 178200, 14, 14, 4, 22, 39, 39, 39 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 270000, /* 270 Mb */ +- 192100, 0x8f, 0x00, 15, +- 4, 23, 40, 41, 41, 133600 }, ++ 192100, 15, 15, 4, 23, 40, 41, 41 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS_HGI, 300000, /* 300 Mb */ +- 207000, 0x8f, 0x00, 15, +- 4, 23, 40, 41, 41, 148400 }, ++ 207000, 15, 15, 4, 23, 40, 41, 41 }, + }, + 50, /* probe interval */ + WLAN_RC_HT_FLAG, /* Phy rates allowed initially */ +@@ -156,177 +115,125 @@ static const struct ath_rate_table ar541 + + static const struct ath_rate_table ar5416_11ng_ratetable = { + 46, ++ 12, /* MCS start */ + { + { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ +- 900, 0x1b, 0x00, 2, +- 0, 0, 0, 0, 0, 0 }, ++ 900, 0, 2, 0, 0, 0, 0, 0 }, + { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */ +- 1900, 0x1a, 0x04, 4, +- 1, 1, 1, 1, 1, 0 }, ++ 1900, 1, 4, 1, 1, 1, 1, 1 }, + { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */ +- 4900, 0x19, 0x04, 11, +- 2, 2, 2, 2, 2, 0 }, ++ 4900, 2, 11, 2, 2, 2, 2, 2 }, + { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */ +- 8100, 0x18, 0x04, 22, +- 3, 3, 3, 3, 3, 0 }, ++ 8100, 3, 22, 3, 3, 3, 3, 3 }, + { INVALID, INVALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ +- 5400, 0x0b, 0x00, 12, +- 4, 4, 4, 4, 4, 0 }, ++ 5400, 4, 12, 4, 4, 4, 4, 4 }, + { INVALID, INVALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ +- 7800, 0x0f, 0x00, 18, +- 4, 5, 5, 5, 5, 0 }, ++ 7800, 5, 18, 4, 5, 5, 5, 5 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ +- 10100, 0x0a, 0x00, 24, +- 6, 6, 6, 6, 6, 0 }, ++ 10100, 6, 24, 6, 6, 6, 6, 6 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ +- 14100, 0x0e, 0x00, 36, +- 6, 7, 7, 7, 7, 0 }, ++ 14100, 7, 36, 6, 7, 7, 7, 7 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ +- 17700, 0x09, 0x00, 48, +- 8, 8, 8, 8, 8, 0 }, ++ 17700, 8, 48, 8, 8, 8, 8, 8 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ +- 23700, 0x0d, 0x00, 72, +- 8, 9, 9, 9, 9, 0 }, ++ 23700, 9, 72, 8, 9, 9, 9, 9 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ +- 27400, 0x08, 0x00, 96, +- 8, 10, 10, 10, 10, 0 }, ++ 27400, 10, 96, 8, 10, 10, 10, 10 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ +- 30900, 0x0c, 0x00, 108, +- 8, 11, 11, 11, 11, 0 }, ++ 30900, 11, 108, 8, 11, 11, 11, 11 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_20_SS, 6500, /* 6.5 Mb */ +- 6400, 0x80, 0x00, 0, +- 4, 12, 28, 12, 28, 3216 }, ++ 6400, 0, 0, 4, 12, 28, 12, 28 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 13000, /* 13 Mb */ +- 12700, 0x81, 0x00, 1, +- 6, 13, 29, 13, 29, 6434 }, ++ 12700, 1, 1, 6, 13, 29, 13, 29 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 19500, /* 19.5 Mb */ +- 18800, 0x82, 0x00, 2, +- 6, 14, 30, 14, 30, 9650 }, ++ 18800, 2, 2, 6, 14, 30, 14, 30 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 26000, /* 26 Mb */ +- 25000, 0x83, 0x00, 3, +- 8, 15, 31, 15, 31, 12868 }, ++ 25000, 3, 3, 8, 15, 31, 15, 31 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 39000, /* 39 Mb */ +- 36700, 0x84, 0x00, 4, +- 8, 16, 32, 16, 32, 19304 }, ++ 36700, 4, 4, 8, 16, 32, 16, 32 }, + { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 52000, /* 52 Mb */ +- 48100, 0x85, 0x00, 5, +- 8, 17, 33, 17, 33, 25740 }, ++ 48100, 5, 5, 8, 17, 33, 17, 33 }, + { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 58500, /* 58.5 Mb */ +- 53500, 0x86, 0x00, 6, +- 8, 18, 34, 18, 34, 28956 }, ++ 53500, 6, 6, 8, 18, 34, 18, 34 }, + { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 65000, /* 65 Mb */ +- 59000, 0x87, 0x00, 7, +- 8, 19, 35, 19, 36, 32180 }, ++ 59000, 7, 7, 8, 19, 35, 19, 36 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 13000, /* 13 Mb */ +- 12700, 0x88, 0x00, 8, +- 4, 20, 37, 20, 37, 6430 }, ++ 12700, 8, 8, 4, 20, 37, 20, 37 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 26000, /* 26 Mb */ +- 24800, 0x89, 0x00, 9, +- 6, 21, 38, 21, 38, 12860 }, ++ 24800, 9, 9, 6, 21, 38, 21, 38 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 39000, /* 39 Mb */ +- 36600, 0x8a, 0x00, 10, +- 6, 22, 39, 22, 39, 19300 }, ++ 36600, 10, 10, 6, 22, 39, 22, 39 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 52000, /* 52 Mb */ +- 48100, 0x8b, 0x00, 11, +- 8, 23, 40, 23, 40, 25736 }, ++ 48100, 11, 11, 8, 23, 40, 23, 40 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 78000, /* 78 Mb */ +- 69500, 0x8c, 0x00, 12, +- 8, 24, 41, 24, 41, 38600 }, ++ 69500, 12, 12, 8, 24, 41, 24, 41 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 104000, /* 104 Mb */ +- 89500, 0x8d, 0x00, 13, +- 8, 25, 42, 25, 42, 51472 }, ++ 89500, 13, 13, 8, 25, 42, 25, 42 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 117000, /* 117 Mb */ +- 98900, 0x8e, 0x00, 14, +- 8, 26, 43, 26, 44, 57890 }, ++ 98900, 14, 14, 8, 26, 43, 26, 44 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 130000, /* 130 Mb */ +- 108300, 0x8f, 0x00, 15, +- 8, 27, 44, 27, 45, 64320 }, ++ 108300, 15, 15, 8, 27, 44, 27, 45 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 13500, /* 13.5 Mb */ +- 13200, 0x80, 0x00, 0, +- 8, 12, 28, 28, 28, 6684 }, ++ 13200, 0, 0, 8, 12, 28, 28, 28 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 27500, /* 27.0 Mb */ +- 25900, 0x81, 0x00, 1, +- 8, 13, 29, 29, 29, 13368 }, ++ 25900, 1, 1, 8, 13, 29, 29, 29 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 40500, /* 40.5 Mb */ +- 38600, 0x82, 0x00, 2, +- 8, 14, 30, 30, 30, 20052 }, ++ 38600, 2, 2, 8, 14, 30, 30, 30 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 54000, /* 54 Mb */ +- 49800, 0x83, 0x00, 3, +- 8, 15, 31, 31, 31, 26738 }, ++ 49800, 3, 3, 8, 15, 31, 31, 31 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 81500, /* 81 Mb */ +- 72200, 0x84, 0x00, 4, +- 8, 16, 32, 32, 32, 40104 }, ++ 72200, 4, 4, 8, 16, 32, 32, 32 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 108000, /* 108 Mb */ +- 92900, 0x85, 0x00, 5, +- 8, 17, 33, 33, 33, 53476 }, ++ 92900, 5, 5, 8, 17, 33, 33, 33 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 121500, /* 121.5 Mb */ +- 102700, 0x86, 0x00, 6, +- 8, 18, 34, 34, 34, 60156 }, ++ 102700, 6, 6, 8, 18, 34, 34, 34 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 135000, /* 135 Mb */ +- 112000, 0x87, 0x00, 7, +- 8, 19, 35, 36, 36, 66840 }, ++ 112000, 7, 7, 8, 19, 35, 36, 36 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, /* 150 Mb */ +- 122000, 0x87, 0x00, 7, +- 8, 19, 35, 36, 36, 74200 }, ++ 122000, 7, 7, 8, 19, 35, 36, 36 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 27000, /* 27 Mb */ +- 25800, 0x88, 0x00, 8, +- 8, 20, 37, 37, 37, 13360 }, ++ 25800, 8, 8, 8, 20, 37, 37, 37 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 54000, /* 54 Mb */ +- 49800, 0x89, 0x00, 9, +- 8, 21, 38, 38, 38, 26720 }, ++ 49800, 9, 9, 8, 21, 38, 38, 38 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 81000, /* 81 Mb */ +- 71900, 0x8a, 0x00, 10, +- 8, 22, 39, 39, 39, 40080 }, ++ 71900, 10, 10, 8, 22, 39, 39, 39 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 108000, /* 108 Mb */ +- 92500, 0x8b, 0x00, 11, +- 8, 23, 40, 40, 40, 53440 }, ++ 92500, 11, 11, 8, 23, 40, 40, 40 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 162000, /* 162 Mb */ +- 130300, 0x8c, 0x00, 12, +- 8, 24, 41, 41, 41, 80160 }, ++ 130300, 12, 12, 8, 24, 41, 41, 41 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 216000, /* 216 Mb */ +- 162800, 0x8d, 0x00, 13, +- 8, 25, 42, 42, 42, 106880 }, ++ 162800, 13, 13, 8, 25, 42, 42, 42 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 243000, /* 243 Mb */ +- 178200, 0x8e, 0x00, 14, +- 8, 26, 43, 43, 43, 120240 }, ++ 178200, 14, 14, 8, 26, 43, 43, 43 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 270000, /* 270 Mb */ +- 192100, 0x8f, 0x00, 15, +- 8, 27, 44, 45, 45, 133600 }, ++ 192100, 15, 15, 8, 27, 44, 45, 45 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS_HGI, 300000, /* 300 Mb */ +- 207000, 0x8f, 0x00, 15, +- 8, 27, 44, 45, 45, 148400 }, +- }, ++ 207000, 15, 15, 8, 27, 44, 45, 45 }, ++ }, + 50, /* probe interval */ + WLAN_RC_HT_FLAG, /* Phy rates allowed initially */ + }; + + static const struct ath_rate_table ar5416_11a_ratetable = { + 8, ++ 0, + { + { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ +- 5400, 0x0b, 0x00, (0x80|12), +- 0, 0, 0 }, ++ 5400, 0, 12, 0, 0, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ +- 7800, 0x0f, 0x00, 18, +- 0, 1, 0 }, ++ 7800, 1, 18, 0, 1, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ +- 10000, 0x0a, 0x00, (0x80|24), +- 2, 2, 0 }, ++ 10000, 2, 24, 2, 2, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ +- 13900, 0x0e, 0x00, 36, +- 2, 3, 0 }, ++ 13900, 3, 36, 2, 3, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ +- 17300, 0x09, 0x00, (0x80|48), +- 4, 4, 0 }, ++ 17300, 4, 48, 4, 4, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ +- 23000, 0x0d, 0x00, 72, +- 4, 5, 0 }, ++ 23000, 5, 72, 4, 5, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ +- 27400, 0x08, 0x00, 96, +- 4, 6, 0 }, ++ 27400, 6, 96, 4, 6, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ +- 29300, 0x0c, 0x00, 108, +- 4, 7, 0 }, ++ 29300, 7, 108, 4, 7, 0 }, + }, + 50, /* probe interval */ + 0, /* Phy rates allowed initially */ +@@ -334,48 +241,51 @@ static const struct ath_rate_table ar541 + + static const struct ath_rate_table ar5416_11g_ratetable = { + 12, ++ 0, + { + { VALID, VALID, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ +- 900, 0x1b, 0x00, 2, +- 0, 0, 0 }, ++ 900, 0, 2, 0, 0, 0 }, + { VALID, VALID, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */ +- 1900, 0x1a, 0x04, 4, +- 1, 1, 0 }, ++ 1900, 1, 4, 1, 1, 0 }, + { VALID, VALID, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */ +- 4900, 0x19, 0x04, 11, +- 2, 2, 0 }, ++ 4900, 2, 11, 2, 2, 0 }, + { VALID, VALID, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */ +- 8100, 0x18, 0x04, 22, +- 3, 3, 0 }, ++ 8100, 3, 22, 3, 3, 0 }, + { INVALID, INVALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ +- 5400, 0x0b, 0x00, 12, +- 4, 4, 0 }, ++ 5400, 4, 12, 4, 4, 0 }, + { INVALID, INVALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ +- 7800, 0x0f, 0x00, 18, +- 4, 5, 0 }, ++ 7800, 5, 18, 4, 5, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ +- 10000, 0x0a, 0x00, 24, +- 6, 6, 0 }, ++ 10000, 6, 24, 6, 6, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ +- 13900, 0x0e, 0x00, 36, +- 6, 7, 0 }, ++ 13900, 7, 36, 6, 7, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ +- 17300, 0x09, 0x00, 48, +- 8, 8, 0 }, ++ 17300, 8, 48, 8, 8, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ +- 23000, 0x0d, 0x00, 72, +- 8, 9, 0 }, ++ 23000, 9, 72, 8, 9, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ +- 27400, 0x08, 0x00, 96, +- 8, 10, 0 }, ++ 27400, 10, 96, 8, 10, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ +- 29300, 0x0c, 0x00, 108, +- 8, 11, 0 }, ++ 29300, 11, 108, 8, 11, 0 }, + }, + 50, /* probe interval */ + 0, /* Phy rates allowed initially */ + }; + ++static const struct ath_rate_table *hw_rate_table[ATH9K_MODE_MAX] = { ++ [ATH9K_MODE_11A] = &ar5416_11a_ratetable, ++ [ATH9K_MODE_11G] = &ar5416_11g_ratetable, ++ [ATH9K_MODE_11NA_HT20] = &ar5416_11na_ratetable, ++ [ATH9K_MODE_11NG_HT20] = &ar5416_11ng_ratetable, ++ [ATH9K_MODE_11NA_HT40PLUS] = &ar5416_11na_ratetable, ++ [ATH9K_MODE_11NA_HT40MINUS] = &ar5416_11na_ratetable, ++ [ATH9K_MODE_11NG_HT40PLUS] = &ar5416_11ng_ratetable, ++ [ATH9K_MODE_11NG_HT40MINUS] = &ar5416_11ng_ratetable, ++}; ++ ++static int ath_rc_get_rateindex(const struct ath_rate_table *rate_table, ++ struct ieee80211_tx_rate *rate); ++ + static inline int8_t median(int8_t a, int8_t b, int8_t c) + { + if (a >= b) { +@@ -534,7 +444,7 @@ static u8 ath_rc_setvalid_rates(struct a + * capflag matches one of the validity + * (VALID/VALID_20/VALID_40) flags */ + +- if (((rate & 0x7F) == (dot11rate & 0x7F)) && ++ if ((rate == dot11rate) && + ((valid & WLAN_RC_CAP_MODE(capflag)) == + WLAN_RC_CAP_MODE(capflag)) && + !WLAN_RC_PHY_HT(phy)) { +@@ -576,8 +486,7 @@ static u8 ath_rc_setvalid_htrates(struct + u8 rate = rateset->rs_rates[i]; + u8 dot11rate = rate_table->info[j].dot11rate; + +- if (((rate & 0x7F) != (dot11rate & 0x7F)) || +- !WLAN_RC_PHY_HT(phy) || ++ if ((rate != dot11rate) || !WLAN_RC_PHY_HT(phy) || + !WLAN_RC_PHY_HT_VALID(valid, capflag)) + continue; + +@@ -696,18 +605,20 @@ static void ath_rc_rate_set_series(const + u8 tries, u8 rix, int rtsctsenable) + { + rate->count = tries; +- rate->idx = rix; ++ rate->idx = rate_table->info[rix].ratecode; + + if (txrc->short_preamble) + rate->flags |= IEEE80211_TX_RC_USE_SHORT_PREAMBLE; + if (txrc->rts || rtsctsenable) + rate->flags |= IEEE80211_TX_RC_USE_RTS_CTS; +- if (WLAN_RC_PHY_40(rate_table->info[rix].phy)) +- rate->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH; +- if (WLAN_RC_PHY_SGI(rate_table->info[rix].phy)) +- rate->flags |= IEEE80211_TX_RC_SHORT_GI; +- if (WLAN_RC_PHY_HT(rate_table->info[rix].phy)) ++ ++ if (WLAN_RC_PHY_HT(rate_table->info[rix].phy)) { + rate->flags |= IEEE80211_TX_RC_MCS; ++ if (WLAN_RC_PHY_40(rate_table->info[rix].phy)) ++ rate->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH; ++ if (WLAN_RC_PHY_SGI(rate_table->info[rix].phy)) ++ rate->flags |= IEEE80211_TX_RC_SHORT_GI; ++ } + } + + static void ath_rc_rate_set_rtscts(struct ath_softc *sc, +@@ -720,7 +631,7 @@ static void ath_rc_rate_set_rtscts(struc + /* get the cix for the lowest valid rix */ + for (i = 3; i >= 0; i--) { + if (rates[i].count && (rates[i].idx >= 0)) { +- rix = rates[i].idx; ++ rix = ath_rc_get_rateindex(rate_table, &rates[i]); + break; + } + } +@@ -1080,15 +991,19 @@ static int ath_rc_get_rateindex(const st + { + int rix; + ++ if (!(rate->flags & IEEE80211_TX_RC_MCS)) ++ return rate->idx; ++ ++ rix = rate->idx + rate_table->mcs_start; + if ((rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) && + (rate->flags & IEEE80211_TX_RC_SHORT_GI)) +- rix = rate_table->info[rate->idx].ht_index; ++ rix = rate_table->info[rix].ht_index; + else if (rate->flags & IEEE80211_TX_RC_SHORT_GI) +- rix = rate_table->info[rate->idx].sgi_index; ++ rix = rate_table->info[rix].sgi_index; + else if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) +- rix = rate_table->info[rate->idx].cw40index; ++ rix = rate_table->info[rix].cw40index; + else +- rix = rate_table->info[rate->idx].base_index; ++ rix = rate_table->info[rix].base_index; + + return rix; + } +@@ -1183,7 +1098,9 @@ struct ath_rate_table *ath_choose_rate_t + + ath_print(common, ATH_DBG_CONFIG, + "Choosing rate table for mode: %d\n", mode); +- return sc->hw_rate_table[mode]; ++ ++ sc->cur_rate_mode = mode; ++ return hw_rate_table[mode]; + } + + static void ath_rc_init(struct ath_softc *sc, +@@ -1197,12 +1114,6 @@ static void ath_rc_init(struct ath_softc + u8 *ht_mcs = (u8 *)&ath_rc_priv->neg_ht_rates; + u8 i, j, k, hi = 0, hthi = 0; + +- if (!rate_table) { +- ath_print(common, ATH_DBG_FATAL, +- "Rate table not initialized\n"); +- return; +- } +- + /* Initial rate table size. Will change depending + * on the working rate set */ + ath_rc_priv->rate_table_size = RATE_TABLE_SIZE; +@@ -1357,7 +1268,8 @@ static void ath_tx_status(void *priv, st + } + } + +- ath_debug_stat_rc(sc, skb); ++ ath_debug_stat_rc(sc, ath_rc_get_rateindex(sc->cur_rate_table, ++ &tx_info->status.rates[final_ts_idx])); + } + + static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband, +@@ -1365,7 +1277,7 @@ static void ath_rate_init(void *priv, st + { + struct ath_softc *sc = priv; + struct ath_rate_priv *ath_rc_priv = priv_sta; +- const struct ath_rate_table *rate_table = NULL; ++ const struct ath_rate_table *rate_table; + bool is_cw40, is_sgi40; + int i, j = 0; + +@@ -1397,11 +1309,9 @@ static void ath_rate_init(void *priv, st + (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT) || + (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC)) { + rate_table = ath_choose_rate_table(sc, sband->band, +- sta->ht_cap.ht_supported, +- is_cw40); +- } else if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) { +- /* cur_rate_table would be set on init through config() */ +- rate_table = sc->cur_rate_table; ++ sta->ht_cap.ht_supported, is_cw40); ++ } else { ++ rate_table = hw_rate_table[sc->cur_rate_mode]; + } + + ath_rc_priv->ht_cap = ath_rc_build_ht_caps(sc, sta, is_cw40, is_sgi40); +@@ -1445,6 +1355,7 @@ static void ath_rate_update(void *priv, + ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_CONFIG, + "Operating HT Bandwidth changed to: %d\n", + sc->hw->conf.channel_type); ++ sc->cur_rate_table = hw_rate_table[sc->cur_rate_mode]; + } + } + } +@@ -1497,26 +1408,6 @@ static struct rate_control_ops ath_rate_ + .free_sta = ath_rate_free_sta, + }; + +-void ath_rate_attach(struct ath_softc *sc) +-{ +- sc->hw_rate_table[ATH9K_MODE_11A] = +- &ar5416_11a_ratetable; +- sc->hw_rate_table[ATH9K_MODE_11G] = +- &ar5416_11g_ratetable; +- sc->hw_rate_table[ATH9K_MODE_11NA_HT20] = +- &ar5416_11na_ratetable; +- sc->hw_rate_table[ATH9K_MODE_11NG_HT20] = +- &ar5416_11ng_ratetable; +- sc->hw_rate_table[ATH9K_MODE_11NA_HT40PLUS] = +- &ar5416_11na_ratetable; +- sc->hw_rate_table[ATH9K_MODE_11NA_HT40MINUS] = +- &ar5416_11na_ratetable; +- sc->hw_rate_table[ATH9K_MODE_11NG_HT40PLUS] = +- &ar5416_11ng_ratetable; +- sc->hw_rate_table[ATH9K_MODE_11NG_HT40MINUS] = +- &ar5416_11ng_ratetable; +-} +- + int ath_rate_control_register(void) + { + return ieee80211_rate_control_register(&ath_rate_ops); +--- a/drivers/net/wireless/ath/ath9k/xmit.c ++++ b/drivers/net/wireless/ath/ath9k/xmit.c +@@ -70,6 +70,29 @@ static int ath_tx_num_badfrms(struct ath + static void ath_tx_rc_status(struct ath_buf *bf, struct ath_desc *ds, + int nbad, int txok, bool update_rc); + ++enum { ++ MCS_DEFAULT, ++ MCS_HT40, ++ MCS_HT40_SGI, ++}; ++ ++static int ath_max_4ms_framelen[3][16] = { ++ [MCS_DEFAULT] = { ++ 3216, 6434, 9650, 12868, 19304, 25740, 28956, 32180, ++ 6430, 12860, 19300, 25736, 38600, 51472, 57890, 64320, ++ }, ++ [MCS_HT40] = { ++ 6684, 13368, 20052, 26738, 40104, 53476, 60156, 66840, ++ 13360, 26720, 40080, 53440, 80160, 106880, 120240, 133600, ++ }, ++ [MCS_HT40_SGI] = { ++ /* TODO: Only MCS 7 and 15 updated, recalculate the rest */ ++ 6684, 13368, 20052, 26738, 40104, 53476, 60156, 74200, ++ 13360, 26720, 40080, 53440, 80160, 106880, 120240, 148400, ++ } ++}; ++ ++ + /*********************/ + /* Aggregation logic */ + /*********************/ +@@ -459,7 +482,6 @@ static void ath_tx_complete_aggr(struct + static u32 ath_lookup_rate(struct ath_softc *sc, struct ath_buf *bf, + struct ath_atx_tid *tid) + { +- const struct ath_rate_table *rate_table = sc->cur_rate_table; + struct sk_buff *skb; + struct ieee80211_tx_info *tx_info; + struct ieee80211_tx_rate *rates; +@@ -480,12 +502,20 @@ static u32 ath_lookup_rate(struct ath_so + + for (i = 0; i < 4; i++) { + if (rates[i].count) { +- if (!WLAN_RC_PHY_HT(rate_table->info[rates[i].idx].phy)) { ++ int modeidx; ++ if (!(rates[i].flags & IEEE80211_TX_RC_MCS)) { + legacy = 1; + break; + } + +- frmlen = rate_table->info[rates[i].idx].max_4ms_framelen; ++ if (rates[i].flags & IEEE80211_TX_RC_SHORT_GI) ++ modeidx = MCS_HT40_SGI; ++ else if (rates[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH) ++ modeidx = MCS_HT40; ++ else ++ modeidx = MCS_DEFAULT; ++ ++ frmlen = ath_max_4ms_framelen[modeidx][rates[i].idx]; + max_4ms_framelen = min(max_4ms_framelen, frmlen); + } + } +@@ -523,12 +553,11 @@ static u32 ath_lookup_rate(struct ath_so + static int ath_compute_num_delims(struct ath_softc *sc, struct ath_atx_tid *tid, + struct ath_buf *bf, u16 frmlen) + { +- const struct ath_rate_table *rt = sc->cur_rate_table; + struct sk_buff *skb = bf->bf_mpdu; + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); + u32 nsymbits, nsymbols; + u16 minlen; +- u8 rc, flags, rix; ++ u8 flags, rix; + int width, half_gi, ndelim, mindelim; + + /* Select standard number of delimiters based on frame length alone */ +@@ -558,7 +587,6 @@ static int ath_compute_num_delims(struct + + rix = tx_info->control.rates[0].idx; + flags = tx_info->control.rates[0].flags; +- rc = rt->info[rix].ratecode; + width = (flags & IEEE80211_TX_RC_40_MHZ_WIDTH) ? 1 : 0; + half_gi = (flags & IEEE80211_TX_RC_SHORT_GI) ? 1 : 0; + +@@ -570,7 +598,7 @@ static int ath_compute_num_delims(struct + if (nsymbols == 0) + nsymbols = 1; + +- nsymbits = bits_per_symbol[HT_RC_2_MCS(rc)][width]; ++ nsymbits = bits_per_symbol[rix][width]; + minlen = (nsymbols * nsymbits) / BITS_PER_BYTE; + + if (frmlen < minlen) { +@@ -1430,22 +1458,14 @@ static int setup_tx_flags(struct ath_sof + static u32 ath_pkt_duration(struct ath_softc *sc, u8 rix, struct ath_buf *bf, + int width, int half_gi, bool shortPreamble) + { +- const struct ath_rate_table *rate_table = sc->cur_rate_table; + u32 nbits, nsymbits, duration, nsymbols; +- u8 rc; + int streams, pktlen; + + pktlen = bf_isaggr(bf) ? bf->bf_al : bf->bf_frmlen; +- rc = rate_table->info[rix].ratecode; +- +- /* for legacy rates, use old function to compute packet duration */ +- if (!IS_HT_RATE(rc)) +- return ath9k_hw_computetxtime(sc->sc_ah, rate_table, pktlen, +- rix, shortPreamble); + + /* find number of symbols: PLCP + data */ + nbits = (pktlen << 3) + OFDM_PLCP_BITS; +- nsymbits = bits_per_symbol[HT_RC_2_MCS(rc)][width]; ++ nsymbits = bits_per_symbol[rix][width]; + nsymbols = (nbits + nsymbits - 1) / nsymbits; + + if (!half_gi) +@@ -1454,7 +1474,7 @@ static u32 ath_pkt_duration(struct ath_s + duration = SYMBOL_TIME_HALFGI(nsymbols); + + /* addup duration for legacy/ht training and signal fields */ +- streams = HT_RC_2_STREAMS(rc); ++ streams = HT_RC_2_STREAMS(rix); + duration += L_STF + L_LTF + L_SIG + HT_SIG + HT_STF + HT_LTF(streams); + + return duration; +@@ -1463,11 +1483,11 @@ static u32 ath_pkt_duration(struct ath_s + static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf) + { + struct ath_common *common = ath9k_hw_common(sc->sc_ah); +- const struct ath_rate_table *rt = sc->cur_rate_table; + struct ath9k_11n_rate_series series[4]; + struct sk_buff *skb; + struct ieee80211_tx_info *tx_info; + struct ieee80211_tx_rate *rates; ++ const struct ieee80211_rate *rate; + struct ieee80211_hdr *hdr; + int i, flags = 0; + u8 rix = 0, ctsrate = 0; +@@ -1486,11 +1506,10 @@ static void ath_buf_set_rate(struct ath_ + * checking the BSS's global flag. + * But for the rate series, IEEE80211_TX_RC_USE_SHORT_PREAMBLE is used. + */ ++ rate = ieee80211_get_rts_cts_rate(sc->hw, tx_info); ++ ctsrate = rate->hw_value; + if (sc->sc_flags & SC_OP_PREAMBLE_SHORT) +- ctsrate = rt->info[tx_info->control.rts_cts_rate_idx].ratecode | +- rt->info[tx_info->control.rts_cts_rate_idx].short_preamble; +- else +- ctsrate = rt->info[tx_info->control.rts_cts_rate_idx].ratecode; ++ ctsrate |= rate->hw_value_short; + + /* + * ATH9K_TXDESC_RTSENA and ATH9K_TXDESC_CTSENA are mutually exclusive. +@@ -1513,6 +1532,9 @@ static void ath_buf_set_rate(struct ath_ + flags &= ~(ATH9K_TXDESC_RTSENA); + + for (i = 0; i < 4; i++) { ++ bool is_40, is_sgi, is_sp; ++ int phy; ++ + if (!rates[i].count || (rates[i].idx < 0)) + continue; + +@@ -1520,12 +1542,6 @@ static void ath_buf_set_rate(struct ath_ + series[i].Tries = rates[i].count; + series[i].ChSel = common->tx_chainmask; + +- if (rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) +- series[i].Rate = rt->info[rix].ratecode | +- rt->info[rix].short_preamble; +- else +- series[i].Rate = rt->info[rix].ratecode; +- + if (rates[i].flags & IEEE80211_TX_RC_USE_RTS_CTS) + series[i].RateFlags |= ATH9K_RATESERIES_RTS_CTS; + if (rates[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH) +@@ -1533,10 +1549,36 @@ static void ath_buf_set_rate(struct ath_ + if (rates[i].flags & IEEE80211_TX_RC_SHORT_GI) + series[i].RateFlags |= ATH9K_RATESERIES_HALFGI; + +- series[i].PktDuration = ath_pkt_duration(sc, rix, bf, +- (rates[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH) != 0, +- (rates[i].flags & IEEE80211_TX_RC_SHORT_GI), +- (rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)); ++ is_sgi = !!(rates[i].flags & IEEE80211_TX_RC_SHORT_GI); ++ is_40 = !!(rates[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH); ++ is_sp = !!(rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE); ++ ++ if (rates[i].flags & IEEE80211_TX_RC_MCS) { ++ /* MCS rates */ ++ series[i].Rate = rix | 0x80; ++ series[i].PktDuration = ath_pkt_duration(sc, rix, bf, ++ is_40, is_sgi, is_sp); ++ continue; ++ } ++ ++ /* legcay rates */ ++ if ((tx_info->band == IEEE80211_BAND_2GHZ) && ++ !(rate->flags & IEEE80211_RATE_ERP_G)) ++ phy = WLAN_RC_PHY_CCK; ++ else ++ phy = WLAN_RC_PHY_OFDM; ++ ++ rate = &sc->sbands[tx_info->band].bitrates[rates[i].idx]; ++ series[i].Rate = rate->hw_value; ++ if (rate->hw_value_short) { ++ if (rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) ++ series[i].Rate |= rate->hw_value_short; ++ } else { ++ is_sp = false; ++ } ++ ++ series[i].PktDuration = ath9k_hw_computetxtime(sc->sc_ah, ++ phy, rate->bitrate * 100, bf->bf_frmlen, rix, is_sp); + } + + /* set dur_update_en for l-sig computation except for PS-Poll frames */ +--- a/drivers/net/wireless/ath/ath9k/ath9k.h ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h +@@ -21,7 +21,6 @@ + #include + #include + +-#include "rc.h" + #include "debug.h" + #include "common.h" + +@@ -433,6 +432,7 @@ struct ath_led { + #define SC_OP_BT_PRIORITY_DETECTED BIT(21) + + struct ath_wiphy; ++struct ath_rate_table; + + struct ath_softc { + struct ieee80211_hw *hw; +@@ -477,9 +477,8 @@ struct ath_softc { + struct ath_rx rx; + struct ath_tx tx; + struct ath_beacon beacon; +- struct ieee80211_rate rates[IEEE80211_NUM_BANDS][ATH_RATE_MAX]; +- const struct ath_rate_table *hw_rate_table[ATH9K_MODE_MAX]; + const struct ath_rate_table *cur_rate_table; ++ enum wireless_mode cur_rate_mode; + struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS]; + + struct ath_led radio_led; +--- a/drivers/net/wireless/ath/ath9k/main.c ++++ b/drivers/net/wireless/ath/ath9k/main.c +@@ -104,37 +104,71 @@ static struct ieee80211_channel ath9k_5g + CHAN5G(5825, 37), /* Channel 165 */ + }; + ++static struct ieee80211_rate ath9k_legacy_rates[] = { ++ { .bitrate = 10, ++ .hw_value = 0x1b, ++ .flags = 0 }, ++ { .bitrate = 20, ++ .hw_value = 0x1a, ++ .hw_value_short = 0x1a | 0x04, ++ .flags = IEEE80211_RATE_SHORT_PREAMBLE }, ++ { .bitrate = 55, ++ .hw_value = 0x19, ++ .hw_value_short = 0x19 | 0x04, ++ .flags = IEEE80211_RATE_SHORT_PREAMBLE }, ++ { .bitrate = 110, ++ .hw_value = 0x18, ++ .hw_value_short = 0x18 | 0x4, ++ .flags = IEEE80211_RATE_SHORT_PREAMBLE }, ++ { .bitrate = 60, ++ .hw_value = 0x0b, ++ .flags = 0 }, ++ { .bitrate = 90, ++ .hw_value = 0x0f, ++ .flags = 0 }, ++ { .bitrate = 120, ++ .hw_value = 0x0a, ++ .flags = 0 }, ++ { .bitrate = 180, ++ .hw_value = 0x0e, ++ .flags = 0 }, ++ { .bitrate = 240, ++ .hw_value = 0x09, ++ .flags = 0 }, ++ { .bitrate = 360, ++ .hw_value = 0x0d, ++ .flags = 0 }, ++ { .bitrate = 480, ++ .hw_value = 0x08, ++ .flags = 0 }, ++ { .bitrate = 540, ++ .hw_value = 0x0c, ++ .flags = 0 }, ++}; ++ + static void ath_cache_conf_rate(struct ath_softc *sc, + struct ieee80211_conf *conf) + { + switch (conf->channel->band) { + case IEEE80211_BAND_2GHZ: + if (conf_is_ht20(conf)) +- sc->cur_rate_table = +- sc->hw_rate_table[ATH9K_MODE_11NG_HT20]; ++ sc->cur_rate_mode = ATH9K_MODE_11NG_HT20; + else if (conf_is_ht40_minus(conf)) +- sc->cur_rate_table = +- sc->hw_rate_table[ATH9K_MODE_11NG_HT40MINUS]; ++ sc->cur_rate_mode = ATH9K_MODE_11NG_HT40MINUS; + else if (conf_is_ht40_plus(conf)) +- sc->cur_rate_table = +- sc->hw_rate_table[ATH9K_MODE_11NG_HT40PLUS]; ++ sc->cur_rate_mode = ATH9K_MODE_11NG_HT40PLUS; + else +- sc->cur_rate_table = +- sc->hw_rate_table[ATH9K_MODE_11G]; ++ sc->cur_rate_mode = ATH9K_MODE_11G; + break; + case IEEE80211_BAND_5GHZ: + if (conf_is_ht20(conf)) +- sc->cur_rate_table = +- sc->hw_rate_table[ATH9K_MODE_11NA_HT20]; ++ sc->cur_rate_mode = ATH9K_MODE_11NA_HT20; + else if (conf_is_ht40_minus(conf)) +- sc->cur_rate_table = +- sc->hw_rate_table[ATH9K_MODE_11NA_HT40MINUS]; ++ sc->cur_rate_mode = ATH9K_MODE_11NA_HT40MINUS; + else if (conf_is_ht40_plus(conf)) +- sc->cur_rate_table = +- sc->hw_rate_table[ATH9K_MODE_11NA_HT40PLUS]; ++ sc->cur_rate_mode = ATH9K_MODE_11NA_HT40PLUS; + else +- sc->cur_rate_table = +- sc->hw_rate_table[ATH9K_MODE_11A]; ++ sc->cur_rate_mode = ATH9K_MODE_11A; + break; + default: + BUG_ON(1); +@@ -190,51 +224,6 @@ static u8 parse_mpdudensity(u8 mpdudensi + } + } + +-static void ath_setup_rates(struct ath_softc *sc, enum ieee80211_band band) +-{ +- const struct ath_rate_table *rate_table = NULL; +- struct ieee80211_supported_band *sband; +- struct ieee80211_rate *rate; +- int i, maxrates; +- +- switch (band) { +- case IEEE80211_BAND_2GHZ: +- rate_table = sc->hw_rate_table[ATH9K_MODE_11G]; +- break; +- case IEEE80211_BAND_5GHZ: +- rate_table = sc->hw_rate_table[ATH9K_MODE_11A]; +- break; +- default: +- break; +- } +- +- if (rate_table == NULL) +- return; +- +- sband = &sc->sbands[band]; +- rate = sc->rates[band]; +- +- if (rate_table->rate_cnt > ATH_RATE_MAX) +- maxrates = ATH_RATE_MAX; +- else +- maxrates = rate_table->rate_cnt; +- +- for (i = 0; i < maxrates; i++) { +- rate[i].bitrate = rate_table->info[i].ratekbps / 100; +- rate[i].hw_value = rate_table->info[i].ratecode; +- if (rate_table->info[i].short_preamble) { +- rate[i].hw_value_short = rate_table->info[i].ratecode | +- rate_table->info[i].short_preamble; +- rate[i].flags = IEEE80211_RATE_SHORT_PREAMBLE; +- } +- sband->n_bitrates++; +- +- ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_CONFIG, +- "Rate: %2dMbps, ratecode: %2d\n", +- rate[i].bitrate / 10, rate[i].hw_value); +- } +-} +- + static struct ath9k_channel *ath_get_curchannel(struct ath_softc *sc, + struct ieee80211_hw *hw) + { +@@ -1707,12 +1696,6 @@ static int ath_init_softc(u16 devid, str + /* default to MONITOR mode */ + sc->sc_ah->opmode = NL80211_IFTYPE_MONITOR; + +- /* Setup rate tables */ +- +- ath_rate_attach(sc); +- ath_setup_rates(sc, IEEE80211_BAND_2GHZ); +- ath_setup_rates(sc, IEEE80211_BAND_5GHZ); +- + /* + * Allocate hardware transmit queues: one queue for + * beacon frames and one data queue for each QoS +@@ -1833,19 +1816,22 @@ static int ath_init_softc(u16 devid, str + /* setup channels and rates */ + + sc->sbands[IEEE80211_BAND_2GHZ].channels = ath9k_2ghz_chantable; +- sc->sbands[IEEE80211_BAND_2GHZ].bitrates = +- sc->rates[IEEE80211_BAND_2GHZ]; + sc->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ; + sc->sbands[IEEE80211_BAND_2GHZ].n_channels = + ARRAY_SIZE(ath9k_2ghz_chantable); ++ sc->sbands[IEEE80211_BAND_2GHZ].bitrates = ath9k_legacy_rates; ++ sc->sbands[IEEE80211_BAND_2GHZ].n_bitrates = ++ ARRAY_SIZE(ath9k_legacy_rates); + + if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes)) { + sc->sbands[IEEE80211_BAND_5GHZ].channels = ath9k_5ghz_chantable; +- sc->sbands[IEEE80211_BAND_5GHZ].bitrates = +- sc->rates[IEEE80211_BAND_5GHZ]; + sc->sbands[IEEE80211_BAND_5GHZ].band = IEEE80211_BAND_5GHZ; + sc->sbands[IEEE80211_BAND_5GHZ].n_channels = + ARRAY_SIZE(ath9k_5ghz_chantable); ++ sc->sbands[IEEE80211_BAND_5GHZ].bitrates = ++ ath9k_legacy_rates + 4; ++ sc->sbands[IEEE80211_BAND_5GHZ].n_bitrates = ++ ARRAY_SIZE(ath9k_legacy_rates) - 4; + } + + switch (ah->btcoex_hw.scheme) { +--- a/drivers/net/wireless/ath/ath9k/rc.h ++++ b/drivers/net/wireless/ath/ath9k/rc.h +@@ -104,6 +104,7 @@ enum { + */ + struct ath_rate_table { + int rate_cnt; ++ int mcs_start; + struct { + int valid; + int valid_single_stream; +@@ -111,14 +112,12 @@ struct ath_rate_table { + u32 ratekbps; + u32 user_ratekbps; + u8 ratecode; +- u8 short_preamble; + u8 dot11rate; + u8 ctrl_rate; + u8 base_index; + u8 cw40index; + u8 sgi_index; + u8 ht_index; +- u32 max_4ms_framelen; + } info[RATE_TABLE_SIZE]; + u32 probe_interval; + u8 initial_ratemax; +@@ -179,8 +178,6 @@ enum ath9k_internal_frame_type { + ATH9K_INT_UNPAUSE + }; + +-void ath_rate_attach(struct ath_softc *sc); +-u8 ath_rate_findrateix(struct ath_softc *sc, u8 dot11_rate); + int ath_rate_control_register(void); + void ath_rate_control_unregister(void); + +--- a/drivers/net/wireless/ath/ath9k/beacon.c ++++ b/drivers/net/wireless/ath/ath9k/beacon.c +@@ -65,9 +65,9 @@ static void ath_beacon_setup(struct ath_ + struct ath_common *common = ath9k_hw_common(ah); + struct ath_desc *ds; + struct ath9k_11n_rate_series series[4]; +- const struct ath_rate_table *rt; + int flags, antenna, ctsrate = 0, ctsduration = 0; +- u8 rate; ++ struct ieee80211_supported_band *sband; ++ u8 rate = 0; + + ds = bf->bf_desc; + flags = ATH9K_TXDESC_NOACK; +@@ -91,10 +91,10 @@ static void ath_beacon_setup(struct ath_ + + ds->ds_data = bf->bf_buf_addr; + +- rt = sc->cur_rate_table; +- rate = rt->info[0].ratecode; ++ sband = &sc->sbands[sc->hw->conf.channel->band]; ++ rate = sband->bitrates[0].hw_value; + if (sc->sc_flags & SC_OP_PREAMBLE_SHORT) +- rate |= rt->info[0].short_preamble; ++ rate |= sband->bitrates[0].hw_value_short; + + ath9k_hw_set11n_txdesc(ah, ds, skb->len + FCS_LEN, + ATH9K_PKT_TYPE_BEACON, +--- a/drivers/net/wireless/ath/ath9k/debug.h ++++ b/drivers/net/wireless/ath/ath9k/debug.h +@@ -18,6 +18,7 @@ + #define DEBUG_H + + #include "hw.h" ++#include "rc.h" + + struct ath_txq; + struct ath_buf; +@@ -138,7 +139,7 @@ void ath9k_exit_debug(struct ath_hw *ah) + int ath9k_debug_create_root(void); + void ath9k_debug_remove_root(void); + void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status); +-void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb); ++void ath_debug_stat_rc(struct ath_softc *sc, int final_rate); + void ath_debug_stat_tx(struct ath_softc *sc, struct ath_txq *txq, + struct ath_buf *bf); + void ath_debug_stat_retries(struct ath_softc *sc, int rix, +--- a/drivers/net/wireless/ath/ath9k/debug.c ++++ b/drivers/net/wireless/ath/ath9k/debug.c +@@ -255,21 +255,11 @@ static const struct file_operations fops + .owner = THIS_MODULE + }; + +-void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb) ++void ath_debug_stat_rc(struct ath_softc *sc, int final_rate) + { +- struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); +- struct ieee80211_tx_rate *rates = tx_info->status.rates; +- int final_ts_idx = 0, idx, i; + struct ath_rc_stats *stats; + +- for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { +- if (!rates[i].count) +- break; +- +- final_ts_idx = i; +- } +- idx = rates[final_ts_idx].idx; +- stats = &sc->debug.stats.rcstats[idx]; ++ stats = &sc->debug.stats.rcstats[final_rate]; + stats->success++; + } + From 89dfc3133ae37b6c1b18a1086342504339258b08 Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 15 Nov 2009 21:36:40 +0000 Subject: [PATCH 171/288] mac80211: add some missing patch chunks that were accidentally left out in the previous commit git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18430 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches/560-ath9k_rate_control_api.patch | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/package/mac80211/patches/560-ath9k_rate_control_api.patch b/package/mac80211/patches/560-ath9k_rate_control_api.patch index a9e4e5112..219bd8b16 100644 --- a/package/mac80211/patches/560-ath9k_rate_control_api.patch +++ b/package/mac80211/patches/560-ath9k_rate_control_api.patch @@ -1197,3 +1197,62 @@ stats->success++; } +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -149,22 +149,19 @@ bool ath9k_get_channel_edges(struct ath_ + } + + u16 ath9k_hw_computetxtime(struct ath_hw *ah, +- const struct ath_rate_table *rates, ++ u8 phy, int kbps, + u32 frameLen, u16 rateix, + bool shortPreamble) + { + u32 bitsPerSymbol, numBits, numSymbols, phyTime, txTime; +- u32 kbps; +- +- kbps = rates->info[rateix].ratekbps; + + if (kbps == 0) + return 0; + +- switch (rates->info[rateix].phy) { ++ switch (phy) { + case WLAN_RC_PHY_CCK: + phyTime = CCK_PREAMBLE_BITS + CCK_PLCP_BITS; +- if (shortPreamble && rates->info[rateix].short_preamble) ++ if (shortPreamble) + phyTime >>= 1; + numBits = frameLen << 3; + txTime = CCK_SIFS_TIME + phyTime + ((numBits * 1000) / kbps); +@@ -195,8 +192,7 @@ u16 ath9k_hw_computetxtime(struct ath_hw + break; + default: + ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, +- "Unknown phy %u (rate ix %u)\n", +- rates->info[rateix].phy, rateix); ++ "Unknown phy %u (rate ix %u)\n", phy, rateix); + txTime = 0; + break; + } +--- a/drivers/net/wireless/ath/ath9k/hw.h ++++ b/drivers/net/wireless/ath/ath9k/hw.h +@@ -670,7 +670,7 @@ bool ath9k_hw_wait(struct ath_hw *ah, u3 + u32 ath9k_hw_reverse_bits(u32 val, u32 n); + bool ath9k_get_channel_edges(struct ath_hw *ah, u16 flags, u16 *low, u16 *high); + u16 ath9k_hw_computetxtime(struct ath_hw *ah, +- const struct ath_rate_table *rates, ++ u8 phy, int kbps, + u32 frameLen, u16 rateix, bool shortPreamble); + void ath9k_hw_get_channel_centers(struct ath_hw *ah, + struct ath9k_channel *chan, +--- a/drivers/net/wireless/ath/ath9k/mac.h ++++ b/drivers/net/wireless/ath/ath9k/mac.h +@@ -616,7 +616,6 @@ enum ath9k_cipher { + + struct ath_hw; + struct ath9k_channel; +-struct ath_rate_table; + + u32 ath9k_hw_gettxbuf(struct ath_hw *ah, u32 q); + void ath9k_hw_puttxbuf(struct ath_hw *ah, u32 q, u32 txdp); From 76fbd95419d679c21622d15b0a35b9e8be466f5c Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 15 Nov 2009 22:05:03 +0000 Subject: [PATCH 172/288] mac80211: adjust patches based on upstream feedback git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18431 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../mac80211/patches/520-driver_flags.patch | 25 +++---------------- .../mac80211/patches/530-ath9k_cleanup.patch | 22 ++++++++-------- 2 files changed, 15 insertions(+), 32 deletions(-) diff --git a/package/mac80211/patches/520-driver_flags.patch b/package/mac80211/patches/520-driver_flags.patch index d27c502ec..13d85ee1e 100644 --- a/package/mac80211/patches/520-driver_flags.patch +++ b/package/mac80211/patches/520-driver_flags.patch @@ -1,37 +1,20 @@ --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -386,14 +386,17 @@ struct ieee80211_tx_rate { - * @flags: transmit info flags, defined above - * @band: the band to transmit on (use for checking for races) - * @antenna_sel_tx: antenna to use, 0 for automatic diversity -+ * @driver_flags: flags for internal driver use - * @pad: padding, ignore +@@ -390,10 +390,12 @@ struct ieee80211_tx_rate { * @control: union for control data * @status: union for status data * @driver_data: array of driver_data pointers - * @ampdu_ack_len: number of aggregated frames. -- * relevant only if IEEE80211_TX_STATUS_AMPDU was set. + * @ampdu_ack_len: number of acked aggregated frames. -+ * relevant only if ieee80211_tx_status_ampdu was set. + * relevant only if IEEE80211_TX_STATUS_AMPDU was set. * @ampdu_ack_map: block ack bit map for the aggregation. * relevant only if IEEE80211_TX_STATUS_AMPDU was set. + * @ampdu_len: number of aggregated frames. -+ * relevant only if ieee80211_tx_status_ampdu was set. ++ * relevant only if IEEE80211_TX_STATUS_AMPDU was set. * @ack_signal: signal strength of the ACK frame */ struct ieee80211_tx_info { -@@ -403,8 +406,8 @@ struct ieee80211_tx_info { - - u8 antenna_sel_tx; - -- /* 2 byte hole */ -- u8 pad[2]; -+ u8 driver_flags; -+ u8 pad; - - union { - struct { -@@ -428,7 +431,8 @@ struct ieee80211_tx_info { +@@ -428,7 +430,8 @@ struct ieee80211_tx_info { u8 ampdu_ack_len; u64 ampdu_ack_map; int ack_signal; diff --git a/package/mac80211/patches/530-ath9k_cleanup.patch b/package/mac80211/patches/530-ath9k_cleanup.patch index e16ccf1e2..ab205d573 100644 --- a/package/mac80211/patches/530-ath9k_cleanup.patch +++ b/package/mac80211/patches/530-ath9k_cleanup.patch @@ -52,7 +52,7 @@ - struct ath_tx_info_priv *tx_info_priv = ATH_TX_INFO_PRIV(tx_info); - if (tx_info_priv && tx_info_priv->frame_type == ATH9K_INT_PAUSE && -+ if ((tx_info->driver_flags & ATH_TX_INFO_FRAME_TYPE_PAUSE) && ++ if ((tx_info->pad[0] & ATH_TX_INFO_FRAME_TYPE_PAUSE) && aphy->state == ATH_WIPHY_PAUSING) { - if (!(info->flags & IEEE80211_TX_STAT_ACK)) { + if (!(tx_info->flags & IEEE80211_TX_STAT_ACK)) { @@ -127,15 +127,15 @@ - tx_info->rate_driver_data[0] = tx_info_priv; - tx_info_priv->aphy = aphy; - tx_info_priv->frame_type = txctl->frame_type; -+ tx_info->driver_flags = 0; ++ tx_info->pad[0] = 0; + switch (txctl->frame_type) { + case ATH9K_NOT_INTERNAL: + break; + case ATH9K_INT_PAUSE: -+ tx_info->driver_flags |= ATH_TX_INFO_FRAME_TYPE_PAUSE; ++ tx_info->pad[0] |= ATH_TX_INFO_FRAME_TYPE_PAUSE; + /* fall through */ + case ATH9K_INT_UNPAUSE: -+ tx_info->driver_flags |= ATH_TX_INFO_FRAME_TYPE_INTERNAL; ++ tx_info->pad[0] |= ATH_TX_INFO_FRAME_TYPE_INTERNAL; + break; + } hdrlen = ieee80211_get_hdrlen_from_skb(skb); @@ -194,7 +194,7 @@ - if (frame_type == ATH9K_NOT_INTERNAL) - ieee80211_tx_status(hw, skb); - else -+ if (unlikely(tx_info->driver_flags & ATH_TX_INFO_FRAME_TYPE_INTERNAL)) ++ if (unlikely(tx_info->pad[0] & ATH_TX_INFO_FRAME_TYPE_INTERNAL)) ath9k_tx_status(hw, skb); + else + ieee80211_tx_status(hw, skb); @@ -226,7 +226,7 @@ - tx_info_priv->update_rc = update_rc; + if (update_rc) -+ tx_info->driver_flags |= ATH_TX_INFO_UPDATE_RC; ++ tx_info->pad[0] |= ATH_TX_INFO_UPDATE_RC; if (ds->ds_txstat.ts_status & ATH9K_TXERR_FILT) tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED; @@ -239,10 +239,10 @@ - tx_info_priv->n_bad_frames = nbad; + if (ds->ds_txstat.ts_flags & + (ATH9K_TX_DATA_UNDERRUN | ATH9K_TX_DELIM_UNDERRUN)) -+ tx_info->driver_flags |= ATH_TX_INFO_UNDERRUN; ++ tx_info->pad[0] |= ATH_TX_INFO_UNDERRUN; + if ((ds->ds_txstat.ts_status & ATH9K_TXERR_XRETRY) || + (ds->ds_txstat.ts_status & ATH9K_TXERR_FIFO)) -+ tx_info->driver_flags |= ATH_TX_INFO_XRETRY; ++ tx_info->pad[0] |= ATH_TX_INFO_XRETRY; + tx_info->status.ampdu_len = bf->bf_nframes; + tx_info->status.ampdu_ack_len = bf->bf_nframes - nbad; } @@ -414,7 +414,7 @@ if (!priv_sta || !ieee80211_is_data(fc) || - !tx_info_priv->update_rc) - goto exit; -+ !(tx_info->driver_flags & ATH_TX_INFO_UPDATE_RC)) ++ !(tx_info->pad[0] & ATH_TX_INFO_UPDATE_RC)) + return; - if (tx_info_priv->tx.ts_status & ATH9K_TXERR_FILT) @@ -431,7 +431,7 @@ - if (tx_info_priv->tx.ts_flags & - (ATH9K_TX_DATA_UNDERRUN | ATH9K_TX_DELIM_UNDERRUN) && - ((sc->sc_ah->tx_trig_level) >= ath_rc_priv->tx_triglevel_max)) { -+ if ((tx_info->driver_flags & ATH_TX_INFO_UNDERRUN) && ++ if ((tx_info->pad[0] & ATH_TX_INFO_UNDERRUN) && + (sc->sc_ah->tx_trig_level >= ath_rc_priv->tx_triglevel_max)) { tx_status = 1; is_underrun = 1; @@ -439,7 +439,7 @@ - if ((tx_info_priv->tx.ts_status & ATH9K_TXERR_XRETRY) || - (tx_info_priv->tx.ts_status & ATH9K_TXERR_FIFO)) -+ if (tx_info->driver_flags & ATH_TX_INFO_XRETRY) ++ if (tx_info->pad[0] & ATH_TX_INFO_XRETRY) tx_status = 1; ath_rc_tx_status(sc, ath_rc_priv, tx_info, final_ts_idx, tx_status, From 1477f1e30e335b9ad2df451636277c714dc37797 Mon Sep 17 00:00:00 2001 From: jow Date: Sun, 15 Nov 2009 23:19:39 +0000 Subject: [PATCH 173/288] [brcm-2.4] add migration code to automatically convert old to new switch config on first boot, this will be removed at some point in the future git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18432 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../brcm-2.4/base-files/etc/init.d/netconfig | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/target/linux/brcm-2.4/base-files/etc/init.d/netconfig b/target/linux/brcm-2.4/base-files/etc/init.d/netconfig index 4d66962f9..b5d900a73 100755 --- a/target/linux/brcm-2.4/base-files/etc/init.d/netconfig +++ b/target/linux/brcm-2.4/base-files/etc/init.d/netconfig @@ -4,7 +4,41 @@ START=05 start() { - [ -e /etc/config/network ] && exit 0 + [ -e /etc/config/network ] && { + local batch + + config_cb() { + case "$1" in + switch) + option_cb() { + case "$1" in + vlan[0-9]|vlan1[0-5]) + local id="${1#vlan}" + append batch "delete network.eth0.${1}${N}" + append batch "set network.eth0_${n}=switch_vlan${N}" + append batch "set network.eth0_${n}.device=eth0${N}" + append batch "set network.eth0_${n}.vlan=${id}${N}" + append batch "set network.eth0_${n}.ports='${2}'${N}" + ;; + esac + } + ;; + switch_vlan) + option_cb() { :; } + batch="" + ;; + esac + } + + config_load network + + [ -n "$batch" ] && { + logger -t netconfig "migrating switch config to new format ..." + echo "$batch${N}commit network" | uci batch + } + + exit 0 + } mkdir -p /etc/config From ce940c98d6a3cfa5350b6f0b0a5b0af234c42087 Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 16 Nov 2009 00:44:39 +0000 Subject: [PATCH 174/288] ath: use GFP_DMA for rx buffer allocations to fix allocation errors on ixp4xx devices with more than 64 MB RAM git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18433 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/patches/570-ath_use_gfp_dma.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 package/mac80211/patches/570-ath_use_gfp_dma.patch diff --git a/package/mac80211/patches/570-ath_use_gfp_dma.patch b/package/mac80211/patches/570-ath_use_gfp_dma.patch new file mode 100644 index 000000000..af375b151 --- /dev/null +++ b/package/mac80211/patches/570-ath_use_gfp_dma.patch @@ -0,0 +1,11 @@ +--- a/drivers/net/wireless/ath/main.c ++++ b/drivers/net/wireless/ath/main.c +@@ -43,7 +43,7 @@ struct sk_buff *ath_rxbuf_alloc(struct a + * Unfortunately this means we may get 8 KB here from the + * kernel... and that is actually what is observed on some + * systems :( */ +- skb = __dev_alloc_skb(len + common->cachelsz - 1, gfp_mask); ++ skb = __dev_alloc_skb(len + common->cachelsz - 1, gfp_mask | GFP_DMA); + if (skb != NULL) { + off = ((unsigned long) skb->data) % common->cachelsz; + if (off != 0) From d71bee30b8e6b565782eef43b264bc504ce92e87 Mon Sep 17 00:00:00 2001 From: juhosg Date: Mon, 16 Nov 2009 17:31:22 +0000 Subject: [PATCH 175/288] ar71xx: use __init for ar{71,91}xx_usb_setup git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18434 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/files/arch/mips/ar71xx/devices.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c b/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c index d55022f88..65b7419ac 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c @@ -90,7 +90,7 @@ static struct platform_device ar71xx_ehci_device = { (RESET_MODULE_USB_HOST | RESET_MODULE_USB_PHY \ | RESET_MODULE_USB_OHCI_DLL) -static void ar71xx_usb_setup(void) +static void __init ar71xx_usb_setup(void) { ar71xx_device_stop(AR71XX_USB_RESET_MASK); mdelay(1000); @@ -105,7 +105,7 @@ static void ar71xx_usb_setup(void) mdelay(900); } -static void ar91xx_usb_setup(void) +static void __init ar91xx_usb_setup(void) { ar71xx_device_stop(RESET_MODULE_USBSUS_OVERRIDE); mdelay(10); From 1e99bb12ffac08cb6dfb7075b3096b31d7172380 Mon Sep 17 00:00:00 2001 From: juhosg Date: Mon, 16 Nov 2009 17:31:25 +0000 Subject: [PATCH 176/288] ar71xx: register LEDs and buttons on the WNDR3700 Thanks to aorlinks (https://forum.openwrt.org/viewtopic.php?pid=97415#p97415) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18435 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/base-files/etc/diag.sh | 3 + .../files/arch/mips/ar71xx/mach-wndr3700.c | 61 ++++++++++++++++++- 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index 053d6d439..82de0a992 100755 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -66,6 +66,9 @@ get_status_led() { tl-wr941nd) status_led="tl-wr941nd:green:system" ;; + wndr3700) + status_led="wndr3700:green:power" + ;; wnr2000) status_led="wnr2000:green:power" ;; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c index aee68cb9f..1599dce05 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -21,6 +22,17 @@ #include "devices.h" +#define WNDR3700_GPIO_LED_WPS_ORANGE 0 +#define WNDR3700_GPIO_LED_POWER_ORANGE 1 +#define WNDR3700_GPIO_LED_POWER_GREEN 2 +#define WNDR3700_GPIO_LED_WPS_GREEN 4 + +#define WNDR3700_GPIO_BTN_WPS 3 +#define WNDR3700_GPIO_BTN_RESET 8 +#define WNDR3700_GPIO_BTN_WIFI 11 + +#define WNDR3700_BUTTONS_POLL_INTERVAL 20 + #ifdef CONFIG_MTD_PARTITIONS static struct mtd_partition wndr3700_partitions[] = { { @@ -100,6 +112,48 @@ static struct spi_board_info wndr3700_spi_info[] = { } }; +static struct gpio_led wndr3700_leds_gpio[] __initdata = { + { + .name = "wndr3700:green:power", + .gpio = WNDR3700_GPIO_LED_POWER_GREEN, + .active_low = 1, + }, { + .name = "wndr3700:orange:power", + .gpio = WNDR3700_GPIO_LED_POWER_ORANGE, + .active_low = 1, + }, { + .name = "wndr3700:green:wps", + .gpio = WNDR3700_GPIO_LED_WPS_GREEN, + .active_low = 1, + }, { + .name = "wndr3700:orange:wps", + .gpio = WNDR3700_GPIO_LED_WPS_ORANGE, + .active_low = 1, + } +}; + +static struct gpio_button wndr3700_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = BTN_0, + .threshold = 5, + .gpio = WNDR3700_GPIO_BTN_RESET, + }, { + .desc = "wps", + .type = EV_KEY, + .code = BTN_1, + .threshold = 5, + .gpio = WNDR3700_GPIO_BTN_WPS, + } , { + .desc = "wifi", + .type = EV_KEY, + .code = BTN_2, + .threshold = 5, + .gpio = WNDR3700_GPIO_BTN_WIFI, + } +}; + static void __init wndr3700_setup(void) { u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000); @@ -125,7 +179,12 @@ static void __init wndr3700_setup(void) ar71xx_add_device_spi(NULL, wndr3700_spi_info, ARRAY_SIZE(wndr3700_spi_info)); - /* TODO: LEDs, buttons support */ + ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wndr3700_leds_gpio), + wndr3700_leds_gpio); + + ar71xx_add_device_gpio_buttons(-1, WNDR3700_BUTTONS_POLL_INTERVAL, + ARRAY_SIZE(wndr3700_gpio_buttons), + wndr3700_gpio_buttons); } MIPS_MACHINE(AR71XX_MACH_WNDR3700, "NETGEAR WNDR3700", wndr3700_setup); From 672034cb983af45eb0715fd5a28c6591eaa92598 Mon Sep 17 00:00:00 2001 From: juhosg Date: Mon, 16 Nov 2009 17:31:29 +0000 Subject: [PATCH 177/288] package/mac80211: use platform_data on PCI devices in ath9k git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18436 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/Makefile | 2 +- ...m-data-from-platform-data-on-pci-bus.patch | 58 +++++++++++++++++++ ...ROM-only-if-no-platform-data-present.patch | 43 ++++++++++++++ .../patches/560-ath9k_rate_control_api.patch | 8 +-- 4 files changed, 106 insertions(+), 5 deletions(-) create mode 100644 package/mac80211/patches/405-ath9k-read-eeprom-data-from-platform-data-on-pci-bus.patch create mode 100644 package/mac80211/patches/406-ath9k-set-AH_USE_EEPROM-only-if-no-platform-data-present.patch diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile index e4e9b7b54..d28e08d3a 100644 --- a/package/mac80211/Makefile +++ b/package/mac80211/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 PKG_VERSION:=2009-11-13 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL:= \ http://www.orbit-lab.org/kernel/compat-wireless-2.6/2009/11 \ http://wireless.kernel.org/download/compat-wireless-2.6 diff --git a/package/mac80211/patches/405-ath9k-read-eeprom-data-from-platform-data-on-pci-bus.patch b/package/mac80211/patches/405-ath9k-read-eeprom-data-from-platform-data-on-pci-bus.patch new file mode 100644 index 000000000..2f33d2e20 --- /dev/null +++ b/package/mac80211/patches/405-ath9k-read-eeprom-data-from-platform-data-on-pci-bus.patch @@ -0,0 +1,58 @@ +--- a/drivers/net/wireless/ath/ath9k/pci.c ++++ b/drivers/net/wireless/ath/ath9k/pci.c +@@ -16,6 +16,7 @@ + + #include + #include ++#include + #include "ath9k.h" + + static struct pci_device_id ath_pci_id_table[] __devinitdata = { +@@ -61,21 +62,36 @@ static void ath_pci_cleanup(struct ath_c + + static bool ath_pci_eeprom_read(struct ath_common *common, u32 off, u16 *data) + { +- struct ath_hw *ah = (struct ath_hw *) common->ah; ++ struct ath_softc *sc = (struct ath_softc *) common->priv; ++ struct ath9k_platform_data *pdata = sc->dev->platform_data; + +- common->ops->read(ah, AR5416_EEPROM_OFFSET + (off << AR5416_EEPROM_S)); ++ if (pdata) { ++ if (off >= (ARRAY_SIZE(pdata->eeprom_data))) { ++ ath_print(common, ATH_DBG_FATAL, ++ "%s: eeprom read failed, offset %08x " ++ "is out of range\n", ++ __func__, off); ++ } ++ ++ *data = pdata->eeprom_data[off]; ++ } else { ++ struct ath_hw *ah = (struct ath_hw *) common->ah; ++ ++ common->ops->read(ah, AR5416_EEPROM_OFFSET + ++ (off << AR5416_EEPROM_S)); ++ ++ if (!ath9k_hw_wait(ah, ++ AR_EEPROM_STATUS_DATA, ++ AR_EEPROM_STATUS_DATA_BUSY | ++ AR_EEPROM_STATUS_DATA_PROT_ACCESS, 0, ++ AH_WAIT_TIMEOUT)) { ++ return false; ++ } + +- if (!ath9k_hw_wait(ah, +- AR_EEPROM_STATUS_DATA, +- AR_EEPROM_STATUS_DATA_BUSY | +- AR_EEPROM_STATUS_DATA_PROT_ACCESS, 0, +- AH_WAIT_TIMEOUT)) { +- return false; ++ *data = MS(common->ops->read(ah, AR_EEPROM_STATUS_DATA), ++ AR_EEPROM_STATUS_DATA_VAL); + } + +- *data = MS(common->ops->read(ah, AR_EEPROM_STATUS_DATA), +- AR_EEPROM_STATUS_DATA_VAL); +- + return true; + } + diff --git a/package/mac80211/patches/406-ath9k-set-AH_USE_EEPROM-only-if-no-platform-data-present.patch b/package/mac80211/patches/406-ath9k-set-AH_USE_EEPROM-only-if-no-platform-data-present.patch new file mode 100644 index 000000000..8beb224c9 --- /dev/null +++ b/package/mac80211/patches/406-ath9k-set-AH_USE_EEPROM-only-if-no-platform-data-present.patch @@ -0,0 +1,43 @@ +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -433,11 +433,8 @@ static void ath9k_hw_init_defaults(struc + ah->hw_version.magic = AR5416_MAGIC; + ah->hw_version.subvendorid = 0; + +- ah->ah_flags = 0; + if (ah->hw_version.devid == AR5416_AR9100_DEVID) + ah->hw_version.macVersion = AR_SREV_VERSION_9100; +- if (!AR_SREV_9100(ah)) +- ah->ah_flags = AH_USE_EEPROM; + + ah->atim_window = 0; + ah->sta_id1_defaults = AR_STA_ID1_CRPT_MIC_ENABLE; +--- a/drivers/net/wireless/ath/ath9k/main.c ++++ b/drivers/net/wireless/ath/ath9k/main.c +@@ -15,6 +15,7 @@ + */ + + #include ++#include + #include "ath9k.h" + #include "btcoex.h" + +@@ -1633,6 +1634,7 @@ static int ath_init_softc(u16 devid, str + { + struct ath_hw *ah = NULL; + struct ath_common *common; ++ struct ath9k_platform_data *pdata; + int r = 0, i; + int csz = 0; + int qnum; +@@ -1656,6 +1658,10 @@ static int ath_init_softc(u16 devid, str + + ah->hw_version.devid = devid; + ah->hw_version.subsysid = subsysid; ++ pdata = (struct ath9k_platform_data *) sc->dev->platform_data; ++ if (!pdata) ++ ah->ah_flags |= AH_USE_EEPROM; ++ + sc->sc_ah = ah; + + common = ath9k_hw_common(ah); diff --git a/package/mac80211/patches/560-ath9k_rate_control_api.patch b/package/mac80211/patches/560-ath9k_rate_control_api.patch index 219bd8b16..13ada5da0 100644 --- a/package/mac80211/patches/560-ath9k_rate_control_api.patch +++ b/package/mac80211/patches/560-ath9k_rate_control_api.patch @@ -910,7 +910,7 @@ struct ath_led radio_led; --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -104,37 +104,71 @@ static struct ieee80211_channel ath9k_5g +@@ -105,37 +105,71 @@ static struct ieee80211_channel ath9k_5g CHAN5G(5825, 37), /* Channel 165 */ }; @@ -998,7 +998,7 @@ break; default: BUG_ON(1); -@@ -190,51 +224,6 @@ static u8 parse_mpdudensity(u8 mpdudensi +@@ -191,51 +225,6 @@ static u8 parse_mpdudensity(u8 mpdudensi } } @@ -1050,7 +1050,7 @@ static struct ath9k_channel *ath_get_curchannel(struct ath_softc *sc, struct ieee80211_hw *hw) { -@@ -1707,12 +1696,6 @@ static int ath_init_softc(u16 devid, str +@@ -1713,12 +1702,6 @@ static int ath_init_softc(u16 devid, str /* default to MONITOR mode */ sc->sc_ah->opmode = NL80211_IFTYPE_MONITOR; @@ -1063,7 +1063,7 @@ /* * Allocate hardware transmit queues: one queue for * beacon frames and one data queue for each QoS -@@ -1833,19 +1816,22 @@ static int ath_init_softc(u16 devid, str +@@ -1839,19 +1822,22 @@ static int ath_init_softc(u16 devid, str /* setup channels and rates */ sc->sbands[IEEE80211_BAND_2GHZ].channels = ath9k_2ghz_chantable; From aeb76a3ddf319e7596c9f8edba9b0ec9e6d603f6 Mon Sep 17 00:00:00 2001 From: juhosg Date: Mon, 16 Nov 2009 17:31:32 +0000 Subject: [PATCH 178/288] ar71xx: setup platform data for ath9k on the TL-WR741ND, Bullet M and on the WNDR3700 boards git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18437 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../files/arch/mips/ar71xx/mach-tl-wr741nd.c | 28 +++++++++++- .../ar71xx/files/arch/mips/ar71xx/mach-ubnt.c | 30 ++++++++++++- .../files/arch/mips/ar71xx/mach-wndr3700.c | 43 ++++++++++++++++++- 3 files changed, 96 insertions(+), 5 deletions(-) diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c index cbf774849..10f7e8ead 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c @@ -8,12 +8,14 @@ * by the Free Software Foundation. */ +#include #include #include #include #include #include #include +#include #include @@ -105,6 +107,7 @@ static struct gpio_button tl_wr741nd_gpio_buttons[] __initdata = { } }; +#ifdef CONFIG_PCI static struct ar71xx_pci_irq tl_wr741nd_pci_irqs[] __initdata = { { .slot = 0, @@ -113,6 +116,29 @@ static struct ar71xx_pci_irq tl_wr741nd_pci_irqs[] __initdata = { } }; +static struct ath9k_platform_data tl_wr741nd_wmac_data; + +static int tl_wr741nd_pci_plat_dev_init(struct pci_dev *dev) +{ + dev->dev.platform_data = &tl_wr741nd_wmac_data; + return 0; +} + +static void tl_wr741nd_pci_init(void) +{ + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); + + memcpy(tl_wr741nd_wmac_data.eeprom_data, ee, + sizeof(tl_wr741nd_wmac_data.eeprom_data)); + + ar71xx_pci_plat_dev_init = tl_wr741nd_pci_plat_dev_init; + + ar71xx_pci_init(ARRAY_SIZE(tl_wr741nd_pci_irqs), tl_wr741nd_pci_irqs); +} +#else +static inline void tl_wr741nd_pci_init(void) { }; +#endif /* CONFIG_PCI */ + static void __init tl_wr741nd_setup(void) { u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); @@ -145,6 +171,6 @@ static void __init tl_wr741nd_setup(void) ARRAY_SIZE(tl_wr741nd_gpio_buttons), tl_wr741nd_gpio_buttons); - ar71xx_pci_init(ARRAY_SIZE(tl_wr741nd_pci_irqs), tl_wr741nd_pci_irqs); + tl_wr741nd_pci_init(); } MIPS_MACHINE(AR71XX_MACH_TL_WR741ND, "TP-LINK TL-WR741ND", tl_wr741nd_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c index 177b26463..5ba0c8709 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c @@ -10,10 +10,12 @@ * by the Free Software Foundation. */ +#include #include #include #include #include +#include #include #include @@ -244,6 +246,7 @@ static void __init ubnt_lssr71_setup(void) MIPS_MACHINE(AR71XX_MACH_UBNT_LSSR71, "Ubiquiti LS-SR71", ubnt_lssr71_setup); +#ifdef CONFIG_PCI static struct ar71xx_pci_irq ubnt_bullet_m_pci_irqs[] __initdata = { { .slot = 0, @@ -252,6 +255,30 @@ static struct ar71xx_pci_irq ubnt_bullet_m_pci_irqs[] __initdata = { } }; +static struct ath9k_platform_data ubnt_bullet_m_wmac_data; + +static int ubmnt_bullet_m_pci_plat_dev_init(struct pci_dev *dev) +{ + dev->dev.platform_data = &ubnt_bullet_m_wmac_data; + return 0; +} + +static void __init ubnt_bullet_m_pci_init(void) +{ + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); + + memcpy(ubnt_bullet_m_wmac_data.eeprom_data, ee, + sizeof(ubnt_bullet_m_wmac_data.eeprom_data)); + + ar71xx_pci_plat_dev_init = ubmnt_bullet_m_pci_plat_dev_init; + + ar71xx_pci_init(ARRAY_SIZE(ubnt_bullet_m_pci_irqs), + ubnt_bullet_m_pci_irqs); +} +#else +static inline void ubnt_bullet_m_pci_init(void) { }; +#endif /* CONFIG_PCI */ + static void __init ubnt_bullet_m_setup(void) { u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000); @@ -277,8 +304,7 @@ static void __init ubnt_bullet_m_setup(void) ARRAY_SIZE(ubnt_bullet_m_gpio_buttons), ubnt_bullet_m_gpio_buttons); - ar71xx_pci_init(ARRAY_SIZE(ubnt_bullet_m_pci_irqs), - ubnt_bullet_m_pci_irqs); + ubnt_bullet_m_pci_init(); } MIPS_MACHINE(AR71XX_MACH_UBNT_BULLET_M, "Ubiquiti Bullet M", ubnt_bullet_m_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c index 1599dce05..3f0103e46 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c @@ -15,6 +15,8 @@ #include #include #include +#include +#include #include #include @@ -90,6 +92,7 @@ static struct flash_platform_data wndr3700_flash_data = { #endif }; +#ifdef CONFIG_PCI static struct ar71xx_pci_irq wndr3700_pci_irqs[] __initdata = { { .slot = 0, @@ -102,6 +105,42 @@ static struct ar71xx_pci_irq wndr3700_pci_irqs[] __initdata = { } }; +static struct ath9k_platform_data wndr3700_wmac0_data; +static struct ath9k_platform_data wndr3700_wmac1_data; + +static int wndr3700_pci_plat_dev_init(struct pci_dev *dev) +{ + switch (PCI_SLOT(dev->devfn)) { + case 17: + dev->dev.platform_data = &wndr3700_wmac0_data; + break; + case 18: + dev->dev.platform_data = &wndr3700_wmac1_data; + break; + } + + return 0; +} + +static void __init wndr3700_pci_init(void) +{ + u8 *ee; + + ee = (u8 *) KSEG1ADDR(0x1fff1000); + memcpy(wndr3700_wmac0_data.eeprom_data, ee, + sizeof(wndr3700_wmac0_data.eeprom_data)); + + ee = (u8 *) KSEG1ADDR(0x1fff5000); + memcpy(wndr3700_wmac1_data.eeprom_data, ee, + sizeof(wndr3700_wmac1_data.eeprom_data)); + + ar71xx_pci_plat_dev_init = wndr3700_pci_plat_dev_init; + ar71xx_pci_init(ARRAY_SIZE(wndr3700_pci_irqs), wndr3700_pci_irqs); +} +#else +static inline void wndr3700_pci_init(void) { }; +#endif /* CONFIG_PCI */ + static struct spi_board_info wndr3700_spi_info[] = { { .bus_num = 0, @@ -174,8 +213,6 @@ static void __init wndr3700_setup(void) ar71xx_add_device_usb(); - ar71xx_pci_init(ARRAY_SIZE(wndr3700_pci_irqs), wndr3700_pci_irqs); - ar71xx_add_device_spi(NULL, wndr3700_spi_info, ARRAY_SIZE(wndr3700_spi_info)); @@ -185,6 +222,8 @@ static void __init wndr3700_setup(void) ar71xx_add_device_gpio_buttons(-1, WNDR3700_BUTTONS_POLL_INTERVAL, ARRAY_SIZE(wndr3700_gpio_buttons), wndr3700_gpio_buttons); + + wndr3700_pci_init(); } MIPS_MACHINE(AR71XX_MACH_WNDR3700, "NETGEAR WNDR3700", wndr3700_setup); From a3aca9dfa3cdb4522d2669e2e6d2d4ef5ede0c5e Mon Sep 17 00:00:00 2001 From: nbd Date: Tue, 17 Nov 2009 04:36:07 +0000 Subject: [PATCH 179/288] mklibs: fix missing __pack_f symbol in uclibc after relink git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18438 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches/009-uclibc_libgcc_link.patch | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tools/mklibs/patches/009-uclibc_libgcc_link.patch diff --git a/tools/mklibs/patches/009-uclibc_libgcc_link.patch b/tools/mklibs/patches/009-uclibc_libgcc_link.patch new file mode 100644 index 000000000..2312d6a2c --- /dev/null +++ b/tools/mklibs/patches/009-uclibc_libgcc_link.patch @@ -0,0 +1,27 @@ +--- a/src/mklibs.py ++++ b/src/mklibs.py +@@ -560,6 +560,7 @@ while 1: + extra_flags = [] + extra_pre_obj = [] + extra_post_obj = [] ++ libgcc_link = "-lgcc" + + symbols.update(library_symbols_used[library]) + +@@ -575,6 +576,7 @@ while 1: + symbols.add(ProvidedSymbol('__uClibc_init', None, None, True)) + symbols.add(ProvidedSymbol('__uClibc_fini', None, None, True)) + extra_flags.append("-Wl,-init,__uClibc_init") ++ libgcc_link = "-lgcc_s_pic" + + map_file = find_pic_map(library) + if map_file: +@@ -590,7 +592,7 @@ while 1: + cmd.append(pic_file) + cmd.extend(extra_post_obj) + cmd.extend(extra_flags) +- cmd.append("-lgcc") ++ cmd.append(libgcc_link) + cmd.extend(["-L%s" % a for a in [dest_path] + [sysroot + b for b in lib_path if sysroot == "" or b not in ("/" + libdir + "/", "/usr/" + libdir + "/")]]) + cmd.append(library_depends_gcc_libnames(so_file, soname)) + command(target + "gcc", *cmd) From 0dc48c489fa98b8af4cea30b1d5e8ddb1fa5c0c9 Mon Sep 17 00:00:00 2001 From: kaloz Date: Tue, 17 Nov 2009 10:04:41 +0000 Subject: [PATCH 180/288] replace our arm LZMA loader with the one that goes upstream git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18439 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic-2.6/config-2.6.31 | 4 + target/linux/generic-2.6/config-2.6.32 | 4 + ...t_h_fix_usage_for_compressed_kernels.patch | 79 ++ .../050-lzo_compressed_kernels.patch | 321 ++++++++ .../051-lzo_compressed_kernel_for_arm.patch | 298 ++++++++ .../052-lzo_compressed_kernel_for_x86.patch | 54 ++ .../053-lzo_compression_for_initramfs.patch | 114 +++ .../patches-2.6.31/055-lzma_arm_kernel.patch | 69 ++ .../patches-2.6.31/960-arm_lzma_loader.patch | 710 ------------------ .../050-lzo_compressed_kernels.patch | 309 ++++++++ .../051-lzo_compressed_kernel_for_arm.patch | 283 +++++++ .../052-lzo_compressed_kernel_for_x86.patch | 48 ++ .../053-lzo_compression_for_initramfs.patch | 106 +++ .../patches-2.6.32/055-lzma_arm_kernel.patch | 57 ++ .../patches-2.6.32/960-arm_lzma_loader.patch | 710 ------------------ 15 files changed, 1746 insertions(+), 1420 deletions(-) create mode 100644 target/linux/generic-2.6/patches-2.6.31/049-byteshift_h_fix_usage_for_compressed_kernels.patch create mode 100644 target/linux/generic-2.6/patches-2.6.31/050-lzo_compressed_kernels.patch create mode 100644 target/linux/generic-2.6/patches-2.6.31/051-lzo_compressed_kernel_for_arm.patch create mode 100644 target/linux/generic-2.6/patches-2.6.31/052-lzo_compressed_kernel_for_x86.patch create mode 100644 target/linux/generic-2.6/patches-2.6.31/053-lzo_compression_for_initramfs.patch create mode 100644 target/linux/generic-2.6/patches-2.6.31/055-lzma_arm_kernel.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.31/960-arm_lzma_loader.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/050-lzo_compressed_kernels.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/051-lzo_compressed_kernel_for_arm.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/052-lzo_compressed_kernel_for_x86.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/053-lzo_compression_for_initramfs.patch create mode 100644 target/linux/generic-2.6/patches-2.6.32/055-lzma_arm_kernel.patch delete mode 100644 target/linux/generic-2.6/patches-2.6.32/960-arm_lzma_loader.patch diff --git a/target/linux/generic-2.6/config-2.6.31 b/target/linux/generic-2.6/config-2.6.31 index 86647470a..2fec40966 100644 --- a/target/linux/generic-2.6/config-2.6.31 +++ b/target/linux/generic-2.6/config-2.6.31 @@ -1026,6 +1026,9 @@ CONFIG_JOLIET=y # CONFIG_KALLSYMS is not set # CONFIG_KARMA_PARTITION is not set # CONFIG_KEXEC is not set +# CONFIG_KERNEL_GZIP is not set +CONFIG_KERNEL_LZMA=y +# CONFIG_KERNEL_LZO is not set # CONFIG_KEYBOARD_LM8323 is not set # CONFIG_KEYS is not set # CONFIG_KMEMTRACE is not set @@ -1673,6 +1676,7 @@ CONFIG_RAMFS=y # CONFIG_RDC_17F3101X is not set # CONFIG_RD_GZIP is not set CONFIG_RD_LZMA=y +# CONFIG_RD_LZO is not set # CONFIG_REALTEK_PHY is not set # CONFIG_REDWOOD is not set # CONFIG_REGULATOR_BQ24022 is not set diff --git a/target/linux/generic-2.6/config-2.6.32 b/target/linux/generic-2.6/config-2.6.32 index 2da564028..b99d86497 100644 --- a/target/linux/generic-2.6/config-2.6.32 +++ b/target/linux/generic-2.6/config-2.6.32 @@ -1036,6 +1036,9 @@ CONFIG_JOLIET=y # CONFIG_KALLSYMS is not set # CONFIG_KARMA_PARTITION is not set # CONFIG_KEXEC is not set +# CONFIG_KERNEL_GZIP is not set +CONFIG_KERNEL_LZMA=y +# CONFIG_KERNEL_LZO is not set # CONFIG_KEYBOARD_LM8323 is not set # CONFIG_KEYS is not set # CONFIG_KMEMTRACE is not set @@ -1688,6 +1691,7 @@ CONFIG_RCU_FANOUT=32 # CONFIG_RDC_17F3101X is not set # CONFIG_RD_GZIP is not set CONFIG_RD_LZMA=y +# CONFIG_RD_LZO is not set # CONFIG_RDS is not set # CONFIG_REALTEK_PHY is not set # CONFIG_REDWOOD is not set diff --git a/target/linux/generic-2.6/patches-2.6.31/049-byteshift_h_fix_usage_for_compressed_kernels.patch b/target/linux/generic-2.6/patches-2.6.31/049-byteshift_h_fix_usage_for_compressed_kernels.patch new file mode 100644 index 000000000..102a82982 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.31/049-byteshift_h_fix_usage_for_compressed_kernels.patch @@ -0,0 +1,79 @@ +From 2fa4341074cd02fb39aa23410740764948755635 Mon Sep 17 00:00:00 2001 +From: Albin Tonnerre +Date: Wed, 23 Sep 2009 15:57:38 -0700 +Subject: [PATCH] include/linux/unaligned/{l,b}e_byteshift.h: fix usage for compressed kernels + +When unaligned accesses are required for uncompressing a kernel (such as +for LZO decompression on ARM in a patch that follows), including + causes issues as it brings in a lot of things that are +not available in the decompression environment. + +linux/kernel.h brings at least: +extern int console_printk[]; +extern const char hex_asc[]; +which causes errors at link-time as they are not available when +compiling the pre-boot environement. There are also a few others: + + arch/arm/boot/compressed/misc.o: In function `valid_user_regs': + arch/arm/include/asm/ptrace.h:158: undefined reference to `elf_hwcap' + arch/arm/boot/compressed/misc.o: In function `console_silent': + include/linux/kernel.h:292: undefined reference to `console_printk' + arch/arm/boot/compressed/misc.o: In function `console_verbose': + include/linux/kernel.h:297: undefined reference to `console_printk' + arch/arm/boot/compressed/misc.o: In function `pack_hex_byte': + include/linux/kernel.h:360: undefined reference to `hex_asc' + arch/arm/boot/compressed/misc.o: In function `hweight_long': + include/linux/bitops.h:45: undefined reference to `hweight32' + arch/arm/boot/compressed/misc.o: In function `__cmpxchg_local_generic': + include/asm-generic/cmpxchg-local.h:21: undefined reference to `wrong_size_cmpxchg' + include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg' + arch/arm/boot/compressed/misc.o: In function `__xchg': + arch/arm/include/asm/system.h:309: undefined reference to `__bad_xchg' + +However, those files apparently use nothing from , all +they need is the declaration of types such as u32 or u64, so + should be enough + +Signed-off-by: Albin Tonnerre +Cc: Sam Ravnborg +Cc: Russell King +Cc: Ingo Molnar +Cc: Thomas Gleixner +Cc: "H. Peter Anvin" +Cc: Phillip Lougher +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +--- + include/linux/unaligned/be_byteshift.h | 2 +- + include/linux/unaligned/le_byteshift.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/linux/unaligned/be_byteshift.h b/include/linux/unaligned/be_byteshift.h +index 46dd12c..9356b24 100644 +--- a/include/linux/unaligned/be_byteshift.h ++++ b/include/linux/unaligned/be_byteshift.h +@@ -1,7 +1,7 @@ + #ifndef _LINUX_UNALIGNED_BE_BYTESHIFT_H + #define _LINUX_UNALIGNED_BE_BYTESHIFT_H + +-#include ++#include + + static inline u16 __get_unaligned_be16(const u8 *p) + { +diff --git a/include/linux/unaligned/le_byteshift.h b/include/linux/unaligned/le_byteshift.h +index 59777e9..be376fb 100644 +--- a/include/linux/unaligned/le_byteshift.h ++++ b/include/linux/unaligned/le_byteshift.h +@@ -1,7 +1,7 @@ + #ifndef _LINUX_UNALIGNED_LE_BYTESHIFT_H + #define _LINUX_UNALIGNED_LE_BYTESHIFT_H + +-#include ++#include + + static inline u16 __get_unaligned_le16(const u8 *p) + { +-- +1.6.5.1 + diff --git a/target/linux/generic-2.6/patches-2.6.31/050-lzo_compressed_kernels.patch b/target/linux/generic-2.6/patches-2.6.31/050-lzo_compressed_kernels.patch new file mode 100644 index 000000000..fad1b8746 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.31/050-lzo_compressed_kernels.patch @@ -0,0 +1,321 @@ +diff --git a/include/linux/decompress/unlzo.h b/include/linux/decompress/unlzo.h +new file mode 100644 +index 0000000..9872297 +--- /dev/null ++++ b/include/linux/decompress/unlzo.h +@@ -0,0 +1,10 @@ ++#ifndef DECOMPRESS_UNLZO_H ++#define DECOMPRESS_UNLZO_H ++ ++int unlzo(unsigned char *inbuf, int len, ++ int(*fill)(void*, unsigned int), ++ int(*flush)(void*, unsigned int), ++ unsigned char *output, ++ int *pos, ++ void(*error)(char *x)); ++#endif +diff --git a/init/Kconfig b/init/Kconfig +index f515864..eb65318 100644 +--- a/init/Kconfig ++++ b/init/Kconfig +@@ -115,10 +115,13 @@ config HAVE_KERNEL_BZIP2 + config HAVE_KERNEL_LZMA + bool + ++config HAVE_KERNEL_LZO ++ bool ++ + choice + prompt "Kernel compression mode" + default KERNEL_GZIP +- depends on HAVE_KERNEL_GZIP || HAVE_KERNEL_BZIP2 || HAVE_KERNEL_LZMA ++ depends on HAVE_KERNEL_GZIP || HAVE_KERNEL_BZIP2 || HAVE_KERNEL_LZMA || HAVE_KERNEL_LZO + help + The linux kernel is a kind of self-extracting executable. + Several compression algorithms are available, which differ +@@ -141,9 +144,8 @@ config KERNEL_GZIP + bool "Gzip" + depends on HAVE_KERNEL_GZIP + help +- The old and tried gzip compression. Its compression ratio is +- the poorest among the 3 choices; however its speed (both +- compression and decompression) is the fastest. ++ The old and tried gzip compression. It provides a good balance ++ between compression ratio and decompression speed. + + config KERNEL_BZIP2 + bool "Bzip2" +@@ -164,6 +166,14 @@ config KERNEL_LZMA + two. Compression is slowest. The kernel size is about 33% + smaller with LZMA in comparison to gzip. + ++config KERNEL_LZO ++ bool "LZO" ++ depends on HAVE_KERNEL_LZO ++ help ++ Its compression ratio is the poorest among the 4. The kernel ++ size is about about 10% bigger than gzip; however its speed ++ (both compression and decompression) is the fastest. ++ + endchoice + + config SWAP +diff --git a/lib/decompress_unlzo.c b/lib/decompress_unlzo.c +new file mode 100644 +index 0000000..2bb736f +--- /dev/null ++++ b/lib/decompress_unlzo.c +@@ -0,0 +1,208 @@ ++/* ++ * LZO decompressor for the Linux kernel. Code borrowed from the lzo ++ * implementation by Markus Franz Xaver Johannes Oberhumer. ++ * ++ * Linux kernel adaptation: ++ * Copyright (C) 2009 ++ * Albin Tonnerre, Free Electrons ++ * ++ * Original code: ++ * Copyright (C) 1996-2005 Markus Franz Xaver Johannes Oberhumer ++ * All Rights Reserved. ++ * ++ * lzop and the LZO library are free software; you can redistribute them ++ * and/or modify them under the terms of the GNU General Public License as ++ * published by the Free Software Foundation; either version 2 of ++ * the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; see the file COPYING. ++ * If not, write to the Free Software Foundation, Inc., ++ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * Markus F.X.J. Oberhumer ++ * ++ * http://www.oberhumer.com/opensource/lzop/ ++ */ ++ ++#ifdef STATIC ++#include "lzo/lzo1x_decompress.c" ++#else ++#include ++#include ++#endif ++ ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const unsigned char lzop_magic[] = ++ { 0x89, 0x4c, 0x5a, 0x4f, 0x00, 0x0d, 0x0a, 0x1a, 0x0a }; ++ ++#define LZO_BLOCK_SIZE (256*1024l) ++#define HEADER_HAS_FILTER 0x00000800L ++ ++STATIC inline int INIT parse_header(u8 *input, u8 *skip) ++{ ++ int l; ++ u8 *parse = input; ++ u8 level = 0; ++ u16 version; ++ ++ /* read magic: 9 first bits */ ++ for (l = 0; l < 9; l++) { ++ if (*parse++ != lzop_magic[l]) ++ return 0; ++ } ++ /* get version (2bytes), skip library version (2), ++ * 'need to be extracted' version (2) and ++ * method (1) */ ++ version = get_unaligned_be16(parse); ++ parse += 7; ++ if (version >= 0x0940) ++ level = *parse++; ++ if (get_unaligned_be32(parse) & HEADER_HAS_FILTER) ++ parse += 8; /* flags + filter info */ ++ else ++ parse += 4; /* flags */ ++ ++ /* skip mode and mtime_low */ ++ parse += 8; ++ if (version >= 0x0940) ++ parse += 4; /* skip mtime_high */ ++ ++ l = *parse++; ++ /* don't care about the file name, and skip checksum */ ++ parse += l + 4; ++ ++ *skip = parse - input; ++ return 1; ++} ++ ++STATIC inline int INIT unlzo(u8 *input, int in_len, ++ int (*fill) (void *, unsigned int), ++ int (*flush) (void *, unsigned int), ++ u8 *output, int *posp, ++ void (*error_fn) (char *x)) ++{ ++ u8 skip = 0, r = 0; ++ u32 src_len, dst_len; ++ size_t tmp; ++ u8 *in_buf, *in_buf_save, *out_buf; ++ int obytes_processed = 0; ++ ++ set_error_fn(error_fn); ++ ++ if (output) ++ out_buf = output; ++ else if (!flush) { ++ error("NULL output pointer and no flush function provided"); ++ goto exit; ++ } else { ++ out_buf = malloc(LZO_BLOCK_SIZE); ++ if (!out_buf) { ++ error("Could not allocate output buffer"); ++ goto exit; ++ } ++ } ++ ++ if (input && fill) { ++ error("Both input pointer and fill function provided, don't know what to do"); ++ goto exit_1; ++ } else if (input) ++ in_buf = input; ++ else if (!fill || !posp) { ++ error("NULL input pointer and missing position pointer or fill function"); ++ goto exit_1; ++ } else { ++ in_buf = malloc(lzo1x_worst_compress(LZO_BLOCK_SIZE)); ++ if (!in_buf) { ++ error("Could not allocate input buffer"); ++ goto exit_1; ++ } ++ } ++ in_buf_save = in_buf; ++ ++ if (posp) ++ *posp = 0; ++ ++ if (fill) ++ fill(in_buf, lzo1x_worst_compress(LZO_BLOCK_SIZE)); ++ ++ if (!parse_header(input, &skip)) { ++ error("invalid header"); ++ goto exit_2; ++ } ++ in_buf += skip; ++ ++ if (posp) ++ *posp = skip; ++ ++ for (;;) { ++ /* read uncompressed block size */ ++ dst_len = get_unaligned_be32(in_buf); ++ in_buf += 4; ++ ++ /* exit if last block */ ++ if (dst_len == 0) { ++ if (posp) ++ *posp += 4; ++ break; ++ } ++ ++ if (dst_len > LZO_BLOCK_SIZE) { ++ error("dest len longer than block size"); ++ goto exit_2; ++ } ++ ++ /* read compressed block size, and skip block checksum info */ ++ src_len = get_unaligned_be32(in_buf); ++ in_buf += 8; ++ ++ if (src_len <= 0 || src_len > dst_len) { ++ error("file corrupted"); ++ goto exit_2; ++ } ++ ++ /* decompress */ ++ tmp = dst_len; ++ r = lzo1x_decompress_safe((u8 *) in_buf, src_len, out_buf, &tmp); ++ ++ if (r != LZO_E_OK || dst_len != tmp) { ++ error("Compressed data violation"); ++ goto exit_2; ++ } ++ ++ obytes_processed += dst_len; ++ if (flush) ++ flush(out_buf, dst_len); ++ if (output) ++ out_buf += dst_len; ++ if (posp) ++ *posp += src_len + 12; ++ if (fill) { ++ in_buf = in_buf_save; ++ fill(in_buf, lzo1x_worst_compress(LZO_BLOCK_SIZE)); ++ } else ++ in_buf += src_len; ++ } ++ ++exit_2: ++ if (!input) ++ free(in_buf); ++exit_1: ++ if (!output) ++ free(out_buf); ++exit: ++ return obytes_processed; ++} ++ ++#define decompress unlzo +diff --git a/lib/lzo/lzo1x_decompress.c b/lib/lzo/lzo1x_decompress.c +index 5dc6b29..f2fd098 100644 +--- a/lib/lzo/lzo1x_decompress.c ++++ b/lib/lzo/lzo1x_decompress.c +@@ -11,11 +11,13 @@ + * Richard Purdie + */ + ++#ifndef STATIC + #include + #include +-#include +-#include ++#endif ++ + #include ++#include + #include "lzodefs.h" + + #define HAVE_IP(x, ip_end, ip) ((size_t)(ip_end - ip) < (x)) +@@ -244,9 +246,10 @@ lookbehind_overrun: + *out_len = op - out; + return LZO_E_LOOKBEHIND_OVERRUN; + } +- ++#ifndef STATIC + EXPORT_SYMBOL_GPL(lzo1x_decompress_safe); + + MODULE_LICENSE("GPL"); + MODULE_DESCRIPTION("LZO1X Decompressor"); + ++#endif +diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib +index ffdafb2..39c3483 100644 +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -230,3 +230,8 @@ quiet_cmd_lzma = LZMA $@ + cmd_lzma = (cat $(filter-out FORCE,$^) | \ + lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ + (rm -f $@ ; false) ++ ++quiet_cmd_lzo = LZO $@ ++cmd_lzo = (cat $(filter-out FORCE,$^) | \ ++ lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ ++ (rm -f $@ ; false) diff --git a/target/linux/generic-2.6/patches-2.6.31/051-lzo_compressed_kernel_for_arm.patch b/target/linux/generic-2.6/patches-2.6.31/051-lzo_compressed_kernel_for_arm.patch new file mode 100644 index 000000000..f155c0a1b --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.31/051-lzo_compressed_kernel_for_arm.patch @@ -0,0 +1,298 @@ +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig +index 1c4119c..350921d 100644 +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -18,6 +18,8 @@ config ARM + select HAVE_KRETPROBES if (HAVE_KPROBES) + select HAVE_FUNCTION_TRACER if (!XIP_KERNEL) + select HAVE_GENERIC_DMA_COHERENT ++ select HAVE_KERNEL_GZIP ++ select HAVE_KERNEL_LZO + help + The ARM series is a line of low-power-consumption RISC chip designs + licensed by ARM Ltd and targeted at embedded applications and +diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile +index ce39dc5..5b4629b 100644 +--- a/arch/arm/boot/compressed/Makefile ++++ b/arch/arm/boot/compressed/Makefile +@@ -63,8 +63,12 @@ endif + + SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ + +-targets := vmlinux vmlinux.lds piggy.gz piggy.o font.o font.c \ +- head.o misc.o $(OBJS) ++suffix_$(CONFIG_KERNEL_GZIP) = gzip ++suffix_$(CONFIG_KERNEL_LZO) = lzo ++ ++targets := vmlinux vmlinux.lds \ ++ piggy.$(suffix_y) piggy.$(suffix_y).o \ ++ font.o font.c head.o misc.o $(OBJS) + + ifeq ($(CONFIG_FUNCTION_TRACER),y) + ORIG_CFLAGS := $(KBUILD_CFLAGS) +@@ -87,22 +91,31 @@ endif + ifneq ($(PARAMS_PHYS),) + LDFLAGS_vmlinux += --defsym params_phys=$(PARAMS_PHYS) + endif +-LDFLAGS_vmlinux += -p --no-undefined -X \ +- $(shell $(CC) $(KBUILD_CFLAGS) --print-libgcc-file-name) -T ++# ? ++LDFLAGS_vmlinux += -p ++# Report unresolved symbol references ++LDFLAGS_vmlinux += --no-undefined ++# Delete all temporary local symbols ++LDFLAGS_vmlinux += -X ++# Next argument is a linker script ++LDFLAGS_vmlinux += -T ++ ++# For __aeabi_uidivmod ++lib1funcs = $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.o + + # Don't allow any static data in misc.o, which + # would otherwise mess up our GOT table + CFLAGS_misc.o := -Dstatic= + +-$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.o \ +- $(addprefix $(obj)/, $(OBJS)) FORCE ++$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \ ++ $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE + $(call if_changed,ld) + @: + +-$(obj)/piggy.gz: $(obj)/../Image FORCE +- $(call if_changed,gzip) ++$(obj)/piggy.$(suffix_y): $(obj)/../Image FORCE ++ $(call if_changed,$(suffix_y)) + +-$(obj)/piggy.o: $(obj)/piggy.gz FORCE ++$(obj)/piggy.$(suffix_y).o: $(obj)/piggy.$(suffix_y) FORCE + + CFLAGS_font.o := -Dstatic= + +diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c +index 17153b5..7e0fe4d 100644 +--- a/arch/arm/boot/compressed/misc.c ++++ b/arch/arm/boot/compressed/misc.c +@@ -18,10 +18,15 @@ + + unsigned int __machine_arch_type; + ++#define _LINUX_STRING_H_ ++ + #include /* for inline */ + #include /* for size_t */ + #include /* for NULL */ + #include ++#include ++ ++#include + + #ifdef STANDALONE_DEBUG + #define putstr printf +@@ -188,34 +193,8 @@ static inline __ptr_t memcpy(__ptr_t __dest, __const __ptr_t __src, + /* + * gzip delarations + */ +-#define OF(args) args + #define STATIC static + +-typedef unsigned char uch; +-typedef unsigned short ush; +-typedef unsigned long ulg; +- +-#define WSIZE 0x8000 /* Window size must be at least 32k, */ +- /* and a power of two */ +- +-static uch *inbuf; /* input buffer */ +-static uch window[WSIZE]; /* Sliding window buffer */ +- +-static unsigned insize; /* valid bytes in inbuf */ +-static unsigned inptr; /* index of next byte to be processed in inbuf */ +-static unsigned outcnt; /* bytes in output buffer */ +- +-/* gzip flag byte */ +-#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ +-#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ +-#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ +-#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ +-#define COMMENT 0x10 /* bit 4 set: file comment present */ +-#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ +-#define RESERVED 0xC0 /* bit 6,7: reserved */ +- +-#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf()) +- + /* Diagnostic functions */ + #ifdef DEBUG + # define Assert(cond,msg) {if(!(cond)) error(msg);} +@@ -233,24 +212,20 @@ static unsigned outcnt; /* bytes in output buffer */ + # define Tracecv(c,x) + #endif + +-static int fill_inbuf(void); +-static void flush_window(void); + static void error(char *m); + + extern char input_data[]; + extern char input_data_end[]; + +-static uch *output_data; +-static ulg output_ptr; +-static ulg bytes_out; ++static unsigned char *output_data; ++static unsigned long output_ptr; + + static void error(char *m); + + static void putstr(const char *); + +-extern int end; +-static ulg free_mem_ptr; +-static ulg free_mem_end_ptr; ++static unsigned long free_mem_ptr; ++static unsigned long free_mem_end_ptr; + + #ifdef STANDALONE_DEBUG + #define NO_INFLATE_MALLOC +@@ -258,46 +233,13 @@ static ulg free_mem_end_ptr; + + #define ARCH_HAS_DECOMP_WDOG + +-#include "../../../../lib/inflate.c" +- +-/* =========================================================================== +- * Fill the input buffer. This is called only when the buffer is empty +- * and at least one byte is really needed. +- */ +-int fill_inbuf(void) +-{ +- if (insize != 0) +- error("ran out of input data"); +- +- inbuf = input_data; +- insize = &input_data_end[0] - &input_data[0]; +- +- inptr = 1; +- return inbuf[0]; +-} ++#ifdef CONFIG_KERNEL_GZIP ++#include "../../../../lib/decompress_inflate.c" ++#endif + +-/* =========================================================================== +- * Write the output window window[0..outcnt-1] and update crc and bytes_out. +- * (Used for the decompressed data only.) +- */ +-void flush_window(void) +-{ +- ulg c = crc; +- unsigned n; +- uch *in, *out, ch; +- +- in = window; +- out = &output_data[output_ptr]; +- for (n = 0; n < outcnt; n++) { +- ch = *out++ = *in++; +- c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); +- } +- crc = c; +- bytes_out += (ulg)outcnt; +- output_ptr += (ulg)outcnt; +- outcnt = 0; +- putstr("."); +-} ++#ifdef CONFIG_KERNEL_LZO ++#include "../../../../lib/decompress_unlzo.c" ++#endif + + #ifndef arch_error + #define arch_error(x) +@@ -314,22 +256,33 @@ static void error(char *x) + while(1); /* Halt */ + } + ++asmlinkage void __div0(void) ++{ ++ error("Attempting division by 0!"); ++} ++ + #ifndef STANDALONE_DEBUG + +-ulg +-decompress_kernel(ulg output_start, ulg free_mem_ptr_p, ulg free_mem_ptr_end_p, +- int arch_id) ++unsigned long ++decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p, ++ unsigned long free_mem_ptr_end_p, ++ int arch_id) + { +- output_data = (uch *)output_start; /* Points to kernel start */ ++ unsigned char *tmp; ++ ++ output_data = (unsigned char *)output_start; + free_mem_ptr = free_mem_ptr_p; + free_mem_end_ptr = free_mem_ptr_end_p; + __machine_arch_type = arch_id; + + arch_decomp_setup(); + +- makecrc(); ++ tmp = (unsigned char *) (((unsigned long)input_data_end) - 4); ++ output_ptr = get_unaligned_le32(tmp); ++ + putstr("Uncompressing Linux..."); +- gunzip(); ++ decompress(input_data, input_data_end - input_data, ++ NULL, NULL, output_data, NULL, error); + putstr(" done, booting the kernel.\n"); + return output_ptr; + } +@@ -341,11 +294,10 @@ int main() + { + output_data = output_buffer; + +- makecrc(); + putstr("Uncompressing Linux..."); +- gunzip(); ++ decompress(input_data, input_data_end - input_data, ++ NULL, NULL, output_data, NULL, error); + putstr("done.\n"); + return 0; + } + #endif +- +diff --git a/arch/arm/boot/compressed/piggy.S b/arch/arm/boot/compressed/piggy.S +deleted file mode 100644 +index 54c9518..0000000 +--- a/arch/arm/boot/compressed/piggy.S ++++ /dev/null +@@ -1,6 +0,0 @@ +- .section .piggydata,#alloc +- .globl input_data +-input_data: +- .incbin "arch/arm/boot/compressed/piggy.gz" +- .globl input_data_end +-input_data_end: +diff --git a/arch/arm/boot/compressed/piggy.gzip.S b/arch/arm/boot/compressed/piggy.gzip.S +new file mode 100644 +index 0000000..a68adf9 +--- /dev/null ++++ b/arch/arm/boot/compressed/piggy.gzip.S +@@ -0,0 +1,6 @@ ++ .section .piggydata,#alloc ++ .globl input_data ++input_data: ++ .incbin "arch/arm/boot/compressed/piggy.gzip" ++ .globl input_data_end ++input_data_end: +diff --git a/arch/arm/boot/compressed/piggy.lzo.S b/arch/arm/boot/compressed/piggy.lzo.S +new file mode 100644 +index 0000000..a425ad9 +--- /dev/null ++++ b/arch/arm/boot/compressed/piggy.lzo.S +@@ -0,0 +1,6 @@ ++ .section .piggydata,#alloc ++ .globl input_data ++input_data: ++ .incbin "arch/arm/boot/compressed/piggy.lzo" ++ .globl input_data_end ++input_data_end: diff --git a/target/linux/generic-2.6/patches-2.6.31/052-lzo_compressed_kernel_for_x86.patch b/target/linux/generic-2.6/patches-2.6.31/052-lzo_compressed_kernel_for_x86.patch new file mode 100644 index 000000000..bfefe8bfd --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.31/052-lzo_compressed_kernel_for_x86.patch @@ -0,0 +1,54 @@ +diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig +index 72ace95..89f7771 100644 +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig +@@ -49,6 +49,7 @@ config X86 + select HAVE_KERNEL_GZIP + select HAVE_KERNEL_BZIP2 + select HAVE_KERNEL_LZMA ++ select HAVE_KERNEL_LZO + select HAVE_ARCH_KMEMCHECK + + config OUTPUT_FORMAT +diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile +index f8ed065..0e835d0 100644 +--- a/arch/x86/boot/compressed/Makefile ++++ b/arch/x86/boot/compressed/Makefile +@@ -4,7 +4,7 @@ + # create a compressed vmlinux image from the original vmlinux + # + +-targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma head_$(BITS).o misc.o piggy.o ++targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.lzo head_$(BITS).o misc.o piggy.o + + KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 + KBUILD_CFLAGS += -fno-strict-aliasing -fPIC +@@ -48,10 +48,13 @@ $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE + $(call if_changed,bzip2) + $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE + $(call if_changed,lzma) ++$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE ++ $(call if_changed,lzo) + + suffix-$(CONFIG_KERNEL_GZIP) := gz + suffix-$(CONFIG_KERNEL_BZIP2) := bz2 + suffix-$(CONFIG_KERNEL_LZMA) := lzma ++suffix-$(CONFIG_KERNEL_LZO) := lzo + + quiet_cmd_mkpiggy = MKPIGGY $@ + cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false ) +diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c +index 842b2a3..3b22fe8 100644 +--- a/arch/x86/boot/compressed/misc.c ++++ b/arch/x86/boot/compressed/misc.c +@@ -162,6 +162,10 @@ static int lines, cols; + #include "../../../../lib/decompress_unlzma.c" + #endif + ++#ifdef CONFIG_KERNEL_LZO ++#include "../../../../lib/decompress_unlzo.c" ++#endif ++ + static void scroll(void) + { + int i; diff --git a/target/linux/generic-2.6/patches-2.6.31/053-lzo_compression_for_initramfs.patch b/target/linux/generic-2.6/patches-2.6.31/053-lzo_compression_for_initramfs.patch new file mode 100644 index 000000000..f0d8ff39f --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.31/053-lzo_compression_for_initramfs.patch @@ -0,0 +1,114 @@ +diff --git a/lib/Kconfig b/lib/Kconfig +index bb1326d..8639349 100644 +--- a/lib/Kconfig ++++ b/lib/Kconfig +@@ -117,6 +117,10 @@ config DECOMPRESS_BZIP2 + config DECOMPRESS_LZMA + tristate + ++config DECOMPRESS_LZO ++ select LZO_DECOMPRESS ++ tristate ++ + # + # Generic allocator support is selected if needed + # +diff --git a/lib/Makefile b/lib/Makefile +index 2e78277..cfa4041 100644 +--- a/lib/Makefile ++++ b/lib/Makefile +@@ -69,6 +69,7 @@ obj-$(CONFIG_LZO_DECOMPRESS) += lzo/ + lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o + lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o + lib-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o ++lib-$(CONFIG_DECOMPRESS_LZO) += decompress_unlzo.o + + obj-$(CONFIG_TEXTSEARCH) += textsearch.o + obj-$(CONFIG_TEXTSEARCH_KMP) += ts_kmp.o +diff --git a/lib/decompress.c b/lib/decompress.c +index d2842f5..a760681 100644 +--- a/lib/decompress.c ++++ b/lib/decompress.c +@@ -9,6 +9,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -22,6 +23,9 @@ + #ifndef CONFIG_DECOMPRESS_LZMA + # define unlzma NULL + #endif ++#ifndef CONFIG_DECOMPRESS_LZO ++# define unlzo NULL ++#endif + + static const struct compress_format { + unsigned char magic[2]; +@@ -32,6 +36,7 @@ static const struct compress_format { + { {037, 0236}, "gzip", gunzip }, + { {0x42, 0x5a}, "bzip2", bunzip2 }, + { {0x5d, 0x00}, "lzma", unlzma }, ++ { {0x89, 0x4c}, "lzo", unlzo }, + { {0, 0}, NULL, NULL } + }; + +diff --git a/usr/Kconfig b/usr/Kconfig +index 1c3039f..e2721f5 100644 +--- a/usr/Kconfig ++++ b/usr/Kconfig +@@ -72,6 +72,15 @@ config RD_LZMA + Support loading of a LZMA encoded initial ramdisk or cpio buffer + If unsure, say N. + ++config RD_LZO ++ bool "Support initial ramdisks compressed using LZO" if EMBEDDED ++ default !EMBEDDED ++ depends on BLK_DEV_INITRD ++ select DECOMPRESS_LZO ++ help ++ Support loading of a LZO encoded initial ramdisk or cpio buffer ++ If unsure, say N. ++ + choice + prompt "Built-in initramfs compression mode" if INITRAMFS_SOURCE!="" + help +@@ -108,16 +117,15 @@ config INITRAMFS_COMPRESSION_GZIP + bool "Gzip" + depends on RD_GZIP + help +- The old and tried gzip compression. Its compression ratio is +- the poorest among the 3 choices; however its speed (both +- compression and decompression) is the fastest. ++ The old and tried gzip compression. It provides a good balance ++ between compression ratio and decompression speed. + + config INITRAMFS_COMPRESSION_BZIP2 + bool "Bzip2" + depends on RD_BZIP2 + help + Its compression ratio and speed is intermediate. +- Decompression speed is slowest among the three. The initramfs ++ Decompression speed is slowest among the four. The initramfs + size is about 10% smaller with bzip2, in comparison to gzip. + Bzip2 uses a large amount of memory. For modern kernels you + will need at least 8MB RAM or more for booting. +@@ -128,7 +136,15 @@ config INITRAMFS_COMPRESSION_LZMA + help + The most recent compression algorithm. + Its ratio is best, decompression speed is between the other +- two. Compression is slowest. The initramfs size is about 33% ++ three. Compression is slowest. The initramfs size is about 33% + smaller with LZMA in comparison to gzip. + ++config INITRAMFS_COMPRESSION_LZO ++ bool "LZO" ++ depends on RD_LZO ++ help ++ Its compression ratio is the poorest among the four. The kernel ++ size is about about 10% bigger than gzip; however its speed ++ (both compression and decompression) is the fastest. ++ + endchoice diff --git a/target/linux/generic-2.6/patches-2.6.31/055-lzma_arm_kernel.patch b/target/linux/generic-2.6/patches-2.6.31/055-lzma_arm_kernel.patch new file mode 100644 index 000000000..1f3962892 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.31/055-lzma_arm_kernel.patch @@ -0,0 +1,69 @@ +From d0f226a0f104c7d1da1d215b8013359273e39e18 Mon Sep 17 00:00:00 2001 +From: Albin Tonnerre +Date: Fri, 16 Oct 2009 16:17:22 +0200 +Subject: [PATCH] Add LZMA decompression on ARM + + +Signed-off-by: Albin Tonnerre +--- + arch/arm/Kconfig | 1 + + arch/arm/boot/compressed/Makefile | 1 + + arch/arm/boot/compressed/misc.c | 4 ++++ + arch/arm/boot/compressed/piggy.lzma.S | 6 ++++++ + 4 files changed, 12 insertions(+), 0 deletions(-) + create mode 100644 arch/arm/boot/compressed/piggy.lzma.S + +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig +index ea71c0c..f5bf779 100644 +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -20,6 +20,7 @@ config ARM + select HAVE_GENERIC_DMA_COHERENT + select HAVE_KERNEL_GZIP + select HAVE_KERNEL_LZO ++ select HAVE_KERNEL_LZMA + help + The ARM series is a line of low-power-consumption RISC chip designs + licensed by ARM Ltd and targeted at embedded applications and +diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile +index 5b4629b..dcfcb74 100644 +--- a/arch/arm/boot/compressed/Makefile ++++ b/arch/arm/boot/compressed/Makefile +@@ -65,6 +65,7 @@ SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ + + suffix_$(CONFIG_KERNEL_GZIP) = gzip + suffix_$(CONFIG_KERNEL_LZO) = lzo ++suffix_$(CONFIG_KERNEL_LZMA) = lzma + + targets := vmlinux vmlinux.lds \ + piggy.$(suffix_y) piggy.$(suffix_y).o \ +diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c +index 7e0fe4d..4e35a10 100644 +--- a/arch/arm/boot/compressed/misc.c ++++ b/arch/arm/boot/compressed/misc.c +@@ -237,6 +237,10 @@ static unsigned long free_mem_end_ptr; + #include "../../../../lib/decompress_inflate.c" + #endif + ++#ifdef CONFIG_KERNEL_LZMA ++#include "../../../../lib/decompress_unlzma.c" ++#endif ++ + #ifdef CONFIG_KERNEL_LZO + #include "../../../../lib/decompress_unlzo.c" + #endif +diff --git a/arch/arm/boot/compressed/piggy.lzma.S b/arch/arm/boot/compressed/piggy.lzma.S +new file mode 100644 +index 0000000..d7e69cf +--- /dev/null ++++ b/arch/arm/boot/compressed/piggy.lzma.S +@@ -0,0 +1,6 @@ ++ .section .piggydata,#alloc ++ .globl input_data ++input_data: ++ .incbin "arch/arm/boot/compressed/piggy.lzma" ++ .globl input_data_end ++input_data_end: +-- +1.6.5 + diff --git a/target/linux/generic-2.6/patches-2.6.31/960-arm_lzma_loader.patch b/target/linux/generic-2.6/patches-2.6.31/960-arm_lzma_loader.patch deleted file mode 100644 index 5f4f28757..000000000 --- a/target/linux/generic-2.6/patches-2.6.31/960-arm_lzma_loader.patch +++ /dev/null @@ -1,710 +0,0 @@ ---- a/arch/arm/boot/compressed/Makefile -+++ b/arch/arm/boot/compressed/Makefile -@@ -63,7 +63,7 @@ endif - - SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ - --targets := vmlinux vmlinux.lds piggy.gz piggy.o font.o font.c \ -+targets := vmlinux vmlinux.lds piggy.lzma piggy.o font.o font.c \ - head.o misc.o $(OBJS) - - ifeq ($(CONFIG_FUNCTION_TRACER),y) -@@ -99,10 +99,10 @@ $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj - $(call if_changed,ld) - @: - --$(obj)/piggy.gz: $(obj)/../Image FORCE -- $(call if_changed,gzip) -+$(obj)/piggy.lzma: $(obj)/../Image FORCE -+ $(call if_changed,lzma) - --$(obj)/piggy.o: $(obj)/piggy.gz FORCE -+$(obj)/piggy.o: $(obj)/piggy.lzma FORCE - - CFLAGS_font.o := -Dstatic= - ---- a/arch/arm/boot/compressed/misc.c -+++ b/arch/arm/boot/compressed/misc.c -@@ -185,36 +185,10 @@ static inline __ptr_t memcpy(__ptr_t __d - return __dest; - } - --/* -- * gzip delarations -- */ --#define OF(args) args --#define STATIC static -- --typedef unsigned char uch; --typedef unsigned short ush; --typedef unsigned long ulg; -- --#define WSIZE 0x8000 /* Window size must be at least 32k, */ -+#define WSIZE 0x20000 /* Window size must be at least 128k, */ - /* and a power of two */ - --static uch *inbuf; /* input buffer */ --static uch window[WSIZE]; /* Sliding window buffer */ -- --static unsigned insize; /* valid bytes in inbuf */ --static unsigned inptr; /* index of next byte to be processed in inbuf */ --static unsigned outcnt; /* bytes in output buffer */ -- --/* gzip flag byte */ --#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ --#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ --#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ --#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ --#define COMMENT 0x10 /* bit 4 set: file comment present */ --#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ --#define RESERVED 0xC0 /* bit 6,7: reserved */ -- --#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf()) -+static u8 window[WSIZE]; /* Sliding window buffer */ - - /* Diagnostic functions */ - #ifdef DEBUG -@@ -233,24 +207,21 @@ static unsigned outcnt; /* bytes in out - # define Tracecv(c,x) - #endif - --static int fill_inbuf(void); --static void flush_window(void); - static void error(char *m); - - extern char input_data[]; - extern char input_data_end[]; - --static uch *output_data; --static ulg output_ptr; --static ulg bytes_out; -+static unsigned long output_ptr; -+static unsigned long bytes_out; - - static void error(char *m); - - static void putstr(const char *); - - extern int end; --static ulg free_mem_ptr; --static ulg free_mem_end_ptr; -+static unsigned long free_mem_ptr; -+static unsigned long free_mem_end_ptr; - - #ifdef STANDALONE_DEBUG - #define NO_INFLATE_MALLOC -@@ -258,50 +229,10 @@ static ulg free_mem_end_ptr; - - #define ARCH_HAS_DECOMP_WDOG - --#include "../../../../lib/inflate.c" -- --/* =========================================================================== -- * Fill the input buffer. This is called only when the buffer is empty -- * and at least one byte is really needed. -- */ --int fill_inbuf(void) --{ -- if (insize != 0) -- error("ran out of input data"); -- -- inbuf = input_data; -- insize = &input_data_end[0] - &input_data[0]; -- -- inptr = 1; -- return inbuf[0]; --} -- --/* =========================================================================== -- * Write the output window window[0..outcnt-1] and update crc and bytes_out. -- * (Used for the decompressed data only.) -- */ --void flush_window(void) --{ -- ulg c = crc; -- unsigned n; -- uch *in, *out, ch; -- -- in = window; -- out = &output_data[output_ptr]; -- for (n = 0; n < outcnt; n++) { -- ch = *out++ = *in++; -- c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); -- } -- crc = c; -- bytes_out += (ulg)outcnt; -- output_ptr += (ulg)outcnt; -- outcnt = 0; -- putstr("."); --} -- - #ifndef arch_error - #define arch_error(x) - #endif -+#include "unlzma.c" - - static void error(char *x) - { -@@ -316,20 +247,16 @@ static void error(char *x) - - #ifndef STANDALONE_DEBUG - --ulg --decompress_kernel(ulg output_start, ulg free_mem_ptr_p, ulg free_mem_ptr_end_p, -+unsigned long -+decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p, unsigned long free_mem_ptr_end_p, - int arch_id) - { -- output_data = (uch *)output_start; /* Points to kernel start */ -- free_mem_ptr = free_mem_ptr_p; -- free_mem_end_ptr = free_mem_ptr_end_p; - __machine_arch_type = arch_id; - - arch_decomp_setup(); - -- makecrc(); - putstr("Uncompressing Linux..."); -- gunzip(); -+ output_ptr += unlzma((u8 *) output_start, input_data, window); - putstr(" done, booting the kernel.\n"); - return output_ptr; - } -@@ -339,11 +266,8 @@ char output_buffer[1500*1024]; - - int main() - { -- output_data = output_buffer; -- -- makecrc(); - putstr("Uncompressing Linux..."); -- gunzip(); -+ unlzma((u8 *) output_buffer, input_data, window); - putstr("done.\n"); - return 0; - } ---- a/arch/arm/boot/compressed/piggy.S -+++ b/arch/arm/boot/compressed/piggy.S -@@ -1,6 +1,6 @@ - .section .piggydata,#alloc - .globl input_data - input_data: -- .incbin "arch/arm/boot/compressed/piggy.gz" -+ .incbin "arch/arm/boot/compressed/piggy.lzma" - .globl input_data_end - input_data_end: ---- /dev/null -+++ b/arch/arm/boot/compressed/unlzma.c -@@ -0,0 +1,429 @@ -+/* -+ * Copyright (c) 2009 Felix Fietkau -+ * -+ * 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, -+ * or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ * -+ * uncompress.c -+ */ -+ -+#include -+#include -+#include "unlzma.h" -+ -+struct unlzma_ctx { -+ const u8 *next_in; -+ u8 *next_out; -+ u8 *outbuf; -+ -+ /* reader state */ -+ u32 code; -+ u32 range; -+ u32 bound; -+ -+ /* writer state */ -+ u8 previous_byte; -+ ssize_t pos; -+ -+ /* cstate */ -+ int state; -+ u32 rep0, rep1, rep2, rep3; -+ -+ void *workspace; -+} ctx; -+ -+static int inbs = 0; -+static inline u8 -+rc_read(void) -+{ -+#if 0 -+ if (unlikely(++inbs > 16 * 1024)) { -+ putstr("."); -+ inbs = 0; -+ } -+#endif -+ return *(ctx.next_in++); -+} -+ -+ -+static inline void -+rc_get_code(void) -+{ -+ ctx.code = (ctx.code << 8) | rc_read(); -+} -+ -+static inline void -+rc_normalize(void) -+{ -+ if (ctx.range < (1 << RC_TOP_BITS)) { -+ ctx.range <<= 8; -+ rc_get_code(); -+ } -+} -+ -+static inline int -+rc_is_bit_0(u16 *p) -+{ -+ rc_normalize(); -+ ctx.bound = *p * (ctx.range >> RC_MODEL_TOTAL_BITS); -+ return ctx.code < ctx.bound; -+} -+ -+static inline void -+rc_update_bit_0(u16 *p) -+{ -+ ctx.range = ctx.bound; -+ *p += ((1 << RC_MODEL_TOTAL_BITS) - *p) >> RC_MOVE_BITS; -+} -+ -+static inline void -+rc_update_bit_1(u16 *p) -+{ -+ ctx.range -= ctx.bound; -+ ctx.code -= ctx.bound; -+ *p -= *p >> RC_MOVE_BITS; -+} -+ -+static inline bool -+rc_get_bit(u16 *p, int *symbol) -+{ -+ if (rc_is_bit_0(p)) { -+ rc_update_bit_0(p); -+ *symbol *= 2; -+ return 0; -+ } else { -+ rc_update_bit_1(p); -+ *symbol = *symbol * 2 + 1; -+ return 1; -+ } -+} -+ -+static inline int -+rc_direct_bit(void) -+{ -+ rc_normalize(); -+ ctx.range >>= 1; -+ if (ctx.code >= ctx.range) { -+ ctx.code -= ctx.range; -+ return 1; -+ } -+ return 0; -+} -+ -+static inline void -+rc_bit_tree_decode(u16 *p, int num_levels, int *symbol) -+{ -+ int i = num_levels; -+ -+ *symbol = 1; -+ while (i--) -+ rc_get_bit(p + *symbol, symbol); -+ *symbol -= 1 << num_levels; -+} -+ -+static inline u8 -+peek_old_byte(u32 offs) -+{ -+ u32 pos = ctx.pos - offs; -+ return ctx.outbuf[pos]; -+} -+ -+static inline void -+write_byte(u8 byte) -+{ -+ ctx.previous_byte = byte; -+ *(ctx.next_out++) = byte; -+ ctx.pos++; -+} -+ -+ -+static inline void -+copy_byte(u32 offs) -+{ -+ write_byte(peek_old_byte(offs)); -+} -+ -+static inline void -+copy_bytes(u32 rep0, int len) -+{ -+ do { -+ copy_byte(rep0); -+ len--; -+ } while (len != 0); -+} -+ -+static inline void -+process_bit0(u16 *p, int pos_state, u16 *prob, -+ int lc, u32 literal_pos_mask) -+{ -+ int mi = 1; -+ rc_update_bit_0(prob); -+ prob = (p + LZMA_LITERAL + -+ (LZMA_LIT_SIZE -+ * (((ctx.pos & literal_pos_mask) << lc) -+ + (ctx.previous_byte >> (8 - lc)))) -+ ); -+ -+ if (ctx.state >= LZMA_NUM_LIT_STATES) { -+ int match_byte = peek_old_byte(ctx.rep0); -+ do { -+ u16 bit; -+ u16 *prob_lit; -+ -+ match_byte <<= 1; -+ bit = match_byte & 0x100; -+ prob_lit = prob + 0x100 + bit + mi; -+ if (rc_get_bit(prob_lit, &mi) != !!bit) -+ break; -+ } while (mi < 0x100); -+ } -+ while (mi < 0x100) { -+ u16 *prob_lit = prob + mi; -+ rc_get_bit(prob_lit, &mi); -+ } -+ write_byte(mi); -+ if (ctx.state < 4) -+ ctx.state = 0; -+ else if (ctx.state < 10) -+ ctx.state -= 3; -+ else -+ ctx.state -= 6; -+} -+ -+static inline void -+process_bit1(u16 *p, int pos_state, u16 *prob) -+{ -+ int offset; -+ u16 *prob_len; -+ int num_bits; -+ int len; -+ -+ rc_update_bit_1(prob); -+ prob = p + LZMA_IS_REP + ctx.state; -+ if (rc_is_bit_0(prob)) { -+ rc_update_bit_0(prob); -+ ctx.rep3 = ctx.rep2; -+ ctx.rep2 = ctx.rep1; -+ ctx.rep1 = ctx.rep0; -+ ctx.state = ctx.state < LZMA_NUM_LIT_STATES ? 0 : 3; -+ prob = p + LZMA_LEN_CODER; -+ } else { -+ rc_update_bit_1(prob); -+ prob = p + LZMA_IS_REP_G0 + ctx.state; -+ if (rc_is_bit_0(prob)) { -+ rc_update_bit_0(prob); -+ prob = (p + LZMA_IS_REP_0_LONG -+ + (ctx.state << -+ LZMA_NUM_POS_BITS_MAX) + -+ pos_state); -+ if (rc_is_bit_0(prob)) { -+ rc_update_bit_0(prob); -+ -+ ctx.state = ctx.state < LZMA_NUM_LIT_STATES ? -+ 9 : 11; -+ copy_byte(ctx.rep0); -+ return; -+ } else { -+ rc_update_bit_1(prob); -+ } -+ } else { -+ u32 distance; -+ -+ rc_update_bit_1(prob); -+ prob = p + LZMA_IS_REP_G1 + ctx.state; -+ if (rc_is_bit_0(prob)) { -+ rc_update_bit_0(prob); -+ distance = ctx.rep1; -+ } else { -+ rc_update_bit_1(prob); -+ prob = p + LZMA_IS_REP_G2 + ctx.state; -+ if (rc_is_bit_0(prob)) { -+ rc_update_bit_0(prob); -+ distance = ctx.rep2; -+ } else { -+ rc_update_bit_1(prob); -+ distance = ctx.rep3; -+ ctx.rep3 = ctx.rep2; -+ } -+ ctx.rep2 = ctx.rep1; -+ } -+ ctx.rep1 = ctx.rep0; -+ ctx.rep0 = distance; -+ } -+ ctx.state = ctx.state < LZMA_NUM_LIT_STATES ? 8 : 11; -+ prob = p + LZMA_REP_LEN_CODER; -+ } -+ -+ prob_len = prob + LZMA_LEN_CHOICE; -+ if (rc_is_bit_0(prob_len)) { -+ rc_update_bit_0(prob_len); -+ prob_len = (prob + LZMA_LEN_LOW -+ + (pos_state << -+ LZMA_LEN_NUM_LOW_BITS)); -+ offset = 0; -+ num_bits = LZMA_LEN_NUM_LOW_BITS; -+ } else { -+ rc_update_bit_1(prob_len); -+ prob_len = prob + LZMA_LEN_CHOICE_2; -+ if (rc_is_bit_0(prob_len)) { -+ rc_update_bit_0(prob_len); -+ prob_len = (prob + LZMA_LEN_MID -+ + (pos_state << -+ LZMA_LEN_NUM_MID_BITS)); -+ offset = 1 << LZMA_LEN_NUM_LOW_BITS; -+ num_bits = LZMA_LEN_NUM_MID_BITS; -+ } else { -+ rc_update_bit_1(prob_len); -+ prob_len = prob + LZMA_LEN_HIGH; -+ offset = ((1 << LZMA_LEN_NUM_LOW_BITS) -+ + (1 << LZMA_LEN_NUM_MID_BITS)); -+ num_bits = LZMA_LEN_NUM_HIGH_BITS; -+ } -+ } -+ -+ rc_bit_tree_decode(prob_len, num_bits, &len); -+ len += offset; -+ -+ if (ctx.state < 4) { -+ int pos_slot; -+ -+ ctx.state += LZMA_NUM_LIT_STATES; -+ prob = -+ p + LZMA_POS_SLOT + -+ ((len < -+ LZMA_NUM_LEN_TO_POS_STATES ? len : -+ LZMA_NUM_LEN_TO_POS_STATES - 1) -+ << LZMA_NUM_POS_SLOT_BITS); -+ rc_bit_tree_decode(prob, -+ LZMA_NUM_POS_SLOT_BITS, -+ &pos_slot); -+ if (pos_slot >= LZMA_START_POS_MODEL_INDEX) { -+ int i, mi; -+ num_bits = (pos_slot >> 1) - 1; -+ ctx.rep0 = 2 | (pos_slot & 1); -+ if (pos_slot < LZMA_END_POS_MODEL_INDEX) { -+ ctx.rep0 <<= num_bits; -+ prob = p + LZMA_SPEC_POS + -+ ctx.rep0 - pos_slot - 1; -+ } else { -+ num_bits -= LZMA_NUM_ALIGN_BITS; -+ while (num_bits--) -+ ctx.rep0 = (ctx.rep0 << 1) | -+ rc_direct_bit(); -+ prob = p + LZMA_ALIGN; -+ ctx.rep0 <<= LZMA_NUM_ALIGN_BITS; -+ num_bits = LZMA_NUM_ALIGN_BITS; -+ } -+ i = 1; -+ mi = 1; -+ while (num_bits--) { -+ if (rc_get_bit(prob + mi, &mi)) -+ ctx.rep0 |= i; -+ i <<= 1; -+ } -+ } else -+ ctx.rep0 = pos_slot; -+ if (++(ctx.rep0) == 0) -+ return; -+ } -+ -+ len += LZMA_MATCH_MIN_LEN; -+ -+ copy_bytes(ctx.rep0, len); -+} -+ -+ -+static int -+do_unlzma(void) -+{ -+ u8 hdr_buf[sizeof(struct lzma_header)]; -+ struct lzma_header *header = (struct lzma_header *)hdr_buf; -+ u32 pos_state_mask; -+ u32 literal_pos_mask; -+ int lc, pb, lp; -+ int num_probs; -+ int i, mi; -+ u16 *p; -+ -+ for (i = 0; i < sizeof(struct lzma_header); i++) { -+ hdr_buf[i] = rc_read(); -+ } -+ -+ ctx.pos = 0; -+ ctx.state = 0; -+ ctx.rep0 = ctx.rep1 = ctx.rep2 = ctx.rep3 = 1; -+ -+ ctx.previous_byte = 0; -+ ctx.code = 0; -+ ctx.range = 0xFFFFFFFF; -+ -+ if (header->pos >= (9 * 5 * 5)) -+ return -1; -+ -+ mi = 0; -+ lc = header->pos; -+ while (lc >= 9) { -+ mi++; -+ lc -= 9; -+ } -+ pb = 0; -+ lp = mi; -+ while (lp >= 5) { -+ pb++; -+ lp -= 5; -+ } -+ pos_state_mask = (1 << pb) - 1; -+ literal_pos_mask = (1 << lp) - 1; -+ -+ p = (u16 *) ctx.workspace; -+ if (!p) -+ return -1; -+ -+ num_probs = LZMA_LITERAL + (LZMA_LIT_SIZE << (lc + lp)); -+ for (i = 0; i < num_probs; i++) -+ p[i] = (1 << RC_MODEL_TOTAL_BITS) >> 1; -+ -+ for (i = 0; i < 5; i++) -+ rc_get_code(); -+ -+ while (1) { -+ int pos_state = ctx.pos & pos_state_mask; -+ u16 *prob = p + LZMA_IS_MATCH + -+ (ctx.state << LZMA_NUM_POS_BITS_MAX) + pos_state; -+ if (rc_is_bit_0(prob)) -+ process_bit0(p, pos_state, prob, -+ lc, literal_pos_mask); -+ else { -+ process_bit1(p, pos_state, prob); -+ if (ctx.rep0 == 0) -+ break; -+ } -+ } -+ -+ return ctx.pos; -+} -+ -+ -+static int unlzma(unsigned char *dest, const unsigned char *src, unsigned char *workspace) -+{ -+ memset(&ctx, 0, sizeof(ctx)); -+ ctx.outbuf = dest; -+ ctx.next_in = src; -+ ctx.next_out = dest; -+ ctx.workspace = workspace; -+ -+ return do_unlzma(); -+} -+ -+ ---- /dev/null -+++ b/arch/arm/boot/compressed/unlzma.h -@@ -0,0 +1,81 @@ -+/* LZMA uncompresion module for pcomp -+ * Copyright (C) 2009 Felix Fietkau -+ * -+ * Based on: -+ * Initial Linux kernel adaptation -+ * Copyright (C) 2006 Alain < alain@knaff.lu > -+ * -+ * Based on small lzma deflate implementation/Small range coder -+ * implementation for lzma. -+ * Copyright (C) 2006 Aurelien Jacobs < aurel@gnuage.org > -+ * -+ * Based on LzmaDecode.c from the LZMA SDK 4.22 (http://www.7-zip.org/) -+ * Copyright (C) 1999-2005 Igor Pavlov -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ */ -+#ifndef __UNLZMA_H -+#define __UNLZMA_H -+ -+struct lzma_header { -+ __u8 pos; -+ __le32 dict_size; -+ __le64 uncompr_size; -+} __attribute__ ((packed)); -+ -+ -+#define RC_TOP_BITS 24 -+#define RC_MOVE_BITS 5 -+#define RC_MODEL_TOTAL_BITS 11 -+ -+#define LZMA_BASE_SIZE 1846 -+#define LZMA_LIT_SIZE 768 -+ -+#define LZMA_NUM_POS_BITS_MAX 4 -+ -+#define LZMA_LEN_NUM_LOW_BITS 3 -+#define LZMA_LEN_NUM_MID_BITS 3 -+#define LZMA_LEN_NUM_HIGH_BITS 8 -+ -+#define LZMA_LEN_CHOICE 0 -+#define LZMA_LEN_CHOICE_2 (LZMA_LEN_CHOICE + 1) -+#define LZMA_LEN_LOW (LZMA_LEN_CHOICE_2 + 1) -+#define LZMA_LEN_MID (LZMA_LEN_LOW \ -+ + (1 << (LZMA_NUM_POS_BITS_MAX + LZMA_LEN_NUM_LOW_BITS))) -+#define LZMA_LEN_HIGH (LZMA_LEN_MID \ -+ +(1 << (LZMA_NUM_POS_BITS_MAX + LZMA_LEN_NUM_MID_BITS))) -+#define LZMA_NUM_LEN_PROBS (LZMA_LEN_HIGH + (1 << LZMA_LEN_NUM_HIGH_BITS)) -+ -+#define LZMA_NUM_STATES 12 -+#define LZMA_NUM_LIT_STATES 7 -+ -+#define LZMA_START_POS_MODEL_INDEX 4 -+#define LZMA_END_POS_MODEL_INDEX 14 -+#define LZMA_NUM_FULL_DISTANCES (1 << (LZMA_END_POS_MODEL_INDEX >> 1)) -+ -+#define LZMA_NUM_POS_SLOT_BITS 6 -+#define LZMA_NUM_LEN_TO_POS_STATES 4 -+ -+#define LZMA_NUM_ALIGN_BITS 4 -+ -+#define LZMA_MATCH_MIN_LEN 2 -+ -+#define LZMA_IS_MATCH 0 -+#define LZMA_IS_REP (LZMA_IS_MATCH + (LZMA_NUM_STATES << LZMA_NUM_POS_BITS_MAX)) -+#define LZMA_IS_REP_G0 (LZMA_IS_REP + LZMA_NUM_STATES) -+#define LZMA_IS_REP_G1 (LZMA_IS_REP_G0 + LZMA_NUM_STATES) -+#define LZMA_IS_REP_G2 (LZMA_IS_REP_G1 + LZMA_NUM_STATES) -+#define LZMA_IS_REP_0_LONG (LZMA_IS_REP_G2 + LZMA_NUM_STATES) -+#define LZMA_POS_SLOT (LZMA_IS_REP_0_LONG \ -+ + (LZMA_NUM_STATES << LZMA_NUM_POS_BITS_MAX)) -+#define LZMA_SPEC_POS (LZMA_POS_SLOT \ -+ +(LZMA_NUM_LEN_TO_POS_STATES << LZMA_NUM_POS_SLOT_BITS)) -+#define LZMA_ALIGN (LZMA_SPEC_POS \ -+ + LZMA_NUM_FULL_DISTANCES - LZMA_END_POS_MODEL_INDEX) -+#define LZMA_LEN_CODER (LZMA_ALIGN + (1 << LZMA_NUM_ALIGN_BITS)) -+#define LZMA_REP_LEN_CODER (LZMA_LEN_CODER + LZMA_NUM_LEN_PROBS) -+#define LZMA_LITERAL (LZMA_REP_LEN_CODER + LZMA_NUM_LEN_PROBS) -+ -+#endif diff --git a/target/linux/generic-2.6/patches-2.6.32/050-lzo_compressed_kernels.patch b/target/linux/generic-2.6/patches-2.6.32/050-lzo_compressed_kernels.patch new file mode 100644 index 000000000..733d1756f --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/050-lzo_compressed_kernels.patch @@ -0,0 +1,309 @@ +--- /dev/null ++++ b/include/linux/decompress/unlzo.h +@@ -0,0 +1,10 @@ ++#ifndef DECOMPRESS_UNLZO_H ++#define DECOMPRESS_UNLZO_H ++ ++int unlzo(unsigned char *inbuf, int len, ++ int(*fill)(void*, unsigned int), ++ int(*flush)(void*, unsigned int), ++ unsigned char *output, ++ int *pos, ++ void(*error)(char *x)); ++#endif +--- a/init/Kconfig ++++ b/init/Kconfig +@@ -115,10 +115,13 @@ config HAVE_KERNEL_BZIP2 + config HAVE_KERNEL_LZMA + bool + ++config HAVE_KERNEL_LZO ++ bool ++ + choice + prompt "Kernel compression mode" + default KERNEL_GZIP +- depends on HAVE_KERNEL_GZIP || HAVE_KERNEL_BZIP2 || HAVE_KERNEL_LZMA ++ depends on HAVE_KERNEL_GZIP || HAVE_KERNEL_BZIP2 || HAVE_KERNEL_LZMA || HAVE_KERNEL_LZO + help + The linux kernel is a kind of self-extracting executable. + Several compression algorithms are available, which differ +@@ -141,9 +144,8 @@ config KERNEL_GZIP + bool "Gzip" + depends on HAVE_KERNEL_GZIP + help +- The old and tried gzip compression. Its compression ratio is +- the poorest among the 3 choices; however its speed (both +- compression and decompression) is the fastest. ++ The old and tried gzip compression. It provides a good balance ++ between compression ratio and decompression speed. + + config KERNEL_BZIP2 + bool "Bzip2" +@@ -164,6 +166,14 @@ config KERNEL_LZMA + two. Compression is slowest. The kernel size is about 33% + smaller with LZMA in comparison to gzip. + ++config KERNEL_LZO ++ bool "LZO" ++ depends on HAVE_KERNEL_LZO ++ help ++ Its compression ratio is the poorest among the 4. The kernel ++ size is about about 10% bigger than gzip; however its speed ++ (both compression and decompression) is the fastest. ++ + endchoice + + config SWAP +--- /dev/null ++++ b/lib/decompress_unlzo.c +@@ -0,0 +1,208 @@ ++/* ++ * LZO decompressor for the Linux kernel. Code borrowed from the lzo ++ * implementation by Markus Franz Xaver Johannes Oberhumer. ++ * ++ * Linux kernel adaptation: ++ * Copyright (C) 2009 ++ * Albin Tonnerre, Free Electrons ++ * ++ * Original code: ++ * Copyright (C) 1996-2005 Markus Franz Xaver Johannes Oberhumer ++ * All Rights Reserved. ++ * ++ * lzop and the LZO library are free software; you can redistribute them ++ * and/or modify them under the terms of the GNU General Public License as ++ * published by the Free Software Foundation; either version 2 of ++ * the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; see the file COPYING. ++ * If not, write to the Free Software Foundation, Inc., ++ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * Markus F.X.J. Oberhumer ++ * ++ * http://www.oberhumer.com/opensource/lzop/ ++ */ ++ ++#ifdef STATIC ++#include "lzo/lzo1x_decompress.c" ++#else ++#include ++#include ++#endif ++ ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const unsigned char lzop_magic[] = ++ { 0x89, 0x4c, 0x5a, 0x4f, 0x00, 0x0d, 0x0a, 0x1a, 0x0a }; ++ ++#define LZO_BLOCK_SIZE (256*1024l) ++#define HEADER_HAS_FILTER 0x00000800L ++ ++STATIC inline int INIT parse_header(u8 *input, u8 *skip) ++{ ++ int l; ++ u8 *parse = input; ++ u8 level = 0; ++ u16 version; ++ ++ /* read magic: 9 first bits */ ++ for (l = 0; l < 9; l++) { ++ if (*parse++ != lzop_magic[l]) ++ return 0; ++ } ++ /* get version (2bytes), skip library version (2), ++ * 'need to be extracted' version (2) and ++ * method (1) */ ++ version = get_unaligned_be16(parse); ++ parse += 7; ++ if (version >= 0x0940) ++ level = *parse++; ++ if (get_unaligned_be32(parse) & HEADER_HAS_FILTER) ++ parse += 8; /* flags + filter info */ ++ else ++ parse += 4; /* flags */ ++ ++ /* skip mode and mtime_low */ ++ parse += 8; ++ if (version >= 0x0940) ++ parse += 4; /* skip mtime_high */ ++ ++ l = *parse++; ++ /* don't care about the file name, and skip checksum */ ++ parse += l + 4; ++ ++ *skip = parse - input; ++ return 1; ++} ++ ++STATIC inline int INIT unlzo(u8 *input, int in_len, ++ int (*fill) (void *, unsigned int), ++ int (*flush) (void *, unsigned int), ++ u8 *output, int *posp, ++ void (*error_fn) (char *x)) ++{ ++ u8 skip = 0, r = 0; ++ u32 src_len, dst_len; ++ size_t tmp; ++ u8 *in_buf, *in_buf_save, *out_buf; ++ int obytes_processed = 0; ++ ++ set_error_fn(error_fn); ++ ++ if (output) ++ out_buf = output; ++ else if (!flush) { ++ error("NULL output pointer and no flush function provided"); ++ goto exit; ++ } else { ++ out_buf = malloc(LZO_BLOCK_SIZE); ++ if (!out_buf) { ++ error("Could not allocate output buffer"); ++ goto exit; ++ } ++ } ++ ++ if (input && fill) { ++ error("Both input pointer and fill function provided, don't know what to do"); ++ goto exit_1; ++ } else if (input) ++ in_buf = input; ++ else if (!fill || !posp) { ++ error("NULL input pointer and missing position pointer or fill function"); ++ goto exit_1; ++ } else { ++ in_buf = malloc(lzo1x_worst_compress(LZO_BLOCK_SIZE)); ++ if (!in_buf) { ++ error("Could not allocate input buffer"); ++ goto exit_1; ++ } ++ } ++ in_buf_save = in_buf; ++ ++ if (posp) ++ *posp = 0; ++ ++ if (fill) ++ fill(in_buf, lzo1x_worst_compress(LZO_BLOCK_SIZE)); ++ ++ if (!parse_header(input, &skip)) { ++ error("invalid header"); ++ goto exit_2; ++ } ++ in_buf += skip; ++ ++ if (posp) ++ *posp = skip; ++ ++ for (;;) { ++ /* read uncompressed block size */ ++ dst_len = get_unaligned_be32(in_buf); ++ in_buf += 4; ++ ++ /* exit if last block */ ++ if (dst_len == 0) { ++ if (posp) ++ *posp += 4; ++ break; ++ } ++ ++ if (dst_len > LZO_BLOCK_SIZE) { ++ error("dest len longer than block size"); ++ goto exit_2; ++ } ++ ++ /* read compressed block size, and skip block checksum info */ ++ src_len = get_unaligned_be32(in_buf); ++ in_buf += 8; ++ ++ if (src_len <= 0 || src_len > dst_len) { ++ error("file corrupted"); ++ goto exit_2; ++ } ++ ++ /* decompress */ ++ tmp = dst_len; ++ r = lzo1x_decompress_safe((u8 *) in_buf, src_len, out_buf, &tmp); ++ ++ if (r != LZO_E_OK || dst_len != tmp) { ++ error("Compressed data violation"); ++ goto exit_2; ++ } ++ ++ obytes_processed += dst_len; ++ if (flush) ++ flush(out_buf, dst_len); ++ if (output) ++ out_buf += dst_len; ++ if (posp) ++ *posp += src_len + 12; ++ if (fill) { ++ in_buf = in_buf_save; ++ fill(in_buf, lzo1x_worst_compress(LZO_BLOCK_SIZE)); ++ } else ++ in_buf += src_len; ++ } ++ ++exit_2: ++ if (!input) ++ free(in_buf); ++exit_1: ++ if (!output) ++ free(out_buf); ++exit: ++ return obytes_processed; ++} ++ ++#define decompress unlzo +--- a/lib/lzo/lzo1x_decompress.c ++++ b/lib/lzo/lzo1x_decompress.c +@@ -11,11 +11,13 @@ + * Richard Purdie + */ + ++#ifndef STATIC + #include + #include +-#include +-#include ++#endif ++ + #include ++#include + #include "lzodefs.h" + + #define HAVE_IP(x, ip_end, ip) ((size_t)(ip_end - ip) < (x)) +@@ -244,9 +246,10 @@ lookbehind_overrun: + *out_len = op - out; + return LZO_E_LOOKBEHIND_OVERRUN; + } +- ++#ifndef STATIC + EXPORT_SYMBOL_GPL(lzo1x_decompress_safe); + + MODULE_LICENSE("GPL"); + MODULE_DESCRIPTION("LZO1X Decompressor"); + ++#endif +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -230,3 +230,8 @@ quiet_cmd_lzma = LZMA $@ + cmd_lzma = (cat $(filter-out FORCE,$^) | \ + lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ + (rm -f $@ ; false) ++ ++quiet_cmd_lzo = LZO $@ ++cmd_lzo = (cat $(filter-out FORCE,$^) | \ ++ lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ ++ (rm -f $@ ; false) diff --git a/target/linux/generic-2.6/patches-2.6.32/051-lzo_compressed_kernel_for_arm.patch b/target/linux/generic-2.6/patches-2.6.32/051-lzo_compressed_kernel_for_arm.patch new file mode 100644 index 000000000..49512bb41 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/051-lzo_compressed_kernel_for_arm.patch @@ -0,0 +1,283 @@ +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -18,6 +18,8 @@ config ARM + select HAVE_KRETPROBES if (HAVE_KPROBES) + select HAVE_FUNCTION_TRACER if (!XIP_KERNEL) + select HAVE_GENERIC_DMA_COHERENT ++ select HAVE_KERNEL_GZIP ++ select HAVE_KERNEL_LZO + help + The ARM series is a line of low-power-consumption RISC chip designs + licensed by ARM Ltd and targeted at embedded applications and +--- a/arch/arm/boot/compressed/Makefile ++++ b/arch/arm/boot/compressed/Makefile +@@ -63,8 +63,12 @@ endif + + SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ + +-targets := vmlinux vmlinux.lds piggy.gz piggy.o font.o font.c \ +- head.o misc.o $(OBJS) ++suffix_$(CONFIG_KERNEL_GZIP) = gzip ++suffix_$(CONFIG_KERNEL_LZO) = lzo ++ ++targets := vmlinux vmlinux.lds \ ++ piggy.$(suffix_y) piggy.$(suffix_y).o \ ++ font.o font.c head.o misc.o $(OBJS) + + ifeq ($(CONFIG_FUNCTION_TRACER),y) + ORIG_CFLAGS := $(KBUILD_CFLAGS) +@@ -87,22 +91,31 @@ endif + ifneq ($(PARAMS_PHYS),) + LDFLAGS_vmlinux += --defsym params_phys=$(PARAMS_PHYS) + endif +-LDFLAGS_vmlinux += -p --no-undefined -X \ +- $(shell $(CC) $(KBUILD_CFLAGS) --print-libgcc-file-name) -T ++# ? ++LDFLAGS_vmlinux += -p ++# Report unresolved symbol references ++LDFLAGS_vmlinux += --no-undefined ++# Delete all temporary local symbols ++LDFLAGS_vmlinux += -X ++# Next argument is a linker script ++LDFLAGS_vmlinux += -T ++ ++# For __aeabi_uidivmod ++lib1funcs = $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.o + + # Don't allow any static data in misc.o, which + # would otherwise mess up our GOT table + CFLAGS_misc.o := -Dstatic= + +-$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.o \ +- $(addprefix $(obj)/, $(OBJS)) FORCE ++$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \ ++ $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE + $(call if_changed,ld) + @: + +-$(obj)/piggy.gz: $(obj)/../Image FORCE +- $(call if_changed,gzip) ++$(obj)/piggy.$(suffix_y): $(obj)/../Image FORCE ++ $(call if_changed,$(suffix_y)) + +-$(obj)/piggy.o: $(obj)/piggy.gz FORCE ++$(obj)/piggy.$(suffix_y).o: $(obj)/piggy.$(suffix_y) FORCE + + CFLAGS_font.o := -Dstatic= + +--- a/arch/arm/boot/compressed/misc.c ++++ b/arch/arm/boot/compressed/misc.c +@@ -18,10 +18,15 @@ + + unsigned int __machine_arch_type; + ++#define _LINUX_STRING_H_ ++ + #include /* for inline */ + #include /* for size_t */ + #include /* for NULL */ + #include ++#include ++ ++#include + + #ifdef STANDALONE_DEBUG + #define putstr printf +@@ -188,34 +193,8 @@ static inline __ptr_t memcpy(__ptr_t __d + /* + * gzip delarations + */ +-#define OF(args) args + #define STATIC static + +-typedef unsigned char uch; +-typedef unsigned short ush; +-typedef unsigned long ulg; +- +-#define WSIZE 0x8000 /* Window size must be at least 32k, */ +- /* and a power of two */ +- +-static uch *inbuf; /* input buffer */ +-static uch window[WSIZE]; /* Sliding window buffer */ +- +-static unsigned insize; /* valid bytes in inbuf */ +-static unsigned inptr; /* index of next byte to be processed in inbuf */ +-static unsigned outcnt; /* bytes in output buffer */ +- +-/* gzip flag byte */ +-#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ +-#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ +-#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ +-#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ +-#define COMMENT 0x10 /* bit 4 set: file comment present */ +-#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ +-#define RESERVED 0xC0 /* bit 6,7: reserved */ +- +-#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf()) +- + /* Diagnostic functions */ + #ifdef DEBUG + # define Assert(cond,msg) {if(!(cond)) error(msg);} +@@ -233,24 +212,20 @@ static unsigned outcnt; /* bytes in out + # define Tracecv(c,x) + #endif + +-static int fill_inbuf(void); +-static void flush_window(void); + static void error(char *m); + + extern char input_data[]; + extern char input_data_end[]; + +-static uch *output_data; +-static ulg output_ptr; +-static ulg bytes_out; ++static unsigned char *output_data; ++static unsigned long output_ptr; + + static void error(char *m); + + static void putstr(const char *); + +-extern int end; +-static ulg free_mem_ptr; +-static ulg free_mem_end_ptr; ++static unsigned long free_mem_ptr; ++static unsigned long free_mem_end_ptr; + + #ifdef STANDALONE_DEBUG + #define NO_INFLATE_MALLOC +@@ -258,46 +233,13 @@ static ulg free_mem_end_ptr; + + #define ARCH_HAS_DECOMP_WDOG + +-#include "../../../../lib/inflate.c" +- +-/* =========================================================================== +- * Fill the input buffer. This is called only when the buffer is empty +- * and at least one byte is really needed. +- */ +-int fill_inbuf(void) +-{ +- if (insize != 0) +- error("ran out of input data"); +- +- inbuf = input_data; +- insize = &input_data_end[0] - &input_data[0]; +- +- inptr = 1; +- return inbuf[0]; +-} ++#ifdef CONFIG_KERNEL_GZIP ++#include "../../../../lib/decompress_inflate.c" ++#endif + +-/* =========================================================================== +- * Write the output window window[0..outcnt-1] and update crc and bytes_out. +- * (Used for the decompressed data only.) +- */ +-void flush_window(void) +-{ +- ulg c = crc; +- unsigned n; +- uch *in, *out, ch; +- +- in = window; +- out = &output_data[output_ptr]; +- for (n = 0; n < outcnt; n++) { +- ch = *out++ = *in++; +- c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); +- } +- crc = c; +- bytes_out += (ulg)outcnt; +- output_ptr += (ulg)outcnt; +- outcnt = 0; +- putstr("."); +-} ++#ifdef CONFIG_KERNEL_LZO ++#include "../../../../lib/decompress_unlzo.c" ++#endif + + #ifndef arch_error + #define arch_error(x) +@@ -314,22 +256,33 @@ static void error(char *x) + while(1); /* Halt */ + } + ++asmlinkage void __div0(void) ++{ ++ error("Attempting division by 0!"); ++} ++ + #ifndef STANDALONE_DEBUG + +-ulg +-decompress_kernel(ulg output_start, ulg free_mem_ptr_p, ulg free_mem_ptr_end_p, +- int arch_id) ++unsigned long ++decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p, ++ unsigned long free_mem_ptr_end_p, ++ int arch_id) + { +- output_data = (uch *)output_start; /* Points to kernel start */ ++ unsigned char *tmp; ++ ++ output_data = (unsigned char *)output_start; + free_mem_ptr = free_mem_ptr_p; + free_mem_end_ptr = free_mem_ptr_end_p; + __machine_arch_type = arch_id; + + arch_decomp_setup(); + +- makecrc(); ++ tmp = (unsigned char *) (((unsigned long)input_data_end) - 4); ++ output_ptr = get_unaligned_le32(tmp); ++ + putstr("Uncompressing Linux..."); +- gunzip(); ++ decompress(input_data, input_data_end - input_data, ++ NULL, NULL, output_data, NULL, error); + putstr(" done, booting the kernel.\n"); + return output_ptr; + } +@@ -341,11 +294,10 @@ int main() + { + output_data = output_buffer; + +- makecrc(); + putstr("Uncompressing Linux..."); +- gunzip(); ++ decompress(input_data, input_data_end - input_data, ++ NULL, NULL, output_data, NULL, error); + putstr("done.\n"); + return 0; + } + #endif +- +--- a/arch/arm/boot/compressed/piggy.S ++++ /dev/null +@@ -1,6 +0,0 @@ +- .section .piggydata,#alloc +- .globl input_data +-input_data: +- .incbin "arch/arm/boot/compressed/piggy.gz" +- .globl input_data_end +-input_data_end: +--- /dev/null ++++ b/arch/arm/boot/compressed/piggy.gzip.S +@@ -0,0 +1,6 @@ ++ .section .piggydata,#alloc ++ .globl input_data ++input_data: ++ .incbin "arch/arm/boot/compressed/piggy.gzip" ++ .globl input_data_end ++input_data_end: +--- /dev/null ++++ b/arch/arm/boot/compressed/piggy.lzo.S +@@ -0,0 +1,6 @@ ++ .section .piggydata,#alloc ++ .globl input_data ++input_data: ++ .incbin "arch/arm/boot/compressed/piggy.lzo" ++ .globl input_data_end ++input_data_end: diff --git a/target/linux/generic-2.6/patches-2.6.32/052-lzo_compressed_kernel_for_x86.patch b/target/linux/generic-2.6/patches-2.6.32/052-lzo_compressed_kernel_for_x86.patch new file mode 100644 index 000000000..ea7d2400b --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/052-lzo_compressed_kernel_for_x86.patch @@ -0,0 +1,48 @@ +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig +@@ -49,6 +49,7 @@ config X86 + select HAVE_KERNEL_GZIP + select HAVE_KERNEL_BZIP2 + select HAVE_KERNEL_LZMA ++ select HAVE_KERNEL_LZO + select HAVE_ARCH_KMEMCHECK + + config OUTPUT_FORMAT +--- a/arch/x86/boot/compressed/Makefile ++++ b/arch/x86/boot/compressed/Makefile +@@ -4,7 +4,7 @@ + # create a compressed vmlinux image from the original vmlinux + # + +-targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma head_$(BITS).o misc.o piggy.o ++targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.lzo head_$(BITS).o misc.o piggy.o + + KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 + KBUILD_CFLAGS += -fno-strict-aliasing -fPIC +@@ -48,10 +48,13 @@ $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.al + $(call if_changed,bzip2) + $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE + $(call if_changed,lzma) ++$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE ++ $(call if_changed,lzo) + + suffix-$(CONFIG_KERNEL_GZIP) := gz + suffix-$(CONFIG_KERNEL_BZIP2) := bz2 + suffix-$(CONFIG_KERNEL_LZMA) := lzma ++suffix-$(CONFIG_KERNEL_LZO) := lzo + + quiet_cmd_mkpiggy = MKPIGGY $@ + cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false ) +--- a/arch/x86/boot/compressed/misc.c ++++ b/arch/x86/boot/compressed/misc.c +@@ -162,6 +162,10 @@ static int lines, cols; + #include "../../../../lib/decompress_unlzma.c" + #endif + ++#ifdef CONFIG_KERNEL_LZO ++#include "../../../../lib/decompress_unlzo.c" ++#endif ++ + static void scroll(void) + { + int i; diff --git a/target/linux/generic-2.6/patches-2.6.32/053-lzo_compression_for_initramfs.patch b/target/linux/generic-2.6/patches-2.6.32/053-lzo_compression_for_initramfs.patch new file mode 100644 index 000000000..3445b4ae9 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/053-lzo_compression_for_initramfs.patch @@ -0,0 +1,106 @@ +--- a/lib/Kconfig ++++ b/lib/Kconfig +@@ -120,6 +120,10 @@ config DECOMPRESS_LZMA + config DECOMPRESS_LZMA_NEEDED + boolean + ++config DECOMPRESS_LZO ++ select LZO_DECOMPRESS ++ tristate ++ + # + # Generic allocator support is selected if needed + # +--- a/lib/Makefile ++++ b/lib/Makefile +@@ -69,6 +69,7 @@ obj-$(CONFIG_LZO_DECOMPRESS) += lzo/ + lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o + lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o + lib-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o ++lib-$(CONFIG_DECOMPRESS_LZO) += decompress_unlzo.o + + obj-$(CONFIG_TEXTSEARCH) += textsearch.o + obj-$(CONFIG_TEXTSEARCH_KMP) += ts_kmp.o +--- a/lib/decompress.c ++++ b/lib/decompress.c +@@ -9,6 +9,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -22,6 +23,9 @@ + #ifndef CONFIG_DECOMPRESS_LZMA + # define unlzma NULL + #endif ++#ifndef CONFIG_DECOMPRESS_LZO ++# define unlzo NULL ++#endif + + static const struct compress_format { + unsigned char magic[2]; +@@ -32,6 +36,7 @@ static const struct compress_format { + { {037, 0236}, "gzip", gunzip }, + { {0x42, 0x5a}, "bzip2", bunzip2 }, + { {0x5d, 0x00}, "lzma", unlzma }, ++ { {0x89, 0x4c}, "lzo", unlzo }, + { {0, 0}, NULL, NULL } + }; + +--- a/usr/Kconfig ++++ b/usr/Kconfig +@@ -72,6 +72,15 @@ config RD_LZMA + Support loading of a LZMA encoded initial ramdisk or cpio buffer + If unsure, say N. + ++config RD_LZO ++ bool "Support initial ramdisks compressed using LZO" if EMBEDDED ++ default !EMBEDDED ++ depends on BLK_DEV_INITRD ++ select DECOMPRESS_LZO ++ help ++ Support loading of a LZO encoded initial ramdisk or cpio buffer ++ If unsure, say N. ++ + choice + prompt "Built-in initramfs compression mode" if INITRAMFS_SOURCE!="" + help +@@ -108,16 +117,15 @@ config INITRAMFS_COMPRESSION_GZIP + bool "Gzip" + depends on RD_GZIP + help +- The old and tried gzip compression. Its compression ratio is +- the poorest among the 3 choices; however its speed (both +- compression and decompression) is the fastest. ++ The old and tried gzip compression. It provides a good balance ++ between compression ratio and decompression speed. + + config INITRAMFS_COMPRESSION_BZIP2 + bool "Bzip2" + depends on RD_BZIP2 + help + Its compression ratio and speed is intermediate. +- Decompression speed is slowest among the three. The initramfs ++ Decompression speed is slowest among the four. The initramfs + size is about 10% smaller with bzip2, in comparison to gzip. + Bzip2 uses a large amount of memory. For modern kernels you + will need at least 8MB RAM or more for booting. +@@ -128,7 +136,15 @@ config INITRAMFS_COMPRESSION_LZMA + help + The most recent compression algorithm. + Its ratio is best, decompression speed is between the other +- two. Compression is slowest. The initramfs size is about 33% ++ three. Compression is slowest. The initramfs size is about 33% + smaller with LZMA in comparison to gzip. + ++config INITRAMFS_COMPRESSION_LZO ++ bool "LZO" ++ depends on RD_LZO ++ help ++ Its compression ratio is the poorest among the four. The kernel ++ size is about about 10% bigger than gzip; however its speed ++ (both compression and decompression) is the fastest. ++ + endchoice diff --git a/target/linux/generic-2.6/patches-2.6.32/055-lzma_arm_kernel.patch b/target/linux/generic-2.6/patches-2.6.32/055-lzma_arm_kernel.patch new file mode 100644 index 000000000..a0111bd55 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.32/055-lzma_arm_kernel.patch @@ -0,0 +1,57 @@ +From d0f226a0f104c7d1da1d215b8013359273e39e18 Mon Sep 17 00:00:00 2001 +From: Albin Tonnerre +Date: Fri, 16 Oct 2009 16:17:22 +0200 +Subject: [PATCH] Add LZMA decompression on ARM + + +Signed-off-by: Albin Tonnerre +--- + arch/arm/Kconfig | 1 + + arch/arm/boot/compressed/Makefile | 1 + + arch/arm/boot/compressed/misc.c | 4 ++++ + arch/arm/boot/compressed/piggy.lzma.S | 6 ++++++ + 4 files changed, 12 insertions(+), 0 deletions(-) + create mode 100644 arch/arm/boot/compressed/piggy.lzma.S + +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -20,6 +20,7 @@ config ARM + select HAVE_GENERIC_DMA_COHERENT + select HAVE_KERNEL_GZIP + select HAVE_KERNEL_LZO ++ select HAVE_KERNEL_LZMA + help + The ARM series is a line of low-power-consumption RISC chip designs + licensed by ARM Ltd and targeted at embedded applications and +--- a/arch/arm/boot/compressed/Makefile ++++ b/arch/arm/boot/compressed/Makefile +@@ -65,6 +65,7 @@ SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/ + + suffix_$(CONFIG_KERNEL_GZIP) = gzip + suffix_$(CONFIG_KERNEL_LZO) = lzo ++suffix_$(CONFIG_KERNEL_LZMA) = lzma + + targets := vmlinux vmlinux.lds \ + piggy.$(suffix_y) piggy.$(suffix_y).o \ +--- a/arch/arm/boot/compressed/misc.c ++++ b/arch/arm/boot/compressed/misc.c +@@ -237,6 +237,10 @@ static unsigned long free_mem_end_ptr; + #include "../../../../lib/decompress_inflate.c" + #endif + ++#ifdef CONFIG_KERNEL_LZMA ++#include "../../../../lib/decompress_unlzma.c" ++#endif ++ + #ifdef CONFIG_KERNEL_LZO + #include "../../../../lib/decompress_unlzo.c" + #endif +--- /dev/null ++++ b/arch/arm/boot/compressed/piggy.lzma.S +@@ -0,0 +1,6 @@ ++ .section .piggydata,#alloc ++ .globl input_data ++input_data: ++ .incbin "arch/arm/boot/compressed/piggy.lzma" ++ .globl input_data_end ++input_data_end: diff --git a/target/linux/generic-2.6/patches-2.6.32/960-arm_lzma_loader.patch b/target/linux/generic-2.6/patches-2.6.32/960-arm_lzma_loader.patch deleted file mode 100644 index 5f4f28757..000000000 --- a/target/linux/generic-2.6/patches-2.6.32/960-arm_lzma_loader.patch +++ /dev/null @@ -1,710 +0,0 @@ ---- a/arch/arm/boot/compressed/Makefile -+++ b/arch/arm/boot/compressed/Makefile -@@ -63,7 +63,7 @@ endif - - SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ - --targets := vmlinux vmlinux.lds piggy.gz piggy.o font.o font.c \ -+targets := vmlinux vmlinux.lds piggy.lzma piggy.o font.o font.c \ - head.o misc.o $(OBJS) - - ifeq ($(CONFIG_FUNCTION_TRACER),y) -@@ -99,10 +99,10 @@ $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj - $(call if_changed,ld) - @: - --$(obj)/piggy.gz: $(obj)/../Image FORCE -- $(call if_changed,gzip) -+$(obj)/piggy.lzma: $(obj)/../Image FORCE -+ $(call if_changed,lzma) - --$(obj)/piggy.o: $(obj)/piggy.gz FORCE -+$(obj)/piggy.o: $(obj)/piggy.lzma FORCE - - CFLAGS_font.o := -Dstatic= - ---- a/arch/arm/boot/compressed/misc.c -+++ b/arch/arm/boot/compressed/misc.c -@@ -185,36 +185,10 @@ static inline __ptr_t memcpy(__ptr_t __d - return __dest; - } - --/* -- * gzip delarations -- */ --#define OF(args) args --#define STATIC static -- --typedef unsigned char uch; --typedef unsigned short ush; --typedef unsigned long ulg; -- --#define WSIZE 0x8000 /* Window size must be at least 32k, */ -+#define WSIZE 0x20000 /* Window size must be at least 128k, */ - /* and a power of two */ - --static uch *inbuf; /* input buffer */ --static uch window[WSIZE]; /* Sliding window buffer */ -- --static unsigned insize; /* valid bytes in inbuf */ --static unsigned inptr; /* index of next byte to be processed in inbuf */ --static unsigned outcnt; /* bytes in output buffer */ -- --/* gzip flag byte */ --#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ --#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ --#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ --#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ --#define COMMENT 0x10 /* bit 4 set: file comment present */ --#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ --#define RESERVED 0xC0 /* bit 6,7: reserved */ -- --#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf()) -+static u8 window[WSIZE]; /* Sliding window buffer */ - - /* Diagnostic functions */ - #ifdef DEBUG -@@ -233,24 +207,21 @@ static unsigned outcnt; /* bytes in out - # define Tracecv(c,x) - #endif - --static int fill_inbuf(void); --static void flush_window(void); - static void error(char *m); - - extern char input_data[]; - extern char input_data_end[]; - --static uch *output_data; --static ulg output_ptr; --static ulg bytes_out; -+static unsigned long output_ptr; -+static unsigned long bytes_out; - - static void error(char *m); - - static void putstr(const char *); - - extern int end; --static ulg free_mem_ptr; --static ulg free_mem_end_ptr; -+static unsigned long free_mem_ptr; -+static unsigned long free_mem_end_ptr; - - #ifdef STANDALONE_DEBUG - #define NO_INFLATE_MALLOC -@@ -258,50 +229,10 @@ static ulg free_mem_end_ptr; - - #define ARCH_HAS_DECOMP_WDOG - --#include "../../../../lib/inflate.c" -- --/* =========================================================================== -- * Fill the input buffer. This is called only when the buffer is empty -- * and at least one byte is really needed. -- */ --int fill_inbuf(void) --{ -- if (insize != 0) -- error("ran out of input data"); -- -- inbuf = input_data; -- insize = &input_data_end[0] - &input_data[0]; -- -- inptr = 1; -- return inbuf[0]; --} -- --/* =========================================================================== -- * Write the output window window[0..outcnt-1] and update crc and bytes_out. -- * (Used for the decompressed data only.) -- */ --void flush_window(void) --{ -- ulg c = crc; -- unsigned n; -- uch *in, *out, ch; -- -- in = window; -- out = &output_data[output_ptr]; -- for (n = 0; n < outcnt; n++) { -- ch = *out++ = *in++; -- c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); -- } -- crc = c; -- bytes_out += (ulg)outcnt; -- output_ptr += (ulg)outcnt; -- outcnt = 0; -- putstr("."); --} -- - #ifndef arch_error - #define arch_error(x) - #endif -+#include "unlzma.c" - - static void error(char *x) - { -@@ -316,20 +247,16 @@ static void error(char *x) - - #ifndef STANDALONE_DEBUG - --ulg --decompress_kernel(ulg output_start, ulg free_mem_ptr_p, ulg free_mem_ptr_end_p, -+unsigned long -+decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p, unsigned long free_mem_ptr_end_p, - int arch_id) - { -- output_data = (uch *)output_start; /* Points to kernel start */ -- free_mem_ptr = free_mem_ptr_p; -- free_mem_end_ptr = free_mem_ptr_end_p; - __machine_arch_type = arch_id; - - arch_decomp_setup(); - -- makecrc(); - putstr("Uncompressing Linux..."); -- gunzip(); -+ output_ptr += unlzma((u8 *) output_start, input_data, window); - putstr(" done, booting the kernel.\n"); - return output_ptr; - } -@@ -339,11 +266,8 @@ char output_buffer[1500*1024]; - - int main() - { -- output_data = output_buffer; -- -- makecrc(); - putstr("Uncompressing Linux..."); -- gunzip(); -+ unlzma((u8 *) output_buffer, input_data, window); - putstr("done.\n"); - return 0; - } ---- a/arch/arm/boot/compressed/piggy.S -+++ b/arch/arm/boot/compressed/piggy.S -@@ -1,6 +1,6 @@ - .section .piggydata,#alloc - .globl input_data - input_data: -- .incbin "arch/arm/boot/compressed/piggy.gz" -+ .incbin "arch/arm/boot/compressed/piggy.lzma" - .globl input_data_end - input_data_end: ---- /dev/null -+++ b/arch/arm/boot/compressed/unlzma.c -@@ -0,0 +1,429 @@ -+/* -+ * Copyright (c) 2009 Felix Fietkau -+ * -+ * 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, -+ * or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ * -+ * uncompress.c -+ */ -+ -+#include -+#include -+#include "unlzma.h" -+ -+struct unlzma_ctx { -+ const u8 *next_in; -+ u8 *next_out; -+ u8 *outbuf; -+ -+ /* reader state */ -+ u32 code; -+ u32 range; -+ u32 bound; -+ -+ /* writer state */ -+ u8 previous_byte; -+ ssize_t pos; -+ -+ /* cstate */ -+ int state; -+ u32 rep0, rep1, rep2, rep3; -+ -+ void *workspace; -+} ctx; -+ -+static int inbs = 0; -+static inline u8 -+rc_read(void) -+{ -+#if 0 -+ if (unlikely(++inbs > 16 * 1024)) { -+ putstr("."); -+ inbs = 0; -+ } -+#endif -+ return *(ctx.next_in++); -+} -+ -+ -+static inline void -+rc_get_code(void) -+{ -+ ctx.code = (ctx.code << 8) | rc_read(); -+} -+ -+static inline void -+rc_normalize(void) -+{ -+ if (ctx.range < (1 << RC_TOP_BITS)) { -+ ctx.range <<= 8; -+ rc_get_code(); -+ } -+} -+ -+static inline int -+rc_is_bit_0(u16 *p) -+{ -+ rc_normalize(); -+ ctx.bound = *p * (ctx.range >> RC_MODEL_TOTAL_BITS); -+ return ctx.code < ctx.bound; -+} -+ -+static inline void -+rc_update_bit_0(u16 *p) -+{ -+ ctx.range = ctx.bound; -+ *p += ((1 << RC_MODEL_TOTAL_BITS) - *p) >> RC_MOVE_BITS; -+} -+ -+static inline void -+rc_update_bit_1(u16 *p) -+{ -+ ctx.range -= ctx.bound; -+ ctx.code -= ctx.bound; -+ *p -= *p >> RC_MOVE_BITS; -+} -+ -+static inline bool -+rc_get_bit(u16 *p, int *symbol) -+{ -+ if (rc_is_bit_0(p)) { -+ rc_update_bit_0(p); -+ *symbol *= 2; -+ return 0; -+ } else { -+ rc_update_bit_1(p); -+ *symbol = *symbol * 2 + 1; -+ return 1; -+ } -+} -+ -+static inline int -+rc_direct_bit(void) -+{ -+ rc_normalize(); -+ ctx.range >>= 1; -+ if (ctx.code >= ctx.range) { -+ ctx.code -= ctx.range; -+ return 1; -+ } -+ return 0; -+} -+ -+static inline void -+rc_bit_tree_decode(u16 *p, int num_levels, int *symbol) -+{ -+ int i = num_levels; -+ -+ *symbol = 1; -+ while (i--) -+ rc_get_bit(p + *symbol, symbol); -+ *symbol -= 1 << num_levels; -+} -+ -+static inline u8 -+peek_old_byte(u32 offs) -+{ -+ u32 pos = ctx.pos - offs; -+ return ctx.outbuf[pos]; -+} -+ -+static inline void -+write_byte(u8 byte) -+{ -+ ctx.previous_byte = byte; -+ *(ctx.next_out++) = byte; -+ ctx.pos++; -+} -+ -+ -+static inline void -+copy_byte(u32 offs) -+{ -+ write_byte(peek_old_byte(offs)); -+} -+ -+static inline void -+copy_bytes(u32 rep0, int len) -+{ -+ do { -+ copy_byte(rep0); -+ len--; -+ } while (len != 0); -+} -+ -+static inline void -+process_bit0(u16 *p, int pos_state, u16 *prob, -+ int lc, u32 literal_pos_mask) -+{ -+ int mi = 1; -+ rc_update_bit_0(prob); -+ prob = (p + LZMA_LITERAL + -+ (LZMA_LIT_SIZE -+ * (((ctx.pos & literal_pos_mask) << lc) -+ + (ctx.previous_byte >> (8 - lc)))) -+ ); -+ -+ if (ctx.state >= LZMA_NUM_LIT_STATES) { -+ int match_byte = peek_old_byte(ctx.rep0); -+ do { -+ u16 bit; -+ u16 *prob_lit; -+ -+ match_byte <<= 1; -+ bit = match_byte & 0x100; -+ prob_lit = prob + 0x100 + bit + mi; -+ if (rc_get_bit(prob_lit, &mi) != !!bit) -+ break; -+ } while (mi < 0x100); -+ } -+ while (mi < 0x100) { -+ u16 *prob_lit = prob + mi; -+ rc_get_bit(prob_lit, &mi); -+ } -+ write_byte(mi); -+ if (ctx.state < 4) -+ ctx.state = 0; -+ else if (ctx.state < 10) -+ ctx.state -= 3; -+ else -+ ctx.state -= 6; -+} -+ -+static inline void -+process_bit1(u16 *p, int pos_state, u16 *prob) -+{ -+ int offset; -+ u16 *prob_len; -+ int num_bits; -+ int len; -+ -+ rc_update_bit_1(prob); -+ prob = p + LZMA_IS_REP + ctx.state; -+ if (rc_is_bit_0(prob)) { -+ rc_update_bit_0(prob); -+ ctx.rep3 = ctx.rep2; -+ ctx.rep2 = ctx.rep1; -+ ctx.rep1 = ctx.rep0; -+ ctx.state = ctx.state < LZMA_NUM_LIT_STATES ? 0 : 3; -+ prob = p + LZMA_LEN_CODER; -+ } else { -+ rc_update_bit_1(prob); -+ prob = p + LZMA_IS_REP_G0 + ctx.state; -+ if (rc_is_bit_0(prob)) { -+ rc_update_bit_0(prob); -+ prob = (p + LZMA_IS_REP_0_LONG -+ + (ctx.state << -+ LZMA_NUM_POS_BITS_MAX) + -+ pos_state); -+ if (rc_is_bit_0(prob)) { -+ rc_update_bit_0(prob); -+ -+ ctx.state = ctx.state < LZMA_NUM_LIT_STATES ? -+ 9 : 11; -+ copy_byte(ctx.rep0); -+ return; -+ } else { -+ rc_update_bit_1(prob); -+ } -+ } else { -+ u32 distance; -+ -+ rc_update_bit_1(prob); -+ prob = p + LZMA_IS_REP_G1 + ctx.state; -+ if (rc_is_bit_0(prob)) { -+ rc_update_bit_0(prob); -+ distance = ctx.rep1; -+ } else { -+ rc_update_bit_1(prob); -+ prob = p + LZMA_IS_REP_G2 + ctx.state; -+ if (rc_is_bit_0(prob)) { -+ rc_update_bit_0(prob); -+ distance = ctx.rep2; -+ } else { -+ rc_update_bit_1(prob); -+ distance = ctx.rep3; -+ ctx.rep3 = ctx.rep2; -+ } -+ ctx.rep2 = ctx.rep1; -+ } -+ ctx.rep1 = ctx.rep0; -+ ctx.rep0 = distance; -+ } -+ ctx.state = ctx.state < LZMA_NUM_LIT_STATES ? 8 : 11; -+ prob = p + LZMA_REP_LEN_CODER; -+ } -+ -+ prob_len = prob + LZMA_LEN_CHOICE; -+ if (rc_is_bit_0(prob_len)) { -+ rc_update_bit_0(prob_len); -+ prob_len = (prob + LZMA_LEN_LOW -+ + (pos_state << -+ LZMA_LEN_NUM_LOW_BITS)); -+ offset = 0; -+ num_bits = LZMA_LEN_NUM_LOW_BITS; -+ } else { -+ rc_update_bit_1(prob_len); -+ prob_len = prob + LZMA_LEN_CHOICE_2; -+ if (rc_is_bit_0(prob_len)) { -+ rc_update_bit_0(prob_len); -+ prob_len = (prob + LZMA_LEN_MID -+ + (pos_state << -+ LZMA_LEN_NUM_MID_BITS)); -+ offset = 1 << LZMA_LEN_NUM_LOW_BITS; -+ num_bits = LZMA_LEN_NUM_MID_BITS; -+ } else { -+ rc_update_bit_1(prob_len); -+ prob_len = prob + LZMA_LEN_HIGH; -+ offset = ((1 << LZMA_LEN_NUM_LOW_BITS) -+ + (1 << LZMA_LEN_NUM_MID_BITS)); -+ num_bits = LZMA_LEN_NUM_HIGH_BITS; -+ } -+ } -+ -+ rc_bit_tree_decode(prob_len, num_bits, &len); -+ len += offset; -+ -+ if (ctx.state < 4) { -+ int pos_slot; -+ -+ ctx.state += LZMA_NUM_LIT_STATES; -+ prob = -+ p + LZMA_POS_SLOT + -+ ((len < -+ LZMA_NUM_LEN_TO_POS_STATES ? len : -+ LZMA_NUM_LEN_TO_POS_STATES - 1) -+ << LZMA_NUM_POS_SLOT_BITS); -+ rc_bit_tree_decode(prob, -+ LZMA_NUM_POS_SLOT_BITS, -+ &pos_slot); -+ if (pos_slot >= LZMA_START_POS_MODEL_INDEX) { -+ int i, mi; -+ num_bits = (pos_slot >> 1) - 1; -+ ctx.rep0 = 2 | (pos_slot & 1); -+ if (pos_slot < LZMA_END_POS_MODEL_INDEX) { -+ ctx.rep0 <<= num_bits; -+ prob = p + LZMA_SPEC_POS + -+ ctx.rep0 - pos_slot - 1; -+ } else { -+ num_bits -= LZMA_NUM_ALIGN_BITS; -+ while (num_bits--) -+ ctx.rep0 = (ctx.rep0 << 1) | -+ rc_direct_bit(); -+ prob = p + LZMA_ALIGN; -+ ctx.rep0 <<= LZMA_NUM_ALIGN_BITS; -+ num_bits = LZMA_NUM_ALIGN_BITS; -+ } -+ i = 1; -+ mi = 1; -+ while (num_bits--) { -+ if (rc_get_bit(prob + mi, &mi)) -+ ctx.rep0 |= i; -+ i <<= 1; -+ } -+ } else -+ ctx.rep0 = pos_slot; -+ if (++(ctx.rep0) == 0) -+ return; -+ } -+ -+ len += LZMA_MATCH_MIN_LEN; -+ -+ copy_bytes(ctx.rep0, len); -+} -+ -+ -+static int -+do_unlzma(void) -+{ -+ u8 hdr_buf[sizeof(struct lzma_header)]; -+ struct lzma_header *header = (struct lzma_header *)hdr_buf; -+ u32 pos_state_mask; -+ u32 literal_pos_mask; -+ int lc, pb, lp; -+ int num_probs; -+ int i, mi; -+ u16 *p; -+ -+ for (i = 0; i < sizeof(struct lzma_header); i++) { -+ hdr_buf[i] = rc_read(); -+ } -+ -+ ctx.pos = 0; -+ ctx.state = 0; -+ ctx.rep0 = ctx.rep1 = ctx.rep2 = ctx.rep3 = 1; -+ -+ ctx.previous_byte = 0; -+ ctx.code = 0; -+ ctx.range = 0xFFFFFFFF; -+ -+ if (header->pos >= (9 * 5 * 5)) -+ return -1; -+ -+ mi = 0; -+ lc = header->pos; -+ while (lc >= 9) { -+ mi++; -+ lc -= 9; -+ } -+ pb = 0; -+ lp = mi; -+ while (lp >= 5) { -+ pb++; -+ lp -= 5; -+ } -+ pos_state_mask = (1 << pb) - 1; -+ literal_pos_mask = (1 << lp) - 1; -+ -+ p = (u16 *) ctx.workspace; -+ if (!p) -+ return -1; -+ -+ num_probs = LZMA_LITERAL + (LZMA_LIT_SIZE << (lc + lp)); -+ for (i = 0; i < num_probs; i++) -+ p[i] = (1 << RC_MODEL_TOTAL_BITS) >> 1; -+ -+ for (i = 0; i < 5; i++) -+ rc_get_code(); -+ -+ while (1) { -+ int pos_state = ctx.pos & pos_state_mask; -+ u16 *prob = p + LZMA_IS_MATCH + -+ (ctx.state << LZMA_NUM_POS_BITS_MAX) + pos_state; -+ if (rc_is_bit_0(prob)) -+ process_bit0(p, pos_state, prob, -+ lc, literal_pos_mask); -+ else { -+ process_bit1(p, pos_state, prob); -+ if (ctx.rep0 == 0) -+ break; -+ } -+ } -+ -+ return ctx.pos; -+} -+ -+ -+static int unlzma(unsigned char *dest, const unsigned char *src, unsigned char *workspace) -+{ -+ memset(&ctx, 0, sizeof(ctx)); -+ ctx.outbuf = dest; -+ ctx.next_in = src; -+ ctx.next_out = dest; -+ ctx.workspace = workspace; -+ -+ return do_unlzma(); -+} -+ -+ ---- /dev/null -+++ b/arch/arm/boot/compressed/unlzma.h -@@ -0,0 +1,81 @@ -+/* LZMA uncompresion module for pcomp -+ * Copyright (C) 2009 Felix Fietkau -+ * -+ * Based on: -+ * Initial Linux kernel adaptation -+ * Copyright (C) 2006 Alain < alain@knaff.lu > -+ * -+ * Based on small lzma deflate implementation/Small range coder -+ * implementation for lzma. -+ * Copyright (C) 2006 Aurelien Jacobs < aurel@gnuage.org > -+ * -+ * Based on LzmaDecode.c from the LZMA SDK 4.22 (http://www.7-zip.org/) -+ * Copyright (C) 1999-2005 Igor Pavlov -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ */ -+#ifndef __UNLZMA_H -+#define __UNLZMA_H -+ -+struct lzma_header { -+ __u8 pos; -+ __le32 dict_size; -+ __le64 uncompr_size; -+} __attribute__ ((packed)); -+ -+ -+#define RC_TOP_BITS 24 -+#define RC_MOVE_BITS 5 -+#define RC_MODEL_TOTAL_BITS 11 -+ -+#define LZMA_BASE_SIZE 1846 -+#define LZMA_LIT_SIZE 768 -+ -+#define LZMA_NUM_POS_BITS_MAX 4 -+ -+#define LZMA_LEN_NUM_LOW_BITS 3 -+#define LZMA_LEN_NUM_MID_BITS 3 -+#define LZMA_LEN_NUM_HIGH_BITS 8 -+ -+#define LZMA_LEN_CHOICE 0 -+#define LZMA_LEN_CHOICE_2 (LZMA_LEN_CHOICE + 1) -+#define LZMA_LEN_LOW (LZMA_LEN_CHOICE_2 + 1) -+#define LZMA_LEN_MID (LZMA_LEN_LOW \ -+ + (1 << (LZMA_NUM_POS_BITS_MAX + LZMA_LEN_NUM_LOW_BITS))) -+#define LZMA_LEN_HIGH (LZMA_LEN_MID \ -+ +(1 << (LZMA_NUM_POS_BITS_MAX + LZMA_LEN_NUM_MID_BITS))) -+#define LZMA_NUM_LEN_PROBS (LZMA_LEN_HIGH + (1 << LZMA_LEN_NUM_HIGH_BITS)) -+ -+#define LZMA_NUM_STATES 12 -+#define LZMA_NUM_LIT_STATES 7 -+ -+#define LZMA_START_POS_MODEL_INDEX 4 -+#define LZMA_END_POS_MODEL_INDEX 14 -+#define LZMA_NUM_FULL_DISTANCES (1 << (LZMA_END_POS_MODEL_INDEX >> 1)) -+ -+#define LZMA_NUM_POS_SLOT_BITS 6 -+#define LZMA_NUM_LEN_TO_POS_STATES 4 -+ -+#define LZMA_NUM_ALIGN_BITS 4 -+ -+#define LZMA_MATCH_MIN_LEN 2 -+ -+#define LZMA_IS_MATCH 0 -+#define LZMA_IS_REP (LZMA_IS_MATCH + (LZMA_NUM_STATES << LZMA_NUM_POS_BITS_MAX)) -+#define LZMA_IS_REP_G0 (LZMA_IS_REP + LZMA_NUM_STATES) -+#define LZMA_IS_REP_G1 (LZMA_IS_REP_G0 + LZMA_NUM_STATES) -+#define LZMA_IS_REP_G2 (LZMA_IS_REP_G1 + LZMA_NUM_STATES) -+#define LZMA_IS_REP_0_LONG (LZMA_IS_REP_G2 + LZMA_NUM_STATES) -+#define LZMA_POS_SLOT (LZMA_IS_REP_0_LONG \ -+ + (LZMA_NUM_STATES << LZMA_NUM_POS_BITS_MAX)) -+#define LZMA_SPEC_POS (LZMA_POS_SLOT \ -+ +(LZMA_NUM_LEN_TO_POS_STATES << LZMA_NUM_POS_SLOT_BITS)) -+#define LZMA_ALIGN (LZMA_SPEC_POS \ -+ + LZMA_NUM_FULL_DISTANCES - LZMA_END_POS_MODEL_INDEX) -+#define LZMA_LEN_CODER (LZMA_ALIGN + (1 << LZMA_NUM_ALIGN_BITS)) -+#define LZMA_REP_LEN_CODER (LZMA_LEN_CODER + LZMA_NUM_LEN_PROBS) -+#define LZMA_LITERAL (LZMA_REP_LEN_CODER + LZMA_NUM_LEN_PROBS) -+ -+#endif From 1c6be5e8b9e9e290cd1f3eb6cc1d1916a1323716 Mon Sep 17 00:00:00 2001 From: kaloz Date: Tue, 17 Nov 2009 10:06:15 +0000 Subject: [PATCH 181/288] refresh 2.6.32 patches with -rc7 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18440 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic-2.6/config-2.6.32 | 10 +++++++++- .../generic-2.6/patches-2.6.32/150-netfilter_imq.patch | 2 +- .../patches-2.6.32/240-packet_socket_type.patch | 6 +++--- .../generic-2.6/patches-2.6.32/410-gpio_buttons.patch | 2 +- .../patches-2.6.32/840-unable_to_open_console.patch | 4 ++-- .../linux/generic-2.6/patches-2.6.32/922-gpiommc.patch | 2 +- .../patches-2.6.32/977-textsearch_kconfig_hacks.patch | 2 +- .../generic-2.6/patches-2.6.32/980-vm_exports.patch | 10 +++++----- .../patches-2.6.32/998-openwrt_lzma_options.patch | 4 +++- .../patches-2.6.32/999-use_preinit_as_init.patch | 2 +- .../ixp4xx/patches-2.6.32/050-disable_dmabounce.patch | 2 +- .../ixp4xx/patches-2.6.32/402-ixp4xx_gpiolib.patch | 2 +- 12 files changed, 29 insertions(+), 19 deletions(-) diff --git a/target/linux/generic-2.6/config-2.6.32 b/target/linux/generic-2.6/config-2.6.32 index b99d86497..c60c2f6cc 100644 --- a/target/linux/generic-2.6/config-2.6.32 +++ b/target/linux/generic-2.6/config-2.6.32 @@ -88,6 +88,7 @@ CONFIG_ASK_IP_FIB_HASH=y # CONFIG_ATA_OVER_ETH is not set # CONFIG_ATARI_PARTITION is not set CONFIG_ATA_SFF=y +# CONFIG_ATA_VERBOSE_ERROR is not set # CONFIG_ATH5K is not set # CONFIG_ATH9K is not set # CONFIG_ATL1C is not set @@ -149,6 +150,7 @@ CONFIG_BCM43XX_DMA=y # CONFIG_BCM43XX is not set # CONFIG_BCM43XX_PIO_MODE is not set CONFIG_BCM43XX_PIO=y +# CONFIG_BE2ISCSI is not set # CONFIG_BEFS_FS is not set # CONFIG_BFS_FS is not set # CONFIG_BINARY_PRINTF is not set @@ -1035,10 +1037,10 @@ CONFIG_JOLIET=y # CONFIG_KALLSYMS_EXTRA_PASS is not set # CONFIG_KALLSYMS is not set # CONFIG_KARMA_PARTITION is not set -# CONFIG_KEXEC is not set # CONFIG_KERNEL_GZIP is not set CONFIG_KERNEL_LZMA=y # CONFIG_KERNEL_LZO is not set +# CONFIG_KEXEC is not set # CONFIG_KEYBOARD_LM8323 is not set # CONFIG_KEYS is not set # CONFIG_KMEMTRACE is not set @@ -1531,6 +1533,7 @@ CONFIG_PARTITION_ADVANCED=y # CONFIG_PATA_AMD is not set # CONFIG_PATA_ARTOP is not set # CONFIG_PATA_ATIIXP is not set +# CONFIG_PATA_ATP867X is not set # CONFIG_PATA_CMD640_PCI is not set # CONFIG_PATA_CMD64X is not set # CONFIG_PATA_CS5520 is not set @@ -1563,6 +1566,7 @@ CONFIG_PARTITION_ADVANCED=y # CONFIG_PATA_PLATFORM is not set # CONFIG_PATA_QDI is not set # CONFIG_PATA_RADISYS is not set +# CONFIG_PATA_RDC is not set # CONFIG_PATA_RZ1000 is not set # CONFIG_PATA_SC1200 is not set # CONFIG_PATA_SCH is not set @@ -1802,6 +1806,7 @@ CONFIG_SCHED_CFS=y # CONFIG_SCSI_AIC7XXX_OLD is not set # CONFIG_SCSI_AIC94XX is not set # CONFIG_SCSI_ARCMSR is not set +# CONFIG_SCSI_BFA_FC is not set # CONFIG_SCSI_BNX2_ISCSI is not set # CONFIG_SCSI_BUSLOGIC is not set # CONFIG_SCSI_CONSTANTS is not set @@ -1840,6 +1845,7 @@ CONFIG_SCSI_MULTI_LUN=y # CONFIG_SCSI_NSP32 is not set # CONFIG_SCSI_OSD_INITIATOR is not set # CONFIG_SCSI_PAS16 is not set +# CONFIG_SCSI_PMCRAID is not set CONFIG_SCSI_PROC_FS=y # CONFIG_SCSI_PSI240I is not set # CONFIG_SCSI_QLA_FC is not set @@ -2353,6 +2359,7 @@ CONFIG_USB_HIDINPUT=y # CONFIG_USB_ISIGHTFW is not set # CONFIG_USB is not set # CONFIG_USB_ISP116X_HCD is not set +# CONFIG_USB_ISP1362_HCD is not set # CONFIG_USB_ISP1760_HCD is not set # CONFIG_USB_KAWETH is not set # CONFIG_USB_KBD is not set @@ -2615,6 +2622,7 @@ CONFIG_VLAN_8021Q=y # CONFIG_VMSPLIT_2G is not set CONFIG_VMSPLIT_3G=y # CONFIG_VT6655 is not set +# CONFIG_VT6656 is not set # CONFIG_VT is not set # CONFIG_VXFS_FS is not set # CONFIG_W1 is not set diff --git a/target/linux/generic-2.6/patches-2.6.32/150-netfilter_imq.patch b/target/linux/generic-2.6/patches-2.6.32/150-netfilter_imq.patch index 35090871a..6467a2423 100644 --- a/target/linux/generic-2.6/patches-2.6.32/150-netfilter_imq.patch +++ b/target/linux/generic-2.6/patches-2.6.32/150-netfilter_imq.patch @@ -811,7 +811,7 @@ extern void kfree_skb(struct sk_buff *skb); extern void consume_skb(struct sk_buff *skb); extern void __kfree_skb(struct sk_buff *skb); -@@ -1970,6 +1988,10 @@ static inline void __nf_copy(struct sk_b +@@ -1972,6 +1990,10 @@ static inline void __nf_copy(struct sk_b dst->nfct_reasm = src->nfct_reasm; nf_conntrack_get_reasm(src->nfct_reasm); #endif diff --git a/target/linux/generic-2.6/patches-2.6.32/240-packet_socket_type.patch b/target/linux/generic-2.6/patches-2.6.32/240-packet_socket_type.patch index 42fcb9315..71827643e 100644 --- a/target/linux/generic-2.6/patches-2.6.32/240-packet_socket_type.patch +++ b/target/linux/generic-2.6/patches-2.6.32/240-packet_socket_type.patch @@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau if (dev_net(dev) != sock_net(sk)) goto drop; -@@ -1384,6 +1387,7 @@ static int packet_create(struct net *net +@@ -1381,6 +1384,7 @@ static int packet_create(struct net *net spin_lock_init(&po->bind_lock); mutex_init(&po->pg_vec_lock); po->prot_hook.func = packet_rcv; @@ -99,7 +99,7 @@ Signed-off-by: Felix Fietkau if (sock->type == SOCK_PACKET) po->prot_hook.func = packet_rcv_spkt; -@@ -1731,6 +1735,16 @@ packet_setsockopt(struct socket *sock, i +@@ -1728,6 +1732,16 @@ packet_setsockopt(struct socket *sock, i ret = packet_mc_drop(sk, &mreq); return ret; } @@ -116,7 +116,7 @@ Signed-off-by: Felix Fietkau #ifdef CONFIG_PACKET_MMAP case PACKET_RX_RING: -@@ -1876,6 +1890,13 @@ static int packet_getsockopt(struct sock +@@ -1873,6 +1887,13 @@ static int packet_getsockopt(struct sock data = &val; break; diff --git a/target/linux/generic-2.6/patches-2.6.32/410-gpio_buttons.patch b/target/linux/generic-2.6/patches-2.6.32/410-gpio_buttons.patch index 95987ce48..41f52afea 100644 --- a/target/linux/generic-2.6/patches-2.6.32/410-gpio_buttons.patch +++ b/target/linux/generic-2.6/patches-2.6.32/410-gpio_buttons.patch @@ -1,6 +1,6 @@ --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig -@@ -316,4 +316,20 @@ config INPUT_PCAP +@@ -317,4 +317,20 @@ config INPUT_PCAP To compile this driver as a module, choose M here: the module will be called pcap_keys. diff --git a/target/linux/generic-2.6/patches-2.6.32/840-unable_to_open_console.patch b/target/linux/generic-2.6/patches-2.6.32/840-unable_to_open_console.patch index 3925b7791..15b546112 100644 --- a/target/linux/generic-2.6/patches-2.6.32/840-unable_to_open_console.patch +++ b/target/linux/generic-2.6/patches-2.6.32/840-unable_to_open_console.patch @@ -1,7 +1,7 @@ --- a/init/main.c +++ b/init/main.c -@@ -819,7 +819,7 @@ static noinline int init_post(void) - printk(KERN_INFO"Running BFS CPU scheduler v0.302 by Con Kolivas.\n"); +@@ -817,7 +817,7 @@ static noinline int init_post(void) + numa_default_policy(); if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) - printk(KERN_WARNING "Warning: unable to open an initial console.\n"); diff --git a/target/linux/generic-2.6/patches-2.6.32/922-gpiommc.patch b/target/linux/generic-2.6/patches-2.6.32/922-gpiommc.patch index 4fdf7bbc6..e2547eda8 100644 --- a/target/linux/generic-2.6/patches-2.6.32/922-gpiommc.patch +++ b/target/linux/generic-2.6/patches-2.6.32/922-gpiommc.patch @@ -829,7 +829,7 @@ +be done automatically. --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -2354,6 +2354,11 @@ T: git git://git.kernel.org/pub/scm/linu +@@ -2348,6 +2348,11 @@ T: git git://git.kernel.org/pub/scm/linu S: Maintained F: drivers/media/video/gspca/ diff --git a/target/linux/generic-2.6/patches-2.6.32/977-textsearch_kconfig_hacks.patch b/target/linux/generic-2.6/patches-2.6.32/977-textsearch_kconfig_hacks.patch index 97fad7dfe..94d6b91d8 100644 --- a/target/linux/generic-2.6/patches-2.6.32/977-textsearch_kconfig_hacks.patch +++ b/target/linux/generic-2.6/patches-2.6.32/977-textsearch_kconfig_hacks.patch @@ -1,6 +1,6 @@ --- a/lib/Kconfig +++ b/lib/Kconfig -@@ -148,16 +148,16 @@ config REED_SOLOMON_DEC16 +@@ -152,16 +152,16 @@ config REED_SOLOMON_DEC16 # Textsearch support is select'ed if needed # config TEXTSEARCH diff --git a/target/linux/generic-2.6/patches-2.6.32/980-vm_exports.patch b/target/linux/generic-2.6/patches-2.6.32/980-vm_exports.patch index 4c3b56147..91f85c2b6 100644 --- a/target/linux/generic-2.6/patches-2.6.32/980-vm_exports.patch +++ b/target/linux/generic-2.6/patches-2.6.32/980-vm_exports.patch @@ -40,7 +40,7 @@ { --- a/kernel/exit.c +++ b/kernel/exit.c -@@ -510,6 +510,7 @@ struct files_struct *get_files_struct(st +@@ -507,6 +507,7 @@ struct files_struct *get_files_struct(st return files; } @@ -48,7 +48,7 @@ void put_files_struct(struct files_struct *files) { -@@ -529,6 +530,7 @@ void put_files_struct(struct files_struc +@@ -526,6 +527,7 @@ void put_files_struct(struct files_struc free_fdtable(fdt); } } @@ -68,7 +68,7 @@ * macro override instead of weak attribute alias, to workaround --- a/kernel/sched.c +++ b/kernel/sched.c -@@ -6046,6 +6046,7 @@ int can_nice(const struct task_struct *p +@@ -6075,6 +6075,7 @@ int can_nice(const struct task_struct *p return (nice_rlim <= p->signal->rlim[RLIMIT_NICE].rlim_cur || capable(CAP_SYS_NICE)); } @@ -78,7 +78,7 @@ --- a/mm/memory.c +++ b/mm/memory.c -@@ -1097,6 +1097,7 @@ unsigned long zap_page_range(struct vm_a +@@ -1100,6 +1100,7 @@ unsigned long zap_page_range(struct vm_a tlb_finish_mmu(tlb, address, end); return end; } @@ -86,7 +86,7 @@ /** * zap_vma_ptes - remove ptes mapping the vma -@@ -2483,6 +2484,7 @@ int vmtruncate_range(struct inode *inode +@@ -2486,6 +2487,7 @@ int vmtruncate_range(struct inode *inode return 0; } diff --git a/target/linux/generic-2.6/patches-2.6.32/998-openwrt_lzma_options.patch b/target/linux/generic-2.6/patches-2.6.32/998-openwrt_lzma_options.patch index f9108f271..08bb83a43 100644 --- a/target/linux/generic-2.6/patches-2.6.32/998-openwrt_lzma_options.patch +++ b/target/linux/generic-2.6/patches-2.6.32/998-openwrt_lzma_options.patch @@ -1,12 +1,14 @@ --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib -@@ -228,5 +228,5 @@ cmd_bzip2 = (cat $(filter-out FORCE,$^) +@@ -228,7 +228,7 @@ cmd_bzip2 = (cat $(filter-out FORCE,$^) quiet_cmd_lzma = LZMA $@ cmd_lzma = (cat $(filter-out FORCE,$^) | \ - lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ + lzma e -lc1 -lp2 -pb2 -eos -si -so && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ (rm -f $@ ; false) + + quiet_cmd_lzo = LZO $@ --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh @@ -225,7 +225,7 @@ cpio_list= diff --git a/target/linux/generic-2.6/patches-2.6.32/999-use_preinit_as_init.patch b/target/linux/generic-2.6/patches-2.6.32/999-use_preinit_as_init.patch index 8887afa78..7bea5256d 100644 --- a/target/linux/generic-2.6/patches-2.6.32/999-use_preinit_as_init.patch +++ b/target/linux/generic-2.6/patches-2.6.32/999-use_preinit_as_init.patch @@ -1,6 +1,6 @@ --- a/init/main.c +++ b/init/main.c -@@ -843,10 +843,7 @@ static noinline int init_post(void) +@@ -841,10 +841,7 @@ static noinline int init_post(void) printk(KERN_WARNING "Failed to execute %s. Attempting " "defaults...\n", execute_command); } diff --git a/target/linux/ixp4xx/patches-2.6.32/050-disable_dmabounce.patch b/target/linux/ixp4xx/patches-2.6.32/050-disable_dmabounce.patch index 9e1c02304..34de296b3 100644 --- a/target/linux/ixp4xx/patches-2.6.32/050-disable_dmabounce.patch +++ b/target/linux/ixp4xx/patches-2.6.32/050-disable_dmabounce.patch @@ -1,6 +1,6 @@ --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig -@@ -415,7 +415,6 @@ config ARCH_IXP4XX +@@ -418,7 +418,6 @@ config ARCH_IXP4XX select GENERIC_GPIO select GENERIC_TIME select GENERIC_CLOCKEVENTS diff --git a/target/linux/ixp4xx/patches-2.6.32/402-ixp4xx_gpiolib.patch b/target/linux/ixp4xx/patches-2.6.32/402-ixp4xx_gpiolib.patch index 631703432..b3f1336f5 100644 --- a/target/linux/ixp4xx/patches-2.6.32/402-ixp4xx_gpiolib.patch +++ b/target/linux/ixp4xx/patches-2.6.32/402-ixp4xx_gpiolib.patch @@ -50,7 +50,7 @@ --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig -@@ -415,6 +415,7 @@ config ARCH_IXP4XX +@@ -418,6 +418,7 @@ config ARCH_IXP4XX select GENERIC_GPIO select GENERIC_TIME select GENERIC_CLOCKEVENTS From e71fb302b174c22fe04eed5b63ef2657e58d7d63 Mon Sep 17 00:00:00 2001 From: kaloz Date: Tue, 17 Nov 2009 19:49:25 +0000 Subject: [PATCH 182/288] change x86 image generation handling to treat only olpc specially git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18441 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/x86/image/Config.in | 2 +- target/linux/x86/image/Makefile | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/target/linux/x86/image/Config.in b/target/linux/x86/image/Config.in index 9dd7ae587..8768e7cbe 100644 --- a/target/linux/x86/image/Config.in +++ b/target/linux/x86/image/Config.in @@ -1,6 +1,6 @@ config X86_GRUB_IMAGES bool "Build GRUB images (Linux x86 or x86_64 host only)" - depends TARGET_x86_generic + depends !TARGET_x86_olpc depends TARGET_ROOTFS_EXT2FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS || TARGET_ROOTFS_ISO select PACKAGE_grub default y diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile index 699dcfe6a..b412873c3 100644 --- a/target/linux/x86/image/Makefile +++ b/target/linux/x86/image/Makefile @@ -9,7 +9,7 @@ include $(INCLUDE_DIR)/image.mk export PATH=$(TARGET_PATH):/sbin -ifeq ($(CONFIG_TARGET_x86_generic),y) +ifneq ($(CONFIG_TARGET_x86_olpc),y) BOOTOPTS=$(strip $(subst ",, $(CONFIG_X86_GRUB_BOOTOPTS))) ROOTPART=$(strip $(subst ",, $(CONFIG_X86_GRUB_ROOTPART))) #"))")) # fix vim's broken syntax highlighting @@ -120,14 +120,13 @@ endif define Image/Prepare $(CP) $(LINUX_DIR)/arch/x86/boot/bzImage $(KDIR)/bzImage -ifeq ($(CONFIG_TARGET_x86_generic),y) - $(call Image/Prepare/grub) -endif ifeq ($(CONFIG_TARGET_x86_olpc),y) $(call Image/Prepare/bootscript) +else + $(call Image/Prepare/grub) endif endef - + define Image/Build/squashfs $(call prepare_generic_squashfs,$(KDIR)/root.squashfs) endef From 71b834c5a542c92bbd85c139cdc39c1820e02ad5 Mon Sep 17 00:00:00 2001 From: nico Date: Tue, 17 Nov 2009 21:29:27 +0000 Subject: [PATCH 183/288] change ext2/ext3 load order so that lazy mount tries ext3 before ext2 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18442 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/kernel/modules/fs.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kernel/modules/fs.mk b/package/kernel/modules/fs.mk index 425a78219..3755f0f66 100644 --- a/package/kernel/modules/fs.mk +++ b/package/kernel/modules/fs.mk @@ -82,7 +82,7 @@ define KernelPackage/fs-ext2 KCONFIG:=CONFIG_EXT2_FS DEPENDS:=$(if $(DUMP)$(CONFIG_FS_MBCACHE),+kmod-fs-mbcache) FILES:=$(LINUX_DIR)/fs/ext2/ext2.$(LINUX_KMOD_SUFFIX) - AUTOLOAD:=$(call AutoLoad,30,ext2) + AUTOLOAD:=$(call AutoLoad,32,ext2) endef define KernelPackage/fs-ext2/description @@ -102,7 +102,7 @@ define KernelPackage/fs-ext3 FILES:= \ $(LINUX_DIR)/fs/ext3/ext3.$(LINUX_KMOD_SUFFIX) \ $(LINUX_DIR)/fs/jbd/jbd.$(LINUX_KMOD_SUFFIX) - AUTOLOAD:=$(call AutoLoad,30,jbd ext3) + AUTOLOAD:=$(call AutoLoad,31,jbd ext3) endef define KernelPackage/fs-ext3/description From 569415276b6a2b711eaadd44e90148c6ae0791a5 Mon Sep 17 00:00:00 2001 From: nico Date: Tue, 17 Nov 2009 21:53:50 +0000 Subject: [PATCH 184/288] atheros: add fstype to combined image file name git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18443 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/atheros/image/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/atheros/image/Makefile b/target/linux/atheros/image/Makefile index 15cd99586..fb9afae5c 100644 --- a/target/linux/atheros/image/Makefile +++ b/target/linux/atheros/image/Makefile @@ -55,7 +55,7 @@ define Image/Build -sh $(TOPDIR)/scripts/combined-image.sh \ "$(BIN_DIR)/openwrt-$(BOARD)-vmlinux.lzma" \ "$(BIN_DIR)/openwrt-$(BOARD)-root.$(1)" \ - "$(BIN_DIR)/openwrt-$(BOARD)-combined.img" + "$(BIN_DIR)/openwrt-$(BOARD)-combined.$(1).img" endif endef From 7ea6da151ad75bb7d7733690b6271893a6de30d5 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 18 Nov 2009 03:48:55 +0000 Subject: [PATCH 185/288] ath9k: split up and adjust rc cleanup patch according to upstream feedback, also fix tx status reporting for minstrel compatibility git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18444 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches/560-ath9k_rate_control_api.patch | 578 ++---------------- .../patches/561-ath9k_rc_table_cleanup.patch | 477 +++++++++++++++ 2 files changed, 539 insertions(+), 516 deletions(-) create mode 100644 package/mac80211/patches/561-ath9k_rc_table_cleanup.patch diff --git a/package/mac80211/patches/560-ath9k_rate_control_api.patch b/package/mac80211/patches/560-ath9k_rate_control_api.patch index 13ada5da0..5769d305a 100644 --- a/package/mac80211/patches/560-ath9k_rate_control_api.patch +++ b/package/mac80211/patches/560-ath9k_rate_control_api.patch @@ -1,473 +1,38 @@ --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c -@@ -19,133 +19,92 @@ +@@ -19,6 +19,7 @@ static const struct ath_rate_table ar5416_11na_ratetable = { 42, + 8, /* MCS start */ { { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ -- 5400, 0x0b, 0x00, 12, -- 0, 0, 0, 0, 0, 0 }, -+ 5400, 0, 12, 0, 0, 0, 0, 0 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ -- 7800, 0x0f, 0x00, 18, -- 0, 1, 1, 1, 1, 0 }, -+ 7800, 1, 18, 0, 1, 1, 1, 1 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ -- 10000, 0x0a, 0x00, 24, -- 2, 2, 2, 2, 2, 0 }, -+ 10000, 2, 24, 2, 2, 2, 2, 2 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ -- 13900, 0x0e, 0x00, 36, -- 2, 3, 3, 3, 3, 0 }, -+ 13900, 3, 36, 2, 3, 3, 3, 3 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ -- 17300, 0x09, 0x00, 48, -- 4, 4, 4, 4, 4, 0 }, -+ 17300, 4, 48, 4, 4, 4, 4, 4 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ -- 23000, 0x0d, 0x00, 72, -- 4, 5, 5, 5, 5, 0 }, -+ 23000, 5, 72, 4, 5, 5, 5, 5 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ -- 27400, 0x08, 0x00, 96, -- 4, 6, 6, 6, 6, 0 }, -+ 27400, 6, 96, 4, 6, 6, 6, 6 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ -- 29300, 0x0c, 0x00, 108, -- 4, 7, 7, 7, 7, 0 }, -+ 29300, 7, 108, 4, 7, 7, 7, 7 }, - { VALID_2040, VALID_2040, WLAN_RC_PHY_HT_20_SS, 6500, /* 6.5 Mb */ -- 6400, 0x80, 0x00, 0, -- 0, 8, 24, 8, 24, 3216 }, -+ 6400, 0, 0, 0, 8, 24, 8, 24 }, - { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 13000, /* 13 Mb */ -- 12700, 0x81, 0x00, 1, -- 2, 9, 25, 9, 25, 6434 }, -+ 12700, 1, 1, 2, 9, 25, 9, 25 }, - { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 19500, /* 19.5 Mb */ -- 18800, 0x82, 0x00, 2, -- 2, 10, 26, 10, 26, 9650 }, -+ 18800, 2, 2, 2, 10, 26, 10, 26 }, - { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 26000, /* 26 Mb */ -- 25000, 0x83, 0x00, 3, -- 4, 11, 27, 11, 27, 12868 }, -+ 25000, 3, 3, 4, 11, 27, 11, 27 }, - { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 39000, /* 39 Mb */ -- 36700, 0x84, 0x00, 4, -- 4, 12, 28, 12, 28, 19304 }, -+ 36700, 4, 4, 4, 12, 28, 12, 28 }, - { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 52000, /* 52 Mb */ -- 48100, 0x85, 0x00, 5, -- 4, 13, 29, 13, 29, 25740 }, -+ 48100, 5, 5, 4, 13, 29, 13, 29 }, - { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 58500, /* 58.5 Mb */ -- 53500, 0x86, 0x00, 6, -- 4, 14, 30, 14, 30, 28956 }, -+ 53500, 6, 6, 4, 14, 30, 14, 30 }, - { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 65000, /* 65 Mb */ -- 59000, 0x87, 0x00, 7, -- 4, 15, 31, 15, 32, 32180 }, -+ 59000, 7, 7, 4, 15, 31, 15, 32 }, - { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 13000, /* 13 Mb */ -- 12700, 0x88, 0x00, -- 8, 3, 16, 33, 16, 33, 6430 }, -+ 12700, 8, 8, 3, 16, 33, 16, 33 }, - { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 26000, /* 26 Mb */ -- 24800, 0x89, 0x00, 9, -- 2, 17, 34, 17, 34, 12860 }, -+ 24800, 9, 9, 2, 17, 34, 17, 34 }, - { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 39000, /* 39 Mb */ -- 36600, 0x8a, 0x00, 10, -- 2, 18, 35, 18, 35, 19300 }, -+ 36600, 10, 10, 2, 18, 35, 18, 35 }, - { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 52000, /* 52 Mb */ -- 48100, 0x8b, 0x00, 11, -- 4, 19, 36, 19, 36, 25736 }, -+ 48100, 11, 11, 4, 19, 36, 19, 36 }, - { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 78000, /* 78 Mb */ -- 69500, 0x8c, 0x00, 12, -- 4, 20, 37, 20, 37, 38600 }, -+ 69500, 12, 12, 4, 20, 37, 20, 37 }, - { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 104000, /* 104 Mb */ -- 89500, 0x8d, 0x00, 13, -- 4, 21, 38, 21, 38, 51472 }, -+ 89500, 13, 13, 4, 21, 38, 21, 38 }, - { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 117000, /* 117 Mb */ -- 98900, 0x8e, 0x00, 14, -- 4, 22, 39, 22, 39, 57890 }, -+ 98900, 14, 14, 4, 22, 39, 22, 39 }, - { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 130000, /* 130 Mb */ -- 108300, 0x8f, 0x00, 15, -- 4, 23, 40, 23, 41, 64320 }, -+ 108300, 15, 15, 4, 23, 40, 23, 41 }, - { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 13500, /* 13.5 Mb */ -- 13200, 0x80, 0x00, 0, -- 0, 8, 24, 24, 24, 6684 }, -+ 13200, 0, 0, 0, 8, 24, 24, 24 }, - { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 27500, /* 27.0 Mb */ -- 25900, 0x81, 0x00, 1, -- 2, 9, 25, 25, 25, 13368 }, -+ 25900, 1, 1, 2, 9, 25, 25, 25 }, - { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 40500, /* 40.5 Mb */ -- 38600, 0x82, 0x00, 2, -- 2, 10, 26, 26, 26, 20052 }, -+ 38600, 2, 2, 2, 10, 26, 26, 26 }, - { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 54000, /* 54 Mb */ -- 49800, 0x83, 0x00, 3, -- 4, 11, 27, 27, 27, 26738 }, -+ 49800, 3, 3, 4, 11, 27, 27, 27 }, - { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 81500, /* 81 Mb */ -- 72200, 0x84, 0x00, 4, -- 4, 12, 28, 28, 28, 40104 }, -+ 72200, 4, 4, 4, 12, 28, 28, 28 }, - { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 108000, /* 108 Mb */ -- 92900, 0x85, 0x00, 5, -- 4, 13, 29, 29, 29, 53476 }, -+ 92900, 5, 5, 4, 13, 29, 29, 29 }, - { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 121500, /* 121.5 Mb */ -- 102700, 0x86, 0x00, 6, -- 4, 14, 30, 30, 30, 60156 }, -+ 102700, 6, 6, 4, 14, 30, 30, 30 }, - { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 135000, /* 135 Mb */ -- 112000, 0x87, 0x00, 7, -- 4, 15, 31, 32, 32, 66840 }, -+ 112000, 7, 7, 4, 15, 31, 32, 32 }, - { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, /* 150 Mb */ -- 122000, 0x87, 0x00, 7, -- 4, 15, 31, 32, 32, 74200 }, -+ 122000, 7, 7, 4, 15, 31, 32, 32 }, - { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 27000, /* 27 Mb */ -- 25800, 0x88, 0x00, 8, -- 0, 16, 33, 33, 33, 13360 }, -+ 25800, 8, 8, 0, 16, 33, 33, 33 }, - { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 54000, /* 54 Mb */ -- 49800, 0x89, 0x00, 9, -- 2, 17, 34, 34, 34, 26720 }, -+ 49800, 9, 9, 2, 17, 34, 34, 34 }, - { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 81000, /* 81 Mb */ -- 71900, 0x8a, 0x00, 10, -- 2, 18, 35, 35, 35, 40080 }, -+ 71900, 10, 10, 2, 18, 35, 35, 35 }, - { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 108000, /* 108 Mb */ -- 92500, 0x8b, 0x00, 11, -- 4, 19, 36, 36, 36, 53440 }, -+ 92500, 11, 11, 4, 19, 36, 36, 36 }, - { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 162000, /* 162 Mb */ -- 130300, 0x8c, 0x00, 12, -- 4, 20, 37, 37, 37, 80160 }, -+ 130300, 12, 12, 4, 20, 37, 37, 37 }, - { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 216000, /* 216 Mb */ -- 162800, 0x8d, 0x00, 13, -- 4, 21, 38, 38, 38, 106880 }, -+ 162800, 13, 13, 4, 21, 38, 38, 38 }, - { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 243000, /* 243 Mb */ -- 178200, 0x8e, 0x00, 14, -- 4, 22, 39, 39, 39, 120240 }, -+ 178200, 14, 14, 4, 22, 39, 39, 39 }, - { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 270000, /* 270 Mb */ -- 192100, 0x8f, 0x00, 15, -- 4, 23, 40, 41, 41, 133600 }, -+ 192100, 15, 15, 4, 23, 40, 41, 41 }, - { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS_HGI, 300000, /* 300 Mb */ -- 207000, 0x8f, 0x00, 15, -- 4, 23, 40, 41, 41, 148400 }, -+ 207000, 15, 15, 4, 23, 40, 41, 41 }, - }, - 50, /* probe interval */ - WLAN_RC_HT_FLAG, /* Phy rates allowed initially */ -@@ -156,177 +115,125 @@ static const struct ath_rate_table ar541 + 5400, 0x0b, 0x00, 12, +@@ -156,6 +157,7 @@ static const struct ath_rate_table ar541 static const struct ath_rate_table ar5416_11ng_ratetable = { 46, + 12, /* MCS start */ { { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ -- 900, 0x1b, 0x00, 2, -- 0, 0, 0, 0, 0, 0 }, -+ 900, 0, 2, 0, 0, 0, 0, 0 }, - { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */ -- 1900, 0x1a, 0x04, 4, -- 1, 1, 1, 1, 1, 0 }, -+ 1900, 1, 4, 1, 1, 1, 1, 1 }, - { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */ -- 4900, 0x19, 0x04, 11, -- 2, 2, 2, 2, 2, 0 }, -+ 4900, 2, 11, 2, 2, 2, 2, 2 }, - { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */ -- 8100, 0x18, 0x04, 22, -- 3, 3, 3, 3, 3, 0 }, -+ 8100, 3, 22, 3, 3, 3, 3, 3 }, - { INVALID, INVALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ -- 5400, 0x0b, 0x00, 12, -- 4, 4, 4, 4, 4, 0 }, -+ 5400, 4, 12, 4, 4, 4, 4, 4 }, - { INVALID, INVALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ -- 7800, 0x0f, 0x00, 18, -- 4, 5, 5, 5, 5, 0 }, -+ 7800, 5, 18, 4, 5, 5, 5, 5 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ -- 10100, 0x0a, 0x00, 24, -- 6, 6, 6, 6, 6, 0 }, -+ 10100, 6, 24, 6, 6, 6, 6, 6 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ -- 14100, 0x0e, 0x00, 36, -- 6, 7, 7, 7, 7, 0 }, -+ 14100, 7, 36, 6, 7, 7, 7, 7 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ -- 17700, 0x09, 0x00, 48, -- 8, 8, 8, 8, 8, 0 }, -+ 17700, 8, 48, 8, 8, 8, 8, 8 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ -- 23700, 0x0d, 0x00, 72, -- 8, 9, 9, 9, 9, 0 }, -+ 23700, 9, 72, 8, 9, 9, 9, 9 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ -- 27400, 0x08, 0x00, 96, -- 8, 10, 10, 10, 10, 0 }, -+ 27400, 10, 96, 8, 10, 10, 10, 10 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ -- 30900, 0x0c, 0x00, 108, -- 8, 11, 11, 11, 11, 0 }, -+ 30900, 11, 108, 8, 11, 11, 11, 11 }, - { INVALID, INVALID, WLAN_RC_PHY_HT_20_SS, 6500, /* 6.5 Mb */ -- 6400, 0x80, 0x00, 0, -- 4, 12, 28, 12, 28, 3216 }, -+ 6400, 0, 0, 4, 12, 28, 12, 28 }, - { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 13000, /* 13 Mb */ -- 12700, 0x81, 0x00, 1, -- 6, 13, 29, 13, 29, 6434 }, -+ 12700, 1, 1, 6, 13, 29, 13, 29 }, - { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 19500, /* 19.5 Mb */ -- 18800, 0x82, 0x00, 2, -- 6, 14, 30, 14, 30, 9650 }, -+ 18800, 2, 2, 6, 14, 30, 14, 30 }, - { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 26000, /* 26 Mb */ -- 25000, 0x83, 0x00, 3, -- 8, 15, 31, 15, 31, 12868 }, -+ 25000, 3, 3, 8, 15, 31, 15, 31 }, - { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 39000, /* 39 Mb */ -- 36700, 0x84, 0x00, 4, -- 8, 16, 32, 16, 32, 19304 }, -+ 36700, 4, 4, 8, 16, 32, 16, 32 }, - { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 52000, /* 52 Mb */ -- 48100, 0x85, 0x00, 5, -- 8, 17, 33, 17, 33, 25740 }, -+ 48100, 5, 5, 8, 17, 33, 17, 33 }, - { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 58500, /* 58.5 Mb */ -- 53500, 0x86, 0x00, 6, -- 8, 18, 34, 18, 34, 28956 }, -+ 53500, 6, 6, 8, 18, 34, 18, 34 }, - { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 65000, /* 65 Mb */ -- 59000, 0x87, 0x00, 7, -- 8, 19, 35, 19, 36, 32180 }, -+ 59000, 7, 7, 8, 19, 35, 19, 36 }, - { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 13000, /* 13 Mb */ -- 12700, 0x88, 0x00, 8, -- 4, 20, 37, 20, 37, 6430 }, -+ 12700, 8, 8, 4, 20, 37, 20, 37 }, - { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 26000, /* 26 Mb */ -- 24800, 0x89, 0x00, 9, -- 6, 21, 38, 21, 38, 12860 }, -+ 24800, 9, 9, 6, 21, 38, 21, 38 }, - { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 39000, /* 39 Mb */ -- 36600, 0x8a, 0x00, 10, -- 6, 22, 39, 22, 39, 19300 }, -+ 36600, 10, 10, 6, 22, 39, 22, 39 }, - { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 52000, /* 52 Mb */ -- 48100, 0x8b, 0x00, 11, -- 8, 23, 40, 23, 40, 25736 }, -+ 48100, 11, 11, 8, 23, 40, 23, 40 }, - { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 78000, /* 78 Mb */ -- 69500, 0x8c, 0x00, 12, -- 8, 24, 41, 24, 41, 38600 }, -+ 69500, 12, 12, 8, 24, 41, 24, 41 }, - { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 104000, /* 104 Mb */ -- 89500, 0x8d, 0x00, 13, -- 8, 25, 42, 25, 42, 51472 }, -+ 89500, 13, 13, 8, 25, 42, 25, 42 }, - { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 117000, /* 117 Mb */ -- 98900, 0x8e, 0x00, 14, -- 8, 26, 43, 26, 44, 57890 }, -+ 98900, 14, 14, 8, 26, 43, 26, 44 }, - { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 130000, /* 130 Mb */ -- 108300, 0x8f, 0x00, 15, -- 8, 27, 44, 27, 45, 64320 }, -+ 108300, 15, 15, 8, 27, 44, 27, 45 }, - { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 13500, /* 13.5 Mb */ -- 13200, 0x80, 0x00, 0, -- 8, 12, 28, 28, 28, 6684 }, -+ 13200, 0, 0, 8, 12, 28, 28, 28 }, - { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 27500, /* 27.0 Mb */ -- 25900, 0x81, 0x00, 1, -- 8, 13, 29, 29, 29, 13368 }, -+ 25900, 1, 1, 8, 13, 29, 29, 29 }, - { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 40500, /* 40.5 Mb */ -- 38600, 0x82, 0x00, 2, -- 8, 14, 30, 30, 30, 20052 }, -+ 38600, 2, 2, 8, 14, 30, 30, 30 }, - { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 54000, /* 54 Mb */ -- 49800, 0x83, 0x00, 3, -- 8, 15, 31, 31, 31, 26738 }, -+ 49800, 3, 3, 8, 15, 31, 31, 31 }, - { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 81500, /* 81 Mb */ -- 72200, 0x84, 0x00, 4, -- 8, 16, 32, 32, 32, 40104 }, -+ 72200, 4, 4, 8, 16, 32, 32, 32 }, - { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 108000, /* 108 Mb */ -- 92900, 0x85, 0x00, 5, -- 8, 17, 33, 33, 33, 53476 }, -+ 92900, 5, 5, 8, 17, 33, 33, 33 }, - { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 121500, /* 121.5 Mb */ -- 102700, 0x86, 0x00, 6, -- 8, 18, 34, 34, 34, 60156 }, -+ 102700, 6, 6, 8, 18, 34, 34, 34 }, - { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 135000, /* 135 Mb */ -- 112000, 0x87, 0x00, 7, -- 8, 19, 35, 36, 36, 66840 }, -+ 112000, 7, 7, 8, 19, 35, 36, 36 }, - { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, /* 150 Mb */ -- 122000, 0x87, 0x00, 7, -- 8, 19, 35, 36, 36, 74200 }, -+ 122000, 7, 7, 8, 19, 35, 36, 36 }, - { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 27000, /* 27 Mb */ -- 25800, 0x88, 0x00, 8, -- 8, 20, 37, 37, 37, 13360 }, -+ 25800, 8, 8, 8, 20, 37, 37, 37 }, - { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 54000, /* 54 Mb */ -- 49800, 0x89, 0x00, 9, -- 8, 21, 38, 38, 38, 26720 }, -+ 49800, 9, 9, 8, 21, 38, 38, 38 }, - { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 81000, /* 81 Mb */ -- 71900, 0x8a, 0x00, 10, -- 8, 22, 39, 39, 39, 40080 }, -+ 71900, 10, 10, 8, 22, 39, 39, 39 }, - { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 108000, /* 108 Mb */ -- 92500, 0x8b, 0x00, 11, -- 8, 23, 40, 40, 40, 53440 }, -+ 92500, 11, 11, 8, 23, 40, 40, 40 }, - { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 162000, /* 162 Mb */ -- 130300, 0x8c, 0x00, 12, -- 8, 24, 41, 41, 41, 80160 }, -+ 130300, 12, 12, 8, 24, 41, 41, 41 }, - { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 216000, /* 216 Mb */ -- 162800, 0x8d, 0x00, 13, -- 8, 25, 42, 42, 42, 106880 }, -+ 162800, 13, 13, 8, 25, 42, 42, 42 }, - { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 243000, /* 243 Mb */ -- 178200, 0x8e, 0x00, 14, -- 8, 26, 43, 43, 43, 120240 }, -+ 178200, 14, 14, 8, 26, 43, 43, 43 }, - { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 270000, /* 270 Mb */ -- 192100, 0x8f, 0x00, 15, -- 8, 27, 44, 45, 45, 133600 }, -+ 192100, 15, 15, 8, 27, 44, 45, 45 }, - { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS_HGI, 300000, /* 300 Mb */ -- 207000, 0x8f, 0x00, 15, -- 8, 27, 44, 45, 45, 148400 }, -- }, -+ 207000, 15, 15, 8, 27, 44, 45, 45 }, -+ }, - 50, /* probe interval */ - WLAN_RC_HT_FLAG, /* Phy rates allowed initially */ - }; + 900, 0x1b, 0x00, 2, +@@ -302,6 +304,7 @@ static const struct ath_rate_table ar541 static const struct ath_rate_table ar5416_11a_ratetable = { 8, + 0, { { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ -- 5400, 0x0b, 0x00, (0x80|12), -- 0, 0, 0 }, -+ 5400, 0, 12, 0, 0, 0 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ -- 7800, 0x0f, 0x00, 18, -- 0, 1, 0 }, -+ 7800, 1, 18, 0, 1, 0 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ -- 10000, 0x0a, 0x00, (0x80|24), -- 2, 2, 0 }, -+ 10000, 2, 24, 2, 2, 0 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ -- 13900, 0x0e, 0x00, 36, -- 2, 3, 0 }, -+ 13900, 3, 36, 2, 3, 0 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ -- 17300, 0x09, 0x00, (0x80|48), -- 4, 4, 0 }, -+ 17300, 4, 48, 4, 4, 0 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ -- 23000, 0x0d, 0x00, 72, -- 4, 5, 0 }, -+ 23000, 5, 72, 4, 5, 0 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ -- 27400, 0x08, 0x00, 96, -- 4, 6, 0 }, -+ 27400, 6, 96, 4, 6, 0 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ -- 29300, 0x0c, 0x00, 108, -- 4, 7, 0 }, -+ 29300, 7, 108, 4, 7, 0 }, - }, - 50, /* probe interval */ - 0, /* Phy rates allowed initially */ -@@ -334,48 +241,51 @@ static const struct ath_rate_table ar541 + 5400, 0x0b, 0x00, (0x80|12), +@@ -334,6 +337,7 @@ static const struct ath_rate_table ar541 static const struct ath_rate_table ar5416_11g_ratetable = { 12, + 0, { { VALID, VALID, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ -- 900, 0x1b, 0x00, 2, -- 0, 0, 0 }, -+ 900, 0, 2, 0, 0, 0 }, - { VALID, VALID, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */ -- 1900, 0x1a, 0x04, 4, -- 1, 1, 0 }, -+ 1900, 1, 4, 1, 1, 0 }, - { VALID, VALID, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */ -- 4900, 0x19, 0x04, 11, -- 2, 2, 0 }, -+ 4900, 2, 11, 2, 2, 0 }, - { VALID, VALID, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */ -- 8100, 0x18, 0x04, 22, -- 3, 3, 0 }, -+ 8100, 3, 22, 3, 3, 0 }, - { INVALID, INVALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ -- 5400, 0x0b, 0x00, 12, -- 4, 4, 0 }, -+ 5400, 4, 12, 4, 4, 0 }, - { INVALID, INVALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ -- 7800, 0x0f, 0x00, 18, -- 4, 5, 0 }, -+ 7800, 5, 18, 4, 5, 0 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ -- 10000, 0x0a, 0x00, 24, -- 6, 6, 0 }, -+ 10000, 6, 24, 6, 6, 0 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ -- 13900, 0x0e, 0x00, 36, -- 6, 7, 0 }, -+ 13900, 7, 36, 6, 7, 0 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ -- 17300, 0x09, 0x00, 48, -- 8, 8, 0 }, -+ 17300, 8, 48, 8, 8, 0 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ -- 23000, 0x0d, 0x00, 72, -- 8, 9, 0 }, -+ 23000, 9, 72, 8, 9, 0 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ -- 27400, 0x08, 0x00, 96, -- 8, 10, 0 }, -+ 27400, 10, 96, 8, 10, 0 }, - { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ -- 29300, 0x0c, 0x00, 108, -- 8, 11, 0 }, -+ 29300, 11, 108, 8, 11, 0 }, - }, - 50, /* probe interval */ + 900, 0x1b, 0x00, 2, +@@ -376,6 +380,20 @@ static const struct ath_rate_table ar541 0, /* Phy rates allowed initially */ }; @@ -488,7 +53,7 @@ static inline int8_t median(int8_t a, int8_t b, int8_t c) { if (a >= b) { -@@ -534,7 +444,7 @@ static u8 ath_rc_setvalid_rates(struct a +@@ -534,7 +552,7 @@ static u8 ath_rc_setvalid_rates(struct a * capflag matches one of the validity * (VALID/VALID_20/VALID_40) flags */ @@ -497,7 +62,7 @@ ((valid & WLAN_RC_CAP_MODE(capflag)) == WLAN_RC_CAP_MODE(capflag)) && !WLAN_RC_PHY_HT(phy)) { -@@ -576,8 +486,7 @@ static u8 ath_rc_setvalid_htrates(struct +@@ -576,8 +594,7 @@ static u8 ath_rc_setvalid_htrates(struct u8 rate = rateset->rs_rates[i]; u8 dot11rate = rate_table->info[j].dot11rate; @@ -507,7 +72,7 @@ !WLAN_RC_PHY_HT_VALID(valid, capflag)) continue; -@@ -696,18 +605,20 @@ static void ath_rc_rate_set_series(const +@@ -696,18 +713,20 @@ static void ath_rc_rate_set_series(const u8 tries, u8 rix, int rtsctsenable) { rate->count = tries; @@ -534,7 +99,7 @@ } static void ath_rc_rate_set_rtscts(struct ath_softc *sc, -@@ -720,7 +631,7 @@ static void ath_rc_rate_set_rtscts(struc +@@ -720,7 +739,7 @@ static void ath_rc_rate_set_rtscts(struc /* get the cix for the lowest valid rix */ for (i = 3; i >= 0; i--) { if (rates[i].count && (rates[i].idx >= 0)) { @@ -543,7 +108,7 @@ break; } } -@@ -1080,15 +991,19 @@ static int ath_rc_get_rateindex(const st +@@ -1080,15 +1099,19 @@ static int ath_rc_get_rateindex(const st { int rix; @@ -567,7 +132,7 @@ return rix; } -@@ -1183,7 +1098,9 @@ struct ath_rate_table *ath_choose_rate_t +@@ -1183,7 +1206,9 @@ struct ath_rate_table *ath_choose_rate_t ath_print(common, ATH_DBG_CONFIG, "Choosing rate table for mode: %d\n", mode); @@ -578,7 +143,7 @@ } static void ath_rc_init(struct ath_softc *sc, -@@ -1197,12 +1114,6 @@ static void ath_rc_init(struct ath_softc +@@ -1197,12 +1222,6 @@ static void ath_rc_init(struct ath_softc u8 *ht_mcs = (u8 *)&ath_rc_priv->neg_ht_rates; u8 i, j, k, hi = 0, hthi = 0; @@ -591,7 +156,7 @@ /* Initial rate table size. Will change depending * on the working rate set */ ath_rc_priv->rate_table_size = RATE_TABLE_SIZE; -@@ -1357,7 +1268,8 @@ static void ath_tx_status(void *priv, st +@@ -1357,7 +1376,8 @@ static void ath_tx_status(void *priv, st } } @@ -601,7 +166,7 @@ } static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband, -@@ -1365,7 +1277,7 @@ static void ath_rate_init(void *priv, st +@@ -1365,7 +1385,7 @@ static void ath_rate_init(void *priv, st { struct ath_softc *sc = priv; struct ath_rate_priv *ath_rc_priv = priv_sta; @@ -610,7 +175,7 @@ bool is_cw40, is_sgi40; int i, j = 0; -@@ -1397,11 +1309,9 @@ static void ath_rate_init(void *priv, st +@@ -1397,11 +1417,9 @@ static void ath_rate_init(void *priv, st (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT) || (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC)) { rate_table = ath_choose_rate_table(sc, sband->band, @@ -625,7 +190,7 @@ } ath_rc_priv->ht_cap = ath_rc_build_ht_caps(sc, sta, is_cw40, is_sgi40); -@@ -1445,6 +1355,7 @@ static void ath_rate_update(void *priv, +@@ -1445,6 +1463,7 @@ static void ath_rate_update(void *priv, ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_CONFIG, "Operating HT Bandwidth changed to: %d\n", sc->hw->conf.channel_type); @@ -633,7 +198,7 @@ } } } -@@ -1497,26 +1408,6 @@ static struct rate_control_ops ath_rate_ +@@ -1497,26 +1516,6 @@ static struct rate_control_ops ath_rate_ .free_sta = ath_rate_free_sta, }; @@ -879,6 +444,18 @@ } /* set dur_update_en for l-sig computation except for PS-Poll frames */ +@@ -1925,8 +1967,10 @@ static void ath_tx_rc_status(struct ath_ + } + } + +- for (i = tx_rateindex + 1; i < hw->max_rates; i++) ++ for (i = tx_rateindex + 1; i < hw->max_rates; i++) { + tx_info->status.rates[i].count = 0; ++ tx_info->status.rates[i].idx = -1; ++ } + + tx_info->status.rates[tx_rateindex].count = bf->bf_retries + 1; + } --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h @@ -21,7 +21,6 @@ @@ -910,50 +487,34 @@ struct ath_led radio_led; --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -105,37 +105,71 @@ static struct ieee80211_channel ath9k_5g +@@ -105,37 +105,55 @@ static struct ieee80211_channel ath9k_5g CHAN5G(5825, 37), /* Channel 165 */ }; ++/* Atheros hardware rate code addition for short premble */ ++#define SHPCHECK(__hw_rate, __flags) \ ++ ((__flags & IEEE80211_RATE_SHORT_PREAMBLE) ? (__hw_rate | 0x04 ) : 0) ++ ++#define RATE(_bitrate, _hw_rate, _flags) { \ ++ .bitrate = (_bitrate), \ ++ .flags = (_flags), \ ++ .hw_value = (_hw_rate), \ ++ .hw_value_short = (SHPCHECK(_hw_rate, _flags)) \ ++} ++ +static struct ieee80211_rate ath9k_legacy_rates[] = { -+ { .bitrate = 10, -+ .hw_value = 0x1b, -+ .flags = 0 }, -+ { .bitrate = 20, -+ .hw_value = 0x1a, -+ .hw_value_short = 0x1a | 0x04, -+ .flags = IEEE80211_RATE_SHORT_PREAMBLE }, -+ { .bitrate = 55, -+ .hw_value = 0x19, -+ .hw_value_short = 0x19 | 0x04, -+ .flags = IEEE80211_RATE_SHORT_PREAMBLE }, -+ { .bitrate = 110, -+ .hw_value = 0x18, -+ .hw_value_short = 0x18 | 0x4, -+ .flags = IEEE80211_RATE_SHORT_PREAMBLE }, -+ { .bitrate = 60, -+ .hw_value = 0x0b, -+ .flags = 0 }, -+ { .bitrate = 90, -+ .hw_value = 0x0f, -+ .flags = 0 }, -+ { .bitrate = 120, -+ .hw_value = 0x0a, -+ .flags = 0 }, -+ { .bitrate = 180, -+ .hw_value = 0x0e, -+ .flags = 0 }, -+ { .bitrate = 240, -+ .hw_value = 0x09, -+ .flags = 0 }, -+ { .bitrate = 360, -+ .hw_value = 0x0d, -+ .flags = 0 }, -+ { .bitrate = 480, -+ .hw_value = 0x08, -+ .flags = 0 }, -+ { .bitrate = 540, -+ .hw_value = 0x0c, -+ .flags = 0 }, ++ RATE(10, 0x1b, 0), ++ RATE(20, 0x1a, IEEE80211_RATE_SHORT_PREAMBLE), ++ RATE(55, 0x19, IEEE80211_RATE_SHORT_PREAMBLE), ++ RATE(110, 0x18, IEEE80211_RATE_SHORT_PREAMBLE), ++ RATE(60, 0x0b, 0), ++ RATE(90, 0x0f, 0), ++ RATE(120, 0x0a, 0), ++ RATE(180, 0x0e, 0), ++ RATE(240, 0x09, 0), ++ RATE(360, 0x0d, 0), ++ RATE(480, 0x08, 0), ++ RATE(540, 0x0c, 0), +}; + static void ath_cache_conf_rate(struct ath_softc *sc, @@ -998,7 +559,7 @@ break; default: BUG_ON(1); -@@ -191,51 +225,6 @@ static u8 parse_mpdudensity(u8 mpdudensi +@@ -191,51 +209,6 @@ static u8 parse_mpdudensity(u8 mpdudensi } } @@ -1050,7 +611,7 @@ static struct ath9k_channel *ath_get_curchannel(struct ath_softc *sc, struct ieee80211_hw *hw) { -@@ -1713,12 +1702,6 @@ static int ath_init_softc(u16 devid, str +@@ -1713,12 +1686,6 @@ static int ath_init_softc(u16 devid, str /* default to MONITOR mode */ sc->sc_ah->opmode = NL80211_IFTYPE_MONITOR; @@ -1063,7 +624,7 @@ /* * Allocate hardware transmit queues: one queue for * beacon frames and one data queue for each QoS -@@ -1839,19 +1822,22 @@ static int ath_init_softc(u16 devid, str +@@ -1839,19 +1806,22 @@ static int ath_init_softc(u16 devid, str /* setup channels and rates */ sc->sbands[IEEE80211_BAND_2GHZ].channels = ath9k_2ghz_chantable; @@ -1100,22 +661,7 @@ struct { int valid; int valid_single_stream; -@@ -111,14 +112,12 @@ struct ath_rate_table { - u32 ratekbps; - u32 user_ratekbps; - u8 ratecode; -- u8 short_preamble; - u8 dot11rate; - u8 ctrl_rate; - u8 base_index; - u8 cw40index; - u8 sgi_index; - u8 ht_index; -- u32 max_4ms_framelen; - } info[RATE_TABLE_SIZE]; - u32 probe_interval; - u8 initial_ratemax; -@@ -179,8 +178,6 @@ enum ath9k_internal_frame_type { +@@ -179,8 +180,6 @@ enum ath9k_internal_frame_type { ATH9K_INT_UNPAUSE }; @@ -1144,7 +690,7 @@ - rt = sc->cur_rate_table; - rate = rt->info[0].ratecode; -+ sband = &sc->sbands[sc->hw->conf.channel->band]; ++ sband = &sc->sbands[common->hw->conf.channel->band]; + rate = sband->bitrates[0].hw_value; if (sc->sc_flags & SC_OP_PREAMBLE_SHORT) - rate |= rt->info[0].short_preamble; diff --git a/package/mac80211/patches/561-ath9k_rc_table_cleanup.patch b/package/mac80211/patches/561-ath9k_rc_table_cleanup.patch new file mode 100644 index 000000000..64bf9a670 --- /dev/null +++ b/package/mac80211/patches/561-ath9k_rc_table_cleanup.patch @@ -0,0 +1,477 @@ +--- a/drivers/net/wireless/ath/ath9k/rc.h ++++ b/drivers/net/wireless/ath/ath9k/rc.h +@@ -112,14 +112,12 @@ struct ath_rate_table { + u32 ratekbps; + u32 user_ratekbps; + u8 ratecode; +- u8 short_preamble; + u8 dot11rate; + u8 ctrl_rate; + u8 base_index; + u8 cw40index; + u8 sgi_index; + u8 ht_index; +- u32 max_4ms_framelen; + } info[RATE_TABLE_SIZE]; + u32 probe_interval; + u8 initial_ratemax; +--- a/drivers/net/wireless/ath/ath9k/rc.c ++++ b/drivers/net/wireless/ath/ath9k/rc.c +@@ -22,131 +22,89 @@ static const struct ath_rate_table ar541 + 8, /* MCS start */ + { + { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ +- 5400, 0x0b, 0x00, 12, +- 0, 0, 0, 0, 0, 0 }, ++ 5400, 0, 12, 0, 0, 0, 0, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ +- 7800, 0x0f, 0x00, 18, +- 0, 1, 1, 1, 1, 0 }, ++ 7800, 1, 18, 0, 1, 1, 1, 1 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ +- 10000, 0x0a, 0x00, 24, +- 2, 2, 2, 2, 2, 0 }, ++ 10000, 2, 24, 2, 2, 2, 2, 2 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ +- 13900, 0x0e, 0x00, 36, +- 2, 3, 3, 3, 3, 0 }, ++ 13900, 3, 36, 2, 3, 3, 3, 3 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ +- 17300, 0x09, 0x00, 48, +- 4, 4, 4, 4, 4, 0 }, ++ 17300, 4, 48, 4, 4, 4, 4, 4 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ +- 23000, 0x0d, 0x00, 72, +- 4, 5, 5, 5, 5, 0 }, ++ 23000, 5, 72, 4, 5, 5, 5, 5 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ +- 27400, 0x08, 0x00, 96, +- 4, 6, 6, 6, 6, 0 }, ++ 27400, 6, 96, 4, 6, 6, 6, 6 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ +- 29300, 0x0c, 0x00, 108, +- 4, 7, 7, 7, 7, 0 }, ++ 29300, 7, 108, 4, 7, 7, 7, 7 }, + { VALID_2040, VALID_2040, WLAN_RC_PHY_HT_20_SS, 6500, /* 6.5 Mb */ +- 6400, 0x80, 0x00, 0, +- 0, 8, 24, 8, 24, 3216 }, ++ 6400, 0, 0, 0, 8, 24, 8, 24 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 13000, /* 13 Mb */ +- 12700, 0x81, 0x00, 1, +- 2, 9, 25, 9, 25, 6434 }, ++ 12700, 1, 1, 2, 9, 25, 9, 25 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 19500, /* 19.5 Mb */ +- 18800, 0x82, 0x00, 2, +- 2, 10, 26, 10, 26, 9650 }, ++ 18800, 2, 2, 2, 10, 26, 10, 26 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 26000, /* 26 Mb */ +- 25000, 0x83, 0x00, 3, +- 4, 11, 27, 11, 27, 12868 }, ++ 25000, 3, 3, 4, 11, 27, 11, 27 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 39000, /* 39 Mb */ +- 36700, 0x84, 0x00, 4, +- 4, 12, 28, 12, 28, 19304 }, ++ 36700, 4, 4, 4, 12, 28, 12, 28 }, + { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 52000, /* 52 Mb */ +- 48100, 0x85, 0x00, 5, +- 4, 13, 29, 13, 29, 25740 }, ++ 48100, 5, 5, 4, 13, 29, 13, 29 }, + { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 58500, /* 58.5 Mb */ +- 53500, 0x86, 0x00, 6, +- 4, 14, 30, 14, 30, 28956 }, ++ 53500, 6, 6, 4, 14, 30, 14, 30 }, + { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 65000, /* 65 Mb */ +- 59000, 0x87, 0x00, 7, +- 4, 15, 31, 15, 32, 32180 }, ++ 59000, 7, 7, 4, 15, 31, 15, 32 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 13000, /* 13 Mb */ +- 12700, 0x88, 0x00, +- 8, 3, 16, 33, 16, 33, 6430 }, ++ 12700, 8, 8, 3, 16, 33, 16, 33 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 26000, /* 26 Mb */ +- 24800, 0x89, 0x00, 9, +- 2, 17, 34, 17, 34, 12860 }, ++ 24800, 9, 9, 2, 17, 34, 17, 34 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 39000, /* 39 Mb */ +- 36600, 0x8a, 0x00, 10, +- 2, 18, 35, 18, 35, 19300 }, ++ 36600, 10, 10, 2, 18, 35, 18, 35 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 52000, /* 52 Mb */ +- 48100, 0x8b, 0x00, 11, +- 4, 19, 36, 19, 36, 25736 }, ++ 48100, 11, 11, 4, 19, 36, 19, 36 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 78000, /* 78 Mb */ +- 69500, 0x8c, 0x00, 12, +- 4, 20, 37, 20, 37, 38600 }, ++ 69500, 12, 12, 4, 20, 37, 20, 37 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 104000, /* 104 Mb */ +- 89500, 0x8d, 0x00, 13, +- 4, 21, 38, 21, 38, 51472 }, ++ 89500, 13, 13, 4, 21, 38, 21, 38 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 117000, /* 117 Mb */ +- 98900, 0x8e, 0x00, 14, +- 4, 22, 39, 22, 39, 57890 }, ++ 98900, 14, 14, 4, 22, 39, 22, 39 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 130000, /* 130 Mb */ +- 108300, 0x8f, 0x00, 15, +- 4, 23, 40, 23, 41, 64320 }, ++ 108300, 15, 15, 4, 23, 40, 23, 41 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 13500, /* 13.5 Mb */ +- 13200, 0x80, 0x00, 0, +- 0, 8, 24, 24, 24, 6684 }, ++ 13200, 0, 0, 0, 8, 24, 24, 24 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 27500, /* 27.0 Mb */ +- 25900, 0x81, 0x00, 1, +- 2, 9, 25, 25, 25, 13368 }, ++ 25900, 1, 1, 2, 9, 25, 25, 25 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 40500, /* 40.5 Mb */ +- 38600, 0x82, 0x00, 2, +- 2, 10, 26, 26, 26, 20052 }, ++ 38600, 2, 2, 2, 10, 26, 26, 26 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 54000, /* 54 Mb */ +- 49800, 0x83, 0x00, 3, +- 4, 11, 27, 27, 27, 26738 }, ++ 49800, 3, 3, 4, 11, 27, 27, 27 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 81500, /* 81 Mb */ +- 72200, 0x84, 0x00, 4, +- 4, 12, 28, 28, 28, 40104 }, ++ 72200, 4, 4, 4, 12, 28, 28, 28 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 108000, /* 108 Mb */ +- 92900, 0x85, 0x00, 5, +- 4, 13, 29, 29, 29, 53476 }, ++ 92900, 5, 5, 4, 13, 29, 29, 29 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 121500, /* 121.5 Mb */ +- 102700, 0x86, 0x00, 6, +- 4, 14, 30, 30, 30, 60156 }, ++ 102700, 6, 6, 4, 14, 30, 30, 30 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 135000, /* 135 Mb */ +- 112000, 0x87, 0x00, 7, +- 4, 15, 31, 32, 32, 66840 }, ++ 112000, 7, 7, 4, 15, 31, 32, 32 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, /* 150 Mb */ +- 122000, 0x87, 0x00, 7, +- 4, 15, 31, 32, 32, 74200 }, ++ 122000, 7, 7, 4, 15, 31, 32, 32 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 27000, /* 27 Mb */ +- 25800, 0x88, 0x00, 8, +- 0, 16, 33, 33, 33, 13360 }, ++ 25800, 8, 8, 0, 16, 33, 33, 33 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 54000, /* 54 Mb */ +- 49800, 0x89, 0x00, 9, +- 2, 17, 34, 34, 34, 26720 }, ++ 49800, 9, 9, 2, 17, 34, 34, 34 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 81000, /* 81 Mb */ +- 71900, 0x8a, 0x00, 10, +- 2, 18, 35, 35, 35, 40080 }, ++ 71900, 10, 10, 2, 18, 35, 35, 35 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 108000, /* 108 Mb */ +- 92500, 0x8b, 0x00, 11, +- 4, 19, 36, 36, 36, 53440 }, ++ 92500, 11, 11, 4, 19, 36, 36, 36 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 162000, /* 162 Mb */ +- 130300, 0x8c, 0x00, 12, +- 4, 20, 37, 37, 37, 80160 }, ++ 130300, 12, 12, 4, 20, 37, 37, 37 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 216000, /* 216 Mb */ +- 162800, 0x8d, 0x00, 13, +- 4, 21, 38, 38, 38, 106880 }, ++ 162800, 13, 13, 4, 21, 38, 38, 38 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 243000, /* 243 Mb */ +- 178200, 0x8e, 0x00, 14, +- 4, 22, 39, 39, 39, 120240 }, ++ 178200, 14, 14, 4, 22, 39, 39, 39 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 270000, /* 270 Mb */ +- 192100, 0x8f, 0x00, 15, +- 4, 23, 40, 41, 41, 133600 }, ++ 192100, 15, 15, 4, 23, 40, 41, 41 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS_HGI, 300000, /* 300 Mb */ +- 207000, 0x8f, 0x00, 15, +- 4, 23, 40, 41, 41, 148400 }, ++ 207000, 15, 15, 4, 23, 40, 41, 41 }, + }, + 50, /* probe interval */ + WLAN_RC_HT_FLAG, /* Phy rates allowed initially */ +@@ -160,144 +118,98 @@ static const struct ath_rate_table ar541 + 12, /* MCS start */ + { + { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ +- 900, 0x1b, 0x00, 2, +- 0, 0, 0, 0, 0, 0 }, ++ 900, 0, 2, 0, 0, 0, 0, 0 }, + { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */ +- 1900, 0x1a, 0x04, 4, +- 1, 1, 1, 1, 1, 0 }, ++ 1900, 1, 4, 1, 1, 1, 1, 1 }, + { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */ +- 4900, 0x19, 0x04, 11, +- 2, 2, 2, 2, 2, 0 }, ++ 4900, 2, 11, 2, 2, 2, 2, 2 }, + { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */ +- 8100, 0x18, 0x04, 22, +- 3, 3, 3, 3, 3, 0 }, ++ 8100, 3, 22, 3, 3, 3, 3, 3 }, + { INVALID, INVALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ +- 5400, 0x0b, 0x00, 12, +- 4, 4, 4, 4, 4, 0 }, ++ 5400, 4, 12, 4, 4, 4, 4, 4 }, + { INVALID, INVALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ +- 7800, 0x0f, 0x00, 18, +- 4, 5, 5, 5, 5, 0 }, ++ 7800, 5, 18, 4, 5, 5, 5, 5 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ +- 10100, 0x0a, 0x00, 24, +- 6, 6, 6, 6, 6, 0 }, ++ 10100, 6, 24, 6, 6, 6, 6, 6 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ +- 14100, 0x0e, 0x00, 36, +- 6, 7, 7, 7, 7, 0 }, ++ 14100, 7, 36, 6, 7, 7, 7, 7 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ +- 17700, 0x09, 0x00, 48, +- 8, 8, 8, 8, 8, 0 }, ++ 17700, 8, 48, 8, 8, 8, 8, 8 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ +- 23700, 0x0d, 0x00, 72, +- 8, 9, 9, 9, 9, 0 }, ++ 23700, 9, 72, 8, 9, 9, 9, 9 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ +- 27400, 0x08, 0x00, 96, +- 8, 10, 10, 10, 10, 0 }, ++ 27400, 10, 96, 8, 10, 10, 10, 10 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ +- 30900, 0x0c, 0x00, 108, +- 8, 11, 11, 11, 11, 0 }, ++ 30900, 11, 108, 8, 11, 11, 11, 11 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_20_SS, 6500, /* 6.5 Mb */ +- 6400, 0x80, 0x00, 0, +- 4, 12, 28, 12, 28, 3216 }, ++ 6400, 0, 0, 4, 12, 28, 12, 28 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 13000, /* 13 Mb */ +- 12700, 0x81, 0x00, 1, +- 6, 13, 29, 13, 29, 6434 }, ++ 12700, 1, 1, 6, 13, 29, 13, 29 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 19500, /* 19.5 Mb */ +- 18800, 0x82, 0x00, 2, +- 6, 14, 30, 14, 30, 9650 }, ++ 18800, 2, 2, 6, 14, 30, 14, 30 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 26000, /* 26 Mb */ +- 25000, 0x83, 0x00, 3, +- 8, 15, 31, 15, 31, 12868 }, ++ 25000, 3, 3, 8, 15, 31, 15, 31 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 39000, /* 39 Mb */ +- 36700, 0x84, 0x00, 4, +- 8, 16, 32, 16, 32, 19304 }, ++ 36700, 4, 4, 8, 16, 32, 16, 32 }, + { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 52000, /* 52 Mb */ +- 48100, 0x85, 0x00, 5, +- 8, 17, 33, 17, 33, 25740 }, ++ 48100, 5, 5, 8, 17, 33, 17, 33 }, + { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 58500, /* 58.5 Mb */ +- 53500, 0x86, 0x00, 6, +- 8, 18, 34, 18, 34, 28956 }, ++ 53500, 6, 6, 8, 18, 34, 18, 34 }, + { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 65000, /* 65 Mb */ +- 59000, 0x87, 0x00, 7, +- 8, 19, 35, 19, 36, 32180 }, ++ 59000, 7, 7, 8, 19, 35, 19, 36 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 13000, /* 13 Mb */ +- 12700, 0x88, 0x00, 8, +- 4, 20, 37, 20, 37, 6430 }, ++ 12700, 8, 8, 4, 20, 37, 20, 37 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 26000, /* 26 Mb */ +- 24800, 0x89, 0x00, 9, +- 6, 21, 38, 21, 38, 12860 }, ++ 24800, 9, 9, 6, 21, 38, 21, 38 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 39000, /* 39 Mb */ +- 36600, 0x8a, 0x00, 10, +- 6, 22, 39, 22, 39, 19300 }, ++ 36600, 10, 10, 6, 22, 39, 22, 39 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 52000, /* 52 Mb */ +- 48100, 0x8b, 0x00, 11, +- 8, 23, 40, 23, 40, 25736 }, ++ 48100, 11, 11, 8, 23, 40, 23, 40 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 78000, /* 78 Mb */ +- 69500, 0x8c, 0x00, 12, +- 8, 24, 41, 24, 41, 38600 }, ++ 69500, 12, 12, 8, 24, 41, 24, 41 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 104000, /* 104 Mb */ +- 89500, 0x8d, 0x00, 13, +- 8, 25, 42, 25, 42, 51472 }, ++ 89500, 13, 13, 8, 25, 42, 25, 42 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 117000, /* 117 Mb */ +- 98900, 0x8e, 0x00, 14, +- 8, 26, 43, 26, 44, 57890 }, ++ 98900, 14, 14, 8, 26, 43, 26, 44 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 130000, /* 130 Mb */ +- 108300, 0x8f, 0x00, 15, +- 8, 27, 44, 27, 45, 64320 }, ++ 108300, 15, 15, 8, 27, 44, 27, 45 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 13500, /* 13.5 Mb */ +- 13200, 0x80, 0x00, 0, +- 8, 12, 28, 28, 28, 6684 }, ++ 13200, 0, 0, 8, 12, 28, 28, 28 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 27500, /* 27.0 Mb */ +- 25900, 0x81, 0x00, 1, +- 8, 13, 29, 29, 29, 13368 }, ++ 25900, 1, 1, 8, 13, 29, 29, 29 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 40500, /* 40.5 Mb */ +- 38600, 0x82, 0x00, 2, +- 8, 14, 30, 30, 30, 20052 }, ++ 38600, 2, 2, 8, 14, 30, 30, 30 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 54000, /* 54 Mb */ +- 49800, 0x83, 0x00, 3, +- 8, 15, 31, 31, 31, 26738 }, ++ 49800, 3, 3, 8, 15, 31, 31, 31 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 81500, /* 81 Mb */ +- 72200, 0x84, 0x00, 4, +- 8, 16, 32, 32, 32, 40104 }, ++ 72200, 4, 4, 8, 16, 32, 32, 32 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 108000, /* 108 Mb */ +- 92900, 0x85, 0x00, 5, +- 8, 17, 33, 33, 33, 53476 }, ++ 92900, 5, 5, 8, 17, 33, 33, 33 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 121500, /* 121.5 Mb */ +- 102700, 0x86, 0x00, 6, +- 8, 18, 34, 34, 34, 60156 }, ++ 102700, 6, 6, 8, 18, 34, 34, 34 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 135000, /* 135 Mb */ +- 112000, 0x87, 0x00, 7, +- 8, 19, 35, 36, 36, 66840 }, ++ 112000, 7, 7, 8, 19, 35, 36, 36 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, /* 150 Mb */ +- 122000, 0x87, 0x00, 7, +- 8, 19, 35, 36, 36, 74200 }, ++ 122000, 7, 7, 8, 19, 35, 36, 36 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 27000, /* 27 Mb */ +- 25800, 0x88, 0x00, 8, +- 8, 20, 37, 37, 37, 13360 }, ++ 25800, 8, 8, 8, 20, 37, 37, 37 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 54000, /* 54 Mb */ +- 49800, 0x89, 0x00, 9, +- 8, 21, 38, 38, 38, 26720 }, ++ 49800, 9, 9, 8, 21, 38, 38, 38 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 81000, /* 81 Mb */ +- 71900, 0x8a, 0x00, 10, +- 8, 22, 39, 39, 39, 40080 }, ++ 71900, 10, 10, 8, 22, 39, 39, 39 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 108000, /* 108 Mb */ +- 92500, 0x8b, 0x00, 11, +- 8, 23, 40, 40, 40, 53440 }, ++ 92500, 11, 11, 8, 23, 40, 40, 40 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 162000, /* 162 Mb */ +- 130300, 0x8c, 0x00, 12, +- 8, 24, 41, 41, 41, 80160 }, ++ 130300, 12, 12, 8, 24, 41, 41, 41 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 216000, /* 216 Mb */ +- 162800, 0x8d, 0x00, 13, +- 8, 25, 42, 42, 42, 106880 }, ++ 162800, 13, 13, 8, 25, 42, 42, 42 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 243000, /* 243 Mb */ +- 178200, 0x8e, 0x00, 14, +- 8, 26, 43, 43, 43, 120240 }, ++ 178200, 14, 14, 8, 26, 43, 43, 43 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 270000, /* 270 Mb */ +- 192100, 0x8f, 0x00, 15, +- 8, 27, 44, 45, 45, 133600 }, ++ 192100, 15, 15, 8, 27, 44, 45, 45 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS_HGI, 300000, /* 300 Mb */ +- 207000, 0x8f, 0x00, 15, +- 8, 27, 44, 45, 45, 148400 }, +- }, ++ 207000, 15, 15, 8, 27, 44, 45, 45 }, ++ }, + 50, /* probe interval */ + WLAN_RC_HT_FLAG, /* Phy rates allowed initially */ + }; +@@ -307,29 +219,21 @@ static const struct ath_rate_table ar541 + 0, + { + { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ +- 5400, 0x0b, 0x00, (0x80|12), +- 0, 0, 0 }, ++ 5400, 0, 12, 0, 0, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ +- 7800, 0x0f, 0x00, 18, +- 0, 1, 0 }, ++ 7800, 1, 18, 0, 1, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ +- 10000, 0x0a, 0x00, (0x80|24), +- 2, 2, 0 }, ++ 10000, 2, 24, 2, 2, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ +- 13900, 0x0e, 0x00, 36, +- 2, 3, 0 }, ++ 13900, 3, 36, 2, 3, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ +- 17300, 0x09, 0x00, (0x80|48), +- 4, 4, 0 }, ++ 17300, 4, 48, 4, 4, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ +- 23000, 0x0d, 0x00, 72, +- 4, 5, 0 }, ++ 23000, 5, 72, 4, 5, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ +- 27400, 0x08, 0x00, 96, +- 4, 6, 0 }, ++ 27400, 6, 96, 4, 6, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ +- 29300, 0x0c, 0x00, 108, +- 4, 7, 0 }, ++ 29300, 7, 108, 4, 7, 0 }, + }, + 50, /* probe interval */ + 0, /* Phy rates allowed initially */ +@@ -340,41 +244,29 @@ static const struct ath_rate_table ar541 + 0, + { + { VALID, VALID, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ +- 900, 0x1b, 0x00, 2, +- 0, 0, 0 }, ++ 900, 0, 2, 0, 0, 0 }, + { VALID, VALID, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */ +- 1900, 0x1a, 0x04, 4, +- 1, 1, 0 }, ++ 1900, 1, 4, 1, 1, 0 }, + { VALID, VALID, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */ +- 4900, 0x19, 0x04, 11, +- 2, 2, 0 }, ++ 4900, 2, 11, 2, 2, 0 }, + { VALID, VALID, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */ +- 8100, 0x18, 0x04, 22, +- 3, 3, 0 }, ++ 8100, 3, 22, 3, 3, 0 }, + { INVALID, INVALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ +- 5400, 0x0b, 0x00, 12, +- 4, 4, 0 }, ++ 5400, 4, 12, 4, 4, 0 }, + { INVALID, INVALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ +- 7800, 0x0f, 0x00, 18, +- 4, 5, 0 }, ++ 7800, 5, 18, 4, 5, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ +- 10000, 0x0a, 0x00, 24, +- 6, 6, 0 }, ++ 10000, 6, 24, 6, 6, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ +- 13900, 0x0e, 0x00, 36, +- 6, 7, 0 }, ++ 13900, 7, 36, 6, 7, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ +- 17300, 0x09, 0x00, 48, +- 8, 8, 0 }, ++ 17300, 8, 48, 8, 8, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ +- 23000, 0x0d, 0x00, 72, +- 8, 9, 0 }, ++ 23000, 9, 72, 8, 9, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ +- 27400, 0x08, 0x00, 96, +- 8, 10, 0 }, ++ 27400, 10, 96, 8, 10, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ +- 29300, 0x0c, 0x00, 108, +- 8, 11, 0 }, ++ 29300, 11, 108, 8, 11, 0 }, + }, + 50, /* probe interval */ + 0, /* Phy rates allowed initially */ From 4dd46c8d8deab473113f29e2d2e84f8dd8e667c2 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 18 Nov 2009 04:42:40 +0000 Subject: [PATCH 186/288] ath9k: fix bisectability of rc patches git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18445 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches/560-ath9k_rate_control_api.patch | 449 +++++++++++++++++- .../patches/561-ath9k_rc_table_cleanup.patch | 216 ++++----- 2 files changed, 548 insertions(+), 117 deletions(-) diff --git a/package/mac80211/patches/560-ath9k_rate_control_api.patch b/package/mac80211/patches/560-ath9k_rate_control_api.patch index 5769d305a..912ab6872 100644 --- a/package/mac80211/patches/560-ath9k_rate_control_api.patch +++ b/package/mac80211/patches/560-ath9k_rate_control_api.patch @@ -1,38 +1,469 @@ --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c -@@ -19,6 +19,7 @@ +@@ -19,132 +19,133 @@ static const struct ath_rate_table ar5416_11na_ratetable = { 42, + 8, /* MCS start */ { { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ - 5400, 0x0b, 0x00, 12, -@@ -156,6 +157,7 @@ static const struct ath_rate_table ar541 +- 5400, 0x0b, 0x00, 12, ++ 5400, 0, 0x00, 12, + 0, 0, 0, 0, 0, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ +- 7800, 0x0f, 0x00, 18, ++ 7800, 1, 0x00, 18, + 0, 1, 1, 1, 1, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ +- 10000, 0x0a, 0x00, 24, ++ 10000, 2, 0x00, 24, + 2, 2, 2, 2, 2, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ +- 13900, 0x0e, 0x00, 36, ++ 13900, 3, 0x00, 36, + 2, 3, 3, 3, 3, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ +- 17300, 0x09, 0x00, 48, ++ 17300, 4, 0x00, 48, + 4, 4, 4, 4, 4, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ +- 23000, 0x0d, 0x00, 72, ++ 23000, 5, 0x00, 72, + 4, 5, 5, 5, 5, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ +- 27400, 0x08, 0x00, 96, ++ 27400, 6, 0x00, 96, + 4, 6, 6, 6, 6, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ +- 29300, 0x0c, 0x00, 108, ++ 29300, 7, 0x00, 108, + 4, 7, 7, 7, 7, 0 }, + { VALID_2040, VALID_2040, WLAN_RC_PHY_HT_20_SS, 6500, /* 6.5 Mb */ +- 6400, 0x80, 0x00, 0, ++ 6400, 0, 0x00, 0, + 0, 8, 24, 8, 24, 3216 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 13000, /* 13 Mb */ +- 12700, 0x81, 0x00, 1, ++ 12700, 1, 0x00, 1, + 2, 9, 25, 9, 25, 6434 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 19500, /* 19.5 Mb */ +- 18800, 0x82, 0x00, 2, ++ 18800, 2, 0x00, 2, + 2, 10, 26, 10, 26, 9650 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 26000, /* 26 Mb */ +- 25000, 0x83, 0x00, 3, ++ 25000, 3, 0x00, 3, + 4, 11, 27, 11, 27, 12868 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 39000, /* 39 Mb */ +- 36700, 0x84, 0x00, 4, ++ 36700, 4, 0x00, 4, + 4, 12, 28, 12, 28, 19304 }, + { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 52000, /* 52 Mb */ +- 48100, 0x85, 0x00, 5, ++ 48100, 5, 0x00, 5, + 4, 13, 29, 13, 29, 25740 }, + { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 58500, /* 58.5 Mb */ +- 53500, 0x86, 0x00, 6, ++ 53500, 6, 0x00, 6, + 4, 14, 30, 14, 30, 28956 }, + { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 65000, /* 65 Mb */ +- 59000, 0x87, 0x00, 7, ++ 59000, 7, 0x00, 7, + 4, 15, 31, 15, 32, 32180 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 13000, /* 13 Mb */ +- 12700, 0x88, 0x00, ++ 12700, 8, 0x00, + 8, 3, 16, 33, 16, 33, 6430 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 26000, /* 26 Mb */ +- 24800, 0x89, 0x00, 9, ++ 24800, 9, 0x00, 9, + 2, 17, 34, 17, 34, 12860 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 39000, /* 39 Mb */ +- 36600, 0x8a, 0x00, 10, ++ 36600, 10, 0x00, 10, + 2, 18, 35, 18, 35, 19300 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 52000, /* 52 Mb */ +- 48100, 0x8b, 0x00, 11, ++ 48100, 11, 0x00, 11, + 4, 19, 36, 19, 36, 25736 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 78000, /* 78 Mb */ +- 69500, 0x8c, 0x00, 12, ++ 69500, 12, 0x00, 12, + 4, 20, 37, 20, 37, 38600 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 104000, /* 104 Mb */ +- 89500, 0x8d, 0x00, 13, ++ 89500, 13, 0x00, 13, + 4, 21, 38, 21, 38, 51472 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 117000, /* 117 Mb */ +- 98900, 0x8e, 0x00, 14, ++ 98900, 14, 0x00, 14, + 4, 22, 39, 22, 39, 57890 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 130000, /* 130 Mb */ +- 108300, 0x8f, 0x00, 15, ++ 108300, 15, 0x00, 15, + 4, 23, 40, 23, 41, 64320 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 13500, /* 13.5 Mb */ +- 13200, 0x80, 0x00, 0, ++ 13200, 0, 0x00, 0, + 0, 8, 24, 24, 24, 6684 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 27500, /* 27.0 Mb */ +- 25900, 0x81, 0x00, 1, ++ 25900, 1, 0x00, 1, + 2, 9, 25, 25, 25, 13368 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 40500, /* 40.5 Mb */ +- 38600, 0x82, 0x00, 2, ++ 38600, 2, 0x00, 2, + 2, 10, 26, 26, 26, 20052 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 54000, /* 54 Mb */ +- 49800, 0x83, 0x00, 3, ++ 49800, 3, 0x00, 3, + 4, 11, 27, 27, 27, 26738 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 81500, /* 81 Mb */ +- 72200, 0x84, 0x00, 4, ++ 72200, 4, 0x00, 4, + 4, 12, 28, 28, 28, 40104 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 108000, /* 108 Mb */ +- 92900, 0x85, 0x00, 5, ++ 92900, 5, 0x00, 5, + 4, 13, 29, 29, 29, 53476 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 121500, /* 121.5 Mb */ +- 102700, 0x86, 0x00, 6, ++ 102700, 6, 0x00, 6, + 4, 14, 30, 30, 30, 60156 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 135000, /* 135 Mb */ +- 112000, 0x87, 0x00, 7, ++ 112000, 7, 0x00, 7, + 4, 15, 31, 32, 32, 66840 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, /* 150 Mb */ +- 122000, 0x87, 0x00, 7, ++ 122000, 7, 0x00, 7, + 4, 15, 31, 32, 32, 74200 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 27000, /* 27 Mb */ +- 25800, 0x88, 0x00, 8, ++ 25800, 8, 0x00, 8, + 0, 16, 33, 33, 33, 13360 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 54000, /* 54 Mb */ +- 49800, 0x89, 0x00, 9, ++ 49800, 9, 0x00, 9, + 2, 17, 34, 34, 34, 26720 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 81000, /* 81 Mb */ +- 71900, 0x8a, 0x00, 10, ++ 71900, 10, 0x00, 10, + 2, 18, 35, 35, 35, 40080 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 108000, /* 108 Mb */ +- 92500, 0x8b, 0x00, 11, ++ 92500, 11, 0x00, 11, + 4, 19, 36, 36, 36, 53440 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 162000, /* 162 Mb */ +- 130300, 0x8c, 0x00, 12, ++ 130300, 12, 0x00, 12, + 4, 20, 37, 37, 37, 80160 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 216000, /* 216 Mb */ +- 162800, 0x8d, 0x00, 13, ++ 162800, 13, 0x00, 13, + 4, 21, 38, 38, 38, 106880 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 243000, /* 243 Mb */ +- 178200, 0x8e, 0x00, 14, ++ 178200, 14, 0x00, 14, + 4, 22, 39, 39, 39, 120240 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 270000, /* 270 Mb */ +- 192100, 0x8f, 0x00, 15, ++ 192100, 15, 0x00, 15, + 4, 23, 40, 41, 41, 133600 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS_HGI, 300000, /* 300 Mb */ +- 207000, 0x8f, 0x00, 15, ++ 207000, 15, 0x00, 15, + 4, 23, 40, 41, 41, 148400 }, + }, + 50, /* probe interval */ +@@ -156,144 +157,145 @@ static const struct ath_rate_table ar541 static const struct ath_rate_table ar5416_11ng_ratetable = { 46, + 12, /* MCS start */ { { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ - 900, 0x1b, 0x00, 2, -@@ -302,6 +304,7 @@ static const struct ath_rate_table ar541 +- 900, 0x1b, 0x00, 2, ++ 900, 0, 0x00, 2, + 0, 0, 0, 0, 0, 0 }, + { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */ +- 1900, 0x1a, 0x04, 4, ++ 1900, 1, 0x04, 4, + 1, 1, 1, 1, 1, 0 }, + { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */ +- 4900, 0x19, 0x04, 11, ++ 4900, 2, 0x04, 11, + 2, 2, 2, 2, 2, 0 }, + { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */ +- 8100, 0x18, 0x04, 22, ++ 8100, 3, 0x04, 22, + 3, 3, 3, 3, 3, 0 }, + { INVALID, INVALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ +- 5400, 0x0b, 0x00, 12, ++ 5400, 4, 0x00, 12, + 4, 4, 4, 4, 4, 0 }, + { INVALID, INVALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ +- 7800, 0x0f, 0x00, 18, ++ 7800, 5, 0x00, 18, + 4, 5, 5, 5, 5, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ +- 10100, 0x0a, 0x00, 24, ++ 10100, 6, 0x00, 24, + 6, 6, 6, 6, 6, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ +- 14100, 0x0e, 0x00, 36, ++ 14100, 7, 0x00, 36, + 6, 7, 7, 7, 7, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ +- 17700, 0x09, 0x00, 48, ++ 17700, 8, 0x00, 48, + 8, 8, 8, 8, 8, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ +- 23700, 0x0d, 0x00, 72, ++ 23700, 9, 0x00, 72, + 8, 9, 9, 9, 9, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ +- 27400, 0x08, 0x00, 96, ++ 27400, 10, 0x00, 96, + 8, 10, 10, 10, 10, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ +- 30900, 0x0c, 0x00, 108, ++ 30900, 11, 0x00, 108, + 8, 11, 11, 11, 11, 0 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_20_SS, 6500, /* 6.5 Mb */ +- 6400, 0x80, 0x00, 0, ++ 6400, 0, 0x00, 0, + 4, 12, 28, 12, 28, 3216 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 13000, /* 13 Mb */ +- 12700, 0x81, 0x00, 1, ++ 12700, 1, 0x00, 1, + 6, 13, 29, 13, 29, 6434 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 19500, /* 19.5 Mb */ +- 18800, 0x82, 0x00, 2, ++ 18800, 2, 0x00, 2, + 6, 14, 30, 14, 30, 9650 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 26000, /* 26 Mb */ +- 25000, 0x83, 0x00, 3, ++ 25000, 3, 0x00, 3, + 8, 15, 31, 15, 31, 12868 }, + { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 39000, /* 39 Mb */ +- 36700, 0x84, 0x00, 4, ++ 36700, 4, 0x00, 4, + 8, 16, 32, 16, 32, 19304 }, + { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 52000, /* 52 Mb */ +- 48100, 0x85, 0x00, 5, ++ 48100, 5, 0x00, 5, + 8, 17, 33, 17, 33, 25740 }, + { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 58500, /* 58.5 Mb */ +- 53500, 0x86, 0x00, 6, ++ 53500, 6, 0x00, 6, + 8, 18, 34, 18, 34, 28956 }, + { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 65000, /* 65 Mb */ +- 59000, 0x87, 0x00, 7, ++ 59000, 7, 0x00, 7, + 8, 19, 35, 19, 36, 32180 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 13000, /* 13 Mb */ +- 12700, 0x88, 0x00, 8, ++ 12700, 8, 0x00, 8, + 4, 20, 37, 20, 37, 6430 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 26000, /* 26 Mb */ +- 24800, 0x89, 0x00, 9, ++ 24800, 9, 0x00, 9, + 6, 21, 38, 21, 38, 12860 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 39000, /* 39 Mb */ +- 36600, 0x8a, 0x00, 10, ++ 36600, 10, 0x00, 10, + 6, 22, 39, 22, 39, 19300 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 52000, /* 52 Mb */ +- 48100, 0x8b, 0x00, 11, ++ 48100, 11, 0x00, 11, + 8, 23, 40, 23, 40, 25736 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 78000, /* 78 Mb */ +- 69500, 0x8c, 0x00, 12, ++ 69500, 12, 0x00, 12, + 8, 24, 41, 24, 41, 38600 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 104000, /* 104 Mb */ +- 89500, 0x8d, 0x00, 13, ++ 89500, 13, 0x00, 13, + 8, 25, 42, 25, 42, 51472 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 117000, /* 117 Mb */ +- 98900, 0x8e, 0x00, 14, ++ 98900, 14, 0x00, 14, + 8, 26, 43, 26, 44, 57890 }, + { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 130000, /* 130 Mb */ +- 108300, 0x8f, 0x00, 15, ++ 108300, 15, 0x00, 15, + 8, 27, 44, 27, 45, 64320 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 13500, /* 13.5 Mb */ +- 13200, 0x80, 0x00, 0, ++ 13200, 0, 0x00, 0, + 8, 12, 28, 28, 28, 6684 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 27500, /* 27.0 Mb */ +- 25900, 0x81, 0x00, 1, ++ 25900, 1, 0x00, 1, + 8, 13, 29, 29, 29, 13368 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 40500, /* 40.5 Mb */ +- 38600, 0x82, 0x00, 2, ++ 38600, 2, 0x00, 2, + 8, 14, 30, 30, 30, 20052 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 54000, /* 54 Mb */ +- 49800, 0x83, 0x00, 3, ++ 49800, 3, 0x00, 3, + 8, 15, 31, 31, 31, 26738 }, + { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 81500, /* 81 Mb */ +- 72200, 0x84, 0x00, 4, ++ 72200, 4, 0x00, 4, + 8, 16, 32, 32, 32, 40104 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 108000, /* 108 Mb */ +- 92900, 0x85, 0x00, 5, ++ 92900, 5, 0x00, 5, + 8, 17, 33, 33, 33, 53476 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 121500, /* 121.5 Mb */ +- 102700, 0x86, 0x00, 6, ++ 102700, 6, 0x00, 6, + 8, 18, 34, 34, 34, 60156 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 135000, /* 135 Mb */ +- 112000, 0x87, 0x00, 7, ++ 112000, 7, 0x00, 7, + 8, 19, 35, 36, 36, 66840 }, + { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, /* 150 Mb */ +- 122000, 0x87, 0x00, 7, ++ 122000, 7, 0x00, 7, + 8, 19, 35, 36, 36, 74200 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 27000, /* 27 Mb */ +- 25800, 0x88, 0x00, 8, ++ 25800, 8, 0x00, 8, + 8, 20, 37, 37, 37, 13360 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 54000, /* 54 Mb */ +- 49800, 0x89, 0x00, 9, ++ 49800, 9, 0x00, 9, + 8, 21, 38, 38, 38, 26720 }, + { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 81000, /* 81 Mb */ +- 71900, 0x8a, 0x00, 10, ++ 71900, 10, 0x00, 10, + 8, 22, 39, 39, 39, 40080 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 108000, /* 108 Mb */ +- 92500, 0x8b, 0x00, 11, ++ 92500, 11, 0x00, 11, + 8, 23, 40, 40, 40, 53440 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 162000, /* 162 Mb */ +- 130300, 0x8c, 0x00, 12, ++ 130300, 12, 0x00, 12, + 8, 24, 41, 41, 41, 80160 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 216000, /* 216 Mb */ +- 162800, 0x8d, 0x00, 13, ++ 162800, 13, 0x00, 13, + 8, 25, 42, 42, 42, 106880 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 243000, /* 243 Mb */ +- 178200, 0x8e, 0x00, 14, ++ 178200, 14, 0x00, 14, + 8, 26, 43, 43, 43, 120240 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 270000, /* 270 Mb */ +- 192100, 0x8f, 0x00, 15, ++ 192100, 15, 0x00, 15, + 8, 27, 44, 45, 45, 133600 }, + { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS_HGI, 300000, /* 300 Mb */ +- 207000, 0x8f, 0x00, 15, ++ 207000, 15, 0x00, 15, + 8, 27, 44, 45, 45, 148400 }, + }, + 50, /* probe interval */ +@@ -302,30 +304,31 @@ static const struct ath_rate_table ar541 static const struct ath_rate_table ar5416_11a_ratetable = { 8, + 0, { { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ - 5400, 0x0b, 0x00, (0x80|12), -@@ -334,6 +337,7 @@ static const struct ath_rate_table ar541 +- 5400, 0x0b, 0x00, (0x80|12), ++ 5400, 0, 0x00, 12, + 0, 0, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ +- 7800, 0x0f, 0x00, 18, ++ 7800, 1, 0x00, 18, + 0, 1, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ +- 10000, 0x0a, 0x00, (0x80|24), ++ 10000, 2, 0x00, 24, + 2, 2, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ +- 13900, 0x0e, 0x00, 36, ++ 13900, 3, 0x00, 36, + 2, 3, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ +- 17300, 0x09, 0x00, (0x80|48), ++ 17300, 4, 0x00, 48, + 4, 4, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ +- 23000, 0x0d, 0x00, 72, ++ 23000, 5, 0x00, 72, + 4, 5, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ +- 27400, 0x08, 0x00, 96, ++ 27400, 6, 0x00, 96, + 4, 6, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ +- 29300, 0x0c, 0x00, 108, ++ 29300, 7, 0x00, 108, + 4, 7, 0 }, + }, + 50, /* probe interval */ +@@ -334,48 +337,63 @@ static const struct ath_rate_table ar541 static const struct ath_rate_table ar5416_11g_ratetable = { 12, + 0, { { VALID, VALID, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ - 900, 0x1b, 0x00, 2, -@@ -376,6 +380,20 @@ static const struct ath_rate_table ar541 +- 900, 0x1b, 0x00, 2, ++ 900, 0, 0x00, 2, + 0, 0, 0 }, + { VALID, VALID, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */ +- 1900, 0x1a, 0x04, 4, ++ 1900, 1, 0x04, 4, + 1, 1, 0 }, + { VALID, VALID, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */ +- 4900, 0x19, 0x04, 11, ++ 4900, 2, 0x04, 11, + 2, 2, 0 }, + { VALID, VALID, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */ +- 8100, 0x18, 0x04, 22, ++ 8100, 3, 0x04, 22, + 3, 3, 0 }, + { INVALID, INVALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ +- 5400, 0x0b, 0x00, 12, ++ 5400, 4, 0x00, 12, + 4, 4, 0 }, + { INVALID, INVALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ +- 7800, 0x0f, 0x00, 18, ++ 7800, 5, 0x00, 18, + 4, 5, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ +- 10000, 0x0a, 0x00, 24, ++ 10000, 6, 0x00, 24, + 6, 6, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ +- 13900, 0x0e, 0x00, 36, ++ 13900, 7, 0x00, 36, + 6, 7, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ +- 17300, 0x09, 0x00, 48, ++ 17300, 8, 0x00, 48, + 8, 8, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ +- 23000, 0x0d, 0x00, 72, ++ 23000, 9, 0x00, 72, + 8, 9, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ +- 27400, 0x08, 0x00, 96, ++ 27400, 10, 0x00, 96, + 8, 10, 0 }, + { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ +- 29300, 0x0c, 0x00, 108, ++ 29300, 11, 0x00, 108, + 8, 11, 0 }, + }, + 50, /* probe interval */ 0, /* Phy rates allowed initially */ }; diff --git a/package/mac80211/patches/561-ath9k_rc_table_cleanup.patch b/package/mac80211/patches/561-ath9k_rc_table_cleanup.patch index 64bf9a670..30e0f9f0e 100644 --- a/package/mac80211/patches/561-ath9k_rc_table_cleanup.patch +++ b/package/mac80211/patches/561-ath9k_rc_table_cleanup.patch @@ -21,171 +21,171 @@ 8, /* MCS start */ { { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ -- 5400, 0x0b, 0x00, 12, +- 5400, 0, 0x00, 12, - 0, 0, 0, 0, 0, 0 }, + 5400, 0, 12, 0, 0, 0, 0, 0 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ -- 7800, 0x0f, 0x00, 18, +- 7800, 1, 0x00, 18, - 0, 1, 1, 1, 1, 0 }, + 7800, 1, 18, 0, 1, 1, 1, 1 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ -- 10000, 0x0a, 0x00, 24, +- 10000, 2, 0x00, 24, - 2, 2, 2, 2, 2, 0 }, + 10000, 2, 24, 2, 2, 2, 2, 2 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ -- 13900, 0x0e, 0x00, 36, +- 13900, 3, 0x00, 36, - 2, 3, 3, 3, 3, 0 }, + 13900, 3, 36, 2, 3, 3, 3, 3 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ -- 17300, 0x09, 0x00, 48, +- 17300, 4, 0x00, 48, - 4, 4, 4, 4, 4, 0 }, + 17300, 4, 48, 4, 4, 4, 4, 4 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ -- 23000, 0x0d, 0x00, 72, +- 23000, 5, 0x00, 72, - 4, 5, 5, 5, 5, 0 }, + 23000, 5, 72, 4, 5, 5, 5, 5 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ -- 27400, 0x08, 0x00, 96, +- 27400, 6, 0x00, 96, - 4, 6, 6, 6, 6, 0 }, + 27400, 6, 96, 4, 6, 6, 6, 6 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ -- 29300, 0x0c, 0x00, 108, +- 29300, 7, 0x00, 108, - 4, 7, 7, 7, 7, 0 }, + 29300, 7, 108, 4, 7, 7, 7, 7 }, { VALID_2040, VALID_2040, WLAN_RC_PHY_HT_20_SS, 6500, /* 6.5 Mb */ -- 6400, 0x80, 0x00, 0, +- 6400, 0, 0x00, 0, - 0, 8, 24, 8, 24, 3216 }, + 6400, 0, 0, 0, 8, 24, 8, 24 }, { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 13000, /* 13 Mb */ -- 12700, 0x81, 0x00, 1, +- 12700, 1, 0x00, 1, - 2, 9, 25, 9, 25, 6434 }, + 12700, 1, 1, 2, 9, 25, 9, 25 }, { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 19500, /* 19.5 Mb */ -- 18800, 0x82, 0x00, 2, +- 18800, 2, 0x00, 2, - 2, 10, 26, 10, 26, 9650 }, + 18800, 2, 2, 2, 10, 26, 10, 26 }, { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 26000, /* 26 Mb */ -- 25000, 0x83, 0x00, 3, +- 25000, 3, 0x00, 3, - 4, 11, 27, 11, 27, 12868 }, + 25000, 3, 3, 4, 11, 27, 11, 27 }, { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 39000, /* 39 Mb */ -- 36700, 0x84, 0x00, 4, +- 36700, 4, 0x00, 4, - 4, 12, 28, 12, 28, 19304 }, + 36700, 4, 4, 4, 12, 28, 12, 28 }, { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 52000, /* 52 Mb */ -- 48100, 0x85, 0x00, 5, +- 48100, 5, 0x00, 5, - 4, 13, 29, 13, 29, 25740 }, + 48100, 5, 5, 4, 13, 29, 13, 29 }, { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 58500, /* 58.5 Mb */ -- 53500, 0x86, 0x00, 6, +- 53500, 6, 0x00, 6, - 4, 14, 30, 14, 30, 28956 }, + 53500, 6, 6, 4, 14, 30, 14, 30 }, { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 65000, /* 65 Mb */ -- 59000, 0x87, 0x00, 7, +- 59000, 7, 0x00, 7, - 4, 15, 31, 15, 32, 32180 }, + 59000, 7, 7, 4, 15, 31, 15, 32 }, { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 13000, /* 13 Mb */ -- 12700, 0x88, 0x00, +- 12700, 8, 0x00, - 8, 3, 16, 33, 16, 33, 6430 }, + 12700, 8, 8, 3, 16, 33, 16, 33 }, { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 26000, /* 26 Mb */ -- 24800, 0x89, 0x00, 9, +- 24800, 9, 0x00, 9, - 2, 17, 34, 17, 34, 12860 }, + 24800, 9, 9, 2, 17, 34, 17, 34 }, { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 39000, /* 39 Mb */ -- 36600, 0x8a, 0x00, 10, +- 36600, 10, 0x00, 10, - 2, 18, 35, 18, 35, 19300 }, + 36600, 10, 10, 2, 18, 35, 18, 35 }, { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 52000, /* 52 Mb */ -- 48100, 0x8b, 0x00, 11, +- 48100, 11, 0x00, 11, - 4, 19, 36, 19, 36, 25736 }, + 48100, 11, 11, 4, 19, 36, 19, 36 }, { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 78000, /* 78 Mb */ -- 69500, 0x8c, 0x00, 12, +- 69500, 12, 0x00, 12, - 4, 20, 37, 20, 37, 38600 }, + 69500, 12, 12, 4, 20, 37, 20, 37 }, { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 104000, /* 104 Mb */ -- 89500, 0x8d, 0x00, 13, +- 89500, 13, 0x00, 13, - 4, 21, 38, 21, 38, 51472 }, + 89500, 13, 13, 4, 21, 38, 21, 38 }, { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 117000, /* 117 Mb */ -- 98900, 0x8e, 0x00, 14, +- 98900, 14, 0x00, 14, - 4, 22, 39, 22, 39, 57890 }, + 98900, 14, 14, 4, 22, 39, 22, 39 }, { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 130000, /* 130 Mb */ -- 108300, 0x8f, 0x00, 15, +- 108300, 15, 0x00, 15, - 4, 23, 40, 23, 41, 64320 }, + 108300, 15, 15, 4, 23, 40, 23, 41 }, { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 13500, /* 13.5 Mb */ -- 13200, 0x80, 0x00, 0, +- 13200, 0, 0x00, 0, - 0, 8, 24, 24, 24, 6684 }, + 13200, 0, 0, 0, 8, 24, 24, 24 }, { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 27500, /* 27.0 Mb */ -- 25900, 0x81, 0x00, 1, +- 25900, 1, 0x00, 1, - 2, 9, 25, 25, 25, 13368 }, + 25900, 1, 1, 2, 9, 25, 25, 25 }, { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 40500, /* 40.5 Mb */ -- 38600, 0x82, 0x00, 2, +- 38600, 2, 0x00, 2, - 2, 10, 26, 26, 26, 20052 }, + 38600, 2, 2, 2, 10, 26, 26, 26 }, { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 54000, /* 54 Mb */ -- 49800, 0x83, 0x00, 3, +- 49800, 3, 0x00, 3, - 4, 11, 27, 27, 27, 26738 }, + 49800, 3, 3, 4, 11, 27, 27, 27 }, { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 81500, /* 81 Mb */ -- 72200, 0x84, 0x00, 4, +- 72200, 4, 0x00, 4, - 4, 12, 28, 28, 28, 40104 }, + 72200, 4, 4, 4, 12, 28, 28, 28 }, { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 108000, /* 108 Mb */ -- 92900, 0x85, 0x00, 5, +- 92900, 5, 0x00, 5, - 4, 13, 29, 29, 29, 53476 }, + 92900, 5, 5, 4, 13, 29, 29, 29 }, { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 121500, /* 121.5 Mb */ -- 102700, 0x86, 0x00, 6, +- 102700, 6, 0x00, 6, - 4, 14, 30, 30, 30, 60156 }, + 102700, 6, 6, 4, 14, 30, 30, 30 }, { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 135000, /* 135 Mb */ -- 112000, 0x87, 0x00, 7, +- 112000, 7, 0x00, 7, - 4, 15, 31, 32, 32, 66840 }, + 112000, 7, 7, 4, 15, 31, 32, 32 }, { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, /* 150 Mb */ -- 122000, 0x87, 0x00, 7, +- 122000, 7, 0x00, 7, - 4, 15, 31, 32, 32, 74200 }, + 122000, 7, 7, 4, 15, 31, 32, 32 }, { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 27000, /* 27 Mb */ -- 25800, 0x88, 0x00, 8, +- 25800, 8, 0x00, 8, - 0, 16, 33, 33, 33, 13360 }, + 25800, 8, 8, 0, 16, 33, 33, 33 }, { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 54000, /* 54 Mb */ -- 49800, 0x89, 0x00, 9, +- 49800, 9, 0x00, 9, - 2, 17, 34, 34, 34, 26720 }, + 49800, 9, 9, 2, 17, 34, 34, 34 }, { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 81000, /* 81 Mb */ -- 71900, 0x8a, 0x00, 10, +- 71900, 10, 0x00, 10, - 2, 18, 35, 35, 35, 40080 }, + 71900, 10, 10, 2, 18, 35, 35, 35 }, { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 108000, /* 108 Mb */ -- 92500, 0x8b, 0x00, 11, +- 92500, 11, 0x00, 11, - 4, 19, 36, 36, 36, 53440 }, + 92500, 11, 11, 4, 19, 36, 36, 36 }, { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 162000, /* 162 Mb */ -- 130300, 0x8c, 0x00, 12, +- 130300, 12, 0x00, 12, - 4, 20, 37, 37, 37, 80160 }, + 130300, 12, 12, 4, 20, 37, 37, 37 }, { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 216000, /* 216 Mb */ -- 162800, 0x8d, 0x00, 13, +- 162800, 13, 0x00, 13, - 4, 21, 38, 38, 38, 106880 }, + 162800, 13, 13, 4, 21, 38, 38, 38 }, { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 243000, /* 243 Mb */ -- 178200, 0x8e, 0x00, 14, +- 178200, 14, 0x00, 14, - 4, 22, 39, 39, 39, 120240 }, + 178200, 14, 14, 4, 22, 39, 39, 39 }, { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 270000, /* 270 Mb */ -- 192100, 0x8f, 0x00, 15, +- 192100, 15, 0x00, 15, - 4, 23, 40, 41, 41, 133600 }, + 192100, 15, 15, 4, 23, 40, 41, 41 }, { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS_HGI, 300000, /* 300 Mb */ -- 207000, 0x8f, 0x00, 15, +- 207000, 15, 0x00, 15, - 4, 23, 40, 41, 41, 148400 }, + 207000, 15, 15, 4, 23, 40, 41, 41 }, }, @@ -195,187 +195,187 @@ 12, /* MCS start */ { { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ -- 900, 0x1b, 0x00, 2, +- 900, 0, 0x00, 2, - 0, 0, 0, 0, 0, 0 }, + 900, 0, 2, 0, 0, 0, 0, 0 }, { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */ -- 1900, 0x1a, 0x04, 4, +- 1900, 1, 0x04, 4, - 1, 1, 1, 1, 1, 0 }, + 1900, 1, 4, 1, 1, 1, 1, 1 }, { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */ -- 4900, 0x19, 0x04, 11, +- 4900, 2, 0x04, 11, - 2, 2, 2, 2, 2, 0 }, + 4900, 2, 11, 2, 2, 2, 2, 2 }, { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */ -- 8100, 0x18, 0x04, 22, +- 8100, 3, 0x04, 22, - 3, 3, 3, 3, 3, 0 }, + 8100, 3, 22, 3, 3, 3, 3, 3 }, { INVALID, INVALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ -- 5400, 0x0b, 0x00, 12, +- 5400, 4, 0x00, 12, - 4, 4, 4, 4, 4, 0 }, + 5400, 4, 12, 4, 4, 4, 4, 4 }, { INVALID, INVALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ -- 7800, 0x0f, 0x00, 18, +- 7800, 5, 0x00, 18, - 4, 5, 5, 5, 5, 0 }, + 7800, 5, 18, 4, 5, 5, 5, 5 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ -- 10100, 0x0a, 0x00, 24, +- 10100, 6, 0x00, 24, - 6, 6, 6, 6, 6, 0 }, + 10100, 6, 24, 6, 6, 6, 6, 6 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ -- 14100, 0x0e, 0x00, 36, +- 14100, 7, 0x00, 36, - 6, 7, 7, 7, 7, 0 }, + 14100, 7, 36, 6, 7, 7, 7, 7 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ -- 17700, 0x09, 0x00, 48, +- 17700, 8, 0x00, 48, - 8, 8, 8, 8, 8, 0 }, + 17700, 8, 48, 8, 8, 8, 8, 8 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ -- 23700, 0x0d, 0x00, 72, +- 23700, 9, 0x00, 72, - 8, 9, 9, 9, 9, 0 }, + 23700, 9, 72, 8, 9, 9, 9, 9 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ -- 27400, 0x08, 0x00, 96, +- 27400, 10, 0x00, 96, - 8, 10, 10, 10, 10, 0 }, + 27400, 10, 96, 8, 10, 10, 10, 10 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ -- 30900, 0x0c, 0x00, 108, +- 30900, 11, 0x00, 108, - 8, 11, 11, 11, 11, 0 }, + 30900, 11, 108, 8, 11, 11, 11, 11 }, { INVALID, INVALID, WLAN_RC_PHY_HT_20_SS, 6500, /* 6.5 Mb */ -- 6400, 0x80, 0x00, 0, +- 6400, 0, 0x00, 0, - 4, 12, 28, 12, 28, 3216 }, + 6400, 0, 0, 4, 12, 28, 12, 28 }, { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 13000, /* 13 Mb */ -- 12700, 0x81, 0x00, 1, +- 12700, 1, 0x00, 1, - 6, 13, 29, 13, 29, 6434 }, + 12700, 1, 1, 6, 13, 29, 13, 29 }, { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 19500, /* 19.5 Mb */ -- 18800, 0x82, 0x00, 2, +- 18800, 2, 0x00, 2, - 6, 14, 30, 14, 30, 9650 }, + 18800, 2, 2, 6, 14, 30, 14, 30 }, { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 26000, /* 26 Mb */ -- 25000, 0x83, 0x00, 3, +- 25000, 3, 0x00, 3, - 8, 15, 31, 15, 31, 12868 }, + 25000, 3, 3, 8, 15, 31, 15, 31 }, { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 39000, /* 39 Mb */ -- 36700, 0x84, 0x00, 4, +- 36700, 4, 0x00, 4, - 8, 16, 32, 16, 32, 19304 }, + 36700, 4, 4, 8, 16, 32, 16, 32 }, { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 52000, /* 52 Mb */ -- 48100, 0x85, 0x00, 5, +- 48100, 5, 0x00, 5, - 8, 17, 33, 17, 33, 25740 }, + 48100, 5, 5, 8, 17, 33, 17, 33 }, { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 58500, /* 58.5 Mb */ -- 53500, 0x86, 0x00, 6, +- 53500, 6, 0x00, 6, - 8, 18, 34, 18, 34, 28956 }, + 53500, 6, 6, 8, 18, 34, 18, 34 }, { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 65000, /* 65 Mb */ -- 59000, 0x87, 0x00, 7, +- 59000, 7, 0x00, 7, - 8, 19, 35, 19, 36, 32180 }, + 59000, 7, 7, 8, 19, 35, 19, 36 }, { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 13000, /* 13 Mb */ -- 12700, 0x88, 0x00, 8, +- 12700, 8, 0x00, 8, - 4, 20, 37, 20, 37, 6430 }, + 12700, 8, 8, 4, 20, 37, 20, 37 }, { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 26000, /* 26 Mb */ -- 24800, 0x89, 0x00, 9, +- 24800, 9, 0x00, 9, - 6, 21, 38, 21, 38, 12860 }, + 24800, 9, 9, 6, 21, 38, 21, 38 }, { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 39000, /* 39 Mb */ -- 36600, 0x8a, 0x00, 10, +- 36600, 10, 0x00, 10, - 6, 22, 39, 22, 39, 19300 }, + 36600, 10, 10, 6, 22, 39, 22, 39 }, { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 52000, /* 52 Mb */ -- 48100, 0x8b, 0x00, 11, +- 48100, 11, 0x00, 11, - 8, 23, 40, 23, 40, 25736 }, + 48100, 11, 11, 8, 23, 40, 23, 40 }, { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 78000, /* 78 Mb */ -- 69500, 0x8c, 0x00, 12, +- 69500, 12, 0x00, 12, - 8, 24, 41, 24, 41, 38600 }, + 69500, 12, 12, 8, 24, 41, 24, 41 }, { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 104000, /* 104 Mb */ -- 89500, 0x8d, 0x00, 13, +- 89500, 13, 0x00, 13, - 8, 25, 42, 25, 42, 51472 }, + 89500, 13, 13, 8, 25, 42, 25, 42 }, { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 117000, /* 117 Mb */ -- 98900, 0x8e, 0x00, 14, +- 98900, 14, 0x00, 14, - 8, 26, 43, 26, 44, 57890 }, + 98900, 14, 14, 8, 26, 43, 26, 44 }, { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 130000, /* 130 Mb */ -- 108300, 0x8f, 0x00, 15, +- 108300, 15, 0x00, 15, - 8, 27, 44, 27, 45, 64320 }, + 108300, 15, 15, 8, 27, 44, 27, 45 }, { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 13500, /* 13.5 Mb */ -- 13200, 0x80, 0x00, 0, +- 13200, 0, 0x00, 0, - 8, 12, 28, 28, 28, 6684 }, + 13200, 0, 0, 8, 12, 28, 28, 28 }, { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 27500, /* 27.0 Mb */ -- 25900, 0x81, 0x00, 1, +- 25900, 1, 0x00, 1, - 8, 13, 29, 29, 29, 13368 }, + 25900, 1, 1, 8, 13, 29, 29, 29 }, { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 40500, /* 40.5 Mb */ -- 38600, 0x82, 0x00, 2, +- 38600, 2, 0x00, 2, - 8, 14, 30, 30, 30, 20052 }, + 38600, 2, 2, 8, 14, 30, 30, 30 }, { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 54000, /* 54 Mb */ -- 49800, 0x83, 0x00, 3, +- 49800, 3, 0x00, 3, - 8, 15, 31, 31, 31, 26738 }, + 49800, 3, 3, 8, 15, 31, 31, 31 }, { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 81500, /* 81 Mb */ -- 72200, 0x84, 0x00, 4, +- 72200, 4, 0x00, 4, - 8, 16, 32, 32, 32, 40104 }, + 72200, 4, 4, 8, 16, 32, 32, 32 }, { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 108000, /* 108 Mb */ -- 92900, 0x85, 0x00, 5, +- 92900, 5, 0x00, 5, - 8, 17, 33, 33, 33, 53476 }, + 92900, 5, 5, 8, 17, 33, 33, 33 }, { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 121500, /* 121.5 Mb */ -- 102700, 0x86, 0x00, 6, +- 102700, 6, 0x00, 6, - 8, 18, 34, 34, 34, 60156 }, + 102700, 6, 6, 8, 18, 34, 34, 34 }, { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 135000, /* 135 Mb */ -- 112000, 0x87, 0x00, 7, +- 112000, 7, 0x00, 7, - 8, 19, 35, 36, 36, 66840 }, + 112000, 7, 7, 8, 19, 35, 36, 36 }, { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, /* 150 Mb */ -- 122000, 0x87, 0x00, 7, +- 122000, 7, 0x00, 7, - 8, 19, 35, 36, 36, 74200 }, + 122000, 7, 7, 8, 19, 35, 36, 36 }, { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 27000, /* 27 Mb */ -- 25800, 0x88, 0x00, 8, +- 25800, 8, 0x00, 8, - 8, 20, 37, 37, 37, 13360 }, + 25800, 8, 8, 8, 20, 37, 37, 37 }, { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 54000, /* 54 Mb */ -- 49800, 0x89, 0x00, 9, +- 49800, 9, 0x00, 9, - 8, 21, 38, 38, 38, 26720 }, + 49800, 9, 9, 8, 21, 38, 38, 38 }, { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 81000, /* 81 Mb */ -- 71900, 0x8a, 0x00, 10, +- 71900, 10, 0x00, 10, - 8, 22, 39, 39, 39, 40080 }, + 71900, 10, 10, 8, 22, 39, 39, 39 }, { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 108000, /* 108 Mb */ -- 92500, 0x8b, 0x00, 11, +- 92500, 11, 0x00, 11, - 8, 23, 40, 40, 40, 53440 }, + 92500, 11, 11, 8, 23, 40, 40, 40 }, { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 162000, /* 162 Mb */ -- 130300, 0x8c, 0x00, 12, +- 130300, 12, 0x00, 12, - 8, 24, 41, 41, 41, 80160 }, + 130300, 12, 12, 8, 24, 41, 41, 41 }, { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 216000, /* 216 Mb */ -- 162800, 0x8d, 0x00, 13, +- 162800, 13, 0x00, 13, - 8, 25, 42, 42, 42, 106880 }, + 162800, 13, 13, 8, 25, 42, 42, 42 }, { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 243000, /* 243 Mb */ -- 178200, 0x8e, 0x00, 14, +- 178200, 14, 0x00, 14, - 8, 26, 43, 43, 43, 120240 }, + 178200, 14, 14, 8, 26, 43, 43, 43 }, { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 270000, /* 270 Mb */ -- 192100, 0x8f, 0x00, 15, +- 192100, 15, 0x00, 15, - 8, 27, 44, 45, 45, 133600 }, + 192100, 15, 15, 8, 27, 44, 45, 45 }, { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS_HGI, 300000, /* 300 Mb */ -- 207000, 0x8f, 0x00, 15, +- 207000, 15, 0x00, 15, - 8, 27, 44, 45, 45, 148400 }, - }, + 207000, 15, 15, 8, 27, 44, 45, 45 }, @@ -387,35 +387,35 @@ 0, { { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ -- 5400, 0x0b, 0x00, (0x80|12), +- 5400, 0, 0x00, 12, - 0, 0, 0 }, + 5400, 0, 12, 0, 0, 0 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ -- 7800, 0x0f, 0x00, 18, +- 7800, 1, 0x00, 18, - 0, 1, 0 }, + 7800, 1, 18, 0, 1, 0 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ -- 10000, 0x0a, 0x00, (0x80|24), +- 10000, 2, 0x00, 24, - 2, 2, 0 }, + 10000, 2, 24, 2, 2, 0 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ -- 13900, 0x0e, 0x00, 36, +- 13900, 3, 0x00, 36, - 2, 3, 0 }, + 13900, 3, 36, 2, 3, 0 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ -- 17300, 0x09, 0x00, (0x80|48), +- 17300, 4, 0x00, 48, - 4, 4, 0 }, + 17300, 4, 48, 4, 4, 0 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ -- 23000, 0x0d, 0x00, 72, +- 23000, 5, 0x00, 72, - 4, 5, 0 }, + 23000, 5, 72, 4, 5, 0 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ -- 27400, 0x08, 0x00, 96, +- 27400, 6, 0x00, 96, - 4, 6, 0 }, + 27400, 6, 96, 4, 6, 0 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ -- 29300, 0x0c, 0x00, 108, +- 29300, 7, 0x00, 108, - 4, 7, 0 }, + 29300, 7, 108, 4, 7, 0 }, }, @@ -425,51 +425,51 @@ 0, { { VALID, VALID, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ -- 900, 0x1b, 0x00, 2, +- 900, 0, 0x00, 2, - 0, 0, 0 }, + 900, 0, 2, 0, 0, 0 }, { VALID, VALID, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */ -- 1900, 0x1a, 0x04, 4, +- 1900, 1, 0x04, 4, - 1, 1, 0 }, + 1900, 1, 4, 1, 1, 0 }, { VALID, VALID, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */ -- 4900, 0x19, 0x04, 11, +- 4900, 2, 0x04, 11, - 2, 2, 0 }, + 4900, 2, 11, 2, 2, 0 }, { VALID, VALID, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */ -- 8100, 0x18, 0x04, 22, +- 8100, 3, 0x04, 22, - 3, 3, 0 }, + 8100, 3, 22, 3, 3, 0 }, { INVALID, INVALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ -- 5400, 0x0b, 0x00, 12, +- 5400, 4, 0x00, 12, - 4, 4, 0 }, + 5400, 4, 12, 4, 4, 0 }, { INVALID, INVALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ -- 7800, 0x0f, 0x00, 18, +- 7800, 5, 0x00, 18, - 4, 5, 0 }, + 7800, 5, 18, 4, 5, 0 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ -- 10000, 0x0a, 0x00, 24, +- 10000, 6, 0x00, 24, - 6, 6, 0 }, + 10000, 6, 24, 6, 6, 0 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ -- 13900, 0x0e, 0x00, 36, +- 13900, 7, 0x00, 36, - 6, 7, 0 }, + 13900, 7, 36, 6, 7, 0 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ -- 17300, 0x09, 0x00, 48, +- 17300, 8, 0x00, 48, - 8, 8, 0 }, + 17300, 8, 48, 8, 8, 0 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ -- 23000, 0x0d, 0x00, 72, +- 23000, 9, 0x00, 72, - 8, 9, 0 }, + 23000, 9, 72, 8, 9, 0 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ -- 27400, 0x08, 0x00, 96, +- 27400, 10, 0x00, 96, - 8, 10, 0 }, + 27400, 10, 96, 8, 10, 0 }, { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ -- 29300, 0x0c, 0x00, 108, +- 29300, 11, 0x00, 108, - 8, 11, 0 }, + 29300, 11, 108, 8, 11, 0 }, }, From 9e004422776cb2b06c280013be5ee08099614809 Mon Sep 17 00:00:00 2001 From: kaloz Date: Wed, 18 Nov 2009 10:13:40 +0000 Subject: [PATCH 187/288] fix grub image target dependency git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18446 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/x86/image/Config.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/x86/image/Config.in b/target/linux/x86/image/Config.in index 8768e7cbe..3883f8900 100644 --- a/target/linux/x86/image/Config.in +++ b/target/linux/x86/image/Config.in @@ -1,6 +1,6 @@ config X86_GRUB_IMAGES bool "Build GRUB images (Linux x86 or x86_64 host only)" - depends !TARGET_x86_olpc + depends TARGET_x86 && !TARGET_x86_olpc depends TARGET_ROOTFS_EXT2FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS || TARGET_ROOTFS_ISO select PACKAGE_grub default y From 84e70968c8a4e34427d509ac58ca39e87dd4ce2a Mon Sep 17 00:00:00 2001 From: matteo Date: Wed, 18 Nov 2009 17:05:42 +0000 Subject: [PATCH 188/288] ar71xx: add Ubiquiti Rocket M and Nanostation M support git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18447 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../ar71xx/files/arch/mips/ar71xx/mach-ubnt.c | 80 ++++++++++++------- .../ar71xx/files/arch/mips/ar71xx/prom.c | 7 +- .../mips/include/asm/mach-ar71xx/ar71xx.h | 3 +- 3 files changed, 56 insertions(+), 34 deletions(-) diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c index 5ba0c8709..40490bb5d 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c @@ -34,11 +34,11 @@ #define UBNT_LS_SR71_GPIO_LED_D27 6 #define UBNT_LS_SR71_GPIO_LED_D28 7 -#define UBNT_BULLET_M_GPIO_LED_L1 0 -#define UBNT_BULLET_M_GPIO_LED_L2 1 -#define UBNT_BULLET_M_GPIO_LED_L3 11 -#define UBNT_BULLET_M_GPIO_LED_L4 7 -#define UBNT_BULLET_M_GPIO_BTN_RESET 12 +#define UBNT_M_GPIO_LED_L1 0 +#define UBNT_M_GPIO_LED_L2 1 +#define UBNT_M_GPIO_LED_L3 11 +#define UBNT_M_GPIO_LED_L4 7 +#define UBNT_M_GPIO_BTN_RESET 12 #define UBNT_BUTTONS_POLL_INTERVAL 20 @@ -107,22 +107,22 @@ static struct gpio_led ubnt_ls_sr71_leds_gpio[] __initdata = { } }; -static struct gpio_led ubnt_bullet_m_leds_gpio[] __initdata = { +static struct gpio_led ubnt_m_leds_gpio[] __initdata = { { .name = "ubnt:red:link1", - .gpio = UBNT_BULLET_M_GPIO_LED_L1, + .gpio = UBNT_M_GPIO_LED_L1, .active_low = 0, }, { .name = "ubnt:orange:link2", - .gpio = UBNT_BULLET_M_GPIO_LED_L2, + .gpio = UBNT_M_GPIO_LED_L2, .active_low = 0, }, { .name = "ubnt:green:link3", - .gpio = UBNT_BULLET_M_GPIO_LED_L3, + .gpio = UBNT_M_GPIO_LED_L3, .active_low = 0, }, { .name = "ubnt:green:link4", - .gpio = UBNT_BULLET_M_GPIO_LED_L4, + .gpio = UBNT_M_GPIO_LED_L4, .active_low = 0, } }; @@ -138,13 +138,13 @@ static struct gpio_button ubnt_gpio_buttons[] __initdata = { } }; -static struct gpio_button ubnt_bullet_m_gpio_buttons[] __initdata = { +static struct gpio_button ubnt_m_gpio_buttons[] __initdata = { { .desc = "reset", .type = EV_KEY, .code = BTN_0, .threshold = 5, - .gpio = UBNT_BULLET_M_GPIO_BTN_RESET, + .gpio = UBNT_M_GPIO_BTN_RESET, .active_low = 1, } }; @@ -247,7 +247,7 @@ static void __init ubnt_lssr71_setup(void) MIPS_MACHINE(AR71XX_MACH_UBNT_LSSR71, "Ubiquiti LS-SR71", ubnt_lssr71_setup); #ifdef CONFIG_PCI -static struct ar71xx_pci_irq ubnt_bullet_m_pci_irqs[] __initdata = { +static struct ar71xx_pci_irq ubnt_m_pci_irqs[] __initdata = { { .slot = 0, .pin = 1, @@ -255,35 +255,36 @@ static struct ar71xx_pci_irq ubnt_bullet_m_pci_irqs[] __initdata = { } }; -static struct ath9k_platform_data ubnt_bullet_m_wmac_data; +static struct ath9k_platform_data ubnt_m_wmac_data; -static int ubmnt_bullet_m_pci_plat_dev_init(struct pci_dev *dev) +static int ubmnt_m_pci_plat_dev_init(struct pci_dev *dev) { - dev->dev.platform_data = &ubnt_bullet_m_wmac_data; + dev->dev.platform_data = &ubnt_m_wmac_data; return 0; } -static void __init ubnt_bullet_m_pci_init(void) +static void __init ubnt_m_pci_init(void) { u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - memcpy(ubnt_bullet_m_wmac_data.eeprom_data, ee, - sizeof(ubnt_bullet_m_wmac_data.eeprom_data)); + memcpy(ubnt_m_wmac_data.eeprom_data, ee, + sizeof(ubnt_m_wmac_data.eeprom_data)); - ar71xx_pci_plat_dev_init = ubmnt_bullet_m_pci_plat_dev_init; + ar71xx_pci_plat_dev_init = ubmnt_m_pci_plat_dev_init; - ar71xx_pci_init(ARRAY_SIZE(ubnt_bullet_m_pci_irqs), - ubnt_bullet_m_pci_irqs); + ar71xx_pci_init(ARRAY_SIZE(ubnt_m_pci_irqs), + ubnt_m_pci_irqs); } #else -static inline void ubnt_bullet_m_pci_init(void) { }; +static inline void ubnt_m_pci_init(void) { }; #endif /* CONFIG_PCI */ -static void __init ubnt_bullet_m_setup(void) +static void __init ubnt_m_setup(void) { u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000); ar71xx_set_mac_base(mac); + ar71xx_add_device_spi(NULL, ubnt_spi_info, ARRAY_SIZE(ubnt_spi_info)); @@ -297,14 +298,31 @@ static void __init ubnt_bullet_m_setup(void) ar71xx_add_device_eth(0); - ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(ubnt_bullet_m_leds_gpio), - ubnt_bullet_m_leds_gpio); + ubnt_m_pci_init(); + + ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(ubnt_m_leds_gpio), + ubnt_m_leds_gpio); ar71xx_add_device_gpio_buttons(-1, UBNT_BUTTONS_POLL_INTERVAL, - ARRAY_SIZE(ubnt_bullet_m_gpio_buttons), - ubnt_bullet_m_gpio_buttons); - - ubnt_bullet_m_pci_init(); + ARRAY_SIZE(ubnt_m_gpio_buttons), + ubnt_m_gpio_buttons); } -MIPS_MACHINE(AR71XX_MACH_UBNT_BULLET_M, "Ubiquiti Bullet M", ubnt_bullet_m_setup); +MIPS_MACHINE(AR71XX_MACH_UBNT_M, "Ubiquiti Bullet/Rocket M", ubnt_m_setup); + +/* TODO detect the second ethernet port and use one + init function for all Ubiquiti MIMO series products */ +static void __init ubnt_nano_m_setup(void) +{ + ubnt_m_setup(); + + ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; + ar71xx_eth1_data.phy_mask = 0; + + ar71xx_eth1_data.speed = SPEED_1000; + ar71xx_eth1_data.duplex = DUPLEX_FULL; + + ar71xx_add_device_eth(1); +} + +MIPS_MACHINE(AR71XX_MACH_UBNT_NANO_M, "Ubiquiti Nanostation M", ubnt_nano_m_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/prom.c b/target/linux/ar71xx/files/arch/mips/ar71xx/prom.c index 43d663243..9b6747210 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/prom.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/prom.c @@ -83,8 +83,11 @@ static struct board_rec boards[] __initdata = { .name = "UBNT-LSX", .mach_type = AR71XX_MACH_UBNT_LSX, }, { - .name = "UBNT-BM", - .mach_type = AR71XX_MACH_UBNT_BULLET_M, + .name = "UBNT-M", + .mach_type = AR71XX_MACH_UBNT_M, + }, { + .name = "UBNT-NM", + .mach_type = AR71XX_MACH_UBNT_NANO_M, }, { .name = "WNDR3700", .mach_type = AR71XX_MACH_WNDR3700, diff --git a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h index 2388acaba..8584562e9 100644 --- a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h +++ b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h @@ -140,7 +140,8 @@ enum ar71xx_mach_type { AR71XX_MACH_UBNT_LSX, /* Ubiquiti LSX */ AR71XX_MACH_UBNT_RS, /* Ubiquiti RouterStation */ AR71XX_MACH_UBNT_RSPRO, /* Ubiquiti RouterStation Pro */ - AR71XX_MACH_UBNT_BULLET_M, /* Ubiquiti Bullet M */ + AR71XX_MACH_UBNT_M, /* Ubiquiti Bullet M */ + AR71XX_MACH_UBNT_NANO_M, /* Ubiquiti Bullet M */ AR71XX_MACH_WNR2000, /* NETGEAR WNR2000 */ AR71XX_MACH_WNDR3700, /* NETGEAR WNDR3700 */ AR71XX_MACH_WP543, /* Compex WP543 */ From b4d4ad1eb5bd221c172d8d39d837b8f4adfe1e49 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 18 Nov 2009 18:10:24 +0000 Subject: [PATCH 189/288] mkfwimage: add support for the XM layout (bullet/rocket/nano M) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18448 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- tools/firmware-utils/src/mkfwimage.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/firmware-utils/src/mkfwimage.c b/tools/firmware-utils/src/mkfwimage.c index 83ce6cf3d..ff84d8319 100644 --- a/tools/firmware-utils/src/mkfwimage.c +++ b/tools/firmware-utils/src/mkfwimage.c @@ -75,6 +75,12 @@ fw_layout_t fw_layout_data[] = { .kern_entry = 0x80041000, .firmware_max_length= 0x006C0000, }, + { + .name = "XM", + .kern_start = 0x9f050000, + .kern_entry = 0x80002000, + .firmware_max_length= 0x006A0000, + }, { .name = "", }, }; @@ -179,7 +185,7 @@ static void usage(const char* progname) "\t-o \t - firmware output file, default: %s\n" "\t-k \t\t - kernel file\n" "\t-r \t\t - rootfs file\n" - "\t-B \t\t - choose firmware layout for specified board (XS2, XS5, RS)\n" + "\t-B \t\t - choose firmware layout for specified board (XS2, XS5, RS, XM)\n" "\t-h\t\t\t - this help\n", VERSION, progname, DEFAULT_VERSION, DEFAULT_OUTPUT_FILE); } From e831d25f6b1b63e66fd6408141e86a80b68a9269 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 18 Nov 2009 18:10:28 +0000 Subject: [PATCH 190/288] ar71xx: enable command-line mtd map parsing git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18449 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/config-2.6.28 | 1 + target/linux/ar71xx/config-2.6.30 | 1 + target/linux/ar71xx/config-2.6.31 | 1 + 3 files changed, 3 insertions(+) diff --git a/target/linux/ar71xx/config-2.6.28 b/target/linux/ar71xx/config-2.6.28 index 1a9ca7c77..21a65eeb1 100644 --- a/target/linux/ar71xx/config-2.6.28 +++ b/target/linux/ar71xx/config-2.6.28 @@ -129,6 +129,7 @@ CONFIG_MIPS=y CONFIG_MTD_AR91XX_FLASH=y # CONFIG_MTD_CFI_INTELEXT is not set # CONFIG_MTD_CFI is not set +CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_JEDECPROBE=y CONFIG_MTD_M25P80=y CONFIG_MTD_MYLOADER_PARTS=y diff --git a/target/linux/ar71xx/config-2.6.30 b/target/linux/ar71xx/config-2.6.30 index 76c4829fd..640f06fb9 100644 --- a/target/linux/ar71xx/config-2.6.30 +++ b/target/linux/ar71xx/config-2.6.30 @@ -134,6 +134,7 @@ CONFIG_MIPS=y CONFIG_MTD_AR91XX_FLASH=y # CONFIG_MTD_CFI_INTELEXT is not set # CONFIG_MTD_CFI is not set +CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_JEDECPROBE=y CONFIG_MTD_M25P80=y CONFIG_MTD_MYLOADER_PARTS=y diff --git a/target/linux/ar71xx/config-2.6.31 b/target/linux/ar71xx/config-2.6.31 index 9d92bec78..4ffdd5acd 100644 --- a/target/linux/ar71xx/config-2.6.31 +++ b/target/linux/ar71xx/config-2.6.31 @@ -137,6 +137,7 @@ CONFIG_MIPS=y CONFIG_MTD_AR91XX_FLASH=y # CONFIG_MTD_CFI_INTELEXT is not set # CONFIG_MTD_CFI is not set +CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_JEDECPROBE=y CONFIG_MTD_M25P80=y CONFIG_MTD_MYLOADER_PARTS=y From dc54bc58f3a3368dc6735c7263560eaee700bb53 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 18 Nov 2009 18:10:33 +0000 Subject: [PATCH 191/288] ar71xx: use a separate board id for rocket m git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18450 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c | 3 ++- target/linux/ar71xx/files/arch/mips/ar71xx/prom.c | 7 +++++-- .../files/arch/mips/include/asm/mach-ar71xx/ar71xx.h | 5 +++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c index 40490bb5d..0653c2f03 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c @@ -308,7 +308,8 @@ static void __init ubnt_m_setup(void) ubnt_m_gpio_buttons); } -MIPS_MACHINE(AR71XX_MACH_UBNT_M, "Ubiquiti Bullet/Rocket M", ubnt_m_setup); +MIPS_MACHINE(AR71XX_MACH_UBNT_BULLET_M, "Ubiquiti Bullet M", ubnt_m_setup); +MIPS_MACHINE(AR71XX_MACH_UBNT_ROCKET_M, "Ubiquiti Rocket M", ubnt_m_setup); /* TODO detect the second ethernet port and use one init function for all Ubiquiti MIMO series products */ diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/prom.c b/target/linux/ar71xx/files/arch/mips/ar71xx/prom.c index 9b6747210..4cc97632a 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/prom.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/prom.c @@ -83,8 +83,11 @@ static struct board_rec boards[] __initdata = { .name = "UBNT-LSX", .mach_type = AR71XX_MACH_UBNT_LSX, }, { - .name = "UBNT-M", - .mach_type = AR71XX_MACH_UBNT_M, + .name = "UBNT-BM", + .mach_type = AR71XX_MACH_UBNT_BULLET_M, + }, { + .name = "UBNT-RM", + .mach_type = AR71XX_MACH_UBNT_ROCKET_M, }, { .name = "UBNT-NM", .mach_type = AR71XX_MACH_UBNT_NANO_M, diff --git a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h index 8584562e9..a9f288b27 100644 --- a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h +++ b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h @@ -140,8 +140,9 @@ enum ar71xx_mach_type { AR71XX_MACH_UBNT_LSX, /* Ubiquiti LSX */ AR71XX_MACH_UBNT_RS, /* Ubiquiti RouterStation */ AR71XX_MACH_UBNT_RSPRO, /* Ubiquiti RouterStation Pro */ - AR71XX_MACH_UBNT_M, /* Ubiquiti Bullet M */ - AR71XX_MACH_UBNT_NANO_M, /* Ubiquiti Bullet M */ + AR71XX_MACH_UBNT_BULLET_M, /* Ubiquiti Bullet M */ + AR71XX_MACH_UBNT_ROCKET_M, /* Ubiquiti Rocket M */ + AR71XX_MACH_UBNT_NANO_M, /* Ubiquiti NanoStation M */ AR71XX_MACH_WNR2000, /* NETGEAR WNR2000 */ AR71XX_MACH_WNDR3700, /* NETGEAR WNDR3700 */ AR71XX_MACH_WP543, /* Compex WP543 */ From a2b5bdfc5da6fe9f586edbce3c876857e0bb6017 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 18 Nov 2009 18:10:37 +0000 Subject: [PATCH 192/288] ar71xx: build images for ubnt bullet-m, rocket-m and nano-m git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18451 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/image/Makefile | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index dac7ded01..230e93603 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -138,6 +138,22 @@ define Image/Build/MyLoader $(call imgname,$(1),$(2))-16M.img endef +ubntxm_mtdlayout=mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),1024k(kernel),6528k(rootfs),256k(cfg),64k(EEPROM) +define Image/Build/UBNTXM + $(call PatchKernelLzma,$(2),$(3) $(ubntxm_mtdlayout)) + mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \ + 0x80060000 \ + -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \ + -d $(KDIR)/vmlinux-$(2).bin.lzma \ + $(KDIR)/vmlinux-$(2).uImage.bin + dd if=$(KDIR)/vmlinux-$(2).uImage.bin of=$(KDIR)/vmlinux-$(2).uImage bs=1024k conv=sync + -$(STAGING_DIR_HOST)/bin/mkfwimage \ + -B $(4) -v $(5).$(6).OpenWrt.$(REVISION) \ + -k $(KDIR)/vmlinux-$(2).uImage \ + -r $(BIN_DIR)/openwrt-$(BOARD)-root.$(1) \ + -o $(call imgname,$(1),$(2)).bin +endef + define Image/Build/UBNT $(call PatchKernelLzma,$(2),$(3)) dd if=$(KDIR)/vmlinux-$(2).bin.lzma of=$(KDIR)/vmlinux-$(2).lzma bs=64k conv=sync @@ -275,6 +291,18 @@ define Image/Build/Template/UBNT/jffs2-64k $(call Image/Build/Template/UBNT,jffs2-64k,$(1),$(2),$(3),$(4),$(5)) endef +define Image/Build/Template/UBNTXM + $(call Image/Build/UBNTXM,$(1),$(2),$(3),$(4),$(5),$(6)) +endef + +define Image/Build/Template/UBNTXM/squashfs + $(call Image/Build/Template/UBNTXM,squashfs,$(1),$(2),$(3),$(4),$(5)) +endef + +define Image/Build/Template/UBNTXM/jffs2-64k + $(call Image/Build/Template/UBNTXM,jffs2-64k,$(1),$(2),$(3),$(4),$(5)) +endef + define Image/Build/Template/Planex $(call Image/Build/Planex,$(1),$(2),$(3)) endef @@ -323,10 +351,25 @@ define Image/Build/Profile/UBNTLSSR71 $(call Image/Build/Template/UBNT/$(1),ubnt-ls-sr71,board=UBNT-LS-SR71,LS-SR71,LS-SR71,ar7100) endef +define Image/Build/Profile/UBNTBULLETM + $(call Image/Build/Template/UBNTXM/$(1),ubnt-bullet-m,board=UBNT-BM,XM,UBNTXM,ar7240) +endef + +define Image/Build/Profile/UBNTROCKETM + $(call Image/Build/Template/UBNTXM/$(1),ubnt-rocket-m,board=UBNT-RM,XM,UBNTXM,ar7240) +endef + +define Image/Build/Profile/UBNTNANOM + $(call Image/Build/Template/UBNTXM/$(1),ubnt-nano-m,board=UBNT-NM,XM,UBNTXM,ar7240) +endef + define Image/Build/Profile/UBNT $(call Image/Build/Profile/UBNTRS,$(1)) $(call Image/Build/Profile/UBNTRSPRO,$(1)) $(call Image/Build/Profile/UBNTLSSR71,$(1)) + $(call Image/Build/Profile/UBNTBULLETM,$(1)) + $(call Image/Build/Profile/UBNTROCKETM,$(1)) + $(call Image/Build/Profile/UBNTNANOM,$(1)) endef define Image/Build/Profile/MZKW04NU From f3154a2f5101b1241306547c237c41ee80b4a955 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 18 Nov 2009 18:35:31 +0000 Subject: [PATCH 193/288] ath9k: fix compiler warning without debug enabled git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18452 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../mac80211/patches/560-ath9k_rate_control_api.patch | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/package/mac80211/patches/560-ath9k_rate_control_api.patch b/package/mac80211/patches/560-ath9k_rate_control_api.patch index 912ab6872..b4f2a12ef 100644 --- a/package/mac80211/patches/560-ath9k_rate_control_api.patch +++ b/package/mac80211/patches/560-ath9k_rate_control_api.patch @@ -1148,6 +1148,15 @@ void ath_debug_stat_tx(struct ath_softc *sc, struct ath_txq *txq, struct ath_buf *bf); void ath_debug_stat_retries(struct ath_softc *sc, int rix, +@@ -170,7 +171,7 @@ static inline void ath_debug_stat_interr + } + + static inline void ath_debug_stat_rc(struct ath_softc *sc, +- struct sk_buff *skb) ++ int final_rate) + { + } + --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c @@ -255,21 +255,11 @@ static const struct file_operations fops From 2f66d7b8148ab24b19de1a5b8321a89de10e0b3e Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 19 Nov 2009 17:23:31 +0000 Subject: [PATCH 194/288] do not use the wrapper scripts for exportable toolchains internally. on some systems the wrapper scripts are broken, and their use should be opt-in git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18454 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/toolchain/Makefile | 10 ++++++++++ {toolchain/gcc => target/toolchain}/files/wrapper.sh | 0 toolchain/gcc/Makefile | 6 ------ 3 files changed, 10 insertions(+), 6 deletions(-) rename {toolchain/gcc => target/toolchain}/files/wrapper.sh (100%) diff --git a/target/toolchain/Makefile b/target/toolchain/Makefile index e9b452ec7..fa9405f6c 100644 --- a/target/toolchain/Makefile +++ b/target/toolchain/Makefile @@ -26,6 +26,8 @@ EXCLUDE_DIRS:=*/ccache \ all: compile +TOOLCHAIN_PREFIX:=$(TOOLCHAIN_BUILD_DIR)/toolchain-$(ARCH)_gcc-$(GCCV)_$(LIBC)-$(LIBCV) + $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2: clean mkdir -p $(TOOLCHAIN_BUILD_DIR) $(TAR) -cf - -C $(TOPDIR)/staging_dir/ \ @@ -36,6 +38,14 @@ $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2: clean $(CP) $(TOPDIR)/LICENSE ./files/README.TOOLCHAIN \ $(TOOLCHAIN_BUILD_DIR)/ + $(CP) ./files/wrapper.sh $(TOOLCHAIN_PREFIX)/usr/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh + chmod +x $(TOOLCHAIN_PREFIX)/usr/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh + (cd $(TOOLCHAIN_PREFIX)/usr/bin; \ + for app in cc gcc g++ c++ cpp ld as ; do \ + [ -f $(REAL_GNU_TARGET_NAME)-$${app} ] && mv $(REAL_GNU_TARGET_NAME)-$${app} $(REAL_GNU_TARGET_NAME)-$${app}.bin ; \ + ln -sf $(REAL_GNU_TARGET_NAME)-wrapper.sh $(REAL_GNU_TARGET_NAME)-$${app} ; \ + done; \ + ) echo REVISION:="$(REVISION)" > $(TOOLCHAIN_BUILD_DIR)/version.mk find $(TOOLCHAIN_BUILD_DIR) -name .git | $(XARGS) rm -rf find $(TOOLCHAIN_BUILD_DIR) -name .svn | $(XARGS) rm -rf diff --git a/toolchain/gcc/files/wrapper.sh b/target/toolchain/files/wrapper.sh similarity index 100% rename from toolchain/gcc/files/wrapper.sh rename to target/toolchain/files/wrapper.sh diff --git a/toolchain/gcc/Makefile b/toolchain/gcc/Makefile index 955248e81..ea103c453 100644 --- a/toolchain/gcc/Makefile +++ b/toolchain/gcc/Makefile @@ -246,8 +246,6 @@ define Stage2/Install $(GCC_MAKE) -C $(HOST_BUILD_DIR2) install # Set up the symlinks to enable lying about target name. set -e; \ - $(CP) ./files/wrapper.sh $(TOOLCHAIN_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh - chmod +x $(TOOLCHAIN_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-wrapper.sh (cd $(TOOLCHAIN_DIR)/usr; \ ln -sf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \ cd bin; \ @@ -255,10 +253,6 @@ define Stage2/Install ln -sf $$$${app} \ $(GNU_TARGET_NAME)$$$${app##$(REAL_GNU_TARGET_NAME)}; \ done; \ - for app in cc gcc g++ c++ cpp ld as ; do \ - [ -f $(REAL_GNU_TARGET_NAME)-$$$${app} ] && mv $(REAL_GNU_TARGET_NAME)-$$$${app} $(REAL_GNU_TARGET_NAME)-$$$${app}.bin ; \ - ln -sf $(REAL_GNU_TARGET_NAME)-wrapper.sh $(REAL_GNU_TARGET_NAME)-$$$${app} ; \ - done; \ ); $(if $(CONFIG_EXTRA_TARGET_ARCH),$(call SetupExtraArch)) endef From 7e63500a2879f77b19064291306e0ef4fd62e389 Mon Sep 17 00:00:00 2001 From: jow Date: Fri, 20 Nov 2009 23:02:35 +0000 Subject: [PATCH 195/288] [package] base-files: sysupgrade: restrict find command to plain files to avoid duplicates when generating the conffiles tgz archive git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18455 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/Makefile | 2 +- package/base-files/files/sbin/sysupgrade | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 8138f1cd4..5957f1406 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=base-files -PKG_RELEASE:=33 +PKG_RELEASE:=34 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade index a582d432f..0cf51cfb7 100755 --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -51,7 +51,8 @@ EOF add_uci_conffiles() { local file="$1" - find /etc/config /etc/passwd /etc/group /etc/dropbear /etc/firewall.user /etc/rc.local > "$file" + find /etc/config /etc/passwd /etc/group /etc/dropbear \ + /etc/firewall.user /etc/rc.local -type f > "$file" return 0 } From e57137a613fd5b787725c73674c446e3ae5104e9 Mon Sep 17 00:00:00 2001 From: kaloz Date: Sat, 21 Nov 2009 15:20:11 +0000 Subject: [PATCH 196/288] make lzo compressed initramfs selectable, too git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18457 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Config.in | 3 +++ include/kernel-defaults.mk | 1 + 2 files changed, 4 insertions(+) diff --git a/Config.in b/Config.in index 3e8475cc3..71a7c7da8 100644 --- a/Config.in +++ b/Config.in @@ -43,6 +43,9 @@ menu "Target Images" config TARGET_INITRAMFS_COMPRESSION_LZMA bool "LZMA" + + config TARGET_INITRAMFS_COMPRESSION_LZO + bool "LZO" endchoice config TARGET_ROOTFS_JFFS2 diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk index f49cbb93a..300139cab 100644 --- a/include/kernel-defaults.mk +++ b/include/kernel-defaults.mk @@ -76,6 +76,7 @@ ifeq ($(KERNEL),2.6) echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),CONFIG_INITRAMFS_COMPRESSION_GZIP=y\nCONFIG_RD_GZIP=y,# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set\n# CONFIG_RD_GZIP is not set)" >> $(LINUX_DIR)/.config echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),CONFIG_INITRAMFS_COMPRESSION_BZIP2=y\nCONFIG_RD_BZIP2=y,# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set\n# CONFIG_RD_BZIP2 is not set)" >> $(LINUX_DIR)/.config echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA),CONFIG_INITRAMFS_COMPRESSION_LZMA=y\nCONFIG_RD_LZMA=y,# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set\n# CONFIG_RD_LZMA is not set)" >> $(LINUX_DIR)/.config + echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),CONFIG_INITRAMFS_COMPRESSION_LZO=y\nCONFIG_RD_LZO=y,# CONFIG_INITRAMFS_COMPRESSION_LZO is not set\n# CONFIG_RD_LZO is not set)" >> $(LINUX_DIR)/.config endef else define Kernel/SetInitramfs From a97b8fdfaea983e45f29eacfb5b2f5d440b30ec0 Mon Sep 17 00:00:00 2001 From: kaloz Date: Sat, 21 Nov 2009 15:20:59 +0000 Subject: [PATCH 197/288] add more symbols to the generic config git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18458 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic-2.6/config-2.6.31 | 9 ++++++++- target/linux/generic-2.6/config-2.6.32 | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/target/linux/generic-2.6/config-2.6.31 b/target/linux/generic-2.6/config-2.6.31 index 2fec40966..e8c61e4f9 100644 --- a/target/linux/generic-2.6/config-2.6.31 +++ b/target/linux/generic-2.6/config-2.6.31 @@ -638,8 +638,10 @@ CONFIG_HAVE_MLOCK=y # CONFIG_HID_CYPRESS is not set # CONFIG_HID_DEBUG is not set # CONFIG_HID_DELL is not set +# CONFIG_HID_DRAGONRISE is not set # CONFIG_HID_EZKEY is not set # CONFIG_HID_FF is not set +# CONFIG_HID_GREENASIA is not set # CONFIG_HID_GYRATION is not set # CONFIG_HID is not set # CONFIG_HID_KENSINGTON is not set @@ -653,10 +655,13 @@ CONFIG_HAVE_MLOCK=y # CONFIG_HID_PID is not set # CONFIG_HIDRAW is not set # CONFIG_HID_SAMSUNG is not set +# CONFIG_HID_SMARTJOYPLUS is not set # CONFIG_HID_SONY is not set # CONFIG_HID_SUNPLUS is not set # CONFIG_HID_SUPPORT is not set +# CONFIG_HID_THRUSTMASTER is not set # CONFIG_HID_TOPSEED is not set +# CONFIG_HID_ZEROPLUS is not set # CONFIG_HIGHMEM is not set CONFIG_HIGH_RES_TIMERS=y # CONFIG_HIPPI is not set @@ -1025,10 +1030,10 @@ CONFIG_JOLIET=y # CONFIG_KALLSYMS_EXTRA_PASS is not set # CONFIG_KALLSYMS is not set # CONFIG_KARMA_PARTITION is not set -# CONFIG_KEXEC is not set # CONFIG_KERNEL_GZIP is not set CONFIG_KERNEL_LZMA=y # CONFIG_KERNEL_LZO is not set +# CONFIG_KEXEC is not set # CONFIG_KEYBOARD_LM8323 is not set # CONFIG_KEYS is not set # CONFIG_KMEMTRACE is not set @@ -2596,6 +2601,8 @@ CONFIG_VLAN_8021Q=y # CONFIG_VM_EVENT_COUNTERS is not set # CONFIG_VMSPLIT_1G is not set # CONFIG_VMSPLIT_2G is not set +# CONFIG_VMSPLIT_2G_OPT is not set +# CONFIG_VMSPLIT_3G_OPT is not set CONFIG_VMSPLIT_3G=y # CONFIG_VT6655 is not set # CONFIG_VT is not set diff --git a/target/linux/generic-2.6/config-2.6.32 b/target/linux/generic-2.6/config-2.6.32 index c60c2f6cc..2a314b7eb 100644 --- a/target/linux/generic-2.6/config-2.6.32 +++ b/target/linux/generic-2.6/config-2.6.32 @@ -647,8 +647,10 @@ CONFIG_HAVE_MLOCK=y # CONFIG_HID_CYPRESS is not set # CONFIG_HID_DEBUG is not set # CONFIG_HID_DELL is not set +# CONFIG_HID_DRAGONRISE is not set # CONFIG_HID_EZKEY is not set # CONFIG_HID_FF is not set +# CONFIG_HID_GREENASIA is not set # CONFIG_HID_GYRATION is not set # CONFIG_HID is not set # CONFIG_HID_KENSINGTON is not set @@ -662,10 +664,13 @@ CONFIG_HAVE_MLOCK=y # CONFIG_HID_PID is not set # CONFIG_HIDRAW is not set # CONFIG_HID_SAMSUNG is not set +# CONFIG_HID_SMARTJOYPLUS is not set # CONFIG_HID_SONY is not set # CONFIG_HID_SUNPLUS is not set # CONFIG_HID_SUPPORT is not set +# CONFIG_HID_THRUSTMASTER is not set # CONFIG_HID_TOPSEED is not set +# CONFIG_HID_ZEROPLUS is not set # CONFIG_HIGHMEM is not set CONFIG_HIGH_RES_TIMERS=y # CONFIG_HIPPI is not set @@ -2620,6 +2625,8 @@ CONFIG_VLAN_8021Q=y # CONFIG_VM_EVENT_COUNTERS is not set # CONFIG_VMSPLIT_1G is not set # CONFIG_VMSPLIT_2G is not set +# CONFIG_VMSPLIT_2G_OPT is not set +# CONFIG_VMSPLIT_3G_OPT is not set CONFIG_VMSPLIT_3G=y # CONFIG_VT6655 is not set # CONFIG_VT6656 is not set From 4fba0adb64e5ae81be808503d9baf46f8a1aeb2d Mon Sep 17 00:00:00 2001 From: kaloz Date: Sat, 21 Nov 2009 15:21:34 +0000 Subject: [PATCH 198/288] use CONFIG_EMBEDDED for x86, too git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18459 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/x86/config-2.6.31 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/x86/config-2.6.31 b/target/linux/x86/config-2.6.31 index 5cfc3e16f..6616001d9 100644 --- a/target/linux/x86/config-2.6.31 +++ b/target/linux/x86/config-2.6.31 @@ -93,7 +93,6 @@ CONFIG_EARLY_PRINTK=y # CONFIG_EL3 is not set CONFIG_ELF_CORE=y # CONFIG_ELPLUS is not set -# CONFIG_EMBEDDED is not set # CONFIG_EUROTECH_WDT is not set CONFIG_EXT2_FS=y CONFIG_FAST_CMPXCHG_LOCAL=y @@ -308,6 +307,7 @@ CONFIG_PHYSICAL_START=0x1000000 # CONFIG_PNPBIOS is not set CONFIG_PNP_DEBUG_MESSAGES=y CONFIG_PNP=y +# CONFIG_PROCESSOR_SELECT is not set CONFIG_PROC_PAGE_MONITOR=y # CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set CONFIG_RD_BZIP2=y @@ -406,6 +406,7 @@ CONFIG_X86_NEW_MCE=y # CONFIG_X86_PAE is not set CONFIG_X86_PAT=y CONFIG_X86_PLATFORM_DEVICES=y +CONFIG_X86_PM_TIMER=y # CONFIG_X86_POWERNOW_K6 is not set # CONFIG_X86_POWERNOW_K7 is not set CONFIG_X86_PPRO_FENCE=y From a4b548a00df5f8bcf28e7bb5093123f954eb367a Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 22 Nov 2009 07:08:39 +0000 Subject: [PATCH 199/288] build variants: only build opkg packages for the requested build variant (or any if no variant was specified for the package) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18464 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- include/package-ipkg.mk | 2 ++ package/hostapd/Makefile | 9 ++------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk index bd4e28ce3..1ddd80a8d 100644 --- a/include/package-ipkg.mk +++ b/include/package-ipkg.mk @@ -36,6 +36,7 @@ ifeq ($(DUMP),) IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1) INFO_$(1):=$(IPKG_STATE_DIR)/info/$(1).list + ifeq ($(if $(VARIANT),$(BUILD_VARIANT)),$(VARIANT)) ifdef Package/$(1)/install ifneq ($(CONFIG_PACKAGE_$(1))$(SDK)$(DEVELOPER),) compile: $$(IPKG_$(1)) $(STAGING_DIR_ROOT)/stamp/.$(1)_installed @@ -49,6 +50,7 @@ ifeq ($(DUMP),) @echo "WARNING: skipping $(1) -- package not selected" endif endif + endif IDEPEND_$(1):=$$(call filter_deps,$$(DEPENDS)) diff --git a/package/hostapd/Makefile b/package/hostapd/Makefile index 5e10ea27b..bb497fec3 100644 --- a/package/hostapd/Makefile +++ b/package/hostapd/Makefile @@ -108,7 +108,7 @@ define Build/Compile hostapd hostapd_cli endef -define Package/InstallTemplate +define Package/hostapd/install $(INSTALL_DIR) $(1)/etc/hotplug.d/net $(INSTALL_DATA) ./files/hostapd.hotplug $(1)/etc/hotplug.d/net/ $(INSTALL_DIR) $(1)/lib/wifi @@ -116,12 +116,7 @@ define Package/InstallTemplate $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/ endef - -ifeq ($(BUILD_VARIANT),full) - Package/hostapd/install = $(Package/InstallTemplate) -else - Package/hostapd-mini/install = $(Package/InstallTemplate) -endif +Package/hostapd-mini/install = $(Package/hostapd/install) define Package/hostapd-utils/install $(INSTALL_DIR) $(1)/usr/sbin From 42c7a4ae6f1f6472079c7d91660b8ac3068ab7a3 Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 22 Nov 2009 07:13:30 +0000 Subject: [PATCH 200/288] mac80211: update to compat-wireless 2009-11-21 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18465 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/Makefile | 6 +- .../mac80211/patches/002-disable_rfkill.patch | 38 +- package/mac80211/patches/010-b43_config.patch | 10 +- .../011-move_ar9170_usb_compat_code.patch | 2 +- .../mac80211/patches/012-remove_rfkill.patch | 2 +- ...h9k-fix-invalid-mac-address-handling.patch | 2 +- .../patches/404-ath_regd_optional.patch | 2 +- ...ROM-only-if-no-platform-data-present.patch | 2 +- .../patches/500-4addr_bcast_fix.patch | 11 - ...patch => 500-ath9k_rate_control_api.patch} | 22 +- ...patch => 501-ath9k_rc_table_cleanup.patch} | 0 ...fp_dma.patch => 510-ath_use_gfp_dma.patch} | 0 .../patches/510-nl80211_vlan_add_fix.patch | 20 - .../mac80211/patches/520-driver_flags.patch | 26 - .../mac80211/patches/530-ath9k_cleanup.patch | 460 ------------------ .../patches/540-monitor_tx_status.patch | 14 - .../mac80211/patches/550-ath9k_rx_fix.patch | 10 - 17 files changed, 23 insertions(+), 604 deletions(-) delete mode 100644 package/mac80211/patches/500-4addr_bcast_fix.patch rename package/mac80211/patches/{560-ath9k_rate_control_api.patch => 500-ath9k_rate_control_api.patch} (98%) rename package/mac80211/patches/{561-ath9k_rc_table_cleanup.patch => 501-ath9k_rc_table_cleanup.patch} (100%) rename package/mac80211/patches/{570-ath_use_gfp_dma.patch => 510-ath_use_gfp_dma.patch} (100%) delete mode 100644 package/mac80211/patches/510-nl80211_vlan_add_fix.patch delete mode 100644 package/mac80211/patches/520-driver_flags.patch delete mode 100644 package/mac80211/patches/530-ath9k_cleanup.patch delete mode 100644 package/mac80211/patches/540-monitor_tx_status.patch delete mode 100644 package/mac80211/patches/550-ath9k_rx_fix.patch diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile index d28e08d3a..aef79373d 100644 --- a/package/mac80211/Makefile +++ b/package/mac80211/Makefile @@ -10,12 +10,12 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=2009-11-13 -PKG_RELEASE:=2 +PKG_VERSION:=2009-11-21 +PKG_RELEASE:=1 PKG_SOURCE_URL:= \ http://www.orbit-lab.org/kernel/compat-wireless-2.6/2009/11 \ http://wireless.kernel.org/download/compat-wireless-2.6 -PKG_MD5SUM:=920c3bcfd1b4cd6079a8f9db4afe4e4f +PKG_MD5SUM:=00e80559cddaa160605098572f5c58b8 PKG_SOURCE:=compat-wireless-$(PKG_VERSION).tar.bz2 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION) diff --git a/package/mac80211/patches/002-disable_rfkill.patch b/package/mac80211/patches/002-disable_rfkill.patch index 3aab62970..c935fddf3 100644 --- a/package/mac80211/patches/002-disable_rfkill.patch +++ b/package/mac80211/patches/002-disable_rfkill.patch @@ -1,42 +1,6 @@ --- a/config.mk +++ b/config.mk -@@ -147,7 +147,7 @@ ifneq ($(CONFIG_PCI),) - - CONFIG_ATH5K=m - # CONFIG_ATH5K_DEBUG=y --CONFIG_ATH5K_RFKILL=y -+# CONFIG_ATH5K_RFKILL=y - CONFIG_ATH9K_HW=m - CONFIG_ATH9K=m - # Note: once ath9k_htc is added we'll have to move -@@ -159,7 +159,7 @@ CONFIG_ATH9K_COMMON=m - - CONFIG_IWLWIFI=m - CONFIG_IWLWIFI_LEDS=y --CONFIG_IWLWIFI_RFKILL=y -+# CONFIG_IWLWIFI_RFKILL=y - CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT=y - # CONFIG_IWLWIFI_DEBUG=y - # CONFIG_IWLWIFI_DEBUGFS=y -@@ -179,7 +179,7 @@ CONFIG_B43_PCMCIA=y - endif - CONFIG_B43_PIO=y - CONFIG_B43_LEDS=y --CONFIG_B43_RFKILL=y -+# CONFIG_B43_RFKILL=y - CONFIG_B43_PHY_LP=y - # CONFIG_B43_DEBUG=y - # CONFIG_B43_FORCE_PIO=y -@@ -189,7 +189,7 @@ CONFIG_B43LEGACY_HWRNG=y - CONFIG_B43LEGACY_PCI_AUTOSELECT=y - CONFIG_B43LEGACY_PCICORE_AUTOSELECT=y - CONFIG_B43LEGACY_LEDS=y --CONFIG_B43LEGACY_RFKILL=y -+# CONFIG_B43LEGACY_RFKILL=y - # CONFIG_B43LEGACY_DEBUG=y - CONFIG_B43LEGACY_DMA=y - CONFIG_B43LEGACY_PIO=y -@@ -422,8 +422,8 @@ endif +@@ -421,8 +421,8 @@ endif # We need the backported rfkill module on kernel < 2.6.31. # In more recent kernel versions use the in kernel rfkill module. ifdef CONFIG_COMPAT_WIRELESS_31 diff --git a/package/mac80211/patches/010-b43_config.patch b/package/mac80211/patches/010-b43_config.patch index 9074ee787..8c5253550 100644 --- a/package/mac80211/patches/010-b43_config.patch +++ b/package/mac80211/patches/010-b43_config.patch @@ -1,6 +1,6 @@ --- a/config.mk +++ b/config.mk -@@ -160,12 +160,12 @@ CONFIG_B43_HWRNG=y +@@ -160,9 +160,9 @@ CONFIG_B43_HWRNG=y CONFIG_B43_PCI_AUTOSELECT=y CONFIG_B43_PCICORE_AUTOSELECT=y ifneq ($(CONFIG_PCMCIA),) @@ -10,13 +10,9 @@ -CONFIG_B43_PIO=y +# CONFIG_B43_PIO=y CONFIG_B43_LEDS=y - # CONFIG_B43_RFKILL=y --CONFIG_B43_PHY_LP=y -+# CONFIG_B43_PHY_LP=y + CONFIG_B43_PHY_LP=y # CONFIG_B43_DEBUG=y - # CONFIG_B43_FORCE_PIO=y - -@@ -219,8 +219,8 @@ CONFIG_SSB_PCIHOST_POSSIBLE=y +@@ -217,8 +217,8 @@ CONFIG_SSB_PCIHOST_POSSIBLE=y CONFIG_SSB_PCIHOST=y CONFIG_SSB_B43_PCI_BRIDGE=y ifneq ($(CONFIG_PCMCIA),) diff --git a/package/mac80211/patches/011-move_ar9170_usb_compat_code.patch b/package/mac80211/patches/011-move_ar9170_usb_compat_code.patch index 036d56301..52b90b004 100644 --- a/package/mac80211/patches/011-move_ar9170_usb_compat_code.patch +++ b/package/mac80211/patches/011-move_ar9170_usb_compat_code.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ar9170/usb.c +++ b/drivers/net/wireless/ath/ar9170/usb.c -@@ -98,6 +98,225 @@ static struct usb_device_id ar9170_usb_i +@@ -100,6 +100,225 @@ static struct usb_device_id ar9170_usb_i }; MODULE_DEVICE_TABLE(usb, ar9170_usb_ids); diff --git a/package/mac80211/patches/012-remove_rfkill.patch b/package/mac80211/patches/012-remove_rfkill.patch index 53262edd0..a47168a05 100644 --- a/package/mac80211/patches/012-remove_rfkill.patch +++ b/package/mac80211/patches/012-remove_rfkill.patch @@ -22,7 +22,7 @@ #include --- a/include/linux/rfkill_backport.h +++ b/include/linux/rfkill_backport.h -@@ -146,7 +146,7 @@ struct rfkill_ops { +@@ -149,7 +149,7 @@ struct rfkill_ops { int (*set_block)(void *data, bool blocked); }; diff --git a/package/mac80211/patches/403-ath9k-fix-invalid-mac-address-handling.patch b/package/mac80211/patches/403-ath9k-fix-invalid-mac-address-handling.patch index 1780fc7b3..687d9e477 100644 --- a/package/mac80211/patches/403-ath9k-fix-invalid-mac-address-handling.patch +++ b/package/mac80211/patches/403-ath9k-fix-invalid-mac-address-handling.patch @@ -8,7 +8,7 @@ #include #include "hw.h" -@@ -494,8 +495,18 @@ static int ath9k_hw_init_macaddr(struct +@@ -489,8 +490,18 @@ static int ath9k_hw_init_macaddr(struct common->macaddr[2 * i] = eeval >> 8; common->macaddr[2 * i + 1] = eeval & 0xff; } diff --git a/package/mac80211/patches/404-ath_regd_optional.patch b/package/mac80211/patches/404-ath_regd_optional.patch index 58ed4bdbe..a5413697b 100644 --- a/package/mac80211/patches/404-ath_regd_optional.patch +++ b/package/mac80211/patches/404-ath_regd_optional.patch @@ -10,7 +10,7 @@ #include "regd_common.h" /* -@@ -588,3 +591,5 @@ u32 ath_regd_get_band_ctl(struct ath_reg +@@ -587,3 +590,5 @@ u32 ath_regd_get_band_ctl(struct ath_reg } } EXPORT_SYMBOL(ath_regd_get_band_ctl); diff --git a/package/mac80211/patches/406-ath9k-set-AH_USE_EEPROM-only-if-no-platform-data-present.patch b/package/mac80211/patches/406-ath9k-set-AH_USE_EEPROM-only-if-no-platform-data-present.patch index 8beb224c9..734dea030 100644 --- a/package/mac80211/patches/406-ath9k-set-AH_USE_EEPROM-only-if-no-platform-data-present.patch +++ b/package/mac80211/patches/406-ath9k-set-AH_USE_EEPROM-only-if-no-platform-data-present.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -433,11 +433,8 @@ static void ath9k_hw_init_defaults(struc +@@ -431,11 +431,8 @@ static void ath9k_hw_init_defaults(struc ah->hw_version.magic = AR5416_MAGIC; ah->hw_version.subvendorid = 0; diff --git a/package/mac80211/patches/500-4addr_bcast_fix.patch b/package/mac80211/patches/500-4addr_bcast_fix.patch deleted file mode 100644 index 3143aaf8f..000000000 --- a/package/mac80211/patches/500-4addr_bcast_fix.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -1236,7 +1236,7 @@ ieee80211_deliver_skb(struct ieee80211_r - if ((sdata->vif.type == NL80211_IFTYPE_AP || - sdata->vif.type == NL80211_IFTYPE_AP_VLAN) && - !(sdata->flags & IEEE80211_SDATA_DONT_BRIDGE_PACKETS) && -- (rx->flags & IEEE80211_RX_RA_MATCH)) { -+ (rx->flags & IEEE80211_RX_RA_MATCH) && !rx->sdata->use_4addr) { - if (is_multicast_ether_addr(ehdr->h_dest)) { - /* - * send multicast frames both to higher layers in diff --git a/package/mac80211/patches/560-ath9k_rate_control_api.patch b/package/mac80211/patches/500-ath9k_rate_control_api.patch similarity index 98% rename from package/mac80211/patches/560-ath9k_rate_control_api.patch rename to package/mac80211/patches/500-ath9k_rate_control_api.patch index b4f2a12ef..fe476cb25 100644 --- a/package/mac80211/patches/560-ath9k_rate_control_api.patch +++ b/package/mac80211/patches/500-ath9k_rate_control_api.patch @@ -750,7 +750,7 @@ minlen = (nsymbols * nsymbits) / BITS_PER_BYTE; if (frmlen < minlen) { -@@ -1430,22 +1458,14 @@ static int setup_tx_flags(struct ath_sof +@@ -1425,22 +1453,14 @@ static int setup_tx_flags(struct ath_sof static u32 ath_pkt_duration(struct ath_softc *sc, u8 rix, struct ath_buf *bf, int width, int half_gi, bool shortPreamble) { @@ -774,7 +774,7 @@ nsymbols = (nbits + nsymbits - 1) / nsymbits; if (!half_gi) -@@ -1454,7 +1474,7 @@ static u32 ath_pkt_duration(struct ath_s +@@ -1449,7 +1469,7 @@ static u32 ath_pkt_duration(struct ath_s duration = SYMBOL_TIME_HALFGI(nsymbols); /* addup duration for legacy/ht training and signal fields */ @@ -783,7 +783,7 @@ duration += L_STF + L_LTF + L_SIG + HT_SIG + HT_STF + HT_LTF(streams); return duration; -@@ -1463,11 +1483,11 @@ static u32 ath_pkt_duration(struct ath_s +@@ -1458,11 +1478,11 @@ static u32 ath_pkt_duration(struct ath_s static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf) { struct ath_common *common = ath9k_hw_common(sc->sc_ah); @@ -796,7 +796,7 @@ struct ieee80211_hdr *hdr; int i, flags = 0; u8 rix = 0, ctsrate = 0; -@@ -1486,11 +1506,10 @@ static void ath_buf_set_rate(struct ath_ +@@ -1481,11 +1501,10 @@ static void ath_buf_set_rate(struct ath_ * checking the BSS's global flag. * But for the rate series, IEEE80211_TX_RC_USE_SHORT_PREAMBLE is used. */ @@ -811,7 +811,7 @@ /* * ATH9K_TXDESC_RTSENA and ATH9K_TXDESC_CTSENA are mutually exclusive. -@@ -1513,6 +1532,9 @@ static void ath_buf_set_rate(struct ath_ +@@ -1508,6 +1527,9 @@ static void ath_buf_set_rate(struct ath_ flags &= ~(ATH9K_TXDESC_RTSENA); for (i = 0; i < 4; i++) { @@ -821,7 +821,7 @@ if (!rates[i].count || (rates[i].idx < 0)) continue; -@@ -1520,12 +1542,6 @@ static void ath_buf_set_rate(struct ath_ +@@ -1515,12 +1537,6 @@ static void ath_buf_set_rate(struct ath_ series[i].Tries = rates[i].count; series[i].ChSel = common->tx_chainmask; @@ -834,7 +834,7 @@ if (rates[i].flags & IEEE80211_TX_RC_USE_RTS_CTS) series[i].RateFlags |= ATH9K_RATESERIES_RTS_CTS; if (rates[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH) -@@ -1533,10 +1549,36 @@ static void ath_buf_set_rate(struct ath_ +@@ -1528,10 +1544,36 @@ static void ath_buf_set_rate(struct ath_ if (rates[i].flags & IEEE80211_TX_RC_SHORT_GI) series[i].RateFlags |= ATH9K_RATESERIES_HALFGI; @@ -875,7 +875,7 @@ } /* set dur_update_en for l-sig computation except for PS-Poll frames */ -@@ -1925,8 +1967,10 @@ static void ath_tx_rc_status(struct ath_ +@@ -1920,8 +1962,10 @@ static void ath_tx_rc_status(struct ath_ } } @@ -897,7 +897,7 @@ #include "debug.h" #include "common.h" -@@ -433,6 +432,7 @@ struct ath_led { +@@ -423,6 +422,7 @@ struct ath_led { #define SC_OP_BT_PRIORITY_DETECTED BIT(21) struct ath_wiphy; @@ -905,7 +905,7 @@ struct ath_softc { struct ieee80211_hw *hw; -@@ -477,9 +477,8 @@ struct ath_softc { +@@ -467,9 +467,8 @@ struct ath_softc { struct ath_rx rx; struct ath_tx tx; struct ath_beacon beacon; @@ -1223,7 +1223,7 @@ } --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h -@@ -670,7 +670,7 @@ bool ath9k_hw_wait(struct ath_hw *ah, u3 +@@ -647,7 +647,7 @@ bool ath9k_hw_wait(struct ath_hw *ah, u3 u32 ath9k_hw_reverse_bits(u32 val, u32 n); bool ath9k_get_channel_edges(struct ath_hw *ah, u16 flags, u16 *low, u16 *high); u16 ath9k_hw_computetxtime(struct ath_hw *ah, diff --git a/package/mac80211/patches/561-ath9k_rc_table_cleanup.patch b/package/mac80211/patches/501-ath9k_rc_table_cleanup.patch similarity index 100% rename from package/mac80211/patches/561-ath9k_rc_table_cleanup.patch rename to package/mac80211/patches/501-ath9k_rc_table_cleanup.patch diff --git a/package/mac80211/patches/570-ath_use_gfp_dma.patch b/package/mac80211/patches/510-ath_use_gfp_dma.patch similarity index 100% rename from package/mac80211/patches/570-ath_use_gfp_dma.patch rename to package/mac80211/patches/510-ath_use_gfp_dma.patch diff --git a/package/mac80211/patches/510-nl80211_vlan_add_fix.patch b/package/mac80211/patches/510-nl80211_vlan_add_fix.patch deleted file mode 100644 index e0cdaead1..000000000 --- a/package/mac80211/patches/510-nl80211_vlan_add_fix.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -1813,7 +1813,7 @@ static int nl80211_get_station(struct sk - } - - /* -- * Get vlan interface making sure it is on the right wiphy. -+ * Get vlan interface making sure it is running and on the right wiphy. - */ - static int get_vlan(struct genl_info *info, - struct cfg80211_registered_device *rdev, -@@ -1831,6 +1831,8 @@ static int get_vlan(struct genl_info *in - return -EINVAL; - if ((*vlan)->ieee80211_ptr->wiphy != &rdev->wiphy) - return -EINVAL; -+ if (!netif_running(*vlan)) -+ return -ENETDOWN; - } - return 0; - } diff --git a/package/mac80211/patches/520-driver_flags.patch b/package/mac80211/patches/520-driver_flags.patch deleted file mode 100644 index 13d85ee1e..000000000 --- a/package/mac80211/patches/520-driver_flags.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -390,10 +390,12 @@ struct ieee80211_tx_rate { - * @control: union for control data - * @status: union for status data - * @driver_data: array of driver_data pointers -- * @ampdu_ack_len: number of aggregated frames. -+ * @ampdu_ack_len: number of acked aggregated frames. - * relevant only if IEEE80211_TX_STATUS_AMPDU was set. - * @ampdu_ack_map: block ack bit map for the aggregation. - * relevant only if IEEE80211_TX_STATUS_AMPDU was set. -+ * @ampdu_len: number of aggregated frames. -+ * relevant only if IEEE80211_TX_STATUS_AMPDU was set. - * @ack_signal: signal strength of the ACK frame - */ - struct ieee80211_tx_info { -@@ -428,7 +430,8 @@ struct ieee80211_tx_info { - u8 ampdu_ack_len; - u64 ampdu_ack_map; - int ack_signal; -- /* 8 bytes free */ -+ u8 ampdu_len; -+ /* 7 bytes free */ - } status; - struct { - struct ieee80211_tx_rate driver_rates[ diff --git a/package/mac80211/patches/530-ath9k_cleanup.patch b/package/mac80211/patches/530-ath9k_cleanup.patch deleted file mode 100644 index ab205d573..000000000 --- a/package/mac80211/patches/530-ath9k_cleanup.patch +++ /dev/null @@ -1,460 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/common.h -+++ b/drivers/net/wireless/ath/ath9k/common.h -@@ -81,6 +81,7 @@ struct ath_buf { - u16 bf_flags; - struct ath_buf_state bf_state; - dma_addr_t bf_dmacontext; -+ struct ath_wiphy *aphy; - }; - - struct ath_atx_tid { ---- a/drivers/net/wireless/ath/ath9k/rc.h -+++ b/drivers/net/wireless/ath/ath9k/rc.h -@@ -167,24 +167,18 @@ struct ath_rate_priv { - struct ath_rate_softc *asc; - }; - -+#define ATH_TX_INFO_FRAME_TYPE_INTERNAL (1 << 0) -+#define ATH_TX_INFO_FRAME_TYPE_PAUSE (1 << 1) -+#define ATH_TX_INFO_UPDATE_RC (1 << 2) -+#define ATH_TX_INFO_XRETRY (1 << 3) -+#define ATH_TX_INFO_UNDERRUN (1 << 4) -+ - enum ath9k_internal_frame_type { - ATH9K_NOT_INTERNAL, - ATH9K_INT_PAUSE, - ATH9K_INT_UNPAUSE - }; - --struct ath_tx_info_priv { -- struct ath_wiphy *aphy; -- struct ath_tx_status tx; -- int n_frames; -- int n_bad_frames; -- bool update_rc; -- enum ath9k_internal_frame_type frame_type; --}; -- --#define ATH_TX_INFO_PRIV(tx_info) \ -- ((struct ath_tx_info_priv *)((tx_info)->rate_driver_data[0])) -- - void ath_rate_attach(struct ath_softc *sc); - u8 ath_rate_findrateix(struct ath_softc *sc, u8 dot11_rate); - int ath_rate_control_register(void); ---- a/drivers/net/wireless/ath/ath9k/virtual.c -+++ b/drivers/net/wireless/ath/ath9k/virtual.c -@@ -338,13 +338,11 @@ void ath9k_wiphy_chan_work(struct work_s - void ath9k_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) - { - struct ath_wiphy *aphy = hw->priv; -- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); -- struct ath_tx_info_priv *tx_info_priv = ATH_TX_INFO_PRIV(tx_info); - -- if (tx_info_priv && tx_info_priv->frame_type == ATH9K_INT_PAUSE && -+ if ((tx_info->pad[0] & ATH_TX_INFO_FRAME_TYPE_PAUSE) && - aphy->state == ATH_WIPHY_PAUSING) { -- if (!(info->flags & IEEE80211_TX_STAT_ACK)) { -+ if (!(tx_info->flags & IEEE80211_TX_STAT_ACK)) { - printk(KERN_DEBUG "ath9k: %s: no ACK for pause " - "frame\n", wiphy_name(hw->wiphy)); - /* -@@ -363,9 +361,6 @@ void ath9k_tx_status(struct ieee80211_hw - } - } - -- kfree(tx_info_priv); -- tx_info->rate_driver_data[0] = NULL; -- - dev_kfree_skb(skb); - } - ---- a/drivers/net/wireless/ath/ath9k/xmit.c -+++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -251,6 +251,7 @@ static struct ath_buf* ath_clone_txbuf(s - - ATH_TXBUF_RESET(tbf); - -+ tbf->aphy = bf->aphy; - tbf->bf_mpdu = bf->bf_mpdu; - tbf->bf_buf_addr = bf->bf_buf_addr; - *(tbf->bf_desc) = *(bf->bf_desc); -@@ -270,7 +271,6 @@ static void ath_tx_complete_aggr(struct - struct ieee80211_hw *hw; - struct ieee80211_hdr *hdr; - struct ieee80211_tx_info *tx_info; -- struct ath_tx_info_priv *tx_info_priv; - struct ath_atx_tid *tid = NULL; - struct ath_buf *bf_next, *bf_last = bf->bf_lastbf; - struct ath_desc *ds = bf_last->bf_desc; -@@ -284,8 +284,7 @@ static void ath_tx_complete_aggr(struct - hdr = (struct ieee80211_hdr *)skb->data; - - tx_info = IEEE80211_SKB_CB(skb); -- tx_info_priv = (struct ath_tx_info_priv *) tx_info->rate_driver_data[0]; -- hw = tx_info_priv->aphy->hw; -+ hw = bf->aphy->hw; - - rcu_read_lock(); - -@@ -464,7 +463,6 @@ static u32 ath_lookup_rate(struct ath_so - struct sk_buff *skb; - struct ieee80211_tx_info *tx_info; - struct ieee80211_tx_rate *rates; -- struct ath_tx_info_priv *tx_info_priv; - u32 max_4ms_framelen, frmlen; - u16 aggr_limit, legacy = 0; - int i; -@@ -472,7 +470,6 @@ static u32 ath_lookup_rate(struct ath_so - skb = bf->bf_mpdu; - tx_info = IEEE80211_SKB_CB(skb); - rates = tx_info->control.rates; -- tx_info_priv = (struct ath_tx_info_priv *)tx_info->rate_driver_data[0]; - - /* - * Find the lowest frame length among the rate series that will have a -@@ -1560,21 +1557,26 @@ static int ath_tx_setup_buffer(struct ie - struct ath_softc *sc = aphy->sc; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; -- struct ath_tx_info_priv *tx_info_priv; - int hdrlen; - __le16 fc; - -- tx_info_priv = kzalloc(sizeof(*tx_info_priv), GFP_ATOMIC); -- if (unlikely(!tx_info_priv)) -- return -ENOMEM; -- tx_info->rate_driver_data[0] = tx_info_priv; -- tx_info_priv->aphy = aphy; -- tx_info_priv->frame_type = txctl->frame_type; -+ tx_info->pad[0] = 0; -+ switch (txctl->frame_type) { -+ case ATH9K_NOT_INTERNAL: -+ break; -+ case ATH9K_INT_PAUSE: -+ tx_info->pad[0] |= ATH_TX_INFO_FRAME_TYPE_PAUSE; -+ /* fall through */ -+ case ATH9K_INT_UNPAUSE: -+ tx_info->pad[0] |= ATH_TX_INFO_FRAME_TYPE_INTERNAL; -+ break; -+ } - hdrlen = ieee80211_get_hdrlen_from_skb(skb); - fc = hdr->frame_control; - - ATH_TXBUF_RESET(bf); - -+ bf->aphy = aphy; - bf->bf_frmlen = skb->len + FCS_LEN - (hdrlen & 3); - - if (conf_is_ht(&hw->conf) && !is_pae(skb)) -@@ -1599,8 +1601,6 @@ static int ath_tx_setup_buffer(struct ie - skb->len, DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(sc->dev, bf->bf_dmacontext))) { - bf->bf_mpdu = NULL; -- kfree(tx_info_priv); -- tx_info->rate_driver_data[0] = NULL; - ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, - "dma_mapping_error() on TX\n"); - return -ENOMEM; -@@ -1781,27 +1781,17 @@ exit: - /*****************/ - - static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, -- int tx_flags) -+ struct ath_wiphy *aphy, int tx_flags) - { - struct ieee80211_hw *hw = sc->hw; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); -- struct ath_tx_info_priv *tx_info_priv = ATH_TX_INFO_PRIV(tx_info); - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - int hdrlen, padsize; -- int frame_type = ATH9K_NOT_INTERNAL; - - ath_print(common, ATH_DBG_XMIT, "TX complete: skb: %p\n", skb); - -- if (tx_info_priv) { -- hw = tx_info_priv->aphy->hw; -- frame_type = tx_info_priv->frame_type; -- } -- -- if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK || -- tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) { -- kfree(tx_info_priv); -- tx_info->rate_driver_data[0] = NULL; -- } -+ if (aphy) -+ hw = aphy->hw; - - if (tx_flags & ATH_TX_BAR) - tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; -@@ -1833,10 +1823,10 @@ static void ath_tx_complete(struct ath_s - SC_OP_WAIT_FOR_TX_ACK)); - } - -- if (frame_type == ATH9K_NOT_INTERNAL) -- ieee80211_tx_status(hw, skb); -- else -+ if (unlikely(tx_info->pad[0] & ATH_TX_INFO_FRAME_TYPE_INTERNAL)) - ath9k_tx_status(hw, skb); -+ else -+ ieee80211_tx_status(hw, skb); - } - - static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, -@@ -1859,7 +1849,7 @@ static void ath_tx_complete_buf(struct a - } - - dma_unmap_single(sc->dev, bf->bf_dmacontext, skb->len, DMA_TO_DEVICE); -- ath_tx_complete(sc, skb, tx_flags); -+ ath_tx_complete(sc, skb, bf->aphy, tx_flags); - ath_debug_stat_tx(sc, txq, bf); - - /* -@@ -1907,8 +1897,7 @@ static void ath_tx_rc_status(struct ath_ - struct sk_buff *skb = bf->bf_mpdu; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); -- struct ath_tx_info_priv *tx_info_priv = ATH_TX_INFO_PRIV(tx_info); -- struct ieee80211_hw *hw = tx_info_priv->aphy->hw; -+ struct ieee80211_hw *hw = bf->aphy->hw; - u8 i, tx_rateindex; - - if (txok) -@@ -1917,17 +1906,22 @@ static void ath_tx_rc_status(struct ath_ - tx_rateindex = ds->ds_txstat.ts_rateindex; - WARN_ON(tx_rateindex >= hw->max_rates); - -- tx_info_priv->update_rc = update_rc; -+ if (update_rc) -+ tx_info->pad[0] |= ATH_TX_INFO_UPDATE_RC; - if (ds->ds_txstat.ts_status & ATH9K_TXERR_FILT) - tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED; - - if ((ds->ds_txstat.ts_status & ATH9K_TXERR_FILT) == 0 && - (bf->bf_flags & ATH9K_TXDESC_NOACK) == 0 && update_rc) { - if (ieee80211_is_data(hdr->frame_control)) { -- memcpy(&tx_info_priv->tx, &ds->ds_txstat, -- sizeof(tx_info_priv->tx)); -- tx_info_priv->n_frames = bf->bf_nframes; -- tx_info_priv->n_bad_frames = nbad; -+ if (ds->ds_txstat.ts_flags & -+ (ATH9K_TX_DATA_UNDERRUN | ATH9K_TX_DELIM_UNDERRUN)) -+ tx_info->pad[0] |= ATH_TX_INFO_UNDERRUN; -+ if ((ds->ds_txstat.ts_status & ATH9K_TXERR_XRETRY) || -+ (ds->ds_txstat.ts_status & ATH9K_TXERR_FIFO)) -+ tx_info->pad[0] |= ATH_TX_INFO_XRETRY; -+ tx_info->status.ampdu_len = bf->bf_nframes; -+ tx_info->status.ampdu_ack_len = bf->bf_nframes - nbad; - } - } - ---- a/drivers/net/wireless/ath/ath9k/debug.c -+++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -257,14 +257,17 @@ static const struct file_operations fops - - void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb) - { -- struct ath_tx_info_priv *tx_info_priv = NULL; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ieee80211_tx_rate *rates = tx_info->status.rates; -- int final_ts_idx, idx; -+ int final_ts_idx = 0, idx, i; - struct ath_rc_stats *stats; - -- tx_info_priv = ATH_TX_INFO_PRIV(tx_info); -- final_ts_idx = tx_info_priv->tx.ts_rateindex; -+ for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { -+ if (!rates[i].count) -+ break; -+ -+ final_ts_idx = i; -+ } - idx = rates[final_ts_idx].idx; - stats = &sc->debug.stats.rcstats[idx]; - stats->success++; ---- a/drivers/net/wireless/ath/ath9k/rc.c -+++ b/drivers/net/wireless/ath/ath9k/rc.c -@@ -859,12 +859,12 @@ static void ath_get_rate(void *priv, str - static bool ath_rc_update_per(struct ath_softc *sc, - const struct ath_rate_table *rate_table, - struct ath_rate_priv *ath_rc_priv, -- struct ath_tx_info_priv *tx_info_priv, -+ struct ieee80211_tx_info *tx_info, - int tx_rate, int xretries, int retries, - u32 now_msec) - { - bool state_change = false; -- int count; -+ int count, n_bad_frames; - u8 last_per; - static u32 nretry_to_per_lookup[10] = { - 100 * 0 / 1, -@@ -880,6 +880,7 @@ static bool ath_rc_update_per(struct ath - }; - - last_per = ath_rc_priv->per[tx_rate]; -+ n_bad_frames = tx_info->status.ampdu_len - tx_info->status.ampdu_ack_len; - - if (xretries) { - if (xretries == 1) { -@@ -907,7 +908,7 @@ static bool ath_rc_update_per(struct ath - if (retries >= count) - retries = count - 1; - -- if (tx_info_priv->n_bad_frames) { -+ if (n_bad_frames) { - /* new_PER = 7/8*old_PER + 1/8*(currentPER) - * Assuming that n_frames is not 0. The current PER - * from the retries is 100 * retries / (retries+1), -@@ -920,14 +921,14 @@ static bool ath_rc_update_per(struct ath - * the above PER. The expression below is a - * simplified version of the sum of these two terms. - */ -- if (tx_info_priv->n_frames > 0) { -- int n_frames, n_bad_frames; -+ if (tx_info->status.ampdu_len > 0) { -+ int n_frames, n_bad_tries; - u8 cur_per, new_per; - -- n_bad_frames = retries * tx_info_priv->n_frames + -- tx_info_priv->n_bad_frames; -- n_frames = tx_info_priv->n_frames * (retries + 1); -- cur_per = (100 * n_bad_frames / n_frames) >> 3; -+ n_bad_tries = retries * tx_info->status.ampdu_len + -+ n_bad_frames; -+ n_frames = tx_info->status.ampdu_len * (retries + 1); -+ cur_per = (100 * n_bad_tries / n_frames) >> 3; - new_per = (u8)(last_per - (last_per >> 3) + cur_per); - ath_rc_priv->per[tx_rate] = new_per; - } -@@ -943,8 +944,7 @@ static bool ath_rc_update_per(struct ath - * this was a probe. Otherwise, ignore the probe. - */ - if (ath_rc_priv->probe_rate && ath_rc_priv->probe_rate == tx_rate) { -- if (retries > 0 || 2 * tx_info_priv->n_bad_frames > -- tx_info_priv->n_frames) { -+ if (retries > 0 || 2 * n_bad_frames > tx_info->status.ampdu_len) { - /* - * Since we probed with just a single attempt, - * any retries means the probe failed. Also, -@@ -1003,7 +1003,7 @@ static bool ath_rc_update_per(struct ath - - static void ath_rc_update_ht(struct ath_softc *sc, - struct ath_rate_priv *ath_rc_priv, -- struct ath_tx_info_priv *tx_info_priv, -+ struct ieee80211_tx_info *tx_info, - int tx_rate, int xretries, int retries) - { - u32 now_msec = jiffies_to_msecs(jiffies); -@@ -1020,7 +1020,7 @@ static void ath_rc_update_ht(struct ath_ - - /* Update PER first */ - state_change = ath_rc_update_per(sc, rate_table, ath_rc_priv, -- tx_info_priv, tx_rate, xretries, -+ tx_info, tx_rate, xretries, - retries, now_msec); - - /* -@@ -1098,7 +1098,6 @@ static void ath_rc_tx_status(struct ath_ - struct ieee80211_tx_info *tx_info, - int final_ts_idx, int xretries, int long_retry) - { -- struct ath_tx_info_priv *tx_info_priv = ATH_TX_INFO_PRIV(tx_info); - const struct ath_rate_table *rate_table; - struct ieee80211_tx_rate *rates = tx_info->status.rates; - u8 flags; -@@ -1124,9 +1123,8 @@ static void ath_rc_tx_status(struct ath_ - return; - - rix = ath_rc_get_rateindex(rate_table, &rates[i]); -- ath_rc_update_ht(sc, ath_rc_priv, -- tx_info_priv, rix, -- xretries ? 1 : 2, -+ ath_rc_update_ht(sc, ath_rc_priv, tx_info, -+ rix, xretries ? 1 : 2, - rates[i].count); - } - } -@@ -1149,8 +1147,7 @@ static void ath_rc_tx_status(struct ath_ - return; - - rix = ath_rc_get_rateindex(rate_table, &rates[i]); -- ath_rc_update_ht(sc, ath_rc_priv, tx_info_priv, rix, -- xretries, long_retry); -+ ath_rc_update_ht(sc, ath_rc_priv, tx_info, rix, xretries, long_retry); - } - - static const -@@ -1301,23 +1298,30 @@ static void ath_tx_status(void *priv, st - { - struct ath_softc *sc = priv; - struct ath_rate_priv *ath_rc_priv = priv_sta; -- struct ath_tx_info_priv *tx_info_priv = NULL; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr; -- int final_ts_idx, tx_status = 0, is_underrun = 0; -+ int final_ts_idx = 0, tx_status = 0, is_underrun = 0; -+ int long_retry = 0; - __le16 fc; -+ int i; - - hdr = (struct ieee80211_hdr *)skb->data; - fc = hdr->frame_control; -- tx_info_priv = ATH_TX_INFO_PRIV(tx_info); -- final_ts_idx = tx_info_priv->tx.ts_rateindex; -+ for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { -+ struct ieee80211_tx_rate *rate = &tx_info->status.rates[i]; -+ if (!rate->count) -+ break; -+ -+ final_ts_idx = i; -+ long_retry = rate->count - 1; -+ } - - if (!priv_sta || !ieee80211_is_data(fc) || -- !tx_info_priv->update_rc) -- goto exit; -+ !(tx_info->pad[0] & ATH_TX_INFO_UPDATE_RC)) -+ return; - -- if (tx_info_priv->tx.ts_status & ATH9K_TXERR_FILT) -- goto exit; -+ if (tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) -+ return; - - /* - * If underrun error is seen assume it as an excessive retry only -@@ -1325,20 +1329,17 @@ static void ath_tx_status(void *priv, st - * Adjust the long retry as if the frame was tried hw->max_rate_tries - * times. This affects how ratectrl updates PER for the failed rate. - */ -- if (tx_info_priv->tx.ts_flags & -- (ATH9K_TX_DATA_UNDERRUN | ATH9K_TX_DELIM_UNDERRUN) && -- ((sc->sc_ah->tx_trig_level) >= ath_rc_priv->tx_triglevel_max)) { -+ if ((tx_info->pad[0] & ATH_TX_INFO_UNDERRUN) && -+ (sc->sc_ah->tx_trig_level >= ath_rc_priv->tx_triglevel_max)) { - tx_status = 1; - is_underrun = 1; - } - -- if ((tx_info_priv->tx.ts_status & ATH9K_TXERR_XRETRY) || -- (tx_info_priv->tx.ts_status & ATH9K_TXERR_FIFO)) -+ if (tx_info->pad[0] & ATH_TX_INFO_XRETRY) - tx_status = 1; - - ath_rc_tx_status(sc, ath_rc_priv, tx_info, final_ts_idx, tx_status, -- (is_underrun) ? sc->hw->max_rate_tries : -- tx_info_priv->tx.ts_longretry); -+ (is_underrun) ? sc->hw->max_rate_tries : long_retry); - - /* Check if aggregation has to be enabled for this tid */ - if (conf_is_ht(&sc->hw->conf) && -@@ -1357,8 +1358,6 @@ static void ath_tx_status(void *priv, st - } - - ath_debug_stat_rc(sc, skb); --exit: -- kfree(tx_info_priv); - } - - static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband, diff --git a/package/mac80211/patches/540-monitor_tx_status.patch b/package/mac80211/patches/540-monitor_tx_status.patch deleted file mode 100644 index b2a35de85..000000000 --- a/package/mac80211/patches/540-monitor_tx_status.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/net/mac80211/main.c -+++ b/net/mac80211/main.c -@@ -587,6 +587,11 @@ void ieee80211_tx_status(struct ieee8021 - if (!netif_running(sdata->dev)) - continue; - -+ if ((sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) && -+ !(info->flags & IEEE80211_TX_CTL_INJECTED) && -+ (type == IEEE80211_FTYPE_DATA)) -+ continue; -+ - if (prev_dev) { - skb2 = skb_clone(skb, GFP_ATOMIC); - if (skb2) { diff --git a/package/mac80211/patches/550-ath9k_rx_fix.patch b/package/mac80211/patches/550-ath9k_rx_fix.patch deleted file mode 100644 index cdef13cf3..000000000 --- a/package/mac80211/patches/550-ath9k_rx_fix.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/common.c -+++ b/drivers/net/wireless/ath/ath9k/common.c -@@ -203,6 +203,7 @@ int ath9k_cmn_rx_skb_preprocess(struct a - { - struct ath_hw *ah = common->ah; - -+ memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); - if (!ath9k_rx_accept(common, skb, rx_status, rx_stats, decrypt_error)) - return -EINVAL; - From 91312f560f72dc8c5cee653344e7f2996ec50a08 Mon Sep 17 00:00:00 2001 From: jow Date: Sun, 22 Nov 2009 11:52:08 +0000 Subject: [PATCH 201/288] [package] dnsmasq: Set a list of addnhosts files. e.g. list 'addnhosts' '/var/etc/hosts.olsr' list 'addnhosts' '/var/etc/hosts.olsrv6' hosts.olsr for ipv4 and hosts.olsrv6 for ipv6 addresses. Signed-off-by: Patrick Grimm git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18470 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/dnsmasq/Makefile | 2 +- package/dnsmasq/files/dnsmasq.init | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package/dnsmasq/Makefile b/package/dnsmasq/Makefile index dc083f4b6..f2f0c9677 100644 --- a/package/dnsmasq/Makefile +++ b/package/dnsmasq/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dnsmasq PKG_VERSION:=2.50 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq diff --git a/package/dnsmasq/files/dnsmasq.init b/package/dnsmasq/files/dnsmasq.init index ba1bf721d..bc14aa6c4 100644 --- a/package/dnsmasq/files/dnsmasq.init +++ b/package/dnsmasq/files/dnsmasq.init @@ -49,6 +49,10 @@ append_notinterface() { append args "-I $1" } +append_addnhosts() { + append args "-H $1" +} + dnsmasq() { local cfg="$1" append_bool "$cfg" authoritative "-K" @@ -72,13 +76,13 @@ dnsmasq() { append_parm "$cfg" port "-p" append_parm "$cfg" ednspacket_max "-P" append_parm "$cfg" dhcpleasemax "-X" - append_parm "$cfg" "addnhosts" "-H" append_parm "$cfg" "queryport" "-Q" append_parm "$cfg" "domain" "-s" append_parm "$cfg" "local" "-S" config_list_foreach "$cfg" "server" append_server config_list_foreach "$cfg" "interface" append_interface config_list_foreach "$cfg" "notinterface" append_notinterface + config_list_foreach "$cfg" "addnhosts" append_addnhosts append_parm "$cfg" "leasefile" "-l" append_parm "$cfg" "resolvfile" "-r" append_parm "$cfg" "tftp_root" "--tftp-root" From 9a46418be945f38dc229327dbc6039e7ac7f83f4 Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 22 Nov 2009 12:24:51 +0000 Subject: [PATCH 203/288] [x86] remove obsolete 2.6.28 config & empty patches dir git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18473 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/x86/config-2.6.28 | 392 --------------------------------- 1 file changed, 392 deletions(-) delete mode 100644 target/linux/x86/config-2.6.28 diff --git a/target/linux/x86/config-2.6.28 b/target/linux/x86/config-2.6.28 deleted file mode 100644 index 4473e7f0a..000000000 --- a/target/linux/x86/config-2.6.28 +++ /dev/null @@ -1,392 +0,0 @@ -# CONFIG_3C515 is not set -CONFIG_4KSTACKS=y -# CONFIG_60XX_WDT is not set -# CONFIG_64BIT is not set -# CONFIG_8139TOO is not set -# CONFIG_AC3200 is not set -# CONFIG_ACQUIRE_WDT is not set -# CONFIG_ADVANTECH_WDT is not set -# CONFIG_AGP is not set -# CONFIG_ALIM1535_WDT is not set -# CONFIG_APRICOT is not set -CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" -CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y -CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y -CONFIG_ARCH_HAS_CPU_RELAX=y -CONFIG_ARCH_HAS_DEFAULT_IDLE=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_MAY_HAVE_PC_FDC=y -# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set -CONFIG_ARCH_POPULATES_NODE_MAP=y -CONFIG_ARCH_SELECT_MEMORY_MODEL=y -CONFIG_ARCH_SPARSEMEM_ENABLE=y -CONFIG_ARCH_SUPPORTS_MSI=y -CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y -# CONFIG_AT1700 is not set -# CONFIG_AUDIT_ARCH is not set -# CONFIG_BINFMT_AOUT is not set -CONFIG_BINFMT_MISC=y -CONFIG_BITREVERSE=y -# CONFIG_BLK_DEV_4DRIVES is not set -# CONFIG_BLK_DEV_ALI14XX is not set -CONFIG_BLK_DEV_AMD74XX=y -# CONFIG_BLK_DEV_DTC2278 is not set -CONFIG_BLK_DEV_GENERIC=y -# CONFIG_BLK_DEV_HT6560B is not set -CONFIG_BLK_DEV_IDEDMA_PCI=y -CONFIG_BLK_DEV_IDEDMA_SFF=y -CONFIG_BLK_DEV_IDEDMA=y -CONFIG_BLK_DEV_IDEPCI=y -CONFIG_BLK_DEV_PIIX=y -# CONFIG_BLK_DEV_QD65XX is not set -CONFIG_BLK_DEV_SC1200=y -# CONFIG_BLK_DEV_UMC8672 is not set -CONFIG_BLK_DEV_VIA82CXXX=y -# CONFIG_BLK_DEV_XD is not set -CONFIG_BOUNCE=y -CONFIG_CLASSIC_RCU=y -CONFIG_CLOCKSOURCE_WATCHDOG=y -# CONFIG_CMDLINE_BOOL is not set -CONFIG_COMPAT_VDSO=y -CONFIG_CONSOLE_TRANSLATIONS=y -# CONFIG_CPU5_WDT is not set -# CONFIG_CPU_FREQ_DEBUG is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set -# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set -# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_STAT_DETAILS=y -CONFIG_CPU_FREQ_STAT=y -CONFIG_CPU_FREQ_TABLE=y -CONFIG_CPU_FREQ=y -CONFIG_CPU_SUP_AMD=y -CONFIG_CPU_SUP_CENTAUR_32=y -CONFIG_CPU_SUP_CYRIX_32=y -CONFIG_CPU_SUP_INTEL=y -CONFIG_CPU_SUP_TRANSMETA_32=y -CONFIG_CPU_SUP_UMC_32=y -# CONFIG_CS5535_GPIO is not set -# CONFIG_CS89x0 is not set -# CONFIG_DCDBAS is not set -CONFIG_DEBUG_BUGVERBOSE=y -CONFIG_DEBUG_MEMORY_INIT=y -CONFIG_DEFAULT_IO_DELAY_TYPE=0 -# CONFIG_DELL_RBU is not set -# CONFIG_DEPCA is not set -CONFIG_DEVPORT=y -# CONFIG_DMIID is not set -CONFIG_DMI=y -CONFIG_DNOTIFY=y -CONFIG_DOUBLEFAULT=y -CONFIG_DUMMY_CONSOLE=y -# CONFIG_EARLY_PRINTK_DBGP is not set -CONFIG_EARLY_PRINTK=y -# CONFIG_EDAC is not set -# CONFIG_EDD is not set -# CONFIG_EISA is not set -# CONFIG_EL16 is not set -# CONFIG_EL1 is not set -# CONFIG_EL2 is not set -# CONFIG_EL3 is not set -CONFIG_ELF_CORE=y -# CONFIG_ELPLUS is not set -# CONFIG_EMBEDDED is not set -# CONFIG_EUROTECH_WDT is not set -CONFIG_EXT2_FS=y -CONFIG_FAST_CMPXCHG_LOCAL=y -CONFIG_FIRMWARE_IN_KERNEL=y -CONFIG_FIRMWARE_MEMMAP=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CMOS_UPDATE=y -# CONFIG_GENERIC_CPU is not set -CONFIG_GENERIC_FIND_FIRST_BIT=y -CONFIG_GENERIC_FIND_NEXT_BIT=y -CONFIG_GENERIC_IOMAP=y -CONFIG_GENERIC_ISA_DMA=y -# CONFIG_GENERIC_TIME_VSYSCALL is not set -# CONFIG_HANGCHECK_TIMER is not set -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT=y -CONFIG_HAVE_AOUT=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_ATOMIC_IOMAP=y -# CONFIG_HAVE_CPUMASK_OF_CPU_MAP is not set -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_HAVE_IDE=y -CONFIG_HAVE_IOREMAP_PROT=y -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_KVM=y -CONFIG_HAVE_LATENCYTOP_SUPPORT=y -CONFIG_HAVE_OPROFILE=y -# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set -CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y -CONFIG_HID_COMPAT=y -CONFIG_HID_SUPPORT=y -CONFIG_HID=y -# CONFIG_HIGHMEM4G is not set -# CONFIG_HIGHMEM64G is not set -# CONFIG_HIGH_RES_TIMERS is not set -# CONFIG_HPET_TIMER is not set -# CONFIG_HP_WATCHDOG is not set -CONFIG_HT_IRQ=y -# CONFIG_HUGETLBFS is not set -CONFIG_HW_CONSOLE=y -# CONFIG_HW_RANDOM_AMD is not set -CONFIG_HW_RANDOM_GEODE=y -# CONFIG_HW_RANDOM_INTEL is not set -CONFIG_HW_RANDOM_VIA=y -CONFIG_HW_RANDOM=y -# CONFIG_I6300ESB_WDT is not set -# CONFIG_I8K is not set -# CONFIG_IB700_WDT is not set -# CONFIG_IBM_ASM is not set -# CONFIG_IBMASR is not set -# CONFIG_IDE_GD_ATAPI is not set -CONFIG_IDE_GD_ATA=y -CONFIG_IDE_GD=y -CONFIG_IDE_GENERIC=y -CONFIG_IDEPCI_PCIBUS_ORDER=y -# CONFIG_IDE_PROC_FS is not set -CONFIG_IDE_TIMINGS=y -CONFIG_IDE=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_INPUT_KEYBOARD=y -CONFIG_INPUT_MOUSEDEV_PSAUX=y -CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 -CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -CONFIG_INPUT_MOUSEDEV=y -CONFIG_INPUT_MOUSE=y -CONFIG_INPUT=y -CONFIG_IO_DELAY_0X80=y -# CONFIG_IO_DELAY_0XED is not set -# CONFIG_IO_DELAY_NONE is not set -CONFIG_IO_DELAY_TYPE_0X80=0 -CONFIG_IO_DELAY_TYPE_0XED=1 -CONFIG_IO_DELAY_TYPE_NONE=3 -CONFIG_IO_DELAY_TYPE_UDELAY=2 -# CONFIG_IO_DELAY_UDELAY is not set -# CONFIG_IOMMU_HELPER is not set -CONFIG_ISA_DMA_API=y -CONFIG_ISAPNP=y -CONFIG_ISA=y -# CONFIG_ISCSI_IBFT_FIND is not set -# CONFIG_IT8712F_WDT is not set -# CONFIG_IT87_WDT is not set -# CONFIG_ITCO_WDT is not set -CONFIG_KALLSYMS=y -CONFIG_KEXEC=y -CONFIG_KEYBOARD_ATKBD=y -# CONFIG_KEYBOARD_LKKBD is not set -# CONFIG_KEYBOARD_NEWTON is not set -# CONFIG_KEYBOARD_STOWAWAY is not set -# CONFIG_KEYBOARD_SUNKBD is not set -# CONFIG_KEYBOARD_XTKBD is not set -CONFIG_KTIME_SCALAR=y -# CONFIG_LANCE is not set -# CONFIG_LEDS_CLEVO_MAIL is not set -CONFIG_M386=y -# CONFIG_M486 is not set -# CONFIG_M586 is not set -# CONFIG_M586MMX is not set -# CONFIG_M586TSC is not set -# CONFIG_M686 is not set -# CONFIG_MACHZ_WDT is not set -# CONFIG_MACINTOSH_DRIVERS is not set -CONFIG_MATH_EMULATION=y -# CONFIG_MCA is not set -# CONFIG_MCORE2 is not set -# CONFIG_MCRUSOE is not set -# CONFIG_MCYRIXIII is not set -# CONFIG_MDA_CONSOLE is not set -# CONFIG_MEFFICEON is not set -# CONFIG_MEMTEST is not set -# CONFIG_MGEODEGX1 is not set -# CONFIG_MGEODE_LX is not set -# CONFIG_MICROCODE_AMD is not set -CONFIG_MICROCODE_INTEL=y -CONFIG_MICROCODE_OLD_INTERFACE=y -CONFIG_MICROCODE=y -# CONFIG_MIXCOMWD is not set -# CONFIG_MK6 is not set -# CONFIG_MK7 is not set -# CONFIG_MK8 is not set -# CONFIG_MOUSE_BCM5974 is not set -CONFIG_MOUSE_PS2_ALPS=y -# CONFIG_MOUSE_PS2_ELANTECH is not set -CONFIG_MOUSE_PS2_LIFEBOOK=y -CONFIG_MOUSE_PS2_LOGIPS2PP=y -CONFIG_MOUSE_PS2_SYNAPTICS=y -# CONFIG_MOUSE_PS2_TOUCHKIT is not set -CONFIG_MOUSE_PS2_TRACKPOINT=y -CONFIG_MOUSE_PS2=y -# CONFIG_MOUSE_SERIAL is not set -# CONFIG_MOUSE_VSXXXAA is not set -# CONFIG_MPENTIUM4 is not set -# CONFIG_MPENTIUMIII is not set -# CONFIG_MPENTIUMII is not set -# CONFIG_MPENTIUMM is not set -# CONFIG_MPSC is not set -CONFIG_MTD_BLOCK2MTD=y -# CONFIG_MTD_CFI is not set -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -# CONFIG_MTD_TS5500 is not set -# CONFIG_MTRR_SANITIZER is not set -CONFIG_MTRR=y -# CONFIG_MVIAC3_2 is not set -# CONFIG_MVIAC7 is not set -# CONFIG_MWINCHIP3D is not set -# CONFIG_MWINCHIPC6 is not set -CONFIG_NAMESPACES=y -CONFIG_NET_VENDOR_3COM=y -# CONFIG_NET_VENDOR_RACAL is not set -# CONFIG_NET_VENDOR_SMC is not set -CONFIG_NOHIGHMEM=y -# CONFIG_NSC_GPIO is not set -CONFIG_NVRAM=y -# CONFIG_OLPC is not set -# CONFIG_OPTIMIZE_INLINING is not set -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PAGE_OFFSET=0xC0000000 -# CONFIG_PARAVIRT_GUEST is not set -# CONFIG_PC8736x_GPIO is not set -# CONFIG_PC87413_WDT is not set -CONFIG_PCI_BIOS=y -CONFIG_PCI_DIRECT=y -CONFIG_PCI_DOMAINS=y -# CONFIG_PCIEPORTBUS is not set -CONFIG_PCI_GOANY=y -# CONFIG_PCI_GOBIOS is not set -# CONFIG_PCI_GODIRECT is not set -# CONFIG_PCI_GOMMCONFIG is not set -# CONFIG_PCI_GOOLPC is not set -CONFIG_PCSPKR_PLATFORM=y -# CONFIG_PCWATCHDOG is not set -CONFIG_PHYSICAL_ALIGN=0x100000 -CONFIG_PHYSICAL_START=0x100000 -# CONFIG_PNPACPI is not set -# CONFIG_PNPBIOS is not set -CONFIG_PNP_DEBUG_MESSAGES=y -CONFIG_PNP=y -CONFIG_PROC_PAGE_MONITOR=y -# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set -# CONFIG_R6040 is not set -# CONFIG_RELOCATABLE is not set -CONFIG_RTC=y -# CONFIG_SBC7240_WDT is not set -# CONFIG_SBC8360_WDT is not set -# CONFIG_SBC_EPX_C3_WATCHDOG is not set -# CONFIG_SC1200_WDT is not set -# CONFIG_SC520_WDT is not set -# CONFIG_SCHED_HRTICK is not set -CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y -# CONFIG_SCSI_DMA is not set -# CONFIG_SCx200_GPIO is not set -CONFIG_SCx200HR_TIMER=y -# CONFIG_SCx200_WDT is not set -CONFIG_SCx200=y -# CONFIG_SERIAL_8250_EXTENDED is not set -CONFIG_SERIAL_8250_PCI=y -CONFIG_SERIAL_8250_PNP=y -# CONFIG_SERIO_CT82C710 is not set -CONFIG_SERIO_I8042=y -CONFIG_SERIO_LIBPS2=y -# CONFIG_SERIO_PCIPS2 is not set -# CONFIG_SERIO_RAW is not set -CONFIG_SERIO_SERPORT=y -CONFIG_SERIO=y -# CONFIG_SLAB is not set -# CONFIG_SLUB_DEBUG_ON is not set -CONFIG_SLUB_DEBUG=y -# CONFIG_SLUB_STATS is not set -CONFIG_SLUB=y -# CONFIG_SMSC37B787_WDT is not set -# CONFIG_SONYPI is not set -CONFIG_SPARSEMEM_STATIC=y -CONFIG_STRICT_DEVMEM=y -# CONFIG_SYSPROF_TRACER is not set -# CONFIG_TELCLOCK is not set -# CONFIG_TOSHIBA is not set -# CONFIG_TYPHOON is not set -CONFIG_UID16=y -CONFIG_USB_SUPPORT=y -# CONFIG_USER_NS is not set -# CONFIG_VGACON_SOFT_SCROLLBACK is not set -CONFIG_VGA_CONSOLE=y -# CONFIG_VGASTATE is not set -# CONFIG_VIA_RHINE is not set -CONFIG_VM86=y -CONFIG_VM_EVENT_COUNTERS=y -# CONFIG_VORTEX is not set -CONFIG_VT_CONSOLE=y -# CONFIG_VT_HW_CONSOLE_BINDING is not set -CONFIG_VT=y -# CONFIG_W83697UG_WDT is not set -# CONFIG_WAFER_WDT is not set -# CONFIG_WDT is not set -CONFIG_X86_32=y -# CONFIG_X86_64 is not set -CONFIG_X86_BIOS_REBOOT=y -# CONFIG_X86_CHECK_BIOS_CORRUPTION is not set -# CONFIG_X86_CMPXCHG is not set -# CONFIG_X86_CPUFREQ_NFORCE2 is not set -# CONFIG_X86_CPUID is not set -CONFIG_X86_CPU=y -# CONFIG_X86_ELAN is not set -# CONFIG_X86_E_POWERSAVER is not set -CONFIG_X86_F00F_BUG=y -CONFIG_X86_FIND_SMP_CONFIG=y -# CONFIG_X86_GENERICARCH is not set -CONFIG_X86_GENERIC=y -# CONFIG_X86_GX_SUSPMOD is not set -CONFIG_X86_INTEL_USERCOPY=y -CONFIG_X86_IO_APIC=y -CONFIG_X86_L1_CACHE_SHIFT=7 -CONFIG_X86_LOCAL_APIC=y -# CONFIG_X86_LONGRUN is not set -# CONFIG_X86_MCE_NONFATAL is not set -# CONFIG_X86_MCE_P4THERMAL is not set -CONFIG_X86_MCE=y -CONFIG_X86_MINIMUM_CPU_FAMILY=3 -CONFIG_X86_MPPARSE=y -# CONFIG_X86_MSR is not set -# CONFIG_X86_P4_CLOCKMOD is not set -# CONFIG_X86_PAE is not set -CONFIG_X86_PAT=y -CONFIG_X86_PC=y -# CONFIG_X86_POWERNOW_K6 is not set -# CONFIG_X86_POWERNOW_K7 is not set -# CONFIG_X86_POWERNOW_K8 is not set -CONFIG_X86_PPRO_FENCE=y -# CONFIG_X86_RDC321X is not set -# CONFIG_X86_REBOOTFIXUPS is not set -CONFIG_X86_RESERVE_LOW_64K=y -# CONFIG_X86_SPEEDSTEP_CENTRINO is not set -# CONFIG_X86_SPEEDSTEP_ICH is not set -# CONFIG_X86_SPEEDSTEP_LIB is not set -# CONFIG_X86_SPEEDSTEP_SMI is not set -CONFIG_X86_UP_APIC=y -CONFIG_X86_UP_IOAPIC=y -CONFIG_X86_VERBOSE_BOOTUP=y -# CONFIG_X86_VOYAGER is not set -# CONFIG_X86_VSMP is not set -CONFIG_X86=y -# CONFIG_ZONE_DMA32 is not set From 4e94330d217d42c725bd468e68fc3091788e6563 Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 22 Nov 2009 12:27:39 +0000 Subject: [PATCH 204/288] [toolchain] eglibc: don't use minor version numbers in config symbols, only in version strings git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18474 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- toolchain/eglibc/Config.in | 12 ++++++------ toolchain/eglibc/Config.version | 12 ++---------- toolchain/eglibc/Makefile | 12 ++++++------ 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/toolchain/eglibc/Config.in b/toolchain/eglibc/Config.in index 80f4fdee3..407240b8c 100644 --- a/toolchain/eglibc/Config.in +++ b/toolchain/eglibc/Config.in @@ -5,8 +5,8 @@ choice help Select the version of eglibc you wish to use. - config EGLIBC_VERSION_2_6_1 - bool "eglibc 2.6.1" + config EGLIBC_VERSION_2_6 + bool "eglibc 2.6" config EGLIBC_VERSION_2_7 bool "eglibc 2.7" @@ -17,8 +17,8 @@ choice config EGLIBC_VERSION_2_9 bool "eglibc 2.9" - config EGLIBC_VERSION_2_10_1 - bool "eglibc 2.10.1" + config EGLIBC_VERSION_2_10 + bool "eglibc 2.10" config EGLIBC_VERSION_TRUNK bool "eglibc trunk" @@ -29,11 +29,11 @@ config EGLIBC_REVISION string prompt "eglibc revision" depends on TOOLCHAINOPTS && USE_EGLIBC - default "5887" if EGLIBC_VERSION_2_6_1 + default "5887" if EGLIBC_VERSION_2_6 default "8588" if EGLIBC_VERSION_2_7 default "8587" if EGLIBC_VERSION_2_8 default "8690" if EGLIBC_VERSION_2_9 - default "8873" if EGLIBC_VERSION_2_10_1 + default "8873" if EGLIBC_VERSION_2_10 default "HEAD" if EGLIBC_VERSION_TRUNK default "" diff --git a/toolchain/eglibc/Config.version b/toolchain/eglibc/Config.version index 00b3722ea..e31282681 100644 --- a/toolchain/eglibc/Config.version +++ b/toolchain/eglibc/Config.version @@ -1,17 +1,9 @@ config EGLIBC_VERSION string depends on USE_EGLIBC - default "2.6.1" if EGLIBC_VERSION_2_6_1 + default "2.6.1" if EGLIBC_VERSION_2_6 default "2.7" if EGLIBC_VERSION_2_7 default "2.8" if EGLIBC_VERSION_2_8 default "2.9" if EGLIBC_VERSION_2_9 - default "2.10.1" if EGLIBC_VERSION_2_10_1 + default "2.10.1" if EGLIBC_VERSION_2_10 default "trunk" - -config EGLIBC_VERSION_2_6 - bool - default y if EGLIBC_VERSION_2_6_1 - -config EGLIBC_VERSION_2_10 - bool - default y if EGLIBC_VERSION_2_10_1 diff --git a/toolchain/eglibc/Makefile b/toolchain/eglibc/Makefile index 0363dd906..b72b4bd35 100644 --- a/toolchain/eglibc/Makefile +++ b/toolchain/eglibc/Makefile @@ -15,22 +15,22 @@ PKG_SOURCE_VERSION:=$(PKG_REVISION) PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-r$(PKG_REVISION) PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.bz2 -ifeq ($(PKG_VERSION),2.6.1) +ifneq ($(CONFIG_EGLIBC_VERSION_2_6),) PKG_SOURCE_URL:=svn://svn.eglibc.org/branches/eglibc-2_6 endif -ifeq ($(PKG_VERSION),2.7) +ifneq ($(CONFIG_EGLIBC_VERSION_2_7),) PKG_SOURCE_URL:=svn://svn.eglibc.org/branches/eglibc-2_7 endif -ifeq ($(PKG_VERSION),2.8) +ifneq ($(CONFIG_EGLIBC_VERSION_2_8),) PKG_SOURCE_URL:=svn://svn.eglibc.org/branches/eglibc-2_8 endif -ifeq ($(PKG_VERSION),2.9) +ifneq ($(CONFIG_EGLIBC_VERSION_2_9),) PKG_SOURCE_URL:=svn://svn.eglibc.org/branches/eglibc-2_9 endif -ifeq ($(PKG_VERSION),2.10.1) +ifneq ($(CONFIG_EGLIBC_VERSION_2_10),) PKG_SOURCE_URL:=svn://svn.eglibc.org/branches/eglibc-2_10 endif -ifeq ($(PKG_VERSION),trunk) +ifneq ($(CONFIG_EGLIBC_VERSION_TRUNK),) PKG_SOURCE_URL:=svn://svn.eglibc.org/trunk endif From 57aa2ecccea6bfc8183660687937ba97edc20d12 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 22 Nov 2009 14:53:20 +0000 Subject: [PATCH 205/288] [brcm63xx] add support for the RTA1025W_16 board (#5979) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18476 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../arch/mips/bcm63xx/boards/board_bcm963xx.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/target/linux/brcm63xx/files/arch/mips/bcm63xx/boards/board_bcm963xx.c b/target/linux/brcm63xx/files/arch/mips/bcm63xx/boards/board_bcm963xx.c index 5f2151609..d9c4a20c6 100644 --- a/target/linux/brcm63xx/files/arch/mips/bcm63xx/boards/board_bcm963xx.c +++ b/target/linux/brcm63xx/files/arch/mips/bcm63xx/boards/board_bcm963xx.c @@ -418,7 +418,23 @@ static struct board_info __initdata board_96348gw_a = { .has_ohci0 = 1, }; +static struct board_info __initdata board_rta1025w_16 = { + .name = "RTA1025W_16", + .expected_cpu_id = 0x6348, + + .has_enet0 = 1, + .has_enet1 = 1, + .has_pci = 1, + .enet0 = { + .has_phy = 1, + .use_internal_phy = 1, + }, + .enet1 = { + .force_speed_100 = 1, + .force_duplex_full = 1, + }, +}; #endif /* @@ -586,6 +602,7 @@ static const struct board_info __initdata *bcm963xx_boards[] = { &board_FAST2404, &board_DV201AMR, &board_96348gw_a, + &board_rta1025w_16, #endif #ifdef CONFIG_BCM63XX_CPU_6358 From 3b1067ec77fe12074165e6027003ac25184f721e Mon Sep 17 00:00:00 2001 From: jow Date: Sun, 22 Nov 2009 14:54:26 +0000 Subject: [PATCH 206/288] [brcm47xx] add missing CONFIG_MIPS_FPU_EMU to kernel config git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18477 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/brcm47xx/config-2.6.28 | 1 + target/linux/brcm47xx/config-2.6.30 | 1 + 2 files changed, 2 insertions(+) diff --git a/target/linux/brcm47xx/config-2.6.28 b/target/linux/brcm47xx/config-2.6.28 index 509384ef8..17dd173a7 100644 --- a/target/linux/brcm47xx/config-2.6.28 +++ b/target/linux/brcm47xx/config-2.6.28 @@ -93,6 +93,7 @@ CONFIG_LEDS_GPIO=y # CONFIG_MACH_VR41XX is not set # CONFIG_MIKROTIK_RB532 is not set # CONFIG_MIPS_COBALT is not set +# CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MACHINE is not set # CONFIG_MIPS_MALTA is not set diff --git a/target/linux/brcm47xx/config-2.6.30 b/target/linux/brcm47xx/config-2.6.30 index 0c7a25f2d..07ff5f34a 100644 --- a/target/linux/brcm47xx/config-2.6.30 +++ b/target/linux/brcm47xx/config-2.6.30 @@ -103,6 +103,7 @@ CONFIG_LEDS_GPIO=y # CONFIG_MACH_VR41XX is not set # CONFIG_MIKROTIK_RB532 is not set # CONFIG_MIPS_COBALT is not set +# CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MACHINE is not set # CONFIG_MIPS_MALTA is not set From c60fa109325175c84dfaac6c013be0fbc9eeaf24 Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 22 Nov 2009 15:30:11 +0000 Subject: [PATCH 207/288] eglibc: fix wrong config symbol name if library configuration submenu git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18479 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- toolchain/eglibc/config/Config.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchain/eglibc/config/Config.in b/toolchain/eglibc/config/Config.in index 0eb925fac..82d04cdb0 100644 --- a/toolchain/eglibc/config/Config.in +++ b/toolchain/eglibc/config/Config.in @@ -227,7 +227,7 @@ config EGLIBC_OPTION_EGLIBC_FSTAB getfsent setfsent getfsfile -config OPTION_EGLIBC_FTRAVERSE +config EGLIBC_OPTION_EGLIBC_FTRAVERSE bool "Functions for traversing file hierarchies" default y depends EGLIBC_VERSION_2_10 From 57a61ca2b377be60f30a874dae5a26565816cd79 Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 22 Nov 2009 15:34:26 +0000 Subject: [PATCH 208/288] cosmetic: reformat library configuration submenu - adjust indent & spaces - use coherent config symbol names in help git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18480 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- toolchain/eglibc/config/Config.in | 1311 +++++++++++++++-------------- 1 file changed, 669 insertions(+), 642 deletions(-) diff --git a/toolchain/eglibc/config/Config.in b/toolchain/eglibc/config/Config.in index 82d04cdb0..a55c66081 100644 --- a/toolchain/eglibc/config/Config.in +++ b/toolchain/eglibc/config/Config.in @@ -1,781 +1,808 @@ config EGLIBC_OPTION_EGLIBC_ADVANCED_INET6 - bool "IPv6 Advanced Sockets API support (RFC3542)" - default y - select EGLIBC_OPTION_EGLIBC_INET - help - This option group includes the functions specified by RFC 3542, - "Advanced Sockets Application Program Interface (API) for - IPv6". + bool "IPv6 Advanced Sockets API support (RFC3542)" + default y + select EGLIBC_OPTION_EGLIBC_INET + help + This option group includes the functions specified by RFC 3542, + "Advanced Sockets Application Program Interface (API) for + IPv6". - This option group includes the following functions: + This option group includes the following functions: + + inet6_opt_append + inet6_opt_find + inet6_opt_finish + inet6_opt_get_val + inet6_opt_init + inet6_option_alloc + inet6_option_append + inet6_option_find + inet6_option_init + inet6_option_next + inet6_option_space + inet6_opt_next + inet6_opt_set_val + inet6_rth_add + inet6_rth_getaddr + inet6_rth_init + inet6_rth_reverse + inet6_rth_segments + inet6_rth_space - inet6_opt_append - inet6_opt_find - inet6_opt_finish - inet6_opt_get_val - inet6_opt_init - inet6_alloc - inet6_append - inet6_find - inet6_init - inet6_next - inet6_space - inet6_opt_next - inet6_opt_set_val - inet6_rth_add - inet6_rth_getaddr - inet6_rth_init - inet6_rth_reverse - inet6_rth_segments - inet6_rth_space config EGLIBC_OPTION_EGLIBC_BACKTRACE - bool "Functions for producing backtraces" - default y - help - This option group includes functions for producing a list of - the function calls that are currently active in a thread, from - within the thread itself. These functions are often used - within signal handlers, to produce diagnostic output. + bool "Functions for producing backtraces" + default y + help + This option group includes functions for producing a list of + the function calls that are currently active in a thread, from + within the thread itself. These functions are often used + within signal handlers, to produce diagnostic output. - This option group includes the following functions: + This option group includes the following functions: + + backtrace + backtrace_symbols + backtrace_symbols_fd - backtrace - backtrace_symbols - backtrace_symbols_fd config EGLIBC_OPTION_EGLIBC_BSD - bool "BSD-specific functions, and their compatibility stubs" - default y - help - This option group includes functions specific to BSD kernels. - A number of these functions have stub versions that are also - included in libraries built for non-BSD systems for - compatibility. + bool "BSD-specific functions, and their compatibility stubs" + default y + help + This option group includes functions specific to BSD kernels. + A number of these functions have stub versions that are also + included in libraries built for non-BSD systems for + compatibility. - This option group includes the following functions: + This option group includes the following functions: + + chflags + fchflags + lchmod + revoke + setlogin - chflags - fchflags - lchmod - revoke - setlogin config EGLIBC_OPTION_EGLIBC_CXX_TESTS - bool "Tests that link against the standard C++ library." - default y - select EGLIBC_OPTION_POSIX_WIDE_CHAR_DEVICE_IO - select EGLIBC_OPTION_EGLIBC_LIBM - help - This option group does not include any C library functions; - instead, it controls which EGLIBC tests an ordinary 'make - tests' runs. With this group disabled, tests that would - normally link against the standard C++ library are not - run. + bool "Tests that link against the standard C++ library." + default y + select EGLIBC_OPTION_POSIX_WIDE_CHAR_DEVICE_IO + select EGLIBC_OPTION_EGLIBC_LIBM + help + This option group does not include any C library functions; + instead, it controls which EGLIBC tests an ordinary 'make + tests' runs. With this group disabled, tests that would + normally link against the standard C++ library are not + run. + + The standard C++ library depends on the math library 'libm' and + the wide character I/O functions included in EGLIBC. If those + option groups are disabled, this test must also be disabled. - The standard C++ library depends on the math library 'libm' and - the wide character I/O functions included in EGLIBC. If those - option groups are disabled, this test must also be disabled. config EGLIBC_OPTION_EGLIBC_CATGETS - bool "Functions for accessing message catalogs" - default y - select EGLIBC_OPTION_EGLIBC_LOCALE_CODE - help - This option group includes functions for accessing message - catalogs: catopen, catclose, and catgets. + bool "Functions for accessing message catalogs" + default y + select EGLIBC_OPTION_EGLIBC_LOCALE_CODE + help + This option group includes functions for accessing message + catalogs: catopen, catclose, and catgets. + + This option group depends on the EGLIBC_OPTION_EGLIBC_LOCALE_CODE + option group; if you disable that, you must also disable this. - This option group depends on the EGLIBC_LOCALE_CODE - option group; if you disable that, you must also disable this. config EGLIBC_OPTION_EGLIBC_CHARSETS - bool "iconv/gconv character set conversion libraries" - default y - help + bool "iconv/gconv character set conversion libraries" + default y + help - This option group includes support for character sets other - than ASCII (ANSI_X3.4-1968) and Unicode and ISO-10646 in their - various encodings. This affects both the character sets - supported by the wide and multibyte character functions, and - those supported by the 'iconv' functions. + This option group includes support for character sets other + than ASCII (ANSI_X3.4-1968) and Unicode and ISO-10646 in their + various encodings. This affects both the character sets + supported by the wide and multibyte character functions, and + those supported by the 'iconv' functions. - With this option group disabled, EGLIBC supports only the - following character sets: + With this option group disabled, EGLIBC supports only the + following character sets: - ANSI_X3.4 - ASCII - ANSI_X3.4-1968 - ANSI_X3.4-1986 - ASCII - CP367 - CSASCII - IBM367 - ISO-IR-6 - ISO646-US - ISO_646.IRV:1991 - OSF00010020 - US - US-ASCII + ANSI_X3.4 - ASCII + ANSI_X3.4-1968 + ANSI_X3.4-1986 + ASCII + CP367 + CSASCII + IBM367 + ISO-IR-6 + ISO646-US + ISO_646.IRV:1991 + OSF00010020 + US + US-ASCII - 10646-1:1993 - ISO 10646, in big-endian UCS4 form - 10646-1:1993/UCS4 - CSUCS4 - ISO-10646 - ISO-10646/UCS4 - OSF00010104 - OSF00010105 - OSF00010106 - UCS-4 - UCS-4BE - UCS4 + 10646-1:1993 - ISO 10646, in big-endian UCS4 form + 10646-1:1993/UCS4 + CSUCS4 + ISO-10646 + ISO-10646/UCS4 + OSF00010104 + OSF00010105 + OSF00010106 + UCS-4 + UCS-4BE + UCS4 - UCS-4LE - ISO 10646, in little-endian UCS4 form + UCS-4LE - ISO 10646, in little-endian UCS4 form - ISO-10646/UTF-8 - ISO 10646, in UTF-8 form - ISO-10646/UTF8 - ISO-IR-193 - OSF05010001 - UTF-8 - UTF8 + ISO-10646/UTF-8 - ISO 10646, in UTF-8 form + ISO-10646/UTF8 + ISO-IR-193 + OSF05010001 + UTF-8 + UTF8 - ISO-10646/UCS2 - ISO 10646, in target-endian UCS2 form - OSF00010100 - OSF00010101 - OSF00010102 - UCS-2 - UCS2 + ISO-10646/UCS2 - ISO 10646, in target-endian UCS2 form + OSF00010100 + OSF00010101 + OSF00010102 + UCS-2 + UCS2 - UCS-2BE - ISO 10646, in big-endian UCS2 form - UNICODEBIG + UCS-2BE - ISO 10646, in big-endian UCS2 form + UNICODEBIG - UCS-2LE - ISO 10646, in little-endian UCS2 form - UNICODELITTLE + UCS-2LE - ISO 10646, in little-endian UCS2 form + UNICODELITTLE + + WCHAR_T - EGLIBC's internal form (target-endian, + 32-bit ISO 10646) - WCHAR_T - EGLIBC's internal form (target-endian, - 32-bit ISO 10646) config EGLIBC_OPTION_EGLIBC_DB_ALIASES - bool "Functions for accessing the mail aliases database" - default y - help - This option group includes functions for looking up mail - aliases in '/etc/aliases' or using nsswitch. It includes the - following functions: + bool "Functions for accessing the mail aliases database" + default y + help + This option group includes functions for looking up mail + aliases in '/etc/aliases' or using nsswitch. It includes the + following functions: - endaliasent - getaliasbyname - getaliasbyname_r - getaliasent - getaliasent_r - setaliasent + endaliasent + getaliasbyname + getaliasbyname_r + getaliasent + getaliasent_r + setaliasent + + When this option group is disabled, the NSS service libraries + also lack support for querying their mail alias tables. - When this option group is disabled, the NSS service libraries - also lack support for querying their mail alias tables. config EGLIBC_OPTION_EGLIBC_ENVZ - bool "Functions for handling envz-style environment vectors." - default y - help - This option group contains functions for creating and operating - on envz vectors. An "envz vector" is a vector of strings in a - contiguous block of memory, where each element is a name-value - pair, and elements are separated from their neighbors by null - characters. + bool "Functions for handling envz-style environment vectors." + default y + help + This option group contains functions for creating and operating + on envz vectors. An "envz vector" is a vector of strings in a + contiguous block of memory, where each element is a name-value + pair, and elements are separated from their neighbors by null + characters. - This option group includes the following functions: + This option group includes the following functions: + + envz_add envz_merge + envz_entry envz_remove + envz_get envz_strip - envz_add envz_merge - envz_entry envz_remove - envz_get envz_strip config EGLIBC_OPTION_EGLIBC_FCVT - bool "Functions for converting floating-point numbers to strings" - default y - depends EGLIBC_VERSION_2_10 - help - This option group includes functions for converting - floating-point numbers to strings. + bool "Functions for converting floating-point numbers to strings" + default y + depends EGLIBC_VERSION_2_10 + help + This option group includes functions for converting + floating-point numbers to strings. - This option group includes the following functions: + This option group includes the following functions: + + ecvt qecvt + ecvt_r qecvt_r + fcvt qfcvt + fcvt_r qfcvt_r + gcvt qgcvt - ecvt qecvt - ecvt_r qecvt_r - fcvt qfcvt - fcvt_r qfcvt_r - gcvt qgcvt config EGLIBC_OPTION_EGLIBC_FMTMSG - bool "Functions for formatting messages" - default y - depends EGLIBC_VERSION_2_10 - help - This option group includes the following functions: + bool "Functions for formatting messages" + default y + depends EGLIBC_VERSION_2_10 + help + This option group includes the following functions: + + addseverity fmtmsg - addseverity fmtmsg config EGLIBC_OPTION_EGLIBC_FSTAB - bool "Access functions for 'fstab'" - default y - help - This option group includes functions for reading the mount - point specification table, '/etc/fstab'. These functions are - not included in the POSIX standard, which provides the - 'getmntent' family of functions instead. + bool "Access functions for 'fstab'" + default y + help + This option group includes functions for reading the mount + point specification table, '/etc/fstab'. These functions are + not included in the POSIX standard, which provides the + 'getmntent' family of functions instead. - This option group includes the following functions: + This option group includes the following functions: - endfsent getfsspec - getfsent setfsent - getfsfile + endfsent getfsspec + getfsent setfsent + getfsfile config EGLIBC_OPTION_EGLIBC_FTRAVERSE - bool "Functions for traversing file hierarchies" - default y - depends EGLIBC_VERSION_2_10 - help - This option group includes functions for traversing file - UNIX file hierachies. + bool "Functions for traversing file hierarchies" + default y + depends EGLIBC_VERSION_2_10 + help + This option group includes functions for traversing file + UNIX file hierachies. - This option group includes the following functions: + This option group includes the following functions: + + fts_open ftw + fts_read nftw + fts_children ftw64 + fts_set nftw64 + fts_close - fts_open ftw - fts_read nftw - fts_children ftw64 - fts_set nftw64 - fts_close config EGLIBC_OPTION_EGLIBC_GETLOGIN - bool "The getlogin function" - default y - select EGLIBC_OPTION_EGLIBC_UTMP - help - This function group includes the 'getlogin' and 'getlogin_r' - functions, which return the user name associated by the login - activity with the current process's controlling terminal. + bool "The getlogin function" + default y + select EGLIBC_OPTION_EGLIBC_UTMP + help + This function group includes the 'getlogin' and 'getlogin_r' + functions, which return the user name associated by the login + activity with the current process's controlling terminal. + + With this option group disabled, the 'glob' function will not + fall back on 'getlogin' to find the user's login name for tilde + expansion when the 'HOME' environment variable is not set. - With this option group disabled, the 'glob' function will not - fall back on 'getlogin' to find the user's login name for tilde - expansion when the 'HOME' environment variable is not set. config EGLIBC_OPTION_EGLIBC_INET - bool "Networking support" - default y - help - This option group includes networking-specific functions and - data. With EGLIBC_INET disabled, the EGLIBC - installation and API changes as follows: + bool "Networking support" + default y + help + This option group includes networking-specific functions and + data. With EGLIBC_OPTION_EGLIBC_INET disabled, the EGLIBC + installation and API changes as follows: - - The following libraries are not installed: + - The following libraries are not installed: - libanl - libnsl - libnss_compat - libnss_dns - libnss_hesiod - libnss_nis - libnss_nisplus - libresolv - - - The following functions and variables are omitted from libc: + libanl + libnsl + libnss_compat + libnss_dns + libnss_hesiod + libnss_nis + libnss_nisplus + libresolv + + - The following functions and variables are omitted from libc: - authdes_create hstrerror svc_fdset - authdes_getucred htonl svc_getreq - authdes_pk_create htons svc_getreq_common - authnone_create if_freenameindex svc_getreq_poll - authunix_create if_indextoname svc_getreqset - authunix_create_default if_nameindex svc_max_pollfd - bindresvport if_nametoindex svc_pollfd - callrpc in6addr_any svcraw_create - cbc_crypt in6addr_loopback svc_register - clnt_broadcast inet6_opt_append svc_run - clnt_create inet6_opt_find svc_sendreply - clnt_pcreateerror inet6_opt_finish svctcp_create - clnt_perrno inet6_opt_get_val svcudp_bufcreate - clnt_perror inet6_opt_init svcudp_create - clntraw_create inet6_alloc svcudp_enablecache - clnt_spcreateerror inet6_append svcunix_create - clnt_sperrno inet6_find svcunixfd_create - clnt_sperror inet6_init svc_unregister - clnttcp_create inet6_next user2netname - clntudp_bufcreate inet6_space xdecrypt - clntudp_create inet6_opt_next xdr_accepted_reply - clntunix_create inet6_opt_set_val xdr_array - des_setparity inet6_rth_add xdr_authdes_cred - ecb_crypt inet6_rth_getaddr xdr_authdes_verf - endaliasent inet6_rth_init xdr_authunix_parms - endhostent inet6_rth_reverse xdr_bool - endnetent inet6_rth_segments xdr_bytes - endnetgrent inet6_rth_space xdr_callhdr - endprotoent inet_addr xdr_callmsg - endrpcent inet_aton xdr_char - endservent inet_lnaof xdr_cryptkeyarg - ether_aton inet_makeaddr xdr_cryptkeyarg2 - ether_aton_r inet_netof xdr_cryptkeyres - ether_hostton inet_network xdr_des_block - ether_line inet_nsap_addr xdr_double - ether_ntoa inet_nsap_ntoa xdr_enum - ether_ntoa_r inet_ntoa xdr_float - ether_ntohost inet_ntop xdr_free - freeaddrinfo inet_pton xdr_getcredres - freeifaddrs innetgr xdr_hyper - gai_strerror iruserok xdr_int - getaddrinfo iruserok_af xdr_int16_t - getaliasbyname key_decryptsession xdr_int32_t - getaliasbyname_r key_decryptsession_pk xdr_int64_t - getaliasent key_encryptsession xdr_int8_t - getaliasent_r key_encryptsession_pk xdr_keybuf - gethostbyaddr key_gendes xdr_key_netstarg - gethostbyaddr_r key_get_conv xdr_key_netstres - gethostbyname key_secretkey_is_set xdr_keystatus - gethostbyname2 key_setnet xdr_long - gethostbyname2_r key_setsecret xdr_longlong_t - gethostbyname_r netname2host xdrmem_create - gethostent netname2user xdr_netnamestr - gethostent_r ntohl xdr_netobj - getifaddrs ntohs xdr_opaque - getipv4sourcefilter passwd2des xdr_opaque_auth - get_myaddress pmap_getmaps xdr_pmap - getnameinfo pmap_getport xdr_pmaplist - getnetbyaddr pmap_rmtcall xdr_pointer - getnetbyaddr_r pmap_set xdr_quad_t - getnetbyname pmap_unset xdrrec_create - getnetbyname_r rcmd xdrrec_endofrecord - getnetent rcmd_af xdrrec_eof - getnetent_r registerrpc xdrrec_skiprecord - getnetgrent res_init xdr_reference - getnetgrent_r rexec xdr_rejected_reply - getnetname rexec_af xdr_replymsg - getprotobyname rexecoptions xdr_rmtcall_args - getprotobyname_r rpc_createerr xdr_rmtcallres - getprotobynumber rresvport xdr_short - getprotobynumber_r rresvport_af xdr_sizeof - getprotoent rtime xdrstdio_create - getprotoent_r ruserok xdr_string - getpublickey ruserok_af xdr_u_char - getrpcbyname ruserpass xdr_u_hyper - getrpcbyname_r setaliasent xdr_u_int - getrpcbynumber sethostent xdr_uint16_t - getrpcbynumber_r setipv4sourcefilter xdr_uint32_t - getrpcent setnetent xdr_uint64_t - getrpcent_r setnetgrent xdr_uint8_t - getrpcport setprotoent xdr_u_long - getsecretkey setrpcent xdr_u_longlong_t - getservbyname setservent xdr_union - getservbyname_r setsourcefilter xdr_unixcred - getservbyport svcauthdes_stats xdr_u_quad_t - getservbyport_r svcerr_auth xdr_u_short - getservent svcerr_decode xdr_vector - getservent_r svcerr_noproc xdr_void - getsourcefilter svcerr_noprog xdr_wrapstring - h_errlist svcerr_progvers xencrypt - h_errno svcerr_systemerr xprt_register - herror svcerr_weakauth xprt_unregister - h_nerr svc_exit - host2netname svcfd_create + authdes_create hstrerror svc_fdset + authdes_getucred htonl svc_getreq + authdes_pk_create htons svc_getreq_common + authnone_create if_freenameindex svc_getreq_poll + authunix_create if_indextoname svc_getreqset + authunix_create_default if_nameindex svc_max_pollfd + bindresvport if_nametoindex svc_pollfd + callrpc in6addr_any svcraw_create + cbc_crypt in6addr_loopback svc_register + clnt_broadcast inet6_opt_append svc_run + clnt_create inet6_opt_find svc_sendreply + clnt_pcreateerror inet6_opt_finish svctcp_create + clnt_perrno inet6_opt_get_val svcudp_bufcreate + clnt_perror inet6_opt_init svcudp_create + clntraw_create inet6_option_alloc svcudp_enablecache + clnt_spcreateerror inet6_option_append svcunix_create + clnt_sperrno inet6_option_find svcunixfd_create + clnt_sperror inet6_option_init svc_unregister + clnttcp_create inet6_option_next user2netname + clntudp_bufcreate inet6_option_space xdecrypt + clntudp_create inet6_opt_next xdr_accepted_reply + clntunix_create inet6_opt_set_val xdr_array + des_setparity inet6_rth_add xdr_authdes_cred + ecb_crypt inet6_rth_getaddr xdr_authdes_verf + endaliasent inet6_rth_init xdr_authunix_parms + endhostent inet6_rth_reverse xdr_bool + endnetent inet6_rth_segments xdr_bytes + endnetgrent inet6_rth_space xdr_callhdr + endprotoent inet_addr xdr_callmsg + endrpcent inet_aton xdr_char + endservent inet_lnaof xdr_cryptkeyarg + ether_aton inet_makeaddr xdr_cryptkeyarg2 + ether_aton_r inet_netof xdr_cryptkeyres + ether_hostton inet_network xdr_des_block + ether_line inet_nsap_addr xdr_double + ether_ntoa inet_nsap_ntoa xdr_enum + ether_ntoa_r inet_ntoa xdr_float + ether_ntohost inet_ntop xdr_free + freeaddrinfo inet_pton xdr_getcredres + freeifaddrs innetgr xdr_hyper + gai_strerror iruserok xdr_int + getaddrinfo iruserok_af xdr_int16_t + getaliasbyname key_decryptsession xdr_int32_t + getaliasbyname_r key_decryptsession_pk xdr_int64_t + getaliasent key_encryptsession xdr_int8_t + getaliasent_r key_encryptsession_pk xdr_keybuf + gethostbyaddr key_gendes xdr_key_netstarg + gethostbyaddr_r key_get_conv xdr_key_netstres + gethostbyname key_secretkey_is_set xdr_keystatus + gethostbyname2 key_setnet xdr_long + gethostbyname2_r key_setsecret xdr_longlong_t + gethostbyname_r netname2host xdrmem_create + gethostent netname2user xdr_netnamestr + gethostent_r ntohl xdr_netobj + getifaddrs ntohs xdr_opaque + getipv4sourcefilter passwd2des xdr_opaque_auth + get_myaddress pmap_getmaps xdr_pmap + getnameinfo pmap_getport xdr_pmaplist + getnetbyaddr pmap_rmtcall xdr_pointer + getnetbyaddr_r pmap_set xdr_quad_t + getnetbyname pmap_unset xdrrec_create + getnetbyname_r rcmd xdrrec_endofrecord + getnetent rcmd_af xdrrec_eof + getnetent_r registerrpc xdrrec_skiprecord + getnetgrent res_init xdr_reference + getnetgrent_r rexec xdr_rejected_reply + getnetname rexec_af xdr_replymsg + getprotobyname rexecoptions xdr_rmtcall_args + getprotobyname_r rpc_createerr xdr_rmtcallres + getprotobynumber rresvport xdr_short + getprotobynumber_r rresvport_af xdr_sizeof + getprotoent rtime xdrstdio_create + getprotoent_r ruserok xdr_string + getpublickey ruserok_af xdr_u_char + getrpcbyname ruserpass xdr_u_hyper + getrpcbyname_r setaliasent xdr_u_int + getrpcbynumber sethostent xdr_uint16_t + getrpcbynumber_r setipv4sourcefilter xdr_uint32_t + getrpcent setnetent xdr_uint64_t + getrpcent_r setnetgrent xdr_uint8_t + getrpcport setprotoent xdr_u_long + getsecretkey setrpcent xdr_u_longlong_t + getservbyname setservent xdr_union + getservbyname_r setsourcefilter xdr_unixcred + getservbyport svcauthdes_stats xdr_u_quad_t + getservbyport_r svcerr_auth xdr_u_short + getservent svcerr_decode xdr_vector + getservent_r svcerr_noproc xdr_void + getsourcefilter svcerr_noprog xdr_wrapstring + h_errlist svcerr_progvers xencrypt + h_errno svcerr_systemerr xprt_register + herror svcerr_weakauth xprt_unregister + h_nerr svc_exit + host2netname svcfd_create - - The rpcgen, nscd, and rpcinfo commands are not installed. + - The rpcgen, nscd, and rpcinfo commands are not installed. - - The 'rpc' file (a text file listing RPC services) is not installed. + - The 'rpc' file (a text file listing RPC services) is not installed. + + Socket-related system calls do not fall in this option group, + because many are also used for other inter-process + communication mechanisms. For example, the 'syslog' routines + use Unix-domain sockets to communicate with the syslog daemon; + syslog is valuable in non-networked contexts. - Socket-related system calls do not fall in this option group, - because many are also used for other inter-process - communication mechanisms. For example, the 'syslog' routines - use Unix-domain sockets to communicate with the syslog daemon; - syslog is valuable in non-networked contexts. config EGLIBC_OPTION_EGLIBC_LIBM - bool "libm (math library)" - default y - help - This option group includes the 'libm' library, containing - mathematical functions. If this option group is omitted, then - an EGLIBC installation does not include shared or unshared versions - of the math library. + bool "libm (math library)" + default y + help + This option group includes the 'libm' library, containing + mathematical functions. If this option group is omitted, then + an EGLIBC installation does not include shared or unshared versions + of the math library. - Note that this does not remove all floating-point related - functionality from EGLIBC; for example, 'printf' and 'scanf' - can still print and read floating-point values with this option - group disabled. + Note that this does not remove all floating-point related + functionality from EGLIBC; for example, 'printf' and 'scanf' + can still print and read floating-point values with this option + group disabled. + + Note that the ISO Standard C++ library 'libstdc++' depends on + EGLIBC's math library 'libm'. If you disable this option + group, you will not be able to build 'libstdc++' against the + resulting EGLIBC installation. - Note that the ISO Standard C++ library 'libstdc++' depends on - EGLIBC's math library 'libm'. If you disable this option - group, you will not be able to build 'libstdc++' against the - resulting EGLIBC installation. config EGLIBC_OPTION_EGLIBC_LOCALES - bool "Locale definitions" - default y - help - This option group includes all locale definitions other than - that for the "C" locale. If this option group is omitted, then - only the "C" locale is supported. + bool "Locale definitions" + default y + help + This option group includes all locale definitions other than + that for the "C" locale. If this option group is omitted, then + only the "C" locale is supported. config EGLIBC_OPTION_EGLIBC_LOCALE_CODE - bool "Locale functions" - default y - select EGLIBC_OPTION_POSIX_C_LANG_WIDE_CHAR if EGLIBC_VERSION_2_8 || EGLIBC_VERSION_2_9 || EGLIBC_VERSION_2_10 - help - This option group includes locale support functions, programs, - and libraries. With EGLIBC_LOCALE_FUNCTIONS disabled, - EGLIBC supports only the 'C' locale (also known as 'POSIX'), - and ignores the settings of the 'LANG' and 'LC_*' environment - variables. + bool "Locale functions" + default y + select EGLIBC_OPTION_POSIX_C_LANG_WIDE_CHAR if EGLIBC_VERSION_2_8 || EGLIBC_VERSION_2_9 || EGLIBC_VERSION_2_10 + help + This option group includes locale support functions, programs, + and libraries. With EGLIBC_LOCALE_FUNCTIONS disabled, + EGLIBC supports only the 'C' locale (also known as 'POSIX'), + and ignores the settings of the 'LANG' and 'LC_*' environment + variables. - With EGLIBC_LOCALE_CODE disabled, the following - functions are omitted from libc: + With EGLIBC_OPTION_LOCALE_CODE disabled, the following + functions are omitted from libc: - duplocale localeconv nl_langinfo rpmatch strfmon_l - freelocale newlocale nl_langinfo_l strfmon uselocale + duplocale localeconv nl_langinfo rpmatch strfmon_l + freelocale newlocale nl_langinfo_l strfmon uselocale - Furthermore, only the LC_CTYPE and LC_TIME categories of the - standard "C" locale are available. + Furthermore, only the LC_CTYPE and LC_TIME categories of the + standard "C" locale are available. + + The EGLIBC_OPTION_EGLIBC_CATGETS option group depends on this option + group; if you disable EGLIBC_OPTION_EGLIBC_LOCALE_CODE, you must also + disable EGLIBC_OPTION_EGLIBC_CATGETS. - The EGLIBC_CATGETS option group depends on this option - group; if you disable EGLIBC_LOCALE_CODE, you must also - disable EGLIBC_CATGETS. config EGLIBC_OPTION_EGLIBC_NIS - bool "Support for NIS, NIS+, and the special 'compat' services." - default y - select EGLIBC_OPTION_EGLIBC_INET - select EGLIBC_OPTION_EGLIBC_SUNRPC - help - This option group includes the NIS, NIS+, and 'compat' Name - Service Switch service libraries. When it is disabled, those - services libraries are not installed; you should remove any - references to them from your 'nsswitch.conf' file. + bool "Support for NIS, NIS+, and the special 'compat' services." + default y + select EGLIBC_OPTION_EGLIBC_INET + select EGLIBC_OPTION_EGLIBC_SUNRPC + help + This option group includes the NIS, NIS+, and 'compat' Name + Service Switch service libraries. When it is disabled, those + services libraries are not installed; you should remove any + references to them from your 'nsswitch.conf' file. + + This option group depends on the EGLIBC_OPTION_EGLIBC_INET option + group; you must enable that to enable this option group. - This option group depends on the EGLIBC_INET option - group; you must enable that to enable this option group. config EGLIBC_OPTION_EGLIBC_NSSWITCH - bool "Name service switch (nsswitch) support" - default y - help + bool "Name service switch (nsswitch) support" + default y + help - This option group includes support for the 'nsswitch' facility. - With this option group enabled, all EGLIBC functions for - accessing various system databases (passwords and groups; - networking; aliases; public keys; and so on) consult the - '/etc/nsswitch.conf' configuration file to decide how to handle - queries. + This option group includes support for the 'nsswitch' facility. + With this option group enabled, all EGLIBC functions for + accessing various system databases (passwords and groups; + networking; aliases; public keys; and so on) consult the + '/etc/nsswitch.conf' configuration file to decide how to handle + queries. - With this option group disabled, EGLIBC uses a fixed list of - services to satisfy queries on each database, as requested by - configuration files specified when EGLIBC is built. Your - 'option-groups.config' file must set the following two - variables: + With this option group disabled, EGLIBC uses a fixed list of + services to satisfy queries on each database, as requested by + configuration files specified when EGLIBC is built. Your + 'option-groups.config' file must set the following two + variables: - EGLIBC_NSSWITCH_FIXED_CONFIG + EGLIBC_OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG - Set this to the name of a file whose contents observe the - same syntax as an ordinary '/etc/nsswitch.conf' file. The - EGLIBC build process parses this file just as EGLIBC would - at run time if EGLIBC_NSSWITCH were enabled, and - produces a C library that uses the nsswitch service - libraries to search for database entries as this file - specifies, instead of consulting '/etc/nsswitch.conf' at run - time. + Set this to the name of a file whose contents observe the + same syntax as an ordinary '/etc/nsswitch.conf' file. The + EGLIBC build process parses this file just as EGLIBC would + at run time if EGLIBC_NSSWITCH were enabled, and + produces a C library that uses the nsswitch service + libraries to search for database entries as this file + specifies, instead of consulting '/etc/nsswitch.conf' at run + time. - This should be an absolute filename. The EGLIBC build - process may use it from several different working - directories. It may include references to Makefile - variables like 'common-objpfx' (the top of the build tree, - with a trailing slash), or '..' (the top of the source tree, - with a trailing slash). + This should be an absolute filename. The EGLIBC build + process may use it from several different working + directories. It may include references to Makefile + variables like 'common-objpfx' (the top of the build tree, + with a trailing slash), or '..' (the top of the source tree, + with a trailing slash). - The EGLIBC source tree includes a sample configuration file - named 'nss/fixed-nsswitch.conf'; for simple configurations, - you will probably want to delete references to databases not - needed on your system. + The EGLIBC source tree includes a sample configuration file + named 'nss/fixed-nsswitch.conf'; for simple configurations, + you will probably want to delete references to databases not + needed on your system. - EGLIBC_NSSWITCH_FIXED_FUNCTIONS + EGLIBC_OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS - The EGLIBC build process uses this file to decide which - functions to make available from which service libraries. - The file 'nss/fixed-nsswitch.functions' serves as a sample - configuration file for this setting, and explains its syntax - and meaning in more detail. + The EGLIBC build process uses this file to decide which + functions to make available from which service libraries. + The file 'nss/fixed-nsswitch.functions' serves as a sample + configuration file for this setting, and explains its syntax + and meaning in more detail. - This should be an absolute file name. The EGLIBC build - process may use it from several different working - directories. It may include references to Makefile - variables like 'common-objpfx' (the top of the build tree, - with a trailing slash), or '..' (the top of the source tree, - with a trailing slash). + This should be an absolute file name. The EGLIBC build + process may use it from several different working + directories. It may include references to Makefile + variables like 'common-objpfx' (the top of the build tree, + with a trailing slash), or '..' (the top of the source tree, + with a trailing slash). - Be sure to mention each function in each service you wish to - use. If you do not mention a service's function here, the - EGLIBC database access functions will not find it, even if - it is listed in the EGLIBC_NSSWITCH_FIXED_CONFIG - file. + Be sure to mention each function in each service you wish to + use. If you do not mention a service's function here, the + EGLIBC database access functions will not find it, even if + it is listed in the EGLIBC_OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG + file. - In this arrangement, EGLIBC will not use the 'dlopen' and - 'dlsym' functions to find database access functions. Instead, - libc hard-codes references to the service libraries' database - access functions. You must explicitly link your program - against the name service libraries (those whose names start - with 'libnss_', in the sysroot's '/lib' directory) whose - functions you intend to use. This arrangement helps - system-wide static analysis tools decide which functions a - system actually uses. + In this arrangement, EGLIBC will not use the 'dlopen' and + 'dlsym' functions to find database access functions. Instead, + libc hard-codes references to the service libraries' database + access functions. You must explicitly link your program + against the name service libraries (those whose names start + with 'libnss_', in the sysroot's '/lib' directory) whose + functions you intend to use. This arrangement helps + system-wide static analysis tools decide which functions a + system actually uses. + + Note that some nsswitch service libraries require other option + groups to be enabled; for example, the EGLIBC_INET + option group must be enabled to use the 'libnss_dns.so.2' + service library, which uses the Domain Name System network + protocol to answer queries. - Note that some nsswitch service libraries require other option - groups to be enabled; for example, the EGLIBC_INET - option group must be enabled to use the 'libnss_dns.so.2' - service library, which uses the Domain Name System network - protocol to answer queries. config EGLIBC_OPTION_EGLIBC_RCMD - bool "Support for 'rcmd' and related library functions" - default y - select EGLIBC_OPTION_EGLIBC_INET - help - This option group includes functions for running commands on - remote machines via the 'rsh' protocol, and doing authentication - related to those functions. This also includes functions that - use the 'rexec' protocol. + bool "Support for 'rcmd' and related library functions" + default y + select EGLIBC_OPTION_EGLIBC_INET + help + This option group includes functions for running commands on + remote machines via the 'rsh' protocol, and doing authentication + related to those functions. This also includes functions that + use the 'rexec' protocol. + + This option group includes the following functions: + + rcmd ruserok + rcmd_af ruserok_af + rexec iruserok + rexec_af iruserok_af + rresvport ruserpass + rresvport_af - This option group includes the following functions: - rcmd ruserok - rcmd_af ruserok_af - rexec iruserok - rexec_af iruserok_af - rresvport ruserpass - rresvport_af - config EGLIBC_OPTION_EGLIBC_SPAWN - bool "Support for POSIX posix_spawn functions" - default y - help - This option group includes the POSIX functions for executing - programs in child processes without using 'fork' or 'vfork'. + bool "Support for POSIX posix_spawn functions" + default y + help + This option group includes the POSIX functions for executing + programs in child processes without using 'fork' or 'vfork'. - This option group includes the following functions: + This option group includes the following functions: - posix_spawn - posix_spawnattr_destroy - posix_spawnattr_getflags - posix_spawnattr_getpgroup - posix_spawnattr_getschedparam - posix_spawnattr_getschedpolicy - posix_spawnattr_getsigdefault - posix_spawnattr_getsigmask - posix_spawnattr_init - posix_spawnattr_setflags - posix_spawnattr_setpgroup - posix_spawnattr_setschedparam - posix_spawnattr_setschedpolicy - posix_spawnattr_setsigdefault - posix_spawnattr_setsigmask - posix_spawn_file_actions_addclose - posix_spawn_file_actions_adddup2 - posix_spawn_file_actions_addopen - posix_spawn_file_actions_destroy - posix_spawn_file_actions_init - posix_spawnp + posix_spawn + posix_spawnattr_destroy + posix_spawnattr_getflags + posix_spawnattr_getpgroup + posix_spawnattr_getschedparam + posix_spawnattr_getschedpolicy + posix_spawnattr_getsigdefault + posix_spawnattr_getsigmask + posix_spawnattr_init + posix_spawnattr_setflags + posix_spawnattr_setpgroup + posix_spawnattr_setschedparam + posix_spawnattr_setschedpolicy + posix_spawnattr_setsigdefault + posix_spawnattr_setsigmask + posix_spawn_file_actions_addclose + posix_spawn_file_actions_adddup2 + posix_spawn_file_actions_addopen + posix_spawn_file_actions_destroy + posix_spawn_file_actions_init + posix_spawnp + + This option group also provides the ability for the iconv, + localedef, and locale programs to operate transparently on + compressed charset definitions. When this option group is + disabled, those programs will only operate on uncompressed + charmap files. - This option group also provides the ability for the iconv, - localedef, and locale programs to operate transparently on - compressed charset definitions. When this option group is - disabled, those programs will only operate on uncompressed - charmap files. config EGLIBC_OPTION_EGLIBC_STREAMS - bool "Support for accessing STREAMS." - default y - help - This option group includes functions for reading and writing - messages to and from STREAMS. The STREAMS interface provides a - uniform mechanism for implementing networking services and other - character-based I/O. (STREAMS are not to be confused with - FILE objects, also called 'streams'.) + bool "Support for accessing STREAMS." + default y + help + This option group includes functions for reading and writing + messages to and from STREAMS. The STREAMS interface provides a + uniform mechanism for implementing networking services and other + character-based I/O. (STREAMS are not to be confused with + FILE objects, also called 'streams'.) - This option group includes the following functions: + This option group includes the following functions: + + getmsg putpmsg + getpmsg fattach + isastream fdetach + putmsg - getmsg putpmsg - getpmsg fattach - isastream fdetach - putmsg config EGLIBC_OPTION_EGLIBC_SUNRPC - bool "Support for the Sun 'RPC' protocol." - default y - select EGLIBC_OPTION_EGLIBC_INET - help - This option group includes support for the Sun RPC protocols, - including the 'rpcgen' and 'rpcinfo' programs. + bool "Support for the Sun 'RPC' protocol." + default y + select EGLIBC_OPTION_EGLIBC_INET + help + This option group includes support for the Sun RPC protocols, + including the 'rpcgen' and 'rpcinfo' programs. + config EGLIBC_OPTION_EGLIBC_UTMP - bool "Older access functions for 'utmp' login records" - default y - help - This option group includes the older 'utent' family of - functions for accessing user login records in the 'utmp' file. - POSIX omits these functions in favor of the 'utxent' family, - and they are obsolete on systems other than Linux. + bool "Older access functions for 'utmp' login records" + default y + help + This option group includes the older 'utent' family of + functions for accessing user login records in the 'utmp' file. + POSIX omits these functions in favor of the 'utxent' family, + and they are obsolete on systems other than Linux. - This option group includes the following functions: + This option group includes the following functions: - endutent - getutent - getutent_r - getutid - getutid_r - getutline - getutline_r - logwtmp - pututline - setutent - updwtmp - utmpname + endutent + getutent + getutent_r + getutid + getutid_r + getutline + getutline_r + logwtmp + pututline + setutent + updwtmp + utmpname - This option group includes the following libraries: + This option group includes the following libraries: + + libutil.so (and libutil.a) - libutil.so (and libutil.a) config EGLIBC_OPTION_EGLIBC_UTMPX - bool "POSIX access functions for 'utmp' login records" - default y - select EGLIBC_OPTION_EGLIBC_UTMP - help - This option group includes the POSIX functions for reading and - writing user login records in the 'utmp' file (usually - '/var/run/utmp'). The POSIX functions operate on 'struct - utmpx' structures, as opposed to the family of older 'utent' - functions, which operate on 'struct utmp' structures. + bool "POSIX access functions for 'utmp' login records" + default y + select EGLIBC_OPTION_EGLIBC_UTMP + help + This option group includes the POSIX functions for reading and + writing user login records in the 'utmp' file (usually + '/var/run/utmp'). The POSIX functions operate on 'struct + utmpx' structures, as opposed to the family of older 'utent' + functions, which operate on 'struct utmp' structures. - This option group includes the following functions: + This option group includes the following functions: + + endutxent + getutmp + getutmpx + getutxent + getutxid + getutxline + pututxline + setutxent + updwtmpx + utmpxname - endutxent - getutmp - getutmpx - getutxent - getutxid - getutxline - pututxline - setutxent - updwtmpx - utmpxname config EGLIBC_OPTION_EGLIBC_WORDEXP - bool "Shell-style word expansion" - default y - help - This option group includes the 'wordexp' function for - performing word expansion in the manner of the shell, and the - accompanying 'wordfree' function. + bool "Shell-style word expansion" + default y + help + This option group includes the 'wordexp' function for + performing word expansion in the manner of the shell, and the + accompanying 'wordfree' function. + config EGLIBC_OPTION_POSIX_C_LANG_WIDE_CHAR - bool "ISO C library wide character functions, excluding I/O" - default y - depends EGLIBC_VERSION_2_8 || EGLIBC_VERSION_2_9 || EGLIBC_VERSION_2_10 - help - This option group includes the functions defined by the ISO C - standard for working with wide and multibyte characters in - memory. Functions for reading and writing wide and multibyte - characters from and to files call in the - POSIX_WIDE_CHAR_DEVICE_IO option group. + bool "ISO C library wide character functions, excluding I/O" + default y + depends EGLIBC_VERSION_2_8 || EGLIBC_VERSION_2_9 || EGLIBC_VERSION_2_10 + help + This option group includes the functions defined by the ISO C + standard for working with wide and multibyte characters in + memory. Functions for reading and writing wide and multibyte + characters from and to files call in the + EGLIBC_OPTION_POSIX_WIDE_CHAR_DEVICE_IO option group. - This option group includes the following functions: + This option group includes the following functions: + + btowc mbsinit wcscspn wcstoll + iswalnum mbsrtowcs wcsftime wcstombs + iswalpha mbstowcs wcslen wcstoul + iswblank mbtowc wcsncat wcstoull + iswcntrl swprintf wcsncmp wcstoumax + iswctype swscanf wcsncpy wcsxfrm + iswdigit towctrans wcspbrk wctob + iswgraph towlower wcsrchr wctomb + iswlower towupper wcsrtombs wctrans + iswprint vswprintf wcsspn wctype + iswpunct vswscanf wcsstr wmemchr + iswspace wcrtomb wcstod wmemcmp + iswupper wcscat wcstof wmemcpy + iswxdigit wcschr wcstoimax wmemmove + mblen wcscmp wcstok wmemset + mbrlen wcscoll wcstol + mbrtowc wcscpy wcstold - btowc mbsinit wcscspn wcstoll - iswalnum mbsrtowcs wcsftime wcstombs - iswalpha mbstowcs wcslen wcstoul - iswblank mbtowc wcsncat wcstoull - iswcntrl swprintf wcsncmp wcstoumax - iswctype swscanf wcsncpy wcsxfrm - iswdigit towctrans wcspbrk wctob - iswgraph towlower wcsrchr wctomb - iswlower towupper wcsrtombs wctrans - iswprint vswprintf wcsspn wctype - iswpunct vswscanf wcsstr wmemchr - iswspace wcrtomb wcstod wmemcmp - iswupper wcscat wcstof wmemcpy - iswxdigit wcschr wcstoimax wmemmove - mblen wcscmp wcstok wmemset - mbrlen wcscoll wcstol - mbrtowc wcscpy wcstold config EGLIBC_OPTION_POSIX_REGEXP - bool "Regular expressions" - default y - help - This option group includes the POSIX regular expression - functions, and the associated non-POSIX extensions and - compatibility functions. + bool "Regular expressions" + default y + help + This option group includes the POSIX regular expression + functions, and the associated non-POSIX extensions and + compatibility functions. - With POSIX_REGEXP disabled, the following functions are - omitted from libc: + With EGLIBC_OPTION_POSIX_REGEXP disabled, the following functions are + omitted from libc: - re_comp re_max_failures regcomp - re_compile_fastmap re_search regerror - re_compile_pattern re_search_2 regexec - re_exec re_set_registers regfree - re_match re_set_syntax rpmatch - re_match_2 re_syntax_options + re_comp re_max_failures regcomp + re_compile_fastmap re_search regerror + re_compile_pattern re_search_2 regexec + re_exec re_set_registers regfree + re_match re_set_syntax rpmatch + re_match_2 re_syntax_options + + Furthermore, the compatibility regexp interface defined in the + header file, 'compile', 'step', and 'advance', is + omitted. - Furthermore, the compatibility regexp interface defined in the - header file, 'compile', 'step', and 'advance', is - omitted. config EGLIBC_OPTION_POSIX_REGEXP_GLIBC - bool "Regular expressions from GLIBC" - default y - select EGLIBC_OPTION_POSIX_REGEXP - depends EGLIBC_VERSION_2_10 - help - This option group specifies which regular expression - library to use. The choice is between regex - implementation from GLIBC and regex implementation from - libiberty. The GLIBC variant is fully POSIX conformant and - optimized for speed; regex from libiberty is more than twice - as small while still is enough for most practical purposes. + bool "Regular expressions from GLIBC" + default y + depends EGLIBC_VERSION_2_10 + select EGLIBC_OPTION_POSIX_REGEXP + help + This option group specifies which regular expression + library to use. The choice is between regex + implementation from GLIBC and regex implementation from + libiberty. The GLIBC variant is fully POSIX conformant and + optimized for speed; regex from libiberty is more than twice + as small while still is enough for most practical purposes. + config EGLIBC_OPTION_POSIX_WIDE_CHAR_DEVICE_IO - bool "Input and output functions for wide characters" - default y - select EGLIBC_OPTION_POSIX_C_LANG_WIDE_CHAR if EGLIBC_VERSION_2_8 || EGLIBC_VERSION_2_9 || EGLIBC_VERSION_2_10 - help - This option group includes functions for reading and writing - wide characters to and from streams. + bool "Input and output functions for wide characters" + default y + select EGLIBC_OPTION_POSIX_C_LANG_WIDE_CHAR if EGLIBC_VERSION_2_8 || EGLIBC_VERSION_2_9 || EGLIBC_VERSION_2_10 + help + This option group includes functions for reading and writing + wide characters to and from streams. - This option group includes the following functions: + This option group includes the following functions: - fgetwc fwprintf putwchar vwscanf - fgetws fwscanf ungetwc wprintf - fputwc getwc vfwprintf wscanf - fputws getwchar vfwscanf - fwide putwc vwprintf + fgetwc fwprintf putwchar vwscanf + fgetws fwscanf ungetwc wprintf + fputwc getwc vfwprintf wscanf + fputws getwchar vfwscanf + fwide putwc vwprintf - This option group further includes the following unlocked - variants of the above functions: + This option group further includes the following unlocked + variants of the above functions: - fgetwc_unlocked getwc_unlocked - fgetws_unlocked getwchar_unlocked - fputwc_unlocked putwc_unlocked - fputws_unlocked putwchar_unlocked - - Note that the GNU standard C++ library, 'libstdc++.so', uses - some of these functions; you will not be able to link or run - C++ programs if you disable this option group. + fgetwc_unlocked getwc_unlocked + fgetws_unlocked getwchar_unlocked + fputwc_unlocked putwc_unlocked + fputws_unlocked putwchar_unlocked + + Note that the GNU standard C++ library, 'libstdc++.so', uses + some of these functions; you will not be able to link or run + C++ programs if you disable this option group. - This option group also affects the behavior of the following - functions: + This option group also affects the behavior of the following + functions: - fdopen - fopen - fopen64 - freopen - freopen64 + fdopen + fopen + fopen64 + freopen + freopen64 - These functions all take an OPENTYPE parameter which may - contain a string of the form ",ccs=CHARSET", indicating that - the underlying file uses the character set named CHARSET. - This produces a wide-oriented stream, which is only useful - when the functions included in this option group are present. - If the user attempts to open a file specifying a character set - in the OPENTYPE parameter, and EGLIBC was built with this - option group disabled, the function returns NULL, and sets - errno to EINVAL. + These functions all take an OPENTYPE parameter which may + contain a string of the form ",ccs=CHARSET", indicating that + the underlying file uses the character set named CHARSET. + This produces a wide-oriented stream, which is only useful + when the functions included in this option group are present. + If the user attempts to open a file specifying a character set + in the OPENTYPE parameter, and EGLIBC was built with this + option group disabled, the function returns NULL, and sets + errno to EINVAL. From 97d70dd8598d81077ffff6db013511670ee9aaad Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 22 Nov 2009 15:49:35 +0000 Subject: [PATCH 209/288] cosmetic: more reformatting missed from [18480] git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18481 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- toolchain/eglibc/config/Config.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/toolchain/eglibc/config/Config.in b/toolchain/eglibc/config/Config.in index a55c66081..eed1b2f90 100644 --- a/toolchain/eglibc/config/Config.in +++ b/toolchain/eglibc/config/Config.in @@ -237,6 +237,7 @@ config EGLIBC_OPTION_EGLIBC_FSTAB getfsent setfsent getfsfile + config EGLIBC_OPTION_EGLIBC_FTRAVERSE bool "Functions for traversing file hierarchies" default y @@ -430,12 +431,12 @@ config EGLIBC_OPTION_EGLIBC_LOCALE_CODE select EGLIBC_OPTION_POSIX_C_LANG_WIDE_CHAR if EGLIBC_VERSION_2_8 || EGLIBC_VERSION_2_9 || EGLIBC_VERSION_2_10 help This option group includes locale support functions, programs, - and libraries. With EGLIBC_LOCALE_FUNCTIONS disabled, + and libraries. With EGLIBC_OPTION_EGLIBC_LOCALE_CODE disabled, EGLIBC supports only the 'C' locale (also known as 'POSIX'), and ignores the settings of the 'LANG' and 'LC_*' environment variables. - With EGLIBC_OPTION_LOCALE_CODE disabled, the following + With EGLIBC_OPTION_EGLIBC_LOCALE_CODE disabled, the following functions are omitted from libc: duplocale localeconv nl_langinfo rpmatch strfmon_l From 26df34e35ffe671aa1b5d62f22f7f0edccea7f68 Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 22 Nov 2009 17:00:50 +0000 Subject: [PATCH 210/288] busybox: restore previous inittab handling when terminal can't be accessed (closes: #6181) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18485 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/busybox/patches/001-init_avoid_loop_opening_tty.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/busybox/patches/001-init_avoid_loop_opening_tty.patch b/package/busybox/patches/001-init_avoid_loop_opening_tty.patch index 8cc9ca2c8..8f0ef1fc0 100644 --- a/package/busybox/patches/001-init_avoid_loop_opening_tty.patch +++ b/package/busybox/patches/001-init_avoid_loop_opening_tty.patch @@ -6,7 +6,7 @@ */ - if (a->pid == 0) + if (a->pid == 0) { -+ if (a->terminal && access(a->terminal, R_OK | W_OK)) ++ if (a->terminal[0] && access(a->terminal, R_OK | W_OK)) + continue; a->pid = run(a); + } From 1a0728cfcf9e98da7a3184710a33c62e519e1844 Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 23 Nov 2009 17:12:54 +0000 Subject: [PATCH 211/288] hostapd: fix rebuild checks (#6210) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18497 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- include/package.mk | 2 +- package/hostapd/Makefile | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/package.mk b/include/package.mk index 4ee9d7129..90aa51c59 100644 --- a/include/package.mk +++ b/include/package.mk @@ -17,7 +17,7 @@ include $(INCLUDE_DIR)/unpack.mk include $(INCLUDE_DIR)/depends.mk STAMP_PREPARED=$(PKG_BUILD_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call find_md5,${CURDIR} $(PKG_FILE_DEPENDS),))) -STAMP_CONFIGURED:=$(PKG_BUILD_DIR)/.configured$(if $(QUILT)$(DUMP),,_$(call confvar,$(PKG_CONFIG_DEPENDS))) +STAMP_CONFIGURED:=$(PKG_BUILD_DIR)/.configured$(if $(DUMP),,_$(call confvar,$(PKG_CONFIG_DEPENDS))) STAMP_BUILT:=$(PKG_BUILD_DIR)/.built STAMP_INSTALLED:=$(STAGING_DIR)/stamp/.$(PKG_NAME)_installed diff --git a/package/hostapd/Makefile b/package/hostapd/Makefile index bb497fec3..b1dde1c45 100644 --- a/package/hostapd/Makefile +++ b/package/hostapd/Makefile @@ -80,9 +80,19 @@ define Package/hostapd-utils/description IEEE 802.1x/WPA/EAP/RADIUS Authenticator. endef -define Build/Configure +ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED))) + $(warning $(wildcard $(PKG_BUILD_DIR)/.config_*) != $(subst .configured_,.config_,$(STAMP_CONFIGURED))) + define Build/Configure/rebuild rm -f $(PKG_BUILD_DIR)/hostapd/hostapd + rm -f $(PKG_BUILD_DIR)/hostapd/*.o rm -f $(PKG_BUILD_DIR)/src/drivers/drivers.o + rm -f $(PKG_BUILD_DIR)/.config_* + touch $(subst .configured_,.config_,$(STAMP_CONFIGURED)) + endef +endif + +define Build/Configure + $(Build/Configure/rebuild) $(CP) ./files/$(BUILD_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config endef From cbcaeda0d6e4ac504377ca05311aadfe075fa967 Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 23 Nov 2009 17:12:59 +0000 Subject: [PATCH 212/288] ar71xx: use 4k erase size images for ubnt xm git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18498 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/image/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 230e93603..33937e402 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -296,7 +296,7 @@ define Image/Build/Template/UBNTXM endef define Image/Build/Template/UBNTXM/squashfs - $(call Image/Build/Template/UBNTXM,squashfs,$(1),$(2),$(3),$(4),$(5)) + $(call Image/Build/Template/UBNTXM,squashfs-4k,$(1),$(2),$(3),$(4),$(5)) endef define Image/Build/Template/UBNTXM/jffs2-64k From 5362dd1b5a8b234e6427221e7d46d66ce7b69849 Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 23 Nov 2009 20:35:05 +0000 Subject: [PATCH 213/288] mount debugfs by default git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18502 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/files/etc/init.d/boot | 1 + 1 file changed, 1 insertion(+) diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot index 3da0d6bc9..aa9e96778 100755 --- a/package/base-files/files/etc/init.d/boot +++ b/package/base-files/files/etc/init.d/boot @@ -59,6 +59,7 @@ start() { touch /var/log/lastlog touch /tmp/resolv.conf.auto ln -sf /tmp/resolv.conf.auto /tmp/resolv.conf + grep -q debugfs /proc/filesystems && mount -t debugfs debugfs /sys/kernel/debug [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe killall -q hotplug2 From 3595a2ac005d2fac77e59b031ee01950c9e63b47 Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 23 Nov 2009 20:38:18 +0000 Subject: [PATCH 214/288] ath9k: add a few debugfs files to access the chainmasks and registers git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18503 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches/520-ath9k_debugfs_chainmask.patch | 130 ++++++++++++++++++ .../patches/530-ath9k_debugfs_regaccess.patch | 128 +++++++++++++++++ 2 files changed, 258 insertions(+) create mode 100644 package/mac80211/patches/520-ath9k_debugfs_chainmask.patch create mode 100644 package/mac80211/patches/530-ath9k_debugfs_regaccess.patch diff --git a/package/mac80211/patches/520-ath9k_debugfs_chainmask.patch b/package/mac80211/patches/520-ath9k_debugfs_chainmask.patch new file mode 100644 index 000000000..d8ca8dfbf --- /dev/null +++ b/package/mac80211/patches/520-ath9k_debugfs_chainmask.patch @@ -0,0 +1,130 @@ +--- a/drivers/net/wireless/ath/ath9k/debug.c ++++ b/drivers/net/wireless/ath/ath9k/debug.c +@@ -71,6 +71,90 @@ static const struct file_operations fops + .owner = THIS_MODULE + }; + ++static ssize_t read_file_tx_chainmask(struct file *file, char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath_softc *sc = file->private_data; ++ struct ath_common *common = ath9k_hw_common(sc->sc_ah); ++ char buf[32]; ++ unsigned int len; ++ ++ len = snprintf(buf, sizeof(buf), "0x%08x\n", common->tx_chainmask); ++ return simple_read_from_buffer(user_buf, count, ppos, buf, len); ++} ++ ++static ssize_t write_file_tx_chainmask(struct file *file, const char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath_softc *sc = file->private_data; ++ struct ath_common *common = ath9k_hw_common(sc->sc_ah); ++ unsigned long mask; ++ char buf[32]; ++ ssize_t len; ++ ++ len = min(count, sizeof(buf) - 1); ++ if (copy_from_user(buf, user_buf, len)) ++ return -EINVAL; ++ ++ buf[len] = '\0'; ++ if (strict_strtoul(buf, 0, &mask)) ++ return -EINVAL; ++ ++ common->tx_chainmask = mask; ++ sc->sc_ah->caps.tx_chainmask = mask; ++ return count; ++} ++ ++static const struct file_operations fops_tx_chainmask = { ++ .read = read_file_tx_chainmask, ++ .write = write_file_tx_chainmask, ++ .open = ath9k_debugfs_open, ++ .owner = THIS_MODULE ++}; ++ ++ ++static ssize_t read_file_rx_chainmask(struct file *file, char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath_softc *sc = file->private_data; ++ struct ath_common *common = ath9k_hw_common(sc->sc_ah); ++ char buf[32]; ++ unsigned int len; ++ ++ len = snprintf(buf, sizeof(buf), "0x%08x\n", common->rx_chainmask); ++ return simple_read_from_buffer(user_buf, count, ppos, buf, len); ++} ++ ++static ssize_t write_file_rx_chainmask(struct file *file, const char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath_softc *sc = file->private_data; ++ struct ath_common *common = ath9k_hw_common(sc->sc_ah); ++ unsigned long mask; ++ char buf[32]; ++ ssize_t len; ++ ++ len = min(count, sizeof(buf) - 1); ++ if (copy_from_user(buf, user_buf, len)) ++ return -EINVAL; ++ ++ buf[len] = '\0'; ++ if (strict_strtoul(buf, 0, &mask)) ++ return -EINVAL; ++ ++ common->rx_chainmask = mask; ++ sc->sc_ah->caps.rx_chainmask = mask; ++ return count; ++} ++ ++static const struct file_operations fops_rx_chainmask = { ++ .read = read_file_rx_chainmask, ++ .write = write_file_rx_chainmask, ++ .open = ath9k_debugfs_open, ++ .owner = THIS_MODULE ++}; ++ ++ + static ssize_t read_file_dma(struct file *file, char __user *user_buf, + size_t count, loff_t *ppos) + { +@@ -568,6 +652,16 @@ int ath9k_init_debug(struct ath_hw *ah) + if (!sc->debug.debugfs_debug) + goto err; + ++ sc->debug.debugfs_rx_chainmask = debugfs_create_file("rx_chainmask", ++ S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_rx_chainmask); ++ if (!sc->debug.debugfs_rx_chainmask) ++ goto err; ++ ++ sc->debug.debugfs_tx_chainmask = debugfs_create_file("tx_chainmask", ++ S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_tx_chainmask); ++ if (!sc->debug.debugfs_tx_chainmask) ++ goto err; ++ + sc->debug.debugfs_dma = debugfs_create_file("dma", S_IRUSR, + sc->debug.debugfs_phy, sc, &fops_dma); + if (!sc->debug.debugfs_dma) +@@ -611,6 +705,8 @@ void ath9k_exit_debug(struct ath_hw *ah) + struct ath_common *common = ath9k_hw_common(ah); + struct ath_softc *sc = (struct ath_softc *) common->priv; + ++ debugfs_remove(sc->debug.debugfs_tx_chainmask); ++ debugfs_remove(sc->debug.debugfs_rx_chainmask); + debugfs_remove(sc->debug.debugfs_xmit); + debugfs_remove(sc->debug.debugfs_wiphy); + debugfs_remove(sc->debug.debugfs_rcstat); +--- a/drivers/net/wireless/ath/ath9k/debug.h ++++ b/drivers/net/wireless/ath/ath9k/debug.h +@@ -123,6 +123,8 @@ struct ath_stats { + }; + + struct ath9k_debug { ++ struct dentry *debugfs_rx_chainmask; ++ struct dentry *debugfs_tx_chainmask; + struct dentry *debugfs_phy; + struct dentry *debugfs_debug; + struct dentry *debugfs_dma; diff --git a/package/mac80211/patches/530-ath9k_debugfs_regaccess.patch b/package/mac80211/patches/530-ath9k_debugfs_regaccess.patch new file mode 100644 index 000000000..b973dbb2a --- /dev/null +++ b/package/mac80211/patches/530-ath9k_debugfs_regaccess.patch @@ -0,0 +1,128 @@ +--- a/drivers/net/wireless/ath/ath9k/debug.c ++++ b/drivers/net/wireless/ath/ath9k/debug.c +@@ -634,6 +634,86 @@ static const struct file_operations fops + .owner = THIS_MODULE + }; + ++static ssize_t read_file_regidx(struct file *file, char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath_softc *sc = file->private_data; ++ char buf[32]; ++ unsigned int len; ++ ++ len = snprintf(buf, sizeof(buf), "0x%08x\n", sc->debug.regidx); ++ return simple_read_from_buffer(user_buf, count, ppos, buf, len); ++} ++ ++static ssize_t write_file_regidx(struct file *file, const char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath_softc *sc = file->private_data; ++ unsigned long regidx; ++ char buf[32]; ++ ssize_t len; ++ ++ len = min(count, sizeof(buf) - 1); ++ if (copy_from_user(buf, user_buf, len)) ++ return -EINVAL; ++ ++ buf[len] = '\0'; ++ if (strict_strtoul(buf, 0, ®idx)) ++ return -EINVAL; ++ ++ sc->debug.regidx = regidx; ++ return count; ++} ++ ++static const struct file_operations fops_regidx = { ++ .read = read_file_regidx, ++ .write = write_file_regidx, ++ .open = ath9k_debugfs_open, ++ .owner = THIS_MODULE ++}; ++ ++static ssize_t read_file_regval(struct file *file, char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath_softc *sc = file->private_data; ++ struct ath_hw *ah = sc->sc_ah; ++ char buf[32]; ++ unsigned int len; ++ u32 regval; ++ ++ regval = REG_READ_D(ah, sc->debug.regidx); ++ len = snprintf(buf, sizeof(buf), "0x%08x\n", regval); ++ return simple_read_from_buffer(user_buf, count, ppos, buf, len); ++} ++ ++static ssize_t write_file_regval(struct file *file, const char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath_softc *sc = file->private_data; ++ struct ath_hw *ah = sc->sc_ah; ++ unsigned long regval; ++ char buf[32]; ++ ssize_t len; ++ ++ len = min(count, sizeof(buf) - 1); ++ if (copy_from_user(buf, user_buf, len)) ++ return -EINVAL; ++ ++ buf[len] = '\0'; ++ if (strict_strtoul(buf, 0, ®val)) ++ return -EINVAL; ++ ++ REG_WRITE_D(ah, sc->debug.regidx, regval); ++ return count; ++} ++ ++static const struct file_operations fops_regval = { ++ .read = read_file_regval, ++ .write = write_file_regval, ++ .open = ath9k_debugfs_open, ++ .owner = THIS_MODULE ++}; ++ + int ath9k_init_debug(struct ath_hw *ah) + { + struct ath_common *common = ath9k_hw_common(ah); +@@ -694,6 +774,17 @@ int ath9k_init_debug(struct ath_hw *ah) + if (!sc->debug.debugfs_xmit) + goto err; + ++ sc->debug.regidx = 0; ++ sc->debug.debugfs_regidx = debugfs_create_file("regidx", ++ S_IRUSR|S_IWUSR, sc->debug.debugfs_phy, sc, &fops_regidx); ++ if (!sc->debug.debugfs_regidx) ++ goto err; ++ ++ sc->debug.debugfs_regval = debugfs_create_file("regval", ++ S_IRUSR|S_IWUSR, sc->debug.debugfs_phy, sc, &fops_regval); ++ if (!sc->debug.debugfs_regval) ++ goto err; ++ + return 0; + err: + ath9k_exit_debug(ah); +@@ -707,6 +798,8 @@ void ath9k_exit_debug(struct ath_hw *ah) + + debugfs_remove(sc->debug.debugfs_tx_chainmask); + debugfs_remove(sc->debug.debugfs_rx_chainmask); ++ debugfs_remove(sc->debug.debugfs_regval); ++ debugfs_remove(sc->debug.debugfs_regidx); + debugfs_remove(sc->debug.debugfs_xmit); + debugfs_remove(sc->debug.debugfs_wiphy); + debugfs_remove(sc->debug.debugfs_rcstat); +--- a/drivers/net/wireless/ath/ath9k/debug.h ++++ b/drivers/net/wireless/ath/ath9k/debug.h +@@ -132,6 +132,9 @@ struct ath9k_debug { + struct dentry *debugfs_rcstat; + struct dentry *debugfs_wiphy; + struct dentry *debugfs_xmit; ++ struct dentry *debugfs_regidx; ++ struct dentry *debugfs_regval; ++ u32 regidx; + struct ath_stats stats; + }; + From 1110dd598c91a42bba90f2315381245d904bba07 Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 23 Nov 2009 22:01:40 +0000 Subject: [PATCH 215/288] mac80211: do not build b44 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18504 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/patches/001-disable_b44.patch | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 package/mac80211/patches/001-disable_b44.patch diff --git a/package/mac80211/patches/001-disable_b44.patch b/package/mac80211/patches/001-disable_b44.patch new file mode 100644 index 000000000..4a442dbec --- /dev/null +++ b/package/mac80211/patches/001-disable_b44.patch @@ -0,0 +1,17 @@ +--- a/config.mk ++++ b/config.mk +@@ -242,10 +242,10 @@ endif + + CONFIG_P54_PCI=m + +-CONFIG_B44=m +-CONFIG_B44_PCI_AUTOSELECT=y +-CONFIG_B44_PCICORE_AUTOSELECT=y +-CONFIG_B44_PCI=y ++# CONFIG_B44=m ++# CONFIG_B44_PCI_AUTOSELECT=y ++# CONFIG_B44_PCICORE_AUTOSELECT=y ++# CONFIG_B44_PCI=y + + CONFIG_RTL8180=m + From 5e3ba36eb5ce79c1545260d62283332917d77464 Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 23 Nov 2009 22:01:45 +0000 Subject: [PATCH 216/288] separate ath9k debugfs support from ath9k debugging, use the mac80211 debugfs config option to enable it git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18505 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/Makefile | 8 +- .../patches/520-ath9k_debugfs_config.patch | 81 +++++++++++++++++++ ...atch => 530-ath9k_debugfs_chainmask.patch} | 12 +-- ...atch => 540-ath9k_debugfs_regaccess.patch} | 6 +- 4 files changed, 95 insertions(+), 12 deletions(-) create mode 100644 package/mac80211/patches/520-ath9k_debugfs_config.patch rename package/mac80211/patches/{520-ath9k_debugfs_chainmask.patch => 530-ath9k_debugfs_chainmask.patch} (93%) rename package/mac80211/patches/{530-ath9k_debugfs_regaccess.patch => 540-ath9k_debugfs_regaccess.patch} (94%) diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile index aef79373d..2da34bada 100644 --- a/package/mac80211/Makefile +++ b/package/mac80211/Makefile @@ -22,6 +22,9 @@ PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION) PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_kmod-mac80211 \ + CONFIG_PACKAGE_MAC80211_DEBUGFS \ + CONFIG_PACKAGE_ATH_DEBUG \ + CONFIG_ATH_USER_REGD \ include $(INCLUDE_DIR)/package.mk @@ -498,8 +501,7 @@ BUILDFLAGS:= \ $(if $(CONFIG_PCI),-DCONFIG_SSB_SPROM) \ $(if $(CONFIG_LEDS_TRIGGERS), -DCONFIG_MAC80211_LEDS -DCONFIG_LEDS_TRIGGERS -DCONFIG_B43_LEDS -DCONFIG_B43LEGACY_LEDS -DCONFIG_AR9170_LEDS) \ -DCONFIG_B43_HWRNG -DCONFIG_B43LEGACY_HWRNG \ - $(if $(CONFIG_PACKAGE_MAC80211_DEBUGFS),-DCONFIG_MAC80211_DEBUGFS) \ - $(if $(CONFIG_PACKAGE_ATH9K_DEBUG),-DCONFIG_ATH9K_DEBUG) \ + $(if $(CONFIG_PACKAGE_MAC80211_DEBUGFS),-DCONFIG_MAC80211_DEBUGFS -DCONFIG_ATH9K_DEBUGFS) \ $(if $(CONFIG_PACKAGE_ATH_DEBUG),-DCONFIG_ATH_DEBUG) \ -D__CONFIG_MAC80211_RC_DEFAULT=minstrel \ $(if $(CONFIG_ATH_USER_REGD),-DATH_USER_REGD=1) @@ -530,7 +532,7 @@ MAKE_OPTS:= \ CONFIG_ATH_DEBUG=$(if $(CONFIG_PACKAGE_ATH_DEBUG),y) \ CONFIG_ATH5K=$(if $(CONFIG_PACKAGE_kmod-ath5k),m) \ CONFIG_ATH9K=$(if $(CONFIG_PACKAGE_kmod-ath9k),m) \ - CONFIG_ATH9K_DEBUG=$(if $(CONFIG_PACKAGE_ATH9K_DEBUG),y) \ + CONFIG_ATH9K_DEBUGFS=$(if $(CONFIG_PACKAGE_MAC80211_DEBUGFS),y) \ CONFIG_ZD1211RW=$(if $(CONFIG_PACKAGE_kmod-zd1211rw),m) \ CONFIG_P54_COMMON=$(if $(CONFIG_PACKAGE_kmod-p54-common),m) \ CONFIG_P54_PCI=$(if $(CONFIG_PACKAGE_kmod-p54-pci),m) \ diff --git a/package/mac80211/patches/520-ath9k_debugfs_config.patch b/package/mac80211/patches/520-ath9k_debugfs_config.patch new file mode 100644 index 000000000..021338307 --- /dev/null +++ b/package/mac80211/patches/520-ath9k_debugfs_config.patch @@ -0,0 +1,81 @@ +--- a/drivers/net/wireless/ath/ath9k/Makefile ++++ b/drivers/net/wireless/ath/ath9k/Makefile +@@ -7,7 +7,7 @@ ath9k-y += beacon.o \ + + ath9k-$(CONFIG_PCI) += pci.o + ath9k-$(CONFIG_ATHEROS_AR71XX) += ahb.o +-ath9k-$(CONFIG_ATH9K_DEBUG) += debug.o ++ath9k-$(CONFIG_ATH9K_DEBUGFS) += debug.o + + obj-$(CONFIG_ATH9K) += ath9k.o + +--- a/drivers/net/wireless/ath/ath9k/ath9k.h ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h +@@ -483,7 +483,7 @@ struct ath_softc { + + int beacon_interval; + +-#ifdef CONFIG_ATH9K_DEBUG ++#ifdef CONFIG_ATH9K_DEBUGFS + struct ath9k_debug debug; + #endif + struct ath_beacon_config cur_beacon_conf; +--- a/drivers/net/wireless/ath/ath9k/debug.c ++++ b/drivers/net/wireless/ath/ath9k/debug.c +@@ -31,6 +31,8 @@ static int ath9k_debugfs_open(struct ino + return 0; + } + ++#ifdef CONFIG_ATH_DEBUG ++ + static ssize_t read_file_debug(struct file *file, char __user *user_buf, + size_t count, loff_t *ppos) + { +@@ -71,6 +73,8 @@ static const struct file_operations fops + .owner = THIS_MODULE + }; + ++#endif ++ + static ssize_t read_file_dma(struct file *file, char __user *user_buf, + size_t count, loff_t *ppos) + { +@@ -563,10 +567,12 @@ int ath9k_init_debug(struct ath_hw *ah) + if (!sc->debug.debugfs_phy) + goto err; + ++#ifdef CONFIG_ATH_DEBUG + sc->debug.debugfs_debug = debugfs_create_file("debug", + S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_debug); + if (!sc->debug.debugfs_debug) + goto err; ++#endif + + sc->debug.debugfs_dma = debugfs_create_file("dma", S_IRUSR, + sc->debug.debugfs_phy, sc, &fops_dma); +--- a/drivers/net/wireless/ath/ath9k/debug.h ++++ b/drivers/net/wireless/ath/ath9k/debug.h +@@ -23,13 +23,13 @@ + struct ath_txq; + struct ath_buf; + +-#ifdef CONFIG_ATH9K_DEBUG ++#ifdef CONFIG_ATH9K_DEBUGFS + #define TX_STAT_INC(q, c) sc->debug.stats.txstats[q].c++ + #else + #define TX_STAT_INC(q, c) do { } while (0) + #endif + +-#ifdef CONFIG_ATH9K_DEBUG ++#ifdef CONFIG_ATH9K_DEBUGFS + + /** + * struct ath_interrupt_stats - Contains statistics about interrupts +@@ -186,6 +186,6 @@ static inline void ath_debug_stat_retrie + { + } + +-#endif /* CONFIG_ATH9K_DEBUG */ ++#endif /* CONFIG_ATH9K_DEBUGFS */ + + #endif /* DEBUG_H */ diff --git a/package/mac80211/patches/520-ath9k_debugfs_chainmask.patch b/package/mac80211/patches/530-ath9k_debugfs_chainmask.patch similarity index 93% rename from package/mac80211/patches/520-ath9k_debugfs_chainmask.patch rename to package/mac80211/patches/530-ath9k_debugfs_chainmask.patch index d8ca8dfbf..a26b4dc8a 100644 --- a/package/mac80211/patches/520-ath9k_debugfs_chainmask.patch +++ b/package/mac80211/patches/530-ath9k_debugfs_chainmask.patch @@ -1,8 +1,8 @@ --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -71,6 +71,90 @@ static const struct file_operations fops - .owner = THIS_MODULE - }; +@@ -75,6 +75,90 @@ static const struct file_operations fops + + #endif +static ssize_t read_file_tx_chainmask(struct file *file, char __user *user_buf, + size_t count, loff_t *ppos) @@ -91,9 +91,9 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { -@@ -568,6 +652,16 @@ int ath9k_init_debug(struct ath_hw *ah) - if (!sc->debug.debugfs_debug) +@@ -574,6 +658,16 @@ int ath9k_init_debug(struct ath_hw *ah) goto err; + #endif + sc->debug.debugfs_rx_chainmask = debugfs_create_file("rx_chainmask", + S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_rx_chainmask); @@ -108,7 +108,7 @@ sc->debug.debugfs_dma = debugfs_create_file("dma", S_IRUSR, sc->debug.debugfs_phy, sc, &fops_dma); if (!sc->debug.debugfs_dma) -@@ -611,6 +705,8 @@ void ath9k_exit_debug(struct ath_hw *ah) +@@ -617,6 +711,8 @@ void ath9k_exit_debug(struct ath_hw *ah) struct ath_common *common = ath9k_hw_common(ah); struct ath_softc *sc = (struct ath_softc *) common->priv; diff --git a/package/mac80211/patches/530-ath9k_debugfs_regaccess.patch b/package/mac80211/patches/540-ath9k_debugfs_regaccess.patch similarity index 94% rename from package/mac80211/patches/530-ath9k_debugfs_regaccess.patch rename to package/mac80211/patches/540-ath9k_debugfs_regaccess.patch index b973dbb2a..b927b5513 100644 --- a/package/mac80211/patches/530-ath9k_debugfs_regaccess.patch +++ b/package/mac80211/patches/540-ath9k_debugfs_regaccess.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -634,6 +634,86 @@ static const struct file_operations fops +@@ -638,6 +638,86 @@ static const struct file_operations fops .owner = THIS_MODULE }; @@ -87,7 +87,7 @@ int ath9k_init_debug(struct ath_hw *ah) { struct ath_common *common = ath9k_hw_common(ah); -@@ -694,6 +774,17 @@ int ath9k_init_debug(struct ath_hw *ah) +@@ -700,6 +780,17 @@ int ath9k_init_debug(struct ath_hw *ah) if (!sc->debug.debugfs_xmit) goto err; @@ -105,7 +105,7 @@ return 0; err: ath9k_exit_debug(ah); -@@ -707,6 +798,8 @@ void ath9k_exit_debug(struct ath_hw *ah) +@@ -713,6 +804,8 @@ void ath9k_exit_debug(struct ath_hw *ah) debugfs_remove(sc->debug.debugfs_tx_chainmask); debugfs_remove(sc->debug.debugfs_rx_chainmask); From b3c2645b973334f87992997f15bee3f600d3dcc3 Mon Sep 17 00:00:00 2001 From: florian Date: Mon, 23 Nov 2009 22:30:42 +0000 Subject: [PATCH 217/288] [package] update compcache to 0.5.4 (#6018) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18512 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/compcache/Config.in | 30 + package/compcache/Makefile | 36 +- package/compcache/files/compcache.config | 5 +- package/compcache/files/compcache.init | 28 +- .../patches/000-provide_lzo_kmod.patch | 662 ++++++++++++++++++ package/compcache/patches/001-lzo-speed.patch | 32 +- .../patches/002-compact_lzo-codec.patch | 30 - .../patches/100-use_register_width.patch | 24 + .../patches/200-av_compress_ratio.patch | 39 ++ 9 files changed, 813 insertions(+), 73 deletions(-) create mode 100644 package/compcache/Config.in create mode 100644 package/compcache/patches/000-provide_lzo_kmod.patch delete mode 100644 package/compcache/patches/002-compact_lzo-codec.patch create mode 100644 package/compcache/patches/100-use_register_width.patch create mode 100644 package/compcache/patches/200-av_compress_ratio.patch diff --git a/package/compcache/Config.in b/package/compcache/Config.in new file mode 100644 index 000000000..9904237ed --- /dev/null +++ b/package/compcache/Config.in @@ -0,0 +1,30 @@ +# compcache configuration + +config COMPCACHE_ENABLE + bool "enabled on boot" + default n + depends on PACKAGE_kmod-compcache + help + Enables compressed ram swap devices. + +config COMPCACHE_RAM_REPORTED + string "swap space reported to kernel in kb" + depends on PACKAGE_kmod-compcache + default "2048" + help + This is the amount of memory that will be reported + to the kernel as swap. The real ram in use will differ, + because of lzo compression. + Example: + 16 MB = 2048 KB + 32 MB = 4098 KB + +config COMPCACHE_BACKUP_DEV + string "Backup device for compcache" + depends on PACKAGE_kmod-compcache + default "" + help + Compcache will use this as a backup device for swap. + Example: + /dev/sda5 + diff --git a/package/compcache/Makefile b/package/compcache/Makefile index a4d845100..8ca581b3d 100644 --- a/package/compcache/Makefile +++ b/package/compcache/Makefile @@ -1,21 +1,19 @@ # -# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2009 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # -# $Id: Makefile 6562 2009-01-21 11:19:24 ghd $ +# $Id: Makefile 6562 2009-10-05 08:30:14 ghd $ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=compcache -PKG_VERSION:=0.5 +PKG_VERSION:=0.5.4 PKG_RELEASE:=$(PKG_VERSION)-1 PKG_SOURCE_URL:=http://compcache.googlecode.com/files/ -PKG_MD5SUM:=eea73324e9e69178866f6c0fbc852f1f - -#PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME) +PKG_MD5SUM:=e83535925a014ac34e1eaeb4f7a2f49a PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz @@ -26,18 +24,18 @@ define KernelPackage/compcache DEPENDS:=@LINUX_2_6 @BUSYBOX_CONFIG_SWAPONOFF TITLE:=Driver for compressed ram swap device VERSION:=$(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE)+$(PKG_RELEASE) - FILES:=$(PKG_BUILD_DIR)/compcache.$(LINUX_KMOD_SUFFIX) \ - $(PKG_BUILD_DIR)/sub-projects/compression/lzo-kmod/lzo1x.$(LINUX_KMOD_SUFFIX) \ - $(PKG_BUILD_DIR)/sub-projects/allocators/xvmalloc-kmod/xvmalloc.$(LINUX_KMOD_SUFFIX) -# AUTOLOAD:=$(call AutoLoad,10,xvmalloc lzo1x compcache+compcache_size_kbytes=2048) + FILES:=$(PKG_BUILD_DIR)/ramzswap.$(LINUX_KMOD_SUFFIX) \ + $(PKG_BUILD_DIR)/sub-projects/compression/lzo-kmod/lzo1x.$(LINUX_KMOD_SUFFIX) \ + $(PKG_BUILD_DIR)/sub-projects/allocators/xvmalloc-kmod/xvmalloc.$(LINUX_KMOD_SUFFIX) endef -BUILDFLAGS:=-DCONFIG_BLK_DEV_COMPCACHE_DEBUG=0 \ - -DCONFIG_BLK_DEV_COMPCACHE_STATS=1 \ - -DCONFIG_XV_DEBUG=0 \ - -DCONFIG_XV_STATS=1 \ - -g -Wall +XVM = sub-projects/allocators/xvmalloc-kmod +LZO = sub-projects/compression/lzo-kmod +BUILDFLAGS:=-DCONFIG_BLK_DEV_RAMZSWAP_STATS \ + -I$(PKG_BUILD_DIR)/$(XVM) \ + -I$(PKG_BUILD_DIR)/$(LZO) \ + -g -Wall define Build/Compile $(MAKE) -C "$(LINUX_DIR)" \ @@ -52,8 +50,16 @@ endef define KernelPackage/compcache/install $(INSTALL_DIR) $(1)/etc/config $(INSTALL_DATA) ./files/compcache.config $(1)/etc/config/compcache + $(SED) 's,%ENABLED%,$(if $(CONFIG_COMPCACHE_ENABLE),1,0),g' \ + -e 's,%RAM_REPORTED%,$(call qstrip,$(CONFIG_COMPCACHE_RAM_REPORTED)),g' \ + -e 's,%BACKUP_DEV%,$(call qstrip,$(CONFIG_COMPCACHE_BACKUP_DEV)),g' \ + $(1)/etc/config/compcache $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/compcache.init $(1)/etc/init.d/compcache endef +define KernelPackage/compcache/config + source "$(SOURCE)/Config.in" +endef + $(eval $(call KernelPackage,compcache)) diff --git a/package/compcache/files/compcache.config b/package/compcache/files/compcache.config index 96ee19284..3faab3e14 100644 --- a/package/compcache/files/compcache.config +++ b/package/compcache/files/compcache.config @@ -1,3 +1,4 @@ config compcache - option 'enabled' '0' - option 'size_kbytes' '2048' + option 'enabled' '%ENABLED%' + option 'size_kbytes' '%RAM_REPORTED%' + option 'backup_dev' '%BACKUP_DEV%' diff --git a/package/compcache/files/compcache.init b/package/compcache/files/compcache.init index 5c85e5ddd..b9406d108 100644 --- a/package/compcache/files/compcache.init +++ b/package/compcache/files/compcache.init @@ -1,18 +1,28 @@ #!/bin/sh /etc/rc.common # Copyright (C) 2008 OpenWrt.org -START=19 +START=14 load_modules() { local section="$1" config_get "size_kbytes" "$section" "size_kbytes" + config_get "backup_dev" "$section" "backup_dev" + #CC_PARAM_STR="memlimit_kb=$1 backing_dev=$BACKING_DEV" config_get_bool "enabled" "$section" "enabled" '1' if [ "$enabled" -gt 0 ]; then - if [ "`lsmod | grep 'compcache'`" != "" ]; then - echo "compcache allready loaded" + if [ "`cat /proc/swaps | grep 'ramzswap0'`" != "" ]; then + echo "compcache already loaded" else - insmod xvmalloc - insmod lzo1x - insmod compcache compcache_size_kbytes=$size_kbytes + if [ "$backup_dev" != "" ]; then + params_set="memlimit_kb=$size_kbytes backing_swap=$backup_dev" + else + params_set="disksize_kb=$size_kbytes" + fi + if [ "`lsmod | grep 'ramzswap'`" == "" ]; then + insmod xvmalloc + insmod lzo1x + insmod ramzswap $params_set + swapon /dev/ramzswap0 + fi fi fi } @@ -22,9 +32,9 @@ remove_modules() { config_get_bool "enabled" "$section" "enabled" '1' if [ "$enabled" -gt 0 ]; then [ "`cat /proc/swaps | grep 'ramzswap0'`" != "" ] && swapoff /dev/ramzswap0 - [ "`lsmod | grep 'compcache'`" != "" ] && rmmod compcache > /dev/null - [ "`lsmod | grep 'lzo1x'`" != "" ] && rmmod lzo1x > /dev/null - [ "`lsmod | grep 'xvmalloc'`" != "" ] && rmmod xvmalloc > /dev/null + [ "`lsmod | grep 'ramzswap'`" != "" ] && rmmod ramzswap &> /dev/null + [ "`lsmod | grep 'lzo1x'`" != "" ] && rmmod lzo1x &> /dev/null + [ "`lsmod | grep 'xvmalloc'`" != "" ] && rmmod xvmalloc &> /dev/null fi } diff --git a/package/compcache/patches/000-provide_lzo_kmod.patch b/package/compcache/patches/000-provide_lzo_kmod.patch new file mode 100644 index 000000000..1ad4fb63a --- /dev/null +++ b/package/compcache/patches/000-provide_lzo_kmod.patch @@ -0,0 +1,662 @@ +diff -uNr compcache-0.5.4-old/Makefile compcache-0.5.4/Makefile +--- compcache-0.5.4-old/Makefile 2009-10-17 08:49:42.000000000 +0200 ++++ compcache-0.5.4/Makefile 2009-10-17 09:39:34.000000000 +0200 +@@ -1,19 +1,26 @@ + KERNEL_BUILD_PATH ?= "/lib/modules/$(shell uname -r)/build" + + XVM = sub-projects/allocators/xvmalloc-kmod +-EXTRA_CFLAGS := -DCONFIG_BLK_DEV_RAMZSWAP_STATS \ +- -I$(PWD)/$(XVM) \ ++LZO = sub-projects/compression/lzo-kmod ++ ++EXTRA_CFLAGS += -DCONFIG_BLK_DEV_RAMZSWAP_STATS \ ++ -I$(PWD)/$(XVM) \ ++ -I$(PWD)/$(LZO) \ + -g -Wall + + obj-m += $(XVM)/xvmalloc.o \ ++ $(LZO)/lzo1x.o \ + ramzswap.o + + all: + make -C $(KERNEL_BUILD_PATH) M=$(PWD)/$(XVM) modules ++ make -C $(KERNEL_BUILD_PATH) M=$(PWD)/$(LZO) modules + make -C $(KERNEL_BUILD_PATH) M=$(PWD) modules + @ln -sf $(XVM)/xvmalloc.ko ++ @ln -sf $(LZO)/xvmalloc.ko + + clean: + make -C $(KERNEL_BUILD_PATH) M=$(PWD) clean + make -C $(KERNEL_BUILD_PATH) M=$(PWD)/$(XVM) clean ++ make -C $(KERNEL_BUILD_PATH) M=$(PWD)/$(LZO) clean + @rm -rf *.ko +diff -uNr compcache-0.5.4-old/ramzswap.c compcache-0.5.4/ramzswap.c +--- compcache-0.5.4-old/ramzswap.c 2009-10-17 08:50:06.000000000 +0200 ++++ compcache-0.5.4/ramzswap.c 2009-10-17 09:35:59.000000000 +0200 +@@ -20,7 +20,6 @@ + #include + #include + #include +-#include + #include + #include + #include +diff -uNr compcache-0.5.4-old/ramzswap.h compcache-0.5.4/ramzswap.h +--- compcache-0.5.4-old/ramzswap.h 2009-10-17 08:50:06.000000000 +0200 ++++ compcache-0.5.4/ramzswap.h 2009-10-17 09:40:45.000000000 +0200 +@@ -16,6 +16,7 @@ + #define _RAMZSWAP_H_ + + #include "xvmalloc.h" ++#include "lzo.h" + + /* + * Stored at beginning of each compressed object. +diff -uNr compcache-0.5.4-old/sub-projects/compression/lzo-kmod/lzo1x.c compcache-0.5.4/sub-projects/compression/lzo-kmod/lzo1x.c +--- compcache-0.5.4-old/sub-projects/compression/lzo-kmod/lzo1x.c 1970-01-01 01:00:00.000000000 +0100 ++++ compcache-0.5.4/sub-projects/compression/lzo-kmod/lzo1x.c 2009-10-17 09:35:59.000000000 +0200 +@@ -0,0 +1,7 @@ ++#include ++ ++#include "lzo1x_compress.c" ++#include "lzo1x_decompress.c" ++ ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION("LZO1X Lib"); +diff -uNr compcache-0.5.4-old/sub-projects/compression/lzo-kmod/lzo1x_compress.c compcache-0.5.4/sub-projects/compression/lzo-kmod/lzo1x_compress.c +--- compcache-0.5.4-old/sub-projects/compression/lzo-kmod/lzo1x_compress.c 1970-01-01 01:00:00.000000000 +0100 ++++ compcache-0.5.4/sub-projects/compression/lzo-kmod/lzo1x_compress.c 2009-10-17 09:35:59.000000000 +0200 +@@ -0,0 +1,227 @@ ++/* ++ * LZO1X Compressor from MiniLZO ++ * ++ * Copyright (C) 1996-2005 Markus F.X.J. Oberhumer ++ * ++ * The full LZO package can be found at: ++ * http://www.oberhumer.com/opensource/lzo/ ++ * ++ * Changed for kernel use by: ++ * Nitin Gupta ++ * Richard Purdie ++ */ ++ ++#include ++#include ++#include ++ ++#include "lzodefs.h" ++#include "lzo.h" ++ ++static noinline size_t ++_lzo1x_1_do_compress(const unsigned char *in, size_t in_len, ++ unsigned char *out, size_t *out_len, void *wrkmem) ++{ ++ const unsigned char * const in_end = in + in_len; ++ const unsigned char * const ip_end = in + in_len - M2_MAX_LEN - 5; ++ const unsigned char ** const dict = wrkmem; ++ const unsigned char *ip = in, *ii = ip; ++ const unsigned char *end, *m, *m_pos; ++ size_t m_off, m_len, dindex; ++ unsigned char *op = out; ++ ++ ip += 4; ++ ++ for (;;) { ++ dindex = ((size_t)(0x21 * DX3(ip, 5, 5, 6)) >> 5) & D_MASK; ++ m_pos = dict[dindex]; ++ ++ if (m_pos < in) ++ goto literal; ++ ++ if (ip == m_pos || ((size_t)(ip - m_pos) > M4_MAX_OFFSET)) ++ goto literal; ++ ++ m_off = ip - m_pos; ++ if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3]) ++ goto try_match; ++ ++ dindex = (dindex & (D_MASK & 0x7ff)) ^ (D_HIGH | 0x1f); ++ m_pos = dict[dindex]; ++ ++ if (m_pos < in) ++ goto literal; ++ ++ if (ip == m_pos || ((size_t)(ip - m_pos) > M4_MAX_OFFSET)) ++ goto literal; ++ ++ m_off = ip - m_pos; ++ if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3]) ++ goto try_match; ++ ++ goto literal; ++ ++try_match: ++ if (get_unaligned((const unsigned short *)m_pos) ++ == get_unaligned((const unsigned short *)ip)) { ++ if (likely(m_pos[2] == ip[2])) ++ goto match; ++ } ++ ++literal: ++ dict[dindex] = ip; ++ ++ip; ++ if (unlikely(ip >= ip_end)) ++ break; ++ continue; ++ ++match: ++ dict[dindex] = ip; ++ if (ip != ii) { ++ size_t t = ip - ii; ++ ++ if (t <= 3) { ++ op[-2] |= t; ++ } else if (t <= 18) { ++ *op++ = (t - 3); ++ } else { ++ size_t tt = t - 18; ++ ++ *op++ = 0; ++ while (tt > 255) { ++ tt -= 255; ++ *op++ = 0; ++ } ++ *op++ = tt; ++ } ++ do { ++ *op++ = *ii++; ++ } while (--t > 0); ++ } ++ ++ ip += 3; ++ if (m_pos[3] != *ip++ || m_pos[4] != *ip++ ++ || m_pos[5] != *ip++ || m_pos[6] != *ip++ ++ || m_pos[7] != *ip++ || m_pos[8] != *ip++) { ++ --ip; ++ m_len = ip - ii; ++ ++ if (m_off <= M2_MAX_OFFSET) { ++ m_off -= 1; ++ *op++ = (((m_len - 1) << 5) ++ | ((m_off & 7) << 2)); ++ *op++ = (m_off >> 3); ++ } else if (m_off <= M3_MAX_OFFSET) { ++ m_off -= 1; ++ *op++ = (M3_MARKER | (m_len - 2)); ++ goto m3_m4_offset; ++ } else { ++ m_off -= 0x4000; ++ ++ *op++ = (M4_MARKER | ((m_off & 0x4000) >> 11) ++ | (m_len - 2)); ++ goto m3_m4_offset; ++ } ++ } else { ++ end = in_end; ++ m = m_pos + M2_MAX_LEN + 1; ++ ++ while (ip < end && *m == *ip) { ++ m++; ++ ip++; ++ } ++ m_len = ip - ii; ++ ++ if (m_off <= M3_MAX_OFFSET) { ++ m_off -= 1; ++ if (m_len <= 33) { ++ *op++ = (M3_MARKER | (m_len - 2)); ++ } else { ++ m_len -= 33; ++ *op++ = M3_MARKER | 0; ++ goto m3_m4_len; ++ } ++ } else { ++ m_off -= 0x4000; ++ if (m_len <= M4_MAX_LEN) { ++ *op++ = (M4_MARKER ++ | ((m_off & 0x4000) >> 11) ++ | (m_len - 2)); ++ } else { ++ m_len -= M4_MAX_LEN; ++ *op++ = (M4_MARKER ++ | ((m_off & 0x4000) >> 11)); ++m3_m4_len: ++ while (m_len > 255) { ++ m_len -= 255; ++ *op++ = 0; ++ } ++ ++ *op++ = (m_len); ++ } ++ } ++m3_m4_offset: ++ *op++ = ((m_off & 63) << 2); ++ *op++ = (m_off >> 6); ++ } ++ ++ ii = ip; ++ if (unlikely(ip >= ip_end)) ++ break; ++ } ++ ++ *out_len = op - out; ++ return in_end - ii; ++} ++ ++int lzo1x_1_compress(const unsigned char *in, size_t in_len, unsigned char *out, ++ size_t *out_len, void *wrkmem) ++{ ++ const unsigned char *ii; ++ unsigned char *op = out; ++ size_t t; ++ ++ if (unlikely(in_len <= M2_MAX_LEN + 5)) { ++ t = in_len; ++ } else { ++ t = _lzo1x_1_do_compress(in, in_len, op, out_len, wrkmem); ++ op += *out_len; ++ } ++ ++ if (t > 0) { ++ ii = in + in_len - t; ++ ++ if (op == out && t <= 238) { ++ *op++ = (17 + t); ++ } else if (t <= 3) { ++ op[-2] |= t; ++ } else if (t <= 18) { ++ *op++ = (t - 3); ++ } else { ++ size_t tt = t - 18; ++ ++ *op++ = 0; ++ while (tt > 255) { ++ tt -= 255; ++ *op++ = 0; ++ } ++ ++ *op++ = tt; ++ } ++ do { ++ *op++ = *ii++; ++ } while (--t > 0); ++ } ++ ++ *op++ = M4_MARKER | 1; ++ *op++ = 0; ++ *op++ = 0; ++ ++ *out_len = op - out; ++ return LZO_E_OK; ++} ++EXPORT_SYMBOL_GPL(lzo1x_1_compress); ++ ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION("LZO1X-1 Compressor"); ++ +diff -uNr compcache-0.5.4-old/sub-projects/compression/lzo-kmod/lzo1x_decompress.c compcache-0.5.4/sub-projects/compression/lzo-kmod/lzo1x_decompress.c +--- compcache-0.5.4-old/sub-projects/compression/lzo-kmod/lzo1x_decompress.c 1970-01-01 01:00:00.000000000 +0100 ++++ compcache-0.5.4/sub-projects/compression/lzo-kmod/lzo1x_decompress.c 2009-10-17 09:35:59.000000000 +0200 +@@ -0,0 +1,255 @@ ++/* ++ * LZO1X Decompressor from MiniLZO ++ * ++ * Copyright (C) 1996-2005 Markus F.X.J. Oberhumer ++ * ++ * The full LZO package can be found at: ++ * http://www.oberhumer.com/opensource/lzo/ ++ * ++ * Changed for kernel use by: ++ * Nitin Gupta ++ * Richard Purdie ++ */ ++ ++#include ++#include ++#include ++#include ++ ++#include "lzodefs.h" ++#include "lzo.h" ++ ++#define HAVE_IP(x, ip_end, ip) ((size_t)(ip_end - ip) < (x)) ++#define HAVE_OP(x, op_end, op) ((size_t)(op_end - op) < (x)) ++#define HAVE_LB(m_pos, out, op) (m_pos < out || m_pos >= op) ++ ++#define COPY4(dst, src) \ ++ put_unaligned(get_unaligned((const u32 *)(src)), (u32 *)(dst)) ++ ++int lzo1x_decompress_safe(const unsigned char *in, size_t in_len, ++ unsigned char *out, size_t *out_len) ++{ ++ const unsigned char * const ip_end = in + in_len; ++ unsigned char * const op_end = out + *out_len; ++ const unsigned char *ip = in, *m_pos; ++ unsigned char *op = out; ++ size_t t; ++ ++ *out_len = 0; ++ ++ if (*ip > 17) { ++ t = *ip++ - 17; ++ if (t < 4) ++ goto match_next; ++ if (HAVE_OP(t, op_end, op)) ++ goto output_overrun; ++ if (HAVE_IP(t + 1, ip_end, ip)) ++ goto input_overrun; ++ do { ++ *op++ = *ip++; ++ } while (--t > 0); ++ goto first_literal_run; ++ } ++ ++ while ((ip < ip_end)) { ++ t = *ip++; ++ if (t >= 16) ++ goto match; ++ if (t == 0) { ++ if (HAVE_IP(1, ip_end, ip)) ++ goto input_overrun; ++ while (*ip == 0) { ++ t += 255; ++ ip++; ++ if (HAVE_IP(1, ip_end, ip)) ++ goto input_overrun; ++ } ++ t += 15 + *ip++; ++ } ++ if (HAVE_OP(t + 3, op_end, op)) ++ goto output_overrun; ++ if (HAVE_IP(t + 4, ip_end, ip)) ++ goto input_overrun; ++ ++ COPY4(op, ip); ++ op += 4; ++ ip += 4; ++ if (--t > 0) { ++ if (t >= 4) { ++ do { ++ COPY4(op, ip); ++ op += 4; ++ ip += 4; ++ t -= 4; ++ } while (t >= 4); ++ if (t > 0) { ++ do { ++ *op++ = *ip++; ++ } while (--t > 0); ++ } ++ } else { ++ do { ++ *op++ = *ip++; ++ } while (--t > 0); ++ } ++ } ++ ++first_literal_run: ++ t = *ip++; ++ if (t >= 16) ++ goto match; ++ m_pos = op - (1 + M2_MAX_OFFSET); ++ m_pos -= t >> 2; ++ m_pos -= *ip++ << 2; ++ ++ if (HAVE_LB(m_pos, out, op)) ++ goto lookbehind_overrun; ++ ++ if (HAVE_OP(3, op_end, op)) ++ goto output_overrun; ++ *op++ = *m_pos++; ++ *op++ = *m_pos++; ++ *op++ = *m_pos; ++ ++ goto match_done; ++ ++ do { ++match: ++ if (t >= 64) { ++ m_pos = op - 1; ++ m_pos -= (t >> 2) & 7; ++ m_pos -= *ip++ << 3; ++ t = (t >> 5) - 1; ++ if (HAVE_LB(m_pos, out, op)) ++ goto lookbehind_overrun; ++ if (HAVE_OP(t + 3 - 1, op_end, op)) ++ goto output_overrun; ++ goto copy_match; ++ } else if (t >= 32) { ++ t &= 31; ++ if (t == 0) { ++ if (HAVE_IP(1, ip_end, ip)) ++ goto input_overrun; ++ while (*ip == 0) { ++ t += 255; ++ ip++; ++ if (HAVE_IP(1, ip_end, ip)) ++ goto input_overrun; ++ } ++ t += 31 + *ip++; ++ } ++ m_pos = op - 1; ++ m_pos -= le16_to_cpu(get_unaligned( ++ (const unsigned short *)ip)) >> 2; ++ ip += 2; ++ } else if (t >= 16) { ++ m_pos = op; ++ m_pos -= (t & 8) << 11; ++ ++ t &= 7; ++ if (t == 0) { ++ if (HAVE_IP(1, ip_end, ip)) ++ goto input_overrun; ++ while (*ip == 0) { ++ t += 255; ++ ip++; ++ if (HAVE_IP(1, ip_end, ip)) ++ goto input_overrun; ++ } ++ t += 7 + *ip++; ++ } ++ m_pos -= le16_to_cpu(get_unaligned( ++ (const unsigned short *)ip)) >> 2; ++ ip += 2; ++ if (m_pos == op) ++ goto eof_found; ++ m_pos -= 0x4000; ++ } else { ++ m_pos = op - 1; ++ m_pos -= t >> 2; ++ m_pos -= *ip++ << 2; ++ ++ if (HAVE_LB(m_pos, out, op)) ++ goto lookbehind_overrun; ++ if (HAVE_OP(2, op_end, op)) ++ goto output_overrun; ++ ++ *op++ = *m_pos++; ++ *op++ = *m_pos; ++ goto match_done; ++ } ++ ++ if (HAVE_LB(m_pos, out, op)) ++ goto lookbehind_overrun; ++ if (HAVE_OP(t + 3 - 1, op_end, op)) ++ goto output_overrun; ++ ++ if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) { ++ COPY4(op, m_pos); ++ op += 4; ++ m_pos += 4; ++ t -= 4 - (3 - 1); ++ do { ++ COPY4(op, m_pos); ++ op += 4; ++ m_pos += 4; ++ t -= 4; ++ } while (t >= 4); ++ if (t > 0) ++ do { ++ *op++ = *m_pos++; ++ } while (--t > 0); ++ } else { ++copy_match: ++ *op++ = *m_pos++; ++ *op++ = *m_pos++; ++ do { ++ *op++ = *m_pos++; ++ } while (--t > 0); ++ } ++match_done: ++ t = ip[-2] & 3; ++ if (t == 0) ++ break; ++match_next: ++ if (HAVE_OP(t, op_end, op)) ++ goto output_overrun; ++ if (HAVE_IP(t + 1, ip_end, ip)) ++ goto input_overrun; ++ ++ *op++ = *ip++; ++ if (t > 1) { ++ *op++ = *ip++; ++ if (t > 2) ++ *op++ = *ip++; ++ } ++ ++ t = *ip++; ++ } while (ip < ip_end); ++ } ++ ++ *out_len = op - out; ++ return LZO_E_EOF_NOT_FOUND; ++ ++eof_found: ++ *out_len = op - out; ++ return (ip == ip_end ? LZO_E_OK : ++ (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN)); ++input_overrun: ++ *out_len = op - out; ++ return LZO_E_INPUT_OVERRUN; ++ ++output_overrun: ++ *out_len = op - out; ++ return LZO_E_OUTPUT_OVERRUN; ++ ++lookbehind_overrun: ++ *out_len = op - out; ++ return LZO_E_LOOKBEHIND_OVERRUN; ++} ++ ++EXPORT_SYMBOL_GPL(lzo1x_decompress_safe); ++ ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION("LZO1X Decompressor"); ++ +diff -uNr compcache-0.5.4-old/sub-projects/compression/lzo-kmod/lzodefs.h compcache-0.5.4/sub-projects/compression/lzo-kmod/lzodefs.h +--- compcache-0.5.4-old/sub-projects/compression/lzo-kmod/lzodefs.h 1970-01-01 01:00:00.000000000 +0100 ++++ compcache-0.5.4/sub-projects/compression/lzo-kmod/lzodefs.h 2009-10-17 09:35:59.000000000 +0200 +@@ -0,0 +1,43 @@ ++/* ++ * lzodefs.h -- architecture, OS and compiler specific defines ++ * ++ * Copyright (C) 1996-2005 Markus F.X.J. Oberhumer ++ * ++ * The full LZO package can be found at: ++ * http://www.oberhumer.com/opensource/lzo/ ++ * ++ * Changed for kernel use by: ++ * Nitin Gupta ++ * Richard Purdie ++ */ ++ ++#define LZO_VERSION 0x2020 ++#define LZO_VERSION_STRING "2.02" ++#define LZO_VERSION_DATE "Oct 17 2005" ++ ++#define M1_MAX_OFFSET 0x0400 ++#define M2_MAX_OFFSET 0x0800 ++#define M3_MAX_OFFSET 0x4000 ++#define M4_MAX_OFFSET 0xbfff ++ ++#define M1_MIN_LEN 2 ++#define M1_MAX_LEN 2 ++#define M2_MIN_LEN 3 ++#define M2_MAX_LEN 8 ++#define M3_MIN_LEN 3 ++#define M3_MAX_LEN 33 ++#define M4_MIN_LEN 3 ++#define M4_MAX_LEN 9 ++ ++#define M1_MARKER 0 ++#define M2_MARKER 64 ++#define M3_MARKER 32 ++#define M4_MARKER 16 ++ ++#define D_BITS 14 ++#define D_MASK ((1u << D_BITS) - 1) ++#define D_HIGH ((D_MASK >> 1) + 1) ++ ++#define DX2(p, s1, s2) (((((size_t)((p)[2]) << (s2)) ^ (p)[1]) \ ++ << (s1)) ^ (p)[0]) ++#define DX3(p, s1, s2, s3) ((DX2((p)+1, s2, s3) << (s1)) ^ (p)[0]) +diff -uNr compcache-0.5.4-old/sub-projects/compression/lzo-kmod/lzo.h compcache-0.5.4/sub-projects/compression/lzo-kmod/lzo.h +--- compcache-0.5.4-old/sub-projects/compression/lzo-kmod/lzo.h 1970-01-01 01:00:00.000000000 +0100 ++++ compcache-0.5.4/sub-projects/compression/lzo-kmod/lzo.h 2009-10-17 09:35:59.000000000 +0200 +@@ -0,0 +1,44 @@ ++#ifndef __LZO_H__ ++#define __LZO_H__ ++/* ++ * LZO Public Kernel Interface ++ * A mini subset of the LZO real-time data compression library ++ * ++ * Copyright (C) 1996-2005 Markus F.X.J. Oberhumer ++ * ++ * The full LZO package can be found at: ++ * http://www.oberhumer.com/opensource/lzo/ ++ * ++ * Changed for kernel use by: ++ * Nitin Gupta ++ * Richard Purdie ++ */ ++ ++#define LZO1X_MEM_COMPRESS (16384 * sizeof(unsigned char *)) ++#define LZO1X_1_MEM_COMPRESS LZO1X_MEM_COMPRESS ++ ++#define lzo1x_worst_compress(x) ((x) + ((x) / 16) + 64 + 3) ++ ++/* This requires 'workmem' of size LZO1X_1_MEM_COMPRESS */ ++int lzo1x_1_compress(const unsigned char *src, size_t src_len, ++ unsigned char *dst, size_t *dst_len, void *wrkmem); ++ ++/* safe decompression with overrun testing */ ++int lzo1x_decompress_safe(const unsigned char *src, size_t src_len, ++ unsigned char *dst, size_t *dst_len); ++ ++/* ++ * Return values (< 0 = Error) ++ */ ++#define LZO_E_OK 0 ++#define LZO_E_ERROR (-1) ++#define LZO_E_OUT_OF_MEMORY (-2) ++#define LZO_E_NOT_COMPRESSIBLE (-3) ++#define LZO_E_INPUT_OVERRUN (-4) ++#define LZO_E_OUTPUT_OVERRUN (-5) ++#define LZO_E_LOOKBEHIND_OVERRUN (-6) ++#define LZO_E_EOF_NOT_FOUND (-7) ++#define LZO_E_INPUT_NOT_CONSUMED (-8) ++#define LZO_E_NOT_YET_IMPLEMENTED (-9) ++ ++#endif +diff -uNr compcache-0.5.4-old/sub-projects/compression/lzo-kmod/Makefile compcache-0.5.4/sub-projects/compression/lzo-kmod/Makefile +--- compcache-0.5.4-old/sub-projects/compression/lzo-kmod/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ compcache-0.5.4/sub-projects/compression/lzo-kmod/Makefile 2009-10-17 09:35:59.000000000 +0200 +@@ -0,0 +1,8 @@ ++obj-m += lzo1x_compress.o lzo1x_decompress.o ++ ++all: ++ make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules ++ ++clean: ++ make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean ++ diff --git a/package/compcache/patches/001-lzo-speed.patch b/package/compcache/patches/001-lzo-speed.patch index df27b9bb6..59efe097c 100644 --- a/package/compcache/patches/001-lzo-speed.patch +++ b/package/compcache/patches/001-lzo-speed.patch @@ -1,6 +1,6 @@ -diff -uNr compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x_compress.c compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x_compress.c ---- compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x_compress.c 2008-08-13 06:33:34.000000000 +0200 -+++ compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x_compress.c 2009-01-21 08:00:35.000000000 +0100 +diff -uNr compcache-0.5.3-org/sub-projects/compression/lzo-kmod/lzo1x_compress.c compcache-0.5.3/sub-projects/compression/lzo-kmod/lzo1x_compress.c +--- compcache-0.5.3-org/sub-projects/compression/lzo-kmod/lzo1x_compress.c 2009-04-20 06:28:30.000000000 +0200 ++++ compcache-0.5.3/sub-projects/compression/lzo-kmod/lzo1x_compress.c 2009-04-20 06:29:21.000000000 +0200 @@ -62,8 +62,12 @@ goto literal; @@ -55,9 +55,9 @@ diff -uNr compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x_compress.c compc MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("LZO1X-1 Compressor"); - -diff -uNr compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x_decompress.c compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x_decompress.c ---- compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x_decompress.c 2008-08-13 06:33:42.000000000 +0200 -+++ compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x_decompress.c 2009-01-21 07:49:41.000000000 +0100 +diff -uNr compcache-0.5.3-org/sub-projects/compression/lzo-kmod/lzo1x_decompress.c compcache-0.5.3/sub-projects/compression/lzo-kmod/lzo1x_decompress.c +--- compcache-0.5.3-org/sub-projects/compression/lzo-kmod/lzo1x_decompress.c 2009-04-20 06:28:30.000000000 +0200 ++++ compcache-0.5.3/sub-projects/compression/lzo-kmod/lzo1x_decompress.c 2009-04-20 06:29:21.000000000 +0200 @@ -45,10 +45,7 @@ goto output_overrun; if (HAVE_IP(t + 1, ip_end, ip)) @@ -70,7 +70,7 @@ diff -uNr compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x_decompress.c com } while ((ip < ip_end)) { -@@ -71,23 +68,20 @@ +@@ -71,30 +68,27 @@ if (HAVE_IP(t + 4, ip_end, ip)) goto input_overrun; @@ -108,6 +108,14 @@ diff -uNr compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x_decompress.c com do { *op++ = *ip++; } while (--t > 0); + } + } + +-first_literal_run: ++//first_literal_run: + t = *ip++; + if (t >= 16) + goto match; @@ -139,8 +133,7 @@ t += 31 + *ip++; } @@ -173,13 +181,3 @@ diff -uNr compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x_decompress.c com } else { copy_match: *op++ = *m_pos++; -@@ -247,9 +251,7 @@ - *out_len = op - out; - return LZO_E_LOOKBEHIND_OVERRUN; - } -- - EXPORT_SYMBOL_GPL(lzo1x_decompress_safe); - - MODULE_LICENSE("GPL"); - MODULE_DESCRIPTION("LZO1X Decompressor"); -- diff --git a/package/compcache/patches/002-compact_lzo-codec.patch b/package/compcache/patches/002-compact_lzo-codec.patch deleted file mode 100644 index 4b560f317..000000000 --- a/package/compcache/patches/002-compact_lzo-codec.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- compcache-0.5/Makefile.bak 2008-12-10 07:25:44.000000000 +0100 -+++ compcache-0.5/Makefile 2009-01-21 08:25:38.000000000 +0100 -@@ -4,15 +4,13 @@ - -DCONFIG_XV_STATS \ - -g -Wall - --obj-m += sub-projects/compression/lzo-kmod/lzo1x_decompress.o \ -- sub-projects/compression/lzo-kmod/lzo1x_compress.o \ -+obj-m += sub-projects/compression/lzo-kmod/lzo1x.o \ - sub-projects/allocators/xvmalloc-kmod/xvmalloc.o \ - compcache.o - - all: - make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules -- @ln -sf sub-projects/compression/lzo-kmod/lzo1x_decompress.ko -- @ln -sf sub-projects/compression/lzo-kmod/lzo1x_compress.ko -+ @ln -sf sub-projects/compression/lzo-kmod/lzo1x.ko - @ln -sf sub-projects/allocators/xvmalloc-kmod/xvmalloc.ko - - clean: ---- compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x.c~ 1970-01-01 01:00:00.000000000 +0100 -+++ compcache-0.5/sub-projects/compression/lzo-kmod/lzo1x.c 2008-05-06 09:38:12.000000000 +0200 -@@ -0,0 +1,7 @@ -+#include -+ -+#include "lzo1x_compress.c" -+#include "lzo1x_decompress.c" -+ -+MODULE_LICENSE("GPL"); -+MODULE_DESCRIPTION("LZO1X Lib"); diff --git a/package/compcache/patches/100-use_register_width.patch b/package/compcache/patches/100-use_register_width.patch new file mode 100644 index 000000000..6200d56fd --- /dev/null +++ b/package/compcache/patches/100-use_register_width.patch @@ -0,0 +1,24 @@ +diff -uNr compcache-0.5.2/compcache.c compcache/compcache.c +--- compcache-0.5.2/compcache.c 2009-03-10 13:03:56.000000000 +0100 ++++ compcache/ramzswap.c 2009-04-01 17:38:20.000000000 +0200 +@@ -68,15 +68,15 @@ + static int page_zero_filled(void *ptr) + { + u32 pos; +- u64 *page; +- +- page = (u64 *)ptr; +- ++#if defined(CONFIG_64BIT) ++ u64 *page = (u64 *)ptr; ++#else ++ u32 *page = (u32 *)ptr; ++#endif + for (pos = 0; pos != PAGE_SIZE / sizeof(*page); pos++) { + if (page[pos]) + return 0; + } +- + return 1; + } + diff --git a/package/compcache/patches/200-av_compress_ratio.patch b/package/compcache/patches/200-av_compress_ratio.patch new file mode 100644 index 000000000..82a1ecce8 --- /dev/null +++ b/package/compcache/patches/200-av_compress_ratio.patch @@ -0,0 +1,39 @@ +diff -uNr compcache-0.5.4-old/ramzswap.c compcache-0.5.4/ramzswap.c +--- compcache-0.5.4-old/ramzswap.c 2009-10-18 09:14:53.000000000 +0200 ++++ compcache-0.5.4/ramzswap.c 2009-10-18 09:12:08.000000000 +0200 +@@ -126,7 +126,9 @@ + { + int len; + size_t succ_writes, mem_used; +- unsigned int good_compress_perc = 0, no_compress_perc = 0; ++ unsigned int good_compress_perc = 0, ++ av_compression_perc = 0, ++ no_compress_perc = 0; + + mem_used = xv_get_total_size_bytes(rzs.mem_pool) + + (stats.pages_expand << PAGE_SHIFT); +@@ -154,6 +156,8 @@ + if (succ_writes && stats.pages_stored) { + good_compress_perc = stats.good_compress * 100 + / stats.pages_stored; ++ av_compression_perc = stats.compr_size * 100 ++ / (stats.good_compress << PAGE_SHIFT); + no_compress_perc = stats.pages_expand * 100 + / stats.pages_stored; + } +@@ -168,6 +172,7 @@ + "NotifyFree: %8llu\n" + "ZeroPages: %8u\n" + "GoodCompress: %8u %%\n" ++ "AvCompression: %8u %%\n" + "NoCompress: %8u %%\n" + "PagesStored: %8u\n" + "PagesUsed: %8zu\n" +@@ -182,6 +187,7 @@ + stats.notify_free, + stats.pages_zero, + good_compress_perc, ++ av_compression_perc, + no_compress_perc, + stats.pages_stored, + mem_used >> PAGE_SHIFT, From 9b7c8c39dee07184c0c440c00a9aaa01a1a726e6 Mon Sep 17 00:00:00 2001 From: florian Date: Mon, 23 Nov 2009 22:30:45 +0000 Subject: [PATCH 218/288] [package] package sfdisk from util-linux-ng (#5998) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18513 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/util-linux-ng/Makefile | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/package/util-linux-ng/Makefile b/package/util-linux-ng/Makefile index 56645f25a..a3124fd31 100644 --- a/package/util-linux-ng/Makefile +++ b/package/util-linux-ng/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=util-linux-ng PKG_VERSION:=2.13.0.1 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.13 @@ -46,6 +46,16 @@ define Package/cfdisk/description This package contains a utility for managing disk partition tables. endef +define Package/sfdisk +$(call Package/util-linux/Default) + TITLE:=Partition table manipulation utility (Command-line) + SUBMENU=disc +endef + +define Package/sfdisk/description + This package contains a utility for managing disk partition tables using command-line only. +endef + define Package/losetup $(call Package/util-linux/Default) TITLE:=Loopback devices setup and control utility @@ -100,7 +110,7 @@ endef define Build/Compile $(MAKE) -C $(PKG_BUILD_DIR)/disk-utils mkswap $(MAKE) -C $(PKG_BUILD_DIR)/mount swapon losetup umount mount - $(MAKE) -C $(PKG_BUILD_DIR)/fdisk fdisk cfdisk + $(MAKE) -C $(PKG_BUILD_DIR)/fdisk fdisk cfdisk sfdisk $(MAKE) -C $(PKG_BUILD_DIR)/hwclock hwclock $(MAKE) -C $(PKG_BUILD_DIR)/sys-utils flock endef @@ -115,6 +125,11 @@ define Package/cfdisk/install $(INSTALL_BIN) $(PKG_BUILD_DIR)/fdisk/cfdisk $(1)/sbin/ endef +define Package/sfdisk/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/fdisk/sfdisk $(1)/usr/sbin/ +endef + define Package/losetup/install $(INSTALL_DIR) $(1)/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/mount/losetup $(1)/sbin/ @@ -143,6 +158,7 @@ endef $(eval $(call BuildPackage,fdisk)) $(eval $(call BuildPackage,cfdisk)) +$(eval $(call BuildPackage,sfdisk)) $(eval $(call BuildPackage,losetup)) $(eval $(call BuildPackage,mount-utils)) $(eval $(call BuildPackage,swap-utils)) From 6c64fce072af58aa0c33e179b4408d7ac0ad7eaa Mon Sep 17 00:00:00 2001 From: florian Date: Mon, 23 Nov 2009 23:53:23 +0000 Subject: [PATCH 219/288] [package] downgrade e2fsprogs to 1.40.11 which does not segfault until we fix the issue (#6073) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18517 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/e2fsprogs/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/e2fsprogs/Makefile b/package/e2fsprogs/Makefile index 49f0eca4f..e5cf995c9 100644 --- a/package/e2fsprogs/Makefile +++ b/package/e2fsprogs/Makefile @@ -8,8 +8,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=e2fsprogs -PKG_VERSION:=1.41.9 -PKG_MD5SUM:=52f60a9e19a02f142f5546f1b5681927 +PKG_VERSION:=1.40.11 +PKG_MD5SUM:=004cea70d724fdc7f1a952dffe4c9db8 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz From 3944e3b1bfec75b402592cadbcb0789c58551290 Mon Sep 17 00:00:00 2001 From: nico Date: Tue, 24 Nov 2009 00:43:31 +0000 Subject: [PATCH 220/288] [toolchain] eglibc: update v2.10 to rev. 9289 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18518 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- toolchain/eglibc/Config.in | 2 +- toolchain/eglibc/Config.version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/toolchain/eglibc/Config.in b/toolchain/eglibc/Config.in index 407240b8c..8f38d0981 100644 --- a/toolchain/eglibc/Config.in +++ b/toolchain/eglibc/Config.in @@ -33,7 +33,7 @@ config EGLIBC_REVISION default "8588" if EGLIBC_VERSION_2_7 default "8587" if EGLIBC_VERSION_2_8 default "8690" if EGLIBC_VERSION_2_9 - default "8873" if EGLIBC_VERSION_2_10 + default "9289" if EGLIBC_VERSION_2_10 default "HEAD" if EGLIBC_VERSION_TRUNK default "" diff --git a/toolchain/eglibc/Config.version b/toolchain/eglibc/Config.version index e31282681..6e2146d15 100644 --- a/toolchain/eglibc/Config.version +++ b/toolchain/eglibc/Config.version @@ -5,5 +5,5 @@ config EGLIBC_VERSION default "2.7" if EGLIBC_VERSION_2_7 default "2.8" if EGLIBC_VERSION_2_8 default "2.9" if EGLIBC_VERSION_2_9 - default "2.10.1" if EGLIBC_VERSION_2_10 + default "2.10.2" if EGLIBC_VERSION_2_10 default "trunk" From aa0f3a77805a1e03623a6f8c60c1f0167be75a48 Mon Sep 17 00:00:00 2001 From: nico Date: Tue, 24 Nov 2009 07:03:04 +0000 Subject: [PATCH 221/288] [toolchain] eglibc: add support for v2.11 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18522 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- toolchain/eglibc/Config.in | 5 ++++ toolchain/eglibc/Config.version | 1 + toolchain/eglibc/Makefile | 3 ++ toolchain/eglibc/config/Config.in | 50 ++++++++++++++++++++++++++----- 4 files changed, 51 insertions(+), 8 deletions(-) diff --git a/toolchain/eglibc/Config.in b/toolchain/eglibc/Config.in index 8f38d0981..d9c23e072 100644 --- a/toolchain/eglibc/Config.in +++ b/toolchain/eglibc/Config.in @@ -20,6 +20,10 @@ choice config EGLIBC_VERSION_2_10 bool "eglibc 2.10" + config EGLIBC_VERSION_2_11 + bool "eglibc 2.11" + depends GCC_VERSION_4_3 || GCC_VERSION_4_4 + config EGLIBC_VERSION_TRUNK bool "eglibc trunk" @@ -34,6 +38,7 @@ config EGLIBC_REVISION default "8587" if EGLIBC_VERSION_2_8 default "8690" if EGLIBC_VERSION_2_9 default "9289" if EGLIBC_VERSION_2_10 + default "9306" if EGLIBC_VERSION_2_11 default "HEAD" if EGLIBC_VERSION_TRUNK default "" diff --git a/toolchain/eglibc/Config.version b/toolchain/eglibc/Config.version index 6e2146d15..217c9ce44 100644 --- a/toolchain/eglibc/Config.version +++ b/toolchain/eglibc/Config.version @@ -6,4 +6,5 @@ config EGLIBC_VERSION default "2.8" if EGLIBC_VERSION_2_8 default "2.9" if EGLIBC_VERSION_2_9 default "2.10.2" if EGLIBC_VERSION_2_10 + default "2.11 " if EGLIBC_VERSION_2_11 default "trunk" diff --git a/toolchain/eglibc/Makefile b/toolchain/eglibc/Makefile index b72b4bd35..822309d05 100644 --- a/toolchain/eglibc/Makefile +++ b/toolchain/eglibc/Makefile @@ -30,6 +30,9 @@ endif ifneq ($(CONFIG_EGLIBC_VERSION_2_10),) PKG_SOURCE_URL:=svn://svn.eglibc.org/branches/eglibc-2_10 endif +ifneq ($(CONFIG_EGLIBC_VERSION_2_11),) + PKG_SOURCE_URL:=svn://svn.eglibc.org/branches/eglibc-2_11 +endif ifneq ($(CONFIG_EGLIBC_VERSION_TRUNK),) PKG_SOURCE_URL:=svn://svn.eglibc.org/trunk endif diff --git a/toolchain/eglibc/config/Config.in b/toolchain/eglibc/config/Config.in index eed1b2f90..ad442430e 100644 --- a/toolchain/eglibc/config/Config.in +++ b/toolchain/eglibc/config/Config.in @@ -46,6 +46,17 @@ config EGLIBC_OPTION_EGLIBC_BACKTRACE backtrace_symbols_fd +config EGLIBC_OPTION_EGLIBC_BIG_MACROS + bool "Use extensive inline code" + default y + depends EGLIBC_VERSION_2_11 + help + This option group specifies whether certain pieces of code + should be inlined to achieve maximum speed. If this option + group is not selected, function calls will be used instead, + hence reducing the library footprint. + + config EGLIBC_OPTION_EGLIBC_BSD bool "BSD-specific functions, and their compatibility stubs" default y @@ -198,7 +209,7 @@ config EGLIBC_OPTION_EGLIBC_ENVZ config EGLIBC_OPTION_EGLIBC_FCVT bool "Functions for converting floating-point numbers to strings" default y - depends EGLIBC_VERSION_2_10 + depends EGLIBC_VERSION_2_10 || EGLIBC_VERSION_2_11 help This option group includes functions for converting floating-point numbers to strings. @@ -215,7 +226,7 @@ config EGLIBC_OPTION_EGLIBC_FCVT config EGLIBC_OPTION_EGLIBC_FMTMSG bool "Functions for formatting messages" default y - depends EGLIBC_VERSION_2_10 + depends EGLIBC_VERSION_2_10 || EGLIBC_VERSION_2_11 help This option group includes the following functions: @@ -241,7 +252,7 @@ config EGLIBC_OPTION_EGLIBC_FSTAB config EGLIBC_OPTION_EGLIBC_FTRAVERSE bool "Functions for traversing file hierarchies" default y - depends EGLIBC_VERSION_2_10 + depends EGLIBC_VERSION_2_10 || EGLIBC_VERSION_2_11 help This option group includes functions for traversing file UNIX file hierachies. @@ -428,7 +439,7 @@ config EGLIBC_OPTION_EGLIBC_LOCALES config EGLIBC_OPTION_EGLIBC_LOCALE_CODE bool "Locale functions" default y - select EGLIBC_OPTION_POSIX_C_LANG_WIDE_CHAR if EGLIBC_VERSION_2_8 || EGLIBC_VERSION_2_9 || EGLIBC_VERSION_2_10 + select EGLIBC_OPTION_POSIX_C_LANG_WIDE_CHAR if EGLIBC_VERSION_2_8 || EGLIBC_VERSION_2_9 || EGLIBC_VERSION_2_10 || EGLIBC_VERSION_2_11 help This option group includes locale support functions, programs, and libraries. With EGLIBC_OPTION_EGLIBC_LOCALE_CODE disabled, @@ -450,6 +461,28 @@ config EGLIBC_OPTION_EGLIBC_LOCALE_CODE disable EGLIBC_OPTION_EGLIBC_CATGETS. +config EGLIBC_OPTION_EGLIBC_MEMUSAGE + bool "Memory profiling library" + default y + depends EGLIBC_VERSION_2_11 + help + This option group includes the `libmemusage' library and + the `memusage' and `memusagestat' utilities. + These components provide memory profiling functions. + + EGLIBC_OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE + + Libmemusage library buffers the profiling data in memory + before writing it out to disk. By default, the library + allocates 1.5M buffer, which can be substantial for some + systems. EGLIBC_OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE option + allows to change the default buffer size. It specifies + the number of entries the buffer should have. + On most architectures one buffer entry amounts to 48 bytes, + so setting this option to the value of 512 will reduce the size of + the memory buffer to 24K. + + config EGLIBC_OPTION_EGLIBC_NIS bool "Support for NIS, NIS+, and the special 'compat' services." default y @@ -468,6 +501,7 @@ config EGLIBC_OPTION_EGLIBC_NIS config EGLIBC_OPTION_EGLIBC_NSSWITCH bool "Name service switch (nsswitch) support" default y + select EGLIBC_OPTION_EGLIBC_INET help This option group includes support for the 'nsswitch' facility. @@ -538,7 +572,7 @@ config EGLIBC_OPTION_EGLIBC_NSSWITCH system actually uses. Note that some nsswitch service libraries require other option - groups to be enabled; for example, the EGLIBC_INET + groups to be enabled; for example, the EGLIBC_OPTION_EGLIBC_INET option group must be enabled to use the 'libnss_dns.so.2' service library, which uses the Domain Name System network protocol to answer queries. @@ -695,7 +729,7 @@ config EGLIBC_OPTION_EGLIBC_WORDEXP config EGLIBC_OPTION_POSIX_C_LANG_WIDE_CHAR bool "ISO C library wide character functions, excluding I/O" default y - depends EGLIBC_VERSION_2_8 || EGLIBC_VERSION_2_9 || EGLIBC_VERSION_2_10 + depends EGLIBC_VERSION_2_8 || EGLIBC_VERSION_2_9 || EGLIBC_VERSION_2_10 || EGLIBC_VERSION_2_11 help This option group includes the functions defined by the ISO C standard for working with wide and multibyte characters in @@ -750,7 +784,7 @@ config EGLIBC_OPTION_POSIX_REGEXP config EGLIBC_OPTION_POSIX_REGEXP_GLIBC bool "Regular expressions from GLIBC" default y - depends EGLIBC_VERSION_2_10 + depends EGLIBC_VERSION_2_10 || EGLIBC_VERSION_2_11 select EGLIBC_OPTION_POSIX_REGEXP help This option group specifies which regular expression @@ -764,7 +798,7 @@ config EGLIBC_OPTION_POSIX_REGEXP_GLIBC config EGLIBC_OPTION_POSIX_WIDE_CHAR_DEVICE_IO bool "Input and output functions for wide characters" default y - select EGLIBC_OPTION_POSIX_C_LANG_WIDE_CHAR if EGLIBC_VERSION_2_8 || EGLIBC_VERSION_2_9 || EGLIBC_VERSION_2_10 + select EGLIBC_OPTION_POSIX_C_LANG_WIDE_CHAR if EGLIBC_VERSION_2_8 || EGLIBC_VERSION_2_9 || EGLIBC_VERSION_2_10 || EGLIBC_VERSION_2_11 help This option group includes functions for reading and writing wide characters to and from streams. From bdbd2e119d0f58be7d70ea7bcdb4de111f079ce1 Mon Sep 17 00:00:00 2001 From: hcg Date: Tue, 24 Nov 2009 10:39:31 +0000 Subject: [PATCH 222/288] kmod-sound-core: Add new 2.6.32 kernel config option git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18523 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/kernel/modules/sound.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/kernel/modules/sound.mk b/package/kernel/modules/sound.mk index f78cdfc4b..1d3a5bee6 100644 --- a/package/kernel/modules/sound.mk +++ b/package/kernel/modules/sound.mk @@ -24,7 +24,8 @@ define KernelPackage/sound-core CONFIG_SND_SEQUENCER_OSS=y \ CONFIG_HOSTAUDIO \ CONFIG_SND_PCM_OSS \ - CONFIG_SND_MIXER_OSS + CONFIG_SND_MIXER_OSS \ + CONFIG_SOUND_OSS_CORE_PRECLAIM=y endef define KernelPackage/sound-core/2.4 From c312c2ca40a27ce95431bb88cacece5978070c77 Mon Sep 17 00:00:00 2001 From: nbd Date: Tue, 24 Nov 2009 13:55:32 +0000 Subject: [PATCH 223/288] kernel: add missing config symbols for kernel debugging git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18524 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic-2.6/config-2.6.30 | 2 ++ target/linux/generic-2.6/config-2.6.31 | 2 ++ target/linux/generic-2.6/config-2.6.32 | 2 ++ 3 files changed, 6 insertions(+) diff --git a/target/linux/generic-2.6/config-2.6.30 b/target/linux/generic-2.6/config-2.6.30 index 76ce52c40..97a3ade92 100644 --- a/target/linux/generic-2.6/config-2.6.30 +++ b/target/linux/generic-2.6/config-2.6.30 @@ -564,6 +564,7 @@ CONFIG_FRAME_WARN=1024 # CONFIG_FS_POSIX_ACL is not set # CONFIG_FTL is not set # CONFIG_FTRACE is not set +# CONFIG_FTRACE_STARTUP_TEST is not set # CONFIG_FUNCTION_TRACER is not set # CONFIG_FUSE_FS is not set # CONFIG_FUSION_FC is not set @@ -1234,6 +1235,7 @@ CONFIG_NET_CLS_IND=y # CONFIG_NET_CLS_TCINDEX is not set # CONFIG_NET_CLS_U32 is not set CONFIG_NET_CLS=y +# CONFIG_NET_DROP_MONITOR is not set # CONFIG_NETCONSOLE is not set # CONFIG_NETDEBUG is not set # CONFIG_NETDEV_10000 is not set diff --git a/target/linux/generic-2.6/config-2.6.31 b/target/linux/generic-2.6/config-2.6.31 index e8c61e4f9..b1d2a01c3 100644 --- a/target/linux/generic-2.6/config-2.6.31 +++ b/target/linux/generic-2.6/config-2.6.31 @@ -582,6 +582,7 @@ CONFIG_FSNOTIFY=y # CONFIG_FS_POSIX_ACL is not set # CONFIG_FTL is not set # CONFIG_FTRACE is not set +# CONFIG_FTRACE_STARTUP_TEST is not set # CONFIG_FUNCTION_TRACER is not set # CONFIG_FUSE_FS is not set # CONFIG_FUSION_FC is not set @@ -1270,6 +1271,7 @@ CONFIG_NET_CLS_IND=y # CONFIG_NET_CLS_TCINDEX is not set # CONFIG_NET_CLS_U32 is not set CONFIG_NET_CLS=y +# CONFIG_NET_DROP_MONITOR is not set # CONFIG_NETCONSOLE is not set # CONFIG_NETDEBUG is not set # CONFIG_NETDEV_10000 is not set diff --git a/target/linux/generic-2.6/config-2.6.32 b/target/linux/generic-2.6/config-2.6.32 index 2a314b7eb..b136f2fbd 100644 --- a/target/linux/generic-2.6/config-2.6.32 +++ b/target/linux/generic-2.6/config-2.6.32 @@ -590,6 +590,7 @@ CONFIG_FSNOTIFY=y # CONFIG_FS_POSIX_ACL is not set # CONFIG_FTL is not set # CONFIG_FTRACE is not set +# CONFIG_FTRACE_STARTUP_TEST is not set # CONFIG_FUNCTION_TRACER is not set # CONFIG_FUSE_FS is not set # CONFIG_FUSION_FC is not set @@ -1283,6 +1284,7 @@ CONFIG_NET_CLS_IND=y # CONFIG_NET_CLS_TCINDEX is not set # CONFIG_NET_CLS_U32 is not set CONFIG_NET_CLS=y +# CONFIG_NET_DROP_MONITOR is not set # CONFIG_NETCONSOLE is not set # CONFIG_NETDEBUG is not set # CONFIG_NETDEV_10000 is not set From 5a99d27cc6b54b9a24133ee16ede65eeece37e0d Mon Sep 17 00:00:00 2001 From: nbd Date: Tue, 24 Nov 2009 13:55:37 +0000 Subject: [PATCH 224/288] ath: only use GFP_DMA on ixp4xx git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18525 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches/510-ath_use_gfp_dma.patch | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/package/mac80211/patches/510-ath_use_gfp_dma.patch b/package/mac80211/patches/510-ath_use_gfp_dma.patch index af375b151..9390a2faa 100644 --- a/package/mac80211/patches/510-ath_use_gfp_dma.patch +++ b/package/mac80211/patches/510-ath_use_gfp_dma.patch @@ -1,11 +1,17 @@ --- a/drivers/net/wireless/ath/main.c +++ b/drivers/net/wireless/ath/main.c -@@ -43,7 +43,7 @@ struct sk_buff *ath_rxbuf_alloc(struct a - * Unfortunately this means we may get 8 KB here from the - * kernel... and that is actually what is observed on some - * systems :( */ -- skb = __dev_alloc_skb(len + common->cachelsz - 1, gfp_mask); -+ skb = __dev_alloc_skb(len + common->cachelsz - 1, gfp_mask | GFP_DMA); - if (skb != NULL) { - off = ((unsigned long) skb->data) % common->cachelsz; - if (off != 0) +@@ -31,6 +31,14 @@ struct sk_buff *ath_rxbuf_alloc(struct a + u32 off; + + /* ++ * Enable GFP_DMA in order to avoid using DMA bounce buffers ++ * on IXP4xx devices with more than 64M RAM ++ */ ++#ifdef CONFIG_ARCH_IXP4XX ++ gfp_mask |= GFP_DMA; ++#endif ++ ++ /* + * Cache-line-align. This is important (for the + * 5210 at least) as not doing so causes bogus data + * in rx'd frames. From 124b7a0af508f2b1f8383b5e666654ed92289acd Mon Sep 17 00:00:00 2001 From: nbd Date: Tue, 24 Nov 2009 13:55:40 +0000 Subject: [PATCH 225/288] ar71xx: the squashfs-4k images are unreliable in some builds. add 4k, 8k padding to the generic squashfs images and use them on 4k devices as well git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18526 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- include/image.mk | 12 ++++++++---- target/linux/ar71xx/image/Makefile | 6 ++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/image.mk b/include/image.mk index a722086a0..d75ca3c30 100644 --- a/include/image.mk +++ b/include/image.mk @@ -40,13 +40,17 @@ define add_jffs2_mark echo -ne '\xde\xad\xc0\xde' >> $(1) endef -# pad to 64k and add jffs2 end-of-filesystem mark -# do this twice to make sure that this works with 128k blocksize as well +# pad to 4k, 8k, 64k, 128k and add jffs2 end-of-filesystem mark define prepare_generic_squashfs - dd if=$(1) of=$(KDIR)/tmpfile.1 bs=64k conv=sync + dd if=$(1) of=$(KDIR)/tmpfile.0 bs=4k conv=sync + $(call add_jffs2_mark,$(KDIR)/tmpfile.0) + dd if=$(KDIR)/tmpfile.0 of=$(KDIR)/tmpfile.1 bs=4k conv=sync $(call add_jffs2_mark,$(KDIR)/tmpfile.1) - dd of=$(1) if=$(KDIR)/tmpfile.1 bs=64k conv=sync + dd if=$(KDIR)/tmpfile.1 of=$(KDIR)/tmpfile.2 bs=64k conv=sync + $(call add_jffs2_mark,$(KDIR)/tmpfile.2) + dd if=$(KDIR)/tmpfile.2 of=$(1) bs=64k conv=sync $(call add_jffs2_mark,$(1)) + rm -f $(KDIR)/tmpfile.* endef ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 33937e402..ed623de20 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -276,7 +276,7 @@ define Image/Build/Template/TPLINK4K endef define Image/Build/Template/TPLINK4K/squashfs - $(call Image/Build/Template/TPLINK,squashfs-4k,$(1),$(2),$(3)) + $(call Image/Build/Template/TPLINK,squashfs,$(1),$(2),$(3)) endef define Image/Build/Template/UBNT @@ -296,7 +296,7 @@ define Image/Build/Template/UBNTXM endef define Image/Build/Template/UBNTXM/squashfs - $(call Image/Build/Template/UBNTXM,squashfs-4k,$(1),$(2),$(3),$(4),$(5)) + $(call Image/Build/Template/UBNTXM,squashfs,$(1),$(2),$(3),$(4),$(5)) endef define Image/Build/Template/UBNTXM/jffs2-64k @@ -428,8 +428,6 @@ define Image/Build/Profile/Madwifi endef define Image/Build/squashfs - dd if=$(KDIR)/root.squashfs of=$(IMGNAME)-root.squashfs-4k bs=4k conv=sync - $(call add_jffs2_mark,$(IMGNAME)-root.squashfs-4k) $(call prepare_generic_squashfs,$(KDIR)/root.squashfs) endef From 9351b5dfae41a0c7efebe5ede936cb7e8d0fcdaf Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 24 Nov 2009 21:17:20 +0000 Subject: [PATCH 226/288] [tools] update automake to 1.10, fixes #6022 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18527 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- tools/automake/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/automake/Makefile b/tools/automake/Makefile index cd258479d..ff0f9b216 100644 --- a/tools/automake/Makefile +++ b/tools/automake/Makefile @@ -7,11 +7,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=automake -PKG_VERSION:=1.9.6 +PKG_VERSION:=1.10 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=@GNU/automake -PKG_MD5SUM:=c11b8100bb311492d8220378fd8bf9e0 +PKG_MD5SUM:= include $(INCLUDE_DIR)/host-build.mk @@ -30,6 +30,7 @@ define Host/Install mv $(STAGING_DIR_HOST)/bin/aclocal $(STAGING_DIR_HOST)/bin/aclocal.real $(INSTALL_BIN) ./files/aclocal $(STAGING_DIR_HOST)/bin ln -f $(STAGING_DIR_HOST)/bin/aclocal $(STAGING_DIR_HOST)/bin/aclocal-1.9 + ln -f $(STAGING_DIR_HOST)/bin/aclocal $(STAGING_DIR_HOST)/bin/aclocal-1.10 endef define Host/Clean From 6b398193ef29d501b64be93af512da13e9a2f5fe Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 24 Nov 2009 22:13:19 +0000 Subject: [PATCH 227/288] [package] prevent busybox's ping6 from crashing (#4604) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18528 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/busybox/Makefile | 2 +- package/busybox/patches/500-ping6_crash.patch | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 package/busybox/patches/500-ping6_crash.patch diff --git a/package/busybox/Makefile b/package/busybox/Makefile index 75bb315cc..508c3e99a 100644 --- a/package/busybox/Makefile +++ b/package/busybox/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=busybox PKG_VERSION:=1.14.4 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://www.busybox.net/downloads \ diff --git a/package/busybox/patches/500-ping6_crash.patch b/package/busybox/patches/500-ping6_crash.patch new file mode 100644 index 000000000..8412a18ac --- /dev/null +++ b/package/busybox/patches/500-ping6_crash.patch @@ -0,0 +1,12 @@ +Index: busybox-1.15.2/networking/ping.c +=================================================================== +--- busybox-1.15.2.orig/networking/ping.c 2009-11-24 22:57:29.000000000 +0100 ++++ busybox-1.15.2/networking/ping.c 2009-11-24 22:58:58.000000000 +0100 +@@ -769,6 +769,7 @@ + int ping6_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; + int ping6_main(int argc UNUSED_PARAM, char **argv) + { ++ argv[-1] = argv[0]; + argv[0] = (char*)"-6"; + return ping_main(0 /* argc+1 - but it's unused anyway */, + argv - 1); From 916a84b6ef049bc04d6617ffc65a17fc76171a91 Mon Sep 17 00:00:00 2001 From: juhosg Date: Wed, 25 Nov 2009 09:51:19 +0000 Subject: [PATCH 228/288] ar71xx: dont't build images for Ubiquiti XM devices with the Madwifi profile git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18530 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/image/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index ed623de20..24b1fa36a 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -423,7 +423,9 @@ define Image/Build/Profile/Default endef define Image/Build/Profile/Madwifi - $(call Image/Build/Profile/UBNT,$(1)) + $(call Image/Build/Profile/UBNTRS,$(1)) + $(call Image/Build/Profile/UBNTRSPRO,$(1)) + $(call Image/Build/Profile/UBNTLSSR71,$(1)) $(call Image/Build/Profile/WP543,$(1)) endef From 227b0b29bdd246463ce93b847dd380909a3a4ae0 Mon Sep 17 00:00:00 2001 From: juhosg Date: Wed, 25 Nov 2009 09:51:25 +0000 Subject: [PATCH 229/288] ar71xx: create combined images for the RS, RS-PRO and LS-SR71 boards, and add sysupgrade support for them git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18531 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../ar71xx/base-files/lib/upgrade/platform.sh | 84 ++++++++++++++++++- target/linux/ar71xx/image/Makefile | 11 ++- 2 files changed, 93 insertions(+), 2 deletions(-) diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index c4c56afdd..ef84e8469 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -7,6 +7,60 @@ PART_NAME=firmware RAMFS_COPY_DATA=/lib/ar71xx.sh +CI_BLKSZ=65536 +CI_LDADR=0x80060000 + +platform_find_partitions() { + local first dev size erasesize name + while read dev size erasesize name; do + name=${name#'"'}; name=${name%'"'} + case "$name" in + vmlinux.bin.l7|kernel|linux|rootfs) + if [ -z "$first" ]; then + first="$name" + else + echo "$erasesize:$first:$name" + break + fi + ;; + esac + done < /proc/mtd +} + +platform_find_kernelpart() { + local part + for part in "${1%:*}" "${1#*:}"; do + case "$part" in + vmlinux.bin.l7|kernel|linux) + echo "$part" + break + ;; + esac + done +} + +platform_do_upgrade_combined() { + local partitions=$(platform_find_partitions) + local kernelpart=$(platform_find_kernelpart "${partitions#*:}") + local erase_size=$((0x${partitions%%:*})); partitions="${partitions#*:}" + local kern_length=0x$(dd if="$1" bs=2 skip=1 count=4 2>/dev/null) + local kern_blocks=$(($kern_length / $CI_BLKSZ)) + local root_blocks=$((0x$(dd if="$1" bs=2 skip=5 count=4 2>/dev/null) / $CI_BLKSZ)) + + if [ -n "$partitions" ] && [ -n "$kernelpart" ] && \ + [ ${kern_blocks:-0} -gt 0 ] && \ + [ ${root_blocks:-0} -gt ${kern_blocks:-0} ] && \ + [ ${erase_size:-0} -gt 0 ]; + then + local append="" + [ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && append="-j $CONF_TAR" + + ( dd if="$1" bs=$CI_BLKSZ skip=1 count=$kern_blocks 2>/dev/null; \ + dd if="$1" bs=$CI_BLKSZ skip=$((1+$kern_blocks)) count=$root_blocks 2>/dev/null ) | \ + mtd -r $append -F$kernelpart:$kern_length:$CI_LDADR,rootfs write - $partitions + fi +} + platform_check_image() { local board=$(ar71xx_board_name) local magic="$(get_magic_word "$1")" @@ -35,13 +89,41 @@ platform_check_image() { } return 0 ;; + routerstation | routerstation-pro | ls-sr71) + [ "$magic" != "4349" ] && { + echo "Invalid image. Use *-sysupgrade.bin files on this board" + return 1 + } + + local md5_img=$(dd if="$1" bs=2 skip=9 count=16 2>/dev/null) + local md5_chk=$(dd if="$1" bs=$CI_BLKSZ skip=1 2>/dev/null | md5sum -); md5_chk="${md5_chk%% *}" + + if [ -n "$md5_img" -a -n "$md5_chk" ] && [ "$md5_img" = "$md5_chk" ]; then + return 0 + else + echo "Invalid image. Contents do not match checksum (image:$md5_img calculated:$md5_chk)" + return 1 + fi + return 0 + ;; esac echo "Sysupgrade is not yet supported on $board." return 1 } -# use default for platform_do_upgrade() +platform_do_upgrade() { + local board=$(ar71xx_board_name) + + case "$board" in + routerstation | routerstation-pro) + platform_do_upgrade_combined "$ARGV" + ;; + *) + default_do_upgrade "$ARGV" + ;; + esac +} disable_watchdog() { killall watchdog diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 24b1fa36a..30663f12c 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -161,7 +161,11 @@ define Image/Build/UBNT -B $(4) -v $(5).$(6).OpenWrt.$(REVISION) \ -k $(KDIR)/vmlinux-$(2).lzma \ -r $(BIN_DIR)/openwrt-$(BOARD)-root.$(1) \ - -o $(call imgname,$(1),$(2)).bin + -o $(call imgname,$(1),$(2))-factory.bin + -sh $(TOPDIR)/scripts/combined-image.sh \ + "$(KDIR)/vmlinux-$(2).lzma" \ + "$(BIN_DIR)/openwrt-$(BOARD)-root.$(1)" \ + $(call imgname,$(1),$(2))-sysupgrade.bin endef define Image/Build/Planex @@ -431,6 +435,11 @@ endef define Image/Build/squashfs $(call prepare_generic_squashfs,$(KDIR)/root.squashfs) + dd if=$(KDIR)/root.squashfs of=$(KDIR)/root.squashfs-4k.tmp0 bs=4k conv=sync + $(call add_jffs2_mark,$(KDIR)/root.squashfs-4k.tmp0) + dd if=$(KDIR)/root.squashfs-4k.tmp0 of=$(IMGNAME)-root.squashfs-4k bs=4k conv=sync + $(call add_jffs2_mark,$(IMGNAME)-root.squashfs-4k) + rm -f $(KDIR)/root.squashfs-4k.tmp0 endef define Image/Build From 4e8c80cba447f0ace6c68b1355f1fac00eb7d759 Mon Sep 17 00:00:00 2001 From: juhosg Date: Wed, 25 Nov 2009 09:51:28 +0000 Subject: [PATCH 230/288] ar71xx: enable failsafe on the Nanostation M/Rocket M git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18532 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/base-files/etc/diag.sh | 2 +- target/linux/ar71xx/base-files/lib/ar71xx.sh | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index 82de0a992..1d88f431f 100755 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -39,7 +39,7 @@ get_status_led() { aw-nr580) status_led="aw-nr580:green:ready" ;; - bullet-m) + bullet-m | rocket-m | nano-m) status_led="ubnt:green:link4" ;; ls-sr71) diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 5ff238871..b1c3b83ea 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -22,6 +22,9 @@ ar71xx_board_name() { *"Bullet M") name="bullet-m" ;; + *"Nanostation M") + name="nanostation-m" + ;; *LS-SR71) name="ls-sr71" ;; @@ -49,6 +52,9 @@ ar71xx_board_name() { *RB-493) name="rb-493" ;; + *"Rocket M") + name="rocket-m" + ;; *RouterStation) name="routerstation" ;; From a9499f8570ff31ab1b08410cd926b532ea986ef7 Mon Sep 17 00:00:00 2001 From: juhosg Date: Wed, 25 Nov 2009 09:51:31 +0000 Subject: [PATCH 231/288] ar71xx: add sysupgrade support for Ubiquiti XM boards git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18533 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/base-files/lib/upgrade/platform.sh | 2 +- target/linux/ar71xx/image/Makefile | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index ef84e8469..8ee412ed0 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -68,7 +68,7 @@ platform_check_image() { [ "$ARGC" -gt 1 ] && return 1 case "$board" in - ap83 | mzk-w04nu | mzk-w300nh | tew-632brp | wrt-400n) + ap83 | mzk-w04nu | mzk-w300nh | tew-632brp | wrt-400n | bullet-m | nano-m | rocket-m) [ "$magic" != "2705" ] && { echo "Invalid image type." return 1 diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 30663f12c..b61524ecd 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -138,7 +138,7 @@ define Image/Build/MyLoader $(call imgname,$(1),$(2))-16M.img endef -ubntxm_mtdlayout=mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),1024k(kernel),6528k(rootfs),256k(cfg),64k(EEPROM) +ubntxm_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1024k(kernel),6528k(rootfs),256k(cfg)ro,64k(EEPROM)ro,7552k@0x50000(firmware) define Image/Build/UBNTXM $(call PatchKernelLzma,$(2),$(3) $(ubntxm_mtdlayout)) mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \ @@ -151,7 +151,11 @@ define Image/Build/UBNTXM -B $(4) -v $(5).$(6).OpenWrt.$(REVISION) \ -k $(KDIR)/vmlinux-$(2).uImage \ -r $(BIN_DIR)/openwrt-$(BOARD)-root.$(1) \ - -o $(call imgname,$(1),$(2)).bin + -o $(call imgname,$(1),$(2))-factory.bin + ( \ + dd if=$(KDIR)/vmlinux-$(2).uImage; \ + dd if=$(BIN_DIR)/openwrt-$(BOARD)-root.$(1); \ + ) > $(call imgname,$(1),$(2))-sysupgrade.bin endef define Image/Build/UBNT From 66818c8ce5e1530d0b5d5b67ed52927dd7206d68 Mon Sep 17 00:00:00 2001 From: juhosg Date: Wed, 25 Nov 2009 09:51:33 +0000 Subject: [PATCH 232/288] ar71xx: use MkImageLzma template for Ubiquiti XM devices git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18534 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/image/Makefile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index b61524ecd..db57ed4e8 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -141,11 +141,7 @@ endef ubntxm_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1024k(kernel),6528k(rootfs),256k(cfg)ro,64k(EEPROM)ro,7552k@0x50000(firmware) define Image/Build/UBNTXM $(call PatchKernelLzma,$(2),$(3) $(ubntxm_mtdlayout)) - mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \ - 0x80060000 \ - -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \ - -d $(KDIR)/vmlinux-$(2).bin.lzma \ - $(KDIR)/vmlinux-$(2).uImage.bin + $(call MkImageLzma,$(KDIR)/vmlinux-$(2).bin.lzma,$(KDIR)/vmlinux-$(2).uImage.bin) dd if=$(KDIR)/vmlinux-$(2).uImage.bin of=$(KDIR)/vmlinux-$(2).uImage bs=1024k conv=sync -$(STAGING_DIR_HOST)/bin/mkfwimage \ -B $(4) -v $(5).$(6).OpenWrt.$(REVISION) \ From 7f61c43e8f3e899b57aff47e65465ba0c81da954 Mon Sep 17 00:00:00 2001 From: juhosg Date: Wed, 25 Nov 2009 10:28:30 +0000 Subject: [PATCH 233/288] ar71xx: rename TL-WRx41 images, because newer factory web interface does not accept files with '.uni' extension. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18535 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/image/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index db57ed4e8..79f7b7c5f 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -197,7 +197,7 @@ define Image/Build/TPLINK -B $(4) -N OpenWrt -V $(REVISION)\ -k $(KDIR)/vmlinux-$(2).bin.gz \ -r $(BIN_DIR)/openwrt-$(BOARD)-root.$(1) \ - -o $(call imgname,$(1),$(2)).uni + -o $(call imgname,$(1),$(2))-universal.bin endef define Image/Build/CyberTAN From ab1cdc3db353ea7af16224cee7ae3feaab8f0d8d Mon Sep 17 00:00:00 2001 From: juhosg Date: Wed, 25 Nov 2009 20:35:58 +0000 Subject: [PATCH 234/288] package/mac80211: disable 2GHz band for 5GHz only devices git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18537 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/Makefile | 2 +- ...GHz-band-only-if-the-device-supports.patch | 52 +++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 package/mac80211/patches/550-ath9k-enable-2GHz-band-only-if-the-device-supports.patch diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile index 2da34bada..62903e266 100644 --- a/package/mac80211/Makefile +++ b/package/mac80211/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 PKG_VERSION:=2009-11-21 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL:= \ http://www.orbit-lab.org/kernel/compat-wireless-2.6/2009/11 \ http://wireless.kernel.org/download/compat-wireless-2.6 diff --git a/package/mac80211/patches/550-ath9k-enable-2GHz-band-only-if-the-device-supports.patch b/package/mac80211/patches/550-ath9k-enable-2GHz-band-only-if-the-device-supports.patch new file mode 100644 index 000000000..dca58ed1f --- /dev/null +++ b/package/mac80211/patches/550-ath9k-enable-2GHz-band-only-if-the-device-supports.patch @@ -0,0 +1,52 @@ +--- a/drivers/net/wireless/ath/ath9k/main.c ++++ b/drivers/net/wireless/ath/ath9k/main.c +@@ -1805,13 +1805,15 @@ static int ath_init_softc(u16 devid, str + + /* setup channels and rates */ + +- sc->sbands[IEEE80211_BAND_2GHZ].channels = ath9k_2ghz_chantable; +- sc->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ; +- sc->sbands[IEEE80211_BAND_2GHZ].n_channels = +- ARRAY_SIZE(ath9k_2ghz_chantable); +- sc->sbands[IEEE80211_BAND_2GHZ].bitrates = ath9k_legacy_rates; +- sc->sbands[IEEE80211_BAND_2GHZ].n_bitrates = +- ARRAY_SIZE(ath9k_legacy_rates); ++ if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes)) { ++ sc->sbands[IEEE80211_BAND_2GHZ].channels = ath9k_2ghz_chantable; ++ sc->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ; ++ sc->sbands[IEEE80211_BAND_2GHZ].n_channels = ++ ARRAY_SIZE(ath9k_2ghz_chantable); ++ sc->sbands[IEEE80211_BAND_2GHZ].bitrates = ath9k_legacy_rates; ++ sc->sbands[IEEE80211_BAND_2GHZ].n_bitrates = ++ ARRAY_SIZE(ath9k_legacy_rates); ++ } + + if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes)) { + sc->sbands[IEEE80211_BAND_5GHZ].channels = ath9k_5ghz_chantable; +@@ -1886,8 +1888,9 @@ void ath_set_hw_capab(struct ath_softc * + + hw->rate_control_algorithm = "ath9k_rate_control"; + +- hw->wiphy->bands[IEEE80211_BAND_2GHZ] = +- &sc->sbands[IEEE80211_BAND_2GHZ]; ++ if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes)) ++ hw->wiphy->bands[IEEE80211_BAND_2GHZ] = ++ &sc->sbands[IEEE80211_BAND_2GHZ]; + if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes)) + hw->wiphy->bands[IEEE80211_BAND_5GHZ] = + &sc->sbands[IEEE80211_BAND_5GHZ]; +@@ -1926,9 +1929,12 @@ int ath_init_device(u16 devid, struct at + reg = &common->regulatory; + + if (ah->caps.hw_caps & ATH9K_HW_CAP_HT) { +- setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap); ++ if (test_bit(ATH9K_MODE_11G, ah->caps.wireless_modes)) ++ setup_ht_cap(sc, ++ &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap); + if (test_bit(ATH9K_MODE_11A, ah->caps.wireless_modes)) +- setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap); ++ setup_ht_cap(sc, ++ &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap); + } + + /* initialize tx/rx engine */ From 147800af355a7388117e168572489b3e64c51a33 Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 25 Nov 2009 22:52:59 +0000 Subject: [PATCH 235/288] [octeon] resync kernel configuration git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18538 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/octeon/config-default | 48 +++++++++++++++--------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/target/linux/octeon/config-default b/target/linux/octeon/config-default index 15ea51c6a..3751a75bd 100644 --- a/target/linux/octeon/config-default +++ b/target/linux/octeon/config-default @@ -1,9 +1,9 @@ # CONFIG_32BIT is not set -CONFIG_64BIT_PHYS_ADDR=y CONFIG_64BIT=y +CONFIG_64BIT_PHYS_ADDR=y # CONFIG_ALTERA_PCIE_CHDMA is not set -# CONFIG_ANDROID_BINDER_IPC is not set # CONFIG_ANDROID is not set +# CONFIG_ANDROID_BINDER_IPC is not set # CONFIG_ANDROID_LOGGER is not set # CONFIG_ANDROID_LOW_MEMORY_KILLER is not set # CONFIG_ANDROID_RAM_CONSOLE is not set @@ -30,22 +30,22 @@ CONFIG_BSD_PROCESS_ACCT_V3=y # CONFIG_CAVIUM_OCTEON_2ND_KERNEL is not set CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE=2 CONFIG_CAVIUM_OCTEON_HW_FIX_UNALIGNED=y +CONFIG_CAVIUM_OCTEON_LOCK_L2=y CONFIG_CAVIUM_OCTEON_LOCK_L2_EXCEPTION=y CONFIG_CAVIUM_OCTEON_LOCK_L2_INTERRUPT=y CONFIG_CAVIUM_OCTEON_LOCK_L2_LOW_LEVEL_INTERRUPT=y CONFIG_CAVIUM_OCTEON_LOCK_L2_MEMCPY=y CONFIG_CAVIUM_OCTEON_LOCK_L2_TLB=y -CONFIG_CAVIUM_OCTEON_LOCK_L2=y CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD=y # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set CONFIG_CAVIUM_OCTEON_SPECIFIC_OPTIONS=y -CONFIG_CEVT_R4K_LIB=y CONFIG_CEVT_R4K=y +CONFIG_CEVT_R4K_LIB=y # CONFIG_CGROUP_SCHED is not set CONFIG_CMDLINE="console=ttyS0,115200" # CONFIG_COMEDI is not set -CONFIG_COMPAT_BRK=y CONFIG_COMPAT=y +CONFIG_COMPAT_BRK=y CONFIG_CPU_BIG_ENDIAN=y CONFIG_CPU_CAVIUM_OCTEON=y CONFIG_CPU_HAS_PREFETCH=y @@ -83,8 +83,8 @@ CONFIG_DEBUG_INFO=y CONFIG_DEBUG_KERNEL=y # CONFIG_DEBUG_KOBJECT is not set # CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_LOCK_ALLOC is not set # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set # CONFIG_DEBUG_MUTEXES is not set # CONFIG_DEBUG_NOTIFIERS is not set # CONFIG_DEBUG_OBJECTS is not set @@ -92,8 +92,8 @@ CONFIG_DEBUG_KERNEL=y # CONFIG_DEBUG_SG is not set # CONFIG_DEBUG_SHIRQ is not set # CONFIG_DEBUG_SLAB is not set -CONFIG_DEBUG_SPINLOCK_SLEEP=y CONFIG_DEBUG_SPINLOCK=y +CONFIG_DEBUG_SPINLOCK_SLEEP=y # CONFIG_DEBUG_STACK_USAGE is not set # CONFIG_DEBUG_VM is not set # CONFIG_DEBUG_WRITECOUNT is not set @@ -116,8 +116,8 @@ CONFIG_FAIR_GROUP_SCHED=y # CONFIG_FLATMEM_MANUAL is not set CONFIG_FRAME_WARN=2048 # CONFIG_FW_LOADER is not set -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_FIND_LAST_BIT=y CONFIG_GENERIC_FIND_NEXT_BIT=y @@ -132,31 +132,31 @@ CONFIG_HAVE_ARCH_KGDB=y # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set CONFIG_HAVE_IDE=y CONFIG_HAVE_MEMORY_PRESENT=y -CONFIG_HAVE_MLOCKED_PAGE_BIT=y CONFIG_HAVE_MLOCK=y +CONFIG_HAVE_MLOCKED_PAGE_BIT=y CONFIG_HAVE_OPROFILE=y CONFIG_HAVE_SYSCALL_WRAPPERS=y # CONFIG_HECI is not set # CONFIG_HIGH_RES_TIMERS is not set CONFIG_HW_HAS_PCI=y -CONFIG_HW_RANDOM_OCTEON=y CONFIG_HW_RANDOM=y -# CONFIG_HZ_100 is not set +CONFIG_HW_RANDOM_OCTEON=y CONFIG_HZ=250 +# CONFIG_HZ_100 is not set CONFIG_HZ_250=y CONFIG_INITRAMFS_SOURCE="" -CONFIG_INOTIFY_USER=y CONFIG_INOTIFY=y -CONFIG_IRQ_CPU_OCTEON=y +CONFIG_INOTIFY_USER=y CONFIG_IRQ_CPU=y +CONFIG_IRQ_CPU_OCTEON=y CONFIG_IRQ_PER_CPU=y # CONFIG_ISDN is not set -# CONFIG_KALLSYMS_ALL is not set CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set CONFIG_KEXEC=y # CONFIG_KGDB is not set -CONFIG_LEGACY_PTY_COUNT=256 CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 # CONFIG_LEMOTE_FULONG is not set CONFIG_LOCK_KERNEL=y # CONFIG_LOCK_STAT is not set @@ -170,6 +170,7 @@ CONFIG_MAGIC_SYSRQ=y # CONFIG_ME4000 is not set # CONFIG_MEILHAUS is not set # CONFIG_MIKROTIK_RB532 is not set +CONFIG_MIPS=y CONFIG_MIPS32_COMPAT=y CONFIG_MIPS32_N32=y CONFIG_MIPS32_O32=y @@ -182,7 +183,6 @@ CONFIG_MIPS_MT_DISABLED=y # CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_MT_SMTC is not set # CONFIG_MIPS_SIM is not set -CONFIG_MIPS=y # CONFIG_MISC_DEVICES is not set # CONFIG_MTD_CFI_INTELEXT is not set # CONFIG_MTD_COMPLEX_MAPPINGS is not set @@ -207,20 +207,20 @@ CONFIG_PHYS_ADDR_T_64BIT=y # CONFIG_PNX8550_JBS is not set # CONFIG_PNX8550_STB810 is not set # CONFIG_POHMELFS is not set -CONFIG_POSIX_MQUEUE_SYSCTL=y CONFIG_POSIX_MQUEUE=y +CONFIG_POSIX_MQUEUE_SYSCTL=y # CONFIG_PROBE_INITRD_HEADER is not set CONFIG_PROC_PAGE_MONITOR=y # CONFIG_PROVE_LOCKING is not set # CONFIG_RCU_TORTURE_TEST is not set CONFIG_RELAY=y -# CONFIG_RT_GROUP_SCHED is not set # CONFIG_RTL8187SE is not set +# CONFIG_RT_GROUP_SCHED is not set # CONFIG_RT_MUTEX_TESTER is not set # CONFIG_RUNTIME_DEBUG is not set +# CONFIG_SCHEDSTATS is not set CONFIG_SCHED_DEBUG=y CONFIG_SCHED_OMIT_FRAME_POINTER=y -# CONFIG_SCHEDSTATS is not set # CONFIG_SCSI_DMA is not set CONFIG_SECCOMP=y # CONFIG_SERIAL_8250_EXTENDED is not set @@ -238,15 +238,16 @@ CONFIG_SECCOMP=y # CONFIG_SIBYTE_SWARM is not set # CONFIG_SLOW_WORK is not set CONFIG_SMP=y +CONFIG_SPARSEMEM=y CONFIG_SPARSEMEM_MANUAL=y CONFIG_SPARSEMEM_STATIC=y -CONFIG_SPARSEMEM=y -# CONFIG_STAGING_EXCLUDE_BUILD is not set CONFIG_STAGING=y +# CONFIG_STAGING_EXCLUDE_BUILD is not set CONFIG_STOP_MACHINE=y CONFIG_SWAP_IO_SPACE=y -CONFIG_SYSFS_DEPRECATED_V2=y CONFIG_SYSFS_DEPRECATED=y +CONFIG_SYSFS_DEPRECATED_V2=y +CONFIG_SYSVIPC_COMPAT=y CONFIG_SYS_HAS_CPU_CAVIUM_OCTEON=y CONFIG_SYS_HAS_EARLY_PRINTK=y CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y @@ -254,14 +255,13 @@ CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y CONFIG_SYS_SUPPORTS_HIGHMEM=y CONFIG_SYS_SUPPORTS_SMP=y -CONFIG_SYSVIPC_COMPAT=y # CONFIG_TC35815 is not set # CONFIG_TIMER_STATS is not set CONFIG_TRACING_SUPPORT=y CONFIG_UNEVICTABLE_LRU=y CONFIG_USB_SUPPORT=y -CONFIG_USE_GENERIC_SMP_HELPERS=y CONFIG_USER_SCHED=y +CONFIG_USE_GENERIC_SMP_HELPERS=y # CONFIG_VLAN_8021Q is not set CONFIG_VM_EVENT_COUNTERS=y CONFIG_WEAK_ORDERING=y From bd245df66fd2d2474807fcfb636119dd782f8da4 Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 25 Nov 2009 22:53:17 +0000 Subject: [PATCH 236/288] [kernel] refresh 2.6.25 patches git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18539 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic-2.6/patches-2.6.25/150-netfilter_imq.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/generic-2.6/patches-2.6.25/150-netfilter_imq.patch b/target/linux/generic-2.6/patches-2.6.25/150-netfilter_imq.patch index d21a02132..5fcef0a7d 100644 --- a/target/linux/generic-2.6/patches-2.6.25/150-netfilter_imq.patch +++ b/target/linux/generic-2.6/patches-2.6.25/150-netfilter_imq.patch @@ -794,7 +794,7 @@ depends on IP_NF_FILTER --- a/net/ipv4/netfilter/Makefile +++ b/net/ipv4/netfilter/Makefile -@@ -52,6 +52,7 @@ obj-$(CONFIG_IP_NF_MATCH_SET) += ipt_set +@@ -51,6 +51,7 @@ obj-$(CONFIG_IP_NF_MATCH_TTL) += ipt_ttl obj-$(CONFIG_IP_NF_TARGET_CLUSTERIP) += ipt_CLUSTERIP.o obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o obj-$(CONFIG_IP_NF_TARGET_LOG) += ipt_LOG.o From 288fe380457a72eaf1a6b6201326e5a51b82976c Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 25 Nov 2009 23:43:48 +0000 Subject: [PATCH 237/288] [ep93xx] add support for the Simplemachines Sim.One board git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18540 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ep93xx/Makefile | 21 + target/linux/ep93xx/base-files/etc/inittab | 5 + target/linux/ep93xx/config-2.6.30 | 239 + target/linux/ep93xx/image/Makefile | 35 + .../patches-2.6.30/001-ep93xx-regs.patch | 479 ++ .../002-lcd-linux-hd44780.patch | 4342 +++++++++++++++++ .../patches-2.6.30/003-ep93xx-i2c.patch | 225 + .../patches-2.6.30/004-simone-rtc.patch | 78 + .../patches-2.6.30/005-ep93xx-dma.patch | 3622 ++++++++++++++ .../006-ep93xx-touchscreen.patch | 1319 +++++ .../patches-2.6.30/007-ep93xx-eth.patch | 405 ++ .../patches-2.6.30/008-ep93xx-spi.patch | 714 +++ .../ep93xx/patches-2.6.30/009-ep93xx-fb.patch | 3565 ++++++++++++++ .../patches-2.6.30/010-ep93xx-snd-ac97.patch | 3808 +++++++++++++++ .../patches-2.6.30/011-simone-board-def.patch | 1658 +++++++ .../patches-2.6.30/012-ep93xx-cpuinfo.patch | 32 + 16 files changed, 20547 insertions(+) create mode 100644 target/linux/ep93xx/Makefile create mode 100644 target/linux/ep93xx/base-files/etc/inittab create mode 100644 target/linux/ep93xx/config-2.6.30 create mode 100644 target/linux/ep93xx/image/Makefile create mode 100644 target/linux/ep93xx/patches-2.6.30/001-ep93xx-regs.patch create mode 100644 target/linux/ep93xx/patches-2.6.30/002-lcd-linux-hd44780.patch create mode 100644 target/linux/ep93xx/patches-2.6.30/003-ep93xx-i2c.patch create mode 100644 target/linux/ep93xx/patches-2.6.30/004-simone-rtc.patch create mode 100644 target/linux/ep93xx/patches-2.6.30/005-ep93xx-dma.patch create mode 100644 target/linux/ep93xx/patches-2.6.30/006-ep93xx-touchscreen.patch create mode 100644 target/linux/ep93xx/patches-2.6.30/007-ep93xx-eth.patch create mode 100644 target/linux/ep93xx/patches-2.6.30/008-ep93xx-spi.patch create mode 100644 target/linux/ep93xx/patches-2.6.30/009-ep93xx-fb.patch create mode 100644 target/linux/ep93xx/patches-2.6.30/010-ep93xx-snd-ac97.patch create mode 100644 target/linux/ep93xx/patches-2.6.30/011-simone-board-def.patch create mode 100644 target/linux/ep93xx/patches-2.6.30/012-ep93xx-cpuinfo.patch diff --git a/target/linux/ep93xx/Makefile b/target/linux/ep93xx/Makefile new file mode 100644 index 000000000..a43855ed1 --- /dev/null +++ b/target/linux/ep93xx/Makefile @@ -0,0 +1,21 @@ +# +# Copyright (C) 2009 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +ARCH:=arm +BOARD:=ep93xx +BOARDNAME:=Cirrus Logic EP93xx SoC +FEATURES:=squashfs jffs2 ext2 tgz +CFLAGS:=-Os -pipe -march=armv4t -funit-at-a-time + +LINUX_VERSION:=2.6.30.9 + +include $(INCLUDE_DIR)/target.mk + +KERNELNAME:="uImage" + +$(eval $(call BuildTarget)) diff --git a/target/linux/ep93xx/base-files/etc/inittab b/target/linux/ep93xx/base-files/etc/inittab new file mode 100644 index 000000000..ea83e79cc --- /dev/null +++ b/target/linux/ep93xx/base-files/etc/inittab @@ -0,0 +1,5 @@ +::sysinit:/etc/init.d/rcS S boot +::shutdown:/etc/init.d/rcS K stop +tts/0::askfirst:/bin/ash --login +ttyAM0::askfirst:/bin/ash --login +tty1::askfirst:/bin/ash --login diff --git a/target/linux/ep93xx/config-2.6.30 b/target/linux/ep93xx/config-2.6.30 new file mode 100644 index 000000000..3e3e205c4 --- /dev/null +++ b/target/linux/ep93xx/config-2.6.30 @@ -0,0 +1,239 @@ +CONFIG_AEABI=y +CONFIG_ALIGNMENT_TRAP=y +CONFIG_ARCH_EP93XX=y +CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y +# CONFIG_ARCH_HAS_ILOG2_U32 is not set +# CONFIG_ARCH_HAS_ILOG2_U64 is not set +CONFIG_ARCH_REQUIRE_GPIOLIB=y +# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set +# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set +# CONFIG_ARCH_SUPPORTS_MSI is not set +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARM=y +CONFIG_ARM_AMBA=y +CONFIG_ARM_THUMB=y +CONFIG_ARM_VIC=y +# CONFIG_ARPD is not set +# CONFIG_BINARY_PRINTF is not set +CONFIG_BITREVERSE=y +# CONFIG_BLK_DEV_INITRD is not set +# CONFIG_BSD_PROCESS_ACCT is not set +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_CFG80211=y +# CONFIG_CFG80211_REG_DEBUG is not set +CONFIG_CMDLINE="console=ttyAM0,57600 init=/etc/preinit" +CONFIG_COMMON_CLKDEV=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_CPU_32=y +CONFIG_CPU_32v4T=y +CONFIG_CPU_ABRT_EV4T=y +CONFIG_CPU_ARM920T=y +CONFIG_CPU_CACHE_V4WT=y +CONFIG_CPU_CACHE_VIVT=y +CONFIG_CPU_COPY_V4WB=y +CONFIG_CPU_CP15=y +CONFIG_CPU_CP15_MMU=y +# CONFIG_CPU_DCACHE_WRITETHROUGH is not set +# CONFIG_CPU_ICACHE_DISABLE is not set +CONFIG_CPU_PABRT_NOIFAR=y +CONFIG_CPU_TLB_V4WBI=y +CONFIG_CRC7=y +CONFIG_CRC_ITU_T=y +CONFIG_CRUNCH=y +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_AES=y +CONFIG_CRYPTO_ARC4=y +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_DES=y +CONFIG_CRYPTO_ECB=m +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +CONFIG_CRYPTO_MD5=y +CONFIG_CRYPTO_MICHAEL_MIC=y +CONFIG_CRYPTO_PCBC=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_SHA1=y +CONFIG_CRYPTO_WORKQUEUE=y +CONFIG_DEBUG_USER=y +CONFIG_DECOMPRESS_LZMA=y +CONFIG_DEFAULT_TCP_CONG="cubic" +# CONFIG_DM9000 is not set +CONFIG_DNOTIFY=y +CONFIG_DUMMY_CONSOLE=y +CONFIG_ELF_CORE=y +# CONFIG_ENABLE_WARN_DEPRECATED is not set +CONFIG_EP93XX_EARLY_UART1=y +# CONFIG_EP93XX_EARLY_UART2 is not set +# CONFIG_EP93XX_EARLY_UART3 is not set +CONFIG_EP93XX_ETH=y +CONFIG_EP93XX_WATCHDOG=y +CONFIG_FB=y +# CONFIG_FB_ARMCLCD is not set +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB_EP93XX=y +# CONFIG_FB_EP93XX_MONO is not set +# CONFIG_FIRMWARE_EDID is not set +CONFIG_FONTS=y +# CONFIG_FONT_10x18 is not set +# CONFIG_FONT_6x11 is not set +# CONFIG_FONT_7x14 is not set +CONFIG_FONT_8x16=y +CONFIG_FONT_8x8=y +# CONFIG_FONT_ACORN_8x8 is not set +# CONFIG_FONT_MINI_4x6 is not set +# CONFIG_FONT_PEARL_8x8 is not set +# CONFIG_FONT_SUN12x22 is not set +# CONFIG_FONT_SUN8x16 is not set +# CONFIG_FPE_FASTFPE is not set +CONFIG_FPE_NWFPE=y +CONFIG_FPE_NWFPE_XP=y +CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +CONFIG_FRAME_POINTER=y +# CONFIG_FW_LOADER is not set +# CONFIG_GENERIC_CLOCKEVENTS is not set +CONFIG_GENERIC_FIND_LAST_BIT=y +CONFIG_GENERIC_GPIO=y +CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y +# CONFIG_GENERIC_TIME is not set +CONFIG_GPIOLIB=y +# CONFIG_HAMRADIO is not set +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +CONFIG_HAVE_AOUT=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_IDE=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_HAVE_MLOCK=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HW_CONSOLE=y +# CONFIG_HW_RANDOM is not set +CONFIG_I2C=y +CONFIG_I2C_ALGOBIT=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_EP93XX=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_INOTIFY=y +CONFIG_INOTIFY_USER=y +CONFIG_INPUT=y +# CONFIG_INPUT_MISC is not set +CONFIG_INPUT_TOUCHSCREEN=y +# CONFIG_IP_ADVANCED_ROUTER is not set +# CONFIG_IP_MULTICAST is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_BOOTP=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_IP_PNP_RARP is not set +# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set +# CONFIG_JFFS2_SUMMARY is not set +CONFIG_LCD_HD44780=m +CONFIG_LCD_LINUX=m +CONFIG_LIBCRC32C=y +CONFIG_LOCALVERSION_AUTO=y +CONFIG_LOCK_KERNEL=y +CONFIG_LOGO=y +CONFIG_LOGO_LINUX_CLUT224=y +CONFIG_LOGO_LINUX_MONO=y +CONFIG_LOGO_LINUX_VGA16=y +CONFIG_LOG_BUF_SHIFT=16 +CONFIG_MAC80211=m +# CONFIG_MAC80211_DEBUGFS is not set +# CONFIG_MAC80211_DEBUG_MENU is not set +# CONFIG_MAC80211_HWSIM is not set +# CONFIG_MAC80211_LEDS is not set +# CONFIG_MAC80211_MESH is not set +CONFIG_MAC80211_RC_DEFAULT="pid" +# CONFIG_MAC80211_RC_DEFAULT_MINSTREL is not set +CONFIG_MAC80211_RC_DEFAULT_PID=y +CONFIG_MAC80211_RC_MINSTREL=y +CONFIG_MAC80211_RC_PID=y +# CONFIG_MACH_ADSSPHERE is not set +# CONFIG_MACH_EDB9302 is not set +# CONFIG_MACH_EDB9302A is not set +# CONFIG_MACH_EDB9307 is not set +# CONFIG_MACH_EDB9307A is not set +# CONFIG_MACH_EDB9312 is not set +# CONFIG_MACH_EDB9315 is not set +# CONFIG_MACH_EDB9315A is not set +# CONFIG_MACH_GESBC9312 is not set +# CONFIG_MACH_MICRO9 is not set +# CONFIG_MACH_MICRO9H is not set +# CONFIG_MACH_MICRO9L is not set +# CONFIG_MACH_MICRO9M is not set +CONFIG_MACH_SIM_ONE=y +# CONFIG_MACH_TS72XX is not set +# CONFIG_MFD_T7L66XB is not set +# CONFIG_MISC_DEVICES is not set +CONFIG_MMC=y +CONFIG_MMC_BLOCK=y +CONFIG_MMC_SPI=y +CONFIG_MODULE_FORCE_UNLOAD=y +CONFIG_MTD_CFI_ADV_OPTIONS=y +# CONFIG_MTD_CFI_GEOMETRY is not set +CONFIG_MTD_CFI_STAA=y +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +CONFIG_MTD_PHYSMAP=y +CONFIG_MTD_RAM=y +# CONFIG_NETDEV_1000 is not set +# CONFIG_NETFILTER is not set +CONFIG_NET_KEY=y +# CONFIG_NEW_LEDS is not set +CONFIG_NLS=y +# CONFIG_NO_IOPORT is not set +CONFIG_OABI_COMPAT=y +# CONFIG_OUTER_CACHE is not set +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PAGE_OFFSET=0xC0000000 +# CONFIG_PCI_SYSCALL is not set +CONFIG_PREEMPT=y +# CONFIG_ROMFS_BACKED_BY_BLOCK is not set +# CONFIG_ROMFS_BACKED_BY_BOTH is not set +# CONFIG_ROMFS_BACKED_BY_MTD is not set +# CONFIG_SCSI_DMA is not set +# CONFIG_SDIO_UART is not set +# CONFIG_SERIAL_8250 is not set +CONFIG_SERIAL_AMBA_PL010=y +CONFIG_SERIAL_AMBA_PL010_CONSOLE=y +# CONFIG_SERIAL_AMBA_PL011 is not set +# CONFIG_SLOW_WORK is not set +CONFIG_SPI=y +CONFIG_SPI_BITBANG=y +CONFIG_SPI_EP93XX=y +# CONFIG_SPI_GPIO is not set +CONFIG_SPI_MASTER=y +# CONFIG_SPI_SPIDEV is not set +CONFIG_SPLIT_PTLOCK_CPUS=4096 +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +# CONFIG_TCP_CONG_ADVANCED is not set +CONFIG_TCP_CONG_CUBIC=y +CONFIG_TOUCHSCREEN_EP93XX=y +CONFIG_TRACING_SUPPORT=y +CONFIG_UID16=y +# CONFIG_USB_ARCH_HAS_EHCI is not set +CONFIG_USB_SUPPORT=y +CONFIG_VECTORS_BASE=0xffff0000 +# CONFIG_VGA_CONSOLE is not set +CONFIG_VIDEO_OUTPUT_CONTROL=y +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +# CONFIG_VT_HW_CONSOLE_BINDING is not set +CONFIG_ZBOOT_ROM_BSS=0x0 +CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/ep93xx/image/Makefile b/target/linux/ep93xx/image/Makefile new file mode 100644 index 000000000..129db3f38 --- /dev/null +++ b/target/linux/ep93xx/image/Makefile @@ -0,0 +1,35 @@ +# +# Copyright (C) 2009 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + +define Image/Prepare + cp $(LINUX_DIR)/arch/arm/boot/uImage $(KDIR)/uImage +endef + +define Image/BuildKernel +endef + +define Image/Build/jffs2-64k + dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(1).img bs=64k conv=sync +endef + +define Image/Build/jffs2-128k + dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(1).img bs=128k conv=sync +endef + +define Image/Build/squashfs + $(call prepare_generic_squashfs,$(KDIR)/root.squashfs) + dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(1).img bs=128k conv=sync +endef + +define Image/Build + cp $(KDIR)/uImage $(BIN_DIR)/uImage-$(board) + $(call Image/Build/$(1),$(1)) +endef + +$(eval $(call BuildImage)) diff --git a/target/linux/ep93xx/patches-2.6.30/001-ep93xx-regs.patch b/target/linux/ep93xx/patches-2.6.30/001-ep93xx-regs.patch new file mode 100644 index 000000000..9b3128bfc --- /dev/null +++ b/target/linux/ep93xx/patches-2.6.30/001-ep93xx-regs.patch @@ -0,0 +1,479 @@ +--- a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h ++++ b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h +@@ -57,6 +57,33 @@ + #define EP93XX_APB_SIZE 0x00200000 + + ++/* 8081_0000 - 8081_ffff: Timers */ ++#define TIMERS_OFFSET 0x010000 ++#define TIMERS_BASE (EP93XX_APB_VIRT_BASE|TIMERS_OFFSET) ++ ++#define TIMER1LOAD (TIMERS_BASE+0x00) ++#define TIMER1VALUE (TIMERS_BASE+0x04) ++#define TIMER1CONTROL (TIMERS_BASE+0x08) ++#define TIMER1CLEAR (TIMERS_BASE+0x0C) ++#define TIMER1TEST (TIMERS_BASE+0x10) ++ ++#define TIMER2LOAD (TIMERS_BASE+0x20) ++#define TIMER2VALUE (TIMERS_BASE+0x24) ++#define TIMER2CONTROL (TIMERS_BASE+0x28) ++#define TIMER2CLEAR (TIMERS_BASE+0x2C) ++#define TIMER2TEST (TIMERS_BASE+0x30) ++ ++#define TIMER3LOAD (TIMERS_BASE+0x80) ++#define TIMER3VALUE (TIMERS_BASE+0x84) ++#define TIMER3CONTROL (TIMERS_BASE+0x88) ++#define TIMER3CLEAR (TIMERS_BASE+0x8C) ++#define TIMER3TEST (TIMERS_BASE+0x90) ++ ++#define TTIMERBZCONT (TIMERS_BASE+0x40) ++ ++#define TIMER4VALUELOW (TIMERS_BASE+0x60) ++#define TIMER4VALUEHIGH (TIMERS_BASE+0x64) ++ + /* AHB peripherals */ + #define EP93XX_DMA_BASE ((void __iomem *) \ + (EP93XX_AHB_VIRT_BASE + 0x00000000)) +@@ -105,6 +132,8 @@ + #define EP93XX_I2S_BASE (EP93XX_APB_VIRT_BASE + 0x00020000) + + #define EP93XX_SECURITY_BASE (EP93XX_APB_VIRT_BASE + 0x00030000) ++#define EP93XX_SECURITY_REG(x) (EP93XX_SECURITY_BASE + (x)) ++#define EP93XX_SECURITY_UNIQID EP93XX_SECURITY_REG(0x2440) + + #define EP93XX_GPIO_BASE (EP93XX_APB_VIRT_BASE + 0x00040000) + #define EP93XX_GPIO_REG(x) (EP93XX_GPIO_BASE + (x)) +@@ -127,6 +156,7 @@ + #define EP93XX_AAC_BASE (EP93XX_APB_VIRT_BASE + 0x00080000) + + #define EP93XX_SPI_BASE (EP93XX_APB_VIRT_BASE + 0x000a0000) ++#define EP93XX_SPI_BASE_PHYS (EP93XX_APB_PHYS_BASE + 0x000a0000) + + #define EP93XX_IRDA_BASE (EP93XX_APB_VIRT_BASE + 0x000b0000) + +@@ -164,8 +194,425 @@ + #define EP93XX_SYSCON_DEVICE_CONFIG_U2EN (1<<20) + #define EP93XX_SYSCON_DEVICE_CONFIG_U1EN (1<<18) + #define EP93XX_SYSCON_SWLOCK EP93XX_SYSCON_REG(0xc0) ++#define EP93XX_SYSCON_CHIP_ID EP93XX_SYSCON_REG(0x94) ++#define EP93XX_SYSCON_BMAR EP93XX_SYSCON_REG(0x54) ++#define EP93XX_SYSCON_I2SDIV EP93XX_SYSCON_REG(0x8C) ++#define EP93XX_SYSCON_DEVCFG_CONFIG_Mong 0x02000000 ++#define EP93XX_SYSCON_DEVCFG_CONFIG_Tong 0x04000000 ++#define EP93XX_SYSCON_DEVCFG_CONFIG_I2SONSSP 0x00000080 ++#define EP93XX_SYSCON_DEVCFG_CONFIG_I2SONAC97 0x00000040 ++#define EP93XX_SYSCON_DEVCFG_RasOnP3 0x00000010 ++#define EP93XX_SYSCON_DEVCFG_A1onG 0x00200000 ++#define EP93XX_SYSCON_DEVCFG_A2onG 0x00400000 ++#define EP93XX_SYSCON_DEVCFG_U1EN 0x00040000 ++#define EP93XX_SYSCON_DEVCFG_TIN 0x00020000 + + #define EP93XX_WATCHDOG_BASE (EP93XX_APB_VIRT_BASE + 0x00140000) + + ++#define SYSCON_PWRCNT (EP93XX_SYSCON_BASE+0x0004) ++#define SYSCON_VIDDIV (EP93XX_SYSCON_BASE+0x0084) ++#define SYSCON_MIRDIV (EP93XX_SYSCON_BASE+0x0088) ++#define SYSCON_KTDIV (EP93XX_SYSCON_BASE+0x0090) ++#define SYSCON_KTDIV_TSEN 0x80000000 ++//----------------------------------------------------------------------------- ++// SYSCON_CLKSET1 ++//----------------------------------------------------------------------------- ++#define SYSCON_CLKSET1_PLL1_X2IPD_SHIFT 0 ++#define SYSCON_CLKSET1_PLL1_X2IPD_MASK 0x0000001f ++#define SYSCON_CLKSET1_PLL1_X2FBD2_SHIFT 5 ++#define SYSCON_CLKSET1_PLL1_X2FBD2_MASK 0x000007e0 ++#define SYSCON_CLKSET1_PLL1_X1FBD1_SHIFT 11 ++#define SYSCON_CLKSET1_PLL1_X1FBD1_MASK 0x0000f800 ++#define SYSCON_CLKSET1_PLL1_PS_SHIFT 16 ++#define SYSCON_CLKSET1_PLL1_PS_MASK 0x00030000 ++#define SYSCON_CLKSET1_PCLKDIV_SHIFT 18 ++#define SYSCON_CLKSET1_PCLKDIV_MASK 0x000c0000 ++#define SYSCON_CLKSET1_HCLKDIV_SHIFT 20 ++#define SYSCON_CLKSET1_HCLKDIV_MASK 0x00700000 ++#define SYSCON_CLKSET1_nBYP1 0x00800000 ++#define SYSCON_CLKSET1_SMCROM 0x01000000 ++#define SYSCON_CLKSET1_FCLKDIV_SHIFT 25 ++#define SYSCON_CLKSET1_FCLKDIV_MASK 0x0e000000 ++ ++#define SYSCON_CLKSET1_HSEL 0x00000001 ++#define SYSCON_CLKSET1_PLL1_EXCLKSEL 0x00000002 ++ ++#define SYSCON_CLKSET1_PLL1_P_MASK 0x0000007C ++#define SYSCON_CLKSET1_PLL1_P_SHIFT 2 ++ ++#define SYSCON_CLKSET1_PLL1_M1_MASK 0x00000780 ++#define SYSCON_CLKSET1_PLL1_M1_SHIFT 7 ++#define SYSCON_CLKSET1_PLL1_M2_MASK 0x0000F800 ++#define SYSCON_CLKSET1_PLL1_M2_SHIFT 11 ++#define SYSCON_CLKSET1_PLL1_PS_MASK 0x00030000 ++#define SYSCON_CLKSET1_PLL1_PS_SHIFT 16 ++#define SYSCON_CLKSET1_PCLK_DIV_MASK 0x000C0000 ++#define SYSCON_CLKSET1_PCLK_DIV_SHIFT 18 ++#define SYSCON_CLKSET1_HCLK_DIV_MASK 0x00700000 ++#define SYSCON_CLKSET1_HCLK_DIV_SHIFT 20 ++#define SYSCON_CLKSET1_SMCROM 0x01000000 ++#define SYSCON_CLKSET1_FCLK_DIV_MASK 0x0E000000 ++#define SYSCON_CLKSET1_FCLK_DIV_SHIFT 25 ++ ++#define SYSCON_CLKSET2_PLL2_EN 0x00000001 ++#define SYSCON_CLKSET2_PLL2EXCLKSEL 0x00000002 ++#define SYSCON_CLKSET2_PLL2_P_MASK 0x0000007C ++#define SYSCON_CLKSET2_PLL2_P_SHIFT 2 ++#define SYSCON_CLKSET2_PLL2_M2_MASK 0x00000F80 ++#define SYSCON_CLKSET2_PLL2_M2_SHIFT 7 ++#define SYSCON_CLKSET2_PLL2_M1_MASK 0x0001F000 ++#define SYSCON_CLKSET2_PLL2_M1 12 ++#define SYSCON_CLKSET2_PLL2_PS_MASK 0x000C0000 ++#define SYSCON_CLKSET2_PLL2_PS_SHIFT 18 ++#define SYSCON_CLKSET2_USBDIV_MASK 0xF0000000 ++#define SYSCON_CLKSET2_USBDIV_SHIFT 28 ++ ++//----------------------------------------------------------------------------- ++// I2SDIV Register Defines ++//----------------------------------------------------------------------------- ++#define SYSCON_I2SDIV_MDIV_MASK 0x0000007f ++#define SYSCON_I2SDIV_MDIV_SHIFT 0 ++#define SYSCON_I2SDIV_PDIV_MASK 0x00000300 ++#define SYSCON_I2SDIV_PDIV_SHIFT 8 ++#define SYSCON_I2SDIV_PSEL 0x00002000 ++#define SYSCON_I2SDIV_ESEL 0x00004000 ++#define SYSCON_I2SDIV_MENA 0x00008000 ++#define SYSCON_I2SDIV_SDIV 0x00010000 ++#define SYSCON_I2SDIV_LRDIV_MASK 0x00060000 ++#define SYSCON_I2SDIV_LRDIV_SHIFT 17 ++#define SYSCON_I2SDIV_SPOL 0x00080000 ++#define SYSCON_I2SDIV_DROP 0x00100000 ++#define SYSCON_I2SDIV_ORIDE 0x20000000 ++#define SYSCON_I2SDIV_SLAVE 0x40000000 ++#define SYSCON_I2SDIV_SENA 0x80000000 ++ ++#define SYSCON_I2SDIV_PDIV_OFF 0x00000000 ++#define SYSCON_I2SDIV_PDIV_2 0x00000100 ++#define SYSCON_I2SDIV_PDIV_25 0x00000200 ++#define SYSCON_I2SDIV_PDIV_3 0x00000300 ++ ++#define SYSCON_I2SDIV_LRDIV_32 0x00000000 ++#define SYSCON_I2SDIV_LRDIV_64 0x00020000 ++#define SYSCON_I2SDIV_LRDIV_128 0x00040000 ++ ++//----------------------------------------------------------------------------- ++// VIDDIV Register Defines ++//----------------------------------------------------------------------------- ++#define SYSCON_VIDDIV_VDIV_MASK 0x0000007f ++#define SYSCON_VIDDIV_VDIV_SHIFT 0 ++#define SYSCON_VIDDIV_PDIV_MASK 0x00000300 ++#define SYSCON_VIDDIV_PDIV_SHIFT 8 ++#define SYSCON_VIDDIV_PSEL 0x00002000 ++#define SYSCON_VIDDIV_ESEL 0x00004000 ++#define SYSCON_VIDDIV_VENA 0x00008000 ++ ++//----------------------------------------------------------------------------- ++// MIRDIV Register Defines ++//----------------------------------------------------------------------------- ++#define SYSCON_MIRDIV_MDIV_MASK 0x0000003f ++#define SYSCON_MIRDIV_MDIV_SHIFT 0 ++#define SYSCON_MIRDIV_PDIV_MASK 0x00000300 ++#define SYSCON_MIRDIV_PDIV_SHIFT 8 ++#define SYSCON_MIRDIV_PSEL 0x00002000 ++#define SYSCON_MIRDIV_ESEL 0x00004000 ++#define SYSCON_MIRDIV_MENA 0x00008000 ++ ++/* 8082_0000 - 8082_ffff: I2S */ ++#define I2S_OFFSET 0x020000 ++#define I2S_BASE (EP93XX_APB_VIRT_BASE|I2S_OFFSET) ++#define I2S_PHYS_BASE (EP93XX_APB_PHYS_BASE + I2S_OFFSET) ++ ++ ++ ++#define I2STxClkCfg (I2S_BASE+0x00) /* 8082.0000 R/W Transmitter clock config register */ ++#define I2SRxClkCfg (I2S_BASE+0x04) /* 8082.0004 R/W Receiver clock config register */ ++#define I2SGlSts (I2S_BASE+0x08) /* 8082.0008 R/W SAI Global Status register. */ ++#define I2SGlCtrl (I2S_BASE+0x0C) /* 8082.000C R/W SAI Global Control register */ ++ ++#define I2STX0Lft (I2S_BASE+0x10) /* 8082.0010 R/W Left TX data reg for channel 0 */ ++#define I2STX0Rt (I2S_BASE+0x14) /* 8082.0014 R/W Right TX data reg for channel 0 */ ++#define I2STX1Lft (I2S_BASE+0x18) /* 8082.0018 R/W Left TX data reg for channel 1 */ ++#define I2STX1Rt (I2S_BASE+0x1C) /* 8082.001C R/W Right TX data reg for channel 1 */ ++#define I2STX2Lft (I2S_BASE+0x20) /* 8082.0020 R/W Left TX data reg for channel 2 */ ++#define I2STX2Rt (I2S_BASE+0x24) /* 8082.0024 R/W Right TX data reg for channel 2 */ ++ ++#define I2STXLinCtrlData (I2S_BASE+0x28) /* 8082.0028 R/W TX Line Control data register */ ++#define I2STXCtrl (I2S_BASE+0x2C) /* 8082.002C R/W TX Control register */ ++#define I2STXWrdLen (I2S_BASE+0x30) /* 8082.0030 R/W TX Word Length */ ++#define I2STX0En (I2S_BASE+0x34) /* 8082.0034 R/W TX0 Channel Enable */ ++#define I2STX1En (I2S_BASE+0x38) /* 8082.0038 R/W TX1 Channel Enable */ ++#define I2STX2En (I2S_BASE+0x3C) /* 8082.003C R/W TX2 Channel Enable */ ++ ++#define I2SRX0Lft (I2S_BASE+0x40) /* 8082.0040 R Left RX data reg for channel 0 */ ++#define I2SRX0Rt (I2S_BASE+0x44) /* 8082.0044 R Right RX data reg for channel 0 */ ++#define I2SRX1Lft (I2S_BASE+0x48) /* 8082.0048 R Left RX data reg for channel 1 */ ++#define I2SRX1Rt (I2S_BASE+0x4C) /* 8082.004c R Right RX data reg for channel 1 */ ++#define I2SRX2Lft (I2S_BASE+0x50) /* 8082.0050 R Left RX data reg for channel 2 */ ++#define I2SRX2Rt (I2S_BASE+0x54) /* 8082.0054 R Right RX data reg for channel 2 */ ++ ++#define I2SRXLinCtrlData (I2S_BASE+0x58) /* 8082.0058 R/W RX Line Control data register */ ++#define I2SRXCtrl (I2S_BASE+0x5C) /* 8082.005C R/W RX Control register */ ++#define I2SRXWrdLen (I2S_BASE+0x60) /* 8082.0060 R/W RX Word Length */ ++#define I2SRX0En (I2S_BASE+0x64) /* 8082.0064 R/W RX0 Channel Enable */ ++#define I2SRX1En (I2S_BASE+0x68) /* 8082.0068 R/W RX1 Channel Enable */ ++#define I2SRX2En (I2S_BASE+0x6C) /* 8082.006C R/W RX2 Channel Enable */ ++ ++/* 8084_0000 - 8084_ffff: GPIO */ ++#define GPIO_OFFSET 0x040000 ++#define GPIO_BASE (EP93XX_APB_VIRT_BASE|GPIO_OFFSET) ++#define GPIO_PADR (GPIO_BASE+0x00) ++#define GPIO_PBDR (GPIO_BASE+0x04) ++#define GPIO_PCDR (GPIO_BASE+0x08) ++#define GPIO_PDDR (GPIO_BASE+0x0C) ++#define GPIO_PADDR (GPIO_BASE+0x10) ++#define GPIO_PBDDR (GPIO_BASE+0x14) ++#define GPIO_PCDDR (GPIO_BASE+0x18) ++#define GPIO_PDDDR (GPIO_BASE+0x1C) ++#define GPIO_PEDR (GPIO_BASE+0x20) ++#define GPIO_PEDDR (GPIO_BASE+0x24) ++// #define 0x8084.0028 Reserved ++// #define 0x8084.002C Reserved ++#define GPIO_PFDR (GPIO_BASE+0x30) ++#define GPIO_PFDDR (GPIO_BASE+0x34) ++#define GPIO_PGDR (GPIO_BASE+0x38) ++#define GPIO_PGDDR (GPIO_BASE+0x3C) ++#define GPIO_PHDR (GPIO_BASE+0x40) ++#define GPIO_PHDDR (GPIO_BASE+0x44) ++// #define 0x8084.0048 RAZ RAZ ++#define GPIO_FINTTYPE1 (GPIO_BASE+0x4C) ++#define GPIO_FINTTYPE2 (GPIO_BASE+0x50) ++#define GPIO_FEOI (GPIO_BASE+0x54) /* WRITE ONLY - READ UNDEFINED */ ++#define GPIO_FINTEN (GPIO_BASE+0x58) ++#define GPIO_INTSTATUSF (GPIO_BASE+0x5C) ++#define GPIO_RAWINTSTASUSF (GPIO_BASE+0x60) ++#define GPIO_FDB (GPIO_BASE+0x64) ++#define GPIO_PAPINDR (GPIO_BASE+0x68) ++#define GPIO_PBPINDR (GPIO_BASE+0x6C) ++#define GPIO_PCPINDR (GPIO_BASE+0x70) ++#define GPIO_PDPINDR (GPIO_BASE+0x74) ++#define GPIO_PEPINDR (GPIO_BASE+0x78) ++#define GPIO_PFPINDR (GPIO_BASE+0x7C) ++#define GPIO_PGPINDR (GPIO_BASE+0x80) ++#define GPIO_PHPINDR (GPIO_BASE+0x84) ++#define GPIO_AINTTYPE1 (GPIO_BASE+0x90) ++#define GPIO_AINTTYPE2 (GPIO_BASE+0x94) ++#define GPIO_AEOI (GPIO_BASE+0x98) /* WRITE ONLY - READ UNDEFINED */ ++#define GPIO_AINTEN (GPIO_BASE+0x9C) ++#define GPIO_INTSTATUSA (GPIO_BASE+0xA0) ++#define GPIO_RAWINTSTSTISA (GPIO_BASE+0xA4) ++#define GPIO_ADB (GPIO_BASE+0xA8) ++#define GPIO_BINTTYPE1 (GPIO_BASE+0xAC) ++#define GPIO_BINTTYPE2 (GPIO_BASE+0xB0) ++#define GPIO_BEOI (GPIO_BASE+0xB4) /* WRITE ONLY - READ UNDEFINED */ ++#define GPIO_BINTEN (GPIO_BASE+0xB8) ++#define GPIO_INTSTATUSB (GPIO_BASE+0xBC) ++#define GPIO_RAWINTSTSTISB (GPIO_BASE+0xC0) ++#define GPIO_BDB (GPIO_BASE+0xC4) ++#define GPIO_EEDRIVE (GPIO_BASE+0xC8) ++//#define Reserved (GPIO_BASE+0xCC) ++#define GPIO_TCR (GPIO_BASE+0xD0) /* Test Registers */ ++#define GPIO_TISRA (GPIO_BASE+0xD4) /* Test Registers */ ++#define GPIO_TISRB (GPIO_BASE+0xD8) /* Test Registers */ ++#define GPIO_TISRC (GPIO_BASE+0xDC) /* Test Registers */ ++#define GPIO_TISRD (GPIO_BASE+0xE0) /* Test Registers */ ++#define GPIO_TISRE (GPIO_BASE+0xE4) /* Test Registers */ ++#define GPIO_TISRF (GPIO_BASE+0xE8) /* Test Registers */ ++#define GPIO_TISRG (GPIO_BASE+0xEC) /* Test Registers */ ++#define GPIO_TISRH (GPIO_BASE+0xF0) /* Test Registers */ ++#define GPIO_TCER (GPIO_BASE+0xF4) /* Test Registers */ ++ ++ ++/* 8088_0000 - 8088_ffff: Ac97 Controller (AAC) */ ++#define AC97_OFFSET 0x080000 ++#define AC97_BASE (EP93XX_APB_VIRT_BASE|AC97_OFFSET) ++#define EP93XX_AC97_PHY_BASE (EP93XX_APB_PHYS_BASE|AC97_OFFSET) ++#define AC97DR1 (AC97_BASE+0x00) /* 8088.0000 R/W Data read or written from/to FIFO1 */ ++#define AC97RXCR1 (AC97_BASE+0x04) /* 8088.0004 R/W Control register for receive */ ++#define AC97TXCR1 (AC97_BASE+0x08) /* 8088.0008 R/W Control register for transmit */ ++#define AC97SR1 (AC97_BASE+0x0C) /* 8088.000C R Status register */ ++#define AC97RISR1 (AC97_BASE+0x10) /* 8088.0010 R Raw interrupt status register */ ++#define AC97ISR1 (AC97_BASE+0x14) /* 8088.0014 R Interrupt Status */ ++#define AC97IE1 (AC97_BASE+0x18) /* 8088.0018 R/W Interrupt Enable */ ++ /* 8088.001C Reserved - RAZ */ ++#define AC97DR2 (AC97_BASE+0x20) /* 8088.0020 R/W Data read or written from/to FIFO2 */ ++#define AC97RXCR2 (AC97_BASE+0x24) /* 8088.0024 R/W Control register for receive */ ++#define AC97TXCR2 (AC97_BASE+0x28) /* 8088.0028 R/W Control register for transmit */ ++#define AC97SR2 (AC97_BASE+0x2C) /* 8088.002C R Status register */ ++#define AC97RISR2 (AC97_BASE+0x30) /* 8088.0030 R Raw interrupt status register */ ++#define AC97ISR2 (AC97_BASE+0x34) /* 8088.0034 R Interrupt Status */ ++#define AC97IE2 (AC97_BASE+0x38) /* 8088.0038 R/W Interrupt Enable */ ++ /* 8088.003C Reserved - RAZ */ ++#define AC97DR3 (AC97_BASE+0x40) /* 8088.0040 R/W Data read or written from/to FIFO3. */ ++#define AC97RXCR3 (AC97_BASE+0x44) /* 8088.0044 R/W Control register for receive */ ++#define AC97TXCR3 (AC97_BASE+0x48) /* 8088.0048 R/W Control register for transmit */ ++#define AC97SR3 (AC97_BASE+0x4C) /* 8088.004C R Status register */ ++#define AC97RISR3 (AC97_BASE+0x50) /* 8088.0050 R Raw interrupt status register */ ++#define AC97ISR3 (AC97_BASE+0x54) /* 8088.0054 R Interrupt Status */ ++#define AC97IE3 (AC97_BASE+0x58) /* 8088.0058 R/W Interrupt Enable */ ++ /* 8088.005C Reserved - RAZ */ ++#define AC97DR2 (AC97_BASE+0x20) /* 8088.0020 R/W Data read or written from/to FIFO2 */ ++#define AC97RXCR2 (AC97_BASE+0x24) /* 8088.0024 R/W Control register for receive */ ++#define AC97TXCR2 (AC97_BASE+0x28) /* 8088.0028 R/W Control register for transmit */ ++#define AC97SR2 (AC97_BASE+0x2C) /* 8088.002C R Status register */ ++#define AC97RISR2 (AC97_BASE+0x30) /* 8088.0030 R Raw interrupt status register */ ++#define AC97ISR2 (AC97_BASE+0x34) /* 8088.0034 R Interrupt Status */ ++#define AC97IE2 (AC97_BASE+0x38) /* 8088.0038 R/W Interrupt Enable */ ++ /* 8088.003C Reserved - RAZ */ ++#define AC97DR3 (AC97_BASE+0x40) /* 8088.0040 R/W Data read or written from/to FIFO3. */ ++#define AC97RXCR3 (AC97_BASE+0x44) /* 8088.0044 R/W Control register for receive */ ++#define AC97TXCR3 (AC97_BASE+0x48) /* 8088.0048 R/W Control register for transmit */ ++#define AC97SR3 (AC97_BASE+0x4C) /* 8088.004C R Status register */ ++#define AC97RISR3 (AC97_BASE+0x50) /* 8088.0050 R Raw interrupt status register */ ++#define AC97ISR3 (AC97_BASE+0x54) /* 8088.0054 R Interrupt Status */ ++#define AC97IE3 (AC97_BASE+0x58) /* 8088.0058 R/W Interrupt Enable */ ++ /* 8088.005C Reserved - RAZ */ ++#define AC97DR4 (AC97_BASE+0x60) /* 8088.0060 R/W Data read or written from/to FIFO4. */ ++#define AC97RXCR4 (AC97_BASE+0x64) /* 8088.0064 R/W Control register for receive */ ++#define AC97TXCR4 (AC97_BASE+0x68) /* 8088.0068 R/W Control register for transmit */ ++#define AC97SR4 (AC97_BASE+0x6C) /* 8088.006C R Status register */ ++#define AC97RISR4 (AC97_BASE+0x70) /* 8088.0070 R Raw interrupt status register */ ++#define AC97ISR4 (AC97_BASE+0x74) /* 8088.0074 R Interrupt Status */ ++#define AC97IE4 (AC97_BASE+0x78) /* 8088.0078 R/W Interrupt Enable */ ++ /* 8088.007C Reserved - RAZ */ ++#define AC97S1DATA (AC97_BASE+0x80) /* 8088.0080 R/W Data received/transmitted on SLOT1 */ ++#define AC97S2DATA (AC97_BASE+0x84) /* 8088.0084 R/W Data received/transmitted on SLOT2 */ ++#define AC97S12DATA (AC97_BASE+0x88) /* 8088.0088 R/W Data received/transmitted on SLOT12 */ ++#define AC97RGIS (AC97_BASE+0x8C) /* 8088.008C R/W Raw Global interrupt status register*/ ++#define AC97GIS (AC97_BASE+0x90) /* 8088.0090 R Global interrupt status register */ ++#define AC97IM (AC97_BASE+0x94) /* 8088.0094 R/W Interrupt mask register */ ++#define AC97EOI (AC97_BASE+0x98) /* 8088.0098 W Interrupt clear register */ ++#define AC97GCR (AC97_BASE+0x9C) /* 8088.009C R/W Main Control register */ ++#define AC97RESET (AC97_BASE+0xA0) /* 8088.00A0 R/W RESET control register. */ ++#define AC97SYNC (AC97_BASE+0xA4) /* 8088.00A4 R/W SYNC control register. */ ++#define AC97GCIS (AC97_BASE+0xA8) /* 8088.00A8 R Global chan FIFO int status register */ ++ ++ ++/* 800B_0000 - 800B_FFFF: VIC 0 */ ++#define VIC0_OFFSET 0x0B0000 ++#define VIC0_BASE (EP93XX_AHB_VIRT_BASE|VIC0_OFFSET) ++#define VIC0 (VIC0_BASE+0x000) ++#define VIC0IRQSTATUS (VIC0_BASE+0x000) /* R IRQ status register */ ++#define VIC0FIQSTATUS (VIC0_BASE+0x004) /* R FIQ status register */ ++#define VIC0RAWINTR (VIC0_BASE+0x008) /* R Raw interrupt status register */ ++#define VIC0INTSELECT (VIC0_BASE+0x00C) /* R/W Interrupt select register */ ++#define VIC0INTENABLE (VIC0_BASE+0x010) /* R/W Interrupt enable register */ ++#define VIC0INTENCLEAR (VIC0_BASE+0x014) /* W Interrupt enable clear register */ ++ ++/* 8003_0000 - 8003_ffff: Raster */ ++#define RASTER_OFFSET 0x030000 ++#define RASTER_BASE (EP93XX_AHB_VIRT_BASE|RASTER_OFFSET) ++#define VLINESTOTAL (RASTER_BASE+0x00) ++#define VSYNCSTRTSTOP (RASTER_BASE+0x04) ++#define VACTIVESTRTSTOP (RASTER_BASE+0x08) ++#define VCLKSTRTSTOP (RASTER_BASE+0x0C) ++#define HCLKSTOTAL (RASTER_BASE+0x10) ++#define HSYNCSTRTSTOP (RASTER_BASE+0x14) ++#define HACTIVESTRTSTOP (RASTER_BASE+0x18) ++#define HCLKSTRTSTOP (RASTER_BASE+0x1C) ++#define BRIGHTNESS (RASTER_BASE+0x20) ++#define VIDEOATTRIBS (RASTER_BASE+0x24) ++#define VIDSCRNPAGE (RASTER_BASE+0x28) ++#define VIDSCRNHPG (RASTER_BASE+0x2C) ++#define SCRNLINES (RASTER_BASE+0x30) ++#define LINELENGTH (RASTER_BASE+0x34) ++#define VLINESTEP (RASTER_BASE+0x38) ++#define LINECARRY (RASTER_BASE+0x3C) ++#define BLINKRATE (RASTER_BASE+0x40) ++#define BLINKMASK (RASTER_BASE+0x44) ++#define BLINKPATTRN (RASTER_BASE+0x48) ++#define PATTRNMASK (RASTER_BASE+0x4C) ++#define BG_OFFSET (RASTER_BASE+0x50) ++#define PIXELMODE (RASTER_BASE+0x54) ++#define PARLLIFOUT (RASTER_BASE+0x58) ++#define PARLLIFIN (RASTER_BASE+0x5C) ++#define CURSOR_ADR_START (RASTER_BASE+0x60) ++#define CURSOR_ADR_RESET (RASTER_BASE+0x64) ++#define CURSORSIZE (RASTER_BASE+0x68) ++#define CURSORCOLOR1 (RASTER_BASE+0x6C) ++#define CURSORCOLOR2 (RASTER_BASE+0x70) ++#define CURSORXYLOC (RASTER_BASE+0x74) ++#define CURSOR_DHSCAN_LH_YLOC (RASTER_BASE+0x78) ++#define RASTER_SWLOCK (RASTER_BASE+0x7C) ++#define GS_LUT (RASTER_BASE+0x80) ++#define RASTER_TCR (RASTER_BASE+0x100) ++#define RASTER_TISRA (RASTER_BASE+0x104) ++#define RASTER_TISRB (RASTER_BASE+0x108) ++#define CURSOR_TISR (RASTER_BASE+0x10C) ++#define RASTER_TOCRA (RASTER_BASE+0x110) ++#define RASTER_TOCRB (RASTER_BASE+0x114) ++#define FIFO_TOCRA (RASTER_BASE+0x118) ++#define FIFO_TOCRB (RASTER_BASE+0x11C) ++#define BLINK_TISR (RASTER_BASE+0x120) ++#define DAC_TISRA (RASTER_BASE+0x124) ++#define DAC_TISRB (RASTER_BASE+0x128) ++#define SHIFT_TISR (RASTER_BASE+0x12C) ++#define DACMUX_TOCRA (RASTER_BASE+0x130) ++#define DACMUX_TOCRB (RASTER_BASE+0x134) ++#define PELMUX_TOCR (RASTER_BASE+0x138) ++#define VIDEO_TOCRA (RASTER_BASE+0x13C) ++#define VIDEO_TOCRB (RASTER_BASE+0x140) ++#define YCRCB_TOCR (RASTER_BASE+0x144) ++#define CURSOR_TOCR (RASTER_BASE+0x148) ++#define VIDEO_TOCRC (RASTER_BASE+0x14C) ++#define SHIFT_TOCR (RASTER_BASE+0x150) ++#define BLINK_TOCR (RASTER_BASE+0x154) ++#define RASTER_TCER (RASTER_BASE+0x180) ++#define SIGVAL (RASTER_BASE+0x200) ++#define SIGCTL (RASTER_BASE+0x204) ++#define VSIGSTRTSTOP (RASTER_BASE+0x208) ++#define HSIGSTRTSTOP (RASTER_BASE+0x20C) ++#define SIGCLR (RASTER_BASE+0x210) ++#define ACRATE (RASTER_BASE+0x214) ++#define LUTCONT (RASTER_BASE+0x218) ++#define VBLANKSTRTSTOP (RASTER_BASE+0x228) ++#define HBLANKSTRTSTOP (RASTER_BASE+0x22C) ++#define LUT (RASTER_BASE+0x400) ++#define CURSORBLINK1 (RASTER_BASE+0x21C) ++#define CURSORBLINK2 (RASTER_BASE+0x220) ++#define CURSORBLINK (RASTER_BASE+0x224) ++#define EOLOFFSET (RASTER_BASE+0x230) ++#define FIFOLEVEL (RASTER_BASE+0x234) ++#define GS_LUT2 (RASTER_BASE+0x280) ++#define GS_LUT3 (RASTER_BASE+0x300) ++#define COLOR_LUT (RASTER_BASE+0x400) ++ ++/* 8004_0000 - 8004_ffff: Graphics */ ++#define GRAPHICS_OFFSET 0x040000 ++#define GRAPHICS_BASE (EP93XX_AHB_VIRT_BASE|GRAPHICS_OFFSET) ++#define SRCPIXELSTRT (GRAPHICS_BASE+0x00) ++#define DESTPIXELSTRT (GRAPHICS_BASE+0x04) ++#define BLKSRCSTRT (GRAPHICS_BASE+0x08) ++#define BLKDSTSTRT (GRAPHICS_BASE+0x0C) ++#define BLKSRCWIDTH (GRAPHICS_BASE+0x10) ++#define SRCLINELENGTH (GRAPHICS_BASE+0x14) ++#define BLKDESTWIDTH (GRAPHICS_BASE+0x18) ++#define BLKDESTHEIGHT (GRAPHICS_BASE+0x1C) ++#define DESTLINELENGTH (GRAPHICS_BASE+0x20) ++#define BLOCKCTRL (GRAPHICS_BASE+0x24) ++#define TRANSPATTRN (GRAPHICS_BASE+0x28) ++#define BLOCKMASK (GRAPHICS_BASE+0x2C) ++#define BACKGROUND (GRAPHICS_BASE+0x30) ++#define LINEINC (GRAPHICS_BASE+0x34) ++#define LINEINIT (GRAPHICS_BASE+0x38) ++#define LINEPATTRN (GRAPHICS_BASE+0x3C) ++ ++#define EP93XX_RASTER_BASE (EP93XX_AHB_VIRT_BASE + 0x00030000) ++#define EP93XX_RASTER_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00030000) ++ ++#define EP93XX_GRAPHICS_ACCEL_BASE (EP93XX_AHB_VIRT_BASE + 0x00040000) ++#define EP93XX_GRAPHICS_ACCEL_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00040000) ++ ++#ifndef __ASSEMBLY__ ++ ++#define SysconSetLocked(registername,value) \ ++ { \ ++ local_irq_disable(); \ ++ outl( 0xAA, EP93XX_SYSCON_SWLOCK); \ ++ outl( value, registername); \ ++ local_irq_enable(); \ ++ } ++ ++#endif /* Not __ASSEMBLY__ */ ++ + #endif diff --git a/target/linux/ep93xx/patches-2.6.30/002-lcd-linux-hd44780.patch b/target/linux/ep93xx/patches-2.6.30/002-lcd-linux-hd44780.patch new file mode 100644 index 000000000..7480b2811 --- /dev/null +++ b/target/linux/ep93xx/patches-2.6.30/002-lcd-linux-hd44780.patch @@ -0,0 +1,4342 @@ +Index: linux-2.6.30.9/arch/arm/Kconfig +=================================================================== +--- linux-2.6.30.9.orig/arch/arm/Kconfig 2009-10-05 17:38:08.000000000 +0200 ++++ linux-2.6.30.9/arch/arm/Kconfig 2009-11-24 02:01:42.000000000 +0100 +@@ -1407,6 +1407,8 @@ + + source "drivers/accessibility/Kconfig" + ++source "drivers/lcd-linux/Kconfig" ++ + source "drivers/leds/Kconfig" + + source "drivers/rtc/Kconfig" +Index: linux-2.6.30.9/drivers/Makefile +=================================================================== +--- linux-2.6.30.9.orig/drivers/Makefile 2009-10-05 17:38:08.000000000 +0200 ++++ linux-2.6.30.9/drivers/Makefile 2009-11-24 02:01:42.000000000 +0100 +@@ -106,4 +106,5 @@ + obj-$(CONFIG_SSB) += ssb/ + obj-$(CONFIG_VIRTIO) += virtio/ + obj-$(CONFIG_STAGING) += staging/ ++obj-$(CONFIG_LCD_LINUX) += lcd-linux/ + obj-y += platform/ +Index: linux-2.6.30.9/drivers/lcd-linux/Config.in +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.30.9/drivers/lcd-linux/Config.in 2009-11-24 02:01:42.000000000 +0100 +@@ -0,0 +1,8 @@ ++if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then ++ mainmenu_option next_comment ++ comment 'LCD support' ++ ++ tristate 'LCD-Linux layer' CONFIG_LCD_LINUX ++ dep_tristate ' HD44780 controller' CONFIG_LCD_HD44780 $CONFIG_LCD_LINUX ++ endmenu ++fi +Index: linux-2.6.30.9/drivers/lcd-linux/Kconfig +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.30.9/drivers/lcd-linux/Kconfig 2009-11-24 02:01:42.000000000 +0100 +@@ -0,0 +1,33 @@ ++menu "LCD-Linux support" ++ depends on EXPERIMENTAL ++ ++config LCD_LINUX ++ tristate "LCD-Linux layer" ++ default m ++ help ++ LCD-Linux provides an easy way to drive LCD displays under ++ Linux by creating a character which can be read or written. ++ It features complete VT102 emulation and recognizes ++ many escape sequences. If you want to use it you must also ++ choose an appropriate driver, otherwise it will not be ++ very useful. For more information see ++ http://lcd-linux.sourceforge.net/ ++ ++ To compile LCD-Linux as a module, choose M here: ++ the module will be called lcd-linux. ++ ++config LCD_HD44780 ++ tristate "HD44780 controller" ++ depends on LCD_LINUX && MACH_SIM_ONE ++ default m ++ help ++ This is a LCD-Linux driver for LCD displays based on the ++ Hitachi HD44780 (and compatible) controllers connected ++ to the SimOne LCD port. ++ ++ To compile this driver as a module, choose M here: ++ the module will be called hd44780. ++ ++ If unsure, say N. ++ ++endmenu +Index: linux-2.6.30.9/drivers/lcd-linux/Makefile +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.30.9/drivers/lcd-linux/Makefile 2009-11-24 02:01:42.000000000 +0100 +@@ -0,0 +1,8 @@ ++# ++# ++# Standard Makefile to statically compile LCD-Linux into the kernel ++# Linux 2.6 ++ ++obj-$(CONFIG_LCD_LINUX) += lcd-linux.o ++obj-$(CONFIG_LCD_HD44780) += hd44780.o ++ +Index: linux-2.6.30.9/drivers/lcd-linux/cgram/default.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.30.9/drivers/lcd-linux/cgram/default.h 2009-11-24 02:01:42.000000000 +0100 +@@ -0,0 +1,37 @@ ++/* default.h ++ * ++ * ++ * ++ * Default user defined characters for lcdmod. ++ * ++ * Copyright (C) by Michael McLellan (mikey@cs.auckland.ac.nz) ++ * ++ * 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 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * ++ * ++ */ ++ ++static void init_charmap(void) ++{ ++} ++ ++static unsigned char cg0[] = { 0x1f, 0x1f, 0x11, 0x0f, 0x11, 0x1e, 0x01, 0x1f }; ++static unsigned char cg1[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f }; ++static unsigned char cg2[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f }; ++static unsigned char cg3[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x1f }; ++static unsigned char cg4[] = { 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x1f }; ++static unsigned char cg5[] = { 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f }; ++static unsigned char cg6[] = { 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f }; ++static unsigned char cg7[] = { 0x00, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f }; +Index: linux-2.6.30.9/drivers/lcd-linux/charmap.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.30.9/drivers/lcd-linux/charmap.h 2009-11-24 02:01:42.000000000 +0100 +@@ -0,0 +1,79 @@ ++/* charmap.h ++ * ++ * ++ * ++ * Character mapping for HD44780 devices by Mark Haemmerling . ++ * ++ * Translates ISO 8859-1 to HD44780 charset. ++ * HD44780 charset reference: http://markh.de/hd44780-charset.png ++ * ++ * Initial table taken from lcd.o Linux kernel driver by ++ * Nils Faerber . Thanks! ++ * ++ * This file is released under the GNU General Public License. Refer to the ++ * COPYING file distributed with this package. ++ * ++ * Following translations are being performed: ++ * - maps umlaut accent characters to the corresponding umlaut characters ++ * - maps other accent characters to the characters without accents ++ * - maps beta (=ringel-S), micro and Yen ++ * ++ * Alternative mappings: ++ * - #112 ("p") -> #240 (large "p"), orig. mapped -> #112 ++ * - #113 ("q") -> #241 (large "q"), orig. mapped -> #113 ++ * ++ * HD44780 misses backslash ++ * ++ */ ++ ++static unsigned char charmap[] = { ++ ++/* 0 - 31 */ ++ 0, 1, 2, 3, 4, 5, 6, 7, ++ 8, 9, 10, 11, 12, 13, 14, 15, ++ 16, 17, 18, 19, 20, 21, 22, 23, ++ 24, 25, 26, 27, 28, 29, 30, 31, ++ ++/* 32 - 63 */ ++ 32, 33, 34, 35, 36, 37, 38, 39, ++ 40, 41, 42, 43, 44, 45, 46, 47, ++ 48, 49, 50, 51, 52, 53, 54, 55, ++ 56, 57, 58, 59, 60, 61, 62, 63, ++ ++/* 64 - 95 */ ++ 64, 65, 66, 67, 68, 69, 70, 71, ++ 72, 73, 74, 75, 76, 77, 78, 79, ++ 80, 81, 82, 83, 84, 85, 86, 87, ++ 88, 89, 90, 91, 47, 93, 94, 95, ++ ++/* 96 - 127 */ ++ 96, 97, 98, 99, 100, 101, 102, 103, ++104, 105, 106, 107, 108, 109, 110, 111, ++112, 113, 114, 115, 116, 117, 118, 119, ++120, 121, 122, 123, 124, 125, 126, 127, ++ ++/* 128 - 159 */ ++128, 129, 130, 131, 132, 133, 134, 135, ++136, 137, 138, 139, 140, 141, 142, 143, ++144, 145, 146, 147, 148, 149, 150, 151, ++152, 153, 154, 155, 156, 157, 158, 159, ++ ++/* 160 - 191 */ ++160, 33, 236, 237, 164, 92, 124, 167, ++ 34, 169, 170, 171, 172, 173, 174, 175, ++223, 177, 178, 179, 39, 249, 247, 165, ++ 44, 185, 186, 187, 188, 189, 190, 63, ++ ++/* 192 - 223 */ ++ 65, 65, 65, 65, 225, 65, 65, 67, ++ 69, 69, 69, 69, 73, 73, 73, 73, ++ 68, 78, 79, 79, 79, 79, 239, 120, ++ 48, 85, 85, 85, 245, 89, 240, 226, ++ ++/* 224 - 255 */ ++ 97, 97, 97, 97, 225, 97, 97, 99, ++101, 101, 101, 101, 105, 105, 105, 105, ++111, 110, 111, 111, 111, 111, 239, 253, ++ 48, 117, 117, 117, 245, 121, 240, 255 ++ ++}; +Index: linux-2.6.30.9/drivers/lcd-linux/commands.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.30.9/drivers/lcd-linux/commands.h 2009-11-24 02:01:42.000000000 +0100 +@@ -0,0 +1,77 @@ ++/* commands.h ++ * ++ * ++ * ++ * LCD-Linux: ++ * Driver for HD44780 compatible displays connected to the parallel port. ++ * ++ * HD44780 commands. ++ * ++ * Copyright (C) 2004 - 2007 Mattia Jona-Lasinio (mjona@users.sourceforge.net) ++ * ++ * 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 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * ++ */ ++ ++#ifndef HD44780_COMMANDS_H ++#define HD44780_COMMANDS_H ++ ++/*** HD44780 Command Set ***/ ++ ++/* Clear Display*/ ++#define CLR_DISP 0x01 /* Clear entire display; cursor at row 0, column 0 */ ++ ++/* Return Home */ ++#define RET_HOME 0x02 /* Cursor at row 0, column 0; display content doesn't change */ ++ ++/* Entry Mode Set */ ++#define ENTRY_MODE_SET 0x04 ++#define DISP_SHIFT_ON (ENTRY_MODE_SET | 0x01) /* Shift display, not cursor after data write */ ++#define DISP_SHIFT_OFF (ENTRY_MODE_SET | 0x00) /* Shift cursor, not display after data write */ ++#define CURS_INC (ENTRY_MODE_SET | 0x02) /* Shift on the right after data read/write */ ++#define CURS_DEC (ENTRY_MODE_SET | 0x00) /* Shift on the left after data read/write */ ++ ++/* Display on/off Control */ ++#define DISP_ONOFF_CNTR 0x08 ++#define BLINK_ON (DISP_ONOFF_CNTR | 0x01) /* Cursor blinking on */ ++#define BLINK_OFF (DISP_ONOFF_CNTR | 0x00) /* Cursor blinking off */ ++#define CURS_ON (DISP_ONOFF_CNTR | 0x02) /* Display Cursor */ ++#define CURS_OFF (DISP_ONOFF_CNTR | 0x00) /* Hide Cursor */ ++#define DISP_ON (DISP_ONOFF_CNTR | 0x04) /* Turn on display updating */ ++#define DISP_OFF (DISP_ONOFF_CNTR | 0x00) /* Freeze display content */ ++ ++/* Cursor or Display Shift */ ++#define CURS_DISP_SHIFT 0x10 ++#define SHIFT_RIGHT (CURS_DISP_SHIFT | 0x04) /* Shift on the right */ ++#define SHIFT_LEFT (CURS_DISP_SHIFT | 0x00) /* Shift on the left */ ++#define SHIFT_DISP (CURS_DISP_SHIFT | 0x08) /* Shift display */ ++#define SHIFT_CURS (CURS_DISP_SHIFT | 0x00) /* Shift cursor */ ++ ++/* Function Set */ ++#define FUNC_SET 0x20 ++#define FONT_5X10 (FUNC_SET | 0x04) /* Select 5x10 dots font */ ++#define FONT_5X8 (FUNC_SET | 0x00) /* Select 5x8 dots font */ ++#define DISP_2_LINES (FUNC_SET | 0x08) /* Select 2 lines display (only 5x8 font allowed) */ ++#define DISP_1_LINE (FUNC_SET | 0x00) /* Select 1 line display */ ++#define BUS_8_BITS (FUNC_SET | 0x10) /* Set 8 data bits */ ++#define BUS_4_BITS (FUNC_SET | 0x00) /* Set 4 data bits */ ++ ++/* Set CGRAM Address */ ++#define CGRAM_IO 0x40 /* Base CGRAM address */ ++ ++/* Set DDRAM Address */ ++#define DDRAM_IO 0x80 /* Base DDRAM address */ ++ ++#endif /* commands included */ +Index: linux-2.6.30.9/drivers/lcd-linux/config.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.30.9/drivers/lcd-linux/config.h 2009-11-24 02:01:42.000000000 +0100 +@@ -0,0 +1,73 @@ ++/* config.h ++ * ++ * ++ * ++ * Configure file for LCD-Linux. Here you must specify your hardware setup and ++ * timings constants. The default values will probably be right for you. ++ * ++ * Copyright (C) 2005 - 2007 Mattia Jona-Lasinio (mjona@users.sourceforge.net) ++ * ++ * 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 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * ++ * ++ */ ++ ++/* Setup the default user defined characters in CGRAM */ ++#include "cgram/default.h" ++ ++/* Don't modify the default timing constants ++ * unless you know what you are doing. ++ */ ++ ++/* Execution times (in microseconds) */ ++#define T_READ 60 /* Read execution time (min 43 us) */ ++#define T_WRITE 60 /* Write execution time (min 43 us) */ ++#define T_BF 2 /* Busy flag polling time (min 1 us) */ ++ ++/* Timings in nanoseconds */ ++#define T_AS 200 /* Address set-up time (min 140 ns) */ ++#define T_EH 500 /* Enable high time (min 450 ns) */ ++#define T_EL 600 /* Enable low time (min 500 ns) */ ++ ++/* Various constants */ ++#define DFLT_NUM_CNTR 1 /* Default number of controllers the display has */ ++#define DFLT_CNTR_ROWS 2 /* Default number of rows per controller */ ++#define DFLT_CNTR_COLS 16 /* Default number of columns the display has */ ++#define DFLT_VS_ROWS 25 /* Default number of rows for the virtual screen */ ++#define DFLT_VS_COLS 80 /* Default number of columns for the virtual screen */ ++#define DFLT_TABSTOP 3 /* Default length of tabs */ ++#define DFLT_FLAGS (HD44780_CHECK_BF | HD44780_4BITS_BUS ) /* Default flags */ ++ ++#define MAX_CNTR_ROWS 4 /* The HD44780 supports up to 4 lines as a fake 2 lines mode */ ++#define MAX_CNTR_COLS 80 /* The HD44780 supports up to 80 characters (1*80; 2*40; etc) */ ++ ++#define SETUP 4 ++#define HIGH_NIBBLE_WRITE(x) (((x) >> (4-SETUP)) & (0x0f << SETUP)) ++#define LOW_NIBBLE_WRITE(x) (((x) << SETUP) & (0x0f << SETUP)) ++#define HIGH_NIBBLE_READ(x) (((x) & (0x0f << SETUP)) << (4-SETUP)) ++#define LOW_NIBBLE_READ(x) (((x) & (0x0f << SETUP)) >> SETUP) ++ ++ ++#define SIMONE_LCD_RS EP93XX_GPIO_LINE_A(2) /* OUT */ ++#define SIMONE_LCD_RD EP93XX_GPIO_LINE_A(3) /* OUT */ ++#define SIMONE_LCD_EN EP93XX_GPIO_LINE_B(4) /* EGPIO12 OUT */ ++#define SIMONE_LCD_BCKLIGHT EP93XX_GPIO_LINE_B(5) /* EGPIO13 OUT */ ++ ++#define SIMONE_LCD_DATA0 EP93XX_GPIO_LINE_A(4) ++#define SIMONE_LCD_DATA1 EP93XX_GPIO_LINE_A(5) ++#define SIMONE_LCD_DATA2 EP93XX_GPIO_LINE_A(6) ++#define SIMONE_LCD_DATA3 EP93XX_GPIO_LINE_A(7) ++ ++ +Index: linux-2.6.30.9/drivers/lcd-linux/hd44780.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.30.9/drivers/lcd-linux/hd44780.c 2009-11-24 02:05:29.000000000 +0100 +@@ -0,0 +1,860 @@ ++/* hd44780.c ++ * ++ * ++ * ++ * LCD-Linux: ++ * Driver for HD44780 compatible displays connected to the parallel port. ++ * ++ * Copyright (C) 2005 - 2007 Mattia Jona-Lasinio (mjona@users.sourceforge.net) ++ * Adapted to Sim.One Hardware by Nuccio Raciti (raciti.nuccio@gmail.com) ++ * ++ * 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 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * ++ */ ++ ++ ++#include ++ ++ ++#ifdef CONFIG_PROC_FS ++#define USE_PROC ++#else ++#undef USE_PROC ++#endif ++ ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include ++#include ++ ++#include ++#include ++#include ++ ++#ifdef USE_PROC ++#include ++#endif ++ ++#define LCD_LINUX_MAIN ++#include ++ ++#include "charmap.h" ++#include "commands.h" ++#include "config.h" ++ ++/** Function prototypes **/ ++static void read_display(unsigned char *byte, unsigned char bitmask); ++static void write_display(unsigned char byte, unsigned char bitmask); ++ ++/* Initialization */ ++static int hd44780_validate_driver(void); ++static int hd44780_init_port(void); ++static int hd44780_cleanup_port(void); ++static int hd44780_init_display(void); ++static int hd44780_cleanup_display(void); ++ ++/* Write */ ++static void hd44780_address_mode(int); ++static void hd44780_clear_display(void); ++static void hd44780_write_char(unsigned int, unsigned short); ++static void hd44780_write_cgram_char(unsigned char, unsigned char *); ++ ++/* Read */ ++static void check_bf(unsigned char); ++static void hd44780_read_char(unsigned int, unsigned short *); ++static void hd44780_read_cgram_char(unsigned char, unsigned char *); ++ ++/* Input handling */ ++static int hd44780_handle_custom_char(unsigned int); ++static int hd44780_handle_custom_ioctl(unsigned int,unsigned long , unsigned int); ++ ++/* Proc operations */ ++#ifdef USE_PROC ++static void create_proc_entries(void); ++static void remove_proc_entries(void); ++#endif ++ ++/* hd44780 access */ ++#define ACCESS_TO_READ 0 ++#define ACCESS_TO_WRITE 1 ++#define ACCESS_TO_DATA 2 ++ ++/* hd44780_flags */ ++#define _CHECK_BF 0 /* Do busy-flag checking */ ++#define _4BITS_BUS 1 /* The bus is 4 bits long */ ++#define _5X10_FONT 2 /* Use 5x10 font */ ++#define CURSOR_BLINK 3 /* Make the cursor blinking */ ++#define SHOW_CURSOR 4 /* Make the cursor visible */ ++#define DISPLAY_ON 5 /* Display status: on or off */ ++#define INC_ADDR 6 /* Increment address after data read/write */ ++#define BACKLIGHT 7 /* Display backlight: on or off */ ++#define CGRAM_STATE 9 /* Controller status bitmask (bits 9->15): DDRAM or CGRAM access */ ++#define ESC_MASK 0x00ff0000 ++#define PROC_MASK 0x0f000000 ++ ++#define SET_STATE(state, mask) (hd44780_flags = (hd44780_flags & ~(mask)) | ((state) & (mask))) ++#define SET_ESC_STATE(state) SET_STATE((state) << 16, ESC_MASK) ++#define SET_PROC_LEVEL(level) SET_STATE((level) << 24, PROC_MASK) ++#define ESC_STATE ((hd44780_flags & ESC_MASK) >> 16) ++#define PROC_LEVEL ((hd44780_flags & PROC_MASK) >> 24) ++ ++/* globals */ ++static unsigned int disp_size; /* Display size (rows*columns) */ ++static unsigned int disp_offset[1]; /* Physical cursor position on the display */ ++static unsigned long hd44780_flags; /* Driver flags for internal use only */ ++ ++static struct lcd_parameters par = { ++ .name = HD44780_STRING, ++ .minor = HD44780_MINOR, ++ .flags = DFLT_FLAGS, ++ .tabstop = DFLT_TABSTOP, ++ .num_cntr = 1, ++ .cntr_rows = DFLT_CNTR_ROWS, ++ .cntr_cols = DFLT_CNTR_COLS, ++ .vs_rows = DFLT_VS_ROWS, ++ .vs_cols = DFLT_VS_COLS, ++ .cgram_chars = 8, ++ .cgram_bytes = 8, ++ .cgram_char0 = 0, ++}; ++/* End of globals */ ++ ++#ifdef MODULE ++#include ++MODULE_ALIAS_CHARDEV(LCD_MAJOR, HD44780_MINOR); ++#include ++ ++static unsigned short flags = DFLT_FLAGS; ++static unsigned short tabstop = DFLT_TABSTOP; ++static unsigned short cntr_rows = DFLT_CNTR_ROWS; ++static unsigned short cntr_cols = DFLT_CNTR_COLS; ++static unsigned short vs_rows = DFLT_VS_ROWS; ++static unsigned short vs_cols = DFLT_VS_COLS; ++static unsigned short minor = HD44780_MINOR; ++ ++MODULE_DESCRIPTION("LCD SimOne driver for HD44780 compatible controllers."); ++MODULE_AUTHOR("Nuccio Raciti (raciti.nuccio@gmail.com)"); ++#ifdef MODULE_LICENSE ++MODULE_LICENSE("GPL"); ++#endif ++module_param(flags, ushort, 0444); ++module_param(cntr_rows, ushort, 0444); ++module_param(cntr_cols, ushort, 0444); ++module_param(vs_rows, ushort, 0444); ++module_param(vs_cols, ushort, 0444); ++module_param(tabstop, ushort, 0444); ++module_param(minor, ushort, 0444); ++ ++MODULE_PARM_DESC(flags, "Various flags (see Documentation)"); ++MODULE_PARM_DESC(cntr_rows, "Number of rows per controller on the LCD: 1, 2, 4 (default: " string(DFLT_CNTR_ROWS) ")"); ++MODULE_PARM_DESC(cntr_cols, "Number of columns on the LCD (default: " string(DFLT_CNTR_COLS) ", max: " string(MAX_CNTR_COLS) ")"); ++MODULE_PARM_DESC(vs_rows, "Number of rows of the virtual screen (default: " string(DFLT_VS_ROWS) ")"); ++MODULE_PARM_DESC(vs_cols, "Number of columns of the virtual screen (default: " string(DFLT_VS_COLS) ")"); ++MODULE_PARM_DESC(tabstop, "Tab character length (default: " string(DFLT_TABSTOP) ")"); ++MODULE_PARM_DESC(minor, "Assigned minor number (default: " string(HD44780_MINOR) ")"); ++#else ++ ++/* ++ * Parse boot command line ++ * ++ * hd44780=cntr_rows,cntr_cols,vs_rows,vs_cols,flags,minor,tabstop ++ */ ++static int __init hd44780_boot_init(char *cmdline) ++{ ++ char *str = cmdline; ++ int idx = 0; ++ unsigned short *args[] = { ++ &par.cntr_rows, ++ &par.cntr_cols, ++ &par.vs_rows, ++ &par.vs_cols, ++ &par.flags, ++ &par.num_cntr, ++ &par.minor, ++ &par.tabstop, ++ }; ++ ++ while (*cmdline && idx < (sizeof(args)/sizeof(unsigned short *))) { ++ switch (*str) { ++ case ',': ++ *str++ = 0; ++ case 0: ++ if (strlen(cmdline)) ++ *args[idx] = simple_strtoul(cmdline, NULL, 0); ++ ++idx; ++ cmdline = str; ++ break; ++ default: ++ ++str; ++ break; ++ } ++ } ++ ++ return (1); ++} ++ ++__setup("hd44780=", hd44780_boot_init); ++#endif /* MODULE */ ++ ++/* Macros for iterator handling */ ++static inline unsigned int iterator_inc_(unsigned int iterator, const unsigned int module) ++{ ++ return ((++iterator)%module); ++} ++ ++static inline unsigned int iterator_dec_(unsigned int iterator, const unsigned int module) ++{ ++ return (iterator ? --iterator : module-1); ++} ++ ++#define iterator_inc(iterator, module) (iterator = iterator_inc_(iterator, module)) ++#define iterator_dec(iterator, module) (iterator = iterator_dec_(iterator, module)) ++ ++static inline void set_lines(unsigned char bitmask) ++{ ++ gpio_set_value(SIMONE_LCD_EN, 0); /* Disable */ ++ ++ if(bitmask & ACCESS_TO_WRITE ) { ++ gpio_direction_output (SIMONE_LCD_DATA0 , 0); ++ gpio_direction_output (SIMONE_LCD_DATA1 , 0); ++ gpio_direction_output (SIMONE_LCD_DATA2 , 0); ++ gpio_direction_output (SIMONE_LCD_DATA3 , 0); ++ gpio_set_value(SIMONE_LCD_RD, 0); /* Write */ ++ } else { ++ ++ gpio_direction_input (SIMONE_LCD_DATA0); ++ gpio_direction_input (SIMONE_LCD_DATA1); ++ gpio_direction_input (SIMONE_LCD_DATA2); ++ gpio_direction_input (SIMONE_LCD_DATA3); ++ gpio_set_value(SIMONE_LCD_RD, 1); /* Read */ ++ } ++ ++ if(bitmask & ACCESS_TO_DATA ) ++ gpio_set_value(SIMONE_LCD_RS, 1); /* Data */ ++ else ++ gpio_set_value(SIMONE_LCD_RS, 0); /* Cmds*/ ++ ++ if(test_bit(BACKLIGHT, &hd44780_flags)) ++ gpio_set_value(SIMONE_LCD_BCKLIGHT, 1); ++ else ++ gpio_set_value(SIMONE_LCD_BCKLIGHT, 0); ++} ++ ++ ++/* Low level read from the display */ ++static inline unsigned char __read_display(unsigned char bitmask) ++{ ++ unsigned char byte; ++ ++ set_lines (bitmask); ++ ++ ndelay(T_AS); /* Address set-up time */ ++ gpio_set_value(SIMONE_LCD_EN, 1); /* Enable */ ++ ndelay(T_EH);/* Enable high time */ ++ ++ byte = (gpio_get_value(SIMONE_LCD_DATA0) << 4); ++ byte |= (gpio_get_value(SIMONE_LCD_DATA1) << 5); ++ byte |= (gpio_get_value(SIMONE_LCD_DATA2) << 6); ++ byte |= (gpio_get_value(SIMONE_LCD_DATA3) << 7); ++ ++ gpio_set_value(SIMONE_LCD_EN, 0); /* Disable */ ++ ++ ndelay(T_EL); /* Enable low time */ ++ ++ ++ return (byte); ++ ++} ++ ++/* Low level write to the display */ ++static inline void __write_display(unsigned char data, unsigned char bitmask) ++{ ++ set_lines(bitmask); ++ ++ if(data & 0x10) ++ gpio_set_value(SIMONE_LCD_DATA0, 1); ++ else ++ gpio_set_value(SIMONE_LCD_DATA0, 0); ++ ++ if(data & 0x20) ++ gpio_set_value(SIMONE_LCD_DATA1, 1); ++ else ++ gpio_set_value(SIMONE_LCD_DATA1, 0); ++ ++ if(data & 0x40) ++ gpio_set_value(SIMONE_LCD_DATA2, 1); ++ else ++ gpio_set_value(SIMONE_LCD_DATA2, 0); ++ ++ if(data & 0x80) ++ gpio_set_value(SIMONE_LCD_DATA3, 1); ++ else ++ gpio_set_value(SIMONE_LCD_DATA3, 0); ++ ++ ndelay(T_AS); /* Address set-up time */ ++ gpio_set_value(SIMONE_LCD_EN, 1); ++ ndelay(T_EH); /* Enable high time */ ++ ++ gpio_set_value(SIMONE_LCD_EN, 0); /* Disable */ ++ ndelay(T_EL); /* Enable low time */ ++} ++ ++ ++/* Read data from the display (4 bit bus, check busy flag) */ ++static void read_display (unsigned char *byte,unsigned char bitmask) ++{ ++ if(bitmask) check_bf(bitmask); ++ *byte = HIGH_NIBBLE_READ(__read_display(bitmask)); ++ if(bitmask) check_bf(bitmask); ++ *byte |= LOW_NIBBLE_READ(__read_display(bitmask)); ++} ++ ++ ++/* Output commands or data to the display (4 bit bus, check busy flag) */ ++static void write_display(unsigned char byte,unsigned char bitmask) ++{ ++ check_bf(bitmask); ++ __write_display(HIGH_NIBBLE_WRITE(byte),bitmask); ++ check_bf(bitmask); ++ __write_display(LOW_NIBBLE_WRITE(byte),bitmask); ++} ++ ++ ++/* Read Address Counter AC from the display */ ++static unsigned char read_ac(unsigned char bitmask) ++{ ++ unsigned char byte; ++ ++ read_display(&byte, bitmask); ++ ++ return (byte); ++} ++ ++ ++/* Do busy-flag check */ ++static void check_bf(unsigned char bitmask) ++{ ++ unsigned int timeout = 20; ++ static unsigned char do_check_bf = 5; ++ gpio_set_value(SIMONE_LCD_EN, 0); /* Disable */ ++ ++ gpio_direction_input (SIMONE_LCD_DATA0); ++ gpio_direction_input (SIMONE_LCD_DATA1); ++ gpio_direction_input (SIMONE_LCD_DATA2); ++ gpio_direction_input (SIMONE_LCD_DATA3); ++ ++ gpio_set_value(SIMONE_LCD_RD, 1); /* Read */ ++ gpio_set_value(SIMONE_LCD_RS, 0); /* Instru */ ++ ++ ndelay(T_AS); /* Address set-up time */ ++ gpio_set_value(SIMONE_LCD_EN, 1); /* Enable */ ++ ndelay(T_EH);/* Enable high time */ ++ ++ do{ ++ udelay(T_BF); ++ } while (gpio_get_value(SIMONE_LCD_DATA3) && --timeout); ++ ++ if (! timeout) { ++ if (! --do_check_bf) { ++ printk(KERN_NOTICE "hd44780 error: is the LCD connected?\n"); ++ } ++ } ++ ++ gpio_set_value(SIMONE_LCD_EN, 0); /* Disable */ ++ ++ ndelay(T_EL); /* Enable low time */ ++} ++ ++/* Send commands to the display */ ++static void write_command(unsigned char command) ++{ ++ write_display(command, ACCESS_TO_WRITE); ++ ++ if (command <= 0x03) ++ mdelay(2); ++} ++ ++static inline void set_cursor(unsigned int offset) ++{ ++ unsigned int disp_number = offset/disp_size; ++ unsigned int local_offset = offset%disp_size; ++ ++ if (disp_offset[disp_number] != local_offset || test_bit(CGRAM_STATE+disp_number, &hd44780_flags)) { ++ unsigned int disp_row = local_offset/par.cntr_cols; ++ unsigned int disp_column = local_offset%par.cntr_cols; ++ ++ write_command(DDRAM_IO | ((disp_row%2)*0x40) | (((disp_row >= 2)*par.cntr_cols)+disp_column)); ++ clear_bit(CGRAM_STATE+disp_number, &hd44780_flags); ++ disp_offset[disp_number] = local_offset; ++ } ++} ++ ++/* HD44780 DDRAM addresses are consecutive only when ++ * the cursor moves on the same row of the display. ++ * Every time the row of the cursor changes we invalidate ++ * the cursor position to force hardware cursor repositioning. ++ */ ++static inline void mov_cursor(unsigned int disp_number) ++{ ++ if (test_bit(INC_ADDR, &hd44780_flags)) { ++ iterator_inc(disp_offset[disp_number], disp_size); ++ if (disp_offset[disp_number]%par.cntr_cols == 0) ++ disp_offset[disp_number] = disp_size; ++ } else { ++ iterator_dec(disp_offset[disp_number], disp_size); ++ if (disp_offset[disp_number]%par.cntr_cols == par.cntr_cols-1) ++ disp_offset[disp_number] = disp_size; ++ } ++} ++ ++static struct lcd_driver hd44780 = { ++ .read_char = hd44780_read_char, ++ .read_cgram_char = hd44780_read_cgram_char, ++ .write_char = hd44780_write_char, ++ .write_cgram_char = hd44780_write_cgram_char, ++ .address_mode = hd44780_address_mode, ++ .clear_display = hd44780_clear_display, ++ .validate_driver = hd44780_validate_driver, ++ .init_display = hd44780_init_display, ++ .cleanup_display = hd44780_cleanup_display, ++ .init_port = hd44780_init_port, ++ .cleanup_port = hd44780_cleanup_port, ++ .handle_custom_char = hd44780_handle_custom_char, ++ .handle_custom_ioctl = hd44780_handle_custom_ioctl, ++ ++ .charmap = charmap, ++}; ++ ++static void hd44780_read_char(unsigned int offset, unsigned short *data) ++{ ++ unsigned int disp_number = offset/disp_size; ++ unsigned char tmp; ++ ++ set_cursor(offset); ++ read_display(&tmp, ACCESS_TO_DATA); ++ *data = tmp; ++ mov_cursor(disp_number); ++} ++ ++static void hd44780_read_cgram_char(unsigned char index, unsigned char *pixels) ++{ ++ unsigned int i; ++ ++ write_command(CGRAM_IO | (index << 3)); ++ set_bit(CGRAM_STATE+0, &hd44780_flags); ++ ++ for (i = 0; i < 8; ++i) { ++ read_display(pixels+i, ACCESS_TO_DATA ); ++ pixels[i] &= 0x1f; ++ } ++} ++ ++static void hd44780_write_char(unsigned int offset, unsigned short data) ++{ ++ unsigned int disp_number = offset/disp_size; ++ ++ set_cursor(offset); ++ write_display(data & 0xff, ACCESS_TO_WRITE | ACCESS_TO_DATA ); ++ mov_cursor(disp_number); ++} ++ ++static void hd44780_write_cgram_char(unsigned char index, unsigned char *pixels) ++{ ++ unsigned int i; ++ ++ /* Move address pointer to index in CGRAM */ ++ write_command(CGRAM_IO | (index << 3)); ++ ++ set_bit(CGRAM_STATE+0, &hd44780_flags); ++ ++ for (i = 0; i < 8; ++i) { ++ pixels[i] &= 0x1f; ++ write_display(pixels[i], ACCESS_TO_WRITE | ACCESS_TO_DATA ); ++ } ++} ++ ++/* Increment/decrement address mode after a data read/write */ ++static void hd44780_address_mode(int mode) ++{ ++ if (mode > 0 && ! test_bit(INC_ADDR, &hd44780_flags)) { ++ write_command(CURS_INC | DISP_SHIFT_OFF); ++ set_bit(INC_ADDR, &hd44780_flags); ++ } else if (mode < 0 && test_bit(INC_ADDR, &hd44780_flags)) { ++ write_command(CURS_DEC | DISP_SHIFT_OFF); ++ clear_bit(INC_ADDR, &hd44780_flags); ++ } ++} ++ ++static void hd44780_clear_display(void) ++{ ++ write_command(CLR_DISP); ++ if (! test_bit(INC_ADDR, &hd44780_flags)) ++ write_command(CURS_DEC | DISP_SHIFT_OFF); ++ memset(disp_offset, 0, sizeof(disp_offset)); ++} ++ ++static int hd44780_validate_driver(void) ++{ ++ if (par.cntr_rows != 1 && par.cntr_rows != 2 && par.cntr_rows != 4) ++ par.cntr_rows = DFLT_CNTR_ROWS; ++ ++ if (par.cntr_rows != 1) ++ par.flags &= ~HD44780_5X10_FONT; ++ ++ ++ if (! par.cntr_cols || par.cntr_cols > MAX_CNTR_COLS/par.cntr_rows) ++ par.cntr_cols = MAX_CNTR_COLS/par.cntr_rows; ++ ++ disp_size = par.cntr_rows*par.cntr_cols; ++ ++ /* These parameters depend on the hardware and cannot be changed */ ++ par.cgram_chars = 8; ++ par.cgram_bytes = 8; ++ par.cgram_char0 = 0; ++ ++ return (0); ++} ++ ++/* Send init commands to the display */ ++static void write_init_command(void) ++{ ++ unsigned char command = 0x30; ++ ++ __write_display(HIGH_NIBBLE_WRITE(command), ACCESS_TO_WRITE); ++ mdelay(20); /* Wait more than 4.1 ms */ ++ __write_display(HIGH_NIBBLE_WRITE(command), ACCESS_TO_WRITE); ++ udelay(200); /* Wait more than 100 us */ ++ __write_display(HIGH_NIBBLE_WRITE(command), ACCESS_TO_WRITE); ++ udelay(200); /* Wait more than 100 us */ ++ command = BUS_4_BITS; ++ command |= ((par.cntr_rows == 1) ? DISP_1_LINE : DISP_2_LINES); ++ command |= (test_bit(_5X10_FONT, &hd44780_flags) ? FONT_5X10 : FONT_5X8); ++ write_command(command); ++ /* set_bit(BACKLIGHT, &hd44780_flags); */ ++} ++ ++static int hd44780_init_display(void) ++{ ++ if (par.flags & HD44780_CHECK_BF) ++ set_bit(_CHECK_BF, &hd44780_flags); ++ else ++ clear_bit(_CHECK_BF, &hd44780_flags); ++ ++ if (par.flags & HD44780_4BITS_BUS) ++ set_bit(_4BITS_BUS, &hd44780_flags); ++ else ++ clear_bit(_4BITS_BUS, &hd44780_flags); ++ ++ if (par.flags & HD44780_5X10_FONT) ++ set_bit(_5X10_FONT, &hd44780_flags); ++ else ++ clear_bit(_5X10_FONT, &hd44780_flags); ++ ++ write_init_command(); ++ ++ hd44780_clear_display(); ++ hd44780_address_mode(1); ++ write_command(DISP_ON | CURS_OFF | BLINK_OFF); ++ set_bit(DISPLAY_ON, &hd44780_flags); ++ clear_bit(SHOW_CURSOR, &hd44780_flags); ++ clear_bit(CURSOR_BLINK, &hd44780_flags); ++ ++ /* Set the CGRAM to default values */ ++ hd44780_write_cgram_char(0, cg0); ++ hd44780_write_cgram_char(1, cg1); ++ hd44780_write_cgram_char(2, cg2); ++ hd44780_write_cgram_char(3, cg3); ++ hd44780_write_cgram_char(4, cg4); ++ hd44780_write_cgram_char(5, cg5); ++ hd44780_write_cgram_char(6, cg6); ++ hd44780_write_cgram_char(7, cg7); ++ init_charmap(); ++ ++ return (0); ++} ++ ++static int hd44780_cleanup_display(void) ++{ ++ hd44780_clear_display(); ++ ++ return (0); ++} ++ ++static int hd44780_init_port(void) ++{ ++ gpio_direction_output (SIMONE_LCD_BCKLIGHT, 0); ++ gpio_direction_output (SIMONE_LCD_RD , 0); ++ gpio_direction_output (SIMONE_LCD_RS , 0); ++ gpio_direction_output (SIMONE_LCD_EN , 0); ++ gpio_set_value(SIMONE_LCD_EN, 0); /* Disable */ ++ ++ return (0); ++} ++ ++static int hd44780_cleanup_port(void) ++{ ++ ++ gpio_direction_input (SIMONE_LCD_BCKLIGHT); ++ gpio_direction_input (SIMONE_LCD_RD); ++ gpio_direction_input (SIMONE_LCD_RS); ++ gpio_direction_input (SIMONE_LCD_EN); ++ gpio_direction_input (SIMONE_LCD_DATA0); ++ gpio_direction_input (SIMONE_LCD_DATA1); ++ gpio_direction_input (SIMONE_LCD_DATA2); ++ gpio_direction_input (SIMONE_LCD_DATA3); ++ return (0); ++} ++ ++static void display_attr(unsigned char input) ++{ ++ unsigned char command; ++ ++ switch (ESC_STATE) { ++ case 'a': /* Turn on/off the display cursor */ ++ if (input == '1') ++ set_bit(SHOW_CURSOR, &hd44780_flags); ++ else if (input == '0') ++ clear_bit(SHOW_CURSOR, &hd44780_flags); ++ break; ++ case 'b': /* Turn on/off the display cursor blinking */ ++ if (input == '1') ++ set_bit(CURSOR_BLINK, &hd44780_flags); ++ else if (input == '0') ++ clear_bit(CURSOR_BLINK, &hd44780_flags); ++ break; ++ case 'h': /* Turn on/off the display */ ++ if (input == '1') ++ set_bit(DISPLAY_ON, &hd44780_flags); ++ else if (input == '0') ++ clear_bit(DISPLAY_ON, &hd44780_flags); ++ break; ++ } ++ ++ command = (test_bit(DISPLAY_ON, &hd44780_flags) ? DISP_ON : DISP_OFF); ++ command |= (test_bit(SHOW_CURSOR, &hd44780_flags) ? CURS_ON : CURS_OFF); ++ command |= (test_bit(CURSOR_BLINK, &hd44780_flags) ? BLINK_ON : BLINK_OFF); ++ ++ if (ESC_STATE == 'h') ++ write_command(command); ++} ++ ++static int hd44780_handle_custom_char(unsigned int _input) ++{ ++ unsigned char input = _input & 0xff; ++ ++ if (_input & (~0xff)) { ++ switch (ESC_STATE) { ++ case 'a': /* Turn on/off the display cursor */ ++ case 'b': /* Turn on/off the display cursor blinking */ ++ case 'h': /* Turn on/off the the display */ ++ display_attr(input); ++ return (0); ++ case 'l': /* Turn on/off the backlight */ ++ if (input == '1') ++ set_bit(BACKLIGHT, &hd44780_flags); ++ else if (input == '0') ++ clear_bit(BACKLIGHT, &hd44780_flags); ++ read_ac(ACCESS_TO_READ); ++ return (0); ++ } ++ } ++ ++ switch (input) { ++ case 'a': /* Turn on/off the display cursor */ ++ case 'b': /* Turn on/off the display cursor blinking */ ++ case 'h': /* Turn on/off the display */ ++ case 'l': /* Turn on/off the backlight */ ++ SET_ESC_STATE(input); ++ return (1); ++ case 'd': /* Shift display cursor Right */ ++ write_command(SHIFT_CURS | SHIFT_RIGHT); ++ return (0); ++ case 'e': /* Shift display cursor Left */ ++ write_command(SHIFT_CURS | SHIFT_LEFT); ++ return (0); ++ case 'f': /* Shift display Right */ ++ write_command(SHIFT_DISP | SHIFT_RIGHT); ++ return (0); ++ case 'g': /* Shift display Left */ ++ write_command(SHIFT_DISP | SHIFT_LEFT); ++ return (0); ++ } ++ ++ return (-1); ++} ++ ++static int hd44780_handle_custom_ioctl(unsigned int num, unsigned long arg, unsigned int user_space) ++{ ++ unsigned char *buffer = (unsigned char *)arg; ++ ++ if (num != HD44780_READ_AC) ++ return (-ENOIOCTLCMD); ++ ++ if (user_space) ++ put_user(read_ac(ACCESS_TO_READ), buffer); ++ else ++ buffer[0] = read_ac(ACCESS_TO_READ); ++ ++ return (0); ++} ++ ++#ifdef USE_PROC ++static int hd44780_proc_status(char *buffer, char **start, off_t offset, int size, int *eof, void *data) ++{ ++ char *temp = buffer; ++ ++ /* Print display configuration */ ++ temp += sprintf(temp, ++ "Interface:\t%u bits\n" ++ "Display rows:\t%d\n" ++ "Display cols:\t%d\n" ++ "Screen rows:\t%d\n" ++ "Screen cols:\t%d\n" ++ "Read:\t\t%sabled\n" ++ "Busy flag chk:\t%sabled\n" ++ "Assigned minor:\t%u\n", ++ (test_bit(_4BITS_BUS, &hd44780_flags) ? 4 : 8), ++ par.cntr_rows, par.cntr_cols, ++ par.vs_rows, par.vs_cols, ++ (hd44780.read_char ? "En" : "Dis"), ++ (test_bit(_CHECK_BF, &hd44780_flags) ? "En" : "Dis"), ++ par.minor); ++ ++ return (temp-buffer); ++} ++ ++static int hd44780_proc_cgram(char *buffer, char **start, off_t offset, int size, int *eof, void *data) ++{ ++ char *temp = buffer; ++ unsigned int i; ++ ++ temp += sprintf(temp, "static void init_charmap(void)\n{\n" ++ "\t/*\n" ++ "\t * charmap[char mapped to cg0] = 0;\n" ++ "\t * charmap[char mapped to cg1] = 1;\n" ++ "\t * charmap[char mapped to cg2] = 2;\n" ++ "\t * charmap[char mapped to cg3] = 3;\n" ++ "\t * charmap[char mapped to cg4] = 4;\n" ++ "\t * charmap[char mapped to cg5] = 5;\n" ++ "\t * charmap[char mapped to cg6] = 6;\n" ++ "\t * charmap[char mapped to cg7] = 7;\n" ++ "\t */\n" ++ "}\n\n"); ++ ++ for (i = 0; i < 8; ++i) { ++ unsigned char cgram_buffer[8]; ++ unsigned int j; ++ ++ temp += sprintf(temp, "static unsigned char cg%u[] = { ", i); ++ hd44780_read_cgram_char(i, cgram_buffer); ++ for (j = 0; j < 8; ++j) ++ temp += sprintf(temp, "0x%.2x%s", cgram_buffer[j], (j == 7 ? " };\n" : ", ")); ++ } ++ ++ return (temp-buffer); ++} ++ ++static void create_proc_entries(void) ++{ ++ int count = 0; ++ ++ SET_PROC_LEVEL(count); ++ if (create_proc_read_entry("status", 0, hd44780.driver_proc_root, hd44780_proc_status, NULL) == NULL) { ++ printk(KERN_ERR "hd44780: cannot create /proc/lcd/%s/status\n", par.name); ++ return; ++ } ++ SET_PROC_LEVEL(++count); ++ if (hd44780.read_cgram_char) { ++ if (create_proc_read_entry("cgram.h", 0, hd44780.driver_proc_root, hd44780_proc_cgram, NULL) == NULL) { ++ printk(KERN_ERR "hd44780: cannot create /proc/lcd/%s/cgram.h\n", par.name); ++ return; ++ } ++ SET_PROC_LEVEL(++count); ++ } ++} ++ ++static void remove_proc_entries(void) ++{ ++ switch (PROC_LEVEL) { ++ case 2: ++ remove_proc_entry("cgram.h", hd44780.driver_proc_root); ++ case 1: ++ remove_proc_entry("status", hd44780.driver_proc_root); ++ } ++ SET_PROC_LEVEL(0); ++} ++#endif ++ ++/* Initialization */ ++static int __init hd44780_init_module(void) ++{ ++ int ret; ++ ++#ifdef MODULE ++#ifdef NOT_DEF ++ if ((ret = request_module("lcd-linux"))) { ++ if (ret != -ENOSYS) { ++ printk(KERN_ERR "hd44780: failure while loading module lcd-linux\n"); ++ return (ret); ++ } ++ printk(KERN_ERR "hd44780: your kernel does not have kmod or kerneld support;\n"); ++ printk(KERN_ERR "hd44780: remember to load the lcd-linux module before\n"); ++ printk(KERN_ERR "hd44780: loading the hd44780 module\n"); ++ } ++#endif ++ if (flags != DFLT_FLAGS) par.flags = flags; ++ if (tabstop != DFLT_TABSTOP) par.tabstop = tabstop; ++ if (cntr_rows != DFLT_CNTR_ROWS) par.cntr_rows = cntr_rows; ++ if (cntr_cols != DFLT_CNTR_COLS) par.cntr_cols = cntr_cols; ++ if (vs_rows != DFLT_VS_ROWS) par.vs_rows = vs_rows; ++ if (vs_cols != DFLT_VS_COLS) par.vs_cols = vs_cols; ++ if (minor != HD44780_MINOR) par.minor = minor; ++#endif ++ ++ lcd_driver_setup(&hd44780); ++ if ((ret = lcd_register_driver(&hd44780, &par))) ++ return (ret); ++ ++#ifdef USE_PROC ++ if (hd44780.driver_proc_root) ++ create_proc_entries(); ++#endif ++ ++ printk(KERN_INFO "HD44780 driver (LCD-Linux" HD44780_VERSION ")\n"); ++ printk(KERN_INFO "Nuccio Raciti \n"); ++ ++ ++ return (0); ++} ++ ++/* Cleanup */ ++ ++static void __exit hd44780_cleanup_module(void) ++{ ++#ifdef USE_PROC ++ if (hd44780.driver_proc_root) ++ remove_proc_entries(); ++#endif ++ ++ lcd_unregister_driver(&hd44780, &par); ++} ++ ++module_init(hd44780_init_module) ++module_exit(hd44780_cleanup_module) +Index: linux-2.6.30.9/drivers/lcd-linux/lcd-linux.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.30.9/drivers/lcd-linux/lcd-linux.c 2009-11-24 02:01:42.000000000 +0100 +@@ -0,0 +1,2892 @@ ++/* lcd-linux.c ++ * ++ * ++ * ++ * Software layer to drive LCD displays under Linux. ++ * ++ * Copyright (C) 2005 - 2007 Mattia Jona-Lasinio (mjona@users.sourceforge.net) ++ * ++ * 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 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * ++ */ ++ ++#include ++ ++#ifndef KERNEL_VERSION ++#define KERNEL_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) ++#endif ++ ++#ifndef LINUX_VERSION_CODE ++#error - LINUX_VERSION_CODE undefined in 'linux/version.h' ++#endif ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) ++#include ++#else ++#include ++#endif ++#ifdef CONFIG_PROC_FS ++#define USE_PROC ++#else ++#undef USE_PROC ++#endif ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) ++#include ++#else ++#include ++#endif ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) ++#include ++#endif ++#include ++#include ++#include ++#include ++#include ++ ++#ifdef USE_PROC ++#include ++#endif ++ ++#define LCD_LINUX_MAIN ++#include ++ ++/*** struct_flags ***/ ++#define NEED_WRAP 0 /* Next char will trigger a newline */ ++#define DECIM 1 /* Insert mode */ ++#define DECAWM 2 /* Autowrap */ ++#define DECSCNM 3 /* Inverted screen */ ++#define CRLF 4 /* Follow lf, vt, ff, with a cr */ ++#define INC_CURS_POS 5 /* Increment cursor position after data read/write */ ++#define QUES 6 /* CSI Esc sequence contains a question mark */ ++#define USER_SPACE 7 /* If set, the buffer pointed by arg in do_lcd_ioctl() is ++ * assumed to be in user space otherwise it is in kernel space */ ++#define NULL_CHARMAP 8 /* The driver doesn't provide a charmap so the ++ * lcd-linux layer provides one*/ ++#define CAN_DO_COLOR 9 /* The display is color capable */ ++#define WITH_ATTR 10 /* If set, the void * buffer in do_lcd_read/write() contains ++ * attributes and therefore is an unsigned short * otherwise it ++ * is an unsigned char * ++ */ ++ ++/*** attributes ***/ ++#define I_MASK 0x03 /* Intensity (0 = low, 1 = normal, 2 = bright) */ ++#define ULINE 0x04 /* Underlined text */ ++#define REVERSE 0x08 /* Reversed video text */ ++#define BLINK 0x80 /* Blinking text */ ++ ++/*** Color attributes ***/ ++#define FG_MASK 0x0f /* Foreground color */ ++#define BG_MASK 0xf0 /* Background color */ ++ ++/* input states */ ++#define NORMAL 0x00001000 /* Normal mode */ ++#define RAW 0x00002000 /* Raw mode (console emulation disabled) */ ++#define SYN 0x00003000 /* Synchronous Idle mode */ ++#define ESC 0x00004000 /* Escape mode */ ++#define CSI 0x00005000 /* CSI escape mode */ ++#define ESC_G0 0x00006000 /* G0 character set */ ++#define ESC_G1 0x00007000 /* G1 character set */ ++#define ESC_HASH 0x00008000 /* ESC # escape sequence */ ++#define ESC_PERCENT 0x00009000 /* ESC % escape sequence */ ++#define ARG 0x0000a000 /* Waiting for arguments for the lcd-linux layer */ ++#define ARG_DRIVER 0x0000b000 /* Waiting for arguments for the display driver */ ++#define INPUT_MASK 0x0000f000 ++#define ESC_MASK 0x00ff0000 ++#define INIT_MASK 0x0f000000 ++#define PROC_MASK 0xf0000000 ++ ++#define SET_STATE(p, state, mask) ((p)->struct_flags = ((p)->struct_flags & ~(mask)) | ((state) & (mask))) ++#define SET_INPUT_STATE(p, state) SET_STATE(p, state, INPUT_MASK) ++#define SET_ESC_STATE(p, state) SET_STATE(p, (state) << 16, ESC_MASK) ++#define SET_INIT_LEVEL(p, level) SET_STATE(p, (level) << 24, INIT_MASK) ++#define SET_PROC_LEVEL(p, level) SET_STATE(p, (level) << 28, PROC_MASK) ++#define INPUT_STATE(p) ((p)->struct_flags & INPUT_MASK) ++#define ESC_STATE(p) (((p)->struct_flags & ESC_MASK) >> 16) ++#define INIT_LEVEL(p) (((p)->struct_flags & INIT_MASK) >> 24) ++#define PROC_LEVEL(p) (((p)->struct_flags & PROC_MASK) >> 28) ++ ++#define NPAR 16 /* Max number of parameters in CSI escape sequence */ ++#define FLIP_BUF_SIZE (1 << 6) /* Flip buffer size (64 bytes) */ ++ ++struct lcd_struct { ++ struct list_head lcd_list; /* Doubly linked list */ ++ struct semaphore lcd_sem; /* Locks this structure */ ++ struct lcd_driver *driver; /* The driver associated to this struct */ ++ struct lcd_parameters *par; /* The parameters associated to this struct */ ++ unsigned long struct_flags; /* Flags for internal use only */ ++ unsigned int refcount; /* Number of references to this struct */ ++ ++ unsigned short *display; /* The display buffer */ ++ ++ unsigned short *fb; /* The virtual screen framebuffer */ ++ unsigned int fb_size; /* Size of the framebuffer */ ++ unsigned int frame_base; /* Offset of row 0, column 0 of a frame in fb */ ++ unsigned int frame_size; /* Size of the frame */ ++ ++ unsigned int row; /* Current row in virtual screen */ ++ unsigned int col; /* Current column in virtual screen */ ++ unsigned int s_offset; /* Saved cursor position in virtual screen */ ++ ++ unsigned int top; /* Top scroll row in virtual screen */ ++ unsigned int bot; /* Bottom scroll row in virtual screen */ ++ ++ int esc_args; /* Number of arguments for a normal escape sequence */ ++ unsigned int csi_args[NPAR]; /* CSI parameters */ ++ unsigned int index; /* Index in csi_args and counter for cgram characters generation */ ++ unsigned char cgram_index; /* Index of the cgram character to be created */ ++ unsigned char *cgram_buffer; /* Buffer for cgram operations in this driver */ ++ ++ unsigned short erase_char; /* Character to be used when erasing */ ++ unsigned char attr; /* Current attributes */ ++ unsigned char color; /* Color for normal intensity mode */ ++ unsigned char s_color; /* Saved color for normal intensity mode */ ++ unsigned char defcolor; /* Default color for normal intensity mode */ ++ unsigned char ulcolor; /* Color for underline mode */ ++ unsigned char halfcolor; /* Color for low intensity mode */ ++ unsigned char attributes; /* Packed attributes */ ++ unsigned char s_attributes; /* Saved packed attributes */ ++ ++ unsigned char *s_charmap; /* Saved character map for this driver */ ++ unsigned char *flip_buf; /* High speed flip buffer */ ++}; ++ ++/** Function prototypes **/ ++ ++/* Init/Cleanup the driver */ ++static int init_driver(struct lcd_struct *); ++static int cleanup_driver(struct lcd_struct *); ++ ++/* Read from/Write to the driver */ ++static void read_data(struct lcd_struct *, unsigned short *); ++static void read_cgram(struct lcd_struct *, unsigned char, unsigned char *); ++static void write_data(struct lcd_struct *, unsigned short); ++static void write_cgram(struct lcd_struct *, unsigned char, unsigned char *); ++ ++/* Input handlers */ ++static void cr(struct lcd_struct *); ++static void lf(struct lcd_struct *); ++static void control_char(struct lcd_struct *, unsigned char); ++static void handle_csi(struct lcd_struct *, unsigned char); ++static int handle_custom_esc(struct lcd_struct *, unsigned int); ++static int handle_esc(struct lcd_struct *, unsigned char); ++static void handle_input(struct lcd_struct *, unsigned short); ++ ++/* Low level file operations */ ++static ssize_t do_lcd_read(struct lcd_struct *, void *, size_t); ++static ssize_t do_lcd_write(struct lcd_struct *, const void *, size_t); ++static int do_lcd_open(struct lcd_struct *); ++static int do_lcd_release(struct lcd_struct *); ++static int do_lcd_ioctl(struct lcd_struct *, unsigned int, unsigned long); ++ ++/* Proc functions */ ++#ifdef USE_PROC ++static void create_driver_proc_entries(struct lcd_struct *); ++static void remove_driver_proc_entries(struct lcd_struct *); ++#endif ++ ++/* globals */ ++static unsigned int major = LCD_MAJOR; /* Major number for LCD-Linux device */ ++static unsigned short minors = LCD_MINORS; /* Minor numbers allocated for LCD-Linux */ ++static LIST_HEAD(lcd_drivers); /* Registered lcd drivers */ ++static struct semaphore drivers_sem; /* Locks the lcd_drivers list */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) ++static struct class *lcd_linux_class; ++#endif ++#ifdef USE_PROC ++static struct proc_dir_entry *lcd_proc_root; ++#endif ++/* End of globals */ ++ ++#ifdef MODULE ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) ++#include ++MODULE_ALIAS_CHARDEV_MAJOR(LCD_MAJOR); ++#endif ++MODULE_DESCRIPTION("Software layer to drive LCD displays under Linux."); ++MODULE_AUTHOR("Mattia Jona-Lasinio "); ++#ifdef MODULE_LICENSE ++MODULE_LICENSE("GPL"); ++#endif ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) ++module_param(minors, ushort, 0444); ++#else ++MODULE_PARM(minors, "h"); ++#endif ++MODULE_PARM_DESC(minors, "Minor numbers allocated for LCD-Linux (default: " string(LCD_MINORS) ")"); ++#else ++ ++/* ++ * Parse boot command line ++ * ++ * lcd=minors ++ */ ++static int __init lcd_linux_boot_init(char *cmdline) ++{ ++ unsigned short args; ++ ++ if ((args = simple_strtoul(cmdline, NULL, 0))) ++ minors = args; ++ ++ return (1); ++} ++ ++__setup("lcd=", lcd_linux_boot_init); ++#endif /* MODULE */ ++ ++/* Macros for iterator handling */ ++static inline unsigned int iterator_inc_(unsigned int iterator, const unsigned int module) ++{ ++ return ((++iterator)%module); ++} ++ ++static inline unsigned int iterator_dec_(unsigned int iterator, const unsigned int module) ++{ ++ return (iterator ? --iterator : module-1); ++} ++ ++#define iterator_inc(iterator, module) (iterator = iterator_inc_(iterator, module)) ++#define iterator_dec(iterator, module) (iterator = iterator_dec_(iterator, module)) ++ ++/* Uncomment the following two lines ++ * for non-atomic set_bit and clear_bit ++#define set_bit __set_bit ++#define clear_bit __clear_bit ++*/ ++ ++/************************************ ++ * Low level routines and utilities * ++ ************************************/ ++/* ++ * Set whether the address counter should be incremented ++ * or decremented after a Read/Write ++ */ ++static void address_mode(struct lcd_struct *p, int mode) ++{ ++ struct lcd_driver *driver = p->driver; ++ ++ if (mode > 0 && ! test_bit(INC_CURS_POS, &p->struct_flags)) { ++ if (driver->address_mode) ++ driver->address_mode(mode); ++ set_bit(INC_CURS_POS, &p->struct_flags); ++ } else if (mode < 0 && test_bit(INC_CURS_POS, &p->struct_flags)) { ++ if (driver->address_mode) ++ driver->address_mode(mode); ++ clear_bit(INC_CURS_POS, &p->struct_flags); ++ } ++} ++ ++/* WARNING!! This function returns an int because if iterator is not ++ * within the visible area of the frame it returns -1 ++ */ ++static inline int vs_to_frame_(struct lcd_struct *p, unsigned int iterator) ++{ ++ unsigned int vs_cols = p->par->vs_cols; ++ unsigned int row = iterator/vs_cols; ++ unsigned int col = iterator%vs_cols; ++ unsigned int frame_base_row = p->frame_base/vs_cols; ++ unsigned int frame_base_col = p->frame_base%vs_cols; ++ unsigned int frame_rows = p->par->cntr_rows*p->par->num_cntr; ++ unsigned int frame_cols = p->par->cntr_cols; ++ ++ if (row < frame_base_row || row >= frame_base_row+frame_rows) ++ return (-1); ++ if (col < frame_base_col || col >= frame_base_col+frame_cols) ++ return (-1); ++ ++ return ((row-frame_base_row)*frame_cols+(col-frame_base_col)); ++} ++ ++/* Given 'iterator' in vs, returns the offset in vs corresponding to the nearest ++ * visible offset in vs, or returns 'iterator' if it is already visible. ++ */ ++static unsigned int round_vs_(struct lcd_struct *p, unsigned int iterator) ++{ ++ unsigned int vs_cols = p->par->vs_cols; ++ unsigned int row = iterator/vs_cols; ++ unsigned int col = iterator%vs_cols; ++ unsigned int frame_base_row = p->frame_base/vs_cols; ++ unsigned int frame_base_col = p->frame_base%vs_cols; ++ unsigned int frame_rows = p->par->cntr_rows*p->par->num_cntr; ++ unsigned int frame_cols = p->par->cntr_cols; ++ ++ if (row < frame_base_row) ++ row = frame_base_row; ++ else if (row >= frame_base_row+frame_rows) ++ row = frame_base_row+(frame_rows-1); ++ ++ if (col < frame_base_col) ++ col = frame_base_col; ++ else if (col >= frame_base_col+frame_cols) ++ col = frame_base_col+(frame_cols-1); ++ ++ return ((row*vs_cols)+col); ++} ++ ++#define round_vs(p, iterator) (iterator = round_vs_(p, iterator)) ++ ++/* ++ * Sync the frame area starting at offset s, ending at offset e with fb content. ++ */ ++static void redraw_screen(struct lcd_struct *p, unsigned int s, unsigned int e) ++{ ++ unsigned int len; ++ unsigned int row = p->row, col = p->col; ++ unsigned int inc_set = test_bit(INC_CURS_POS, &p->struct_flags); ++ unsigned int frame_cols = p->par->cntr_cols; ++ unsigned int vs_cols = p->par->vs_cols; ++ unsigned long flags; ++ ++ if (s >= p->fb_size || e >= p->fb_size || e < s || e < p->frame_base) ++ return; ++ ++ round_vs(p, s); ++ round_vs(p, e); ++ ++ len = 1+e-s; ++ ++ if (! inc_set) ++ s = e; ++ ++ p->row = s/vs_cols; ++ p->col = s%vs_cols; ++ ++ flags = p->struct_flags; ++ clear_bit(NEED_WRAP, &p->struct_flags); ++ clear_bit(DECIM, &p->struct_flags); ++ set_bit(DECAWM, &p->struct_flags); ++ SET_INPUT_STATE(p, RAW); ++ if (inc_set) ++ while (len--) ++ if (vs_to_frame_(p, (p->row*vs_cols)+p->col) < 0) { ++ s += vs_cols-frame_cols; ++ len -= vs_cols-frame_cols-1; ++ p->row = s/vs_cols; ++ p->col = s%vs_cols; ++ } else { ++ write_data(p, p->fb[s++]); ++ if (test_bit(NEED_WRAP, &p->struct_flags)) { ++ cr(p); ++ lf(p); ++ } ++ } ++ else ++ while (len--) ++ if (vs_to_frame_(p, (p->row*vs_cols)+p->col) < 0) { ++ s -= vs_cols-frame_cols; ++ len -= vs_cols-frame_cols-1; ++ p->row = s/vs_cols; ++ p->col = s%vs_cols; ++ } else { ++ write_data(p, p->fb[s--]); ++ if (test_bit(NEED_WRAP, &p->struct_flags)) { ++ cr(p); ++ lf(p); ++ } ++ } ++ p->struct_flags = flags; ++ ++ p->row = row; p->col = col; ++} ++ ++static int make_cursor_visible(struct lcd_struct *p) ++{ ++ unsigned int vs_rows = p->par->vs_rows; ++ unsigned int vs_cols = p->par->vs_cols; ++ unsigned int frame_base, frame_base_row, frame_base_col; ++ unsigned int frame_rows = p->par->cntr_rows*p->par->num_cntr; ++ unsigned int frame_cols = p->par->cntr_cols; ++ unsigned int tmp = frame_cols/2; ++ ++ if (test_bit(INC_CURS_POS, &p->struct_flags)) { ++ /* cursor always on the lowest row of the display */ ++ frame_base_row = 0; ++ frame_base_col = 0; ++ if (p->row >= frame_rows) ++ frame_base_row = p->row-(frame_rows-1); ++ if (p->col >= frame_cols) { ++ frame_base_col = p->col-(frame_cols-1); ++ if (tmp) { ++ tmp = (tmp-(frame_base_col%tmp))%tmp; ++ if (frame_base_col+tmp <= vs_cols-frame_cols) ++ frame_base_col += tmp; ++ } ++ } ++ } else { ++ /* cursor always on the uppermost row of the display */ ++ frame_base_row = vs_rows-frame_rows; ++ frame_base_col = vs_cols-frame_cols; ++ if (p->row < vs_rows-frame_rows) ++ frame_base_row = p->row; ++ if (p->col < vs_cols-frame_cols) { ++ frame_base_col = p->col; ++ if (tmp) { ++ tmp = frame_base_col%tmp; ++ if (frame_base_col >= tmp) ++ frame_base_col -= tmp; ++ } ++ } ++ } ++ ++ frame_base = p->frame_base; ++ p->frame_base = (frame_base_row*vs_cols)+frame_base_col; ++ ++ return (frame_base != p->frame_base); ++} ++ ++/* ++ * Move the visible screen area at user's wish ++ */ ++static void browse_screen(struct lcd_struct *p, unsigned char dir) ++{ ++ unsigned int vs_rows = p->par->vs_rows; ++ unsigned int vs_cols = p->par->vs_cols; ++ unsigned int frame_base_row = p->frame_base/vs_cols; ++ unsigned int frame_base_col = p->frame_base%vs_cols; ++ unsigned int frame_rows = p->par->cntr_rows*p->par->num_cntr; ++ unsigned int frame_cols = p->par->cntr_cols; ++ ++ switch (dir) { ++ case '1': /* Up */ ++ if (! frame_base_row) ++ return; ++ --frame_base_row; ++ break; ++ case '2': /* Down */ ++ if (frame_base_row >= vs_rows-frame_rows) ++ return; ++ ++frame_base_row; ++ break; ++ case '3': /* Left */ ++ if (! frame_base_col) ++ return; ++ --frame_base_col; ++ break; ++ case '4': /* Right */ ++ if (frame_base_col >= vs_cols-frame_cols) ++ return; ++ ++frame_base_col; ++ break; ++ default: ++ return; ++ } ++ ++ p->frame_base = (frame_base_row*vs_cols)+frame_base_col; ++ redraw_screen(p, 0, p->fb_size-1); ++} ++ ++static inline void __memset_short(unsigned short *buf, unsigned short c, unsigned int len) ++{ ++ while (len--) ++ *buf++ = c; ++} ++ ++/* ++ * A memset implementation writing to LCD instead of memory locations. ++ */ ++static void lcd_memset(struct lcd_struct *p, unsigned int d, unsigned short c, unsigned int len) ++{ ++ unsigned int inc_set = test_bit(INC_CURS_POS, &p->struct_flags); ++ ++ if (! len || d >= p->fb_size) ++ return; ++ ++ if (inc_set && d+len > p->fb_size) ++ len = p->fb_size-d; ++ else if (! inc_set && len > d+1) ++ len = d+1; ++ ++ if (! inc_set) ++ d -= len-1; ++ __memset_short(p->fb+d, c, len); ++ ++ if (make_cursor_visible(p)) ++ redraw_screen(p, 0, p->fb_size-1); ++ else ++ redraw_screen(p, d, d+(len-1)); ++} ++ ++static inline void __memcpy_short(unsigned short *d, unsigned short *s, unsigned int len, int dir) ++{ ++ if (dir > 0) ++ while (len--) ++ *d++ = *s++; ++ else ++ while (len--) ++ *d-- = *s--; ++} ++ ++/* ++ * A memmove implementation writing to LCD instead of memory locations. ++ * Copy is done in a non destructive way. Display regions may overlap. ++ */ ++static void lcd_memmove(struct lcd_struct *p, unsigned int d, unsigned int s, unsigned int len) ++{ ++ if (! len || d == s || d >= p->fb_size || s >= p->fb_size) ++ return; ++ ++ if (d < s) { ++ if (test_bit(INC_CURS_POS, &p->struct_flags)) { ++ if (s+len > p->fb_size) ++ len = p->fb_size-s; ++ } else { ++ if (len > d+1) ++ len = d+1; ++ d -= len-1; ++ s -= len-1; ++ } ++ __memcpy_short(p->fb+d, p->fb+s, len, 1); ++ if (make_cursor_visible(p)) ++ redraw_screen(p, 0, p->fb_size-1); ++ else ++ redraw_screen(p, d, d+(len-1)); ++ } else { ++ if (test_bit(INC_CURS_POS, &p->struct_flags)) { ++ if (d+len > p->fb_size) ++ len = p->fb_size-d; ++ d += len-1; ++ s += len-1; ++ } else { ++ if (len > s+1) ++ len = s+1; ++ } ++ __memcpy_short(p->fb+d, p->fb+s, len, -1); ++ if (make_cursor_visible(p)) ++ redraw_screen(p, 0, p->fb_size-1); ++ else ++ redraw_screen(p, d-(len-1), d); ++ } ++} ++ ++static void scrup(struct lcd_struct *p, unsigned int t, unsigned int b, unsigned int nr) ++{ ++ unsigned int vs_rows = p->par->vs_rows; ++ unsigned int vs_cols = p->par->vs_cols; ++ unsigned int d, s; ++ ++ if (t+nr >= b) ++ nr = b-t-1; ++ if (b > vs_rows || t >= b || nr < 1) ++ return; ++ d = t*vs_cols; ++ s = (t+nr)*vs_cols; ++ if (test_bit(INC_CURS_POS, &p->struct_flags)) { ++ lcd_memmove(p, d, s, (b-t-nr)*vs_cols); ++ lcd_memset(p, d+(b-t-nr)*vs_cols, p->erase_char, nr*vs_cols); ++ } else { ++ lcd_memmove(p, d+(b-t-nr)*vs_cols-1, s+(b-t-nr)*vs_cols-1, (b-t-nr)*vs_cols); ++ lcd_memset(p, d+(b-t)*vs_cols-1, p->erase_char, nr*vs_cols); ++ } ++} ++ ++static void scrdown(struct lcd_struct *p, unsigned int t, unsigned int b, unsigned int nr) ++{ ++ unsigned int vs_rows = p->par->vs_rows; ++ unsigned int vs_cols = p->par->vs_cols; ++ unsigned int d, s; ++ ++ if (t+nr >= b) ++ nr = b-t-1; ++ if (b > vs_rows || t >= b || nr < 1) ++ return; ++ s = t*vs_cols; ++ d = (t+nr)*vs_cols; ++ if (test_bit(INC_CURS_POS, &p->struct_flags)) { ++ lcd_memmove(p, d, s, (b-t-nr)*vs_cols); ++ lcd_memset(p, s, p->erase_char, nr*vs_cols); ++ } else { ++ lcd_memmove(p, d+(b-t-nr)*vs_cols-1, s+(b-t-nr)*vs_cols-1, (b-t-nr)*vs_cols); ++ lcd_memset(p, s+nr*vs_cols-1, p->erase_char, nr*vs_cols); ++ } ++} ++ ++static void lcd_insert_char(struct lcd_struct *p, unsigned int nr) ++{ ++ unsigned int vs_cols = p->par->vs_cols; ++ unsigned int pos = (p->row*vs_cols)+p->col; ++ ++ clear_bit(NEED_WRAP, &p->struct_flags); ++ if (test_bit(INC_CURS_POS, &p->struct_flags)) ++ lcd_memmove(p, pos+nr, pos, vs_cols-p->col-nr); ++ else ++ lcd_memmove(p, pos-nr, pos, p->col-(nr-1)); ++ lcd_memset(p, pos, p->erase_char, nr); ++} ++ ++static void lcd_delete_char(struct lcd_struct *p, unsigned int nr) ++{ ++ unsigned int vs_cols = p->par->vs_cols; ++ unsigned int pos = (p->row*vs_cols)+p->col; ++ ++ clear_bit(NEED_WRAP, &p->struct_flags); ++ if (test_bit(INC_CURS_POS, &p->struct_flags)) { ++ lcd_memmove(p, pos, pos+nr, vs_cols-(p->col+nr)); ++ lcd_memset(p, (p->row+1)*vs_cols-nr, p->erase_char, nr); ++ } else { ++ lcd_memmove(p, pos, pos-nr, p->col-(nr-1)); ++ lcd_memset(p, (p->row*vs_cols)+(nr-1), p->erase_char, nr); ++ } ++} ++ ++ ++ ++ ++ ++/****************************************************************************** ++ ************************* VT 102 Emulation ************************* ++ ******************************************************************************/ ++ ++/********************** ++ * Control characters * ++ **********************/ ++static void bs(struct lcd_struct *p) ++{ ++ clear_bit(NEED_WRAP, &p->struct_flags); ++ if (test_bit(INC_CURS_POS, &p->struct_flags)) { ++ if (p->col) ++ --p->col; ++ } else { ++ if (p->col+1 < p->par->vs_cols) ++ ++p->col; ++ } ++} ++ ++static void cr(struct lcd_struct *p) ++{ ++ clear_bit(NEED_WRAP, &p->struct_flags); ++ p->col = (test_bit(INC_CURS_POS, &p->struct_flags) ? 0 : p->par->vs_cols-1); ++} ++ ++static void lf(struct lcd_struct *p) ++{ ++ clear_bit(NEED_WRAP, &p->struct_flags); ++ if (test_bit(INC_CURS_POS, &p->struct_flags)) { ++ if (p->row+1 == p->bot && INPUT_STATE(p) != RAW) { ++ make_cursor_visible(p); ++ scrup(p, p->top, p->bot, 1); ++ } else if (p->row+1 < p->par->vs_rows) ++ ++p->row; ++ } else { ++ if (p->row == p->top && INPUT_STATE(p) != RAW) { ++ make_cursor_visible(p); ++ scrdown(p, p->top, p->bot, 1); ++ } else if (p->row) ++ --p->row; ++ } ++} ++ ++static void ri(struct lcd_struct *p) ++{ ++ clear_bit(NEED_WRAP, &p->struct_flags); ++ if (test_bit(INC_CURS_POS, &p->struct_flags)) { ++ if (p->row == p->top) { ++ make_cursor_visible(p); ++ scrdown(p, p->top, p->bot, 1); ++ } else if (p->row) ++ --p->row; ++ } else { ++ if (p->row+1 == p->bot) { ++ make_cursor_visible(p); ++ scrup(p, p->top, p->bot, 1); ++ } else if (p->row+1 < p->par->vs_rows) ++ ++p->row; ++ } ++} ++ ++static void ff(struct lcd_struct *p) ++{ ++ unsigned int vs_rows = p->par->vs_rows; ++ unsigned int vs_cols = p->par->vs_cols; ++ ++ clear_bit(NEED_WRAP, &p->struct_flags); ++ if (p->driver->clear_display) { ++ p->driver->clear_display(); ++ __memset_short(p->fb, p->erase_char, p->fb_size); ++ __memset_short(p->display, p->erase_char, p->frame_size); ++ p->frame_base = 0; ++ } else if (test_bit(INC_CURS_POS, &p->struct_flags)) ++ lcd_memset(p, 0, p->erase_char, p->fb_size); ++ else ++ lcd_memset(p, p->fb_size-1, p->erase_char, p->fb_size); ++ ++ if (test_bit(INC_CURS_POS, &p->struct_flags)) ++ p->row = p->col = 0; ++ else { ++ p->row = vs_rows-1; ++ p->col = vs_cols-1; ++ } ++} ++ ++static void tab(struct lcd_struct *p) ++{ ++ struct lcd_parameters *par = p->par; ++ unsigned int i, vs_cols = par->vs_cols; ++ ++ clear_bit(NEED_WRAP, &p->struct_flags); ++ ++ if (! par->tabstop) ++ return; ++ ++ if (test_bit(INC_CURS_POS, &p->struct_flags)) { ++ i = par->tabstop-(p->col%par->tabstop); ++ if (p->col+i < vs_cols) ++ p->col += i; ++ } else { ++ i = p->col%par->tabstop; ++ i = (i == 0 ? par->tabstop : i); ++ if (p->col >= i) ++ p->col -= i; ++ } ++} ++ ++/* ++ * Control character handler. ++ */ ++static void control_char(struct lcd_struct *p, unsigned char val) ++{ ++ switch (val) { ++ case 0x08: /* BS: Back Space (^H) */ ++ case 0x7f: /* DEL: Delete */ ++ bs(p); ++ return; ++ ++ case 0x09: /* HT: Horizontal Tab (^I) */ ++ tab(p); ++ return; ++ ++ case 0x0c: /* FF: Form Feed (^L) */ ++ ff(p); ++ return; ++ ++ case 0x0a: /* LF: Line Feed (^J) */ ++ case 0x0b: /* VT: Vertical Tab (^K) */ ++ lf(p); ++ if (! test_bit(CRLF, &p->struct_flags)) ++ return; ++ ++ case 0x0d: /* CR: Carriage Return (^M) */ ++ cr(p); ++ return; ++ ++ case 0x16: /* SYN: Synchronous Idle (^V) */ ++ SET_INPUT_STATE(p, SYN); ++ return; ++ ++ case 0x1b: /* ESC: Start of escape sequence */ ++ SET_INPUT_STATE(p, ESC); ++ return; ++ ++ case 0x9b: /* CSI: Start of CSI escape sequence */ ++ memset(p->csi_args, 0, sizeof(p->csi_args)); ++ p->index = 0; ++ SET_INPUT_STATE(p, CSI); ++ return; ++ } ++} ++ ++static void gotoxy(struct lcd_struct *p, int new_col, int new_row) ++{ ++ unsigned int vs_rows = p->par->vs_rows; ++ unsigned int vs_cols = p->par->vs_cols; ++ ++ clear_bit(NEED_WRAP, &p->struct_flags); ++ if (new_row < 0) ++ p->row = 0; ++ else if (new_row >= vs_rows) ++ p->row = vs_rows-1; ++ else ++ p->row = new_row; ++ ++ if (new_col < 0) ++ p->col = 0; ++ else if (new_col >= vs_cols) ++ p->col = vs_cols-1; ++ else ++ p->col = new_col; ++ ++ if (make_cursor_visible(p)) ++ redraw_screen(p, 0, p->fb_size-1); ++} ++ ++ ++/****************************** ++ * ECMA-48 CSI ESC- sequences * ++ ******************************/ ++static void csi_at(struct lcd_struct *p, unsigned int nr) ++{ ++ unsigned int vs_cols = p->par->vs_cols; ++ ++ if (p->col+nr > vs_cols) ++ nr = vs_cols-p->col; ++ else if (! nr) ++ ++nr; ++ lcd_insert_char(p, nr); ++} ++ ++static void csi_J(struct lcd_struct *p, unsigned int action) ++{ ++ unsigned int vs_cols = p->par->vs_cols; ++ unsigned int pos = (p->row*vs_cols)+p->col; ++ ++ clear_bit(NEED_WRAP, &p->struct_flags); ++ switch (action) { ++ case 0: /* From cursor to end of display */ ++ lcd_memset(p, pos, p->erase_char, p->fb_size-pos); ++ return; ++ ++ case 1: /* From start of display to cursor */ ++ lcd_memset(p, 0, p->erase_char, pos+1); ++ return; ++ ++ case 2: /* Whole display */ ++ lcd_memset(p, 0, p->erase_char, p->fb_size); ++ return; ++ } ++} ++ ++static void csi_K(struct lcd_struct *p, unsigned int action) ++{ ++ unsigned int vs_cols = p->par->vs_cols; ++ unsigned int row_start = p->row*vs_cols; ++ ++ clear_bit(NEED_WRAP, &p->struct_flags); ++ switch (action) { ++ case 0: /* From cursor to end of line */ ++ lcd_memset(p, row_start+p->col, p->erase_char, vs_cols-p->col); ++ return; ++ ++ case 1: /* From start of line to cursor */ ++ lcd_memset(p, row_start, p->erase_char, p->col+1); ++ return; ++ ++ case 2: /* Whole line */ ++ lcd_memset(p, row_start, p->erase_char, vs_cols); ++ return; ++ } ++} ++ ++static void csi_L(struct lcd_struct *p, unsigned int nr) ++{ ++ unsigned int vs_rows = p->par->vs_rows; ++ unsigned int vs_cols = p->par->vs_cols; ++ ++ clear_bit(NEED_WRAP, &p->struct_flags); ++ if (p->row+nr > vs_rows) ++ nr = vs_rows-p->row; ++ else if (! nr) ++ ++nr;; ++ lcd_memmove(p, (p->row+nr)*vs_cols, p->row*vs_cols, (vs_rows-p->row-nr)*vs_cols); ++ lcd_memset(p, p->row*vs_cols, p->erase_char, nr*vs_cols); ++} ++ ++static void csi_M(struct lcd_struct *p, unsigned int nr) ++{ ++ unsigned int vs_rows = p->par->vs_rows; ++ unsigned int vs_cols = p->par->vs_cols; ++ ++ clear_bit(NEED_WRAP, &p->struct_flags); ++ if (p->row+nr > vs_rows) ++ nr = vs_rows-p->row; ++ else if (! nr) ++ ++nr;; ++ lcd_memmove(p, p->row*vs_cols, (p->row+nr)*vs_cols, (vs_rows-p->row-nr)*vs_cols); ++ lcd_memset(p, (vs_rows-nr)*vs_cols, p->erase_char, nr*vs_cols); ++} ++ ++static void csi_P(struct lcd_struct *p, unsigned int nr) ++{ ++ unsigned int vs_cols = p->par->vs_cols; ++ ++ if (p->col+nr > vs_cols) ++ nr = vs_cols-p->col; ++ else if (! nr) ++ ++nr; ++ lcd_delete_char(p, nr); ++} ++ ++static void csi_X(struct lcd_struct *p, unsigned int nr) ++{ ++ unsigned int vs_cols = p->par->vs_cols; ++ ++ clear_bit(NEED_WRAP, &p->struct_flags); ++ if (p->col+nr > vs_cols) ++ nr = vs_cols-p->col; ++ else if (! nr) ++ ++nr; ++ lcd_memset(p, (p->row*vs_cols)+p->col, p->erase_char, nr); ++} ++ ++static void csi_su(struct lcd_struct *p, unsigned char input) ++{ ++ unsigned int vs_cols = p->par->vs_cols; ++ ++ clear_bit(NEED_WRAP, &p->struct_flags); ++ if (input == 'u') { ++ p->row = p->s_offset/vs_cols; ++ p->col = p->s_offset%vs_cols; ++ p->color = p->s_color; ++ p->attributes = p->s_attributes; ++ return; ++ } ++ p->s_offset = (p->row*vs_cols)+p->col; ++ p->s_color = p->color; ++ p->s_attributes = p->attributes; ++} ++ ++static unsigned char build_attr(struct lcd_struct *p, unsigned char color, unsigned char intensity, ++ unsigned char blink, unsigned char underline, unsigned char reverse) ++{ ++ unsigned char attr; ++ ++ if (test_bit(CAN_DO_COLOR, &p->struct_flags)) { ++ attr = color; ++ if (underline) ++ attr = (attr & BG_MASK) | p->ulcolor; ++ else if (intensity == 0) ++ attr = (attr & BG_MASK) | p->halfcolor; ++ if (reverse) ++ attr = (attr & 0x88) | ((attr & 0x70) >> 4) | ((attr & 0x07) << 4); ++ if (blink) ++ attr ^= 0x80; ++ if (intensity == 2) ++ attr ^= 0x08; ++ } else { ++ attr = intensity; ++ attr |= (underline ? ULINE : 0x00); ++ attr |= (reverse ? REVERSE : 0x00); ++ attr |= (blink ? BLINK : 0x00); ++ } ++ ++ return (attr); ++} ++ ++static void update_attr(struct lcd_struct *p) ++{ ++ unsigned char intensity = p->attributes & 0x03; ++ unsigned char underline = (p->attributes >> 2) & 0x01; ++ unsigned char reverse = (p->attributes >> 3) & 0x01; ++ unsigned char blink = (p->attributes >> 7) & 0x01; ++ unsigned char decscnm = (p->struct_flags >> DECSCNM) & 0x01; ++ ++ p->attr = build_attr(p, p->color, intensity, blink, underline, reverse^decscnm); ++ p->erase_char = (build_attr(p, p->color, 1, blink, 0, decscnm) << 8) | ' '; ++} ++ ++static void default_attr(struct lcd_struct *p) ++{ ++ p->attributes = 0x01; ++ p->color = p->defcolor; ++} ++ ++static void lcd_invert_screen(struct lcd_struct *p, unsigned int offset, unsigned int len) ++{ ++ if (test_bit(CAN_DO_COLOR, &p->struct_flags)) ++ while (len--) { ++ p->fb[offset] = (p->fb[offset] & 0x88ff) | ((p->fb[offset] & 0x7000) >> 4) | ((p->fb[offset] & 0x0700) << 4); ++ ++offset; ++ } ++ else ++ while (len--) { ++ p->fb[offset] ^= 0x0800; ++ ++offset; ++ } ++} ++ ++static void csi_m(struct lcd_struct *p, unsigned int n) ++{ ++ int i, arg; ++ ++ for (i = 0; i <= n; ++i) ++ switch ((arg = p->csi_args[i])) ++ { ++ case 0: ++ default_attr(p); ++ break; ++ ++ case 1: ++ p->attributes = (p->attributes & ~I_MASK) | 2; ++ break; ++ ++ case 2: ++ p->attributes = (p->attributes & ~I_MASK) | 0; ++ break; ++ ++ case 4: ++ p->attributes |= ULINE; ++ break; ++ ++ case 5: ++ p->attributes |= BLINK; ++ break; ++ ++ case 7: ++ p->attributes |= REVERSE; ++ break; ++ ++ case 21: case 22: ++ p->attributes = (p->attributes & ~I_MASK) | 1; ++ break; ++ ++ case 24: ++ p->attributes &= ~ULINE; ++ break; ++ ++ case 25: ++ p->attributes &= ~BLINK; ++ break; ++ ++ case 27: ++ p->attributes &= ~REVERSE; ++ break; ++ ++ case 38: ++ p->attributes |= ULINE; ++ p->color = (p->color & BG_MASK) | (p->defcolor & FG_MASK); ++ break; ++ ++ case 39: ++ p->attributes &= ~ULINE; ++ p->color = (p->color & BG_MASK) | (p->defcolor & FG_MASK); ++ break; ++ ++ case 49: ++ p->color = (p->defcolor & BG_MASK) | (p->color & FG_MASK); ++ break; ++ ++ default: ++ if (arg >= 30 && arg <= 37) ++ p->color = (p->color & BG_MASK) | color_table[arg-30]; ++ else if (arg >= 40 && arg <= 47) ++ p->color = (p->color & FG_MASK) | (color_table[arg-40] << 4); ++ break; ++ } ++ ++ update_attr(p); ++} ++ ++static void csi_h(struct lcd_struct *p, unsigned char n) ++{ ++ switch (n) { ++ case 4: /* Set insert mode */ ++ set_bit(DECIM, &p->struct_flags); ++ return; ++ ++ case 5: /* Inverted screen mode */ ++ if (test_bit(QUES, &p->struct_flags) && ! test_bit(DECSCNM, &p->struct_flags)) { ++ set_bit(DECSCNM, &p->struct_flags); ++ lcd_invert_screen(p, 0, p->fb_size); ++ update_attr(p); ++ redraw_screen(p, 0, p->fb_size-1); ++ } ++ return; ++ ++ case 7: /* Set autowrap */ ++ if (test_bit(QUES, &p->struct_flags)) ++ set_bit(DECAWM, &p->struct_flags); ++ return; ++ ++ case 20: /* Set cr lf */ ++ set_bit(CRLF, &p->struct_flags); ++ return; ++ } ++} ++ ++static void csi_l(struct lcd_struct *p, unsigned char n) ++{ ++ switch (n) { ++ case 4: /* Reset insert mode */ ++ clear_bit(DECIM, &p->struct_flags); ++ return; ++ ++ case 5: /* Normal screen mode */ ++ if (test_bit(QUES, &p->struct_flags) && test_bit(DECSCNM, &p->struct_flags)) { ++ clear_bit(DECSCNM, &p->struct_flags); ++ lcd_invert_screen(p, 0, p->fb_size); ++ update_attr(p); ++ redraw_screen(p, 0, p->fb_size-1); ++ } ++ return; ++ ++ case 7: /* Reset autowrap */ ++ if (test_bit(QUES, &p->struct_flags)) ++ clear_bit(DECAWM, &p->struct_flags); ++ return; ++ ++ case 20: /* Reset cr lf */ ++ clear_bit(CRLF, &p->struct_flags); ++ return; ++ } ++} ++ ++static void csi_linux(struct lcd_struct *p) ++{ ++ switch (p->csi_args[0]) { ++ case 1: ++ if (test_bit(CAN_DO_COLOR, &p->struct_flags) && p->csi_args[1] < 16) { ++ p->ulcolor = color_table[p->csi_args[1]]; ++ if (p->attributes & ULINE) ++ update_attr(p); ++ } ++ return; ++ ++ case 2: ++ if (test_bit(CAN_DO_COLOR, &p->struct_flags) && p->csi_args[1] < 16) { ++ p->halfcolor = color_table[p->csi_args[1]]; ++ if ((p->attributes & I_MASK) == 0) ++ update_attr(p); ++ } ++ return; ++ ++ case 8: ++ p->defcolor = p->color; ++ default_attr(p); ++ update_attr(p); ++ return; ++ } ++} ++ ++static void csi_r(struct lcd_struct *p, unsigned int top, unsigned int bot) ++{ ++ /* Minimum allowed region is 2 lines */ ++ if (top < bot) { ++ p->top = top-1; ++ p->bot = bot; ++ gotoxy(p, 0, 0); ++ } ++} ++ ++/* ++ * ECMA-48 CSI ESC- sequence handler. ++ */ ++static void handle_csi(struct lcd_struct *p, unsigned char input) ++{ ++ if (p->index >= NPAR) { ++ SET_INPUT_STATE(p, NORMAL); ++ printk(KERN_NOTICE "LCD: too many parameters in CSI escape sequence\n"); ++ } else if (input == '?') { ++ set_bit(QUES, &p->struct_flags); ++ } else if (input == ';') { ++ ++p->index; ++ } else if (input >= '0' && input <= '9') { ++ p->csi_args[p->index] = (p->csi_args[p->index]*10)+(input-'0'); ++ } else { ++ SET_INPUT_STATE(p, NORMAL); ++ if (! test_bit(INC_CURS_POS, &p->struct_flags)) ++ return; ++ switch (input) { ++ case 'h': /* DECSET sequences and mode switches */ ++ csi_h(p, p->csi_args[0]); ++ clear_bit(QUES, &p->struct_flags); ++ return; ++ ++ case 'l': /* DECRST sequences and mode switches */ ++ csi_l(p, p->csi_args[0]); ++ clear_bit(QUES, &p->struct_flags); ++ return; ++ } ++ clear_bit(QUES, &p->struct_flags); ++ switch (input) { ++ case '@': /* Insert # Blank character */ ++ csi_at(p, p->csi_args[0]); ++ return; ++ ++ case 'G': case '`': /* Cursor to indicated column in current row */ ++ if (p->csi_args[0]) ++ --p->csi_args[0]; ++ gotoxy(p, p->csi_args[0], p->row); ++ return; ++ ++ case 'A': /* Cursor # rows Up */ ++ if (! p->csi_args[0]) ++ ++p->csi_args[0]; ++ gotoxy(p, p->col, p->row-p->csi_args[0]); ++ return; ++ ++ case 'B': case 'e': /* Cursor # rows Down */ ++ if (! p->csi_args[0]) ++ ++p->csi_args[0]; ++ gotoxy(p, p->col, p->row+p->csi_args[0]); ++ return; ++ ++ case 'C': case 'a': /* Cursor # columns Right */ ++ if (! p->csi_args[0]) ++ ++p->csi_args[0]; ++ gotoxy(p, p->col+p->csi_args[0], p->row); ++ return; ++ ++ case 'D': /* Cursor # columns Left */ ++ if (! p->csi_args[0]) ++ ++p->csi_args[0]; ++ gotoxy(p, p->col-p->csi_args[0], p->row); ++ return; ++ ++ case 'E': /* Cursor # rows Down, column 1 */ ++ if (! p->csi_args[0]) ++ ++p->csi_args[0]; ++ gotoxy(p, 0, p->row+p->csi_args[0]); ++ return; ++ ++ case 'F': /* Cursor # rows Up, column 1 */ ++ if (! p->csi_args[0]) ++ ++p->csi_args[0]; ++ gotoxy(p, 0, p->row-p->csi_args[0]); ++ return; ++ ++ case 'd': /* Cursor to indicated row in current column */ ++ if (p->csi_args[0]) ++ --p->csi_args[0]; ++ gotoxy(p, p->col, p->csi_args[0]); ++ return; ++ ++ case 'H': case 'f': /* Cursor to indicated row, column (origin 1, 1) */ ++ if (p->csi_args[0]) ++ --p->csi_args[0]; ++ if (p->csi_args[1]) ++ --p->csi_args[1]; ++ gotoxy(p, p->csi_args[1], p->csi_args[0]); ++ return; ++ ++ case 'J': /* Erase display */ ++ csi_J(p, p->csi_args[0]); ++ return; ++ ++ case 'K': /* Erase line */ ++ csi_K(p, p->csi_args[0]); ++ return; ++ ++ case 'L': /* Insert # blank lines */ ++ csi_L(p, p->csi_args[0]); ++ return; ++ ++ case 'M': /* Delete # blank lines */ ++ csi_M(p, p->csi_args[0]); ++ return; ++ ++ case 'P': /* Delete # characters on the current line */ ++ csi_P(p, p->csi_args[0]); ++ return; ++ ++ case 'X': /* Erase # characters on the current line */ ++ csi_X(p, p->csi_args[0]); ++ return; ++ ++ case 'm': /* Set video attributes */ ++ csi_m(p, p->index); ++ return; ++ ++ case 's': /* Save cursor position */ ++ case 'u': /* Restore cursor position */ ++ csi_su(p, input); ++ return; ++ ++ case ']': /* Linux private ESC [ ] sequence */ ++ csi_linux(p); ++ return; ++ ++ case 'r': /* Set the scrolling region */ ++ if (! p->csi_args[0]) ++ ++p->csi_args[0]; ++ if (! p->csi_args[1] || p->csi_args[1] > p->par->vs_rows) ++ p->csi_args[1] = p->par->vs_rows; ++ csi_r(p, p->csi_args[0], p->csi_args[1]); ++ return; ++ ++ /* Ignored escape sequences */ ++ case 'c': ++ case 'g': ++ case 'n': ++ case 'q': ++ return; ++ ++ default: ++ printk(KERN_NOTICE "LCD: unrecognized CSI escape sequence: ESC [ %u\n", input); ++ return; ++ } ++ } ++} ++ ++/* ++ * Custom ESC- sequence handler. ++ */ ++static int handle_custom_esc(struct lcd_struct *p, unsigned int _input) ++{ ++ unsigned char input = _input & 0xff; ++ struct lcd_parameters *par = p->par; ++ ++ if (_input & (~0xff)) { ++ switch (ESC_STATE(p)) { ++ case 's': ++ if (p->index++) { ++ unsigned char *buf = p->cgram_buffer+(p->cgram_index-par->cgram_char0)*par->cgram_bytes; ++ ++ buf[p->index-2] = input; ++ if (p->index == par->cgram_bytes+1) ++ write_cgram(p, p->cgram_index, buf); ++ } else { ++ if (! p->driver->write_cgram_char) { ++ printk(KERN_ERR "LCD: %s: missing function to write to CGRAM\n", p->par->name); ++ return (-1); ++ } ++ if (input >= par->cgram_char0 && input < par->cgram_char0+par->cgram_chars) ++ p->cgram_index = input; ++ else { ++ printk(KERN_NOTICE "LCD: bad CGRAM index\n"); ++ return (-1); ++ } ++ } ++ return (0); ++ ++ case 'G': ++ if (input >= par->cgram_char0 && input < par->cgram_char0+par->cgram_chars) ++ write_data(p, (p->attr << 8) | p->driver->charmap[input]); ++ else { ++ SET_INPUT_STATE(p, NORMAL); ++ handle_input(p, (p->attr << 8) | input); ++ } ++ return (0); ++ ++ case 'r': ++ if (input == '1') ++ address_mode(p, -1); ++ else if (input == '0') ++ address_mode(p, 1); ++ return (0); ++ ++ case 'A': ++ scrup(p, p->top, p->bot, input); ++ return (0); ++ ++ case 'B': ++ scrdown(p, p->top, p->bot, input); ++ return (0); ++ ++ case 'C': ++ browse_screen(p, input); ++ return (0); ++ } ++ } ++ ++ /* These are the custom ESC- sequences */ ++ switch (input) { ++ case 's': /* CGRAM select */ ++ if (p->cgram_buffer) { ++ SET_ESC_STATE(p, input); ++ p->index = 0; ++ return (par->cgram_bytes+1); ++ } else { ++ printk(KERN_NOTICE "LCD: driver %s does not support CGRAM chars\n", par->name); ++ return (0); ++ } ++ ++ case 'A': /* Scroll up */ ++ case 'B': /* Scroll down */ ++ case 'C': /* Browse screen */ ++ case 'G': /* Enter cgram mode */ ++ case 'r': /* Decrement counter after data read/write */ ++ SET_ESC_STATE(p, input); ++ return (1); ++ } ++ ++ return (-1); ++} ++ ++/* ++ * ESC- but not CSI sequence handler. ++ */ ++static int handle_esc(struct lcd_struct *p, unsigned char input) ++{ ++ int ret; ++ ++ SET_INPUT_STATE(p, NORMAL); ++ switch (input) { ++ case 'c': /* Reset */ ++ set_bit(DECAWM, &p->struct_flags); ++ set_bit(INC_CURS_POS, &p->struct_flags); ++ ff(p); ++ return (0); ++ ++ case 'D': /* Line Feed */ ++ lf(p); ++ return (0); ++ ++ case 'E': /* New Line */ ++ cr(p); ++ lf(p); ++ return (0); ++ ++ case 'M': /* Reverse Line Feed */ ++ ri(p); ++ return (0); ++ ++ case '7': ++ case '8': ++ csi_su(p, (input == '7' ? 's' : 'u')); ++ return (0); ++ ++ /* CSI: Start of CSI escape sequence */ ++ case '[': ++ memset(p->csi_args, 0, sizeof(p->csi_args)); ++ p->index = 0; ++ SET_INPUT_STATE(p, CSI); ++ return (0); ++ ++ /* Ignored escape sequences */ ++ case '(': ++ SET_INPUT_STATE(p, ESC_G0); ++ return (1); ++ ++ case ')': ++ SET_INPUT_STATE(p, ESC_G1); ++ return (1); ++ ++ case '#': ++ SET_INPUT_STATE(p, ESC_HASH); ++ return (1); ++ ++ case '%': ++ SET_INPUT_STATE(p, ESC_PERCENT); ++ return (1); ++ ++ case 'H': ++ case 'Z': ++ case '>': ++ case '=': ++ case ']': ++ return (0); ++ } ++ ++ /* These are the custom ESC- sequences */ ++ if ((ret = handle_custom_esc(p, input)) > 0) { ++ SET_INPUT_STATE(p, ARG); ++ return (ret); ++ } ++ ++ if (ret < 0 && p->driver->handle_custom_char) ++ if ((ret = p->driver->handle_custom_char(input)) > 0) { ++ SET_INPUT_STATE(p, ARG_DRIVER); ++ return (ret); ++ } ++ ++ if (ret < 0) ++ printk(KERN_NOTICE "LCD: unrecognized escape sequence: ESC %u\n", input); ++ ++ return (0); ++} ++ ++/* ++ * Main input handler. ++ */ ++static void handle_input(struct lcd_struct *p, unsigned short _input) ++{ ++ unsigned char input = _input & 0xff; ++ struct lcd_driver *driver = p->driver; ++ ++ switch (INPUT_STATE(p)) { ++ case NORMAL: ++ if (input < 0x20 || input == 0x9b) ++ control_char(p, input); ++ else ++ write_data(p, (_input & 0xff00) | driver->charmap[input]); ++ return; ++ ++ case RAW: ++ write_data(p, (_input & 0xff00) | driver->charmap[input]); ++ return; ++ ++ case SYN: ++ write_data(p, _input); ++ SET_INPUT_STATE(p, NORMAL); ++ return; ++ ++ case ESC: ++ p->esc_args = handle_esc(p, input); ++ return; ++ ++ case ESC_G0: ++ case ESC_G1: ++ case ESC_HASH: ++ case ESC_PERCENT: ++ if (! --p->esc_args) ++ SET_INPUT_STATE(p, NORMAL); ++ return; ++ ++ case CSI: ++ handle_csi(p, input); ++ return; ++ ++ case ARG: ++ if (handle_custom_esc(p, 0x100 | input) || ! --p->esc_args) ++ SET_INPUT_STATE(p, NORMAL); ++ return; ++ ++ case ARG_DRIVER: ++ if (driver->handle_custom_char(0x100 | input) || ! --p->esc_args) ++ SET_INPUT_STATE(p, NORMAL); ++ return; ++ } ++} ++ ++ ++ ++ ++ ++/*************************************** ++ * Read from/Write to display routines * ++ ***************************************/ ++ ++/* ++ * Write character data to the display. ++ */ ++static void write_data(struct lcd_struct *p, unsigned short data) ++{ ++ unsigned int vs_cols = p->par->vs_cols; ++ unsigned int pos; ++ int frame_pos; ++ ++ if (test_bit(NEED_WRAP, &p->struct_flags)) { ++ cr(p); ++ lf(p); ++ } ++ ++ if (test_bit(DECIM, &p->struct_flags)) ++ lcd_insert_char(p, 1); ++ ++ pos = (p->row*vs_cols)+p->col; ++ if ((frame_pos = vs_to_frame_(p, pos)) < 0) { ++ make_cursor_visible(p); ++ redraw_screen(p, 0, p->fb_size-1); ++ frame_pos = vs_to_frame_(p, pos); ++ } ++ ++ if (p->display[frame_pos] != data) { ++ p->driver->write_char(frame_pos, data); ++ p->display[frame_pos] = data; ++ } ++ ++ p->fb[pos] = data; ++ ++ if (test_bit(INC_CURS_POS, &p->struct_flags)) { ++ if (p->col+1 < vs_cols) ++ iterator_inc(p->col, vs_cols); ++ else if (test_bit(DECAWM, &p->struct_flags)) ++ set_bit(NEED_WRAP, &p->struct_flags); ++ } else { ++ if (p->col) ++ iterator_dec(p->col, vs_cols); ++ else if (test_bit(DECAWM, &p->struct_flags)) ++ set_bit(NEED_WRAP, &p->struct_flags); ++ } ++} ++ ++/* ++ * Write an entire CGRAM character to the display. ++ */ ++static void write_cgram(struct lcd_struct *p, unsigned char index, unsigned char *pixels) ++{ ++ unsigned int inc_set = test_bit(INC_CURS_POS, &p->struct_flags); ++ ++ if (! inc_set) ++ address_mode(p, 1); ++ ++ p->driver->write_cgram_char(index, pixels); ++ ++ if (! inc_set) ++ address_mode(p, -1); ++} ++ ++/* ++ * Read character data from the display. ++ */ ++static void read_data(struct lcd_struct *p, unsigned short *data) ++{ ++ unsigned int vs_rows = p->par->vs_rows; ++ unsigned int vs_cols = p->par->vs_cols; ++ unsigned int pos = (p->row*vs_cols)+p->col; ++ int frame_pos; ++ ++ if ((frame_pos = vs_to_frame_(p, pos)) < 0) { ++ make_cursor_visible(p); ++ redraw_screen(p, 0, p->fb_size-1); ++ frame_pos = vs_to_frame_(p, pos); ++ } ++ ++ p->driver->read_char(frame_pos, data); ++ ++ if (test_bit(INC_CURS_POS, &p->struct_flags)) { ++ iterator_inc(p->col, vs_cols); ++ if (! p->col) { ++ if (p->row+1 < vs_rows) ++ ++p->row; ++ } ++ } else { ++ iterator_dec(p->col, vs_cols); ++ if (p->col+1 == vs_cols) { ++ if (p->row) ++ --p->row; ++ } ++ } ++} ++ ++/* ++ * Read an entire CGRAM character from the display. ++ */ ++static void read_cgram(struct lcd_struct *p, unsigned char index, unsigned char *pixels) ++{ ++ unsigned int inc_set = test_bit(INC_CURS_POS, &p->struct_flags); ++ ++ if (! inc_set) ++ address_mode(p, 1); ++ ++ p->driver->read_cgram_char(index, pixels); ++ ++ if (! inc_set) ++ address_mode(p, -1); ++} ++ ++ ++ ++ ++ ++/**************************** ++ * Proc filesystem routines * ++ ****************************/ ++#ifdef USE_PROC ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0) ++/* create_proc_read_entry is missing in 2.2.x kernels */ ++static struct proc_dir_entry *create_proc_read_entry(const char *name, mode_t mode, ++ struct proc_dir_entry *parent, read_proc_t *read_proc, void *data) ++{ ++ struct proc_dir_entry *res = create_proc_entry(name, mode, parent); ++ ++ if (res) { ++ res->read_proc = read_proc; ++ res->data = data; ++ } ++ ++ return (res); ++} ++#endif ++ ++static int proc_fb_read(char *buffer, char **start, off_t offset, int size, int *eof, void *data) ++{ ++ char *temp = buffer; ++ struct lcd_struct *p = (struct lcd_struct *)data; ++ unsigned int vs_cols; ++ static unsigned int nr, need_wrap; ++ static off_t _offset; ++ ++ down(&p->lcd_sem); ++ if (! offset) ++ _offset = 0; ++ if ((*eof = (_offset >= p->fb_size))) { ++ up(&p->lcd_sem); ++ return (0); ++ } ++ vs_cols = p->par->vs_cols; ++ if (size && need_wrap) { ++ need_wrap = 0; ++ temp += sprintf(temp, "\n"); ++ --size; ++ } ++ if (! nr) ++ nr = vs_cols; ++ *start = (char *)0; ++ while (size && nr) { ++ unsigned char c = (p->fb[_offset] & 0xff); ++ ++ temp += sprintf(temp, "%c", (c < 0x20 ? '·' : c)); ++ --size; ++ --nr; ++ ++*start; ++ ++_offset; ++ } ++ if (! nr) { ++ if (size) { ++ temp += sprintf(temp, "\n"); ++ --size; ++ } else ++ need_wrap = 1; ++ } ++ up(&p->lcd_sem); ++ ++ return (temp-buffer); ++} ++ ++static int proc_display_read(char *buffer, char **start, off_t offset, int size, int *eof, void *data) ++{ ++ char *temp = buffer; ++ struct lcd_struct *p = (struct lcd_struct *)data; ++ unsigned int i, frame_cols; ++ int frame_pos; ++ ++ down(&p->lcd_sem); ++ frame_cols = p->par->cntr_cols; ++ frame_pos = vs_to_frame_(p, (p->row*p->par->vs_cols)+p->col); ++ temp += sprintf(temp, " "); ++ for (i = 2; i <= frame_cols; i += 2) ++ temp += sprintf(temp, " %d", i%10); ++ temp += sprintf(temp, "\n"); ++ ++ temp += sprintf(temp, " +"); ++ for (i = 0; i < frame_cols; ++i) ++ temp += sprintf(temp, "-"); ++ temp += sprintf(temp, "+\n"); ++ ++ for (i = 0; i < p->frame_size; ++i) { ++ unsigned char c = (p->display[i] & 0xff); ++ ++ if (! (i%frame_cols)) ++ temp += sprintf(temp, "%2d |", 1+i/frame_cols); ++ if (frame_pos--) ++ temp += sprintf(temp, "%c", (c < 0x20 ? '·' : c)); ++ else ++ temp += sprintf(temp, "_"); ++ if (! ((i+1)%frame_cols)) ++ temp += sprintf(temp, "|\n"); ++ } ++ ++ temp += sprintf(temp, " +"); ++ for (i = 0; i < frame_cols; ++i) ++ temp += sprintf(temp, "-"); ++ temp += sprintf(temp, "+\n"); ++ up(&p->lcd_sem); ++ ++ return (temp-buffer); ++} ++ ++static int proc_charmap_read(char *buffer, char **start, off_t offset, int size, int *eof, void *data) ++{ ++ char *temp = buffer; ++ struct lcd_struct *p = (struct lcd_struct *)data; ++ unsigned char *charmap; ++ unsigned int i; ++ ++ down(&p->lcd_sem); ++ charmap = p->driver->charmap; ++ temp += sprintf(temp, "static unsigned char charmap[] = {"); ++ for (i = 0; i < 255; ++i) { ++ if (! (i & 7)) { ++ temp += sprintf(temp, "\n"); ++ if (! (i & 31)) ++ temp += sprintf(temp, "\n/* %d - %d */\n", i, i+31); ++ } ++ temp += sprintf(temp, "0x%.2x, ", *charmap++); ++ } ++ temp += sprintf(temp, "0x%.2x\n\n};\n", *charmap); ++ up(&p->lcd_sem); ++ ++ return (temp-buffer); ++} ++ ++static int proc_registered_drivers(char *buffer, char **start, off_t offset, int size, int *eof, void *data) ++{ ++ char *temp = buffer; ++ struct list_head *entry; ++ ++ down(&drivers_sem); ++ temp += sprintf(temp, "Registered drivers:\n"); ++ list_for_each(entry, &lcd_drivers) { ++ struct lcd_struct *p = list_entry(entry, struct lcd_struct, lcd_list); ++ ++ down(&p->lcd_sem); ++ temp += sprintf(temp, "%3d %s\n", p->par->minor, p->par->name); ++ up(&p->lcd_sem); ++ } ++ up(&drivers_sem); ++ ++ return (temp-buffer); ++} ++ ++static void create_driver_proc_entries(struct lcd_struct *p) ++{ ++ struct proc_dir_entry *driver_proc_root = p->driver->driver_proc_root; ++ int proc_level = 0; ++ ++ SET_PROC_LEVEL(p, proc_level); ++ if (create_proc_read_entry("framebuffer", 0, driver_proc_root, proc_fb_read, p) == NULL) { ++ printk(KERN_ERR "LCD: cannot create /proc/lcd/%s/framebuffer\n", p->par->name); ++ return; ++ } ++ SET_PROC_LEVEL(p, ++proc_level); ++ if (create_proc_read_entry("display", 0, driver_proc_root, proc_display_read, p) == NULL) { ++ printk(KERN_ERR "LCD: cannot create /proc/lcd/%s/display\n", p->par->name); ++ return; ++ } ++ SET_PROC_LEVEL(p, ++proc_level); ++ if (create_proc_read_entry("charmap.h", 0, driver_proc_root, proc_charmap_read, p) == NULL) { ++ printk(KERN_ERR "LCD: cannot create /proc/lcd/%s/charmap.h\n", p->par->name); ++ return; ++ } ++ SET_PROC_LEVEL(p, ++proc_level); ++} ++ ++static void remove_driver_proc_entries(struct lcd_struct *p) ++{ ++ struct proc_dir_entry *driver_proc_root = p->driver->driver_proc_root; ++ ++ switch (PROC_LEVEL(p)) { ++ case 3: ++ remove_proc_entry("charmap.h", driver_proc_root); ++ case 2: ++ remove_proc_entry("display", driver_proc_root); ++ case 1: ++ remove_proc_entry("framebuffer", driver_proc_root); ++ } ++ SET_PROC_LEVEL(p, 0); ++} ++#endif ++ ++ ++ ++ ++ ++/***************************** ++ * Low level file operations * ++ *****************************/ ++static ssize_t do_lcd_read(struct lcd_struct *p, void *buffer, size_t length) ++{ ++ unsigned int i; ++ unsigned short tmp; ++ ++ if (! p->refcount) ++ return (-ENXIO); ++ ++ if (! p->driver->read_char) { ++ printk(KERN_NOTICE "LCD: driver %s doesn't support reading\n", p->par->name); ++ return (-ENOSYS); ++ } ++ ++ if (test_bit(WITH_ATTR, &p->struct_flags)) ++ for (i = 0; i < length; ++i) { ++ read_data(p, &tmp); ++ ((unsigned short *)buffer)[i] = tmp; ++ } ++ else ++ for (i = 0; i < length; ++i) { ++ read_data(p, &tmp); ++ ((unsigned char *)buffer)[i] = tmp & 0xff; ++ } ++ ++ return (length); ++} ++ ++static ssize_t do_lcd_write(struct lcd_struct *p, const void *buffer, size_t length) ++{ ++ unsigned int i; ++ ++ if (! p->refcount) ++ return (-ENXIO); ++ ++ if (test_bit(WITH_ATTR, &p->struct_flags)) ++ for (i = 0; i < length; ++i) ++ handle_input(p, ((const unsigned short *)buffer)[i]); ++ else ++ for (i = 0; i < length; ++i) ++ handle_input(p, (p->attr << 8) | ((const unsigned char *)buffer)[i]); ++ ++ return (length); ++} ++ ++static int do_lcd_open(struct lcd_struct *p) ++{ ++ if (! p->refcount) { ++ if (p->driver->driver_module) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) ++ if (! try_module_get(p->driver->driver_module)) ++ return (-EBUSY); ++#else ++ if (__MOD_IN_USE(p->driver->driver_module)) ++ return (-EBUSY); ++ ++ __MOD_INC_USE_COUNT(p->driver->driver_module); ++#endif ++ } ++ } ++ ++ ++p->refcount; ++ ++ return (0); ++} ++ ++static int do_lcd_release(struct lcd_struct *p) ++{ ++ if (! p->refcount) ++ return (0); ++ ++ if (p->refcount == 1) { ++ if (p->driver->driver_module) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) ++ module_put(p->driver->driver_module); ++#else ++ __MOD_DEC_USE_COUNT(p->driver->driver_module); ++#endif ++ } ++ ++ --p->refcount; ++ ++ return (0); ++} ++ ++static int cgram_ioctl(struct lcd_struct *p, unsigned int cmd, unsigned char *argp) ++{ ++ struct lcd_parameters *par = p->par; ++ unsigned int length = par->cgram_bytes; ++ unsigned char index = argp[0]; ++ unsigned char *buffer = argp+1; ++ unsigned char *cgram_buffer = p->cgram_buffer+(index-par->cgram_char0)*length; ++ ++ if (index < par->cgram_char0 || index >= par->cgram_char0+par->cgram_chars) ++ return (-EINVAL); ++ ++ if (cmd == LCDL_SET_CGRAM_CHAR) { ++ if (! p->driver->write_cgram_char) { ++ printk(KERN_ERR "LCD: %s: missing function to write to CGRAM\n", p->par->name); ++ return (-ENOSYS); ++ } ++ if (test_bit(USER_SPACE, &p->struct_flags)) { ++ if (copy_from_user(cgram_buffer, buffer, length)) ++ return (-EFAULT); ++ } else ++ memcpy(cgram_buffer, buffer, length); ++ write_cgram(p, index, cgram_buffer); ++ } else { ++ if (! p->driver->read_cgram_char) { ++ printk(KERN_ERR "LCD: %s: missing function to read from CGRAM or unable to read\n", p->par->name); ++ return (-ENOSYS); ++ } ++ read_cgram(p, index, cgram_buffer); ++ if (test_bit(USER_SPACE, &p->struct_flags)) { ++ if (copy_to_user(buffer, cgram_buffer, length)) ++ return (-EFAULT); ++ } else ++ memcpy(buffer, cgram_buffer, length); ++ } ++ ++ return (0); ++} ++ ++static int do_lcd_ioctl(struct lcd_struct *p, unsigned int cmd, unsigned long arg) ++{ ++ int i; ++ struct lcd_driver *driver = p->driver; ++ struct lcd_parameters *par = p->par; ++ unsigned char *argp = (unsigned char *)arg; ++ ++ if (! p->refcount) ++ return (-ENXIO); ++ ++ switch (cmd) { ++ case LCDL_SET_PARAM: ++ if ((i = cleanup_driver(p))) ++ return (i); ++ i = par->minor; ++ if (test_bit(USER_SPACE, &p->struct_flags)) { ++ if (copy_from_user(par, argp, sizeof(struct lcd_parameters))) ++ return (-EFAULT); ++ } else ++ memcpy(par, argp, sizeof(struct lcd_parameters)); ++ par->minor = i; ++ return (init_driver(p)); ++ ++ case LCDL_GET_PARAM: ++ if (test_bit(USER_SPACE, &p->struct_flags)) { ++ if (copy_to_user(argp, par, sizeof(struct lcd_parameters))) ++ return (-EFAULT); ++ } else ++ memcpy(argp, par, sizeof(struct lcd_parameters)); ++ return (0); ++ ++ case LCDL_RESET_CHARMAP: ++ for (i = 0; i < 256; ++i) ++ driver->charmap[i] = i; ++ return (0); ++ ++ case LCDL_CHARSUBST: ++ if (test_bit(USER_SPACE, &p->struct_flags)) { ++ get_user(i, argp); ++ get_user(driver->charmap[i], argp+1); ++ } else { ++ i = argp[0]; ++ driver->charmap[i] = argp[1]; ++ } ++ return (0); ++ ++ case LCDL_SAVE_CHARMAP: ++ memcpy(p->s_charmap, driver->charmap, 256); ++ return (0); ++ ++ case LCDL_RESTORE_CHARMAP: ++ memcpy(driver->charmap, p->s_charmap, 256); ++ return (0); ++ ++ case LCDL_SWAP_CHARMAP: ++ { ++ unsigned char *tmp; ++ ++ tmp = driver->charmap; ++ driver->charmap = p->s_charmap; ++ p->s_charmap = tmp; ++ } ++ return (0); ++ ++ case LCDL_RAW_MODE: ++ if (arg) { ++ clear_bit(NEED_WRAP, &p->struct_flags); ++ clear_bit(DECIM, &p->struct_flags); ++ clear_bit(DECAWM, &p->struct_flags); ++ SET_INPUT_STATE(p, RAW); ++ } else { ++ set_bit(DECAWM, &p->struct_flags); ++ SET_INPUT_STATE(p, NORMAL); ++ } ++ return (0); ++ ++ case LCDL_CLEAR_DISP: ++ ff(p); ++ return (0); ++ ++ case LCDL_SET_CGRAM_CHAR: ++ case LCDL_GET_CGRAM_CHAR: ++ if (p->cgram_buffer) ++ return (cgram_ioctl(p, cmd, argp)); ++ else ++ printk(KERN_NOTICE "LCD: driver %s does not support CGRAM chars\n", par->name); ++ return (0); ++ ++ case LCDL_SET_CHARMAP: ++ if (test_bit(USER_SPACE, &p->struct_flags)) { ++ if (copy_from_user(driver->charmap, argp, 256)) ++ return (-EFAULT); ++ } else ++ memcpy(driver->charmap, argp, 256); ++ return (0); ++ ++ case LCDL_GET_CHARMAP: ++ if (test_bit(USER_SPACE, &p->struct_flags)) { ++ if (copy_to_user(argp, driver->charmap, 256)) ++ return (-EFAULT); ++ } else ++ memcpy(argp, driver->charmap, 256); ++ return (0); ++ ++ case LCDL_MEMSET: ++ case LCDL_MEMMOVE: ++ { ++ int buf[3]; ++ ++ if (test_bit(USER_SPACE, &p->struct_flags)) { ++ if (copy_from_user(buf, argp, sizeof(buf))) ++ return (-EFAULT); ++ } else ++ memcpy(buf, argp, sizeof(buf)); ++ ++ if (cmd == LCDL_MEMSET) ++ lcd_memset(p, buf[0], buf[1], buf[2]); ++ else ++ lcd_memmove(p, buf[0], buf[1], buf[2]); ++ ++ return (0); ++ } ++ ++ default: ++ if (driver->handle_custom_ioctl) ++ return (driver->handle_custom_ioctl(cmd, arg, test_bit(USER_SPACE, &p->struct_flags))); ++ } ++ ++ return (-ENOIOCTLCMD); ++} ++ ++ ++ ++ ++ ++/************************************************** ++ * Kernel register/unregister lcd driver routines * ++ **************************************************/ ++/* ++ * Find a driver in lcd_drivers linked list ++ */ ++static struct lcd_struct *find_lcd_struct(unsigned short minor) ++{ ++ struct list_head *entry; ++ ++ list_for_each(entry, &lcd_drivers) { ++ struct lcd_struct *p = list_entry(entry, struct lcd_struct, lcd_list); ++ ++ if (p->par->minor == minor) ++ return (p); ++ } ++ ++ return (NULL); ++} ++ ++static void list_add_sorted(struct list_head *new) ++{ ++ struct list_head *entry; ++ unsigned short new_minor = (list_entry(new, struct lcd_struct, lcd_list))->par->minor; ++ ++ list_for_each(entry, &lcd_drivers) { ++ struct lcd_struct *p = list_entry(entry, struct lcd_struct, lcd_list); ++ ++ if (p->par->minor > new_minor) ++ break; ++ } ++ list_add_tail(new, entry); ++} ++ ++/* Exported function */ ++int lcd_register_driver(struct lcd_driver *driver, struct lcd_parameters *par) ++{ ++ int ret; ++ struct lcd_struct *p; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) ++ struct device *lcd_device; ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) ++ struct class_device *lcd_class_device; ++#endif ++ ++ if (! driver || ! par || par->minor >= minors) ++ return (-EINVAL); ++ if (! driver->write_char || ! driver->init_port || ! driver->cleanup_port) { ++ printk(KERN_ERR "LCD: missing functions\n"); ++ return (-EINVAL); ++ } ++ ++ down(&drivers_sem); ++ ++ if (find_lcd_struct(par->minor)) { ++ up(&drivers_sem); ++ return (-EBUSY); ++ } ++ ++ if ((p = (struct lcd_struct *)kmalloc(sizeof(struct lcd_struct), GFP_KERNEL)) == NULL) { ++ printk(KERN_ERR "LCD: memory allocation failed (kmalloc)\n"); ++ up(&drivers_sem); ++ return (-ENOMEM); ++ } ++ memset(p, 0, sizeof(struct lcd_struct)); ++ ++ p->driver = driver; ++ p->par = par; ++ p->refcount = 0; ++ SET_INIT_LEVEL(p, 0); ++ SET_INPUT_STATE(p, NORMAL); ++ set_bit(DECAWM, &p->struct_flags); ++ set_bit(INC_CURS_POS, &p->struct_flags); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) ++ lcd_device = device_create(lcd_linux_class, NULL, MKDEV(major, par->minor), "%s", par->name); ++ if (IS_ERR(lcd_device)) { ++ kfree(p); ++ up(&drivers_sem); ++ return (PTR_ERR(lcd_device)); ++ } ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15) ++ lcd_class_device = class_device_create(lcd_linux_class, NULL, MKDEV(major, par->minor), NULL, "%s", par->name); ++ if (IS_ERR(lcd_class_device)) { ++ kfree(p); ++ up(&drivers_sem); ++ return (PTR_ERR(lcd_class_device)); ++ } ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) ++ lcd_class_device = class_device_create(lcd_linux_class, MKDEV(major, par->minor), NULL, "%s", par->name); ++ if (IS_ERR(lcd_class_device)) { ++ kfree(p); ++ up(&drivers_sem); ++ return (PTR_ERR(lcd_class_device)); ++ } ++#endif ++ ++#ifdef USE_PROC ++ if (lcd_proc_root && (driver->driver_proc_root = proc_mkdir(par->name, lcd_proc_root)) == NULL) ++ printk(KERN_ERR "LCD: cannot create /proc/lcd/%s/\n", par->name); ++#endif ++ ++ if ((ret = init_driver(p))) { ++#ifdef USE_PROC ++ if (driver->driver_proc_root) ++ remove_proc_entry(p->par->name, lcd_proc_root); ++#endif ++ kfree(p); ++ up(&drivers_sem); ++ return (ret); ++ } ++ ++ init_MUTEX(&p->lcd_sem); ++ ++ list_add_sorted(&p->lcd_list); ++ ++ up(&drivers_sem); ++ ++#ifdef MODULE ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) ++ try_module_get(THIS_MODULE); ++#else ++ MOD_INC_USE_COUNT; ++#endif ++#endif ++ ++ return (0); ++} ++EXPORT_SYMBOL(lcd_register_driver); ++ ++/* Exported function */ ++int lcd_unregister_driver(struct lcd_driver *driver, struct lcd_parameters *par) ++{ ++ int ret; ++ struct lcd_struct *p; ++ ++ if (! driver || ! par || par->minor >= minors) ++ return (-EINVAL); ++ ++ down(&drivers_sem); ++ ++ if ((p = find_lcd_struct(par->minor)) == NULL || p->driver != driver) { ++ printk(KERN_ERR "LCD: driver not found; lcd_unregister_driver failed\n"); ++ up(&drivers_sem); ++ return (-ENODEV); ++ } ++ ++ down(&p->lcd_sem); ++ ++ if (p->refcount) { ++ printk(KERN_ERR "LCD: driver busy; lcd_unregister_driver failed\n"); ++ up(&p->lcd_sem); ++ up(&drivers_sem); ++ return (-EBUSY); ++ } ++ ++ if ((ret = cleanup_driver(p))) { ++ up(&p->lcd_sem); ++ up(&drivers_sem); ++ return (ret); ++ } ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) ++ device_destroy(lcd_linux_class, MKDEV(major, par->minor)); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) ++ class_device_destroy(lcd_linux_class, MKDEV(major, par->minor)); ++#endif ++ ++#ifdef USE_PROC ++ if (p->driver->driver_proc_root) ++ remove_proc_entry(p->par->name, lcd_proc_root); ++#endif ++ ++ list_del(&p->lcd_list); ++ kfree(p); ++ ++ up(&drivers_sem); ++ ++#ifdef MODULE ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) ++ module_put(THIS_MODULE); ++#else ++ MOD_DEC_USE_COUNT; ++#endif ++#endif ++ ++ return (0); ++} ++EXPORT_SYMBOL(lcd_unregister_driver); ++ ++ ++ ++ ++ ++/************************ ++ * Kernel I/O interface * ++ ************************/ ++/* Exported function */ ++int lcd_open(unsigned short minor, struct lcd_struct **pp) ++{ ++ int ret; ++ struct lcd_struct *p; ++ ++ down(&drivers_sem); ++ ++ if (minor >= minors || (*pp = p = find_lcd_struct(minor)) == NULL) { ++ printk(KERN_ERR "LCD: lcd_open failed. Device not found.\n"); ++ up(&drivers_sem); ++ return (-ENODEV); ++ } ++ ++ down(&p->lcd_sem); ++ up(&drivers_sem); ++ ++ ret = do_lcd_open(p); ++ ++ up(&p->lcd_sem); ++ ++ return (ret); ++} ++EXPORT_SYMBOL(lcd_open); ++ ++/* Exported function */ ++int lcd_close(struct lcd_struct **pp) ++{ ++ int ret; ++ struct lcd_struct *p; ++ ++ if (! pp || ! (p = *pp)) { ++ printk(KERN_ERR "LCD: NULL pointer in lcd_close\n"); ++ return (-ENODEV); ++ } ++ ++ down(&p->lcd_sem); ++ ++ if (! (ret = do_lcd_release(p))) ++ *pp = NULL; ++ ++ up(&p->lcd_sem); ++ ++ return (ret); ++} ++EXPORT_SYMBOL(lcd_close); ++ ++static inline loff_t offset_to_row_col(struct lcd_struct *p, loff_t offset) ++{ ++ unsigned long _offset = offset; ++ unsigned int vs_cols = p->par->vs_cols; ++ ++ gotoxy(p, _offset%vs_cols, _offset/vs_cols); ++ ++ return ((p->row*vs_cols)+p->col); ++} ++ ++/* Exported function */ ++ssize_t lcd_read(struct lcd_struct *p, void *bufp, size_t length, loff_t offset, unsigned int with_attr) ++{ ++ ssize_t ret = 0; ++ ++ if (! p) { ++ printk(KERN_ERR "LCD: NULL pointer in lcd_read\n"); ++ return (-ENODEV); ++ } ++ if (! bufp) ++ return (-EFAULT); ++ if (offset < 0 || offset >= p->fb_size) ++ return (-EINVAL); ++ ++ if (length+offset > p->fb_size) ++ length = p->fb_size-offset; ++ ++ if (with_attr) ++ set_bit(WITH_ATTR, &p->struct_flags); ++ ++ offset_to_row_col(p, offset); ++ ret = do_lcd_read(p, bufp, length); ++ ++ if (with_attr) ++ clear_bit(WITH_ATTR, &p->struct_flags); ++ ++ return (ret); ++} ++EXPORT_SYMBOL(lcd_read); ++ ++/* Exported function */ ++ssize_t lcd_write(struct lcd_struct *p, const void *bufp, size_t length, loff_t offset, unsigned int with_attr) ++{ ++ ssize_t ret; ++ ++ if (! p) { ++ printk(KERN_ERR "LCD: NULL pointer in lcd_write\n"); ++ return (-ENODEV); ++ } ++ if (! bufp) ++ return (-EFAULT); ++ if (offset < 0 || offset >= p->fb_size) ++ return (-EINVAL); ++ ++ if (with_attr) ++ set_bit(WITH_ATTR, &p->struct_flags); ++ ++ offset_to_row_col(p, offset); ++ ret = do_lcd_write(p, bufp, length); ++ ++ if (with_attr) ++ clear_bit(WITH_ATTR, &p->struct_flags); ++ ++ return (ret); ++} ++EXPORT_SYMBOL(lcd_write); ++ ++/* Exported function */ ++int lcd_ioctl(struct lcd_struct *p, unsigned int cmd, ...) ++{ ++ int ret; ++ unsigned long arg; ++ va_list ap; ++ ++ if (! p) { ++ printk(KERN_ERR "LCD: NULL pointer in lcd_ioctl\n"); ++ return (-ENODEV); ++ } ++ ++ down(&p->lcd_sem); ++ va_start(ap, cmd); ++ arg = va_arg(ap, unsigned long); ++ ret = do_lcd_ioctl(p, cmd, arg); ++ va_end(ap); ++ up(&p->lcd_sem); ++ ++ return (ret); ++} ++EXPORT_SYMBOL(lcd_ioctl); ++ ++ ++ ++ ++ ++/******************* ++ * File operations * ++ *******************/ ++static loff_t lcd_fops_llseek(struct file *filp, loff_t offset, int orig) ++{ ++ struct lcd_struct *p; ++ ++ if (! (p = filp->private_data)) ++ return (-ENODEV); ++ ++ down(&p->lcd_sem); ++ ++ switch (orig) { ++ case 0: ++ filp->f_pos = offset; ++ break; ++ ++ case 1: ++ filp->f_pos += offset; ++ break; ++ ++ default: ++ up(&p->lcd_sem); ++ return (-EINVAL); /* SEEK_END not supported */ ++ } ++ ++ filp->f_pos = offset_to_row_col(p, filp->f_pos); ++ ++ up(&p->lcd_sem); ++ ++ return (filp->f_pos); ++} ++ ++static ssize_t lcd_fops_read(struct file *filp, char *buffer, size_t length, loff_t *offp) ++{ ++ ssize_t ret = 0; ++ char *bufp = buffer; ++ struct lcd_struct *p; ++ ++ if (! bufp) ++ return (-EFAULT); ++ if (! (p = filp->private_data)) ++ return (-ENODEV); ++ ++ down(&p->lcd_sem); ++ ++ if (*offp < 0 || *offp >= p->fb_size) { ++ up(&p->lcd_sem); ++ return (-EINVAL); ++ } ++ ++ if (length+(*offp) > p->fb_size) ++ length = p->fb_size-(*offp); ++ ++ while (length) { ++ ret = (length > FLIP_BUF_SIZE ? FLIP_BUF_SIZE : length); ++ if ((ret = do_lcd_read(p, p->flip_buf, ret)) < 0) ++ break; ++ *offp = (p->row*p->par->vs_cols)+p->col; ++ if (copy_to_user(bufp, p->flip_buf, ret)) { ++ ret = -EFAULT; ++ break; ++ } ++ length -= ret; ++ bufp += ret; ++ ret = bufp-buffer; ++ if (length) ++ schedule(); ++ } ++ ++ up(&p->lcd_sem); ++ ++ return (ret); ++} ++ ++static ssize_t lcd_fops_write(struct file *filp, const char *buffer, size_t length, loff_t *offp) ++{ ++ ssize_t ret = 0; ++ const char *bufp = buffer; ++ struct lcd_struct *p; ++ ++ if (! bufp) ++ return (-EFAULT); ++ if (! (p = filp->private_data)) ++ return (-ENODEV); ++ ++ down(&p->lcd_sem); ++ ++ if (*offp < 0 || *offp >= p->fb_size) { ++ up(&p->lcd_sem); ++ return (-EINVAL); ++ } ++ ++ while (length) { ++ ret = (length > FLIP_BUF_SIZE ? FLIP_BUF_SIZE : length); ++ if (copy_from_user(p->flip_buf, bufp, ret)) { ++ ret = -EFAULT; ++ break; ++ } ++ if ((ret = do_lcd_write(p, p->flip_buf, ret)) < 0) ++ break; ++ *offp = (p->row*p->par->vs_cols)+p->col; ++ length -= ret; ++ bufp += ret; ++ ret = bufp-buffer; ++ if (length) ++ schedule(); ++ } ++ ++ up(&p->lcd_sem); ++ ++ return (ret); ++} ++ ++static int lcd_fops_open(struct inode *inop, struct file *filp) ++{ ++ unsigned short minor; ++ int ret; ++ struct lcd_struct *p; ++ ++ down(&drivers_sem); ++ ++ if ((minor = MINOR(inop->i_rdev)) >= minors || (filp->private_data = p = find_lcd_struct(minor)) == NULL) { ++ up(&drivers_sem); ++ return (-ENODEV); ++ } ++ ++ down(&p->lcd_sem); ++ up(&drivers_sem); ++ ++ ret = do_lcd_open(p); ++ ++ up(&p->lcd_sem); ++ ++ return (ret); ++} ++ ++static int lcd_fops_release(struct inode *inop, struct file *filp) ++{ ++ struct lcd_struct *p; ++ int ret; ++ ++ if (! (p = filp->private_data)) ++ return (-ENODEV); ++ ++ down(&p->lcd_sem); ++ ++ if (! (ret = do_lcd_release(p))) ++ filp->private_data = NULL; ++ ++ up(&p->lcd_sem); ++ ++ return (ret); ++} ++ ++static int lcd_fops_ioctl(struct inode *inop, struct file *filp, unsigned int cmd, unsigned long arg) ++{ ++ struct lcd_struct *p; ++ int ret; ++ ++ if (! (p = filp->private_data)) ++ return (-ENODEV); ++ ++ down(&p->lcd_sem); ++ ++ set_bit(USER_SPACE, &p->struct_flags); ++ ret = do_lcd_ioctl(p, cmd, arg); ++ clear_bit(USER_SPACE, &p->struct_flags); ++ ++ up(&p->lcd_sem); ++ ++ return (ret); ++} ++ ++static struct file_operations lcd_linux_fops = { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0) ++ .owner = THIS_MODULE, ++#endif ++ .llseek = lcd_fops_llseek, ++ .read = lcd_fops_read, ++ .write = lcd_fops_write, ++ .open = lcd_fops_open, ++ .release = lcd_fops_release, ++ .ioctl = lcd_fops_ioctl, ++}; ++ ++ ++ ++ ++ ++/******************************** ++ * Init/Cleanup driver routines * ++ ********************************/ ++static int do_init_driver(struct lcd_struct *p) ++{ ++ int ret, init_level; ++ struct lcd_driver *driver = p->driver; ++ struct lcd_parameters *par = p->par; ++ unsigned int frame_rows = par->cntr_rows*par->num_cntr; ++ unsigned int frame_cols = par->cntr_cols; ++ ++ switch ((init_level = INIT_LEVEL(p))) { ++ case 0: ++ if (frame_rows == 0 || frame_cols == 0 || ! par->name) { ++ printk(KERN_ERR "LCD: wrong lcd parameters\n"); ++ return (-EINVAL); ++ } ++ if (driver->validate_driver) { ++ if ((ret = driver->validate_driver()) < 0) { ++ printk(KERN_ERR "LCD: validate_driver failed\n"); ++ return (-EINVAL); ++ } else if (ret > 0) { ++ set_bit(CAN_DO_COLOR, &p->struct_flags); ++ p->defcolor = 0x07; ++ p->ulcolor = 0x0f; ++ p->halfcolor = 0x08; ++ } ++ } ++ default_attr(p); ++ update_attr(p); ++ p->frame_size = frame_rows*frame_cols; ++ if (par->vs_rows < frame_rows) ++ par->vs_rows = frame_rows; ++ if (par->vs_cols < frame_cols) ++ par->vs_cols = frame_cols; ++ p->fb_size = par->vs_rows*par->vs_cols; ++ ++ ret = sizeof(short)*p->fb_size; ++ ret += sizeof(short)*p->frame_size; ++ ret += FLIP_BUF_SIZE; ++ ret += (p->driver->charmap ? 256 : 512); ++ ret += par->cgram_chars*par->cgram_bytes; ++ if ((p->fb = (unsigned short *)vmalloc(ret)) == NULL) { ++ printk(KERN_ERR "LCD: memory allocation failed (vmalloc)\n"); ++ return (-ENOMEM); ++ } ++ __memset_short(p->fb, p->erase_char, p->fb_size+p->frame_size); ++ ++ p->display = p->fb+p->fb_size; ++ p->flip_buf = (unsigned char *)(p->display+p->frame_size); ++ ++ if (! p->driver->charmap) { ++ set_bit(NULL_CHARMAP, &p->struct_flags); ++ p->driver->charmap = p->flip_buf+FLIP_BUF_SIZE; ++ for (ret = 0; ret < 256; ++ret) ++ p->driver->charmap[ret] = ret; ++ p->s_charmap = p->driver->charmap+256; ++ } else ++ p->s_charmap = p->flip_buf+FLIP_BUF_SIZE; ++ memset(p->s_charmap, 0, 256); ++ ++ if (par->cgram_chars*par->cgram_bytes) { ++ p->cgram_buffer = p->s_charmap+256; ++ memset(p->cgram_buffer, 0, par->cgram_chars*par->cgram_bytes); ++ } else ++ p->cgram_buffer = NULL; ++ ++ p->frame_base = 0; ++ p->row = p->col = 0; ++ p->top = 0; ++ p->bot = par->vs_rows; ++ SET_INIT_LEVEL(p, ++init_level); ++ ++ case 1: ++ /* Initialize the communication port */ ++ if ((ret = driver->init_port())) { ++ printk(KERN_ERR "LCD: failure while initializing the communication port\n"); ++ return (ret); ++ } ++ SET_INIT_LEVEL(p, ++init_level); ++ ++ case 2: ++ /* Initialize LCD display */ ++ if (driver->init_display && (ret = driver->init_display())) { ++ printk(KERN_ERR "LCD: failure while initializing the display\n"); ++ return (ret); ++ } ++ ++#ifdef USE_PROC ++ /* Create entries in /proc/lcd/"driver" */ ++ if (driver->driver_proc_root) ++ create_driver_proc_entries(p); ++#endif ++ SET_INIT_LEVEL(p, ++init_level); ++ } ++ ++ return (0); ++} ++ ++static int do_cleanup_driver(struct lcd_struct *p) ++{ ++ int ret, init_level; ++ struct lcd_driver *driver = p->driver; ++ ++ switch ((init_level = INIT_LEVEL(p))) { ++ case 3: ++#ifdef USE_PROC ++ if (driver->driver_proc_root) ++ remove_driver_proc_entries(p); ++#endif ++ if (driver->cleanup_display && (ret = driver->cleanup_display())) { ++ printk(KERN_ERR "LCD: failure while cleaning the display\n"); ++ return (ret); ++ } ++ SET_INIT_LEVEL(p, --init_level); ++ ++ case 2: ++ if ((ret = driver->cleanup_port())) { ++ printk(KERN_ERR "LCD: failure while cleaning the communication port\n"); ++ return (ret); ++ } ++ SET_INIT_LEVEL(p, --init_level); ++ ++ case 1: ++ if (test_bit(NULL_CHARMAP, &p->struct_flags)) { ++ p->driver->charmap = NULL; ++ clear_bit(NULL_CHARMAP, &p->struct_flags); ++ } ++ vfree(p->fb); ++ p->fb = NULL; ++ SET_INIT_LEVEL(p, --init_level); ++ } ++ ++ return (0); ++} ++ ++static int init_driver(struct lcd_struct *p) ++{ ++ int ret; ++ ++ if ((ret = do_init_driver(p))) { ++ do_cleanup_driver(p); ++ printk(KERN_ERR "LCD: init_driver failed\n"); ++ } ++ ++ return (ret); ++} ++ ++static int cleanup_driver(struct lcd_struct *p) ++{ ++ int ret; ++ ++ if ((ret = do_cleanup_driver(p))) { ++ do_init_driver(p); ++ printk(KERN_ERR "LCD: cleanup_driver failed\n"); ++ } ++ ++ return (ret); ++} ++ ++ ++ ++ ++ ++/******************************** ++ * Init/Cleanup module routines * ++ ********************************/ ++static int __init lcd_linux_init_module(void) ++{ ++ int ret; ++ ++ if (! minors || minors > 256) ++ minors = LCD_MINORS; ++ ++ init_MUTEX(&drivers_sem); ++ ++ if ((ret = register_chrdev(major, LCD_LINUX_STRING, &lcd_linux_fops)) < 0) { ++ printk(KERN_ERR "LCD: register_chrdev failed\n"); ++ return (ret); ++ } ++ if (major == 0) ++ major = ret; ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) ++ if (IS_ERR((lcd_linux_class = class_create(THIS_MODULE, "lcd")))) { ++ ret = PTR_ERR(lcd_linux_class); ++ unregister_chrdev(major, LCD_LINUX_STRING); ++ return (ret); ++ } ++#endif ++ ++#ifdef USE_PROC ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) ++ if ((lcd_proc_root = proc_mkdir("lcd", NULL)) == NULL) ++#else ++ if ((lcd_proc_root = proc_mkdir("lcd", &proc_root)) == NULL) ++#endif ++ printk(KERN_ERR "LCD: cannot create /proc/lcd/\n"); ++ else if (create_proc_read_entry("drivers", 0, lcd_proc_root, proc_registered_drivers, NULL) == NULL) ++ printk(KERN_ERR "LCD: cannot create /proc/lcd/drivers\n"); ++#endif ++ ++ printk(KERN_INFO "LCD: --> LCD-Linux " LCD_LINUX_VERSION " <--\n"); ++ printk(KERN_INFO "LCD: --> Mattia Jona-Lasinio <--\n" ); ++ ++ ++ return (0); ++} ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0) ++static void __exit lcd_linux_cleanup_module(void) ++#else ++/* __exit is not defined in 2.2.x kernels */ ++static void lcd_linux_cleanup_module(void) ++#endif ++{ ++#ifdef USE_PROC ++ if (lcd_proc_root) { ++ remove_proc_entry("drivers", lcd_proc_root); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) ++ remove_proc_entry("lcd", NULL); ++#else ++ remove_proc_entry("lcd", &proc_root); ++#endif ++ } ++#endif ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) ++ class_destroy(lcd_linux_class); ++#endif ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) ++ unregister_chrdev(major, LCD_LINUX_STRING); ++#else ++ if (unregister_chrdev(major, LCD_LINUX_STRING)) ++ printk(KERN_ERR "LCD: unregister_chrdev failed\n"); ++#endif ++} ++ ++module_init(lcd_linux_init_module) ++module_exit(lcd_linux_cleanup_module) +Index: linux-2.6.30.9/include/linux/hd44780.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.30.9/include/linux/hd44780.h 2009-11-24 02:01:42.000000000 +0100 +@@ -0,0 +1,46 @@ ++/* hd44780.h ++ * ++ * ++ * LCD-Linux: ++ * Driver for HD44780 compatible displays connected to the parallel port. ++ * ++ * HD44780 header file. ++ * ++ * Copyright (C) 2004 - 2007 Mattia Jona-Lasinio (mjona@users.sourceforge.net) ++ * ++ * 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 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * ++ */ ++ ++#ifndef HD44780_H ++#define HD44780_H ++ ++#include ++ ++#define HD44780_VERSION LCD_LINUX_VERSION /* Version number */ ++#define HD44780_STRING "hd44780" ++ ++#define HD44780_MINOR 0 /* Minor number for the hd44780 driver */ ++ ++ ++/* flags */ ++#define HD44780_CHECK_BF 0x00000001 /* Do busy flag checking */ ++#define HD44780_4BITS_BUS 0x00000002 /* Set the bus length to 4 bits */ ++#define HD44780_5X10_FONT 0x00000004 /* Use 5x10 dots fonts */ ++ ++/* IOCTLs */ ++#define HD44780_READ_AC _IOR(LCD_MAJOR, 0x00, unsigned char *) ++ ++#endif /* HD44780 included */ +Index: linux-2.6.30.9/include/linux/lcd-linux.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.30.9/include/linux/lcd-linux.h 2009-11-24 02:01:42.000000000 +0100 +@@ -0,0 +1,151 @@ ++/* lcd-linux.h ++ * ++ * ++ * Software layer to drive LCD displays under Linux. ++ * ++ * External interface header file. ++ * ++ * Copyright (C) 2005 - 2007 Mattia Jona-Lasinio (mjona@users.sourceforge.net) ++ * ++ * 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 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * ++ */ ++ ++#ifndef LCD_LINUX_H ++#define LCD_LINUX_H ++ ++#ifndef LCD_LINUX_MAIN ++#warning ++#warning LCD-Linux is still in development stage and ++#warning aims at speed and optimization. For these ++#warning reasons there is no guarantee of backward ++#warning compatibility between different LCD-Linux ++#warning versions. Be sure to use the lcd-linux.h ++#warning file of the same version as the module. ++#warning "http://lcd-linux.sourceforge.net/" ++#warning ++#endif ++ ++#define LCD_LINUX_VERSION "0.13.6" /* Version number */ ++#define LCD_LINUX_STRING "lcd" ++ ++#define LCD_MAJOR 120 /* Major number for this device ++ * Set this to 0 for dynamic allocation ++ */ ++#define LCD_MINORS 8 /* Minors allocated for LCD-Linux*/ ++ ++#include ++ ++#define str(s) #s ++#define string(s) str(s) ++ ++struct lcd_parameters { ++ const char *name; /* Driver's name */ ++ unsigned long flags; /* Flags (see documentation) */ ++ unsigned short minor; /* Minor number of the char device */ ++ unsigned short tabstop; /* Tab character length */ ++ unsigned short num_cntr; /* Controllers to drive */ ++ unsigned short cntr_rows; /* Rows per controller */ ++ unsigned short cntr_cols; /* Display columns */ ++ unsigned short vs_rows; /* Virtual screen rows */ ++ unsigned short vs_cols; /* Virtual screen columns */ ++ unsigned short cgram_chars; /* Number of user definable characters */ ++ unsigned short cgram_bytes; /* Number of bytes required to define a ++ * user definable character */ ++ unsigned char cgram_char0; /* Ascii of first user definable character */ ++}; ++ ++/* IOCTLs */ ++#include ++#define LCDL_SET_PARAM _IOW(LCD_MAJOR, 0x80, struct lcd_parameters *) ++#define LCDL_GET_PARAM _IOR(LCD_MAJOR, 0x81, struct lcd_parameters *) ++#define LCDL_CHARSUBST _IOW(LCD_MAJOR, 0x82, unsigned char *) ++#define LCDL_RAW_MODE _IOW(LCD_MAJOR, 0x83, unsigned int) ++#define LCDL_RESET_CHARMAP _IO(LCD_MAJOR, 0x84) ++#define LCDL_SAVE_CHARMAP _IO(LCD_MAJOR, 0x85) ++#define LCDL_RESTORE_CHARMAP _IO(LCD_MAJOR, 0x86) ++#define LCDL_SWAP_CHARMAP _IO(LCD_MAJOR, 0x87) ++#define LCDL_CLEAR_DISP _IO(LCD_MAJOR, 0x88) ++#define LCDL_SET_CGRAM_CHAR _IOW(LCD_MAJOR, 0x89, unsigned char *) ++#define LCDL_GET_CGRAM_CHAR _IOR(LCD_MAJOR, 0x8a, unsigned char *) ++#define LCDL_SET_CHARMAP _IOW(LCD_MAJOR, 0x8b, unsigned char *) ++#define LCDL_GET_CHARMAP _IOR(LCD_MAJOR, 0x8c, unsigned char *) ++#define LCDL_MEMSET _IOW(LCD_MAJOR, 0x8d, unsigned int *) ++#define LCDL_MEMMOVE _IOW(LCD_MAJOR, 0x8e, unsigned int *) ++ ++ ++ ++#ifdef __KERNEL__ /* The rest is for kernel only */ ++ ++#include ++#include ++ ++ ++struct lcd_driver { ++ void (*read_char)(unsigned int offset, unsigned short *data); ++ void (*read_cgram_char)(unsigned char index, unsigned char *pixmap); ++ void (*write_char)(unsigned int offset, unsigned short data); ++ void (*write_cgram_char)(unsigned char index, unsigned char *pixmap); ++ void (*clear_display)(void); ++ void (*address_mode)(int mode); ++ int (*validate_driver)(void); ++ int (*init_display)(void); ++ int (*cleanup_display)(void); ++ int (*init_port)(void); ++ int (*cleanup_port)(void); ++ int (*handle_custom_char)(unsigned int data); ++ int (*handle_custom_ioctl)(unsigned int cmd, unsigned long arg, unsigned int arg_in_userspace); ++ ++ /* The character map to be used */ ++ unsigned char *charmap; ++ ++ /* The root where the driver can create its own proc files. ++ * Will be filled by the lcd-linux layer. ++ */ ++ struct proc_dir_entry *driver_proc_root; ++ ++ /* Set this field to 'driver_module_init' or call lcd_driver_setup ++ * just before registering the driver with lcd_register_driver. ++ */ ++ struct module *driver_module; ++}; ++ ++#ifdef MODULE ++#define driver_module_init THIS_MODULE ++#else ++#define driver_module_init NULL ++#endif ++ ++/* Always call lcd_driver_setup just before registering the driver ++ * with lcd_register_driver. ++ */ ++static inline void lcd_driver_setup(struct lcd_driver *p) ++{ ++ p->driver_module = driver_module_init; ++} ++ ++/* External interface */ ++struct lcd_struct; ++int lcd_register_driver(struct lcd_driver *drv, struct lcd_parameters *par); ++int lcd_unregister_driver(struct lcd_driver *drv, struct lcd_parameters *par); ++int lcd_open(unsigned short minor, struct lcd_struct **lcd); ++int lcd_close(struct lcd_struct **lcd); ++int lcd_ioctl(struct lcd_struct *lcd, unsigned int cmd, ...); ++ssize_t lcd_write(struct lcd_struct *lcd, const void *buffer, size_t length, loff_t offset, unsigned int); ++ssize_t lcd_read(struct lcd_struct *lcd, void *buffer, size_t length, loff_t offset, unsigned int); ++ ++#endif /* __KERNEL__ */ ++ ++#endif /* External interface included */ diff --git a/target/linux/ep93xx/patches-2.6.30/003-ep93xx-i2c.patch b/target/linux/ep93xx/patches-2.6.30/003-ep93xx-i2c.patch new file mode 100644 index 000000000..aaf4d3ca8 --- /dev/null +++ b/target/linux/ep93xx/patches-2.6.30/003-ep93xx-i2c.patch @@ -0,0 +1,225 @@ +Index: linux-2.6.30.9/drivers/i2c/busses/Kconfig +=================================================================== +--- linux-2.6.30.9.orig/drivers/i2c/busses/Kconfig 2009-11-24 21:00:21.000000000 +0100 ++++ linux-2.6.30.9/drivers/i2c/busses/Kconfig 2009-11-24 21:00:23.000000000 +0100 +@@ -326,6 +326,10 @@ + devices such as DaVinci NIC. + For details please see http://www.ti.com/davinci + ++config I2C_EP93XX ++ tristate "EP93XX I2C" ++ depends on I2C && ARCH_EP93XX ++ + config I2C_GPIO + tristate "GPIO-based bitbanging I2C" + depends on GENERIC_GPIO +Index: linux-2.6.30.9/drivers/i2c/busses/Makefile +=================================================================== +--- linux-2.6.30.9.orig/drivers/i2c/busses/Makefile 2009-11-24 21:00:21.000000000 +0100 ++++ linux-2.6.30.9/drivers/i2c/busses/Makefile 2009-11-24 21:00:23.000000000 +0100 +@@ -30,6 +30,7 @@ + obj-$(CONFIG_I2C_BLACKFIN_TWI) += i2c-bfin-twi.o + obj-$(CONFIG_I2C_CPM) += i2c-cpm.o + obj-$(CONFIG_I2C_DAVINCI) += i2c-davinci.o ++obj-$(CONFIG_I2C_EP93XX) += i2c-ep93xx.o + obj-$(CONFIG_I2C_GPIO) += i2c-gpio.o + obj-$(CONFIG_I2C_HIGHLANDER) += i2c-highlander.o + obj-$(CONFIG_I2C_IBM_IIC) += i2c-ibm_iic.o +Index: linux-2.6.30.9/drivers/i2c/busses/i2c-ep93xx.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.30.9/drivers/i2c/busses/i2c-ep93xx.c 2009-11-24 21:00:38.000000000 +0100 +@@ -0,0 +1,193 @@ ++/* ------------------------------------------------------------------------ * ++ * i2c-ep933xx.c I2C bus glue for Cirrus EP93xx * ++ * ------------------------------------------------------------------------ * ++ ++ Copyright (C) 2004 Michael Burian ++ ++ Based on i2c-parport-light.c ++ Copyright (C) 2003-2004 Jean Delvare ++ ++ 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 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ * ------------------------------------------------------------------------ */ ++ ++ ++//#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++//1/(2*clockfrequency) ++#define EE_DELAY_USEC 50 ++#define GPIOG_EECLK 1 ++#define GPIOG_EEDAT 2 ++ ++/* ----- I2C algorithm call-back functions and structures ----------------- */ ++ ++// TODO: optimize ++static void ep93xx_setscl(void *data, int state) ++{ ++ unsigned int uiPGDR, uiPGDDR; ++ ++ uiPGDR = inl(GPIO_PGDR); ++ uiPGDDR = inl(GPIO_PGDDR); ++ ++ /* Configure the clock line as output. */ ++ uiPGDDR |= GPIOG_EECLK; ++ outl(uiPGDDR, GPIO_PGDDR); ++ ++ /* Set clock line to state */ ++ if(state) ++ uiPGDR |= GPIOG_EECLK; ++ else ++ uiPGDR &= ~GPIOG_EECLK; ++ ++ outl(uiPGDR, GPIO_PGDR); ++} ++ ++static void ep93xx_setsda(void *data, int state) ++{ ++ unsigned int uiPGDR, uiPGDDR; ++ ++ uiPGDR = inl(GPIO_PGDR); ++ uiPGDDR = inl(GPIO_PGDDR); ++ ++ /* Configure the data line as output. */ ++ uiPGDDR |= GPIOG_EEDAT; ++ outl(uiPGDDR, GPIO_PGDDR); ++ ++ /* Set data line to state */ ++ if(state) ++ uiPGDR |= GPIOG_EEDAT; ++ else ++ uiPGDR &= ~GPIOG_EEDAT; ++ ++ outl(uiPGDR, GPIO_PGDR); ++} ++ ++static int ep93xx_getscl(void *data) ++{ ++ unsigned int uiPGDR, uiPGDDR; ++ ++ uiPGDR = inl(GPIO_PGDR); ++ uiPGDDR = inl(GPIO_PGDDR); ++ ++ /* Configure the clock line as input */ ++ uiPGDDR &= ~GPIOG_EECLK; ++ outl(uiPGDDR, GPIO_PGDDR); ++ ++ /* Return state of the clock line */ ++ return (inl(GPIO_PGDR) & GPIOG_EECLK) ? 1 : 0; ++} ++ ++static int ep93xx_getsda(void *data) ++{ ++ unsigned int uiPGDR, uiPGDDR; ++ uiPGDR = inl(GPIO_PGDR); ++ uiPGDDR = inl(GPIO_PGDDR); ++ ++ /* Configure the data line as input */ ++ uiPGDDR &= ~GPIOG_EEDAT; ++ outl(uiPGDDR, GPIO_PGDDR); ++ ++ /* Return state of the data line */ ++ return (inl(GPIO_PGDR) & GPIOG_EEDAT) ? 1 : 0; ++} ++ ++/* ------------------------------------------------------------------------ ++ * Encapsulate the above functions in the correct operations structure. ++ * This is only done when more than one hardware adapter is supported. ++ */ ++ ++/* last line (us, ms, timeout) ++ * us dominates the bit rate: 10us means: 100Kbit/sec(25 means 40kbps) ++ * 10ms not known ++ * 100ms timeout ++ */ ++static struct i2c_algo_bit_data ep93xx_data = { ++ .setsda = ep93xx_setsda, ++ .setscl = ep93xx_setscl, ++ .getsda = ep93xx_getsda, ++ .getscl = ep93xx_getscl, ++ .udelay = 10, ++ //.mdelay = 10, ++ .timeout = HZ, ++}; ++ ++/* ----- I2c structure ---------------------------------------------------- */ ++static struct i2c_adapter ep93xx_adapter = { ++ .owner = THIS_MODULE, ++ .class = I2C_CLASS_HWMON, ++ .algo_data = &ep93xx_data, ++ .name = "EP93XX I2C bit-bang interface", ++}; ++ ++/* ----- Module loading, unloading and information ------------------------ */ ++ ++static int __init i2c_ep93xx_init(void) ++{ ++ unsigned long uiPGDR, uiPGDDR; ++ ++ /* Read the current value of the GPIO data and data direction registers. */ ++ uiPGDR = inl(GPIO_PGDR); ++ uiPGDDR = inl(GPIO_PGDDR); ++ ++ /* If the GPIO pins have not been configured since reset, the data ++ * and clock lines will be set as inputs and with data value of 0. ++ * External pullup resisters are pulling them high. ++ * Set them both high before configuring them as outputs. */ ++ uiPGDR |= (GPIOG_EEDAT | GPIOG_EECLK); ++ outl(uiPGDR, GPIO_PGDR); ++ ++ /* Delay to meet the EE Interface timing specification. */ ++ udelay(EE_DELAY_USEC); ++ ++ ++ /* Configure the EE data and clock lines as outputs. */ ++ uiPGDDR |= (GPIOG_EEDAT | GPIOG_EECLK); ++ outl(uiPGDDR, GPIO_PGDDR); ++ ++ /* Delay to meet the EE Interface timing specification. */ ++ udelay(EE_DELAY_USEC); ++ ++ /* Reset hardware to a sane state (SCL and SDA high) */ ++ ep93xx_setsda(NULL, 1); ++ ep93xx_setscl(NULL, 1); ++ ++ if (i2c_bit_add_bus(&ep93xx_adapter) > 0) { ++ printk(KERN_ERR "i2c-ep93xx: Unable to register with I2C\n"); ++ return -ENODEV; ++ } ++ ++ return 0; ++} ++ ++static void __exit i2c_ep93xx_exit(void) ++{ ++ //i2c_bit_del_bus(&ep93xx_adapter); ++ i2c_del_adapter(&ep93xx_adapter); ++} ++ ++MODULE_AUTHOR("Michael Burian"); ++MODULE_DESCRIPTION("I2C bus glue for Cirrus EP93xx processors"); ++MODULE_LICENSE("GPL"); ++ ++module_init(i2c_ep93xx_init); ++module_exit(i2c_ep93xx_exit); diff --git a/target/linux/ep93xx/patches-2.6.30/004-simone-rtc.patch b/target/linux/ep93xx/patches-2.6.30/004-simone-rtc.patch new file mode 100644 index 000000000..69f2c5a9b --- /dev/null +++ b/target/linux/ep93xx/patches-2.6.30/004-simone-rtc.patch @@ -0,0 +1,78 @@ +--- a/drivers/rtc/rtc-ds1307.c ++++ b/drivers/rtc/rtc-ds1307.c +@@ -661,6 +661,13 @@ static int __devinit ds1307_probe(struct + goto exit_free; + } + ++#if (defined(CONFIG_MACH_SIM_ONE)) ++ /* SIM.ONE board needs 32khz clock on SQW/INTB pin */ ++ i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL, ++ ds1307->regs[0] & ~DS1337_BIT_INTCN); ++ i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL, ++ ds1307->regs[0] | (DS1337_BIT_RS1 | DS1337_BIT_RS2)); ++#endif + /* oscillator off? turn it on, so clock can tick. */ + if (ds1307->regs[0] & DS1337_BIT_nEOSC) + ds1307->regs[0] &= ~DS1337_BIT_nEOSC; +--- a/drivers/rtc/Kconfig ++++ b/drivers/rtc/Kconfig +@@ -570,6 +570,14 @@ config RTC_DRV_EP93XX + This driver can also be built as a module. If so, the module + will be called rtc-ep93xx. + ++config RTC_DRV_EP93XX_DS1337 ++ bool "Cirrus Logic EP93XX using DS1337 chip" ++ depends on RTC_DRV_EP93XX && I2C && MACH_SIM_ONE ++ help ++ If you say yes here, the EP93XX driver will use the ++ battery-backed-up DS1337 RTC chip on the SIM.ONE board. ++ You almost certainly want this. ++ + config RTC_DRV_SA1100 + tristate "SA11x0/PXA2xx" + depends on ARCH_SA1100 || ARCH_PXA +--- a/drivers/rtc/rtc-ep93xx.c ++++ b/drivers/rtc/rtc-ep93xx.c +@@ -13,6 +13,13 @@ + #include + #include + #include ++#include ++ ++#if defined(CONFIG_RTC_DRV_EP93XX_DS1337) ++extern int ds1337_do_command(int id, int cmd, void *arg); ++#define DS1337_GET_DATE 0 ++#define DS1337_SET_DATE 1 ++#endif + + #define EP93XX_RTC_REG(x) (EP93XX_RTC_BASE + (x)) + #define EP93XX_RTC_DATA EP93XX_RTC_REG(0x0000) +@@ -37,16 +44,28 @@ static int ep93xx_get_swcomp(struct devi + + static int ep93xx_rtc_read_time(struct device *dev, struct rtc_time *tm) + { ++#if defined(CONFIG_RTC_DRV_EP93XX_DS1337) ++ /* Reroute the internal device to the DS1337 */ ++ return ds1337_do_command(0, DS1337_GET_DATE, (void *)tm); ++#else + unsigned long time = __raw_readl(EP93XX_RTC_DATA); + + rtc_time_to_tm(time, tm); + return 0; ++#endif + } + + static int ep93xx_rtc_set_mmss(struct device *dev, unsigned long secs) + { ++#if defined(CONFIG_RTC_DRV_EP93XX_DS1337) ++ struct rtc_time tm; ++ ++ rtc_time_to_tm(secs, &tm); ++ return ds1337_do_command(0, DS1337_SET_DATE, (void *)&tm); ++#else + __raw_writel(secs + 1, EP93XX_RTC_LOAD); + return 0; ++#endif + } + + static int ep93xx_rtc_proc(struct device *dev, struct seq_file *seq) diff --git a/target/linux/ep93xx/patches-2.6.30/005-ep93xx-dma.patch b/target/linux/ep93xx/patches-2.6.30/005-ep93xx-dma.patch new file mode 100644 index 000000000..366413202 --- /dev/null +++ b/target/linux/ep93xx/patches-2.6.30/005-ep93xx-dma.patch @@ -0,0 +1,3622 @@ +--- /dev/null ++++ b/arch/arm/mach-ep93xx/dma_ep93xx.c +@@ -0,0 +1,2940 @@ ++/****************************************************************************** ++ * arch/arm/mach-ep9312/dma_ep93xx.c ++ * ++ * Support functions for the ep93xx internal DMA channels. ++ * (see also Documentation/arm/ep93xx/dma.txt) ++ * ++ * Copyright (C) 2003 Cirrus Logic ++ * ++ * A large portion of this file is based on the dma api implemented by ++ * Nicolas Pitre, dma-sa1100.c, copyrighted 2000. ++ * ++ * ++ * 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 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * ++ ****************************************************************************/ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include "dma_ep93xx.h" ++ ++/***************************************************************************** ++ * ++ * Debugging macros ++ * ++ ****************************************************************************/ ++#undef DEBUG ++//#define DEBUG 1 ++#ifdef DEBUG ++#define DPRINTK( fmt, arg... ) printk( fmt, ##arg ) ++#else ++#define DPRINTK( fmt, arg... ) ++#endif ++ ++/***************************************************************************** ++ * ++ * static global variables ++ * ++ ****************************************************************************/ ++ep93xx_dma_t dma_chan[MAX_EP93XX_DMA_CHANNELS]; ++ ++/* ++ * lock used to protect the list of dma channels while searching for a free ++ * channel during dma_request. ++ */ ++//static spinlock_t dma_list_lock; ++static spinlock_t dma_list_lock = SPIN_LOCK_UNLOCKED; ++ ++/***************************************************************************** ++ * ++ * Internal DMA processing functions. ++ * ++ ****************************************************************************/ ++/***************************************************************************** ++ * ++ * get_dma_channel_from_handle() ++ * ++ * If Handle is valid, returns the DMA channel # (0 to 9 for channels 1-10) ++ * If Handle is not valid, returns -1. ++ * ++ ****************************************************************************/ ++static int ++dma_get_channel_from_handle(int handle) ++{ ++ int channel; ++ ++ /* ++ * Get the DMA channel # from the handle. ++ */ ++ channel = ((int)handle & DMA_HANDLE_SPECIFIER_MASK) >> 28; ++ ++ /* ++ * See if this is a valid handle. ++ */ ++ if (dma_chan[channel].last_valid_handle != (int)handle) { ++ DPRINTK("DMA ERROR - invalid handle 0x%x \n", handle); ++ return(-1); ++ } ++ ++ /* ++ * See if this instance is still open ++ */ ++ if (!dma_chan[channel].ref_count ) ++ return(-1); ++ ++ return(channel); ++} ++ ++static void dma_m2m_transfer_done(ep93xx_dma_t *dma) ++{ ++ unsigned int uiCONTROL; ++ unsigned int M2M_reg_base = dma->reg_base; ++ unsigned int read_back; ++ ++ DPRINTK("1 "); ++ ++ outl( 0, M2M_reg_base+M2M_OFFSET_INTERRUPT ); ++ ++ if (dma->total_buffers) { ++ /* ++ * The current_buffer has already been tranfered, so add the ++ * byte count to the total_bytes field. ++ */ ++ dma->total_bytes = dma->total_bytes + ++ dma->buffer_queue[dma->current_buffer].size; ++ ++ /* ++ * Mark the current_buffer as used. ++ */ ++ dma->buffer_queue[dma->current_buffer].used = TRUE; ++ ++ /* ++ * Increment the used buffer counter ++ */ ++ dma->used_buffers++; ++ ++ DPRINTK("#%d", dma->current_buffer); ++ ++ /* ++ * Increment the current_buffer ++ */ ++ dma->current_buffer = (dma->current_buffer + 1) % ++ MAX_EP93XX_DMA_BUFFERS; ++ ++ /* ++ * check if there's a new buffer to transfer. ++ */ ++ if (dma->new_buffers && dma->xfer_enable) { ++ /* ++ * We have a new buffer to transfer so program in the ++ * buffer values. Since a STALL interrupt was ++ * triggered, we program the buffer descriptor 0 ++ * ++ * Set the SAR_BASE/DAR_BASE/BCR registers with values ++ * from the next buffer in the queue. ++ */ ++ outl( dma->buffer_queue[dma->current_buffer].source, ++ M2M_reg_base + M2M_OFFSET_SAR_BASE0 ); ++ ++ outl( dma->buffer_queue[dma->current_buffer].dest, ++ M2M_reg_base + M2M_OFFSET_DAR_BASE0 ); ++ ++ outl( dma->buffer_queue[dma->current_buffer].size, ++ M2M_reg_base + M2M_OFFSET_BCR0 ); ++ ++ DPRINTK("SAR_BASE0 - 0x%x\n", dma->buffer_queue[dma->current_buffer].source); ++ DPRINTK("DAR_BASE0 - 0x%x\n", dma->buffer_queue[dma->current_buffer].dest); ++ DPRINTK("BCR0 - 0x%x\n", dma->buffer_queue[dma->current_buffer].size); ++ ++ /* ++ * Decrement the new buffer counter ++ */ ++ dma->new_buffers--; ++ ++ /* ++ * If there's a second new buffer, we program the ++ * second buffer descriptor. ++ */ ++ if (dma->new_buffers) { ++ outl( dma->buffer_queue[(dma->current_buffer + 1) % ++ MAX_EP93XX_DMA_BUFFERS].source, ++ M2M_reg_base+M2M_OFFSET_SAR_BASE1 ); ++ ++ outl( dma->buffer_queue[(dma->current_buffer + 1) % ++ MAX_EP93XX_DMA_BUFFERS].dest, ++ M2M_reg_base+M2M_OFFSET_DAR_BASE1 ); ++ ++ outl( dma->buffer_queue[(dma->current_buffer + 1) % ++ MAX_EP93XX_DMA_BUFFERS].size, ++ M2M_reg_base+M2M_OFFSET_BCR1 ); ++ ++ uiCONTROL = inl(M2M_reg_base+M2M_OFFSET_CONTROL); ++ uiCONTROL |= CONTROL_M2M_NFBINTEN; ++ outl( uiCONTROL, M2M_reg_base+M2M_OFFSET_CONTROL ); ++ ++ dma->new_buffers--; ++ } ++ } else { ++ DPRINTK("2 \n"); ++ /* ++ * There's a chance we setup both buffer descriptors, ++ * but didn't service the NFB quickly enough, causing ++ * the channel to transfer both buffers, then enter the ++ * stall state. So, we need to be able to process the ++ * second buffer. ++ */ ++ if ((dma->used_buffers + dma->new_buffers) < dma->total_buffers) ++ { ++ DPRINTK("3 "); ++ ++ /* ++ * The current_buffer has already been ++ * tranferred, so add the byte count to the ++ * total_bytes field. ++ */ ++ dma->total_bytes = dma->total_bytes + ++ dma->buffer_queue[dma->current_buffer].size; ++ ++ /* ++ * Mark the current_buffer as used. ++ */ ++ dma->buffer_queue[dma->current_buffer].used = TRUE; ++ ++ /* ++ * Increment the used buffer counter ++ */ ++ dma->used_buffers++; ++ ++ DPRINTK("#%d", dma->current_buffer); ++ ++ /* ++ * Increment the current buffer pointer. ++ */ ++ dma->current_buffer = (dma->current_buffer + 1) % ++ MAX_EP93XX_DMA_BUFFERS; ++ ++ } ++ ++ /* ++ * No new buffers to transfer, so disable the channel. ++ */ ++ uiCONTROL = inl(M2M_reg_base+M2M_OFFSET_CONTROL); ++ uiCONTROL &= ~CONTROL_M2M_ENABLE; ++ outl( uiCONTROL, M2M_reg_base+M2M_OFFSET_CONTROL ); ++ ++ /* ++ * Indicate that this channel is in the pause by ++ * starvation state by setting the pause bit to true. ++ */ ++ dma->pause = TRUE; ++ } ++ } else { ++ /* ++ * No buffers to transfer, or old buffers to mark as used, ++ * so disable the channel ++ */ ++ uiCONTROL = inl(M2M_reg_base+M2M_OFFSET_CONTROL); ++ uiCONTROL &= ~CONTROL_M2M_ENABLE; ++ outl( uiCONTROL, M2M_reg_base+M2M_OFFSET_CONTROL ); ++ ++ /* ++ * Must read the control register back after a write. ++ */ ++ read_back = inl(M2M_reg_base+M2M_OFFSET_CONTROL); ++ ++ /* ++ * Indicate that this channel is in the pause by ++ * starvation state by setting the pause bit to true. ++ */ ++ dma->pause = TRUE; ++ } ++} ++ ++static void dma_m2m_next_frame_buffer(ep93xx_dma_t *dma) ++{ ++ int loop; ++ unsigned int uiCONTROL; ++ unsigned int M2M_reg_base = dma->reg_base; ++ ++ DPRINTK("5 "); ++ ++ if (dma->total_buffers) { ++ DPRINTK("6 "); ++ /* ++ * The iCurrentBuffer has already been transfered. so add the ++ * byte count from the current buffer to the total byte count. ++ */ ++ dma->total_bytes = dma->total_bytes + ++ dma->buffer_queue[dma->current_buffer].size; ++ ++ /* ++ * Mark the Current Buffer as used. ++ */ ++ dma->buffer_queue[dma->current_buffer].used = TRUE; ++ ++ /* ++ * Increment the used buffer counter ++ */ ++ dma->used_buffers++; ++ ++ DPRINTK("#%d", dma->current_buffer); ++ ++ if ((dma->buffer_queue[ ++ (dma->current_buffer + 1) % MAX_EP93XX_DMA_BUFFERS].last) || ++ (dma->new_buffers == 0) || (dma->xfer_enable == FALSE)) { ++ DPRINTK("7 "); ++ ++ /* ++ * This is the last Buffer in this transaction, so ++ * disable the NFB interrupt. We shouldn't get an NFB ++ * int when the FSM moves to the ON state where it ++ * would typically get the NFB int indicating a new ++ * buffer can be programmed. Instead, once in the ON ++ * state, the DMA will just proceed to complete the ++ * transfer of the current buffer, move the FSB ++ * directly to the STALL state where a STALL interrupt ++ * will be generated. ++ */ ++ uiCONTROL = inl(M2M_reg_base+M2M_OFFSET_CONTROL); ++ uiCONTROL &= ~CONTROL_M2M_NFBINTEN ; ++ outl( uiCONTROL, M2M_reg_base+M2M_OFFSET_CONTROL ); ++ ++ /* ++ * The current buffer has been transferred, so ++ * increment the current buffer counter to reflect ++ * this. ++ */ ++ dma->current_buffer = (dma->current_buffer + 1) % ++ MAX_EP93XX_DMA_BUFFERS; ++ ++ DPRINTK("End of NFB handling. \n"); ++ DPRINTK("CONTROL - 0x%x \n", ++ inl(M2M_reg_base+M2M_OFFSET_CONTROL) ); ++ DPRINTK("STATUS - 0x%x \n", ++ inl(M2M_reg_base+M2M_OFFSET_STATUS) ); ++ DPRINTK("SAR_BASE0 - 0x%x \n", ++ inl(M2M_reg_base+M2M_OFFSET_SAR_BASE0) ); ++ DPRINTK("SAR_CUR0 - 0x%x \n", ++ inl(M2M_reg_base+M2M_OFFSET_SAR_CURRENT0) ); ++ DPRINTK("DAR_BASE0 - 0x%x \n", ++ inl(M2M_reg_base+M2M_OFFSET_DAR_BASE0) ); ++ DPRINTK("DAR_CUR0 - 0x%x \n", ++ inl(M2M_reg_base+M2M_OFFSET_DAR_CURRENT0) ); ++ ++ DPRINTK("Buffer buf_id source size last used \n"); ++ for (loop = 0; loop < 32; loop ++) ++ DPRINTK("%d 0x%x 0x%x 0x%x %d %d \n", ++ loop, dma->buffer_queue[loop].buf_id, ++ dma->buffer_queue[loop].source, ++ dma->buffer_queue[loop].size, ++ dma->buffer_queue[loop].last, ++ dma->buffer_queue[loop].used); ++ DPRINTK("pause 0x%x 0x%x 0x%x %d %d \n", ++ dma->pause_buf.buf_id, dma->pause_buf.source, ++ dma->pause_buf.size, dma->pause_buf.last, ++ dma->pause_buf.used); ++ ++ DPRINTK("Pause - %d \n", dma->pause); ++ DPRINTK("xfer_enable - %d \n", dma->xfer_enable); ++ DPRINTK("total bytes - 0x%x \n", dma->total_bytes); ++ DPRINTK("total buffer - %d \n", dma->total_buffers); ++ DPRINTK("new buffers - %d \n", dma->new_buffers); ++ DPRINTK("current buffer - %d \n", dma->current_buffer); ++ DPRINTK("last buffer - %d \n", dma->last_buffer); ++ DPRINTK("used buffers - %d \n", dma->used_buffers); ++ DPRINTK("callback addr - 0x%p \n", dma->callback); ++ ++ } else if (dma->new_buffers) { ++ DPRINTK("8 "); ++ /* ++ * We have a new buffer, so increment the current ++ * buffer to point to the next buffer, which is already ++ * programmed into the DMA. Next time around, it'll be ++ * pointing to the current buffer. ++ */ ++ dma->current_buffer = (dma->current_buffer + 1) % ++ MAX_EP93XX_DMA_BUFFERS; ++ ++ /* ++ * We know we have a new buffer to program as the next ++ * buffer, so check which set of SAR_BASE/DAR_BASE/BCR ++ * registers to program. ++ */ ++ if ( inl(M2M_reg_base+M2M_OFFSET_STATUS) & STATUS_M2M_NB ) { ++ /* ++ * Set the SAR_BASE1/DAR_BASE1/BCR1 registers ++ * with values from the next buffer in the ++ * queue. ++ */ ++ outl( dma->buffer_queue[(dma->current_buffer + 1) % ++ MAX_EP93XX_DMA_BUFFERS].source, ++ M2M_reg_base+M2M_OFFSET_SAR_BASE1 ); ++ ++ outl( dma->buffer_queue[(dma->current_buffer + 1) % ++ MAX_EP93XX_DMA_BUFFERS].dest, ++ M2M_reg_base+M2M_OFFSET_DAR_BASE1 ); ++ ++ outl( dma->buffer_queue[(dma->current_buffer + 1) % ++ MAX_EP93XX_DMA_BUFFERS].size, ++ M2M_reg_base+M2M_OFFSET_BCR1 ); ++ } else { ++ /* ++ * Set the SAR_BASE0/DAR_BASE0/BCR0 registers ++ * with values from the next buffer in the ++ * queue. ++ */ ++ outl( dma->buffer_queue[(dma->current_buffer + 1) % ++ MAX_EP93XX_DMA_BUFFERS].source, ++ M2M_reg_base+M2M_OFFSET_SAR_BASE0 ); ++ ++ outl( dma->buffer_queue[(dma->current_buffer + 1) % ++ MAX_EP93XX_DMA_BUFFERS].dest, ++ M2M_reg_base+M2M_OFFSET_DAR_BASE0 ); ++ ++ outl( dma->buffer_queue[(dma->current_buffer + 1) % ++ MAX_EP93XX_DMA_BUFFERS].size, ++ M2M_reg_base+M2M_OFFSET_BCR0 ); ++ } ++ ++ /* ++ * Decrement the new buffers counter ++ */ ++ dma->new_buffers--; ++ } ++ } else { ++ /* ++ * Total number of buffers is 0 - really we should never get ++ * here, but just in case. ++ */ ++ DPRINTK("9 \n"); ++ ++ /* ++ * No new buffers to transfer, so Disable the channel ++ */ ++ uiCONTROL = inl(M2M_reg_base+M2M_OFFSET_CONTROL); ++ uiCONTROL &= ~CONTROL_M2M_ENABLE; ++ outl( uiCONTROL, M2M_reg_base+M2M_OFFSET_CONTROL ); ++ ++ /* ++ * Indicate that the channel is paused by starvation. ++ */ ++ dma->pause = 1; ++ } ++} ++ ++/***************************************************************************** ++ * ++ * dma_m2m_irq_handler ++ * ++ ****************************************************************************/ ++static irqreturn_t ++dma_m2m_irq_handler(int irq, void *dev_id) ++{ ++ ep93xx_dma_t *dma = (ep93xx_dma_t *)dev_id; ++ unsigned int M2M_reg_base = dma->reg_base; ++ ep93xx_dma_dev_t dma_int = UNDEF_INT; ++ int status; ++ ++// printk("+m2m irq=%d\n", irq); ++ ++ /* ++ * Determine what kind of dma interrupt this is. ++ */ ++ status = inl(M2M_reg_base + M2M_OFFSET_INTERRUPT); ++ if ( status & INTERRUPT_M2M_DONEINT ) ++ dma_int = DONE; // we're done with a requested dma ++ else if ( status & INTERRUPT_M2M_NFBINT ) ++ dma_int = NFB; // we're done with one dma buffer ++ ++ DPRINTK("IRQ: b=%#x st=%#x\n", (int)dma->current_buffer, dma_int); ++ ++ switch (dma_int) { ++ /* ++ * Next Frame Buffer Interrupt. If there's a new buffer program it ++ * Check if this is the last buffer in the transfer, ++ * and if it is, disable the NFB int to prevent being ++ * interrupted for another buffer when we know there won't be ++ * another. ++ */ ++ case NFB: ++ dma_m2m_next_frame_buffer(dma); ++ break; ++ /* ++ * Done interrupt generated, indicating that the transfer is complete. ++ */ ++ case DONE: ++ dma_m2m_transfer_done(dma); ++ break; ++ ++ default: ++ break; ++ } ++ ++ if ((dma_int != UNDEF_INT) && dma->callback) ++ dma->callback(dma_int, dma->device, dma->user_data); ++ ++ return IRQ_HANDLED; ++} ++ ++/***************************************************************************** ++ * ++ * dma_m2p_irq_handler ++ * ++ * ++ * ++ ****************************************************************************/ ++static irqreturn_t ++dma_m2p_irq_handler(int irq, void *dev_id) ++{ ++ ep93xx_dma_t *dma = (ep93xx_dma_t *) dev_id; ++ unsigned int M2P_reg_base = dma->reg_base; ++ unsigned int read_back; ++ ep93xx_dma_dev_t dma_int = UNDEF_INT; ++ unsigned int loop, uiCONTROL, uiINTERRUPT; ++ ++ /* ++ * Determine what kind of dma interrupt this is. ++ */ ++ if ( inl(M2P_reg_base+M2P_OFFSET_INTERRUPT) & INTERRUPT_M2P_STALLINT ) ++ dma_int = STALL; ++ else if ( inl(M2P_reg_base+M2P_OFFSET_INTERRUPT) & INTERRUPT_M2P_NFBINT ) ++ dma_int = NFB; ++ else if ( inl(M2P_reg_base+M2P_OFFSET_INTERRUPT) & INTERRUPT_M2P_CHERRORINT ) ++ dma_int = CHERROR; ++ ++ /* ++ * Stall Interrupt: The Channel is stalled, meaning nothing is ++ * programmed to transfer right now. So, we're back to the ++ * beginnning. If there's a buffer to transfer, program it into ++ * max and base 0 registers. ++ */ ++ if (dma_int == STALL) { ++ DPRINTK("1 "); ++ ++ if (dma->total_buffers) { ++ /* ++ * The current_buffer has already been tranfered, so ++ * add the byte count to the total_bytes field. ++ */ ++ dma->total_bytes = dma->total_bytes + ++ dma->buffer_queue[dma->current_buffer].size; ++ ++ /* ++ * Mark the current_buffer as used. ++ */ ++ dma->buffer_queue[dma->current_buffer].used = TRUE; ++ ++ /* ++ * Increment the used buffer counter ++ */ ++ dma->used_buffers++; ++ ++ DPRINTK("#%d", dma->current_buffer); ++ ++ /* ++ * Increment the current_buffer ++ */ ++ dma->current_buffer = (dma->current_buffer + 1) % ++ MAX_EP93XX_DMA_BUFFERS; ++ ++ /* ++ * check if there's a new buffer to transfer. ++ */ ++ if (dma->new_buffers && dma->xfer_enable) { ++ /* ++ * We have a new buffer to transfer so program ++ * in the buffer values. Since a STALL ++ * interrupt was triggered, we program the ++ * base0 and maxcnt0 ++ * ++ * Set the MAXCNT0 register with the buffer ++ * size ++ */ ++ outl( dma->buffer_queue[dma->current_buffer].size, ++ M2P_reg_base+M2P_OFFSET_MAXCNT0 ); ++ ++ /* ++ * Set the BASE0 register with the buffer base ++ * address ++ */ ++ outl( dma->buffer_queue[dma->current_buffer].source, ++ M2P_reg_base+M2P_OFFSET_BASE0 ); ++ ++ /* ++ * Decrement the new buffer counter ++ */ ++ dma->new_buffers--; ++ ++ if (dma->new_buffers) { ++ DPRINTK("A "); ++ /* ++ * Set the MAXCNT1 register with the ++ * buffer size ++ */ ++ outl( dma->buffer_queue[(dma->current_buffer + 1) % ++ MAX_EP93XX_DMA_BUFFERS].size, ++ M2P_reg_base+M2P_OFFSET_MAXCNT1 ); ++ ++ /* ++ * Set the BASE1 register with the ++ * buffer base address ++ */ ++ outl( dma->buffer_queue[dma->current_buffer + 1 % ++ MAX_EP93XX_DMA_BUFFERS].source, ++ M2P_reg_base+M2P_OFFSET_BASE1 ); ++ ++ /* ++ * Decrement the new buffer counter ++ */ ++ dma->new_buffers--; ++ ++ /* ++ * Enable the NFB Interrupt. ++ */ ++ uiCONTROL = inl(M2P_reg_base+M2P_OFFSET_CONTROL); ++ uiCONTROL |= CONTROL_M2P_NFBINTEN; ++ outl( uiCONTROL, M2P_reg_base+M2P_OFFSET_CONTROL ); ++ } ++ } else { ++ /* ++ * No new buffers. ++ */ ++ DPRINTK("2 \n"); ++ ++ /* ++ * There's a chance we setup both buffer descriptors, but ++ * didn't service the NFB quickly enough, causing the channel ++ * to transfer both buffers, then enter the stall state. ++ * So, we need to be able to process the second buffer. ++ */ ++ if ((dma->used_buffers + dma->new_buffers) < dma->total_buffers) { ++ DPRINTK("3 "); ++ ++ /* ++ * The current_buffer has already been tranfered, so add the ++ * byte count to the total_bytes field. ++ */ ++ dma->total_bytes = dma->total_bytes + ++ dma->buffer_queue[dma->current_buffer].size; ++ ++ /* ++ * Mark the current_buffer as used. ++ */ ++ dma->buffer_queue[dma->current_buffer].used = TRUE; ++ ++ /* ++ * Increment the used buffer counter ++ */ ++ dma->used_buffers++; ++ ++ DPRINTK("#%d", dma->current_buffer); ++ ++ /* ++ * Increment the current buffer pointer. ++ */ ++ dma->current_buffer = (dma->current_buffer + 1) % ++ MAX_EP93XX_DMA_BUFFERS; ++ ++ } ++ ++ /* ++ * No new buffers to transfer, so disable the channel. ++ */ ++ uiCONTROL = inl(M2P_reg_base+M2P_OFFSET_CONTROL); ++ uiCONTROL &= ~CONTROL_M2P_ENABLE; ++ outl( uiCONTROL, M2P_reg_base+M2P_OFFSET_CONTROL ); ++ ++ /* ++ * Indicate that this channel is in the pause by starvation ++ * state by setting the pause bit to true. ++ */ ++ dma->pause = TRUE; ++ ++ DPRINTK("STATUS - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_STATUS) ); ++ DPRINTK("CONTROL - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_CONTROL) ); ++ DPRINTK("REMAIN - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_REMAIN) ); ++ DPRINTK("PPALLOC - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_PPALLOC) ); ++ DPRINTK("BASE0 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_BASE0) ); ++ DPRINTK("MAXCNT0 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_MAXCNT0) ); ++ DPRINTK("CURRENT0 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_CURRENT0) ); ++ DPRINTK("BASE1 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_BASE1) ); ++ DPRINTK("MAXCNT1 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_MAXCNT1) ); ++ DPRINTK("CURRENT1 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_CURRENT1) ); ++ ++ DPRINTK("Buffer buf_id source size last used \n"); ++ for (loop = 0; loop < 32; loop ++) ++ DPRINTK("%d 0x%x 0x%x 0x%x %d %d \n", ++ loop, dma->buffer_queue[loop].buf_id, dma->buffer_queue[loop].source, ++ dma->buffer_queue[loop].size, ++ dma->buffer_queue[loop].last, dma->buffer_queue[loop].used); ++ DPRINTK("pause 0x%x 0x%x 0x%x %d %d \n", ++ dma->pause_buf.buf_id, dma->pause_buf.source, dma->pause_buf.size, ++ dma->pause_buf.last, dma->pause_buf.used); ++ ++ DPRINTK("Pause - %d \n", dma->pause); ++ DPRINTK("xfer_enable - %d \n", dma->xfer_enable); ++ DPRINTK("total bytes - 0x%x \n", dma->total_bytes); ++ DPRINTK("total buffer - %d \n", dma->total_buffers); ++ DPRINTK("new buffers - %d \n", dma->new_buffers); ++ DPRINTK("current buffer - %d \n", dma->current_buffer); ++ DPRINTK("last buffer - %d \n", dma->last_buffer); ++ DPRINTK("used buffers - %d \n", dma->used_buffers); ++ DPRINTK("callback addr - 0x%p \n", dma->callback); ++ } ++ } else { ++ /* ++ * No buffers to transfer, or old buffers to mark as used, ++ * so Disable the channel ++ */ ++ uiCONTROL = inl(M2P_reg_base+M2P_OFFSET_CONTROL); ++ uiCONTROL &= ~CONTROL_M2P_ENABLE; ++ outl( uiCONTROL, M2P_reg_base+M2P_OFFSET_CONTROL ); ++ ++ /* ++ * Must read the control register back after a write. ++ */ ++ read_back = inl(M2P_reg_base+M2P_OFFSET_CONTROL); ++ ++ /* ++ * Indicate that this channel is in the pause by ++ * starvation state by setting the pause bit to true. ++ */ ++ dma->pause = TRUE; ++ } ++ } ++ ++ /* ++ * Next Frame Buffer Interrupt. If there's a new buffer program it ++ * Check if this is the last buffer in the transfer, ++ * and if it is, disable the NFB int to prevent being ++ * interrupted for another buffer when we know there won't be ++ * another. ++ */ ++ if (dma_int == NFB) { ++ DPRINTK("5 "); ++ ++ if (dma->total_buffers) { ++ DPRINTK("6 "); ++ /* ++ * The iCurrentBuffer has already been transfered. so add the ++ * byte count from the current buffer to the total byte count. ++ */ ++ dma->total_bytes = dma->total_bytes + ++ dma->buffer_queue[dma->current_buffer].size; ++ ++ /* ++ * Mark the Current Buffer as used. ++ */ ++ dma->buffer_queue[dma->current_buffer].used = TRUE; ++ ++ /* ++ * Increment the used buffer counter ++ */ ++ dma->used_buffers++; ++ ++ DPRINTK("#%d", dma->current_buffer); ++ ++ if ((dma->buffer_queue[ ++ (dma->current_buffer + 1) % MAX_EP93XX_DMA_BUFFERS].last) || ++ (dma->new_buffers == 0) || (dma->xfer_enable == FALSE)) { ++ DPRINTK("7 "); ++ ++ /* ++ * This is the last Buffer in this transaction, so disable ++ * the NFB interrupt. We shouldn't get an NFB int when the ++ * FSM moves to the ON state where it would typically get the ++ * NFB int indicating a new buffer can be programmed. ++ * Instead, once in the ON state, the DMA will just proceed ++ * to complet the transfer of the current buffer, move the ++ * FSB directly to the STALL state where a STALL interrupt ++ * will be generated. ++ */ ++ uiCONTROL = inl(M2P_reg_base+M2P_OFFSET_CONTROL); ++ uiCONTROL &= ~CONTROL_M2P_NFBINTEN; ++ outl( uiCONTROL, M2P_reg_base+M2P_OFFSET_CONTROL ); ++ ++ /* ++ * The current buffer has been transferred, so increment ++ * the current buffer counter to reflect this. ++ */ ++ dma->current_buffer = (dma->current_buffer + 1) % MAX_EP93XX_DMA_BUFFERS; ++ ++ DPRINTK("End of NFB handling. \n"); ++ DPRINTK("STATUS - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_STATUS) ); ++ DPRINTK("CONTROL - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_CONTROL) ); ++ DPRINTK("REMAIN - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_REMAIN) ); ++ DPRINTK("PPALLOC - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_PPALLOC) ); ++ DPRINTK("BASE0 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_BASE0) ); ++ DPRINTK("MAXCNT0 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_MAXCNT0) ); ++ DPRINTK("CURRENT0 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_CURRENT0) ); ++ DPRINTK("BASE1 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_BASE1) ); ++ DPRINTK("MAXCNT1 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_MAXCNT1) ); ++ DPRINTK("CURRENT1 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_CURRENT1) ); ++ ++ DPRINTK("Buffer buf_id source size last used \n"); ++ for (loop = 0; loop < 32; loop ++) ++ DPRINTK("%d 0x%x 0x%x 0x%x %d %d \n", ++ loop, dma->buffer_queue[loop].buf_id, dma->buffer_queue[loop].source, ++ dma->buffer_queue[loop].size, ++ dma->buffer_queue[loop].last, dma->buffer_queue[loop].used); ++ DPRINTK("pause 0x%x 0x%x 0x%x %d %d \n", ++ dma->pause_buf.buf_id, dma->pause_buf.source, dma->pause_buf.size, ++ dma->pause_buf.last, dma->pause_buf.used); ++ ++ DPRINTK("Pause - %d \n", dma->pause); ++ DPRINTK("xfer_enable - %d \n", dma->xfer_enable); ++ DPRINTK("total bytes - 0x%x \n", dma->total_bytes); ++ DPRINTK("total buffer - %d \n", dma->total_buffers); ++ DPRINTK("new buffers - %d \n", dma->new_buffers); ++ DPRINTK("current buffer - %d \n", dma->current_buffer); ++ DPRINTK("last buffer - %d \n", dma->last_buffer); ++ DPRINTK("used buffers - %d \n", dma->used_buffers); ++ DPRINTK("callback addr - 0x%p \n", dma->callback); ++ ++ } else if (dma->new_buffers) { ++ DPRINTK("8 "); ++ /* ++ * we have a new buffer, so increment the current buffer to ++ * point to the next buffer, which is already programmed into ++ * the DMA. Next time around, it'll be pointing to the ++ * current buffer. ++ */ ++ dma->current_buffer = (dma->current_buffer + 1) % MAX_EP93XX_DMA_BUFFERS; ++ ++ /* ++ * we know we have a new buffer to program as the next ++ * buffer, so check which set of MAXCNT and BASE registers ++ * to program. ++ */ ++ if ( inl(M2P_reg_base+M2P_OFFSET_STATUS) & STATUS_M2P_NEXTBUFFER ) { ++ /* ++ * Set the MAXCNT1 register with the buffer size ++ */ ++ outl( dma->buffer_queue[ ++ (dma->current_buffer + 1) % MAX_EP93XX_DMA_BUFFERS].size, ++ M2P_reg_base+M2P_OFFSET_MAXCNT1 ); ++ ++ /* ++ * Set the BASE1 register with the buffer base address ++ */ ++ outl( dma->buffer_queue[ ++ (dma->current_buffer + 1) % MAX_EP93XX_DMA_BUFFERS].source, ++ M2P_reg_base+M2P_OFFSET_BASE1 ); ++ } else { ++ /* ++ * Set the MAXCNT0 register with the buffer size ++ */ ++ outl( dma->buffer_queue[ ++ (dma->current_buffer + 1) % MAX_EP93XX_DMA_BUFFERS].size, ++ M2P_reg_base+M2P_OFFSET_MAXCNT0 ); ++ ++ /* ++ * Set the BASE0 register with the buffer base address ++ */ ++ outl( dma->buffer_queue[ ++ (dma->current_buffer + 1) % MAX_EP93XX_DMA_BUFFERS].source, ++ M2P_reg_base+M2P_OFFSET_BASE0 ); ++ } ++ ++ /* ++ * Decrement the new buffers counter ++ */ ++ dma->new_buffers--; ++ } ++ } else { ++ /* ++ * Total number of buffers is 0 - really we should never get here, ++ * but just in case. ++ */ ++ DPRINTK("9 \n"); ++ ++ /* ++ * No new buffers to transfer, so Disable the channel ++ */ ++ uiCONTROL = inl(M2P_reg_base+M2P_OFFSET_CONTROL); ++ uiCONTROL &= ~CONTROL_M2P_ENABLE; ++ outl( uiCONTROL, M2P_reg_base+M2P_OFFSET_CONTROL ); ++ } ++ } ++ ++ /* ++ * Channel Error Interrupt, or perhipheral interrupt, specific to the ++ * memory to/from peripheral channels. ++ */ ++ if (dma_int == CHERROR) { ++ /* ++ * just clear the interrupt, it's really up to the peripheral ++ * driver to determine if any further action is necessary. ++ */ ++ uiINTERRUPT = inl(M2P_reg_base+M2P_OFFSET_INTERRUPT); ++ uiINTERRUPT &= ~INTERRUPT_M2P_CHERRORINT; ++ outl( uiINTERRUPT, M2P_reg_base+M2P_OFFSET_INTERRUPT ); ++ } ++ ++ /* ++ * Make sure the interrupt was valid, and if it was, then check ++ * if a callback function was installed for this DMA channel. If a ++ * callback was installed call it. ++ */ ++ if ((dma_int != UNDEF_INT) && dma->callback) ++ dma->callback(dma_int, dma->device, dma->user_data); ++ ++ return IRQ_HANDLED; ++} ++ ++/***************************************************************************** ++ * ++ * ep9312_dma_open_m2p(int device) ++ * ++ * Description: This function will attempt to open a M2P/P2M DMA channel. ++ * If the open is successful, the channel number is returned, ++ * otherwise a negative number is returned. ++ * ++ * Parameters: ++ * device: device for which the dma channel is requested. ++ * ++ ****************************************************************************/ ++static int ++dma_open_m2p(int device) ++{ ++ int channel = -1; ++ unsigned int loop; ++ unsigned int M2P_reg_base; ++ unsigned int uiPWRCNT; ++ /*unsigned long flags;*/ ++ ++ DPRINTK("DMA Open M2P with hw dev %d\n", device); ++ ++ /* ++ * Lock the dma channel list. ++ */ ++ //spin_lock_irqsave(&dma_list_lock, flags); ++ spin_lock(&dma_list_lock); ++ ++ /* ++ * Verify that the device requesting DMA isn't already using a DMA channel ++ */ ++ if (device >= 10) ++ loop = 1; // Rx transfer requested ++ else ++ loop = 0; // Tx transfer requested ++ ++ for (; loop < 10; loop = loop + 2) ++ /* ++ * Before checking for a matching device, check that the ++ * channel is in use, otherwise the device field is ++ * invalid. ++ */ ++ if (dma_chan[loop].ref_count) ++ if (device == dma_chan[loop].device) { ++ DPRINTK("DMA Open M2P - Error\n"); ++ return(-1); ++ } ++ ++ /* ++ * Get a DMA channel instance for the given hardware device. ++ * If this is a TX look for even numbered channels, else look for ++ * odd numbered channels ++ */ ++ if (device >= 10) ++ loop = 1; /* Rx transfer requested */ ++ else ++ loop = 0; /* Tx transfer requested */ ++ ++ for (; loop < 10; loop = loop + 2) ++ if (!dma_chan[loop].ref_count) { ++ /* ++ * Capture the channel and increment the reference count. ++ */ ++ channel = loop; ++ dma_chan[channel].ref_count++; ++ break; ++ } ++ ++ /* ++ * Unlock the dma channel list. ++ */ ++ //spin_unlock_irqrestore(&dma_list_lock, flags); ++ spin_unlock(&dma_list_lock); ++ /* ++ * See if we got a valid channel. ++ */ ++ if (channel < 0) ++ return(-1); ++ ++ /* ++ * Point regs to the correct dma channel register base. ++ */ ++ M2P_reg_base = dma_chan[channel].reg_base; ++ ++ /* ++ * Turn on the clock for the specified DMA channel ++ * TODO: need to use the correct register name for the ++ * power control register. ++ */ ++ uiPWRCNT = inl(/*SYSCON_PWRCNT*/EP93XX_SYSCON_CLOCK_CONTROL); ++ switch (channel) { ++ case 0: ++ uiPWRCNT |= SYSCON_PWRCNT_DMA_M2PCH0; ++ break; ++ ++ case 1: ++ uiPWRCNT |= SYSCON_PWRCNT_DMA_M2PCH1; ++ break; ++ ++ case 2: ++ uiPWRCNT |= SYSCON_PWRCNT_DMA_M2PCH2; ++ break; ++ ++ case 3: ++ uiPWRCNT |= SYSCON_PWRCNT_DMA_M2PCH3; ++ break; ++ ++ case 4: ++ uiPWRCNT |= SYSCON_PWRCNT_DMA_M2PCH4; ++ break; ++ ++ case 5: ++ uiPWRCNT |= SYSCON_PWRCNT_DMA_M2PCH5; ++ break; ++ ++ case 6: ++ uiPWRCNT |= SYSCON_PWRCNT_DMA_M2PCH6; ++ break; ++ ++ case 7: ++ uiPWRCNT |= SYSCON_PWRCNT_DMA_M2PCH7; ++ break; ++ ++ case 8: ++ uiPWRCNT |= SYSCON_PWRCNT_DMA_M2PCH8; ++ break; ++ ++ case 9: ++ uiPWRCNT |= SYSCON_PWRCNT_DMA_M2PCH9; ++ break; ++ ++ default: ++ return(-1); ++ } ++ outl( uiPWRCNT, /*SYSCON_PWRCNT*/EP93XX_SYSCON_CLOCK_CONTROL ); ++ ++ /* ++ * Clear out the control register before any further setup. ++ */ ++ outl( 0, M2P_reg_base+M2P_OFFSET_CONTROL ); ++ ++ /* ++ * Setup the peripheral port value in the DMA channel registers. ++ */ ++ if (device < 10) ++ outl( (unsigned int)device, M2P_reg_base+M2P_OFFSET_PPALLOC ); ++ else ++ outl( (unsigned int)(device - 10), M2P_reg_base+M2P_OFFSET_PPALLOC ); ++ ++ /* ++ * Let's hold on to the value of the Hw device for comparison later. ++ */ ++ dma_chan[channel].device = device; ++ ++ /* ++ * Success. ++ */ ++ return(channel); ++} ++ ++/***************************************************************************** ++ * ++ * dma_open_m2m(int device) ++ * ++ * Description: This function will attempt to open a M2M DMA channel. ++ * If the open is successful, the channel number is returned, ++ * otherwise a negative number is returned. ++ * ++ * Parameters: ++ * device: device for which the dma channel is requested. ++ * ++ ****************************************************************************/ ++static int ++dma_open_m2m(int device) ++{ ++ int channel = -1; ++ unsigned int loop; ++ unsigned int M2M_reg_base; ++ unsigned int uiPWRCNT, uiCONTROL; ++ /*unsigned long flags;*/ ++ ++ DPRINTK("DMA Open M2M with hw dev %d\n", device); ++ ++ /* ++ * Lock the dma channel list. ++ */ ++ //spin_lock_irqsave(&dma_list_lock, flags); ++ spin_lock(&dma_list_lock); ++ ++ ++ /* ++ * Check if this device is already allocated a channel. ++ * TODO: can one M2M device be allocated multiple channels? ++ */ ++ for (loop = 10; loop < 12; loop++) ++ /* ++ * Before checking for a matching device, check that the ++ * channel is in use, otherwise the device field is ++ * invalid. ++ */ ++ if (dma_chan[loop].ref_count) ++ if (device == dma_chan[loop].device) { ++ DPRINTK("Error - dma_open_m2m - already allocated channel\n"); ++ ++ /* ++ * Unlock the dma channel list. ++ */ ++ //spin_unlock_irqrestore(&dma_list_lock, flags); ++ spin_unlock(&dma_list_lock); ++ /* ++ * Fail. ++ */ ++ return(-1); ++ } ++ ++ /* ++ * Get a DMA channel instance for the given hardware device. ++ */ ++ for (loop = 10; loop < 12; loop++) ++ if (!dma_chan[loop].ref_count) { ++ /* ++ * Capture the channel and increment the reference count. ++ */ ++ channel = loop; ++ dma_chan[channel].ref_count++; ++ break; ++ } ++ ++ /* ++ * Unlock the dma channel list. ++ */ ++ //spin_unlock(dma_list_lock); ++ spin_unlock(&dma_list_lock); ++ //spin_unlock_irqrestore(&dma_list_lock, flags); ++ ++ /* ++ * See if we got a valid channel. ++ */ ++ if (channel < 0) ++ return(-1); ++ ++ /* ++ * Point regs to the correct dma channel register base. ++ */ ++ M2M_reg_base = dma_chan[channel].reg_base; ++ ++ /* ++ * Turn on the clock for the specified DMA channel ++ * TODO: need to use the correct register name for the ++ * power control register. ++ */ ++ uiPWRCNT = inl(/*SYSCON_PWRCNT*/EP93XX_SYSCON_CLOCK_CONTROL); ++ switch (channel) { ++ case 10: ++ uiPWRCNT |= SYSCON_PWRCNT_DMA_M2MCH0; ++ break; ++ ++ case 11: ++ uiPWRCNT |= SYSCON_PWRCNT_DMA_M2MCH1; ++ break; ++ ++ default: ++ return(-1); ++ } ++ outl( uiPWRCNT, /*SYSCON_PWRCNT*/EP93XX_SYSCON_CLOCK_CONTROL); ++ ++ DPRINTK("DMA Open - power control: 0x%x \n", inl(SYSCON_PWRCNT) ); ++ ++ /* ++ * Clear out the control register before any further setup. ++ */ ++ outl( 0, M2M_reg_base+M2M_OFFSET_CONTROL ); ++ ++ /* ++ * Setup the transfer mode and the request source selection within ++ * the DMA M2M channel registers. ++ */ ++ switch (device) { ++ case DMA_MEMORY: ++ /* ++ * Clear TM field, set RSS field to 0 ++ */ ++ uiCONTROL = inl(M2M_reg_base+M2M_OFFSET_CONTROL); ++ uiCONTROL &= ~(CONTROL_M2M_TM_MASK | CONTROL_M2M_RSS_MASK); ++ outl( uiCONTROL, M2M_reg_base+M2M_OFFSET_CONTROL ); ++ break; ++ ++ case DMA_IDE: ++ /* ++ * Set RSS field to 3, Set NO_HDSK, Set PW field to 1 ++ */ ++ uiCONTROL = inl(M2M_reg_base+M2M_OFFSET_CONTROL); ++ uiCONTROL &= ~(CONTROL_M2M_RSS_MASK|CONTROL_M2M_PW_MASK); ++ uiCONTROL |= (3<pause || (!dma->pause && dma->xfer_enable)) */ ++ if (dma->xfer_enable) { ++ /* ++ * DMA channel is not paused, so we can't configure it. ++ */ ++ DPRINTK("DMA channel not paused, so can't configure! \n"); ++ return(-1); ++ } ++ ++ /* ++ * Mask interrupts. ++ */ ++ local_irq_save(flags); ++ ++ /* ++ * Setup a pointer into the dma channel's register set. ++ */ ++ M2M_reg_base = dma->reg_base; ++ ++ uiCONTROL = inl(M2M_reg_base + M2M_OFFSET_CONTROL); ++ outl(0, M2M_reg_base + M2M_OFFSET_CONTROL); ++ inl(M2M_reg_base + M2M_OFFSET_CONTROL); ++ outl(uiCONTROL, M2M_reg_base + M2M_OFFSET_CONTROL); ++ ++ /* ++ * By default we disable the stall interrupt. ++ */ ++ uiCONTROL = inl(M2M_reg_base+M2M_OFFSET_CONTROL); ++ uiCONTROL &= ~CONTROL_M2M_STALLINTEN; ++ outl( uiCONTROL, M2M_reg_base+M2M_OFFSET_CONTROL ); ++ ++ /* ++ * By default we disable the done interrupt. ++ */ ++ uiCONTROL = inl(M2M_reg_base+M2M_OFFSET_CONTROL); ++ uiCONTROL &= ~CONTROL_M2M_DONEINTEN; ++ outl( uiCONTROL, M2M_reg_base+M2M_OFFSET_CONTROL ); ++ ++ /* ++ * Set up the transfer control fields based on values passed in ++ * the flags_m2m field. ++ */ ++ uiCONTROL = inl(M2M_reg_base+M2M_OFFSET_CONTROL); ++ ++ if ( flags_m2m & DESTINATION_HOLD ) ++ uiCONTROL |= CONTROL_M2M_DAH; ++ else ++ uiCONTROL &= ~CONTROL_M2M_DAH; ++ ++ if ( flags_m2m & SOURCE_HOLD ) ++ uiCONTROL |= CONTROL_M2M_SAH; ++ else ++ uiCONTROL &= ~CONTROL_M2M_SAH; ++ ++ uiCONTROL &= ~CONTROL_M2M_TM_MASK; ++ uiCONTROL |= (((flags_m2m & TRANSFER_MODE_MASK) >> TRANSFER_MODE_SHIFT) << ++ CONTROL_M2M_TM_SHIFT) & CONTROL_M2M_TM_MASK; ++ ++ uiCONTROL &= ~CONTROL_M2M_PWSC_MASK; ++ uiCONTROL |= (((flags_m2m & WAIT_STATES_MASK) >> WAIT_STATES_SHIFT) << ++ CONTROL_M2M_PWSC_SHIFT) & CONTROL_M2M_PWSC_MASK; ++ ++ outl( uiCONTROL, M2M_reg_base+M2M_OFFSET_CONTROL ); ++ inl(M2M_reg_base + M2M_OFFSET_CONTROL); ++ ++ /* ++ * Save the callback function in the dma instance for this channel. ++ */ ++ dma->callback = callback; ++ ++ /* ++ * Save the user data in the the dma instance for this channel. ++ */ ++ dma->user_data = user_data; ++ ++ /* ++ * Put the dma instance into the pause state by setting the ++ * pause bit to true. ++ */ ++ dma->pause = TRUE; ++ ++ local_irq_restore(flags); ++ ++ /* ++ * Success. ++ */ ++ return(0); ++} ++ ++/***************************************************************************** ++ * ++ * int dma_start(int handle, unsigned int channels, unsigned int * handles) ++ * ++ * Description: Initiate a transfer on up to 3 channels. ++ * ++ * handle: handle for the channel to initiate transfer on. ++ * channels: number of channels to initiate transfers on. ++ * handles: pointer to an array of handles, one for each channel which ++ * is to be started. ++ * ++ ****************************************************************************/ ++static int ++dma_start_m2m(int channel, ep93xx_dma_t * dma) ++{ ++ unsigned long flags; ++ unsigned int M2M_reg_base = dma->reg_base; ++ unsigned int uiCONTROL; ++ ++ /* ++ * Mask interrupts while we get this started. ++ */ ++ local_irq_save(flags); ++ ++ /* ++ * Make sure the channel has at least one buffer in the queue. ++ */ ++ if (dma->new_buffers < 1) { ++ /* ++ * Unmask irqs ++ */ ++ local_irq_restore(flags); ++ ++ DPRINTK("DMA Start: Channel starved.\n"); ++ ++ /* ++ * This channel does not have enough buffers queued up, ++ * so enter the pause by starvation state. ++ */ ++ dma->xfer_enable = TRUE; ++ dma->pause = TRUE; ++ ++ /* ++ * Success. ++ */ ++ return(0); ++ } ++ ++ /* ++ * Clear any pending interrupts. ++ */ ++ outl(0x0, M2M_reg_base+M2M_OFFSET_INTERRUPT); ++ ++ /* ++ * Set up one or both buffer descriptors with values from the next one or ++ * two buffers in the queue. By default disable the next frame buffer ++ * interrupt on the channel. ++ */ ++ uiCONTROL = inl(M2M_reg_base+M2M_OFFSET_CONTROL); ++ uiCONTROL &= ~CONTROL_M2M_NFBINTEN; ++ outl( uiCONTROL, M2M_reg_base+M2M_OFFSET_CONTROL ); ++ ++ /* ++ * enable the done interrupt. ++ */ ++ uiCONTROL = inl(M2M_reg_base+M2M_OFFSET_CONTROL); ++ uiCONTROL |= CONTROL_M2M_DONEINTEN; ++ outl( uiCONTROL, M2M_reg_base+M2M_OFFSET_CONTROL ); ++ ++ /* ++ * Update the dma channel instance transfer state. ++ */ ++ dma->xfer_enable = TRUE; ++ dma->pause = FALSE; ++ ++ /* ++ * Program up the first buffer descriptor with a source and destination ++ * and a byte count. ++ */ ++ outl( dma->buffer_queue[dma->current_buffer].source, ++ M2M_reg_base+M2M_OFFSET_SAR_BASE0 ); ++ ++ outl( dma->buffer_queue[dma->current_buffer].dest, ++ M2M_reg_base+M2M_OFFSET_DAR_BASE0 ); ++ ++ outl( dma->buffer_queue[dma->current_buffer].size, ++ M2M_reg_base+M2M_OFFSET_BCR0 ); ++ ++ /* ++ * Decrement the new buffers counter. ++ */ ++ dma->new_buffers--; ++ ++ /* ++ * Set up the second buffer descriptor with a second buffer if we have ++ * a second buffer. ++ */ ++ if (dma->new_buffers) { ++ outl( dma->buffer_queue[(dma->current_buffer + 1) % ++ MAX_EP93XX_DMA_BUFFERS].source, ++ M2M_reg_base+M2M_OFFSET_SAR_BASE1 ); ++ ++ outl( dma->buffer_queue[(dma->current_buffer + 1) % ++ MAX_EP93XX_DMA_BUFFERS].dest, ++ M2M_reg_base+M2M_OFFSET_DAR_BASE1 ); ++ ++ outl( dma->buffer_queue[(dma->current_buffer + 1) % ++ MAX_EP93XX_DMA_BUFFERS].size, ++ M2M_reg_base+M2M_OFFSET_BCR1 ); ++ ++ uiCONTROL = inl(M2M_reg_base+M2M_OFFSET_CONTROL); ++ uiCONTROL |= CONTROL_M2M_NFBINTEN; ++ outl( uiCONTROL, M2M_reg_base+M2M_OFFSET_CONTROL ); ++ ++ dma->new_buffers--; ++ } ++ ++ /* ++ * Now we enable the channel. This initiates the transfer. ++ */ ++ uiCONTROL = inl(M2M_reg_base+M2M_OFFSET_CONTROL); ++ uiCONTROL |= CONTROL_M2M_ENABLE; ++ outl( uiCONTROL, M2M_reg_base+M2M_OFFSET_CONTROL ); ++ inl(M2M_reg_base + M2M_OFFSET_CONTROL); ++ ++ /* ++ * If this is a memory to memory transfer, we need to s/w trigger the ++ * transfer by setting the start bit within the control register. ++ */ ++ if (dma->device == DMA_MEMORY) { ++ uiCONTROL = inl(M2M_reg_base+M2M_OFFSET_CONTROL); ++ uiCONTROL |= CONTROL_M2M_START; ++ outl( uiCONTROL, M2M_reg_base+M2M_OFFSET_CONTROL ); ++ } ++ ++ DPRINTK("DMA - It's been started!!"); ++ DPRINTK("CONTROL - 0x%x \n", inl(M2M_reg_base+M2M_OFFSET_CONTROL) ); ++ DPRINTK("STATUS - 0x%x \n", inl(M2M_reg_base+M2M_OFFSET_STATUS) ); ++ DPRINTK("BCR0 - 0x%x \n", dma->buffer_queue[dma->current_buffer].size); ++ DPRINTK("SAR_BASE0 - 0x%x \n", inl(M2M_reg_base+M2M_OFFSET_SAR_BASE0) ); ++ DPRINTK("SAR_CUR0 - 0x%x \n", inl(M2M_reg_base+M2M_OFFSET_SAR_CURRENT0) ); ++ DPRINTK("DAR_BASE0 - 0x%x \n", inl(M2M_reg_base+M2M_OFFSET_DAR_BASE0) ); ++ DPRINTK("DAR_CUR0 - 0x%x \n", inl(M2M_reg_base+M2M_OFFSET_DAR_CURRENT0) ); ++ ++ /* ++ * Unmask irqs ++ */ ++ local_irq_restore(flags); ++ ++ /* ++ * Success. ++ */ ++ return(0); ++} ++ ++/***************************************************************************** ++ * ++ * DMA interface functions ++ * ++ ****************************************************************************/ ++ ++/***************************************************************************** ++ * ++ * int dma_init(int handle, unsigned int flags_m2p, unsigned int flags_m2m, ++ * dma_callback callback, unsigned int user_data) ++ * ++ * Description: Configure the DMA channel and install a callback function. ++ * ++ * handle: Handle unique the each instance of the dma interface, used ++ * to verify this call. ++ * flags_m2p Flags used to configure an M2P/P2M dma channel and determine ++ * if a callback function and user_data information are included ++ * in this call. This field should be NULL if handle represents ++ * an M2M channel. ++ * flags_m2m Flags used to configure an M2M dma channel and determine ++ * if a callback function and user_data information are included ++ * in this call. This field should be NULL if handle represents ++ * an M2P/P2M channel. ++ * callback function pointer which is called near the end of the ++ * dma channel's irq handler. ++ * user_data defined by the calling driver. ++ * ++ ****************************************************************************/ ++int ++ep93xx_dma_config(int handle, unsigned int flags_m2p, unsigned int flags_m2m, ++ dma_callback callback, unsigned int user_data) ++{ ++ int channel; ++ ep93xx_dma_t * dma; ++ unsigned long flags; ++ unsigned int M2P_reg_base, uiCONTROL; ++ ++ /* ++ * Get the DMA hw channel # from the handle. ++ */ ++ channel = dma_get_channel_from_handle(handle); ++ ++ /* ++ * See if this is a valid handle. ++ */ ++ if (channel < 0) { ++ printk(KERN_ERR ++ "DMA Config: Invalid dma handle.\n"); ++ return(-EINVAL); ++ } ++ ++ DPRINTK("DMA Config \n"); ++ ++ dma = &dma_chan[channel]; ++ ++ local_irq_save(flags); ++ ++ /* ++ * Check if the channel is currently transferring. ++ */ ++ if (dma->xfer_enable) { ++ local_irq_restore(flags); ++ return(-EINVAL); ++ } ++ ++ /* ++ * Check if this is an m2m function. ++ */ ++ if (channel >= 10) { ++ local_irq_restore(flags); ++ ++ /* ++ * Call another function to handle m2m config. ++ */ ++ return(dma_config_m2m(dma, flags_m2m, callback, user_data)); ++ } ++ ++ /* ++ * Setup a pointer into the dma channel's register set. ++ */ ++ M2P_reg_base = dma->reg_base; ++ ++ /* ++ * By default we enable the stall interrupt. ++ */ ++ uiCONTROL = inl(M2P_reg_base+M2P_OFFSET_CONTROL); ++ uiCONTROL |= CONTROL_M2P_STALLINTEN; ++ outl( uiCONTROL, M2P_reg_base+M2P_OFFSET_CONTROL ); ++ ++ /* ++ * Configure the channel for an error from the peripheral. ++ */ ++ uiCONTROL = inl(M2P_reg_base+M2P_OFFSET_CONTROL); ++ if ( flags_m2p && CHANNEL_ERROR_INT_ENABLE ) ++ uiCONTROL |= CONTROL_M2P_CHERRORINTEN; ++ else ++ uiCONTROL &= ~CONTROL_M2P_CHERRORINTEN; ++ outl( uiCONTROL, M2P_reg_base+M2P_OFFSET_CONTROL ); ++ ++ uiCONTROL = inl(M2P_reg_base+M2P_OFFSET_CONTROL); ++ if ( flags_m2p && CHANNEL_ABORT ) ++ uiCONTROL |= CONTROL_M2P_ABRT; ++ else ++ uiCONTROL &= ~CONTROL_M2P_ABRT; ++ outl( uiCONTROL, M2P_reg_base+M2P_OFFSET_CONTROL ); ++ ++ uiCONTROL = inl(M2P_reg_base+M2P_OFFSET_CONTROL); ++ if ( flags_m2p && IGNORE_CHANNEL_ERROR ) ++ uiCONTROL |= CONTROL_M2P_ICE; ++ else ++ uiCONTROL &= ~CONTROL_M2P_ICE; ++ outl( uiCONTROL, M2P_reg_base+M2P_OFFSET_CONTROL ); ++ ++ /* ++ * Save the callback function in the dma instance for this channel. ++ */ ++ dma->callback = callback; ++ ++ /* ++ * Save the user data in the the dma instance for this channel. ++ */ ++ dma->user_data = user_data; ++ ++ /* ++ * Put the dma instance into the pause state by setting the ++ * pause bit to true. ++ */ ++ dma->pause = TRUE; ++ ++ local_irq_restore(flags); ++ ++ /* ++ * Success. ++ */ ++ return(0); ++} ++ ++/***************************************************************************** ++ * ++ * int dma_start(int handle, unsigned int channels, unsigned int * handles) ++ * ++ * Description: Initiate a transfer on up to 3 channels. ++ * ++ * handle: handle for the channel to initiate transfer on. ++ * channels: number of channels to initiate transfers on. ++ * handles: pointer to an array of handles, one for each channel which ++ * is to be started. ++ * ++ ****************************************************************************/ ++int ++ep93xx_dma_start(int handle, unsigned int channels, unsigned int * handles) ++{ ++ ep93xx_dma_t * dma_pointers[3]; ++ unsigned int M2P_reg_bases[3]; ++ unsigned int loop, uiCONTROL; ++ unsigned long flags; ++ int channel; ++ ++ /* ++ * Get the DMA hw channel # from the handle. ++ */ ++ channel = dma_get_channel_from_handle(handle); ++ ++ /* ++ * See if this is a valid handle. ++ */ ++ if (channel < 0) { ++ printk(KERN_ERR "DMA Start: Invalid dma handle.\n"); ++ return(-EINVAL); ++ } ++ ++ if (channels < 1) { ++ printk(KERN_ERR "DMA Start: Invalid parameter.\n"); ++ return(-EINVAL); ++ } ++ ++ DPRINTK("DMA Start \n"); ++ ++ /* ++ * Mask off registers. ++ */ ++ local_irq_save(flags); ++ ++ /* ++ * Check if this is a start multiple. ++ */ ++ if (channels > 1) { ++ DPRINTK("DMA ERROR: Start, multiple start not supported yet \n"); ++ return(-1); ++ } else { ++ /* ++ * Check if this channel is already transferring. ++ */ ++ if (dma_chan[channel].xfer_enable && !dma_chan[channel].pause) { ++ printk(KERN_ERR ++ "DMA Start: Invalid command for channel %d.\n", channel); ++ ++ /* ++ * Unmask irqs ++ */ ++ local_irq_restore(flags); ++ ++ /* ++ * This channel is already transferring, so return an error. ++ */ ++ return(-EINVAL); ++ } ++ ++ /* ++ * If this is an M2M channel, call a different function. ++ */ ++ if (channel >= 10) { ++ /* ++ * Unmask irqs ++ */ ++ local_irq_restore(flags); ++ ++ /* ++ * Call the m2m start function. Only start one channel. ++ */ ++ return(dma_start_m2m(channel, &dma_chan[channel])); ++ } ++ ++ /* ++ * Make sure the channel has at least one buffer in the queue. ++ */ ++ if (dma_chan[channel].new_buffers < 1) { ++ DPRINTK("DMA Start: Channel starved.\n"); ++ ++ /* ++ * This channel does not have enough buffers queued up, ++ * so enter the pause by starvation state. ++ */ ++ dma_chan[channel].xfer_enable = TRUE; ++ dma_chan[channel].pause = TRUE; ++ ++ /* ++ * Unmask irqs ++ */ ++ local_irq_restore(flags); ++ ++ /* ++ * Success. ++ */ ++ return(0); ++ } ++ ++ /* ++ * Set up a dma instance pointer for this dma channel. ++ */ ++ dma_pointers[0] = &dma_chan[channel]; ++ ++ /* ++ * Set up a pointer to the register set for this channel. ++ */ ++ M2P_reg_bases[0] = dma_pointers[0]->reg_base; ++ } ++ ++ /* ++ * Setup both MAXCNT registers with values from the next two buffers ++ * in the queue, and enable the next frame buffer interrupt on the channel. ++ */ ++ for (loop = 0; loop < channels; loop++) { ++ /* ++ * Check if we need to restore a paused transfer. ++ */ ++ if (dma_pointers[loop]->pause_buf.buf_id != -1) ++ outl( dma_pointers[loop]->pause_buf.size, ++ M2P_reg_bases[loop]+M2P_OFFSET_MAXCNT0 ); ++ else ++ outl( dma_pointers[loop]->buffer_queue[dma_pointers[loop]->current_buffer].size, ++ M2P_reg_bases[loop]+M2P_OFFSET_MAXCNT0 ); ++ } ++ ++ for (loop = 0; loop < channels; loop++) { ++ /* ++ * Enable the specified dma channels. ++ */ ++ uiCONTROL = inl(M2P_reg_bases[loop]+M2P_OFFSET_CONTROL); ++ uiCONTROL |= CONTROL_M2P_ENABLE; ++ outl( uiCONTROL, M2P_reg_bases[loop]+M2P_OFFSET_CONTROL ); ++ ++ /* ++ * Update the dma channel instance transfer state. ++ */ ++ dma_pointers[loop]->xfer_enable = TRUE; ++ dma_pointers[loop]->pause = FALSE; ++ } ++ ++ /* ++ * Program up the BASE0 registers for all specified channels, this ++ * will initiate transfers on all specified channels. ++ */ ++ for (loop = 0; loop < channels; loop++) ++ /* ++ * Check if we need to restore a paused transfer. ++ */ ++ if (dma_pointers[loop]->pause_buf.buf_id != -1) { ++ outl( dma_pointers[loop]->pause_buf.source, ++ M2P_reg_bases[loop]+M2P_OFFSET_BASE0 ); ++ ++ /* ++ * Set the pause buffer to NULL ++ */ ++ dma_pointers[loop]->pause_buf.buf_id = -1; ++ dma_pointers[loop]->pause_buf.size = 0; ++ } else if(dma_pointers[loop]->new_buffers){ ++ outl( dma_pointers[loop]->buffer_queue[ ++ dma_pointers[loop]->current_buffer].source, ++ M2P_reg_bases[loop]+M2P_OFFSET_BASE0 ); ++ dma_pointers[loop]->new_buffers--; ++ ++ } ++ ++ /* ++ * Before restoring irqs setup the second MAXCNT/BASE ++ * register with a second buffer. ++ */ ++ for (loop = 0; loop < channels; loop++) ++ if (dma_pointers[loop]->new_buffers) { ++ /* ++ * By default we enable the next frame buffer interrupt. ++ */ ++ uiCONTROL = inl(M2P_reg_bases[loop]+M2P_OFFSET_CONTROL); ++ uiCONTROL |= CONTROL_M2P_NFBINTEN; ++ outl( uiCONTROL, M2P_reg_bases[loop]+M2P_OFFSET_CONTROL ); ++ ++ outl( dma_pointers[loop]->buffer_queue[ ++ (dma_pointers[loop]->current_buffer + 1) % ++ MAX_EP93XX_DMA_BUFFERS].size, ++ M2P_reg_bases[loop]+M2P_OFFSET_MAXCNT1 ); ++ ++ outl( dma_pointers[loop]->buffer_queue[ ++ (dma_pointers[loop]->current_buffer + 1) % ++ MAX_EP93XX_DMA_BUFFERS].source, ++ M2P_reg_bases[loop]+M2P_OFFSET_BASE1 ); ++ dma_pointers[loop]->new_buffers--; ++ } ++ ++ /* ++ DPRINTK("DMA - It's been started!!"); ++ DPRINTK("STATUS - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_STATUS) ); ++ DPRINTK("CONTROL - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_CONTROL) ); ++ DPRINTK("REMAIN - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_REMAIN) ); ++ DPRINTK("PPALLOC - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_PPALLOC) ); ++ DPRINTK("BASE0 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_BASE0) ); ++ DPRINTK("MAXCNT0 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_MAXCNT0) ); ++ DPRINTK("CURRENT0 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_CURRENT0) ); ++ DPRINTK("BASE1 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_BASE1) ); ++ DPRINTK("MAXCNT1 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_MAXCNT1) ); ++ DPRINTK("CURRENT1 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_CURRENT1) ); ++ ++ DPRINTK("Pause - %d \n", dma_pointers[0]->pause); ++ DPRINTK("xfer_enable - %d \n", dma_pointers[0]->xfer_enable); ++ DPRINTK("total bytes - 0x%x \n", dma_pointers[0]->total_bytes); ++ DPRINTK("total buffer - %d \n", dma_pointers[0]->total_buffers); ++ DPRINTK("new buffers - %d \n", dma_pointers[0]->new_buffers); ++ DPRINTK("current buffer - %d \n", dma_pointers[0]->current_buffer); ++ DPRINTK("last buffer - %d \n", dma_pointers[0]->last_buffer); ++ DPRINTK("used buffers - %d \n", dma_pointers[0]->used_buffers); ++ */ ++ /* ++ * Unmask irqs ++ */ ++ local_irq_restore(flags); ++ ++ /* ++ * Success. ++ */ ++ return(0); ++} ++ ++/***************************************************************************** ++ * ++ * int ep93xx_dma_add_buffer(int handle, unsigned int * address, ++ * unsigned int size, unsigned int last) ++ * ++ * Description: Add a buffer entry to the DMA buffer queue. ++ * ++ * handle: handle for the channel to add this buffer to. ++ * address: Pointer to an integer which is the start address of the ++ * buffer which is to be added to the queue. ++ * size: size of the buffer in bytes. ++ * last: 1 if this is the last buffer in this stream, 0 otherwise. ++ * ++ ****************************************************************************/ ++int ++ep93xx_dma_add_buffer(int handle, unsigned int source, unsigned int dest, ++ unsigned int size, unsigned int last, ++ unsigned int buf_id) ++{ ++ unsigned long flags; ++ ep93xx_dma_t * dma; ++ int channel; ++#if 0 ++ static int peak_total_buffers=0; ++#endif ++ /* ++ * Get the DMA hw channel # from the handle. ++ */ ++ channel = dma_get_channel_from_handle(handle); ++ ++ /* ++ * See if this is a valid handle. ++ */ ++ if (channel < 0) { ++ printk(KERN_ERR ++ "DMA Add Buffer: Invalid dma handle.\n"); ++ return(-EINVAL); ++ } ++ ++ /* ++ * Get a pointer to the dma instance. ++ */ ++ dma = &dma_chan[channel]; ++ ++#if 0 ++ if( dma->total_buffers > peak_total_buffers ) ++ { ++ peak_total_buffers=dma->total_buffers; ++ printk("peak_total_buffers=%d\n", peak_total_buffers ); ++ } ++#endif ++ /* ++ * Mask interrupts and hold on to the original state. ++ */ ++ local_irq_save(flags); ++ ++ /* ++ * If the buffer queue is full, last_buffer is the same as current_buffer and ++ * we're not tranfering, or last_buffer is pointing to a used buffer, then exit. ++ * TODO: do I need to do any more checks? ++ */ ++ if (dma->total_buffers >= MAX_EP93XX_DMA_BUFFERS) ++ { ++ DPRINTK("too many dma buffers: MAX_EP93XX_DMA_BUFFERS set to low ?\n"); ++ /* ++ * Restore the state of the irqs ++ */ ++ local_irq_restore(flags); ++ ++ /* ++ * Fail. ++ */ ++ return(-1); ++ } ++ ++ /* ++ * Add this buffer to the queue ++ */ ++ dma->buffer_queue[dma->last_buffer].source = source; ++ dma->buffer_queue[dma->last_buffer].dest = dest; ++ dma->buffer_queue[dma->last_buffer].size = size; ++ dma->buffer_queue[dma->last_buffer].last = last; ++ dma->buffer_queue[dma->last_buffer].buf_id = buf_id; ++ ++ /* ++ * Reset the used field of the buffer structure. ++ */ ++ dma->buffer_queue[dma->last_buffer].used = FALSE; ++ ++ /* ++ * Increment the End Item Pointer. ++ */ ++ dma->last_buffer = (dma->last_buffer + 1) % MAX_EP93XX_DMA_BUFFERS; ++ ++ /* ++ * Increment the new buffers counter and the total buffers counter ++ */ ++ dma->new_buffers++; ++ dma->total_buffers++; ++ ++ /* ++ * restore the interrupt state. ++ */ ++ local_irq_restore(flags); ++ ++ /* ++ * Check if the channel was starved into a stopped state. ++ */ ++ if (dma->pause && dma->xfer_enable) { ++ if (dma->new_buffers >= 1) { ++ DPRINTK("DMA - calling start from add after starve. \n"); ++ ++ /* ++ * The channel was starved into a stopped state, and we've got ++ * 2 new buffers, so start tranferring again. ++ */ ++ ep93xx_dma_start(handle, 1, 0); ++ } ++ } ++ ++ /* ++ * Success. ++ */ ++ return(0); ++} ++ ++/***************************************************************************** ++ * ++ * int ep93xx_dma_remove_buffer(int handle, unsigned int * address, ++ * unsigned int * size) ++ * ++ * Description: Remove a buffer entry from the DMA buffer queue. If ++ * buffer was removed successfully, return 0, otherwise ++ * return -1. ++ * ++ * handle: handle for the channel to remove a buffer from. ++ * address: Pointer to an integer which is filled in with the start ++ * address of the removed buffer. ++ * size: Pointer to an integer which is filled in with the size in ++ * bytes of the removed buffer. ++ * ++ ****************************************************************************/ ++int ++ep93xx_dma_remove_buffer(int handle, unsigned int * buf_id) ++{ ++ unsigned int test; ++ unsigned int loop; ++ int return_val = -1; ++ unsigned long flags; ++ ep93xx_dma_t *dma; ++ int channel; ++ ++ /* ++ * Get the DMA hw channel # from the handle. ++ */ ++ channel = dma_get_channel_from_handle(handle); ++ ++ /* ++ * See if this is a valid handle. ++ */ ++ if (channel < 0) { ++ printk(KERN_ERR ++ "DMA Remove Buffer: Invalid dma handle.\n"); ++ return(-EINVAL); ++ } ++ ++ dma = &dma_chan[channel]; ++ ++ /* ++ * Mask interrupts and hold on to the original state. ++ */ ++ local_irq_save(flags); ++ ++ /* ++ * Make sure there are used buffers to be returned. ++ */ ++ if (dma->used_buffers) { ++ test = dma->last_buffer; ++ ++ for (loop = 0; loop < MAX_EP93XX_DMA_BUFFERS; loop++) { ++ if (dma->buffer_queue[test].used && (dma->buffer_queue[test].buf_id != -1)) { ++ /*DPRINTK("buffer %d used \n", test); */ ++ ++ /* ++ * This is a used buffer, fill in the buf_id pointer ++ * with the buf_id for this buffer. ++ */ ++ *buf_id = dma->buffer_queue[test].buf_id; ++ ++ /* ++ * Reset this buffer structure ++ */ ++ dma->buffer_queue[test].buf_id = -1; ++ ++ /* ++ * Decrement the used buffer counter, and the total buffer counter. ++ */ ++ dma->used_buffers--; ++ dma->total_buffers--; ++ ++ /* ++ * Successful removal of a buffer, so set the return ++ * value to 0, then exit this loop. ++ */ ++ return_val = 0; ++ break; ++ } ++ ++ /* ++ * This buffer isn't used, let's see if the next one is. ++ */ ++ test = (test + 1) % MAX_EP93XX_DMA_BUFFERS; ++ } ++ } ++ ++ /* ++ * Restore interrupts. ++ */ ++ local_irq_restore(flags); ++ ++ /* ++ * Success. ++ */ ++ return(return_val); ++} ++ ++/***************************************************************************** ++ * ++ * int ep93xx_dma_pause(int handle, unsigned int channels, ++ * unsigned int * handles) ++ * ++ * Description: Disable any ongoing transfer for the given channel, retaining ++ * the state of the current buffer transaction so that upon ++ * resume, the dma will continue where it left off. ++ * ++ * handle: Handle for the channel to be paused. If this is a pause for ++ * for multiple channels, handle is a valid handle for one of ++ * the channels to be paused. ++ * channels: number of channel to pause transfers on. ++ * handles: Pointer to an array of handles, one for each channel which ++ * to be paused. If this pause is intended only for one ++ * channel, this field should be set to NULL. ++ * ++ ****************************************************************************/ ++int ++ep93xx_dma_pause(int handle, unsigned int channels, unsigned int * handles) ++{ ++ unsigned long flags; ++ ep93xx_dma_t * dma; ++ int channel; ++ ++ DPRINTK("ep93xx_dma_pause \n"); ++ ++ /* ++ * Mask interrupts and hold on to the original state. ++ */ ++ local_irq_save(flags); ++ ++ /* ++ * Get the DMA hw channel # from the handle. ++ */ ++ channel = dma_get_channel_from_handle(handle); ++ ++ /* ++ * See if this is a valid handle. ++ */ ++ if (channel < 0) { ++ /* ++ * restore interrupts. ++ */ ++ local_irq_restore(flags); ++ ++ printk(KERN_ERR ++ "DMA Pause: Invalid dma handle.\n"); ++ ++ /* ++ * Fail. ++ */ ++ return(-EINVAL); ++ } ++ ++ DPRINTK("DMA %d: pause \n", channel); ++ ++ /* ++ * Set up a pointer to the dma instance data. ++ */ ++ dma = &dma_chan[channel]; ++ ++ /* ++ * Check if we're already paused. ++ */ ++ if (dma->pause) { ++ /* ++ * We're paused, but are we stopped? ++ */ ++ if (dma->xfer_enable) ++ /* ++ * Put the channel in the stopped state. ++ */ ++ dma->xfer_enable = FALSE; ++ ++ DPRINTK("DMA Pause - already paused."); ++ } else { ++ /* ++ * Put the channel into the stopped state. ++ */ ++ dma->xfer_enable = FALSE; ++ dma->pause = TRUE; ++ } ++ ++ /* ++ * restore interrupts. ++ */ ++ local_irq_restore(flags); ++ ++ /* ++ * Already paused, so exit. ++ */ ++ return(0); ++} ++ ++/***************************************************************************** ++ * ++ * void ep93xx_dma_flush(int handle) ++ * ++ * Description: Flushes all queued buffers and transfers in progress ++ * for the given channel. Return the buffer entries ++ * to the calling function. ++ * ++ * handle: handle for the channel for which the flush is intended. ++ * ++ ****************************************************************************/ ++int ++ep93xx_dma_flush(int handle) ++{ ++ unsigned int loop; ++ unsigned long flags; ++ ep93xx_dma_t * dma; ++ int channel; ++ unsigned int M2P_reg_base,uiCONTROL; ++ ++ /* ++ * Get the DMA hw channel # from the handle. ++ */ ++ channel = dma_get_channel_from_handle(handle); ++ ++ /* ++ * See if this is a valid handle. ++ */ ++ if (channel < 0) { ++ printk(KERN_ERR "DMA Flush: Invalid dma handle.\n"); ++ return(-EINVAL); ++ } ++ ++ DPRINTK("DMA %d: flush \n", channel); ++ ++ /* ++ * Set up a pointer to the dma instance data for this channel ++ */ ++ dma = &dma_chan[channel]; ++ ++ /* ++ * Mask interrupts and hold on to the original state. ++ */ ++ local_irq_save(flags); ++ ++ /* ++ * Disable the dma channel ++ */ ++ if (channel < 10) { ++ /* ++ * M2P channel ++ */ ++ uiCONTROL = inl(dma->reg_base+M2P_OFFSET_CONTROL); ++ uiCONTROL &= ~CONTROL_M2P_ENABLE; ++ outl( uiCONTROL, dma->reg_base+M2P_OFFSET_CONTROL ); ++ } else { ++ /* ++ * M2M channel ++ */ ++ uiCONTROL = inl(dma->reg_base+M2M_OFFSET_CONTROL); ++ uiCONTROL &= ~CONTROL_M2M_ENABLE; ++ outl( uiCONTROL, dma->reg_base+M2M_OFFSET_CONTROL ); ++ } ++ ++ for (loop = 0; loop < MAX_EP93XX_DMA_BUFFERS; loop++) ++ { ++ dma->buffer_queue[loop].buf_id = -1; ++ dma->buffer_queue[loop].last = 0; ++ } ++ ++ /* ++ * Set the Current and Last item to zero. ++ */ ++ dma->current_buffer = 0; ++ dma->last_buffer = 0; ++ ++ /* ++ * Reset the Buffer counters ++ */ ++ dma->used_buffers = 0; ++ dma->new_buffers = 0; ++ dma->total_buffers = 0; ++ ++ /* ++ * reset the Total bytes counter. ++ */ ++ dma->total_bytes = 0; ++ ++ /* ++ * Reset the paused buffer. ++ */ ++ dma->pause_buf.last = 0; ++ dma->pause_buf.buf_id = -1; ++ ++ M2P_reg_base = dma_chan[channel].reg_base; ++ ++ /* ++ * restore interrupts. ++ */ ++ local_irq_restore(flags); ++ ++ /* ++ * Success. ++ */ ++ return(0); ++} ++ ++/***************************************************************************** ++ * ++ * int ep93xx_dma_queue_full(int handle) ++ * ++ * Description: Query to determine if the DMA queue of buffers for ++ * a given channel is full. ++ * 0 = queue is full ++ * 1 = queue is not full ++ * ++ * handle: handle for the channel to query. ++ * ++ ****************************************************************************/ ++int ++ep93xx_dma_queue_full(int handle) ++{ ++ int list_full = 0; ++ unsigned long flags; ++ int channel; ++ ++ /* ++ * Get the DMA hw channel # from the handle. ++ */ ++ channel = dma_get_channel_from_handle(handle); ++ ++ /* ++ * See if this is a valid handle. ++ */ ++ if (channel < 0) { ++ printk(KERN_ERR "DMA Queue Full: Invalid dma handle.\n"); ++ return(-EINVAL); ++ } ++ ++ DPRINTK("DMA %d: queue full \n", channel); ++ ++ /* ++ * Mask interrupts and hold on to the original state. ++ */ ++ local_irq_save(flags); ++ ++ /* ++ * If the last item is equal to the used item then ++ * the queue is full. ++ */ ++ if (dma_chan[channel].total_buffers < MAX_EP93XX_DMA_BUFFERS) ++ list_full = FALSE; ++ else ++ list_full = TRUE; ++ ++ /* ++ * restore interrupts. ++ */ ++ local_irq_restore(flags); ++ ++ return(list_full); ++} ++ ++/***************************************************************************** ++ * ++ * int ep93xx_dma_get_position() ++ * ++ * Description: Takes two integer pointers and fills them with the start ++ * and current address of the buffer currently transferring ++ * on the specified DMA channel. ++ * ++ * handle handle for the channel to query. ++ * *buf_id buffer id for the current buffer transferring on the ++ * dma channel. ++ * *total total bytes transferred on the channel. Only counts ++ * whole buffers transferred. ++ * *current_frac number of bytes transferred so far in the current buffer. ++ ****************************************************************************/ ++int ++ep93xx_dma_get_position(int handle, unsigned int * buf_id, ++ unsigned int * total, unsigned int * current_frac ) ++{ ++ int channel; ++ ep93xx_dma_t * dma; ++ unsigned int buf_id1, total1, current_frac1, buf_id2, total2; ++ unsigned int Status, NextBuffer, StateIsBufNext, M2P_reg_base=0; ++ unsigned int pause1, pause2; ++ ++ /* ++ * Get the DMA hw channel # from the handle. See if this is a ++ * valid handle. ++ */ ++ channel = dma_get_channel_from_handle(handle); ++ if (channel < 0) { ++ printk(KERN_ERR "DMA Get Position: Invalid dma handle.\n"); ++ return(-EINVAL); ++ } ++ ++ dma = &dma_chan[channel]; ++ ++ /* ++ * If DMA moves to a new buffer in the middle of us grabbing the ++ * buffer info, then do it over again. ++ */ ++ do{ ++ buf_id1 = dma->buffer_queue[dma->current_buffer].buf_id; ++ total1 = dma->total_bytes; ++ pause1 = dma->pause; ++ ++ if (channel < 10) { ++ // M2P ++ M2P_reg_base = dma->reg_base; ++ ++ Status = inl(M2P_reg_base+M2P_OFFSET_STATUS); ++ ++ NextBuffer = ((Status & STATUS_M2P_NEXTBUFFER) != 0); ++ ++ StateIsBufNext = ((Status & STATUS_M2P_CURRENT_MASK) == ++ STATUS_M2P_DMA_BUF_NEXT); ++ ++ if( NextBuffer ^ StateIsBufNext ) ++ current_frac1 = inl(M2P_reg_base+M2P_OFFSET_CURRENT1) - ++ inl(M2P_reg_base+M2P_OFFSET_BASE1); ++ else ++ current_frac1 = inl(M2P_reg_base+M2P_OFFSET_CURRENT0) - ++ inl(M2P_reg_base+M2P_OFFSET_BASE0); ++ ++ } else { ++ // M2M - TODO implement this for M2M ++ current_frac1 = 0; ++ } ++ ++ buf_id2 = dma->buffer_queue[dma->current_buffer].buf_id; ++ total2 = dma->total_bytes; ++ pause2 = dma->pause; ++ ++ } while ( (buf_id1 != buf_id2) || (total1 != total2) || (pause1 != pause2) ); ++ ++ if (pause1) ++ current_frac1 = 0; ++ ++ if (buf_id) ++ *buf_id = buf_id1; ++ ++ if (total) ++ *total = total1; ++ ++ if (current_frac) ++ *current_frac = current_frac1; ++ ++// DPRINTK("DMA buf_id %d, total %d, frac %d\n", buf_id1, total1, current_frac1); ++ ++ /* ++ * Success. ++ */ ++ return(0); ++} ++ ++/***************************************************************************** ++ * ++ * int ep93xx_dma_get_total(int handle) ++ * ++ * Description: Returns the total number of bytes transferred on the ++ * specified channel since the channel was requested. ++ * ++ * handle: handle for the channel to query. ++ * ++ ****************************************************************************/ ++int ++ep93xx_dma_get_total(int handle) ++{ ++ int channel; ++ ++ /* ++ * Get the DMA hw channel # from the handle. ++ */ ++ channel = dma_get_channel_from_handle(handle); ++ ++ /* ++ * See if this is a valid handle. ++ */ ++ if (channel < 0) { ++ printk(KERN_ERR "DMA Get Total: Invalid dma handle.\n"); ++ return(-EINVAL); ++ } ++ ++ DPRINTK("DMA %d: total: %d \n", channel, dma_chan[channel].total_bytes); ++ ++ /* ++ * Return the total number of bytes transferred on this channel since ++ * it was requested. ++ */ ++ return(dma_chan[channel].total_bytes); ++} ++ ++/***************************************************************************** ++ * ++ * int ep93xx_dma_is_done(int handle) ++ * ++ * Description: Determines if the specified channel is done ++ * transferring the requested data. ++ * ++ * handle: handle for the channel to query. ++ * ++ ****************************************************************************/ ++int ++ep93xx_dma_is_done(int handle) ++{ ++ ep93xx_dma_t *dma; ++ int channel; ++ ++ /* ++ * Get the DMA hw channel # from the handle. ++ */ ++ channel = dma_get_channel_from_handle(handle); ++ ++ /* ++ * See if this is a valid handle. ++ */ ++ if (channel < 0) { ++ printk(KERN_ERR "ep93xx_dma_is_done: Invalid dma handle.\n"); ++ return(-EINVAL); ++ } ++ ++ /* ++ * Get a pointer to the DMA channel state structure. ++ */ ++ dma = &dma_chan[channel]; ++ ++ /* ++ * See if there are any buffers remaining to be provided to the HW. ++ */ ++ if (dma->new_buffers) ++ return 0; ++ ++ /* ++ * See if this is a M2P or M2M channel. ++ */ ++ if (channel < 10) { ++ /* ++ * If the bytes remaining register of the HW is not zero, then ++ * there is more work to be done. ++ */ ++ if (inl(dma->reg_base + M2P_OFFSET_REMAIN) != 0) ++ return 0; ++ } else { ++ /* ++ * If either byte count register in the HW is not zero, then there ++ * is more work to be done. ++ */ ++ if ((inl(dma->reg_base + M2M_OFFSET_BCR0) != 0) || ++ (inl(dma->reg_base + M2M_OFFSET_BCR1) != 0)) ++ return 0; ++ } ++ ++ /* ++ * The DMA is complete. ++ */ ++ return 1; ++} ++ ++/***************************************************************************** ++ * ep93xx_dma_request ++ * ++ * Description: This function will allocate a DMA channel for a particular ++ * hardware peripheral. Before initiating a transfer on the allocated ++ * channel, the channel must be set up and buffers have to queued up. ++ * ++ * handle: pointer to an integer which is filled in with a unique ++ * handle for this instance of the dma interface. ++ * device_id string with the device name, primarily used by /proc. ++ * device hardware device ID for which the requested dma channel will ++ * transfer data. ++ * ++ ****************************************************************************/ ++int ++ep93xx_dma_request(int * handle, const char *device_id, ++ ep93xx_dma_dev_t device) ++{ ++ ep93xx_dma_t *dma = NULL; ++ int channel; ++ unsigned int error = 0; ++ unsigned int loop; ++ unsigned int M2P_reg_base; ++ ++ /* ++ * Check if the device requesting a DMA channel is a valid device. ++ */ ++ if ((device >= UNDEF_DMA) || (device < 0)) ++ return(-ENODEV); ++ ++ /* ++ * We've got a valid hardware device requesting a DMA channel. ++ * Now check if the device should open an M2P or M2M channel ++ */ ++ if (device < 20) ++ channel = dma_open_m2p(device); ++ else ++ channel = dma_open_m2m(device); ++ ++ /* ++ * Check if we successfully opened a DMA channel ++ */ ++ if (channel < 0) { ++ printk(KERN_ERR "%s: Could not open dma channel for this device.\n", ++ device_id); ++ return(-EBUSY); ++ } ++ ++ dma = &dma_chan[channel]; ++ ++ if(dma->terminated==1) { ++ free_irq(dma->irq, (void *) dma); ++ dma->terminated=0; ++ } ++ ++ /* ++ * Request the appropriate IRQ for the specified channel ++ */ ++ if (channel < 10) ++ error = request_irq(dma->irq, dma_m2p_irq_handler, ++ IRQF_DISABLED, device_id, (void *) dma); ++ else ++ error = request_irq(dma->irq, &dma_m2m_irq_handler, ++ IRQF_DISABLED, device_id, (void *) dma); ++ ++ /* ++ * Check for any errors during the irq request ++ */ ++ if (error) { ++ printk(KERN_ERR "%s: unable to request IRQ %d for DMA channel\n", ++ device_id, dma->irq); ++ return(error); ++ } ++ ++ /* ++ * Generate a valid handle and exit. ++ * ++ * Increment the last valid handle. ++ * Check for wraparound (unlikely, but we like to be complete). ++ */ ++ dma->last_valid_handle++; ++ ++ if ( (dma->last_valid_handle & DMA_HANDLE_SPECIFIER_MASK) != ++ (channel << 28) ) ++ dma->last_valid_handle = (channel << 28) + 1; ++ ++ /* ++ * Fill in the handle pointer with a valid handle for ++ * this dma channel instance. ++ */ ++ *handle = dma->last_valid_handle; ++ ++ DPRINTK("Handle for channel %d: 0x%x\n", channel, *handle); ++ ++ /* ++ * Save the device ID and device name. ++ */ ++ dma->device = device; ++ dma->device_id = device_id; ++ ++ /* ++ * Init all fields within the dma instance. ++ */ ++ for (loop = 0; loop < MAX_EP93XX_DMA_BUFFERS; loop++) ++ dma->buffer_queue[loop].buf_id = -1; ++ ++ /* ++ * Initialize all buffer queue variables. ++ */ ++ dma->current_buffer = 0; ++ dma->last_buffer = 0; ++ ++ dma->new_buffers = 0; ++ dma->used_buffers = 0; ++ dma->total_buffers = 0; ++ ++ /* ++ * Initialize the total bytes variable ++ */ ++ dma->total_bytes = 0; ++ ++ /* ++ * Initialize the transfer and pause state variables to 0. ++ */ ++ dma->xfer_enable = 0; ++ ++ dma->pause = 0; ++ ++ /* ++ * Initialize the pause buffer structure. ++ */ ++ dma->pause_buf.buf_id = -1; ++ ++ /* ++ * Initialize the callback function and user data fields. ++ */ ++ dma->callback = NULL; ++ ++ /* ++ * User data used as a parameter for the Callback function. The user ++ * sets up the data and sends it with the callback function. ++ */ ++ dma->user_data = 0; ++ ++ M2P_reg_base = dma_chan[channel].reg_base; ++ ++ /* ++ * Debugging message. ++ */ ++ DPRINTK("Successfully requested dma channel %d\n", channel); ++ DPRINTK("STATUS - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_STATUS) ); ++ DPRINTK("CONTROL - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_CONTROL) ); ++ DPRINTK("REMAIN - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_REMAIN) ); ++ DPRINTK("PPALLOC - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_PPALLOC) ); ++ DPRINTK("BASE0 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_BASE0) ); ++ DPRINTK("MAXCNT0 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_MAXCNT0) ); ++ DPRINTK("CURRENT0 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_CURRENT0) ); ++ DPRINTK("BASE1 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_BASE1) ); ++ DPRINTK("MAXCNT1 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_MAXCNT1) ); ++ DPRINTK("CURRENT1 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_CURRENT1) ); ++ ++ DPRINTK("Buffer source size last used \n"); ++ for (loop = 0; loop < 5; loop ++) ++ DPRINTK("%d 0x%x 0x%x %d %d \n", ++ loop, dma->buffer_queue[loop].source, dma->buffer_queue[loop].size, ++ dma->buffer_queue[loop].last, dma->buffer_queue[loop].used); ++ DPRINTK("pause 0x%x 0x%x %d %d \n", ++ dma->pause_buf.source, dma->pause_buf.size, ++ dma->pause_buf.last, dma->pause_buf.used); ++ ++ DPRINTK("Pause - %d \n", dma->pause); ++ DPRINTK("xfer_enable - %d \n", dma->xfer_enable); ++ DPRINTK("total bytes - 0x%x \n", dma->total_bytes); ++ DPRINTK("total buffer - %d \n", dma->total_buffers); ++ DPRINTK("new buffers - %d \n", dma->new_buffers); ++ DPRINTK("current buffer - %d \n", dma->current_buffer); ++ DPRINTK("last buffer - %d \n", dma->last_buffer); ++ DPRINTK("used buffers - %d \n", dma->used_buffers); ++ ++ DPRINTK("CURRENT1 - 0x%x \n", inl(M2P_reg_base+M2P_OFFSET_CURRENT1) ); ++ DPRINTK("VIC0IRQSTATUS - 0x%x, VIC0INTENABLE - 0x%x \n", ++ *(unsigned int *)(VIC0IRQSTATUS), ++ *(unsigned int *)(VIC0INTENABLE)); ++ ++ /* ++ * Success. ++ */ ++ return(0); ++} ++ ++/***************************************************************************** ++ * ++ * ep93xx_dma_free ++ * ++ * Description: This function will free the dma channel for future requests. ++ * ++ * handle: handle for the channel to be freed. ++ * ++ ****************************************************************************/ ++int ++ep93xx_dma_free(int handle) ++{ ++ ep93xx_dma_t *dma; ++ unsigned int M2M_reg_base, M2P_reg_base, uiCONTROL; ++ int channel; ++ ++ /* ++ * Get the DMA hw channel # from the handle. ++ */ ++ channel = dma_get_channel_from_handle(handle); ++ ++ /* ++ * See if this is a valid handle. ++ */ ++ if (channel < 0) { ++ printk(KERN_ERR "DMA Free: Invalid dma handle.\n"); ++ return(-EINVAL); ++ } ++ ++ /* ++ * Get a pointer to the dma instance. ++ */ ++ dma = &dma_chan[channel]; ++ ++ /* ++ * Disable the dma channel ++ */ ++ if (channel < 10) { ++ /* ++ * M2P channel ++ */ ++ M2P_reg_base = dma->reg_base; ++ ++ uiCONTROL = inl(M2P_reg_base+M2P_OFFSET_CONTROL); ++ uiCONTROL &= ~CONTROL_M2P_ENABLE; ++ outl( uiCONTROL, M2P_reg_base+M2P_OFFSET_CONTROL ); ++ } else { ++ /* ++ * M2M channel ++ */ ++ M2M_reg_base = dma->reg_base; ++ ++ uiCONTROL = inl(M2M_reg_base+M2M_OFFSET_CONTROL); ++ uiCONTROL &= ~CONTROL_M2M_ENABLE; ++ outl( uiCONTROL, M2M_reg_base+M2M_OFFSET_CONTROL ); ++ } ++ ++ /* ++ * Free the interrupt servicing this dma channel ++ */ ++ //free_irq(dma->irq, (void *) dma); ++ dma->terminated=1; ++ ++ /* ++ * Decrement the reference count for this instance of the dma interface ++ */ ++ dma->ref_count--; ++ ++ /* ++ * Set the transfer and pause state variables to 0 ++ * (unititialized state). ++ */ ++ dma->xfer_enable = 0; ++ dma->pause = 0; ++ ++ /* ++ * Debugging message. ++ */ ++ DPRINTK("Successfully freed dma channel %d\n", channel); ++ /* ++ * Success. ++ */ ++ return(0); ++} ++ ++/***************************************************************************** ++ * ++ * ep93xx_dma_init(void) ++ * ++ * Description: This function is called during system initialization to ++ * setup the interrupt number and register set base address for each DMA ++ * channel. ++ * ++ ****************************************************************************/ ++static int __init ++ep93xx_dma_init(void) ++{ ++ int channel; ++ ++ /* ++ * Init some values in each dma instance. ++ */ ++ for (channel = 0; channel < MAX_EP93XX_DMA_CHANNELS; channel++) { ++ /* ++ * IRQ for the specified dma channel. ++ */ ++ dma_chan[channel].irq = IRQ_EP93XX_DMAM2P0 + channel; ++ ++ dma_chan[channel].terminated = 0; ++ ++ /* ++ * Initial value of the dma channel handle. ++ */ ++ dma_chan[channel].last_valid_handle = channel << 28; ++ ++ /* ++ * Give the instance a pointer to the dma channel register ++ * base. ++ */ ++ if (channel < 10) ++ dma_chan[channel].reg_base = DMAM2PChannelBase[channel]; ++ else ++ dma_chan[channel].reg_base = DMAM2MChannelBase[channel - 10]; ++ ++ /* ++ * Initialize the reference count for this channel. ++ */ ++ dma_chan[channel].ref_count = 0; ++ } ++ ++ DPRINTK("DMA Interface intitialization complete\n"); ++ ++ /* ++ * Success ++ */ ++ return 0; ++} ++ ++arch_initcall(ep93xx_dma_init); ++ ++EXPORT_SYMBOL(ep93xx_dma_free); ++EXPORT_SYMBOL(ep93xx_dma_request); ++EXPORT_SYMBOL(ep93xx_dma_flush); ++EXPORT_SYMBOL(ep93xx_dma_pause); ++EXPORT_SYMBOL(ep93xx_dma_remove_buffer); ++EXPORT_SYMBOL(ep93xx_dma_add_buffer); ++EXPORT_SYMBOL(ep93xx_dma_start); ++EXPORT_SYMBOL(ep93xx_dma_config); +--- /dev/null ++++ b/arch/arm/mach-ep93xx/dma_ep93xx.h +@@ -0,0 +1,676 @@ ++/***************************************************************************** ++ * ++ * arch/arm/mach-ep93xx/dma_ep93xx.h ++ * ++ * DESCRIPTION: 93XX DMA controller API private defintions. ++ * ++ * Copyright Cirrus Logic Corporation, 2003. All rights reserved ++ * ++ * 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 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * ++ ****************************************************************************/ ++#ifndef _EP93XX_DMA_H_ ++#define _EP93XX_DMA_H_ ++ ++// as it turns out the ide dma is the biggest dma buffer hog so far ++// in case the HDD is "thinking" (seek/buffer flush) ++// the continueing r/w DMAs to the HDD will be queued up to up to PRD_ENTRIES entries... ++#include ++#define MAX_EP93XX_DMA_BUFFERS PRD_ENTRIES ++ ++#ifndef TRUE ++#define TRUE 1 ++#endif ++ ++#ifndef FALSE ++#define FALSE 0 ++#endif ++ ++#ifndef NULL ++#define NULL 0 ++#endif ++ ++#define EP93XX_DMA_BASE (EP93XX_AHB_VIRT_BASE + 0x00000000) ++ ++/***************************************************************************** ++ * 0x8000.0000 -> 0x8000.003C M2P Channel 0 Registers (Tx) ++ * 0x8000.0040 -> 0x8000.007C M2P Channel 1 Registers (Rx) ++ * 0x8000.0080 -> 0x8000.00BC M2P Channel 2 Registers (Tx) ++ * 0x8000.00C0 -> 0x8000.00FC M2P Channel 3 Registers (Rx) ++ * 0x8000.0100 -> 0x8000.013C M2M Channel 0 Registers ++ * 0x8000.0140 -> 0x8000.017C M2M Channel 1 Registers ++ * 0x8000.0180 -> 0x8000.01BC Not Used ++ * 0x8000.01C0 -> 0x8000.01FC Not Used ++ * 0x8000.0200 -> 0x8000.023C M2P Channel 5 Registers (Rx) ++ * 0x8000.0240 -> 0x8000.027C M2P Channel 4 Registers (Tx) ++ * 0x8000.0280 -> 0x8000.02BC M2P Channel 7 Registers (Rx) ++ * 0x8000.02C0 -> 0x8000.02FC M2P Channel 6 Registers (Tx) ++ * 0x8000.0300 -> 0x8000.033C M2P Channel 9 Registers (Rx) ++ * 0x8000.0340 -> 0x8000.037C M2P Channel 8 Registers (Tx) ++ * 0x8000.0380 DMA Channel Arbitration register ++ * 0x8000.03C0 DMA Global Interrupt register ++ * 0x8000.03C4 -> 0x8000.03FC Not Used ++ * ++ * ++ * Internal M2P/P2M Channel Register Map ++ * ++ * Offset Name Access Bits Reset Value ++ * 0x00 CONTROL R/W 6 0 ++ * 0x04 INTERRUPT R/W TC* 3 0 ++ * 0x08 PPALLOC R/W 4 channel dependant ++ * (see reg description) ++ * 0x0C STATUS RO 8 0 ++ * 0x10 reserved ++ * 0x14 REMAIN RO 16 0 ++ * 0X18 Reserved ++ * 0X1C Reserved ++ * 0x20 MAXCNT0 R/W 16 0 ++ * 0x24 BASE0 R/W 32 0 ++ * 0x28 CURRENT0 RO 32 0 ++ * 0x2C Reserved ++ * 0x30 MAXCNT1 R/W 16 0 ++ * 0x34 BASE1 R/W 32 0 ++ * 0X38 CURRENT1 RO 32 0 ++ * 0X3C Reserved ++ * ++ * M2M Channel Register Map ++ * Offset Name Access Bits Reset Value ++ * ++ * 0x00 CONTROL R/W 22 0 ++ * 0x04 INTERRUPT R/W TC* 3 0 ++ * 0x08 Reserved ++ * 0x0C STATUS R/W TC* 14 0 ++ * 0x10 BCR0 R/W 16 0 ++ * 0x14 BCR1 R/W 16 0 ++ * 0x18 SAR_BASE0 R/W 32 0 ++ * 0x1C SAR_BASE1 R/W 32 0 ++ * 0x20 Reserved ++ * 0x24 SAR_CURRENT0 RO 32 0 ++ * 0x28 SAR_CURRENT1 RO 32 0 ++ * 0x2C DAR_BASE0 R/W 32 0 ++ * 0x30 DAR_BASE1 R/W 32 0 ++ * 0x34 DAR_CURRENT0 RO 32 0 ++ * 0X38 Reserved ++ * 0X3C DAR_CURRENT1 RO 32 0 ++ * * Write this location once to clear the bit (see ++ * Interrupt/Status register description for which bits ++ * this rule applies to). ++ * ++ ****************************************************************************/ ++ ++ ++/*----------------------------------------------------------------------------------*/ ++/* M2P Registers */ ++/*----------------------------------------------------------------------------------*/ ++/* ++ * M2P CONTROL register bit defines ++ */ ++#define CONTROL_M2P_STALLINTEN 0x00000001 /* Enables the STALL interrupt */ ++#define CONTROL_M2P_NFBINTEN 0x00000002 /* Enables the NFB interrupt */ ++#define CONTROL_M2P_CHERRORINTEN 0x00000008 /* Enables the ChError interrupt*/ ++#define CONTROL_M2P_ENABLE 0x00000010 /* Enables the channel */ ++#define CONTROL_M2P_ABRT 0x00000020 /* Determines how DMA behaves in*/ ++ /* NEXT state with peripheral */ ++ /* error */ ++ /* 0: NEXT -> ON, ignore error */ ++ /* 1: NEXT -> STALL, disable ch.*/ ++#define CONTROL_M2P_ICE 0x00000040 /* Ignore Channel Error */ ++ ++/* ++ * M2P INTERRUPT register bit defines ++ */ ++#define INTERRUPT_M2P_STALLINT 0x00000001 /* Indicates channel stalled. */ ++#define INTERRUPT_M2P_NFBINT 0x00000002 /* Indicates channel is hungry. */ ++#define INTERRUPT_M2P_CHERRORINT 0x00000008 /* Peripheral detects error */ ++ ++ ++/* ++ * STATUS register bit defines ++ */ ++#define STATUS_M2P_STALL 0x00000001 /* A '1' indicates channel is */ ++ /* stalled */ ++#define STATUS_M2P_NFB 0x00000002 /* A '1' indicates channel has moved*/ ++ /* from NEXT state to ON state, but */ ++ /* waiting for next buffer to be */ ++ /* programmed. */ ++#define STATUS_M2P_CHERROR 0x00000008 /* Enables the ChError interrupt */ ++#define STATUS_M2P_CURRENT_MASK 0x00000030 /* Current state of the FSM */ ++#define STATUS_M2P_CURRENT_SHIFT 4 ++#define STATUS_M2P_NEXTBUFFER 0x00000040 /* Informs the int handler after an */ ++ /* NFB int which pair of maxcnt and */ ++ /* base regs to update. */ ++#define STATUS_M2P_BYTES_MASK 0x0000f800 /* number of valid DMA data */ ++#define STATUS_M2P_BYTES_SHIFT 7 /* currently in */ ++ /* packer/unpacker */ ++ ++#define STATUS_M2P_DMA_NO_BUF 0x00000000 ++#define STATUS_M2P_DMA_BUF_ON 0x00000010 ++#define STATUS_M2P_DMA_BUF_NEXT 0x00000020 ++ ++/* ++ * Register masks to mask off reserved bits after reading register. ++ */ ++#define M2P_MASK_PPALLOC 0x0000000f ++#define M2P_MASK_REMAIN 0x0000ffff ++#define M2P_MASK_MAXCNT0 0x0000ffff ++#define M2P_MASK_BASE0 0xffffffff ++#define M2P_MASK_CURRENT0 0xffffffff ++#define M2P_MASK_MAXCNT1 0x0000ffff ++#define M2P_MASK_BASE1 0xffffffff ++#define M2P_MASK_CURRENT1 0xffffffff ++ ++ ++/*----------------------------------------------------------------------------------*/ ++/* M2M Registers */ ++/*----------------------------------------------------------------------------------*/ ++ ++#define CONTROL_M2M_STALLINTEN 0x00000001 /* Enables the STALL interrupt */ ++#define CONTROL_M2M_SCT 0x00000002 /* Source Copy Transfer. Setup a */ ++ /* block transfer from 1 memory source */ ++ /* location. */ ++#define CONTROL_M2M_DONEINTEN 0x00000004 /* Enables the DONE interrupt which */ ++ /* indicates if the xfer completed */ ++ /* successfully */ ++#define CONTROL_M2M_ENABLE 0x00000008 /* Enables the channel */ ++#define CONTROL_M2M_START 0x00000010 /* Initiates the xfer. 'software trigger' */ ++#define CONTROL_M2M_BWC_MASK 0x000001e0 /* Bandwidth control. Indicate number of */ ++#define CONTROL_M2M_BWC_SHIFT 5 /* bytes in a transfer. */ ++#define CONTROL_M2M_PW_MASK 0x00000600 /* Peripheral width. Used for xfers */ ++#define CONTROL_M2M_PW_SHIFT 9 /* between memory and external peripheral. */ ++ /* 00: byte, 01: halfword, 10: word. */ ++#define CONTROL_M2M_DAH 0x00000800 /* Destination Address Hold */ ++#define CONTROL_M2M_SAH 0x00001000 /* Source Address Hold */ ++#define CONTROL_M2M_TM_MASK 0x00006000 /* Transfer Mode. 00: sw triggered, */ ++#define CONTROL_M2M_TM_SHIFT 13 /* 01: hw initiated M2P, 01: hw initiated P2M */ ++#define CONTROL_M2M_ETDP_MASK 0x00018000 /* End-of-Transfer/Terminal Count pin */ ++#define CONTROL_M2M_ETDP_SHIFT 15 /* direction and polarity. */ ++#define CONTROL_M2M_DACKP 0x00020000 /* DMA acknowledge pin polarity */ ++ ++#define CONTROL_M2M_DREQP_MASK 0x00180000 /* DMA request pin polarity. must be set */ ++#define CONTROL_M2M_DREQP_SHIFT 19 /* before enable bit. */ ++#define CONTROL_M2M_NFBINTEN 0x00200000 /* Enables generation of the NFB interrupt. */ ++#define CONTROL_M2M_RSS_MASK 0x00c00000 /* Request source selection: */ ++#define CONTROL_M2M_RSS_SHIFT 22 /* 000 - External DReq[0] */ ++ /* 001 - External DReq[1] */ ++ /* 01X - Internal SSPRx */ ++ /* 10X - Internal SSPTx */ ++ /* 11X - Internal IDE */ ++#define CONTROL_M2M_NO_HDSK 0x01000000 /* No handshake. When set the peripheral doesn't */ ++ /* require the regular handshake protocal. Must */ ++ /* be set for SSP and IDE operations, optional */ ++ /* for external peripherals. */ ++#define CONTROL_M2M_PWSC_MASK 0xfe000000 /* Peripheral wait states count. Gives the latency */ ++#define CONTROL_M2M_PWSC_SHIFT 25 /* (in PCLK cycles) needed by the peripheral to */ ++ /* deassert its' request once the M2M xfer w/ DMA */ ++ /* is complete. */ ++ ++/* ++ * M2M INTERRUPT register bit defines ++ */ ++#define INTERRUPT_M2M_STALLINT 0x00000001 /* Stall interrupt indicates channel stalled. */ ++#define INTERRUPT_M2M_DONEINT 0x00000002 /* Transaction done. */ ++#define INTERRUPT_M2M_NFBINT 0x00000004 /* Next frame buffer interrupt indicates */ ++ /* channel requires a new buffer */ ++ ++ ++ ++/* ++ * M2M STATUS register bit defines ++ */ ++#define STATUS_M2M_STALL 0x00000001 /* A '1' indicates channel is stalled */ ++#define STATUS_M2M_CURRENTSTATE_MASK 0x0000003e /* Indicates state of M2M Channel control */ ++#define STATUS_M2M_CURRENTSTATE_SHIFT 1 /* FSM (0-2): */ ++ /* 000 - IDLE, 001 - STALL, 010 - MEM_RD, */ ++ /* 011 - MEM_WR, 100 - BWC_WAIT */ ++ /* and M2M buffer FSM (3-2): */ ++ /* 00 - NO_BUF, 01 - BUF_ON, 10 - BUF_NEXT */ ++#define STATUS_M2M_DONE 0x00000040 /* Transfer completed successfully if 1. */ ++#define STATUS_M2M_TCS_MASK 0x00000180 /* Terminal Count status. Indicates whether or */ ++#define STATUS_M2M_TCS_SHIFT 7 /* or not the actual byte count reached */ ++ /* programmed limit for buffer descriptor */ ++#define STATUS_M2M_EOTS_MASK 0x00000600 /* End-of-Transfer status for buffer */ ++#define STATUS_M2M_EOTS_SHIFT 9 ++#define STATUS_M2M_NFB 0x00000800 /* A '1' indicates channel has moved */ ++ /* from NEXT state to ON state, but the next */ ++ /* byte count reg for next buffer has not been */ ++ /* programmed yet. */ ++#define STATUS_M2M_NB 0x00001000 /* NextBuffer status. Informs NFB service */ ++ /* routine, after NFB int, which pair of buffer */ ++ /* descriptor registers is free to update. */ ++#define STATUS_M2M_DREQS 0x00002000 /* DREQ status. Reflects the status of the */ ++ /* synchronized external peripherals DMA */ ++ /* request signal. */ ++ ++/* ++ * Register masks to mask off reserved bits after reading register. ++ */ ++#define M2M_MASK_BCR0 0x0000ffff ++#define M2M_MASK_BCR1 0x0000ffff ++#define M2M_MASK_SAR_BASE0 0xffffffff ++#define M2M_MASK_SAR_BASE1 0xffffffff ++#define M2M_MASK_SAR_CURRENT0 0xffffffff ++#define M2M_MASK_SAR_CURRENT1 0xffffffff ++#define M2M_MASK_DAR_BASE0 0xffffffff ++#define M2M_MASK_DAR_BASE1 0xffffffff ++#define M2M_MASK_DAR_CURRENT0 0xffffffff ++#define M2M_MASK_DAR_CURRENT1 0xffffffff ++ ++ ++// ++/* 8000_0000 - 8000_ffff: DMA */ ++#define DMA_OFFSET 0x000000 ++#define DMA_BASE (EP93XX_DMA_BASE) ++#define DMAMP_TX_0_CONTROL (DMA_BASE+0x0000) ++#define DMAMP_TX_0_INTERRUPT (DMA_BASE+0x0004) ++#define DMAMP_TX_0_PPALLOC (DMA_BASE+0x0008) ++#define DMAMP_TX_0_STATUS (DMA_BASE+0x000C) ++#define DMAMP_TX_0_REMAIN (DMA_BASE+0x0014) ++#define DMAMP_TX_0_MAXCNT0 (DMA_BASE+0x0020) ++#define DMAMP_TX_0_BASE0 (DMA_BASE+0x0024) ++#define DMAMP_TX_0_CURRENT0 (DMA_BASE+0x0028) ++#define DMAMP_TX_0_MAXCNT1 (DMA_BASE+0x0030) ++#define DMAMP_TX_0_BASE1 (DMA_BASE+0x0034) ++#define DMAMP_TX_0_CURRENT1 (DMA_BASE+0x0038) ++ ++#define DMAMP_RX_1_CONTROL (DMA_BASE+0x0040) ++#define DMAMP_RX_1_INTERRUPT (DMA_BASE+0x0044) ++#define DMAMP_RX_1_PPALLOC (DMA_BASE+0x0048) ++#define DMAMP_RX_1_STATUS (DMA_BASE+0x004C) ++#define DMAMP_RX_1_REMAIN (DMA_BASE+0x0054) ++#define DMAMP_RX_1_MAXCNT0 (DMA_BASE+0x0060) ++#define DMAMP_RX_1_BASE0 (DMA_BASE+0x0064) ++#define DMAMP_RX_1_CURRENT0 (DMA_BASE+0x0068) ++#define DMAMP_RX_1_MAXCNT1 (DMA_BASE+0x0070) ++#define DMAMP_RX_1_BASE1 (DMA_BASE+0x0074) ++#define DMAMP_RX_1_CURRENT1 (DMA_BASE+0x0078) ++ ++#define DMAMP_TX_2_CONTROL (DMA_BASE+0x0080) ++#define DMAMP_TX_2_INTERRUPT (DMA_BASE+0x0084) ++#define DMAMP_TX_2_PPALLOC (DMA_BASE+0x0088) ++#define DMAMP_TX_2_STATUS (DMA_BASE+0x008C) ++#define DMAMP_TX_2_REMAIN (DMA_BASE+0x0094) ++#define DMAMP_TX_2_MAXCNT0 (DMA_BASE+0x00A0) ++#define DMAMP_TX_2_BASE0 (DMA_BASE+0x00A4) ++#define DMAMP_TX_2_CURRENT0 (DMA_BASE+0x00A8) ++#define DMAMP_TX_2_MAXCNT1 (DMA_BASE+0x00B0) ++#define DMAMP_TX_2_BASE1 (DMA_BASE+0x00B4) ++#define DMAMP_TX_2_CURRENT1 (DMA_BASE+0x00B8) ++ ++#define DMAMP_RX_3_CONTROL (DMA_BASE+0x00C0) ++#define DMAMP_RX_3_INTERRUPT (DMA_BASE+0x00C4) ++#define DMAMP_RX_3_PPALLOC (DMA_BASE+0x00C8) ++#define DMAMP_RX_3_STATUS (DMA_BASE+0x00CC) ++#define DMAMP_RX_3_REMAIN (DMA_BASE+0x00D4) ++#define DMAMP_RX_3_MAXCNT0 (DMA_BASE+0x00E0) ++#define DMAMP_RX_3_BASE0 (DMA_BASE+0x00E4) ++#define DMAMP_RX_3_CURRENT0 (DMA_BASE+0x00E8) ++#define DMAMP_RX_3_MAXCNT1 (DMA_BASE+0x00F0) ++#define DMAMP_RX_3_BASE1 (DMA_BASE+0x00F4) ++#define DMAMP_RX_3_CURRENT1 (DMA_BASE+0x00F8) ++ ++#define DMAMM_0_CONTROL (DMA_BASE+0x0100) ++#define DMAMM_0_INTERRUPT (DMA_BASE+0x0104) ++#define DMAMM_0_STATUS (DMA_BASE+0x010C) ++#define DMAMM_0_BCR0 (DMA_BASE+0x0110) ++#define DMAMM_0_BCR1 (DMA_BASE+0x0114) ++#define DMAMM_0_SAR_BASE0 (DMA_BASE+0x0118) ++#define DMAMM_0_SAR_BASE1 (DMA_BASE+0x011C) ++#define DMAMM_0_SAR_CURRENT0 (DMA_BASE+0x0124) ++#define DMAMM_0_SAR_CURRENT1 (DMA_BASE+0x0128) ++#define DMAMM_0_DAR_BASE0 (DMA_BASE+0x012C) ++#define DMAMM_0_DAR_BASE1 (DMA_BASE+0x0130) ++#define DMAMM_0_DAR_CURRENT0 (DMA_BASE+0x0134) ++#define DMAMM_0_DAR_CURRENT1 (DMA_BASE+0x013C) ++ ++#define DMAMM_1_CONTROL (DMA_BASE+0x0140) ++#define DMAMM_1_INTERRUPT (DMA_BASE+0x0144) ++#define DMAMM_1_STATUS (DMA_BASE+0x014C) ++#define DMAMM_1_BCR0 (DMA_BASE+0x0150) ++#define DMAMM_1_BCR1 (DMA_BASE+0x0154) ++#define DMAMM_1_SAR_BASE0 (DMA_BASE+0x0158) ++#define DMAMM_1_SAR_BASE1 (DMA_BASE+0x015C) ++#define DMAMM_1_SAR_CURRENT0 (DMA_BASE+0x0164) ++#define DMAMM_1_SAR_CURRENT1 (DMA_BASE+0x0168) ++#define DMAMM_1_DAR_BASE0 (DMA_BASE+0x016C) ++#define DMAMM_1_DAR_BASE1 (DMA_BASE+0x0170) ++#define DMAMM_1_DAR_CURRENT0 (DMA_BASE+0x0174) ++#define DMAMM_1_DAR_CURRENT1 (DMA_BASE+0x017C) ++ ++#define DMAMP_RX_5_CONTROL (DMA_BASE+0x0200) ++#define DMAMP_RX_5_INTERRUPT (DMA_BASE+0x0204) ++#define DMAMP_RX_5_PPALLOC (DMA_BASE+0x0208) ++#define DMAMP_RX_5_STATUS (DMA_BASE+0x020C) ++#define DMAMP_RX_5_REMAIN (DMA_BASE+0x0214) ++#define DMAMP_RX_5_MAXCNT0 (DMA_BASE+0x0220) ++#define DMAMP_RX_5_BASE0 (DMA_BASE+0x0224) ++#define DMAMP_RX_5_CURRENT0 (DMA_BASE+0x0228) ++#define DMAMP_RX_5_MAXCNT1 (DMA_BASE+0x0230) ++#define DMAMP_RX_5_BASE1 (DMA_BASE+0x0234) ++#define DMAMP_RX_5_CURRENT1 (DMA_BASE+0x0238) ++ ++#define DMAMP_TX_4_CONTROL (DMA_BASE+0x0240) ++#define DMAMP_TX_4_INTERRUPT (DMA_BASE+0x0244) ++#define DMAMP_TX_4_PPALLOC (DMA_BASE+0x0248) ++#define DMAMP_TX_4_STATUS (DMA_BASE+0x024C) ++#define DMAMP_TX_4_REMAIN (DMA_BASE+0x0254) ++#define DMAMP_TX_4_MAXCNT0 (DMA_BASE+0x0260) ++#define DMAMP_TX_4_BASE0 (DMA_BASE+0x0264) ++#define DMAMP_TX_4_CURRENT0 (DMA_BASE+0x0268) ++#define DMAMP_TX_4_MAXCNT1 (DMA_BASE+0x0270) ++#define DMAMP_TX_4_BASE1 (DMA_BASE+0x0274) ++#define DMAMP_TX_4_CURRENT1 (DMA_BASE+0x0278) ++ ++#define DMAMP_RX_7_CONTROL (DMA_BASE+0x0280) ++#define DMAMP_RX_7_INTERRUPT (DMA_BASE+0x0284) ++#define DMAMP_RX_7_PPALLOC (DMA_BASE+0x0288) ++#define DMAMP_RX_7_STATUS (DMA_BASE+0x028C) ++#define DMAMP_RX_7_REMAIN (DMA_BASE+0x0294) ++#define DMAMP_RX_7_MAXCNT0 (DMA_BASE+0x02A0) ++#define DMAMP_RX_7_BASE0 (DMA_BASE+0x02A4) ++#define DMAMP_RX_7_CURRENT0 (DMA_BASE+0x02A8) ++#define DMAMP_RX_7_MAXCNT1 (DMA_BASE+0x02B0) ++#define DMAMP_RX_7_BASE1 (DMA_BASE+0x02B4) ++#define DMAMP_RX_7_CURRENT1 (DMA_BASE+0x02B8) ++ ++#define DMAMP_TX_6_CONTROL (DMA_BASE+0x02C0) ++#define DMAMP_TX_6_INTERRUPT (DMA_BASE+0x02C4) ++#define DMAMP_TX_6_PPALLOC (DMA_BASE+0x02C8) ++#define DMAMP_TX_6_STATUS (DMA_BASE+0x02CC) ++#define DMAMP_TX_6_REMAIN (DMA_BASE+0x02D4) ++#define DMAMP_TX_6_MAXCNT0 (DMA_BASE+0x02E0) ++#define DMAMP_TX_6_BASE0 (DMA_BASE+0x02E4) ++#define DMAMP_TX_6_CURRENT0 (DMA_BASE+0x02E8) ++#define DMAMP_TX_6_MAXCNT1 (DMA_BASE+0x02F0) ++#define DMAMP_TX_6_BASE1 (DMA_BASE+0x02F4) ++#define DMAMP_TX_6_CURRENT1 (DMA_BASE+0x02F8) ++ ++#define DMAMP_RX_9_CONTROL (DMA_BASE+0x0300) ++#define DMAMP_RX_9_INTERRUPT (DMA_BASE+0x0304) ++#define DMAMP_RX_9_PPALLOC (DMA_BASE+0x0308) ++#define DMAMP_RX_9_STATUS (DMA_BASE+0x030C) ++#define DMAMP_RX_9_REMAIN (DMA_BASE+0x0314) ++#define DMAMP_RX_9_MAXCNT0 (DMA_BASE+0x0320) ++#define DMAMP_RX_9_BASE0 (DMA_BASE+0x0324) ++#define DMAMP_RX_9_CURRENT0 (DMA_BASE+0x0328) ++#define DMAMP_RX_9_MAXCNT1 (DMA_BASE+0x0330) ++#define DMAMP_RX_9_BASE1 (DMA_BASE+0x0334) ++#define DMAMP_RX_9_CURRENT1 (DMA_BASE+0x0338) ++ ++#define DMAMP_TX_8_CONTROL (DMA_BASE+0x0340) ++#define DMAMP_TX_8_INTERRUPT (DMA_BASE+0x0344) ++#define DMAMP_TX_8_PPALLOC (DMA_BASE+0x0348) ++#define DMAMP_TX_8_STATUS (DMA_BASE+0x034C) ++#define DMAMP_TX_8_REMAIN (DMA_BASE+0x0354) ++#define DMAMP_TX_8_MAXCNT0 (DMA_BASE+0x0360) ++#define DMAMP_TX_8_BASE0 (DMA_BASE+0x0364) ++#define DMAMP_TX_8_CURRENT0 (DMA_BASE+0x0368) ++#define DMAMP_TX_8_MAXCNT1 (DMA_BASE+0x0370) ++#define DMAMP_TX_8_BASE1 (DMA_BASE+0x0374) ++#define DMAMP_TX_8_CURRENT1 (DMA_BASE+0x0378) ++ ++#define DMA_ARBITRATION (DMA_BASE+0x0380) ++#define DMA_INTERRUPT (DMA_BASE+0x03C0) ++ ++ ++/* ++ * DMA Register Base addresses and Offsets ++ */ ++#define DMA_M2P_TX_0_BASE DMAMP_TX_0_CONTROL ++#define DMA_M2P_RX_1_BASE DMAMP_RX_1_CONTROL ++#define DMA_M2P_TX_2_BASE DMAMP_TX_2_CONTROL ++#define DMA_M2P_RX_3_BASE DMAMP_RX_3_CONTROL ++#define DMA_M2M_0_BASE DMAMM_0_CONTROL ++#define DMA_M2M_1_BASE DMAMM_1_CONTROL ++#define DMA_M2P_RX_5_BASE DMAMP_RX_5_CONTROL ++#define DMA_M2P_TX_4_BASE DMAMP_TX_4_CONTROL ++#define DMA_M2P_RX_7_BASE DMAMP_RX_7_CONTROL ++#define DMA_M2P_TX_6_BASE DMAMP_TX_6_CONTROL ++#define DMA_M2P_RX_9_BASE DMAMP_RX_9_CONTROL ++#define DMA_M2P_TX_8_BASE DMAMP_TX_8_CONTROL ++ ++#define M2P_OFFSET_CONTROL 0x0000 ++#define M2P_OFFSET_INTERRUPT 0x0004 ++#define M2P_OFFSET_PPALLOC 0x0008 ++#define M2P_OFFSET_STATUS 0x000C ++#define M2P_OFFSET_REMAIN 0x0014 ++#define M2P_OFFSET_MAXCNT0 0x0020 ++#define M2P_OFFSET_BASE0 0x0024 ++#define M2P_OFFSET_CURRENT0 0x0028 ++#define M2P_OFFSET_MAXCNT1 0x0030 ++#define M2P_OFFSET_BASE1 0x0034 ++#define M2P_OFFSET_CURRENT1 0x0038 ++ ++#define M2M_OFFSET_CONTROL 0x0000 ++#define M2M_OFFSET_INTERRUPT 0x0004 ++#define M2M_OFFSET_STATUS 0x000C ++#define M2M_OFFSET_BCR0 0x0010 ++#define M2M_OFFSET_BCR1 0x0014 ++#define M2M_OFFSET_SAR_BASE0 0x0018 ++#define M2M_OFFSET_SAR_BASE1 0x001C ++#define M2M_OFFSET_SAR_CURRENT0 0x0024 ++#define M2M_OFFSET_SAR_CURRENT1 0x0028 ++#define M2M_OFFSET_DAR_BASE0 0x002C ++#define M2M_OFFSET_DAR_BASE1 0x0030 ++#define M2M_OFFSET_DAR_CURRENT0 0x0034 ++#define M2M_OFFSET_DAR_CURRENT1 0x003C ++ ++ ++ ++//----------------------------------------------------------------------------- ++// PWRCNT Register Defines ++//----------------------------------------------------------------------------- ++#define SYSCON_PWRCNT_FIREN 0x80000000 ++#define SYSCON_PWRCNT_UARTBAUD 0x20000000 ++#define SYSCON_PWRCNT_USHEN 0x10000000 ++#define SYSCON_PWRCNT_DMA_M2MCH1 0x08000000 ++#define SYSCON_PWRCNT_DMA_M2MCH0 0x04000000 ++#define SYSCON_PWRCNT_DMA_M2PCH8 0x02000000 ++#define SYSCON_PWRCNT_DMA_M2PCH9 0x01000000 ++#define SYSCON_PWRCNT_DMA_M2PCH6 0x00800000 ++#define SYSCON_PWRCNT_DMA_M2PCH7 0x00400000 ++#define SYSCON_PWRCNT_DMA_M2PCH4 0x00200000 ++#define SYSCON_PWRCNT_DMA_M2PCH5 0x00100000 ++#define SYSCON_PWRCNT_DMA_M2PCH2 0x00080000 ++#define SYSCON_PWRCNT_DMA_M2PCH3 0x00040000 ++#define SYSCON_PWRCNT_DMA_M2PCH0 0x00020000 ++#define SYSCON_PWRCNT_DMA_M2PCH1 0x00010000 ++ ++#ifndef __ASSEMBLY__ ++/* ++ * DMA Register Base addresses ++ */ ++static unsigned int const DMAM2PChannelBase[10] = ++{ ++ DMA_M2P_TX_0_BASE, ++ DMA_M2P_RX_1_BASE, ++ DMA_M2P_TX_2_BASE, ++ DMA_M2P_RX_3_BASE, ++ DMA_M2P_TX_4_BASE, ++ DMA_M2P_RX_5_BASE, ++ DMA_M2P_TX_6_BASE, ++ DMA_M2P_RX_7_BASE, ++ DMA_M2P_TX_8_BASE, ++ DMA_M2P_RX_9_BASE ++}; ++ ++static unsigned int const DMAM2MChannelBase[2] = ++{ ++ DMA_M2M_0_BASE, ++ DMA_M2M_1_BASE ++}; ++ ++#endif /* __ASSEMBLY__ */ ++ ++/***************************************************************************** ++ * ++ * DMA buffer structure type. ++ * ++ ****************************************************************************/ ++typedef struct ep93xx_dma_buffer_s ++{ ++ unsigned int source; /* buffer physical source address. */ ++ unsigned int dest; /* buffer physical destination address, */ ++ /* only used with the 2 M2M channels. */ ++ unsigned int size; /* buffer size in bytes */ ++ unsigned int last; /* 1 if this is the last buffer */ ++ /* in this transaction. If 1, */ ++ /* disable the NFBint so we aren't */ ++ /* interrupted for another buffer */ ++ /* when we know there won't be another. */ ++ unsigned int used; /* This field is set to 1 by the DMA */ ++ /* interface after the buffer is transferred*/ ++ int buf_id; /* unique identifyer specified by the */ ++ /* the driver which requested the dma */ ++} ep93xx_dma_buffer_t; ++ ++typedef ep93xx_dma_buffer_t * ep93xx_dma_buffer_p; ++ ++/***************************************************************************** ++ * ++ * Instance definition for the DMA interface. ++ * ++ ****************************************************************************/ ++typedef struct ep9312_dma_s ++{ ++ /* ++ * This 1 when the instance is in use, and 0 when it's not. ++ */ ++ unsigned int ref_count; ++ ++ /* ++ * This is the last valid handle for this instance. When giving out a ++ * new handle this will be incremented and given out. ++ */ ++ int last_valid_handle; ++ ++ /* ++ * device specifies one of the 20 DMA hardware ports this ++ * DMA channel will service. ++ */ ++ ep93xx_dma_dev_t device; ++ ++ /* ++ * DMABufferQueue is the queue of buffer structure pointers which the ++ * dma channel will use to setup transfers. ++ */ ++ ep93xx_dma_buffer_t buffer_queue[MAX_EP93XX_DMA_BUFFERS]; ++ ++ /* ++ * currnt_buffer : This is the buffer currently being transfered on ++ * this channel. ++ * last_buffer : This is the last buffer for this transfer. ++ * Note: current_buffer + 1 is already programmed into the dma ++ * channel as the next buffer to transfer. Don't write ++ * over either entry. ++ */ ++ int current_buffer; ++ int last_buffer; ++ ++ /* ++ * The following 3 fields are buffer counters. ++ * ++ * iNewBuffers: Buffers in the queue which have not been transfered. ++ * iUsedBuffers: Buffers in the queue which have have been tranferred, ++ * and are waiting to be returned. ++ * iTotalBuffers: Total number of buffers in the queue. ++ */ ++ int new_buffers; ++ int used_buffers; ++ int total_buffers; ++ ++ /* ++ * uiTotalBytes has the total bytes transfered on the channel since the ++ * last flush. This value does not include the bytes tranfered in the ++ * current buffer. A byte count is only added after a complete buffer ++ * is tranfered. ++ */ ++ unsigned int total_bytes; ++ ++ /* ++ * Interrupt number for this channel ++ */ ++ unsigned int irq; ++ ++ /* ++ * Indicates whether or not the channel is currently enabled to transfer ++ * data. ++ */ ++ unsigned int xfer_enable; ++ ++ /* ++ * pause indicates if the dma channel was paused by calling the pause ++ * ioctl. ++ */ ++ unsigned int pause; ++ ++ /* ++ * buffer structure used during a pause to capture the current ++ * address and remaining bytes for the buffer actively being transferred ++ * on the channel. This buffer will be used to reprogram the dma ++ * channel upon a resume. ++ */ ++ ep93xx_dma_buffer_t pause_buf; ++ ++ /* ++ * DMACallback is a function pointer which the calling application can ++ * use install a function to. this fuction can be used to notify the ++ * calling application of an interrupt. ++ */ ++ dma_callback callback; ++ ++ /* ++ * User data used as a parameter for the Callback function. The user ++ * sets up the data and sends it with the callback function. ++ */ ++ unsigned int user_data; ++ ++ /* ++ * A string representation of the device attached to the channel. ++ */ ++ const char * device_id; ++ ++ /* ++ * The register base address for this dma channel. ++ */ ++ unsigned int reg_base; ++ ++ /* ++ * terminated indicates ++ */ ++ unsigned int terminated; ++ ++ ++} ep93xx_dma_t; ++ ++/***************************************************************************** ++ * ++ * DMA macros ++ * ++ ****************************************************************************/ ++#define DMA_HANDLE_SPECIFIER_MASK 0xF0000000 ++#define DMA_CH0_HANDLE_SPECIFIER 0x00000000 ++#define DMA_CH1_HANDLE_SPECIFIER 0x10000000 ++#define DMA_CH2_HANDLE_SPECIFIER 0x20000000 ++#define DMA_CH3_HANDLE_SPECIFIER 0x30000000 ++#define DMA_CH4_HANDLE_SPECIFIER 0x40000000 ++#define DMA_CH5_HANDLE_SPECIFIER 0x50000000 ++#define DMA_CH6_HANDLE_SPECIFIER 0x60000000 ++#define DMA_CH7_HANDLE_SPECIFIER 0x70000000 ++#define DMA_CH8_HANDLE_SPECIFIER 0x80000000 ++#define DMA_CH9_HANDLE_SPECIFIER 0x90000000 ++#define DMA_CH10_HANDLE_SPECIFIER 0xA0000000 ++#define DMA_CH11_HANDLE_SPECIFIER 0xB0000000 ++ ++#endif // _DMADRV_H_ diff --git a/target/linux/ep93xx/patches-2.6.30/006-ep93xx-touchscreen.patch b/target/linux/ep93xx/patches-2.6.30/006-ep93xx-touchscreen.patch new file mode 100644 index 000000000..6a0d5dbfd --- /dev/null +++ b/target/linux/ep93xx/patches-2.6.30/006-ep93xx-touchscreen.patch @@ -0,0 +1,1319 @@ +Index: linux-2.6.30.9/drivers/input/touchscreen/Kconfig +=================================================================== +--- linux-2.6.30.9.orig/drivers/input/touchscreen/Kconfig 2009-11-24 21:00:18.000000000 +0100 ++++ linux-2.6.30.9/drivers/input/touchscreen/Kconfig 2009-11-24 21:00:45.000000000 +0100 +@@ -161,6 +161,10 @@ + module will be called wacom_w8001. + + ++config TOUCHSCREEN_EP93XX ++ tristate "EP93xx Touchscreen" ++ depends on ARM && INPUT && ARCH_EP93XX ++ + config TOUCHSCREEN_MTOUCH + tristate "MicroTouch serial touchscreens" + select SERIO +Index: linux-2.6.30.9/drivers/input/touchscreen/Makefile +=================================================================== +--- linux-2.6.30.9.orig/drivers/input/touchscreen/Makefile 2009-11-24 21:00:18.000000000 +0100 ++++ linux-2.6.30.9/drivers/input/touchscreen/Makefile 2009-11-24 21:00:45.000000000 +0100 +@@ -14,6 +14,7 @@ + obj-$(CONFIG_TOUCHSCREEN_CORGI) += corgi_ts.o + obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o + obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o ++obj-$(CONFIG_TOUCHSCREEN_EP93XX) += ep93xx_ts.o + obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.o + obj-$(CONFIG_TOUCHSCREEN_INEXIO) += inexio.o + obj-$(CONFIG_TOUCHSCREEN_MIGOR) += migor_ts.o +Index: linux-2.6.30.9/drivers/input/touchscreen/ep93xx_ts.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.30.9/drivers/input/touchscreen/ep93xx_ts.c 2009-11-24 21:09:48.000000000 +0100 +@@ -0,0 +1,1117 @@ ++/* ++ * linux/drivers/input/touchscreen/ep93xx_ts.c ++ * ++ * Copyright (C) 2003-2004 Cirrus Corp. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define TOUCH_OFFSET 0x100000 ++#define TOUCH_BASE (EP93XX_APB_VIRT_BASE|TOUCH_OFFSET) ++#define TSSetup (TOUCH_BASE+0x00) /* R/W touchscreen controller setup control register. */ ++#define TSXYMaxMin (TOUCH_BASE+0x04) /* R/W touchscreen controller max/min register. */ ++#define TSXYResult (TOUCH_BASE+0x08) /* R touchscreen controller result register. */ ++#define TSDischarge (TOUCH_BASE+0x0C) /* LOCKED R/W touchscreen Switch Matrix control register. */ ++#define TSXSample (TOUCH_BASE+0x10) /* LOCKED R/W touchscreen Switch Matrix control register. */ ++#define TSYSample (TOUCH_BASE+0x14) /* LOCKED R/W touchscreen Switch Matrix control register. */ ++#define TSDirect (TOUCH_BASE+0x18) /* LOCKED R/W touchscreen Switch Matrix control register. */ ++#define TSDetect (TOUCH_BASE+0x1C) /* LOCKED R/W touchscreen Switch Matrix control register. */ ++#define TSSWLock (TOUCH_BASE+0x20) /* NA R/W touchscreen software lock register. */ ++#define TSSetup2 (TOUCH_BASE+0x24) /* R/W touchscreen setup control register #2. */ ++ ++// ++// To customize for a new touchscreen, there are various macros that ++// have to be set. If you allow UART_HACK_DEBUG to be defined, you ++// will get real time ts data scrolling up your serial terminal ++// screen that will help you empirically determine good values for these. ++// ++ ++// ++// These are used as trigger levels to know when we have pen up/down ++// ++// The rules: ++// 1. TS_HEAVY_INV_PRESSURE < TS_LIGHT_INV_PRESSURE because these ++// are Inverse pressure. ++// 2. Any touch lighter than TS_LIGHT_INV_PRESSURE is a pen up. ++// 3. Any touch heavier than TS_HEAVY_INV_PRESSURE is a pen down. ++// ++#define TS_HEAVY_INV_PRESSURE 0xFE0 //C00 ++#define TS_LIGHT_INV_PRESSURE 0xFFF //e00 ++ ++// ++// If the x, y, or inverse pressure changes more than these values ++// between two succeeding points, the point is not reported. ++// ++#define TS_MAX_VALID_XY_CHANGE 0x300 ++#define TS_MAX_VALID_PRESSURE_CHANGE 0x100 ++ ++// ++// This is the minimum Z1 Value that is valid. ++// ++#define MIN_Z1_VALUE 0x50 ++ ++// ++// Settling delay for taking each ADC measurement. Increase this ++// if ts is jittery. ++// ++#define EP93XX_TS_ADC_DELAY_USEC 2000 ++ ++// ++// Delay between TS points. ++// ++#define EP93XX_TS_PER_POINT_DELAY_USEC 10000 ++ ++//----------------------------------------------------------------------------- ++// Debug messaging thru the UARTs ++//----------------------------------------------------------------------------- ++/* ++ * Hello there! Are you trying to get this driver to work with a new ++ * touschscreen? Turn this on and you will get useful info coming ++ * out of your serial port. ++ */ ++/* #define PRINT_CALIBRATION_FACTORS */ ++#ifdef PRINT_CALIBRATION_FACTORS ++#define UART_HACK_DEBUG 1 ++int iMaxX=0, iMaxY=0, iMinX = 0xfff, iMinY = 0xfff; ++#endif ++ ++/* ++ * For debugging, let's spew messages out serial port 1 or 3 at 57,600 baud. ++ */ ++/* #define UART_HACK_DEBUG 1 */ ++#if 0 ++#ifdef UART_HACK_DEBUG ++static char szBuf[256]; ++void UARTWriteString(char * msg); ++#define DPRINTK( x... ) \ ++ sprintf( szBuf, ##x ); \ ++ UARTWriteString( szBuf ); ++#else ++static char szBuf[256]; ++#define DPRINTK( x... ) \ ++ sprintf( szBuf, ##x ); \ ++ printk( szBuf ); ++#endif ++#endif // 0 ++#define DPRINTK( x... ) ++ ++//----------------------------------------------------------------------------- ++// A few more macros... ++//----------------------------------------------------------------------------- ++#define TSSETUP_DEFAULT ( TSSETUP_NSMP_32 | TSSETUP_DEV_64 | \ ++ ((128<>2] & 0x20); ++ ++ // send a char to the uart ++ pDebugUART[0] = value; ++} ++ ++void UARTWriteString(char * msg) ++{ ++ int index = 0; ++ unsigned int uiTemp; ++ ++ //if((pDebugUART[0x14>>2] & 0x1) == 0) ++ if( bUartInitialized == 0 ) ++ { ++ uiTemp = inl(EP93XX_SYSCON_DEVICE_CONFIG); ++ uiTemp |= EP93XX_SYSCON_DEVCFG_U1E; ++ //uiTemp |= EP93XX_SYSCON_DEVCFG_U3E; ++ SysconSetLocked(EP93XX_SYSCON_DEVICE_CONFIG, uiTemp); ++ pDebugUART[0x10>>2] = 0xf; ++ pDebugUART[0xc>>2] = 0; ++ pDebugUART[0x8>>2] = 0x70; ++ pDebugUART[0x14>>2] = 0x1; ++ bUartInitialized = 1; ++ } ++ while (msg[index] != 0) ++ { ++ if (msg[index] == '\n') ++ { ++ SendChar('\r'); ++ SendChar('\n'); ++ } ++ else ++ { ++ SendChar(msg[index]); ++ } ++ index++; ++ } ++} ++#endif // UART_HACK_DEBUG ++ ++/* ++ * ep93xx_ts_isr ++ */ ++static irqreturn_t ep93xx_ts_isr(int irq, void *dev_id) ++{ ++ DPRINTK("isr\n"); ++ ++ // ++ // Note that we don't clear the interrupt here. The interrupt ++ // gets cleared in TS_Soft_Scan_Mode when the TS ENABLE ++ // bit is cleared. ++ // ++ ++ // ++ // Set the ts to manual polling mode and schedule a callback. ++ // That way we can return from the isr in a reasonable amount of ++ // time and process the touch in the callback after a brief delay. ++ // ++ TS_Soft_Scan_Mode(); ++ ++ return(IRQ_HANDLED); ++} ++ ++/* ++ * Save the current ts 'event' in an atomic fashion. ++ */ ++static void ee93xx_ts_evt_add( int buttons, int iX, int iY, int iPressure ) ++{ ++#ifdef PRINT_CALIBRATION_FACTORS ++ if( iX > iMaxX ) iMaxX = iX; ++ if( iX < iMinX ) iMinX = iX; ++ if( iY > iMaxY ) iMaxY = iY; ++ if( iY < iMinY ) iMinY = iY; ++#endif ++ ++ ++ // printk("ee93xx_ts_evt_add\n"); ++ //DPRINTK("cb\n"); ++ /* ++ * Note the event, but use spinlocks to keep it from getting ++ * halfway read if we get interrupted. ++ */ ++ ++ spin_lock(&event_buffer_lock); ++ gSample.currentX = iX; ++ gSample.currentY = iY; ++ gSample.currentButton = buttons; ++ gSample.currentPressure = iPressure; ++ bFreshTouchData = 1; ++ do_gettimeofday(&gSample.currentTime); ++ ++ ++ spin_unlock(&event_buffer_lock); ++ ++ kill_fasync(&ep93xx_fasync, SIGIO, POLL_IN); ++ wake_up_interruptible(&queue); ++ ++} ++ ++ ++static ssize_t ep93xx_ts_read(struct file *filp, char *buf, size_t count, loff_t *l) ++{ ++ ++ unsigned short data[3]; ++ struct ts_sample ts_data; ++ int iReturn = -EFAULT; ++ // printk("ep93xx_ts_read\n"); ++ ++#ifdef PRINT_CALIBRATION_FACTORS ++ static int lala=0; ++ if( bFreshTouchData && (lala++ > 9) ) ++ { ++ DPRINTK("%4d, %4d - range [%4d to %4d],[%4d to %4d]\n", ++ f, currentY, iMinX, iMaxX, iMinY, iMaxY ); ++ lala = 0; ++ } ++#endif ++ if( !bFreshTouchData) ++ { ++ iReturn = 0; ++ } ++ else if( (count == sizeof(data)) ) ++ { ++ spin_lock_irq(&event_buffer_lock); ++ bFreshTouchData = 0; ++ data[0] = gSample.currentX; ++ data[1] = gSample.currentY; ++ data[2] = gSample.currentButton; ++ ++ spin_unlock_irq(&event_buffer_lock); ++ ++ if (copy_to_user(buf, data, sizeof data)) ++ return -EFAULT; ++ ++ count -= sizeof(data); ++ ++ /* return the # of bytes that got read */ ++ iReturn = sizeof(data) ; ++ } ++ else if (count == sizeof(struct ts_sample) ) ++ { ++ spin_lock_irq(&event_buffer_lock); ++ bFreshTouchData = 0; ++ ts_data.x = gSample.currentX; ++ ts_data.y = gSample.currentY; ++ ts_data.pressure = gSample.currentPressure; ++ ts_data.tv = gSample.currentTime; ++ spin_unlock_irq(&event_buffer_lock); ++ ++ if (copy_to_user(buf, &ts_data, sizeof(struct ts_sample))) ++ { ++ iReturn = -EFAULT; ++ } ++ else ++ { ++ count -= sizeof(ts_data); ++ iReturn = sizeof(ts_data); ++ } ++ ++ } ++ ++ return iReturn; ++} ++ ++static unsigned int ep93xx_ts_poll(struct file *filp, poll_table *wait) ++{ ++ // printk("ep93xx_ts_poll\n"); ++ poll_wait(filp, &queue, wait); ++ ++ if( bFreshTouchData ) ++ { ++ return POLLIN | POLLRDNORM; ++ } ++ ++ return 0; ++} ++ ++static int ep93xx_ts_open(struct inode *inode, struct file *filp) ++{ ++ printk("ep93xx_ts_open"); ++ ++ if( down_trylock(&open_sem) ) ++ { ++ return -EBUSY; ++ } ++ ++ ep93xx_ts_setup(); ++ ++ return 0; ++} ++ ++/* ++ * Asynchronous I/O support. ++ */ ++static int ep93xx_ts_fasync(int fd, struct file *filp, int on) ++{ ++ int retval; ++ ++ retval = fasync_helper(fd, filp, on, &ep93xx_fasync); ++ if (retval < 0) ++ { ++ return retval; ++ } ++ ++ return 0; ++} ++ ++static int ep93xx_ts_release(struct inode *inode, struct file *filp) ++{ ++ Stop_Timer2(); ++ ++ /* ++ * Call our async I/O support to request that this file ++ * cease to be used for async I/O. ++ */ ++ ep93xx_ts_fasync(-1, filp, 0); ++ ++ ep93xx_ts_shutdown(); ++ ++ up(&open_sem); ++ ++ return 0; ++} ++ ++static ssize_t ep93xx_ts_write(struct file *file, const char *buffer, size_t count, ++ loff_t *ppos) ++{ ++ return -EINVAL; ++} ++ ++ ++static int ep93xx_ts_ioctl(struct inode *inode, struct file *file, uint command, ulong u) ++{ ++ static const int version = EV_VERSION; ++ static const u_int32_t bit =(1 << EV_ABS); ++ static const u_int32_t absbit = (1 << ABS_X) | (1 << ABS_Y) | (1 << ABS_PRESSURE); ++ int iReturn ; ++ int i = 0; ++ ++ switch(command) ++ { ++ case EVIOCGVERSION: ++ DPRINTK("ep93xx_ts_ioctl command = EVIOCGVERSION\r\n"); ++ i = copy_to_user((void __user *)u, (void *)version, sizeof(version)); ++ iReturn = i ? -EFAULT : 0; ++ break; ++ ++ case EVIOCGBIT(0,sizeof(u_int32_t) * 8) : ++ DPRINTK("ep93xx_ts_ioctl command = EVIOCGBIT(0,sizeof(uint32) * 8)\r\n"); ++ i = copy_to_user((void __user *)u, (void *)bit, sizeof(bit)); ++ iReturn = i ? -EFAULT : 0; ++ break; ++ ++ case EVIOCGBIT(EV_ABS, sizeof(absbit) * 8): ++ DPRINTK("ep93xx_ts_ioctl command = EVIOCGBIT(0,sizeof(uint32) * 8)\r\n"); ++ copy_to_user((void __user *)u, (void *)absbit, sizeof(absbit)); ++ iReturn = i ? -EFAULT : 0; ++ break; ++ default: ++ DPRINTK(" ep93xx_ts_ioctl unknown command = %d\n",u); ++ iReturn = -1; ++ break; ++ } ++ ++ return iReturn; ++} ++ ++static struct file_operations ep93xx_ts_fops = { ++ owner: THIS_MODULE, ++ read: ep93xx_ts_read, ++ write: ep93xx_ts_write, ++ poll: ep93xx_ts_poll, ++ open: ep93xx_ts_open, ++ ioctl: ep93xx_ts_ioctl, ++ release: ep93xx_ts_release, ++ fasync: ep93xx_ts_fasync, ++}; ++ ++static struct miscdevice ep93xx_ts_miscdev = ++{ ++ EP93XX_TS_MINOR, ++ "ep93xx_ts", ++ &ep93xx_ts_fops ++}; ++ ++void ep93xx_ts_setup(void) ++{ ++ unsigned int uiKTDIV, uiTSXYMaxMin; ++ // printk("ep93xx_hw_setup\n"); ++ ++ /* ++ * Set the TSEN bit in KTDIV so that we are enabling the clock ++ * for the touchscreen. ++ */ ++ uiKTDIV = inl(SYSCON_KTDIV); ++ uiKTDIV |= SYSCON_KTDIV_TSEN; ++ SysconSetLocked( SYSCON_KTDIV, uiKTDIV ); ++ ++ // ++ // Program the TSSetup and TSSetup2 registers. ++ // ++ outl( TSSETUP_DEFAULT, TSSetup ); ++ outl( TSSETUP2_DEFAULT, TSSetup2 ); ++ ++ // ++ // Set the the touch settings. ++ // ++ outl( 0xaa, TSSWLock ); ++ outl( sSwitchSettings.uiDischarge, TSDirect ); ++ ++ outl( 0xaa, TSSWLock ); ++ outl( sSwitchSettings.uiDischarge, TSDischarge ); ++ ++ outl( 0xaa, TSSWLock ); ++ outl( sSwitchSettings.uiSwitchZ1, TSXSample ); ++ ++ outl( 0xaa, TSSWLock ); ++ outl( sSwitchSettings.uiSwitchZ2, TSYSample ); ++ ++ outl( 0xaa, TSSWLock ); ++ outl( sSwitchSettings.uiDetect, TSDetect ); ++ ++ // ++ // X,YMin set to 0x40 = have to drag that many pixels for a new irq. ++ // X,YMax set to 0x40 = 1024 pixels is the maximum movement within the ++ // time scan limit. ++ // ++ uiTSXYMaxMin = (50 << TSMAXMIN_XMIN_SHIFT) & TSMAXMIN_XMIN_MASK; ++ uiTSXYMaxMin |= (50 << TSMAXMIN_YMIN_SHIFT) & TSMAXMIN_YMIN_MASK; ++ uiTSXYMaxMin |= (0xff << TSMAXMIN_XMAX_SHIFT) & TSMAXMIN_XMAX_MASK; ++ uiTSXYMaxMin |= (0xff << TSMAXMIN_YMAX_SHIFT) & TSMAXMIN_YMAX_MASK; ++ outl( uiTSXYMaxMin, TSXYMaxMin ); ++ ++ bCurrentPenDown = 0; ++ bFreshTouchData = 0; ++ guiLastX = 0; ++ guiLastY = 0; ++ guiLastInvPressure = 0xffffff; ++ ++ // ++ // Enable the touch screen scanning engine. ++ // ++ TS_Hardware_Scan_Mode(); ++} ++ ++/* ++ * ep93xx_ts_shutdown ++ * ++ */ ++static void ++ep93xx_ts_shutdown(void) ++{ ++ unsigned int uiKTDIV; ++ ++ DPRINTK("ep93xx_ts_shutdown\n"); ++ ++ sTouch.state = TS_STATE_STOPPED; ++ Stop_Timer2(); ++ ++ /* ++ * Disable the scanning engine. ++ */ ++ outl( 0, TSSetup ); ++ outl( 0, TSSetup2 ); ++ ++ /* ++ * Clear the TSEN bit in KTDIV so that we are disabling the clock ++ * for the touchscreen. ++ */ ++ uiKTDIV = inl(SYSCON_KTDIV); ++ uiKTDIV &= ~SYSCON_KTDIV_TSEN; ++ SysconSetLocked( SYSCON_KTDIV, uiKTDIV ); ++ ++} /* ep93xx_ts_shutdown */ ++ ++static irqreturn_t ep93xx_timer2_isr(int irq, void *dev_id) ++{ ++ DPRINTK("%d", (int)sTouch.state ); ++ ++ switch( sTouch.state ) ++ { ++ case TS_STATE_STOPPED: ++ TS_Hardware_Scan_Mode(); ++ break; ++ ++ // ++ // Get the Z1 value for pressure measurement and set up ++ // the switch register for getting the Z2 measurement. ++ // ++ case TS_STATE_Z1: ++ Set_Timer2_uSec( EP93XX_TS_ADC_DELAY_USEC ); ++ sTouch.uiZ1 = ADCGetData( 2, 200 ); ++ ep93xx_ts_set_direct( sSwitchSettings.uiSwitchZ2 ); ++ sTouch.state = TS_STATE_Z2; ++ break; ++ ++ // ++ // Get the Z2 value for pressure measurement and set up ++ // the switch register for getting the Y measurement. ++ // ++ case TS_STATE_Z2: ++ sTouch.uiZ2 = ADCGetData( 2, 200 ); ++ ep93xx_ts_set_direct( sSwitchSettings.uiYSample ); ++ sTouch.state = TS_STATE_Y; ++ break; ++ ++ // ++ // Get the Y value and set up the switch register for ++ // getting the X measurement. ++ // ++ case TS_STATE_Y: ++ sTouch.uiY = ADCGetData( 4, 20 ); ++ ep93xx_ts_set_direct( sSwitchSettings.uiXSample ); ++ sTouch.state = TS_STATE_X; ++ break; ++ ++ // ++ // Read the X value. This is the last of the 4 adc values ++ // we need so we continue on to process the data. ++ // ++ case TS_STATE_X: ++ Stop_Timer2(); ++ ++ sTouch.uiX = ADCGetData( 4, 20 ); ++ ++ outl( 0xaa, TSSWLock ); ++ outl( sSwitchSettings.uiDischarge, TSDirect ); ++ ++ sTouch.state = TS_STATE_DONE; ++ ++ /* ++ * Process this set of ADC readings. ++ */ ++ ProcessPointData(); ++ ++ break; ++ ++ ++ // ++ // Shouldn't get here. But if we do, we can recover... ++ // ++ case TS_STATE_DONE: ++ TS_Hardware_Scan_Mode(); ++ break; ++ } ++ ++ // ++ // Clear the timer2 interrupt. ++ // ++ outl( 1, TIMER2CLEAR ); ++ return(IRQ_HANDLED); ++} ++ ++/*--------------------------------------------------------------------- ++ * ProcessPointData ++ * ++ * This routine processes the ADC data into usable point data and then ++ * puts the driver into hw or sw scanning mode before returning. ++ * ++ * We calculate inverse pressure (lower number = more pressure) then ++ * do a hystheresis with the two pressure values 'light' and 'heavy'. ++ * ++ * If we are above the light, we have pen up. ++ * If we are below the heavy we have pen down. ++ * As long as the pressure stays below the light, pen stays down. ++ * When we get above the light again, pen goes back up. ++ * ++ */ ++static void ProcessPointData(void) ++{ ++ int bValidPoint = 0; ++ unsigned int uiXDiff, uiYDiff, uiInvPressureDiff; ++ unsigned int uiInvPressure; ++ ++ // ++ // Calculate the current pressure. ++ // ++ uiInvPressure = CalculateInvPressure(); ++ ++ DPRINTK(" X=0x%x, Y=0x%x, Z1=0x%x, Z2=0x%x, InvPressure=0x%x", ++ sTouch.uiX, sTouch.uiY, sTouch.uiZ1, sTouch.uiZ2, uiInvPressure ); ++ ++ // ++ // If pen pressure is so light that it is greater than the 'max' setting ++ // then we consider this to be a pen up. ++ // ++ if( uiInvPressure >= TS_LIGHT_INV_PRESSURE ) ++ { ++ DPRINTK(" -- up \n"); ++ bCurrentPenDown = 0; ++ ee93xx_ts_evt_add( 0, guiLastX, guiLastY, 0 ); ++ TS_Hardware_Scan_Mode(); ++ return; ++ } ++ ++ // ++ // Hystheresis: ++ // If the pen pressure is hard enough to be less than the 'min' OR ++ // the pen is already down and is still less than the 'max'... ++ // ++ if( (uiInvPressure < TS_HEAVY_INV_PRESSURE) || ++ ( bCurrentPenDown && (uiInvPressure < TS_LIGHT_INV_PRESSURE) ) ) ++ { ++ if( bCurrentPenDown ) ++ { ++ // ++ // If pen was previously down, check the difference between ++ // the last sample and this one... if the difference between ++ // samples is too great, ignore the sample. ++ // ++ uiXDiff = abs(guiLastX - sTouch.uiX); ++ uiYDiff = abs(guiLastY - sTouch.uiY); ++ uiInvPressureDiff = abs(guiLastInvPressure - uiInvPressure); ++ ++ if( (uiXDiff < TS_MAX_VALID_XY_CHANGE) && (uiYDiff < TS_MAX_VALID_XY_CHANGE) && ++ (uiInvPressureDiff < TS_MAX_VALID_PRESSURE_CHANGE) ) ++ { ++ DPRINTK(" -- valid(two) \n"); ++ bValidPoint = 1; ++ } ++ else ++ { ++ DPRINTK(" -- INvalid(two) \n"); ++ } ++ } ++ else ++ { ++ DPRINTK(" -- valid \n"); ++ bValidPoint = 1; ++ } ++ ++ /* ++ * If either the pen was put down or dragged make a note of it. ++ */ ++ if( bValidPoint ) ++ { ++ guiLastX = sTouch.uiX; ++ guiLastY = sTouch.uiY; ++ guiLastInvPressure = uiInvPressure; ++ bCurrentPenDown = 1; ++ ee93xx_ts_evt_add( 1, sTouch.uiX, sTouch.uiY, (0x7000000 /uiInvPressure) ); ++ } ++ ++ TS_Soft_Scan_Mode(); ++ return; ++ } ++ ++ DPRINTK(" -- fallout \n"); ++ TS_Hardware_Scan_Mode(); ++} ++ ++static void ep93xx_ts_set_direct( unsigned int uiADCSwitch ) ++{ ++ unsigned int uiResult; ++ ++ // ++ // Set the switch settings in the direct register. ++ // ++ outl( 0xaa, TSSWLock ); ++ outl( uiADCSwitch, TSDirect ); ++ ++ // ++ // Read and throw away the first sample. ++ // ++ do { ++ uiResult = inl(TSXYResult); ++ } while( !(uiResult & TSXYRESULT_SDR) ); ++ ++} ++ ++static unsigned int ADCGetData ++( ++ unsigned int uiSamples, ++ unsigned int uiMaxDiff ++) ++{ ++ unsigned int uiResult, uiValue, uiCount, uiLowest, uiHighest, uiSum, uiAve; ++ ++ do ++ { ++ // ++ //Initialize our values. ++ // ++ uiLowest = 0xfffffff; ++ uiHighest = 0; ++ uiSum = 0; ++ ++ for( uiCount = 0 ; uiCount < uiSamples ; uiCount++ ) ++ { ++ // ++ // Read the touch screen four more times and average. ++ // ++ do { ++ uiResult = inl(TSXYResult); ++ } while( !(uiResult & TSXYRESULT_SDR) ); ++ ++ uiValue = (uiResult & TSXYRESULT_AD_MASK) >> TSXYRESULT_AD_SHIFT; ++ uiValue = ((uiValue >> 4) + ((1 + TSXYRESULT_X_MASK)>>1)) & TSXYRESULT_X_MASK; ++ ++ // ++ // Add up the values. ++ // ++ uiSum += uiValue; ++ ++ // ++ // Get the lowest and highest values. ++ // ++ if( uiValue < uiLowest ) ++ { ++ uiLowest = uiValue; ++ } ++ if( uiValue > uiHighest ) ++ { ++ uiHighest = uiValue; ++ } ++ } ++ ++ } while( (uiHighest - uiLowest) > uiMaxDiff ); ++ ++ // ++ // Calculate the Average value. ++ // ++ uiAve = uiSum / uiSamples; ++ ++ return uiAve; ++} ++ ++//**************************************************************************** ++// CalculateInvPressure ++//**************************************************************************** ++// Is the Touch Valid. Touch is not valid if the X or Y value is not ++// in range and the pressure is not enough. ++// ++// Touch resistance can be measured by the following formula: ++// ++// Rx * X * Z2 ++// Rtouch = --------- * (-- - 1) ++// 4096 Z1 ++// ++// This is simplified in the ration of Rtouch to Rx. The lower the value, the ++// higher the pressure. ++// ++// Z2 ++// InvPressure = X * (-- - 1) ++// Z1 ++// ++static unsigned int CalculateInvPressure(void) ++{ ++ unsigned int uiInvPressure; ++ ++ // ++ // Check to see if the point is valid. ++ // ++ if( sTouch.uiZ1 < MIN_Z1_VALUE ) ++ { ++ uiInvPressure = 0x10000; ++ } ++ ++ // ++ // Can omit the pressure calculation if you need to get rid of the division. ++ // ++ else ++ { ++ uiInvPressure = ((sTouch.uiX * sTouch.uiZ2) / sTouch.uiZ1) - sTouch.uiX; ++ } ++ ++ return uiInvPressure; ++} ++ ++ ++ ++//**************************************************************************** ++// TS_Hardware_Scan_Mode ++//**************************************************************************** ++// Enables the ep93xx ts scanning engine so that when the pen goes down ++// we will get an interrupt. ++// ++// ++static void TS_Hardware_Scan_Mode(void) ++{ ++ unsigned int uiDevCfg; ++ ++ DPRINTK("S\n"); ++ ++ // ++ // Disable the soft scanning engine. ++ // ++ sTouch.state = TS_STATE_STOPPED; ++ Stop_Timer2(); ++ ++ // ++ // Clear the TIN (Touchscreen INactive) bit so we can go to ++ // automatic scanning mode. ++ // ++ uiDevCfg = inl( EP93XX_SYSCON_DEVICE_CONFIG ); ++ SysconSetLocked( EP93XX_SYSCON_DEVICE_CONFIG, (uiDevCfg & ~EP93XX_SYSCON_DEVCFG_TIN) ); ++ ++ // ++ // Enable the touch screen scanning state machine by setting ++ // the ENABLE bit. ++ // ++ outl( (TSSETUP_DEFAULT | TSSETUP_ENABLE), TSSetup ); ++ ++ // ++ // Set the flag to show that we are in interrupt mode. ++ // ++ gScanningMode = TS_MODE_HARDWARE_SCAN; ++ ++ // ++ // Initialize TSSetup2 register. ++ // ++ outl( TSSETUP2_DEFAULT, TSSetup2 ); ++ ++} ++ ++//**************************************************************************** ++// TS_Soft_Scan_Mode ++//**************************************************************************** ++// Sets the touch screen to manual polling mode. ++// ++// ++static void TS_Soft_Scan_Mode(void) ++{ ++ unsigned int uiDevCfg; ++ ++ DPRINTK("M\n"); ++ ++ if( gScanningMode != TS_MODE_SOFT_SCAN ) ++ { ++ // ++ // Disable the touch screen scanning state machine by clearing ++ // the ENABLE bit. ++ // ++ outl( TSSETUP_DEFAULT, TSSetup ); ++ ++ // ++ // Set the TIN bit so we can do manual touchscreen polling. ++ // ++ uiDevCfg = inl(EP93XX_SYSCON_DEVICE_CONFIG ); ++ SysconSetLocked( EP93XX_SYSCON_DEVICE_CONFIG, (uiDevCfg | EP93XX_SYSCON_DEVCFG_TIN) ); ++ } ++ ++ // ++ // Set the switch register up for the first ADC reading ++ // ++ ep93xx_ts_set_direct( sSwitchSettings.uiSwitchZ1 ); ++ ++ // ++ // Initialize our software state machine to know which ADC ++ // reading to take ++ // ++ sTouch.state = TS_STATE_Z1; ++ ++ // ++ // Set the timer so after a mSec or two settling delay it will ++ // take the first ADC reading. ++ // ++ Set_Timer2_uSec( EP93XX_TS_PER_POINT_DELAY_USEC ); ++ ++ // ++ // Note that we are in sw scanning mode not hw scanning mode. ++ // ++ gScanningMode = TS_MODE_SOFT_SCAN; ++ ++} ++ ++static void Set_Timer2_uSec( unsigned int uiDelay_uSec ) ++{ ++ unsigned int uiClockTicks; ++ ++ /* ++ * Stop timer 2 ++ */ ++ outl( 0, TIMER2CONTROL ); ++ ++ uiClockTicks = ((uiDelay_uSec * 508) + 999) / 1000; ++ outl( uiClockTicks, TIMER2LOAD ); ++ outl( uiClockTicks, TIMER2VALUE ); ++ ++ /* ++ * Set up Timer 2 for 508 kHz clock and periodic mode. ++ */ ++ outl( 0xC8, TIMER2CONTROL ); ++ ++} ++ ++static void Stop_Timer2(void) ++{ ++ outl( 0, TIMER2CONTROL ); ++} ++ ++/* ++ * Initialization and exit routines ++ */ ++int __init ep93xx_ts_init(void) ++{ ++ int retval; ++ ++ //printk("ep93xx_ts_init\n"); ++ ++ // printk("request Touchscreen interrupt.\n"); ++ retval = request_irq( IRQ_EP93XX_TOUCH, ep93xx_ts_isr, IRQF_DISABLED, "ep93xx_ts", 0); ++ if( retval ) ++ { ++ printk(KERN_WARNING "ep93xx_ts: failed to get touchscreen IRQ\n"); ++ return retval; ++ } ++ ++ // printk("Request Timer interrupt.\n"); ++ retval = request_irq( IRQ_EP93XX_TIMER2, ep93xx_timer2_isr, ++ IRQF_DISABLED, "ep93xx_timer2", 0); ++ if( retval ) ++ { ++ printk(KERN_WARNING "ep93xx_ts: failed to get timer2 IRQ\n"); ++ return retval; ++ } ++ ++ // printk("Register Touchscreen Driver\n"); ++ misc_register(&ep93xx_ts_miscdev); ++ ++ sTouch.state = TS_STATE_STOPPED; ++ gScanningMode = TS_MODE_UN_INITIALIZED; ++ ++ printk(KERN_NOTICE "ep93xx touchscreen driver configured for 4-wire operation\n"); ++ ++ return 0; ++} ++void __exit ++ep93xx_ts_exit(void) ++{ ++ DPRINTK("ep93xx_ts_exit\n"); ++ ++ Stop_Timer2(); ++ ++ free_irq(IRQ_EP93XX_TOUCH, 0); ++ free_irq(IRQ_EP93XX_TIMER2, 0); ++ ++ misc_deregister(&ep93xx_ts_miscdev); ++} ++ ++module_init(ep93xx_ts_init); ++module_exit(ep93xx_ts_exit); ++ ++MODULE_DESCRIPTION("Cirrus EP93xx touchscreen driver"); ++MODULE_SUPPORTED_DEVICE("touchscreen/ep93xx"); +Index: linux-2.6.30.9/drivers/input/touchscreen/ep93xx_ts.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.30.9/drivers/input/touchscreen/ep93xx_ts.h 2009-11-24 21:00:45.000000000 +0100 +@@ -0,0 +1,53 @@ ++/* ++ * ep93xx_ts.h ++ * ++ * The contents of this file are subject to the Mozilla Public License ++ * Version 1.1 (the "License"); you may not use this file except in ++ * compliance with the License. You may obtain a copy of the License ++ * at http://www.mozilla.org/MPL/ ++ * ++ * Software distributed under the License is distributed on an "AS IS" ++ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See ++ * the License for the specific language governing rights and ++ * limitations under the License. ++ * ++ * The initial developer of the original code is David A. Hinds ++ * . Portions created by David A. Hinds ++ * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. ++ * ++ * Alternatively, the contents of this file may be used under the ++ * terms of the GNU General Public License version 2 (the "GPL"), in ++ * which case the provisions of the GPL are applicable instead of the ++ * above. If you wish to allow the use of your version of this file ++ * only under the terms of the GPL and not to allow others to use ++ * your version of this file under the MPL, indicate your decision by ++ * deleting the provisions above and replace them with the notice and ++ * other provisions required by the GPL. If you do not delete the ++ * provisions above, a recipient may use your version of this file ++ * under either the MPL or the GPL. ++ */ ++ ++#ifndef _LINUX_EP93XX_TS_H ++#define _LINUX_EP93XX_TS_H ++ ++/*touchscreen register defines*/ ++#define SYSCON_KTDIV EP93XX_SYSCON_KEY_TOUCH_CLOCK_DIV ++#define SYSCON_SWLOCK EP93XX_SYSCON_SWLOCK ++#define TSSetup EP93XX_TOUCHSCREEN_TSSetup ++#define TSXYMaxMin EP93XX_TOUCHSCREEN_TSXYMaxMin ++#define TSXYResult EP93XX_TOUCHSCREEN_TSDischarge ++#define TSDischarge EP93XX_TOUCHSCREEN_TSDischarge ++#define TSXSample EP93XX_TOUCHSCREEN_TSXSample ++#define TSYSample EP93XX_TOUCHSCREEN_TSYSample ++#define TSDirect EP93XX_TOUCHSCREEN_TSDirect ++#define TSDetect EP93XX_TOUCHSCREEN_TSDetect ++#define TSSWLock EP93XX_TOUCHSCREEN_TSSWLock ++#define TSSetup2 EP93XX_TOUCHSCREEN_TSSetup2 ++ ++ ++//#define SYSCON_DEVCFG EP93XX_SYSCON_DEVICE_CONFIG ++#define TIMER2CONTROL EP93XX_TIMER2_CONTROL ++#define TIMER2LOAD EP93XX_TIMER2_LOAD ++#define TIMER2VALUE EP93XX_TIMER2_VALUE ++#define TIMER2CLEAR EP93XX_TIMER2_CLEAR ++#endif +Index: linux-2.6.30.9/arch/arm/mach-ep93xx/include/mach/hardware.h +=================================================================== +--- linux-2.6.30.9.orig/arch/arm/mach-ep93xx/include/mach/hardware.h 2009-11-24 21:00:18.000000000 +0100 ++++ linux-2.6.30.9/arch/arm/mach-ep93xx/include/mach/hardware.h 2009-11-24 21:09:21.000000000 +0100 +@@ -7,6 +7,7 @@ + #include "ep93xx-regs.h" + + #define pcibios_assign_all_busses() 0 ++#include "regs_touch.h" + + #include "platform.h" + +Index: linux-2.6.30.9/arch/arm/mach-ep93xx/include/mach/regs_touch.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.30.9/arch/arm/mach-ep93xx/include/mach/regs_touch.h 2009-11-24 21:00:45.000000000 +0100 +@@ -0,0 +1,95 @@ ++/*============================================================================= ++ * ++ * FILE: regs_touch.h ++ * ++ * DESCRIPTION: Analog Touchscreen Register Definition ++ * ++ * Copyright Cirrus Logic, 2001-2003 ++ * ++ * 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 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ *============================================================================= ++ */ ++#ifndef _REGS_TOUCH_H_ ++#define _REGS_TOUCH_H_ ++ ++/* ++ *----------------------------------------------------------------------------- ++ * Individual bit #defines ++ *----------------------------------------------------------------------------- ++ */ ++#define TSSETUP_SDLY_MASK 0x000003FF ++#define TSSETUP_SDLY_SHIFT 0 ++#define TSSETUP_NSMP_4 0x00000000 ++#define TSSETUP_NSMP_8 0x00000400 ++#define TSSETUP_NSMP_16 0x00000800 ++#define TSSETUP_NSMP_32 0x00000C00 ++#define TSSETUP_NSMP_MASK 0x00000C00 ++#define TSSETUP_DEV_4 0x00000000 ++#define TSSETUP_DEV_8 0x00001000 ++#define TSSETUP_DEV_12 0x00002000 ++#define TSSETUP_DEV_16 0x00003000 ++#define TSSETUP_DEV_24 0x00004000 ++#define TSSETUP_DEV_32 0x00005000 ++#define TSSETUP_DEV_64 0x00006000 ++#define TSSETUP_DEV_128 0x00007000 ++#define TSSETUP_ENABLE 0x00008000 ++#define TSSETUP_DLY_MASK 0x03FF0000 ++#define TSSETUP_DLY_SHIFT 16 ++#define TSSETUP_TDTCT 0x80000000 ++ ++#define TSMAXMIN_XMIN_MASK 0x000000FF ++#define TSMAXMIN_XMIN_SHIFT 0 ++#define TSMAXMIN_YMIN_MASK 0x0000FF00 ++#define TSMAXMIN_YMIN_SHIFT 8 ++#define TSMAXMIN_XMAX_MASK 0x00FF0000 ++#define TSMAXMIN_XMAX_SHIFT 16 ++#define TSMAXMIN_YMAX_MASK 0xFF000000 ++#define TSMAXMIN_YMAX_SHIFT 24 ++ ++#define TSXYRESULT_X_MASK 0x00000FFF ++#define TSXYRESULT_X_SHIFT 0 ++#define TSXYRESULT_AD_MASK 0x0000FFFF ++#define TSXYRESULT_AD_SHIFT 0 ++#define TSXYRESULT_Y_MASK 0x0FFF0000 ++#define TSXYRESULT_Y_SHIFT 16 ++#define TSXYRESULT_SDR 0x80000000 ++ ++#define TSX_SAMPLE_MASK 0x00003FFF ++#define TSX_SAMPLE_SHIFT 0x00 ++#define TSY_SAMPLE_MASK 0x3FFF0000 ++#define TSY_SAMPLE_SHIFT 0x10 ++ ++#define TSSETUP2_TINT 0x00000001 ++#define TSSETUP2_NICOR 0x00000002 ++#define TSSETUP2_PINT 0x00000004 ++#define TSSETUP2_PENSTS 0x00000008 ++#define TSSETUP2_PINTEN 0x00000010 ++#define TSSETUP2_DEVINT 0x00000020 ++#define TSSETUP2_DINTEN 0x00000040 ++#define TSSETUP2_DTMEN 0x00000080 ++#define TSSETUP2_DISDEV 0x00000100 ++#define TSSETUP2_NSIGND 0x00000200 ++#define TSSETUP2_S28EN 0x00000400 ++#define TSSETUP2_RINTEN 0x00000800 ++ ++#define TSXYRESULT_SDR 0x80000000 ++ ++/* ++ *----------------------------------------------------------------------------- ++ *----------------------------------------------------------------------------- ++ */ ++ ++ ++#endif /* _REGS_TOUCH_H_ */ diff --git a/target/linux/ep93xx/patches-2.6.30/007-ep93xx-eth.patch b/target/linux/ep93xx/patches-2.6.30/007-ep93xx-eth.patch new file mode 100644 index 000000000..cd715bfaf --- /dev/null +++ b/target/linux/ep93xx/patches-2.6.30/007-ep93xx-eth.patch @@ -0,0 +1,405 @@ +--- /dev/null ++++ b/drivers/net/arm/ep93xx_eth.h +@@ -0,0 +1,402 @@ ++/*------------------------------------------------------------------------ ++ * ep93xx_eth.h ++ * : header file of Ethernet Device Driver for Cirrus Logic EP93xx. ++ * ++ * Copyright (C) 2003 by Cirrus Logic www.cirrus.com ++ * This software may be used and distributed according to the terms ++ * of the GNU Public License. ++ * ++ * This file contains device related information like register info ++ * and register access method macros for the Ethernet device ++ * embedded within Cirrus Logic's EP93xx SOC chip. ++ * ++ * Information contained in this file was obtained from ++ * the EP9312 Manual Revision 0.12 and 0.14 from Cirrus Logic. ++ * ++ * History ++ * 05/18/01 Sungwook Kim Initial release ++ * 03/25/2003 Melody Modified for EP92xx ++ *--------------------------------------------------------------------------*/ ++ ++ ++#ifndef _EP9213_ETH_H_ ++#define _EP9213_ETH_H_ ++ ++ ++/*--------------------------------------------------------------- ++ * Definition of H/W Defects and Their Workarounds ++ *-------------------------------------------------------------*/ ++ ++ ++ ++/*--------------------------------------------------------------- ++ * Data types used in this driver ++ *-------------------------------------------------------------*/ ++typedef unsigned char U8; ++typedef unsigned short U16; ++typedef unsigned long U32; ++typedef unsigned int UINT; ++ ++ ++ ++/*--------------------------------------------------------------- ++ * Definition of the registers. ++ * For details, refer to the datasheet . ++ * ++ * Basically, most registers are 32 bits width register. ++ * But some are 16 bits and some are 6 or 8 bytes long. ++ *-------------------------------------------------------------*/ ++ ++#define REG_RxCTL 0x0000 /*offset to Receiver Control Reg*/ ++#define RxCTL_PauseA (1<<20) ++#define RxCTL_RxFCE1 (1<<19) ++#define RxCTL_RxFCE0 (1<<18) ++#define RxCTL_BCRC (1<<17) ++#define RxCTL_SRxON (1<<16) ++#define RxCTL_RCRCA (1<<13) ++#define RxCTL_RA (1<<12) ++#define RxCTL_PA (1<<11) ++#define RxCTL_BA (1<<10) ++#define RxCTL_MA (1<<9) ++#define RxCTL_IAHA (1<<8) ++#define RxCTL_IA3 (1<<3) ++#define RxCTL_IA2 (1<<2) ++#define RxCTL_IA1 (1<<1) ++#define RxCTL_IA0 (1<<0) ++ ++#define REG_TxCTL 0x0004 /*offset to Transmit Control Reg*/ ++#define TxCTL_DefDis (1<<7) ++#define TxCTL_MBE (1<<6) ++#define TxCTL_ICRC (1<<5) ++#define TxCTL_TxPD (1<<5) ++#define TxCTL_OColl (1<<3) ++#define TxCTL_SP (1<<2) ++#define TxCTL_PB (1<<1) ++#define TxCTL_STxON (1<<0) ++ ++#define REG_TestCTL 0x0008 /*Test Control Reg, R/W*/ ++#define TestCTL_MACF (1<<7) ++#define TestCTL_MFDX (1<<6) ++#define TestCTL_DB (1<<5) ++#define TestCTL_MIIF (1<<4) ++ ++#define REG_MIICmd 0x0010 /*offset to MII Command Reg, R/W*/ ++#define MIICmd_OP (0x03<<14) ++#define MIICmd_OP_RD (2<<14) ++#define MIICmd_OP_WR (1<<14) ++#define MIICmd_PHYAD (0x1f<<5) ++#define MIICmd_REGAD (0x1f<<0) ++ ++#define REG_MIIData 0x0014 /*offset to MII Data Reg, R/W*/ ++#define MIIData_MIIData (0xffff<<0) ++ ++#define REG_MIISts 0x0018 /*offset to MII Status Reg, R*/ ++#define MIISts_Busy (1<<0) ++ ++#define REG_SelfCTL 0x0020 /*offset to Self Control Reg*/ ++#define SelfCTL_RWP (1<<7) /*Remote Wake Pin*/ ++#define SelfCTL_GPO0 (1<<5) ++#define SelfCTL_PUWE (1<<4) ++#define SelfCTL_PDWE (1<<3) ++#define SelfCTL_MIIL (1<<2) ++#define SelfCTL_RESET (1<<0) ++ ++#define REG_IntEn 0x0024 /*Interrupt Enable Reg, R/W*/ ++#define IntEn_RWIE (1<<30) ++#define IntEn_RxMIE (1<<29) ++#define IntEn_RxBIE (1<<28) ++#define IntEn_RxSQIE (1<<27) ++#define IntEn_TxLEIE (1<<26) ++#define IntEn_ECIE (1<<25) ++#define IntEn_TxUHIE (1<<24) ++#define IntEn_MOIE (1<<18) ++#define IntEn_TxCOIE (1<<17) ++#define IntEn_RxROIE (1<<16) ++#define IntEn_MIIIE (1<<12) ++#define IntEn_PHYSIE (1<<11) ++#define IntEn_TIE (1<<10) ++#define IntEn_SWIE (1<<8) ++#define IntEn_TxSQIE (1<<3) ++#define IntEn_RxEOFIE (1<<2) ++#define IntEn_RxEOBIE (1<<1) ++#define IntEn_RxHDRIE (1<<0) ++ ++#define REG_IntStsP 0x0028 /*offset to Interrupt Status Preserve Reg, R/W*/ ++#define REG_IntStsC 0x002c /*offset to Interrupt Status Clear Reg, R*/ ++#define IntSts_RWI (1<<30) ++#define IntSts_RxMI (1<<29) ++#define IntSts_RxBI (1<<28) ++#define IntSts_RxSQI (1<<27) ++#define IntSts_TxLEI (1<<26) ++#define IntSts_ECI (1<<25) ++#define IntSts_TxUHI (1<<24) ++#define IntSts_MOI (1<<18) ++#define IntSts_TxCOI (1<<17) ++#define IntSts_RxROI (1<<16) ++#define IntSts_MIII (1<<12) ++#define IntSts_PHYSI (1<<11) ++#define IntSts_TI (1<<10) ++#define IntSts_AHBE (1<<9) ++#define IntSts_SWI (1<<8) ++#define IntSts_OTHER (1<<4) ++#define IntSts_TxSQ (1<<3) ++#define IntSts_RxSQ (1<<2) ++ ++#define REG_GT 0x0040 /*offset to General Timer Reg*/ ++#define GT_GTC (0xffff<<16) ++#define GT_GTP (0xffff<<0) ++ ++#define REG_FCT 0x0044 /*offset to Flow Control Timer Reg*/ ++#define FCT_FCT (0x00ffffff<<0) ++ ++#define REG_FCF 0x0048 /*offset to Flow Control Format Reg*/ ++#define FCF_MACCT (0xffff<<16) ++#define FCF_TPT (0xffff<<0) ++ ++#define REG_AFP 0x004c /*offset to Address Filter Pointer Reg*/ ++#define AFP_AFP (0x07<<0) /*Address Filter Pointer (bank control for REG_IndAD)*/ ++#define AFP_AFP_IA0 0 /*Primary Individual Address (MAC Addr)*/ ++#define AFP_AFP_IA1 1 /*Individual Address 1*/ ++#define AFP_AFP_IA2 2 /*Individual Address 2*/ ++#define AFP_AFP_IA3 3 /*Individual Address 3*/ ++#define AFP_AFP_DTxP 6 /*Destination Address of Tx Pause Frame*/ ++#define AFP_AFP_HASH 7 /*Hash Table*/ ++ ++#define REG_IndAD 0x0050 /*offset to Individual Address Reg, n bytes, R/W*/ ++ ++#define REG_GIntSts 0x0060 /*offset to Global Interrupt Status Reg (writing 1 will clear)*/ ++#define REG_GIntROS 0x0068 /*offset to Global Interrupt Status Read Only Reg*/ ++#define GIntSts_INT (1<<15) /*Global Interrupt Request Status*/ ++ ++#define REG_GIntMsk 0x0064 /*offset to Global Interrupt Mask Reg*/ ++#define GIntMsk_IntEn (1<<15) /*Global Interrupt Enable*/ ++ ++#define REG_GIntFrc 0x006c /*offset to Global Interrupt Force Reg*/ ++#define GIntFrc_INT (1<<15) /*Force to set GIntSts*/ ++ ++#define REG_TxCollCnt 0x0070 /*Transmit Collision Count Reg, R*/ ++#define REG_RxMissCnt 0x0074 /*Receive Miss Count Reg, R*/ ++#define REG_RxRntCnt 0x0078 /*Receive Runt Count Reg, R*/ ++ ++#define REG_BMCtl 0x0080 /*offset to Bus Master Control Reg, R/W*/ ++#define BMCtl_MT (1<<13) ++#define BMCtl_TT (1<<12) ++#define BMCtl_UnH (1<<11) ++#define BMCtl_TxChR (1<<10) ++#define BMCtl_TxDis (1<<9) ++#define BMCtl_TxEn (1<<8) ++#define BMCtl_EH2 (1<<6) ++#define BMCtl_EH1 (1<<5) ++#define BMCtl_EEOB (1<<4) ++#define BMCtl_RxChR (1<<2) ++#define BMCtl_RxDis (1<<1) ++#define BMCtl_RxEn (1<<0) ++ ++#define REG_BMSts 0x0084 /*offset to Bus Master Status Reg, R*/ ++#define BMSts_TxAct (1<<7) ++#define BMSts_TP (1<<4) ++#define BMSts_RxAct (1<<3) ++#define BMSts_QID (0x07<<0) ++#define BMSts_QID_RxDt (0<<0) ++#define BMSts_QID_TxDt (1<<0) ++#define BMSts_QID_RxSts (2<<0) ++#define BMSts_QID_TxSts (3<<0) ++#define BMSts_QID_RxDesc (4<<0) ++#define BMSts_QID_TxDesc (5<<0) ++ ++#define REG_RBCA 0x0088 /*offset to Receive Buffer Current Address Reg, R*/ ++#define REG_TBCA 0x008c /*offset to Transmit Buffer Current Address Reg, R*/ ++ ++#define REG_RxDBA 0x0090 /*offset to Receive Descriptor Queue Base Address Reg, R/W*/ ++#define REG_RxDBL 0x0094 /*offset to Receive Descriptor Queue Base Length Reg, R/W, 16bits*/ ++#define REG_RxDCL 0x0096 /*offset to Receive Descriptor Queue Current Length Reg, R/W, 16bits*/ ++#define REG_RxDCA 0x0098 /*offset to Receive Descriptor Queue Current Address Reg, R/W*/ ++ ++#define REG_RxDEQ 0x009c /*offset to Receive Descriptor Enqueue Reg, R/W*/ ++#define RxDEQ_RDV (0xffff<<16) /*R 16bit; Receive Descriptor Value*/ ++#define RxDEQ_RDI (0xff<<0) /*W 8bit; Receive Descriptor Increment*/ ++ ++#define REG_RxSBA 0x00a0 /*offset to Receive Status Queue Base Address Reg, R/W*/ ++#define REG_RxSBL 0x00a4 /*offset to Receive Status Queue Base Length Reg, R/W, 16bits*/ ++#define REG_RxSCL 0x00a6 /*offset to Receive Status Queue Current Length Reg, R/W, 16bits*/ ++#define REG_RxSCA 0x00a8 /*offset to Receive Status Queue Current Address Reg, R/W*/ ++ ++#define REG_RxSEQ 0x00ac /*offset to Receive Status Queue Current Address Reg, R/W*/ ++#define RxSEQ_RSV (0xffff<<16) ++#define RxSEQ_RSI (0xff<<0) ++ ++#define REG_TxDBA 0x00b0 /*offset to Transmit Descriptor Queue Base Address Reg, R/W*/ ++#define REG_TxDBL 0x00b4 /*offset to Transmit Descriptor Queue Base Length Reg, R/W, 16bits*/ ++#define REG_TxDCL 0x00b6 /*offset to Transmit Descriptor Queue Current Length Reg, R/W, 16bits*/ ++#define REG_TxDCA 0x00b8 /*offset to Transmit Descriptor Queue Current Address Reg, R/W*/ ++ ++#define REG_TxDEQ 0x00bc /*offset to Transmit Descriptor Queue Current Address Reg, R/W*/ ++#define TxDEQ_TDV (0xffff<<16) ++#define TxDEQ_TDI (0xff<<0) ++ ++#define REG_TxSBA 0x00c0 /*offset to Transmit Status Queue Base Address Reg, R/W*/ ++#define REG_TxSBL 0x00c4 /*offset to Transmit Status Queue Base Length Reg, R/W, 16bits*/ ++#define REG_TxSCL 0x00c6 /*offset to Transmit Status Queue Current Length Reg, R/W, 16bits*/ ++#define REG_TxSCA 0x00c8 /*offset to Transmit Status Queue Current Address Reg, R/W*/ ++ ++#define REG_RxBTH 0x00d0 /*offset to Receive Buffer Threshold Reg, R/W*/ ++#define RxBTH_RDHT (0x03ff<<16) ++#define RxBTH_RDST (0x03ff<<0) ++ ++#define REG_TxBTH 0x00d4 /*offset to Transmit Buffer Threshold Reg, R/W*/ ++#define TxBTH_TDHT (0x03ff<<16) ++#define TxBTH_TDST (0x03ff<<0) ++ ++#define REG_RxSTH 0x00d8 /*offset to Receive Status Threshold Reg, R/W*/ ++#define RxSTH_RSHT (0x003f<<16) ++#define RxSTH_RSST (0x003f<<0) ++ ++#define REG_TxSTH 0x00dc /*offset to Transmit Status Threshold Reg, R/W*/ ++#define TxSTH_TSHT (0x003f<<16) ++#define TxSTH_TSST (0x003f<<0) ++ ++#define REG_RxDTH 0x00e0 /*offset to Receive Descriptor Threshold Reg, R/W*/ ++#define RxDTH_RDHT (0x003f<<16) ++#define RxDTH_RDST (0x003f<<0) ++ ++#define REG_TxDTH 0x00e4 /*offset to Transmit Descriptor Threshold Reg, R/W*/ ++#define TxDTH_TDHT (0x003f<<16) ++#define TxDTH_TDST (0x003f<<0) ++ ++#define REG_MaxFL 0x00e8 /*offset to Max Frame Length Reg, R/W*/ ++#define MaxFL_MFL (0x07ff<<16) ++#define MaxFL_TST (0x07ff<<0) ++ ++#define REG_RxHL 0x00ec /*offset to Receive Header Length Reg, R/W*/ ++#define RxHL_RHL2 (0x07ff<<16) ++#define RxHL_RHL1 (0x03ff<<0) ++ ++#define REG_MACCFG0 0x0100 /*offset to Test Reg #0, R/W*/ ++#define MACCFG0_DbgSel (1<<7) ++#define MACCFG0_LCKEN (1<<6) ++#define MACCFG0_LRATE (1<<5) ++#define MACCFG0_RXERR (1<<4) ++#define MACCFG0_BIT33 (1<<2) ++#define MACCFG0_PMEEN (1<<1) ++#define MACCFG0_PMEST (1<<0) ++ ++#define REG_MACCFG1 0x0104 /*offset to Test Reg #1, R/W*/ ++#define REG_MACCFG2 0x0108 /*offset to Test Reg #2, R*/ ++#define REG_MACCFG3 0x010c /*offset to Test Reg #3, R*/ ++ ++ ++ ++/*--------------------------------------------------------------- ++ * Definition of Descriptor/Status Queue Entry ++ *-------------------------------------------------------------*/ ++ ++typedef union receiveDescriptor { /*data structure of Receive Descriptor Queue Entry*/ ++ struct { /*whole value*/ ++ U32 e0, /*1st dword entry*/ ++ e1; /*2nd dword entry*/ ++ } w; ++ struct { /*bit field definitions*/ ++ U32 ba:32, /*Buffer Address (keep in mind this is physical address)*/ ++ bl:16, /*b15-0; Buffer Length*/ ++ bi:15, /*b30-16; Buffer Index*/ ++ nsof:1; /*b31; Not Start Of Frame*/ ++ } f; ++} receiveDescriptor; ++ ++ ++typedef union receiveStatus { /*data structure of Receive Status Queue Entry*/ ++ struct { /*whole word*/ ++ U32 e0, /*1st dword entry*/ ++ e1; /*2nd dword entry*/ ++ } w; ++ struct { /*bit field*/ ++ U32 rsrv1:8, /*b7-0: reserved*/ ++ hti:6, /*b13-8: Hash Table Index*/ ++ rsrv2:1, /*b14: reserved*/ ++ crci:1, /*b15: CRC Included*/ ++ crce:1, /*b16: CRC Error*/ ++ edata:1, /*b17: Extra Data*/ ++ runt:1, /*b18: Runt Frame*/ ++ fe:1, /*b19: Framing Error*/ ++ oe:1, /*b20: Overrun Error*/ ++ rxerr:1, /*b21: Rx Error*/ ++ am:2, /*b23-22: Address Match*/ ++ rsrv3:4, /*b27-24: reserved*/ ++ eob:1, /*b28: End Of Buffer*/ ++ eof:1, /*b29: End Of Frame*/ ++ rwe:1, /*b30: Received Without Error*/ ++ rfp:1, /*b31: Receive Frame Processed*/ ++ fl:16, /*b15-0: frame length*/ ++ bi:15, /*b30-16: Buffer Index*/ ++ rfp2:1; /*b31: Receive Frame Processed at 2nd word*/ ++ } f; ++} receiveStatus; ++ ++ ++typedef union transmitDescriptor { /*data structure of Transmit Descriptor Queue Entry*/ ++ struct { /*whole value*/ ++ U32 e0, /*1st dword entry*/ ++ e1; /*2nd dword entry*/ ++ } w; ++ struct { /*bit field*/ ++ U32 ba:32, /*b31-0: Buffer Address (keep in mind this is physical address)*/ ++ bl:12, /*b11-0: Buffer Length*/ ++ rsrv1:3, /*b14-12: reserved*/ ++ af:1, /*b15: Abort Frame*/ ++ bi:15, /*b30-16: Buffer Index*/ ++ eof:1; /*b31: End Of Frame*/ ++ ++ } f; ++} transmitDescriptor; ++ ++ ++typedef union transmitStatus { /*data structure of Transmit Status Queue Entry*/ ++ struct { /*whole word*/ ++ U32 e0; /*1st dword entry*/ ++ } w; ++ struct { /*bit field*/ ++ U32 bi:15, /*b14-0: Buffer Index*/ ++ rsrv3:1, /*b15: reserved*/ ++ ncoll:5, /*b20-16: Number of Collisions*/ ++ rsrv2:3, /*b23-21: reserved*/ ++ ecoll:1, /*b24: Excess Collisions*/ ++ txu:1, /*b25: Tx Underrun*/ ++ ow:1, /*b26: Out of Window*/ ++ rsrv1:1, /*b27: reserved*/ ++ lcrs:1, /*b28: Loss of CRS*/ ++ fa:1, /*b29: Frame Abort*/ ++ txwe:1, /*b30: Transmitted Without Error*/ ++ txfp:1; /*b31: Transmit Frame Processed*/ ++ } f; ++} transmitStatus; ++ ++ ++ ++/*--------------------------------------------------------------- ++ * Size of device registers occupied in memory/IO address map ++ *-------------------------------------------------------------*/ ++#define DEV_REG_SPACE 0x00010000 ++ ++/* ++#define U8 unsigned char ++#define U16 unsigned short ++#define U32 unsigned long ++*/ ++ ++/*--------------------------------------------------------------- ++ * A definition of register access macros ++ *-------------------------------------------------------------*/ ++#define _RegRd(type,ofs) (*(volatile type*)(ofs)) ++#define _RegWr(type,ofs,dt) *(volatile type*)(ofs)=((type)(dt)) ++ ++#define RegRd8(ofs) _RegRd(U8,(char*)pD->base_addr+(ofs)) ++#define RegRd16(ofs) _RegRd(U16,(char*)pD->base_addr+(ofs)) ++#define RegRd32(ofs) _RegRd(U32,(char*)pD->base_addr+(ofs)) ++#define RegWr8(ofs,dt) _RegWr(U8,(char*)pD->base_addr+(ofs),(dt)) ++#define RegWr16(ofs,dt) _RegWr(U16,(char*)pD->base_addr+(ofs),(dt)) ++#define RegWr32(ofs,dt) _RegWr(U32,(char*)pD->base_addr+(ofs),(dt)) ++ ++ ++ ++#endif /* _EP9213_ETH_H_ */ ++ diff --git a/target/linux/ep93xx/patches-2.6.30/008-ep93xx-spi.patch b/target/linux/ep93xx/patches-2.6.30/008-ep93xx-spi.patch new file mode 100644 index 000000000..8292bbcf1 --- /dev/null +++ b/target/linux/ep93xx/patches-2.6.30/008-ep93xx-spi.patch @@ -0,0 +1,714 @@ +Index: linux-2.6.30.9/drivers/spi/Kconfig +=================================================================== +--- linux-2.6.30.9.orig/drivers/spi/Kconfig 2009-11-24 21:09:23.000000000 +0100 ++++ linux-2.6.30.9/drivers/spi/Kconfig 2009-11-24 21:09:53.000000000 +0100 +@@ -125,6 +125,12 @@ + + If unsure, say N. + ++config SPI_EP93XX ++ tristate "EP93xx SSP SPI master" ++ depends on SPI_MASTER && ARCH_EP93XX && EXPERIMENTAL ++ help ++ This enables the EP93xx SPI master controller. ++ + config SPI_IMX + tristate "Freescale iMX SPI controller" + depends on ARCH_IMX && EXPERIMENTAL +Index: linux-2.6.30.9/drivers/spi/Makefile +=================================================================== +--- linux-2.6.30.9.orig/drivers/spi/Makefile 2009-11-24 21:09:23.000000000 +0100 ++++ linux-2.6.30.9/drivers/spi/Makefile 2009-11-24 21:09:53.000000000 +0100 +@@ -16,6 +16,7 @@ + obj-$(CONFIG_SPI_BITBANG) += spi_bitbang.o + obj-$(CONFIG_SPI_AU1550) += au1550_spi.o + obj-$(CONFIG_SPI_BUTTERFLY) += spi_butterfly.o ++obj-$(CONFIG_SPI_EP93XX) += spi_ep93xx.o + obj-$(CONFIG_SPI_GPIO) += spi_gpio.o + obj-$(CONFIG_SPI_GPIO_OLD) += spi_gpio_old.o + obj-$(CONFIG_SPI_IMX) += spi_imx.o +Index: linux-2.6.30.9/drivers/spi/spi_ep93xx.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.30.9/drivers/spi/spi_ep93xx.c 2009-11-24 21:21:25.000000000 +0100 +@@ -0,0 +1,680 @@ ++/* ++ * linux/drivers/spi/spi_ep93xx.c ++ * ++ * Copyright (C) 2007 Manfred Gruber ++ * Small changes by Peter Ivanov to support MMC over SPI, 2008 ++ * SIM.ONE changes by Nuccio Raciti Simplemachine ++ * ++ * Based on pxa2xx_spi.c/spi_imx.c and bitbang.c driver ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include ++#include ++#include ++ ++/* #define SPI_EP93XX_DEBUG */ ++ ++#define DEFINE_SSP_REG(reg, off) \ ++ static inline u32 read_##reg(void *p) \ ++ { return __raw_readl(p + (off)); } \ ++ static inline void write_##reg(u32 v, void *p) \ ++ { __raw_writel(v, p + (off)); } ++ ++DEFINE_SSP_REG(SSPCR0, 0x00) ++DEFINE_SSP_REG(SSPCR1, 0x04) ++DEFINE_SSP_REG(SSPDR, 0x08) ++DEFINE_SSP_REG(SSPSR, 0x0c) ++DEFINE_SSP_REG(SSPCPSR, 0x10) ++DEFINE_SSP_REG(SSPIIR, 0x14) ++DEFINE_SSP_REG(SSPICR, 0x14) ++ ++/* Bits in SSPCR0 */ ++#define SSPCR0_DSS_MASK 0x0000000f ++#define SSPCR0_FRF_MASK 0x00000030 ++#define SSPCR0_FRF_SHIFT 4 ++#define SSPCR0_FRF_MOTOROLA (0 << SSPCR0_FRF_SHIFT) ++#define SSPCR0_FRF_TI (1 << SSPCR0_FRF_SHIFT) ++#define SSPCR0_FRF_NI (2 << SSPCR0_FRF_SHIFT) ++#define SSPCR0_SPO 0x00000040 ++#define SSPCR0_SPH 0x00000080 ++#define SSPCR0_SCR_MASK 0x0000ff00 ++#define SSPCR0_SCR_SHIFT 8 ++ ++/* Bits in SSPCR1 */ ++#define SSPC1_RIE 0x00000001 ++#define SSPC1_TIE 0x00000002 ++#define SSPC1_RORIE 0x00000004 ++#define SSPC1_LBM 0x00000008 ++#define SSPC1_SSE 0x00000010 ++#define SSPC1_MS 0x00000020 ++#define SSPC1_SOD 0x00000040 ++ ++/* Bits in SSPSR */ ++#define SSPSR_TFE 0x00000001 /* TX FIFO is empty */ ++#define SSPSR_TNF 0x00000002 /* TX FIFO is not full */ ++#define SSPSR_RNE 0x00000004 /* RX FIFO is not empty */ ++#define SSPSR_RFF 0x00000008 /* RX FIFO is full */ ++#define SSPSR_BSY 0x00000010 /* SSP is busy */ ++#define SSPSR_MASK 0x0000001F /* SSP is busy */ ++ ++/* Bits in SSPCPSR */ ++#define SSPCPSR_SCR_MASK 0x000000ff ++ ++/* Bits in SSPIIR */ ++#define SSPIIR_RIS 0x00000001 /* RX FIFO IRQ status */ ++#define SSPIIR_TIS 0x00000002 /* TX FIFO is not full */ ++#define SSPIIR_RORIS 0x00000004 /* RX FIFO is full */ ++ ++#define SPI_SSPCLK 7.4e6 ++#define SPI_SSPCLK_REV_E2 14.8e6 /* only for chip Rev E2 */ ++#define SPI_MAX_SPEED 3.7e6 ++#define SPI_MAX_SPEED_REV_E2 7.4e6 /* only for chip Rev E2 */ ++#define SPI_CPSDVR_DIV_MIN 2 ++#define SPI_CPSDVR_DIV_MAX 254 ++#define SPI_SCR_DIV_MIN 0 ++#define SPI_SCR_DIV_MAX 255 ++#define SPI_DATARATE_OK 0 ++#define SPI_DATARATE_NOK -1 ++ ++struct driver_data { ++ /* Driver model hookup */ ++ struct platform_device *pdev; ++ ++ /* SPI framework hookup */ ++ struct spi_master *master; ++ ++ /* SSP register addresses */ ++ void *ioaddr; ++ ++ /* SSP irq */ ++ int irq; ++ ++ struct list_head queue; ++ ++ /* SSP spinlock */ ++ spinlock_t lock; ++ ++ struct workqueue_struct *workqueue; ++ struct work_struct work; ++ ++ u8 busy; ++ u8 use_dma; ++}; ++ ++static unsigned ep93xx_txrx_8(struct spi_device *spi, struct spi_transfer *t) ++{ ++ struct driver_data *drv_data; ++ const u8 *tx = t->tx_buf; ++ u8 *rx = t->rx_buf; ++ unsigned count = t->len; ++ u8 byte; ++ int busy; ++ ++ drv_data = spi_master_get_devdata(spi->master); ++ ++#ifdef SPI_EP93XX_DEBUG ++ dev_info(&spi->dev, ++ "ep93xx_txrx_8: t->len %u \n", t->len); ++#endif ++ ++ while (likely(count > 0)) { ++ byte = 0; ++ if (tx) { ++ byte = *tx++; ++#ifdef SPI_EP93XX_DEBUG ++ dev_info(&spi->dev, ++ "ep93xx_txrx_8: write 0x%x \n", byte); ++#endif ++ } ++ ++ write_SSPDR(byte, drv_data->ioaddr); ++ busy = read_SSPSR(drv_data->ioaddr); ++ while (busy & SSPSR_BSY) { ++ cpu_relax(); ++ busy = read_SSPSR(drv_data->ioaddr); ++#ifdef SPI_EP93XX_DEBUG ++ dev_info(&spi->dev, ++ "ep93xx_txrx_8: delay. SSPSR: 0x%X\n", busy); ++#endif ++ } ++ byte = read_SSPDR(drv_data->ioaddr); ++ ++ if (rx) { ++ *rx++ = byte; ++#ifdef SPI_EP93XX_DEBUG ++ dev_info(&spi->dev, ++ "ep93xx_txrx_8: read 0x%x \n", byte); ++#endif ++ } ++ count -= 1; ++ } ++ return t->len - count; ++} ++ ++ ++static unsigned ep93xx_txrx_16(struct spi_device *spi, struct spi_transfer *t) ++{ ++ ++ struct driver_data *drv_data; ++ const u16 *tx = t->tx_buf; ++ u16 *rx = t->rx_buf; ++ unsigned count = t->len; ++ u16 word; ++ int busy; ++ ++ drv_data = spi_master_get_devdata(spi->master); ++ ++#ifdef SPI_EP93XX_DEBUG ++ dev_info(&spi->dev, ++ "ep93xx_txrx_16: t->len %u \n", t->len); ++#endif ++ while (likely(count > 0)) { ++ word = 0; ++ if (tx) { ++ word = *tx++; ++#ifdef SPI_EP93XX_DEBUG ++ dev_info(&spi->dev, ++ "ep93xx_txrx_16: write 0x%x \n", word); ++#endif ++ } ++ ++ write_SSPDR(word, drv_data->ioaddr); ++ busy = read_SSPSR(drv_data->ioaddr); ++ while (busy & SSPSR_BSY) { ++ cpu_relax(); ++ busy = read_SSPSR(drv_data->ioaddr); ++#ifdef SPI_EP93XX_DEBUG ++ dev_info(&spi->dev, ++ "ep93xx_txrx_8: delay.\n"); ++#endif ++ } ++ ++ word = read_SSPDR(drv_data->ioaddr); ++ ++ if (rx) { ++ *rx++ = word; ++#ifdef SPI_EP93XX_DEBUG ++ dev_info(&spi->dev, ++ "ep93xx_txrx_16: read 0x%x \n", word); ++#endif ++ } ++ count -= 2; ++ } ++ return t->len - count; ++} ++ ++static u32 spi_data_rate(u32 speed_hz, u32 *div_cpsdvr, u32 *div_scr, ++ struct driver_data *drv_data, struct spi_device *spi) ++{ ++ unsigned int spi_sspclk = SPI_SSPCLK; ++ unsigned int bus_speed_max = SPI_MAX_SPEED; ++ unsigned int bus_hz_tmp = 0; ++ u32 div_cpsdvr_tmp; ++ u32 div_scr_tmp; ++ u32 rv = SPI_DATARATE_NOK; ++ int chip_rev; ++ ++ /* Checking CHIP_ID */ ++ chip_rev = (__raw_readl (EP93XX_SYSCON_CHIP_ID) >> 28) & 0xF; ++ if (chip_rev == 7) ++ { ++ /* Chip version: Rev E2 */ ++ /* This device has double speed SSP clock */ ++ spi_sspclk = SPI_SSPCLK_REV_E2; ++ bus_speed_max = SPI_MAX_SPEED_REV_E2; ++#ifdef SPI_EP93XX_DEBUG ++ dev_info(&spi->dev, ++ "Chip Rev E2 detected! This device has double speed SSP clock.\n"); ++#endif ++ } ++ ++ *div_cpsdvr = SPI_CPSDVR_DIV_MAX; ++ *div_scr = SPI_SCR_DIV_MAX; ++ ++ for (div_cpsdvr_tmp = SPI_CPSDVR_DIV_MIN; ++ div_cpsdvr_tmp <= SPI_CPSDVR_DIV_MAX && rv; div_cpsdvr_tmp++) { ++ for (div_scr_tmp = SPI_SCR_DIV_MIN; ++ div_scr_tmp <= SPI_SCR_DIV_MAX && rv; div_scr_tmp++) { ++ bus_hz_tmp = spi_sspclk / (div_cpsdvr_tmp * (1 + div_scr_tmp)); ++ if (bus_hz_tmp <= speed_hz && bus_hz_tmp <= bus_speed_max) { ++ *div_cpsdvr = div_cpsdvr_tmp; ++ *div_scr = div_scr_tmp; ++ rv = SPI_DATARATE_OK; ++ } ++ } ++ } ++#ifdef SPI_EP93XX_DEBUG ++ dev_info(&spi->dev, ++ "Needed SPI bus frequency: %i Hz\n", speed_hz); ++ dev_info(&spi->dev, ++ "Actual SPI bus frequency: %i Hz\n", bus_hz_tmp); ++#endif ++ return rv; ++} ++ ++/* Supported modes (returns -EINVAL if not supported mode requested) */ ++#define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH) ++ ++static int ep93xx_spi_setup(struct spi_device *spi) ++{ ++ struct driver_data *drv_data; ++ u16 val; ++ u32 div_scr; ++ u32 div_cpsdvr; ++ unsigned int bits = spi->bits_per_word; ++ unsigned long speed_hz = spi->max_speed_hz; ++ ++ drv_data = spi_master_get_devdata(spi->master); ++ ++ /* enable SSP */ ++ write_SSPCR1(SSPC1_SSE, drv_data->ioaddr); ++ /* Enable SSP and loopback mode (only for testing!) */ ++ /* write_SSPCR1(SSPC1_SSE | SSPC1_LBM, drv_data->ioaddr); */ ++ ++ if (bits == 0) ++ bits = 8; ++ if (bits < 4 || bits > 16) { ++ dev_err(&spi->dev, ++ "setup invalid bits_per_word %u (4 to 16)\n", bits); ++ return -EINVAL; ++ } else { ++ val = read_SSPCR0(drv_data->ioaddr); ++ val = val & ~SSPCR0_DSS_MASK ; ++ val = val | (bits-1); ++ write_SSPCR0(val, drv_data->ioaddr); ++#ifdef SPI_EP93XX_DEBUG ++ dev_info (&spi->dev, "Bits per word: %i\n", bits); ++#endif ++ } ++ ++ if (spi->mode & ~MODEBITS) { ++ dev_err(&spi->dev, "unsupported mode bits: %x\n", ++ spi->mode & ~MODEBITS); ++ return -EINVAL; ++ } else { ++ val = read_SSPCR0(drv_data->ioaddr); ++ val = val & ~SSPCR0_SPO; ++ val = val & ~SSPCR0_SPH; ++ if (spi->mode & SPI_CPOL) ++ { ++ val = val | SSPCR0_SPO; ++ } ++#ifdef SPI_EP93XX_DEBUG ++ dev_info (&spi->dev, "Clock polarity (CPOL): %s\n", (spi->mode & SPI_CPHA) ? "1" : "0"); ++#endif ++ if (spi->mode & SPI_CPHA) ++ { ++ val = val | SSPCR0_SPH; ++ } ++#ifdef SPI_EP93XX_DEBUG ++ dev_info (&spi->dev, "Clock phase (CPHA): %s\n", (spi->mode & SPI_CPHA) ? "1" : "0"); ++#endif ++ write_SSPCR0(val, drv_data->ioaddr); ++ } ++ ++ if (SPI_DATARATE_OK == (spi_data_rate(speed_hz, &div_cpsdvr, ++ &div_scr, drv_data, spi))) { ++ ++ val = read_SSPCPSR(drv_data->ioaddr); ++ val = val & ~SSPCPSR_SCR_MASK; ++ val = val | div_cpsdvr; ++#ifdef SPI_EP93XX_DEBUG ++ dev_info (&spi->dev, "SSPCPSR: 0x%X\n", val); ++#endif ++ write_SSPCPSR(val, drv_data->ioaddr); ++ ++ val = read_SSPCR0(drv_data->ioaddr); ++ val = val & ~SSPCR0_SCR_MASK; ++ val = val | (div_scr << SSPCR0_SCR_SHIFT); ++#ifdef SPI_EP93XX_DEBUG ++ dev_info (&spi->dev, "SSPCR0: 0x%X (div_scr: 0x%X)\n", val, div_scr); ++#endif ++ write_SSPCR0(val, drv_data->ioaddr); ++ } else ++ return -EINVAL; ++ ++ /* reenable */ ++ val = read_SSPCR1(drv_data->ioaddr); ++ val = val & ~SSPC1_SSE; ++ write_SSPCR1(val, drv_data->ioaddr); ++ val = read_SSPCR1(drv_data->ioaddr); ++ val = val | SSPC1_SSE; ++ write_SSPCR1(val, drv_data->ioaddr); ++#ifdef SPI_EP93XX_DEBUG ++ dev_info (&spi->dev, "Loopback mode: %s\n", (val & SSPC1_LBM) ? "On" : "Off"); ++#endif ++ ++ return 0; ++} ++ ++static int ep93xx_spi_transfer(struct spi_device *spi, struct spi_message *m) ++{ ++ struct driver_data *drv_data; ++ unsigned long flags; ++ int status = 0; ++ ++ m->actual_length = 0; ++ m->status = -EINPROGRESS; ++ ++ drv_data = spi_master_get_devdata(spi->master); ++ ++ spin_lock_irqsave(&drv_data->lock, flags); ++ if (!spi->max_speed_hz) ++ status = -ENETDOWN; ++ else { ++ list_add_tail(&m->queue, &drv_data->queue); ++ queue_work(drv_data->workqueue, &drv_data->work); ++ } ++ spin_unlock_irqrestore(&drv_data->lock, flags); ++ return status; ++} ++ ++static void ep93xx_work(struct work_struct *work) ++{ ++ struct driver_data *drv_data = ++ container_of(work, struct driver_data, work); ++ unsigned long flags; ++ ++ spin_lock_irqsave(&drv_data->lock, flags); ++ drv_data->busy = 1; ++ ++ while (!list_empty(&drv_data->queue)) { ++ struct spi_message *m; ++ struct spi_device *spi; ++ struct spi_transfer *t = NULL; ++ int status; ++ ++ m = container_of(drv_data->queue.next, struct spi_message, ++ queue); ++ list_del_init(&m->queue); ++ spin_unlock_irqrestore(&drv_data->lock, flags); ++ ++ spi = m->spi; ++ status = 0; ++ ++ list_for_each_entry(t, &m->transfers, transfer_list) { ++ ++ if (!t->tx_buf && !t->rx_buf && t->len) { ++ status = -EINVAL; ++ break; ++ } ++ ++ if (t->len) { ++ if (!m->is_dma_mapped) { ++ t->rx_dma = 0; ++ t->tx_dma = 0; ++ } ++ if (t->bits_per_word <= 8) ++ status = ep93xx_txrx_8(spi, t); ++ else ++ status = ep93xx_txrx_16(spi, t); ++ } ++ ++ if (status != t->len) { ++ if (status > 0) ++ status = -EMSGSIZE; ++ break; ++ } ++ m->actual_length += status; ++ status = 0; ++ ++ /* protocol tweaks before next transfer */ ++ if (t->delay_usecs) ++ udelay(t->delay_usecs); ++ ++ if (t->transfer_list.next == &m->transfers) ++ break; ++ } ++ ++ m->status = status; ++ m->complete(m->context); ++ ++ spin_lock_irqsave(&drv_data->lock, flags); ++ } ++ drv_data->busy = 0; ++ spin_unlock_irqrestore(&drv_data->lock, flags); ++} ++ ++static irqreturn_t ssp_int(int irq, void *dev_id) ++{ ++ struct driver_data *drv_data = dev_id; ++ u8 status; ++ status = read_SSPIIR(drv_data->ioaddr); ++ ++ if (status & SSPIIR_RORIS) { ++ dev_err(&drv_data->pdev->dev, "SPI rx overrun.\n"); ++ ++ /* We clear the overrun here ! */ ++ write_SSPICR(0, drv_data->ioaddr); ++ } ++ ++ /* RX interrupt */ ++ if (status & SSPIIR_RIS) ++ dev_info(&drv_data->pdev->dev, "SPI RX interrupt\n"); ++ ++ /* TX interrupt */ ++ if (status & SSPIIR_TIS) ++ dev_info(&drv_data->pdev->dev, "SPI TX interrupt\n"); ++ ++ write_SSPICR(0, drv_data->ioaddr); ++ return IRQ_HANDLED; ++} ++ ++static int __init ep93xx_spi_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct spi_master *master; ++ struct driver_data *drv_data = 0; ++ struct resource *memory_resource; ++ int status = 0; ++ u16 val; ++ ++ /* Allocate master with space for drv_data and null dma buffer */ ++ master = spi_alloc_master(dev, sizeof(struct driver_data)); ++ if (!master) { ++ dev_err(&pdev->dev, "cannot alloc spi_master\n"); ++ return -ENOMEM; ++ } ++ drv_data = spi_master_get_devdata(master); ++ drv_data->master = master; ++ drv_data->pdev = pdev; ++ ++ master->num_chipselect = EP93XX_GPIO_LINE_H(7) + 1; ++ master->bus_num = pdev->id; ++ master->setup = ep93xx_spi_setup; ++ master->transfer = ep93xx_spi_transfer; ++ ++ spin_lock_init(&drv_data->lock); ++ INIT_LIST_HEAD(&drv_data->queue); ++ ++ /* Setup register addresses */ ++ memory_resource = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (!memory_resource) { ++ dev_err(&pdev->dev, "memory resources not defined\n"); ++ status = -EIO; ++ goto out_error_master_alloc; ++ } else { ++ drv_data->ioaddr = ioremap(memory_resource->start, ++ memory_resource->end - memory_resource->start); ++ if (drv_data->ioaddr == NULL) { ++ dev_err(&pdev->dev, "ioremap failed\n"); ++ status = -EIO; ++ goto out_error_master_alloc; ++ } ++ } ++ ++ /* Attach to IRQ */ ++ drv_data->irq = platform_get_irq(pdev, 0); ++ if (drv_data->irq < 0) ++ return drv_data->irq; ++ ++ if (drv_data->irq <= 0) { ++ dev_err(&pdev->dev, "IRQ resource not defined\n"); ++ status = -ENODEV; ++ goto out_error_master_alloc; ++ } ++ ++ status = request_irq(drv_data->irq, ssp_int, 0, "ep93xx-spi", drv_data); ++ if (status < 0) { ++ dev_err(&pdev->dev, "cannot get SPI IRQ 0\n"); ++ goto out_error_master_alloc; ++ } ++ ++ /* SSP default configuration, enable */ ++ write_SSPCR1(SSPC1_SSE, drv_data->ioaddr); ++ ++ /* run as master */ ++ val = read_SSPCR1(drv_data->ioaddr); ++ val = val & ~SSPC1_MS; ++ write_SSPCR1(val, drv_data->ioaddr); ++ ++ /* frame format to Motorola SPI Format */ ++ val = read_SSPCR0(drv_data->ioaddr); ++ val = val & ~SSPCR0_FRF_MASK ; ++ val = val | SSPCR0_FRF_MOTOROLA; ++ write_SSPCR0(val, drv_data->ioaddr); ++ ++ /* enable interrupts */ ++ val = read_SSPCR1(drv_data->ioaddr); ++ /* for now only overrun is handled */ ++ /* val = val | SSPC1_RIE | SSPC1_TIE | SSPC1_RORIE; */ ++ val = val | SSPC1_RORIE; ++ write_SSPCR1(val, drv_data->ioaddr); ++ ++ /* SSP default configuration, re enable */ ++ val = read_SSPCR1(drv_data->ioaddr); ++ val = val & ~SSPC1_SSE; ++ write_SSPCR1(val, drv_data->ioaddr); ++ val = read_SSPCR1(drv_data->ioaddr); ++ val = val | SSPC1_SSE; ++ write_SSPCR1(val, drv_data->ioaddr); ++ ++ /* Register with the SPI framework */ ++ platform_set_drvdata(pdev, drv_data); ++ status = spi_register_master(master); ++ if (status != 0) { ++ dev_err(&pdev->dev, "cannot register SPI master\n"); ++ goto out_error_master_alloc; ++ } else ++ dev_info(&pdev->dev, "SPI Controller initalized\n"); ++ ++ INIT_WORK(&drv_data->work, ep93xx_work); ++ spin_lock_init(&drv_data->lock); ++ INIT_LIST_HEAD(&drv_data->queue); ++ ++ /* this task is the only thing to touch the SPI bits */ ++ drv_data->busy = 0; ++ drv_data->workqueue = create_singlethread_workqueue( ++ dev_name(drv_data->master->dev.parent)); ++/* drv_data->master->cdev.dev->bus_id); */ ++ if (drv_data->workqueue == NULL) { ++ status = -EBUSY; ++ goto out_error_free_irq; ++ } ++ ++ return status; ++ ++out_error_free_irq: ++ free_irq(drv_data->irq, master); ++out_error_master_alloc: ++ if (drv_data->ioaddr != NULL) ++ iounmap(drv_data->ioaddr); ++ spi_master_put(master); ++ return status; ++} ++ ++static int __exit ep93xx_spi_remove(struct platform_device *pdev) ++{ ++ struct driver_data *drv_data = platform_get_drvdata(pdev); ++ u8 val; ++ ++ WARN_ON(!list_empty(&drv_data->queue)); ++ ++ destroy_workqueue(drv_data->workqueue); ++ ++ /* switch off SSP*/ ++ val = read_SSPCR1(drv_data->ioaddr); ++ val = val & ~SSPC1_SSE; ++ write_SSPCR1(val, drv_data->ioaddr); ++ ++ /* release irqs */ ++ if (drv_data->irq > 0) ++ free_irq(drv_data->irq, drv_data); ++ ++ /* Disconnect from the SPI framework */ ++ spi_unregister_master(drv_data->master); ++ spi_master_put(drv_data->master); ++ ++ if (drv_data->ioaddr != NULL) ++ iounmap(drv_data->ioaddr); ++ ++ /* Prevent double remove */ ++ platform_set_drvdata(pdev, NULL); ++ return 0; ++} ++ ++#ifdef CONFIG_PM ++static int ep93xx_spi_suspend(struct platform_device *pdev, pm_message_t msg) ++{ ++ return 0; ++} ++ ++static int ep93xx_spi_resume(struct platform_device *pdev) ++{ ++ return 0; ++} ++ ++#else ++#define ep93xx_spi_suspend NULL ++#define ep93xx_spi_resume NULL ++#endif ++ ++struct platform_driver ep93xx_spi_device = { ++ .remove = __exit_p(ep93xx_spi_remove), ++#ifdef CONFIG_PM ++ .suspend = ep93xx_spi_suspend, ++ .resume = ep93xx_spi_resume, ++#endif ++ .driver = { ++ .name = "ep93xx-spi", ++ .bus = &spi_bus_type, ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++int __init ep93xx_spi_init(void) ++{ ++ return platform_driver_probe(&ep93xx_spi_device, ep93xx_spi_probe); ++} ++ ++void __exit ep93xx_spi_exit(void) ++{ ++ platform_driver_unregister(&ep93xx_spi_device); ++} ++ ++module_init(ep93xx_spi_init); ++module_exit(ep93xx_spi_exit); ++ ++MODULE_DESCRIPTION("EP93XX SPI Driver"); ++MODULE_AUTHOR("Manfred Gruber, "); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/ep93xx/patches-2.6.30/009-ep93xx-fb.patch b/target/linux/ep93xx/patches-2.6.30/009-ep93xx-fb.patch new file mode 100644 index 000000000..d7816bd72 --- /dev/null +++ b/target/linux/ep93xx/patches-2.6.30/009-ep93xx-fb.patch @@ -0,0 +1,3565 @@ +--- a/drivers/video/Kconfig ++++ b/drivers/video/Kconfig +@@ -255,6 +255,25 @@ config FB_CIRRUS + Say N unless you have such a graphics board or plan to get one + before you next recompile the kernel. + ++config FB_EP93XX ++ tristate "EP93xx frame buffer support" ++ depends on FB ++ select FB_CFB_FILLRECT ++ select FB_CFB_COPYAREA ++ select FB_CFB_IMAGEBLIT ++ help ++ This is the frame buffer device driver for the internal raster engine ++ on certain members of the EP93xx family. For VGA and LCD output. ++ ++config FB_EP93XX_MONO ++ tristate "EP93xx Mono frame buffer support" ++ depends on FB ++ select FB_CFB_FILLRECT ++ select FB_CFB_COPYAREA ++ help ++ This is the frame buffer device driver for the internal raster engine ++ on certain members of the EP93xx family. For LCD output. ++ + config FB_PM2 + tristate "Permedia2 support" + depends on FB && ((AMIGA && BROKEN) || PCI) +--- a/drivers/video/Makefile ++++ b/drivers/video/Makefile +@@ -95,6 +95,8 @@ obj-$(CONFIG_FB_ARMCLCD) += amba-clcd. + obj-$(CONFIG_FB_68328) += 68328fb.o + obj-$(CONFIG_FB_GBE) += gbefb.o + obj-$(CONFIG_FB_CIRRUS) += cirrusfb.o ++obj-$(CONFIG_FB_EP93XX) += ep93xxfb.o ++obj-$(CONFIG_FB_EP93XX_MONO) += ep93xxfb_mono.o + obj-$(CONFIG_FB_ASILIANT) += asiliantfb.o + obj-$(CONFIG_FB_PXA) += pxafb.o + obj-$(CONFIG_FB_W100) += w100fb.o +--- /dev/null ++++ b/drivers/video/ep93xxfb.c +@@ -0,0 +1,1628 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "ep93xxfb.h" ++#include ++#include ++ ++#include "console/fbcon.h" ++ ++ ++#if defined(CONFIG_MACH_EDB9312) || defined(CONFIG_MACH_EDB9315) || defined(CONFIG_MACH_EDB9307) || defined(CONFIG_MACH_EDB9301) || defined(CONFIG_MACH_EDB9302) ++#define CONFIG_EP93XX_SDCS3 ++#else ++#define CONFIG_EP93XX_SDCS0 ++#endif ++ ++//#define DEBUG 1 ++#ifdef DEBUG ++#define DPRINTK( fmt, arg... ) printk( fmt, ##arg ) ++#else ++#define DPRINTK( fmt, arg... ) ++#endif ++ ++#define FBDEV_NAME "ep93xxfb" ++ ++#define ep93xxfb_outl(value, reg) \ ++{ \ ++ outl(RASTER_SWLOCK_VALUE, RASTER_SWLOCK); \ ++ outl(value, reg); \ ++} ++ ++#define DEFAULT_OUT CRT_OUT ++#define DEFAULT_MODE 7 ++#define DEFAULT_BPP 24 ++ ++static DECLARE_WAIT_QUEUE_HEAD(ep93xxfb_wait_in); ++ ++static unsigned int pseudo_palette[256]; ++static unsigned long *cursor_data = NULL; ++static struct ep93xxfb_info epinfo; ++ ++static int vout = DEFAULT_OUT; ++static int vmode = DEFAULT_MODE; ++static int depth = DEFAULT_BPP; ++ ++ ++static int ep93xxfb_setcol(struct fb_info *info, int bpp); ++ ++ ++static struct ep93xxfb_videomodes ep93xxfb_vmods[] = { ++ { ++ "Philips-LB064V02-640x480x60", ++ 640, 24, 96, 40, 480, 10, 2, 33, 60, ++ CLK_INTERNAL, EDGE_FALLING, POL_LOW, POL_LOW, POL_LOW, ++ }, ++ { // 1 ++ "CRT-640x480-60", ++ 640, 24, 96, 40, 480, 11, 2, 32, 60, ++ CLK_INTERNAL, EDGE_RISING, POL_LOW, POL_LOW, POL_LOW, ++ }, ++ { // 2 ++ "CRT-640x480-72", ++ 640, 40, 40, 144, 480, 8, 3, 30, 72, ++ CLK_INTERNAL, EDGE_RISING, POL_LOW, POL_LOW, POL_LOW, ++ }, ++ { // 3 ++ "CRT-640x480-75", ++ 640, 16, 76, 120, 480, 1, 3, 16, 75, ++ CLK_INTERNAL, EDGE_RISING, POL_LOW, POL_LOW, POL_LOW, ++ }, ++ { // 4 ++ "CRT-640x480-85", ++ 640, 56, 56, 80, 480, 1, 3, 25, 85, ++ CLK_INTERNAL, EDGE_RISING, POL_LOW, POL_LOW, POL_LOW, ++ }, ++ { // 5 ++ "CTR-640x480-100", ++ 640, 32, 96, 96, 480, 8, 6, 36, 100, ++ CLK_INTERNAL, EDGE_RISING, POL_LOW, POL_LOW, POL_LOW, ++ }, ++ { // 6 ++ "CRT-800x600-56", ++ 800, 24, 72, 128, 600, 1, 2, 22, 56, ++ CLK_INTERNAL, EDGE_RISING, POL_LOW, POL_LOW, POL_LOW, ++ }, ++ { // 7 ++ "CRT-800x600-60", ++ 800, 40, 128, 88, 600, 1, 4, 23, 60, ++ CLK_INTERNAL, EDGE_RISING, POL_LOW, POL_HIGH, POL_HIGH, ++ }, ++ { // 8 ++ "CRT-800x600-72", ++ 800, 56, 120, 64, 600, 37, 6, 23, 72, ++ CLK_INTERNAL, EDGE_RISING, POL_LOW, POL_LOW, POL_LOW, ++ }, ++ { // 9 ++ "CRT-800x600-85", ++ 800, 64, 64, 160, 600, 16, 5, 36, 85, ++ CLK_INTERNAL, EDGE_RISING, POL_LOW, POL_LOW, POL_LOW, ++ }, ++ { // 10 ++ "CRT-800x600-100", ++ 800, 64, 64, 160, 600, 4, 6, 30, 100, ++ CLK_INTERNAL, EDGE_RISING, POL_LOW, POL_LOW, POL_LOW, ++ }, ++ { // 11 ++ "CRT-1024x768-60", ++ 1024, 8, 144, 168, 768, 3, 6, 29, 60, ++ CLK_INTERNAL, EDGE_RISING, POL_LOW, POL_LOW, POL_LOW, ++ }, ++ { // 12 ++ "CRT-1024x768-70", ++ 1024, 24, 136, 144, 768, 3, 6, 29, 70, ++ CLK_INTERNAL, EDGE_RISING, POL_LOW, POL_LOW, POL_LOW, ++ }, ++ { // 13 ++ "CRT-1024x768-75", ++ 1024, 16, 96, 176, 768, 1, 3, 28, 75, ++ CLK_INTERNAL, EDGE_RISING, POL_LOW, POL_HIGH, POL_HIGH, ++ }, ++ { // 14 ++ "CRT-1024x768-85", ++ 1024, 48, 96, 208, 768, 1, 3, 36, 85, ++ CLK_INTERNAL, EDGE_RISING, POL_LOW, POL_HIGH, POL_HIGH, ++ }, ++ { // 15 ++ "CRT-1280x720-60", ++ 1280, 48, 112, 248, 720, 1, 3, 38, 60, ++ CLK_INTERNAL, EDGE_RISING, POL_LOW, POL_HIGH, POL_HIGH, ++ } ++}; ++ ++static void philips_lb064v02_on(unsigned char value) ++{ ++ DPRINTK("philips_lb064v02_on \n"); ++ outl(inl(GPIO_PADDR) | 2, GPIO_PADDR); ++ outl(inl(GPIO_PADR) | 2, GPIO_PADR); ++} ++ ++static void philips_lb064v02_off(unsigned char value) ++{ ++ DPRINTK("philips_lb064v02_off \n"); ++ outl(inl(GPIO_PADR) & ~2, GPIO_PADR); ++} ++ ++static irqreturn_t ep93xxfb_irq_handler(int i, void *blah) ++{ ++ outl(0x00000000, BLOCKCTRL); ++ wake_up(&ep93xxfb_wait_in); ++ return IRQ_HANDLED; ++} ++ ++static void ep93xxfb_wait(void) ++{ ++ DECLARE_WAITQUEUE(wait, current); ++ add_wait_queue(&ep93xxfb_wait_in, &wait); ++ set_current_state(TASK_UNINTERRUPTIBLE); ++ ++ while (inl(BLOCKCTRL) & 0x00000001){ ++ if(/*(pls_proba==1)&&*/(!in_atomic())) ++ schedule(); ++ } ++ ++ remove_wait_queue(&ep93xxfb_wait_in, &wait); ++ set_current_state(TASK_RUNNING); ++ ++} ++ ++void ep93xxfb_fillrect(struct fb_info *p, const struct fb_fillrect *fill) ++{ ++ unsigned long blkdestwidth,tmp; ++ ++ if (!fill->width || !fill->height || ++ (fill->dx >= p->var.xres) || ++ (fill->dy >= p->var.yres) || ++ ((fill->dx + fill->width - 1) >= p->var.xres) || ++ ((fill->dy + fill->height - 1) >= p->var.yres)) ++ return; ++ ++ tmp = (( fill->dx + fill->width ) * epinfo.bpp ); ++ blkdestwidth = tmp / 32; ++ if(blkdestwidth > 0 && (tmp % 32 == 0)) ++ blkdestwidth--; ++ blkdestwidth = blkdestwidth - (fill->dx * epinfo.bpp) / 32; ++ ++ outl(fill->color, BLOCKMASK); ++ outl( ((fill->dx * epinfo.bpp) & 0x1F) | ++ ((((fill->dx + fill->width - 1) * epinfo.bpp ) & 0x1F) << 16), ++ DESTPIXELSTRT); ++ outl( ((epinfo.xres * epinfo.bpp) / 32), DESTLINELENGTH); ++ outl( blkdestwidth, BLKDESTWIDTH ); ++ outl(fill->height - 1, BLKDESTHEIGHT); ++ outl((epinfo.fb_phys + (fill->dy * epinfo.xres * epinfo.bpp ) / 8 + ++ (fill->dx * epinfo.bpp ) / 8 ) ++ , BLKDSTSTRT); ++ outl( epinfo.pixformat | 0x0000000B, BLOCKCTRL); ++ ep93xxfb_wait(); ++ ++} ++ ++void ep93xxfb_copyarea(struct fb_info *p, const struct fb_copyarea *area) ++{ ++ unsigned long startsx,stopsx,startdx,stopdx,startsy,startdy; ++ unsigned long blksrcwidth,blkdestwidth,tmp; ++ unsigned long val = 0; ++ ++ if( !area->width || !area->width || ++ (area->sx >= p->var.xres) || (area->sy >= p->var.yres) || ++ (area->dx >= p->var.xres) || (area->dy >= p->var.yres) || ++ ((area->dx + area->width - 1) >= p->var.xres) || ++ ((area->dy + area->height - 1) >= p->var.yres)) ++ return; ++ ++ if(area->sx == area->dx && area->sy == area->dy) ++ return; ++ ++ if ((area->dy == area->sy) && (area->dx > area->sx) && ++ (area->dx < (area->sx + area->width - 1))) { ++ startdx = area->dx + area->width - 1; ++ stopdx = area->dx; ++ startsx = area->sx + area->width - 1; ++ stopsx = area->sx; ++ val |= 0x000000A0; ++ } ++ else { ++ startdx = area->dx; ++ stopdx = area->dx + area->width - 1; ++ startsx = area->sx; ++ stopsx = area->sx + area->width - 1; ++ } ++ ++ if (area->dy <= area->sy) { ++ startdy = area->dy; ++ startsy = area->sy; ++ } ++ else { ++ startdy = area->dy + area->height -1; ++ startsy = area->sy + area->height -1; ++ val |= 0x00000140; ++ } ++ ++ tmp = (( area->sx + area->width ) * epinfo.bpp ); ++ blksrcwidth = tmp / 32; ++ if(blksrcwidth > 0 && (tmp % 32 == 0)) ++ blksrcwidth--; ++ blksrcwidth = blksrcwidth - (area->sx * epinfo.bpp) / 32; ++ ++ tmp = (( area->dx + area->width ) * epinfo.bpp ); ++ blkdestwidth = tmp / 32; ++ if(blkdestwidth > 0 && (tmp % 32 == 0)) ++ blkdestwidth--; ++ blkdestwidth = blkdestwidth - (area->dx * epinfo.bpp) / 32; ++ ++ outl( 0x00000000 , BLOCKCTRL); ++ ++ /*** src ***/ ++ outl((((startsx * epinfo.bpp) & 0x1F) | ++ (((stopsx * epinfo.bpp ) & 0x1F) << 16)) ++ , SRCPIXELSTRT); ++ outl((epinfo.fb_phys + (startsy * epinfo.xres * epinfo.bpp ) / 8 + ++ (startsx * epinfo.bpp ) / 8 ) ++ , BLKSRCSTRT); ++ outl(((epinfo.xres * epinfo.bpp) / 32), SRCLINELENGTH); ++ outl( blksrcwidth, BLKSRCWIDTH ); ++ ++ /*** dest ***/ ++ outl((((startdx * epinfo.bpp) & 0x1F) | ++ (((stopdx * epinfo.bpp ) & 0x1F) << 16)) ++ , DESTPIXELSTRT); ++ outl((epinfo.fb_phys + (startdy * epinfo.xres * epinfo.bpp ) / 8 + ++ (startdx * epinfo.bpp ) / 8 ) ++ , BLKDSTSTRT); ++ outl( ((epinfo.xres * epinfo.bpp) / 32), DESTLINELENGTH); ++ outl( blkdestwidth, BLKDESTWIDTH); ++ outl( area->height - 1 , BLKDESTHEIGHT); ++ outl( epinfo.pixformat | val | 0x00000003, BLOCKCTRL); ++ ep93xxfb_wait(); ++} ++ ++void ep93xxfb_imageblit(struct fb_info *p, const struct fb_image *image) ++{ ++// unsigned long blkdestwidth,tmp; ++// void * pucBlitBuf; ++ cfb_imageblit( p , image ); ++ return; ++/* ++ if ((image->dx >= p->var.xres) || ++ (image->dy >= p->var.yres) || ++ ((image->dx + image->width - 1) >= p->var.xres) || ++ ((image->dy + image->height - 1) >= p->var.yres)) ++ return; ++ if (epinfo.bpp != image->depth ) ++ return; ++ ++ tmp = (( image->dx + image->width ) * epinfo.bpp ); ++ blkdestwidth = tmp / 32; ++ if(blkdestwidth > 0 && (tmp % 32 == 0)) ++ blkdestwidth--; ++ blkdestwidth = blkdestwidth - (image->dx * epinfo.bpp) / 32; ++ ++ pucBlitBuf = kmalloc(1024*8,GFP_KERNEL); ++ copy_from_user(pucBlitBuf, image->data, 5000); ++ ++ outl( 0x00000000 , BLOCKCTRL); ++ ++ outl( 0x00000000, SRCPIXELSTRT); ++ outl( virt_to_phys(pucBlitBuf), BLKSRCSTRT); ++ outl( (image->width * epinfo.bpp) / 32 , SRCLINELENGTH); ++ outl(((image->width - 1) * epinfo.bpp) / 32, BLKSRCWIDTH ); ++ ++ outl(((image->dx * epinfo.bpp) & 0x1F) | ++ ((((image->dx + image->width - 1) * epinfo.bpp ) & 0x1F) << 16) ++ , DESTPIXELSTRT); ++ outl((epinfo.fb_phys + (image->dy * epinfo.xres * epinfo.bpp ) / 8 + ++ (image->dx * epinfo.bpp ) / 8 ) ++ , BLKDSTSTRT); ++ outl( ((epinfo.xres * epinfo.bpp) / 32), DESTLINELENGTH ); ++ outl( blkdestwidth, BLKDESTWIDTH ); ++ outl( image->height - 1 , BLKDESTHEIGHT); ++ outl(image->fg_color, BLOCKMASK); ++ outl(image->bg_color, BACKGROUND); ++ outl( epinfo.pixformat | 0x00000003, BLOCKCTRL ); ++ ep93xxfb_wait(); ++*/ ++} ++ ++ ++static unsigned long isqrt(unsigned long a) ++{ ++ unsigned long rem = 0; ++ unsigned long root = 0; ++ int i; ++ ++ for (i = 0; i < 16; i++) { ++ root <<= 1; ++ rem = ((rem << 2) + (a >> 30)); ++ a <<= 2; ++ root++; ++ if (root <= rem) { ++ rem -= root; ++ root++; ++ } ++ else ++ root--; ++ } ++ return root >> 1; ++} ++ ++int ep93xxfb_line(struct fb_info *info, struct ep93xx_line *line) ++{ ++ unsigned long value = 0; ++ long x, y, dx, dy, count, xinc, yinc, xval, yval, incr; ++ ++ if ((line->x1 > info->var.xres) || ++ (line->x2 > info->var.xres) || ++ (line->y1 > info->var.yres) || ++ (line->y2 > info->var.yres)) ++ return -EFAULT; ++ x = line->x1; ++ y = line->y1; ++ dx = line->x2 - line->x1; ++ dy = line->y2 - line->y1; ++ ++ if ( !dx || !dy ) ++ return -EFAULT; ++ ++ if ( dx < 0 && dy < 0 ) { ++ x = line->x2; ++ y = line->y2; ++ dx *= -1; ++ dy *= -1; ++ } ++ else if ( dx < 0 && dy > 0 ){ ++ dx *= -1; ++ value = 0x000000A0; ++ } ++ else if( dy < 0 && dx > 0 ){ ++ dy *= -1; ++ value = 0x00000140; ++ } ++ ++ if (line->flags & LINE_PRECISE) { ++ count = isqrt(((dy * dy) + (dx * dx)) * 4096); ++ xinc = (4095 * 64 * dx) / count; ++ yinc = (4095 * 64 * dy) / count; ++ xval = 2048; ++ yval = 2048; ++ count = 0; ++ while (dx || dy) { ++ incr = 0; ++ xval -= xinc; ++ if (xval <= 0) { ++ xval += 4096; ++ dx--; ++ incr = 1; ++ } ++ yval -= yinc; ++ if (yval <= 0) { ++ yval += 4096; ++ dy--; ++ incr = 1; ++ } ++ count += incr; ++ } ++ } ++ else { ++ if ( dx == dy ) { ++ xinc = 4095; ++ yinc = 4095; ++ count = dx; ++ ++ } ++ else if ( dx < dy ) { ++ xinc = ( dx * 4095 ) / dy; ++ yinc = 4095; ++ count = dy; ++ ++ } ++ else { ++ xinc = 4095; ++ yinc = ( dy * 4095 ) / dx; ++ count = dx; ++ } ++ } ++ ++ outl(0x08000800, LINEINIT); ++ if (line->flags & LINE_PATTERN) ++ outl(line->pattern, LINEPATTRN); ++ else ++ outl(0x000fffff, LINEPATTRN); ++ outl(epinfo.fb_phys + ((y * epinfo.xres * epinfo.bpp) / 8) + ++ ((x * epinfo.bpp ) / 8 ), BLKDSTSTRT); ++ ++ outl(((x * epinfo.bpp) & 0x1F) | ++ ((((x + dx - 1) * epinfo.bpp) & 0x1F ) << 16), ++ DESTPIXELSTRT); ++ outl((epinfo.xres * epinfo.bpp) / 32, DESTLINELENGTH); ++ outl(line->fgcolor, BLOCKMASK); ++ outl(line->bgcolor, BACKGROUND); ++ outl((yinc << 16) | xinc, LINEINC); ++ outl( count & 0xFFF, BLKDESTWIDTH); ++ outl( 0 , BLKDESTHEIGHT); ++ value |= (line->flags & LINE_BACKGROUND) ? 0x00004000 : 0; ++ outl(epinfo.pixformat | value | 0x00000013, BLOCKCTRL); ++ ep93xxfb_wait(); ++ return 0; ++} ++ ++int ioctl_cursor=0; ++ ++int ep93xxfb_cursor(struct fb_info *info, struct ep93xx_cursor *cursor) ++{ ++ unsigned long x,y,save; ++ ++ if((cursor->width ==0) || (cursor->height ==0) ) ++ { ++ struct fb_cursor *fbcon_cursor =(struct fb_cursor *)cursor; ++ struct fbcon_ops *ops = (struct fbcon_ops *)info->fbcon_par; ++ unsigned int scan_align = info->pixmap.scan_align - 1; ++ unsigned int buf_align = info->pixmap.buf_align - 1; ++ unsigned int i, size, dsize, s_pitch, d_pitch; ++ struct fb_image *image; ++ u8 *src, *dst; ++ ++ if(ioctl_cursor==1 ){ ++ DPRINTK("softcursor error return\n"); ++ return 0; ++ } ++ ++ ++ if (info->state != FBINFO_STATE_RUNNING) ++ return 0; ++ ++ s_pitch = (fbcon_cursor->image.width + 7) >> 3; ++ dsize = s_pitch * fbcon_cursor->image.height; ++ ++ if (dsize + sizeof(struct fb_image) != ops->cursor_size) { ++ if (ops->cursor_src != NULL) ++ kfree(ops->cursor_src); ++ ops->cursor_size = dsize + sizeof(struct fb_image); ++ ++ ops->cursor_src = kmalloc(ops->cursor_size, GFP_ATOMIC); ++ if (!ops->cursor_src) { ++ ops->cursor_size = 0; ++ return -ENOMEM; ++ } ++ } ++ src = ops->cursor_src + sizeof(struct fb_image); ++ image = (struct fb_image *)ops->cursor_src; ++ *image = fbcon_cursor->image; ++ d_pitch = (s_pitch + scan_align) & ~scan_align; ++ ++ size = d_pitch * image->height + buf_align; ++ size &= ~buf_align; ++ dst = fb_get_buffer_offset(info, &info->pixmap, size); ++ ++ if (fbcon_cursor->enable) { ++ switch (fbcon_cursor->rop) { ++ case ROP_XOR: ++ for (i = 0; i < dsize; i++) ++ src[i] = image->data[i] ^ fbcon_cursor->mask[i]; ++ break; ++ case ROP_COPY: ++ default: ++ for (i = 0; i < dsize; i++) ++ src[i] = image->data[i] & fbcon_cursor->mask[i]; ++ break; ++ } ++ } else ++ memcpy(src, image->data, dsize); ++ ++ fb_pad_aligned_buffer(dst, d_pitch, src, s_pitch, image->height); ++ image->data = dst; ++ info->fbops->fb_imageblit(info, image); ++ return 0; ++ ++ } ++ else{ ++ ioctl_cursor = 1; ++ ++ /*if (cursor->width > 16 || cursor->height > 16){ ++ DPRINTK("%s width %d or heright %d error\n",__FUNCTION__,cursor->width,cursor->height); ++ return -ENXIO; ++ }*/ ++ ++ if (cursor->flags & CURSOR_OFF) ++ outl(inl(CURSORXYLOC) & ~0x00008000, CURSORXYLOC); ++ ++ if (cursor->flags & CURSOR_SETSHAPE) { ++ copy_from_user(cursor_data, cursor->data, ++ cursor->width * cursor->height / 4); ++ save = inl(CURSORXYLOC); ++ outl(save & ~0x00008000, CURSORXYLOC); ++ ++ outl(virt_to_phys(cursor_data), CURSOR_ADR_START); ++ outl(virt_to_phys(cursor_data), CURSOR_ADR_RESET); ++ outl(((cursor->width - 1) & 0x30) << 4 | ((cursor->height - 1) << 2) | ++ ((cursor->width - 1) >> 4), CURSORSIZE); ++ outl(save, CURSORXYLOC); ++ ++ } ++ ++ if (cursor->flags & CURSOR_SETCOLOR) { ++ outl(cursor->color1, CURSORCOLOR1); ++ outl(cursor->color2, CURSORCOLOR2); ++ outl(cursor->blinkcolor1, CURSORBLINK1); ++ outl(cursor->blinkcolor2, CURSORBLINK2); ++ } ++ ++ if (cursor->flags & CURSOR_BLINK) { ++ if (cursor->blinkrate) ++ outl(0x00000100 | cursor->blinkrate, CURSORBLINK); ++ else ++ outl(0x0000000FF, CURSORBLINK); ++ } ++ ++ if (cursor->flags & CURSOR_MOVE) { ++ x = (inl(HACTIVESTRTSTOP) & 0x000007ff) - cursor->dx - 2; ++ y = (inl(VACTIVESTRTSTOP) & 0x000007ff) - cursor->dy; ++ outl((inl(CURSORXYLOC) & 0x8000) | (y << 16) | x, CURSORXYLOC); ++ } ++ ++ if(cursor->flags & CURSOR_ON) ++ outl(inl(CURSORXYLOC) | 0x00008000, CURSORXYLOC); ++ ++ return 0; ++ } ++} ++ ++ ++ ++static inline void ++ep93xxfb_palette_write(u_int regno, u_int red, u_int green, ++ u_int blue, u_int trans) ++{ ++ unsigned int cont, i, pal; ++ DPRINTK("ep93xxfb_palette_write - enter\n"); ++ pal = ((red & 0xFF00) << 8) | (green & 0xFF00) | ((blue & 0xFF00) >> 8); ++ pseudo_palette[regno] = pal; ++ outl( pal, ( COLOR_LUT + ( regno << 2 ))); ++ cont = inl( LUTCONT ); ++ ++ if (( cont & LUTCONT_STAT && cont & LUTCONT_RAM1 ) || ++ ( !( cont & LUTCONT_STAT ) && !( cont&LUTCONT_RAM1 ))) { ++ for ( i = 0; i < 256; i++ ) { ++ outl( pseudo_palette[i], ( COLOR_LUT + ( i << 2 )) ); ++ } ++ outl( cont ^ LUTCONT_RAM1, LUTCONT ); ++ } ++} ++ ++int ep93xxfb_setcolreg(unsigned regno, unsigned red, unsigned green, ++ unsigned blue, unsigned transp, ++ struct fb_info *info) ++{ ++ ++#define CNVT_TOHW(val,width) ((((val)<<(width))+0x7FFF-(val))>>16) ++ ++ switch ( info->fix.visual ) ++ { ++ case FB_VISUAL_PSEUDOCOLOR: ++ ep93xxfb_palette_write(regno, red, green, blue, transp); ++ break; ++ case FB_VISUAL_TRUECOLOR: ++ if (regno >= 16) ++ return 1; ++ red = CNVT_TOHW(red, info->var.red.length); ++ green = CNVT_TOHW(green, info->var.green.length); ++ blue = CNVT_TOHW(blue, info->var.blue.length); ++ transp = CNVT_TOHW(transp, info->var.transp.length); ++ ((u32 *)(info->pseudo_palette))[regno] = ++ (red << info->var.red.offset) | ++ (green << info->var.green.offset) | ++ (blue << info->var.blue.offset) | ++ (transp << info->var.transp.offset); ++ break; ++ case FB_VISUAL_DIRECTCOLOR: ++ red = CNVT_TOHW(red, 8); ++ green = CNVT_TOHW(green, 8); ++ blue = CNVT_TOHW(blue, 8); ++ transp = CNVT_TOHW(transp, 8); ++ break; ++ } ++#undef CNVT_TOHW ++ return 0; ++} ++ ++static int ep93xx_pan_display(struct fb_var_screeninfo *var, ++ struct fb_info *info) ++{ ++ DPRINTK("ep93xx_pan_display - enter\n"); ++ ++ if (var->yoffset < 0 ++ || var->yoffset + var->yres > info->var.yres_virtual ++ || var->xoffset) ++ return -EINVAL; ++ ++ outl(epinfo.fb_phys + info->fix.line_length * var->yoffset ++ , VIDSCRNPAGE); ++ ++ info->var.xoffset = var->xoffset; ++ info->var.yoffset = var->yoffset; ++ ++ DPRINTK("ep93xx_pan_display - exit\n"); ++ return 0; ++} ++ ++ ++static int ++ep93xxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) ++{ ++ struct fb_var_screeninfo tmp_var; ++ unsigned long pclk; ++ DPRINTK("ep93xxfb_check_var - enter\n"); ++ ++ if( vout != 0) { ++ printk(" ep93xxfb_check_var - vout != 0\n"); ++ return -EINVAL; ++ } ++ ++ memcpy (&tmp_var, var, sizeof (tmp_var)); ++ ++ if( (tmp_var.vmode & FB_VMODE_MASK) != FB_VMODE_NONINTERLACED ) { ++ printk(" ep93xxfb_check_var - unsupported video mode\n"); ++ return -EINVAL; ++ } ++ ++ if( ((tmp_var.xres * tmp_var.yres * tmp_var.bits_per_pixel) / 8) > ++ MAX_FBMEM_SIZE ) { ++ printk(" ep93xxfb_check_var - memory error \n"); ++ return -ENOMEM; ++ } ++ ++ if( ((tmp_var.xres_virtual * tmp_var.yres_virtual * tmp_var.bits_per_pixel) / 8) > ++ MAX_FBMEM_SIZE ) { ++ printk(" ep93xxfb_check_var - memory error \n"); ++ return -ENOMEM; ++ } ++ ++ pclk = 1000 * (1000000000 / tmp_var.pixclock); ++ ++ if( pclk > ep93xx_get_max_video_clk() ) { ++ printk(" ep93xxfb_check_var - pixel clock error %lu\n",pclk); ++ return -EINVAL; ++ } ++ ++ if (var->xres_virtual != var->xres) ++ var->xres_virtual = var->xres; ++ if (var->yres_virtual < var->yres) ++ var->yres_virtual = var->yres; ++ ++ if (var->xoffset < 0) ++ var->xoffset = 0; ++ if (var->yoffset < 0) ++ var->yoffset = 0; ++ ++ switch (tmp_var.bits_per_pixel) { ++ case 8: ++ break; ++ case 16: ++ break; ++ case 24: ++ break; ++ case 32: ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ DPRINTK("ep93xxfb_check_var - exit\n"); ++ return 0; ++} ++ ++ ++static int ep93xxfb_set_par(struct fb_info *info) ++{ ++ struct fb_var_screeninfo tmp_var; ++ unsigned long attribs; ++ ++ DPRINTK("ep93xxfb_set_par - enter\n"); ++ ++ if( ep93xxfb_check_var(&info->var,info) < 0 ) ++ return -EINVAL; ++ ++ if( !ep93xxfb_setcol(info,info->var.bits_per_pixel) ) ++ return -EINVAL; ++ ++ ++ info->fix.line_length = (info->var.xres * info->var.bits_per_pixel) / 8; ++ ++ ep93xxfb_blank( 1 , info ); ++ ++ memcpy(&tmp_var,&info->var,sizeof(tmp_var)); ++ ++ epinfo.xres = tmp_var.xres; ++ epinfo.xsync = tmp_var.hsync_len; ++ epinfo.xfp = tmp_var.right_margin; ++ epinfo.xbp = tmp_var.left_margin; ++ epinfo.xtotal = epinfo.xres + epinfo.xsync + ++ epinfo.xfp + epinfo.xbp; ++ ++ epinfo.yres = tmp_var.yres; ++ epinfo.ysync = tmp_var.vsync_len; ++ epinfo.yfp = tmp_var.lower_margin; ++ epinfo.ybp = tmp_var.upper_margin; ++ epinfo.ytotal = epinfo.yres + epinfo.ysync + ++ epinfo.yfp + epinfo.ybp; ++ ++ epinfo.pixclock = tmp_var.pixclock ; ++ epinfo.refresh = 1000 * (1000000000 / tmp_var.pixclock) ; ++ ++ if( epinfo.refresh > ep93xx_get_max_video_clk()) ++ epinfo.refresh = ep93xx_get_max_video_clk(); ++ epinfo.bpp = tmp_var.bits_per_pixel; ++ ++ ep93xxfb_setclk(); ++ ep93xxfb_timing_signal_generation(); ++ ++ // set video memory parameters ++ outl(epinfo.fb_phys, VIDSCRNPAGE); ++ outl(epinfo.yres , SCRNLINES); ++ outl(((epinfo.xres * epinfo.bpp) / 32) - 1, LINELENGTH); ++ outl((epinfo.xres * epinfo.bpp) / 32, VLINESTEP); ++ ++ // set pixel mode ++ ep93xxfb_pixelmod(epinfo.bpp); ++ ++ attribs = 0; ++#ifdef CONFIG_EP93XX_SDCS0 ++ attribs |= 0 << VIDEOATTRIBS_SDSEL_SHIFT; ++#endif ++#ifdef CONFIG_EP93XX_SDCS1 ++ attribs |= 1 << VIDEOATTRIBS_SDSEL_SHIFT; ++#endif ++#ifdef CONFIG_EP93XX_SDCS2 ++ attribs |= 2 << VIDEOATTRIBS_SDSEL_SHIFT; ++#endif ++#ifdef CONFIG_EP93XX_SDCS3 ++ attribs |= 3 << VIDEOATTRIBS_SDSEL_SHIFT; ++#endif ++ ++ attribs |= VIDEOATTRIBS_INVCLK; ++ if( tmp_var.sync & FB_SYNC_HOR_HIGH_ACT ) ++ attribs |= VIDEOATTRIBS_HSPOL; ++ if( tmp_var.sync & FB_SYNC_VERT_HIGH_ACT ) ++ attribs |= VIDEOATTRIBS_VCPOL; ++ ++ ep93xxfb_outl(attribs, VIDEOATTRIBS); ++ ep93xxfb_blank( 0 , info ); ++ ++ DPRINTK("ep93xxfb_set_par - exit\n"); ++ ++ return 0; ++} ++ ++ ++static int ep93xxfb_blank(int blank_mode,struct fb_info *info) ++{ ++ unsigned long attribs; ++ DPRINTK("ep93xxfb_blank - enter\n"); ++ attribs = inl(VIDEOATTRIBS); ++ ++#ifdef CONFIG_EP93XX_SDCS0 ++ attribs |= 0 << VIDEOATTRIBS_SDSEL_SHIFT; ++#endif ++#ifdef CONFIG_EP93XX_SDCS1 ++ attribs |= 1 << VIDEOATTRIBS_SDSEL_SHIFT; ++#endif ++#ifdef CONFIG_EP93XX_SDCS2 ++ attribs |= 2 << VIDEOATTRIBS_SDSEL_SHIFT; ++#endif ++#ifdef CONFIG_EP93XX_SDCS3 ++ attribs |= 3 << VIDEOATTRIBS_SDSEL_SHIFT; ++#endif ++ ++ if (blank_mode) { ++ if (epinfo.off) ++ (epinfo.off)( 0 ); ++ ++ ep93xxfb_outl(attribs & ~(VIDEOATTRIBS_DATAEN | ++ VIDEOATTRIBS_SYNCEN | VIDEOATTRIBS_PCLKEN | ++ VIDEOATTRIBS_EN), VIDEOATTRIBS); ++ } ++ else { ++ if (epinfo.clk_src == CLK_INTERNAL) ++ attribs |= VIDEOATTRIBS_PCLKEN; ++ else ++ attribs &= ~VIDEOATTRIBS_PCLKEN; ++ ++ ep93xxfb_outl(attribs | VIDEOATTRIBS_DATAEN | ++ VIDEOATTRIBS_SYNCEN | VIDEOATTRIBS_EN, ++ VIDEOATTRIBS); ++ ++ if (epinfo.configure) ++ (epinfo.configure)( epinfo.automods ); ++ if (epinfo.on) ++ (epinfo.on)( 0 ); ++ } ++ return 0; ++} ++ ++static int ep93xxfb_mmap(struct fb_info *info,struct vm_area_struct *vma) ++{ ++ unsigned long off, start, len; ++ ++ DPRINTK("ep93xxfb_mmap - enter\n"); ++ ++ off = vma->vm_pgoff << PAGE_SHIFT; ++ start = info->fix.smem_start; ++ len = PAGE_ALIGN(start & ~PAGE_MASK) + info->fix.smem_len; ++ start &= PAGE_MASK; ++ if ((vma->vm_end - vma->vm_start + off) > len) ++ return -EINVAL; ++ ++ off += start; ++ vma->vm_pgoff = off >> PAGE_SHIFT; ++ ++ vma->vm_flags |= VM_IO; ++ vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); ++ ++ if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, ++ vma->vm_end - vma->vm_start, vma->vm_page_prot)) { ++ DPRINTK("ep93xxfb_mmap error\n"); ++ return -EAGAIN; ++ } ++ ++ DPRINTK("ep93xxfb_mmap - exit\n"); ++ return 0; ++} ++ ++static unsigned long ep93xx_get_pll_frequency(unsigned long pll) ++{ ++ unsigned long fb1, fb2, ipd, ps, freq; ++ ++ if (pll == 1) ++ pll = inl(EP93XX_SYSCON_CLOCK_SET1); ++ else if (pll == 2) ++ pll = inl(EP93XX_SYSCON_CLOCK_SET2); ++ else ++ return 0; ++ ++ ps = (pll & SYSCON_CLKSET1_PLL1_PS_MASK) >> SYSCON_CLKSET1_PLL1_PS_SHIFT; ++ fb1 = ((pll & SYSCON_CLKSET1_PLL1_X1FBD1_MASK) >> SYSCON_CLKSET1_PLL1_X1FBD1_SHIFT); ++ fb2 = ((pll & SYSCON_CLKSET1_PLL1_X2FBD2_MASK) >> SYSCON_CLKSET1_PLL1_X2FBD2_SHIFT); ++ ipd = ((pll & SYSCON_CLKSET1_PLL1_X2IPD_MASK) >> SYSCON_CLKSET1_PLL1_X2IPD_SHIFT); ++ ++ freq = (((0x00e10000 * (fb1+1)) / (ipd+1)) * (fb2+1)) >> ps; ++ return freq; ++} ++ ++static int ep93xx_get_max_video_clk() ++{ ++ unsigned long f,freq = 0; ++ ++ freq = 14745600 / 4; ++ f = ep93xx_get_pll_frequency(1) / 4; ++ if ( f > freq ) ++ freq = f; ++ f = ep93xx_get_pll_frequency(2) / 4; ++ if ( f > freq ) ++ freq = f; ++ ++ return freq; ++} ++ ++static int ep93xx_set_video_div(unsigned long freq) ++{ ++ unsigned long pdiv = 0, div = 0, psel = 0, esel = 0; ++ unsigned long err, f, i, j, k; ++ ++ err = -1; ++ ++ for (i = 0; i < 3; i++) { ++ if (i == 0) ++ f = 14745600 * 2; ++ else if (i == 1) ++ f = ep93xx_get_pll_frequency(1) * 2; ++ else ++ f = ep93xx_get_pll_frequency(2) * 2; ++ ++ for (j = 4; j <= 6; j++) { ++ k = f / (freq * j); ++ if (k < 2) ++ continue; ++ ++ if (abs(((f / (j * k))) - freq ) < err ) { ++ pdiv = j - 3; ++ div = k; ++ psel = (i == 2) ? 1 : 0; ++ esel = (i == 0) ? 0 : 1; ++ err = (f / (j * k)) - freq; ++ } ++ } ++ } ++ ++ if (err == -1) ++ return -1; ++ ++ SysconSetLocked(SYSCON_VIDDIV,SYSCON_VIDDIV_VENA | (esel ? SYSCON_VIDDIV_ESEL : 0) | ++ (psel ? SYSCON_VIDDIV_PSEL : 0) | ++ (pdiv << SYSCON_VIDDIV_PDIV_SHIFT) | ++ (div << SYSCON_VIDDIV_VDIV_SHIFT) ++ ); ++ ++ return freq + err; ++} ++ ++static void ep93xxfb_pixelmod(int bpp) ++{ ++ unsigned long tmpdata = 0; ++ ++ DPRINTK("ep93xxfb_pixelmod %dbpp -enter\n",bpp); ++ switch(bpp) { ++ case 8: ++ tmpdata = PIXELMODE_P_8BPP | ++ PIXELMODE_S_1PPCMAPPED | ++ PIXELMODE_C_LUT; ++ epinfo.pixformat = PIXEL_FORMAT_8; ++ break; ++ case 16: ++ tmpdata = PIXELMODE_P_16BPP | ++ PIXELMODE_S_1PPCMAPPED | ++ PIXELMODE_C_565; ++ epinfo.pixformat = PIXEL_FORMAT_16; ++ break; ++ case 24: ++ tmpdata = PIXELMODE_P_24BPP | ++ PIXELMODE_S_1PPC | ++ PIXELMODE_C_888; ++ epinfo.pixformat = PIXEL_FORMAT_24; ++ break; ++ case 32: ++ tmpdata = PIXELMODE_P_32BPP | ++ PIXELMODE_S_1PPC | ++ PIXELMODE_C_888; ++ epinfo.pixformat = PIXEL_FORMAT_32; ++ break; ++ default: ++ break; ++ } ++ outl(tmpdata,PIXELMODE); ++} ++ ++static void ep93xxfb_timing_signal_generation(void) ++{ ++ unsigned long vlinestotal,vsyncstart,vsyncstop, ++ vactivestart,vactivestop, ++ vblankstart,vblankstop, ++ vclkstart,vclkstop; ++ ++ unsigned long hclkstotal,hsyncstart,hsyncstop, ++ hactivestart,hactivestop, ++ hblankstart,hblankstop, ++ hclkstart,hclkstop; ++ ++ DPRINTK("ep93xxfb_timing_signal_generation - enter\n"); ++ ++ vlinestotal = epinfo.ytotal - 1; ++ vsyncstart = vlinestotal; ++ vsyncstop = vlinestotal - epinfo.ysync; ++ vblankstart = vlinestotal - epinfo.ysync - epinfo.ybp; ++ vblankstop = epinfo.yfp - 1; ++ vactivestart = vblankstart; ++ vactivestop = vblankstop; ++ vclkstart = vlinestotal; ++ vclkstop = vlinestotal + 1; ++ ++ hclkstotal = epinfo.xtotal - 1; ++ hsyncstart = hclkstotal; ++ hsyncstop = hclkstotal - epinfo.xsync; ++ hblankstart = hclkstotal - epinfo.xsync - epinfo.xbp; ++ hblankstop = epinfo.xfp - 1; ++ hactivestart = hblankstart; ++ hactivestop = hblankstop; ++ hclkstart = hclkstotal ; ++ hclkstop = hclkstotal ; ++ ++ ep93xxfb_outl(0, VIDEOATTRIBS); ++ ++ ep93xxfb_outl( vlinestotal , VLINESTOTAL ); ++ ep93xxfb_outl( vsyncstart + (vsyncstop << 16), VSYNCSTRTSTOP ); ++ ep93xxfb_outl( vactivestart + (vactivestop << 16), VACTIVESTRTSTOP ); ++ ep93xxfb_outl( vblankstart + (vblankstop << 16), VBLANKSTRTSTOP ); ++ ep93xxfb_outl( vclkstart + (vclkstop << 16), VCLKSTRTSTOP ); ++ ++ ep93xxfb_outl( hclkstotal , HCLKSTOTAL ); ++ ep93xxfb_outl( hsyncstart + (hsyncstop << 16), HSYNCSTRTSTOP ); ++ ep93xxfb_outl( hactivestart + (hactivestop << 16) , HACTIVESTRTSTOP ); ++ ep93xxfb_outl( hblankstart + (hblankstop << 16) , HBLANKSTRTSTOP ); ++ ep93xxfb_outl( hclkstart + (hclkstop << 16) , HCLKSTRTSTOP ); ++ ++ ep93xxfb_outl(0, LINECARRY); ++ ++} ++ ++static int ep93xxfb_setcol(struct fb_info *info, int bpp) ++{ ++ ++ DPRINTK("ep93xxfb_setcol %dbpp\n",bpp); ++ switch(bpp) { ++ case 8: ++ info->var.bits_per_pixel = 8; ++ info->var.red.length = 8; ++ info->var.green.length = 8; ++ info->var.blue.length = 8; ++ info->fix.visual = FB_VISUAL_PSEUDOCOLOR; ++ break; ++ case 16: ++ info->var.bits_per_pixel = 16; ++ info->var.red.offset = 11; ++ info->var.red.length = 5; ++ info->var.green.offset = 5; ++ info->var.green.length = 6; ++ info->var.blue.offset = 0; ++ info->var.blue.length = 5; ++ info->fix.visual = FB_VISUAL_TRUECOLOR; ++ break; ++ case 24: ++ info->var.bits_per_pixel = 24; ++ info->var.red.length = 8; ++ info->var.blue.length = 8; ++ info->var.green.length = 8; ++ info->var.red.offset = 16; ++ info->var.green.offset = 8; ++ info->var.blue.offset = 0; ++ info->fix.visual = FB_VISUAL_TRUECOLOR; ++ break; ++ case 32: ++ info->var.bits_per_pixel = 32; ++ info->var.red.length = 8; ++ info->var.blue.length = 8; ++ info->var.green.length = 8; ++ info->var.transp.length = 0; ++ info->var.red.offset = 16; ++ info->var.green.offset = 8; ++ info->var.blue.offset = 0; ++ info->var.transp.offset = 0; ++ info->fix.visual = FB_VISUAL_TRUECOLOR; ++ break; ++ default: ++ return 0; ++ } ++ return 1; ++} ++ ++static int ep93xxfb_setclk() ++{ ++ unsigned long calc_clk,act_clk; ++ ++ if ( epinfo.clk_src == CLK_INTERNAL ) { ++ SysconSetLocked(EP93XX_SYSCON_DEVICE_CONFIG,inl(EP93XX_SYSCON_DEVICE_CONFIG) & ~EP93XX_SYSCON_DEVICE_CONFIG_CRUNCH_ENABLE); ++ calc_clk = epinfo.refresh; ++ act_clk = ep93xx_set_video_div( calc_clk ); ++ if ( act_clk == -1 ) ++ return -ENODEV; ++ ++ epinfo.refresh = act_clk; ++ epinfo.pixclock = 1000000000 / (act_clk / 1000); ++ } ++ else { ++ SysconSetLocked(SYSCON_VIDDIV,0); ++ SysconSetLocked(EP93XX_SYSCON_DEVICE_CONFIG,inl(EP93XX_SYSCON_DEVICE_CONFIG) | EP93XX_SYSCON_DEVICE_CONFIG_CRUNCH_ENABLE); ++ ++ } ++ ++ return 0; ++} ++ ++ ++static void ep93xxfb_get_par(struct fb_info *info) ++{ ++ ++ DPRINTK("ep93xxfb_get_par - enter\n"); ++ epinfo.configure = NULL; ++ epinfo.on = NULL; ++ epinfo.off = NULL; ++ ++ switch( vout ) { ++ case LCD_OUT: ++ epinfo.on = philips_lb064v02_on; ++ epinfo.off = philips_lb064v02_off; ++ ++ case CRT_OUT: ++ epinfo.xres = ep93xxfb_vmods[vmode].hres; ++ epinfo.xsync = ep93xxfb_vmods[vmode].hsync; ++ epinfo.xfp = ep93xxfb_vmods[vmode].hfp; ++ epinfo.xbp = ep93xxfb_vmods[vmode].hbp; ++ epinfo.xtotal = epinfo.xres + epinfo.xsync + ++ epinfo.xfp + epinfo.xbp; ++ ++ epinfo.yres = ep93xxfb_vmods[vmode].vres; ++ epinfo.ysync = ep93xxfb_vmods[vmode].vsync; ++ epinfo.yfp = ep93xxfb_vmods[vmode].vfp; ++ epinfo.ybp = ep93xxfb_vmods[vmode].vbp; ++ epinfo.ytotal = epinfo.yres + epinfo.ysync + ++ epinfo.yfp + epinfo.ybp; ++ ++ epinfo.refresh = ep93xxfb_vmods[vmode].refresh; ++ epinfo.refresh = epinfo.xtotal * epinfo.ytotal * epinfo.refresh; ++ epinfo.pixclock = 1000000000 / ( epinfo.refresh / 1000); ++ epinfo.bpp = depth; ++ ++ epinfo.clk_src = ep93xxfb_vmods[vmode].clk_src; ++ epinfo.clk_edge = ep93xxfb_vmods[vmode].clk_edge; ++ epinfo.pol_blank = ep93xxfb_vmods[vmode].pol_blank; ++ epinfo.pol_xsync = ep93xxfb_vmods[vmode].pol_hsync; ++ epinfo.pol_ysync = ep93xxfb_vmods[vmode].pol_vsync; ++ break; ++ ++ } ++} ++ ++static int ep93xxfb_alloc_videomem(void) ++{ ++ unsigned long adr,size,pgsize; ++ int order; ++ ++ DPRINTK("ep93xxfb_alloc_videomem - enter \n"); ++ ++ epinfo.fb_log = NULL; ++ epinfo.fb_size = PAGE_ALIGN( MAX_FBMEM_SIZE/*ep93xxfb_vmods[vmode].hres * ep93xxfb_vmods[vmode].vres * (depth / 8)*/ ); ++ order = get_order( epinfo.fb_size ); ++ epinfo.fb_log = (void*) __get_free_pages( GFP_KERNEL, order ); ++ ++ if (epinfo.fb_log) { ++ epinfo.fb_phys = __virt_to_phys((int) epinfo.fb_log ); ++ adr = (unsigned long)epinfo.fb_log; ++ size = epinfo.fb_size; ++ pgsize = 1 << order; ++ do { ++ adr += pgsize; ++ SetPageReserved(virt_to_page(adr)); ++ } while(size -= pgsize); ++ } ++ else{ ++ printk("%s memory fail \n",__FUNCTION__); ++ return -ENOMEM; ++ } ++ ++ memset(epinfo.fb_log,0x00,epinfo.fb_size); ++ DPRINTK(" fb_log_addres = 0x%x\n",epinfo.fb_log); ++ DPRINTK(" fb_phys_address = 0x%x\n",epinfo.fb_phys); ++ DPRINTK(" fb_size = %lu\n",epinfo.fb_size); ++ DPRINTK(" fb_page_order = %d\n",order); ++ DPRINTK("ep93xxfb_alloc_videomem - exit \n"); ++ return 0; ++} ++ ++static void ep93xxfb_release_videomem(void) ++{ ++ unsigned long adr,size,psize; ++ int order; ++ ++ DPRINTK("ep93xxfb_release_videomem - enter \n"); ++ ++ if (epinfo.fb_log) { ++ order = get_order(epinfo.fb_size); ++ adr = (unsigned long)epinfo.fb_log; ++ size = epinfo.fb_size; ++ psize = 1 << order ; ++ do { ++ adr += psize; ++ ClearPageReserved(virt_to_page(adr)); ++ } while(size -= psize); ++ free_pages((unsigned long)epinfo.fb_log, order ); ++ } ++ ++ ++ DPRINTK("ep93xxfb_release_videomem - exit \n"); ++} ++ ++static void ep93xxfb_setinfo(struct fb_info *info) ++{ ++ ++ info->pseudo_palette = pseudo_palette; ++ info->var.xres = epinfo.xres; ++ info->var.yres = epinfo.yres; ++ info->var.xres_virtual = epinfo.xres; ++ info->var.yres_virtual = epinfo.yres; ++ ++ ep93xxfb_setcol( info, depth ); ++ ++ info->var.activate = FB_ACTIVATE_NOW; ++ info->var.left_margin = epinfo.xbp; ++ info->var.right_margin = epinfo.xfp; ++ info->var.upper_margin = epinfo.ybp; ++ info->var.lower_margin = epinfo.yfp; ++ info->var.hsync_len = epinfo.xsync; ++ info->var.vsync_len = epinfo.ysync; ++ ++ if( epinfo.pol_xsync == POL_HIGH ) ++ info->var.sync |= FB_SYNC_HOR_HIGH_ACT; ++ if( epinfo.pol_ysync == POL_HIGH ) ++ info->var.sync |= FB_SYNC_VERT_HIGH_ACT; ++ ++ info->var.vmode = FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP; ++ info->fix.smem_start = epinfo.fb_phys; ++ info->fix.smem_len = epinfo.fb_size; ++ info->fix.type = FB_TYPE_PACKED_PIXELS; ++ info->fix.line_length = epinfo.xres * (epinfo.bpp / 8); ++ info->screen_base = epinfo.fb_log; ++ info->var.pixclock = epinfo.pixclock; ++ info->fix.ypanstep = 1; ++ info->fix.ywrapstep = 1; ++ ++} ++ ++static int ep93xxfb_config(struct fb_info *info) ++{ ++ unsigned long attribs; ++ ++ DPRINTK("ep93xxfb_config - enter\n"); ++ ++ ep93xxfb_get_par( info ); ++ if( ep93xxfb_alloc_videomem() != 0 ) { ++ printk("Unable to allocate video memory\n"); ++ return -ENOMEM; ++ } ++ ++ if( ep93xxfb_setclk() != 0 ) { ++ printk("Unable to set pixel clock\n"); ++ ep93xxfb_release_videomem(); ++ return -ENODEV; ++ } ++ ++ SysconSetLocked(EP93XX_SYSCON_DEVICE_CONFIG, inl(EP93XX_SYSCON_DEVICE_CONFIG) |EP93XX_SYSCON_DEVCFG_RasOnP3); ++ ep93xxfb_timing_signal_generation(); ++ ++ /* set video memory parameters */ ++ outl(epinfo.fb_phys, VIDSCRNPAGE); ++ outl(epinfo.yres , SCRNLINES); ++ outl(((epinfo.xres * epinfo.bpp) / 32) - 1, LINELENGTH); ++ outl((epinfo.xres * epinfo.bpp) / 32, VLINESTEP); ++ ++ ++ /* set pixel mode */ ++ ep93xxfb_pixelmod(depth); ++ ++ attribs = 0; ++ ++#ifdef CONFIG_EP93XX_SDCS0 ++ attribs |= 0 << VIDEOATTRIBS_SDSEL_SHIFT; ++#endif ++#ifdef CONFIG_EP93XX_SDCS1 ++ attribs |= 1 << VIDEOATTRIBS_SDSEL_SHIFT; ++#endif ++#ifdef CONFIG_EP93XX_SDCS2 ++ attribs |= 2 << VIDEOATTRIBS_SDSEL_SHIFT; ++#endif ++#ifdef CONFIG_EP93XX_SDCS3 ++ attribs |= 3 << VIDEOATTRIBS_SDSEL_SHIFT; ++#endif ++ ++ if(epinfo.clk_edge == EDGE_RISING) ++ attribs |= VIDEOATTRIBS_INVCLK; ++ if(epinfo.pol_blank == POL_HIGH) ++ attribs |= VIDEOATTRIBS_BLKPOL; ++ if(epinfo.pol_xsync == POL_HIGH) ++ attribs |= VIDEOATTRIBS_HSPOL; ++ if(epinfo.pol_ysync == POL_HIGH) ++ attribs |= VIDEOATTRIBS_VCPOL; ++ ++ ep93xxfb_outl(attribs, VIDEOATTRIBS); ++ ep93xxfb_setinfo( info ); ++ ++ if(epinfo.configure) ++ (epinfo.configure)( epinfo.automods ); ++ ++ ep93xxfb_blank( 0 , info ); ++ ++ DPRINTK("ep93xxfb_config - exit\n"); ++ return 0; ++} ++ ++int ep93xxfb_ioctl(struct fb_info *info,unsigned int cmd, unsigned long arg) ++{ ++ struct fb_fillrect fill; ++ struct fb_copyarea cparea; ++ struct fb_image img; ++ struct ep93xx_line line; ++ struct ep93xx_cursor cursor; ++ ++ switch (cmd) { ++ case FBIO_EP93XX_CURSOR: ++ copy_from_user(&cursor, (void *)arg, sizeof(struct ep93xx_cursor)); ++ ep93xxfb_cursor(info,&cursor); ++ break; ++ case FBIO_EP93XX_LINE: ++ copy_from_user(&line, (void *)arg, sizeof(struct ep93xx_line)); ++ ep93xxfb_line(info,&line); ++ break; ++ case FBIO_EP93XX_FILL: ++ copy_from_user(&fill, (void *)arg, sizeof(struct fb_fillrect)); ++ ep93xxfb_fillrect(info,&fill); ++ break; ++ case FBIO_EP93XX_BLIT: ++ copy_from_user(&img, (void *)arg, sizeof(struct fb_image)); ++ ep93xxfb_imageblit(info, &img); ++ break; ++ case FBIO_EP93XX_COPY: ++ copy_from_user(&cparea, (void *)arg, sizeof(struct fb_copyarea)); ++ ep93xxfb_copyarea(info,&cparea); ++ break; ++ default: ++ return -EFAULT; ++ } ++ return 0; ++} ++ ++ ++static struct fb_ops ep93xxfb_ops = { ++ .owner = THIS_MODULE, ++ .fb_setcolreg = ep93xxfb_setcolreg, ++ .fb_check_var = ep93xxfb_check_var, ++ .fb_set_par = ep93xxfb_set_par, ++ .fb_blank = ep93xxfb_blank, ++ .fb_pan_display = ep93xx_pan_display, ++ .fb_fillrect = ep93xxfb_fillrect, ++ .fb_copyarea = ep93xxfb_copyarea, ++ .fb_imageblit = cfb_imageblit, ++ .fb_cursor = ep93xxfb_cursor, ++ .fb_ioctl = ep93xxfb_ioctl, ++ .fb_mmap = ep93xxfb_mmap, ++}; ++ ++ ++static struct resource ep93xxfb_raster_resources = { ++ .start = EP93XX_RASTER_PHYS_BASE, ++ .end = EP93XX_RASTER_PHYS_BASE + 0x1ffff, ++ .flags = IORESOURCE_MEM, ++}; ++ ++ ++static int __init ep93xxfb_probe(struct platform_device *device) ++{ ++ struct fb_info *info = NULL; ++ struct resource *res = NULL; ++ int ret = 0; ++ int arb = 0; ++ ++ DPRINTK("ep93xxfb_probe - enter \n"); ++ ++ ++ if(!device) { ++ printk("error : to_platform_device\n"); ++ return -ENODEV; ++ } ++ res = platform_get_resource( device, IORESOURCE_MEM, 0); ++ if(!res) { ++ printk("error : platform_get_resource \n"); ++ return -ENODEV; ++ } ++ cursor_data = kmalloc( 64 * 64 * 2, GFP_KERNEL ); ++ memset( cursor_data, 0x00, 64 * 64 * 2 ); ++ if(!cursor_data) { ++ printk("Unable to allocate memory for hw_cursor\n"); ++ return -ENOMEM; ++ } ++ if (!request_mem_region(res->start,res->end - res->start + 1, FBDEV_NAME )) ++ return -EBUSY; ++ ++ info = framebuffer_alloc(sizeof(u32) * 256, &device->dev); ++ ++ if(!info) { ++ printk("Unable to allocate memory for frame buffer\n"); ++ return -ENOMEM; ++ } ++ ++ info->flags = FBINFO_DEFAULT; ++ strncpy(info->fix.id, FBDEV_NAME, sizeof(info->fix.id)); ++ info->fix.mmio_start = res->start; ++ info->fix.mmio_len = res->end - res->start + 1; ++ info->fbops = &ep93xxfb_ops; ++ info->pseudo_palette = info->par; ++ info->state = FBINFO_STATE_RUNNING; ++ ++ if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { ++ ret = -ENOMEM; ++ goto fbuff; ++ } ++ ++ if ((ret = ep93xxfb_config(info)) < 0) ++ goto clmap; ++ ++ if (register_framebuffer(info) < 0) { ++ printk(KERN_ERR "Unable to register ep93xxfb frame buffer\n"); ++ ret = -EINVAL; ++ goto clmap; ++ } ++ platform_set_drvdata(device, info); ++ printk(KERN_INFO "fb%d: EP93xx frame buffer at %dx%dx%dbpp\n", info->node, ++ info->var.xres, info->var.yres, info->var.bits_per_pixel); ++ ++ /*change the raster arb to the highest one--Bo*/ ++ arb = inl(EP93XX_SYSCON_BMAR); ++ arb = (arb & 0x3f8) | 0x01; ++ outl(arb,EP93XX_SYSCON_BMAR); ++ ++ DPRINTK("ep93xxfb_probe - exit \n"); ++ return 0; ++ ++clmap: ++ fb_dealloc_cmap(&info->cmap); ++ ++fbuff: ++ framebuffer_release(info); ++ return ret; ++} ++ ++static int ep93xxfb_remove(struct platform_device *device) ++{ ++ struct resource *res; ++ struct fb_info *info; ++ struct ep93xx_cursor cursor; ++ ++ DPRINTK("ep93xxfb_remove - enter \n"); ++ ++ info = platform_get_drvdata(device); ++ ++ ep93xxfb_release_videomem(); ++ ++ res = platform_get_resource( device, IORESOURCE_MEM, 0); ++ release_mem_region(res->start, res->end - res->start + 1); ++ ++ platform_set_drvdata(device, NULL); ++ unregister_framebuffer(info); ++ ++ fb_dealloc_cmap(&info->cmap); ++ framebuffer_release(info); ++ ++ cursor.flags = CURSOR_OFF; ++ ep93xxfb_cursor(info,&cursor); ++ if(cursor_data!=NULL) ++ kfree(cursor_data); ++ ++ ep93xxfb_blank( 1, info ); ++ ++ DPRINTK("ep93xxfb_remove - exit \n"); ++ return 0; ++} ++ ++static void ep93xxfb_platform_release(struct device *device) ++{ ++ DPRINTK("ep93xxfb_platform_release - enter\n"); ++} ++ ++static int ep93xxfb_check_param(void) ++{ ++ ++ switch(vout) { ++ case CRT_OUT: ++ if( vmode >=(sizeof(ep93xxfb_vmods)/sizeof(ep93xxfb_vmods[0]))){ ++ vmode = 1; ++ depth = DEFAULT_BPP; ++ return 0; ++ } ++ break; ++ case LCD_OUT: ++ if( vmode != 0 || depth != 16 ) { ++ vmode = 0; ++ depth = DEFAULT_BPP; ++ return 0; ++ } ++ break; ++ default: ++ vmode = DEFAULT_MODE; ++ depth = DEFAULT_BPP; ++ vout = DEFAULT_OUT; ++ return 0; ++ break; ++ } ++ ++ if(!((depth == 8) || (depth == 16) || (depth == 24) || (depth == 32))) ++ depth = DEFAULT_BPP; ++ ++ return 1; ++} ++ ++int __init ep93xxfb_setup(char *options) ++{ ++ char *opt; ++ ++ DPRINTK("ep93xxfb_setup - %s\n",options); ++ ++ if (!options || !*options) ++ return 0; ++ ++ while ((opt = strsep(&options, ",")) != NULL) { ++ if (!strncmp(opt, "vout=", 5)) ++ vout = simple_strtoul(opt + 5, NULL, 0); ++ else if (!strncmp(opt, "vmode=", 6)) ++ vmode = simple_strtoul(opt + 6, NULL, 0); ++ else if (!strncmp(opt, "depth=", 6)) ++ depth = simple_strtoul(opt + 6, NULL, 0); ++ } ++ ep93xxfb_check_param(); ++ return 0; ++} ++ ++ ++static struct platform_driver ep93xxfb_driver = { ++ .probe = ep93xxfb_probe, ++ .remove = ep93xxfb_remove, ++ .driver = { ++ .name = FBDEV_NAME, ++ }, ++}; ++ ++static struct platform_device ep93xxfb_device = { ++ .name = FBDEV_NAME, ++ .id = -1, ++ .dev = { ++ .release = ep93xxfb_platform_release, ++ }, ++ .num_resources = 1, ++ .resource = &ep93xxfb_raster_resources, ++}; ++ ++int __init ep93xxfb_init(void) ++{ ++ int ret = 0; ++ char *option = NULL; ++ ++ DPRINTK("ep93xxfb_init - enter\n"); ++ ++ if (fb_get_options("ep93xxfb", &option)) ++ return -ENODEV; ++ ep93xxfb_setup(option); ++ ++ ++ if( !ep93xxfb_check_param() ) { ++ printk("Unsupported format \n"); ++ return -1; ++ } ++ /*Add the Hardware accel irq */ ++ outl(0x00000000, BLOCKCTRL); ++ ret = request_irq(IRQ_EP93XX_GRAPHICS, ep93xxfb_irq_handler, IRQF_DISABLED,"graphics",NULL); ++ ++ if (ret != 0) { ++ printk("%s: can't get irq %i, err %d\n",__FUNCTION__, IRQ_EP93XX_GRAPHICS, ret); ++ return -EBUSY; ++ } ++ ++ /*-------------------------------*/ ++ ret = platform_driver_register(&ep93xxfb_driver); ++ ++ if (!ret) { ++ ret = platform_device_register(&ep93xxfb_device); ++ if (ret) ++ platform_driver_unregister(&ep93xxfb_driver); ++ } ++ ++ DPRINTK("ep93xxfb_init - exit\n"); ++ return ret; ++} ++ ++ ++ ++static void __exit ep93xxfb_exit(void) ++{ ++ DPRINTK("ep93xxfb_exit - enter\n"); ++ platform_driver_unregister(&ep93xxfb_driver); ++ platform_device_unregister(&ep93xxfb_device); ++ DPRINTK("ep93xxfb_exit - exit\n"); ++} ++ ++module_init(ep93xxfb_init); ++module_exit(ep93xxfb_exit); ++ ++ ++module_param( vmode, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); ++MODULE_PARM_DESC(vmode, "Specify the video mode number that should be used"); ++module_param( vout , int , S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP ); ++MODULE_PARM_DESC(vout ,"Specify video output (0 = CRT ,1 = LCD )"); ++module_param( depth , int, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); ++MODULE_PARM_DESC(depth ,"Color depth (8,16,24,32)"); ++MODULE_LICENSE("GPL"); +--- /dev/null ++++ b/drivers/video/ep93xxfb.h +@@ -0,0 +1,236 @@ ++#ifndef __EP93XXFB_H__ ++#define __EP93XXFB_H__ ++ ++ ++#define POL_HIGH 1 ++#define POL_LOW 0 ++#define EDGE_RISING 1 ++#define EDGE_FALLING 0 ++#define CLK_INTERNAL 1 ++#define CLK_EXTERNAL 0 ++ ++#define CRT_OUT 0 ++#define LCD_OUT 1 ++#define TV_OUT 2 ++ ++#define MAX_XRES 1280 ++#define MAX_YRES 1024 ++#define MAX_BPP 16 ++#define MAX_FBMEM_SIZE 3686400/*1920000*/ ++ ++#define MAX_XRES_CRT MAX_XRES ++#define MAX_YRES_CRT MAX_YRES ++#define MAX_XRES_SVIDEO 1024 ++#define MAX_YRES_SVIDEO 768 ++ ++#define PIXEL_FORMAT_SHIFT 17 ++#define PIXEL_FORMAT_4 ( 1 << PIXEL_FORMAT_SHIFT ) ++#define PIXEL_FORMAT_8 ( 2 << PIXEL_FORMAT_SHIFT ) ++#define PIXEL_FORMAT_16 ( 4 << PIXEL_FORMAT_SHIFT ) ++#define PIXEL_FORMAT_24 ( 6 << PIXEL_FORMAT_SHIFT ) ++#define PIXEL_FORMAT_32 ( 7 << PIXEL_FORMAT_SHIFT ) ++ ++ ++struct ep93xxfb_videomodes ++{ ++ const char *name; ++ ++ unsigned long hres; // Horizontal Valid ++ unsigned long hfp; // Horizontal Front Porch ++ unsigned long hsync; // Horizontal Sync Width ++ unsigned long hbp; // Horizontal Back Porch ++ ++ unsigned long vres; // Vertical Valid ++ unsigned long vfp; // Vertical Front Porch ++ unsigned long vsync; // Vertical Sync Width ++ unsigned long vbp; // Vertical Back Porch ++ ++ unsigned long refresh; // Vertical Sync Frequency ++ ++ unsigned long clk_src; ++ unsigned long clk_edge; ++ unsigned long pol_blank; ++ unsigned long pol_hsync; ++ unsigned long pol_vsync; ++}; ++ ++ ++struct ep93xxfb_info ++{ ++ ++ ++ dma_addr_t fb_phys; ++ void *fb_log; ++ unsigned long fb_size; ++ unsigned long fb_actsize; ++ ++ unsigned long xtotal; ++ unsigned long ytotal; ++ ++ unsigned int xres; ++ unsigned int xfp; ++ unsigned int xsync; ++ unsigned int xbp; ++ ++ unsigned int yres; ++ unsigned int yfp; ++ unsigned int ysync; ++ unsigned int ybp; ++ unsigned int bpp; ++ ++ unsigned long refresh; ++ unsigned long pixclock; ++ unsigned long pixformat; ++ ++ unsigned int clk_src; ++ unsigned int clk_edge; ++ unsigned int pol_blank; ++ unsigned int pol_xsync; ++ unsigned int pol_ysync; ++ ++ unsigned char automods; ++ ++ void (*configure)(unsigned char value); ++ void (*on)(unsigned char value); ++ void (*off)(unsigned char value); ++}; ++ ++static int ep93xxfb_setclk(void); ++static int ep93xx_get_max_video_clk(void); ++static void ep93xxfb_pixelmod(int bpp); ++static void ep93xxfb_timing_signal_generation(void); ++static int ep93xxfb_blank(int blank_mode,struct fb_info *info); ++ ++#define EE_DELAY_USEC 2 ++#define EE_READ_TIMEOUT 100 ++#define CX25871_DEV_ADDRESS 0x88 ++#define GPIOG_EEDAT 2 ++#define GPIOG_EECLK 1 ++#define CXMODES_COUNT 24 ++ ++struct cx25871_vmodes ++{ ++ ++ const char *name; ++ unsigned char automode; ++ unsigned int hres; ++ unsigned int vres; ++ unsigned int hclktotal; ++ unsigned int vclktotal; ++ unsigned int hblank; ++ unsigned int vblank; ++ unsigned long clkfrequency; ++ ++}; ++ ++ ++int write_reg(unsigned char ucRegAddr, unsigned char ucRegValue); ++void cx25871_on(unsigned char value); ++void cx25871_off(unsigned char value); ++void cx25871_config(unsigned char value); ++ ++static void philips_lb064v02_on(unsigned char value); ++static void philips_lb064v02_off(unsigned char value); ++ ++ ++#define FBIO_EP93XX_CURSOR 0x000046c1 ++#define FBIO_EP93XX_LINE 0x000046c2 ++#define FBIO_EP93XX_FILL 0x000046c3 ++#define FBIO_EP93XX_BLIT 0x000046c4 ++#define FBIO_EP93XX_COPY 0x000046c5 ++ ++ ++#define CURSOR_BLINK 0x00000001 ++#define CURSOR_MOVE 0x00000002 ++#define CURSOR_SETSHAPE 0x00000004 ++#define CURSOR_SETCOLOR 0x00000008 ++#define CURSOR_ON 0x00000010 ++#define CURSOR_OFF 0x00000020 ++ ++ ++/* ++* ioctl(fd, FBIO_EP93XX_CURSOR, ep93xx_cursor *) ++* ++* "data" points to an array of pixels that define the cursor; each row should ++* be a multiple of 32-bit values (i.e. 16 pixels). Each pixel is two bits, ++* where the values are: ++* ++* 00 => transparent 01 => invert 10 => color1 11 => color2 ++* ++* The data is arranged as follows (per word): ++* ++* bits: |31-30|29-28|27-26|25-24|23-22|21-20|19-18|17-16| ++* pixel: | 12 | 13 | 14 | 15 | 8 | 9 | 10 | 11 | ++* bits: |15-14|13-12|11-10| 9-8 | 7-6 | 5-4 | 3-2 | 1-0 | ++* pixel: | 4 | 5 | 6 | 7 | 0 | 1 | 2 | 3 | ++* ++* Regardless of the frame buffer color depth, "color1", "color2", ++* "blinkcolor1", and "blinkcolor2" are 24-bit colors since the cursor is ++* injected into the data stream right before the video DAC. ++* ++* When "blinkrate" is not zero, pixel value 10 will alternate between "color1" ++* and "blinkcolor1" (similar for pixel value 11 and "color2"/"blinkcolor2"). ++* ++* "blinkrate" ranges between 0 and 255. When 0, blinking is disabled. 255 is ++* the fastest blink rate and 1 is the slowest. ++* ++* Both "width" and "height" must be between 1 and 64; it is preferable to have ++* "width" a multiple of 16. ++*/ ++struct ep93xx_cursor { ++ unsigned long flags; ++ unsigned long dx; // Only used if CURSOR_MOVE is set ++ unsigned long dy; // Only used if CURSOR_MOVE is set ++ unsigned long width; // Only used if CURSOR_SETSHAPE is set ++ unsigned long height; // Only used if CURSOR_SETSHAPE is set ++ const char *data; // Only used if CURSOR_SETSHAPE is set ++ unsigned long blinkrate; // Only used if CURSOR_BLINK is set ++ unsigned long color1; // Only used if CURSOR_SETCOLOR is set ++ unsigned long color2; // Only used if CURSOR_SETCOLOR is set ++ unsigned long blinkcolor1; // Only used if CURSOR_SETCOLOR is set ++ unsigned long blinkcolor2; // Only used if CURSOR_SETCOLOR is set ++}; ++ ++ ++/* ++ * The bits in the flags field of ep93xx_line. ++*/ ++/* ++* ioctl(fd, FBIO_EP93XX_LINE, ep93xx_line *) ++* ++* The line starts at ("x1","y1") and ends at ("x2","y2"). This means that ++* when using a pattern, the two coordinates are not transitive (i.e. swapping ++* ("x1","y1") with ("x2","y2") will not necessarily draw the exact same line, ++* pattern-wise). ++* ++* "pattern" is a 2 to 16 bit pattern (since a 1 bit pattern isn't much of a ++* pattern). The lower 16 bits define the pattern (1 being foreground, 0 being ++* background or transparent), and bits 19-16 define the length of the pattern ++* (as pattern length - 1). So, for example, "0xf00ff" defines a 16 bit ++* with the first 8 pixels in the foreground color and the next 8 pixels in the ++* background color or transparent. ++* ++* LINE_PRECISE is used to apply angularly corrected patterns to line. It ++* should only be used when LINE_PATTERN is also set. The pattern will be ++* applied along the length of the line, instead of along the length of the ++* major axis. This may result in the loss of fine details in the pattern, and ++* will take more time to draw the line in most cases. ++*/ ++ ++#define LINE_PATTERN 0x00000001 ++#define LINE_PRECISE 0x00000002 ++#define LINE_BACKGROUND 0x00000004 ++ ++struct ep93xx_line { ++ unsigned long flags; ++ unsigned long x1; ++ unsigned long y1; ++ unsigned long x2; ++ unsigned long y2; ++ unsigned long fgcolor; ++ unsigned long bgcolor; // Only used if LINE_BACKGROUND is set ++ unsigned long pattern; // Only used if LINE_PATTERN is set ++}; ++ ++#endif /* __EP93XXFB_H__ */ ++ +--- /dev/null ++++ b/drivers/video/ep93xxfb_mono.c +@@ -0,0 +1,1281 @@ ++/* ++ * drivers/video/ep93xxfb_mono.c -- grayscale on mono LCD driver for ++ * Cirrus Logic EP93xx. ++ * ++ * Copyright (C) 2007 Cirrus Logic ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file COPYING in the main directory of this archive for ++ * more details. ++ * ++ * This driver works for the following two LCD: ++ * SHARP LM121VB1T01 - A dual scan 640x480 monochrome LCD. ++ * HOSIDEN HLM6323 - A single scan 320x240 monochrome LCD. ++ * ++ * And support two gray modes: ++ * 8 levels of gray - Actually is 7 levels of gray. Two of the levels ++ * have the same gray. ++ * 16 levels of gray - Extending the gray levels by switching the LUT ++ * for each frame. ++ * ++ * HW connection for SHARP LM121VB1T01: ++ * P12 <------> LCD_U0 ++ * P8 <------> LCD_U1 ++ * P4 <------> LCD_U2 ++ * P0 <------> LCD_U3 ++ * P14 <------> LCD_L0 ++ * P10 <------> LCD_L1 ++ * P6 <------> LCD_L2 ++ * P2 <------> LCD_L3 ++ * HW connection for HOSIDEN HLM6323: ++ * P12 <------> LCD_0 ++ * P8 <------> LCD_1 ++ * P4 <------> LCD_2 ++ * P0 <------> LCD_3 ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++ ++#include ++ ++#define CONFIG_EP93XX_SDCS0 ++ ++#undef DEBUG ++#ifdef DEBUG ++#define DPRINTK( fmt, arg... ) printk( fmt, ##arg ) ++#else ++#define DPRINTK( fmt, arg... ) ++#endif ++ ++#define FBDEV_NAME "ep93xxfb" ++ ++#define ep93xxfb_lock_outl(value, reg) \ ++{ \ ++ outl(RASTER_SWLOCK_VALUE, RASTER_SWLOCK); \ ++ outl(value, reg); \ ++ DPRINTK(#reg"=0x%08x\n", (unsigned int)(value)); \ ++} ++ ++#define ep93xxfb_outl(value, reg) \ ++{ \ ++ outl(value, reg); \ ++ DPRINTK(#reg"=0x%08x\n", (unsigned int)(value)); \ ++} ++ ++static unsigned int pseudo_palette[256]; ++ ++struct ep93xxfb_mono_videomodes ++{ ++ const char *name; ++ ++ unsigned long hres; // Horizontal Valid ++ unsigned long vres; // Vertical Valid ++ unsigned int freq; ++ unsigned int dualscan; ++ unsigned int bpp; ++ unsigned int graylevel; ++ ++ void (*configure)(unsigned char value); ++ void (*on)(unsigned char value); ++ void (*off)(unsigned char value); ++}; ++ ++struct ep93xxfb_mono_info ++{ ++ dma_addr_t fb_phys; ++ void *fb_log; ++ unsigned long fb_size; ++ unsigned long fb_actsize; ++ ++ unsigned int xres; ++ unsigned int yres; ++ ++ unsigned int freq; ++ unsigned int dualscan; ++ unsigned int bpp; ++ unsigned int graylevel; ++ ++ void (*configure)(unsigned char value); ++ void (*on)(unsigned char value); ++ void (*off)(unsigned char value); ++}; ++ ++ ++void LM121VB1T01_configure(unsigned char value); ++void HOSIDEN_HLM6323_configure(unsigned char value); ++ ++static int vmode = 1; ++ ++static struct ep93xxfb_mono_info epinfo; ++static struct ep93xxfb_mono_videomodes ep93xxfb_vmods[] = ++{ ++ { ++ "SHARP-LM121VB1T01-8GRAY", ++ 640, 480, 100, ++ 1, //dual scan ++ 4, //4bpp ++ 8, //8-level grayscale ++ LM121VB1T01_configure, ++ NULL, ++ NULL, ++ }, ++ { ++ "SHARP-LM121VB1T01-16GRAY", ++ 640, 480, 120, ++ 1, //dual scan ++ 4, //4bpp ++ 16, //16-level grayscale ++ LM121VB1T01_configure, ++ NULL, ++ NULL, ++ }, ++ { ++ "HOSIDEN HLM6323", ++ 320, 240, 115, ++ 0, //single scan ++ 4, //4bpp ++ 8, //8-level grayscale ++ HOSIDEN_HLM6323_configure, ++ NULL, ++ NULL, ++ }, ++ { ++ "HOSIDEN HLM6323", ++ 320, 240, 115, ++ 0, //single scan ++ 4, //4bpp ++ 16, //16-level grayscale ++ HOSIDEN_HLM6323_configure, ++ NULL, ++ NULL, ++ }, ++}; ++ ++ ++#define EP93XX_GS_OFFSET(lut, frame, pixel) ( (lut) + ( (pixel) << 2) + ((frame) << 5 )) ++ ++static unsigned long DY_LUT[2][16]; ++ ++static unsigned long GSLUT[32] = ++{ ++ 0x00070000, 0x00070000, 0x00070000, 0x00070000, /*0%*/ ++ 0x00078241, 0x00074182, 0x00071428, 0x00072814, /*25%*/ ++ 0x00000412, 0x00000241, 0x00000124, 0x00000000, /*33%*/ ++ 0x0007aa55, 0x000755aa, 0x000755aa, 0x0007aa55, /*50%*/ ++ 0x00000bed, 0x00000dbe, 0x00000edb, 0x00000000, /*66%*/ ++ 0x00077dbe, 0x0007be7d, 0x0007ebd7, 0x0007d7eb, /*75%*/ ++ 0x0007ffff, 0x0007ffff, 0x0007ffff, 0x0007ffff, /*100%*/ ++ 0x0007ffff, 0x0007ffff, 0x0007ffff, 0x0007ffff, ++}; ++ ++static void ep93xxfb_8gray_palette_init(void) ++{ ++ unsigned int cont, i, n; ++ unsigned int frame, pixval, gslut; ++ cont = inl(LUTCONT); ++ for (i=0; i< 16; i++) ++ { ++ n = (i & 0xe) << 4; ++ outl( n, (COLOR_LUT+(i<<2)) ); ++ } ++ for (pixval=0; pixval < 8; pixval++) ++ { ++ for (frame=0; frame < 4; frame++) ++ { ++ gslut = GSLUT[pixval*4 + frame]; ++ outl(gslut,EP93XX_GS_OFFSET(GS_LUT, frame, pixval)); ++ } ++ } ++ outl( cont ^ LUTCONT_RAM1, LUTCONT ); ++} ++ ++static void ep93xxfb_16gray_palette_switch(int index) ++{ ++ unsigned int cont, i, n; ++ cont = inl(LUTCONT); ++ n = index & 0x1; ++ for (i=0; i< 16; i++) ++ { ++ outl( DY_LUT[n][i], (COLOR_LUT+(i<<2)) ); ++ } ++ outl( cont ^ LUTCONT_RAM1, LUTCONT ); ++} ++ ++static void ep93xxfb_16gray_palette_init(void) ++{ ++ int i; ++ unsigned int cont; ++ unsigned int frame, pixval, gslut; ++ int split_table[16][2] = ++ { ++ {0, 0 }, ++ {0, 2 }, ++ {1, 1 }, ++ {3, 0 }, ++ ++ {2, 2 }, ++ {4, 0 }, ++ {3, 2 }, ++ {4, 2 }, ++ ++ {3, 3 }, // {6, 0 }, ++ {3, 4 }, ++ {4, 4 }, ++ {6, 2 }, ++ ++ {5, 5 }, ++ {3, 6 }, ++ {4, 6 }, ++ {6, 6 }, ++ }; ++ ++ cont = inl(LUTCONT); ++ for (i=0; i< 16; i++) ++ { ++ DY_LUT[0][i]=split_table[i][0] << 5; ++ DY_LUT[1][i]=split_table[i][1] << 5; ++ ++ outl( DY_LUT[0][i], (COLOR_LUT+(i<<2)) ); ++ } ++ ++ for (pixval=0; pixval < 8; pixval++) ++ { ++ for (frame=0; frame < 4; frame++) ++ { ++ gslut = GSLUT[pixval*4 + frame]; ++ outl(gslut,EP93XX_GS_OFFSET(GS_LUT, frame, pixval)); ++ outl(gslut,EP93XX_GS_OFFSET(GS_LUT2, frame, pixval)); ++ outl(gslut,EP93XX_GS_OFFSET(GS_LUT3, frame, pixval)); ++ } ++ } ++ outl( cont ^ LUTCONT_RAM1, LUTCONT ); ++} ++ ++static int ep93xxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) ++{ ++ struct fb_var_screeninfo tmp_var; ++ DPRINTK("ep93xxfb_check_var - enter\n"); ++ ++ memcpy (&tmp_var, var, sizeof (tmp_var)); ++ ++ if (var->xres_virtual != var->xres) ++ var->xres_virtual = var->xres; ++ if (var->yres_virtual < var->yres) ++ var->yres_virtual = var->yres; ++ ++ if (var->xoffset < 0) ++ var->xoffset = 0; ++ if (var->yoffset < 0) ++ var->yoffset = 0; ++ ++ switch (tmp_var.bits_per_pixel) ++ { ++ case 4: ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ DPRINTK("ep93xxfb_check_var - exit\n"); ++ return 0; ++} ++ ++static int ep93xxfb_set_par(struct fb_info *info) ++{ ++ DPRINTK("ep93xxfb_set_par\n"); ++ switch (info->var.bits_per_pixel) { ++ case 4: ++ info->fix.visual = FB_VISUAL_PSEUDOCOLOR; ++ break; ++ ++ default: ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++ ++static int ep93xxfb_blank(int blank_mode,struct fb_info *info) ++{ ++ unsigned long attribs; ++ DPRINTK("ep93xxfb_blank - enter\n"); ++ attribs = inl(VIDEOATTRIBS); ++ ++ if (blank_mode) { ++ if (epinfo.off) ++ (epinfo.off)( 0 ); ++ ++ ep93xxfb_lock_outl(attribs & ~(VIDEOATTRIBS_DATAEN | ++ VIDEOATTRIBS_SYNCEN | VIDEOATTRIBS_PCLKEN | ++ VIDEOATTRIBS_EN), VIDEOATTRIBS); ++ } ++ else { ++ ++ if (epinfo.configure) ++ (epinfo.configure)( (unsigned char) epinfo.graylevel ); ++ if (epinfo.on) ++ (epinfo.on)( 0 ); ++ } ++ return 0; ++} ++ ++static void ep93xxfb_get_par(struct fb_info *info) ++{ ++ ++ DPRINTK("ep93xxfb_get_par - enter\n"); ++ ++ epinfo.configure = ep93xxfb_vmods[vmode].configure; ++ epinfo.on = ep93xxfb_vmods[vmode].on; ++ epinfo.off = ep93xxfb_vmods[vmode].off; ++ ++ epinfo.freq = ep93xxfb_vmods[vmode].freq; ++ epinfo.dualscan = ep93xxfb_vmods[vmode].dualscan; ++ epinfo.bpp = ep93xxfb_vmods[vmode].bpp; ++ epinfo.graylevel = ep93xxfb_vmods[vmode].graylevel; ++ ++ epinfo.xres = ep93xxfb_vmods[vmode].hres; ++ epinfo.yres = ep93xxfb_vmods[vmode].vres; ++ ++} ++ ++static int ep93xxfb_alloc_videomem(void) ++{ ++ unsigned long adr,size,pgsize; ++ int order; ++ ++ DPRINTK("ep93xxfb_alloc_videomem - enter \n"); ++ ++ epinfo.fb_log = NULL; ++ epinfo.fb_size = epinfo.xres*epinfo.yres*epinfo.bpp/8; ++ order = get_order( epinfo.fb_size ); ++ epinfo.fb_log = (void*) __get_free_pages( GFP_KERNEL, order ); ++ ++ if (epinfo.fb_log) { ++ epinfo.fb_phys = __virt_to_phys((int) epinfo.fb_log ); ++ adr = (unsigned long)epinfo.fb_log; ++ size = epinfo.fb_size; ++ pgsize = 1 << order; ++ do { ++ adr += pgsize; ++ SetPageReserved(virt_to_page(adr)); ++ } while(size -= pgsize); ++ } ++ else ++ return -ENOMEM; ++ ++ memset(epinfo.fb_log,0x00,epinfo.fb_size); ++ ++ DPRINTK(" fb_log_addres = 0x%x\n", (unsigned int)epinfo.fb_log); ++ DPRINTK(" fb_phys_address = 0x%x\n", (unsigned int)epinfo.fb_phys); ++ DPRINTK(" fb_size = %lu\n", (unsigned long)epinfo.fb_size); ++ DPRINTK(" fb_page_order = %d\n", (unsigned int)order); ++ DPRINTK("ep93xxfb_alloc_videomem - exit \n"); ++ return 0; ++} ++ ++static void ep93xxfb_release_videomem(void) ++{ ++ unsigned long adr,size,psize; ++ int order; ++ ++ DPRINTK("ep93xxfb_release_videomem - enter \n"); ++ if (epinfo.fb_log) { ++ order = get_order(epinfo.fb_size); ++ adr = (unsigned long)epinfo.fb_log; ++ size = epinfo.fb_size; ++ psize = 1 << order ; ++ do { ++ adr += psize; ++ ClearPageReserved(virt_to_page(adr)); ++ } while(size -= psize); ++ free_pages((unsigned long)epinfo.fb_log, order ); ++ } ++ DPRINTK("ep93xxfb_release_videomem - exit \n"); ++} ++ ++static void ep93xxfb_setinfo(struct fb_info *info) ++{ ++ ++ DPRINTK("ep93xxfb_setinfo - enter \n"); ++ info->pseudo_palette = pseudo_palette; ++ info->var.xres = epinfo.xres; ++ info->var.yres = epinfo.yres; ++ info->var.xres_virtual = epinfo.xres; ++ info->var.yres_virtual = epinfo.yres; ++ ++ info->var.bits_per_pixel = epinfo.bpp; ++ info->var.red.length = epinfo.bpp; ++ info->var.green.length = epinfo.bpp; ++ info->var.blue.length = epinfo.bpp; ++ info->fix.visual = FB_VISUAL_PSEUDOCOLOR; ++ info->var.red.offset = 0; ++ info->var.green.offset =0; ++ info->var.blue.offset = 0; ++ ++ info->fix.smem_start = epinfo.fb_phys; ++ info->fix.smem_len = epinfo.fb_size; ++ info->fix.type = FB_TYPE_PACKED_PIXELS; ++ info->fix.line_length = (epinfo.xres * epinfo.bpp) / 8; ++ info->fix.accel = FB_ACCEL_NONE; ++ info->screen_base = epinfo.fb_log; ++ info->fix.ypanstep = 1; ++ info->fix.ywrapstep = 1; ++ ++ DPRINTK("ep93xxfb_setinfo - exit \n"); ++} ++ ++static int ep93xxfb_config(struct fb_info *info) ++{ ++ DPRINTK("ep93xxfb_config - enter\n"); ++ ++ ep93xxfb_get_par( info ); ++ if( ep93xxfb_alloc_videomem() != 0 ) { ++ printk("Unable to allocate video memory\n"); ++ return -ENOMEM; ++ } ++ ++ /* set video memory parameters */ ++ ep93xxfb_outl(epinfo.fb_phys, VIDSCRNPAGE); ++ if(epinfo.dualscan) ++ { ++ ep93xxfb_outl(epinfo.fb_phys + (epinfo.bpp*epinfo.xres*epinfo.yres/16) ++ , VIDSCRNHPG); ++ } ++ ++ DPRINTK(" fb_phys = 0x%x\n", inl(VIDSCRNPAGE) ); ++ DPRINTK(" fb_phys_hpg = 0x%x\n", inl(VIDSCRNHPG)); ++ ++ ep93xxfb_outl(epinfo.yres , SCRNLINES); ++ ep93xxfb_outl(((epinfo.xres * epinfo.bpp) / 32) - 1, LINELENGTH); ++ ep93xxfb_outl((epinfo.xres * epinfo.bpp) / 32, VLINESTEP); ++ ++ if(epinfo.configure) ++ (epinfo.configure)( (unsigned char) epinfo.graylevel ); ++ ++ ep93xxfb_setinfo( info ); ++ ++ ++ DPRINTK("ep93xxfb_config - exit\n"); ++ return 0; ++} ++ ++static unsigned long ep93xx_get_pll_frequency(unsigned long pll) ++{ ++ unsigned long fb1, fb2, ipd, ps, freq; ++ ++ if (pll == 1) ++ pll = inl(EP93XX_SYSCON_CLOCK_SET1); ++ else if (pll == 2) ++ pll = inl(EP93XX_SYSCON_CLOCK_SET2); ++ else ++ return 0; ++ ++ ps = (pll & SYSCON_CLKSET1_PLL1_PS_MASK) >> SYSCON_CLKSET1_PLL1_PS_SHIFT; ++ fb1 = ((pll & SYSCON_CLKSET1_PLL1_X1FBD1_MASK) >> SYSCON_CLKSET1_PLL1_X1FBD1_SHIFT); ++ fb2 = ((pll & SYSCON_CLKSET1_PLL1_X2FBD2_MASK) >> SYSCON_CLKSET1_PLL1_X2FBD2_SHIFT); ++ ipd = ((pll & SYSCON_CLKSET1_PLL1_X2IPD_MASK) >> SYSCON_CLKSET1_PLL1_X2IPD_SHIFT); ++ ++ freq = (((0x00e10000 * (fb1+1)) / (ipd+1)) * (fb2+1)) >> ps; ++ return freq; ++} ++ ++static int ep93xx_set_video_div(unsigned long freq) ++{ ++ unsigned long pdiv = 0, div = 0, psel = 0, esel = 0; ++ unsigned long err, f, i, j, k; ++ ++ err = -1; ++ ++ for (i = 0; i < 3; i++) { ++ if (i == 0) ++ f = 14745600 * 2; ++ else if (i == 1) ++ f = ep93xx_get_pll_frequency(1) * 2; ++ else ++ f = ep93xx_get_pll_frequency(2) * 2; ++ ++ for (j = 4; j <= 6; j++) { ++ k = f / (freq * j); ++ if (k < 2) ++ continue; ++ ++ if (abs(((f / (j * k))) - freq ) < err ) { ++ pdiv = j - 3; ++ div = k; ++ psel = (i == 2) ? 1 : 0; ++ esel = (i == 0) ? 0 : 1; ++ err = (f / (j * k)) - freq; ++ } ++ } ++ } ++ ++ if (err == -1) ++ return -1; ++ ++ f = SYSCON_VIDDIV_VENA | (esel ? SYSCON_VIDDIV_ESEL : 0) | ++ (psel ? SYSCON_VIDDIV_PSEL : 0) | ++ (pdiv << SYSCON_VIDDIV_PDIV_SHIFT) | ++ (div << SYSCON_VIDDIV_VDIV_SHIFT); ++ outl(0xaa, EP93XX_SYSCON_SWLOCK); ++ outl(f, SYSCON_VIDDIV); ++ ++ return freq + err; ++} ++ ++static int interrupt_hooked = 0; ++static int vs_counter = 0; ++ ++#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17) ++static irqreturn_t ep93xxfb_irq_handler(int i, void *blah) ++#else ++static irqreturn_t ep93xxfb_irq_handler(int i, void *blah, struct pt_regs *regs) ++#endif ++{ ++ ++ outl(RASTER_SWLOCK_VALUE, RASTER_SWLOCK); ++ outl( ++#ifdef CONFIG_EP93XX_SDCS0 ++ (0 << VIDEOATTRIBS_SDSEL_SHIFT) | ++#endif ++#ifdef CONFIG_EP93XX_SDCS1 ++ (1 << VIDEOATTRIBS_SDSEL_SHIFT) | ++#endif ++#ifdef CONFIG_EP93XX_SDCS2 ++ (2 << VIDEOATTRIBS_SDSEL_SHIFT) | ++#endif ++#ifdef CONFIG_EP93XX_SDCS3 ++ (3 << VIDEOATTRIBS_SDSEL_SHIFT) | ++#endif ++ VIDEOATTRIBS_VCPOL | VIDEOATTRIBS_HSPOL | ++ VIDEOATTRIBS_DATAEN | VIDEOATTRIBS_SYNCEN | VIDEOATTRIBS_INVCLK | ++ VIDEOATTRIBS_PCLKEN | VIDEOATTRIBS_EN | VIDEOATTRIBS_INTEN , ++ VIDEOATTRIBS ); ++ ++ ep93xxfb_16gray_palette_switch(vs_counter++); ++ ++ return IRQ_HANDLED; ++} ++ ++void LM121VB1T01_configure(unsigned char value) ++{ ++ ++ int n; ++ unsigned long attribs; ++ printk("LM121VB1T01_configure\n"); ++ ++ switch(value) ++ { ++ case 8: ++ ep93xxfb_8gray_palette_init(); ++ break; ++ case 16: ++ ep93xxfb_16gray_palette_init(); ++ break; ++ default: ++ return; ++ } ++ ++ SysconSetLocked(EP93XX_SYSCON_DEVICE_CONFIG, (inl(EP93XX_SYSCON_DEVICE_CONFIG) & ~EP93XX_SYSCON_DEVICE_CONFIG_CRUNCH_ENABLE) | EP93XX_SYSCON_DEVCFG_RasOnP3); ++ ++ ep93xx_set_video_div(epinfo.freq*240*1280); ++ ++ ep93xxfb_lock_outl( 0x00000000 , VIDEOATTRIBS ); ++ ++ n = 240; ++ ep93xxfb_lock_outl( n + 3 , VLINESTOTAL ); ++ ep93xxfb_lock_outl( ((n)<<16) + n+1 , VSYNCSTRTSTOP ); ++ ep93xxfb_lock_outl( ((2)<<16) + n+2 , VACTIVESTRTSTOP ); ++ ep93xxfb_lock_outl( ((3)<<16) + n+3 , VBLANKSTRTSTOP ); ++ ep93xxfb_lock_outl( ((n+3)<<16) + n+3 , VCLKSTRTSTOP ); ++ ++ n = 1280; ++ ep93xxfb_lock_outl( n + 15 , HCLKSTOTAL ); ++ ep93xxfb_lock_outl( ((n+5)<<16) + n+ 14 , HSYNCSTRTSTOP ); ++ ep93xxfb_lock_outl( ((15)<<16) + n + 15 , HACTIVESTRTSTOP ); ++ ep93xxfb_lock_outl( ((n+15)<<16) + 15 , HBLANKSTRTSTOP ); ++ ep93xxfb_lock_outl( ((n)<<16) + n , HCLKSTRTSTOP ); ++ ++ ep93xxfb_lock_outl( 14 , LINECARRY ); ++ ++ attribs = 0; ++ ++#ifdef CONFIG_EP93XX_SDCS0 ++ attribs |= 0 << VIDEOATTRIBS_SDSEL_SHIFT; ++#endif ++#ifdef CONFIG_EP93XX_SDCS1 ++ attribs |= 1 << VIDEOATTRIBS_SDSEL_SHIFT; ++#endif ++#ifdef CONFIG_EP93XX_SDCS2 ++ attribs |= 2 << VIDEOATTRIBS_SDSEL_SHIFT; ++#endif ++#ifdef CONFIG_EP93XX_SDCS3 ++ attribs |= 3 << VIDEOATTRIBS_SDSEL_SHIFT; ++#endif ++ ++ switch(value) ++ { ++ case 8: ++ ep93xxfb_lock_outl( PIXELMODE_DSCAN | ++ PIXELMODE_S_8PPC | PIXELMODE_P_4BPP | ++ PIXELMODE_C_GSLUT , PIXELMODE ); ++ ++ ep93xxfb_lock_outl( ++ attribs | VIDEOATTRIBS_VCPOL | VIDEOATTRIBS_HSPOL | ++ VIDEOATTRIBS_DATAEN | VIDEOATTRIBS_SYNCEN | VIDEOATTRIBS_INVCLK | ++ VIDEOATTRIBS_PCLKEN | VIDEOATTRIBS_EN , ++ VIDEOATTRIBS ); ++ break; ++ case 16: ++ if(!interrupt_hooked) ++ { ++ request_irq(IRQ_EP93XX_VSYNC, ep93xxfb_irq_handler, IRQF_DISABLED, "lut switch interrupt", NULL); ++ interrupt_hooked = 1; ++ } ++ ep93xxfb_lock_outl( PIXELMODE_DSCAN | ++ PIXELMODE_S_8PPC | PIXELMODE_P_4BPP | PIXELMODE_C_GSLUT, PIXELMODE ); ++ ++ ep93xxfb_lock_outl( ++ attribs | VIDEOATTRIBS_VCPOL | VIDEOATTRIBS_HSPOL | ++ VIDEOATTRIBS_DATAEN | VIDEOATTRIBS_SYNCEN | VIDEOATTRIBS_INVCLK | ++ VIDEOATTRIBS_PCLKEN | VIDEOATTRIBS_EN | VIDEOATTRIBS_INTEN, ++ VIDEOATTRIBS ); ++ break; ++ default: ++ return; ++ } ++ ++} ++ ++void HOSIDEN_HLM6323_configure(unsigned char value) ++{ ++ int n; ++ unsigned long attribs; ++ ++ printk("HOSIDEN_HLM6323_configure\n"); ++ ++ switch(value) ++ { ++ case 8: ++ ep93xxfb_8gray_palette_init(); ++ break; ++ case 16: ++ ep93xxfb_16gray_palette_init(); ++ break; ++ default: ++ return; ++ } ++ ++ SysconSetLocked(EP93XX_SYSCON_DEVICE_CONFIG, inl(EP93XX_SYSCON_DEVICE_CONFIG) |EP93XX_SYSCON_DEVCFG_RasOnP3); ++ ++ ep93xxfb_lock_outl( 0x00000000 , VIDEOATTRIBS ); ++ ++ ep93xx_set_video_div(epinfo.freq*320*240); ++ mdelay(10); ++ ++ n = 240; ++ ep93xxfb_lock_outl( n + 3 , VLINESTOTAL ); ++ ep93xxfb_lock_outl( ((n+1)<<16) + n +2 , VSYNCSTRTSTOP ); ++ ep93xxfb_lock_outl( ((3)<<16) + n +3 , VACTIVESTRTSTOP ); ++ ep93xxfb_lock_outl( ((3)<<16) + n +3 , VBLANKSTRTSTOP ); ++ ep93xxfb_lock_outl( ((n+3)<<16) + n +3, VCLKSTRTSTOP ); ++ ++ n = 320; ++ ep93xxfb_lock_outl( n + 3, HCLKSTOTAL ); ++ ep93xxfb_lock_outl( ((n+1)<<16) + n+2 , HSYNCSTRTSTOP ); ++ ep93xxfb_lock_outl( ((3)<<16) + n+3 , HACTIVESTRTSTOP ); ++ ep93xxfb_lock_outl( ((3)<<16) + n+3 , HBLANKSTRTSTOP ); ++ ep93xxfb_lock_outl( ((n+3)<<16) + n+3 , HCLKSTRTSTOP ); ++ ++ ep93xxfb_lock_outl( 3 , LINECARRY ); ++ ++ attribs = 0; ++ ++#ifdef CONFIG_EP93XX_SDCS0 ++ attribs |= 0 << VIDEOATTRIBS_SDSEL_SHIFT; ++#endif ++#ifdef CONFIG_EP93XX_SDCS1 ++ attribs |= 1 << VIDEOATTRIBS_SDSEL_SHIFT; ++#endif ++#ifdef CONFIG_EP93XX_SDCS2 ++ attribs |= 2 << VIDEOATTRIBS_SDSEL_SHIFT; ++#endif ++#ifdef CONFIG_EP93XX_SDCS3 ++ attribs |= 3 << VIDEOATTRIBS_SDSEL_SHIFT; ++#endif ++ ++ switch(value) ++ { ++ case 8: ++ ep93xxfb_lock_outl( ++ PIXELMODE_S_4PPC | PIXELMODE_P_4BPP | PIXELMODE_C_GSLUT, PIXELMODE ); ++ ep93xxfb_lock_outl( ++ attribs | VIDEOATTRIBS_VCPOL | VIDEOATTRIBS_HSPOL | ++ VIDEOATTRIBS_DATAEN | VIDEOATTRIBS_SYNCEN | VIDEOATTRIBS_INVCLK | ++ VIDEOATTRIBS_PCLKEN | VIDEOATTRIBS_EN , ++ VIDEOATTRIBS ); ++ break; ++ case 16: ++ ep93xxfb_lock_outl( ++ PIXELMODE_S_4PPC | PIXELMODE_P_4BPP | PIXELMODE_C_GSLUT, PIXELMODE ); ++ if(!interrupt_hooked) ++ { ++ request_irq(IRQ_EP93XX_VSYNC, ep93xxfb_irq_handler, IRQF_DISABLED, "lut switch interrupt", NULL); ++ interrupt_hooked = 1; ++ } ++ ep93xxfb_lock_outl( ++ attribs | VIDEOATTRIBS_VCPOL | VIDEOATTRIBS_HSPOL | ++ VIDEOATTRIBS_DATAEN | VIDEOATTRIBS_SYNCEN | VIDEOATTRIBS_INVCLK | ++ VIDEOATTRIBS_PCLKEN | VIDEOATTRIBS_EN | VIDEOATTRIBS_INTEN, ++ VIDEOATTRIBS ); ++ break; ++ default: ++ return; ++ } ++} ++ ++#define FB_WRITEL fb_writel ++#define FB_READL fb_readl ++#define LEFT_POS(bpp) (0) ++#define SHIFT_HIGH(val, bits) ((val) << (bits)) ++#define SHIFT_LOW(val, bits) ((val) >> (bits)) ++static inline void color_imageblit(const struct fb_image *image, ++ struct fb_info *p, u8 *dst1, ++ u32 start_index, ++ u32 pitch_index) ++{ ++ /* Draw the penguin */ ++ u32 *dst, *dst2; ++ u32 color = 0, val, shift; ++ int i, n, bpp = p->var.bits_per_pixel; ++ u32 null_bits = 32 - bpp; ++ u32 *palette = (u32 *) p->pseudo_palette; ++ const u8 *src = image->data; ++ ++ dst2 = (u32 *) dst1; ++ for (i = image->height; i--; ) { ++ n = image->width; ++ dst = (u32 *) dst1; ++ shift = 0; ++ val = 0; ++ ++ if (start_index) { ++ u32 start_mask = ~(SHIFT_HIGH(~(u32)0, start_index)); ++ val = FB_READL(dst) & start_mask; ++ shift = start_index; ++ } ++ while (n--) { ++ if (p->fix.visual == FB_VISUAL_TRUECOLOR || ++ p->fix.visual == FB_VISUAL_DIRECTCOLOR ) ++ color = palette[*src]; ++ else ++ color = *src; ++ color <<= LEFT_POS(bpp); ++ val |= SHIFT_HIGH(color, shift); ++ if (shift >= null_bits) { ++ FB_WRITEL(val, dst++); ++ ++ val = (shift == null_bits) ? 0 : ++ SHIFT_LOW(color, 32 - shift); ++ } ++ shift += bpp; ++ shift &= (32 - 1); ++ src++; ++ } ++ if (shift) { ++ u32 end_mask = SHIFT_HIGH(~(u32)0, shift); ++ ++ FB_WRITEL((FB_READL(dst) & end_mask) | val, dst); ++ } ++ dst1 += p->fix.line_length; ++ if (pitch_index) { ++ dst2 += p->fix.line_length; ++ dst1 = (u8 *)((long __force)dst2 & ~(sizeof(u32) - 1)); ++ ++ start_index += pitch_index; ++ start_index &= 32 - 1; ++ } ++ } ++} ++ ++static const int reversebit[]= ++{ ++ 7, 6, 5, 4, 3, 2, 1, 0, ++ 15,14,13,12,11,10, 9, 8, ++ 23,22,21,20,19,18,17,16, ++ 31,30,29,28,27,26,25,24, ++}; ++static inline void slow_imageblit(const struct fb_image *image, struct fb_info *p, ++ u8 *dst1, u32 fgcolor, ++ u32 bgcolor, ++ u32 start_index, ++ u32 pitch_index) ++{ ++ u32 shift, color = 0, bpp = p->var.bits_per_pixel; ++ u32 *dst, *dst2; ++ u32 val, pitch = p->fix.line_length; ++ u32 null_bits = 32 - bpp; ++ u32 spitch = (image->width+7)/8; ++ const u8 *src = image->data, *s; ++ u32 i, j, l; ++ ++ dst2 = (u32 *) dst1; ++ fgcolor <<= LEFT_POS(bpp); ++ bgcolor <<= LEFT_POS(bpp); ++ for (i = image->height; i--; ) { ++ shift = val = 0; ++ l = 8; ++ j = image->width; ++ dst = (u32 *) dst1; ++ s = src; ++ ++ /* write leading bits */ ++ if (start_index) { ++ u32 start_mask = ~(SHIFT_HIGH(~(u32)0,start_index)); ++ val = FB_READL(dst) & start_mask; ++ shift = start_index; ++ } ++ ++ while (j--) { ++ l--; ++ color = (*s & (1 << l)) ? fgcolor : bgcolor; ++ val |= SHIFT_HIGH(color, reversebit[shift]); ++ /* Did the bitshift spill bits to the next long? */ ++ if (shift >= null_bits) { ++ FB_WRITEL(val, dst++); ++ val = (shift == null_bits) ? 0 : ++ SHIFT_LOW(color, 32 - reversebit[shift]); ++ } ++ shift += bpp; ++ shift &= (32 - 1); ++ if (!l) { l = 8; s++; }; ++ } ++ ++ /* write trailing bits */ ++ if (shift) { ++ u32 end_mask = SHIFT_HIGH(~(u32)0, shift); ++ ++ FB_WRITEL((FB_READL(dst) & end_mask) | val, dst); ++ } ++ ++ dst1 += pitch; ++ src += spitch; ++ if (pitch_index) { ++ dst2 += pitch; ++ dst1 = (u8 *)((long __force)dst2 & ~(sizeof(u32) - 1)); ++ start_index += pitch_index; ++ start_index &= 32 - 1; ++ } ++ ++ } ++} ++ ++static void ep93xx_imageblit(struct fb_info *p, const struct fb_image *image) ++{ ++ u32 fgcolor, bgcolor, start_index, bitstart, pitch_index = 0; ++ u32 bpl = sizeof(u32), bpp = p->var.bits_per_pixel; ++ u32 dx = image->dx, dy = image->dy; ++ u8 *dst1; ++ ++ if (p->state != FBINFO_STATE_RUNNING) ++ return; ++ ++ bitstart = (dy * p->fix.line_length * 8) + (dx * bpp); ++ start_index = bitstart & (32 - 1); ++ pitch_index = (p->fix.line_length & (bpl - 1)) * 8; ++ ++ bitstart /= 8; ++ bitstart &= ~(bpl - 1); ++ dst1 = p->screen_base + bitstart; ++ ++ if (p->fbops->fb_sync) ++ p->fbops->fb_sync(p); ++ ++ if (image->depth == 1) { ++ if (p->fix.visual == FB_VISUAL_TRUECOLOR || ++ p->fix.visual == FB_VISUAL_DIRECTCOLOR) { ++ fgcolor = ((u32*)(p->pseudo_palette))[image->fg_color]; ++ bgcolor = ((u32*)(p->pseudo_palette))[image->bg_color]; ++ } else { ++ fgcolor = image->fg_color; ++ bgcolor = image->bg_color; ++ } ++ slow_imageblit(image, p, dst1, fgcolor, bgcolor, ++ start_index, pitch_index); ++ } else ++ color_imageblit(image, p, dst1, start_index, pitch_index); ++} ++ ++ ++#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8) ++ ++int ep93xxfb_ioctl(struct fb_info *info,unsigned int cmd, unsigned long arg) ++{ ++ return 0; ++} ++ ++static int ep93xxfb_mmap(struct fb_info *info,struct vm_area_struct *vma) ++{ ++ unsigned long off, start, len; ++ ++ DPRINTK("ep93xxfb_mmap - enter\n"); ++ ++ off = vma->vm_pgoff << PAGE_SHIFT; ++ start = info->fix.smem_start; ++ len = PAGE_ALIGN(start & ~PAGE_MASK) + info->fix.smem_len; ++ start &= PAGE_MASK; ++ if ((vma->vm_end - vma->vm_start + off) > len) ++ return -EINVAL; ++ ++ off += start; ++ vma->vm_pgoff = off >> PAGE_SHIFT; ++ ++ vma->vm_flags |= VM_IO; ++ vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); ++ ++ if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, ++ vma->vm_end - vma->vm_start, vma->vm_page_prot)) { ++ DPRINTK("ep93xxfb_mmap error\n"); ++ return -EAGAIN; ++ } ++ ++ DPRINTK("ep93xxfb_mmap - exit\n"); ++ return 0; ++} ++ ++ ++static struct fb_ops ep93xxfb_ops = { ++ .owner = THIS_MODULE, ++ .fb_check_var = ep93xxfb_check_var, ++ .fb_set_par = ep93xxfb_set_par, ++ .fb_blank = ep93xxfb_blank, ++ .fb_fillrect = cfb_fillrect, ++ .fb_copyarea = cfb_copyarea, ++ // .fb_imageblit = cfb_imageblit, ++ .fb_imageblit = ep93xx_imageblit, ++ .fb_ioctl = ep93xxfb_ioctl, ++ .fb_mmap = ep93xxfb_mmap, ++}; ++ ++ ++static struct resource ep93xxfb_raster_resources = { ++ .start = EP93XX_RASTER_PHYS_BASE, ++ .end = EP93XX_RASTER_PHYS_BASE + 0x1ffff, ++ .flags = IORESOURCE_MEM, ++}; ++ ++ ++static int __init ep93xxfb_probe(struct platform_device *device) ++{ ++ struct fb_info *info = NULL; ++ struct resource *res = NULL; ++ int ret = 0; ++ int arb = 0; ++ ++ DPRINTK("ep93xxfb_probe - enter \n"); ++ ++ if(!device) { ++ printk("error : to_platform_device\n"); ++ return -ENODEV; ++ } ++ res = platform_get_resource( device, IORESOURCE_MEM, 0); ++ if(!res) { ++ printk("error : platform_get_resource \n"); ++ return -ENODEV; ++ } ++ if (!request_mem_region(res->start,res->end - res->start + 1, FBDEV_NAME )) ++ return -EBUSY; ++ ++ info = framebuffer_alloc(sizeof(u32) * 256, &device->dev); ++ ++ if(!info) { ++ printk("Unable to allocate memory for frame buffer\n"); ++ return -ENOMEM; ++ } ++ ++ info->flags = FBINFO_DEFAULT; ++ strncpy(info->fix.id, FBDEV_NAME, sizeof(info->fix.id)); ++ info->fix.mmio_start = res->start; ++ info->fix.mmio_len = res->end - res->start + 1; ++ info->fbops = &ep93xxfb_ops; ++ info->pseudo_palette = info->par; ++ info->state = FBINFO_STATE_RUNNING; ++ ++ printk("mmio_start = 0x%08x\n", res->start); ++ printk("mmio_len = 0x%08x\n", res->end - res->start + 1); ++ ++ if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { ++ ret = -ENOMEM; ++ goto fbuff; ++ } ++ ++ if ((ret = ep93xxfb_config(info)) < 0) ++ goto clmap; ++ ++ if (register_framebuffer(info) < 0) { ++ printk(KERN_ERR "Unable to register ep93xxfb frame buffer\n"); ++ ret = -EINVAL; ++ goto clmap; ++ } ++ platform_set_drvdata(device, info); ++ printk(KERN_INFO "fb%d: EP93xx frame buffer at %dx%dx%dbpp\n", info->node, ++ info->var.xres, info->var.yres, info->var.bits_per_pixel); ++ ++ /*change the raster arb to the highest one--Bo*/ ++ arb = inl(EP93XX_SYSCON_BMAR); ++ arb = (arb & 0x3f8) | 0x01; ++ ep93xxfb_outl(arb,EP93XX_SYSCON_BMAR); ++ ++ DPRINTK("ep93xxfb_probe - exit \n"); ++ return 0; ++ ++clmap: ++ fb_dealloc_cmap(&info->cmap); ++ ++fbuff: ++ framebuffer_release(info); ++ return ret; ++} ++ ++static int ep93xxfb_remove(struct platform_device *device) ++{ ++ struct resource *res; ++ struct fb_info *info; ++ ++ DPRINTK("ep93xxfb_remove - enter \n"); ++ ++ info = platform_get_drvdata(device); ++ ++ ep93xxfb_release_videomem(); ++ ++ res = platform_get_resource( device, IORESOURCE_MEM, 0); ++ release_mem_region(res->start, res->end - res->start + 1); ++ ++ platform_set_drvdata(device, NULL); ++ unregister_framebuffer(info); ++ ++ fb_dealloc_cmap(&info->cmap); ++ framebuffer_release(info); ++ ++ ep93xxfb_blank( 1, info ); ++ ++ DPRINTK("ep93xxfb_remove - exit \n"); ++ return 0; ++} ++ ++static void ep93xxfb_platform_release(struct device *device) ++{ ++ DPRINTK("ep93xxfb_platform_release - enter\n"); ++} ++ ++ ++static struct platform_driver ep93xxfb_driver = { ++ .probe = ep93xxfb_probe, ++ .remove = ep93xxfb_remove, ++ .driver = { ++ .name = FBDEV_NAME, ++ }, ++}; ++ ++static struct platform_device ep93xxfb_device = { ++ .name = FBDEV_NAME, ++ .id = -1, ++ .dev = { ++ .release = ep93xxfb_platform_release, ++ }, ++ .num_resources = 1, ++ .resource = &ep93xxfb_raster_resources, ++}; ++ ++int __init ep93xxfb_init(void) ++{ ++ int ret = 0; ++ ++ DPRINTK("ep93xxfb_init - enter\n"); ++ ++ ret = platform_driver_register(&ep93xxfb_driver); ++ ++ if (!ret) { ++ ret = platform_device_register(&ep93xxfb_device); ++ if (ret) ++ platform_driver_unregister(&ep93xxfb_driver); ++ } ++ DPRINTK("ep93xxfb_init - exit\n"); ++ return ret; ++} ++ ++static void __exit ep93xxfb_exit(void) ++{ ++ DPRINTK("ep93xxfb_exit - enter\n"); ++ platform_driver_unregister(&ep93xxfb_driver); ++ platform_device_unregister(&ep93xxfb_device); ++ DPRINTK("ep93xxfb_exit - exit\n"); ++} ++ ++#else // LINUX_VERSION_CODE ++ ++ ++int ep93xxfb_setcolreg(unsigned regno, unsigned red, unsigned green, ++ unsigned blue, unsigned transp, ++ struct fb_info *info) ++{ ++ return 0; ++} ++static struct fb_ops ep93xxfb_ops = { ++ .owner = THIS_MODULE, ++ .fb_setcolreg = ep93xxfb_setcolreg, ++ .fb_check_var = ep93xxfb_check_var, ++ .fb_set_par = ep93xxfb_set_par, ++ .fb_blank = ep93xxfb_blank, ++ .fb_fillrect = cfb_fillrect, ++ .fb_copyarea = cfb_copyarea, ++ .fb_imageblit = ep93xx_imageblit, ++ .fb_cursor = soft_cursor, ++}; ++ ++static int __init ep93xxfb_probe(struct device *device) ++{ ++ struct platform_device *pdev = to_platform_device(device); ++ struct fb_info *info = NULL; ++ struct resource *res = NULL; ++ int ret = 0; ++ int arb = 0; ++ ++ DPRINTK("ep93xxfb_probe - enter \n"); ++ ++ ++ if(!device) { ++ printk("error : to_platform_device\n"); ++ return -ENODEV; ++ } ++ res = platform_get_resource( pdev, IORESOURCE_MEM, 0); ++ if(!res) { ++ printk("error : platform_get_resource \n"); ++ return -ENODEV; ++ } ++ if (!request_mem_region(res->start,res->end - res->start + 1, FBDEV_NAME )) ++ return -EBUSY; ++ ++ info = framebuffer_alloc(sizeof(u32) * 256, &pdev->dev); ++ ++ if(!info) { ++ printk("Unable to allocate memory for frame buffer\n"); ++ return -ENOMEM; ++ } ++ ++ info->flags = FBINFO_DEFAULT; ++ strncpy(info->fix.id, FBDEV_NAME, sizeof(info->fix.id)); ++ info->fix.mmio_start = res->start; ++ info->fix.mmio_len = res->end - res->start + 1; ++ info->fbops = &ep93xxfb_ops; ++ info->pseudo_palette = info->par; ++ info->state = FBINFO_STATE_RUNNING; ++ ++ if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { ++ ret = -ENOMEM; ++ goto fbuff; ++ } ++ ++ if ((ret = ep93xxfb_config(info)) < 0) ++ goto clmap; ++ ++ if (register_framebuffer(info) < 0) { ++ printk(KERN_ERR "Unable to register ep93xxfb frame buffer\n"); ++ ret = -EINVAL; ++ goto clmap; ++ } ++ dev_set_drvdata(device, info); ++ printk(KERN_INFO "fb%d: EP93xx frame buffer at %dx%dx%dbpp\n", info->node, ++ info->var.xres, info->var.yres, info->var.bits_per_pixel); ++ ++ /*change the raster arb to the highest one--Bo*/ ++ arb = inl(EP93XX_SYSCON_BMAR); ++ arb = (arb & 0x3f8) | 0x01; ++ ep93xxfb_outl(arb,EP93XX_SYSCON_BMAR); ++ ++ DPRINTK("ep93xxfb_probe - exit \n"); ++ return 0; ++ ++clmap: ++ fb_dealloc_cmap(&info->cmap); ++ ++fbuff: ++ framebuffer_release(info); ++ return ret; ++} ++ ++static int ep93xxfb_remove(struct device *device) ++{ ++ struct platform_device *pdev = to_platform_device(device); ++ struct resource *res; ++ struct fb_info *info; ++ ++ DPRINTK("ep93xxfb_remove - enter \n"); ++ ++ info = dev_get_drvdata(device); ++ ++ ep93xxfb_release_videomem(); ++ ++ res = platform_get_resource( pdev, IORESOURCE_MEM, 0); ++ release_mem_region(res->start, res->end - res->start + 1); ++ ++ dev_set_drvdata(device, NULL); ++ unregister_framebuffer(info); ++ ++ fb_dealloc_cmap(&info->cmap); ++ framebuffer_release(info); ++ ++ ep93xxfb_blank( 1, info ); ++ ++ DPRINTK("ep93xxfb_remove - exit \n"); ++ return 0; ++} ++static struct device_driver ep93xxfb_driver = { ++ .name = FBDEV_NAME, ++ .bus = &platform_bus_type, ++ .probe = ep93xxfb_probe, ++ .remove = ep93xxfb_remove, ++}; ++int __init ep93xxfb_init(void) ++{ ++ DPRINTK("ep93xxfb_init\n"); ++ return driver_register(&ep93xxfb_driver); ++} ++ ++static void __exit ep93xxfb_exit(void) ++{ ++ DPRINTK("ep93xxfb_exit\n"); ++ return driver_unregister(&ep93xxfb_driver); ++} ++ ++int __init ep93xxfb_setup(char *options) ++{ ++ DPRINTK("ep93xxfb_setup\n"); ++ return 0; ++} ++ ++#endif // LINUX_VERSION_CODE ++ ++ ++module_init(ep93xxfb_init); ++module_exit(ep93xxfb_exit); ++MODULE_AUTHOR("John Zheng "); ++MODULE_LICENSE("GPL"); ++ +--- a/arch/arm/mach-ep93xx/include/mach/hardware.h ++++ b/arch/arm/mach-ep93xx/include/mach/hardware.h +@@ -7,6 +7,7 @@ + #include "ep93xx-regs.h" + + #define pcibios_assign_all_busses() 0 ++#include "regs_raster.h" + #include "regs_touch.h" + + #include "platform.h" +--- a/arch/arm/mach-ep93xx/include/mach/irqs.h ++++ b/arch/arm/mach-ep93xx/include/mach/irqs.h +@@ -34,7 +34,8 @@ + #define IRQ_EP93XX_UART3TX 28 + #define IRQ_EP93XX_KEY 29 + #define IRQ_EP93XX_TOUCH 30 +-#define EP93XX_VIC1_VALID_IRQ_MASK 0x7ffffffc ++#define IRQ_EP93XX_GRAPHICS 31 ++#define EP93XX_VIC1_VALID_IRQ_MASK 0xfffffffc + + #define IRQ_EP93XX_EXT0 32 + #define IRQ_EP93XX_EXT1 33 +--- /dev/null ++++ b/arch/arm/mach-ep93xx/include/mach/regs_raster.h +@@ -0,0 +1,347 @@ ++/*============================================================================= ++ * ++ * FILE: regs_raster.h ++ * ++ * DESCRIPTION: ep93xx Raster Engine Register Definition ++ * ++ * Copyright Cirrus Logic, 2001-2003 ++ * ++ * 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 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * ++ *============================================================================= ++ */ ++#ifndef _REGS_RASTER_H_ ++#define _REGS_RASTER_H_ ++ ++//----------------------------------------------------------------------------- ++// VLINESTOTAL Register Definitions ++//----------------------------------------------------------------------------- ++#define VLINESTOTAL_MASK 0x000007ff ++ ++//----------------------------------------------------------------------------- ++// VSYNCSTRTSTOP Register Definitions ++//----------------------------------------------------------------------------- ++#define VSYNCSTRTSTOP_STRT_MASK 0x07ff0000 ++#define VSYNCSTRTSTOP_STRT_SHIFT 0 ++#define VSYNCSTRTSTOP_STOP_MASK 0x000007ff ++#define VSYNCSTRTSTOP_STOP_SHIFT 16 ++ ++//----------------------------------------------------------------------------- ++// VACTIVESTRTSTOP Register Definitions ++//----------------------------------------------------------------------------- ++#define VACTIVESTRTSTOP_STRT_MASK 0x07ff0000 ++#define VACTIVESTRTSTOP_STRT_SHIFT 0 ++#define VACTIVESTRTSTOP_STOP_MASK 0x000007ff ++#define VACTIVESTRTSTOP_STOP_SHIFT 16 ++ ++//----------------------------------------------------------------------------- ++// VCLKSTRTSTOP Register Definitions ++//----------------------------------------------------------------------------- ++#define VCLKSTRTSTOP_STRT_MASK 0x07ff0000 ++#define VCLKSTRTSTOP_STRT_SHIFT 0 ++#define VCLKSTRTSTOP_STOP_MASK 0x000007ff ++#define VCLKSTRTSTOP_STOP_SHIFT 16 ++ ++//----------------------------------------------------------------------------- ++// VBLANKSTRTSTOP Register Definitions ++//----------------------------------------------------------------------------- ++#define VBLANKSTRTSTOP_STRT_MASK 0x07ff0000 ++#define VBLANKSTRTSTOP_STRT_SHIFT 0 ++#define VBLANKSTRTSTOP_STOP_MASK 0x000007ff ++#define VBLANKSTRTSTOP_STOP_SHIFT 16 ++ ++//----------------------------------------------------------------------------- ++// HSYNCSTRTSTOP Register Definitions ++//----------------------------------------------------------------------------- ++#define HSYNCSTRTSTOP_STRT_MASK 0x07ff0000 ++#define HSYNCSTRTSTOP_STRT_SHIFT 0 ++#define HSYNCSTRTSTOP_STOP_MASK 0x000007ff ++#define HSYNCSTRTSTOP_STOP_SHIFT 16 ++ ++//----------------------------------------------------------------------------- ++// HACTIVESTRTSTOP Register Definitions ++//----------------------------------------------------------------------------- ++#define HACTIVESTRTSTOP_STRT_MASK 0x07ff0000 ++#define HACTIVESTRTSTOP_STRT_SHIFT 0 ++#define HACTIVESTRTSTOP_STOP_MASK 0x000007ff ++#define HACTIVESTRTSTOP_STOP_SHIFT 16 ++ ++//----------------------------------------------------------------------------- ++// HCLKSTRTSTOP Register Definitions ++//----------------------------------------------------------------------------- ++#define HCLKSTRTSTOP_STRT_MASK 0x07ff0000 ++#define HCLKSTRTSTOP_STRT_SHIFT 0 ++#define HCLKSTRTSTOP_STOP_MASK 0x000007ff ++#define HCLKSTRTSTOP_STOP_SHIFT 16 ++ ++//----------------------------------------------------------------------------- ++// BRIGHTNESS Register Definitions ++//----------------------------------------------------------------------------- ++#define BRIGHTNESS_MASK 0x0000ffff ++#define BRIGHTNESS_CNT_MASK 0x000000ff ++#define BRIGHTNESS_CNT_SHIFT 0 ++#define BRIGHTNESS_CMP_MASK 0x0000ff00 ++#define BRIGHTNESS_CMP_SHIFT 8 ++ ++//----------------------------------------------------------------------------- ++// VIDEOATTRIBS Register Definitions ++//----------------------------------------------------------------------------- ++#define VIDEOATTRIBS_MASK 0x001fffff ++#define VIDEOATTRIBS_EN 0x00000001 ++#define VIDEOATTRIBS_PCLKEN 0x00000002 ++#define VIDEOATTRIBS_SYNCEN 0x00000004 ++#define VIDEOATTRIBS_DATAEN 0x00000008 ++#define VIDEOATTRIBS_CSYNC 0x00000010 ++#define VIDEOATTRIBS_VCPOL 0x00000020 ++#define VIDEOATTRIBS_HSPOL 0x00000040 ++#define VIDEOATTRIBS_BLKPOL 0x00000080 ++#define VIDEOATTRIBS_INVCLK 0x00000100 ++#define VIDEOATTRIBS_ACEN 0x00000200 ++#define VIDEOATTRIBS_LCDEN 0x00000400 ++#define VIDEOATTRIBS_CCIREN 0x00001000 ++#define VIDEOATTRIBS_PIFEN 0x00002000 ++#define VIDEOATTRIBS_INTEN 0x00004000 ++#define VIDEOATTRIBS_INT 0x00008000 ++#define VIDEOATTRIBS_INTRLC 0x00010000 ++#define VIDEOATTRIBS_EQUSER 0x00020000 ++#define VIDEOATTRIBS_DHORZ 0x00040000 ++#define VIDEOATTRIBS_DVERT 0x00080000 ++#define VIDEOATTRIBS_BKPXD 0x00100000 ++ ++#define VIDEOATTRIBS_SDSEL_MASK 0x00600000 ++#define VIDEOATTRIBS_SDSEL_SHIFT 21 ++ ++//----------------------------------------------------------------------------- ++// HBLANKSTRTSTOP Register Definitions ++//----------------------------------------------------------------------------- ++#define HBLANKSTRTSTOP_STRT_MASK 0x07ff0000 ++#define HBLANKSTRTSTOP_STRT_SHIFT 0 ++#define HBLANKSTRTSTOP_STOP_MASK 0x000007ff ++#define HBLANKSTRTSTOP_STOP_SHIFT 16 ++ ++//----------------------------------------------------------------------------- ++// LINECARRY Register Definitions ++//----------------------------------------------------------------------------- ++#define LINECARRY_LCARY_MASK 0x000007ff ++#define LINECARRY_LCARY_SHIFT 0 ++ ++//----------------------------------------------------------------------------- ++// BLINKRATE Register Definitons ++//----------------------------------------------------------------------------- ++#define BLINKRATE_MASK 0x000000ff ++ ++//----------------------------------------------------------------------------- ++// BLINKMASK Register Definitons ++//----------------------------------------------------------------------------- ++#define BLINKMASK_MASK 0x00ffffff ++ ++//----------------------------------------------------------------------------- ++// VIDSCRNPAGE Register Definitons ++//----------------------------------------------------------------------------- ++#define VIDSCRNPAGE_PAGE_MASK 0x0ffffffc ++ ++//----------------------------------------------------------------------------- ++// VIDSCRNHPG Register Definitons ++//----------------------------------------------------------------------------- ++#define VIDSCRNHPG_MASK 0x0ffffffc ++ ++//----------------------------------------------------------------------------- ++// SCRNLINES Register Definitons ++//----------------------------------------------------------------------------- ++#define SCRNLINES_MASK 0x000007ff ++ ++//----------------------------------------------------------------------------- ++// LINELENGTH Register Definitons ++//----------------------------------------------------------------------------- ++#define LINELENGTH_MASK 0x000007ff ++ ++//----------------------------------------------------------------------------- ++// VLINESTEP Register Definitons ++//----------------------------------------------------------------------------- ++#define VLINESTEP_MASK 0x00000fff ++ ++//----------------------------------------------------------------------------- ++// RASTER_SWLOCK Register Definitons ++//----------------------------------------------------------------------------- ++#define RASTER_SWLOCK_MASK_WR 0xff ++#define RASTER_SWLOCK_MASK_R 0x1 ++#define RASTER_SWLOCK_VALUE 0xaa ++ ++//----------------------------------------------------------------------------- ++// LUTCONT Register Definitions ++//----------------------------------------------------------------------------- ++#define LUTCONT_MASK 0x00000003 ++#define LUTCONT_SWTCH 0x00000001 ++#define LUTCONT_STAT 0x00000002 ++#define LUTCONT_RAM0 0 ++#define LUTCONT_RAM1 1 ++ ++//----------------------------------------------------------------------------- ++// CURSORBLINK1 Register Definitions ++//----------------------------------------------------------------------------- ++#define CURSORBLINK1_MASK 0x00ffffff ++//----------------------------------------------------------------------------- ++// CURSORBLINK2 Register Definitions ++//----------------------------------------------------------------------------- ++#define CURSORBLINK2_MASK 0x00ffffff ++ ++//----------------------------------------------------------------------------- ++// CURSORBLINK Register Definitions ++//----------------------------------------------------------------------------- ++#define CURSORBLINK_MASK 0x000001ff ++#define CURSORBLINK_RATE_MASK 0x000000ff ++#define CURSORBLINK_RATE_SHIFT 0 ++#define CURSORBLINK_EN 0x00000100 ++ ++//----------------------------------------------------------------------------- ++// BLINKPATRN Register Definitions ++//----------------------------------------------------------------------------- ++#define BLINKPATRN_MASK 0x00ffffff ++ ++//----------------------------------------------------------------------------- ++// PATRNMASK Register Definitions ++//----------------------------------------------------------------------------- ++#define PATRNMASK_MASK 0x00ffffff ++ ++//----------------------------------------------------------------------------- ++// BG_OFFSET Register Definitions ++//----------------------------------------------------------------------------- ++#define BG_OFFSET_MASK 0x00ffffff ++ ++//----------------------------------------------------------------------------- ++// PIXELMODE Register Definitions ++//----------------------------------------------------------------------------- ++#define PIXELMODE_P_MASK 0x00000007 ++#define PIXELMODE_P_MUX_DISABLE 0x00000000 ++#define PIXELMODE_P_4BPP 0x00000001 ++#define PIXELMODE_P_8BPP 0x00000002 ++#define PIXELMODE_P_16BPP 0x00000004 ++#define PIXELMODE_P_24BPP 0x00000006 ++#define PIXELMODE_P_32BPP 0x00000007 ++ ++#define PIXELMODE_S_MASK 0x00000038 ++#define PIXELMODE_S_1PPC 0x00000000 ++#define PIXELMODE_S_1PPCMAPPED 0x00000008 ++#define PIXELMODE_S_2PPC 0x00000010 ++#define PIXELMODE_S_4PPC 0x00000018 ++#define PIXELMODE_S_8PPC 0x00000020 ++#define PIXELMODE_S_223PPC 0x00000028 ++#define PIXELMODE_S_DS223PPC 0x00000030 ++#define PIXELMODE_S_UNDEF 0x00000038 ++ ++#define PIXELMODE_M_MASK 0x000003c0 ++#define PIXELMODE_M_NOBLINK 0x00000000 ++#define PIXELMODE_M_ANDBLINK 0x00000040 ++#define PIXELMODE_M_ORBLINK 0x00000080 ++#define PIXELMODE_M_XORBLINK 0x000000c0 ++#define PIXELMODE_M_BGBLINK 0x00000100 ++#define PIXELMODE_M_OFFSINGBLINK 0x00000140 ++#define PIXELMODE_M_OFF888BLINK 0x00000180 ++#define PIXELMODE_M_DIMBLINK 0x00000300 ++#define PIXELMODE_M_BRTBLINK 0x00000340 ++#define PIXELMODE_M_DIM888BLINK 0x00000380 ++#define PIXELMODE_M_BRT888BLINK 0x000003c0 ++ ++#define PIXELMODE_C_MASK 0x00003c00 ++#define PIXELMODE_C_LUT 0x00000000 ++#define PIXELMODE_C_888 0x00001000 ++#define PIXELMODE_C_565 0x00001400 ++#define PIXELMODE_C_555 0x00001800 ++#define PIXELMODE_C_GSLUT 0x00002000 ++ ++#define PIXELMODE_DSCAN 0x00004000 ++#define PIXELMODE_TRBSW 0x00008000 ++ ++//----------------------------------------------------------------------------- ++//PARLLIFOUT Register Defintions ++//----------------------------------------------------------------------------- ++#define PARLLIFOUT_DAT_MASK 0x0000000f ++#define PARLLIFOUT_DAT_SHIFT 0 ++#define PARLLIFOUT_RD 0x00000010 ++ ++//----------------------------------------------------------------------------- ++//PARLLIFIN Register Defintions ++//----------------------------------------------------------------------------- ++#define PARLLIFIN_DAT_MASK 0x0000000f ++#define PARLLIFIN_DAT_SHIFT 0 ++#define PARLLIFIN_CNT_MASK 0x000f0000 ++#define PARLLIFIN_CNT_SHIFT 16 ++#define PARLLIFIN_ESTRT_MASK 0x00f00000 ++#define PARLLIFIN_ESTRT_SHIFT 20 ++ ++//----------------------------------------------------------------------------- ++// CURSORADRSTART Register Defintions ++//----------------------------------------------------------------------------- ++#define CURSOR_ADR_START_MASK 0xfffffffc ++ ++//----------------------------------------------------------------------------- ++// CURSORADRSTART Register Defintions ++//----------------------------------------------------------------------------- ++#define CURSOR_ADR_RESET_MASK 0xfffffffc ++ ++//----------------------------------------------------------------------------- ++// CURSORCOLOR1 Register Definitions ++//----------------------------------------------------------------------------- ++#define CURSORCOLOR1_MASK 0x00ffffff ++//----------------------------------------------------------------------------- ++// CURSORCOLOR2 Register Definitions ++//----------------------------------------------------------------------------- ++#define CURSORCOLOR2_MASK 0x00ffffff ++ ++//----------------------------------------------------------------------------- ++// CURSORXYLOC Register Definitions ++//----------------------------------------------------------------------------- ++#define CURSORXYLOC_MASK 0x07ff87ff ++#define CURSORXYLOC_XLOC_MASK 0x000007ff ++#define CURSORXYLOC_XLOC_SHIFT 0 ++#define CURSORXYLOC_CEN 0x00008000 ++#define CURSORXYLOC_YLOC_MASK 0x07ff0000 ++#define CURSORXYLOC_YLOC_SHIFT 16 ++ ++//----------------------------------------------------------------------------- ++// CURSOR_DSCAN_LH_YLOC Register Definitions ++//----------------------------------------------------------------------------- ++#define CURSOR_DSCAN_LH_YLOC_MASK 0x000087ff ++ ++#define CURSOR_DSCAN_LH_YLOC_YLOC_MASK 0x000007ff ++#define CURSOR_DSCAN_LH_YLOC_YLOC_SHIFT 0 ++#define CURSOR_DSCAN_LH_YLOC_CLHEN 0x00008000 ++ ++//----------------------------------------------------------------------------- ++// CURSORSIZE Register Definitions ++//----------------------------------------------------------------------------- ++#define CURSORSIZE_MASK 0x0000ffff ++ ++#define CURSORSIZE_CWID_MASK 0x00000003 ++#define CURSORSIZE_CWID_SHIFT 0 ++#define CURSORSIZE_CWID_1_WORD 0 ++#define CURSORSIZE_CWID_2_WORD 1 ++#define CURSORSIZE_CWID_3_WORD 2 ++#define CURSORSIZE_CWID_4_WORD 3 ++ ++#define CURSORSIZE_CLINS_MASK 0x000000fc ++#define CURSORSIZE_CLINS_SHIFT 2 ++ ++#define CURSORSIZE_CSTEP_MASK 0x00000300 ++#define CURSORSIZE_CSTEP_SHIFT 8 ++#define CURSORSIZE_CSTEP_1_WORD 0 ++#define CURSORSIZE_CSTEP_2_WORD 1 ++#define CURSORSIZE_CSTEP_3_WORD 2 ++#define CURSORSIZE_CSTEP_4_WORD 3 ++ ++#define CURSORSIZE_DLNS_MASK 0x0000fc00 ++#define CURSORSIZE_DLNS_SHIFT 10 ++ ++#endif /* _REGS_RASTER_H_ */ diff --git a/target/linux/ep93xx/patches-2.6.30/010-ep93xx-snd-ac97.patch b/target/linux/ep93xx/patches-2.6.30/010-ep93xx-snd-ac97.patch new file mode 100644 index 000000000..36f316be1 --- /dev/null +++ b/target/linux/ep93xx/patches-2.6.30/010-ep93xx-snd-ac97.patch @@ -0,0 +1,3808 @@ +--- a/arch/arm/mach-ep93xx/include/mach/hardware.h ++++ b/arch/arm/mach-ep93xx/include/mach/hardware.h +@@ -5,6 +5,7 @@ + #define __ASM_ARCH_HARDWARE_H + + #include "ep93xx-regs.h" ++#include "regs_ac97.h" + + #define pcibios_assign_all_busses() 0 + #include "regs_raster.h" +--- /dev/null ++++ b/arch/arm/mach-ep93xx/include/mach/regs_ac97.h +@@ -0,0 +1,180 @@ ++/*============================================================================= ++ * FILE: regs_ac97.h ++ * ++ * DESCRIPTION: Ac'97 Register Definition ++ * ++ * Copyright Cirrus Logic, 2001-2003 ++ * ++ * 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 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ *============================================================================= ++ */ ++#ifndef _REGS_AC97_H_ ++#define _REGS_AC97_H_ ++ ++//----------------------------------------------------------------------------- ++// Bit definitionses ++//----------------------------------------------------------------------------- ++#define AC97ISR_RIS 8 ++#define AC97ISR_TIS 4 ++#define AC97ISR_RTIS 2 ++#define AC97ISR_TCIS 1 ++ ++#define AC97RGIS_SLOT1TXCOMPLETE 0x01 ++#define AC97RGIS_SLOT2RXVALID 0x02 ++#define AC97RGIS_GPIOTXCOMPLETE 0x04 ++#define AC97RGIS_GPIOINTRX 0x08 ++#define AC97RGIS_RWIS 0x10 ++#define AC97RGIS_CODECREADY 0x20 ++#define AC97RGIS_SLOT2TXCOMPLETE 0x40 ++ ++#define AC97SR_RXFE 0x0001 ++#define AC97SR_TXFE 0x0002 ++#define AC97SR_RXFF 0x0004 ++#define AC97SR_TXFF 0x0008 ++#define AC97SR_TXBUSY 0x0010 ++#define AC97SR_RXOE 0x0020 ++#define AC97SR_TXUE 0x0040 ++ ++#define AC97GSR_IFE 0x1 ++#define AC97GSR_LOOP 0x2 ++#define AC97GSR_OVERRIDECODECREADY 0x4 ++ ++#define AC97RESET_TIMEDRESET 0x1 ++#define AC97RESET_FORCEDRESET 0x2 ++#define AC97RESET_EFORCER 0x4 ++ ++#define AC97RXCR_REN 0x1 ++ ++#define AC97TXCR_TEN 0x1 ++ ++ ++//**************************************************************************** ++// ++// The Ac97 Codec registers, accessable through the Ac-link. ++// These are not controller registers and are not memory mapped. ++// Includes registers specific to CS4202 (Beavis). ++// ++//**************************************************************************** ++#define AC97_REG_OFFSET_MASK 0x0000007E ++ ++#define AC97_00_RESET 0x00000000 ++#define AC97_02_MASTER_VOL 0x00000002 ++#define AC97_04_HEADPHONE_VOL 0x00000004 ++#define AC97_06_MONO_VOL 0x00000006 ++#define AC97_08_TONE 0x00000008 ++#define AC97_0A_PC_BEEP_VOL 0x0000000A ++#define AC97_0C_PHONE_VOL 0x0000000C ++#define AC97_0E_MIC_VOL 0x0000000E ++#define AC97_10_LINE_IN_VOL 0x00000010 ++#define AC97_12_CD_VOL 0x00000012 ++#define AC97_14_VIDEO_VOL 0x00000014 ++#define AC97_16_AUX_VOL 0x00000016 ++#define AC97_18_PCM_OUT_VOL 0x00000018 ++#define AC97_1A_RECORD_SELECT 0x0000001A ++#define AC97_1C_RECORD_GAIN 0x0000001C ++#define AC97_1E_RESERVED_1E 0x0000001E ++#define AC97_20_GENERAL_PURPOSE 0x00000020 ++#define AC97_22_3D_CONTROL 0x00000022 ++#define AC97_24_MODEM_RATE 0x00000024 ++#define AC97_26_POWERDOWN 0x00000026 ++#define AC97_28_EXT_AUDIO_ID 0x00000028 ++#define AC97_2A_EXT_AUDIO_POWER 0x0000002A ++#define AC97_2C_PCM_FRONT_DAC_RATE 0x0000002C ++#define AC97_2E_PCM_SURR_DAC_RATE 0x0000002E ++#define AC97_30_PCM_LFE_DAC_RATE 0x00000030 ++#define AC97_32_PCM_LR_ADC_RATE 0x00000032 ++#define AC97_34_MIC_ADC_RATE 0x00000034 ++#define AC97_36_6CH_VOL_C_LFE 0x00000036 ++#define AC97_38_6CH_VOL_SURROUND 0x00000038 ++#define AC97_3A_SPDIF_CONTROL 0x0000003A ++#define AC97_3C_EXT_MODEM_ID 0x0000003C ++#define AC97_3E_EXT_MODEM_POWER 0x0000003E ++#define AC97_40_LINE1_CODEC_RATE 0x00000040 ++#define AC97_42_LINE2_CODEC_RATE 0x00000042 ++#define AC97_44_HANDSET_CODEC_RATE 0x00000044 ++#define AC97_46_LINE1_CODEC_LEVEL 0x00000046 ++#define AC97_48_LINE2_CODEC_LEVEL 0x00000048 ++#define AC97_4A_HANDSET_CODEC_LEVEL 0x0000004A ++#define AC97_4C_GPIO_PIN_CONFIG 0x0000004C ++#define AC97_4E_GPIO_PIN_TYPE 0x0000004E ++#define AC97_50_GPIO_PIN_STICKY 0x00000050 ++#define AC97_52_GPIO_PIN_WAKEUP 0x00000052 ++#define AC97_54_GPIO_PIN_STATUS 0x00000054 ++#define AC97_56_RESERVED 0x00000056 ++#define AC97_58_RESERVED 0x00000058 ++#define AC97_5A_CRYSTAL_REV_N_FAB_ID 0x0000005A ++#define AC97_5C_TEST_AND_MISC_CTRL 0x0000005C ++#define AC97_5E_AC_MODE 0x0000005E ++#define AC97_60_MISC_CRYSTAL_CONTROL 0x00000060 ++#define AC97_62_VENDOR_RESERVED 0x00000062 ++#define AC97_64_DAC_SRC_PHASE_INCR 0x00000064 ++#define AC97_66_ADC_SRC_PHASE_INCR 0x00000066 ++#define AC97_68_RESERVED_68 0x00000068 ++#define AC97_6A_SERIAL_PORT_CONTROL 0x0000006A ++#define AC97_6C_VENDOR_RESERVED 0x0000006C ++#define AC97_6E_VENDOR_RESERVED 0x0000006E ++#define AC97_70_BDI_CONFIG 0x00000070 ++#define AC97_72_BDI_WAKEUP 0x00000072 ++#define AC97_74_VENDOR_RESERVED 0x00000074 ++#define AC97_76_CAL_ADDRESS 0x00000076 ++#define AC97_78_CAL_DATA 0x00000078 ++#define AC97_7A_VENDOR_RESERVED 0x0000007A ++#define AC97_7C_VENDOR_ID1 0x0000007C ++#define AC97_7E_VENDOR_ID2 0x0000007E ++ ++ ++#ifndef __ASSEMBLY__ ++ ++// ++// enum type for use with reg AC97_RECORD_SELECT ++// ++typedef enum{ ++ RECORD_MIC = 0x0000, ++ RECORD_CD = 0x0101, ++ RECORD_VIDEO_IN = 0x0202, ++ RECORD_AUX_IN = 0x0303, ++ RECORD_LINE_IN = 0x0404, ++ RECORD_STEREO_MIX = 0x0505, ++ RECORD_MONO_MIX = 0x0606, ++ RECORD_PHONE_IN = 0x0707 ++} Ac97RecordSources; ++ ++#endif /* __ASSEMBLY__ */ ++ ++// ++// Sample rates supported directly in AC97_PCM_FRONT_DAC_RATE and ++// AC97_PCM_LR_ADC_RATE. ++// ++#define Ac97_Fs_8000 0x1f40 ++#define Ac97_Fs_11025 0x2b11 ++#define Ac97_Fs_16000 0x3e80 ++#define Ac97_Fs_22050 0x5622 ++#define Ac97_Fs_32000 0x7d00 ++#define Ac97_Fs_44100 0xac44 ++#define Ac97_Fs_48000 0xbb80 ++ ++// ++// RSIZE and TSIZE in AC97RXCR and AC97TXCR ++// ++#define Ac97_SIZE_20 2 ++#define Ac97_SIZE_18 1 ++#define Ac97_SIZE_16 0 ++#define Ac97_SIZE_12 3 ++ ++//============================================================================= ++//============================================================================= ++ ++ ++#endif /* _REGS_AC97_H_ */ +--- a/sound/arm/Kconfig ++++ b/sound/arm/Kconfig +@@ -11,6 +11,23 @@ menuconfig SND_ARM + + if SND_ARM + ++config SND_EP93XX_AC97 ++ tristate "AC97 driver for the Cirrus EP93xx chip" ++ depends on ARCH_EP93XX && SND ++ select SND_EP93XX_PCM ++ select SND_AC97_CODEC ++ help ++ Say Y here to use AC'97 audio with a Cirrus Logic EP93xx chip. ++ ++ To compile this driver as a module, choose M here: the module ++ will be called snd-ep93xx-ac97. ++ ++config SND_EP93XX_PCM ++ tristate ++ select SND_PCM ++ help ++ Generic PCM module for EP93xx ++ + config SND_ARMAACI + tristate "ARM PrimeCell PL041 AC Link support" + depends on ARM_AMBA +--- a/sound/arm/Makefile ++++ b/sound/arm/Makefile +@@ -5,6 +5,9 @@ + obj-$(CONFIG_SND_ARMAACI) += snd-aaci.o + snd-aaci-objs := aaci.o devdma.o + ++obj-$(CONFIG_SND_EP93XX_AC97) += snd-ep93xx-ac97.o ++snd-ep93xx-ac97-objs := ep93xx-ac97.o ++ + obj-$(CONFIG_SND_PXA2XX_PCM) += snd-pxa2xx-pcm.o + snd-pxa2xx-pcm-objs := pxa2xx-pcm.o + +--- /dev/null ++++ b/sound/arm/ep93xx-ac97.c +@@ -0,0 +1,3482 @@ ++/* ++ * linux/sound/arm/ep93xx-ac97.c -- ALSA PCM interface for the edb93xx ac97 audio ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include "ep93xx-ac97.h" ++ ++#define DRIVER_VERSION "01/05/2009" ++#define DRIVER_DESC "EP93xx AC97 Audio driver" ++static int ac_link_enabled = 0; ++static int codec_supported_mixers; ++ ++//#define DEBUG 1 ++#ifdef DEBUG ++#define DPRINTK( fmt, arg... ) printk( fmt, ##arg ) ++#else ++#define DPRINTK( fmt, arg... ) ++#endif ++ ++#define WL16 0 ++#define WL24 1 ++ ++#define AUDIO_NAME "ep93xx-ac97" ++#define AUDIO_SAMPLE_RATE_DEFAULT 44100 ++#define AUDIO_DEFAULT_VOLUME 0 ++#define AUDIO_MAX_VOLUME 181 ++#define AUDIO_DEFAULT_DMACHANNELS 3 ++#define PLAYBACK_DEFAULT_DMACHANNELS 3 ++#define CAPTURE_DEFAULT_DMACHANNELS 3 ++ ++#define CHANNEL_FRONT (1<<0) ++#define CHANNEL_REAR (1<<1) ++#define CHANNEL_CENTER_LFE (1<<2) ++ ++static void snd_ep93xx_dma_tx_callback( ep93xx_dma_int_t DMAInt, ++ ep93xx_dma_dev_t device, ++ unsigned int user_data); ++static void snd_ep93xx_dma_rx_callback( ep93xx_dma_int_t DMAInt, ++ ep93xx_dma_dev_t device, ++ unsigned int user_data); ++ ++static const struct snd_pcm_hardware ep93xx_ac97_pcm_hardware = { ++ ++ ++ .info = ( SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_PAUSE ), ++ .formats = ( SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S8 | ++ SNDRV_PCM_FMTBIT_U16_LE | SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_U16_BE | SNDRV_PCM_FMTBIT_S16_BE | ++ SNDRV_PCM_FMTBIT_U32_LE | SNDRV_PCM_FMTBIT_S32_LE | ++ SNDRV_PCM_FMTBIT_U32_BE | SNDRV_PCM_FMTBIT_S32_BE ), ++ .rates = ( SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | ++ SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | ++ SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | ++ SNDRV_PCM_RATE_48000 ), ++ .rate_min = 8000, ++ .rate_max = 48000, ++ .channels_min = 1,/*2,*/ ++ .channels_max = 2, ++ ++ .period_bytes_min = 1 * 1024, ++ .period_bytes_max = 32 * 1024, ++ .periods_min = 1, ++ .periods_max = 32, ++ .buffer_bytes_max = 32 * 1024, ++ .fifo_size = 0, ++}; ++ ++static audio_stream_t output_stream; ++static audio_stream_t input_stream; ++ ++static audio_state_t audio_state = ++{ ++ .output_stream =&output_stream, ++ .output_dma[0] =DMATx_AAC1, ++ .output_id[0] ="Ac97 out", ++ ++ .input_stream =&input_stream, ++ .input_dma[0] =DMARx_AAC1, ++ .input_id[0] ="Ac97 in", ++ ++ .sem = __SEMAPHORE_INIT(audio_state.sem,1), ++ .codec_set_by_playback = 0, ++ .codec_set_by_capture = 0, ++ .DAC_bit_width =16, ++ .bCompactMode =0, ++}; ++ ++ ++ ++/* ++ * peek ++ * ++ * Reads an AC97 codec register. Returns -1 if there was an error. ++ */ ++static int peek(unsigned int uiAddress) ++{ ++ unsigned int uiAC97RGIS; ++ ++ if( !ac_link_enabled ) ++ { ++ printk("ep93xx ac97 peek: attempt to peek before enabling ac-link.\n"); ++ return -1; ++ } ++ ++ /* ++ * Check to make sure that the address is aligned on a word boundary ++ * and is 7E or less. ++ */ ++ if( ((uiAddress & 0x1)!=0) || (uiAddress > 0x007e)) ++ { ++ return -1; ++ } ++ ++ /* ++ * How it is supposed to work is: ++ * - The ac97 controller sends out a read addr in slot 1. ++ * - In the next frame, the codec will echo that address back in slot 1 ++ * and send the data in slot 2. SLOT2RXVALID will be set to 1. ++ * ++ * Read until SLOT2RXVALID goes to 1. Reading the data in AC97S2DATA ++ * clears SLOT2RXVALID. ++ */ ++ ++ /* ++ * First, delay one frame in case of back to back peeks/pokes. ++ */ ++ mdelay( 1 ); ++ ++ /* ++ * Write the address to AC97S1DATA, delay 1 frame, read the flags. ++ */ ++ outl( uiAddress, AC97S1DATA); ++ udelay( 21 * 4 ); ++ uiAC97RGIS = inl( AC97RGIS ); ++ ++ /* ++ * Return error if we timed out. ++ */ ++ if( ((uiAC97RGIS & AC97RGIS_SLOT1TXCOMPLETE) == 0 ) && ++ ((uiAC97RGIS & AC97RGIS_SLOT2RXVALID) == 0 ) ) ++ { ++ printk( "ep93xx-ac97 - peek failed reading reg 0x%02x.\n", uiAddress ); ++ return -1; ++ } ++ ++ return ( inl(AC97S2DATA) & 0x000fffff); ++} ++ ++/* ++ * poke ++ * ++ * Writes an AC97 codec Register. Return -1 if error. ++ */ ++static int poke(unsigned int uiAddress, unsigned int uiValue) ++{ ++ unsigned int uiAC97RGIS; ++ ++ if( !ac_link_enabled ) ++ { ++ printk("ep93xx ac97 poke: attempt to poke before enabling ac-link.\n"); ++ return -1; ++ } ++ ++ /* ++ * Check to make sure that the address is align on a word boundary and ++ * is 7E or less. And that the value is a 16 bit value. ++ */ ++ if( ((uiAddress & 0x1)!=0) || (uiAddress > 0x007e)) ++ { ++ printk("ep93xx ac97 poke: address error.\n"); ++ return -1; ++ } ++ ++ /*stop the audio loop from the input to the output directly*/ ++ ++ if((uiAddress==AC97_0E_MIC_VOL)||(uiAddress==AC97_10_LINE_IN_VOL)) ++ { ++ uiValue = (uiValue | 0x8000); ++ ++ } ++ ++ /* ++ * First, delay one frame in case of back to back peeks/pokes. ++ */ ++ mdelay( 1 ); ++ ++ /* ++ * Write the data to AC97S2DATA, then the address to AC97S1DATA. ++ */ ++ outl( uiValue, AC97S2DATA ); ++ outl( uiAddress, AC97S1DATA ); ++ ++ /* ++ * Wait for the tx to complete, get status. ++ */ ++ udelay( 30 );/*21*/ ++ uiAC97RGIS = inl(AC97RGIS); ++ ++ /* ++ * Return error if we timed out. ++ */ ++ if( !(inl(AC97RGIS) & AC97RGIS_SLOT1TXCOMPLETE) ) ++ { ++ printk( "ep93xx-ac97: poke failed writing reg 0x%02x value 0x%02x.\n", uiAddress, uiValue ); ++ return -1; ++ } ++ ++ return 0; ++} ++ ++ ++/* ++ * When we get to the multichannel case the pre-fill and enable code ++ * will go to the dma driver's start routine. ++ */ ++static void ep93xx_audio_enable( int input_or_output_stream ) ++{ ++ unsigned int uiTemp; ++ ++ DPRINTK("ep93xx_audio_enable :%x\n",input_or_output_stream); ++ ++ /* ++ * Enable the rx or tx channel depending on the value of ++ * input_or_output_stream ++ */ ++ if( input_or_output_stream ) ++ { ++ uiTemp = inl(AC97TXCR1); ++ outl( (uiTemp | AC97TXCR_TEN), AC97TXCR1 ); ++ } ++ else ++ { ++ uiTemp = inl(AC97RXCR1); ++ outl( (uiTemp | AC97RXCR_REN), AC97RXCR1 ); ++ } ++ ++ ++ //DDEBUG("ep93xx_audio_enable - EXIT\n"); ++} ++ ++static void ep93xx_audio_disable( int input_or_output_stream ) ++{ ++ unsigned int uiTemp; ++ ++ DPRINTK("ep93xx_audio_disable\n"); ++ ++ /* ++ * Disable the rx or tx channel depending on the value of ++ * input_or_output_stream ++ */ ++ if( input_or_output_stream ) ++ { ++ uiTemp = inl(AC97TXCR1); ++ outl( (uiTemp & ~AC97TXCR_TEN), AC97TXCR1 ); ++ } ++ else ++ { ++ uiTemp = inl(AC97RXCR1); ++ outl( (uiTemp & ~AC97RXCR_REN), AC97RXCR1 ); ++ } ++ ++ //DDEBUG("ep93xx_audio_disable - EXIT\n"); ++} ++ ++ ++ ++/*=======================================================================================*/ ++/* ++ * ep93xx_setup_src ++ * ++ * Once the ac-link is up and all is good, we want to set the codec to a ++ * usable mode. ++ */ ++static void ep93xx_setup_src(void) ++{ ++ int iTemp; ++ ++ /* ++ * Set the VRA bit to enable the SRC. ++ */ ++ iTemp = peek( AC97_2A_EXT_AUDIO_POWER ); ++ poke( AC97_2A_EXT_AUDIO_POWER, (iTemp | 0x1) ); ++ ++ /* ++ * Set the DSRC/ASRC bits to enable the variable rate SRC. ++ */ ++ iTemp = peek( AC97_60_MISC_CRYSTAL_CONTROL ); ++ poke( AC97_60_MISC_CRYSTAL_CONTROL, (iTemp | 0x0300) ); ++} ++ ++/* ++ * ep93xx_set_samplerate ++ * ++ * lFrequency - Sample Rate in Hz ++ * bCapture - 0 to set Tx sample rate; 1 to set Rx sample rate ++ */ ++static void ep93xx_set_samplerate( long lSampleRate, int bCapture ) ++{ ++ unsigned short usDivider, usPhase; ++ ++ DPRINTK( "ep93xx_set_samplerate - Fs = %d\n", (int)lSampleRate ); ++ ++ if( (lSampleRate < 7200) || (lSampleRate > 48000) ) ++ { ++ printk( "ep93xx_set_samplerate - invalid Fs = %d\n", ++ (int)lSampleRate ); ++ return; ++ } ++ ++ /* ++ * Calculate divider and phase increment. ++ * ++ * divider = round( 0x1770000 / lSampleRate ) ++ * Note that usually rounding is done by adding 0.5 to a floating ++ * value and then truncating. To do this without using floating ++ * point, I multiply the fraction by two, do the division, then add one, ++ * then divide the whole by 2 and then truncate. ++ * Same effect, no floating point math. ++ * ++ * Ph incr = trunc( (0x1000000 / usDivider) + 1 ) ++ */ ++ ++ usDivider = (unsigned short)( ((2 * 0x1770000 / lSampleRate) + 1) / 2 ); ++ ++ usPhase = (0x1000000 / usDivider) + 1; ++ ++ /* ++ * Write them in the registers. Spec says divider must be ++ * written after phase incr. ++ */ ++ if(!bCapture) ++ { ++ poke( AC97_2C_PCM_FRONT_DAC_RATE, usDivider); ++ poke( AC97_64_DAC_SRC_PHASE_INCR, usPhase); ++ } ++ else ++ { ++ ++ poke( AC97_32_PCM_LR_ADC_RATE, usDivider); ++ poke( AC97_66_ADC_SRC_PHASE_INCR, usPhase); ++ } ++ ++ DPRINTK( "ep93xx_set_samplerate - phase = %d, divider = %d\n", ++ (unsigned int)usPhase, (unsigned int)usDivider ); ++ ++ /* ++ * We sorta should report the actual samplerate back to the calling ++ * application. But some applications freak out if they don't get ++ * exactly what they asked for. So we fudge and tell them what ++ * they want to hear. ++ */ ++ //audio_samplerate = lSampleRate; ++ ++ DPRINTK( "ep93xx_set_samplerate - EXIT\n" ); ++} ++ ++/* ++ * ep93xx_set_hw_format ++ * ++ * Sets up whether the controller is expecting 20 bit data in 32 bit words ++ * or 16 bit data compacted to have a stereo sample in each 32 bit word. ++ */ ++static void ep93xx_set_hw_format( long format,long channel ) ++{ ++ int bCompactMode; ++ ++ switch( format ) ++ { ++ /* ++ * Here's all the <=16 bit formats. We can squeeze both L and R ++ * into one 32 bit sample so use compact mode. ++ */ ++ case SNDRV_PCM_FORMAT_U8: ++ case SNDRV_PCM_FORMAT_S8: ++ case SNDRV_PCM_FORMAT_S16_LE: ++ case SNDRV_PCM_FORMAT_U16_LE: ++ bCompactMode = 1; ++ break; ++ ++ /* ++ * Add any other >16 bit formats here... ++ */ ++ case SNDRV_PCM_FORMAT_S32_LE: ++ default: ++ bCompactMode = 0; ++ break; ++ } ++ ++ if( bCompactMode ) ++ { ++ DPRINTK("ep93xx_set_hw_format - Setting serial mode to 16 bit compact.\n"); ++ ++ /* ++ * Turn on Compact Mode so we can fit each stereo sample into ++ * a 32 bit word. Twice as efficent for DMA and FIFOs. ++ */ ++ if(channel==2){ ++ outl( 0x00008018, AC97RXCR1 ); ++ outl( 0x00008018, AC97TXCR1 ); ++ } ++ else { ++ outl( 0x00008018, AC97RXCR1 ); ++ outl( 0x00008018, AC97TXCR1 ); ++ } ++ ++ ++ audio_state.DAC_bit_width = 16; ++ audio_state.bCompactMode = 1; ++ } ++ else ++ { ++ DPRINTK("ep93xx_set_hw_format - Setting serial mode to 20 bit non-CM.\n"); ++ ++ /* ++ * Turn off Compact Mode so we can do > 16 bits per channel ++ */ ++ if(channel==2){ ++ outl( 0x00004018, AC97RXCR1 ); ++ outl( 0x00004018, AC97TXCR1 ); ++ } ++ else{ ++ outl( 0x00004018, AC97RXCR1 ); ++ outl( 0x00004018, AC97TXCR1 ); ++ } ++ ++ audio_state.DAC_bit_width = 20; ++ audio_state.bCompactMode = 0; ++ } ++ ++} ++ ++/* ++ * ep93xx_stop_loop ++ * ++ * Once the ac-link is up and all is good, we want to set the codec to a ++ * usable mode. ++ */ ++static void ep93xx_stop_loop(void) ++{ ++ int iTemp; ++ ++ /* ++ * Set the AC97_0E_MIC_VOL MUTE bit to enable the LOOP. ++ */ ++ iTemp = peek( AC97_0E_MIC_VOL ); ++ poke( AC97_0E_MIC_VOL, (iTemp | 0x8000) ); ++ ++ /* ++ * Set the AC97_10_LINE_IN_VOL MUTE bit to enable the LOOP. ++ */ ++ iTemp = peek( AC97_10_LINE_IN_VOL ); ++ poke( AC97_10_LINE_IN_VOL, (iTemp | 0x8000) ); ++} ++ ++/* ++ * ep93xx_init_ac97_controller ++ * ++ * This routine sets up the Ac'97 Controller. ++ */ ++static void ep93xx_init_ac97_controller(void) ++{ ++ unsigned int uiDEVCFG, uiTemp; ++ ++ DPRINTK("ep93xx_init_ac97_controller - enter\n"); ++ ++ /* ++ * Configure the multiplexed Ac'97 pins to be Ac97 not I2s. ++ * Configure the EGPIO4 and EGPIO6 to be GPIOS, not to be ++ * SDOUT's for the second and third I2S controller channels. ++ */ ++ uiDEVCFG = inl(EP93XX_SYSCON_DEVICE_CONFIG); ++ ++ uiDEVCFG &= ~(EP93XX_SYSCON_DEVCFG_CONFIG_I2SONAC97 | ++ EP93XX_SYSCON_DEVCFG_A1onG | ++ EP93XX_SYSCON_DEVCFG_A2onG); ++ ++ SysconSetLocked(EP93XX_SYSCON_DEVICE_CONFIG, uiDEVCFG); ++ ++ /* ++ * Disable the AC97 controller internal loopback. ++ * Disable Override codec ready. ++ */ ++ outl( 0, AC97GCR ); ++ ++ /* ++ * Enable the AC97 Link. ++ */ ++ uiTemp = inl(AC97GCR); ++ outl( (uiTemp | AC97GSR_IFE), AC97GCR ); ++ ++ /* ++ * Set the TIMEDRESET bit. Will cause a > 1uSec reset of the ac-link. ++ * This bit is self resetting. ++ */ ++ outl( AC97RESET_TIMEDRESET, AC97RESET ); ++ ++ /* ++ * Delay briefly, but let's not hog the processor. ++ */ ++ set_current_state(TASK_INTERRUPTIBLE); ++ schedule_timeout( 5 ); /* 50 mSec */ ++ ++ /* ++ * Read the AC97 status register to see if we've seen a CODECREADY ++ * signal from the AC97 codec. ++ */ ++ if( !(inl(AC97RGIS) & AC97RGIS_CODECREADY)) ++ { ++ printk( "ep93xx-ac97 - FAIL: CODECREADY still low!\n"); ++ return; ++ } ++ ++ /* ++ * Delay for a second, not hogging the processor ++ */ ++ set_current_state(TASK_INTERRUPTIBLE); ++ schedule_timeout( HZ ); /* 1 Sec */ ++ ++ /* ++ * Now the Ac-link is up. We can read and write codec registers. ++ */ ++ ac_link_enabled = 1; ++ ++ /* ++ * Set up the rx and tx channels ++ * Set the CM bit, data size=16 bits, enable tx slots 3 & 4. ++ */ ++ ep93xx_set_hw_format( EP93XX_DEFAULT_FORMAT,EP93XX_DEFAULT_NUM_CHANNELS ); ++ ++ DPRINTK( "ep93xx-ac97 -- AC97RXCR1: %08x\n", inl(AC97RXCR1) ); ++ DPRINTK( "ep93xx-ac97 -- AC97TXCR1: %08x\n", inl(AC97TXCR1) ); ++ ++ DPRINTK("ep93xx_init_ac97_controller - EXIT - success\n"); ++ ++} ++ ++#ifdef alsa_ac97_debug ++static void ep93xx_dump_ac97_regs(void) ++{ ++ int i; ++ unsigned int reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7; ++ ++ DPRINTK( "---------------------------------------------\n"); ++ DPRINTK( " : 0 2 4 6 8 A C E\n" ); ++ ++ for( i=0 ; i < 0x80 ; i+=0x10 ) ++ { ++ reg0 = 0xffff & (unsigned int)peek( i ); ++ reg1 = 0xffff & (unsigned int)peek( i + 0x2 ); ++ reg2 = 0xffff & (unsigned int)peek( i + 0x4 ); ++ reg3 = 0xffff & (unsigned int)peek( i + 0x6 ); ++ reg4 = 0xffff & (unsigned int)peek( i + 0x8 ); ++ reg5 = 0xffff & (unsigned int)peek( i + 0xa ); ++ reg6 = 0xffff & (unsigned int)peek( i + 0xc ); ++ reg7 = 0xffff & (unsigned int)peek( i + 0xe ); ++ ++ DPRINTK( " %02x : %04x %04x %04x %04x %04x %04x %04x %04x\n", ++ i, reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7); ++ } ++ ++ DPRINTK( "---------------------------------------------\n"); ++} ++#endif ++ ++ ++#define supported_mixer(FOO) \ ++ ( (FOO >= 0) && \ ++ (FOO < SOUND_MIXER_NRDEVICES) && \ ++ codec_supported_mixers & (1< ac97 quickly. */ ++enum ac97_recsettings ++{ ++ AC97_REC_MIC=0, ++ AC97_REC_CD, ++ AC97_REC_VIDEO, ++ AC97_REC_AUX, ++ AC97_REC_LINE, ++ AC97_REC_STEREO, /* combination of all enabled outputs.. */ ++ AC97_REC_MONO, /*.. or the mono equivalent */ ++ AC97_REC_PHONE ++}; ++ ++static const unsigned int ac97_rm2oss[] = ++{ ++ [AC97_REC_MIC] = SOUND_MIXER_MIC, ++ [AC97_REC_CD] = SOUND_MIXER_CD, ++ [AC97_REC_VIDEO] = SOUND_MIXER_VIDEO, ++ [AC97_REC_AUX] = SOUND_MIXER_LINE1, ++ [AC97_REC_LINE] = SOUND_MIXER_LINE, ++ [AC97_REC_STEREO]= SOUND_MIXER_IGAIN, ++ [AC97_REC_PHONE] = SOUND_MIXER_PHONEIN ++}; ++ ++/* indexed by bit position */ ++static const unsigned int ac97_oss_rm[] = ++{ ++ [SOUND_MIXER_MIC] = AC97_REC_MIC, ++ [SOUND_MIXER_CD] = AC97_REC_CD, ++ [SOUND_MIXER_VIDEO] = AC97_REC_VIDEO, ++ [SOUND_MIXER_LINE1] = AC97_REC_AUX, ++ [SOUND_MIXER_LINE] = AC97_REC_LINE, ++ [SOUND_MIXER_IGAIN] = AC97_REC_STEREO, ++ [SOUND_MIXER_PHONEIN] = AC97_REC_PHONE ++}; ++ ++ ++/* ++ * ep93xx_write_mixer ++ * ++ */ ++static void ep93xx_write_mixer ++( ++ int oss_channel, ++ unsigned int left, ++ unsigned int right ++) ++{ ++ u16 val = 0; ++ ac97_mixer_hw_t * mh = &ac97_hw[oss_channel]; ++ ++ DPRINTK("ac97_codec: wrote OSS %2d (ac97 0x%02x), " ++ "l:%2d, r:%2d:", ++ oss_channel, mh->offset, left, right); ++ ++ if( !mh->scale ) ++ { ++ printk( "ep93xx-ac97.c: ep93xx_write_mixer - not a valid OSS channel\n"); ++ return; ++ } ++ ++ if( AC97_STEREO_MASK & (1 << oss_channel) ) ++ { ++ /* stereo mixers */ ++ if (left == 0 && right == 0) ++ { ++ val = 0x8000; ++ } ++ else ++ { ++ if (oss_channel == SOUND_MIXER_IGAIN) ++ { ++ right = (right * mh->scale) / 100; ++ left = (left * mh->scale) / 100; ++ if (right >= mh->scale) ++ right = mh->scale-1; ++ if (left >= mh->scale) ++ left = mh->scale-1; ++ } ++ else ++ { ++ right = ((100 - right) * mh->scale) / 100; ++ left = ((100 - left) * mh->scale) / 100; ++ if (right >= mh->scale) ++ right = mh->scale-1; ++ if (left >= mh->scale) ++ left = mh->scale-1; ++ } ++ val = (left << 8) | right; ++ } ++ } ++ else if(left == 0) ++ { ++ val = 0x8000; ++ } ++ else if( (oss_channel == SOUND_MIXER_SPEAKER) || ++ (oss_channel == SOUND_MIXER_PHONEIN) || ++ (oss_channel == SOUND_MIXER_PHONEOUT) ) ++ { ++ left = ((100 - left) * mh->scale) / 100; ++ if (left >= mh->scale) ++ left = mh->scale-1; ++ val = left; ++ } ++ else if (oss_channel == SOUND_MIXER_MIC) ++ { ++ val = peek( mh->offset) & ~0x801f; ++ left = ((100 - left) * mh->scale) / 100; ++ if (left >= mh->scale) ++ left = mh->scale-1; ++ val |= left; ++ } ++ /* ++ * For bass and treble, the low bit is optional. Masking it ++ * lets us avoid the 0xf 'bypass'. ++ * Do a read, modify, write as we have two contols in one reg. ++ */ ++ else if (oss_channel == SOUND_MIXER_BASS) ++ { ++ val = peek( mh->offset) & ~0x0f00; ++ left = ((100 - left) * mh->scale) / 100; ++ if (left >= mh->scale) ++ left = mh->scale-1; ++ val |= (left << 8) & 0x0e00; ++ } ++ else if (oss_channel == SOUND_MIXER_TREBLE) ++ { ++ val = peek( mh->offset) & ~0x000f; ++ left = ((100 - left) * mh->scale) / 100; ++ if (left >= mh->scale) ++ left = mh->scale-1; ++ val |= left & 0x000e; ++ } ++ ++ DPRINTK(" 0x%04x", val); ++ ++ poke( mh->offset, val ); ++ ++#ifdef alsa_ac97_debug ++ val = peek( mh->offset ); ++ DEBUG(" -> 0x%04x\n", val); ++#endif ++ ++} ++ ++/* a thin wrapper for write_mixer */ ++static void ep93xx_set_mixer ++( ++ unsigned int oss_mixer, ++ unsigned int val ++) ++{ ++ unsigned int left,right; ++ ++ /* cleanse input a little */ ++ right = ((val >> 8) & 0xff) ; ++ left = (val & 0xff) ; ++ ++ if (right > 100) right = 100; ++ if (left > 100) left = 100; ++ ++ /*mixer_state[oss_mixer] = (right << 8) | left;*/ ++ ep93xx_write_mixer( oss_mixer, left, right); ++} ++ ++static void ep93xx_init_mixer(void) ++{ ++ u16 cap; ++ int i; ++ ++ /* mixer masks */ ++ codec_supported_mixers = AC97_SUPPORTED_MASK; ++ ++ cap = peek( AC97_00_RESET ); ++ if( !(cap & 0x04) ) ++ { ++ codec_supported_mixers &= ~(SOUND_MASK_BASS|SOUND_MASK_TREBLE); ++ } ++ if( !(cap & 0x10) ) ++ { ++ codec_supported_mixers &= ~SOUND_MASK_ALTPCM; ++ } ++ ++ /* ++ * Detect bit resolution of output volume controls by writing to the ++ * 6th bit (not unmuting yet) ++ */ ++ poke( AC97_02_MASTER_VOL, 0xa020 ); ++ if( peek( AC97_02_MASTER_VOL) != 0xa020 ) ++ { ++ ac97_hw[SOUND_MIXER_VOLUME].scale = 32; ++ } ++ ++ poke( AC97_04_HEADPHONE_VOL, 0xa020 ); ++ if( peek( AC97_04_HEADPHONE_VOL) != 0xa020 ) ++ { ++ ac97_hw[AC97_04_HEADPHONE_VOL].scale = 32; ++ } ++ ++ poke( AC97_06_MONO_VOL, 0x8020 ); ++ if( peek( AC97_06_MONO_VOL) != 0x8020 ) ++ { ++ ac97_hw[AC97_06_MONO_VOL].scale = 32; ++ } ++ ++ /* initialize mixer channel volumes */ ++ for( i = 0; ++ (i < SOUND_MIXER_NRDEVICES) && (mixer_defaults[i].mixer != -1) ; ++ i++ ) ++ { ++ if( !supported_mixer( mixer_defaults[i].mixer) ) ++ { ++ continue; ++ } ++ ++ ep93xx_set_mixer( mixer_defaults[i].mixer, mixer_defaults[i].value); ++ } ++ ++} ++ ++static int ep93xx_set_recsource( int mask ) ++{ ++ unsigned int val; ++ ++ /* Arg contains a bit for each recording source */ ++ if( mask == 0 ) ++ { ++ return 0; ++ } ++ ++ mask &= AC97_RECORD_MASK; ++ ++ if( mask == 0 ) ++ { ++ return -EINVAL; ++ } ++ ++ /* ++ * May have more than one bit set. So clear out currently selected ++ * record source value first (AC97 supports only 1 input) ++ */ ++ val = (1 << ac97_rm2oss[peek( AC97_1A_RECORD_SELECT ) & 0x07]); ++ if (mask != val) ++ mask &= ~val; ++ ++ val = ffs(mask); ++ val = ac97_oss_rm[val-1]; ++ val |= val << 8; /* set both channels */ ++ ++ /* ++ * ++ */ ++ val = peek( AC97_1A_RECORD_SELECT ) & 0x0707; ++ if ((val&0x0404)!=0) ++ val=0x0404; ++ else if((val&0x0000)!=0) ++ val=0x0101; ++ ++ ++ DPRINTK("ac97_codec: setting ac97 recmask to 0x%04x\n", val); ++ ++ poke( AC97_1A_RECORD_SELECT, val); ++ ++ return 0; ++} ++ ++/* ++ * ep93xx_init_ac97_codec ++ * ++ * Program up the external Ac97 codec. ++ * ++ */ ++static void ep93xx_init_ac97_codec( void ) ++{ ++ DPRINTK("ep93xx_init_ac97_codec - enter\n"); ++ ++ ep93xx_setup_src(); ++ ep93xx_set_samplerate( AUDIO_SAMPLE_RATE_DEFAULT, 0 ); ++ ep93xx_set_samplerate( AUDIO_SAMPLE_RATE_DEFAULT, 1 ); ++ ep93xx_init_mixer(); ++ ++ DPRINTK("ep93xx_init_ac97_codec - EXIT\n"); ++ ++} ++ ++ ++/* ++ * ep93xx_audio_init ++ * Audio interface ++ */ ++static void ep93xx_audio_init(void) ++{ ++ DPRINTK("ep93xx_audio_init - enter\n"); ++ /* ++ * Init the controller, enable the ac-link. ++ * Initialize the codec. ++ */ ++ ep93xx_init_ac97_controller(); ++ ep93xx_init_ac97_codec(); ++ /*stop the audio loop from the input to the output directly*/ ++ ep93xx_stop_loop(); ++ ++#ifdef alsa_ac97_debug ++ ep93xx_dump_ac97_regs(); ++#endif ++ DPRINTK("ep93xx_audio_init - EXIT\n"); ++} ++ ++/*====================================================================================*/ ++ ++ ++static void print_audio_format( long format ) ++{ ++ switch( format ){ ++ case SNDRV_PCM_FORMAT_S8: ++ DPRINTK( "AFMT_S8\n" ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_U8: ++ DPRINTK( "AFMT_U8\n" ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_S16_LE: ++ DPRINTK( "AFMT_S16_LE\n" ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_S16_BE: ++ DPRINTK( "AFMT_S16_BE\n" ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_U16_LE: ++ DPRINTK( "AFMT_U16_LE\n" ); ++ break; ++ case SNDRV_PCM_FORMAT_U16_BE: ++ DPRINTK( "AFMT_U16_BE\n" ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_S24_LE: ++ DPRINTK( "AFMT_S24_LE\n" ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_S24_BE: ++ DPRINTK( "AFMT_S24_BE\n" ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_U24_LE: ++ DPRINTK( "AFMT_U24_LE\n" ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_U24_BE: ++ DPRINTK( "AFMT_U24_BE\n" ); ++ break; ++ case SNDRV_PCM_FORMAT_S32_LE: ++ DPRINTK( "AFMT_S24_LE\n" ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_S32_BE: ++ DPRINTK( "AFMT_S24_BE\n" ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_U32_LE: ++ DPRINTK( "AFMT_U24_LE\n" ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_U32_BE: ++ DPRINTK( "AFMT_U24_BE\n" ); ++ break; ++ default: ++ DPRINTK( "ep93xx_i2s_Unsupported Audio Format\n" ); ++ break; ++ } ++} ++ ++static void audio_set_format( audio_stream_t * s, long val ) ++{ ++ DPRINTK( "ep93xx_i2s_audio_set_format enter. Format requested (%d) %d ", ++ (int)val,SNDRV_PCM_FORMAT_S16_LE); ++ print_audio_format( val ); ++ ++ switch( val ){ ++ case SNDRV_PCM_FORMAT_S8: ++ s->audio_format = SNDRV_PCM_FORMAT_S8; ++ s->audio_stream_bitwidth = 8; ++ break; ++ ++ case SNDRV_PCM_FORMAT_U8: ++ s->audio_format = SNDRV_PCM_FORMAT_U8; ++ s->audio_stream_bitwidth = 8; ++ break; ++ ++ case SNDRV_PCM_FORMAT_S16_LE: ++ case SNDRV_PCM_FORMAT_S16_BE: ++ s->audio_format = SNDRV_PCM_FORMAT_S16_LE; ++ s->audio_stream_bitwidth = 16; ++ break; ++ ++ case SNDRV_PCM_FORMAT_U16_LE: ++ case SNDRV_PCM_FORMAT_U16_BE: ++ s->audio_format = SNDRV_PCM_FORMAT_U16_LE; ++ s->audio_stream_bitwidth = 16; ++ break; ++ ++ case SNDRV_PCM_FORMAT_S24_LE: ++ case SNDRV_PCM_FORMAT_S24_BE: ++ s->audio_format = SNDRV_PCM_FORMAT_S24_LE; ++ s->audio_stream_bitwidth = 24; ++ break; ++ ++ case SNDRV_PCM_FORMAT_U24_LE: ++ case SNDRV_PCM_FORMAT_U24_BE: ++ s->audio_format = SNDRV_PCM_FORMAT_U24_LE; ++ s->audio_stream_bitwidth = 24; ++ break; ++ ++ case SNDRV_PCM_FORMAT_U32_LE: ++ case SNDRV_PCM_FORMAT_U32_BE: ++ case SNDRV_PCM_FORMAT_S32_LE: ++ case SNDRV_PCM_FORMAT_S32_BE: ++ s->audio_format = SNDRV_PCM_FORMAT_S32_LE; ++ s->audio_stream_bitwidth = 32; ++ break; ++ default: ++ DPRINTK( "ep93xx_i2s_Unsupported Audio Format\n" ); ++ break; ++ } ++ ++ DPRINTK( "ep93xx_i2s_audio_set_format EXIT format set to be (%d) ", (int)s->audio_format ); ++ print_audio_format( (long)s->audio_format ); ++} ++ ++static __inline__ unsigned long copy_to_user_S24_LE ++( ++ audio_stream_t *stream, ++ const char *to, ++ unsigned long to_count ++) ++{ ++ int *dma_buffer_0 = (int *)stream->hwbuf[0]; ++ int *dma_buffer_1 = (int *)stream->hwbuf[1]; ++ int *dma_buffer_2 = (int *)stream->hwbuf[2]; ++ ++ int total_to_count = to_count; ++ int *user_ptr = (int *)to; /* 32 bit user buffer */ ++ int count; ++ ++ count = 8 * stream->dma_num_channels; ++ ++ while (to_count > 0){ ++ ++ __put_user( (int)( *dma_buffer_0++ ), user_ptr++ ); ++ __put_user( (int)( *dma_buffer_0++ ), user_ptr++ ); ++ ++ if(stream->audio_channels_flag & CHANNEL_REAR ){ ++ __put_user( (int)( *dma_buffer_1++ ), user_ptr++ ); ++ __put_user( (int)( *dma_buffer_1++ ), user_ptr++ ); ++ } ++ ++ if(stream->audio_channels_flag & CHANNEL_CENTER_LFE ){ ++ __put_user( (int)( *dma_buffer_2++ ), user_ptr++ ); ++ __put_user( (int)( *dma_buffer_2++ ), user_ptr++ ); ++ } ++ to_count -= count; ++ } ++ return total_to_count; ++} ++ ++static __inline__ unsigned long copy_to_user_U24_LE ++( ++ audio_stream_t *stream, ++ const char *to, ++ unsigned long to_count ++) ++{ ++ int *dma_buffer_0 = (int *)stream->hwbuf[0]; ++ int *dma_buffer_1 = (int *)stream->hwbuf[1]; ++ int *dma_buffer_2 = (int *)stream->hwbuf[2]; ++ ++ int total_to_count = to_count; ++ unsigned int * user_ptr = (unsigned int *)to; /* 32 bit user buffer */ ++ int count; ++ ++ count = 8 * stream->dma_num_channels; ++ ++ while (to_count > 0){ ++ __put_user( ((unsigned int)( *dma_buffer_0++ )) ^ 0x8000, user_ptr++ ); ++ __put_user( ((unsigned int)( *dma_buffer_0++ )) ^ 0x8000, user_ptr++ ); ++ ++ if(stream->audio_channels_flag & CHANNEL_REAR ){ ++ __put_user( ((unsigned int)( *dma_buffer_1++ )) ^ 0x8000, user_ptr++ ); ++ __put_user( ((unsigned int)( *dma_buffer_1++ )) ^ 0x8000, user_ptr++ ); ++ } ++ ++ if(stream->audio_channels_flag & CHANNEL_CENTER_LFE ){ ++ __put_user( ((unsigned int)( *dma_buffer_2++ )) ^ 0x8000, user_ptr++ ); ++ __put_user( ((unsigned int)( *dma_buffer_2++ )) ^ 0x8000, user_ptr++ ); ++ } ++ to_count -= count; ++ } ++ return total_to_count; ++} ++ ++static __inline__ unsigned long copy_to_user_S16_LE ++( ++ audio_stream_t *stream, ++ const char *to, ++ unsigned long to_count ++) ++{ ++ int *dma_buffer_0 = (int *)stream->hwbuf[0]; ++ int *dma_buffer_1 = (int *)stream->hwbuf[1]; ++ int *dma_buffer_2 = (int *)stream->hwbuf[2]; ++ int total_to_count = to_count; ++ short * user_ptr = (short *)to; /* 16 bit user buffer */ ++ int count; ++ ++ count = 4 * stream->dma_num_channels; ++ ++ while (to_count > 0){ ++ ++ __put_user( (short)( *dma_buffer_0++ ), user_ptr++ ); ++ __put_user( (short)( *dma_buffer_0++ ), user_ptr++ ); ++ ++ if( stream->audio_channels_flag & CHANNEL_REAR ){ ++ __put_user( (short)( *dma_buffer_1++ ), user_ptr++ ); ++ __put_user( (short)( *dma_buffer_1++ ), user_ptr++ ); ++ } ++ ++ if( stream->audio_channels_flag & CHANNEL_CENTER_LFE ){ ++ __put_user( (short)( *dma_buffer_2++ ), user_ptr++ ); ++ __put_user( (short)( *dma_buffer_2++ ), user_ptr++ ); ++ } ++ to_count -= count; ++ } ++ return total_to_count; ++} ++ ++static __inline__ unsigned long copy_to_user_U16_LE ++( ++ audio_stream_t *stream, ++ const char *to, ++ unsigned long to_count ++) ++{ ++ int *dma_buffer_0 = (int *)stream->hwbuf[0]; ++ int *dma_buffer_1 = (int *)stream->hwbuf[1]; ++ int *dma_buffer_2 = (int *)stream->hwbuf[2]; ++ int count; ++ int total_to_count = to_count; ++ short * user_ptr = (short *)to; /* 16 bit user buffer */ ++ ++ count = 4 * stream->dma_num_channels; ++ ++ while (to_count > 0){ ++ ++ __put_user( ((unsigned short)( *dma_buffer_0++ )) ^ 0x8000, user_ptr++ ); ++ __put_user( ((unsigned short)( *dma_buffer_0++ )) ^ 0x8000, user_ptr++ ); ++ ++ if(stream->audio_channels_flag & CHANNEL_REAR ){ ++ __put_user( ((unsigned short)( *dma_buffer_1++ )) ^ 0x8000, user_ptr++ ); ++ __put_user( ((unsigned short)( *dma_buffer_1++ )) ^ 0x8000, user_ptr++ ); ++ } ++ ++ if(stream->audio_channels_flag & CHANNEL_CENTER_LFE ){ ++ __put_user( ((unsigned short)( *dma_buffer_2++ )) ^ 0x8000, user_ptr++ ); ++ __put_user( ((unsigned short)( *dma_buffer_2++ )) ^ 0x8000, user_ptr++ ); ++ } ++ to_count -= count; ++ } ++ return total_to_count; ++} ++ ++static __inline__ unsigned long copy_to_user_S8 ++( ++ audio_stream_t *stream, ++ const char *to, ++ unsigned long to_count ++) ++{ ++ char *dma_buffer_0 = (char *)stream->hwbuf[0]; ++ char *dma_buffer_1 = (char *)stream->hwbuf[1]; ++ char *dma_buffer_2 = (char *)stream->hwbuf[2]; ++ int count; ++ int total_to_count = to_count; ++ char * user_ptr = (char *)to; /* 8 bit user buffer */ ++ ++ count = 2 * stream->dma_num_channels; ++ ++ dma_buffer_0++; ++ dma_buffer_1++; ++ dma_buffer_2++; ++ ++ while (to_count > 0){ ++ ++ __put_user( (char)( *dma_buffer_0 ), user_ptr++ ); ++ dma_buffer_0 += 4; ++ __put_user( (char)( *dma_buffer_0 ), user_ptr++ ); ++ dma_buffer_0 += 4; ++ ++ if(stream->audio_channels_flag & CHANNEL_REAR ){ ++ __put_user( (char)( *dma_buffer_1 ), user_ptr++ ); ++ dma_buffer_1 += 4; ++ __put_user( (char)( *dma_buffer_1 ), user_ptr++ ); ++ dma_buffer_1 += 4; ++ } ++ ++ if(stream->audio_channels_flag & CHANNEL_CENTER_LFE ){ ++ __put_user( (char)( *dma_buffer_2 ), user_ptr++ ); ++ dma_buffer_2 += 4; ++ __put_user( (char)( *dma_buffer_2 ), user_ptr++ ); ++ dma_buffer_2 += 4; ++ } ++ to_count -= count; ++ } ++ return total_to_count; ++} ++ ++static __inline__ unsigned long copy_to_user_U8 ++( ++ audio_stream_t *stream, ++ const char *to, ++ unsigned long to_count ++) ++{ ++ char *dma_buffer_0 = (char *)stream->hwbuf[0]; ++ char *dma_buffer_1 = (char *)stream->hwbuf[1]; ++ char *dma_buffer_2 = (char *)stream->hwbuf[2]; ++ int count; ++ int total_to_count = to_count; ++ char * user_ptr = (char *)to; /* 8 bit user buffer */ ++ ++ count = 2 * stream->dma_num_channels; ++ ++ dma_buffer_0++; ++ dma_buffer_1++; ++ dma_buffer_2++; ++ ++ while (to_count > 0){ ++ ++ __put_user( (char)( *dma_buffer_0 ) ^ 0x80, user_ptr++ ); ++ dma_buffer_0 += 4; ++ __put_user( (char)( *dma_buffer_0 ) ^ 0x80, user_ptr++ ); ++ dma_buffer_0 += 4; ++ ++ if(stream->audio_channels_flag & CHANNEL_REAR ){ ++ __put_user( (char)( *dma_buffer_1 ) ^ 0x80, user_ptr++ ); ++ dma_buffer_1 += 4; ++ __put_user( (char)( *dma_buffer_1 ) ^ 0x80, user_ptr++ ); ++ dma_buffer_1 += 4; ++ } ++ ++ if(stream->audio_channels_flag & CHANNEL_CENTER_LFE ){ ++ __put_user( (char)( *dma_buffer_2 ) ^ 0x80, user_ptr++ ); ++ dma_buffer_2 += 4; ++ __put_user( (char)( *dma_buffer_2 ) ^ 0x80, user_ptr++ ); ++ dma_buffer_2 += 4; ++ } ++ to_count -= count; ++ } ++ return total_to_count; ++} ++ ++ ++ ++ ++static __inline__ unsigned long copy_to_user_S16_LE_CM ++( ++ audio_stream_t *stream, ++ const char *to, ++ unsigned long to_count ++) ++{ ++ short *dma_buffer_0 = (short *)stream->hwbuf[0]; ++ int *dma_buffer_1 = (int *)stream->hwbuf[1]; ++ int *dma_buffer_2 = (int *)stream->hwbuf[2]; ++ int total_to_count = to_count; ++ short * user_ptr = (short *)to; /* 16 bit user buffer */ ++ int count; ++ ++ ++ count = 4 * stream->dma_num_channels; ++ ++ while (to_count > 0){ ++ if(stream->audio_num_channels == 2){ ++ __put_user( (short)( *dma_buffer_0++ ), user_ptr++ ); ++ __put_user( (short)( *dma_buffer_0++ ), user_ptr++ ); ++ to_count -= count; ++ } ++ else{ ++ dma_buffer_0++; ++ __put_user( (short)( *dma_buffer_0++ ), user_ptr++ ); ++ to_count -= 2; ++ } ++ ++ if( stream->audio_channels_flag & CHANNEL_REAR ){ ++ __put_user( (short)( *dma_buffer_1++ ), user_ptr++ ); ++ __put_user( (short)( *dma_buffer_1++ ), user_ptr++ ); ++ } ++ ++ if( stream->audio_channels_flag & CHANNEL_CENTER_LFE ){ ++ __put_user( (short)( *dma_buffer_2++ ), user_ptr++ ); ++ __put_user( (short)( *dma_buffer_2++ ), user_ptr++ ); ++ } ++ //to_count -= count; ++ } ++ return total_to_count; ++} ++ ++static __inline__ unsigned long copy_to_user_U16_LE_CM ++( ++ audio_stream_t *stream, ++ const char *to, ++ unsigned long to_count ++) ++{ ++ unsigned short *dma_buffer_0 = (unsigned short *)stream->hwbuf[0]; ++ int *dma_buffer_1 = (int *)stream->hwbuf[1]; ++ int *dma_buffer_2 = (int *)stream->hwbuf[2]; ++ int count; ++ int total_to_count = to_count; ++ unsigned short * user_ptr = (unsigned short *)to; /* 16 bit user buffer */ ++ ++ count = 4 * stream->dma_num_channels; ++ ++ while (to_count > 0){ ++ ++ if(stream->audio_num_channels == 2){ ++ __put_user( ((unsigned short)( *dma_buffer_0++ )) ^ 0x8000, user_ptr++ ); ++ __put_user( ((unsigned short)( *dma_buffer_0++ )) ^ 0x8000, user_ptr++ ); ++ to_count -= count; ++ } ++ else{ ++ dma_buffer_0++; ++ __put_user( ((unsigned short)( *dma_buffer_0++ )) ^ 0x8000, user_ptr++ ); ++ to_count -= 2; ++ } ++ ++ if(stream->audio_channels_flag & CHANNEL_REAR ){ ++ __put_user( ((unsigned short)( *dma_buffer_1++ )) ^ 0x8000, user_ptr++ ); ++ __put_user( ((unsigned short)( *dma_buffer_1++ )) ^ 0x8000, user_ptr++ ); ++ } ++ ++ if(stream->audio_channels_flag & CHANNEL_CENTER_LFE ){ ++ __put_user( ((unsigned short)( *dma_buffer_2++ )) ^ 0x8000, user_ptr++ ); ++ __put_user( ((unsigned short)( *dma_buffer_2++ )) ^ 0x8000, user_ptr++ ); ++ } ++ //to_count -= count; ++ } ++ return total_to_count; ++} ++ ++static __inline__ unsigned long copy_to_user_S8_CM ++( ++ audio_stream_t *stream, ++ const char *to, ++ unsigned long to_count ++) ++{ ++ unsigned short *dma_buffer_0 = (unsigned short *)stream->hwbuf[0]; ++ char *dma_buffer_1 = (char *)stream->hwbuf[1]; ++ char *dma_buffer_2 = (char *)stream->hwbuf[2]; ++ int count; ++ int total_to_count = to_count; ++ char * user_ptr = (char *)to; /* 8 bit user buffer */ ++ ++ count = 2 * stream->dma_num_channels; ++ ++ dma_buffer_0++; ++ dma_buffer_1++; ++ dma_buffer_2++; ++ ++ while (to_count > 0){ ++ if(stream->audio_num_channels == 2){ ++ __put_user( (char)( *dma_buffer_0++ >> 8), user_ptr++ ); ++ //dma_buffer_0 += 4; ++ __put_user( (char)( *dma_buffer_0++ >> 8), user_ptr++ ); ++ //dma_buffer_0 += 4; ++ to_count -= count; ++ } ++ else{ ++ dma_buffer_0++ ; ++ __put_user( (char)( *dma_buffer_0++ >> 8), user_ptr++ ); ++ ++ to_count -= 1; ++ } ++ if(stream->audio_channels_flag & CHANNEL_REAR ){ ++ __put_user( (char)( *dma_buffer_1 ), user_ptr++ ); ++ dma_buffer_1 += 4; ++ __put_user( (char)( *dma_buffer_1 ), user_ptr++ ); ++ dma_buffer_1 += 4; ++ } ++ ++ if(stream->audio_channels_flag & CHANNEL_CENTER_LFE ){ ++ __put_user( (char)( *dma_buffer_2 ), user_ptr++ ); ++ dma_buffer_2 += 4; ++ __put_user( (char)( *dma_buffer_2 ), user_ptr++ ); ++ dma_buffer_2 += 4; ++ } ++ //to_count -= count; ++ } ++ return total_to_count; ++} ++ ++static __inline__ unsigned long copy_to_user_U8_CM ++( ++ audio_stream_t *stream, ++ const char *to, ++ unsigned long to_count ++) ++{ ++ unsigned short *dma_buffer_0 = (unsigned short *)stream->hwbuf[0]; ++ char *dma_buffer_1 = (char *)stream->hwbuf[1]; ++ char *dma_buffer_2 = (char *)stream->hwbuf[2]; ++ int count; ++ int total_to_count = to_count; ++ char * user_ptr = (char *)to; /* 8 bit user buffer */ ++ ++ count = 2 * stream->dma_num_channels; ++ ++ dma_buffer_0++; ++ dma_buffer_1++; ++ dma_buffer_2++; ++ ++ while (to_count > 0){ ++ if(stream->audio_num_channels == 2){ ++ __put_user( (char)( *dma_buffer_0++ >>8) ^ 0x80, user_ptr++ ); ++ //dma_buffer_0 += 4; ++ __put_user( (char)( *dma_buffer_0++ >>8) ^ 0x80, user_ptr++ ); ++ //dma_buffer_0 += 4; ++ to_count -= count; ++ } ++ else{ ++ dma_buffer_0++; ++ __put_user( (char)( *dma_buffer_0++ >>8) ^ 0x80, user_ptr++ ); ++ //dma_buffer_0 += 4; ++ to_count--; ++ } ++ ++ if(stream->audio_channels_flag & CHANNEL_REAR ){ ++ __put_user( (char)( *dma_buffer_1 ) ^ 0x80, user_ptr++ ); ++ dma_buffer_1 += 4; ++ __put_user( (char)( *dma_buffer_1 ) ^ 0x80, user_ptr++ ); ++ dma_buffer_1 += 4; ++ } ++ ++ if(stream->audio_channels_flag & CHANNEL_CENTER_LFE ){ ++ __put_user( (char)( *dma_buffer_2 ) ^ 0x80, user_ptr++ ); ++ dma_buffer_2 += 4; ++ __put_user( (char)( *dma_buffer_2 ) ^ 0x80, user_ptr++ ); ++ dma_buffer_2 += 4; ++ } ++ //to_count -= count; ++ } ++ return total_to_count; ++} ++ ++static __inline__ unsigned long copy_to_user_U32 ++( ++ audio_stream_t *stream, ++ const char *to, ++ unsigned long to_count ++) ++{ ++ char *dma_buffer_0 = (char *)stream->hwbuf[0]; ++ ++ if(__copy_to_user( (char *)to, dma_buffer_0, to_count)) ++ { ++ return -EFAULT; ++ } ++ return to_count; ++} ++ ++static __inline__ int copy_to_user_with_conversion ++( ++ audio_stream_t *stream, ++ const char *to, ++ int toCount, ++ int bCompactMode ++) ++{ ++ int ret = 0; ++ ++ if( toCount == 0 ){ ++ DPRINTK("ep93xx_i2s_copy_to_user_with_conversion - nothing to copy!\n"); ++ } ++ ++ if( bCompactMode == 1 ){ ++ ++ switch( stream->audio_format ){ ++ ++ case SNDRV_PCM_FORMAT_S8: ++ ret = copy_to_user_S8_CM( stream, to, toCount ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_U8: ++ ret = copy_to_user_U8_CM( stream, to, toCount ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_S16_LE: ++ ret = copy_to_user_S16_LE_CM( stream, to, toCount ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_U16_LE: ++ ret = copy_to_user_U16_LE_CM( stream, to, toCount ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_S24_LE: ++ //ret = copy_to_user_S24_LE( stream, to, toCount ); ++ //break; ++ ++ case SNDRV_PCM_FORMAT_U24_LE: ++ //ret = copy_to_user_U24_LE( stream, to, toCount ); ++ //break; ++ ++ case SNDRV_PCM_FORMAT_S32_LE: ++ default: ++ DPRINTK( "ep93xx_i2s copy to user unsupported audio format %x\n",stream->audio_format ); ++ break; ++ } ++ ++ } ++ else{ ++ ++ switch( stream->audio_format ){ ++ ++ case SNDRV_PCM_FORMAT_S8: ++ ret = copy_to_user_S8( stream, to, toCount ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_U8: ++ ret = copy_to_user_U8( stream, to, toCount ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_S16_LE: ++ ret = copy_to_user_S16_LE( stream, to, toCount ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_U16_LE: ++ ret = copy_to_user_U16_LE( stream, to, toCount ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_S24_LE: ++ //ret = copy_to_user_S24_LE( stream, to, toCount ); ++ //break; ++ ++ case SNDRV_PCM_FORMAT_U24_LE: ++ //ret = copy_to_user_U24_LE( stream, to, toCount ); ++ //break; ++ DPRINTK( "ep93xx_i2s copy to user unsupported audio format %x\n",stream->audio_format ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_S32_LE: ++ ++ //__copy_to_user( (char *)to, from, toCount); ++ ret = copy_to_user_U32( stream, to, toCount ); ++ break; ++ default: ++ DPRINTK( "ep93xx_i2s copy to user unsupported audio format\n" ); ++ break; ++ } ++ ++ } ++ return ret; ++} ++ ++static __inline__ int copy_from_user_S24_LE ++( ++ audio_stream_t *stream, ++ const char *from, ++ int toCount ++) ++{ ++ int *dma_buffer_0 = (int *)stream->hwbuf[0]; ++ int *dma_buffer_1 = (int *)stream->hwbuf[1]; ++ int *dma_buffer_2 = (int *)stream->hwbuf[2]; ++ int count; ++ ++ unsigned int * user_buffer = (unsigned int *)from; ++ unsigned int data; ++ ++ int toCount0 = toCount; ++ count = 8 * stream->dma_num_channels; ++ ++ while (toCount > 0){ ++ ++ __get_user(data, user_buffer++); ++ *dma_buffer_0++ = (unsigned int)data; ++ __get_user(data, user_buffer++); ++ *dma_buffer_0++ = (unsigned int)data; ++ ++ if(stream->audio_channels_flag & CHANNEL_REAR ){ ++ __get_user(data, user_buffer++); ++ *dma_buffer_1++ = (unsigned int)data; ++ __get_user(data, user_buffer++); ++ *dma_buffer_1++ = (unsigned int)data; ++ } ++ ++ if(stream->audio_channels_flag & CHANNEL_CENTER_LFE ){ ++ __get_user(data, user_buffer++); ++ *dma_buffer_2++ = (unsigned int)data; ++ __get_user(data, user_buffer++); ++ *dma_buffer_2++ = (unsigned int)data; ++ } ++ toCount -= count; ++ } ++ return toCount0 / 2; ++} ++ ++static __inline__ int copy_from_user_U24_LE ++( ++ audio_stream_t *stream, ++ const char *from, ++ int toCount ++) ++{ ++ int *dma_buffer_0 = (int *)stream->hwbuf[0]; ++ int *dma_buffer_1 = (int *)stream->hwbuf[1]; ++ int *dma_buffer_2 = (int *)stream->hwbuf[2]; ++ int count; ++ unsigned int * user_buffer = (unsigned int *)from; ++ unsigned int data; ++ ++ int toCount0 = toCount; ++ count = 8 * stream->dma_num_channels; ++ ++ while (toCount > 0){ ++ ++ __get_user(data, user_buffer++); ++ *dma_buffer_0++ = ((unsigned int)data ^ 0x8000); ++ __get_user(data, user_buffer++); ++ *dma_buffer_0++ = ((unsigned int)data ^ 0x8000); ++ ++ if(stream->audio_channels_flag & CHANNEL_REAR ){ ++ __get_user(data, user_buffer++); ++ *dma_buffer_1++ = ((unsigned int)data ^ 0x8000); ++ __get_user(data, user_buffer++); ++ *dma_buffer_1++ = ((unsigned int)data ^ 0x8000); ++ } ++ ++ if(stream->audio_channels_flag & CHANNEL_CENTER_LFE ){ ++ __get_user(data, user_buffer++); ++ *dma_buffer_2++ = ((unsigned int)data ^ 0x8000); ++ __get_user(data, user_buffer++); ++ *dma_buffer_2++ = ((unsigned int)data ^ 0x8000); ++ } ++ toCount -= count; ++ } ++ return toCount0 / 2; ++} ++ ++static __inline__ int copy_from_user_S16_LE ++( ++ audio_stream_t *stream, ++ const char *from, ++ int toCount ++) ++{ ++ int *dma_buffer_0 = (int *)stream->hwbuf[0]; ++ int *dma_buffer_1 = (int *)stream->hwbuf[1]; ++ int *dma_buffer_2 = (int *)stream->hwbuf[2]; ++ unsigned short *user_buffer = (unsigned short *)from; ++ unsigned short data; ++ ++ int toCount0 = toCount; ++ int count; ++ count = 8 * stream->dma_num_channels; ++ ++ while (toCount > 0){ ++ ++ __get_user(data, user_buffer++); ++ *dma_buffer_0++ = data; ++ if(stream->audio_num_channels == 2){ ++ __get_user(data, user_buffer++); ++ } ++ *dma_buffer_0++ = data; ++ ++ if(stream->audio_channels_flag & CHANNEL_REAR ){ ++ __get_user(data, user_buffer++); ++ *dma_buffer_1++ = data; ++ __get_user(data, user_buffer++); ++ *dma_buffer_1++ = data; ++ } ++ ++ if(stream->audio_channels_flag & CHANNEL_CENTER_LFE ){ ++ __get_user(data, user_buffer++); ++ *dma_buffer_2++ = data; ++ __get_user(data, user_buffer++); ++ *dma_buffer_2++ = data; ++ } ++ toCount -= count; ++ } ++ ++ if(stream->audio_num_channels == 1){ ++ return toCount0 / 4; ++ } ++ return toCount0 / 2; ++} ++ ++static __inline__ int copy_from_user_U16_LE ++( ++ audio_stream_t *stream, ++ const char *from, ++ int toCount ++) ++{ ++ int *dma_buffer_0 = (int *)stream->hwbuf[0]; ++ int *dma_buffer_1 = (int *)stream->hwbuf[1]; ++ int *dma_buffer_2 = (int *)stream->hwbuf[2]; ++ int count; ++ unsigned short * user_buffer = (unsigned short *)from; ++ unsigned short data; ++ ++ int toCount0 = toCount; ++ count = 8 * stream->dma_num_channels; ++ ++ while (toCount > 0){ ++ ++ __get_user(data, user_buffer++); ++ *dma_buffer_0++ = ((unsigned int)data ^ 0x8000); ++ if(stream->audio_num_channels == 2){ ++ __get_user(data, user_buffer++); ++ } ++ *dma_buffer_0++ = ((unsigned int)data ^ 0x8000); ++ ++ if(stream->audio_channels_flag & CHANNEL_REAR ){ ++ __get_user(data, user_buffer++); ++ *dma_buffer_1++ = ((unsigned int)data ^ 0x8000); ++ __get_user(data, user_buffer++); ++ *dma_buffer_1++ = ((unsigned int)data ^ 0x8000); ++ } ++ ++ if(stream->audio_channels_flag & CHANNEL_CENTER_LFE ){ ++ __get_user(data, user_buffer++); ++ *dma_buffer_2++ = ((unsigned int)data ^ 0x8000); ++ __get_user(data, user_buffer++); ++ *dma_buffer_2++ = ((unsigned int)data ^ 0x8000); ++ } ++ toCount -= count; ++ } ++ ++ if(stream->audio_num_channels == 1){ ++ return toCount0 / 4; ++ } ++ return toCount0 / 2; ++} ++ ++static __inline__ int copy_from_user_S8 ++( ++ audio_stream_t *stream, ++ const char *from, ++ int toCount ++) ++{ ++ char *dma_buffer_0 = (char *)stream->hwbuf[0]; ++ char *dma_buffer_1 = (char *)stream->hwbuf[1]; ++ char *dma_buffer_2 = (char *)stream->hwbuf[2]; ++ int count; ++ unsigned char * user_buffer = (unsigned char *)from; ++ unsigned char data; ++ ++ int toCount0 = toCount; ++ count = 8 * stream->dma_num_channels; ++ ++ dma_buffer_0++; ++ dma_buffer_1++; ++ dma_buffer_2++; ++ ++ while (toCount > 0){ ++ __get_user(data, user_buffer++); ++ *dma_buffer_0 = data; ++ dma_buffer_0 += 4; ++ if(stream->audio_num_channels == 2){ ++ __get_user(data, user_buffer++); ++ } ++ *dma_buffer_0 = data; ++ dma_buffer_0 += 4; ++ ++ if(stream->audio_channels_flag & CHANNEL_REAR ){ ++ __get_user(data, user_buffer++); ++ *dma_buffer_1 = data; ++ dma_buffer_1 += 4; ++ __get_user(data, user_buffer++); ++ *dma_buffer_1 = data; ++ dma_buffer_1 += 4; ++ } ++ ++ if(stream->audio_channels_flag & CHANNEL_CENTER_LFE ){ ++ __get_user(data, user_buffer++); ++ *dma_buffer_2 = data; ++ dma_buffer_2 += 4; ++ __get_user(data, user_buffer++); ++ *dma_buffer_2 = data; ++ dma_buffer_2 += 4; ++ } ++ toCount -= count; ++ } ++ ++ if(stream->audio_num_channels == 1){ ++ return toCount0 / 8; ++ } ++ return toCount0 / 4; ++} ++ ++static __inline__ int copy_from_user_U8 ++( ++ audio_stream_t *stream, ++ const char *from, ++ int toCount ++) ++{ ++ char *dma_buffer_0 = (char *)stream->hwbuf[0]; ++ char *dma_buffer_1 = (char *)stream->hwbuf[1]; ++ char *dma_buffer_2 = (char *)stream->hwbuf[2]; ++ int count; ++ unsigned char *user_buffer = (unsigned char *)from; ++ unsigned char data; ++ ++ int toCount0 = toCount; ++ count = 8 * stream->dma_num_channels; ++ ++ dma_buffer_0 ++; ++ dma_buffer_1 ++; ++ dma_buffer_2 ++; ++ ++ while (toCount > 0){ ++ ++ __get_user(data, user_buffer++); ++ *dma_buffer_0 = ((unsigned char)data ^ 0x80); ++ dma_buffer_0 += 4; ++ if(stream->audio_num_channels == 2){ ++ __get_user(data, user_buffer++); ++ } ++ *dma_buffer_0 = ((unsigned char)data ^ 0x80); ++ dma_buffer_0 += 4; ++ ++ if(stream->audio_channels_flag & CHANNEL_REAR ){ ++ __get_user(data, user_buffer++); ++ *dma_buffer_1 = ((unsigned char)data ^ 0x80); ++ dma_buffer_1 += 4; ++ __get_user(data, user_buffer++); ++ *dma_buffer_1 = ((unsigned char)data ^ 0x80); ++ dma_buffer_1 += 4; ++ } ++ ++ if(stream->audio_channels_flag & CHANNEL_CENTER_LFE ){ ++ __get_user(data, user_buffer++); ++ *dma_buffer_2 = ((unsigned char)data ^ 0x80); ++ dma_buffer_2 += 4; ++ __get_user(data, user_buffer++); ++ *dma_buffer_2 = ((unsigned char)data ^ 0x80); ++ dma_buffer_2 += 4; ++ } ++ toCount -= count; ++ } ++ ++ if(stream->audio_num_channels == 1){ ++ return toCount0 / 8; ++ } ++ return toCount0 / 4; ++} ++ ++static __inline__ int copy_from_user_S16_LE_CM ++( ++ audio_stream_t *stream, ++ const char *from, ++ int toCount ++) ++{ ++ unsigned int *dma_buffer_0 = (int *)stream->hwbuf[0]; ++ unsigned int *dma_buffer_1 = (int *)stream->hwbuf[1]; ++ unsigned int *dma_buffer_2 = (int *)stream->hwbuf[2]; ++ unsigned short *user_buffer = (unsigned short *)from; ++ short data; ++ unsigned int val; ++ int toCount0 = toCount; ++ int count; ++ count = 4 * stream->dma_num_channels; ++ ++ //printk("count=%x tocount\n",count,toCount); ++ while (toCount > 0){ ++ ++ __get_user(data, user_buffer++); ++ //*dma_buffer_0++ = data; ++ val = (unsigned int)data & 0x0000ffff; ++ if(stream->audio_num_channels == 2){ ++ __get_user(data, user_buffer++); ++ } ++ *dma_buffer_0++ = ((unsigned int)data << 16) | val; ++ ++ if(stream->audio_channels_flag & CHANNEL_REAR ){ ++ __get_user(data, user_buffer++); ++ //*dma_buffer_1++ = data; ++ val = (unsigned int)data & 0x0000ffff; ++ __get_user(data, user_buffer++); ++ *dma_buffer_1++ = ((unsigned int)data << 16) | val; ++ } ++ ++ if(stream->audio_channels_flag & CHANNEL_CENTER_LFE ){ ++ __get_user(data, user_buffer++); ++ //*dma_buffer_2++ = data; ++ val = (unsigned int)data & 0x0000ffff; ++ __get_user(data, user_buffer++); ++ *dma_buffer_2++ = ((unsigned int)data << 16) | val; ++ } ++ toCount -= count; ++ } ++ ++ if(stream->audio_num_channels == 1){ ++ return toCount0 /2 ; ++ } ++ ++ return toCount0 ; ++} ++ ++static __inline__ int copy_from_user_U16_LE_CM ++( ++ audio_stream_t *stream, ++ const char *from, ++ int toCount ++) ++{ ++ int *dma_buffer_0 = (int *)stream->hwbuf[0]; ++ int *dma_buffer_1 = (int *)stream->hwbuf[1]; ++ int *dma_buffer_2 = (int *)stream->hwbuf[2]; ++ int count; ++ unsigned short * user_buffer = (unsigned short *)from; ++ unsigned short data; ++ unsigned int val; ++ int toCount0 = toCount; ++ count = 4 * stream->dma_num_channels; ++ ++ while (toCount > 0){ ++ ++ __get_user(data, user_buffer++); ++ //*dma_buffer_0++ = ((unsigned int)data ^ 0x8000); ++ val = (unsigned int)data & 0x0000ffff; ++ if(stream->audio_num_channels == 2){ ++ __get_user(data, user_buffer++); ++ } ++ //*dma_buffer_0++ = ((unsigned int)data ^ 0x8000); ++ *dma_buffer_0++ = (((unsigned int)data << 16) | val) ^ 0x80008000; ++ ++ if(stream->audio_channels_flag & CHANNEL_REAR ){ ++ __get_user(data, user_buffer++); ++ //*dma_buffer_1++ = ((unsigned int)data ^ 0x8000); ++ val = (unsigned int)data & 0x0000ffff; ++ __get_user(data, user_buffer++); ++ //*dma_buffer_1++ = ((unsigned int)data ^ 0x8000); ++ *dma_buffer_1++ = (((unsigned int)data << 16) | val) ^ 0x80008000; ++ } ++ ++ if(stream->audio_channels_flag & CHANNEL_CENTER_LFE ){ ++ __get_user(data, user_buffer++); ++ //*dma_buffer_2++ = ((unsigned int)data ^ 0x8000); ++ val = (unsigned int)data & 0x0000ffff; ++ __get_user(data, user_buffer++); ++ //*dma_buffer_2++ = ((unsigned int)data ^ 0x8000); ++ *dma_buffer_2++ = (((unsigned int)data << 16) | val) ^ 0x80008000; ++ } ++ toCount -= count; ++ } ++ ++ if(stream->audio_num_channels == 1){ ++ return toCount0/2; ++ } ++ return toCount0 ; ++} ++ ++static __inline__ int copy_from_user_S8_CM ++( ++ audio_stream_t *stream, ++ const char *from, ++ int toCount ++) ++{ ++ char *dma_buffer_0 = (char *)stream->hwbuf[0]; ++ char *dma_buffer_1 = (char *)stream->hwbuf[1]; ++ char *dma_buffer_2 = (char *)stream->hwbuf[2]; ++ int count; ++ unsigned char * user_buffer = (unsigned char *)from; ++ unsigned char data; ++ int toCount0 = toCount; ++ count = 4 * stream->dma_num_channels; ++ ++ dma_buffer_0++; ++ dma_buffer_1++; ++ dma_buffer_2++; ++ ++ while (toCount > 0){ ++ __get_user(data, user_buffer++); ++ *dma_buffer_0 = data; ++ *(dma_buffer_0 +1 ) = 0; ++ dma_buffer_0 += 2; ++ ++ if(stream->audio_num_channels == 2){ ++ __get_user(data, user_buffer++); ++ } ++ *dma_buffer_0 = data; ++ *(dma_buffer_0 +1 ) = 0; ++ dma_buffer_0 += 2; ++ ++ if(stream->audio_channels_flag & CHANNEL_REAR ){ ++ __get_user(data, user_buffer++); ++ *dma_buffer_1 = data; ++ dma_buffer_1 += 2; ++ __get_user(data, user_buffer++); ++ *dma_buffer_1 = data; ++ dma_buffer_1 += 2; ++ } ++ ++ if(stream->audio_channels_flag & CHANNEL_CENTER_LFE ){ ++ __get_user(data, user_buffer++); ++ *dma_buffer_2 = data; ++ dma_buffer_2 += 2; ++ __get_user(data, user_buffer++); ++ *dma_buffer_2 = data; ++ dma_buffer_2 += 2; ++ } ++ toCount -= count; ++ } ++ ++ if(stream->audio_num_channels == 1){ ++ return toCount0 / 4; ++ } ++ ++ return toCount0 / 2; ++} ++ ++static __inline__ int copy_from_user_U8_CM ++( ++ audio_stream_t *stream, ++ const char *from, ++ int toCount ++) ++{ ++ unsigned char *dma_buffer_0 = (unsigned char *)stream->hwbuf[0]; ++ unsigned char *dma_buffer_1 = (unsigned char *)stream->hwbuf[1]; ++ unsigned char *dma_buffer_2 = (unsigned char *)stream->hwbuf[2]; ++ int count; ++ unsigned char *user_buffer = (unsigned char *)from; ++ unsigned char data; ++ ++ int toCount0 = toCount; ++ count = 4 * stream->dma_num_channels; ++ ++ dma_buffer_0 ++; ++ dma_buffer_1 ++; ++ dma_buffer_2 ++; ++ ++ while (toCount > 0){ ++ ++ __get_user(data, user_buffer++); ++ *dma_buffer_0 = ((unsigned char)data ^ 0x80); ++ *(dma_buffer_0 +1 ) = 0; ++ dma_buffer_0 += 2; ++ ++ if(stream->audio_num_channels == 2){ ++ __get_user(data, user_buffer++); ++ } ++ *dma_buffer_0 = ((unsigned char)data ^ 0x80); ++ *(dma_buffer_0 +1 ) = 0; ++ dma_buffer_0 += 2; ++ ++ ++ if(stream->audio_channels_flag & CHANNEL_REAR ){ ++ __get_user(data, user_buffer++); ++ *dma_buffer_1 = ((unsigned char)data ^ 0x80); ++ dma_buffer_1 += 2; ++ __get_user(data, user_buffer++); ++ *dma_buffer_1 = ((unsigned char)data ^ 0x80); ++ dma_buffer_1 += 2; ++ } ++ ++ if(stream->audio_channels_flag & CHANNEL_CENTER_LFE ){ ++ __get_user(data, user_buffer++); ++ *dma_buffer_2 = ((unsigned char)data ^ 0x80); ++ dma_buffer_2 += 2; ++ __get_user(data, user_buffer++); ++ *dma_buffer_2 = ((unsigned char)data ^ 0x80); ++ dma_buffer_2 += 2; ++ } ++ toCount -= count; ++ } ++ ++ if(stream->audio_num_channels == 1){ ++ return toCount0 / 4; ++ } ++ ++ return toCount0 / 2; ++} ++ ++static int copy_from_user_U32 ++( ++ audio_stream_t *stream, ++ const char *from, ++ int toCount ++) ++{ ++ char *dma_buffer_0 = (char *)stream->hwbuf[0]; ++ ++ if (copy_from_user( (char *)dma_buffer_0, from, toCount)) ++ { ++ return -EFAULT; ++ } ++ ++ return toCount; ++ ++} ++ ++/* ++ * Returns negative for error ++ * Returns # of bytes transferred out of the from buffer ++ * for success. ++ */ ++static __inline__ int copy_from_user_with_conversion ++( ++ audio_stream_t *stream, ++ const char *from, ++ int toCount, ++ int bCompactMode ++) ++{ ++ int ret = 0; ++// DPRINTK("copy_from_user_with_conversion\n"); ++ if( toCount == 0 ){ ++ DPRINTK("ep93xx_i2s_copy_from_user_with_conversion - nothing to copy!\n"); ++ } ++ ++ if( bCompactMode == 1){ ++ ++ switch( stream->audio_format ){ ++ ++ case SNDRV_PCM_FORMAT_S8: ++ DPRINTK("SNDRV_PCM_FORMAT_S8 CM\n"); ++ ret = copy_from_user_S8_CM( stream, from, toCount ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_U8: ++ DPRINTK("SNDRV_PCM_FORMAT_U8 CM\n"); ++ ret = copy_from_user_U8_CM( stream, from, toCount ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_S16_LE: ++ DPRINTK("SNDRV_PCM_FORMAT_S16_LE CM\n"); ++ ret = copy_from_user_S16_LE_CM( stream, from, toCount ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_U16_LE: ++ DPRINTK("SNDRV_PCM_FORMAT_U16_LE CM\n"); ++ ret = copy_from_user_U16_LE_CM( stream, from, toCount ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_S24_LE: ++ DPRINTK("SNDRV_PCM_FORMAT_S24_LE CM\n"); ++ //ret = copy_from_user_S24_LE( stream, from, toCount ); ++ //break; ++ ++ case SNDRV_PCM_FORMAT_U24_LE: ++ DPRINTK("SNDRV_PCM_FORMAT_U24_LE CM\n"); ++ //ret = copy_from_user_U24_LE( stream, from, toCount ); ++ //break; ++ case SNDRV_PCM_FORMAT_S32_LE: ++ DPRINTK("SNDRV_PCM_FORMAT_S32_LE CM\n"); ++ //break; ++ default: ++ DPRINTK( "ep93xx_i2s copy from user unsupported audio format\n" ); ++ break; ++ } ++ } ++ else{ ++ switch( stream->audio_format ){ ++ ++ case SNDRV_PCM_FORMAT_S8: ++ DPRINTK("SNDRV_PCM_FORMAT_S8\n"); ++ ret = copy_from_user_S8( stream, from, toCount ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_U8: ++ DPRINTK("SNDRV_PCM_FORMAT_U8\n"); ++ ret = copy_from_user_U8( stream, from, toCount ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_S16_LE: ++ DPRINTK("SNDRV_PCM_FORMAT_S16_LE\n"); ++ ret = copy_from_user_S16_LE( stream, from, toCount ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_U16_LE: ++ DPRINTK("SNDRV_PCM_FORMAT_U16_LE\n"); ++ ret = copy_from_user_U16_LE( stream, from, toCount ); ++ break; ++ ++ case SNDRV_PCM_FORMAT_S24_LE: ++ DPRINTK("SNDRV_PCM_FORMAT_S24_LE\n"); ++ //ret = copy_from_user_S24_LE( stream, from, toCount ); ++ //break; ++ ++ case SNDRV_PCM_FORMAT_U24_LE: ++ DPRINTK("SNDRV_PCM_FORMAT_U24_LE\n"); ++ //ret = copy_from_user_U24_LE( stream, from, toCount ); ++ //break; ++ DPRINTK( "ep93xx_i2s copy from user unsupported audio format\n" ); ++ break; ++ case SNDRV_PCM_FORMAT_S32_LE: ++ DPRINTK("SNDRV_PCM_FORMAT_S32_LE\n"); ++ ret = copy_from_user_U32( stream, from, toCount ); ++ break; ++ default: ++ DPRINTK( "ep93xx_i2s copy from user unsupported audio format\n" ); ++ break; ++ } ++ } ++ ++ return ret; ++} ++ ++ ++ ++/* ++ * For audio playback, we convert samples of arbitrary format to be 32 bit ++ * for our hardware. We're scaling a user buffer to a dma buffer. So when ++ * report byte counts, we scale them acording to the ratio of DMA sample ++ * size to user buffer sample size. When we report # of DMA fragments, ++ * we don't scale that. So: ++ * ++ * Also adjust the size and number of dma fragments if sample size changed. ++ * ++ * Input format Input sample Output sample size ratio (out:in) ++ * bits channels size (bytes) CM non-CM CM non-CM ++ * 8 stereo 2 4 8 2:1 4:1 ++ * 16 stereo 4 4 8 1:1 2:1 ++ * 24 stereo 6 4 8 X 8:6 not a real case ++ * ++ */ ++static void snd_ep93xx_dma2usr_ratio( audio_stream_t * stream,int bCompactMode ) ++{ ++ unsigned int dma_sample_size, user_sample_size; ++ ++ if(bCompactMode == 1){ ++ dma_sample_size = 4; /* each stereo sample is 2 * 32 bits */ ++ } ++ else{ ++ dma_sample_size = 8; ++ } ++ ++ // If stereo 16 bit, user sample is 4 bytes. ++ // If stereo 8 bit, user sample is 2 bytes. ++ if(stream->audio_num_channels == 1){ ++ user_sample_size = stream->audio_stream_bitwidth / 8; ++ } ++ else{ ++ user_sample_size = stream->audio_stream_bitwidth / 4; ++ } ++ ++ stream->dma2usr_ratio = dma_sample_size / user_sample_size; ++} ++ ++/*---------------------------------------------------------------------------------------------*/ ++ ++static int snd_ep93xx_dma_free(struct snd_pcm_substream *substream ){ ++ ++ ++ audio_state_t *state = substream->private_data; ++ audio_stream_t *stream = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? ++ state->output_stream:state->input_stream; ++ int i; ++ ++ ++ DPRINTK("snd_ep93xx_dma_free - enter\n"); ++ for( i = 0 ; i < stream->dma_num_channels ;i++ ){ ++ ep93xx_dma_free( stream->dmahandles[i] ); ++ } ++ DPRINTK("snd_ep93xx_dma_free - exit\n"); ++ return 0; ++} ++ ++static int snd_ep93xx_dma_config(struct snd_pcm_substream *substream ){ ++ ++ audio_state_t *state = substream->private_data; ++ audio_stream_t *stream = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? ++ state->output_stream:state->input_stream; ++ int i,err = 0; ++ ++ DPRINTK("snd_ep93xx_dma_config - enter\n"); ++ ++ for( i = 0 ; i < stream->dma_num_channels ;i++ ){ ++ ++ err = ep93xx_dma_request(&stream->dmahandles[i], ++ stream->devicename, ++ (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? ++ state->output_dma[i]:state->input_dma[i] ); ++ if (err){ ++ printk("snd_ep93xx_dma_config - exit ERROR dma request failed\n"); ++ return err; ++ } ++ err = ep93xx_dma_config( stream->dmahandles[i], ++ IGNORE_CHANNEL_ERROR, ++ 0, ++ (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? ++ snd_ep93xx_dma_tx_callback:snd_ep93xx_dma_rx_callback, ++ (unsigned int)substream ); ++ if (err){ ++ printk("snd_ep93xx_dma_config - exit ERROR dma request failed\n"); ++ return err; ++ } ++ } ++ ++ DPRINTK("snd_ep93xx_dma_config - enter\n"); ++ return err; ++} ++ ++static void snd_ep93xx_dma_start( audio_state_t * state, audio_stream_t * stream ) ++{ ++ int err,i; ++ ++ DPRINTK("snd_ep93xx_dma_start - enter\n"); ++ ++ for(i = 0 ;i < stream->dma_num_channels;i++) ++ err = ep93xx_dma_start( stream->dmahandles[i], 1,(unsigned int *) stream->dmahandles ); ++ ++ stream->active = 1; ++ ++ DPRINTK("snd_ep93xx_dma_start - exit\n"); ++} ++ ++static void snd_ep93xx_dma_pause( audio_state_t * state, audio_stream_t * stream ) ++{ ++ int i; ++ ++ DPRINTK("snd_ep93xx_dma_pause - enter\n"); ++ ++ for(i = 0 ;i < stream->dma_num_channels;i++) ++ ep93xx_dma_pause( stream->dmahandles[i], 1,(unsigned int *)stream->dmahandles ); ++ ++ stream->active = 0; ++ DPRINTK("snd_ep93xx_dma_pause - exit\n"); ++ ++} ++ ++static void snd_ep93xx_dma_flush( audio_state_t * state, audio_stream_t * stream ){ ++ ++ int i; ++ ++ DPRINTK("snd_ep93xx_dma_flush - enter\n"); ++ ++ for( i = 0 ; i < stream->dma_num_channels ; i++ ) ++ ep93xx_dma_flush( stream->dmahandles[i] ); ++ ++ DPRINTK("snd_ep93xx_dma_flush - exit\n"); ++} ++ ++static void snd_ep93xx_deallocate_buffers( struct snd_pcm_substream *substream, audio_stream_t *stream ) ++{ ++ int i; ++ audio_channel_t *dma_chan; ++ ++ DPRINTK("snd_ep93xx_deallocate_buffers - enter\n"); ++ ++ if( stream->dma_channels ){ ++ ++ for(i = 0;i < stream->dma_num_channels;i++){ ++ ++ dma_chan = &stream->dma_channels[i]; ++ ++ if( dma_chan->area ){ ++ ++ if( dma_chan->audio_buffers ){ ++ ++ kfree(dma_chan->audio_buffers); ++ dma_chan->audio_buffers = NULL; ++ ++ } ++ ++ kfree(dma_chan->area); ++ dma_chan->area = NULL; ++ } ++ } ++ kfree(stream->dma_channels); ++ stream->dma_channels = NULL; ++ } ++ DPRINTK("snd_ep93xx_deallocate_buffers - exit\n"); ++} ++ ++static int snd_ep93xx_allocate_buffers(struct snd_pcm_substream *substream, audio_stream_t *stream) ++{ ++ audio_channel_t *channel; ++ unsigned int size,tmpsize,bufsize,bufextsize; ++ int i,j; ++ ++ ++ DPRINTK("snd_ep93xx_allocate_buffers - enter\n" ); ++ ++ if (stream->dma_channels){ ++ printk("ep93xx_i2s %s BUSY\n",__FUNCTION__); ++ return -EBUSY; ++ } ++ ++ stream->dma_channels = (audio_channel_t *)kmalloc(sizeof(audio_channel_t) * stream->dma_num_channels , GFP_KERNEL); ++ ++ if (!stream->dma_channels){ ++ printk(AUDIO_NAME ": unable to allocate dma_channels memory\n"); ++ return - ENOMEM; ++ } ++ ++ size = ( stream->dmasize / stream->dma_num_channels ) * stream->dma2usr_ratio; ++ ++ for( i = 0; i < stream->dma_num_channels;i++){ ++ channel = &stream->dma_channels[i]; ++ ++ channel->area = kmalloc( size, GFP_DMA ); ++ ++ if(!channel->area){ ++ printk(AUDIO_NAME ": unable to allocate audio memory\n"); ++ return -ENOMEM; ++ } ++ channel->bytes = size; ++ channel->addr = __virt_to_phys((int) channel->area); ++ memset( channel->area, 0, channel->bytes ); ++ ++ bufsize = ( stream->fragsize / stream->dma_num_channels ) * stream->dma2usr_ratio; ++ channel->audio_buff_count = size / bufsize; ++ bufextsize = size % bufsize; ++ ++ if( bufextsize > 0 ){ ++ channel->audio_buff_count++; ++ } ++ ++ channel->audio_buffers = (audio_buf_t *)kmalloc(sizeof(audio_buf_t) * channel->audio_buff_count , GFP_KERNEL); ++ ++ if (!channel->audio_buffers){ ++ printk(AUDIO_NAME ": unable to allocate audio memory\n "); ++ return -ENOMEM; ++ } ++ ++ tmpsize = size; ++ ++ for( j = 0; j < channel->audio_buff_count; j++){ ++ ++ channel->audio_buffers[j].dma_addr = channel->addr + j * bufsize; ++ ++ if( tmpsize >= bufsize ){ ++ tmpsize -= bufsize; ++ channel->audio_buffers[j].bytes = bufsize; ++ channel->audio_buffers[j].reportedbytes = bufsize / stream->dma2usr_ratio; ++ } ++ else{ ++ channel->audio_buffers[j].bytes = bufextsize; ++ channel->audio_buffers[j].reportedbytes = bufextsize / stream->dma2usr_ratio; ++ } ++ } ++ } ++ ++ DPRINTK("snd_ep93xx_allocate_buffers -- exit SUCCESS\n" ); ++ return 0; ++} ++ ++/* ++ * DMA callback functions ++ */ ++ ++static void snd_ep93xx_dma_tx_callback ++( ++ ep93xx_dma_int_t DMAInt, ++ ep93xx_dma_dev_t device, ++ unsigned int user_data ++) ++{ ++ int handle; ++ int i,chan; ++ unsigned int buf_id; ++ ++ struct snd_pcm_substream *substream = (struct snd_pcm_substream *)user_data; ++ audio_state_t *state = (audio_state_t *)(substream->private_data); ++ audio_stream_t *stream = state->output_stream; ++ audio_buf_t *buf; ++ ++ switch( device ) ++ { ++ case DMATx_I2S3: ++ DPRINTK( "snd_ep93xx_dma_tx_callback - DMATx_I2S3\n"); ++ i = 2; ++ break; ++ case DMATx_I2S2: ++ DPRINTK( "snd_ep93xx_dma_tx_callback - DMATx_I2S2\n"); ++ i = 1; ++ break; ++ case DMATx_I2S1: ++ default: ++ DPRINTK( "snd_ep93xx_dma_tx_callback - DMATx_I2S1\n"); ++ i = 0; ++ break; ++ } ++ ++ if(stream->audio_num_channels == 1){ ++ chan = 0; ++ } ++ else{ ++ chan = stream->audio_num_channels / 2 - 1; ++ } ++ handle = stream->dmahandles[i]; ++ ++ if(stream->stopped == 0){ ++ ++ if( ep93xx_dma_remove_buffer( handle, &buf_id ) >= 0 ){ ++ ++ buf = (audio_buf_t *)buf_id; ++ stream->bytecount += buf->reportedbytes; ++ ep93xx_dma_add_buffer( stream->dmahandles[i], ++ (unsigned int)buf->dma_addr, ++ 0, ++ buf->bytes, ++ 0, ++ (unsigned int) buf ); ++ if(chan == i) ++ snd_pcm_period_elapsed(substream); ++ } ++ } ++} ++ ++static void snd_ep93xx_dma_rx_callback ++( ++ ep93xx_dma_int_t DMAInt, ++ ep93xx_dma_dev_t device, ++ unsigned int user_data ++) ++{ ++ int handle,i,chan; ++ unsigned int buf_id; ++ audio_buf_t *buf; ++ ++ struct snd_pcm_substream *substream = (struct snd_pcm_substream *)user_data; ++ audio_state_t *state = (audio_state_t *)(substream->private_data); ++ audio_stream_t *stream = state->input_stream; ++ ++ switch( device ){ ++ ++ case DMARx_I2S3: ++ DPRINTK( "snd_ep93xx_dma_rx_callback - DMARx_I2S3\n"); ++ i = 2; ++ break; ++ case DMARx_I2S2: ++ DPRINTK( "snd_ep93xx_dma_rx_callback - DMARx_I2S2\n"); ++ i = 1; ++ break; ++ case DMARx_I2S1: ++ default: ++ DPRINTK( "snd_ep93xx_dma_rx_callback - DMARx_I2S1\n"); ++ i = 0; ++ break; ++ } ++ ++ if(stream->audio_num_channels == 1){ ++ chan = 0; ++ } ++ else{ ++ chan = stream->audio_num_channels / 2 - 1; ++ } ++ handle = stream->dmahandles[i]; ++ ++ if( stream->stopped == 0 ){ ++ ++ if( ep93xx_dma_remove_buffer( handle, &buf_id ) >= 0 ){ ++ ++ buf = (audio_buf_t *)buf_id; ++ stream->bytecount += buf->reportedbytes; ++ ep93xx_dma_add_buffer( stream->dmahandles[i], ++ (unsigned int)buf->dma_addr, ++ 0, ++ buf->bytes, ++ 0, ++ (unsigned int) buf ); ++ if( i == chan ) ++ snd_pcm_period_elapsed(substream); ++ } ++ } ++} ++ ++static int snd_ep93xx_release(struct snd_pcm_substream *substream) ++{ ++ audio_state_t *state = (audio_state_t *)substream->private_data; ++ audio_stream_t *stream = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? ++ state->output_stream : state->input_stream; ++ ++ DPRINTK("snd_ep93xx_release - enter\n"); ++ ++ down(&state->sem); ++ stream->active = 0; ++ stream->stopped = 0; ++ snd_ep93xx_deallocate_buffers(substream, stream); ++ up(&state->sem); ++ ++ DPRINTK("snd_ep93xx_release - exit\n"); ++ ++ return 0; ++} ++ ++static int ep93xx_ac97_pcm_startup(struct snd_pcm_substream *substream) ++{ ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ int r; ++ int iTempMasterVol,iTempHeadphoneVol,iTempMonoVol,iTempRecordSelect; ++ /*save the old mixer*/ ++ iTempRecordSelect = peek(AC97_1A_RECORD_SELECT); ++ iTempMasterVol = peek( AC97_02_MASTER_VOL); ++ iTempHeadphoneVol = peek( AC97_04_HEADPHONE_VOL); ++ iTempMonoVol = peek( AC97_06_MONO_VOL); ++ ++ runtime->hw.channels_min = 1; ++ runtime->hw.channels_max = 2; ++ ++ ep93xx_audio_init(); ++ /*ep93xx_init_ac97_controller();*/ ++ ++ /*reset the old output mixer*/ ++ poke( AC97_02_MASTER_VOL, iTempMasterVol); ++ poke( AC97_04_HEADPHONE_VOL,iTempHeadphoneVol ); ++ poke( AC97_06_MONO_VOL, iTempMonoVol); ++ poke( AC97_1A_RECORD_SELECT,iTempRecordSelect); ++ ++ r = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? ++ AC97_RATES_FRONT_DAC : AC97_RATES_ADC; ++ ++ DPRINTK(" ep93xx_ac97_pcm_startup=%x\n",r); ++ ++ return 0; ++} ++ ++ ++static int snd_ep93xx_pcm_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ DPRINTK("snd_ep93xx_pcm_hw_params - enter\n"); ++ return snd_pcm_lib_malloc_pages(substream,params_buffer_bytes(params)); ++} ++ ++static int snd_ep93xx_pcm_hw_free(struct snd_pcm_substream *substream) ++{ ++ ++ DPRINTK("snd_ep93xx_pcm_hw_free - enter\n"); ++ return snd_pcm_lib_free_pages(substream); ++} ++ ++/* ++ *snd_ep93xx_pcm_prepare: need to finish these functions as lower ++ *chip_set_sample_format ++ *chip_set_sample_rate ++ *chip_set_channels ++ *chip_set_dma_setup ++ */ ++ ++static int snd_ep93xx_pcm_prepare_playback( struct snd_pcm_substream *substream) ++{ ++ audio_state_t *state = (audio_state_t *) substream->private_data; ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ audio_stream_t *stream = state->output_stream; ++ ++ DPRINTK("snd_ep93xx_pcm_prepare_playback - enter\n"); ++ ++ ep93xx_audio_disable(1); ++ ep93xx_ac97_pcm_startup(substream); ++ ++ snd_ep93xx_deallocate_buffers(substream,stream); ++ ++ //if(runtime->channels % 2 != 0) ++ // return -1; ++ ++ DPRINTK("The runtime item : \n"); ++ DPRINTK("runtime->dma_addr = 0x%x\n", runtime->dma_addr); ++ DPRINTK("runtime->dma_area = 0x%x\n", runtime->dma_area); ++ DPRINTK("runtime->dma_bytes = %d\n", runtime->dma_bytes); ++ DPRINTK("runtime->frame_bits = %d\n", runtime->frame_bits); ++ DPRINTK("runtime->buffer_size = %d\n", runtime->buffer_size); ++ DPRINTK("runtime->period_size = %d\n", runtime->period_size); ++ DPRINTK("runtime->periods = %d\n", runtime->periods); ++ DPRINTK("runtime->rate = %d\n", runtime->rate); ++ DPRINTK("runtime->format = %d\n", runtime->format); ++ DPRINTK("runtime->channels = %d\n", runtime->channels); ++ ++ /* set requestd format when available */ ++ stream->audio_num_channels = runtime->channels; ++ if(stream->audio_num_channels == 1){ ++ stream->dma_num_channels = 1; ++ } ++ else{ ++ stream->dma_num_channels = runtime->channels / 2; ++ } ++ ++ stream->audio_channels_flag = CHANNEL_FRONT; ++ if(stream->dma_num_channels == 2) ++ stream->audio_channels_flag |= CHANNEL_REAR; ++ if(stream->dma_num_channels == 3) ++ stream->audio_channels_flag |= CHANNEL_REAR | CHANNEL_CENTER_LFE; ++ ++ stream->dmasize = runtime->dma_bytes; ++ stream->nbfrags = runtime->periods; ++ stream->fragsize = frames_to_bytes (runtime, runtime->period_size); ++ stream->bytecount = 0; ++ ++ if( !state->codec_set_by_capture ){ ++ state->codec_set_by_playback = 1; ++ ++ if( stream->audio_rate != runtime->rate ){ ++ ep93xx_set_samplerate( runtime->rate,0 ); ++ } ++ //if( stream->audio_format != runtime->format ){ ++ // snd_ep93xx_i2s_init((stream->audio_stream_bitwidth == 24)); ++ //} ++ } ++ else{ ++ audio_stream_t *s = state->input_stream; ++ if( runtime->format != s->audio_format) ++ return -1; ++ if( runtime->rate != s->audio_rate ) ++ return -1; ++ } ++ ++ stream->audio_format = runtime->format ; ++ ep93xx_set_hw_format(stream->audio_format,stream->audio_num_channels); ++ ++ ++ stream->audio_rate = runtime->rate; ++ audio_set_format( stream, runtime->format ); ++ snd_ep93xx_dma2usr_ratio( stream,state->bCompactMode ); ++ ++ if( snd_ep93xx_allocate_buffers( substream, stream ) != 0 ){ ++ snd_ep93xx_deallocate_buffers( substream, stream ); ++ return -1; ++ } ++ ++ ep93xx_audio_enable(1); ++ ++ DPRINTK("snd_ep93xx_pcm_prepare_playback - exit\n"); ++ return 0; ++} ++ ++static int snd_ep93xx_pcm_prepare_capture( struct snd_pcm_substream *substream) ++{ ++ audio_state_t *state = (audio_state_t *) substream->private_data; ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ audio_stream_t *stream = state->input_stream; ++ ++ ep93xx_audio_disable(0); ++ ep93xx_ac97_pcm_startup(substream); ++ ++ snd_ep93xx_deallocate_buffers(substream,stream); ++ ++ //if(runtime->channels % 2 != 0) ++ //return -1; ++ ++ DPRINTK("snd_ep93xx_pcm_prepare_capture - enter\n"); ++ ++// printk("The runtime item : \n"); ++// printk("runtime->dma_addr = 0x%x\n", runtime->dma_addr); ++// printk("runtime->dma_area = 0x%x\n", runtime->dma_area); ++// printk("runtime->dma_bytes = %d\n", runtime->dma_bytes); ++// printk("runtime->frame_bits = %d\n", runtime->frame_bits); ++// printk("runtime->buffer_size = %d\n", runtime->buffer_size); ++// printk("runtime->period_size = %d\n", runtime->period_size); ++// printk("runtime->periods = %d\n", runtime->periods); ++// printk("runtime->rate = %d\n", runtime->rate); ++// printk("runtime->format = %d\n", runtime->format); ++// printk("runtime->channels = %d\n", runtime->channels); ++ ++ /* set requestd format when available */ ++ stream->audio_num_channels = runtime->channels; ++ if(stream->audio_num_channels == 1){ ++ stream->dma_num_channels = 1; ++ } ++ else{ ++ stream->dma_num_channels = runtime->channels / 2; ++ } ++ ++ stream->audio_channels_flag = CHANNEL_FRONT; ++ if(stream->dma_num_channels == 2) ++ stream->audio_channels_flag |= CHANNEL_REAR; ++ if(stream->dma_num_channels == 3) ++ stream->audio_channels_flag |= CHANNEL_REAR | CHANNEL_CENTER_LFE; ++ ++ stream->dmasize = runtime->dma_bytes; ++ stream->nbfrags = runtime->periods; ++ stream->fragsize = frames_to_bytes (runtime, runtime->period_size); ++ stream->bytecount = 0; ++ ++ if( !state->codec_set_by_playback ){ ++ state->codec_set_by_capture = 1; ++ ++ /*rate*/ ++ if( stream->audio_rate != runtime->rate ){ ++ ep93xx_set_samplerate( runtime->rate,1 ); ++ } ++ ++ /*mixer*/ ++ ep93xx_set_recsource(SOUND_MASK_MIC|SOUND_MASK_LINE1 | SOUND_MASK_LINE); ++ poke( AC97_1C_RECORD_GAIN, 0); ++ ++ /*format*/ ++ //if( stream->audio_format != runtime->format ){ ++ // snd_ep93xx_i2s_init((stream->audio_stream_bitwidth == 24)); ++ //} ++ } ++ else{ ++ audio_stream_t *s = state->output_stream; ++ if( runtime->format != s->audio_format) ++ return -1; ++ if( runtime->rate != s->audio_rate ) ++ return -1; ++ } ++ ++ stream->audio_format = runtime->format ; ++ ep93xx_set_hw_format(stream->audio_format,stream->audio_num_channels); ++ ++ ++ stream->audio_rate = runtime->rate; ++ audio_set_format( stream, runtime->format ); ++ snd_ep93xx_dma2usr_ratio( stream,state->bCompactMode ); ++ ++ if( snd_ep93xx_allocate_buffers( substream, stream ) != 0 ){ ++ snd_ep93xx_deallocate_buffers( substream, stream ); ++ return -1; ++ } ++ ++ ep93xx_audio_enable(0); ++ ++ DPRINTK("snd_ep93xx_pcm_prepare_capture - exit\n"); ++ return 0; ++} ++/* ++ *start/stop/pause dma translate ++ */ ++static int snd_ep93xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) ++{ ++ audio_state_t *state = (audio_state_t *)substream->private_data; ++ audio_stream_t *stream = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? ++ state->output_stream:state->input_stream; ++ audio_buf_t *buf; ++ audio_channel_t *dma_channel; ++ int i,count,ret = 0; ++ unsigned long flags; ++ ++ DPRINTK("snd_ep93xx_pcm_triger %d - enter \n",cmd); ++ ++ switch (cmd){ ++ ++ case SNDRV_PCM_TRIGGER_START: ++ ++ snd_ep93xx_dma_config( substream ); ++ ++ stream->stopped = 0; ++ ++ if( !stream->active && !stream->stopped ){ ++ stream->active = 1; ++ snd_ep93xx_dma_start( state, stream ); ++ } ++ ++ local_irq_save(flags); ++ ++ for (i = 0; i < stream->dma_num_channels; i++){ ++ dma_channel = &stream->dma_channels[i]; ++ ++ for(count = 0 ;count < dma_channel->audio_buff_count; count++){ ++ ++ buf = &dma_channel->audio_buffers[count]; ++ ep93xx_dma_add_buffer( stream->dmahandles[i], ++ (unsigned int)buf->dma_addr, ++ 0, ++ buf->bytes, ++ 0, ++ (unsigned int) buf ); ++ } ++ } ++ ++ local_irq_restore(flags); ++ break; ++ ++ case SNDRV_PCM_TRIGGER_STOP: ++ stream->stopped = 1; ++ snd_ep93xx_dma_pause( state, stream ); ++ snd_ep93xx_dma_flush( state, stream ); ++ snd_ep93xx_dma_free( substream ); ++ break; ++ ++ case SNDRV_PCM_TRIGGER_SUSPEND: ++ break; ++ case SNDRV_PCM_TRIGGER_PAUSE_PUSH: ++ break; ++ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: ++ break; ++ ++ default: ++ ret = -EINVAL; ++ } ++ DPRINTK("snd_ep93xx_pcm_triger %d - exit \n",cmd); ++ return ret; ++} ++ ++static snd_pcm_uframes_t snd_ep93xx_pcm_pointer_playback(struct snd_pcm_substream *substream) ++{ ++ audio_state_t *state = (audio_state_t *)(substream->private_data); ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ audio_stream_t *stream = state->output_stream; ++ snd_pcm_uframes_t pointer = 0; ++ ++ pointer = bytes_to_frames( runtime,stream->bytecount ); ++ ++ if (pointer >= runtime->buffer_size){ ++ pointer = 0; ++ stream->bytecount = 0; ++ } ++ ++ DPRINTK("snd_ep93xx_pcm_pointer_playback - exit\n"); ++ return pointer; ++} ++ ++static snd_pcm_uframes_t snd_ep93xx_pcm_pointer_capture(struct snd_pcm_substream *substream) ++{ ++ audio_state_t *state = (audio_state_t *)(substream->private_data); ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ audio_stream_t *stream = state->input_stream; ++ snd_pcm_uframes_t pointer = 0; ++ ++ pointer = bytes_to_frames( runtime,stream->bytecount ); ++ ++ if (pointer >= runtime->buffer_size){ ++ pointer = 0; ++ stream->bytecount = 0; ++ } ++ ++ DPRINTK("snd_ep93xx_pcm_pointer_capture - exit\n"); ++ return pointer; ++} ++ ++static int snd_ep93xx_pcm_open(struct snd_pcm_substream *substream) ++{ ++ audio_state_t *state = substream->private_data; ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ audio_stream_t *stream = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? ++ state->output_stream:state->input_stream; ++ ++ DPRINTK("snd_ep93xx_pcm_open - enter\n"); ++ ++ down(&state->sem); ++ ++ runtime->hw = ep93xx_ac97_pcm_hardware; ++ ++ stream->dma_num_channels = AUDIO_DEFAULT_DMACHANNELS; ++ stream->dma_channels = NULL; ++ stream->audio_rate = 0; ++ stream->audio_stream_bitwidth = 0; ++ ++ up(&state->sem); ++ ++ DPRINTK("snd_ep93xx_pcm_open - exit\n"); ++ return 0; ++} ++ ++/* ++ *free the HW dma channel ++ *free the HW dma buffer ++ *free the Hw dma decrotion using function :kfree ++ */ ++static int snd_ep93xx_pcm_close(struct snd_pcm_substream *substream) ++{ ++ audio_state_t *state = (audio_state_t *)(substream->private_data); ++ ++ DPRINTK("snd_ep93xx_pcm_close - enter\n"); ++ ++ snd_ep93xx_release(substream); ++ ++ if(substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ++ state->codec_set_by_playback = 0; ++ else ++ state->codec_set_by_capture = 0; ++ ++ DPRINTK("snd_ep93xx_pcm_close - exit\n"); ++ return 0; ++} ++ ++static int snd_ep93xx_pcm_copy_playback(struct snd_pcm_substream * substream,int channel, ++ snd_pcm_uframes_t pos,void __user *src, snd_pcm_uframes_t count) ++{ ++ ++ audio_state_t *state = (audio_state_t *)substream->private_data; ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ audio_stream_t *stream = state->output_stream ; ++ audio_channel_t *dma_channel; ++ int i; ++ int tocount = frames_to_bytes(runtime,count); ++ ++ for( i = 0; i < stream->dma_num_channels; i++ ){ ++ ++ dma_channel = &stream->dma_channels[i]; ++ stream->hwbuf[i] = dma_channel->area + ( frames_to_bytes(runtime,pos) * stream->dma2usr_ratio / stream->dma_num_channels ); ++ ++ } ++ ++ if(copy_from_user_with_conversion(stream ,(const char*)src,(tocount * stream->dma2usr_ratio),state->bCompactMode) <=0 ){ ++ DPRINTK(KERN_ERR "copy_from_user_with_conversion() failed\n"); ++ return -EFAULT; ++ } ++ ++ DPRINTK("snd_ep93xx_pcm_copy_playback - exit\n"); ++ return 0; ++} ++ ++ ++static int snd_ep93xx_pcm_copy_capture(struct snd_pcm_substream * substream,int channel, ++ snd_pcm_uframes_t pos,void __user *src, snd_pcm_uframes_t count) ++{ ++ audio_state_t *state = (audio_state_t *)substream->private_data; ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ audio_stream_t *stream = state->input_stream ; ++ audio_channel_t *dma_channel; ++ int i; ++ ++ int tocount = frames_to_bytes(runtime,count); ++ ++ for( i = 0; i < stream->dma_num_channels; i++ ){ ++ ++ dma_channel = &stream->dma_channels[i]; ++ stream->hwbuf[i] = dma_channel->area + ( frames_to_bytes(runtime,pos) * stream->dma2usr_ratio / stream->dma_num_channels ); ++ ++ } ++ ++ if(copy_to_user_with_conversion(stream,(const char*)src,tocount,state->bCompactMode) <=0 ){ ++ ++ DPRINTK(KERN_ERR "copy_to_user_with_conversion() failed\n"); ++ return -EFAULT; ++ } ++ ++ DPRINTK("snd_ep93xx_pcm_copy_capture - exit\n"); ++ return 0; ++} ++ ++/*----------------------------------------------------------------------------------*/ ++static unsigned short ep93xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg) ++{ ++ int val = -1; ++ /*volatile u32 *reg_addr;*/ ++ ++ DPRINTK(" number of codec:%x reg=%x\n",ac97->num,reg); ++ val=peek(reg); ++ if(val==-1){ ++ printk(KERN_ERR "%s: read error (ac97_reg=%d )val=%x\n", ++ __FUNCTION__, reg, val); ++ return 0; ++ } ++ ++ return val; ++} ++ ++static void ep93xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val) ++{ ++ /*volatile u32 *reg_addr;*/ ++ int ret; ++ ++ DPRINTK(" number of codec:%x rge=%x val=%x\n",ac97->num,reg,val); ++ ret=poke(reg, val); ++ if(ret!=0){ ++ printk(KERN_ERR "%s: write error (ac97_reg=%d val=%x)\n", ++ __FUNCTION__, reg, val); ++ } ++ ++} ++ ++static void ep93xx_ac97_reset(struct snd_ac97 *ac97) ++{ ++ ++ DPRINTK(" ep93xx_ac97_reset\n"); ++ ep93xx_audio_init(); ++ ++} ++ ++static struct snd_ac97_bus_ops ep93xx_ac97_ops = { ++ .read = ep93xx_ac97_read, ++ .write = ep93xx_ac97_write, ++ .reset = ep93xx_ac97_reset, ++}; ++ ++static struct snd_pcm *ep93xx_ac97_pcm; ++static struct snd_ac97 *ep93xx_ac97_ac97; ++ ++static struct snd_pcm_ops snd_ep93xx_pcm_playback_ops = { ++ .open = snd_ep93xx_pcm_open, ++ .close = snd_ep93xx_pcm_close, ++ .ioctl = snd_pcm_lib_ioctl, ++ .hw_params = snd_ep93xx_pcm_hw_params, ++ .hw_free = snd_ep93xx_pcm_hw_free, ++ .prepare = snd_ep93xx_pcm_prepare_playback, ++ .trigger = snd_ep93xx_pcm_trigger, ++ .pointer = snd_ep93xx_pcm_pointer_playback, ++ .copy = snd_ep93xx_pcm_copy_playback, ++ ++}; ++ ++static struct snd_pcm_ops snd_ep93xx_pcm_capture_ops = { ++ .open = snd_ep93xx_pcm_open, ++ .close = snd_ep93xx_pcm_close, ++ .ioctl = snd_pcm_lib_ioctl, ++ .hw_params = snd_ep93xx_pcm_hw_params, ++ .hw_free = snd_ep93xx_pcm_hw_free, ++ .prepare = snd_ep93xx_pcm_prepare_capture, ++ .trigger = snd_ep93xx_pcm_trigger, ++ .pointer = snd_ep93xx_pcm_pointer_capture, ++ .copy = snd_ep93xx_pcm_copy_capture, ++}; ++ ++/*--------------------------------------------------------------------------*/ ++ ++ ++static int snd_ep93xx_pcm_new(struct snd_card *card, audio_state_t *state, struct snd_pcm **rpcm) ++{ ++ struct snd_pcm *pcm; ++ int play = state->output_stream? 1 : 0;/*SNDRV_PCM_STREAM_PLAYBACK*/ ++ int capt = state->input_stream ? 1 : 0;/*SNDRV_PCM_STREAM_CAPTURE*/ ++ int ret = 0; ++ ++ DPRINTK("snd_ep93xx_pcm_new - enter\n"); ++ ++ /* Register the new pcm device interface */ ++ ret = snd_pcm_new(card, "EP93xx-AC97-PCM", 0, play, capt, &pcm); ++ ++ if (ret){ ++ DPRINTK("%s--%x:card=%x,play=%x,capt=%x,&pcm=%x\n",__FUNCTION__,ret,(int)card,play,capt,(int)pcm); ++ goto out; ++ } ++ ++ /* allocate the pcm(DMA) memory */ ++ ret = snd_pcm_lib_preallocate_pages_for_all(pcm, /*SNDRV_DMA_TYPE_DEV,0,*/SNDRV_DMA_TYPE_CONTINUOUS,snd_dma_continuous_data(GFP_KERNEL),128*1024,128*1024); ++ ++ DPRINTK("The substream item : \n"); ++ DPRINTK("pcm->streams[0].substream->dma_buffer.addr = 0x%x\n", pcm->streams[0].substream->dma_buffer.addr); ++ DPRINTK("pcm->streams[0].substream->dma_buffer.area = 0x%x\n", pcm->streams[0].substream->dma_buffer.area); ++ DPRINTK("pcm->streams[0].substream->dma_buffer.bytes = 0x%x\n", pcm->streams[0].substream->dma_buffer.bytes); ++ DPRINTK("pcm->streams[1].substream->dma_buffer.addr = 0x%x\n", pcm->streams[1].substream->dma_buffer.addr); ++ DPRINTK("pcm->streams[1].substream->dma_buffer.area = 0x%x\n", pcm->streams[1].substream->dma_buffer.area); ++ DPRINTK("pcm->streams[1].substream->dma_buffer.bytes = 0x%x\n", pcm->streams[1].substream->dma_buffer.bytes); ++ ++ pcm->private_data = state; ++ ++ /* seem to free the pcm data struct-->self dma buffer */ ++ pcm->private_free = (void*) snd_pcm_lib_preallocate_free_for_all; ++ ++ /* alsa pcm ops setting for SNDRV_PCM_STREAM_PLAYBACK */ ++ if (play) { ++ int stream = SNDRV_PCM_STREAM_PLAYBACK; ++ snd_pcm_set_ops(pcm, stream, &snd_ep93xx_pcm_playback_ops); ++ } ++ ++ /* alsa pcm ops setting for SNDRV_PCM_STREAM_CAPTURE */ ++ if (capt) { ++ int stream = SNDRV_PCM_STREAM_CAPTURE; ++ snd_pcm_set_ops(pcm, stream, &snd_ep93xx_pcm_capture_ops); ++ } ++ ++ if (rpcm) ++ *rpcm = pcm; ++ DPRINTK("snd_ep93xx_pcm_new - exit\n"); ++out: ++ return ret; ++} ++ ++#ifdef CONFIG_PM ++ ++int ep93xx_ac97_do_suspend(struct snd_card *card, unsigned int state) ++{ ++ if (card->power_state != SNDRV_CTL_POWER_D3cold) { ++ snd_pcm_suspend_all(ep93xx_ac97_pcm); ++ snd_ac97_suspend(ep93xx_ac97_ac97); ++ snd_power_change_state(card, SNDRV_CTL_POWER_D3cold); ++ } ++ ++ return 0; ++} ++ ++int ep93xx_ac97_do_resume(struct snd_card *card, unsigned int state) ++{ ++ if (card->power_state != SNDRV_CTL_POWER_D0) { ++ ++ snd_ac97_resume(ep93xx_ac97_ac97); ++ snd_power_change_state(card, SNDRV_CTL_POWER_D0); ++ } ++ ++ return 0; ++} ++ ++int ep93xx_ac97_suspend(struct platform_device *_dev, u32 state, u32 level) ++{ ++ struct snd_card *card = platform_get_drvdata(_dev); ++ int ret = 0; ++ ++ if (card && level == SUSPEND_DISABLE) ++ ret = ep93xx_ac97_do_suspend(card, SNDRV_CTL_POWER_D3cold); ++ ++ return ret; ++} ++ ++int ep93xx_ac97_resume(struct platform_device *_dev, u32 level) ++{ ++ struct snd_card *card = platform_get_drvdata(_dev); ++ int ret = 0; ++ ++ if (card && level == RESUME_ENABLE) ++ ret = ep93xx_ac97_do_resume(card, SNDRV_CTL_POWER_D0); ++ ++ return ret; ++} ++ ++#else ++/* ++#define ep93xx_ac97_do_suspend NULL ++#define ep93xx_ac97_do_resume NULL ++#define ep93xx_ac97_suspend NULL ++#define ep93xx_ac97_resume NULL ++*/ ++ ++int ep93xx_ac97_do_suspend(struct snd_card *card, unsigned int state) ++{ ++ return 0; ++} ++ ++int ep93xx_ac97_do_resume(struct snd_card *card, unsigned int state) ++{ ++ return 0; ++} ++ ++int ep93xx_ac97_resume(struct platform_device *_dev, u32 level) ++{ ++ struct snd_card *card = platform_get_drvdata(_dev); ++ int ret = 0; ++ ++ //if (card && level == RESUME_ENABLE) ++ ret = ep93xx_ac97_do_resume(card, SNDRV_CTL_POWER_D0); ++ ++ return ret; ++} ++ ++int ep93xx_ac97_suspend(struct platform_device *_dev, u32 state, u32 level) ++{ ++ struct snd_card *card = platform_get_drvdata(_dev); ++ int ret = 0; ++ ++ //if (card && level == SUSPEND_DISABLE) ++ ret = ep93xx_ac97_do_suspend(card, SNDRV_CTL_POWER_D3cold); ++ ++ return ret; ++} ++ ++#endif ++ ++ ++ ++/* module init & exit */ ++static int __devinit ep93xx_ac97_probe(struct platform_device *dev) ++{ ++ struct snd_card *card; ++ struct snd_ac97_bus *ac97_bus; ++ struct snd_ac97_template ac97_template; ++ int err = -ENOMEM; ++ struct resource *res = NULL; ++ ++ DPRINTK("snd_ep93xx_probe - enter\n"); ++ ++ /* Enable audio early on, give the DAC time to come up. */ ++ res = platform_get_resource( dev, IORESOURCE_MEM, 0); ++ ++ if(!res) { ++ printk("error : platform_get_resource \n"); ++ return -ENODEV; ++ } ++ ++ if (!request_mem_region(res->start,res->end - res->start + 1, "snd-ac97-cs4202" )){ ++ printk("error : request_mem_region\n"); ++ return -EBUSY; ++ } ++ ++ /*enable ac97 codec*/ ++ ep93xx_audio_init(); ++ ++ /* register the soundcard */ ++ card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, ++ THIS_MODULE, 0); ++ if (!card){ ++ printk("AC97: snd_card_new error\n"); ++ goto error; ++ } ++ ++ card->dev = &dev->dev; ++ /*regist the new pcm device*/ ++ err = snd_ep93xx_pcm_new(card, &audio_state, &ep93xx_ac97_pcm); ++ if (err){ ++ printk("AC97: ep93xx_ac97_pcm_new error\n"); ++ goto error; ++ } ++ if (card == NULL) { ++ DPRINTK(KERN_ERR "snd_card_new() failed\n"); ++ goto error; ++ } ++ ++ /*driver name*/ ++ strcpy(card->driver, "CS4202A"); ++ strcpy(card->shortname, "Cirrus Logic AC97 Audio "); ++ strcpy(card->longname, "Cirrus Logic AC97 Audio with CS4202A"); ++ ++ /*regist the new ac97 device*/ ++ err = snd_ac97_bus(card, 0, &ep93xx_ac97_ops, NULL, &ac97_bus); ++ if (err){ ++ printk("AC97: snd_ac97_bus error\n"); ++ goto error; ++ } ++ ++ memset(&ac97_template, 0, sizeof(ac97_template)); ++ err = snd_ac97_mixer(ac97_bus, &ac97_template, &ep93xx_ac97_ac97); ++ if (err){ ++ printk("AC97: snd_ac97_mixer error\n"); ++ goto error; ++ } ++ ++ /**/ ++ ep93xx_audio_init(); ++ /*setting the card device callback*/ ++ //err = snd_card_set_pm_callback(card, ep93xx_ac97_do_suspend,ep93xx_ac97_do_resume, (void*)NULL); ++ //if(err != 0){ ++ // printk("snd_card_set_pm_callback error\n"); ++ //} ++ ++ /*regist the new CARD device*/ ++ err = snd_card_register(card); ++ if (err == 0) { ++ printk( KERN_INFO "Cirrus Logic ep93xx ac97 audio initialized\n" ); ++ platform_set_drvdata(dev,card); ++ DPRINTK("snd_ep93xx_probe - exit\n"); ++ return 0; ++ } ++ ++error: ++ snd_card_free(card); ++ printk("snd_ep93xx_probe - error\n"); ++ return err; ++ ++return 0; ++} ++ ++static int __devexit ep93xx_ac97_remove(struct platform_device *dev) ++{ ++ struct resource *res; ++ struct snd_card *card = platform_get_drvdata(dev); ++ ++ res = platform_get_resource( dev, IORESOURCE_MEM, 0); ++ release_mem_region(res->start, res->end - res->start + 1); ++ ++ DPRINTK("snd_ep93xx_ac97_remove - enter\n"); ++ ++ if (card) { ++ snd_card_free(card); ++ platform_set_drvdata(dev, NULL); ++ } ++ DPRINTK("snd_ep93xx_remove - exit\n"); ++ ++return 0; ++} ++ ++ ++static struct platform_driver ep93xx_ac97_driver = { ++ .probe = ep93xx_ac97_probe, ++ .remove = __devexit_p (ep93xx_ac97_remove), ++ .suspend = ep93xx_ac97_suspend, ++ .resume = ep93xx_ac97_resume, ++ .driver = { ++ .name = "ep93xx-ac97", ++ }, ++}; ++ ++ ++static int __init ep93xx_ac97_init(void) ++{ ++ int ret; ++ ++ DPRINTK(KERN_INFO "%s: version %s\n", DRIVER_DESC, DRIVER_VERSION); ++ DPRINTK("snd_ep93xx_AC97_init - enter\n"); ++ ret = platform_driver_register(&ep93xx_ac97_driver); ++ DPRINTK("snd_ep93xx_AC97_init - exit\n"); ++ return ret; ++} ++ ++static void __exit ep93xx_ac97_exit(void) ++{ ++ DPRINTK("ep93xx_ac97_exit - enter\n"); ++ return platform_driver_unregister(&ep93xx_ac97_driver); ++} ++ ++module_init(ep93xx_ac97_init); ++module_exit(ep93xx_ac97_exit); ++ ++MODULE_DESCRIPTION("Cirrus Logic audio module"); ++MODULE_LICENSE("GPL"); +--- /dev/null ++++ b/sound/arm/ep93xx-ac97.h +@@ -0,0 +1,89 @@ ++/* ++ * linux/sound/arm/ep93xx-ac97.h -- ALSA PCM interface for the edb93xx ac97 audio ++ * ++ * Author: Fred Wei ++ * Created: July 19, 2005 ++ * Copyright: Cirrus Logic, Inc. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++#define EP93XX_DEFAULT_NUM_CHANNELS 2 ++#define EP93XX_DEFAULT_FORMAT SNDRV_PCM_FORMAT_S16_LE ++#define EP93XX_DEFAULT_BIT_WIDTH 16 ++#define MAX_DEVICE_NAME 20 ++ ++/* ++ * Buffer Management ++ */ ++ ++typedef struct { ++ ++ unsigned char *area; /* virtual pointer */ ++ dma_addr_t dma_addr; /* physical address */ ++ size_t bytes; ++ size_t reportedbytes; /* buffer size */ ++ int sent; /* indicates that dma has the buf */ ++ char *start; /* points to actual buffer */ ++ ++} audio_buf_t; ++ ++ ++typedef struct { ++ ++ unsigned char *area; /* virtual pointer */ ++ dma_addr_t addr; /* physical address */ ++ size_t bytes; /* buffer size in bytes */ ++ unsigned char *buff_pos; /* virtual pointer */ ++ audio_buf_t *audio_buffers; /* array of audio buffer structures */ ++ int audio_buff_count; ++ ++ ++} audio_channel_t; ++ ++typedef struct audio_stream_s { ++ ++ /* dma stuff */ ++ int dmahandles[3]; /* handles for dma driver instances */ ++ char devicename[MAX_DEVICE_NAME]; /* string - name of device */ ++ int dma_num_channels; /* 1, 2, or 3 DMA channels */ ++ audio_channel_t *dma_channels; ++ u_int nbfrags; /* nbr of fragments i.e. buffers */ ++ u_int fragsize; /* fragment i.e. buffer size */ ++ u_int dmasize; ++ int bytecount; /* nbr of processed bytes */ ++ int externedbytecount; /* nbr of processed bytes */ ++ volatile int active; /* actually in progress */ ++ volatile int stopped; /* might be active but stopped */ ++ char *hwbuf[3]; ++ long audio_rate; ++ long audio_num_channels; /* Range: 1 to 6 */ ++ int audio_channels_flag; ++ long audio_format; ++ long audio_stream_bitwidth; /* Range: 8, 16, 24 */ ++ int dma2usr_ratio; ++ ++} audio_stream_t; ++ ++ ++/* ++ * State structure for one instance ++ */ ++typedef struct { ++ ++ audio_stream_t *output_stream; ++ audio_stream_t *input_stream; ++ ep93xx_dma_dev_t output_dma[3]; ++ ep93xx_dma_dev_t input_dma[3]; ++ char *output_id[3]; ++ char *input_id[3]; ++ struct semaphore sem; /* to protect against races in attach() */ ++ int codec_set_by_playback; ++ int codec_set_by_capture; ++ int DAC_bit_width; /* 16, 20, 24 bits */ ++ int bCompactMode; /* set if 32bits = a stereo sample */ ++ ++} audio_state_t; ++ diff --git a/target/linux/ep93xx/patches-2.6.30/011-simone-board-def.patch b/target/linux/ep93xx/patches-2.6.30/011-simone-board-def.patch new file mode 100644 index 000000000..d499259ad --- /dev/null +++ b/target/linux/ep93xx/patches-2.6.30/011-simone-board-def.patch @@ -0,0 +1,1658 @@ +Index: linux-2.6.30.9/arch/arm/mach-ep93xx/Kconfig +=================================================================== +--- linux-2.6.30.9.orig/arch/arm/mach-ep93xx/Kconfig 2009-11-26 00:13:04.000000000 +0100 ++++ linux-2.6.30.9/arch/arm/mach-ep93xx/Kconfig 2009-11-26 00:13:15.000000000 +0100 +@@ -88,6 +88,12 @@ + Say 'Y' here if you want your kernel to support the + Contec Hypercontrol Micro9-L board. + ++config MACH_SIM_ONE ++ bool "Support SIM.ONE board " ++ help ++ Say 'Y' here if you want your kernel to support the ++ Simplemachines SIM.ONE board. ++ + config MACH_TS72XX + bool "Support Technologic Systems TS-72xx SBC" + help +Index: linux-2.6.30.9/arch/arm/mach-ep93xx/Makefile +=================================================================== +--- linux-2.6.30.9.orig/arch/arm/mach-ep93xx/Makefile 2009-11-26 00:13:04.000000000 +0100 ++++ linux-2.6.30.9/arch/arm/mach-ep93xx/Makefile 2009-11-26 00:13:15.000000000 +0100 +@@ -16,4 +16,5 @@ + obj-$(CONFIG_MACH_EDB9315A) += edb9315a.o + obj-$(CONFIG_MACH_GESBC9312) += gesbc9312.o + obj-$(CONFIG_MACH_MICRO9) += micro9.o ++obj-$(CONFIG_MACH_SIM_ONE) += simone.o + obj-$(CONFIG_MACH_TS72XX) += ts72xx.o +Index: linux-2.6.30.9/arch/arm/mach-ep93xx/Makefile.boot +=================================================================== +--- linux-2.6.30.9.orig/arch/arm/mach-ep93xx/Makefile.boot 2009-11-26 00:13:04.000000000 +0100 ++++ linux-2.6.30.9/arch/arm/mach-ep93xx/Makefile.boot 2009-11-26 00:13:15.000000000 +0100 +@@ -1,2 +1,4 @@ + zreladdr-y := 0x00008000 + params_phys-y := 0x00000100 ++ zreladdr-$(CONFIG_MACH_SIM_ONE) := 0xc0008000 ++params_phys-$(CONFIG_MACH_SIM_ONE) := 0xc0000100 +Index: linux-2.6.30.9/arch/arm/mach-ep93xx/simone.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.30.9/arch/arm/mach-ep93xx/simone.c 2009-11-26 00:14:09.000000000 +0100 +@@ -0,0 +1,217 @@ ++/* ++ * arch/arm/mach-ep93xx/simone.c ++ * Simplemachines SIM.ONE support. ++ * ++ * Copyright (C) 2009 Simplemachines ++ * MMC support by Peter Ivanov , 2007 ++ * ++ * 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 of the License, or (at ++ * your option) any later version. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++ ++static struct physmap_flash_data simone_flash_data = { ++ .width = 2, ++}; ++ ++static struct resource simone_flash_resource = { ++ .start = 0x60000000, ++ .end = 0x60000000+ SZ_8M - 1, ++ .flags = IORESOURCE_MEM, ++}; ++ ++static struct platform_device simone_flash = { ++ .name = "physmap-flash", ++ .id = 0, ++ .dev = { ++ .platform_data = &simone_flash_data, ++ }, ++ .num_resources = 1, ++ .resource = &simone_flash_resource, ++}; ++ ++ ++static struct resource ep93xx_ac97_resources[] = { ++ [0] = { ++ .start = EP93XX_AC97_PHY_BASE, ++ .end = EP93XX_AC97_PHY_BASE + 0x6C, ++ .flags = IORESOURCE_MEM, ++ }, ++ [1] = { ++ .start = NO_IRQ, ++ .end = NO_IRQ, ++ .flags = IORESOURCE_IRQ, ++ }, ++}; ++ ++static u64 ep93xx_ac97_dma_mask = 0xffffffffUL; ++ ++static struct platform_device ep93xx_ac97_device = { ++ .name = "ep93xx-ac97", ++ .id = 0, ++ .num_resources = 2, ++ .resource = ep93xx_ac97_resources, ++ .dev = { ++ .dma_mask = &ep93xx_ac97_dma_mask, ++ .coherent_dma_mask = 0xffffffffUL, ++ }, ++}; ++ ++ ++#ifdef CONFIG_SPI ++static struct resource ep93xx_spi_resources[] = { ++ [0] = { ++ .start = EP93XX_SPI_BASE_PHYS, ++ .end = EP93XX_SPI_BASE_PHYS + 0x0fff, ++ .flags = IORESOURCE_MEM, ++ }, ++ [1] = { ++ .start = IRQ_EP93XX_SSP, ++ .end = IRQ_EP93XX_SSP, ++ .flags = IORESOURCE_IRQ, ++ }, ++}; ++ ++static struct platform_device ep93xx_spi_device = { ++ .name = "ep93xx-spi", ++ .id = 0, ++ .resource = ep93xx_spi_resources, ++ .num_resources = ARRAY_SIZE(ep93xx_spi_resources), ++}; ++ ++ ++#define EP93XX_MMC_SPI_CARD_PRESENT EP93XX_GPIO_LINE_A(0) ++ ++/* ++ * Initializes SPI system to communicate with MMC/SD card ++ */ ++int ep93xx_mmc_spi_init (struct device *pdev, irqreturn_t (*card_det_irq_handler)(int, void *), ++ void *mmc) ++{ ++ int rv; ++ ++ rv = gpio_request(EP93XX_MMC_SPI_CARD_PRESENT, "ep93xx-mmc-spi"); ++ if (rv) { ++ dev_info(pdev, "failed to request MMC/SD gpio pin\n"); ++ return rv; ++ } ++ ++ gpio_direction_input (EP93XX_MMC_SPI_CARD_PRESENT); ++ ++ if ((rv = request_irq (gpio_to_irq( EP93XX_MMC_SPI_CARD_PRESENT), ++ card_det_irq_handler, ++ IRQF_DISABLED | IRQ_TYPE_EDGE_FALLING, /* flags */ ++ "ep93xx-mmc-spi", /* devname */ ++ mmc /* void *devid */ ++ )) == 0) ++ { ++ dev_info (pdev, "MMC/SD card detection IRQ %i assigned.\n", ++ gpio_to_irq(EP93XX_MMC_SPI_CARD_PRESENT)); ++ } ++ else ++ { ++ dev_err (pdev, "Cannot assign MMC/SD card detection IRQ (%i)!\n", ++ gpio_to_irq(EP93XX_MMC_SPI_CARD_PRESENT)); ++ return rv; ++ } ++ return 0; ++} ++ ++void ep93xx_mmc_spi_exit (struct device *pdev, void *mmc) ++{ ++ free_irq (EP93XX_MMC_SPI_CARD_PRESENT, mmc); ++} ++ ++static struct mmc_spi_platform_data ep93xx_spi_pdata = { ++ .init = &ep93xx_mmc_spi_init, ++ .exit = &ep93xx_mmc_spi_exit, ++ .get_ro = NULL, ++ .detect_delay = 500, /* card detection delay in msec */ ++ .ocr_mask = MMC_VDD_33_34, ++}; ++ ++static struct spi_board_info ep93xx_spi_board_info[] __initdata = { ++ { ++ .modalias = "mmc_spi", ++ .max_speed_hz = 7.4E6, /* max spi clock (SCK) speed in HZ */ ++ .bus_num = 0, ++ .chip_select = 0, ++ .platform_data = (void*) &ep93xx_spi_pdata, ++ .controller_data = NULL, ++ .mode = SPI_MODE_0, ++ } ++}; ++#endif ++static struct ep93xx_eth_data ep93xx_eth_data = { ++ .dev_addr = { 0x00, 0xba, 0xd0, 0x0b, 0xad, 0x00 }, ++}; ++ ++static struct resource ep93xx_eth_resource[] = { ++ { ++ .start = EP93XX_ETHERNET_PHYS_BASE, ++ .end = EP93XX_ETHERNET_PHYS_BASE + 0xffff, ++ .flags = IORESOURCE_MEM, ++ }, { ++ .start = IRQ_EP93XX_ETHERNET, ++ .end = IRQ_EP93XX_ETHERNET, ++ .flags = IORESOURCE_IRQ, ++ } ++}; ++ ++static struct platform_device ep93xx_eth_device = { ++ .name = "ep93xx-eth", ++ .id = -1, ++ .dev = { ++ .platform_data = &ep93xx_eth_data, ++ }, ++ .num_resources = ARRAY_SIZE(ep93xx_eth_resource), ++ .resource = ep93xx_eth_resource, ++}; ++ ++static void __init simone_init_machine(void) ++{ ++ ep93xx_init_devices(); ++ /* Switch off the LCD backlight*/ ++ gpio_request(EP93XX_GPIO_LINE_B(5), "lcd"); ++ gpio_direction_output (EP93XX_GPIO_LINE_B(5), 0); ++ platform_device_register(&simone_flash); ++ platform_device_register(&ep93xx_ac97_device); ++ platform_device_register(&ep93xx_eth_device); ++#if defined(CONFIG_SPI_EP93XX) || defined(CONFIG_SPI_EP93XX_MODULE) ++ dev_set_name(&ep93xx_spi_device.dev, "apb:spi"); ++ platform_device_register(&ep93xx_spi_device); ++ spi_register_board_info(ep93xx_spi_board_info,ARRAY_SIZE(ep93xx_spi_board_info)); ++#endif ++} ++ ++MACHINE_START(SIM_ONE, "Simplemachine SimONE Board") ++ /* Maintainer: Nuccio Raciti Simplemachine */ ++ .phys_io = EP93XX_APB_PHYS_BASE, ++ .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, ++ .boot_params = 0x00000100, ++ .map_io = ep93xx_map_io, ++ .init_irq = ep93xx_init_irq, ++ .timer = &ep93xx_timer, ++ .init_machine = simone_init_machine, ++MACHINE_END +Index: linux-2.6.30.9/arch/arm/mach-ep93xx/include/mach/memory.h +=================================================================== +--- linux-2.6.30.9.orig/arch/arm/mach-ep93xx/include/mach/memory.h 2009-11-26 00:13:04.000000000 +0100 ++++ linux-2.6.30.9/arch/arm/mach-ep93xx/include/mach/memory.h 2009-11-26 00:13:15.000000000 +0100 +@@ -5,6 +5,10 @@ + #ifndef __ASM_ARCH_MEMORY_H + #define __ASM_ARCH_MEMORY_H + ++#if defined(CONFIG_MACH_SIM_ONE) ++#define PHYS_OFFSET UL(0xc0000000) ++#else + #define PHYS_OFFSET UL(0x00000000) ++#endif + + #endif +Index: linux-2.6.30.9/arch/arm/configs/simone_defconfig +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.30.9/arch/arm/configs/simone_defconfig 2009-11-26 00:13:15.000000000 +0100 +@@ -0,0 +1,1380 @@ ++# ++# Automatically generated make config: don't edit ++# Linux kernel version: 2.6.24.7 ++# Tue May 12 17:49:25 2009 ++# ++CONFIG_ARM=y ++CONFIG_SYS_SUPPORTS_APM_EMULATION=y ++# CONFIG_GENERIC_GPIO is not set ++# CONFIG_GENERIC_TIME is not set ++# CONFIG_GENERIC_CLOCKEVENTS is not set ++CONFIG_MMU=y ++# CONFIG_NO_IOPORT is not set ++CONFIG_GENERIC_HARDIRQS=y ++CONFIG_STACKTRACE_SUPPORT=y ++CONFIG_LOCKDEP_SUPPORT=y ++CONFIG_TRACE_IRQFLAGS_SUPPORT=y ++CONFIG_HARDIRQS_SW_RESEND=y ++CONFIG_GENERIC_IRQ_PROBE=y ++CONFIG_RWSEM_GENERIC_SPINLOCK=y ++# CONFIG_ARCH_HAS_ILOG2_U32 is not set ++# CONFIG_ARCH_HAS_ILOG2_U64 is not set ++CONFIG_GENERIC_HWEIGHT=y ++CONFIG_GENERIC_CALIBRATE_DELAY=y ++CONFIG_ZONE_DMA=y ++CONFIG_VECTORS_BASE=0xffff0000 ++CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" ++ ++# ++# General setup ++# ++CONFIG_EXPERIMENTAL=y ++CONFIG_BROKEN_ON_SMP=y ++CONFIG_LOCK_KERNEL=y ++CONFIG_INIT_ENV_ARG_LIMIT=32 ++CONFIG_LOCALVERSION="" ++CONFIG_LOCALVERSION_AUTO=y ++CONFIG_SWAP=y ++CONFIG_SYSVIPC=y ++CONFIG_SYSVIPC_SYSCTL=y ++# CONFIG_POSIX_MQUEUE is not set ++# CONFIG_BSD_PROCESS_ACCT is not set ++# CONFIG_TASKSTATS is not set ++# CONFIG_USER_NS is not set ++# CONFIG_PID_NS is not set ++# CONFIG_AUDIT is not set ++CONFIG_IKCONFIG=y ++CONFIG_IKCONFIG_PROC=y ++CONFIG_LOG_BUF_SHIFT=16 ++# CONFIG_CGROUPS is not set ++CONFIG_FAIR_GROUP_SCHED=y ++CONFIG_FAIR_USER_SCHED=y ++# CONFIG_FAIR_CGROUP_SCHED is not set ++CONFIG_SYSFS_DEPRECATED=y ++# CONFIG_RELAY is not set ++# CONFIG_BLK_DEV_INITRD is not set ++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set ++CONFIG_SYSCTL=y ++CONFIG_EMBEDDED=y ++CONFIG_UID16=y ++CONFIG_SYSCTL_SYSCALL=y ++CONFIG_KALLSYMS=y ++# CONFIG_KALLSYMS_EXTRA_PASS is not set ++CONFIG_HOTPLUG=y ++CONFIG_PRINTK=y ++CONFIG_BUG=y ++CONFIG_ELF_CORE=y ++CONFIG_BASE_FULL=y ++CONFIG_FUTEX=y ++CONFIG_ANON_INODES=y ++CONFIG_EPOLL=y ++CONFIG_SIGNALFD=y ++CONFIG_EVENTFD=y ++CONFIG_SHMEM=y ++CONFIG_VM_EVENT_COUNTERS=y ++CONFIG_SLAB=y ++# CONFIG_SLUB is not set ++# CONFIG_SLOB is not set ++CONFIG_SLABINFO=y ++CONFIG_RT_MUTEXES=y ++# CONFIG_TINY_SHMEM is not set ++CONFIG_BASE_SMALL=0 ++CONFIG_MODULES=y ++CONFIG_MODULE_UNLOAD=y ++CONFIG_MODULE_FORCE_UNLOAD=y ++# CONFIG_MODVERSIONS is not set ++# CONFIG_MODULE_SRCVERSION_ALL is not set ++CONFIG_KMOD=y ++CONFIG_BLOCK=y ++# CONFIG_LBD is not set ++# CONFIG_BLK_DEV_IO_TRACE is not set ++# CONFIG_LSF is not set ++# CONFIG_BLK_DEV_BSG is not set ++ ++# ++# IO Schedulers ++# ++CONFIG_IOSCHED_NOOP=y ++# CONFIG_IOSCHED_AS is not set ++CONFIG_IOSCHED_DEADLINE=y ++# CONFIG_IOSCHED_CFQ is not set ++# CONFIG_DEFAULT_AS is not set ++CONFIG_DEFAULT_DEADLINE=y ++# CONFIG_DEFAULT_CFQ is not set ++# CONFIG_DEFAULT_NOOP is not set ++CONFIG_DEFAULT_IOSCHED="deadline" ++ ++# ++# System Type ++# ++# CONFIG_ARCH_AAEC2000 is not set ++# CONFIG_ARCH_INTEGRATOR is not set ++# CONFIG_ARCH_REALVIEW is not set ++# CONFIG_ARCH_VERSATILE is not set ++# CONFIG_ARCH_AT91 is not set ++# CONFIG_ARCH_CLPS7500 is not set ++# CONFIG_ARCH_CLPS711X is not set ++# CONFIG_ARCH_CO285 is not set ++# CONFIG_ARCH_EBSA110 is not set ++CONFIG_ARCH_EP93XX=y ++# CONFIG_ARCH_FOOTBRIDGE is not set ++# CONFIG_ARCH_NETX is not set ++# CONFIG_ARCH_H720X is not set ++# CONFIG_ARCH_IMX is not set ++# CONFIG_ARCH_IOP13XX is not set ++# CONFIG_ARCH_IOP32X is not set ++# CONFIG_ARCH_IOP33X is not set ++# CONFIG_ARCH_IXP23XX is not set ++# CONFIG_ARCH_IXP2000 is not set ++# CONFIG_ARCH_IXP4XX is not set ++# CONFIG_ARCH_L7200 is not set ++# CONFIG_ARCH_KS8695 is not set ++# CONFIG_ARCH_NS9XXX is not set ++# CONFIG_ARCH_MXC is not set ++# CONFIG_ARCH_PNX4008 is not set ++# CONFIG_ARCH_PXA is not set ++# CONFIG_ARCH_RPC is not set ++# CONFIG_ARCH_SA1100 is not set ++# CONFIG_ARCH_S3C2410 is not set ++# CONFIG_ARCH_SHARK is not set ++# CONFIG_ARCH_LH7A40X is not set ++# CONFIG_ARCH_DAVINCI is not set ++# CONFIG_ARCH_OMAP is not set ++ ++# ++# Cirrus EP93xx Implementation Options ++# ++CONFIG_CRUNCH=y ++ ++# ++# EP93xx Platforms ++# ++# CONFIG_MACH_ADSSPHERE is not set ++# CONFIG_MACH_EDB9302 is not set ++# CONFIG_MACH_EDB9302A is not set ++# CONFIG_MACH_EDB9307 is not set ++# CONFIG_MACH_EDB9312 is not set ++# CONFIG_MACH_EDB9315 is not set ++# CONFIG_MACH_EDB9315A is not set ++# CONFIG_MACH_GESBC9312 is not set ++# CONFIG_MACH_MICRO9 is not set ++# CONFIG_MACH_MICRO9H is not set ++# CONFIG_MACH_MICRO9M is not set ++# CONFIG_MACH_MICRO9L is not set ++CONFIG_MACH_SIM_ONE=y ++# CONFIG_MACH_TS72XX is not set ++ ++# ++# Boot options ++# ++ ++# ++# Power management ++# ++ ++# ++# Processor Type ++# ++CONFIG_CPU_32=y ++CONFIG_CPU_ARM920T=y ++CONFIG_CPU_32v4T=y ++CONFIG_CPU_ABRT_EV4T=y ++CONFIG_CPU_CACHE_V4WT=y ++CONFIG_CPU_CACHE_VIVT=y ++CONFIG_CPU_COPY_V4WB=y ++CONFIG_CPU_TLB_V4WBI=y ++CONFIG_CPU_CP15=y ++CONFIG_CPU_CP15_MMU=y ++ ++# ++# Processor Features ++# ++CONFIG_ARM_THUMB=y ++# CONFIG_CPU_ICACHE_DISABLE is not set ++# CONFIG_CPU_DCACHE_DISABLE is not set ++# CONFIG_CPU_DCACHE_WRITETHROUGH is not set ++# CONFIG_OUTER_CACHE is not set ++CONFIG_ARM_VIC=y ++ ++# ++# Bus support ++# ++CONFIG_ARM_AMBA=y ++# CONFIG_PCI_SYSCALL is not set ++# CONFIG_ARCH_SUPPORTS_MSI is not set ++# CONFIG_PCCARD is not set ++ ++# ++# Kernel Features ++# ++# CONFIG_TICK_ONESHOT is not set ++CONFIG_PREEMPT=y ++# CONFIG_NO_IDLE_HZ is not set ++CONFIG_HZ=100 ++CONFIG_AEABI=y ++CONFIG_OABI_COMPAT=y ++# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set ++CONFIG_SELECT_MEMORY_MODEL=y ++CONFIG_FLATMEM_MANUAL=y ++# CONFIG_DISCONTIGMEM_MANUAL is not set ++# CONFIG_SPARSEMEM_MANUAL is not set ++CONFIG_FLATMEM=y ++CONFIG_FLAT_NODE_MEM_MAP=y ++# CONFIG_SPARSEMEM_STATIC is not set ++# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set ++CONFIG_SPLIT_PTLOCK_CPUS=4096 ++# CONFIG_RESOURCES_64BIT is not set ++CONFIG_ZONE_DMA_FLAG=1 ++CONFIG_BOUNCE=y ++CONFIG_VIRT_TO_BUS=y ++CONFIG_ALIGNMENT_TRAP=y ++ ++# ++# Boot options ++# ++CONFIG_ZBOOT_ROM_TEXT=0x0 ++CONFIG_ZBOOT_ROM_BSS=0x0 ++CONFIG_CMDLINE="console=ttyAM0,115200 root=/dev/ram" ++# CONFIG_XIP_KERNEL is not set ++# CONFIG_KEXEC is not set ++ ++# ++# Floating point emulation ++# ++ ++# ++# At least one emulation must be selected ++# ++CONFIG_FPE_NWFPE=y ++CONFIG_FPE_NWFPE_XP=y ++# CONFIG_FPE_FASTFPE is not set ++ ++# ++# Userspace binary formats ++# ++CONFIG_BINFMT_ELF=y ++# CONFIG_BINFMT_AOUT is not set ++# CONFIG_BINFMT_MISC is not set ++# CONFIG_ARTHUR is not set ++ ++# ++# Power management options ++# ++# CONFIG_PM is not set ++CONFIG_SUSPEND_UP_POSSIBLE=y ++ ++# ++# Networking ++# ++CONFIG_NET=y ++ ++# ++# Networking options ++# ++CONFIG_PACKET=y ++CONFIG_PACKET_MMAP=y ++CONFIG_UNIX=y ++CONFIG_XFRM=y ++# CONFIG_XFRM_USER is not set ++# CONFIG_XFRM_SUB_POLICY is not set ++# CONFIG_XFRM_MIGRATE is not set ++CONFIG_NET_KEY=y ++# CONFIG_NET_KEY_MIGRATE is not set ++CONFIG_INET=y ++# CONFIG_IP_MULTICAST is not set ++# CONFIG_IP_ADVANCED_ROUTER is not set ++CONFIG_IP_FIB_HASH=y ++CONFIG_IP_PNP=y ++CONFIG_IP_PNP_DHCP=y ++CONFIG_IP_PNP_BOOTP=y ++# CONFIG_IP_PNP_RARP is not set ++# CONFIG_NET_IPIP is not set ++# CONFIG_NET_IPGRE is not set ++# CONFIG_ARPD is not set ++CONFIG_SYN_COOKIES=y ++# CONFIG_INET_AH is not set ++# CONFIG_INET_ESP is not set ++# CONFIG_INET_IPCOMP is not set ++# CONFIG_INET_XFRM_TUNNEL is not set ++# CONFIG_INET_TUNNEL is not set ++CONFIG_INET_XFRM_MODE_TRANSPORT=y ++CONFIG_INET_XFRM_MODE_TUNNEL=y ++CONFIG_INET_XFRM_MODE_BEET=y ++# CONFIG_INET_LRO is not set ++CONFIG_INET_DIAG=y ++CONFIG_INET_TCP_DIAG=y ++# CONFIG_TCP_CONG_ADVANCED is not set ++CONFIG_TCP_CONG_CUBIC=y ++CONFIG_DEFAULT_TCP_CONG="cubic" ++# CONFIG_TCP_MD5SIG is not set ++CONFIG_IPV6=y ++# CONFIG_IPV6_PRIVACY is not set ++# CONFIG_IPV6_ROUTER_PREF is not set ++# CONFIG_IPV6_OPTIMISTIC_DAD is not set ++# CONFIG_INET6_AH is not set ++# CONFIG_INET6_ESP is not set ++# CONFIG_INET6_IPCOMP is not set ++# CONFIG_IPV6_MIP6 is not set ++# CONFIG_INET6_XFRM_TUNNEL is not set ++# CONFIG_INET6_TUNNEL is not set ++# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set ++# CONFIG_INET6_XFRM_MODE_TUNNEL is not set ++# CONFIG_INET6_XFRM_MODE_BEET is not set ++# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set ++# CONFIG_IPV6_SIT is not set ++# CONFIG_IPV6_TUNNEL is not set ++# CONFIG_IPV6_MULTIPLE_TABLES is not set ++# CONFIG_NETWORK_SECMARK is not set ++# CONFIG_NETFILTER is not set ++# CONFIG_IP_DCCP is not set ++# CONFIG_IP_SCTP is not set ++# CONFIG_TIPC is not set ++# CONFIG_ATM is not set ++# CONFIG_BRIDGE is not set ++# CONFIG_VLAN_8021Q is not set ++# CONFIG_DECNET is not set ++# CONFIG_LLC2 is not set ++# CONFIG_IPX is not set ++# CONFIG_ATALK is not set ++# CONFIG_X25 is not set ++# CONFIG_LAPB is not set ++# CONFIG_ECONET is not set ++# CONFIG_WAN_ROUTER is not set ++# CONFIG_NET_SCHED is not set ++CONFIG_NET_SCH_FIFO=y ++ ++# ++# Network testing ++# ++# CONFIG_NET_PKTGEN is not set ++# CONFIG_HAMRADIO is not set ++# CONFIG_IRDA is not set ++# CONFIG_BT is not set ++# CONFIG_AF_RXRPC is not set ++ ++# ++# Wireless ++# ++CONFIG_CFG80211=y ++CONFIG_NL80211=y ++CONFIG_WIRELESS_EXT=y ++CONFIG_MAC80211=m ++CONFIG_MAC80211_RCSIMPLE=y ++# CONFIG_MAC80211_DEBUG is not set ++CONFIG_IEEE80211=m ++# CONFIG_IEEE80211_DEBUG is not set ++CONFIG_IEEE80211_CRYPT_WEP=m ++CONFIG_IEEE80211_CRYPT_CCMP=m ++CONFIG_IEEE80211_CRYPT_TKIP=m ++# CONFIG_IEEE80211_SOFTMAC is not set ++# CONFIG_RFKILL is not set ++# CONFIG_NET_9P is not set ++ ++# ++# Device Drivers ++# ++ ++# ++# Generic Driver Options ++# ++CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" ++CONFIG_STANDALONE=y ++CONFIG_PREVENT_FIRMWARE_BUILD=y ++# CONFIG_FW_LOADER is not set ++# CONFIG_SYS_HYPERVISOR is not set ++# CONFIG_CONNECTOR is not set ++CONFIG_MTD=y ++# CONFIG_MTD_DEBUG is not set ++# CONFIG_MTD_CONCAT is not set ++CONFIG_MTD_PARTITIONS=y ++# CONFIG_MTD_REDBOOT_PARTS is not set ++# CONFIG_MTD_CMDLINE_PARTS is not set ++# CONFIG_MTD_AFS_PARTS is not set ++ ++# ++# User Modules And Translation Layers ++# ++CONFIG_MTD_CHAR=y ++CONFIG_MTD_BLKDEVS=y ++CONFIG_MTD_BLOCK=y ++# CONFIG_FTL is not set ++# CONFIG_NFTL is not set ++# CONFIG_INFTL is not set ++# CONFIG_RFD_FTL is not set ++# CONFIG_SSFDC is not set ++# CONFIG_MTD_OOPS is not set ++ ++# ++# RAM/ROM/Flash chip drivers ++# ++CONFIG_MTD_CFI=y ++# CONFIG_MTD_JEDECPROBE is not set ++CONFIG_MTD_GEN_PROBE=y ++CONFIG_MTD_CFI_ADV_OPTIONS=y ++CONFIG_MTD_CFI_NOSWAP=y ++# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set ++# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set ++# CONFIG_MTD_CFI_GEOMETRY is not set ++CONFIG_MTD_MAP_BANK_WIDTH_1=y ++CONFIG_MTD_MAP_BANK_WIDTH_2=y ++CONFIG_MTD_MAP_BANK_WIDTH_4=y ++# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set ++# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set ++# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set ++CONFIG_MTD_CFI_I1=y ++CONFIG_MTD_CFI_I2=y ++# CONFIG_MTD_CFI_I4 is not set ++# CONFIG_MTD_CFI_I8 is not set ++# CONFIG_MTD_OTP is not set ++CONFIG_MTD_CFI_INTELEXT=y ++CONFIG_MTD_CFI_AMDSTD=y ++CONFIG_MTD_CFI_STAA=y ++CONFIG_MTD_CFI_UTIL=y ++CONFIG_MTD_RAM=y ++# CONFIG_MTD_ROM is not set ++# CONFIG_MTD_ABSENT is not set ++ ++# ++# Mapping drivers for chip access ++# ++# CONFIG_MTD_COMPLEX_MAPPINGS is not set ++CONFIG_MTD_PHYSMAP=y ++CONFIG_MTD_PHYSMAP_START=0x0 ++CONFIG_MTD_PHYSMAP_LEN=0x0 ++CONFIG_MTD_PHYSMAP_BANKWIDTH=1 ++# CONFIG_MTD_ARM_INTEGRATOR is not set ++# CONFIG_MTD_PLATRAM is not set ++ ++# ++# Self-contained MTD device drivers ++# ++# CONFIG_MTD_DATAFLASH is not set ++# CONFIG_MTD_M25P80 is not set ++# CONFIG_MTD_SLRAM is not set ++# CONFIG_MTD_PHRAM is not set ++# CONFIG_MTD_MTDRAM is not set ++# CONFIG_MTD_BLOCK2MTD is not set ++ ++# ++# Disk-On-Chip Device Drivers ++# ++# CONFIG_MTD_DOC2000 is not set ++# CONFIG_MTD_DOC2001 is not set ++# CONFIG_MTD_DOC2001PLUS is not set ++# CONFIG_MTD_NAND is not set ++# CONFIG_MTD_ONENAND is not set ++ ++# ++# UBI - Unsorted block images ++# ++# CONFIG_MTD_UBI is not set ++# CONFIG_PARPORT is not set ++CONFIG_BLK_DEV=y ++# CONFIG_BLK_DEV_COW_COMMON is not set ++CONFIG_BLK_DEV_LOOP=y ++# CONFIG_BLK_DEV_CRYPTOLOOP is not set ++CONFIG_BLK_DEV_NBD=y ++# CONFIG_BLK_DEV_UB is not set ++# CONFIG_BLK_DEV_RAM is not set ++# CONFIG_CDROM_PKTCDVD is not set ++# CONFIG_ATA_OVER_ETH is not set ++# CONFIG_MISC_DEVICES is not set ++CONFIG_EEPROM_93CX6=m ++ ++# ++# SCSI device support ++# ++# CONFIG_RAID_ATTRS is not set ++CONFIG_SCSI=y ++CONFIG_SCSI_DMA=y ++# CONFIG_SCSI_TGT is not set ++# CONFIG_SCSI_NETLINK is not set ++# CONFIG_SCSI_PROC_FS is not set ++ ++# ++# SCSI support type (disk, tape, CD-ROM) ++# ++CONFIG_BLK_DEV_SD=y ++# CONFIG_CHR_DEV_ST is not set ++# CONFIG_CHR_DEV_OSST is not set ++# CONFIG_BLK_DEV_SR is not set ++# CONFIG_CHR_DEV_SG is not set ++# CONFIG_CHR_DEV_SCH is not set ++ ++# ++# Some SCSI devices (e.g. CD jukebox) support multiple LUNs ++# ++# CONFIG_SCSI_MULTI_LUN is not set ++# CONFIG_SCSI_CONSTANTS is not set ++# CONFIG_SCSI_LOGGING is not set ++# CONFIG_SCSI_SCAN_ASYNC is not set ++CONFIG_SCSI_WAIT_SCAN=m ++ ++# ++# SCSI Transports ++# ++# CONFIG_SCSI_SPI_ATTRS is not set ++# CONFIG_SCSI_FC_ATTRS is not set ++# CONFIG_SCSI_ISCSI_ATTRS is not set ++# CONFIG_SCSI_SAS_LIBSAS is not set ++# CONFIG_SCSI_SRP_ATTRS is not set ++CONFIG_SCSI_LOWLEVEL=y ++# CONFIG_ISCSI_TCP is not set ++# CONFIG_SCSI_DEBUG is not set ++# CONFIG_ATA is not set ++# CONFIG_MD is not set ++CONFIG_NETDEVICES=y ++# CONFIG_NETDEVICES_MULTIQUEUE is not set ++# CONFIG_DUMMY is not set ++# CONFIG_BONDING is not set ++# CONFIG_MACVLAN is not set ++# CONFIG_EQUALIZER is not set ++# CONFIG_TUN is not set ++# CONFIG_VETH is not set ++# CONFIG_PHYLIB is not set ++CONFIG_NET_ETHERNET=y ++CONFIG_MII=y ++CONFIG_EP93XX_ETH=y ++# CONFIG_AX88796 is not set ++# CONFIG_SMC91X is not set ++# CONFIG_DM9000 is not set ++# CONFIG_IBM_NEW_EMAC_ZMII is not set ++# CONFIG_IBM_NEW_EMAC_RGMII is not set ++# CONFIG_IBM_NEW_EMAC_TAH is not set ++# CONFIG_IBM_NEW_EMAC_EMAC4 is not set ++# CONFIG_B44 is not set ++# CONFIG_NETDEV_1000 is not set ++# CONFIG_NETDEV_10000 is not set ++ ++# ++# Wireless LAN ++# ++# CONFIG_WLAN_PRE80211 is not set ++CONFIG_WLAN_80211=y ++# CONFIG_LIBERTAS is not set ++# CONFIG_USB_ZD1201 is not set ++CONFIG_RTL8187=m ++# CONFIG_HOSTAP is not set ++# CONFIG_B43 is not set ++# CONFIG_B43LEGACY is not set ++# CONFIG_RT2X00 is not set ++ ++# ++# USB Network Adapters ++# ++CONFIG_USB_CATC=y ++# CONFIG_USB_KAWETH is not set ++# CONFIG_USB_PEGASUS is not set ++CONFIG_USB_RTL8150=y ++# CONFIG_USB_USBNET is not set ++# CONFIG_WAN is not set ++CONFIG_PPP=m ++# CONFIG_PPP_MULTILINK is not set ++# CONFIG_PPP_FILTER is not set ++# CONFIG_PPP_ASYNC is not set ++CONFIG_PPP_SYNC_TTY=m ++# CONFIG_PPP_DEFLATE is not set ++CONFIG_PPP_BSDCOMP=m ++# CONFIG_PPP_MPPE is not set ++CONFIG_PPPOE=m ++# CONFIG_PPPOL2TP is not set ++# CONFIG_SLIP is not set ++CONFIG_SLHC=m ++# CONFIG_SHAPER is not set ++# CONFIG_NETCONSOLE is not set ++# CONFIG_NETPOLL is not set ++# CONFIG_NET_POLL_CONTROLLER is not set ++# CONFIG_ISDN is not set ++ ++# ++# Input device support ++# ++CONFIG_INPUT=y ++# CONFIG_INPUT_FF_MEMLESS is not set ++# CONFIG_INPUT_POLLDEV is not set ++ ++# ++# Userland interfaces ++# ++CONFIG_INPUT_MOUSEDEV=y ++CONFIG_INPUT_MOUSEDEV_PSAUX=y ++CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 ++CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 ++# CONFIG_INPUT_JOYDEV is not set ++CONFIG_INPUT_EVDEV=y ++# CONFIG_INPUT_EVBUG is not set ++ ++# ++# Input Device Drivers ++# ++CONFIG_INPUT_KEYBOARD=y ++CONFIG_KEYBOARD_ATKBD=y ++# CONFIG_KEYBOARD_SUNKBD is not set ++# CONFIG_KEYBOARD_LKKBD is not set ++# CONFIG_KEYBOARD_XTKBD is not set ++# CONFIG_KEYBOARD_NEWTON is not set ++# CONFIG_KEYBOARD_STOWAWAY is not set ++CONFIG_INPUT_MOUSE=y ++CONFIG_MOUSE_PS2=y ++CONFIG_MOUSE_PS2_ALPS=y ++# CONFIG_MOUSE_PS2_LOGIPS2PP is not set ++# CONFIG_MOUSE_PS2_SYNAPTICS is not set ++# CONFIG_MOUSE_PS2_LIFEBOOK is not set ++# CONFIG_MOUSE_PS2_TRACKPOINT is not set ++# CONFIG_MOUSE_PS2_TOUCHKIT is not set ++# CONFIG_MOUSE_SERIAL is not set ++# CONFIG_MOUSE_APPLETOUCH is not set ++# CONFIG_MOUSE_VSXXXAA is not set ++# CONFIG_INPUT_JOYSTICK is not set ++# CONFIG_INPUT_TABLET is not set ++CONFIG_INPUT_TOUCHSCREEN=y ++# CONFIG_TOUCHSCREEN_ADS7846 is not set ++# CONFIG_TOUCHSCREEN_FUJITSU is not set ++# CONFIG_TOUCHSCREEN_GUNZE is not set ++# CONFIG_TOUCHSCREEN_ELO is not set ++# CONFIG_TOUCHSCREEN_MTOUCH is not set ++# CONFIG_TOUCHSCREEN_MK712 is not set ++# CONFIG_TOUCHSCREEN_PENMOUNT is not set ++# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set ++# CONFIG_TOUCHSCREEN_TOUCHWIN is not set ++# CONFIG_TOUCHSCREEN_UCB1400 is not set ++# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set ++CONFIG_TOUCHSCREEN_EP93XX=y ++# CONFIG_INPUT_MISC is not set ++ ++# ++# Hardware I/O ports ++# ++CONFIG_SERIO=y ++# CONFIG_SERIO_SERPORT is not set ++# CONFIG_SERIO_AMBAKMI is not set ++CONFIG_SERIO_LIBPS2=y ++# CONFIG_SERIO_RAW is not set ++# CONFIG_GAMEPORT is not set ++ ++# ++# Character devices ++# ++CONFIG_VT=y ++CONFIG_VT_CONSOLE=y ++CONFIG_HW_CONSOLE=y ++# CONFIG_VT_HW_CONSOLE_BINDING is not set ++# CONFIG_SERIAL_NONSTANDARD is not set ++ ++# ++# Serial drivers ++# ++# CONFIG_SERIAL_8250 is not set ++ ++# ++# Non-8250 serial port support ++# ++CONFIG_SERIAL_AMBA_PL010=y ++CONFIG_SERIAL_AMBA_PL010_CONSOLE=y ++# CONFIG_SERIAL_AMBA_PL011 is not set ++CONFIG_SERIAL_CORE=y ++CONFIG_SERIAL_CORE_CONSOLE=y ++CONFIG_UNIX98_PTYS=y ++# CONFIG_LEGACY_PTYS is not set ++# CONFIG_IPMI_HANDLER is not set ++# CONFIG_HW_RANDOM is not set ++# CONFIG_NVRAM is not set ++# CONFIG_R3964 is not set ++# CONFIG_RAW_DRIVER is not set ++# CONFIG_TCG_TPM is not set ++CONFIG_I2C=y ++CONFIG_I2C_BOARDINFO=y ++CONFIG_I2C_CHARDEV=y ++ ++# ++# I2C Algorithms ++# ++CONFIG_I2C_ALGOBIT=y ++# CONFIG_I2C_ALGOPCF is not set ++# CONFIG_I2C_ALGOPCA is not set ++ ++# ++# I2C Hardware Bus support ++# ++CONFIG_I2C_EP93XX=y ++# CONFIG_I2C_OCORES is not set ++# CONFIG_I2C_PARPORT_LIGHT is not set ++# CONFIG_I2C_SIMTEC is not set ++# CONFIG_I2C_TAOS_EVM is not set ++# CONFIG_I2C_STUB is not set ++# CONFIG_I2C_TINY_USB is not set ++ ++# ++# Miscellaneous I2C Chip support ++# ++CONFIG_SENSORS_DS1337=y ++# CONFIG_SENSORS_DS1374 is not set ++# CONFIG_DS1682 is not set ++# CONFIG_SENSORS_EEPROM is not set ++# CONFIG_SENSORS_PCF8574 is not set ++# CONFIG_SENSORS_PCA9539 is not set ++# CONFIG_SENSORS_PCF8591 is not set ++# CONFIG_SENSORS_MAX6875 is not set ++# CONFIG_SENSORS_TSL2550 is not set ++# CONFIG_I2C_DEBUG_CORE is not set ++# CONFIG_I2C_DEBUG_ALGO is not set ++# CONFIG_I2C_DEBUG_BUS is not set ++# CONFIG_I2C_DEBUG_CHIP is not set ++ ++# ++# SPI support ++# ++CONFIG_SPI=y ++CONFIG_SPI_MASTER=y ++ ++# ++# SPI Master Controller Drivers ++# ++CONFIG_SPI_BITBANG=y ++CONFIG_SPI_EP93XX=y ++ ++# ++# SPI Protocol Masters ++# ++# CONFIG_SPI_AT25 is not set ++# CONFIG_SPI_SPIDEV is not set ++# CONFIG_SPI_TLE62X0 is not set ++# CONFIG_W1 is not set ++# CONFIG_POWER_SUPPLY is not set ++# CONFIG_HWMON is not set ++CONFIG_WATCHDOG=y ++# CONFIG_WATCHDOG_NOWAYOUT is not set ++ ++# ++# Watchdog Device Drivers ++# ++# CONFIG_SOFT_WATCHDOG is not set ++CONFIG_EP93XX_WATCHDOG=y ++ ++# ++# USB-based Watchdog Cards ++# ++# CONFIG_USBPCWATCHDOG is not set ++ ++# ++# Sonics Silicon Backplane ++# ++CONFIG_SSB_POSSIBLE=y ++# CONFIG_SSB is not set ++ ++# ++# Multifunction device drivers ++# ++# CONFIG_MFD_SM501 is not set ++ ++# ++# Multimedia devices ++# ++# CONFIG_VIDEO_DEV is not set ++# CONFIG_DVB_CORE is not set ++# CONFIG_DAB is not set ++ ++# ++# Graphics support ++# ++# CONFIG_VGASTATE is not set ++CONFIG_VIDEO_OUTPUT_CONTROL=y ++CONFIG_FB=y ++# CONFIG_FIRMWARE_EDID is not set ++# CONFIG_FB_DDC is not set ++CONFIG_FB_CFB_FILLRECT=y ++CONFIG_FB_CFB_COPYAREA=y ++CONFIG_FB_CFB_IMAGEBLIT=y ++# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set ++# CONFIG_FB_SYS_FILLRECT is not set ++# CONFIG_FB_SYS_COPYAREA is not set ++# CONFIG_FB_SYS_IMAGEBLIT is not set ++# CONFIG_FB_SYS_FOPS is not set ++CONFIG_FB_DEFERRED_IO=y ++# CONFIG_FB_SVGALIB is not set ++# CONFIG_FB_MACMODES is not set ++# CONFIG_FB_BACKLIGHT is not set ++# CONFIG_FB_MODE_HELPERS is not set ++# CONFIG_FB_TILEBLITTING is not set ++ ++# ++# Frame buffer hardware drivers ++# ++CONFIG_FB_EP93XX=y ++# CONFIG_FB_EP93XX_MONO is not set ++# CONFIG_FB_ARMCLCD is not set ++# CONFIG_FB_S1D13XXX is not set ++# CONFIG_FB_VIRTUAL is not set ++# CONFIG_BACKLIGHT_LCD_SUPPORT is not set ++ ++# ++# Display device support ++# ++# CONFIG_DISPLAY_SUPPORT is not set ++ ++# ++# Console display driver support ++# ++# CONFIG_VGA_CONSOLE is not set ++CONFIG_DUMMY_CONSOLE=y ++CONFIG_FRAMEBUFFER_CONSOLE=y ++# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set ++# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set ++CONFIG_FONTS=y ++CONFIG_FONT_8x8=y ++CONFIG_FONT_8x16=y ++# CONFIG_FONT_6x11 is not set ++# CONFIG_FONT_7x14 is not set ++# CONFIG_FONT_PEARL_8x8 is not set ++# CONFIG_FONT_ACORN_8x8 is not set ++# CONFIG_FONT_MINI_4x6 is not set ++# CONFIG_FONT_SUN8x16 is not set ++# CONFIG_FONT_SUN12x22 is not set ++# CONFIG_FONT_10x18 is not set ++CONFIG_LOGO=y ++CONFIG_LOGO_LINUX_MONO=y ++CONFIG_LOGO_LINUX_VGA16=y ++CONFIG_LOGO_LINUX_CLUT224=y ++ ++# ++# Sound ++# ++CONFIG_SOUND=y ++ ++# ++# Advanced Linux Sound Architecture ++# ++CONFIG_SND=y ++CONFIG_SND_TIMER=y ++CONFIG_SND_PCM=y ++# CONFIG_SND_SEQUENCER is not set ++CONFIG_SND_OSSEMUL=y ++CONFIG_SND_MIXER_OSS=y ++CONFIG_SND_PCM_OSS=y ++CONFIG_SND_PCM_OSS_PLUGINS=y ++# CONFIG_SND_DYNAMIC_MINORS is not set ++# CONFIG_SND_SUPPORT_OLD_API is not set ++# CONFIG_SND_VERBOSE_PROCFS is not set ++# CONFIG_SND_VERBOSE_PRINTK is not set ++# CONFIG_SND_DEBUG is not set ++ ++# ++# Generic devices ++# ++CONFIG_SND_AC97_CODEC=y ++# CONFIG_SND_DUMMY is not set ++# CONFIG_SND_MTPAV is not set ++# CONFIG_SND_SERIAL_U16550 is not set ++# CONFIG_SND_MPU401 is not set ++ ++# ++# ALSA ARM devices ++# ++CONFIG_SND_EP93XX_AC97=y ++CONFIG_SND_EP93XX_PCM=y ++# CONFIG_SND_ARMAACI is not set ++ ++# ++# SPI devices ++# ++ ++# ++# USB devices ++# ++# CONFIG_SND_USB_AUDIO is not set ++# CONFIG_SND_USB_CAIAQ is not set ++ ++# ++# System on Chip audio support ++# ++# CONFIG_SND_SOC is not set ++ ++# ++# SoC Audio support for SuperH ++# ++ ++# ++# Open Sound System ++# ++# CONFIG_SOUND_PRIME is not set ++CONFIG_AC97_BUS=y ++CONFIG_HID_SUPPORT=y ++CONFIG_HID=y ++# CONFIG_HID_DEBUG is not set ++# CONFIG_HIDRAW is not set ++ ++# ++# USB Input Devices ++# ++CONFIG_USB_HID=y ++# CONFIG_USB_HIDINPUT_POWERBOOK is not set ++# CONFIG_HID_FF is not set ++# CONFIG_USB_HIDDEV is not set ++CONFIG_USB_SUPPORT=y ++CONFIG_USB_ARCH_HAS_HCD=y ++CONFIG_USB_ARCH_HAS_OHCI=y ++# CONFIG_USB_ARCH_HAS_EHCI is not set ++CONFIG_USB=y ++# CONFIG_USB_DEBUG is not set ++ ++# ++# Miscellaneous USB options ++# ++CONFIG_USB_DEVICEFS=y ++CONFIG_USB_DEVICE_CLASS=y ++CONFIG_USB_DYNAMIC_MINORS=y ++# CONFIG_USB_OTG is not set ++ ++# ++# USB Host Controller Drivers ++# ++# CONFIG_USB_ISP116X_HCD is not set ++CONFIG_USB_OHCI_HCD=y ++# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set ++# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set ++CONFIG_USB_OHCI_LITTLE_ENDIAN=y ++# CONFIG_USB_SL811_HCD is not set ++# CONFIG_USB_R8A66597_HCD is not set ++ ++# ++# USB Device Class drivers ++# ++CONFIG_USB_ACM=m ++CONFIG_USB_PRINTER=m ++ ++# ++# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' ++# ++ ++# ++# may also be needed; see USB_STORAGE Help for more information ++# ++CONFIG_USB_STORAGE=y ++# CONFIG_USB_STORAGE_DEBUG is not set ++# CONFIG_USB_STORAGE_DATAFAB is not set ++# CONFIG_USB_STORAGE_FREECOM is not set ++# CONFIG_USB_STORAGE_ISD200 is not set ++# CONFIG_USB_STORAGE_DPCM is not set ++# CONFIG_USB_STORAGE_USBAT is not set ++# CONFIG_USB_STORAGE_SDDR09 is not set ++# CONFIG_USB_STORAGE_SDDR55 is not set ++# CONFIG_USB_STORAGE_JUMPSHOT is not set ++# CONFIG_USB_STORAGE_ALAUDA is not set ++# CONFIG_USB_STORAGE_ONETOUCH is not set ++# CONFIG_USB_STORAGE_KARMA is not set ++# CONFIG_USB_LIBUSUAL is not set ++ ++# ++# USB Imaging devices ++# ++# CONFIG_USB_MDC800 is not set ++# CONFIG_USB_MICROTEK is not set ++# CONFIG_USB_MON is not set ++ ++# ++# USB port drivers ++# ++ ++# ++# USB Serial Converter support ++# ++CONFIG_USB_SERIAL=y ++CONFIG_USB_SERIAL_CONSOLE=y ++# CONFIG_USB_SERIAL_GENERIC is not set ++# CONFIG_USB_SERIAL_AIRCABLE is not set ++# CONFIG_USB_SERIAL_AIRPRIME is not set ++# CONFIG_USB_SERIAL_ARK3116 is not set ++# CONFIG_USB_SERIAL_BELKIN is not set ++# CONFIG_USB_SERIAL_CH341 is not set ++# CONFIG_USB_SERIAL_WHITEHEAT is not set ++# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set ++# CONFIG_USB_SERIAL_CP2101 is not set ++# CONFIG_USB_SERIAL_CYPRESS_M8 is not set ++# CONFIG_USB_SERIAL_EMPEG is not set ++# CONFIG_USB_SERIAL_FTDI_SIO is not set ++# CONFIG_USB_SERIAL_FUNSOFT is not set ++# CONFIG_USB_SERIAL_VISOR is not set ++# CONFIG_USB_SERIAL_IPAQ is not set ++# CONFIG_USB_SERIAL_IR is not set ++# CONFIG_USB_SERIAL_EDGEPORT is not set ++# CONFIG_USB_SERIAL_EDGEPORT_TI is not set ++# CONFIG_USB_SERIAL_GARMIN is not set ++# CONFIG_USB_SERIAL_IPW is not set ++# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set ++# CONFIG_USB_SERIAL_KEYSPAN is not set ++# CONFIG_USB_SERIAL_KLSI is not set ++# CONFIG_USB_SERIAL_KOBIL_SCT is not set ++# CONFIG_USB_SERIAL_MCT_U232 is not set ++# CONFIG_USB_SERIAL_MOS7720 is not set ++# CONFIG_USB_SERIAL_MOS7840 is not set ++# CONFIG_USB_SERIAL_NAVMAN is not set ++CONFIG_USB_SERIAL_PL2303=y ++# CONFIG_USB_SERIAL_OTI6858 is not set ++# CONFIG_USB_SERIAL_HP4X is not set ++# CONFIG_USB_SERIAL_SAFE is not set ++# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set ++# CONFIG_USB_SERIAL_TI is not set ++# CONFIG_USB_SERIAL_CYBERJACK is not set ++# CONFIG_USB_SERIAL_XIRCOM is not set ++# CONFIG_USB_SERIAL_OPTION is not set ++# CONFIG_USB_SERIAL_OMNINET is not set ++# CONFIG_USB_SERIAL_DEBUG is not set ++ ++# ++# USB Miscellaneous drivers ++# ++# CONFIG_USB_EMI62 is not set ++# CONFIG_USB_EMI26 is not set ++# CONFIG_USB_ADUTUX is not set ++# CONFIG_USB_AUERSWALD is not set ++# CONFIG_USB_RIO500 is not set ++# CONFIG_USB_LEGOTOWER is not set ++# CONFIG_USB_LCD is not set ++# CONFIG_USB_BERRY_CHARGE is not set ++# CONFIG_USB_LED is not set ++# CONFIG_USB_CYPRESS_CY7C63 is not set ++# CONFIG_USB_CYTHERM is not set ++# CONFIG_USB_PHIDGET is not set ++# CONFIG_USB_IDMOUSE is not set ++# CONFIG_USB_FTDI_ELAN is not set ++# CONFIG_USB_APPLEDISPLAY is not set ++# CONFIG_USB_LD is not set ++# CONFIG_USB_TRANCEVIBRATOR is not set ++# CONFIG_USB_IOWARRIOR is not set ++# CONFIG_USB_TEST is not set ++ ++# ++# USB DSL modem support ++# ++ ++# ++# USB Gadget Support ++# ++# CONFIG_USB_GADGET is not set ++CONFIG_MMC=y ++# CONFIG_MMC_DEBUG is not set ++# CONFIG_MMC_UNSAFE_RESUME is not set ++ ++# ++# MMC/SD Card Drivers ++# ++CONFIG_MMC_BLOCK=y ++CONFIG_MMC_BLOCK_BOUNCE=y ++# CONFIG_SDIO_UART is not set ++ ++# ++# MMC/SD Host Controller Drivers ++# ++# CONFIG_MMC_ARMMMCI is not set ++CONFIG_MMC_SPI=y ++# ++# SimOne LCD support ++# ++CONFIG_LCD_LINUX=m ++CONFIG_LCD_HD44780=m ++# ++# CONFIG_NEW_LEDS is not set ++CONFIG_RTC_LIB=y ++CONFIG_RTC_CLASS=y ++CONFIG_RTC_HCTOSYS=y ++CONFIG_RTC_HCTOSYS_DEVICE="rtc0" ++# CONFIG_RTC_DEBUG is not set ++ ++# ++# RTC interfaces ++# ++CONFIG_RTC_INTF_SYSFS=y ++CONFIG_RTC_INTF_PROC=y ++CONFIG_RTC_INTF_DEV=y ++# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set ++# CONFIG_RTC_DRV_TEST is not set ++ ++# ++# I2C RTC drivers ++# ++CONFIG_RTC_DRV_DS1307=y ++# CONFIG_RTC_DRV_DS1374 is not set ++# CONFIG_RTC_DRV_DS1672 is not set ++# CONFIG_RTC_DRV_MAX6900 is not set ++# CONFIG_RTC_DRV_RS5C372 is not set ++# CONFIG_RTC_DRV_ISL1208 is not set ++# CONFIG_RTC_DRV_X1205 is not set ++# CONFIG_RTC_DRV_PCF8563 is not set ++# CONFIG_RTC_DRV_PCF8583 is not set ++# CONFIG_RTC_DRV_M41T80 is not set ++ ++# ++# SPI RTC drivers ++# ++# CONFIG_RTC_DRV_RS5C348 is not set ++# CONFIG_RTC_DRV_MAX6902 is not set ++ ++# ++# Platform RTC drivers ++# ++# CONFIG_RTC_DRV_CMOS is not set ++# CONFIG_RTC_DRV_DS1553 is not set ++# CONFIG_RTC_DRV_STK17TA8 is not set ++# CONFIG_RTC_DRV_DS1742 is not set ++# CONFIG_RTC_DRV_M48T86 is not set ++# CONFIG_RTC_DRV_M48T59 is not set ++# CONFIG_RTC_DRV_V3020 is not set ++ ++# ++# on-CPU RTC drivers ++# ++CONFIG_RTC_DRV_EP93XX=y ++CONFIG_RTC_DRV_EP93XX_DS1337=y ++# CONFIG_RTC_DRV_PL031 is not set ++ ++# ++# File systems ++# ++CONFIG_EXT2_FS=y ++CONFIG_EXT2_FS_XATTR=y ++CONFIG_EXT2_FS_POSIX_ACL=y ++CONFIG_EXT2_FS_SECURITY=y ++# CONFIG_EXT2_FS_XIP is not set ++CONFIG_EXT3_FS=y ++# CONFIG_EXT3_FS_XATTR is not set ++# CONFIG_EXT4DEV_FS is not set ++CONFIG_JBD=y ++CONFIG_FS_MBCACHE=y ++# CONFIG_REISERFS_FS is not set ++# CONFIG_JFS_FS is not set ++CONFIG_FS_POSIX_ACL=y ++# CONFIG_XFS_FS is not set ++# CONFIG_GFS2_FS is not set ++# CONFIG_OCFS2_FS is not set ++# CONFIG_MINIX_FS is not set ++CONFIG_ROMFS_FS=y ++CONFIG_INOTIFY=y ++CONFIG_INOTIFY_USER=y ++# CONFIG_QUOTA is not set ++CONFIG_DNOTIFY=y ++# CONFIG_AUTOFS_FS is not set ++CONFIG_AUTOFS4_FS=y ++# CONFIG_FUSE_FS is not set ++ ++# ++# CD-ROM/DVD Filesystems ++# ++CONFIG_ISO9660_FS=y ++CONFIG_JOLIET=y ++# CONFIG_ZISOFS is not set ++CONFIG_UDF_FS=y ++CONFIG_UDF_NLS=y ++ ++# ++# DOS/FAT/NT Filesystems ++# ++CONFIG_FAT_FS=y ++CONFIG_MSDOS_FS=y ++CONFIG_VFAT_FS=y ++CONFIG_FAT_DEFAULT_CODEPAGE=437 ++CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" ++# CONFIG_NTFS_FS is not set ++ ++# ++# Pseudo filesystems ++# ++CONFIG_PROC_FS=y ++CONFIG_PROC_SYSCTL=y ++CONFIG_SYSFS=y ++CONFIG_TMPFS=y ++# CONFIG_TMPFS_POSIX_ACL is not set ++# CONFIG_HUGETLB_PAGE is not set ++# CONFIG_CONFIGFS_FS is not set ++ ++# ++# Miscellaneous filesystems ++# ++# CONFIG_ADFS_FS is not set ++# CONFIG_AFFS_FS is not set ++# CONFIG_HFS_FS is not set ++# CONFIG_HFSPLUS_FS is not set ++# CONFIG_BEFS_FS is not set ++# CONFIG_BFS_FS is not set ++# CONFIG_EFS_FS is not set ++CONFIG_JFFS2_FS=y ++CONFIG_JFFS2_FS_DEBUG=0 ++CONFIG_JFFS2_FS_WRITEBUFFER=y ++# CONFIG_JFFS2_FS_WBUF_VERIFY is not set ++# CONFIG_JFFS2_SUMMARY is not set ++# CONFIG_JFFS2_FS_XATTR is not set ++# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set ++CONFIG_JFFS2_ZLIB=y ++# CONFIG_JFFS2_LZO is not set ++CONFIG_JFFS2_RTIME=y ++# CONFIG_JFFS2_RUBIN is not set ++# CONFIG_CRAMFS is not set ++# CONFIG_VXFS_FS is not set ++# CONFIG_HPFS_FS is not set ++# CONFIG_QNX4FS_FS is not set ++# CONFIG_SYSV_FS is not set ++# CONFIG_UFS_FS is not set ++CONFIG_NETWORK_FILESYSTEMS=y ++CONFIG_NFS_FS=y ++CONFIG_NFS_V3=y ++# CONFIG_NFS_V3_ACL is not set ++# CONFIG_NFS_V4 is not set ++# CONFIG_NFS_DIRECTIO is not set ++# CONFIG_NFSD is not set ++CONFIG_ROOT_NFS=y ++CONFIG_LOCKD=y ++CONFIG_LOCKD_V4=y ++CONFIG_NFS_COMMON=y ++CONFIG_SUNRPC=y ++# CONFIG_SUNRPC_BIND34 is not set ++# CONFIG_RPCSEC_GSS_KRB5 is not set ++# CONFIG_RPCSEC_GSS_SPKM3 is not set ++# CONFIG_SMB_FS is not set ++# CONFIG_CIFS is not set ++# CONFIG_NCP_FS is not set ++# CONFIG_CODA_FS is not set ++# CONFIG_AFS_FS is not set ++ ++# ++# Partition Types ++# ++CONFIG_PARTITION_ADVANCED=y ++# CONFIG_ACORN_PARTITION is not set ++# CONFIG_OSF_PARTITION is not set ++# CONFIG_AMIGA_PARTITION is not set ++# CONFIG_ATARI_PARTITION is not set ++# CONFIG_MAC_PARTITION is not set ++CONFIG_MSDOS_PARTITION=y ++# CONFIG_BSD_DISKLABEL is not set ++# CONFIG_MINIX_SUBPARTITION is not set ++# CONFIG_SOLARIS_X86_PARTITION is not set ++# CONFIG_UNIXWARE_DISKLABEL is not set ++# CONFIG_LDM_PARTITION is not set ++# CONFIG_SGI_PARTITION is not set ++# CONFIG_ULTRIX_PARTITION is not set ++# CONFIG_SUN_PARTITION is not set ++# CONFIG_KARMA_PARTITION is not set ++# CONFIG_EFI_PARTITION is not set ++# CONFIG_SYSV68_PARTITION is not set ++CONFIG_NLS=y ++CONFIG_NLS_DEFAULT="iso8859-1" ++CONFIG_NLS_CODEPAGE_437=y ++# CONFIG_NLS_CODEPAGE_737 is not set ++# CONFIG_NLS_CODEPAGE_775 is not set ++# CONFIG_NLS_CODEPAGE_850 is not set ++# CONFIG_NLS_CODEPAGE_852 is not set ++# CONFIG_NLS_CODEPAGE_855 is not set ++# CONFIG_NLS_CODEPAGE_857 is not set ++# CONFIG_NLS_CODEPAGE_860 is not set ++# CONFIG_NLS_CODEPAGE_861 is not set ++# CONFIG_NLS_CODEPAGE_862 is not set ++# CONFIG_NLS_CODEPAGE_863 is not set ++# CONFIG_NLS_CODEPAGE_864 is not set ++# CONFIG_NLS_CODEPAGE_865 is not set ++# CONFIG_NLS_CODEPAGE_866 is not set ++# CONFIG_NLS_CODEPAGE_869 is not set ++# CONFIG_NLS_CODEPAGE_936 is not set ++# CONFIG_NLS_CODEPAGE_950 is not set ++# CONFIG_NLS_CODEPAGE_932 is not set ++# CONFIG_NLS_CODEPAGE_949 is not set ++# CONFIG_NLS_CODEPAGE_874 is not set ++# CONFIG_NLS_ISO8859_8 is not set ++# CONFIG_NLS_CODEPAGE_1250 is not set ++# CONFIG_NLS_CODEPAGE_1251 is not set ++# CONFIG_NLS_ASCII is not set ++CONFIG_NLS_ISO8859_1=y ++# CONFIG_NLS_ISO8859_2 is not set ++# CONFIG_NLS_ISO8859_3 is not set ++# CONFIG_NLS_ISO8859_4 is not set ++# CONFIG_NLS_ISO8859_5 is not set ++# CONFIG_NLS_ISO8859_6 is not set ++# CONFIG_NLS_ISO8859_7 is not set ++# CONFIG_NLS_ISO8859_9 is not set ++# CONFIG_NLS_ISO8859_13 is not set ++# CONFIG_NLS_ISO8859_14 is not set ++# CONFIG_NLS_ISO8859_15 is not set ++# CONFIG_NLS_KOI8_R is not set ++# CONFIG_NLS_KOI8_U is not set ++# CONFIG_NLS_UTF8 is not set ++# CONFIG_DLM is not set ++# CONFIG_INSTRUMENTATION is not set ++ ++# ++# Kernel hacking ++# ++# CONFIG_PRINTK_TIME is not set ++# CONFIG_ENABLE_WARN_DEPRECATED is not set ++# CONFIG_ENABLE_MUST_CHECK is not set ++# CONFIG_MAGIC_SYSRQ is not set ++# CONFIG_UNUSED_SYMBOLS is not set ++# CONFIG_DEBUG_FS is not set ++# CONFIG_HEADERS_CHECK is not set ++# CONFIG_DEBUG_KERNEL is not set ++# CONFIG_DEBUG_BUGVERBOSE is not set ++CONFIG_FRAME_POINTER=y ++# CONFIG_SAMPLES is not set ++CONFIG_DEBUG_USER=y ++ ++# ++# Security options ++# ++# CONFIG_KEYS is not set ++# CONFIG_SECURITY is not set ++# CONFIG_SECURITY_FILE_CAPABILITIES is not set ++CONFIG_CRYPTO=y ++CONFIG_CRYPTO_ALGAPI=y ++CONFIG_CRYPTO_BLKCIPHER=y ++CONFIG_CRYPTO_MANAGER=y ++# CONFIG_CRYPTO_HMAC is not set ++# CONFIG_CRYPTO_XCBC is not set ++# CONFIG_CRYPTO_NULL is not set ++# CONFIG_CRYPTO_MD4 is not set ++CONFIG_CRYPTO_MD5=y ++CONFIG_CRYPTO_SHA1=y ++# CONFIG_CRYPTO_SHA256 is not set ++# CONFIG_CRYPTO_SHA512 is not set ++# CONFIG_CRYPTO_WP512 is not set ++# CONFIG_CRYPTO_TGR192 is not set ++# CONFIG_CRYPTO_GF128MUL is not set ++CONFIG_CRYPTO_ECB=m ++CONFIG_CRYPTO_CBC=m ++CONFIG_CRYPTO_PCBC=y ++# CONFIG_CRYPTO_LRW is not set ++# CONFIG_CRYPTO_XTS is not set ++# CONFIG_CRYPTO_CRYPTD is not set ++CONFIG_CRYPTO_DES=y ++# CONFIG_CRYPTO_FCRYPT is not set ++# CONFIG_CRYPTO_BLOWFISH is not set ++# CONFIG_CRYPTO_TWOFISH is not set ++# CONFIG_CRYPTO_SERPENT is not set ++CONFIG_CRYPTO_AES=y ++# CONFIG_CRYPTO_CAST5 is not set ++# CONFIG_CRYPTO_CAST6 is not set ++# CONFIG_CRYPTO_TEA is not set ++CONFIG_CRYPTO_ARC4=y ++# CONFIG_CRYPTO_KHAZAD is not set ++# CONFIG_CRYPTO_ANUBIS is not set ++# CONFIG_CRYPTO_SEED is not set ++# CONFIG_CRYPTO_DEFLATE is not set ++CONFIG_CRYPTO_MICHAEL_MIC=y ++# CONFIG_CRYPTO_CRC32C is not set ++# CONFIG_CRYPTO_CAMELLIA is not set ++# CONFIG_CRYPTO_TEST is not set ++# CONFIG_CRYPTO_AUTHENC is not set ++# CONFIG_CRYPTO_HW is not set ++ ++# ++# Library routines ++# ++CONFIG_BITREVERSE=y ++# CONFIG_CRC_CCITT is not set ++# CONFIG_CRC16 is not set ++CONFIG_CRC_ITU_T=y ++CONFIG_CRC32=y ++CONFIG_CRC7=y ++CONFIG_LIBCRC32C=y ++CONFIG_ZLIB_INFLATE=y ++CONFIG_ZLIB_DEFLATE=y ++CONFIG_PLIST=y ++CONFIG_HAS_IOMEM=y ++CONFIG_HAS_IOPORT=y ++CONFIG_HAS_DMA=y diff --git a/target/linux/ep93xx/patches-2.6.30/012-ep93xx-cpuinfo.patch b/target/linux/ep93xx/patches-2.6.30/012-ep93xx-cpuinfo.patch new file mode 100644 index 000000000..d2845c910 --- /dev/null +++ b/target/linux/ep93xx/patches-2.6.30/012-ep93xx-cpuinfo.patch @@ -0,0 +1,32 @@ +Index: linux-2.6.30.9/arch/arm/kernel/setup.c +=================================================================== +--- linux-2.6.30.9.orig/arch/arm/kernel/setup.c 2009-11-24 21:00:10.000000000 +0100 ++++ linux-2.6.30.9/arch/arm/kernel/setup.c 2009-11-24 21:00:46.000000000 +0100 +@@ -42,6 +42,10 @@ + #include + #include + ++#if defined(CONFIG_ARCH_EP93XX) ++#include ++#endif ++ + #include "compat.h" + #include "atags.h" + +@@ -844,9 +848,16 @@ + seq_puts(m, "\n"); + + seq_printf(m, "Hardware\t: %s\n", machine_name); ++#if defined(CONFIG_ARCH_EP93XX) ++ seq_printf(m, "Revision\t: %04x\n", ++ *((unsigned int *)EP93XX_SYSCON_CHIP_ID) >> 28); ++ seq_printf(m, "Serial\t\t: %016x\n", ++ *((unsigned int *)EP93XX_SECURITY_UNIQID)); ++#else + seq_printf(m, "Revision\t: %04x\n", system_rev); + seq_printf(m, "Serial\t\t: %08x%08x\n", + system_serial_high, system_serial_low); ++#endif + + return 0; + } From cf95df7f3d2bac25d80b7cf113ba7a589300eada Mon Sep 17 00:00:00 2001 From: markus Date: Thu, 26 Nov 2009 10:58:01 +0000 Subject: [PATCH 238/288] new upstream release 2.51 with some fixes, see http://www.thekelleys.org.uk/dnsmasq/CHANGELOG refreshed patches for new release git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18541 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/dnsmasq/Makefile | 6 +++--- package/dnsmasq/patches/101-ipv6.patch | 8 +++++--- package/dnsmasq/patches/103-ipv6_fix.patch | 14 +++++++++----- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/package/dnsmasq/Makefile b/package/dnsmasq/Makefile index f2f0c9677..27f438c73 100644 --- a/package/dnsmasq/Makefile +++ b/package/dnsmasq/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dnsmasq -PKG_VERSION:=2.50 -PKG_RELEASE:=3 +PKG_VERSION:=2.51 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq -PKG_MD5SUM:=f7b1e17c590e493039537434c57c9de7 +PKG_MD5SUM:=97465261a6de5258a3c3edfe51ca16a4 include $(INCLUDE_DIR)/package.mk diff --git a/package/dnsmasq/patches/101-ipv6.patch b/package/dnsmasq/patches/101-ipv6.patch index af4a81d68..945ddbba1 100644 --- a/package/dnsmasq/patches/101-ipv6.patch +++ b/package/dnsmasq/patches/101-ipv6.patch @@ -1,6 +1,8 @@ ---- a/src/config.h -+++ b/src/config.h -@@ -257,8 +257,9 @@ NOTES: +Index: dnsmasq-2.51/src/config.h +=================================================================== +--- dnsmasq-2.51.orig/src/config.h ++++ dnsmasq-2.51/src/config.h +@@ -270,8 +270,9 @@ NOTES: /* We assume that systems which don't have IPv6 headers don't have ntop and pton either */ diff --git a/package/dnsmasq/patches/103-ipv6_fix.patch b/package/dnsmasq/patches/103-ipv6_fix.patch index 33624521d..8269b79f0 100644 --- a/package/dnsmasq/patches/103-ipv6_fix.patch +++ b/package/dnsmasq/patches/103-ipv6_fix.patch @@ -1,5 +1,7 @@ ---- a/src/netlink.c -+++ b/src/netlink.c +Index: dnsmasq-2.51/src/netlink.c +=================================================================== +--- dnsmasq-2.51.orig/src/netlink.c ++++ dnsmasq-2.51/src/netlink.c @@ -129,6 +129,7 @@ int iface_enumerate(void *parm, int (*ip ssize_t len; static unsigned int seq = 0; @@ -31,9 +33,11 @@ } #endif } ---- a/src/network.c -+++ b/src/network.c -@@ -296,7 +296,7 @@ static int create_ipv6_listener(struct l +Index: dnsmasq-2.51/src/network.c +=================================================================== +--- dnsmasq-2.51.orig/src/network.c ++++ dnsmasq-2.51/src/network.c +@@ -302,7 +302,7 @@ static int create_ipv6_listener(struct l bind(tcpfd, (struct sockaddr *)&addr, sa_len(&addr)) == -1 || listen(tcpfd, 5) == -1 || bind(fd, (struct sockaddr *)&addr, sa_len(&addr)) == -1) From 69cbd19bb445fc2a7072f782e681ac79219d8086 Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 26 Nov 2009 16:05:20 +0000 Subject: [PATCH 239/288] [package] libuuid needs to be compiled with fPIC/pic. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18542 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/e2fsprogs/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/e2fsprogs/Makefile b/package/e2fsprogs/Makefile index e5cf995c9..c05105aab 100644 --- a/package/e2fsprogs/Makefile +++ b/package/e2fsprogs/Makefile @@ -107,6 +107,8 @@ $(call Package/e2fsprogs) DEPENDS:=libuuid libblkid endef +TARGET_CFLAGS += $(FPIC) + CONFIGURE_ARGS += \ --enable-shared \ --enable-static \ From c9909eaed1e1cc3dc4fa1d657feef1edc535029e Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 26 Nov 2009 18:33:26 +0000 Subject: [PATCH 240/288] [ep93xx] resync kernel configuration git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18549 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ep93xx/config-2.6.30 | 33 +------------------------------ 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/target/linux/ep93xx/config-2.6.30 b/target/linux/ep93xx/config-2.6.30 index 3e3e205c4..4f96ab5ab 100644 --- a/target/linux/ep93xx/config-2.6.30 +++ b/target/linux/ep93xx/config-2.6.30 @@ -19,8 +19,6 @@ CONFIG_BITREVERSE=y # CONFIG_BLK_DEV_INITRD is not set # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CFG80211=y -# CONFIG_CFG80211_REG_DEBUG is not set CONFIG_CMDLINE="console=ttyAM0,57600 init=/etc/preinit" CONFIG_COMMON_CLKDEV=y CONFIG_CONSOLE_TRANSLATIONS=y @@ -45,7 +43,6 @@ CONFIG_CRYPTO_AES=y CONFIG_CRYPTO_ARC4=y CONFIG_CRYPTO_BLKCIPHER=y CONFIG_CRYPTO_BLKCIPHER2=y -CONFIG_CRYPTO_CRC32C=y CONFIG_CRYPTO_DES=y CONFIG_CRYPTO_ECB=m CONFIG_CRYPTO_HASH=y @@ -134,35 +131,15 @@ CONFIG_INOTIFY_USER=y CONFIG_INPUT=y # CONFIG_INPUT_MISC is not set CONFIG_INPUT_TOUCHSCREEN=y -# CONFIG_IP_ADVANCED_ROUTER is not set -# CONFIG_IP_MULTICAST is not set -CONFIG_IP_PNP=y -CONFIG_IP_PNP_BOOTP=y -CONFIG_IP_PNP_DHCP=y -# CONFIG_IP_PNP_RARP is not set -# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set -# CONFIG_JFFS2_SUMMARY is not set CONFIG_LCD_HD44780=m CONFIG_LCD_LINUX=m -CONFIG_LIBCRC32C=y -CONFIG_LOCALVERSION_AUTO=y -CONFIG_LOCK_KERNEL=y CONFIG_LOGO=y CONFIG_LOGO_LINUX_CLUT224=y CONFIG_LOGO_LINUX_MONO=y CONFIG_LOGO_LINUX_VGA16=y CONFIG_LOG_BUF_SHIFT=16 -CONFIG_MAC80211=m -# CONFIG_MAC80211_DEBUGFS is not set -# CONFIG_MAC80211_DEBUG_MENU is not set -# CONFIG_MAC80211_HWSIM is not set -# CONFIG_MAC80211_LEDS is not set -# CONFIG_MAC80211_MESH is not set -CONFIG_MAC80211_RC_DEFAULT="pid" # CONFIG_MAC80211_RC_DEFAULT_MINSTREL is not set -CONFIG_MAC80211_RC_DEFAULT_PID=y -CONFIG_MAC80211_RC_MINSTREL=y -CONFIG_MAC80211_RC_PID=y +# CONFIG_MAC80211_RC_DEFAULT_PID is not set # CONFIG_MACH_ADSSPHERE is not set # CONFIG_MACH_EDB9302 is not set # CONFIG_MACH_EDB9302A is not set @@ -190,11 +167,6 @@ CONFIG_MTD_CFI_STAA=y # CONFIG_MTD_COMPLEX_MAPPINGS is not set CONFIG_MTD_PHYSMAP=y CONFIG_MTD_RAM=y -# CONFIG_NETDEV_1000 is not set -# CONFIG_NETFILTER is not set -CONFIG_NET_KEY=y -# CONFIG_NEW_LEDS is not set -CONFIG_NLS=y # CONFIG_NO_IOPORT is not set CONFIG_OABI_COMPAT=y # CONFIG_OUTER_CACHE is not set @@ -202,9 +174,6 @@ CONFIG_PAGEFLAGS_EXTENDED=y CONFIG_PAGE_OFFSET=0xC0000000 # CONFIG_PCI_SYSCALL is not set CONFIG_PREEMPT=y -# CONFIG_ROMFS_BACKED_BY_BLOCK is not set -# CONFIG_ROMFS_BACKED_BY_BOTH is not set -# CONFIG_ROMFS_BACKED_BY_MTD is not set # CONFIG_SCSI_DMA is not set # CONFIG_SDIO_UART is not set # CONFIG_SERIAL_8250 is not set From 48f784e338083adb7f96d0301dcfdd41b219656e Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 26 Nov 2009 18:33:43 +0000 Subject: [PATCH 241/288] [ep93xx] target supports usb git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18550 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ep93xx/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ep93xx/Makefile b/target/linux/ep93xx/Makefile index a43855ed1..52cabaaaa 100644 --- a/target/linux/ep93xx/Makefile +++ b/target/linux/ep93xx/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk ARCH:=arm BOARD:=ep93xx BOARDNAME:=Cirrus Logic EP93xx SoC -FEATURES:=squashfs jffs2 ext2 tgz +FEATURES:=squashfs jffs2 ext2 tgz usb CFLAGS:=-Os -pipe -march=armv4t -funit-at-a-time LINUX_VERSION:=2.6.30.9 From 1e35f1ce285c06d339158cb6ce87dbfa87b1d374 Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 26 Nov 2009 18:44:00 +0000 Subject: [PATCH 242/288] [toolchain] fix gcc version selection for octeon git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18551 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- toolchain/gcc/Config.in | 2 +- toolchain/gcc/Config.version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in index b19427be0..ccaccaf00 100644 --- a/toolchain/gcc/Config.in +++ b/toolchain/gcc/Config.in @@ -11,7 +11,7 @@ choice default GCC_VERSION_4_3_3 if TARGET_coldfire default GCC_VERSION_4_4_1 if ubicom32 default GCC_VERSION_4_4_1 if TARGET_octeon - default GCC_VERSION_4_3_3_CS if mips || mipsel + default GCC_VERSION_4_3_3_CS if (mips || mipsel) && !TARGET_octeon default GCC_VERSION_4_3_3_CS if arm || armeb default GCC_VERSION_4_1_2 help diff --git a/toolchain/gcc/Config.version b/toolchain/gcc/Config.version index 9c1125dd7..f4e701784 100644 --- a/toolchain/gcc/Config.version +++ b/toolchain/gcc/Config.version @@ -66,7 +66,7 @@ if !LINUX_2_4 default y if TARGET_coldfire config GCC_VERSION_4_3_3_CS - default y if mips || mipsel + default y if (mips || mipsel) && !TARGET_octeon default y if arm || armeb config GCC_VERSION_4_4_1 From 6e7938dc40f2da4c823241a72ecfed04fee1e048 Mon Sep 17 00:00:00 2001 From: juhosg Date: Fri, 27 Nov 2009 21:20:54 +0000 Subject: [PATCH 243/288] ar71xx: add AR724x register defines git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18559 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h index a9f288b27..d134f867e 100644 --- a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h +++ b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h @@ -302,6 +302,8 @@ void ar71xx_gpio_function_disable(u32 mask); #define AR724X_DDR_REG_FLUSH_GE0 0x7c #define AR724X_DDR_REG_FLUSH_GE1 0x80 +#define AR724X_DDR_REG_FLUSH_USB 0x84 +#define AR724X_DDR_REG_FLUSH_PCIE 0x88 #define AR91XX_DDR_REG_FLUSH_GE0 0x7c #define AR91XX_DDR_REG_FLUSH_GE1 0x80 From 0bf5a55bb76dbc3773f5ea798b45657d07643a46 Mon Sep 17 00:00:00 2001 From: juhosg Date: Fri, 27 Nov 2009 21:21:01 +0000 Subject: [PATCH 244/288] ar71xx: fix AR724X_GPIO_COUNT git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18560 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h index d134f867e..8f57d9b76 100644 --- a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h +++ b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h @@ -253,7 +253,7 @@ static inline u32 ar71xx_usb_ctrl_rr(unsigned reg) #define AR71XX_GPIO_COUNT 16 -#define AR724X_GPIO_COUNT 16 +#define AR724X_GPIO_COUNT 18 #define AR91XX_GPIO_FUNC_WMAC_LED_EN BIT(22) #define AR91XX_GPIO_FUNC_EXP_PORT_CS_EN BIT(21) From 10b45a8d43bb8aca5c5cf83aa4b2c66806b08703 Mon Sep 17 00:00:00 2001 From: juhosg Date: Fri, 27 Nov 2009 21:21:06 +0000 Subject: [PATCH 245/288] ar71xx: add AR724x GPIO_FUNC register bit defines git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18561 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../arch/mips/include/asm/mach-ar71xx/ar71xx.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h index 8f57d9b76..65f2120f5 100644 --- a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h +++ b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h @@ -253,6 +253,24 @@ static inline u32 ar71xx_usb_ctrl_rr(unsigned reg) #define AR71XX_GPIO_COUNT 16 +#define AR724X_GPIO_FUNC_GE0_MII_CLK_EN BIT(19) +#define AR724X_GPIO_FUNC_SPI_EN BIT(18) +#define AR724X_GPIO_FUNC_SPI_CS_EN2 BIT(14) +#define AR724X_GPIO_FUNC_SPI_CS_EN1 BIT(13) +#define AR724X_GPIO_FUNC_CLK_OBS5_EN BIT(12) +#define AR724X_GPIO_FUNC_CLK_OBS4_EN BIT(11) +#define AR724X_GPIO_FUNC_CLK_OBS3_EN BIT(10) +#define AR724X_GPIO_FUNC_CLK_OBS2_EN BIT(9) +#define AR724X_GPIO_FUNC_CLK_OBS1_EN BIT(8) +#define AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN BIT(7) +#define AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN BIT(6) +#define AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN BIT(5) +#define AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN BIT(4) +#define AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN BIT(3) +#define AR724X_GPIO_FUNC_UART_RTS_CTS_EN BIT(2) +#define AR724X_GPIO_FUNC_UART_EN BIT(1) +#define AR724X_GPIO_FUNC_JTAG_DISABLE BIT(0) + #define AR724X_GPIO_COUNT 18 #define AR91XX_GPIO_FUNC_WMAC_LED_EN BIT(22) From 08ca9f93c255a02c2ab44f3814174af2356c0f73 Mon Sep 17 00:00:00 2001 From: juhosg Date: Fri, 27 Nov 2009 21:21:10 +0000 Subject: [PATCH 246/288] mac80211: select channel 36 by default on 5GHz only devices git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18562 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/files/lib/wifi/mac80211.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package/mac80211/files/lib/wifi/mac80211.sh b/package/mac80211/files/lib/wifi/mac80211.sh index 00a81393d..591d978da 100644 --- a/package/mac80211/files/lib/wifi/mac80211.sh +++ b/package/mac80211/files/lib/wifi/mac80211.sh @@ -300,6 +300,7 @@ detect_mac80211() { done mode_11n="" mode_band="g" + channel="5" ht_cap=0 for cap in $(iw phy "$dev" info | grep 'HT capabilities' | cut -d: -f2); do ht_cap="$(($ht_cap | $cap))" @@ -314,12 +315,12 @@ detect_mac80211() { [ "$(($ht_cap & 64))" -eq 64 ] && append ht_capab "$list SHORT-GI-40" "$N" [ "$(($ht_cap & 4096))" -eq 4096 ] && append ht_capab "$list DSSS_CCK-40" "$N" } - iw phy "$dev" info | grep -q '2412 MHz' || mode_band="a" + iw phy "$dev" info | grep -q '2412 MHz' || mode_band="a"; channel="36" cat < Date: Fri, 27 Nov 2009 21:21:14 +0000 Subject: [PATCH 247/288] mac80211: update ath9k patch git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18563 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/Makefile | 2 +- ...GHz-band-only-if-the-device-supports.patch | 56 +++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile index 62903e266..6fb2b2314 100644 --- a/package/mac80211/Makefile +++ b/package/mac80211/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 PKG_VERSION:=2009-11-21 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE_URL:= \ http://www.orbit-lab.org/kernel/compat-wireless-2.6/2009/11 \ http://wireless.kernel.org/download/compat-wireless-2.6 diff --git a/package/mac80211/patches/550-ath9k-enable-2GHz-band-only-if-the-device-supports.patch b/package/mac80211/patches/550-ath9k-enable-2GHz-band-only-if-the-device-supports.patch index dca58ed1f..ed07822e7 100644 --- a/package/mac80211/patches/550-ath9k-enable-2GHz-band-only-if-the-device-supports.patch +++ b/package/mac80211/patches/550-ath9k-enable-2GHz-band-only-if-the-device-supports.patch @@ -1,3 +1,59 @@ +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -979,7 +979,10 @@ int ath9k_hw_init(struct ath_hw *ah) + return r; + + ath9k_hw_init_mode_gain_regs(ah); +- ath9k_hw_fill_cap_info(ah); ++ r = ath9k_hw_fill_cap_info(ah); ++ if (r) ++ return r; ++ + ath9k_hw_init_11a_eeprom_fix(ah); + + r = ath9k_hw_init_macaddr(ah); +@@ -3115,7 +3118,7 @@ EXPORT_SYMBOL(ath9k_hw_set_sta_beacon_ti + /* HW Capabilities */ + /*******************/ + +-void ath9k_hw_fill_cap_info(struct ath_hw *ah) ++int ath9k_hw_fill_cap_info(struct ath_hw *ah) + { + struct ath9k_hw_capabilities *pCap = &ah->caps; + struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); +@@ -3146,6 +3149,12 @@ void ath9k_hw_fill_cap_info(struct ath_h + } + + eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE); ++ if ((eeval & (AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A)) == 0) { ++ ath_print(common, ATH_DBG_FATAL, ++ "no band has been marked as supported in EEPROM.\n"); ++ return -EINVAL; ++ } ++ + bitmap_zero(pCap->wireless_modes, ATH9K_MODE_MAX); + + if (eeval & AR5416_OPFLAGS_11A) { +@@ -3305,6 +3314,8 @@ void ath9k_hw_fill_cap_info(struct ath_h + } else { + btcoex_hw->scheme = ATH_BTCOEX_CFG_NONE; + } ++ ++ return 0; + } + + bool ath9k_hw_getcapability(struct ath_hw *ah, enum ath9k_capability_type type, +--- a/drivers/net/wireless/ath/ath9k/hw.h ++++ b/drivers/net/wireless/ath/ath9k/hw.h +@@ -619,7 +619,7 @@ void ath9k_hw_detach(struct ath_hw *ah); + int ath9k_hw_init(struct ath_hw *ah); + int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, + bool bChannelChange); +-void ath9k_hw_fill_cap_info(struct ath_hw *ah); ++int ath9k_hw_fill_cap_info(struct ath_hw *ah); + bool ath9k_hw_getcapability(struct ath_hw *ah, enum ath9k_capability_type type, + u32 capability, u32 *result); + bool ath9k_hw_setcapability(struct ath_hw *ah, enum ath9k_capability_type type, --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c @@ -1805,13 +1805,15 @@ static int ath_init_softc(u16 devid, str From f8955d76060869b91f93cec40652943b7140e1f8 Mon Sep 17 00:00:00 2001 From: juhosg Date: Fri, 27 Nov 2009 21:21:17 +0000 Subject: [PATCH 248/288] ar71xx: fix pll_1000 values for the WNDR3700 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18564 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c index 3f0103e46..9c5dd41a4 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c @@ -200,11 +200,13 @@ static void __init wndr3700_setup(void) ar71xx_set_mac_base(mac); ar71xx_add_device_mdio(0x0); + ar71xx_eth0_pll_data.pll_1000 = 0x11110000; ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ar71xx_eth0_data.phy_mask = 0xf; ar71xx_eth0_data.speed = SPEED_1000; ar71xx_eth0_data.duplex = DUPLEX_FULL; + ar71xx_eth1_pll_data.pll_1000 = 0x11110000; ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ar71xx_eth1_data.phy_mask = 0x10; From 97c0d28d14e2b9b6ea672f57d234423ba2e5c7a5 Mon Sep 17 00:00:00 2001 From: juhosg Date: Fri, 27 Nov 2009 21:21:21 +0000 Subject: [PATCH 249/288] ar71xx: add PCI fixup for the WNDR3700 board git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18565 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../files/arch/mips/ar71xx/mach-wndr3700.c | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c index 9c5dd41a4..472d603ba 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -108,6 +109,82 @@ static struct ar71xx_pci_irq wndr3700_pci_irqs[] __initdata = { static struct ath9k_platform_data wndr3700_wmac0_data; static struct ath9k_platform_data wndr3700_wmac1_data; +static void wndr3700_pci_fixup(struct pci_dev *dev) +{ + void __iomem *mem; + u16 *cal_data; + u16 cmd; + u32 bar0; + u32 val; + + if (ar71xx_mach != AR71XX_MACH_WNDR3700) + return; + + switch (PCI_SLOT(dev->devfn)) { + case 17: + cal_data = wndr3700_wmac0_data.eeprom_data; + break; + case 18: + cal_data = wndr3700_wmac1_data.eeprom_data; + break; + default: + return; + } + + if (*cal_data != 0xa55a) { + printk(KERN_ERR "PCI: no calibration data found for %s\n", + pci_name(dev)); + return; + } + + mem = ioremap(AR71XX_PCI_MEM_BASE, 0x10000); + if (!mem) { + printk(KERN_ERR "PCI: ioremap error for device %s\n", + pci_name(dev)); + return; + } + + printk(KERN_INFO "PCI: fixup device %s\n", pci_name(dev)); + + pci_read_config_dword(dev, PCI_BASE_ADDRESS_0, &bar0); + + /* Setup the PCI device to allow access to the internal registers */ + pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, AR71XX_PCI_MEM_BASE); + pci_read_config_word(dev, PCI_COMMAND, &cmd); + cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; + pci_write_config_word(dev, PCI_COMMAND, cmd); + + /* set pointer to first reg address */ + cal_data += 3; + while (*cal_data != 0xffff) { + u32 reg; + reg = *cal_data++; + val = *cal_data++; + val |= (*cal_data++) << 16; + + __raw_writel(val, mem + reg); + udelay(100); + } + + pci_read_config_dword(dev, PCI_VENDOR_ID, &val); + dev->vendor = val & 0xffff; + dev->device = (val >> 16) & 0xffff; + + pci_read_config_dword(dev, PCI_CLASS_REVISION, &val); + dev->revision = val & 0xff; + dev->class = val >> 8; /* upper 3 bytes */ + + pci_read_config_word(dev, PCI_COMMAND, &cmd); + cmd &= ~(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY); + pci_write_config_word(dev, PCI_COMMAND, cmd); + + pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, bar0); + + iounmap(mem); +} +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATHEROS, PCI_ANY_ID, + wndr3700_pci_fixup); + static int wndr3700_pci_plat_dev_init(struct pci_dev *dev) { switch (PCI_SLOT(dev->devfn)) { From bf337e9b27be2a034b04abcbc6de2728ced04c57 Mon Sep 17 00:00:00 2001 From: juhosg Date: Fri, 27 Nov 2009 21:21:24 +0000 Subject: [PATCH 250/288] ar71xx: add default network configuration file for the WNDR3700 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18566 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../base-files/etc/defconfig/wndr3700/network | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 target/linux/ar71xx/base-files/etc/defconfig/wndr3700/network diff --git a/target/linux/ar71xx/base-files/etc/defconfig/wndr3700/network b/target/linux/ar71xx/base-files/etc/defconfig/wndr3700/network new file mode 100644 index 000000000..2d4d8e012 --- /dev/null +++ b/target/linux/ar71xx/base-files/etc/defconfig/wndr3700/network @@ -0,0 +1,16 @@ +config interface loopback + option ifname lo + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + +config interface lan + option ifname eth0 + option type bridge + option proto static + option ipaddr 192.168.1.1 + option netmask 255.255.255.0 + +config interface wan + option ifname eth1 + option proto dhcp From 8a11ffce727cd0a8a0578a5c3359c21c04539a06 Mon Sep 17 00:00:00 2001 From: juhosg Date: Fri, 27 Nov 2009 21:21:28 +0000 Subject: [PATCH 251/288] mac80211: fix a typo in the mac80211.sh git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18567 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/Makefile | 2 +- package/mac80211/files/lib/wifi/mac80211.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile index 6fb2b2314..9440ca6a1 100644 --- a/package/mac80211/Makefile +++ b/package/mac80211/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 PKG_VERSION:=2009-11-21 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE_URL:= \ http://www.orbit-lab.org/kernel/compat-wireless-2.6/2009/11 \ http://wireless.kernel.org/download/compat-wireless-2.6 diff --git a/package/mac80211/files/lib/wifi/mac80211.sh b/package/mac80211/files/lib/wifi/mac80211.sh index 591d978da..b7984a3b7 100644 --- a/package/mac80211/files/lib/wifi/mac80211.sh +++ b/package/mac80211/files/lib/wifi/mac80211.sh @@ -309,7 +309,7 @@ detect_mac80211() { [ "$ht_cap" -gt 0 ] && { mode_11n="n" list=" list ht_capab" - [ "$(($ht_cap & 2))" -eq 1 ] && append ht_capab "$list LDPC" "$N" + [ "$(($ht_cap & 1))" -eq 1 ] && append ht_capab "$list LDPC" "$N" [ "$(($ht_cap & 2))" -eq 2 ] && append ht_capab "$list HT40-" "$N" [ "$(($ht_cap & 32))" -eq 32 ] && append ht_capab "$list SHORT-GI-20" "$N" [ "$(($ht_cap & 64))" -eq 64 ] && append ht_capab "$list SHORT-GI-40" "$N" From bb870b728f83763d03ca6d5f69d236aa7585dc2a Mon Sep 17 00:00:00 2001 From: juhosg Date: Sat, 28 Nov 2009 08:25:49 +0000 Subject: [PATCH 252/288] ar71xx: fix a typo in ar71xx.sh git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18568 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/base-files/lib/ar71xx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index b1c3b83ea..c24a8b3e8 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -74,7 +74,7 @@ ar71xx_board_name() { name="wp543" ;; *WNDR3700) - name"wndr3700" + name="wndr3700" ;; *WNR2000) name="wnr2000" From ebd0fd5ff93fe2a439143d06506dd46cf53668d8 Mon Sep 17 00:00:00 2001 From: juhosg Date: Sat, 28 Nov 2009 08:25:53 +0000 Subject: [PATCH 253/288] firmware-utils: add WNDR3700 image fixing tool (thanks to Anael Orlinski) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18569 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- tools/firmware-utils/Makefile | 1 + tools/firmware-utils/src/wndr3700.c | 139 ++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 tools/firmware-utils/src/wndr3700.c diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index 5ccc0d12b..ec41e0827 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -52,6 +52,7 @@ define Host/Compile $(call cc,pc1crypt) $(call cc,osbridge-crc) $(call cc2,wrt400n cyg_crc32) + $(call cc,wndr3700) endef define Host/Install diff --git a/tools/firmware-utils/src/wndr3700.c b/tools/firmware-utils/src/wndr3700.c new file mode 100644 index 000000000..51e5352cb --- /dev/null +++ b/tools/firmware-utils/src/wndr3700.c @@ -0,0 +1,139 @@ +/* + * wndr3700.c - partially based on OpenWrt's add_header.c + * + * Copyright (C) 2009 Anael Orlinski + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License, + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* + * The add_header utility used by various vendors preprends the buf + * image with a header containing a CRC32 value which is generated for the + * model id + reserved space for CRC32 + buf, then replaces the reserved + * area with the actual CRC32. This replacement tool mimics this behavior. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BPB 8 /* bits/byte */ + +static uint32_t crc32[1<> 1)) : (crc >> 1); + crc32[n] = crc; + } +} + +static uint32_t crc32buf(unsigned char *buf, size_t len) +{ + uint32_t crc = 0xFFFFFFFF; + + for (; len; len--, buf++) + crc = crc32[(uint8_t)crc ^ *buf] ^ (crc >> BPB); + return ~crc; +} + +struct header { + uint32_t magic; + uint32_t crc; + unsigned char stuff[56]; +}; + +static void usage(const char *) __attribute__ (( __noreturn__ )); + +static void usage(const char *mess) +{ + fprintf(stderr, "Error: %s\n", mess); + fprintf(stderr, "Usage: wndr3700 input_file output_file\n"); + fprintf(stderr, "\n"); + exit(1); +} + +int main(int argc, char **argv) +{ + off_t len; // of original buf + off_t buflen; // of the output file + int fd; + void *input_file; // pointer to the input file (mmmapped) + struct header header; + unsigned char *buf; // pointer to prefix + copy of original buf + + // verify parameters + + if (argc != 3) + usage("wrong number of arguments"); + + // mmap input_file + if ((fd = open(argv[1], O_RDONLY)) < 0 + || (len = lseek(fd, 0, SEEK_END)) < 0 + || (input_file = mmap(0, len, PROT_READ, MAP_SHARED, fd, 0)) == (void *) (-1) + || close(fd) < 0) + { + fprintf(stderr, "Error loading file %s: %s\n", argv[1], strerror(errno)); + exit(1); + } + + buflen = len; + + init_crc32(); + + // preload header + memcpy(&header, input_file, sizeof(header)); + + header.magic = htonl(0x33373030); /* 3700 in ascii */ + header.crc = 0; + + // create a firmware image in memory and copy the input_file to it + buf = malloc(buflen); + memcpy(buf, input_file, len); + + // CRC of temporary header + header.crc = htonl(crc32buf((unsigned char*)&header, sizeof(header))); + + memcpy(buf, &header, sizeof(header)); + + // write the buf + if ((fd = open(argv[2], O_CREAT|O_WRONLY|O_TRUNC,0644)) < 0 + || write(fd, buf, buflen) != buflen + || close(fd) < 0) + { + fprintf(stderr, "Error storing file %s: %s\n", argv[2], strerror(errno)); + exit(2); + } + + free(buf); + + munmap(input_file,len); + + return 0; +} From 00f04685a2c8254d08d3440325b096a88b121416 Mon Sep 17 00:00:00 2001 From: juhosg Date: Sat, 28 Nov 2009 08:25:56 +0000 Subject: [PATCH 254/288] ar71xx: create sysupgrade image for the WNDR3700 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18570 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../ar71xx/base-files/lib/upgrade/platform.sh | 7 +++ target/linux/ar71xx/image/Makefile | 45 +++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 8ee412ed0..97c3a41da 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -82,6 +82,13 @@ platform_check_image() { } return 0 ;; + wndr3700) + [ "$magic" != "3337" ] && { + echo "Invalid image type." + return 1 + } + return 0 + ;; wrt160nl) [ "$magic" != "4e4c" ] && { echo "Invalid image type." diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 79f7b7c5f..4c88a85e6 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -215,6 +215,34 @@ define Image/Build/CyberTAN -o $(call imgname,$(1),$(2)).bin endef +wndr3700_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,1024k(kernel),6656k(rootfs),64k(art)ro,7680k@0x70000(firmware) +define Image/Build/WNDR3700 + $(call PatchKernelLzma,$(2),$(3) $(wndr3700_mtdlayout)) + $(call MkImageLzma,$(KDIR)/vmlinux-$(2).bin.lzma,$(KDIR)/vmlinux-$(2).uImage) + mkdir $(KDIR)/wndr3700 + mkdir $(KDIR)/wndr3700/image + $(STAGING_DIR_HOST)/bin/wndr3700 \ + $(KDIR)/vmlinux-$(2).uImage \ + $(KDIR)/wndr3700/image/uImage + $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \ + $(KDIR)/wndr3700 $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp \ + -nopad -noappend -root-owned -be + -rm -rf $(KDIR)/wndr3700 + mkimage -A mips -O linux -T filesystem -C none \ + -a 0xbf070000 -e 0xbf070000 \ + -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \ + -d $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp \ + $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp2 + $(STAGING_DIR_HOST)/bin/wndr3700 \ + $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp2 \ + $(KDIR)/vmlinux-$(2).uImage.squashfs + -rm -f $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp* + ( \ + dd if=$(KDIR)/vmlinux-$(2).uImage.squashfs bs=1M conv=sync; \ + dd if=$(KDIR)/root.$(1) bs=64k; \ + ) > $(call imgname,$(1),$(2))-sysupgrade.bin +endef + define Image/Build/Template/Compex $(call Image/Build/MyLoader,$(1),$(2)) endef @@ -319,6 +347,18 @@ define Image/Build/Template/Planex/jffs2-64k $(call Image/Build/Template/Planex,jffs2-64k,$(1),$(2)) endef +define Image/Build/Template/WNDR3700 + $(call Image/Build/WNDR3700,$(1),$(2),$(3)) +endef + +define Image/Build/Template/WNDR3700/squashfs + $(call Image/Build/Template/WNDR3700,squashfs,$(1),$(2)) +endef + +define Image/Build/Template/WNDR3700/jffs2-64k + $(call Image/Build/Template/WNDR3700,jffs2-64k,$(1),$(2)) +endef + define Image/Build/Profile/AP83 $(call Image/Build/Template/AP83/$(1),ap83,board=AP83) endef @@ -400,6 +440,10 @@ define Image/Build/Profile/TLWR941NDV2 $(call Image/Build/Template/TPLINK/$(1),tl-wr941ndv2,board=TL-WR941ND,TL-WR941NDv2) endef +define Image/Build/Profile/WNDR3700 + $(call Image/Build/Template/WNDR3700/$(1),wndr3700,board=WNDR3700) +endef + define Image/Build/Profile/WRT400N $(call Image/Build/Template/WRT400N/$(1),wrt400n,board=WRT400N) endef @@ -422,6 +466,7 @@ define Image/Build/Profile/Default $(call Image/Build/Profile/TLWR941NDV2,$(1)) $(call Image/Build/Profile/UBNT,$(1)) $(call Image/Build/Profile/WP543,$(1)) + $(call Image/Build/Profile/WNDR3700,$(1)) $(call Image/Build/Profile/WRT400N,$(1)) $(call Image/Build/Profile/WRT160NL,$(1)) endef From 4bcc767170867495a170f365d58d98d7bf075618 Mon Sep 17 00:00:00 2001 From: juhosg Date: Sat, 28 Nov 2009 09:28:25 +0000 Subject: [PATCH 255/288] ar71xx: create images for the WNDR3700, which can be flashed via the factory web interface git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18571 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/image/Makefile | 4 + tools/firmware-utils/Makefile | 1 + tools/firmware-utils/src/mkdniimg.c | 199 ++++++++++++++++++++++++++++ 3 files changed, 204 insertions(+) create mode 100644 tools/firmware-utils/src/mkdniimg.c diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 4c88a85e6..04629ffd5 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -241,6 +241,10 @@ define Image/Build/WNDR3700 dd if=$(KDIR)/vmlinux-$(2).uImage.squashfs bs=1M conv=sync; \ dd if=$(KDIR)/root.$(1) bs=64k; \ ) > $(call imgname,$(1),$(2))-sysupgrade.bin + $(STAGING_DIR_HOST)/bin/mkdniimg \ + -B WNDR3700 -v OpenWrt.$(REVISION) \ + -i $(call imgname,$(1),$(2))-sysupgrade.bin \ + -o $(call imgname,$(1),$(2))-factory.bin endef define Image/Build/Template/Compex diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index ec41e0827..85ef59509 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -53,6 +53,7 @@ define Host/Compile $(call cc,osbridge-crc) $(call cc2,wrt400n cyg_crc32) $(call cc,wndr3700) + $(call cc,mkdniimg) endef define Host/Install diff --git a/tools/firmware-utils/src/mkdniimg.c b/tools/firmware-utils/src/mkdniimg.c new file mode 100644 index 000000000..31b321012 --- /dev/null +++ b/tools/firmware-utils/src/mkdniimg.c @@ -0,0 +1,199 @@ +/* + * Copyright (C) 2009 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include /* for unlink() */ +#include +#include /* for getopt() */ +#include +#include +#include + +#define DNI_HDR_LEN 128 + +/* + * Globals + */ +static char *ifname; +static char *progname; +static char *ofname; +static char *version = "1.00.00"; +static char *region ="NA"; + +static char *board_id; +/* + * Message macros + */ +#define ERR(fmt, ...) do { \ + fflush(0); \ + fprintf(stderr, "[%s] *** error: " fmt "\n", \ + progname, ## __VA_ARGS__ ); \ +} while (0) + +#define ERRS(fmt, ...) do { \ + int save = errno; \ + fflush(0); \ + fprintf(stderr, "[%s] *** error: " fmt "\n", \ + progname, ## __VA_ARGS__, strerror(save)); \ +} while (0) + +void usage(int status) +{ + FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout; + struct board_info *board; + + fprintf(stream, "Usage: %s [OPTIONS...]\n", progname); + fprintf(stream, +"\n" +"Options:\n" +" -B create image for the board specified with \n" +" -i read input from the file \n" +" -o write output to the file \n" +" -v set image version to \n" +" -r set image region to \n" +" -h show this screen\n" + ); + + exit(status); +} + +int main(int argc, char *argv[]) +{ + int res = EXIT_FAILURE; + int buflen; + int err; + struct stat st; + char *buf; + int i; + uint8_t csum; + + FILE *outfile, *infile; + + progname = basename(argv[0]); + + while ( 1 ) { + int c; + + c = getopt(argc, argv, "B:i:o:v:r:h"); + if (c == -1) + break; + + switch (c) { + case 'B': + board_id = optarg; + break; + case 'i': + ifname = optarg; + break; + case 'o': + ofname = optarg; + break; + case 'v': + version = optarg; + break; + case 'r': + region = optarg; + break; + case 'h': + usage(EXIT_SUCCESS); + break; + default: + usage(EXIT_FAILURE); + break; + } + } + + if (board_id == NULL) { + ERR("no board specified"); + goto err; + } + + if (ifname == NULL) { + ERR("no input file specified"); + goto err; + } + + if (ofname == NULL) { + ERR("no output file specified"); + goto err; + } + + err = stat(ifname, &st); + if (err){ + ERRS("stat failed on %s", ifname); + goto err; + } + + buflen = st.st_size + DNI_HDR_LEN + 1; + buf = malloc(buflen); + if (!buf) { + ERR("no memory for buffer\n"); + goto err; + } + + memset(buf, 0, DNI_HDR_LEN); + snprintf(buf, DNI_HDR_LEN, "device:%s\nversion:V%s\nregion:%s\n", + board_id, version, region); + + infile = fopen(ifname, "r"); + if (infile == NULL) { + ERRS("could not open \"%s\" for reading", ifname); + goto err_free; + } + + errno = 0; + fread(buf + DNI_HDR_LEN, st.st_size, 1, infile); + if (errno != 0) { + ERRS("unable to read from file %s", ifname); + goto err_close_in; + } + + csum = 0; + for (i = 0; i < (st.st_size + DNI_HDR_LEN); i++) + csum += buf[i]; + + csum = 0xff - csum; + buf[st.st_size + DNI_HDR_LEN] = csum; + + outfile = fopen(ofname, "w"); + if (outfile == NULL) { + ERRS("could not open \"%s\" for writing", ofname); + goto err_close_in; + } + + errno = 0; + fwrite(buf, buflen, 1, outfile); + if (errno) { + ERRS("unable to write to file %s", ofname); + goto err_close_out; + } + + res = EXIT_SUCCESS; + + out_flush: + fflush(outfile); + + err_close_out: + fclose(outfile); + if (res != EXIT_SUCCESS) { + unlink(ofname); + } + + err_close_in: + fclose(infile); + + err_free: + free(buf); + + err: + return res; +} From 2b30212a0f48cccb532cec0a04e8247eca9b242c Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 28 Nov 2009 11:33:04 +0000 Subject: [PATCH 256/288] [rdc] add sitecom subtarget after the profiles->subtargets conversion (#6245) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18576 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/rdc/Makefile | 2 +- target/linux/rdc/image/Makefile | 6 +++--- target/linux/rdc/sitecom/config-2.6.30 | 3 +++ target/linux/rdc/sitecom/target.mk | 2 ++ 4 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 target/linux/rdc/sitecom/config-2.6.30 create mode 100644 target/linux/rdc/sitecom/target.mk diff --git a/target/linux/rdc/Makefile b/target/linux/rdc/Makefile index c4bfd66c0..2d9d1fb83 100644 --- a/target/linux/rdc/Makefile +++ b/target/linux/rdc/Makefile @@ -11,7 +11,7 @@ BOARD:=rdc BOARDNAME:=RDC 321x FEATURES:=squashfs jffs2 pci usb pcmcia CFLAGS:=-Os -pipe -march=i486 -funit-at-a-time -SUBTARGETS:=amit ar525w r8610 dir-450 +SUBTARGETS:=amit ar525w r8610 dir-450 sitecom LINUX_VERSION:=2.6.30.9 diff --git a/target/linux/rdc/image/Makefile b/target/linux/rdc/image/Makefile index 6f960ac56..0de6dbc25 100644 --- a/target/linux/rdc/image/Makefile +++ b/target/linux/rdc/image/Makefile @@ -34,7 +34,7 @@ define Image/Build/ar525w $(STAGING_DIR_HOST)/bin/airlink -e -b 1 -j $(shell bash -c 'echo $$[$(3)]') $(KDIR)/bzImage $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2)-web.img endef -define Image/Prepare/wl153/squashfs +define Image/Prepare/sitecom/squashfs dd if=/dev/null of=$(KDIR)/root.tmp seek=1 bs=32k echo -n "0123456789abcdef0123" >> $(KDIR)/root.tmp cat $(KDIR)/bzImage $(KDIR)/root.squashfs >> $(KDIR)/root.tmp @@ -44,13 +44,13 @@ define Image/Prepare/wl153/squashfs $(call add_jffs2_mark,$(KDIR)/root.squashfs) endef -define Image/Build/wl153 +define Image/Build/sitecom echo -ne "\0\0" >> $(KDIR)/bzImage dd if=$(KDIR)/bzImage of=$(KDIR)/bzImage.tmp bs=4 conv=sync dd if=$(KDIR)/bzImage.tmp of=$(KDIR)/bzImage bs=1 count=$$$$(perl -we 'print((-s"$(KDIR)/bzImage.tmp")-2)') perl -we 'while(<>){$$$$i.=$$$$_}print pack"v",-(unpack"%v*",$$$$i)' < $(KDIR)/bzImage.tmp >> $(KDIR)/bzImage $(RM) $(KDIR)/bzImage.tmp - $(call Image/Prepare/wl153/$(1)) + $(call Image/Prepare/sitecom/$(1)) perl -we 'print "CSYS",pack("V",-s"$(KDIR)/bzImage"),pack("V",-s"$(KDIR)/root.$(1)"),"WRRM",pack("V",-s"$(KDIR)/bzImage")' > $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img cat $(KDIR)/bzImage $(KDIR)/root.$(1) >> $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img if [ `perl -we 'print -s"$(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img"'` -gt $$$$((0xffff0000-0xffe08000)) ]; then mv $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img $(BIN_DIR)/openwrt-$(BOARD)-$(1)-$(2).img.too_big; echo "#ERR image too big"; fi diff --git a/target/linux/rdc/sitecom/config-2.6.30 b/target/linux/rdc/sitecom/config-2.6.30 new file mode 100644 index 000000000..e6bfa8886 --- /dev/null +++ b/target/linux/rdc/sitecom/config-2.6.30 @@ -0,0 +1,3 @@ +# CONFIG_MTD_PHYSMAP is not set +# CONFIG_MTD_R8610 is not set +# CONFIG_MTD_RDC3210 is not set diff --git a/target/linux/rdc/sitecom/target.mk b/target/linux/rdc/sitecom/target.mk new file mode 100644 index 000000000..83a8c957b --- /dev/null +++ b/target/linux/rdc/sitecom/target.mk @@ -0,0 +1,2 @@ +BOARDNAME:=Devices from Sitecom (WL-153, DC-230) +DEFAULT_PACKAGE+= kmod-usb-core kmod-usb-ohci kmod-usb2 From 2c7b7e70275cdc8bdeff255f4f2e7cf23189892b Mon Sep 17 00:00:00 2001 From: juhosg Date: Sat, 28 Nov 2009 13:49:14 +0000 Subject: [PATCH 257/288] mac80211: fix default channel selection in mac80211.sh (thanks to blubberdiblub) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18577 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/Makefile | 2 +- package/mac80211/files/lib/wifi/mac80211.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile index 9440ca6a1..efb68cd8f 100644 --- a/package/mac80211/Makefile +++ b/package/mac80211/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 PKG_VERSION:=2009-11-21 -PKG_RELEASE:=4 +PKG_RELEASE:=5 PKG_SOURCE_URL:= \ http://www.orbit-lab.org/kernel/compat-wireless-2.6/2009/11 \ http://wireless.kernel.org/download/compat-wireless-2.6 diff --git a/package/mac80211/files/lib/wifi/mac80211.sh b/package/mac80211/files/lib/wifi/mac80211.sh index b7984a3b7..f530d7e51 100644 --- a/package/mac80211/files/lib/wifi/mac80211.sh +++ b/package/mac80211/files/lib/wifi/mac80211.sh @@ -315,7 +315,7 @@ detect_mac80211() { [ "$(($ht_cap & 64))" -eq 64 ] && append ht_capab "$list SHORT-GI-40" "$N" [ "$(($ht_cap & 4096))" -eq 4096 ] && append ht_capab "$list DSSS_CCK-40" "$N" } - iw phy "$dev" info | grep -q '2412 MHz' || mode_band="a"; channel="36" + iw phy "$dev" info | grep -q '2412 MHz' || { mode_band="a"; channel="36"; } cat < Date: Sat, 28 Nov 2009 13:49:17 +0000 Subject: [PATCH 258/288] ar71xx: override mtd partitions for the TEW-632BRP family git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18578 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/image/Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 04629ffd5..6f913f5ec 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -77,11 +77,12 @@ define Image/Build/WRT400N fi; fi endef +cameo_mtdlayout=mtdparts=spi0.0:128k(u-boot)ro,64k(config)ro,896k(kernel),2880k(rootfs),64k(art)ro,3776k@0x30000(firmware) define Image/Build/Cameo - $(call PatchKernelLzma,$(2),$(3)) - if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt 851968 ]; then \ + $(call PatchKernelLzma,$(2),$(3) $(cameo_mtdlayout)) + if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt 917504 ]; then \ echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \ - else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 3014656 ]; then \ + else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 2949120 ]; then \ echo "Warning: $(KDIR)/root.$(1) is too big"; \ else \ mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \ @@ -89,8 +90,8 @@ define Image/Build/Cameo -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \ -d $(KDIR)/vmlinux-$(2).bin.lzma $(KDIR)/vmlinux-$(2).uImage; \ ( \ - dd if=$(KDIR)/vmlinux-$(2).uImage bs=832k conv=sync; \ - dd if=$(KDIR)/root.$(1) bs=2944k conv=sync; \ + dd if=$(KDIR)/vmlinux-$(2).uImage bs=896k conv=sync; \ + dd if=$(KDIR)/root.$(1) bs=2880k conv=sync; \ echo -n $(4); \ ) > $(call imgname,$(1),$(2)).uni; \ fi; fi From e63ae33477df6783e8399b4bfb8eed5a607c7888 Mon Sep 17 00:00:00 2001 From: juhosg Date: Sat, 28 Nov 2009 13:49:19 +0000 Subject: [PATCH 259/288] ar71xx: fix extension of the WNDR3700 firmware image git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18579 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/image/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 6f913f5ec..653a8af69 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -245,7 +245,7 @@ define Image/Build/WNDR3700 $(STAGING_DIR_HOST)/bin/mkdniimg \ -B WNDR3700 -v OpenWrt.$(REVISION) \ -i $(call imgname,$(1),$(2))-sysupgrade.bin \ - -o $(call imgname,$(1),$(2))-factory.bin + -o $(call imgname,$(1),$(2))-factory.img endef define Image/Build/Template/Compex From eaa1ec9472cd44de6d880bea9b39512bf70501e7 Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 28 Nov 2009 14:25:41 +0000 Subject: [PATCH 260/288] [mac80211] update p54usb firmware to 2.13.24.0.lm87.arm (#6177, #6237) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18580 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile index efb68cd8f..303618bbd 100644 --- a/package/mac80211/Makefile +++ b/package/mac80211/Makefile @@ -56,12 +56,12 @@ endef # Prism54 drivers P54PCIFW:=2.13.12.0.arm -P54USBFW:=2.13.24.0.lm86.arm +P54USBFW:=2.13.24.0.lm87.arm define Download/p54usb FILE:=$(P54USBFW) URL:=http://daemonizer.de/prism54/prism54-fw/fw-usb - MD5SUM:=2efd50eab43c0d0376765576a54b7a30 + MD5SUM:=8e8ab005a4f8f0123bcdc51bc25b47f6 endef $(eval $(call Download,p54usb)) From 0da4b7c2080993059906e671fe33471142efbc73 Mon Sep 17 00:00:00 2001 From: juhosg Date: Sat, 28 Nov 2009 18:00:53 +0000 Subject: [PATCH 261/288] mac80211: remove trailing whitespaces in mac80211.sh git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18582 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/files/lib/wifi/mac80211.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package/mac80211/files/lib/wifi/mac80211.sh b/package/mac80211/files/lib/wifi/mac80211.sh index f530d7e51..534a737a4 100644 --- a/package/mac80211/files/lib/wifi/mac80211.sh +++ b/package/mac80211/files/lib/wifi/mac80211.sh @@ -134,7 +134,7 @@ enable_mac80211() { esac # All interfaces must have unique mac addresses - # which can either be explicitly set in the device + # which can either be explicitly set in the device # section, or automatically generated config_get macaddr "$device" macaddr local mac_1="${macaddr%%:*}" @@ -142,7 +142,7 @@ enable_mac80211() { config_get vif_mac "$vif" macaddr [ -n "$vif_mac" ] || { - if [ "$i" -gt 0 ]; then + if [ "$i" -gt 0 ]; then offset="$(( 2 + $i * 4 ))" else offset="0" @@ -168,7 +168,7 @@ enable_mac80211() { # none -> NO encryption # # wep + keymgmt = '' -> we use iw to connect to the - # network. + # network. # # wep + keymgmt = 'NONE' -> wpa_supplicant will be # configured to handle the wep connection @@ -182,7 +182,7 @@ enable_mac80211() { zidx = idx - 1 config_get key "$vif" "key${idx}" if [ -n "$key" ]; then - append keystring "${zidx}:${key} " + append keystring "${zidx}:${key} " fi done fi @@ -238,7 +238,7 @@ enable_mac80211() { ;; sta|mesh) config_get bssid "$vif" bssid - case "$enc" in + case "$enc" in wep) if [ -e "$keymgmt" ]; then [ -n "$keystring" ] && @@ -293,7 +293,7 @@ detect_mac80211() { config_foreach check_device wifi-device [ "$found" -gt 0 ] && continue - while :; do + while :; do config_get type "wifi$devidx" type [ -n "$type" ] || break devidx=$(($devidx + 1)) From f1db6935aee7d844efa89fddb773e9b362f980fb Mon Sep 17 00:00:00 2001 From: juhosg Date: Sat, 28 Nov 2009 18:00:59 +0000 Subject: [PATCH 262/288] mac80211: fix detection of multiple mac80211 devices git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18583 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/Makefile | 2 +- package/mac80211/files/lib/wifi/mac80211.sh | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile index 303618bbd..5eaf77bda 100644 --- a/package/mac80211/Makefile +++ b/package/mac80211/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 PKG_VERSION:=2009-11-21 -PKG_RELEASE:=5 +PKG_RELEASE:=6 PKG_SOURCE_URL:= \ http://www.orbit-lab.org/kernel/compat-wireless-2.6/2009/11 \ http://wireless.kernel.org/download/compat-wireless-2.6 diff --git a/package/mac80211/files/lib/wifi/mac80211.sh b/package/mac80211/files/lib/wifi/mac80211.sh index 534a737a4..91fdcf57c 100644 --- a/package/mac80211/files/lib/wifi/mac80211.sh +++ b/package/mac80211/files/lib/wifi/mac80211.sh @@ -288,16 +288,16 @@ check_device() { detect_mac80211() { devidx=0 config_load wireless + while :; do + config_get type "wifi$devidx" type + [ -n "$type" ] || break + devidx=$(($devidx + 1)) + done for dev in $(ls /sys/class/ieee80211); do found=0 config_foreach check_device wifi-device [ "$found" -gt 0 ] && continue - while :; do - config_get type "wifi$devidx" type - [ -n "$type" ] || break - devidx=$(($devidx + 1)) - done mode_11n="" mode_band="g" channel="5" @@ -335,6 +335,7 @@ config wifi-iface option encryption none EOF + devidx=$(($devidx + 1)) done } From 24b9904ea6113463aaa57ec6e6484950226bd153 Mon Sep 17 00:00:00 2001 From: juhosg Date: Sat, 28 Nov 2009 18:01:03 +0000 Subject: [PATCH 263/288] mac80211: use mac address from platform data if present on ath9k git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18584 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/Makefile | 2 +- ...rride-mac-address-from-platform-data.patch | 53 +++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 package/mac80211/patches/407-ath9k-override-mac-address-from-platform-data.patch diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile index 5eaf77bda..4ee955574 100644 --- a/package/mac80211/Makefile +++ b/package/mac80211/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 PKG_VERSION:=2009-11-21 -PKG_RELEASE:=6 +PKG_RELEASE:=7 PKG_SOURCE_URL:= \ http://www.orbit-lab.org/kernel/compat-wireless-2.6/2009/11 \ http://wireless.kernel.org/download/compat-wireless-2.6 diff --git a/package/mac80211/patches/407-ath9k-override-mac-address-from-platform-data.patch b/package/mac80211/patches/407-ath9k-override-mac-address-from-platform-data.patch new file mode 100644 index 000000000..e4aeab5ce --- /dev/null +++ b/package/mac80211/patches/407-ath9k-override-mac-address-from-platform-data.patch @@ -0,0 +1,53 @@ +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -16,8 +16,10 @@ + + #include + #include ++#include + #include + ++#include "ath9k.h" + #include "hw.h" + #include "rc.h" + #include "initvals.h" +@@ -472,17 +474,23 @@ static int ath9k_hw_rf_claim(struct ath_ + static int ath9k_hw_init_macaddr(struct ath_hw *ah) + { + struct ath_common *common = ath9k_hw_common(ah); ++ struct ath_softc *sc = (struct ath_softc *) common->priv; ++ struct ath9k_platform_data *pdata = sc->dev->platform_data; + u32 sum; + int i; + u16 eeval; + + sum = 0; +- for (i = 0; i < 3; i++) { +- eeval = ah->eep_ops->get_eeprom(ah, AR_EEPROM_MAC(i)); +- sum += eeval; +- common->macaddr[2 * i] = eeval >> 8; +- common->macaddr[2 * i + 1] = eeval & 0xff; +- } ++ if (pdata && pdata->macaddr) ++ memcpy(common->macaddr, pdata->macaddr, ETH_ALEN); ++ else ++ for (i = 0; i < 3; i++) { ++ eeval = ah->eep_ops->get_eeprom(ah, AR_EEPROM_MAC(i)); ++ sum += eeval; ++ common->macaddr[2 * i] = eeval >> 8; ++ common->macaddr[2 * i + 1] = eeval & 0xff; ++ } ++ + if (!is_valid_ether_addr(common->macaddr)) { + DECLARE_MAC_BUF(macbuf); + +--- a/include/linux/ath9k_platform.h ++++ b/include/linux/ath9k_platform.h +@@ -23,6 +23,7 @@ + + struct ath9k_platform_data { + u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS]; ++ u8 *macaddr; + }; + + #endif /* _LINUX_ATH9K_PLATFORM_H */ From 874e72b262e663f3e7c305b114b4e10424d1046c Mon Sep 17 00:00:00 2001 From: juhosg Date: Sat, 28 Nov 2009 18:01:06 +0000 Subject: [PATCH 264/288] ar71xx: update ath9k_platform.h git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18585 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/files/include/linux/ath9k_platform.h | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ar71xx/files/include/linux/ath9k_platform.h b/target/linux/ar71xx/files/include/linux/ath9k_platform.h index 3fbe9b25c..9fb8c6e42 100644 --- a/target/linux/ar71xx/files/include/linux/ath9k_platform.h +++ b/target/linux/ar71xx/files/include/linux/ath9k_platform.h @@ -15,6 +15,7 @@ struct ath9k_platform_data { u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS]; + u8 *macaddr; }; #endif /* _LINUX_ATH9K_PLATFORM_H */ From 52df74715be7c6a815a581b88e01bc0b392952f0 Mon Sep 17 00:00:00 2001 From: juhosg Date: Sat, 28 Nov 2009 18:01:09 +0000 Subject: [PATCH 265/288] ar71xx: fix mac address for 5GHz interface on WNDR3700 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18586 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c index 472d603ba..5f95270ad 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c @@ -107,7 +107,9 @@ static struct ar71xx_pci_irq wndr3700_pci_irqs[] __initdata = { }; static struct ath9k_platform_data wndr3700_wmac0_data; +static u8 wndr3700_wmac0_macaddr[6]; static struct ath9k_platform_data wndr3700_wmac1_data; +static u8 wndr3700_wmac1_macaddr[6]; static void wndr3700_pci_fixup(struct pci_dev *dev) { @@ -201,15 +203,17 @@ static int wndr3700_pci_plat_dev_init(struct pci_dev *dev) static void __init wndr3700_pci_init(void) { - u8 *ee; + u8 *ee = (u8 *) KSEG1ADDR(0x1fff0000); - ee = (u8 *) KSEG1ADDR(0x1fff1000); - memcpy(wndr3700_wmac0_data.eeprom_data, ee, + memcpy(wndr3700_wmac0_data.eeprom_data, ee + 0x1000, sizeof(wndr3700_wmac0_data.eeprom_data)); + memcpy(wndr3700_wmac0_macaddr, ee, sizeof(wndr3700_wmac0_macaddr)); + wndr3700_wmac0_data.macaddr = wndr3700_wmac0_macaddr; - ee = (u8 *) KSEG1ADDR(0x1fff5000); - memcpy(wndr3700_wmac1_data.eeprom_data, ee, + memcpy(wndr3700_wmac1_data.eeprom_data, ee + 0x5000, sizeof(wndr3700_wmac1_data.eeprom_data)); + memcpy(wndr3700_wmac1_macaddr, ee + 12, sizeof(wndr3700_wmac1_macaddr)); + wndr3700_wmac1_data.macaddr = wndr3700_wmac1_macaddr; ar71xx_pci_plat_dev_init = wndr3700_pci_plat_dev_init; ar71xx_pci_init(ARRAY_SIZE(wndr3700_pci_irqs), wndr3700_pci_irqs); From d27e7369f5ef5d9c92f94c086be55a33749e366f Mon Sep 17 00:00:00 2001 From: hauke Date: Sat, 28 Nov 2009 22:09:18 +0000 Subject: [PATCH 266/288] [amazon] Some general changes for amazon drivers. This is mostly needed for kernel 2.6.30 support. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18588 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../files/drivers/char/watchdog/amazon_wdt.c | 4 +- .../amazon/files/drivers/net/amazon_sw.c | 74 +++++++++---------- .../amazon/files/drivers/serial/amazon_asc.c | 6 ++ .../files/include/asm-mips/amazon/amazon_sw.h | 1 + 4 files changed, 43 insertions(+), 42 deletions(-) diff --git a/target/linux/amazon/files/drivers/char/watchdog/amazon_wdt.c b/target/linux/amazon/files/drivers/char/watchdog/amazon_wdt.c index 3c58d2fea..e06203d5b 100644 --- a/target/linux/amazon/files/drivers/char/watchdog/amazon_wdt.c +++ b/target/linux/amazon/files/drivers/char/watchdog/amazon_wdt.c @@ -222,7 +222,7 @@ int __init amazon_wdt_init_module(void) #endif amazon_wdt_isopen=0; - printk(KERN_INFO DRV_NAME "driver loaded but inactive"); + printk(KERN_INFO DRV_NAME "driver loaded but inactive\n"); return 0; } @@ -233,7 +233,7 @@ void amazon_wdt_cleanup_module(void) remove_proc_entry("wdt_register", amazon_wdt_dir); remove_proc_entry("amazon_wdt", NULL); #endif - printk(KERN_INFO DRV_NAME "unregistered"); + printk(KERN_INFO DRV_NAME "unregistered\n"); return; } diff --git a/target/linux/amazon/files/drivers/net/amazon_sw.c b/target/linux/amazon/files/drivers/net/amazon_sw.c index d19db6e36..14d3a8507 100644 --- a/target/linux/amazon/files/drivers/net/amazon_sw.c +++ b/target/linux/amazon/files/drivers/net/amazon_sw.c @@ -105,10 +105,7 @@ module_param(timeout, int, 0); int switch_init(struct net_device *dev); void switch_tx_timeout(struct net_device *dev); -struct net_device switch_devs[2] = { - {init:switch_init,}, - {init:switch_init,} -}; +static struct net_device *switch_devs[2]; int add_mac_table_entry(u64 entry_value) { @@ -274,7 +271,7 @@ __setup("ethaddr=", ethaddr_setup); static void open_rx_dma(struct net_device *dev) { - struct switch_priv *priv = (struct switch_priv *) dev->priv; + struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev); struct dma_device_info *dma_dev = priv->dma_device; int i; @@ -286,7 +283,7 @@ static void open_rx_dma(struct net_device *dev) #ifdef CONFIG_NET_HW_FLOWCONTROL static void close_rx_dma(struct net_device *dev) { - struct switch_priv *priv = (struct switch_priv *) dev->priv; + struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev); struct dma_device_info *dma_dev = priv->dma_device; int i; @@ -306,7 +303,7 @@ void amazon_xon(struct net_device *dev) int switch_open(struct net_device *dev) { - struct switch_priv *priv = (struct switch_priv *) dev->priv; + struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev); if (!strcmp(dev->name, "eth1")) { priv->mdio_phy_addr = PHY0_ADDR; } @@ -325,7 +322,7 @@ int switch_open(struct net_device *dev) int switch_release(struct net_device *dev) { int i; - struct switch_priv *priv = (struct switch_priv *) dev->priv; + struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev); struct dma_device_info *dma_dev = priv->dma_device; for (i = 0; i < dma_dev->num_tx_chan; i++) @@ -348,7 +345,7 @@ int switch_release(struct net_device *dev) void switch_rx(struct net_device *dev, int len, struct sk_buff *skb) { - struct switch_priv *priv = (struct switch_priv *) dev->priv; + struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev); #ifdef CONFIG_NET_HW_FLOWCONTROL int mit_sel = 0; #endif @@ -381,7 +378,7 @@ void switch_rx(struct net_device *dev, int len, struct sk_buff *skb) int asmlinkage switch_hw_tx(char *buf, int len, struct net_device *dev) { - struct switch_priv *priv = dev->priv; + struct switch_priv *priv = netdev_priv(dev); struct dma_device_info *dma_dev = priv->dma_device; dma_dev->current_tx_chan = 0; @@ -392,7 +389,7 @@ int asmlinkage switch_tx(struct sk_buff *skb, struct net_device *dev) { int len; char *data; - struct switch_priv *priv = (struct switch_priv *) dev->priv; + struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev); len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len; data = skb->data; @@ -411,7 +408,7 @@ int asmlinkage switch_tx(struct sk_buff *skb, struct net_device *dev) void switch_tx_timeout(struct net_device *dev) { - struct switch_priv *priv = (struct switch_priv *) dev->priv; + struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev); priv->stats.tx_errors++; netif_wake_queue(dev); return; @@ -419,7 +416,7 @@ void switch_tx_timeout(struct net_device *dev) void negotiate(struct net_device *dev) { - struct switch_priv *priv = (struct switch_priv *) dev->priv; + struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev); unsigned short data = get_mdio_reg(priv->mdio_phy_addr, MDIO_ADVERTISMENT_REG); data &= ~(MDIO_ADVERT_100_HD | MDIO_ADVERT_100_FD | MDIO_ADVERT_10_FD | MDIO_ADVERT_10_HD); @@ -470,7 +467,7 @@ void negotiate(struct net_device *dev) void set_duplex(struct net_device *dev, enum duplex new_duplex) { - struct switch_priv *priv = (struct switch_priv *) dev->priv; + struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev); if (new_duplex != priv->current_duplex) { priv->current_duplex = new_duplex; negotiate(dev); @@ -479,14 +476,14 @@ void set_duplex(struct net_device *dev, enum duplex new_duplex) void set_speed(struct net_device *dev, unsigned long speed) { - struct switch_priv *priv = (struct switch_priv *) dev->priv; + struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev); priv->current_speed_selection = speed; negotiate(dev); } static int switch_ethtool_ioctl(struct net_device *dev, struct ifreq *ifr) { - struct switch_priv *priv = (struct switch_priv *) dev->priv; + struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev); struct ethtool_cmd ecmd; if (copy_from_user(&ecmd, ifr->ifr_data, sizeof(ecmd))) @@ -642,7 +639,7 @@ int switch_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) struct net_device_stats *switch_stats(struct net_device *dev) { - struct switch_priv *priv = (struct switch_priv *) dev->priv; + struct switch_priv *priv = (struct switch_priv *) netdev_priv(dev); return &priv->stats; } @@ -692,7 +689,7 @@ int dma_intr_handler(struct dma_device_info *dma_dev, int status) { struct net_device *dev; - dev = switch_devs + (u32) dma_dev->priv; + dev = dma_dev->priv; switch (status) { case RCV_INT: switch_hw_receive(dev, dma_dev); @@ -735,19 +732,18 @@ int dma_buffer_free(u8 * dataptr, void *opt) return OK; } -int init_dma_device(_dma_device_info * dma_dev) +int init_dma_device(_dma_device_info * dma_dev, struct net_device *dev) { int i; int num_tx_chan, num_rx_chan; if (strcmp(dma_dev->device_name, "switch1") == 0) { num_tx_chan = 1; num_rx_chan = 2; - dma_dev->priv = (void *) 0; } else { num_tx_chan = 1; num_rx_chan = 2; - dma_dev->priv = (void *) 1; } + dma_dev->priv = dev; dma_dev->weight = 1; dma_dev->num_tx_chan = num_tx_chan; @@ -799,21 +795,15 @@ int switch_init(struct net_device *dev) dev->tx_timeout = switch_tx_timeout; dev->watchdog_timeo = timeout; - SET_MODULE_OWNER(dev); - - dev->priv = kmalloc(sizeof(struct switch_priv), GFP_KERNEL); - if (dev->priv == NULL) - return -ENOMEM; - memset(dev->priv, 0, sizeof(struct switch_priv)); - priv = dev->priv; + priv = netdev_priv(dev); priv->dma_device = (struct dma_device_info *) kmalloc(sizeof(struct dma_device_info), GFP_KERNEL); - if ((dev - switch_devs) == 0) { + if (priv->num == 0) { sprintf(priv->dma_device->device_name, "switch1"); - } else if ((dev - switch_devs) == 1) { + } else if (priv->num == 1) { sprintf(priv->dma_device->device_name, "switch2"); } printk("\"%s\"\n", priv->dma_device->device_name); - init_dma_device(priv->dma_device); + init_dma_device(priv->dma_device, dev); result = dma_device_register(priv->dma_device); /* read the mac address from the mac table and put them into the mac table. */ @@ -827,12 +817,12 @@ int switch_init(struct net_device *dev) dev->dev_addr[2] = 0xda; dev->dev_addr[3] = 0x86; dev->dev_addr[4] = 0x23; - dev->dev_addr[5] = 0x74 + (unsigned char) (dev - switch_devs); + dev->dev_addr[5] = 0x74 + (unsigned char) priv->num; } else { for (i = 0; i < 6; i++) { dev->dev_addr[i] = my_ethaddr[i]; } - dev->dev_addr[5] += +(unsigned char) (dev - switch_devs); + dev->dev_addr[5] += +(unsigned char) priv->num; } return OK; } @@ -840,12 +830,16 @@ int switch_init(struct net_device *dev) int switch_init_module(void) { int i = 0, result, device_present = 0; + struct switch_priv *priv; for (i = 0; i < AMAZON_SW_INT_NO; i++) { - sprintf(switch_devs[i].name, "eth%d", i); - - if ((result = register_netdev(switch_devs + i))) - printk("error %i registering device \"%s\"\n", result, switch_devs[i].name); + switch_devs[i] = alloc_etherdev(sizeof(struct switch_priv)); + switch_devs[i]->init = switch_init; + strcpy(switch_devs[i]->name, "eth%d"); + priv = (struct switch_priv *) netdev_priv(switch_devs[i]); + priv->num = i; + if ((result = register_netdev(switch_devs[i]))) + printk("error %i registering device \"%s\"\n", result, switch_devs[i]->name); else device_present++; } @@ -858,13 +852,13 @@ void switch_cleanup(void) int i; struct switch_priv *priv; for (i = 0; i < AMAZON_SW_INT_NO; i++) { - priv = switch_devs[i].priv; + priv = netdev_priv(switch_devs[i]); if (priv->dma_device) { dma_device_unregister(priv->dma_device); kfree(priv->dma_device); } - kfree(switch_devs[i].priv); - unregister_netdev(switch_devs + i); + kfree(netdev_priv(switch_devs[i])); + unregister_netdev(switch_devs[i]); } return; } diff --git a/target/linux/amazon/files/drivers/serial/amazon_asc.c b/target/linux/amazon/files/drivers/serial/amazon_asc.c index 7c17cb0f4..629754945 100644 --- a/target/linux/amazon/files/drivers/serial/amazon_asc.c +++ b/target/linux/amazon/files/drivers/serial/amazon_asc.c @@ -102,10 +102,16 @@ static void amazonasc_enable_ms(struct uart_port *port) return; } +#include + static void amazonasc_rx_chars(struct uart_port *port) { +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 26)) + struct tty_struct *tty = port->info->port.tty; +#else struct tty_struct *tty = port->info->tty; +#endif unsigned int ch = 0, rsr = 0, fifocnt; fifocnt = amazon_readl(AMAZON_ASC_FSTAT) & ASCFSTAT_RXFFLMASK; diff --git a/target/linux/amazon/files/include/asm-mips/amazon/amazon_sw.h b/target/linux/amazon/files/include/asm-mips/amazon/amazon_sw.h index 3b73b5389..13273813a 100644 --- a/target/linux/amazon/files/include/asm-mips/amazon/amazon_sw.h +++ b/target/linux/amazon/files/include/asm-mips/amazon/amazon_sw.h @@ -166,6 +166,7 @@ struct switch_priv { int rx_queue_len; int full_duplex; enum duplex current_duplex; + int num; }; #endif //AMAZON_SW_H From 4ac203ac44a171514b2df6c36434ca78140ec539 Mon Sep 17 00:00:00 2001 From: hauke Date: Sat, 28 Nov 2009 22:17:37 +0000 Subject: [PATCH 267/288] [amazon] Add kernel 2.6.30 support The device is booting and Ethernet is working, but nothing more was tested. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18589 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/amazon/Makefile | 8 + target/linux/amazon/config-2.6.30 | 150 ++++++++++++++++++ .../files/include/asm-mips/mach-amazon/war.h | 24 +++ .../patches-2.6.30/000-mips-bad-intctl.patch | 32 ++++ .../010-mips_clocksource_init_war.patch | 33 ++++ .../patches-2.6.30/017-wdt-driver.patch | 10 ++ .../amazon/patches-2.6.30/100-board.patch | 48 ++++++ .../patches-2.6.30/130-mtd_drivers.patch | 7 + .../patches-2.6.30/140-net_drivers.patch | 9 ++ .../patches-2.6.30/150-serial_driver.patch | 10 ++ .../amazon/patches-2.6.30/160-cfi-swap.patch | 56 +++++++ ...fix_deprecated_interrupt_definations.patch | 53 +++++++ .../210-remove_unnedded_variables.patch | 12 ++ .../amazon/patches-2.6.30/220-fix_timer.patch | 93 +++++++++++ .../amazon/patches-2.6.30/230-fix_pci.patch | 20 +++ .../amazon/patches-2.6.30/240-irq_fix.patch | 20 +++ 16 files changed, 585 insertions(+) create mode 100644 target/linux/amazon/config-2.6.30 create mode 100644 target/linux/amazon/files/include/asm-mips/mach-amazon/war.h create mode 100644 target/linux/amazon/patches-2.6.30/000-mips-bad-intctl.patch create mode 100644 target/linux/amazon/patches-2.6.30/010-mips_clocksource_init_war.patch create mode 100644 target/linux/amazon/patches-2.6.30/017-wdt-driver.patch create mode 100644 target/linux/amazon/patches-2.6.30/100-board.patch create mode 100644 target/linux/amazon/patches-2.6.30/130-mtd_drivers.patch create mode 100644 target/linux/amazon/patches-2.6.30/140-net_drivers.patch create mode 100644 target/linux/amazon/patches-2.6.30/150-serial_driver.patch create mode 100644 target/linux/amazon/patches-2.6.30/160-cfi-swap.patch create mode 100644 target/linux/amazon/patches-2.6.30/200-fix_deprecated_interrupt_definations.patch create mode 100644 target/linux/amazon/patches-2.6.30/210-remove_unnedded_variables.patch create mode 100644 target/linux/amazon/patches-2.6.30/220-fix_timer.patch create mode 100644 target/linux/amazon/patches-2.6.30/230-fix_pci.patch create mode 100644 target/linux/amazon/patches-2.6.30/240-irq_fix.patch diff --git a/target/linux/amazon/Makefile b/target/linux/amazon/Makefile index cca8a415f..5a5fed598 100644 --- a/target/linux/amazon/Makefile +++ b/target/linux/amazon/Makefile @@ -18,4 +18,12 @@ define Target/Description Build firmware images for Infineon Amazon boards endef +ifeq ($(KERNEL_PATCHVER),2.6.30) + define Kernel/Prepare + $(call Kernel/Prepare/Default) + mv $(LINUX_DIR)/include/asm-mips/mach-amazon $(LINUX_DIR)/arch/mips/include/asm/mach-amazon + mv $(LINUX_DIR)/drivers/char/watchdog/amazon_wdt.c $(LINUX_DIR)/drivers/watchdog/amazon_wdt.c + endef +endif + $(eval $(call BuildTarget)) diff --git a/target/linux/amazon/config-2.6.30 b/target/linux/amazon/config-2.6.30 new file mode 100644 index 000000000..33a0107b5 --- /dev/null +++ b/target/linux/amazon/config-2.6.30 @@ -0,0 +1,150 @@ +CONFIG_32BIT=y +# CONFIG_64BIT is not set +CONFIG_ADM6996_SUPPORT=y +CONFIG_AMAZON=y +CONFIG_AMAZON_ASC_UART=y +CONFIG_AMAZON_MTD=y +CONFIG_AMAZON_NET_SW=y +CONFIG_AMAZON_PCI=y +CONFIG_AMAZON_WDT=y +# CONFIG_ARCH_HAS_ILOG2_U32 is not set +# CONFIG_ARCH_HAS_ILOG2_U64 is not set +CONFIG_ARCH_POPULATES_NODE_MAP=y +# CONFIG_ARCH_SUPPORTS_MSI is not set +CONFIG_ARCH_SUPPORTS_OPROFILE=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +# CONFIG_BCM47XX is not set +# CONFIG_BINARY_PRINTF is not set +CONFIG_BITREVERSE=y +# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set +# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set +CONFIG_CEVT_R4K=y +CONFIG_CEVT_R4K_LIB=y +CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,jffs2 init=/bin/sh" +CONFIG_CPU_BIG_ENDIAN=y +# CONFIG_CPU_CAVIUM_OCTEON is not set +CONFIG_CPU_HAS_LLSC=y +CONFIG_CPU_HAS_PREFETCH=y +CONFIG_CPU_HAS_SYNC=y +# CONFIG_CPU_LITTLE_ENDIAN is not set +# CONFIG_CPU_LOONGSON2 is not set +CONFIG_CPU_MIPS32=y +# CONFIG_CPU_MIPS32_R1 is not set +CONFIG_CPU_MIPS32_R2=y +# CONFIG_CPU_MIPS64_R1 is not set +# CONFIG_CPU_MIPS64_R2 is not set +CONFIG_CPU_MIPSR2=y +# CONFIG_CPU_NEVADA is not set +# CONFIG_CPU_R10000 is not set +# CONFIG_CPU_R3000 is not set +# CONFIG_CPU_R4300 is not set +# CONFIG_CPU_R4X00 is not set +# CONFIG_CPU_R5000 is not set +# CONFIG_CPU_R5432 is not set +# CONFIG_CPU_R5500 is not set +# CONFIG_CPU_R6000 is not set +# CONFIG_CPU_R8000 is not set +# CONFIG_CPU_RM7000 is not set +# CONFIG_CPU_RM9000 is not set +# CONFIG_CPU_SB1 is not set +CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y +CONFIG_CPU_SUPPORTS_HIGHMEM=y +# CONFIG_CPU_TX39XX is not set +# CONFIG_CPU_TX49XX is not set +# CONFIG_CPU_VR41XX is not set +CONFIG_CSRC_R4K=y +CONFIG_CSRC_R4K_LIB=y +CONFIG_DECOMPRESS_LZMA=y +CONFIG_DEVPORT=y +# CONFIG_DM9000 is not set +CONFIG_DMA_NEED_PCI_MAP_STATE=y +CONFIG_DMA_NONCOHERENT=y +CONFIG_EARLY_PRINTK=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CMOS_UPDATE=y +CONFIG_GENERIC_FIND_LAST_BIT=y +CONFIG_GENERIC_FIND_NEXT_BIT=y +CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y +CONFIG_HARDWARE_WATCHPOINTS=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +CONFIG_HAVE_ARCH_KGDB=y +# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set +CONFIG_HAVE_IDE=y +CONFIG_HAVE_MLOCK=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_STD_PC_SERIAL_PORT=y +CONFIG_HW_HAS_PCI=y +CONFIG_HW_RANDOM=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_IRQ_CPU=y +CONFIG_KALLSYMS=y +# CONFIG_LEMOTE_FULONG is not set +# CONFIG_MACH_ALCHEMY is not set +# CONFIG_MACH_DECSTATION is not set +# CONFIG_MACH_JAZZ is not set +# CONFIG_MACH_TX39XX is not set +# CONFIG_MACH_TX49XX is not set +# CONFIG_MACH_VR41XX is not set +# CONFIG_MIKROTIK_RB532 is not set +CONFIG_MIPS=y +# CONFIG_MIPS_COBALT is not set +# CONFIG_MIPS_FPU_EMU is not set +CONFIG_MIPS_L1_CACHE_SHIFT=5 +# CONFIG_MIPS_MACHINE is not set +# CONFIG_MIPS_MALTA is not set +CONFIG_MIPS_MT_DISABLED=y +# CONFIG_MIPS_MT_SMP is not set +# CONFIG_MIPS_MT_SMTC is not set +# CONFIG_MIPS_SIM is not set +CONFIG_MTD_AMAZON_BUS_WIDTH_16=y +# CONFIG_MTD_AMAZON_BUS_WIDTH_32 is not set +# CONFIG_MTD_AMAZON_BUS_WIDTH_8 is not set +# CONFIG_MTD_AMAZON_FLASH_SIZE_16 is not set +# CONFIG_MTD_AMAZON_FLASH_SIZE_2 is not set +CONFIG_MTD_AMAZON_FLASH_SIZE_4=y +# CONFIG_MTD_AMAZON_FLASH_SIZE_8 is not set +CONFIG_MTD_CFI_ADV_OPTIONS=y +# CONFIG_MTD_CFI_GEOMETRY is not set +# CONFIG_MTD_CFI_INTELEXT is not set +CONFIG_MTD_PHYSMAP=y +CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-3 +CONFIG_MTD_REDBOOT_PARTS=y +# CONFIG_NET_PCI is not set +# CONFIG_NO_IOPORT is not set +# CONFIG_NXP_STB220 is not set +# CONFIG_NXP_STB225 is not set +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PCI_DOMAINS=y +# CONFIG_PMC_MSP is not set +# CONFIG_PMC_YOSEMITE is not set +# CONFIG_PNX8550_JBS is not set +# CONFIG_PNX8550_STB810 is not set +# CONFIG_PROBE_INITRD_HEADER is not set +CONFIG_SCHED_OMIT_FRAME_POINTER=y +# CONFIG_SCSI_DMA is not set +# CONFIG_SERIAL_8250 is not set +# CONFIG_SGI_IP22 is not set +# CONFIG_SGI_IP27 is not set +# CONFIG_SGI_IP28 is not set +# CONFIG_SGI_IP32 is not set +# CONFIG_SIBYTE_BIGSUR is not set +# CONFIG_SIBYTE_CARMEL is not set +# CONFIG_SIBYTE_CRHINE is not set +# CONFIG_SIBYTE_CRHONE is not set +# CONFIG_SIBYTE_LITTLESUR is not set +# CONFIG_SIBYTE_RHONE is not set +# CONFIG_SIBYTE_SENTOSA is not set +# CONFIG_SIBYTE_SWARM is not set +# CONFIG_SLOW_WORK is not set +CONFIG_SYS_HAS_CPU_MIPS32_R1=y +CONFIG_SYS_HAS_CPU_MIPS32_R2=y +CONFIG_SYS_HAS_EARLY_PRINTK=y +CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y +CONFIG_SYS_SUPPORTS_ARBIT_HZ=y +CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y +CONFIG_TRACING_SUPPORT=y +CONFIG_TRAD_SIGNALS=y +CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/amazon/files/include/asm-mips/mach-amazon/war.h b/target/linux/amazon/files/include/asm-mips/mach-amazon/war.h new file mode 100644 index 000000000..da42ee5a2 --- /dev/null +++ b/target/linux/amazon/files/include/asm-mips/mach-amazon/war.h @@ -0,0 +1,24 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + */ +#ifndef __ASM_MIPS_MACH_AMAZON_WAR_H +#define __ASM_MIPS_MACH_AMAZON_WAR_H + +#define R4600_V1_INDEX_ICACHEOP_WAR 0 +#define R4600_V1_HIT_CACHEOP_WAR 0 +#define R4600_V2_HIT_CACHEOP_WAR 0 +#define R5432_CP0_INTERRUPT_WAR 0 +#define BCM1250_M3_WAR 0 +#define SIBYTE_1956_WAR 0 +#define MIPS4K_ICACHE_REFILL_WAR 0 +#define MIPS_CACHE_SYNC_WAR 0 +#define TX49XX_ICACHE_INDEX_INV_WAR 0 +#define RM9000_CDEX_SMP_WAR 0 +#define ICACHE_REFILLS_WORKAROUND_WAR 0 +#define R10000_LLSC_WAR 0 +#define MIPS34K_MISSED_ITLB_WAR 0 + +#endif diff --git a/target/linux/amazon/patches-2.6.30/000-mips-bad-intctl.patch b/target/linux/amazon/patches-2.6.30/000-mips-bad-intctl.patch new file mode 100644 index 000000000..5de5064dc --- /dev/null +++ b/target/linux/amazon/patches-2.6.30/000-mips-bad-intctl.patch @@ -0,0 +1,32 @@ +--- a/arch/mips/kernel/traps.c ++++ b/arch/mips/kernel/traps.c +@@ -1542,7 +1542,16 @@ void __cpuinit per_cpu_trap_init(void) + */ + if (cpu_has_mips_r2) { + cp0_compare_irq = (read_c0_intctl() >> 29) & 7; ++ if (!cp0_compare_irq) ++ cp0_compare_irq = CP0_LEGACY_COMPARE_IRQ; ++ + cp0_perfcount_irq = (read_c0_intctl() >> 26) & 7; ++ if (!cp0_perfcount_irq) ++ cp0_perfcount_irq = CP0_LEGACY_PERFCNT_IRQ; ++ ++ if (arch_fixup_c0_irqs) ++ arch_fixup_c0_irqs(); ++ + if (cp0_perfcount_irq == cp0_compare_irq) + cp0_perfcount_irq = -1; + } else { +--- a/arch/mips/include/asm/irq.h ++++ b/arch/mips/include/asm/irq.h +@@ -157,8 +157,10 @@ extern void free_irqno(unsigned int irq) + * IE7. Since R2 their number has to be read from the c0_intctl register. + */ + #define CP0_LEGACY_COMPARE_IRQ 7 ++#define CP0_LEGACY_PERFCNT_IRQ 7 + + extern int cp0_compare_irq; + extern int cp0_perfcount_irq; ++extern void __weak arch_fixup_c0_irqs(void); + + #endif /* _ASM_IRQ_H */ diff --git a/target/linux/amazon/patches-2.6.30/010-mips_clocksource_init_war.patch b/target/linux/amazon/patches-2.6.30/010-mips_clocksource_init_war.patch new file mode 100644 index 000000000..ac44c308f --- /dev/null +++ b/target/linux/amazon/patches-2.6.30/010-mips_clocksource_init_war.patch @@ -0,0 +1,33 @@ +--- a/arch/mips/kernel/cevt-r4k.c ++++ b/arch/mips/kernel/cevt-r4k.c +@@ -21,6 +21,22 @@ + + #ifndef CONFIG_MIPS_MT_SMTC + ++/* ++ * Compare interrupt can be routed and latched outside the core, ++ * so a single execution hazard barrier may not be enough to give ++ * it time to clear as seen in the Cause register. 4 time the ++ * pipeline depth seems reasonably conservative, and empirically ++ * works better in configurations with high CPU/bus clock ratios. ++ */ ++ ++#define compare_change_hazard() \ ++ do { \ ++ irq_disable_hazard(); \ ++ irq_disable_hazard(); \ ++ irq_disable_hazard(); \ ++ irq_disable_hazard(); \ ++ } while (0) ++ + static int mips_next_event(unsigned long delta, + struct clock_event_device *evt) + { +@@ -30,6 +46,7 @@ static int mips_next_event(unsigned long + cnt = read_c0_count(); + cnt += delta; + write_c0_compare(cnt); ++ compare_change_hazard(); + res = ((int)(read_c0_count() - cnt) > 0) ? -ETIME : 0; + return res; + } diff --git a/target/linux/amazon/patches-2.6.30/017-wdt-driver.patch b/target/linux/amazon/patches-2.6.30/017-wdt-driver.patch new file mode 100644 index 000000000..bee390bbb --- /dev/null +++ b/target/linux/amazon/patches-2.6.30/017-wdt-driver.patch @@ -0,0 +1,10 @@ +--- a/drivers/watchdog/Makefile ++++ b/drivers/watchdog/Makefile +@@ -105,6 +105,7 @@ obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o + obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o + obj-$(CONFIG_AR7_WDT) += ar7_wdt.o + obj-$(CONFIG_TXX9_WDT) += txx9wdt.o ++obj-$(CONFIG_AMAZON_WDT) += amazon_wdt.o + + # PARISC Architecture + diff --git a/target/linux/amazon/patches-2.6.30/100-board.patch b/target/linux/amazon/patches-2.6.30/100-board.patch new file mode 100644 index 000000000..df813e74d --- /dev/null +++ b/target/linux/amazon/patches-2.6.30/100-board.patch @@ -0,0 +1,48 @@ +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -60,6 +60,21 @@ config BCM47XX + help + Support for BCM47XX based boards + ++config AMAZON ++ bool "Amazon support (EXPERIMENTAL)" ++ depends on EXPERIMENTAL ++ select DMA_NONCOHERENT ++ select IRQ_CPU ++ select CEVT_R4K ++ select CSRC_R4K ++ select SYS_HAS_CPU_MIPS32_R1 ++ select SYS_HAS_CPU_MIPS32_R2 ++ select HAVE_STD_PC_SERIAL_PORT ++ select SYS_SUPPORTS_BIG_ENDIAN ++ select SYS_SUPPORTS_32BIT_KERNEL ++ select SYS_HAS_EARLY_PRINTK ++ select HW_HAS_PCI ++ + config MIPS_COBALT + bool "Cobalt Server" + select CEVT_R4K +@@ -633,6 +648,7 @@ config CAVIUM_OCTEON_REFERENCE_BOARD + + endchoice + ++source "arch/mips/amazon/Kconfig" + source "arch/mips/alchemy/Kconfig" + source "arch/mips/basler/excite/Kconfig" + source "arch/mips/jazz/Kconfig" +--- a/arch/mips/Makefile ++++ b/arch/mips/Makefile +@@ -283,6 +283,13 @@ libs-$(CONFIG_MIPS_XXS1500) += arch/mips + load-$(CONFIG_MIPS_XXS1500) += 0xffffffff80100000 + + # ++# Infineon AMAZON ++# ++core-$(CONFIG_AMAZON) += arch/mips/amazon/ ++cflags-$(CONFIG_AMAZON) += -I$(srctree)/arch/mips/include/asm/mach-amazon ++load-$(CONFIG_AMAZON) += 0xffffffff80002000 ++ ++# + # Cobalt Server + # + core-$(CONFIG_MIPS_COBALT) += arch/mips/cobalt/ diff --git a/target/linux/amazon/patches-2.6.30/130-mtd_drivers.patch b/target/linux/amazon/patches-2.6.30/130-mtd_drivers.patch new file mode 100644 index 000000000..aaf3a8d8a --- /dev/null +++ b/target/linux/amazon/patches-2.6.30/130-mtd_drivers.patch @@ -0,0 +1,7 @@ +--- a/drivers/mtd/maps/Makefile ++++ b/drivers/mtd/maps/Makefile +@@ -62,3 +62,4 @@ obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_ + obj-$(CONFIG_MTD_BFIN_ASYNC) += bfin-async-flash.o + obj-$(CONFIG_MTD_RBTX4939) += rbtx4939-flash.o + obj-$(CONFIG_MTD_VMU) += vmu-flash.o ++obj-$(CONFIG_AMAZON_MTD) += amazon.o diff --git a/target/linux/amazon/patches-2.6.30/140-net_drivers.patch b/target/linux/amazon/patches-2.6.30/140-net_drivers.patch new file mode 100644 index 000000000..5c677fd2e --- /dev/null +++ b/target/linux/amazon/patches-2.6.30/140-net_drivers.patch @@ -0,0 +1,9 @@ +--- a/drivers/net/Makefile ++++ b/drivers/net/Makefile +@@ -272,3 +272,6 @@ obj-$(CONFIG_VIRTIO_NET) += virtio_net.o + obj-$(CONFIG_SFC) += sfc/ + + obj-$(CONFIG_WIMAX) += wimax/ ++ ++obj-$(CONFIG_AMAZON_NET_SW) += amazon_sw.o ++obj-$(CONFIG_ADM6996_SUPPORT) += admmod.o diff --git a/target/linux/amazon/patches-2.6.30/150-serial_driver.patch b/target/linux/amazon/patches-2.6.30/150-serial_driver.patch new file mode 100644 index 000000000..8b7741c93 --- /dev/null +++ b/target/linux/amazon/patches-2.6.30/150-serial_driver.patch @@ -0,0 +1,10 @@ +--- a/drivers/serial/Makefile ++++ b/drivers/serial/Makefile +@@ -3,6 +3,7 @@ + # + + obj-$(CONFIG_SERIAL_CORE) += serial_core.o ++obj-$(CONFIG_AMAZON_ASC_UART) += amazon_asc.o + obj-$(CONFIG_SERIAL_21285) += 21285.o + + # These Sparc drivers have to appear before others such as 8250 diff --git a/target/linux/amazon/patches-2.6.30/160-cfi-swap.patch b/target/linux/amazon/patches-2.6.30/160-cfi-swap.patch new file mode 100644 index 000000000..4809fccd8 --- /dev/null +++ b/target/linux/amazon/patches-2.6.30/160-cfi-swap.patch @@ -0,0 +1,56 @@ +--- a/drivers/mtd/chips/cfi_cmdset_0002.c ++++ b/drivers/mtd/chips/cfi_cmdset_0002.c +@@ -1090,6 +1090,9 @@ static int __xipram do_write_oneword(str + int retry_cnt = 0; + + adr += chip->start; ++#ifdef CONFIG_AMAZON ++ adr ^= 2; ++#endif + + spin_lock(chip->mutex); + ret = get_chip(map, chip, adr, FL_WRITING); +@@ -1372,7 +1375,11 @@ static int __xipram do_write_buffer(stru + z = 0; + while(z < words * map_bankwidth(map)) { + datum = map_word_load(map, buf); ++#ifdef CONFIG_AMAZON ++ map_write(map, datum, (adr + z) ^ 0x2); ++#else + map_write(map, datum, adr + z); ++#endif + + z += map_bankwidth(map); + buf += map_bankwidth(map); +@@ -1617,6 +1624,9 @@ static int __xipram do_erase_oneblock(st + int ret = 0; + + adr += chip->start; ++#ifdef CONFIG_AMAZON ++ adr ^= 2; ++#endif + + spin_lock(chip->mutex); + ret = get_chip(map, chip, adr, FL_ERASING); +@@ -1745,6 +1755,10 @@ static int do_atmel_lock(struct map_info + struct cfi_private *cfi = map->fldrv_priv; + int ret; + ++#ifdef CONFIG_AMAZON ++ adr ^= 2; ++#endif ++ + spin_lock(chip->mutex); + ret = get_chip(map, chip, adr + chip->start, FL_LOCKING); + if (ret) +@@ -1781,6 +1795,10 @@ static int do_atmel_unlock(struct map_in + struct cfi_private *cfi = map->fldrv_priv; + int ret; + ++#ifdef CONFIG_AMAZON ++ adr ^= 2; ++#endif ++ + spin_lock(chip->mutex); + ret = get_chip(map, chip, adr + chip->start, FL_UNLOCKING); + if (ret) diff --git a/target/linux/amazon/patches-2.6.30/200-fix_deprecated_interrupt_definations.patch b/target/linux/amazon/patches-2.6.30/200-fix_deprecated_interrupt_definations.patch new file mode 100644 index 000000000..3c683e03c --- /dev/null +++ b/target/linux/amazon/patches-2.6.30/200-fix_deprecated_interrupt_definations.patch @@ -0,0 +1,53 @@ +--- a/arch/mips/amazon/dma-core.c ++++ b/arch/mips/amazon/dma-core.c +@@ -1387,7 +1387,7 @@ static int dma_init(void) + AMAZON_DMA_EMSG("cannot register device dma-core!\n"); + return result; + } +- result = request_irq(AMAZON_DMA_INT, dma_interrupt, SA_INTERRUPT, "dma-core", (void *) &dma_interrupt); ++ result = request_irq(AMAZON_DMA_INT, dma_interrupt, IRQF_DISABLED, "dma-core", (void *) &dma_interrupt); + if (result) { + AMAZON_DMA_EMSG("error, cannot get dma_irq!\n"); + free_irq(AMAZON_DMA_INT, (void *) &dma_interrupt); +--- a/arch/mips/amazon/interrupt.c ++++ b/arch/mips/amazon/interrupt.c +@@ -157,7 +157,7 @@ out: + + static struct irqaction cascade = { + .handler = no_action, +- .flags = SA_INTERRUPT, ++ .flags = IRQF_DISABLED, + .name = "cascade", + }; + +--- a/arch/mips/amazon/setup.c ++++ b/arch/mips/amazon/setup.c +@@ -107,7 +107,7 @@ static void amazon_timer6_interrupt(int + + static struct irqaction hrt_irqaction = { + .handler = amazon_timer6_interrupt, +- .flags = SA_INTERRUPT, ++ .flags = IRQF_DISABLED, + .name = "hrt", + }; + +--- a/drivers/atm/amazon_tpe.c ++++ b/drivers/atm/amazon_tpe.c +@@ -2404,13 +2404,13 @@ amazon_atm_dev_t * amazon_atm_create(voi + + + // Register interrupts for insertion and extraction +- request_irq(AMAZON_SWIE_INT, amazon_atm_swie_isr, SA_INTERRUPT, "tpe_swie", NULL); +- request_irq(AMAZON_CBM_INT, amazon_atm_cbm_isr, SA_INTERRUPT, "tpe_cbm", NULL); ++ request_irq(AMAZON_SWIE_INT, amazon_atm_swie_isr, IRQF_DISABLED, "tpe_swie", NULL); ++ request_irq(AMAZON_CBM_INT, amazon_atm_cbm_isr, IRQF_DISABLED, "tpe_cbm", NULL); + #ifdef AMAZON_ATM_DEBUG +- request_irq(AMAZON_HTU_INT , amazon_atm_htu_isr, SA_INTERRUPT, "tpe_htu", NULL); ++ request_irq(AMAZON_HTU_INT , amazon_atm_htu_isr, IRQF_DISABLED, "tpe_htu", NULL); + #endif + #ifdef AMAZON_TPE_TEST_AAL5_INT +- request_irq(AMAZON_AAL5_INT, amazon_atm_aal5_isr, SA_INTERRUPT, "tpe_aal5", NULL); ++ request_irq(AMAZON_AAL5_INT, amazon_atm_aal5_isr, IRQF_DISABLED, "tpe_aal5", NULL); + #endif + return &g_atm_dev; + } diff --git a/target/linux/amazon/patches-2.6.30/210-remove_unnedded_variables.patch b/target/linux/amazon/patches-2.6.30/210-remove_unnedded_variables.patch new file mode 100644 index 000000000..c2c7fbd3a --- /dev/null +++ b/target/linux/amazon/patches-2.6.30/210-remove_unnedded_variables.patch @@ -0,0 +1,12 @@ +--- a/arch/mips/amazon/prom.c ++++ b/arch/mips/amazon/prom.c +@@ -59,9 +59,6 @@ void prom_printf(const char * fmt, ...) + + void __init prom_init(void) + { +- mips_machgroup = MACH_GROUP_INFINEON; +- mips_machtype = MACH_INFINEON_AMAZON; +- + strcpy(&(arcs_cmdline[0]), "console=ttyS0,115200 rootfstype=squashfs,jffs2"); + + add_memory_region(0x00000000, 0x1000000, BOOT_MEM_RAM); diff --git a/target/linux/amazon/patches-2.6.30/220-fix_timer.patch b/target/linux/amazon/patches-2.6.30/220-fix_timer.patch new file mode 100644 index 000000000..6408b88f9 --- /dev/null +++ b/target/linux/amazon/patches-2.6.30/220-fix_timer.patch @@ -0,0 +1,93 @@ +--- a/arch/mips/amazon/setup.c ++++ b/arch/mips/amazon/setup.c +@@ -36,6 +36,12 @@ + #include + #include + ++static unsigned int r4k_offset; ++static unsigned int r4k_cur; ++ ++/* required in arch/mips/kernel/kspd.c */ ++unsigned long cpu_khz; ++ + extern void prom_printf(const char * fmt, ...); + static void amazon_reboot_setup(void); + +@@ -91,35 +97,32 @@ unsigned int amazon_get_cpu_ver(void) + return cpu_ver; + } + +-void amazon_time_init(void) ++static inline u32 amazon_get_counter_resolution(void) + { +- mips_hpt_frequency = amazon_get_cpu_hz()/2; +- printk("mips_hpt_frequency:%d\n", mips_hpt_frequency); ++ u32 res; ++ __asm__ __volatile__( ++ ".set push\n" ++ ".set mips32r2\n" ++ ".set noreorder\n" ++ "rdhwr %0, $3\n" ++ "ehb\n" ++ ".set pop\n" ++ : "=&r" (res) ++ : /* no input */ ++ : "memory"); ++ instruction_hazard(); ++ return res; + } + +-extern int hr_time_resolution; +- +-/* ISR GPTU Timer 6 for high resolution timer */ +-static void amazon_timer6_interrupt(int irq, void *dev_id) ++void __init plat_time_init(void) + { +- timer_interrupt(AMAZON_TIMER6_INT, NULL); +-} +- +-static struct irqaction hrt_irqaction = { +- .handler = amazon_timer6_interrupt, +- .flags = IRQF_DISABLED, +- .name = "hrt", +-}; ++ mips_hpt_frequency = amazon_get_cpu_hz() / amazon_get_counter_resolution(); ++ r4k_offset = mips_hpt_frequency / HZ; ++ printk("mips_hpt_frequency:%d\n", mips_hpt_frequency); ++ printk("r4k_offset: %08x(%d)\n", r4k_offset, r4k_offset); + +-/* +- * THe CPU counter for System timer, set to HZ +- * GPTU Timer 6 for high resolution timer, set to hr_time_resolution +- * Also misuse this routine to print out the CPU type and clock. +- */ +-void __init plat_timer_setup(struct irqaction *irq) +-{ +- /* cpu counter for timer interrupts */ +- setup_irq(MIPS_CPU_TIMER_IRQ, irq); ++ r4k_cur = (read_c0_count() + r4k_offset); ++ write_c0_compare(r4k_cur); + + /* enable the timer in the PMU */ + amazon_writel(amazon_readl(AMAZON_PMU_PWDCR)| AMAZON_PMU_PWDCR_GPT|AMAZON_PMU_PWDCR_FPI, AMAZON_PMU_PWDCR); +@@ -147,7 +150,6 @@ void __init plat_mem_setup(void) + } + + amazon_reboot_setup(); +- board_time_init = amazon_time_init; + + //stop reset TPE and DFE + amazon_writel(0, AMAZON_RST_REQ); +--- a/arch/mips/amazon/interrupt.c ++++ b/arch/mips/amazon/interrupt.c +@@ -184,3 +184,10 @@ void __init arch_init_irq(void) + set_irq_chip(i, &amazon_irq_type); + } + } ++ ++void __cpuinit arch_fixup_c0_irqs(void) ++{ ++ /* FIXME: check for CPUID and only do fix for specific chips/versions */ ++ cp0_compare_irq = CP0_LEGACY_COMPARE_IRQ; ++ cp0_perfcount_irq = CP0_LEGACY_PERFCNT_IRQ; ++} diff --git a/target/linux/amazon/patches-2.6.30/230-fix_pci.patch b/target/linux/amazon/patches-2.6.30/230-fix_pci.patch new file mode 100644 index 000000000..84d88dd92 --- /dev/null +++ b/target/linux/amazon/patches-2.6.30/230-fix_pci.patch @@ -0,0 +1,20 @@ +--- a/arch/mips/amazon/pci.c ++++ b/arch/mips/amazon/pci.c +@@ -182,7 +182,7 @@ static struct pci_controller amazon_pci_ + .io_resource = &pci_io_resource + }; + +-int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin) ++int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) + { + switch (slot) { + case 13: +@@ -240,7 +240,7 @@ int pcibios_plat_dev_init(struct pci_dev + return 0; + } + +-int amazon_pci_init(void) ++int __init amazon_pci_init(void) + { + u32 temp_buffer; + diff --git a/target/linux/amazon/patches-2.6.30/240-irq_fix.patch b/target/linux/amazon/patches-2.6.30/240-irq_fix.patch new file mode 100644 index 000000000..151f1b4fc --- /dev/null +++ b/target/linux/amazon/patches-2.6.30/240-irq_fix.patch @@ -0,0 +1,20 @@ +--- a/arch/mips/amazon/interrupt.c ++++ b/arch/mips/amazon/interrupt.c +@@ -177,12 +177,11 @@ void __init arch_init_irq(void) + setup_irq(i, &cascade); + } + +- for (i = INT_NUM_IRQ0; i <= INT_NUM_IM4_IRL31; i++) { +- irq_desc[i].status = IRQ_DISABLED; +- irq_desc[i].action = 0; +- irq_desc[i].depth = 1; +- set_irq_chip(i, &amazon_irq_type); +- } ++ for (i = INT_NUM_IRQ0; i <= INT_NUM_IM4_IRL31; i++) ++ set_irq_chip_and_handler(i, &amazon_irq_type, ++ handle_level_irq); ++ ++ set_c0_status(IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5); + } + + void __cpuinit arch_fixup_c0_irqs(void) From 4b15e7fd78da67313149e38a0d40165b8e288a0f Mon Sep 17 00:00:00 2001 From: hauke Date: Sat, 28 Nov 2009 22:25:26 +0000 Subject: [PATCH 268/288] [kernel] Some build fixes. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18590 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches-2.6.21/024-mips_disable_fpu.patch | 2 +- .../patches-2.6.25/024-mips_disable_fpu.patch | 155 ++++++++++++++++++ .../30-fix_conflicting_getline.patch | 29 ++++ 3 files changed, 185 insertions(+), 1 deletion(-) create mode 100644 target/linux/generic-2.6/patches-2.6.25/024-mips_disable_fpu.patch create mode 100644 target/linux/generic-2.6/patches-2.6.25/30-fix_conflicting_getline.patch diff --git a/target/linux/generic-2.6/patches-2.6.21/024-mips_disable_fpu.patch b/target/linux/generic-2.6/patches-2.6.21/024-mips_disable_fpu.patch index eabc3bfcc..3476d158e 100644 --- a/target/linux/generic-2.6/patches-2.6.21/024-mips_disable_fpu.patch +++ b/target/linux/generic-2.6/patches-2.6.21/024-mips_disable_fpu.patch @@ -135,6 +135,7 @@ Signed-off-by: Florian Fainelli + return 0; +} + ++#ifdef CONFIG_64BIT +int fpu_emulator_save_context32(struct sigcontext32 __user *sc) +{ + return 0; @@ -145,6 +146,5 @@ Signed-off-by: Florian Fainelli + return 0; +} + -+#ifdef CONFIG_64BIT +#endif /* CONFIG_64BIT */ +#endif /* CONFIG_MIPS_FPU_EMU */ diff --git a/target/linux/generic-2.6/patches-2.6.25/024-mips_disable_fpu.patch b/target/linux/generic-2.6/patches-2.6.25/024-mips_disable_fpu.patch new file mode 100644 index 000000000..3dfbec792 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.25/024-mips_disable_fpu.patch @@ -0,0 +1,155 @@ +MIPS: allow disabling the kernel FPU emulator + +This patch allows turning off the in-kernel Algorithmics +FPU emulator support, which allows one to save a couple of +precious blocks on an embedded system. + +Signed-off-by: Florian Fainelli +-- +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -831,6 +831,17 @@ config I8259 + config MIPS_BONITO64 + bool + ++config MIPS_FPU_EMU ++ bool "Enable FPU emulation" ++ default y ++ help ++ This option allows building a kernel with or without the Algorithmics ++ FPU emulator enabled. Turning off this option results in a kernel which ++ does not catch floating operations exceptions. Make sure that your toolchain ++ is configured to enable software floating point emulation in that case. ++ ++ If unsure say Y here. ++ + config MIPS_MSC + bool + +--- a/arch/mips/math-emu/Makefile ++++ b/arch/mips/math-emu/Makefile +@@ -2,12 +2,14 @@ + # Makefile for the Linux/MIPS kernel FPU emulation. + # + +-obj-y := cp1emu.o ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \ ++obj-y := kernel_linkage.o dsemul.o cp1emu.o ++ ++obj-$(CONFIG_MIPS_FPU_EMU) += ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \ + ieee754xcpt.o dp_frexp.o dp_modf.o dp_div.o dp_mul.o dp_sub.o \ + dp_add.o dp_fsp.o dp_cmp.o dp_logb.o dp_scalb.o dp_simple.o \ + dp_tint.o dp_fint.o dp_tlong.o dp_flong.o sp_frexp.o sp_modf.o \ + sp_div.o sp_mul.o sp_sub.o sp_add.o sp_fdp.o sp_cmp.o sp_logb.o \ + sp_scalb.o sp_simple.o sp_tint.o sp_fint.o sp_tlong.o sp_flong.o \ +- dp_sqrt.o sp_sqrt.o kernel_linkage.o dsemul.o ++ dp_sqrt.o sp_sqrt.o + + EXTRA_CFLAGS += -Werror +--- a/arch/mips/math-emu/cp1emu.c ++++ b/arch/mips/math-emu/cp1emu.c +@@ -57,6 +57,12 @@ + #endif + #define __mips 4 + ++/* Further private data for which no space exists in mips_fpu_struct */ ++ ++struct mips_fpu_emulator_stats fpuemustats; ++ ++#ifdef CONFIG_MIPS_FPU_EMU ++ + /* Function which emulates a floating point instruction. */ + + static int fpu_emu(struct pt_regs *, struct mips_fpu_struct *, +@@ -67,10 +73,6 @@ static int fpux_emu(struct pt_regs *, + struct mips_fpu_struct *, mips_instruction); + #endif + +-/* Further private data for which no space exists in mips_fpu_struct */ +- +-struct mips_fpu_emulator_stats fpuemustats; +- + /* Control registers */ + + #define FPCREG_RID 0 /* $0 = revision id */ +@@ -1277,6 +1279,13 @@ int fpu_emulator_cop1Handler(struct pt_r + + return sig; + } ++#else ++int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx, ++ int has_fpu) ++{ ++ return 0; ++} ++#endif /* CONFIG_MIPS_FPU_EMU */ + + #ifdef CONFIG_DEBUG_FS + extern struct dentry *mips_debugfs_dir; +--- a/arch/mips/math-emu/dsemul.c ++++ b/arch/mips/math-emu/dsemul.c +@@ -110,6 +110,7 @@ int mips_dsemul(struct pt_regs *regs, mi + return SIGILL; /* force out of emulation loop */ + } + ++#ifdef CONFIG_MIPS_FPU_EMU + int do_dsemulret(struct pt_regs *xcp) + { + struct emuframe __user *fr; +@@ -166,3 +167,9 @@ int do_dsemulret(struct pt_regs *xcp) + + return 1; + } ++#else ++int do_dsemulret(struct pt_regs *xcp) ++{ ++ return 0; ++} ++#endif /* CONFIG_MIPS_FPU_EMU */ +--- a/arch/mips/math-emu/kernel_linkage.c ++++ b/arch/mips/math-emu/kernel_linkage.c +@@ -28,6 +28,7 @@ + + #define SIGNALLING_NAN 0x7ff800007ff80000LL + ++#ifdef CONFIG_MIPS_FPU_EMU + void fpu_emulator_init_fpu(void) + { + static int first = 1; +@@ -111,4 +112,36 @@ int fpu_emulator_restore_context32(struc + + return err; + } +-#endif ++#endif /* CONFIG_64BIT */ ++#else ++ ++void fpu_emulator_init_fpu(void) ++{ ++ printk(KERN_INFO "FPU emulator disabled, make sure your toolchain" ++ "was compiled with software floating point support (soft-float)\n"); ++ return; ++} ++ ++int fpu_emulator_save_context(struct sigcontext __user *sc) ++{ ++ return 0; ++} ++ ++int fpu_emulator_restore_context(struct sigcontext __user *sc) ++{ ++ return 0; ++} ++ ++#ifdef CONFIG_64BIT ++int fpu_emulator_save_context32(struct sigcontext32 __user *sc) ++{ ++ return 0; ++} ++ ++int fpu_emulator_restore_context32(struct sigcontext32 __user *sc) ++{ ++ return 0; ++} ++ ++#endif /* CONFIG_64BIT */ ++#endif /* CONFIG_MIPS_FPU_EMU */ diff --git a/target/linux/generic-2.6/patches-2.6.25/30-fix_conflicting_getline.patch b/target/linux/generic-2.6/patches-2.6.25/30-fix_conflicting_getline.patch new file mode 100644 index 000000000..0a68134f7 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.25/30-fix_conflicting_getline.patch @@ -0,0 +1,29 @@ +--- a/scripts/unifdef.c ++++ b/scripts/unifdef.c +@@ -206,7 +206,7 @@ static void done(void); + static void error(const char *); + static int findsym(const char *); + static void flushline(bool); +-static Linetype getline(void); ++static Linetype get_line(void); + static Linetype ifeval(const char **); + static void ignoreoff(void); + static void ignoreon(void); +@@ -512,7 +512,7 @@ process(void) + + for (;;) { + linenum++; +- lineval = getline(); ++ lineval = get_line(); + trans_table[ifstate[depth]][lineval](); + debug("process %s -> %s depth %d", + linetype_name[lineval], +@@ -526,7 +526,7 @@ process(void) + * help from skipcomment(). + */ + static Linetype +-getline(void) ++get_line(void) + { + const char *cp; + int cursym; From cc71c84c17692290c6b3aee41066293448cdc505 Mon Sep 17 00:00:00 2001 From: hauke Date: Sat, 28 Nov 2009 23:16:11 +0000 Subject: [PATCH 269/288] [iw] Update iw to version 0.9.18 The deleted patches went upstream. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18591 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/iw/Makefile | 4 +- package/iw/patches/000-upstream.patch | 155 -------------------------- package/iw/patches/100-4addr.patch | 76 ------------- package/iw/patches/110-sta_vlan.patch | 69 ------------ 4 files changed, 2 insertions(+), 302 deletions(-) delete mode 100644 package/iw/patches/000-upstream.patch delete mode 100644 package/iw/patches/100-4addr.patch delete mode 100644 package/iw/patches/110-sta_vlan.patch diff --git a/package/iw/Makefile b/package/iw/Makefile index ce3b4ec48..827413ab4 100644 --- a/package/iw/Makefile +++ b/package/iw/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iw -PKG_VERSION:=0.9.17 +PKG_VERSION:=0.9.18 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://wireless.kernel.org/download/iw/ -PKG_MD5SUM:=427841093ac11c5cbc025a3e13aac139 +PKG_MD5SUM:=9734080d8a5c4b768c5e0da665a48950 PKG_BUILD_DEPENDS:=mac80211 include $(INCLUDE_DIR)/package.mk diff --git a/package/iw/patches/000-upstream.patch b/package/iw/patches/000-upstream.patch deleted file mode 100644 index 8aee7758a..000000000 --- a/package/iw/patches/000-upstream.patch +++ /dev/null @@ -1,155 +0,0 @@ ---- a/Makefile -+++ b/Makefile -@@ -3,7 +3,7 @@ - MAKEFLAGS += --no-print-directory - - PREFIX ?= /usr --BINDIR ?= $(PREFIX)/bin -+SBINDIR ?= $(PREFIX)/sbin - MANDIR ?= $(PREFIX)/share/man - PKG_CONFIG ?= pkg-config - -@@ -85,8 +85,8 @@ check: - - install: iw iw.8.gz - @$(NQ) ' INST iw' -- $(Q)$(MKDIR) $(DESTDIR)$(BINDIR) -- $(Q)$(INSTALL) -m 755 -t $(DESTDIR)$(BINDIR) iw -+ $(Q)$(MKDIR) $(DESTDIR)$(SBINDIR) -+ $(Q)$(INSTALL) -m 755 -t $(DESTDIR)$(SBINDIR) iw - @$(NQ) ' INST iw.8' - $(Q)$(MKDIR) $(DESTDIR)$(MANDIR)/man8/ - $(Q)$(INSTALL) -m 644 -t $(DESTDIR)$(MANDIR)/man8/ iw.8.gz ---- a/iw.c -+++ b/iw.c -@@ -223,9 +223,12 @@ static int phy_lookup(char *name) - if (fd < 0) - return -1; - pos = read(fd, buf, sizeof(buf) - 1); -- if (pos < 0) -+ if (pos < 0) { -+ close(fd); - return -1; -+ } - buf[pos] = '\0'; -+ close(fd); - return atoi(buf); - } - ---- a/nl80211.h -+++ b/nl80211.h -@@ -262,6 +262,9 @@ - * reasons, for this the %NL80211_ATTR_DISCONNECTED_BY_AP and - * %NL80211_ATTR_REASON_CODE attributes are used. - * -+ * @NL80211_CMD_SET_WIPHY_NETNS: Set a wiphy's netns. Note that all devices -+ * associated with this wiphy must be down and will follow. -+ * - * @NL80211_CMD_MAX: highest used command number - * @__NL80211_CMD_AFTER_LAST: internal use - */ -@@ -336,6 +339,8 @@ enum nl80211_commands { - NL80211_CMD_ROAM, - NL80211_CMD_DISCONNECT, - -+ NL80211_CMD_SET_WIPHY_NETNS, -+ - /* add new commands above here */ - - /* used to define NL80211_CMD_MAX below */ -@@ -475,10 +480,6 @@ enum nl80211_commands { - * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz) - * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive - * scanning and include a zero-length SSID (wildcard) for wildcard scan -- * @NL80211_ATTR_SCAN_GENERATION: the scan generation increases whenever the -- * scan result list changes (BSS expired or added) so that applications -- * can verify that they got a single, consistent snapshot (when all dump -- * messages carried the same generation number) - * @NL80211_ATTR_BSS: scan result BSS - * - * @NL80211_ATTR_REG_INITIATOR: indicates who requested the regulatory domain -@@ -573,6 +574,16 @@ enum nl80211_commands { - * and join_ibss(), key information is in a nested attribute each - * with %NL80211_KEY_* sub-attributes - * -+ * @NL80211_ATTR_PID: Process ID of a network namespace. -+ * -+ * @NL80211_ATTR_GENERATION: Used to indicate consistent snapshots for -+ * dumps. This number increases whenever the object list being -+ * dumped changes, and as such userspace can verify that it has -+ * obtained a complete and consistent snapshot by verifying that -+ * all dump messages contain the same generation number. If it -+ * changed then the list changed and the dump should be repeated -+ * completely from scratch. -+ * - * @NL80211_ATTR_MAX: highest attribute number currently defined - * @__NL80211_ATTR_AFTER_LAST: internal use - */ -@@ -644,7 +655,7 @@ enum nl80211_attrs { - - NL80211_ATTR_SCAN_FREQUENCIES, - NL80211_ATTR_SCAN_SSIDS, -- NL80211_ATTR_SCAN_GENERATION, -+ NL80211_ATTR_GENERATION, /* replaces old SCAN_GENERATION */ - NL80211_ATTR_BSS, - - NL80211_ATTR_REG_INITIATOR, -@@ -701,12 +712,17 @@ enum nl80211_attrs { - NL80211_ATTR_KEY, - NL80211_ATTR_KEYS, - -+ NL80211_ATTR_PID, -+ - /* add attributes here, update the policy in nl80211.c */ - - __NL80211_ATTR_AFTER_LAST, - NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 - }; - -+/* source-level API compatibility */ -+#define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION -+ - /* - * Allow user space programs to use #ifdef on new attributes by defining them - * here ---- a/phy.c -+++ b/phy.c -@@ -140,3 +140,27 @@ static int handle_rts(struct nl80211_sta - COMMAND(set, rts, "", - NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_rts, - "Set rts threshold."); -+ -+static int handle_netns(struct nl80211_state *state, -+ struct nl_cb *cb, -+ struct nl_msg *msg, -+ int argc, char **argv) -+{ -+ char *end; -+ -+ if (argc != 1) -+ return 1; -+ -+ NLA_PUT_U32(msg, NL80211_ATTR_PID, -+ strtoul(argv[0], &end, 10)); -+ -+ if (*end != '\0') -+ return 1; -+ -+ return 0; -+ nla_put_failure: -+ return -ENOBUFS; -+} -+COMMAND(set, netns, "", -+ NL80211_CMD_SET_WIPHY_NETNS, 0, CIB_PHY, handle_netns, -+ "Put this wireless device into a different network namespace"); ---- a/station.c -+++ b/station.c -@@ -127,7 +127,7 @@ static int print_sta_handler(struct nl_m - printf("\n\tmesh plid:\t%d", - nla_get_u16(sinfo[NL80211_STA_INFO_PLID])); - if (sinfo[NL80211_STA_INFO_PLINK_STATE]) { -- switch (nla_get_u16(sinfo[NL80211_STA_INFO_PLINK_STATE])) { -+ switch (nla_get_u8(sinfo[NL80211_STA_INFO_PLINK_STATE])) { - case LISTEN: - strcpy(state_name, "LISTEN"); - break; diff --git a/package/iw/patches/100-4addr.patch b/package/iw/patches/100-4addr.patch deleted file mode 100644 index db6b88010..000000000 --- a/package/iw/patches/100-4addr.patch +++ /dev/null @@ -1,76 +0,0 @@ ---- a/interface.c -+++ b/interface.c -@@ -137,6 +137,20 @@ static int get_if_type(int *argc, char * - return 2; - } - -+static int parse_wds_flag(const char *value, struct nl_msg *msg) -+{ -+ if (strcmp(value, "on") == 0) -+ NLA_PUT_U8(msg, NL80211_ATTR_4ADDR, 1); -+ else if (strcmp(value, "off") == 0) -+ NLA_PUT_U8(msg, NL80211_ATTR_4ADDR, 0); -+ else -+ return 1; -+ return 0; -+ -+nla_put_failure: -+ return 1; -+} -+ - static int handle_interface_add(struct nl80211_state *state, - struct nl_cb *cb, - struct nl_msg *msg, -@@ -168,6 +182,15 @@ static int handle_interface_add(struct n - mesh_id = argv[0]; - argc--; - argv++; -+ } else if (strcmp(argv[0], "wds") == 0) { -+ argc--; -+ argv++; -+ if (parse_wds_flag(argv[0], msg)) { -+ fprintf(stderr, "wds error\n"); -+ return 2; -+ } -+ argc--; -+ argv++; - } else if (strcmp(argv[0], "flags") == 0) { - argc--; - argv++; -@@ -192,14 +215,14 @@ static int handle_interface_add(struct n - nla_put_failure: - return -ENOBUFS; - } --COMMAND(interface, add, " type [mesh_id ] [flags *]", -+COMMAND(interface, add, " type [mesh_id ] [wds on|off] [flags *]", - NL80211_CMD_NEW_INTERFACE, 0, CIB_PHY, handle_interface_add, - "Add a new virtual interface with the given configuration.\n" - IFACE_TYPES "\n\n" - "The flags are only used for monitor interfaces, valid flags are:\n" - VALID_FLAGS "\n\n" - "The mesh_id is used only for mesh mode."); --COMMAND(interface, add, " type [mesh_id ] [flags *]", -+COMMAND(interface, add, " type [mesh_id ] [wds on|off] [flags *]", - NL80211_CMD_NEW_INTERFACE, 0, CIB_NETDEV, handle_interface_add, NULL); - - static int handle_interface_del(struct nl80211_state *state, ---- a/nl80211.h -+++ b/nl80211.h -@@ -584,6 +584,8 @@ enum nl80211_commands { - * changed then the list changed and the dump should be repeated - * completely from scratch. - * -+ * @NL80211_ATTR_4ADDR: Use 4-address frames on a virtual interface -+ * - * @NL80211_ATTR_MAX: highest attribute number currently defined - * @__NL80211_ATTR_AFTER_LAST: internal use - */ -@@ -714,6 +716,8 @@ enum nl80211_attrs { - - NL80211_ATTR_PID, - -+ NL80211_ATTR_4ADDR, -+ - /* add attributes here, update the policy in nl80211.c */ - - __NL80211_ATTR_AFTER_LAST, diff --git a/package/iw/patches/110-sta_vlan.patch b/package/iw/patches/110-sta_vlan.patch deleted file mode 100644 index 913c698bb..000000000 --- a/package/iw/patches/110-sta_vlan.patch +++ /dev/null @@ -1,69 +0,0 @@ ---- a/station.c -+++ b/station.c -@@ -196,7 +196,7 @@ COMMAND(station, del, "", - NL80211_CMD_DEL_STATION, 0, CIB_NETDEV, handle_station_get, - "Remove the given station entry (use with caution!)"); - --static int handle_station_set(struct nl80211_state *state, -+static int handle_station_set_plink(struct nl80211_state *state, - struct nl_cb *cb, - struct nl_msg *msg, - int argc, char **argv) -@@ -241,9 +241,56 @@ static int handle_station_set(struct nl8 - return -ENOBUFS; - } - COMMAND(station, set, " plink_action ", -- NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set, -+ NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_plink, - "Set mesh peer link action for this station (peer)."); - -+static int handle_station_set_vlan(struct nl80211_state *state, -+ struct nl_cb *cb, -+ struct nl_msg *msg, -+ int argc, char **argv) -+{ -+ unsigned char mac_addr[ETH_ALEN]; -+ unsigned long sta_vlan = 0; -+ char *err = NULL; -+ -+ if (argc < 3) -+ return 1; -+ -+ if (mac_addr_a2n(mac_addr, argv[0])) { -+ fprintf(stderr, "invalid mac address\n"); -+ return 2; -+ } -+ argc--; -+ argv++; -+ -+ if (strcmp("vlan", argv[0]) != 0) -+ return 1; -+ argc--; -+ argv++; -+ -+ sta_vlan = strtoul(argv[0], &err, 0); -+ if (err && *err) { -+ fprintf(stderr, "invalid vlan id\n"); -+ return 2; -+ } -+ argc--; -+ argv++; -+ -+ if (argc) -+ return 1; -+ -+ NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr); -+ NLA_PUT_U32(msg, NL80211_ATTR_STA_VLAN, sta_vlan); -+ -+ return 0; -+ nla_put_failure: -+ return -ENOBUFS; -+} -+COMMAND(station, set, " vlan ", -+ NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_vlan, -+ "Set an AP VLAN for this station."); -+ -+ - static int handle_station_dump(struct nl80211_state *state, - struct nl_cb *cb, - struct nl_msg *msg, From 9707320079989c662c1079bdefe81c95798b0659 Mon Sep 17 00:00:00 2001 From: hauke Date: Sat, 28 Nov 2009 23:16:40 +0000 Subject: [PATCH 270/288] [crda] Update regulatory database to version 2009.11.25 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18592 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/crda/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/crda/Makefile b/package/crda/Makefile index dc6a9e0cc..402bee53b 100644 --- a/package/crda/Makefile +++ b/package/crda/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=crda -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_VERSION:=1.1.0 PKG_SOURCE_URL:=http://wireless.kernel.org/download/crda PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 @@ -17,10 +17,10 @@ PKG_MD5SUM:=6004584d2e39e899f7642b141dd72028 PKG_BUILD_DEPENDS:=mac80211 PKG_REGULATORY_NAME:=regulatory -PKG_REGULATORY_VERSION:=2009.04.17 +PKG_REGULATORY_VERSION:=2009.11.25 PKG_REGULATORY_SOURCE_URL:=http://wireless.kernel.org/download/wireless-regdb/regulatory.bins PKG_REGULATORY_SOURCE:=$(PKG_REGULATORY_VERSION)-$(PKG_REGULATORY_NAME).bin -PKG_REGULATORY_MD5SUM:=2d7d99b79062b8f2edfbd72222fdfe08 +PKG_REGULATORY_MD5SUM:=873b5c55a26c8ba7674e083f51cb10aa include $(INCLUDE_DIR)/package.mk From 2745ba44b659701075dbcbf3eaab257e53f95830 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 29 Nov 2009 00:31:21 +0000 Subject: [PATCH 271/288] [kernel] revert the 027-mips_module_reloc.patch patch for mips64 targets until we fix it (#6129) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18593 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../cobalt/patches/001-no_module_reloc.patch | 335 ++++++++++++++++++ .../octeon/patches/106-no_module_reloc.patch | 335 ++++++++++++++++++ .../sibyte/patches/106-no_module_reloc.patch | 335 ++++++++++++++++++ 3 files changed, 1005 insertions(+) create mode 100644 target/linux/cobalt/patches/001-no_module_reloc.patch create mode 100644 target/linux/octeon/patches/106-no_module_reloc.patch create mode 100644 target/linux/sibyte/patches/106-no_module_reloc.patch diff --git a/target/linux/cobalt/patches/001-no_module_reloc.patch b/target/linux/cobalt/patches/001-no_module_reloc.patch new file mode 100644 index 000000000..833dea791 --- /dev/null +++ b/target/linux/cobalt/patches/001-no_module_reloc.patch @@ -0,0 +1,335 @@ +diff -urN linux-2.6.30.7/arch/mips/Makefile linux-2.6.30.7.new/arch/mips/Makefile +--- linux-2.6.30.7/arch/mips/Makefile 2009-09-27 13:17:16.000000000 +0200 ++++ linux-2.6.30.7.new/arch/mips/Makefile 2009-09-15 19:46:05.000000000 +0200 +@@ -83,7 +83,7 @@ + cflags-y += -G 0 -mno-abicalls -fno-pic -pipe + cflags-y += -msoft-float + LDFLAGS_vmlinux += -G 0 -static -n -nostdlib +-MODFLAGS += -mno-long-calls ++MODFLAGS += -mlong-calls + + cflags-y += -ffreestanding + +diff -urN linux-2.6.30.7/arch/mips/include/asm/module.h linux-2.6.30.7.new/arch/mips/include/asm/module.h +--- linux-2.6.30.7/arch/mips/include/asm/module.h 2009-09-27 13:17:16.000000000 +0200 ++++ linux-2.6.30.7.new/arch/mips/include/asm/module.h 2009-09-15 19:46:05.000000000 +0200 +@@ -9,11 +9,6 @@ + struct list_head dbe_list; + const struct exception_table_entry *dbe_start; + const struct exception_table_entry *dbe_end; +- +- void *plt_tbl; +- unsigned int core_plt_offset; +- unsigned int core_plt_size; +- unsigned int init_plt_offset; + }; + + typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */ +diff -urN linux-2.6.30.7/arch/mips/kernel/module.c linux-2.6.30.7.new/arch/mips/kernel/module.c +--- linux-2.6.30.7/arch/mips/kernel/module.c 2009-09-27 13:17:16.000000000 +0200 ++++ linux-2.6.30.7.new/arch/mips/kernel/module.c 2009-09-15 19:46:05.000000000 +0200 +@@ -43,116 +43,6 @@ + static LIST_HEAD(dbe_list); + static DEFINE_SPINLOCK(dbe_lock); + +-/* +- * Get the potential max trampolines size required of the init and +- * non-init sections. Only used if we cannot find enough contiguous +- * physically mapped memory to put the module into. +- */ +-static unsigned int +-get_plt_size(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, +- const char *secstrings, unsigned int symindex, bool is_init) +-{ +- unsigned long ret = 0; +- unsigned int i, j; +- Elf_Sym *syms; +- +- /* Everything marked ALLOC (this includes the exported symbols) */ +- for (i = 1; i < hdr->e_shnum; ++i) { +- unsigned int info = sechdrs[i].sh_info; +- +- if (sechdrs[i].sh_type != SHT_REL +- && sechdrs[i].sh_type != SHT_RELA) +- continue; +- +- /* Not a valid relocation section? */ +- if (info >= hdr->e_shnum) +- continue; +- +- /* Don't bother with non-allocated sections */ +- if (!(sechdrs[info].sh_flags & SHF_ALLOC)) +- continue; +- +- /* If it's called *.init*, and we're not init, we're +- not interested */ +- if ((strstr(secstrings + sechdrs[i].sh_name, ".init") != 0) +- != is_init) +- continue; +- +- syms = (Elf_Sym *) sechdrs[symindex].sh_addr; +- if (sechdrs[i].sh_type == SHT_REL) { +- Elf_Mips_Rel *rel = (void *) sechdrs[i].sh_addr; +- unsigned int size = sechdrs[i].sh_size / sizeof(*rel); +- +- for (j = 0; j < size; ++j) { +- Elf_Sym *sym; +- +- if (ELF_MIPS_R_TYPE(rel[j]) != R_MIPS_26) +- continue; +- +- sym = syms + ELF_MIPS_R_SYM(rel[j]); +- if (!is_init && sym->st_shndx != SHN_UNDEF) +- continue; +- +- ret += 4 * sizeof(int); +- } +- } else { +- Elf_Mips_Rela *rela = (void *) sechdrs[i].sh_addr; +- unsigned int size = sechdrs[i].sh_size / sizeof(*rela); +- +- for (j = 0; j < size; ++j) { +- Elf_Sym *sym; +- +- if (ELF_MIPS_R_TYPE(rela[j]) != R_MIPS_26) +- continue; +- +- sym = syms + ELF_MIPS_R_SYM(rela[j]); +- if (!is_init && sym->st_shndx != SHN_UNDEF) +- continue; +- +- ret += 4 * sizeof(int); +- } +- } +- } +- +- return ret; +-} +- +-#ifndef MODULE_START +-static void *alloc_phys(unsigned long size) +-{ +- unsigned order; +- struct page *page; +- struct page *p; +- +- size = PAGE_ALIGN(size); +- order = get_order(size); +- +- page = alloc_pages(GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN | +- __GFP_THISNODE, order); +- if (!page) +- return NULL; +- +- split_page(page, order); +- +- for (p = page + (size >> PAGE_SHIFT); p < page + (1 << order); ++p) +- __free_page(p); +- +- return page_address(page); +-} +-#endif +- +-static void free_phys(void *ptr, unsigned long size) +-{ +- struct page *page; +- struct page *end; +- +- page = virt_to_page(ptr); +- end = page + (PAGE_ALIGN(size) >> PAGE_SHIFT); +- +- for (; page < end; ++page) +- __free_page(page); +-} +- + void *module_alloc(unsigned long size) + { + #ifdef MODULE_START +@@ -168,45 +58,16 @@ + + return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL); + #else +- void *ptr; +- + if (size == 0) + return NULL; +- +- ptr = alloc_phys(size); +- +- /* If we failed to allocate physically contiguous memory, +- * fall back to regular vmalloc. The module loader code will +- * create jump tables to handle long jumps */ +- if (!ptr) +- return vmalloc(size); +- +- return ptr; +-#endif +-} +- +-static inline bool is_phys_addr(void *ptr) +-{ +-#ifdef CONFIG_64BIT +- return (KSEGX((unsigned long)ptr) == CKSEG0); +-#else +- return (KSEGX(ptr) == KSEG0); ++ return vmalloc(size); + #endif + } + + /* Free memory returned from module_alloc */ + void module_free(struct module *mod, void *module_region) + { +- if (is_phys_addr(module_region)) { +- if (mod->module_init == module_region) +- free_phys(module_region, mod->init_size); +- else if (mod->module_core == module_region) +- free_phys(module_region, mod->core_size); +- else +- BUG(); +- } else { +- vfree(module_region); +- } ++ vfree(module_region); + /* FIXME: If module_region == mod->init_region, trim exception + table entries. */ + } +@@ -214,24 +75,6 @@ + int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, + char *secstrings, struct module *mod) + { +- unsigned int symindex = 0; +- unsigned int core_size, init_size; +- int i; +- +- for (i = 1; i < hdr->e_shnum; i++) +- if (sechdrs[i].sh_type == SHT_SYMTAB) +- symindex = i; +- +- core_size = get_plt_size(hdr, sechdrs, secstrings, symindex, false); +- init_size = get_plt_size(hdr, sechdrs, secstrings, symindex, true); +- +- mod->arch.core_plt_offset = 0; +- mod->arch.core_plt_size = core_size; +- mod->arch.init_plt_offset = core_size; +- mod->arch.plt_tbl = kmalloc(core_size + init_size, GFP_KERNEL); +- if (!mod->arch.plt_tbl) +- return -ENOMEM; +- + return 0; + } + +@@ -254,41 +97,27 @@ + return 0; + } + +-static Elf_Addr add_plt_entry_to(unsigned *plt_offset, +- void *start, Elf_Addr v) ++static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v) + { +- unsigned *tramp = start + *plt_offset; +- +- *plt_offset += 4 * sizeof(int); +- +- /* adjust carry for addiu */ +- if (v & 0x00008000) +- v += 0x10000; +- +- tramp[0] = 0x3c190000 | (v >> 16); /* lui t9, hi16 */ +- tramp[1] = 0x27390000 | (v & 0xffff); /* addiu t9, t9, lo16 */ +- tramp[2] = 0x03200008; /* jr t9 */ +- tramp[3] = 0x00000000; /* nop */ +- +- return (Elf_Addr) tramp; +-} ++ if (v % 4) { ++ printk(KERN_ERR "module %s: dangerous relocation\n", me->name); ++ return -ENOEXEC; ++ } + +-static Elf_Addr add_plt_entry(struct module *me, void *location, Elf_Addr v) +-{ +- if (location >= me->module_core && +- location < me->module_core + me->core_size) +- return add_plt_entry_to(&me->arch.core_plt_offset, +- me->arch.plt_tbl, v); ++ if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { ++ printk(KERN_ERR ++ "module %s: relocation overflow\n", ++ me->name); ++ return -ENOEXEC; ++ } + +- if (location >= me->module_init && +- location < me->module_init + me->init_size) +- return add_plt_entry_to(&me->arch.init_plt_offset, +- me->arch.plt_tbl, v); ++ *location = (*location & ~0x03ffffff) | ++ ((*location + (v >> 2)) & 0x03ffffff); + + return 0; + } + +-static int set_r_mips_26(struct module *me, u32 *location, u32 ofs, Elf_Addr v) ++static int apply_r_mips_26_rela(struct module *me, u32 *location, Elf_Addr v) + { + if (v % 4) { + printk(KERN_ERR "module %s: dangerous relocation\n", me->name); +@@ -296,31 +125,17 @@ + } + + if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { +- v = add_plt_entry(me, location, v + (ofs << 2)); +- if (!v) { +- printk(KERN_ERR ++ printk(KERN_ERR + "module %s: relocation overflow\n", + me->name); +- return -ENOEXEC; +- } +- ofs = 0; ++ return -ENOEXEC; + } + +- *location = (*location & ~0x03ffffff) | ((ofs + (v >> 2)) & 0x03ffffff); ++ *location = (*location & ~0x03ffffff) | ((v >> 2) & 0x03ffffff); + + return 0; + } + +-static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v) +-{ +- return set_r_mips_26(me, location, *location & 0x03ffffff, v); +-} +- +-static int apply_r_mips_26_rela(struct module *me, u32 *location, Elf_Addr v) +-{ +- return set_r_mips_26(me, location, 0, v); +-} +- + static int apply_r_mips_hi16_rel(struct module *me, u32 *location, Elf_Addr v) + { + struct mips_hi16 *n; +@@ -585,23 +400,11 @@ + list_add(&me->arch.dbe_list, &dbe_list); + spin_unlock_irq(&dbe_lock); + } +- +- /* Get rid of the fixup trampoline if we're running the module +- * from physically mapped address space */ +- if (me->arch.core_plt_offset == 0 && +- me->arch.init_plt_offset == me->arch.core_plt_size && +- is_phys_addr(me->module_core)) { +- kfree(me->arch.plt_tbl); +- me->arch.plt_tbl = NULL; +- } +- + return 0; + } + + void module_arch_cleanup(struct module *mod) + { +- if (mod->arch.plt_tbl) +- kfree(mod->arch.plt_tbl); + spin_lock_irq(&dbe_lock); + list_del(&mod->arch.dbe_list); + spin_unlock_irq(&dbe_lock); diff --git a/target/linux/octeon/patches/106-no_module_reloc.patch b/target/linux/octeon/patches/106-no_module_reloc.patch new file mode 100644 index 000000000..833dea791 --- /dev/null +++ b/target/linux/octeon/patches/106-no_module_reloc.patch @@ -0,0 +1,335 @@ +diff -urN linux-2.6.30.7/arch/mips/Makefile linux-2.6.30.7.new/arch/mips/Makefile +--- linux-2.6.30.7/arch/mips/Makefile 2009-09-27 13:17:16.000000000 +0200 ++++ linux-2.6.30.7.new/arch/mips/Makefile 2009-09-15 19:46:05.000000000 +0200 +@@ -83,7 +83,7 @@ + cflags-y += -G 0 -mno-abicalls -fno-pic -pipe + cflags-y += -msoft-float + LDFLAGS_vmlinux += -G 0 -static -n -nostdlib +-MODFLAGS += -mno-long-calls ++MODFLAGS += -mlong-calls + + cflags-y += -ffreestanding + +diff -urN linux-2.6.30.7/arch/mips/include/asm/module.h linux-2.6.30.7.new/arch/mips/include/asm/module.h +--- linux-2.6.30.7/arch/mips/include/asm/module.h 2009-09-27 13:17:16.000000000 +0200 ++++ linux-2.6.30.7.new/arch/mips/include/asm/module.h 2009-09-15 19:46:05.000000000 +0200 +@@ -9,11 +9,6 @@ + struct list_head dbe_list; + const struct exception_table_entry *dbe_start; + const struct exception_table_entry *dbe_end; +- +- void *plt_tbl; +- unsigned int core_plt_offset; +- unsigned int core_plt_size; +- unsigned int init_plt_offset; + }; + + typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */ +diff -urN linux-2.6.30.7/arch/mips/kernel/module.c linux-2.6.30.7.new/arch/mips/kernel/module.c +--- linux-2.6.30.7/arch/mips/kernel/module.c 2009-09-27 13:17:16.000000000 +0200 ++++ linux-2.6.30.7.new/arch/mips/kernel/module.c 2009-09-15 19:46:05.000000000 +0200 +@@ -43,116 +43,6 @@ + static LIST_HEAD(dbe_list); + static DEFINE_SPINLOCK(dbe_lock); + +-/* +- * Get the potential max trampolines size required of the init and +- * non-init sections. Only used if we cannot find enough contiguous +- * physically mapped memory to put the module into. +- */ +-static unsigned int +-get_plt_size(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, +- const char *secstrings, unsigned int symindex, bool is_init) +-{ +- unsigned long ret = 0; +- unsigned int i, j; +- Elf_Sym *syms; +- +- /* Everything marked ALLOC (this includes the exported symbols) */ +- for (i = 1; i < hdr->e_shnum; ++i) { +- unsigned int info = sechdrs[i].sh_info; +- +- if (sechdrs[i].sh_type != SHT_REL +- && sechdrs[i].sh_type != SHT_RELA) +- continue; +- +- /* Not a valid relocation section? */ +- if (info >= hdr->e_shnum) +- continue; +- +- /* Don't bother with non-allocated sections */ +- if (!(sechdrs[info].sh_flags & SHF_ALLOC)) +- continue; +- +- /* If it's called *.init*, and we're not init, we're +- not interested */ +- if ((strstr(secstrings + sechdrs[i].sh_name, ".init") != 0) +- != is_init) +- continue; +- +- syms = (Elf_Sym *) sechdrs[symindex].sh_addr; +- if (sechdrs[i].sh_type == SHT_REL) { +- Elf_Mips_Rel *rel = (void *) sechdrs[i].sh_addr; +- unsigned int size = sechdrs[i].sh_size / sizeof(*rel); +- +- for (j = 0; j < size; ++j) { +- Elf_Sym *sym; +- +- if (ELF_MIPS_R_TYPE(rel[j]) != R_MIPS_26) +- continue; +- +- sym = syms + ELF_MIPS_R_SYM(rel[j]); +- if (!is_init && sym->st_shndx != SHN_UNDEF) +- continue; +- +- ret += 4 * sizeof(int); +- } +- } else { +- Elf_Mips_Rela *rela = (void *) sechdrs[i].sh_addr; +- unsigned int size = sechdrs[i].sh_size / sizeof(*rela); +- +- for (j = 0; j < size; ++j) { +- Elf_Sym *sym; +- +- if (ELF_MIPS_R_TYPE(rela[j]) != R_MIPS_26) +- continue; +- +- sym = syms + ELF_MIPS_R_SYM(rela[j]); +- if (!is_init && sym->st_shndx != SHN_UNDEF) +- continue; +- +- ret += 4 * sizeof(int); +- } +- } +- } +- +- return ret; +-} +- +-#ifndef MODULE_START +-static void *alloc_phys(unsigned long size) +-{ +- unsigned order; +- struct page *page; +- struct page *p; +- +- size = PAGE_ALIGN(size); +- order = get_order(size); +- +- page = alloc_pages(GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN | +- __GFP_THISNODE, order); +- if (!page) +- return NULL; +- +- split_page(page, order); +- +- for (p = page + (size >> PAGE_SHIFT); p < page + (1 << order); ++p) +- __free_page(p); +- +- return page_address(page); +-} +-#endif +- +-static void free_phys(void *ptr, unsigned long size) +-{ +- struct page *page; +- struct page *end; +- +- page = virt_to_page(ptr); +- end = page + (PAGE_ALIGN(size) >> PAGE_SHIFT); +- +- for (; page < end; ++page) +- __free_page(page); +-} +- + void *module_alloc(unsigned long size) + { + #ifdef MODULE_START +@@ -168,45 +58,16 @@ + + return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL); + #else +- void *ptr; +- + if (size == 0) + return NULL; +- +- ptr = alloc_phys(size); +- +- /* If we failed to allocate physically contiguous memory, +- * fall back to regular vmalloc. The module loader code will +- * create jump tables to handle long jumps */ +- if (!ptr) +- return vmalloc(size); +- +- return ptr; +-#endif +-} +- +-static inline bool is_phys_addr(void *ptr) +-{ +-#ifdef CONFIG_64BIT +- return (KSEGX((unsigned long)ptr) == CKSEG0); +-#else +- return (KSEGX(ptr) == KSEG0); ++ return vmalloc(size); + #endif + } + + /* Free memory returned from module_alloc */ + void module_free(struct module *mod, void *module_region) + { +- if (is_phys_addr(module_region)) { +- if (mod->module_init == module_region) +- free_phys(module_region, mod->init_size); +- else if (mod->module_core == module_region) +- free_phys(module_region, mod->core_size); +- else +- BUG(); +- } else { +- vfree(module_region); +- } ++ vfree(module_region); + /* FIXME: If module_region == mod->init_region, trim exception + table entries. */ + } +@@ -214,24 +75,6 @@ + int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, + char *secstrings, struct module *mod) + { +- unsigned int symindex = 0; +- unsigned int core_size, init_size; +- int i; +- +- for (i = 1; i < hdr->e_shnum; i++) +- if (sechdrs[i].sh_type == SHT_SYMTAB) +- symindex = i; +- +- core_size = get_plt_size(hdr, sechdrs, secstrings, symindex, false); +- init_size = get_plt_size(hdr, sechdrs, secstrings, symindex, true); +- +- mod->arch.core_plt_offset = 0; +- mod->arch.core_plt_size = core_size; +- mod->arch.init_plt_offset = core_size; +- mod->arch.plt_tbl = kmalloc(core_size + init_size, GFP_KERNEL); +- if (!mod->arch.plt_tbl) +- return -ENOMEM; +- + return 0; + } + +@@ -254,41 +97,27 @@ + return 0; + } + +-static Elf_Addr add_plt_entry_to(unsigned *plt_offset, +- void *start, Elf_Addr v) ++static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v) + { +- unsigned *tramp = start + *plt_offset; +- +- *plt_offset += 4 * sizeof(int); +- +- /* adjust carry for addiu */ +- if (v & 0x00008000) +- v += 0x10000; +- +- tramp[0] = 0x3c190000 | (v >> 16); /* lui t9, hi16 */ +- tramp[1] = 0x27390000 | (v & 0xffff); /* addiu t9, t9, lo16 */ +- tramp[2] = 0x03200008; /* jr t9 */ +- tramp[3] = 0x00000000; /* nop */ +- +- return (Elf_Addr) tramp; +-} ++ if (v % 4) { ++ printk(KERN_ERR "module %s: dangerous relocation\n", me->name); ++ return -ENOEXEC; ++ } + +-static Elf_Addr add_plt_entry(struct module *me, void *location, Elf_Addr v) +-{ +- if (location >= me->module_core && +- location < me->module_core + me->core_size) +- return add_plt_entry_to(&me->arch.core_plt_offset, +- me->arch.plt_tbl, v); ++ if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { ++ printk(KERN_ERR ++ "module %s: relocation overflow\n", ++ me->name); ++ return -ENOEXEC; ++ } + +- if (location >= me->module_init && +- location < me->module_init + me->init_size) +- return add_plt_entry_to(&me->arch.init_plt_offset, +- me->arch.plt_tbl, v); ++ *location = (*location & ~0x03ffffff) | ++ ((*location + (v >> 2)) & 0x03ffffff); + + return 0; + } + +-static int set_r_mips_26(struct module *me, u32 *location, u32 ofs, Elf_Addr v) ++static int apply_r_mips_26_rela(struct module *me, u32 *location, Elf_Addr v) + { + if (v % 4) { + printk(KERN_ERR "module %s: dangerous relocation\n", me->name); +@@ -296,31 +125,17 @@ + } + + if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { +- v = add_plt_entry(me, location, v + (ofs << 2)); +- if (!v) { +- printk(KERN_ERR ++ printk(KERN_ERR + "module %s: relocation overflow\n", + me->name); +- return -ENOEXEC; +- } +- ofs = 0; ++ return -ENOEXEC; + } + +- *location = (*location & ~0x03ffffff) | ((ofs + (v >> 2)) & 0x03ffffff); ++ *location = (*location & ~0x03ffffff) | ((v >> 2) & 0x03ffffff); + + return 0; + } + +-static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v) +-{ +- return set_r_mips_26(me, location, *location & 0x03ffffff, v); +-} +- +-static int apply_r_mips_26_rela(struct module *me, u32 *location, Elf_Addr v) +-{ +- return set_r_mips_26(me, location, 0, v); +-} +- + static int apply_r_mips_hi16_rel(struct module *me, u32 *location, Elf_Addr v) + { + struct mips_hi16 *n; +@@ -585,23 +400,11 @@ + list_add(&me->arch.dbe_list, &dbe_list); + spin_unlock_irq(&dbe_lock); + } +- +- /* Get rid of the fixup trampoline if we're running the module +- * from physically mapped address space */ +- if (me->arch.core_plt_offset == 0 && +- me->arch.init_plt_offset == me->arch.core_plt_size && +- is_phys_addr(me->module_core)) { +- kfree(me->arch.plt_tbl); +- me->arch.plt_tbl = NULL; +- } +- + return 0; + } + + void module_arch_cleanup(struct module *mod) + { +- if (mod->arch.plt_tbl) +- kfree(mod->arch.plt_tbl); + spin_lock_irq(&dbe_lock); + list_del(&mod->arch.dbe_list); + spin_unlock_irq(&dbe_lock); diff --git a/target/linux/sibyte/patches/106-no_module_reloc.patch b/target/linux/sibyte/patches/106-no_module_reloc.patch new file mode 100644 index 000000000..833dea791 --- /dev/null +++ b/target/linux/sibyte/patches/106-no_module_reloc.patch @@ -0,0 +1,335 @@ +diff -urN linux-2.6.30.7/arch/mips/Makefile linux-2.6.30.7.new/arch/mips/Makefile +--- linux-2.6.30.7/arch/mips/Makefile 2009-09-27 13:17:16.000000000 +0200 ++++ linux-2.6.30.7.new/arch/mips/Makefile 2009-09-15 19:46:05.000000000 +0200 +@@ -83,7 +83,7 @@ + cflags-y += -G 0 -mno-abicalls -fno-pic -pipe + cflags-y += -msoft-float + LDFLAGS_vmlinux += -G 0 -static -n -nostdlib +-MODFLAGS += -mno-long-calls ++MODFLAGS += -mlong-calls + + cflags-y += -ffreestanding + +diff -urN linux-2.6.30.7/arch/mips/include/asm/module.h linux-2.6.30.7.new/arch/mips/include/asm/module.h +--- linux-2.6.30.7/arch/mips/include/asm/module.h 2009-09-27 13:17:16.000000000 +0200 ++++ linux-2.6.30.7.new/arch/mips/include/asm/module.h 2009-09-15 19:46:05.000000000 +0200 +@@ -9,11 +9,6 @@ + struct list_head dbe_list; + const struct exception_table_entry *dbe_start; + const struct exception_table_entry *dbe_end; +- +- void *plt_tbl; +- unsigned int core_plt_offset; +- unsigned int core_plt_size; +- unsigned int init_plt_offset; + }; + + typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */ +diff -urN linux-2.6.30.7/arch/mips/kernel/module.c linux-2.6.30.7.new/arch/mips/kernel/module.c +--- linux-2.6.30.7/arch/mips/kernel/module.c 2009-09-27 13:17:16.000000000 +0200 ++++ linux-2.6.30.7.new/arch/mips/kernel/module.c 2009-09-15 19:46:05.000000000 +0200 +@@ -43,116 +43,6 @@ + static LIST_HEAD(dbe_list); + static DEFINE_SPINLOCK(dbe_lock); + +-/* +- * Get the potential max trampolines size required of the init and +- * non-init sections. Only used if we cannot find enough contiguous +- * physically mapped memory to put the module into. +- */ +-static unsigned int +-get_plt_size(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, +- const char *secstrings, unsigned int symindex, bool is_init) +-{ +- unsigned long ret = 0; +- unsigned int i, j; +- Elf_Sym *syms; +- +- /* Everything marked ALLOC (this includes the exported symbols) */ +- for (i = 1; i < hdr->e_shnum; ++i) { +- unsigned int info = sechdrs[i].sh_info; +- +- if (sechdrs[i].sh_type != SHT_REL +- && sechdrs[i].sh_type != SHT_RELA) +- continue; +- +- /* Not a valid relocation section? */ +- if (info >= hdr->e_shnum) +- continue; +- +- /* Don't bother with non-allocated sections */ +- if (!(sechdrs[info].sh_flags & SHF_ALLOC)) +- continue; +- +- /* If it's called *.init*, and we're not init, we're +- not interested */ +- if ((strstr(secstrings + sechdrs[i].sh_name, ".init") != 0) +- != is_init) +- continue; +- +- syms = (Elf_Sym *) sechdrs[symindex].sh_addr; +- if (sechdrs[i].sh_type == SHT_REL) { +- Elf_Mips_Rel *rel = (void *) sechdrs[i].sh_addr; +- unsigned int size = sechdrs[i].sh_size / sizeof(*rel); +- +- for (j = 0; j < size; ++j) { +- Elf_Sym *sym; +- +- if (ELF_MIPS_R_TYPE(rel[j]) != R_MIPS_26) +- continue; +- +- sym = syms + ELF_MIPS_R_SYM(rel[j]); +- if (!is_init && sym->st_shndx != SHN_UNDEF) +- continue; +- +- ret += 4 * sizeof(int); +- } +- } else { +- Elf_Mips_Rela *rela = (void *) sechdrs[i].sh_addr; +- unsigned int size = sechdrs[i].sh_size / sizeof(*rela); +- +- for (j = 0; j < size; ++j) { +- Elf_Sym *sym; +- +- if (ELF_MIPS_R_TYPE(rela[j]) != R_MIPS_26) +- continue; +- +- sym = syms + ELF_MIPS_R_SYM(rela[j]); +- if (!is_init && sym->st_shndx != SHN_UNDEF) +- continue; +- +- ret += 4 * sizeof(int); +- } +- } +- } +- +- return ret; +-} +- +-#ifndef MODULE_START +-static void *alloc_phys(unsigned long size) +-{ +- unsigned order; +- struct page *page; +- struct page *p; +- +- size = PAGE_ALIGN(size); +- order = get_order(size); +- +- page = alloc_pages(GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN | +- __GFP_THISNODE, order); +- if (!page) +- return NULL; +- +- split_page(page, order); +- +- for (p = page + (size >> PAGE_SHIFT); p < page + (1 << order); ++p) +- __free_page(p); +- +- return page_address(page); +-} +-#endif +- +-static void free_phys(void *ptr, unsigned long size) +-{ +- struct page *page; +- struct page *end; +- +- page = virt_to_page(ptr); +- end = page + (PAGE_ALIGN(size) >> PAGE_SHIFT); +- +- for (; page < end; ++page) +- __free_page(page); +-} +- + void *module_alloc(unsigned long size) + { + #ifdef MODULE_START +@@ -168,45 +58,16 @@ + + return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL); + #else +- void *ptr; +- + if (size == 0) + return NULL; +- +- ptr = alloc_phys(size); +- +- /* If we failed to allocate physically contiguous memory, +- * fall back to regular vmalloc. The module loader code will +- * create jump tables to handle long jumps */ +- if (!ptr) +- return vmalloc(size); +- +- return ptr; +-#endif +-} +- +-static inline bool is_phys_addr(void *ptr) +-{ +-#ifdef CONFIG_64BIT +- return (KSEGX((unsigned long)ptr) == CKSEG0); +-#else +- return (KSEGX(ptr) == KSEG0); ++ return vmalloc(size); + #endif + } + + /* Free memory returned from module_alloc */ + void module_free(struct module *mod, void *module_region) + { +- if (is_phys_addr(module_region)) { +- if (mod->module_init == module_region) +- free_phys(module_region, mod->init_size); +- else if (mod->module_core == module_region) +- free_phys(module_region, mod->core_size); +- else +- BUG(); +- } else { +- vfree(module_region); +- } ++ vfree(module_region); + /* FIXME: If module_region == mod->init_region, trim exception + table entries. */ + } +@@ -214,24 +75,6 @@ + int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, + char *secstrings, struct module *mod) + { +- unsigned int symindex = 0; +- unsigned int core_size, init_size; +- int i; +- +- for (i = 1; i < hdr->e_shnum; i++) +- if (sechdrs[i].sh_type == SHT_SYMTAB) +- symindex = i; +- +- core_size = get_plt_size(hdr, sechdrs, secstrings, symindex, false); +- init_size = get_plt_size(hdr, sechdrs, secstrings, symindex, true); +- +- mod->arch.core_plt_offset = 0; +- mod->arch.core_plt_size = core_size; +- mod->arch.init_plt_offset = core_size; +- mod->arch.plt_tbl = kmalloc(core_size + init_size, GFP_KERNEL); +- if (!mod->arch.plt_tbl) +- return -ENOMEM; +- + return 0; + } + +@@ -254,41 +97,27 @@ + return 0; + } + +-static Elf_Addr add_plt_entry_to(unsigned *plt_offset, +- void *start, Elf_Addr v) ++static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v) + { +- unsigned *tramp = start + *plt_offset; +- +- *plt_offset += 4 * sizeof(int); +- +- /* adjust carry for addiu */ +- if (v & 0x00008000) +- v += 0x10000; +- +- tramp[0] = 0x3c190000 | (v >> 16); /* lui t9, hi16 */ +- tramp[1] = 0x27390000 | (v & 0xffff); /* addiu t9, t9, lo16 */ +- tramp[2] = 0x03200008; /* jr t9 */ +- tramp[3] = 0x00000000; /* nop */ +- +- return (Elf_Addr) tramp; +-} ++ if (v % 4) { ++ printk(KERN_ERR "module %s: dangerous relocation\n", me->name); ++ return -ENOEXEC; ++ } + +-static Elf_Addr add_plt_entry(struct module *me, void *location, Elf_Addr v) +-{ +- if (location >= me->module_core && +- location < me->module_core + me->core_size) +- return add_plt_entry_to(&me->arch.core_plt_offset, +- me->arch.plt_tbl, v); ++ if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { ++ printk(KERN_ERR ++ "module %s: relocation overflow\n", ++ me->name); ++ return -ENOEXEC; ++ } + +- if (location >= me->module_init && +- location < me->module_init + me->init_size) +- return add_plt_entry_to(&me->arch.init_plt_offset, +- me->arch.plt_tbl, v); ++ *location = (*location & ~0x03ffffff) | ++ ((*location + (v >> 2)) & 0x03ffffff); + + return 0; + } + +-static int set_r_mips_26(struct module *me, u32 *location, u32 ofs, Elf_Addr v) ++static int apply_r_mips_26_rela(struct module *me, u32 *location, Elf_Addr v) + { + if (v % 4) { + printk(KERN_ERR "module %s: dangerous relocation\n", me->name); +@@ -296,31 +125,17 @@ + } + + if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { +- v = add_plt_entry(me, location, v + (ofs << 2)); +- if (!v) { +- printk(KERN_ERR ++ printk(KERN_ERR + "module %s: relocation overflow\n", + me->name); +- return -ENOEXEC; +- } +- ofs = 0; ++ return -ENOEXEC; + } + +- *location = (*location & ~0x03ffffff) | ((ofs + (v >> 2)) & 0x03ffffff); ++ *location = (*location & ~0x03ffffff) | ((v >> 2) & 0x03ffffff); + + return 0; + } + +-static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v) +-{ +- return set_r_mips_26(me, location, *location & 0x03ffffff, v); +-} +- +-static int apply_r_mips_26_rela(struct module *me, u32 *location, Elf_Addr v) +-{ +- return set_r_mips_26(me, location, 0, v); +-} +- + static int apply_r_mips_hi16_rel(struct module *me, u32 *location, Elf_Addr v) + { + struct mips_hi16 *n; +@@ -585,23 +400,11 @@ + list_add(&me->arch.dbe_list, &dbe_list); + spin_unlock_irq(&dbe_lock); + } +- +- /* Get rid of the fixup trampoline if we're running the module +- * from physically mapped address space */ +- if (me->arch.core_plt_offset == 0 && +- me->arch.init_plt_offset == me->arch.core_plt_size && +- is_phys_addr(me->module_core)) { +- kfree(me->arch.plt_tbl); +- me->arch.plt_tbl = NULL; +- } +- + return 0; + } + + void module_arch_cleanup(struct module *mod) + { +- if (mod->arch.plt_tbl) +- kfree(mod->arch.plt_tbl); + spin_lock_irq(&dbe_lock); + list_del(&mod->arch.dbe_list); + spin_unlock_irq(&dbe_lock); From acdd34f57584fa4563b419a23567a6ced6f4202b Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 29 Nov 2009 00:33:27 +0000 Subject: [PATCH 272/288] [ubicom32] add missing configuration symbols git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18594 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ubicom32/config-2.6.28 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/ubicom32/config-2.6.28 b/target/linux/ubicom32/config-2.6.28 index a3518a082..ff32f092e 100755 --- a/target/linux/ubicom32/config-2.6.28 +++ b/target/linux/ubicom32/config-2.6.28 @@ -100,6 +100,7 @@ CONFIG_LEGACY_PTYS=y CONFIG_LIBCRC32C=y # CONFIG_LINKER_RELAXATION is not set # CONFIG_MISC_DEVICES is not set +# CONFIG_MMC_UBICOM32 is not set # CONFIG_MMU is not set CONFIG_MODULE_FORCE_LOAD=y # CONFIG_MODULE_UNLOAD is not set @@ -139,6 +140,7 @@ CONFIG_SPI_MASTER=y # CONFIG_SPI_SPIDEV is not set CONFIG_SPI_UBICOM32_GPIO=y CONFIG_SPI=y +# CONFIG_SND_UBI32 is not set # CONFIG_STOP_ON_BUG is not set # CONFIG_STOP_ON_TRAP is not set # CONFIG_SYSCTL_SYSCALL_CHECK is not set From bc2a8262e9bd2d5ae7604925f997234b2bc23767 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 29 Nov 2009 00:33:32 +0000 Subject: [PATCH 273/288] [ubicom32] prevent some modules from being built on ubicom32 since they do not compile or link git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18595 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/kernel/modules/block.mk | 2 +- package/kernel/modules/crypto.mk | 2 +- package/kernel/modules/netdevices.mk | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/modules/block.mk b/package/kernel/modules/block.mk index 37c1045ee..cbdf2b3a0 100644 --- a/package/kernel/modules/block.mk +++ b/package/kernel/modules/block.mk @@ -10,7 +10,7 @@ BLOCK_MENU:=Block Devices define KernelPackage/ata-core SUBMENU:=$(BLOCK_MENU) TITLE:=Serial and Parallel ATA support - DEPENDS:=@PCI_SUPPORT @LINUX_2_6 +kmod-scsi-core + DEPENDS:=@PCI_SUPPORT @LINUX_2_6 +kmod-scsi-core @!TARGET_ubicom32 KCONFIG:=CONFIG_ATA FILES:=$(LINUX_DIR)/drivers/ata/libata.$(LINUX_KMOD_SUFFIX) AUTOLOAD:=$(call AutoLoad,21,libata) diff --git a/package/kernel/modules/crypto.mk b/package/kernel/modules/crypto.mk index f75ebe9f8..012b68bef 100644 --- a/package/kernel/modules/crypto.mk +++ b/package/kernel/modules/crypto.mk @@ -108,7 +108,7 @@ $(eval $(call KernelPackage,crypto-hw-geode)) define KernelPackage/crypto-hw-hifn-795x SUBMENU:=$(CRYPTO_MENU) TITLE:=HIFN 795x crypto accelerator - DEPENDS:=+kmod-crypto-core +kmod-crypto-des + DEPENDS:=+kmod-crypto-core +kmod-crypto-des @!TARGET_ubicom32 KCONFIG:= \ CONFIG_CRYPTO_HW=y \ CONFIG_CRYPTO_DEV_HIFN_795X \ diff --git a/package/kernel/modules/netdevices.mk b/package/kernel/modules/netdevices.mk index 6871216ef..f270c7f8e 100644 --- a/package/kernel/modules/netdevices.mk +++ b/package/kernel/modules/netdevices.mk @@ -290,7 +290,7 @@ define KernelPackage/tg3 TITLE:=Broadcom Tigon3 Gigabit Ethernet FILES:=$(LINUX_DIR)/drivers/net/tg3.$(LINUX_KMOD_SUFFIX) KCONFIG:=CONFIG_TIGON3 - DEPENDS:=@LINUX_2_6 +LINUX_2_6_28||LINUX_2_6_30||LINUX_2_6_31:kmod-libphy + DEPENDS:=@LINUX_2_6 +LINUX_2_6_28||LINUX_2_6_30||LINUX_2_6_31:kmod-libphy @!TARGET_ubicom32 SUBMENU:=$(NETWORK_DEVICES_MENU) AUTOLOAD:=$(call AutoLoad,50,tg3) endef From 1ccd78cda735ff94abb33f770d20ff6b74714fa9 Mon Sep 17 00:00:00 2001 From: juhosg Date: Sun, 29 Nov 2009 09:33:50 +0000 Subject: [PATCH 274/288] tools: build old squashfs tools for ar71xx git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18596 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- tools/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/Makefile b/tools/Makefile index e3e26f3c4..f5be9bb5c 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -17,11 +17,13 @@ tools-y += m4 autoconf automake bison pkg-config sed mklibs tools-y += sstrip ipkg-utils genext2fs mtd-utils mkimage tools-y += firmware-utils patch-cmdline quilt yaffs2 ifneq ($(CONFIG_LINUX_2_4)$(CONFIG_LINUX_2_6_21)$(CONFIG_LINUX_2_6_25)$(CONFIG_LINUX_2_6_28),) -tools-y += squashfs lzma-old +tools-y += squashfs lzma-old else +ifneq ($(CONFIG_TARGET_ar71xx),) +tools-y += squashfs lzma-old +endif tools-y += squashfs4 lzma endif - tools-$(CONFIG_CCACHE) += ccache ifdef CONFIG_GCC_USE_GRAPHITE From f5180a42705894d807c42650435164163bb60016 Mon Sep 17 00:00:00 2001 From: hauke Date: Sun, 29 Nov 2009 12:09:42 +0000 Subject: [PATCH 275/288] [brcm47xx] Remove patches already applied in generic and refresh patches. This fixes #6200 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18597 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../brcm47xx/patches-2.6.28/220-bcm5354.patch | 6 +- .../280-activate_ssb_support_in_usb.patch | 16 - .../800-fix_cfe_detection.patch | 2 +- .../810-ssb-add-pmu-support.patch | 823 ------------------ ...4bx-relocation-for-arm-module-loader.patch | 2 +- .../patches-2.6.28/976-ssb_update.patch | 8 + 6 files changed, 13 insertions(+), 844 deletions(-) delete mode 100644 target/linux/brcm47xx/patches-2.6.28/280-activate_ssb_support_in_usb.patch delete mode 100644 target/linux/brcm47xx/patches-2.6.28/810-ssb-add-pmu-support.patch diff --git a/target/linux/brcm47xx/patches-2.6.28/220-bcm5354.patch b/target/linux/brcm47xx/patches-2.6.28/220-bcm5354.patch index a6a5e9519..837bd43e7 100644 --- a/target/linux/brcm47xx/patches-2.6.28/220-bcm5354.patch +++ b/target/linux/brcm47xx/patches-2.6.28/220-bcm5354.patch @@ -1,6 +1,6 @@ --- a/drivers/ssb/driver_chipcommon.c +++ b/drivers/ssb/driver_chipcommon.c -@@ -270,6 +270,8 @@ void ssb_chipco_resume(struct ssb_chipco +@@ -258,6 +258,8 @@ void ssb_chipco_resume(struct ssb_chipco void ssb_chipco_get_clockcpu(struct ssb_chipcommon *cc, u32 *plltype, u32 *n, u32 *m) { @@ -9,7 +9,7 @@ *n = chipco_read32(cc, SSB_CHIPCO_CLOCK_N); *plltype = (cc->capabilities & SSB_CHIPCO_CAP_PLLT); switch (*plltype) { -@@ -293,6 +295,8 @@ void ssb_chipco_get_clockcpu(struct ssb_ +@@ -281,6 +283,8 @@ void ssb_chipco_get_clockcpu(struct ssb_ void ssb_chipco_get_clockcontrol(struct ssb_chipcommon *cc, u32 *plltype, u32 *n, u32 *m) { @@ -31,7 +31,7 @@ } --- a/drivers/ssb/main.c +++ b/drivers/ssb/main.c -@@ -1011,6 +1011,8 @@ u32 ssb_clockspeed(struct ssb_bus *bus) +@@ -1013,6 +1013,8 @@ u32 ssb_clockspeed(struct ssb_bus *bus) if (bus->chip_id == 0x5365) { rate = 100000000; diff --git a/target/linux/brcm47xx/patches-2.6.28/280-activate_ssb_support_in_usb.patch b/target/linux/brcm47xx/patches-2.6.28/280-activate_ssb_support_in_usb.patch deleted file mode 100644 index aeb9d334c..000000000 --- a/target/linux/brcm47xx/patches-2.6.28/280-activate_ssb_support_in_usb.patch +++ /dev/null @@ -1,16 +0,0 @@ -This prevents the options from being delete with make kernel_oldconfig. ---- - drivers/ssb/Kconfig | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/ssb/Kconfig -+++ b/drivers/ssb/Kconfig -@@ -126,6 +126,8 @@ config SSB_DRIVER_MIPS - config SSB_EMBEDDED - bool - depends on SSB_DRIVER_MIPS -+ select USB_EHCI_HCD_SSB if USB_EHCI_HCD -+ select USB_OHCI_HCD_SSB if USB_OHCI_HCD - default y - - config SSB_DRIVER_EXTIF diff --git a/target/linux/brcm47xx/patches-2.6.28/800-fix_cfe_detection.patch b/target/linux/brcm47xx/patches-2.6.28/800-fix_cfe_detection.patch index 6cba54053..c3a8a5738 100644 --- a/target/linux/brcm47xx/patches-2.6.28/800-fix_cfe_detection.patch +++ b/target/linux/brcm47xx/patches-2.6.28/800-fix_cfe_detection.patch @@ -90,7 +90,7 @@ { char buf[CL_SIZE]; -@@ -146,9 +122,12 @@ static __init void prom_init_mem(void) +@@ -154,9 +130,12 @@ static __init void prom_init_mem(void) void __init prom_init(void) { diff --git a/target/linux/brcm47xx/patches-2.6.28/810-ssb-add-pmu-support.patch b/target/linux/brcm47xx/patches-2.6.28/810-ssb-add-pmu-support.patch deleted file mode 100644 index 7ab70aa54..000000000 --- a/target/linux/brcm47xx/patches-2.6.28/810-ssb-add-pmu-support.patch +++ /dev/null @@ -1,823 +0,0 @@ -Sent to mainline on 2009 Feb 03. - -For further modifications, please use separate patch files. This simpifies -keeping track of what is upstream and what is not. Thanks. - ---mb - - ---- a/drivers/ssb/Makefile -+++ b/drivers/ssb/Makefile -@@ -9,6 +9,7 @@ ssb-$(CONFIG_SSB_PCMCIAHOST) += pcmcia. - - # built-in drivers - ssb-y += driver_chipcommon.o -+ssb-y += driver_chipcommon_pmu.o - ssb-$(CONFIG_SSB_DRIVER_MIPS) += driver_mipscore.o - ssb-$(CONFIG_SSB_DRIVER_EXTIF) += driver_extif.o - ssb-$(CONFIG_SSB_DRIVER_PCICORE) += driver_pcicore.o ---- /dev/null -+++ b/drivers/ssb/driver_chipcommon_pmu.c -@@ -0,0 +1,508 @@ -+/* -+ * Sonics Silicon Backplane -+ * Broadcom ChipCommon Power Management Unit driver -+ * -+ * Copyright 2009, Michael Buesch -+ * Copyright 2007, Broadcom Corporation -+ * -+ * Licensed under the GNU/GPL. See COPYING for details. -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include "ssb_private.h" -+ -+static u32 ssb_chipco_pll_read(struct ssb_chipcommon *cc, u32 offset) -+{ -+ chipco_write32(cc, SSB_CHIPCO_PLLCTL_ADDR, offset); -+ return chipco_read32(cc, SSB_CHIPCO_PLLCTL_DATA); -+} -+ -+static void ssb_chipco_pll_write(struct ssb_chipcommon *cc, -+ u32 offset, u32 value) -+{ -+ chipco_write32(cc, SSB_CHIPCO_PLLCTL_ADDR, offset); -+ chipco_write32(cc, SSB_CHIPCO_PLLCTL_DATA, value); -+} -+ -+struct pmu0_plltab_entry { -+ u16 freq; /* Crystal frequency in kHz.*/ -+ u8 xf; /* Crystal frequency value for PMU control */ -+ u8 wb_int; -+ u32 wb_frac; -+}; -+ -+static const struct pmu0_plltab_entry pmu0_plltab[] = { -+ { .freq = 12000, .xf = 1, .wb_int = 73, .wb_frac = 349525, }, -+ { .freq = 13000, .xf = 2, .wb_int = 67, .wb_frac = 725937, }, -+ { .freq = 14400, .xf = 3, .wb_int = 61, .wb_frac = 116508, }, -+ { .freq = 15360, .xf = 4, .wb_int = 57, .wb_frac = 305834, }, -+ { .freq = 16200, .xf = 5, .wb_int = 54, .wb_frac = 336579, }, -+ { .freq = 16800, .xf = 6, .wb_int = 52, .wb_frac = 399457, }, -+ { .freq = 19200, .xf = 7, .wb_int = 45, .wb_frac = 873813, }, -+ { .freq = 19800, .xf = 8, .wb_int = 44, .wb_frac = 466033, }, -+ { .freq = 20000, .xf = 9, .wb_int = 44, .wb_frac = 0, }, -+ { .freq = 25000, .xf = 10, .wb_int = 70, .wb_frac = 419430, }, -+ { .freq = 26000, .xf = 11, .wb_int = 67, .wb_frac = 725937, }, -+ { .freq = 30000, .xf = 12, .wb_int = 58, .wb_frac = 699050, }, -+ { .freq = 38400, .xf = 13, .wb_int = 45, .wb_frac = 873813, }, -+ { .freq = 40000, .xf = 14, .wb_int = 45, .wb_frac = 0, }, -+}; -+#define SSB_PMU0_DEFAULT_XTALFREQ 20000 -+ -+static const struct pmu0_plltab_entry * pmu0_plltab_find_entry(u32 crystalfreq) -+{ -+ const struct pmu0_plltab_entry *e; -+ unsigned int i; -+ -+ for (i = 0; i < ARRAY_SIZE(pmu0_plltab); i++) { -+ e = &pmu0_plltab[i]; -+ if (e->freq == crystalfreq) -+ return e; -+ } -+ -+ return NULL; -+} -+ -+/* Tune the PLL to the crystal speed. crystalfreq is in kHz. */ -+static void ssb_pmu0_pllinit_r0(struct ssb_chipcommon *cc, -+ u32 crystalfreq) -+{ -+ struct ssb_bus *bus = cc->dev->bus; -+ const struct pmu0_plltab_entry *e = NULL; -+ u32 pmuctl, tmp, pllctl; -+ unsigned int i; -+ -+ if ((bus->chip_id == 0x5354) && !crystalfreq) { -+ /* The 5354 crystal freq is 25MHz */ -+ crystalfreq = 25000; -+ } -+ if (crystalfreq) -+ e = pmu0_plltab_find_entry(crystalfreq); -+ if (!e) -+ e = pmu0_plltab_find_entry(SSB_PMU0_DEFAULT_XTALFREQ); -+ BUG_ON(!e); -+ crystalfreq = e->freq; -+ cc->pmu.crystalfreq = e->freq; -+ -+ /* Check if the PLL already is programmed to this frequency. */ -+ pmuctl = chipco_read32(cc, SSB_CHIPCO_PMU_CTL); -+ if (((pmuctl & SSB_CHIPCO_PMU_CTL_XTALFREQ) >> SSB_CHIPCO_PMU_CTL_XTALFREQ_SHIFT) == e->xf) { -+ /* We're already there... */ -+ return; -+ } -+ -+ ssb_printk(KERN_INFO PFX "Programming PLL to %u.%03u MHz\n", -+ (crystalfreq / 1000), (crystalfreq % 1000)); -+ -+ /* First turn the PLL off. */ -+ switch (bus->chip_id) { -+ case 0x4328: -+ chipco_mask32(cc, SSB_CHIPCO_PMU_MINRES_MSK, -+ ~(1 << SSB_PMURES_4328_BB_PLL_PU)); -+ chipco_mask32(cc, SSB_CHIPCO_PMU_MAXRES_MSK, -+ ~(1 << SSB_PMURES_4328_BB_PLL_PU)); -+ break; -+ case 0x5354: -+ chipco_mask32(cc, SSB_CHIPCO_PMU_MINRES_MSK, -+ ~(1 << SSB_PMURES_5354_BB_PLL_PU)); -+ chipco_mask32(cc, SSB_CHIPCO_PMU_MAXRES_MSK, -+ ~(1 << SSB_PMURES_5354_BB_PLL_PU)); -+ break; -+ default: -+ SSB_WARN_ON(1); -+ } -+ for (i = 1500; i; i--) { -+ tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST); -+ if (!(tmp & SSB_CHIPCO_CLKCTLST_HAVEHT)) -+ break; -+ udelay(10); -+ } -+ tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST); -+ if (tmp & SSB_CHIPCO_CLKCTLST_HAVEHT) -+ ssb_printk(KERN_EMERG PFX "Failed to turn the PLL off!\n"); -+ -+ /* Set PDIV in PLL control 0. */ -+ pllctl = ssb_chipco_pll_read(cc, SSB_PMU0_PLLCTL0); -+ if (crystalfreq >= SSB_PMU0_PLLCTL0_PDIV_FREQ) -+ pllctl |= SSB_PMU0_PLLCTL0_PDIV_MSK; -+ else -+ pllctl &= ~SSB_PMU0_PLLCTL0_PDIV_MSK; -+ ssb_chipco_pll_write(cc, SSB_PMU0_PLLCTL0, pllctl); -+ -+ /* Set WILD in PLL control 1. */ -+ pllctl = ssb_chipco_pll_read(cc, SSB_PMU0_PLLCTL1); -+ pllctl &= ~SSB_PMU0_PLLCTL1_STOPMOD; -+ pllctl &= ~(SSB_PMU0_PLLCTL1_WILD_IMSK | SSB_PMU0_PLLCTL1_WILD_FMSK); -+ pllctl |= ((u32)e->wb_int << SSB_PMU0_PLLCTL1_WILD_IMSK_SHIFT) & SSB_PMU0_PLLCTL1_WILD_IMSK; -+ pllctl |= ((u32)e->wb_frac << SSB_PMU0_PLLCTL1_WILD_FMSK_SHIFT) & SSB_PMU0_PLLCTL1_WILD_FMSK; -+ if (e->wb_frac == 0) -+ pllctl |= SSB_PMU0_PLLCTL1_STOPMOD; -+ ssb_chipco_pll_write(cc, SSB_PMU0_PLLCTL1, pllctl); -+ -+ /* Set WILD in PLL control 2. */ -+ pllctl = ssb_chipco_pll_read(cc, SSB_PMU0_PLLCTL2); -+ pllctl &= ~SSB_PMU0_PLLCTL2_WILD_IMSKHI; -+ pllctl |= (((u32)e->wb_int >> 4) << SSB_PMU0_PLLCTL2_WILD_IMSKHI_SHIFT) & SSB_PMU0_PLLCTL2_WILD_IMSKHI; -+ ssb_chipco_pll_write(cc, SSB_PMU0_PLLCTL2, pllctl); -+ -+ /* Set the crystalfrequency and the divisor. */ -+ pmuctl = chipco_read32(cc, SSB_CHIPCO_PMU_CTL); -+ pmuctl &= ~SSB_CHIPCO_PMU_CTL_ILP_DIV; -+ pmuctl |= (((crystalfreq + 127) / 128 - 1) << SSB_CHIPCO_PMU_CTL_ILP_DIV_SHIFT) -+ & SSB_CHIPCO_PMU_CTL_ILP_DIV; -+ pmuctl &= ~SSB_CHIPCO_PMU_CTL_XTALFREQ; -+ pmuctl |= ((u32)e->xf << SSB_CHIPCO_PMU_CTL_XTALFREQ_SHIFT) & SSB_CHIPCO_PMU_CTL_XTALFREQ; -+ chipco_write32(cc, SSB_CHIPCO_PMU_CTL, pmuctl); -+} -+ -+struct pmu1_plltab_entry { -+ u16 freq; /* Crystal frequency in kHz.*/ -+ u8 xf; /* Crystal frequency value for PMU control */ -+ u8 ndiv_int; -+ u32 ndiv_frac; -+ u8 p1div; -+ u8 p2div; -+}; -+ -+static const struct pmu1_plltab_entry pmu1_plltab[] = { -+ { .freq = 12000, .xf = 1, .p1div = 3, .p2div = 22, .ndiv_int = 0x9, .ndiv_frac = 0xFFFFEF, }, -+ { .freq = 13000, .xf = 2, .p1div = 1, .p2div = 6, .ndiv_int = 0xb, .ndiv_frac = 0x483483, }, -+ { .freq = 14400, .xf = 3, .p1div = 1, .p2div = 10, .ndiv_int = 0xa, .ndiv_frac = 0x1C71C7, }, -+ { .freq = 15360, .xf = 4, .p1div = 1, .p2div = 5, .ndiv_int = 0xb, .ndiv_frac = 0x755555, }, -+ { .freq = 16200, .xf = 5, .p1div = 1, .p2div = 10, .ndiv_int = 0x5, .ndiv_frac = 0x6E9E06, }, -+ { .freq = 16800, .xf = 6, .p1div = 1, .p2div = 10, .ndiv_int = 0x5, .ndiv_frac = 0x3CF3CF, }, -+ { .freq = 19200, .xf = 7, .p1div = 1, .p2div = 9, .ndiv_int = 0x5, .ndiv_frac = 0x17B425, }, -+ { .freq = 19800, .xf = 8, .p1div = 1, .p2div = 11, .ndiv_int = 0x4, .ndiv_frac = 0xA57EB, }, -+ { .freq = 20000, .xf = 9, .p1div = 1, .p2div = 11, .ndiv_int = 0x4, .ndiv_frac = 0, }, -+ { .freq = 24000, .xf = 10, .p1div = 3, .p2div = 11, .ndiv_int = 0xa, .ndiv_frac = 0, }, -+ { .freq = 25000, .xf = 11, .p1div = 5, .p2div = 16, .ndiv_int = 0xb, .ndiv_frac = 0, }, -+ { .freq = 26000, .xf = 12, .p1div = 1, .p2div = 2, .ndiv_int = 0x10, .ndiv_frac = 0xEC4EC4, }, -+ { .freq = 30000, .xf = 13, .p1div = 3, .p2div = 8, .ndiv_int = 0xb, .ndiv_frac = 0, }, -+ { .freq = 38400, .xf = 14, .p1div = 1, .p2div = 5, .ndiv_int = 0x4, .ndiv_frac = 0x955555, }, -+ { .freq = 40000, .xf = 15, .p1div = 1, .p2div = 2, .ndiv_int = 0xb, .ndiv_frac = 0, }, -+}; -+ -+#define SSB_PMU1_DEFAULT_XTALFREQ 15360 -+ -+static const struct pmu1_plltab_entry * pmu1_plltab_find_entry(u32 crystalfreq) -+{ -+ const struct pmu1_plltab_entry *e; -+ unsigned int i; -+ -+ for (i = 0; i < ARRAY_SIZE(pmu1_plltab); i++) { -+ e = &pmu1_plltab[i]; -+ if (e->freq == crystalfreq) -+ return e; -+ } -+ -+ return NULL; -+} -+ -+/* Tune the PLL to the crystal speed. crystalfreq is in kHz. */ -+static void ssb_pmu1_pllinit_r0(struct ssb_chipcommon *cc, -+ u32 crystalfreq) -+{ -+ struct ssb_bus *bus = cc->dev->bus; -+ const struct pmu1_plltab_entry *e = NULL; -+ u32 buffer_strength = 0; -+ u32 tmp, pllctl, pmuctl; -+ unsigned int i; -+ -+ if (bus->chip_id == 0x4312) { -+ /* We do not touch the BCM4312 PLL and assume -+ * the default crystal settings work out-of-the-box. */ -+ cc->pmu.crystalfreq = 20000; -+ return; -+ } -+ -+ if (crystalfreq) -+ e = pmu1_plltab_find_entry(crystalfreq); -+ if (!e) -+ e = pmu1_plltab_find_entry(SSB_PMU1_DEFAULT_XTALFREQ); -+ BUG_ON(!e); -+ crystalfreq = e->freq; -+ cc->pmu.crystalfreq = e->freq; -+ -+ /* Check if the PLL already is programmed to this frequency. */ -+ pmuctl = chipco_read32(cc, SSB_CHIPCO_PMU_CTL); -+ if (((pmuctl & SSB_CHIPCO_PMU_CTL_XTALFREQ) >> SSB_CHIPCO_PMU_CTL_XTALFREQ_SHIFT) == e->xf) { -+ /* We're already there... */ -+ return; -+ } -+ -+ ssb_printk(KERN_INFO PFX "Programming PLL to %u.%03u MHz\n", -+ (crystalfreq / 1000), (crystalfreq % 1000)); -+ -+ /* First turn the PLL off. */ -+ switch (bus->chip_id) { -+ case 0x4325: -+ chipco_mask32(cc, SSB_CHIPCO_PMU_MINRES_MSK, -+ ~((1 << SSB_PMURES_4325_BBPLL_PWRSW_PU) | -+ (1 << SSB_PMURES_4325_HT_AVAIL))); -+ chipco_mask32(cc, SSB_CHIPCO_PMU_MAXRES_MSK, -+ ~((1 << SSB_PMURES_4325_BBPLL_PWRSW_PU) | -+ (1 << SSB_PMURES_4325_HT_AVAIL))); -+ /* Adjust the BBPLL to 2 on all channels later. */ -+ buffer_strength = 0x222222; -+ break; -+ default: -+ SSB_WARN_ON(1); -+ } -+ for (i = 1500; i; i--) { -+ tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST); -+ if (!(tmp & SSB_CHIPCO_CLKCTLST_HAVEHT)) -+ break; -+ udelay(10); -+ } -+ tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST); -+ if (tmp & SSB_CHIPCO_CLKCTLST_HAVEHT) -+ ssb_printk(KERN_EMERG PFX "Failed to turn the PLL off!\n"); -+ -+ /* Set p1div and p2div. */ -+ pllctl = ssb_chipco_pll_read(cc, SSB_PMU1_PLLCTL0); -+ pllctl &= ~(SSB_PMU1_PLLCTL0_P1DIV | SSB_PMU1_PLLCTL0_P2DIV); -+ pllctl |= ((u32)e->p1div << SSB_PMU1_PLLCTL0_P1DIV_SHIFT) & SSB_PMU1_PLLCTL0_P1DIV; -+ pllctl |= ((u32)e->p2div << SSB_PMU1_PLLCTL0_P2DIV_SHIFT) & SSB_PMU1_PLLCTL0_P2DIV; -+ ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL0, pllctl); -+ -+ /* Set ndiv int and ndiv mode */ -+ pllctl = ssb_chipco_pll_read(cc, SSB_PMU1_PLLCTL2); -+ pllctl &= ~(SSB_PMU1_PLLCTL2_NDIVINT | SSB_PMU1_PLLCTL2_NDIVMODE); -+ pllctl |= ((u32)e->ndiv_int << SSB_PMU1_PLLCTL2_NDIVINT_SHIFT) & SSB_PMU1_PLLCTL2_NDIVINT; -+ pllctl |= (1 << SSB_PMU1_PLLCTL2_NDIVMODE_SHIFT) & SSB_PMU1_PLLCTL2_NDIVMODE; -+ ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL2, pllctl); -+ -+ /* Set ndiv frac */ -+ pllctl = ssb_chipco_pll_read(cc, SSB_PMU1_PLLCTL3); -+ pllctl &= ~SSB_PMU1_PLLCTL3_NDIVFRAC; -+ pllctl |= ((u32)e->ndiv_frac << SSB_PMU1_PLLCTL3_NDIVFRAC_SHIFT) & SSB_PMU1_PLLCTL3_NDIVFRAC; -+ ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL3, pllctl); -+ -+ /* Change the drive strength, if required. */ -+ if (buffer_strength) { -+ pllctl = ssb_chipco_pll_read(cc, SSB_PMU1_PLLCTL5); -+ pllctl &= ~SSB_PMU1_PLLCTL5_CLKDRV; -+ pllctl |= (buffer_strength << SSB_PMU1_PLLCTL5_CLKDRV_SHIFT) & SSB_PMU1_PLLCTL5_CLKDRV; -+ ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL5, pllctl); -+ } -+ -+ /* Tune the crystalfreq and the divisor. */ -+ pmuctl = chipco_read32(cc, SSB_CHIPCO_PMU_CTL); -+ pmuctl &= ~(SSB_CHIPCO_PMU_CTL_ILP_DIV | SSB_CHIPCO_PMU_CTL_XTALFREQ); -+ pmuctl |= ((((u32)e->freq + 127) / 128 - 1) << SSB_CHIPCO_PMU_CTL_ILP_DIV_SHIFT) -+ & SSB_CHIPCO_PMU_CTL_ILP_DIV; -+ pmuctl |= ((u32)e->xf << SSB_CHIPCO_PMU_CTL_XTALFREQ_SHIFT) & SSB_CHIPCO_PMU_CTL_XTALFREQ; -+ chipco_write32(cc, SSB_CHIPCO_PMU_CTL, pmuctl); -+} -+ -+static void ssb_pmu_pll_init(struct ssb_chipcommon *cc) -+{ -+ struct ssb_bus *bus = cc->dev->bus; -+ u32 crystalfreq = 0; /* in kHz. 0 = keep default freq. */ -+ -+ if (bus->bustype == SSB_BUSTYPE_SSB) { -+ /* TODO: The user may override the crystal frequency. */ -+ } -+ -+ switch (bus->chip_id) { -+ case 0x4312: -+ case 0x4325: -+ ssb_pmu1_pllinit_r0(cc, crystalfreq); -+ break; -+ case 0x4328: -+ case 0x5354: -+ ssb_pmu0_pllinit_r0(cc, crystalfreq); -+ break; -+ default: -+ ssb_printk(KERN_ERR PFX -+ "ERROR: PLL init unknown for device %04X\n", -+ bus->chip_id); -+ } -+} -+ -+struct pmu_res_updown_tab_entry { -+ u8 resource; /* The resource number */ -+ u16 updown; /* The updown value */ -+}; -+ -+enum pmu_res_depend_tab_task { -+ PMU_RES_DEP_SET = 1, -+ PMU_RES_DEP_ADD, -+ PMU_RES_DEP_REMOVE, -+}; -+ -+struct pmu_res_depend_tab_entry { -+ u8 resource; /* The resource number */ -+ u8 task; /* SET | ADD | REMOVE */ -+ u32 depend; /* The depend mask */ -+}; -+ -+static const struct pmu_res_updown_tab_entry pmu_res_updown_tab_4328a0[] = { -+ { .resource = SSB_PMURES_4328_EXT_SWITCHER_PWM, .updown = 0x0101, }, -+ { .resource = SSB_PMURES_4328_BB_SWITCHER_PWM, .updown = 0x1F01, }, -+ { .resource = SSB_PMURES_4328_BB_SWITCHER_BURST, .updown = 0x010F, }, -+ { .resource = SSB_PMURES_4328_BB_EXT_SWITCHER_BURST, .updown = 0x0101, }, -+ { .resource = SSB_PMURES_4328_ILP_REQUEST, .updown = 0x0202, }, -+ { .resource = SSB_PMURES_4328_RADIO_SWITCHER_PWM, .updown = 0x0F01, }, -+ { .resource = SSB_PMURES_4328_RADIO_SWITCHER_BURST, .updown = 0x0F01, }, -+ { .resource = SSB_PMURES_4328_ROM_SWITCH, .updown = 0x0101, }, -+ { .resource = SSB_PMURES_4328_PA_REF_LDO, .updown = 0x0F01, }, -+ { .resource = SSB_PMURES_4328_RADIO_LDO, .updown = 0x0F01, }, -+ { .resource = SSB_PMURES_4328_AFE_LDO, .updown = 0x0F01, }, -+ { .resource = SSB_PMURES_4328_PLL_LDO, .updown = 0x0F01, }, -+ { .resource = SSB_PMURES_4328_BG_FILTBYP, .updown = 0x0101, }, -+ { .resource = SSB_PMURES_4328_TX_FILTBYP, .updown = 0x0101, }, -+ { .resource = SSB_PMURES_4328_RX_FILTBYP, .updown = 0x0101, }, -+ { .resource = SSB_PMURES_4328_XTAL_PU, .updown = 0x0101, }, -+ { .resource = SSB_PMURES_4328_XTAL_EN, .updown = 0xA001, }, -+ { .resource = SSB_PMURES_4328_BB_PLL_FILTBYP, .updown = 0x0101, }, -+ { .resource = SSB_PMURES_4328_RF_PLL_FILTBYP, .updown = 0x0101, }, -+ { .resource = SSB_PMURES_4328_BB_PLL_PU, .updown = 0x0701, }, -+}; -+ -+static const struct pmu_res_depend_tab_entry pmu_res_depend_tab_4328a0[] = { -+ { -+ /* Adjust ILP Request to avoid forcing EXT/BB into burst mode. */ -+ .resource = SSB_PMURES_4328_ILP_REQUEST, -+ .task = PMU_RES_DEP_SET, -+ .depend = ((1 << SSB_PMURES_4328_EXT_SWITCHER_PWM) | -+ (1 << SSB_PMURES_4328_BB_SWITCHER_PWM)), -+ }, -+}; -+ -+static const struct pmu_res_updown_tab_entry pmu_res_updown_tab_4325a0[] = { -+ { .resource = SSB_PMURES_4325_XTAL_PU, .updown = 0x1501, }, -+}; -+ -+static const struct pmu_res_depend_tab_entry pmu_res_depend_tab_4325a0[] = { -+ { -+ /* Adjust HT-Available dependencies. */ -+ .resource = SSB_PMURES_4325_HT_AVAIL, -+ .task = PMU_RES_DEP_ADD, -+ .depend = ((1 << SSB_PMURES_4325_RX_PWRSW_PU) | -+ (1 << SSB_PMURES_4325_TX_PWRSW_PU) | -+ (1 << SSB_PMURES_4325_LOGEN_PWRSW_PU) | -+ (1 << SSB_PMURES_4325_AFE_PWRSW_PU)), -+ }, -+}; -+ -+static void ssb_pmu_resources_init(struct ssb_chipcommon *cc) -+{ -+ struct ssb_bus *bus = cc->dev->bus; -+ u32 min_msk = 0, max_msk = 0; -+ unsigned int i; -+ const struct pmu_res_updown_tab_entry *updown_tab = NULL; -+ unsigned int updown_tab_size; -+ const struct pmu_res_depend_tab_entry *depend_tab = NULL; -+ unsigned int depend_tab_size; -+ -+ switch (bus->chip_id) { -+ case 0x4312: -+ /* We keep the default settings: -+ * min_msk = 0xCBB -+ * max_msk = 0x7FFFF -+ */ -+ break; -+ case 0x4325: -+ /* Power OTP down later. */ -+ min_msk = (1 << SSB_PMURES_4325_CBUCK_BURST) | -+ (1 << SSB_PMURES_4325_LNLDO2_PU); -+ if (chipco_read32(cc, SSB_CHIPCO_CHIPSTAT) & -+ SSB_CHIPCO_CHST_4325_PMUTOP_2B) -+ min_msk |= (1 << SSB_PMURES_4325_CLDO_CBUCK_BURST); -+ /* The PLL may turn on, if it decides so. */ -+ max_msk = 0xFFFFF; -+ updown_tab = pmu_res_updown_tab_4325a0; -+ updown_tab_size = ARRAY_SIZE(pmu_res_updown_tab_4325a0); -+ depend_tab = pmu_res_depend_tab_4325a0; -+ depend_tab_size = ARRAY_SIZE(pmu_res_depend_tab_4325a0); -+ break; -+ case 0x4328: -+ min_msk = (1 << SSB_PMURES_4328_EXT_SWITCHER_PWM) | -+ (1 << SSB_PMURES_4328_BB_SWITCHER_PWM) | -+ (1 << SSB_PMURES_4328_XTAL_EN); -+ /* The PLL may turn on, if it decides so. */ -+ max_msk = 0xFFFFF; -+ updown_tab = pmu_res_updown_tab_4328a0; -+ updown_tab_size = ARRAY_SIZE(pmu_res_updown_tab_4328a0); -+ depend_tab = pmu_res_depend_tab_4328a0; -+ depend_tab_size = ARRAY_SIZE(pmu_res_depend_tab_4328a0); -+ break; -+ case 0x5354: -+ /* The PLL may turn on, if it decides so. */ -+ max_msk = 0xFFFFF; -+ break; -+ default: -+ ssb_printk(KERN_ERR PFX -+ "ERROR: PMU resource config unknown for device %04X\n", -+ bus->chip_id); -+ } -+ -+ if (updown_tab) { -+ for (i = 0; i < updown_tab_size; i++) { -+ chipco_write32(cc, SSB_CHIPCO_PMU_RES_TABSEL, -+ updown_tab[i].resource); -+ chipco_write32(cc, SSB_CHIPCO_PMU_RES_UPDNTM, -+ updown_tab[i].updown); -+ } -+ } -+ if (depend_tab) { -+ for (i = 0; i < depend_tab_size; i++) { -+ chipco_write32(cc, SSB_CHIPCO_PMU_RES_TABSEL, -+ depend_tab[i].resource); -+ switch (depend_tab[i].task) { -+ case PMU_RES_DEP_SET: -+ chipco_write32(cc, SSB_CHIPCO_PMU_RES_DEPMSK, -+ depend_tab[i].depend); -+ break; -+ case PMU_RES_DEP_ADD: -+ chipco_set32(cc, SSB_CHIPCO_PMU_RES_DEPMSK, -+ depend_tab[i].depend); -+ break; -+ case PMU_RES_DEP_REMOVE: -+ chipco_mask32(cc, SSB_CHIPCO_PMU_RES_DEPMSK, -+ ~(depend_tab[i].depend)); -+ break; -+ default: -+ SSB_WARN_ON(1); -+ } -+ } -+ } -+ -+ /* Set the resource masks. */ -+ if (min_msk) -+ chipco_write32(cc, SSB_CHIPCO_PMU_MINRES_MSK, min_msk); -+ if (max_msk) -+ chipco_write32(cc, SSB_CHIPCO_PMU_MAXRES_MSK, max_msk); -+} -+ -+void ssb_pmu_init(struct ssb_chipcommon *cc) -+{ -+ struct ssb_bus *bus = cc->dev->bus; -+ u32 pmucap; -+ -+ if (!(cc->capabilities & SSB_CHIPCO_CAP_PMU)) -+ return; -+ -+ pmucap = chipco_read32(cc, SSB_CHIPCO_PMU_CAP); -+ cc->pmu.rev = (pmucap & SSB_CHIPCO_PMU_CAP_REVISION); -+ -+ ssb_dprintk(KERN_DEBUG PFX "Found rev %u PMU (capabilities 0x%08X)\n", -+ cc->pmu.rev, pmucap); -+ -+ if (cc->pmu.rev >= 1) { -+ if ((bus->chip_id == 0x4325) && (bus->chip_rev < 2)) { -+ chipco_mask32(cc, SSB_CHIPCO_PMU_CTL, -+ ~SSB_CHIPCO_PMU_CTL_NOILPONW); -+ } else { -+ chipco_set32(cc, SSB_CHIPCO_PMU_CTL, -+ SSB_CHIPCO_PMU_CTL_NOILPONW); -+ } -+ } -+ ssb_pmu_pll_init(cc); -+ ssb_pmu_resources_init(cc); -+} ---- a/drivers/ssb/driver_chipcommon.c -+++ b/drivers/ssb/driver_chipcommon.c -@@ -26,19 +26,6 @@ enum ssb_clksrc { - }; - - --static inline u32 chipco_read32(struct ssb_chipcommon *cc, -- u16 offset) --{ -- return ssb_read32(cc->dev, offset); --} -- --static inline void chipco_write32(struct ssb_chipcommon *cc, -- u16 offset, -- u32 value) --{ -- ssb_write32(cc->dev, offset, value); --} -- - static inline u32 chipco_write32_masked(struct ssb_chipcommon *cc, u16 offset, - u32 mask, u32 value) - { -@@ -246,6 +233,7 @@ void ssb_chipcommon_init(struct ssb_chip - { - if (!cc->dev) - return; /* We don't have a ChipCommon */ -+ ssb_pmu_init(cc); - chipco_powercontrol_init(cc); - ssb_chipco_set_clockmode(cc, SSB_CLKMODE_FAST); - calc_fast_powerup_delay(cc); ---- a/include/linux/ssb/ssb_driver_chipcommon.h -+++ b/include/linux/ssb/ssb_driver_chipcommon.h -@@ -181,6 +181,16 @@ - #define SSB_CHIPCO_PROG_WAITCNT 0x0124 - #define SSB_CHIPCO_FLASH_CFG 0x0128 - #define SSB_CHIPCO_FLASH_WAITCNT 0x012C -+#define SSB_CHIPCO_CLKCTLST 0x01E0 /* Clock control and status (rev >= 20) */ -+#define SSB_CHIPCO_CLKCTLST_FORCEALP 0x00000001 /* Force ALP request */ -+#define SSB_CHIPCO_CLKCTLST_FORCEHT 0x00000002 /* Force HT request */ -+#define SSB_CHIPCO_CLKCTLST_FORCEILP 0x00000004 /* Force ILP request */ -+#define SSB_CHIPCO_CLKCTLST_HAVEALPREQ 0x00000008 /* ALP available request */ -+#define SSB_CHIPCO_CLKCTLST_HAVEHTREQ 0x00000010 /* HT available request */ -+#define SSB_CHIPCO_CLKCTLST_HWCROFF 0x00000020 /* Force HW clock request off */ -+#define SSB_CHIPCO_CLKCTLST_HAVEHT 0x00010000 /* HT available */ -+#define SSB_CHIPCO_CLKCTLST_HAVEALP 0x00020000 /* APL available */ -+#define SSB_CHIPCO_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */ - #define SSB_CHIPCO_UART0_DATA 0x0300 - #define SSB_CHIPCO_UART0_IMR 0x0304 - #define SSB_CHIPCO_UART0_FCR 0x0308 -@@ -197,6 +207,196 @@ - #define SSB_CHIPCO_UART1_LSR 0x0414 - #define SSB_CHIPCO_UART1_MSR 0x0418 - #define SSB_CHIPCO_UART1_SCRATCH 0x041C -+/* PMU registers (rev >= 20) */ -+#define SSB_CHIPCO_PMU_CTL 0x0600 /* PMU control */ -+#define SSB_CHIPCO_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */ -+#define SSB_CHIPCO_PMU_CTL_ILP_DIV_SHIFT 16 -+#define SSB_CHIPCO_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */ -+#define SSB_CHIPCO_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */ -+#define SSB_CHIPCO_PMU_CTL_ALPREQEN 0x00000080 /* ALP req enable */ -+#define SSB_CHIPCO_PMU_CTL_XTALFREQ 0x0000007C /* Crystal freq */ -+#define SSB_CHIPCO_PMU_CTL_XTALFREQ_SHIFT 2 -+#define SSB_CHIPCO_PMU_CTL_ILPDIVEN 0x00000002 /* ILP div enable */ -+#define SSB_CHIPCO_PMU_CTL_LPOSEL 0x00000001 /* LPO sel */ -+#define SSB_CHIPCO_PMU_CAP 0x0604 /* PMU capabilities */ -+#define SSB_CHIPCO_PMU_CAP_REVISION 0x000000FF /* Revision mask */ -+#define SSB_CHIPCO_PMU_STAT 0x0608 /* PMU status */ -+#define SSB_CHIPCO_PMU_STAT_INTPEND 0x00000040 /* Interrupt pending */ -+#define SSB_CHIPCO_PMU_STAT_SBCLKST 0x00000030 /* Backplane clock status? */ -+#define SSB_CHIPCO_PMU_STAT_HAVEALP 0x00000008 /* ALP available */ -+#define SSB_CHIPCO_PMU_STAT_HAVEHT 0x00000004 /* HT available */ -+#define SSB_CHIPCO_PMU_STAT_RESINIT 0x00000003 /* Res init */ -+#define SSB_CHIPCO_PMU_RES_STAT 0x060C /* PMU res status */ -+#define SSB_CHIPCO_PMU_RES_PEND 0x0610 /* PMU res pending */ -+#define SSB_CHIPCO_PMU_TIMER 0x0614 /* PMU timer */ -+#define SSB_CHIPCO_PMU_MINRES_MSK 0x0618 /* PMU min res mask */ -+#define SSB_CHIPCO_PMU_MAXRES_MSK 0x061C /* PMU max res mask */ -+#define SSB_CHIPCO_PMU_RES_TABSEL 0x0620 /* PMU res table sel */ -+#define SSB_CHIPCO_PMU_RES_DEPMSK 0x0624 /* PMU res dep mask */ -+#define SSB_CHIPCO_PMU_RES_UPDNTM 0x0628 /* PMU res updown timer */ -+#define SSB_CHIPCO_PMU_RES_TIMER 0x062C /* PMU res timer */ -+#define SSB_CHIPCO_PMU_CLKSTRETCH 0x0630 /* PMU clockstretch */ -+#define SSB_CHIPCO_PMU_WATCHDOG 0x0634 /* PMU watchdog */ -+#define SSB_CHIPCO_PMU_RES_REQTS 0x0640 /* PMU res req timer sel */ -+#define SSB_CHIPCO_PMU_RES_REQT 0x0644 /* PMU res req timer */ -+#define SSB_CHIPCO_PMU_RES_REQM 0x0648 /* PMU res req mask */ -+#define SSB_CHIPCO_CHIPCTL_ADDR 0x0650 -+#define SSB_CHIPCO_CHIPCTL_DATA 0x0654 -+#define SSB_CHIPCO_REGCTL_ADDR 0x0658 -+#define SSB_CHIPCO_REGCTL_DATA 0x065C -+#define SSB_CHIPCO_PLLCTL_ADDR 0x0660 -+#define SSB_CHIPCO_PLLCTL_DATA 0x0664 -+ -+ -+ -+/** PMU PLL registers */ -+ -+/* PMU rev 0 PLL registers */ -+#define SSB_PMU0_PLLCTL0 0 -+#define SSB_PMU0_PLLCTL0_PDIV_MSK 0x00000001 -+#define SSB_PMU0_PLLCTL0_PDIV_FREQ 25000 /* kHz */ -+#define SSB_PMU0_PLLCTL1 1 -+#define SSB_PMU0_PLLCTL1_WILD_IMSK 0xF0000000 /* Wild int mask (low nibble) */ -+#define SSB_PMU0_PLLCTL1_WILD_IMSK_SHIFT 28 -+#define SSB_PMU0_PLLCTL1_WILD_FMSK 0x0FFFFF00 /* Wild frac mask */ -+#define SSB_PMU0_PLLCTL1_WILD_FMSK_SHIFT 8 -+#define SSB_PMU0_PLLCTL1_STOPMOD 0x00000040 /* Stop mod */ -+#define SSB_PMU0_PLLCTL2 2 -+#define SSB_PMU0_PLLCTL2_WILD_IMSKHI 0x0000000F /* Wild int mask (high nibble) */ -+#define SSB_PMU0_PLLCTL2_WILD_IMSKHI_SHIFT 0 -+ -+/* PMU rev 1 PLL registers */ -+#define SSB_PMU1_PLLCTL0 0 -+#define SSB_PMU1_PLLCTL0_P1DIV 0x00F00000 /* P1 div */ -+#define SSB_PMU1_PLLCTL0_P1DIV_SHIFT 20 -+#define SSB_PMU1_PLLCTL0_P2DIV 0x0F000000 /* P2 div */ -+#define SSB_PMU1_PLLCTL0_P2DIV_SHIFT 24 -+#define SSB_PMU1_PLLCTL1 1 -+#define SSB_PMU1_PLLCTL1_M1DIV 0x000000FF /* M1 div */ -+#define SSB_PMU1_PLLCTL1_M1DIV_SHIFT 0 -+#define SSB_PMU1_PLLCTL1_M2DIV 0x0000FF00 /* M2 div */ -+#define SSB_PMU1_PLLCTL1_M2DIV_SHIFT 8 -+#define SSB_PMU1_PLLCTL1_M3DIV 0x00FF0000 /* M3 div */ -+#define SSB_PMU1_PLLCTL1_M3DIV_SHIFT 16 -+#define SSB_PMU1_PLLCTL1_M4DIV 0xFF000000 /* M4 div */ -+#define SSB_PMU1_PLLCTL1_M4DIV_SHIFT 24 -+#define SSB_PMU1_PLLCTL2 2 -+#define SSB_PMU1_PLLCTL2_M5DIV 0x000000FF /* M5 div */ -+#define SSB_PMU1_PLLCTL2_M5DIV_SHIFT 0 -+#define SSB_PMU1_PLLCTL2_M6DIV 0x0000FF00 /* M6 div */ -+#define SSB_PMU1_PLLCTL2_M6DIV_SHIFT 8 -+#define SSB_PMU1_PLLCTL2_NDIVMODE 0x000E0000 /* NDIV mode */ -+#define SSB_PMU1_PLLCTL2_NDIVMODE_SHIFT 17 -+#define SSB_PMU1_PLLCTL2_NDIVINT 0x1FF00000 /* NDIV int */ -+#define SSB_PMU1_PLLCTL2_NDIVINT_SHIFT 20 -+#define SSB_PMU1_PLLCTL3 3 -+#define SSB_PMU1_PLLCTL3_NDIVFRAC 0x00FFFFFF /* NDIV frac */ -+#define SSB_PMU1_PLLCTL3_NDIVFRAC_SHIFT 0 -+#define SSB_PMU1_PLLCTL4 4 -+#define SSB_PMU1_PLLCTL5 5 -+#define SSB_PMU1_PLLCTL5_CLKDRV 0xFFFFFF00 /* clk drv */ -+#define SSB_PMU1_PLLCTL5_CLKDRV_SHIFT 8 -+ -+/* BCM4312 PLL resource numbers. */ -+#define SSB_PMURES_4312_SWITCHER_BURST 0 -+#define SSB_PMURES_4312_SWITCHER_PWM 1 -+#define SSB_PMURES_4312_PA_REF_LDO 2 -+#define SSB_PMURES_4312_CORE_LDO_BURST 3 -+#define SSB_PMURES_4312_CORE_LDO_PWM 4 -+#define SSB_PMURES_4312_RADIO_LDO 5 -+#define SSB_PMURES_4312_ILP_REQUEST 6 -+#define SSB_PMURES_4312_BG_FILTBYP 7 -+#define SSB_PMURES_4312_TX_FILTBYP 8 -+#define SSB_PMURES_4312_RX_FILTBYP 9 -+#define SSB_PMURES_4312_XTAL_PU 10 -+#define SSB_PMURES_4312_ALP_AVAIL 11 -+#define SSB_PMURES_4312_BB_PLL_FILTBYP 12 -+#define SSB_PMURES_4312_RF_PLL_FILTBYP 13 -+#define SSB_PMURES_4312_HT_AVAIL 14 -+ -+/* BCM4325 PLL resource numbers. */ -+#define SSB_PMURES_4325_BUCK_BOOST_BURST 0 -+#define SSB_PMURES_4325_CBUCK_BURST 1 -+#define SSB_PMURES_4325_CBUCK_PWM 2 -+#define SSB_PMURES_4325_CLDO_CBUCK_BURST 3 -+#define SSB_PMURES_4325_CLDO_CBUCK_PWM 4 -+#define SSB_PMURES_4325_BUCK_BOOST_PWM 5 -+#define SSB_PMURES_4325_ILP_REQUEST 6 -+#define SSB_PMURES_4325_ABUCK_BURST 7 -+#define SSB_PMURES_4325_ABUCK_PWM 8 -+#define SSB_PMURES_4325_LNLDO1_PU 9 -+#define SSB_PMURES_4325_LNLDO2_PU 10 -+#define SSB_PMURES_4325_LNLDO3_PU 11 -+#define SSB_PMURES_4325_LNLDO4_PU 12 -+#define SSB_PMURES_4325_XTAL_PU 13 -+#define SSB_PMURES_4325_ALP_AVAIL 14 -+#define SSB_PMURES_4325_RX_PWRSW_PU 15 -+#define SSB_PMURES_4325_TX_PWRSW_PU 16 -+#define SSB_PMURES_4325_RFPLL_PWRSW_PU 17 -+#define SSB_PMURES_4325_LOGEN_PWRSW_PU 18 -+#define SSB_PMURES_4325_AFE_PWRSW_PU 19 -+#define SSB_PMURES_4325_BBPLL_PWRSW_PU 20 -+#define SSB_PMURES_4325_HT_AVAIL 21 -+ -+/* BCM4328 PLL resource numbers. */ -+#define SSB_PMURES_4328_EXT_SWITCHER_PWM 0 -+#define SSB_PMURES_4328_BB_SWITCHER_PWM 1 -+#define SSB_PMURES_4328_BB_SWITCHER_BURST 2 -+#define SSB_PMURES_4328_BB_EXT_SWITCHER_BURST 3 -+#define SSB_PMURES_4328_ILP_REQUEST 4 -+#define SSB_PMURES_4328_RADIO_SWITCHER_PWM 5 -+#define SSB_PMURES_4328_RADIO_SWITCHER_BURST 6 -+#define SSB_PMURES_4328_ROM_SWITCH 7 -+#define SSB_PMURES_4328_PA_REF_LDO 8 -+#define SSB_PMURES_4328_RADIO_LDO 9 -+#define SSB_PMURES_4328_AFE_LDO 10 -+#define SSB_PMURES_4328_PLL_LDO 11 -+#define SSB_PMURES_4328_BG_FILTBYP 12 -+#define SSB_PMURES_4328_TX_FILTBYP 13 -+#define SSB_PMURES_4328_RX_FILTBYP 14 -+#define SSB_PMURES_4328_XTAL_PU 15 -+#define SSB_PMURES_4328_XTAL_EN 16 -+#define SSB_PMURES_4328_BB_PLL_FILTBYP 17 -+#define SSB_PMURES_4328_RF_PLL_FILTBYP 18 -+#define SSB_PMURES_4328_BB_PLL_PU 19 -+ -+/* BCM5354 PLL resource numbers. */ -+#define SSB_PMURES_5354_EXT_SWITCHER_PWM 0 -+#define SSB_PMURES_5354_BB_SWITCHER_PWM 1 -+#define SSB_PMURES_5354_BB_SWITCHER_BURST 2 -+#define SSB_PMURES_5354_BB_EXT_SWITCHER_BURST 3 -+#define SSB_PMURES_5354_ILP_REQUEST 4 -+#define SSB_PMURES_5354_RADIO_SWITCHER_PWM 5 -+#define SSB_PMURES_5354_RADIO_SWITCHER_BURST 6 -+#define SSB_PMURES_5354_ROM_SWITCH 7 -+#define SSB_PMURES_5354_PA_REF_LDO 8 -+#define SSB_PMURES_5354_RADIO_LDO 9 -+#define SSB_PMURES_5354_AFE_LDO 10 -+#define SSB_PMURES_5354_PLL_LDO 11 -+#define SSB_PMURES_5354_BG_FILTBYP 12 -+#define SSB_PMURES_5354_TX_FILTBYP 13 -+#define SSB_PMURES_5354_RX_FILTBYP 14 -+#define SSB_PMURES_5354_XTAL_PU 15 -+#define SSB_PMURES_5354_XTAL_EN 16 -+#define SSB_PMURES_5354_BB_PLL_FILTBYP 17 -+#define SSB_PMURES_5354_RF_PLL_FILTBYP 18 -+#define SSB_PMURES_5354_BB_PLL_PU 19 -+ -+ -+ -+/** Chip specific Chip-Status register contents. */ -+#define SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL 0x00000003 -+#define SSB_CHIPCO_CHST_4325_DEFCIS_SEL 0 /* OTP is powered up, use def. CIS, no SPROM */ -+#define SSB_CHIPCO_CHST_4325_SPROM_SEL 1 /* OTP is powered up, SPROM is present */ -+#define SSB_CHIPCO_CHST_4325_OTP_SEL 2 /* OTP is powered up, no SPROM */ -+#define SSB_CHIPCO_CHST_4325_OTP_PWRDN 3 /* OTP is powered down, SPROM is present */ -+#define SSB_CHIPCO_CHST_4325_SDIO_USB_MODE 0x00000004 -+#define SSB_CHIPCO_CHST_4325_SDIO_USB_MODE_SHIFT 2 -+#define SSB_CHIPCO_CHST_4325_RCAL_VALID 0x00000008 -+#define SSB_CHIPCO_CHST_4325_RCAL_VALID_SHIFT 3 -+#define SSB_CHIPCO_CHST_4325_RCAL_VALUE 0x000001F0 -+#define SSB_CHIPCO_CHST_4325_RCAL_VALUE_SHIFT 4 -+#define SSB_CHIPCO_CHST_4325_PMUTOP_2B 0x00000200 /* 1 for 2b, 0 for to 2a */ - - - -@@ -353,11 +553,20 @@ - struct ssb_device; - struct ssb_serial_port; - -+/* Data for the PMU, if available. -+ * Check availability with ((struct ssb_chipcommon)->capabilities & SSB_CHIPCO_CAP_PMU) -+ */ -+struct ssb_chipcommon_pmu { -+ u8 rev; /* PMU revision */ -+ u32 crystalfreq; /* The active crystal frequency (in kHz) */ -+}; -+ - struct ssb_chipcommon { - struct ssb_device *dev; - u32 capabilities; - /* Fast Powerup Delay constant */ - u16 fast_pwrup_delay; -+ struct ssb_chipcommon_pmu pmu; - }; - - static inline bool ssb_chipco_available(struct ssb_chipcommon *cc) -@@ -365,6 +574,17 @@ static inline bool ssb_chipco_available( - return (cc->dev != NULL); - } - -+/* Register access */ -+#define chipco_read32(cc, offset) ssb_read32((cc)->dev, offset) -+#define chipco_write32(cc, offset, val) ssb_write32((cc)->dev, offset, val) -+ -+#define chipco_mask32(cc, offset, mask) \ -+ chipco_write32(cc, offset, chipco_read32(cc, offset) & (mask)) -+#define chipco_set32(cc, offset, set) \ -+ chipco_write32(cc, offset, chipco_read32(cc, offset) | (set)) -+#define chipco_maskset32(cc, offset, mask, set) \ -+ chipco_write32(cc, offset, (chipco_read32(cc, offset) & (mask)) | (set)) -+ - extern void ssb_chipcommon_init(struct ssb_chipcommon *cc); - - extern void ssb_chipco_suspend(struct ssb_chipcommon *cc); -@@ -406,4 +626,8 @@ extern int ssb_chipco_serial_init(struct - struct ssb_serial_port *ports); - #endif /* CONFIG_SSB_SERIAL */ - -+/* PMU support */ -+extern void ssb_pmu_init(struct ssb_chipcommon *cc); -+ -+ - #endif /* LINUX_SSB_CHIPCO_H_ */ diff --git a/target/linux/generic-2.6/patches-2.6.28/230-add-r_arm_v4bx-relocation-for-arm-module-loader.patch b/target/linux/generic-2.6/patches-2.6.28/230-add-r_arm_v4bx-relocation-for-arm-module-loader.patch index f78bba8c9..3e8d1fb0b 100644 --- a/target/linux/generic-2.6/patches-2.6.28/230-add-r_arm_v4bx-relocation-for-arm-module-loader.patch +++ b/target/linux/generic-2.6/patches-2.6.28/230-add-r_arm_v4bx-relocation-for-arm-module-loader.patch @@ -10,7 +10,7 @@ * These are used to set parameters in the core dumps. --- a/arch/arm/kernel/module.c +++ b/arch/arm/kernel/module.c -@@ -132,6 +132,15 @@ apply_relocate(Elf32_Shdr *sechdrs, cons +@@ -136,6 +136,15 @@ apply_relocate(Elf32_Shdr *sechdrs, cons *(u32 *)loc |= offset & 0x00ffffff; break; diff --git a/target/linux/generic-2.6/patches-2.6.28/976-ssb_update.patch b/target/linux/generic-2.6/patches-2.6.28/976-ssb_update.patch index cd44b9860..279a116d9 100644 --- a/target/linux/generic-2.6/patches-2.6.28/976-ssb_update.patch +++ b/target/linux/generic-2.6/patches-2.6.28/976-ssb_update.patch @@ -1440,6 +1440,14 @@ static inline u32 chipco_write32_masked(struct ssb_chipcommon *cc, u16 offset, u32 mask, u32 value) { +@@ -246,6 +233,7 @@ void ssb_chipcommon_init(struct ssb_chip + { + if (!cc->dev) + return; /* We don't have a ChipCommon */ ++ ssb_pmu_init(cc); + chipco_powercontrol_init(cc); + ssb_chipco_set_clockmode(cc, SSB_CLKMODE_FAST); + calc_fast_powerup_delay(cc); --- a/drivers/ssb/scan.c +++ b/drivers/ssb/scan.c @@ -175,6 +175,8 @@ static u32 scan_read32(struct ssb_bus *b From 4ae360c4fb5b8bb53674b1ff1d51fbd7cf52eed3 Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 29 Nov 2009 13:33:15 +0000 Subject: [PATCH 276/288] ar71xx: add usb support for ubnt rocket m git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18598 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../ar71xx/files/arch/mips/ar71xx/ar71xx.c | 12 +++++-- .../ar71xx/files/arch/mips/ar71xx/devices.c | 33 +++++++++++++++++++ .../ar71xx/files/arch/mips/ar71xx/mach-ubnt.c | 8 ++++- .../mips/include/asm/mach-ar71xx/ar71xx.h | 3 ++ 4 files changed, 53 insertions(+), 3 deletions(-) diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/ar71xx.c b/target/linux/ar71xx/files/arch/mips/ar71xx/ar71xx.c index 30d08c051..2a9dff311 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/ar71xx.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/ar71xx.c @@ -36,6 +36,7 @@ EXPORT_SYMBOL_GPL(ar71xx_usb_ctrl_base); void ar71xx_device_stop(u32 mask) { unsigned long flags; + u32 mask_inv; u32 t; switch (ar71xx_soc) { @@ -49,9 +50,12 @@ void ar71xx_device_stop(u32 mask) break; case AR71XX_SOC_AR7240: + mask_inv = mask & RESET_MODULE_USB_OHCI_DLL_7240; local_irq_save(flags); t = ar71xx_reset_rr(AR724X_RESET_REG_RESET_MODULE); - ar71xx_reset_wr(AR724X_RESET_REG_RESET_MODULE, t | mask); + t |= mask; + t &= ~mask_inv; + ar71xx_reset_wr(AR724X_RESET_REG_RESET_MODULE, t); local_irq_restore(flags); break; @@ -72,6 +76,7 @@ EXPORT_SYMBOL_GPL(ar71xx_device_stop); void ar71xx_device_start(u32 mask) { unsigned long flags; + u32 mask_inv; u32 t; switch (ar71xx_soc) { @@ -85,9 +90,12 @@ void ar71xx_device_start(u32 mask) break; case AR71XX_SOC_AR7240: + mask_inv = mask & RESET_MODULE_USB_OHCI_DLL_7240; local_irq_save(flags); t = ar71xx_reset_rr(AR724X_RESET_REG_RESET_MODULE); - ar71xx_reset_wr(AR724X_RESET_REG_RESET_MODULE, t & ~mask); + t &= ~mask; + t |= mask_inv; + ar71xx_reset_wr(AR724X_RESET_REG_RESET_MODULE, t); local_irq_restore(flags); break; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c b/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c index 65b7419ac..bed23938e 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c @@ -42,6 +42,19 @@ static struct resource ar71xx_ohci_resources[] = { }, }; +static struct resource ar7240_ohci_resources[] = { + [0] = { + .start = AR7240_OHCI_BASE, + .end = AR7240_OHCI_BASE + AR7240_OHCI_SIZE - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = AR71XX_CPU_IRQ_USB, + .end = AR71XX_CPU_IRQ_USB, + .flags = IORESOURCE_IRQ, + }, +}; + static u64 ar71xx_ohci_dmamask = DMA_BIT_MASK(32); static struct platform_device ar71xx_ohci_device = { .name = "ar71xx-ohci", @@ -90,6 +103,9 @@ static struct platform_device ar71xx_ehci_device = { (RESET_MODULE_USB_HOST | RESET_MODULE_USB_PHY \ | RESET_MODULE_USB_OHCI_DLL) +#define AR7240_USB_RESET_MASK \ + (RESET_MODULE_USB_HOST | RESET_MODULE_USB_OHCI_DLL_7240) + static void __init ar71xx_usb_setup(void) { ar71xx_device_stop(AR71XX_USB_RESET_MASK); @@ -105,6 +121,18 @@ static void __init ar71xx_usb_setup(void) mdelay(900); } +static void __init ar7240_usb_setup(void) +{ + ar71xx_ohci_device.resource = ar7240_ohci_resources; + + ar71xx_device_stop(AR7240_USB_RESET_MASK); + mdelay(1000); + ar71xx_device_start(AR7240_USB_RESET_MASK); + + /* WAR for HW bug. Here it adjusts the duration between two SOFS */ + ar71xx_usb_ctrl_wr(USB_CTRL_REG_FLADJ, 0x3); +} + static void __init ar91xx_usb_setup(void) { ar71xx_device_stop(RESET_MODULE_USBSUS_OVERRIDE); @@ -120,6 +148,11 @@ static void __init ar91xx_usb_setup(void) void __init ar71xx_add_device_usb(void) { switch (ar71xx_soc) { + case AR71XX_SOC_AR7240: + ar7240_usb_setup(); + platform_device_register(&ar71xx_ohci_device); + break; + case AR71XX_SOC_AR7130: case AR71XX_SOC_AR7141: case AR71XX_SOC_AR7161: diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c index 0653c2f03..9b70f8ddc 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c @@ -308,8 +308,14 @@ static void __init ubnt_m_setup(void) ubnt_m_gpio_buttons); } +static void __init ubnt_rocket_m_setup(void) +{ + ubnt_m_setup(); + ar71xx_add_device_usb(); +} + MIPS_MACHINE(AR71XX_MACH_UBNT_BULLET_M, "Ubiquiti Bullet M", ubnt_m_setup); -MIPS_MACHINE(AR71XX_MACH_UBNT_ROCKET_M, "Ubiquiti Rocket M", ubnt_m_setup); +MIPS_MACHINE(AR71XX_MACH_UBNT_ROCKET_M, "Ubiquiti Rocket M", ubnt_rocket_m_setup); /* TODO detect the second ethernet port and use one init function for all Ubiquiti MIMO series products */ diff --git a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h index 65f2120f5..46629327c 100644 --- a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h +++ b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h @@ -32,6 +32,8 @@ #define AR71XX_EHCI_SIZE 0x01000000 #define AR71XX_OHCI_BASE 0x1c000000 #define AR71XX_OHCI_SIZE 0x01000000 +#define AR7240_OHCI_BASE 0x1b000000 +#define AR7240_OHCI_SIZE 0x01000000 #define AR71XX_SPI_BASE 0x1f000000 #define AR71XX_SPI_SIZE 0x01000000 @@ -468,6 +470,7 @@ static inline u32 ar724x_pci_rr(unsigned reg) #define RESET_MODULE_USB_OHCI_DLL BIT(6) #define RESET_MODULE_USB_HOST BIT(5) #define RESET_MODULE_USB_PHY BIT(4) +#define RESET_MODULE_USB_OHCI_DLL_7240 BIT(3) #define RESET_MODULE_PCI_BUS BIT(1) #define RESET_MODULE_PCI_CORE BIT(0) From ac42d58d7c974b42dd434a2f7f327b390c929c63 Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 29 Nov 2009 13:38:03 +0000 Subject: [PATCH 277/288] ar71xx: mask out reserved bits from the dma tx status in the ethernet driver git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18599 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../files/drivers/net/ag71xx/ag71xx_main.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c index 57f6b34d6..94420477c 100644 --- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c +++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c @@ -318,6 +318,7 @@ static void ag71xx_hw_set_macaddr(struct ag71xx *ag, unsigned char *mac) static void ag71xx_dma_reset(struct ag71xx *ag) { + u32 val; int i; ag71xx_dump_dma_regs(ag); @@ -340,13 +341,19 @@ static void ag71xx_dma_reset(struct ag71xx *ag) ag71xx_wr(ag, AG71XX_REG_RX_STATUS, RX_STATUS_BE | RX_STATUS_OF); ag71xx_wr(ag, AG71XX_REG_TX_STATUS, TX_STATUS_BE | TX_STATUS_UR); - if (ag71xx_rr(ag, AG71XX_REG_RX_STATUS)) - printk(KERN_ALERT "%s: unable to clear DMA Rx status\n", - ag->dev->name); + val = ag71xx_rr(ag, AG71XX_REG_RX_STATUS); + if (val) + printk(KERN_ALERT "%s: unable to clear DMA Rx status: %08x\n", + ag->dev->name, val); - if (ag71xx_rr(ag, AG71XX_REG_TX_STATUS)) - printk(KERN_ALERT "%s: unable to clear DMA Tx status\n", - ag->dev->name); + val = ag71xx_rr(ag, AG71XX_REG_TX_STATUS); + + /* mask out reserved bits */ + val &= ~0xff000000; + + if (val) + printk(KERN_ALERT "%s: unable to clear DMA Tx status: %08x\n", + ag->dev->name, val); ag71xx_dump_dma_regs(ag); } From f916333f1ebc34b73b46d124e98ef654feae45ab Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 29 Nov 2009 13:56:41 +0000 Subject: [PATCH 278/288] mac80211: fix up wds sta mode after r18591 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18600 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/mac80211/files/lib/wifi/mac80211.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/mac80211/files/lib/wifi/mac80211.sh b/package/mac80211/files/lib/wifi/mac80211.sh index 91fdcf57c..bc6cc1449 100644 --- a/package/mac80211/files/lib/wifi/mac80211.sh +++ b/package/mac80211/files/lib/wifi/mac80211.sh @@ -125,7 +125,7 @@ enable_mac80211() { ;; sta) local wdsflag - [ "$wds" -gt 0 ] && wdsflag="wds on" + [ "$wds" -gt 0 ] && wdsflag="4addr on" iw phy "$phy" interface add "$ifname" type managed $wdsflag config_get_bool powersave "$vif" powersave 0 [ "$powersave" -gt 0 ] && powersave="on" || powersave="off" From b1e695999e776665a790e84837ba4b6c89d52e58 Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 29 Nov 2009 14:13:47 +0000 Subject: [PATCH 279/288] hostapd: replace the wme_* config variables with wmm_* ones (fixes #6247) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18602 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/hostapd/files/hostapd.sh | 42 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/package/hostapd/files/hostapd.sh b/package/hostapd/files/hostapd.sh index 4a13c19ab..e12c39276 100644 --- a/package/hostapd/files/hostapd.sh +++ b/package/hostapd/files/hostapd.sh @@ -119,27 +119,27 @@ EOF ;; *) cat >> /var/run/hostapd-$ifname.conf < Date: Sun, 29 Nov 2009 14:31:55 +0000 Subject: [PATCH 280/288] kernel: move CONFIG_MIPS_FPU_EMU to generic kernel config git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18603 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/amazon/config-2.6.21 | 1 - target/linux/amazon/config-2.6.30 | 1 - target/linux/ar7/config-default | 1 - target/linux/ar71xx/config-2.6.28 | 1 - target/linux/ar71xx/config-2.6.30 | 1 - target/linux/ar71xx/config-2.6.31 | 1 - target/linux/atheros/config-2.6.30 | 1 - target/linux/atheros/config-2.6.31 | 1 - target/linux/brcm47xx/config-2.6.28 | 1 - target/linux/brcm47xx/config-2.6.30 | 1 - target/linux/brcm47xx/config-2.6.31 | 1 - target/linux/brcm63xx/config-2.6.30 | 1 - target/linux/cobalt/config-default | 1 - target/linux/generic-2.6/config-2.6.21 | 1 + target/linux/generic-2.6/config-2.6.25 | 1 + target/linux/generic-2.6/config-2.6.28 | 1 + target/linux/generic-2.6/config-2.6.30 | 1 + target/linux/generic-2.6/config-2.6.31 | 1 + target/linux/generic-2.6/config-2.6.32 | 1 + target/linux/ifxmips/config-2.6.30 | 1 - target/linux/octeon/config-default | 1 - target/linux/rb532/config-default | 1 - 22 files changed, 6 insertions(+), 16 deletions(-) diff --git a/target/linux/amazon/config-2.6.21 b/target/linux/amazon/config-2.6.21 index c1bb034fe..cfe6fa540 100644 --- a/target/linux/amazon/config-2.6.21 +++ b/target/linux/amazon/config-2.6.21 @@ -71,7 +71,6 @@ CONFIG_KALLSYMS=y # CONFIG_MIPS_DB1500 is not set # CONFIG_MIPS_DB1550 is not set # CONFIG_MIPS_EV64120 is not set -# CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MALTA is not set # CONFIG_MIPS_MIRAGE is not set diff --git a/target/linux/amazon/config-2.6.30 b/target/linux/amazon/config-2.6.30 index 33a0107b5..bb6bca05c 100644 --- a/target/linux/amazon/config-2.6.30 +++ b/target/linux/amazon/config-2.6.30 @@ -91,7 +91,6 @@ CONFIG_KALLSYMS=y # CONFIG_MIKROTIK_RB532 is not set CONFIG_MIPS=y # CONFIG_MIPS_COBALT is not set -# CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MACHINE is not set # CONFIG_MIPS_MALTA is not set diff --git a/target/linux/ar7/config-default b/target/linux/ar7/config-default index 59a31d8f6..f10105592 100644 --- a/target/linux/ar7/config-default +++ b/target/linux/ar7/config-default @@ -90,7 +90,6 @@ CONFIG_LEDS_GPIO=y # CONFIG_MACH_VR41XX is not set # CONFIG_MIKROTIK_RB532 is not set # CONFIG_MIPS_COBALT is not set -# CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MACHINE is not set # CONFIG_MIPS_MALTA is not set diff --git a/target/linux/ar71xx/config-2.6.28 b/target/linux/ar71xx/config-2.6.28 index 21a65eeb1..340379068 100644 --- a/target/linux/ar71xx/config-2.6.28 +++ b/target/linux/ar71xx/config-2.6.28 @@ -117,7 +117,6 @@ CONFIG_IRQ_CPU=y CONFIG_MICREL_PHY=y # CONFIG_MIKROTIK_RB532 is not set # CONFIG_MIPS_COBALT is not set -# CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 CONFIG_MIPS_MACHINE=y # CONFIG_MIPS_MALTA is not set diff --git a/target/linux/ar71xx/config-2.6.30 b/target/linux/ar71xx/config-2.6.30 index 640f06fb9..4a2f129f1 100644 --- a/target/linux/ar71xx/config-2.6.30 +++ b/target/linux/ar71xx/config-2.6.30 @@ -122,7 +122,6 @@ CONFIG_IRQ_CPU=y CONFIG_MICREL_PHY=y # CONFIG_MIKROTIK_RB532 is not set # CONFIG_MIPS_COBALT is not set -# CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 CONFIG_MIPS_MACHINE=y # CONFIG_MIPS_MALTA is not set diff --git a/target/linux/ar71xx/config-2.6.31 b/target/linux/ar71xx/config-2.6.31 index 4ffdd5acd..b92b0f639 100644 --- a/target/linux/ar71xx/config-2.6.31 +++ b/target/linux/ar71xx/config-2.6.31 @@ -125,7 +125,6 @@ CONFIG_MAC80211_DEFAULT_PS_VALUE=0 CONFIG_MICREL_PHY=y # CONFIG_MIKROTIK_RB532 is not set # CONFIG_MIPS_COBALT is not set -# CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 CONFIG_MIPS_MACHINE=y # CONFIG_MIPS_MALTA is not set diff --git a/target/linux/atheros/config-2.6.30 b/target/linux/atheros/config-2.6.30 index 1cf297ee9..bc5d78928 100644 --- a/target/linux/atheros/config-2.6.30 +++ b/target/linux/atheros/config-2.6.30 @@ -94,7 +94,6 @@ CONFIG_IRQ_CPU=y # CONFIG_MACH_VR41XX is not set # CONFIG_MIKROTIK_RB532 is not set # CONFIG_MIPS_COBALT is not set -# CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MACHINE is not set # CONFIG_MIPS_MALTA is not set diff --git a/target/linux/atheros/config-2.6.31 b/target/linux/atheros/config-2.6.31 index e40f691a2..9b8b239a1 100644 --- a/target/linux/atheros/config-2.6.31 +++ b/target/linux/atheros/config-2.6.31 @@ -100,7 +100,6 @@ CONFIG_MAC80211_DEFAULT_PS_VALUE=0 # CONFIG_MACH_VR41XX is not set # CONFIG_MIKROTIK_RB532 is not set # CONFIG_MIPS_COBALT is not set -# CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MACHINE is not set # CONFIG_MIPS_MALTA is not set diff --git a/target/linux/brcm47xx/config-2.6.28 b/target/linux/brcm47xx/config-2.6.28 index 17dd173a7..509384ef8 100644 --- a/target/linux/brcm47xx/config-2.6.28 +++ b/target/linux/brcm47xx/config-2.6.28 @@ -93,7 +93,6 @@ CONFIG_LEDS_GPIO=y # CONFIG_MACH_VR41XX is not set # CONFIG_MIKROTIK_RB532 is not set # CONFIG_MIPS_COBALT is not set -# CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MACHINE is not set # CONFIG_MIPS_MALTA is not set diff --git a/target/linux/brcm47xx/config-2.6.30 b/target/linux/brcm47xx/config-2.6.30 index 07ff5f34a..0c7a25f2d 100644 --- a/target/linux/brcm47xx/config-2.6.30 +++ b/target/linux/brcm47xx/config-2.6.30 @@ -103,7 +103,6 @@ CONFIG_LEDS_GPIO=y # CONFIG_MACH_VR41XX is not set # CONFIG_MIKROTIK_RB532 is not set # CONFIG_MIPS_COBALT is not set -# CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MACHINE is not set # CONFIG_MIPS_MALTA is not set diff --git a/target/linux/brcm47xx/config-2.6.31 b/target/linux/brcm47xx/config-2.6.31 index 3432d26fc..5f3754d9e 100644 --- a/target/linux/brcm47xx/config-2.6.31 +++ b/target/linux/brcm47xx/config-2.6.31 @@ -104,7 +104,6 @@ CONFIG_MAC80211_DEFAULT_PS_VALUE=0 # CONFIG_MACH_VR41XX is not set # CONFIG_MIKROTIK_RB532 is not set # CONFIG_MIPS_COBALT is not set -# CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MACHINE is not set # CONFIG_MIPS_MALTA is not set diff --git a/target/linux/brcm63xx/config-2.6.30 b/target/linux/brcm63xx/config-2.6.30 index 33c69df59..2c78dcd9d 100644 --- a/target/linux/brcm63xx/config-2.6.30 +++ b/target/linux/brcm63xx/config-2.6.30 @@ -125,7 +125,6 @@ CONFIG_LEDS_GPIO=y CONFIG_MAGIC_SYSRQ=y # CONFIG_MIKROTIK_RB532 is not set # CONFIG_MIPS_COBALT is not set -# CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MACHINE is not set # CONFIG_MIPS_MALTA is not set diff --git a/target/linux/cobalt/config-default b/target/linux/cobalt/config-default index ad4b48512..b0ecd1405 100644 --- a/target/linux/cobalt/config-default +++ b/target/linux/cobalt/config-default @@ -140,7 +140,6 @@ CONFIG_MIPS32_COMPAT=y CONFIG_MIPS32_N32=y CONFIG_MIPS32_O32=y CONFIG_MIPS_COBALT=y -# CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MACHINE is not set # CONFIG_MIPS_MALTA is not set diff --git a/target/linux/generic-2.6/config-2.6.21 b/target/linux/generic-2.6/config-2.6.21 index 9ec23b5f1..1d91636b2 100644 --- a/target/linux/generic-2.6/config-2.6.21 +++ b/target/linux/generic-2.6/config-2.6.21 @@ -727,6 +727,7 @@ CONFIG_MII=y CONFIG_MINI_FO=y # CONFIG_MINIX_FS is not set # CONFIG_MINIX_SUBPARTITION is not set +# CONFIG_MIPS_FPU_EMU is not set # CONFIG_MKISS is not set CONFIG_MMC_BLOCK_BOUNCE=y # CONFIG_MMC_BLOCK is not set diff --git a/target/linux/generic-2.6/config-2.6.25 b/target/linux/generic-2.6/config-2.6.25 index 276a48f68..ba93a3267 100644 --- a/target/linux/generic-2.6/config-2.6.25 +++ b/target/linux/generic-2.6/config-2.6.25 @@ -809,6 +809,7 @@ CONFIG_MII=y CONFIG_MINI_FO=y # CONFIG_MINIX_FS is not set # CONFIG_MINIX_SUBPARTITION is not set +# CONFIG_MIPS_FPU_EMU is not set CONFIG_MISC_DEVICES=y # CONFIG_MKISS is not set # CONFIG_MMC_ARMMMCI is not set diff --git a/target/linux/generic-2.6/config-2.6.28 b/target/linux/generic-2.6/config-2.6.28 index 2984dc31e..82b79bd8a 100644 --- a/target/linux/generic-2.6/config-2.6.28 +++ b/target/linux/generic-2.6/config-2.6.28 @@ -945,6 +945,7 @@ CONFIG_MII=y CONFIG_MINI_FO=y # CONFIG_MINIX_FS is not set # CONFIG_MINIX_SUBPARTITION is not set +# CONFIG_MIPS_FPU_EMU is not set CONFIG_MISC_DEVICES=y # CONFIG_MISDN_HFCPCI is not set # CONFIG_MISDN is not set diff --git a/target/linux/generic-2.6/config-2.6.30 b/target/linux/generic-2.6/config-2.6.30 index 97a3ade92..62f05d621 100644 --- a/target/linux/generic-2.6/config-2.6.30 +++ b/target/linux/generic-2.6/config-2.6.30 @@ -1092,6 +1092,7 @@ CONFIG_MII=y CONFIG_MINI_FO=y # CONFIG_MINIX_FS is not set # CONFIG_MINIX_SUBPARTITION is not set +# CONFIG_MIPS_FPU_EMU is not set CONFIG_MISC_DEVICES=y CONFIG_MISC_FILESYSTEMS=y # CONFIG_MISDN_HFCPCI is not set diff --git a/target/linux/generic-2.6/config-2.6.31 b/target/linux/generic-2.6/config-2.6.31 index b1d2a01c3..221a13f42 100644 --- a/target/linux/generic-2.6/config-2.6.31 +++ b/target/linux/generic-2.6/config-2.6.31 @@ -1133,6 +1133,7 @@ CONFIG_MII=y CONFIG_MINI_FO=y # CONFIG_MINIX_FS is not set # CONFIG_MINIX_SUBPARTITION is not set +# CONFIG_MIPS_FPU_EMU is not set CONFIG_MISC_DEVICES=y CONFIG_MISC_FILESYSTEMS=y # CONFIG_MISDN_HFCPCI is not set diff --git a/target/linux/generic-2.6/config-2.6.32 b/target/linux/generic-2.6/config-2.6.32 index b136f2fbd..542b5e44b 100644 --- a/target/linux/generic-2.6/config-2.6.32 +++ b/target/linux/generic-2.6/config-2.6.32 @@ -1145,6 +1145,7 @@ CONFIG_MII=y CONFIG_MINI_FO=y # CONFIG_MINIX_FS is not set # CONFIG_MINIX_SUBPARTITION is not set +# CONFIG_MIPS_FPU_EMU is not set CONFIG_MISC_DEVICES=y CONFIG_MISC_FILESYSTEMS=y # CONFIG_MISDN_HFCPCI is not set diff --git a/target/linux/ifxmips/config-2.6.30 b/target/linux/ifxmips/config-2.6.30 index 3842dd526..b9167f631 100644 --- a/target/linux/ifxmips/config-2.6.30 +++ b/target/linux/ifxmips/config-2.6.30 @@ -98,7 +98,6 @@ CONFIG_LEDS_IFXMIPS=y # CONFIG_MACH_VR41XX is not set # CONFIG_MIKROTIK_RB532 is not set # CONFIG_MIPS_COBALT is not set -# CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MACHINE is not set # CONFIG_MIPS_MALTA is not set diff --git a/target/linux/octeon/config-default b/target/linux/octeon/config-default index 3751a75bd..5054d158a 100644 --- a/target/linux/octeon/config-default +++ b/target/linux/octeon/config-default @@ -175,7 +175,6 @@ CONFIG_MIPS32_COMPAT=y CONFIG_MIPS32_N32=y CONFIG_MIPS32_O32=y # CONFIG_MIPS_COBALT is not set -# CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=7 # CONFIG_MIPS_MACHINE is not set # CONFIG_MIPS_MALTA is not set diff --git a/target/linux/rb532/config-default b/target/linux/rb532/config-default index 2f95a18d7..811477904 100644 --- a/target/linux/rb532/config-default +++ b/target/linux/rb532/config-default @@ -99,7 +99,6 @@ CONFIG_LEDS_MIKROTIK_RB532=y # CONFIG_MACH_VR41XX is not set CONFIG_MIKROTIK_RB532=y # CONFIG_MIPS_COBALT is not set -# CONFIG_MIPS_FPU_EMU is not set CONFIG_MIPS_L1_CACHE_SHIFT=4 # CONFIG_MIPS_MACHINE is not set # CONFIG_MIPS_MALTA is not set From deecd2f2a20b0fd7f5bcd72babf00f32f2c6a82b Mon Sep 17 00:00:00 2001 From: hauke Date: Sun, 29 Nov 2009 16:53:50 +0000 Subject: [PATCH 281/288] [amazon] Read the size of the available memory from parameters passed to the kernel by firmware. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18604 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../linux/amazon/files/arch/mips/amazon/prom.c | 18 +++++++++++++++++- .../210-remove_unnedded_variables.patch | 12 ++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/target/linux/amazon/files/arch/mips/amazon/prom.c b/target/linux/amazon/files/arch/mips/amazon/prom.c index f138bcbef..c5db4f5cd 100644 --- a/target/linux/amazon/files/arch/mips/amazon/prom.c +++ b/target/linux/amazon/files/arch/mips/amazon/prom.c @@ -59,12 +59,28 @@ void prom_printf(const char * fmt, ...) void __init prom_init(void) { + char **envp = (char **) fw_arg2; + + int memsize = 16; /* assume 16M as default */ + mips_machgroup = MACH_GROUP_INFINEON; mips_machtype = MACH_INFINEON_AMAZON; + envp = (char **)KSEG1ADDR((unsigned long)envp); + while (*envp) { + char *e = (char *)KSEG1ADDR(*envp); + + if (!strncmp(e, "memsize=", 8)) { + e += 8; + memsize = simple_strtoul(e, NULL, 10); + } + envp++; + } + memsize *= 1024 * 1024; + strcpy(&(arcs_cmdline[0]), "console=ttyS0,115200 rootfstype=squashfs,jffs2"); - add_memory_region(0x00000000, 0x1000000, BOOT_MEM_RAM); + add_memory_region(0x00000000, memsize, BOOT_MEM_RAM); } void prom_free_prom_memory(void) diff --git a/target/linux/amazon/patches-2.6.30/210-remove_unnedded_variables.patch b/target/linux/amazon/patches-2.6.30/210-remove_unnedded_variables.patch index c2c7fbd3a..3683a2732 100644 --- a/target/linux/amazon/patches-2.6.30/210-remove_unnedded_variables.patch +++ b/target/linux/amazon/patches-2.6.30/210-remove_unnedded_variables.patch @@ -1,12 +1,12 @@ --- a/arch/mips/amazon/prom.c +++ b/arch/mips/amazon/prom.c -@@ -59,9 +59,6 @@ void prom_printf(const char * fmt, ...) +@@ -63,9 +63,6 @@ void __init prom_init(void) + + int memsize = 16; /* assume 16M as default */ - void __init prom_init(void) - { - mips_machgroup = MACH_GROUP_INFINEON; - mips_machtype = MACH_INFINEON_AMAZON; - - strcpy(&(arcs_cmdline[0]), "console=ttyS0,115200 rootfstype=squashfs,jffs2"); - - add_memory_region(0x00000000, 0x1000000, BOOT_MEM_RAM); + envp = (char **)KSEG1ADDR((unsigned long)envp); + while (*envp) { + char *e = (char *)KSEG1ADDR(*envp); From 3bea333001b3e3bbfea5cb1411accb1903506c18 Mon Sep 17 00:00:00 2001 From: hauke Date: Sun, 29 Nov 2009 16:54:17 +0000 Subject: [PATCH 282/288] [amazon] Update to kernel 2.6.30 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18605 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/amazon/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/amazon/Makefile b/target/linux/amazon/Makefile index 5a5fed598..d0787ca25 100644 --- a/target/linux/amazon/Makefile +++ b/target/linux/amazon/Makefile @@ -10,7 +10,7 @@ ARCH:=mips BOARD:=amazon BOARDNAME:=Infineon Amazon FEATURES:=squashfs jffs2 broken -LINUX_VERSION:=2.6.21.7 +LINUX_VERSION:=2.6.30.9 include $(INCLUDE_DIR)/target.mk From 8d2137b93d3f9ab6fbb446f4510076a0be77a403 Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 29 Nov 2009 16:56:38 +0000 Subject: [PATCH 283/288] hostapd: update to latest git, fixes ampdu settings in the beacon HT IE git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18606 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/hostapd/Makefile | 4 +-- package/hostapd/patches/100-madwifi_fix.patch | 4 +-- package/hostapd/patches/110-countrycode.patch | 2 +- .../hostapd/patches/120-nl80211_ap_fix.patch | 16 --------- .../{130-wds_ap.patch => 120-wds_ap.patch} | 28 ++++++++-------- package/hostapd/patches/130-compile_fix.patch | 10 ++++++ package/hostapd/patches/140-ht40_scan.patch | 11 ------- .../hostapd/patches/150-ht_cap_endian.patch | 33 ------------------- 8 files changed, 29 insertions(+), 79 deletions(-) delete mode 100644 package/hostapd/patches/120-nl80211_ap_fix.patch rename package/hostapd/patches/{130-wds_ap.patch => 120-wds_ap.patch} (89%) create mode 100644 package/hostapd/patches/130-compile_fix.patch delete mode 100644 package/hostapd/patches/140-ht40_scan.patch delete mode 100644 package/hostapd/patches/150-ht_cap_endian.patch diff --git a/package/hostapd/Makefile b/package/hostapd/Makefile index b1dde1c45..d1ca7ea88 100644 --- a/package/hostapd/Makefile +++ b/package/hostapd/Makefile @@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_VERSION:=20091111 +PKG_VERSION:=20091129 PKG_RELEASE:=1 -PKG_REV:=dc6d9ac250f793a62b21ca828445967fb484305f +PKG_REV:=be8eb8ab3ee42aa66930aea827bdcb05a2172276 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git diff --git a/package/hostapd/patches/100-madwifi_fix.patch b/package/hostapd/patches/100-madwifi_fix.patch index 915b86a64..42f0b3ad3 100644 --- a/package/hostapd/patches/100-madwifi_fix.patch +++ b/package/hostapd/patches/100-madwifi_fix.patch @@ -1,6 +1,6 @@ --- a/src/drivers/driver_madwifi.c +++ b/src/drivers/driver_madwifi.c -@@ -318,6 +318,7 @@ madwifi_set_iface_flags(void *priv, int +@@ -323,6 +323,7 @@ madwifi_set_iface_flags(void *priv, int { struct madwifi_driver_data *drv = priv; struct ifreq ifr; @@ -8,7 +8,7 @@ wpa_printf(MSG_DEBUG, "%s: dev_up=%d", __func__, dev_up); -@@ -332,10 +333,14 @@ madwifi_set_iface_flags(void *priv, int +@@ -337,10 +338,14 @@ madwifi_set_iface_flags(void *priv, int return -1; } diff --git a/package/hostapd/patches/110-countrycode.patch b/package/hostapd/patches/110-countrycode.patch index 7c9d0219d..73738f15e 100644 --- a/package/hostapd/patches/110-countrycode.patch +++ b/package/hostapd/patches/110-countrycode.patch @@ -1,6 +1,6 @@ --- a/hostapd/hostapd.c +++ b/hostapd/hostapd.c -@@ -1344,10 +1344,8 @@ static int setup_interface(struct hostap +@@ -1339,10 +1339,8 @@ static int setup_interface(struct hostap if (hapd->iconf->country[0] && hapd->iconf->country[1]) { os_memcpy(country, hapd->iconf->country, 3); country[3] = '\0'; diff --git a/package/hostapd/patches/120-nl80211_ap_fix.patch b/package/hostapd/patches/120-nl80211_ap_fix.patch deleted file mode 100644 index 78475e87d..000000000 --- a/package/hostapd/patches/120-nl80211_ap_fix.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -4418,10 +4418,10 @@ static void *i802_init(struct hostapd_da - /* start listening for EAPOL on the default AP interface */ - add_ifidx(drv, drv->ifindex); - -- if (params->bssid) { -- if (hostapd_set_iface_flags(drv, drv->ifname, 0)) -- goto failed; -+ if (hostapd_set_iface_flags(drv, drv->ifname, 0)) -+ goto failed; - -+ if (params->bssid) { - if (set_ifhwaddr(drv, drv->ifname, params->bssid)) - goto failed; - } diff --git a/package/hostapd/patches/130-wds_ap.patch b/package/hostapd/patches/120-wds_ap.patch similarity index 89% rename from package/hostapd/patches/130-wds_ap.patch rename to package/hostapd/patches/120-wds_ap.patch index 4624f88a1..a6f7669f6 100644 --- a/package/hostapd/patches/130-wds_ap.patch +++ b/package/hostapd/patches/120-wds_ap.patch @@ -11,7 +11,7 @@ } else if (os_strcmp(buf, "country_code") == 0) { --- a/hostapd/config.h +++ b/hostapd/config.h -@@ -198,6 +198,7 @@ struct hostapd_bss_config { +@@ -195,6 +195,7 @@ struct hostapd_bss_config { int num_accept_mac; struct mac_acl_entry *deny_mac; int num_deny_mac; @@ -21,7 +21,7 @@ * algorithms, WPA_AUTH_ALG_{OPEN,SHARED,LEAP} */ --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -1305,6 +1305,7 @@ struct wpa_driver_ops { +@@ -1127,6 +1127,7 @@ struct wpa_driver_ops { const char *ifname, const u8 *addr); int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname, int vlan_id); @@ -31,7 +31,7 @@ * @priv: driver private data --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -2755,7 +2755,7 @@ static void nl80211_remove_iface(struct +@@ -2675,7 +2675,7 @@ static void nl80211_remove_iface(struct static int nl80211_create_iface_once(struct wpa_driver_nl80211_data *drv, const char *ifname, enum nl80211_iftype iftype, @@ -40,7 +40,7 @@ { struct nl_msg *msg, *flags = NULL; int ifidx; -@@ -2786,6 +2786,8 @@ static int nl80211_create_iface_once(str +@@ -2706,6 +2706,8 @@ static int nl80211_create_iface_once(str if (err) goto nla_put_failure; @@ -49,7 +49,7 @@ } ret = send_and_recv_msgs(drv, msg, NULL, NULL); -@@ -2816,11 +2818,11 @@ static int nl80211_create_iface_once(str +@@ -2736,11 +2738,11 @@ static int nl80211_create_iface_once(str } static int nl80211_create_iface(struct wpa_driver_nl80211_data *drv, const char *ifname, enum nl80211_iftype iftype, @@ -63,7 +63,7 @@ /* if error occured and interface exists already */ if (ret == -ENFILE && if_nametoindex(ifname)) { -@@ -2830,7 +2832,7 @@ static int nl80211_create_iface(struct w +@@ -2750,7 +2752,7 @@ static int nl80211_create_iface(struct w nl80211_remove_iface(drv, if_nametoindex(ifname)); /* Try to create the interface again */ @@ -72,7 +72,7 @@ } return ret; -@@ -3055,7 +3057,7 @@ static struct sock_filter msock_filter_i +@@ -2975,7 +2977,7 @@ static struct sock_filter msock_filter_i #if 0 /* @@ -81,7 +81,7 @@ */ /* load the lower byte of the frame control field */ BPF_STMT(BPF_LD | BPF_B | BPF_IND, 0), -@@ -3063,13 +3065,13 @@ static struct sock_filter msock_filter_i +@@ -2983,13 +2985,13 @@ static struct sock_filter msock_filter_i BPF_STMT(BPF_ALU | BPF_AND | BPF_K, 0x0c), /* drop non-data frames */ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 8, 0, FAIL), @@ -99,7 +99,7 @@ /* * add header length to index -@@ -3175,7 +3177,7 @@ nl80211_create_monitor_interface(struct +@@ -3095,7 +3097,7 @@ nl80211_create_monitor_interface(struct buf[IFNAMSIZ - 1] = '\0'; drv->monitor_ifidx = @@ -108,7 +108,7 @@ if (drv->monitor_ifidx < 0) return -1; -@@ -4155,7 +4157,7 @@ static int i802_bss_add(void *priv, cons +@@ -4064,7 +4066,7 @@ static int i802_bss_add(void *priv, cons if (bss == NULL) return -1; @@ -117,7 +117,7 @@ if (ifidx < 0) { os_free(bss); return -1; -@@ -4264,7 +4266,7 @@ static int i802_if_add(const char *iface +@@ -4162,7 +4164,7 @@ static int i802_if_add(const char *iface enum hostapd_driver_if_type type, char *ifname, const u8 *addr) { @@ -126,7 +126,7 @@ return -1; return 0; } -@@ -4310,6 +4312,22 @@ static int i802_set_sta_vlan(void *priv, +@@ -4208,6 +4210,22 @@ static int i802_set_sta_vlan(void *priv, return -ENOBUFS; } @@ -149,7 +149,7 @@ static void handle_eapol(int sock, void *eloop_ctx, void *sock_ctx) { -@@ -4536,5 +4554,6 @@ const struct wpa_driver_ops wpa_driver_n +@@ -4424,5 +4442,6 @@ const struct wpa_driver_ops wpa_driver_n .if_update = i802_if_update, .if_remove = i802_if_remove, .set_sta_vlan = i802_set_sta_vlan, @@ -158,7 +158,7 @@ }; --- a/hostapd/driver_i.h +++ b/hostapd/driver_i.h -@@ -453,6 +453,14 @@ hostapd_set_sta_vlan(const char *ifname, +@@ -446,6 +446,14 @@ hostapd_set_sta_vlan(const char *ifname, } static inline int diff --git a/package/hostapd/patches/130-compile_fix.patch b/package/hostapd/patches/130-compile_fix.patch new file mode 100644 index 000000000..5a04f9a80 --- /dev/null +++ b/package/hostapd/patches/130-compile_fix.patch @@ -0,0 +1,10 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #include "nl80211_copy.h" + + #include "common.h" diff --git a/package/hostapd/patches/140-ht40_scan.patch b/package/hostapd/patches/140-ht40_scan.patch deleted file mode 100644 index b8fa6e38f..000000000 --- a/package/hostapd/patches/140-ht40_scan.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/hostapd/hw_features.c -+++ b/hostapd/hw_features.c -@@ -329,7 +329,7 @@ static int ieee80211n_check_40mhz_5g(str - if (!match) { - for (i = 0; i < scan_res->num; i++) { - struct wpa_scan_res *bss = scan_res->res[i]; -- ieee80211n_get_pri_sec_chan(bss, &pri_chan, &sec_chan); -+ ieee80211n_get_pri_sec_chan(bss, &bss_pri_chan, &bss_sec_chan); - if (pri_chan == bss_sec_chan && - sec_chan == bss_pri_chan) { - wpa_printf(MSG_INFO, "Switch own primary and " diff --git a/package/hostapd/patches/150-ht_cap_endian.patch b/package/hostapd/patches/150-ht_cap_endian.patch deleted file mode 100644 index d8f3856ee..000000000 --- a/package/hostapd/patches/150-ht_cap_endian.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- a/hostapd/ieee802_11.c -+++ b/hostapd/ieee802_11.c -@@ -1586,24 +1586,16 @@ hostapd_get_ht_capab(struct hostapd_data - struct ht_cap_ie *ht_cap_ie, - struct ht_cap_ie *neg_ht_cap_ie) - { -+ u16 cap; - - os_memcpy(neg_ht_cap_ie, ht_cap_ie, sizeof(struct ht_cap_ie)); -- neg_ht_cap_ie->data.capabilities_info = -- ht_cap_ie->data.capabilities_info & hapd->iconf->ht_capab; -- -- neg_ht_cap_ie->data.capabilities_info &= ~HT_CAP_INFO_SMPS_DISABLED; -- if ((ht_cap_ie->data.capabilities_info & HT_CAP_INFO_SMPS_DISABLED) == -- (hapd->iconf->ht_capab & HT_CAP_INFO_SMPS_DISABLED)) -- neg_ht_cap_ie->data.capabilities_info |= -- hapd->iconf->ht_capab & HT_CAP_INFO_SMPS_DISABLED; -- else -- neg_ht_cap_ie->data.capabilities_info |= -- HT_CAP_INFO_SMPS_DISABLED; -+ cap = le_to_host16(neg_ht_cap_ie->data.capabilities_info); -+ cap &= hapd->iconf->ht_capab; -+ cap |= (hapd->iconf->ht_capab & HT_CAP_INFO_SMPS_DISABLED); - - /* FIXME: Rx STBC needs to be handled specially */ -- neg_ht_cap_ie->data.capabilities_info &= ~HT_CAP_INFO_RX_STBC_MASK; -- neg_ht_cap_ie->data.capabilities_info |= -- hapd->iconf->ht_capab & HT_CAP_INFO_RX_STBC_MASK; -+ cap |= (hapd->iconf->ht_capab & HT_CAP_INFO_RX_STBC_MASK); -+ neg_ht_cap_ie->data.capabilities_info = host_to_le16(cap); - } - #endif /* CONFIG_IEEE80211N */ - From 785fefeaea7a60302d00940aa5d633c8e03a004d Mon Sep 17 00:00:00 2001 From: kaloz Date: Mon, 30 Nov 2009 10:32:20 +0000 Subject: [PATCH 284/288] upgrade x86 to 2.6.31.6, resync patches git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18609 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- include/kernel-version.mk | 4 +- .../020-mips_multi_machine_support.patch | 2 +- .../patches-2.6.31/032-mips_vmlinux_lds.patch | 30 ++---------- ...t_h_fix_usage_for_compressed_kernels.patch | 7 --- .../050-lzo_compressed_kernels.patch | 12 ----- .../051-lzo_compressed_kernel_for_arm.patch | 19 +------- .../052-lzo_compressed_kernel_for_x86.patch | 8 +--- .../053-lzo_compression_for_initramfs.patch | 14 ++---- .../patches-2.6.31/055-lzma_arm_kernel.patch | 14 +----- .../patches-2.6.31/270-sched_bfs.patch | 4 +- .../977-textsearch_kconfig_hacks.patch | 2 +- .../998-openwrt_lzma_options.patch | 4 +- target/linux/x86/Makefile | 2 +- .../patches-2.6.31/100-pata_sc1200-wrap.patch | 11 ----- .../patches-2.6.31/300-block2mtd_init.patch | 48 ++++++++----------- 15 files changed, 39 insertions(+), 142 deletions(-) delete mode 100644 target/linux/x86/patches-2.6.31/100-pata_sc1200-wrap.patch diff --git a/include/kernel-version.mk b/include/kernel-version.mk index ad4f36d07..4562d5a38 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -22,8 +22,8 @@ endif ifeq ($(LINUX_VERSION),2.6.30.9) LINUX_KERNEL_MD5SUM:=5a4cd5543a9d7c1a819700b21be31ef1 endif -ifeq ($(LINUX_VERSION),2.6.31.5) - LINUX_KERNEL_MD5SUM:=926bff46d24e2f303e4ee92234e394d8 +ifeq ($(LINUX_VERSION),2.6.31.6) + LINUX_KERNEL_MD5SUM:=485472df88af84becdcf47f45de3ba46 endif # disable the md5sum check for unknown kernel versions diff --git a/target/linux/generic-2.6/patches-2.6.31/020-mips_multi_machine_support.patch b/target/linux/generic-2.6/patches-2.6.31/020-mips_multi_machine_support.patch index f36ae3855..5c70b548a 100644 --- a/target/linux/generic-2.6/patches-2.6.31/020-mips_multi_machine_support.patch +++ b/target/linux/generic-2.6/patches-2.6.31/020-mips_multi_machine_support.patch @@ -122,7 +122,7 @@ + --- a/arch/mips/kernel/Makefile +++ b/arch/mips/kernel/Makefile -@@ -85,6 +85,7 @@ obj-$(CONFIG_GPIO_TXX9) += gpio_txx9.o +@@ -87,6 +87,7 @@ obj-$(CONFIG_GPIO_TXX9) += gpio_txx9.o obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o obj-$(CONFIG_EARLY_PRINTK) += early_printk.o diff --git a/target/linux/generic-2.6/patches-2.6.31/032-mips_vmlinux_lds.patch b/target/linux/generic-2.6/patches-2.6.31/032-mips_vmlinux_lds.patch index 2ecf89dde..807a9444f 100644 --- a/target/linux/generic-2.6/patches-2.6.31/032-mips_vmlinux_lds.patch +++ b/target/linux/generic-2.6/patches-2.6.31/032-mips_vmlinux_lds.patch @@ -1,35 +1,11 @@ --- a/arch/mips/kernel/Makefile +++ b/arch/mips/kernel/Makefile -@@ -2,6 +2,8 @@ - # Makefile for the Linux/MIPS kernel. - # +@@ -4,6 +4,8 @@ + + CPPFLAGS_vmlinux.lds := $(KBUILD_CFLAGS) +CPPFLAGS_vmlinux.lds := $(KBUILD_CFLAGS) $(EXTRA_LDSFLAGS) + extra-y := head.o init_task.o vmlinux.lds obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \ ---- a/arch/mips/kernel/vmlinux.lds.S -+++ b/arch/mips/kernel/vmlinux.lds.S -@@ -10,15 +10,15 @@ PHDRS { - note PT_NOTE FLAGS(4); /* R__ */ - } - --ifdef CONFIG_32BIT -- ifdef CONFIG_CPU_LITTLE_ENDIAN -+#ifdef CONFIG_32BIT -+ #ifdef CONFIG_CPU_LITTLE_ENDIAN - jiffies = jiffies_64; -- else -+ #else - jiffies = jiffies_64 + 4; -- endif --else -+ #endif -+#else - jiffies = jiffies_64; --endif -+#endif - - SECTIONS - { diff --git a/target/linux/generic-2.6/patches-2.6.31/049-byteshift_h_fix_usage_for_compressed_kernels.patch b/target/linux/generic-2.6/patches-2.6.31/049-byteshift_h_fix_usage_for_compressed_kernels.patch index 102a82982..5cd81070e 100644 --- a/target/linux/generic-2.6/patches-2.6.31/049-byteshift_h_fix_usage_for_compressed_kernels.patch +++ b/target/linux/generic-2.6/patches-2.6.31/049-byteshift_h_fix_usage_for_compressed_kernels.patch @@ -48,8 +48,6 @@ Signed-off-by: Linus Torvalds include/linux/unaligned/le_byteshift.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -diff --git a/include/linux/unaligned/be_byteshift.h b/include/linux/unaligned/be_byteshift.h -index 46dd12c..9356b24 100644 --- a/include/linux/unaligned/be_byteshift.h +++ b/include/linux/unaligned/be_byteshift.h @@ -1,7 +1,7 @@ @@ -61,8 +59,6 @@ index 46dd12c..9356b24 100644 static inline u16 __get_unaligned_be16(const u8 *p) { -diff --git a/include/linux/unaligned/le_byteshift.h b/include/linux/unaligned/le_byteshift.h -index 59777e9..be376fb 100644 --- a/include/linux/unaligned/le_byteshift.h +++ b/include/linux/unaligned/le_byteshift.h @@ -1,7 +1,7 @@ @@ -74,6 +70,3 @@ index 59777e9..be376fb 100644 static inline u16 __get_unaligned_le16(const u8 *p) { --- -1.6.5.1 - diff --git a/target/linux/generic-2.6/patches-2.6.31/050-lzo_compressed_kernels.patch b/target/linux/generic-2.6/patches-2.6.31/050-lzo_compressed_kernels.patch index fad1b8746..733d1756f 100644 --- a/target/linux/generic-2.6/patches-2.6.31/050-lzo_compressed_kernels.patch +++ b/target/linux/generic-2.6/patches-2.6.31/050-lzo_compressed_kernels.patch @@ -1,6 +1,3 @@ -diff --git a/include/linux/decompress/unlzo.h b/include/linux/decompress/unlzo.h -new file mode 100644 -index 0000000..9872297 --- /dev/null +++ b/include/linux/decompress/unlzo.h @@ -0,0 +1,10 @@ @@ -14,8 +11,6 @@ index 0000000..9872297 + int *pos, + void(*error)(char *x)); +#endif -diff --git a/init/Kconfig b/init/Kconfig -index f515864..eb65318 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -115,10 +115,13 @@ config HAVE_KERNEL_BZIP2 @@ -60,9 +55,6 @@ index f515864..eb65318 100644 endchoice config SWAP -diff --git a/lib/decompress_unlzo.c b/lib/decompress_unlzo.c -new file mode 100644 -index 0000000..2bb736f --- /dev/null +++ b/lib/decompress_unlzo.c @@ -0,0 +1,208 @@ @@ -274,8 +266,6 @@ index 0000000..2bb736f +} + +#define decompress unlzo -diff --git a/lib/lzo/lzo1x_decompress.c b/lib/lzo/lzo1x_decompress.c -index 5dc6b29..f2fd098 100644 --- a/lib/lzo/lzo1x_decompress.c +++ b/lib/lzo/lzo1x_decompress.c @@ -11,11 +11,13 @@ @@ -306,8 +296,6 @@ index 5dc6b29..f2fd098 100644 MODULE_DESCRIPTION("LZO1X Decompressor"); +#endif -diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib -index ffdafb2..39c3483 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -230,3 +230,8 @@ quiet_cmd_lzma = LZMA $@ diff --git a/target/linux/generic-2.6/patches-2.6.31/051-lzo_compressed_kernel_for_arm.patch b/target/linux/generic-2.6/patches-2.6.31/051-lzo_compressed_kernel_for_arm.patch index f155c0a1b..49512bb41 100644 --- a/target/linux/generic-2.6/patches-2.6.31/051-lzo_compressed_kernel_for_arm.patch +++ b/target/linux/generic-2.6/patches-2.6.31/051-lzo_compressed_kernel_for_arm.patch @@ -1,5 +1,3 @@ -diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig -index 1c4119c..350921d 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -18,6 +18,8 @@ config ARM @@ -11,8 +9,6 @@ index 1c4119c..350921d 100644 help The ARM series is a line of low-power-consumption RISC chip designs licensed by ARM Ltd and targeted at embedded applications and -diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile -index ce39dc5..5b4629b 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -63,8 +63,12 @@ endif @@ -69,8 +65,6 @@ index ce39dc5..5b4629b 100644 CFLAGS_font.o := -Dstatic= -diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c -index 17153b5..7e0fe4d 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c @@ -18,10 +18,15 @@ @@ -89,7 +83,7 @@ index 17153b5..7e0fe4d 100644 #ifdef STANDALONE_DEBUG #define putstr printf -@@ -188,34 +193,8 @@ static inline __ptr_t memcpy(__ptr_t __dest, __const __ptr_t __src, +@@ -188,34 +193,8 @@ static inline __ptr_t memcpy(__ptr_t __d /* * gzip delarations */ @@ -124,7 +118,7 @@ index 17153b5..7e0fe4d 100644 /* Diagnostic functions */ #ifdef DEBUG # define Assert(cond,msg) {if(!(cond)) error(msg);} -@@ -233,24 +212,20 @@ static unsigned outcnt; /* bytes in output buffer */ +@@ -233,24 +212,20 @@ static unsigned outcnt; /* bytes in out # define Tracecv(c,x) #endif @@ -260,9 +254,6 @@ index 17153b5..7e0fe4d 100644 } #endif - -diff --git a/arch/arm/boot/compressed/piggy.S b/arch/arm/boot/compressed/piggy.S -deleted file mode 100644 -index 54c9518..0000000 --- a/arch/arm/boot/compressed/piggy.S +++ /dev/null @@ -1,6 +0,0 @@ @@ -272,9 +263,6 @@ index 54c9518..0000000 - .incbin "arch/arm/boot/compressed/piggy.gz" - .globl input_data_end -input_data_end: -diff --git a/arch/arm/boot/compressed/piggy.gzip.S b/arch/arm/boot/compressed/piggy.gzip.S -new file mode 100644 -index 0000000..a68adf9 --- /dev/null +++ b/arch/arm/boot/compressed/piggy.gzip.S @@ -0,0 +1,6 @@ @@ -284,9 +272,6 @@ index 0000000..a68adf9 + .incbin "arch/arm/boot/compressed/piggy.gzip" + .globl input_data_end +input_data_end: -diff --git a/arch/arm/boot/compressed/piggy.lzo.S b/arch/arm/boot/compressed/piggy.lzo.S -new file mode 100644 -index 0000000..a425ad9 --- /dev/null +++ b/arch/arm/boot/compressed/piggy.lzo.S @@ -0,0 +1,6 @@ diff --git a/target/linux/generic-2.6/patches-2.6.31/052-lzo_compressed_kernel_for_x86.patch b/target/linux/generic-2.6/patches-2.6.31/052-lzo_compressed_kernel_for_x86.patch index bfefe8bfd..ea7d2400b 100644 --- a/target/linux/generic-2.6/patches-2.6.31/052-lzo_compressed_kernel_for_x86.patch +++ b/target/linux/generic-2.6/patches-2.6.31/052-lzo_compressed_kernel_for_x86.patch @@ -1,5 +1,3 @@ -diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig -index 72ace95..89f7771 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -49,6 +49,7 @@ config X86 @@ -10,8 +8,6 @@ index 72ace95..89f7771 100644 select HAVE_ARCH_KMEMCHECK config OUTPUT_FORMAT -diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile -index f8ed065..0e835d0 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile @@ -4,7 +4,7 @@ @@ -23,7 +19,7 @@ index f8ed065..0e835d0 100644 KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 KBUILD_CFLAGS += -fno-strict-aliasing -fPIC -@@ -48,10 +48,13 @@ $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE +@@ -48,10 +48,13 @@ $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.al $(call if_changed,bzip2) $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE $(call if_changed,lzma) @@ -37,8 +33,6 @@ index f8ed065..0e835d0 100644 quiet_cmd_mkpiggy = MKPIGGY $@ cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false ) -diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c -index 842b2a3..3b22fe8 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c @@ -162,6 +162,10 @@ static int lines, cols; diff --git a/target/linux/generic-2.6/patches-2.6.31/053-lzo_compression_for_initramfs.patch b/target/linux/generic-2.6/patches-2.6.31/053-lzo_compression_for_initramfs.patch index f0d8ff39f..3445b4ae9 100644 --- a/target/linux/generic-2.6/patches-2.6.31/053-lzo_compression_for_initramfs.patch +++ b/target/linux/generic-2.6/patches-2.6.31/053-lzo_compression_for_initramfs.patch @@ -1,10 +1,8 @@ -diff --git a/lib/Kconfig b/lib/Kconfig -index bb1326d..8639349 100644 --- a/lib/Kconfig +++ b/lib/Kconfig -@@ -117,6 +117,10 @@ config DECOMPRESS_BZIP2 - config DECOMPRESS_LZMA - tristate +@@ -120,6 +120,10 @@ config DECOMPRESS_LZMA + config DECOMPRESS_LZMA_NEEDED + boolean +config DECOMPRESS_LZO + select LZO_DECOMPRESS @@ -13,8 +11,6 @@ index bb1326d..8639349 100644 # # Generic allocator support is selected if needed # -diff --git a/lib/Makefile b/lib/Makefile -index 2e78277..cfa4041 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -69,6 +69,7 @@ obj-$(CONFIG_LZO_DECOMPRESS) += lzo/ @@ -25,8 +21,6 @@ index 2e78277..cfa4041 100644 obj-$(CONFIG_TEXTSEARCH) += textsearch.o obj-$(CONFIG_TEXTSEARCH_KMP) += ts_kmp.o -diff --git a/lib/decompress.c b/lib/decompress.c -index d2842f5..a760681 100644 --- a/lib/decompress.c +++ b/lib/decompress.c @@ -9,6 +9,7 @@ @@ -55,8 +49,6 @@ index d2842f5..a760681 100644 { {0, 0}, NULL, NULL } }; -diff --git a/usr/Kconfig b/usr/Kconfig -index 1c3039f..e2721f5 100644 --- a/usr/Kconfig +++ b/usr/Kconfig @@ -72,6 +72,15 @@ config RD_LZMA diff --git a/target/linux/generic-2.6/patches-2.6.31/055-lzma_arm_kernel.patch b/target/linux/generic-2.6/patches-2.6.31/055-lzma_arm_kernel.patch index 1f3962892..a0111bd55 100644 --- a/target/linux/generic-2.6/patches-2.6.31/055-lzma_arm_kernel.patch +++ b/target/linux/generic-2.6/patches-2.6.31/055-lzma_arm_kernel.patch @@ -13,8 +13,6 @@ Signed-off-by: Albin Tonnerre 4 files changed, 12 insertions(+), 0 deletions(-) create mode 100644 arch/arm/boot/compressed/piggy.lzma.S -diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig -index ea71c0c..f5bf779 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -20,6 +20,7 @@ config ARM @@ -25,11 +23,9 @@ index ea71c0c..f5bf779 100644 help The ARM series is a line of low-power-consumption RISC chip designs licensed by ARM Ltd and targeted at embedded applications and -diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile -index 5b4629b..dcfcb74 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile -@@ -65,6 +65,7 @@ SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ +@@ -65,6 +65,7 @@ SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/ suffix_$(CONFIG_KERNEL_GZIP) = gzip suffix_$(CONFIG_KERNEL_LZO) = lzo @@ -37,8 +33,6 @@ index 5b4629b..dcfcb74 100644 targets := vmlinux vmlinux.lds \ piggy.$(suffix_y) piggy.$(suffix_y).o \ -diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c -index 7e0fe4d..4e35a10 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c @@ -237,6 +237,10 @@ static unsigned long free_mem_end_ptr; @@ -52,9 +46,6 @@ index 7e0fe4d..4e35a10 100644 #ifdef CONFIG_KERNEL_LZO #include "../../../../lib/decompress_unlzo.c" #endif -diff --git a/arch/arm/boot/compressed/piggy.lzma.S b/arch/arm/boot/compressed/piggy.lzma.S -new file mode 100644 -index 0000000..d7e69cf --- /dev/null +++ b/arch/arm/boot/compressed/piggy.lzma.S @@ -0,0 +1,6 @@ @@ -64,6 +55,3 @@ index 0000000..d7e69cf + .incbin "arch/arm/boot/compressed/piggy.lzma" + .globl input_data_end +input_data_end: --- -1.6.5 - diff --git a/target/linux/generic-2.6/patches-2.6.31/270-sched_bfs.patch b/target/linux/generic-2.6/patches-2.6.31/270-sched_bfs.patch index c045ae3ab..9f30674ef 100644 --- a/target/linux/generic-2.6/patches-2.6.31/270-sched_bfs.patch +++ b/target/linux/generic-2.6/patches-2.6.31/270-sched_bfs.patch @@ -176,7 +176,7 @@ This patch adds support for bfs v230, modified for diff size reduction #define sched_exec() {} --- a/init/Kconfig +++ b/init/Kconfig -@@ -441,9 +441,22 @@ config LOG_BUF_SHIFT +@@ -451,9 +451,22 @@ config LOG_BUF_SHIFT config HAVE_UNSTABLE_SCHED_CLOCK bool @@ -199,7 +199,7 @@ This patch adds support for bfs v230, modified for diff size reduction default n help This feature lets CPU scheduler recognize task groups and control CPU -@@ -494,6 +507,7 @@ endchoice +@@ -504,6 +517,7 @@ endchoice menuconfig CGROUPS boolean "Control Group support" diff --git a/target/linux/generic-2.6/patches-2.6.31/977-textsearch_kconfig_hacks.patch b/target/linux/generic-2.6/patches-2.6.31/977-textsearch_kconfig_hacks.patch index 97fad7dfe..94d6b91d8 100644 --- a/target/linux/generic-2.6/patches-2.6.31/977-textsearch_kconfig_hacks.patch +++ b/target/linux/generic-2.6/patches-2.6.31/977-textsearch_kconfig_hacks.patch @@ -1,6 +1,6 @@ --- a/lib/Kconfig +++ b/lib/Kconfig -@@ -148,16 +148,16 @@ config REED_SOLOMON_DEC16 +@@ -152,16 +152,16 @@ config REED_SOLOMON_DEC16 # Textsearch support is select'ed if needed # config TEXTSEARCH diff --git a/target/linux/generic-2.6/patches-2.6.31/998-openwrt_lzma_options.patch b/target/linux/generic-2.6/patches-2.6.31/998-openwrt_lzma_options.patch index f9108f271..08bb83a43 100644 --- a/target/linux/generic-2.6/patches-2.6.31/998-openwrt_lzma_options.patch +++ b/target/linux/generic-2.6/patches-2.6.31/998-openwrt_lzma_options.patch @@ -1,12 +1,14 @@ --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib -@@ -228,5 +228,5 @@ cmd_bzip2 = (cat $(filter-out FORCE,$^) +@@ -228,7 +228,7 @@ cmd_bzip2 = (cat $(filter-out FORCE,$^) quiet_cmd_lzma = LZMA $@ cmd_lzma = (cat $(filter-out FORCE,$^) | \ - lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ + lzma e -lc1 -lp2 -pb2 -eos -si -so && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ (rm -f $@ ; false) + + quiet_cmd_lzo = LZO $@ --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh @@ -225,7 +225,7 @@ cpio_list= diff --git a/target/linux/x86/Makefile b/target/linux/x86/Makefile index e90680799..94a259fe8 100644 --- a/target/linux/x86/Makefile +++ b/target/linux/x86/Makefile @@ -12,7 +12,7 @@ BOARDNAME:=x86 FEATURES:=squashfs jffs2 ext2 vdi vmdk pcmcia tgz SUBTARGETS=generic olpc -LINUX_VERSION:=2.6.31.5 +LINUX_VERSION:=2.6.31.6 include $(INCLUDE_DIR)/target.mk diff --git a/target/linux/x86/patches-2.6.31/100-pata_sc1200-wrap.patch b/target/linux/x86/patches-2.6.31/100-pata_sc1200-wrap.patch deleted file mode 100644 index 066694b35..000000000 --- a/target/linux/x86/patches-2.6.31/100-pata_sc1200-wrap.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/drivers/ata/pata_sc1200.c -+++ b/drivers/ata/pata_sc1200.c -@@ -236,7 +236,7 @@ static int sc1200_init_one(struct pci_de - .port_ops = &sc1200_port_ops - }; - /* Can't enable port 2 yet, see top comments */ -- const struct ata_port_info *ppi[] = { &info, }; -+ const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info }; - - return ata_pci_sff_init_one(dev, ppi, &sc1200_sht, NULL); - } diff --git a/target/linux/x86/patches-2.6.31/300-block2mtd_init.patch b/target/linux/x86/patches-2.6.31/300-block2mtd_init.patch index 29e4037c8..123a9d305 100644 --- a/target/linux/x86/patches-2.6.31/300-block2mtd_init.patch +++ b/target/linux/x86/patches-2.6.31/300-block2mtd_init.patch @@ -1,8 +1,6 @@ -Index: linux-2.6.31.5/arch/x86/kernel/vmlinux.lds.S -=================================================================== ---- linux-2.6.31.5.orig/arch/x86/kernel/vmlinux.lds.S 2009-10-23 00:57:56.000000000 +0200 -+++ linux-2.6.31.5/arch/x86/kernel/vmlinux.lds.S 2009-11-07 14:31:54.000000000 +0100 -@@ -244,6 +244,12 @@ +--- a/arch/x86/kernel/vmlinux.lds.S ++++ b/arch/x86/kernel/vmlinux.lds.S +@@ -244,6 +244,12 @@ SECTIONS __initcall_end = .; } @@ -15,10 +13,8 @@ Index: linux-2.6.31.5/arch/x86/kernel/vmlinux.lds.S .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) { __con_initcall_start = .; *(.con_initcall.init) -Index: linux-2.6.31.5/drivers/mtd/devices/block2mtd.c -=================================================================== ---- linux-2.6.31.5.orig/drivers/mtd/devices/block2mtd.c 2009-11-07 14:30:57.000000000 +0100 -+++ linux-2.6.31.5/drivers/mtd/devices/block2mtd.c 2009-11-07 14:31:19.000000000 +0100 +--- a/drivers/mtd/devices/block2mtd.c ++++ b/drivers/mtd/devices/block2mtd.c @@ -18,10 +18,18 @@ #include #include @@ -38,7 +34,7 @@ Index: linux-2.6.31.5/drivers/mtd/devices/block2mtd.c /* Info for the block device */ struct block2mtd_dev { -@@ -33,10 +41,34 @@ +@@ -33,10 +41,34 @@ struct block2mtd_dev { char devname[0]; }; @@ -73,7 +69,7 @@ Index: linux-2.6.31.5/drivers/mtd/devices/block2mtd.c static struct page *page_read(struct address_space *mapping, int index) { -@@ -511,7 +543,9 @@ +@@ -511,7 +543,9 @@ static int block2mtd_setup2(const char * if (token[2] && (strlen(token[2]) + 1 > 80)) parse_err("mtd device name too long"); @@ -84,10 +80,8 @@ Index: linux-2.6.31.5/drivers/mtd/devices/block2mtd.c return 0; } -Index: linux-2.6.31.5/include/asm-generic/vmlinux.lds.h -=================================================================== ---- linux-2.6.31.5.orig/include/asm-generic/vmlinux.lds.h 2009-11-07 14:30:57.000000000 +0100 -+++ linux-2.6.31.5/include/asm-generic/vmlinux.lds.h 2009-11-07 14:31:19.000000000 +0100 +--- a/include/asm-generic/vmlinux.lds.h ++++ b/include/asm-generic/vmlinux.lds.h @@ -622,12 +622,14 @@ *(.initcall4s.init) \ *(.initcall5.init) \ @@ -104,11 +98,9 @@ Index: linux-2.6.31.5/include/asm-generic/vmlinux.lds.h #define INIT_CALLS \ VMLINUX_SYMBOL(__initcall_start) = .; \ INITCALLS \ -Index: linux-2.6.31.5/init/do_mounts.c -=================================================================== ---- linux-2.6.31.5.orig/init/do_mounts.c 2009-10-23 00:57:56.000000000 +0200 -+++ linux-2.6.31.5/init/do_mounts.c 2009-11-07 14:31:19.000000000 +0100 -@@ -176,16 +176,8 @@ +--- a/init/do_mounts.c ++++ b/init/do_mounts.c +@@ -176,16 +176,8 @@ static int __init fs_names_setup(char *s return 1; } @@ -125,7 +117,7 @@ Index: linux-2.6.31.5/init/do_mounts.c static void __init get_fs_names(char *page) { -@@ -366,23 +358,6 @@ +@@ -366,23 +358,6 @@ void __init prepare_namespace(void) { int is_floppy; @@ -149,10 +141,8 @@ Index: linux-2.6.31.5/init/do_mounts.c if (saved_root_name[0]) { root_device_name = saved_root_name; if (!strncmp(root_device_name, "mtd", 3) || -Index: linux-2.6.31.5/init/main.c -=================================================================== ---- linux-2.6.31.5.orig/init/main.c 2009-11-07 14:30:59.000000000 +0100 -+++ linux-2.6.31.5/init/main.c 2009-11-07 14:31:19.000000000 +0100 +--- a/init/main.c ++++ b/init/main.c @@ -79,6 +79,7 @@ #ifdef CONFIG_X86_LOCAL_APIC #include @@ -161,7 +151,7 @@ Index: linux-2.6.31.5/init/main.c static int kernel_init(void *); -@@ -784,12 +785,13 @@ +@@ -784,12 +785,13 @@ int do_one_initcall(initcall_t fn) extern initcall_t __initcall_start[], __initcall_end[], __early_initcall_end[]; @@ -177,7 +167,7 @@ Index: linux-2.6.31.5/init/main.c do_one_initcall(*call); /* Make sure there is no pending stuff from the initcall sequence */ -@@ -812,7 +814,7 @@ +@@ -812,7 +814,7 @@ static void __init do_basic_setup(void) driver_init(); init_irq_proc(); do_ctors(); @@ -186,7 +176,7 @@ Index: linux-2.6.31.5/init/main.c } static void __init do_pre_smp_initcalls(void) -@@ -873,6 +875,13 @@ +@@ -873,6 +875,13 @@ static noinline int init_post(void) panic("No init found. Try passing init= option to kernel."); } @@ -200,7 +190,7 @@ Index: linux-2.6.31.5/init/main.c static int __init kernel_init(void * unused) { lock_kernel(); -@@ -917,7 +926,16 @@ +@@ -917,7 +926,16 @@ static int __init kernel_init(void * unu if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) { ramdisk_execute_command = NULL; From 29288d352b1d01990a96fb2eaafff380d7844993 Mon Sep 17 00:00:00 2001 From: kaloz Date: Mon, 30 Nov 2009 11:01:53 +0000 Subject: [PATCH 285/288] add some more symbols to the generic 2.6.32 config git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18611 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic-2.6/config-2.6.32 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/target/linux/generic-2.6/config-2.6.32 b/target/linux/generic-2.6/config-2.6.32 index 542b5e44b..146c853f8 100644 --- a/target/linux/generic-2.6/config-2.6.32 +++ b/target/linux/generic-2.6/config-2.6.32 @@ -671,6 +671,7 @@ CONFIG_HAVE_MLOCK=y # CONFIG_HID_SUPPORT is not set # CONFIG_HID_THRUSTMASTER is not set # CONFIG_HID_TOPSEED is not set +# CONFIG_HID_TWINHAN is not set # CONFIG_HID_ZEROPLUS is not set # CONFIG_HIGHMEM is not set CONFIG_HIGH_RES_TIMERS=y @@ -696,6 +697,7 @@ CONFIG_HOTPLUG=y # CONFIG_HW_RANDOM_INTEL is not set # CONFIG_HW_RANDOM_TIMERIOMEM is not set # CONFIG_HW_RANDOM_VIA is not set +# CONFIG_HYPERV is not set CONFIG_HZ=100 # CONFIG_HZ_1000 is not set CONFIG_HZ_100=y @@ -854,6 +856,7 @@ CONFIG_INPUT_MISC=y # CONFIG_INPUT_TOUCHSCREEN is not set # CONFIG_INPUT_TSDEV is not set # CONFIG_INPUT_UINPUT is not set +# CONFIG_INPUT_WINBOND_CIR is not set # CONFIG_INPUT_WISTRON_BTNS is not set # CONFIG_INSTRUMENTATION is not set # CONFIG_IOSCHED_AS is not set @@ -1048,6 +1051,7 @@ CONFIG_KERNEL_LZMA=y # CONFIG_KERNEL_LZO is not set # CONFIG_KEXEC is not set # CONFIG_KEYBOARD_LM8323 is not set +# CONFIG_KEYBOARD_OPENCORES is not set # CONFIG_KEYS is not set # CONFIG_KMEMTRACE is not set CONFIG_KMOD=y @@ -1128,6 +1132,7 @@ CONFIG_MAC80211_DEFAULT_PS=y # CONFIG_MEGARAID_NEWGEN is not set # CONFIG_MEGARAID_SAS is not set # CONFIG_MEILHAUS is not set +# CONFIG_MEMORY_FAILURE is not set # CONFIG_MEMSTICK is not set # CONFIG_MFD_ASIC3 is not set # CONFIG_MFD_CORE is not set @@ -1176,6 +1181,7 @@ CONFIG_MODULE_UNLOAD=y # CONFIG_MOUSE_INPORT is not set # CONFIG_MOUSE_LOGIBM is not set # CONFIG_MOUSE_PC110PAD is not set +# CONFIG_MOUSE_PS2_SENTELIC is not set # CONFIG_MOUSE_SYNAPTICS_I2C is not set # CONFIG_MSDOS_FS is not set CONFIG_MSDOS_PARTITION=y @@ -1285,13 +1291,13 @@ CONFIG_NET_CLS_IND=y # CONFIG_NET_CLS_TCINDEX is not set # CONFIG_NET_CLS_U32 is not set CONFIG_NET_CLS=y -# CONFIG_NET_DROP_MONITOR is not set # CONFIG_NETCONSOLE is not set # CONFIG_NETDEBUG is not set # CONFIG_NETDEV_10000 is not set CONFIG_NETDEV_1000=y CONFIG_NETDEVICES_MULTIQUEUE=y CONFIG_NETDEVICES=y +# CONFIG_NET_DROP_MONITOR is not set # CONFIG_NET_DSA is not set # CONFIG_NET_EMATCH_CMP is not set # CONFIG_NET_EMATCH is not set @@ -1728,6 +1734,7 @@ CONFIG_RD_LZMA=y # CONFIG_RT2870 is not set # CONFIG_RT2X00 is not set # CONFIG_RT3070 is not set +# CONFIG_RT3090 is not set # CONFIG_RTC_CLASS is not set # CONFIG_RTC_DEBUG is not set # CONFIG_RTC_DRV_BQ4802 is not set @@ -1797,6 +1804,7 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y # CONFIG_SATA_ULI is not set # CONFIG_SATA_VIA is not set # CONFIG_SATA_VITESSE is not set +# CONFIG_SBC_FITPC2_WATCHDOG is not set # CONFIG_SC92031 is not set # CONFIG_SCC is not set # CONFIG_SCHED_BFS is not set @@ -1978,6 +1986,7 @@ CONFIG_SERIAL_CORE=y # CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set # CONFIG_SERIAL_UARTLITE is not set # CONFIG_SERIO is not set +# CONFIG_SFI is not set # CONFIG_SGI_IOC4 is not set # CONFIG_SGI_PARTITION is not set # CONFIG_SHAPER is not set @@ -2631,6 +2640,7 @@ CONFIG_VLAN_8021Q=y # CONFIG_VMSPLIT_2G_OPT is not set # CONFIG_VMSPLIT_3G_OPT is not set CONFIG_VMSPLIT_3G=y +# CONFIG_VMXNET3 is not set # CONFIG_VT6655 is not set # CONFIG_VT6656 is not set # CONFIG_VT is not set From c6dd3f4df6cbc176128f8d83407586720983cbfc Mon Sep 17 00:00:00 2001 From: kaloz Date: Mon, 30 Nov 2009 11:05:18 +0000 Subject: [PATCH 286/288] [x86]: enable ACPI/HPET/MSI in the generic config git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18612 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/x86/config-2.6.31 | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/target/linux/x86/config-2.6.31 b/target/linux/x86/config-2.6.31 index 6616001d9..31e015aee 100644 --- a/target/linux/x86/config-2.6.31 +++ b/target/linux/x86/config-2.6.31 @@ -3,6 +3,26 @@ CONFIG_4KSTACKS=y # CONFIG_60XX_WDT is not set # CONFIG_64BIT is not set # CONFIG_AC3200 is not set +# CONFIG_ACPI_AC is not set +# CONFIG_ACPI_ASUS is not set +# CONFIG_ACPI_BATTERY is not set +CONFIG_ACPI_BLACKLIST_YEAR=0 +# CONFIG_ACPI_BUTTON is not set +# CONFIG_ACPI_CONTAINER is not set +# CONFIG_ACPI_DEBUG is not set +# CONFIG_ACPI_DOCK is not set +# CONFIG_ACPI_FAN is not set +# CONFIG_ACPI_PCI_SLOT is not set +CONFIG_ACPI_PROCESSOR=y +# CONFIG_ACPI_PROC_EVENT is not set +# CONFIG_ACPI_PROCFS is not set +# CONFIG_ACPI_PROCFS_POWER is not set +# CONFIG_ACPI_SBS is not set +CONFIG_ACPI_SYSFS_POWER=y +CONFIG_ACPI_THERMAL=y +# CONFIG_ACPI_TOSHIBA is not set +# CONFIG_ACPI_WMI is not set +CONFIG_ACPI=y # CONFIG_ACQUIRE_WDT is not set # CONFIG_ADVANTECH_WDT is not set # CONFIG_AGP is not set @@ -25,6 +45,7 @@ CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_WANT_FRAME_POINTERS=y CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +# CONFIG_ASUS_LAPTOP is not set # CONFIG_AT1700 is not set CONFIG_ATA_GENERIC=y CONFIG_ATA_PIIX=y @@ -77,6 +98,7 @@ CONFIG_DEFAULT_IO_DELAY_TYPE=0 # CONFIG_DEPCA is not set CONFIG_DEVPORT=y # CONFIG_DMA_API_DEBUG is not set +# CONFIG_DMAR is not set # CONFIG_DMIID is not set CONFIG_DMI=y CONFIG_DNOTIFY=y @@ -86,6 +108,8 @@ CONFIG_DUMMY_CONSOLE=y CONFIG_EARLY_PRINTK=y # CONFIG_EDAC is not set # CONFIG_EDD is not set +# CONFIG_EEEPC_LAPTOP is not set +# CONFIG_EFI is not set # CONFIG_EISA is not set # CONFIG_EL16 is not set # CONFIG_EL1 is not set @@ -152,12 +176,15 @@ CONFIG_HAVE_MMIOTRACE_SUPPORT=y CONFIG_HAVE_OPROFILE=y CONFIG_HAVE_SETUP_PER_CPU_AREA=y CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y +# CONFIG_HIBERNATION is not set CONFIG_HID_SUPPORT=y CONFIG_HID=y # CONFIG_HIGHMEM4G is not set # CONFIG_HIGHMEM64G is not set # CONFIG_HIGH_RES_TIMERS is not set +CONFIG_HPET_MMAP=y # CONFIG_HPET_TIMER is not set +CONFIG_HPET=y # CONFIG_HP_WATCHDOG is not set CONFIG_HT_IRQ=y # CONFIG_HUGETLBFS is not set @@ -172,6 +199,7 @@ CONFIG_HW_RANDOM=y # CONFIG_IB700_WDT is not set # CONFIG_IBM_ASM is not set # CONFIG_IBMASR is not set +# CONFIG_IMA is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_INPUT_KEYBOARD=y CONFIG_INPUT_MOUSEDEV_PSAUX=y @@ -181,6 +209,7 @@ CONFIG_INPUT_MOUSEDEV=y CONFIG_INPUT_MOUSE=y CONFIG_INPUT=y # CONFIG_INPUT_YEALINK is not set +# CONFIG_INTEL_MENLOW is not set CONFIG_IO_DELAY_0X80=y # CONFIG_IO_DELAY_0XED is not set # CONFIG_IO_DELAY_NONE is not set @@ -299,14 +328,19 @@ CONFIG_PCI_GOANY=y # CONFIG_PCI_GODIRECT is not set # CONFIG_PCI_GOMMCONFIG is not set # CONFIG_PCI_GOOLPC is not set +CONFIG_PCI_MSI=y CONFIG_PCSPKR_PLATFORM=y # CONFIG_PCWATCHDOG is not set +# CONFIG_PDA_POWER is not set CONFIG_PHYSICAL_ALIGN=0x100000 CONFIG_PHYSICAL_START=0x1000000 +# CONFIG_PM_DEBUG is not set +CONFIG_PM=y # CONFIG_PNPACPI is not set # CONFIG_PNPBIOS is not set CONFIG_PNP_DEBUG_MESSAGES=y CONFIG_PNP=y +# CONFIG_POWER_SUPPLY_DEBUG is not set # CONFIG_PROCESSOR_SELECT is not set CONFIG_PROC_PAGE_MONITOR=y # CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set @@ -350,7 +384,10 @@ CONFIG_SLUB=y # CONFIG_SPARSE_IRQ is not set CONFIG_SPARSEMEM_STATIC=y CONFIG_STRICT_DEVMEM=y +# CONFIG_SUSPEND is not set +# CONFIG_TC1100_WMI is not set # CONFIG_TELCLOCK is not set +# CONFIG_THINKPAD_ACPI is not set # CONFIG_TOSHIBA is not set CONFIG_TRACING_SUPPORT=y # CONFIG_TYPHOON is not set @@ -372,6 +409,7 @@ CONFIG_VT=y CONFIG_X86_32_LAZY_GS=y CONFIG_X86_32=y # CONFIG_X86_64 is not set +# CONFIG_X86_ACPI_CPUFREQ is not set # CONFIG_X86_ANCIENT_MCE is not set # CONFIG_X86_CHECK_BIOS_CORRUPTION is not set # CONFIG_X86_CMPXCHG is not set @@ -391,6 +429,7 @@ CONFIG_X86_IO_APIC=y CONFIG_X86_L1_CACHE_BYTES=64 CONFIG_X86_L1_CACHE_SHIFT=4 CONFIG_X86_LOCAL_APIC=y +# CONFIG_X86_LONGHAUL is not set # CONFIG_X86_LONGRUN is not set CONFIG_X86_MCE_AMD=y # CONFIG_X86_MCE_INJECT is not set @@ -409,6 +448,7 @@ CONFIG_X86_PLATFORM_DEVICES=y CONFIG_X86_PM_TIMER=y # CONFIG_X86_POWERNOW_K6 is not set # CONFIG_X86_POWERNOW_K7 is not set +# CONFIG_X86_POWERNOW_K8 is not set CONFIG_X86_PPRO_FENCE=y # CONFIG_X86_RDC321X is not set # CONFIG_X86_REBOOTFIXUPS is not set From b490cdf270963d60db6166681e6b683a35b47a50 Mon Sep 17 00:00:00 2001 From: kaloz Date: Mon, 30 Nov 2009 11:45:37 +0000 Subject: [PATCH 287/288] refresh 2.6.32 patches with -rc8 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18613 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches-2.6.32/020-mips_multi_machine_support.patch | 2 +- .../patches-2.6.32/021-mips_image_cmdline_hack.patch | 2 +- .../generic-2.6/patches-2.6.32/025-mips_disable_fpu.patch | 4 ++-- .../generic-2.6/patches-2.6.32/150-netfilter_imq.patch | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/target/linux/generic-2.6/patches-2.6.32/020-mips_multi_machine_support.patch b/target/linux/generic-2.6/patches-2.6.32/020-mips_multi_machine_support.patch index 1b29290e5..3ffd2f331 100644 --- a/target/linux/generic-2.6/patches-2.6.32/020-mips_multi_machine_support.patch +++ b/target/linux/generic-2.6/patches-2.6.32/020-mips_multi_machine_support.patch @@ -132,7 +132,7 @@ --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -839,6 +839,9 @@ config MIPS_DISABLE_OBSOLETE_IDE +@@ -840,6 +840,9 @@ config MIPS_DISABLE_OBSOLETE_IDE config SYNC_R4K bool diff --git a/target/linux/generic-2.6/patches-2.6.32/021-mips_image_cmdline_hack.patch b/target/linux/generic-2.6/patches-2.6.32/021-mips_image_cmdline_hack.patch index b63c76304..5efd93d35 100644 --- a/target/linux/generic-2.6/patches-2.6.32/021-mips_image_cmdline_hack.patch +++ b/target/linux/generic-2.6/patches-2.6.32/021-mips_image_cmdline_hack.patch @@ -1,6 +1,6 @@ --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -842,6 +842,10 @@ config SYNC_R4K +@@ -843,6 +843,10 @@ config SYNC_R4K config MIPS_MACHINE def_bool n diff --git a/target/linux/generic-2.6/patches-2.6.32/025-mips_disable_fpu.patch b/target/linux/generic-2.6/patches-2.6.32/025-mips_disable_fpu.patch index 200b750af..43383916c 100644 --- a/target/linux/generic-2.6/patches-2.6.32/025-mips_disable_fpu.patch +++ b/target/linux/generic-2.6/patches-2.6.32/025-mips_disable_fpu.patch @@ -8,7 +8,7 @@ Signed-off-by: Florian Fainelli -- --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -827,6 +827,17 @@ config I8259 +@@ -828,6 +828,17 @@ config I8259 config MIPS_BONITO64 bool @@ -71,7 +71,7 @@ Signed-off-by: Florian Fainelli /* Control registers */ #define FPCREG_RID 0 /* $0 = revision id */ -@@ -1273,6 +1275,13 @@ int fpu_emulator_cop1Handler(struct pt_r +@@ -1274,6 +1276,13 @@ int fpu_emulator_cop1Handler(struct pt_r return sig; } diff --git a/target/linux/generic-2.6/patches-2.6.32/150-netfilter_imq.patch b/target/linux/generic-2.6/patches-2.6.32/150-netfilter_imq.patch index 6467a2423..23636699d 100644 --- a/target/linux/generic-2.6/patches-2.6.32/150-netfilter_imq.patch +++ b/target/linux/generic-2.6/patches-2.6.32/150-netfilter_imq.patch @@ -834,7 +834,7 @@ #include #include #include -@@ -1703,7 +1706,11 @@ int dev_hard_start_xmit(struct sk_buff * +@@ -1704,7 +1707,11 @@ int dev_hard_start_xmit(struct sk_buff * int rc; if (likely(!skb->next)) { @@ -847,7 +847,7 @@ dev_queue_xmit_nit(skb, dev); if (netif_needs_gso(dev, skb)) { -@@ -1788,8 +1795,7 @@ u16 skb_tx_hash(const struct net_device +@@ -1789,8 +1796,7 @@ u16 skb_tx_hash(const struct net_device } EXPORT_SYMBOL(skb_tx_hash); @@ -857,7 +857,7 @@ { const struct net_device_ops *ops = dev->netdev_ops; u16 queue_index = 0; -@@ -1802,6 +1808,7 @@ static struct netdev_queue *dev_pick_tx( +@@ -1803,6 +1809,7 @@ static struct netdev_queue *dev_pick_tx( skb_set_queue_mapping(skb, queue_index); return netdev_get_tx_queue(dev, queue_index); } @@ -1033,7 +1033,7 @@ new->csum = old->csum; new->local_df = old->local_df; new->pkt_type = old->pkt_type; -@@ -2775,6 +2864,13 @@ void __init skb_init(void) +@@ -2776,6 +2865,13 @@ void __init skb_init(void) 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); From 98a41238633bc693110f1a93fa71cc0b950f574e Mon Sep 17 00:00:00 2001 From: juhosg Date: Mon, 30 Nov 2009 13:53:39 +0000 Subject: [PATCH 288/288] ar71xx: override fifo_cfg[123] values on AR7240 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18614 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c | 6 ++++++ target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c | 8 ++++++-- .../files/arch/mips/include/asm/mach-ar71xx/platform.h | 4 ++++ .../linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c | 9 +++++++-- .../linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c | 8 ++++++-- 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c index 10f7e8ead..1d13ce94d 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c @@ -151,12 +151,18 @@ static void __init tl_wr741nd_setup(void) ar71xx_eth0_data.phy_mask = 0x0; ar71xx_eth0_data.speed = SPEED_100; ar71xx_eth0_data.duplex = DUPLEX_FULL; + ar71xx_eth0_data.fifo_cfg1 = 0x0fff0000; + ar71xx_eth0_data.fifo_cfg2 = 0x00001fff; + ar71xx_eth0_data.fifo_cfg3 = 0x008001ff; /* LAN ports */ ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; ar71xx_eth1_data.phy_mask = 0x0; ar71xx_eth1_data.speed = SPEED_1000; ar71xx_eth1_data.duplex = DUPLEX_FULL; + ar71xx_eth1_data.fifo_cfg1 = 0x0fff0000; + ar71xx_eth1_data.fifo_cfg2 = 0x00001fff; + ar71xx_eth1_data.fifo_cfg3 = 0x008001ff; ar71xx_add_device_eth(1); ar71xx_add_device_eth(0); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c index 9b70f8ddc..371ac0fc3 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c @@ -292,9 +292,11 @@ static void __init ubnt_m_setup(void) ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; ar71xx_eth0_data.phy_mask = 0; - ar71xx_eth0_data.speed = SPEED_100; ar71xx_eth0_data.duplex = DUPLEX_FULL; + ar71xx_eth0_data.fifo_cfg1 = 0x0010ffff; + ar71xx_eth0_data.fifo_cfg2 = 0x015500aa; + ar71xx_eth0_data.fifo_cfg3 = 0x01f00140; ar71xx_add_device_eth(0); @@ -325,9 +327,11 @@ static void __init ubnt_nano_m_setup(void) ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; ar71xx_eth1_data.phy_mask = 0; - ar71xx_eth1_data.speed = SPEED_1000; ar71xx_eth1_data.duplex = DUPLEX_FULL; + ar71xx_eth1_data.fifo_cfg1 = 0x0010ffff; + ar71xx_eth1_data.fifo_cfg2 = 0x015500aa; + ar71xx_eth1_data.fifo_cfg3 = 0x01f00140; ar71xx_add_device_eth(1); } diff --git a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/platform.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/platform.h index 52f41f47a..baded8b8b 100644 --- a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/platform.h +++ b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/platform.h @@ -33,6 +33,10 @@ struct ag71xx_platform_data { void (* ddr_flush)(void); void (* set_pll)(int speed); + + u32 fifo_cfg1; + u32 fifo_cfg2; + u32 fifo_cfg3; }; struct ag71xx_mdio_platform_data { diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c index 94420477c..72d2acced 100644 --- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c +++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c @@ -402,8 +402,13 @@ static void ag71xx_hw_init(struct ag71xx *ag) /* setup FIFO configuration registers */ ag71xx_wr(ag, AG71XX_REG_FIFO_CFG0, FIFO_CFG0_INIT); - ag71xx_wr(ag, AG71XX_REG_FIFO_CFG1, 0x0fff0000); - ag71xx_wr(ag, AG71XX_REG_FIFO_CFG2, 0x00001fff); + if (pdata->is_ar724x) { + ag71xx_wr(ag, AG71XX_REG_FIFO_CFG1, pdata->fifo_cfg1); + ag71xx_wr(ag, AG71XX_REG_FIFO_CFG2, pdata->fifo_cfg2); + } else { + ag71xx_wr(ag, AG71XX_REG_FIFO_CFG1, 0x0fff0000); + ag71xx_wr(ag, AG71XX_REG_FIFO_CFG2, 0x00001fff); + } ag71xx_wr(ag, AG71XX_REG_FIFO_CFG4, FIFO_CFG4_INIT); ag71xx_wr(ag, AG71XX_REG_FIFO_CFG5, FIFO_CFG5_INIT); diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c index 6fe4d407e..176eddaaf 100644 --- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c +++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c @@ -72,8 +72,12 @@ static void ag71xx_phy_link_update(struct ag71xx *ag) return; } - ag71xx_wr(ag, AG71XX_REG_FIFO_CFG3, - pdata->is_ar91xx ? 0x780fff : 0x008001ff); + if (pdata->is_ar91xx) + ag71xx_wr(ag, AG71XX_REG_FIFO_CFG3, 0x00780fff); + else if (pdata->is_ar724x) + ag71xx_wr(ag, AG71XX_REG_FIFO_CFG3, pdata->fifo_cfg3); + else + ag71xx_wr(ag, AG71XX_REG_FIFO_CFG3, 0x008001ff); if (pdata->set_pll) pdata->set_pll(ag->speed);