From 9331f2a5754c6966566cddef3e8bc4de9a6643f6 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 28 May 2005 09:17:29 +0000 Subject: [PATCH] move package/linux into target/linux, use wbx' new kernel code. support building images with more than one kernel, split kernel module parts off of packages that use their own kernel modules (fuse, shfs, openswan). some cleanup in the image building process in target/. image builder is disabled for now, needs some fixing. SVN-Revision: 1085 --- openwrt/package/Config.in | 6 - openwrt/package/Makefile | 3 +- openwrt/package/fuse/Config.in | 29 +- openwrt/package/fuse/Makefile | 7 - openwrt/package/linux/Makefile | 175 - .../package/linux/kernel-patches/001-Makefile | 43 - .../linux/kernel-patches/002-Rules_make | 18 - .../kernel-patches/003-arch_mips_Makefile | 42 - .../005-arch_mips_config-shared_in | 56 - .../007-arch_mips_kernel_cpu-probe_c | 121 - .../009-arch_mips_kernel_head_S | 24 - .../010-arch_mips_kernel_proc_c | 14 - .../011-arch_mips_kernel_setup_c | 22 - .../012-arch_mips_kernel_traps_c | 31 - .../kernel-patches/017-arch_mips_pci_Makefile | 12 - .../kernel-patches/018_drivers_char_mem_c | 12 - .../kernel-patches/019-drivers_char_serial_c | 37 - .../kernel-patches/020-drivers_mtd-jumbo | 105 - .../021-drivers_net_Config_in-hnd | 10 - .../kernel-patches/022-drivers_net_Makefile | 48 - .../023-drivers_parport_Makefile | 10 - .../024-drivers_parport_Config_in | 10 - .../028-drivers_pcmcia_Makefile | 23 - .../kernel-patches/029-arch_mips_mm_c-r4k_c | 37 - .../031-include_asm-mips_bootinfo_h | 26 - .../kernel-patches/033-include_asm-mips_cpu_h | 50 - .../036-include_asm-mips_serial_h | 24 - .../linux/kernel-patches/037-init_do_mounts_c | 16 - .../linux/kernel-patches/100-gcc3-mtune | 28 - .../200-include_linux_netdevice_h.patch | 28 - .../201-include_linux_skbuff_h.patch | 24 - .../202-net_core_Makefile.patch | 28 - .../kernel-patches/203-net_core_dev_c.patch | 28 - .../204-net_sched_sched_api_c.patch | 119 - .../205-net_sched_sched_generic_c.patch | 64 - .../206-include_net_pkt_sched_h.patch | 25 - .../linux/kernel-patches/300-squashfs2.1 | 2454 -- .../linux/kernel-patches/301-jffs-compression | 9119 ------ .../package/linux/kernel-patches/302-ebtables | 7012 ---- .../linux/kernel-patches/305-cifs-1.20c | 22022 ------------- .../309-drivers_net_b44_c.patch | 272 - .../kernel-patches/310-netfilter-maxconn | 20 - .../linux/kernel-patches/312-netfilter-TTL | 180 - .../314-drivers_net_b44_h.patch | 11 - .../315-include_linux_pci_ids_h.patch | 10 - .../kernel-patches/316-b44_mii_phy.patch | 89 - .../linux/kernel-patches/400-i4l-cvs-2-4-29 | 20247 ------------ .../403-netdev_random_core.patch | 296 - .../kernel-patches/404-netdev_random_et.patch | 11 - .../arch/mips/brcm-boards/bcm947xx/Makefile | 23 - .../brcm-boards/bcm947xx/compressed/Makefile | 33 - .../arch/mips/brcm-boards/bcm947xx/gpio.c | 158 - .../arch/mips/brcm-boards/bcm947xx/nvram.c | 317 - .../mips/brcm-boards/bcm947xx/nvram_linux.c | 638 - .../arch/mips/brcm-boards/bcm947xx/pcibios.c | 352 - .../arch/mips/brcm-boards/bcm947xx/perfcntr.c | 67 - .../arch/mips/brcm-boards/bcm947xx/prom.c | 41 - .../arch/mips/brcm-boards/bcm947xx/sbmips.c | 951 - .../arch/mips/brcm-boards/bcm947xx/sbpci.c | 557 - .../arch/mips/brcm-boards/bcm947xx/setup.c | 252 - .../arch/mips/brcm-boards/bcm947xx/sflash.c | 346 - .../arch/mips/brcm-boards/bcm947xx/time.c | 117 - .../arch/mips/brcm-boards/generic/Makefile | 26 - .../arch/mips/brcm-boards/generic/gdb_hook.c | 120 - .../mips/brcm-boards/generic/int-handler.S | 51 - .../arch/mips/brcm-boards/generic/irq.c | 130 - .../drivers/mtd/chips/cfi_cmdset_0701.c | 855 - .../drivers/mtd/maps/bcm947xx-flash.c | 236 - .../kernel-source/drivers/net/diag/Makefile | 9 - .../kernel-source/drivers/net/diag/diag_led.c | 244 - .../kernel-source/drivers/net/et/Makefile | 34 - .../kernel-source/drivers/net/hnd/Config.in | 35 - .../kernel-source/drivers/net/hnd/Makefile | 30 - .../kernel-source/drivers/net/hnd/bcmsrom.c | 711 - .../kernel-source/drivers/net/hnd/bcmutils.c | 803 - .../kernel-source/drivers/net/hnd/hnddma.c | 841 - .../kernel-source/drivers/net/hnd/linux_osl.c | 465 - .../kernel-source/drivers/net/hnd/sbutils.c | 2164 -- .../drivers/net/hnd/shared_ksyms.sh | 21 - .../kernel-source/drivers/net/wl/Makefile | 59 - .../drivers/parport/parport_splink.c | 345 - .../drivers/pcmcia/bcm4710_generic.c | 912 - .../drivers/pcmcia/bcm4710_pcmcia.c | 266 - .../drivers/pcmcia/bcm4710pcmcia.h | 118 - .../linux/kernel-source/include/bcm4710.h | 91 - .../linux/kernel-source/include/bcmdevs.h | 253 - .../linux/kernel-source/include/bcmendian.h | 127 - .../linux/kernel-source/include/bcmenet47xx.h | 229 - .../linux/kernel-source/include/bcmenetmib.h | 81 - .../linux/kernel-source/include/bcmenetrxh.h | 43 - .../linux/kernel-source/include/bcmnvram.h | 148 - .../linux/kernel-source/include/bcmsrom.h | 24 - .../linux/kernel-source/include/bcmutils.h | 157 - .../linux/kernel-source/include/epivers.h | 69 - .../linux/kernel-source/include/etsockio.h | 58 - .../linux/kernel-source/include/hnddma.h | 186 - .../linux/kernel-source/include/hndmips.h | 16 - .../linux/kernel-source/include/linux_osl.h | 343 - .../linux/kernel-source/include/linuxver.h | 392 - .../package/linux/kernel-source/include/osl.h | 38 - .../linux/kernel-source/include/pcicfg.h | 369 - .../kernel-source/include/proto/802.11.h | 852 - .../kernel-source/include/proto/ethernet.h | 164 - .../linux/kernel-source/include/sbchipc.h | 367 - .../linux/kernel-source/include/sbconfig.h | 292 - .../linux/kernel-source/include/sbextif.h | 242 - .../linux/kernel-source/include/sbmemc.h | 147 - .../linux/kernel-source/include/sbmips.h | 56 - .../linux/kernel-source/include/sbpci.h | 113 - .../linux/kernel-source/include/sbpcmcia.h | 139 - .../linux/kernel-source/include/sbsdram.h | 75 - .../linux/kernel-source/include/sbutils.h | 94 - .../linux/kernel-source/include/sflash.h | 36 - .../linux/kernel-source/include/trxhdr.h | 31 - .../linux/kernel-source/include/typedefs.h | 293 - openwrt/package/linux/linux-2.4/linux.mk | 114 - .../linux-2.4/patches/000-linux-mips.patch | 26900 ---------------- .../linux-2.4/patches/004-squashfs-lzma.patch | 887 - .../patches/101-netfilter-ipp2p.patch | 720 - .../patches/102-netfilter-layer7.patch | 2022 -- .../patches/103-netfilter-nat-pptp.patch | 2412 -- .../linux-2.4/patches/106-mppe-mppc.patch | 1649 - .../patches/108-optional-aout-support.patch | 688 - .../patches/109-ipsec-nat-traversal.patch | 140 - .../patches/111-netdev_random_et.patch | 11 - .../patches/201-hfc-usb-backport.patch | 2663 -- .../patches/202-pl2303-backport.patch | 738 - .../linux-2.4/patches/203-hfsplus-fix.patch | 23 - .../patches/205-gcc-3.4-ldscript.patch | 10 - .../linux-2.4/patches/206-gcc-3.4-fixes.patch | 214 - .../linux-2.4/patches/207-gcc-4.0-fixes.patch | 198 - openwrt/package/linux/linux.config | 1226 - openwrt/package/linux/linux.mk | 119 - openwrt/package/openswan/Config.in | 1 + openwrt/package/openswan/Makefile | 65 +- .../openswan/{ => ipkg}/openswan.control | 0 openwrt/package/openwrt/Makefile | 26 - openwrt/package/sdk/Makefile | 4 +- openwrt/package/shfs/Config.in | 30 +- openwrt/package/shfs/Makefile | 8 - openwrt/rules.mk | 5 - openwrt/scripts/ipkg | 16 +- openwrt/target/Config.in | 21 +- openwrt/target/Makefile | 20 +- openwrt/target/image.mk | 13 + openwrt/target/jffs2/Makefile | 54 +- openwrt/target/jffs2/jffs2root.mk | 41 - openwrt/{package => target}/linux/Config.in | 31 + openwrt/target/linux/Makefile | 33 + .../linux/control/kmod-arptables.control | 0 .../linux/control/kmod-b44.control | 0 .../linux/control/kmod-brcm-et.control | 0 .../linux/control/kmod-brcm-wl.control | 0 .../linux/control/kmod-cifs.control | 0 .../linux/control/kmod-crypto.control | 0 .../linux/control/kmod-diag.control | 0 .../linux/control/kmod-ebtables.control | 0 .../linux/control/kmod-ext2.control | 0 .../linux/control/kmod-ext3.control | 0 .../linux/control/kmod-gre.control | 0 .../linux/control/kmod-hfsplus.control | 0 .../linux/control/kmod-ide.control | 0 .../linux/control/kmod-ip6tables.control | 0 .../linux/control/kmod-iptables-extra.control | 0 .../linux/control/kmod-iptables.control | 0 .../linux/control/kmod-ipv6.control | 0 .../linux/control/kmod-loop.control | 0 .../linux/control/kmod-lp.control | 0 .../linux/control/kmod-mppe.control | 0 .../linux/control/kmod-nbd.control | 0 .../linux/control/kmod-nfs.control | 0 .../linux/control/kmod-ppp.control | 0 .../linux/control/kmod-pppoe.control | 0 .../linux/control/kmod-sched.control | 0 .../linux/control/kmod-tun.control | 0 .../linux/control/kmod-usb-core.control | 0 .../linux/control/kmod-usb-ohci.control | 0 .../linux/control/kmod-usb-printer.control | 0 .../linux/control/kmod-usb-storage.control | 0 .../linux/control/kmod-usb-uhci.control | 0 .../linux/control/kmod-usb2.control | 0 .../linux/control/kmod-vfat.control | 0 .../linux/control/kmod-xfs.control | 0 openwrt/target/linux/linux-2.4/Makefile | 228 + .../linux/linux-2.4/README | 38 +- openwrt/target/linux/linux-2.4/broadcom.mk | 42 + .../linux/linux-2.4/config/brcm} | 14 +- .../linux-2.4/patches/000-linux_mips.patch} | 0 .../linux/linux-2.4/patches/001-bcm47xx.patch | 0 .../linux/linux-2.4/patches/002-wl_fix.patch} | 0 .../linux-2.4/patches/003-squashfs.patch | 0 .../patches/004-squashfs_lzma.patch} | 0 .../patches/005-jffs2_compression.patch} | 0 .../linux-2.4/patches/100-ebtables.patch | 0 .../patches/101-netfilter_ipp2p.patch} | 0 .../patches/102-netfilter_layer7.patch} | 0 .../patches/103-netfilter_nat_pptp.patch} | 0 .../patches/104-netfilter_maxconn.patch} | 0 .../patches/105-netfilter_TTL.patch} | 0 .../linux-2.4/patches/106-mppe_mppc.patch} | 0 .../linux/linux-2.4/patches/107-cifs.patch | 0 .../patches/108-optional_aout_support.patch} | 0 .../patches/109-ipsec_nat_traversal.patch} | 0 .../patches/110-netdev_random_core.patch | 0 .../linux/linux-2.4/patches/200-i4l.patch | 0 .../patches/201-hfc_usb_backport.patch} | 0 .../patches/202-pl2303_backport.patch} | 0 .../linux-2.4/patches/203-hfsplus_fix.patch} | 0 .../linux-2.4/patches/204-net_b44.patch} | 0 .../patches/205-gcc_3.4_ldscript.patch} | 0 .../patches/206-gcc_3.4_fixes.patch} | 0 .../patches/207-gcc_4.0_fixes.patch} | 0 openwrt/target/linux/package/Config.in | 4 + openwrt/target/linux/package/Makefile | 36 + openwrt/target/linux/package/fuse/Config.in | 23 + openwrt/target/linux/package/fuse/Makefile | 79 + .../package/fuse/ipkg/kmod-fuse.control | 0 .../package/fuse/patches/101-kmod_build.patch | 59 + .../fuse/patches/102-cflags_configure.patch | 22 + .../target/linux/package/openswan/Config.in | 9 + .../target/linux/package/openswan/Makefile | 36 + .../openswan/ipkg/kmod-openswan.control | 6 + openwrt/target/linux/package/shfs/Config.in | 24 + openwrt/target/linux/package/shfs/Makefile | 47 + .../package/shfs/ipkg/kmod-shfs.control | 0 .../package/shfs/patches/101-kmod_build.patch | 103 + .../target/linux/package/wlcompat/Config.in | 7 + .../target/linux/package/wlcompat/Makefile | 34 + .../wlcompat/ipkg}/kmod-wlcompat.control | 0 .../linux/package/wlcompat}/wlcompat.c | 0 openwrt/target/linux/rules.mk | 28 + openwrt/target/squashfs-lzma/Makefile | 40 +- .../100-lzma.patch} | 0 .../target/squashfs-lzma/squashfslzmaroot.mk | 46 - 234 files changed, 1010 insertions(+), 121967 deletions(-) delete mode 100644 openwrt/package/linux/Makefile delete mode 100644 openwrt/package/linux/kernel-patches/001-Makefile delete mode 100644 openwrt/package/linux/kernel-patches/002-Rules_make delete mode 100644 openwrt/package/linux/kernel-patches/003-arch_mips_Makefile delete mode 100644 openwrt/package/linux/kernel-patches/005-arch_mips_config-shared_in delete mode 100644 openwrt/package/linux/kernel-patches/007-arch_mips_kernel_cpu-probe_c delete mode 100644 openwrt/package/linux/kernel-patches/009-arch_mips_kernel_head_S delete mode 100644 openwrt/package/linux/kernel-patches/010-arch_mips_kernel_proc_c delete mode 100644 openwrt/package/linux/kernel-patches/011-arch_mips_kernel_setup_c delete mode 100644 openwrt/package/linux/kernel-patches/012-arch_mips_kernel_traps_c delete mode 100644 openwrt/package/linux/kernel-patches/017-arch_mips_pci_Makefile delete mode 100644 openwrt/package/linux/kernel-patches/018_drivers_char_mem_c delete mode 100644 openwrt/package/linux/kernel-patches/019-drivers_char_serial_c delete mode 100644 openwrt/package/linux/kernel-patches/020-drivers_mtd-jumbo delete mode 100644 openwrt/package/linux/kernel-patches/021-drivers_net_Config_in-hnd delete mode 100644 openwrt/package/linux/kernel-patches/022-drivers_net_Makefile delete mode 100644 openwrt/package/linux/kernel-patches/023-drivers_parport_Makefile delete mode 100644 openwrt/package/linux/kernel-patches/024-drivers_parport_Config_in delete mode 100644 openwrt/package/linux/kernel-patches/028-drivers_pcmcia_Makefile delete mode 100644 openwrt/package/linux/kernel-patches/029-arch_mips_mm_c-r4k_c delete mode 100644 openwrt/package/linux/kernel-patches/031-include_asm-mips_bootinfo_h delete mode 100644 openwrt/package/linux/kernel-patches/033-include_asm-mips_cpu_h delete mode 100644 openwrt/package/linux/kernel-patches/036-include_asm-mips_serial_h delete mode 100644 openwrt/package/linux/kernel-patches/037-init_do_mounts_c delete mode 100644 openwrt/package/linux/kernel-patches/100-gcc3-mtune delete mode 100644 openwrt/package/linux/kernel-patches/200-include_linux_netdevice_h.patch delete mode 100644 openwrt/package/linux/kernel-patches/201-include_linux_skbuff_h.patch delete mode 100644 openwrt/package/linux/kernel-patches/202-net_core_Makefile.patch delete mode 100644 openwrt/package/linux/kernel-patches/203-net_core_dev_c.patch delete mode 100644 openwrt/package/linux/kernel-patches/204-net_sched_sched_api_c.patch delete mode 100644 openwrt/package/linux/kernel-patches/205-net_sched_sched_generic_c.patch delete mode 100644 openwrt/package/linux/kernel-patches/206-include_net_pkt_sched_h.patch delete mode 100644 openwrt/package/linux/kernel-patches/300-squashfs2.1 delete mode 100644 openwrt/package/linux/kernel-patches/301-jffs-compression delete mode 100644 openwrt/package/linux/kernel-patches/302-ebtables delete mode 100644 openwrt/package/linux/kernel-patches/305-cifs-1.20c delete mode 100644 openwrt/package/linux/kernel-patches/309-drivers_net_b44_c.patch delete mode 100644 openwrt/package/linux/kernel-patches/310-netfilter-maxconn delete mode 100644 openwrt/package/linux/kernel-patches/312-netfilter-TTL delete mode 100644 openwrt/package/linux/kernel-patches/314-drivers_net_b44_h.patch delete mode 100644 openwrt/package/linux/kernel-patches/315-include_linux_pci_ids_h.patch delete mode 100644 openwrt/package/linux/kernel-patches/316-b44_mii_phy.patch delete mode 100644 openwrt/package/linux/kernel-patches/400-i4l-cvs-2-4-29 delete mode 100644 openwrt/package/linux/kernel-patches/403-netdev_random_core.patch delete mode 100644 openwrt/package/linux/kernel-patches/404-netdev_random_et.patch delete mode 100644 openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/Makefile delete mode 100644 openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/compressed/Makefile delete mode 100644 openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/gpio.c delete mode 100644 openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/nvram.c delete mode 100644 openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/nvram_linux.c delete mode 100644 openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/pcibios.c delete mode 100644 openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/perfcntr.c delete mode 100644 openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/prom.c delete mode 100644 openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/sbmips.c delete mode 100644 openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/sbpci.c delete mode 100644 openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/setup.c delete mode 100644 openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/sflash.c delete mode 100644 openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/time.c delete mode 100644 openwrt/package/linux/kernel-source/arch/mips/brcm-boards/generic/Makefile delete mode 100644 openwrt/package/linux/kernel-source/arch/mips/brcm-boards/generic/gdb_hook.c delete mode 100644 openwrt/package/linux/kernel-source/arch/mips/brcm-boards/generic/int-handler.S delete mode 100644 openwrt/package/linux/kernel-source/arch/mips/brcm-boards/generic/irq.c delete mode 100644 openwrt/package/linux/kernel-source/drivers/mtd/chips/cfi_cmdset_0701.c delete mode 100644 openwrt/package/linux/kernel-source/drivers/mtd/maps/bcm947xx-flash.c delete mode 100644 openwrt/package/linux/kernel-source/drivers/net/diag/Makefile delete mode 100644 openwrt/package/linux/kernel-source/drivers/net/diag/diag_led.c delete mode 100644 openwrt/package/linux/kernel-source/drivers/net/et/Makefile delete mode 100644 openwrt/package/linux/kernel-source/drivers/net/hnd/Config.in delete mode 100644 openwrt/package/linux/kernel-source/drivers/net/hnd/Makefile delete mode 100644 openwrt/package/linux/kernel-source/drivers/net/hnd/bcmsrom.c delete mode 100644 openwrt/package/linux/kernel-source/drivers/net/hnd/bcmutils.c delete mode 100644 openwrt/package/linux/kernel-source/drivers/net/hnd/hnddma.c delete mode 100644 openwrt/package/linux/kernel-source/drivers/net/hnd/linux_osl.c delete mode 100644 openwrt/package/linux/kernel-source/drivers/net/hnd/sbutils.c delete mode 100644 openwrt/package/linux/kernel-source/drivers/net/hnd/shared_ksyms.sh delete mode 100644 openwrt/package/linux/kernel-source/drivers/net/wl/Makefile delete mode 100644 openwrt/package/linux/kernel-source/drivers/parport/parport_splink.c delete mode 100644 openwrt/package/linux/kernel-source/drivers/pcmcia/bcm4710_generic.c delete mode 100644 openwrt/package/linux/kernel-source/drivers/pcmcia/bcm4710_pcmcia.c delete mode 100644 openwrt/package/linux/kernel-source/drivers/pcmcia/bcm4710pcmcia.h delete mode 100644 openwrt/package/linux/kernel-source/include/bcm4710.h delete mode 100644 openwrt/package/linux/kernel-source/include/bcmdevs.h delete mode 100644 openwrt/package/linux/kernel-source/include/bcmendian.h delete mode 100644 openwrt/package/linux/kernel-source/include/bcmenet47xx.h delete mode 100644 openwrt/package/linux/kernel-source/include/bcmenetmib.h delete mode 100644 openwrt/package/linux/kernel-source/include/bcmenetrxh.h delete mode 100644 openwrt/package/linux/kernel-source/include/bcmnvram.h delete mode 100755 openwrt/package/linux/kernel-source/include/bcmsrom.h delete mode 100644 openwrt/package/linux/kernel-source/include/bcmutils.h delete mode 100644 openwrt/package/linux/kernel-source/include/epivers.h delete mode 100644 openwrt/package/linux/kernel-source/include/etsockio.h delete mode 100644 openwrt/package/linux/kernel-source/include/hnddma.h delete mode 100644 openwrt/package/linux/kernel-source/include/hndmips.h delete mode 100644 openwrt/package/linux/kernel-source/include/linux_osl.h delete mode 100644 openwrt/package/linux/kernel-source/include/linuxver.h delete mode 100644 openwrt/package/linux/kernel-source/include/osl.h delete mode 100644 openwrt/package/linux/kernel-source/include/pcicfg.h delete mode 100644 openwrt/package/linux/kernel-source/include/proto/802.11.h delete mode 100644 openwrt/package/linux/kernel-source/include/proto/ethernet.h delete mode 100644 openwrt/package/linux/kernel-source/include/sbchipc.h delete mode 100644 openwrt/package/linux/kernel-source/include/sbconfig.h delete mode 100644 openwrt/package/linux/kernel-source/include/sbextif.h delete mode 100644 openwrt/package/linux/kernel-source/include/sbmemc.h delete mode 100644 openwrt/package/linux/kernel-source/include/sbmips.h delete mode 100644 openwrt/package/linux/kernel-source/include/sbpci.h delete mode 100644 openwrt/package/linux/kernel-source/include/sbpcmcia.h delete mode 100644 openwrt/package/linux/kernel-source/include/sbsdram.h delete mode 100644 openwrt/package/linux/kernel-source/include/sbutils.h delete mode 100644 openwrt/package/linux/kernel-source/include/sflash.h delete mode 100644 openwrt/package/linux/kernel-source/include/trxhdr.h delete mode 100644 openwrt/package/linux/kernel-source/include/typedefs.h delete mode 100644 openwrt/package/linux/linux-2.4/linux.mk delete mode 100644 openwrt/package/linux/linux-2.4/patches/000-linux-mips.patch delete mode 100644 openwrt/package/linux/linux-2.4/patches/004-squashfs-lzma.patch delete mode 100644 openwrt/package/linux/linux-2.4/patches/101-netfilter-ipp2p.patch delete mode 100644 openwrt/package/linux/linux-2.4/patches/102-netfilter-layer7.patch delete mode 100644 openwrt/package/linux/linux-2.4/patches/103-netfilter-nat-pptp.patch delete mode 100644 openwrt/package/linux/linux-2.4/patches/106-mppe-mppc.patch delete mode 100644 openwrt/package/linux/linux-2.4/patches/108-optional-aout-support.patch delete mode 100644 openwrt/package/linux/linux-2.4/patches/109-ipsec-nat-traversal.patch delete mode 100644 openwrt/package/linux/linux-2.4/patches/111-netdev_random_et.patch delete mode 100644 openwrt/package/linux/linux-2.4/patches/201-hfc-usb-backport.patch delete mode 100644 openwrt/package/linux/linux-2.4/patches/202-pl2303-backport.patch delete mode 100644 openwrt/package/linux/linux-2.4/patches/203-hfsplus-fix.patch delete mode 100644 openwrt/package/linux/linux-2.4/patches/205-gcc-3.4-ldscript.patch delete mode 100644 openwrt/package/linux/linux-2.4/patches/206-gcc-3.4-fixes.patch delete mode 100644 openwrt/package/linux/linux-2.4/patches/207-gcc-4.0-fixes.patch delete mode 100644 openwrt/package/linux/linux.config delete mode 100644 openwrt/package/linux/linux.mk rename openwrt/package/openswan/{ => ipkg}/openswan.control (100%) create mode 100644 openwrt/target/image.mk delete mode 100644 openwrt/target/jffs2/jffs2root.mk rename openwrt/{package => target}/linux/Config.in (88%) create mode 100644 openwrt/target/linux/Makefile rename openwrt/{package => target}/linux/control/kmod-arptables.control (100%) rename openwrt/{package => target}/linux/control/kmod-b44.control (100%) rename openwrt/{package => target}/linux/control/kmod-brcm-et.control (100%) rename openwrt/{package => target}/linux/control/kmod-brcm-wl.control (100%) rename openwrt/{package => target}/linux/control/kmod-cifs.control (100%) rename openwrt/{package => target}/linux/control/kmod-crypto.control (100%) rename openwrt/{package => target}/linux/control/kmod-diag.control (100%) rename openwrt/{package => target}/linux/control/kmod-ebtables.control (100%) rename openwrt/{package => target}/linux/control/kmod-ext2.control (100%) rename openwrt/{package => target}/linux/control/kmod-ext3.control (100%) rename openwrt/{package => target}/linux/control/kmod-gre.control (100%) rename openwrt/{package => target}/linux/control/kmod-hfsplus.control (100%) rename openwrt/{package => target}/linux/control/kmod-ide.control (100%) rename openwrt/{package => target}/linux/control/kmod-ip6tables.control (100%) rename openwrt/{package => target}/linux/control/kmod-iptables-extra.control (100%) rename openwrt/{package => target}/linux/control/kmod-iptables.control (100%) rename openwrt/{package => target}/linux/control/kmod-ipv6.control (100%) rename openwrt/{package => target}/linux/control/kmod-loop.control (100%) rename openwrt/{package => target}/linux/control/kmod-lp.control (100%) rename openwrt/{package => target}/linux/control/kmod-mppe.control (100%) rename openwrt/{package => target}/linux/control/kmod-nbd.control (100%) rename openwrt/{package => target}/linux/control/kmod-nfs.control (100%) rename openwrt/{package => target}/linux/control/kmod-ppp.control (100%) rename openwrt/{package => target}/linux/control/kmod-pppoe.control (100%) rename openwrt/{package => target}/linux/control/kmod-sched.control (100%) rename openwrt/{package => target}/linux/control/kmod-tun.control (100%) rename openwrt/{package => target}/linux/control/kmod-usb-core.control (100%) rename openwrt/{package => target}/linux/control/kmod-usb-ohci.control (100%) rename openwrt/{package => target}/linux/control/kmod-usb-printer.control (100%) rename openwrt/{package => target}/linux/control/kmod-usb-storage.control (100%) rename openwrt/{package => target}/linux/control/kmod-usb-uhci.control (100%) rename openwrt/{package => target}/linux/control/kmod-usb2.control (100%) rename openwrt/{package => target}/linux/control/kmod-vfat.control (100%) rename openwrt/{package => target}/linux/control/kmod-xfs.control (100%) create mode 100644 openwrt/target/linux/linux-2.4/Makefile rename openwrt/{package => target}/linux/linux-2.4/README (79%) create mode 100644 openwrt/target/linux/linux-2.4/broadcom.mk rename openwrt/{package/linux/linux-2.4/linux.config => target/linux/linux-2.4/config/brcm} (99%) rename openwrt/{package/linux/kernel-patches/000-linux-mips-2_4_30.patch => target/linux/linux-2.4/patches/000-linux_mips.patch} (100%) rename openwrt/{package => target}/linux/linux-2.4/patches/001-bcm47xx.patch (100%) rename openwrt/{package/linux/linux-2.4/patches/002-wl-fix.patch => target/linux/linux-2.4/patches/002-wl_fix.patch} (100%) rename openwrt/{package => target}/linux/linux-2.4/patches/003-squashfs.patch (100%) rename openwrt/{package/linux/kernel-patches/600-linux-squashfs-lzma => target/linux/linux-2.4/patches/004-squashfs_lzma.patch} (100%) rename openwrt/{package/linux/linux-2.4/patches/005-jffs2-compression.patch => target/linux/linux-2.4/patches/005-jffs2_compression.patch} (100%) rename openwrt/{package => target}/linux/linux-2.4/patches/100-ebtables.patch (100%) rename openwrt/{package/linux/kernel-patches/304-netfilter-ipp2p-0.7.4 => target/linux/linux-2.4/patches/101-netfilter_ipp2p.patch} (100%) rename openwrt/{package/linux/kernel-patches/306-netfilter-layer7-0.9.1 => target/linux/linux-2.4/patches/102-netfilter_layer7.patch} (100%) rename openwrt/{package/linux/kernel-patches/308-netfilter-nat-pptp => target/linux/linux-2.4/patches/103-netfilter_nat_pptp.patch} (100%) rename openwrt/{package/linux/linux-2.4/patches/104-netfilter-maxconn.patch => target/linux/linux-2.4/patches/104-netfilter_maxconn.patch} (100%) rename openwrt/{package/linux/linux-2.4/patches/105-netfilter-TTL.patch => target/linux/linux-2.4/patches/105-netfilter_TTL.patch} (100%) rename openwrt/{package/linux/kernel-patches/303-mppe-mppc => target/linux/linux-2.4/patches/106-mppe_mppc.patch} (100%) rename openwrt/{package => target}/linux/linux-2.4/patches/107-cifs.patch (100%) rename openwrt/{package/linux/kernel-patches/600-optional-aout-support => target/linux/linux-2.4/patches/108-optional_aout_support.patch} (100%) rename openwrt/{package/linux/kernel-patches/311-ipsec-nat-traversal => target/linux/linux-2.4/patches/109-ipsec_nat_traversal.patch} (100%) rename openwrt/{package => target}/linux/linux-2.4/patches/110-netdev_random_core.patch (100%) rename openwrt/{package => target}/linux/linux-2.4/patches/200-i4l.patch (100%) rename openwrt/{package/linux/kernel-patches/401-hfc-usb-backport-i4l-cvs => target/linux/linux-2.4/patches/201-hfc_usb_backport.patch} (100%) rename openwrt/{package/linux/kernel-patches/402-pl2303-backport-2-4-29 => target/linux/linux-2.4/patches/202-pl2303_backport.patch} (100%) rename openwrt/{package/linux/kernel-patches/207-hfsplus-fix => target/linux/linux-2.4/patches/203-hfsplus_fix.patch} (100%) rename openwrt/{package/linux/linux-2.4/patches/204-net-b44.patch => target/linux/linux-2.4/patches/204-net_b44.patch} (100%) rename openwrt/{package/linux/kernel-patches/208-gcc-3.4-fix => target/linux/linux-2.4/patches/205-gcc_3.4_ldscript.patch} (100%) rename openwrt/{package/linux/kernel-patches/307-gcc-3.4-fix.patch => target/linux/linux-2.4/patches/206-gcc_3.4_fixes.patch} (100%) rename openwrt/{package/linux/kernel-patches/313-gcc-4.0-fixes => target/linux/linux-2.4/patches/207-gcc_4.0_fixes.patch} (100%) create mode 100644 openwrt/target/linux/package/Config.in create mode 100644 openwrt/target/linux/package/Makefile create mode 100644 openwrt/target/linux/package/fuse/Config.in create mode 100644 openwrt/target/linux/package/fuse/Makefile rename openwrt/{ => target/linux}/package/fuse/ipkg/kmod-fuse.control (100%) create mode 100644 openwrt/target/linux/package/fuse/patches/101-kmod_build.patch create mode 100644 openwrt/target/linux/package/fuse/patches/102-cflags_configure.patch create mode 100644 openwrt/target/linux/package/openswan/Config.in create mode 100644 openwrt/target/linux/package/openswan/Makefile create mode 100644 openwrt/target/linux/package/openswan/ipkg/kmod-openswan.control create mode 100644 openwrt/target/linux/package/shfs/Config.in create mode 100644 openwrt/target/linux/package/shfs/Makefile rename openwrt/{ => target/linux}/package/shfs/ipkg/kmod-shfs.control (100%) create mode 100644 openwrt/target/linux/package/shfs/patches/101-kmod_build.patch create mode 100644 openwrt/target/linux/package/wlcompat/Config.in create mode 100644 openwrt/target/linux/package/wlcompat/Makefile rename openwrt/{package/openwrt => target/linux/package/wlcompat/ipkg}/kmod-wlcompat.control (100%) rename openwrt/{package/openwrt => target/linux/package/wlcompat}/wlcompat.c (100%) create mode 100644 openwrt/target/linux/rules.mk rename openwrt/target/squashfs-lzma/{squashfs2.0-tools-lzma.patch => patches/100-lzma.patch} (100%) delete mode 100644 openwrt/target/squashfs-lzma/squashfslzmaroot.mk diff --git a/openwrt/package/Config.in b/openwrt/package/Config.in index 333cf0f5c4..0e8dbd3d60 100644 --- a/openwrt/package/Config.in +++ b/openwrt/package/Config.in @@ -125,11 +125,5 @@ source "package/sdk/Config.in" endmenu -menu "Kernel Configuration" - -source "package/linux/Config.in" - -endmenu - source "package/Sysconf.in" diff --git a/openwrt/package/Makefile b/openwrt/package/Makefile index a26411ddb4..4c1c708658 100644 --- a/openwrt/package/Makefile +++ b/openwrt/package/Makefile @@ -114,7 +114,7 @@ SDK_DEFAULT_PACKAGES:=busybox dnsmasq iptables wireless-tools dropbear bridge ip SDK_DEFAULT_COMPILE:=$(patsubst %,%-compile,$(SDK_DEFAULT_PACKAGES)) all: compile install -clean: $(patsubst %,%-clean,$(package-) $(package-y) $(package-m)) linux-clean +clean: $(patsubst %,%-clean,$(package-) $(package-y) $(package-m)) compile: $(patsubst %,%-compile,$(package-y) $(package-m)) install: $(patsubst %,%-install,$(package-y)) @@ -200,7 +200,6 @@ ulogd-compile: postgresql-compile endif sdk-compile: $(DEV_LIBS_COMPILE) $(SDK_DEFAULT_COMPILE) openwrt-install -$(patsubst %,%-prepare,$(package-y) $(package-m) $(package-)): linux-install %-prepare: @[ -f $(STAMP_DIR)/.$@ ] || $(MAKE) -C $(patsubst %-prepare,%,$@) prepare diff --git a/openwrt/package/fuse/Config.in b/openwrt/package/fuse/Config.in index 92852bf1cb..5159140e3f 100644 --- a/openwrt/package/fuse/Config.in +++ b/openwrt/package/fuse/Config.in @@ -1,39 +1,14 @@ config BR2_PACKAGE_FUSE bool default n - depends BR2_PACKAGE_KMOD_FUSE + depends BR2_PACKAGE_LIBFUSE -config BR2_PACKAGE_KMOD_FUSE - select BR2_PACKAGE_FUSE - prompt "kmod-fuse - FUSE kernel module" - tristate - default m if CONFIG_DEVEL - select BR2_PACKAGE_FUSE - help - With FUSE it is possible to implement a fully functional - filesystem in a userspace program. - - Features include: - - * Simple library API - * Simple installation (no need to patch or recompile the kernel) - * Secure implementation - * Userspace - kernel interface is very efficient - * Usable by non privileged users - * Runs on Linux kernels 2.4.X and 2.6.X - * Has proven very stable over time - - - http://fuse.sourceforge.net/ - - This package contains the fuse.o kernel module. - config BR2_PACKAGE_LIBFUSE prompt "libfuse - FUSE library" tristate default m if CONFIG_DEVEL - depends BR2_PACKAGE_KMOD_FUSE + select BR2_PACKAGE_KMOD_FUSE select BR2_PACKAGE_LIBPTHREAD help With FUSE it is possible to implement a fully functional diff --git a/openwrt/package/fuse/Makefile b/openwrt/package/fuse/Makefile index 869689fe62..60fb4bec50 100644 --- a/openwrt/package/fuse/Makefile +++ b/openwrt/package/fuse/Makefile @@ -16,7 +16,6 @@ PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install include $(TOPDIR)/package/rules.mk -$(eval $(call PKG_template,KMOD_FUSE,kmod-fuse,$(LINUX_VERSION)+$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) $(eval $(call PKG_template,LIBFUSE,libfuse,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) $(eval $(call PKG_template,FUSE_UTILS,fuse-utils,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) @@ -69,12 +68,6 @@ $(PKG_BUILD_DIR)/.built: all install touch $@ -$(IPKG_KMOD_FUSE): - mkdir -p $(IDIR_KMOD_FUSE)/lib/modules/$(LINUX_VERSION) - cp -fpR $(PKG_INSTALL_DIR)/lib/modules/$(LINUX_VERSION)/kernel/fs/fuse/fuse.o \ - $(IDIR_KMOD_FUSE)/lib/modules/$(LINUX_VERSION)/ - $(IPKG_BUILD) $(IDIR_KMOD_FUSE) $(PACKAGE_DIR) - $(IPKG_LIBFUSE): mkdir -p $(IDIR_LIBFUSE)/usr/lib cp -fpR $(PKG_INSTALL_DIR)/usr/lib/libfuse.so.* $(IDIR_LIBFUSE)/usr/lib/ diff --git a/openwrt/package/linux/Makefile b/openwrt/package/linux/Makefile deleted file mode 100644 index 14e3ac4f9c..0000000000 --- a/openwrt/package/linux/Makefile +++ /dev/null @@ -1,175 +0,0 @@ -# $Id$ - -include $(TOPDIR)/rules.mk -include ./linux-2.4/linux.mk -include ./linux-2.4/linux.config - -PKG_BUILD_DIR := $(BUILD_DIR)/linux-modules -PKG_RELEASE := 1 - -TARGETS := -INSTALL_TARGETS := - -.NOTPARALLEL: - -define KMOD_template -ifeq ($$(strip $(4)),) -KDEPEND_$(1):=m -else -KDEPEND_$(1):=$($(4)) -endif - -PKG_$(1) := $(PACKAGE_DIR)/kmod-$(2)_$(LINUX_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk -I_$(1) := $(PKG_BUILD_DIR)/ipkg/$(2) - -ifeq ($$(KDEPEND_$(1)),m) -ifneq ($(BR2_PACKAGE_KMOD_$(1)),) -TARGETS += $$(PKG_$(1)) -endif -ifeq ($(BR2_PACKAGE_KMOD_$(1)),y) -INSTALL_TARGETS += $$(PKG_$(1)) -endif -endif - -$$(PKG_$(1)): $(LINUX_DIR)/.modules_done - mkdir -p $$(I_$(1))/lib/modules/$(LINUX_VERSION) - $(SCRIPT_DIR)/make-ipkg-dir.sh $$(I_$(1)) control/kmod-$(2).control $(LINUX_VERSION)-$(PKG_RELEASE) $(ARCH) - cp $(3) $$(I_$(1))/lib/modules/$(LINUX_VERSION) - $(IPKG_BUILD) $$(I_$(1)) $(PACKAGE_DIR) - -endef - -$(eval $(call KMOD_template,DIAG,diag,\ - $(MODULES_DIR)/kernel/drivers/net/diag/diag.o \ -)) -$(eval $(call KMOD_template,BRCM_WL,brcm-wl,\ - $(MODULES_DIR)/kernel/drivers/net/wl/wl.o \ -,CONFIG_WL)) -$(eval $(call KMOD_template,B44,b44,\ - $(MODULES_DIR)/kernel/drivers/net/b44.o \ -,CONFIG_B44)) -$(eval $(call KMOD_template,BRCM_ET,brcm-et,\ - $(MODULES_DIR)/kernel/drivers/net/et/et.o \ -,CONFIG_ET)) -$(eval $(call KMOD_template,ARPT,arptables,\ - $(MODULES_DIR)/kernel/net/ipv4/netfilter/arp*.o \ -,CONFIG_IP_NF_ARPTABLES)) -$(eval $(call KMOD_template,EBT,ebtables,\ - $(MODULES_DIR)/kernel/net/bridge/netfilter/*.o \ -,CONFIG_BRIDGE_NF_EBTABLES)) -$(eval $(call KMOD_template,IPTABLES_V4,iptables,\ - $(MODULES_DIR)/kernel/net/ipv4/netfilter/ipt_state.o \ - $(MODULES_DIR)/kernel/net/ipv4/netfilter/iptable_nat.o \ - $(MODULES_DIR)/kernel/net/ipv4/netfilter/ip_nat_ftp.o \ - $(MODULES_DIR)/kernel/net/ipv4/netfilter/ipt_conntrack.o \ - $(MODULES_DIR)/kernel/net/ipv4/netfilter/ip_conntrack.o \ - $(MODULES_DIR)/kernel/net/ipv4/netfilter/ip_conntrack_ftp.o \ - $(MODULES_DIR)/kernel/net/ipv4/netfilter/ipt_MASQUERADE.o \ -)) -$(eval $(call KMOD_template,IPTABLES_V4_EXTRA,iptables-extra,\ - $(MODULES_DIR)/kernel/net/ipv4/netfilter/ip*.o \ -)) -$(eval $(call KMOD_template,IPTABLES_V6,ip6tables,\ - $(MODULES_DIR)/kernel/net/ipv6/netfilter/ip*.o \ -,CONFIG_IP6_NF_IPTABLES)) -$(eval $(call KMOD_template,IPV6,ipv6,\ - $(MODULES_DIR)/kernel/net/ipv6/ipv6.o \ -,CONFIG_IPV6)) -$(eval $(call KMOD_template,CIFS,cifs,\ - $(MODULES_DIR)/kernel/fs/cifs/cifs.o \ -,CONFIG_CIFS)) -$(eval $(call KMOD_template,NFS,nfs,\ - $(MODULES_DIR)/kernel/fs/lockd/*.o \ - $(MODULES_DIR)/kernel/fs/nfs/*.o \ - $(MODULES_DIR)/kernel/net/sunrpc/*.o \ -,CONFIG_NFS_FS)) -$(eval $(call KMOD_template,USB,usb-core,\ - $(MODULES_DIR)/kernel/drivers/usb/usbcore.o \ -,CONFIG_USB)) -$(eval $(call KMOD_template,USB_UHCI,usb-uhci,\ - $(MODULES_DIR)/kernel/drivers/usb/host/uhci.o \ -,CONFIG_USB_UHCI_ALT)) -$(eval $(call KMOD_template,USB_OHCI,usb-ohci,\ - $(MODULES_DIR)/kernel/drivers/usb/host/usb-ohci.o \ -,CONFIG_USB_OHCI)) -$(eval $(call KMOD_template,USB2,usb2,\ - $(MODULES_DIR)/kernel/drivers/usb/host/ehci-hcd.o \ -,CONFIG_USB_EHCI_HCD)) -$(eval $(call KMOD_template,USB_STORAGE,usb-storage,\ - $(MODULES_DIR)/kernel/drivers/scsi/*.o \ - $(MODULES_DIR)/kernel/drivers/usb/storage/*.o \ -,CONFIG_USB_STORAGE)) -$(eval $(call KMOD_template,USB_PRINTER,usb-printer,\ - $(MODULES_DIR)/kernel/drivers/usb/printer.o \ -,CONFIG_USB_PRINTER)) -$(eval $(call KMOD_template,LOOP,loop,\ - $(MODULES_DIR)/kernel/drivers/block/loop.o \ -,CONFIG_BLK_DEV_LOOP)) -$(eval $(call KMOD_template,NBD,nbd,\ - $(MODULES_DIR)/kernel/drivers/block/nbd.o \ -,CONFIG_BLK_DEV_NBD)) -$(eval $(call KMOD_template,LP,lp,\ - $(MODULES_DIR)/kernel/drivers/parport/parport.o \ - $(MODULES_DIR)/kernel/drivers/parport/parport_splink.o \ - $(MODULES_DIR)/kernel/drivers/char/lp.o \ -,CONFIG_PARPORT)) -$(eval $(call KMOD_template,IDE,ide,\ - $(MODULES_DIR)/kernel/drivers/ide/*.o \ - $(MODULES_DIR)/kernel/drivers/ide/*/*.o \ -,CONFIG_IDE)) -$(eval $(call KMOD_template,EXT2,ext2,\ - $(MODULES_DIR)/kernel/fs/ext2/*.o \ -,CONFIG_EXT2_FS)) -$(eval $(call KMOD_template,EXT3,ext3,\ - $(MODULES_DIR)/kernel/fs/ext3/*.o \ - $(MODULES_DIR)/kernel/fs/jbd/*.o \ -,CONFIG_EXT3_FS)) -$(eval $(call KMOD_template,XFS,xfs,\ - $(MODULES_DIR)/kernel/fs/xfs/*.o \ -,CONFIG_XFS_FS)) -$(eval $(call KMOD_template,HFSPLUS,hfsplus,\ - $(MODULES_DIR)/kernel/fs/hfsplus/*.o \ -,CONFIG_HFSPLUS_FS)) -$(eval $(call KMOD_template,VFAT,vfat,\ - $(MODULES_DIR)/kernel/fs/vfat/vfat.o \ - $(MODULES_DIR)/kernel/fs/fat/fat.o \ -,CONFIG_VFAT_FS)) -$(eval $(call KMOD_template,CRYPTO,crypto,\ - $(MODULES_DIR)/kernel/crypto/*.o \ -)) -$(eval $(call KMOD_template,PPP,ppp,\ - $(MODULES_DIR)/kernel/drivers/net/ppp_async.o \ - $(MODULES_DIR)/kernel/drivers/net/ppp_generic.o \ - $(MODULES_DIR)/kernel/drivers/net/slhc.o \ -,CONFIG_PPP)) -$(eval $(call KMOD_template,MPPE,mppe,\ - $(MODULES_DIR)/kernel/drivers/net/ppp_mppe_mppc.o \ -,CONFIG_PPP_MPPE_MPPC)) -$(eval $(call KMOD_template,PPPOE,pppoe,\ - $(MODULES_DIR)/kernel/drivers/net/pppoe.o \ - $(MODULES_DIR)/kernel/drivers/net/pppox.o \ -,CONFIG_PPPOE)) -$(eval $(call KMOD_template,TUN,tun,\ - $(MODULES_DIR)/kernel/drivers/net/tun.o \ -,CONFIG_TUN)) -$(eval $(call KMOD_template,GRE,gre,\ - $(MODULES_DIR)/kernel/net/ipv4/ip_gre.o \ -,CONFIG_NET_IPGRE)) -$(eval $(call KMOD_template,SCHED,sched,\ - $(MODULES_DIR)/kernel/net/sched/*.o \ -)) - -$(TARGETS): $(PACKAGE_DIR) - -$(PACKAGE_DIR): - mkdir -p $(PACKAGE_DIR) - -source: linux-source -prepare: $(LINUX_DIR)/.configured -compile: $(LINUX_DIR)/.modules_done $(TARGETS) - -install: compile $(TARGET_MODULES_DIR) - @[ "$(INSTALL_TARGETS)" != "" ] && $(IPKG) install $(INSTALL_TARGETS) || true - -clean: linux-dirclean - rm -f $(TARGETS) diff --git a/openwrt/package/linux/kernel-patches/001-Makefile b/openwrt/package/linux/kernel-patches/001-Makefile deleted file mode 100644 index d01051f844..0000000000 --- a/openwrt/package/linux/kernel-patches/001-Makefile +++ /dev/null @@ -1,43 +0,0 @@ ---- ../../../kernel/linux-mips-cvs/Makefile 2005-01-20 03:19:21.000000000 +0100 -+++ linux-2.4.29.new/Makefile 2005-03-15 01:15:27.441095231 +0100 -@@ -17,9 +17,9 @@ - FINDHPATH = $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net $(HPATH)/math-emu - - HOSTCC = gcc --HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -+HOSTCFLAGS = -Wall -Wstrict-prototypes -Os -fomit-frame-pointer - --CROSS_COMPILE = -+CROSS_COMPILE= - - # - # Include the make variables (CC, etc...) -@@ -91,8 +91,18 @@ - - CPPFLAGS := -D__KERNEL__ -I$(HPATH) - --CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \ -+CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -Os \ - -fno-strict-aliasing -fno-common -+ -+ -+# Turn on -pg to instrument the kernel with calls to mcount(). -+# Unfortunately, gcc won't allow -pg without frame pointers. -+ifdef CONFIG_MCOUNT -+ CFLAGS += -pg -+ CFLAGS_KERNEL += -pg -+ CONFIG_FRAME_POINTER = 1 -+endif -+ - ifndef CONFIG_FRAME_POINTER - CFLAGS += -fomit-frame-pointer - endif -@@ -501,7 +511,7 @@ - ifdef CONFIG_MODVERSIONS - $(MAKE) update-modverfile - endif -- scripts/mkdep -- `find $(FINDHPATH) \( -name SCCS -o -name .svn \) -prune -o -follow -name \*.h ! -name modversions.h -print` > .hdepend -+ (find $(FINDHPATH) \( -name SCCS -o -name .svn \) -prune -o -follow -name \*.h ! -name modversions.h -print | xargs -r scripts/mkdep -- ) > .hdepend - scripts/mkdep -- init/*.c > .depend - - ifdef CONFIG_MODVERSIONS diff --git a/openwrt/package/linux/kernel-patches/002-Rules_make b/openwrt/package/linux/kernel-patches/002-Rules_make deleted file mode 100644 index 485d9a5051..0000000000 --- a/openwrt/package/linux/kernel-patches/002-Rules_make +++ /dev/null @@ -1,18 +0,0 @@ ---- linux-mips-cvs/Rules.make 2003-08-13 17:39:03.000000000 +0200 -+++ linux-broadcom/Rules.make 2005-01-31 13:13:14.000000000 +0100 -@@ -176,7 +176,14 @@ - _modinst__: dummy - ifneq "$(strip $(ALL_MOBJS))" "" - mkdir -p $(MODLIB)/kernel/$(MOD_DESTDIR) -- cp $(sort $(ALL_MOBJS)) $(MODLIB)/kernel/$(MOD_DESTDIR) -+ @#cp $(sort $(ALL_MOBJS)) $(MODLIB)/kernel/$(MOD_DESTDIR) -+ for f in $(ALL_MOBJS) ; do \ -+ $(OBJCOPY) -R __ksymtab -R .comment -R .note -x \ -+ `$(NM) $$f | cut -f3- -d' ' | sed -n \ -+ -e 's/__module_parm_\(.*\)/-K \1/p' \ -+ -e 's/__ks..tab_\(.*\)/-K \1/p'` \ -+ $$f $(MODLIB)/kernel/$(MOD_DESTDIR)$(MOD_TARGET)$$f ; \ -+ done - endif - - .PHONY: modules_install diff --git a/openwrt/package/linux/kernel-patches/003-arch_mips_Makefile b/openwrt/package/linux/kernel-patches/003-arch_mips_Makefile deleted file mode 100644 index 8e4c4f5918..0000000000 --- a/openwrt/package/linux/kernel-patches/003-arch_mips_Makefile +++ /dev/null @@ -1,42 +0,0 @@ ---- linux-mips-cvs/arch/mips/Makefile 2005-01-31 12:59:28.000000000 +0100 -+++ linux-broadcom/arch/mips/Makefile 2005-01-31 13:13:14.000000000 +0100 -@@ -47,9 +47,9 @@ - GCCFLAGS += -G 0 -mno-abicalls -fno-pic -pipe - GCCFLAGS += $(call check_gcc, -finline-limit=100000,) - LINKFLAGS += -G 0 -static -n --MODFLAGS += -mlong-calls -+MODFLAGS += -mlong-calls -fno-common - --ifdef CONFIG_DEBUG_INFO -+ifdef CONFIG_REMOTE_DEBUG - GCCFLAGS += -g - ifdef CONFIG_SB1XXX_CORELIS - GCCFLAGS += -mno-sched-prolog -fno-omit-frame-pointer -@@ -174,6 +174,7 @@ - endif - - AFLAGS += $(GCCFLAGS) -+ASFLAGS += $(GCCFLAGS) - CFLAGS += $(GCCFLAGS) - - LD += -m $(ld-emul) -@@ -727,6 +728,19 @@ - endif - - # -+# Broadcom BCM947XX variants -+# -+ifdef CONFIG_BCM947XX -+LIBS += arch/mips/brcm-boards/generic/brcm.o arch/mips/brcm-boards/bcm947xx/bcm947xx.o -+SUBDIRS += arch/mips/brcm-boards/generic arch/mips/brcm-boards/bcm947xx -+LOADADDR := 0x80001000 -+ -+zImage: vmlinux -+ $(MAKE) -C arch/$(ARCH)/brcm-boards/bcm947xx/compressed -+export LOADADDR -+endif -+ -+# - # Choosing incompatible machines durings configuration will result in - # error messages during linking. Select a default linkscript if - # none has been choosen above. diff --git a/openwrt/package/linux/kernel-patches/005-arch_mips_config-shared_in b/openwrt/package/linux/kernel-patches/005-arch_mips_config-shared_in deleted file mode 100644 index 16c6766eec..0000000000 --- a/openwrt/package/linux/kernel-patches/005-arch_mips_config-shared_in +++ /dev/null @@ -1,56 +0,0 @@ ---- ../../../kernel/linux-mips-cvs/arch/mips/config-shared.in 2005-01-31 12:59:28.000000000 +0100 -+++ linux-2.4.29/arch/mips/config-shared.in 2005-03-12 19:51:22.474214917 +0100 -@@ -208,6 +208,14 @@ - fi - define_bool CONFIG_MIPS_RTC y - fi -+dep_bool 'Support for Broadcom MIPS-based boards' CONFIG_MIPS_BRCM $CONFIG_EXPERIMENTAL -+dep_bool 'Support for Broadcom BCM947XX' CONFIG_BCM947XX $CONFIG_MIPS_BRCM -+if [ "$CONFIG_BCM947XX" = "y" ] ; then -+ bool ' Support for Broadcom BCM4710' CONFIG_BCM4710 -+ bool ' Support for Broadcom BCM4310' CONFIG_BCM4310 -+ bool ' Support for Broadcom BCM4704' CONFIG_BCM4704 -+ bool ' Support for Broadcom BCM5365' CONFIG_BCM5365 -+fi - bool 'Support for SNI RM200 PCI' CONFIG_SNI_RM200_PCI - bool 'Support for TANBAC TB0226 (Mbase)' CONFIG_TANBAC_TB0226 - bool 'Support for TANBAC TB0229 (VR4131DIMM)' CONFIG_TANBAC_TB0229 -@@ -229,6 +237,11 @@ - define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM n - - # -+# Provide an option for a default kernel command line -+# -+string 'Default kernel command string' CONFIG_CMDLINE "" -+ -+# - # Select some configuration options automatically based on user selections. - # - if [ "$CONFIG_ACER_PICA_61" = "y" ]; then -@@ -554,6 +567,13 @@ - define_bool CONFIG_SWAP_IO_SPACE_L y - define_bool CONFIG_BOOT_ELF32 y - fi -+if [ "$CONFIG_BCM947XX" = "y" ] ; then -+ define_bool CONFIG_PCI y -+ define_bool CONFIG_NONCOHERENT_IO y -+ define_bool CONFIG_NEW_TIME_C y -+ define_bool CONFIG_NEW_IRQ y -+ define_bool CONFIG_HND y -+fi - if [ "$CONFIG_SNI_RM200_PCI" = "y" ]; then - define_bool CONFIG_ARC32 y - define_bool CONFIG_ARC_MEMORY y -@@ -1039,7 +1059,11 @@ - - bool 'Are you using a crosscompiler' CONFIG_CROSSCOMPILE - bool 'Enable run-time debugging' CONFIG_RUNTIME_DEBUG --bool 'Remote GDB kernel debugging' CONFIG_KGDB -+if [ "$CONFIG_BCM947XX" = "y" ] ; then -+ bool 'Remote GDB kernel debugging' CONFIG_REMOTE_DEBUG -+else -+ bool 'Remote GDB kernel debugging' CONFIG_KGDB -+fi - dep_bool ' Console output to GDB' CONFIG_GDB_CONSOLE $CONFIG_KGDB - if [ "$CONFIG_KGDB" = "y" ]; then - define_bool CONFIG_DEBUG_INFO y diff --git a/openwrt/package/linux/kernel-patches/007-arch_mips_kernel_cpu-probe_c b/openwrt/package/linux/kernel-patches/007-arch_mips_kernel_cpu-probe_c deleted file mode 100644 index d0d8acf9c4..0000000000 --- a/openwrt/package/linux/kernel-patches/007-arch_mips_kernel_cpu-probe_c +++ /dev/null @@ -1,121 +0,0 @@ ---- linux-mips-cvs/arch/mips/kernel/cpu-probe.c 2005-01-31 12:59:30.000000000 +0100 -+++ linux-broadcom/arch/mips/kernel/cpu-probe.c 2005-01-31 13:13:14.000000000 +0100 -@@ -175,7 +175,7 @@ - - static inline void cpu_probe_legacy(struct cpuinfo_mips *c) - { -- switch (c->processor_id & 0xff00) { -+ switch (c->processor_id & PRID_IMP_MASK) { - case PRID_IMP_R2000: - c->cputype = CPU_R2000; - c->isa_level = MIPS_CPU_ISA_I; -@@ -185,7 +185,7 @@ - c->tlbsize = 64; - break; - case PRID_IMP_R3000: -- if ((c->processor_id & 0xff) == PRID_REV_R3000A) -+ if ((c->processor_id & PRID_REV_MASK) == PRID_REV_R3000A) - if (cpu_has_confreg()) - c->cputype = CPU_R3081E; - else -@@ -200,12 +200,12 @@ - break; - case PRID_IMP_R4000: - if (read_c0_config() & CONF_SC) { -- if ((c->processor_id & 0xff) >= PRID_REV_R4400) -+ if ((c->processor_id & PRID_REV_MASK) >= PRID_REV_R4400) - c->cputype = CPU_R4400PC; - else - c->cputype = CPU_R4000PC; - } else { -- if ((c->processor_id & 0xff) >= PRID_REV_R4400) -+ if ((c->processor_id & PRID_REV_MASK) >= PRID_REV_R4400) - c->cputype = CPU_R4400SC; - else - c->cputype = CPU_R4000SC; -@@ -451,7 +451,7 @@ - static inline void cpu_probe_mips(struct cpuinfo_mips *c) - { - decode_config1(c); -- switch (c->processor_id & 0xff00) { -+ switch (c->processor_id & PRID_IMP_MASK) { - case PRID_IMP_4KC: - c->cputype = CPU_4KC; - c->isa_level = MIPS_CPU_ISA_M32; -@@ -492,10 +492,10 @@ - { - decode_config1(c); - c->options |= MIPS_CPU_PREFETCH; -- switch (c->processor_id & 0xff00) { -+ switch (c->processor_id & PRID_IMP_MASK) { - case PRID_IMP_AU1_REV1: - case PRID_IMP_AU1_REV2: -- switch ((c->processor_id >> 24) & 0xff) { -+ switch ((c->processor_id >> 24) & PRID_REV_MASK) { - case 0: - c->cputype = CPU_AU1000; - break; -@@ -523,10 +523,34 @@ - } - } - -+static inline void cpu_probe_broadcom(struct cpuinfo_mips *c) -+{ -+ decode_config1(c); -+ c->options |= MIPS_CPU_PREFETCH; -+ switch (c->processor_id & PRID_IMP_MASK) { -+ case PRID_IMP_BCM4710: -+ c->cputype = CPU_BCM4710; -+ c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX | -+ MIPS_CPU_4KTLB | MIPS_CPU_COUNTER; -+ c->scache.flags = MIPS_CACHE_NOT_PRESENT; -+ break; -+ case PRID_IMP_4KC: -+ case PRID_IMP_BCM3302: -+ c->cputype = CPU_BCM3302; -+ c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX | -+ MIPS_CPU_4KTLB | MIPS_CPU_COUNTER; -+ c->scache.flags = MIPS_CACHE_NOT_PRESENT; -+ break; -+ default: -+ c->cputype = CPU_UNKNOWN; -+ break; -+ } -+} -+ - static inline void cpu_probe_sibyte(struct cpuinfo_mips *c) - { - decode_config1(c); -- switch (c->processor_id & 0xff00) { -+ switch (c->processor_id & PRID_IMP_MASK) { - case PRID_IMP_SB1: - c->cputype = CPU_SB1; - c->isa_level = MIPS_CPU_ISA_M64; -@@ -548,7 +572,7 @@ - static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c) - { - decode_config1(c); -- switch (c->processor_id & 0xff00) { -+ switch (c->processor_id & PRID_IMP_MASK) { - case PRID_IMP_SR71000: - c->cputype = CPU_SR71000; - c->isa_level = MIPS_CPU_ISA_M64; -@@ -573,7 +597,7 @@ - c->cputype = CPU_UNKNOWN; - - c->processor_id = read_c0_prid(); -- switch (c->processor_id & 0xff0000) { -+ switch (c->processor_id & PRID_COMP_MASK) { - - case PRID_COMP_LEGACY: - cpu_probe_legacy(c); -@@ -584,6 +608,9 @@ - case PRID_COMP_ALCHEMY: - cpu_probe_alchemy(c); - break; -+ case PRID_COMP_BROADCOM: -+ cpu_probe_broadcom(c); -+ break; - case PRID_COMP_SIBYTE: - cpu_probe_sibyte(c); - break; diff --git a/openwrt/package/linux/kernel-patches/009-arch_mips_kernel_head_S b/openwrt/package/linux/kernel-patches/009-arch_mips_kernel_head_S deleted file mode 100644 index d31c55e5cf..0000000000 --- a/openwrt/package/linux/kernel-patches/009-arch_mips_kernel_head_S +++ /dev/null @@ -1,24 +0,0 @@ ---- linux-mips-cvs/arch/mips/kernel/head.S 2004-11-22 14:38:23.000000000 +0100 -+++ linux-broadcom/arch/mips/kernel/head.S 2005-01-31 13:13:14.000000000 +0100 -@@ -28,12 +28,20 @@ - #include - #include - -+#ifdef CONFIG_BCM4710 -+#undef eret -+#define eret nop; nop; eret -+#endif -+ - .text -+ j kernel_entry -+ nop -+ - /* - * Reserved space for exception handlers. - * Necessary for machines which link their kernels at KSEG0. - */ -- .fill 0x400 -+ .fill 0x3f4 - - /* The following two symbols are used for kernel profiling. */ - EXPORT(stext) diff --git a/openwrt/package/linux/kernel-patches/010-arch_mips_kernel_proc_c b/openwrt/package/linux/kernel-patches/010-arch_mips_kernel_proc_c deleted file mode 100644 index 9db525850f..0000000000 --- a/openwrt/package/linux/kernel-patches/010-arch_mips_kernel_proc_c +++ /dev/null @@ -1,14 +0,0 @@ ---- linux-mips-cvs/arch/mips/kernel/proc.c 2004-07-07 20:19:37.000000000 +0200 -+++ linux-broadcom/arch/mips/kernel/proc.c 2005-01-31 13:58:35.000000000 +0100 -@@ -78,9 +78,10 @@ - [CPU_AU1550] "Au1550", - [CPU_24K] "MIPS 24K", - [CPU_AU1200] "Au1200", -+ [CPU_BCM4710] "BCM4710", -+ [CPU_BCM3302] "BCM3302", - }; - -- - static int show_cpuinfo(struct seq_file *m, void *v) - { - unsigned int version = current_cpu_data.processor_id; diff --git a/openwrt/package/linux/kernel-patches/011-arch_mips_kernel_setup_c b/openwrt/package/linux/kernel-patches/011-arch_mips_kernel_setup_c deleted file mode 100644 index ef6dfe7717..0000000000 --- a/openwrt/package/linux/kernel-patches/011-arch_mips_kernel_setup_c +++ /dev/null @@ -1,22 +0,0 @@ ---- linux-mips-cvs/arch/mips/kernel/setup.c 2005-01-13 22:15:57.000000000 +0100 -+++ linux-broadcom/arch/mips/kernel/setup.c 2005-01-31 13:13:14.000000000 +0100 -@@ -493,6 +493,7 @@ - void swarm_setup(void); - void hp_setup(void); - void au1x00_setup(void); -+ void brcm_setup(void); - void frame_info_init(void); - - frame_info_init(); -@@ -691,6 +692,11 @@ - pmc_yosemite_setup(); - break; - #endif -+#if defined(CONFIG_BCM4710) || defined(CONFIG_BCM4310) -+ case MACH_GROUP_BRCM: -+ brcm_setup(); -+ break; -+#endif - default: - panic("Unsupported architecture"); - } diff --git a/openwrt/package/linux/kernel-patches/012-arch_mips_kernel_traps_c b/openwrt/package/linux/kernel-patches/012-arch_mips_kernel_traps_c deleted file mode 100644 index 6612dba5d7..0000000000 --- a/openwrt/package/linux/kernel-patches/012-arch_mips_kernel_traps_c +++ /dev/null @@ -1,31 +0,0 @@ ---- linux-mips-cvs/arch/mips/kernel/traps.c 2004-11-22 14:38:23.000000000 +0100 -+++ linux-broadcom/arch/mips/kernel/traps.c 2005-01-31 13:13:14.000000000 +0100 -@@ -919,6 +919,7 @@ - void __init trap_init(void) - { - extern char except_vec1_generic; -+ extern char except_vec2_generic; - extern char except_vec3_generic, except_vec3_r4000; - extern char except_vec_ejtag_debug; - extern char except_vec4; -@@ -926,6 +927,7 @@ - - /* Copy the generic exception handler code to it's final destination. */ - memcpy((void *)(KSEG0 + 0x80), &except_vec1_generic, 0x80); -+ memcpy((void *)(KSEG0 + 0x100), &except_vec2_generic, 0x80); - - /* - * Setup default vectors -@@ -984,6 +986,12 @@ - set_except_vector(13, handle_tr); - set_except_vector(22, handle_mdmx); - -+ if (current_cpu_data.cputype == CPU_SB1) { -+ /* Enable timer interrupt and scd mapped interrupt */ -+ clear_c0_status(0xf000); -+ set_c0_status(0xc00); -+ } -+ - if (cpu_has_fpu && !cpu_has_nofpuex) - set_except_vector(15, handle_fpe); - diff --git a/openwrt/package/linux/kernel-patches/017-arch_mips_pci_Makefile b/openwrt/package/linux/kernel-patches/017-arch_mips_pci_Makefile deleted file mode 100644 index fed1336150..0000000000 --- a/openwrt/package/linux/kernel-patches/017-arch_mips_pci_Makefile +++ /dev/null @@ -1,12 +0,0 @@ ---- linux-mips-cvs/arch/mips/pci/Makefile 2004-07-31 02:12:38.000000000 +0200 -+++ linux-broadcom/arch/mips/pci/Makefile 2005-01-31 13:13:14.000000000 +0100 -@@ -13,7 +13,9 @@ - obj-$(CONFIG_MIPS_MSC) += ops-msc.o - obj-$(CONFIG_MIPS_NILE4) += ops-nile4.o - obj-$(CONFIG_SNI_RM200_PCI) += ops-sni.o -+ifndef CONFIG_BCM947XX - obj-y += pci.o -+endif - obj-$(CONFIG_PCI_AUTO) += pci_auto.o - - include $(TOPDIR)/Rules.make diff --git a/openwrt/package/linux/kernel-patches/018_drivers_char_mem_c b/openwrt/package/linux/kernel-patches/018_drivers_char_mem_c deleted file mode 100644 index 0f67710fd3..0000000000 --- a/openwrt/package/linux/kernel-patches/018_drivers_char_mem_c +++ /dev/null @@ -1,12 +0,0 @@ ---- linux-mips-cvs/drivers/char/mem.c 2004-08-14 20:38:49.000000000 +0200 -+++ linux-broadcom/drivers/char/mem.c 2005-01-31 13:13:14.000000000 +0100 -@@ -713,7 +713,8 @@ - {1, "mem", S_IRUSR | S_IWUSR | S_IRGRP, &mem_fops}, - {2, "kmem", S_IRUSR | S_IWUSR | S_IRGRP, &kmem_fops}, - {3, "null", S_IRUGO | S_IWUGO, &null_fops}, --#if defined(CONFIG_ISA) || !defined(__mc68000__) -+#if defined(CONFIG_ISA) || !defined(__mc68000__) || \ -+ defined(CONFIG_BCM94702_CPCI) - {4, "port", S_IRUSR | S_IWUSR | S_IRGRP, &port_fops}, - #endif - {5, "zero", S_IRUGO | S_IWUGO, &zero_fops}, diff --git a/openwrt/package/linux/kernel-patches/019-drivers_char_serial_c b/openwrt/package/linux/kernel-patches/019-drivers_char_serial_c deleted file mode 100644 index 56d3fe663e..0000000000 --- a/openwrt/package/linux/kernel-patches/019-drivers_char_serial_c +++ /dev/null @@ -1,37 +0,0 @@ ---- linux-mips-cvs/drivers/char/serial.c 2004-12-27 05:13:43.000000000 +0100 -+++ linux-broadcom/drivers/char/serial.c 2005-01-31 13:13:14.000000000 +0100 -@@ -444,6 +444,10 @@ - return inb(info->port+1); - #endif - case SERIAL_IO_MEM: -+#ifdef CONFIG_BCM4310 -+ readb((unsigned long) info->iomem_base + -+ (UART_SCR<iomem_reg_shift)); -+#endif - return readb((unsigned long) info->iomem_base + - (offset<iomem_reg_shift)); - default: -@@ -464,6 +468,9 @@ - case SERIAL_IO_MEM: - writeb(value, (unsigned long) info->iomem_base + - (offset<iomem_reg_shift)); -+#ifdef CONFIG_BCM4704 -+ *((volatile unsigned int *) KSEG1ADDR(0x18000000)); -+#endif - break; - default: - outb(value, info->port+offset); -@@ -5996,6 +6003,13 @@ - * Divisor, bytesize and parity - */ - state = rs_table + co->index; -+ /* -+ * Safe guard: state structure must have been initialized -+ */ -+ if (state->iomem_base == NULL) { -+ printk("!unable to setup serial console!\n"); -+ return -1; -+ } - if (doflow) - state->flags |= ASYNC_CONS_FLOW; - info = &async_sercons; diff --git a/openwrt/package/linux/kernel-patches/020-drivers_mtd-jumbo b/openwrt/package/linux/kernel-patches/020-drivers_mtd-jumbo deleted file mode 100644 index 5425f6b0ea..0000000000 --- a/openwrt/package/linux/kernel-patches/020-drivers_mtd-jumbo +++ /dev/null @@ -1,105 +0,0 @@ -diff -Nur linux-mips-cvs/drivers/mtd/chips/Config.in linux-broadcom/drivers/mtd/chips/Config.in ---- linux-mips-cvs/drivers/mtd/chips/Config.in 2003-02-26 01:53:49.000000000 +0100 -+++ linux-broadcom/drivers/mtd/chips/Config.in 2005-01-31 13:13:14.000000000 +0100 -@@ -45,6 +45,7 @@ - dep_tristate ' Support for Intel/Sharp flash chips' CONFIG_MTD_CFI_INTELEXT $CONFIG_MTD_GEN_PROBE - dep_tristate ' Support for AMD/Fujitsu flash chips' CONFIG_MTD_CFI_AMDSTD $CONFIG_MTD_GEN_PROBE - dep_tristate ' Support for ST (Advanced Architecture) flash chips' CONFIG_MTD_CFI_STAA $CONFIG_MTD_GEN_PROBE -+dep_tristate ' Support for SST flash chips' CONFIG_MTD_CFI_SSTSTD $CONFIG_MTD_GEN_PROBE - - dep_tristate ' Support for RAM chips in bus mapping' CONFIG_MTD_RAM $CONFIG_MTD - dep_tristate ' Support for ROM chips in bus mapping' CONFIG_MTD_ROM $CONFIG_MTD -diff -Nur linux-mips-cvs/drivers/mtd/chips/Makefile linux-broadcom/drivers/mtd/chips/Makefile ---- linux-mips-cvs/drivers/mtd/chips/Makefile 2003-07-05 05:23:38.000000000 +0200 -+++ linux-broadcom/drivers/mtd/chips/Makefile 2005-01-31 13:13:14.000000000 +0100 -@@ -18,6 +18,7 @@ - obj-$(CONFIG_MTD_AMDSTD) += amd_flash.o - obj-$(CONFIG_MTD_CFI) += cfi_probe.o - obj-$(CONFIG_MTD_CFI_STAA) += cfi_cmdset_0020.o -+obj-$(CONFIG_MTD_CFI_SSTSTD) += cfi_cmdset_0701.o - obj-$(CONFIG_MTD_CFI_AMDSTD) += cfi_cmdset_0002.o - obj-$(CONFIG_MTD_CFI_INTELEXT) += cfi_cmdset_0001.o - obj-$(CONFIG_MTD_GEN_PROBE) += gen_probe.o -diff -Nur linux-mips-cvs/drivers/mtd/chips/cfi_probe.c linux-broadcom/drivers/mtd/chips/cfi_probe.c ---- linux-mips-cvs/drivers/mtd/chips/cfi_probe.c 2003-02-26 01:53:49.000000000 +0100 -+++ linux-broadcom/drivers/mtd/chips/cfi_probe.c 2005-01-31 13:13:14.000000000 +0100 -@@ -67,8 +67,15 @@ - cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL); - cfi_send_gen_cmd(0x98, 0x55, base, map, cfi, cfi->device_type, NULL); - -- if (!qry_present(map,base,cfi)) -- return 0; -+ if (!qry_present(map,base,cfi)) { -+ /* rather broken SST cfi probe (requires SST unlock) */ -+ cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL); -+ cfi_send_gen_cmd(0xAA, 0x5555, base, map, cfi, cfi->device_type, NULL); -+ cfi_send_gen_cmd(0x55, 0x2AAA, base, map, cfi, cfi->device_type, NULL); -+ cfi_send_gen_cmd(0x98, 0x5555, base, map, cfi, cfi->device_type, NULL); -+ if (!qry_present(map,base,cfi)) -+ return 0; -+ } - - if (!cfi->numchips) { - /* This is the first time we're called. Set up the CFI -diff -Nur linux-mips-cvs/drivers/mtd/chips/gen_probe.c linux-broadcom/drivers/mtd/chips/gen_probe.c ---- linux-mips-cvs/drivers/mtd/chips/gen_probe.c 2003-08-13 19:19:18.000000000 +0200 -+++ linux-broadcom/drivers/mtd/chips/gen_probe.c 2005-01-31 13:13:14.000000000 +0100 -@@ -332,9 +332,13 @@ - return cfi_cmdset_0002(map, primary); - #endif - #ifdef CONFIG_MTD_CFI_STAA -- case 0x0020: -+ case 0x0020: - return cfi_cmdset_0020(map, primary); - #endif -+#ifdef CONFIG_MTD_CFI_SSTSTD -+ case 0x0701: -+ return cfi_cmdset_0701(map, primary); -+#endif - } - - return cfi_cmdset_unknown(map, primary); -diff -Nur linux-mips-cvs/drivers/mtd/devices/Config.in linux-broadcom/drivers/mtd/devices/Config.in ---- linux-mips-cvs/drivers/mtd/devices/Config.in 2003-02-26 01:53:49.000000000 +0100 -+++ linux-broadcom/drivers/mtd/devices/Config.in 2005-01-31 13:13:14.000000000 +0100 -@@ -5,6 +5,7 @@ - mainmenu_option next_comment - - comment 'Self-contained MTD device drivers' -+bool ' Broadcom Chipcommon Serial Flash support' CONFIG_MTD_SFLASH - dep_tristate ' Ramix PMC551 PCI Mezzanine RAM card support' CONFIG_MTD_PMC551 $CONFIG_MTD $CONFIG_PCI - if [ "$CONFIG_MTD_PMC551" = "y" -o "$CONFIG_MTD_PMC551" = "m" ]; then - bool ' PMC551 256M DRAM Bugfix' CONFIG_MTD_PMC551_BUGFIX -diff -Nur linux-mips-cvs/drivers/mtd/devices/Makefile linux-broadcom/drivers/mtd/devices/Makefile ---- linux-mips-cvs/drivers/mtd/devices/Makefile 2002-03-30 09:15:50.000000000 +0100 -+++ linux-broadcom/drivers/mtd/devices/Makefile 2005-01-31 13:13:14.000000000 +0100 -@@ -12,6 +12,7 @@ - # here where previously there was none. We now have to ensure that - # doc200[01].o are linked before docprobe.o - -+obj-$(CONFIG_MTD_SFLASH) += sflash.o - obj-$(CONFIG_MTD_DOC1000) += doc1000.o - obj-$(CONFIG_MTD_DOC2000) += doc2000.o - obj-$(CONFIG_MTD_DOC2001) += doc2001.o -diff -Nur linux-mips-cvs/drivers/mtd/maps/Config.in linux-broadcom/drivers/mtd/maps/Config.in ---- linux-mips-cvs/drivers/mtd/maps/Config.in 2004-02-26 01:46:35.000000000 +0100 -+++ linux-broadcom/drivers/mtd/maps/Config.in 2005-01-31 13:13:14.000000000 +0100 -@@ -48,6 +48,7 @@ - fi - - if [ "$CONFIG_MIPS" = "y" ]; then -+ dep_tristate ' CFI Flash device mapped on Broadcom BCM947XX boards' CONFIG_MTD_BCM947XX $CONFIG_MTD_CFI - dep_tristate ' Pb1000 MTD support' CONFIG_MTD_PB1000 $CONFIG_MIPS_PB1000 - dep_tristate ' Pb1500 MTD support' CONFIG_MTD_PB1500 $CONFIG_MIPS_PB1500 - dep_tristate ' Pb1100 MTD support' CONFIG_MTD_PB1100 $CONFIG_MIPS_PB1100 -diff -Nur linux-mips-cvs/drivers/mtd/maps/Makefile linux-broadcom/drivers/mtd/maps/Makefile ---- linux-mips-cvs/drivers/mtd/maps/Makefile 2004-02-26 01:46:35.000000000 +0100 -+++ linux-broadcom/drivers/mtd/maps/Makefile 2005-01-31 13:13:14.000000000 +0100 -@@ -10,6 +10,7 @@ - endif - - # Chip mappings -+obj-$(CONFIG_MTD_BCM947XX) += bcm947xx-flash.o - obj-$(CONFIG_MTD_CDB89712) += cdb89712.o - obj-$(CONFIG_MTD_ARM_INTEGRATOR)+= integrator-flash.o - obj-$(CONFIG_MTD_CFI_FLAGADM) += cfi_flagadm.o diff --git a/openwrt/package/linux/kernel-patches/021-drivers_net_Config_in-hnd b/openwrt/package/linux/kernel-patches/021-drivers_net_Config_in-hnd deleted file mode 100644 index 580d616ce8..0000000000 --- a/openwrt/package/linux/kernel-patches/021-drivers_net_Config_in-hnd +++ /dev/null @@ -1,10 +0,0 @@ ---- linux-mips-cvs/drivers/net/Config.in 2004-11-07 18:13:42.000000000 +0100 -+++ linux-broadcom/drivers/net/Config.in 2005-01-31 13:13:14.000000000 +0100 -@@ -2,6 +2,7 @@ - # Network device configuration - # - -+source drivers/net/hnd/Config.in - source drivers/net/arcnet/Config.in - - tristate 'Dummy net driver support' CONFIG_DUMMY diff --git a/openwrt/package/linux/kernel-patches/022-drivers_net_Makefile b/openwrt/package/linux/kernel-patches/022-drivers_net_Makefile deleted file mode 100644 index 8340c9565b..0000000000 --- a/openwrt/package/linux/kernel-patches/022-drivers_net_Makefile +++ /dev/null @@ -1,48 +0,0 @@ ---- ../../../kernel/linux-mips-cvs/drivers/net/Makefile 2004-08-14 20:38:51.000000000 +0200 -+++ linux/drivers/net/Makefile 2005-03-16 12:45:24.523263597 +0100 -@@ -21,6 +21,16 @@ - list-multi := rcpci.o - rcpci-objs := rcpci45.o rclanmtl.o - -+subdir-m += diag -+ -+ifeq ($(CONFIG_HW_QOS),y) -+subdir-m += port_based_qos -+else -+ ifeq ($(CONFIG_PERFORMANCE),y) -+ subdir-m += port_based_qos -+ endif -+endif -+ - ifeq ($(CONFIG_TULIP),y) - obj-y += tulip/tulip.o - endif -@@ -265,6 +275,28 @@ - endif - endif - -+# -+# Broadcom HND devices -+# -+ifdef CONFIG_HND -+subdir-$(CONFIG_HND) += hnd -+endif -+ifdef CONFIG_ET -+subdir-$(CONFIG_ET) += et -+endif -+ifdef CONFIG_WL -+subdir-$(CONFIG_WL) += wl -+endif -+ifeq ($(CONFIG_HND),y) -+ obj-y += hnd/hnd.o -+endif -+ifeq ($(CONFIG_ET),y) -+ obj-y += et/et.o -+endif -+ifeq ($(CONFIG_WL),y) -+ obj-y += wl/wl.o -+endif -+ - include $(TOPDIR)/Rules.make - - clean: diff --git a/openwrt/package/linux/kernel-patches/023-drivers_parport_Makefile b/openwrt/package/linux/kernel-patches/023-drivers_parport_Makefile deleted file mode 100644 index 996e30a9b1..0000000000 --- a/openwrt/package/linux/kernel-patches/023-drivers_parport_Makefile +++ /dev/null @@ -1,10 +0,0 @@ ---- ../../../kernel/linux-mips-cvs/drivers/parport/Makefile 2004-08-14 20:38:53.000000000 +0200 -+++ linux-2.4.29/drivers/parport/Makefile 2005-03-21 13:57:53.338746517 +0100 -@@ -22,6 +22,7 @@ - - obj-$(CONFIG_PARPORT) += parport.o - obj-$(CONFIG_PARPORT_PC) += parport_pc.o -+obj-$(CONFIG_PARPORT_SPLINK) += parport_splink.o - obj-$(CONFIG_PARPORT_PC_PCMCIA) += parport_cs.o - obj-$(CONFIG_PARPORT_AMIGA) += parport_amiga.o - obj-$(CONFIG_PARPORT_MFC3) += parport_mfc3.o diff --git a/openwrt/package/linux/kernel-patches/024-drivers_parport_Config_in b/openwrt/package/linux/kernel-patches/024-drivers_parport_Config_in deleted file mode 100644 index 1b43798558..0000000000 --- a/openwrt/package/linux/kernel-patches/024-drivers_parport_Config_in +++ /dev/null @@ -1,10 +0,0 @@ ---- ../../../kernel/linux-mips-cvs/drivers/parport/Config.in 2004-02-20 02:22:18.000000000 +0100 -+++ linux-2.4.29/drivers/parport/Config.in 2005-03-21 13:59:33.958193664 +0100 -@@ -11,6 +11,7 @@ - tristate 'Parallel port support' CONFIG_PARPORT - if [ "$CONFIG_PARPORT" != "n" ]; then - dep_tristate ' PC-style hardware' CONFIG_PARPORT_PC $CONFIG_PARPORT -+ dep_tristate ' Asus WL500g parallel port' CONFIG_PARPORT_SPLINK $CONFIG_PARPORT - if [ "$CONFIG_PARPORT_PC" != "n" -a "$CONFIG_SERIAL" != "n" ]; then - if [ "$CONFIG_SERIAL" = "m" ]; then - define_tristate CONFIG_PARPORT_PC_CML1 m diff --git a/openwrt/package/linux/kernel-patches/028-drivers_pcmcia_Makefile b/openwrt/package/linux/kernel-patches/028-drivers_pcmcia_Makefile deleted file mode 100644 index df843e9d8a..0000000000 --- a/openwrt/package/linux/kernel-patches/028-drivers_pcmcia_Makefile +++ /dev/null @@ -1,23 +0,0 @@ -diff -Nur linux-mips-cvs/drivers/pcmcia/Makefile linux-broadcom/drivers/pcmcia/Makefile ---- linux-mips-cvs/drivers/pcmcia/Makefile 2004-04-16 23:05:25.000000000 +0200 -+++ linux-broadcom/drivers/pcmcia/Makefile 2005-01-31 13:13:14.000000000 +0100 -@@ -72,6 +72,10 @@ - au1000_ss-objs-$(CONFIG_MIPS_HYDROGEN3) += au1000_hydrogen3.o - au1000_ss-objs-$(CONFIG_MIPS_XXS1500) += au1000_xxs1500.o - -+obj-$(CONFIG_PCMCIA_BCM4710) += bcm4710_ss.o -+bcm4710_ss-objs := bcm4710_generic.o -+bcm4710_ss-objs += bcm4710_pcmcia.o -+ - obj-$(CONFIG_PCMCIA_SA1100) += sa1100_cs.o - obj-$(CONFIG_PCMCIA_M8XX) += m8xx_pcmcia.o - obj-$(CONFIG_PCMCIA_SIBYTE) += sibyte_generic.o -@@ -110,5 +114,8 @@ - au1x00_ss.o: $(au1000_ss-objs-y) - $(LD) -r -o $@ $(au1000_ss-objs-y) - -+bcm4710_ss.o: $(bcm4710_ss-objs) -+ $(LD) -r -o $@ $(bcm4710_ss-objs) -+ - yenta_socket.o: $(yenta_socket-objs) - $(LD) $(LD_RFLAG) -r -o $@ $(yenta_socket-objs) diff --git a/openwrt/package/linux/kernel-patches/029-arch_mips_mm_c-r4k_c b/openwrt/package/linux/kernel-patches/029-arch_mips_mm_c-r4k_c deleted file mode 100644 index 9ec2862c4d..0000000000 --- a/openwrt/package/linux/kernel-patches/029-arch_mips_mm_c-r4k_c +++ /dev/null @@ -1,37 +0,0 @@ ---- linux-mips-cvs/arch/mips/mm/c-r4k.c 2004-11-03 17:43:07.000000000 +0100 -+++ linux-cache/arch/mips/mm/c-r4k.c 2005-03-06 23:39:53.000000000 +0100 -@@ -1031,9 +1031,34 @@ - c->options |= MIPS_CPU_SUBSET_CACHES; - } - -+#if defined(CONFIG_BCM4310) -+static void __init _change_cachability(u32 cm) -+{ -+ struct cpuinfo_mips *c = ¤t_cpu_data; -+ -+ change_c0_config(CONF_CM_CMASK, cm); -+ if ((c->processor_id & (PRID_COMP_MASK | PRID_IMP_MASK)) == -+ (PRID_COMP_BROADCOM | PRID_IMP_BCM3302)) { -+ cm = read_c0_diag(); -+ /* Enable icache */ -+ cm |= (1 << 31); -+ /* Enable dcache */ -+ cm |= (1 << 30); -+ write_c0_diag(cm); -+ } -+} -+ -+static void (*change_cachability)(u32); -+#endif -+ - static inline void coherency_setup(void) - { -+#if defined(CONFIG_BCM4310) -+ change_cachability = (void (*)(u32)) KSEG1ADDR((unsigned long)(_change_cachability)); -+ change_cachability(CONF_CM_DEFAULT); -+#else - change_c0_config(CONF_CM_CMASK, CONF_CM_DEFAULT); -+#endif - - /* - * c0_status.cu=0 specifies that updates by the sc instruction use diff --git a/openwrt/package/linux/kernel-patches/031-include_asm-mips_bootinfo_h b/openwrt/package/linux/kernel-patches/031-include_asm-mips_bootinfo_h deleted file mode 100644 index c15471e75b..0000000000 --- a/openwrt/package/linux/kernel-patches/031-include_asm-mips_bootinfo_h +++ /dev/null @@ -1,26 +0,0 @@ ---- linux-mips-cvs/include/asm-mips/bootinfo.h 2005-01-31 12:59:49.000000000 +0100 -+++ linux-broadcom/include/asm-mips/bootinfo.h 2005-01-31 13:13:14.000000000 +0100 -@@ -37,6 +37,7 @@ - #define MACH_GROUP_HP_LJ 20 /* Hewlett Packard LaserJet */ - #define MACH_GROUP_LASAT 21 - #define MACH_GROUP_TITAN 22 /* PMC-Sierra Titan */ -+#define MACH_GROUP_BRCM 23 /* Broadcom */ - - /* - * Valid machtype values for group unknown (low order halfword of mips_machtype) -@@ -197,6 +198,15 @@ - #define MACH_TANBAC_TB0229 7 /* TANBAC TB0229 (VR4131DIMM) */ - - /* -+ * Valid machtypes for group Broadcom -+ */ -+#define MACH_BCM93725 0 -+#define MACH_BCM93725_VJ 1 -+#define MACH_BCM93730 2 -+#define MACH_BCM947XX 3 -+#define MACH_BCM933XX 4 -+ -+/* - * Valid machtype for group TITAN - */ - #define MACH_TITAN_YOSEMITE 1 /* PMC-Sierra Yosemite */ diff --git a/openwrt/package/linux/kernel-patches/033-include_asm-mips_cpu_h b/openwrt/package/linux/kernel-patches/033-include_asm-mips_cpu_h deleted file mode 100644 index 98157a572b..0000000000 --- a/openwrt/package/linux/kernel-patches/033-include_asm-mips_cpu_h +++ /dev/null @@ -1,50 +0,0 @@ ---- linux-mips-cvs/include/asm-mips/cpu.h 2004-07-07 20:19:37.000000000 +0200 -+++ linux-broadcom/include/asm-mips/cpu.h 2005-01-31 13:13:14.000000000 +0100 -@@ -22,6 +22,11 @@ - spec. - */ - -+#define PRID_COPT_MASK 0xff000000 -+#define PRID_COMP_MASK 0x00ff0000 -+#define PRID_IMP_MASK 0x0000ff00 -+#define PRID_REV_MASK 0x000000ff -+ - #define PRID_COMP_LEGACY 0x000000 - #define PRID_COMP_MIPS 0x010000 - #define PRID_COMP_BROADCOM 0x020000 -@@ -58,6 +63,7 @@ - #define PRID_IMP_RM7000 0x2700 - #define PRID_IMP_NEVADA 0x2800 /* RM5260 ??? */ - #define PRID_IMP_RM9000 0x3400 -+#define PRID_IMP_BCM4710 0x4000 - #define PRID_IMP_R5432 0x5400 - #define PRID_IMP_R5500 0x5500 - #define PRID_IMP_4KC 0x8000 -@@ -66,10 +72,16 @@ - #define PRID_IMP_4KEC 0x8400 - #define PRID_IMP_4KSC 0x8600 - #define PRID_IMP_25KF 0x8800 -+#define PRID_IMP_BCM3302 0x9000 -+#define PRID_IMP_BCM3303 0x9100 - #define PRID_IMP_24K 0x9300 - - #define PRID_IMP_UNKNOWN 0xff00 - -+#define BCM330X(id) \ -+ (((id & (PRID_COMP_MASK | PRID_IMP_MASK)) == (PRID_COMP_BROADCOM | PRID_IMP_BCM3302)) \ -+ || ((id & (PRID_COMP_MASK | PRID_IMP_MASK)) == (PRID_COMP_BROADCOM | PRID_IMP_BCM3303))) -+ - /* - * These are the PRID's for when 23:16 == PRID_COMP_SIBYTE - */ -@@ -174,7 +186,9 @@ - #define CPU_AU1550 57 - #define CPU_24K 58 - #define CPU_AU1200 59 --#define CPU_LAST 59 -+#define CPU_BCM4710 60 -+#define CPU_BCM3302 61 -+#define CPU_LAST 61 - - /* - * ISA Level encodings diff --git a/openwrt/package/linux/kernel-patches/036-include_asm-mips_serial_h b/openwrt/package/linux/kernel-patches/036-include_asm-mips_serial_h deleted file mode 100644 index b241ff7030..0000000000 --- a/openwrt/package/linux/kernel-patches/036-include_asm-mips_serial_h +++ /dev/null @@ -1,24 +0,0 @@ ---- linux-mips-cvs/include/asm-mips/serial.h 2004-08-20 00:33:33.000000000 +0200 -+++ linux-broadcom/include/asm-mips/serial.h 2005-01-31 13:13:14.000000000 +0100 -@@ -223,6 +223,13 @@ - #define TXX927_SERIAL_PORT_DEFNS - #endif - -+#ifdef CONFIG_BCM947XX -+/* reserve 4 ports to be configured at runtime */ -+#define BCM947XX_SERIAL_PORT_DEFNS { 0, }, { 0, }, { 0, }, { 0, }, -+#else -+#define BCM947XX_SERIAL_PORT_DEFNS -+#endif -+ - #ifdef CONFIG_HAVE_STD_PC_SERIAL_PORT - #define STD_SERIAL_PORT_DEFNS \ - /* UART CLK PORT IRQ FLAGS */ \ -@@ -470,6 +477,7 @@ - #define SERIAL_PORT_DFNS \ - ATLAS_SERIAL_PORT_DEFNS \ - AU1000_SERIAL_PORT_DEFNS \ -+ BCM947XX_SERIAL_PORT_DEFNS \ - COBALT_SERIAL_PORT_DEFNS \ - DDB5477_SERIAL_PORT_DEFNS \ - EV96100_SERIAL_PORT_DEFNS \ diff --git a/openwrt/package/linux/kernel-patches/037-init_do_mounts_c b/openwrt/package/linux/kernel-patches/037-init_do_mounts_c deleted file mode 100644 index 205677b25f..0000000000 --- a/openwrt/package/linux/kernel-patches/037-init_do_mounts_c +++ /dev/null @@ -1,16 +0,0 @@ ---- linux-mips-cvs/init/do_mounts.c 2005-01-20 03:19:24.000000000 +0100 -+++ linux-broadcom/init/do_mounts.c 2005-01-31 13:13:14.000000000 +0100 -@@ -253,7 +253,13 @@ - { "ftlb", 0x2c08 }, - { "ftlc", 0x2c10 }, - { "ftld", 0x2c18 }, -+#if defined(CONFIG_MTD_BLOCK) || defined(CONFIG_MTD_BLOCK_RO) - { "mtdblock", 0x1f00 }, -+ { "mtdblock0",0x1f00 }, -+ { "mtdblock1",0x1f01 }, -+ { "mtdblock2",0x1f02 }, -+ { "mtdblock3",0x1f03 }, -+#endif - { "nb", 0x2b00 }, - { NULL, 0 } - }; diff --git a/openwrt/package/linux/kernel-patches/100-gcc3-mtune b/openwrt/package/linux/kernel-patches/100-gcc3-mtune deleted file mode 100644 index 0f5a7017e9..0000000000 --- a/openwrt/package/linux/kernel-patches/100-gcc3-mtune +++ /dev/null @@ -1,28 +0,0 @@ ---- linux-mips-cvs-21012005/arch/mips/Makefile 2004-11-18 05:16:52.000000000 +0100 -+++ linux-broadcom/arch/mips/Makefile 2005-01-24 02:56:02.000000000 +0100 -@@ -71,13 +74,13 @@ - set_gccflags = $(shell \ - while :; do \ - cpu=$(1); isa=-$(2); \ -- for gcc_opt in -march= -mcpu=; do \ -+ for gcc_opt in -march= -mtune=; do \ - $(CC) $$gcc_opt$$cpu $$isa -S -o /dev/null \ - -xc /dev/null > /dev/null 2>&1 && \ - break 2; \ - done; \ - cpu=$(3); isa=-$(4); \ -- for gcc_opt in -march= -mcpu=; do \ -+ for gcc_opt in -march= -mtune=; do \ - $(CC) $$gcc_opt$$cpu $$isa -S -o /dev/null \ - -xc /dev/null > /dev/null 2>&1 && \ - break 2; \ -@@ -92,7 +95,7 @@ - fi; \ - gas_abi=-Wa,-32; gas_cpu=$$cpu; gas_isa=-Wa,$$isa; \ - while :; do \ -- for gas_opt in -Wa,-march= -Wa,-mcpu=; do \ -+ for gas_opt in -Wa,-march= -Wa,-mtune=; do \ - $(CC) $$gas_abi $$gas_opt$$cpu $$gas_isa -Wa,-Z -c \ - -o /dev/null -xassembler /dev/null > /dev/null 2>&1 && \ - break 2; \ - diff --git a/openwrt/package/linux/kernel-patches/200-include_linux_netdevice_h.patch b/openwrt/package/linux/kernel-patches/200-include_linux_netdevice_h.patch deleted file mode 100644 index 5e758f0ed9..0000000000 --- a/openwrt/package/linux/kernel-patches/200-include_linux_netdevice_h.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- linux-mips-cvs-21012005/include/linux/netdevice.h 2004-11-19 01:28:51.000000000 +0100 -+++ linux-broadcom/include/linux/netdevice.h 2005-01-26 19:51:37.000000000 +0100 -@@ -297,7 +297,10 @@ - * See for details. Jean II */ - struct iw_handler_def * wireless_handlers; - -+#ifndef CONFIG_BCM4710 - struct ethtool_ops *ethtool_ops; -+#endif -+ - - /* - * This marks the end of the "visible" part of the structure. All -@@ -353,7 +356,14 @@ - struct Qdisc *qdisc; - struct Qdisc *qdisc_sleeping; - struct Qdisc *qdisc_ingress; -+ /* -+ * this is needed for the wlan driver binary blob from linksys -+ */ -+#ifdef CONFIG_BCM4710 -+ struct Qdisc *qdisc_list; -+#else - struct list_head qdisc_list; -+#endif - unsigned long tx_queue_len; /* Max frames per queue allowed */ - - /* hard_start_xmit synchronizer */ diff --git a/openwrt/package/linux/kernel-patches/201-include_linux_skbuff_h.patch b/openwrt/package/linux/kernel-patches/201-include_linux_skbuff_h.patch deleted file mode 100644 index 628eaeac4f..0000000000 --- a/openwrt/package/linux/kernel-patches/201-include_linux_skbuff_h.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- linux-mips-cvs-21012005/include/linux/skbuff.h 2005-01-31 12:56:47.000000000 +0100 -+++ linux-broadcom/include/linux/skbuff.h 2005-01-31 12:55:24.000000000 +0100 -@@ -135,10 +135,6 @@ - struct sock *sk; /* Socket we are owned by */ - struct timeval stamp; /* Time we arrived */ - struct net_device *dev; /* Device we arrived on/are leaving by */ -- struct net_device *real_dev; /* For support of point to point protocols -- (e.g. 802.3ad) over bonding, we must save the -- physical device that got the packet before -- replacing skb->dev with the virtual device. */ - - /* Transport layer header */ - union -@@ -219,6 +215,10 @@ - #ifdef CONFIG_NET_SCHED - __u32 tc_index; /* traffic control index */ - #endif -+ struct net_device *real_dev; /* For support of point to point protocols -+ (e.g. 802.3ad) over bonding, we must save the -+ physical device that got the packet before -+ replacing skb->dev with the virtual device. */ - }; - - #ifdef __KERNEL__ diff --git a/openwrt/package/linux/kernel-patches/202-net_core_Makefile.patch b/openwrt/package/linux/kernel-patches/202-net_core_Makefile.patch deleted file mode 100644 index 8abeccce73..0000000000 --- a/openwrt/package/linux/kernel-patches/202-net_core_Makefile.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- linux-mips-cvs-21012005/net/core/Makefile 2004-11-19 01:28:53.000000000 +0100 -+++ linux-broadcom/net/core/Makefile 2005-01-26 15:56:36.000000000 +0100 -@@ -9,7 +9,11 @@ - - O_TARGET := core.o - -+ifeq ($(CONFIG_BCM4710),y) -+export-objs := netfilter.o profile.o neighbour.o -+else - export-objs := netfilter.o profile.o ethtool.o neighbour.o -+endif - - obj-y := sock.o skbuff.o iovec.o datagram.o scm.o - -@@ -21,8 +25,13 @@ - - obj-$(CONFIG_FILTER) += filter.o - -+ifeq ($(CONFIG_BCM4710),y) -+obj-$(CONFIG_NET) += dev.o dev_mcast.o dst.o neighbour.o \ -+ rtnetlink.o utils.o -+else - obj-$(CONFIG_NET) += dev.o ethtool.o dev_mcast.o dst.o neighbour.o \ - rtnetlink.o utils.o -+endif - - obj-$(CONFIG_NETFILTER) += netfilter.o - obj-$(CONFIG_NET_DIVERT) += dv.o diff --git a/openwrt/package/linux/kernel-patches/203-net_core_dev_c.patch b/openwrt/package/linux/kernel-patches/203-net_core_dev_c.patch deleted file mode 100644 index 8ce40f8794..0000000000 --- a/openwrt/package/linux/kernel-patches/203-net_core_dev_c.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- linux-2.4.30/net/core/dev.c 2005-04-04 05:42:20.000000000 +0400 -+++ linux/net/core/dev.c 2005-05-10 14:49:27.809927172 +0400 -@@ -2216,6 +2220,9 @@ - cmd == SIOCBONDSLAVEINFOQUERY || - cmd == SIOCBONDINFOQUERY || - cmd == SIOCBONDCHANGEACTIVE || -+#ifdef CONFIG_BCM4710 -+ cmd == SIOCETHTOOL || -+#endif - cmd == SIOCGMIIPHY || - cmd == SIOCGMIIREG || - cmd == SIOCSMIIREG || -@@ -2312,6 +2319,7 @@ - return ret; - - case SIOCETHTOOL: -+#ifndef CONFIG_BCM4710 - dev_load(ifr.ifr_name); - rtnl_lock(); - ret = dev_ethtool(&ifr); -@@ -2324,6 +2332,7 @@ - ret = -EFAULT; - } - return ret; -+#endif - - /* - * These ioctl calls: diff --git a/openwrt/package/linux/kernel-patches/204-net_sched_sched_api_c.patch b/openwrt/package/linux/kernel-patches/204-net_sched_sched_api_c.patch deleted file mode 100644 index 1f2371e504..0000000000 --- a/openwrt/package/linux/kernel-patches/204-net_sched_sched_api_c.patch +++ /dev/null @@ -1,119 +0,0 @@ ---- linux-2.4.30/net/sched/sch_api.c 2004-11-17 12:54:22.000000000 +0100 -+++ linux-2.4.30-wl/net/sched/sch_api.c 2005-04-24 18:56:03.000000000 +0200 -@@ -194,11 +194,12 @@ - { - struct Qdisc *q; - -- list_for_each_entry(q, &dev->qdisc_list, list) { -+ for (q = dev->qdisc_list; q; q = q->next) { - if (q->handle == handle) - return q; - } - return NULL; -+ - } - - struct Qdisc *qdisc_leaf(struct Qdisc *p, u32 classid) -@@ -371,8 +372,6 @@ - unsigned long cl = cops->get(parent, classid); - if (cl) { - err = cops->graft(parent, cl, new, old); -- if (new) -- new->parent = classid; - cops->put(parent, cl); - } - } -@@ -427,7 +426,6 @@ - - memset(sch, 0, size); - -- INIT_LIST_HEAD(&sch->list); - skb_queue_head_init(&sch->q); - - if (handle == TC_H_INGRESS) -@@ -453,7 +451,8 @@ - - if (!ops->init || (err = ops->init(sch, tca[TCA_OPTIONS-1])) == 0) { - write_lock(&qdisc_tree_lock); -- list_add_tail(&sch->list, &dev->qdisc_list); -+ sch->next = dev->qdisc_list; -+ dev->qdisc_list = sch; - write_unlock(&qdisc_tree_lock); - #ifdef CONFIG_NET_ESTIMATOR - if (tca[TCA_RATE-1]) -@@ -808,19 +807,16 @@ - if (idx > s_idx) - s_q_idx = 0; - read_lock(&qdisc_tree_lock); -- q_idx = 0; -- list_for_each_entry(q, &dev->qdisc_list, list) { -- if (q_idx < s_q_idx) { -- q_idx++; -- continue; -- } -- if (tc_fill_qdisc(skb, q, q->parent, NETLINK_CB(cb->skb).pid, -- cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0) { -- read_unlock(&qdisc_tree_lock); -- goto done; -- } -- q_idx++; -- } -+ for (q = dev->qdisc_list, q_idx = 0; q; -+ q = q->next, q_idx++) { -+ if (q_idx < s_q_idx) -+ continue; -+ if (tc_fill_qdisc(skb, q, 0, NETLINK_CB(cb->skb).pid, -+ cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0) { -+ read_unlock(&qdisc_tree_lock); -+ goto done; -+ } -+ } - read_unlock(&qdisc_tree_lock); - } - -@@ -1033,27 +1029,24 @@ - t = 0; - - read_lock(&qdisc_tree_lock); -- list_for_each_entry(q, &dev->qdisc_list, list) { -- if (t < s_t || !q->ops->cl_ops || -- (tcm->tcm_parent && -- TC_H_MAJ(tcm->tcm_parent) != q->handle)) { -- t++; -- continue; -- } -- if (t > s_t) -- memset(&cb->args[1], 0, sizeof(cb->args)-sizeof(cb->args[0])); -- arg.w.fn = qdisc_class_dump; -- arg.skb = skb; -- arg.cb = cb; -- arg.w.stop = 0; -- arg.w.skip = cb->args[1]; -- arg.w.count = 0; -- q->ops->cl_ops->walk(q, &arg.w); -- cb->args[1] = arg.w.count; -- if (arg.w.stop) -- break; -- t++; -- } -+ for (q=dev->qdisc_list, t=0; q; q = q->next, t++) { -+ if (t < s_t) continue; -+ if (!q->ops->cl_ops) continue; -+ if (tcm->tcm_parent && TC_H_MAJ(tcm->tcm_parent) != q->handle) -+ continue; -+ if (t > s_t) -+ memset(&cb->args[1], 0, sizeof(cb->args)-sizeof(cb->args[0])); -+ arg.w.fn = qdisc_class_dump; -+ arg.skb = skb; -+ arg.cb = cb; -+ arg.w.stop = 0; -+ arg.w.skip = cb->args[1]; -+ arg.w.count = 0; -+ q->ops->cl_ops->walk(q, &arg.w); -+ cb->args[1] = arg.w.count; -+ if (arg.w.stop) -+ break; -+ } - read_unlock(&qdisc_tree_lock); - - cb->args[0] = t; diff --git a/openwrt/package/linux/kernel-patches/205-net_sched_sched_generic_c.patch b/openwrt/package/linux/kernel-patches/205-net_sched_sched_generic_c.patch deleted file mode 100644 index 9de11d38ed..0000000000 --- a/openwrt/package/linux/kernel-patches/205-net_sched_sched_generic_c.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- linux-2.4.30/net/sched/sch_generic.c 2004-11-17 12:54:22.000000000 +0100 -+++ linux-2.4.30-wl/net/sched/sch_generic.c 2005-04-24 18:09:38.000000000 +0200 -@@ -392,7 +392,6 @@ - return NULL; - memset(sch, 0, size); - -- INIT_LIST_HEAD(&sch->list); - skb_queue_head_init(&sch->q); - sch->ops = ops; - sch->enqueue = ops->enqueue; -@@ -422,11 +421,22 @@ - void qdisc_destroy(struct Qdisc *qdisc) - { - struct Qdisc_ops *ops = qdisc->ops; -+ struct net_device *dev; - - if (qdisc->flags&TCQ_F_BUILTIN || - !atomic_dec_and_test(&qdisc->refcnt)) - return; -- list_del(&qdisc->list); -+ -+ dev = qdisc->dev; -+ if (dev) { -+ struct Qdisc *q, **qp; -+ for (qp = &qdisc->dev->qdisc_list; (q=*qp) != NULL; qp = &q->next) { -+ if (q == qdisc) { -+ *qp = q->next; -+ break; -+ } -+ } -+ } - #ifdef CONFIG_NET_ESTIMATOR - qdisc_kill_estimator(&qdisc->stats); - #endif -@@ -455,9 +465,9 @@ - return; - } - write_lock(&qdisc_tree_lock); -- list_add_tail(&qdisc->list, &dev->qdisc_list); -+ qdisc->next = dev->qdisc_list; -+ dev->qdisc_list = qdisc; - write_unlock(&qdisc_tree_lock); -- - } else { - qdisc = &noqueue_qdisc; - } -@@ -501,7 +511,7 @@ - dev->qdisc = &noop_qdisc; - spin_unlock_bh(&dev->queue_lock); - dev->qdisc_sleeping = &noop_qdisc; -- INIT_LIST_HEAD(&dev->qdisc_list); -+ dev->qdisc_list = NULL; - write_unlock(&qdisc_tree_lock); - - dev_watchdog_init(dev); -@@ -523,7 +533,7 @@ - qdisc_destroy(qdisc); - } - #endif -- BUG_TRAP(list_empty(&dev->qdisc_list)); -+ BUG_TRAP(dev->qdisc_list == NULL); - BUG_TRAP(!timer_pending(&dev->watchdog_timer)); - spin_unlock_bh(&dev->queue_lock); - write_unlock(&qdisc_tree_lock); diff --git a/openwrt/package/linux/kernel-patches/206-include_net_pkt_sched_h.patch b/openwrt/package/linux/kernel-patches/206-include_net_pkt_sched_h.patch deleted file mode 100644 index f6bd0143ad..0000000000 --- a/openwrt/package/linux/kernel-patches/206-include_net_pkt_sched_h.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- linux-2.4.30/include/net/pkt_sched.h 2004-11-17 12:54:22.000000000 +0100 -+++ linux-2.4.30-wl/include/net/pkt_sched.h 2005-04-24 18:32:48.000000000 +0200 -@@ -59,7 +59,7 @@ - int (*enqueue)(struct sk_buff *, struct Qdisc *); - struct sk_buff * (*dequeue)(struct Qdisc *); - int (*requeue)(struct sk_buff *, struct Qdisc *); -- unsigned int (*drop)(struct Qdisc *); -+ int (*drop)(struct Qdisc *); - - int (*init)(struct Qdisc *, struct rtattr *arg); - void (*reset)(struct Qdisc *); -@@ -80,12 +80,11 @@ - #define TCQ_F_THROTTLED 2 - #define TCQ_F_INGRESS 4 - struct Qdisc_ops *ops; -+ struct Qdisc *next; - u32 handle; -- u32 parent; - atomic_t refcnt; - struct sk_buff_head q; - struct net_device *dev; -- struct list_head list; - - struct tc_stats stats; - int (*reshape_fail)(struct sk_buff *skb, struct Qdisc *q); diff --git a/openwrt/package/linux/kernel-patches/300-squashfs2.1 b/openwrt/package/linux/kernel-patches/300-squashfs2.1 deleted file mode 100644 index 762b5a4dea..0000000000 --- a/openwrt/package/linux/kernel-patches/300-squashfs2.1 +++ /dev/null @@ -1,2454 +0,0 @@ -diff --new-file -ur linux-2.4.28/fs/Config.in linux-2.4.28-squashfs2.1-r2/fs/Config.in ---- linux-2.4.28/fs/Config.in 2004-11-17 11:54:21.000000000 +0000 -+++ linux-2.4.28-squashfs2.1-r2/fs/Config.in 2004-12-02 02:14:05.000000000 +0000 -@@ -51,6 +51,7 @@ - int 'JFFS2 debugging verbosity (0 = quiet, 2 = noisy)' CONFIG_JFFS2_FS_DEBUG 0 - fi - tristate 'Compressed ROM file system support' CONFIG_CRAMFS -+tristate 'Squashed file system support' CONFIG_SQUASHFS - bool 'Virtual memory file system support (former shm fs)' CONFIG_TMPFS - define_bool CONFIG_RAMFS y - -diff --new-file -ur linux-2.4.28/fs/Makefile linux-2.4.28-squashfs2.1-r2/fs/Makefile ---- linux-2.4.28/fs/Makefile 2004-02-18 13:36:31.000000000 +0000 -+++ linux-2.4.28-squashfs2.1-r2/fs/Makefile 2004-12-02 02:14:05.000000000 +0000 -@@ -65,6 +65,7 @@ - subdir-$(CONFIG_DEVPTS_FS) += devpts - subdir-$(CONFIG_SUN_OPENPROMFS) += openpromfs - subdir-$(CONFIG_BEFS_FS) += befs -+subdir-$(CONFIG_SQUASHFS) += squashfs - subdir-$(CONFIG_JFS_FS) += jfs - subdir-$(CONFIG_XFS_FS) += xfs - -diff --new-file -ur linux-2.4.28/fs/squashfs/inode.c linux-2.4.28-squashfs2.1-r2/fs/squashfs/inode.c ---- linux-2.4.28/fs/squashfs/inode.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.28-squashfs2.1-r2/fs/squashfs/inode.c 2004-12-15 10:13:06.000000000 +0000 -@@ -0,0 +1,1677 @@ -+/* -+ * Squashfs - a compressed read only filesystem for Linux -+ * -+ * Copyright (c) 2002, 2003, 2004 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 - a compressed read only filesystem for Linux -+ * -+ * inode.c -+ */ -+ -+#define SQUASHFS_1_0_COMPATIBILITY -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#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...) if(!silent) printk(KERN_ERR "SQUASHFS error: "s, ## args) -+#define WARNING(s, args...) printk(KERN_WARNING "SQUASHFS: "s, ## args) -+ -+static struct super_block *squashfs_read_super(struct super_block *, void *, int); -+static void squashfs_put_super(struct super_block *); -+static int squashfs_statfs(struct super_block *, struct statfs *); -+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 dentry *squashfs_lookup(struct inode *, struct dentry *); -+static unsigned int read_data(struct super_block *s, char *buffer, -+ unsigned int index, unsigned int length, unsigned int *next_index); -+static int squashfs_get_cached_block(struct super_block *s, char *buffer, -+ unsigned int block, unsigned int offset, int length, -+ unsigned int *next_block, unsigned int *next_offset); -+static struct inode *squashfs_iget(struct super_block *s, squashfs_inode inode); -+static unsigned int read_blocklist(struct inode *inode, int index, int readahead_blks, -+ char *block_list, unsigned short **block_p, unsigned int *bsize); -+static void squashfs_put_super(struct super_block *s); -+ -+#ifdef SQUASHFS_1_0_COMPATIBILITY -+static int squashfs_readpage_lessthan4K(struct file *file, struct page *page); -+static struct inode *squashfs_iget_1(struct super_block *s, squashfs_inode inode); -+static unsigned int read_blocklist_1(struct inode *inode, int index, int readahead_blks, -+ char *block_list, unsigned short **block_p, unsigned int *bsize); -+#endif -+ -+DECLARE_MUTEX(read_data_mutex); -+ -+static z_stream stream; -+ -+static DECLARE_FSTYPE_DEV(squashfs_fs_type, "squashfs", squashfs_read_super); -+ -+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 = { -+ statfs: squashfs_statfs, -+ put_super: squashfs_put_super, -+}; -+ -+static struct address_space_operations squashfs_symlink_aops = { -+ readpage: squashfs_symlink_readpage -+}; -+ -+static struct address_space_operations squashfs_aops = { -+ readpage: squashfs_readpage -+}; -+ -+static struct address_space_operations squashfs_aops_4K = { -+ readpage: squashfs_readpage4K -+}; -+ -+#ifdef SQUASHFS_1_0_COMPATIBILITY -+static struct address_space_operations squashfs_aops_lessthan4K = { -+ readpage: squashfs_readpage_lessthan4K -+}; -+#endif -+ -+static struct file_operations squashfs_dir_ops = { -+ read: generic_read_dir, -+ readdir: squashfs_readdir -+}; -+ -+static 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) -+{ -+ squashfs_sb_info *msBlk = &s->u.squashfs_sb; -+ unsigned short temp; -+ struct buffer_head *bh; -+ -+ if(!(bh = sb_bread(s, *cur_index))) -+ return NULL; -+ -+ 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)))) -+ return NULL; -+ 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 short temp; -+ ((unsigned char *) &temp)[1] = *((unsigned char *) (bh->b_data + *offset)); -+ ((unsigned char *) &temp)[0] = *((unsigned char *) (bh->b_data + *offset + 1)); -+ *c_byte = temp; -+ } else -+ *c_byte = *((unsigned short *) (bh->b_data + *offset)); -+ *offset += 2; -+ } -+ if(SQUASHFS_CHECK_DATA(msBlk->sBlk.flags)) { -+ if(*offset == msBlk->devblksize) { -+ brelse(bh); -+ if(!(bh = sb_bread(s, ++(*cur_index)))) -+ return NULL; -+ offset = 0; -+ } -+ if(*((unsigned char *) (bh->b_data + *offset)) != SQUASHFS_MARKER_BYTE) { -+ ERROR("Metadata block marker corrupt @ %x\n", *cur_index); -+ brelse(bh); -+ return NULL; -+ } -+ *offset ++; -+ } -+ -+ return bh; -+} -+ -+ -+static unsigned int read_data(struct super_block *s, char *buffer, -+ unsigned int index, unsigned int length, unsigned int *next_index) -+{ -+ squashfs_sb_info *msBlk = &s->u.squashfs_sb; -+ 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%x, %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%x, %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(&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]); -+ 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(&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; -+} -+static int squashfs_get_cached_block(struct super_block *s, char *buffer, -+ unsigned int block, unsigned int offset, int length, -+ unsigned int *next_block, unsigned int *next_offset) -+{ -+ squashfs_sb_info *msBlk = &s->u.squashfs_sb; -+ int n, i, bytes, return_length = length; -+ unsigned int next_index; -+ -+ TRACE("Entered squashfs_get_cached_block [%x:%x]\n", block, offset); -+ -+ for(;;) { -+ 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) { -+ up(&msBlk->block_cache_mutex); -+ sleep_on(&msBlk->waitq); -+ continue; -+ } -+ msBlk->next_cache = (i + 1) % SQUASHFS_CACHED_BLKS; -+ -+ if(msBlk->block_cache[i].block == SQUASHFS_INVALID_BLK) { -+ if(!(msBlk->block_cache[i].data = (unsigned char *) -+ kmalloc(SQUASHFS_METADATA_SIZE, GFP_KERNEL))) { -+ ERROR("Failed to allocate cache block\n"); -+ up(&msBlk->block_cache_mutex); -+ return 0; -+ } -+ } -+ -+ msBlk->block_cache[i].block = SQUASHFS_USED_BLK; -+ up(&msBlk->block_cache_mutex); -+ if(!(msBlk->block_cache[i].length = read_data(s, msBlk->block_cache[i].data, block, 0, -+ &next_index))) { -+ ERROR("Unable to read cache block [%x:%x]\n", block, offset); -+ return 0; -+ } -+ 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 [%x:%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); -+ return return_length; -+ } 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; -+ } -+ } -+} -+ -+ -+static int get_fragment_location(struct super_block *s, unsigned int fragment, unsigned int *fragment_start_block, unsigned int *fragment_size) -+{ -+ squashfs_sb_info *msBlk = &s->u.squashfs_sb; -+ unsigned int start_block = msBlk->fragment_index[SQUASHFS_FRAGMENT_INDEX(fragment)]; -+ int offset = SQUASHFS_FRAGMENT_INDEX_OFFSET(fragment); -+ squashfs_fragment_entry fragment_entry; -+ -+ if(msBlk->swap) { -+ squashfs_fragment_entry sfragment_entry; -+ -+ if(!squashfs_get_cached_block(s, (char *) &sfragment_entry, start_block, offset, -+ sizeof(sfragment_entry), &start_block, &offset)) -+ return 0; -+ 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)) -+ return 0; -+ -+ *fragment_start_block = fragment_entry.start_block; -+ *fragment_size = fragment_entry.size; -+ -+ return 1; -+} -+ -+ -+void release_cached_fragment(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); -+} -+ -+ -+struct squashfs_fragment_cache *get_cached_fragment(struct super_block *s, unsigned int start_block, int length) -+{ -+ int i, n; -+ squashfs_sb_info *msBlk = &s->u.squashfs_sb; -+ -+ for(;;) { -+ 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) { -+ up(&msBlk->fragment_mutex); -+ sleep_on(&msBlk->fragment_wait_queue); -+ continue; -+ } -+ msBlk->next_fragment = (msBlk->next_fragment + 1) % SQUASHFS_CACHED_FRAGMENTS; -+ -+ if(msBlk->fragment[i].data == NULL) -+ if(!(msBlk->fragment[i].data = (unsigned char *) -+ kmalloc(SQUASHFS_FILE_MAX_SIZE, GFP_KERNEL))) { -+ ERROR("Failed to allocate fragment cache block\n"); -+ up(&msBlk->fragment_mutex); -+ return NULL; -+ } -+ -+ msBlk->fragment[i].block = SQUASHFS_INVALID_BLK; -+ msBlk->fragment[i].locked = 1; -+ up(&msBlk->fragment_mutex); -+ if(!(msBlk->fragment[i].length = read_data(s, msBlk->fragment[i].data, start_block, length, -+ NULL))) { -+ ERROR("Unable to read fragment cache block [%x]\n", start_block); -+ msBlk->fragment[i].locked = 0; -+ return NULL; -+ } -+ msBlk->fragment[i].block = start_block; -+ TRACE("New fragment %d, start block %d, locked %d\n", i, msBlk->fragment[i].block, msBlk->fragment[i].locked); -+ return &msBlk->fragment[i]; -+ } -+ -+ msBlk->fragment[i].locked ++; -+ up(&msBlk->fragment_mutex); -+ -+ TRACE("Got fragment %d, start block %d, locked %d\n", i, msBlk->fragment[i].block, msBlk->fragment[i].locked); -+ return &msBlk->fragment[i]; -+ } -+} -+ -+ -+#ifdef SQUASHFS_1_0_COMPATIBILITY -+static struct inode *squashfs_iget_1(struct super_block *s, squashfs_inode inode) -+{ -+ struct inode *i = new_inode(s); -+ squashfs_sb_info *msBlk = &s->u.squashfs_sb; -+ 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 next_block, next_offset; -+ squashfs_base_inode_header_1 inodeb; -+ -+ TRACE("Entered squashfs_iget_1\n"); -+ -+ if(msBlk->swap) { -+ squashfs_base_inode_header_1 sinodeb; -+ -+ if(!squashfs_get_cached_block(s, (char *) &sinodeb, block, offset, -+ sizeof(sinodeb), &next_block, &next_offset)) -+ goto failed_read; -+ SQUASHFS_SWAP_BASE_INODE_HEADER_1(&inodeb, &sinodeb, sizeof(sinodeb)); -+ } else -+ if(!squashfs_get_cached_block(s, (char *) &inodeb, block, offset, -+ sizeof(inodeb), &next_block, &next_offset)) -+ goto failed_read; -+ -+ i->i_nlink = 1; -+ -+ i->i_mtime = sBlk->mkfs_time; -+ i->i_atime = sBlk->mkfs_time; -+ i->i_ctime = sBlk->mkfs_time; -+ -+ if(inodeb.inode_type != SQUASHFS_IPC_TYPE) -+ i->i_uid = msBlk->uid[((inodeb.inode_type - 1) / SQUASHFS_TYPES) * 16 + inodeb.uid]; -+ i->i_ino = SQUASHFS_MK_VFS_INODE(block - sBlk->inode_table_start, offset); -+ -+ i->i_mode = inodeb.mode; -+ -+ switch(inodeb.inode_type == SQUASHFS_IPC_TYPE ? SQUASHFS_IPC_TYPE : (inodeb.inode_type - 1) % SQUASHFS_TYPES + 1) { -+ case SQUASHFS_FILE_TYPE: { -+ squashfs_reg_inode_header_1 inodep; -+ -+ if(msBlk->swap) { -+ squashfs_reg_inode_header_1 sinodep; -+ -+ if(!squashfs_get_cached_block(s, (char *) &sinodep, block, offset, sizeof(sinodep), -+ &next_block, &next_offset)) -+ goto failed_read; -+ SQUASHFS_SWAP_REG_INODE_HEADER_1(&inodep, &sinodep); -+ } else -+ if(!squashfs_get_cached_block(s, (char *) &inodep, block, offset, sizeof(inodep), -+ &next_block, &next_offset)) -+ goto failed_read; -+ -+ i->i_size = inodep.file_size; -+ i->i_fop = &generic_ro_fops; -+ if(sBlk->block_size > 4096) -+ i->i_data.a_ops = &squashfs_aops; -+ else if(sBlk->block_size == 4096) -+ i->i_data.a_ops = &squashfs_aops_4K; -+ else -+ i->i_data.a_ops = &squashfs_aops_lessthan4K; -+ i->i_mode |= S_IFREG; -+ i->i_mtime = inodep.mtime; -+ i->i_atime = inodep.mtime; -+ i->i_ctime = inodep.mtime; -+ i->i_blocks = ((i->i_size - 1) >> 9) + 1; -+ i->i_blksize = PAGE_CACHE_SIZE; -+ i->u.squashfs_i.u.s1.fragment_start_block = SQUASHFS_INVALID_BLK; -+ i->u.squashfs_i.u.s1.fragment_offset = 0; -+ i->u.squashfs_i.start_block = inodep.start_block; -+ i->u.squashfs_i.block_list_start = next_block; -+ i->u.squashfs_i.offset = next_offset; -+ TRACE("File inode %x:%x, start_block %x, block_list_start %x, offset %x\n", -+ SQUASHFS_INODE_BLK(inode), offset, inodep.start_block, next_block, next_offset); -+ break; -+ } -+ case SQUASHFS_DIR_TYPE: { -+ squashfs_dir_inode_header_1 inodep; -+ -+ if(msBlk->swap) { -+ squashfs_dir_inode_header_1 sinodep; -+ -+ if(!squashfs_get_cached_block(s, (char *) &sinodep, block, offset, sizeof(sinodep), -+ &next_block, &next_offset)) -+ goto failed_read; -+ SQUASHFS_SWAP_DIR_INODE_HEADER_1(&inodep, &sinodep); -+ } else -+ if(!squashfs_get_cached_block(s, (char *) &inodep, block, offset, sizeof(inodep), -+ &next_block, &next_offset)) -+ goto failed_read; -+ -+ i->i_size = inodep.file_size; -+ i->i_op = &squashfs_dir_inode_ops; -+ i->i_fop = &squashfs_dir_ops; -+ i->i_mode |= S_IFDIR; -+ i->i_mtime = inodep.mtime; -+ i->i_atime = inodep.mtime; -+ i->i_ctime = inodep.mtime; -+ i->u.squashfs_i.start_block = inodep.start_block; -+ i->u.squashfs_i.offset = inodep.offset; -+ i->u.squashfs_i.u.s2.directory_index_count = 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_SYMLINK_TYPE: { -+ squashfs_symlink_inode_header_1 inodep; -+ -+ if(msBlk->swap) { -+ squashfs_symlink_inode_header_1 sinodep; -+ -+ if(!squashfs_get_cached_block(s, (char *) &sinodep, block, offset, sizeof(sinodep), -+ &next_block, &next_offset)) -+ goto failed_read; -+ SQUASHFS_SWAP_SYMLINK_INODE_HEADER_1(&inodep, &sinodep); -+ } else -+ if(!squashfs_get_cached_block(s, (char *) &inodep, block, offset, sizeof(inodep), -+ &next_block, &next_offset)) -+ goto failed_read; -+ -+ 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; -+ i->u.squashfs_i.start_block = next_block; -+ i->u.squashfs_i.offset = next_offset; -+ TRACE("Symbolic link inode %x:%x, start_block %x, offset %x\n", -+ SQUASHFS_INODE_BLK(inode), offset, next_block, next_offset); -+ break; -+ } -+ case SQUASHFS_BLKDEV_TYPE: -+ case SQUASHFS_CHRDEV_TYPE: { -+ squashfs_dev_inode_header_1 inodep; -+ -+ if(msBlk->swap) { -+ squashfs_dev_inode_header_1 sinodep; -+ -+ if(!squashfs_get_cached_block(s, (char *) &sinodep, block, offset, sizeof(sinodep), -+ &next_block, &next_offset)) -+ goto failed_read; -+ SQUASHFS_SWAP_DEV_INODE_HEADER_1(&inodep, &sinodep); -+ } else -+ if(!squashfs_get_cached_block(s, (char *) &inodep, block, offset, sizeof(inodep), -+ &next_block, &next_offset)) -+ goto failed_read; -+ -+ i->i_size = 0; -+ i->i_mode |= (inodeb.inode_type == SQUASHFS_CHRDEV_TYPE) ? S_IFCHR : S_IFBLK; -+ init_special_inode(i, i->i_mode, inodep.rdev); -+ TRACE("Device inode %x:%x, rdev %x\n", SQUASHFS_INODE_BLK(inode), offset, inodep.rdev); -+ break; -+ } -+ case SQUASHFS_IPC_TYPE: { -+ squashfs_ipc_inode_header_1 inodep; -+ -+ if(msBlk->swap) { -+ squashfs_ipc_inode_header_1 sinodep; -+ -+ if(!squashfs_get_cached_block(s, (char *) &sinodep, block, offset, sizeof(sinodep), -+ &next_block, &next_offset)) -+ goto failed_read; -+ SQUASHFS_SWAP_IPC_INODE_HEADER_1(&inodep, &sinodep); -+ } else -+ if(!squashfs_get_cached_block(s, (char *) &inodep, block, offset, sizeof(inodep), -+ &next_block, &next_offset)) -+ goto failed_read; -+ -+ i->i_size = 0; -+ i->i_mode |= (inodep.type == SQUASHFS_FIFO_TYPE) ? S_IFIFO : S_IFSOCK; -+ i->i_uid = msBlk->uid[inodep.offset * 16 + inodeb.uid]; -+ 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; -+ } -+ -+ if(inodeb.guid == 15) -+ i->i_gid = i->i_uid; -+ else -+ i->i_gid = msBlk->guid[inodeb.guid]; -+ -+ insert_inode_hash(i); -+ return i; -+ -+failed_read: -+ ERROR("Unable to read inode [%x:%x]\n", block, offset); -+ -+failed_read1: -+ return NULL; -+} -+#endif -+ -+ -+static struct inode *squashfs_iget(struct super_block *s, squashfs_inode inode) -+{ -+ struct inode *i = new_inode(s); -+ squashfs_sb_info *msBlk = &s->u.squashfs_sb; -+ 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 next_block, next_offset; -+ squashfs_base_inode_header inodeb; -+ -+ TRACE("Entered squashfs_iget\n"); -+ -+ if(msBlk->swap) { -+ squashfs_base_inode_header sinodeb; -+ -+ 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; -+ -+ i->i_nlink = 1; -+ -+ i->i_mtime = sBlk->mkfs_time; -+ i->i_atime = sBlk->mkfs_time; -+ i->i_ctime = sBlk->mkfs_time; -+ -+ i->i_uid = msBlk->uid[inodeb.uid]; -+ i->i_ino = SQUASHFS_MK_VFS_INODE(block - sBlk->inode_table_start, offset); -+ -+ i->i_mode = inodeb.mode; -+ -+ switch(inodeb.inode_type) { -+ case SQUASHFS_FILE_TYPE: { -+ squashfs_reg_inode_header inodep; -+ -+ if(msBlk->swap) { -+ squashfs_reg_inode_header sinodep; -+ -+ 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; -+ -+ i->u.squashfs_i.u.s1.fragment_start_block = SQUASHFS_INVALID_BLK; -+ if(inodep.fragment != SQUASHFS_INVALID_BLK && !get_fragment_location(s, inodep.fragment, -+ &i->u.squashfs_i.u.s1.fragment_start_block, &i->u.squashfs_i.u.s1.fragment_size)) -+ goto failed_read; -+ -+ i->u.squashfs_i.u.s1.fragment_offset = inodep.offset; -+ i->i_size = inodep.file_size; -+ i->i_fop = &generic_ro_fops; -+ if(sBlk->block_size > 4096) -+ i->i_data.a_ops = &squashfs_aops; -+ else -+ i->i_data.a_ops = &squashfs_aops_4K; -+ i->i_mode |= S_IFREG; -+ i->i_mtime = inodep.mtime; -+ i->i_atime = inodep.mtime; -+ i->i_ctime = inodep.mtime; -+ i->i_blocks = ((i->i_size - 1) >> 9) + 1; -+ i->i_blksize = PAGE_CACHE_SIZE; -+ i->u.squashfs_i.start_block = inodep.start_block; -+ i->u.squashfs_i.block_list_start = next_block; -+ i->u.squashfs_i.offset = next_offset; -+ TRACE("File inode %x:%x, start_block %x, block_list_start %x, offset %x fragment_index %x fragment_offset %x\n", -+ SQUASHFS_INODE_BLK(inode), offset, inodep.start_block, next_block, next_offset, inodep.fragment, inodep.offset); -+ break; -+ } -+ case SQUASHFS_DIR_TYPE: { -+ squashfs_dir_inode_header inodep; -+ -+ if(msBlk->swap) { -+ squashfs_dir_inode_header sinodep; -+ -+ 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; -+ -+ i->i_size = inodep.file_size; -+ i->i_op = &squashfs_dir_inode_ops; -+ i->i_fop = &squashfs_dir_ops; -+ i->i_mode |= S_IFDIR; -+ i->i_mtime = inodep.mtime; -+ i->i_atime = inodep.mtime; -+ i->i_ctime = inodep.mtime; -+ i->u.squashfs_i.start_block = inodep.start_block; -+ i->u.squashfs_i.offset = inodep.offset; -+ i->u.squashfs_i.u.s2.directory_index_count = 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: { -+ squashfs_ldir_inode_header inodep; -+ -+ if(msBlk->swap) { -+ squashfs_ldir_inode_header sinodep; -+ -+ 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; -+ -+ i->i_size = inodep.file_size; -+ i->i_op = &squashfs_dir_inode_ops; -+ i->i_fop = &squashfs_dir_ops; -+ i->i_mode |= S_IFDIR; -+ i->i_mtime = inodep.mtime; -+ i->i_atime = inodep.mtime; -+ i->i_ctime = inodep.mtime; -+ i->u.squashfs_i.start_block = inodep.start_block; -+ i->u.squashfs_i.offset = inodep.offset; -+ i->u.squashfs_i.u.s2.directory_index_start = next_block; -+ i->u.squashfs_i.u.s2.directory_index_offset = next_offset; -+ i->u.squashfs_i.u.s2.directory_index_count = inodep.i_count; -+ 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: { -+ squashfs_symlink_inode_header inodep; -+ -+ if(msBlk->swap) { -+ squashfs_symlink_inode_header sinodep; -+ -+ 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; -+ -+ 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; -+ i->u.squashfs_i.start_block = next_block; -+ i->u.squashfs_i.offset = next_offset; -+ TRACE("Symbolic link inode %x:%x, start_block %x, offset %x\n", -+ SQUASHFS_INODE_BLK(inode), offset, next_block, next_offset); -+ break; -+ } -+ case SQUASHFS_BLKDEV_TYPE: -+ case SQUASHFS_CHRDEV_TYPE: { -+ squashfs_dev_inode_header inodep; -+ -+ if(msBlk->swap) { -+ squashfs_dev_inode_header sinodep; -+ -+ 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; -+ -+ i->i_size = 0; -+ i->i_mode |= (inodeb.inode_type == SQUASHFS_CHRDEV_TYPE) ? S_IFCHR : S_IFBLK; -+ init_special_inode(i, i->i_mode, 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: { -+ i->i_size = 0; -+ 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; -+ } -+ -+ if(inodeb.guid == SQUASHFS_GUIDS) -+ i->i_gid = i->i_uid; -+ else -+ i->i_gid = msBlk->guid[inodeb.guid]; -+ -+ insert_inode_hash(i); -+ return i; -+ -+failed_read: -+ ERROR("Unable to read inode [%x:%x]\n", block, offset); -+ -+failed_read1: -+ return NULL; -+} -+ -+ -+static struct super_block *squashfs_read_super(struct super_block *s, -+ void *data, int silent) -+{ -+ kdev_t dev = s->s_dev; -+ squashfs_sb_info *msBlk = &s->u.squashfs_sb; -+ squashfs_super_block *sBlk = &msBlk->sBlk; -+ int i; -+ -+ TRACE("Entered squashfs_read_superblock\n"); -+ -+ msBlk->devblksize = get_hardsect_size(dev); -+ if(msBlk->devblksize < BLOCK_SIZE) -+ msBlk->devblksize = BLOCK_SIZE; -+ msBlk->devblksize_log2 = ffz(~msBlk->devblksize); -+ set_blocksize(dev, msBlk->devblksize); -+ s->s_blocksize = msBlk->devblksize; -+ s->s_blocksize_bits = msBlk->devblksize_log2; -+ -+ init_MUTEX(&msBlk->read_page_mutex); -+ init_MUTEX(&msBlk->block_cache_mutex); -+ init_MUTEX(&msBlk->fragment_mutex); -+ -+ init_waitqueue_head(&msBlk->waitq); -+ init_waitqueue_head(&msBlk->fragment_wait_queue); -+ -+ if(!read_data(s, (char *) sBlk, SQUASHFS_START, sizeof(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) { -+ squashfs_super_block sblk; -+ WARNING("Mounting a different endian SQUASHFS filesystem on %s\n", bdevname(dev)); -+ SQUASHFS_SWAP_SUPER_BLOCK(&sblk, sBlk); -+ memcpy(sBlk, &sblk, sizeof(squashfs_super_block)); -+ msBlk->swap = 1; -+ } else { -+ SERROR("Can't find a SQUASHFS superblock on %s\n", bdevname(dev)); -+ goto failed_mount; -+ } -+ } -+ -+ /* Check the MAJOR & MINOR versions */ -+#ifdef SQUASHFS_1_0_COMPATIBILITY -+ if((sBlk->s_major != 1) && (sBlk->s_major != 2 || sBlk->s_minor > SQUASHFS_MINOR)) { -+ SERROR("Major/Minor mismatch, filesystem is (%d:%d), I support (1 : x) or (2 : <= %d)\n", -+ sBlk->s_major, sBlk->s_minor, SQUASHFS_MINOR); -+ goto failed_mount; -+ } -+ if(sBlk->s_major == 1) -+ sBlk->block_size = sBlk->block_size_1; -+#else -+ if(sBlk->s_major != SQUASHFS_MAJOR || sBlk->s_minor > SQUASHFS_MINOR) { -+ SERROR("Major/Minor mismatch, filesystem is (%d:%d), I support (%d: <= %d)\n", -+ sBlk->s_major, sBlk->s_minor, SQUASHFS_MAJOR, SQUASHFS_MINOR); -+ goto failed_mount; -+ } -+#endif -+ -+ TRACE("Found valid superblock on %s\n", bdevname(dev)); -+ 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 %d 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 %x\n", sBlk->inode_table_start); -+ TRACE("sBlk->directory_table_start %x\n", sBlk->directory_table_start); -+ if(sBlk->s_major > 1) -+ TRACE("sBlk->fragment_table_start %x\n", sBlk->fragment_table_start); -+ TRACE("sBlk->uid_start %x\n", sBlk->uid_start); -+ -+ s->s_flags |= MS_RDONLY; -+ s->s_op = &squashfs_ops; -+ -+ /* Init inode_table block pointer array */ -+ if(!(msBlk->block_cache = (squashfs_cache *) kmalloc(sizeof(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 = (char *) kmalloc(msBlk->read_size, GFP_KERNEL))) { -+ ERROR("Failed to allocate read_data block\n"); -+ goto failed_mount1; -+ } -+ -+ /* Allocate read_page block */ -+ if(sBlk->block_size > PAGE_CACHE_SIZE) { -+ if(!(msBlk->read_page = (char *) kmalloc(sBlk->block_size, GFP_KERNEL))) { -+ ERROR("Failed to allocate read_page block\n"); -+ goto failed_mount2; -+ } -+ } else -+ msBlk->read_page = NULL; -+ -+ /* Allocate uid and gid tables */ -+ if(!(msBlk->uid = (squashfs_uid *) kmalloc((sBlk->no_uids + -+ sBlk->no_guids) * sizeof(squashfs_uid), GFP_KERNEL))) { -+ ERROR("Failed to allocate uid/gid table\n"); -+ goto failed_mount3; -+ } -+ msBlk->guid = msBlk->uid + sBlk->no_uids; -+ -+ if(msBlk->swap) { -+ squashfs_uid suid[sBlk->no_uids + sBlk->no_guids]; -+ -+ if(!read_data(s, (char *) &suid, sBlk->uid_start, ((sBlk->no_uids + sBlk->no_guids) * -+ sizeof(squashfs_uid)) | SQUASHFS_COMPRESSED_BIT_BLOCK, NULL)) { -+ SERROR("unable to read uid/gid table\n"); -+ goto failed_mount4; -+ } -+ SQUASHFS_SWAP_DATA(msBlk->uid, suid, (sBlk->no_uids + sBlk->no_guids), (sizeof(squashfs_uid) * 8)); -+ } else -+ if(!read_data(s, (char *) msBlk->uid, sBlk->uid_start, ((sBlk->no_uids + sBlk->no_guids) * -+ sizeof(squashfs_uid)) | SQUASHFS_COMPRESSED_BIT_BLOCK, NULL)) { -+ SERROR("unable to read uid/gid table\n"); -+ goto failed_mount4; -+ } -+ -+ -+#ifdef SQUASHFS_1_0_COMPATIBILITY -+ if(sBlk->s_major == 1) { -+ msBlk->iget = squashfs_iget_1; -+ msBlk->read_blocklist = read_blocklist_1; -+ msBlk->fragment = NULL; -+ msBlk->fragment_index = NULL; -+ goto allocate_root; -+ } -+#endif -+ msBlk->iget = squashfs_iget; -+ msBlk->read_blocklist = read_blocklist; -+ -+ if(!(msBlk->fragment = (struct squashfs_fragment_cache *) kmalloc(sizeof(struct squashfs_fragment_cache) * SQUASHFS_CACHED_FRAGMENTS, GFP_KERNEL))) { -+ ERROR("Failed to allocate fragment block cache\n"); -+ goto failed_mount4; -+ } -+ -+ 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->fragment_index = (squashfs_fragment_index *) kmalloc(SQUASHFS_FRAGMENT_INDEX_BYTES(sBlk->fragments), GFP_KERNEL))) { -+ ERROR("Failed to allocate uid/gid table\n"); -+ goto failed_mount5; -+ } -+ -+ if(SQUASHFS_FRAGMENT_INDEX_BYTES(sBlk->fragments) && -+ !read_data(s, (char *) msBlk->fragment_index, sBlk->fragment_table_start, -+ SQUASHFS_FRAGMENT_INDEX_BYTES(sBlk->fragments) | SQUASHFS_COMPRESSED_BIT_BLOCK, NULL)) { -+ SERROR("unable to read fragment index table\n"); -+ goto failed_mount6; -+ } -+ -+ if(msBlk->swap) { -+ int i; -+ squashfs_fragment_index 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; -+ } -+ } -+ -+#ifdef SQUASHFS_1_0_COMPATIBILITY -+allocate_root: -+#endif -+ if(!(s->s_root = d_alloc_root((msBlk->iget)(s, sBlk->root_inode)))) { -+ ERROR("Root inode create failed\n"); -+ goto failed_mount5; -+ } -+ -+ TRACE("Leaving squashfs_read_super\n"); -+ return s; -+ -+failed_mount6: -+ kfree(msBlk->fragment_index); -+failed_mount5: -+ kfree(msBlk->fragment); -+failed_mount4: -+ kfree(msBlk->uid); -+failed_mount3: -+ kfree(msBlk->read_page); -+failed_mount2: -+ kfree(msBlk->read_data); -+failed_mount1: -+ kfree(msBlk->block_cache); -+failed_mount: -+ return NULL; -+} -+ -+ -+static int squashfs_statfs(struct super_block *s, struct statfs *buf) -+{ -+ squashfs_super_block *sBlk = &s->u.squashfs_sb.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; -+ unsigned int block = inode->u.squashfs_i.start_block; -+ int offset = inode->u.squashfs_i.offset; -+ void *pageaddr = kmap(page); -+ -+ TRACE("Entered squashfs_symlink_readpage, page index %x, start block %x, offset %x\n", -+ (unsigned int) page->index, inode->u.squashfs_i.start_block, inode->u.squashfs_i.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 [%x:%x]\n", block, offset); -+ goto skip_read; -+ } -+ } -+ -+ if(length != index) { -+ ERROR("(squashfs_symlink_readpage) length != index\n"); -+ bytes = 0; -+ goto skip_read; -+ } -+ -+ bytes = (inode->i_size - length) > PAGE_CACHE_SIZE ? PAGE_CACHE_SIZE : inode->i_size - length; -+ if(!(bytes = squashfs_get_cached_block(inode->i_sb, pageaddr, block, offset, bytes, &block, &offset))) -+ ERROR("Unable to read symbolic link [%x:%x]\n", block, offset); -+ -+skip_read: -+ memset(pageaddr + bytes, 0, PAGE_CACHE_SIZE - bytes); -+ kunmap(page); -+ flush_dcache_page(page); -+ SetPageUptodate(page); -+ UnlockPage(page); -+ -+ return 0; -+} -+ -+ -+#define SIZE 256 -+ -+#ifdef SQUASHFS_1_0_COMPATIBILITY -+static unsigned int read_blocklist_1(struct inode *inode, int index, int readahead_blks, -+ char *block_list, unsigned short **block_p, unsigned int *bsize) -+{ -+ squashfs_sb_info *msBlk = &inode->i_sb->u.squashfs_sb; -+ unsigned short *block_listp; -+ int i = 0; -+ int block_ptr = inode->u.squashfs_i.block_list_start; -+ int offset = inode->u.squashfs_i.offset; -+ unsigned int block = inode->u.squashfs_i.start_block; -+ -+ for(;;) { -+ int blocks = (index + readahead_blks - i); -+ if(blocks > (SIZE >> 1)) { -+ if((index - i) <= (SIZE >> 1)) -+ blocks = index - i; -+ else -+ blocks = SIZE >> 1; -+ } -+ -+ if(msBlk->swap) { -+ unsigned char sblock_list[SIZE]; -+ if(!squashfs_get_cached_block(inode->i_sb, (char *) sblock_list, block_ptr, offset, blocks << 1, &block_ptr, &offset)) { -+ ERROR("Unable to read block list [%d:%x]\n", block_ptr, offset); -+ return 0; -+ } -+ SQUASHFS_SWAP_SHORTS(((unsigned short *)block_list), ((unsigned short *)sblock_list), blocks); -+ } else -+ if(!squashfs_get_cached_block(inode->i_sb, (char *) block_list, block_ptr, offset, blocks << 1, &block_ptr, &offset)) { -+ ERROR("Unable to read block list [%d:%x]\n", block_ptr, offset); -+ return 0; -+ } -+ for(block_listp = (unsigned short *) block_list; i < index && blocks; i ++, block_listp ++, blocks --) -+ block += SQUASHFS_COMPRESSED_SIZE(*block_listp); -+ if(blocks >= readahead_blks) -+ break; -+ } -+ -+ if(bsize) -+ *bsize = SQUASHFS_COMPRESSED_SIZE(*block_listp) | (!SQUASHFS_COMPRESSED(*block_listp) ? SQUASHFS_COMPRESSED_BIT_BLOCK : 0); -+ else -+ *block_p = block_listp; -+ return block; -+} -+#endif -+ -+ -+ -+static unsigned int read_blocklist(struct inode *inode, int index, int readahead_blks, -+ char *block_list, unsigned short **block_p, unsigned int *bsize) -+{ -+ squashfs_sb_info *msBlk = &inode->i_sb->u.squashfs_sb; -+ unsigned int *block_listp; -+ int i = 0; -+ int block_ptr = inode->u.squashfs_i.block_list_start; -+ int offset = inode->u.squashfs_i.offset; -+ unsigned int block = inode->u.squashfs_i.start_block; -+ -+ for(;;) { -+ int blocks = (index + readahead_blks - i); -+ if(blocks > (SIZE >> 2)) { -+ if((index - i) <= (SIZE >> 2)) -+ blocks = index - i; -+ else -+ blocks = SIZE >> 2; -+ } -+ -+ if(msBlk->swap) { -+ unsigned char sblock_list[SIZE]; -+ if(!squashfs_get_cached_block(inode->i_sb, (char *) sblock_list, block_ptr, offset, blocks << 2, &block_ptr, &offset)) { -+ ERROR("Unable to read block list [%d:%x]\n", block_ptr, offset); -+ return 0; -+ } -+ SQUASHFS_SWAP_INTS(((unsigned int *)block_list), ((unsigned int *)sblock_list), blocks); -+ } else -+ if(!squashfs_get_cached_block(inode->i_sb, (char *) block_list, block_ptr, offset, blocks << 2, &block_ptr, &offset)) { -+ ERROR("Unable to read block list [%d:%x]\n", block_ptr, offset); -+ return 0; -+ } -+ for(block_listp = (unsigned int *) block_list; i < index && blocks; i ++, block_listp ++, blocks --) -+ block += SQUASHFS_COMPRESSED_SIZE_BLOCK(*block_listp); -+ if(blocks >= readahead_blks) -+ break; -+ } -+ -+ *bsize = *block_listp; -+ return block; -+} -+ -+ -+static int squashfs_readpage(struct file *file, struct page *page) -+{ -+ struct inode *inode = page->mapping->host; -+ squashfs_sb_info *msBlk = &inode->i_sb->u.squashfs_sb; -+ squashfs_super_block *sBlk = &msBlk->sBlk; -+ unsigned char block_list[SIZE]; -+ unsigned int bsize, block, i = 0, bytes = 0, byte_offset = 0; -+ int index = page->index >> (sBlk->block_log - PAGE_CACHE_SHIFT); -+ void *pageaddr = kmap(page); -+ 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 %x, start block %x\n", (unsigned int) page->index, -+ inode->u.squashfs_i.start_block); -+ -+ if(page->index >= ((inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT)) { -+ goto skip_read; -+ } -+ -+ if(inode->u.squashfs_i.u.s1.fragment_start_block == SQUASHFS_INVALID_BLK || index < (inode->i_size >> 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 = read_data(inode->i_sb, msBlk->read_page, block, bsize, NULL))) { -+ ERROR("Unable to read page, block %x, size %x\n", block, bsize); -+ up(&msBlk->read_page_mutex); -+ goto skip_read; -+ } -+ } else { -+ if((fragment = get_cached_fragment(inode->i_sb, inode->u.squashfs_i.u.s1.fragment_start_block, inode->u.squashfs_i.u.s1.fragment_size)) == NULL) { -+ ERROR("Unable to read page, block %x, size %x\n", inode->u.squashfs_i.u.s1.fragment_start_block, (int) inode->u.squashfs_i.u.s1.fragment_size); -+ goto skip_read; -+ } -+ bytes = inode->u.squashfs_i.u.s1.fragment_offset + (inode->i_size & (sBlk->block_size - 1)); -+ byte_offset = inode->u.squashfs_i.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) { -+ memcpy(pageaddr, data_ptr + byte_offset, available_bytes); -+ memset(pageaddr + available_bytes, 0, PAGE_CACHE_SIZE - available_bytes); -+ kunmap(page); -+ flush_dcache_page(page); -+ SetPageUptodate(page); -+ UnlockPage(page); -+ } else if((push_page = grab_cache_page_nowait(page->mapping, i))) { -+ void *pageaddr = kmap(push_page); -+ memcpy(pageaddr, data_ptr + byte_offset, available_bytes); -+ memset(pageaddr + available_bytes, 0, PAGE_CACHE_SIZE - available_bytes); -+ kunmap(push_page); -+ flush_dcache_page(push_page); -+ SetPageUptodate(push_page); -+ UnlockPage(push_page); -+ page_cache_release(push_page); -+ } -+ } -+ -+ if(inode->u.squashfs_i.u.s1.fragment_start_block == SQUASHFS_INVALID_BLK || index < (inode->i_size >> sBlk->block_log)) -+ up(&msBlk->read_page_mutex); -+ else -+ release_cached_fragment(msBlk, fragment); -+ -+ return 0; -+ -+skip_read: -+ memset(pageaddr + bytes, 0, PAGE_CACHE_SIZE - bytes); -+ kunmap(page); -+ flush_dcache_page(page); -+ SetPageUptodate(page); -+ UnlockPage(page); -+ -+ return 0; -+} -+ -+ -+static int squashfs_readpage4K(struct file *file, struct page *page) -+{ -+ struct inode *inode = page->mapping->host; -+ squashfs_sb_info *msBlk = &inode->i_sb->u.squashfs_sb; -+ squashfs_super_block *sBlk = &msBlk->sBlk; -+ unsigned char block_list[SIZE]; -+ unsigned int bsize, block, bytes = 0; -+ void *pageaddr = kmap(page); -+ -+ TRACE("Entered squashfs_readpage4K, page index %x, start block %x\n", (unsigned int) page->index, -+ inode->u.squashfs_i.start_block); -+ -+ if(page->index >= ((inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT)) { -+ goto skip_read; -+ } -+ -+ if(inode->u.squashfs_i.u.s1.fragment_start_block == SQUASHFS_INVALID_BLK || page->index < (inode->i_size >> sBlk->block_log)) { -+ block = (msBlk->read_blocklist)(inode, page->index, 1, block_list, NULL, &bsize); -+ -+ if(!(bytes = read_data(inode->i_sb, pageaddr, block, bsize, NULL))) -+ ERROR("Unable to read page, block %x, size %x\n", block, bsize); -+ } else { -+ struct squashfs_fragment_cache *fragment; -+ -+ if((fragment = get_cached_fragment(inode->i_sb, inode->u.squashfs_i.u.s1.fragment_start_block, inode->u.squashfs_i.u.s1.fragment_size)) == NULL) -+ ERROR("Unable to read page, block %x, size %x\n", inode->u.squashfs_i.u.s1.fragment_start_block, (int) inode->u.squashfs_i.u.s1.fragment_size); -+ else { -+ bytes = inode->i_size & (sBlk->block_size - 1); -+ memcpy(pageaddr, fragment->data + inode->u.squashfs_i.u.s1.fragment_offset, bytes); -+ release_cached_fragment(msBlk, fragment); -+ } -+ } -+ -+skip_read: -+ memset(pageaddr + bytes, 0, PAGE_CACHE_SIZE - bytes); -+ kunmap(page); -+ flush_dcache_page(page); -+ SetPageUptodate(page); -+ UnlockPage(page); -+ -+ return 0; -+} -+ -+ -+#ifdef SQUASHFS_1_0_COMPATIBILITY -+static int squashfs_readpage_lessthan4K(struct file *file, struct page *page) -+{ -+ struct inode *inode = page->mapping->host; -+ squashfs_sb_info *msBlk = &inode->i_sb->u.squashfs_sb; -+ squashfs_super_block *sBlk = &msBlk->sBlk; -+ unsigned char block_list[SIZE]; -+ unsigned short *block_listp, block, bytes = 0; -+ int index = page->index << (PAGE_CACHE_SHIFT - sBlk->block_log); -+ int file_blocks = ((inode->i_size - 1) >> sBlk->block_log) + 1; -+ int readahead_blks = 1 << (PAGE_CACHE_SHIFT - sBlk->block_log); -+ void *pageaddr = kmap(page); -+ -+ int i_end = index + (1 << (PAGE_CACHE_SHIFT - sBlk->block_log)); -+ int byte; -+ -+ TRACE("Entered squashfs_readpage_lessthan4K, page index %x, start block %x\n", (unsigned int) page->index, -+ inode->u.squashfs_i.start_block); -+ -+ block = read_blocklist_1(inode, index, readahead_blks, block_list, &block_listp, NULL); -+ -+ if(i_end > file_blocks) -+ i_end = file_blocks; -+ -+ while(index < i_end) { -+ int c_byte = !SQUASHFS_COMPRESSED(*block_listp) ? SQUASHFS_COMPRESSED_SIZE(*block_listp) | SQUASHFS_COMPRESSED_BIT_BLOCK : *block_listp; -+ if(!(byte = read_data(inode->i_sb, pageaddr, block, c_byte, NULL))) { -+ ERROR("Unable to read page, block %x, size %x\n", block, *block_listp); -+ goto skip_read; -+ } -+ block += SQUASHFS_COMPRESSED_SIZE(*block_listp); -+ pageaddr += byte; -+ bytes += byte; -+ index ++; -+ block_listp ++; -+ } -+ -+skip_read: -+ memset(pageaddr, 0, PAGE_CACHE_SIZE - bytes); -+ kunmap(page); -+ flush_dcache_page(page); -+ SetPageUptodate(page); -+ UnlockPage(page); -+ -+ return 0; -+} -+#endif -+ -+ -+static int get_dir_index_using_offset(struct super_block *s, unsigned int *next_block, -+ unsigned int *next_offset, unsigned int index_start, unsigned int index_offset, -+ int i_count, long long f_pos) -+{ -+ squashfs_sb_info *msBlk = &s->u.squashfs_sb; -+ squashfs_super_block *sBlk = &msBlk->sBlk; -+ int i, length = 0; -+ squashfs_dir_index 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) -+ return 0; -+ -+ for(i = 0; i < i_count; i++) { -+ if(msBlk->swap) { -+ 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; -+ return length; -+} -+ -+ -+static int get_dir_index_using_name(struct super_block *s, unsigned int *next_block, -+ unsigned int *next_offset, unsigned int index_start, unsigned int index_offset, -+ int i_count, const char *name, int size) -+{ -+ squashfs_sb_info *msBlk = &s->u.squashfs_sb; -+ squashfs_super_block *sBlk = &msBlk->sBlk; -+ int i, length = 0; -+ char buffer[sizeof(squashfs_dir_index) + SQUASHFS_NAME_LEN + 1]; -+ squashfs_dir_index *index = (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) { -+ 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(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; -+} -+ -+ -+static int squashfs_readdir(struct file *file, void *dirent, filldir_t filldir) -+{ -+ struct inode *i = file->f_dentry->d_inode; -+ squashfs_sb_info *msBlk = &i->i_sb->u.squashfs_sb; -+ squashfs_super_block *sBlk = &msBlk->sBlk; -+ int next_block = i->u.squashfs_i.start_block + sBlk->directory_table_start, next_offset = -+ i->u.squashfs_i.offset, length = 0, dirs_read = 0, dir_count; -+ squashfs_dir_header dirh; -+ char buffer[sizeof(squashfs_dir_entry) + SQUASHFS_NAME_LEN + 1]; -+ squashfs_dir_entry *dire = (squashfs_dir_entry *) buffer; -+ -+ TRACE("Entered squashfs_readdir [%x:%x]\n", next_block, next_offset); -+ -+ length = get_dir_index_using_offset(i->i_sb, &next_block, &next_offset, i->u.squashfs_i.u.s2.directory_index_start, -+ i->u.squashfs_i.u.s2.directory_index_offset, i->u.squashfs_i.u.s2.directory_index_count, file->f_pos); -+ -+ while(length < i->i_size) { -+ /* read directory header */ -+ if(msBlk->swap) { -+ 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) { -+ 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)\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"); -+ return dirs_read; -+ } -+ -+ file->f_pos = length; -+ dirs_read ++; -+ } -+ } -+ -+ return dirs_read; -+ -+failed_read: -+ ERROR("Unable to read directory block [%x:%x]\n", next_block, next_offset); -+ return 0; -+} -+ -+ -+static struct dentry *squashfs_lookup(struct inode *i, struct dentry *dentry) -+{ -+ const char *name =dentry->d_name.name; -+ int len = dentry->d_name.len; -+ struct inode *inode = NULL; -+ squashfs_sb_info *msBlk = &i->i_sb->u.squashfs_sb; -+ squashfs_super_block *sBlk = &msBlk->sBlk; -+ int next_block = i->u.squashfs_i.start_block + sBlk->directory_table_start, next_offset = -+ i->u.squashfs_i.offset, length = 0, dir_count; -+ squashfs_dir_header dirh; -+ char buffer[sizeof(squashfs_dir_entry) + SQUASHFS_NAME_LEN]; -+ squashfs_dir_entry *dire = (squashfs_dir_entry *) buffer; -+ int squashfs_2_1 = sBlk->s_major == 2 && sBlk->s_minor == 1; -+ -+ TRACE("Entered squashfs_lookup [%x:%x]\n", next_block, next_offset); -+ -+ length = get_dir_index_using_name(i->i_sb, &next_block, &next_offset, i->u.squashfs_i.u.s2.directory_index_start, -+ i->u.squashfs_i.u.s2.directory_index_offset, i->u.squashfs_i.u.s2.directory_index_count, name, len); -+ -+ while(length < i->i_size) { -+ /* read directory header */ -+ if(msBlk->swap) { -+ 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) { -+ 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(squashfs_2_1 && name[0] < dire->name[0]) -+ goto exit_loop; -+ -+ if((len == dire->size + 1) && !strncmp(name, dire->name, len)) { -+ squashfs_inode ino = SQUASHFS_MKINODE(dirh.start_block, dire->offset); -+ -+ TRACE("calling squashfs_iget for directory entry %s, inode %x:%x\n", -+ name, dirh.start_block, dire->offset); -+ -+ 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 [%x:%x]\n", next_block, next_offset); -+ goto exit_loop; -+} -+ -+ -+static void squashfs_put_super(struct super_block *s) -+{ -+ int i; -+ -+ squashfs_sb_info *sbi = (squashfs_sb_info *) &s->u.squashfs_sb; -+ 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); -+ kfree(sbi->block_cache); -+ } -+ if(sbi->read_data) kfree(sbi->read_data); -+ if(sbi->read_page) kfree(sbi->read_page); -+ if(sbi->uid) kfree(sbi->uid); -+ if(sbi->fragment) { -+ for(i = 0; i < SQUASHFS_CACHED_FRAGMENTS; i++) -+ if(sbi->fragment[i].data != NULL) -+ kfree(sbi->fragment[i].data); -+ kfree(sbi->fragment); -+ } -+ if(sbi->fragment_index) kfree(sbi->fragment_index); -+ sbi->block_cache = NULL; -+ sbi->uid = NULL; -+ sbi->read_data = NULL; -+ sbi->read_page = NULL; -+ sbi->fragment = NULL; -+ sbi->fragment_index = NULL; -+} -+ -+ -+static int __init init_squashfs_fs(void) -+{ -+ -+ printk(KERN_INFO "Squashfs 2.1-r2 (released 2004/12/15) (C) 2002-2004 Phillip Lougher\n"); -+ -+ if(!(stream.workspace = (char *) vmalloc(zlib_inflate_workspacesize()))) { -+ ERROR("Failed to allocate zlib workspace\n"); -+ return -ENOMEM; -+ } -+ return register_filesystem(&squashfs_fs_type); -+} -+ -+ -+static void __exit exit_squashfs_fs(void) -+{ -+ vfree(stream.workspace); -+ unregister_filesystem(&squashfs_fs_type); -+} -+ -+ -+EXPORT_NO_SYMBOLS; -+ -+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"); -diff --new-file -ur linux-2.4.28/fs/squashfs/Makefile linux-2.4.28-squashfs2.1-r2/fs/squashfs/Makefile ---- linux-2.4.28/fs/squashfs/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.28-squashfs2.1-r2/fs/squashfs/Makefile 2004-12-02 02:14:05.000000000 +0000 -@@ -0,0 +1,11 @@ -+# -+# Makefile for the linux squashfs routines. -+# -+ -+O_TARGET := squashfs.o -+ -+obj-y := inode.o -+ -+obj-m := $(O_TARGET) -+ -+include $(TOPDIR)/Rules.make -diff --new-file -ur linux-2.4.28/include/linux/fs.h linux-2.4.28-squashfs2.1-r2/include/linux/fs.h ---- linux-2.4.28/include/linux/fs.h 2004-11-17 11:54:22.000000000 +0000 -+++ linux-2.4.28-squashfs2.1-r2/include/linux/fs.h 2004-12-02 02:14:05.000000000 +0000 -@@ -324,6 +324,7 @@ - #include - #include - #include -+#include - - /* - * Attribute flags. These should be or-ed together to figure out what -@@ -519,6 +520,7 @@ - struct socket socket_i; - struct usbdev_inode_info usbdev_i; - struct jffs2_inode_info jffs2_i; -+ struct squashfs_inode_info squashfs_i; - void *generic_ip; - } u; - }; -@@ -733,6 +735,7 @@ - #include - #include - #include -+#include - - extern struct list_head super_blocks; - extern spinlock_t sb_lock; -@@ -792,6 +795,7 @@ - struct usbdev_sb_info usbdevfs_sb; - struct jffs2_sb_info jffs2_sb; - struct cramfs_sb_info cramfs_sb; -+ struct squashfs_sb_info squashfs_sb; - void *generic_sbp; - } u; - /* -diff --new-file -ur linux-2.4.28/include/linux/squashfs_fs.h linux-2.4.28-squashfs2.1-r2/include/linux/squashfs_fs.h ---- linux-2.4.28/include/linux/squashfs_fs.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.28-squashfs2.1-r2/include/linux/squashfs_fs.h 2004-12-02 02:52:36.000000000 +0000 -@@ -0,0 +1,512 @@ -+#ifndef SQUASHFS_FS -+#define SQUASHFS_FS -+/* -+ * Squashfs -+ * -+ * Copyright (c) 2002, 2003, 2004 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 -+ */ -+ -+#define SQUASHFS_MAJOR 2 -+#define SQUASHFS_MINOR 1 -+#define SQUASHFS_MAGIC 0x73717368 -+#define SQUASHFS_MAGIC_SWAP 0x68737173 -+#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_BLK ((long long) 0xffffffff) -+#define SQUASHFS_USED_BLK ((long long) 0xfffffffe) -+ -+/* 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 -+ -+/* 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)(((squashfs_inode) (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)) -+ -+/* Translate between VFS mode and squashfs mode */ -+#define SQUASHFS_MODE(a) ((a) & 0xfff) -+ -+/* fragment and fragment table defines */ -+typedef unsigned int squashfs_fragment_index; -+#define SQUASHFS_FRAGMENT_BYTES(A) (A * sizeof(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(squashfs_fragment_index)) -+#define SQUASHFS_CACHED_FRAGMENTS 3 -+ -+/* cached data constants for filesystem */ -+#define SQUASHFS_CACHED_BLKS 8 -+ -+#define SQUASHFS_MAX_FILE_SIZE_LOG 32 -+#define SQUASHFS_MAX_FILE_SIZE ((long long) 1 << (SQUASHFS_MAX_FILE_SIZE_LOG - 1)) -+ -+#define SQUASHFS_MARKER_BYTE 0xff -+ -+ -+/* -+ * definitions for structures on disk -+ */ -+ -+typedef unsigned int squashfs_block; -+typedef long long squashfs_inode; -+ -+typedef unsigned int squashfs_uid; -+ -+typedef struct squashfs_super_block { -+ unsigned int s_magic; -+ unsigned int inodes; -+ unsigned int bytes_used; -+ unsigned int uid_start; -+ unsigned int guid_start; -+ unsigned int inode_table_start; -+ unsigned int directory_table_start; -+ 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 root_inode; -+ unsigned int block_size; -+ unsigned int fragments; -+ unsigned int fragment_table_start; -+} __attribute__ ((packed)) squashfs_super_block; -+ -+typedef struct { -+ unsigned int index:27; -+ unsigned int start_block:29; -+ unsigned char size; -+ unsigned char name[0]; -+} __attribute__ ((packed)) squashfs_dir_index; -+ -+typedef struct { -+ 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)) squashfs_base_inode_header; -+ -+typedef squashfs_base_inode_header squashfs_ipc_inode_header; -+ -+typedef struct { -+ 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)) squashfs_dev_inode_header; -+ -+typedef struct { -+ 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)) squashfs_symlink_inode_header; -+ -+typedef struct { -+ 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; -+ squashfs_block start_block; -+ unsigned int fragment; -+ unsigned int offset; -+ unsigned int file_size:SQUASHFS_MAX_FILE_SIZE_LOG; -+ unsigned short block_list[0]; -+} __attribute__ ((packed)) squashfs_reg_inode_header; -+ -+typedef struct { -+ 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)) squashfs_dir_inode_header; -+ -+typedef struct { -+ 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; -+ squashfs_dir_index index[0]; -+} __attribute__ ((packed)) squashfs_ldir_inode_header; -+ -+typedef union { -+ squashfs_base_inode_header base; -+ squashfs_dev_inode_header dev; -+ squashfs_symlink_inode_header symlink; -+ squashfs_reg_inode_header reg; -+ squashfs_dir_inode_header dir; -+ squashfs_ldir_inode_header ldir; -+ squashfs_ipc_inode_header ipc; -+} squashfs_inode_header; -+ -+typedef struct { -+ unsigned int offset:13; -+ unsigned int type:3; -+ unsigned int size:8; -+ char name[0]; -+} __attribute__ ((packed)) squashfs_dir_entry; -+ -+typedef struct { -+ unsigned int count:8; -+ unsigned int start_block:24; -+} __attribute__ ((packed)) squashfs_dir_header; -+ -+typedef struct { -+ unsigned int start_block; -+ unsigned int size; -+} __attribute__ ((packed)) squashfs_fragment_entry; -+ -+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_SUPER_BLOCK(s, d) {\ -+ SQUASHFS_MEMSET(s, d, sizeof(squashfs_super_block));\ -+ SQUASHFS_SWAP((s)->s_magic, d, 0, 32);\ -+ SQUASHFS_SWAP((s)->inodes, d, 32, 32);\ -+ SQUASHFS_SWAP((s)->bytes_used, d, 64, 32);\ -+ SQUASHFS_SWAP((s)->uid_start, d, 96, 32);\ -+ SQUASHFS_SWAP((s)->guid_start, d, 128, 32);\ -+ SQUASHFS_SWAP((s)->inode_table_start, d, 160, 32);\ -+ SQUASHFS_SWAP((s)->directory_table_start, 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, d, 472, 32);\ -+} -+ -+#define SQUASHFS_SWAP_BASE_INODE_HEADER(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_IPC_INODE_HEADER(s, d) SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_ipc_inode_header)) -+ -+#define SQUASHFS_SWAP_DEV_INODE_HEADER(s, d) {\ -+ SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_dev_inode_header));\ -+ SQUASHFS_SWAP((s)->rdev, d, 32, 16);\ -+} -+ -+#define SQUASHFS_SWAP_SYMLINK_INODE_HEADER(s, d) {\ -+ SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_symlink_inode_header));\ -+ SQUASHFS_SWAP((s)->symlink_size, d, 32, 16);\ -+} -+ -+#define SQUASHFS_SWAP_REG_INODE_HEADER(s, d) {\ -+ SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_reg_inode_header));\ -+ 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, SQUASHFS_MAX_FILE_SIZE_LOG);\ -+} -+ -+#define SQUASHFS_SWAP_DIR_INODE_HEADER(s, d) {\ -+ SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_dir_inode_header));\ -+ 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(s, d) {\ -+ SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_ldir_inode_header));\ -+ 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(s, d) {\ -+ SQUASHFS_MEMSET(s, d, sizeof(squashfs_dir_index));\ -+ 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(s, d) {\ -+ SQUASHFS_MEMSET(s, d, sizeof(squashfs_dir_header));\ -+ SQUASHFS_SWAP((s)->count, d, 0, 8);\ -+ SQUASHFS_SWAP((s)->start_block, d, 8, 24);\ -+} -+ -+#define SQUASHFS_SWAP_DIR_ENTRY(s, d) {\ -+ SQUASHFS_MEMSET(s, d, sizeof(squashfs_dir_entry));\ -+ 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(s, d) {\ -+ SQUASHFS_MEMSET(s, d, sizeof(squashfs_fragment_entry));\ -+ SQUASHFS_SWAP((s)->start_block, d, 0, 32);\ -+ SQUASHFS_SWAP((s)->size, d, 32, 32);\ -+} -+ -+#define SQUASHFS_SWAP_SHORTS(s, d, n) {\ -+ int entry;\ -+ int bit_position;\ -+ 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_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_DATA(s, d, n, bits) {\ -+ int entry;\ -+ int bit_position;\ -+ 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_INTS(s, d, n) -+ -+#ifdef SQUASHFS_1_0_COMPATIBILITY -+typedef struct { -+ 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)) squashfs_base_inode_header_1; -+ -+typedef struct { -+ 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)) squashfs_ipc_inode_header_1; -+ -+typedef struct { -+ 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)) squashfs_dev_inode_header_1; -+ -+typedef struct { -+ 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)) squashfs_symlink_inode_header_1; -+ -+typedef struct { -+ 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; -+ squashfs_block start_block; -+ unsigned int file_size:SQUASHFS_MAX_FILE_SIZE_LOG; -+ unsigned short block_list[0]; -+} __attribute__ ((packed)) squashfs_reg_inode_header_1; -+ -+typedef struct { -+ 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)) squashfs_dir_inode_header_1; -+ -+#define SQUASHFS_SWAP_BASE_INODE_HEADER_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_IPC_INODE_HEADER_1(s, d) {\ -+ SQUASHFS_SWAP_BASE_INODE_HEADER_1(s, d, sizeof(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_BASE_INODE_HEADER_1(s, d, sizeof(squashfs_dev_inode_header_1));\ -+ SQUASHFS_SWAP((s)->rdev, d, 24, 16);\ -+} -+ -+#define SQUASHFS_SWAP_SYMLINK_INODE_HEADER_1(s, d) {\ -+ SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_symlink_inode_header_1));\ -+ SQUASHFS_SWAP((s)->symlink_size, d, 24, 16);\ -+} -+ -+#define SQUASHFS_SWAP_REG_INODE_HEADER_1(s, d) {\ -+ SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(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, SQUASHFS_MAX_FILE_SIZE_LOG);\ -+} -+ -+#define SQUASHFS_SWAP_DIR_INODE_HEADER_1(s, d) {\ -+ SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(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 __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) {\ -+ 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;\ -+ 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 -diff --new-file -ur linux-2.4.28/include/linux/squashfs_fs_i.h linux-2.4.28-squashfs2.1-r2/include/linux/squashfs_fs_i.h ---- linux-2.4.28/include/linux/squashfs_fs_i.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.28-squashfs2.1-r2/include/linux/squashfs_fs_i.h 2004-12-15 10:13:06.000000000 +0000 -@@ -0,0 +1,42 @@ -+#ifndef SQUASHFS_FS_I -+#define SQUASHFS_FS_I -+/* -+ * Squashfs -+ * -+ * Copyright (c) 2002, 2003, 2004 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 -+ */ -+ -+typedef struct squashfs_inode_info { -+ unsigned int start_block; -+ unsigned int block_list_start; -+ unsigned int offset; -+ union { -+ struct { -+ unsigned int fragment_start_block; -+ unsigned int fragment_size; -+ unsigned int fragment_offset; -+ } s1; -+ struct { -+ unsigned int directory_index_start; -+ unsigned int directory_index_offset; -+ unsigned int directory_index_count; -+ } s2; -+ } u; -+ } squashfs_inode_info; -+#endif -diff --new-file -ur linux-2.4.28/include/linux/squashfs_fs_sb.h linux-2.4.28-squashfs2.1-r2/include/linux/squashfs_fs_sb.h ---- linux-2.4.28/include/linux/squashfs_fs_sb.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.28-squashfs2.1-r2/include/linux/squashfs_fs_sb.h 2004-12-02 02:52:36.000000000 +0000 -@@ -0,0 +1,65 @@ -+#ifndef SQUASHFS_FS_SB -+#define SQUASHFS_FS_SB -+/* -+ * Squashfs -+ * -+ * Copyright (c) 2002, 2003, 2004 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 -+ -+typedef struct { -+ unsigned int block; -+ int length; -+ unsigned int next_index; -+ char *data; -+ } squashfs_cache; -+ -+struct squashfs_fragment_cache { -+ unsigned int block; -+ int length; -+ unsigned int locked; -+ char *data; -+ }; -+ -+typedef struct squashfs_sb_info { -+ squashfs_super_block sBlk; -+ int devblksize; -+ int devblksize_log2; -+ int swap; -+ squashfs_cache *block_cache; -+ struct squashfs_fragment_cache *fragment; -+ int next_cache; -+ int next_fragment; -+ squashfs_uid *uid; -+ squashfs_uid *guid; -+ squashfs_fragment_index *fragment_index; -+ unsigned int read_size; -+ char *read_data; -+ char *read_page; -+ struct semaphore read_page_mutex; -+ struct semaphore block_cache_mutex; -+ struct semaphore fragment_mutex; -+ wait_queue_head_t waitq; -+ wait_queue_head_t fragment_wait_queue; -+ struct inode *(*iget)(struct super_block *s, squashfs_inode inode); -+ unsigned int (*read_blocklist)(struct inode *inode, int index, int readahead_blks, -+ char *block_list, unsigned short **block_p, unsigned int *bsize); -+ } squashfs_sb_info; -+#endif -diff --new-file -ur linux-2.4.28/init/do_mounts.c linux-2.4.28-squashfs2.1-r2/init/do_mounts.c ---- linux-2.4.28/init/do_mounts.c 2003-11-28 18:26:21.000000000 +0000 -+++ linux-2.4.28-squashfs2.1-r2/init/do_mounts.c 2004-12-02 02:14:06.000000000 +0000 -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - #include - - #define BUILD_CRAMDISK -@@ -476,6 +477,7 @@ - * minix - * ext2 - * romfs -+ * squashfs - * cramfs - * gzip - */ -@@ -486,6 +488,7 @@ - struct minix_super_block *minixsb; - struct ext2_super_block *ext2sb; - struct romfs_super_block *romfsb; -+ struct squashfs_super_block *squashfsb; - struct cramfs_super *cramfsb; - int nblocks = -1; - unsigned char *buf; -@@ -497,6 +500,7 @@ - minixsb = (struct minix_super_block *) buf; - ext2sb = (struct ext2_super_block *) buf; - romfsb = (struct romfs_super_block *) buf; -+ squashfsb = (struct squashfs_super_block *) buf; - cramfsb = (struct cramfs_super *) buf; - memset(buf, 0xe5, size); - -@@ -535,6 +539,15 @@ - 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 --new-file -ur linux-2.4.28/lib/Config.in linux-2.4.28-squashfs2.1-r2/lib/Config.in ---- linux-2.4.28/lib/Config.in 2003-11-28 18:26:21.000000000 +0000 -+++ linux-2.4.28-squashfs2.1-r2/lib/Config.in 2004-12-02 02:14:06.000000000 +0000 -@@ -10,6 +10,7 @@ - # Do we need the compression support? - # - if [ "$CONFIG_CRAMFS" = "y" -o \ -+ "$CONFIG_SQUASHFS" = "y" -o \ - "$CONFIG_PPP_DEFLATE" = "y" -o \ - "$CONFIG_CRYPTO_DEFLATE" = "y" -o \ - "$CONFIG_JFFS2_FS" = "y" -o \ -@@ -17,6 +18,7 @@ - define_tristate CONFIG_ZLIB_INFLATE y - else - if [ "$CONFIG_CRAMFS" = "m" -o \ -+ "$CONFIG_SQUASHFS" = "m" -o \ - "$CONFIG_PPP_DEFLATE" = "m" -o \ - "$CONFIG_CRYPTO_DEFLATE" = "m" -o \ - "$CONFIG_JFFS2_FS" = "m" -o \ diff --git a/openwrt/package/linux/kernel-patches/301-jffs-compression b/openwrt/package/linux/kernel-patches/301-jffs-compression deleted file mode 100644 index 12491d471c..0000000000 --- a/openwrt/package/linux/kernel-patches/301-jffs-compression +++ /dev/null @@ -1,9119 +0,0 @@ -diff -Nur linux-mips-cvs/Documentation/Configure.help linux-mips/Documentation/Configure.help ---- linux-mips-cvs/Documentation/Configure.help 2005-01-20 03:19:21.000000000 +0100 -+++ linux-mips/Documentation/Configure.help 2005-02-07 05:08:35.000000000 +0100 -@@ -17528,6 +17528,32 @@ - If reporting bugs, please try to have available a full dump of the - messages at debug level 1 while the misbehaviour was occurring. - -+ARMLIB compression support for BBC (EXPERIMENTAL) -+CONFIG_JFFS2_BBC_ARMLIB -+ This enables ARMLIB support for BBC. -+ -+LZO1X-* compression support for BBC (EXPERIMENTAL) -+CONFIG_JFFS2_BBC_LZO -+ This enables LZO1X-1 and LZO1X-999 support for BBC. (fast & good -+ compressor, beats ZLIB in everything) -+ -+LZARI compression support for BBC (EXPERIMENTAL) -+CONFIG_JFFS2_BBC_LZARI -+ This enables LempelZiv-Storer-Szymanski compression for BBC with -+ additional arithmetic coding (damn slow, but best compresor). -+ -+LZHD compression support for BBC (EXPERIMENTAL) -+CONFIG_JFFS2_BBC_LZHD -+ This enables LempelZiv-Storer-Szymanski compression for BBC with -+ additional dynamic Huffman coding (a little faster than LZARI, and -+ it's compression ratio is a little worse than LZARI's) -+ -+LZSS compression support for BBC (EXPERIMENTAL) -+CONFIG_JFFS2_BBC_LZSS -+ This enables simple LempelZiv-Storer-Szymanski compression for BBC -+ (faster than LZHD, and, and has a not-so-good compression ratio, -+ was included just for testing) -+ - JFFS stats available in /proc filesystem - CONFIG_JFFS_PROC_FS - Enabling this option will cause statistics from mounted JFFS file systems -diff -Nur linux-mips-cvs/fs/Config.in linux-mips/fs/Config.in ---- linux-mips-cvs/fs/Config.in 2004-11-19 01:28:47.000000000 +0100 -+++ linux-mips/fs/Config.in 2005-02-07 05:08:34.000000000 +0100 -@@ -50,6 +50,12 @@ - if [ "$CONFIG_JFFS2_FS" = "y" -o "$CONFIG_JFFS2_FS" = "m" ] ; then - int 'JFFS2 debugging verbosity (0 = quiet, 2 = noisy)' CONFIG_JFFS2_FS_DEBUG 0 - fi -+dep_mbool ' ARMLIB compression support for BBC (EXPERIMENTAL)' CONFIG_JFFS2_BBC_ARMLIB $CONFIG_JFFS2_FS -+dep_mbool ' LZO1X-* compression support for BBC (EXPERIMENTAL)' CONFIG_JFFS2_BBC_LZO $CONFIG_JFFS2_FS -+dep_mbool ' LZARI compression support for BBC (EXPERIMENTAL)' CONFIG_JFFS2_BBC_LZARI $CONFIG_JFFS2_FS -+dep_mbool ' LZHD compression support for BBC (EXPERIMENTAL)' CONFIG_JFFS2_BBC_LZHD $CONFIG_JFFS2_FS -+dep_mbool ' LZSS compression support for BBC (EXPERIMENTAL)' CONFIG_JFFS2_BBC_LZSS $CONFIG_JFFS2_FS -+ - tristate 'Compressed ROM file system support' CONFIG_CRAMFS - bool 'Virtual memory file system support (former shm fs)' CONFIG_TMPFS - define_bool CONFIG_RAMFS y -diff -Nur linux-mips-cvs/fs/jffs2/Config.in.bbc.inc linux-mips/fs/jffs2/Config.in.bbc.inc ---- linux-mips-cvs/fs/jffs2/Config.in.bbc.inc 1970-01-01 01:00:00.000000000 +0100 -+++ linux-mips/fs/jffs2/Config.in.bbc.inc 2005-02-07 05:08:34.000000000 +0100 -@@ -0,0 +1,5 @@ -+dep_mbool ' ARMLIB compression support for BBC (EXPERIMENTAL)' CONFIG_JFFS2_BBC_ARMLIB $CONFIG_JFFS2_FS -+dep_mbool ' LZO1X-* compression support for BBC (EXPERIMENTAL)' CONFIG_JFFS2_BBC_LZO $CONFIG_JFFS2_FS -+dep_mbool ' LZARI compression support for BBC (EXPERIMENTAL)' CONFIG_JFFS2_BBC_LZARI $CONFIG_JFFS2_FS -+dep_mbool ' LZHD compression support for BBC (EXPERIMENTAL)' CONFIG_JFFS2_BBC_LZHD $CONFIG_JFFS2_FS -+dep_mbool ' LZSS compression support for BBC (EXPERIMENTAL)' CONFIG_JFFS2_BBC_LZSS $CONFIG_JFFS2_FS -diff -Nur linux-mips-cvs/fs/jffs2/Configure.help.bbc.inc linux-mips/fs/jffs2/Configure.help.bbc.inc ---- linux-mips-cvs/fs/jffs2/Configure.help.bbc.inc 1970-01-01 01:00:00.000000000 +0100 -+++ linux-mips/fs/jffs2/Configure.help.bbc.inc 2005-02-07 05:08:34.000000000 +0100 -@@ -0,0 +1,25 @@ -+ARMLIB compression support for BBC (EXPERIMENTAL) -+CONFIG_JFFS2_BBC_ARMLIB -+ This enables ARMLIB support for BBC. -+ -+LZO1X-* compression support for BBC (EXPERIMENTAL) -+CONFIG_JFFS2_BBC_LZO -+ This enables LZO1X-1 and LZO1X-999 support for BBC. (fast & good -+ compressor, beats ZLIB in everything) -+ -+LZARI compression support for BBC (EXPERIMENTAL) -+CONFIG_JFFS2_BBC_LZARI -+ This enables LempelZiv-Storer-Szymanski compression for BBC with -+ additional arithmetic coding (damn slow, but best compresor). -+ -+LZHD compression support for BBC (EXPERIMENTAL) -+CONFIG_JFFS2_BBC_LZHD -+ This enables LempelZiv-Storer-Szymanski compression for BBC with -+ additional dynamic Huffman coding (a little faster than LZARI, and -+ it's compression ratio is a little worse than LZARI's) -+ -+LZSS compression support for BBC (EXPERIMENTAL) -+CONFIG_JFFS2_BBC_LZSS -+ This enables simple LempelZiv-Storer-Szymanski compression for BBC -+ (faster than LZHD, and, and has a not-so-good compression ratio, -+ was included just for testing) -diff -Nur linux-mips-cvs/fs/jffs2/Kconfig.bbc.inc linux-mips/fs/jffs2/Kconfig.bbc.inc ---- linux-mips-cvs/fs/jffs2/Kconfig.bbc.inc 1970-01-01 01:00:00.000000000 +0100 -+++ linux-mips/fs/jffs2/Kconfig.bbc.inc 2005-02-07 05:08:34.000000000 +0100 -@@ -0,0 +1,40 @@ -+config JFFS2_BBC_ARMLIB -+ bool "ARMLIB compression support for BBC (EXPERIMENTAL)" -+ depends on JFFS2_FS && EXPERIMENTAL -+ default y -+ help -+ This enables ARMLIB support for BBC. -+ -+config JFFS2_BBC_LZO -+ bool "LZO1X-* compression support for BBC (EXPERIMENTAL)" -+ depends on JFFS2_FS && EXPERIMENTAL -+ default y -+ help -+ This enables LZO1X-1 and LZO1X-999 support for BBC. (fast & good -+ compressor) -+ -+config JFFS2_BBC_LZARI -+ bool "LZARI compression support for BBC (EXPERIMENTAL)" -+ depends on JFFS2_FS && EXPERIMENTAL -+ default y -+ help -+ This enables LempelZiv-Storer-Szymanski compression for BBC with -+ additional arithmetic coding (damn slow, but best compresor). -+ -+config JFFS2_BBC_LZHD -+ bool "LZHD compression support for BBC (EXPERIMENTAL)" -+ depends on JFFS2_FS && EXPERIMENTAL -+ default y -+ help -+ This enables LempelZiv-Storer-Szymanski compression for BBC with -+ additional dynamic Huffman coding (a little faster than LZARI, and -+ it's compression ratio is a little worse than LZARI's) -+ -+config JFFS2_BBC_LZSS -+ bool "LZSS compression support for BBC (EXPERIMENTAL)" -+ depends on JFFS2_FS && EXPERIMENTAL -+ default y -+ help -+ This enables simple LempelZiv-Storer-Szymanski compression for BBC -+ (faster than LZHD, and, and has a not-so-good compression ratio, -+ was included just for testing) -diff -Nur linux-mips-cvs/fs/jffs2/Makefile linux-mips/fs/jffs2/Makefile ---- linux-mips-cvs/fs/jffs2/Makefile 2003-08-13 19:19:25.000000000 +0200 -+++ linux-mips/fs/jffs2/Makefile 2005-02-07 05:08:34.000000000 +0100 -@@ -10,9 +10,23 @@ - # Note 2! The CFLAGS definitions are now in the main makefile... - - -+JFFS2_BBC_KERNEL_OBJS-y = jffs2_bbc_framework.o jffs2_bbc_fs.o -+ -+JFFS2_BBC_KERNEL_OBJS-$(CONFIG_JFFS2_BBC_ARMLIB) += jffs2_bbc_armlib_comp.o -+JFFS2_BBC_KERNEL_OBJS-$(CONFIG_JFFS2_BBC_LZO) += jffs2_bbc_lzo_comp.o -+JFFS2_BBC_KERNEL_OBJS-$(CONFIG_JFFS2_BBC_LZSS) += jffs2_bbc_lzss_comp.o -+JFFS2_BBC_KERNEL_OBJS-$(CONFIG_JFFS2_BBC_LZARI) += jffs2_bbc_lzari_comp.o -+JFFS2_BBC_KERNEL_OBJS-$(CONFIG_JFFS2_BBC_LZHD) += jffs2_bbc_lzhd_comp.o -+ -+JFFS2_BBC_KERNEL_OBJS := $(JFFS2_BBC_KERNEL_OBJS-y) -+ -+JFFS2_BBC_MKFS_OBJS = jffs2_bbc_mkfs.o jffs2_bbc_framework.o jffs2_bbc_armlib_comp.o jffs2_bbc_lzo_comp.o\ -+ jffs2_bbc_lzss_comp.o jffs2_bbc_lzari_comp.o jffs2_bbc_lzhd_comp.o -+ - COMPR_OBJS := compr.o compr_rubin.o compr_rtime.o pushpull.o \ - compr_zlib.o - JFFS2_OBJS := dir.o file.o ioctl.o nodelist.o malloc.o \ -+ $(JFFS2_BBC_KERNEL_OBJS) \ - read.o nodemgmt.o readinode.o super.o write.o scan.o gc.o \ - symlink.o build.o erase.o background.o - -diff -Nur linux-mips-cvs/fs/jffs2/Makefile.bbc.inc linux-mips/fs/jffs2/Makefile.bbc.inc ---- linux-mips-cvs/fs/jffs2/Makefile.bbc.inc 1970-01-01 01:00:00.000000000 +0100 -+++ linux-mips/fs/jffs2/Makefile.bbc.inc 2005-02-07 05:08:34.000000000 +0100 -@@ -0,0 +1,12 @@ -+JFFS2_BBC_KERNEL_OBJS-y = jffs2_bbc_framework.o jffs2_bbc_fs.o -+ -+JFFS2_BBC_KERNEL_OBJS-$(CONFIG_JFFS2_BBC_ARMLIB) += jffs2_bbc_armlib_comp.o -+JFFS2_BBC_KERNEL_OBJS-$(CONFIG_JFFS2_BBC_LZO) += jffs2_bbc_lzo_comp.o -+JFFS2_BBC_KERNEL_OBJS-$(CONFIG_JFFS2_BBC_LZSS) += jffs2_bbc_lzss_comp.o -+JFFS2_BBC_KERNEL_OBJS-$(CONFIG_JFFS2_BBC_LZARI) += jffs2_bbc_lzari_comp.o -+JFFS2_BBC_KERNEL_OBJS-$(CONFIG_JFFS2_BBC_LZHD) += jffs2_bbc_lzhd_comp.o -+ -+JFFS2_BBC_KERNEL_OBJS := $(JFFS2_BBC_KERNEL_OBJS-y) -+ -+JFFS2_BBC_MKFS_OBJS = jffs2_bbc_mkfs.o jffs2_bbc_framework.o jffs2_bbc_armlib_comp.o jffs2_bbc_lzo_comp.o\ -+ jffs2_bbc_lzss_comp.o jffs2_bbc_lzari_comp.o jffs2_bbc_lzhd_comp.o -diff -Nur linux-mips-cvs/fs/jffs2/compr_zlib.c linux-mips/fs/jffs2/compr_zlib.c ---- linux-mips-cvs/fs/jffs2/compr_zlib.c 2003-01-11 18:53:17.000000000 +0100 -+++ linux-mips/fs/jffs2/compr_zlib.c 2005-02-07 05:08:35.000000000 +0100 -@@ -85,7 +85,7 @@ - vfree(inflate_workspace); - } - --int zlib_compress(unsigned char *data_in, unsigned char *cpage_out, -+int jffs2_zlib_compress2(unsigned char *data_in, unsigned char *cpage_out, - __u32 *sourcelen, __u32 *dstlen) - { - z_stream strm; -@@ -145,7 +145,7 @@ - return 0; - } - --void zlib_decompress(unsigned char *data_in, unsigned char *cpage_out, -+void jffs2_zlib_decompress2(unsigned char *data_in, unsigned char *cpage_out, - __u32 srclen, __u32 destlen) - { - z_stream strm; -@@ -175,3 +175,19 @@ - zlib_inflateEnd(&strm); - up(&inflate_sem); - } -+ -+extern int jffs2_zlib_compress(unsigned char *data_in, unsigned char *cpage_out, __u32 * sourcelen, __u32 * dstlen); -+extern void jffs2_zlib_decompress(unsigned char *data_in, unsigned char *cpage_out, __u32 srclen, __u32 destlen); -+ -+int zlib_compress(unsigned char *data_in, unsigned char *cpage_out, -+ __u32 *sourcelen, __u32 *dstlen) -+{ -+ return jffs2_zlib_compress(data_in,cpage_out,sourcelen,dstlen); -+} -+ -+void zlib_decompress(unsigned char *data_in, unsigned char *cpage_out, -+ __u32 srclen, __u32 destlen) -+{ -+ jffs2_zlib_decompress(data_in,cpage_out,srclen,destlen); -+} -+ -diff -Nur linux-mips-cvs/fs/jffs2/file.c linux-mips/fs/jffs2/file.c ---- linux-mips-cvs/fs/jffs2/file.c 2003-11-17 02:07:44.000000000 +0100 -+++ linux-mips/fs/jffs2/file.c 2005-02-07 05:08:35.000000000 +0100 -@@ -35,6 +35,7 @@ - * - */ - -+#include "jffs2_bbc_framework.h" /**BBC**/ - #include - #include /* for min() */ - #include -@@ -459,6 +460,7 @@ - - comprbuf = kmalloc(cdatalen, GFP_KERNEL); - if (comprbuf) { -+ jffs2_bbc_model_set_act_sb(c); /**BBC**/ - comprtype = jffs2_compress(page_address(pg)+ (file_ofs & (PAGE_CACHE_SIZE-1)), comprbuf, &datalen, &cdatalen); - } - if (comprtype == JFFS2_COMPR_NONE) { -diff -Nur linux-mips-cvs/fs/jffs2/gc.c linux-mips/fs/jffs2/gc.c ---- linux-mips-cvs/fs/jffs2/gc.c 2003-11-17 02:07:44.000000000 +0100 -+++ linux-mips/fs/jffs2/gc.c 2005-02-07 05:08:35.000000000 +0100 -@@ -35,6 +35,7 @@ - * - */ - -+#include "jffs2_bbc_framework.h" /**BBC**/ - #include - #include - #include -@@ -651,6 +652,7 @@ - writebuf = pg_ptr + (offset & (PAGE_CACHE_SIZE -1)); - - if (comprbuf) { -+ jffs2_bbc_model_set_act_sb(c); /**BBC**/ - comprtype = jffs2_compress(writebuf, comprbuf, &datalen, &cdatalen); - } - if (comprtype) { -diff -Nur linux-mips-cvs/fs/jffs2/hpatch linux-mips/fs/jffs2/hpatch ---- linux-mips-cvs/fs/jffs2/hpatch 1970-01-01 01:00:00.000000000 +0100 -+++ linux-mips/fs/jffs2/hpatch 2005-02-07 05:08:34.000000000 +0100 -@@ -0,0 +1,191 @@ -+#!/usr/bin/perl -+# A patch-like utility -+# Designed for patching different version of jffs2 with the same hpatch file -+# -+# Copyright (C) 2004, Ferenc Havasi -+# -+# 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. -+ -+$filename_tmp1="file1.tmp"; -+$filename_tmp2="file2.tmp"; -+ -+$filename_in=""; -+$filename_out=$filename_tmp1; -+$filename_cnt=0; -+ -+# Modes: -+# 0: expecting = -+# 1: normal_cmd -+# 2: skip until = -+# 3: expecting F (first state) -+$mode=3; -+ -+%rules = (); -+ -+sub file_end { -+ if (($mode!=2)&&($modified==1)) { -+ while () { -+ print DST $_; -+ } -+ close(SRC); -+ close(DST); -+ if ($cmd_name ne "") { $rules{"$cmd_name"}=1; } -+ $filename_result=$filename_out; -+ if ($filename_result ne $filename_in_save) { -+ open(RES,"<$filename_result") or die "Cannot open $filename_result.\n"; -+ open(DST,">$filename_in_save") or die "Cannot open $filename_in_save.\n"; -+ while () { -+ print DST $_; -+ } -+ close(DST); -+ close(RES); -+ } -+ unlink($filename_tmp1) && unlink($filename_tmp2); -+ } -+ else { -+ close(SRC); -+ close(DST); -+ $filename_result=$filename_in; -+ if ($filename_result ne $filename_in_save) { -+ open(RES,"<$filename_result") or die "Cannot open $filename_result.\n"; -+ open(DST,">$filename_in_save") or die "Cannot open $filename_in_save.\n"; -+ while () { -+ print DST $_; -+ } -+ close(DST); -+ close(RES); -+ } -+ unlink($filename_tmp1); -+ } -+ $modified=0; -+ foreach $rulename (keys %rules) { -+ if ($rules{"$rulename"}==0) { print(STDERR "On $filename_in_save error applying rule $rulename.\n"); } -+ } -+ %rules = (); -+} -+ -+if ($#ARGV<0) { -+ print ("usage: hpatch hpatch_file\n"); -+ exit; -+} -+ -+open(CMD,"<$ARGV[0]") or die "Cannot open $ARGV[0].\n"; -+$cmd_linenum=0; -+ -+while (chomp($cmd_line=)) { -+ $cmd_linenum++; -+ if ($cmd_line eq "") {next;} -+ #$cmd_line =~ s/\#.*//; -+ $cmd_line =~ s/\ *$//; -+ if ($cmd_line eq "") {next;} -+ if ($cmd_line =~ /^F(.*)/) { -+ $tmp_filename_in=$1; -+ if ($mode!=3) { -+ file_end(); -+ } -+ $filename_in=$tmp_filename_in; -+ $filename_in_save=$filename_in; -+ open(SRC,"<$filename_in") or die "Cannot open $filename_in.\n"; -+ open(DST,">$filename_out") or die "Cannot open $filename_out.\n";; -+ $modified=0; -+ $mode=0; -+ next; -+ } -+ if ($mode==3) {die "error: F expression expected in line $cmd_linenum\n";} -+ if ($cmd_line =~ /^=(.*)/) { -+ $tmp_cmd_name=$1; -+ if (($mode!=2)&&($modified==1)) { -+ while () { -+ print DST $_; -+ } -+ close(SRC); -+ close(DST); -+ if (($cmd_name ne "")) {$rules{"$cmd_name"}=1;}; -+ $filename_cnt++; -+ if ($filename_cnt%2==1) { -+ $filename_in=$filename_tmp1; -+ $filename_out=$filename_tmp2; -+ } -+ else { -+ $filename_in=$filename_tmp2; -+ $filename_out=$filename_tmp1; -+ } -+ } -+ else { -+ close(SRC); -+ close(DST); -+ } -+ $mode=1; -+ $cmd_name=$tmp_cmd_name; -+ if (($cmd_name ne "")) { -+ if ($rules{"$cmd_name"}==1) { -+ $mode=2; -+ } -+ else { -+ $rules{"$cmd_name"}=0; -+ } -+ } -+ open(SRC,"<$filename_in") or die "Cannot open $filename_in.\n"; -+ open(DST,">$filename_out") or die "Cannot open $filename_out.\n"; -+ $modified=0; -+ next; -+ } -+ if ($mode == 0) {die "error: = expression expected in line $cmd_linenum\n";} -+ if ($mode == 2) {next;} -+ if ($cmd_line =~ /^!(.*)/) { -+ print "$1\n"; -+ $modified=1; -+ next; -+ } -+ if ($cmd_line =~ /^\?(.*)/) { -+ $search_str=$1; -+ $found=0; -+ while () { -+ print DST $_; -+ if (index($_,$search_str)>=0) {$found=1; last;} -+ } -+ if ($found==0) { $mode=2; } -+ next; -+ } -+ if ($cmd_line =~ /^\+(.*)/) { -+ print DST "$1\n"; -+ $modified=1; -+ next; -+ } -+ if ($cmd_line =~ /^\-(.*)/) { -+ $search_str=$1; -+ $found=0; -+ while () { -+ if (index($_,$search_str)>=0) {$saved_line=$_; $found=1; $modified=1; last;} -+ print DST $_; -+ } -+ if ($found==0) { $mode=2; } -+ next; -+ } -+ if ($cmd_line =~ /^i(.*)/) { -+ $filename_inc=$1; -+ open(INCSRC,"<$filename_inc") or die "Cannot open $filename_inc.\n"; -+ while () { -+ print DST $_; -+ } -+ next; -+ } -+ if ($cmd_line =~ /^I/) { -+ print DST $saved_line; -+ next; -+ } -+} -+file_end(); -+close(CMD); -diff -Nur linux-mips-cvs/fs/jffs2/jffs2_bbc_armlib_comp.c linux-mips/fs/jffs2/jffs2_bbc_armlib_comp.c ---- linux-mips-cvs/fs/jffs2/jffs2_bbc_armlib_comp.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-mips/fs/jffs2/jffs2_bbc_armlib_comp.c 2005-02-07 05:08:34.000000000 +0100 -@@ -0,0 +1,2224 @@ -+/* -+ * JFFS2-BBC: armlib compressor plugin -+ * -+ * $Id$ -+ * -+ * Copyright (C) 2004, Ferenc Havasi & Tamas Gergely -+ * -+ * 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 "jffs2_bbc_framework.h" -+ -+#ifdef __KERNEL__ -+#include -+#else -+#include -+#endif -+ -+//ORIGIN: include/DataStructures/TypeDefs.h -+ -+/******************************************************************************* -+* FILE: TypeDefs.h -+* AUTHOR: Tamás Gergely -+* MODIFIED: $Id$ -+*******************************************************************************/ -+ -+#ifndef TYPEDEFS_H -+#define TYPEDEFS_H -+ -+#pragma pack(4) -+ -+#ifndef bool -+#define bool char -+#define true 1 -+#define false 0 -+#endif -+ -+#ifndef u8 -+#define u8 unsigned char -+#endif -+#ifndef u16 -+#define u16 unsigned short -+#endif -+#ifndef u32 -+#define u32 unsigned long -+#endif -+#ifndef s8 -+#define s8 signed char -+#endif -+#ifndef s16 -+#define s16 signed short -+#endif -+#ifndef s32 -+#define s32 signed long -+#endif -+ -+typedef struct -+{ -+ u32 capacity; -+ u32 size; -+ u32 alloc_size; -+ void *ptr; -+} vector; -+ -+#define VECTOR_P_END(vct) ((void*)(((char*)((vct)->ptr)) + (vct)->size)) -+#define VECTOR_S_END(vct) ((void*)(((char*)((vct).ptr)) + (vct).size)) -+ -+static void vector_clear(vector *); -+#ifdef JFFS2_BBC_ARMLIB_MODELGEN -+static void vector_reset(vector *); -+static void vector_clr_ptr(vector *); -+static void vector_add_u8(vector *, u8); -+static void vector_add_u16(vector *, u16); -+static void vector_add_u32(vector *, u32); -+static void vector_add_s8(vector *, s8); -+static void vector_add_s16(vector *, s16); -+static void vector_add_s32(vector *, s32); -+static void vector_add_ptr(vector *, void *); -+static void vector_concat(vector *, vector *); -+#endif -+ -+#endif -+ -+//ORIGIN: include/DataStructures/DataTypes.h -+ -+/******************************************************************************* -+* FILE: DataTypes.h -+* AUTHOR: Tamás Gergely -+* MODIFIED: $Id$ -+*******************************************************************************/ -+ -+#ifndef DATATYPES_H -+#define DATATYPES_H -+ -+//#include "DataStructures/TypeDefs.h" -+ -+typedef u16 THUMB_DataType; -+typedef u32 ARM_DataType; -+typedef u8 TokenType; -+typedef u8 PredictorType; -+typedef u8 *ProbDist; -+ -+typedef vector RawData; -+typedef vector RawBlocks; -+typedef vector TokenStream; -+typedef vector TokenBlocks; -+typedef vector LatType; -+ -+#define THUMB_DATA_LENGTH 16 -+#define ARM_DATA_LENGTH 32 -+#define TOKEN_LENGTH 8 -+#define TOKEN_MAXVALUE 0xff -+#define PREDICTOR_LENGTH 8 -+#define PREDICTOR_MAXVALUE 0xff -+ -+#endif -+ -+//ORIGIN: include/DataStructures/BitVector.h -+ -+/******************************************************************************* -+* FILE: BitVector.h -+* AUTHOR: Tamás Gergely -+* MODIFIED: $Id$ -+*******************************************************************************/ -+ -+#ifndef BITVECTOR_H -+#define BITVECTOR_H -+ -+//#include "DataStructures/TypeDefs.h" -+ -+typedef vector BitBlocks; -+ -+#pragma pack(4) -+ -+typedef struct -+{ -+ u32 freebits; -+ u32 capacity; -+ u32 size; -+ u8 *base; -+ u8 *ptr; -+} BitVector; -+ -+#ifdef JFFS2_BBC_ARMLIB_MODELGEN -+static void bitblocks_clear(BitBlocks *); -+static void bitvector_clear(BitVector *); -+static void bitvector_W_reset(BitVector *); -+static void bitvector_W_add0(BitVector *); -+static void bitvector_W_add1(BitVector *); -+static void bitvector_W_concat_b(BitVector *, BitVector *); -+static void bitvector_W_concat_v(BitVector *, vector *); -+static void bitvector_W_flush(BitVector *); -+static void bitvector_R_reset(BitVector *); -+static u8 bitvector_R_get1(BitVector *); -+static u8 bitvector_R_get8(BitVector *); -+#endif -+ -+#define BITVECTOR_P_END(bv) ((void*)(((bv)->base)+((bv)->size))) -+#define BITVECTOR_S_END(bv) ((void*)( ((bv).base)+ ((bv).size))) -+#define BITVECTOR_SKIP(bv,num) ((bv)->ptr) += (num) -+ -+#endif -+ -+//ORIGIN: include/DataStructures/DecisionTree.h -+ -+/******************************************************************************* -+* FILE: DecisionTree.h -+* AUTHOR: Tamás Gergely -+* MODIFIED: $Id$ -+*******************************************************************************/ -+ -+#ifndef DECISIONTREE_H -+#define DECISIONTREE_H -+ -+//#include "DataStructures/DataTypes.h" -+ -+#pragma pack(4) -+ -+#define TREENODETYPE_NULLNODE 0 -+#define TREENODETYPE_NODE_BINARY_EQ 1 -+#define TREENODETYPE_LEAF_P 2 -+#define TREENODETYPE_LEAF_C 3 -+#define TREENODETYPE_NODE_BINARY_LT 5 -+#define TREENODETYPE_IS_NODE(n) (((n) == TREENODETYPE_NODE_BINARY_EQ) || \ -+ ((n) == TREENODETYPE_NODE_BINARY_LT)) -+#define TREENODETYPE_IS_NODE_BINARY(n) (((n) == TREENODETYPE_NODE_BINARY_EQ) || \ -+ ((n) == TREENODETYPE_NODE_BINARY_LT)) -+ -+#define TREENODETYPE_IS_LEAF(n) (((n) == TREENODETYPE_LEAF_P) || \ -+ ((n) == TREENODETYPE_LEAF_C)) -+ -+ -+#define TREE_SUBTREE_RELATION_LEFT_EQ != -+#define TREE_SUBTREE_RELATION_RIGHT_EQ == -+#define TREE_SUBTREE_RELATION_LEFT_LT < -+#define TREE_SUBTREE_RELATION_RIGHT_LT >= -+ -+#define GET_NODE_PTR_TYPE(n) (((TreeNodeDummy*)(n))->type) -+ -+typedef struct -+{ -+ u8 type; -+} TreeNodeDummy; -+ -+typedef struct -+{ -+ u8 type; // [TREENODETYPE_NODE_BINARY] -+ u8 attribute; -+ PredictorType value; -+ void *left; -+ void *right; -+} TreeNodeBinary; -+ -+typedef struct -+{ -+ u8 type; // [TREENODETYPE_LEAF_P] -+ u16 pairs; -+ PredictorType *probabilities; -+} TreeLeafP; -+ -+typedef struct -+{ -+ u8 type; // [TREENODETYPE_LEAF_C] -+ PredictorType predicted_class; -+} TreeLeafC; -+ -+typedef struct -+{ -+ u32 high; -+ u32 low; -+ u32 max; -+} ProbabilityType; -+ -+ -+typedef struct -+{ -+ void *root; -+ u16 number_of_classes; -+ u16 number_of_predictors; -+ PredictorType *predictor_max_values; -+} DecisionTree; -+ -+#ifdef JFFS2_BBC_ARMLIB_MODELGEN -+static void decisiontree_delete(DecisionTree *); -+static void decisiontree_get_probability_for_token(void *, PredictorType *, TokenType, ProbabilityType *); -+static TokenType decisiontree_get_token_for_range(void *, PredictorType *, u32, u32, ProbabilityType *); -+#endif -+ -+#endif -+ -+//ORIGIN: include/DataStructures/PredictorTable.h -+ -+/******************************************************************************* -+* FILE: PredictorTable.h -+* AUTHOR: Tamás Gergely -+* MODIFIED: $Id$ -+*******************************************************************************/ -+ -+#ifndef PREDICTORTABLE_H -+#define PREDICTORTABLE_H -+ -+//#include "DataStructures/TypeDefs.h" -+//#include "DataStructures/DataTypes.h" -+////#include "DataStructures/Filter.h" -+////#include "DataStructures/Converter.h" -+////#include "DataStructures/Manipulator.h" -+ -+#define NUMBER_OF_PREDICTORS_ARM 17 -+ -+#ifndef __KERNEL__ -+#define NUMBER_OF_PREDICTORS_TXT 2 -+#else -+#undef TXT_TOKENS -+#endif // __KERNEL__ -+ -+#ifdef TXT_TOKENS -+#define NUMBER_OF_PREDICTORS NUMBER_OF_PREDICTORS_TXT -+#define predictortable_reset predictortable_resetTXT -+#define predictortable_update predictortable_updateTXT -+#define predictortable_minvalue predictortable_minvalueTXT -+#define predictortable_maxvalue predictortable_maxvalueTXT -+#else -+#define NUMBER_OF_PREDICTORS NUMBER_OF_PREDICTORS_ARM -+#define predictortable_reset predictortable_resetARM -+#define predictortable_update predictortable_updateARM -+#define predictortable_minvalue predictortable_minvalueARM -+#define predictortable_maxvalue predictortable_maxvalueARM -+#endif -+ -+ -+#pragma pack(4) -+ -+typedef struct -+{ -+ PredictorType *predictors; -+} PredictorTable; -+ -+#ifdef JFFS2_BBC_ARMLIB_MODELGEN -+static void predictortable_clear(PredictorTable *); -+static void predictortable_free(PredictorTable *); -+static void predictortable_resetARM(PredictorTable *); -+static void predictortable_updateARM(PredictorTable *, TokenType); -+static PredictorType predictortable_minvalueARM(PredictorTable *, u32); -+static PredictorType predictortable_maxvalueARM(PredictorTable *, u32); -+#endif -+ -+#ifndef __KERNEL__ -+/* -+static void predictortable_resetTXT(PredictorTable *); -+static void predictortable_updateTXT(PredictorTable *, TokenType); -+static PredictorType predictortable_minvalueTXT(PredictorTable *, u32); -+static PredictorType predictortable_maxvalueTXT(PredictorTable *, u32); -+*/ -+#endif // __KERNEL__ -+ -+#endif -+ -+//ORIGIN: include/DataStructures/ipack_model.h -+ -+/******************************************************************************* -+* FILE: ipack_model.h -+* AUTHOR: Tamás Gergely -+* MODIFIED: $Id$ -+*******************************************************************************/ -+ -+#ifndef IPACK_MODEL_H -+#define IPACK_MODEL_H -+ -+//#include "DataStructures/DataTypes.h" -+//#include "DataStructures/DecisionTree.h" -+//#include "DataStructures/PredictorTable.h" -+ -+#define PROBABILITY_SHIFT 12 -+#define PROBABILITY_MAX 0x00001000l -+ -+#define NUMBER_OF_TOKENS_ARM 16 -+#define NUMBER_OF_TOKENS_PER_INSTRUCTION_ARM 8 -+ -+#ifndef __KERNEL__ -+#define NUMBER_OF_TOKENS_TXT 256 -+#define NUMBER_OF_TOKENS_PER_INSTRUCTION_TXT 4 -+#else -+#undef TXT_TOKENS -+#endif // __KERNEL__ -+ -+#ifdef TXT_TOKENS -+#define NUMBER_OF_TOKENS NUMBER_OF_TOKENS_TXT -+#define NUMBER_OF_TOKENS_PER_INSTRUCTION NUMBER_OF_TOKENS_PER_INSTRUCTION_TXT -+#else -+#define NUMBER_OF_TOKENS NUMBER_OF_TOKENS_ARM -+#define NUMBER_OF_TOKENS_PER_INSTRUCTION NUMBER_OF_TOKENS_PER_INSTRUCTION_ARM -+#endif -+ -+#pragma pack(4) -+ -+/* -+ Data structure of an internal node of the tree -+*/ -+typedef struct -+{ -+ PredictorType *attribute_ptr; -+ u32 value; // PredictorType -+ void *right_child_ptr; -+} ipack_treenodeBin; -+/* -+ Data structure of a leaf with probabilities -+*/ -+typedef struct -+{ -+ u16 probabilities[0]; // PredictorType[0] -+} ipack_treeleafP; -+/* -+ Data structure of a leaf with class prediction -+*/ -+typedef struct -+{ -+ PredictorType predicted_class; // PredictorType -+} ipack_treeleafC; -+/* -+ Possible data structures of a tree node -+*/ -+typedef union -+{ -+ ipack_treenodeBin nodeBin; -+ ipack_treeleafP leafP; -+ ipack_treeleafC leafC; -+} ipack_node_data; -+/* -+ Tree node -+*/ -+typedef struct -+{ -+ u32 type; // u8 -+ ipack_node_data data; // ipack_node_data -+} ipack_nodetype; -+/* -+ Nullnode -+*/ -+typedef struct -+{ -+ u32 type; -+ u16 probabilities[NUMBER_OF_TOKENS]; -+} ipack_nullnode; -+/* -+ Model for ipack project -+*/ -+typedef struct -+{ -+ char ID[4]; // char[4] -+ char block_sign[4]; // only the first 2 are used! -+ void *tree_root_ptr; // void* -+ void *tree_code; // generated ARM code -+ PredictorType *predictors_ptr; // PredictorType* -+ ipack_nullnode nullnode; -+} ipack_model_type; -+ -+typedef struct -+{ -+ u32 high; -+ u32 low; -+} ipack_probability_type; -+ -+ -+static void ipack_model_get_probability_for_token(ipack_nodetype *, TokenType, ipack_probability_type *); -+static TokenType ipack_model_get_token_for_range(ipack_nodetype *, u32, u32, ipack_probability_type *); -+/*void ipack_model_predictortable_reset (PredictorType*); -+void ipack_model_predictortable_update (PredictorType*, TokenType);*/ -+ -+#ifndef __KERNEL__ -+/*static void ipack_model_printinfo(ipack_model_type *); -+static void ipack_dumpmodel(void *);*/ -+#endif -+ -+#endif -+ -+//ORIGIN: include/Builders/PredictorGenerator.h -+ -+/******************************************************************************* -+* FILE: PredictorGenerator.h -+* AUTHOR: Tamás Gergely -+* MODIFIED: $Id$ -+*******************************************************************************/ -+ -+#ifndef PREDICTORGENERATOR_H -+#define PREDICTORGENERATOR_H -+ -+//#include "DataStructures.h" -+ -+#ifdef JFFS2_BBC_ARMLIB_MODELGEN -+static PredictorTable *predictorgenerator_generate(void); -+#endif -+ -+#endif -+ -+//ORIGIN: include/Builders/Coder.h -+ -+/******************************************************************************* -+* FILE: Coder.h -+* AUTHOR: Tamás Gergely -+* MODIFIED: $Id$ -+*******************************************************************************/ -+ -+#ifndef CODER_H -+#define CODER_H -+ -+#define CODER_VALUEBITS 16 -+#define CODER_VALUEMAX 0x00010000l -+#define CODER_VALUE3RD 0x0000c000l -+#define CODER_VALUEHLF 0x00008000l -+#define CODER_VALUE1ST 0x00004000l -+ -+#endif -+ -+//ORIGIN: DataStructures/src/TypeDefs.c -+ -+/******************************************************************************* -+* FILE: TypeDefs.c -+* AUTHOR: Tamás Gergely -+* MODIFIED: $Id$ -+*******************************************************************************/ -+ -+//#include "ipack_common.h" -+//#include "DataStructures/TypeDefs.h" -+#ifndef __KERNEL__ -+#include -+#endif -+ -+#define VECTOR_ALLOC_SIZE 0x00001000 -+ -+static void vector_clear(vector * vct) -+{ -+ if (vct->ptr) -+ jffs2_bbc_free(vct->ptr); -+ vct->capacity = 0; -+ vct->size = 0; -+ vct->ptr = 0; -+} -+ -+#ifdef JFFS2_BBC_ARMLIB_MODELGEN -+static void vector_extend(vector * vct) -+{ -+ void *tmp; -+ vct->capacity += vct->alloc_size; -+ tmp = jffs2_bbc_malloc(vct->capacity); -+ if (vct->ptr) { -+ memcpy(tmp, vct->ptr, vct->size); -+ jffs2_bbc_free(vct->ptr); -+ } -+ vct->ptr = tmp; -+} -+ -+static void vector_reset(vector * vct) -+{ -+ vct->capacity = 0; -+ vct->size = 0; -+ vct->alloc_size = VECTOR_ALLOC_SIZE; -+ vct->ptr = 0; -+} -+ -+static void vector_clr_ptr(vector * vct) -+{ -+ void **it; -+ void *end_it; -+ for (it = vct->ptr, end_it = (((char *) (vct->ptr)) + vct->size); it != end_it; it++) { -+ vector_clear(*it); -+ jffs2_bbc_free(*it); -+ } -+ if (vct->ptr) -+ jffs2_bbc_free(vct->ptr); -+ vct->capacity = 0; -+ vct->size = 0; -+ vct->ptr = 0; -+} -+ -+static void vector_add_u8(vector * vct, u8 val) -+{ -+ if ((vct->size) + sizeof(u8) > (vct->capacity)) { -+ vector_extend(vct); -+ } -+ *(u8 *) ((char *) (vct->ptr) + (vct->size)) = val; -+ vct->size += sizeof(u8); -+}; -+ -+static void vector_add_u16(vector * vct, u16 val) -+{ -+ if ((vct->size) + sizeof(u16) > (vct->capacity)) { -+ vector_extend(vct); -+ } -+ *(u16 *) ((char *) (vct->ptr) + (vct->size)) = val; -+ vct->size += sizeof(u16); -+}; -+ -+static void vector_add_u32(vector * vct, u32 val) -+{ -+ if ((vct->size) + sizeof(u32) > (vct->capacity)) { -+ vector_extend(vct); -+ } -+ *(u32 *) ((char *) (vct->ptr) + (vct->size)) = val; -+ vct->size += sizeof(u32); -+}; -+ -+static void vector_add_s8(vector * vct, s8 val) -+{ -+ if ((vct->size) + sizeof(s8) > (vct->capacity)) { -+ vector_extend(vct); -+ } -+ *(s8 *) ((char *) (vct->ptr) + (vct->size)) = val; -+ vct->size += sizeof(s8); -+}; -+ -+static void vector_add_s16(vector * vct, s16 val) -+{ -+ if ((vct->size) + sizeof(s16) > (vct->capacity)) { -+ vector_extend(vct); -+ } -+ *(s16 *) ((char *) (vct->ptr) + (vct->size)) = val; -+ vct->size += sizeof(s16); -+}; -+ -+static void vector_add_s32(vector * vct, s32 val) -+{ -+ if ((vct->size) + sizeof(s32) > (vct->capacity)) { -+ vector_extend(vct); -+ } -+ *(s32 *) ((char *) (vct->ptr) + (vct->size)) = val; -+ vct->size += sizeof(s32); -+}; -+ -+static void vector_add_ptr(vector * vct, void *ptr) -+{ -+ if ((vct->size) + sizeof(void *) > (vct->capacity)) { -+ vector_extend(vct); -+ } -+ *(void **) ((char *) (vct->ptr) + (vct->size)) = ptr; -+ vct->size += sizeof(void *); -+} -+ -+static void vector_concat(vector * lhs, vector * rhs) -+{ -+ void *tmp; -+ if (!(rhs->size)) { -+ return; -+ } -+ tmp = lhs->ptr; -+ lhs->capacity = (lhs->size) + (rhs->size); -+ lhs->ptr = jffs2_bbc_malloc(lhs->capacity); -+ if (tmp) { -+ memcpy(lhs->ptr, tmp, lhs->size); -+ jffs2_bbc_free(tmp); -+ } -+ memcpy((((u8 *) lhs->ptr) + lhs->size), rhs->ptr, rhs->size); -+ lhs->size += rhs->size; -+} -+ -+#endif -+ -+//ORIGIN: DataStructures/src/BitVector.c -+ -+/******************************************************************************* -+* FILE: BitVector.c -+* AUTHOR: Tamás Gergely -+* MODIFIED: $Id$ -+*******************************************************************************/ -+ -+//#include "ipack_common.h" -+//#include "DataStructures/BitVector.h" -+#ifndef __KERNEL__ -+#include -+#endif -+ -+#define VECTOR_ALLOC_SIZE 0x00001000 -+ -+#ifdef JFFS2_BBC_ARMLIB_MODELGEN -+ -+static void bitblocks_clear(BitBlocks * this) -+{ -+ BitVector **it; -+ void *end_it; -+ for (it = this->ptr, end_it = VECTOR_P_END(this); it != end_it; it++) { -+ bitvector_clear(*it); -+ jffs2_bbc_free(*it); -+ } -+ jffs2_bbc_free(this->ptr); -+ this->ptr = 0; -+} -+ -+static void bitvector_clear(BitVector * this) -+{ -+ if (this->base) { -+ jffs2_bbc_free(this->base); -+ } -+ this->freebits = 0; -+ this->capacity = 0; -+ this->size = 0; -+ this->base = 0; -+ this->ptr = 0; -+} -+ -+static void bitvector_W_reset(BitVector * this) -+{ -+ this->freebits = 0; -+ this->capacity = 0; -+ this->size = 0; -+ this->base = 0; -+ this->ptr = 0; -+} -+ -+static void bitvector_W_add0(BitVector * this) -+{ -+ if (!(this->freebits)) { -+ if (this->size == this->capacity) { -+ void *tmp = this->base; -+ this->capacity += VECTOR_ALLOC_SIZE; -+ this->base = jffs2_bbc_malloc(this->capacity); -+ this->ptr = ((u8 *) (this->base)) + this->size; -+ memcpy(this->base, tmp, this->size); -+ jffs2_bbc_free(tmp); -+ } -+ else { -+ this->ptr++; -+ } -+ this->size++; -+ this->freebits = 7; -+ *(this->ptr) = 0x00; -+ } -+ else { -+ this->freebits--; -+ (*(this->ptr)) <<= 1; -+ } -+} -+ -+static void bitvector_W_add1(BitVector * this) -+{ -+ if (!(this->freebits)) { -+ if (this->size == this->capacity) { -+ void *tmp = this->base; -+ this->capacity += VECTOR_ALLOC_SIZE; -+ this->base = jffs2_bbc_malloc(this->capacity); -+ this->ptr = ((u8 *) (this->base)) + this->size; -+ memcpy(this->base, tmp, this->size); -+ jffs2_bbc_free(tmp); -+ } -+ else { -+ this->ptr++; -+ } -+ this->size++; -+ this->freebits = 7; -+ *(this->ptr) = 0x01; -+ } -+ else { -+ this->freebits--; -+ (*(this->ptr)) <<= 1; -+ (*(this->ptr)) |= 0x01; -+ } -+} -+ -+static void bitvector_W_concat_b(BitVector * lhs, BitVector * rhs) -+{ -+ void *tmp; -+ if (!(rhs->size)) { -+ return; -+ } -+ tmp = lhs->base; -+ lhs->capacity = ((((lhs->size) + (rhs->size) - 1) / VECTOR_ALLOC_SIZE) + 1) * VECTOR_ALLOC_SIZE; -+ lhs->base = jffs2_bbc_malloc(lhs->capacity); -+ if (tmp) { -+ memcpy(lhs->base, tmp, lhs->size); -+ jffs2_bbc_free(tmp); -+ } -+ memcpy((((u8 *) (lhs->base)) + lhs->size), rhs->base, rhs->size); -+ lhs->freebits = 0; -+ lhs->size += rhs->size; -+ lhs->ptr = ((u8 *) (lhs->base)) + lhs->size; -+} -+ -+static void bitvector_W_concat_v(BitVector * lhs, vector * rhs) -+{ -+ void *tmp; -+ if (!(rhs->size)) { -+ return; -+ } -+ tmp = lhs->base; -+ lhs->capacity = ((((lhs->size) + (rhs->size) - 1) / VECTOR_ALLOC_SIZE) + 1) * VECTOR_ALLOC_SIZE; -+ lhs->base = jffs2_bbc_malloc(lhs->capacity); -+ if (tmp) { -+ memcpy(lhs->base, tmp, lhs->size); -+ jffs2_bbc_free(tmp); -+ } -+ memcpy((((u8 *) (lhs->base)) + lhs->size), rhs->ptr, rhs->size); -+ lhs->freebits = 0; -+ lhs->size += rhs->size; -+ lhs->ptr = ((u8 *) (lhs->base)) + lhs->size; -+} -+ -+static void bitvector_W_flush(BitVector * this) -+{ -+ (*(this->ptr)) <<= this->freebits; -+ this->freebits = 0; -+} -+ -+static void bitvector_R_reset(BitVector * this) -+{ -+ this->freebits = 7; -+ this->ptr = this->base; -+} -+ -+static u8 bitvector_R_get1(BitVector * this) -+{ -+ u8 tmp = ((*(this->ptr)) >> this->freebits) & 0x01; -+ if (!(this->freebits)) { -+ this->freebits = 7; -+ this->ptr++; -+ } -+ else { -+ this->freebits--; -+ } -+ return tmp; -+} -+ -+static u8 bitvector_R_get8(BitVector * this) -+{ -+ u8 tmp = (*(this->ptr)); -+ this->ptr++; -+ return tmp; -+} -+ -+#endif -+ -+//ORIGIN: DataStructures/src/DecisionTree.c -+ -+/******************************************************************************* -+* FILE: DecisionTree.c -+* AUTHOR: Tamás Gergely -+* MODIFIED: $Id$ -+*******************************************************************************/ -+ -+//#include "ipack_common.h" -+//#include "DataStructures/DecisionTree.h" -+ -+static void decisiontree_delete_node(void *root) -+{ -+ u8 tmp = GET_NODE_PTR_TYPE(root); -+ if (TREENODETYPE_IS_NODE_BINARY(tmp)) { -+ decisiontree_delete_node(((TreeNodeBinary *) root)->left); -+ decisiontree_delete_node(((TreeNodeBinary *) root)->right); -+ } -+ else if ((tmp) == TREENODETYPE_LEAF_P) { -+ if (((TreeLeafP *) root)->probabilities) { -+ jffs2_bbc_free(((TreeLeafP *) root)->probabilities); -+ } -+ } -+ else if ((tmp) == TREENODETYPE_LEAF_C) { -+ } -+ jffs2_bbc_free(root); -+} -+ -+#ifdef JFFS2_BBC_ARMLIB_MODELGEN -+ -+static void decisiontree_delete(DecisionTree * dt) -+{ -+ decisiontree_delete_node(dt->root); -+ jffs2_bbc_free(dt->predictor_max_values); -+} -+ -+static void decisiontree_get_probability_for_token(void *root, PredictorType * preds, TokenType token, ProbabilityType * prob) -+{ -+ void *tmp = root; -+ while (TREENODETYPE_IS_NODE(((TreeNodeBinary *) tmp)->type)) { -+ if (((TreeNodeBinary *) tmp)->type == TREENODETYPE_NODE_BINARY_EQ) { -+ if (preds[((TreeNodeBinary *) tmp)->attribute] TREE_SUBTREE_RELATION_LEFT_EQ((TreeNodeBinary *) tmp)->value) { -+ tmp = ((TreeNodeBinary *) tmp)->left; -+ } -+ else { -+ tmp = ((TreeNodeBinary *) tmp)->right; -+ } -+ } -+ else if (((TreeNodeBinary *) tmp)->type == TREENODETYPE_NODE_BINARY_LT) { -+ if (preds[((TreeNodeBinary *) tmp)->attribute] TREE_SUBTREE_RELATION_LEFT_LT((TreeNodeBinary *) tmp)->value) { -+ tmp = ((TreeNodeBinary *) tmp)->left; -+ } -+ else { -+ tmp = ((TreeNodeBinary *) tmp)->right; -+ } -+ } -+ } -+ prob->high = 0; -+ prob->low = 0; -+ prob->max = 0; -+ if (((TreeNodeBinary *) tmp)->type == TREENODETYPE_LEAF_P) { -+ u32 i; -+ u32 lngth = ((TreeLeafP *) tmp)->pairs << 1; -+ for (i = 0; i < lngth;) { -+ TokenType at = ((TreeLeafP *) tmp)->probabilities[i++]; -+ TokenType av = ((TreeLeafP *) tmp)->probabilities[i++]; -+ if (token > at) -+ prob->low += av; -+ if (token >= at) -+ prob->high += av; -+ prob->max += av; -+ } -+ } -+ else if (((TreeNodeBinary *) tmp)->type == TREENODETYPE_LEAF_C) { -+ if (((TreeLeafC *) tmp)->predicted_class == token) { -+ prob->high = TOKEN_MAXVALUE; -+ prob->max = TOKEN_MAXVALUE; -+ } -+ } -+} -+ -+static TokenType decisiontree_get_token_for_range(void *root, PredictorType * preds, u32 value, u32 range, ProbabilityType * prob) -+{ -+ void *tmp = root; -+ TokenType token = 0; -+ while (TREENODETYPE_IS_NODE(((TreeNodeBinary *) tmp)->type)) { -+ if (((TreeNodeBinary *) tmp)->type == TREENODETYPE_NODE_BINARY_EQ) { -+ if (preds[((TreeNodeBinary *) tmp)->attribute] TREE_SUBTREE_RELATION_LEFT_EQ((TreeNodeBinary *) tmp)->value) { -+ tmp = ((TreeNodeBinary *) tmp)->left; -+ } -+ else { -+ tmp = ((TreeNodeBinary *) tmp)->right; -+ } -+ } -+ else if (((TreeNodeBinary *) tmp)->type == TREENODETYPE_NODE_BINARY_LT) { -+ if (preds[((TreeNodeBinary *) tmp)->attribute] TREE_SUBTREE_RELATION_LEFT_LT((TreeNodeBinary *) tmp)->value) { -+ tmp = ((TreeNodeBinary *) tmp)->left; -+ } -+ else { -+ tmp = ((TreeNodeBinary *) tmp)->right; -+ } -+ } -+ } -+ prob->high = 0; -+ prob->low = 0; -+ prob->max = 0; -+ if (((TreeNodeBinary *) tmp)->type == TREENODETYPE_LEAF_P) { -+ u32 i; -+ u32 norm; -+ TokenType at = 0; -+ TokenType av; -+ u32 lngth = ((TreeLeafP *) tmp)->pairs << 1; -+ for (i = 0; i < lngth;) { -+ i++; -+ prob->max += ((TreeLeafP *) tmp)->probabilities[i++]; -+ } -+ norm = (value * prob->max - 1) / range; -+ for (i = 0; prob->high <= norm;) { -+ at = ((TreeLeafP *) tmp)->probabilities[i++]; -+ av = ((TreeLeafP *) tmp)->probabilities[i++]; -+ prob->high += av; -+ if (prob->high <= norm) -+ prob->low += av; -+ } -+ token = at; -+ } -+ else if (((TreeNodeBinary *) tmp)->type == TREENODETYPE_LEAF_C) { -+ token = ((TreeLeafC *) tmp)->predicted_class; -+ prob->high = TOKEN_MAXVALUE; -+ prob->max = TOKEN_MAXVALUE; -+ } -+ return token; -+} -+#endif -+ -+//ORIGIN: DataStructures/src/PredictorTable.c -+ -+/******************************************************************************* -+* FILE: PredictorTable.c -+* AUTHOR: Tamás Gergely -+* MODIFIED: $Id$ -+*******************************************************************************/ -+ -+//#include "ipack_common.h" -+//#include "DataStructures/PredictorTable.h" -+ -+#ifdef JFFS2_BBC_ARMLIB_MODELGEN -+ -+static void predictortable_clear(PredictorTable * table) -+{ -+ table->predictors = 0; -+} -+ -+static void predictortable_free(PredictorTable * table) -+{ -+ if (table->predictors) { -+ jffs2_bbc_free(table->predictors); -+ table->predictors = 0; -+ } -+} -+ -+static void predictortable_resetARM(PredictorTable * table) -+{ -+ register PredictorType *ptr = table->predictors; -+ register PredictorType *end = ptr + NUMBER_OF_PREDICTORS_ARM; -+ while (ptr < end) { -+ *(ptr++) = 0; -+ } -+} -+ -+static void predictortable_updateARM(PredictorTable * table, TokenType token) -+{ -+ register PredictorType *ptr = table->predictors; -+ register u32 ndx = ptr[0] + 1; -+ ptr[ndx + 8] = ptr[ndx]; -+ ptr[ndx] = token; -+ if (ndx == 8) { -+ ptr[0] = 0; -+ } -+ else { -+ ++ptr[0]; -+ } -+} -+ -+static PredictorType predictortable_minvalueARM(PredictorTable * table, u32 index) -+{ -+ return 0; -+} -+ -+static PredictorType predictortable_maxvalueARM(PredictorTable * table, u32 index) -+{ -+ if (index == 0) { -+ return 7; -+ } -+ else { -+ return 15; -+ } -+} -+ -+#endif -+ -+#ifndef __KERNEL__ -+ -+/*static void predictortable_resetTXT(PredictorTable * table) -+{ -+ register PredictorType *ptr = table->predictors; -+ register PredictorType *end = ptr + NUMBER_OF_PREDICTORS_TXT; -+ while (ptr < end) { -+ *(ptr++) = 0; -+ } -+} -+ -+static void predictortable_updateTXT(PredictorTable * table, TokenType token) -+{ //TODO: modify -+ register PredictorType *ptr = table->predictors; -+// register u32 ndx; -+ ptr[0] = token; -+ if ((('a' <= token) && (token <= 'z')) || (('A' <= token) && (token <= 'Z'))) { -+ ++(ptr[1]); -+ } -+ else { -+ ptr[1] = 0; -+ } -+} -+ -+static PredictorType predictortable_minvalueTXT(PredictorTable * table, u32 index) -+{ -+ return 0; -+} -+ -+static PredictorType predictortable_maxvalueTXT(PredictorTable * table, u32 index) -+{ //TODO: modify -+ return 254; -+}*/ -+ -+#endif // __KERNEL__ -+ -+//ORIGIN: DataStructures/src/ipack_model.c -+ -+/******************************************************************************* -+* FILE: ipack_model.c -+* AUTHOR: Tamás Gergely -+* MODIFIED: $Id$ -+*******************************************************************************/ -+ -+//#include "DataStructures/ipack_model.h" -+//#include "measuredef.h" -+//#include "ipack_common.h" -+ -+#ifdef __MEASURE_TIME_MODEL_GETPROB -+#define __MT_P_MAX 256 -+#define __MT_P_DIV 128 -+#define __MT_P_MIN 0 -+#endif -+ -+static void ipack_model_get_probability_for_token(ipack_nodetype * tmp, TokenType token, ipack_probability_type * prob) -+{ -+// register ipack_nodetype* tmp = model->tree_root_ptr; -+// register ipack_nodetype* tmp = root; -+ while (TREENODETYPE_IS_NODE(tmp->type)) { -+ if (tmp->type == TREENODETYPE_NODE_BINARY_EQ) { -+ if (*(tmp->data.nodeBin.attribute_ptr) TREE_SUBTREE_RELATION_LEFT_EQ tmp->data.nodeBin.value) { -+ ((char *) tmp) += sizeof(tmp->type) + sizeof(ipack_treenodeBin); -+ } -+ else { -+ tmp = tmp->data.nodeBin.right_child_ptr; -+ } -+ } -+ else if (tmp->type == TREENODETYPE_NODE_BINARY_LT) { -+ if (*(tmp->data.nodeBin.attribute_ptr) TREE_SUBTREE_RELATION_LEFT_LT tmp->data.nodeBin.value) { -+ ((char *) tmp) += sizeof(tmp->type) + sizeof(ipack_treenodeBin); -+ } -+ else { -+ tmp = tmp->data.nodeBin.right_child_ptr; -+ } -+ } -+ } -+ prob->high = 0; -+ prob->low = 0; -+// prob->max = 0; -+ if (tmp->type == TREENODETYPE_LEAF_P) { -+ if (token) { -+ prob->low = tmp->data.leafP.probabilities[token - 1]; -+ } -+ prob->high = tmp->data.leafP.probabilities[token]; -+// prob->max = tmp->data.leafP.probabilities[15]; -+ } -+ else if (tmp->type == TREENODETYPE_LEAF_C) { -+ if (tmp->data.leafC.predicted_class == token) { -+ prob->high = TOKEN_MAXVALUE; -+// prob->max = TOKEN_MAXVALUE; -+ } -+ } -+} -+ -+#ifndef IPACK_ARM_ASM -+ -+//return ipack_model_get_token_for_range2(tmp,value,range,prob); -+ -+static TokenType ipack_model_get_token_for_range(ipack_nodetype * tmp, u32 value, u32 range, ipack_probability_type * prob) -+{ -+// register ipack_nodetype* tmp = model->tree_root_ptr; -+// register ipack_nodetype* tmp = root; -+ register TokenType token = 0; -+ while (TREENODETYPE_IS_NODE(tmp->type)) { -+ if (tmp->type == TREENODETYPE_NODE_BINARY_EQ) { -+ if (*(tmp->data.nodeBin.attribute_ptr) TREE_SUBTREE_RELATION_LEFT_EQ tmp->data.nodeBin.value) { -+ ((char *) tmp) += sizeof(tmp->type) + sizeof(ipack_treenodeBin); -+ } -+ else { -+ tmp = tmp->data.nodeBin.right_child_ptr; -+ } -+ } -+ else if (tmp->type == TREENODETYPE_NODE_BINARY_LT) { -+ if (*(tmp->data.nodeBin.attribute_ptr) TREE_SUBTREE_RELATION_LEFT_LT tmp->data.nodeBin.value) { -+ ((char *) tmp) += sizeof(tmp->type) + sizeof(ipack_treenodeBin); -+ } -+ else { -+ tmp = tmp->data.nodeBin.right_child_ptr; -+ } -+ } -+ } -+ prob->high = 0; -+ prob->low = 0; -+// prob->max = 0; -+ if (tmp->type == TREENODETYPE_LEAF_P) { -+ u32 i; -+ u32 norm; -+// prob->max = tmp->data.leafP.probabilities[15]; -+/* norm = (value * prob->max -1)/range; -+ for(i = 0; i < 15; ++i) { -+ if(tmp->data.leafP.probabilities[i] > norm) { -+ break; -+ } -+ }*/ -+ norm = ((value << PROBABILITY_SHIFT) - 1); -+ for (i = 0; i < NUMBER_OF_TOKENS; ++i) { -+ if (range * tmp->data.leafP.probabilities[i] > norm) { -+ break; -+ } -+ } -+ token = (TokenType) i; -+ prob->high = tmp->data.leafP.probabilities[i]; -+ if (token) { -+ prob->low = tmp->data.leafP.probabilities[token - 1]; -+ } -+ } -+ else if (tmp->type == TREENODETYPE_LEAF_C) { -+ token = tmp->data.leafC.predicted_class; -+ prob->high = PROBABILITY_MAX; -+// prob->max = PROBABILITY_MAX; -+ } -+ return token; -+} -+#endif -+/* -+void ipack_model_predictortable_reset(PredictorType* ptr) -+{ -+// register PredictorType* ptr = model->predictors_ptr; -+// register PredictorType* ptr = preds; -+ register PredictorType* end = ptr + NUMBER_OF_PREDICTORS; -+ while(ptr < end) { -+ *(ptr++) = 0; -+ } -+} -+ -+void ipack_model_predictortable_update(PredictorType* ptr, TokenType token) -+{ -+// register PredictorType* ptr = model->predictors_ptr; -+// register PredictorType* ptr = preds; -+ register u32 ndx = ptr[0] + 1; -+ ptr[ndx + 8] = ptr[ndx]; -+ ptr[ndx] = token; -+ if(ndx == 8) { -+ ptr[0] = 0; -+ } else { -+ ++ ptr[0]; -+ } -+}*/ -+/****************************************************************************/ -+ -+#ifndef __KERNEL__ -+static void ipack_model_countpreds(void *ptr, ipack_nodetype * node, double *table, double val) -+{ -+ if ((node->type == TREENODETYPE_NODE_BINARY_EQ) || (node->type == TREENODETYPE_NODE_BINARY_LT)) { -+ table[(u32) (node->data.nodeBin.attribute_ptr) - (u32) (ptr)] += val; -+ ipack_model_countpreds(ptr, (void *) (((u8 *) (node)) + sizeof(node->type) + sizeof(ipack_treenodeBin)), table, val / 2); -+ ipack_model_countpreds(ptr, node->data.nodeBin.right_child_ptr, table, val / 2); -+ } -+ else { -+ } -+} -+ -+/*static void ipack_model_printinfo(ipack_model_type * model) -+{ -+ double *prcnt = jffs2_bbc_malloc(sizeof(double) * NUMBER_OF_PREDICTORS); -+ u32 i; -+ for (i = 0; i < NUMBER_OF_PREDICTORS; i++) { -+ prcnt[i] = 0.0; -+ } -+ ipack_model_countpreds(model->predictors_ptr, model->tree_root_ptr, prcnt, 100); -+ for (i = 0; i < NUMBER_OF_PREDICTORS; i++) { -+ jffs2_bbc_print3(" p[%3d] = %10.6lf\n", (int) i, prcnt[i]); -+ } -+ jffs2_bbc_free(prcnt); -+}*/ -+ -+static void ipack_dumpnode(unsigned char **ptr, FILE * file, char *prefs) -+{ -+ switch (*((*ptr)++)) { -+ u32 i; -+ u32 j; -+ u32 x; -+ u32 y; -+ case TREENODETYPE_NODE_BINARY_EQ: -+ x = *((*ptr)++); -+ y = *((*ptr)++); -+ fprintf(file, "%s+->\tBinary node: P[%u] equals %u\n", prefs, (unsigned int)x, (unsigned int)y); -+ for (j = 0; j < 4096 && prefs[j]; ++j); -+ prefs[j] = '\t'; -+ prefs[++j] = '|'; -+ ipack_dumpnode(ptr, file, prefs); -+ prefs[j--] = 0; -+ ipack_dumpnode(ptr, file, prefs); -+ prefs[j] = 0; -+ break; -+ case TREENODETYPE_NODE_BINARY_LT: -+ x = *((*ptr)++); -+ y = *((*ptr)++); -+ fprintf(file, "%s+->\tBinary node: P[%u] greater than %u\n", prefs, (unsigned int)x, (unsigned int)y); -+ for (j = 0; j < 4096 && prefs[j]; ++j); -+ prefs[j] = '\t'; -+ prefs[++j] = '|'; -+ ipack_dumpnode(ptr, file, prefs); -+ prefs[j--] = 0; -+ ipack_dumpnode(ptr, file, prefs); -+ prefs[j] = 0; -+ break; -+ case TREENODETYPE_LEAF_P: -+ x = *((*ptr)++); -+ fprintf(file, "%s+->\tLeaf: %u pairs\n", prefs, (unsigned int)x); -+ (*ptr) += (x << 1); -+ break; -+ case TREENODETYPE_LEAF_C: -+ x = *((*ptr)++); -+ fprintf(file, "%s+->\tLeaf: class %u\n", prefs, (unsigned int)x); -+ break; -+ default: -+ fprintf(file, "%s+->\tLeaf: nullnode\n", prefs); -+ } -+} -+ -+/*static void ipack_dumpmodel(void *model) -+{ -+ unsigned char *tmp_ptr = model; -+ FILE *file; -+ char C[4096]; -+ if ((file = fopen("DUMPED_MODEL", "wa"))) { -+ int i; -+ for (i = 0; i < 4096; C[i++] = 0); -+ tmp_ptr += 8; -+ tmp_ptr += sizeof(u32); -+ ipack_dumpnode(&tmp_ptr, file, C); -+ fclose(file); -+ } -+}*/ -+ -+#endif -+ -+//ORIGIN: Builders/src/PredictorGenerator.c -+ -+/******************************************************************************* -+* FILE: PredictorGenerator.c -+* AUTHOR: Tamás Gergely -+* MODIFIED: $Id$ -+*******************************************************************************/ -+ -+//#include "ipack_common.h" -+//#include "Builders/PredictorGenerator.h" -+ -+#ifdef JFFS2_BBC_ARMLIB_MODELGEN -+static PredictorTable *predictorgenerator_generate( /*PredictorGeneratorSettings* settings */ ) -+{ -+ PredictorTable *ptr = jffs2_bbc_malloc(sizeof(PredictorTable)); -+ predictortable_clear(ptr); -+ ptr->predictors = jffs2_bbc_malloc(NUMBER_OF_PREDICTORS * sizeof(PredictorType)); -+ return ptr; -+} -+#endif -+ -+//ORIGIN: Builders/src/ipack_armlib_compressor.c -+ -+/******************************************************************************* -+* FILE: ipack_armlim_compressor.c -+* AUTHOR: Tamás Gergely -+* MODIFIED: $Id$ -+*******************************************************************************/ -+ -+//#include "ipack_common.h" -+//#include "DataStructures.h" -+//#include "Builders/PredictorGenerator.h" -+//#include "Builders/Tokenizer.h" -+//#include "Builders/Coder.h" -+ -+#define EC_NO_ERROR 0 -+#define EC_NOT_IPMF_FILE -1 -+#define EC_NOT_IPMF_MODEL -2 -+#define EC_NOT_HG_BLOCK -3 -+#define EC_WRONG_INPUT_LENGTH -501 -+#define EC_CODER_WRONG_PROBABILITY 1 -+#define EC_CODER_WRONG_RANGE 2 -+#define EC_BUFFER_OVERFLOW 501 -+#define EC_BUFFER_UNDERFLOW 502 -+#define EC_UNKNOWN_TOKEN_TYPE 1001 -+#define EC_UNKNOWN_FILTER 1002 -+#define EC_UNKNOWN_CONVERTER 1003 -+#define EC_UNKNOWN_MANIPULATOR 1004 -+ -+/******************************************************************************* -+ -+ COMPRESSOR INIT FUNCTIONS -+ -+*******************************************************************************/ -+ -+#define ROUND_UP_TO_DWORD(val) ( ( (val) + 3 ) & 0xfffffffc ) -+ -+#ifndef __KERNEL__ -+int ipack_glb_endian_X; -+#endif -+ -+static int ipack_compressor_init_tree(unsigned char **ptr, ipack_model_type * model, ipack_nodetype * node, void *nullnode) -+{ -+ int retval = 0; -+ node->type = *((*ptr)++); -+ switch (node->type) { -+ u32 i; -+ u32 j; -+ u32 lngth; -+ u32 tmpret; -+ TokenType at; -+ u16 av; -+ case TREENODETYPE_NODE_BINARY_EQ: -+ case TREENODETYPE_NODE_BINARY_LT: -+ node->data.nodeBin.attribute_ptr = (model->predictors_ptr) + (*((*ptr)++)); -+ node->data.nodeBin.value = *((*ptr)++); -+ retval = sizeof(node->data.nodeBin); -+ retval += ipack_compressor_init_tree(ptr, model, (void *) ROUND_UP_TO_DWORD(((u32) node) + sizeof(node->type) + sizeof(node->data.nodeBin)), nullnode); -+ node->data.nodeBin.right_child_ptr = (void *) ROUND_UP_TO_DWORD(((u32) node) + retval + sizeof(node->type)); -+ retval += ipack_compressor_init_tree(ptr, model, node->data.nodeBin.right_child_ptr, nullnode); -+ break; -+ case TREENODETYPE_LEAF_P: -+ lngth = *((*ptr)++); -+ av = 0; -+ for (i = 0, j = 0; i < lngth; ++i) { -+ at = *((*ptr)++); -+ while (j < at) { -+ node->data.leafP.probabilities[j++] = av; -+ } -+ av += *((*ptr)++); -+ } -+ while (j < NUMBER_OF_TOKENS) { -+ node->data.leafP.probabilities[j++] = av; -+ } -+ for (i = 0; i < NUMBER_OF_TOKENS; ++i) { -+ node->data.leafP.probabilities[i] = ((node->data.leafP.probabilities[i] << PROBABILITY_SHIFT) / node->data.leafP.probabilities[NUMBER_OF_TOKENS - 1]); -+ } -+ retval = ROUND_UP_TO_DWORD(NUMBER_OF_TOKENS * sizeof(u16)); -+ break; -+ case TREENODETYPE_LEAF_C: -+ node->data.leafC.predicted_class = *((*ptr)++); -+ retval = sizeof(node->data.leafC); -+ retval = ROUND_UP_TO_DWORD(retval); -+ break; -+ default: -+ return 0; -+ } -+ return retval + sizeof(node->type); -+} -+ -+#define IPACK_TREE_CONVERT_REPLACE 0 -+#define IPACK_TREE_CONVERT_KEEP 1 -+ -+static void *ipack_tree_to_code(ipack_model_type * model, int *code_size); -+ -+static int ipack_armlib_convert_tree_to_code(ipack_model_type * model_img, int mode) -+{ -+#ifdef IPACK_TREE_TO_CODE -+ int tree_size; -+ -+ model_img->tree_code = ipack_tree_to_code(model_img, &tree_size); -+ jffs2_bbc_print2("Convertation done. Code size=%d\n", tree_size); -+ if (mode == IPACK_TREE_CONVERT_REPLACE) { -+ jffs2_bbc_print1("Freeing original tree.\n"); -+ jffs2_bbc_free(model_img->tree_root_ptr); -+ model_img->tree_root_ptr = NULL; -+ } -+#endif -+ return 0; -+} -+ -+ -+static int ipack_armlib_compressor_init(void **model) -+{ -+ int retval = EC_NO_ERROR; -+ unsigned char *tmp_ptr = *model; -+ u32 i; -+ ipack_model_type *model_img; -+ char tmp_c[2]; -+ -+ if (*(tmp_ptr++) != 'i') { -+ return EC_NOT_IPMF_FILE; -+ } -+ else if (*(tmp_ptr++) != 'P') { -+ return EC_NOT_IPMF_FILE; -+ } -+ else if (*(tmp_ptr++) != 'M') { -+ return EC_NOT_IPMF_FILE; -+ } -+ else if (*(tmp_ptr++) != 'F') { -+ return EC_NOT_IPMF_FILE; -+ } -+ tmp_c[0] = *(tmp_ptr++); -+ tmp_c[1] = *(tmp_ptr++); -+ tmp_ptr += 2; -+ -+ //model_img = jffs2_bbc_malloc(*((u32*)tmp_ptr)); -+ model_img = jffs2_bbc_malloc(sizeof(ipack_model_type) + ROUND_UP_TO_DWORD(NUMBER_OF_PREDICTORS)); -+ model_img->tree_root_ptr = jffs2_bbc_malloc(*((u32 *) tmp_ptr)); //it is smaller a little but, but... -+ -+ tmp_ptr += sizeof(u32); -+ -+ model_img->ID[0] = 'i'; -+ model_img->ID[1] = 'P'; -+ model_img->ID[2] = 'M'; -+ model_img->ID[3] = 'F'; -+ -+ model_img->block_sign[0] = tmp_c[0]; -+ model_img->block_sign[1] = tmp_c[1]; -+ -+ model_img->nullnode.type = TREENODETYPE_LEAF_P; -+ for (i = 0; i < NUMBER_OF_TOKENS; ++i) { -+ model_img->nullnode.probabilities[i] = 0; -+ } -+ model_img->predictors_ptr = (void *) (((u32) model_img) + sizeof(ipack_model_type)); -+ //model_img->tree_root_ptr = (void*)ROUND_UP_TO_DWORD(((u32)(model_img->predictors_ptr)) + NUMBER_OF_PREDICTORS);//ALIGN -+ -+ ipack_compressor_init_tree(&tmp_ptr, model_img, model_img->tree_root_ptr, &(model_img->nullnode)); -+ -+#ifdef IPACK_TREE_TO_CODE -+#ifdef IPACK_AUTO_TREE_TO_CODE -+ jffs2_bbc_print1("Automatically converting tree to ARM code...\n"); -+ ipack_armlib_convert_tree_to_code(model_img, IPACK_TREE_CONVERT_REPLACE); -+#else -+ model_img->tree_code = NULL; -+#endif -+#else -+ model_img->tree_code = NULL; -+#endif -+ -+ jffs2_bbc_free(*model); -+ *model = model_img; -+ return retval; -+} -+ -+/******************************************************************************* -+ -+ COMPRESSOR DEINIT FUNCTIONS -+ -+*******************************************************************************/ -+ -+ -+/* Descructor of compressor (model will be freed with jffs2_bbc_free() after it)*/ -+static void ipack_armlib_compressor_deinit(void) -+{ -+} -+ -+/******************************************************************************* -+ -+ COMPRESS FUNCTIONS -+ -+*******************************************************************************/ -+ -+static int writebits0(unsigned char **dest, u8 * freebits, u32 * opposite, unsigned char *end) -+{ -+ if (!(*freebits)) { -+ ++(*dest); -+ *freebits = 7; -+ **dest = 0x00; -+ } -+ else { -+ --(*freebits); -+ (**dest) <<= 1; -+ } -+ if ((*dest == end) && !(*freebits)) { -+ return EC_BUFFER_OVERFLOW; -+ } -+ while (*opposite) { -+ --(*opposite); -+ if (!(*freebits)) { -+ ++(*dest); -+ *freebits = 7; -+ **dest = 0x01; -+ } -+ else { -+ --(*freebits); -+ (**dest) <<= 1; -+ (**dest) |= 0x01; -+ } -+ if ((*dest == end) && !(*freebits)) { -+ return EC_BUFFER_OVERFLOW; -+ } -+ } -+ return 0; -+} -+ -+static int writebits1(unsigned char **dest, u8 * freebits, u32 * opposite, unsigned char *end) -+{ -+ if (!(*freebits)) { -+ ++(*dest); -+ *freebits = 7; -+ **dest = 0x01; -+ } -+ else { -+ --(*freebits); -+ (**dest) <<= 1; -+ (**dest) |= 0x01; -+ } -+ if ((*dest == end) && !(*freebits)) { -+ return EC_BUFFER_OVERFLOW; -+ } -+ while (*opposite) { -+ --(*opposite); -+ if (!(*freebits)) { -+ ++(*dest); -+ *freebits = 7; -+ **dest = 0x00; -+ } -+ else { -+ --(*freebits); -+ (**dest) <<= 1; -+ } -+ if ((*dest == end) && !(*freebits)) { -+ return EC_BUFFER_OVERFLOW; -+ } -+ } -+ return 0; -+} -+ -+ -+ -+ -+/* Compress block -+ * *dstlen bytes are allocated. -+ * if it is not enough write *sourcelen over to the processed amount of data -+ * returns non zero if fails -+ */ -+static int ipack_armlib_compress(void *model, unsigned char *input, unsigned char *output, unsigned long *sourcelen, unsigned long *dstlen) -+{ -+ register u32 coder_high = CODER_VALUEMAX - 1; -+ register u32 coder_low = 0; -+ u32 coder_opbits = 0; -+ u8 bitvector_freebits = 8; -+ unsigned char *bitvector_ptr = output; -+ unsigned char *bitvector_end = output + (*dstlen - 1); -+ ARM_DataType *tmpp; -+ TokenStream tmpv; -+ TokenType *it; -+ void *end_it; -+ -+ ipack_nodetype *treeroot = ((ipack_model_type *) model)->tree_root_ptr; -+ PredictorType *predctrs = ((ipack_model_type *) model)->predictors_ptr; -+ -+#ifdef IPACK_TREE_TO_CODE -+ void (*treefunc) (ipack_nodetype *, TokenType, ipack_probability_type *); -+ -+ treefunc = ((ipack_model_type *) model)->tree_code; -+ if (treefunc != NULL) -+ treefunc += 4; -+#endif -+ -+ if ((*sourcelen % 4) != 0) { -+ return EC_WRONG_INPUT_LENGTH; -+ } -+ if (*dstlen <= 4) { -+ return EC_BUFFER_OVERFLOW; -+ } -+ -+ if (((ipack_model_type *) model)->ID[0] != 'i') { -+ return EC_NOT_IPMF_MODEL; -+ } -+ else if (((ipack_model_type *) model)->ID[1] != 'P') { -+ return EC_NOT_IPMF_MODEL; -+ } -+ else if (((ipack_model_type *) model)->ID[2] != 'M') { -+ return EC_NOT_IPMF_MODEL; -+ } -+ else if (((ipack_model_type *) model)->ID[3] != 'F') { -+ return EC_NOT_IPMF_MODEL; -+ } -+#ifdef TXT_TOKENS -+ tmpv.capacity = (*sourcelen); -+#else -+ tmpv.capacity = (*sourcelen) << 1; -+#endif -+ tmpv.size = tmpv.capacity; -+ tmpv.ptr = jffs2_bbc_malloc(tmpv.size); -+ it = tmpv.ptr; -+ -+#ifndef __KERNEL__ -+ if (ipack_glb_endian_X) { -+ for (tmpp = (void *) input; (u32) tmpp < (u32) (input + *sourcelen); ++tmpp) { -+#ifdef TXT_TOKENS -+ *(it++) = (u8) ((*tmpp & 0xff000000) >> 24); -+ *(it++) = (u8) ((*tmpp & 0x00ff0000) >> 16); -+ *(it++) = (u8) ((*tmpp & 0x0000ff00) >> 8); -+ *(it++) = (u8) ((*tmpp & 0x000000ff)); -+#else -+ *(it++) = (u8) ((*tmpp & 0x0000f000) >> 12); -+ *(it++) = (u8) ((*tmpp & 0x0000000f)); -+ *(it++) = (u8) ((*tmpp & 0xf0000000) >> 28); -+ *(it++) = (u8) ((*tmpp & 0x000f0000) >> 16); -+ *(it++) = (u8) ((*tmpp & 0x00000f00) >> 8); -+ *(it++) = (u8) ((*tmpp & 0x00f00000) >> 20); -+ *(it++) = (u8) ((*tmpp & 0x0f000000) >> 24); -+ *(it++) = (u8) ((*tmpp & 0x000000f0) >> 4); -+#endif //TXT_TOKENS -+ } -+ } -+ else { -+#endif -+ for (tmpp = (void *) input; (u32) tmpp < (u32) (input + *sourcelen); ++tmpp) { -+#ifdef TXT_TOKENS -+ *(it++) = (u8) ((*tmpp & 0x000000ff)); -+ *(it++) = (u8) ((*tmpp & 0x0000ff00) >> 8); -+ *(it++) = (u8) ((*tmpp & 0x00ff0000) >> 16); -+ *(it++) = (u8) ((*tmpp & 0xff000000) >> 24); -+#else -+ *(it++) = (u8) ((*tmpp & 0x00f00000) >> 20); -+ *(it++) = (u8) ((*tmpp & 0x0f000000) >> 24); -+ *(it++) = (u8) ((*tmpp & 0x000000f0) >> 4); -+ *(it++) = (u8) ((*tmpp & 0x00000f00) >> 8); -+ *(it++) = (u8) ((*tmpp & 0x000f0000) >> 16); -+ *(it++) = (u8) ((*tmpp & 0x0000f000) >> 12); -+ *(it++) = (u8) ((*tmpp & 0x0000000f)); -+ *(it++) = (u8) ((*tmpp & 0xf0000000) >> 28); -+#endif //TXT_TOKENS -+ } -+#ifndef __KERNEL__ -+ } -+#endif -+/* -+ ENCODE -+*/ -+ { //predictor reset -+ register PredictorType *ptr = predctrs; -+ register PredictorType *end = ptr + NUMBER_OF_PREDICTORS; -+ while (ptr < end) { -+ *(ptr++) = 0; -+ } -+ } -+ -+ //*(bitvector_ptr++) = 'H'; -+ //*(bitvector_ptr++) = 'G'; -+ *(bitvector_ptr++) = ((ipack_model_type *) model)->block_sign[0]; -+ *(bitvector_ptr++) = ((ipack_model_type *) model)->block_sign[1]; -+ -+ *(bitvector_ptr++) = (unsigned char) (((*sourcelen) >> 8) & 0xff); -+ *(bitvector_ptr++) = (unsigned char) ((*sourcelen) & 0xff); -+ for (it = tmpv.ptr, end_it = VECTOR_S_END(tmpv); it != end_it; ++it) { -+ ipack_probability_type prob; -+ u32 range; -+ -+#ifdef IPACK_TREE_TO_CODE -+ if (treefunc != NULL) -+ (*treefunc) (treeroot, *it, &prob); -+ else -+ ipack_model_get_probability_for_token(treeroot, *it, &prob); -+#else -+ ipack_model_get_probability_for_token(treeroot, *it, &prob); -+#endif -+ -+ if (prob.high == prob.low) { -+ vector_clear(&tmpv); -+ return EC_CODER_WRONG_PROBABILITY; -+ } -+ range = coder_high - coder_low + 1; -+ coder_high = coder_low + ((range * prob.high) >> PROBABILITY_SHIFT) - 1; -+ coder_low += ((range * prob.low) >> PROBABILITY_SHIFT); -+ for (;;) { -+ if (coder_high < CODER_VALUEHLF) { -+ if (writebits0(&bitvector_ptr, &bitvector_freebits, &coder_opbits, bitvector_end)) { -+ vector_clear(&tmpv); -+ return EC_BUFFER_OVERFLOW; -+ } -+ } -+ else if (coder_low >= CODER_VALUEHLF) { -+ if (writebits1(&bitvector_ptr, &bitvector_freebits, &coder_opbits, bitvector_end)) { -+ vector_clear(&tmpv); -+ return EC_BUFFER_OVERFLOW; -+ } -+ coder_high -= CODER_VALUEHLF; -+ coder_low -= CODER_VALUEHLF; -+ } -+ else if ((CODER_VALUE1ST <= coder_low) && (coder_high < CODER_VALUE3RD)) { -+ ++coder_opbits; -+ coder_high -= CODER_VALUE1ST; -+ coder_low -= CODER_VALUE1ST; -+ } -+ else { -+ break; -+ } -+ coder_high <<= 1; -+ ++coder_high; -+ coder_low <<= 1; -+ if (coder_high < coder_low) { -+ vector_clear(&tmpv); -+ return EC_CODER_WRONG_RANGE; -+ } -+ } -+ { -+#ifdef TXT_TOKENS -+// register u32 ndx; -+ predctrs[0] = *it; -+ if ((('a' <= *it) && (*it <= 'z')) || (('A' <= *it) && (*it <= 'Z'))) { -+ ++(predctrs[1]); -+ } -+ else { -+ predctrs[1] = 0; -+ } -+#else -+ register u32 ndx = predctrs[0] + 1; -+ predctrs[ndx + 8] = predctrs[ndx]; -+ predctrs[ndx] = *it; -+ if (ndx == 8) { -+ predctrs[0] = 0; -+ } -+ else { -+ ++predctrs[0]; -+ } -+#endif -+ } -+ -+ } -+ vector_clear(&tmpv); -+ ++coder_opbits; -+ if (coder_low < CODER_VALUE1ST) { -+ if (writebits0(&bitvector_ptr, &bitvector_freebits, &coder_opbits, bitvector_end)) { -+ return EC_BUFFER_OVERFLOW; -+ } -+ } -+ else { -+ if (writebits1(&bitvector_ptr, &bitvector_freebits, &coder_opbits, bitvector_end)) { -+ return EC_BUFFER_OVERFLOW; -+ } -+ } -+ (*(bitvector_ptr)) <<= bitvector_freebits; -+ *dstlen = ((u32) bitvector_ptr - (u32) output + 1); -+ return EC_NO_ERROR; -+} -+ -+/******************************************************************************* -+ -+ DECOMPRESS FUNCTIONS -+ -+*******************************************************************************/ -+ -+typedef struct -+{ -+ u32 high; -+ u32 low; -+ u32 value; -+ u32 overread; -+} ipack_decompressor_values; -+ -+typedef struct -+{ -+ u8 freebits; -+ unsigned char *ptr; -+ unsigned char *end; -+} ipack_decompressor_bitvector; -+ -+static u8 ipack_bitvector_R_get1(ipack_decompressor_bitvector * bv) -+{ -+ u8 tmp; -+ if (bv->ptr == bv->end) { -+ bv->freebits = 0; -+ return 0; -+ } -+ tmp = (*(bv->ptr) >> bv->freebits) & 0x01; -+ if (!(bv->freebits)) { -+ bv->freebits = 7; -+ ++(bv->ptr); -+ } -+ else { -+ --(bv->freebits); -+ } -+ return tmp; -+} -+ -+/* Decompress block -+ * returns non zero if fails -+ */ -+static int ipack_armlib_decompress(void *model, unsigned char *input, unsigned char *output, unsigned long sourcelen, unsigned long dstlen) -+{ -+ ARM_DataType *data; -+ register u32 coder_high = CODER_VALUEMAX - 1; -+ register u32 coder_low = 0; -+ register u32 coder_value = 0; -+ u32 coder_overread = 0; -+ ipack_decompressor_bitvector bitvector; -+ u32 lngth; -+ u32 i; -+ u32 cntbytes; -+ TokenType tkns[8]; -+ TokenType *tptr; -+ -+ ipack_nodetype *treeroot = ((ipack_model_type *) model)->tree_root_ptr; -+ PredictorType *predctrs = ((ipack_model_type *) model)->predictors_ptr; -+ -+#ifdef IPACK_TREE_TO_CODE -+ TokenType(*treefunc) (ipack_nodetype *, u32, u32, ipack_probability_type *); -+ -+ treefunc = ((ipack_model_type *) model)->tree_code; -+#endif -+ -+ -+ if (((ipack_model_type *) model)->ID[0] != 'i') { -+ return EC_NOT_IPMF_MODEL; -+ } -+ else if (((ipack_model_type *) model)->ID[1] != 'P') { -+ return EC_NOT_IPMF_MODEL; -+ } -+ else if (((ipack_model_type *) model)->ID[2] != 'M') { -+ return EC_NOT_IPMF_MODEL; -+ } -+ else if (((ipack_model_type *) model)->ID[3] != 'F') { -+ return EC_NOT_IPMF_MODEL; -+ } -+ -+ bitvector.freebits = 7; -+ bitvector.ptr = input; -+ bitvector.end = input + sourcelen; -+ -+ /*if(*(bitvector.ptr++) != 'H') { -+ return EC_NOT_HG_BLOCK; -+ } else if(*(bitvector.ptr++) != 'G') { -+ return EC_NOT_HG_BLOCK; -+ } */ -+ bitvector.ptr++; -+ bitvector.ptr++; -+ -+ data = (void *) output; -+ cntbytes = *(bitvector.ptr++); -+ cntbytes <<= 8; -+ cntbytes += *(bitvector.ptr++); -+ -+ { //predictor reset -+ register PredictorType *ptr = predctrs; -+ register PredictorType *end = ptr + NUMBER_OF_PREDICTORS; -+ while (ptr < end) { -+ *(ptr++) = 0; -+ } -+ } -+ for (i = 0; i < CODER_VALUEBITS; ++i) { -+ coder_value <<= 1; -+ coder_value += ipack_bitvector_R_get1(&bitvector); -+ } -+ lngth = dstlen >> 2; -+ if (lngth > (cntbytes >> 2)) { -+ lngth = cntbytes >> 2; -+ } -+ for (i = 0; (i < lngth); ++i) { -+ TokenType itoken; -+ u32 j; -+ tptr = tkns; -+ for (j = 0; j < NUMBER_OF_TOKENS_PER_INSTRUCTION; ++j) { -+ ipack_probability_type prob; -+ u32 range = coder_high - coder_low + 1; -+ -+#ifdef IPACK_TREE_TO_CODE -+ if (treefunc != NULL) -+ itoken = (*treefunc) (treeroot, coder_value - coder_low + 1, range, &prob); -+ else -+#endif -+ itoken = ipack_model_get_token_for_range(treeroot, coder_value - coder_low + 1, range, &prob); -+ -+ -+ if (prob.high == prob.low) { -+ return EC_CODER_WRONG_PROBABILITY; -+ } -+ coder_high = coder_low + ((range * prob.high) >> PROBABILITY_SHIFT) - 1; -+ coder_low += ((range * prob.low) >> PROBABILITY_SHIFT); -+ for (;;) { -+ if (coder_high < CODER_VALUEHLF) { -+ } -+ else if (CODER_VALUEHLF <= coder_low) { -+ coder_value -= CODER_VALUEHLF; -+ coder_high -= CODER_VALUEHLF; -+ coder_low -= CODER_VALUEHLF; -+ } -+ else if ((CODER_VALUE1ST <= coder_low) && (coder_high < CODER_VALUE3RD)) { -+ coder_value -= CODER_VALUE1ST; -+ coder_high -= CODER_VALUE1ST; -+ coder_low -= CODER_VALUE1ST; -+ } -+ else { -+ break; -+ } -+ coder_low <<= 1; -+ coder_high <<= 1; -+ ++(coder_high); -+ coder_value <<= 1; -+ if (bitvector.ptr == bitvector.end) { -+ bitvector.freebits = 0; -+ } -+ coder_value += ((*(bitvector.ptr) >> bitvector.freebits) & 0x01); -+ if (bitvector.freebits) { -+ --bitvector.freebits; -+ } -+ else { -+ bitvector.freebits = 7; -+ ++bitvector.ptr; -+ } -+ if (coder_high < coder_low) { -+ return EC_CODER_WRONG_RANGE; -+ } -+ if ((bitvector.ptr == bitvector.end) && !(bitvector.freebits)) { -+ if ((coder_overread++) > CODER_VALUEBITS) { -+ return EC_BUFFER_UNDERFLOW; -+ } -+ } -+ } -+ { -+#ifdef TXT_TOKENS -+// register u32 ndx; -+ predctrs[0] = itoken; -+ if ((('a' <= itoken) && (itoken <= 'z')) || (('A' <= itoken) && (itoken <= 'Z'))) { -+ ++(predctrs[1]); -+ } -+ else { -+ predctrs[1] = 0; -+ } -+ -+#else -+ register u32 ndx = predctrs[0] + 1; -+ predctrs[ndx + 8] = predctrs[ndx]; -+ predctrs[ndx] = itoken; -+ if (ndx == 8) { -+ predctrs[0] = 0; -+ } -+ else { -+ ++predctrs[0]; -+ } -+#endif -+ } -+ -+ (*(tptr++)) = itoken; -+ } -+ tptr = tkns; -+#ifndef __KERNEL__ -+ if (ipack_glb_endian_X) { -+#ifdef TXT_TOKENS -+ (*data) = ((*tptr) << 24); -+ ++tptr; -+ (*data) |= ((*tptr) << 16); -+ ++tptr; -+ (*data) |= ((*tptr) << 8); -+ ++tptr; -+ (*data) |= (*tptr); -+ ++data; -+#else -+ (*data) = (((*tptr) & 0xf) << 12); -+ ++tptr; -+ (*data) |= ((*tptr) & 0xf); -+ ++tptr; -+ (*data) |= (((*tptr) & 0xf) << 28); -+ ++tptr; -+ (*data) |= (((*tptr) & 0xf) << 16); -+ ++tptr; -+ (*data) |= (((*tptr) & 0xf) << 8); -+ ++tptr; -+ (*data) |= (((*tptr) & 0xf) << 20); -+ ++tptr; -+ (*data) |= (((*tptr) & 0xf) << 24); -+ ++tptr; -+ (*data) |= (((*tptr) & 0xf) << 4); -+ ++data; -+#endif -+ } -+ else { -+#endif -+#ifdef TXT_TOKENS -+ (*data) = (*tptr); -+ ++tptr; -+ (*data) |= ((*tptr) << 8); -+ ++tptr; -+ (*data) |= ((*tptr) << 16); -+ ++tptr; -+ (*data) |= ((*tptr) << 24); -+ ++data; -+#else -+ (*data) = (((*tptr) & 0xf) << 20); -+ ++tptr; -+ (*data) |= (((*tptr) & 0xf) << 24); -+ ++tptr; -+ (*data) |= (((*tptr) & 0xf) << 4); -+ ++tptr; -+ (*data) |= (((*tptr) & 0xf) << 8); -+ ++tptr; -+ (*data) |= (((*tptr) & 0xf) << 16); -+ ++tptr; -+ (*data) |= (((*tptr) & 0xf) << 12); -+ ++tptr; -+ (*data) |= ((*tptr) & 0xf); -+ ++tptr; -+ (*data) |= (((*tptr) & 0xf) << 28); -+ ++data; -+#endif -+#ifndef __KERNEL__ -+ } -+#endif -+ } -+ return EC_NO_ERROR; -+} -+ -+static int ipack_armlib_estimate(void *model, unsigned char *input, unsigned long sourcelen, unsigned long *dstlen, unsigned long *readtime, unsigned long *writetime) -+{ -+ int i, tmp, tmp2, max, maxi; -+ int cnt_cond[] = { 0, 0, 0, 0 }; -+ int cnt_inst[] = { 0, 0, 0, 0 }; -+ -+ // TODO: make a more precise estimation!!! -+ *readtime = JFFS2_BBC_ZLIB_READ_TIME * 6; -+ *writetime = JFFS2_BBC_ZLIB_WRITE_TIME * 2; -+ -+ if (sourcelen % 4 != 0) { -+ *dstlen = sourcelen; -+ return 0; -+ } -+ for (i = 0; i < sourcelen; i++, input++) { -+ tmp2 = tmp = *input; -+ tmp = ((tmp) & 0xf0) >> 4; -+ tmp2 = tmp2 & 0xf; -+ if (tmp == 14) -+ cnt_cond[i % 4]++; -+ if ((tmp2 == 2) || (tmp2 == 3)) -+ cnt_inst[i % 4]++; -+ } -+ maxi = -1; -+ max = -1; -+ for (i = 0; i < 4; i++) -+ if (max < cnt_cond[i]) { -+ max = cnt_cond[i]; -+ maxi = i; -+ } -+ /*jffs2_bbc_print("armlib_EST: %d/%d : %d/%d %d/%d %d/%d %d/%d", -+ cnt_cond[maxi],cnt_inst[maxi], -+ cnt_cond[0],cnt_inst[0], -+ cnt_cond[1],cnt_inst[1], -+ cnt_cond[2],cnt_inst[2], -+ cnt_cond[3],cnt_inst[3]); */ -+ -+ if (cnt_cond[maxi] < (sourcelen >> 4)) { -+ *dstlen = sourcelen; -+ } -+ else { -+ *dstlen = sourcelen / 3; -+ } -+ -+ return 0; -+} -+ -+static char *ipack_armlib_proc_info(void); -+static int ipack_armlib_proc_command(char *command); -+static void ipack_armlib_destroy_model(void **model); -+ -+struct jffs2_bbc_compressor_type jffs2_bbc_armlib = { -+ "armlib", -+ 0x464d5069, -+ {0, 0, 0, 0}, -+ NULL, // init -+ ipack_armlib_compressor_init, // init_model -+ ipack_armlib_destroy_model, // destroy_model -+ ipack_armlib_compressor_deinit, // deinit -+ ipack_armlib_compress, -+ ipack_armlib_estimate, -+ ipack_armlib_decompress, -+ ipack_armlib_proc_info, -+ ipack_armlib_proc_command -+}; -+ -+ -+static char *ipack_armlib_proc_info() -+{ -+#ifdef IPACK_TREE_TO_CODE -+#ifdef IPACK_AUTO_TREE_TO_CODE -+ return "automatic tree to code conversion"; -+#else -+ return "manual tree to code conversion possibility"; -+#endif -+#else -+ return "tree in memory version"; -+#endif -+} -+ -+static int ipack_armlib_proc_command(char *command) -+{ -+ struct jffs2_bbc_model_list_node *model; -+ ipack_model_type *armlib_model; -+ -+ if ((*command == 'g') || (*command == 'G')) { -+ jffs2_bbc_print1("Converting tree(s) to ARM code... (keeping original)\n"); -+ model = jffs2_bbc_armlib.models; -+ if (model == NULL) -+ jffs2_bbc_print1("no model found!\n"); -+ while (model != NULL) { -+ armlib_model = model->model; -+ if (armlib_model == NULL) { -+ jffs2_bbc_print1("Error: NULL model!\n"); -+ } -+ else { -+ ipack_armlib_convert_tree_to_code(armlib_model, IPACK_TREE_CONVERT_KEEP); -+ } -+ model = model->next_compr_model; -+ } -+ } -+ else if ((*command == 'r') || (*command == 'R')) { -+ jffs2_bbc_print1("Converting tree(s) to ARM code... (deleting original)\n"); -+ model = jffs2_bbc_armlib.models; -+ if (model == NULL) -+ jffs2_bbc_print1("no model found!\n"); -+ while (model != NULL) { -+ armlib_model = model->model; -+ if (armlib_model == NULL) { -+ jffs2_bbc_print1("Error: NULL model!\n"); -+ } -+ else { -+ //armlib_model->tree_code = ipack_tree_to_code(armlib_model, &tree_size); -+ //jffs2_bbc_print("Convertation done. Code size=%d\n",tree_size); -+ ipack_armlib_convert_tree_to_code(armlib_model, IPACK_TREE_CONVERT_REPLACE); -+ } -+ model = model->next_compr_model; -+ } -+ } -+ else if ((*command == 'c') || (*command == 'C')) { -+ jffs2_bbc_print1("Deleting ARM representation of the tree(s)...\n"); -+ model = jffs2_bbc_armlib.models; -+ if (model == NULL) -+ jffs2_bbc_print1("no model found!\n"); -+ while (model != NULL) { -+ armlib_model = model->model; -+ if (armlib_model == NULL) { -+ jffs2_bbc_print1("Error: NULL model!\n"); -+ } -+ else { -+ if (armlib_model->tree_code == NULL) { -+ jffs2_bbc_print1("already deleted.\n"); -+ } -+ else { -+ if (armlib_model->tree_root_ptr == NULL) { -+ jffs2_bbc_print1("cannot delete this ARM tree - original tree has deleted\n"); -+ } -+ else { -+ jffs2_bbc_print1("deleting..."); -+ jffs2_bbc_free(armlib_model->tree_code); -+ armlib_model->tree_code = NULL; -+ jffs2_bbc_print1("done.\n"); -+ } -+ } -+ } -+ model = model->next_compr_model; -+ } -+ } -+ else if (*command == '?') { -+ jffs2_bbc_print1("ARMLIB commands:\n"); -+ jffs2_bbc_print1(" g: convert TREEs to ARM code and keep the original\n"); -+ jffs2_bbc_print1(" r: convert TREEs to ARM code and remove the original\n"); -+ jffs2_bbc_print1(" c: delete the original TREEs - if there is any\n"); -+ } -+ else { -+ jffs2_bbc_print1("Unknown command.\n"); -+ } -+ return 0; -+} -+ -+static void ipack_armlib_destroy_model(void **model) -+{ -+ ipack_model_type *model_img; -+ -+ model_img = *model; -+ if (model_img == NULL) { -+ jffs2_bbc_print1("jffs2.bbc: armlib: NULL model at destoying model!\n"); -+ return; -+ } -+ if (model_img->tree_code != NULL) { -+ //jffs2_bbc_print1("jffs2.bbc: armlib: debug: freeing code...\n"); -+ jffs2_bbc_free(model_img->tree_code); -+ model_img->tree_code = NULL; -+ } -+ if (model_img->tree_root_ptr != NULL) { -+ //jffs2_bbc_print1("jffs2.bbc: armlib: debug: freeing tree...\n"); -+ jffs2_bbc_free(model_img->tree_root_ptr); -+ model_img->tree_root_ptr = NULL; -+ } -+ -+ jffs2_bbc_free(model_img); -+ *model = NULL; -+} -+ -+struct jffs2_bbc_compressor_type *jffs2_bbc_armlib_init(int mode) -+{ -+ if (jffs2_bbc_register_compressor(&jffs2_bbc_armlib) == 0) -+ return &jffs2_bbc_armlib; -+ else -+ return NULL; -+} -+ -+void jffs2_bbc_armlib_deinit(void) -+{ -+ jffs2_bbc_unregister_compressor(&jffs2_bbc_armlib); -+} -+ -+/*END OF ARMLIB*/ -diff -Nur linux-mips-cvs/fs/jffs2/jffs2_bbc_framework.c linux-mips/fs/jffs2/jffs2_bbc_framework.c ---- linux-mips-cvs/fs/jffs2/jffs2_bbc_framework.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-mips/fs/jffs2/jffs2_bbc_framework.c 2005-02-07 05:08:34.000000000 +0100 -@@ -0,0 +1,1324 @@ -+/* -+ * JFFS2-BBC: Compression Framework -+ * -+ * $Id$ -+ * -+ * Copyright (C) 2004, Ferenc Havasi -+ * -+ * 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. -+ * -+ */ -+ -+/* USE JFFS2_BBC_STANDALONE define if you don't want to compile without JFFS2 */ -+ -+//#define DEBUG_COMPRESSORS -+//#define DEBUG_SHOW_BLOCK_SIZES -+ -+#define JFFS2_BBC_STAT_BUFF_SIZE 8000 -+ -+#ifndef __KERNEL__ -+ -+#include -+#include -+typedef unsigned long uint32_t; -+ -+#else -+ -+#include -+#include -+#include -+ -+#endif -+ -+#define JFFS2_BBC_ZLIB_BLOCK_SIGN_0 (120) -+#define JFFS2_BBC_ZLIB_BLOCK_SIGN_1 (94) -+ -+#define JFFS2_BBC_DUMMY_BLOCKSIGN_0 (0x54) -+#define JFFS2_BBC_DUMMY_BLOCKSIGN_1 (0x01) -+ -+#ifndef NULL -+#define NULL ((void*)(0)) -+#endif -+ -+#include "jffs2_bbc_framework.h" -+ -+/********************************************************************* -+ * Global data * -+ *********************************************************************/ -+ -+static int jffs2_bbc_compression_mode = JFFS2_BBC_ZLIB_MODE; -+static struct jffs2_bbc_compressor_type *jffs2_bbc_manual_compressor = NULL; -+static struct jffs2_bbc_compressor_type *jffs2_bbc_compressors = NULL; -+static struct jffs2_bbc_model_list_node *jffs2_bbc_model_list = NULL; -+static void *last_sb = NULL; /* previously activated sb */ -+ -+/********************************************************************* -+ * Compressor initialization * -+ *********************************************************************/ -+ -+#ifndef JFFS2_BBC_STANDALONE -+ -+#if !defined(__KERNEL__) || defined(CONFIG_JFFS2_BBC_ARMLIB) -+struct jffs2_bbc_compressor_type *jffs2_bbc_armlib_init(void); -+void jffs2_bbc_armlib_deinit(void); -+#endif -+ -+#if !defined(__KERNEL__) || defined(CONFIG_JFFS2_BBC_LZO) -+struct jffs2_bbc_compressor_type *jffs2_bbc_lzo_init(void); -+void jffs2_bbc_lzo_deinit(void); -+#endif -+ -+#if !defined(__KERNEL__) || defined(CONFIG_JFFS2_BBC_LZSS) -+struct jffs2_bbc_compressor_type *jffs2_bbc_lzss_init(void); -+void jffs2_bbc_lzss_deinit(void); -+#endif -+ -+#if !defined(__KERNEL__) || defined(CONFIG_JFFS2_BBC_LZARI) -+struct jffs2_bbc_compressor_type *jffs2_bbc_lzari_init(void); -+void jffs2_bbc_lzari_deinit(void); -+#endif -+ -+#if !defined(__KERNEL__) || defined(CONFIG_JFFS2_BBC_LZHD) -+struct jffs2_bbc_compressor_type *jffs2_bbc_lzhd_init(void); -+void jffs2_bbc_lzhd_deinit(void); -+#endif -+ -+void jffs2_bbc_compressor_init() -+{ -+#if !defined(__KERNEL__) || defined(CONFIG_JFFS2_BBC_ARMLIB) -+ jffs2_bbc_armlib_init(); -+#endif -+#if !defined(__KERNEL__) || defined(CONFIG_JFFS2_BBC_LZO) -+ jffs2_bbc_lzo_init(); -+#endif -+#if !defined(__KERNEL__) || defined(CONFIG_JFFS2_BBC_LZSS) -+ jffs2_bbc_lzss_init(); -+#endif -+#if !defined(__KERNEL__) || defined(CONFIG_JFFS2_BBC_LZARI) -+ jffs2_bbc_lzari_init(); -+#endif -+#if !defined(__KERNEL__) || defined(CONFIG_JFFS2_BBC_LZHD) -+ jffs2_bbc_lzhd_init(); -+#endif -+} -+ -+void jffs2_bbc_compressor_deinit() -+{ -+#if !defined(__KERNEL__) || defined(CONFIG_JFFS2_BBC_LZHD) -+ jffs2_bbc_lzhd_deinit(); -+#endif -+#if !defined(__KERNEL__) || defined(CONFIG_JFFS2_BBC_LZARI) -+ jffs2_bbc_lzari_deinit(); -+#endif -+#if !defined(__KERNEL__) || defined(CONFIG_JFFS2_BBC_LZSS) -+ jffs2_bbc_lzss_deinit(); -+#endif -+#if !defined(__KERNEL__) || defined(CONFIG_JFFS2_BBC_LZO) -+ jffs2_bbc_lzo_deinit(); -+#endif -+#if !defined(__KERNEL__) || defined(CONFIG_JFFS2_BBC_ARMLIB) -+ jffs2_bbc_armlib_deinit(); -+#endif -+} -+ -+#endif -+ -+#ifndef JFFS2_BBC_STANDALONE -+ -+/********************************************************************* -+ * ZLIB COMPRESSOR * -+ *********************************************************************/ -+ -+extern int jffs2_zlib_compress2(unsigned char *data_in, unsigned char *cpage_out, uint32_t * sourcelen, uint32_t * dstlen); -+extern void jffs2_zlib_decompress2(unsigned char *data_in, unsigned char *cpage_out, uint32_t srclen, uint32_t destlen); -+ -+static int jffs2_bbc_zlib_compress(void *model, unsigned char *input, unsigned char *output, unsigned long *sourcelen, unsigned long *dstlen) -+{ -+ return jffs2_zlib_compress2(input, output, sourcelen, dstlen); -+} -+ -+static int jffs2_bbc_zlib_decompress(void *model, unsigned char *input, unsigned char *output, unsigned long sourcelen, unsigned long dstlen) -+{ -+ jffs2_zlib_decompress2(input, output, sourcelen, dstlen); -+ return 0; -+} -+ -+static int jffs2_bbc_zlib_estimate(void *model, unsigned char *input, unsigned long sourcelen, unsigned long *dstlen, unsigned long *readtime, unsigned long *writetime) -+{ -+ *dstlen = sourcelen * 65 / 100; -+ *readtime = JFFS2_BBC_ZLIB_READ_TIME; -+ *writetime = JFFS2_BBC_ZLIB_WRITE_TIME; -+ return 0; -+} -+ -+static struct jffs2_bbc_compressor_type jffs2_bbc_zlib = { -+ "zlib", -+ 0, -+ {JFFS2_BBC_ZLIB_BLOCK_SIGN_0, JFFS2_BBC_ZLIB_BLOCK_SIGN_1, 0, 0}, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ jffs2_bbc_zlib_compress, -+ jffs2_bbc_zlib_estimate, -+ jffs2_bbc_zlib_decompress, -+ NULL, -+ NULL, -+ 1 -+}; -+ -+static struct jffs2_bbc_compressor_type *jffs2_bbc_original_compressor = &jffs2_bbc_zlib; -+ -+#endif -+ -+/********************************************************************* -+ * Compression mode handling * -+ *********************************************************************/ -+ -+int jffs2_bbc_get_compression_mode(void) -+{ -+ return jffs2_bbc_compression_mode; -+} -+ -+void jffs2_bbc_set_compression_mode(int mode) -+{ -+ jffs2_bbc_compression_mode = mode; -+} -+ -+void jffs2_bbc_set_manual_compressor(struct jffs2_bbc_compressor_type *c) -+{ -+ jffs2_bbc_manual_compressor = c; -+ jffs2_bbc_set_compression_mode(JFFS2_BBC_MANUAL_MODE); -+} -+ -+int jffs2_bbc_set_manual_compressor_by_name(char *name) -+{ -+ struct jffs2_bbc_compressor_type *l; -+ int i; -+ -+ l = jffs2_bbc_compressors; -+ while (l != NULL) { -+ for (i = 0; i < 1000; i++) { -+ if (l->name[i] == 0) { -+ jffs2_bbc_set_manual_compressor(l); -+ return 0; -+ } -+ else if (name[i] == 0) -+ i = 1000; -+ else if (name[i] != l->name[i]) -+ i = 1000; -+ } -+ l = l->next; -+ } -+ jffs2_bbc_set_manual_compressor(NULL); -+ return 1; -+} -+ -+static struct jffs2_bbc_compressor_type *jffs2_bbc_get_compressor_by_name(char *name) -+{ -+ struct jffs2_bbc_compressor_type *l; -+ int i; -+ -+#ifndef JFFS2_BBC_STANDALONE -+ l = jffs2_bbc_original_compressor; -+ for (i = 0; i < 1000; i++) { -+ if (l->name[i] == 0) { -+ return l; -+ } -+ else if (name[i] == 0) -+ i = 1000; -+ else if (name[i] != l->name[i]) -+ i = 1000; -+ } -+#endif -+ -+ l = jffs2_bbc_compressors; -+ while (l != NULL) { -+ for (i = 0; i < 1000; i++) { -+ if (l->name[i] == 0) { -+ return l; -+ } -+ else if (name[i] == 0) -+ i = 1000; -+ else if (name[i] != l->name[i]) -+ i = 1000; -+ } -+ l = l->next; -+ } -+ -+ return NULL; -+} -+ -+int jffs2_bbc_disable_compressor_by_name(char *name) -+{ -+ struct jffs2_bbc_compressor_type *l; -+ -+ l = jffs2_bbc_get_compressor_by_name(name); -+ if (l == NULL) return 1; -+ l->enabled = 0; -+ return 0; -+} -+ -+int jffs2_bbc_enable_compressor_by_name(char *name) -+{ -+ struct jffs2_bbc_compressor_type *l; -+ -+ l = jffs2_bbc_get_compressor_by_name(name); -+ if (l == NULL) return 1; -+ l->enabled = 1; -+ return 0; -+} -+ -+void jffs2_bbc_compressor_command_by_name(char *name_and_command) -+{ -+ struct jffs2_bbc_compressor_type *l; -+ int i; -+ -+ l = jffs2_bbc_compressors; -+ while (l != NULL) { -+ for (i = 0; i < 1000; i++) { -+ if (l->name[i] == 0) { -+ if (name_and_command[i] != ':') { -+ jffs2_bbc_print1("jffs2.bbc: ':' missing after compressor name\n"); -+ } -+ else { -+ if (l->proc_command != NULL) -+ l->proc_command(name_and_command + i + 1); -+ } -+ i = 1000; -+ return; -+ } -+ else if (name_and_command[i] == 0) { -+ i = 1000; -+ } -+ else if (name_and_command[i] != l->name[i]) { -+ i = 1000; -+ } -+ } -+ l = l->next; -+ } -+} -+ -+struct jffs2_bbc_compressor_type *jffs2_bbc_get_manual_compressor(void) -+{ -+ if (jffs2_bbc_get_compression_mode() != JFFS2_BBC_MANUAL_MODE) { -+ jffs2_bbc_manual_compressor = NULL; -+ } -+ return jffs2_bbc_manual_compressor; -+} -+ -+/********************************************************************* -+ * Compressor handling * -+ *********************************************************************/ -+ -+struct jffs2_bbc_compressor_type *jffs2_bbc_get_compressor_list(void) -+{ -+ return jffs2_bbc_compressors; -+} -+ -+struct jffs2_bbc_model_list_node *jffs2_bbc_get_model_list(void) -+{ -+ return jffs2_bbc_model_list; -+} -+ -+int jffs2_bbc_register_compressor(struct jffs2_bbc_compressor_type *c) -+{ -+ struct jffs2_bbc_compressor_type *l; -+ struct jffs2_bbc_model_list_node *l2; -+ int model_found = 0; -+ -+ l = jffs2_bbc_compressors; -+ /* Check for confilcts */ -+ while (l != NULL) { -+ c->name[15] = 0; -+ /*if (strcmp(c->name,l->name)==0) { -+ jffs2_bbc_print1("jffs2.bbc: compressor is already loaded."); -+ return -1; -+ } */ -+ if ((l->model_file_sign == c->model_file_sign) && (c->model_file_sign != 0)) { -+ jffs2_bbc_print1("jffs2.bbc: already used model file sign. fail."); -+ return -1; -+ } -+ l = l->next; -+ } -+ /* Search and initialize model */ -+ c->models = NULL; -+ c->mounted = 0; -+ if (c->init != NULL) { -+ if (c->init() != 0) { -+ jffs2_bbc_print2("jffs2.bbc: cannot initialize compressor %s.\n", c->name); -+ return -1; -+ } -+ } -+ if (c->model_file_sign != 0) { -+ l2 = jffs2_bbc_model_list; -+ while (1) { -+ if (l2 == NULL) -+ break; -+ if (c->model_file_sign == l2->sign) { -+ if (l2->compressor != NULL) { -+ jffs2_bbc_print2("jffs2.bbc: register for %s: BUG, model file already reserved!!!!\n", c->name); -+ } -+ else { -+ if (c->init_model(&(l2->model)) != 0) { -+ jffs2_bbc_print2("jffs2.bbc: cannot initialize compressor %s for a model", c->name); -+ } -+ else { -+ l2->compressor = c; -+ l2->next_compr_model = c->models; -+ c->models = l2; -+ c->mounted++; -+ model_found++; -+ } -+ } -+ } -+ l2 = l2->next_model; -+ } -+ /*if (model_found==0) { -+ jffs2_bbc_print2("jffs2.bbc: no macthing model file found for %s at this time (maybe later)\n",c->name); -+ } */ -+ } -+ /* Insert to the end of the compressor list */ -+ c->enabled = 1; -+ c->buffer = NULL; -+ c->buffer_size = 0; -+ c->stat_compr_orig = c->stat_compr_new = c->stat_decompr = 0; -+ c->next = NULL; -+ if (jffs2_bbc_compressors == NULL) { -+ jffs2_bbc_compressors = c; -+ } -+ else { -+ l = jffs2_bbc_compressors; -+ while (l->next != NULL) -+ l = l->next; -+ l->next = c; -+ } -+ return 0; -+} -+ -+int jffs2_bbc_unregister_compressor(struct jffs2_bbc_compressor_type *c) -+{ -+ struct jffs2_bbc_compressor_type *l; -+ struct jffs2_bbc_model_list_node *l2; -+ -+ if (c->mounted != 0) { -+ jffs2_bbc_print1("jffs2.bbc: Compressor is in use. Sorry."); -+ return -1; -+ } -+ if (jffs2_bbc_compressors == NULL) { -+ jffs2_bbc_print1("jffs2.bbc: unregister: empty list."); -+ return -1; -+ } -+ else if (jffs2_bbc_compressors == c) { -+ if (c->deinit != NULL) -+ c->deinit(); -+ jffs2_bbc_compressors = c->next; -+ } -+ else { -+ l = jffs2_bbc_compressors; -+ while (l->next != c) { -+ if (l->next == NULL) { -+ jffs2_bbc_print2("jffs2.bbc: unregister: cannot find compressor %s in the list.", c->name); -+ return -1; -+ } -+ l = l->next; -+ } -+ if (c->deinit != NULL) -+ c->deinit(); -+ l->next = c->next; -+ } -+ if (c->buffer != NULL) { -+ jffs2_bbc_free(c->buffer); -+ c->buffer = NULL; -+ c->buffer_size = 0; -+ } -+ -+ l2 = jffs2_bbc_model_list; -+ while (l2 != NULL) { -+ if (l2->compressor == c) { -+ jffs2_bbc_print1("jffs2.bbc: unregister: BUG: model found!!!"); -+ l2->compressor = NULL; -+ l2->next_compr_model = NULL; -+ } -+ l2 = l2->next_model; -+ } -+ -+ return 0; -+} -+ -+int jffs2_bbc_model_new(void *sb, int i_num, void *model) -+{ -+ struct jffs2_bbc_model_list_node *node; -+ struct jffs2_bbc_compressor_type *l; -+ char block_sign[2]; -+ -+ int sign; -+ -+ /* check for conflicts... */ -+ sign = *((int *) model); -+ block_sign[0] = *(((char *) model) + 4); -+ block_sign[1] = *(((char *) model) + 5); -+ node = jffs2_bbc_model_list; -+ while (node != NULL) { -+ if ((node->block_sign[0] == block_sign[0]) && (node->block_sign[1] == block_sign[1]) && (node->sb == sb)) { -+ //jffs2_bbc_print2("jffs2.bbc: model_new: model conflict (inode=%d)!\n",i_num); -+ return -1; -+ } -+ node = node->next_model; -+ } -+ -+ /* insertion */ -+ node = jffs2_bbc_malloc_small((long)sizeof(struct jffs2_bbc_model_list_node)); -+ node->sb = sb; -+ node->model = model; -+ node->sign = *((int *) model); -+ node->block_sign[0] = *(((char *) model) + 4); -+ node->block_sign[1] = *(((char *) model) + 5); -+ node->inode = i_num; -+ node->next_model = jffs2_bbc_model_list; -+ node->compressor = NULL; -+ node->stat_decompr = 0; -+ node->next_compr_model = NULL; -+ jffs2_bbc_model_list = node; -+ -+ /* search for matching compressor */ -+ l = jffs2_bbc_compressors; -+ while (l != NULL) { -+ if (l->model_file_sign == sign) { -+ //jffs2_bbc_print2("jffs2.bbc: compressor for model found: %s ",l->name); -+ if (l->init_model(&(node->model)) != 0) { -+ jffs2_bbc_print1("jffs2.bbc: cannot initialize compressor for a model"); -+ } -+ else { -+ l->mounted++; -+ node->compressor = l; -+ node->next_compr_model = l->models; -+ l->models = node; -+ } -+ break; -+ } -+ l = l->next; -+ } -+ return 0; -+} -+ -+static void jffs2_bbc_model_del_from_compressor(struct jffs2_bbc_model_list_node *node) -+{ -+ struct jffs2_bbc_model_list_node *l; -+ -+ if (node->model != NULL) { -+ if (node->compressor != NULL) { -+ if (node->compressor->destroy_model == NULL) { -+ jffs2_bbc_free(node->model); -+ node->model = NULL; -+ } -+ else { -+ node->compressor->destroy_model(&(node->model)); -+ if (node->model != NULL) -+ jffs2_bbc_print1("jffs2.bbc: warning: not NULL model after destroying!\n"); -+ } -+ } -+ } -+ -+ if (node->compressor == NULL) { -+ jffs2_bbc_print1("jffs2.bbc: jffs2_bbc_model_del_from_compressor: no compressor!\n"); -+ return; -+ } -+ l = node->compressor->models; -+ if (l == NULL) { -+ jffs2_bbc_print1("jffs2.bbc: jffs2_bbc_model_del_from_compressor error, models=NULL!\n"); -+ return; -+ } -+ if (l == node) { -+ node->compressor->models = node->next_compr_model; -+ node->compressor->mounted--; -+ return; -+ } -+ while (1) { -+ if (l->next_compr_model == node) { -+ l->next_compr_model = node->next_compr_model; -+ node->compressor->mounted--; -+ return; -+ } -+ l = l->next_compr_model; -+ if (l == NULL) { -+ jffs2_bbc_print1("jffs2.bbc: jffs2_bbc_model_del_from_compressor: not found\n"); -+ return; -+ } -+ } -+} -+ -+void jffs2_bbc_model_del(void *sb) -+{ -+ struct jffs2_bbc_model_list_node *l, *l2; -+ -+ l = jffs2_bbc_model_list; -+ if (l == NULL) -+ return; -+ if (l->sb == sb) { -+ jffs2_bbc_model_list = l->next_model; -+ jffs2_bbc_model_del_from_compressor(l); -+ jffs2_bbc_free_small(l); -+ jffs2_bbc_model_del(sb); -+ return; -+ } -+ while (1) { -+ if (l->next_model == NULL) { -+ break; -+ } -+ if (l->next_model->sb == sb) { -+ l2 = l->next_model; -+ l->next_model = l->next_model->next_model; -+ jffs2_bbc_model_del_from_compressor(l2); -+ jffs2_bbc_free_small(l2); -+ jffs2_bbc_model_del(sb); -+ return; -+ } -+ l = l->next_model; -+ } -+ last_sb = NULL; -+} -+ -+void jffs2_bbc_model_set_act_sb(void *sb) -+{ -+ last_sb = sb; -+} -+ -+void *jffs2_bbc_model_get_act_sb(void) -+{ -+ return last_sb; -+} -+ -+void *jffs2_bbc_model_get_newest(struct jffs2_bbc_compressor_type *compressor) -+{ -+ struct jffs2_bbc_model_list_node *m, *best_m; -+ int max_sign, sign; -+ -+ if (compressor == NULL) { -+ jffs2_bbc_print1("jffs2.bbc: jffs2_bbc_model_get: NULL!!\n"); -+ return NULL; -+ } -+ -+ best_m = NULL; -+ max_sign = -1; -+ m = compressor->models; -+ while (m != NULL) { -+ if (m->sb == last_sb) { -+ sign = (int) (m->block_sign[0]) * 256 + (int) (m->block_sign[1]); -+ if (sign > max_sign) { -+ max_sign = sign; -+ best_m = m; -+ } -+ } -+ m = m->next_compr_model; -+ } -+ if (best_m != NULL) -+ return best_m->model; -+ else -+ return NULL; -+} -+ -+/********************************************************************* -+ * Statistics * -+ *********************************************************************/ -+ -+static char *jffs2_bbc_stat_buff = NULL; -+ -+char *jffs2_bbc_get_model_stats(void) -+{ -+ char *b; -+ struct jffs2_bbc_model_list_node *m; -+ struct jffs2_bbc_compressor_type *c; -+ -+ if (jffs2_bbc_stat_buff == NULL) -+ jffs2_bbc_stat_buff = jffs2_bbc_malloc(8000); -+ -+ b = jffs2_bbc_stat_buff; -+ -+ b += sprintf(b, "Loaded compressors:"); -+ c = jffs2_bbc_compressors; -+ while (c != NULL) { -+ b += sprintf(b, "\n %s (%d) ", c->name, c->enabled); -+ if (c->model_file_sign != 0) { -+ b += sprintf(b, "m_sign=%d ", c->model_file_sign); -+ b += sprintf(b, "models="); -+ m = c->models; -+ while (m != NULL) { -+ b += sprintf(b, "(inode=%d)", m->inode); -+ m = m->next_compr_model; -+ } -+ } -+ else { -+ b += sprintf(b, "b_sign=(%d,%d) nomodel", (int) (c->block_sign[0]), (int) (c->block_sign[1])); -+ } -+ if (c->proc_info != NULL) { -+ b += sprintf(b, "\n %s", c->proc_info()); -+ } -+ c = c->next; -+ } -+ -+ m = jffs2_bbc_model_list; -+ -+ if (m == NULL) { -+ b += sprintf(b, "\nPresent models: NONE\n"); -+ } -+ else { -+ b += sprintf(b, "\nPresent models:\n"); -+ while (m != NULL) { -+ b += sprintf(b, " b_sign=(%d,%d),inode=%d,decompr=%d", (int) (m->block_sign[0]), (int) (m->block_sign[1]), m->inode, m->stat_decompr); -+ if (m->compressor == NULL) -+ b += sprintf(b, ",compressor=NULL\n"); -+ else -+ b += sprintf(b, ",compressor=%s\n", m->compressor->name); -+ m = m->next_model; -+ } -+ } -+ -+ return jffs2_bbc_stat_buff; -+} -+ -+/********************************************************************* -+ * Memory handling, debug * -+ *********************************************************************/ -+ -+static int jffs2_bbc_mem_counter = 0; -+ -+#ifdef __KERNEL__ -+ -+void *jffs2_bbc_malloc(long size) -+{ -+ void *addr = vmalloc(size); -+ if (addr != NULL) -+ jffs2_bbc_mem_counter++; -+ else { -+ jffs2_bbc_print2("DEBUG: not enough memory (%ld)\n", size); -+ } -+ return addr; -+} -+ -+void jffs2_bbc_free(void *addr) -+{ -+ jffs2_bbc_mem_counter--; -+ vfree(addr); -+} -+ -+void *jffs2_bbc_malloc_small(long size) -+{ -+ void *addr; -+ addr = kmalloc(size, 0); -+ if (addr != NULL) -+ jffs2_bbc_mem_counter++; -+ return addr; -+} -+ -+void jffs2_bbc_free_small(void *addr) -+{ -+ jffs2_bbc_mem_counter--; -+ kfree(addr); -+} -+ -+#else -+ -+void *jffs2_bbc_malloc(long size) -+{ -+ void *addr = malloc(size); -+ if (addr != NULL) -+ jffs2_bbc_mem_counter++; -+ return addr; -+} -+ -+void jffs2_bbc_free(void *addr) -+{ -+ jffs2_bbc_mem_counter--; -+ free(addr); -+} -+ -+void *jffs2_bbc_malloc_small(long size) -+{ -+ return jffs2_bbc_malloc(size); -+} -+ -+void jffs2_bbc_free_small(void *addr) -+{ -+ jffs2_bbc_free(addr); -+} -+ -+#endif -+ -+int jffs2_bbc_test_memory_counter(int verbose) -+{ -+ if (verbose > 0) { -+ jffs2_bbc_print2("jffs2.bbc: mem_counter=%d!\n", jffs2_bbc_mem_counter); -+ } -+ return jffs2_bbc_mem_counter; -+} -+ -+int jffs2_bbc_get_memory_counter(void) -+{ -+ return jffs2_bbc_mem_counter; -+} -+ -+static char mem_stat[200]; -+ -+char *jffs2_bbc_get_mem_stats(void) -+{ -+ sprintf(mem_stat, "Memcounter=%d\n", jffs2_bbc_mem_counter); -+ return mem_stat; -+} -+ -+void jffs2_bbc_print_flush(void) -+{ -+#ifdef __KERNEL__ -+ return; -+#else -+ fflush(stdout); -+ fflush(stderr); -+#endif -+} -+ -+/********************************************************************* -+ * FRAMEWORK - ZLIB REPLACEMENT * -+ *********************************************************************/ -+ -+#ifndef JFFS2_BBC_STANDALONE -+ -+/* Temorary buffers */ -+static char stat_str[JFFS2_BBC_STAT_BUFF_SIZE]; -+static int tmp_buffer_size = 0; -+static char *tmp_buffer = NULL; -+ -+/* Statistic - used by /proc/jffs2_bbc and mkfs.jffs2 */ -+char *jffs2_bbc_get_compr_stats(void) -+{ -+ struct jffs2_bbc_compressor_type *l; -+ char *s = stat_str; -+ -+ s += sprintf(s, "Compression statistics:\n"); -+ l = jffs2_bbc_original_compressor; -+ //s += sprintf(s, " zlib: compr=%d/%d decompr=%d\n", stat_zlib_compr_new, stat_zlib_compr_orig, stat_zlib_decompr); -+ s += sprintf(s, " %s: compr=%d/%d decompr=%d\n", l->name, l->stat_compr_new, l->stat_compr_orig, l->stat_decompr); -+ l = jffs2_bbc_get_compressor_list(); -+ while (l != NULL) { -+ s += sprintf(s, " %s: compr=%d/%d decompr=%d\n", l->name, l->stat_compr_new, l->stat_compr_orig, l->stat_decompr); -+ l = l->next; -+ } -+ return stat_str; -+} -+ -+static void jffs2_bbc_buffer_fill(unsigned char *buff, int size) -+{ -+ for (; size > 0; size--, buff++) -+ *buff = 255; -+} -+ -+ -+static int jffs2_bbc_update_compr_buf(unsigned long size) -+{ -+ struct jffs2_bbc_compressor_type *l; -+ -+ if (size < 5000) -+ size = 5000; -+ if (tmp_buffer == NULL) { -+ tmp_buffer = jffs2_bbc_malloc(size); -+ jffs2_bbc_buffer_fill(tmp_buffer, size); -+ tmp_buffer_size = size; -+ } -+ else if (tmp_buffer_size < size) { -+ jffs2_bbc_free(tmp_buffer); -+ tmp_buffer = jffs2_bbc_malloc(size); -+ jffs2_bbc_buffer_fill(tmp_buffer, size); -+ tmp_buffer_size = size; -+ } -+ l = jffs2_bbc_get_compressor_list(); -+ while (l != NULL) { -+ if (l->buffer == NULL) { -+ l->buffer_size = size; -+ l->buffer = jffs2_bbc_malloc(size); -+ jffs2_bbc_buffer_fill(l->buffer, size); -+ } -+ else if (l->buffer_size < size) { -+ jffs2_bbc_free(l->buffer); -+ l->buffer_size = size; -+ l->buffer = jffs2_bbc_malloc(size); -+ jffs2_bbc_buffer_fill(l->buffer, size); -+ } -+ l = l->next; -+ } -+ return 0; -+} -+ -+#ifdef DEBUG_COMPRESSORS -+ -+static unsigned char *debug_tmp_buff = NULL; -+static long debug_orig_srclen = -1; -+static long debug_orig_dstlen = -1; -+static int debug_mem_counter = -1; -+ -+ -+void debug_before_compress(struct jffs2_bbc_compressor_type *c, void *model, unsigned char *input, unsigned char *output, long *sourcelen, long *dstlen) -+{ -+ -+ debug_orig_srclen = *sourcelen; // for buffer overflow test -+ debug_orig_dstlen = *dstlen; // for buffer overflow test -+ output[debug_orig_dstlen + 1] = 255; -+ -+ debug_mem_counter = jffs2_bbc_get_memory_counter(); // for memory guard -+} -+ -+void debug_after_compress(struct jffs2_bbc_compressor_type *c, int back, void *model, unsigned char *input, unsigned char *output, long *sourcelen, long *dstlen) -+{ -+ long dst_len = *dstlen; -+ long src_len = *sourcelen; -+ int i; -+ -+ // Memory guard -+ if (debug_mem_counter != jffs2_bbc_get_memory_counter()) { -+ jffs2_bbc_print4("!!!!!!!! %s error: possible COMPRESSOR MEMORY LEAK: %d->%d\n", c->name, debug_mem_counter, jffs2_bbc_get_memory_counter()); -+ debug_mem_counter = jffs2_bbc_get_memory_counter(); -+ } -+ -+ // Buffer overflow test -+ if (output[debug_orig_dstlen + 1] != 255) { -+ jffs2_bbc_print7("!!!!!!!! %s error: BUFFER OVERFLOW !!!!!!!!!!!! b[%d]=%d (srclen=%d dstlen=%d, back=%d)\n", c->name, (int) (debug_orig_dstlen + 1), (int) (output[debug_orig_dstlen + 1]), (int) (debug_orig_srclen), (int) (*dstlen), back); -+ } -+ -+ // Decompression check -+ if (back == 0) { -+ if (debug_tmp_buff == NULL) -+ debug_tmp_buff = jffs2_bbc_malloc(17000); -+ for (i = 0; i < src_len; i++) debug_tmp_buff[i] = 0xf6; -+ c->decompress(model, output, debug_tmp_buff, dst_len, src_len); -+ // Memory guard for decompressor -+ if (debug_mem_counter != jffs2_bbc_get_memory_counter()) { -+ jffs2_bbc_print4("!!!!!!!! %s error: possible DECOMPRESSOR MEMORY LEAK: %d->%d\n", c->name, debug_mem_counter, jffs2_bbc_get_memory_counter()); -+ debug_mem_counter = jffs2_bbc_get_memory_counter(); -+ } -+ -+ for (i = 0; i < src_len; i++) -+ if (input[i] != debug_tmp_buff[i]) { -+ jffs2_bbc_print7("!!!!!!!! %s error: BLOCK DECOMPRESSED BADLY (first bad: %d in %d: %d!=%d (compressed size=%d)) !!!!!!!!!!!!\n", c->name, i, src_len, (int)input[i], (int)debug_tmp_buff[i], dst_len); -+ break; -+ } -+ return; -+ } -+ -+ // Return value test -+ //jffs2_bbc_print3("!!!!!!!! %s error: %d !!!!!!!!!!!!\n", c->name, back); -+} -+ -+#endif -+ -+int jffs2_zlib_compress(unsigned char *data_in, unsigned char *cpage_out, uint32_t * sourcelen, uint32_t * dstlen) -+{ -+ struct jffs2_bbc_compressor_type *c; -+ int back, back_zlib, mode, min, i, i2; -+ long tmp = 0, tmp_read_time = 1000, tmp_write_time = 1000, orig_src, orig_dest, src, dest; -+ struct jffs2_bbc_model_list_node *m; -+ void *sb; -+ unsigned char *tmp_p = NULL; -+ -+ sb = jffs2_bbc_model_get_act_sb(); -+ -+ orig_src = *sourcelen; -+ orig_dest = *dstlen; -+ -+ mode = jffs2_bbc_get_compression_mode(); -+ -+ if (mode == JFFS2_BBC_DUMMY_MODE) { -+ i=0; i2=0; -+ if (*dstlen>2) { -+ cpage_out[i++]=JFFS2_BBC_DUMMY_BLOCKSIGN_0; -+ cpage_out[i++]=JFFS2_BBC_DUMMY_BLOCKSIGN_1; -+ i2=i; -+ } -+ for (;((i < *dstlen) && (i < (*sourcelen)+i2));i++) { -+ cpage_out[i] = data_in[i-i2]; -+ } -+ *sourcelen=i-i2; -+ *dstlen=i; -+ return 0; -+ } -+ -+ if (mode == JFFS2_BBC_ZLIB_MODE) { -+ /*if (!jffs2_bbc_original_compressor->enabled) { -+ jffs2_bbc_print2("jffs2.bbc: WARNING: ZLIB mode but %s disabled! Enabling for this procedure...\n",jffs2_bbc_original_compressor->name); -+ }*/ -+ back = jffs2_bbc_original_compressor->compress(NULL, data_in, cpage_out, sourcelen, dstlen); -+ jffs2_bbc_original_compressor->stat_compr_orig += *sourcelen; -+ jffs2_bbc_original_compressor->stat_compr_new += *dstlen; -+ return back; -+ } -+ -+ jffs2_bbc_update_compr_buf(orig_dest); -+ -+ if (mode == JFFS2_BBC_SIZE_MODE) { -+ // Testing all compressors -+ if (!jffs2_bbc_original_compressor->enabled) { -+ min = -1; -+ } -+ else { -+ back_zlib = jffs2_bbc_original_compressor->compress(NULL, data_in, cpage_out, sourcelen, dstlen); -+ min = *dstlen; -+ } -+ c = jffs2_bbc_get_compressor_list(); -+ while (c != NULL) { -+ c->buffer_cnt = -1; -+ if (c->enabled == 0) { -+ c = c->next; -+ continue; -+ } -+ if (c->model_file_sign == 0) { -+ src = orig_src; -+ dest = orig_dest; -+#ifdef DEBUG_COMPRESSORS -+ debug_before_compress(c, NULL, data_in, c->buffer, &src, &dest); -+#endif -+ back = c->compress(NULL, data_in, c->buffer, &src, &dest); -+#ifdef DEBUG_COMPRESSORS -+ debug_after_compress(c, back, NULL, data_in, c->buffer, &src, &dest); -+#endif -+ if (back == 0) { -+ c->buffer_cnt = dest; -+ if ((min < 0) || (min > dest)) -+ min = dest; -+ } -+ } -+ else { -+ m = c->models; -+ while (m != NULL) { -+ src = orig_src; -+ dest = orig_dest; -+ if (m->sb == sb) { -+ if (c->buffer_cnt == -1) { -+#ifdef DEBUG_COMPRESSORS -+ debug_before_compress(c, m->model, data_in, c->buffer, (long *) (&src), (long *) (&dest)); -+#endif -+ back = c->compress(m->model, data_in, c->buffer, (long *) (&src), (long *) (&dest)); -+#ifdef DEBUG_COMPRESSORS -+ debug_after_compress(c, back, m->model, data_in, c->buffer, (long *) (&src), (long *) (&dest)); -+#endif -+ if (back == 0) { -+ c->buffer_cnt = dest; -+ if ((min < 0) || (min > dest)) -+ min = dest; -+ } -+ } -+ else { -+#ifdef DEBUG_COMPRESSORS -+ debug_before_compress(c, m->model, data_in, tmp_buffer, &src, &dest); -+#endif -+ back = c->compress(m->model, data_in, tmp_buffer, &src, &dest); -+#ifdef DEBUG_COMPRESSORS -+ debug_after_compress(c, back, m->model, data_in, tmp_buffer, &src, &dest); -+#endif -+ if (back == 0) { -+ if (c->buffer_cnt > dest) { -+ c->buffer_cnt = dest; -+ tmp_p = c->buffer; -+ c->buffer = tmp_buffer; -+ tmp_buffer = tmp_p; -+ if ((min < 0) || (min > dest)) -+ min = dest; -+ } -+ } -+ } -+ } -+ m = m->next_compr_model; -+ } -+ } -+ c = c->next; -+ } -+ //Finding the best and copy its result -+ -+#ifdef DEBUG_SHOW_BLOCK_SIZES -+ jffs2_bbc_print1("\n"); -+ if (jffs2_bbc_original_compressor->enabled) { -+ if (min == *dstlen) { -+ jffs2_bbc_print3("%s:%d* ", jffs2_bbc_original_compressor->name, (int) (*dstlen)); -+ } -+ else { -+ jffs2_bbc_print3("%s:%d ", jffs2_bbc_original_compressor->name, (int) (*dstlen)); -+ } -+ } -+ c = jffs2_bbc_get_compressor_list(); -+ while (c != NULL) { -+ if (c->enabled == 0) { -+ c = c->next; -+ continue; -+ } -+ if (c->buffer_cnt == min) -+ jffs2_bbc_print3("%s:%d* ", c->name, c->buffer_cnt); -+ else -+ jffs2_bbc_print3("%s:%d ", c->name, c->buffer_cnt); -+ c = c->next; -+ } -+#endif -+ -+ if (min == -1) { -+ return -1; // none of compressors work (maybe too short output buffer) -+ } -+ -+ if (jffs2_bbc_original_compressor->enabled) { -+ if (min == *dstlen) { -+ jffs2_bbc_original_compressor->stat_compr_orig += *sourcelen; -+ jffs2_bbc_original_compressor->stat_compr_new += *dstlen; -+ return back_zlib; -+ } -+ } -+ -+ c = jffs2_bbc_get_compressor_list(); -+ while (c != NULL) { -+ if (c->enabled == 0) { -+ c = c->next; -+ continue; -+ } -+ if (c->buffer_cnt == min) { -+ *dstlen = c->buffer_cnt; -+ *sourcelen = orig_src; -+ for (i = 0; i < *dstlen; i++) { -+ cpage_out[i] = c->buffer[i]; -+ } -+ c->stat_compr_orig += *sourcelen; -+ c->stat_compr_new += *dstlen; -+ return 0; -+ } -+ c = c->next; -+ } -+ jffs2_bbc_print1("jffs2.bbc: compr (full): BUG!!!\n"); -+ return 0; -+ } -+ -+ if ((mode == JFFS2_BBC_FASTR_MODE)||(mode == JFFS2_BBC_FASTW_MODE)||(mode == JFFS2_BBC_FASTS_MODE)) { -+ // Estimating all compressors -+ if (jffs2_bbc_original_compressor->enabled) { -+ back = jffs2_bbc_original_compressor->estimate(NULL, data_in, *sourcelen, &tmp, &tmp_read_time, &tmp_write_time); -+ } -+ else { -+ tmp = -1; -+ tmp_read_time = -1; -+ tmp_write_time = -1; -+ } -+ if (mode == JFFS2_BBC_FASTR_MODE) tmp = tmp_read_time; -+ if (mode == JFFS2_BBC_FASTW_MODE) tmp = tmp_write_time; -+ min = tmp; -+ c = jffs2_bbc_get_compressor_list(); -+ while (c != NULL) { -+ src = orig_src; -+ dest = orig_dest; -+ c->buffer_cnt = -1; -+ if (c->enabled == 0) { -+ c = c->next; -+ continue; -+ } -+ if ((c->model_file_sign == 0) || (jffs2_bbc_model_get_newest(c) != NULL)) { -+ back = c->estimate(jffs2_bbc_model_get_newest(c), data_in, src, &dest, &tmp_read_time, &tmp_write_time); -+ if (mode == JFFS2_BBC_FASTR_MODE) dest = tmp_read_time; -+ if (mode == JFFS2_BBC_FASTW_MODE) dest = tmp_write_time; -+ if (back == 0) { -+ c->buffer_cnt = dest; -+ if ((min < 0) || (min > dest)) -+ min = dest; -+ } -+ else { -+ c->buffer_cnt = -1; -+ } -+ } -+ c = c->next; -+ } -+ // Finding the best and compress with it -+ if (min == -1) { -+ return -1; -+ } -+ if (jffs2_bbc_original_compressor->enabled) { -+ if (min == tmp) { -+ back = jffs2_bbc_original_compressor->compress(NULL, data_in, cpage_out, sourcelen, dstlen); -+ jffs2_bbc_original_compressor->stat_compr_orig += *sourcelen; -+ jffs2_bbc_original_compressor->stat_compr_new += *dstlen; -+ return back; -+ } -+ } -+ c = jffs2_bbc_get_compressor_list(); -+ while (c != NULL) { -+ if (c->enabled == 0) { -+ c = c->next; -+ continue; -+ } -+ if (c->buffer_cnt == min) { -+ back = c->compress(jffs2_bbc_model_get_newest(c), data_in, cpage_out, (unsigned long*)sourcelen, (unsigned long*)dstlen); -+ if ((back == 0) && (*dstlen < orig_dest) && (*dstlen > 4)) { -+ c->stat_compr_orig += *sourcelen; -+ c->stat_compr_new += *dstlen; -+ } -+ else { // fallback will always be available -+ *sourcelen = orig_src; -+ *dstlen = orig_dest; -+ back = jffs2_bbc_original_compressor->compress(NULL, data_in, cpage_out, sourcelen, dstlen); -+ jffs2_bbc_original_compressor->stat_compr_orig += *sourcelen; -+ jffs2_bbc_original_compressor->stat_compr_new += *dstlen; -+ return back; -+ } -+ return 0; -+ } -+ c = c->next; -+ } -+ jffs2_bbc_print1("jffs2.bbc: compress (fastX mode): BUG!!!\n"); -+ return 0; -+ } -+ -+ if (mode == JFFS2_BBC_MANUAL_MODE) { -+ c = jffs2_bbc_get_manual_compressor(); -+ if (c != NULL) { -+ if (c->model_file_sign == 0) { -+ src = orig_src; -+ dest = orig_dest; -+ back = c->compress(NULL, data_in, cpage_out, &src, &dest); -+ if (back == 0) { -+ *dstlen = dest; -+ *sourcelen = src; -+ c->stat_compr_orig += *sourcelen; -+ c->stat_compr_new += *dstlen; -+ return 0; -+ } -+ } -+ else { -+ c->buffer_cnt = -1; -+ m = c->models; -+ min = -1; -+ while (m != NULL) { -+ src = orig_src; -+ dest = orig_dest; -+ if (m->sb == sb) { -+ if (min == -1) { -+ back = c->compress(m->model, data_in, cpage_out, (unsigned long*)sourcelen, (unsigned long*)dstlen); -+ if ((back == 0) && (*dstlen < orig_dest) && (*dstlen > 4)) { -+ min = dest; -+ tmp_p = cpage_out; -+ } -+ } -+ else { -+ back = c->compress(m->model, data_in, tmp_buffer, &src, &dest); -+ if ((back == 0) && (dest < orig_dest) && (dest > 4)) { -+ if (c->buffer_cnt > dest) { -+ if (min > dest) { -+ min = dest; -+ tmp_p = tmp_buffer; -+ } -+ } -+ } -+ } -+ } -+ m = m->next_compr_model; -+ } -+ if (min != -1) { -+ if (tmp_p != cpage_out) { -+ for (i = 0; i < min; i++) -+ cpage_out[i] = tmp_p[i]; -+ *sourcelen = orig_src; -+ *dstlen = min; -+ } -+ c->stat_compr_orig += *sourcelen; -+ c->stat_compr_new += *dstlen; -+ return 0; -+ } -+ } -+ } -+ /*else { -+ jffs2_bbc_print1("iPack: manual mode without selected compressor!\n"); -+ } */ -+ -+ /*if (!jffs2_bbc_original_compressor->enabled) { -+ jffs2_bbc_print2("jffs2.bbc: WARNING: %s must be enabled! Enabling for this procedure...\n",jffs2_bbc_original_compressor->name); -+ }*/ -+ back = jffs2_bbc_original_compressor->compress(NULL, data_in, cpage_out, sourcelen, dstlen); -+ jffs2_bbc_original_compressor->stat_compr_orig += *sourcelen; -+ jffs2_bbc_original_compressor->stat_compr_new += *dstlen; -+ return back; -+ -+ -+ } -+ -+ jffs2_bbc_print1("jffs2.bbc: compress: unimlemented compress mode!!!\n"); -+ return 0; -+} -+ -+void jffs2_zlib_decompress(unsigned char *data_in, unsigned char *cpage_out, uint32_t srclen, uint32_t destlen) -+{ -+ struct jffs2_bbc_model_list_node *m; -+ struct jffs2_bbc_compressor_type *c; -+ char d[2]; -+ void *sb; -+ int i; -+ -+ /* If the input too small... */ -+ if (destlen<=2) { -+ cpage_out[0]=data_in[0]; -+ if (destlen==2) cpage_out[1]=data_in[1]; -+ return; -+ } -+ -+ sb = jffs2_bbc_model_get_act_sb(); -+ d[0] = *(data_in); -+ d[1] = *(data_in + 1); -+ -+ d[0] &= 0x7f; // Variants support... -+ -+ /* Search for model based decompressors... */ -+ m = jffs2_bbc_get_model_list(); -+ while (m != NULL) { -+ if ((d[0] == m->block_sign[0]) && (d[1] == m->block_sign[1]) && (sb == m->sb)) { -+ if (m->compressor == NULL) { -+ jffs2_bbc_print3("jffs2.bbc: decompressor for block_sign (%d,%d) not loaded!\n", (int) (d[0]), (int) (d[1])); -+ } -+ else { -+ m->compressor->decompress(m->model, data_in, cpage_out, srclen, destlen); -+ m->compressor->stat_decompr++; -+ m->stat_decompr++; -+ } -+ return; -+ } -+ m = m->next_model; -+ } -+ /* Is it ZLIB? */ -+ if ((((int) d[0]) == (int)(jffs2_bbc_original_compressor->block_sign[0])) && (((int) d[1]) == (int)(jffs2_bbc_original_compressor->block_sign[1]))) { -+ jffs2_bbc_original_compressor->decompress(NULL, data_in, cpage_out, srclen, destlen); -+ jffs2_bbc_original_compressor->stat_decompr++; -+ return; -+ } -+ /* Search for non model based decompressors... */ -+ c = jffs2_bbc_get_compressor_list(); -+ while (c != NULL) { -+ if (c->model_file_sign == 0) { -+ if (((int) (d[0]) == (int) (c->block_sign[0])) && ((int) (d[1]) == (int) (c->block_sign[1]))) { -+ c->decompress(NULL, data_in, cpage_out, srclen, destlen); -+ c->stat_decompr++; -+ return; -+ } -+ } -+ c = c->next; -+ } -+ /* Is it DUMMY? */ -+ if ((((int) d[0]) == JFFS2_BBC_DUMMY_BLOCKSIGN_0) && (((int) d[1]) == JFFS2_BBC_DUMMY_BLOCKSIGN_1)) { -+ for (i=0;idecompress(NULL, data_in, cpage_out, srclen, destlen); -+ jffs2_bbc_original_compressor->stat_decompr++; -+} -+ -+#endif -diff -Nur linux-mips-cvs/fs/jffs2/jffs2_bbc_framework.h linux-mips/fs/jffs2/jffs2_bbc_framework.h ---- linux-mips-cvs/fs/jffs2/jffs2_bbc_framework.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-mips/fs/jffs2/jffs2_bbc_framework.h 2005-02-07 05:08:34.000000000 +0100 -@@ -0,0 +1,202 @@ -+/* -+ * JFFS2-BBC: Compression Framework - headers -+ * -+ * $Id$ -+ * -+ * Copyright (C) 2004, Ferenc Havasi -+ * -+ * 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 __JFFS2_BBC_FRAMEWORK_H__ -+ -+#define __JFFS2_BBC_FRAMEWORK_H__ -+ -+#define JFFS2_BBC_VERSION "0.54.3" -+ -+#define JFFS2_BBC_CONFIG_FILE "bbc.conf" -+ -+/********************************************************************* -+ * Compression mode handling * -+ *********************************************************************/ -+ -+#define JFFS2_BBC_ZLIB_MODE 1 -+#define JFFS2_BBC_SIZE_MODE 2 -+#define JFFS2_BBC_FASTR_MODE 3 -+#define JFFS2_BBC_FASTW_MODE 4 -+#define JFFS2_BBC_FASTS_MODE 5 -+#define JFFS2_BBC_MANUAL_MODE 6 -+#define JFFS2_BBC_DUMMY_MODE 7 -+ -+int jffs2_bbc_get_compression_mode(void); -+void jffs2_bbc_set_compression_mode(int mode); -+ -+/********************************************************************* -+ * Read/write speed unit * -+ * everything is relative to the speed of zlib * -+ * bigger number means slower speed! * -+ *********************************************************************/ -+ -+#define JFFS2_BBC_ZLIB_READ_TIME 10000 -+#define JFFS2_BBC_ZLIB_WRITE_TIME 10000 -+ -+/********************************************************************* -+ * Compressor handling * -+ *********************************************************************/ -+ -+struct jffs2_bbc_compressor_type -+{ -+ char name[16]; -+ int model_file_sign; /* 0 for no model file needed */ -+ char block_sign[4]; /* only nomodel compressors, and only the first 2 _bytes are used! */ -+ int (*init)(void); -+ int (*init_model)(void **model); -+ void (*destroy_model)(void **model); -+ void (*deinit)(void); -+ /* Compress block -+ * *dstlen bytes are allocated. -+ * if it is not enough write *sourcelen over to the processed amount of data -+ * returns non zero if fails -+ */ -+ int (*compress)(void *model, unsigned char *input, unsigned char *output, unsigned long *sourcelen, unsigned long *dstlen); -+ int (*estimate)(void *model, unsigned char *input, unsigned long sourcelen, -+ unsigned long *dstlen, unsigned long *readtime, unsigned long *writetime); -+ /* Decompress block -+ * returns non zero if fails -+ */ -+ int (*decompress)(void *model, unsigned char *input, unsigned char *output, unsigned long sourcelen, unsigned long dstlen); -+ char *(*proc_info)(void); -+ int (*proc_command)(char *command); -+ int enabled; /* filled by BBC */ -+ int mounted; /* filled by BBC */ -+ void *models; /* filled by BBC */ -+ char *buffer; /* filled by BBC */ -+ int buffer_size; /* filled by BBC */ -+ int buffer_cnt; /* filled by BBC */ -+ int buffer_tmp; /* filled by BBC */ -+ int stat_compr_orig; /* filled by BBC */ -+ int stat_compr_new; /* filled by BBC */ -+ int stat_decompr; /* filled by BBC */ -+ struct jffs2_bbc_compressor_type *next; /* filled by BBC */ -+}; -+ -+/* It sets the compression mode to JFFS2_BBC_MANUAL_MODE */ -+ -+void jffs2_bbc_set_manual_compressor(struct jffs2_bbc_compressor_type *c); /* NULL = ZLIB */ -+int jffs2_bbc_set_manual_compressor_by_name(char *name); -+int jffs2_bbc_disable_compressor_by_name(char *name); -+int jffs2_bbc_enable_compressor_by_name(char *name); -+void jffs2_bbc_compressor_command_by_name(char *name_and_command); -+ -+/* If the compression mode is JFFS2_BCC_MANUAL_MODE the manually setted -+ compressor can be get using it. Otherwise it returns with NULL. */ -+ -+struct jffs2_bbc_compressor_type *jffs2_bbc_get_manual_compressor(void); -+ -+struct jffs2_bbc_model_list_node -+{ -+ void *sb; /* FS idendifier (JFFS2_SB_INFO(sb) at this moment) */ -+ void *model; /* model data */ -+ int sign; /* sign of the model (first 4 bytes) */ -+ char block_sign[4]; /* block sign - only the first 2 bytes are used! */ -+ int inode; /* inode number of the model file */ -+ int stat_decompr; -+ struct jffs2_bbc_compressor_type *compressor; -+ struct jffs2_bbc_model_list_node *next_model; -+ struct jffs2_bbc_model_list_node *next_compr_model; -+}; -+ -+struct jffs2_bbc_compressor_type *jffs2_bbc_get_compressor_list(void); -+struct jffs2_bbc_model_list_node *jffs2_bbc_get_model_list(void); -+ -+int jffs2_bbc_register_compressor(struct jffs2_bbc_compressor_type *c); -+int jffs2_bbc_unregister_compressor(struct jffs2_bbc_compressor_type *c); -+ -+int jffs2_bbc_model_new(void *sb, int i_num, void *model); -+void jffs2_bbc_model_del(void *sb); -+void jffs2_bbc_model_set_act_sb(void *sb); -+void *jffs2_bbc_model_get_act_sb(void); -+void *jffs2_bbc_model_get_newest(struct jffs2_bbc_compressor_type *compressor); -+ -+/********************************************************************* -+ * Compressor init function * -+ *********************************************************************/ -+ -+void jffs2_bbc_compressor_init(void); -+void jffs2_bbc_compressor_deinit(void); -+ -+/********************************************************************* -+ * Statistics * -+ *********************************************************************/ -+ -+char *jffs2_bbc_get_compr_stats(void); -+char *jffs2_bbc_get_model_stats(void); -+ -+/********************************************************************* -+ * Other * -+ *********************************************************************/ -+ -+ -+void jffs2_bbc_print_flush(void); -+ -+#ifdef __KERNEL__ -+#include -+#define jffs2_bbc_print1(a) printk(a) -+#define jffs2_bbc_print2(a,b) printk(a,b) -+#define jffs2_bbc_print3(a,b,c) printk(a,b,c) -+#define jffs2_bbc_print4(a,b,c,d) printk(a,b,c,d) -+#define jffs2_bbc_print5(a,b,c,d,e) printk(a,b,c,d,e) -+#define jffs2_bbc_print6(a,b,c,d,e,f) printk(a,b,c,d,e,f) -+#define jffs2_bbc_print7(a,b,c,d,e,f,g) printk(a,b,c,d,e,f,g) -+#define jffs2_bbc_print8(a,b,c,d,e,f,g,h) printk(a,b,c,d,e,f,g,h) -+#define jffs2_bbc_print9(a,b,c,d,e,f,g,h,i) printk(a,b,c,d,e,f,g,h,i) -+#else -+#include -+#define jffs2_bbc_print1(a) fprintf(stderr,a) -+#define jffs2_bbc_print2(a,b) fprintf(stderr,a,b) -+#define jffs2_bbc_print3(a,b,c) fprintf(stderr,a,b,c) -+#define jffs2_bbc_print4(a,b,c,d) fprintf(stderr,a,b,c,d) -+#define jffs2_bbc_print5(a,b,c,d,e) fprintf(stderr,a,b,c,d,e) -+#define jffs2_bbc_print6(a,b,c,d,e,f) fprintf(stderr,a,b,c,d,e,f) -+#define jffs2_bbc_print7(a,b,c,d,e,f,g) fprintf(stderr,a,b,c,d,e,f,g) -+#define jffs2_bbc_print8(a,b,c,d,e,f,g,h) fprintf(stderr,a,b,c,d,e,f,g,h) -+#define jffs2_bbc_print9(a,b,c,d,e,f,g,h,i) fprintf(stderr,a,b,c,d,e,f,g,h,i) -+#endif -+ -+/* Handle endianness */ -+#ifndef __KERNEL__ -+ -+#define ENDIAN_HOST_AND_TARGET_SAME 0 -+#define ENDIAN_HOST_AND_TARGET_DIFFERENT 1 -+ -+extern int jffs2_bbc_glb_endian_X; -+ -+#endif -+ -+/* Allocating more than one page (tip. 4096 byte) */ -+void *jffs2_bbc_malloc(long size); -+void jffs2_bbc_free(void *addr); -+ -+/* Allocating less than one page (tip. 4096 byte) */ -+void *jffs2_bbc_malloc_small(long size); -+void jffs2_bbc_free_small(void *addr); -+ -+/* Memory guarding */ -+int jffs2_bbc_test_memory_counter(int verbose); -+char *jffs2_bbc_get_mem_stats(void); -+int jffs2_bbc_get_memory_counter(void); -+ -+#endif -diff -Nur linux-mips-cvs/fs/jffs2/jffs2_bbc_fs.c linux-mips/fs/jffs2/jffs2_bbc_fs.c ---- linux-mips-cvs/fs/jffs2/jffs2_bbc_fs.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-mips/fs/jffs2/jffs2_bbc_fs.c 2005-02-07 05:08:34.000000000 +0100 -@@ -0,0 +1,331 @@ -+/* -+ * JFFS2-BBC: File System Extension for Linux Kernel -+ * -+ * $Id$ -+ * -+ * Copyright (C) 2004, Ferenc Havasi -+ * -+ * 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 "nodelist.h" -+ -+#include "jffs2_bbc_framework.h" -+ -+struct jffs2_bbc_fs_sb_list { -+ struct super_block *sb; -+ struct jffs2_bbc_fs_sb_list *next; -+}; -+ -+static struct jffs2_bbc_fs_sb_list *sb_list = NULL; -+ -+void jffs2_bbc_proc_init(void); -+void jffs2_bbc_proc_deinit(void); -+ -+void jffs2_bbc_load_model(void *sb_par) { -+ struct jffs2_sb_info *c; -+ //struct jffs2_inode_info *f; -+ struct dentry *config_dentry,*model_dentry; -+ struct qstr config_name,model_name; -+ struct file *config_file,*model_file; -+ char *buff=NULL,*model_buff; -+ int config_size,model_size; -+ int i,prev_i; -+ struct super_block *sb; -+ struct jffs2_bbc_fs_sb_list *sb_l; -+ -+ sb = sb_par; -+ sb_l = jffs2_bbc_malloc_small(sizeof(struct jffs2_bbc_fs_sb_list)); -+ sb_l->sb = sb; -+ sb_l->next = sb_list; -+ sb_list = sb_l; -+ config_name.name = JFFS2_BBC_CONFIG_FILE; -+ config_name.len = strlen(config_name.name); -+ config_name.hash = full_name_hash(config_name.name,config_name.len); -+ config_dentry = d_alloc(sb->s_root,&config_name); -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) -+ sb->s_root->d_inode->i_op->lookup(sb->s_root->d_inode,config_dentry); -+#else -+ sb->s_root->d_inode->i_op->lookup(sb->s_root->d_inode,config_dentry,NULL); -+#endif -+ -+ if (config_dentry->d_inode != NULL) { -+ config_size = config_dentry->d_inode->i_size; -+ //printk("config_file_size=%d\n",config_size); -+ if (config_size > 0) { -+ buff = jffs2_bbc_malloc(config_size+1); -+ config_file = dentry_open(config_dentry,NULL,O_RDONLY); -+ kernel_read(config_file,0,buff,config_size); -+ buff[config_size] = 0; -+ for (prev_i = i = 0 ; i < config_size+1 ; i++) { -+ if (buff[i] == '\n') buff[i]=0; -+ if (buff[i] == 0) { -+ if (prev_i != i) { -+ if ((buff[prev_i] == '-') && (buff[prev_i+1] == 0)) break; -+ printk("reading model file %s... ",buff+prev_i); -+ model_name.name = buff+prev_i; -+ model_name.len = strlen(buff+prev_i); -+ model_name.hash = full_name_hash(model_name.name,model_name.len); -+ model_dentry = d_alloc(sb->s_root,&model_name); -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) -+ sb->s_root->d_inode->i_op->lookup(sb->s_root->d_inode,model_dentry); -+#else -+ sb->s_root->d_inode->i_op->lookup(sb->s_root->d_inode,model_dentry,NULL); -+#endif -+ if (model_dentry->d_inode != NULL) { -+ c = JFFS2_SB_INFO(model_dentry->d_inode->i_sb); -+ //f = JFFS2_INODE_INFO(model_dentry->d_inode); -+ model_size = model_dentry->d_inode->i_size; -+ model_buff = jffs2_bbc_malloc(model_size); -+ model_file = dentry_open(model_dentry,NULL,O_RDONLY); -+ kernel_read(model_file,0,model_buff,model_size); -+ if (jffs2_bbc_model_new(c,model_dentry->d_inode->i_ino,model_buff) != 0) { -+ printk("already loaded.\n"); -+ jffs2_bbc_free(model_buff); -+ } -+ else { -+ printk("done (%d bytes readed from inode %d).\n",model_size,(int)(model_dentry->d_inode->i_ino)); -+ } -+ } -+ else { -+ printk("not found.\n"); -+ } -+ dput(model_dentry); -+ } -+ prev_i = i+1; -+ } -+ } -+ } -+ } -+ dput(config_dentry); -+ if (buff != NULL) jffs2_bbc_free(buff); -+} -+ -+void jffs2_bbc_unload_model(void *sb_par) -+{ -+ struct jffs2_sb_info *c; -+ struct super_block *sb = sb_par; -+ struct jffs2_bbc_fs_sb_list *sb_l,*sb_l2; -+ int done = 0; -+ -+ c = JFFS2_SB_INFO(sb); -+ jffs2_bbc_model_del(c); -+ if (sb_list == NULL) printk("jffs2.bbc: error! NULL sb list!\n"); -+ else { -+ if (sb_list->sb == sb) { -+ jffs2_bbc_free_small(sb_list); -+ sb_list = NULL; -+ done = 1; -+ } -+ else { -+ sb_l = sb_list; -+ while (sb_l->next != NULL) { -+ if (sb_l->next->sb == sb) { -+ sb_l2 = sb_l->next->next; -+ jffs2_bbc_free_small(sb_l->next); -+ sb_l->next = sb_l2; -+ done = 1; -+ } -+ sb_l = sb_l->next; -+ } -+ -+ } -+ if (done == 0) { -+ printk("jffs2.bbc: cannot delete sb from sblist!\n"); -+ } -+ } -+} -+ -+static int jffs2_bbc_get_mounted(void) { -+ struct jffs2_bbc_fs_sb_list *sb_l; -+ int num = 0; -+ -+ sb_l = sb_list; -+ while (sb_l != NULL) { -+ num++; -+ sb_l = sb_l->next; -+ } -+ return num; -+ -+} -+ -+int jffs2_bbc_proc_read(char *buf, char **start, off_t offset, int count, int *eof, void *data) -+{ -+ int len = 0, mode; -+ -+ mode = jffs2_bbc_get_compression_mode(); -+ len += sprintf(buf + len, "BBC version: %s\n", JFFS2_BBC_VERSION); -+ len += sprintf(buf+len,"Mounted jffs2 filesystems: %d\n",jffs2_bbc_get_mounted()); -+ //len += sprintf(buf+len,"actual model file inode: %d\n",jffs2_bbc_model_get_inum()); -+ len += sprintf(buf + len, "Compression mode: "); -+ if (mode == JFFS2_BBC_ZLIB_MODE) -+ len += sprintf(buf + len, "ZLIB mode"); -+ else if (mode == JFFS2_BBC_SIZE_MODE) -+ len += sprintf(buf + len, "SIZE mode"); -+ else if (mode == JFFS2_BBC_FASTR_MODE) -+ len += sprintf(buf + len, "FASTR mode"); -+ else if (mode == JFFS2_BBC_FASTW_MODE) -+ len += sprintf(buf + len, "FASTW mode"); -+ else if (mode == JFFS2_BBC_FASTS_MODE) -+ len += sprintf(buf + len, "FASTS mode"); -+ else if (mode == JFFS2_BBC_DUMMY_MODE) -+ len += sprintf(buf + len, "DUMMY mode"); -+ else if (mode == JFFS2_BBC_MANUAL_MODE) { -+ len += sprintf(buf + len, "MANUAL mode ("); -+ if (jffs2_bbc_get_manual_compressor() != NULL) -+ len += sprintf(buf + len, "%s)", jffs2_bbc_get_manual_compressor()->name); -+ else -+ len += sprintf(buf + len, "ZLIB)"); -+ } -+ else -+ len += sprintf(buf + len, "unknown mode"); -+ len += sprintf(buf + len, "\n"); -+ len += sprintf(buf + len, "%s", jffs2_bbc_get_compr_stats()); -+ len += sprintf(buf + len, "%s", jffs2_bbc_get_model_stats()); -+ len += sprintf(buf + len, "%s", jffs2_bbc_get_mem_stats()); -+ *eof = 1; -+ return len; -+} -+ -+int jffs2_bbc_proc_write(struct file *file, const char *buffer_orig, unsigned long count, void *data) -+{ -+ char *buffer; -+ int i; -+ struct jffs2_bbc_fs_sb_list *sb_l; -+ -+ if (buffer_orig == NULL) return 0; -+ -+ buffer = jffs2_bbc_malloc(count+2); -+ for (i=0;i= 3) && (buffer[1] == ':')) { -+ jffs2_bbc_print1("jffs2.bbc: activating MANUAL mode.\n"); -+ jffs2_bbc_set_manual_compressor_by_name(buffer + 2); -+ jffs2_bbc_free(buffer); -+ return count; -+ } -+ else if (((*buffer == '0')) && (count >= 3) && (buffer[1] == ':')) { -+ jffs2_bbc_print1("jffs2.bbc: disabling a compressor... "); -+ if (jffs2_bbc_disable_compressor_by_name(buffer + 2) == 0) { -+ jffs2_bbc_print1("done.\n"); -+ } -+ else { -+ jffs2_bbc_print1("not found.\n"); -+ } -+ jffs2_bbc_free(buffer); -+ return count; -+ } -+ else if (((*buffer == '1')) && (count >= 3) && (buffer[1] == ':')) { -+ jffs2_bbc_print1("jffs2.bbc: enabling a compressor... "); -+ if (jffs2_bbc_enable_compressor_by_name(buffer + 2) == 0) { -+ jffs2_bbc_print1("done.\n"); -+ } -+ else { -+ jffs2_bbc_print1("not found.\n"); -+ } -+ jffs2_bbc_free(buffer); -+ return count; -+ } -+ else if (((*buffer == 'c') || (*buffer == 'C')) && (count >= 3) && (buffer[1] == ':')) { -+ jffs2_bbc_compressor_command_by_name(buffer + 2); -+ jffs2_bbc_free(buffer); -+ return count; -+ } -+ else if ((*buffer == 'r') || (*buffer == 'R')) { -+ jffs2_bbc_print1("jffs2.bbc: reloading model files:\n"); -+ sb_l = sb_list; -+ while (sb_l != NULL) { -+ jffs2_bbc_unload_model(sb_l->sb); -+ jffs2_bbc_load_model(sb_l->sb); -+ sb_l = sb_l->next; -+ } -+ jffs2_bbc_free(buffer); -+ return count; -+ } -+ else if (((buffer[0] == 'f') || (buffer[0] == 'F'))&&((buffer[1] == 'r') || (buffer[1] == 'R'))) { -+ jffs2_bbc_set_compression_mode(JFFS2_BBC_FASTR_MODE); -+ jffs2_bbc_print1("jffs2.bbc: FASTR compression mode activated.\n"); -+ jffs2_bbc_free(buffer); -+ return count; -+ } -+ else if (((buffer[0] == 'f') || (buffer[0] == 'F'))&&((buffer[1] == 'w') || (buffer[1] == 'W'))) { -+ jffs2_bbc_set_compression_mode(JFFS2_BBC_FASTW_MODE); -+ jffs2_bbc_print1("jffs2.bbc: FASTW compression mode activated.\n"); -+ jffs2_bbc_free(buffer); -+ return count; -+ } -+ else if (((buffer[0] == 'f') || (buffer[0] == 'F'))&&((buffer[1] == 's') || (buffer[1] == 'S'))) { -+ jffs2_bbc_set_compression_mode(JFFS2_BBC_FASTS_MODE); -+ jffs2_bbc_print1("jffs2.bbc: FASTS compression mode activated.\n"); -+ jffs2_bbc_free(buffer); -+ return count; -+ } -+ -+ jffs2_bbc_print1("jffs2.bbc: unkown command. Valid commands are:\n" -+ " z = switch to ZLIB compression mode\n" -+ " s = switch to SIZE compression mode\n" -+ " d = switch to DUMMY compression mode\n" -+ " fr = switch to FASTR compression mode\n" -+ " fw = switch to FASTW compression mode\n" -+ " fs = switch to FASTS compression mode\n" -+ " r = reread model files from actual file system\n" -+ " m:compressor_name = switch to MANUAL compression mode\n" -+ " 0:compressor_name = disable a compressor\n" -+ " 1:compressor_name = enable a compressor\n" -+ " c:compressor_name:command = enable a compressor\n"); -+ jffs2_bbc_free(buffer); -+ return count; -+} -+ -+void jffs2_bbc_proc_init() -+{ -+ struct proc_dir_entry *res = create_proc_entry("jffs2_bbc", 0, NULL); -+ jffs2_bbc_compressor_init(); -+ if (res) { -+ res->read_proc = jffs2_bbc_proc_read; -+ res->write_proc = jffs2_bbc_proc_write; -+ } -+} -+ -+void jffs2_bbc_proc_deinit() -+{ -+ jffs2_bbc_compressor_deinit(); -+ remove_proc_entry("jffs2_bbc", NULL); -+} -diff -Nur linux-mips-cvs/fs/jffs2/jffs2_bbc_fs.h linux-mips/fs/jffs2/jffs2_bbc_fs.h ---- linux-mips-cvs/fs/jffs2/jffs2_bbc_fs.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-mips/fs/jffs2/jffs2_bbc_fs.h 2005-02-07 05:08:34.000000000 +0100 -@@ -0,0 +1,30 @@ -+/* -+ * JFFS2 BBC: File System Extension for Linux Kernel - headers -+ * -+ * $Id$ -+ * -+ * Copyright (C) 2004, Ferenc Havasi -+ * -+ * 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. -+ * -+ */ -+ -+extern int jffs2_bbc_inode_not_found; -+ -+void jffs2_bbc_load_model(void *sb); -+void jffs2_bbc_unload_model(void *sb); -+ -+void jffs2_bbc_proc_init(void); -+void jffs2_bbc_proc_deinit(void); -diff -Nur linux-mips-cvs/fs/jffs2/jffs2_bbc_lzari_comp.c linux-mips/fs/jffs2/jffs2_bbc_lzari_comp.c ---- linux-mips-cvs/fs/jffs2/jffs2_bbc_lzari_comp.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-mips/fs/jffs2/jffs2_bbc_lzari_comp.c 2005-02-07 05:08:34.000000000 +0100 -@@ -0,0 +1,788 @@ -+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ -+ -+/* -+ jffs2_bbc_lzari_comp.c -- Lempel-Ziv-Arithmetic coding compression module for jffs2 -+ Copyright (C) 2004 Patrik Kluba -+ Based on the LZARI source included in LDS (lossless datacompression sources) -+ Block-compression and bitstream modifications by Patrik Kluba -+ $Header$ -+*/ -+ -+/* -+Original copyright follows: -+ -+************************************************************** -+ LZARI.C -- A Data Compression Program -+ (tab = 4 spaces) -+************************************************************** -+ 4/7/1989 Haruhiko Okumura -+ Use, distribute, and modify this program freely. -+ Please send me your improved versions. -+ PC-VAN SCIENCE -+ NIFTY-Serve PAF01022 -+ CompuServe 74050,1022 -+************************************************************** -+ -+LZARI.C (c)1989 by Haruyasu Yoshizaki, Haruhiko Okumura, and Kenji Rikitake. -+All rights reserved. Permission granted for non-commercial use. -+ -+*/ -+ -+/* -+ -+ 2004-02-18 pajko -+ Removed unused variables and fixed no return value -+ -+ 2004-02-16 pajko -+ Initial release -+ -+*/ -+ -+/* lzari.c */ -+ -+#define N 4096 /* size of ring buffer */ -+#define F 60 /* upper limit for match_length */ -+#define THRESHOLD 2 /* encode string into position and length -+ if match_length is greater than this */ -+#define NIL N /* index for root of binary search trees */ -+ -+static unsigned char -+ text_buf[N + F - 1]; /* ring buffer of size N, -+ with extra F-1 bytes to facilitate string comparison */ -+static unsigned long match_position, match_length, /* of longest match. These are -+ set by the InsertNode() procedure. */ -+ lson[N + 1], rson[N + 257], dad[N + 1]; /* left & right children & -+ parents -- These constitute binary search trees. */ -+ -+static void InitTree(void) /* Initialize trees */ -+{ -+ unsigned long i; -+ -+ /* For i = 0 to N - 1, rson[i] and lson[i] will be the right and -+ left children of node i. These nodes need not be initialized. -+ Also, dad[i] is the parent of node i. These are initialized to -+ NIL (= N), which stands for 'not used.' -+ For i = 0 to 255, rson[N + i + 1] is the root of the tree -+ for strings that begin with character i. These are initialized -+ to NIL. Note there are 256 trees. */ -+ -+ for (i = N + 1; i <= N + 256; i++) rson[i] = NIL; /* root */ -+ for (i = 0; i < N; i++) dad[i] = NIL; /* node */ -+} -+ -+static void InsertNode(unsigned long r) -+ /* Inserts string of length F, text_buf[r..r+F-1], into one of the -+ trees (text_buf[r]'th tree) and returns the longest-match position -+ and length via the global variables match_position and match_length. -+ If match_length = F, then removes the old node in favor of the new -+ one, because the old one will be deleted sooner. -+ Note r plays double role, as tree node and position in buffer. */ -+{ -+ unsigned long i, p, temp; -+ unsigned char *key; -+ signed long cmp; -+ -+ cmp = 1; key = &text_buf[r]; p = N + 1 + key[0]; -+ rson[r] = lson[r] = NIL; match_length = 0; -+ for ( ; ; ) { -+ if (cmp >= 0) { -+ if (rson[p] != NIL) p = rson[p]; -+ else { rson[p] = r; dad[r] = p; return; } -+ } else { -+ if (lson[p] != NIL) p = lson[p]; -+ else { lson[p] = r; dad[r] = p; return; } -+ } -+ for (i = 1; i < F; i++) -+ if ((cmp = key[i] - text_buf[p + i]) != 0) break; -+ if (i > THRESHOLD) { -+ if (i > match_length) { -+ match_position = (r - p) & (N - 1); -+ if ((match_length = i) >= F) break; -+ } else if (i == match_length) { -+ if ((temp = (r - p) & (N - 1)) < match_position) -+ match_position = temp; -+ } -+ } -+ } -+ dad[r] = dad[p]; lson[r] = lson[p]; rson[r] = rson[p]; -+ dad[lson[p]] = r; dad[rson[p]] = r; -+ if (rson[dad[p]] == p) rson[dad[p]] = r; -+ else lson[dad[p]] = r; -+ dad[p] = NIL; /* remove p */ -+} -+ -+static void DeleteNode(unsigned long p) /* Delete node p from tree */ -+{ -+ unsigned long q; -+ -+ if (dad[p] == NIL) return; /* not in tree */ -+ if (rson[p] == NIL) q = lson[p]; -+ else if (lson[p] == NIL) q = rson[p]; -+ else { -+ q = lson[p]; -+ if (rson[q] != NIL) { -+ do { q = rson[q]; } while (rson[q] != NIL); -+ rson[dad[q]] = lson[q]; dad[lson[q]] = dad[q]; -+ lson[q] = lson[p]; dad[lson[p]] = q; -+ } -+ rson[q] = rson[p]; dad[rson[p]] = q; -+ } -+ dad[q] = dad[p]; -+ if (rson[dad[p]] == p) rson[dad[p]] = q; -+ else lson[dad[p]] = q; -+ dad[p] = NIL; -+} -+ -+/********** Arithmetic Compression **********/ -+ -+/* If you are not familiar with arithmetic compression, you should read -+ I. E. Witten, R. M. Neal, and J. G. Cleary, -+ Communications of the ACM, Vol. 30, pp. 520-540 (1987), -+ from which much have been borrowed. */ -+ -+#define M 15 -+ -+/* Q1 (= 2 to the M) must be sufficiently large, but not so -+ large as the unsigned long 4 * Q1 * (Q1 - 1) overflows. */ -+ -+#define Q1 (1UL << M) -+#define Q2 (2 * Q1) -+#define Q3 (3 * Q1) -+#define Q4 (4 * Q1) -+#define MAX_CUM (Q1 - 1) -+ -+#define N_CHAR (256 - THRESHOLD + F) -+ /* character code = 0, 1, ..., N_CHAR - 1 */ -+ -+static unsigned long char_to_sym[N_CHAR], sym_to_char[N_CHAR + 1]; -+static unsigned long -+ sym_freq[N_CHAR + 1], /* frequency for symbols */ -+ sym_cum[N_CHAR + 1], /* cumulative freq for symbols */ -+ position_cum[N + 1]; /* cumulative freq for positions */ -+ -+static void StartModel(void) /* Initialize model */ -+{ -+ unsigned long ch, sym, i; -+ -+ sym_cum[N_CHAR] = 0; -+ for (sym = N_CHAR; sym >= 1; sym--) { -+ ch = sym - 1; -+ char_to_sym[ch] = sym; sym_to_char[sym] = ch; -+ sym_freq[sym] = 1; -+ sym_cum[sym - 1] = sym_cum[sym] + sym_freq[sym]; -+ } -+ sym_freq[0] = 0; /* sentinel (!= sym_freq[1]) */ -+ position_cum[N] = 0; -+ for (i = N; i >= 1; i--) -+ position_cum[i - 1] = position_cum[i] + 10000 / (i + 200); -+ /* empirical distribution function (quite tentative) */ -+ /* Please devise a better mechanism! */ -+} -+ -+static void UpdateModel(unsigned long sym) -+{ -+ unsigned long c, ch_i, ch_sym; -+ unsigned long i; -+ if (sym_cum[0] >= MAX_CUM) { -+ c = 0; -+ for (i = N_CHAR; i > 0; i--) { -+ sym_cum[i] = c; -+ c += (sym_freq[i] = (sym_freq[i] + 1) >> 1); -+ } -+ sym_cum[0] = c; -+ } -+ for (i = sym; sym_freq[i] == sym_freq[i - 1]; i--) ; -+ if (i < sym) { -+ ch_i = sym_to_char[i]; ch_sym = sym_to_char[sym]; -+ sym_to_char[i] = ch_sym; sym_to_char[sym] = ch_i; -+ char_to_sym[ch_i] = sym; char_to_sym[ch_sym] = i; -+ } -+ sym_freq[i]++; -+ while (--i > 0) sym_cum[i]++; -+ sym_cum[0]++; -+} -+ -+static unsigned long BinarySearchSym(unsigned long x) -+ /* 1 if x >= sym_cum[1], -+ N_CHAR if sym_cum[N_CHAR] > x, -+ i such that sym_cum[i - 1] > x >= sym_cum[i] otherwise */ -+{ -+ unsigned long i, j, k; -+ -+ i = 1; j = N_CHAR; -+ while (i < j) { -+ k = (i + j) / 2; -+ if (sym_cum[k] > x) i = k + 1; else j = k; -+ } -+ return i; -+} -+ -+unsigned long BinarySearchPos(unsigned long x) -+ /* 0 if x >= position_cum[1], -+ N - 1 if position_cum[N] > x, -+ i such that position_cum[i] > x >= position_cum[i + 1] otherwise */ -+{ -+ unsigned long i, j, k; -+ -+ i = 1; j = N; -+ while (i < j) { -+ k = (i + j) / 2; -+ if (position_cum[k] > x) i = k + 1; else j = k; -+ } -+ return i - 1; -+} -+ -+/* modified for block compression */ -+/* on return, srclen will contain the number of successfully compressed bytes -+ and dstlen will contain completed compressed bytes */ -+ -+static int Encode(unsigned char *srcbuf, unsigned char *dstbuf, unsigned long *srclen, -+ unsigned long *dstlen) -+{ -+ unsigned long c, i, len, r, s, last_match_length, sym, range; -+ unsigned long low = 0; -+ unsigned long high = Q4; -+ unsigned long shifts = 0; /* counts for magnifying low and high around Q2 */ -+ unsigned char *ip, *op; -+ unsigned long written = 0; -+ unsigned long read = 0; -+ unsigned char buffer = 0; -+ unsigned char mask = 128; -+ unsigned char *srcend = srcbuf + *srclen; -+ unsigned char *dstend = dstbuf + *dstlen; -+ ip = srcbuf; -+ op = dstbuf; -+ StartModel(); -+ InitTree(); /* initialize trees */ -+ s = 0; r = N - F; -+ for (i = s; i < r; i++) text_buf[i] = ' '; /* Clear the buffer with -+ any character that will appear often. */ -+ for (len = 0; (len < F) && (ip < srcend); len++) -+ text_buf[r + len] = *(ip++); /* Read F bytes into the last F bytes of -+ the buffer */ -+ read = len; -+ for (i = 1; i <= F; i++) InsertNode(r - i); /* Insert the F strings, -+ each of which begins with one or more 'space' characters. Note -+ the order in which these strings are inserted. This way, -+ degenerate trees will be less likely to occur. */ -+ InsertNode(r); /* Finally, insert the whole string just read. The -+ global variables match_length and match_position are set. */ -+ do { -+ if (match_length > len) match_length = len; /* match_length -+ may be spuriously long near the end of text. */ -+ if (match_length <= THRESHOLD) { -+ match_length = 1; /* Not long enough match. Send one byte. */ -+ sym = char_to_sym[text_buf[r]]; -+ range = high - low; -+ high = low + (range * sym_cum[sym - 1]) / sym_cum[0]; -+ low += (range * sym_cum[sym ]) / sym_cum[0]; -+ for ( ; ; ) { -+ if (high <= Q2) { -+ if ((mask >>= 1) == 0) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = buffer; -+ buffer = 0; -+ mask = 128; -+ written++; -+ *srclen = read; -+ } -+ for ( ; shifts > 0; shifts--) { -+ buffer |= mask; -+ if ((mask >>= 1) == 0) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = buffer; -+ buffer = 0; -+ mask = 128; -+ written++; -+ *srclen = read; -+ } -+ } -+ } else if (low >= Q2) { -+ buffer |= mask; -+ if ((mask >>= 1) == 0) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = buffer; -+ buffer = 0; -+ mask = 128; -+ written++; -+ *srclen = read; -+ } -+ for ( ; shifts > 0; shifts--) { -+ if ((mask >>= 1) == 0) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = buffer; -+ buffer = 0; -+ mask = 128; -+ written++; -+ *srclen = read; -+ } -+ } -+ low -= Q2; -+ high -= Q2; -+ } else if (low >= Q1 && high <= Q3) { -+ shifts++; -+ low -= Q1; -+ high -= Q1; -+ } else break; -+ low += low; high += high; -+ } -+ UpdateModel(sym); -+ } else { -+ sym = char_to_sym[255 - THRESHOLD + match_length]; -+ range = high - low; -+ high = low + (range * sym_cum[sym - 1]) / sym_cum[0]; -+ low += (range * sym_cum[sym ]) / sym_cum[0]; -+ for ( ; ; ) { -+ if (high <= Q2) { -+ if ((mask >>= 1) == 0) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = buffer; -+ buffer = 0; -+ mask = 128; -+ written++; -+ *srclen = read; -+ } -+ for ( ; shifts > 0; shifts--) { -+ buffer |= mask; -+ if ((mask >>= 1) == 0) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = buffer; -+ buffer = 0; -+ mask = 128; -+ written++; -+ *srclen = read; -+ } -+ } -+ } else if (low >= Q2) { -+ buffer |= mask; -+ if ((mask >>= 1) == 0) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = buffer; -+ buffer = 0; -+ mask = 128; -+ written++; -+ *srclen = read; -+ } -+ for ( ; shifts > 0; shifts--) { -+ if ((mask >>= 1) == 0) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = buffer; -+ buffer = 0; -+ mask = 128; -+ written++; -+ *srclen = read; -+ } -+ } -+ low -= Q2; -+ high -= Q2; -+ } else if (low >= Q1 && high <= Q3) { -+ shifts++; -+ low -= Q1; -+ high -= Q1; -+ } else break; -+ low += low; high += high; -+ } -+ UpdateModel(sym); -+ range = high - low; -+ high = low + (range * position_cum[match_position - 1]) / position_cum[0]; -+ low += (range * position_cum[match_position ]) / position_cum[0]; -+ for ( ; ; ) { -+ if (high <= Q2) { -+ if ((mask >>= 1) == 0) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = buffer; -+ buffer = 0; -+ mask = 128; -+ written++; -+ *srclen = read; -+ } -+ for ( ; shifts > 0; shifts--) { -+ buffer |= mask; -+ if ((mask >>= 1) == 0) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = buffer; -+ buffer = 0; -+ mask = 128; -+ written++; -+ *srclen = read; -+ } -+ } -+ } else { -+ if (low >= Q2) { -+ buffer |= mask; -+ if ((mask >>= 1) == 0) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = buffer; -+ buffer = 0; -+ mask = 128; -+ written++; -+ *srclen = read; -+ } -+ for ( ; shifts > 0; shifts--) { -+ if ((mask >>= 1) == 0) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = buffer; -+ buffer = 0; -+ mask = 128; -+ written++; -+ *srclen = read; -+ } -+ } -+ low -= Q2; -+ high -= Q2; -+ } else { -+ if ((low >= Q1) && (high <= Q3)) { -+ shifts++; -+ low -= Q1; -+ high -= Q1; -+ } else { -+ break; -+ } -+ } -+ } -+ low += low; -+ high += high; -+ } -+ } -+ last_match_length = match_length; -+ for (i = 0; (i < last_match_length) && (ip < srcend); i++) { -+ c = *(ip++); -+ DeleteNode(s); -+ text_buf[s] = c; -+ if (s < F - 1) -+ text_buf[s + N] = c; -+ s = (s + 1) & (N - 1); -+ r = (r + 1) & (N - 1); -+ InsertNode(r); -+ } -+ read += i; -+ while (i++ < last_match_length) { -+ DeleteNode(s); -+ s = (s + 1) & (N - 1); -+ r = (r + 1) & (N - 1); -+ if (--len) InsertNode(r); -+ } -+ } while (len > 0); -+ shifts++; -+ if (low < Q1) { -+ if ((mask >>= 1) == 0) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = buffer; -+ buffer = 0; -+ mask = 128; -+ written++; -+ *srclen = read; -+ } -+ for ( ; shifts > 0; shifts--) { -+ buffer |= mask; -+ if ((mask >>= 1) == 0) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = buffer; -+ buffer = 0; -+ mask = 128; -+ written++; -+ *srclen = read; -+ } -+ } -+ } else { -+ buffer |= mask; -+ if ((mask >>= 1) == 0) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = buffer; -+ buffer = 0; -+ mask = 128; -+ written++; -+ *srclen = read; -+ } -+ for ( ; shifts > 0; shifts--) { -+ if ((mask >>= 1) == 0) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = buffer; -+ buffer = 0; -+ mask = 128; -+ written++; -+ *srclen = read; -+ } -+ } -+ } -+ for (i = 0; i < 7; i++) { -+ if ((mask >>= 1) == 0) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = buffer; -+ buffer = 0; -+ mask = 128; -+ written++; -+ *srclen = read; -+ } -+ } -+ *dstlen = written; -+ return 0; -+} -+ -+static int Decode(unsigned char *srcbuf, unsigned char *dstbuf, unsigned long srclen, -+ unsigned long dstlen) /* Just the reverse of Encode(). */ -+{ -+ unsigned long i, r, j, k, c, range, sym; -+ unsigned char *ip, *op; -+ unsigned char *srcend = srcbuf + srclen; -+ unsigned char *dstend = dstbuf + dstlen; -+ unsigned char buffer = 0; -+ unsigned char mask = 0; -+ unsigned long low = 0; -+ unsigned long high = Q4; -+ unsigned long value = 0; -+ ip = srcbuf; -+ op = dstbuf; -+ for (i = 0; i < M + 2; i++) { -+ value *= 2; -+ if ((mask >>= 1) == 0) { -+ buffer = (ip >= srcend) ? 0 : *(ip++); -+ mask = 128; -+ } -+ value += ((buffer & mask) != 0); -+ } -+ StartModel(); -+ for (i = 0; i < N - F; i++) text_buf[i] = ' '; -+ r = N - F; -+ while (op < dstend) { -+ range = high - low; -+ sym = BinarySearchSym((unsigned long) -+ (((value - low + 1) * sym_cum[0] - 1) / range)); -+ high = low + (range * sym_cum[sym - 1]) / sym_cum[0]; -+ low += (range * sym_cum[sym ]) / sym_cum[0]; -+ for ( ; ; ) { -+ if (low >= Q2) { -+ value -= Q2; low -= Q2; high -= Q2; -+ } else if (low >= Q1 && high <= Q3) { -+ value -= Q1; low -= Q1; high -= Q1; -+ } else if (high > Q2) break; -+ low += low; high += high; -+ value *= 2; -+ if ((mask >>= 1) == 0) { -+ buffer = (ip >= srcend) ? 0 : *(ip++); -+ mask = 128; -+ } -+ value += ((buffer & mask) != 0); -+ } -+ c = sym_to_char[sym]; -+ UpdateModel(sym); -+ if (c < 256) { -+ if (op >= dstend) return -1; -+ *(op++) = c; -+ text_buf[r++] = c; -+ r &= (N - 1); -+ } else { -+ j = c - 255 + THRESHOLD; -+ range = high - low; -+ i = BinarySearchPos((unsigned long) -+ (((value - low + 1) * position_cum[0] - 1) / range)); -+ high = low + (range * position_cum[i ]) / position_cum[0]; -+ low += (range * position_cum[i + 1]) / position_cum[0]; -+ for ( ; ; ) { -+ if (low >= Q2) { -+ value -= Q2; low -= Q2; high -= Q2; -+ } else if (low >= Q1 && high <= Q3) { -+ value -= Q1; low -= Q1; high -= Q1; -+ } else if (high > Q2) break; -+ low += low; high += high; -+ value *= 2; -+ if ((mask >>= 1) == 0) { -+ buffer = (ip >= srcend) ? 0 : *(ip++); -+ mask = 128; -+ } -+ value += ((buffer & mask) != 0); -+ } -+ i = (r - i - 1) & (N - 1); -+ for (k = 0; k < j; k++) { -+ c = text_buf[(i + k) & (N - 1)]; -+ if (op >= dstend) return -1; -+ *(op++) = c; -+ text_buf[r++] = c; -+ r &= (N - 1); -+ } -+ } -+ } -+ return 0; -+} -+ -+/* interface to jffs2 bbc follows */ -+ -+#include "jffs2_bbc_framework.h" -+ -+#define JFFS2_BBC_LZARI_BLOCK_SIGN {0x73, 0x9a, 0x1c, 0x4d} -+ -+static int -+jffs2_bbc_lzari_compressor_init (void); -+ -+static void -+jffs2_bbc_lzari_compressor_deinit (void); -+ -+static int -+jffs2_bbc_lzari_compress (void *model, unsigned char *input, -+ unsigned char *output, unsigned long *sourcelen, -+ unsigned long *dstlen); -+ -+static int -+jffs2_bbc_lzari_estimate (void *model, unsigned char *input, -+ unsigned long sourcelen, unsigned long *dstlen, -+ unsigned long *readtime, unsigned long *writetime); -+ -+static int -+jffs2_bbc_lzari_decompress (void *model, unsigned char *input, -+ unsigned char *output, unsigned long sourcelen, -+ unsigned long dstlen); -+ -+static char * -+jffs2_bbc_lzari_proc_info (void); -+ -+static int -+jffs2_bbc_lzari_proc_command (char *command); -+ -+struct jffs2_bbc_compressor_type jffs2_bbc_lzari = { -+ "lzari", -+ 0, -+ JFFS2_BBC_LZARI_BLOCK_SIGN, -+ jffs2_bbc_lzari_compressor_init, -+ NULL, -+ NULL, -+ jffs2_bbc_lzari_compressor_deinit, -+ jffs2_bbc_lzari_compress, -+ jffs2_bbc_lzari_estimate, -+ jffs2_bbc_lzari_decompress, -+ jffs2_bbc_lzari_proc_info, -+ jffs2_bbc_lzari_proc_command -+}; -+ -+static int -+jffs2_bbc_lzari_compressor_init (void) -+{ -+ return 0; -+} -+ -+static void -+jffs2_bbc_lzari_compressor_deinit (void) -+{ -+} -+ -+static int -+jffs2_bbc_lzari_compress (void *model, unsigned char *input, -+ unsigned char *output, unsigned long *sourcelen, -+ unsigned long *dstlen) -+{ -+ int retval; -+ unsigned long dst = *dstlen; -+ *(output++) = jffs2_bbc_lzari.block_sign[0]; -+ *(output++) = jffs2_bbc_lzari.block_sign[1]; -+ dst -= 2; -+ retval = Encode(input, output, sourcelen, &dst); -+ dst += 2; -+ *dstlen = dst; -+ return retval; -+} -+ -+static int -+jffs2_bbc_lzari_estimate (void *model, unsigned char *input, -+ unsigned long sourcelen, unsigned long *dstlen, -+ unsigned long *readtime, unsigned long *writetime) -+{ -+ *dstlen = sourcelen / 2; -+ *readtime = JFFS2_BBC_ZLIB_READ_TIME * 15; -+ *writetime = JFFS2_BBC_ZLIB_WRITE_TIME * 7; -+ return 0; -+} -+ -+static int -+jffs2_bbc_lzari_decompress (void *model, unsigned char *input, -+ unsigned char *output, unsigned long sourcelen, -+ unsigned long dstlen) -+{ -+ if ( ( *(input++) != (unsigned char)jffs2_bbc_lzari.block_sign[0] ) || -+ ( *(input++) != (unsigned char)jffs2_bbc_lzari.block_sign[1] ) -+ ) { -+ return -1; -+ } else { -+ return Decode(input, output, sourcelen - 2, dstlen); -+ } -+} -+ -+static char * -+jffs2_bbc_lzari_proc_info (void) -+{ -+ return "Lempel-Ziv-Arithmetic coding compression module"; -+} -+ -+static int -+jffs2_bbc_lzari_proc_command (char *command) -+{ -+ return 0; -+} -+ -+struct jffs2_bbc_compressor_type * -+jffs2_bbc_lzari_init (int mode) -+{ -+ if (jffs2_bbc_register_compressor (&jffs2_bbc_lzari) == 0) -+ { -+ return &jffs2_bbc_lzari; -+ } -+ else -+ { -+ return NULL; -+ } -+} -+ -+void -+jffs2_bbc_lzari_deinit (void) -+{ -+ jffs2_bbc_unregister_compressor (&jffs2_bbc_lzari); -+} -diff -Nur linux-mips-cvs/fs/jffs2/jffs2_bbc_lzhd_comp.c linux-mips/fs/jffs2/jffs2_bbc_lzhd_comp.c ---- linux-mips-cvs/fs/jffs2/jffs2_bbc_lzhd_comp.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-mips/fs/jffs2/jffs2_bbc_lzhd_comp.c 2005-02-07 05:08:34.000000000 +0100 -@@ -0,0 +1,747 @@ -+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ -+ -+/* -+ jffs2_bbc_lzhd_comp.c -- Lempel-Ziv-(dynamic) Huffman compression module for jffs2 -+ Copyright (C) 2004 Patrik Kluba -+ Based on the LZHUF source included in LDS (lossless datacompression sources) -+ Block-compression and bitstream modifications by Patrik Kluba -+ $Header$ -+*/ -+ -+/* -+Original copyright follows: -+ -+************************************************************** -+ lzhuf.c -+ written by Haruyasu Yoshizaki 11/20/1988 -+ some minor changes 4/6/1989 -+ comments translated by Haruhiko Okumura 4/7/1989 -+************************************************************** -+ -+LZHUF.C (c)1989 by Haruyasu Yoshizaki, Haruhiko Okumura, and Kenji Rikitake. -+All rights reserved. Permission granted for non-commercial use. -+ -+*/ -+ -+/* -+ -+ 2004-02-18 pajko -+ Replaced name lzh-d with lzhd -+ Fixed no return value -+ -+ 2004-02-16 pajko -+ Initial release -+ -+*/ -+ -+/* required because of memmove */ -+#ifndef __KERNEL__ -+ #include -+#else -+ #include -+#endif -+ -+/* lzhuf.c */ -+ -+#define N 4096 /* size of ring buffer */ -+#define F 60 /* upper limit for match_length */ -+#define THRESHOLD 2 /* encode string into position and length -+ if match_length is greater than this */ -+#define NIL N /* index for root of binary search trees */ -+ -+static unsigned char -+ text_buf[N + F - 1]; /* ring buffer of size N, -+ with extra F-1 bytes to facilitate string comparison */ -+static unsigned long match_position, match_length, /* of longest match. These are -+ set by the InsertNode() procedure. */ -+ lson[N + 1], rson[N + 257], dad[N + 1]; /* left & right children & -+ parents -- These constitute binary search trees. */ -+ -+static void InitTree(void) /* initialize trees */ -+{ -+ unsigned long i; -+ -+ /* For i = 0 to N - 1, rson[i] and lson[i] will be the right and -+ left children of node i. These nodes need not be initialized. -+ Also, dad[i] is the parent of node i. These are initialized to -+ NIL (= N), which stands for 'not used.' -+ For i = 0 to 255, rson[N + i + 1] is the root of the tree -+ for strings that begin with character i. These are initialized -+ to NIL. Note there are 256 trees. */ -+ -+ for (i = N + 1; i <= N + 256; i++) rson[i] = NIL; -+ for (i = 0; i < N; i++) dad[i] = NIL; -+} -+ -+static void InsertNode(unsigned long r) -+ /* Inserts string of length F, text_buf[r..r+F-1], into one of the -+ trees (text_buf[r]'th tree) and returns the longest-match position -+ and length via the global variables match_position and match_length. -+ If match_length = F, then removes the old node in favor of the new -+ one, because the old one will be deleted sooner. -+ Note r plays double role, as tree node and position in buffer. */ -+{ -+ unsigned long i, p, c; -+ signed long cmp; -+ unsigned char *key; -+ -+ cmp = 1; key = &text_buf[r]; p = N + 1 + key[0]; -+ rson[r] = lson[r] = NIL; match_length = 0; -+ for ( ; ; ) { -+ if (cmp >= 0) { -+ if (rson[p] != NIL) p = rson[p]; -+ else { rson[p] = r; dad[r] = p; return; } -+ } else { -+ if (lson[p] != NIL) p = lson[p]; -+ else { lson[p] = r; dad[r] = p; return; } -+ } -+ for (i = 1; i < F; i++) -+ if ((cmp = key[i] - text_buf[p + i]) != 0) break; -+ if (i > THRESHOLD) { -+ if (i > match_length) { -+ match_position = ((r - p) & (N - 1)) - 1; -+ if ((match_length = i) >= F) break; -+ } -+ if (i == match_length) { -+ if ((c = ((r - p) & (N - 1)) - 1) < match_position) { -+ match_position = c; -+ } -+ } -+ } -+ } -+ dad[r] = dad[p]; lson[r] = lson[p]; rson[r] = rson[p]; -+ dad[lson[p]] = r; dad[rson[p]] = r; -+ if (rson[dad[p]] == p) rson[dad[p]] = r; -+ else lson[dad[p]] = r; -+ dad[p] = NIL; /* remove p */ -+} -+ -+static void DeleteNode(unsigned long p) /* deletes node p from tree */ -+{ -+ unsigned long q; -+ -+ if (dad[p] == NIL) return; /* not in tree */ -+ if (rson[p] == NIL) q = lson[p]; -+ else if (lson[p] == NIL) q = rson[p]; -+ else { -+ q = lson[p]; -+ if (rson[q] != NIL) { -+ do { q = rson[q]; } while (rson[q] != NIL); -+ rson[dad[q]] = lson[q]; dad[lson[q]] = dad[q]; -+ lson[q] = lson[p]; dad[lson[p]] = q; -+ } -+ rson[q] = rson[p]; dad[rson[p]] = q; -+ } -+ dad[q] = dad[p]; -+ if (rson[dad[p]] == p) rson[dad[p]] = q; else lson[dad[p]] = q; -+ dad[p] = NIL; -+} -+ -+/* Huffman coding */ -+ -+#define N_CHAR (256 - THRESHOLD + F) -+ /* kinds of characters (character code = 0..N_CHAR-1) */ -+#define T (N_CHAR * 2 - 1) /* size of table */ -+#define R (T - 1) /* position of root */ -+#define MAX_FREQ 0x8000 /* updates tree when the */ -+ /* root frequency comes to this value. */ -+ -+typedef unsigned long uchar; // much-much faster -+ -+/* table for encoding and decoding the upper 6 bits of position */ -+ -+/* for encoding */ -+static uchar p_len[64] = { -+ 0x03, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, -+ 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, -+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, -+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, -+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, -+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, -+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, -+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 -+}; -+ -+static uchar p_code[64] = { -+ 0x00, 0x20, 0x30, 0x40, 0x50, 0x58, 0x60, 0x68, -+ 0x70, 0x78, 0x80, 0x88, 0x90, 0x94, 0x98, 0x9C, -+ 0xA0, 0xA4, 0xA8, 0xAC, 0xB0, 0xB4, 0xB8, 0xBC, -+ 0xC0, 0xC2, 0xC4, 0xC6, 0xC8, 0xCA, 0xCC, 0xCE, -+ 0xD0, 0xD2, 0xD4, 0xD6, 0xD8, 0xDA, 0xDC, 0xDE, -+ 0xE0, 0xE2, 0xE4, 0xE6, 0xE8, 0xEA, 0xEC, 0xEE, -+ 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, -+ 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF -+}; -+ -+/* for decoding */ -+static uchar d_code[256] = { -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, -+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, -+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, -+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, -+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, -+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, -+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, -+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, -+ 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, -+ 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, -+ 0x0C, 0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D, -+ 0x0E, 0x0E, 0x0E, 0x0E, 0x0F, 0x0F, 0x0F, 0x0F, -+ 0x10, 0x10, 0x10, 0x10, 0x11, 0x11, 0x11, 0x11, -+ 0x12, 0x12, 0x12, 0x12, 0x13, 0x13, 0x13, 0x13, -+ 0x14, 0x14, 0x14, 0x14, 0x15, 0x15, 0x15, 0x15, -+ 0x16, 0x16, 0x16, 0x16, 0x17, 0x17, 0x17, 0x17, -+ 0x18, 0x18, 0x19, 0x19, 0x1A, 0x1A, 0x1B, 0x1B, -+ 0x1C, 0x1C, 0x1D, 0x1D, 0x1E, 0x1E, 0x1F, 0x1F, -+ 0x20, 0x20, 0x21, 0x21, 0x22, 0x22, 0x23, 0x23, -+ 0x24, 0x24, 0x25, 0x25, 0x26, 0x26, 0x27, 0x27, -+ 0x28, 0x28, 0x29, 0x29, 0x2A, 0x2A, 0x2B, 0x2B, -+ 0x2C, 0x2C, 0x2D, 0x2D, 0x2E, 0x2E, 0x2F, 0x2F, -+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, -+ 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, -+}; -+ -+static uchar d_len[256] = { -+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, -+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, -+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, -+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, -+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, -+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, -+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, -+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, -+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, -+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, -+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, -+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, -+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, -+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, -+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, -+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, -+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, -+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, -+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, -+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, -+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, -+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, -+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, -+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, -+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, -+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, -+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, -+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, -+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, -+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, -+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, -+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, -+}; -+ -+static unsigned long freq[T + 1]; /* frequency table */ -+ -+static unsigned long prnt[T + N_CHAR]; /* pointers to parent nodes, except for the */ -+ /* elements [T..T + N_CHAR - 1] which are used to get */ -+ /* the positions of leaves corresponding to the codes. */ -+ -+static unsigned long son[T]; /* pointers to child nodes (son[], son[] + 1) */ -+ -+/* initialization of tree */ -+ -+static void StartHuff(void) -+{ -+ unsigned long i, j; -+ -+ for (i = 0; i < N_CHAR; i++) { -+ freq[i] = 1; -+ son[i] = i + T; -+ prnt[i + T] = i; -+ } -+ i = 0; j = N_CHAR; -+ while (j <= R) { -+ freq[j] = freq[i] + freq[i + 1]; -+ son[j] = i; -+ prnt[i] = prnt[i + 1] = j; -+ i += 2; j++; -+ } -+ freq[T] = 0xffff; -+ prnt[R] = 0; -+} -+ -+/* reconstruction of tree */ -+ -+static void reconst(void) -+{ -+ unsigned long f, l, i, j, k; -+ -+ /* collect leaf nodes in the first half of the table */ -+ /* and replace the freq by (freq + 1) / 2. */ -+ j = 0; -+ for (i = 0; i < T; i++) { -+ if (son[i] >= T) { -+ freq[j] = (freq[i] + 1) / 2; -+ son[j] = son[i]; -+ j++; -+ } -+ } -+ /* begin constructing tree by connecting sons */ -+ for (i = 0, j = N_CHAR; j < T; i += 2, j++) { -+ k = i + 1; -+ f = freq[j] = freq[i] + freq[k]; -+ for (k = j - 1; f < freq[k]; k--); -+ k++; -+ l = (j - k) * 2; -+ memmove(&freq[k + 1], &freq[k], l*sizeof(unsigned long)); -+ freq[k] = f; -+ memmove(&son[k + 1], &son[k], l*sizeof(unsigned long)); -+ son[k] = i; -+ } -+ /* connect prnt */ -+ for (i = 0; i < T; i++) { -+ if ((k = son[i]) >= T) { -+ prnt[k] = i; -+ } else { -+ prnt[k] = prnt[k + 1] = i; -+ } -+ } -+} -+ -+/* increment frequency of given code by one, and update tree */ -+ -+static void update(unsigned long c) -+{ -+ unsigned long i, j, k, l; -+ -+ if (freq[R] == MAX_FREQ) { -+ reconst(); -+ } -+ c = prnt[c + T]; -+ do { -+ k = ++freq[c]; -+ -+ /* if the order is disturbed, exchange nodes */ -+ if (k > freq[l = c + 1]) { -+ while (k > freq[++l]); -+ l--; -+ freq[c] = freq[l]; -+ freq[l] = k; -+ -+ i = son[c]; -+ prnt[i] = l; -+ if (i < T) prnt[i + 1] = l; -+ -+ j = son[l]; -+ son[l] = i; -+ -+ prnt[j] = c; -+ if (j < T) prnt[j + 1] = c; -+ son[c] = j; -+ -+ c = l; -+ } -+ } while (c = prnt[c]); /* repeat up to root */ -+} -+ -+/* modified for block compression */ -+/* on return, srclen will contain the number of successfully compressed bytes -+ and dstlen will contain completed compressed bytes */ -+ -+static int Encode(unsigned char *srcbuf, unsigned char *dstbuf, unsigned long *srclen, -+ unsigned long *dstlen) -+{ -+ unsigned long c, i, j, k, len, r, s, last_match_length, code_buf_ptr; -+ unsigned char code_buf[17], mask; -+ unsigned char *ip, *op; -+ unsigned long written = 0; -+ unsigned long read = 0; -+ unsigned short putbuf = 0; -+ uchar putlen = 0; -+ unsigned char *srcend = srcbuf + *srclen; -+ unsigned char *dstend = dstbuf + *dstlen; -+ ip = srcbuf; -+ op = dstbuf; -+ StartHuff(); -+ InitTree(); /* initialize trees */ -+ code_buf[0] = 0; /* code_buf[1..16] saves eight units of code, and -+ code_buf[0] works as eight flags, "1" representing that the unit -+ is an unencoded letter (1 byte), "0" a position-and-length pair -+ (2 bytes). Thus, eight units require at most 16 bytes of code. */ -+ code_buf_ptr = mask = 1; -+ s = 0; r = N - F; -+ for (i = s; i < r; i++) text_buf[i] = ' '; /* Clear the buffer with -+ any character that will appear often. */ -+ for (len = 0; (len < F) && (ip < srcend); len++) -+ text_buf[r + len] = *(ip++); /* Read F bytes into the last F bytes of -+ the buffer */ -+ read = len; -+ for (i = 1; i <= F; i++) InsertNode(r - i); /* Insert the F strings, -+ each of which begins with one or more 'space' characters. Note -+ the order in which these strings are inserted. This way, -+ degenerate trees will be less likely to occur. */ -+ InsertNode(r); /* Finally, insert the whole string just read. The -+ global variables match_length and match_position are set. */ -+ do { -+ if (match_length > len) match_length = len; /* match_length -+ may be spuriously long near the end of text. */ -+ if (match_length <= THRESHOLD) { -+ match_length = 1; /* Not long enough match. Send one byte. */ -+ c = text_buf[r]; -+ i = 0; j = 0; k = prnt[c + T]; -+ do { -+ i >>= 1; -+ /* if node's address is odd-numbered, choose bigger brother node */ -+ if (k & 1) i |= 0x8000; -+ j++; -+ } while ((k = prnt[k]) != R); -+ putbuf |= i >> putlen; -+ if ((putlen += j) >= 8) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = putbuf >> 8; -+ if ((putlen -= 8) >= 8) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = putbuf; -+ written += 2; -+ putlen -= 8; -+ putbuf = i << (j - putlen); /**warm**/ -+ } else { -+ putbuf <<= 8; -+ written++; -+ } -+ *srclen = read; -+ } -+ update(c); -+ } else { -+ c = 255 - THRESHOLD + match_length; -+ i = 0; j = 0; k = prnt[c + T]; -+ do { -+ i >>= 1; -+ /* if node's address is odd-numbered, choose bigger brother node */ -+ if (k & 1) i |= 0x8000; -+ j++; -+ } while ((k = prnt[k]) != R); -+ putbuf |= i >> putlen; -+ if ((putlen += j) >= 8) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = putbuf >> 8; -+ if ((putlen -= 8) >= 8) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = putbuf; -+ written += 2; -+ putlen -= 8; -+ putbuf = i << (j - putlen); /**warm**/ -+ } else { -+ putbuf <<= 8; -+ written++; -+ } -+ *srclen = read; -+ } -+ update(c); -+ j = p_len[match_position >> 6]; -+ i = p_code[match_position >> 6] << 8; -+ putbuf |= i >> putlen; -+ if ((putlen += j) >= 8) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = putbuf >> 8; -+ if ((putlen -= 8) >= 8) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = putbuf; -+ written += 2; -+ putlen -= 8; -+ putbuf = i << (j - putlen); /**hot**/ -+ } else { -+ putbuf <<= 8; -+ written++; -+ } -+ *srclen = read; -+ } -+ j = 6; -+ i = (match_position & 0x3f) << 10; -+ putbuf |= i >> putlen; -+ if ((putlen += j) >= 8) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = putbuf >> 8; -+ if ((putlen -= 8) >= 8) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = putbuf; -+ written += 2; -+ putlen -= 8; -+ putbuf = i << (j - putlen); /**hot**/ -+ } else { -+ putbuf <<= 8; -+ written++; -+ } -+ *srclen = read; -+ } -+ } -+ last_match_length = match_length; -+ for (i = 0; (i < last_match_length) && (ip < srcend); i++) { -+ c = *(ip++); -+ DeleteNode(s); -+ text_buf[s] = c; -+ if (s < F - 1) -+ text_buf[s + N] = c; -+ s = (s + 1) & (N - 1); -+ r = (r + 1) & (N - 1); -+ InsertNode(r); -+ } -+ read += i; -+ while (i++ < last_match_length) { -+ DeleteNode(s); -+ s = (s + 1) & (N - 1); -+ r = (r + 1) & (N - 1); -+ if (--len) InsertNode(r); -+ } -+ } while (len > 0); -+ if (putlen) { -+ if (op >= dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ *(op++) = putbuf >> 8; -+ written++; -+ *srclen = read; -+ } -+ *dstlen = written; -+ return 0; -+} -+ -+static int Decode(unsigned char *srcbuf, unsigned char *dstbuf, unsigned long srclen, -+ unsigned long dstlen) /* Just the reverse of Encode(). */ -+{ -+ unsigned long i, r, j, k, c; -+ unsigned char *ip, *op; -+ unsigned char *srcend = srcbuf + srclen; -+ unsigned char *dstend = dstbuf + dstlen; -+ unsigned short getbuf = 0; -+ uchar getlen = 0; -+ ip = srcbuf; -+ op = dstbuf; -+ StartHuff(); -+ for (i = 0; i < N - F; i++) text_buf[i] = ' '; -+ r = N - F; -+ while (op < dstend) { -+ c = son[R]; -+ /* travel from root to leaf, */ -+ /* choosing the smaller child node (son[]) if the read bit is 0, */ -+ /* the bigger (son[]+1} if 1 */ -+ while (c < T) { -+ while (getlen <= 8) { -+ unsigned short t; -+ t = (ip >= srcend) ? 0 : *(ip++); -+ getbuf |= t << (8 - getlen); -+ getlen += 8; -+ } -+ c += ((signed short)getbuf < 0); -+ getbuf <<= 1; -+ getlen--; -+ c = son[c]; -+ } -+ c -= T; -+ update(c); -+ if (c < 256) { -+ if (op >= dstend) return -1; -+ *(op++) = c; -+ text_buf[r++] = c; -+ r &= (N - 1); -+ } else { -+ j = c - 255 + THRESHOLD; -+ while (getlen <= 8) { -+ unsigned short t; -+ t = (ip >= srcend) ? 0 : *(ip++); -+ getbuf |= t << (8 - getlen); -+ getlen += 8; -+ } -+ i = getbuf >> 8; -+ getbuf <<= 8; -+ getlen -= 8; -+ c = d_code[i] << 6; -+ k = d_len[i]; -+ /* read lower 6 bits verbatim */ -+ k -= 2; -+ while (k--) { -+ while (getlen <= 8) { -+ unsigned short t; -+ t = (ip >= srcend) ? 0 : *(ip++); -+ getbuf |= t << (8 - getlen); -+ getlen += 8; -+ } -+ i = (i << 1) + ((signed short)getbuf < 0); -+ getbuf <<= 1; -+ getlen--; -+ } -+ i = c | (i & 0x3F); -+ i = r - i - 1; -+ i &= (N - 1); -+ for (k = 0; k < j; k++) { -+ c = text_buf[(i + k) & (N - 1)]; -+ if (op >= dstend) return -1; -+ *(op++) = c; -+ text_buf[r++] = c; -+ r &= (N - 1); -+ } -+ } -+ } -+ return 0; -+} -+ -+/* interface to jffs2 bbc follows */ -+ -+#include "jffs2_bbc_framework.h" -+ -+ -+#define JFFS2_BBC_LZHD_BLOCK_SIGN {0x3a, 0x98, 0xf7, 0xda} -+ -+static int -+jffs2_bbc_lzhd_compressor_init (void); -+ -+static void -+jffs2_bbc_lzhd_compressor_deinit (void); -+ -+static int -+jffs2_bbc_lzhd_compress (void *model, unsigned char *input, -+ unsigned char *output, unsigned long *sourcelen, -+ unsigned long *dstlen); -+ -+static int -+jffs2_bbc_lzhd_estimate (void *model, unsigned char *input, -+ unsigned long sourcelen, unsigned long *dstlen, -+ unsigned long *readtime, unsigned long *writetime); -+ -+static int -+jffs2_bbc_lzhd_decompress (void *model, unsigned char *input, -+ unsigned char *output, unsigned long sourcelen, -+ unsigned long dstlen); -+ -+static char * -+jffs2_bbc_lzhd_proc_info (void); -+ -+static int -+jffs2_bbc_lzhd_proc_command (char *command); -+ -+struct jffs2_bbc_compressor_type jffs2_bbc_lzhd = { -+ "lzhd", -+ 0, -+ JFFS2_BBC_LZHD_BLOCK_SIGN, -+ jffs2_bbc_lzhd_compressor_init, -+ NULL, -+ NULL, -+ jffs2_bbc_lzhd_compressor_deinit, -+ jffs2_bbc_lzhd_compress, -+ jffs2_bbc_lzhd_estimate, -+ jffs2_bbc_lzhd_decompress, -+ jffs2_bbc_lzhd_proc_info, -+ jffs2_bbc_lzhd_proc_command -+}; -+ -+static int -+jffs2_bbc_lzhd_compressor_init (void) -+{ -+ return 0; -+} -+ -+static void -+jffs2_bbc_lzhd_compressor_deinit (void) -+{ -+} -+ -+static int -+jffs2_bbc_lzhd_compress (void *model, unsigned char *input, -+ unsigned char *output, unsigned long *sourcelen, -+ unsigned long *dstlen) -+{ -+ int retval; -+ unsigned long dst = *dstlen; -+ *(output++) = jffs2_bbc_lzhd.block_sign[0]; -+ *(output++) = jffs2_bbc_lzhd.block_sign[1]; -+ dst -= 2; -+ retval = Encode(input, output, sourcelen, &dst); -+ dst += 2; -+ *dstlen = dst; -+ return retval; -+} -+ -+static int -+jffs2_bbc_lzhd_estimate (void *model, unsigned char *input, -+ unsigned long sourcelen, unsigned long *dstlen, -+ unsigned long *readtime, unsigned long *writetime) -+{ -+ *dstlen = sourcelen * 55 / 100; -+ *readtime = JFFS2_BBC_ZLIB_READ_TIME * 8; -+ *writetime = JFFS2_BBC_ZLIB_WRITE_TIME * 65 / 10; -+ return 0; -+} -+ -+static int -+jffs2_bbc_lzhd_decompress (void *model, unsigned char *input, -+ unsigned char *output, unsigned long sourcelen, -+ unsigned long dstlen) -+{ -+ if ( ( *(input++) != (unsigned char)jffs2_bbc_lzhd.block_sign[0] ) || -+ ( *(input++) != (unsigned char)jffs2_bbc_lzhd.block_sign[1] ) -+ ) { -+ return -1; -+ } else { -+ return Decode(input, output, sourcelen - 2, dstlen); -+ } -+} -+ -+static char * -+jffs2_bbc_lzhd_proc_info (void) -+{ -+ return "Lempel-Ziv-(dynamic) Huffman compression module"; -+} -+ -+static int -+jffs2_bbc_lzhd_proc_command (char *command) -+{ -+ return 0; -+} -+ -+struct jffs2_bbc_compressor_type * -+jffs2_bbc_lzhd_init (int mode) -+{ -+ if (jffs2_bbc_register_compressor (&jffs2_bbc_lzhd) == 0) -+ { -+ return &jffs2_bbc_lzhd; -+ } -+ else -+ { -+ return NULL; -+ } -+} -+ -+void -+jffs2_bbc_lzhd_deinit (void) -+{ -+ jffs2_bbc_unregister_compressor (&jffs2_bbc_lzhd); -+} -diff -Nur linux-mips-cvs/fs/jffs2/jffs2_bbc_lzo_comp.c linux-mips/fs/jffs2/jffs2_bbc_lzo_comp.c ---- linux-mips-cvs/fs/jffs2/jffs2_bbc_lzo_comp.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-mips/fs/jffs2/jffs2_bbc_lzo_comp.c 2005-02-07 05:08:34.000000000 +0100 -@@ -0,0 +1,2435 @@ -+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ -+ -+/* -+ jffs2_bbc_lzo_comp.c -- LZO1X-1 (and -999) compression module for jffs2 -+ Copyright (C) 2004 Patrik Kluba -+ Based on the original LZO sources -+ $Header$ -+*/ -+ -+/* -+ Original copyright notice follows: -+ -+ lzo1x_9x.c -- implementation of the LZO1X-999 compression algorithm -+ lzo_ptr.h -- low-level pointer constructs -+ lzo_swd.ch -- sliding window dictionary -+ lzoconf.h -- configuration for the LZO real-time data compression library -+ lzo_mchw.ch -- matching functions using a window -+ minilzo.c -- mini subset of the LZO real-time data compression library -+ config1x.h -- configuration for the LZO1X algorithm -+ lzo1x.h -- public interface of the LZO1X compression algorithm -+ -+ These files are part of the LZO real-time data compression library. -+ -+ Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer -+ All Rights Reserved. -+ -+ The LZO library 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. -+ -+ The LZO library 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 the LZO library; 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 -+ -+*/ -+ -+/* -+ -+ 2004-02-16 pajko -+ Initial release -+ -removed all 16 bit code -+ -all sensitive data will be on 4 byte boundary -+ -removed check parts for library use -+ -removed all but LZO1X-* compression -+ -+*/ -+ -+#ifndef __KERNEL__ -+ #include -+ #include -+ #include -+ #include -+#else -+ #include -+ #include -+ #include -+ #include -+ #define USHRT_MAX 65535 -+ /* #define UINT_MAX 4294967295U */ -+#endif -+ -+/* data type definitions */ -+#define U32 unsigned long -+#define S32 signed long -+#define I32 long -+#define U16 unsigned short -+#define S16 signed short -+#define I16 short -+#define U8 unsigned char -+#define S8 signed char -+#define I8 char -+ -+/*************************************/ -+ -+/* lzo_swd.ch */ -+ -+#define SWD_N N -+#define SWD_F F -+#define SWD_THRESHOLD THRESHOLD -+ -+/* shortest unsigned int that 2 * SWD_F + SWD_N (currently 53248) fits in */ -+typedef unsigned short swd_uint; -+/* upper limit of that data type */ -+#define SWD_UINT_MAX USHRT_MAX -+ -+/* minilzo.c */ -+ -+#define LZO_VERSION_DATE "Jul 12 2002" -+#define LZO_VERSION_STRING "1.08" -+#define LZO_VERSION 0x1080 -+ -+/* lzo_ptr.h */ -+ -+/* Integral types that have *exactly* the same number of bits as a lzo_voidp */ -+typedef unsigned long lzo_ptr_t; -+typedef long lzo_sptr_t; -+ -+ -+/*************************************/ -+ -+/* config1x.h */ -+ -+#define M1_MAX_OFFSET 0x0400 -+#define M2_MAX_OFFSET 0x0800 -+#define M3_MAX_OFFSET 0x4000 -+#define M4_MAX_OFFSET 0xbfff -+ -+#define MX_MAX_OFFSET (M1_MAX_OFFSET + M2_MAX_OFFSET) -+ -+#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 MIN_LOOKAHEAD (M2_MAX_LEN + 1) -+ -+/* minilzo.c */ -+ -+#define LZO_BYTE(x) ((unsigned char) ((x) & 0xff)) -+ -+#define LZO_MAX(a,b) ((a) >= (b) ? (a) : (b)) -+#define LZO_MIN(a,b) ((a) <= (b) ? (a) : (b)) -+#define LZO_MAX3(a,b,c) ((a) >= (b) ? LZO_MAX(a,c) : LZO_MAX(b,c)) -+#define LZO_MIN3(a,b,c) ((a) <= (b) ? LZO_MIN(a,c) : LZO_MIN(b,c)) -+ -+#define lzo_sizeof(type) ((lzo_uint) (sizeof(type))) -+ -+#define LZO_HIGH(array) ((lzo_uint) (sizeof(array)/sizeof(*(array)))) -+ -+#define LZO_SIZE(bits) (1u << (bits)) -+#define LZO_MASK(bits) (LZO_SIZE(bits) - 1) -+ -+#define LZO_LSIZE(bits) (1ul << (bits)) -+#define LZO_LMASK(bits) (LZO_LSIZE(bits) - 1) -+ -+#define LZO_USIZE(bits) ((lzo_uint) 1 << (bits)) -+#define LZO_UMASK(bits) (LZO_USIZE(bits) - 1) -+ -+#define LZO_STYPE_MAX(b) (((1l << (8*(b)-2)) - 1l) + (1l << (8*(b)-2))) -+#define LZO_UTYPE_MAX(b) (((1ul << (8*(b)-1)) - 1ul) + (1ul << (8*(b)-1))) -+ -+#define _LZO_STRINGIZE(x) #x -+#define _LZO_MEXPAND(x) _LZO_STRINGIZE(x) -+ -+#define _LZO_CONCAT2(a,b) a ## b -+#define _LZO_CONCAT3(a,b,c) a ## b ## c -+#define _LZO_CONCAT4(a,b,c,d) a ## b ## c ## d -+#define _LZO_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e -+ -+#define _LZO_ECONCAT2(a,b) _LZO_CONCAT2(a,b) -+#define _LZO_ECONCAT3(a,b,c) _LZO_CONCAT3(a,b,c) -+#define _LZO_ECONCAT4(a,b,c,d) _LZO_CONCAT4(a,b,c,d) -+#define _LZO_ECONCAT5(a,b,c,d,e) _LZO_CONCAT5(a,b,c,d,e) -+ -+#define lzo_dict_t const lzo_bytep -+#define lzo_dict_p lzo_dict_t * -+#define lzo_moff_t lzo_uint -+ -+#define MEMCPY8_DS(dest,src,len) \ -+ memcpy(dest,src,len); \ -+ dest += len; \ -+ src += len -+ -+#define MEMCPY_DS(dest,src,len) \ -+ do *dest++ = *src++; \ -+ while (--len > 0) -+ -+#define MEMMOVE_DS(dest,src,len) \ -+ do *dest++ = *src++; \ -+ while (--len > 0) -+ -+#define BZERO8_PTR(s,l,n) memset((s),0,(lzo_uint)(l)*(n)) -+ -+#define LZO_BASE 65521u -+#define LZO_NMAX 5552 -+ -+#define LZO_DO1(buf,i) {s1 += buf[i]; s2 += s1;} -+#define LZO_DO2(buf,i) LZO_DO1(buf,i); LZO_DO1(buf,i+1); -+#define LZO_DO4(buf,i) LZO_DO2(buf,i); LZO_DO2(buf,i+2); -+#define LZO_DO8(buf,i) LZO_DO4(buf,i); LZO_DO4(buf,i+4); -+#define LZO_DO16(buf,i) LZO_DO8(buf,i); LZO_DO8(buf,i+8); -+ -+#define IS_SIGNED(type) (((type) (-1)) < ((type) 0)) -+#define IS_UNSIGNED(type) (((type) (-1)) > ((type) 0)) -+ -+#define IS_POWER_OF_2(x) (((x) & ((x) - 1)) == 0) -+ -+#define D_BITS 14 -+#define D_INDEX1(d,p) d = DM((0x21*DX3(p,5,5,6)) >> 5) -+#define D_INDEX2(d,p) d = (d & (D_MASK & 0x7ff)) ^ (D_HIGH | 0x1f) -+ -+#define LZO_HASH LZO_HASH_LZO_INCREMENTAL_B -+ -+#define DL_MIN_LEN M2_MIN_LEN -+ -+#define D_SIZE LZO_SIZE(D_BITS) -+#define D_MASK LZO_MASK(D_BITS) -+ -+#define D_HIGH ((D_MASK >> 1) + 1) -+ -+#define DINDEX1 D_INDEX1 -+#define DINDEX2 D_INDEX2 -+ -+#define DX2(p,s1,s2) \ -+ (((((lzo_uint32)((p)[2]) << (s2)) ^ (p)[1]) << (s1)) ^ (p)[0]) -+ -+#define DX3(p,s1,s2,s3) ((DX2((p)+1,s2,s3) << (s1)) ^ (p)[0]) -+#define DMS(v,s) ((lzo_uint) (((v) & (D_MASK >> (s))) << (s))) -+#define DM(v) DMS(v,0) -+ -+#define DENTRY(p,in) (p) -+#define GINDEX(m_pos,m_off,dict,dindex,in) m_pos = dict[dindex] -+ -+#define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \ -+ (m_pos == NULL || (m_off = (lzo_moff_t) (ip - m_pos)) > max_offset) -+ -+#define LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,max_offset) \ -+ (BOUNDS_CHECKING_OFF_IN_EXPR( \ -+ (PTR_LT(m_pos,in) || \ -+ (m_off = (lzo_moff_t) PTR_DIFF(ip,m_pos)) <= 0 || \ -+ m_off > max_offset) )) -+ -+#define BOUNDS_CHECKING_OFF_IN_EXPR(expr) (expr) -+ -+#define DD_BITS 0 -+#define DD_SIZE LZO_SIZE(DD_BITS) -+#define DD_MASK LZO_MASK(DD_BITS) -+ -+#define DL_BITS (D_BITS - DD_BITS) -+#define DL_SIZE LZO_SIZE(DL_BITS) -+#define DL_MASK LZO_MASK(DL_BITS) -+ -+#define UPDATE_D(dict,drun,dv,p,in) dict[ DINDEX(dv,p) ] = DENTRY(p,in) -+#define UPDATE_I(dict,drun,index,p,in) dict[index] = DENTRY(p,in) -+#define UPDATE_P(ptr,drun,p,in) (ptr)[0] = DENTRY(p,in) -+ -+#define __COPY4(dst,src) * (lzo_uint32p)(dst) = * (const lzo_uint32p)(src) -+#define COPY4(dst,src) __COPY4((lzo_ptr_t)(dst),(lzo_ptr_t)(src)) -+ -+#define TEST_IP (ip < ip_end) -+#define TEST_OP (op <= op_end) -+ -+#define NEED_IP(x) \ -+ if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun -+#define NEED_OP(x) \ -+ if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun -+#define TEST_LOOKBEHIND(m_pos,out) if (m_pos < out) goto lookbehind_overrun -+ -+/* lzo1x_9x.c */ -+ -+#define LZO_UINT_MAX UINT_MAX -+#define N M4_MAX_OFFSET -+#define THRESHOLD 1 -+#define F 2048 -+ -+#define SWD_BEST_OFF (LZO_MAX3( M2_MAX_LEN, M3_MAX_LEN, M4_MAX_LEN ) + 1) -+ -+/* ../include/lzoconf.h */ -+ -+typedef U32 lzo_uint32; -+typedef I32 lzo_int32; -+typedef U32 lzo_uint; -+typedef I32 lzo_int; -+typedef int lzo_bool; -+ -+#define lzo_byte U8 -+#define lzo_bytep U8 * -+#define lzo_charp char * -+#define lzo_voidp void * -+#define lzo_shortp short * -+#define lzo_ushortp unsigned short * -+#define lzo_uint32p lzo_uint32 * -+#define lzo_int32p lzo_int32 * -+#define lzo_uintp lzo_uint * -+#define lzo_intp lzo_int * -+#define lzo_voidpp lzo_voidp * -+#define lzo_bytepp lzo_bytep * -+#define lzo_sizeof_dict_t sizeof(lzo_bytep) -+ -+#define LZO_E_OK 0 -+#define LZO_E_ERROR (-1) -+#define LZO_E_OUT_OF_MEMORY (-2) /* not used right now */ -+#define LZO_E_NOT_COMPRESSIBLE (-3) /* not used right now */ -+#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_PTR_ALIGN_UP(_ptr,_size) \ -+ ((_ptr) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(_ptr),(lzo_uint)(_size))) -+#define LZO_ALIGN(_ptr,_size) LZO_PTR_ALIGN_UP(_ptr,_size) -+ -+typedef int -+ (*lzo_compress_t) (const lzo_byte * src, lzo_uint src_len, -+ lzo_byte * dst, lzo_uintp dst_len, -+ lzo_voidp wrkmem); -+ -+typedef int -+ (*lzo_decompress_t) (const lzo_byte * src, lzo_uint src_len, -+ lzo_byte * dst, lzo_uintp dst_len, -+ lzo_voidp wrkmem); -+ -+typedef int -+ (*lzo_optimize_t) (lzo_byte * src, lzo_uint src_len, -+ lzo_byte * dst, lzo_uintp dst_len, -+ lzo_voidp wrkmem); -+ -+typedef int -+ (*lzo_compress_dict_t) (const lzo_byte * src, lzo_uint src_len, -+ lzo_byte * dst, lzo_uintp dst_len, -+ lzo_voidp wrkmem, -+ const lzo_byte * dict, lzo_uint dict_len); -+ -+typedef int -+ (*lzo_decompress_dict_t) (const lzo_byte * src, lzo_uint src_len, -+ lzo_byte * dst, lzo_uintp dst_len, -+ lzo_voidp wrkmem, -+ const lzo_byte * dict, lzo_uint dict_len); -+ -+typedef int -+ (*lzo_compress_asm_t) (const lzo_byte * src, lzo_uint src_len, -+ lzo_byte * dst, lzo_uintp dst_len, -+ lzo_voidp wrkmem); -+ -+typedef int -+ (*lzo_decompress_asm_t) (const lzo_byte * src, lzo_uint src_len, -+ lzo_byte * dst, lzo_uintp dst_len, -+ lzo_voidp wrkmem); -+ -+typedef void (*lzo_progress_callback_t) (lzo_uint, lzo_uint); -+ -+typedef union -+{ -+ lzo_bytep p; -+ lzo_uint u; -+} __lzo_pu_u; -+typedef union -+{ -+ lzo_bytep p; -+ lzo_uint32 u32; -+} __lzo_pu32_u; -+typedef union -+{ -+ void *vp; -+ lzo_bytep bp; -+ lzo_uint32 u32; -+ long l; -+} lzo_align_t; -+ -+/* lzo1x.h */ -+ -+#define LZO1X_1_MEM_COMPRESS ((lzo_uint32) (16384L * lzo_sizeof_dict_t)) -+#define LZO1X_999_MEM_COMPRESS ((lzo_uint32) (14 * 16384L * sizeof(short))) -+ -+/* lzo_ptr.h */ -+ -+#define PTR(a) ((lzo_ptr_t) (a)) -+#define PTR_LINEAR(a) PTR(a) -+#define PTR_ALIGNED_4(a) ((PTR_LINEAR(a) & 3) == 0) -+#define PTR_ALIGNED_8(a) ((PTR_LINEAR(a) & 7) == 0) -+#define PTR_ALIGNED2_4(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 3) == 0) -+#define PTR_ALIGNED2_8(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 7) == 0) -+#define PTR_LT(a,b) (PTR(a) < PTR(b)) -+#define PTR_GE(a,b) (PTR(a) >= PTR(b)) -+#define PTR_DIFF(a,b) ((lzo_ptrdiff_t) (PTR(a) - PTR(b))) -+#define pd(a,b) ((lzo_uint) ((a)-(b))) -+ -+typedef ptrdiff_t lzo_ptrdiff_t; -+ -+typedef union -+{ -+ char a_char; -+ unsigned char a_uchar; -+ short a_short; -+ unsigned short a_ushort; -+ int a_int; -+ unsigned int a_uint; -+ long a_long; -+ unsigned long a_ulong; -+ lzo_int a_lzo_int; -+ lzo_uint a_lzo_uint; -+ lzo_int32 a_lzo_int32; -+ lzo_uint32 a_lzo_uint32; -+ ptrdiff_t a_ptrdiff_t; -+ lzo_ptrdiff_t a_lzo_ptrdiff_t; -+ lzo_ptr_t a_lzo_ptr_t; -+ lzo_voidp a_lzo_voidp; -+ void *a_void_p; -+ lzo_bytep a_lzo_bytep; -+ lzo_bytepp a_lzo_bytepp; -+ lzo_uintp a_lzo_uintp; -+ lzo_uint *a_lzo_uint_p; -+ lzo_uint32p a_lzo_uint32p; -+ lzo_uint32 *a_lzo_uint32_p; -+ unsigned char *a_uchar_p; -+ char *a_char_p; -+} -+lzo_full_align_t; -+ -+/* lzo_mchw.ch */ -+ -+typedef struct -+{ -+ int init; -+ -+ lzo_uint look; -+ -+ lzo_uint m_len; -+ lzo_uint m_off; -+ -+ lzo_uint last_m_len; -+ lzo_uint last_m_off; -+ -+ const lzo_byte *bp; -+ const lzo_byte *ip; -+ const lzo_byte *in; -+ const lzo_byte *in_end; -+ lzo_byte *out; -+ -+ lzo_progress_callback_t cb; -+ -+ lzo_uint textsize; -+ lzo_uint codesize; -+ lzo_uint printcount; -+ -+ unsigned long lit_bytes; -+ unsigned long match_bytes; -+ unsigned long rep_bytes; -+ unsigned long lazy; -+ -+ lzo_uint r1_lit; -+ lzo_uint r1_m_len; -+ -+ unsigned long m1a_m, m1b_m, m2_m, m3_m, m4_m; -+ unsigned long lit1_r, lit2_r, lit3_r; -+} -+lzo1x_999_t; -+ -+#define getbyte(c) ((c).ip < (c).in_end ? *((c).ip)++ : (-1)) -+ -+/* lzo_swd.ch */ -+ -+#define SWD_UINT(x) ((swd_uint)(x)) -+#define SWD_HSIZE 16384 -+#define SWD_MAX_CHAIN 2048 -+#define HEAD3(b,p) \ -+ (((0x9f5f*(((((lzo_uint32)b[p]<<5)^b[p+1])<<5)^b[p+2]))>>5) & (SWD_HSIZE-1)) -+#define HEAD2(b,p) (b[p] ^ ((unsigned)b[p+1]<<8)) -+#define NIL2 SWD_UINT_MAX -+ -+typedef struct -+{ -+ lzo_uint n; -+ lzo_uint f; -+ lzo_uint threshold; -+ -+ lzo_uint max_chain; -+ lzo_uint nice_length; -+ lzo_bool use_best_off; -+ lzo_uint lazy_insert; -+ -+ lzo_uint m_len; -+ lzo_uint m_off; -+ lzo_uint look; -+ int b_char; -+ -+ lzo_uint best_off[SWD_BEST_OFF]; -+ -+ lzo1x_999_t *c; -+ lzo_uint m_pos; -+ -+ lzo_uint best_pos[SWD_BEST_OFF]; -+ -+ const lzo_byte *dict; -+ const lzo_byte *dict_end; -+ lzo_uint dict_len; -+ -+ lzo_uint ip; -+ lzo_uint bp; -+ lzo_uint rp; -+ lzo_uint b_size; -+ -+ unsigned char *b_wrap; -+ -+ lzo_uint node_count; -+ lzo_uint first_rp; -+ -+ unsigned char b[SWD_N + SWD_F + SWD_F]; -+ swd_uint head3[SWD_HSIZE]; -+ swd_uint succ3[SWD_N + SWD_F]; -+ swd_uint best3[SWD_N + SWD_F]; -+ swd_uint llen3[SWD_HSIZE]; -+ -+ swd_uint head2[65536L]; -+} -+lzo1x_999_swd_t; -+ -+#define s_head3(s,key) s->head3[key] -+#define swd_pos2off(s,pos) \ -+ (s->bp > (pos) ? s->bp - (pos) : s->b_size - ((pos) - s->bp)) -+ -+static __inline__ void -+swd_getbyte (lzo1x_999_swd_t * s) -+{ -+ int c; -+ -+ if ((c = getbyte (*(s->c))) < 0) -+ { -+ if (s->look > 0) -+ --s->look; -+ } -+ else -+ { -+ s->b[s->ip] = LZO_BYTE (c); -+ if (s->ip < s->f) -+ s->b_wrap[s->ip] = LZO_BYTE (c); -+ } -+ if (++s->ip == s->b_size) -+ s->ip = 0; -+ if (++s->bp == s->b_size) -+ s->bp = 0; -+ if (++s->rp == s->b_size) -+ s->rp = 0; -+} -+ -+static void -+swd_initdict (lzo1x_999_swd_t * s, const lzo_byte * dict, lzo_uint dict_len) -+{ -+ s->dict = s->dict_end = NULL; -+ s->dict_len = 0; -+ -+ if (!dict || dict_len <= 0) -+ return; -+ if (dict_len > s->n) -+ { -+ dict += dict_len - s->n; -+ dict_len = s->n; -+ } -+ -+ s->dict = dict; -+ s->dict_len = dict_len; -+ s->dict_end = dict + dict_len; -+ memcpy (s->b, dict, dict_len); -+ s->ip = dict_len; -+} -+ -+static void -+swd_insertdict (lzo1x_999_swd_t * s, lzo_uint node, lzo_uint len) -+{ -+ lzo_uint key; -+ -+ s->node_count = s->n - len; -+ s->first_rp = node; -+ -+ while (len-- > 0) -+ { -+ key = HEAD3 (s->b, node); -+ s->succ3[node] = s_head3 (s, key); -+ s->head3[key] = SWD_UINT (node); -+ s->best3[node] = SWD_UINT (s->f + 1); -+ s->llen3[key]++; -+ -+ key = HEAD2 (s->b, node); -+ s->head2[key] = SWD_UINT (node); -+ -+ node++; -+ } -+} -+ -+static int -+swd_init (lzo1x_999_swd_t * s, const lzo_byte * dict, lzo_uint dict_len) -+{ -+ -+ s->n = SWD_N; -+ s->f = SWD_F; -+ s->threshold = SWD_THRESHOLD; -+ -+ -+ -+ s->max_chain = SWD_MAX_CHAIN; -+ s->nice_length = SWD_F; -+ s->use_best_off = 0; -+ s->lazy_insert = 0; -+ -+ s->b_size = s->n + s->f; -+ if (2 * s->f >= s->n || s->b_size + s->f >= NIL2) -+ return LZO_E_ERROR; -+ s->b_wrap = s->b + s->b_size; -+ s->node_count = s->n; -+ -+ memset (s->llen3, 0, sizeof (s->llen3[0]) * SWD_HSIZE); -+ memset (s->head2, 0xff, sizeof (s->head2[0]) * 65536L); -+ -+ s->ip = 0; -+ swd_initdict (s, dict, dict_len); -+ s->bp = s->ip; -+ s->first_rp = s->ip; -+ -+ s->look = (lzo_uint) (s->c->in_end - s->c->ip); -+ if (s->look > 0) -+ { -+ if (s->look > s->f) -+ s->look = s->f; -+ memcpy (&s->b[s->ip], s->c->ip, s->look); -+ s->c->ip += s->look; -+ s->ip += s->look; -+ } -+ -+ if (s->ip == s->b_size) -+ s->ip = 0; -+ -+ if (s->look >= 2 && s->dict_len > 0) -+ swd_insertdict (s, 0, s->dict_len); -+ -+ s->rp = s->first_rp; -+ if (s->rp >= s->node_count) -+ s->rp -= s->node_count; -+ else -+ s->rp += s->b_size - s->node_count; -+ -+ return LZO_E_OK; -+} -+ -+static __inline__ void -+swd_remove_node (lzo1x_999_swd_t * s, lzo_uint node) -+{ -+ if (s->node_count == 0) -+ { -+ lzo_uint key; -+ -+ key = HEAD3 (s->b, node); -+ -+ --s->llen3[key]; -+ -+ key = HEAD2 (s->b, node); -+ -+ if ((lzo_uint) s->head2[key] == node) -+ s->head2[key] = NIL2; -+ } -+ else -+ --s->node_count; -+} -+ -+static void -+swd_accept (lzo1x_999_swd_t * s, lzo_uint n) -+{ -+ -+ while (n--) -+ { -+ lzo_uint key; -+ -+ swd_remove_node (s, s->rp); -+ -+ key = HEAD3 (s->b, s->bp); -+ s->succ3[s->bp] = s_head3 (s, key); -+ s->head3[key] = SWD_UINT (s->bp); -+ s->best3[s->bp] = SWD_UINT (s->f + 1); -+ s->llen3[key]++; -+ -+ key = HEAD2 (s->b, s->bp); -+ s->head2[key] = SWD_UINT (s->bp);; -+ -+ swd_getbyte (s); -+ } -+} -+ -+static void -+swd_search (lzo1x_999_swd_t * s, lzo_uint node, lzo_uint cnt) -+{ -+ const unsigned char *p1; -+ const unsigned char *p2; -+ const unsigned char *px; -+ -+ lzo_uint m_len = s->m_len; -+ const unsigned char *b = s->b; -+ const unsigned char *bp = s->b + s->bp; -+ const unsigned char *bx = s->b + s->bp + s->look; -+ unsigned char scan_end1; -+ -+ scan_end1 = bp[m_len - 1]; -+ for (; cnt-- > 0; node = s->succ3[node]) -+ { -+ p1 = bp; -+ p2 = b + node; -+ px = bx; -+ -+ if (p2[m_len - 1] == scan_end1 && -+ p2[m_len] == p1[m_len] && -+ p2[0] == p1[0] && p2[1] == p1[1]) -+ { -+ lzo_uint i; -+ -+ p1 += 2; -+ p2 += 2; -+ do -+ { -+ } -+ while (++p1 < px && *p1 == *++p2); -+ -+ i = p1 - bp; -+ -+ if (i < SWD_BEST_OFF) -+ { -+ if (s->best_pos[i] == 0) -+ s->best_pos[i] = node + 1; -+ } -+ -+ if (i > m_len) -+ { -+ s->m_len = m_len = i; -+ s->m_pos = node; -+ if (m_len == s->look) -+ return; -+ if (m_len >= s->nice_length) -+ return; -+ if (m_len > (lzo_uint) s->best3[node]) -+ return; -+ scan_end1 = bp[m_len - 1]; -+ } -+ } -+ } -+} -+ -+static lzo_bool -+swd_search2 (lzo1x_999_swd_t * s) -+{ -+ lzo_uint key; -+ -+ key = s->head2[HEAD2 (s->b, s->bp)]; -+ if (key == NIL2) -+ return 0; -+ -+ if (s->best_pos[2] == 0) -+ s->best_pos[2] = key + 1; -+ -+ if (s->m_len < 2) -+ { -+ s->m_len = 2; -+ s->m_pos = key; -+ } -+ return 1; -+} -+ -+static void -+swd_findbest (lzo1x_999_swd_t * s) -+{ -+ lzo_uint key; -+ lzo_uint cnt, node; -+ lzo_uint len; -+ -+ key = HEAD3 (s->b, s->bp); -+ node = s->succ3[s->bp] = s_head3 (s, key); -+ cnt = s->llen3[key]++; -+ -+ if (cnt > s->max_chain && s->max_chain > 0) -+ cnt = s->max_chain; -+ s->head3[key] = SWD_UINT (s->bp); -+ -+ s->b_char = s->b[s->bp]; -+ len = s->m_len; -+ if (s->m_len >= s->look) -+ { -+ if (s->look == 0) -+ s->b_char = -1; -+ s->m_off = 0; -+ s->best3[s->bp] = SWD_UINT (s->f + 1); -+ } -+ else -+ { -+ -+ if (swd_search2 (s)) -+ -+ if (s->look >= 3) -+ swd_search (s, node, cnt); -+ if (s->m_len > len) -+ s->m_off = swd_pos2off (s, s->m_pos); -+ s->best3[s->bp] = SWD_UINT (s->m_len); -+ -+ if (s->use_best_off) -+ { -+ int i; -+ for (i = 2; i < SWD_BEST_OFF; i++) -+ if (s->best_pos[i] > 0) -+ s->best_off[i] = -+ swd_pos2off (s, -+ s->best_pos[i] - -+ 1); -+ else -+ s->best_off[i] = 0; -+ } -+ -+ } -+ -+ swd_remove_node (s, s->rp); -+ -+ key = HEAD2 (s->b, s->bp); -+ s->head2[key] = SWD_UINT (s->bp); -+ -+} -+ -+/* lzo_mchw.ch */ -+ -+static int -+init_match (lzo1x_999_t * c, lzo1x_999_swd_t * s, -+ const lzo_byte * dict, lzo_uint dict_len, lzo_uint32 flags) -+{ -+ int r; -+ -+ c->init = 1; -+ -+ s->c = c; -+ -+ c->last_m_len = c->last_m_off = 0; -+ -+ c->textsize = c->codesize = c->printcount = 0; -+ c->lit_bytes = c->match_bytes = c->rep_bytes = 0; -+ c->lazy = 0; -+ -+ r = swd_init (s, dict, dict_len); -+ if (r != 0) -+ return r; -+ -+ s->use_best_off = (flags & 1) ? 1 : 0; -+ return r; -+} -+ -+static int -+find_match (lzo1x_999_t * c, lzo1x_999_swd_t * s, -+ lzo_uint this_len, lzo_uint skip) -+{ -+ if (skip > 0) -+ { -+ swd_accept (s, this_len - skip); -+ c->textsize += this_len - skip + 1; -+ } -+ else -+ { -+ c->textsize += this_len - skip; -+ } -+ -+ s->m_len = 1; -+ s->m_len = 1; -+ -+ if (s->use_best_off) -+ memset (s->best_pos, 0, sizeof (s->best_pos)); -+ -+ swd_findbest (s); -+ c->m_len = s->m_len; -+ c->m_off = s->m_off; -+ -+ swd_getbyte (s); -+ -+ if (s->b_char < 0) -+ { -+ c->look = 0; -+ c->m_len = 0; -+ } -+ else -+ { -+ c->look = s->look + 1; -+ } -+ c->bp = c->ip - c->look; -+ -+ if (c->cb && c->textsize > c->printcount) -+ { -+ (*c->cb) (c->textsize, c->codesize); -+ c->printcount += 1024; -+ } -+ -+ return LZO_E_OK; -+} -+ -+/* lzo1x_9x.c */ -+ -+static lzo_byte * -+code_match (lzo1x_999_t * c, lzo_byte * op, lzo_uint m_len, lzo_uint m_off) -+{ -+ lzo_uint x_len = m_len; -+ lzo_uint x_off = m_off; -+ -+ c->match_bytes += m_len; -+ -+ if (m_len == 2) -+ { -+ m_off -= 1; -+ -+ *op++ = LZO_BYTE (M1_MARKER | ((m_off & 3) << 2)); -+ *op++ = LZO_BYTE (m_off >> 2); -+ -+ c->m1a_m++; -+ } -+ -+ else if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET) -+ -+ { -+ -+ m_off -= 1; -+ *op++ = LZO_BYTE (((m_len - 1) << 5) | ((m_off & 7) << 2)); -+ *op++ = LZO_BYTE (m_off >> 3); -+ c->m2_m++; -+ } -+ else if (m_len == M2_MIN_LEN && m_off <= MX_MAX_OFFSET -+ && c->r1_lit >= 4) -+ { -+ m_off -= 1 + M2_MAX_OFFSET; -+ -+ *op++ = LZO_BYTE (M1_MARKER | ((m_off & 3) << 2)); -+ *op++ = LZO_BYTE (m_off >> 2); -+ -+ c->m1b_m++; -+ } -+ else if (m_off <= M3_MAX_OFFSET) -+ { -+ m_off -= 1; -+ if (m_len <= M3_MAX_LEN) -+ *op++ = LZO_BYTE (M3_MARKER | (m_len - 2)); -+ else -+ { -+ m_len -= M3_MAX_LEN; -+ *op++ = M3_MARKER | 0; -+ while (m_len > 255) -+ { -+ m_len -= 255; -+ *op++ = 0; -+ } -+ *op++ = LZO_BYTE (m_len); -+ } -+ -+ *op++ = LZO_BYTE (m_off << 2); -+ *op++ = LZO_BYTE (m_off >> 6); -+ -+ c->m3_m++; -+ } -+ else -+ { -+ lzo_uint k; -+ -+ m_off -= 0x4000; -+ k = (m_off & 0x4000) >> 11; -+ if (m_len <= M4_MAX_LEN) -+ *op++ = LZO_BYTE (M4_MARKER | k | (m_len - 2)); -+ else -+ { -+ m_len -= M4_MAX_LEN; -+ *op++ = LZO_BYTE (M4_MARKER | k | 0); -+ while (m_len > 255) -+ { -+ m_len -= 255; -+ *op++ = 0; -+ } -+ *op++ = LZO_BYTE (m_len); -+ } -+ -+ *op++ = LZO_BYTE (m_off << 2); -+ *op++ = LZO_BYTE (m_off >> 6); -+ -+ c->m4_m++; -+ } -+ -+ c->last_m_len = x_len; -+ c->last_m_off = x_off; -+ return op; -+} -+ -+static lzo_byte * -+STORE_RUN (lzo1x_999_t * c, lzo_byte * op, const lzo_byte * ii, lzo_uint t) -+{ -+ c->lit_bytes += t; -+ -+ if (op == c->out && t <= 238) -+ { -+ *op++ = LZO_BYTE (17 + t); -+ } -+ else if (t <= 3) -+ { -+ op[-2] |= LZO_BYTE (t); -+ -+ c->lit1_r++; -+ } -+ else if (t <= 18) -+ { -+ *op++ = LZO_BYTE (t - 3); -+ c->lit2_r++; -+ } -+ else -+ { -+ lzo_uint tt = t - 18; -+ -+ *op++ = 0; -+ while (tt > 255) -+ { -+ tt -= 255; -+ *op++ = 0; -+ } -+ *op++ = LZO_BYTE (tt); -+ c->lit3_r++; -+ } -+ do -+ *op++ = *ii++; -+ while (--t > 0); -+ -+ return op; -+} -+ -+static lzo_byte * -+code_run (lzo1x_999_t * c, lzo_byte * op, const lzo_byte * ii, -+ lzo_uint lit, lzo_uint m_len) -+{ -+ if (lit > 0) -+ { -+ op = STORE_RUN (c, op, ii, lit); -+ c->r1_m_len = m_len; -+ c->r1_lit = lit; -+ } -+ else -+ { -+ c->r1_m_len = 0; -+ c->r1_lit = 0; -+ } -+ -+ return op; -+} -+ -+static int -+len_of_coded_match (lzo_uint m_len, lzo_uint m_off, lzo_uint lit) -+{ -+ int n = 4; -+ -+ if (m_len < 2) -+ return -1; -+ if (m_len == 2) -+ return (m_off <= M1_MAX_OFFSET && lit > 0 -+ && lit < 4) ? 2 : -1; -+ if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET) -+ return 2; -+ if (m_len == M2_MIN_LEN && m_off <= MX_MAX_OFFSET && lit >= 4) -+ return 2; -+ if (m_off <= M3_MAX_OFFSET) -+ { -+ if (m_len <= M3_MAX_LEN) -+ return 3; -+ m_len -= M3_MAX_LEN; -+ while (m_len > 255) -+ { -+ m_len -= 255; -+ n++; -+ } -+ return n; -+ } -+ if (m_off <= M4_MAX_OFFSET) -+ { -+ if (m_len <= M4_MAX_LEN) -+ return 3; -+ m_len -= M4_MAX_LEN; -+ while (m_len > 255) -+ { -+ m_len -= 255; -+ n++; -+ } -+ return n; -+ } -+ return -1; -+} -+ -+static lzo_int -+min_gain (lzo_uint ahead, lzo_uint lit1, lzo_uint lit2, int l1, int l2, -+ int l3) -+{ -+ lzo_int lazy_match_min_gain = 0; -+ -+ lazy_match_min_gain += ahead; -+ -+ if (lit1 <= 3) -+ lazy_match_min_gain += (lit2 <= 3) ? 0 : 2; -+ else if (lit1 <= 18) -+ lazy_match_min_gain += (lit2 <= 18) ? 0 : 1; -+ -+ lazy_match_min_gain += (l2 - l1) * 2; -+ if (l3 > 0) -+ lazy_match_min_gain -= (ahead - l3) * 2; -+ -+ if (lazy_match_min_gain < 0) -+ lazy_match_min_gain = 0; -+ -+ return lazy_match_min_gain; -+} -+ -+static void -+better_match (const lzo1x_999_swd_t * swd, lzo_uint * m_len, lzo_uint * m_off) -+{ -+ if (*m_len <= M2_MIN_LEN) -+ return; -+ -+ if (*m_off <= M2_MAX_OFFSET) -+ return; -+ -+ if (*m_off > M2_MAX_OFFSET && -+ *m_len >= M2_MIN_LEN + 1 && *m_len <= M2_MAX_LEN + 1 && -+ swd->best_off[*m_len - 1] -+ && swd->best_off[*m_len - 1] <= M2_MAX_OFFSET) -+ { -+ *m_len = *m_len - 1; -+ *m_off = swd->best_off[*m_len]; -+ return; -+ } -+ -+ if (*m_off > M3_MAX_OFFSET && -+ *m_len >= M4_MAX_LEN + 1 && *m_len <= M2_MAX_LEN + 2 && -+ swd->best_off[*m_len - 2] -+ && swd->best_off[*m_len - 2] <= M2_MAX_OFFSET) -+ { -+ *m_len = *m_len - 2; -+ *m_off = swd->best_off[*m_len]; -+ return; -+ } -+ -+ if (*m_off > M3_MAX_OFFSET && -+ *m_len >= M4_MAX_LEN + 1 && *m_len <= M3_MAX_LEN + 1 && -+ swd->best_off[*m_len - 1] -+ && swd->best_off[*m_len - 1] <= M3_MAX_OFFSET) -+ { -+ *m_len = *m_len - 1; -+ *m_off = swd->best_off[*m_len]; -+ } -+ -+} -+ -+/* minilzo.c */ -+ -+static lzo_bool -+lzo_assert (int expr) -+{ -+ return (expr) ? 1 : 0; -+} -+ -+/* lzo1x_9x.c */ -+ -+static int -+lzo1x_999_compress_internal (const lzo_byte * in, lzo_uint in_len, -+ lzo_byte * out, lzo_uintp out_len, -+ lzo_voidp wrkmem, -+ const lzo_byte * dict, lzo_uint dict_len, -+ lzo_progress_callback_t cb, -+ int try_lazy, -+ lzo_uint good_length, -+ lzo_uint max_lazy, -+ lzo_uint nice_length, -+ lzo_uint max_chain, lzo_uint32 flags) -+{ -+ lzo_byte *op; -+ const lzo_byte *ii; -+ lzo_uint lit; -+ lzo_uint m_len, m_off; -+ lzo1x_999_t cc; -+ lzo1x_999_t *const c = &cc; -+ lzo1x_999_swd_t *const swd = (lzo1x_999_swd_t *) wrkmem; -+ int r; -+ -+ if (!lzo_assert -+ (LZO1X_999_MEM_COMPRESS >= lzo_sizeof (lzo1x_999_swd_t))) -+ return LZO_E_ERROR; -+ -+ if (try_lazy < 0) -+ try_lazy = 1; -+ -+ if (good_length <= 0) -+ good_length = 32; -+ -+ if (max_lazy <= 0) -+ max_lazy = 32; -+ -+ if (nice_length <= 0) -+ nice_length = 0; -+ -+ if (max_chain <= 0) -+ max_chain = SWD_MAX_CHAIN; -+ -+ c->init = 0; -+ c->ip = c->in = in; -+ c->in_end = in + in_len; -+ c->out = out; -+ c->cb = cb; -+ c->m1a_m = c->m1b_m = c->m2_m = c->m3_m = c->m4_m = 0; -+ c->lit1_r = c->lit2_r = c->lit3_r = 0; -+ -+ op = out; -+ ii = c->ip; -+ lit = 0; -+ c->r1_lit = c->r1_m_len = 0; -+ -+ r = init_match (c, swd, dict, dict_len, flags); -+ if (r != 0) -+ return r; -+ if (max_chain > 0) -+ swd->max_chain = max_chain; -+ if (nice_length > 0) -+ swd->nice_length = nice_length; -+ -+ r = find_match (c, swd, 0, 0); -+ if (r != 0) -+ return r; -+ while (c->look > 0) -+ { -+ lzo_uint ahead; -+ lzo_uint max_ahead; -+ int l1, l2, l3; -+ -+ c->codesize = op - out; -+ -+ m_len = c->m_len; -+ m_off = c->m_off; -+ -+ if (lit == 0) -+ ii = c->bp; -+ -+ if (m_len < 2 || -+ (m_len == 2 -+ && (m_off > M1_MAX_OFFSET || lit == 0 || lit >= 4)) -+ || (m_len == 2 && op == out) || (op == out && lit == 0)) -+ { -+ -+ m_len = 0; -+ } -+ else if (m_len == M2_MIN_LEN) -+ { -+ -+ if (m_off > MX_MAX_OFFSET && lit >= 4) -+ m_len = 0; -+ } -+ -+ if (m_len == 0) -+ { -+ -+ lit++; -+ swd->max_chain = max_chain; -+ r = find_match (c, swd, 1, 0); -+ continue; -+ } -+ -+ if (swd->use_best_off) -+ better_match (swd, &m_len, &m_off); -+ -+ ahead = 0; -+ if (try_lazy <= 0 || m_len >= max_lazy) -+ { -+ -+ l1 = 0; -+ max_ahead = 0; -+ } -+ else -+ { -+ -+ l1 = len_of_coded_match (m_len, m_off, lit); -+ -+ max_ahead = LZO_MIN (try_lazy, l1 - 1); -+ -+ } -+ -+ while (ahead < max_ahead && c->look > m_len) -+ { -+ lzo_int lazy_match_min_gain; -+ -+ if (m_len >= good_length) -+ swd->max_chain = max_chain >> 2; -+ else -+ swd->max_chain = max_chain; -+ r = find_match (c, swd, 1, 0); -+ ahead++; -+ -+ if (c->m_len < m_len) -+ continue; -+ -+ if (c->m_len == m_len && c->m_off >= m_off) -+ continue; -+ -+ if (swd->use_best_off) -+ better_match (swd, &c->m_len, &c->m_off); -+ -+ l2 = len_of_coded_match (c->m_len, c->m_off, -+ lit + ahead); -+ if (l2 < 0) -+ continue; -+ -+ l3 = (op == out) ? -1 : len_of_coded_match (ahead, -+ m_off, -+ lit); -+ -+ lazy_match_min_gain = -+ min_gain (ahead, lit, lit + ahead, l1, l2, -+ l3); -+ if (c->m_len >= m_len + lazy_match_min_gain) -+ { -+ c->lazy++; -+ -+ if (l3 > 0) -+ { -+ -+ op = code_run (c, op, ii, lit, ahead); -+ lit = 0; -+ -+ op = code_match (c, op, ahead, m_off); -+ } -+ else -+ { -+ lit += ahead; -+ } -+ goto lazy_match_done; -+ } -+ } -+ -+ op = code_run (c, op, ii, lit, m_len); -+ lit = 0; -+ -+ op = code_match (c, op, m_len, m_off); -+ swd->max_chain = max_chain; -+ r = find_match (c, swd, m_len, 1 + ahead); -+ -+ lazy_match_done:; -+ } -+ -+ if (lit > 0) -+ op = STORE_RUN (c, op, ii, lit); -+ -+ *op++ = M4_MARKER | 1; -+ *op++ = 0; -+ *op++ = 0; -+ -+ c->codesize = op - out; -+ -+ *out_len = op - out; -+ -+ if (c->cb) -+ (*c->cb) (c->textsize, c->codesize); -+ -+ return LZO_E_OK; -+} -+ -+static int -+lzo1x_999_compress_level (const lzo_byte * in, lzo_uint in_len, -+ lzo_byte * out, lzo_uintp out_len, -+ lzo_voidp wrkmem, -+ const lzo_byte * dict, lzo_uint dict_len, -+ lzo_progress_callback_t cb, int compression_level) -+{ -+ static const struct -+ { -+ int try_lazy; -+ lzo_uint good_length; -+ lzo_uint max_lazy; -+ lzo_uint nice_length; -+ lzo_uint max_chain; -+ lzo_uint32 flags; -+ } c[9] = -+ { -+ { -+ 0, 0, 0, 8, 4, 0}, -+ { -+ 0, 0, 0, 16, 8, 0}, -+ { -+ 0, 0, 0, 32, 16, 0}, -+ { -+ 1, 4, 4, 16, 16, 0}, -+ { -+ 1, 8, 16, 32, 32, 0}, -+ { -+ 1, 8, 16, 128, 128, 0}, -+ { -+ 2, 8, 32, 128, 256, 0}, -+ { -+ 2, 32, 128, F, 2048, 1}, -+ { -+ 2, F, F, F, 4096, 1} -+ }; -+ -+ if (compression_level < 1 || compression_level > 9) -+ return LZO_E_ERROR; -+ -+ compression_level -= 1; -+ return lzo1x_999_compress_internal (in, in_len, out, out_len, wrkmem, -+ dict, dict_len, cb, -+ c[compression_level].try_lazy, -+ c[compression_level].good_length, -+ c[compression_level].max_lazy, -+ 0, -+ c[compression_level].max_chain, -+ c[compression_level].flags); -+} -+ -+static int -+lzo1x_999_compress (const lzo_byte * in, lzo_uint in_len, -+ lzo_byte * out, lzo_uintp out_len, lzo_voidp wrkmem) -+{ -+ return lzo1x_999_compress_level (in, in_len, out, out_len, wrkmem, -+ NULL, 0, 0, 8); -+} -+ -+/* minilzo.c */ -+ -+static const lzo_byte __lzo_copyright[] = LZO_VERSION_STRING; -+ -+static lzo_uint -+_lzo1x_1_do_compress (const lzo_byte * in, lzo_uint in_len, -+ lzo_byte * out, lzo_uintp out_len, lzo_voidp wrkmem) -+{ -+ -+ register const lzo_byte *ip; -+ -+ lzo_byte *op; -+ const lzo_byte *const in_end = in + in_len; -+ const lzo_byte *const ip_end = in + in_len - 8 - 5; -+ const lzo_byte *ii; -+ lzo_dict_p const dict = (lzo_dict_p) wrkmem; -+ -+ op = out; -+ ip = in; -+ ii = ip; -+ -+ ip += 4; -+ for (;;) -+ { -+ register const lzo_byte *m_pos; -+ -+ lzo_uint m_off; -+ lzo_uint m_len; -+ lzo_uint dindex; -+ -+ DINDEX1 (dindex, ip); -+ GINDEX (m_pos, m_off, dict, dindex, in); -+ if (LZO_CHECK_MPOS_NON_DET -+ (m_pos, m_off, in, ip, M4_MAX_OFFSET)) -+ goto literal; -+ -+ if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3]) -+ goto try_match; -+ DINDEX2 (dindex, ip); -+ GINDEX (m_pos, m_off, dict, dindex, in); -+ -+ if (LZO_CHECK_MPOS_NON_DET -+ (m_pos, m_off, in, ip, M4_MAX_OFFSET)) -+ goto literal; -+ if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3]) -+ goto try_match; -+ goto literal; -+ -+ try_match: -+ if (m_pos[0] != ip[0] || m_pos[1] != ip[1]) -+ { -+ } -+ else -+ { -+ if (m_pos[2] == ip[2]) -+ { -+ goto match; -+ } -+ else -+ { -+ } -+ } -+ -+ literal: -+ UPDATE_I (dict, 0, dindex, ip, in); -+ ++ip; -+ if (ip >= ip_end) -+ break; -+ continue; -+ -+ match: -+ UPDATE_I (dict, 0, dindex, ip, in); -+ -+ if (pd (ip, ii) > 0) -+ { -+ register lzo_uint t = pd (ip, ii); -+ -+ if (t <= 3) -+ { -+ op[-2] |= LZO_BYTE (t); -+ } -+ else if (t <= 18) -+ *op++ = LZO_BYTE (t - 3); -+ else -+ { -+ register lzo_uint tt = t - 18; -+ -+ *op++ = 0; -+ while (tt > 255) -+ { -+ tt -= 255; -+ *op++ = 0; -+ } -+ *op++ = LZO_BYTE (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++ = LZO_BYTE (((m_len - -+ 1) << 5) | ((m_off & 7) << -+ 2)); -+ *op++ = LZO_BYTE (m_off >> 3); -+ } -+ else if (m_off <= M3_MAX_OFFSET) -+ { -+ m_off -= 1; -+ *op++ = LZO_BYTE (M3_MARKER | (m_len - 2)); -+ goto m3_m4_offset; -+ } -+ else -+ -+ { -+ m_off -= 0x4000; -+ -+ *op++ = LZO_BYTE (M4_MARKER | -+ ((m_off & 0x4000) >> 11) | -+ (m_len - 2)); -+ goto m3_m4_offset; -+ } -+ } -+ else -+ { -+ { -+ const lzo_byte *end = in_end; -+ const lzo_byte *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++ = LZO_BYTE (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++ = LZO_BYTE (M4_MARKER | -+ ((m_off & 0x4000) >> -+ 11) | (m_len - 2)); -+ -+ else -+ { -+ m_len -= M4_MAX_LEN; -+ *op++ = LZO_BYTE (M4_MARKER | -+ ((m_off & 0x4000) >> -+ 11)); -+ m3_m4_len: -+ while (m_len > 255) -+ { -+ m_len -= 255; -+ *op++ = 0; -+ } -+ -+ *op++ = LZO_BYTE (m_len); -+ } -+ } -+ -+ m3_m4_offset: -+ *op++ = LZO_BYTE ((m_off & 63) << 2); -+ *op++ = LZO_BYTE (m_off >> 6); -+ } -+ ii = ip; -+ if (ip >= ip_end) -+ break; -+ } -+ -+ *out_len = op - out; -+ return pd (in_end, ii); -+} -+ -+static int -+lzo1x_1_compress (const lzo_byte * in, lzo_uint in_len, -+ lzo_byte * out, lzo_uintp out_len, lzo_voidp wrkmem) -+{ -+ lzo_byte *op = out; -+ lzo_uint t; -+ -+ if (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) -+ { -+ const lzo_byte *ii = in + in_len - t; -+ -+ if (op == out && t <= 238) -+ *op++ = LZO_BYTE (17 + t); -+ else if (t <= 3) -+ op[-2] |= LZO_BYTE (t); -+ else if (t <= 18) -+ *op++ = LZO_BYTE (t - 3); -+ else -+ { -+ lzo_uint tt = t - 18; -+ -+ *op++ = 0; -+ while (tt > 255) -+ { -+ tt -= 255; -+ *op++ = 0; -+ } -+ -+ *op++ = LZO_BYTE (tt); -+ } -+ do -+ *op++ = *ii++; -+ while (--t > 0); -+ } -+ -+ *op++ = M4_MARKER | 1; -+ *op++ = 0; -+ *op++ = 0; -+ -+ *out_len = op - out; -+ return 0; -+} -+ -+static int -+lzo1x_decompress (const lzo_byte * in, lzo_uint in_len, -+ lzo_byte * out, lzo_uintp out_len, lzo_voidp wrkmem) -+{ -+ register lzo_byte *op; -+ register const lzo_byte *ip; -+ register lzo_uint t; -+ -+ register const lzo_byte *m_pos; -+ -+ const lzo_byte *const ip_end = in + in_len; -+ lzo_byte *const op_end = out + *out_len; -+ -+ *out_len = 0; -+ -+ op = out; -+ ip = in; -+ -+ if (*ip > 17) -+ { -+ t = *ip++ - 17; -+ if (t < 4) -+ goto match_next; -+ NEED_OP (t); -+ NEED_IP (t + 1); -+ do -+ *op++ = *ip++; -+ while (--t > 0); -+ goto first_literal_run; -+ } -+ -+ while (TEST_IP && TEST_OP) -+ { -+ t = *ip++; -+ if (t >= 16) -+ goto match; -+ if (t == 0) -+ { -+ NEED_IP (1); -+ while (*ip == 0) -+ { -+ t += 255; -+ ip++; -+ NEED_IP (1); -+ } -+ t += 15 + *ip++; -+ } -+ NEED_OP (t + 3); -+ NEED_IP (t + 4); -+ if (PTR_ALIGNED2_4 (op, ip)) -+ { -+ 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); -+ } -+ } -+ else -+ { -+ *op++ = *ip++; -+ *op++ = *ip++; -+ *op++ = *ip++; -+ 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; -+ TEST_LOOKBEHIND (m_pos, out); -+ NEED_OP (3); -+ *op++ = *m_pos++; -+ *op++ = *m_pos++; -+ *op++ = *m_pos; -+ -+ goto match_done; -+ -+ while (TEST_IP && TEST_OP) -+ { -+ match: -+ if (t >= 64) -+ { -+ m_pos = op - 1; -+ m_pos -= (t >> 2) & 7; -+ m_pos -= *ip++ << 3; -+ t = (t >> 5) - 1; -+ TEST_LOOKBEHIND (m_pos, out); -+ NEED_OP (t + 3 - 1); -+ goto copy_match; -+ -+ } -+ else if (t >= 32) -+ { -+ t &= 31; -+ if (t == 0) -+ { -+ NEED_IP (1); -+ while (*ip == 0) -+ { -+ t += 255; -+ ip++; -+ NEED_IP (1); -+ } -+ t += 31 + *ip++; -+ } -+ -+ m_pos = op - 1; -+ m_pos -= (ip[0] >> 2) + (ip[1] << 6); -+ -+ ip += 2; -+ } -+ else if (t >= 16) -+ { -+ m_pos = op; -+ m_pos -= (t & 8) << 11; -+ -+ t &= 7; -+ if (t == 0) -+ { -+ NEED_IP (1); -+ while (*ip == 0) -+ { -+ t += 255; -+ ip++; -+ NEED_IP (1); -+ } -+ t += 7 + *ip++; -+ } -+ -+ m_pos -= (ip[0] >> 2) + (ip[1] << 6); -+ -+ 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; -+ TEST_LOOKBEHIND (m_pos, out); -+ NEED_OP (2); -+ *op++ = *m_pos++; -+ *op++ = *m_pos; -+ -+ goto match_done; -+ } -+ -+ TEST_LOOKBEHIND (m_pos, out); -+ NEED_OP (t + 3 - 1); -+ if (t >= 2 * 4 - (3 - 1) -+ && PTR_ALIGNED2_4 (op, m_pos)) -+ { -+ 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: -+ NEED_OP (t); -+ NEED_IP (t + 1); -+ do -+ *op++ = *ip++; -+ while (--t > 0); -+ t = *ip++; -+ } -+ } -+ *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; -+} -+ -+/* lzo1x_oo.ch */ -+ -+#define NO_LIT LZO_UINT_MAX -+ -+static void -+copy2 (lzo_byte * ip, const lzo_byte * m_pos, lzo_ptrdiff_t off) -+{ -+ ip[0] = m_pos[0]; -+ if (off == 1) -+ ip[1] = m_pos[0]; -+ else -+ ip[1] = m_pos[1]; -+} -+ -+static void -+copy3 (lzo_byte * ip, const lzo_byte * m_pos, lzo_ptrdiff_t off) -+{ -+ ip[0] = m_pos[0]; -+ if (off == 1) -+ { -+ ip[2] = ip[1] = m_pos[0]; -+ } -+ else if (off == 2) -+ { -+ ip[1] = m_pos[1]; -+ ip[2] = m_pos[0]; -+ } -+ else -+ { -+ ip[1] = m_pos[1]; -+ ip[2] = m_pos[2]; -+ } -+} -+ -+static int -+lzo1x_optimize (lzo_byte * in, lzo_uint in_len, -+ lzo_byte * out, lzo_uintp out_len, lzo_voidp wrkmem) -+{ -+ register lzo_byte *op; -+ register lzo_byte *ip; -+ register lzo_uint t; -+ register lzo_byte *m_pos; -+ lzo_uint nl; -+ const lzo_byte *const ip_end = in + in_len; -+ const lzo_byte *const op_end = out + *out_len; -+ lzo_byte *litp = NULL; -+ lzo_uint lit = 0; -+ lzo_uint next_lit = NO_LIT; -+ long o_m1_a = 0, o_m1_b = 0, o_m2 = 0, o_m3_a = 0, o_m3_b = 0; -+ -+ *out_len = 0; -+ -+ op = out; -+ ip = in; -+ -+ if (*ip > 17) -+ { -+ t = *ip++ - 17; -+ if (t < 4) -+ goto match_next; -+ goto first_literal_run; -+ } -+ -+ while (TEST_IP && TEST_OP) -+ { -+ t = *ip++; -+ if (t >= 16) -+ goto match; -+ litp = ip - 1; -+ if (t == 0) -+ { -+ t = 15; -+ while (*ip == 0) -+ t += 255, ip++; -+ t += *ip++; -+ } -+ lit = t + 3; -+ copy_literal_run: -+ *op++ = *ip++; -+ *op++ = *ip++; -+ *op++ = *ip++; -+ first_literal_run: -+ do -+ *op++ = *ip++; -+ while (--t > 0); -+ -+ t = *ip++; -+ -+ if (t >= 16) -+ goto match; -+ m_pos = op - 1 - 0x800; -+ m_pos -= t >> 2; -+ m_pos -= *ip++ << 2; -+ *op++ = *m_pos++; -+ *op++ = *m_pos++; -+ *op++ = *m_pos++; -+ lit = 0; -+ goto match_done; -+ -+ while (TEST_IP && TEST_OP) -+ { -+ if (t < 16) -+ { -+ m_pos = op - 1; -+ m_pos -= t >> 2; -+ m_pos -= *ip++ << 2; -+ -+ if (litp == NULL) -+ goto copy_m1; -+ -+ nl = ip[-2] & 3; -+ if (nl == 0 && lit == 1 && ip[0] >= 16) -+ { -+ next_lit = nl; -+ lit += 2; -+ *litp = LZO_BYTE ((*litp & ~3) | lit); -+ copy2 (ip - 2, m_pos, op - m_pos); -+ o_m1_a++; -+ } -+ else if (nl == 0 && ip[0] < 16 && ip[0] != 0 -+ && (lit + 2 + ip[0] < 16)) -+ { -+ t = *ip++; -+ *litp &= ~3; -+ copy2 (ip - 3 + 1, m_pos, op - m_pos); -+ litp += 2; -+ if (lit > 0) -+ memmove (litp + 1, litp, lit); -+ lit += 2 + t + 3; -+ *litp = LZO_BYTE (lit - 3); -+ -+ o_m1_b++; -+ *op++ = *m_pos++; -+ *op++ = *m_pos++; -+ goto copy_literal_run; -+ } -+ copy_m1: -+ *op++ = *m_pos++; -+ *op++ = *m_pos++; -+ } -+ else -+ { -+ match: -+ if (t >= 64) -+ { -+ m_pos = op - 1; -+ m_pos -= (t >> 2) & 7; -+ m_pos -= *ip++ << 3; -+ t = (t >> 5) - 1; -+ if (litp == NULL) -+ goto copy_m; -+ -+ nl = ip[-2] & 3; -+ if (t == 1 && lit > 3 && nl == 0 && -+ ip[0] < 16 && ip[0] != 0 -+ && (lit + 3 + ip[0] < 16)) -+ { -+ t = *ip++; -+ copy3 (ip - 1 - 2, m_pos, -+ op - m_pos); -+ lit += 3 + t + 3; -+ *litp = LZO_BYTE (lit - 3); -+ o_m2++; -+ *op++ = *m_pos++; -+ *op++ = *m_pos++; -+ *op++ = *m_pos++; -+ goto copy_literal_run; -+ } -+ } -+ else -+ { -+ if (t >= 32) -+ { -+ t &= 31; -+ if (t == 0) -+ { -+ t = 31; -+ while (*ip == 0) -+ t += 255, -+ ip++; -+ t += *ip++; -+ } -+ m_pos = op - 1; -+ m_pos -= *ip++ >> 2; -+ m_pos -= *ip++ << 6; -+ } -+ else -+ { -+ m_pos = op; -+ m_pos -= (t & 8) << 11; -+ t &= 7; -+ if (t == 0) -+ { -+ t = 7; -+ while (*ip == 0) -+ t += 255, -+ ip++; -+ t += *ip++; -+ } -+ m_pos -= *ip++ >> 2; -+ m_pos -= *ip++ << 6; -+ if (m_pos == op) -+ goto eof_found; -+ m_pos -= 0x4000; -+ } -+ if (litp == NULL) -+ goto copy_m; -+ -+ nl = ip[-2] & 3; -+ if (t == 1 && lit == 0 && nl == 0 -+ && ip[0] >= 16) -+ { -+ next_lit = nl; -+ lit += 3; -+ *litp = LZO_BYTE ((*litp & ~3) -+ | lit); -+ copy3 (ip - 3, m_pos, -+ op - m_pos); -+ o_m3_a++; -+ } -+ else if (t == 1 && lit <= 3 && nl == 0 -+ && ip[0] < 16 && ip[0] != 0 -+ && (lit + 3 + ip[0] < 16)) -+ { -+ t = *ip++; -+ *litp &= ~3; -+ copy3 (ip - 4 + 1, m_pos, -+ op - m_pos); -+ litp += 2; -+ if (lit > 0) -+ memmove (litp + 1, -+ litp, lit); -+ lit += 3 + t + 3; -+ *litp = LZO_BYTE (lit - 3); -+ -+ o_m3_b++; -+ *op++ = *m_pos++; -+ *op++ = *m_pos++; -+ *op++ = *m_pos++; -+ goto copy_literal_run; -+ } -+ } -+ copy_m: -+ *op++ = *m_pos++; -+ *op++ = *m_pos++; -+ do -+ *op++ = *m_pos++; -+ while (--t > 0); -+ } -+ -+ match_done: -+ if (next_lit == NO_LIT) -+ { -+ t = ip[-2] & 3; -+ lit = t; -+ litp = ip - 2; -+ } -+ else -+ t = next_lit; -+ next_lit = NO_LIT; -+ if (t == 0) -+ break; -+ match_next: -+ do -+ *op++ = *ip++; -+ while (--t > 0); -+ t = *ip++; -+ } -+ } -+ -+ *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)); -+} -+ -+/* interface to jffs2 bbc follows */ -+ -+#include "jffs2_bbc_framework.h" -+ -+#define BLOCKSIZE 4096 -+#define OUTBLOCKSIZE (BLOCKSIZE + BLOCKSIZE / 64 + 16 + 3) -+ -+#define JFFS2_BBC_LZO_BLOCK_SIGN {0x3f, 0x47, 0x5a, 0x18} -+ -+static int -+jffs2_bbc_lzo_compressor_init (void); -+ -+static void -+jffs2_bbc_lzo_compressor_deinit (void); -+ -+static int -+jffs2_bbc_lzo_compress (void *model, unsigned char *input, -+ unsigned char *output, unsigned long *sourcelen, -+ unsigned long *dstlen); -+ -+static int -+jffs2_bbc_lzo_estimate (void *model, unsigned char *input, -+ unsigned long sourcelen, unsigned long *dstlen, -+ unsigned long *readtime, unsigned long *writetime); -+ -+static int -+jffs2_bbc_lzo_decompress (void *model, unsigned char *input, -+ unsigned char *output, unsigned long sourcelen, -+ unsigned long dstlen); -+ -+static char * -+jffs2_bbc_lzo_proc_info (void); -+ -+static int -+jffs2_bbc_lzo_proc_command (char *command); -+ -+struct jffs2_bbc_compressor_type jffs2_bbc_lzo = { -+ "lzo", -+ 0, -+ JFFS2_BBC_LZO_BLOCK_SIGN, -+ jffs2_bbc_lzo_compressor_init, -+ NULL, -+ NULL, -+ jffs2_bbc_lzo_compressor_deinit, -+ jffs2_bbc_lzo_compress, -+ jffs2_bbc_lzo_estimate, -+ jffs2_bbc_lzo_decompress, -+ jffs2_bbc_lzo_proc_info, -+ jffs2_bbc_lzo_proc_command -+}; -+ -+static int -+no_lzo1x_optimize (lzo_byte * src, lzo_uint src_len, -+ lzo_byte * dst, lzo_uintp dst_len, lzo_voidp wrkmem) -+{ -+ return 0; -+} -+ -+#ifdef __KERNEL__ -+static lzo_compress_t lzo1x_compressor = lzo1x_1_compress; -+static lzo_optimize_t lzo1x_optimizer = no_lzo1x_optimize; -+static int lzo1x_compressor_type = 1; -+static int lzo1x_optimize_type = 0; -+static unsigned long lzo1x_compressor_memsize = LZO1X_1_MEM_COMPRESS; -+#else -+static lzo_compress_t lzo1x_compressor = lzo1x_999_compress; -+static lzo_optimize_t lzo1x_optimizer = lzo1x_optimize; -+static int lzo1x_compressor_type = 999; -+static int lzo1x_optimize_type = 1; -+static unsigned long lzo1x_compressor_memsize = LZO1X_999_MEM_COMPRESS; -+#endif -+ -+static lzo_bytep wrkmem = NULL; /* temporary buffer for compression, used by lzo */ -+static lzo_bytep cmprssmem = NULL; /* temporary buffer for compression, used by interface */ -+ -+static int -+jffs2_bbc_lzo_compressor_init (void) -+{ -+ wrkmem = (lzo_bytep) jffs2_bbc_malloc (lzo1x_compressor_memsize); -+ cmprssmem = (lzo_bytep) jffs2_bbc_malloc (OUTBLOCKSIZE); -+ return !(wrkmem && cmprssmem); -+} -+ -+static void -+jffs2_bbc_lzo_compressor_deinit (void) -+{ -+ jffs2_bbc_free (wrkmem); -+ jffs2_bbc_free (cmprssmem); -+} -+ -+static int -+jffs2_bbc_lzo_compress (void *model, unsigned char *input, -+ unsigned char *output, unsigned long *sourcelen, -+ unsigned long *dstlen) -+{ -+ lzo_uint csize = OUTBLOCKSIZE; -+ lzo_uint isize = *sourcelen; -+ int retval; -+ if ((retval = -+ lzo1x_compressor (input, *sourcelen, cmprssmem, &csize, -+ wrkmem)) != LZO_E_OK) -+ { -+ *sourcelen = *dstlen = 0; -+ return retval; -+ } -+ else -+ { -+ retval = lzo1x_optimizer (cmprssmem, csize, input, &isize, -+ NULL); -+ csize += 2; -+ if (csize <= *dstlen) { -+ *dstlen = csize; -+ *(output++) = jffs2_bbc_lzo.block_sign[0]; -+ *(output++) = jffs2_bbc_lzo.block_sign[1]; -+ memcpy (output, cmprssmem, csize - 2); -+ return retval; -+ } else { -+ *sourcelen = *dstlen = 0; -+ return -1; -+ } -+ } -+} -+ -+static int -+jffs2_bbc_lzo_estimate (void *model, unsigned char *input, -+ unsigned long sourcelen, unsigned long *dstlen, -+ unsigned long *readtime, unsigned long *writetime) -+{ -+ *dstlen = sourcelen * 55 / 100; -+ *readtime = JFFS2_BBC_ZLIB_READ_TIME / 2; -+ *writetime = JFFS2_BBC_ZLIB_WRITE_TIME * 8 / 10; /* LZO1X-1 is much-much faster, -+ but LZO1X-999 is slow. The default mode for inside kernel compression is LZO1X-1 -+ This should be *0.4 really */ -+ return 0; -+} -+ -+static int -+jffs2_bbc_lzo_decompress (void *model, unsigned char *input, -+ unsigned char *output, unsigned long sourcelen, -+ unsigned long dstlen) -+{ -+ lzo_uint outlen = dstlen; -+ if ( ( *(input++) != (unsigned char)jffs2_bbc_lzo.block_sign[0] ) || -+ ( *(input++) != (unsigned char)jffs2_bbc_lzo.block_sign[1] ) -+ ) { -+ return -1; -+ } else { -+ return lzo1x_decompress (input, sourcelen - 2, output, &outlen, NULL); -+ } -+} -+ -+static char * -+jffs2_bbc_lzo_proc_info (void) -+{ -+ if (lzo1x_compressor_type == 1) -+ { -+ if (lzo1x_optimize_type == 1) -+ { -+ return "LZO1X-1 compression with optimization"; -+ } -+ else -+ { -+ return "LZO1X-1 compression without optimization"; -+ } -+ } -+ else if (lzo1x_compressor_type == 999) -+ { -+ if (lzo1x_optimize_type == 1) -+ { -+ return "LZO1X-999 compression with optimization"; -+ } -+ else -+ { -+ return "LZO1X-999 compression without optimization"; -+ } -+ } -+ else -+ { -+ return "Unknown configuration!"; -+ } -+} -+ -+static int -+jffs2_bbc_lzo_proc_command (char *command) -+{ -+ switch (*command) -+ { -+ case 'o': -+ /* switch optimization off */ -+ lzo1x_optimizer = no_lzo1x_optimize; -+ lzo1x_optimize_type = 0; -+ jffs2_bbc_print1 ("Compression optimization switched off.\n"); -+ return 0; -+ case 'O': -+ /* switch optimization on */ -+ lzo1x_optimizer = lzo1x_optimize; -+ lzo1x_optimize_type = 1; -+ jffs2_bbc_print1 ("Compression optimization switched on.\n"); -+ return 0; -+ case '1': -+ /* switch compression to LZO1X-1 */ -+ jffs2_bbc_free (wrkmem); -+ lzo1x_compressor_type = 1; -+ lzo1x_compressor = lzo1x_1_compress; -+ lzo1x_compressor_memsize = LZO1X_1_MEM_COMPRESS; -+ wrkmem = (lzo_bytep) -+ jffs2_bbc_malloc (lzo1x_compressor_memsize); -+ jffs2_bbc_print1 ("Compression type switched to LZO1X-1.\n"); -+ return 0; -+ case '9': -+ /* switch compression to LZO1X-999 */ -+ jffs2_bbc_free (wrkmem); -+ lzo1x_compressor_type = 999; -+ lzo1x_compressor = lzo1x_999_compress; -+ lzo1x_compressor_memsize = LZO1X_999_MEM_COMPRESS; -+ wrkmem = (lzo_bytep) -+ jffs2_bbc_malloc (lzo1x_compressor_memsize); -+ jffs2_bbc_print1 -+ ("Compression type switched to LZO1X-999.\n"); -+ return 0; -+ default: -+ jffs2_bbc_print1 ("Unknown command!\n"); -+ return 0; -+ } -+} -+ -+ -+struct jffs2_bbc_compressor_type * -+jffs2_bbc_lzo_init (int mode) -+{ -+ if (jffs2_bbc_register_compressor (&jffs2_bbc_lzo) == 0) -+ { -+ return &jffs2_bbc_lzo; -+ } -+ else -+ { -+ return NULL; -+ } -+} -+ -+void -+jffs2_bbc_lzo_deinit (void) -+{ -+ jffs2_bbc_unregister_compressor (&jffs2_bbc_lzo); -+} -diff -Nur linux-mips-cvs/fs/jffs2/jffs2_bbc_lzss_comp.c linux-mips/fs/jffs2/jffs2_bbc_lzss_comp.c ---- linux-mips-cvs/fs/jffs2/jffs2_bbc_lzss_comp.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-mips/fs/jffs2/jffs2_bbc_lzss_comp.c 2005-02-07 05:08:34.000000000 +0100 -@@ -0,0 +1,385 @@ -+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ -+ -+/* -+ jffs2_bbc_lzss_comp.c -- Lempel-Ziv-Storer-Szymanski compression module for jffs2 -+ Copyright (C) 2004 Patrik Kluba -+ Based on the LZSS source included in LDS (lossless datacompression sources) -+ Block-compression modifications by Patrik Kluba -+ $Header$ -+*/ -+ -+/* -+Original copyright follows: -+ -+************************************************************** -+ LZSS.C -- A Data Compression Program -+************************************************************** -+ 4/6/1989 Haruhiko Okumura -+ Use, distribute, and modify this program freely. -+ Please send me your improved versions. -+ PC-VAN SCIENCE -+ NIFTY-Serve PAF01022 -+ CompuServe 74050,1022 -+************************************************************** -+ -+*/ -+ -+/* -+ -+ 2004-02-16 pajko -+ Initial release -+ -+*/ -+ -+/* lzss.c */ -+ -+#define N 4096 /* size of ring buffer */ -+#define F 18 /* upper limit for match_length */ -+#define THRESHOLD 2 /* encode string into position and length -+ if match_length is greater than this */ -+#define NIL N /* index for root of binary search trees */ -+ -+static unsigned char -+ text_buf[N + F - 1]; /* ring buffer of size N, -+ with extra F-1 bytes to facilitate string comparison */ -+static unsigned long match_position, match_length; /* of longest match. These are -+ set by the InsertNode() procedure. */ -+static unsigned long lson[N + 1], rson[N + 257], dad[N + 1]; /* left & right children & -+ parents -- These constitute binary search trees. */ -+ -+static void InitTree(void) /* initialize trees */ -+{ -+ unsigned long i; -+ -+ /* For i = 0 to N - 1, rson[i] and lson[i] will be the right and -+ left children of node i. These nodes need not be initialized. -+ Also, dad[i] is the parent of node i. These are initialized to -+ NIL (= N), which stands for 'not used.' -+ For i = 0 to 255, rson[N + i + 1] is the root of the tree -+ for strings that begin with character i. These are initialized -+ to NIL. Note there are 256 trees. */ -+ -+ for (i = N + 1; i <= N + 256; i++) rson[i] = NIL; -+ for (i = 0; i < N; i++) dad[i] = NIL; -+} -+ -+static void InsertNode(unsigned long r) -+ /* Inserts string of length F, text_buf[r..r+F-1], into one of the -+ trees (text_buf[r]'th tree) and returns the longest-match position -+ and length via the global variables match_position and match_length. -+ If match_length = F, then removes the old node in favor of the new -+ one, because the old one will be deleted sooner. -+ Note r plays double role, as tree node and position in buffer. */ -+{ -+ unsigned long i, p; -+ unsigned char *key; -+ signed long cmp; -+ -+ cmp = 1; key = &text_buf[r]; p = N + 1 + key[0]; -+ rson[r] = lson[r] = NIL; match_length = 0; -+ for ( ; ; ) { -+ if (cmp >= 0) { -+ if (rson[p] != NIL) p = rson[p]; -+ else { rson[p] = r; dad[r] = p; return; } -+ } else { -+ if (lson[p] != NIL) p = lson[p]; -+ else { lson[p] = r; dad[r] = p; return; } -+ } -+ for (i = 1; i < F; i++) -+ if ((cmp = key[i] - text_buf[p + i]) != 0) break; -+ if (i > match_length) { -+ match_position = p; -+ if ((match_length = i) >= F) break; -+ } -+ } -+ dad[r] = dad[p]; lson[r] = lson[p]; rson[r] = rson[p]; -+ dad[lson[p]] = r; dad[rson[p]] = r; -+ if (rson[dad[p]] == p) rson[dad[p]] = r; -+ else lson[dad[p]] = r; -+ dad[p] = NIL; /* remove p */ -+} -+ -+static void DeleteNode(unsigned long p) /* deletes node p from tree */ -+{ -+ unsigned long q; -+ -+ if (dad[p] == NIL) return; /* not in tree */ -+ if (rson[p] == NIL) q = lson[p]; -+ else if (lson[p] == NIL) q = rson[p]; -+ else { -+ q = lson[p]; -+ if (rson[q] != NIL) { -+ do { q = rson[q]; } while (rson[q] != NIL); -+ rson[dad[q]] = lson[q]; dad[lson[q]] = dad[q]; -+ lson[q] = lson[p]; dad[lson[p]] = q; -+ } -+ rson[q] = rson[p]; dad[rson[p]] = q; -+ } -+ dad[q] = dad[p]; -+ if (rson[dad[p]] == p) rson[dad[p]] = q; else lson[dad[p]] = q; -+ dad[p] = NIL; -+} -+ -+/* modified for block compression */ -+/* on return, srclen will contain the number of successfully compressed bytes -+ and dstlen will contain completed compressed bytes */ -+ -+static int Encode(unsigned char *srcbuf, unsigned char *dstbuf, unsigned long *srclen, -+ unsigned long *dstlen) -+{ -+ unsigned long i, len, r, c, s, last_match_length, code_buf_ptr; -+ unsigned char code_buf[17], mask; -+ unsigned char *ip, *op; -+ unsigned long written = 0; -+ unsigned long read = 0; -+ unsigned char *srcend = srcbuf + *srclen; -+ unsigned char *dstend = dstbuf + *dstlen; -+ ip = srcbuf; -+ op = dstbuf; -+ InitTree(); /* initialize trees */ -+ code_buf[0] = 0; /* code_buf[1..16] saves eight units of code, and -+ code_buf[0] works as eight flags, "1" representing that the unit -+ is an unencoded letter (1 byte), "0" a position-and-length pair -+ (2 bytes). Thus, eight units require at most 16 bytes of code. */ -+ code_buf_ptr = mask = 1; -+ s = 0; r = N - F; -+ for (i = s; i < r; i++) text_buf[i] = ' '; /* Clear the buffer with -+ any character that will appear often. */ -+ for (len = 0; (len < F) && (ip < srcend); len++) -+ text_buf[r + len] = *(ip++); /* Read F bytes into the last F bytes of -+ the buffer */ -+ read = len; -+ for (i = 1; i <= F; i++) InsertNode(r - i); /* Insert the F strings, -+ each of which begins with one or more 'space' characters. Note -+ the order in which these strings are inserted. This way, -+ degenerate trees will be less likely to occur. */ -+ InsertNode(r); /* Finally, insert the whole string just read. The -+ global variables match_length and match_position are set. */ -+ do { -+ if (match_length > len) match_length = len; /* match_length -+ may be spuriously long near the end of text. */ -+ if (match_length <= THRESHOLD) { -+ match_length = 1; /* Not long enough match. Send one byte. */ -+ code_buf[0] |= mask; /* 'send one byte' flag */ -+ code_buf[code_buf_ptr++] = text_buf[r]; /* Send uncoded. */ -+ } else { -+ code_buf[code_buf_ptr++] = match_position; -+ code_buf[code_buf_ptr++] = (((match_position >> 4) & 0xf0) -+ | (match_length - (THRESHOLD + 1))); /* Send position and -+ length pair. Note match_length > THRESHOLD. */ -+ } -+ if ((mask <<= 1) == 0) { /* Shift mask left one bit. */ -+ if ((op + code_buf_ptr) > dstend) { -+ *dstlen = written; /* written contains bytes of complete compressed -+ code */ -+ return -1; -+ }; -+ for (i = 0; i < code_buf_ptr; *(op++) = code_buf[i++]); /* Send at most 8 units of */ -+ /* code together */ -+ written += code_buf_ptr; -+ *srclen = read; /* this many bytes have been successfully compressed */ -+ code_buf[0] = 0; code_buf_ptr = mask = 1; -+ } -+ last_match_length = match_length; -+ for (i = 0; (i < last_match_length) && (ip < srcend); i++) { -+ c = *(ip++); -+ DeleteNode(s); /* Delete old strings and */ -+ text_buf[s] = c; /* read new bytes */ -+ if (s < F - 1) text_buf[s + N] = c; /* If the position is -+ near the end of buffer, extend the buffer to make -+ string comparison easier. */ -+ s = (s + 1) & (N - 1); r = (r + 1) & (N - 1); -+ /* Since this is a ring buffer, increment the position -+ modulo N. */ -+ InsertNode(r); /* Register the string in text_buf[r..r+F-1] */ -+ } -+ read += i; -+ while (i++ < last_match_length) { /* After the end of text, */ -+ DeleteNode(s); /* no need to read, but */ -+ s = (s + 1) & (N - 1); r = (r + 1) & (N - 1); -+ if (--len) InsertNode(r); /* buffer may not be empty. */ -+ } -+ } while (len > 0); /* until length of string to be processed is zero */ -+ if (code_buf_ptr > 1) { /* Send remaining code. */ -+ if ((op + code_buf_ptr) > dstend) { -+ *dstlen = written; -+ return -1; -+ } -+ for (i = 0; i < code_buf_ptr; *(op++) = code_buf[i++]); -+ written += code_buf_ptr; -+ *srclen = read; -+ } -+ *dstlen = written; -+ return 0; -+} -+ -+static int Decode(unsigned char *srcbuf, unsigned char *dstbuf, unsigned long srclen, -+ unsigned long dstlen) /* Just the reverse of Encode(). */ -+{ -+ unsigned long i, r, c, j, k, flags; -+ unsigned char *ip, *op; -+ unsigned long written; -+ unsigned long read; -+ unsigned char *srcend = srcbuf + srclen; -+ unsigned char *dstend = dstbuf + dstlen; -+ read = written = 0; -+ ip = srcbuf; -+ op = dstbuf; -+ for (i = 0; i < N - F; i++) text_buf[i] = ' '; -+ r = N - F; flags = 0; -+ for ( ; ; ) { -+ if (((flags >>= 1) & 256) == 0) { -+ if (ip >= srcend) return 0; -+ c = *(ip++); -+ flags = c | 0xff00; /* uses higher byte cleverly */ -+ } /* to count eight */ -+ if (flags & 1) { -+ if (ip >= srcend) return 0; -+ c = *(ip++); -+ if (op >= dstend) return -1; -+ *(op++) = text_buf[r++] = c; r &= (N - 1); -+ } else { -+ if ((ip + 2) > srcend) return 0; -+ i = *(ip++); -+ j = *(ip++); -+ i |= ((j & 0xf0) << 4); j = (j & 0x0f) + THRESHOLD; -+ if ((op + j + 1) > dstend) return -1; -+ for (k = 0; k <= j; k++) { -+ c = text_buf[(i + k) & (N - 1)]; -+ *(op++) = text_buf[r++] = c; r &= (N - 1); -+ } -+ } -+ } -+} -+ -+/* interface to jffs2 bbc follows */ -+ -+#include "jffs2_bbc_framework.h" -+ -+ -+#define JFFS2_BBC_LZSS_BLOCK_SIGN {0x27, 0x6f, 0x12, 0xc4} -+ -+static int -+jffs2_bbc_lzss_compressor_init (void); -+ -+static void -+jffs2_bbc_lzss_compressor_deinit (void); -+ -+static int -+jffs2_bbc_lzss_compress (void *model, unsigned char *input, -+ unsigned char *output, unsigned long *sourcelen, -+ unsigned long *dstlen); -+ -+static int -+jffs2_bbc_lzss_estimate (void *model, unsigned char *input, -+ unsigned long sourcelen, unsigned long *dstlen, -+ unsigned long *readtime, unsigned long *writetime); -+ -+static int -+jffs2_bbc_lzss_decompress (void *model, unsigned char *input, -+ unsigned char *output, unsigned long sourcelen, -+ unsigned long dstlen); -+ -+static char * -+jffs2_bbc_lzss_proc_info (void); -+ -+static int -+jffs2_bbc_lzss_proc_command (char *command); -+ -+struct jffs2_bbc_compressor_type jffs2_bbc_lzss = { -+ "lzss", -+ 0, -+ JFFS2_BBC_LZSS_BLOCK_SIGN, -+ jffs2_bbc_lzss_compressor_init, -+ NULL, -+ NULL, -+ jffs2_bbc_lzss_compressor_deinit, -+ jffs2_bbc_lzss_compress, -+ jffs2_bbc_lzss_estimate, -+ jffs2_bbc_lzss_decompress, -+ jffs2_bbc_lzss_proc_info, -+ jffs2_bbc_lzss_proc_command -+}; -+ -+static int -+jffs2_bbc_lzss_compressor_init (void) -+{ -+ return 0; -+} -+ -+static void -+jffs2_bbc_lzss_compressor_deinit (void) -+{ -+} -+ -+static int -+jffs2_bbc_lzss_compress (void *model, unsigned char *input, -+ unsigned char *output, unsigned long *sourcelen, -+ unsigned long *dstlen) -+{ -+ int retval; -+ unsigned long dst = *dstlen; -+ *(output++) = jffs2_bbc_lzss.block_sign[0]; -+ *(output++) = jffs2_bbc_lzss.block_sign[1]; -+ dst -= 2; -+ retval = Encode(input, output, sourcelen, &dst); -+ dst += 2; -+ *dstlen = dst; -+ return retval; -+} -+ -+static int -+jffs2_bbc_lzss_estimate (void *model, unsigned char *input, -+ unsigned long sourcelen, unsigned long *dstlen, -+ unsigned long *readtime, unsigned long *writetime) -+{ -+ *dstlen = sourcelen * 60 / 100; -+ *readtime = JFFS2_BBC_ZLIB_READ_TIME * 12 / 10; -+ *writetime = JFFS2_BBC_ZLIB_WRITE_TIME * 3; -+ return 0; -+} -+ -+static int -+jffs2_bbc_lzss_decompress (void *model, unsigned char *input, -+ unsigned char *output, unsigned long sourcelen, -+ unsigned long dstlen) -+{ -+ if ( ( *(input++) != (unsigned char)jffs2_bbc_lzss.block_sign[0] ) || -+ ( *(input++) != (unsigned char)jffs2_bbc_lzss.block_sign[1] ) -+ ) { -+ return -1; -+ } else { -+ return Decode(input, output, sourcelen - 2, dstlen); -+ } -+} -+ -+static char * -+jffs2_bbc_lzss_proc_info (void) -+{ -+ return "Lempel-Ziv-Storer-Szymanski compression module"; -+} -+ -+static int -+jffs2_bbc_lzss_proc_command (char *command) -+{ -+ return 0; -+} -+ -+struct jffs2_bbc_compressor_type * -+jffs2_bbc_lzss_init (int mode) -+{ -+ if (jffs2_bbc_register_compressor (&jffs2_bbc_lzss) == 0) -+ { -+ return &jffs2_bbc_lzss; -+ } -+ else -+ { -+ return NULL; -+ } -+} -+ -+void -+jffs2_bbc_lzss_deinit (void) -+{ -+ jffs2_bbc_unregister_compressor (&jffs2_bbc_lzss); -+} -diff -Nur linux-mips-cvs/fs/jffs2/linux-2.4.25.hpatch linux-mips/fs/jffs2/linux-2.4.25.hpatch ---- linux-mips-cvs/fs/jffs2/linux-2.4.25.hpatch 1970-01-01 01:00:00.000000000 +0100 -+++ linux-mips/fs/jffs2/linux-2.4.25.hpatch 2005-02-07 05:08:34.000000000 +0100 -@@ -0,0 +1,97 @@ -+FMakefile -+=BBC insertion -+-COMPR_OBJS -+iMakefile.bbc.inc -++ -+I -+?JFFS2_OBJS -++ $(JFFS2_BBC_KERNEL_OBJS) \ -+ -+F../Config.in -+=BBC insertion -+-tristate 'Compressed ROM file system support' CONFIG_CRAMFS -+iConfig.in.bbc.inc -++ -+I -+F../../Documentation/Configure.help -+=BBC insertion -+-JFFS stats available -+iConfigure.help.bbc.inc -++ -+I -+Fcompr_zlib.c -+=(de)compress->(de)compress2 -+-int zlib_compress(unsigned char *data_in, unsigned char *cpage_out, -++int jffs2_zlib_compress2(unsigned char *data_in, unsigned char *cpage_out, -+-void zlib_decompress(unsigned char *data_in, unsigned char *cpage_out, -++void jffs2_zlib_decompress2(unsigned char *data_in, unsigned char *cpage_out, -+?inflateEnd(&strm); -+?} -++ -++extern int jffs2_zlib_compress(unsigned char *data_in, unsigned char *cpage_out, __u32 * sourcelen, __u32 * dstlen); -++extern void jffs2_zlib_decompress(unsigned char *data_in, unsigned char *cpage_out, __u32 srclen, __u32 destlen); -++ -++int zlib_compress(unsigned char *data_in, unsigned char *cpage_out, -++ __u32 *sourcelen, __u32 *dstlen) -++{ -++ return jffs2_zlib_compress(data_in,cpage_out,sourcelen,dstlen); -++} -++ -++void zlib_decompress(unsigned char *data_in, unsigned char *cpage_out, -++ __u32 srclen, __u32 destlen) -++{ -++ jffs2_zlib_decompress(data_in,cpage_out,srclen,destlen); -++} -++ -+ -+Ffile.c -+=set_act_sb before write -+-#include -++#include "jffs2_bbc_framework.h" /**BBC**/ -+I -+?int jffs2_commit_write -+-jffs2_compress( -++ jffs2_bbc_model_set_act_sb(c); /**BBC**/ -+I -+ -+Fgc.c -+=set_act_sb before write -+-#include -++#include "jffs2_bbc_framework.h" /**BBC**/ -+I -+?int jffs2_garbage_collect_dnode( -+-jffs2_compress( -++ jffs2_bbc_model_set_act_sb(c); /**BBC**/ -+I -+ -+Fread.c -+=set_act_sb before read -+-#include -++#include "jffs2_bbc_framework.h" /**BBC**/ -+I -+?int jffs2_read_dnode( -+-jffs2_decompress( -++ jffs2_bbc_model_set_act_sb(c); /**BBC**/ -+I -+ -+Fsuper.c -+=init, load_model -+-#include -++#include "jffs2_bbc_fs.h" /**BBC**/ -+I -+?struct super_block *jffs2_read_super( -+-return sb; -++ jffs2_bbc_load_model(sb); /**BBC**/ -+I -+?void jffs2_put_super -+?c = JFFS2_SB_INFO -++ jffs2_bbc_unload_model(sb); /**BBC**/ -+?init_jffs2_fs(void) -+?int ret; -++ -++ jffs2_bbc_proc_init(); /**BBC**/ -++ -+?exit_jffs2_fs(void) -+?{ -++ jffs2_bbc_proc_deinit(); /**BBC**/ -++ -diff -Nur linux-mips-cvs/fs/jffs2/read.c linux-mips/fs/jffs2/read.c ---- linux-mips-cvs/fs/jffs2/read.c 2003-11-17 02:07:44.000000000 +0100 -+++ linux-mips/fs/jffs2/read.c 2005-02-07 05:08:35.000000000 +0100 -@@ -35,6 +35,7 @@ - * - */ - -+#include "jffs2_bbc_framework.h" /**BBC**/ - #include - #include - #include -@@ -140,6 +141,7 @@ - D2(printk(KERN_DEBUG "Data CRC matches calculated CRC %08x\n", crc)); - if (ri->compr != JFFS2_COMPR_NONE) { - D2(printk(KERN_DEBUG "Decompress %d bytes from %p to %d bytes at %p\n", ri->csize, readbuf, ri->dsize, decomprbuf)); -+ jffs2_bbc_model_set_act_sb(c); /**BBC**/ - ret = jffs2_decompress(ri->compr, readbuf, decomprbuf, ri->csize, ri->dsize); - if (ret) { - printk(KERN_WARNING "Error: jffs2_decompress returned %d\n", ret); -diff -Nur linux-mips-cvs/fs/jffs2/super.c linux-mips/fs/jffs2/super.c ---- linux-mips-cvs/fs/jffs2/super.c 2003-01-11 18:53:17.000000000 +0100 -+++ linux-mips/fs/jffs2/super.c 2005-02-07 05:08:35.000000000 +0100 -@@ -35,6 +35,7 @@ - * - */ - -+#include "jffs2_bbc_fs.h" /**BBC**/ - #include - #include - #include -@@ -272,6 +273,7 @@ - sb->s_magic = JFFS2_SUPER_MAGIC; - if (!(sb->s_flags & MS_RDONLY)) - jffs2_start_garbage_collect_thread(c); -+ jffs2_bbc_load_model(sb); /**BBC**/ - return sb; - - out_root_i: -@@ -288,6 +290,7 @@ - void jffs2_put_super (struct super_block *sb) - { - struct jffs2_sb_info *c = JFFS2_SB_INFO(sb); -+ jffs2_bbc_unload_model(sb); /**BBC**/ - - D2(printk(KERN_DEBUG "jffs2: jffs2_put_super()\n")); - -@@ -344,6 +347,9 @@ - { - int ret; - -+ jffs2_bbc_proc_init(); /**BBC**/ -+ -+ - printk(KERN_NOTICE "JFFS2 version 2.1. (C) 2001 Red Hat, Inc., designed by Axis Communications AB.\n"); - - #ifdef JFFS2_OUT_OF_KERNEL -@@ -388,6 +394,8 @@ - - static void __exit exit_jffs2_fs(void) - { -+ jffs2_bbc_proc_deinit(); /**BBC**/ -+ - jffs2_destroy_slab_caches(); - jffs2_zlib_exit(); - unregister_filesystem(&jffs2_fs_type); diff --git a/openwrt/package/linux/kernel-patches/302-ebtables b/openwrt/package/linux/kernel-patches/302-ebtables deleted file mode 100644 index b1c34abe4d..0000000000 --- a/openwrt/package/linux/kernel-patches/302-ebtables +++ /dev/null @@ -1,7012 +0,0 @@ ---- linux-2.4.29/net/bridge/br_private.h 2004-08-08 01:26:06.000000000 +0200 -+++ linux-2.4.29-ebt-brnf/net/bridge/br_private.h 2005-03-14 21:24:04.000000000 +0100 -@@ -143,8 +143,10 @@ extern void br_fdb_insert(struct net_bri - /* br_forward.c */ - extern void br_deliver(struct net_bridge_port *to, - struct sk_buff *skb); -+extern int br_dev_queue_push_xmit(struct sk_buff *skb); - extern void br_forward(struct net_bridge_port *to, - struct sk_buff *skb); -+extern int br_forward_finish(struct sk_buff *skb); - extern void br_flood_deliver(struct net_bridge *br, - struct sk_buff *skb, - int clone); -@@ -165,7 +167,8 @@ extern void br_get_port_ifindices(struct - int *ifindices); - - /* br_input.c */ --extern void br_handle_frame(struct sk_buff *skb); -+extern int br_handle_frame_finish(struct sk_buff *skb); -+extern int br_handle_frame(struct sk_buff *skb); - - /* br_ioctl.c */ - extern int br_ioctl(struct net_bridge *br, -@@ -175,6 +178,10 @@ extern int br_ioctl(struct net_bridge *b - unsigned long arg2); - extern int br_ioctl_deviceless_stub(unsigned long arg); - -+/* br_netfilter.c */ -+extern int br_netfilter_init(void); -+extern void br_netfilter_fini(void); -+ - /* br_stp.c */ - extern int br_is_root_bridge(struct net_bridge *br); - extern struct net_bridge_port *br_get_port(struct net_bridge *br, ---- linux-2.4.29/include/linux/if_bridge.h 2001-11-22 20:47:12.000000000 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/if_bridge.h 2005-03-14 21:11:28.000000000 +0100 -@@ -102,7 +102,8 @@ struct net_bridge; - struct net_bridge_port; - - extern int (*br_ioctl_hook)(unsigned long arg); --extern void (*br_handle_frame_hook)(struct sk_buff *skb); -+extern int (*br_handle_frame_hook)(struct sk_buff *skb); -+extern int (*br_should_route_hook)(struct sk_buff **pskb); - - #endif - ---- linux-2.4.29/net/core/dev.c 2004-04-14 15:05:41.000000000 +0200 -+++ linux-2.4.29-ebt-brnf/net/core/dev.c 2005-03-14 00:00:29.000000000 +0100 -@@ -1426,7 +1426,7 @@ static void net_tx_action(struct softirq - - - #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) --void (*br_handle_frame_hook)(struct sk_buff *skb) = NULL; -+int (*br_handle_frame_hook)(struct sk_buff *skb) = NULL; - #endif - - static __inline__ int handle_bridge(struct sk_buff *skb, -@@ -1443,7 +1443,6 @@ static __inline__ int handle_bridge(stru - } - } - -- br_handle_frame_hook(skb); - return ret; - } - -@@ -1503,7 +1502,12 @@ int netif_receive_skb(struct sk_buff *sk - #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) - if (skb->dev->br_port != NULL && br_handle_frame_hook != NULL && - skb->pkt_type != PACKET_LOOPBACK) { -- return handle_bridge(skb, pt_prev); -+ int ret; -+ -+ ret = handle_bridge(skb, pt_prev); -+ if (br_handle_frame_hook(skb) == 0) -+ return ret; -+ pt_prev = NULL; - } - #endif - ---- linux-2.4.29/net/bridge/br_input.c 2003-08-25 13:44:44.000000000 +0200 -+++ linux-2.4.29-ebt-brnf/net/bridge/br_input.c 2005-03-14 00:00:29.000000000 +0100 -@@ -24,6 +24,9 @@ unsigned char bridge_ula[6] = { 0x01, 0x - - static int br_pass_frame_up_finish(struct sk_buff *skb) - { -+#ifdef CONFIG_NETFILTER_DEBUG -+ skb->nf_debug = 0; -+#endif - netif_rx(skb); - - return 0; -@@ -46,7 +49,7 @@ static void br_pass_frame_up(struct net_ - br_pass_frame_up_finish); - } - --static int br_handle_frame_finish(struct sk_buff *skb) -+int br_handle_frame_finish(struct sk_buff *skb) - { - struct net_bridge *br; - unsigned char *dest; -@@ -112,7 +115,7 @@ err_nolock: - return 0; - } - --void br_handle_frame(struct sk_buff *skb) -+int br_handle_frame(struct sk_buff *skb) - { - struct net_bridge *br; - unsigned char *dest; -@@ -146,26 +149,35 @@ void br_handle_frame(struct sk_buff *skb - goto handle_special_frame; - - if (p->state == BR_STATE_FORWARDING) { -+ if (br_should_route_hook && br_should_route_hook(&skb)) { -+ read_unlock(&br->lock); -+ return -1; -+ } -+ -+ if (!memcmp(p->br->dev.dev_addr, dest, ETH_ALEN)) -+ skb->pkt_type = PACKET_HOST; -+ - NF_HOOK(PF_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL, - br_handle_frame_finish); - read_unlock(&br->lock); -- return; -+ return 0; - } - - err: - read_unlock(&br->lock); - err_nolock: - kfree_skb(skb); -- return; -+ return 0; - - handle_special_frame: - if (!dest[5]) { - NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_IN, skb, skb->dev,NULL, - br_stp_handle_bpdu); - read_unlock(&br->lock); -- return; -+ return 0; - } - - read_unlock(&br->lock); - kfree_skb(skb); -+ return 0; - } ---- linux-2.4.29/net/bridge/br_forward.c 2003-11-28 19:26:21.000000000 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/br_forward.c 2005-03-14 00:00:29.000000000 +0100 -@@ -30,18 +30,21 @@ static inline int should_deliver(struct - return 1; - } - --static int __dev_queue_push_xmit(struct sk_buff *skb) -+int br_dev_queue_push_xmit(struct sk_buff *skb) - { -+#ifdef CONFIG_NETFILTER -+ nf_bridge_maybe_copy_header(skb); -+#endif - skb_push(skb, ETH_HLEN); - dev_queue_xmit(skb); - - return 0; - } - --static int __br_forward_finish(struct sk_buff *skb) -+int br_forward_finish(struct sk_buff *skb) - { - NF_HOOK(PF_BRIDGE, NF_BR_POST_ROUTING, skb, NULL, skb->dev, -- __dev_queue_push_xmit); -+ br_dev_queue_push_xmit); - - return 0; - } -@@ -49,8 +52,11 @@ static int __br_forward_finish(struct sk - static void __br_deliver(struct net_bridge_port *to, struct sk_buff *skb) - { - skb->dev = to->dev; -+#ifdef CONFIG_NETFILTER_DEBUG -+ skb->nf_debug = 0; -+#endif - NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev, -- __br_forward_finish); -+ br_forward_finish); - } - - static void __br_forward(struct net_bridge_port *to, struct sk_buff *skb) -@@ -62,7 +68,7 @@ static void __br_forward(struct net_brid - skb->ip_summed = CHECKSUM_NONE; - - NF_HOOK(PF_BRIDGE, NF_BR_FORWARD, skb, indev, skb->dev, -- __br_forward_finish); -+ br_forward_finish); - } - - /* called under bridge lock */ ---- linux-2.4.29/net/bridge/br.c 2004-08-08 01:26:06.000000000 +0200 -+++ linux-2.4.29-ebt-brnf/net/bridge/br.c 2005-03-14 00:00:29.000000000 +0100 -@@ -30,6 +30,8 @@ - #include "../atm/lec.h" - #endif - -+int (*br_should_route_hook) (struct sk_buff **pskb) = NULL; -+ - void br_dec_use_count() - { - MOD_DEC_USE_COUNT; -@@ -44,6 +46,10 @@ static int __init br_init(void) - { - printk(KERN_INFO "NET4: Ethernet Bridge 008 for NET4.0\n"); - -+#ifdef CONFIG_NETFILTER -+ if (br_netfilter_init()) -+ return 1; -+#endif - br_handle_frame_hook = br_handle_frame; - br_ioctl_hook = br_ioctl_deviceless_stub; - #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) -@@ -57,6 +63,9 @@ static int __init br_init(void) - - static void __exit br_deinit(void) - { -+#ifdef CONFIG_NETFILTER -+ br_netfilter_fini(); -+#endif - unregister_netdevice_notifier(&br_device_notifier); - - rtnl_lock(); -@@ -73,7 +82,7 @@ static void __exit br_deinit(void) - #endif - } - --EXPORT_NO_SYMBOLS; -+EXPORT_SYMBOL(br_should_route_hook); - - module_init(br_init) - module_exit(br_deinit) ---- linux-2.4.29/net/bridge/Makefile 2000-12-29 23:07:24.000000000 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/Makefile 2005-03-14 00:00:29.000000000 +0100 -@@ -7,10 +7,17 @@ - # - # Note 2! The CFLAGS definition is now in the main makefile... - -+export-objs := br.o -+ - O_TARGET := bridge.o - obj-y := br.o br_device.o br_fdb.o br_forward.o br_if.o br_input.o \ - br_ioctl.o br_notify.o br_stp.o br_stp_bpdu.o \ - br_stp_if.o br_stp_timer.o -+ -+ifeq ($(CONFIG_NETFILTER),y) -+obj-y += br_netfilter.o -+endif -+ - obj-m := $(O_TARGET) - - include $(TOPDIR)/Rules.make ---- linux-2.4.29/include/linux/netfilter_bridge.h 2001-06-12 04:15:27.000000000 +0200 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_bridge.h 2005-03-14 21:24:06.000000000 +0100 -@@ -6,6 +6,10 @@ - - #include - #include -+#if defined(__KERNEL__) && defined(CONFIG_NETFILTER) -+#include -+#include -+#endif - - /* Bridge Hooks */ - /* After promisc drops, checksum checks. */ -@@ -18,7 +22,76 @@ - #define NF_BR_LOCAL_OUT 3 - /* Packets about to hit the wire. */ - #define NF_BR_POST_ROUTING 4 --#define NF_BR_NUMHOOKS 5 -+/* Not really a hook, but used for the ebtables broute table */ -+#define NF_BR_BROUTING 5 -+#define NF_BR_NUMHOOKS 6 -+ -+#ifdef __KERNEL__ -+ -+#define BRNF_PKT_TYPE 0x01 -+#define BRNF_BRIDGED_DNAT 0x02 -+#define BRNF_DONT_TAKE_PARENT 0x04 -+#define BRNF_BRIDGED 0x08 -+#define BRNF_NF_BRIDGE_PREROUTING 0x10 -+ -+enum nf_br_hook_priorities { -+ NF_BR_PRI_FIRST = INT_MIN, -+ NF_BR_PRI_NAT_DST_BRIDGED = -300, -+ NF_BR_PRI_FILTER_BRIDGED = -200, -+ NF_BR_PRI_BRNF = 0, -+ NF_BR_PRI_NAT_DST_OTHER = 100, -+ NF_BR_PRI_FILTER_OTHER = 200, -+ NF_BR_PRI_NAT_SRC = 300, -+ NF_BR_PRI_LAST = INT_MAX, -+}; -+ -+#ifdef CONFIG_NETFILTER -+static inline -+struct nf_bridge_info *nf_bridge_alloc(struct sk_buff *skb) -+{ -+ struct nf_bridge_info **nf_bridge = &(skb->nf_bridge); -+ -+ if ((*nf_bridge = kmalloc(sizeof(**nf_bridge), GFP_ATOMIC)) != NULL) { -+ atomic_set(&(*nf_bridge)->use, 1); -+ (*nf_bridge)->mask = 0; -+ (*nf_bridge)->physindev = (*nf_bridge)->physoutdev = NULL; -+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) -+ (*nf_bridge)->netoutdev = NULL; -+#endif -+ } -+ -+ return *nf_bridge; -+} -+ -+/* Only used in br_forward.c */ -+static inline -+void nf_bridge_maybe_copy_header(struct sk_buff *skb) -+{ -+ if (skb->nf_bridge) { -+ if (skb->protocol == __constant_htons(ETH_P_8021Q)) { -+ memcpy(skb->data - 18, skb->nf_bridge->data, 18); -+ skb_push(skb, 4); -+ } else -+ memcpy(skb->data - 16, skb->nf_bridge->data, 16); -+ } -+} -+ -+static inline -+void nf_bridge_save_header(struct sk_buff *skb) -+{ -+ int header_size = 16; -+ -+ if (skb->protocol == __constant_htons(ETH_P_8021Q)) -+ header_size = 18; -+ memcpy(skb->nf_bridge->data, skb->data - header_size, header_size); -+} - -+struct bridge_skb_cb { -+ union { -+ __u32 ipv4; -+ } daddr; -+}; -+#endif /* CONFIG_NETFILTER */ - -+#endif /* __KERNEL__ */ - #endif ---- linux-2.4.29/include/linux/netfilter_ipv4/ip_tables.h 2004-08-08 01:26:06.000000000 +0200 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_ipv4/ip_tables.h 2005-03-14 21:24:28.000000000 +0100 -@@ -159,7 +159,7 @@ struct ipt_entry - #define IPT_CONTINUE 0xFFFFFFFF - - /* For standard target */ --#define IPT_RETURN (-NF_MAX_VERDICT - 1) -+#define IPT_RETURN (-NF_REPEAT - 1) - - /* TCP matching stuff */ - struct ipt_tcp ---- linux-2.4.29/include/linux/netfilter_ipv6/ip6_tables.h 2004-08-08 01:26:06.000000000 +0200 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_ipv6/ip6_tables.h 2005-03-14 00:00:29.000000000 +0100 -@@ -167,7 +167,7 @@ struct ip6t_entry - #define IP6T_CONTINUE 0xFFFFFFFF - - /* For standard target */ --#define IP6T_RETURN (-NF_MAX_VERDICT - 1) -+#define IP6T_RETURN (-NF_REPEAT - 1) - - /* TCP matching stuff */ - struct ip6t_tcp ---- linux-2.4.29/include/linux/netfilter_arp/arp_tables.h 2003-08-25 13:44:44.000000000 +0200 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_arp/arp_tables.h 2005-03-14 21:24:31.000000000 +0100 -@@ -154,7 +154,7 @@ struct arpt_entry - #define ARPT_CONTINUE 0xFFFFFFFF - - /* For standard target */ --#define ARPT_RETURN (-NF_MAX_VERDICT - 1) -+#define ARPT_RETURN (-NF_REPEAT - 1) - - /* The argument to ARPT_SO_GET_INFO */ - struct arpt_getinfo ---- linux-2.4.29/net/Makefile 2004-08-08 01:26:06.000000000 +0200 -+++ linux-2.4.29-ebt-brnf/net/Makefile 2005-03-14 00:00:29.000000000 +0100 -@@ -7,7 +7,8 @@ - - O_TARGET := network.o - --mod-subdirs := ipv4/netfilter ipv6/netfilter ipx irda bluetooth atm netlink sched core sctp 802 -+mod-subdirs := ipv4/netfilter ipv6/netfilter bridge/netfilter ipx irda \ -+ bluetooth atm netlink sched core sctp 802 - export-objs := netsyms.o - - subdir-y := core ethernet -@@ -27,6 +28,12 @@ subdir-$(CONFIG_NETFILTER) += ipv6/netfi - endif - endif - -+ifneq ($(CONFIG_BRIDGE),n) -+ifneq ($(CONFIG_BRIDGE),) -+subdir-$(CONFIG_BRIDGE) += bridge/netfilter -+endif -+endif -+ - subdir-$(CONFIG_KHTTPD) += khttpd - subdir-$(CONFIG_PACKET) += packet - subdir-$(CONFIG_NET_SCHED) += sched ---- linux-2.4.29/net/Config.in 2005-01-19 15:10:13.000000000 +0100 -+++ linux-2.4.29-ebt-brnf/net/Config.in 2005-03-14 00:00:29.000000000 +0100 -@@ -70,6 +70,9 @@ if [ "$CONFIG_DECNET" != "n" ]; then - source net/decnet/Config.in - fi - dep_tristate '802.1d Ethernet Bridging' CONFIG_BRIDGE $CONFIG_INET -+if [ "$CONFIG_BRIDGE" != "n" -a "$CONFIG_NETFILTER" != "n" ]; then -+ source net/bridge/netfilter/Config.in -+fi - if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - tristate 'CCITT X.25 Packet Layer (EXPERIMENTAL)' CONFIG_X25 - tristate 'LAPB Data Link Driver (EXPERIMENTAL)' CONFIG_LAPB ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/Makefile 2005-03-14 00:00:29.000000000 +0100 -@@ -0,0 +1,34 @@ -+# -+# Makefile for the netfilter modules on top of bridging. -+# -+# Note! Dependencies are done automagically by 'make dep', which also -+# removes any old dependencies. DON'T put your own dependencies here -+# unless it's something special (ie not a .c file). -+# -+# Note 2! The CFLAGS definition is now in the main makefile... -+ -+O_TARGET := netfilter.o -+ -+export-objs := ebtables.o -+ -+obj-$(CONFIG_BRIDGE_NF_EBTABLES) += ebtables.o -+obj-$(CONFIG_BRIDGE_EBT_T_FILTER) += ebtable_filter.o -+obj-$(CONFIG_BRIDGE_EBT_T_NAT) += ebtable_nat.o -+obj-$(CONFIG_BRIDGE_EBT_BROUTE) += ebtable_broute.o -+obj-$(CONFIG_BRIDGE_EBT_802_3) += ebt_802_3.o -+obj-$(CONFIG_BRIDGE_EBT_ARPF) += ebt_arp.o -+obj-$(CONFIG_BRIDGE_EBT_AMONG) += ebt_among.o -+obj-$(CONFIG_BRIDGE_EBT_IPF) += ebt_ip.o -+obj-$(CONFIG_BRIDGE_EBT_LIMIT) += ebt_limit.o -+obj-$(CONFIG_BRIDGE_EBT_MARKF) += ebt_mark_m.o -+obj-$(CONFIG_BRIDGE_EBT_PKTTYPE) += ebt_pkttype.o -+obj-$(CONFIG_BRIDGE_EBT_STP) += ebt_stp.o -+obj-$(CONFIG_BRIDGE_EBT_VLANF) += ebt_vlan.o -+obj-$(CONFIG_BRIDGE_EBT_LOG) += ebt_log.o -+obj-$(CONFIG_BRIDGE_EBT_LOG) += ebt_ulog.o -+obj-$(CONFIG_BRIDGE_EBT_ARPREPLY) += ebt_arpreply.o -+obj-$(CONFIG_BRIDGE_EBT_DNAT) += ebt_dnat.o -+obj-$(CONFIG_BRIDGE_EBT_MARK_T) += ebt_mark.o -+obj-$(CONFIG_BRIDGE_EBT_REDIRECT) += ebt_redirect.o -+obj-$(CONFIG_BRIDGE_EBT_SNAT) += ebt_snat.o -+include $(TOPDIR)/Rules.make ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/Config.in 2005-03-14 00:00:29.000000000 +0100 -@@ -0,0 +1,23 @@ -+# -+# Bridge netfilter configuration -+# -+dep_tristate ' Bridge: ebtables' CONFIG_BRIDGE_NF_EBTABLES $CONFIG_BRIDGE -+dep_tristate ' ebt: filter table support' CONFIG_BRIDGE_EBT_T_FILTER $CONFIG_BRIDGE_NF_EBTABLES -+dep_tristate ' ebt: nat table support' CONFIG_BRIDGE_EBT_T_NAT $CONFIG_BRIDGE_NF_EBTABLES -+dep_tristate ' ebt: broute table support' CONFIG_BRIDGE_EBT_BROUTE $CONFIG_BRIDGE_NF_EBTABLES -+dep_tristate ' ebt: log support' CONFIG_BRIDGE_EBT_LOG $CONFIG_BRIDGE_NF_EBTABLES -+dep_tristate ' ebt: ulog support' CONFIG_BRIDGE_EBT_LOG $CONFIG_BRIDGE_NF_EBTABLES -+dep_tristate ' ebt: IP filter support' CONFIG_BRIDGE_EBT_IPF $CONFIG_BRIDGE_NF_EBTABLES -+dep_tristate ' ebt: ARP filter support' CONFIG_BRIDGE_EBT_ARPF $CONFIG_BRIDGE_NF_EBTABLES -+dep_tristate ' ebt: among filter support' CONFIG_BRIDGE_EBT_AMONG $CONFIG_BRIDGE_NF_EBTABLES -+dep_tristate ' ebt: limit filter support' CONFIG_BRIDGE_EBT_LIMIT $CONFIG_BRIDGE_NF_EBTABLES -+dep_tristate ' ebt: 802.1Q VLAN filter support' CONFIG_BRIDGE_EBT_VLANF $CONFIG_BRIDGE_NF_EBTABLES -+dep_tristate ' ebt: 802.3 filter support' CONFIG_BRIDGE_EBT_802_3 $CONFIG_BRIDGE_NF_EBTABLES -+dep_tristate ' ebt: packet type filter support' CONFIG_BRIDGE_EBT_PKTTYPE $CONFIG_BRIDGE_NF_EBTABLES -+dep_tristate ' ebt: STP filter support' CONFIG_BRIDGE_EBT_STP $CONFIG_BRIDGE_NF_EBTABLES -+dep_tristate ' ebt: mark filter support' CONFIG_BRIDGE_EBT_MARKF $CONFIG_BRIDGE_NF_EBTABLES -+dep_tristate ' ebt: arp reply target support' CONFIG_BRIDGE_EBT_ARPREPLY $CONFIG_BRIDGE_NF_EBTABLES -+dep_tristate ' ebt: snat target support' CONFIG_BRIDGE_EBT_SNAT $CONFIG_BRIDGE_NF_EBTABLES -+dep_tristate ' ebt: dnat target support' CONFIG_BRIDGE_EBT_DNAT $CONFIG_BRIDGE_NF_EBTABLES -+dep_tristate ' ebt: redirect target support' CONFIG_BRIDGE_EBT_REDIRECT $CONFIG_BRIDGE_NF_EBTABLES -+dep_tristate ' ebt: mark target support' CONFIG_BRIDGE_EBT_MARK_T $CONFIG_BRIDGE_NF_EBTABLES ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/ebtable_filter.c 2005-03-14 00:00:29.000000000 +0100 -@@ -0,0 +1,90 @@ -+/* -+ * ebtable_filter -+ * -+ * Authors: -+ * Bart De Schuymer -+ * -+ * April, 2002 -+ * -+ */ -+ -+#include -+#include -+ -+#define FILTER_VALID_HOOKS ((1 << NF_BR_LOCAL_IN) | (1 << NF_BR_FORWARD) | \ -+ (1 << NF_BR_LOCAL_OUT)) -+ -+static struct ebt_entries initial_chains[] = -+{ -+ {0, "INPUT", 0, EBT_ACCEPT, 0}, -+ {0, "FORWARD", 0, EBT_ACCEPT, 0}, -+ {0, "OUTPUT", 0, EBT_ACCEPT, 0} -+}; -+ -+static struct ebt_replace initial_table = -+{ -+ "filter", FILTER_VALID_HOOKS, 0, 3 * sizeof(struct ebt_entries), -+ { [NF_BR_LOCAL_IN]&initial_chains[0], [NF_BR_FORWARD]&initial_chains[1], -+ [NF_BR_LOCAL_OUT]&initial_chains[2] }, 0, NULL, (char *)initial_chains -+}; -+ -+static int check(const struct ebt_table_info *info, unsigned int valid_hooks) -+{ -+ if (valid_hooks & ~FILTER_VALID_HOOKS) -+ return -EINVAL; -+ return 0; -+} -+ -+static struct ebt_table frame_filter = -+{ -+ {NULL, NULL}, "filter", &initial_table, FILTER_VALID_HOOKS, -+ RW_LOCK_UNLOCKED, check, NULL -+}; -+ -+static unsigned int -+ebt_hook (unsigned int hook, struct sk_buff **pskb, const struct net_device *in, -+ const struct net_device *out, int (*okfn)(struct sk_buff *)) -+{ -+ return ebt_do_table(hook, pskb, in, out, &frame_filter); -+} -+ -+static struct nf_hook_ops ebt_ops_filter[] = { -+ { { NULL, NULL }, ebt_hook, PF_BRIDGE, NF_BR_LOCAL_IN, -+ NF_BR_PRI_FILTER_BRIDGED}, -+ { { NULL, NULL }, ebt_hook, PF_BRIDGE, NF_BR_FORWARD, -+ NF_BR_PRI_FILTER_BRIDGED}, -+ { { NULL, NULL }, ebt_hook, PF_BRIDGE, NF_BR_LOCAL_OUT, -+ NF_BR_PRI_FILTER_OTHER} -+}; -+ -+static int __init init(void) -+{ -+ int i, j, ret; -+ -+ ret = ebt_register_table(&frame_filter); -+ if (ret < 0) -+ return ret; -+ for (i = 0; i < sizeof(ebt_ops_filter) / sizeof(ebt_ops_filter[0]); i++) -+ if ((ret = nf_register_hook(&ebt_ops_filter[i])) < 0) -+ goto cleanup; -+ return ret; -+cleanup: -+ for (j = 0; j < i; j++) -+ nf_unregister_hook(&ebt_ops_filter[j]); -+ ebt_unregister_table(&frame_filter); -+ return ret; -+} -+ -+static void __exit fini(void) -+{ -+ int i; -+ -+ for (i = 0; i < sizeof(ebt_ops_filter) / sizeof(ebt_ops_filter[0]); i++) -+ nf_unregister_hook(&ebt_ops_filter[i]); -+ ebt_unregister_table(&frame_filter); -+} -+ -+module_init(init); -+module_exit(fini); -+EXPORT_NO_SYMBOLS; -+MODULE_LICENSE("GPL"); ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/ebtable_nat.c 2005-03-14 00:00:29.000000000 +0100 -@@ -0,0 +1,96 @@ -+/* -+ * ebtable_nat -+ * -+ * Authors: -+ * Bart De Schuymer -+ * -+ * April, 2002 -+ * -+ */ -+ -+#include -+#include -+#define NAT_VALID_HOOKS ((1 << NF_BR_PRE_ROUTING) | (1 << NF_BR_LOCAL_OUT) | \ -+ (1 << NF_BR_POST_ROUTING)) -+ -+static struct ebt_entries initial_chains[] = -+{ -+ {0, "PREROUTING", 0, EBT_ACCEPT, 0}, -+ {0, "OUTPUT", 0, EBT_ACCEPT, 0}, -+ {0, "POSTROUTING", 0, EBT_ACCEPT, 0} -+}; -+ -+static struct ebt_replace initial_table = -+{ -+ "nat", NAT_VALID_HOOKS, 0, 3 * sizeof(struct ebt_entries), -+ { [NF_BR_PRE_ROUTING]&initial_chains[0], [NF_BR_LOCAL_OUT]&initial_chains[1], -+ [NF_BR_POST_ROUTING]&initial_chains[2] }, 0, NULL, (char *)initial_chains -+}; -+ -+static int check(const struct ebt_table_info *info, unsigned int valid_hooks) -+{ -+ if (valid_hooks & ~NAT_VALID_HOOKS) -+ return -EINVAL; -+ return 0; -+} -+ -+static struct ebt_table frame_nat = -+{ -+ {NULL, NULL}, "nat", &initial_table, NAT_VALID_HOOKS, -+ RW_LOCK_UNLOCKED, check, NULL -+}; -+ -+static unsigned int -+ebt_nat_dst(unsigned int hook, struct sk_buff **pskb, const struct net_device *in -+ , const struct net_device *out, int (*okfn)(struct sk_buff *)) -+{ -+ return ebt_do_table(hook, pskb, in, out, &frame_nat); -+} -+ -+static unsigned int -+ebt_nat_src(unsigned int hook, struct sk_buff **pskb, const struct net_device *in -+ , const struct net_device *out, int (*okfn)(struct sk_buff *)) -+{ -+ return ebt_do_table(hook, pskb, in, out, &frame_nat); -+} -+ -+static struct nf_hook_ops ebt_ops_nat[] = { -+ { { NULL, NULL }, ebt_nat_dst, PF_BRIDGE, NF_BR_LOCAL_OUT, -+ NF_BR_PRI_NAT_DST_OTHER}, -+ { { NULL, NULL }, ebt_nat_src, PF_BRIDGE, NF_BR_POST_ROUTING, -+ NF_BR_PRI_NAT_SRC}, -+ { { NULL, NULL }, ebt_nat_dst, PF_BRIDGE, NF_BR_PRE_ROUTING, -+ NF_BR_PRI_NAT_DST_BRIDGED}, -+}; -+ -+static int __init init(void) -+{ -+ int i, ret, j; -+ -+ ret = ebt_register_table(&frame_nat); -+ if (ret < 0) -+ return ret; -+ for (i = 0; i < sizeof(ebt_ops_nat) / sizeof(ebt_ops_nat[0]); i++) -+ if ((ret = nf_register_hook(&ebt_ops_nat[i])) < 0) -+ goto cleanup; -+ return ret; -+cleanup: -+ for (j = 0; j < i; j++) -+ nf_unregister_hook(&ebt_ops_nat[j]); -+ ebt_unregister_table(&frame_nat); -+ return ret; -+} -+ -+static void __exit fini(void) -+{ -+ int i; -+ -+ for (i = 0; i < sizeof(ebt_ops_nat) / sizeof(ebt_ops_nat[0]); i++) -+ nf_unregister_hook(&ebt_ops_nat[i]); -+ ebt_unregister_table(&frame_nat); -+} -+ -+module_init(init); -+module_exit(fini); -+EXPORT_NO_SYMBOLS; -+MODULE_LICENSE("GPL"); ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/ebtable_broute.c 2005-03-14 00:00:29.000000000 +0100 -@@ -0,0 +1,79 @@ -+/* -+ * ebtable_broute -+ * -+ * Authors: -+ * Bart De Schuymer -+ * -+ * April, 2002 -+ * -+ * This table lets you choose between routing and bridging for frames -+ * entering on a bridge enslaved nic. This table is traversed before any -+ * other ebtables table. See net/bridge/br_input.c. -+ */ -+ -+#include -+#include -+#include -+#include -+ -+// EBT_ACCEPT means the frame will be bridged -+// EBT_DROP means the frame will be routed -+static struct ebt_entries initial_chain = -+ {0, "BROUTING", 0, EBT_ACCEPT, 0}; -+ -+static struct ebt_replace initial_table = -+{ -+ "broute", 1 << NF_BR_BROUTING, 0, sizeof(struct ebt_entries), -+ { [NF_BR_BROUTING]&initial_chain}, 0, NULL, (char *)&initial_chain -+}; -+ -+static int check(const struct ebt_table_info *info, unsigned int valid_hooks) -+{ -+ if (valid_hooks & ~(1 << NF_BR_BROUTING)) -+ return -EINVAL; -+ return 0; -+} -+ -+static struct ebt_table broute_table = -+{ -+ {NULL, NULL}, "broute", &initial_table, 1 << NF_BR_BROUTING, -+ RW_LOCK_UNLOCKED, check, NULL -+}; -+ -+static int ebt_broute(struct sk_buff **pskb) -+{ -+ int ret; -+ -+ ret = ebt_do_table(NF_BR_BROUTING, pskb, (*pskb)->dev, NULL, -+ &broute_table); -+ if (ret == NF_DROP) -+ return 1; // route it -+ return 0; // bridge it -+} -+ -+static int __init init(void) -+{ -+ int ret; -+ -+ ret = ebt_register_table(&broute_table); -+ if (ret < 0) -+ return ret; -+ br_write_lock_bh(BR_NETPROTO_LOCK); -+ // see br_input.c -+ br_should_route_hook = ebt_broute; -+ br_write_unlock_bh(BR_NETPROTO_LOCK); -+ return ret; -+} -+ -+static void __exit fini(void) -+{ -+ br_write_lock_bh(BR_NETPROTO_LOCK); -+ br_should_route_hook = NULL; -+ br_write_unlock_bh(BR_NETPROTO_LOCK); -+ ebt_unregister_table(&broute_table); -+} -+ -+module_init(init); -+module_exit(fini); -+EXPORT_NO_SYMBOLS; -+MODULE_LICENSE("GPL"); ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/ebt_among.c 2005-03-14 00:00:29.000000000 +0100 -@@ -0,0 +1,223 @@ -+/* -+ * ebt_among -+ * -+ * Authors: -+ * Grzegorz Borowiak -+ * -+ * August, 2003 -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+static int ebt_mac_wormhash_contains(const struct ebt_mac_wormhash *wh, -+ const char *mac, uint32_t ip) -+{ -+ /* You may be puzzled as to how this code works. -+ * Some tricks were used, refer to -+ * include/linux/netfilter_bridge/ebt_among.h -+ * as there you can find a solution of this mystery. -+ */ -+ const struct ebt_mac_wormhash_tuple *p; -+ int start, limit, i; -+ uint32_t cmp[2] = { 0, 0 }; -+ int key = (const unsigned char) mac[5]; -+ -+ memcpy(((char *) cmp) + 2, mac, 6); -+ start = wh->table[key]; -+ limit = wh->table[key + 1]; -+ if (ip) { -+ for (i = start; i < limit; i++) { -+ p = &wh->pool[i]; -+ if (cmp[1] == p->cmp[1] && cmp[0] == p->cmp[0]) { -+ if (p->ip == 0 || p->ip == ip) { -+ return 1; -+ } -+ } -+ } -+ } else { -+ for (i = start; i < limit; i++) { -+ p = &wh->pool[i]; -+ if (cmp[1] == p->cmp[1] && cmp[0] == p->cmp[0]) { -+ if (p->ip == 0) { -+ return 1; -+ } -+ } -+ } -+ } -+ return 0; -+} -+ -+static int ebt_mac_wormhash_check_integrity(const struct ebt_mac_wormhash -+ *wh) -+{ -+ int i; -+ -+ for (i = 0; i < 256; i++) { -+ if (wh->table[i] > wh->table[i + 1]) -+ return -0x100 - i; -+ if (wh->table[i] < 0) -+ return -0x200 - i; -+ if (wh->table[i] > wh->poolsize) -+ return -0x300 - i; -+ } -+ if (wh->table[256] > wh->poolsize) -+ return -0xc00; -+ return 0; -+} -+ -+static int get_ip_dst(const struct sk_buff *skb, uint32_t * addr) -+{ -+ if (skb->mac.ethernet->h_proto == __constant_htons(ETH_P_IP)) -+ *addr = skb->nh.iph->daddr; -+ else if (skb->mac.ethernet->h_proto == __constant_htons(ETH_P_ARP)) { -+ uint32_t arp_len = sizeof(struct arphdr) + -+ (2 * (((*skb).nh.arph)->ar_hln)) + -+ (2 * (((*skb).nh.arph)->ar_pln)); -+ -+ /* Make sure the packet is long enough. */ -+ if ((((*skb).nh.raw) + arp_len) > (*skb).tail) -+ return -1; -+ /* IPv4 addresses are always 4 bytes. */ -+ if (((*skb).nh.arph)->ar_pln != sizeof(uint32_t)) -+ return -1; -+ -+ memcpy(addr, ((*skb).nh.raw) + sizeof(struct arphdr) + -+ (2 * (((*skb).nh.arph)->ar_hln)) + -+ (((*skb).nh.arph)->ar_pln), sizeof(uint32_t)); -+ -+ } -+ return 0; -+} -+ -+static int get_ip_src(const struct sk_buff *skb, uint32_t * addr) -+{ -+ if (skb->mac.ethernet->h_proto == __constant_htons(ETH_P_IP)) -+ *addr = skb->nh.iph->saddr; -+ else if (skb->mac.ethernet->h_proto == __constant_htons(ETH_P_ARP)) { -+ uint32_t arp_len = sizeof(struct arphdr) + -+ (2 * (((*skb).nh.arph)->ar_hln)) + -+ (2 * (((*skb).nh.arph)->ar_pln)); -+ -+ /* Make sure the packet is long enough. */ -+ if ((((*skb).nh.raw) + arp_len) > (*skb).tail) -+ return -1; -+ /* IPv4 addresses are always 4 bytes. */ -+ if (((*skb).nh.arph)->ar_pln != sizeof(uint32_t)) -+ return -1; -+ -+ memcpy(addr, ((*skb).nh.raw) + sizeof(struct arphdr) + -+ ((((*skb).nh.arph)->ar_hln)), sizeof(uint32_t)); -+ -+ } -+ return 0; -+} -+ -+static int ebt_filter_among(const struct sk_buff *skb, -+ const struct net_device *in, -+ const struct net_device *out, const void *data, -+ unsigned int datalen) -+{ -+ struct ebt_among_info *info = (struct ebt_among_info *) data; -+ const char *dmac, *smac; -+ const struct ebt_mac_wormhash *wh_dst, *wh_src; -+ uint32_t dip = 0, sip = 0; -+ -+ wh_dst = ebt_among_wh_dst(info); -+ wh_src = ebt_among_wh_src(info); -+ -+ if (wh_src) { -+ smac = skb->mac.ethernet->h_source; -+ if (get_ip_src(skb, &sip)) -+ return EBT_NOMATCH; -+ if (!(info->bitmask & EBT_AMONG_SRC_NEG)) { -+ /* we match only if it contains */ -+ if (!ebt_mac_wormhash_contains(wh_src, smac, sip)) -+ return EBT_NOMATCH; -+ } else { -+ /* we match only if it DOES NOT contain */ -+ if (ebt_mac_wormhash_contains(wh_src, smac, sip)) -+ return EBT_NOMATCH; -+ } -+ } -+ -+ if (wh_dst) { -+ dmac = skb->mac.ethernet->h_dest; -+ if (get_ip_dst(skb, &dip)) -+ return EBT_NOMATCH; -+ if (!(info->bitmask & EBT_AMONG_DST_NEG)) { -+ /* we match only if it contains */ -+ if (!ebt_mac_wormhash_contains(wh_dst, dmac, dip)) -+ return EBT_NOMATCH; -+ } else { -+ /* we match only if it DOES NOT contain */ -+ if (ebt_mac_wormhash_contains(wh_dst, dmac, dip)) -+ return EBT_NOMATCH; -+ } -+ } -+ -+ return EBT_MATCH; -+} -+ -+static int ebt_among_check(const char *tablename, unsigned int hookmask, -+ const struct ebt_entry *e, void *data, -+ unsigned int datalen) -+{ -+ struct ebt_among_info *info = (struct ebt_among_info *) data; -+ int expected_length = sizeof(struct ebt_among_info); -+ const struct ebt_mac_wormhash *wh_dst, *wh_src; -+ int err; -+ -+ wh_dst = ebt_among_wh_dst(info); -+ wh_src = ebt_among_wh_src(info); -+ expected_length += ebt_mac_wormhash_size(wh_dst); -+ expected_length += ebt_mac_wormhash_size(wh_src); -+ -+ if (datalen != EBT_ALIGN(expected_length)) { -+ printk(KERN_WARNING -+ "ebtables: among: wrong size: %d" -+ "against expected %d, rounded to %d\n", -+ datalen, expected_length, -+ EBT_ALIGN(expected_length)); -+ return -EINVAL; -+ } -+ if (wh_dst && (err = ebt_mac_wormhash_check_integrity(wh_dst))) { -+ printk(KERN_WARNING -+ "ebtables: among: dst integrity fail: %x\n", -err); -+ return -EINVAL; -+ } -+ if (wh_src && (err = ebt_mac_wormhash_check_integrity(wh_src))) { -+ printk(KERN_WARNING -+ "ebtables: among: src integrity fail: %x\n", -err); -+ return -EINVAL; -+ } -+ return 0; -+} -+ -+static struct ebt_match filter_among = { -+ {NULL, NULL}, -+ EBT_AMONG_MATCH, -+ ebt_filter_among, -+ ebt_among_check, -+ NULL, -+ THIS_MODULE -+}; -+ -+static int __init init(void) -+{ -+ return ebt_register_match(&filter_among); -+} -+ -+static void __exit fini(void) -+{ -+ ebt_unregister_match(&filter_among); -+} -+ -+module_init(init); -+module_exit(fini); -+EXPORT_NO_SYMBOLS; -+MODULE_LICENSE("GPL"); ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/ebt_limit.c 2005-03-14 00:00:29.000000000 +0100 -@@ -0,0 +1,101 @@ -+/* -+ * ebt_limit -+ * -+ * Authors: -+ * Tom Marshall -+ * -+ * Mostly copied from netfilter's ipt_limit.c, see that file for explanation -+ * -+ * September, 2003 -+ * -+ */ -+ -+#include -+#include -+#include -+ -+#include -+#include -+ -+static spinlock_t limit_lock = SPIN_LOCK_UNLOCKED; -+ -+#define CREDITS_PER_JIFFY 128 -+ -+static int ebt_limit_match(const struct sk_buff *skb, const struct net_device *in, -+ const struct net_device *out, const void *data, unsigned int datalen) -+{ -+ struct ebt_limit_info *info = (struct ebt_limit_info *)data; -+ unsigned long now = jiffies; -+ -+ spin_lock_bh(&limit_lock); -+ info->credit += (now - xchg(&info->prev, now)) * CREDITS_PER_JIFFY; -+ if (info->credit > info->credit_cap) -+ info->credit = info->credit_cap; -+ -+ if (info->credit >= info->cost) { -+ /* We're not limited. */ -+ info->credit -= info->cost; -+ spin_unlock_bh(&limit_lock); -+ return EBT_MATCH; -+ } -+ -+ spin_unlock_bh(&limit_lock); -+ return EBT_NOMATCH; -+} -+ -+/* Precision saver. */ -+static u_int32_t -+user2credits(u_int32_t user) -+{ -+ /* If multiplying would overflow... */ -+ if (user > 0xFFFFFFFF / (HZ*CREDITS_PER_JIFFY)) -+ /* Divide first. */ -+ return (user / EBT_LIMIT_SCALE) * HZ * CREDITS_PER_JIFFY; -+ -+ return (user * HZ * CREDITS_PER_JIFFY) / EBT_LIMIT_SCALE; -+} -+ -+static int ebt_limit_check(const char *tablename, unsigned int hookmask, -+ const struct ebt_entry *e, void *data, unsigned int datalen) -+{ -+ struct ebt_limit_info *info = (struct ebt_limit_info *)data; -+ -+ if (datalen != EBT_ALIGN(sizeof(struct ebt_limit_info))) -+ return -EINVAL; -+ -+ /* Check for overflow. */ -+ if (info->burst == 0 -+ || user2credits(info->avg * info->burst) < user2credits(info->avg)) { -+ printk("Overflow in ebt_limit: %u/%u\n", -+ info->avg, info->burst); -+ return -EINVAL; -+ } -+ -+ /* User avg in seconds * EBT_LIMIT_SCALE: convert to jiffies * 128. */ -+ info->prev = jiffies; -+ info->credit = user2credits(info->avg * info->burst); -+ info->credit_cap = user2credits(info->avg * info->burst); -+ info->cost = user2credits(info->avg); -+ return 0; -+} -+ -+static struct ebt_match ebt_limit_reg = -+{ -+ {NULL, NULL}, EBT_LIMIT_MATCH, ebt_limit_match, ebt_limit_check, NULL, -+ THIS_MODULE -+}; -+ -+static int __init init(void) -+{ -+ return ebt_register_match(&ebt_limit_reg); -+} -+ -+static void __exit fini(void) -+{ -+ ebt_unregister_match(&ebt_limit_reg); -+} -+ -+module_init(init); -+module_exit(fini); -+EXPORT_NO_SYMBOLS; -+MODULE_LICENSE("GPL"); ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/ebt_arpreply.c 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,86 @@ -+/* -+ * ebt_arpreply -+ * -+ * Authors: -+ * Grzegorz Borowiak -+ * Bart De Schuymer -+ * -+ * August, 2003 -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+static int ebt_target_reply(struct sk_buff **pskb, unsigned int hooknr, -+ const struct net_device *in, const struct net_device *out, -+ const void *data, unsigned int datalen) -+{ -+ struct ebt_arpreply_info *info = (struct ebt_arpreply_info *)data; -+ struct arphdr *ah; -+ unsigned char *sha, *arp_ptr; -+ u32 sip, tip; -+ -+ ah = (**pskb).nh.arph; -+ if (ah->ar_op != __constant_htons(ARPOP_REQUEST) || -+ ah->ar_hln != ETH_ALEN || ah->ar_pro != htons(ETH_P_IP) || -+ ah->ar_pln != 4) -+ return EBT_CONTINUE; -+ -+ arp_ptr = (unsigned char *)(ah + 1); -+ -+ /* get source and target IP */ -+ sha = arp_ptr; -+ arp_ptr += ETH_ALEN; -+ memcpy(&sip, arp_ptr, 4); -+ arp_ptr += 4 + ETH_ALEN; -+ memcpy(&tip, arp_ptr, 4); -+ -+ arp_send(ARPOP_REPLY, ETH_P_ARP, sip, in, tip, sha, info->mac, sha); -+ -+ return info->target; -+} -+ -+static int ebt_target_reply_check(const char *tablename, unsigned int hookmask, -+ const struct ebt_entry *e, void *data, unsigned int datalen) -+{ -+ struct ebt_arpreply_info *info = (struct ebt_arpreply_info *)data; -+ -+ if (datalen != EBT_ALIGN(sizeof(struct ebt_arpreply_info))) -+ return -EINVAL; -+ if (BASE_CHAIN && info->target == EBT_RETURN) -+ return -EINVAL; -+ if (e->ethproto != __constant_htons(ETH_P_ARP) || -+ e->invflags & EBT_IPROTO) -+ return -EINVAL; -+ CLEAR_BASE_CHAIN_BIT; -+ if (strcmp(tablename, "nat") || hookmask & ~(1 << NF_BR_PRE_ROUTING)) -+ return -EINVAL; -+ return 0; -+} -+ -+static struct ebt_target reply_target = -+{ -+ .name = EBT_ARPREPLY_TARGET, -+ .target = ebt_target_reply, -+ .check = ebt_target_reply_check, -+ .me = THIS_MODULE, -+}; -+ -+static int __init init(void) -+{ -+ return ebt_register_target(&reply_target); -+} -+ -+static void __exit fini(void) -+{ -+ ebt_unregister_target(&reply_target); -+} -+ -+module_init(init); -+module_exit(fini); -+EXPORT_NO_SYMBOLS; -+MODULE_LICENSE("GPL"); ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/ebt_802_3.c 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,74 @@ -+/* -+ * 802_3 -+ * -+ * Author: -+ * Chris Vitale csv@bluetail.com -+ * -+ * May 2003 -+ * -+ */ -+ -+#include -+#include -+#include -+ -+static int ebt_filter_802_3(const struct sk_buff *skb, const struct net_device *in, -+ const struct net_device *out, const void *data, unsigned int datalen) -+{ -+ struct ebt_802_3_info *info = (struct ebt_802_3_info *)data; -+ struct ebt_802_3_hdr *hdr = (struct ebt_802_3_hdr *)skb->mac.ethernet; -+ uint16_t type = hdr->llc.ui.ctrl & IS_UI ? hdr->llc.ui.type : hdr->llc.ni.type; -+ -+ if (info->bitmask & EBT_802_3_SAP) { -+ if (FWINV(info->sap != hdr->llc.ui.ssap, EBT_802_3_SAP)) -+ return EBT_NOMATCH; -+ if (FWINV(info->sap != hdr->llc.ui.dsap, EBT_802_3_SAP)) -+ return EBT_NOMATCH; -+ } -+ -+ if (info->bitmask & EBT_802_3_TYPE) { -+ if (!(hdr->llc.ui.dsap == CHECK_TYPE && hdr->llc.ui.ssap == CHECK_TYPE)) -+ return EBT_NOMATCH; -+ if (FWINV(info->type != type, EBT_802_3_TYPE)) -+ return EBT_NOMATCH; -+ } -+ -+ return EBT_MATCH; -+} -+ -+static struct ebt_match filter_802_3; -+static int ebt_802_3_check(const char *tablename, unsigned int hookmask, -+ const struct ebt_entry *e, void *data, unsigned int datalen) -+{ -+ struct ebt_802_3_info *info = (struct ebt_802_3_info *)data; -+ -+ if (datalen != EBT_ALIGN(sizeof(struct ebt_802_3_info))) -+ return -EINVAL; -+ if (info->bitmask & ~EBT_802_3_MASK || info->invflags & ~EBT_802_3_MASK) -+ return -EINVAL; -+ -+ return 0; -+} -+ -+static struct ebt_match filter_802_3 = -+{ -+ .name = EBT_802_3_MATCH, -+ .match = ebt_filter_802_3, -+ .check = ebt_802_3_check, -+ .me = THIS_MODULE, -+}; -+ -+static int __init init(void) -+{ -+ return ebt_register_match(&filter_802_3); -+} -+ -+static void __exit fini(void) -+{ -+ ebt_unregister_match(&filter_802_3); -+} -+ -+module_init(init); -+module_exit(fini); -+EXPORT_NO_SYMBOLS; -+MODULE_LICENSE("GPL"); ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/ebt_mark.c 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,66 @@ -+/* -+ * ebt_mark -+ * -+ * Authors: -+ * Bart De Schuymer -+ * -+ * July, 2002 -+ * -+ */ -+ -+// The mark target can be used in any chain -+// I believe adding a mangle table just for marking is total overkill -+// Marking a frame doesn't really change anything in the frame anyway -+ -+#include -+#include -+#include -+ -+static int ebt_target_mark(struct sk_buff **pskb, unsigned int hooknr, -+ const struct net_device *in, const struct net_device *out, -+ const void *data, unsigned int datalen) -+{ -+ struct ebt_mark_t_info *info = (struct ebt_mark_t_info *)data; -+ -+ if ((*pskb)->nfmark != info->mark) { -+ (*pskb)->nfmark = info->mark; -+ (*pskb)->nfcache |= NFC_ALTERED; -+ } -+ return info->target; -+} -+ -+static int ebt_target_mark_check(const char *tablename, unsigned int hookmask, -+ const struct ebt_entry *e, void *data, unsigned int datalen) -+{ -+ struct ebt_mark_t_info *info = (struct ebt_mark_t_info *)data; -+ -+ if (datalen != EBT_ALIGN(sizeof(struct ebt_mark_t_info))) -+ return -EINVAL; -+ if (BASE_CHAIN && info->target == EBT_RETURN) -+ return -EINVAL; -+ CLEAR_BASE_CHAIN_BIT; -+ if (INVALID_TARGET) -+ return -EINVAL; -+ return 0; -+} -+ -+static struct ebt_target mark_target = -+{ -+ {NULL, NULL}, EBT_MARK_TARGET, ebt_target_mark, -+ ebt_target_mark_check, NULL, THIS_MODULE -+}; -+ -+static int __init init(void) -+{ -+ return ebt_register_target(&mark_target); -+} -+ -+static void __exit fini(void) -+{ -+ ebt_unregister_target(&mark_target); -+} -+ -+module_init(init); -+module_exit(fini); -+EXPORT_NO_SYMBOLS; -+MODULE_LICENSE("GPL"); ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/ebt_mark_m.c 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,61 @@ -+/* -+ * ebt_mark_m -+ * -+ * Authors: -+ * Bart De Schuymer -+ * -+ * July, 2002 -+ * -+ */ -+ -+#include -+#include -+#include -+ -+static int ebt_filter_mark(const struct sk_buff *skb, -+ const struct net_device *in, const struct net_device *out, const void *data, -+ unsigned int datalen) -+{ -+ struct ebt_mark_m_info *info = (struct ebt_mark_m_info *) data; -+ -+ if (info->bitmask & EBT_MARK_OR) -+ return !(!!(skb->nfmark & info->mask) ^ info->invert); -+ return !(((skb->nfmark & info->mask) == info->mark) ^ info->invert); -+} -+ -+static int ebt_mark_check(const char *tablename, unsigned int hookmask, -+ const struct ebt_entry *e, void *data, unsigned int datalen) -+{ -+ struct ebt_mark_m_info *info = (struct ebt_mark_m_info *) data; -+ -+ if (datalen != EBT_ALIGN(sizeof(struct ebt_mark_m_info))) -+ return -EINVAL; -+ if (info->bitmask & ~EBT_MARK_MASK) -+ return -EINVAL; -+ if ((info->bitmask & EBT_MARK_OR) && (info->bitmask & EBT_MARK_AND)) -+ return -EINVAL; -+ if (!info->bitmask) -+ return -EINVAL; -+ return 0; -+} -+ -+static struct ebt_match filter_mark = -+{ -+ {NULL, NULL}, EBT_MARK_MATCH, ebt_filter_mark, ebt_mark_check, NULL, -+ THIS_MODULE -+}; -+ -+static int __init init(void) -+{ -+ return ebt_register_match(&filter_mark); -+} -+ -+static void __exit fini(void) -+{ -+ ebt_unregister_match(&filter_mark); -+} -+ -+module_init(init); -+module_exit(fini); -+EXPORT_NO_SYMBOLS; -+MODULE_LICENSE("GPL"); ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/ebt_pkttype.c 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,60 @@ -+/* -+ * ebt_pkttype -+ * -+ * Authors: -+ * Bart De Schuymer -+ * -+ * April, 2003 -+ * -+ */ -+ -+#include -+#include -+#include -+ -+static int ebt_filter_pkttype(const struct sk_buff *skb, -+ const struct net_device *in, -+ const struct net_device *out, -+ const void *data, -+ unsigned int datalen) -+{ -+ struct ebt_pkttype_info *info = (struct ebt_pkttype_info *)data; -+ -+ return (skb->pkt_type != info->pkt_type) ^ info->invert; -+} -+ -+static int ebt_pkttype_check(const char *tablename, unsigned int hookmask, -+ const struct ebt_entry *e, void *data, unsigned int datalen) -+{ -+ struct ebt_pkttype_info *info = (struct ebt_pkttype_info *)data; -+ -+ if (datalen != EBT_ALIGN(sizeof(struct ebt_pkttype_info))) -+ return -EINVAL; -+ if (info->invert != 0 && info->invert != 1) -+ return -EINVAL; -+ /* Allow any pkt_type value */ -+ return 0; -+} -+ -+static struct ebt_match filter_pkttype = -+{ -+ .name = EBT_PKTTYPE_MATCH, -+ .match = ebt_filter_pkttype, -+ .check = ebt_pkttype_check, -+ .me = THIS_MODULE, -+}; -+ -+static int __init init(void) -+{ -+ return ebt_register_match(&filter_pkttype); -+} -+ -+static void __exit fini(void) -+{ -+ ebt_unregister_match(&filter_pkttype); -+} -+ -+module_init(init); -+module_exit(fini); -+EXPORT_NO_SYMBOLS; -+MODULE_LICENSE("GPL"); ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/ebt_stp.c 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,191 @@ -+/* -+ * ebt_stp -+ * -+ * Authors: -+ * Bart De Schuymer -+ * Stephen Hemminger -+ * -+ * June, 2003 -+ */ -+ -+#include -+#include -+#include -+ -+#define BPDU_TYPE_CONFIG 0 -+#define BPDU_TYPE_TCN 0x80 -+ -+struct stp_header { -+ uint8_t dsap; -+ uint8_t ssap; -+ uint8_t ctrl; -+ uint8_t pid; -+ uint8_t vers; -+ uint8_t type; -+}; -+ -+struct stp_config_pdu { -+ uint8_t flags; -+ uint8_t root[8]; -+ uint8_t root_cost[4]; -+ uint8_t sender[8]; -+ uint8_t port[2]; -+ uint8_t msg_age[2]; -+ uint8_t max_age[2]; -+ uint8_t hello_time[2]; -+ uint8_t forward_delay[2]; -+}; -+ -+#define NR16(p) (p[0] << 8 | p[1]) -+#define NR32(p) ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]) -+ -+static int ebt_filter_config(struct ebt_stp_info *info, -+ struct stp_config_pdu *stpc) -+{ -+ struct ebt_stp_config_info *c; -+ uint16_t v16; -+ uint32_t v32; -+ int verdict, i; -+ -+ c = &info->config; -+ if ((info->bitmask & EBT_STP_FLAGS) && -+ FWINV(c->flags != stpc->flags, EBT_STP_FLAGS)) -+ return EBT_NOMATCH; -+ if (info->bitmask & EBT_STP_ROOTPRIO) { -+ v16 = NR16(stpc->root); -+ if (FWINV(v16 < c->root_priol || -+ v16 > c->root_priou, EBT_STP_ROOTPRIO)) -+ return EBT_NOMATCH; -+ } -+ if (info->bitmask & EBT_STP_ROOTADDR) { -+ verdict = 0; -+ for (i = 0; i < 6; i++) -+ verdict |= (stpc->root[2+i] ^ c->root_addr[i]) & -+ c->root_addrmsk[i]; -+ if (FWINV(verdict != 0, EBT_STP_ROOTADDR)) -+ return EBT_NOMATCH; -+ } -+ if (info->bitmask & EBT_STP_ROOTCOST) { -+ v32 = NR32(stpc->root_cost); -+ if (FWINV(v32 < c->root_costl || -+ v32 > c->root_costu, EBT_STP_ROOTCOST)) -+ return EBT_NOMATCH; -+ } -+ if (info->bitmask & EBT_STP_SENDERPRIO) { -+ v16 = NR16(stpc->sender); -+ if (FWINV(v16 < c->sender_priol || -+ v16 > c->sender_priou, EBT_STP_SENDERPRIO)) -+ return EBT_NOMATCH; -+ } -+ if (info->bitmask & EBT_STP_SENDERADDR) { -+ verdict = 0; -+ for (i = 0; i < 6; i++) -+ verdict |= (stpc->sender[2+i] ^ c->sender_addr[i]) & -+ c->sender_addrmsk[i]; -+ if (FWINV(verdict != 0, EBT_STP_SENDERADDR)) -+ return EBT_NOMATCH; -+ } -+ if (info->bitmask & EBT_STP_PORT) { -+ v16 = NR16(stpc->port); -+ if (FWINV(v16 < c->portl || -+ v16 > c->portu, EBT_STP_PORT)) -+ return EBT_NOMATCH; -+ } -+ if (info->bitmask & EBT_STP_MSGAGE) { -+ v16 = NR16(stpc->msg_age); -+ if (FWINV(v16 < c->msg_agel || -+ v16 > c->msg_ageu, EBT_STP_MSGAGE)) -+ return EBT_NOMATCH; -+ } -+ if (info->bitmask & EBT_STP_MAXAGE) { -+ v16 = NR16(stpc->max_age); -+ if (FWINV(v16 < c->max_agel || -+ v16 > c->max_ageu, EBT_STP_MAXAGE)) -+ return EBT_NOMATCH; -+ } -+ if (info->bitmask & EBT_STP_HELLOTIME) { -+ v16 = NR16(stpc->hello_time); -+ if (FWINV(v16 < c->hello_timel || -+ v16 > c->hello_timeu, EBT_STP_HELLOTIME)) -+ return EBT_NOMATCH; -+ } -+ if (info->bitmask & EBT_STP_FWDD) { -+ v16 = NR16(stpc->forward_delay); -+ if (FWINV(v16 < c->forward_delayl || -+ v16 > c->forward_delayu, EBT_STP_FWDD)) -+ return EBT_NOMATCH; -+ } -+ return EBT_MATCH; -+} -+ -+static int ebt_filter_stp(const struct sk_buff *skb, const struct net_device *in, -+ const struct net_device *out, const void *data, unsigned int datalen) -+{ -+ struct ebt_stp_info *info = (struct ebt_stp_info *)data; -+ struct stp_header stph; -+ uint8_t header[6] = {0x42, 0x42, 0x03, 0x00, 0x00, 0x00}; -+ if (skb_copy_bits(skb, 0, &stph, sizeof(stph))) -+ return EBT_NOMATCH; -+ -+ /* The stp code only considers these */ -+ if (memcmp(&stph, header, sizeof(header))) -+ return EBT_NOMATCH; -+ -+ if (info->bitmask & EBT_STP_TYPE -+ && FWINV(info->type != stph.type, EBT_STP_TYPE)) -+ return EBT_NOMATCH; -+ -+ if (stph.type == BPDU_TYPE_CONFIG && -+ info->bitmask & EBT_STP_CONFIG_MASK) { -+ struct stp_config_pdu stpc; -+ -+ if (skb_copy_bits(skb, sizeof(stph), &stpc, sizeof(stpc))) -+ return EBT_NOMATCH; -+ return ebt_filter_config(info, &stpc); -+ } -+ return EBT_MATCH; -+} -+ -+static int ebt_stp_check(const char *tablename, unsigned int hookmask, -+ const struct ebt_entry *e, void *data, unsigned int datalen) -+{ -+ struct ebt_stp_info *info = (struct ebt_stp_info *)data; -+ int len = EBT_ALIGN(sizeof(struct ebt_stp_info)); -+ uint8_t bridge_ula[6] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 }; -+ uint8_t msk[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; -+ -+ if (info->bitmask & ~EBT_STP_MASK || info->invflags & ~EBT_STP_MASK || -+ !(info->bitmask & EBT_STP_MASK)) -+ return -EINVAL; -+ if (datalen != len) -+ return -EINVAL; -+ /* Make sure the match only receives stp frames */ -+ if (memcmp(e->destmac, bridge_ula, ETH_ALEN) || -+ memcmp(e->destmsk, msk, ETH_ALEN) || !(e->bitmask & EBT_DESTMAC)) -+ return -EINVAL; -+ -+ return 0; -+} -+ -+static struct ebt_match filter_stp = -+{ -+ .name = EBT_STP_MATCH, -+ .match = ebt_filter_stp, -+ .check = ebt_stp_check, -+ .me = THIS_MODULE, -+}; -+ -+static int __init init(void) -+{ -+ return ebt_register_match(&filter_stp); -+} -+ -+static void __exit fini(void) -+{ -+ ebt_unregister_match(&filter_stp); -+} -+ -+module_init(init); -+module_exit(fini); -+EXPORT_NO_SYMBOLS; -+MODULE_LICENSE("GPL"); ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/ebt_redirect.c 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,71 @@ -+/* -+ * ebt_redirect -+ * -+ * Authors: -+ * Bart De Schuymer -+ * -+ * April, 2002 -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include "../br_private.h" -+ -+static int ebt_target_redirect(struct sk_buff **pskb, unsigned int hooknr, -+ const struct net_device *in, const struct net_device *out, -+ const void *data, unsigned int datalen) -+{ -+ struct ebt_redirect_info *info = (struct ebt_redirect_info *)data; -+ -+ if (hooknr != NF_BR_BROUTING) -+ memcpy((**pskb).mac.ethernet->h_dest, -+ in->br_port->br->dev.dev_addr, ETH_ALEN); -+ else { -+ memcpy((**pskb).mac.ethernet->h_dest, -+ in->dev_addr, ETH_ALEN); -+ (*pskb)->pkt_type = PACKET_HOST; -+ } -+ return info->target; -+} -+ -+static int ebt_target_redirect_check(const char *tablename, unsigned int hookmask, -+ const struct ebt_entry *e, void *data, unsigned int datalen) -+{ -+ struct ebt_redirect_info *info = (struct ebt_redirect_info *)data; -+ -+ if (datalen != EBT_ALIGN(sizeof(struct ebt_redirect_info))) -+ return -EINVAL; -+ if (BASE_CHAIN && info->target == EBT_RETURN) -+ return -EINVAL; -+ CLEAR_BASE_CHAIN_BIT; -+ if ( (strcmp(tablename, "nat") || hookmask & ~(1 << NF_BR_PRE_ROUTING)) && -+ (strcmp(tablename, "broute") || hookmask & ~(1 << NF_BR_BROUTING)) ) -+ return -EINVAL; -+ if (INVALID_TARGET) -+ return -EINVAL; -+ return 0; -+} -+ -+static struct ebt_target redirect_target = -+{ -+ {NULL, NULL}, EBT_REDIRECT_TARGET, ebt_target_redirect, -+ ebt_target_redirect_check, NULL, THIS_MODULE -+}; -+ -+static int __init init(void) -+{ -+ return ebt_register_target(&redirect_target); -+} -+ -+static void __exit fini(void) -+{ -+ ebt_unregister_target(&redirect_target); -+} -+ -+module_init(init); -+module_exit(fini); -+EXPORT_NO_SYMBOLS; -+MODULE_LICENSE("GPL"); ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/ebt_arp.c 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,149 @@ -+/* -+ * ebt_arp -+ * -+ * Authors: -+ * Bart De Schuymer -+ * Tim Gardner -+ * -+ * April, 2002 -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+static int ebt_filter_arp(const struct sk_buff *skb, const struct net_device *in, -+ const struct net_device *out, const void *data, unsigned int datalen) -+{ -+ struct ebt_arp_info *info = (struct ebt_arp_info *)data; -+ -+ if (info->bitmask & EBT_ARP_OPCODE && FWINV(info->opcode != -+ ((*skb).nh.arph)->ar_op, EBT_ARP_OPCODE)) -+ return EBT_NOMATCH; -+ if (info->bitmask & EBT_ARP_HTYPE && FWINV(info->htype != -+ ((*skb).nh.arph)->ar_hrd, EBT_ARP_HTYPE)) -+ return EBT_NOMATCH; -+ if (info->bitmask & EBT_ARP_PTYPE && FWINV(info->ptype != -+ ((*skb).nh.arph)->ar_pro, EBT_ARP_PTYPE)) -+ return EBT_NOMATCH; -+ -+ if (info->bitmask & (EBT_ARP_SRC_IP | EBT_ARP_DST_IP)) -+ { -+ uint32_t arp_len = sizeof(struct arphdr) + -+ (2 * (((*skb).nh.arph)->ar_hln)) + -+ (2 * (((*skb).nh.arph)->ar_pln)); -+ uint32_t dst; -+ uint32_t src; -+ -+ // Make sure the packet is long enough. -+ if ((((*skb).nh.raw) + arp_len) > (*skb).tail) -+ return EBT_NOMATCH; -+ // IPv4 addresses are always 4 bytes. -+ if (((*skb).nh.arph)->ar_pln != sizeof(uint32_t)) -+ return EBT_NOMATCH; -+ -+ if (info->bitmask & EBT_ARP_SRC_IP) { -+ memcpy(&src, ((*skb).nh.raw) + sizeof(struct arphdr) + -+ ((*skb).nh.arph)->ar_hln, sizeof(uint32_t)); -+ if (FWINV(info->saddr != (src & info->smsk), -+ EBT_ARP_SRC_IP)) -+ return EBT_NOMATCH; -+ } -+ -+ if (info->bitmask & EBT_ARP_DST_IP) { -+ memcpy(&dst, ((*skb).nh.raw)+sizeof(struct arphdr) + -+ (2*(((*skb).nh.arph)->ar_hln)) + -+ (((*skb).nh.arph)->ar_pln), sizeof(uint32_t)); -+ if (FWINV(info->daddr != (dst & info->dmsk), -+ EBT_ARP_DST_IP)) -+ return EBT_NOMATCH; -+ } -+ } -+ -+ if (info->bitmask & (EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC)) -+ { -+ uint32_t arp_len = sizeof(struct arphdr) + -+ (2 * (((*skb).nh.arph)->ar_hln)) + -+ (2 * (((*skb).nh.arph)->ar_pln)); -+ unsigned char dst[ETH_ALEN]; -+ unsigned char src[ETH_ALEN]; -+ -+ // Make sure the packet is long enough. -+ if ((((*skb).nh.raw) + arp_len) > (*skb).tail) -+ return EBT_NOMATCH; -+ // MAC addresses are 6 bytes. -+ if (((*skb).nh.arph)->ar_hln != ETH_ALEN) -+ return EBT_NOMATCH; -+ if (info->bitmask & EBT_ARP_SRC_MAC) { -+ uint8_t verdict, i; -+ -+ memcpy(&src, ((*skb).nh.raw) + -+ sizeof(struct arphdr), -+ ETH_ALEN); -+ verdict = 0; -+ for (i = 0; i < 6; i++) -+ verdict |= (src[i] ^ info->smaddr[i]) & -+ info->smmsk[i]; -+ if (FWINV(verdict != 0, EBT_ARP_SRC_MAC)) -+ return EBT_NOMATCH; -+ } -+ -+ if (info->bitmask & EBT_ARP_DST_MAC) { -+ uint8_t verdict, i; -+ -+ memcpy(&dst, ((*skb).nh.raw) + -+ sizeof(struct arphdr) + -+ (((*skb).nh.arph)->ar_hln) + -+ (((*skb).nh.arph)->ar_pln), -+ ETH_ALEN); -+ verdict = 0; -+ for (i = 0; i < 6; i++) -+ verdict |= (dst[i] ^ info->dmaddr[i]) & -+ info->dmmsk[i]; -+ if (FWINV(verdict != 0, EBT_ARP_DST_MAC)) -+ return EBT_NOMATCH; -+ } -+ } -+ -+ return EBT_MATCH; -+} -+ -+static int ebt_arp_check(const char *tablename, unsigned int hookmask, -+ const struct ebt_entry *e, void *data, unsigned int datalen) -+{ -+ struct ebt_arp_info *info = (struct ebt_arp_info *)data; -+ -+ if (datalen != EBT_ALIGN(sizeof(struct ebt_arp_info))) -+ return -EINVAL; -+ if ((e->ethproto != __constant_htons(ETH_P_ARP) && -+ e->ethproto != __constant_htons(ETH_P_RARP)) || -+ e->invflags & EBT_IPROTO) -+ return -EINVAL; -+ if (info->bitmask & ~EBT_ARP_MASK || info->invflags & ~EBT_ARP_MASK) -+ return -EINVAL; -+ return 0; -+} -+ -+static struct ebt_match filter_arp = -+{ -+ {NULL, NULL}, EBT_ARP_MATCH, ebt_filter_arp, ebt_arp_check, NULL, -+ THIS_MODULE -+}; -+ -+static int __init init(void) -+{ -+ return ebt_register_match(&filter_arp); -+} -+ -+static void __exit fini(void) -+{ -+ ebt_unregister_match(&filter_arp); -+} -+ -+module_init(init); -+module_exit(fini); -+EXPORT_NO_SYMBOLS; -+MODULE_LICENSE("GPL"); ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/ebt_ip.c 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,121 @@ -+/* -+ * ebt_ip -+ * -+ * Authors: -+ * Bart De Schuymer -+ * -+ * April, 2002 -+ * -+ * Changes: -+ * added ip-sport and ip-dport -+ * Innominate Security Technologies AG -+ * September, 2002 -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+struct tcpudphdr { -+ uint16_t src; -+ uint16_t dst; -+}; -+ -+union h_u { -+ unsigned char *raw; -+ struct tcpudphdr *tuh; -+}; -+ -+static int ebt_filter_ip(const struct sk_buff *skb, const struct net_device *in, -+ const struct net_device *out, const void *data, -+ unsigned int datalen) -+{ -+ struct ebt_ip_info *info = (struct ebt_ip_info *)data; -+ -+ if (info->bitmask & EBT_IP_TOS && -+ FWINV(info->tos != ((*skb).nh.iph)->tos, EBT_IP_TOS)) -+ return EBT_NOMATCH; -+ if (info->bitmask & EBT_IP_PROTO) { -+ if (FWINV(info->protocol != ((*skb).nh.iph)->protocol, -+ EBT_IP_PROTO)) -+ return EBT_NOMATCH; -+ if ( info->protocol == IPPROTO_TCP || -+ info->protocol == IPPROTO_UDP ) -+ { -+ union h_u h; -+ h.raw = skb->data + skb->nh.iph->ihl*4; -+ if (info->bitmask & EBT_IP_DPORT) { -+ uint16_t port = ntohs(h.tuh->dst); -+ if (FWINV(port < info->dport[0] || -+ port > info->dport[1], -+ EBT_IP_DPORT)) -+ return EBT_NOMATCH; -+ } -+ if (info->bitmask & EBT_IP_SPORT) { -+ uint16_t port = ntohs(h.tuh->src); -+ if (FWINV(port < info->sport[0] || -+ port > info->sport[1], -+ EBT_IP_SPORT)) -+ return EBT_NOMATCH; -+ } -+ } -+ } -+ if (info->bitmask & EBT_IP_SOURCE && -+ FWINV((((*skb).nh.iph)->saddr & info->smsk) != -+ info->saddr, EBT_IP_SOURCE)) -+ return EBT_NOMATCH; -+ if ((info->bitmask & EBT_IP_DEST) && -+ FWINV((((*skb).nh.iph)->daddr & info->dmsk) != -+ info->daddr, EBT_IP_DEST)) -+ return EBT_NOMATCH; -+ return EBT_MATCH; -+} -+ -+static int ebt_ip_check(const char *tablename, unsigned int hookmask, -+ const struct ebt_entry *e, void *data, unsigned int datalen) -+{ -+ struct ebt_ip_info *info = (struct ebt_ip_info *)data; -+ -+ if (datalen != EBT_ALIGN(sizeof(struct ebt_ip_info))) -+ return -EINVAL; -+ if (e->ethproto != __constant_htons(ETH_P_IP) || -+ e->invflags & EBT_IPROTO) -+ return -EINVAL; -+ if (info->bitmask & ~EBT_IP_MASK || info->invflags & ~EBT_IP_MASK) -+ return -EINVAL; -+ if (info->bitmask & (EBT_IP_DPORT | EBT_IP_SPORT)) { -+ if (!info->bitmask & EBT_IPROTO) -+ return -EINVAL; -+ if (info->protocol != IPPROTO_TCP && -+ info->protocol != IPPROTO_UDP) -+ return -EINVAL; -+ } -+ if (info->bitmask & EBT_IP_DPORT && info->dport[0] > info->dport[1]) -+ return -EINVAL; -+ if (info->bitmask & EBT_IP_SPORT && info->sport[0] > info->sport[1]) -+ return -EINVAL; -+ return 0; -+} -+ -+static struct ebt_match filter_ip = -+{ -+ {NULL, NULL}, EBT_IP_MATCH, ebt_filter_ip, ebt_ip_check, NULL, -+ THIS_MODULE -+}; -+ -+static int __init init(void) -+{ -+ return ebt_register_match(&filter_ip); -+} -+ -+static void __exit fini(void) -+{ -+ ebt_unregister_match(&filter_ip); -+} -+ -+module_init(init); -+module_exit(fini); -+EXPORT_NO_SYMBOLS; -+MODULE_LICENSE("GPL"); ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/ebt_vlan.c 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,259 @@ -+/* -+ * Description: EBTables 802.1Q match extension kernelspace module. -+ * Authors: Nick Fedchik -+ * Bart De Schuymer -+ * -+ * 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 -+ -+static unsigned char debug; -+#define MODULE_VERSION "0.6" -+ -+MODULE_PARM(debug, "0-1b"); -+MODULE_PARM_DESC(debug, "debug=1 is turn on debug messages"); -+MODULE_AUTHOR("Nick Fedchik "); -+MODULE_DESCRIPTION("802.1Q match module (ebtables extension), v" -+ MODULE_VERSION); -+MODULE_LICENSE("GPL"); -+ -+ -+#define DEBUG_MSG(args...) if (debug) printk (KERN_DEBUG "ebt_vlan: " args) -+#define INV_FLAG(_inv_flag_) (info->invflags & _inv_flag_) ? "!" : "" -+#define GET_BITMASK(_BIT_MASK_) info->bitmask & _BIT_MASK_ -+#define SET_BITMASK(_BIT_MASK_) info->bitmask |= _BIT_MASK_ -+#define EXIT_ON_MISMATCH(_MATCH_,_MASK_) if (!((info->_MATCH_ == _MATCH_)^!!(info->invflags & _MASK_))) return 1; -+ -+/* -+ * Function description: ebt_filter_vlan() is main engine for -+ * checking passed 802.1Q frame according to -+ * the passed extension parameters (in the *data buffer) -+ * ebt_filter_vlan() is called after successfull check the rule params -+ * by ebt_check_vlan() function. -+ * Parameters: -+ * const struct sk_buff *skb - pointer to passed ethernet frame buffer -+ * const void *data - pointer to passed extension parameters -+ * unsigned int datalen - length of passed *data buffer -+ * const struct net_device *in - -+ * const struct net_device *out - -+ * const struct ebt_counter *c - -+ * Returned values: -+ * 0 - ok (all rule params matched) -+ * 1 - miss (rule params not acceptable to the parsed frame) -+ */ -+static int -+ebt_filter_vlan(const struct sk_buff *skb, -+ const struct net_device *in, -+ const struct net_device *out, -+ const void *data, unsigned int datalen) -+{ -+ struct ebt_vlan_info *info = (struct ebt_vlan_info *) data; /* userspace data */ -+ struct vlan_ethhdr *frame = (struct vlan_ethhdr *) skb->mac.raw; /* Passed tagged frame */ -+ -+ unsigned short TCI; /* Whole TCI, given from parsed frame */ -+ unsigned short id; /* VLAN ID, given from frame TCI */ -+ unsigned char prio; /* user_priority, given from frame TCI */ -+ unsigned short encap; /* VLAN encapsulated Type/Length field, given from orig frame */ -+ -+ /* -+ * Tag Control Information (TCI) consists of the following elements: -+ * - User_priority. The user_priority field is three bits in length, -+ * interpreted as a binary number. -+ * - Canonical Format Indicator (CFI). The Canonical Format Indicator -+ * (CFI) is a single bit flag value. Currently ignored. -+ * - VLAN Identifier (VID). The VID is encoded as -+ * an unsigned binary number. -+ */ -+ TCI = ntohs(frame->h_vlan_TCI); -+ id = TCI & VLAN_VID_MASK; -+ prio = (TCI >> 13) & 0x7; -+ encap = frame->h_vlan_encapsulated_proto; -+ -+ /* -+ * Checking VLAN Identifier (VID) -+ */ -+ if (GET_BITMASK(EBT_VLAN_ID)) { /* Is VLAN ID parsed? */ -+ EXIT_ON_MISMATCH(id, EBT_VLAN_ID); -+ } -+ /* -+ * Checking user_priority -+ */ -+ if (GET_BITMASK(EBT_VLAN_PRIO)) { /* Is VLAN user_priority parsed? */ -+ EXIT_ON_MISMATCH(prio, EBT_VLAN_PRIO); -+ } -+ /* -+ * Checking Encapsulated Proto (Length/Type) field -+ */ -+ if (GET_BITMASK(EBT_VLAN_ENCAP)) { /* Is VLAN Encap parsed? */ -+ EXIT_ON_MISMATCH(encap, EBT_VLAN_ENCAP); -+ } -+ /* -+ * All possible extension parameters was parsed. -+ * If rule never returned by missmatch, then all ok. -+ */ -+ return 0; -+} -+ -+/* -+ * Function description: ebt_vlan_check() is called when userspace -+ * delivers the table entry to the kernel, -+ * and to check that userspace doesn't give a bad table. -+ * Parameters: -+ * const char *tablename - table name string -+ * unsigned int hooknr - hook number -+ * const struct ebt_entry *e - ebtables entry basic set -+ * const void *data - pointer to passed extension parameters -+ * unsigned int datalen - length of passed *data buffer -+ * Returned values: -+ * 0 - ok (all delivered rule params are correct) -+ * 1 - miss (rule params is out of range, invalid, incompatible, etc.) -+ */ -+static int -+ebt_check_vlan(const char *tablename, -+ unsigned int hooknr, -+ const struct ebt_entry *e, void *data, unsigned int datalen) -+{ -+ struct ebt_vlan_info *info = (struct ebt_vlan_info *) data; -+ -+ /* -+ * Parameters buffer overflow check -+ */ -+ if (datalen != EBT_ALIGN(sizeof(struct ebt_vlan_info))) { -+ DEBUG_MSG -+ ("passed size %d is not eq to ebt_vlan_info (%d)\n", -+ datalen, sizeof(struct ebt_vlan_info)); -+ return -EINVAL; -+ } -+ -+ /* -+ * Is it 802.1Q frame checked? -+ */ -+ if (e->ethproto != __constant_htons(ETH_P_8021Q)) { -+ DEBUG_MSG -+ ("passed entry proto %2.4X is not 802.1Q (8100)\n", -+ (unsigned short) ntohs(e->ethproto)); -+ return -EINVAL; -+ } -+ -+ /* -+ * Check for bitmask range -+ * True if even one bit is out of mask -+ */ -+ if (info->bitmask & ~EBT_VLAN_MASK) { -+ DEBUG_MSG("bitmask %2X is out of mask (%2X)\n", -+ info->bitmask, EBT_VLAN_MASK); -+ return -EINVAL; -+ } -+ -+ /* -+ * Check for inversion flags range -+ */ -+ if (info->invflags & ~EBT_VLAN_MASK) { -+ DEBUG_MSG("inversion flags %2X is out of mask (%2X)\n", -+ info->invflags, EBT_VLAN_MASK); -+ return -EINVAL; -+ } -+ -+ /* -+ * Reserved VLAN ID (VID) values -+ * ----------------------------- -+ * 0 - The null VLAN ID. -+ * 1 - The default Port VID (PVID) -+ * 0x0FFF - Reserved for implementation use. -+ * if_vlan.h: VLAN_GROUP_ARRAY_LEN 4096. -+ */ -+ if (GET_BITMASK(EBT_VLAN_ID)) { /* when vlan-id param was spec-ed */ -+ if (!!info->id) { /* if id!=0 => check vid range */ -+ if (info->id > VLAN_GROUP_ARRAY_LEN) { -+ DEBUG_MSG -+ ("id %d is out of range (1-4096)\n", -+ info->id); -+ return -EINVAL; -+ } -+ /* -+ * Note: This is valid VLAN-tagged frame point. -+ * Any value of user_priority are acceptable, -+ * but should be ignored according to 802.1Q Std. -+ * So we just drop the prio flag. -+ */ -+ info->bitmask &= ~EBT_VLAN_PRIO; -+ } -+ /* -+ * Else, id=0 (null VLAN ID) => user_priority range (any?) -+ */ -+ } -+ -+ if (GET_BITMASK(EBT_VLAN_PRIO)) { -+ if ((unsigned char) info->prio > 7) { -+ DEBUG_MSG -+ ("prio %d is out of range (0-7)\n", -+ info->prio); -+ return -EINVAL; -+ } -+ } -+ /* -+ * Check for encapsulated proto range - it is possible to be -+ * any value for u_short range. -+ * if_ether.h: ETH_ZLEN 60 - Min. octets in frame sans FCS -+ */ -+ if (GET_BITMASK(EBT_VLAN_ENCAP)) { -+ if ((unsigned short) ntohs(info->encap) < ETH_ZLEN) { -+ DEBUG_MSG -+ ("encap frame length %d is less than minimal\n", -+ ntohs(info->encap)); -+ return -EINVAL; -+ } -+ } -+ -+ return 0; -+} -+ -+static struct ebt_match filter_vlan = { -+ {NULL, NULL}, -+ EBT_VLAN_MATCH, -+ ebt_filter_vlan, -+ ebt_check_vlan, -+ NULL, -+ THIS_MODULE -+}; -+ -+/* -+ * Module initialization function. -+ */ -+static int __init init(void) -+{ -+ DEBUG_MSG("ebtables 802.1Q extension module v" -+ MODULE_VERSION "\n"); -+ DEBUG_MSG("module debug=%d\n", !!debug); -+ return ebt_register_match(&filter_vlan); -+} -+ -+/* -+ * Module "finalization" function -+ */ -+static void __exit fini(void) -+{ -+ ebt_unregister_match(&filter_vlan); -+} -+ -+module_init(init); -+module_exit(fini); -+ -+EXPORT_NO_SYMBOLS; ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/ebt_log.c 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,153 @@ -+/* -+ * ebt_log -+ * -+ * Authors: -+ * Bart De Schuymer -+ * -+ * April, 2002 -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static spinlock_t ebt_log_lock = SPIN_LOCK_UNLOCKED; -+ -+static int ebt_log_check(const char *tablename, unsigned int hookmask, -+ const struct ebt_entry *e, void *data, unsigned int datalen) -+{ -+ struct ebt_log_info *info = (struct ebt_log_info *)data; -+ -+ if (datalen != EBT_ALIGN(sizeof(struct ebt_log_info))) -+ return -EINVAL; -+ if (info->bitmask & ~EBT_LOG_MASK) -+ return -EINVAL; -+ if (info->loglevel >= 8) -+ return -EINVAL; -+ info->prefix[EBT_LOG_PREFIX_SIZE - 1] = '\0'; -+ return 0; -+} -+ -+struct tcpudphdr -+{ -+ uint16_t src; -+ uint16_t dst; -+}; -+ -+struct arppayload -+{ -+ unsigned char mac_src[ETH_ALEN]; -+ unsigned char ip_src[4]; -+ unsigned char mac_dst[ETH_ALEN]; -+ unsigned char ip_dst[4]; -+}; -+ -+static void print_MAC(unsigned char *p) -+{ -+ int i; -+ -+ for (i = 0; i < ETH_ALEN; i++, p++) -+ printk("%02x%c", *p, i == ETH_ALEN - 1 ? ' ':':'); -+} -+ -+#define myNIPQUAD(a) a[0], a[1], a[2], a[3] -+static void ebt_log(const struct sk_buff *skb, unsigned int hooknr, -+ const struct net_device *in, const struct net_device *out, -+ const void *data, unsigned int datalen) -+{ -+ struct ebt_log_info *info = (struct ebt_log_info *)data; -+ char level_string[4] = "< >"; -+ level_string[1] = '0' + info->loglevel; -+ -+ spin_lock_bh(&ebt_log_lock); -+ printk(level_string); -+ printk("%s IN=%s OUT=%s ", info->prefix, in ? in->name : "", -+ out ? out->name : ""); -+ -+ printk("MAC source = "); -+ print_MAC((skb->mac.ethernet)->h_source); -+ printk("MAC dest = "); -+ print_MAC((skb->mac.ethernet)->h_dest); -+ -+ printk("proto = 0x%04x", ntohs(((*skb).mac.ethernet)->h_proto)); -+ -+ if ((info->bitmask & EBT_LOG_IP) && skb->mac.ethernet->h_proto == -+ htons(ETH_P_IP)){ -+ struct iphdr *iph = skb->nh.iph; -+ printk(" IP SRC=%u.%u.%u.%u IP DST=%u.%u.%u.%u,", -+ NIPQUAD(iph->saddr), NIPQUAD(iph->daddr)); -+ printk(" IP tos=0x%02X, IP proto=%d", iph->tos, iph->protocol); -+ if (iph->protocol == IPPROTO_TCP || -+ iph->protocol == IPPROTO_UDP) { -+ struct tcpudphdr *ports = (struct tcpudphdr *)(skb->data + iph->ihl*4); -+ -+ if (skb->data + iph->ihl*4 > skb->tail) { -+ printk(" INCOMPLETE TCP/UDP header"); -+ goto out; -+ } -+ printk(" SPT=%u DPT=%u", ntohs(ports->src), -+ ntohs(ports->dst)); -+ } -+ goto out; -+ } -+ -+ if ((info->bitmask & EBT_LOG_ARP) && -+ ((skb->mac.ethernet->h_proto == __constant_htons(ETH_P_ARP)) || -+ (skb->mac.ethernet->h_proto == __constant_htons(ETH_P_RARP)))) { -+ struct arphdr * arph = skb->nh.arph; -+ printk(" ARP HTYPE=%d, PTYPE=0x%04x, OPCODE=%d", -+ ntohs(arph->ar_hrd), ntohs(arph->ar_pro), -+ ntohs(arph->ar_op)); -+ /* If it's for Ethernet and the lengths are OK, -+ * then log the ARP payload */ -+ if (arph->ar_hrd == __constant_htons(1) && -+ arph->ar_hln == ETH_ALEN && -+ arph->ar_pln == sizeof(uint32_t)) { -+ struct arppayload *arpp = (struct arppayload *)(skb->data + sizeof(*arph)); -+ -+ if (skb->data + sizeof(*arph) > skb->tail) { -+ printk(" INCOMPLETE ARP header"); -+ goto out; -+ } -+ -+ printk(" ARP MAC SRC="); -+ print_MAC(arpp->mac_src); -+ printk(" ARP IP SRC=%u.%u.%u.%u", -+ myNIPQUAD(arpp->ip_src)); -+ printk(" ARP MAC DST="); -+ print_MAC(arpp->mac_dst); -+ printk(" ARP IP DST=%u.%u.%u.%u", -+ myNIPQUAD(arpp->ip_dst)); -+ } -+ -+ } -+out: -+ printk("\n"); -+ spin_unlock_bh(&ebt_log_lock); -+} -+ -+static struct ebt_watcher log = -+{ -+ {NULL, NULL}, EBT_LOG_WATCHER, ebt_log, ebt_log_check, NULL, -+ THIS_MODULE -+}; -+ -+static int __init init(void) -+{ -+ return ebt_register_watcher(&log); -+} -+ -+static void __exit fini(void) -+{ -+ ebt_unregister_watcher(&log); -+} -+ -+module_init(init); -+module_exit(fini); -+EXPORT_NO_SYMBOLS; -+MODULE_LICENSE("GPL"); ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/ebt_ulog.c 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,281 @@ -+/* -+ * netfilter module for userspace bridged Ethernet frames logging daemons -+ * -+ * Authors: -+ * Bart De Schuymer -+ * -+ * November, 2004 -+ * -+ * Based on ipt_ULOG.c, which is -+ * (C) 2000-2002 by Harald Welte -+ * -+ * This module accepts two parameters: -+ * -+ * nlbufsiz: -+ * The parameter specifies how big the buffer for each netlink multicast -+ * group is. e.g. If you say nlbufsiz=8192, up to eight kb of packets will -+ * get accumulated in the kernel until they are sent to userspace. It is -+ * NOT possible to allocate more than 128kB, and it is strongly discouraged, -+ * because atomically allocating 128kB inside the network rx softirq is not -+ * reliable. Please also keep in mind that this buffer size is allocated for -+ * each nlgroup you are using, so the total kernel memory usage increases -+ * by that factor. -+ * -+ * flushtimeout: -+ * Specify, after how many hundredths of a second the queue should be -+ * flushed even if it is not full yet. -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "../br_private.h" -+ -+#define PRINTR(format, args...) do { if (net_ratelimit()) \ -+ printk(format , ## args); } while (0) -+ -+static unsigned int nlbufsiz = 4096; -+MODULE_PARM(nlbufsiz, "i"); -+MODULE_PARM_DESC(nlbufsiz, "netlink buffer size (number of bytes) " -+ "(defaults to 4096)"); -+ -+static unsigned int flushtimeout = 10; -+MODULE_PARM(flushtimeout, "i"); -+MODULE_PARM_DESC(flushtimeout, "buffer flush timeout (hundredths of a second) " -+ "(defaults to 10)"); -+ -+typedef struct { -+ unsigned int qlen; /* number of nlmsgs' in the skb */ -+ struct nlmsghdr *lastnlh; /* netlink header of last msg in skb */ -+ struct sk_buff *skb; /* the pre-allocated skb */ -+ struct timer_list timer; /* the timer function */ -+ spinlock_t lock; /* the per-queue lock */ -+} ebt_ulog_buff_t; -+ -+static ebt_ulog_buff_t ulog_buffers[EBT_ULOG_MAXNLGROUPS]; -+static struct sock *ebtlognl; -+ -+/* send one ulog_buff_t to userspace */ -+static void ulog_send(unsigned int nlgroup) -+{ -+ ebt_ulog_buff_t *ub = &ulog_buffers[nlgroup]; -+ -+ if (timer_pending(&ub->timer)) -+ del_timer(&ub->timer); -+ -+ /* last nlmsg needs NLMSG_DONE */ -+ if (ub->qlen > 1) -+ ub->lastnlh->nlmsg_type = NLMSG_DONE; -+ -+ NETLINK_CB(ub->skb).dst_groups = 1 << nlgroup; -+ netlink_broadcast(ebtlognl, ub->skb, 0, 1 << nlgroup, GFP_ATOMIC); -+ -+ ub->qlen = 0; -+ ub->skb = NULL; -+} -+ -+/* timer function to flush queue in flushtimeout time */ -+static void ulog_timer(unsigned long data) -+{ -+ spin_lock_bh(&ulog_buffers[data].lock); -+ if (ulog_buffers[data].skb) -+ ulog_send(data); -+ spin_unlock_bh(&ulog_buffers[data].lock); -+} -+ -+static struct sk_buff *ulog_alloc_skb(unsigned int size) -+{ -+ struct sk_buff *skb; -+ -+ skb = alloc_skb(nlbufsiz, GFP_ATOMIC); -+ if (!skb) { -+ PRINTR(KERN_ERR "ebt_ulog: can't alloc whole buffer " -+ "of size %ub!\n", nlbufsiz); -+ if (size < nlbufsiz) { -+ /* try to allocate only as much as we need for -+ * current packet */ -+ skb = alloc_skb(size, GFP_ATOMIC); -+ if (!skb) -+ PRINTR(KERN_ERR "ebt_ulog: can't even allocate " -+ "buffer of size %ub\n", size); -+ } -+ } -+ -+ return skb; -+} -+ -+static void ebt_ulog(const struct sk_buff *skb, unsigned int hooknr, -+ const struct net_device *in, const struct net_device *out, -+ const void *data, unsigned int datalen) -+{ -+ ebt_ulog_packet_msg_t *pm; -+ size_t size, copy_len; -+ struct nlmsghdr *nlh; -+ struct ebt_ulog_info *loginfo = (struct ebt_ulog_info *)data; -+ unsigned int group = loginfo->nlgroup; -+ ebt_ulog_buff_t *ub = &ulog_buffers[group]; -+ spinlock_t *lock = &ub->lock; -+ -+ if ((loginfo->cprange == 0) || -+ (loginfo->cprange > skb->len + ETH_HLEN)) -+ copy_len = skb->len + ETH_HLEN; -+ else -+ copy_len = loginfo->cprange; -+ -+ size = NLMSG_SPACE(sizeof(*pm) + copy_len); -+ -+ spin_lock_bh(lock); -+ -+ if (!ub->skb) { -+ if (!(ub->skb = ulog_alloc_skb(size))) -+ goto alloc_failure; -+ } else if (size > skb_tailroom(ub->skb)) { -+ ulog_send(group); -+ -+ if (!(ub->skb = ulog_alloc_skb(size))) -+ goto alloc_failure; -+ } -+ -+ nlh = NLMSG_PUT(ub->skb, 0, ub->qlen, 0, -+ size - NLMSG_ALIGN(sizeof(*nlh))); -+ ub->qlen++; -+ -+ pm = NLMSG_DATA(nlh); -+ -+ /* Fill in the ulog data */ -+ do_gettimeofday(&pm->stamp); -+ if (ub->qlen == 1) -+ ub->skb->stamp = pm->stamp; -+ pm->data_len = copy_len; -+ pm->mark = skb->nfmark; -+ pm->hook = hooknr; -+ if (loginfo->prefix != NULL) -+ strcpy(pm->prefix, loginfo->prefix); -+ else -+ *(pm->prefix) = '\0'; -+ -+ if (in) { -+ strcpy(pm->physindev, in->name); -+ strcpy(pm->indev, in->br_port->br->dev.name); -+ } else -+ pm->indev[0] = pm->physindev[0] = '\0'; -+ -+ if (out) { -+ strcpy(pm->physoutdev, out->name); -+ strcpy(pm->outdev, out->br_port->br->dev.name); -+ } else -+ pm->outdev[0] = pm->physoutdev[0] = '\0'; -+ -+ if (skb_copy_bits(skb, -ETH_HLEN, pm->data, copy_len) < 0) -+ BUG(); -+ -+ if (ub->qlen > 1) -+ ub->lastnlh->nlmsg_flags |= NLM_F_MULTI; -+ -+ ub->lastnlh = nlh; -+ -+ if (ub->qlen >= loginfo->qthreshold) -+ ulog_send(group); -+ else if (!timer_pending(&ub->timer)) { -+ ub->timer.expires = jiffies + flushtimeout * HZ / 100; -+ add_timer(&ub->timer); -+ } -+ -+unlock: -+ spin_unlock_bh(lock); -+ -+ return; -+ -+nlmsg_failure: -+ PRINTR(KERN_ERR "ebt_ULOG: error during NLMSG_PUT.\n"); -+ goto unlock; -+alloc_failure: -+ goto unlock; -+} -+ -+static int ebt_ulog_check(const char *tablename, unsigned int hookmask, -+ const struct ebt_entry *e, void *data, unsigned int datalen) -+{ -+ struct ebt_ulog_info *loginfo = (struct ebt_ulog_info *)data; -+ -+ if (datalen != EBT_ALIGN(sizeof(struct ebt_ulog_info)) || -+ loginfo->nlgroup > 31) -+ return -EINVAL; -+ -+ loginfo->prefix[EBT_ULOG_PREFIX_LEN - 1] = '\0'; -+ -+ if (loginfo->qthreshold > EBT_ULOG_MAX_QLEN) -+ loginfo->qthreshold = EBT_ULOG_MAX_QLEN; -+ -+ return 0; -+} -+ -+static struct ebt_watcher ulog = { -+ {NULL, NULL}, EBT_ULOG_WATCHER, ebt_ulog, ebt_ulog_check, NULL, -+ THIS_MODULE -+}; -+ -+static int __init init(void) -+{ -+ int i, ret = 0; -+ -+ if (nlbufsiz >= 128*1024) { -+ printk(KERN_NOTICE "ebt_ulog: Netlink buffer has to be <= 128kB," -+ " please try a smaller nlbufsiz parameter.\n"); -+ return -EINVAL; -+ } -+ -+ /* initialize ulog_buffers */ -+ for (i = 0; i < EBT_ULOG_MAXNLGROUPS; i++) { -+ init_timer(&ulog_buffers[i].timer); -+ ulog_buffers[i].timer.function = ulog_timer; -+ ulog_buffers[i].timer.data = i; -+ ulog_buffers[i].lock = SPIN_LOCK_UNLOCKED; -+ } -+ -+ ebtlognl = netlink_kernel_create(NETLINK_NFLOG, NULL); -+ if (!ebtlognl) -+ ret = -ENOMEM; -+ else if ((ret = ebt_register_watcher(&ulog))) -+ sock_release(ebtlognl->socket); -+ -+ return ret; -+} -+ -+static void __exit fini(void) -+{ -+ ebt_ulog_buff_t *ub; -+ int i; -+ -+ ebt_unregister_watcher(&ulog); -+ for (i = 0; i < EBT_ULOG_MAXNLGROUPS; i++) { -+ ub = &ulog_buffers[i]; -+ if (timer_pending(&ub->timer)) -+ del_timer(&ub->timer); -+ spin_lock_bh(&ub->lock); -+ if (ub->skb) { -+ kfree_skb(ub->skb); -+ ub->skb = NULL; -+ } -+ spin_unlock_bh(&ub->lock); -+ } -+ sock_release(ebtlognl->socket); -+} -+ -+module_init(init); -+module_exit(fini); -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Bart De Schuymer "); -+MODULE_DESCRIPTION("ebtables userspace logging module for bridged Ethernet" -+ " frames"); ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/ebt_snat.c 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,64 @@ -+/* -+ * ebt_snat -+ * -+ * Authors: -+ * Bart De Schuymer -+ * -+ * June, 2002 -+ * -+ */ -+ -+#include -+#include -+#include -+ -+static int ebt_target_snat(struct sk_buff **pskb, unsigned int hooknr, -+ const struct net_device *in, const struct net_device *out, -+ const void *data, unsigned int datalen) -+{ -+ struct ebt_nat_info *info = (struct ebt_nat_info *) data; -+ -+ memcpy(((**pskb).mac.ethernet)->h_source, info->mac, -+ ETH_ALEN * sizeof(unsigned char)); -+ return info->target; -+} -+ -+static int ebt_target_snat_check(const char *tablename, unsigned int hookmask, -+ const struct ebt_entry *e, void *data, unsigned int datalen) -+{ -+ struct ebt_nat_info *info = (struct ebt_nat_info *) data; -+ -+ if (datalen != EBT_ALIGN(sizeof(struct ebt_nat_info))) -+ return -EINVAL; -+ if (BASE_CHAIN && info->target == EBT_RETURN) -+ return -EINVAL; -+ CLEAR_BASE_CHAIN_BIT; -+ if (strcmp(tablename, "nat")) -+ return -EINVAL; -+ if (hookmask & ~(1 << NF_BR_POST_ROUTING)) -+ return -EINVAL; -+ if (INVALID_TARGET) -+ return -EINVAL; -+ return 0; -+} -+ -+static struct ebt_target snat = -+{ -+ {NULL, NULL}, EBT_SNAT_TARGET, ebt_target_snat, ebt_target_snat_check, -+ NULL, THIS_MODULE -+}; -+ -+static int __init init(void) -+{ -+ return ebt_register_target(&snat); -+} -+ -+static void __exit fini(void) -+{ -+ ebt_unregister_target(&snat); -+} -+ -+module_init(init); -+module_exit(fini); -+EXPORT_NO_SYMBOLS; -+MODULE_LICENSE("GPL"); ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/ebt_dnat.c 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,65 @@ -+/* -+ * ebt_dnat -+ * -+ * Authors: -+ * Bart De Schuymer -+ * -+ * June, 2002 -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+ -+static int ebt_target_dnat(struct sk_buff **pskb, unsigned int hooknr, -+ const struct net_device *in, const struct net_device *out, -+ const void *data, unsigned int datalen) -+{ -+ struct ebt_nat_info *info = (struct ebt_nat_info *)data; -+ -+ memcpy(((**pskb).mac.ethernet)->h_dest, info->mac, -+ ETH_ALEN * sizeof(unsigned char)); -+ return info->target; -+} -+ -+static int ebt_target_dnat_check(const char *tablename, unsigned int hookmask, -+ const struct ebt_entry *e, void *data, unsigned int datalen) -+{ -+ struct ebt_nat_info *info = (struct ebt_nat_info *)data; -+ -+ if (BASE_CHAIN && info->target == EBT_RETURN) -+ return -EINVAL; -+ CLEAR_BASE_CHAIN_BIT; -+ if ( (strcmp(tablename, "nat") || -+ (hookmask & ~((1 << NF_BR_PRE_ROUTING) | (1 << NF_BR_LOCAL_OUT)))) && -+ (strcmp(tablename, "broute") || hookmask & ~(1 << NF_BR_BROUTING)) ) -+ return -EINVAL; -+ if (datalen != EBT_ALIGN(sizeof(struct ebt_nat_info))) -+ return -EINVAL; -+ if (INVALID_TARGET) -+ return -EINVAL; -+ return 0; -+} -+ -+static struct ebt_target dnat = -+{ -+ {NULL, NULL}, EBT_DNAT_TARGET, ebt_target_dnat, ebt_target_dnat_check, -+ NULL, THIS_MODULE -+}; -+ -+static int __init init(void) -+{ -+ return ebt_register_target(&dnat); -+} -+ -+static void __exit fini(void) -+{ -+ ebt_unregister_target(&dnat); -+} -+ -+module_init(init); -+module_exit(fini); -+EXPORT_NO_SYMBOLS; -+MODULE_LICENSE("GPL"); ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/netfilter/ebtables.c 2005-03-14 21:04:05.155913576 +0100 -@@ -0,0 +1,1497 @@ -+/* -+ * ebtables -+ * -+ * Author: -+ * Bart De Schuymer -+ * -+ * ebtables.c,v 2.0, July, 2002 -+ * -+ * This code is stongly inspired on the iptables code which is -+ * Copyright (C) 1999 Paul `Rusty' Russell & Michael J. Neuling -+ * -+ * 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. -+ */ -+ -+// used for print_string -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+// needed for logical [in,out]-dev filtering -+#include "../br_private.h" -+ -+// list_named_find -+#define ASSERT_READ_LOCK(x) -+#define ASSERT_WRITE_LOCK(x) -+#include -+ -+#if 0 // use this for remote debugging -+// Copyright (C) 1998 by Ori Pomerantz -+// Print the string to the appropriate tty, the one -+// the current task uses -+static void print_string(char *str) -+{ -+ struct tty_struct *my_tty; -+ -+ /* The tty for the current task */ -+ my_tty = current->tty; -+ if (my_tty != NULL) { -+ (*(my_tty->driver).write)(my_tty, 0, str, strlen(str)); -+ (*(my_tty->driver).write)(my_tty, 0, "\015\012", 2); -+ } -+} -+ -+#define BUGPRINT(args) print_string(args); -+#else -+#define BUGPRINT(format, args...) printk("kernel msg: ebtables bug: please "\ -+ "report to author: "format, ## args) -+// #define BUGPRINT(format, args...) -+#endif -+#define MEMPRINT(format, args...) printk("kernel msg: ebtables "\ -+ ": out of memory: "format, ## args) -+// #define MEMPRINT(format, args...) -+ -+ -+ -+// Each cpu has its own set of counters, so there is no need for write_lock in -+// the softirq -+// For reading or updating the counters, the user context needs to -+// get a write_lock -+ -+// The size of each set of counters is altered to get cache alignment -+#define SMP_ALIGN(x) (((x) + SMP_CACHE_BYTES-1) & ~(SMP_CACHE_BYTES-1)) -+#define COUNTER_OFFSET(n) (SMP_ALIGN(n * sizeof(struct ebt_counter))) -+#define COUNTER_BASE(c, n, cpu) ((struct ebt_counter *)(((char *)c) + \ -+ COUNTER_OFFSET(n) * cpu)) -+ -+ -+ -+static DECLARE_MUTEX(ebt_mutex); -+static LIST_HEAD(ebt_tables); -+static LIST_HEAD(ebt_targets); -+static LIST_HEAD(ebt_matches); -+static LIST_HEAD(ebt_watchers); -+ -+static struct ebt_target ebt_standard_target = -+{ {NULL, NULL}, EBT_STANDARD_TARGET, NULL, NULL, NULL, NULL}; -+ -+static inline int ebt_do_watcher (struct ebt_entry_watcher *w, -+ const struct sk_buff *skb, unsigned int hooknr, const struct net_device *in, -+ const struct net_device *out) -+{ -+ w->u.watcher->watcher(skb, hooknr, in, out, w->data, -+ w->watcher_size); -+ // watchers don't give a verdict -+ return 0; -+} -+ -+static inline int ebt_do_match (struct ebt_entry_match *m, -+ const struct sk_buff *skb, const struct net_device *in, -+ const struct net_device *out) -+{ -+ return m->u.match->match(skb, in, out, m->data, -+ m->match_size); -+} -+ -+static inline int ebt_dev_check(char *entry, const struct net_device *device) -+{ -+ int i = 0; -+ char *devname = device->name; -+ -+ if (*entry == '\0') -+ return 0; -+ if (!device) -+ return 1; -+ /* 1 is the wildcard token */ -+ while (entry[i] != '\0' && entry[i] != 1 && entry[i] == devname[i]) -+ i++; -+ return (devname[i] != entry[i] && entry[i] != 1); -+} -+ -+#define FWINV2(bool,invflg) ((bool) ^ !!(e->invflags & invflg)) -+// process standard matches -+static inline int ebt_basic_match(struct ebt_entry *e, struct ethhdr *h, -+ const struct net_device *in, const struct net_device *out) -+{ -+ int verdict, i; -+ -+ if (e->bitmask & EBT_802_3) { -+ if (FWINV2(ntohs(h->h_proto) >= 1536, EBT_IPROTO)) -+ return 1; -+ } else if (!(e->bitmask & EBT_NOPROTO) && -+ FWINV2(e->ethproto != h->h_proto, EBT_IPROTO)) -+ return 1; -+ -+ if (FWINV2(ebt_dev_check(e->in, in), EBT_IIN)) -+ return 1; -+ if (FWINV2(ebt_dev_check(e->out, out), EBT_IOUT)) -+ return 1; -+ if ((!in || !in->br_port) ? 0 : FWINV2(ebt_dev_check( -+ e->logical_in, &in->br_port->br->dev), EBT_ILOGICALIN)) -+ return 1; -+ if ((!out || !out->br_port) ? 0 : FWINV2(ebt_dev_check( -+ e->logical_out, &out->br_port->br->dev), EBT_ILOGICALOUT)) -+ return 1; -+ -+ if (e->bitmask & EBT_SOURCEMAC) { -+ verdict = 0; -+ for (i = 0; i < 6; i++) -+ verdict |= (h->h_source[i] ^ e->sourcemac[i]) & -+ e->sourcemsk[i]; -+ if (FWINV2(verdict != 0, EBT_ISOURCE) ) -+ return 1; -+ } -+ if (e->bitmask & EBT_DESTMAC) { -+ verdict = 0; -+ for (i = 0; i < 6; i++) -+ verdict |= (h->h_dest[i] ^ e->destmac[i]) & -+ e->destmsk[i]; -+ if (FWINV2(verdict != 0, EBT_IDEST) ) -+ return 1; -+ } -+ return 0; -+} -+ -+// Do some firewalling -+unsigned int ebt_do_table (unsigned int hook, struct sk_buff **pskb, -+ const struct net_device *in, const struct net_device *out, -+ struct ebt_table *table) -+{ -+ int i, nentries; -+ struct ebt_entry *point; -+ struct ebt_counter *counter_base, *cb_base; -+ struct ebt_entry_target *t; -+ int verdict, sp = 0; -+ struct ebt_chainstack *cs; -+ struct ebt_entries *chaininfo; -+ char *base; -+ struct ebt_table_info *private; -+ -+ read_lock_bh(&table->lock); -+ private = table->private; -+ cb_base = COUNTER_BASE(private->counters, private->nentries, -+ cpu_number_map(smp_processor_id())); -+ if (private->chainstack) -+ cs = private->chainstack[cpu_number_map(smp_processor_id())]; -+ else -+ cs = NULL; -+ chaininfo = private->hook_entry[hook]; -+ nentries = private->hook_entry[hook]->nentries; -+ point = (struct ebt_entry *)(private->hook_entry[hook]->data); -+ counter_base = cb_base + private->hook_entry[hook]->counter_offset; -+ // base for chain jumps -+ base = private->entries; -+ i = 0; -+ while (i < nentries) { -+ if (ebt_basic_match(point, (**pskb).mac.ethernet, in, out)) -+ goto letscontinue; -+ -+ if (EBT_MATCH_ITERATE(point, ebt_do_match, *pskb, in, out) != 0) -+ goto letscontinue; -+ -+ // increase counter -+ (*(counter_base + i)).pcnt++; -+ (*(counter_base + i)).bcnt+=(**pskb).len; -+ -+ // these should only watch: not modify, nor tell us -+ // what to do with the packet -+ EBT_WATCHER_ITERATE(point, ebt_do_watcher, *pskb, hook, in, -+ out); -+ -+ t = (struct ebt_entry_target *) -+ (((char *)point) + point->target_offset); -+ // standard target -+ if (!t->u.target->target) -+ verdict = ((struct ebt_standard_target *)t)->verdict; -+ else -+ verdict = t->u.target->target(pskb, hook, -+ in, out, t->data, t->target_size); -+ if (verdict == EBT_ACCEPT) { -+ read_unlock_bh(&table->lock); -+ return NF_ACCEPT; -+ } -+ if (verdict == EBT_DROP) { -+ read_unlock_bh(&table->lock); -+ return NF_DROP; -+ } -+ if (verdict == EBT_RETURN) { -+letsreturn: -+#ifdef CONFIG_NETFILTER_DEBUG -+ if (sp == 0) { -+ BUGPRINT("RETURN on base chain"); -+ // act like this is EBT_CONTINUE -+ goto letscontinue; -+ } -+#endif -+ sp--; -+ // put all the local variables right -+ i = cs[sp].n; -+ chaininfo = cs[sp].chaininfo; -+ nentries = chaininfo->nentries; -+ point = cs[sp].e; -+ counter_base = cb_base + -+ chaininfo->counter_offset; -+ continue; -+ } -+ if (verdict == EBT_CONTINUE) -+ goto letscontinue; -+#ifdef CONFIG_NETFILTER_DEBUG -+ if (verdict < 0) { -+ BUGPRINT("bogus standard verdict\n"); -+ read_unlock_bh(&table->lock); -+ return NF_DROP; -+ } -+#endif -+ // jump to a udc -+ cs[sp].n = i + 1; -+ cs[sp].chaininfo = chaininfo; -+ cs[sp].e = (struct ebt_entry *) -+ (((char *)point) + point->next_offset); -+ i = 0; -+ chaininfo = (struct ebt_entries *) (base + verdict); -+#ifdef CONFIG_NETFILTER_DEBUG -+ if (chaininfo->distinguisher) { -+ BUGPRINT("jump to non-chain\n"); -+ read_unlock_bh(&table->lock); -+ return NF_DROP; -+ } -+#endif -+ nentries = chaininfo->nentries; -+ point = (struct ebt_entry *)chaininfo->data; -+ counter_base = cb_base + chaininfo->counter_offset; -+ sp++; -+ continue; -+letscontinue: -+ point = (struct ebt_entry *) -+ (((char *)point) + point->next_offset); -+ i++; -+ } -+ -+ // I actually like this :) -+ if (chaininfo->policy == EBT_RETURN) -+ goto letsreturn; -+ if (chaininfo->policy == EBT_ACCEPT) { -+ read_unlock_bh(&table->lock); -+ return NF_ACCEPT; -+ } -+ read_unlock_bh(&table->lock); -+ return NF_DROP; -+} -+ -+// If it succeeds, returns element and locks mutex -+static inline void * -+find_inlist_lock_noload(struct list_head *head, const char *name, int *error, -+ struct semaphore *mutex) -+{ -+ void *ret; -+ -+ *error = down_interruptible(mutex); -+ if (*error != 0) -+ return NULL; -+ -+ ret = list_named_find(head, name); -+ if (!ret) { -+ *error = -ENOENT; -+ up(mutex); -+ } -+ return ret; -+} -+ -+#ifndef CONFIG_KMOD -+#define find_inlist_lock(h,n,p,e,m) find_inlist_lock_noload((h),(n),(e),(m)) -+#else -+static void * -+find_inlist_lock(struct list_head *head, const char *name, const char *prefix, -+ int *error, struct semaphore *mutex) -+{ -+ void *ret; -+ -+ ret = find_inlist_lock_noload(head, name, error, mutex); -+ if (!ret) { -+ char modulename[EBT_FUNCTION_MAXNAMELEN + strlen(prefix) + 1]; -+ strcpy(modulename, prefix); -+ strcat(modulename, name); -+ request_module(modulename); -+ ret = find_inlist_lock_noload(head, name, error, mutex); -+ } -+ return ret; -+} -+#endif -+ -+static inline struct ebt_table * -+find_table_lock(const char *name, int *error, struct semaphore *mutex) -+{ -+ return find_inlist_lock(&ebt_tables, name, "ebtable_", error, mutex); -+} -+ -+static inline struct ebt_match * -+find_match_lock(const char *name, int *error, struct semaphore *mutex) -+{ -+ return find_inlist_lock(&ebt_matches, name, "ebt_", error, mutex); -+} -+ -+static inline struct ebt_watcher * -+find_watcher_lock(const char *name, int *error, struct semaphore *mutex) -+{ -+ return find_inlist_lock(&ebt_watchers, name, "ebt_", error, mutex); -+} -+ -+static inline struct ebt_target * -+find_target_lock(const char *name, int *error, struct semaphore *mutex) -+{ -+ return find_inlist_lock(&ebt_targets, name, "ebt_", error, mutex); -+} -+ -+static inline int -+ebt_check_match(struct ebt_entry_match *m, struct ebt_entry *e, -+ const char *name, unsigned int hookmask, unsigned int *cnt) -+{ -+ struct ebt_match *match; -+ int ret; -+ -+ if (((char *)m) + m->match_size + sizeof(struct ebt_entry_match) > -+ ((char *)e) + e->watchers_offset) -+ return -EINVAL; -+ match = find_match_lock(m->u.name, &ret, &ebt_mutex); -+ if (!match) -+ return ret; -+ m->u.match = match; -+ if (match->me) -+ __MOD_INC_USE_COUNT(match->me); -+ up(&ebt_mutex); -+ if (match->check && -+ match->check(name, hookmask, e, m->data, m->match_size) != 0) { -+ BUGPRINT("match->check failed\n"); -+ if (match->me) -+ __MOD_DEC_USE_COUNT(match->me); -+ return -EINVAL; -+ } -+ (*cnt)++; -+ return 0; -+} -+ -+static inline int -+ebt_check_watcher(struct ebt_entry_watcher *w, struct ebt_entry *e, -+ const char *name, unsigned int hookmask, unsigned int *cnt) -+{ -+ struct ebt_watcher *watcher; -+ int ret; -+ -+ if (((char *)w) + w->watcher_size + sizeof(struct ebt_entry_watcher) > -+ ((char *)e) + e->target_offset) -+ return -EINVAL; -+ watcher = find_watcher_lock(w->u.name, &ret, &ebt_mutex); -+ if (!watcher) -+ return ret; -+ w->u.watcher = watcher; -+ if (watcher->me) -+ __MOD_INC_USE_COUNT(watcher->me); -+ up(&ebt_mutex); -+ if (watcher->check && -+ watcher->check(name, hookmask, e, w->data, w->watcher_size) != 0) { -+ BUGPRINT("watcher->check failed\n"); -+ if (watcher->me) -+ __MOD_DEC_USE_COUNT(watcher->me); -+ return -EINVAL; -+ } -+ (*cnt)++; -+ return 0; -+} -+ -+// this one is very careful, as it is the first function -+// to parse the userspace data -+static inline int -+ebt_check_entry_size_and_hooks(struct ebt_entry *e, -+ struct ebt_table_info *newinfo, char *base, char *limit, -+ struct ebt_entries **hook_entries, unsigned int *n, unsigned int *cnt, -+ unsigned int *totalcnt, unsigned int *udc_cnt, unsigned int valid_hooks) -+{ -+ int i; -+ -+ for (i = 0; i < NF_BR_NUMHOOKS; i++) { -+ if ((valid_hooks & (1 << i)) == 0) -+ continue; -+ if ( (char *)hook_entries[i] - base == -+ (char *)e - newinfo->entries) -+ break; -+ } -+ // beginning of a new chain -+ // if i == NF_BR_NUMHOOKS it must be a user defined chain -+ if (i != NF_BR_NUMHOOKS || !(e->bitmask & EBT_ENTRY_OR_ENTRIES)) { -+ if ((e->bitmask & EBT_ENTRY_OR_ENTRIES) != 0) { -+ // we make userspace set this right, -+ // so there is no misunderstanding -+ BUGPRINT("EBT_ENTRY_OR_ENTRIES shouldn't be set " -+ "in distinguisher\n"); -+ return -EINVAL; -+ } -+ // this checks if the previous chain has as many entries -+ // as it said it has -+ if (*n != *cnt) { -+ BUGPRINT("nentries does not equal the nr of entries " -+ "in the chain\n"); -+ return -EINVAL; -+ } -+ // before we look at the struct, be sure it is not too big -+ if ((char *)hook_entries[i] + sizeof(struct ebt_entries) -+ > limit) { -+ BUGPRINT("entries_size too small\n"); -+ return -EINVAL; -+ } -+ if (((struct ebt_entries *)e)->policy != EBT_DROP && -+ ((struct ebt_entries *)e)->policy != EBT_ACCEPT) { -+ // only RETURN from udc -+ if (i != NF_BR_NUMHOOKS || -+ ((struct ebt_entries *)e)->policy != EBT_RETURN) { -+ BUGPRINT("bad policy\n"); -+ return -EINVAL; -+ } -+ } -+ if (i == NF_BR_NUMHOOKS) // it's a user defined chain -+ (*udc_cnt)++; -+ else -+ newinfo->hook_entry[i] = (struct ebt_entries *)e; -+ if (((struct ebt_entries *)e)->counter_offset != *totalcnt) { -+ BUGPRINT("counter_offset != totalcnt"); -+ return -EINVAL; -+ } -+ *n = ((struct ebt_entries *)e)->nentries; -+ *cnt = 0; -+ return 0; -+ } -+ // a plain old entry, heh -+ if (sizeof(struct ebt_entry) > e->watchers_offset || -+ e->watchers_offset > e->target_offset || -+ e->target_offset >= e->next_offset) { -+ BUGPRINT("entry offsets not in right order\n"); -+ return -EINVAL; -+ } -+ // this is not checked anywhere else -+ if (e->next_offset - e->target_offset < sizeof(struct ebt_entry_target)) { -+ BUGPRINT("target size too small\n"); -+ return -EINVAL; -+ } -+ -+ (*cnt)++; -+ (*totalcnt)++; -+ return 0; -+} -+ -+struct ebt_cl_stack -+{ -+ struct ebt_chainstack cs; -+ int from; -+ unsigned int hookmask; -+}; -+ -+// we need these positions to check that the jumps to a different part of the -+// entries is a jump to the beginning of a new chain. -+static inline int -+ebt_get_udc_positions(struct ebt_entry *e, struct ebt_table_info *newinfo, -+ struct ebt_entries **hook_entries, unsigned int *n, unsigned int valid_hooks, -+ struct ebt_cl_stack *udc) -+{ -+ int i; -+ -+ // we're only interested in chain starts -+ if (e->bitmask & EBT_ENTRY_OR_ENTRIES) -+ return 0; -+ for (i = 0; i < NF_BR_NUMHOOKS; i++) { -+ if ((valid_hooks & (1 << i)) == 0) -+ continue; -+ if (newinfo->hook_entry[i] == (struct ebt_entries *)e) -+ break; -+ } -+ // only care about udc -+ if (i != NF_BR_NUMHOOKS) -+ return 0; -+ -+ udc[*n].cs.chaininfo = (struct ebt_entries *)e; -+ // these initialisations are depended on later in check_chainloops() -+ udc[*n].cs.n = 0; -+ udc[*n].hookmask = 0; -+ -+ (*n)++; -+ return 0; -+} -+ -+static inline int -+ebt_cleanup_match(struct ebt_entry_match *m, unsigned int *i) -+{ -+ if (i && (*i)-- == 0) -+ return 1; -+ if (m->u.match->destroy) -+ m->u.match->destroy(m->data, m->match_size); -+ if (m->u.match->me) -+ __MOD_DEC_USE_COUNT(m->u.match->me); -+ -+ return 0; -+} -+ -+static inline int -+ebt_cleanup_watcher(struct ebt_entry_watcher *w, unsigned int *i) -+{ -+ if (i && (*i)-- == 0) -+ return 1; -+ if (w->u.watcher->destroy) -+ w->u.watcher->destroy(w->data, w->watcher_size); -+ if (w->u.watcher->me) -+ __MOD_DEC_USE_COUNT(w->u.watcher->me); -+ -+ return 0; -+} -+ -+static inline int -+ebt_cleanup_entry(struct ebt_entry *e, unsigned int *cnt) -+{ -+ struct ebt_entry_target *t; -+ -+ if ((e->bitmask & EBT_ENTRY_OR_ENTRIES) == 0) -+ return 0; -+ // we're done -+ if (cnt && (*cnt)-- == 0) -+ return 1; -+ EBT_WATCHER_ITERATE(e, ebt_cleanup_watcher, NULL); -+ EBT_MATCH_ITERATE(e, ebt_cleanup_match, NULL); -+ t = (struct ebt_entry_target *)(((char *)e) + e->target_offset); -+ if (t->u.target->destroy) -+ t->u.target->destroy(t->data, t->target_size); -+ if (t->u.target->me) -+ __MOD_DEC_USE_COUNT(t->u.target->me); -+ -+ return 0; -+} -+ -+static inline int -+ebt_check_entry(struct ebt_entry *e, struct ebt_table_info *newinfo, -+ const char *name, unsigned int *cnt, unsigned int valid_hooks, -+ struct ebt_cl_stack *cl_s, unsigned int udc_cnt) -+{ -+ struct ebt_entry_target *t; -+ struct ebt_target *target; -+ unsigned int i, j, hook = 0, hookmask = 0; -+ int ret; -+ -+ // Don't mess with the struct ebt_entries -+ if ((e->bitmask & EBT_ENTRY_OR_ENTRIES) == 0) -+ return 0; -+ -+ if (e->bitmask & ~EBT_F_MASK) { -+ BUGPRINT("Unknown flag for bitmask\n"); -+ return -EINVAL; -+ } -+ if (e->invflags & ~EBT_INV_MASK) { -+ BUGPRINT("Unknown flag for inv bitmask\n"); -+ return -EINVAL; -+ } -+ if ( (e->bitmask & EBT_NOPROTO) && (e->bitmask & EBT_802_3) ) { -+ BUGPRINT("NOPROTO & 802_3 not allowed\n"); -+ return -EINVAL; -+ } -+ // what hook do we belong to? -+ for (i = 0; i < NF_BR_NUMHOOKS; i++) { -+ if ((valid_hooks & (1 << i)) == 0) -+ continue; -+ if ((char *)newinfo->hook_entry[i] < (char *)e) -+ hook = i; -+ else -+ break; -+ } -+ // (1 << NF_BR_NUMHOOKS) tells the check functions the rule is on -+ // a base chain -+ if (i < NF_BR_NUMHOOKS) -+ hookmask = (1 << hook) | (1 << NF_BR_NUMHOOKS); -+ else { -+ for (i = 0; i < udc_cnt; i++) -+ if ((char *)(cl_s[i].cs.chaininfo) > (char *)e) -+ break; -+ if (i == 0) -+ hookmask = (1 << hook) | (1 << NF_BR_NUMHOOKS); -+ else -+ hookmask = cl_s[i - 1].hookmask; -+ } -+ i = 0; -+ ret = EBT_MATCH_ITERATE(e, ebt_check_match, e, name, hookmask, &i); -+ if (ret != 0) -+ goto cleanup_matches; -+ j = 0; -+ ret = EBT_WATCHER_ITERATE(e, ebt_check_watcher, e, name, hookmask, &j); -+ if (ret != 0) -+ goto cleanup_watchers; -+ t = (struct ebt_entry_target *)(((char *)e) + e->target_offset); -+ target = find_target_lock(t->u.name, &ret, &ebt_mutex); -+ if (!target) -+ goto cleanup_watchers; -+ if (target->me) -+ __MOD_INC_USE_COUNT(target->me); -+ up(&ebt_mutex); -+ -+ t->u.target = target; -+ if (t->u.target == &ebt_standard_target) { -+ if (e->target_offset + sizeof(struct ebt_standard_target) > -+ e->next_offset) { -+ BUGPRINT("Standard target size too big\n"); -+ ret = -EFAULT; -+ goto cleanup_watchers; -+ } -+ if (((struct ebt_standard_target *)t)->verdict < -+ -NUM_STANDARD_TARGETS) { -+ BUGPRINT("Invalid standard target\n"); -+ ret = -EFAULT; -+ goto cleanup_watchers; -+ } -+ } else if ((e->target_offset + t->target_size + -+ sizeof(struct ebt_entry_target) > e->next_offset) || -+ (t->u.target->check && -+ t->u.target->check(name, hookmask, e, t->data, t->target_size) != 0)){ -+ if (t->u.target->me) -+ __MOD_DEC_USE_COUNT(t->u.target->me); -+ ret = -EFAULT; -+ goto cleanup_watchers; -+ } -+ (*cnt)++; -+ return 0; -+cleanup_watchers: -+ EBT_WATCHER_ITERATE(e, ebt_cleanup_watcher, &j); -+cleanup_matches: -+ EBT_MATCH_ITERATE(e, ebt_cleanup_match, &i); -+ return ret; -+} -+ -+// checks for loops and sets the hook mask for udc -+// the hook mask for udc tells us from which base chains the udc can be -+// accessed. This mask is a parameter to the check() functions of the extensions -+static int check_chainloops(struct ebt_entries *chain, -+ struct ebt_cl_stack *cl_s, unsigned int udc_cnt, -+ unsigned int hooknr, char *base) -+{ -+ int i, chain_nr = -1, pos = 0, nentries = chain->nentries, verdict; -+ struct ebt_entry *e = (struct ebt_entry *)chain->data; -+ struct ebt_entry_target *t; -+ -+ while (pos < nentries || chain_nr != -1) { -+ // end of udc, go back one 'recursion' step -+ if (pos == nentries) { -+ // put back values of the time when this chain was called -+ e = cl_s[chain_nr].cs.e; -+ if (cl_s[chain_nr].from != -1) -+ nentries = -+ cl_s[cl_s[chain_nr].from].cs.chaininfo->nentries; -+ else -+ nentries = chain->nentries; -+ pos = cl_s[chain_nr].cs.n; -+ // make sure we won't see a loop that isn't one -+ cl_s[chain_nr].cs.n = 0; -+ chain_nr = cl_s[chain_nr].from; -+ if (pos == nentries) -+ continue; -+ } -+ t = (struct ebt_entry_target *) -+ (((char *)e) + e->target_offset); -+ if (strcmp(t->u.name, EBT_STANDARD_TARGET)) -+ goto letscontinue; -+ if (e->target_offset + sizeof(struct ebt_standard_target) > -+ e->next_offset) { -+ BUGPRINT("Standard target size too big\n"); -+ return -1; -+ } -+ verdict = ((struct ebt_standard_target *)t)->verdict; -+ if (verdict >= 0) { // jump to another chain -+ struct ebt_entries *hlp2 = -+ (struct ebt_entries *)(base + verdict); -+ for (i = 0; i < udc_cnt; i++) -+ if (hlp2 == cl_s[i].cs.chaininfo) -+ break; -+ // bad destination or loop -+ if (i == udc_cnt) { -+ BUGPRINT("bad destination\n"); -+ return -1; -+ } -+ if (cl_s[i].cs.n) { -+ BUGPRINT("loop\n"); -+ return -1; -+ } -+ // this can't be 0, so the above test is correct -+ cl_s[i].cs.n = pos + 1; -+ pos = 0; -+ cl_s[i].cs.e = ((void *)e + e->next_offset); -+ e = (struct ebt_entry *)(hlp2->data); -+ nentries = hlp2->nentries; -+ cl_s[i].from = chain_nr; -+ chain_nr = i; -+ // this udc is accessible from the base chain for hooknr -+ cl_s[i].hookmask |= (1 << hooknr); -+ continue; -+ } -+letscontinue: -+ e = (void *)e + e->next_offset; -+ pos++; -+ } -+ return 0; -+} -+ -+// do the parsing of the table/chains/entries/matches/watchers/targets, heh -+static int translate_table(struct ebt_replace *repl, -+ struct ebt_table_info *newinfo) -+{ -+ unsigned int i, j, k, udc_cnt; -+ int ret; -+ struct ebt_cl_stack *cl_s = NULL; // used in the checking for chain loops -+ -+ i = 0; -+ while (i < NF_BR_NUMHOOKS && !(repl->valid_hooks & (1 << i))) -+ i++; -+ if (i == NF_BR_NUMHOOKS) { -+ BUGPRINT("No valid hooks specified\n"); -+ return -EINVAL; -+ } -+ if (repl->hook_entry[i] != (struct ebt_entries *)repl->entries) { -+ BUGPRINT("Chains don't start at beginning\n"); -+ return -EINVAL; -+ } -+ // make sure chains are ordered after each other in same order -+ // as their corresponding hooks -+ for (j = i + 1; j < NF_BR_NUMHOOKS; j++) { -+ if (!(repl->valid_hooks & (1 << j))) -+ continue; -+ if ( repl->hook_entry[j] <= repl->hook_entry[i] ) { -+ BUGPRINT("Hook order must be followed\n"); -+ return -EINVAL; -+ } -+ i = j; -+ } -+ -+ for (i = 0; i < NF_BR_NUMHOOKS; i++) -+ newinfo->hook_entry[i] = NULL; -+ -+ newinfo->entries_size = repl->entries_size; -+ newinfo->nentries = repl->nentries; -+ -+ // do some early checkings and initialize some things -+ i = 0; // holds the expected nr. of entries for the chain -+ j = 0; // holds the up to now counted entries for the chain -+ k = 0; // holds the total nr. of entries, should equal -+ // newinfo->nentries afterwards -+ udc_cnt = 0; // will hold the nr. of user defined chains (udc) -+ ret = EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, -+ ebt_check_entry_size_and_hooks, newinfo, repl->entries, -+ repl->entries + repl->entries_size, repl->hook_entry, &i, &j, &k, -+ &udc_cnt, repl->valid_hooks); -+ -+ if (ret != 0) -+ return ret; -+ -+ if (i != j) { -+ BUGPRINT("nentries does not equal the nr of entries in the " -+ "(last) chain\n"); -+ return -EINVAL; -+ } -+ if (k != newinfo->nentries) { -+ BUGPRINT("Total nentries is wrong\n"); -+ return -EINVAL; -+ } -+ -+ // check if all valid hooks have a chain -+ for (i = 0; i < NF_BR_NUMHOOKS; i++) { -+ if (newinfo->hook_entry[i] == NULL && -+ (repl->valid_hooks & (1 << i))) { -+ BUGPRINT("Valid hook without chain\n"); -+ return -EINVAL; -+ } -+ } -+ -+ // Get the location of the udc, put them in an array -+ // While we're at it, allocate the chainstack -+ if (udc_cnt) { -+ // this will get free'd in do_replace()/ebt_register_table() -+ // if an error occurs -+ newinfo->chainstack = (struct ebt_chainstack **) -+ vmalloc(smp_num_cpus * sizeof(struct ebt_chainstack)); -+ if (!newinfo->chainstack) -+ return -ENOMEM; -+ for (i = 0; i < smp_num_cpus; i++) { -+ newinfo->chainstack[i] = -+ vmalloc(udc_cnt * sizeof(struct ebt_chainstack)); -+ if (!newinfo->chainstack[i]) { -+ while (i) -+ vfree(newinfo->chainstack[--i]); -+ vfree(newinfo->chainstack); -+ newinfo->chainstack = NULL; -+ return -ENOMEM; -+ } -+ } -+ -+ cl_s = (struct ebt_cl_stack *) -+ vmalloc(udc_cnt * sizeof(struct ebt_cl_stack)); -+ if (!cl_s) -+ return -ENOMEM; -+ i = 0; // the i'th udc -+ EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, -+ ebt_get_udc_positions, newinfo, repl->hook_entry, &i, -+ repl->valid_hooks, cl_s); -+ // sanity check -+ if (i != udc_cnt) { -+ BUGPRINT("i != udc_cnt\n"); -+ vfree(cl_s); -+ return -EFAULT; -+ } -+ } -+ -+ // Check for loops -+ for (i = 0; i < NF_BR_NUMHOOKS; i++) -+ if (repl->valid_hooks & (1 << i)) -+ if (check_chainloops(newinfo->hook_entry[i], -+ cl_s, udc_cnt, i, newinfo->entries)) { -+ if (cl_s) -+ vfree(cl_s); -+ return -EINVAL; -+ } -+ -+ // we now know the following (along with E=mc): -+ // - the nr of entries in each chain is right -+ // - the size of the allocated space is right -+ // - all valid hooks have a corresponding chain -+ // - there are no loops -+ // - wrong data can still be on the level of a single entry -+ // - could be there are jumps to places that are not the -+ // beginning of a chain. This can only occur in chains that -+ // are not accessible from any base chains, so we don't care. -+ -+ // used to know what we need to clean up if something goes wrong -+ i = 0; -+ ret = EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, -+ ebt_check_entry, newinfo, repl->name, &i, repl->valid_hooks, -+ cl_s, udc_cnt); -+ if (ret != 0) { -+ EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, -+ ebt_cleanup_entry, &i); -+ } -+ if (cl_s) -+ vfree(cl_s); -+ return ret; -+} -+ -+// called under write_lock -+static void get_counters(struct ebt_counter *oldcounters, -+ struct ebt_counter *counters, unsigned int nentries) -+{ -+ int i, cpu; -+ struct ebt_counter *counter_base; -+ -+ // counters of cpu 0 -+ memcpy(counters, oldcounters, -+ sizeof(struct ebt_counter) * nentries); -+ // add other counters to those of cpu 0 -+ for (cpu = 1; cpu < smp_num_cpus; cpu++) { -+ counter_base = COUNTER_BASE(oldcounters, nentries, cpu); -+ for (i = 0; i < nentries; i++) { -+ counters[i].pcnt += counter_base[i].pcnt; -+ counters[i].bcnt += counter_base[i].bcnt; -+ } -+ } -+} -+ -+// replace the table -+static int do_replace(void *user, unsigned int len) -+{ -+ int ret, i, countersize; -+ struct ebt_table_info *newinfo; -+ struct ebt_replace tmp; -+ struct ebt_table *t; -+ struct ebt_counter *counterstmp = NULL; -+ // used to be able to unlock earlier -+ struct ebt_table_info *table; -+ -+ if (copy_from_user(&tmp, user, sizeof(tmp)) != 0) -+ return -EFAULT; -+ -+ if (len != sizeof(tmp) + tmp.entries_size) { -+ BUGPRINT("Wrong len argument\n"); -+ return -EINVAL; -+ } -+ -+ if (tmp.entries_size == 0) { -+ BUGPRINT("Entries_size never zero\n"); -+ return -EINVAL; -+ } -+ countersize = COUNTER_OFFSET(tmp.nentries) * smp_num_cpus; -+ newinfo = (struct ebt_table_info *) -+ vmalloc(sizeof(struct ebt_table_info) + countersize); -+ if (!newinfo) -+ return -ENOMEM; -+ -+ if (countersize) -+ memset(newinfo->counters, 0, countersize); -+ -+ newinfo->entries = (char *)vmalloc(tmp.entries_size); -+ if (!newinfo->entries) { -+ ret = -ENOMEM; -+ goto free_newinfo; -+ } -+ if (copy_from_user( -+ newinfo->entries, tmp.entries, tmp.entries_size) != 0) { -+ BUGPRINT("Couldn't copy entries from userspace\n"); -+ ret = -EFAULT; -+ goto free_entries; -+ } -+ -+ // the user wants counters back -+ // the check on the size is done later, when we have the lock -+ if (tmp.num_counters) { -+ counterstmp = (struct ebt_counter *) -+ vmalloc(tmp.num_counters * sizeof(struct ebt_counter)); -+ if (!counterstmp) { -+ ret = -ENOMEM; -+ goto free_entries; -+ } -+ } -+ else -+ counterstmp = NULL; -+ -+ // this can get initialized by translate_table() -+ newinfo->chainstack = NULL; -+ ret = translate_table(&tmp, newinfo); -+ -+ if (ret != 0) -+ goto free_counterstmp; -+ -+ t = find_table_lock(tmp.name, &ret, &ebt_mutex); -+ if (!t) -+ goto free_iterate; -+ -+ // the table doesn't like it -+ if (t->check && (ret = t->check(newinfo, tmp.valid_hooks))) -+ goto free_unlock; -+ -+ if (tmp.num_counters && tmp.num_counters != t->private->nentries) { -+ BUGPRINT("Wrong nr. of counters requested\n"); -+ ret = -EINVAL; -+ goto free_unlock; -+ } -+ -+ // we have the mutex lock, so no danger in reading this pointer -+ table = t->private; -+ // we need an atomic snapshot of the counters -+ write_lock_bh(&t->lock); -+ if (tmp.num_counters) -+ get_counters(t->private->counters, counterstmp, -+ t->private->nentries); -+ -+ t->private = newinfo; -+ write_unlock_bh(&t->lock); -+ up(&ebt_mutex); -+ // So, a user can change the chains while having messed up her counter -+ // allocation. Only reason why this is done is because this way the lock -+ // is held only once, while this doesn't bring the kernel into a -+ // dangerous state. -+ if (tmp.num_counters && -+ copy_to_user(tmp.counters, counterstmp, -+ tmp.num_counters * sizeof(struct ebt_counter))) { -+ BUGPRINT("Couldn't copy counters to userspace\n"); -+ ret = -EFAULT; -+ } -+ else -+ ret = 0; -+ -+ // decrease module count and free resources -+ EBT_ENTRY_ITERATE(table->entries, table->entries_size, -+ ebt_cleanup_entry, NULL); -+ -+ vfree(table->entries); -+ if (table->chainstack) { -+ for (i = 0; i < smp_num_cpus; i++) -+ vfree(table->chainstack[i]); -+ vfree(table->chainstack); -+ } -+ vfree(table); -+ -+ if (counterstmp) -+ vfree(counterstmp); -+ return ret; -+ -+free_unlock: -+ up(&ebt_mutex); -+free_iterate: -+ EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, -+ ebt_cleanup_entry, NULL); -+free_counterstmp: -+ if (counterstmp) -+ vfree(counterstmp); -+ // can be initialized in translate_table() -+ if (newinfo->chainstack) { -+ for (i = 0; i < smp_num_cpus; i++) -+ vfree(newinfo->chainstack[i]); -+ vfree(newinfo->chainstack); -+ } -+free_entries: -+ if (newinfo->entries) -+ vfree(newinfo->entries); -+free_newinfo: -+ if (newinfo) -+ vfree(newinfo); -+ return ret; -+} -+ -+int ebt_register_target(struct ebt_target *target) -+{ -+ int ret; -+ -+ ret = down_interruptible(&ebt_mutex); -+ if (ret != 0) -+ return ret; -+ if (!list_named_insert(&ebt_targets, target)) { -+ up(&ebt_mutex); -+ return -EEXIST; -+ } -+ up(&ebt_mutex); -+ MOD_INC_USE_COUNT; -+ -+ return 0; -+} -+ -+void ebt_unregister_target(struct ebt_target *target) -+{ -+ down(&ebt_mutex); -+ LIST_DELETE(&ebt_targets, target); -+ up(&ebt_mutex); -+ MOD_DEC_USE_COUNT; -+} -+ -+int ebt_register_match(struct ebt_match *match) -+{ -+ int ret; -+ -+ ret = down_interruptible(&ebt_mutex); -+ if (ret != 0) -+ return ret; -+ if (!list_named_insert(&ebt_matches, match)) { -+ up(&ebt_mutex); -+ return -EEXIST; -+ } -+ up(&ebt_mutex); -+ MOD_INC_USE_COUNT; -+ -+ return 0; -+} -+ -+void ebt_unregister_match(struct ebt_match *match) -+{ -+ down(&ebt_mutex); -+ LIST_DELETE(&ebt_matches, match); -+ up(&ebt_mutex); -+ MOD_DEC_USE_COUNT; -+} -+ -+int ebt_register_watcher(struct ebt_watcher *watcher) -+{ -+ int ret; -+ -+ ret = down_interruptible(&ebt_mutex); -+ if (ret != 0) -+ return ret; -+ if (!list_named_insert(&ebt_watchers, watcher)) { -+ up(&ebt_mutex); -+ return -EEXIST; -+ } -+ up(&ebt_mutex); -+ MOD_INC_USE_COUNT; -+ -+ return 0; -+} -+ -+void ebt_unregister_watcher(struct ebt_watcher *watcher) -+{ -+ down(&ebt_mutex); -+ LIST_DELETE(&ebt_watchers, watcher); -+ up(&ebt_mutex); -+ MOD_DEC_USE_COUNT; -+} -+ -+int ebt_register_table(struct ebt_table *table) -+{ -+ struct ebt_table_info *newinfo; -+ int ret, i, countersize; -+ -+ if (!table || !table->table ||!table->table->entries || -+ table->table->entries_size == 0 || -+ table->table->counters || table->private) { -+ BUGPRINT("Bad table data for ebt_register_table!!!\n"); -+ return -EINVAL; -+ } -+ -+ countersize = COUNTER_OFFSET(table->table->nentries) * smp_num_cpus; -+ newinfo = (struct ebt_table_info *) -+ vmalloc(sizeof(struct ebt_table_info) + countersize); -+ ret = -ENOMEM; -+ if (!newinfo) -+ return -ENOMEM; -+ -+ newinfo->entries = (char *)vmalloc(table->table->entries_size); -+ if (!(newinfo->entries)) -+ goto free_newinfo; -+ -+ memcpy(newinfo->entries, table->table->entries, -+ table->table->entries_size); -+ -+ if (countersize) -+ memset(newinfo->counters, 0, countersize); -+ -+ // fill in newinfo and parse the entries -+ newinfo->chainstack = NULL; -+ ret = translate_table(table->table, newinfo); -+ if (ret != 0) { -+ BUGPRINT("Translate_table failed\n"); -+ goto free_chainstack; -+ } -+ -+ if (table->check && table->check(newinfo, table->valid_hooks)) { -+ BUGPRINT("The table doesn't like its own initial data, lol\n"); -+ return -EINVAL; -+ } -+ -+ table->private = newinfo; -+ table->lock = RW_LOCK_UNLOCKED; -+ ret = down_interruptible(&ebt_mutex); -+ if (ret != 0) -+ goto free_chainstack; -+ -+ if (list_named_find(&ebt_tables, table->name)) { -+ ret = -EEXIST; -+ BUGPRINT("Table name already exists\n"); -+ goto free_unlock; -+ } -+ -+ list_prepend(&ebt_tables, table); -+ up(&ebt_mutex); -+ MOD_INC_USE_COUNT; -+ return 0; -+free_unlock: -+ up(&ebt_mutex); -+free_chainstack: -+ if (newinfo->chainstack) { -+ for (i = 0; i < smp_num_cpus; i++) -+ vfree(newinfo->chainstack[i]); -+ vfree(newinfo->chainstack); -+ } -+ vfree(newinfo->entries); -+free_newinfo: -+ vfree(newinfo); -+ return ret; -+} -+ -+void ebt_unregister_table(struct ebt_table *table) -+{ -+ int i; -+ -+ if (!table) { -+ BUGPRINT("Request to unregister NULL table!!!\n"); -+ return; -+ } -+ down(&ebt_mutex); -+ LIST_DELETE(&ebt_tables, table); -+ up(&ebt_mutex); -+ EBT_ENTRY_ITERATE(table->private->entries, -+ table->private->entries_size, ebt_cleanup_entry, NULL); -+ if (table->private->entries) -+ vfree(table->private->entries); -+ if (table->private->chainstack) { -+ for (i = 0; i < smp_num_cpus; i++) -+ vfree(table->private->chainstack[i]); -+ vfree(table->private->chainstack); -+ } -+ vfree(table->private); -+ MOD_DEC_USE_COUNT; -+} -+ -+// userspace just supplied us with counters -+static int update_counters(void *user, unsigned int len) -+{ -+ int i, ret; -+ struct ebt_counter *tmp; -+ struct ebt_replace hlp; -+ struct ebt_table *t; -+ -+ if (copy_from_user(&hlp, user, sizeof(hlp))) -+ return -EFAULT; -+ -+ if (len != sizeof(hlp) + hlp.num_counters * sizeof(struct ebt_counter)) -+ return -EINVAL; -+ if (hlp.num_counters == 0) -+ return -EINVAL; -+ -+ if ( !(tmp = (struct ebt_counter *) -+ vmalloc(hlp.num_counters * sizeof(struct ebt_counter))) ){ -+ MEMPRINT("Update_counters && nomemory\n"); -+ return -ENOMEM; -+ } -+ -+ t = find_table_lock(hlp.name, &ret, &ebt_mutex); -+ if (!t) -+ goto free_tmp; -+ -+ if (hlp.num_counters != t->private->nentries) { -+ BUGPRINT("Wrong nr of counters\n"); -+ ret = -EINVAL; -+ goto unlock_mutex; -+ } -+ -+ if ( copy_from_user(tmp, hlp.counters, -+ hlp.num_counters * sizeof(struct ebt_counter)) ) { -+ BUGPRINT("Updata_counters && !cfu\n"); -+ ret = -EFAULT; -+ goto unlock_mutex; -+ } -+ -+ // we want an atomic add of the counters -+ write_lock_bh(&t->lock); -+ -+ // we add to the counters of the first cpu -+ for (i = 0; i < hlp.num_counters; i++) { -+ t->private->counters[i].pcnt += tmp[i].pcnt; -+ t->private->counters[i].bcnt += tmp[i].bcnt; -+ } -+ -+ write_unlock_bh(&t->lock); -+ ret = 0; -+unlock_mutex: -+ up(&ebt_mutex); -+free_tmp: -+ vfree(tmp); -+ return ret; -+} -+ -+static inline int ebt_make_matchname(struct ebt_entry_match *m, -+ char *base, char *ubase) -+{ -+ char *hlp = ubase - base + (char *)m; -+ if (copy_to_user(hlp, m->u.match->name, EBT_FUNCTION_MAXNAMELEN)) -+ return -EFAULT; -+ return 0; -+} -+ -+static inline int ebt_make_watchername(struct ebt_entry_watcher *w, -+ char *base, char *ubase) -+{ -+ char *hlp = ubase - base + (char *)w; -+ if (copy_to_user(hlp , w->u.watcher->name, EBT_FUNCTION_MAXNAMELEN)) -+ return -EFAULT; -+ return 0; -+} -+ -+static inline int ebt_make_names(struct ebt_entry *e, char *base, char *ubase) -+{ -+ int ret; -+ char *hlp; -+ struct ebt_entry_target *t; -+ -+ if ((e->bitmask & EBT_ENTRY_OR_ENTRIES) == 0) -+ return 0; -+ -+ hlp = ubase - base + (char *)e + e->target_offset; -+ t = (struct ebt_entry_target *)(((char *)e) + e->target_offset); -+ -+ ret = EBT_MATCH_ITERATE(e, ebt_make_matchname, base, ubase); -+ if (ret != 0) -+ return ret; -+ ret = EBT_WATCHER_ITERATE(e, ebt_make_watchername, base, ubase); -+ if (ret != 0) -+ return ret; -+ if (copy_to_user(hlp, t->u.target->name, EBT_FUNCTION_MAXNAMELEN)) -+ return -EFAULT; -+ return 0; -+} -+ -+// called with ebt_mutex down -+static int copy_everything_to_user(struct ebt_table *t, void *user, -+ int *len, int cmd) -+{ -+ struct ebt_replace tmp; -+ struct ebt_counter *counterstmp, *oldcounters; -+ unsigned int entries_size, nentries; -+ char *entries; -+ -+ if (cmd == EBT_SO_GET_ENTRIES) { -+ entries_size = t->private->entries_size; -+ nentries = t->private->nentries; -+ entries = t->private->entries; -+ oldcounters = t->private->counters; -+ } else { -+ entries_size = t->table->entries_size; -+ nentries = t->table->nentries; -+ entries = t->table->entries; -+ oldcounters = t->table->counters; -+ } -+ -+ if (copy_from_user(&tmp, user, sizeof(tmp))) { -+ BUGPRINT("Cfu didn't work\n"); -+ return -EFAULT; -+ } -+ -+ if (*len != sizeof(struct ebt_replace) + entries_size + -+ (tmp.num_counters? nentries * sizeof(struct ebt_counter): 0)) { -+ BUGPRINT("Wrong size\n"); -+ return -EINVAL; -+ } -+ -+ if (tmp.nentries != nentries) { -+ BUGPRINT("Nentries wrong\n"); -+ return -EINVAL; -+ } -+ -+ if (tmp.entries_size != entries_size) { -+ BUGPRINT("Wrong size\n"); -+ return -EINVAL; -+ } -+ -+ // userspace might not need the counters -+ if (tmp.num_counters) { -+ if (tmp.num_counters != nentries) { -+ BUGPRINT("Num_counters wrong\n"); -+ return -EINVAL; -+ } -+ counterstmp = (struct ebt_counter *) -+ vmalloc(nentries * sizeof(struct ebt_counter)); -+ if (!counterstmp) { -+ MEMPRINT("Couldn't copy counters, out of memory\n"); -+ return -ENOMEM; -+ } -+ write_lock_bh(&t->lock); -+ get_counters(oldcounters, counterstmp, nentries); -+ write_unlock_bh(&t->lock); -+ -+ if (copy_to_user(tmp.counters, counterstmp, -+ nentries * sizeof(struct ebt_counter))) { -+ BUGPRINT("Couldn't copy counters to userspace\n"); -+ vfree(counterstmp); -+ return -EFAULT; -+ } -+ vfree(counterstmp); -+ } -+ -+ if (copy_to_user(tmp.entries, entries, entries_size)) { -+ BUGPRINT("Couldn't copy entries to userspace\n"); -+ return -EFAULT; -+ } -+ // set the match/watcher/target names right -+ return EBT_ENTRY_ITERATE(entries, entries_size, -+ ebt_make_names, entries, tmp.entries); -+} -+ -+static int do_ebt_set_ctl(struct sock *sk, -+ int cmd, void *user, unsigned int len) -+{ -+ int ret; -+ -+ switch(cmd) { -+ case EBT_SO_SET_ENTRIES: -+ ret = do_replace(user, len); -+ break; -+ case EBT_SO_SET_COUNTERS: -+ ret = update_counters(user, len); -+ break; -+ default: -+ ret = -EINVAL; -+ } -+ return ret; -+} -+ -+static int do_ebt_get_ctl(struct sock *sk, int cmd, void *user, int *len) -+{ -+ int ret; -+ struct ebt_replace tmp; -+ struct ebt_table *t; -+ -+ if (copy_from_user(&tmp, user, sizeof(tmp))) -+ return -EFAULT; -+ -+ t = find_table_lock(tmp.name, &ret, &ebt_mutex); -+ if (!t) -+ return ret; -+ -+ switch(cmd) { -+ case EBT_SO_GET_INFO: -+ case EBT_SO_GET_INIT_INFO: -+ if (*len != sizeof(struct ebt_replace)){ -+ ret = -EINVAL; -+ up(&ebt_mutex); -+ break; -+ } -+ if (cmd == EBT_SO_GET_INFO) { -+ tmp.nentries = t->private->nentries; -+ tmp.entries_size = t->private->entries_size; -+ tmp.valid_hooks = t->valid_hooks; -+ } else { -+ tmp.nentries = t->table->nentries; -+ tmp.entries_size = t->table->entries_size; -+ tmp.valid_hooks = t->table->valid_hooks; -+ } -+ up(&ebt_mutex); -+ if (copy_to_user(user, &tmp, *len) != 0){ -+ BUGPRINT("c2u Didn't work\n"); -+ ret = -EFAULT; -+ break; -+ } -+ ret = 0; -+ break; -+ -+ case EBT_SO_GET_ENTRIES: -+ case EBT_SO_GET_INIT_ENTRIES: -+ ret = copy_everything_to_user(t, user, len, cmd); -+ up(&ebt_mutex); -+ break; -+ -+ default: -+ up(&ebt_mutex); -+ ret = -EINVAL; -+ } -+ -+ return ret; -+} -+ -+static struct nf_sockopt_ops ebt_sockopts = -+{ { NULL, NULL }, PF_INET, EBT_BASE_CTL, EBT_SO_SET_MAX + 1, do_ebt_set_ctl, -+ EBT_BASE_CTL, EBT_SO_GET_MAX + 1, do_ebt_get_ctl, 0, NULL -+}; -+ -+static int __init init(void) -+{ -+ int ret; -+ -+ down(&ebt_mutex); -+ list_named_insert(&ebt_targets, &ebt_standard_target); -+ up(&ebt_mutex); -+ if ((ret = nf_register_sockopt(&ebt_sockopts)) < 0) -+ return ret; -+ -+ printk(KERN_NOTICE "Ebtables v2.0 registered\n"); -+ return 0; -+} -+ -+static void __exit fini(void) -+{ -+ nf_unregister_sockopt(&ebt_sockopts); -+ printk(KERN_NOTICE "Ebtables v2.0 unregistered\n"); -+} -+ -+EXPORT_SYMBOL(ebt_register_table); -+EXPORT_SYMBOL(ebt_unregister_table); -+EXPORT_SYMBOL(ebt_register_match); -+EXPORT_SYMBOL(ebt_unregister_match); -+EXPORT_SYMBOL(ebt_register_watcher); -+EXPORT_SYMBOL(ebt_unregister_watcher); -+EXPORT_SYMBOL(ebt_register_target); -+EXPORT_SYMBOL(ebt_unregister_target); -+EXPORT_SYMBOL(ebt_do_table); -+module_init(init); -+module_exit(fini); -+MODULE_LICENSE("GPL"); ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_bridge/ebtables.h 2005-03-14 21:24:12.000000000 +0100 -@@ -0,0 +1,361 @@ -+/* -+ * ebtables -+ * -+ * Authors: -+ * Bart De Schuymer -+ * -+ * ebtables.c,v 2.0, September, 2002 -+ * -+ * This code is stongly inspired on the iptables code which is -+ * Copyright (C) 1999 Paul `Rusty' Russell & Michael J. Neuling -+ */ -+ -+#ifndef __LINUX_BRIDGE_EFF_H -+#define __LINUX_BRIDGE_EFF_H -+#include -+#include -+#include -+ -+#define EBT_TABLE_MAXNAMELEN 32 -+#define EBT_CHAIN_MAXNAMELEN EBT_TABLE_MAXNAMELEN -+#define EBT_FUNCTION_MAXNAMELEN EBT_TABLE_MAXNAMELEN -+ -+// verdicts >0 are "branches" -+#define EBT_ACCEPT -1 -+#define EBT_DROP -2 -+#define EBT_CONTINUE -3 -+#define EBT_RETURN -4 -+#define NUM_STANDARD_TARGETS 4 -+ -+struct ebt_counter -+{ -+ uint64_t pcnt; -+ uint64_t bcnt; -+}; -+ -+struct ebt_entries { -+ // this field is always set to zero -+ // See EBT_ENTRY_OR_ENTRIES. -+ // Must be same size as ebt_entry.bitmask -+ unsigned int distinguisher; -+ // the chain name -+ char name[EBT_CHAIN_MAXNAMELEN]; -+ // counter offset for this chain -+ unsigned int counter_offset; -+ // one standard (accept, drop, return) per hook -+ int policy; -+ // nr. of entries -+ unsigned int nentries; -+ // entry list -+ char data[0]; -+}; -+ -+// used for the bitmask of struct ebt_entry -+ -+// This is a hack to make a difference between an ebt_entry struct and an -+// ebt_entries struct when traversing the entries from start to end. -+// Using this simplifies the code alot, while still being able to use -+// ebt_entries. -+// Contrary, iptables doesn't use something like ebt_entries and therefore uses -+// different techniques for naming the policy and such. So, iptables doesn't -+// need a hack like this. -+#define EBT_ENTRY_OR_ENTRIES 0x01 -+// these are the normal masks -+#define EBT_NOPROTO 0x02 -+#define EBT_802_3 0x04 -+#define EBT_SOURCEMAC 0x08 -+#define EBT_DESTMAC 0x10 -+#define EBT_F_MASK (EBT_NOPROTO | EBT_802_3 | EBT_SOURCEMAC | EBT_DESTMAC \ -+ | EBT_ENTRY_OR_ENTRIES) -+ -+#define EBT_IPROTO 0x01 -+#define EBT_IIN 0x02 -+#define EBT_IOUT 0x04 -+#define EBT_ISOURCE 0x8 -+#define EBT_IDEST 0x10 -+#define EBT_ILOGICALIN 0x20 -+#define EBT_ILOGICALOUT 0x40 -+#define EBT_INV_MASK (EBT_IPROTO | EBT_IIN | EBT_IOUT | EBT_ILOGICALIN \ -+ | EBT_ILOGICALOUT | EBT_ISOURCE | EBT_IDEST) -+ -+struct ebt_entry_match -+{ -+ union { -+ char name[EBT_FUNCTION_MAXNAMELEN]; -+ struct ebt_match *match; -+ } u; -+ // size of data -+ unsigned int match_size; -+ unsigned char data[0]; -+}; -+ -+struct ebt_entry_watcher -+{ -+ union { -+ char name[EBT_FUNCTION_MAXNAMELEN]; -+ struct ebt_watcher *watcher; -+ } u; -+ // size of data -+ unsigned int watcher_size; -+ unsigned char data[0]; -+}; -+ -+struct ebt_entry_target -+{ -+ union { -+ char name[EBT_FUNCTION_MAXNAMELEN]; -+ struct ebt_target *target; -+ } u; -+ // size of data -+ unsigned int target_size; -+ unsigned char data[0]; -+}; -+ -+#define EBT_STANDARD_TARGET "standard" -+struct ebt_standard_target -+{ -+ struct ebt_entry_target target; -+ int verdict; -+}; -+ -+// one entry -+struct ebt_entry { -+ // this needs to be the first field -+ unsigned int bitmask; -+ unsigned int invflags; -+ uint16_t ethproto; -+ // the physical in-dev -+ char in[IFNAMSIZ]; -+ // the logical in-dev -+ char logical_in[IFNAMSIZ]; -+ // the physical out-dev -+ char out[IFNAMSIZ]; -+ // the logical out-dev -+ char logical_out[IFNAMSIZ]; -+ unsigned char sourcemac[ETH_ALEN]; -+ unsigned char sourcemsk[ETH_ALEN]; -+ unsigned char destmac[ETH_ALEN]; -+ unsigned char destmsk[ETH_ALEN]; -+ // sizeof ebt_entry + matches -+ unsigned int watchers_offset; -+ // sizeof ebt_entry + matches + watchers -+ unsigned int target_offset; -+ // sizeof ebt_entry + matches + watchers + target -+ unsigned int next_offset; -+ unsigned char elems[0]; -+}; -+ -+struct ebt_replace -+{ -+ char name[EBT_TABLE_MAXNAMELEN]; -+ unsigned int valid_hooks; -+ // nr of rules in the table -+ unsigned int nentries; -+ // total size of the entries -+ unsigned int entries_size; -+ // start of the chains -+ struct ebt_entries *hook_entry[NF_BR_NUMHOOKS]; -+ // nr of counters userspace expects back -+ unsigned int num_counters; -+ // where the kernel will put the old counters -+ struct ebt_counter *counters; -+ char *entries; -+}; -+ -+// [gs]etsockopt numbers -+#define EBT_BASE_CTL 128 -+ -+#define EBT_SO_SET_ENTRIES (EBT_BASE_CTL) -+#define EBT_SO_SET_COUNTERS (EBT_SO_SET_ENTRIES+1) -+#define EBT_SO_SET_MAX (EBT_SO_SET_COUNTERS+1) -+ -+#define EBT_SO_GET_INFO (EBT_BASE_CTL) -+#define EBT_SO_GET_ENTRIES (EBT_SO_GET_INFO+1) -+#define EBT_SO_GET_INIT_INFO (EBT_SO_GET_ENTRIES+1) -+#define EBT_SO_GET_INIT_ENTRIES (EBT_SO_GET_INIT_INFO+1) -+#define EBT_SO_GET_MAX (EBT_SO_GET_INIT_ENTRIES+1) -+ -+#ifdef __KERNEL__ -+ -+// return values for match() functions -+#define EBT_MATCH 0 -+#define EBT_NOMATCH 1 -+ -+struct ebt_match -+{ -+ struct list_head list; -+ const char name[EBT_FUNCTION_MAXNAMELEN]; -+ // 0 == it matches -+ int (*match)(const struct sk_buff *skb, const struct net_device *in, -+ const struct net_device *out, const void *matchdata, -+ unsigned int datalen); -+ // 0 == let it in -+ int (*check)(const char *tablename, unsigned int hookmask, -+ const struct ebt_entry *e, void *matchdata, unsigned int datalen); -+ void (*destroy)(void *matchdata, unsigned int datalen); -+ struct module *me; -+}; -+ -+struct ebt_watcher -+{ -+ struct list_head list; -+ const char name[EBT_FUNCTION_MAXNAMELEN]; -+ void (*watcher)(const struct sk_buff *skb, unsigned int hooknr, -+ const struct net_device *in, const struct net_device *out, -+ const void *watcherdata, unsigned int datalen); -+ // 0 == let it in -+ int (*check)(const char *tablename, unsigned int hookmask, -+ const struct ebt_entry *e, void *watcherdata, unsigned int datalen); -+ void (*destroy)(void *watcherdata, unsigned int datalen); -+ struct module *me; -+}; -+ -+struct ebt_target -+{ -+ struct list_head list; -+ const char name[EBT_FUNCTION_MAXNAMELEN]; -+ // returns one of the standard verdicts -+ int (*target)(struct sk_buff **pskb, unsigned int hooknr, -+ const struct net_device *in, const struct net_device *out, -+ const void *targetdata, unsigned int datalen); -+ // 0 == let it in -+ int (*check)(const char *tablename, unsigned int hookmask, -+ const struct ebt_entry *e, void *targetdata, unsigned int datalen); -+ void (*destroy)(void *targetdata, unsigned int datalen); -+ struct module *me; -+}; -+ -+// used for jumping from and into user defined chains (udc) -+struct ebt_chainstack -+{ -+ struct ebt_entries *chaininfo; // pointer to chain data -+ struct ebt_entry *e; // pointer to entry data -+ unsigned int n; // n'th entry -+}; -+ -+struct ebt_table_info -+{ -+ // total size of the entries -+ unsigned int entries_size; -+ unsigned int nentries; -+ // pointers to the start of the chains -+ struct ebt_entries *hook_entry[NF_BR_NUMHOOKS]; -+ // room to maintain the stack used for jumping from and into udc -+ struct ebt_chainstack **chainstack; -+ char *entries; -+ struct ebt_counter counters[0] ____cacheline_aligned; -+}; -+ -+struct ebt_table -+{ -+ struct list_head list; -+ char name[EBT_TABLE_MAXNAMELEN]; -+ struct ebt_replace *table; -+ unsigned int valid_hooks; -+ rwlock_t lock; -+ // e.g. could be the table explicitly only allows certain -+ // matches, targets, ... 0 == let it in -+ int (*check)(const struct ebt_table_info *info, -+ unsigned int valid_hooks); -+ // the data used by the kernel -+ struct ebt_table_info *private; -+}; -+ -+#define EBT_ALIGN(s) (((s) + (__alignof__(struct ebt_entry_target)-1)) & \ -+ ~(__alignof__(struct ebt_entry_target)-1)) -+extern int ebt_register_table(struct ebt_table *table); -+extern void ebt_unregister_table(struct ebt_table *table); -+extern int ebt_register_match(struct ebt_match *match); -+extern void ebt_unregister_match(struct ebt_match *match); -+extern int ebt_register_watcher(struct ebt_watcher *watcher); -+extern void ebt_unregister_watcher(struct ebt_watcher *watcher); -+extern int ebt_register_target(struct ebt_target *target); -+extern void ebt_unregister_target(struct ebt_target *target); -+extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff **pskb, -+ const struct net_device *in, const struct net_device *out, -+ struct ebt_table *table); -+ -+ // Used in the kernel match() functions -+#define FWINV(bool,invflg) ((bool) ^ !!(info->invflags & invflg)) -+// True if the hook mask denotes that the rule is in a base chain, -+// used in the check() functions -+#define BASE_CHAIN (hookmask & (1 << NF_BR_NUMHOOKS)) -+// Clear the bit in the hook mask that tells if the rule is on a base chain -+#define CLEAR_BASE_CHAIN_BIT (hookmask &= ~(1 << NF_BR_NUMHOOKS)) -+// True if the target is not a standard target -+#define INVALID_TARGET (info->target < -NUM_STANDARD_TARGETS || info->target >= 0) -+ -+#endif /* __KERNEL__ */ -+ -+// blatently stolen from ip_tables.h -+// fn returns 0 to continue iteration -+#define EBT_MATCH_ITERATE(e, fn, args...) \ -+({ \ -+ unsigned int __i; \ -+ int __ret = 0; \ -+ struct ebt_entry_match *__match; \ -+ \ -+ for (__i = sizeof(struct ebt_entry); \ -+ __i < (e)->watchers_offset; \ -+ __i += __match->match_size + \ -+ sizeof(struct ebt_entry_match)) { \ -+ __match = (void *)(e) + __i; \ -+ \ -+ __ret = fn(__match , ## args); \ -+ if (__ret != 0) \ -+ break; \ -+ } \ -+ if (__ret == 0) { \ -+ if (__i != (e)->watchers_offset) \ -+ __ret = -EINVAL; \ -+ } \ -+ __ret; \ -+}) -+ -+#define EBT_WATCHER_ITERATE(e, fn, args...) \ -+({ \ -+ unsigned int __i; \ -+ int __ret = 0; \ -+ struct ebt_entry_watcher *__watcher; \ -+ \ -+ for (__i = e->watchers_offset; \ -+ __i < (e)->target_offset; \ -+ __i += __watcher->watcher_size + \ -+ sizeof(struct ebt_entry_watcher)) { \ -+ __watcher = (void *)(e) + __i; \ -+ \ -+ __ret = fn(__watcher , ## args); \ -+ if (__ret != 0) \ -+ break; \ -+ } \ -+ if (__ret == 0) { \ -+ if (__i != (e)->target_offset) \ -+ __ret = -EINVAL; \ -+ } \ -+ __ret; \ -+}) -+ -+#define EBT_ENTRY_ITERATE(entries, size, fn, args...) \ -+({ \ -+ unsigned int __i; \ -+ int __ret = 0; \ -+ struct ebt_entry *__entry; \ -+ \ -+ for (__i = 0; __i < (size);) { \ -+ __entry = (void *)(entries) + __i; \ -+ __ret = fn(__entry , ## args); \ -+ if (__ret != 0) \ -+ break; \ -+ if (__entry->bitmask != 0) \ -+ __i += __entry->next_offset; \ -+ else \ -+ __i += sizeof(struct ebt_entries); \ -+ } \ -+ if (__ret == 0) { \ -+ if (__i != (size)) \ -+ __ret = -EINVAL; \ -+ } \ -+ __ret; \ -+}) -+ -+#endif ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_bridge/ebt_among.h 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,65 @@ -+#ifndef __LINUX_BRIDGE_EBT_AMONG_H -+#define __LINUX_BRIDGE_EBT_AMONG_H -+ -+#define EBT_AMONG_DST 0x01 -+#define EBT_AMONG_SRC 0x02 -+ -+/* Grzegorz Borowiak 2003 -+ * -+ * Write-once-read-many hash table, used for checking if a given -+ * MAC address belongs to a set or not and possibly for checking -+ * if it is related with a given IPv4 address. -+ * -+ * The hash value of an address is its last byte. -+ * -+ * In real-world ethernet addresses, values of the last byte are -+ * evenly distributed and there is no need to consider other bytes. -+ * It would only slow the routines down. -+ * -+ * For MAC address comparison speedup reasons, we introduce a trick. -+ * MAC address is mapped onto an array of two 32-bit integers. -+ * This pair of integers is compared with MAC addresses in the -+ * hash table, which are stored also in form of pairs of integers -+ * (in `cmp' array). This is quick as it requires only two elementary -+ * number comparisons in worst case. Further, we take advantage of -+ * fact that entropy of 3 last bytes of address is larger than entropy -+ * of 3 first bytes. So first we compare 4 last bytes of addresses and -+ * if they are the same we compare 2 first. -+ * -+ * Yes, it is a memory overhead, but in 2003 AD, who cares? -+ */ -+ -+struct ebt_mac_wormhash_tuple -+{ -+ uint32_t cmp[2]; -+ uint32_t ip; -+}; -+ -+struct ebt_mac_wormhash -+{ -+ int table[257]; -+ int poolsize; -+ struct ebt_mac_wormhash_tuple pool[0]; -+}; -+ -+#define ebt_mac_wormhash_size(x) ((x) ? sizeof(struct ebt_mac_wormhash) \ -+ + (x)->poolsize * sizeof(struct ebt_mac_wormhash_tuple) : 0) -+ -+struct ebt_among_info -+{ -+ int wh_dst_ofs; -+ int wh_src_ofs; -+ int bitmask; -+}; -+ -+#define EBT_AMONG_DST_NEG 0x1 -+#define EBT_AMONG_SRC_NEG 0x2 -+ -+#define ebt_among_wh_dst(x) ((x)->wh_dst_ofs ? \ -+ (struct ebt_mac_wormhash*)((char*)(x) + (x)->wh_dst_ofs) : NULL) -+#define ebt_among_wh_src(x) ((x)->wh_src_ofs ? \ -+ (struct ebt_mac_wormhash*)((char*)(x) + (x)->wh_src_ofs) : NULL) -+ -+#define EBT_AMONG_MATCH "among" -+ -+#endif ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_bridge/ebt_limit.h 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,23 @@ -+#ifndef __LINUX_BRIDGE_EBT_LIMIT_H -+#define __LINUX_BRIDGE_EBT_LIMIT_H -+ -+#define EBT_LIMIT_MATCH "limit" -+ -+/* timings are in milliseconds. */ -+#define EBT_LIMIT_SCALE 10000 -+ -+/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 -+ seconds, or one every 59 hours. */ -+ -+struct ebt_limit_info -+{ -+ u_int32_t avg; /* Average secs between packets * scale */ -+ u_int32_t burst; /* Period multiplier for upper limit. */ -+ -+ /* Used internally by the kernel */ -+ unsigned long prev; -+ u_int32_t credit; -+ u_int32_t credit_cap, cost; -+}; -+ -+#endif ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_bridge/ebt_arpreply.h 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,11 @@ -+#ifndef __LINUX_BRIDGE_EBT_ARPREPLY_H -+#define __LINUX_BRIDGE_EBT_ARPREPLY_H -+ -+struct ebt_arpreply_info -+{ -+ unsigned char mac[ETH_ALEN]; -+ int target; -+}; -+#define EBT_ARPREPLY_TARGET "arpreply" -+ -+#endif ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_bridge/ebt_802_3.h 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,60 @@ -+#ifndef __LINUX_BRIDGE_EBT_802_3_H -+#define __LINUX_BRIDGE_EBT_802_3_H -+ -+#define EBT_802_3_SAP 0x01 -+#define EBT_802_3_TYPE 0x02 -+ -+#define EBT_802_3_MATCH "802_3" -+ -+/* -+ * If frame has DSAP/SSAP value 0xaa you must check the SNAP type -+ * to discover what kind of packet we're carrying. -+ */ -+#define CHECK_TYPE 0xaa -+ -+/* -+ * Control field may be one or two bytes. If the first byte has -+ * the value 0x03 then the entire length is one byte, otherwise it is two. -+ * One byte controls are used in Unnumbered Information frames. -+ * Two byte controls are used in Numbered Information frames. -+ */ -+#define IS_UI 0x03 -+ -+#define EBT_802_3_MASK (EBT_802_3_SAP | EBT_802_3_TYPE | EBT_802_3) -+ -+/* ui has one byte ctrl, ni has two */ -+struct hdr_ui { -+ uint8_t dsap; -+ uint8_t ssap; -+ uint8_t ctrl; -+ uint8_t orig[3]; -+ uint16_t type; -+}; -+ -+struct hdr_ni { -+ uint8_t dsap; -+ uint8_t ssap; -+ uint16_t ctrl; -+ uint8_t orig[3]; -+ uint16_t type; -+}; -+ -+struct ebt_802_3_hdr { -+ uint8_t daddr[6]; -+ uint8_t saddr[6]; -+ uint16_t len; -+ union { -+ struct hdr_ui ui; -+ struct hdr_ni ni; -+ } llc; -+}; -+ -+struct ebt_802_3_info -+{ -+ uint8_t sap; -+ uint16_t type; -+ uint8_t bitmask; -+ uint8_t invflags; -+}; -+ -+#endif ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_bridge/ebt_arp.h 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,32 @@ -+#ifndef __LINUX_BRIDGE_EBT_ARP_H -+#define __LINUX_BRIDGE_EBT_ARP_H -+ -+#define EBT_ARP_OPCODE 0x01 -+#define EBT_ARP_HTYPE 0x02 -+#define EBT_ARP_PTYPE 0x04 -+#define EBT_ARP_SRC_IP 0x08 -+#define EBT_ARP_DST_IP 0x10 -+#define EBT_ARP_SRC_MAC 0x20 -+#define EBT_ARP_DST_MAC 0x40 -+#define EBT_ARP_MASK (EBT_ARP_OPCODE | EBT_ARP_HTYPE | EBT_ARP_PTYPE | \ -+ EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC) -+#define EBT_ARP_MATCH "arp" -+ -+struct ebt_arp_info -+{ -+ uint16_t htype; -+ uint16_t ptype; -+ uint16_t opcode; -+ uint32_t saddr; -+ uint32_t smsk; -+ uint32_t daddr; -+ uint32_t dmsk; -+ unsigned char smaddr[ETH_ALEN]; -+ unsigned char smmsk[ETH_ALEN]; -+ unsigned char dmaddr[ETH_ALEN]; -+ unsigned char dmmsk[ETH_ALEN]; -+ uint8_t bitmask; -+ uint8_t invflags; -+}; -+ -+#endif ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_bridge/ebt_ip.h 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,43 @@ -+/* -+ * ebt_ip -+ * -+ * Authors: -+ * Bart De Schuymer -+ * -+ * April, 2002 -+ * -+ * Changes: -+ * added ip-sport and ip-dport -+ * Innominate Security Technologies AG -+ * September, 2002 -+ */ -+ -+#ifndef __LINUX_BRIDGE_EBT_IP_H -+#define __LINUX_BRIDGE_EBT_IP_H -+ -+#define EBT_IP_SOURCE 0x01 -+#define EBT_IP_DEST 0x02 -+#define EBT_IP_TOS 0x04 -+#define EBT_IP_PROTO 0x08 -+#define EBT_IP_SPORT 0x10 -+#define EBT_IP_DPORT 0x20 -+#define EBT_IP_MASK (EBT_IP_SOURCE | EBT_IP_DEST | EBT_IP_TOS | EBT_IP_PROTO |\ -+ EBT_IP_SPORT | EBT_IP_DPORT ) -+#define EBT_IP_MATCH "ip" -+ -+// the same values are used for the invflags -+struct ebt_ip_info -+{ -+ uint32_t saddr; -+ uint32_t daddr; -+ uint32_t smsk; -+ uint32_t dmsk; -+ uint8_t tos; -+ uint8_t protocol; -+ uint8_t bitmask; -+ uint8_t invflags; -+ uint16_t sport[2]; -+ uint16_t dport[2]; -+}; -+ -+#endif ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_bridge/ebt_pkttype.h 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,11 @@ -+#ifndef __LINUX_BRIDGE_EBT_PKTTYPE_H -+#define __LINUX_BRIDGE_EBT_PKTTYPE_H -+ -+struct ebt_pkttype_info -+{ -+ uint8_t pkt_type; -+ uint8_t invert; -+}; -+#define EBT_PKTTYPE_MATCH "pkttype" -+ -+#endif ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_bridge/ebt_stp.h 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,46 @@ -+#ifndef __LINUX_BRIDGE_EBT_STP_H -+#define __LINUX_BRIDGE_EBT_STP_H -+ -+#define EBT_STP_TYPE 0x0001 -+ -+#define EBT_STP_FLAGS 0x0002 -+#define EBT_STP_ROOTPRIO 0x0004 -+#define EBT_STP_ROOTADDR 0x0008 -+#define EBT_STP_ROOTCOST 0x0010 -+#define EBT_STP_SENDERPRIO 0x0020 -+#define EBT_STP_SENDERADDR 0x0040 -+#define EBT_STP_PORT 0x0080 -+#define EBT_STP_MSGAGE 0x0100 -+#define EBT_STP_MAXAGE 0x0200 -+#define EBT_STP_HELLOTIME 0x0400 -+#define EBT_STP_FWDD 0x0800 -+ -+#define EBT_STP_MASK 0x0fff -+#define EBT_STP_CONFIG_MASK 0x0ffe -+ -+#define EBT_STP_MATCH "stp" -+ -+struct ebt_stp_config_info -+{ -+ uint8_t flags; -+ uint16_t root_priol, root_priou; -+ char root_addr[6], root_addrmsk[6]; -+ uint32_t root_costl, root_costu; -+ uint16_t sender_priol, sender_priou; -+ char sender_addr[6], sender_addrmsk[6]; -+ uint16_t portl, portu; -+ uint16_t msg_agel, msg_ageu; -+ uint16_t max_agel, max_ageu; -+ uint16_t hello_timel, hello_timeu; -+ uint16_t forward_delayl, forward_delayu; -+}; -+ -+struct ebt_stp_info -+{ -+ uint8_t type; -+ struct ebt_stp_config_info config; -+ uint16_t bitmask; -+ uint16_t invflags; -+}; -+ -+#endif ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_bridge/ebt_vlan.h 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,20 @@ -+#ifndef __LINUX_BRIDGE_EBT_VLAN_H -+#define __LINUX_BRIDGE_EBT_VLAN_H -+ -+#define EBT_VLAN_ID 0x01 -+#define EBT_VLAN_PRIO 0x02 -+#define EBT_VLAN_ENCAP 0x04 -+#define EBT_VLAN_MASK (EBT_VLAN_ID | EBT_VLAN_PRIO | EBT_VLAN_ENCAP) -+#define EBT_VLAN_MATCH "vlan" -+ -+struct ebt_vlan_info { -+ uint16_t id; /* VLAN ID {1-4095} */ -+ uint8_t prio; /* VLAN User Priority {0-7} */ -+ uint16_t encap; /* VLAN Encapsulated frame code {0-65535} */ -+ uint8_t bitmask; /* Args bitmask bit 1=1 - ID arg, -+ bit 2=1 User-Priority arg, bit 3=1 encap*/ -+ uint8_t invflags; /* Inverse bitmask bit 1=1 - inversed ID arg, -+ bit 2=1 - inversed Pirority arg */ -+}; -+ -+#endif ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_bridge/ebt_log.h 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,17 @@ -+#ifndef __LINUX_BRIDGE_EBT_LOG_H -+#define __LINUX_BRIDGE_EBT_LOG_H -+ -+#define EBT_LOG_IP 0x01 // if the frame is made by ip, log the ip information -+#define EBT_LOG_ARP 0x02 -+#define EBT_LOG_MASK (EBT_LOG_IP | EBT_LOG_ARP) -+#define EBT_LOG_PREFIX_SIZE 30 -+#define EBT_LOG_WATCHER "log" -+ -+struct ebt_log_info -+{ -+ uint8_t loglevel; -+ uint8_t prefix[EBT_LOG_PREFIX_SIZE]; -+ uint32_t bitmask; -+}; -+ -+#endif ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_bridge/ebt_ulog.h 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,33 @@ -+#ifndef _EBT_ULOG_H -+#define _EBT_ULOG_H -+ -+#define EBT_ULOG_DEFAULT_NLGROUP 0 -+#define EBT_ULOG_DEFAULT_QTHRESHOLD 1 -+#define EBT_ULOG_MAXNLGROUPS 32 /* hardcoded netlink max */ -+#define EBT_ULOG_PREFIX_LEN 32 -+#define EBT_ULOG_MAX_QLEN 50 -+#define EBT_ULOG_WATCHER "ulog" -+ -+struct ebt_ulog_info { -+ uint32_t nlgroup; -+ unsigned int cprange; -+ unsigned int qthreshold; -+ char prefix[EBT_ULOG_PREFIX_LEN]; -+}; -+ -+typedef struct ebt_ulog_packet_msg { -+ char indev[IFNAMSIZ]; -+ char outdev[IFNAMSIZ]; -+ char physindev[IFNAMSIZ]; -+ char physoutdev[IFNAMSIZ]; -+ char prefix[EBT_ULOG_PREFIX_LEN]; -+ struct timeval stamp; -+ unsigned long mark; -+ unsigned int hook; -+ size_t data_len; -+ /* The complete packet, including Ethernet header and perhaps -+ * the VLAN header is appended */ -+ unsigned char data[0] __attribute__ ((aligned (__alignof__(int)))); -+} ebt_ulog_packet_msg_t; -+ -+#endif /* _EBT_ULOG_H */ ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_bridge/ebt_nat.h 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,13 @@ -+#ifndef __LINUX_BRIDGE_EBT_NAT_H -+#define __LINUX_BRIDGE_EBT_NAT_H -+ -+struct ebt_nat_info -+{ -+ unsigned char mac[ETH_ALEN]; -+ // EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN -+ int target; -+}; -+#define EBT_SNAT_TARGET "snat" -+#define EBT_DNAT_TARGET "dnat" -+ -+#endif ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_bridge/ebt_redirect.h 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,11 @@ -+#ifndef __LINUX_BRIDGE_EBT_REDIRECT_H -+#define __LINUX_BRIDGE_EBT_REDIRECT_H -+ -+struct ebt_redirect_info -+{ -+ // EBT_ACCEPT, EBT_DROP or EBT_CONTINUE or EBT_RETURN -+ int target; -+}; -+#define EBT_REDIRECT_TARGET "redirect" -+ -+#endif ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_bridge/ebt_mark_m.h 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,15 @@ -+#ifndef __LINUX_BRIDGE_EBT_MARK_M_H -+#define __LINUX_BRIDGE_EBT_MARK_M_H -+ -+#define EBT_MARK_AND 0x01 -+#define EBT_MARK_OR 0x02 -+#define EBT_MARK_MASK (EBT_MARK_AND | EBT_MARK_OR) -+struct ebt_mark_m_info -+{ -+ unsigned long mark, mask; -+ uint8_t invert; -+ uint8_t bitmask; -+}; -+#define EBT_MARK_MATCH "mark_m" -+ -+#endif ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_bridge/ebt_mark_t.h 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,12 @@ -+#ifndef __LINUX_BRIDGE_EBT_MARK_T_H -+#define __LINUX_BRIDGE_EBT_MARK_T_H -+ -+struct ebt_mark_t_info -+{ -+ unsigned long mark; -+ // EBT_ACCEPT, EBT_DROP or EBT_CONTINUE or EBT_RETURN -+ int target; -+}; -+#define EBT_MARK_TARGET "mark" -+ -+#endif ---- linux-2.4.29/include/linux/netfilter.h 2005-01-19 15:10:12.000000000 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter.h 2005-03-14 21:11:36.000000000 +0100 -@@ -17,7 +17,8 @@ - #define NF_STOLEN 2 - #define NF_QUEUE 3 - #define NF_REPEAT 4 --#define NF_MAX_VERDICT NF_REPEAT -+#define NF_STOP 5 -+#define NF_MAX_VERDICT NF_STOP - - /* Generic cache responses from hook functions. - <= 0x2000 is used for protocol-flags. */ -@@ -118,17 +119,34 @@ extern struct list_head nf_hooks[NPROTO] - /* This is gross, but inline doesn't cut it for avoiding the function - call in fast path: gcc doesn't inline (needs value tracking?). --RR */ - #ifdef CONFIG_NETFILTER_DEBUG --#define NF_HOOK nf_hook_slow -+#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \ -+({int __ret; \ -+if ((__ret=nf_hook_slow(pf, hook, &(skb), indev, outdev, okfn, INT_MIN)) == 1) \ -+ __ret = (okfn)(skb); \ -+__ret;}) -+#define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \ -+({int __ret; \ -+if ((__ret=nf_hook_slow(pf, hook, &(skb), indev, outdev, okfn, thresh)) == 1) \ -+ __ret = (okfn)(skb); \ -+__ret;}) - #else --#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \ --(list_empty(&nf_hooks[(pf)][(hook)]) \ -- ? (okfn)(skb) \ -- : nf_hook_slow((pf), (hook), (skb), (indev), (outdev), (okfn))) -+#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \ -+({int __ret; \ -+if (list_empty(&nf_hooks[pf][hook]) || \ -+ (__ret=nf_hook_slow(pf, hook, &(skb), indev, outdev, okfn, INT_MIN)) == 1) \ -+ __ret = (okfn)(skb); \ -+__ret;}) -+#define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \ -+({int __ret; \ -+if (list_empty(&nf_hooks[pf][hook]) || \ -+ (__ret=nf_hook_slow(pf, hook, &(skb), indev, outdev, okfn, thresh)) == 1) \ -+ __ret = (okfn)(skb); \ -+__ret;}) - #endif - --int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb, -+int nf_hook_slow(int pf, unsigned int hook, struct sk_buff **pskb, - struct net_device *indev, struct net_device *outdev, -- int (*okfn)(struct sk_buff *)); -+ int (*okfn)(struct sk_buff *), int thresh); - - /* Call setsockopt() */ - int nf_setsockopt(struct sock *sk, int pf, int optval, char *opt, ---- linux-2.4.29/include/linux/netfilter_ipv4.h 2002-02-25 20:38:13.000000000 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_ipv4.h 2005-03-14 21:11:36.000000000 +0100 -@@ -52,8 +52,10 @@ - enum nf_ip_hook_priorities { - NF_IP_PRI_FIRST = INT_MIN, - NF_IP_PRI_CONNTRACK = -200, -+ NF_IP_PRI_BRIDGE_SABOTAGE_FORWARD = -175, - NF_IP_PRI_MANGLE = -150, - NF_IP_PRI_NAT_DST = -100, -+ NF_IP_PRI_BRIDGE_SABOTAGE_LOCAL_OUT = -50, - NF_IP_PRI_FILTER = 0, - NF_IP_PRI_NAT_SRC = 100, - NF_IP_PRI_LAST = INT_MAX, ---- linux-2.4.29/include/linux/netfilter_ipv6.h 2001-01-02 01:17:54.000000000 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_ipv6.h 2005-03-14 21:24:11.000000000 +0100 -@@ -57,8 +57,10 @@ - enum nf_ip6_hook_priorities { - NF_IP6_PRI_FIRST = INT_MIN, - NF_IP6_PRI_CONNTRACK = -200, -+ NF_IP6_PRI_BRIDGE_SABOTAGE_FORWARD = -175, - NF_IP6_PRI_MANGLE = -150, - NF_IP6_PRI_NAT_DST = -100, -+ NF_IP6_PRI_BRIDGE_SABOTAGE_LOCAL_OUT = -50, - NF_IP6_PRI_FILTER = 0, - NF_IP6_PRI_NAT_SRC = 100, - NF_IP6_PRI_LAST = INT_MAX, ---- linux-2.4.29/include/linux/skbuff.h 2004-08-08 01:26:06.000000000 +0200 -+++ linux-2.4.29-ebt-brnf/include/linux/skbuff.h 2005-03-14 21:07:31.000000000 +0100 -@@ -92,6 +92,20 @@ struct nf_conntrack { - struct nf_ct_info { - struct nf_conntrack *master; - }; -+ -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+struct nf_bridge_info { -+ atomic_t use; -+ struct net_device *physindev; -+ struct net_device *physoutdev; -+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) -+ struct net_device *netoutdev; -+#endif -+ unsigned int mask; -+ unsigned long data[32 / sizeof(unsigned long)]; -+}; -+#endif -+ - #endif - - struct sk_buff_head { -@@ -208,6 +222,9 @@ struct sk_buff { - #ifdef CONFIG_NETFILTER_DEBUG - unsigned int nf_debug; - #endif -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+ struct nf_bridge_info *nf_bridge; /* Saved data about a bridged frame - see br_netfilter.c */ -+#endif - #endif /*CONFIG_NETFILTER*/ - - #if defined(CONFIG_HIPPI) -@@ -1175,6 +1192,20 @@ nf_reset(struct sk_buff *skb) - skb->nf_debug = 0; - #endif - } -+ -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge) -+{ -+ if (nf_bridge && atomic_dec_and_test(&nf_bridge->use)) -+ kfree(nf_bridge); -+} -+static inline void nf_bridge_get(struct nf_bridge_info *nf_bridge) -+{ -+ if (nf_bridge) -+ atomic_inc(&nf_bridge->use); -+} -+#endif -+ - #else /* CONFIG_NETFILTER */ - static inline void nf_reset(struct sk_buff *skb) {} - #endif /* CONFIG_NETFILTER */ ---- linux-2.4.29/net/core/netfilter.c 2005-01-19 15:10:13.000000000 +0100 -+++ linux-2.4.29-ebt-brnf/net/core/netfilter.c 2005-03-14 21:21:41.825275416 +0100 -@@ -342,32 +342,29 @@ static unsigned int nf_iterate(struct li - const struct net_device *indev, - const struct net_device *outdev, - struct list_head **i, -- int (*okfn)(struct sk_buff *)) -+ int (*okfn)(struct sk_buff *), -+ int hook_thresh) - { -+ unsigned int verdict; -+ - for (*i = (*i)->next; *i != head; *i = (*i)->next) { - struct nf_hook_ops *elem = (struct nf_hook_ops *)*i; -- switch (elem->hook(hook, skb, indev, outdev, okfn)) { -- case NF_QUEUE: -- return NF_QUEUE; -- -- case NF_STOLEN: -- return NF_STOLEN; -- -- case NF_DROP: -- return NF_DROP; - -- case NF_REPEAT: -- *i = (*i)->prev; -- break; -+ if (hook_thresh > elem->priority) -+ continue; - -+ verdict = elem->hook(hook, skb, indev, outdev, okfn); -+ if (verdict != NF_ACCEPT) { - #ifdef CONFIG_NETFILTER_DEBUG -- case NF_ACCEPT: -- break; -- -- default: -- NFDEBUG("Evil return from %p(%u).\n", -- elem->hook, hook); -+ if (unlikely(verdict > NF_MAX_VERDICT)) { -+ NFDEBUG("Evil return from %p(%u).\n", -+ elem->hook, hook); -+ continue; -+ } - #endif -+ if (verdict != NF_REPEAT) -+ return verdict; -+ *i = (*i)->prev; - } - } - return NF_ACCEPT; -@@ -413,6 +410,10 @@ static void nf_queue(struct sk_buff *skb - { - int status; - struct nf_info *info; -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+ struct net_device *physindev = NULL; -+ struct net_device *physoutdev = NULL; -+#endif - - if (!queue_handler[pf].outfn) { - kfree_skb(skb); -@@ -435,36 +436,52 @@ static void nf_queue(struct sk_buff *skb - if (indev) dev_hold(indev); - if (outdev) dev_hold(outdev); - -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+ if (skb->nf_bridge) { -+ physindev = skb->nf_bridge->physindev; -+ if (physindev) dev_hold(physindev); -+ physoutdev = skb->nf_bridge->physoutdev; -+ if (physoutdev) dev_hold(physoutdev); -+ } -+#endif -+ - status = queue_handler[pf].outfn(skb, info, queue_handler[pf].data); - if (status < 0) { - /* James M doesn't say fuck enough. */ - if (indev) dev_put(indev); - if (outdev) dev_put(outdev); -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+ if (physindev) dev_put(physindev); -+ if (physoutdev) dev_put(physoutdev); -+#endif - kfree(info); - kfree_skb(skb); - return; - } - } - --int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb, -+/* Returns 1 if okfn() needs to be executed by the caller, -+ * -EPERM for NF_DROP, 0 otherwise. */ -+int nf_hook_slow(int pf, unsigned int hook, struct sk_buff **pskb, - struct net_device *indev, - struct net_device *outdev, -- int (*okfn)(struct sk_buff *)) -+ int (*okfn)(struct sk_buff *), -+ int hook_thresh) - { - struct list_head *elem; - unsigned int verdict; - int ret = 0; - - /* This stopgap cannot be removed until all the hooks are audited. */ -- if (skb_is_nonlinear(skb) && skb_linearize(skb, GFP_ATOMIC) != 0) { -- kfree_skb(skb); -+ if (skb_is_nonlinear(*pskb) && skb_linearize(*pskb, GFP_ATOMIC) != 0) { -+ kfree_skb(*pskb); - return -ENOMEM; - } -- if (skb->ip_summed == CHECKSUM_HW) { -+ if ((*pskb)->ip_summed == CHECKSUM_HW) { - if (outdev == NULL) { -- skb->ip_summed = CHECKSUM_NONE; -+ (*pskb)->ip_summed = CHECKSUM_NONE; - } else { -- skb_checksum_help(skb); -+ skb_checksum_help(*pskb); - } - } - -@@ -472,30 +489,24 @@ int nf_hook_slow(int pf, unsigned int ho - br_read_lock_bh(BR_NETPROTO_LOCK); - - #ifdef CONFIG_NETFILTER_DEBUG -- if (skb->nf_debug & (1 << hook)) { -+ if (unlikely((*pskb)->nf_debug & (1 << hook))) { - printk("nf_hook: hook %i already set.\n", hook); -- nf_dump_skb(pf, skb); -+ nf_dump_skb(pf, *pskb); - } -- skb->nf_debug |= (1 << hook); -+ (*pskb)->nf_debug |= (1 << hook); - #endif - - elem = &nf_hooks[pf][hook]; -- verdict = nf_iterate(&nf_hooks[pf][hook], &skb, hook, indev, -- outdev, &elem, okfn); -- if (verdict == NF_QUEUE) { -- NFDEBUG("nf_hook: Verdict = QUEUE.\n"); -- nf_queue(skb, elem, pf, hook, indev, outdev, okfn); -- } -- -- switch (verdict) { -- case NF_ACCEPT: -- ret = okfn(skb); -- break; -- -- case NF_DROP: -- kfree_skb(skb); -+ verdict = nf_iterate(&nf_hooks[pf][hook], pskb, hook, indev, -+ outdev, &elem, okfn, hook_thresh); -+ if (verdict == NF_ACCEPT || verdict == NF_STOP) -+ ret = 1; -+ else if (verdict == NF_DROP) { -+ kfree_skb(*pskb); - ret = -EPERM; -- break; -+ } else if (verdict == NF_QUEUE) { -+ NFDEBUG("nf_hook: Verdict = QUEUE.\n"); -+ nf_queue(*pskb, elem, pf, hook, indev, outdev, okfn); - } - - br_read_unlock_bh(BR_NETPROTO_LOCK); -@@ -510,6 +521,14 @@ void nf_reinject(struct sk_buff *skb, st - - /* We don't have BR_NETPROTO_LOCK here */ - br_read_lock_bh(BR_NETPROTO_LOCK); -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+ if (skb->nf_bridge) { -+ if (skb->nf_bridge->physindev) -+ dev_put(skb->nf_bridge->physindev); -+ if (skb->nf_bridge->physoutdev) -+ dev_put(skb->nf_bridge->physoutdev); -+ } -+#endif - for (i = nf_hooks[info->pf][info->hook].next; i != elem; i = i->next) { - if (i == &nf_hooks[info->pf][info->hook]) { - /* The module which sent it to userspace is gone. */ -@@ -530,7 +549,7 @@ void nf_reinject(struct sk_buff *skb, st - verdict = nf_iterate(&nf_hooks[info->pf][info->hook], - &skb, info->hook, - info->indev, info->outdev, &elem, -- info->okfn); -+ info->okfn, INT_MIN); - } - - switch (verdict) { ---- linux-2.4.29/net/core/skbuff.c 2003-08-25 13:44:44.000000000 +0200 -+++ linux-2.4.29-ebt-brnf/net/core/skbuff.c 2005-03-14 00:00:30.000000000 +0100 -@@ -246,6 +246,9 @@ static inline void skb_headerinit(void * - #ifdef CONFIG_NETFILTER_DEBUG - skb->nf_debug = 0; - #endif -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+ skb->nf_bridge = NULL; -+#endif - #endif - #ifdef CONFIG_NET_SCHED - skb->tc_index = 0; -@@ -326,6 +329,9 @@ void __kfree_skb(struct sk_buff *skb) - } - #ifdef CONFIG_NETFILTER - nf_conntrack_put(skb->nfct); -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+ nf_bridge_put(skb->nf_bridge); -+#endif - #endif - skb_headerinit(skb, NULL, 0); /* clean state */ - kfree_skbmem(skb); -@@ -393,6 +399,9 @@ struct sk_buff *skb_clone(struct sk_buff - #ifdef CONFIG_NETFILTER_DEBUG - C(nf_debug); - #endif -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+ C(nf_bridge); -+#endif - #endif /*CONFIG_NETFILTER*/ - #if defined(CONFIG_HIPPI) - C(private); -@@ -405,6 +414,9 @@ struct sk_buff *skb_clone(struct sk_buff - skb->cloned = 1; - #ifdef CONFIG_NETFILTER - nf_conntrack_get(skb->nfct); -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+ nf_bridge_get(skb->nf_bridge); -+#endif - #endif - return n; - } -@@ -440,6 +452,10 @@ static void copy_skb_header(struct sk_bu - #ifdef CONFIG_NETFILTER_DEBUG - new->nf_debug=old->nf_debug; - #endif -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+ new->nf_bridge=old->nf_bridge; -+ nf_bridge_get(new->nf_bridge); -+#endif - #endif - #ifdef CONFIG_NET_SCHED - new->tc_index = old->tc_index; -@@ -726,9 +742,9 @@ struct sk_buff *skb_copy_expand(const st - /* Set the tail pointer and length */ - skb_put(n,skb->len); - -- /* Copy the data only. */ -- if (skb_copy_bits(skb, 0, n->data, skb->len)) -- BUG(); -+ /* Copy the linear data and header. */ -+ if (skb_copy_bits(skb, -newheadroom, n->head, newheadroom + skb->len)) -+ BUG(); - - copy_skb_header(n, skb); - return n; ---- linux-2.4.29/net/ipv4/netfilter/ip_tables.c 2005-01-19 15:10:13.000000000 +0100 -+++ linux-2.4.29-ebt-brnf/net/ipv4/netfilter/ip_tables.c 2005-03-14 00:00:30.000000000 +0100 -@@ -118,12 +118,19 @@ static LIST_HEAD(ipt_tables); - static inline int - ip_packet_match(const struct iphdr *ip, - const char *indev, -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+ const char *physindev, -+#endif - const char *outdev, -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+ const char *physoutdev, -+#endif - const struct ipt_ip *ipinfo, - int isfrag) - { - size_t i; - unsigned long ret; -+ unsigned long ret2 = 1; - - #define FWINV(bool,invflg) ((bool) ^ !!(ipinfo->invflags & invflg)) - -@@ -153,7 +160,15 @@ ip_packet_match(const struct iphdr *ip, - & ((const unsigned long *)ipinfo->iniface_mask)[i]; - } - -- if (FWINV(ret != 0, IPT_INV_VIA_IN)) { -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+ for (i = 0, ret2 = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) { -+ ret2 |= (((const unsigned long *)physindev)[i] -+ ^ ((const unsigned long *)ipinfo->iniface)[i]) -+ & ((const unsigned long *)ipinfo->iniface_mask)[i]; -+ } -+#endif -+ -+ if (FWINV(ret != 0 && ret2 != 0, IPT_INV_VIA_IN)) { - dprintf("VIA in mismatch (%s vs %s).%s\n", - indev, ipinfo->iniface, - ipinfo->invflags&IPT_INV_VIA_IN ?" (INV)":""); -@@ -166,7 +181,15 @@ ip_packet_match(const struct iphdr *ip, - & ((const unsigned long *)ipinfo->outiface_mask)[i]; - } - -- if (FWINV(ret != 0, IPT_INV_VIA_OUT)) { -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+ for (i = 0, ret2 = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) { -+ ret2 |= (((const unsigned long *)physoutdev)[i] -+ ^ ((const unsigned long *)ipinfo->outiface)[i]) -+ & ((const unsigned long *)ipinfo->outiface_mask)[i]; -+ } -+#endif -+ -+ if (FWINV(ret != 0 && ret2 != 0, IPT_INV_VIA_OUT)) { - dprintf("VIA out mismatch (%s vs %s).%s\n", - outdev, ipinfo->outiface, - ipinfo->invflags&IPT_INV_VIA_OUT ?" (INV)":""); -@@ -265,6 +288,9 @@ ipt_do_table(struct sk_buff **pskb, - /* Initializing verdict to NF_DROP keeps gcc happy. */ - unsigned int verdict = NF_DROP; - const char *indev, *outdev; -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+ const char *physindev, *physoutdev; -+#endif - void *table_base; - struct ipt_entry *e, *back; - -@@ -274,6 +300,13 @@ ipt_do_table(struct sk_buff **pskb, - datalen = (*pskb)->len - ip->ihl * 4; - indev = in ? in->name : nulldevname; - outdev = out ? out->name : nulldevname; -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+ physindev = ((*pskb)->nf_bridge && (*pskb)->nf_bridge->physindev) ? -+ (*pskb)->nf_bridge->physindev->name : nulldevname; -+ physoutdev = ((*pskb)->nf_bridge && (*pskb)->nf_bridge->physoutdev) ? -+ (*pskb)->nf_bridge->physoutdev->name : nulldevname; -+#endif -+ - /* We handle fragments by dealing with the first fragment as - * if it was a normal packet. All other fragments are treated - * normally, except that they will NEVER match rules that ask -@@ -309,7 +342,15 @@ ipt_do_table(struct sk_buff **pskb, - IP_NF_ASSERT(e); - IP_NF_ASSERT(back); - (*pskb)->nfcache |= e->nfcache; -- if (ip_packet_match(ip, indev, outdev, &e->ip, offset)) { -+ if (ip_packet_match(ip, indev, -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+ physindev, -+#endif -+ outdev, -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+ physoutdev, -+#endif -+ &e->ip, offset)) { - struct ipt_entry_target *t; - - if (IPT_MATCH_ITERATE(e, do_match, ---- linux-2.4.29/net/ipv4/ip_output.c 2005-01-19 15:10:13.000000000 +0100 -+++ linux-2.4.29-ebt-brnf/net/ipv4/ip_output.c 2005-03-14 00:00:30.000000000 +0100 -@@ -890,6 +890,10 @@ int ip_fragment(struct sk_buff *skb, int - /* Connection association is same as pre-frag packet */ - skb2->nfct = skb->nfct; - nf_conntrack_get(skb2->nfct); -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+ skb2->nf_bridge = skb->nf_bridge; -+ nf_bridge_get(skb2->nf_bridge); -+#endif - #ifdef CONFIG_NETFILTER_DEBUG - skb2->nf_debug = skb->nf_debug; - #endif ---- linux-2.4.29/net/ipv4/netfilter/ipt_LOG.c 2003-11-28 19:26:21.000000000 +0100 -+++ linux-2.4.29-ebt-brnf/net/ipv4/netfilter/ipt_LOG.c 2005-03-14 00:00:30.000000000 +0100 -@@ -316,6 +316,18 @@ ipt_log_target(struct sk_buff **pskb, - loginfo->prefix, - in ? in->name : "", - out ? out->name : ""); -+#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) -+ if ((*pskb)->nf_bridge) { -+ struct net_device *physindev = (*pskb)->nf_bridge->physindev; -+ struct net_device *physoutdev = (*pskb)->nf_bridge->physoutdev; -+ -+ if (physindev && in != physindev) -+ printk("PHYSIN=%s ", physindev->name); -+ if (physoutdev && out != physoutdev) -+ printk("PHYSOUT=%s ", physoutdev->name); -+ } -+#endif -+ - if (in && !out) { - /* MAC logging for input chain only. */ - printk("MAC="); ---- linux-2.4.29/net/ipv4/netfilter/Makefile 2003-08-25 13:44:44.000000000 +0200 -+++ linux-2.4.29-ebt-brnf/net/ipv4/netfilter/Makefile 2005-03-14 00:00:30.000000000 +0100 -@@ -87,6 +87,8 @@ obj-$(CONFIG_IP_NF_MATCH_CONNTRACK) += i - obj-$(CONFIG_IP_NF_MATCH_UNCLEAN) += ipt_unclean.o - obj-$(CONFIG_IP_NF_MATCH_TCPMSS) += ipt_tcpmss.o - -+obj-$(CONFIG_IP_NF_MATCH_PHYSDEV) += ipt_physdev.o -+ - # targets - obj-$(CONFIG_IP_NF_TARGET_REJECT) += ipt_REJECT.o - obj-$(CONFIG_IP_NF_TARGET_MIRROR) += ipt_MIRROR.o ---- linux-2.4.29/net/ipv4/netfilter/Config.in 2005-01-19 15:10:13.000000000 +0100 -+++ linux-2.4.29-ebt-brnf/net/ipv4/netfilter/Config.in 2005-03-14 00:00:30.000000000 +0100 -@@ -44,6 +44,9 @@ if [ "$CONFIG_IP_NF_IPTABLES" != "n" ]; - dep_tristate ' Unclean match support (EXPERIMENTAL)' CONFIG_IP_NF_MATCH_UNCLEAN $CONFIG_IP_NF_IPTABLES - dep_tristate ' Owner match support (EXPERIMENTAL)' CONFIG_IP_NF_MATCH_OWNER $CONFIG_IP_NF_IPTABLES - fi -+ if [ "$CONFIG_BRIDGE" != "n" ]; then -+ dep_tristate ' Physdev match support' CONFIG_IP_NF_MATCH_PHYSDEV $CONFIG_IP_NF_IPTABLES -+ fi - # The targets - dep_tristate ' Packet filtering' CONFIG_IP_NF_FILTER $CONFIG_IP_NF_IPTABLES - if [ "$CONFIG_IP_NF_FILTER" != "n" ]; then ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/bridge/br_netfilter.c 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,1101 @@ -+/* -+ * Handle firewalling -+ * Linux ethernet bridge -+ * -+ * Authors: -+ * Lennert Buytenhek -+ * Bart De Schuymer (maintainer) -+ * -+ * Changes: -+ * Apr 29 2003: physdev module support (bdschuym) -+ * Jun 19 2003: let arptables see bridged ARP traffic (bdschuym) -+ * Oct 06 2003: filter encapsulated IP/ARP VLAN traffic on untagged bridge -+ * (bdschuym) -+ * Aug 28 2004: add IPv6 filtering (bdschuym) -+ * -+ * 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. -+ * -+ * Lennert dedicates this file to Kerstin Wurdinger. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "br_private.h" -+#ifdef CONFIG_SYSCTL -+#include -+#endif -+ -+#define skb_origaddr(skb) (((struct bridge_skb_cb *) \ -+ (skb->nf_bridge->data))->daddr.ipv4) -+#define store_orig_dstaddr(skb) (skb_origaddr(skb) = (skb)->nh.iph->daddr) -+#define dnat_took_place(skb) (skb_origaddr(skb) != (skb)->nh.iph->daddr) -+ -+#define has_bridge_parent(device) ((device)->br_port != NULL) -+#define bridge_parent(device) (&((device)->br_port->br->dev)) -+ -+#ifdef CONFIG_SYSCTL -+static struct ctl_table_header *brnf_sysctl_header; -+static int brnf_call_iptables = 1; -+static int brnf_call_ip6tables = 1; -+static int brnf_call_arptables = 1; -+static int brnf_filter_vlan_tagged = 1; -+#else -+#define brnf_filter_vlan_tagged 1 -+#endif -+ -+#define IS_VLAN_IP (skb->protocol == __constant_htons(ETH_P_8021Q) && \ -+ hdr->h_vlan_encapsulated_proto == __constant_htons(ETH_P_IP) && \ -+ brnf_filter_vlan_tagged) -+#define IS_VLAN_IPV6 (skb->protocol == __constant_htons(ETH_P_8021Q) && \ -+ hdr->h_vlan_encapsulated_proto == __constant_htons(ETH_P_IPV6) && \ -+ brnf_filter_vlan_tagged) -+/* -+#define IS_VLAN_ARP (skb->protocol == __constant_htons(ETH_P_8021Q) && \ -+ hdr->h_vlan_encapsulated_proto == __constant_htons(ETH_P_ARP) && \ -+ brnf_filter_vlan_tagged) -+*/ -+ -+/* We need these fake structures to make netfilter happy -- -+ * lots of places assume that skb->dst != NULL, which isn't -+ * all that unreasonable. -+ * -+ * Currently, we fill in the PMTU entry because netfilter -+ * refragmentation needs it, and the rt_flags entry because -+ * ipt_REJECT needs it. Future netfilter modules might -+ * require us to fill additional fields. -+ */ -+static struct net_device __fake_net_device = { -+ .hard_header_len = ETH_HLEN -+}; -+ -+static struct rtable __fake_rtable = { -+ u: { -+ dst: { -+ __refcnt: ATOMIC_INIT(1), -+ dev: &__fake_net_device, -+ pmtu: 1500 -+ } -+ }, -+ -+ rt_flags: 0 -+}; -+ -+ -+/* PF_BRIDGE/PRE_ROUTING *********************************************/ -+/* Undo the changes made for ip6tables PREROUTING and continue the -+ * bridge PRE_ROUTING hook. */ -+static int br_nf_pre_routing_finish_ipv6(struct sk_buff *skb) -+{ -+ struct nf_bridge_info *nf_bridge = skb->nf_bridge; -+ -+#ifdef CONFIG_NETFILTER_DEBUG -+ skb->nf_debug ^= (1 << NF_BR_PRE_ROUTING); -+#endif -+ -+ if (nf_bridge->mask & BRNF_PKT_TYPE) { -+ skb->pkt_type = PACKET_OTHERHOST; -+ nf_bridge->mask ^= BRNF_PKT_TYPE; -+ } -+ nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING; -+ -+ skb->dst = (struct dst_entry *)&__fake_rtable; -+ dst_hold(skb->dst); -+ -+ skb->dev = nf_bridge->physindev; -+ if (skb->protocol == __constant_htons(ETH_P_8021Q)) { -+ skb_push(skb, VLAN_HLEN); -+ skb->nh.raw -= VLAN_HLEN; -+ } -+ NF_HOOK_THRESH(PF_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL, -+ br_handle_frame_finish, 1); -+ -+ return 0; -+} -+ -+static void __br_dnat_complain(void) -+{ -+ static unsigned long last_complaint; -+ -+ if (jiffies - last_complaint >= 5 * HZ) { -+ printk(KERN_WARNING "Performing cross-bridge DNAT requires IP " -+ "forwarding to be enabled\n"); -+ last_complaint = jiffies; -+ } -+} -+ -+ -+/* This requires some explaining. If DNAT has taken place, -+ * we will need to fix up the destination Ethernet address, -+ * and this is a tricky process. -+ * -+ * There are two cases to consider: -+ * 1. The packet was DNAT'ed to a device in the same bridge -+ * port group as it was received on. We can still bridge -+ * the packet. -+ * 2. The packet was DNAT'ed to a different device, either -+ * a non-bridged device or another bridge port group. -+ * The packet will need to be routed. -+ * -+ * The correct way of distinguishing between these two cases is to -+ * call ip_route_input() and to look at skb->dst->dev, which is -+ * changed to the destination device if ip_route_input() succeeds. -+ * -+ * Let us first consider the case that ip_route_input() succeeds: -+ * -+ * If skb->dst->dev equals the logical bridge device the packet -+ * came in on, we can consider this bridging. We then call -+ * skb->dst->output() which will make the packet enter br_nf_local_out() -+ * not much later. In that function it is assured that the iptables -+ * FORWARD chain is traversed for the packet. -+ * -+ * Otherwise, the packet is considered to be routed and we just -+ * change the destination MAC address so that the packet will -+ * later be passed up to the IP stack to be routed. -+ * -+ * Let us now consider the case that ip_route_input() fails: -+ * -+ * After a "echo '0' > /proc/sys/net/ipv4/ip_forward" ip_route_input() -+ * will fail, while __ip_route_output_key() will return success. The source -+ * address for __ip_route_output_key() is set to zero, so __ip_route_output_key -+ * thinks we're handling a locally generated packet and won't care -+ * if IP forwarding is allowed. We send a warning message to the users's -+ * log telling her to put IP forwarding on. -+ * -+ * ip_route_input() will also fail if there is no route available. -+ * In that case we just drop the packet. -+ * -+ * --Lennert, 20020411 -+ * --Bart, 20020416 (updated) -+ * --Bart, 20021007 (updated) -+ */ -+ -+static int br_nf_pre_routing_finish_bridge(struct sk_buff *skb) -+{ -+#ifdef CONFIG_NETFILTER_DEBUG -+ skb->nf_debug |= (1 << NF_BR_PRE_ROUTING) | (1 << NF_BR_FORWARD); -+#endif -+ -+ if (skb->pkt_type == PACKET_OTHERHOST) { -+ skb->pkt_type = PACKET_HOST; -+ skb->nf_bridge->mask |= BRNF_PKT_TYPE; -+ } -+ skb->nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING; -+ -+ skb->dev = bridge_parent(skb->dev); -+ if (skb->protocol == __constant_htons(ETH_P_8021Q)) { -+ skb_pull(skb, VLAN_HLEN); -+ skb->nh.raw += VLAN_HLEN; -+ } -+ skb->dst->output(skb); -+ return 0; -+} -+ -+static int br_nf_pre_routing_finish(struct sk_buff *skb) -+{ -+ struct net_device *dev = skb->dev; -+ struct iphdr *iph = skb->nh.iph; -+ struct nf_bridge_info *nf_bridge = skb->nf_bridge; -+ -+#ifdef CONFIG_NETFILTER_DEBUG -+ skb->nf_debug ^= (1 << NF_BR_PRE_ROUTING); -+#endif -+ -+ if (nf_bridge->mask & BRNF_PKT_TYPE) { -+ skb->pkt_type = PACKET_OTHERHOST; -+ nf_bridge->mask ^= BRNF_PKT_TYPE; -+ } -+ nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING; -+ -+ if (dnat_took_place(skb)) { -+ if (ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, -+ dev)) { -+ struct rtable *rt; -+ -+ if (!ip_route_output(&rt, iph->daddr, 0, iph->tos, 0)) { -+ /* Bridged-and-DNAT'ed traffic doesn't -+ * require ip_forwarding. -+ */ -+ if (((struct dst_entry *)rt)->dev == dev) { -+ skb->dst = (struct dst_entry *)rt; -+ goto bridged_dnat; -+ } -+ __br_dnat_complain(); -+ dst_release((struct dst_entry *)rt); -+ } -+ kfree_skb(skb); -+ return 0; -+ } else { -+ if (skb->dst->dev == dev) { -+bridged_dnat: -+ /* Tell br_nf_local_out this is a -+ * bridged frame -+ */ -+ nf_bridge->mask |= BRNF_BRIDGED_DNAT; -+ skb->dev = nf_bridge->physindev; -+ if (skb->protocol == -+ __constant_htons(ETH_P_8021Q)) { -+ skb_push(skb, VLAN_HLEN); -+ skb->nh.raw -= VLAN_HLEN; -+ } -+ NF_HOOK_THRESH(PF_BRIDGE, NF_BR_PRE_ROUTING, -+ skb, skb->dev, NULL, -+ br_nf_pre_routing_finish_bridge, -+ 1); -+ return 0; -+ } -+ memcpy(skb->mac.ethernet->h_dest, dev->dev_addr, -+ ETH_ALEN); -+ skb->pkt_type = PACKET_HOST; -+ } -+ } else { -+ skb->dst = (struct dst_entry *)&__fake_rtable; -+ dst_hold(skb->dst); -+ } -+ -+ skb->dev = nf_bridge->physindev; -+ if (skb->protocol == __constant_htons(ETH_P_8021Q)) { -+ skb_push(skb, VLAN_HLEN); -+ skb->nh.raw -= VLAN_HLEN; -+ } -+ NF_HOOK_THRESH(PF_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL, -+ br_handle_frame_finish, 1); -+ -+ return 0; -+} -+ -+/* Some common code for IPv4/IPv6 */ -+static void setup_pre_routing(struct sk_buff *skb) -+{ -+ struct nf_bridge_info *nf_bridge = skb->nf_bridge; -+ -+ if (skb->pkt_type == PACKET_OTHERHOST) { -+ skb->pkt_type = PACKET_HOST; -+ nf_bridge->mask |= BRNF_PKT_TYPE; -+ } -+ -+ nf_bridge->mask |= BRNF_NF_BRIDGE_PREROUTING; -+ nf_bridge->physindev = skb->dev; -+ skb->dev = bridge_parent(skb->dev); -+} -+ -+/* We only check the length. A bridge shouldn't do any hop-by-hop stuff anyway */ -+static int check_hbh_len(struct sk_buff *skb) -+{ -+ unsigned char *raw = (u8*)(skb->nh.ipv6h+1); -+ u32 pkt_len; -+ int off = raw - skb->nh.raw; -+ int len = (raw[1]+1)<<3; -+ -+ if ((raw + len) - skb->data > skb_headlen(skb)) -+ goto bad; -+ -+ off += 2; -+ len -= 2; -+ -+ while (len > 0) { -+ int optlen = raw[off+1]+2; -+ -+ switch (skb->nh.raw[off]) { -+ case IPV6_TLV_PAD0: -+ optlen = 1; -+ break; -+ -+ case IPV6_TLV_PADN: -+ break; -+ -+ case IPV6_TLV_JUMBO: -+ if (skb->nh.raw[off+1] != 4 || (off&3) != 2) -+ goto bad; -+ -+ pkt_len = ntohl(*(u32*)(skb->nh.raw+off+2)); -+ -+ if (pkt_len > skb->len - sizeof(struct ipv6hdr)) -+ goto bad; -+ if (pkt_len + sizeof(struct ipv6hdr) < skb->len) { -+ if (__pskb_trim(skb, -+ pkt_len + sizeof(struct ipv6hdr))) -+ goto bad; -+ if (skb->ip_summed == CHECKSUM_HW) -+ skb->ip_summed = CHECKSUM_NONE; -+ } -+ break; -+ default: -+ if (optlen > len) -+ goto bad; -+ break; -+ } -+ off += optlen; -+ len -= optlen; -+ } -+ if (len == 0) -+ return 0; -+bad: -+ return -1; -+ -+} -+ -+/* Replicate the checks that IPv6 does on packet reception and pass the packet -+ * to ip6tables, which doesn't support NAT, so things are fairly simple. */ -+static unsigned int br_nf_pre_routing_ipv6(unsigned int hook, -+ struct sk_buff *skb, const struct net_device *in, -+ const struct net_device *out, int (*okfn)(struct sk_buff *)) -+{ -+ struct ipv6hdr *hdr; -+ u32 pkt_len; -+ struct nf_bridge_info *nf_bridge; -+ -+ if (skb->len < sizeof(struct ipv6hdr)) -+ goto inhdr_error; -+ -+ if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) -+ goto inhdr_error; -+ -+ hdr = skb->nh.ipv6h; -+ -+ if (hdr->version != 6) -+ goto inhdr_error; -+ -+ pkt_len = ntohs(hdr->payload_len); -+ -+ if (pkt_len || hdr->nexthdr != NEXTHDR_HOP) { -+ if (pkt_len + sizeof(struct ipv6hdr) > skb->len) -+ goto inhdr_error; -+ if (pkt_len + sizeof(struct ipv6hdr) < skb->len) { -+ if (__pskb_trim(skb, pkt_len + sizeof(struct ipv6hdr))) -+ goto inhdr_error; -+ if (skb->ip_summed == CHECKSUM_HW) -+ skb->ip_summed = CHECKSUM_NONE; -+ } -+ } -+ if (hdr->nexthdr == NEXTHDR_HOP && check_hbh_len(skb)) -+ goto inhdr_error; -+ -+#ifdef CONFIG_NETFILTER_DEBUG -+ skb->nf_debug ^= (1 << NF_IP6_PRE_ROUTING); -+#endif -+ if ((nf_bridge = nf_bridge_alloc(skb)) == NULL) -+ return NF_DROP; -+ setup_pre_routing(skb); -+ -+ NF_HOOK(PF_INET6, NF_IP6_PRE_ROUTING, skb, skb->dev, NULL, -+ br_nf_pre_routing_finish_ipv6); -+ -+ return NF_STOLEN; -+ -+inhdr_error: -+ return NF_DROP; -+} -+ -+/* Direct IPv6 traffic to br_nf_pre_routing_ipv6. -+ * Replicate the checks that IPv4 does on packet reception. -+ * Set skb->dev to the bridge device (i.e. parent of the -+ * receiving device) to make netfilter happy, the REDIRECT -+ * target in particular. Save the original destination IP -+ * address to be able to detect DNAT afterwards. -+ */ -+static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff **pskb, -+ const struct net_device *in, const struct net_device *out, -+ int (*okfn)(struct sk_buff *)) -+{ -+ struct iphdr *iph; -+ __u32 len; -+ struct sk_buff *skb = *pskb; -+ struct nf_bridge_info *nf_bridge; -+ struct vlan_ethhdr *hdr = (struct vlan_ethhdr *) -+ ((*pskb)->mac.ethernet); -+ -+ if (skb->protocol == __constant_htons(ETH_P_IPV6) || IS_VLAN_IPV6) { -+#ifdef CONFIG_SYSCTL -+ if (!brnf_call_ip6tables) -+ return NF_ACCEPT; -+#endif -+ if ((skb = skb_share_check(*pskb, GFP_ATOMIC)) == NULL) -+ goto out; -+ -+ if (skb->protocol == __constant_htons(ETH_P_8021Q)) { -+ skb_pull(skb, VLAN_HLEN); -+ (skb)->nh.raw += VLAN_HLEN; -+ } -+ return br_nf_pre_routing_ipv6(hook, skb, in, out, okfn); -+ } -+ -+#ifdef CONFIG_SYSCTL -+ if (!brnf_call_iptables) -+ return NF_ACCEPT; -+#endif -+ -+ if (skb->protocol != __constant_htons(ETH_P_IP) && !IS_VLAN_IP) -+ return NF_ACCEPT; -+ if ((skb = skb_share_check(*pskb, GFP_ATOMIC)) == NULL) -+ goto out; -+ -+ if (skb->protocol == __constant_htons(ETH_P_8021Q)) { -+ skb_pull(skb, VLAN_HLEN); -+ (skb)->nh.raw += VLAN_HLEN; -+ } -+ -+ if (!pskb_may_pull(skb, sizeof(struct iphdr))) -+ goto inhdr_error; -+ -+ iph = skb->nh.iph; -+ if (iph->ihl < 5 || iph->version != 4) -+ goto inhdr_error; -+ -+ if (!pskb_may_pull(skb, 4*iph->ihl)) -+ goto inhdr_error; -+ -+ iph = skb->nh.iph; -+ if (ip_fast_csum((__u8 *)iph, iph->ihl) != 0) -+ goto inhdr_error; -+ -+ len = ntohs(iph->tot_len); -+ if (skb->len < len || len < 4*iph->ihl) -+ goto inhdr_error; -+ -+ if (skb->len > len) { -+ __pskb_trim(skb, len); -+ if (skb->ip_summed == CHECKSUM_HW) -+ skb->ip_summed = CHECKSUM_NONE; -+ } -+ -+#ifdef CONFIG_NETFILTER_DEBUG -+ skb->nf_debug ^= (1 << NF_IP_PRE_ROUTING); -+#endif -+ if ((nf_bridge = nf_bridge_alloc(skb)) == NULL) -+ return NF_DROP; -+ -+ setup_pre_routing(skb); -+ store_orig_dstaddr(skb); -+ -+ NF_HOOK(PF_INET, NF_IP_PRE_ROUTING, skb, skb->dev, NULL, -+ br_nf_pre_routing_finish); -+ -+ return NF_STOLEN; -+ -+inhdr_error: -+// IP_INC_STATS_BH(IpInHdrErrors); -+out: -+ return NF_DROP; -+} -+ -+ -+/* PF_BRIDGE/LOCAL_IN ************************************************/ -+/* The packet is locally destined, which requires a real -+ * dst_entry, so detach the fake one. On the way up, the -+ * packet would pass through PRE_ROUTING again (which already -+ * took place when the packet entered the bridge), but we -+ * register an IPv4 PRE_ROUTING 'sabotage' hook that will -+ * prevent this from happening. -+ */ -+static unsigned int br_nf_local_in(unsigned int hook, struct sk_buff **pskb, -+ const struct net_device *in, const struct net_device *out, -+ int (*okfn)(struct sk_buff *)) -+{ -+ struct sk_buff *skb = *pskb; -+ -+ if (skb->dst == (struct dst_entry *)&__fake_rtable) { -+ dst_release(skb->dst); -+ skb->dst = NULL; -+ } -+ -+ return NF_ACCEPT; -+} -+ -+/* PF_BRIDGE/FORWARD *************************************************/ -+static int br_nf_forward_finish(struct sk_buff *skb) -+{ -+ struct nf_bridge_info *nf_bridge = skb->nf_bridge; -+ struct net_device *in; -+/* struct vlan_ethhdr *hdr = (struct vlan_ethhdr *)(skb->mac.ethernet);*/ -+ -+#ifdef CONFIG_NETFILTER_DEBUG -+ skb->nf_debug ^= (1 << NF_BR_FORWARD); -+#endif -+ -+/* if (skb->protocol != __constant_htons(ETH_P_ARP) && !IS_VLAN_ARP) {*/ -+ in = nf_bridge->physindev; -+ if (nf_bridge->mask & BRNF_PKT_TYPE) { -+ skb->pkt_type = PACKET_OTHERHOST; -+ nf_bridge->mask ^= BRNF_PKT_TYPE; -+ } -+/* } else { -+ in = *((struct net_device **)(skb->cb)); -+ }*/ -+ if (skb->protocol == __constant_htons(ETH_P_8021Q)) { -+ skb_push(skb, VLAN_HLEN); -+ skb->nh.raw -= VLAN_HLEN; -+ } -+ NF_HOOK_THRESH(PF_BRIDGE, NF_BR_FORWARD, skb, in, -+ skb->dev, br_forward_finish, 1); -+ return 0; -+} -+ -+/* This is the 'purely bridged' case. For IP, we pass the packet to -+ * netfilter with indev and outdev set to the bridge device, -+ * but we are still able to filter on the 'real' indev/outdev -+ * because of the ipt_physdev.c module. For ARP, indev and outdev are the -+ * bridge ports. -+ */ -+static unsigned int br_nf_forward_ip(unsigned int hook, struct sk_buff **pskb, -+ const struct net_device *in, const struct net_device *out, -+ int (*okfn)(struct sk_buff *)) -+{ -+ struct sk_buff *skb = *pskb; -+ struct nf_bridge_info *nf_bridge; -+ struct vlan_ethhdr *hdr = (struct vlan_ethhdr *)(skb->mac.ethernet); -+ int pf; -+ -+ if (!skb->nf_bridge) -+ return NF_ACCEPT; -+ -+ if (skb->protocol == __constant_htons(ETH_P_IP) || IS_VLAN_IP) -+ pf = PF_INET; -+ else -+ pf = PF_INET6; -+ -+ if (skb->protocol == __constant_htons(ETH_P_8021Q)) { -+ skb_pull(*pskb, VLAN_HLEN); -+ (*pskb)->nh.raw += VLAN_HLEN; -+ } -+ -+#ifdef CONFIG_NETFILTER_DEBUG -+ skb->nf_debug ^= (1 << NF_BR_FORWARD); -+#endif -+ nf_bridge = skb->nf_bridge; -+ if (skb->pkt_type == PACKET_OTHERHOST) { -+ skb->pkt_type = PACKET_HOST; -+ nf_bridge->mask |= BRNF_PKT_TYPE; -+ } -+ -+ /* The physdev module checks on this */ -+ nf_bridge->mask |= BRNF_BRIDGED; -+ nf_bridge->physoutdev = skb->dev; -+ -+ NF_HOOK(pf, NF_IP_FORWARD, skb, bridge_parent(in), -+ bridge_parent(out), br_nf_forward_finish); -+ -+ return NF_STOLEN; -+} -+ -+/* -+static unsigned int br_nf_forward_arp(unsigned int hook, struct sk_buff **pskb, -+ const struct net_device *in, const struct net_device *out, -+ int (*okfn)(struct sk_buff *)) -+{ -+ struct sk_buff *skb = *pskb; -+ struct vlan_ethhdr *hdr = (struct vlan_ethhdr *)(skb->mac.ethernet); -+ struct net_device **d = (struct net_device **)(skb->cb); -+ -+ if (!brnf_call_arptables) -+ return NF_ACCEPT; -+ -+ if (skb->protocol != __constant_htons(ETH_P_ARP)) { -+ if (!IS_VLAN_ARP) -+ return NF_ACCEPT; -+ skb_pull(*pskb, VLAN_HLEN); -+ (*pskb)->nh.raw += VLAN_HLEN; -+ } -+ -+#ifdef CONFIG_NETFILTER_DEBUG -+ skb->nf_debug ^= (1 << NF_BR_FORWARD); -+#endif -+ -+ if (skb->nh.arph->ar_pln != 4) { -+ if (IS_VLAN_ARP) { -+ skb_push(*pskb, VLAN_HLEN); -+ (*pskb)->nh.raw -= VLAN_HLEN; -+ } -+ return NF_ACCEPT; -+ } -+ *d = (struct net_device *)in; -+ NF_HOOK(NF_ARP, NF_ARP_FORWARD, skb, (struct net_device *)in, -+ (struct net_device *)out, br_nf_forward_finish); -+ -+ return NF_STOLEN; -+} -+*/ -+ -+/* PF_BRIDGE/LOCAL_OUT ***********************************************/ -+static int br_nf_local_out_finish(struct sk_buff *skb) -+{ -+#ifdef CONFIG_NETFILTER_DEBUG -+ skb->nf_debug &= ~(1 << NF_BR_LOCAL_OUT); -+#endif -+ if (skb->protocol == __constant_htons(ETH_P_8021Q)) { -+ skb_push(skb, VLAN_HLEN); -+ skb->nh.raw -= VLAN_HLEN; -+ } -+ -+ NF_HOOK_THRESH(PF_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev, -+ br_forward_finish, NF_BR_PRI_FIRST + 1); -+ -+ return 0; -+} -+ -+ -+/* This function sees both locally originated IP packets and forwarded -+ * IP packets (in both cases the destination device is a bridge -+ * device). It also sees bridged-and-DNAT'ed packets. -+ * To be able to filter on the physical bridge devices (with the ipt_physdev.c -+ * module), we steal packets destined to a bridge device away from the -+ * PF_INET/FORWARD and PF_INET/OUTPUT hook functions, and give them back later, -+ * when we have determined the real output device. This is done in here. -+ * -+ * If (nf_bridge->mask & BRNF_BRIDGED_DNAT) then the packet is bridged -+ * and we fake the PF_BRIDGE/FORWARD hook. The function br_nf_forward() -+ * will then fake the PF_INET/FORWARD hook. br_nf_local_out() has priority -+ * NF_BR_PRI_FIRST, so no relevant PF_BRIDGE/INPUT functions have been nor -+ * will be executed. -+ * Otherwise, if nf_bridge->physindev is NULL, the bridge-nf code never touched -+ * this packet before, and so the packet was locally originated. We fake -+ * the PF_INET/LOCAL_OUT hook. -+ * Finally, if nf_bridge->physindev isn't NULL, then the packet was IP routed, -+ * so we fake the PF_INET/FORWARD hook. ipv4_sabotage_out() makes sure -+ * even routed packets that didn't arrive on a bridge interface have their -+ * nf_bridge->physindev set. -+ */ -+ -+static unsigned int br_nf_local_out(unsigned int hook, struct sk_buff **pskb, -+ const struct net_device *in, const struct net_device *out, -+ int (*okfn)(struct sk_buff *)) -+{ -+ struct net_device *realindev, *realoutdev; -+ struct sk_buff *skb = *pskb; -+ struct nf_bridge_info *nf_bridge; -+ struct vlan_ethhdr *hdr = (struct vlan_ethhdr *)(skb->mac.ethernet); -+ int pf; -+ -+ if (!skb->nf_bridge) -+ return NF_ACCEPT; -+ -+ if (skb->protocol == __constant_htons(ETH_P_IP) || IS_VLAN_IP) -+ pf = PF_INET; -+ else -+ pf = PF_INET6; -+ -+#ifdef CONFIG_NETFILTER_DEBUG -+ /* Sometimes we get packets with NULL ->dst here (for example, -+ * running a dhcp client daemon triggers this). This should now -+ * be fixed, but let's keep the check around. */ -+ if (skb->dst == NULL) { -+ printk(KERN_CRIT "br_netfilter: skb->dst == NULL."); -+ return NF_ACCEPT; -+ } -+#endif -+ -+ nf_bridge = skb->nf_bridge; -+ nf_bridge->physoutdev = skb->dev; -+ realindev = nf_bridge->physindev; -+ -+ /* Bridged, take PF_BRIDGE/FORWARD. -+ * (see big note in front of br_nf_pre_routing_finish) -+ */ -+ if (nf_bridge->mask & BRNF_BRIDGED_DNAT) { -+ if (nf_bridge->mask & BRNF_PKT_TYPE) { -+ skb->pkt_type = PACKET_OTHERHOST; -+ nf_bridge->mask ^= BRNF_PKT_TYPE; -+ } -+ if (skb->protocol == __constant_htons(ETH_P_8021Q)) { -+ skb_push(skb, VLAN_HLEN); -+ skb->nh.raw -= VLAN_HLEN; -+ } -+ -+ NF_HOOK(PF_BRIDGE, NF_BR_FORWARD, skb, realindev, -+ skb->dev, br_forward_finish); -+ goto out; -+ } -+ realoutdev = bridge_parent(skb->dev); -+ -+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) -+ /* iptables should match -o br0.x */ -+ if (nf_bridge->netoutdev) -+ realoutdev = nf_bridge->netoutdev; -+#endif -+ if (skb->protocol == __constant_htons(ETH_P_8021Q)) { -+ skb_pull(skb, VLAN_HLEN); -+ (*pskb)->nh.raw += VLAN_HLEN; -+ } -+ /* IP forwarded traffic has a physindev, locally -+ * generated traffic hasn't. -+ */ -+ if (realindev != NULL) { -+ if (((nf_bridge->mask & BRNF_DONT_TAKE_PARENT) == 0) && -+ has_bridge_parent(realindev)) -+ realindev = bridge_parent(realindev); -+ NF_HOOK_THRESH(pf, NF_IP_FORWARD, skb, realindev, -+ realoutdev, okfn, -+ NF_IP_PRI_BRIDGE_SABOTAGE_FORWARD + 1); -+ } else { -+#ifdef CONFIG_NETFILTER_DEBUG -+ skb->nf_debug ^= (1 << NF_IP_LOCAL_OUT); -+#endif -+ -+ NF_HOOK_THRESH(pf, NF_IP_LOCAL_OUT, skb, realindev, -+ realoutdev, okfn, -+ NF_IP_PRI_BRIDGE_SABOTAGE_LOCAL_OUT + 1); -+ } -+ -+out: -+ return NF_STOLEN; -+} -+ -+ -+/* PF_BRIDGE/POST_ROUTING ********************************************/ -+static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff **pskb, -+ const struct net_device *in, const struct net_device *out, -+ int (*okfn)(struct sk_buff *)) -+{ -+ struct sk_buff *skb = *pskb; -+ struct nf_bridge_info *nf_bridge = (*pskb)->nf_bridge; -+ struct vlan_ethhdr *hdr = (struct vlan_ethhdr *)(skb->mac.ethernet); -+ struct net_device *realoutdev = bridge_parent(skb->dev); -+ int pf; -+ -+#ifdef CONFIG_NETFILTER_DEBUG -+ /* Be very paranoid. This probably won't happen anymore, but let's -+ * keep the check just to be sure... */ -+ if (skb->mac.raw < skb->head || skb->mac.raw + ETH_HLEN > skb->data) { -+ printk(KERN_CRIT "br_netfilter: Argh!! br_nf_post_routing: " -+ "bad mac.raw pointer."); -+ goto print_error; -+ } -+#endif -+ -+ if (!nf_bridge) -+ return NF_ACCEPT; -+ -+ if (skb->protocol == __constant_htons(ETH_P_IP) || IS_VLAN_IP) -+ pf = PF_INET; -+ else -+ pf = PF_INET6; -+ -+ /* Sometimes we get packets with NULL ->dst here (for example, -+ * running a dhcp client daemon triggers this). -+ */ -+ if (skb->dst == NULL) -+ return NF_ACCEPT; -+ -+#ifdef CONFIG_NETFILTER_DEBUG -+ /* Sometimes we get packets with NULL ->dst here (for example, -+ * running a dhcp client daemon triggers this). This should now -+ * be fixed, but let's keep the check around. -+ */ -+ if (skb->dst == NULL) { -+ printk(KERN_CRIT "br_netfilter: skb->dst == NULL."); -+ goto print_error; -+ } -+ -+ skb->nf_debug ^= (1 << NF_IP_POST_ROUTING); -+#endif -+ -+ /* We assume any code from br_dev_queue_push_xmit onwards doesn't care -+ * about the value of skb->pkt_type. -+ */ -+ if (skb->pkt_type == PACKET_OTHERHOST) { -+ skb->pkt_type = PACKET_HOST; -+ nf_bridge->mask |= BRNF_PKT_TYPE; -+ } -+ -+ if (skb->protocol == __constant_htons(ETH_P_8021Q)) { -+ skb_pull(skb, VLAN_HLEN); -+ skb->nh.raw += VLAN_HLEN; -+ } -+ -+ nf_bridge_save_header(skb); -+ -+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) -+ if (nf_bridge->netoutdev) -+ realoutdev = nf_bridge->netoutdev; -+#endif -+ NF_HOOK(pf, NF_IP_POST_ROUTING, skb, NULL, -+ realoutdev, br_dev_queue_push_xmit); -+ -+ return NF_STOLEN; -+ -+#ifdef CONFIG_NETFILTER_DEBUG -+print_error: -+ if (skb->dev != NULL) { -+ printk("[%s]", skb->dev->name); -+ if (has_bridge_parent(skb->dev)) -+ printk("[%s]", bridge_parent(skb->dev)->name); -+ } -+ printk(" head:%p, raw:%p, data:%p\n", skb->head, skb->mac.raw, -+ skb->data); -+ return NF_ACCEPT; -+#endif -+} -+ -+ -+/* IPv4/SABOTAGE *****************************************************/ -+ -+/* Don't hand locally destined packets to PF_INET/PRE_ROUTING -+ * for the second time. -+ */ -+static unsigned int ip_sabotage_in(unsigned int hook, struct sk_buff **pskb, -+ const struct net_device *in, const struct net_device *out, -+ int (*okfn)(struct sk_buff *)) -+{ -+ if ((*pskb)->nf_bridge && -+ !((*pskb)->nf_bridge->mask & BRNF_NF_BRIDGE_PREROUTING)) { -+ return NF_STOP; -+ } -+ -+ return NF_ACCEPT; -+} -+ -+/* Postpone execution of PF_INET/FORWARD, PF_INET/LOCAL_OUT -+ * and PF_INET/POST_ROUTING until we have done the forwarding -+ * decision in the bridge code and have determined skb->physoutdev. -+ */ -+static unsigned int ip_sabotage_out(unsigned int hook, struct sk_buff **pskb, -+ const struct net_device *in, const struct net_device *out, -+ int (*okfn)(struct sk_buff *)) -+{ -+ struct sk_buff *skb = *pskb; -+ -+ if ((out->hard_start_xmit == br_dev_xmit && -+ okfn != br_nf_forward_finish && -+ okfn != br_nf_local_out_finish && -+ okfn != br_dev_queue_push_xmit) -+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) -+ || ((out->priv_flags & IFF_802_1Q_VLAN) && -+ VLAN_DEV_INFO(out)->real_dev->hard_start_xmit == br_dev_xmit) -+#endif -+ ) { -+ struct nf_bridge_info *nf_bridge; -+ -+ if (!skb->nf_bridge) { -+#ifdef CONFIG_SYSCTL -+ /* This code is executed while in the IP(v6) stack, -+ the version should be 4 or 6. We can't use -+ skb->protocol because that isn't set on -+ PF_INET(6)/LOCAL_OUT. */ -+ struct iphdr *ip = skb->nh.iph; -+ -+ if (ip->version == 4 && !brnf_call_iptables) -+ return NF_ACCEPT; -+ else if (ip->version == 6 && !brnf_call_ip6tables) -+ return NF_ACCEPT; -+#endif -+ if (hook == NF_IP_POST_ROUTING) -+ return NF_ACCEPT; -+ if (!nf_bridge_alloc(skb)) -+ return NF_DROP; -+ } -+ -+ nf_bridge = skb->nf_bridge; -+ -+ /* This frame will arrive on PF_BRIDGE/LOCAL_OUT and we -+ * will need the indev then. For a brouter, the real indev -+ * can be a bridge port, so we make sure br_nf_local_out() -+ * doesn't use the bridge parent of the indev by using -+ * the BRNF_DONT_TAKE_PARENT mask. -+ */ -+ if (hook == NF_IP_FORWARD && nf_bridge->physindev == NULL) { -+ nf_bridge->mask &= BRNF_DONT_TAKE_PARENT; -+ nf_bridge->physindev = (struct net_device *)in; -+ } -+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) -+ /* the iptables outdev is br0.x, not br0 */ -+ if (out->priv_flags & IFF_802_1Q_VLAN) -+ nf_bridge->netoutdev = (struct net_device *)out; -+#endif -+ return NF_STOP; -+ } -+ -+ return NF_ACCEPT; -+} -+ -+/* For br_nf_local_out we need (prio = NF_BR_PRI_FIRST), to insure that innocent -+ * PF_BRIDGE/NF_BR_LOCAL_OUT functions don't get bridged traffic as input. -+ * For br_nf_post_routing, we need (prio = NF_BR_PRI_LAST), because -+ * ip_refrag() can return NF_STOLEN. -+ */ -+static struct nf_hook_ops br_nf_ops[] = { -+ { .hook = br_nf_pre_routing, -+ .pf = PF_BRIDGE, -+ .hooknum = NF_BR_PRE_ROUTING, -+ .priority = NF_BR_PRI_BRNF, }, -+ { .hook = br_nf_local_in, -+ .pf = PF_BRIDGE, -+ .hooknum = NF_BR_LOCAL_IN, -+ .priority = NF_BR_PRI_BRNF, }, -+ { .hook = br_nf_forward_ip, -+ .pf = PF_BRIDGE, -+ .hooknum = NF_BR_FORWARD, -+ .priority = NF_BR_PRI_BRNF /*- 1*/, }, -+/* { .hook = br_nf_forward_arp, -+ .pf = PF_BRIDGE, -+ .hooknum = NF_BR_FORWARD, -+ .priority = NF_BR_PRI_BRNF, },*/ -+ { .hook = br_nf_local_out, -+ .pf = PF_BRIDGE, -+ .hooknum = NF_BR_LOCAL_OUT, -+ .priority = NF_BR_PRI_FIRST, }, -+ { .hook = br_nf_post_routing, -+ .pf = PF_BRIDGE, -+ .hooknum = NF_BR_POST_ROUTING, -+ .priority = NF_BR_PRI_LAST, }, -+ { .hook = ip_sabotage_in, -+ .pf = PF_INET, -+ .hooknum = NF_IP_PRE_ROUTING, -+ .priority = NF_IP_PRI_FIRST, }, -+ { .hook = ip_sabotage_in, -+ .pf = PF_INET6, -+ .hooknum = NF_IP6_PRE_ROUTING, -+ .priority = NF_IP6_PRI_FIRST, }, -+ { .hook = ip_sabotage_out, -+ .pf = PF_INET, -+ .hooknum = NF_IP_FORWARD, -+ .priority = NF_IP_PRI_BRIDGE_SABOTAGE_FORWARD, }, -+ { .hook = ip_sabotage_out, -+ .pf = PF_INET6, -+ .hooknum = NF_IP6_FORWARD, -+ .priority = NF_IP6_PRI_BRIDGE_SABOTAGE_FORWARD, }, -+ { .hook = ip_sabotage_out, -+ .pf = PF_INET, -+ .hooknum = NF_IP_LOCAL_OUT, -+ .priority = NF_IP_PRI_BRIDGE_SABOTAGE_LOCAL_OUT, }, -+ { .hook = ip_sabotage_out, -+ .pf = PF_INET6, -+ .hooknum = NF_IP6_LOCAL_OUT, -+ .priority = NF_IP6_PRI_BRIDGE_SABOTAGE_LOCAL_OUT, }, -+ { .hook = ip_sabotage_out, -+ .pf = PF_INET, -+ .hooknum = NF_IP_POST_ROUTING, -+ .priority = NF_IP_PRI_FIRST, }, -+ { .hook = ip_sabotage_out, -+ .pf = PF_INET6, -+ .hooknum = NF_IP6_POST_ROUTING, -+ .priority = NF_IP6_PRI_FIRST, }, -+}; -+ -+#ifdef CONFIG_SYSCTL -+static -+int brnf_sysctl_call_tables(ctl_table *ctl, int write, struct file * filp, -+ void *buffer, size_t *lenp) -+{ -+ int ret; -+ -+ ret = proc_dointvec(ctl, write, filp, buffer, lenp); -+ -+ if (write && *(int *)(ctl->data)) -+ *(int *)(ctl->data) = 1; -+ return ret; -+} -+ -+static ctl_table brnf_table[] = { -+ { -+ .ctl_name = NET_BRIDGE_NF_CALL_ARPTABLES, -+ .procname = "bridge-nf-call-arptables", -+ .data = &brnf_call_arptables, -+ .maxlen = sizeof(int), -+ .mode = 0644, -+ .proc_handler = &brnf_sysctl_call_tables, -+ }, -+ { -+ .ctl_name = NET_BRIDGE_NF_CALL_IPTABLES, -+ .procname = "bridge-nf-call-iptables", -+ .data = &brnf_call_iptables, -+ .maxlen = sizeof(int), -+ .mode = 0644, -+ .proc_handler = &brnf_sysctl_call_tables, -+ }, -+ { -+ .ctl_name = NET_BRIDGE_NF_CALL_IP6TABLES, -+ .procname = "bridge-nf-call-ip6tables", -+ .data = &brnf_call_ip6tables, -+ .maxlen = sizeof(int), -+ .mode = 0644, -+ .proc_handler = &brnf_sysctl_call_tables, -+ }, -+ { -+ .ctl_name = NET_BRIDGE_NF_FILTER_VLAN_TAGGED, -+ .procname = "bridge-nf-filter-vlan-tagged", -+ .data = &brnf_filter_vlan_tagged, -+ .maxlen = sizeof(int), -+ .mode = 0644, -+ .proc_handler = &brnf_sysctl_call_tables, -+ }, -+ { .ctl_name = 0 } -+}; -+ -+static ctl_table brnf_bridge_table[] = { -+ { -+ .ctl_name = NET_BRIDGE, -+ .procname = "bridge", -+ .mode = 0555, -+ .child = brnf_table, -+ }, -+ { .ctl_name = 0 } -+}; -+ -+static ctl_table brnf_net_table[] = { -+ { -+ .ctl_name = CTL_NET, -+ .procname = "net", -+ .mode = 0555, -+ .child = brnf_bridge_table, -+ }, -+ { .ctl_name = 0 } -+}; -+#endif -+ -+int br_netfilter_init(void) -+{ -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE(br_nf_ops); i++) { -+ int ret; -+ -+ if ((ret = nf_register_hook(&br_nf_ops[i])) >= 0) -+ continue; -+ -+ while (i--) -+ nf_unregister_hook(&br_nf_ops[i]); -+ -+ return ret; -+ } -+ -+#ifdef CONFIG_SYSCTL -+ brnf_sysctl_header = register_sysctl_table(brnf_net_table, 0); -+ if (brnf_sysctl_header == NULL) { -+ printk(KERN_WARNING "br_netfilter: can't register to sysctl.\n"); -+ for (i = 0; i < ARRAY_SIZE(br_nf_ops); i++) -+ nf_unregister_hook(&br_nf_ops[i]); -+ return -EFAULT; -+ } -+#endif -+ -+ printk(KERN_NOTICE "Bridge firewalling registered\n"); -+ -+ return 0; -+} -+ -+void br_netfilter_fini(void) -+{ -+ int i; -+ -+ for (i = ARRAY_SIZE(br_nf_ops) - 1; i >= 0; i--) -+ nf_unregister_hook(&br_nf_ops[i]); -+#ifdef CONFIG_SYSCTL -+ unregister_sysctl_table(brnf_sysctl_header); -+#endif -+ -+} ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/net/ipv4/netfilter/ipt_physdev.c 2005-03-14 00:00:30.000000000 +0100 -@@ -0,0 +1,127 @@ -+/* Kernel module to match the bridge port in and -+ * out device for IP packets coming into contact with a bridge. */ -+#include -+#include -+#include -+#include -+#include -+#include -+#define MATCH 1 -+#define NOMATCH 0 -+ -+static int -+match(const struct sk_buff *skb, -+ const struct net_device *in, -+ const struct net_device *out, -+ const void *matchinfo, -+ int offset, -+ const void *hdr, -+ u_int16_t datalen, -+ int *hotdrop) -+{ -+ int i; -+ static const char nulldevname[IFNAMSIZ] = { 0 }; -+ const struct ipt_physdev_info *info = matchinfo; -+ unsigned long ret; -+ const char *indev, *outdev; -+ struct nf_bridge_info *nf_bridge; -+ -+ /* Not a bridged IP packet or no info available yet: -+ * LOCAL_OUT/mangle and LOCAL_OUT/nat don't know if -+ * the destination device will be a bridge. */ -+ if (!(nf_bridge = skb->nf_bridge)) { -+ /* Return MATCH if the invert flags of the used options are on */ -+ if ((info->bitmask & IPT_PHYSDEV_OP_BRIDGED) && -+ !(info->invert & IPT_PHYSDEV_OP_BRIDGED)) -+ return NOMATCH; -+ if ((info->bitmask & IPT_PHYSDEV_OP_ISIN) && -+ !(info->invert & IPT_PHYSDEV_OP_ISIN)) -+ return NOMATCH; -+ if ((info->bitmask & IPT_PHYSDEV_OP_ISOUT) && -+ !(info->invert & IPT_PHYSDEV_OP_ISOUT)) -+ return NOMATCH; -+ if ((info->bitmask & IPT_PHYSDEV_OP_IN) && -+ !(info->invert & IPT_PHYSDEV_OP_IN)) -+ return NOMATCH; -+ if ((info->bitmask & IPT_PHYSDEV_OP_OUT) && -+ !(info->invert & IPT_PHYSDEV_OP_OUT)) -+ return NOMATCH; -+ return MATCH; -+ } -+ -+ /* This only makes sense in the FORWARD and POSTROUTING chains */ -+ if ((info->bitmask & IPT_PHYSDEV_OP_BRIDGED) && -+ (!!(nf_bridge->mask & BRNF_BRIDGED) ^ -+ !(info->invert & IPT_PHYSDEV_OP_BRIDGED))) -+ return NOMATCH; -+ -+ if ((info->bitmask & IPT_PHYSDEV_OP_ISIN && -+ (!nf_bridge->physindev ^ !!(info->invert & IPT_PHYSDEV_OP_ISIN))) || -+ (info->bitmask & IPT_PHYSDEV_OP_ISOUT && -+ (!nf_bridge->physoutdev ^ !!(info->invert & IPT_PHYSDEV_OP_ISOUT)))) -+ return NOMATCH; -+ -+ if (!(info->bitmask & IPT_PHYSDEV_OP_IN)) -+ goto match_outdev; -+ indev = nf_bridge->physindev ? nf_bridge->physindev->name : nulldevname; -+ for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) { -+ ret |= (((const unsigned long *)indev)[i] -+ ^ ((const unsigned long *)info->physindev)[i]) -+ & ((const unsigned long *)info->in_mask)[i]; -+ } -+ -+ if ((ret == 0) ^ !(info->invert & IPT_PHYSDEV_OP_IN)) -+ return NOMATCH; -+ -+match_outdev: -+ if (!(info->bitmask & IPT_PHYSDEV_OP_OUT)) -+ return MATCH; -+ outdev = nf_bridge->physoutdev ? -+ nf_bridge->physoutdev->name : nulldevname; -+ for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) { -+ ret |= (((const unsigned long *)outdev)[i] -+ ^ ((const unsigned long *)info->physoutdev)[i]) -+ & ((const unsigned long *)info->out_mask)[i]; -+ } -+ -+ return (ret != 0) ^ !(info->invert & IPT_PHYSDEV_OP_OUT); -+} -+ -+static int -+checkentry(const char *tablename, -+ const struct ipt_ip *ip, -+ void *matchinfo, -+ unsigned int matchsize, -+ unsigned int hook_mask) -+{ -+ const struct ipt_physdev_info *info = matchinfo; -+ -+ if (matchsize != IPT_ALIGN(sizeof(struct ipt_physdev_info))) -+ return 0; -+ if (!(info->bitmask & IPT_PHYSDEV_OP_MASK) || -+ info->bitmask & ~IPT_PHYSDEV_OP_MASK) -+ return 0; -+ return 1; -+} -+ -+static struct ipt_match physdev_match = { -+ .name = "physdev", -+ .match = &match, -+ .checkentry = &checkentry, -+ .me = THIS_MODULE, -+}; -+ -+static int __init init(void) -+{ -+ return ipt_register_match(&physdev_match); -+} -+ -+static void __exit fini(void) -+{ -+ ipt_unregister_match(&physdev_match); -+} -+ -+module_init(init); -+module_exit(fini); -+MODULE_LICENSE("GPL"); -+EXPORT_NO_SYMBOLS; ---- /dev/null 2005-03-14 20:10:29.001600248 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/netfilter_ipv4/ipt_physdev.h 2005-03-14 21:24:30.000000000 +0100 -@@ -0,0 +1,24 @@ -+#ifndef _IPT_PHYSDEV_H -+#define _IPT_PHYSDEV_H -+ -+#ifdef __KERNEL__ -+#include -+#endif -+ -+#define IPT_PHYSDEV_OP_IN 0x01 -+#define IPT_PHYSDEV_OP_OUT 0x02 -+#define IPT_PHYSDEV_OP_BRIDGED 0x04 -+#define IPT_PHYSDEV_OP_ISIN 0x08 -+#define IPT_PHYSDEV_OP_ISOUT 0x10 -+#define IPT_PHYSDEV_OP_MASK (0x20 - 1) -+ -+struct ipt_physdev_info { -+ char physindev[IFNAMSIZ]; -+ char in_mask[IFNAMSIZ]; -+ char physoutdev[IFNAMSIZ]; -+ char out_mask[IFNAMSIZ]; -+ u_int8_t invert; -+ u_int8_t bitmask; -+}; -+ -+#endif /*_IPT_PHYSDEV_H*/ ---- linux-2.4.29/net/8021q/vlan_dev.c 2005-01-19 15:10:13.000000000 +0100 -+++ linux-2.4.29-ebt-brnf/net/8021q/vlan_dev.c 2005-03-14 00:00:30.000000000 +0100 -@@ -488,6 +488,10 @@ int vlan_dev_hard_start_xmit(struct sk_b - stats->tx_packets++; /* for statics only */ - stats->tx_bytes += skb->len; - -+ skb->protocol = __constant_htons(ETH_P_8021Q); -+ skb->mac.raw -= VLAN_HLEN; -+ skb->nh.raw -= VLAN_HLEN; -+ - skb->dev = VLAN_DEV_INFO(dev)->real_dev; - dev_queue_xmit(skb); - ---- linux-2.4.29/include/linux/sysctl.h 2005-01-19 15:10:13.000000000 +0100 -+++ linux-2.4.29-ebt-brnf/include/linux/sysctl.h 2005-03-14 21:07:18.000000000 +0100 -@@ -608,6 +608,15 @@ enum { - NET_DECNET_CONF_DEV_STATE = 7 - }; - -+/* /proc/sys/net/bridge */ -+enum { -+ NET_BRIDGE_NF_CALL_ARPTABLES = 1, -+ NET_BRIDGE_NF_CALL_IPTABLES = 2, -+ NET_BRIDGE_NF_CALL_IP6TABLES = 3, -+ NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4, -+}; -+ -+ - /* CTL_PROC names: */ - - /* CTL_FS names: */ ---- linux-2.4.29/net/ipv4/netfilter/ipt_REJECT.c 2005-01-19 15:10:13.000000000 +0100 -+++ linux-2.4.29-ebt-brnf/net/ipv4/netfilter/ipt_REJECT.c 2005-03-14 00:00:30.000000000 +0100 -@@ -15,6 +15,9 @@ - #include - #include - #include -+#ifdef CONFIG_BRIDGE_NETFILTER -+#include -+#endif - - #if 0 - #define DEBUGP printk -@@ -29,7 +32,13 @@ static inline struct rtable *route_rever - struct rt_key key = {}; - struct rtable *rt; - -- if (hook != NF_IP_FORWARD) { -+ /* We don't require ip forwarding to be enabled to be able to -+ * send a RST reply for bridged traffic. */ -+ if (hook != NF_IP_FORWARD -+#ifdef CONFIG_BRIDGE_NETFILTER -+ || (skb->nf_bridge && skb->nf_bridge->mask & BRNF_BRIDGED) -+#endif -+ ) { - key.dst = iph->saddr; - if (hook == NF_IP_LOCAL_IN) - key.src = iph->daddr; diff --git a/openwrt/package/linux/kernel-patches/305-cifs-1.20c b/openwrt/package/linux/kernel-patches/305-cifs-1.20c deleted file mode 100644 index bdccf4de9f..0000000000 --- a/openwrt/package/linux/kernel-patches/305-cifs-1.20c +++ /dev/null @@ -1,22022 +0,0 @@ -diff -urN linux-2.4.29.old/Documentation/Configure.help linux-2.4.29/Documentation/Configure.help ---- linux-2.4.29.old/Documentation/Configure.help 2005-03-21 19:30:22.000000000 +0100 -+++ linux-2.4.29/Documentation/Configure.help 2005-03-21 19:36:51.000000000 +0100 -@@ -17943,6 +17943,34 @@ - - If you don't know what all this is about, say N. - -+CIFS (Common Internet File System) support -+CONFIG_CIFS -+ This is the client VFS module for the Common Internet File System -+ (CIFS) protocol which is the successor to the Server Message Block -+ (SMB) protocol, the native file sharing mechanism for most early -+ PC operating systems. CIFS is fully supported by current network -+ file servers such as Windows 2000, Windows 2003 (including -+ Windows XP) as well by Samba (which provides excellent CIFS -+ server support for Linux and many other operating systems). -+ The smbfs module should be used instead of this cifs module for -+ mounting to older SMB servers such as OS/2. The smbfs and cifs -+ modules can coexist and do not conflict. -+ -+ The intent of this module is to provide the most advanced network -+ file system function for CIFS compliant servers, including better -+ POSIX compliance, secure per-user session establishment, high -+ performance safe distributed caching (oplock), optional packet -+ signing, Unicode support and other internationalization improvements -+ For more information see the project page at -+ http://us1.samba.org/samba/Linux_CIFS_client.html -+ -+CIFS Debugging -+CONFIG_CIFS_DEBUG -+ If you are experiencing any problems with the CIFS filesystem, say -+ Y here. This will result in additional debugging messages to be -+ written to the system log. Under normal circumstances, this -+ results in very little overhead. -+ - SMB file system support (to mount Windows shares etc.) - CONFIG_SMB_FS - SMB (Server Message Block) is the protocol Windows for Workgroups -diff -urN linux-2.4.29.old/Documentation/filesystems/00-INDEX linux-2.4.29/Documentation/filesystems/00-INDEX ---- linux-2.4.29.old/Documentation/filesystems/00-INDEX 2004-02-18 14:36:30.000000000 +0100 -+++ linux-2.4.29/Documentation/filesystems/00-INDEX 2005-03-21 19:36:51.000000000 +0100 -@@ -10,6 +10,8 @@ - - info for the BeOS file system (BFS) - bfs.txt - - info for the SCO UnixWare Boot Filesystem (BFS). -+cifs.txt -+ - info on the Common Internet File System (CIFS) - coda.txt - - description of the CODA filesystem. - cramfs.txt -diff -urN linux-2.4.29.old/Documentation/filesystems/cifs.txt linux-2.4.29/Documentation/filesystems/cifs.txt ---- linux-2.4.29.old/Documentation/filesystems/cifs.txt 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/Documentation/filesystems/cifs.txt 2005-03-21 19:36:51.000000000 +0100 -@@ -0,0 +1,51 @@ -+ This is the client VFS module for the Common Internet File System -+ (CIFS) protocol which is the successor to the Server Message Block -+ (SMB) protocol, the native file sharing mechanism for most early -+ PC operating systems. CIFS is fully supported by current network -+ file servers such as Windows 2000, Windows 2003 (including -+ Windows XP) as well by Samba (which provides excellent CIFS -+ server support for Linux and many other operating systems), so -+ this network filesystem client can mount to a wide variety of -+ servers. The smbfs module should be used instead of this cifs module -+ for mounting to older SMB servers such as OS/2. The smbfs and cifs -+ modules can coexist and do not conflict. The CIFS VFS filesystem -+ module is designed to work well with servers that implement the -+ newer versions (dialects) of the SMB/CIFS protocol such as Samba, -+ the program written by Andrew Tridgell that turns any Unix host -+ into a SMB/CIFS file server. -+ -+ The intent of this module is to provide the most advanced network -+ file system function for CIFS compliant servers, including better -+ POSIX compliance, secure per-user session establishment, high -+ performance safe distributed caching (oplock), optional packet -+ signing, large files, Unicode support and other internationalization -+ improvements. Since both Samba server and this filesystem client support -+ the CIFS Unix extensions, the combination can provide a reasonable -+ alternative to NFSv4 for fileserving in some Linux to Linux environments, -+ not just in Linux to Windows environments. -+ -+ This filesystem has an optional mount utility (mount.cifs) that can -+ be obtained from the project page and installed in the path in the same -+ directory with the other mount helpers (such as mount.smbfs). -+ Mounting using the cifs filesystem without installing the mount helper -+ requires specifying the server's ip address. -+ -+ For Linux 2.4: -+ mount //anything/here /mnt_target -o -+ user=username,pass=password,unc=//ip_address_of_server/sharename -+ -+ For Linux 2.5: -+ mount //ip_address_of_server/sharename /mnt_target -o user=username, pass=password -+ -+ -+ For more information on the module see the project page at -+ -+ http://us1.samba.org/samba/Linux_CIFS_client.html -+ -+ For more information on CIFS see: -+ -+ http://www.snia.org/tech_activities/CIFS -+ -+ or the Samba site: -+ -+ http://www.samba.org -diff -urN linux-2.4.29.old/fs/cifs/asn1.c linux-2.4.29/fs/cifs/asn1.c ---- linux-2.4.29.old/fs/cifs/asn1.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/asn1.c 2004-07-14 00:25:04.000000000 +0200 -@@ -0,0 +1,614 @@ -+/* -+ * The ASB.1/BER parsing code is derived from ip_nat_snmp_basic.c which was in -+ * turn derived from the gxsnmp package by Gregory McLean & Jochen Friedrich -+ * -+ * Copyright (c) 2000 RP Internet (www.rpi.net.au). -+ * -+ * 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 "cifspdu.h" -+#include "cifsglob.h" -+#include "cifs_debug.h" -+ -+/***************************************************************************** -+ * -+ * Basic ASN.1 decoding routines (gxsnmp author Dirk Wisse) -+ * -+ *****************************************************************************/ -+ -+/* Class */ -+#define ASN1_UNI 0 /* Universal */ -+#define ASN1_APL 1 /* Application */ -+#define ASN1_CTX 2 /* Context */ -+#define ASN1_PRV 3 /* Private */ -+ -+/* Tag */ -+#define ASN1_EOC 0 /* End Of Contents or N/A */ -+#define ASN1_BOL 1 /* Boolean */ -+#define ASN1_INT 2 /* Integer */ -+#define ASN1_BTS 3 /* Bit String */ -+#define ASN1_OTS 4 /* Octet String */ -+#define ASN1_NUL 5 /* Null */ -+#define ASN1_OJI 6 /* Object Identifier */ -+#define ASN1_OJD 7 /* Object Description */ -+#define ASN1_EXT 8 /* External */ -+#define ASN1_SEQ 16 /* Sequence */ -+#define ASN1_SET 17 /* Set */ -+#define ASN1_NUMSTR 18 /* Numerical String */ -+#define ASN1_PRNSTR 19 /* Printable String */ -+#define ASN1_TEXSTR 20 /* Teletext String */ -+#define ASN1_VIDSTR 21 /* Video String */ -+#define ASN1_IA5STR 22 /* IA5 String */ -+#define ASN1_UNITIM 23 /* Universal Time */ -+#define ASN1_GENTIM 24 /* General Time */ -+#define ASN1_GRASTR 25 /* Graphical String */ -+#define ASN1_VISSTR 26 /* Visible String */ -+#define ASN1_GENSTR 27 /* General String */ -+ -+/* Primitive / Constructed methods*/ -+#define ASN1_PRI 0 /* Primitive */ -+#define ASN1_CON 1 /* Constructed */ -+ -+/* -+ * Error codes. -+ */ -+#define ASN1_ERR_NOERROR 0 -+#define ASN1_ERR_DEC_EMPTY 2 -+#define ASN1_ERR_DEC_EOC_MISMATCH 3 -+#define ASN1_ERR_DEC_LENGTH_MISMATCH 4 -+#define ASN1_ERR_DEC_BADVALUE 5 -+ -+#define SPNEGO_OID_LEN 7 -+#define NTLMSSP_OID_LEN 10 -+unsigned long SPNEGO_OID[7] = { 1, 3, 6, 1, 5, 5, 2 }; -+unsigned long NTLMSSP_OID[10] = { 1, 3, 6, 1, 4, 1, 311, 2, 2, 10 }; -+ -+/* -+ * ASN.1 context. -+ */ -+struct asn1_ctx { -+ int error; /* Error condition */ -+ unsigned char *pointer; /* Octet just to be decoded */ -+ unsigned char *begin; /* First octet */ -+ unsigned char *end; /* Octet after last octet */ -+}; -+ -+/* -+ * Octet string (not null terminated) -+ */ -+struct asn1_octstr { -+ unsigned char *data; -+ unsigned int len; -+}; -+ -+static void -+asn1_open(struct asn1_ctx *ctx, unsigned char *buf, unsigned int len) -+{ -+ ctx->begin = buf; -+ ctx->end = buf + len; -+ ctx->pointer = buf; -+ ctx->error = ASN1_ERR_NOERROR; -+} -+ -+static unsigned char -+asn1_octet_decode(struct asn1_ctx *ctx, unsigned char *ch) -+{ -+ if (ctx->pointer >= ctx->end) { -+ ctx->error = ASN1_ERR_DEC_EMPTY; -+ return 0; -+ } -+ *ch = *(ctx->pointer)++; -+ return 1; -+} -+ -+static unsigned char -+asn1_tag_decode(struct asn1_ctx *ctx, unsigned int *tag) -+{ -+ unsigned char ch; -+ -+ *tag = 0; -+ -+ do { -+ if (!asn1_octet_decode(ctx, &ch)) -+ return 0; -+ *tag <<= 7; -+ *tag |= ch & 0x7F; -+ } while ((ch & 0x80) == 0x80); -+ return 1; -+} -+ -+static unsigned char -+asn1_id_decode(struct asn1_ctx *ctx, -+ unsigned int *cls, unsigned int *con, unsigned int *tag) -+{ -+ unsigned char ch; -+ -+ if (!asn1_octet_decode(ctx, &ch)) -+ return 0; -+ -+ *cls = (ch & 0xC0) >> 6; -+ *con = (ch & 0x20) >> 5; -+ *tag = (ch & 0x1F); -+ -+ if (*tag == 0x1F) { -+ if (!asn1_tag_decode(ctx, tag)) -+ return 0; -+ } -+ return 1; -+} -+ -+static unsigned char -+asn1_length_decode(struct asn1_ctx *ctx, unsigned int *def, unsigned int *len) -+{ -+ unsigned char ch, cnt; -+ -+ if (!asn1_octet_decode(ctx, &ch)) -+ return 0; -+ -+ if (ch == 0x80) -+ *def = 0; -+ else { -+ *def = 1; -+ -+ if (ch < 0x80) -+ *len = ch; -+ else { -+ cnt = (unsigned char) (ch & 0x7F); -+ *len = 0; -+ -+ while (cnt > 0) { -+ if (!asn1_octet_decode(ctx, &ch)) -+ return 0; -+ *len <<= 8; -+ *len |= ch; -+ cnt--; -+ } -+ } -+ } -+ return 1; -+} -+ -+static unsigned char -+asn1_header_decode(struct asn1_ctx *ctx, -+ unsigned char **eoc, -+ unsigned int *cls, unsigned int *con, unsigned int *tag) -+{ -+ unsigned int def, len; -+ -+ if (!asn1_id_decode(ctx, cls, con, tag)) -+ return 0; -+ -+ if (!asn1_length_decode(ctx, &def, &len)) -+ return 0; -+ -+ if (def) -+ *eoc = ctx->pointer + len; -+ else -+ *eoc = NULL; -+ return 1; -+} -+ -+static unsigned char -+asn1_eoc_decode(struct asn1_ctx *ctx, unsigned char *eoc) -+{ -+ unsigned char ch; -+ -+ if (eoc == 0) { -+ if (!asn1_octet_decode(ctx, &ch)) -+ return 0; -+ -+ if (ch != 0x00) { -+ ctx->error = ASN1_ERR_DEC_EOC_MISMATCH; -+ return 0; -+ } -+ -+ if (!asn1_octet_decode(ctx, &ch)) -+ return 0; -+ -+ if (ch != 0x00) { -+ ctx->error = ASN1_ERR_DEC_EOC_MISMATCH; -+ return 0; -+ } -+ return 1; -+ } else { -+ if (ctx->pointer != eoc) { -+ ctx->error = ASN1_ERR_DEC_LENGTH_MISMATCH; -+ return 0; -+ } -+ return 1; -+ } -+} -+ -+/* static unsigned char asn1_null_decode(struct asn1_ctx *ctx, -+ unsigned char *eoc) -+{ -+ ctx->pointer = eoc; -+ return 1; -+} -+ -+static unsigned char asn1_long_decode(struct asn1_ctx *ctx, -+ unsigned char *eoc, long *integer) -+{ -+ unsigned char ch; -+ unsigned int len; -+ -+ if (!asn1_octet_decode(ctx, &ch)) -+ return 0; -+ -+ *integer = (signed char) ch; -+ len = 1; -+ -+ while (ctx->pointer < eoc) { -+ if (++len > sizeof(long)) { -+ ctx->error = ASN1_ERR_DEC_BADVALUE; -+ return 0; -+ } -+ -+ if (!asn1_octet_decode(ctx, &ch)) -+ return 0; -+ -+ *integer <<= 8; -+ *integer |= ch; -+ } -+ return 1; -+} -+ -+static unsigned char asn1_uint_decode(struct asn1_ctx *ctx, -+ unsigned char *eoc, -+ unsigned int *integer) -+{ -+ unsigned char ch; -+ unsigned int len; -+ -+ if (!asn1_octet_decode(ctx, &ch)) -+ return 0; -+ -+ *integer = ch; -+ if (ch == 0) -+ len = 0; -+ else -+ len = 1; -+ -+ while (ctx->pointer < eoc) { -+ if (++len > sizeof(unsigned int)) { -+ ctx->error = ASN1_ERR_DEC_BADVALUE; -+ return 0; -+ } -+ -+ if (!asn1_octet_decode(ctx, &ch)) -+ return 0; -+ -+ *integer <<= 8; -+ *integer |= ch; -+ } -+ return 1; -+} -+ -+static unsigned char asn1_ulong_decode(struct asn1_ctx *ctx, -+ unsigned char *eoc, -+ unsigned long *integer) -+{ -+ unsigned char ch; -+ unsigned int len; -+ -+ if (!asn1_octet_decode(ctx, &ch)) -+ return 0; -+ -+ *integer = ch; -+ if (ch == 0) -+ len = 0; -+ else -+ len = 1; -+ -+ while (ctx->pointer < eoc) { -+ if (++len > sizeof(unsigned long)) { -+ ctx->error = ASN1_ERR_DEC_BADVALUE; -+ return 0; -+ } -+ -+ if (!asn1_octet_decode(ctx, &ch)) -+ return 0; -+ -+ *integer <<= 8; -+ *integer |= ch; -+ } -+ return 1; -+} -+ -+static unsigned char -+asn1_octets_decode(struct asn1_ctx *ctx, -+ unsigned char *eoc, -+ unsigned char **octets, unsigned int *len) -+{ -+ unsigned char *ptr; -+ -+ *len = 0; -+ -+ *octets = kmalloc(eoc - ctx->pointer, GFP_ATOMIC); -+ if (*octets == NULL) { -+ return 0; -+ } -+ -+ ptr = *octets; -+ while (ctx->pointer < eoc) { -+ if (!asn1_octet_decode(ctx, (unsigned char *) ptr++)) { -+ kfree(*octets); -+ *octets = NULL; -+ return 0; -+ } -+ (*len)++; -+ } -+ return 1; -+} */ -+ -+static unsigned char -+asn1_subid_decode(struct asn1_ctx *ctx, unsigned long *subid) -+{ -+ unsigned char ch; -+ -+ *subid = 0; -+ -+ do { -+ if (!asn1_octet_decode(ctx, &ch)) -+ return 0; -+ -+ *subid <<= 7; -+ *subid |= ch & 0x7F; -+ } while ((ch & 0x80) == 0x80); -+ return 1; -+} -+ -+static unsigned char -+asn1_oid_decode(struct asn1_ctx *ctx, -+ unsigned char *eoc, unsigned long **oid, unsigned int *len) -+{ -+ unsigned long subid; -+ unsigned int size; -+ unsigned long *optr; -+ -+ size = eoc - ctx->pointer + 1; -+ *oid = kmalloc(size * sizeof (unsigned long), GFP_ATOMIC); -+ if (*oid == NULL) { -+ return 0; -+ } -+ -+ optr = *oid; -+ -+ if (!asn1_subid_decode(ctx, &subid)) { -+ kfree(*oid); -+ *oid = NULL; -+ return 0; -+ } -+ -+ if (subid < 40) { -+ optr[0] = 0; -+ optr[1] = subid; -+ } else if (subid < 80) { -+ optr[0] = 1; -+ optr[1] = subid - 40; -+ } else { -+ optr[0] = 2; -+ optr[1] = subid - 80; -+ } -+ -+ *len = 2; -+ optr += 2; -+ -+ while (ctx->pointer < eoc) { -+ if (++(*len) > size) { -+ ctx->error = ASN1_ERR_DEC_BADVALUE; -+ kfree(*oid); -+ *oid = NULL; -+ return 0; -+ } -+ -+ if (!asn1_subid_decode(ctx, optr++)) { -+ kfree(*oid); -+ *oid = NULL; -+ return 0; -+ } -+ } -+ return 1; -+} -+ -+static int -+compare_oid(unsigned long *oid1, unsigned int oid1len, -+ unsigned long *oid2, unsigned int oid2len) -+{ -+ unsigned int i; -+ -+ if (oid1len != oid2len) -+ return 0; -+ else { -+ for (i = 0; i < oid1len; i++) { -+ if (oid1[i] != oid2[i]) -+ return 0; -+ } -+ return 1; -+ } -+} -+ -+ /* BB check for endian conversion issues here */ -+ -+int -+decode_negTokenInit(unsigned char *security_blob, int length, -+ enum securityEnum *secType) -+{ -+ struct asn1_ctx ctx; -+ unsigned char *end; -+ unsigned char *sequence_end; -+ unsigned long *oid; -+ unsigned int cls, con, tag, oidlen, rc; -+ int use_ntlmssp = FALSE; -+ -+ *secType = NTLM; /* BB eventually make Kerberos or NLTMSSP the default */ -+ -+ /* cifs_dump_mem(" Received SecBlob ", security_blob, length); */ -+ -+ asn1_open(&ctx, security_blob, length); -+ -+ if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { -+ cFYI(1, ("Error decoding negTokenInit header ")); -+ return 0; -+ } else if ((cls != ASN1_APL) || (con != ASN1_CON) -+ || (tag != ASN1_EOC)) { -+ cFYI(1, ("cls = %d con = %d tag = %d", cls, con, tag)); -+ return 0; -+ } else { -+ /* remember to free obj->oid */ -+ rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag); -+ if (rc) { -+ if ((tag == ASN1_OJI) && (cls == ASN1_PRI)) { -+ rc = asn1_oid_decode(&ctx, end, &oid, &oidlen); -+ if (rc) { -+ rc = compare_oid(oid, oidlen, -+ SPNEGO_OID, -+ SPNEGO_OID_LEN); -+ kfree(oid); -+ } -+ } else -+ rc = 0; -+ } -+ -+ if (!rc) { -+ cFYI(1, ("Error decoding negTokenInit header")); -+ return 0; -+ } -+ -+ if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { -+ cFYI(1, ("Error decoding negTokenInit ")); -+ return 0; -+ } else if ((cls != ASN1_CTX) || (con != ASN1_CON) -+ || (tag != ASN1_EOC)) { -+ cFYI(1,("cls = %d con = %d tag = %d end = %p (%d) exit 0", -+ cls, con, tag, end, *end)); -+ return 0; -+ } -+ -+ if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { -+ cFYI(1, ("Error decoding negTokenInit ")); -+ return 0; -+ } else if ((cls != ASN1_UNI) || (con != ASN1_CON) -+ || (tag != ASN1_SEQ)) { -+ cFYI(1,("cls = %d con = %d tag = %d end = %p (%d) exit 1", -+ cls, con, tag, end, *end)); -+ return 0; -+ } -+ -+ if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { -+ cFYI(1, ("Error decoding 2nd part of negTokenInit ")); -+ return 0; -+ } else if ((cls != ASN1_CTX) || (con != ASN1_CON) -+ || (tag != ASN1_EOC)) { -+ cFYI(1, -+ ("cls = %d con = %d tag = %d end = %p (%d) exit 0", -+ cls, con, tag, end, *end)); -+ return 0; -+ } -+ -+ if (asn1_header_decode -+ (&ctx, &sequence_end, &cls, &con, &tag) == 0) { -+ cFYI(1, ("Error decoding 2nd part of negTokenInit ")); -+ return 0; -+ } else if ((cls != ASN1_UNI) || (con != ASN1_CON) -+ || (tag != ASN1_SEQ)) { -+ cFYI(1, -+ ("cls = %d con = %d tag = %d end = %p (%d) exit 1", -+ cls, con, tag, end, *end)); -+ return 0; -+ } -+ -+ while (!asn1_eoc_decode(&ctx, sequence_end)) { -+ rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag); -+ if (!rc) { -+ cFYI(1, -+ ("Error 1 decoding negTokenInit header exit 2")); -+ return 0; -+ } -+ if ((tag == ASN1_OJI) && (con == ASN1_PRI)) { -+ asn1_oid_decode(&ctx, end, &oid, &oidlen); -+ cFYI(1, -+ ("OID len = %d oid = 0x%lx 0x%lx 0x%lx 0x%lx", -+ oidlen, *oid, *(oid + 1), *(oid + 2), -+ *(oid + 3))); -+ rc = compare_oid(oid, oidlen, NTLMSSP_OID, -+ NTLMSSP_OID_LEN); -+ kfree(oid); -+ if (rc) -+ use_ntlmssp = TRUE; -+ } else { -+ cFYI(1,("This should be an oid what is going on? ")); -+ } -+ } -+ -+ if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { -+ cFYI(1, -+ ("Error decoding last part of negTokenInit exit 3")); -+ return 0; -+ } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { /* tag = 3 indicating mechListMIC */ -+ cFYI(1, -+ ("Exit 4 cls = %d con = %d tag = %d end = %p (%d)", -+ cls, con, tag, end, *end)); -+ return 0; -+ } -+ if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { -+ cFYI(1, -+ ("Error decoding last part of negTokenInit exit 5")); -+ return 0; -+ } else if ((cls != ASN1_UNI) || (con != ASN1_CON) -+ || (tag != ASN1_SEQ)) { -+ cFYI(1, -+ ("Exit 6 cls = %d con = %d tag = %d end = %p (%d)", -+ cls, con, tag, end, *end)); -+ } -+ -+ if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { -+ cFYI(1, -+ ("Error decoding last part of negTokenInit exit 7")); -+ return 0; -+ } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { -+ cFYI(1, -+ ("Exit 8 cls = %d con = %d tag = %d end = %p (%d)", -+ cls, con, tag, end, *end)); -+ return 0; -+ } -+ if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { -+ cFYI(1, -+ ("Error decoding last part of negTokenInit exit 9")); -+ return 0; -+ } else if ((cls != ASN1_UNI) || (con != ASN1_PRI) -+ || (tag != ASN1_GENSTR)) { -+ cFYI(1, -+ ("Exit 10 cls = %d con = %d tag = %d end = %p (%d)", -+ cls, con, tag, end, *end)); -+ return 0; -+ } -+ cFYI(1, ("Need to call asn1_octets_decode() function for this %s", ctx.pointer)); /* is this UTF-8 or ASCII? */ -+ } -+ -+ /* if (use_kerberos) -+ *secType = Kerberos -+ else */ -+ if (use_ntlmssp) { -+ *secType = NTLMSSP; -+ } -+ -+ return 1; -+} -diff -urN linux-2.4.29.old/fs/cifs/AUTHORS linux-2.4.29/fs/cifs/AUTHORS ---- linux-2.4.29.old/fs/cifs/AUTHORS 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/AUTHORS 2004-07-14 00:25:04.000000000 +0200 -@@ -0,0 +1,37 @@ -+Original Author -+=============== -+Steve French (sfrench@samba.org) -+ -+The author wishes to express his appreciation and thanks to: -+Andrew Tridgell (Samba team) for his early suggestions about smb/cifs VFS -+improvements. Thanks to IBM for allowing me the time and test resources to pursue -+this project. Jim McDonough from IBM (and the Samba Team) for his help. -+The IBM Linux JFS team for explaining many esoteric Linux filesystem features. -+Dave Boutcher of IBM Rochester (author of the OS/400 smb/cifs filesystem client) -+for proving years ago that a very good smb/cifs client could be done on a Unix like -+operating system. Volker Lendecke, Andrew Tridgell, Urban Widmark, John Newbigin -+and others for their work on the Linux smbfs module over the years. Thanks to -+the other members of the Storage Network Industry Association CIFS Technical -+Workgroup for their work specifying this highly complex protocol and finally -+thanks to the Samba team for their technical advice and encouragement. -+ -+Patch Contributors -+------------------ -+Zwane Mwaikambo -+Andi Kleen -+Amrut Joshi -+Shobhit Dayal -+Sergey Vlasov -+Richard Hughes -+Yury Umanets -+ -+Test case and Bug Report contributors -+------------------------------------- -+Thanks to those in the community who have submitted detailed bug reports -+and debug of problems they have found: Jochen Dolze, David Blaine, -+Rene Scharfe, Martin Josefsson, Alexander Wild, Anthony Liguori, -+Lars Muller, Urban Widmark, Massimiliano Ferrero, Howard Owen, -+Olaf Kirch, Kieron Briggs, Nick Millington and others. -+ -+And thanks to the IBM LTC and Power test teams and SuSE testers for -+finding multiple bugs during excellent stress test runs. -diff -urN linux-2.4.29.old/fs/cifs/CHANGES linux-2.4.29/fs/cifs/CHANGES ---- linux-2.4.29.old/fs/cifs/CHANGES 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/CHANGES 2004-07-14 00:25:04.000000000 +0200 -@@ -0,0 +1,572 @@ -+Version 1.20 -+------------ -+Make transaction counts more consistent. Merge /proc/fs/cifs/SimultaneousOps -+info into /proc/fs/cifs/DebugData. Fix oops in rare oops in readdir -+(in build_wildcard_path_from_dentry). Fix mknod to pass type field -+(block/char/fifo) properly. Remove spurious mount warning log entry when -+credentials passed as mount argument. Set major/minor device number in -+inode for block and char devices when unix extensions enabled. -+ -+Version 1.19 -+------------ -+Fix /proc/fs/cifs/Stats and DebugData display to handle larger -+amounts of return data. Properly limit requests to MAX_REQ (50 -+is the usual maximum active multiplex SMB/CIFS requests per server). -+Do not kill cifsd (and thus hurt the other SMB session) when more than one -+session to the same server (but with different userids) exists and one -+of the two user's smb sessions is being removed while leaving the other. -+Do not loop reconnecting in cifsd demultiplex thread when admin -+kills the thread without going through unmount. -+ -+Version 1.18 -+------------ -+Do not rename hardlinked files (since that should be a noop). Flush -+cached write behind data when reopening a file after session abend, -+except when already in write. Grab per socket sem during reconnect -+to avoid oops in sendmsg if overlapping with reconnect. Do not -+reset cached inode file size on readdir for files open for write on -+client. -+ -+ -+Version 1.17 -+------------ -+Update number of blocks in file so du command is happier (in Linux a fake -+blocksize of 512 is required for calculating number of blocks in inode). -+Fix prepare write of partial pages to read in data from server if possible. -+Fix race on tcpStatus field between unmount and reconnection code, causing -+cifsd process sometimes to hang around forever. Improve out of memory -+checks in cifs_filldir -+ -+Version 1.16 -+------------ -+Fix incorrect file size in file handle based setattr on big endian hardware. -+Fix oops in build_path_from_dentry when out of memory. Add checks for invalid -+and closing file structs in writepage/partialpagewrite. Add statistics -+for each mounted share (new menuconfig option). Fix endianness problem in -+volume information displayed in /proc/fs/cifs/DebugData (only affects -+affects big endian architectures). Prevent renames while constructing -+path names for open, mkdir and rmdir. -+ -+Version 1.15 -+------------ -+Change to mempools for alloc smb request buffers and multiplex structs -+to better handle low memory problems (and potential deadlocks). -+ -+Version 1.14 -+------------ -+Fix incomplete listings of large directories on Samba servers when Unix -+extensions enabled. Fix oops when smb_buffer can not be allocated. Fix -+rename deadlock when writing out dirty pages at same time. -+ -+Version 1.13 -+------------ -+Fix open of files in which O_CREATE can cause the mode to change in -+some cases. Fix case in which retry of write overlaps file close. -+Fix PPC64 build error. Reduce excessive stack usage in smb password -+hashing. Fix overwrite of Linux user's view of file mode to Windows servers. -+ -+Version 1.12 -+------------ -+Fixes for large file copy, signal handling, socket retry, buffer -+allocation and low memory situations. -+ -+Version 1.11 -+------------ -+Better port 139 support to Windows servers (RFC1001/RFC1002 Session_Initialize) -+also now allowing support for specifying client netbiosname. NT4 support added. -+ -+Version 1.10 -+------------ -+Fix reconnection (and certain failed mounts) to properly wake up the -+blocked users thread so it does not seem hung (in some cases was blocked -+until the cifs receive timeout expired). Fix spurious error logging -+to kernel log when application with open network files killed. -+ -+Version 1.09 -+------------ -+Fix /proc/fs module unload warning message (that could be logged -+to the kernel log). Fix intermittent failure in connectathon -+test7 (hardlink count not immediately refreshed in case in which -+inode metadata can be incorrectly kept cached when time near zero) -+ -+Version 1.08 -+------------ -+Allow file_mode and dir_mode (specified at mount time) to be enforced -+locally (the server already enforced its own ACLs too) for servers -+that do not report the correct mode (do not support the -+CIFS Unix Extensions). -+ -+Version 1.07 -+------------ -+Fix some small memory leaks in some unmount error paths. Fix major leak -+of cache pages in readpages causing multiple read oriented stress -+testcases (including fsx, and even large file copy) to fail over time. -+ -+Version 1.06 -+------------ -+Send NTCreateX with ATTR_POSIX if Linux/Unix extensions negotiated with server. -+This allows files that differ only in case and improves performance of file -+creation and file open to such servers. Fix semaphore conflict which causes -+slow delete of open file to Samba (which unfortunately can cause an oplock -+break to self while vfs_unlink held i_sem) which can hang for 20 seconds. -+ -+Version 1.05 -+------------ -+fixes to cifs_readpages for fsx test case -+ -+Version 1.04 -+------------ -+Fix caching data integrity bug when extending file size especially when no -+oplock on file. Fix spurious logging of valid already parsed mount options -+that are parsed outside of the cifs vfs such as nosuid. -+ -+ -+Version 1.03 -+------------ -+Connect to server when port number override not specified, and tcp port -+unitialized. Reset search to restart at correct file when kernel routine -+filldir returns error during large directory searches (readdir). -+ -+Version 1.02 -+------------ -+Fix caching problem when files opened by multiple clients in which -+page cache could contain stale data, and write through did -+not occur often enough while file was still open when read ahead -+(read oplock) not allowed. Treat "sep=" when first mount option -+as an overrride of comma as the default separator between mount -+options. -+ -+Version 1.01 -+------------ -+Allow passwords longer than 16 bytes. Allow null password string. -+ -+Version 1.00 -+------------ -+Gracefully clean up failed mounts when attempting to mount to servers such as -+Windows 98 that terminate tcp sessions during prototocol negotiation. Handle -+embedded commas in mount parsing of passwords. -+ -+Version 0.99 -+------------ -+Invalidate local inode cached pages on oplock break and when last file -+instance is closed so that the client does not continue using stale local -+copy rather than later modified server copy of file. Do not reconnect -+when server drops the tcp session prematurely before negotiate -+protocol response. Fix oops in roepen_file when dentry freed. Allow -+the support for CIFS Unix Extensions to be disabled via proc interface. -+ -+Version 0.98 -+------------ -+Fix hang in commit_write during reconnection of open files under heavy load. -+Fix unload_nls oops in a mount failure path. Serialize writes to same socket -+which also fixes any possible races when cifs signatures are enabled in SMBs -+being sent out of signature sequence number order. -+ -+Version 0.97 -+------------ -+Fix byte range locking bug (endian problem) causing bad offset and -+length. -+ -+Version 0.96 -+------------ -+Fix oops (in send_sig) caused by CIFS unmount code trying to -+wake up the demultiplex thread after it had exited. Do not log -+error on harmless oplock release of closed handle. -+ -+Version 0.95 -+------------ -+Fix unsafe global variable usage and password hash failure on gcc 3.3.1 -+Fix problem reconnecting secondary mounts to same server after session -+failure. Fix invalid dentry - race in mkdir when directory gets created -+by another client between the lookup and mkdir. -+ -+Version 0.94 -+------------ -+Fix to list processing in reopen_files. Fix reconnection when server hung -+but tcpip session still alive. Set proper timeout on socket read. -+ -+Version 0.93 -+------------ -+Add missing mount options including iocharset. SMP fixes in write and open. -+Fix errors in reconnecting after TCP session failure. Fix module unloading -+of default nls codepage -+ -+Version 0.92 -+------------ -+Active smb transactions should never go negative (fix double FreeXid). Fix -+list processing in file routines. Check return code on kmalloc in open. -+Fix spinlock usage for SMP. -+ -+Version 0.91 -+------------ -+Fix oops in reopen_files when invalid dentry. drop dentry on server rename -+and on revalidate errors. Fix cases where pid is now tgid. Fix return code -+on create hard link when server does not support them. -+ -+Version 0.90 -+------------ -+Fix scheduling while atomic error in getting inode info on newly created file. -+Fix truncate of existing files opened with O_CREAT but not O_TRUNC set. -+ -+Version 0.89 -+------------ -+Fix oops on write to dead tcp session. Remove error log write for case when file open -+O_CREAT but not O_EXCL -+ -+Version 0.88 -+------------ -+Fix non-POSIX behavior on rename of open file and delete of open file by taking -+advantage of trans2 SetFileInfo rename facility if available on target server. -+Retry on ENOSPC and EAGAIN socket errors. -+ -+Version 0.87 -+------------ -+Fix oops on big endian readdir. Set blksize to be even power of two (2**blkbits) to fix -+allocation size miscalculation. After oplock token lost do not read through -+cache. -+ -+Version 0.86 -+------------ -+Fix oops on empty file readahead. Fix for file size handling for locally cached files. -+ -+Version 0.85 -+------------ -+Fix oops in mkdir when server fails to return inode info. Fix oops in reopen_files -+during auto reconnection to server after server recovered from failure. -+ -+Version 0.84 -+------------ -+Finish support for Linux 2.5 open/create changes, which removes the -+redundant NTCreate/QPathInfo/close that was sent during file create. -+Enable oplock by default. Enable packet signing by default (needed to -+access many recent Windows servers) -+ -+Version 0.83 -+------------ -+Fix oops when mounting to long server names caused by inverted parms to kmalloc. -+Fix MultiuserMount (/proc/fs/cifs configuration setting) so that when enabled -+we will choose a cifs user session (smb uid) that better matches the local -+uid if a) the mount uid does not match the current uid and b) we have another -+session to the same server (ip address) for a different mount which -+matches the current local uid. -+ -+Version 0.82 -+------------ -+Add support for mknod of block or character devices. Fix oplock -+code (distributed caching) to properly send response to oplock -+break from server. -+ -+Version 0.81 -+------------ -+Finish up CIFS packet digital signing for the default -+NTLM security case. This should help Windows 2003 -+network interoperability since it is common for -+packet signing to be required now. Fix statfs (stat -f) -+which recently started returning errors due to -+invalid value (-1 instead of 0) being set in the -+struct kstatfs f_ffiles field. -+ -+Version 0.80 -+----------- -+Fix oops on stopping oplock thread when removing cifs when -+built as module. -+ -+Version 0.79 -+------------ -+Fix mount options for ro (readonly), uid, gid and file and directory mode. -+ -+Version 0.78 -+------------ -+Fix errors displayed on failed mounts to be more understandable. -+Fixed various incorrect or misleading smb to posix error code mappings. -+ -+Version 0.77 -+------------ -+Fix display of NTFS DFS junctions to display as symlinks. -+They are the network equivalent. Fix oops in -+cifs_partialpagewrite caused by missing spinlock protection -+of openfile linked list. Allow writebehind caching errors to -+be returned to the application at file close. -+ -+Version 0.76 -+------------ -+Clean up options displayed in /proc/mounts by show_options to -+be more consistent with other filesystems. -+ -+Version 0.75 -+------------ -+Fix delete of readonly file to Windows servers. Reflect -+presence or absence of read only dos attribute in mode -+bits for servers that do not support CIFS Unix extensions. -+Fix shortened results on readdir of large directories to -+servers supporting CIFS Unix extensions (caused by -+incorrect resume key). -+ -+Version 0.74 -+------------ -+Fix truncate bug (set file size) that could cause hangs e.g. running fsx -+ -+Version 0.73 -+------------ -+unload nls if mount fails. -+ -+Version 0.72 -+------------ -+Add resume key support to search (readdir) code to workaround -+Windows bug. Add /proc/fs/cifs/LookupCacheEnable which -+allows disabling caching of attribute information for -+lookups. -+ -+Version 0.71 -+------------ -+Add more oplock handling (distributed caching code). Remove -+dead code. Remove excessive stack space utilization from -+symlink routines. -+ -+Version 0.70 -+------------ -+Fix oops in get dfs referral (triggered when null path sent in to -+mount). Add support for overriding rsize at mount time. -+ -+Version 0.69 -+------------ -+Fix buffer overrun in readdir which caused intermittent kernel oopses. -+Fix writepage code to release kmap on write data. Allow "-ip=" new -+mount option to be passed in on parameter distinct from the first part -+(server name portion of) the UNC name. Allow override of the -+tcp port of the target server via new mount option "-port=" -+ -+Version 0.68 -+------------ -+Fix search handle leak on rewind. Fix setuid and gid so that they are -+reflected in the local inode immediately. Cleanup of whitespace -+to make 2.4 and 2.5 versions more consistent. -+ -+ -+Version 0.67 -+------------ -+Fix signal sending so that captive thread (cifsd) exits on umount -+(which was causing the warning in kmem_cache_free of the request buffers -+at rmmod time). This had broken as a sideeffect of the recent global -+kernel change to daemonize. Fix memory leak in readdir code which -+showed up in "ls -R" (and applications that did search rewinding). -+ -+Version 0.66 -+------------ -+Reconnect tids and fids after session reconnection (still do not -+reconnect byte range locks though). Fix problem caching -+lookup information for directory inodes, improving performance, -+especially in deep directory trees. Fix various build warnings. -+ -+Version 0.65 -+------------ -+Finish fixes to commit write for caching/readahead consistency. fsx -+now works to Samba servers. Fix oops caused when readahead -+was interrupted by a signal. -+ -+Version 0.64 -+------------ -+Fix data corruption (in partial page after truncate) that caused fsx to -+fail to Windows servers. Cleaned up some extraneous error logging in -+common error paths. Add generic sendfile support. -+ -+Version 0.63 -+------------ -+Fix memory leak in AllocMidQEntry. -+Finish reconnection logic, so connection with server can be dropped -+(or server rebooted) and the cifs client will reconnect. -+ -+Version 0.62 -+------------ -+Fix temporary socket leak when bad userid or password specified -+(or other SMBSessSetup failure). Increase maximum buffer size to slightly -+over 16K to allow negotiation of up to Samba and Windows server default read -+sizes. Add support for readpages -+ -+Version 0.61 -+------------ -+Fix oops when username not passed in on mount. Extensive fixes and improvements -+to error logging (strip redundant newlines, change debug macros to ensure newline -+passed in and to be more consistent). Fix writepage wrong file handle problem, -+a readonly file handle could be incorrectly used to attempt to write out -+file updates through the page cache to multiply open files. This could cause -+the iozone benchmark to fail on the fwrite test. Fix bug mounting two different -+shares to the same Windows server when using different usernames -+(doing this to Samba servers worked but Windows was rejecting it) - now it is -+possible to use different userids when connecting to the same server from a -+Linux client. Fix oops when treeDisconnect called during unmount on -+previously freed socket. -+ -+Version 0.60 -+------------ -+Fix oops in readpages caused by not setting address space operations in inode in -+rare code path. -+ -+Version 0.59 -+------------ -+Includes support for deleting of open files and renaming over existing files (per POSIX -+requirement). Add readlink support for Windows junction points (directory symlinks). -+ -+Version 0.58 -+------------ -+Changed read and write to go through pagecache. Added additional address space operations. -+Memory mapped operations now working. -+ -+Version 0.57 -+------------ -+Added writepage code for additional memory mapping support. Fixed leak in xids causing -+the simultaneous operations counter (/proc/fs/cifs/SimultaneousOps) to increase on -+every stat call. Additional formatting cleanup. -+ -+Version 0.56 -+------------ -+Fix bigendian bug in order of time conversion. Merge 2.5 to 2.4 version. Formatting cleanup. -+ -+Version 0.55 -+------------ -+Fixes from Zwane Mwaikambo for adding missing return code checking in a few places. -+Also included a modified version of his fix to protect global list manipulation of -+the smb session and tree connection and mid related global variables. -+ -+Version 0.54 -+------------ -+Fix problem with captive thread hanging around at unmount time. Adjust to 2.5.42-pre -+changes to superblock layout. Remove wasteful allocation of smb buffers (now the send -+buffer is reused for responses). Add more oplock handling. Additional minor cleanup. -+ -+Version 0.53 -+------------ -+More stylistic updates to better match kernel style. Add additional statistics -+for filesystem which can be viewed via /proc/fs/cifs. Add more pieces of NTLMv2 -+and CIFS Packet Signing enablement. -+ -+Version 0.52 -+------------ -+Replace call to sleep_on with safer wait_on_event. -+Make stylistic changes to better match kernel style recommendations. -+Remove most typedef usage (except for the PDUs themselves). -+ -+Version 0.51 -+------------ -+Update mount so the -unc mount option is no longer required (the ip address can be specified -+in a UNC style device name. Implementation of readpage/writepage started. -+ -+Version 0.50 -+------------ -+Fix intermittent problem with incorrect smb header checking on badly -+fragmented tcp responses -+ -+Version 0.49 -+------------ -+Fixes to setting of allocation size and file size. -+ -+Version 0.48 -+------------ -+Various 2.5.38 fixes. Now works on 2.5.38 -+ -+Version 0.47 -+------------ -+Prepare for 2.5 kernel merge. Remove ifdefs. -+ -+Version 0.46 -+------------ -+Socket buffer management fixes. Fix dual free. -+ -+Version 0.45 -+------------ -+Various big endian fixes for hardlinks and symlinks and also for dfs. -+ -+Version 0.44 -+------------ -+Various big endian fixes for servers with Unix extensions such as Samba -+ -+Version 0.43 -+------------ -+Various FindNext fixes for incorrect filenames on large directory searches on big endian -+clients. basic posix file i/o tests now work on big endian machines, not just le -+ -+Version 0.42 -+------------ -+SessionSetup and NegotiateProtocol now work from Big Endian machines. -+Various Big Endian fixes found during testing on the Linux on 390. Various fixes for compatibility with older -+versions of 2.4 kernel (now builds and works again on kernels at least as early as 2.4.7). -+ -+Version 0.41 -+------------ -+Various minor fixes for Connectathon Posix "basic" file i/o test suite. Directory caching fixed so hardlinked -+files now return the correct rumber of links on fstat as they are repeatedly linked and unlinked. -+ -+Version 0.40 -+------------ -+Implemented "Raw" (i.e. not encapsulated in SPNEGO) NTLMSSP (i.e. the Security Provider Interface used to negotiate -+session advanced session authentication). Raw NTLMSSP is preferred by Windows 2000 Professional and Windows XP. -+Began implementing support for SPNEGO encapsulation of NTLMSSP based session authentication blobs -+(which is the mechanism preferred by Windows 2000 server in the absence of Kerberos). -+ -+Version 0.38 -+------------ -+Introduced optional mount helper utility mount.cifs and made coreq changes to cifs vfs to enable -+it. Fixed a few bugs in the DFS code (e.g. bcc two bytes too short and incorrect uid in PDU). -+ -+Version 0.37 -+------------ -+Rewrote much of connection and mount/unmount logic to handle bugs with -+multiple uses to same share, multiple users to same server etc. -+ -+Version 0.36 -+------------ -+Fixed major problem with dentry corruption (missing call to dput) -+ -+Version 0.35 -+------------ -+Rewrite of readdir code to fix bug. Various fixes for bigendian machines. -+Begin adding oplock support. Multiusermount and oplockEnabled flags added to /proc/fs/cifs -+although corresponding function not fully implemented in the vfs yet -+ -+Version 0.34 -+------------ -+Fixed dentry caching bug, misc. cleanup -+ -+Version 0.33 -+------------ -+Fixed 2.5 support to handle build and configure changes as well as misc. 2.5 changes. Now can build -+on current 2.5 beta version (2.5.24) of the Linux kernel as well as on 2.4 Linux kernels. -+Support for STATUS codes (newer 32 bit NT error codes) added. DFS support begun to be added. -+ -+Version 0.32 -+------------ -+Unix extensions (symlink, readlink, hardlink, chmod and some chgrp and chown) implemented -+and tested against Samba 2.2.5 -+ -+ -+Version 0.31 -+------------ -+1) Fixed lockrange to be correct (it was one byte too short) -+ -+2) Fixed GETLK (i.e. the fcntl call to test a range of bytes in a file to see if locked) to correctly -+show range as locked when there is a conflict with an existing lock. -+ -+3) default file perms are now 2767 (indicating support for mandatory locks) instead of 777 for directories -+in most cases. Eventually will offer optional ability to query server for the correct perms. -+ -+3) Fixed eventual trap when mounting twice to different shares on the same server when the first succeeded -+but the second one was invalid and failed (the second one was incorrectly disconnecting the tcp and smb -+session) -+ -+4) Fixed error logging of valid mount options -+ -+5) Removed logging of password field. -+ -+6) Moved negotiate, treeDisconnect and uloggoffX (only tConx and SessSetup remain in connect.c) to cifssmb.c -+and cleaned them up and made them more consistent with other cifs functions. -+ -+7) Server support for Unix extensions is now fully detected and FindFirst is implemented both ways -+(with or without Unix exentions) but FindNext and QueryPathInfo with the Unix extensions are not completed, -+nor is the symlink support using the Unix extensions -+ -+8) Started adding the readlink and follow_link code -+ -+Version 0.3 -+----------- -+Initial drop -+ -diff -urN linux-2.4.29.old/fs/cifs/cifs_debug.c linux-2.4.29/fs/cifs/cifs_debug.c ---- linux-2.4.29.old/fs/cifs/cifs_debug.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/cifs_debug.c 2004-07-14 00:25:04.000000000 +0200 -@@ -0,0 +1,797 @@ -+/* -+ * fs/cifs_debug.c -+ * -+ * Copyright (C) International Business Machines Corp., 2000,2003 -+ * -+ * Modified by Steve French (sfrench@us.ibm.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 -+#include -+#include -+#include -+#include -+#include -+#include "cifspdu.h" -+#include "cifsglob.h" -+#include "cifsproto.h" -+#include "cifs_debug.h" -+ -+void -+cifs_dump_mem(char *label, void *data, int length) -+{ -+ int i, j; -+ int *intptr = data; -+ char *charptr = data; -+ char buf[10], line[80]; -+ -+ printk(KERN_DEBUG "%s: dump of %d bytes of data at 0x%p\n\n", -+ label, length, data); -+ for (i = 0; i < length; i += 16) { -+ line[0] = 0; -+ for (j = 0; (j < 4) && (i + j * 4 < length); j++) { -+ sprintf(buf, " %08x", intptr[i / 4 + j]); -+ strcat(line, buf); -+ } -+ buf[0] = ' '; -+ buf[2] = 0; -+ for (j = 0; (j < 16) && (i + j < length); j++) { -+ buf[1] = isprint(charptr[i + j]) ? charptr[i + j] : '.'; -+ strcat(line, buf); -+ } -+ printk(KERN_DEBUG "%s\n", line); -+ } -+} -+ -+#ifdef CONFIG_PROC_FS -+int -+cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset, -+ int count, int *eof, void *data) -+{ -+ struct list_head *tmp; -+ struct list_head *tmp1; -+ struct mid_q_entry * mid_entry; -+ struct cifsSesInfo *ses; -+ struct cifsTconInfo *tcon; -+ int i; -+ int length = 0; -+ char * original_buf = buf; -+ -+ *beginBuffer = buf + offset; -+ -+ -+ length = -+ sprintf(buf, -+ "Display Internal CIFS Data Structures for Debugging\n" -+ "---------------------------------------------------\n"); -+ buf += length; -+ -+ length = sprintf(buf, "Servers:\n"); -+ buf += length; -+ -+ i = 0; -+ read_lock(&GlobalSMBSeslock); -+ list_for_each(tmp, &GlobalSMBSessionList) { -+ i++; -+ ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList); -+ length = -+ sprintf(buf, -+ "\n%d) Name: %s Domain: %s Mounts: %d ServerOS: %s \n\tServerNOS: %s\tCapabilities: 0x%x\n\tSMB session status: %d\tTCP status: %d", -+ i, ses->serverName, ses->serverDomain, atomic_read(&ses->inUse), -+ ses->serverOS, ses->serverNOS, ses->capabilities,ses->status,ses->server->tcpStatus); -+ buf += length; -+ if(ses->server) { -+ buf += sprintf(buf, "\n\tLocal Users To Server: %d SecMode: 0x%x Req Active: %d", -+ atomic_read(&ses->server->socketUseCount), -+ ses->server->secMode, -+ atomic_read(&ses->server->inFlight)); -+ -+ length = sprintf(buf, "\nMIDs: \n"); -+ buf += length; -+ -+ spin_lock(&GlobalMid_Lock); -+ list_for_each(tmp1, &ses->server->pending_mid_q) { -+ mid_entry = list_entry(tmp1, struct -+ mid_q_entry, -+ qhead); -+ if(mid_entry) { -+ length = sprintf(buf,"State: %d com: %d pid: %d tsk: %p mid %d\n",mid_entry->midState,mid_entry->command,mid_entry->pid,mid_entry->tsk,mid_entry->mid); -+ buf += length; -+ } -+ } -+ spin_unlock(&GlobalMid_Lock); -+ } -+ -+ } -+ read_unlock(&GlobalSMBSeslock); -+ sprintf(buf, "\n"); -+ buf++; -+ -+ length = sprintf(buf, "\nShares:\n"); -+ buf += length; -+ -+ i = 0; -+ read_lock(&GlobalSMBSeslock); -+ list_for_each(tmp, &GlobalTreeConnectionList) { -+ i++; -+ tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); -+ length = -+ sprintf(buf, -+ "\n%d) %s Uses: %d Type: %s Characteristics: 0x%x Attributes: 0x%x\nPathComponentMax: %d Status: %d", -+ i, tcon->treeName, -+ atomic_read(&tcon->useCount), -+ tcon->nativeFileSystem, -+ tcon->fsDevInfo.DeviceCharacteristics, -+ tcon->fsAttrInfo.Attributes, -+ tcon->fsAttrInfo.MaxPathNameComponentLength,tcon->tidStatus); -+ buf += length; -+ if (tcon->fsDevInfo.DeviceType == FILE_DEVICE_DISK) -+ length = sprintf(buf, " type: DISK "); -+ else if (tcon->fsDevInfo.DeviceType == FILE_DEVICE_CD_ROM) -+ length = sprintf(buf, " type: CDROM "); -+ else -+ length = -+ sprintf(buf, " type: %d ", -+ tcon->fsDevInfo.DeviceType); -+ buf += length; -+ if(tcon->tidStatus == CifsNeedReconnect) { -+ buf += sprintf(buf, "\tDISCONNECTED "); -+ length += 14; -+ } -+ } -+ read_unlock(&GlobalSMBSeslock); -+ -+ length = sprintf(buf, "\n"); -+ buf += length; -+ -+ /* BB add code to dump additional info such as TCP session info now */ -+ /* Now calculate total size of returned data */ -+ length = buf - original_buf; -+ -+ if(offset + count >= length) -+ *eof = 1; -+ if(length < offset) { -+ *eof = 1; -+ return 0; -+ } else { -+ length = length - offset; -+ } -+ if (length > count) -+ length = count; -+ -+ return length; -+} -+ -+#ifdef CONFIG_CIFS_STATS -+int -+cifs_stats_read(char *buf, char **beginBuffer, off_t offset, -+ int count, int *eof, void *data) -+{ -+ int item_length,i,length; -+ struct list_head *tmp; -+ struct cifsTconInfo *tcon; -+ -+ *beginBuffer = buf + offset; -+ -+ length = sprintf(buf, -+ "Resources in use\nCIFS Session: %d\n", -+ sesInfoAllocCount.counter); -+ buf += length; -+ item_length = -+ sprintf(buf,"Share (unique mount targets): %d\n", -+ tconInfoAllocCount.counter); -+ length += item_length; -+ buf += item_length; -+ item_length = -+ sprintf(buf,"SMB Request/Response Buffer: %d\n", -+ bufAllocCount.counter); -+ length += item_length; -+ buf += item_length; -+ item_length = -+ sprintf(buf,"Operations (MIDs): %d\n", -+ midCount.counter); -+ length += item_length; -+ buf += item_length; -+ item_length = sprintf(buf, -+ "\n%d session %d share reconnects\n", -+ tcpSesReconnectCount.counter,tconInfoReconnectCount.counter); -+ length += item_length; -+ buf += item_length; -+ -+ item_length = sprintf(buf, -+ "Total vfs operations: %d maximum at one time: %d\n", -+ GlobalCurrentXid,GlobalMaxActiveXid); -+ length += item_length; -+ buf += item_length; -+ -+ i = 0; -+ read_lock(&GlobalSMBSeslock); -+ list_for_each(tmp, &GlobalTreeConnectionList) { -+ i++; -+ tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); -+ item_length = sprintf(buf,"\n%d) %s",i, tcon->treeName); -+ buf += item_length; -+ length += item_length; -+ if(tcon->tidStatus == CifsNeedReconnect) { -+ buf += sprintf(buf, "\tDISCONNECTED "); -+ length += 14; -+ } -+ item_length = sprintf(buf,"\nSMBs: %d Oplock Breaks: %d", -+ atomic_read(&tcon->num_smbs_sent), -+ atomic_read(&tcon->num_oplock_brks)); -+ buf += item_length; -+ length += item_length; -+ item_length = sprintf(buf,"\nReads: %d Bytes %lld", -+ atomic_read(&tcon->num_reads), -+ (long long)(tcon->bytes_read)); -+ buf += item_length; -+ length += item_length; -+ item_length = sprintf(buf,"\nWrites: %d Bytes: %lld", -+ atomic_read(&tcon->num_writes), -+ (long long)(tcon->bytes_written)); -+ buf += item_length; -+ length += item_length; -+ item_length = sprintf(buf, -+ "\nOpens: %d Deletes: %d\nMkdirs: %d Rmdirs: %d", -+ atomic_read(&tcon->num_opens), -+ atomic_read(&tcon->num_deletes), -+ atomic_read(&tcon->num_mkdirs), -+ atomic_read(&tcon->num_rmdirs)); -+ buf += item_length; -+ length += item_length; -+ item_length = sprintf(buf, -+ "\nRenames: %d T2 Renames %d", -+ atomic_read(&tcon->num_renames), -+ atomic_read(&tcon->num_t2renames)); -+ buf += item_length; -+ length += item_length; -+ } -+ read_unlock(&GlobalSMBSeslock); -+ -+ buf += sprintf(buf,"\n"); -+ length++; -+ -+ if(offset + count >= length) -+ *eof = 1; -+ if(length < offset) { -+ *eof = 1; -+ return 0; -+ } else { -+ length = length - offset; -+ } -+ if (length > count) -+ length = count; -+ -+ return length; -+} -+#endif -+ -+struct proc_dir_entry *proc_fs_cifs; -+read_proc_t cifs_txanchor_read; -+static read_proc_t cifsFYI_read; -+static write_proc_t cifsFYI_write; -+static read_proc_t oplockEnabled_read; -+static write_proc_t oplockEnabled_write; -+static read_proc_t lookupFlag_read; -+static write_proc_t lookupFlag_write; -+static read_proc_t traceSMB_read; -+static write_proc_t traceSMB_write; -+static read_proc_t multiuser_mount_read; -+static write_proc_t multiuser_mount_write; -+static read_proc_t extended_security_read; -+static write_proc_t extended_security_write; -+static read_proc_t ntlmv2_enabled_read; -+static write_proc_t ntlmv2_enabled_write; -+static read_proc_t packet_signing_enabled_read; -+static write_proc_t packet_signing_enabled_write; -+static read_proc_t quotaEnabled_read; -+static write_proc_t quotaEnabled_write; -+static read_proc_t linuxExtensionsEnabled_read; -+static write_proc_t linuxExtensionsEnabled_write; -+ -+void -+cifs_proc_init(void) -+{ -+ struct proc_dir_entry *pde; -+ -+ proc_fs_cifs = proc_mkdir("cifs", proc_root_fs); -+ if (proc_fs_cifs == NULL) -+ return; -+ -+ proc_fs_cifs->owner = THIS_MODULE; -+ create_proc_read_entry("DebugData", 0, proc_fs_cifs, -+ cifs_debug_data_read, NULL); -+ -+#ifdef CONFIG_CIFS_STATS -+ create_proc_read_entry("Stats", 0, proc_fs_cifs, -+ cifs_stats_read, NULL); -+#endif -+ pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs, -+ cifsFYI_read, NULL); -+ if (pde) -+ pde->write_proc = cifsFYI_write; -+ -+ pde = -+ create_proc_read_entry("traceSMB", 0, proc_fs_cifs, -+ traceSMB_read, NULL); -+ if (pde) -+ pde->write_proc = traceSMB_write; -+ -+ pde = create_proc_read_entry("OplockEnabled", 0, proc_fs_cifs, -+ oplockEnabled_read, NULL); -+ if (pde) -+ pde->write_proc = oplockEnabled_write; -+ -+ pde = create_proc_read_entry("QuotaEnabled", 0, proc_fs_cifs, -+ quotaEnabled_read, NULL); -+ if (pde) -+ pde->write_proc = quotaEnabled_write; -+ -+ pde = create_proc_read_entry("LinuxExtensionsEnabled", 0, proc_fs_cifs, -+ linuxExtensionsEnabled_read, NULL); -+ if (pde) -+ pde->write_proc = linuxExtensionsEnabled_write; -+ -+ pde = -+ create_proc_read_entry("MultiuserMount", 0, proc_fs_cifs, -+ multiuser_mount_read, NULL); -+ if (pde) -+ pde->write_proc = multiuser_mount_write; -+ -+ pde = -+ create_proc_read_entry("ExtendedSecurity", 0, proc_fs_cifs, -+ extended_security_read, NULL); -+ if (pde) -+ pde->write_proc = extended_security_write; -+ -+ pde = -+ create_proc_read_entry("LookupCacheEnabled", 0, proc_fs_cifs, -+ lookupFlag_read, NULL); -+ if (pde) -+ pde->write_proc = lookupFlag_write; -+ -+ pde = -+ create_proc_read_entry("NTLMV2Enabled", 0, proc_fs_cifs, -+ ntlmv2_enabled_read, NULL); -+ if (pde) -+ pde->write_proc = ntlmv2_enabled_write; -+ -+ pde = -+ create_proc_read_entry("PacketSigningEnabled", 0, proc_fs_cifs, -+ packet_signing_enabled_read, NULL); -+ if (pde) -+ pde->write_proc = packet_signing_enabled_write; -+} -+ -+void -+cifs_proc_clean(void) -+{ -+ if (proc_fs_cifs == NULL) -+ return; -+ -+ remove_proc_entry("DebugData", proc_fs_cifs); -+ remove_proc_entry("cifsFYI", proc_fs_cifs); -+ remove_proc_entry("traceSMB", proc_fs_cifs); -+#ifdef CONFIG_CIFS_STATS -+ remove_proc_entry("Stats", proc_fs_cifs); -+#endif -+ remove_proc_entry("MultiuserMount", proc_fs_cifs); -+ remove_proc_entry("OplockEnabled", proc_fs_cifs); -+ remove_proc_entry("NTLMV2Enabled",proc_fs_cifs); -+ remove_proc_entry("ExtendedSecurity",proc_fs_cifs); -+ remove_proc_entry("PacketSigningEnabled",proc_fs_cifs); -+ remove_proc_entry("LinuxExtensionsEnabled",proc_fs_cifs); -+ remove_proc_entry("QuotaEnabled",proc_fs_cifs); -+ remove_proc_entry("LookupCacheEnabled",proc_fs_cifs); -+ remove_proc_entry("cifs", proc_root_fs); -+} -+ -+static int -+cifsFYI_read(char *page, char **start, off_t off, int count, -+ int *eof, void *data) -+{ -+ int len; -+ -+ len = sprintf(page, "%d\n", cifsFYI); -+ -+ len -= off; -+ *start = page + off; -+ -+ if (len > count) -+ len = count; -+ else -+ *eof = 1; -+ -+ if (len < 0) -+ len = 0; -+ -+ return len; -+} -+static int -+cifsFYI_write(struct file *file, const char *buffer, -+ unsigned long count, void *data) -+{ -+ char c; -+ int rc; -+ -+ rc = get_user(c, buffer); -+ if (rc) -+ return rc; -+ if (c == '0' || c == 'n' || c == 'N') -+ cifsFYI = 0; -+ else if (c == '1' || c == 'y' || c == 'Y') -+ cifsFYI = 1; -+ -+ return count; -+} -+ -+static int -+oplockEnabled_read(char *page, char **start, off_t off, -+ int count, int *eof, void *data) -+{ -+ int len; -+ -+ len = sprintf(page, "%d\n", oplockEnabled); -+ -+ len -= off; -+ *start = page + off; -+ -+ if (len > count) -+ len = count; -+ else -+ *eof = 1; -+ -+ if (len < 0) -+ len = 0; -+ -+ return len; -+} -+static int -+oplockEnabled_write(struct file *file, const char *buffer, -+ unsigned long count, void *data) -+{ -+ char c; -+ int rc; -+ -+ rc = get_user(c, buffer); -+ if (rc) -+ return rc; -+ if (c == '0' || c == 'n' || c == 'N') -+ oplockEnabled = 0; -+ else if (c == '1' || c == 'y' || c == 'Y') -+ oplockEnabled = 1; -+ -+ return count; -+} -+ -+static int -+quotaEnabled_read(char *page, char **start, off_t off, -+ int count, int *eof, void *data) -+{ -+ int len; -+ -+ len = sprintf(page, "%d\n", quotaEnabled); -+/* could also check if quotas are enabled in kernel -+ as a whole first */ -+ len -= off; -+ *start = page + off; -+ -+ if (len > count) -+ len = count; -+ else -+ *eof = 1; -+ -+ if (len < 0) -+ len = 0; -+ -+ return len; -+} -+static int -+quotaEnabled_write(struct file *file, const char *buffer, -+ unsigned long count, void *data) -+{ -+ char c; -+ int rc; -+ -+ rc = get_user(c, buffer); -+ if (rc) -+ return rc; -+ if (c == '0' || c == 'n' || c == 'N') -+ quotaEnabled = 0; -+ else if (c == '1' || c == 'y' || c == 'Y') -+ quotaEnabled = 1; -+ -+ return count; -+} -+ -+static int -+linuxExtensionsEnabled_read(char *page, char **start, off_t off, -+ int count, int *eof, void *data) -+{ -+ int len; -+ -+ len = sprintf(page, "%d\n", linuxExtEnabled); -+/* could also check if quotas are enabled in kernel -+ as a whole first */ -+ len -= off; -+ *start = page + off; -+ -+ if (len > count) -+ len = count; -+ else -+ *eof = 1; -+ -+ if (len < 0) -+ len = 0; -+ -+ return len; -+} -+static int -+linuxExtensionsEnabled_write(struct file *file, const char *buffer, -+ unsigned long count, void *data) -+{ -+ char c; -+ int rc; -+ -+ rc = get_user(c, buffer); -+ if (rc) -+ return rc; -+ if (c == '0' || c == 'n' || c == 'N') -+ linuxExtEnabled = 0; -+ else if (c == '1' || c == 'y' || c == 'Y') -+ linuxExtEnabled = 1; -+ -+ return count; -+} -+ -+ -+static int -+lookupFlag_read(char *page, char **start, off_t off, -+ int count, int *eof, void *data) -+{ -+ int len; -+ -+ len = sprintf(page, "%d\n", lookupCacheEnabled); -+ -+ len -= off; -+ *start = page + off; -+ -+ if (len > count) -+ len = count; -+ else -+ *eof = 1; -+ -+ if (len < 0) -+ len = 0; -+ -+ return len; -+} -+static int -+lookupFlag_write(struct file *file, const char *buffer, -+ unsigned long count, void *data) -+{ -+ char c; -+ int rc; -+ -+ rc = get_user(c, buffer); -+ if (rc) -+ return rc; -+ if (c == '0' || c == 'n' || c == 'N') -+ lookupCacheEnabled = 0; -+ else if (c == '1' || c == 'y' || c == 'Y') -+ lookupCacheEnabled = 1; -+ -+ return count; -+} -+static int -+traceSMB_read(char *page, char **start, off_t off, int count, -+ int *eof, void *data) -+{ -+ int len; -+ -+ len = sprintf(page, "%d\n", traceSMB); -+ -+ len -= off; -+ *start = page + off; -+ -+ if (len > count) -+ len = count; -+ else -+ *eof = 1; -+ -+ if (len < 0) -+ len = 0; -+ -+ return len; -+} -+static int -+traceSMB_write(struct file *file, const char *buffer, -+ unsigned long count, void *data) -+{ -+ char c; -+ int rc; -+ -+ rc = get_user(c, buffer); -+ if (rc) -+ return rc; -+ if (c == '0' || c == 'n' || c == 'N') -+ traceSMB = 0; -+ else if (c == '1' || c == 'y' || c == 'Y') -+ traceSMB = 1; -+ -+ return count; -+} -+ -+static int -+multiuser_mount_read(char *page, char **start, off_t off, -+ int count, int *eof, void *data) -+{ -+ int len; -+ -+ len = sprintf(page, "%d\n", multiuser_mount); -+ -+ len -= off; -+ *start = page + off; -+ -+ if (len > count) -+ len = count; -+ else -+ *eof = 1; -+ -+ if (len < 0) -+ len = 0; -+ -+ return len; -+} -+static int -+multiuser_mount_write(struct file *file, const char *buffer, -+ unsigned long count, void *data) -+{ -+ char c; -+ int rc; -+ -+ rc = get_user(c, buffer); -+ if (rc) -+ return rc; -+ if (c == '0' || c == 'n' || c == 'N') -+ multiuser_mount = 0; -+ else if (c == '1' || c == 'y' || c == 'Y') -+ multiuser_mount = 1; -+ -+ return count; -+} -+ -+static int -+extended_security_read(char *page, char **start, off_t off, -+ int count, int *eof, void *data) -+{ -+ int len; -+ -+ len = sprintf(page, "%d\n", extended_security); -+ -+ len -= off; -+ *start = page + off; -+ -+ if (len > count) -+ len = count; -+ else -+ *eof = 1; -+ -+ if (len < 0) -+ len = 0; -+ -+ return len; -+} -+static int -+extended_security_write(struct file *file, const char *buffer, -+ unsigned long count, void *data) -+{ -+ char c; -+ int rc; -+ -+ rc = get_user(c, buffer); -+ if (rc) -+ return rc; -+ if (c == '0' || c == 'n' || c == 'N') -+ extended_security = 0; -+ else if (c == '1' || c == 'y' || c == 'Y') -+ extended_security = 1; -+ -+ return count; -+} -+ -+static int -+ntlmv2_enabled_read(char *page, char **start, off_t off, -+ int count, int *eof, void *data) -+{ -+ int len; -+ -+ len = sprintf(page, "%d\n", ntlmv2_support); -+ -+ len -= off; -+ *start = page + off; -+ -+ if (len > count) -+ len = count; -+ else -+ *eof = 1; -+ -+ if (len < 0) -+ len = 0; -+ -+ return len; -+} -+static int -+ntlmv2_enabled_write(struct file *file, const char *buffer, -+ unsigned long count, void *data) -+{ -+ char c; -+ int rc; -+ -+ rc = get_user(c, buffer); -+ if (rc) -+ return rc; -+ if (c == '0' || c == 'n' || c == 'N') -+ ntlmv2_support = 0; -+ else if (c == '1' || c == 'y' || c == 'Y') -+ ntlmv2_support = 1; -+ -+ return count; -+} -+ -+static int -+packet_signing_enabled_read(char *page, char **start, off_t off, -+ int count, int *eof, void *data) -+{ -+ int len; -+ -+ len = sprintf(page, "%d\n", sign_CIFS_PDUs); -+ -+ len -= off; -+ *start = page + off; -+ -+ if (len > count) -+ len = count; -+ else -+ *eof = 1; -+ -+ if (len < 0) -+ len = 0; -+ -+ return len; -+} -+static int -+packet_signing_enabled_write(struct file *file, const char *buffer, -+ unsigned long count, void *data) -+{ -+ char c; -+ int rc; -+ -+ rc = get_user(c, buffer); -+ if (rc) -+ return rc; -+ if (c == '0' || c == 'n' || c == 'N') -+ sign_CIFS_PDUs = 0; -+ else if (c == '1' || c == 'y' || c == 'Y') -+ sign_CIFS_PDUs = 1; -+ else if (c == '2') -+ sign_CIFS_PDUs = 2; -+ -+ return count; -+} -+ -+ -+#endif -diff -urN linux-2.4.29.old/fs/cifs/cifs_debug.h linux-2.4.29/fs/cifs/cifs_debug.h ---- linux-2.4.29.old/fs/cifs/cifs_debug.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/cifs_debug.h 2004-07-14 00:25:04.000000000 +0200 -@@ -0,0 +1,66 @@ -+/* -+ * -+ * Copyright (c) International Business Machines Corp., 2000,2002 -+ * Modified by Steve French (sfrench@us.ibm.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 -+ * -+*/ -+#define CIFS_DEBUG /* BB temporary */ -+ -+#ifndef _H_CIFS_DEBUG -+#define _H_CIFS_DEBUG -+ -+void cifs_dump_mem(char *label, void *data, int length); -+extern int traceSMB; /* flag which enables the function below */ -+void dump_smb(struct smb_hdr *, int); -+ -+/* -+ * debug ON -+ * -------- -+ */ -+#ifdef CIFS_DEBUG -+ -+ -+/* information message: e.g., configuration, major event */ -+extern int cifsFYI; -+#define cifsfyi(format,arg...) if (cifsFYI) printk(KERN_DEBUG " " __FILE__ ": " format "\n" "" , ## arg) -+ -+#define cFYI(button,prspec) if (button) cifsfyi prspec -+ -+#define cifswarn(format, arg...) printk(KERN_WARNING ": " format "\n" , ## arg) -+ -+/* debug event message: */ -+extern int cifsERROR; -+ -+#define cEVENT(format,arg...) if (cifsERROR) printk(KERN_EVENT __FILE__ ": " format "\n" , ## arg) -+ -+/* error event message: e.g., i/o error */ -+#define cifserror(format,arg...) if (cifsERROR) printk(KERN_ERR " CIFS VFS: " format "\n" "" , ## arg) -+ -+#define cERROR(button, prspec) if (button) cifserror prspec -+ -+/* -+ * debug OFF -+ * --------- -+ */ -+#else /* _CIFS_DEBUG */ -+#define cERROR(button,prspec) -+#define cEVENT(format,arg...) -+#define cFYI(button, prspec) -+#define cifserror(format,arg...) -+#endif /* _CIFS_DEBUG */ -+ -+#endif /* _H_CIFS_DEBUG */ -diff -urN linux-2.4.29.old/fs/cifs/cifsencrypt.c linux-2.4.29/fs/cifs/cifsencrypt.c ---- linux-2.4.29.old/fs/cifs/cifsencrypt.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/cifsencrypt.c 2004-07-14 00:25:04.000000000 +0200 -@@ -0,0 +1,204 @@ -+/* -+ * fs/cifs/cifsencrypt.c -+ * -+ * Copyright (C) International Business Machines Corp., 2003 -+ * Author(s): Steve French (sfrench@us.ibm.com) -+ * -+ * This library is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This library 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 Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#include -+#include "cifspdu.h" -+#include "cifsglob.h" -+#include "cifs_debug.h" -+#include "md5.h" -+#include "cifs_unicode.h" -+ -+/* Calculate and return the CIFS signature based on the mac key and the smb pdu */ -+/* the 16 byte signature must be allocated by the caller */ -+/* Note we only use the 1st eight bytes */ -+/* Note that the smb header signature field on input contains the -+ sequence number before this function is called */ -+ -+extern void mdfour(unsigned char *out, unsigned char *in, int n); -+extern void E_md4hash(const unsigned char *passwd, unsigned char *p16); -+ -+static int cifs_calculate_signature(const struct smb_hdr * cifs_pdu, const char * key, char * signature) -+{ -+ struct MD5Context context; -+ -+ if((cifs_pdu == NULL) || (signature == NULL)) -+ return -EINVAL; -+ -+ MD5Init(&context); -+ MD5Update(&context,key,CIFS_SESSION_KEY_SIZE+16); -+ MD5Update(&context,cifs_pdu->Protocol,cifs_pdu->smb_buf_length); -+ MD5Final(signature,&context); -+ return 0; -+} -+ -+int cifs_sign_smb(struct smb_hdr * cifs_pdu, struct cifsSesInfo * ses, -+ __u32 * pexpected_response_sequence_number) -+{ -+ int rc = 0; -+ char smb_signature[20]; -+ -+ /* BB remember to initialize sequence number elsewhere and initialize mac_signing key elsewhere BB */ -+ /* BB remember to add code to save expected sequence number in midQ entry BB */ -+ -+ if((cifs_pdu == NULL) || (ses == NULL)) -+ return -EINVAL; -+ -+ if((le32_to_cpu(cifs_pdu->Flags2) & SMBFLG2_SECURITY_SIGNATURE) == 0) -+ return rc; -+ -+ spin_lock(&GlobalMid_Lock); -+ cifs_pdu->Signature.Sequence.SequenceNumber = cpu_to_le32(ses->sequence_number); -+ cifs_pdu->Signature.Sequence.Reserved = 0; -+ -+ *pexpected_response_sequence_number = ses->sequence_number++; -+ ses->sequence_number++; -+ spin_unlock(&GlobalMid_Lock); -+ -+ rc = cifs_calculate_signature(cifs_pdu, ses->mac_signing_key,smb_signature); -+ if(rc) -+ memset(cifs_pdu->Signature.SecuritySignature, 0, 8); -+ else -+ memcpy(cifs_pdu->Signature.SecuritySignature, smb_signature, 8); -+ -+ return rc; -+} -+ -+int cifs_verify_signature(struct smb_hdr * cifs_pdu, const char * mac_key, -+ __u32 expected_sequence_number) -+{ -+ unsigned int rc; -+ char server_response_sig[8]; -+ char what_we_think_sig_should_be[20]; -+ -+ if((cifs_pdu == NULL) || (mac_key == NULL)) -+ return -EINVAL; -+ -+ if (cifs_pdu->Command == SMB_COM_NEGOTIATE) -+ return 0; -+ -+ if (cifs_pdu->Command == SMB_COM_LOCKING_ANDX) { -+ struct smb_com_lock_req * pSMB = (struct smb_com_lock_req *)cifs_pdu; -+ if(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE) -+ return 0; -+ } -+ -+ /* BB what if signatures are supposed to be on for session but server does not -+ send one? BB */ -+ -+ /* Do not need to verify session setups with signature "BSRSPYL " */ -+ if(memcmp(cifs_pdu->Signature.SecuritySignature,"BSRSPYL ",8)==0) -+ cFYI(1,("dummy signature received for smb command 0x%x",cifs_pdu->Command)); -+ -+ expected_sequence_number = cpu_to_le32(expected_sequence_number); -+ -+ /* save off the origiginal signature so we can modify the smb and check -+ its signature against what the server sent */ -+ memcpy(server_response_sig,cifs_pdu->Signature.SecuritySignature,8); -+ -+ cifs_pdu->Signature.Sequence.SequenceNumber = expected_sequence_number; -+ cifs_pdu->Signature.Sequence.Reserved = 0; -+ -+ rc = cifs_calculate_signature(cifs_pdu, mac_key, -+ what_we_think_sig_should_be); -+ -+ if(rc) -+ return rc; -+ -+ -+/* cifs_dump_mem("what we think it should be: ",what_we_think_sig_should_be,16); */ -+ -+ if(memcmp(server_response_sig, what_we_think_sig_should_be, 8)) -+ return -EACCES; -+ else -+ return 0; -+ -+} -+ -+/* We fill in key by putting in 40 byte array which was allocated by caller */ -+int cifs_calculate_mac_key(char * key, const char * rn, const char * password) -+{ -+ char temp_key[16]; -+ if ((key == NULL) || (rn == NULL)) -+ return -EINVAL; -+ -+ E_md4hash(password, temp_key); -+ mdfour(key,temp_key,16); -+ memcpy(key+16,rn, CIFS_SESSION_KEY_SIZE); -+ return 0; -+} -+ -+int CalcNTLMv2_partial_mac_key(struct cifsSesInfo * ses, struct nls_table * nls_info) -+{ -+ char temp_hash[16]; -+ struct HMACMD5Context ctx; -+ char * ucase_buf; -+ wchar_t * unicode_buf; -+ unsigned int i,user_name_len,dom_name_len; -+ -+ if(ses) -+ return -EINVAL; -+ -+ E_md4hash(ses->password, temp_hash); -+ -+ hmac_md5_init_limK_to_64(temp_hash, 16, &ctx); -+ user_name_len = strlen(ses->userName); -+ if(user_name_len > MAX_USERNAME_SIZE) -+ return -EINVAL; -+ dom_name_len = strlen(ses->domainName); -+ if(dom_name_len > MAX_USERNAME_SIZE) -+ return -EINVAL; -+ -+ ucase_buf = kmalloc((MAX_USERNAME_SIZE+1), GFP_KERNEL); -+ unicode_buf = kmalloc((MAX_USERNAME_SIZE+1)*4, GFP_KERNEL); -+ -+ for(i=0;icharset2upper[(int)ses->userName[i]]; -+ ucase_buf[i] = 0; -+ user_name_len = cifs_strtoUCS(unicode_buf, ucase_buf, MAX_USERNAME_SIZE*2, nls_info); -+ unicode_buf[user_name_len] = 0; -+ user_name_len++; -+ -+ for(i=0;icharset2upper[(int)ses->domainName[i]]; -+ ucase_buf[i] = 0; -+ dom_name_len = cifs_strtoUCS(unicode_buf+user_name_len, ucase_buf, MAX_USERNAME_SIZE*2, nls_info); -+ -+ unicode_buf[user_name_len + dom_name_len] = 0; -+ hmac_md5_update((const unsigned char *) unicode_buf, -+ (user_name_len+dom_name_len)*2,&ctx); -+ -+ hmac_md5_final(ses->mac_signing_key,&ctx); -+ kfree(ucase_buf); -+ kfree(unicode_buf); -+ return 0; -+} -+void CalcNTLMv2_response(const struct cifsSesInfo * ses,char * v2_session_response) -+{ -+ struct HMACMD5Context context; -+ memcpy(v2_session_response + 8, ses->server->cryptKey,8); -+ /* gen_blob(v2_session_response + 16); */ -+ hmac_md5_init_limK_to_64(ses->mac_signing_key, 16, &context); -+ -+ hmac_md5_update(ses->server->cryptKey,8,&context); -+/* hmac_md5_update(v2_session_response+16)client thing,8,&context); */ /* BB fix */ -+ -+ hmac_md5_final(v2_session_response,&context); -+} -diff -urN linux-2.4.29.old/fs/cifs/cifserr.c linux-2.4.29/fs/cifs/cifserr.c ---- linux-2.4.29.old/fs/cifs/cifserr.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/cifserr.c 2004-07-14 00:25:04.000000000 +0200 -@@ -0,0 +1,70 @@ -+/* -+ * fs/cifserr.c -+ * -+ * Copyright (c) International Business Machines Corp., 2002 -+ * Author(s): Steve French (sfrench@us.ibm.com) -+ * -+ * This library is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This library 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 Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#include -+#include -+#include -+#include "cifsfs.h" -+ -+int map_cifs_error(int error_class, int error_code, -+ int status_codes_negotiated) -+{ -+ -+ -+ if (status_codes_negotiated) { -+ switch (error_code) { -+ default: -+ return EIO; -+ } -+ } else -+ switch (error_class) { -+ case SUCCESS: -+ return 0; -+ -+ case ERRDOS: -+ switch (error_code) { -+ case ERRbadfunc: -+ return EINVAL; -+ default: -+ return EIO; -+ } -+ -+ case ERRSRV: -+ switch (error_code) { -+ default: -+ return EIO; -+ } -+ -+ case ERRHRD: -+ switch (error_code) { -+ default: -+ return EIO; -+ } -+ default: -+ return EIO; -+ } -+ return 0; -+} -+ -+int map_smb_error(int error_class, int error_code) -+{ -+ return map_cifs_error(error_class, error_code, FALSE); -+} -diff -urN linux-2.4.29.old/fs/cifs/cifsfs.c linux-2.4.29/fs/cifs/cifsfs.c ---- linux-2.4.29.old/fs/cifs/cifsfs.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/cifsfs.c 2004-07-14 00:25:04.000000000 +0200 -@@ -0,0 +1,769 @@ -+/* -+ * fs/cifs/cifsfs.c -+ * -+ * Copyright (C) International Business Machines Corp., 2002,2004 -+ * Author(s): Steve French (sfrench@us.ibm.com) -+ * -+ * Common Internet FileSystem (CIFS) client -+ * -+ * This library is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This library 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 Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+/* Note that BB means BUGBUG (ie something to fix eventually) */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,15)) -+#include -+#endif -+#include -+#include "cifsfs.h" -+#include "cifspdu.h" -+#define DECLARE_GLOBALS_HERE -+#include "cifsglob.h" -+#include "cifsproto.h" -+#include "cifs_debug.h" -+#include "cifs_fs_sb.h" -+#include -+#define CIFS_MAGIC_NUMBER 0xFF534D42 /* the first four bytes of SMB PDUs */ -+/* BB when mempool_resize is added back in, we will resize pool on new mount */ -+#define CIFS_MIN_RCV_POOL 11 /* enough for progress to five servers */ -+ -+#ifdef CONFIG_CIFS_QUOTA -+static struct quotactl_ops cifs_quotactl_ops; -+#endif -+ -+extern struct file_system_type cifs_fs_type; -+ -+int cifsFYI = 0; -+int cifsERROR = 1; -+int traceSMB = 0; -+unsigned int oplockEnabled = 1; -+unsigned int quotaEnabled = 0; -+unsigned int linuxExtEnabled = 1; -+unsigned int lookupCacheEnabled = 1; -+unsigned int multiuser_mount = 0; -+unsigned int extended_security = 0; -+unsigned int ntlmv2_support = 0; -+unsigned int sign_CIFS_PDUs = 1; -+unsigned int CIFSMaximumBufferSize = CIFS_MAX_MSGSIZE; -+struct task_struct * oplockThread = NULL; -+ -+extern int cifs_mount(struct super_block *, struct cifs_sb_info *, char *, -+ const char *); -+extern int cifs_umount(struct super_block *, struct cifs_sb_info *); -+void cifs_proc_init(void); -+void cifs_proc_clean(void); -+ -+static DECLARE_COMPLETION(cifs_oplock_exited); -+ -+ -+struct super_block * -+cifs_read_super(struct super_block *sb, void *data, int silent) -+{ -+ struct inode *inode; -+ struct cifs_sb_info *cifs_sb; -+ int rc = 0; -+ -+ sb->s_flags |= MS_NODIRATIME; /* and probably even noatime */ -+ cifs_sb = CIFS_SB(sb); -+ if(cifs_sb == NULL) -+ return 0; -+ else -+ memset(cifs_sb,0,sizeof(struct cifs_sb_info)); -+ -+ -+ rc = cifs_mount(sb, cifs_sb, data, NULL); -+ -+ if (rc) { -+ if (!silent) -+ cERROR(1, -+ ("cifs_mount failed w/return code = %d", rc)); -+ goto out_mount_failed; -+ } -+ -+ sb->s_magic = CIFS_MAGIC_NUMBER; -+ sb->s_op = &cifs_super_ops; -+/* if(cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512) -+ sb->s_blocksize = cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */ -+#ifdef CONFIG_CIFS_QUOTA -+ sb->s_qcop = &cifs_quotactl_ops; -+#endif -+ sb->s_blocksize = CIFS_MAX_MSGSIZE; -+ sb->s_blocksize_bits = 14; /* default 2**14 = CIFS_MAX_MSGSIZE */ -+ inode = iget(sb, ROOT_I); -+ -+ if (!inode) { -+ goto out_no_root; -+ } -+ -+ sb->s_root = d_alloc_root(inode); -+ -+ if (!sb->s_root) { -+ goto out_no_root; -+ } -+ -+ return sb; -+ -+out_no_root: -+ cERROR(1, ("cifs_read_super: get root inode failed")); -+ if (inode) -+ iput(inode); -+ -+out_mount_failed: -+ if(cifs_sb->local_nls) -+ unload_nls(cifs_sb->local_nls); -+ sb->s_dev = 0; -+ return 0; -+} -+ -+static void -+cifs_put_super(struct super_block *sb) -+{ -+ int rc = 0; -+ struct cifs_sb_info *cifs_sb; -+ -+ cFYI(1, ("In cifs_put_super")); -+ cifs_sb = CIFS_SB(sb); -+ if(cifs_sb == NULL) { -+ cFYI(1,("Empty cifs superblock info passed to unmount")); -+ return; -+ } -+ rc = cifs_umount(sb, cifs_sb); -+ if (rc) { -+ cERROR(1, ("cifs_umount failed with return code %d", rc)); -+ } -+ unload_nls(cifs_sb->local_nls); -+ return; -+} -+ -+static int -+cifs_statfs(struct super_block *sb, struct statfs *buf) -+{ -+ int xid, rc; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ -+ xid = GetXid(); -+ -+ cifs_sb = CIFS_SB(sb); -+ pTcon = cifs_sb->tcon; -+ -+ buf->f_type = CIFS_MAGIC_NUMBER; -+ -+ /* instead could get the real value via SMB_QUERY_FS_ATTRIBUTE_INFO */ -+ buf->f_namelen = PATH_MAX; /* PATH_MAX may be too long - it would presumably -+ be length of total path, note that some servers may be -+ able to support more than this, but best to be safe -+ since Win2k and others can not handle very long filenames */ -+ buf->f_files = 0; /* undefined */ -+ buf->f_ffree = 0; /* unlimited */ -+ -+ rc = CIFSSMBQFSInfo(xid, pTcon, buf, cifs_sb->local_nls); -+ -+ /* -+ int f_type; -+ __fsid_t f_fsid; -+ int f_namelen; */ -+ /* BB get from info put in tcon struct at mount time with call to QFSAttrInfo */ -+ FreeXid(xid); -+ return 0; /* always return success? what if volume is no longer available? */ -+} -+ -+static int cifs_permission(struct inode * inode, int mask) -+{ -+ /* the server does permission checks, we do not need to do it here */ -+ return 0; -+} -+ -+kmem_cache_t *cifs_req_cachep; -+kmem_cache_t *cifs_mid_cachep; -+kmem_cache_t *cifs_oplock_cachep; -+ -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+static struct inode * -+cifs_alloc_inode(struct super_block *sb) -+{ -+ struct cifsInodeInfo *cifs_inode; -+ cifs_inode = -+ (struct cifsInodeInfo *) kmem_cache_alloc(cifs_inode_cachep, -+ SLAB_KERNEL); -+ if (!cifs_inode) -+ return NULL; -+ cifs_inode->cifsAttrs = 0x20; /* default */ -+ atomic_set(&cifs_inode->inUse, 0); -+ cifs_inode->time = 0; -+ /* Until the file is open and we have gotten oplock -+ info back from the server, can not assume caching of -+ file data or metadata */ -+ cifs_inode->clientCanCacheRead = FALSE; -+ cifs_inode->clientCanCacheAll = FALSE; -+ INIT_LIST_HEAD(&cifs_inode->openFileList); -+ return &cifs_inode->vfs_inode; -+} -+ -+static void -+cifs_destroy_inode(struct inode *inode) -+{ -+ kmem_cache_free(cifs_inode_cachep, CIFS_I(inode)); -+} -+#endif -+ -+/* -+ * cifs_show_options() is for displaying mount options in /proc/mounts. -+ * Not all settable options are displayed but most of the important -+ * ones are. -+ */ -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,15)) -+static int -+cifs_show_options(struct seq_file *s, struct vfsmount *m) -+{ -+ struct cifs_sb_info *cifs_sb; -+ -+ cifs_sb = CIFS_SB(m->mnt_sb); -+ -+ if (cifs_sb) { -+ if (cifs_sb->tcon) { -+ seq_printf(s, ",unc=%s", cifs_sb->tcon->treeName); -+ if ((cifs_sb->tcon->ses) && (cifs_sb->tcon->ses->userName)) -+ seq_printf(s, ",username=%s", -+ cifs_sb->tcon->ses->userName); -+ if(cifs_sb->tcon->ses->domainName) -+ seq_printf(s, ",domain=%s", -+ cifs_sb->tcon->ses->domainName); -+ } -+ seq_printf(s, ",rsize=%d",cifs_sb->rsize); -+ seq_printf(s, ",wsize=%d",cifs_sb->wsize); -+ } -+ return 0; -+} -+#endif -+ -+#ifdef CONFIG_CIFS_QUOTA -+int cifs_xquota_set(struct super_block * sb, int quota_type, qid_t qid, -+ struct fs_disk_quota * pdquota) -+{ -+ int xid; -+ int rc = 0; -+ struct cifs_sb_info *cifs_sb = CIFS_SB(sb); -+ struct cifsTconInfo *pTcon; -+ -+ if(cifs_sb) -+ pTcon = cifs_sb->tcon; -+ else -+ return -EIO; -+ -+ -+ xid = GetXid(); -+ if(pTcon) { -+ cFYI(1,("set type: 0x%x id: %d",quota_type,qid)); -+ } else { -+ return -EIO; -+ } -+ -+ FreeXid(xid); -+ return rc; -+} -+ -+int cifs_xquota_get(struct super_block * sb, int quota_type, qid_t qid, -+ struct fs_disk_quota * pdquota) -+{ -+ int xid; -+ int rc = 0; -+ struct cifs_sb_info *cifs_sb = CIFS_SB(sb); -+ struct cifsTconInfo *pTcon; -+ -+ if(cifs_sb) -+ pTcon = cifs_sb->tcon; -+ else -+ return -EIO; -+ -+ xid = GetXid(); -+ if(pTcon) { -+ cFYI(1,("set type: 0x%x id: %d",quota_type,qid)); -+ } else { -+ rc = -EIO; -+ } -+ -+ FreeXid(xid); -+ return rc; -+} -+ -+int cifs_xstate_set(struct super_block * sb, unsigned int flags, int operation) -+{ -+ int xid; -+ int rc = 0; -+ struct cifs_sb_info *cifs_sb = CIFS_SB(sb); -+ struct cifsTconInfo *pTcon; -+ -+ if(cifs_sb) -+ pTcon = cifs_sb->tcon; -+ else -+ return -EIO; -+ -+ xid = GetXid(); -+ if(pTcon) { -+ cFYI(1,("flags: 0x%x operation: 0x%x",flags,operation)); -+ } else { -+ rc = -EIO; -+ } -+ -+ FreeXid(xid); -+ return rc; -+} -+ -+int cifs_xstate_get(struct super_block * sb, struct fs_quota_stat *qstats) -+{ -+ int xid; -+ int rc = 0; -+ struct cifs_sb_info *cifs_sb = CIFS_SB(sb); -+ struct cifsTconInfo *pTcon; -+ -+ if(cifs_sb) { -+ pTcon = cifs_sb->tcon; -+ } else { -+ return -EIO; -+ } -+ xid = GetXid(); -+ if(pTcon) { -+ cFYI(1,("pqstats %p",qstats)); -+ } else { -+ rc = -EIO; -+ } -+ -+ FreeXid(xid); -+ return rc; -+} -+ -+static struct quotactl_ops cifs_quotactl_ops = { -+ .set_xquota = cifs_xquota_set, -+ .get_xquota = cifs_xquota_set, -+ .set_xstate = cifs_xstate_set, -+ .get_xstate = cifs_xstate_get, -+}; -+#endif -+ -+static int cifs_remount(struct super_block *sb, int *flags, char *data) -+{ -+ *flags |= MS_NODIRATIME; -+ return 0; -+} -+ -+struct super_operations cifs_super_ops = { -+ .read_inode = cifs_read_inode, -+ .put_super = cifs_put_super, -+ .statfs = cifs_statfs, -+/* .alloc_inode = cifs_alloc_inode, -+ .destroy_inode = cifs_destroy_inode, */ -+/* .drop_inode = generic_delete_inode, -+ .delete_inode = cifs_delete_inode, *//* Do not need the above two functions -+ unless later we add lazy close of inodes or unless the kernel forgets to call -+ us with the same number of releases (closes) as opens */ -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,15)) -+ .show_options = cifs_show_options, -+#endif -+/* .umount_begin = cifs_umount_begin, *//* consider adding in the future */ -+}; -+ -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+static struct super_block * -+cifs_get_sb(struct file_system_type *fs_type, -+ int flags, const char *dev_name, void *data) -+{ -+ int rc; -+ struct super_block *sb = sget(fs_type, NULL, set_anon_super, NULL); -+ -+ cFYI(1, ("Devname: %s flags: %d ", dev_name, flags)); -+ -+ if (IS_ERR(sb)) -+ return sb; -+ -+ sb->s_flags = flags; -+ -+ rc = cifs_read_super(sb, data, dev_name, flags & MS_VERBOSE ? 1 : 0); -+ if (rc) { -+ up_write(&sb->s_umount); -+ deactivate_super(sb); -+ return ERR_PTR(rc); -+ } -+ sb->s_flags |= MS_ACTIVE; -+ return sb; -+} -+#endif -+ -+static ssize_t -+cifs_read_wrapper(struct file * file, char *read_data, size_t read_size, -+ loff_t * poffset) -+{ -+ if(file == NULL) -+ return -EIO; -+ else if(file->f_dentry == NULL) -+ return -EIO; -+ else if(file->f_dentry->d_inode == NULL) -+ return -EIO; -+ -+ if(CIFS_I(file->f_dentry->d_inode)->clientCanCacheRead) { -+ return generic_file_read(file,read_data,read_size,poffset); -+ } else { -+ /* BB do we need to lock inode from here until after invalidate? */ -+/* if(file->f_dentry->d_inode->i_mapping) { -+ filemap_fdatawrite(file->f_dentry->d_inode->i_mapping); -+ filemap_fdatawait(file->f_dentry->d_inode->i_mapping); -+ }*/ -+/* cifs_revalidate(file->f_dentry);*/ /* BB fixme */ -+ -+ /* BB we should make timer configurable - perhaps -+ by simply calling cifs_revalidate here */ -+ /* invalidate_remote_inode(file->f_dentry->d_inode);*/ -+ return generic_file_read(file,read_data,read_size,poffset); -+ } -+} -+ -+static ssize_t -+cifs_write_wrapper(struct file * file, const char *write_data, -+ size_t write_size, loff_t * poffset) -+{ -+ ssize_t written; -+ -+ if(file == NULL) -+ return -EIO; -+ else if(file->f_dentry == NULL) -+ return -EIO; -+ else if(file->f_dentry->d_inode == NULL) -+ return -EIO; -+ -+ /* check whether we can cache writes locally */ -+ written = generic_file_write(file,write_data,write_size,poffset); -+ if(!CIFS_I(file->f_dentry->d_inode)->clientCanCacheAll) { -+ if(file->f_dentry->d_inode->i_mapping) { -+ filemap_fdatasync(file->f_dentry->d_inode->i_mapping); -+ } -+ } -+ return written; -+} -+ -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+static struct file_system_type cifs_fs_type = { -+ .owner = THIS_MODULE, -+ .name = "cifs", -+ .get_sb = cifs_get_sb, -+ .kill_sb = kill_anon_super, -+ /* .fs_flags */ -+}; -+#endif -+ -+static DECLARE_FSTYPE(cifs_fs_type, "cifs", cifs_read_super,0); -+ -+ -+struct inode_operations cifs_dir_inode_ops = { -+ .create = cifs_create, -+ .lookup = cifs_lookup, -+ .unlink = cifs_unlink, -+ .link = cifs_hardlink, -+ .mkdir = cifs_mkdir, -+ .rmdir = cifs_rmdir, -+ .rename = cifs_rename, -+ .permission = cifs_permission, -+ .revalidate = cifs_revalidate, -+ .setattr = cifs_setattr, -+ .symlink = cifs_symlink, -+ .mknod = cifs_mknod, -+}; -+ -+struct inode_operations cifs_file_inode_ops = { -+ .revalidate = cifs_revalidate, -+ .setattr = cifs_setattr, -+/* .getattr = cifs_getattr,*/ -+ .rename = cifs_rename, -+ .permission = cifs_permission, -+#ifdef CONFIG_CIFS_XATTR -+ .setxattr = cifs_setxattr, -+ .getxattr = cifs_getxattr, -+ .listxattr = cifs_listxattr, -+ .removexattr = cifs_removexattr, -+#endif -+}; -+ -+struct inode_operations cifs_symlink_inode_ops = { -+ .readlink = cifs_readlink, -+ .follow_link = cifs_follow_link, -+ .permission = cifs_permission, -+ /* BB add the following two eventually */ -+ /* revalidate: cifs_revalidate, -+ setattr: cifs_notify_change, *//* BB do we need notify change */ -+#ifdef CONFIG_CIFS_XATTR -+ .setxattr = cifs_setxattr, -+ .getxattr = cifs_getxattr, -+ .listxattr = cifs_listxattr, -+ .removexattr = cifs_removexattr, -+#endif -+}; -+ -+struct file_operations cifs_file_ops = { -+ .read = cifs_read_wrapper, -+ .write = cifs_write_wrapper, -+ .open = cifs_open, -+ .release = cifs_close, -+ .lock = cifs_lock, -+ .fsync = cifs_fsync, -+ .flush = cifs_flush, -+ .mmap = cifs_file_mmap, -+/* .sendfile = generic_file_sendfile,*/ -+#ifdef CONFIG_CIFS_FCNTL -+ .fcntl = cifs_fcntl, -+#endif -+}; -+ -+struct file_operations cifs_dir_ops = { -+ .readdir = cifs_readdir, -+ .release = cifs_closedir, -+ .read = generic_read_dir, -+#ifdef CONFIG_CIFS_FCNTL -+ .fcntl = cifs_fcntl, -+#endif -+}; -+/* -+static void -+cifs_init_once(void *inode, kmem_cache_t * cachep, unsigned long flags) -+{ -+ struct cifsInodeInfo *cifsi = (struct cifsInodeInfo *) inode; -+ -+ if ((flags & (SLAB_CTOR_VERIFY | SLAB_CTOR_CONSTRUCTOR)) == -+ SLAB_CTOR_CONSTRUCTOR) { -+ inode_init_once(&cifsi->vfs_inode); -+ INIT_LIST_HEAD(&cifsi->lockList); -+ } -+} -+ -+static int -+cifs_init_inodecache(void) -+{ -+ cifs_inode_cachep = kmem_cache_create("cifs_inode_cache", -+ sizeof (struct cifsInodeInfo), -+ 0, SLAB_HWCACHE_ALIGN, -+ cifs_init_once, NULL); -+ if (cifs_inode_cachep == NULL) -+ return -ENOMEM; -+ -+ -+ return 0; -+} -+ -+static void -+cifs_destroy_inodecache(void) -+{ -+ if (kmem_cache_destroy(cifs_inode_cachep)) -+ printk(KERN_WARNING "cifs_inode_cache: error freeing\n"); -+} */ -+ -+static int -+cifs_init_request_bufs(void) -+{ -+ cifs_req_cachep = kmem_cache_create("cifs_request", -+ CIFS_MAX_MSGSIZE + -+ MAX_CIFS_HDR_SIZE, 0, -+ SLAB_HWCACHE_ALIGN, NULL, NULL); -+ if (cifs_req_cachep == NULL) -+ return -ENOMEM; -+ -+ return 0; -+} -+ -+static void -+cifs_destroy_request_bufs(void) -+{ -+ if (kmem_cache_destroy(cifs_req_cachep)) -+ printk(KERN_WARNING -+ "cifs_destroy_request_cache: error not all structures were freed\n"); -+} -+ -+static int -+cifs_init_mids(void) -+{ -+ cifs_mid_cachep = kmem_cache_create("cifs_mpx_ids", -+ sizeof (struct mid_q_entry), 0, -+ SLAB_HWCACHE_ALIGN, NULL, NULL); -+ if (cifs_mid_cachep == NULL) -+ return -ENOMEM; -+ cifs_oplock_cachep = kmem_cache_create("cifs_oplock_struct", -+ sizeof (struct oplock_q_entry), 0, -+ SLAB_HWCACHE_ALIGN, NULL, NULL); -+ if (cifs_oplock_cachep == NULL) { -+ kmem_cache_destroy(cifs_mid_cachep); -+ return -ENOMEM; -+ } -+ -+ return 0; -+} -+ -+static void -+cifs_destroy_mids(void) -+{ -+ if (kmem_cache_destroy(cifs_mid_cachep)) -+ printk(KERN_WARNING -+ "cifs_destroy_mids: error not all structures were freed\n"); -+ if (kmem_cache_destroy(cifs_oplock_cachep)) -+ printk(KERN_WARNING -+ "error not all oplock structures were freed\n"); -+} -+ -+static int cifs_oplock_thread(void * dummyarg) -+{ -+ struct oplock_q_entry * oplock_item; -+ struct cifsTconInfo *pTcon; -+ struct inode * inode; -+ __u16 netfid; -+ int rc = 0; -+ -+ daemonize(); -+ sprintf(current->comm,"cifsoplockd"); -+ -+ oplockThread = current; -+ do { -+ set_current_state(TASK_INTERRUPTIBLE); -+ -+ schedule_timeout(1*HZ); -+ spin_lock(&GlobalMid_Lock); -+ if(list_empty(&GlobalOplock_Q)) { -+ spin_unlock(&GlobalMid_Lock); -+ set_current_state(TASK_INTERRUPTIBLE); -+ schedule_timeout(39*HZ); -+ } else { -+ oplock_item = list_entry(GlobalOplock_Q.next, -+ struct oplock_q_entry, qhead); -+ if(oplock_item) { -+ cFYI(1,("found oplock item to write out")); -+ pTcon = oplock_item->tcon; -+ inode = oplock_item->pinode; -+ netfid = oplock_item->netfid; -+ spin_unlock(&GlobalMid_Lock); -+ DeleteOplockQEntry(oplock_item); -+ /* can not grab inode sem here since it would -+ deadlock when oplock received on delete -+ since vfs_unlink holds the i_sem across -+ the call */ -+ /* down(&inode->i_sem);*/ -+ if (S_ISREG(inode->i_mode)) { -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,17)) -+ rc = filemap_fdatasync(inode->i_mapping); -+ if(rc) -+ CIFS_I(inode)->write_behind_rc = rc; -+#else -+ filemap_fdatasync(inode->i_mapping); -+#endif -+ if(CIFS_I(inode)->clientCanCacheRead == 0) -+ invalidate_inode_pages(inode); -+ } else -+ rc = 0; -+ /* releasing a stale oplock after recent reconnection -+ of smb session using a now incorrect file -+ handle is not a data integrity issue but do -+ not bother sending an oplock release if session -+ to server still is disconnected since oplock -+ already released by the server in that case */ -+ if(pTcon->tidStatus != CifsNeedReconnect) { -+ rc = CIFSSMBLock(0, pTcon, -+ netfid, -+ 0 /* len */ , 0 /* offset */, 0, -+ 0, LOCKING_ANDX_OPLOCK_RELEASE, -+ 0 /* wait flag */); -+ cFYI(1,("Oplock release rc = %d ",rc)); -+ } -+ } else -+ spin_unlock(&GlobalMid_Lock); -+ } -+ } while(!signal_pending(current)); -+ complete_and_exit (&cifs_oplock_exited, 0); -+} -+ -+static int __init -+init_cifs(void) -+{ -+ int rc = 0; -+#if CONFIG_PROC_FS -+ cifs_proc_init(); -+#endif -+ INIT_LIST_HEAD(&GlobalServerList); /* BB not implemented yet */ -+ INIT_LIST_HEAD(&GlobalSMBSessionList); -+ INIT_LIST_HEAD(&GlobalTreeConnectionList); -+ INIT_LIST_HEAD(&GlobalOplock_Q); -+/* -+ * Initialize Global counters -+ */ -+ atomic_set(&sesInfoAllocCount, 0); -+ atomic_set(&tconInfoAllocCount, 0); -+ atomic_set(&tcpSesReconnectCount, 0); -+ atomic_set(&tconInfoReconnectCount, 0); -+ -+ atomic_set(&bufAllocCount, 0); -+ atomic_set(&midCount, 0); -+ GlobalCurrentXid = 0; -+ GlobalTotalActiveXid = 0; -+ GlobalMaxActiveXid = 0; -+ GlobalSMBSeslock = RW_LOCK_UNLOCKED; -+ GlobalMid_Lock = SPIN_LOCK_UNLOCKED; -+ -+/* rc = cifs_init_inodecache();*/ -+ if (!rc) { -+ rc = cifs_init_mids(); -+ if (!rc) { -+ rc = cifs_init_request_bufs(); -+ if (!rc) { -+ rc = register_filesystem(&cifs_fs_type); -+ if (!rc) { -+ kernel_thread(cifs_oplock_thread, NULL, -+ CLONE_FS | CLONE_FILES | CLONE_VM); -+ return rc; /* Success */ -+ } else -+ cifs_destroy_request_bufs(); -+ } -+ cifs_destroy_mids(); -+ } -+/* cifs_destroy_inodecache(); */ -+ } -+#if CONFIG_PROC_FS -+ cifs_proc_clean(); -+#endif -+ return rc; -+} -+ -+static void __exit -+exit_cifs(void) -+{ -+ cFYI(0, ("In unregister ie exit_cifs")); -+#if CONFIG_PROC_FS -+ cifs_proc_clean(); -+#endif -+ unregister_filesystem(&cifs_fs_type); -+/* cifs_destroy_inodecache();*/ -+ cifs_destroy_mids(); -+ cifs_destroy_request_bufs(); -+ if(oplockThread) { -+ send_sig(SIGTERM, oplockThread, 1); -+ wait_for_completion(&cifs_oplock_exited); -+ } -+} -+ -+MODULE_AUTHOR("Steve French "); -+MODULE_LICENSE("GPL"); /* combination of LGPL + GPL source behaves as GPL */ -+MODULE_DESCRIPTION -+ ("VFS to access servers complying with the SNIA CIFS Specification e.g. Samba and Windows"); -+module_init(init_cifs) -+module_exit(exit_cifs) -diff -urN linux-2.4.29.old/fs/cifs/cifsfs.h linux-2.4.29/fs/cifs/cifsfs.h ---- linux-2.4.29.old/fs/cifs/cifsfs.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/cifsfs.h 2004-07-14 00:25:04.000000000 +0200 -@@ -0,0 +1,97 @@ -+/* -+ * fs/cifs/cifsfs.h -+ * -+ * Copyright (c) International Business Machines Corp., 2002 -+ * Author(s): Steve French (sfrench@us.ibm.com) -+ * -+ * This library is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This library 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 Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#ifndef _CIFSFS_H -+#define _CIFSFS_H -+ -+#define ROOT_I 2 -+ -+#ifndef FALSE -+#define FALSE 0 -+#endif -+ -+#ifndef TRUE -+#define TRUE 1 -+#endif -+ -+extern int map_cifs_error(int error_class, int error_code, -+ int status_codes_negotiated); -+ -+extern struct address_space_operations cifs_addr_ops; -+ -+/* Functions related to super block operations */ -+extern struct super_operations cifs_super_ops; -+extern void cifs_put_inode(struct inode *); -+extern void cifs_read_inode(struct inode *); -+extern void cifs_delete_inode(struct inode *); -+/* extern void cifs_write_inode(struct inode *); *//* BB not needed yet */ -+ -+/* Functions related to inodes */ -+extern struct inode_operations cifs_dir_inode_ops; -+extern int cifs_create(struct inode *, struct dentry *, int); -+extern struct dentry *cifs_lookup(struct inode *, struct dentry *); -+extern int cifs_unlink(struct inode *, struct dentry *); -+extern int cifs_hardlink(struct dentry *, struct inode *, struct dentry *); -+extern int cifs_mknod(struct inode *, struct dentry *, int, int); -+extern int cifs_mkdir(struct inode *, struct dentry *, int); -+extern int cifs_rmdir(struct inode *, struct dentry *); -+extern int cifs_rename(struct inode *, struct dentry *, struct inode *, -+ struct dentry *); -+extern int cifs_revalidate(struct dentry *); -+extern int cifs_setattr(struct dentry *, struct iattr *); -+ -+extern struct inode_operations cifs_file_inode_ops; -+extern void cifs_truncate_file(struct inode *); -+extern struct inode_operations cifs_symlink_inode_ops; -+ -+/* Functions related to files and directories */ -+extern struct file_operations cifs_file_ops; -+extern int cifs_open(struct inode *inode, struct file *file); -+extern int cifs_close(struct inode *inode, struct file *file); -+extern int cifs_closedir(struct inode *inode, struct file *file); -+extern ssize_t cifs_read(struct file *file, char *read_data, -+ size_t read_size, loff_t * poffset); -+extern ssize_t cifs_write(struct file *file, const char *write_data, -+ size_t write_size, loff_t * poffset); -+extern int cifs_lock(struct file *, int, struct file_lock *); -+extern int cifs_fsync(struct file *, struct dentry *, int); -+extern int cifs_flush(struct file *); -+extern int cifs_file_mmap(struct file * , struct vm_area_struct *); -+extern struct file_operations cifs_dir_ops; -+extern int cifs_dir_open(struct inode *inode, struct file *file); -+extern int cifs_readdir(struct file *file, void *direntry, filldir_t filldir); -+extern long cifs_fcntl(int, unsigned int, unsigned long, struct file *); -+ -+/* Functions related to dir entries */ -+extern struct dentry_operations cifs_dentry_ops; -+ -+/* Functions related to symlinks */ -+extern int cifs_follow_link(struct dentry *direntry, struct nameidata *nd); -+extern int cifs_readlink(struct dentry *direntry, char *buffer, int buflen); -+extern int cifs_symlink(struct inode *inode, struct dentry *direntry, -+ const char *symname); -+extern int cifs_removexattr(struct dentry *, const char *); -+extern int cifs_setxattr(struct dentry *, const char *, const void *, -+ size_t, int); -+extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t); -+extern ssize_t cifs_listxattr(struct dentry *, char *, size_t); -+#define CIFS_VERSION "1.20" -+#endif /* _CIFSFS_H */ -diff -urN linux-2.4.29.old/fs/cifs/cifs_fs_sb.h linux-2.4.29/fs/cifs/cifs_fs_sb.h ---- linux-2.4.29.old/fs/cifs/cifs_fs_sb.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/cifs_fs_sb.h 2004-07-14 00:25:04.000000000 +0200 -@@ -0,0 +1,32 @@ -+/* -+ * fs/cifs/cifs_fs_sb.h -+ * -+ * Copyright (c) International Business Machines Corp., 2002 -+ * Author(s): Steve French (sfrench@us.ibm.com) -+ * -+ * This library is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This library 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 Lesser General Public License for more details. -+ * -+ */ -+#ifndef _CIFS_FS_SB_H -+#define _CIFS_FS_SB_H -+ -+struct cifs_sb_info { -+ struct cifsTconInfo *tcon; /* primary mount */ -+ struct list_head nested_tcon_q; -+ struct nls_table *local_nls; -+ unsigned int rsize; -+ unsigned int wsize; -+ uid_t mnt_uid; -+ gid_t mnt_gid; -+ mode_t mnt_file_mode; -+ mode_t mnt_dir_mode; -+}; -+#endif /* _CIFS_FS_SB_H */ -diff -urN linux-2.4.29.old/fs/cifs/cifsglob.h linux-2.4.29/fs/cifs/cifsglob.h ---- linux-2.4.29.old/fs/cifs/cifsglob.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/cifsglob.h 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,413 @@ -+/* -+ * fs/cifs/cifsglob.h -+ * -+ * Copyright (C) International Business Machines Corp., 2002,2003 -+ * Author(s): Steve French (sfrench@us.ibm.com) -+ * -+ * This library is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This library 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 Lesser General Public License for more details. -+ * -+ */ -+#include -+#include -+#include "cifs_fs_sb.h" -+/* -+ * The sizes of various internal tables and strings -+ */ -+#define MAX_UID_INFO 16 -+#define MAX_SES_INFO 2 -+#define MAX_TCON_INFO 4 -+ -+#define MAX_TREE_SIZE 2 + MAX_SERVER_SIZE + 1 + MAX_SHARE_SIZE + 1 -+#define MAX_SERVER_SIZE 15 -+#define MAX_SHARE_SIZE 64 /* used to be 20 - this should still be enough */ -+#define MAX_USERNAME_SIZE 32 /* 32 is to allow for 15 char names + null -+ termination then *2 for unicode versions */ -+#define MAX_PASSWORD_SIZE 16 -+ -+/* -+ * MAX_REQ is the maximum number of requests that WE will send -+ * on one socket concurently. It also matches the most common -+ * value of max multiplex returned by servers. We may -+ * eventually want to use the negotiated value (in case -+ * future servers can handle more) when we are more confident that -+ * we will not have problems oveloading the socket with pending -+ * write data. -+ */ -+#define CIFS_MAX_REQ 50 -+ -+#define SERVER_NAME_LENGTH 15 -+#define SERVER_NAME_LEN_WITH_NULL (SERVER_NAME_LENGTH + 1) -+ -+/* used to define string lengths for reversing unicode strings */ -+/* (256+1)*2 = 514 */ -+/* (max path length + 1 for null) * 2 for unicode */ -+#define MAX_NAME 514 -+ -+#include "cifspdu.h" -+ -+#ifndef FALSE -+#define FALSE 0 -+#endif -+ -+#ifndef TRUE -+#define TRUE 1 -+#endif -+ -+#ifndef XATTR_DOS_ATTRIB -+#define XATTR_DOS_ATTRIB "user.DOSATTRIB" -+#endif -+ -+/* -+ * This information is kept on every Server we know about. -+ * -+ * Some things to note: -+ * -+ */ -+#define SERVER_NAME_LEN_WITH_NULL (SERVER_NAME_LENGTH + 1) -+ -+/* -+ * CIFS vfs client Status information (based on what we know.) -+ */ -+ -+ /* associated with each tcp and smb session */ -+enum statusEnum { -+ CifsNew = 0, -+ CifsGood, -+ CifsExiting, -+ CifsNeedReconnect -+}; -+ -+enum securityEnum { -+ NTLM = 0, /* Legacy NTLM012 auth with NTLM hash */ -+ NTLMv2, /* Legacy NTLM auth with NTLMv2 hash */ -+ RawNTLMSSP, /* NTLMSSP without SPNEGO */ -+ NTLMSSP, /* NTLMSSP via SPNEGO */ -+ Kerberos /* Kerberos via SPNEGO */ -+}; -+ -+enum protocolEnum { -+ IPV4 = 0, -+ IPV6, -+ SCTP -+ /* Netbios frames protocol not supported at this time */ -+}; -+ -+/* -+ ***************************************************************** -+ * Except the CIFS PDUs themselves all the -+ * globally interesting structs should go here -+ ***************************************************************** -+ */ -+ -+struct TCP_Server_Info { -+ char server_Name[SERVER_NAME_LEN_WITH_NULL]; /* 15 chars + X'20'in 16th */ -+ char unicode_server_Name[SERVER_NAME_LEN_WITH_NULL * 2]; /* Unicode version of server_Name */ -+ struct socket *ssocket; -+ union { -+ struct sockaddr_in sockAddr; -+ struct sockaddr_in6 sockAddr6; -+ } addr; -+ wait_queue_head_t response_q; -+ wait_queue_head_t request_q; /* if more than maxmpx to srvr must block*/ -+ struct list_head pending_mid_q; -+ void *Server_NlsInfo; /* BB - placeholder for future NLS info */ -+ unsigned short server_codepage; /* codepage for the server */ -+ unsigned long ip_address; /* IP addr for the server if known */ -+ enum protocolEnum protocolType; -+ char versionMajor; -+ char versionMinor; -+ int svlocal:1; /* local server or remote */ -+ atomic_t socketUseCount; /* number of open cifs sessions on socket */ -+ atomic_t inFlight; /* number of requests on the wire to server */ -+ enum statusEnum tcpStatus; /* what we think the status is */ -+ struct semaphore tcpSem; -+ struct task_struct *tsk; -+ char server_GUID[16]; -+ char secMode; -+ enum securityEnum secType; -+ unsigned int maxReq; /* Clients should submit no more */ -+ /* than maxReq distinct unanswered SMBs to the server when using */ -+ /* multiplexed reads or writes */ -+ unsigned int maxBuf; /* maxBuf specifies the maximum */ -+ /* message size the server can send or receive for non-raw SMBs */ -+ unsigned int maxRw; /* maxRw specifies the maximum */ -+ /* message size the server can send or receive for */ -+ /* SMB_COM_WRITE_RAW or SMB_COM_READ_RAW. */ -+ char sessid[4]; /* unique token id for this session */ -+ /* (returned on Negotiate */ -+ int capabilities; /* allow selective disabling of caps by smb sess */ -+ __u16 timeZone; -+ char cryptKey[CIFS_CRYPTO_KEY_SIZE]; -+ char workstation_RFC1001_name[16]; /* 16th byte is always zero */ -+}; -+ -+/* -+ * The following is our shortcut to user information. We surface the uid, -+ * and name. We always get the password on the fly in case it -+ * has changed. We also hang a list of sessions owned by this user off here. -+ */ -+struct cifsUidInfo { -+ struct list_head userList; -+ struct list_head sessionList; /* SMB sessions for this user */ -+ uid_t linux_uid; -+ char user[MAX_USERNAME_SIZE + 1]; /* ascii name of user */ -+ /* BB may need ptr or callback for PAM or WinBind info */ -+}; -+ -+/* -+ * Session structure. One of these for each uid session with a particular host -+ */ -+struct cifsSesInfo { -+ struct list_head cifsSessionList; -+ struct semaphore sesSem; -+ struct cifsUidInfo *uidInfo; /* pointer to user info */ -+ struct TCP_Server_Info *server; /* pointer to server info */ -+ atomic_t inUse; /* # of mounts (tree connections) on this ses */ -+ enum statusEnum status; -+ __u32 sequence_number; /* needed for CIFS PDU signature */ -+ __u16 ipc_tid; /* special tid for connection to IPC share */ -+ char mac_signing_key[CIFS_SESSION_KEY_SIZE + 16]; -+ char *serverOS; /* name of operating system underlying the server */ -+ char *serverNOS; /* name of network operating system that the server is running */ -+ char *serverDomain; /* security realm of server */ -+ int Suid; /* remote smb uid */ -+ uid_t linux_uid; /* local Linux uid */ -+ int capabilities; -+ char serverName[SERVER_NAME_LEN_WITH_NULL * 2]; /* BB make bigger for tcp names - will ipv6 and sctp addresses fit here?? */ -+ char userName[MAX_USERNAME_SIZE + 1]; -+ char domainName[MAX_USERNAME_SIZE + 1]; -+ char * password; -+}; -+ -+/* -+ * there is one of these for each connection to a resource on a particular -+ * session -+ */ -+struct cifsTconInfo { -+ struct list_head cifsConnectionList; -+ struct list_head openFileList; -+ struct semaphore tconSem; -+ struct cifsSesInfo *ses; /* pointer to session associated with */ -+ char treeName[MAX_TREE_SIZE + 1]; /* UNC name of resource (in ASCII not UTF) */ -+ char *nativeFileSystem; -+ __u16 tid; /* The 2 byte tree id */ -+ __u16 Flags; /* optional support bits */ -+ enum statusEnum tidStatus; -+ atomic_t useCount; /* how many mounts (explicit or implicit) to this share */ -+#ifdef CONFIG_CIFS_STATS -+ atomic_t num_smbs_sent; -+ atomic_t num_writes; -+ atomic_t num_reads; -+ atomic_t num_oplock_brks; -+ atomic_t num_opens; -+ atomic_t num_deletes; -+ atomic_t num_mkdirs; -+ atomic_t num_rmdirs; -+ atomic_t num_renames; -+ atomic_t num_t2renames; -+ __u64 bytes_read; -+ __u64 bytes_written; -+ spinlock_t stat_lock; -+#endif -+ FILE_SYSTEM_DEVICE_INFO fsDevInfo; -+ FILE_SYSTEM_ATTRIBUTE_INFO fsAttrInfo; /* ok if file system name truncated */ -+ FILE_SYSTEM_UNIX_INFO fsUnixInfo; -+ int retry:1; -+ /* BB add field for back pointer to sb struct? */ -+}; -+ -+/* -+ * This info hangs off the cifsFileInfo structure. This is used to track -+ * byte stream locks on the file -+ */ -+struct cifsLockInfo { -+ struct cifsLockInfo *next; -+ int start; -+ int length; -+ int type; -+}; -+ -+/* -+ * One of these for each open instance of a file -+ */ -+struct cifsFileInfo { -+ struct list_head tlist; /* pointer to next fid owned by tcon */ -+ struct list_head flist; /* next fid (file instance) for this inode */ -+ unsigned int uid; /* allows finding which FileInfo structure */ -+ __u32 pid; /* process id who opened file */ -+ __u16 netfid; /* file id from remote */ -+ /* BB add lock scope info here if needed */ ; -+ /* lock scope id (0 if none) */ -+ struct file * pfile; /* needed for writepage */ -+ struct inode * pInode; /* needed for oplock break */ -+ int endOfSearch:1; /* we have reached end of search */ -+ int closePend:1; /* file is marked to close */ -+ int emptyDir:1; -+ int invalidHandle:1; /* file closed via session abend */ -+ struct semaphore fh_sem; /* prevents reopen race after dead ses*/ -+ char * search_resume_name; -+ unsigned int resume_name_length; -+ __u32 resume_key; -+}; -+ -+/* -+ * One of these for each file inode -+ */ -+ -+struct cifsInodeInfo { -+ struct list_head lockList; -+ /* BB add in lists for dirty pages - i.e. write caching info for oplock */ -+ struct list_head openFileList; -+ int write_behind_rc; -+ __u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */ -+ atomic_t inUse; /* num concurrent users (local openers cifs) of file*/ -+ unsigned long time; /* jiffies of last update/check of inode */ -+ int clientCanCacheRead:1; /* read oplock */ -+ int clientCanCacheAll:1; /* read and writebehind oplock */ -+ int oplockPending:1; -+ struct inode vfs_inode; -+}; -+ -+static inline struct cifsInodeInfo * CIFS_I(struct inode *inode) -+{ -+ return (struct cifsInodeInfo *)&(inode->u); -+} -+ -+static inline struct cifs_sb_info * CIFS_SB(struct super_block *sb) -+{ -+ return (struct cifs_sb_info *) &(sb->u); -+} -+ -+ -+/* one of these for every pending CIFS request to the server */ -+struct mid_q_entry { -+ struct list_head qhead; /* mids waiting on reply from this server */ -+ __u16 mid; /* multiplex id */ -+ __u16 pid; /* process id */ -+ __u32 sequence_number; /* for CIFS signing */ -+ __u16 command; /* smb command code */ -+ struct timeval when_sent; /* time when smb sent */ -+ struct cifsSesInfo *ses; /* smb was sent to this server */ -+ struct task_struct *tsk; /* task waiting for response */ -+ struct smb_hdr *resp_buf; /* response buffer */ -+ int midState; /* wish this were enum but can not pass to wait_event */ -+}; -+ -+struct oplock_q_entry { -+ struct list_head qhead; -+ struct inode * pinode; -+ struct cifsTconInfo * tcon; -+ __u16 netfid; -+}; -+ -+#define MID_FREE 0 -+#define MID_REQUEST_ALLOCATED 1 -+#define MID_REQUEST_SUBMITTED 2 -+#define MID_RESPONSE_RECEIVED 4 -+#define MID_RETRY_NEEDED 8 /* session closed while this request out */ -+ -+/* -+ ***************************************************************** -+ * All constants go here -+ ***************************************************************** -+ */ -+ -+#define UID_HASH (16) -+ -+/* -+ * Note that ONE module should define _DECLARE_GLOBALS_HERE to cause the -+ * following to be declared. -+ */ -+ -+/**************************************************************************** -+ * Locking notes. All updates to global variables and lists should be -+ * protected by spinlocks or semaphores. -+ * -+ * Spinlocks -+ * --------- -+ * GlobalMid_Lock protects: -+ * list operations on pending_mid_q and oplockQ -+ * updates to XID counters, multiplex id and SMB sequence numbers -+ * GlobalSMBSesLock protects: -+ * list operations on tcp and SMB session lists and tCon lists -+ * f_owner.lock protects certain per file struct operations -+ * mapping->page_lock protects certain per page operations -+ * -+ * Semaphores -+ * ---------- -+ * sesSem operations on smb session -+ * tconSem operations on tree connection -+ * fh_sem file handle reconnection operations -+ * -+ ****************************************************************************/ -+ -+#ifdef DECLARE_GLOBALS_HERE -+#define GLOBAL_EXTERN -+#else -+#define GLOBAL_EXTERN extern -+#endif -+ -+/* -+ * The list of servers that did not respond with NT LM 0.12. -+ * This list helps improve performance and eliminate the messages indicating -+ * that we had a communications error talking to the server in this list. -+ */ -+GLOBAL_EXTERN struct servers_not_supported *NotSuppList; /*@z4a */ -+ -+/* -+ * The following is a hash table of all the users we know about. -+ */ -+GLOBAL_EXTERN struct smbUidInfo *GlobalUidList[UID_HASH]; -+ -+GLOBAL_EXTERN struct list_head GlobalServerList; /* BB not implemented yet */ -+GLOBAL_EXTERN struct list_head GlobalSMBSessionList; -+GLOBAL_EXTERN struct list_head GlobalTreeConnectionList; -+GLOBAL_EXTERN rwlock_t GlobalSMBSeslock; /* protects list inserts on 3 above */ -+ -+GLOBAL_EXTERN struct list_head GlobalOplock_Q; -+ -+/* -+ * Global transaction id (XID) information -+ */ -+GLOBAL_EXTERN unsigned int GlobalCurrentXid; /* protected by GlobalMid_Sem */ -+GLOBAL_EXTERN unsigned int GlobalTotalActiveXid; /* prot by GlobalMid_Sem */ -+GLOBAL_EXTERN unsigned int GlobalMaxActiveXid; /* prot by GlobalMid_Sem */ -+GLOBAL_EXTERN spinlock_t GlobalMid_Lock; /* protects above and list operations */ -+ /* on midQ entries */ -+GLOBAL_EXTERN char Local_System_Name[15]; -+ -+/* -+ * Global counters, updated atomically -+ */ -+GLOBAL_EXTERN atomic_t sesInfoAllocCount; -+GLOBAL_EXTERN atomic_t tconInfoAllocCount; -+ -+GLOBAL_EXTERN atomic_t tcpSesReconnectCount; -+GLOBAL_EXTERN atomic_t tconInfoReconnectCount; -+ -+/* Various Debug counters to remove someday (BB) */ -+GLOBAL_EXTERN atomic_t bufAllocCount; -+GLOBAL_EXTERN atomic_t midCount; -+ -+/* Misc globals */ -+GLOBAL_EXTERN unsigned int multiuser_mount; /* if enabled allows new sessions -+ to be established on existing mount if we -+ have the uid/password or Kerberos credential -+ or equivalent for current user */ -+GLOBAL_EXTERN unsigned int oplockEnabled; -+GLOBAL_EXTERN unsigned int quotaEnabled; -+GLOBAL_EXTERN unsigned int lookupCacheEnabled; -+GLOBAL_EXTERN unsigned int extended_security; /* if on, session setup sent -+ with more secure ntlmssp2 challenge/resp */ -+GLOBAL_EXTERN unsigned int ntlmv2_support; /* better optional password hash */ -+GLOBAL_EXTERN unsigned int sign_CIFS_PDUs; /* enable smb packet signing */ -+GLOBAL_EXTERN unsigned int linuxExtEnabled; /* enable Linux/Unix CIFS extensions */ -+ -diff -urN linux-2.4.29.old/fs/cifs/cifspdu.h linux-2.4.29/fs/cifs/cifspdu.h ---- linux-2.4.29.old/fs/cifs/cifspdu.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/cifspdu.h 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,1793 @@ -+/* -+ * fs/cifs/cifspdu.h -+ * -+ * Copyright (c) International Business Machines Corp., 2002 -+ * Author(s): Steve French (sfrench@us.ibm.com) -+ * -+ * This library is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This library 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 Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#ifndef _CIFSPDU_H -+#define _CIFSPDU_H -+ -+#include -+ -+#define CIFS_PROT 0 -+#define BAD_PROT CIFS_PROT+1 -+ -+/* SMB command codes */ -+#define SMB_COM_CREATE_DIRECTORY 0x00 -+#define SMB_COM_DELETE_DIRECTORY 0x01 -+#define SMB_COM_CLOSE 0x04 -+#define SMB_COM_DELETE 0x06 -+#define SMB_COM_RENAME 0x07 -+#define SMB_COM_LOCKING_ANDX 0x24 -+#define SMB_COM_COPY 0x29 -+#define SMB_COM_READ_ANDX 0x2E -+#define SMB_COM_WRITE_ANDX 0x2F -+#define SMB_COM_TRANSACTION2 0x32 -+#define SMB_COM_TRANSACTION2_SECONDARY 0x33 -+#define SMB_COM_FIND_CLOSE2 0x34 -+#define SMB_COM_TREE_DISCONNECT 0x71 -+#define SMB_COM_NEGOTIATE 0x72 -+#define SMB_COM_SESSION_SETUP_ANDX 0x73 -+#define SMB_COM_LOGOFF_ANDX 0x74 -+#define SMB_COM_TREE_CONNECT_ANDX 0x75 -+#define SMB_COM_NT_TRANSACT 0xA0 -+#define SMB_COM_NT_TRANSACT_SECONDARY 0xA1 -+#define SMB_COM_NT_CREATE_ANDX 0xA2 -+#define SMB_COM_NT_RENAME 0xA5 -+ -+/* Transact2 subcommand codes */ -+#define TRANS2_OPEN 0x00 -+#define TRANS2_FIND_FIRST 0x01 -+#define TRANS2_FIND_NEXT 0x02 -+#define TRANS2_QUERY_FS_INFORMATION 0x03 -+#define TRANS2_QUERY_PATH_INFORMATION 0x05 -+#define TRANS2_SET_PATH_INFORMATION 0x06 -+#define TRANS2_QUERY_FILE_INFORMATION 0x07 -+#define TRANS2_SET_FILE_INFORMATION 0x08 -+#define TRANS2_GET_DFS_REFERRAL 0x10 -+#define TRANS2_REPORT_DFS_INCOSISTENCY 0x11 -+ -+/* NT Transact subcommand codes */ -+#define NT_TRANSACT_CREATE 0x01 -+#define NT_TRANSACT_IOCTL 0x02 -+#define NT_TRANSACT_SET_SECURITY_DESC 0x03 -+#define NT_TRANSACT_NOTIFY_CHANGE 0x04 -+#define NT_TRANSACT_RENAME 0x05 -+#define NT_TRANSACT_QUERY_SECURITY_DESC 0x06 -+#define NT_TRANSACT_GET_USER_QUOTA 0x07 -+#define NT_TRANSACT_SET_USER_QUOTA 0x08 -+ -+#define MAX_CIFS_HDR_SIZE 256 /* chained NTCreateXReadX will probably be biggest */ -+ -+/* internal cifs vfs structures */ -+/***************************************************************** -+ * All constants go here -+ ***************************************************************** -+ */ -+ -+/* -+ * Starting value for maximum SMB size negotiation -+ */ -+#define CIFS_MAX_MSGSIZE (4*4096) -+ -+/* -+ * Size of encrypted user password in bytes -+ */ -+#define CIFS_ENCPWD_SIZE (16) -+ -+/* -+ * Size of the crypto key returned on the negotiate SMB in bytes -+ */ -+#define CIFS_CRYPTO_KEY_SIZE (8) -+ -+/* -+ * Size of the session key (crypto key encrypted with the password -+ */ -+#define CIFS_SESSION_KEY_SIZE (24) -+ -+/* -+ * Maximum user name length -+ */ -+#define CIFS_UNLEN (20) -+ -+/* -+ * Flags on SMB open -+ */ -+#define SMBOPEN_WRITE_THROUGH 0x4000 -+#define SMBOPEN_DENY_ALL 0x0010 -+#define SMBOPEN_DENY_WRITE 0x0020 -+#define SMBOPEN_DENY_READ 0x0030 -+#define SMBOPEN_DENY_NONE 0x0040 -+#define SMBOPEN_READ 0x0000 -+#define SMBOPEN_WRITE 0x0001 -+#define SMBOPEN_READWRITE 0x0002 -+#define SMBOPEN_EXECUTE 0x0003 -+ -+#define SMBOPEN_OCREATE 0x0010 -+#define SMBOPEN_OTRUNC 0x0002 -+#define SMBOPEN_OAPPEND 0x0001 -+ -+/* -+ * SMB flag definitions -+ */ -+#define SMBFLG_EXTD_LOCK 0x01 /* server supports lock-read write-unlock primitives */ -+#define SMBFLG_RCV_POSTED 0x02 /* obsolete */ -+#define SMBFLG_RSVD 0x04 -+#define SMBFLG_CASELESS 0x08 /* all pathnames treated as caseless (off implies case sensitive file handling requested) */ -+#define SMBFLG_CANONICAL_PATH_FORMAT 0x10 /* obsolete */ -+#define SMBFLG_OLD_OPLOCK 0x20 /* obsolete */ -+#define SMBFLG_OLD_OPLOCK_NOTIFY 0x40 /* obsolete */ -+#define SMBFLG_RESPONSE 0x80 /* this PDU is a response from server */ -+ -+/* -+ * SMB flag2 definitions -+ */ -+#define SMBFLG2_KNOWS_LONG_NAMES 0x0001 /* can send long (non-8.3) path names in response */ -+#define SMBFLG2_KNOWS_EAS 0x0002 -+#define SMBFLG2_SECURITY_SIGNATURE 0x0004 -+#define SMBFLG2_IS_LONG_NAME 0x0040 -+#define SMBFLG2_EXT_SEC 0x0800 -+#define SMBFLG2_DFS 0x1000 -+#define SMBFLG2_PAGING_IO 0x2000 -+#define SMBFLG2_ERR_STATUS 0x4000 -+#define SMBFLG2_UNICODE 0x8000 -+ -+/* -+ * These are the file access permission bits defined in CIFS for the -+ * NTCreateAndX as well as the level 0x107 -+ * TRANS2_QUERY_PATH_INFORMATION API. The level 0x107, SMB_QUERY_FILE_ALL_INFO -+ * responds with the AccessFlags. -+ * The AccessFlags specifies the access permissions a caller has to the -+ * file and can have any suitable combination of the following values: -+ */ -+ -+#define FILE_READ_DATA 0x00000001 /* Data can be read from the file */ -+#define FILE_WRITE_DATA 0x00000002 /* Data can be written to the file */ -+#define FILE_APPEND_DATA 0x00000004 /* Data can be appended to the file */ -+#define FILE_READ_EA 0x00000008 /* Extended attributes associated */ -+ /* with the file can be read */ -+#define FILE_WRITE_EA 0x00000010 /* Extended attributes associated */ -+ /* with the file can be written */ -+#define FILE_EXECUTE 0x00000020 /*Data can be read into memory from */ -+ /* the file using system paging I/O */ -+#define FILE_DELETE_CHILD 0x00000040 -+#define FILE_READ_ATTRIBUTES 0x00000080 /* Attributes associated with the */ -+ /* file can be read */ -+#define FILE_WRITE_ATTRIBUTES 0x00000100 /* Attributes associated with the */ -+ /* file can be written */ -+#define DELETE 0x00010000 /* The file can be deleted */ -+#define READ_CONTROL 0x00020000 /* The access control list and */ -+ /* ownership associated with the */ -+ /* file can be read */ -+#define WRITE_DAC 0x00040000 /* The access control list and */ -+ /* ownership associated with the */ -+ /* file can be written. */ -+#define WRITE_OWNER 0x00080000 /* Ownership information associated */ -+ /* with the file can be written */ -+#define SYNCHRONIZE 0x00100000 /* The file handle can waited on to */ -+ /* synchronize with the completion */ -+ /* of an input/output request */ -+#define GENERIC_ALL 0x10000000 -+#define GENERIC_EXECUTE 0x20000000 -+#define GENERIC_WRITE 0x40000000 -+#define GENERIC_READ 0x80000000 -+ /* In summary - Relevant file */ -+ /* access flags from CIFS are */ -+ /* file_read_data, file_write_data */ -+ /* file_execute, file_read_attributes */ -+ /* write_dac, and delete. */ -+ -+/* -+ * Invalid readdir handle -+ */ -+#define CIFS_NO_HANDLE 0xFFFF -+ -+/* IPC$ in ASCII */ -+#define CIFS_IPC_RESOURCE "\x49\x50\x43\x24" -+ -+/* IPC$ in Unicode */ -+#define CIFS_IPC_UNICODE_RESOURCE "\x00\x49\x00\x50\x00\x43\x00\x24\x00\x00" -+ -+/* Unicode Null terminate 2 bytes of 0 */ -+#define UNICODE_NULL "\x00\x00" -+#define ASCII_NULL 0x00 -+ -+/* -+ * Server type values (returned on EnumServer API -+ */ -+#define CIFS_SV_TYPE_DC 0x00000008 -+#define CIFS_SV_TYPE_BACKDC 0x00000010 -+ -+/* -+ * Alias type flags (From EnumAlias API call -+ */ -+#define CIFS_ALIAS_TYPE_FILE 0x0001 -+#define CIFS_SHARE_TYPE_FILE 0x0000 -+ -+/* -+ * File Attribute flags -+ */ -+#define ATTR_READONLY 0x0001 -+#define ATTR_HIDDEN 0x0002 -+#define ATTR_SYSTEM 0x0004 -+#define ATTR_VOLUME 0x0008 -+#define ATTR_DIRECTORY 0x0010 -+#define ATTR_ARCHIVE 0x0020 -+#define ATTR_DEVICE 0x0040 -+#define ATTR_NORMAL 0x0080 -+#define ATTR_TEMPORARY 0x0100 -+#define ATTR_SPARSE 0x0200 -+#define ATTR_REPARSE 0x0400 -+#define ATTR_COMPRESSED 0x0800 -+#define ATTR_OFFLINE 0x1000 /* ie file not immediately available - offline storage */ -+#define ATTR_NOT_CONTENT_INDEXED 0x2000 -+#define ATTR_ENCRYPTED 0x4000 -+#define ATTR_POSIX_SEMANTICS 0x01000000 -+#define ATTR_BACKUP_SEMANTICS 0x02000000 -+#define ATTR_DELETE_ON_CLOSE 0x04000000 -+#define ATTR_SEQUENTIAL_SCAN 0x08000000 -+#define ATTR_RANDOM_ACCESS 0x10000000 -+#define ATTR_NO_BUFFERING 0x20000000 -+#define ATTR_WRITE_THROUGH 0x80000000 -+ -+/* ShareAccess flags */ -+#define FILE_NO_SHARE 0x00000000 -+#define FILE_SHARE_READ 0x00000001 -+#define FILE_SHARE_WRITE 0x00000002 -+#define FILE_SHARE_DELETE 0x00000004 -+#define FILE_SHARE_ALL 0x00000007 -+ -+/* CreateDisposition flags */ -+#define FILE_SUPERSEDE 0x00000000 -+#define FILE_OPEN 0x00000001 -+#define FILE_CREATE 0x00000002 -+#define FILE_OPEN_IF 0x00000003 -+#define FILE_OVERWRITE 0x00000004 -+#define FILE_OVERWRITE_IF 0x00000005 -+ -+/* CreateOptions */ -+#define CREATE_NOT_FILE 0x00000001 /* if set must not be file */ -+#define CREATE_WRITE_THROUGH 0x00000002 -+#define CREATE_NOT_DIR 0x00000040 /* if set must not be directory */ -+#define CREATE_RANDOM_ACCESS 0x00000800 -+#define CREATE_DELETE_ON_CLOSE 0x00001000 -+#define OPEN_REPARSE_POINT 0x00200000 -+ -+/* ImpersonationLevel flags */ -+#define SECURITY_ANONYMOUS 0 -+#define SECURITY_IDENTIFICATION 1 -+#define SECURITY_IMPERSONATION 2 -+#define SECURITY_DELEGATION 3 -+ -+/* SecurityFlags */ -+#define SECURITY_CONTEXT_TRACKING 0x01 -+#define SECURITY_EFFECTIVE_ONLY 0x02 -+ -+/* -+ * Default PID value, used in all SMBs where the PID is not important -+ */ -+#define CIFS_DFT_PID 0x1234 -+ -+/* -+ * We use the same routine for Copy and Move SMBs. This flag is used to -+ * distinguish -+ */ -+#define CIFS_COPY_OP 1 -+#define CIFS_RENAME_OP 2 -+ -+#define GETU16(var) (*((__u16 *)var)) /* BB check for endian issues */ -+#define GETU32(var) (*((__u32 *)var)) /* BB check for endian issues */ -+ -+#pragma pack(1) -+ -+struct smb_hdr { -+ __u32 smb_buf_length; /* big endian on wire *//* BB length is only two or three bytes - with one or two byte type preceding it but that is always zero - we could mask the type byte off just in case BB */ -+ __u8 Protocol[4]; -+ __u8 Command; -+ union { -+ struct { -+ __u8 ErrorClass; -+ __u8 Reserved; -+ __u16 Error; /* note: treated as little endian (le) on wire */ -+ } DosError; -+ __u32 CifsError; /* note: le */ -+ } Status; -+ __u8 Flags; -+ __u16 Flags2; /* note: le */ -+ __u16 PidHigh; /* note: le */ -+ union { -+ struct { -+ __u32 SequenceNumber; /* le */ -+ __u32 Reserved; /* zero */ -+ } Sequence; -+ __u8 SecuritySignature[8]; /* le */ -+ } Signature; -+ __u8 pad[2]; -+ __u16 Tid; -+ __u16 Pid; /* note: le */ -+ __u16 Uid; -+ __u16 Mid; -+ __u8 WordCount; -+}; -+/* given a pointer to an smb_hdr retrieve the value of byte count */ -+#define BCC(smb_var) ( *(__u16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) ) ) -+ -+/* given a pointer to an smb_hdr retrieve the pointer to the byte area */ -+#define pByteArea(smb_var) ((char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) + 2 ) -+ -+/* -+ * Computer Name Length -+ */ -+#define CNLEN 15 -+ -+/* -+ * Share Name Length @S8A -+ * Note: This length is limited by the SMB used to get @S8A -+ * the Share info. NetShareEnum only returns 13 @S8A -+ * chars, including the null termination. @S8A -+ */ -+#define SNLEN 12 /*@S8A */ -+ -+/* -+ * Comment Length -+ */ -+#define MAXCOMMENTLEN 40 -+ -+/* -+ * The OS/2 maximum path name -+ */ -+#define MAX_PATHCONF 256 -+ -+/* -+ * SMB frame definitions (following must be packed structs) -+ * See the SNIA CIFS Specification for details. -+ * -+ * The Naming convention is the lower case version of the -+ * smb command code name for the struct and this is typedef to the -+ * uppercase version of the same name with the prefix SMB_ removed -+ * for brevity. Although typedefs are not commonly used for -+ * structure definitions in the Linux kernel, their use in the -+ * CIFS standards document, which this code is based on, may -+ * make this one of the cases where typedefs for structures make -+ * sense to improve readability for readers of the standards doc. -+ * Typedefs can always be removed later if they are too distracting -+ * and they are only used for the CIFSs PDUs themselves, not -+ * internal cifs vfs structures -+ * -+ */ -+ -+typedef struct negotiate_req { -+ struct smb_hdr hdr; /* wct = 0 */ -+ __u16 ByteCount; -+ unsigned char DialectsArray[1]; -+} NEGOTIATE_REQ; -+ -+typedef struct negotiate_rsp { -+ struct smb_hdr hdr; /* wct = 17 */ -+ __u16 DialectIndex; -+ __u8 SecurityMode; -+ __u16 MaxMpxCount; -+ __u16 MaxNumberVcs; -+ __u32 MaxBufferSize; -+ __u32 MaxRawSize; -+ __u32 SessionKey; -+ __u32 Capabilities; /* see below */ -+ __u32 SystemTimeLow; -+ __u32 SystemTimeHigh; -+ __u16 ServerTimeZone; -+ __u8 EncryptionKeyLength; -+ __u16 ByteCount; -+ union { -+ unsigned char EncryptionKey[1]; /* if cap extended security is off */ -+ /* followed by Domain name - if extended security is off */ -+ /* followed by 16 bytes of server GUID */ -+ /* followed by security blob if cap_extended_security negotiated */ -+ struct { -+ unsigned char GUID[16]; -+ unsigned char SecurityBlob[1]; -+ } extended_response; -+ } u; -+} NEGOTIATE_RSP; -+ -+/* SecurityMode bits */ -+#define SECMODE_USER 0x01 /* off indicates share level security */ -+#define SECMODE_PW_ENCRYPT 0x02 -+#define SECMODE_SIGN_ENABLED 0x04 /* SMB security signatures enabled */ -+#define SECMODE_SIGN_REQUIRED 0x08 /* SMB security signatures required */ -+ -+/* Negotiate response Capabilities */ -+#define CAP_RAW_MODE 0x00000001 -+#define CAP_MPX_MODE 0x00000002 -+#define CAP_UNICODE 0x00000004 -+#define CAP_LARGE_FILES 0x00000008 -+#define CAP_NT_SMBS 0x00000010 /* implies CAP_NT_FIND */ -+#define CAP_RPC_REMOTE_APIS 0x00000020 -+#define CAP_STATUS32 0x00000040 -+#define CAP_LEVEL_II_OPLOCKS 0x00000080 -+#define CAP_LOCK_AND_READ 0x00000100 -+#define CAP_NT_FIND 0x00000200 -+#define CAP_DFS 0x00001000 -+#define CAP_INFOLEVEL_PASSTHRU 0x00002000 -+#define CAP_LARGE_READ_X 0x00004000 -+#define CAP_LARGE_WRITE_X 0x00008000 -+#define CAP_UNIX 0x00800000 -+#define CAP_RESERVED 0x02000000 -+#define CAP_BULK_TRANSFER 0x20000000 -+#define CAP_COMPRESSED_DATA 0x40000000 -+#define CAP_EXTENDED_SECURITY 0x80000000 -+ -+typedef union smb_com_session_setup_andx { -+ struct { /* request format */ -+ struct smb_hdr hdr; /* wct = 12 */ -+ __u8 AndXCommand; -+ __u8 AndXReserved; -+ __u16 AndXOffset; -+ __u16 MaxBufferSize; -+ __u16 MaxMpxCount; -+ __u16 VcNumber; -+ __u32 SessionKey; -+ __u16 SecurityBlobLength; -+ __u32 Reserved; -+ __u32 Capabilities; /* see below */ -+ __u16 ByteCount; -+ unsigned char SecurityBlob[1]; /* followed by */ -+ /* STRING NativeOS */ -+ /* STRING NativeLanMan */ -+ } req; /* NTLM request format (with extended security */ -+ -+ struct { /* request format */ -+ struct smb_hdr hdr; /* wct = 13 */ -+ __u8 AndXCommand; -+ __u8 AndXReserved; -+ __u16 AndXOffset; -+ __u16 MaxBufferSize; -+ __u16 MaxMpxCount; -+ __u16 VcNumber; -+ __u32 SessionKey; -+ __u16 CaseInsensitivePasswordLength; /* ASCII password length */ -+ __u16 CaseSensitivePasswordLength; /* Unicode password length */ -+ __u32 Reserved; /* see below */ -+ __u32 Capabilities; -+ __u16 ByteCount; -+ unsigned char CaseInsensitivePassword[1]; /* followed by: */ -+ /* unsigned char * CaseSensitivePassword; */ -+ /* STRING AccountName */ -+ /* STRING PrimaryDomain */ -+ /* STRING NativeOS */ -+ /* STRING NativeLanMan */ -+ } req_no_secext; /* NTLM request format (without extended security */ -+ -+ struct { /* default (NTLM) response format */ -+ struct smb_hdr hdr; /* wct = 4 */ -+ __u8 AndXCommand; -+ __u8 AndXReserved; -+ __u16 AndXOffset; -+ __u16 Action; /* see below */ -+ __u16 SecurityBlobLength; -+ __u16 ByteCount; -+ unsigned char SecurityBlob[1]; /* followed by */ -+/* unsigned char * NativeOS; */ -+/* unsigned char * NativeLanMan; */ -+/* unsigned char * PrimaryDomain; */ -+ } resp; /* NTLM response format (with or without extended security */ -+ -+ struct { /* request format */ -+ struct smb_hdr hdr; /* wct = 10 */ -+ __u8 AndXCommand; -+ __u8 AndXReserved; -+ __u16 AndXOffset; -+ __u16 MaxBufferSize; -+ __u16 MaxMpxCount; -+ __u16 VcNumber; -+ __u32 SessionKey; -+ __u16 PassswordLength; -+ __u32 Reserved; -+ __u16 ByteCount; -+ unsigned char AccountPassword[1]; /* followed by */ -+ /* STRING AccountName */ -+ /* STRING PrimaryDomain */ -+ /* STRING NativeOS */ -+ /* STRING NativeLanMan */ -+ } old_req; /* pre-NTLM (LANMAN2.1) request format */ -+ -+ struct { /* default (NTLM) response format */ -+ struct smb_hdr hdr; /* wct = 3 */ -+ __u8 AndXCommand; -+ __u8 AndXReserved; -+ __u16 AndXOffset; -+ __u16 Action; /* see below */ -+ __u16 ByteCount; -+ unsigned char NativeOS[1]; /* followed by */ -+/* unsigned char * NativeLanMan; */ -+/* unsigned char * PrimaryDomain; */ -+ } old_resp; /* pre-NTLM (LANMAN2.1) response format */ -+} SESSION_SETUP_ANDX; -+ -+#define CIFS_NETWORK_OPSYS "CIFS VFS Client for Linux" -+ -+/* Capabilities bits (for NTLM SessSetup request) */ -+#define CAP_UNICODE 0x00000004 -+#define CAP_LARGE_FILES 0x00000008 -+#define CAP_NT_SMBS 0x00000010 -+#define CAP_STATUS32 0x00000040 -+#define CAP_LEVEL_II_OPLOCKS 0x00000080 -+#define CAP_NT_FIND 0x00000200 /* reserved should be zero (presumably because NT_SMBs implies the same thing) */ -+#define CAP_BULK_TRANSFER 0x20000000 -+#define CAP_EXTENDED_SECURITY 0x80000000 -+ -+/* Action bits */ -+#define GUEST_LOGIN 1 -+ -+typedef struct smb_com_tconx_req { -+ struct smb_hdr hdr; /* wct = 4 */ -+ __u8 AndXCommand; -+ __u8 AndXReserved; -+ __u16 AndXOffset; -+ __u16 Flags; /* see below */ -+ __u16 PasswordLength; -+ __u16 ByteCount; -+ unsigned char Password[1]; /* followed by */ -+/* STRING Path *//* \\server\share name */ -+ /* STRING Service */ -+} TCONX_REQ; -+ -+typedef struct smb_com_tconx_rsp { -+ struct smb_hdr hdr; /* wct = 3 *//* note that Win2000 has sent wct=7 in some cases on responses. Four unspecified words followed OptionalSupport */ -+ __u8 AndXCommand; -+ __u8 AndXReserved; -+ __u16 AndXOffset; -+ __u16 OptionalSupport; /* see below */ -+ __u16 ByteCount; -+ unsigned char Service[1]; /* always ASCII, not Unicode */ -+ /* STRING NativeFileSystem */ -+} TCONX_RSP; -+ -+/* tree connect Flags */ -+#define DISCONNECT_TID 0x0001 -+#define TCON_EXTENDED_SECINFO 0x0008 -+/* OptionalSupport bits */ -+#define SMB_SUPPORT_SEARCH_BITS 0x0001 /* must have bits (exclusive searches suppt. */ -+#define SMB_SHARE_IS_IN_DFS 0x0002 -+ -+typedef struct smb_com_logoff_andx_req { -+ -+ struct smb_hdr hdr; /* wct = 2 */ -+ __u8 AndXCommand; -+ __u8 AndXReserved; -+ __u16 AndXOffset; -+ __u16 ByteCount; -+} LOGOFF_ANDX_REQ; -+ -+typedef struct smb_com_logoff_andx_rsp { -+ struct smb_hdr hdr; /* wct = 2 */ -+ __u8 AndXCommand; -+ __u8 AndXReserved; -+ __u16 AndXOffset; -+ __u16 ByteCount; -+} LOGOFF_ANDX_RSP; -+ -+typedef union smb_com_tree_disconnect { /* as an altetnative can use flag on tree_connect PDU to effect disconnect *//* probably the simplest SMB PDU */ -+ struct { -+ struct smb_hdr hdr; /* wct = 0 */ -+ __u16 ByteCount; /* bcc = 0 */ -+ } req; -+ struct { -+ struct smb_hdr hdr; /* wct = 0 */ -+ __u16 ByteCount; /* bcc = 0 */ -+ } resp; -+} TREE_DISCONNECT; -+ -+typedef struct smb_com_close_req { -+ struct smb_hdr hdr; /* wct = 3 */ -+ __u16 FileID; -+ __u32 LastWriteTime; /* should be zero */ -+ __u16 ByteCount; /* 0 */ -+} CLOSE_REQ; -+ -+typedef struct smb_com_close_rsp { -+ struct smb_hdr hdr; /* wct = 0 */ -+ __u16 ByteCount; /* bct = 0 */ -+} CLOSE_RSP; -+ -+typedef struct smb_com_findclose_req { -+ struct smb_hdr hdr; /* wct = 1 */ -+ __u16 FileID; -+ __u16 ByteCount; /* 0 */ -+} FINDCLOSE_REQ; -+ -+/* OpenFlags */ -+#define REQ_OPLOCK 0x00000002 -+#define REQ_BATCHOPLOCK 0x00000004 -+#define REQ_OPENDIRONLY 0x00000008 -+ -+typedef struct smb_com_open_req { /* also handles create */ -+ struct smb_hdr hdr; /* wct = 24 */ -+ __u8 AndXCommand; -+ __u8 AndXReserved; -+ __u16 AndXOffset; -+ __u8 Reserved; /* Must Be Zero */ -+ __u16 NameLength; -+ __u32 OpenFlags; -+ __u32 RootDirectoryFid; -+ __u32 DesiredAccess; -+ __u64 AllocationSize; -+ __u32 FileAttributes; -+ __u32 ShareAccess; -+ __u32 CreateDisposition; -+ __u32 CreateOptions; -+ __u32 ImpersonationLevel; -+ __u8 SecurityFlags; -+ __u16 ByteCount; -+ char fileName[1]; -+} OPEN_REQ; -+ -+/* open response: oplock levels */ -+#define OPLOCK_NONE 0 -+#define OPLOCK_EXCLUSIVE 1 -+#define OPLOCK_BATCH 2 -+#define OPLOCK_READ 3 /* level 2 oplock */ -+ -+/* open response for CreateAction shifted left */ -+#define CIFS_CREATE_ACTION 0x20000 /* file created */ -+ -+typedef struct smb_com_open_rsp { -+ struct smb_hdr hdr; /* wct = 34 BB */ -+ __u8 AndXCommand; -+ __u8 AndXReserved; -+ __u16 AndXOffset; -+ __u8 OplockLevel; -+ __u16 Fid; -+ __u32 CreateAction; -+ __u64 CreationTime; -+ __u64 LastAccessTime; -+ __u64 LastWriteTime; -+ __u64 ChangeTime; -+ __u32 FileAttributes; -+ __u64 AllocationSize; -+ __u64 EndOfFile; -+ __u16 FileType; -+ __u16 DeviceState; -+ __u8 DirectoryFlag; -+ __u16 ByteCount; /* bct = 0 */ -+} OPEN_RSP; -+ -+typedef struct smb_com_write_req { -+ struct smb_hdr hdr; /* wct = 14 */ -+ __u8 AndXCommand; -+ __u8 AndXReserved; -+ __u16 AndXOffset; -+ __u16 Fid; -+ __u32 OffsetLow; -+ __u32 Reserved; -+ __u16 WriteMode; -+ __u16 Remaining; -+ __u16 DataLengthHigh; -+ __u16 DataLengthLow; -+ __u16 DataOffset; -+ __u32 OffsetHigh; -+ __u16 ByteCount; -+ __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ -+ char Data[1]; -+} WRITE_REQ; -+ -+typedef struct smb_com_write_rsp { -+ struct smb_hdr hdr; /* wct = 6 */ -+ __u8 AndXCommand; -+ __u8 AndXReserved; -+ __u16 AndXOffset; -+ __u16 Count; -+ __u16 Remaining; -+ __u32 Reserved; -+ __u16 ByteCount; -+} WRITE_RSP; -+ -+typedef struct smb_com_read_req { -+ struct smb_hdr hdr; /* wct = 12 */ -+ __u8 AndXCommand; -+ __u8 AndXReserved; -+ __u16 AndXOffset; -+ __u16 Fid; -+ __u32 OffsetLow; -+ __u16 MaxCount; -+ __u16 MinCount; /* obsolete */ -+ __u32 MaxCountHigh; -+ __u16 Remaining; -+ __u32 OffsetHigh; -+ __u16 ByteCount; -+} READ_REQ; -+ -+typedef struct smb_com_read_rsp { -+ struct smb_hdr hdr; /* wct = 12 */ -+ __u8 AndXCommand; -+ __u8 AndXReserved; -+ __u16 AndXOffset; -+ __u16 Remaining; -+ __u16 DataCompactionMode; -+ __u16 Reserved; -+ __u16 DataLength; -+ __u16 DataOffset; -+ __u16 DataLengthHigh; -+ __u64 Reserved2; -+ __u16 ByteCount; -+ __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ -+ char Data[1]; -+} READ_RSP; -+ -+typedef struct locking_andx_range { -+ __u16 Pid; -+ __u16 Pad; -+ __u32 OffsetHigh; -+ __u32 OffsetLow; -+ __u32 LengthHigh; -+ __u32 LengthLow; -+} LOCKING_ANDX_RANGE; -+ -+#define LOCKING_ANDX_SHARED_LOCK 0x01 -+#define LOCKING_ANDX_OPLOCK_RELEASE 0x02 -+#define LOCKING_ANDX_CHANGE_LOCKTYPE 0x04 -+#define LOCKING_ANDX_CANCEL_LOCK 0x08 -+#define LOCKING_ANDX_LARGE_FILES 0x10 /* always on for us */ -+ -+typedef struct smb_com_lock_req { -+ struct smb_hdr hdr; /* wct = 8 */ -+ __u8 AndXCommand; -+ __u8 AndXReserved; -+ __u16 AndXOffset; -+ __u16 Fid; -+ __u8 LockType; -+ __u8 OplockLevel; -+ __u32 Timeout; -+ __u16 NumberOfUnlocks; -+ __u16 NumberOfLocks; -+ __u16 ByteCount; -+ LOCKING_ANDX_RANGE Locks[1]; -+} LOCK_REQ; -+ -+typedef struct smb_com_lock_rsp { -+ struct smb_hdr hdr; /* wct = 2 */ -+ __u8 AndXCommand; -+ __u8 AndXReserved; -+ __u16 AndXOffset; -+ __u16 ByteCount; -+} LOCK_RSP; -+ -+typedef struct smb_com_rename_req { -+ struct smb_hdr hdr; /* wct = 1 */ -+ __u16 SearchAttributes; /* target file attributes */ -+ __u16 ByteCount; -+ __u8 BufferFormat; /* 4 = ASCII or Unicode */ -+ unsigned char OldFileName[1]; -+ /* followed by __u8 BufferFormat2 */ -+ /* followed by NewFileName */ -+} RENAME_REQ; -+ -+ /* copy request flags */ -+#define COPY_MUST_BE_FILE 0x0001 -+#define COPY_MUST_BE_DIR 0x0002 -+#define COPY_TARGET_MODE_ASCII 0x0004 /* if not set, binary */ -+#define COPY_SOURCE_MODE_ASCII 0x0008 /* if not set, binary */ -+#define COPY_VERIFY_WRITES 0x0010 -+#define COPY_TREE 0x0020 -+ -+typedef struct smb_com_copy_req { -+ struct smb_hdr hdr; /* wct = 3 */ -+ __u16 Tid2; -+ __u16 OpenFunction; -+ __u16 Flags; -+ __u16 ByteCount; -+ __u8 BufferFormat; /* 4 = ASCII or Unicode */ -+ unsigned char OldFileName[1]; -+ /* followed by __u8 BufferFormat2 */ -+ /* followed by NewFileName string */ -+} COPY_REQ; -+ -+typedef struct smb_com_copy_rsp { -+ struct smb_hdr hdr; /* wct = 1 */ -+ __u16 CopyCount; /* number of files copied */ -+ __u16 ByteCount; /* may be zero */ -+ __u8 BufferFormat; /* 0x04 - only present if errored file follows */ -+ unsigned char ErrorFileName[1]; /* only present if error in copy */ -+} COPY_RSP; -+ -+#define CREATE_HARD_LINK 0x103 -+#define MOVEFILE_COPY_ALLOWED 0x0002 -+#define MOVEFILE_REPLACE_EXISTING 0x0001 -+ -+typedef struct smb_com_nt_rename_req { /* A5 - also used for create hardlink */ -+ struct smb_hdr hdr; /* wct = 4 */ -+ __u16 SearchAttributes; /* target file attributes */ -+ __u16 Flags; /* spec says Information Level */ -+ __u32 ClusterCount; -+ __u16 ByteCount; -+ __u8 BufferFormat; /* 4 = ASCII or Unicode */ -+ unsigned char OldFileName[1]; -+ /* followed by __u8 BufferFormat2 */ -+ /* followed by NewFileName */ -+} NT_RENAME_REQ; -+ -+typedef struct smb_com_rename_rsp { -+ struct smb_hdr hdr; /* wct = 0 */ -+ __u16 ByteCount; /* bct = 0 */ -+} RENAME_RSP; -+ -+typedef struct smb_com_delete_file_req { -+ struct smb_hdr hdr; /* wct = 1 */ -+ __u16 SearchAttributes; -+ __u16 ByteCount; -+ __u8 BufferFormat; /* 4 = ASCII */ -+ unsigned char fileName[1]; -+} DELETE_FILE_REQ; -+ -+typedef struct smb_com_delete_file_rsp { -+ struct smb_hdr hdr; /* wct = 0 */ -+ __u16 ByteCount; /* bct = 0 */ -+} DELETE_FILE_RSP; -+ -+typedef struct smb_com_delete_directory_req { -+ struct smb_hdr hdr; /* wct = 0 */ -+ __u16 ByteCount; -+ __u8 BufferFormat; /* 4 = ASCII */ -+ unsigned char DirName[1]; -+} DELETE_DIRECTORY_REQ; -+ -+typedef struct smb_com_delete_directory_rsp { -+ struct smb_hdr hdr; /* wct = 0 */ -+ __u16 ByteCount; /* bct = 0 */ -+} DELETE_DIRECTORY_RSP; -+ -+typedef struct smb_com_create_directory_req { -+ struct smb_hdr hdr; /* wct = 0 */ -+ __u16 ByteCount; -+ __u8 BufferFormat; /* 4 = ASCII */ -+ unsigned char DirName[1]; -+} CREATE_DIRECTORY_REQ; -+ -+typedef struct smb_com_create_directory_rsp { -+ struct smb_hdr hdr; /* wct = 0 */ -+ __u16 ByteCount; /* bct = 0 */ -+} CREATE_DIRECTORY_RSP; -+ -+/***************************************************/ -+/* NT Transact structure defintions follow */ -+/* Currently only ioctl and notify are implemented */ -+/***************************************************/ -+typedef struct smb_com_transaction_ioctl_req { -+ struct smb_hdr hdr; /* wct = 23 */ -+ __u8 MaxSetupCount; -+ __u16 Reserved; -+ __u32 TotalParameterCount; -+ __u32 TotalDataCount; -+ __u32 MaxParameterCount; -+ __u32 MaxDataCount; -+ __u32 ParameterCount; -+ __u32 ParameterOffset; -+ __u32 DataCount; -+ __u32 DataOffset; -+ __u8 SetupCount; /* four setup words follow subcommand */ -+ /* SNIA spec incorrectly included spurious pad here */ -+ __u16 SubCommand;/* 2 = IOCTL/FSCTL */ -+ __u32 FunctionCode; -+ __u16 Fid; -+ __u8 IsFsctl; /* 1 = File System Control, 0 = device control (IOCTL)*/ -+ __u8 IsRootFlag; /* 1 = apply command to root of share (must be DFS share)*/ -+ __u16 ByteCount; -+ __u8 Pad[3]; -+ __u8 Data[1]; -+} TRANSACT_IOCTL_REQ; -+ -+typedef struct smb_com_transaction_ioctl_rsp { -+ struct smb_hdr hdr; /* wct = 19 */ -+ __u8 Reserved[3]; -+ __u32 TotalParameterCount; -+ __u32 TotalDataCount; -+ __u32 ParameterCount; -+ __u32 ParameterOffset; -+ __u32 ParameterDisplacement; -+ __u32 DataCount; -+ __u32 DataOffset; -+ __u32 DataDisplacement; -+ __u8 SetupCount; /* 1 */ -+ __u16 ReturnedDataLen; -+ __u16 ByteCount; -+ __u8 Pad[3]; -+} TRANSACT_IOCTL_RSP; -+ -+typedef struct smb_com_transaction_change_notify_req { -+ struct smb_hdr hdr; /* wct = 23 */ -+ __u8 MaxSetupCount; -+ __u16 Reserved; -+ __u32 TotalParameterCount; -+ __u32 TotalDataCount; -+ __u32 MaxParameterCount; -+ __u32 MaxDataCount; -+ __u32 ParameterCount; -+ __u32 ParameterOffset; -+ __u32 DataCount; -+ __u32 DataOffset; -+ __u8 SetupCount; /* four setup words follow subcommand */ -+ /* SNIA spec incorrectly included spurious pad here */ -+ __u16 SubCommand;/* 4 = Change Notify */ -+ __u32 CompletionFilter; /* operation to monitor */ -+ __u16 Fid; -+ __u8 WatchTree; /* 1 = Monitor subdirectories */ -+ __u8 Reserved2; -+ __u16 ByteCount; -+/* __u8 Pad[3];*/ -+/* __u8 Data[1];*/ -+} TRANSACT_CHANGE_NOTIFY_REQ; -+ -+typedef struct smb_com_transaction_change_notify_rsp { -+ struct smb_hdr hdr; /* wct = 18 */ -+ __u8 Reserved[3]; -+ __u32 TotalParameterCount; -+ __u32 TotalDataCount; -+ __u32 ParameterCount; -+ __u32 ParameterOffset; -+ __u32 ParameterDisplacement; -+ __u32 DataCount; -+ __u32 DataOffset; -+ __u32 DataDisplacement; -+ __u8 SetupCount; /* 0 */ -+ __u16 ByteCount; -+ /* __u8 Pad[3]; */ -+} TRANSACT_CHANGE_NOTIFY_RSP; -+/* Completion Filter flags for Notify */ -+#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001 -+#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002 -+#define FILE_NOTIFY_CHANGE_NAME 0x00000003 -+#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004 -+#define FILE_NOTIFY_CHANGE_SIZE 0x00000008 -+#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010 -+#define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020 -+#define FILE_NOTIFY_CHANGE_CREATION 0x00000040 -+#define FILE_NOTIFY_CHANGE_EA 0x00000080 -+#define FILE_NOTIFY_CHANGE_SECURITY 0x00000100 -+#define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200 -+#define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400 -+#define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800 -+ -+#define FILE_ACTION_ADDED 0x00000001 -+#define FILE_ACTION_REMOVED 0x00000002 -+#define FILE_ACTION_MODIFIED 0x00000003 -+#define FILE_ACTION_RENAMED_OLD_NAME 0x00000004 -+#define FILE_ACTION_RENAMED_NEW_NAME 0x00000005 -+#define FILE_ACTION_ADDED_STREAM 0x00000006 -+#define FILE_ACTION_REMOVED_STREAM 0x00000007 -+#define FILE_ACTION_MODIFIED_STREAM 0x00000008 -+ -+/* response contains array of the following structures */ -+struct file_notify_information { -+ __u32 NextEntryOffset; -+ __u32 Action; -+ __u32 FileNameLength; -+ __u8 FileName[1]; -+}; -+ -+struct reparse_data { -+ __u32 ReparseTag; -+ __u16 ReparseDataLength; -+ __u16 Reserved; -+ __u16 AltNameOffset; -+ __u16 AltNameLen; -+ __u16 TargetNameOffset; -+ __u16 TargetNameLen; -+ char LinkNamesBuf[1]; -+}; -+ -+struct cifs_quota_data { -+ __u32 rsrvd1; /* 0 */ -+ __u32 sid_size; -+ __u64 rsrvd2; /* 0 */ -+ __u64 space_used; -+ __u64 soft_limit; -+ __u64 hard_limit; -+ char sid[1]; /* variable size? */ -+}; -+ -+/* quota sub commands */ -+#define QUOTA_LIST_CONTINUE 0 -+#define QUOTA_LIST_START 0x100 -+#define QUOTA_FOR_SID 0x101 -+ -+typedef union smb_com_transaction2 { -+ struct { -+ struct smb_hdr hdr; /* wct = 14+ */ -+ __u16 TotalParameterCount; -+ __u16 TotalDataCount; -+ __u16 MaxParameterCount; -+ __u16 MaxDataCount; -+ __u8 MaxSetupCount; -+ __u8 Reserved; -+ __u16 Flags; -+ __u32 Timeout; -+ __u16 Reserved2; -+ __u16 ParameterCount; -+ __u16 ParameterOffset; -+ __u16 DataCount; -+ __u16 DataOffset; -+ __u8 SetupCount; -+ __u8 Reserved3; -+ __u16 SubCommand; /* 1st setup word - can be followed by SetupCount words */ -+ __u16 ByteCount; /* careful - setupcount is not always one */ -+ } req; -+ struct { -+ struct smb_hdr hdr; /* wct = 0 */ -+ __u16 TotalParameterCount; -+ __u16 TotalDataCount; -+ __u16 Reserved; -+ __u16 ParameterCount; -+ __u16 ParamterOffset; -+ __u16 ParameterDisplacement; -+ __u16 DataCount; -+ __u16 DataOffset; -+ __u16 DataDisplacement; -+ __u8 SetupCount; -+ __u8 Reserved1; /* should be zero setup words following */ -+ __u16 ByteCount; -+ __u16 Reserved2; /* parameter word reserved - present for infolevels > 100 */ -+ /* data area follows */ -+ } resp; -+} TRANSACTION2; -+ -+/* PathInfo/FileInfo infolevels */ -+#define SMB_INFO_STANDARD 1 -+#define SMB_INFO_QUERY_EAS_FROM_LIST 3 -+#define SMB_INFO_QUERY_ALL_EAS 4 -+#define SMB_INFO_IS_NAME_VALID 6 -+#define SMB_QUERY_FILE_BASIC_INFO 0x101 -+#define SMB_QUERY_FILE_STANDARD_INFO 0x102 -+#define SMB_QUERY_FILE_EA_INFO 0x103 -+#define SMB_QUERY_FILE_NAME_INFO 0x104 -+#define SMB_QUERY_FILE_ALLOCATION_INFO 0x105 -+#define SMB_QUERY_FILE_END_OF_FILEINFO 0x106 -+#define SMB_QUERY_FILE_ALL_INFO 0x107 -+#define SMB_QUERY_ALT_NAME_INFO 0x108 -+#define SMB_QUERY_FILE_STREAM_INFO 0x109 -+#define SMB_QUERY_FILE_COMPRESSION_INFO 0x10B -+#define SMB_QUERY_FILE_UNIX_BASIC 0x200 -+#define SMB_QUERY_FILE_UNIX_LINK 0x201 -+ -+#define SMB_SET_FILE_BASIC_INFO 0x101 -+#define SMB_SET_FILE_DISPOSITION_INFO 0x102 -+#define SMB_SET_FILE_ALLOCATION_INFO 0x103 -+#define SMB_SET_FILE_END_OF_FILE_INFO 0x104 -+#define SMB_SET_FILE_UNIX_BASIC 0x200 -+#define SMB_SET_FILE_UNIX_LINK 0x201 -+#define SMB_SET_FILE_UNIX_HLINK 0x203 -+#define SMB_SET_FILE_BASIC_INFO2 0x3ec -+#define SMB_SET_FILE_RENAME_INFORMATION 0x3f2 -+#define SMB_FILE_ALL_INFO2 0x3fa -+#define SMB_SET_FILE_ALLOCATION_INFO2 0x3fb -+#define SMB_SET_FILE_END_OF_FILE_INFO2 0x3fc -+#define SMB_FILE_MOVE_CLUSTER_INFO 0x407 -+#define SMB_FILE_QUOTA_INFO 0x408 -+#define SMB_FILE_REPARSEPOINT_INFO 0x409 -+#define SMB_FILE_MAXIMUM_INFO 0x40d -+ -+/* Find File infolevels */ -+#define SMB_FIND_FILE_DIRECTORY_INFO 0x101 -+#define SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102 -+#define SMB_FIND_FILE_NAMES_INFO 0x103 -+#define SMB_FIND_FILE_BOTH_DIRECTORY_INFO 0x104 -+#define SMB_FIND_FILE_UNIX 0x202 -+ -+typedef struct smb_com_transaction2_qpi_req { -+ struct smb_hdr hdr; /* wct = 14+ */ -+ __u16 TotalParameterCount; -+ __u16 TotalDataCount; -+ __u16 MaxParameterCount; -+ __u16 MaxDataCount; -+ __u8 MaxSetupCount; -+ __u8 Reserved; -+ __u16 Flags; -+ __u32 Timeout; -+ __u16 Reserved2; -+ __u16 ParameterCount; -+ __u16 ParameterOffset; -+ __u16 DataCount; -+ __u16 DataOffset; -+ __u8 SetupCount; -+ __u8 Reserved3; -+ __u16 SubCommand; /* one setup word */ -+ __u16 ByteCount; -+ __u8 Pad; -+ __u16 InformationLevel; -+ __u32 Reserved4; -+ char FileName[1]; -+} TRANSACTION2_QPI_REQ; -+ -+typedef struct smb_com_transaction2_qpi_rsp { -+ struct smb_hdr hdr; /* wct = 10 + SetupCount */ -+ __u16 TotalParameterCount; -+ __u16 TotalDataCount; -+ __u16 Reserved; -+ __u16 ParameterCount; -+ __u16 ParameterOffset; -+ __u16 ParameterDisplacement; -+ __u16 DataCount; -+ __u16 DataOffset; -+ __u16 DataDisplacement; -+ __u8 SetupCount; -+ __u8 Reserved1; /* should be zero setup words following */ -+ __u16 ByteCount; -+ __u16 Reserved2; /* parameter word reserved - present for infolevels > 100 */ -+} TRANSACTION2_QPI_RSP; -+ -+typedef struct smb_com_transaction2_spi_req { -+ struct smb_hdr hdr; /* wct = 15 */ -+ __u16 TotalParameterCount; -+ __u16 TotalDataCount; -+ __u16 MaxParameterCount; -+ __u16 MaxDataCount; -+ __u8 MaxSetupCount; -+ __u8 Reserved; -+ __u16 Flags; -+ __u32 Timeout; -+ __u16 Reserved2; -+ __u16 ParameterCount; -+ __u16 ParameterOffset; -+ __u16 DataCount; -+ __u16 DataOffset; -+ __u8 SetupCount; -+ __u8 Reserved3; -+ __u16 SubCommand; /* one setup word */ -+ __u16 ByteCount; -+ __u8 Pad; -+ __u16 Pad1; -+ __u16 InformationLevel; -+ __u32 Reserved4; -+ char FileName[1]; -+} TRANSACTION2_SPI_REQ; -+ -+typedef struct smb_com_transaction2_spi_rsp { -+ struct smb_hdr hdr; /* wct = 10 + SetupCount */ -+ __u16 TotalParameterCount; -+ __u16 TotalDataCount; -+ __u16 Reserved; -+ __u16 ParameterCount; -+ __u16 ParameterOffset; -+ __u16 ParameterDisplacement; -+ __u16 DataCount; -+ __u16 DataOffset; -+ __u16 DataDisplacement; -+ __u8 SetupCount; -+ __u8 Reserved1; /* should be zero setup words following */ -+ __u16 ByteCount; -+ __u16 Reserved2; /* parameter word reserved - present for infolevels > 100 */ -+} TRANSACTION2_SPI_RSP; -+ -+struct set_file_rename { -+ __u32 overwrite; /* 1 = overwrite dest */ -+ __u32 root_fid; /* zero */ -+ __u32 target_name_len; -+ char target_name[0]; /* Must be unicode */ -+}; -+ -+struct smb_com_transaction2_sfi_req { -+ struct smb_hdr hdr; /* wct = 15 */ -+ __u16 TotalParameterCount; -+ __u16 TotalDataCount; -+ __u16 MaxParameterCount; -+ __u16 MaxDataCount; -+ __u8 MaxSetupCount; -+ __u8 Reserved; -+ __u16 Flags; -+ __u32 Timeout; -+ __u16 Reserved2; -+ __u16 ParameterCount; -+ __u16 ParameterOffset; -+ __u16 DataCount; -+ __u16 DataOffset; -+ __u8 SetupCount; -+ __u8 Reserved3; -+ __u16 SubCommand; /* one setup word */ -+ __u16 ByteCount; -+ __u8 Pad; -+ __u16 Pad1; -+ __u16 Fid; -+ __u16 InformationLevel; -+ __u16 Reserved4; -+}; -+ -+struct smb_com_transaction2_sfi_rsp { -+ struct smb_hdr hdr; /* wct = 10 + SetupCount */ -+ __u16 TotalParameterCount; -+ __u16 TotalDataCount; -+ __u16 Reserved; -+ __u16 ParameterCount; -+ __u16 ParameterOffset; -+ __u16 ParameterDisplacement; -+ __u16 DataCount; -+ __u16 DataOffset; -+ __u16 DataDisplacement; -+ __u8 SetupCount; -+ __u8 Reserved1; /* should be zero setup words following */ -+ __u16 ByteCount; -+ __u16 Reserved2; /* parameter word reserved - present for infolevels > 100 */ -+}; -+ -+ -+/* -+ * Flags on T2 FINDFIRST and FINDNEXT -+ */ -+#define CIFS_SEARCH_CLOSE_ALWAYS 0x0001 -+#define CIFS_SEARCH_CLOSE_AT_END 0x0002 -+#define CIFS_SEARCH_RETURN_RESUME 0x0004 -+#define CIFS_SEARCH_CONTINUE_FROM_LAST 0x0008 -+#define CIFS_SEARCH_BACKUP_SEARCH 0x0010 -+ -+/* -+ * Size of the resume key on FINDFIRST and FINDNEXT calls -+ */ -+#define CIFS_SMB_RESUME_KEY_SIZE 4 -+ -+typedef struct smb_com_transaction2_ffirst_req { -+ struct smb_hdr hdr; /* wct = 15 */ -+ __u16 TotalParameterCount; -+ __u16 TotalDataCount; -+ __u16 MaxParameterCount; -+ __u16 MaxDataCount; -+ __u8 MaxSetupCount; -+ __u8 Reserved; -+ __u16 Flags; -+ __u32 Timeout; -+ __u16 Reserved2; -+ __u16 ParameterCount; -+ __u16 ParameterOffset; -+ __u16 DataCount; -+ __u16 DataOffset; -+ __u8 SetupCount; /* one */ -+ __u8 Reserved3; -+ __u16 SubCommand; /* TRANS2_FIND_FIRST */ -+ __u16 ByteCount; -+ __u8 Pad; -+ __u16 SearchAttributes; -+ __u16 SearchCount; -+ __u16 SearchFlags; -+ __u16 InformationLevel; -+ __u32 SearchStorageType; -+ char FileName[1]; -+} TRANSACTION2_FFIRST_REQ; -+ -+typedef struct smb_com_transaction2_ffirst_rsp { -+ struct smb_hdr hdr; /* wct = 10 */ -+ __u16 TotalParameterCount; -+ __u16 TotalDataCount; -+ __u16 Reserved; -+ __u16 ParameterCount; -+ __u16 ParameterOffset; -+ __u16 ParameterDisplacement; -+ __u16 DataCount; -+ __u16 DataOffset; -+ __u16 DataDisplacement; -+ __u8 SetupCount; -+ __u8 Reserved1; /* should be zero setup words following */ -+ __u16 ByteCount; -+} TRANSACTION2_FFIRST_RSP; -+ -+typedef struct smb_com_transaction2_ffirst_rsp_parms { -+ __u16 SearchHandle; -+ __u16 SearchCount; -+ __u16 EndofSearch; -+ __u16 EAErrorOffset; -+ __u16 LastNameOffset; -+} T2_FFIRST_RSP_PARMS; -+ -+typedef struct smb_com_transaction2_fnext_req { -+ struct smb_hdr hdr; /* wct = 15 */ -+ __u16 TotalParameterCount; -+ __u16 TotalDataCount; -+ __u16 MaxParameterCount; -+ __u16 MaxDataCount; -+ __u8 MaxSetupCount; -+ __u8 Reserved; -+ __u16 Flags; -+ __u32 Timeout; -+ __u16 Reserved2; -+ __u16 ParameterCount; -+ __u16 ParameterOffset; -+ __u16 DataCount; -+ __u16 DataOffset; -+ __u8 SetupCount; /* one */ -+ __u8 Reserved3; -+ __u16 SubCommand; /* TRANS2_FIND_NEXT */ -+ __u16 ByteCount; -+ __u8 Pad; -+ __u16 SearchHandle; -+ __u16 SearchCount; -+ __u16 InformationLevel; -+ __u32 ResumeKey; -+ __u16 SearchFlags; -+ char ResumeFileName[1]; -+} TRANSACTION2_FNEXT_REQ; -+ -+typedef struct smb_com_transaction2_fnext_rsp { -+ struct smb_hdr hdr; /* wct = 10 */ -+ __u16 TotalParameterCount; -+ __u16 TotalDataCount; -+ __u16 Reserved; -+ __u16 ParameterCount; -+ __u16 ParameterOffset; -+ __u16 ParameterDisplacement; -+ __u16 DataCount; -+ __u16 DataOffset; -+ __u16 DataDisplacement; -+ __u8 SetupCount; -+ __u8 Reserved1; /* should be zero setup words following */ -+ __u16 ByteCount; -+} TRANSACTION2_FNEXT_RSP; -+ -+typedef struct smb_com_transaction2_fnext_rsp_parms { -+ __u16 SearchCount; -+ __u16 EndofSearch; -+ __u16 EAErrorOffset; -+ __u16 LastNameOffset; -+} T2_FNEXT_RSP_PARMS; -+ -+/* QFSInfo Levels */ -+#define SMB_INFO_ALLOCATION 1 -+#define SMB_INFO_VOLUME 2 -+#define SMB_QUERY_FS_VOLUME_INFO 0x102 -+#define SMB_QUERY_FS_SIZE_INFO 0x103 -+#define SMB_QUERY_FS_DEVICE_INFO 0x104 -+#define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105 -+#define SMB_QUERY_CIFS_UNIX_INFO 0x200 -+#define SMB_QUERY_LABEL_INFO 0x3ea -+#define SMB_QUERY_FS_QUOTA_INFO 0x3ee -+ -+typedef struct smb_com_transaction2_qfsi_req { -+ struct smb_hdr hdr; /* wct = 14+ */ -+ __u16 TotalParameterCount; -+ __u16 TotalDataCount; -+ __u16 MaxParameterCount; -+ __u16 MaxDataCount; -+ __u8 MaxSetupCount; -+ __u8 Reserved; -+ __u16 Flags; -+ __u32 Timeout; -+ __u16 Reserved2; -+ __u16 ParameterCount; -+ __u16 ParameterOffset; -+ __u16 DataCount; -+ __u16 DataOffset; -+ __u8 SetupCount; -+ __u8 Reserved3; -+ __u16 SubCommand; /* one setup word */ -+ __u16 ByteCount; -+ __u8 Pad; -+ __u16 InformationLevel; -+} TRANSACTION2_QFSI_REQ; -+ -+typedef struct smb_com_transaction_qfsi_rsp { -+ struct smb_hdr hdr; /* wct = 10 + SetupCount */ -+ __u16 TotalParameterCount; -+ __u16 TotalDataCount; -+ __u16 Reserved; -+ __u16 ParameterCount; -+ __u16 ParameterOffset; -+ __u16 ParameterDisplacement; -+ __u16 DataCount; -+ __u16 DataOffset; -+ __u16 DataDisplacement; -+ __u8 SetupCount; -+ __u8 Reserved1; /* should be zero setup words following */ -+ __u16 ByteCount; -+ __u8 Pad; /* may be three bytes *//* followed by data area */ -+} TRANSACTION2_QFSI_RSP; -+ -+typedef struct smb_com_transaction2_get_dfs_refer_req { -+ struct smb_hdr hdr; /* wct = 15 */ -+ __u16 TotalParameterCount; -+ __u16 TotalDataCount; -+ __u16 MaxParameterCount; -+ __u16 MaxDataCount; -+ __u8 MaxSetupCount; -+ __u8 Reserved; -+ __u16 Flags; -+ __u32 Timeout; -+ __u16 Reserved2; -+ __u16 ParameterCount; -+ __u16 ParameterOffset; -+ __u16 DataCount; -+ __u16 DataOffset; -+ __u8 SetupCount; -+ __u8 Reserved3; -+ __u16 SubCommand; /* one setup word */ -+ __u16 ByteCount; -+ __u8 Pad[3]; /* Win2K has sent 0x0F01 (max resp length perhaps?) followed by one byte pad - doesn't seem to matter though */ -+ __u16 MaxReferralLevel; -+ char RequestFileName[1]; -+} TRANSACTION2_GET_DFS_REFER_REQ; -+ -+typedef struct dfs_referral_level_3 { -+ __u16 VersionNumber; -+ __u16 ReferralSize; -+ __u16 ServerType; /* 0x0001 = CIFS server */ -+ __u16 ReferralFlags; /* or proximity - not clear which since always set to zero - SNIA spec says 0x01 means strip off PathConsumed chars before submitting RequestFileName to remote node */ -+ __u16 TimeToLive; -+ __u16 Proximity; -+ __u16 DfsPathOffset; -+ __u16 DfsAlternatePathOffset; -+ __u16 NetworkAddressOffset; -+} REFERRAL3; -+ -+typedef struct smb_com_transaction_get_dfs_refer_rsp { -+ struct smb_hdr hdr; /* wct = 10 */ -+ __u16 TotalParameterCount; -+ __u16 TotalDataCount; -+ __u16 Reserved; -+ __u16 ParameterCount; -+ __u16 ParameterOffset; -+ __u16 ParameterDisplacement; -+ __u16 DataCount; -+ __u16 DataOffset; -+ __u16 DataDisplacement; -+ __u8 SetupCount; -+ __u8 Reserved1; /* zero setup words following */ -+ __u16 ByteCount; -+ __u8 Pad; -+ __u16 PathConsumed; -+ __u16 NumberOfReferrals; -+ __u16 DFSFlags; -+ __u16 Pad2; -+ REFERRAL3 referrals[1]; /* array of level 3 dfs_referral structures */ -+ /* followed by the strings pointed to by the referral structures */ -+} TRANSACTION2_GET_DFS_REFER_RSP; -+ -+/* DFS Flags */ -+#define DFSREF_REFERRAL_SERVER 0x0001 -+#define DFSREF_STORAGE_SERVER 0x0002 -+ -+/* IOCTL information */ -+/* List of ioctl function codes that look to be of interest to remote clients like this. */ -+/* Need to do some experimentation to make sure they all work remotely. */ -+/* Some of the following such as the encryption/compression ones would be */ -+/* invoked from tools via a specialized hook into the VFS rather than via the */ -+/* standard vfs entry points */ -+#define FSCTL_REQUEST_OPLOCK_LEVEL_1 0x00090000 -+#define FSCTL_REQUEST_OPLOCK_LEVEL_2 0x00090004 -+#define FSCTL_REQUEST_BATCH_OPLOCK 0x00090008 -+#define FSCTL_LOCK_VOLUME 0x00090018 -+#define FSCTL_UNLOCK_VOLUME 0x0009001C -+#define FSCTL_GET_COMPRESSION 0x0009003C -+#define FSCTL_SET_COMPRESSION 0x0009C040 -+#define FSCTL_REQUEST_FILTER_OPLOCK 0x0009008C -+#define FSCTL_FILESYS_GET_STATISTICS 0x00090090 -+#define FSCTL_SET_REPARSE_POINT 0x000900A4 -+#define FSCTL_GET_REPARSE_POINT 0x000900A8 -+#define FSCTL_DELETE_REPARSE_POINT 0x000900AC -+#define FSCTL_SET_SPARSE 0x000900C4 -+#define FSCTL_SET_ZERO_DATA 0x000900C8 -+#define FSCTL_SET_ENCRYPTION 0x000900D7 -+#define FSCTL_ENCRYPTION_FSCTL_IO 0x000900DB -+#define FSCTL_WRITE_RAW_ENCRYPTED 0x000900DF -+#define FSCTL_READ_RAW_ENCRYPTED 0x000900E3 -+#define FSCTL_SIS_COPYFILE 0x00090100 -+#define FSCTL_SIS_LINK_FILES 0x0009C104 -+ -+#define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003 -+#define IO_REPARSE_TAG_HSM 0xC0000004 -+#define IO_REPARSE_TAG_SIS 0x80000007 -+ -+/* -+ ************************************************************************ -+ * All structs for everything above the SMB PDUs themselves -+ * (such as the T2 level specific data) go here -+ ************************************************************************ -+ */ -+ -+/* -+ * Information on a server -+ */ -+ -+struct serverInfo { -+ char name[16]; -+ unsigned char versionMajor; -+ unsigned char versionMinor; -+ unsigned long type; -+ unsigned int commentOffset; -+}; -+ -+/* -+ * The following structure is the format of the data returned on a NetShareEnum -+ * with level "90" (x5A) -+ */ -+ -+struct shareInfo { -+ char shareName[13]; -+ char pad; -+ unsigned short type; -+ unsigned int commentOffset; -+}; -+ -+struct aliasInfo { -+ char aliasName[9]; -+ char pad; -+ unsigned int commentOffset; -+ unsigned char type[2]; -+}; -+ -+struct aliasInfo92 { -+ int aliasNameOffset; -+ int serverNameOffset; -+ int shareNameOffset; -+}; -+ -+typedef struct { -+ __u64 TotalAllocationUnits; -+ __u64 FreeAllocationUnits; -+ __u32 SectorsPerAllocationUnit; -+ __u32 BytesPerSector; -+} FILE_SYSTEM_INFO; /* size info, level 0x103 */ -+ -+typedef struct { -+ __u16 MajorVersionNumber; -+ __u16 MinorVersionNumber; -+ __u64 Capability; -+} FILE_SYSTEM_UNIX_INFO; /* Unix extensions info, level 0x200 */ -+/* Linux/Unix extensions capability flags */ -+#define CIFS_UNIX_FCNTL_CAP 0x00000001 /* support for fcntl locks */ -+#define CIFS_UNIX_POSIX_ACL_CAP 0x00000002 -+ -+/* DeviceType Flags */ -+#define FILE_DEVICE_CD_ROM 0x00000002 -+#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 -+#define FILE_DEVICE_DFS 0x00000006 -+#define FILE_DEVICE_DISK 0x00000007 -+#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 -+#define FILE_DEVICE_FILE_SYSTEM 0x00000009 -+#define FILE_DEVICE_NAMED_PIPE 0x00000011 -+#define FILE_DEVICE_NETWORK 0x00000012 -+#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014 -+#define FILE_DEVICE_NULL 0x00000015 -+#define FILE_DEVICE_PARALLEL_PORT 0x00000016 -+#define FILE_DEVICE_PRINTER 0x00000018 -+#define FILE_DEVICE_SERIAL_PORT 0x0000001b -+#define FILE_DEVICE_STREAMS 0x0000001e -+#define FILE_DEVICE_TAPE 0x0000001f -+#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020 -+#define FILE_DEVICE_VIRTUAL_DISK 0x00000024 -+#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 -+ -+typedef struct { -+ __u32 DeviceType; -+ __u32 DeviceCharacteristics; -+} FILE_SYSTEM_DEVICE_INFO; /* device info, level 0x104 */ -+ -+typedef struct { -+ __u32 Attributes; -+ __u32 MaxPathNameComponentLength; -+ __u32 FileSystemNameLen; -+ char FileSystemName[52]; /* do not really need to save this - so potentially get only subset of name */ -+} FILE_SYSTEM_ATTRIBUTE_INFO; -+ -+typedef struct { /* data block encoding of response to level 263 QPathInfo */ -+ __u64 CreationTime; -+ __u64 LastAccessTime; -+ __u64 LastWriteTime; -+ __u64 ChangeTime; -+ __u32 Attributes; -+ __u32 Pad1; -+ __u64 AllocationSize; -+ __u64 EndOfFile; /* size ie offset to first free byte in file */ -+ __u32 NumberOfLinks; /* hard links */ -+ __u8 DeletePending; -+ __u8 Directory; -+ __u16 Pad2; -+ __u64 IndexNumber; -+ __u32 EASize; -+ __u32 AccessFlags; -+ __u64 IndexNumber1; -+ __u64 CurrentByteOffset; -+ __u32 Mode; -+ __u32 AlignmentRequirement; -+ __u32 FileNameLength; -+ char FileName[1]; -+} FILE_ALL_INFO; /* level 263 QPathInfo */ -+ -+typedef struct { -+ __u64 EndOfFile; -+ __u64 NumOfBytes; -+ __u64 LastStatusChange; /*SNIA spec says DCE time for the three time fields */ -+ __u64 LastAccessTime; -+ __u64 LastModificationTime; -+ __u64 Uid; -+ __u64 Gid; -+ __u32 Type; -+ __u64 DevMajor; -+ __u64 DevMinor; -+ __u64 UniqueId; -+ __u64 Permissions; -+ __u64 Nlinks; -+} FILE_UNIX_BASIC_INFO; /* level 512 QPathInfo */ -+ -+typedef struct { -+ char LinkDest[1]; -+} FILE_UNIX_LINK_INFO; /* level 513 QPathInfo */ -+ -+/* defines for enumerating possible values of the Unix type field below */ -+#define UNIX_FILE 0 -+#define UNIX_DIR 1 -+#define UNIX_SYMLINK 2 -+#define UNIX_CHARDEV 3 -+#define UNIX_BLOCKDEV 4 -+#define UNIX_FIFO 5 -+#define UNIX_SOCKET 6 -+ -+typedef struct { -+ __u32 NextEntryOffset; -+ __u32 ResumeKey; -+ __u64 EndOfFile; -+ __u64 NumOfBytes; -+ __u64 LastStatusChange; /*SNIA spec says DCE time for the three time fields */ -+ __u64 LastAccessTime; -+ __u64 LastModificationTime; -+ __u64 Uid; -+ __u64 Gid; -+ __u32 Type; -+ __u64 DevMajor; -+ __u64 DevMinor; -+ __u64 UniqueId; -+ __u64 Permissions; -+ __u64 Nlinks; -+ char FileName[1]; -+} FILE_UNIX_INFO; -+ -+typedef struct { -+ __u64 CreationTime; -+ __u64 LastAccessTime; -+ __u64 LastWriteTime; -+ __u64 ChangeTime; -+ __u32 Attributes; -+ __u32 Pad; -+} FILE_BASIC_INFO; /* size info, level 0x101 */ -+ -+struct file_allocation_info { -+ __u64 AllocationSize; -+}; /* size info, level 0x103 */ -+ -+struct file_end_of_file_info { -+ __u64 FileSize; /* offset to end of file */ -+}; /* size info, level 0x104 */ -+ -+typedef struct { -+ __u32 NextEntryOffset; -+ __u32 FileIndex; -+ __u64 CreationTime; -+ __u64 LastAccessTime; -+ __u64 LastWriteTime; -+ __u64 ChangeTime; -+ __u64 EndOfFile; -+ __u64 AllocationSize; -+ __u32 ExtFileAttributes; -+ __u32 FileNameLength; -+ char FileName[1]; -+} FILE_DIRECTORY_INFO; /* level 257 FF response data area */ -+ -+struct gea { -+ unsigned char cbName; -+ char szName[1]; -+}; -+ -+struct gealist { -+ unsigned long cbList; -+ struct gea list[1]; -+}; -+ -+struct fea { -+ unsigned char EA_flags; -+ __u8 name_len; -+ __u16 value_len; -+ char szName[1]; -+ /* optionally followed by value */ -+}; -+/* flags for _FEA.fEA */ -+#define FEA_NEEDEA 0x80 /* need EA bit */ -+ -+struct fealist { -+ __u32 list_len; -+ struct fea list[1]; -+}; -+ -+/* used to hold an arbitrary blob of data */ -+struct data_blob { -+ __u8 *data; -+ size_t length; -+ void (*free) (struct data_blob * data_blob); -+}; -+ -+#ifdef CONFIG_CIFS_POSIX -+/* -+ For better POSIX semantics from Linux client, (even better -+ than the existing CIFS Unix Extensions) we need updated PDUs for: -+ -+ 1) PosixCreateX - to set and return the mode, inode#, device info and -+ perhaps add a CreateDevice - to create Pipes and other special .inodes -+ Also note POSIX open flags -+ 2) Close - to return the last write time to do cache across close more safely -+ 3) PosixQFSInfo - to return statfs info -+ 4) FindFirst return unique inode number - what about resume key, two forms short (matches readdir) and full (enough info to cache inodes) -+ 5) Mkdir - set mode -+ -+ And under consideration: -+ 6) FindClose2 (return nanosecond timestamp ??) -+ 7) Use nanosecond timestamps throughout all time fields if -+ corresponding attribute flag is set -+ 8) sendfile - handle based copy -+ 9) Direct i/o -+ 10) "POSIX ACL" support -+ 11) Misc fcntls? -+ -+ what about fixing 64 bit alignment -+ -+ There are also various legacy SMB/CIFS requests used as is -+ -+ From existing Lanman and NTLM dialects: -+ -------------------------------------- -+ NEGOTIATE -+ SESSION_SETUP_ANDX (BB which?) -+ TREE_CONNECT_ANDX (BB which wct?) -+ TREE_DISCONNECT (BB add volume timestamp on response) -+ LOGOFF_ANDX -+ DELETE (note delete open file behavior) -+ DELETE_DIRECTORY -+ READ_AND_X -+ WRITE_AND_X -+ LOCKING_AND_X (note posix lock semantics) -+ RENAME (note rename across dirs and open file rename posix behaviors) -+ NT_RENAME (for hardlinks) Is this good enough for all features? -+ FIND_CLOSE2 -+ TRANSACTION2 (18 cases) -+ SMB_SET_FILE_END_OF_FILE_INFO2 SMB_SET_PATH_END_OF_FILE_INFO2 -+ (BB verify that never need to set allocation size) -+ SMB_SET_FILE_BASIC_INFO2 (setting times - BB can it be done via Unix ext?) -+ -+ COPY (note support for copy across directories) - FUTURE, OPTIONAL -+ setting/getting OS/2 EAs - FUTURE (BB can this handle -+ setting Linux xattrs perfectly) - OPTIONAL -+ dnotify - FUTURE, OPTIONAL -+ quota - FUTURE, OPTIONAL -+ -+ Note that various requests implemented for NT interop such as -+ NT_TRANSACT (IOCTL) QueryReparseInfo -+ are unneeded to servers compliant with the CIFS POSIX extensions -+ -+ From CIFS Unix Extensions: -+ ------------------------- -+ T2 SET_PATH_INFO (SMB_SET_FILE_UNIX_LINK) for symlinks -+ T2 SET_PATH_INFO (SMB_SET_FILE_BASIC_INFO2) -+ T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_LINK) -+ T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_BASIC) - BB check for missing inode fields -+ Actually need QUERY_FILE_UNIX_INFO since has inode num -+ BB what about a) blksize/blkbits/blocks -+ b) i_version -+ c) i_rdev -+ d) notify mask? -+ e) generation -+ f) size_seqcount -+ T2 FIND_FIRST/FIND_NEXT FIND_FILE_UNIX -+ TRANS2_GET_DFS_REFERRAL - OPTIONAL but recommended -+ T2_QFS_INFO QueryDevice/AttributeInfo - OPTIONAL -+ -+ -+ */ -+#endif -+ -+#pragma pack() /* resume default structure packing */ -+ -+#endif /* _CIFSPDU_H */ -diff -urN linux-2.4.29.old/fs/cifs/cifsproto.h linux-2.4.29/fs/cifs/cifsproto.h ---- linux-2.4.29.old/fs/cifs/cifsproto.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/cifsproto.h 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,254 @@ -+/* -+ * fs/cifs/cifsproto.h -+ * -+ * Copyright (c) International Business Machines Corp., 2002 -+ * Author(s): Steve French (sfrench@us.ibm.com) -+ * -+ * This library is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This library 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 Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+#ifndef _CIFSPROTO_H -+#define _CIFSPROTO_H -+#include -+ -+struct statfs; -+ -+/* -+ ***************************************************************** -+ * All Prototypes -+ ***************************************************************** -+ */ -+ -+extern struct smb_hdr *cifs_buf_get(void); -+extern void cifs_buf_release(void *); -+extern int smb_send(struct socket *, struct smb_hdr *, -+ unsigned int /* length */ , struct sockaddr *); -+extern unsigned int _GetXid(void); -+extern void _FreeXid(unsigned int); -+#define GetXid() (int)_GetXid(); cFYI(1,("CIFS VFS: in %s as Xid: %d with uid: %d",__FUNCTION__, xid,current->fsuid)); -+#define FreeXid(curr_xid) {_FreeXid(curr_xid); cFYI(1,("CIFS VFS: leaving %s (xid = %d) rc = %d",__FUNCTION__,curr_xid,rc));} -+extern char *build_path_from_dentry(struct dentry *); -+extern char *build_wildcard_path_from_dentry(struct dentry *direntry); -+extern void renew_parental_timestamps(struct dentry *direntry); -+extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *, -+ struct smb_hdr * /* input */ , -+ struct smb_hdr * /* out */ , -+ int * /* bytes returned */ , const int long_op); -+extern int checkSMBhdr(struct smb_hdr *smb, __u16 mid); -+extern int checkSMB(struct smb_hdr *smb, __u16 mid, int length); -+extern int is_valid_oplock_break(struct smb_hdr *smb); -+extern unsigned int smbCalcSize(struct smb_hdr *ptr); -+extern int decode_negTokenInit(unsigned char *security_blob, int length, -+ enum securityEnum *secType); -+extern int map_smb_to_linux_error(struct smb_hdr *smb); -+extern void header_assemble(struct smb_hdr *, char /* command */ , -+ const struct cifsTconInfo *, int -+ /* length of fixed section (word count) in two byte units */ -+ ); -+struct oplock_q_entry * AllocOplockQEntry(struct inode *, u16, struct cifsTconInfo *); -+void DeleteOplockQEntry(struct oplock_q_entry *); -+extern time_t cifs_NTtimeToUnix(u64 /* utc nanoseconds since 1601 */ ); -+extern u64 cifs_UnixTimeToNT(time_t); -+extern int cifs_get_inode_info(struct inode **pinode, -+ const unsigned char *search_path, -+ FILE_ALL_INFO * pfile_info, -+ struct super_block *sb, int xid); -+extern int cifs_get_inode_info_unix(struct inode **pinode, -+ const unsigned char *search_path, -+ struct super_block *sb,int xid); -+ -+extern int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo, -+ struct nls_table * nls_info); -+extern int CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses); -+ -+extern int CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, -+ const char *tree, struct cifsTconInfo *tcon, -+ const struct nls_table *); -+ -+extern int CIFSFindFirst(const int xid, struct cifsTconInfo *tcon, -+ const char *searchName, -+ FILE_DIRECTORY_INFO * findData, -+ T2_FFIRST_RSP_PARMS * findParms, -+ const struct nls_table *nls_codepage, -+ int *pUnicodeFlag, -+ int *pUnixFlag /* if Unix extensions used */ ); -+extern int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, -+ FILE_DIRECTORY_INFO * findData, -+ T2_FNEXT_RSP_PARMS * findParms, -+ const __u16 searchHandle, char * resume_name, -+ int name_length, __u32 resume_key, -+ int *UnicodeFlag, int *pUnixFlag); -+ -+extern int CIFSFindClose(const int, struct cifsTconInfo *tcon, -+ const __u16 search_handle); -+ -+extern int CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon, -+ const unsigned char *searchName, -+ FILE_ALL_INFO * findData, -+ const struct nls_table *nls_codepage); -+ -+extern int CIFSSMBUnixQPathInfo(const int xid, -+ struct cifsTconInfo *tcon, -+ const unsigned char *searchName, -+ FILE_UNIX_BASIC_INFO * pFindData, -+ const struct nls_table *nls_codepage); -+ -+extern int CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses, -+ const unsigned char *searchName, -+ unsigned char **targetUNCs, -+ unsigned int *number_of_UNC_in_array, -+ const struct nls_table *nls_codepage); -+ -+extern int connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo, -+ const char *old_path, -+ const struct nls_table *nls_codepage); -+extern int get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, -+ const char *old_path, const struct nls_table *nls_codepage, -+ unsigned int *pnum_referrals, unsigned char ** preferrals); -+extern int CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon, -+ struct statfs *FSData, -+ const struct nls_table *nls_codepage); -+extern int CIFSSMBQFSAttributeInfo(const int xid, -+ struct cifsTconInfo *tcon, -+ const struct nls_table *nls_codepage); -+extern int CIFSSMBQFSDeviceInfo(const int xid, struct cifsTconInfo *tcon, -+ const struct nls_table *nls_codepage); -+extern int CIFSSMBQFSUnixInfo(const int xid, struct cifsTconInfo *tcon, -+ const struct nls_table *nls_codepage); -+ -+extern int CIFSSMBSetTimes(const int xid, struct cifsTconInfo *tcon, -+ char *fileName, FILE_BASIC_INFO * data, -+ const struct nls_table *nls_codepage); -+extern int CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, -+ char *fileName, __u64 size,int setAllocationSizeFlag, -+ const struct nls_table *nls_codepage); -+extern int CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, -+ __u64 size, __u16 fileHandle,__u32 opener_pid, int AllocSizeFlag); -+extern int CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *pTcon, -+ char *full_path, __u64 mode, __u64 uid, -+ __u64 gid, dev_t dev, const struct nls_table *nls_codepage); -+ -+extern int CIFSSMBMkDir(const int xid, struct cifsTconInfo *tcon, -+ const char *newName, -+ const struct nls_table *nls_codepage); -+extern int CIFSSMBRmDir(const int xid, struct cifsTconInfo *tcon, -+ const char *name, const struct nls_table *nls_codepage); -+ -+extern int CIFSSMBDelFile(const int xid, struct cifsTconInfo *tcon, -+ const char *name, -+ const struct nls_table *nls_codepage); -+extern int CIFSSMBRename(const int xid, struct cifsTconInfo *tcon, -+ const char *fromName, const char *toName, -+ const struct nls_table *nls_codepage); -+extern int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon, -+ int netfid, char * target_name, const struct nls_table *nls_codepage); -+extern int CIFSCreateHardLink(const int xid, -+ struct cifsTconInfo *tcon, -+ const char *fromName, const char *toName, -+ const struct nls_table *nls_codepage); -+extern int CIFSUnixCreateHardLink(const int xid, -+ struct cifsTconInfo *tcon, -+ const char *fromName, const char *toName, -+ const struct nls_table *nls_codepage); -+extern int CIFSUnixCreateSymLink(const int xid, -+ struct cifsTconInfo *tcon, -+ const char *fromName, const char *toName, -+ const struct nls_table *nls_codepage); -+extern int CIFSSMBUnixQuerySymLink(const int xid, -+ struct cifsTconInfo *tcon, -+ const unsigned char *searchName, -+ char *syminfo, const int buflen, -+ const struct nls_table *nls_codepage); -+extern int CIFSSMBQueryReparseLinkInfo(const int xid, -+ struct cifsTconInfo *tcon, -+ const unsigned char *searchName, -+ char *symlinkinfo, const int buflen, __u16 fid, -+ const struct nls_table *nls_codepage); -+ -+extern int CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon, -+ const char *fileName, const int disposition, -+ const int access_flags, const int omode, -+ __u16 * netfid, int *pOplock, FILE_ALL_INFO *, -+ const struct nls_table *nls_codepage); -+extern int CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, -+ const int smb_file_id); -+ -+extern int CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, -+ const int netfid, unsigned int count, -+ const __u64 lseek, unsigned int *nbytes, char **buf); -+extern int CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, -+ const int netfid, const unsigned int count, -+ const __u64 lseek, unsigned int *nbytes, -+ const char *buf, const int long_op); -+extern int CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, -+ const __u16 netfid, const __u64 len, -+ const __u64 offset, const __u32 numUnlock, -+ const __u32 numLock, const __u8 lockType, -+ const int waitFlag); -+ -+extern int CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon); -+extern int CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses); -+ -+extern struct cifsSesInfo *sesInfoAlloc(void); -+extern void sesInfoFree(struct cifsSesInfo *); -+extern struct cifsTconInfo *tconInfoAlloc(void); -+extern void tconInfoFree(struct cifsTconInfo *); -+ -+extern int cifs_reconnect(struct TCP_Server_Info *server); -+ -+extern int cifs_sign_smb(struct smb_hdr *, struct cifsSesInfo *,__u32 *); -+extern int cifs_verify_signature(const struct smb_hdr *, const char * mac_key, -+ __u32 expected_sequence_number); -+extern int cifs_calculate_mac_key(char * key,const char * rn,const char * pass); -+extern void CalcNTLMv2_partial_mac_key(struct cifsSesInfo *, struct nls_table *); -+extern void CalcNTLMv2_response(const struct cifsSesInfo *,char * ); -+ -+extern int CIFSBuildServerList(int xid, char *serverBufferList, -+ int recordlength, int *entries, -+ int *totalEntries, int *topoChangedFlag); -+extern int CIFSSMBQueryShares(int xid, struct cifsTconInfo *tcon, -+ struct shareInfo *shareList, int bufferLen, -+ int *entries, int *totalEntries); -+extern int CIFSSMBQueryAlias(int xid, struct cifsTconInfo *tcon, -+ struct aliasInfo *aliasList, int bufferLen, -+ int *entries, int *totalEntries); -+extern int CIFSSMBAliasInfo(int xid, struct cifsTconInfo *tcon, -+ char *aliasName, char *serverName, -+ char *shareName, char *comment); -+extern int CIFSSMBGetShareInfo(int xid, struct cifsTconInfo *tcon, -+ char *share, char *comment); -+extern int CIFSSMBGetUserPerms(int xid, struct cifsTconInfo *tcon, -+ char *userName, char *searchName, int *perms); -+extern int CIFSSMBSync(int xid, struct cifsTconInfo *tcon, int netfid, int pid); -+ -+extern int CIFSSMBSeek(int xid, -+ struct cifsTconInfo *tcon, -+ int netfid, -+ int pid, -+ int whence, unsigned long offset, long long *newoffset); -+ -+extern int CIFSSMBCopy(int xid, -+ struct cifsTconInfo *source_tcon, -+ const char *fromName, -+ const __u16 target_tid, -+ const char *toName, const int flags, -+ const struct nls_table *nls_codepage); -+extern int CIFSSMBNotify(const int xid, struct cifsTconInfo *tcon, -+ const int notify_subdirs,const __u16 netfid,__u32 filter, -+ const struct nls_table *nls_codepage); -+extern int CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon, -+ const unsigned char *searchName, -+ char * EAData, size_t size, -+ const struct nls_table *nls_codepage); -+#endif /* _CIFSPROTO_H */ -diff -urN linux-2.4.29.old/fs/cifs/cifssmb.c linux-2.4.29/fs/cifs/cifssmb.c ---- linux-2.4.29.old/fs/cifs/cifssmb.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/cifssmb.c 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,3016 @@ -+/* -+ * fs/cifs/cifssmb.c -+ * -+ * Copyright (C) International Business Machines Corp., 2002,2003 -+ * Author(s): Steve French (sfrench@us.ibm.com) -+ * -+ * Contains the routines for constructing the SMB PDUs themselves -+ * -+ * This library is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This library 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 Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+ /* SMB/CIFS PDU handling routines here - except for leftovers in connect.c */ -+ /* These are mostly routines that operate on a pathname, or on a tree id */ -+ /* (mounted volume), but there are eight handle based routines which must be */ -+ /* treated slightly different for reconnection purposes since we never want */ -+ /* to reuse a stale file handle and the caller knows the file handle */ -+ -+#include -+#include -+#include -+#include -+#include "cifspdu.h" -+#include "cifsglob.h" -+#include "cifsproto.h" -+#include "cifs_unicode.h" -+#include "cifs_debug.h" -+ -+#ifdef CONFIG_CIFS_POSIX -+static struct { -+ int index; -+ char *name; -+} protocols[] = { -+ {CIFS_PROT, "\2NT LM 0.12"}, -+ {CIFS_PROT, "\2POSIX 2"}, -+ {BAD_PROT, "\2"} -+}; -+#else -+static struct { -+ int index; -+ char *name; -+} protocols[] = { -+ {CIFS_PROT, "\2NT LM 0.12"}, -+ {BAD_PROT, "\2"} -+}; -+#endif -+ -+ -+/* Mark as invalid, all open files on tree connections since they -+ were closed when session to server was lost */ -+static void mark_open_files_invalid(struct cifsTconInfo * pTcon) -+{ -+ struct cifsFileInfo *open_file = NULL; -+ struct list_head * tmp; -+ struct list_head * tmp1; -+ -+/* list all files open on tree connection and mark them invalid */ -+ write_lock(&GlobalSMBSeslock); -+ list_for_each_safe(tmp, tmp1, &pTcon->openFileList) { -+ open_file = list_entry(tmp,struct cifsFileInfo, tlist); -+ if(open_file) { -+ open_file->invalidHandle = TRUE; -+ } -+ } -+ write_unlock(&GlobalSMBSeslock); -+ /* BB Add call to invalidate_inodes(sb) for all superblocks mounted to this tcon */ -+} -+ -+static int -+smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, -+ void **request_buf /* returned */ , -+ void **response_buf /* returned */ ) -+{ -+ int rc = 0; -+ int timeout = 10 * HZ; -+ -+ /* SMBs NegProt, SessSetup, uLogoff do not have tcon yet so -+ check for tcp and smb session status done differently -+ for those three - in the calling routine */ -+ if(tcon) { -+ if((tcon->ses) && (tcon->ses->server)){ -+ struct nls_table *nls_codepage; -+ /* Give Demultiplex thread up to 10 seconds to -+ reconnect, should be greater than cifs socket -+ timeout which is 7 seconds */ -+ while(tcon->ses->server->tcpStatus == CifsNeedReconnect) { -+ while ((tcon->ses->server->tcpStatus != CifsGood) && (timeout > 0)){ -+ timeout = interruptible_sleep_on_timeout(&tcon->ses->server->response_q,timeout); -+ } -+ if(tcon->ses->server->tcpStatus == CifsNeedReconnect) { -+ /* on "soft" mounts we wait once */ -+ if((tcon->retry == FALSE) || -+ (tcon->ses->status == CifsExiting)) { -+ cFYI(1,("gave up waiting on reconnect in smb_init")); -+ return -EHOSTDOWN; -+ } /* else "hard" mount - keep retrying until -+ process is killed or server comes back up */ -+ } else /* TCP session is reestablished now */ -+ break; -+ -+ } -+ -+ nls_codepage = load_nls_default(); -+ /* need to prevent multiple threads trying to -+ simultaneously reconnect the same SMB session */ -+ down(&tcon->ses->sesSem); -+ if(tcon->ses->status == CifsNeedReconnect) -+ rc = cifs_setup_session(0, tcon->ses, nls_codepage); -+ if(!rc && (tcon->tidStatus == CifsNeedReconnect)) { -+ mark_open_files_invalid(tcon); -+ rc = CIFSTCon(0, tcon->ses, tcon->treeName, tcon, -+ nls_codepage); -+ up(&tcon->ses->sesSem); -+ if(rc == 0) -+ atomic_inc(&tconInfoReconnectCount); -+ -+ cFYI(1, ("reconnect tcon rc = %d", rc)); -+ /* Removed call to reopen open files here - -+ it is safer (and faster) to reopen files -+ one at a time as needed in read and write */ -+ -+ /* Check if handle based operation so we -+ know whether we can continue or not without -+ returning to caller to reset file handle */ -+ switch(smb_command) { -+ case SMB_COM_READ_ANDX: -+ case SMB_COM_WRITE_ANDX: -+ case SMB_COM_CLOSE: -+ case SMB_COM_FIND_CLOSE2: -+ case SMB_COM_LOCKING_ANDX: { -+ unload_nls(nls_codepage); -+ return -EAGAIN; -+ } -+ } -+ } else { -+ up(&tcon->ses->sesSem); -+ } -+ unload_nls(nls_codepage); -+ -+ } else { -+ return -EIO; -+ } -+ } -+ if(rc) -+ return rc; -+ -+ *request_buf = cifs_buf_get(); -+ if (*request_buf == 0) { -+ /* BB should we add a retry in here if not a writepage? */ -+ return -ENOMEM; -+ } -+ /* Although the original thought was we needed the response buf for */ -+ /* potential retries of smb operations it turns out we can determine */ -+ /* from the mid flags when the request buffer can be resent without */ -+ /* having to use a second distinct buffer for the response */ -+ *response_buf = *request_buf; -+ -+ header_assemble((struct smb_hdr *) *request_buf, smb_command, tcon, -+ wct /*wct */ ); -+ -+#ifdef CONFIG_CIFS_STATS -+ if(tcon != NULL) { -+ atomic_inc(&tcon->num_smbs_sent); -+ } -+#endif -+ return rc; -+} -+ -+int -+CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) -+{ -+ NEGOTIATE_REQ *pSMB; -+ NEGOTIATE_RSP *pSMBr; -+ int rc = 0; -+ int bytes_returned; -+ struct TCP_Server_Info * server; -+ -+ if(ses->server) -+ server = ses->server; -+ else { -+ rc = -EIO; -+ return rc; -+ } -+ rc = smb_init(SMB_COM_NEGOTIATE, 0, NULL /* no tcon yet */ , -+ (void **) &pSMB, (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ pSMB->hdr.Flags2 |= SMBFLG2_UNICODE; -+ if (extended_security) -+ pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC; -+ -+ pSMB->ByteCount = strlen(protocols[0].name) + 1; -+ strncpy(pSMB->DialectsArray, protocols[0].name, 30); -+ /* null guaranteed to be at end of source and target buffers anyway */ -+ -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ -+ rc = SendReceive(xid, ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc == 0) { -+ server->secMode = pSMBr->SecurityMode; -+ server->secType = NTLM; /* BB override default for NTLMv2 or krb*/ -+ /* one byte - no need to convert this or EncryptionKeyLen from le,*/ -+ server->maxReq = le16_to_cpu(pSMBr->MaxMpxCount); -+ /* probably no need to store and check maxvcs */ -+ server->maxBuf = -+ min(le32_to_cpu(pSMBr->MaxBufferSize), -+ (__u32) CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE); -+ server->maxRw = le32_to_cpu(pSMBr->MaxRawSize); -+ cFYI(0, ("Max buf = %d ", ses->server->maxBuf)); -+ GETU32(ses->server->sessid) = le32_to_cpu(pSMBr->SessionKey); -+ server->capabilities = le32_to_cpu(pSMBr->Capabilities); -+ server->timeZone = le16_to_cpu(pSMBr->ServerTimeZone); -+ /* BB with UTC do we ever need to be using srvr timezone? */ -+ if (pSMBr->EncryptionKeyLength == CIFS_CRYPTO_KEY_SIZE) { -+ memcpy(server->cryptKey, pSMBr->u.EncryptionKey, -+ CIFS_CRYPTO_KEY_SIZE); -+ } else if ((pSMBr->hdr.Flags2 & SMBFLG2_EXT_SEC) -+ && (pSMBr->EncryptionKeyLength == 0)) { -+ /* decode security blob */ -+ } else -+ rc = -EIO; -+ -+ /* BB might be helpful to save off the domain of server here */ -+ -+ if (pSMBr->hdr.Flags2 & SMBFLG2_EXT_SEC) { -+ if (pSMBr->ByteCount < 16) -+ rc = -EIO; -+ else if (pSMBr->ByteCount == 16) { -+ server->secType = RawNTLMSSP; -+ if (server->socketUseCount.counter > 1) { -+ if (memcmp -+ (server->server_GUID, -+ pSMBr->u.extended_response. -+ GUID, 16) != 0) { -+ cFYI(1, -+ ("UID of server does not match previous connection to same ip address")); -+ memcpy(server-> -+ server_GUID, -+ pSMBr->u. -+ extended_response. -+ GUID, 16); -+ } -+ } else -+ memcpy(server->server_GUID, -+ pSMBr->u.extended_response. -+ GUID, 16); -+ } else { -+ rc = decode_negTokenInit(pSMBr->u. -+ extended_response. -+ SecurityBlob, -+ pSMBr->ByteCount - -+ 16, &server->secType); -+ } -+ } else -+ server->capabilities &= ~CAP_EXTENDED_SECURITY; -+ if(sign_CIFS_PDUs == FALSE) { -+ if(server->secMode & SECMODE_SIGN_REQUIRED) -+ cERROR(1, -+ ("Server requires /proc/fs/cifs/PacketSigningEnabled")); -+ server->secMode &= ~(SECMODE_SIGN_ENABLED | SECMODE_SIGN_REQUIRED); -+ } else if(sign_CIFS_PDUs == 1) { -+ if((server->secMode & SECMODE_SIGN_REQUIRED) == 0) -+ server->secMode &= ~(SECMODE_SIGN_ENABLED | SECMODE_SIGN_REQUIRED); -+ } -+ -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ return rc; -+} -+ -+int -+CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon) -+{ -+ struct smb_hdr *smb_buffer; -+ struct smb_hdr *smb_buffer_response; -+ int rc = 0; -+ int length; -+ -+ cFYI(1, ("In tree disconnect")); -+ /* -+ * If last user of the connection and -+ * connection alive - disconnect it -+ * If this is the last connection on the server session disconnect it -+ * (and inside session disconnect we should check if tcp socket needs -+ * to be freed and kernel thread woken up). -+ */ -+ if (tcon) -+ down(&tcon->tconSem); -+ else -+ return -EIO; -+ -+ atomic_dec(&tcon->useCount); -+ if (atomic_read(&tcon->useCount) > 0) { -+ up(&tcon->tconSem); -+ return -EBUSY; -+ } -+ -+ /* No need to return error on this operation if tid invalidated and -+ closed on server already e.g. due to tcp session crashing */ -+ if(tcon->tidStatus == CifsNeedReconnect) { -+ up(&tcon->tconSem); -+ return 0; -+ } -+ -+ if((tcon->ses == 0) || (tcon->ses->server == 0)) { -+ up(&tcon->tconSem); -+ return -EIO; -+ } -+ -+ rc = smb_init(SMB_COM_TREE_DISCONNECT, 0, tcon, -+ (void **) &smb_buffer, (void **) &smb_buffer_response); -+ if (rc) { -+ up(&tcon->tconSem); -+ return rc; -+ } -+ rc = SendReceive(xid, tcon->ses, smb_buffer, smb_buffer_response, -+ &length, 0); -+ if (rc) -+ cFYI(1, (" Tree disconnect failed %d", rc)); -+ -+ if (smb_buffer) -+ cifs_buf_release(smb_buffer); -+ up(&tcon->tconSem); -+ -+ /* No need to return error on this operation if tid invalidated and -+ closed on server already e.g. due to tcp session crashing */ -+ if (rc == -EAGAIN) -+ rc = 0; -+ -+ return rc; -+} -+ -+int -+CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses) -+{ -+ struct smb_hdr *smb_buffer_response; -+ LOGOFF_ANDX_REQ *pSMB; -+ int rc = 0; -+ int length; -+ -+ cFYI(1, ("In SMBLogoff for session disconnect")); -+ if (ses) -+ down(&ses->sesSem); -+ else -+ return -EIO; -+ -+ atomic_dec(&ses->inUse); -+ if (atomic_read(&ses->inUse) > 0) { -+ up(&ses->sesSem); -+ return -EBUSY; -+ } -+ -+ rc = smb_init(SMB_COM_LOGOFF_ANDX, 2, NULL /* no tcon anymore */, -+ (void **) &pSMB, (void **) &smb_buffer_response); -+ -+ if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) -+ pSMB->hdr.Flags2 |= SMBFLG2_SECURITY_SIGNATURE; -+ -+ if (rc) { -+ up(&ses->sesSem); -+ return rc; -+ } -+ -+ pSMB->hdr.Uid = ses->Suid; -+ -+ pSMB->AndXCommand = 0xFF; -+ rc = SendReceive(xid, ses, (struct smb_hdr *) pSMB, -+ smb_buffer_response, &length, 0); -+ if (ses->server) { -+ atomic_dec(&ses->server->socketUseCount); -+ if (atomic_read(&ses->server->socketUseCount) == 0) { -+ spin_lock(&GlobalMid_Lock); -+ ses->server->tcpStatus = CifsExiting; -+ spin_unlock(&GlobalMid_Lock); -+ rc = -ESHUTDOWN; -+ } -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ up(&ses->sesSem); -+ -+ /* if session dead then we do not need to do ulogoff, -+ since server closed smb session, no sense reporting -+ error */ -+ if (rc == -EAGAIN) -+ rc = 0; -+ return rc; -+} -+ -+int -+CIFSSMBDelFile(const int xid, struct cifsTconInfo *tcon, -+ const char *fileName, const struct nls_table *nls_codepage) -+{ -+ DELETE_FILE_REQ *pSMB = NULL; -+ DELETE_FILE_RSP *pSMBr = NULL; -+ int rc = 0; -+ int bytes_returned; -+ int name_len; -+ -+DelFileRetry: -+ rc = smb_init(SMB_COM_DELETE, 1, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len = -+ cifs_strtoUCS((wchar_t *) pSMB->fileName, fileName, 530 -+ /* find define for this maxpathcomponent */ -+ , nls_codepage); -+ name_len++; /* trailing null */ -+ name_len *= 2; -+ } else { /* BB improve the check for buffer overruns BB */ -+ name_len = strnlen(fileName, 530); -+ name_len++; /* trailing null */ -+ strncpy(pSMB->fileName, fileName, name_len); -+ } -+ pSMB->SearchAttributes = -+ cpu_to_le16(ATTR_READONLY | ATTR_HIDDEN | ATTR_SYSTEM); -+ pSMB->ByteCount = name_len + 1; -+ pSMB->BufferFormat = 0x04; -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cFYI(1, ("Error in RMFile = %d", rc)); -+ } -+#ifdef CONFIG_CIFS_STATS -+ else { -+ atomic_inc(&tcon->num_deletes); -+ } -+#endif -+ -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ if (rc == -EAGAIN) -+ goto DelFileRetry; -+ -+ return rc; -+} -+ -+int -+CIFSSMBRmDir(const int xid, struct cifsTconInfo *tcon, -+ const char *dirName, const struct nls_table *nls_codepage) -+{ -+ DELETE_DIRECTORY_REQ *pSMB = NULL; -+ DELETE_DIRECTORY_RSP *pSMBr = NULL; -+ int rc = 0; -+ int bytes_returned; -+ int name_len; -+ -+ cFYI(1, ("In CIFSSMBRmDir")); -+RmDirRetry: -+ rc = smb_init(SMB_COM_DELETE_DIRECTORY, 0, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len = cifs_strtoUCS((wchar_t *) pSMB->DirName, dirName, 530 -+ /* find define for this maxpathcomponent */ -+ , nls_codepage); -+ name_len++; /* trailing null */ -+ name_len *= 2; -+ } else { /* BB improve the check for buffer overruns BB */ -+ name_len = strnlen(dirName, 530); -+ name_len++; /* trailing null */ -+ strncpy(pSMB->DirName, dirName, name_len); -+ } -+ -+ pSMB->ByteCount = name_len + 1; -+ pSMB->BufferFormat = 0x04; -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cFYI(1, ("Error in RMDir = %d", rc)); -+ } -+#ifdef CONFIG_CIFS_STATS -+ else { -+ atomic_inc(&tcon->num_rmdirs); -+ } -+#endif -+ -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ if (rc == -EAGAIN) -+ goto RmDirRetry; -+ return rc; -+} -+ -+int -+CIFSSMBMkDir(const int xid, struct cifsTconInfo *tcon, -+ const char *name, const struct nls_table *nls_codepage) -+{ -+ int rc = 0; -+ CREATE_DIRECTORY_REQ *pSMB = NULL; -+ CREATE_DIRECTORY_RSP *pSMBr = NULL; -+ int bytes_returned; -+ int name_len; -+ -+ cFYI(1, ("In CIFSSMBMkDir")); -+MkDirRetry: -+ rc = smb_init(SMB_COM_CREATE_DIRECTORY, 0, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len = cifs_strtoUCS((wchar_t *) pSMB->DirName, name, 530 -+ /* find define for this maxpathcomponent */ -+ , nls_codepage); -+ name_len++; /* trailing null */ -+ name_len *= 2; -+ } else { /* BB improve the check for buffer overruns BB */ -+ name_len = strnlen(name, 530); -+ name_len++; /* trailing null */ -+ strncpy(pSMB->DirName, name, name_len); -+ } -+ -+ pSMB->ByteCount = name_len + 1 /* for buf format */ ; -+ pSMB->BufferFormat = 0x04; -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cFYI(1, ("Error in Mkdir = %d", rc)); -+ } -+#ifdef CONFIG_CIFS_STATS -+ else { -+ atomic_inc(&tcon->num_mkdirs); -+ } -+#endif -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ if (rc == -EAGAIN) -+ goto MkDirRetry; -+ return rc; -+} -+ -+int -+CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon, -+ const char *fileName, const int openDisposition, -+ const int access_flags, const int create_options, __u16 * netfid, -+ int *pOplock, FILE_ALL_INFO * pfile_info, -+ const struct nls_table *nls_codepage) -+{ -+ int rc = -EACCES; -+ OPEN_REQ *pSMB = NULL; -+ OPEN_RSP *pSMBr = NULL; -+ int bytes_returned; -+ int name_len; -+ -+openRetry: -+ rc = smb_init(SMB_COM_NT_CREATE_ANDX, 24, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ pSMB->AndXCommand = 0xFF; /* none */ -+ -+ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { -+ pSMB->ByteCount = 1; /* account for one byte pad to word boundary */ -+ name_len = -+ cifs_strtoUCS((wchar_t *) (pSMB->fileName + 1), -+ fileName, 530 -+ /* find define for this maxpathcomponent */ -+ , nls_codepage); -+ name_len++; /* trailing null */ -+ name_len *= 2; -+ pSMB->NameLength = cpu_to_le16(name_len); -+ } else { /* BB improve the check for buffer overruns BB */ -+ pSMB->ByteCount = 0; /* no pad */ -+ name_len = strnlen(fileName, 530); -+ name_len++; /* trailing null */ -+ pSMB->NameLength = cpu_to_le16(name_len); -+ strncpy(pSMB->fileName, fileName, name_len); -+ } -+ if (*pOplock & REQ_OPLOCK) -+ pSMB->OpenFlags = cpu_to_le32(REQ_OPLOCK); -+ else if (*pOplock & REQ_BATCHOPLOCK) { -+ pSMB->OpenFlags = cpu_to_le32(REQ_BATCHOPLOCK); -+ } -+ pSMB->DesiredAccess = cpu_to_le32(access_flags); -+ pSMB->AllocationSize = 0; -+ pSMB->FileAttributes = ATTR_NORMAL; -+ /* XP does not handle ATTR_POSIX_SEMANTICS */ -+ /* but it helps speed up case sensitive checks for other -+ servers such as Samba */ -+ if (tcon->ses->capabilities & CAP_UNIX) -+ pSMB->FileAttributes |= ATTR_POSIX_SEMANTICS; -+ -+ /* if ((omode & S_IWUGO) == 0) -+ pSMB->FileAttributes |= ATTR_READONLY;*/ -+ /* Above line causes problems due to vfs splitting create into two -+ pieces - need to set mode after file created not while it is -+ being created */ -+ pSMB->FileAttributes = cpu_to_le32(pSMB->FileAttributes); -+ pSMB->ShareAccess = cpu_to_le32(FILE_SHARE_ALL); -+ pSMB->CreateDisposition = cpu_to_le32(openDisposition); -+ pSMB->CreateOptions = cpu_to_le32(create_options); -+ pSMB->ImpersonationLevel = cpu_to_le32(SECURITY_IMPERSONATION); /* BB ??*/ -+ pSMB->SecurityFlags = -+ cpu_to_le32(SECURITY_CONTEXT_TRACKING | SECURITY_EFFECTIVE_ONLY); -+ -+ pSMB->ByteCount += name_len; -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ /* long_op set to 1 to allow for oplock break timeouts */ -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 1); -+ if (rc) { -+ cFYI(1, ("Error in Open = %d", rc)); -+ } else { -+ *pOplock = pSMBr->OplockLevel; /* one byte no need to le_to_cpu */ -+ *netfid = pSMBr->Fid; /* cifs fid stays in le */ -+ /* Let caller know file was created so we can set the mode. */ -+ /* Do we care about the CreateAction in any other cases? */ -+ if(cpu_to_le32(FILE_CREATE) == pSMBr->CreateAction) -+ *pOplock |= CIFS_CREATE_ACTION; -+ if(pfile_info) { -+ memcpy((char *)pfile_info,(char *)&pSMBr->CreationTime, -+ 36 /* CreationTime to Attributes */); -+ /* the file_info buf is endian converted by caller */ -+ pfile_info->AllocationSize = pSMBr->AllocationSize; -+ pfile_info->EndOfFile = pSMBr->EndOfFile; -+ pfile_info->NumberOfLinks = cpu_to_le32(1); -+ } -+ -+#ifdef CONFIG_CIFS_STATS -+ atomic_inc(&tcon->num_opens); -+#endif -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ if (rc == -EAGAIN) -+ goto openRetry; -+ return rc; -+} -+ -+/* If no buffer passed in, then caller wants to do the copy -+ as in the case of readpages so the SMB buffer must be -+ freed by the caller */ -+ -+int -+CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, -+ const int netfid, const unsigned int count, -+ const __u64 lseek, unsigned int *nbytes, char **buf) -+{ -+ int rc = -EACCES; -+ READ_REQ *pSMB = NULL; -+ READ_RSP *pSMBr = NULL; -+ char *pReadData = NULL; -+ int bytes_returned; -+ -+ *nbytes = 0; -+ rc = smb_init(SMB_COM_READ_ANDX, 12, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ /* tcon and ses pointer are checked in smb_init */ -+ if (tcon->ses->server == NULL) -+ return -ECONNABORTED; -+ -+ pSMB->AndXCommand = 0xFF; /* none */ -+ pSMB->Fid = netfid; -+ pSMB->OffsetLow = cpu_to_le32(lseek & 0xFFFFFFFF); -+ pSMB->OffsetHigh = cpu_to_le32(lseek >> 32); -+ pSMB->Remaining = 0; -+ pSMB->MaxCount = cpu_to_le16(count); -+ pSMB->MaxCountHigh = 0; -+ pSMB->ByteCount = 0; /* no need to do le conversion since it is 0 */ -+ -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cERROR(1, ("Send error in read = %d", rc)); -+ } else { -+ pSMBr->DataLength = le16_to_cpu(pSMBr->DataLength); -+ *nbytes = pSMBr->DataLength; -+ /*check that DataLength would not go beyond end of SMB */ -+ if ((pSMBr->DataLength > CIFS_MAX_MSGSIZE) -+ || (pSMBr->DataLength > count)) { -+ cFYI(1,("bad length %d for count %d",pSMBr->DataLength,count)); -+ rc = -EIO; -+ *nbytes = 0; -+ } else { -+ pReadData = -+ (char *) (&pSMBr->hdr.Protocol) + -+ le16_to_cpu(pSMBr->DataOffset); -+/* if(rc = copy_to_user(buf, pReadData, pSMBr->DataLength)) { -+ cERROR(1,("Faulting on read rc = %d",rc)); -+ rc = -EFAULT; -+ }*/ /* can not use copy_to_user when using page cache*/ -+ if(*buf) -+ memcpy(*buf,pReadData,pSMBr->DataLength); -+ } -+ } -+ if (pSMB) { -+ if(*buf) -+ cifs_buf_release(pSMB); -+ else -+ *buf = (char *)pSMB; -+ } -+ -+ /* Note: On -EAGAIN error only caller can retry on handle based calls -+ since file handle passed in no longer valid */ -+ return rc; -+} -+ -+int -+CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, -+ const int netfid, const unsigned int count, -+ const __u64 offset, unsigned int *nbytes, const char *buf, -+ const int long_op) -+{ -+ int rc = -EACCES; -+ WRITE_REQ *pSMB = NULL; -+ WRITE_RSP *pSMBr = NULL; -+ int bytes_returned; -+ -+ rc = smb_init(SMB_COM_WRITE_ANDX, 14, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ /* tcon and ses pointer are checked in smb_init */ -+ if (tcon->ses->server == NULL) -+ return -ECONNABORTED; -+ -+ pSMB->AndXCommand = 0xFF; /* none */ -+ pSMB->Fid = netfid; -+ pSMB->OffsetLow = cpu_to_le32(offset & 0xFFFFFFFF); -+ pSMB->OffsetHigh = cpu_to_le32(offset >> 32); -+ pSMB->Remaining = 0; -+ if (count > ((tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFF00)) -+ pSMB->DataLengthLow = -+ (tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFF00; -+ else -+ pSMB->DataLengthLow = count; -+ pSMB->DataLengthHigh = 0; -+ pSMB->DataOffset = -+ cpu_to_le16(offsetof(struct smb_com_write_req,Data) - 4); -+ -+ memcpy(pSMB->Data,buf,pSMB->DataLengthLow); -+ -+ pSMB->ByteCount += pSMB->DataLengthLow + 1 /* pad */ ; -+ pSMB->DataLengthLow = cpu_to_le16(pSMB->DataLengthLow); -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, long_op); -+ if (rc) { -+ cFYI(1, ("Send error in write = %d", rc)); -+ *nbytes = 0; -+ } else -+ *nbytes = le16_to_cpu(pSMBr->Count); -+ -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ -+ /* Note: On -EAGAIN error only caller can retry on handle based calls -+ since file handle passed in no longer valid */ -+ -+ return rc; -+} -+ -+int -+CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, -+ const __u16 smb_file_id, const __u64 len, -+ const __u64 offset, const __u32 numUnlock, -+ const __u32 numLock, const __u8 lockType, const int waitFlag) -+{ -+ int rc = 0; -+ LOCK_REQ *pSMB = NULL; -+ LOCK_RSP *pSMBr = NULL; -+ int bytes_returned; -+ int timeout = 0; -+ __u64 temp; -+ -+ cFYI(1, ("In CIFSSMBLock - timeout %d numLock %d",waitFlag,numLock)); -+ rc = smb_init(SMB_COM_LOCKING_ANDX, 8, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ if(lockType == LOCKING_ANDX_OPLOCK_RELEASE) { -+ timeout = -1; /* no response expected */ -+ pSMB->Timeout = 0; -+ } else if (waitFlag == TRUE) { -+ timeout = 3; /* blocking operation, no timeout */ -+ pSMB->Timeout = -1; /* blocking - do not time out */ -+ } else { -+ pSMB->Timeout = 0; -+ } -+ -+ pSMB->NumberOfLocks = cpu_to_le32(numLock); -+ pSMB->NumberOfUnlocks = cpu_to_le32(numUnlock); -+ pSMB->LockType = lockType; -+ pSMB->AndXCommand = 0xFF; /* none */ -+ pSMB->Fid = smb_file_id; /* netfid stays le */ -+ -+ if(numLock != 0) { -+ pSMB->Locks[0].Pid = cpu_to_le16(current->tgid); -+ /* BB where to store pid high? */ -+ temp = cpu_to_le64(len); -+ pSMB->Locks[0].LengthLow = (__u32)(temp & 0xFFFFFFFF); -+ pSMB->Locks[0].LengthHigh = (__u32)(temp>>32); -+ temp = cpu_to_le64(offset); -+ pSMB->Locks[0].OffsetLow = (__u32)(temp & 0xFFFFFFFF); -+ pSMB->Locks[0].OffsetHigh = (__u32)(temp>>32); -+ pSMB->ByteCount = sizeof (LOCKING_ANDX_RANGE); -+ } else { -+ /* oplock break */ -+ pSMB->ByteCount = 0; -+ } -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, timeout); -+ -+ if (rc) { -+ cFYI(1, ("Send error in Lock = %d", rc)); -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ -+ /* Note: On -EAGAIN error only caller can retry on handle based calls -+ since file handle passed in no longer valid */ -+ return rc; -+} -+ -+int -+CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, int smb_file_id) -+{ -+ int rc = 0; -+ CLOSE_REQ *pSMB = NULL; -+ CLOSE_RSP *pSMBr = NULL; -+ int bytes_returned; -+ cFYI(1, ("In CIFSSMBClose")); -+ -+/* do not retry on dead session on close */ -+ rc = smb_init(SMB_COM_CLOSE, 3, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if(rc == -EAGAIN) -+ return 0; -+ if (rc) -+ return rc; -+ -+ pSMB->FileID = (__u16) smb_file_id; -+ pSMB->LastWriteTime = 0; -+ pSMB->ByteCount = 0; -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ if(rc!=-EINTR) { -+ /* EINTR is expected when user ctl-c to kill app */ -+ cERROR(1, ("Send error in Close = %d", rc)); -+ } -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ -+ /* Since session is dead, file will be closed on server already */ -+ if(rc == -EAGAIN) -+ rc = 0; -+ -+ return rc; -+} -+ -+int -+CIFSSMBRename(const int xid, struct cifsTconInfo *tcon, -+ const char *fromName, const char *toName, -+ const struct nls_table *nls_codepage) -+{ -+ int rc = 0; -+ RENAME_REQ *pSMB = NULL; -+ RENAME_RSP *pSMBr = NULL; -+ int bytes_returned; -+ int name_len, name_len2; -+ -+ cFYI(1, ("In CIFSSMBRename")); -+renameRetry: -+ rc = smb_init(SMB_COM_RENAME, 1, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ pSMB->BufferFormat = 0x04; -+ pSMB->SearchAttributes = -+ cpu_to_le16(ATTR_READONLY | ATTR_HIDDEN | ATTR_SYSTEM | -+ ATTR_DIRECTORY); -+ -+ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len = -+ cifs_strtoUCS((wchar_t *) pSMB->OldFileName, fromName, 530 -+ /* find define for this maxpathcomponent */ -+ , nls_codepage); -+ name_len++; /* trailing null */ -+ name_len *= 2; -+ pSMB->OldFileName[name_len] = 0x04; /* pad */ -+ /* protocol requires ASCII signature byte on Unicode string */ -+ pSMB->OldFileName[name_len + 1] = 0x00; -+ name_len2 = -+ cifs_strtoUCS((wchar_t *) & pSMB-> -+ OldFileName[name_len + 2], toName, 530, -+ nls_codepage); -+ name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; -+ name_len2 *= 2; /* convert to bytes */ -+ } else { /* BB improve the check for buffer overruns BB */ -+ name_len = strnlen(fromName, 530); -+ name_len++; /* trailing null */ -+ strncpy(pSMB->OldFileName, fromName, name_len); -+ name_len2 = strnlen(toName, 530); -+ name_len2++; /* trailing null */ -+ pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */ -+ strncpy(&pSMB->OldFileName[name_len + 1], toName, name_len2); -+ name_len2++; /* trailing null */ -+ name_len2++; /* signature byte */ -+ } -+ -+ pSMB->ByteCount = 1 /* 1st signature byte */ + name_len + name_len2; -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cFYI(1, ("Send error in rename = %d", rc)); -+ } -+ -+#ifdef CONFIG_CIFS_STATS -+ else { -+ atomic_inc(&tcon->num_renames); -+ } -+#endif -+ -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ -+ if (rc == -EAGAIN) -+ goto renameRetry; -+ -+ return rc; -+} -+ -+int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon, -+ int netfid, char * target_name, const struct nls_table * nls_codepage) -+{ -+ struct smb_com_transaction2_sfi_req *pSMB = NULL; -+ struct smb_com_transaction2_sfi_rsp *pSMBr = NULL; -+ struct set_file_rename * rename_info; -+ char *data_offset; -+ char dummy_string[30]; -+ int rc = 0; -+ int bytes_returned = 0; -+ int len_of_str; -+ -+ cFYI(1, ("Rename to File by handle")); -+ rc = smb_init(SMB_COM_TRANSACTION2, 15, pTcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ pSMB->ParameterCount = 6; -+ pSMB->MaxSetupCount = 0; -+ pSMB->Reserved = 0; -+ pSMB->Flags = 0; -+ pSMB->Timeout = 0; -+ pSMB->Reserved2 = 0; -+ pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_sfi_req, -+ Fid) - 4; -+ pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; -+ -+ data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset; -+ rename_info = (struct set_file_rename *) data_offset; -+ pSMB->MaxParameterCount = cpu_to_le16(2); -+ pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */ -+ pSMB->SetupCount = 1; -+ pSMB->Reserved3 = 0; -+ pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); -+ pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount; -+ pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); -+ pSMB->TotalParameterCount = pSMB->ParameterCount; -+ pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); -+ pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); -+ /* construct random name ".cifs_tmp" */ -+ rename_info->overwrite = cpu_to_le32(1); -+ rename_info->root_fid = 0; -+ /* unicode only call */ -+ if(target_name == NULL) { -+ sprintf(dummy_string,"cifs%x",pSMB->hdr.Mid); -+ len_of_str = cifs_strtoUCS((wchar_t *) rename_info->target_name, dummy_string, 24, nls_codepage); -+ } else { -+ len_of_str = cifs_strtoUCS((wchar_t *) rename_info->target_name, target_name, 530, nls_codepage); -+ } -+ rename_info->target_name_len = cpu_to_le32(2 * len_of_str); -+ pSMB->DataCount = 12 /* sizeof(struct set_file_rename) */ + (2 * len_of_str) + 2; -+ pSMB->ByteCount += pSMB->DataCount; -+ pSMB->DataCount = cpu_to_le16(pSMB->DataCount); -+ pSMB->TotalDataCount = pSMB->DataCount; -+ pSMB->Fid = netfid; -+ pSMB->InformationLevel = -+ cpu_to_le16(SMB_SET_FILE_RENAME_INFORMATION); -+ pSMB->Reserved4 = 0; -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ rc = SendReceive(xid, pTcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cFYI(1,("Send error in Rename (by file handle) = %d", rc)); -+ } -+#ifdef CONFIG_CIFS_STATS -+ else { -+ atomic_inc(&pTcon->num_t2renames); -+ } -+#endif -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ -+ /* Note: On -EAGAIN error only caller can retry on handle based calls -+ since file handle passed in no longer valid */ -+ -+ return rc; -+} -+ -+int -+CIFSSMBCopy(const int xid, struct cifsTconInfo *tcon, const char * fromName, -+ const __u16 target_tid, const char *toName, const int flags, -+ const struct nls_table *nls_codepage) -+{ -+ int rc = 0; -+ COPY_REQ *pSMB = NULL; -+ COPY_RSP *pSMBr = NULL; -+ int bytes_returned; -+ int name_len, name_len2; -+ -+ cFYI(1, ("In CIFSSMBCopy")); -+copyRetry: -+ rc = smb_init(SMB_COM_COPY, 1, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ pSMB->BufferFormat = 0x04; -+ pSMB->Tid2 = target_tid; -+ -+ if(flags & COPY_TREE) -+ pSMB->Flags |= COPY_TREE; -+ pSMB->Flags = cpu_to_le16(pSMB->Flags); -+ -+ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len = cifs_strtoUCS((wchar_t *) pSMB->OldFileName, -+ fromName, -+ 530 /* find define for this maxpathcomponent */, -+ nls_codepage); -+ name_len++; /* trailing null */ -+ name_len *= 2; -+ pSMB->OldFileName[name_len] = 0x04; /* pad */ -+ /* protocol requires ASCII signature byte on Unicode string */ -+ pSMB->OldFileName[name_len + 1] = 0x00; -+ name_len2 = cifs_strtoUCS((wchar_t *) & pSMB-> -+ OldFileName[name_len + 2], toName, 530, -+ nls_codepage); -+ name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; -+ name_len2 *= 2; /* convert to bytes */ -+ } else { /* BB improve the check for buffer overruns BB */ -+ name_len = strnlen(fromName, 530); -+ name_len++; /* trailing null */ -+ strncpy(pSMB->OldFileName, fromName, name_len); -+ name_len2 = strnlen(toName, 530); -+ name_len2++; /* trailing null */ -+ pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */ -+ strncpy(&pSMB->OldFileName[name_len + 1], toName, name_len2); -+ name_len2++; /* trailing null */ -+ name_len2++; /* signature byte */ -+ } -+ -+ pSMB->ByteCount = 1 /* 1st signature byte */ + name_len + name_len2; -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cFYI(1, ("Send error in copy = %d with %d files copied", -+ rc, pSMBr->CopyCount)); -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ -+ if (rc == -EAGAIN) -+ goto copyRetry; -+ -+ return rc; -+} -+ -+int -+CIFSUnixCreateSymLink(const int xid, struct cifsTconInfo *tcon, -+ const char *fromName, const char *toName, -+ const struct nls_table *nls_codepage) -+{ -+ TRANSACTION2_SPI_REQ *pSMB = NULL; -+ TRANSACTION2_SPI_RSP *pSMBr = NULL; -+ char *data_offset; -+ int name_len; -+ int name_len_target; -+ int rc = 0; -+ int bytes_returned = 0; -+ -+ cFYI(1, ("In Symlink Unix style")); -+createSymLinkRetry: -+ rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len = -+ cifs_strtoUCS((wchar_t *) pSMB->FileName, fromName, 530 -+ /* find define for this maxpathcomponent */ -+ , nls_codepage); -+ name_len++; /* trailing null */ -+ name_len *= 2; -+ -+ } else { /* BB improve the check for buffer overruns BB */ -+ name_len = strnlen(fromName, 530); -+ name_len++; /* trailing null */ -+ strncpy(pSMB->FileName, fromName, name_len); -+ } -+ pSMB->ParameterCount = 6 + name_len; -+ pSMB->MaxSetupCount = 0; -+ pSMB->Reserved = 0; -+ pSMB->Flags = 0; -+ pSMB->Timeout = 0; -+ pSMB->Reserved2 = 0; -+ pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req, -+ InformationLevel) - 4; -+ pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; -+ -+ data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset; -+ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len_target = -+ cifs_strtoUCS((wchar_t *) data_offset, toName, 530 -+ /* find define for this maxpathcomponent */ -+ , nls_codepage); -+ name_len_target++; /* trailing null */ -+ name_len_target *= 2; -+ } else { /* BB improve the check for buffer overruns BB */ -+ name_len_target = strnlen(toName, 530); -+ name_len_target++; /* trailing null */ -+ strncpy(data_offset, toName, name_len_target); -+ } -+ -+ pSMB->DataCount = name_len_target; -+ pSMB->MaxParameterCount = cpu_to_le16(2); -+ /* BB find exact max on data count below from sess */ -+ pSMB->MaxDataCount = cpu_to_le16(1000); -+ pSMB->SetupCount = 1; -+ pSMB->Reserved3 = 0; -+ pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); -+ pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; -+ pSMB->DataCount = cpu_to_le16(pSMB->DataCount); -+ pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); -+ pSMB->TotalDataCount = pSMB->DataCount; -+ pSMB->TotalParameterCount = pSMB->ParameterCount; -+ pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); -+ pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); -+ pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_LINK); -+ pSMB->Reserved4 = 0; -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cFYI(1, -+ ("Send error in SetPathInfo (create symlink) = %d", -+ rc)); -+ } -+ -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ -+ if (rc == -EAGAIN) -+ goto createSymLinkRetry; -+ -+ return rc; -+} -+ -+int -+CIFSUnixCreateHardLink(const int xid, struct cifsTconInfo *tcon, -+ const char *fromName, const char *toName, -+ const struct nls_table *nls_codepage) -+{ -+ TRANSACTION2_SPI_REQ *pSMB = NULL; -+ TRANSACTION2_SPI_RSP *pSMBr = NULL; -+ char *data_offset; -+ int name_len; -+ int name_len_target; -+ int rc = 0; -+ int bytes_returned = 0; -+ -+ cFYI(1, ("In Create Hard link Unix style")); -+createHardLinkRetry: -+ rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len = cifs_strtoUCS((wchar_t *) pSMB->FileName, toName, 530 -+ /* find define for this maxpathcomponent */ -+ , nls_codepage); -+ name_len++; /* trailing null */ -+ name_len *= 2; -+ -+ } else { /* BB improve the check for buffer overruns BB */ -+ name_len = strnlen(toName, 530); -+ name_len++; /* trailing null */ -+ strncpy(pSMB->FileName, toName, name_len); -+ } -+ pSMB->ParameterCount = 6 + name_len; -+ pSMB->MaxSetupCount = 0; -+ pSMB->Reserved = 0; -+ pSMB->Flags = 0; -+ pSMB->Timeout = 0; -+ pSMB->Reserved2 = 0; -+ pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req, -+ InformationLevel) - 4; -+ pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; -+ -+ data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset; -+ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len_target = -+ cifs_strtoUCS((wchar_t *) data_offset, fromName, 530 -+ /* find define for this maxpathcomponent */ -+ , nls_codepage); -+ name_len_target++; /* trailing null */ -+ name_len_target *= 2; -+ } else { /* BB improve the check for buffer overruns BB */ -+ name_len_target = strnlen(fromName, 530); -+ name_len_target++; /* trailing null */ -+ strncpy(data_offset, fromName, name_len_target); -+ } -+ -+ pSMB->DataCount = name_len_target; -+ pSMB->MaxParameterCount = cpu_to_le16(2); -+ /* BB find exact max on data count below from sess*/ -+ pSMB->MaxDataCount = cpu_to_le16(1000); -+ pSMB->SetupCount = 1; -+ pSMB->Reserved3 = 0; -+ pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); -+ pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; -+ pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); -+ pSMB->TotalParameterCount = pSMB->ParameterCount; -+ pSMB->DataCount = cpu_to_le16(pSMB->DataCount); -+ pSMB->TotalDataCount = pSMB->DataCount; -+ pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); -+ pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); -+ pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_HLINK); -+ pSMB->Reserved4 = 0; -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cFYI(1, ("Send error in SetPathInfo (hard link) = %d", rc)); -+ } -+ -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ if (rc == -EAGAIN) -+ goto createHardLinkRetry; -+ -+ return rc; -+} -+ -+int -+CIFSCreateHardLink(const int xid, struct cifsTconInfo *tcon, -+ const char *fromName, const char *toName, -+ const struct nls_table *nls_codepage) -+{ -+ int rc = 0; -+ NT_RENAME_REQ *pSMB = NULL; -+ RENAME_RSP *pSMBr = NULL; -+ int bytes_returned; -+ int name_len, name_len2; -+ -+ cFYI(1, ("In CIFSCreateHardLink")); -+winCreateHardLinkRetry: -+ -+ rc = smb_init(SMB_COM_NT_RENAME, 4, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ pSMB->SearchAttributes = -+ cpu_to_le16(ATTR_READONLY | ATTR_HIDDEN | ATTR_SYSTEM | -+ ATTR_DIRECTORY); -+ pSMB->Flags = cpu_to_le16(CREATE_HARD_LINK); -+ pSMB->ClusterCount = 0; -+ -+ pSMB->BufferFormat = 0x04; -+ -+ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len = -+ cifs_strtoUCS((wchar_t *) pSMB->OldFileName, fromName, 530 -+ /* find define for this maxpathcomponent */ -+ , nls_codepage); -+ name_len++; /* trailing null */ -+ name_len *= 2; -+ pSMB->OldFileName[name_len] = 0; /* pad */ -+ pSMB->OldFileName[name_len + 1] = 0x04; -+ name_len2 = -+ cifs_strtoUCS((wchar_t *) & pSMB-> -+ OldFileName[name_len + 2], toName, 530, -+ nls_codepage); -+ name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; -+ name_len2 *= 2; /* convert to bytes */ -+ } else { /* BB improve the check for buffer overruns BB */ -+ name_len = strnlen(fromName, 530); -+ name_len++; /* trailing null */ -+ strncpy(pSMB->OldFileName, fromName, name_len); -+ name_len2 = strnlen(toName, 530); -+ name_len2++; /* trailing null */ -+ pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */ -+ strncpy(&pSMB->OldFileName[name_len + 1], toName, name_len2); -+ name_len2++; /* trailing null */ -+ name_len2++; /* signature byte */ -+ } -+ -+ pSMB->ByteCount = 1 /* string type byte */ + name_len + name_len2; -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cFYI(1, ("Send error in hard link (NT rename) = %d", rc)); -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ if (rc == -EAGAIN) -+ goto winCreateHardLinkRetry; -+ -+ return rc; -+} -+ -+int -+CIFSSMBUnixQuerySymLink(const int xid, struct cifsTconInfo *tcon, -+ const unsigned char *searchName, -+ char *symlinkinfo, const int buflen, -+ const struct nls_table *nls_codepage) -+{ -+/* SMB_QUERY_FILE_UNIX_LINK */ -+ TRANSACTION2_QPI_REQ *pSMB = NULL; -+ TRANSACTION2_QPI_RSP *pSMBr = NULL; -+ int rc = 0; -+ int bytes_returned; -+ int name_len; -+ -+ cFYI(1, ("In QPathSymLinkInfo (Unix) for path %s", searchName)); -+ -+querySymLinkRetry: -+ rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len = -+ cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530 -+ /* find define for this maxpathcomponent */ -+ , nls_codepage); -+ name_len++; /* trailing null */ -+ name_len *= 2; -+ } else { /* BB improve the check for buffer overruns BB */ -+ name_len = strnlen(searchName, 530); -+ name_len++; /* trailing null */ -+ strncpy(pSMB->FileName, searchName, name_len); -+ } -+ -+ pSMB->TotalParameterCount = -+ 2 /* level */ + 4 /* rsrvd */ + name_len /* incl null */ ; -+ pSMB->TotalDataCount = 0; -+ pSMB->MaxParameterCount = cpu_to_le16(2); -+ /* BB find exact max data count below from sess structure BB */ -+ pSMB->MaxDataCount = cpu_to_le16(4000); -+ pSMB->MaxSetupCount = 0; -+ pSMB->Reserved = 0; -+ pSMB->Flags = 0; -+ pSMB->Timeout = 0; -+ pSMB->Reserved2 = 0; -+ pSMB->ParameterOffset = cpu_to_le16(offsetof( -+ struct smb_com_transaction2_qpi_req ,InformationLevel) - 4); -+ pSMB->DataCount = 0; -+ pSMB->DataOffset = 0; -+ pSMB->SetupCount = 1; -+ pSMB->Reserved3 = 0; -+ pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION); -+ pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; -+ pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); -+ pSMB->ParameterCount = pSMB->TotalParameterCount; -+ pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_UNIX_LINK); -+ pSMB->Reserved4 = 0; -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cFYI(1, ("Send error in QuerySymLinkInfo = %d", rc)); -+ } else { /* decode response */ -+ pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); -+ pSMBr->DataCount = le16_to_cpu(pSMBr->DataCount); -+ if ((pSMBr->ByteCount < 2) || (pSMBr->DataOffset > 512)) -+ /* BB also check enough total bytes returned */ -+ rc = -EIO; /* bad smb */ -+ else { -+ if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len = UniStrnlen((wchar_t *) ((char *) -+ &pSMBr->hdr.Protocol +pSMBr->DataOffset), -+ min_t(const int, buflen,pSMBr->DataCount) / 2); -+ cifs_strfromUCS_le(symlinkinfo, -+ (wchar_t *) ((char *)&pSMBr->hdr.Protocol + -+ pSMBr->DataOffset), -+ name_len, nls_codepage); -+ } else { -+ strncpy(symlinkinfo, -+ (char *) &pSMBr->hdr.Protocol + -+ pSMBr->DataOffset, -+ min_t(const int, buflen, pSMBr->DataCount)); -+ } -+ symlinkinfo[buflen] = 0; -+ /* just in case so calling code does not go off the end of buffer */ -+ } -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ if (rc == -EAGAIN) -+ goto querySymLinkRetry; -+ return rc; -+} -+ -+ -+ -+int -+CIFSSMBQueryReparseLinkInfo(const int xid, struct cifsTconInfo *tcon, -+ const unsigned char *searchName, -+ char *symlinkinfo, const int buflen,__u16 fid, -+ const struct nls_table *nls_codepage) -+{ -+ int rc = 0; -+ int bytes_returned; -+ int name_len; -+ struct smb_com_transaction_ioctl_req * pSMB; -+ struct smb_com_transaction_ioctl_rsp * pSMBr; -+ -+ cFYI(1, ("In Windows reparse style QueryLink for path %s", searchName)); -+ rc = smb_init(SMB_COM_NT_TRANSACT, 23, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ pSMB->TotalParameterCount = 0 ; -+ pSMB->TotalDataCount = 0; -+ pSMB->MaxParameterCount = cpu_to_le32(2); -+ /* BB find exact data count max from sess structure BB */ -+ pSMB->MaxDataCount = cpu_to_le32(4000); -+ pSMB->MaxSetupCount = 4; -+ pSMB->Reserved = 0; -+ pSMB->ParameterOffset = 0; -+ pSMB->DataCount = 0; -+ pSMB->DataOffset = 0; -+ pSMB->SetupCount = 4; -+ pSMB->SubCommand = cpu_to_le16(NT_TRANSACT_IOCTL); -+ pSMB->ParameterCount = pSMB->TotalParameterCount; -+ pSMB->FunctionCode = cpu_to_le32(FSCTL_GET_REPARSE_POINT); -+ pSMB->IsFsctl = 1; /* FSCTL */ -+ pSMB->IsRootFlag = 0; -+ pSMB->Fid = fid; /* file handle always le */ -+ pSMB->ByteCount = 0; -+ -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cFYI(1, ("Send error in QueryReparseLinkInfo = %d", rc)); -+ } else { /* decode response */ -+ pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); -+ pSMBr->DataCount = le16_to_cpu(pSMBr->DataCount); -+ if ((pSMBr->ByteCount < 2) || (pSMBr->DataOffset > 512)) -+ /* BB also check enough total bytes returned */ -+ rc = -EIO; /* bad smb */ -+ else { -+ if(pSMBr->DataCount && (pSMBr->DataCount < 2048)) { -+ /* could also validate reparse tag && better check name length */ -+ struct reparse_data * reparse_buf = (struct reparse_data *) -+ ((char *)&pSMBr->hdr.Protocol + pSMBr->DataOffset); -+ if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len = UniStrnlen((wchar_t *) -+ (reparse_buf->LinkNamesBuf + -+ reparse_buf->TargetNameOffset), -+ min(buflen/2, reparse_buf->TargetNameLen / 2)); -+ cifs_strfromUCS_le(symlinkinfo, -+ (wchar_t *) (reparse_buf->LinkNamesBuf + -+ reparse_buf->TargetNameOffset), -+ name_len, nls_codepage); -+ } else { /* ASCII names */ -+ strncpy(symlinkinfo,reparse_buf->LinkNamesBuf + -+ reparse_buf->TargetNameOffset, -+ min_t(const int, buflen, reparse_buf->TargetNameLen)); -+ } -+ } else { -+ rc = -EIO; -+ cFYI(1,("Invalid return data count on get reparse info ioctl")); -+ } -+ symlinkinfo[buflen] = 0; /* just in case so the caller -+ does not go off the end of the buffer */ -+ cFYI(1,("readlink result - %s ",symlinkinfo)); -+ } -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ -+ /* Note: On -EAGAIN error only caller can retry on handle based calls -+ since file handle passed in no longer valid */ -+ -+ return rc; -+} -+ -+int -+CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon, -+ const unsigned char *searchName, -+ FILE_ALL_INFO * pFindData, -+ const struct nls_table *nls_codepage) -+{ -+/* level 263 SMB_QUERY_FILE_ALL_INFO */ -+ TRANSACTION2_QPI_REQ *pSMB = NULL; -+ TRANSACTION2_QPI_RSP *pSMBr = NULL; -+ int rc = 0; -+ int bytes_returned; -+ int name_len; -+ -+ cFYI(1, ("In QPathInfo path %s", searchName)); -+QPathInfoRetry: -+ rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len = -+ cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530 -+ /* find define for this maxpathcomponent */ -+ , nls_codepage); -+ name_len++; /* trailing null */ -+ name_len *= 2; -+ } else { /* BB improve the check for buffer overruns BB */ -+ name_len = strnlen(searchName, 530); -+ name_len++; /* trailing null */ -+ strncpy(pSMB->FileName, searchName, name_len); -+ } -+ -+ pSMB->TotalParameterCount = 2 /* level */ + 4 /* reserved */ + -+ name_len /* includes null */ ; -+ pSMB->TotalDataCount = 0; -+ pSMB->MaxParameterCount = cpu_to_le16(2); -+ pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ -+ pSMB->MaxSetupCount = 0; -+ pSMB->Reserved = 0; -+ pSMB->Flags = 0; -+ pSMB->Timeout = 0; -+ pSMB->Reserved2 = 0; -+ pSMB->ParameterOffset = cpu_to_le16(offsetof( -+ struct smb_com_transaction2_qpi_req ,InformationLevel) - 4); -+ pSMB->DataCount = 0; -+ pSMB->DataOffset = 0; -+ pSMB->SetupCount = 1; -+ pSMB->Reserved3 = 0; -+ pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION); -+ pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; -+ pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); -+ pSMB->ParameterCount = pSMB->TotalParameterCount; -+ pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_ALL_INFO); -+ pSMB->Reserved4 = 0; -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cFYI(1, ("Send error in QPathInfo = %d", rc)); -+ } else { /* decode response */ -+ pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); -+ /* BB also check enough total bytes returned */ -+ /* BB we need to improve the validity checking -+ of these trans2 responses */ -+ if ((pSMBr->ByteCount < 40) || (pSMBr->DataOffset > 512)) -+ rc = -EIO; /* bad smb */ -+ else if (pFindData){ -+ memcpy((char *) pFindData, -+ (char *) &pSMBr->hdr.Protocol + -+ pSMBr->DataOffset, sizeof (FILE_ALL_INFO)); -+ } else -+ rc = -ENOMEM; -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ if (rc == -EAGAIN) -+ goto QPathInfoRetry; -+ -+ return rc; -+} -+ -+int -+CIFSSMBUnixQPathInfo(const int xid, struct cifsTconInfo *tcon, -+ const unsigned char *searchName, -+ FILE_UNIX_BASIC_INFO * pFindData, -+ const struct nls_table *nls_codepage) -+{ -+/* SMB_QUERY_FILE_UNIX_BASIC */ -+ TRANSACTION2_QPI_REQ *pSMB = NULL; -+ TRANSACTION2_QPI_RSP *pSMBr = NULL; -+ int rc = 0; -+ int bytes_returned = 0; -+ int name_len; -+ -+ cFYI(1, ("In QPathInfo (Unix) the path %s", searchName)); -+UnixQPathInfoRetry: -+ rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len = -+ cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530 -+ /* find define for this maxpathcomponent */ -+ , nls_codepage); -+ name_len++; /* trailing null */ -+ name_len *= 2; -+ } else { /* BB improve the check for buffer overruns BB */ -+ name_len = strnlen(searchName, 530); -+ name_len++; /* trailing null */ -+ strncpy(pSMB->FileName, searchName, name_len); -+ } -+ -+ pSMB->TotalParameterCount = 2 /* level */ + 4 /* reserved */ + -+ name_len /* includes null */ ; -+ pSMB->TotalDataCount = 0; -+ pSMB->MaxParameterCount = cpu_to_le16(2); -+ /* BB find exact max SMB PDU from sess structure BB */ -+ pSMB->MaxDataCount = cpu_to_le16(4000); -+ pSMB->MaxSetupCount = 0; -+ pSMB->Reserved = 0; -+ pSMB->Flags = 0; -+ pSMB->Timeout = 0; -+ pSMB->Reserved2 = 0; -+ pSMB->ParameterOffset = cpu_to_le16(offsetof( -+ struct smb_com_transaction2_qpi_req ,InformationLevel) - 4); -+ pSMB->DataCount = 0; -+ pSMB->DataOffset = 0; -+ pSMB->SetupCount = 1; -+ pSMB->Reserved3 = 0; -+ pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION); -+ pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; -+ pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); -+ pSMB->ParameterCount = pSMB->TotalParameterCount; -+ pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_UNIX_BASIC); -+ pSMB->Reserved4 = 0; -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cFYI(1, ("Send error in QPathInfo = %d", rc)); -+ } else { /* decode response */ -+ pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); -+ /* BB also check if enough total bytes returned */ -+ if ((pSMBr->ByteCount < sizeof(FILE_UNIX_BASIC_INFO)) || -+ (pSMBr->DataOffset > 512) || -+ (pSMBr->DataOffset < sizeof(struct smb_hdr))) { -+ cFYI(1,("UnixQPathinfo invalid data offset %d bytes returned %d", -+ (int)pSMBr->DataOffset,bytes_returned)); -+ rc = -EIO; /* bad smb */ -+ } else { -+ memcpy((char *) pFindData, -+ (char *) &pSMBr->hdr.Protocol + -+ pSMBr->DataOffset, -+ sizeof (FILE_UNIX_BASIC_INFO)); -+ } -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ if (rc == -EAGAIN) -+ goto UnixQPathInfoRetry; -+ -+ return rc; -+} -+ -+int -+CIFSFindSingle(const int xid, struct cifsTconInfo *tcon, -+ const char *searchName, FILE_ALL_INFO * findData, -+ const struct nls_table *nls_codepage) -+{ -+/* level 257 SMB_ */ -+ TRANSACTION2_FFIRST_REQ *pSMB = NULL; -+ TRANSACTION2_FFIRST_RSP *pSMBr = NULL; -+ int rc = 0; -+ int bytes_returned; -+ int name_len; -+ -+ cFYI(1, ("In FindUnique")); -+findUniqueRetry: -+ rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len = -+ cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530 -+ /* find define for this maxpathcomponent */ -+ , nls_codepage); -+ name_len++; /* trailing null */ -+ name_len *= 2; -+ } else { /* BB improve the check for buffer overruns BB */ -+ name_len = strnlen(searchName, 530); -+ name_len++; /* trailing null */ -+ strncpy(pSMB->FileName, searchName, name_len); -+ } -+ -+ pSMB->TotalParameterCount = 12 + name_len /* includes null */ ; -+ pSMB->TotalDataCount = 0; /* no EAs */ -+ pSMB->MaxParameterCount = cpu_to_le16(2); -+ pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ -+ pSMB->MaxSetupCount = 0; -+ pSMB->Reserved = 0; -+ pSMB->Flags = 0; -+ pSMB->Timeout = 0; -+ pSMB->Reserved2 = 0; -+ pSMB->ParameterOffset = cpu_to_le16( -+ offsetof(struct smb_com_transaction2_ffirst_req,InformationLevel) - 4); -+ pSMB->DataCount = 0; -+ pSMB->DataOffset = 0; -+ pSMB->SetupCount = 1; /* one byte, no need to le convert */ -+ pSMB->Reserved3 = 0; -+ pSMB->SubCommand = cpu_to_le16(TRANS2_FIND_FIRST); -+ pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; -+ pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalDataCount); -+ pSMB->ParameterCount = pSMB->TotalParameterCount; -+ pSMB->SearchAttributes = -+ cpu_to_le16(ATTR_READONLY | ATTR_HIDDEN | ATTR_SYSTEM | -+ ATTR_DIRECTORY); -+ pSMB->SearchCount = cpu_to_le16(16); /* BB increase */ -+ pSMB->SearchFlags = cpu_to_le16(1); -+ pSMB->InformationLevel = cpu_to_le16(SMB_FIND_FILE_DIRECTORY_INFO); -+ pSMB->SearchStorageType = 0; /* BB what should we set this to? BB */ -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ -+ if (rc) { -+ cFYI(1, ("Send error in FindFileDirInfo = %d", rc)); -+ } else { /* decode response */ -+ -+ /* BB fill in */ -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ if (rc == -EAGAIN) -+ goto findUniqueRetry; -+ -+ return rc; -+} -+ -+int -+CIFSFindFirst(const int xid, struct cifsTconInfo *tcon, -+ const char *searchName, FILE_DIRECTORY_INFO * findData, -+ T2_FFIRST_RSP_PARMS * findParms, -+ const struct nls_table *nls_codepage, int *pUnicodeFlag, -+ int *pUnixFlag) -+{ -+/* level 257 SMB_ */ -+ TRANSACTION2_FFIRST_REQ *pSMB = NULL; -+ TRANSACTION2_FFIRST_RSP *pSMBr = NULL; -+ char *response_data; -+ int rc = 0; -+ int bytes_returned; -+ int name_len; -+ -+ cFYI(1, ("In FindFirst")); -+findFirstRetry: -+ rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len = -+ cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530 -+ /* find define for this maxpathcomponent */ -+ , nls_codepage); -+ name_len++; /* trailing null */ -+ name_len *= 2; -+ } else { /* BB improve the check for buffer overruns BB */ -+ name_len = strnlen(searchName, 530); -+ name_len++; /* trailing null */ -+ strncpy(pSMB->FileName, searchName, name_len); -+ } -+ -+ pSMB->TotalParameterCount = 12 + name_len /* includes null */ ; -+ pSMB->TotalDataCount = 0; /* no EAs */ -+ pSMB->MaxParameterCount = cpu_to_le16(10); -+ pSMB->MaxDataCount = cpu_to_le16((tcon->ses->server->maxBuf - -+ MAX_CIFS_HDR_SIZE) & 0xFFFFFF00); -+ pSMB->MaxSetupCount = 0; -+ pSMB->Reserved = 0; -+ pSMB->Flags = 0; -+ pSMB->Timeout = 0; -+ pSMB->Reserved2 = 0; -+ pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; -+ pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); -+ pSMB->ParameterCount = pSMB->TotalParameterCount; -+ pSMB->ParameterOffset = cpu_to_le16(offsetof(struct -+ smb_com_transaction2_ffirst_req, SearchAttributes) - 4); -+ pSMB->DataCount = 0; -+ pSMB->DataOffset = 0; -+ pSMB->SetupCount = 1; /* one byte no need to make endian neutral */ -+ pSMB->Reserved3 = 0; -+ pSMB->SubCommand = cpu_to_le16(TRANS2_FIND_FIRST); -+ pSMB->SearchAttributes = -+ cpu_to_le16(ATTR_READONLY | ATTR_HIDDEN | ATTR_SYSTEM | -+ ATTR_DIRECTORY); -+ pSMB->SearchCount = cpu_to_le16(CIFS_MAX_MSGSIZE / sizeof (FILE_DIRECTORY_INFO)); /* should this be shrunk even more ? */ -+ pSMB->SearchFlags = cpu_to_le16(CIFS_SEARCH_CLOSE_AT_END | CIFS_SEARCH_RETURN_RESUME); -+ -+ /* test for Unix extensions */ -+ if (tcon->ses->capabilities & CAP_UNIX) { -+ pSMB->InformationLevel = cpu_to_le16(SMB_FIND_FILE_UNIX); -+ *pUnixFlag = TRUE; -+ } else { -+ pSMB->InformationLevel = -+ cpu_to_le16(SMB_FIND_FILE_DIRECTORY_INFO); -+ *pUnixFlag = FALSE; -+ } -+ pSMB->SearchStorageType = 0; /* BB what should we set this to? It is not clear if it matters BB */ -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ -+ if (rc) { /* BB add logic to retry regular search if Unix search rejected unexpectedly by server */ -+ cFYI(1, ("Error in FindFirst = %d", rc)); -+ } else { /* decode response */ -+ /* BB add safety checks for these memcpys */ -+ if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) -+ *pUnicodeFlag = TRUE; -+ else -+ *pUnicodeFlag = FALSE; -+ memcpy(findParms, -+ (char *) &pSMBr->hdr.Protocol + -+ le16_to_cpu(pSMBr->ParameterOffset), -+ sizeof (T2_FFIRST_RSP_PARMS)); -+ /* search handle can stay LE and EAoffset not needed so not converted */ -+ findParms->EndofSearch = le16_to_cpu(findParms->EndofSearch); -+ findParms->LastNameOffset = -+ le16_to_cpu(findParms->LastNameOffset); -+ findParms->SearchCount = le16_to_cpu(findParms->SearchCount); -+ response_data = -+ (char *) &pSMBr->hdr.Protocol + -+ le16_to_cpu(pSMBr->DataOffset); -+ memcpy(findData, response_data, le16_to_cpu(pSMBr->DataCount)); -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ -+ if (rc == -EAGAIN) -+ goto findFirstRetry; -+ -+ return rc; -+} -+ -+int -+CIFSFindNext(const int xid, struct cifsTconInfo *tcon, -+ FILE_DIRECTORY_INFO * findData, T2_FNEXT_RSP_PARMS * findParms, -+ const __u16 searchHandle, char * resume_file_name, int name_len, -+ __u32 resume_key, int *pUnicodeFlag, int *pUnixFlag) -+{ -+/* level 257 SMB_ */ -+ TRANSACTION2_FNEXT_REQ *pSMB = NULL; -+ TRANSACTION2_FNEXT_RSP *pSMBr = NULL; -+ char *response_data; -+ int rc = 0; -+ int bytes_returned; -+ -+ cFYI(1, ("In FindNext")); -+ -+ if(resume_file_name == NULL) { -+ return -EIO; -+ } -+ rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ pSMB->TotalParameterCount = 14; /* includes 2 bytes of null string, converted to LE below */ -+ pSMB->TotalDataCount = 0; /* no EAs */ -+ pSMB->MaxParameterCount = cpu_to_le16(8); -+ pSMB->MaxDataCount = -+ cpu_to_le16((tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFF00); -+ pSMB->MaxSetupCount = 0; -+ pSMB->Reserved = 0; -+ pSMB->Flags = 0; -+ pSMB->Timeout = 0; -+ pSMB->Reserved2 = 0; -+ pSMB->ParameterOffset = cpu_to_le16(offsetof( -+ struct smb_com_transaction2_fnext_req,SearchHandle) - 4); -+ pSMB->DataCount = 0; -+ pSMB->DataOffset = 0; -+ pSMB->SetupCount = 1; -+ pSMB->Reserved3 = 0; -+ pSMB->SubCommand = cpu_to_le16(TRANS2_FIND_NEXT); -+ pSMB->SearchHandle = searchHandle; /* always kept as le */ -+ findParms->SearchCount = 0; /* set to zero in case of error */ -+ pSMB->SearchCount = -+ cpu_to_le16(CIFS_MAX_MSGSIZE / sizeof (FILE_DIRECTORY_INFO)); -+ /* test for Unix extensions */ -+ if (tcon->ses->capabilities & CAP_UNIX) { -+ pSMB->InformationLevel = cpu_to_le16(SMB_FIND_FILE_UNIX); -+ *pUnixFlag = TRUE; -+ } else { -+ pSMB->InformationLevel = -+ cpu_to_le16(SMB_FIND_FILE_DIRECTORY_INFO); -+ *pUnixFlag = FALSE; -+ } -+ pSMB->ResumeKey = resume_key; -+ pSMB->SearchFlags = -+ cpu_to_le16(CIFS_SEARCH_CLOSE_AT_END | CIFS_SEARCH_RETURN_RESUME); -+ /* BB add check to make sure we do not cross end of smb */ -+ if(name_len < CIFS_MAX_MSGSIZE) { -+ memcpy(pSMB->ResumeFileName, resume_file_name, name_len); -+ pSMB->ByteCount += name_len; -+ } -+ pSMB->TotalParameterCount += name_len; -+ pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; -+ pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); -+ pSMB->ParameterCount = pSMB->TotalParameterCount; -+ /* BB improve error handling here */ -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ -+ if (rc) { -+ if (rc == -EBADF) -+ rc = 0; /* search probably was closed at end of search above */ -+ else -+ cFYI(1, ("FindNext returned = %d", rc)); -+ } else { /* decode response */ -+ /* BB add safety checks for these memcpys */ -+ if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) -+ *pUnicodeFlag = TRUE; -+ else -+ *pUnicodeFlag = FALSE; -+ memcpy(findParms, -+ (char *) &pSMBr->hdr.Protocol + -+ le16_to_cpu(pSMBr->ParameterOffset), -+ sizeof (T2_FNEXT_RSP_PARMS)); -+ findParms->EndofSearch = le16_to_cpu(findParms->EndofSearch); -+ findParms->LastNameOffset = -+ le16_to_cpu(findParms->LastNameOffset); -+ findParms->SearchCount = le16_to_cpu(findParms->SearchCount); -+ response_data = -+ (char *) &pSMBr->hdr.Protocol + -+ le16_to_cpu(pSMBr->DataOffset); -+ memcpy(findData, response_data, le16_to_cpu(pSMBr->DataCount)); -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ -+ /* Note: On -EAGAIN error only caller can retry on handle based calls -+ since file handle passed in no longer valid */ -+ -+ return rc; -+} -+ -+int -+CIFSFindClose(const int xid, struct cifsTconInfo *tcon, const __u16 searchHandle) -+{ -+ int rc = 0; -+ FINDCLOSE_REQ *pSMB = NULL; -+ CLOSE_RSP *pSMBr = NULL; -+ int bytes_returned; -+ -+ cFYI(1, ("In CIFSSMBFindClose")); -+ rc = smb_init(SMB_COM_FIND_CLOSE2, 1, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ /* no sense returning error if session restarted -+ file handle has been closed */ -+ if(rc == -EAGAIN) -+ return 0; -+ if (rc) -+ return rc; -+ -+ pSMB->FileID = searchHandle; -+ pSMB->ByteCount = 0; -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cERROR(1, ("Send error in FindClose = %d", rc)); -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ -+ /* Since session is dead, search handle closed on server already */ -+ if (rc == -EAGAIN) -+ rc = 0; -+ -+ return rc; -+} -+ -+int -+CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses, -+ const unsigned char *searchName, -+ unsigned char **targetUNCs, -+ unsigned int *number_of_UNC_in_array, -+ const struct nls_table *nls_codepage) -+{ -+/* TRANS2_GET_DFS_REFERRAL */ -+ TRANSACTION2_GET_DFS_REFER_REQ *pSMB = NULL; -+ TRANSACTION2_GET_DFS_REFER_RSP *pSMBr = NULL; -+ struct dfs_referral_level_3 * referrals = NULL; -+ int rc = 0; -+ int bytes_returned; -+ int name_len; -+ unsigned int i; -+ char * temp; -+ *number_of_UNC_in_array = 0; -+ *targetUNCs = NULL; -+ -+ cFYI(1, ("In GetDFSRefer the path %s", searchName)); -+ if (ses == NULL) -+ return -ENODEV; -+getDFSRetry: -+ rc = smb_init(SMB_COM_TRANSACTION2, 15, NULL, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ pSMB->hdr.Tid = ses->ipc_tid; -+ pSMB->hdr.Uid = ses->Suid; -+ if (ses->capabilities & CAP_STATUS32) { -+ pSMB->hdr.Flags2 |= SMBFLG2_ERR_STATUS; -+ } -+ if (ses->capabilities & CAP_DFS) { -+ pSMB->hdr.Flags2 |= SMBFLG2_DFS; -+ } -+ -+ if (ses->capabilities & CAP_UNICODE) { -+ pSMB->hdr.Flags2 |= SMBFLG2_UNICODE; -+ name_len = -+ cifs_strtoUCS((wchar_t *) pSMB->RequestFileName, -+ searchName, 530 -+ /* find define for this maxpathcomponent */ -+ , nls_codepage); -+ name_len++; /* trailing null */ -+ name_len *= 2; -+ } else { /* BB improve the check for buffer overruns BB */ -+ name_len = strnlen(searchName, 530); -+ name_len++; /* trailing null */ -+ strncpy(pSMB->RequestFileName, searchName, name_len); -+ } -+ -+ pSMB->ParameterCount = 2 /* level */ + name_len /*includes null */ ; -+ pSMB->TotalDataCount = 0; -+ pSMB->DataCount = 0; -+ pSMB->DataOffset = 0; -+ pSMB->MaxParameterCount = 0; -+ pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ -+ pSMB->MaxSetupCount = 0; -+ pSMB->Reserved = 0; -+ pSMB->Flags = 0; -+ pSMB->Timeout = 0; -+ pSMB->Reserved2 = 0; -+ pSMB->ParameterOffset = cpu_to_le16(offsetof( -+ struct smb_com_transaction2_get_dfs_refer_req, MaxReferralLevel) - 4); -+ pSMB->SetupCount = 1; -+ pSMB->Reserved3 = 0; -+ pSMB->SubCommand = cpu_to_le16(TRANS2_GET_DFS_REFERRAL); -+ pSMB->ByteCount = pSMB->ParameterCount + 3 /* pad */ ; -+ pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); -+ pSMB->TotalParameterCount = pSMB->ParameterCount; -+ pSMB->MaxReferralLevel = cpu_to_le16(3); -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ -+ rc = SendReceive(xid, ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cFYI(1, ("Send error in GetDFSRefer = %d", rc)); -+ } else { /* decode response */ -+/* BB Add logic to parse referrals here */ -+ pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); -+ pSMBr->DataCount = le16_to_cpu(pSMBr->DataCount); -+ cFYI(1, -+ ("Decoding GetDFSRefer response. BCC: %d Offset %d", -+ pSMBr->ByteCount, pSMBr->DataOffset)); -+ if ((pSMBr->ByteCount < 17) || (pSMBr->DataOffset > 512)) /* BB also check enough total bytes returned */ -+ rc = -EIO; /* bad smb */ -+ else { -+ referrals = -+ (struct dfs_referral_level_3 *) -+ (8 /* sizeof start of data block */ + -+ pSMBr->DataOffset + -+ (char *) &pSMBr->hdr.Protocol); -+ cFYI(1,("num_referrals: %d dfs flags: 0x%x ... \nfor referral one refer size: 0x%x srv type: 0x%x refer flags: 0x%x ttl: 0x%x",pSMBr->NumberOfReferrals,pSMBr->DFSFlags, referrals->ReferralSize,referrals->ServerType,referrals->ReferralFlags,referrals->TimeToLive)); -+ /* BB This field is actually two bytes in from start of -+ data block so we could do safety check that DataBlock -+ begins at address of pSMBr->NumberOfReferrals */ -+ *number_of_UNC_in_array = le16_to_cpu(pSMBr->NumberOfReferrals); -+ -+ /* BB Fix below so can return more than one referral */ -+ if(*number_of_UNC_in_array > 1) -+ *number_of_UNC_in_array = 1; -+ -+ /* get the length of the strings describing refs */ -+ name_len = 0; -+ for(i=0;i<*number_of_UNC_in_array;i++) { -+ /* make sure that DfsPathOffset not past end */ -+ referrals->DfsPathOffset = le16_to_cpu(referrals->DfsPathOffset); -+ if(referrals->DfsPathOffset > pSMBr->DataCount) { -+ /* if invalid referral, stop here and do -+ not try to copy any more */ -+ *number_of_UNC_in_array = i; -+ break; -+ } -+ temp = ((char *)referrals) + referrals->DfsPathOffset; -+ -+ if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len += UniStrnlen((wchar_t *)temp,pSMBr->DataCount); -+ } else { -+ name_len += strnlen(temp,pSMBr->DataCount); -+ } -+ referrals++; -+ /* BB add check that referral pointer does not fall off end PDU */ -+ -+ } -+ /* BB add check for name_len bigger than bcc */ -+ *targetUNCs = -+ kmalloc(name_len+1+ (*number_of_UNC_in_array),GFP_KERNEL); -+ /* copy the ref strings */ -+ referrals = -+ (struct dfs_referral_level_3 *) -+ (8 /* sizeof data hdr */ + -+ pSMBr->DataOffset + -+ (char *) &pSMBr->hdr.Protocol); -+ -+ for(i=0;i<*number_of_UNC_in_array;i++) { -+ temp = ((char *)referrals) + referrals->DfsPathOffset; -+ if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) { -+ cifs_strfromUCS_le(*targetUNCs, -+ (wchar_t *) temp, name_len, nls_codepage); -+ } else { -+ strncpy(*targetUNCs,temp,name_len); -+ } -+ /* BB update target_uncs pointers */ -+ referrals++; -+ } -+ temp = *targetUNCs; -+ temp[name_len] = 0; -+ } -+ -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ -+ if (rc == -EAGAIN) -+ goto getDFSRetry; -+ -+ return rc; -+} -+ -+int -+CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon, -+ struct statfs *FSData, const struct nls_table *nls_codepage) -+{ -+/* level 0x103 SMB_QUERY_FILE_SYSTEM_INFO */ -+ TRANSACTION2_QFSI_REQ *pSMB = NULL; -+ TRANSACTION2_QFSI_RSP *pSMBr = NULL; -+ FILE_SYSTEM_INFO *response_data; -+ int rc = 0; -+ int bytes_returned = 0; -+ -+ cFYI(1, ("In QFSInfo")); -+QFSInfoRetry: -+ rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ pSMB->TotalParameterCount = 2; /* level */ -+ pSMB->TotalDataCount = 0; -+ pSMB->MaxParameterCount = cpu_to_le16(2); -+ pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ -+ pSMB->MaxSetupCount = 0; -+ pSMB->Reserved = 0; -+ pSMB->Flags = 0; -+ pSMB->Timeout = 0; -+ pSMB->Reserved2 = 0; -+ pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; -+ pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); -+ pSMB->ParameterCount = pSMB->TotalParameterCount; -+ pSMB->ParameterOffset = cpu_to_le16(offsetof( -+ struct smb_com_transaction2_qfsi_req, InformationLevel) - 4); -+ pSMB->DataCount = 0; -+ pSMB->DataOffset = 0; -+ pSMB->SetupCount = 1; -+ pSMB->Reserved3 = 0; -+ pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION); -+ pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FS_SIZE_INFO); -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cERROR(1, ("Send error in QFSInfo = %d", rc)); -+ } else { /* decode response */ -+ pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); -+ cFYI(1, -+ ("Decoding qfsinfo response. BCC: %d Offset %d", -+ pSMBr->ByteCount, pSMBr->DataOffset)); -+ if ((pSMBr->ByteCount < 24) || (pSMBr->DataOffset > 512)) /* BB also check enough total bytes returned */ -+ rc = -EIO; /* bad smb */ -+ else { -+ response_data = -+ (FILE_SYSTEM_INFO -+ *) (((char *) &pSMBr->hdr.Protocol) + -+ pSMBr->DataOffset); -+ FSData->f_bsize = -+ le32_to_cpu(response_data->BytesPerSector) * -+ le32_to_cpu(response_data-> -+ SectorsPerAllocationUnit); -+ FSData->f_blocks = -+ le64_to_cpu(response_data->TotalAllocationUnits); -+ FSData->f_bfree = FSData->f_bavail = -+ le64_to_cpu(response_data->FreeAllocationUnits); -+ cFYI(1, -+ ("Blocks: %lld Free: %lld Block size %ld", -+ (unsigned long long)FSData->f_blocks, -+ (unsigned long long)FSData->f_bfree, -+ FSData->f_bsize)); -+ } -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ -+ if (rc == -EAGAIN) -+ goto QFSInfoRetry; -+ -+ return rc; -+} -+ -+int -+CIFSSMBQFSAttributeInfo(int xid, struct cifsTconInfo *tcon, -+ const struct nls_table *nls_codepage) -+{ -+/* level 0x105 SMB_QUERY_FILE_SYSTEM_INFO */ -+ TRANSACTION2_QFSI_REQ *pSMB = NULL; -+ TRANSACTION2_QFSI_RSP *pSMBr = NULL; -+ FILE_SYSTEM_ATTRIBUTE_INFO *response_data; -+ int rc = 0; -+ int bytes_returned = 0; -+ -+ cFYI(1, ("In QFSAttributeInfo")); -+QFSAttributeRetry: -+ rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ pSMB->TotalParameterCount = 2; /* level */ -+ pSMB->TotalDataCount = 0; -+ pSMB->MaxParameterCount = cpu_to_le16(2); -+ pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ -+ pSMB->MaxSetupCount = 0; -+ pSMB->Reserved = 0; -+ pSMB->Flags = 0; -+ pSMB->Timeout = 0; -+ pSMB->Reserved2 = 0; -+ pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; -+ pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); -+ pSMB->ParameterCount = pSMB->TotalParameterCount; -+ pSMB->ParameterOffset = cpu_to_le16(offsetof( -+ struct smb_com_transaction2_qfsi_req, InformationLevel) - 4); -+ pSMB->DataCount = 0; -+ pSMB->DataOffset = 0; -+ pSMB->SetupCount = 1; -+ pSMB->Reserved3 = 0; -+ pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION); -+ pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FS_ATTRIBUTE_INFO); -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cERROR(1, ("Send error in QFSAttributeInfo = %d", rc)); -+ } else { /* decode response */ -+ pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); -+ if ((pSMBr->ByteCount < 13) || (pSMBr->DataOffset > 512)) { /* BB also check enough bytes returned */ -+ rc = -EIO; /* bad smb */ -+ } else { -+ response_data = -+ (FILE_SYSTEM_ATTRIBUTE_INFO -+ *) (((char *) &pSMBr->hdr.Protocol) + -+ pSMBr->DataOffset); -+ response_data->Attributes = le32_to_cpu(response_data->Attributes); -+ response_data->MaxPathNameComponentLength = -+ le32_to_cpu(response_data->MaxPathNameComponentLength); -+ response_data->FileSystemNameLen = -+ le32_to_cpu(response_data->FileSystemNameLen); -+ memcpy(&tcon->fsAttrInfo, response_data, -+ sizeof (FILE_SYSTEM_ATTRIBUTE_INFO)); -+ } -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ -+ if (rc == -EAGAIN) -+ goto QFSAttributeRetry; -+ -+ return rc; -+} -+ -+int -+CIFSSMBQFSDeviceInfo(int xid, struct cifsTconInfo *tcon, -+ const struct nls_table *nls_codepage) -+{ -+/* level 0x104 SMB_QUERY_FILE_SYSTEM_INFO */ -+ TRANSACTION2_QFSI_REQ *pSMB = NULL; -+ TRANSACTION2_QFSI_RSP *pSMBr = NULL; -+ FILE_SYSTEM_DEVICE_INFO *response_data; -+ int rc = 0; -+ int bytes_returned = 0; -+ -+ cFYI(1, ("In QFSDeviceInfo")); -+QFSDeviceRetry: -+ rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ pSMB->TotalParameterCount = 2; /* level */ -+ pSMB->TotalDataCount = 0; -+ pSMB->MaxParameterCount = cpu_to_le16(2); -+ pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ -+ pSMB->MaxSetupCount = 0; -+ pSMB->Reserved = 0; -+ pSMB->Flags = 0; -+ pSMB->Timeout = 0; -+ pSMB->Reserved2 = 0; -+ pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; -+ pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); -+ pSMB->ParameterCount = pSMB->TotalParameterCount; -+ pSMB->ParameterOffset = cpu_to_le16(offsetof( -+ struct smb_com_transaction2_qfsi_req, InformationLevel) - 4); -+ -+ pSMB->DataCount = 0; -+ pSMB->DataOffset = 0; -+ pSMB->SetupCount = 1; -+ pSMB->Reserved3 = 0; -+ pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION); -+ pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FS_DEVICE_INFO); -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cFYI(1, ("Send error in QFSDeviceInfo = %d", rc)); -+ } else { /* decode response */ -+ pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); -+ if ((pSMBr->ByteCount < sizeof (FILE_SYSTEM_DEVICE_INFO)) -+ || (pSMBr->DataOffset > 512)) -+ rc = -EIO; /* bad smb */ -+ else { -+ response_data = -+ (FILE_SYSTEM_DEVICE_INFO -+ *) (((char *) &pSMBr->hdr.Protocol) + -+ pSMBr->DataOffset); -+ response_data->DeviceType = -+ le32_to_cpu(response_data->DeviceType); -+ response_data->DeviceCharacteristics = -+ le32_to_cpu(response_data->DeviceCharacteristics); -+ memcpy(&tcon->fsDevInfo, response_data, -+ sizeof (FILE_SYSTEM_DEVICE_INFO)); -+ } -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ -+ if (rc == -EAGAIN) -+ goto QFSDeviceRetry; -+ -+ return rc; -+} -+ -+int -+CIFSSMBQFSUnixInfo(int xid, struct cifsTconInfo *tcon, -+ const struct nls_table *nls_codepage) -+{ -+/* level 0x200 SMB_QUERY_CIFS_UNIX_INFO */ -+ TRANSACTION2_QFSI_REQ *pSMB = NULL; -+ TRANSACTION2_QFSI_RSP *pSMBr = NULL; -+ FILE_SYSTEM_UNIX_INFO *response_data; -+ int rc = 0; -+ int bytes_returned = 0; -+ -+ cFYI(1, ("In QFSUnixInfo")); -+QFSUnixRetry: -+ rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ pSMB->ParameterCount = 2; /* level */ -+ pSMB->TotalDataCount = 0; -+ pSMB->DataCount = 0; -+ pSMB->DataOffset = 0; -+ pSMB->MaxParameterCount = cpu_to_le16(2); -+ pSMB->MaxDataCount = cpu_to_le16(100); /* BB find exact max SMB PDU from sess structure BB */ -+ pSMB->MaxSetupCount = 0; -+ pSMB->Reserved = 0; -+ pSMB->Flags = 0; -+ pSMB->Timeout = 0; -+ pSMB->Reserved2 = 0; -+ pSMB->ByteCount = pSMB->ParameterCount + 1 /* pad */ ; -+ pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); -+ pSMB->TotalParameterCount = pSMB->ParameterCount; -+ pSMB->ParameterOffset = cpu_to_le16(offsetof(struct -+ smb_com_transaction2_qfsi_req, InformationLevel) - 4); -+ pSMB->SetupCount = 1; -+ pSMB->Reserved3 = 0; -+ pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION); -+ pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_CIFS_UNIX_INFO); -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cERROR(1, ("Send error in QFSUnixInfo = %d", rc)); -+ } else { /* decode response */ -+ pSMBr->DataOffset = cpu_to_le16(pSMBr->DataOffset); -+ if ((pSMBr->ByteCount < 13) || (pSMBr->DataOffset > 512)) { -+ rc = -EIO; /* bad smb */ -+ } else { -+ response_data = -+ (FILE_SYSTEM_UNIX_INFO -+ *) (((char *) &pSMBr->hdr.Protocol) + -+ pSMBr->DataOffset); -+ response_data->MajorVersionNumber = -+ le16_to_cpu(response_data->MajorVersionNumber); -+ response_data->MinorVersionNumber = -+ le16_to_cpu(response_data->MinorVersionNumber); -+ response_data->Capability = -+ le64_to_cpu(response_data->Capability); -+ memcpy(&tcon->fsUnixInfo, response_data, -+ sizeof (FILE_SYSTEM_UNIX_INFO)); -+ } -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ -+ if (rc == -EAGAIN) -+ goto QFSUnixRetry; -+ -+ -+ return rc; -+} -+ -+/* We can not use write of zero bytes trick to -+ set file size due to need for large file support. Also note that -+ this SetPathInfo is preferred to SetFileInfo based method in next -+ routine which is only needed to work around a sharing violation bug -+ in Samba which this routine can run into */ -+ -+int -+CIFSSMBSetEOF(int xid, struct cifsTconInfo *tcon, char *fileName, -+ __u64 size, int SetAllocation, const struct nls_table *nls_codepage) -+{ -+ struct smb_com_transaction2_spi_req *pSMB = NULL; -+ struct smb_com_transaction2_spi_rsp *pSMBr = NULL; -+ struct file_end_of_file_info *parm_data; -+ int name_len; -+ int rc = 0; -+ int bytes_returned = 0; -+ -+ cFYI(1, ("In SetEOF")); -+SetEOFRetry: -+ rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len = -+ cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, 530 -+ /* find define for this maxpathcomponent */ -+ , nls_codepage); -+ name_len++; /* trailing null */ -+ name_len *= 2; -+ } else { /* BB improve the check for buffer overruns BB */ -+ name_len = strnlen(fileName, 530); -+ name_len++; /* trailing null */ -+ strncpy(pSMB->FileName, fileName, name_len); -+ } -+ pSMB->ParameterCount = 6 + name_len; -+ pSMB->DataCount = sizeof (struct file_end_of_file_info); -+ pSMB->MaxParameterCount = cpu_to_le16(2); -+ pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB size from sess */ -+ pSMB->MaxSetupCount = 0; -+ pSMB->Reserved = 0; -+ pSMB->Flags = 0; -+ pSMB->Timeout = 0; -+ pSMB->Reserved2 = 0; -+ pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req, -+ InformationLevel) - 4; -+ pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; -+ if(SetAllocation) { -+ if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU) -+ pSMB->InformationLevel = -+ cpu_to_le16(SMB_SET_FILE_ALLOCATION_INFO2); -+ else -+ pSMB->InformationLevel = -+ cpu_to_le16(SMB_SET_FILE_ALLOCATION_INFO); -+ } else /* Set File Size */ { -+ if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU) -+ pSMB->InformationLevel = -+ cpu_to_le16(SMB_SET_FILE_END_OF_FILE_INFO2); -+ else -+ pSMB->InformationLevel = -+ cpu_to_le16(SMB_SET_FILE_END_OF_FILE_INFO); -+ } -+ -+ parm_data = -+ (struct file_end_of_file_info *) (((char *) &pSMB->hdr.Protocol) + -+ pSMB->DataOffset); -+ pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); -+ pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); -+ pSMB->SetupCount = 1; -+ pSMB->Reserved3 = 0; -+ pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); -+ pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; -+ pSMB->DataCount = cpu_to_le16(pSMB->DataCount); -+ pSMB->TotalDataCount = pSMB->DataCount; -+ pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); -+ pSMB->TotalParameterCount = pSMB->ParameterCount; -+ pSMB->Reserved4 = 0; -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ parm_data->FileSize = cpu_to_le64(size); -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cFYI(1, ("SetPathInfo (file size) returned %d", rc)); -+ } -+ -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ -+ if (rc == -EAGAIN) -+ goto SetEOFRetry; -+ -+ return rc; -+} -+ -+int -+CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size, -+ __u16 fid, __u32 pid_of_opener, int SetAllocation) -+{ -+ struct smb_com_transaction2_sfi_req *pSMB = NULL; -+ struct smb_com_transaction2_sfi_rsp *pSMBr = NULL; -+ char *data_offset; -+ struct file_end_of_file_info *parm_data; -+ int rc = 0; -+ int bytes_returned = 0; -+ __u32 tmp; -+ -+ cFYI(1, ("SetFileSize (via SetFileInfo) %lld", -+ (long long)size)); -+ rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ tmp = cpu_to_le32(pid_of_opener); /* override pid of current process -+ so network fid will be valid */ -+ pSMB->hdr.Pid = tmp & 0xFFFF; -+ tmp >>= 16; -+ pSMB->hdr.PidHigh = tmp & 0xFFFF; -+ -+ pSMB->ParameterCount = 6; -+ pSMB->MaxSetupCount = 0; -+ pSMB->Reserved = 0; -+ pSMB->Flags = 0; -+ pSMB->Timeout = 0; -+ pSMB->Reserved2 = 0; -+ pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_sfi_req, -+ Fid) - 4; -+ pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; -+ -+ data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset; -+ -+ pSMB->DataCount = sizeof(struct file_end_of_file_info); -+ pSMB->MaxParameterCount = cpu_to_le16(2); -+ pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */ -+ pSMB->SetupCount = 1; -+ pSMB->Reserved3 = 0; -+ pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); -+ pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; -+ pSMB->DataCount = cpu_to_le16(pSMB->DataCount); -+ pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); -+ pSMB->TotalDataCount = pSMB->DataCount; -+ pSMB->TotalParameterCount = pSMB->ParameterCount; -+ pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); -+ parm_data = -+ (struct file_end_of_file_info *) (((char *) &pSMB->hdr.Protocol) + -+ pSMB->DataOffset); -+ pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); /* now safe to change to le */ -+ parm_data->FileSize = cpu_to_le64(size); -+ pSMB->Fid = fid; -+ if(SetAllocation) { -+ if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU) -+ pSMB->InformationLevel = -+ cpu_to_le16(SMB_SET_FILE_ALLOCATION_INFO2); -+ else -+ pSMB->InformationLevel = -+ cpu_to_le16(SMB_SET_FILE_ALLOCATION_INFO); -+ } else /* Set File Size */ { -+ if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU) -+ pSMB->InformationLevel = -+ cpu_to_le16(SMB_SET_FILE_END_OF_FILE_INFO2); -+ else -+ pSMB->InformationLevel = -+ cpu_to_le16(SMB_SET_FILE_END_OF_FILE_INFO); -+ } -+ pSMB->Reserved4 = 0; -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cFYI(1, -+ ("Send error in SetFileInfo (SetFileSize) = %d", -+ rc)); -+ } -+ -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ -+ /* Note: On -EAGAIN error only caller can retry on handle based calls -+ since file handle passed in no longer valid */ -+ -+ return rc; -+} -+ -+int -+CIFSSMBSetTimes(int xid, struct cifsTconInfo *tcon, char *fileName, -+ FILE_BASIC_INFO * data, const struct nls_table *nls_codepage) -+{ -+ TRANSACTION2_SPI_REQ *pSMB = NULL; -+ TRANSACTION2_SPI_RSP *pSMBr = NULL; -+ int name_len; -+ int rc = 0; -+ int bytes_returned = 0; -+ char *data_offset; -+ -+ cFYI(1, ("In SetTimes")); -+ -+SetTimesRetry: -+ rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len = -+ cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, 530 -+ /* find define for this maxpathcomponent */ -+ , nls_codepage); -+ name_len++; /* trailing null */ -+ name_len *= 2; -+ } else { /* BB improve the check for buffer overruns BB */ -+ name_len = strnlen(fileName, 530); -+ name_len++; /* trailing null */ -+ strncpy(pSMB->FileName, fileName, name_len); -+ } -+ -+ pSMB->ParameterCount = 6 + name_len; -+ pSMB->DataCount = sizeof (FILE_BASIC_INFO); -+ pSMB->MaxParameterCount = cpu_to_le16(2); -+ pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ -+ pSMB->MaxSetupCount = 0; -+ pSMB->Reserved = 0; -+ pSMB->Flags = 0; -+ pSMB->Timeout = 0; -+ pSMB->Reserved2 = 0; -+ pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req, -+ InformationLevel) - 4; -+ pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; -+ data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset; -+ pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); -+ pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); -+ pSMB->SetupCount = 1; -+ pSMB->Reserved3 = 0; -+ pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); -+ pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; -+ -+ pSMB->DataCount = cpu_to_le16(pSMB->DataCount); -+ pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); -+ pSMB->TotalDataCount = pSMB->DataCount; -+ pSMB->TotalParameterCount = pSMB->ParameterCount; -+ if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU) -+ pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_BASIC_INFO2); -+ else -+ pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_BASIC_INFO); -+ pSMB->Reserved4 = 0; -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ memcpy(data_offset, data, sizeof (FILE_BASIC_INFO)); -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cFYI(1, ("SetPathInfo (times) returned %d", rc)); -+ } -+ -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ -+ if (rc == -EAGAIN) -+ goto SetTimesRetry; -+ -+ return rc; -+} -+ -+int -+CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *tcon, -+ char *fileName, __u64 mode, __u64 uid, __u64 gid, -+ dev_t device, const struct nls_table *nls_codepage) -+{ -+ TRANSACTION2_SPI_REQ *pSMB = NULL; -+ TRANSACTION2_SPI_RSP *pSMBr = NULL; -+ int name_len; -+ int rc = 0; -+ int bytes_returned = 0; -+ FILE_UNIX_BASIC_INFO *data_offset; -+ -+ cFYI(1, ("In SetUID/GID/Mode")); -+setPermsRetry: -+ rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len = -+ cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, 530 -+ /* find define for this maxpathcomponent */ -+ , nls_codepage); -+ name_len++; /* trailing null */ -+ name_len *= 2; -+ } else { /* BB improve the check for buffer overruns BB */ -+ name_len = strnlen(fileName, 530); -+ name_len++; /* trailing null */ -+ strncpy(pSMB->FileName, fileName, name_len); -+ } -+ -+ pSMB->ParameterCount = 6 + name_len; -+ pSMB->DataCount = sizeof (FILE_UNIX_BASIC_INFO); -+ pSMB->MaxParameterCount = cpu_to_le16(2); -+ pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ -+ pSMB->MaxSetupCount = 0; -+ pSMB->Reserved = 0; -+ pSMB->Flags = 0; -+ pSMB->Timeout = 0; -+ pSMB->Reserved2 = 0; -+ pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req, -+ InformationLevel) - 4; -+ pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; -+ data_offset = -+ (FILE_UNIX_BASIC_INFO *) ((char *) &pSMB->hdr.Protocol + -+ pSMB->DataOffset); -+ pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); -+ pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); -+ pSMB->SetupCount = 1; -+ pSMB->Reserved3 = 0; -+ pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); -+ pSMB->ByteCount = 3 /* pad */ + pSMB->ParameterCount + pSMB->DataCount; -+ pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); -+ pSMB->DataCount = cpu_to_le16(pSMB->DataCount); -+ pSMB->TotalParameterCount = pSMB->ParameterCount; -+ pSMB->TotalDataCount = pSMB->DataCount; -+ pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_BASIC); -+ pSMB->Reserved4 = 0; -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ data_offset->Uid = cpu_to_le64(uid); -+ data_offset->Gid = cpu_to_le64(gid); -+ /* better to leave device as zero when it is */ -+ data_offset->DevMajor = cpu_to_le64(MAJOR(device)); -+ data_offset->DevMinor = cpu_to_le64(MINOR(device)); -+ data_offset->Permissions = cpu_to_le64(mode); -+ -+ if(S_ISREG(mode)) -+ data_offset->Type = cpu_to_le32(UNIX_FILE); -+ else if(S_ISDIR(mode)) -+ data_offset->Type = cpu_to_le32(UNIX_DIR); -+ else if(S_ISLNK(mode)) -+ data_offset->Type = cpu_to_le32(UNIX_SYMLINK); -+ else if(S_ISCHR(mode)) -+ data_offset->Type = cpu_to_le32(UNIX_CHARDEV); -+ else if(S_ISBLK(mode)) -+ data_offset->Type = cpu_to_le32(UNIX_BLOCKDEV); -+ else if(S_ISFIFO(mode)) -+ data_offset->Type = cpu_to_le32(UNIX_FIFO); -+ else if(S_ISSOCK(mode)) -+ data_offset->Type = cpu_to_le32(UNIX_SOCKET); -+ -+ -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cFYI(1, ("SetPathInfo (perms) returned %d", rc)); -+ } -+ -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ if (rc == -EAGAIN) -+ goto setPermsRetry; -+ return rc; -+} -+ -+int CIFSSMBNotify(const int xid, struct cifsTconInfo *tcon, -+ const int notify_subdirs, const __u16 netfid, -+ __u32 filter, const struct nls_table *nls_codepage) -+{ -+ int rc = 0; -+ struct smb_com_transaction_change_notify_req * pSMB = NULL; -+ struct smb_com_transaction_change_notify_rsp * pSMBr = NULL; -+ int bytes_returned; -+ -+ cFYI(1, ("In CIFSSMBNotify for file handle %d",(int)netfid)); -+ rc = smb_init(SMB_COM_NT_TRANSACT, 23, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ pSMB->TotalParameterCount = 0 ; -+ pSMB->TotalDataCount = 0; -+ pSMB->MaxParameterCount = cpu_to_le32(2); -+ /* BB find exact data count max from sess structure BB */ -+ pSMB->MaxDataCount = 0; /* same in little endian or be */ -+ pSMB->MaxSetupCount = 4; -+ pSMB->Reserved = 0; -+ pSMB->ParameterOffset = 0; -+ pSMB->DataCount = 0; -+ pSMB->DataOffset = 0; -+ pSMB->SetupCount = 4; /* single byte does not need le conversion */ -+ pSMB->SubCommand = cpu_to_le16(NT_TRANSACT_NOTIFY_CHANGE); -+ pSMB->ParameterCount = pSMB->TotalParameterCount; -+ if(notify_subdirs) -+ pSMB->WatchTree = 1; /* one byte - no le conversion needed */ -+ pSMB->Reserved2 = 0; -+ pSMB->CompletionFilter = cpu_to_le32(filter); -+ pSMB->Fid = netfid; /* file handle always le */ -+ pSMB->ByteCount = 0; -+ -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cFYI(1, ("Error in Notify = %d", rc)); -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+/* if (rc == -EAGAIN) -+ goto NotifyRetry; */ -+ return rc; -+} -+#ifdef CONFIG_CIFS_XATTR -+int -+CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon, -+ const unsigned char *searchName, -+ char * EAData, size_t size, -+ const struct nls_table *nls_codepage) -+{ -+ /* BB assumes one setup word */ -+ TRANSACTION2_QPI_REQ *pSMB = NULL; -+ TRANSACTION2_QPI_RSP *pSMBr = NULL; -+ int rc = 0; -+ int bytes_returned; -+ int name_len; -+ -+ cFYI(1, ("In Query All EAs path %s", searchName)); -+QAllEAsRetry: -+ rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, -+ (void **) &pSMBr); -+ if (rc) -+ return rc; -+ -+ if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { -+ name_len = -+ cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530 -+ /* find define for this maxpathcomponent */ -+ , nls_codepage); -+ name_len++; /* trailing null */ -+ name_len *= 2; -+ } else { /* BB improve the check for buffer overruns BB */ -+ name_len = strnlen(searchName, 530); -+ name_len++; /* trailing null */ -+ strncpy(pSMB->FileName, searchName, name_len); -+ } -+ -+ pSMB->TotalParameterCount = 2 /* level */ + 4 /* reserved */ + -+ name_len /* includes null */ ; -+ pSMB->TotalDataCount = 0; -+ pSMB->MaxParameterCount = cpu_to_le16(2); -+ pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ -+ pSMB->MaxSetupCount = 0; -+ pSMB->Reserved = 0; -+ pSMB->Flags = 0; -+ pSMB->Timeout = 0; -+ pSMB->Reserved2 = 0; -+ pSMB->ParameterOffset = cpu_to_le16(offsetof( -+ struct smb_com_transaction2_qpi_req ,InformationLevel) - 4); -+ pSMB->DataCount = 0; -+ pSMB->DataOffset = 0; -+ pSMB->SetupCount = 1; -+ pSMB->Reserved3 = 0; -+ pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION); -+ pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; -+ pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); -+ pSMB->ParameterCount = pSMB->TotalParameterCount; -+ pSMB->InformationLevel = cpu_to_le16(SMB_INFO_QUERY_ALL_EAS); -+ pSMB->Reserved4 = 0; -+ pSMB->hdr.smb_buf_length += pSMB->ByteCount; -+ pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); -+ -+ rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, -+ (struct smb_hdr *) pSMBr, &bytes_returned, 0); -+ if (rc) { -+ cFYI(1, ("Send error in QueryAllEAs = %d", rc)); -+ } else { /* decode response */ -+ pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); -+ /* BB also check enough total bytes returned */ -+ /* BB we need to improve the validity checking -+ of these trans2 responses */ -+ if ((pSMBr->ByteCount < 4) || (pSMBr->DataOffset > 512)) -+ rc = -EIO; /* bad smb */ -+ /* else if (pFindData){ -+ memcpy((char *) pFindData, -+ (char *) &pSMBr->hdr.Protocol + -+ pSMBr->DataOffset, kl); -+ }*/ else { -+ /* check that length of list is not more than bcc */ -+ /* check that each entry does not go beyond length -+ of list */ -+ /* check that each element of each entry does not -+ go beyond end of list */ -+ struct fealist * ea_response_data; -+ rc = 0; -+ /* validate_trans2_offsets() */ -+ /* BB to check if(start of smb + pSMBr->DataOffset > &bcc+ bcc)*/ -+ ea_response_data = (struct fealist *) -+ (((char *) &pSMBr->hdr.Protocol) + -+ pSMBr->DataOffset); -+ cFYI(1,("ea length %d",ea_response_data->list_len)); -+ } -+ } -+ if (pSMB) -+ cifs_buf_release(pSMB); -+ if (rc == -EAGAIN) -+ goto QAllEAsRetry; -+ -+ return rc; -+} -+#endif -diff -urN linux-2.4.29.old/fs/cifs/cifs_unicode.c linux-2.4.29/fs/cifs/cifs_unicode.c ---- linux-2.4.29.old/fs/cifs/cifs_unicode.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/cifs_unicode.c 2004-07-14 00:25:04.000000000 +0200 -@@ -0,0 +1,87 @@ -+/* -+ * fs/cifs/cifs_unicode.c -+ * -+ * Copyright (c) International Business Machines Corp., 2000,2002 -+ * Modified by Steve French (sfrench@us.ibm.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 -+#include "cifs_unicode.h" -+#include "cifs_uniupr.h" -+#include "cifspdu.h" -+#include "cifs_debug.h" -+ -+/* -+ * NAME: cifs_strfromUCS() -+ * -+ * FUNCTION: Convert little-endian unicode string to character string -+ * -+ */ -+int -+cifs_strfromUCS_le(char *to, const wchar_t * from, /* LITTLE ENDIAN */ -+ int len, const struct nls_table *codepage) -+{ -+ int i; -+ int outlen = 0; -+ -+ for (i = 0; (i < len) && from[i]; i++) { -+ int charlen; -+ /* 2.4.0 kernel or greater */ -+ charlen = -+ codepage->uni2char(le16_to_cpu(from[i]), &to[outlen], -+ NLS_MAX_CHARSET_SIZE); -+ if (charlen > 0) { -+ outlen += charlen; -+ } else { -+ to[outlen++] = '?'; -+ } -+ } -+ to[outlen] = 0; -+ return outlen; -+} -+ -+/* -+ * NAME: cifs_strtoUCS() -+ * -+ * FUNCTION: Convert character string to unicode string -+ * -+ */ -+int -+cifs_strtoUCS(wchar_t * to, const char *from, int len, -+ const struct nls_table *codepage) -+{ -+ int charlen; -+ int i; -+ -+ for (i = 0; len && *from; i++, from += charlen, len -= charlen) { -+ -+ /* works for 2.4.0 kernel or later */ -+ charlen = codepage->char2uni(from, len, &to[i]); -+ if (charlen < 1) { -+ cERROR(1, -+ ("cifs_strtoUCS: char2uni returned %d", -+ charlen)); -+ to[i] = cpu_to_le16(0x003f); /* a question mark */ -+ charlen = 1; -+ } -+ to[i] = cpu_to_le16(to[i]); -+ -+ } -+ -+ to[i] = 0; -+ return i; -+} -+ -diff -urN linux-2.4.29.old/fs/cifs/cifs_unicode.h linux-2.4.29/fs/cifs/cifs_unicode.h ---- linux-2.4.29.old/fs/cifs/cifs_unicode.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/cifs_unicode.h 2004-07-14 00:25:04.000000000 +0200 -@@ -0,0 +1,353 @@ -+/* -+ * cifs_unicode: Unicode kernel case support -+ * -+ * Function: -+ * Convert a unicode character to upper or lower case using -+ * compressed tables. -+ * -+ * Copyright (c) International Business Machines Corp., 2000,2002 -+ * -+ * 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 -+ * -+ * -+ * Notes: -+ * These APIs are based on the C library functions. The semantics -+ * should match the C functions but with expanded size operands. -+ * -+ * The upper/lower functions are based on a table created by mkupr. -+ * This is a compressed table of upper and lower case conversion. -+ * -+ */ -+ -+#include -+#include -+#include -+ -+#define UNIUPR_NOLOWER /* Example to not expand lower case tables */ -+ -+/* Just define what we want from uniupr.h. We don't want to define the tables -+ * in each source file. -+ */ -+#ifndef UNICASERANGE_DEFINED -+struct UniCaseRange { -+ wchar_t start; -+ wchar_t end; -+ signed char *table; -+}; -+#endif /* UNICASERANGE_DEFINED */ -+ -+#ifndef UNIUPR_NOUPPER -+extern signed char CifsUniUpperTable[512]; -+extern const struct UniCaseRange CifsUniUpperRange[]; -+#endif /* UNIUPR_NOUPPER */ -+ -+#ifndef UNIUPR_NOLOWER -+extern signed char UniLowerTable[512]; -+extern struct UniCaseRange UniLowerRange[]; -+#endif /* UNIUPR_NOLOWER */ -+ -+#ifdef __KERNEL__ -+int cifs_strfromUCS_le(char *, const wchar_t *, int, const struct nls_table *); -+int cifs_strtoUCS(wchar_t *, const char *, int, const struct nls_table *); -+#endif -+ -+/* -+ * UniStrcat: Concatenate the second string to the first -+ * -+ * Returns: -+ * Address of the first string -+ */ -+static inline wchar_t * -+UniStrcat(wchar_t * ucs1, const wchar_t * ucs2) -+{ -+ wchar_t *anchor = ucs1; /* save a pointer to start of ucs1 */ -+ -+ while (*ucs1++) ; /* To end of first string */ -+ ucs1--; /* Return to the null */ -+ while ((*ucs1++ = *ucs2++)) ; /* copy string 2 over */ -+ return anchor; -+} -+ -+/* -+ * UniStrchr: Find a character in a string -+ * -+ * Returns: -+ * Address of first occurrence of character in string -+ * or NULL if the character is not in the string -+ */ -+static inline wchar_t * -+UniStrchr(const wchar_t * ucs, wchar_t uc) -+{ -+ while ((*ucs != uc) && *ucs) -+ ucs++; -+ -+ if (*ucs == uc) -+ return (wchar_t *) ucs; -+ return NULL; -+} -+ -+/* -+ * UniStrcmp: Compare two strings -+ * -+ * Returns: -+ * < 0: First string is less than second -+ * = 0: Strings are equal -+ * > 0: First string is greater than second -+ */ -+static inline int -+UniStrcmp(const wchar_t * ucs1, const wchar_t * ucs2) -+{ -+ while ((*ucs1 == *ucs2) && *ucs1) { -+ ucs1++; -+ ucs2++; -+ } -+ return (int) *ucs1 - (int) *ucs2; -+} -+ -+/* -+ * UniStrcpy: Copy a string -+ */ -+static inline wchar_t * -+UniStrcpy(wchar_t * ucs1, const wchar_t * ucs2) -+{ -+ wchar_t *anchor = ucs1; /* save the start of result string */ -+ -+ while ((*ucs1++ = *ucs2++)) ; -+ return anchor; -+} -+ -+/* -+ * UniStrlen: Return the length of a string (in 16 bit Unicode chars not bytes) -+ */ -+static inline size_t -+UniStrlen(const wchar_t * ucs1) -+{ -+ int i = 0; -+ -+ while (*ucs1++) -+ i++; -+ return i; -+} -+ -+/* -+ * UniStrnlen: Return the length (in 16 bit Unicode chars not bytes) of a string (length limited) -+ */ -+static inline size_t -+UniStrnlen(const wchar_t * ucs1, int maxlen) -+{ -+ int i = 0; -+ -+ while (*ucs1++) { -+ i++; -+ if (i >= maxlen) -+ break; -+ } -+ return i; -+} -+ -+/* -+ * UniStrncat: Concatenate length limited string -+ */ -+static inline wchar_t * -+UniStrncat(wchar_t * ucs1, const wchar_t * ucs2, size_t n) -+{ -+ wchar_t *anchor = ucs1; /* save pointer to string 1 */ -+ -+ while (*ucs1++) ; -+ ucs1--; /* point to null terminator of s1 */ -+ while (n-- && (*ucs1 = *ucs2)) { /* copy s2 after s1 */ -+ ucs1++; -+ ucs2++; -+ } -+ *ucs1 = 0; /* Null terminate the result */ -+ return (anchor); -+} -+ -+/* -+ * UniStrncmp: Compare length limited string -+ */ -+static inline int -+UniStrncmp(const wchar_t * ucs1, const wchar_t * ucs2, size_t n) -+{ -+ if (!n) -+ return 0; /* Null strings are equal */ -+ while ((*ucs1 == *ucs2) && *ucs1 && --n) { -+ ucs1++; -+ ucs2++; -+ } -+ return (int) *ucs1 - (int) *ucs2; -+} -+ -+/* -+ * UniStrncmp_le: Compare length limited string - native to little-endian -+ */ -+static inline int -+UniStrncmp_le(const wchar_t * ucs1, const wchar_t * ucs2, size_t n) -+{ -+ if (!n) -+ return 0; /* Null strings are equal */ -+ while ((*ucs1 == __le16_to_cpu(*ucs2)) && *ucs1 && --n) { -+ ucs1++; -+ ucs2++; -+ } -+ return (int) *ucs1 - (int) __le16_to_cpu(*ucs2); -+} -+ -+/* -+ * UniStrncpy: Copy length limited string with pad -+ */ -+static inline wchar_t * -+UniStrncpy(wchar_t * ucs1, const wchar_t * ucs2, size_t n) -+{ -+ wchar_t *anchor = ucs1; -+ -+ while (n-- && *ucs2) /* Copy the strings */ -+ *ucs1++ = *ucs2++; -+ -+ n++; -+ while (n--) /* Pad with nulls */ -+ *ucs1++ = 0; -+ return anchor; -+} -+ -+/* -+ * UniStrncpy_le: Copy length limited string with pad to little-endian -+ */ -+static inline wchar_t * -+UniStrncpy_le(wchar_t * ucs1, const wchar_t * ucs2, size_t n) -+{ -+ wchar_t *anchor = ucs1; -+ -+ while (n-- && *ucs2) /* Copy the strings */ -+ *ucs1++ = __le16_to_cpu(*ucs2++); -+ -+ n++; -+ while (n--) /* Pad with nulls */ -+ *ucs1++ = 0; -+ return anchor; -+} -+ -+/* -+ * UniStrstr: Find a string in a string -+ * -+ * Returns: -+ * Address of first match found -+ * NULL if no matching string is found -+ */ -+static inline wchar_t * -+UniStrstr(const wchar_t * ucs1, const wchar_t * ucs2) -+{ -+ const wchar_t *anchor1 = ucs1; -+ const wchar_t *anchor2 = ucs2; -+ -+ while (*ucs1) { -+ if (*ucs1 == *ucs2) { /* Partial match found */ -+ ucs1++; -+ ucs2++; -+ } else { -+ if (!*ucs2) /* Match found */ -+ return (wchar_t *) anchor1; -+ ucs1 = ++anchor1; /* No match */ -+ ucs2 = anchor2; -+ } -+ } -+ -+ if (!*ucs2) /* Both end together */ -+ return (wchar_t *) anchor1; /* Match found */ -+ return NULL; /* No match */ -+} -+ -+#ifndef UNIUPR_NOUPPER -+/* -+ * UniToupper: Convert a unicode character to upper case -+ */ -+static inline wchar_t -+UniToupper(register wchar_t uc) -+{ -+ register const struct UniCaseRange *rp; -+ -+ if (uc < sizeof (CifsUniUpperTable)) { /* Latin characters */ -+ return uc + CifsUniUpperTable[uc]; /* Use base tables */ -+ } else { -+ rp = CifsUniUpperRange; /* Use range tables */ -+ while (rp->start) { -+ if (uc < rp->start) /* Before start of range */ -+ return uc; /* Uppercase = input */ -+ if (uc <= rp->end) /* In range */ -+ return uc + rp->table[uc - rp->start]; -+ rp++; /* Try next range */ -+ } -+ } -+ return uc; /* Past last range */ -+} -+ -+/* -+ * UniStrupr: Upper case a unicode string -+ */ -+static inline wchar_t * -+UniStrupr(register wchar_t * upin) -+{ -+ register wchar_t *up; -+ -+ up = upin; -+ while (*up) { /* For all characters */ -+ *up = UniToupper(*up); -+ up++; -+ } -+ return upin; /* Return input pointer */ -+} -+#endif /* UNIUPR_NOUPPER */ -+ -+#ifndef UNIUPR_NOLOWER -+/* -+ * UniTolower: Convert a unicode character to lower case -+ */ -+static inline wchar_t -+UniTolower(wchar_t uc) -+{ -+ register struct UniCaseRange *rp; -+ -+ if (uc < sizeof (UniLowerTable)) { /* Latin characters */ -+ return uc + UniLowerTable[uc]; /* Use base tables */ -+ } else { -+ rp = UniLowerRange; /* Use range tables */ -+ while (rp->start) { -+ if (uc < rp->start) /* Before start of range */ -+ return uc; /* Uppercase = input */ -+ if (uc <= rp->end) /* In range */ -+ return uc + rp->table[uc - rp->start]; -+ rp++; /* Try next range */ -+ } -+ } -+ return uc; /* Past last range */ -+} -+ -+/* -+ * UniStrlwr: Lower case a unicode string -+ */ -+static inline wchar_t * -+UniStrlwr(register wchar_t * upin) -+{ -+ register wchar_t *up; -+ -+ up = upin; -+ while (*up) { /* For all characters */ -+ *up = UniTolower(*up); -+ up++; -+ } -+ return upin; /* Return input pointer */ -+} -+ -+#endif -diff -urN linux-2.4.29.old/fs/cifs/cifs_uniupr.h linux-2.4.29/fs/cifs/cifs_uniupr.h ---- linux-2.4.29.old/fs/cifs/cifs_uniupr.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/cifs_uniupr.h 2004-07-14 00:25:04.000000000 +0200 -@@ -0,0 +1,253 @@ -+/* -+ * Copyright (c) International Business Machines Corp., 2000,2002 -+ * -+ * 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 -+ * -+ * uniupr.h - Unicode compressed case ranges -+ * -+*/ -+ -+#ifndef UNIUPR_NOUPPER -+/* -+ * Latin upper case -+ */ -+signed char CifsUniUpperTable[512] = { -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 000-00f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 010-01f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 020-02f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 030-03f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 040-04f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 050-05f */ -+ 0, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, /* 060-06f */ -+ -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, 0, 0, 0, 0, 0, /* 070-07f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 080-08f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 090-09f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0a0-0af */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0b0-0bf */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0c0-0cf */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0d0-0df */ -+ -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, /* 0e0-0ef */ -+ -32, -32, -32, -32, -32, -32, -32, 0, -32, -32, -32, -32, -32, -32, -32, 121, /* 0f0-0ff */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 100-10f */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 110-11f */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 120-12f */ -+ 0, 0, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, /* 130-13f */ -+ -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, /* 140-14f */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 150-15f */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 160-16f */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, /* 170-17f */ -+ 0, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, /* 180-18f */ -+ 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, /* 190-19f */ -+ 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, /* 1a0-1af */ -+ -1, 0, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, /* 1b0-1bf */ -+ 0, 0, 0, 0, 0, -1, -2, 0, -1, -2, 0, -1, -2, 0, -1, 0, /* 1c0-1cf */ -+ -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, -79, 0, -1, /* 1d0-1df */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 1e0-1ef */ -+ 0, 0, -1, -2, 0, -1, 0, 0, 0, -1, 0, -1, 0, -1, 0, -1, /* 1f0-1ff */ -+}; -+ -+/* Upper case range - Greek */ -+static signed char UniCaseRangeU03a0[47] = { -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -38, -37, -37, -37, /* 3a0-3af */ -+ 0, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, /* 3b0-3bf */ -+ -32, -32, -31, -32, -32, -32, -32, -32, -32, -32, -32, -32, -64, -+ -63, -63, -+}; -+ -+/* Upper case range - Cyrillic */ -+static signed char UniCaseRangeU0430[48] = { -+ -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, /* 430-43f */ -+ -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, /* 440-44f */ -+ 0, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, 0, -80, -80, /* 450-45f */ -+}; -+ -+/* Upper case range - Extended cyrillic */ -+static signed char UniCaseRangeU0490[61] = { -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 490-49f */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 4a0-4af */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 4b0-4bf */ -+ 0, 0, -1, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -+}; -+ -+/* Upper case range - Extended latin and greek */ -+static signed char UniCaseRangeU1e00[509] = { -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 1e00-1e0f */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 1e10-1e1f */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 1e20-1e2f */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 1e30-1e3f */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 1e40-1e4f */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 1e50-1e5f */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 1e60-1e6f */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 1e70-1e7f */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 1e80-1e8f */ -+ 0, -1, 0, -1, 0, -1, 0, 0, 0, 0, 0, -59, 0, -1, 0, -1, /* 1e90-1e9f */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 1ea0-1eaf */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 1eb0-1ebf */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 1ec0-1ecf */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 1ed0-1edf */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, /* 1ee0-1eef */ -+ 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, /* 1ef0-1eff */ -+ 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, /* 1f00-1f0f */ -+ 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1f10-1f1f */ -+ 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, /* 1f20-1f2f */ -+ 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, /* 1f30-1f3f */ -+ 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1f40-1f4f */ -+ 0, 8, 0, 8, 0, 8, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, /* 1f50-1f5f */ -+ 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, /* 1f60-1f6f */ -+ 74, 74, 86, 86, 86, 86, 100, 100, 0, 0, 112, 112, 126, 126, 0, 0, /* 1f70-1f7f */ -+ 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, /* 1f80-1f8f */ -+ 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, /* 1f90-1f9f */ -+ 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, /* 1fa0-1faf */ -+ 8, 8, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1fb0-1fbf */ -+ 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1fc0-1fcf */ -+ 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1fd0-1fdf */ -+ 8, 8, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1fe0-1fef */ -+ 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, -+}; -+ -+/* Upper case range - Wide latin */ -+static signed char UniCaseRangeUff40[27] = { -+ 0, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, /* ff40-ff4f */ -+ -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -+}; -+ -+/* -+ * Upper Case Range -+ */ -+const struct UniCaseRange CifsUniUpperRange[] = { -+ {0x03a0, 0x03ce, UniCaseRangeU03a0}, -+ {0x0430, 0x045f, UniCaseRangeU0430}, -+ {0x0490, 0x04cc, UniCaseRangeU0490}, -+ {0x1e00, 0x1ffc, UniCaseRangeU1e00}, -+ {0xff40, 0xff5a, UniCaseRangeUff40}, -+ {0, 0, NULL} -+}; -+#endif -+ -+#ifndef UNIUPR_NOLOWER -+/* -+ * Latin lower case -+ */ -+static signed char CifsUniLowerTable[512] = { -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 000-00f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 010-01f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 020-02f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 030-03f */ -+ 0, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 040-04f */ -+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 0, 0, 0, 0, 0, /* 050-05f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 060-06f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 070-07f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 080-08f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 090-09f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0a0-0af */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0b0-0bf */ -+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 0c0-0cf */ -+ 32, 32, 32, 32, 32, 32, 32, 0, 32, 32, 32, 32, 32, 32, 32, 0, /* 0d0-0df */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0e0-0ef */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0f0-0ff */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 100-10f */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 110-11f */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 120-12f */ -+ 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, /* 130-13f */ -+ 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, /* 140-14f */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 150-15f */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 160-16f */ -+ 1, 0, 1, 0, 1, 0, 1, 0, -121, 1, 0, 1, 0, 1, 0, 0, /* 170-17f */ -+ 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 79, 0, /* 180-18f */ -+ 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, /* 190-19f */ -+ 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, /* 1a0-1af */ -+ 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, /* 1b0-1bf */ -+ 0, 0, 0, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 1, 0, 1, /* 1c0-1cf */ -+ 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, /* 1d0-1df */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 1e0-1ef */ -+ 0, 2, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 1f0-1ff */ -+}; -+ -+/* Lower case range - Greek */ -+static signed char UniCaseRangeL0380[44] = { -+ 0, 0, 0, 0, 0, 0, 38, 0, 37, 37, 37, 0, 64, 0, 63, 63, /* 380-38f */ -+ 0, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 390-39f */ -+ 32, 32, 0, 32, 32, 32, 32, 32, 32, 32, 32, 32, -+}; -+ -+/* Lower case range - Cyrillic */ -+static signed char UniCaseRangeL0400[48] = { -+ 0, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 0, 80, 80, /* 400-40f */ -+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 410-41f */ -+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 420-42f */ -+}; -+ -+/* Lower case range - Extended cyrillic */ -+static signed char UniCaseRangeL0490[60] = { -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 490-49f */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 4a0-4af */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 4b0-4bf */ -+ 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, -+}; -+ -+/* Lower case range - Extended latin and greek */ -+static signed char UniCaseRangeL1e00[504] = { -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 1e00-1e0f */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 1e10-1e1f */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 1e20-1e2f */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 1e30-1e3f */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 1e40-1e4f */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 1e50-1e5f */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 1e60-1e6f */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 1e70-1e7f */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 1e80-1e8f */ -+ 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, /* 1e90-1e9f */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 1ea0-1eaf */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 1eb0-1ebf */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 1ec0-1ecf */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 1ed0-1edf */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, /* 1ee0-1eef */ -+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, /* 1ef0-1eff */ -+ 0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, -8, -8, /* 1f00-1f0f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, 0, 0, /* 1f10-1f1f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, -8, -8, /* 1f20-1f2f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, -8, -8, /* 1f30-1f3f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, 0, 0, /* 1f40-1f4f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, -8, 0, -8, 0, -8, 0, -8, /* 1f50-1f5f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, -8, -8, /* 1f60-1f6f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1f70-1f7f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, -8, -8, /* 1f80-1f8f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, -8, -8, /* 1f90-1f9f */ -+ 0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, -8, -8, /* 1fa0-1faf */ -+ 0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -74, -74, -9, 0, 0, 0, /* 1fb0-1fbf */ -+ 0, 0, 0, 0, 0, 0, 0, 0, -86, -86, -86, -86, -9, 0, 0, 0, /* 1fc0-1fcf */ -+ 0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -100, -100, 0, 0, 0, 0, /* 1fd0-1fdf */ -+ 0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -112, -112, -7, 0, 0, 0, /* 1fe0-1fef */ -+ 0, 0, 0, 0, 0, 0, 0, 0, -+}; -+ -+/* Lower case range - Wide latin */ -+static signed char UniCaseRangeLff20[27] = { -+ 0, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* ff20-ff2f */ -+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, -+}; -+ -+/* -+ * Lower Case Range -+ */ -+const static struct UniCaseRange CifsUniLowerRange[] = { -+ 0x0380, 0x03ab, UniCaseRangeL0380, -+ 0x0400, 0x042f, UniCaseRangeL0400, -+ 0x0490, 0x04cb, UniCaseRangeL0490, -+ 0x1e00, 0x1ff7, UniCaseRangeL1e00, -+ 0xff20, 0xff3a, UniCaseRangeLff20, -+ 0, 0, 0 -+}; -+#endif -diff -urN linux-2.4.29.old/fs/cifs/connect.c linux-2.4.29/fs/cifs/connect.c ---- linux-2.4.29.old/fs/cifs/connect.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/connect.c 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,2924 @@ -+/* -+ * fs/cifs/connect.c -+ * -+ * Copyright (C) International Business Machines Corp., 2002,2004 -+ * Author(s): Steve French (sfrench@us.ibm.com) -+ * -+ * This library is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This library 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 Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * along with this library; 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 "cifspdu.h" -+#include "cifsglob.h" -+#include "cifsproto.h" -+#include "cifs_unicode.h" -+#include "cifs_debug.h" -+#include "cifs_fs_sb.h" -+#include "ntlmssp.h" -+#include "nterr.h" -+#include "rfc1002pdu.h" -+ -+#define CIFS_PORT 445 -+#define RFC1001_PORT 139 -+ -+extern void SMBencrypt(unsigned char *passwd, unsigned char *c8, -+ unsigned char *p24); -+extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, -+ unsigned char *p24); -+extern int cifs_inet_pton(int, const char *, void *dst); -+ -+struct smb_vol { -+ char *username; -+ char *password; -+ char *domainname; -+ char *UNC; -+ char *UNCip; -+ char *iocharset; /* local code page for mapping to and from Unicode */ -+ char source_rfc1001_name[16]; /* netbios name of client */ -+ uid_t linux_uid; -+ gid_t linux_gid; -+ mode_t file_mode; -+ mode_t dir_mode; -+ int rw:1; -+ int retry:1; -+ int intr:1; -+ unsigned int rsize; -+ unsigned int wsize; -+ unsigned int sockopt; -+ unsigned short int port; -+}; -+ -+static int ipv4_connect(struct sockaddr_in *psin_server, -+ struct socket **csocket, -+ char * netb_name); -+static int ipv6_connect(struct sockaddr_in6 *psin_server, -+ struct socket **csocket); -+ -+ -+ /* -+ * cifs tcp session reconnection -+ * -+ * mark tcp session as reconnecting so temporarily locked -+ * mark all smb sessions as reconnecting for tcp session -+ * reconnect tcp session -+ * wake up waiters on reconnection? - (not needed currently) -+ */ -+ -+int -+cifs_reconnect(struct TCP_Server_Info *server) -+{ -+ int rc = 0; -+ struct list_head *tmp; -+ struct cifsSesInfo *ses; -+ struct cifsTconInfo *tcon; -+ struct mid_q_entry * mid_entry; -+ -+ spin_lock(&GlobalMid_Lock); -+ if(server->tcpStatus == CifsExiting) { -+ /* the demux thread will exit normally -+ next time through the loop */ -+ spin_unlock(&GlobalMid_Lock); -+ return rc; -+ } else -+ server->tcpStatus = CifsNeedReconnect; -+ spin_unlock(&GlobalMid_Lock); -+ server->maxBuf = 0; -+ -+ cFYI(1, ("Reconnecting tcp session ")); -+ -+ /* before reconnecting the tcp session, mark the smb session (uid) -+ and the tid bad so they are not used until reconnected */ -+ read_lock(&GlobalSMBSeslock); -+ list_for_each(tmp, &GlobalSMBSessionList) { -+ ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList); -+ if (ses->server) { -+ if (ses->server == server) { -+ ses->status = CifsNeedReconnect; -+ ses->ipc_tid = 0; -+ } -+ } -+ /* else tcp and smb sessions need reconnection */ -+ } -+ list_for_each(tmp, &GlobalTreeConnectionList) { -+ tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); -+ if((tcon) && (tcon->ses) && (tcon->ses->server == server)) { -+ tcon->tidStatus = CifsNeedReconnect; -+ } -+ } -+ read_unlock(&GlobalSMBSeslock); -+ /* do not want to be sending data on a socket we are freeing */ -+ down(&server->tcpSem); -+ if(server->ssocket) { -+ cFYI(1,("State: 0x%x Flags: 0x%lx", server->ssocket->state, -+ server->ssocket->flags)); -+ server->ssocket->ops->shutdown(server->ssocket,SEND_SHUTDOWN); -+ cFYI(1,("Post shutdown state: 0x%x Flags: 0x%lx", server->ssocket->state, -+ server->ssocket->flags)); -+ sock_release(server->ssocket); -+ server->ssocket = NULL; -+ } -+ -+ spin_lock(&GlobalMid_Lock); -+ list_for_each(tmp, &server->pending_mid_q) { -+ mid_entry = list_entry(tmp, struct -+ mid_q_entry, -+ qhead); -+ if(mid_entry) { -+ if(mid_entry->midState == MID_REQUEST_SUBMITTED) { -+ /* Mark other intransit requests as needing retry so -+ we do not immediately mark the session bad again -+ (ie after we reconnect below) as they timeout too */ -+ mid_entry->midState = MID_RETRY_NEEDED; -+ } -+ } -+ } -+ spin_unlock(&GlobalMid_Lock); -+ up(&server->tcpSem); -+ -+ while ((server->tcpStatus != CifsExiting) && (server->tcpStatus != CifsGood)) -+ { -+ if(server->protocolType == IPV6) { -+ rc = ipv6_connect(&server->addr.sockAddr6,&server->ssocket); -+ } else { -+ rc = ipv4_connect(&server->addr.sockAddr, -+ &server->ssocket, -+ server->workstation_RFC1001_name); -+ } -+ if(rc) { -+ set_current_state(TASK_INTERRUPTIBLE); -+ schedule_timeout(3 * HZ); -+ } else { -+ atomic_inc(&tcpSesReconnectCount); -+ spin_lock(&GlobalMid_Lock); -+ if(server->tcpStatus != CifsExiting) -+ server->tcpStatus = CifsGood; -+ spin_unlock(&GlobalMid_Lock); -+ /* atomic_set(&server->inFlight,0);*/ -+ wake_up(&server->response_q); -+ } -+ } -+ return rc; -+} -+ -+static int -+cifs_demultiplex_thread(struct TCP_Server_Info *server) -+{ -+ int length; -+ unsigned int pdu_length, total_read; -+ struct smb_hdr *smb_buffer = NULL; -+ struct msghdr smb_msg; -+ mm_segment_t temp_fs; -+ struct iovec iov; -+ struct socket *csocket = server->ssocket; -+ struct list_head *tmp; -+ struct cifsSesInfo *ses; -+ struct task_struct *task_to_wake = NULL; -+ struct mid_q_entry *mid_entry; -+ char *temp; -+ -+ daemonize(); -+ sprintf(current->comm,"cifsd"); -+ /* allow_signal(SIGKILL);*/ -+ current->flags |= PF_MEMALLOC; -+ server->tsk = current; /* save process info to wake at shutdown */ -+ cFYI(1, ("Demultiplex PID: %d", current->pid)); -+ -+ temp_fs = get_fs(); /* we must turn off socket api parm checking */ -+ set_fs(get_ds()); -+ -+ while (server->tcpStatus != CifsExiting) { -+ if (smb_buffer == NULL) -+ smb_buffer = cifs_buf_get(); -+ else -+ memset(smb_buffer, 0, sizeof (struct smb_hdr)); -+ -+ if (smb_buffer == NULL) { -+ cERROR(1,("Can not get memory for SMB response")); -+ set_current_state(TASK_INTERRUPTIBLE); -+ schedule_timeout(HZ * 3); /* give system time to free memory */ -+ continue; -+ } -+ iov.iov_base = smb_buffer; -+ iov.iov_len = sizeof (struct smb_hdr) - 1; -+ /* 1 byte less above since wct is not always returned in error cases */ -+ smb_msg.msg_iov = &iov; -+ smb_msg.msg_iovlen = 1; -+ smb_msg.msg_control = NULL; -+ smb_msg.msg_controllen = 0; -+ -+ length = -+ sock_recvmsg(csocket, &smb_msg, -+ sizeof (struct smb_hdr) - -+ 1 /* RFC1001 header and SMB header */ , -+ MSG_PEEK /* flags see socket.h */ ); -+ -+ if(server->tcpStatus == CifsExiting) { -+ break; -+ } else if (server->tcpStatus == CifsNeedReconnect) { -+ cFYI(1,("Reconnecting after server stopped responding")); -+ cifs_reconnect(server); -+ cFYI(1,("call to reconnect done")); -+ csocket = server->ssocket; -+ continue; -+ } else if ((length == -ERESTARTSYS) || (length == -EAGAIN)) { -+ set_current_state(TASK_INTERRUPTIBLE); -+ schedule_timeout(1); /* minimum sleep to prevent looping -+ allowing socket to clear and app threads to set -+ tcpStatus CifsNeedReconnect if server hung */ -+ continue; -+ } else if (length <= 0) { -+ if(server->tcpStatus == CifsNew) { -+ cFYI(1,("tcp session abended prematurely (after SMBnegprot)")); -+ /* some servers kill tcp session rather than returning -+ smb negprot error in which case reconnecting here is -+ not going to help - return error to mount */ -+ break; -+ } -+ if(length == -EINTR) { -+ cFYI(1,("cifsd thread killed")); -+ break; -+ } -+ cFYI(1,("Reconnecting after unexpected peek error %d",length)); -+ cifs_reconnect(server); -+ csocket = server->ssocket; -+ wake_up(&server->response_q); -+ continue; -+ } -+ -+ pdu_length = 4 + ntohl(smb_buffer->smb_buf_length); -+ /* Ony read pdu_length after below checks for too short (due -+ to e.g. int overflow) and too long ie beyond end of buf */ -+ cFYI(1, ("Peek length rcvd: 0x%x beginning 0x%x)", length, pdu_length)); -+ -+ temp = (char *) smb_buffer; -+ if (length > 3) { -+ if (temp[0] == (char) RFC1002_SESSION_KEEP_ALIVE) { -+ iov.iov_base = smb_buffer; -+ iov.iov_len = 4; -+ length = sock_recvmsg(csocket, &smb_msg, 4, 0); -+ cFYI(0,("Received 4 byte keep alive packet")); -+ } else if (temp[0] == (char) RFC1002_POSITIVE_SESSION_RESPONSE) { -+ iov.iov_base = smb_buffer; -+ iov.iov_len = 4; -+ length = sock_recvmsg(csocket, &smb_msg, 4, 0); -+ cFYI(1,("Good RFC 1002 session rsp")); -+ } else if ((temp[0] == (char)RFC1002_NEGATIVE_SESSION_RESPONSE) -+ && (length == 5)) { -+ /* we get this from Windows 98 instead of error on SMB negprot response */ -+ cFYI(1,("Negative RFC 1002 Session Response Error 0x%x)",temp[4])); -+ if(server->tcpStatus == CifsNew) { -+ /* if nack on negprot (rather than -+ ret of smb negprot error) reconnecting -+ not going to help, ret error to mount */ -+ break; -+ } else { -+ /* give server a second to -+ clean up before reconnect attempt */ -+ set_current_state(TASK_INTERRUPTIBLE); -+ schedule_timeout(HZ); -+ /* always try 445 first on reconnect -+ since we get NACK on some if we ever -+ connected to port 139 (the NACK is -+ since we do not begin with RFC1001 -+ session initialize frame) */ -+ server->addr.sockAddr.sin_port = CIFS_PORT; -+ cifs_reconnect(server); -+ csocket = server->ssocket; -+ wake_up(&server->response_q); -+ continue; -+ } -+ } else if (temp[0] != (char) 0) { -+ cERROR(1,("Unknown RFC 1002 frame")); -+ cifs_dump_mem(" Received Data: ", temp, length); -+ cifs_reconnect(server); -+ csocket = server->ssocket; -+ continue; -+ } else { -+ if ((length != sizeof (struct smb_hdr) - 1) -+ || (pdu_length > -+ CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE) -+ || (pdu_length < -+ sizeof (struct smb_hdr) - 1) -+ || -+ (checkSMBhdr -+ (smb_buffer, smb_buffer->Mid))) { -+ cERROR(1, -+ ("Invalid size or format for SMB found with length %d and pdu_lenght %d", -+ length, pdu_length)); -+ cifs_dump_mem("Received Data is: ",temp,sizeof(struct smb_hdr)); -+ /* could we fix this network corruption by finding next -+ smb header (instead of killing the session) and -+ restart reading from next valid SMB found? */ -+ cifs_reconnect(server); -+ csocket = server->ssocket; -+ continue; -+ } else { /* length ok */ -+ -+ length = 0; -+ iov.iov_base = smb_buffer; -+ iov.iov_len = pdu_length; -+ for (total_read = 0; -+ total_read < pdu_length; -+ total_read += length) { -+ length = sock_recvmsg(csocket, &smb_msg, -+ pdu_length - total_read, 0); -+ if (length == 0) { -+ cERROR(1, -+ ("Zero length receive when expecting %d ", -+ pdu_length - total_read)); -+ cifs_reconnect(server); -+ csocket = server->ssocket; -+ continue; -+ } -+ } -+ } -+ -+ dump_smb(smb_buffer, length); -+ if (checkSMB -+ (smb_buffer, smb_buffer->Mid, total_read)) { -+ cERROR(1, ("Bad SMB Received ")); -+ continue; -+ } -+ -+ task_to_wake = NULL; -+ spin_lock(&GlobalMid_Lock); -+ list_for_each(tmp, &server->pending_mid_q) { -+ mid_entry = list_entry(tmp, struct -+ mid_q_entry, -+ qhead); -+ -+ if ((mid_entry->mid == smb_buffer->Mid) && (mid_entry->midState == MID_REQUEST_SUBMITTED)) { -+ cFYI(1, -+ (" Mid 0x%x matched - waking up ",mid_entry->mid)); -+ task_to_wake = mid_entry->tsk; -+ mid_entry->resp_buf = -+ smb_buffer; -+ mid_entry->midState = -+ MID_RESPONSE_RECEIVED; -+ } -+ } -+ spin_unlock(&GlobalMid_Lock); -+ if (task_to_wake) { -+ smb_buffer = NULL; /* will be freed by users thread after he is done */ -+ wake_up_process(task_to_wake); -+ } else if (is_valid_oplock_break(smb_buffer) == FALSE) { -+ cERROR(1, ("No task to wake, unknown frame rcvd!")); -+ cifs_dump_mem("Received Data is: ",temp,sizeof(struct smb_hdr)); -+ } -+ } -+ } else { -+ cFYI(0, -+ ("Frame less than four bytes received %d bytes long.", -+ length)); -+ if (length > 0) { -+ length = sock_recvmsg(csocket, &smb_msg, length, 0); /* throw away junk frame */ -+ cFYI(1, -+ (" with junk 0x%x in it ", -+ *(__u32 *) smb_buffer)); -+ } -+ } -+ } -+ spin_lock(&GlobalMid_Lock); -+ server->tcpStatus = CifsExiting; -+ server->tsk = NULL; -+ atomic_set(&server->inFlight, 0); -+ spin_unlock(&GlobalMid_Lock); -+ /* Although there should not be any requests blocked on -+ this queue it can not hurt to be paranoid and try to wake up requests -+ that may haven been blocked when more than 50 at time were on the wire -+ to the same server - they now will see the session is in exit state -+ and get out of SendReceive. */ -+ wake_up_all(&server->request_q); -+ /* give those requests time to exit */ -+ set_current_state(TASK_INTERRUPTIBLE); -+ schedule_timeout(HZ/8); -+ -+ if(server->ssocket) { -+ sock_release(csocket); -+ server->ssocket = NULL; -+ } -+ set_fs(temp_fs); -+ if (smb_buffer) /* buffer usually freed in free_mid - need to free it on error or exit */ -+ cifs_buf_release(smb_buffer); -+ -+ read_lock(&GlobalSMBSeslock); -+ if (list_empty(&server->pending_mid_q)) { -+ /* loop through server session structures attached to this and mark them dead */ -+ list_for_each(tmp, &GlobalSMBSessionList) { -+ ses = -+ list_entry(tmp, struct cifsSesInfo, -+ cifsSessionList); -+ if (ses->server == server) { -+ ses->status = CifsExiting; -+ ses->server = NULL; -+ } -+ } -+ read_unlock(&GlobalSMBSeslock); -+ } else { -+ spin_lock(&GlobalMid_Lock); -+ list_for_each(tmp, &server->pending_mid_q) { -+ mid_entry = list_entry(tmp, struct mid_q_entry, qhead); -+ if (mid_entry->midState == MID_REQUEST_SUBMITTED) { -+ cFYI(1, -+ (" Clearing Mid 0x%x - waking up ",mid_entry->mid)); -+ task_to_wake = mid_entry->tsk; -+ if(task_to_wake) { -+ wake_up_process(task_to_wake); -+ } -+ } -+ } -+ spin_unlock(&GlobalMid_Lock); -+ read_unlock(&GlobalSMBSeslock); -+ set_current_state(TASK_INTERRUPTIBLE); -+ /* 1/8th of sec is more than enough time for them to exit */ -+ schedule_timeout(HZ/8); -+ } -+ -+ if (list_empty(&server->pending_mid_q)) { -+ /* mpx threads have not exited yet give them -+ at least the smb send timeout time for long ops */ -+ cFYI(1, ("Wait for exit from demultiplex thread")); -+ set_current_state(TASK_INTERRUPTIBLE); -+ schedule_timeout(46 * HZ); -+ /* if threads still have not exited they are probably never -+ coming home not much else we can do but free the memory */ -+ } -+ kfree(server); -+ -+ set_current_state(TASK_INTERRUPTIBLE); -+ schedule_timeout(HZ/4); -+ return 0; -+} -+ -+static void * -+cifs_kcalloc(size_t size, int type) -+{ -+ void *addr; -+ addr = kmalloc(size, type); -+ if (addr) -+ memset(addr, 0, size); -+ return addr; -+} -+ -+static int -+cifs_parse_mount_options(char *options, const char *devname, struct smb_vol *vol) -+{ -+ char *value; -+ char *data; -+ unsigned int temp_len, i, j; -+ char separator[2]; -+ -+ separator[0] = ','; -+ separator[1] = 0; -+ -+ memset(vol->source_rfc1001_name,0x20,15); -+ for(i=0;i < strnlen(system_utsname.nodename,15);i++) { -+ /* does not have to be a perfect mapping since the field is -+ informational, only used for servers that do not support -+ port 445 and it can be overridden at mount time */ -+ vol->source_rfc1001_name[i] = toupper(system_utsname.nodename[i]); -+ } -+ vol->source_rfc1001_name[15] = 0; -+ -+ vol->linux_uid = current->uid; /* current->euid instead? */ -+ vol->linux_gid = current->gid; -+ vol->dir_mode = S_IRWXUGO; -+ /* 2767 perms indicate mandatory locking support */ -+ vol->file_mode = S_IALLUGO & ~(S_ISUID | S_IXGRP); -+ -+ /* vol->retry default is 0 (i.e. "soft" limited retry not hard retry) */ -+ vol->rw = TRUE; -+ -+ if (!options) -+ return 1; -+ -+ if(strncmp(options,"sep=",4) == 0) { -+ if(options[4] != 0) { -+ separator[0] = options[4]; -+ options += 5; -+ } else { -+ cFYI(1,("Null separator not allowed")); -+ } -+ } -+ -+ while ((data = strsep(&options, separator)) != NULL) { -+ if (!*data) -+ continue; -+ if ((value = strchr(data, '=')) != NULL) -+ *value++ = '\0'; -+ if (strnicmp(data, "user", 4) == 0) { -+ if (!value || !*value) { -+ printk(KERN_WARNING -+ "CIFS: invalid or missing username\n"); -+ return 1; /* needs_arg; */ -+ } -+ if (strnlen(value, 200) < 200) { -+ vol->username = value; -+ } else { -+ printk(KERN_WARNING "CIFS: username too long\n"); -+ return 1; -+ } -+ } else if (strnicmp(data, "pass", 4) == 0) { -+ if (!value || !*value) { -+ vol->password = NULL; -+ continue; -+ } -+ temp_len = strlen(value); -+ /* removed password length check, NTLM passwords -+ can be arbitrarily long */ -+ -+ /* if comma in password, the string will be -+ prematurely null terminated. Commas in password are -+ specified across the cifs mount interface by a double -+ comma ie ,, and a comma used as in other cases ie ',' -+ as a parameter delimiter/separator is single and due -+ to the strsep above is temporarily zeroed. */ -+ -+ /* NB: password legally can have multiple commas and -+ the only illegal character in a password is null */ -+ -+ if ((value[temp_len] == 0) && (value[temp_len+1] == separator[0])) { -+ /* reinsert comma */ -+ value[temp_len] = separator[0]; -+ temp_len+=2; /* move after the second comma */ -+ while(value[temp_len] != 0) { -+ if((value[temp_len] == separator[0]) && (value[temp_len+1] != separator[0])) { -+ /* single comma indicating start of next parm */ -+ break; -+ } -+ temp_len++; -+ } -+ if(value[temp_len] == 0) { -+ options = NULL; -+ } else { -+ value[temp_len] = 0; -+ /* move options to point to start of next parm */ -+ options = value + temp_len + 1; -+ } -+ /* go from value to (value + temp_len) condensing double commas to singles */ -+ vol->password = cifs_kcalloc(temp_len, GFP_KERNEL); -+ for(i=0,j=0;ipassword[j] = value[i]; -+ if(value[i] == separator[0] && value[i+1] == separator[0]) { -+ /* skip second comma */ -+ i++; -+ } -+ } -+ /* value[temp_len] is zeroed above so -+ vol->password[temp_len] guaranteed to be null */ -+ } else { -+ vol->password = cifs_kcalloc(temp_len + 1, GFP_KERNEL); -+ strcpy(vol->password, value); -+ } -+ } else if (strnicmp(data, "ip", 2) == 0) { -+ if (!value || !*value) { -+ vol->UNCip = NULL; -+ } else if (strnlen(value, 35) < 35) { -+ vol->UNCip = value; -+ } else { -+ printk(KERN_WARNING "CIFS: ip address too long\n"); -+ return 1; -+ } -+ } else if ((strnicmp(data, "unc", 3) == 0) -+ || (strnicmp(data, "target", 6) == 0) -+ || (strnicmp(data, "path", 4) == 0)) { -+ if (!value || !*value) { -+ printk(KERN_WARNING -+ "CIFS: invalid path to network resource\n"); -+ return 1; /* needs_arg; */ -+ } -+ if ((temp_len = strnlen(value, 300)) < 300) { -+ vol->UNC = kmalloc(temp_len+1,GFP_KERNEL); -+ if(vol->UNC == NULL) -+ return 1; -+ strcpy(vol->UNC,value); -+ if (strncmp(vol->UNC, "//", 2) == 0) { -+ vol->UNC[0] = '\\'; -+ vol->UNC[1] = '\\'; -+ } else if (strncmp(vol->UNC, "\\\\", 2) != 0) { -+ printk(KERN_WARNING -+ "CIFS: UNC Path does not begin with // or \\\\ \n"); -+ return 1; -+ } -+ } else { -+ printk(KERN_WARNING "CIFS: UNC name too long\n"); -+ return 1; -+ } -+ } else if ((strnicmp(data, "domain", 3) == 0) -+ || (strnicmp(data, "workgroup", 5) == 0)) { -+ if (!value || !*value) { -+ printk(KERN_WARNING "CIFS: invalid domain name\n"); -+ return 1; /* needs_arg; */ -+ } -+ /* BB are there cases in which a comma can be valid in -+ a domain name and need special handling? */ -+ if (strnlen(value, 65) < 65) { -+ vol->domainname = value; -+ cFYI(1, ("Domain name set")); -+ } else { -+ printk(KERN_WARNING "CIFS: domain name too long\n"); -+ return 1; -+ } -+ } else if (strnicmp(data, "iocharset", 9) == 0) { -+ if (!value || !*value) { -+ printk(KERN_WARNING "CIFS: invalid iocharset specified\n"); -+ return 1; /* needs_arg; */ -+ } -+ if (strnlen(value, 65) < 65) { -+ if(strnicmp(value,"default",7)) -+ vol->iocharset = value; -+ /* if iocharset not set load_nls_default used by caller */ -+ cFYI(1, ("iocharset set to %s",value)); -+ } else { -+ printk(KERN_WARNING "CIFS: iocharset name too long.\n"); -+ return 1; -+ } -+ } else if (strnicmp(data, "uid", 3) == 0) { -+ if (value && *value) { -+ vol->linux_uid = -+ simple_strtoul(value, &value, 0); -+ } -+ } else if (strnicmp(data, "gid", 3) == 0) { -+ if (value && *value) { -+ vol->linux_gid = -+ simple_strtoul(value, &value, 0); -+ } -+ } else if (strnicmp(data, "file_mode", 4) == 0) { -+ if (value && *value) { -+ vol->file_mode = -+ simple_strtoul(value, &value, 0); -+ } -+ } else if (strnicmp(data, "dir_mode", 3) == 0) { -+ if (value && *value) { -+ vol->dir_mode = -+ simple_strtoul(value, &value, 0); -+ } -+ } else if (strnicmp(data, "port", 4) == 0) { -+ if (value && *value) { -+ vol->port = -+ simple_strtoul(value, &value, 0); -+ } -+ } else if (strnicmp(data, "rsize", 5) == 0) { -+ if (value && *value) { -+ vol->rsize = -+ simple_strtoul(value, &value, 0); -+ } -+ } else if (strnicmp(data, "wsize", 5) == 0) { -+ if (value && *value) { -+ vol->wsize = -+ simple_strtoul(value, &value, 0); -+ } -+ } else if (strnicmp(data, "sockopt", 5) == 0) { -+ if (value && *value) { -+ vol->sockopt = -+ simple_strtoul(value, &value, 0); -+ } -+ } else if (strnicmp(data, "netbiosname", 4) == 0) { -+ if (!value || !*value || (*value == ' ')) { -+ cFYI(1,("invalid (empty) netbiosname specified")); -+ } else { -+ memset(vol->source_rfc1001_name,0x20,15); -+ for(i=0;i<15;i++) { -+ /* BB are there cases in which a comma can be -+ valid in this workstation netbios name (and need -+ special handling)? */ -+ -+ /* We do not uppercase netbiosname for user */ -+ if (value[i]==0) -+ break; -+ else -+ vol->source_rfc1001_name[i] = value[i]; -+ } -+ /* The string has 16th byte zero still from -+ set at top of the function */ -+ if((i==15) && (value[i] != 0)) -+ printk(KERN_WARNING "CIFS: netbiosname longer than 15 and was truncated.\n"); -+ } -+ } else if (strnicmp(data, "credentials", 4) == 0) { -+ /* ignore */ -+ } else if (strnicmp(data, "version", 3) == 0) { -+ /* ignore */ -+ } else if (strnicmp(data, "rw", 2) == 0) { -+ vol->rw = TRUE; -+ } else if ((strnicmp(data, "suid", 4) == 0) || -+ (strnicmp(data, "nosuid", 6) == 0) || -+ (strnicmp(data, "exec", 4) == 0) || -+ (strnicmp(data, "noexec", 6) == 0) || -+ (strnicmp(data, "nodev", 5) == 0) || -+ (strnicmp(data, "noauto", 6) == 0) || -+ (strnicmp(data, "dev", 3) == 0)) { -+ /* The mount tool or mount.cifs helper (if present) -+ uses these opts to set flags, and the flags are read -+ by the kernel vfs layer before we get here (ie -+ before read super) so there is no point trying to -+ parse these options again and set anything and it -+ is ok to just ignore them */ -+ continue; -+ } else if (strnicmp(data, "ro", 2) == 0) { -+ vol->rw = FALSE; -+ } else if (strnicmp(data, "hard", 4) == 0) { -+ vol->retry = 1; -+ } else if (strnicmp(data, "soft", 4) == 0) { -+ vol->retry = 0; -+ } else if (strnicmp(data, "nohard", 6) == 0) { -+ vol->retry = 0; -+ } else if (strnicmp(data, "nosoft", 6) == 0) { -+ vol->retry = 1; -+ } else if (strnicmp(data, "nointr", 6) == 0) { -+ vol->intr = 0; -+ } else if (strnicmp(data, "intr", 4) == 0) { -+ vol->intr = 1; -+ } else if (strnicmp(data, "noac", 4) == 0) { -+ printk(KERN_WARNING "CIFS: Mount option noac not supported. Instead set /proc/fs/cifs/LookupCacheEnabled to 0\n"); -+ } else -+ printk(KERN_WARNING "CIFS: Unknown mount option %s\n",data); -+ } -+ if (vol->UNC == NULL) { -+ if(devname == NULL) { -+ printk(KERN_WARNING "CIFS: Missing UNC name for mount target\n"); -+ return 1; -+ } -+ if ((temp_len = strnlen(devname, 300)) < 300) { -+ vol->UNC = kmalloc(temp_len+1,GFP_KERNEL); -+ if(vol->UNC == NULL) -+ return 1; -+ strcpy(vol->UNC,devname); -+ if (strncmp(vol->UNC, "//", 2) == 0) { -+ vol->UNC[0] = '\\'; -+ vol->UNC[1] = '\\'; -+ } else if (strncmp(vol->UNC, "\\\\", 2) != 0) { -+ printk(KERN_WARNING "CIFS: UNC Path does not begin with // or \\\\ \n"); -+ return 1; -+ } -+ } else { -+ printk(KERN_WARNING "CIFS: UNC name too long\n"); -+ return 1; -+ } -+ } -+ if(vol->UNCip == 0) -+ vol->UNCip = &vol->UNC[2]; -+ -+ return 0; -+} -+ -+static struct cifsSesInfo * -+cifs_find_tcp_session(__u32 new_target_ip_addr, -+ char *userName, struct TCP_Server_Info **psrvTcp) -+{ -+ struct list_head *tmp; -+ struct cifsSesInfo *ses; -+ -+ *psrvTcp = NULL; -+ read_lock(&GlobalSMBSeslock); -+ list_for_each(tmp, &GlobalSMBSessionList) { -+ ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList); -+ if (ses->server) { -+ if (ses->server->addr.sockAddr.sin_addr.s_addr == -+ new_target_ip_addr) { -+ /* BB lock server and tcp session and increment use count here?? */ -+ *psrvTcp = ses->server; /* found a match on the TCP session */ -+ /* BB check if reconnection needed */ -+ if (strncmp -+ (ses->userName, userName, -+ MAX_USERNAME_SIZE) == 0){ -+ read_unlock(&GlobalSMBSeslock); -+ return ses; /* found exact match on both tcp and SMB sessions */ -+ } -+ } -+ } -+ /* else tcp and smb sessions need reconnection */ -+ } -+ read_unlock(&GlobalSMBSeslock); -+ return NULL; -+} -+ -+static struct cifsTconInfo * -+find_unc(__u32 new_target_ip_addr, char *uncName, char *userName) -+{ -+ struct list_head *tmp; -+ struct cifsTconInfo *tcon; -+ -+ read_lock(&GlobalSMBSeslock); -+ list_for_each(tmp, &GlobalTreeConnectionList) { -+ cFYI(1, ("Next tcon - ")); -+ tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); -+ if (tcon->ses) { -+ if (tcon->ses->server) { -+ cFYI(1, -+ (" old ip addr: %x == new ip %x ?", -+ tcon->ses->server->addr.sockAddr.sin_addr. -+ s_addr, new_target_ip_addr)); -+ if (tcon->ses->server->addr.sockAddr.sin_addr. -+ s_addr == new_target_ip_addr) { -+ /* BB lock tcon and server and tcp session and increment use count here? */ -+ /* found a match on the TCP session */ -+ /* BB check if reconnection needed */ -+ cFYI(1,("Matched ip, old UNC: %s == new: %s ?", -+ tcon->treeName, uncName)); -+ if (strncmp -+ (tcon->treeName, uncName, -+ MAX_TREE_SIZE) == 0) { -+ cFYI(1, -+ ("Matched UNC, old user: %s == new: %s ?", -+ tcon->treeName, uncName)); -+ if (strncmp -+ (tcon->ses->userName, -+ userName, -+ MAX_USERNAME_SIZE) == 0) { -+ read_unlock(&GlobalSMBSeslock); -+ return tcon;/* also matched user (smb session)*/ -+ } -+ } -+ } -+ } -+ } -+ } -+ read_unlock(&GlobalSMBSeslock); -+ return NULL; -+} -+ -+int -+connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo, -+ const char *old_path, const struct nls_table *nls_codepage) -+{ -+ unsigned char *referrals = NULL; -+ unsigned int num_referrals; -+ int rc = 0; -+ -+ rc = get_dfs_path(xid, pSesInfo,old_path, nls_codepage, -+ &num_referrals, &referrals); -+ -+ /* BB Add in code to: if valid refrl, if not ip address contact -+ the helper that resolves tcp names, mount to it, try to -+ tcon to it unmount it if fail */ -+ -+ if(referrals) -+ kfree(referrals); -+ -+ return rc; -+} -+ -+int -+get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, -+ const char *old_path, const struct nls_table *nls_codepage, -+ unsigned int *pnum_referrals, unsigned char ** preferrals) -+{ -+ char *temp_unc; -+ int rc = 0; -+ -+ *pnum_referrals = 0; -+ -+ if (pSesInfo->ipc_tid == 0) { -+ temp_unc = kmalloc(2 /* for slashes */ + -+ strnlen(pSesInfo->serverName,SERVER_NAME_LEN_WITH_NULL * 2) -+ + 1 + 4 /* slash IPC$ */ + 2, -+ GFP_KERNEL); -+ if (temp_unc == NULL) -+ return -ENOMEM; -+ temp_unc[0] = '\\'; -+ temp_unc[1] = '\\'; -+ strcpy(temp_unc + 2, pSesInfo->serverName); -+ strcpy(temp_unc + 2 + strlen(pSesInfo->serverName), "\\IPC$"); -+ rc = CIFSTCon(xid, pSesInfo, temp_unc, NULL, nls_codepage); -+ cFYI(1, -+ ("CIFS Tcon rc = %d ipc_tid = %d", rc,pSesInfo->ipc_tid)); -+ kfree(temp_unc); -+ } -+ if (rc == 0) -+ rc = CIFSGetDFSRefer(xid, pSesInfo, old_path, preferrals, -+ pnum_referrals, nls_codepage); -+ -+ return rc; -+} -+ -+/* See RFC1001 section 14 on representation of Netbios names */ -+static void rfc1002mangle(char * target,char * source, unsigned int length) -+{ -+ unsigned int i,j; -+ -+ for(i=0,j=0;i<(length);i++) { -+ /* mask a nibble at a time and encode */ -+ target[j] = 'A' + (0x0F & (source[i] >> 4)); -+ target[j+1] = 'A' + (0x0F & source[i]); -+ j+=2; -+ } -+ -+} -+ -+ -+static int -+ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket, -+ char * netbios_name) -+{ -+ int rc = 0; -+ int connected = 0; -+ unsigned short int orig_port = 0; -+ -+ if(*csocket == NULL) { -+ rc = sock_create(PF_INET, SOCK_STREAM, IPPROTO_TCP, csocket); -+ if (rc < 0) { -+ cERROR(1, ("Error %d creating socket",rc)); -+ *csocket = NULL; -+ return rc; -+ } else { -+ /* BB other socket options to set KEEPALIVE, NODELAY? */ -+ cFYI(1,("Socket created")); -+ (*csocket)->sk->allocation = GFP_NOFS; -+ } -+ } -+ -+ psin_server->sin_family = AF_INET; -+ if(psin_server->sin_port) { /* user overrode default port */ -+ rc = (*csocket)->ops->connect(*csocket, -+ (struct sockaddr *) psin_server, -+ sizeof (struct sockaddr_in),0); -+ if (rc >= 0) -+ connected = 1; -+ } -+ -+ if(!connected) { -+ /* save original port so we can retry user specified port -+ later if fall back ports fail this time */ -+ orig_port = psin_server->sin_port; -+ -+ /* do not retry on the same port we just failed on */ -+ if(psin_server->sin_port != htons(CIFS_PORT)) { -+ psin_server->sin_port = htons(CIFS_PORT); -+ -+ rc = (*csocket)->ops->connect(*csocket, -+ (struct sockaddr *) psin_server, -+ sizeof (struct sockaddr_in),0); -+ if (rc >= 0) -+ connected = 1; -+ } -+ } -+ if (!connected) { -+ psin_server->sin_port = htons(RFC1001_PORT); -+ rc = (*csocket)->ops->connect(*csocket, (struct sockaddr *) -+ psin_server, sizeof (struct sockaddr_in),0); -+ if (rc >= 0) -+ connected = 1; -+ } -+ -+ /* give up here - unless we want to retry on different -+ protocol families some day */ -+ if (!connected) { -+ if(orig_port) -+ psin_server->sin_port = orig_port; -+ cFYI(1,("Error %d connecting to server via ipv4",rc)); -+ sock_release(*csocket); -+ *csocket = NULL; -+ return rc; -+ } -+ /* Eventually check for other socket options to change from -+ the default. sock_setsockopt not used because it expects -+ user space buffer */ -+ (*csocket)->sk->rcvtimeo = 7 * HZ; -+ -+ /* send RFC1001 sessinit */ -+ -+ if(psin_server->sin_port == htons(139)) { -+ /* some servers require RFC1001 sessinit before sending -+ negprot - BB check reconnection in case where second -+ sessinit is sent but no second negprot */ -+ struct rfc1002_session_packet * ses_init_buf; -+ struct smb_hdr * smb_buf; -+ ses_init_buf = cifs_kcalloc(sizeof(struct rfc1002_session_packet), GFP_KERNEL); -+ if(ses_init_buf) { -+ ses_init_buf->trailer.session_req.called_len = 32; -+ rfc1002mangle(ses_init_buf->trailer.session_req.called_name, -+ DEFAULT_CIFS_CALLED_NAME,16); -+ ses_init_buf->trailer.session_req.calling_len = 32; -+ /* calling name ends in null (byte 16) from old smb -+ convention. */ -+ if(netbios_name && (netbios_name[0] !=0)) { -+ rfc1002mangle(ses_init_buf->trailer.session_req.calling_name, -+ netbios_name,16); -+ } else { -+ rfc1002mangle(ses_init_buf->trailer.session_req.calling_name, -+ "LINUX_CIFS_CLNT",16); -+ } -+ ses_init_buf->trailer.session_req.scope1 = 0; -+ ses_init_buf->trailer.session_req.scope2 = 0; -+ smb_buf = (struct smb_hdr *)ses_init_buf; -+ /* sizeof RFC1002_SESSION_REQUEST with no scope */ -+ smb_buf->smb_buf_length = 0x81000044; -+ rc = smb_send(*csocket, smb_buf, 0x44, -+ (struct sockaddr *)psin_server); -+ kfree(ses_init_buf); -+ } -+ /* else the negprot may still work without this -+ even though malloc failed */ -+ -+ } -+ -+ return rc; -+} -+ -+static int -+ipv6_connect(struct sockaddr_in6 *psin_server, struct socket **csocket) -+{ -+ int rc = 0; -+ int connected = 0; -+ -+ if(*csocket == NULL) { -+ rc = sock_create(PF_INET6, SOCK_STREAM, IPPROTO_TCP, csocket); -+ if (rc < 0) { -+ cERROR(1, ("Error %d creating ipv6 socket",rc)); -+ *csocket = NULL; -+ return rc; -+ } else { -+ /* BB other socket options to set KEEPALIVE, NODELAY? */ -+ cFYI(1,("ipv6 Socket created")); -+ (*csocket)->sk->allocation = GFP_NOFS; -+ } -+ } -+ -+ psin_server->sin6_family = AF_INET6; -+ -+ if(psin_server->sin6_port) { /* user overrode default port */ -+ rc = (*csocket)->ops->connect(*csocket, -+ (struct sockaddr *) psin_server, -+ sizeof (struct sockaddr_in6),0); -+ if (rc >= 0) -+ connected = 1; -+ } -+ -+ if(!connected) { -+ /* do not retry on the same port we just failed on */ -+ if(psin_server->sin6_port != htons(CIFS_PORT)) { -+ psin_server->sin6_port = htons(CIFS_PORT); -+ -+ rc = (*csocket)->ops->connect(*csocket, -+ (struct sockaddr *) psin_server, -+ sizeof (struct sockaddr_in6),0); -+ if (rc >= 0) -+ connected = 1; -+ } -+ } -+ if (!connected) { -+ psin_server->sin6_port = htons(RFC1001_PORT); -+ rc = (*csocket)->ops->connect(*csocket, (struct sockaddr *) -+ psin_server, sizeof (struct sockaddr_in6),0); -+ if (rc >= 0) -+ connected = 1; -+ } -+ -+ /* give up here - unless we want to retry on different -+ protocol families some day */ -+ if (!connected) { -+ cFYI(1,("Error %d connecting to server via ipv6",rc)); -+ sock_release(*csocket); -+ *csocket = NULL; -+ return rc; -+ } -+ /* Eventually check for other socket options to change from -+ the default. sock_setsockopt not used because it expects -+ user space buffer */ -+ (*csocket)->sk->rcvtimeo = 7 * HZ; -+ -+ return rc; -+} -+ -+int -+cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, -+ char *mount_data, const char *devname) -+{ -+ int rc = 0; -+ int xid; -+ struct socket *csocket = NULL; -+ struct sockaddr_in sin_server; -+ struct sockaddr_in6 sin_server6; -+ struct smb_vol volume_info; -+ struct cifsSesInfo *pSesInfo = NULL; -+ struct cifsSesInfo *existingCifsSes = NULL; -+ struct cifsTconInfo *tcon = NULL; -+ struct TCP_Server_Info *srvTcp = NULL; -+ -+ xid = GetXid(); -+ -+ cFYI(1, ("Entering cifs_mount. Xid: %d with: %s", xid, mount_data)); /* BB removeme BB fixme */ -+ -+ memset(&volume_info,0,sizeof(struct smb_vol)); -+ if (cifs_parse_mount_options(mount_data, devname, &volume_info)) { -+ if(volume_info.UNC) -+ kfree(volume_info.UNC); -+ if(volume_info.password) -+ kfree(volume_info.password); -+ FreeXid(xid); -+ return -EINVAL; -+ } -+ -+ if (volume_info.username) { -+ cFYI(1, ("Username: %s ", volume_info.username)); -+ -+ } else { -+ cifserror("No username specified "); -+ /* In userspace mount helper we can get user name from alternate -+ locations such as env variables and files on disk */ -+ if(volume_info.UNC) -+ kfree(volume_info.UNC); -+ if(volume_info.password) -+ kfree(volume_info.password); -+ FreeXid(xid); -+ return -EINVAL; -+ } -+ -+ if (volume_info.UNCip && volume_info.UNC) { -+ rc = cifs_inet_pton(AF_INET, volume_info.UNCip,&sin_server.sin_addr.s_addr); -+ -+ if(rc == 0) { -+ /* not ipv4 address, try ipv6 */ -+ rc = cifs_inet_pton(AF_INET6,volume_info.UNCip,&sin_server6.sin6_addr.in6_u); -+ } -+ -+ if(rc != 1) { -+ /* we failed translating address */ -+ if(volume_info.UNC) -+ kfree(volume_info.UNC); -+ if(volume_info.password) -+ kfree(volume_info.password); -+ FreeXid(xid); -+ return -EINVAL; -+ } -+ -+ cFYI(1, ("UNC: %s ip: %s", volume_info.UNC, volume_info.UNCip)); -+ /* success */ -+ rc = 0; -+ } else if (volume_info.UNCip){ -+ /* BB using ip addr as server name connect to the DFS root below */ -+ cERROR(1,("Connecting to DFS root not implemented yet")); -+ if(volume_info.UNC) -+ kfree(volume_info.UNC); -+ if(volume_info.password) -+ kfree(volume_info.password); -+ FreeXid(xid); -+ return -EINVAL; -+ } else /* which servers DFS root would we conect to */ { -+ cERROR(1, -+ ("CIFS mount error: No UNC path (e.g. -o unc=//192.168.1.100/public) specified ")); -+ if(volume_info.UNC) -+ kfree(volume_info.UNC); -+ if(volume_info.password) -+ kfree(volume_info.password); -+ FreeXid(xid); -+ return -EINVAL; -+ } -+ -+ /* this is needed for ASCII cp to Unicode converts */ -+ if(volume_info.iocharset == NULL) { -+ cifs_sb->local_nls = load_nls_default(); -+ /* load_nls_default can not return null */ -+ } else { -+ cifs_sb->local_nls = load_nls(volume_info.iocharset); -+ if(cifs_sb->local_nls == NULL) { -+ cERROR(1,("CIFS mount error: iocharset %s not found",volume_info.iocharset)); -+ if(volume_info.UNC) -+ kfree(volume_info.UNC); -+ if(volume_info.password) -+ kfree(volume_info.password); -+ FreeXid(xid); -+ return -ELIBACC; -+ } -+ } -+ -+ existingCifsSes = -+ cifs_find_tcp_session(sin_server.sin_addr.s_addr, -+ volume_info.username, &srvTcp); -+ if (srvTcp) { -+ cFYI(1, ("Existing tcp session with server found ")); -+ } else { /* create socket */ -+ if(volume_info.port) -+ sin_server.sin_port = htons(volume_info.port); -+ else -+ sin_server.sin_port = 0; -+ rc = ipv4_connect(&sin_server,&csocket,volume_info.source_rfc1001_name); -+ if (rc < 0) { -+ cERROR(1, -+ ("Error connecting to IPv4 socket. Aborting operation")); -+ if(csocket != NULL) -+ sock_release(csocket); -+ if(volume_info.UNC) -+ kfree(volume_info.UNC); -+ if(volume_info.password) -+ kfree(volume_info.password); -+ FreeXid(xid); -+ return rc; -+ } -+ -+ srvTcp = kmalloc(sizeof (struct TCP_Server_Info), GFP_KERNEL); -+ if (srvTcp == NULL) { -+ rc = -ENOMEM; -+ sock_release(csocket); -+ if(volume_info.UNC) -+ kfree(volume_info.UNC); -+ if(volume_info.password) -+ kfree(volume_info.password); -+ FreeXid(xid); -+ return rc; -+ } else { -+ memset(srvTcp, 0, sizeof (struct TCP_Server_Info)); -+ memcpy(&srvTcp->addr.sockAddr, &sin_server, sizeof (struct sockaddr_in)); -+ atomic_set(&srvTcp->inFlight,0); -+ /* BB Add code for ipv6 case too */ -+ srvTcp->ssocket = csocket; -+ srvTcp->protocolType = IPV4; -+ init_waitqueue_head(&srvTcp->response_q); -+ init_waitqueue_head(&srvTcp->request_q); -+ INIT_LIST_HEAD(&srvTcp->pending_mid_q); -+ /* at this point we are the only ones with the pointer -+ to the struct since the kernel thread not created yet -+ so no need to spinlock this init of tcpStatus */ -+ srvTcp->tcpStatus = CifsNew; -+ init_MUTEX(&srvTcp->tcpSem); -+ kernel_thread((void *)(void *)cifs_demultiplex_thread, srvTcp, -+ CLONE_FS | CLONE_FILES | CLONE_VM); -+ memcpy(srvTcp->workstation_RFC1001_name, volume_info.source_rfc1001_name,16); -+ } -+ } -+ -+ if (existingCifsSes) { -+ pSesInfo = existingCifsSes; -+ cFYI(1, ("Existing smb sess found ")); -+ if(volume_info.password) -+ kfree(volume_info.password); -+ /* volume_info.UNC freed at end of function */ -+ } else if (!rc) { -+ cFYI(1, ("Existing smb sess not found ")); -+ pSesInfo = sesInfoAlloc(); -+ if (pSesInfo == NULL) -+ rc = -ENOMEM; -+ else { -+ pSesInfo->server = srvTcp; -+ sprintf(pSesInfo->serverName, "%u.%u.%u.%u", -+ NIPQUAD(sin_server.sin_addr.s_addr)); -+ } -+ -+ if (!rc){ -+ /* volume_info.password freed at unmount */ -+ if (volume_info.password) -+ pSesInfo->password = volume_info.password; -+ if (volume_info.username) -+ strncpy(pSesInfo->userName, -+ volume_info.username,MAX_USERNAME_SIZE); -+ if (volume_info.domainname) -+ strncpy(pSesInfo->domainName, -+ volume_info.domainname,MAX_USERNAME_SIZE); -+ pSesInfo->linux_uid = volume_info.linux_uid; -+ down(&pSesInfo->sesSem); -+ rc = cifs_setup_session(xid,pSesInfo, cifs_sb->local_nls); -+ up(&pSesInfo->sesSem); -+ if(!rc) -+ atomic_inc(&srvTcp->socketUseCount); -+ } else -+ if(volume_info.password) -+ kfree(volume_info.password); -+ } -+ -+ /* search for existing tcon to this server share */ -+ if (!rc) { -+ if((volume_info.rsize) && (volume_info.rsize + MAX_CIFS_HDR_SIZE < srvTcp->maxBuf)) -+ cifs_sb->rsize = volume_info.rsize; -+ else -+ cifs_sb->rsize = srvTcp->maxBuf - MAX_CIFS_HDR_SIZE; /* default */ -+ if((volume_info.wsize) && (volume_info.wsize + MAX_CIFS_HDR_SIZE < srvTcp->maxBuf)) -+ cifs_sb->wsize = volume_info.wsize; -+ else -+ cifs_sb->wsize = srvTcp->maxBuf - MAX_CIFS_HDR_SIZE; /* default */ -+ if(cifs_sb->rsize < PAGE_CACHE_SIZE) { -+ cifs_sb->rsize = PAGE_CACHE_SIZE; -+ cERROR(1,("Attempt to set readsize for mount to less than one page (4096)")); -+ } -+ cifs_sb->mnt_uid = volume_info.linux_uid; -+ cifs_sb->mnt_gid = volume_info.linux_gid; -+ cifs_sb->mnt_file_mode = volume_info.file_mode; -+ cifs_sb->mnt_dir_mode = volume_info.dir_mode; -+ cFYI(1,("file mode: 0x%x dir mode: 0x%x",cifs_sb->mnt_file_mode,cifs_sb->mnt_dir_mode)); -+ tcon = -+ find_unc(sin_server.sin_addr.s_addr, volume_info.UNC, -+ volume_info.username); -+ if (tcon) { -+ cFYI(1, ("Found match on UNC path ")); -+ /* we can have only one retry value for a connection -+ to a share so for resources mounted more than once -+ to the same server share the last value passed in -+ for the retry flag is used */ -+ tcon->retry = volume_info.retry; -+ } else { -+ tcon = tconInfoAlloc(); -+ if (tcon == NULL) -+ rc = -ENOMEM; -+ else { -+ /* check for null share name ie connect to dfs root */ -+ -+ /* BB check if this works for exactly length three strings */ -+ if ((strchr(volume_info.UNC + 3, '\\') == NULL) -+ && (strchr(volume_info.UNC + 3, '/') == -+ NULL)) { -+ rc = connect_to_dfs_path(xid, -+ pSesInfo, -+ "", -+ cifs_sb-> -+ local_nls); -+ if(volume_info.UNC) -+ kfree(volume_info.UNC); -+ FreeXid(xid); -+ return -ENODEV; -+ } else { -+ rc = CIFSTCon(xid, pSesInfo, -+ volume_info.UNC, -+ tcon, cifs_sb->local_nls); -+ cFYI(1, ("CIFS Tcon rc = %d", rc)); -+ } -+ if (!rc) { -+ atomic_inc(&pSesInfo->inUse); -+ tcon->retry = volume_info.retry; -+ } -+ } -+ } -+ } -+ if(pSesInfo) { -+ if (pSesInfo->capabilities & CAP_LARGE_FILES) { -+ sb->s_maxbytes = (u64) 1 << 63; -+ } else -+ sb->s_maxbytes = (u64) 1 << 31; /* 2 GB */ -+ } -+ -+/* on error free sesinfo and tcon struct if needed */ -+ if (rc) { -+ /* if session setup failed, use count is zero but -+ we still need to free cifsd thread */ -+ if(atomic_read(&srvTcp->socketUseCount) == 0) { -+ spin_lock(&GlobalMid_Lock); -+ srvTcp->tcpStatus = CifsExiting; -+ spin_unlock(&GlobalMid_Lock); -+ if(srvTcp->tsk) -+ send_sig(SIGKILL,srvTcp->tsk,1); -+ } -+ /* If find_unc succeeded then rc == 0 so we can not end */ -+ if (tcon) /* up accidently freeing someone elses tcon struct */ -+ tconInfoFree(tcon); -+ if (existingCifsSes == 0) { -+ if (pSesInfo) { -+ if ((pSesInfo->server) && -+ (pSesInfo->status == CifsGood)) { -+ int temp_rc; -+ temp_rc = CIFSSMBLogoff(xid, pSesInfo); -+ /* if the socketUseCount is now zero */ -+ if((temp_rc == -ESHUTDOWN) && -+ (pSesInfo->server->tsk)) -+ send_sig(SIGKILL,pSesInfo->server->tsk,1); -+ } else -+ cFYI(1, ("No session or bad tcon")); -+ sesInfoFree(pSesInfo); -+ /* pSesInfo = NULL; */ -+ } -+ } -+ } else { -+ atomic_inc(&tcon->useCount); -+ cifs_sb->tcon = tcon; -+ tcon->ses = pSesInfo; -+ -+ /* do not care if following two calls succeed - informational only */ -+ CIFSSMBQFSDeviceInfo(xid, tcon, cifs_sb->local_nls); -+ CIFSSMBQFSAttributeInfo(xid, tcon, cifs_sb->local_nls); -+ if (tcon->ses->capabilities & CAP_UNIX) -+ CIFSSMBQFSUnixInfo(xid, tcon, cifs_sb->local_nls); -+ } -+ -+ /* volume_info.password is freed above when existing session found -+ (in which case it is not needed anymore) but when new sesion is created -+ the password ptr is put in the new session structure (in which case the -+ password will be freed at unmount time) */ -+ if(volume_info.UNC) -+ kfree(volume_info.UNC); -+ FreeXid(xid); -+ return rc; -+} -+ -+static int -+CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, -+ char session_key[CIFS_SESSION_KEY_SIZE], -+ const struct nls_table *nls_codepage) -+{ -+ struct smb_hdr *smb_buffer; -+ struct smb_hdr *smb_buffer_response; -+ SESSION_SETUP_ANDX *pSMB; -+ SESSION_SETUP_ANDX *pSMBr; -+ char *bcc_ptr; -+ char *user = ses->userName; -+ char *domain = ses->domainName; -+ int rc = 0; -+ int remaining_words = 0; -+ int bytes_returned = 0; -+ int len; -+ -+ cFYI(1, ("In sesssetup ")); -+ -+ smb_buffer = cifs_buf_get(); -+ if (smb_buffer == 0) { -+ return -ENOMEM; -+ } -+ smb_buffer_response = smb_buffer; -+ pSMBr = pSMB = (SESSION_SETUP_ANDX *) smb_buffer; -+ -+ /* send SMBsessionSetup here */ -+ header_assemble(smb_buffer, SMB_COM_SESSION_SETUP_ANDX, -+ NULL /* no tCon exists yet */ , 13 /* wct */ ); -+ -+ pSMB->req_no_secext.AndXCommand = 0xFF; -+ pSMB->req_no_secext.MaxBufferSize = cpu_to_le16(ses->server->maxBuf); -+ pSMB->req_no_secext.MaxMpxCount = cpu_to_le16(ses->server->maxReq); -+ -+ if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) -+ smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; -+ -+ pSMB->req_no_secext.Capabilities = -+ CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS; -+ if (ses->capabilities & CAP_UNICODE) { -+ smb_buffer->Flags2 |= SMBFLG2_UNICODE; -+ pSMB->req_no_secext.Capabilities |= CAP_UNICODE; -+ } -+ if (ses->capabilities & CAP_STATUS32) { -+ smb_buffer->Flags2 |= SMBFLG2_ERR_STATUS; -+ pSMB->req_no_secext.Capabilities |= CAP_STATUS32; -+ } -+ if (ses->capabilities & CAP_DFS) { -+ smb_buffer->Flags2 |= SMBFLG2_DFS; -+ pSMB->req_no_secext.Capabilities |= CAP_DFS; -+ } -+ pSMB->req_no_secext.Capabilities = -+ cpu_to_le32(pSMB->req_no_secext.Capabilities); -+ /* pSMB->req_no_secext.CaseInsensitivePasswordLength = -+ CIFS_SESSION_KEY_SIZE; */ -+ pSMB->req_no_secext.CaseInsensitivePasswordLength = 0; -+ pSMB->req_no_secext.CaseSensitivePasswordLength = -+ cpu_to_le16(CIFS_SESSION_KEY_SIZE); -+ bcc_ptr = pByteArea(smb_buffer); -+ /* memcpy(bcc_ptr, (char *) lm_session_key, CIFS_SESSION_KEY_SIZE); -+ bcc_ptr += CIFS_SESSION_KEY_SIZE; */ -+ memcpy(bcc_ptr, (char *) session_key, CIFS_SESSION_KEY_SIZE); -+ bcc_ptr += CIFS_SESSION_KEY_SIZE; -+ -+ if (ses->capabilities & CAP_UNICODE) { -+ if ((long) bcc_ptr % 2) { /* must be word aligned for Unicode */ -+ *bcc_ptr = 0; -+ bcc_ptr++; -+ } -+ if(user == NULL) -+ bytes_returned = 0; /* skill null user */ -+ else -+ bytes_returned = -+ cifs_strtoUCS((wchar_t *) bcc_ptr, user, 100, -+ nls_codepage); -+ bcc_ptr += 2 * bytes_returned; /* convert num 16 bit words to bytes */ -+ bcc_ptr += 2; /* trailing null */ -+ if (domain == NULL) -+ bytes_returned = -+ cifs_strtoUCS((wchar_t *) bcc_ptr, -+ "CIFS_LINUX_DOM", 32, nls_codepage); -+ else -+ bytes_returned = -+ cifs_strtoUCS((wchar_t *) bcc_ptr, domain, 64, -+ nls_codepage); -+ bcc_ptr += 2 * bytes_returned; -+ bcc_ptr += 2; -+ bytes_returned = -+ cifs_strtoUCS((wchar_t *) bcc_ptr, "Linux version ", -+ 32, nls_codepage); -+ bcc_ptr += 2 * bytes_returned; -+ bytes_returned = -+ cifs_strtoUCS((wchar_t *) bcc_ptr, UTS_RELEASE, 32, -+ nls_codepage); -+ bcc_ptr += 2 * bytes_returned; -+ bcc_ptr += 2; -+ bytes_returned = -+ cifs_strtoUCS((wchar_t *) bcc_ptr, CIFS_NETWORK_OPSYS, -+ 64, nls_codepage); -+ bcc_ptr += 2 * bytes_returned; -+ bcc_ptr += 2; -+ } else { -+ if(user != NULL) { -+ strncpy(bcc_ptr, user, 200); -+ bcc_ptr += strnlen(user, 200); -+ } -+ *bcc_ptr = 0; -+ bcc_ptr++; -+ if (domain == NULL) { -+ strcpy(bcc_ptr, "CIFS_LINUX_DOM"); -+ bcc_ptr += strlen("CIFS_LINUX_DOM") + 1; -+ } else { -+ strncpy(bcc_ptr, domain, 64); -+ bcc_ptr += strnlen(domain, 64); -+ *bcc_ptr = 0; -+ bcc_ptr++; -+ } -+ strcpy(bcc_ptr, "Linux version "); -+ bcc_ptr += strlen("Linux version "); -+ strcpy(bcc_ptr, UTS_RELEASE); -+ bcc_ptr += strlen(UTS_RELEASE) + 1; -+ strcpy(bcc_ptr, CIFS_NETWORK_OPSYS); -+ bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1; -+ } -+ BCC(smb_buffer) = (long) bcc_ptr - (long) pByteArea(smb_buffer); -+ smb_buffer->smb_buf_length += BCC(smb_buffer); -+ BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer)); -+ -+ rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, -+ &bytes_returned, 1); -+ if (rc) { -+/* rc = map_smb_to_linux_error(smb_buffer_response); now done in SendReceive */ -+ } else if ((smb_buffer_response->WordCount == 3) -+ || (smb_buffer_response->WordCount == 4)) { -+ pSMBr->resp.Action = le16_to_cpu(pSMBr->resp.Action); -+ if (pSMBr->resp.Action & GUEST_LOGIN) -+ cFYI(1, (" Guest login")); /* do we want to mark SesInfo struct ? */ -+ if (ses) { -+ ses->Suid = smb_buffer_response->Uid; /* UID left in wire format (le) */ -+ cFYI(1, ("UID = %d ", ses->Suid)); -+ /* response can have either 3 or 4 word count - Samba sends 3 */ -+ bcc_ptr = pByteArea(smb_buffer_response); -+ if ((pSMBr->resp.hdr.WordCount == 3) -+ || ((pSMBr->resp.hdr.WordCount == 4) -+ && (pSMBr->resp.SecurityBlobLength < -+ pSMBr->resp.ByteCount))) { -+ if (pSMBr->resp.hdr.WordCount == 4) -+ bcc_ptr += -+ pSMBr->resp.SecurityBlobLength; -+ -+ if (smb_buffer->Flags2 & SMBFLG2_UNICODE) { -+ if ((long) (bcc_ptr) % 2) { -+ remaining_words = -+ (BCC(smb_buffer_response) -+ - 1) / 2; -+ bcc_ptr++; /* Unicode strings must be word aligned */ -+ } else { -+ remaining_words = -+ BCC -+ (smb_buffer_response) / 2; -+ } -+ len = -+ UniStrnlen((wchar_t *) bcc_ptr, -+ remaining_words - 1); -+/* We look for obvious messed up bcc or strings in response so we do not go off -+ the end since (at least) WIN2K and Windows XP have a major bug in not null -+ terminating last Unicode string in response */ -+ ses->serverOS = cifs_kcalloc(2 * (len + 1), GFP_KERNEL); -+ cifs_strfromUCS_le(ses->serverOS, -+ (wchar_t *)bcc_ptr, len,nls_codepage); -+ bcc_ptr += 2 * (len + 1); -+ remaining_words -= len + 1; -+ ses->serverOS[2 * len] = 0; -+ ses->serverOS[1 + (2 * len)] = 0; -+ if (remaining_words > 0) { -+ len = UniStrnlen((wchar_t *)bcc_ptr, -+ remaining_words -+ - 1); -+ ses->serverNOS =cifs_kcalloc(2 * (len + 1),GFP_KERNEL); -+ cifs_strfromUCS_le(ses->serverNOS, -+ (wchar_t *)bcc_ptr,len,nls_codepage); -+ bcc_ptr += 2 * (len + 1); -+ ses->serverNOS[2 * len] = 0; -+ ses->serverNOS[1 + (2 * len)] = 0; -+ remaining_words -= len + 1; -+ if (remaining_words > 0) { -+ len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); -+ /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ -+ ses->serverDomain = -+ cifs_kcalloc(2*(len+1),GFP_KERNEL); -+ cifs_strfromUCS_le(ses->serverDomain, -+ (wchar_t *)bcc_ptr,len,nls_codepage); -+ bcc_ptr += 2 * (len + 1); -+ ses->serverDomain[2*len] = 0; -+ ses->serverDomain[1+(2*len)] = 0; -+ } /* else no more room so create dummy domain string */ -+ else -+ ses->serverDomain = -+ cifs_kcalloc(2, -+ GFP_KERNEL); -+ } else { /* no room so create dummy domain and NOS string */ -+ ses->serverDomain = -+ cifs_kcalloc(2, GFP_KERNEL); -+ ses->serverNOS = -+ cifs_kcalloc(2, GFP_KERNEL); -+ } -+ } else { /* ASCII */ -+ len = strnlen(bcc_ptr, 1024); -+ if (((long) bcc_ptr + len) - (long) -+ pByteArea(smb_buffer_response) -+ <= BCC(smb_buffer_response)) { -+ ses->serverOS = cifs_kcalloc(len + 1,GFP_KERNEL); -+ strncpy(ses->serverOS,bcc_ptr, len); -+ -+ bcc_ptr += len; -+ bcc_ptr[0] = 0; /* null terminate the string */ -+ bcc_ptr++; -+ -+ len = strnlen(bcc_ptr, 1024); -+ ses->serverNOS = cifs_kcalloc(len + 1,GFP_KERNEL); -+ strncpy(ses->serverNOS, bcc_ptr, len); -+ bcc_ptr += len; -+ bcc_ptr[0] = 0; -+ bcc_ptr++; -+ -+ len = strnlen(bcc_ptr, 1024); -+ ses->serverDomain = cifs_kcalloc(len + 1,GFP_KERNEL); -+ strncpy(ses->serverDomain, bcc_ptr, len); -+ bcc_ptr += len; -+ bcc_ptr[0] = 0; -+ bcc_ptr++; -+ } else -+ cFYI(1, -+ ("Variable field of length %d extends beyond end of smb ", -+ len)); -+ } -+ } else { -+ cERROR(1, -+ (" Security Blob Length extends beyond end of SMB")); -+ } -+ } else { -+ cERROR(1, ("No session structure passed in.")); -+ } -+ } else { -+ cERROR(1, -+ (" Invalid Word count %d: ", -+ smb_buffer_response->WordCount)); -+ rc = -EIO; -+ } -+ -+ if (smb_buffer) -+ cifs_buf_release(smb_buffer); -+ -+ return rc; -+} -+ -+static int -+CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, -+ char *SecurityBlob,int SecurityBlobLength, -+ const struct nls_table *nls_codepage) -+{ -+ struct smb_hdr *smb_buffer; -+ struct smb_hdr *smb_buffer_response; -+ SESSION_SETUP_ANDX *pSMB; -+ SESSION_SETUP_ANDX *pSMBr; -+ char *bcc_ptr; -+ char *user = ses->userName; -+ char *domain = ses->domainName; -+ int rc = 0; -+ int remaining_words = 0; -+ int bytes_returned = 0; -+ int len; -+ -+ cFYI(1, ("In spnego sesssetup ")); -+ -+ smb_buffer = cifs_buf_get(); -+ if (smb_buffer == 0) { -+ return -ENOMEM; -+ } -+ smb_buffer_response = smb_buffer; -+ pSMBr = pSMB = (SESSION_SETUP_ANDX *) smb_buffer; -+ -+ /* send SMBsessionSetup here */ -+ header_assemble(smb_buffer, SMB_COM_SESSION_SETUP_ANDX, -+ NULL /* no tCon exists yet */ , 12 /* wct */ ); -+ pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC; -+ pSMB->req.AndXCommand = 0xFF; -+ pSMB->req.MaxBufferSize = cpu_to_le16(ses->server->maxBuf); -+ pSMB->req.MaxMpxCount = cpu_to_le16(ses->server->maxReq); -+ -+ if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) -+ smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; -+ -+ pSMB->req.Capabilities = -+ CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | -+ CAP_EXTENDED_SECURITY; -+ if (ses->capabilities & CAP_UNICODE) { -+ smb_buffer->Flags2 |= SMBFLG2_UNICODE; -+ pSMB->req.Capabilities |= CAP_UNICODE; -+ } -+ if (ses->capabilities & CAP_STATUS32) { -+ smb_buffer->Flags2 |= SMBFLG2_ERR_STATUS; -+ pSMB->req.Capabilities |= CAP_STATUS32; -+ } -+ if (ses->capabilities & CAP_DFS) { -+ smb_buffer->Flags2 |= SMBFLG2_DFS; -+ pSMB->req.Capabilities |= CAP_DFS; -+ } -+ pSMB->req.Capabilities = cpu_to_le32(pSMB->req.Capabilities); -+ -+ pSMB->req.SecurityBlobLength = cpu_to_le16(SecurityBlobLength); -+ bcc_ptr = pByteArea(smb_buffer); -+ memcpy(bcc_ptr, SecurityBlob, SecurityBlobLength); -+ bcc_ptr += SecurityBlobLength; -+ -+ if (ses->capabilities & CAP_UNICODE) { -+ if ((long) bcc_ptr % 2) { /* must be word aligned for Unicode strings */ -+ *bcc_ptr = 0; -+ bcc_ptr++; -+ } -+ bytes_returned = -+ cifs_strtoUCS((wchar_t *) bcc_ptr, user, 100, nls_codepage); -+ bcc_ptr += 2 * bytes_returned; /* convert num of 16 bit words to bytes */ -+ bcc_ptr += 2; /* trailing null */ -+ if (domain == NULL) -+ bytes_returned = -+ cifs_strtoUCS((wchar_t *) bcc_ptr, -+ "CIFS_LINUX_DOM", 32, nls_codepage); -+ else -+ bytes_returned = -+ cifs_strtoUCS((wchar_t *) bcc_ptr, domain, 64, -+ nls_codepage); -+ bcc_ptr += 2 * bytes_returned; -+ bcc_ptr += 2; -+ bytes_returned = -+ cifs_strtoUCS((wchar_t *) bcc_ptr, "Linux version ", -+ 32, nls_codepage); -+ bcc_ptr += 2 * bytes_returned; -+ bytes_returned = -+ cifs_strtoUCS((wchar_t *) bcc_ptr, UTS_RELEASE, 32, -+ nls_codepage); -+ bcc_ptr += 2 * bytes_returned; -+ bcc_ptr += 2; -+ bytes_returned = -+ cifs_strtoUCS((wchar_t *) bcc_ptr, CIFS_NETWORK_OPSYS, -+ 64, nls_codepage); -+ bcc_ptr += 2 * bytes_returned; -+ bcc_ptr += 2; -+ } else { -+ strncpy(bcc_ptr, user, 200); -+ bcc_ptr += strnlen(user, 200); -+ *bcc_ptr = 0; -+ bcc_ptr++; -+ if (domain == NULL) { -+ strcpy(bcc_ptr, "CIFS_LINUX_DOM"); -+ bcc_ptr += strlen("CIFS_LINUX_DOM") + 1; -+ } else { -+ strncpy(bcc_ptr, domain, 64); -+ bcc_ptr += strnlen(domain, 64); -+ *bcc_ptr = 0; -+ bcc_ptr++; -+ } -+ strcpy(bcc_ptr, "Linux version "); -+ bcc_ptr += strlen("Linux version "); -+ strcpy(bcc_ptr, UTS_RELEASE); -+ bcc_ptr += strlen(UTS_RELEASE) + 1; -+ strcpy(bcc_ptr, CIFS_NETWORK_OPSYS); -+ bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1; -+ } -+ BCC(smb_buffer) = (long) bcc_ptr - (long) pByteArea(smb_buffer); -+ smb_buffer->smb_buf_length += BCC(smb_buffer); -+ BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer)); -+ -+ rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, -+ &bytes_returned, 1); -+ if (rc) { -+/* rc = map_smb_to_linux_error(smb_buffer_response); *//* done in SendReceive now */ -+ } else if ((smb_buffer_response->WordCount == 3) -+ || (smb_buffer_response->WordCount == 4)) { -+ pSMBr->resp.Action = le16_to_cpu(pSMBr->resp.Action); -+ pSMBr->resp.SecurityBlobLength = -+ le16_to_cpu(pSMBr->resp.SecurityBlobLength); -+ if (pSMBr->resp.Action & GUEST_LOGIN) -+ cFYI(1, (" Guest login")); /* BB do we want to set anything in SesInfo struct ? */ -+ if (ses) { -+ ses->Suid = smb_buffer_response->Uid; /* UID left in wire format (le) */ -+ cFYI(1, ("UID = %d ", ses->Suid)); -+ bcc_ptr = pByteArea(smb_buffer_response); /* response can have either 3 or 4 word count - Samba sends 3 */ -+ -+ /* BB Fix below to make endian neutral !! */ -+ -+ if ((pSMBr->resp.hdr.WordCount == 3) -+ || ((pSMBr->resp.hdr.WordCount == 4) -+ && (pSMBr->resp.SecurityBlobLength < -+ pSMBr->resp.ByteCount))) { -+ if (pSMBr->resp.hdr.WordCount == 4) { -+ bcc_ptr += -+ pSMBr->resp.SecurityBlobLength; -+ cFYI(1, -+ ("Security Blob Length %d ", -+ pSMBr->resp.SecurityBlobLength)); -+ } -+ -+ if (smb_buffer->Flags2 & SMBFLG2_UNICODE) { -+ if ((long) (bcc_ptr) % 2) { -+ remaining_words = -+ (BCC(smb_buffer_response) -+ - 1) / 2; -+ bcc_ptr++; /* Unicode strings must be word aligned */ -+ } else { -+ remaining_words = -+ BCC -+ (smb_buffer_response) / 2; -+ } -+ len = -+ UniStrnlen((wchar_t *) bcc_ptr, -+ remaining_words - 1); -+/* We look for obvious messed up bcc or strings in response so we do not go off -+ the end since (at least) WIN2K and Windows XP have a major bug in not null -+ terminating last Unicode string in response */ -+ ses->serverOS = -+ cifs_kcalloc(2 * (len + 1), GFP_KERNEL); -+ cifs_strfromUCS_le(ses->serverOS, -+ (wchar_t *) -+ bcc_ptr, len, -+ nls_codepage); -+ bcc_ptr += 2 * (len + 1); -+ remaining_words -= len + 1; -+ ses->serverOS[2 * len] = 0; -+ ses->serverOS[1 + (2 * len)] = 0; -+ if (remaining_words > 0) { -+ len = UniStrnlen((wchar_t *)bcc_ptr, -+ remaining_words -+ - 1); -+ ses->serverNOS = -+ cifs_kcalloc(2 * (len + 1), -+ GFP_KERNEL); -+ cifs_strfromUCS_le(ses->serverNOS, -+ (wchar_t *)bcc_ptr, -+ len, -+ nls_codepage); -+ bcc_ptr += 2 * (len + 1); -+ ses->serverNOS[2 * len] = 0; -+ ses->serverNOS[1 + (2 * len)] = 0; -+ remaining_words -= len + 1; -+ if (remaining_words > 0) { -+ len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); -+ /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ -+ ses->serverDomain = cifs_kcalloc(2*(len+1),GFP_KERNEL); -+ cifs_strfromUCS_le(ses->serverDomain, -+ (wchar_t *)bcc_ptr, -+ len, -+ nls_codepage); -+ bcc_ptr += 2*(len+1); -+ ses->serverDomain[2*len] = 0; -+ ses->serverDomain[1+(2*len)] = 0; -+ } /* else no more room so create dummy domain string */ -+ else -+ ses->serverDomain = -+ cifs_kcalloc(2,GFP_KERNEL); -+ } else { /* no room so create dummy domain and NOS string */ -+ ses->serverDomain = cifs_kcalloc(2, GFP_KERNEL); -+ ses->serverNOS = cifs_kcalloc(2, GFP_KERNEL); -+ } -+ } else { /* ASCII */ -+ -+ len = strnlen(bcc_ptr, 1024); -+ if (((long) bcc_ptr + len) - (long) -+ pByteArea(smb_buffer_response) -+ <= BCC(smb_buffer_response)) { -+ ses->serverOS = cifs_kcalloc(len + 1, GFP_KERNEL); -+ strncpy(ses->serverOS, bcc_ptr, len); -+ -+ bcc_ptr += len; -+ bcc_ptr[0] = 0; /* null terminate the string */ -+ bcc_ptr++; -+ -+ len = strnlen(bcc_ptr, 1024); -+ ses->serverNOS = cifs_kcalloc(len + 1,GFP_KERNEL); -+ strncpy(ses->serverNOS, bcc_ptr, len); -+ bcc_ptr += len; -+ bcc_ptr[0] = 0; -+ bcc_ptr++; -+ -+ len = strnlen(bcc_ptr, 1024); -+ ses->serverDomain = cifs_kcalloc(len + 1, GFP_KERNEL); -+ strncpy(ses->serverDomain, bcc_ptr, len); -+ bcc_ptr += len; -+ bcc_ptr[0] = 0; -+ bcc_ptr++; -+ } else -+ cFYI(1, -+ ("Variable field of length %d extends beyond end of smb ", -+ len)); -+ } -+ } else { -+ cERROR(1, -+ (" Security Blob Length extends beyond end of SMB")); -+ } -+ } else { -+ cERROR(1, ("No session structure passed in.")); -+ } -+ } else { -+ cERROR(1, -+ (" Invalid Word count %d: ", -+ smb_buffer_response->WordCount)); -+ rc = -EIO; -+ } -+ -+ if (smb_buffer) -+ cifs_buf_release(smb_buffer); -+ -+ return rc; -+} -+ -+static int -+CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, -+ struct cifsSesInfo *ses, int * pNTLMv2_flag, -+ const struct nls_table *nls_codepage) -+{ -+ struct smb_hdr *smb_buffer; -+ struct smb_hdr *smb_buffer_response; -+ SESSION_SETUP_ANDX *pSMB; -+ SESSION_SETUP_ANDX *pSMBr; -+ char *bcc_ptr; -+ char *domain = ses->domainName; -+ int rc = 0; -+ int remaining_words = 0; -+ int bytes_returned = 0; -+ int len; -+ int SecurityBlobLength = sizeof (NEGOTIATE_MESSAGE); -+ PNEGOTIATE_MESSAGE SecurityBlob; -+ PCHALLENGE_MESSAGE SecurityBlob2; -+ -+ cFYI(1, ("In NTLMSSP sesssetup (negotiate) ")); -+ *pNTLMv2_flag = FALSE; -+ smb_buffer = cifs_buf_get(); -+ if (smb_buffer == 0) { -+ return -ENOMEM; -+ } -+ smb_buffer_response = smb_buffer; -+ pSMB = (SESSION_SETUP_ANDX *) smb_buffer; -+ pSMBr = (SESSION_SETUP_ANDX *) smb_buffer_response; -+ -+ /* send SMBsessionSetup here */ -+ header_assemble(smb_buffer, SMB_COM_SESSION_SETUP_ANDX, -+ NULL /* no tCon exists yet */ , 12 /* wct */ ); -+ pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC; -+ pSMB->req.hdr.Flags |= (SMBFLG_CASELESS | SMBFLG_CANONICAL_PATH_FORMAT); -+ -+ pSMB->req.AndXCommand = 0xFF; -+ pSMB->req.MaxBufferSize = cpu_to_le16(ses->server->maxBuf); -+ pSMB->req.MaxMpxCount = cpu_to_le16(ses->server->maxReq); -+ -+ if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) -+ smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; -+ -+ pSMB->req.Capabilities = -+ CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | -+ CAP_EXTENDED_SECURITY; -+ if (ses->capabilities & CAP_UNICODE) { -+ smb_buffer->Flags2 |= SMBFLG2_UNICODE; -+ pSMB->req.Capabilities |= CAP_UNICODE; -+ } -+ if (ses->capabilities & CAP_STATUS32) { -+ smb_buffer->Flags2 |= SMBFLG2_ERR_STATUS; -+ pSMB->req.Capabilities |= CAP_STATUS32; -+ } -+ if (ses->capabilities & CAP_DFS) { -+ smb_buffer->Flags2 |= SMBFLG2_DFS; -+ pSMB->req.Capabilities |= CAP_DFS; -+ } -+ pSMB->req.Capabilities = cpu_to_le32(pSMB->req.Capabilities); -+ -+ bcc_ptr = (char *) &pSMB->req.SecurityBlob; -+ SecurityBlob = (PNEGOTIATE_MESSAGE) bcc_ptr; -+ strncpy(SecurityBlob->Signature, NTLMSSP_SIGNATURE, 8); -+ SecurityBlob->MessageType = NtLmNegotiate; -+ SecurityBlob->NegotiateFlags = -+ NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_NEGOTIATE_OEM | -+ NTLMSSP_REQUEST_TARGET | NTLMSSP_NEGOTIATE_NTLM | 0x80000000 | -+ /* NTLMSSP_NEGOTIATE_ALWAYS_SIGN | */ NTLMSSP_NEGOTIATE_128; -+ if(sign_CIFS_PDUs) -+ SecurityBlob->NegotiateFlags |= NTLMSSP_NEGOTIATE_SIGN; -+ if(ntlmv2_support) -+ SecurityBlob->NegotiateFlags |= NTLMSSP_NEGOTIATE_NTLMV2; -+ /* setup pointers to domain name and workstation name */ -+ bcc_ptr += SecurityBlobLength; -+ -+ SecurityBlob->WorkstationName.Buffer = 0; -+ SecurityBlob->WorkstationName.Length = 0; -+ SecurityBlob->WorkstationName.MaximumLength = 0; -+ -+ if (domain == NULL) { -+ SecurityBlob->DomainName.Buffer = 0; -+ SecurityBlob->DomainName.Length = 0; -+ SecurityBlob->DomainName.MaximumLength = 0; -+ } else { -+ SecurityBlob->NegotiateFlags |= -+ NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED; -+ strncpy(bcc_ptr, domain, 63); -+ SecurityBlob->DomainName.Length = strnlen(domain, 64); -+ SecurityBlob->DomainName.MaximumLength = -+ cpu_to_le16(SecurityBlob->DomainName.Length); -+ SecurityBlob->DomainName.Buffer = -+ cpu_to_le32((long) &SecurityBlob-> -+ DomainString - -+ (long) &SecurityBlob->Signature); -+ bcc_ptr += SecurityBlob->DomainName.Length; -+ SecurityBlobLength += SecurityBlob->DomainName.Length; -+ SecurityBlob->DomainName.Length = -+ cpu_to_le16(SecurityBlob->DomainName.Length); -+ } -+ if (ses->capabilities & CAP_UNICODE) { -+ if ((long) bcc_ptr % 2) { -+ *bcc_ptr = 0; -+ bcc_ptr++; -+ } -+ -+ bytes_returned = -+ cifs_strtoUCS((wchar_t *) bcc_ptr, "Linux version ", -+ 32, nls_codepage); -+ bcc_ptr += 2 * bytes_returned; -+ bytes_returned = -+ cifs_strtoUCS((wchar_t *) bcc_ptr, UTS_RELEASE, 32, -+ nls_codepage); -+ bcc_ptr += 2 * bytes_returned; -+ bcc_ptr += 2; /* null terminate Linux version */ -+ bytes_returned = -+ cifs_strtoUCS((wchar_t *) bcc_ptr, CIFS_NETWORK_OPSYS, -+ 64, nls_codepage); -+ bcc_ptr += 2 * bytes_returned; -+ *(bcc_ptr + 1) = 0; -+ *(bcc_ptr + 2) = 0; -+ bcc_ptr += 2; /* null terminate network opsys string */ -+ *(bcc_ptr + 1) = 0; -+ *(bcc_ptr + 2) = 0; -+ bcc_ptr += 2; /* null domain */ -+ } else { /* ASCII */ -+ strcpy(bcc_ptr, "Linux version "); -+ bcc_ptr += strlen("Linux version "); -+ strcpy(bcc_ptr, UTS_RELEASE); -+ bcc_ptr += strlen(UTS_RELEASE) + 1; -+ strcpy(bcc_ptr, CIFS_NETWORK_OPSYS); -+ bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1; -+ bcc_ptr++; /* empty domain field */ -+ *bcc_ptr = 0; -+ } -+ SecurityBlob->NegotiateFlags = -+ cpu_to_le32(SecurityBlob->NegotiateFlags); -+ pSMB->req.SecurityBlobLength = cpu_to_le16(SecurityBlobLength); -+ BCC(smb_buffer) = (long) bcc_ptr - (long) pByteArea(smb_buffer); -+ smb_buffer->smb_buf_length += BCC(smb_buffer); -+ BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer)); -+ -+ rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, -+ &bytes_returned, 1); -+ -+ if (smb_buffer_response->Status.CifsError == -+ (NT_STATUS_MORE_PROCESSING_REQUIRED)) -+ rc = 0; -+ -+ if (rc) { -+/* rc = map_smb_to_linux_error(smb_buffer_response); *//* done in SendReceive now */ -+ } else if ((smb_buffer_response->WordCount == 3) -+ || (smb_buffer_response->WordCount == 4)) { -+ pSMBr->resp.Action = le16_to_cpu(pSMBr->resp.Action); -+ pSMBr->resp.SecurityBlobLength = -+ le16_to_cpu(pSMBr->resp.SecurityBlobLength); -+ if (pSMBr->resp.Action & GUEST_LOGIN) -+ cFYI(1, (" Guest login")); -+ /* Do we want to set anything in SesInfo struct when guest login? */ -+ -+ bcc_ptr = pByteArea(smb_buffer_response); -+ /* response can have either 3 or 4 word count - Samba sends 3 */ -+ -+ SecurityBlob2 = (PCHALLENGE_MESSAGE) bcc_ptr; -+ if (SecurityBlob2->MessageType != NtLmChallenge) { -+ cFYI(1, -+ ("Unexpected NTLMSSP message type received %d", -+ SecurityBlob2->MessageType)); -+ } else if (ses) { -+ ses->Suid = smb_buffer_response->Uid; /* UID left in le format */ -+ cFYI(1, ("UID = %d ", ses->Suid)); -+ if ((pSMBr->resp.hdr.WordCount == 3) -+ || ((pSMBr->resp.hdr.WordCount == 4) -+ && (pSMBr->resp.SecurityBlobLength < -+ pSMBr->resp.ByteCount))) { -+ if (pSMBr->resp.hdr.WordCount == 4) { -+ bcc_ptr += -+ pSMBr->resp.SecurityBlobLength; -+ cFYI(1, -+ ("Security Blob Length %d ", -+ pSMBr->resp.SecurityBlobLength)); -+ } -+ -+ cFYI(1, ("NTLMSSP Challenge rcvd ")); -+ -+ memcpy(ses->server->cryptKey, -+ SecurityBlob2->Challenge, -+ CIFS_CRYPTO_KEY_SIZE); -+ if(SecurityBlob2->NegotiateFlags & NTLMSSP_NEGOTIATE_NTLMV2) -+ *pNTLMv2_flag = TRUE; -+ -+ if((SecurityBlob2->NegotiateFlags & -+ NTLMSSP_NEGOTIATE_ALWAYS_SIGN) -+ || (sign_CIFS_PDUs > 1)) -+ ses->server->secMode |= -+ SECMODE_SIGN_REQUIRED; -+ if ((SecurityBlob2->NegotiateFlags & -+ NTLMSSP_NEGOTIATE_SIGN) && (sign_CIFS_PDUs)) -+ ses->server->secMode |= -+ SECMODE_SIGN_ENABLED; -+ -+ if (smb_buffer->Flags2 & SMBFLG2_UNICODE) { -+ if ((long) (bcc_ptr) % 2) { -+ remaining_words = -+ (BCC(smb_buffer_response) -+ - 1) / 2; -+ bcc_ptr++; /* Unicode strings must be word aligned */ -+ } else { -+ remaining_words = -+ BCC -+ (smb_buffer_response) / 2; -+ } -+ len = -+ UniStrnlen((wchar_t *) bcc_ptr, -+ remaining_words - 1); -+/* We look for obvious messed up bcc or strings in response so we do not go off -+ the end since (at least) WIN2K and Windows XP have a major bug in not null -+ terminating last Unicode string in response */ -+ ses->serverOS = -+ cifs_kcalloc(2 * (len + 1), GFP_KERNEL); -+ cifs_strfromUCS_le(ses->serverOS, -+ (wchar_t *) -+ bcc_ptr, len, -+ nls_codepage); -+ bcc_ptr += 2 * (len + 1); -+ remaining_words -= len + 1; -+ ses->serverOS[2 * len] = 0; -+ ses->serverOS[1 + (2 * len)] = 0; -+ if (remaining_words > 0) { -+ len = UniStrnlen((wchar_t *) -+ bcc_ptr, -+ remaining_words -+ - 1); -+ ses->serverNOS = -+ cifs_kcalloc(2 * (len + 1), -+ GFP_KERNEL); -+ cifs_strfromUCS_le(ses-> -+ serverNOS, -+ (wchar_t *) -+ bcc_ptr, -+ len, -+ nls_codepage); -+ bcc_ptr += 2 * (len + 1); -+ ses->serverNOS[2 * len] = 0; -+ ses->serverNOS[1 + -+ (2 * len)] = 0; -+ remaining_words -= len + 1; -+ if (remaining_words > 0) { -+ len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); -+ /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ -+ ses->serverDomain = -+ cifs_kcalloc(2 * -+ (len + -+ 1), -+ GFP_KERNEL); -+ cifs_strfromUCS_le -+ (ses-> -+ serverDomain, -+ (wchar_t *) -+ bcc_ptr, len, -+ nls_codepage); -+ bcc_ptr += -+ 2 * (len + 1); -+ ses-> -+ serverDomain[2 -+ * len] -+ = 0; -+ ses-> -+ serverDomain[1 -+ + -+ (2 -+ * -+ len)] -+ = 0; -+ } /* else no more room so create dummy domain string */ -+ else -+ ses->serverDomain = -+ cifs_kcalloc(2, -+ GFP_KERNEL); -+ } else { /* no room so create dummy domain and NOS string */ -+ ses->serverDomain = -+ cifs_kcalloc(2, GFP_KERNEL); -+ ses->serverNOS = -+ cifs_kcalloc(2, GFP_KERNEL); -+ } -+ } else { /* ASCII */ -+ len = strnlen(bcc_ptr, 1024); -+ if (((long) bcc_ptr + len) - (long) -+ pByteArea(smb_buffer_response) -+ <= BCC(smb_buffer_response)) { -+ ses->serverOS = -+ cifs_kcalloc(len + 1, -+ GFP_KERNEL); -+ strncpy(ses->serverOS, -+ bcc_ptr, len); -+ -+ bcc_ptr += len; -+ bcc_ptr[0] = 0; /* null terminate string */ -+ bcc_ptr++; -+ -+ len = strnlen(bcc_ptr, 1024); -+ ses->serverNOS = -+ cifs_kcalloc(len + 1, -+ GFP_KERNEL); -+ strncpy(ses->serverNOS, bcc_ptr, len); -+ bcc_ptr += len; -+ bcc_ptr[0] = 0; -+ bcc_ptr++; -+ -+ len = strnlen(bcc_ptr, 1024); -+ ses->serverDomain = -+ cifs_kcalloc(len + 1, -+ GFP_KERNEL); -+ strncpy(ses->serverDomain, bcc_ptr, len); -+ bcc_ptr += len; -+ bcc_ptr[0] = 0; -+ bcc_ptr++; -+ } else -+ cFYI(1, -+ ("Variable field of length %d extends beyond end of smb ", -+ len)); -+ } -+ } else { -+ cERROR(1, -+ (" Security Blob Length extends beyond end of SMB")); -+ } -+ } else { -+ cERROR(1, ("No session structure passed in.")); -+ } -+ } else { -+ cERROR(1, -+ (" Invalid Word count %d: ", -+ smb_buffer_response->WordCount)); -+ rc = -EIO; -+ } -+ -+ if (smb_buffer) -+ cifs_buf_release(smb_buffer); -+ -+ return rc; -+} -+ -+static int -+CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, -+ char *ntlm_session_key, int ntlmv2_flag, -+ const struct nls_table *nls_codepage) -+{ -+ struct smb_hdr *smb_buffer; -+ struct smb_hdr *smb_buffer_response; -+ SESSION_SETUP_ANDX *pSMB; -+ SESSION_SETUP_ANDX *pSMBr; -+ char *bcc_ptr; -+ char *user = ses->userName; -+ char *domain = ses->domainName; -+ int rc = 0; -+ int remaining_words = 0; -+ int bytes_returned = 0; -+ int len; -+ int SecurityBlobLength = sizeof (AUTHENTICATE_MESSAGE); -+ PAUTHENTICATE_MESSAGE SecurityBlob; -+ -+ cFYI(1, ("In NTLMSSPSessSetup (Authenticate)")); -+ -+ smb_buffer = cifs_buf_get(); -+ if (smb_buffer == 0) { -+ return -ENOMEM; -+ } -+ smb_buffer_response = smb_buffer; -+ pSMB = (SESSION_SETUP_ANDX *) smb_buffer; -+ pSMBr = (SESSION_SETUP_ANDX *) smb_buffer_response; -+ -+ /* send SMBsessionSetup here */ -+ header_assemble(smb_buffer, SMB_COM_SESSION_SETUP_ANDX, -+ NULL /* no tCon exists yet */ , 12 /* wct */ ); -+ pSMB->req.hdr.Flags |= (SMBFLG_CASELESS | SMBFLG_CANONICAL_PATH_FORMAT); -+ pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC; -+ pSMB->req.AndXCommand = 0xFF; -+ pSMB->req.MaxBufferSize = cpu_to_le16(ses->server->maxBuf); -+ pSMB->req.MaxMpxCount = cpu_to_le16(ses->server->maxReq); -+ -+ pSMB->req.hdr.Uid = ses->Suid; -+ -+ if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) -+ smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; -+ -+ pSMB->req.Capabilities = -+ CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | -+ CAP_EXTENDED_SECURITY; -+ if (ses->capabilities & CAP_UNICODE) { -+ smb_buffer->Flags2 |= SMBFLG2_UNICODE; -+ pSMB->req.Capabilities |= CAP_UNICODE; -+ } -+ if (ses->capabilities & CAP_STATUS32) { -+ smb_buffer->Flags2 |= SMBFLG2_ERR_STATUS; -+ pSMB->req.Capabilities |= CAP_STATUS32; -+ } -+ if (ses->capabilities & CAP_DFS) { -+ smb_buffer->Flags2 |= SMBFLG2_DFS; -+ pSMB->req.Capabilities |= CAP_DFS; -+ } -+ pSMB->req.Capabilities = cpu_to_le32(pSMB->req.Capabilities); -+ -+ bcc_ptr = (char *) &pSMB->req.SecurityBlob; -+ SecurityBlob = (PAUTHENTICATE_MESSAGE) bcc_ptr; -+ strncpy(SecurityBlob->Signature, NTLMSSP_SIGNATURE, 8); -+ SecurityBlob->MessageType = NtLmAuthenticate; -+ bcc_ptr += SecurityBlobLength; -+ SecurityBlob->NegotiateFlags = -+ NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_REQUEST_TARGET | -+ NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_TARGET_INFO | -+ 0x80000000 | NTLMSSP_NEGOTIATE_128; -+ if(sign_CIFS_PDUs) -+ SecurityBlob->NegotiateFlags |= /* NTLMSSP_NEGOTIATE_ALWAYS_SIGN |*/ NTLMSSP_NEGOTIATE_SIGN; -+ if(ntlmv2_flag) -+ SecurityBlob->NegotiateFlags |= NTLMSSP_NEGOTIATE_NTLMV2; -+ -+/* setup pointers to domain name and workstation name */ -+ -+ SecurityBlob->WorkstationName.Buffer = 0; -+ SecurityBlob->WorkstationName.Length = 0; -+ SecurityBlob->WorkstationName.MaximumLength = 0; -+ SecurityBlob->SessionKey.Length = 0; -+ SecurityBlob->SessionKey.MaximumLength = 0; -+ SecurityBlob->SessionKey.Buffer = 0; -+ -+ SecurityBlob->LmChallengeResponse.Length = 0; -+ SecurityBlob->LmChallengeResponse.MaximumLength = 0; -+ SecurityBlob->LmChallengeResponse.Buffer = 0; -+ -+ SecurityBlob->NtChallengeResponse.Length = -+ cpu_to_le16(CIFS_SESSION_KEY_SIZE); -+ SecurityBlob->NtChallengeResponse.MaximumLength = -+ cpu_to_le16(CIFS_SESSION_KEY_SIZE); -+ memcpy(bcc_ptr, ntlm_session_key, CIFS_SESSION_KEY_SIZE); -+ SecurityBlob->NtChallengeResponse.Buffer = -+ cpu_to_le32(SecurityBlobLength); -+ SecurityBlobLength += CIFS_SESSION_KEY_SIZE; -+ bcc_ptr += CIFS_SESSION_KEY_SIZE; -+ -+ if (ses->capabilities & CAP_UNICODE) { -+ if (domain == NULL) { -+ SecurityBlob->DomainName.Buffer = 0; -+ SecurityBlob->DomainName.Length = 0; -+ SecurityBlob->DomainName.MaximumLength = 0; -+ } else { -+ SecurityBlob->DomainName.Length = -+ cifs_strtoUCS((wchar_t *) bcc_ptr, domain, 64, -+ nls_codepage); -+ SecurityBlob->DomainName.Length *= 2; -+ SecurityBlob->DomainName.MaximumLength = -+ cpu_to_le16(SecurityBlob->DomainName.Length); -+ SecurityBlob->DomainName.Buffer = -+ cpu_to_le32(SecurityBlobLength); -+ bcc_ptr += SecurityBlob->DomainName.Length; -+ SecurityBlobLength += SecurityBlob->DomainName.Length; -+ SecurityBlob->DomainName.Length = -+ cpu_to_le16(SecurityBlob->DomainName.Length); -+ } -+ if (user == NULL) { -+ SecurityBlob->UserName.Buffer = 0; -+ SecurityBlob->UserName.Length = 0; -+ SecurityBlob->UserName.MaximumLength = 0; -+ } else { -+ SecurityBlob->UserName.Length = -+ cifs_strtoUCS((wchar_t *) bcc_ptr, user, 64, -+ nls_codepage); -+ SecurityBlob->UserName.Length *= 2; -+ SecurityBlob->UserName.MaximumLength = -+ cpu_to_le16(SecurityBlob->UserName.Length); -+ SecurityBlob->UserName.Buffer = -+ cpu_to_le32(SecurityBlobLength); -+ bcc_ptr += SecurityBlob->UserName.Length; -+ SecurityBlobLength += SecurityBlob->UserName.Length; -+ SecurityBlob->UserName.Length = -+ cpu_to_le16(SecurityBlob->UserName.Length); -+ } -+ -+ /* SecurityBlob->WorkstationName.Length = cifs_strtoUCS((wchar_t *) bcc_ptr, "AMACHINE",64, nls_codepage); -+ SecurityBlob->WorkstationName.Length *= 2; -+ SecurityBlob->WorkstationName.MaximumLength = cpu_to_le16(SecurityBlob->WorkstationName.Length); -+ SecurityBlob->WorkstationName.Buffer = cpu_to_le32(SecurityBlobLength); -+ bcc_ptr += SecurityBlob->WorkstationName.Length; -+ SecurityBlobLength += SecurityBlob->WorkstationName.Length; -+ SecurityBlob->WorkstationName.Length = cpu_to_le16(SecurityBlob->WorkstationName.Length); */ -+ -+ if ((long) bcc_ptr % 2) { -+ *bcc_ptr = 0; -+ bcc_ptr++; -+ } -+ bytes_returned = -+ cifs_strtoUCS((wchar_t *) bcc_ptr, "Linux version ", -+ 32, nls_codepage); -+ bcc_ptr += 2 * bytes_returned; -+ bytes_returned = -+ cifs_strtoUCS((wchar_t *) bcc_ptr, UTS_RELEASE, 32, -+ nls_codepage); -+ bcc_ptr += 2 * bytes_returned; -+ bcc_ptr += 2; /* null term version string */ -+ bytes_returned = -+ cifs_strtoUCS((wchar_t *) bcc_ptr, CIFS_NETWORK_OPSYS, -+ 64, nls_codepage); -+ bcc_ptr += 2 * bytes_returned; -+ *(bcc_ptr + 1) = 0; -+ *(bcc_ptr + 2) = 0; -+ bcc_ptr += 2; /* null terminate network opsys string */ -+ *(bcc_ptr + 1) = 0; -+ *(bcc_ptr + 2) = 0; -+ bcc_ptr += 2; /* null domain */ -+ } else { /* ASCII */ -+ if (domain == NULL) { -+ SecurityBlob->DomainName.Buffer = 0; -+ SecurityBlob->DomainName.Length = 0; -+ SecurityBlob->DomainName.MaximumLength = 0; -+ } else { -+ SecurityBlob->NegotiateFlags |= -+ NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED; -+ strncpy(bcc_ptr, domain, 63); -+ SecurityBlob->DomainName.Length = strnlen(domain, 64); -+ SecurityBlob->DomainName.MaximumLength = -+ cpu_to_le16(SecurityBlob->DomainName.Length); -+ SecurityBlob->DomainName.Buffer = -+ cpu_to_le32(SecurityBlobLength); -+ bcc_ptr += SecurityBlob->DomainName.Length; -+ SecurityBlobLength += SecurityBlob->DomainName.Length; -+ SecurityBlob->DomainName.Length = -+ cpu_to_le16(SecurityBlob->DomainName.Length); -+ } -+ if (user == NULL) { -+ SecurityBlob->UserName.Buffer = 0; -+ SecurityBlob->UserName.Length = 0; -+ SecurityBlob->UserName.MaximumLength = 0; -+ } else { -+ strncpy(bcc_ptr, user, 63); -+ SecurityBlob->UserName.Length = strnlen(user, 64); -+ SecurityBlob->UserName.MaximumLength = -+ cpu_to_le16(SecurityBlob->UserName.Length); -+ SecurityBlob->UserName.Buffer = -+ cpu_to_le32(SecurityBlobLength); -+ bcc_ptr += SecurityBlob->UserName.Length; -+ SecurityBlobLength += SecurityBlob->UserName.Length; -+ SecurityBlob->UserName.Length = -+ cpu_to_le16(SecurityBlob->UserName.Length); -+ } -+ /* BB fill in our workstation name if known BB */ -+ -+ strcpy(bcc_ptr, "Linux version "); -+ bcc_ptr += strlen("Linux version "); -+ strcpy(bcc_ptr, UTS_RELEASE); -+ bcc_ptr += strlen(UTS_RELEASE) + 1; -+ strcpy(bcc_ptr, CIFS_NETWORK_OPSYS); -+ bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1; -+ bcc_ptr++; /* null domain */ -+ *bcc_ptr = 0; -+ } -+ SecurityBlob->NegotiateFlags = -+ cpu_to_le32(SecurityBlob->NegotiateFlags); -+ pSMB->req.SecurityBlobLength = cpu_to_le16(SecurityBlobLength); -+ BCC(smb_buffer) = (long) bcc_ptr - (long) pByteArea(smb_buffer); -+ smb_buffer->smb_buf_length += BCC(smb_buffer); -+ BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer)); -+ -+ rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, -+ &bytes_returned, 1); -+ if (rc) { -+/* rc = map_smb_to_linux_error(smb_buffer_response); *//* done in SendReceive now */ -+ } else if ((smb_buffer_response->WordCount == 3) -+ || (smb_buffer_response->WordCount == 4)) { -+ pSMBr->resp.Action = le16_to_cpu(pSMBr->resp.Action); -+ pSMBr->resp.SecurityBlobLength = -+ le16_to_cpu(pSMBr->resp.SecurityBlobLength); -+ if (pSMBr->resp.Action & GUEST_LOGIN) -+ cFYI(1, (" Guest login")); /* BB do we want to set anything in SesInfo struct ? */ -+/* if(SecurityBlob2->MessageType != NtLm??){ -+ cFYI("Unexpected message type on auth response is %d ")); -+ } */ -+ if (ses) { -+ cFYI(1, -+ ("Does UID on challenge %d match auth response UID %d ", -+ ses->Suid, smb_buffer_response->Uid)); -+ ses->Suid = smb_buffer_response->Uid; /* UID left in wire format */ -+ bcc_ptr = pByteArea(smb_buffer_response); -+ /* response can have either 3 or 4 word count - Samba sends 3 */ -+ if ((pSMBr->resp.hdr.WordCount == 3) -+ || ((pSMBr->resp.hdr.WordCount == 4) -+ && (pSMBr->resp.SecurityBlobLength < -+ pSMBr->resp.ByteCount))) { -+ if (pSMBr->resp.hdr.WordCount == 4) { -+ bcc_ptr += -+ pSMBr->resp.SecurityBlobLength; -+ cFYI(1, -+ ("Security Blob Length %d ", -+ pSMBr->resp.SecurityBlobLength)); -+ } -+ -+ cFYI(1, -+ ("NTLMSSP response to Authenticate ")); -+ -+ if (smb_buffer->Flags2 & SMBFLG2_UNICODE) { -+ if ((long) (bcc_ptr) % 2) { -+ remaining_words = -+ (BCC(smb_buffer_response) -+ - 1) / 2; -+ bcc_ptr++; /* Unicode strings must be word aligned */ -+ } else { -+ remaining_words = BCC(smb_buffer_response) / 2; -+ } -+ len = -+ UniStrnlen((wchar_t *) bcc_ptr,remaining_words - 1); -+/* We look for obvious messed up bcc or strings in response so we do not go off -+ the end since (at least) WIN2K and Windows XP have a major bug in not null -+ terminating last Unicode string in response */ -+ ses->serverOS = -+ cifs_kcalloc(2 * (len + 1), GFP_KERNEL); -+ cifs_strfromUCS_le(ses->serverOS, -+ (wchar_t *) -+ bcc_ptr, len, -+ nls_codepage); -+ bcc_ptr += 2 * (len + 1); -+ remaining_words -= len + 1; -+ ses->serverOS[2 * len] = 0; -+ ses->serverOS[1 + (2 * len)] = 0; -+ if (remaining_words > 0) { -+ len = UniStrnlen((wchar_t *) -+ bcc_ptr, -+ remaining_words -+ - 1); -+ ses->serverNOS = -+ cifs_kcalloc(2 * (len + 1), -+ GFP_KERNEL); -+ cifs_strfromUCS_le(ses-> -+ serverNOS, -+ (wchar_t *) -+ bcc_ptr, -+ len, -+ nls_codepage); -+ bcc_ptr += 2 * (len + 1); -+ ses->serverNOS[2 * len] = 0; -+ ses->serverNOS[1+(2*len)] = 0; -+ remaining_words -= len + 1; -+ if (remaining_words > 0) { -+ len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); -+ /* last string not always null terminated (e.g. for Windows XP & 2000) */ -+ ses->serverDomain = -+ cifs_kcalloc(2 * -+ (len + -+ 1), -+ GFP_KERNEL); -+ cifs_strfromUCS_le -+ (ses-> -+ serverDomain, -+ (wchar_t *) -+ bcc_ptr, len, -+ nls_codepage); -+ bcc_ptr += -+ 2 * (len + 1); -+ ses-> -+ serverDomain[2 -+ * len] -+ = 0; -+ ses-> -+ serverDomain[1 -+ + -+ (2 -+ * -+ len)] -+ = 0; -+ } /* else no more room so create dummy domain string */ -+ else -+ ses->serverDomain = cifs_kcalloc(2,GFP_KERNEL); -+ } else { /* no room so create dummy domain and NOS string */ -+ ses->serverDomain = cifs_kcalloc(2, GFP_KERNEL); -+ ses->serverNOS = cifs_kcalloc(2, GFP_KERNEL); -+ } -+ } else { /* ASCII */ -+ len = strnlen(bcc_ptr, 1024); -+ if (((long) bcc_ptr + len) - -+ (long) pByteArea(smb_buffer_response) -+ <= BCC(smb_buffer_response)) { -+ ses->serverOS = cifs_kcalloc(len + 1,GFP_KERNEL); -+ strncpy(ses->serverOS,bcc_ptr, len); -+ -+ bcc_ptr += len; -+ bcc_ptr[0] = 0; /* null terminate the string */ -+ bcc_ptr++; -+ -+ len = strnlen(bcc_ptr, 1024); -+ ses->serverNOS = cifs_kcalloc(len+1,GFP_KERNEL); -+ strncpy(ses->serverNOS, bcc_ptr, len); -+ bcc_ptr += len; -+ bcc_ptr[0] = 0; -+ bcc_ptr++; -+ -+ len = strnlen(bcc_ptr, 1024); -+ ses->serverDomain = cifs_kcalloc(len+1,GFP_KERNEL); -+ strncpy(ses->serverDomain, bcc_ptr, len); -+ bcc_ptr += len; -+ bcc_ptr[0] = 0; -+ bcc_ptr++; -+ } else -+ cFYI(1, -+ ("Variable field of length %d extends beyond end of smb ", -+ len)); -+ } -+ } else { -+ cERROR(1, -+ (" Security Blob Length extends beyond end of SMB")); -+ } -+ } else { -+ cERROR(1, ("No session structure passed in.")); -+ } -+ } else { -+ cERROR(1, -+ (" Invalid Word count %d: ", -+ smb_buffer_response->WordCount)); -+ rc = -EIO; -+ } -+ -+ if (smb_buffer) -+ cifs_buf_release(smb_buffer); -+ -+ return rc; -+} -+ -+int -+CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, -+ const char *tree, struct cifsTconInfo *tcon, -+ const struct nls_table *nls_codepage) -+{ -+ struct smb_hdr *smb_buffer; -+ struct smb_hdr *smb_buffer_response; -+ TCONX_REQ *pSMB; -+ TCONX_RSP *pSMBr; -+ char *bcc_ptr; -+ int rc = 0; -+ int length; -+ -+ if (ses == NULL) -+ return -EIO; -+ -+ smb_buffer = cifs_buf_get(); -+ if (smb_buffer == 0) { -+ return -ENOMEM; -+ } -+ smb_buffer_response = smb_buffer; -+ -+ header_assemble(smb_buffer, SMB_COM_TREE_CONNECT_ANDX, -+ NULL /*no tid */ , 4 /*wct */ ); -+ smb_buffer->Uid = ses->Suid; -+ pSMB = (TCONX_REQ *) smb_buffer; -+ pSMBr = (TCONX_RSP *) smb_buffer_response; -+ -+ pSMB->AndXCommand = 0xFF; -+ pSMB->Flags = cpu_to_le16(TCON_EXTENDED_SECINFO); -+ pSMB->PasswordLength = cpu_to_le16(1); /* minimum */ -+ bcc_ptr = &(pSMB->Password[0]); -+ bcc_ptr++; /* skip password */ -+ -+ if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) -+ smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; -+ -+ if (ses->capabilities & CAP_STATUS32) { -+ smb_buffer->Flags2 |= SMBFLG2_ERR_STATUS; -+ } -+ if (ses->capabilities & CAP_DFS) { -+ smb_buffer->Flags2 |= SMBFLG2_DFS; -+ } -+ if (ses->capabilities & CAP_UNICODE) { -+ smb_buffer->Flags2 |= SMBFLG2_UNICODE; -+ length = -+ cifs_strtoUCS((wchar_t *) bcc_ptr, tree, 100, nls_codepage); -+ bcc_ptr += 2 * length; /* convert num of 16 bit words to bytes */ -+ bcc_ptr += 2; /* skip trailing null */ -+ } else { /* ASCII */ -+ -+ strcpy(bcc_ptr, tree); -+ bcc_ptr += strlen(tree) + 1; -+ } -+ strcpy(bcc_ptr, "?????"); -+ bcc_ptr += strlen("?????"); -+ bcc_ptr += 1; -+ BCC(smb_buffer) = (long) bcc_ptr - (long) pByteArea(smb_buffer); -+ smb_buffer->smb_buf_length += BCC(smb_buffer); -+ BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer)); -+ -+ rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &length, 0); -+ -+ /* if (rc) rc = map_smb_to_linux_error(smb_buffer_response); */ -+ /* above now done in SendReceive */ -+ if ((rc == 0) && (tcon != NULL)) { -+ tcon->tidStatus = CifsGood; -+ tcon->tid = smb_buffer_response->Tid; -+ bcc_ptr = pByteArea(smb_buffer_response); -+ length = strnlen(bcc_ptr, BCC(smb_buffer_response) - 2); -+ /* skip service field (NB: this field is always ASCII) */ -+ bcc_ptr += length + 1; -+ strncpy(tcon->treeName, tree, MAX_TREE_SIZE); -+ if (smb_buffer->Flags2 & SMBFLG2_UNICODE) { -+ length = UniStrnlen((wchar_t *) bcc_ptr, 512); -+ if (((long) bcc_ptr + (2 * length)) - -+ (long) pByteArea(smb_buffer_response) <= -+ BCC(smb_buffer_response)) { -+ if(tcon->nativeFileSystem) -+ kfree(tcon->nativeFileSystem); -+ tcon->nativeFileSystem = -+ cifs_kcalloc(length + 2, GFP_KERNEL); -+ cifs_strfromUCS_le(tcon->nativeFileSystem, -+ (wchar_t *) bcc_ptr, -+ length, nls_codepage); -+ bcc_ptr += 2 * length; -+ bcc_ptr[0] = 0; /* null terminate the string */ -+ bcc_ptr[1] = 0; -+ bcc_ptr += 2; -+ } -+ /* else do not bother copying these informational fields */ -+ } else { -+ length = strnlen(bcc_ptr, 1024); -+ if (((long) bcc_ptr + length) - -+ (long) pByteArea(smb_buffer_response) <= -+ BCC(smb_buffer_response)) { -+ if(tcon->nativeFileSystem) -+ kfree(tcon->nativeFileSystem); -+ tcon->nativeFileSystem = -+ cifs_kcalloc(length + 1, GFP_KERNEL); -+ strncpy(tcon->nativeFileSystem, bcc_ptr, -+ length); -+ } -+ /* else do not bother copying these informational fields */ -+ } -+ tcon->Flags = le16_to_cpu(pSMBr->OptionalSupport); -+ cFYI(1, ("Tcon flags: 0x%x ", tcon->Flags)); -+ } else if ((rc == 0) && tcon == NULL) { -+ /* all we need to save for IPC$ connection */ -+ ses->ipc_tid = smb_buffer_response->Tid; -+ } -+ -+ if (smb_buffer) -+ cifs_buf_release(smb_buffer); -+ return rc; -+} -+ -+int -+cifs_umount(struct super_block *sb, struct cifs_sb_info *cifs_sb) -+{ -+ int rc = 0; -+ int xid; -+ struct cifsSesInfo *ses = NULL; -+ struct task_struct *cifsd_task; -+ -+ xid = GetXid(); -+ -+ if (cifs_sb->tcon) { -+ ses = cifs_sb->tcon->ses; /* save ptr to ses before delete tcon!*/ -+ rc = CIFSSMBTDis(xid, cifs_sb->tcon); -+ if (rc == -EBUSY) { -+ FreeXid(xid); -+ return 0; -+ } -+ tconInfoFree(cifs_sb->tcon); -+ if ((ses) && (ses->server)) { -+ /* save off task so we do not refer to ses later */ -+ cifsd_task = ses->server->tsk; -+ cFYI(1, ("About to do SMBLogoff ")); -+ rc = CIFSSMBLogoff(xid, ses); -+ if (rc == -EBUSY) { -+ FreeXid(xid); -+ return 0; -+ } else if (rc == -ESHUTDOWN) { -+ cFYI(1,("Waking up socket by sending it signal")); -+ send_sig(SIGKILL,cifsd_task,1); -+ rc = 0; -+ } /* else - we have an smb session -+ left on this socket do not kill cifsd */ -+ } else -+ cFYI(1, ("No session or bad tcon")); -+ } -+ -+ cifs_sb->tcon = NULL; -+ if (ses) { -+ set_current_state(TASK_INTERRUPTIBLE); -+ schedule_timeout(HZ / 2); -+ } -+ if (ses) -+ sesInfoFree(ses); -+ -+ FreeXid(xid); -+ return rc; /* BB check if we should always return zero here */ -+} -+ -+int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo, -+ struct nls_table * nls_info) -+{ -+ int rc = 0; -+ char ntlm_session_key[CIFS_SESSION_KEY_SIZE]; -+ int ntlmv2_flag = FALSE; -+ -+ /* what if server changes its buffer size after dropping the session? */ -+ if(pSesInfo->server->maxBuf == 0) /* no need to send on reconnect */ { -+ rc = CIFSSMBNegotiate(xid, pSesInfo); -+ if(rc == -EAGAIN) /* retry only once on 1st time connection */ { -+ rc = CIFSSMBNegotiate(xid, pSesInfo); -+ if(rc == -EAGAIN) -+ rc = -EHOSTDOWN; -+ } -+ if(rc == 0) { -+ spin_lock(&GlobalMid_Lock); -+ if(pSesInfo->server->tcpStatus != CifsExiting) -+ pSesInfo->server->tcpStatus = CifsGood; -+ else -+ rc = -EHOSTDOWN; -+ spin_unlock(&GlobalMid_Lock); -+ -+ } -+ } -+ if (!rc) { -+ pSesInfo->capabilities = pSesInfo->server->capabilities; -+ if(linuxExtEnabled == 0) -+ pSesInfo->capabilities &= (~CAP_UNIX); -+ pSesInfo->sequence_number = 0; -+ cFYI(1,("Security Mode: 0x%x Capabilities: 0x%x Time Zone: %d", -+ pSesInfo->server->secMode, -+ pSesInfo->server->capabilities, -+ pSesInfo->server->timeZone)); -+ if (extended_security -+ && (pSesInfo->capabilities & CAP_EXTENDED_SECURITY) -+ && (pSesInfo->server->secType == NTLMSSP)) { -+ cFYI(1, ("New style sesssetup ")); -+ rc = CIFSSpnegoSessSetup(xid, pSesInfo, -+ NULL /* security blob */, -+ 0 /* blob length */, -+ nls_info); -+ } else if (extended_security -+ && (pSesInfo->capabilities & CAP_EXTENDED_SECURITY) -+ && (pSesInfo->server->secType == RawNTLMSSP)) { -+ cFYI(1, ("NTLMSSP sesssetup ")); -+ rc = CIFSNTLMSSPNegotiateSessSetup(xid, -+ pSesInfo, -+ &ntlmv2_flag, -+ nls_info); -+ if (!rc) { -+ if(ntlmv2_flag) { -+ char * v2_response; -+ cFYI(1,("Can use more secure NTLM version 2 password hash")); -+ CalcNTLMv2_partial_mac_key(pSesInfo, -+ nls_info); -+ v2_response = kmalloc(16 + 64 /* blob */, GFP_KERNEL); -+ if(v2_response) { -+ CalcNTLMv2_response(pSesInfo,v2_response); -+/* cifs_calculate_ntlmv2_mac_key(pSesInfo->mac_signing_key, response, ntlm_session_key, */ -+ kfree(v2_response); -+ /* BB Put dummy sig in SessSetup PDU? */ -+ } else -+ rc = -ENOMEM; -+ -+ } else { -+ SMBNTencrypt(pSesInfo->password, -+ pSesInfo->server->cryptKey, -+ ntlm_session_key); -+ -+ cifs_calculate_mac_key(pSesInfo->mac_signing_key, -+ ntlm_session_key, -+ pSesInfo->password); -+ } -+ /* for better security the weaker lanman hash not sent -+ in AuthSessSetup so we no longer calculate it */ -+ -+ rc = CIFSNTLMSSPAuthSessSetup(xid, -+ pSesInfo, -+ ntlm_session_key, -+ ntlmv2_flag, -+ nls_info); -+ } -+ } else { /* old style NTLM 0.12 session setup */ -+ SMBNTencrypt(pSesInfo->password, -+ pSesInfo->server->cryptKey, -+ ntlm_session_key); -+ -+ cifs_calculate_mac_key(pSesInfo->mac_signing_key, -+ ntlm_session_key, pSesInfo->password); -+ rc = CIFSSessSetup(xid, pSesInfo, -+ ntlm_session_key, nls_info); -+ } -+ if (rc) { -+ cERROR(1,("Send error in SessSetup = %d",rc)); -+ } else { -+ cFYI(1,("CIFS Session Established successfully")); -+ pSesInfo->status = CifsGood; -+ } -+ } -+ return rc; -+} -+ -diff -urN linux-2.4.29.old/fs/cifs/dir.c linux-2.4.29/fs/cifs/dir.c ---- linux-2.4.29.old/fs/cifs/dir.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/dir.c 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,425 @@ -+/* -+ * fs/cifs/dir.c -+ * -+ * vfs operations that deal with dentries -+ * -+ * Copyright (C) International Business Machines Corp., 2002,2003 -+ * Author(s): Steve French (sfrench@us.ibm.com) -+ * -+ * This library is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This library 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 Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+#include -+#include -+#include -+#include "cifsfs.h" -+#include "cifspdu.h" -+#include "cifsglob.h" -+#include "cifsproto.h" -+#include "cifs_debug.h" -+#include "cifs_fs_sb.h" -+ -+void -+renew_parental_timestamps(struct dentry *direntry) -+{ -+ /* BB check if there is a way to get the kernel to do this or if we really need this */ -+ do { -+ direntry->d_time = jiffies; -+ direntry = direntry->d_parent; -+ } while (!IS_ROOT(direntry)); -+} -+ -+/* Note: caller must free return buffer */ -+char * -+build_path_from_dentry(struct dentry *direntry) -+{ -+ struct dentry *temp; -+ int namelen = 0; -+ char *full_path; -+ -+ if(direntry == NULL) -+ return NULL; /* not much we can do if dentry is freed and -+ we need to reopen the file after it was closed implicitly -+ when the server crashed */ -+ -+cifs_bp_rename_retry: -+ for (temp = direntry; !IS_ROOT(temp);) { -+ namelen += (1 + temp->d_name.len); -+ temp = temp->d_parent; -+ if(temp == NULL) { -+ cERROR(1,("corrupt dentry")); -+ return NULL; -+ } -+ } -+ -+ full_path = kmalloc(namelen+1, GFP_KERNEL); -+ if(full_path == NULL) -+ return full_path; -+ full_path[namelen] = 0; /* trailing null */ -+ -+ for (temp = direntry; !IS_ROOT(temp);) { -+ namelen -= 1 + temp->d_name.len; -+ if (namelen < 0) { -+ break; -+ } else { -+ full_path[namelen] = '\\'; -+ strncpy(full_path + namelen + 1, temp->d_name.name, -+ temp->d_name.len); -+ cFYI(0, (" name: %s ", full_path + namelen)); -+ } -+ temp = temp->d_parent; -+ if(temp == NULL) { -+ cERROR(1,("corrupt dentry")); -+ kfree(full_path); -+ return NULL; -+ } -+ } -+ if (namelen != 0) { -+ cERROR(1, -+ ("We did not end path lookup where we expected namelen is %d", -+ namelen)); -+ /* presumably this is only possible if we were racing with a rename -+ of one of the parent directories (we can not lock the dentries -+ above us to prevent this, but retrying should be harmless) */ -+ kfree(full_path); -+ namelen = 0; -+ goto cifs_bp_rename_retry; -+ } -+ -+ return full_path; -+} -+ -+/* Note: caller must free return buffer */ -+char * -+build_wildcard_path_from_dentry(struct dentry *direntry) -+{ -+ struct dentry *temp; -+ int namelen = 0; -+ char *full_path; -+ -+ if(direntry == NULL) -+ return NULL; /* not much we can do if dentry is freed and -+ we need to reopen the file after it was closed implicitly -+ when the server crashed */ -+ -+cifs_bwp_rename_retry: -+ for (temp = direntry; !IS_ROOT(temp);) { -+ namelen += (1 + temp->d_name.len); -+ temp = temp->d_parent; -+ if(temp == NULL) { -+ cERROR(1,("corrupt dentry")); -+ return NULL; -+ } -+ } -+ -+ full_path = kmalloc(namelen+3, GFP_KERNEL); -+ if(full_path == NULL) -+ return full_path; -+ -+ full_path[namelen] = '\\'; -+ full_path[namelen+1] = '*'; -+ full_path[namelen+2] = 0; /* trailing null */ -+ -+ for (temp = direntry; !IS_ROOT(temp);) { -+ namelen -= 1 + temp->d_name.len; -+ if (namelen < 0) { -+ break; -+ } else { -+ full_path[namelen] = '\\'; -+ strncpy(full_path + namelen + 1, temp->d_name.name, -+ temp->d_name.len); -+ cFYI(0, (" name: %s ", full_path + namelen)); -+ } -+ temp = temp->d_parent; -+ if(temp == NULL) { -+ cERROR(1,("corrupt dentry")); -+ kfree(full_path); -+ return NULL; -+ } -+ } -+ if (namelen != 0) { -+ cERROR(1, -+ ("We did not end path lookup where we expected namelen is %d", -+ namelen)); -+ /* presumably this is only possible if we were racing with a rename -+ of one of the parent directories (we can not lock the dentries -+ above us to prevent this, but retrying should be harmless) */ -+ kfree(full_path); -+ namelen = 0; -+ goto cifs_bwp_rename_retry; -+ } -+ -+ return full_path; -+} -+ -+/* Inode operations in similar order to how they appear in the Linux file fs.h */ -+ -+int -+cifs_create(struct inode *inode, struct dentry *direntry, int mode) -+{ -+ int rc = -ENOENT; -+ int xid; -+ int oplock = 0; /* no sense requested oplock if we are just going to -+ immediately close the file */ -+ __u16 fileHandle; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ char *full_path = NULL; -+ FILE_ALL_INFO * buf = NULL; -+ struct inode *newinode = NULL; -+ -+ xid = GetXid(); -+ -+ cifs_sb = CIFS_SB(inode->i_sb); -+ pTcon = cifs_sb->tcon; -+ -+ down(&direntry->d_sb->s_vfs_rename_sem); -+ full_path = build_path_from_dentry(direntry); -+ up(&direntry->d_sb->s_vfs_rename_sem); -+ if(full_path == NULL) { -+ FreeXid(xid); -+ return -ENOMEM; -+ } -+ -+ /* BB add processing to set equivalent of mode - e.g. via CreateX with ACLs */ -+ -+ buf = kmalloc(sizeof(FILE_ALL_INFO),GFP_KERNEL); -+ rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OVERWRITE_IF, -+ GENERIC_WRITE, CREATE_NOT_DIR, -+ &fileHandle, &oplock, buf, cifs_sb->local_nls); -+ if (rc) { -+ cFYI(1, ("cifs_create returned 0x%x ", rc)); -+ } else { -+ /* BB for case of overwriting existing file can we use the inode that was -+ passed in rather than creating new one?? */ -+ if (pTcon->ses->capabilities & CAP_UNIX) -+ rc = cifs_get_inode_info_unix(&newinode, full_path, -+ inode->i_sb,xid); -+ else -+ rc = cifs_get_inode_info(&newinode, full_path, -+ buf, inode->i_sb,xid); -+ -+ if (rc != 0) { -+ cFYI(1,("Create worked but get_inode_info failed with rc = %d", -+ rc)); -+ } else { -+ direntry->d_op = &cifs_dentry_ops; -+ d_instantiate(direntry, newinode); -+ } -+ CIFSSMBClose(xid, pTcon, fileHandle); -+ -+ if(newinode) { -+ newinode->i_mode = mode; -+ if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) -+ CIFSSMBUnixSetPerms(xid, pTcon, full_path, inode->i_mode, -+ (__u64)-1, -+ (__u64)-1, -+ 0 /* dev */, -+ cifs_sb->local_nls); -+ else { /* BB implement via Windows security descriptors */ -+ /* eg CIFSSMBWinSetPerms(xid,pTcon,full_path,mode,-1,-1,local_nls);*/ -+ /* in the meantime could set r/o dos attribute when perms are eg: -+ mode & 0222 == 0 */ -+ } -+ } -+ } -+ -+ if (buf) -+ kfree(buf); -+ if (full_path) -+ kfree(full_path); -+ FreeXid(xid); -+ -+ return rc; -+} -+ -+int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, int device_number) -+{ -+ int rc = -EPERM; -+ int xid; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ char *full_path = NULL; -+ struct inode * newinode = NULL; -+ -+ xid = GetXid(); -+ -+ cifs_sb = CIFS_SB(inode->i_sb); -+ pTcon = cifs_sb->tcon; -+ -+ down(&direntry->d_sb->s_vfs_rename_sem); -+ full_path = build_path_from_dentry(direntry); -+ up(&direntry->d_sb->s_vfs_rename_sem); -+ if(full_path == NULL) -+ rc = -ENOMEM; -+ -+ if (full_path && (pTcon->ses->capabilities & CAP_UNIX)) { -+ rc = CIFSSMBUnixSetPerms(xid, pTcon, -+ full_path, mode, current->euid, current->egid, -+ device_number, cifs_sb->local_nls); -+ if(!rc) { -+ rc = cifs_get_inode_info_unix(&newinode, full_path, -+ inode->i_sb,xid); -+ direntry->d_op = &cifs_dentry_ops; -+ if(rc == 0) -+ d_instantiate(direntry, newinode); -+ } -+ } -+ -+ if (full_path) -+ kfree(full_path); -+ FreeXid(xid); -+ -+ return rc; -+} -+ -+ -+struct dentry * -+cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry) -+{ -+ int xid; -+ int rc = 0; /* to get around spurious gcc warning, set to zero here */ -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ struct inode *newInode = NULL; -+ char *full_path = NULL; -+ -+ xid = GetXid(); -+ -+ cFYI(1, -+ (" parent inode = 0x%p name is: %s and dentry = 0x%p", -+ parent_dir_inode, direntry->d_name.name, direntry)); -+ -+ /* BB Add check of incoming data - e.g. frame not longer than maximum SMB - let server check the namelen BB */ -+ -+ /* check whether path exists */ -+ -+ cifs_sb = CIFS_SB(parent_dir_inode->i_sb); -+ pTcon = cifs_sb->tcon; -+ -+ /* can not grab the rename sem here since it would -+ deadlock in the cases (beginning of sys_rename itself) -+ in which we already have the sb rename sem */ -+ full_path = build_path_from_dentry(direntry); -+ if(full_path == NULL) { -+ FreeXid(xid); -+ return ERR_PTR(-ENOMEM); -+ } -+ -+ if (direntry->d_inode != NULL) { -+ cFYI(1, (" non-NULL inode in lookup")); -+ } else { -+ cFYI(1, (" NULL inode in lookup")); -+ } -+ cFYI(1, -+ (" Full path: %s inode = 0x%p", full_path, direntry->d_inode)); -+ -+ if (pTcon->ses->capabilities & CAP_UNIX) -+ rc = cifs_get_inode_info_unix(&newInode, full_path, -+ parent_dir_inode->i_sb,xid); -+ else -+ rc = cifs_get_inode_info(&newInode, full_path, NULL, -+ parent_dir_inode->i_sb,xid); -+ -+ if ((rc == 0) && (newInode != NULL)) { -+ direntry->d_op = &cifs_dentry_ops; -+ d_add(direntry, newInode); -+ -+ /* since paths are not looked up by component - the parent directories are presumed to be good here */ -+ renew_parental_timestamps(direntry); -+ -+ } else if (rc == -ENOENT) { -+ rc = 0; -+ d_add(direntry, NULL); -+ } else { -+ cERROR(1,("Error 0x%x or on cifs_get_inode_info in lookup",rc)); -+ /* BB special case check for Access Denied - watch security -+ exposure of returning dir info implicitly via different rc -+ if file exists or not but no access BB */ -+ } -+ -+ if (full_path) -+ kfree(full_path); -+ FreeXid(xid); -+ return ERR_PTR(rc); -+} -+ -+int -+cifs_dir_open(struct inode *inode, struct file *file) -+{ /* NB: currently unused since searches are opened in readdir */ -+ int rc = 0; -+ int xid; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ char *full_path = NULL; -+ -+ xid = GetXid(); -+ -+ cifs_sb = CIFS_SB(inode->i_sb); -+ pTcon = cifs_sb->tcon; -+ -+ if(file->f_dentry) { -+ down(&file->f_dentry->d_sb->s_vfs_rename_sem); -+ full_path = build_wildcard_path_from_dentry(file->f_dentry); -+ up(&file->f_dentry->d_sb->s_vfs_rename_sem); -+ } else { -+ FreeXid(xid); -+ return -EIO; -+ } -+ -+ cFYI(1, ("inode = 0x%p and full path is %s", inode, full_path)); -+ -+ if (full_path) -+ kfree(full_path); -+ FreeXid(xid); -+ return rc; -+} -+ -+static int -+cifs_d_revalidate(struct dentry *direntry, int flags) -+{ -+ int isValid = 1; -+ -+/* lock_kernel(); *//* surely we do not want to lock the kernel for a whole network round trip which could take seconds */ -+ -+ if (direntry->d_inode) { -+ if (cifs_revalidate(direntry)) { -+ /* unlock_kernel(); */ -+ return 0; -+ } -+ } else { -+ cFYI(1, -+ ("In cifs_d_revalidate with no inode but name = %s and dentry 0x%p", -+ direntry->d_name.name, direntry)); -+ } -+ -+/* unlock_kernel(); */ -+ -+ return isValid; -+} -+ -+/* static int cifs_d_delete(struct dentry *direntry) -+{ -+ int rc = 0; -+ -+ cFYI(1, ("In cifs d_delete, name = %s", direntry->d_name.name)); -+ -+ return rc; -+} */ -+ -+struct dentry_operations cifs_dentry_ops = { -+ .d_revalidate = cifs_d_revalidate, -+/* d_delete: cifs_d_delete, *//* not needed except for debugging */ -+ /* no need for d_hash, d_compare, d_release, d_iput ... yet. BB confirm this BB */ -+}; -diff -urN linux-2.4.29.old/fs/cifs/file.c linux-2.4.29/fs/cifs/file.c ---- linux-2.4.29.old/fs/cifs/file.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/file.c 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,2185 @@ -+/* -+ * fs/cifs/file.c -+ * -+ * vfs operations that deal with files -+ * -+ * Copyright (C) International Business Machines Corp., 2002,2003 -+ * Author(s): Steve French (sfrench@us.ibm.com) -+ * -+ * This library is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This library 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 Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * along with this library; 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 "cifsfs.h" -+#include "cifspdu.h" -+#include "cifsglob.h" -+#include "cifsproto.h" -+#include "cifs_unicode.h" -+#include "cifs_debug.h" -+#include "cifs_fs_sb.h" -+ -+int -+cifs_open(struct inode *inode, struct file *file) -+{ -+ int rc = -EACCES; -+ int xid, oplock; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ struct cifsFileInfo *pCifsFile; -+ struct cifsInodeInfo *pCifsInode; -+ char *full_path = NULL; -+ int desiredAccess = 0x20197; -+ int disposition; -+ __u16 netfid; -+ FILE_ALL_INFO * buf = NULL; -+ time_t temp; -+ -+ xid = GetXid(); -+ -+ cifs_sb = CIFS_SB(inode->i_sb); -+ pTcon = cifs_sb->tcon; -+ -+ down(&inode->i_sb->s_vfs_rename_sem); -+ full_path = build_path_from_dentry(file->f_dentry); -+ up(&inode->i_sb->s_vfs_rename_sem); -+ if(full_path == NULL) { -+ FreeXid(xid); -+ return -ENOMEM; -+ } -+ -+ cFYI(1, (" inode = 0x%p file flags are 0x%x for %s", inode, file->f_flags,full_path)); -+ if ((file->f_flags & O_ACCMODE) == O_RDONLY) -+ desiredAccess = GENERIC_READ; -+ else if ((file->f_flags & O_ACCMODE) == O_WRONLY) -+ desiredAccess = GENERIC_WRITE; -+ else if ((file->f_flags & O_ACCMODE) == O_RDWR) { -+ /* GENERIC_ALL is too much permission to request */ -+ /* can cause unnecessary access denied on create */ -+ /* desiredAccess = GENERIC_ALL; */ -+ desiredAccess = GENERIC_READ | GENERIC_WRITE; -+ } -+ -+/********************************************************************* -+ * open flag mapping table: -+ * -+ * POSIX Flag CIFS Disposition -+ * ---------- ---------------- -+ * O_CREAT FILE_OPEN_IF -+ * O_CREAT | O_EXCL FILE_CREATE -+ * O_CREAT | O_TRUNC FILE_OVERWRITE_IF -+ * O_TRUNC FILE_OVERWRITE -+ * none of the above FILE_OPEN -+ * -+ * Note that there is not a direct match between disposition -+ * FILE_SUPERSEDE (ie create whether or not file exists although -+ * O_CREAT | O_TRUNC is similar but truncates the existing -+ * file rather than creating a new file as FILE_SUPERSEDE does -+ * (which uses the attributes / metadata passed in on open call) -+ *? -+ *? O_SYNC is a reasonable match to CIFS writethrough flag -+ *? and the read write flags match reasonably. O_LARGEFILE -+ *? is irrelevant because largefile support is always used -+ *? by this client. Flags O_APPEND, O_DIRECT, O_DIRECTORY, -+ * O_FASYNC, O_NOFOLLOW, O_NONBLOCK need further investigation -+ *********************************************************************/ -+ -+ /* For 2.4 case, file was already checked for existence -+ before create by vfs lookup and created in create -+ entry point, we are now just opening the newly -+ created file with the right desiredAccess flags */ -+ -+ if((file->f_flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) -+ disposition = FILE_OPEN_IF; -+ else if((file->f_flags & (O_CREAT | O_TRUNC)) == (O_CREAT | O_TRUNC)) -+ disposition = FILE_OVERWRITE_IF; -+ else if((file->f_flags & O_CREAT) == O_CREAT) -+ disposition = FILE_OPEN_IF; -+ else -+ disposition = FILE_OPEN; -+ -+ if (oplockEnabled) -+ oplock = REQ_OPLOCK; -+ else -+ oplock = FALSE; -+ -+ /* BB pass O_SYNC flag through on file attributes .. BB */ -+ -+ /* Also refresh inode by passing in file_info buf returned by SMBOpen -+ and calling get_inode_info with returned buf (at least -+ helps non-Unix server case */ -+ -+ /* BB we can not do this if this is the second open of a file -+ and the first handle has writebehind data, we might be -+ able to simply do a filemap_fdatawrite/filemap_fdatawait first */ -+ buf = kmalloc(sizeof(FILE_ALL_INFO),GFP_KERNEL); -+ if(buf==0) { -+ if (full_path) -+ kfree(full_path); -+ FreeXid(xid); -+ return -ENOMEM; -+ } -+ rc = CIFSSMBOpen(xid, pTcon, full_path, disposition, desiredAccess, -+ CREATE_NOT_DIR, &netfid, &oplock, buf, cifs_sb->local_nls); -+ if (rc) { -+ cFYI(1, ("cifs_open returned 0x%x ", rc)); -+ cFYI(1, ("oplock: %d ", oplock)); -+ } else { -+ file->private_data = -+ kmalloc(sizeof (struct cifsFileInfo), GFP_KERNEL); -+ if (file->private_data) { -+ memset(file->private_data, 0, sizeof(struct cifsFileInfo)); -+ pCifsFile = (struct cifsFileInfo *) file->private_data; -+ pCifsFile->netfid = netfid; -+ pCifsFile->pid = current->pid; -+ init_MUTEX(&pCifsFile->fh_sem); -+ pCifsFile->pfile = file; /* needed for writepage */ -+ pCifsFile->pInode = inode; -+ pCifsFile->invalidHandle = FALSE; -+ pCifsFile->closePend = FALSE; -+ write_lock(&GlobalSMBSeslock); -+ spin_lock(&files_lock); -+ list_add(&pCifsFile->tlist,&pTcon->openFileList); -+ pCifsInode = CIFS_I(file->f_dentry->d_inode); -+ if(pCifsInode) { -+ /* want handles we can use to read with first */ -+ /* in the list so we do not have to walk the */ -+ /* list to search for one in prepare_write */ -+ if ((file->f_flags & O_ACCMODE) == O_WRONLY) { -+ list_add_tail(&pCifsFile->flist,&pCifsInode->openFileList); -+ } else { -+ list_add(&pCifsFile->flist,&pCifsInode->openFileList); -+ } -+ spin_unlock(&files_lock); -+ write_unlock(&GlobalSMBSeslock); -+ if(pCifsInode->clientCanCacheRead) { -+ /* we have the inode open somewhere else -+ no need to discard cache data */ -+ } else { -+ if(buf) { -+ /* BB need same check in cifs_create too? */ -+ -+ /* if not oplocked, invalidate inode pages if mtime -+ or file size changed */ -+ temp = cifs_NTtimeToUnix(le64_to_cpu(buf->LastWriteTime)); -+ if((file->f_dentry->d_inode->i_mtime == temp) && -+ (file->f_dentry->d_inode->i_size == (loff_t)le64_to_cpu(buf->EndOfFile))) { -+ cFYI(1,("inode unchanged on server")); -+ } else { -+ if(file->f_dentry->d_inode->i_mapping) { -+ /* BB no need to lock inode until after invalidate*/ -+ /* since namei code should already have it locked?*/ -+ filemap_fdatasync(file->f_dentry->d_inode->i_mapping); -+ } -+ cFYI(1,("invalidating remote inode since open detected it changed")); -+ invalidate_inode_pages(file->f_dentry->d_inode); -+ } -+ } -+ } -+ if (pTcon->ses->capabilities & CAP_UNIX) -+ rc = cifs_get_inode_info_unix(&file->f_dentry->d_inode, -+ full_path, inode->i_sb,xid); -+ else -+ rc = cifs_get_inode_info(&file->f_dentry->d_inode, -+ full_path, buf, inode->i_sb,xid); -+ -+ if((oplock & 0xF) == OPLOCK_EXCLUSIVE) { -+ pCifsInode->clientCanCacheAll = TRUE; -+ pCifsInode->clientCanCacheRead = TRUE; -+ cFYI(1,("Exclusive Oplock granted on inode %p",file->f_dentry->d_inode)); -+ } else if((oplock & 0xF) == OPLOCK_READ) -+ pCifsInode->clientCanCacheRead = TRUE; -+ } else { -+ spin_unlock(&files_lock); -+ write_unlock(&GlobalSMBSeslock); -+ } -+ if(oplock & CIFS_CREATE_ACTION) { -+ /* time to set mode which we can not set earlier due -+ to problems creating new read-only files */ -+ if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) -+ CIFSSMBUnixSetPerms(xid, pTcon, full_path, inode->i_mode, -+ (__u64)-1, -+ (__u64)-1, -+ 0 /* dev */, -+ cifs_sb->local_nls); -+ else {/* BB implement via Windows security descriptors */ -+ /* eg CIFSSMBWinSetPerms(xid,pTcon,full_path,mode,-1,-1,local_nls);*/ -+ /* in the meantime could set r/o dos attribute when perms are eg: -+ mode & 0222 == 0 */ -+ } -+ } -+ } -+ } -+ -+ if (buf) -+ kfree(buf); -+ if (full_path) -+ kfree(full_path); -+ FreeXid(xid); -+ return rc; -+} -+ -+/* Try to reaquire byte range locks that were released when session */ -+/* to server was lost */ -+static int cifs_relock_file(struct cifsFileInfo * cifsFile) -+{ -+ int rc = 0; -+ -+/* BB list all locks open on this file and relock */ -+ -+ return rc; -+} -+ -+static int cifs_reopen_file(struct inode *inode, struct file *file, int can_flush) -+{ -+ int rc = -EACCES; -+ int xid, oplock; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ struct cifsFileInfo *pCifsFile; -+ struct cifsInodeInfo *pCifsInode; -+ char *full_path = NULL; -+ int desiredAccess = 0x20197; -+ int disposition = FILE_OPEN; -+ __u16 netfid; -+ -+ if(inode == NULL) -+ return -EBADF; -+ if (file->private_data) { -+ pCifsFile = (struct cifsFileInfo *) file->private_data; -+ } else -+ return -EBADF; -+ -+ xid = GetXid(); -+ down(&pCifsFile->fh_sem); -+ if(pCifsFile->invalidHandle == FALSE) { -+ up(&pCifsFile->fh_sem); -+ FreeXid(xid); -+ return 0; -+ } -+ -+ if(file->f_dentry == NULL) { -+ up(&pCifsFile->fh_sem); -+ cFYI(1,("failed file reopen, no valid name if dentry freed")); -+ FreeXid(xid); -+ return -EBADF; -+ } -+ cifs_sb = CIFS_SB(inode->i_sb); -+ pTcon = cifs_sb->tcon; -+/* can not grab rename sem here because various ops, including -+those that already have the rename sem can end up causing writepage -+to get called and if the server was down that means we end up here, -+and we can never tell if the caller already has the rename_sem */ -+ full_path = build_path_from_dentry(file->f_dentry); -+ if(full_path == NULL) { -+ up(&pCifsFile->fh_sem); -+ FreeXid(xid); -+ return -ENOMEM; -+ } -+ -+ cFYI(1, (" inode = 0x%p file flags are 0x%x for %s", inode, file->f_flags,full_path)); -+ if ((file->f_flags & O_ACCMODE) == O_RDONLY) -+ desiredAccess = GENERIC_READ; -+ else if ((file->f_flags & O_ACCMODE) == O_WRONLY) -+ desiredAccess = GENERIC_WRITE; -+ else if ((file->f_flags & O_ACCMODE) == O_RDWR) { -+ /* GENERIC_ALL is too much permission to request */ -+ /* can cause unnecessary access denied on create */ -+ /* desiredAccess = GENERIC_ALL; */ -+ desiredAccess = GENERIC_READ | GENERIC_WRITE; -+ } -+ -+ if (oplockEnabled) -+ oplock = REQ_OPLOCK; -+ else -+ oplock = FALSE; -+ -+ -+ /* Can not refresh inode by passing in file_info buf to be returned -+ by SMBOpen and then calling get_inode_info with returned buf -+ since file might have write behind data that needs to be flushed -+ and server version of file size can be stale. If we -+ knew for sure that inode was not dirty locally we could do this */ -+ -+/* buf = kmalloc(sizeof(FILE_ALL_INFO),GFP_KERNEL); -+ if(buf==0) { -+ up(&pCifsFile->fh_sem); -+ if (full_path) -+ kfree(full_path); -+ FreeXid(xid); -+ return -ENOMEM; -+ }*/ -+ rc = CIFSSMBOpen(xid, pTcon, full_path, disposition, desiredAccess, -+ CREATE_NOT_DIR, &netfid, &oplock, NULL, cifs_sb->local_nls); -+ if (rc) { -+ up(&pCifsFile->fh_sem); -+ cFYI(1, ("cifs_open returned 0x%x ", rc)); -+ cFYI(1, ("oplock: %d ", oplock)); -+ } else { -+ pCifsFile->netfid = netfid; -+ pCifsFile->invalidHandle = FALSE; -+ up(&pCifsFile->fh_sem); -+ pCifsInode = CIFS_I(inode); -+ if(pCifsInode) { -+ if(can_flush) { -+ filemap_fdatasync(inode->i_mapping); -+ filemap_fdatawait(inode->i_mapping); -+ /* temporarily disable caching while we -+ go to server to get inode info */ -+ pCifsInode->clientCanCacheAll = FALSE; -+ pCifsInode->clientCanCacheRead = FALSE; -+ if (pTcon->ses->capabilities & CAP_UNIX) -+ rc = cifs_get_inode_info_unix(&inode, -+ full_path, inode->i_sb,xid); -+ else -+ rc = cifs_get_inode_info(&inode, -+ full_path, NULL, inode->i_sb,xid); -+ } /* else we are writing out data to server already -+ and could deadlock if we tried to flush data, and -+ since we do not know if we have data that would -+ invalidate the current end of file on the server -+ we can not go to the server to get the new -+ inod info */ -+ if((oplock & 0xF) == OPLOCK_EXCLUSIVE) { -+ pCifsInode->clientCanCacheAll = TRUE; -+ pCifsInode->clientCanCacheRead = TRUE; -+ cFYI(1,("Exclusive Oplock granted on inode %p",file->f_dentry->d_inode)); -+ } else if((oplock & 0xF) == OPLOCK_READ) { -+ pCifsInode->clientCanCacheRead = TRUE; -+ pCifsInode->clientCanCacheAll = FALSE; -+ } else { -+ pCifsInode->clientCanCacheRead = FALSE; -+ pCifsInode->clientCanCacheAll = FALSE; -+ } -+ cifs_relock_file(pCifsFile); -+ } -+ } -+ -+ if (full_path) -+ kfree(full_path); -+ FreeXid(xid); -+ return rc; -+} -+ -+int -+cifs_close(struct inode *inode, struct file *file) -+{ -+ int rc = 0; -+ int xid; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ struct cifsFileInfo *pSMBFile = -+ (struct cifsFileInfo *) file->private_data; -+ -+ xid = GetXid(); -+ -+ cifs_sb = CIFS_SB(inode->i_sb); -+ pTcon = cifs_sb->tcon; -+ if (pSMBFile) { -+ pSMBFile->closePend = TRUE; -+ spin_lock(&files_lock); -+ if(pTcon) { -+ /* no sense reconnecting to close a file that is -+ already closed */ -+ if (pTcon->tidStatus != CifsNeedReconnect) { -+ spin_unlock(&files_lock); -+ rc = CIFSSMBClose(xid,pTcon,pSMBFile->netfid); -+ spin_lock(&files_lock); -+ } -+ } -+ list_del(&pSMBFile->flist); -+ list_del(&pSMBFile->tlist); -+ spin_unlock(&files_lock); -+ if(pSMBFile->search_resume_name) -+ kfree(pSMBFile->search_resume_name); -+ kfree(file->private_data); -+ file->private_data = NULL; -+ } else -+ rc = -EBADF; -+ -+ if(list_empty(&(CIFS_I(inode)->openFileList))) { -+ cFYI(1,("closing last open instance for inode %p",inode)); -+ /* if the file is not open we do not know if we can cache -+ info on this inode, much less write behind and read ahead */ -+ CIFS_I(inode)->clientCanCacheRead = FALSE; -+ CIFS_I(inode)->clientCanCacheAll = FALSE; -+ } -+ if((rc ==0) && CIFS_I(inode)->write_behind_rc) -+ rc = CIFS_I(inode)->write_behind_rc; -+ FreeXid(xid); -+ return rc; -+} -+ -+int -+cifs_closedir(struct inode *inode, struct file *file) -+{ -+ int rc = 0; -+ int xid; -+ struct cifsFileInfo *pSMBFileStruct = -+ (struct cifsFileInfo *) file->private_data; -+ -+ cFYI(1, ("Closedir inode = 0x%p with ", inode)); -+ -+ xid = GetXid(); -+ -+ if (pSMBFileStruct) { -+ cFYI(1, ("Freeing private data in close dir")); -+ kfree(file->private_data); -+ file->private_data = NULL; -+ } -+ FreeXid(xid); -+ return rc; -+} -+ -+int -+cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) -+{ -+ int rc, xid; -+ __u32 lockType = LOCKING_ANDX_LARGE_FILES; -+ __u32 numLock = 0; -+ __u32 numUnlock = 0; -+ __u64 length; -+ int wait_flag = FALSE; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ length = 1 + pfLock->fl_end - pfLock->fl_start; -+ -+ rc = -EACCES; -+ -+ xid = GetXid(); -+ -+ cFYI(1, -+ ("Lock parm: 0x%x flockflags: 0x%x flocktype: 0x%x start: %lld end: %lld", -+ cmd, pfLock->fl_flags, pfLock->fl_type, pfLock->fl_start, -+ pfLock->fl_end)); -+ -+ if (pfLock->fl_flags & FL_POSIX) -+ cFYI(1, ("Posix ")); -+ if (pfLock->fl_flags & FL_FLOCK) -+ cFYI(1, ("Flock ")); -+/* if (pfLock->fl_flags & FL_SLEEP) { -+ cFYI(1, ("Blocking lock ")); -+ wait_flag = TRUE; -+ } */ -+ if (pfLock->fl_flags & FL_ACCESS) -+ cFYI(1, ("Process suspended by mandatory locking - not implemented yet ")); -+ if (pfLock->fl_flags & FL_LEASE) -+ cFYI(1, ("Lease on file - not implemented yet")); -+ if (pfLock->fl_flags & (~(FL_POSIX | FL_FLOCK | FL_ACCESS | FL_LEASE))) -+ cFYI(1, ("Unknown lock flags 0x%x",pfLock->fl_flags)); -+ -+ if (pfLock->fl_type == F_WRLCK) { -+ cFYI(1, ("F_WRLCK ")); -+ numLock = 1; -+ } else if (pfLock->fl_type == F_UNLCK) { -+ cFYI(1, ("F_UNLCK ")); -+ numUnlock = 1; -+ } else if (pfLock->fl_type == F_RDLCK) { -+ cFYI(1, ("F_RDLCK ")); -+ lockType |= LOCKING_ANDX_SHARED_LOCK; -+ numLock = 1; -+ } else if (pfLock->fl_type == F_EXLCK) { -+ cFYI(1, ("F_EXLCK ")); -+ numLock = 1; -+ } else if (pfLock->fl_type == F_SHLCK) { -+ cFYI(1, ("F_SHLCK ")); -+ lockType |= LOCKING_ANDX_SHARED_LOCK; -+ numLock = 1; -+ } else -+ cFYI(1, ("Unknown type of lock ")); -+ -+ cifs_sb = CIFS_SB(file->f_dentry->d_sb); -+ pTcon = cifs_sb->tcon; -+ -+ if (file->private_data == NULL) { -+ FreeXid(xid); -+ return -EBADF; -+ } -+ -+ if (IS_GETLK(cmd)) { -+ rc = CIFSSMBLock(xid, pTcon, -+ ((struct cifsFileInfo *) file-> -+ private_data)->netfid, -+ length, -+ pfLock->fl_start, 0, 1, lockType, -+ 0 /* wait flag */ ); -+ if (rc == 0) { -+ rc = CIFSSMBLock(xid, pTcon, -+ ((struct cifsFileInfo *) file-> -+ private_data)->netfid, -+ length, -+ pfLock->fl_start, 1 /* numUnlock */ , -+ 0 /* numLock */ , lockType, -+ 0 /* wait flag */ ); -+ pfLock->fl_type = F_UNLCK; -+ if (rc != 0) -+ cERROR(1, -+ ("Error unlocking previously locked range %d during test of lock ", -+ rc)); -+ rc = 0; -+ -+ } else { -+ /* if rc == ERR_SHARING_VIOLATION ? */ -+ rc = 0; /* do not change lock type to unlock since range in use */ -+ } -+ -+ FreeXid(xid); -+ return rc; -+ } -+ -+ rc = CIFSSMBLock(xid, pTcon, -+ ((struct cifsFileInfo *) file->private_data)-> -+ netfid, length, -+ pfLock->fl_start, numUnlock, numLock, lockType, -+ wait_flag); -+ FreeXid(xid); -+ return rc; -+} -+ -+ssize_t -+cifs_write(struct file * file, const char *write_data, -+ size_t write_size, loff_t * poffset) -+{ -+ int rc = 0; -+ unsigned int bytes_written = 0; -+ unsigned int total_written; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ int xid, long_op; -+ struct cifsFileInfo * open_file; -+ -+ if(file->f_dentry == NULL) -+ return -EBADF; -+ -+ cifs_sb = CIFS_SB(file->f_dentry->d_sb); -+ if(cifs_sb == NULL) { -+ return -EBADF; -+ } -+ pTcon = cifs_sb->tcon; -+ -+ /*cFYI(1, -+ (" write %d bytes to offset %lld of %s", write_size, -+ *poffset, file->f_dentry->d_name.name)); */ -+ -+ if (file->private_data == NULL) { -+ return -EBADF; -+ } else { -+ open_file = (struct cifsFileInfo *) file->private_data; -+ } -+ -+ xid = GetXid(); -+ if(file->f_dentry->d_inode == NULL) { -+ FreeXid(xid); -+ return -EBADF; -+ } -+ -+ if (*poffset > file->f_dentry->d_inode->i_size) -+ long_op = 2; /* writes past end of file can take a long time */ -+ else -+ long_op = 1; -+ -+ for (total_written = 0; write_size > total_written; -+ total_written += bytes_written) { -+ rc = -EAGAIN; -+ while(rc == -EAGAIN) { -+ if(file->private_data == NULL) { -+ /* file has been closed on us */ -+ FreeXid(xid); -+ /* if we have gotten here we have written some data -+ and blocked, and the file has been freed on us -+ while we blocked so return what we managed to write */ -+ return total_written; -+ } -+ if(open_file->closePend) { -+ FreeXid(xid); -+ if(total_written) -+ return total_written; -+ else -+ return -EBADF; -+ } -+ if (open_file->invalidHandle) { -+ if((file->f_dentry == NULL) || -+ (file->f_dentry->d_inode == NULL)) { -+ FreeXid(xid); -+ return total_written; -+ } -+ /* we could deadlock if we called -+ filemap_fdatawait from here so tell -+ reopen_file not to flush data to server now */ -+ rc = cifs_reopen_file(file->f_dentry->d_inode, -+ file,FALSE); -+ if(rc != 0) -+ break; -+ } -+ -+ rc = CIFSSMBWrite(xid, pTcon, -+ open_file->netfid, -+ write_size - total_written, *poffset, -+ &bytes_written, -+ write_data + total_written, long_op); -+ } -+ if (rc || (bytes_written == 0)) { -+ if (total_written) -+ break; -+ else { -+ FreeXid(xid); -+ return rc; -+ } -+ } else -+ *poffset += bytes_written; -+ long_op = FALSE; /* subsequent writes fast - 15 seconds is plenty */ -+ } -+ -+#ifdef CONFIG_CIFS_STATS -+ if(total_written > 0) { -+ atomic_inc(&pTcon->num_writes); -+ spin_lock(&pTcon->stat_lock); -+ pTcon->bytes_written += total_written; -+ spin_unlock(&pTcon->stat_lock); -+ } -+#endif -+ -+ /* since the write may have blocked check these pointers again */ -+ if(file->f_dentry) { -+ if(file->f_dentry->d_inode) { -+ file->f_dentry->d_inode->i_ctime = file->f_dentry->d_inode->i_mtime = -+ CURRENT_TIME; -+ if (total_written > 0) { -+ if (*poffset > file->f_dentry->d_inode->i_size) -+ file->f_dentry->d_inode->i_size = *poffset; -+ } -+ mark_inode_dirty_sync(file->f_dentry->d_inode); -+ } -+ } -+ FreeXid(xid); -+ return total_written; -+} -+ -+static int -+cifs_partialpagewrite(struct page *page,unsigned from, unsigned to) -+{ -+ struct address_space *mapping = page->mapping; -+ loff_t offset = (loff_t)page->index << PAGE_CACHE_SHIFT; -+ char * write_data; -+ int rc = -EFAULT; -+ int bytes_written = 0; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ struct inode *inode; -+ struct cifsInodeInfo *cifsInode; -+ struct cifsFileInfo *open_file = NULL; -+ struct list_head *tmp; -+ struct list_head *tmp1; -+ -+ if (!mapping) { -+ return -EFAULT; -+ } else if(!mapping->host) { -+ return -EFAULT; -+ } -+ -+ inode = page->mapping->host; -+ cifs_sb = CIFS_SB(inode->i_sb); -+ pTcon = cifs_sb->tcon; -+ -+ offset += (loff_t)from; -+ write_data = kmap(page); -+ write_data += from; -+ -+ if((to > PAGE_CACHE_SIZE) || (from > to)) { -+ kunmap(page); -+ return -EIO; -+ } -+ -+ /* racing with truncate? */ -+ if(offset > mapping->host->i_size) { -+ kunmap(page); -+ return 0; /* don't care */ -+ } -+ -+ /* check to make sure that we are not extending the file */ -+ if(mapping->host->i_size - offset < (loff_t)to) -+ to = (unsigned)(mapping->host->i_size - offset); -+ -+ -+ cifsInode = CIFS_I(mapping->host); -+ read_lock(&GlobalSMBSeslock); -+ /* BB we should start at the end */ -+ list_for_each_safe(tmp, tmp1, &cifsInode->openFileList) { -+ open_file = list_entry(tmp,struct cifsFileInfo, flist); -+ if(open_file->closePend) -+ continue; -+ /* We check if file is open for writing first */ -+ if((open_file->pfile) && -+ ((open_file->pfile->f_flags & O_RDWR) || -+ (open_file->pfile->f_flags & O_WRONLY))) { -+ read_unlock(&GlobalSMBSeslock); -+ bytes_written = cifs_write(open_file->pfile, write_data, -+ to-from, &offset); -+ read_lock(&GlobalSMBSeslock); -+ /* Does mm or vfs already set times? */ -+ inode->i_atime = inode->i_mtime = CURRENT_TIME; -+ if ((bytes_written > 0) && (offset)) { -+ rc = 0; -+ } else if(bytes_written < 0) { -+ if(rc == -EBADF) { -+ /* have seen a case in which -+ kernel seemed to have closed/freed a file -+ even with writes active so we might as well -+ see if there are other file structs to try -+ for the same inode before giving up */ -+ continue; -+ } else -+ rc = bytes_written; -+ } -+ break; /* now that we found a valid file handle -+ and tried to write to it we are done, no -+ sense continuing to loop looking for another */ -+ } -+ if(tmp->next == NULL) { -+ cFYI(1,("File instance %p removed",tmp)); -+ break; -+ } -+ } -+ read_unlock(&GlobalSMBSeslock); -+ if(open_file == NULL) { -+ cFYI(1,("No writeable filehandles for inode")); -+ rc = -EIO; -+ } -+ -+ kunmap(page); -+ return rc; -+} -+ -+#if 0 -+static int -+cifs_writepages(struct address_space *mapping, struct writeback_control *wbc) -+{ -+ int rc = -EFAULT; -+ int xid; -+ -+ xid = GetXid(); -+/* call 16K write then Setpageuptodate */ -+ FreeXid(xid); -+ return rc; -+} -+#endif -+ -+static int -+cifs_writepage(struct page* page) -+{ -+ int rc = -EFAULT; -+ int xid; -+ -+ xid = GetXid(); -+/* BB add check for wbc flags */ -+ page_cache_get(page); -+ if (!Page_Uptodate(page)) { -+ cFYI(1,("ppw - page not up to date")); -+ } -+ -+ rc = cifs_partialpagewrite(page,0,PAGE_CACHE_SIZE); -+ SetPageUptodate(page); /* BB add check for error and Clearuptodate? */ -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,20)) -+ unlock_page(page); -+#else -+ UnlockPage(page); -+#endif -+ page_cache_release(page); -+ FreeXid(xid); -+ return rc; -+} -+ -+static int -+cifs_commit_write(struct file *file, struct page *page, unsigned offset, -+ unsigned to) -+{ -+ int xid; -+ int rc = 0; -+ struct inode *inode = page->mapping->host; -+ loff_t position = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to; -+ char * page_data; -+ -+ xid = GetXid(); -+ cFYI(1,("commit write for page %p up to position %lld for %d",page,position,to)); -+ if (position > inode->i_size){ -+ inode->i_size = position; -+ /*if (file->private_data == NULL) { -+ rc = -EBADF; -+ } else { -+ open_file = (struct cifsFileInfo *)file->private_data; -+ cifs_sb = CIFS_SB(inode->i_sb); -+ rc = -EAGAIN; -+ while(rc == -EAGAIN) { -+ if((open_file->invalidHandle) && -+ (!open_file->closePend)) { -+ rc = cifs_reopen_file(file->f_dentry->d_inode,file); -+ if(rc != 0) -+ break; -+ } -+ if(!open_file->closePend) { -+ rc = CIFSSMBSetFileSize(xid, cifs_sb->tcon, -+ position, open_file->netfid, -+ open_file->pid,FALSE); -+ } else { -+ rc = -EBADF; -+ break; -+ } -+ } -+ cFYI(1,(" SetEOF (commit write) rc = %d",rc)); -+ }*/ -+ } -+ if (!Page_Uptodate(page)) { -+ position = ((loff_t)page->index << PAGE_CACHE_SHIFT) + offset; -+ /* can not rely on (or let) writepage write this data */ -+ if(to < offset) { -+ cFYI(1,("Illegal offsets, can not copy from %d to %d", -+ offset,to)); -+ FreeXid(xid); -+ return rc; -+ } -+ /* this is probably better than directly calling -+ partialpage_write since in this function -+ the file handle is known which we might as well -+ leverage */ -+ /* BB check if anything else missing out of ppw */ -+ /* such as updating last write time */ -+ page_data = kmap(page); -+ rc = cifs_write(file, page_data+offset,to-offset, -+ &position); -+ if(rc > 0) -+ rc = 0; -+ /* else if rc < 0 should we set writebehind rc? */ -+ kunmap(page); -+ } else { -+ set_page_dirty(page); -+ } -+ -+ FreeXid(xid); -+ return rc; -+} -+ -+int -+cifs_fsync(struct file *file, struct dentry *dentry, int datasync) -+{ -+ int xid; -+ int rc = 0; -+ struct inode * inode = file->f_dentry->d_inode; -+ -+ xid = GetXid(); -+ -+ cFYI(1, ("Sync file - name: %s datasync: 0x%x ", -+ dentry->d_name.name, datasync)); -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,17)) -+ rc = filemap_fdatasync(inode->i_mapping); -+#else -+ filemap_fdatasync(inode->i_mapping); -+#endif -+ if(rc == 0) -+ CIFS_I(inode)->write_behind_rc = 0; -+ FreeXid(xid); -+ return rc; -+} -+ -+static int -+cifs_sync_page(struct page *page) -+{ -+ struct address_space *mapping; -+ struct inode *inode; -+ unsigned long index = page->index; -+ unsigned int rpages = 0; -+ int rc = 0; -+ -+ cFYI(1,("sync page %p",page)); -+ mapping = page->mapping; -+ if (!mapping) -+ return 0; -+ inode = mapping->host; -+ if (!inode) -+ return 0; -+ -+/* fill in rpages then -+ result = cifs_pagein_inode(inode, index, rpages); *//* BB finish */ -+ -+ cFYI(1, ("rpages is %d for sync page of Index %ld ", rpages, index)); -+ -+ if (rc < 0) -+ return rc; -+ return 0; -+} -+ -+/* -+ * As file closes, flush all cached write data for this inode checking -+ * for write behind errors. -+ * -+ */ -+int cifs_flush(struct file *file) -+{ -+ struct inode * inode = file->f_dentry->d_inode; -+ int rc = 0; -+ -+ /* Rather than do the steps manually: */ -+ /* lock the inode for writing */ -+ /* loop through pages looking for write behind data (dirty pages) */ -+ /* coalesce into contiguous 16K (or smaller) chunks to write to server */ -+ /* send to server (prefer in parallel) */ -+ /* deal with writebehind errors */ -+ /* unlock inode for writing */ -+ /* filemapfdatawrite appears easier for the time being */ -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,17)) -+ rc = filemap_fdatasync(inode->i_mapping); -+#else -+ filemap_fdatasync(inode->i_mapping); -+#endif -+ if(rc == 0) /* reset wb rc if we were able to write out dirty pages */ -+ CIFS_I(inode)->write_behind_rc = 0; -+ -+ cFYI(1,("Flush inode %p file %p rc %d",inode,file,rc)); -+ -+ return rc; -+} -+ -+ -+ssize_t -+cifs_read(struct file * file, char *read_data, size_t read_size, -+ loff_t * poffset) -+{ -+ int rc = -EACCES; -+ unsigned int bytes_read = 0; -+ unsigned int total_read; -+ unsigned int current_read_size; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ int xid; -+ char * current_offset; -+ struct cifsFileInfo * open_file; -+ -+ xid = GetXid(); -+ cifs_sb = CIFS_SB(file->f_dentry->d_sb); -+ pTcon = cifs_sb->tcon; -+ -+ if (file->private_data == NULL) { -+ FreeXid(xid); -+ return -EBADF; -+ } -+ open_file = (struct cifsFileInfo *)file->private_data; -+ -+ if((file->f_flags & O_ACCMODE) == O_WRONLY) { -+ cFYI(1,("attempting read on write only file instance")); -+ } -+ -+ for (total_read = 0,current_offset=read_data; read_size > total_read; -+ total_read += bytes_read,current_offset+=bytes_read) { -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,15)) -+ current_read_size = min_t(const int,read_size - total_read,cifs_sb->rsize); -+#else -+ current_read_size = min(read_size - total_read,cifs_sb->rsize); -+#endif -+ rc = -EAGAIN; -+ while(rc == -EAGAIN) { -+ if ((open_file->invalidHandle) && (!open_file->closePend)) { -+ rc = cifs_reopen_file(file->f_dentry->d_inode, -+ file,TRUE); -+ if(rc != 0) -+ break; -+ } -+ -+ rc = CIFSSMBRead(xid, pTcon, -+ open_file->netfid, -+ current_read_size, *poffset, -+ &bytes_read, ¤t_offset); -+ } -+ if (rc || (bytes_read == 0)) { -+ if (total_read) { -+ break; -+ } else { -+ FreeXid(xid); -+ return rc; -+ } -+ } else { -+#ifdef CONFIG_CIFS_STATS -+ atomic_inc(&pTcon->num_reads); -+ spin_lock(&pTcon->stat_lock); -+ pTcon->bytes_read += total_read; -+ spin_unlock(&pTcon->stat_lock); -+#endif -+ *poffset += bytes_read; -+ } -+ } -+ FreeXid(xid); -+ return total_read; -+} -+ -+int cifs_file_mmap(struct file * file, struct vm_area_struct * vma) -+{ -+ struct dentry * dentry = file->f_dentry; -+ int rc, xid; -+ -+ xid = GetXid(); -+ rc = cifs_revalidate(dentry); -+ if (rc) { -+ cFYI(1,("Validation prior to mmap failed, error=%d", rc)); -+ FreeXid(xid); -+ return rc; -+ } -+ rc = generic_file_mmap(file, vma); -+ FreeXid(xid); -+ return rc; -+} -+ -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+static void cifs_copy_cache_pages(struct address_space *mapping, -+ struct list_head *pages, int bytes_read, -+ char *data,struct pagevec * plru_pvec) -+{ -+ struct page *page; -+ char * target; -+ -+ while (bytes_read > 0) { -+ if(list_empty(pages)) -+ break; -+ -+ page = list_entry(pages->prev, struct page, lru); -+ list_del(&page->lru); -+ -+ if (add_to_page_cache(page, mapping, page->index, GFP_KERNEL)) { -+ page_cache_release(page); -+ cFYI(1,("Add page cache failed")); -+ continue; -+ } -+ -+ target = kmap_atomic(page,KM_USER0); -+ -+ if(PAGE_CACHE_SIZE > bytes_read) { -+ memcpy(target,data,bytes_read); -+ /* zero the tail end of this partial page */ -+ memset(target+bytes_read,0,PAGE_CACHE_SIZE-bytes_read); -+ bytes_read = 0; -+ } else { -+ memcpy(target,data,PAGE_CACHE_SIZE); -+ bytes_read -= PAGE_CACHE_SIZE; -+ } -+ kunmap_atomic(target,KM_USER0); -+ -+ flush_dcache_page(page); -+ SetPageUptodate(page); -+ unlock_page(page); -+ if (!pagevec_add(plru_pvec, page)) -+ __pagevec_lru_add(plru_pvec); -+ data += PAGE_CACHE_SIZE; -+ } -+ return; -+} -+ -+ -+static int -+cifs_readpages(struct file *file, struct address_space *mapping, -+ struct list_head *page_list, unsigned num_pages) -+{ -+ int rc = -EACCES; -+ int xid; -+ loff_t offset; -+ struct page * page; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ int bytes_read = 0; -+ unsigned int read_size,i; -+ char * smb_read_data = NULL; -+ struct smb_com_read_rsp * pSMBr; -+ struct pagevec lru_pvec; -+ struct cifsFileInfo * open_file; -+ -+ xid = GetXid(); -+ if (file->private_data == NULL) { -+ FreeXid(xid); -+ return -EBADF; -+ } -+ open_file = (struct cifsFileInfo *)file->private_data; -+ cifs_sb = CIFS_SB(file->f_dentry->d_sb); -+ pTcon = cifs_sb->tcon; -+ -+ pagevec_init(&lru_pvec, 0); -+ -+ for(i = 0;iprev, struct page, lru); -+ offset = (loff_t)page->index << PAGE_CACHE_SHIFT; -+ -+ /* count adjacent pages that we will read into */ -+ contig_pages = 0; -+ expected_index = list_entry(page_list->prev,struct page,lru)->index; -+ list_for_each_entry_reverse(tmp_page,page_list,lru) { -+ if(tmp_page->index == expected_index) { -+ contig_pages++; -+ expected_index++; -+ } else { -+ break; -+ } -+ } -+ if(contig_pages + i > num_pages) { -+ contig_pages = num_pages - i; -+ } -+ -+ /* for reads over a certain size could initiate async read ahead */ -+ -+ read_size = contig_pages * PAGE_CACHE_SIZE; -+ /* Read size needs to be in multiples of one page */ -+ read_size = min_t(const unsigned int,read_size,cifs_sb->rsize & PAGE_CACHE_MASK); -+ -+ rc = -EAGAIN; -+ while(rc == -EAGAIN) { -+ if ((open_file->invalidHandle) && (!open_file->closePend)) { -+ rc = cifs_reopen_file(file->f_dentry->d_inode, -+ file, TRUE); -+ if(rc != 0) -+ break; -+ } -+ -+ rc = CIFSSMBRead(xid, pTcon, -+ open_file->netfid, -+ read_size, offset, -+ &bytes_read, &smb_read_data); -+ /* BB need to check return code here */ -+ if(rc== -EAGAIN) { -+ if(smb_read_data) { -+ cifs_buf_release(smb_read_data); -+ smb_read_data = NULL; -+ } -+ } -+ } -+ if ((rc < 0) || (smb_read_data == NULL)) { -+ cFYI(1,("Read error in readpages: %d",rc)); -+ /* clean up remaing pages off list */ -+ while (!list_empty(page_list) && (i < num_pages)) { -+ page = list_entry(page_list->prev, struct page, lru); -+ list_del(&page->lru); -+ page_cache_release(page); -+ } -+ break; -+ } else if (bytes_read > 0) { -+ pSMBr = (struct smb_com_read_rsp *)smb_read_data; -+ cifs_copy_cache_pages(mapping, page_list, bytes_read, -+ smb_read_data + 4 /* RFC1001 hdr */ + -+ le16_to_cpu(pSMBr->DataOffset), &lru_pvec); -+ -+ i += bytes_read >> PAGE_CACHE_SHIFT; -+#ifdef CONFIG_CIFS_STATS -+ atomic_inc(&pTcon->num_reads); -+ spin_lock(&pTcon->stat_lock); -+ pTcon->bytes_read += bytes_read; -+ spin_unlock(&pTcon->stat_lock); -+#endif -+ if((int)(bytes_read & PAGE_CACHE_MASK) != bytes_read) { -+ cFYI(1,("Partial page %d of %d read to cache",i++,num_pages)); -+ -+ i++; /* account for partial page */ -+ -+ /* server copy of file can have smaller size than client */ -+ /* BB do we need to verify this common case ? this case is ok - -+ if we are at server EOF we will hit it on next read */ -+ -+ /* while(!list_empty(page_list) && (i < num_pages)) { -+ page = list_entry(page_list->prev,struct page, list); -+ list_del(&page->list); -+ page_cache_release(page); -+ } -+ break; */ -+ } -+ } else { -+ cFYI(1,("No bytes read (%d) at offset %lld . Cleaning remaining pages from readahead list",bytes_read,offset)); -+ /* BB turn off caching and do new lookup on file size at server? */ -+ while (!list_empty(page_list) && (i < num_pages)) { -+ page = list_entry(page_list->prev, struct page, lru); -+ list_del(&page->lru); -+ page_cache_release(page); /* BB removeme - replace with zero of page? */ -+ } -+ break; -+ } -+ if(smb_read_data) { -+ cifs_buf_release(smb_read_data); -+ smb_read_data = NULL; -+ } -+ bytes_read = 0; -+ } -+ -+ pagevec_lru_add(&lru_pvec); -+ -+/* need to free smb_read_data buf before exit */ -+ if(smb_read_data) { -+ cifs_buf_release(smb_read_data); -+ smb_read_data = NULL; -+ } -+ -+ FreeXid(xid); -+ return rc; -+} -+#endif -+ -+static int cifs_readpage_worker(struct file *file, struct page *page, loff_t * poffset) -+{ -+ char * read_data; -+ int rc; -+ -+ page_cache_get(page); -+ read_data = kmap(page); -+ /* for reads over a certain size could initiate async read ahead */ -+ -+ rc = cifs_read(file, read_data, PAGE_CACHE_SIZE, poffset); -+ -+ if (rc < 0) -+ goto io_error; -+ else { -+ cFYI(1,("Bytes read %d ",rc)); -+ } -+ -+ file->f_dentry->d_inode->i_atime = CURRENT_TIME; -+ -+ if(PAGE_CACHE_SIZE > rc) { -+ memset(read_data+rc, 0, PAGE_CACHE_SIZE - rc); -+ } -+ flush_dcache_page(page); -+ SetPageUptodate(page); -+ rc = 0; -+ -+io_error: -+ kunmap(page); -+ page_cache_release(page); -+ return rc; -+} -+ -+static int -+cifs_readpage(struct file *file, struct page *page) -+{ -+ loff_t offset = (loff_t)page->index << PAGE_CACHE_SHIFT; -+ int rc = -EACCES; -+ int xid; -+ -+ xid = GetXid(); -+ -+ if (file->private_data == NULL) { -+ FreeXid(xid); -+ return -EBADF; -+ } -+ -+ cFYI(1,("readpage %p at offset %d 0x%x\n",page,(int)offset,(int)offset)); -+ -+ rc = cifs_readpage_worker(file,page,&offset); -+ -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,20)) -+ unlock_page(page); -+#else -+ UnlockPage(page); -+#endif -+ -+ FreeXid(xid); -+ return rc; -+} -+ -+/* We do not want to update the file size from server for inodes -+ open for write - to avoid races with writepage extending -+ the file - in the future we could consider allowing -+ refreshing the inode only on increases in the file size -+ but this is tricky to do without racing with writebehind -+ page caching in the current Linux kernel design */ -+ -+int is_size_safe_to_change(struct cifsInodeInfo * cifsInode) -+{ -+ struct list_head *tmp; -+ struct list_head *tmp1; -+ struct cifsFileInfo *open_file = NULL; -+ int rc = TRUE; -+ -+ if(cifsInode == NULL) -+ return rc; -+ -+ read_lock(&GlobalSMBSeslock); -+ list_for_each_safe(tmp, tmp1, &cifsInode->openFileList) { -+ open_file = list_entry(tmp,struct cifsFileInfo, flist); -+ if(open_file == NULL) -+ break; -+ if(open_file->closePend) -+ continue; -+ /* We check if file is open for writing, -+ BB we could supplement this with a check to see if file size -+ changes have been flushed to server - ie inode metadata dirty */ -+ if((open_file->pfile) && -+ ((open_file->pfile->f_flags & O_RDWR) || -+ (open_file->pfile->f_flags & O_WRONLY))) { -+ rc = FALSE; -+ break; -+ } -+ if(tmp->next == NULL) { -+ cFYI(1,("File instance %p removed",tmp)); -+ break; -+ } -+ } -+ read_unlock(&GlobalSMBSeslock); -+ return rc; -+} -+ -+ -+void -+fill_in_inode(struct inode *tmp_inode, -+ FILE_DIRECTORY_INFO * pfindData, int *pobject_type) -+{ -+ struct cifsInodeInfo *cifsInfo = CIFS_I(tmp_inode); -+ struct cifs_sb_info *cifs_sb = CIFS_SB(tmp_inode->i_sb); -+ -+ pfindData->ExtFileAttributes = -+ le32_to_cpu(pfindData->ExtFileAttributes); -+ pfindData->AllocationSize = le64_to_cpu(pfindData->AllocationSize); -+ pfindData->EndOfFile = le64_to_cpu(pfindData->EndOfFile); -+ cifsInfo->cifsAttrs = pfindData->ExtFileAttributes; -+ cifsInfo->time = jiffies; -+ -+ /* Linux can not store file creation time unfortunately so ignore it */ -+ tmp_inode->i_atime = -+ cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastAccessTime)); -+ tmp_inode->i_mtime = -+ cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastWriteTime)); -+ tmp_inode->i_ctime = -+ cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime)); -+ /* treat dos attribute of read-only as read-only mode bit e.g. 555? */ -+ /* 2767 perms - indicate mandatory locking */ -+ /* BB fill in uid and gid here? with help from winbind? -+ or retrieve from NTFS stream extended attribute */ -+ if(atomic_read(&cifsInfo->inUse) == 0) { -+ tmp_inode->i_uid = cifs_sb->mnt_uid; -+ tmp_inode->i_gid = cifs_sb->mnt_gid; -+ /* set default mode. will override for dirs below */ -+ tmp_inode->i_mode = cifs_sb->mnt_file_mode; -+ } -+ -+ cFYI(0, -+ ("CIFS FFIRST: Attributes came in as 0x%x", -+ pfindData->ExtFileAttributes)); -+ if (pfindData->ExtFileAttributes & ATTR_REPARSE) { -+ *pobject_type = DT_LNK; -+ /* BB can this and S_IFREG or S_IFDIR be set as in Windows? */ -+ tmp_inode->i_mode |= S_IFLNK; -+ } else if (pfindData->ExtFileAttributes & ATTR_DIRECTORY) { -+ *pobject_type = DT_DIR; -+ /* override default perms since we do not lock dirs */ -+ if(atomic_read(&cifsInfo->inUse) == 0) { -+ tmp_inode->i_mode = cifs_sb->mnt_dir_mode; -+ } -+ tmp_inode->i_mode |= S_IFDIR; -+ } else { -+ *pobject_type = DT_REG; -+ tmp_inode->i_mode |= S_IFREG; -+ if(pfindData->ExtFileAttributes & ATTR_READONLY) -+ tmp_inode->i_mode &= ~(S_IWUGO); -+ -+ }/* could add code here - to validate if device or weird share type? */ -+ -+ /* can not fill in nlink here as in qpathinfo version and Unx search */ -+ if(atomic_read(&cifsInfo->inUse) == 0) { -+ atomic_set(&cifsInfo->inUse,1); -+ } -+ if(is_size_safe_to_change(cifsInfo)) { -+ /* can not safely change the file size here if the -+ client is writing to it due to potential races */ -+ tmp_inode->i_size = pfindData->EndOfFile; -+ -+ /* 512 bytes (2**9) is the fake blocksize that must be used */ -+ /* for this calculation, even though the reported blocksize is larger */ -+ tmp_inode->i_blocks = (512 - 1 + pfindData->AllocationSize) >> 9; -+ } -+ -+ if (pfindData->AllocationSize < pfindData->EndOfFile) -+ cFYI(1, ("Possible sparse file: allocation size less than end of file ")); -+ cFYI(1, -+ ("File Size %ld and blocks %ld and blocksize %ld", -+ (unsigned long) tmp_inode->i_size, tmp_inode->i_blocks, -+ tmp_inode->i_blksize)); -+ if (S_ISREG(tmp_inode->i_mode)) { -+ cFYI(1, (" File inode ")); -+ tmp_inode->i_op = &cifs_file_inode_ops; -+ tmp_inode->i_fop = &cifs_file_ops; -+ tmp_inode->i_data.a_ops = &cifs_addr_ops; -+ } else if (S_ISDIR(tmp_inode->i_mode)) { -+ cFYI(1, (" Directory inode")); -+ tmp_inode->i_op = &cifs_dir_inode_ops; -+ tmp_inode->i_fop = &cifs_dir_ops; -+ } else if (S_ISLNK(tmp_inode->i_mode)) { -+ cFYI(1, (" Symbolic Link inode ")); -+ tmp_inode->i_op = &cifs_symlink_inode_ops; -+ } else { -+ cFYI(1, (" Init special inode ")); -+ init_special_inode(tmp_inode, tmp_inode->i_mode, -+ kdev_t_to_nr(tmp_inode->i_rdev)); -+ } -+} -+ -+void -+unix_fill_in_inode(struct inode *tmp_inode, -+ FILE_UNIX_INFO * pfindData, int *pobject_type) -+{ -+ struct cifsInodeInfo *cifsInfo = CIFS_I(tmp_inode); -+ cifsInfo->time = jiffies; -+ atomic_inc(&cifsInfo->inUse); -+ -+ tmp_inode->i_atime = -+ cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastAccessTime)); -+ tmp_inode->i_mtime = -+ cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastModificationTime)); -+ tmp_inode->i_ctime = -+ cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastStatusChange)); -+ -+ tmp_inode->i_mode = le64_to_cpu(pfindData->Permissions); -+ pfindData->Type = le32_to_cpu(pfindData->Type); -+ if (pfindData->Type == UNIX_FILE) { -+ *pobject_type = DT_REG; -+ tmp_inode->i_mode |= S_IFREG; -+ } else if (pfindData->Type == UNIX_SYMLINK) { -+ *pobject_type = DT_LNK; -+ tmp_inode->i_mode |= S_IFLNK; -+ } else if (pfindData->Type == UNIX_DIR) { -+ *pobject_type = DT_DIR; -+ tmp_inode->i_mode |= S_IFDIR; -+ } else if (pfindData->Type == UNIX_CHARDEV) { -+ *pobject_type = DT_CHR; -+ tmp_inode->i_mode |= S_IFCHR; -+ tmp_inode->i_rdev = MKDEV(le64_to_cpu(pfindData->DevMajor), -+ le64_to_cpu(pfindData->DevMinor) & MINORMASK); -+ } else if (pfindData->Type == UNIX_BLOCKDEV) { -+ *pobject_type = DT_BLK; -+ tmp_inode->i_mode |= S_IFBLK; -+ tmp_inode->i_rdev = MKDEV(le64_to_cpu(pfindData->DevMajor), -+ le64_to_cpu(pfindData->DevMinor) & MINORMASK); -+ } else if (pfindData->Type == UNIX_FIFO) { -+ *pobject_type = DT_FIFO; -+ tmp_inode->i_mode |= S_IFIFO; -+ } else if (pfindData->Type == UNIX_SOCKET) { -+ *pobject_type = DT_SOCK; -+ tmp_inode->i_mode |= S_IFSOCK; -+ } -+ -+ tmp_inode->i_uid = le64_to_cpu(pfindData->Uid); -+ tmp_inode->i_gid = le64_to_cpu(pfindData->Gid); -+ tmp_inode->i_nlink = le64_to_cpu(pfindData->Nlinks); -+ -+ pfindData->NumOfBytes = le64_to_cpu(pfindData->NumOfBytes); -+ if(is_size_safe_to_change(cifsInfo)) { -+ /* can not safely change the file size here if the -+ client is writing to it due to potential races */ -+ pfindData->EndOfFile = le64_to_cpu(pfindData->EndOfFile); -+ tmp_inode->i_size = pfindData->EndOfFile; -+ -+ /* 512 bytes (2**9) is the fake blocksize that must be used */ -+ /* for this calculation, not the real blocksize */ -+ tmp_inode->i_blocks = (512 - 1 + pfindData->NumOfBytes) >> 9; -+ } -+ -+ if (S_ISREG(tmp_inode->i_mode)) { -+ cFYI(1, ("File inode")); -+ tmp_inode->i_op = &cifs_file_inode_ops; -+ tmp_inode->i_fop = &cifs_file_ops; -+ tmp_inode->i_data.a_ops = &cifs_addr_ops; -+ } else if (S_ISDIR(tmp_inode->i_mode)) { -+ cFYI(1, ("Directory inode")); -+ tmp_inode->i_op = &cifs_dir_inode_ops; -+ tmp_inode->i_fop = &cifs_dir_ops; -+ } else if (S_ISLNK(tmp_inode->i_mode)) { -+ cFYI(1, ("Symbolic Link inode")); -+ tmp_inode->i_op = &cifs_symlink_inode_ops; -+/* tmp_inode->i_fop = *//* do not need to set to anything */ -+ } else { -+ cFYI(1, ("Special inode")); -+ init_special_inode(tmp_inode, tmp_inode->i_mode, -+ kdev_t_to_nr(tmp_inode->i_rdev)); -+ } -+} -+ -+static void -+construct_dentry(struct qstr *qstring, struct file *file, -+ struct inode **ptmp_inode, struct dentry **pnew_dentry) -+{ -+ struct dentry *tmp_dentry; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ struct cifsInodeInfo *pCifsI; -+ -+ cFYI(1, ("For %s ", qstring->name)); -+ cifs_sb = CIFS_SB(file->f_dentry->d_sb); -+ pTcon = cifs_sb->tcon; -+ -+ qstring->hash = full_name_hash(qstring->name, qstring->len); -+ tmp_dentry = d_lookup(file->f_dentry, qstring); -+ if (tmp_dentry) { -+ cFYI(0, (" existing dentry with inode 0x%p", tmp_dentry->d_inode)); -+ *ptmp_inode = tmp_dentry->d_inode; -+ /* BB overwrite the old name? i.e. tmp_dentry->d_name and tmp_dentry->d_name.len ?? */ -+ if(*ptmp_inode == NULL) { -+ *ptmp_inode = new_inode(file->f_dentry->d_sb); -+ if(*ptmp_inode == NULL) -+ return; -+ d_instantiate(tmp_dentry, *ptmp_inode); -+ insert_inode_hash(*ptmp_inode); -+ pCifsI = CIFS_I(*ptmp_inode); -+ INIT_LIST_HEAD(&pCifsI->openFileList); -+ /* can not enable caching for this inode -+ until a file instance is open and we -+ can check the oplock flag on the open -+ response */ -+ (*ptmp_inode)->i_blksize = CIFS_MAX_MSGSIZE; -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,15)) -+ (*ptmp_inode)->i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */ -+#endif -+ pCifsI->clientCanCacheRead = FALSE; -+ pCifsI->clientCanCacheAll = FALSE; -+ pCifsI->time = 0; -+ /* do not need to set cifs Attrs since -+ they are about to be overwritten -+ in fill_in_inode */ -+ atomic_set(&pCifsI->inUse, 0); -+ } -+ } else { -+ tmp_dentry = d_alloc(file->f_dentry, qstring); -+ if(tmp_dentry == NULL) { -+ cERROR(1,("Failed allocating dentry")); -+ return; -+ } -+ -+ if(ptmp_inode) { -+ *ptmp_inode = new_inode(file->f_dentry->d_sb); -+ if(*ptmp_inode == NULL) -+ return; -+ pCifsI = CIFS_I(*ptmp_inode); -+ insert_inode_hash(*ptmp_inode); -+ INIT_LIST_HEAD(&pCifsI->openFileList); -+ /* can not enable caching for this inode -+ until a file instance is open and we -+ can check the oplock flag on the open -+ response */ -+ (*ptmp_inode)->i_blksize = CIFS_MAX_MSGSIZE; -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,15)) -+ (*ptmp_inode)->i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */ -+#endif -+ pCifsI->clientCanCacheRead = FALSE; -+ pCifsI->clientCanCacheAll = FALSE; -+ pCifsI->time = 0; -+ /* do not need to set cifs Attrs since -+ they are about to be overwritten -+ in fill_in_inode */ -+ atomic_set(&pCifsI->inUse, 0); -+ } -+ tmp_dentry->d_op = &cifs_dentry_ops; -+ d_instantiate(tmp_dentry, *ptmp_inode); -+ d_rehash(tmp_dentry); -+ } -+ -+ tmp_dentry->d_time = jiffies; -+ *pnew_dentry = tmp_dentry; -+} -+ -+static void reset_resume_key(struct file * dir_file, -+ unsigned char * filename, -+ unsigned int len,int Unicode,struct nls_table * nls_tab) { -+ struct cifsFileInfo *cifsFile; -+ -+ cifsFile = (struct cifsFileInfo *)dir_file->private_data; -+ if(cifsFile == NULL) -+ return; -+ if(cifsFile->search_resume_name) { -+ kfree(cifsFile->search_resume_name); -+ } -+ -+ if(Unicode) -+ len *= 2; -+ cifsFile->resume_name_length = len; -+ -+ cifsFile->search_resume_name = -+ kmalloc(cifsFile->resume_name_length, GFP_KERNEL); -+ -+ if(cifsFile->search_resume_name == NULL) { -+ cERROR(1,("failed new resume key allocate, length %d", -+ cifsFile->resume_name_length)); -+ return; -+ } -+ if(Unicode) -+ cifs_strtoUCS((wchar_t *) cifsFile->search_resume_name, -+ filename, len, nls_tab); -+ else -+ memcpy(cifsFile->search_resume_name, filename, -+ cifsFile->resume_name_length); -+ cFYI(1,("Reset resume key to: %s with len %d",filename,len)); -+ return; -+} -+ -+ -+ -+static int -+cifs_filldir(struct qstr *pqstring, FILE_DIRECTORY_INFO * pfindData, -+ struct file *file, filldir_t filldir, void *direntry) -+{ -+ struct inode *tmp_inode; -+ struct dentry *tmp_dentry; -+ int object_type,rc; -+ -+ pqstring->name = pfindData->FileName; -+ pqstring->len = pfindData->FileNameLength; -+ -+ construct_dentry(pqstring, file, &tmp_inode, &tmp_dentry); -+ if((tmp_inode == NULL) || (tmp_dentry == NULL)) { -+ return -ENOMEM; -+ } -+ fill_in_inode(tmp_inode, pfindData, &object_type); -+ rc = filldir(direntry, pfindData->FileName, pqstring->len, file->f_pos, -+ tmp_inode->i_ino, object_type); -+ if(rc) { -+ /* due to readdir error we need to recalculate resume -+ key so next readdir will restart on right entry */ -+ cFYI(1,("Error %d on filldir of %s",rc ,pfindData->FileName)); -+ } -+ dput(tmp_dentry); -+ return rc; -+} -+ -+static int -+cifs_filldir_unix(struct qstr *pqstring, -+ FILE_UNIX_INFO * pUnixFindData, struct file *file, -+ filldir_t filldir, void *direntry) -+{ -+ struct inode *tmp_inode; -+ struct dentry *tmp_dentry; -+ int object_type, rc; -+ -+ pqstring->name = pUnixFindData->FileName; -+ pqstring->len = strnlen(pUnixFindData->FileName, MAX_PATHCONF); -+ -+ construct_dentry(pqstring, file, &tmp_inode, &tmp_dentry); -+ if((tmp_inode == NULL) || (tmp_dentry == NULL)) { -+ return -ENOMEM; -+ } -+ -+ unix_fill_in_inode(tmp_inode, pUnixFindData, &object_type); -+ rc = filldir(direntry, pUnixFindData->FileName, pqstring->len, -+ file->f_pos, tmp_inode->i_ino, object_type); -+ if(rc) { -+ /* due to readdir error we need to recalculate resume -+ key so next readdir will restart on right entry */ -+ cFYI(1,("Error %d on filldir of %s",rc ,pUnixFindData->FileName)); -+ } -+ dput(tmp_dentry); -+ return rc; -+} -+ -+int -+cifs_readdir(struct file *file, void *direntry, filldir_t filldir) -+{ -+ int rc = 0; -+ int xid; -+ int Unicode = FALSE; -+ int UnixSearch = FALSE; -+ unsigned int bufsize, i; -+ __u16 searchHandle; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ struct cifsFileInfo *cifsFile = NULL; -+ char *full_path = NULL; -+ char *data; -+ struct qstr qstring; -+ T2_FFIRST_RSP_PARMS findParms; -+ T2_FNEXT_RSP_PARMS findNextParms; -+ FILE_DIRECTORY_INFO *pfindData; -+ FILE_DIRECTORY_INFO *lastFindData; -+ FILE_UNIX_INFO *pfindDataUnix; -+ -+ xid = GetXid(); -+ -+ cifs_sb = CIFS_SB(file->f_dentry->d_sb); -+ pTcon = cifs_sb->tcon; -+ bufsize = pTcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; -+ if(bufsize > CIFS_MAX_MSGSIZE) { -+ FreeXid(xid); -+ return -EIO; -+ } -+ data = kmalloc(bufsize, GFP_KERNEL); -+ pfindData = (FILE_DIRECTORY_INFO *) data; -+ -+ if(file->f_dentry == NULL) { -+ FreeXid(xid); -+ return -EIO; -+ } -+ down(&file->f_dentry->d_sb->s_vfs_rename_sem); -+ full_path = build_wildcard_path_from_dentry(file->f_dentry); -+ up(&file->f_dentry->d_sb->s_vfs_rename_sem); -+ -+ -+ cFYI(1, ("Full path: %s start at: %lld ", full_path, file->f_pos)); -+ -+ switch ((int) file->f_pos) { -+ case 0: -+ if (filldir(direntry, ".", 1, file->f_pos, -+ file->f_dentry->d_inode->i_ino, DT_DIR) < 0) { -+ cERROR(1, ("Filldir for current dir failed ")); -+ break; -+ } -+ file->f_pos++; -+ /* fallthrough */ -+ case 1: -+ if (filldir(direntry, "..", 2, file->f_pos, -+ file->f_dentry->d_parent->d_inode->i_ino, DT_DIR) < 0) { -+ cERROR(1, ("Filldir for parent dir failed ")); -+ break; -+ } -+ file->f_pos++; -+ /* fallthrough */ -+ case 2: -+ if (file->private_data != NULL) { -+ cifsFile = -+ (struct cifsFileInfo *) file->private_data; -+ if (cifsFile->endOfSearch) { -+ if(cifsFile->emptyDir) { -+ cFYI(1, ("End of search, empty dir")); -+ rc = 0; -+ break; -+ } -+ } else { -+ cifsFile->invalidHandle = TRUE; -+ CIFSFindClose(xid, pTcon, cifsFile->netfid); -+ } -+ if(cifsFile->search_resume_name) { -+ kfree(cifsFile->search_resume_name); -+ cifsFile->search_resume_name = NULL; -+ } -+ } -+ rc = CIFSFindFirst(xid, pTcon, full_path, pfindData, -+ &findParms, cifs_sb->local_nls, -+ &Unicode, &UnixSearch); -+ cFYI(1, ("Count: %d End: %d ", findParms.SearchCount, -+ findParms.EndofSearch)); -+ -+ if (rc == 0) { -+ searchHandle = findParms.SearchHandle; -+ if(file->private_data == NULL) -+ file->private_data = -+ kmalloc(sizeof(struct cifsFileInfo),GFP_KERNEL); -+ if (file->private_data) { -+ memset(file->private_data, 0, -+ sizeof (struct cifsFileInfo)); -+ cifsFile = -+ (struct cifsFileInfo *) file->private_data; -+ cifsFile->netfid = searchHandle; -+ cifsFile->invalidHandle = FALSE; -+ init_MUTEX(&cifsFile->fh_sem); -+ } else { -+ rc = -ENOMEM; -+ break; -+ } -+ -+ renew_parental_timestamps(file->f_dentry); -+ lastFindData = -+ (FILE_DIRECTORY_INFO *) ((char *) pfindData + -+ findParms.LastNameOffset); -+ if((char *)lastFindData > (char *)pfindData + bufsize) { -+ cFYI(1,("last search entry past end of packet")); -+ rc = -EIO; -+ break; -+ } -+ /* Offset of resume key same for levels 257 and 514 */ -+ cifsFile->resume_key = lastFindData->FileIndex; -+ if(UnixSearch == FALSE) { -+ cifsFile->resume_name_length = -+ le32_to_cpu(lastFindData->FileNameLength); -+ if(cifsFile->resume_name_length > bufsize - 64) { -+ cFYI(1,("Illegal resume file name length %d", -+ cifsFile->resume_name_length)); -+ rc = -ENOMEM; -+ break; -+ } -+ cifsFile->search_resume_name = -+ kmalloc(cifsFile->resume_name_length, GFP_KERNEL); -+ cFYI(1,("Last file: %s with name %d bytes long", -+ lastFindData->FileName, -+ cifsFile->resume_name_length)); -+ memcpy(cifsFile->search_resume_name, -+ lastFindData->FileName, -+ cifsFile->resume_name_length); -+ } else { -+ pfindDataUnix = (FILE_UNIX_INFO *)lastFindData; -+ if (Unicode == TRUE) { -+ for(i=0;(pfindDataUnix->FileName[i] -+ | pfindDataUnix->FileName[i+1]); -+ i+=2) { -+ if(i > bufsize-64) -+ break; -+ } -+ cifsFile->resume_name_length = i + 2; -+ } else { -+ cifsFile->resume_name_length = -+ strnlen(pfindDataUnix->FileName, -+ bufsize-63); -+ } -+ if(cifsFile->resume_name_length > bufsize - 64) { -+ cFYI(1,("Illegal resume file name length %d", -+ cifsFile->resume_name_length)); -+ rc = -ENOMEM; -+ break; -+ } -+ cifsFile->search_resume_name = -+ kmalloc(cifsFile->resume_name_length, GFP_KERNEL); -+ cFYI(1,("Last file: %s with name %d bytes long", -+ pfindDataUnix->FileName, -+ cifsFile->resume_name_length)); -+ memcpy(cifsFile->search_resume_name, -+ pfindDataUnix->FileName, -+ cifsFile->resume_name_length); -+ } -+ for (i = 2; i < (unsigned int)findParms.SearchCount + 2; i++) { -+ if (UnixSearch == FALSE) { -+ pfindData->FileNameLength = -+ le32_to_cpu(pfindData->FileNameLength); -+ if (Unicode == TRUE) -+ pfindData->FileNameLength = -+ cifs_strfromUCS_le -+ (pfindData->FileName, -+ (wchar_t *) -+ pfindData->FileName, -+ (pfindData-> -+ FileNameLength) / 2, -+ cifs_sb->local_nls); -+ qstring.len = pfindData->FileNameLength; -+ if (((qstring.len != 1) -+ || (pfindData->FileName[0] != '.')) -+ && ((qstring.len != 2) -+ || (pfindData-> -+ FileName[0] != '.') -+ || (pfindData-> -+ FileName[1] != '.'))) { -+ if(cifs_filldir(&qstring, -+ pfindData, -+ file, filldir, -+ direntry)) { -+ /* do not end search if -+ kernel not ready to take -+ remaining entries yet */ -+ reset_resume_key(file, pfindData->FileName,qstring.len, -+ Unicode, cifs_sb->local_nls); -+ findParms.EndofSearch = 0; -+ break; -+ } -+ file->f_pos++; -+ } -+ } else { /* UnixSearch */ -+ pfindDataUnix = -+ (FILE_UNIX_INFO *) pfindData; -+ if (Unicode == TRUE) -+ qstring.len = -+ cifs_strfromUCS_le -+ (pfindDataUnix->FileName, -+ (wchar_t *) -+ pfindDataUnix->FileName, -+ MAX_PATHCONF, -+ cifs_sb->local_nls); -+ else -+ qstring.len = -+ strnlen(pfindDataUnix-> -+ FileName, -+ MAX_PATHCONF); -+ if (((qstring.len != 1) -+ || (pfindDataUnix-> -+ FileName[0] != '.')) -+ && ((qstring.len != 2) -+ || (pfindDataUnix-> -+ FileName[0] != '.') -+ || (pfindDataUnix-> -+ FileName[1] != '.'))) { -+ if(cifs_filldir_unix(&qstring, -+ pfindDataUnix, -+ file, -+ filldir, -+ direntry)) { -+ /* do not end search if -+ kernel not ready to take -+ remaining entries yet */ -+ findParms.EndofSearch = 0; -+ reset_resume_key(file, pfindDataUnix->FileName, -+ qstring.len,Unicode,cifs_sb->local_nls); -+ break; -+ } -+ file->f_pos++; -+ } -+ } -+ /* works also for Unix ff struct since first field of both */ -+ pfindData = -+ (FILE_DIRECTORY_INFO *) ((char *) pfindData -+ + le32_to_cpu(pfindData->NextEntryOffset)); -+ /* BB also should check to make sure that pointer is not beyond the end of the SMB */ -+ /* if(pfindData > lastFindData) rc = -EIO; break; */ -+ } /* end for loop */ -+ if ((findParms.EndofSearch != 0) && cifsFile) { -+ cifsFile->endOfSearch = TRUE; -+ if(findParms.SearchCount == 2) -+ cifsFile->emptyDir = TRUE; -+ } -+ } else { -+ if (cifsFile) -+ cifsFile->endOfSearch = TRUE; -+ /* unless parent directory gone do not return error */ -+ rc = 0; -+ } -+ break; -+ default: -+ if (file->private_data == NULL) { -+ rc = -EBADF; -+ cFYI(1, -+ ("Readdir on closed srch, pos = %lld", -+ file->f_pos)); -+ } else { -+ cifsFile = (struct cifsFileInfo *) file->private_data; -+ if (cifsFile->endOfSearch) { -+ rc = 0; -+ cFYI(1, ("End of search ")); -+ break; -+ } -+ searchHandle = cifsFile->netfid; -+ rc = CIFSFindNext(xid, pTcon, pfindData, -+ &findNextParms, searchHandle, -+ cifsFile->search_resume_name, -+ cifsFile->resume_name_length, -+ cifsFile->resume_key, -+ &Unicode, &UnixSearch); -+ cFYI(1,("Count: %d End: %d ", -+ findNextParms.SearchCount, -+ findNextParms.EndofSearch)); -+ if ((rc == 0) && (findNextParms.SearchCount != 0)) { -+ /* BB save off resume key, key name and name length */ -+ lastFindData = -+ (FILE_DIRECTORY_INFO *) ((char *) pfindData -+ + findNextParms.LastNameOffset); -+ if((char *)lastFindData > (char *)pfindData + bufsize) { -+ cFYI(1,("last search entry past end of packet")); -+ rc = -EIO; -+ break; -+ } -+ /* Offset of resume key same for levels 257 and 514 */ -+ cifsFile->resume_key = lastFindData->FileIndex; -+ -+ if(UnixSearch == FALSE) { -+ cifsFile->resume_name_length = -+ le32_to_cpu(lastFindData->FileNameLength); -+ if(cifsFile->resume_name_length > bufsize - 64) { -+ cFYI(1,("Illegal resume file name length %d", -+ cifsFile->resume_name_length)); -+ rc = -ENOMEM; -+ break; -+ } -+ /* Free the memory allocated by previous findfirst -+ or findnext call - we can not reuse the memory since -+ the resume name may not be same string length */ -+ if(cifsFile->search_resume_name) -+ kfree(cifsFile->search_resume_name); -+ cifsFile->search_resume_name = -+ kmalloc(cifsFile->resume_name_length, GFP_KERNEL); -+ cFYI(1,("Last file: %s with name %d bytes long", -+ lastFindData->FileName, -+ cifsFile->resume_name_length)); -+ memcpy(cifsFile->search_resume_name, -+ lastFindData->FileName, -+ cifsFile->resume_name_length); -+ } else { -+ pfindDataUnix = (FILE_UNIX_INFO *)lastFindData; -+ if (Unicode == TRUE) { -+ for(i=0;(pfindDataUnix->FileName[i] -+ | pfindDataUnix->FileName[i+1]); -+ i+=2) { -+ if(i > bufsize-64) -+ break; -+ } -+ cifsFile->resume_name_length = i + 2; -+ } else { -+ cifsFile->resume_name_length = -+ strnlen(pfindDataUnix-> -+ FileName, -+ MAX_PATHCONF); -+ } -+ if(cifsFile->resume_name_length > bufsize - 64) { -+ cFYI(1,("Illegal resume file name length %d", -+ cifsFile->resume_name_length)); -+ rc = -ENOMEM; -+ break; -+ } -+ /* Free the memory allocated by previous findfirst -+ or findnext call - we can not reuse the memory since -+ the resume name may not be same string length */ -+ if(cifsFile->search_resume_name) -+ kfree(cifsFile->search_resume_name); -+ cifsFile->search_resume_name = -+ kmalloc(cifsFile->resume_name_length, GFP_KERNEL); -+ cFYI(1,("fnext last file: %s with name %d bytes long", -+ pfindDataUnix->FileName, -+ cifsFile->resume_name_length)); -+ memcpy(cifsFile->search_resume_name, -+ pfindDataUnix->FileName, -+ cifsFile->resume_name_length); -+ } -+ -+ for (i = 0; i < findNextParms.SearchCount; i++) { -+ pfindData->FileNameLength = -+ le32_to_cpu(pfindData-> -+ FileNameLength); -+ if (UnixSearch == FALSE) { -+ if (Unicode == TRUE) -+ pfindData->FileNameLength = -+ cifs_strfromUCS_le -+ (pfindData->FileName, -+ (wchar_t *) -+ pfindData->FileName, -+ (pfindData->FileNameLength)/ 2, -+ cifs_sb->local_nls); -+ qstring.len = -+ pfindData->FileNameLength; -+ if (((qstring.len != 1) -+ || (pfindData->FileName[0] != '.')) -+ && ((qstring.len != 2) -+ || (pfindData->FileName[0] != '.') -+ || (pfindData->FileName[1] != -+ '.'))) { -+ if(cifs_filldir -+ (&qstring, -+ pfindData, -+ file, filldir, -+ direntry)) { -+ /* do not end search if -+ kernel not ready to take -+ remaining entries yet */ -+ findNextParms.EndofSearch = 0; -+ reset_resume_key(file, pfindData->FileName,qstring.len, -+ Unicode,cifs_sb->local_nls); -+ break; -+ } -+ file->f_pos++; -+ } -+ } else { /* UnixSearch */ -+ pfindDataUnix = -+ (FILE_UNIX_INFO *) -+ pfindData; -+ if (Unicode == TRUE) -+ qstring.len = -+ cifs_strfromUCS_le -+ (pfindDataUnix->FileName, -+ (wchar_t *) -+ pfindDataUnix->FileName, -+ MAX_PATHCONF, -+ cifs_sb->local_nls); -+ else -+ qstring.len = -+ strnlen -+ (pfindDataUnix-> -+ FileName, -+ MAX_PATHCONF); -+ if (((qstring.len != 1) -+ || (pfindDataUnix-> -+ FileName[0] != '.')) -+ && ((qstring.len != 2) -+ || (pfindDataUnix-> -+ FileName[0] != '.') -+ || (pfindDataUnix-> -+ FileName[1] != -+ '.'))) { -+ if(cifs_filldir_unix -+ (&qstring, -+ pfindDataUnix, -+ file, filldir, -+ direntry)) { -+ /* do not end search if -+ kernel not ready to take -+ remaining entries yet */ -+ findNextParms.EndofSearch = 0; -+ reset_resume_key(file, pfindDataUnix->FileName,qstring.len, -+ Unicode,cifs_sb->local_nls); -+ break; -+ } -+ file->f_pos++; -+ } -+ } -+ pfindData = (FILE_DIRECTORY_INFO *) ((char *) pfindData + le32_to_cpu(pfindData->NextEntryOffset)); /* works also for Unix find struct since this is the first field of both */ -+ /* BB also should check to make sure that pointer is not beyond the end of the SMB */ -+ } /* end for loop */ -+ if (findNextParms.EndofSearch != 0) { -+ cifsFile->endOfSearch = TRUE; -+ } -+ } else { -+ cifsFile->endOfSearch = TRUE; -+ rc = 0; /* unless parent directory disappeared - do not return error here (eg Access Denied or no more files) */ -+ } -+ } -+ } /* end switch */ -+ if (data) -+ kfree(data); -+ if (full_path) -+ kfree(full_path); -+ FreeXid(xid); -+ -+ return rc; -+} -+int cifs_prepare_write(struct file *file, struct page *page, -+ unsigned from, unsigned to) -+{ -+ int rc = 0; -+ loff_t offset = (loff_t)page->index << PAGE_CACHE_SHIFT; -+ cFYI(1,("prepare write for page %p from %d to %d",page,from,to)); -+ if (!Page_Uptodate(page)) { -+ /* if (to - from != PAGE_CACHE_SIZE) { -+ void *kaddr = kmap_atomic(page, KM_USER0); -+ memset(kaddr, 0, from); -+ memset(kaddr + to, 0, PAGE_CACHE_SIZE - to); -+ flush_dcache_page(page); -+ kunmap_atomic(kaddr, KM_USER0); -+ } */ -+ /* If we are writing a full page it will be up to date, -+ no need to read from the server */ -+ if((to==PAGE_CACHE_SIZE) && (from == 0)) -+ SetPageUptodate(page); -+ -+ /* might as well read a page, it is fast enough */ -+ if((file->f_flags & O_ACCMODE) != O_WRONLY) { -+ rc = cifs_readpage_worker(file,page,&offset); -+ } else { -+ /* should we try using another -+ file handle if there is one - how would we lock it -+ to prevent close of that handle racing with this read? */ -+ /* In any case this will be written out by commit_write */ -+ } -+ } -+ -+ /* BB should we pass any errors back? e.g. if we do not have read access to the file */ -+ return 0; -+} -+ -+ -+struct address_space_operations cifs_addr_ops = { -+ .readpage = cifs_readpage, -+/* .readpages = cifs_readpages, */ -+ .writepage = cifs_writepage, -+ .prepare_write = cifs_prepare_write, -+ .commit_write = cifs_commit_write, -+ .sync_page = cifs_sync_page, -+ /*.direct_IO = */ -+}; -diff -urN linux-2.4.29.old/fs/cifs/inode.c linux-2.4.29/fs/cifs/inode.c ---- linux-2.4.29.old/fs/cifs/inode.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/inode.c 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,1079 @@ -+/* -+ * fs/cifs/inode.c -+ * -+ * Copyright (C) International Business Machines Corp., 2002,2003 -+ * Author(s): Steve French (sfrench@us.ibm.com) -+ * -+ * This library is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This library 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 Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * along with this library; 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 "cifsfs.h" -+#include "cifspdu.h" -+#include "cifsglob.h" -+#include "cifsproto.h" -+#include "cifs_debug.h" -+#include "cifs_fs_sb.h" -+ -+extern int is_size_safe_to_change(struct cifsInodeInfo *); -+ -+struct inode * get_cifs_inode(struct super_block * sb) -+{ -+ struct inode * newinode; -+ newinode = new_inode(sb); -+ cFYI(1,("got new inode %p",newinode)); -+ if(newinode) { -+ struct cifsInodeInfo * cifsInfo = CIFS_I(newinode); -+ cifsInfo->clientCanCacheRead = FALSE; -+ cifsInfo->clientCanCacheAll = FALSE; -+ INIT_LIST_HEAD(&cifsInfo->openFileList); -+ cifsInfo->cifsAttrs = 0x20; /* default */ -+ newinode->i_blksize = CIFS_MAX_MSGSIZE; -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,15)) -+ newinode->i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */ -+#endif -+ atomic_set(&cifsInfo->inUse, 0); -+ cifsInfo->time = 0; -+ insert_inode_hash(newinode); -+ } -+ return newinode; -+ -+} -+ -+int -+cifs_get_inode_info_unix(struct inode **pinode, -+ const unsigned char *search_path, -+ struct super_block *sb,int xid) -+{ -+ int rc = 0; -+ FILE_UNIX_BASIC_INFO findData; -+ struct cifsTconInfo *pTcon; -+ struct inode *inode; -+ struct cifs_sb_info *cifs_sb = CIFS_SB(sb); -+ char *tmp_path; -+ -+ pTcon = cifs_sb->tcon; -+ cFYI(1, (" Getting info on %s ", search_path)); -+ /* we could have done a find first instead but this returns more info */ -+ rc = CIFSSMBUnixQPathInfo(xid, pTcon, search_path, &findData, -+ cifs_sb->local_nls); -+ /* dump_mem("\nUnixQPathInfo return data", &findData, sizeof(findData)); */ -+ if (rc) { -+ if (rc == -EREMOTE) { -+ tmp_path = -+ kmalloc(strnlen -+ (pTcon->treeName, -+ MAX_TREE_SIZE + 1) + -+ strnlen(search_path, MAX_PATHCONF) + 1, -+ GFP_KERNEL); -+ if (tmp_path == NULL) { -+ return -ENOMEM; -+ } -+ /* have to skip first of the double backslash of UNC name */ -+ strncpy(tmp_path, pTcon->treeName, MAX_TREE_SIZE); -+ strncat(tmp_path, search_path, MAX_PATHCONF); -+ rc = connect_to_dfs_path(xid, pTcon->ses, -+ /* treename + */ tmp_path, -+ cifs_sb->local_nls); -+ kfree(tmp_path); -+ -+ /* BB fix up inode etc. */ -+ } else if (rc) { -+ return rc; -+ } -+ -+ } else { -+ struct cifsInodeInfo *cifsInfo; -+ -+ /* get new inode */ -+ if (*pinode == NULL) { -+ *pinode = get_cifs_inode(sb); -+ } -+ if(*pinode == NULL) { -+ return -ENOMEM; -+ } -+ -+ inode = *pinode; -+ cifsInfo = CIFS_I(inode); -+ -+ cFYI(1, (" Old time %ld ", cifsInfo->time)); -+ cifsInfo->time = jiffies; -+ cFYI(1, (" New time %ld ", cifsInfo->time)); -+ atomic_set(&cifsInfo->inUse,1); /* ok to set on every refresh of inode */ -+ -+ inode->i_atime = -+ cifs_NTtimeToUnix(le64_to_cpu(findData.LastAccessTime)); -+ inode->i_mtime = -+ cifs_NTtimeToUnix(le64_to_cpu -+ (findData.LastModificationTime)); -+ inode->i_ctime = -+ cifs_NTtimeToUnix(le64_to_cpu(findData.LastStatusChange)); -+ inode->i_mode = le64_to_cpu(findData.Permissions); -+ findData.Type = le32_to_cpu(findData.Type); -+ if (findData.Type == UNIX_FILE) { -+ inode->i_mode |= S_IFREG; -+ } else if (findData.Type == UNIX_SYMLINK) { -+ inode->i_mode |= S_IFLNK; -+ } else if (findData.Type == UNIX_DIR) { -+ inode->i_mode |= S_IFDIR; -+ } else if (findData.Type == UNIX_CHARDEV) { -+ inode->i_mode |= S_IFCHR; -+ inode->i_rdev = MKDEV(le64_to_cpu(findData.DevMajor), -+ le64_to_cpu(findData.DevMinor) & MINORMASK); -+ } else if (findData.Type == UNIX_BLOCKDEV) { -+ inode->i_mode |= S_IFBLK; -+ inode->i_rdev = MKDEV(le64_to_cpu(findData.DevMajor), -+ le64_to_cpu(findData.DevMinor) & MINORMASK); -+ } else if (findData.Type == UNIX_FIFO) { -+ inode->i_mode |= S_IFIFO; -+ } else if (findData.Type == UNIX_SOCKET) { -+ inode->i_mode |= S_IFSOCK; -+ } -+ inode->i_uid = le64_to_cpu(findData.Uid); -+ inode->i_gid = le64_to_cpu(findData.Gid); -+ inode->i_nlink = le64_to_cpu(findData.Nlinks); -+ findData.NumOfBytes = le64_to_cpu(findData.NumOfBytes); -+ findData.EndOfFile = le64_to_cpu(findData.EndOfFile); -+ -+ if(is_size_safe_to_change(cifsInfo)) { -+ /* can not safely change the file size here if the -+ client is writing to it due to potential races */ -+ inode->i_size = findData.EndOfFile; -+/* blksize needs to be multiple of two. So safer to default to blksize -+ and blkbits set in superblock so 2**blkbits and blksize will match */ -+/* inode->i_blksize = -+ (pTcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFE00;*/ -+ -+ /* This seems incredibly stupid but it turns out that -+ i_blocks is not related to (i_size / i_blksize), instead a -+ size of 512 is required to be used for calculating num blocks */ -+ -+ -+/* inode->i_blocks = -+ (inode->i_blksize - 1 + findData.NumOfBytes) >> inode->i_blkbits;*/ -+ -+ /* 512 bytes (2**9) is the fake blocksize that must be used */ -+ /* for this calculation */ -+ inode->i_blocks = (512 - 1 + findData.NumOfBytes) >> 9; -+ } -+ -+ if (findData.NumOfBytes < findData.EndOfFile) -+ cFYI(1, ("Server inconsistency Error: it says allocation size less than end of file ")); -+ cFYI(1, -+ ("Size %ld and blocks %ld ", -+ (unsigned long) inode->i_size, inode->i_blocks)); -+ if (S_ISREG(inode->i_mode)) { -+ cFYI(1, (" File inode ")); -+ inode->i_op = &cifs_file_inode_ops; -+ inode->i_fop = &cifs_file_ops; -+ inode->i_data.a_ops = &cifs_addr_ops; -+ } else if (S_ISDIR(inode->i_mode)) { -+ cFYI(1, (" Directory inode")); -+ inode->i_op = &cifs_dir_inode_ops; -+ inode->i_fop = &cifs_dir_ops; -+ } else if (S_ISLNK(inode->i_mode)) { -+ cFYI(1, (" Symbolic Link inode ")); -+ inode->i_op = &cifs_symlink_inode_ops; -+/* tmp_inode->i_fop = *//* do not need to set to anything */ -+ } else { -+ cFYI(1, (" Init special inode ")); -+ init_special_inode(inode, inode->i_mode, -+ kdev_t_to_nr(inode->i_rdev)); -+ } -+ } -+ return rc; -+} -+ -+int -+cifs_get_inode_info(struct inode **pinode, const unsigned char *search_path, -+ FILE_ALL_INFO * pfindData, struct super_block *sb, int xid) -+{ -+ int rc = 0; -+ struct cifsTconInfo *pTcon; -+ struct inode *inode; -+ struct cifs_sb_info *cifs_sb = CIFS_SB(sb); -+ char *tmp_path; -+ char *buf = NULL; -+ -+ pTcon = cifs_sb->tcon; -+ cFYI(1,("Getting info on %s ", search_path)); -+ -+ if((pfindData == NULL) && (*pinode != NULL)) { -+ if(CIFS_I(*pinode)->clientCanCacheRead) { -+ cFYI(1,("No need to revalidate inode sizes on cached file ")); -+ return rc; -+ } -+ } -+ -+ /* if file info not passed in then get it from server */ -+ if(pfindData == NULL) { -+ buf = kmalloc(sizeof(FILE_ALL_INFO),GFP_KERNEL); -+ pfindData = (FILE_ALL_INFO *)buf; -+ /* could do find first instead but this returns more info */ -+ rc = CIFSSMBQPathInfo(xid, pTcon, search_path, pfindData, -+ cifs_sb->local_nls); -+ } -+ /* dump_mem("\nQPathInfo return data",&findData, sizeof(findData)); */ -+ if (rc) { -+ if (rc == -EREMOTE) { -+ tmp_path = -+ kmalloc(strnlen -+ (pTcon->treeName, -+ MAX_TREE_SIZE + 1) + -+ strnlen(search_path, MAX_PATHCONF) + 1, -+ GFP_KERNEL); -+ if (tmp_path == NULL) { -+ if(buf) -+ kfree(buf); -+ return -ENOMEM; -+ } -+ -+ strncpy(tmp_path, pTcon->treeName, MAX_TREE_SIZE); -+ strncat(tmp_path, search_path, MAX_PATHCONF); -+ rc = connect_to_dfs_path(xid, pTcon->ses, -+ /* treename + */ tmp_path, -+ cifs_sb->local_nls); -+ kfree(tmp_path); -+ /* BB fix up inode etc. */ -+ } else if (rc) { -+ if(buf) -+ kfree(buf); -+ return rc; -+ } -+ } else { -+ struct cifsInodeInfo *cifsInfo; -+ -+ /* get new inode */ -+ if (*pinode == NULL) { -+ *pinode = get_cifs_inode(sb); -+ } -+ if(*pinode == NULL) -+ return -ENOMEM; -+ inode = *pinode; -+ cifsInfo = CIFS_I(inode); -+ pfindData->Attributes = le32_to_cpu(pfindData->Attributes); -+ cifsInfo->cifsAttrs = pfindData->Attributes; -+ cFYI(1, (" Old time %ld ", cifsInfo->time)); -+ cifsInfo->time = jiffies; -+ cFYI(1, (" New time %ld ", cifsInfo->time)); -+ -+/* blksize needs to be multiple of two. So safer to default to blksize -+ and blkbits set in superblock so 2**blkbits and blksize will match */ -+/* inode->i_blksize = -+ (pTcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFE00;*/ -+ -+ /* Linux can not store file creation time unfortunately so we ignore it */ -+ inode->i_atime = -+ cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastAccessTime)); -+ inode->i_mtime = -+ cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastWriteTime)); -+ inode->i_ctime = -+ cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime)); -+ cFYI(0, -+ (" Attributes came in as 0x%x ", pfindData->Attributes)); -+ -+ /* set default mode. will override for dirs below */ -+ if(atomic_read(&cifsInfo->inUse) == 0) -+ /* new inode, can safely set these fields */ -+ inode->i_mode = cifs_sb->mnt_file_mode; -+ -+ if (pfindData->Attributes & ATTR_REPARSE) { -+ /* Can IFLNK be set as it basically is on windows with IFREG or IFDIR? */ -+ inode->i_mode |= S_IFLNK; -+ } else if (pfindData->Attributes & ATTR_DIRECTORY) { -+ /* override default perms since we do not do byte range locking on dirs */ -+ inode->i_mode = cifs_sb->mnt_dir_mode; -+ inode->i_mode |= S_IFDIR; -+ } else { -+ inode->i_mode |= S_IFREG; -+ /* treat the dos attribute of read-only as read-only mode e.g. 555 */ -+ if(cifsInfo->cifsAttrs & ATTR_READONLY) -+ inode->i_mode &= ~(S_IWUGO); -+ /* BB add code here - validate if device or weird share or device type? */ -+ } -+ if(is_size_safe_to_change(cifsInfo)) { -+ /* can not safely change the file size here if the -+ client is writing to it due to potential races */ -+ inode->i_size = le64_to_cpu(pfindData->EndOfFile); -+ -+ /* 512 bytes (2**9) is the fake blocksize that must be used */ -+ /* for this calculation */ -+ inode->i_blocks = (512 - 1 + pfindData->AllocationSize) -+ >> 9; -+ } -+ pfindData->AllocationSize = le64_to_cpu(pfindData->AllocationSize); -+ -+ cFYI(1, -+ (" Size %ld and blocks %ld ", -+ (unsigned long) inode->i_size, inode->i_blocks)); -+ inode->i_nlink = le32_to_cpu(pfindData->NumberOfLinks); -+ -+ /* BB fill in uid and gid here? with help from winbind? -+ or retrieve from NTFS stream extended attribute */ -+ if(atomic_read(&cifsInfo->inUse) == 0) { -+ inode->i_uid = cifs_sb->mnt_uid; -+ inode->i_gid = cifs_sb->mnt_gid; -+ /* set so we do not keep refreshing these fields with -+ bad data after user has changed them in memory */ -+ atomic_set(&cifsInfo->inUse,1); -+ } -+ -+ if (S_ISREG(inode->i_mode)) { -+ cFYI(1, (" File inode ")); -+ inode->i_op = &cifs_file_inode_ops; -+ inode->i_fop = &cifs_file_ops; -+ inode->i_data.a_ops = &cifs_addr_ops; -+ } else if (S_ISDIR(inode->i_mode)) { -+ cFYI(1, (" Directory inode ")); -+ inode->i_op = &cifs_dir_inode_ops; -+ inode->i_fop = &cifs_dir_ops; -+ } else if (S_ISLNK(inode->i_mode)) { -+ cFYI(1, (" Symbolic Link inode ")); -+ inode->i_op = &cifs_symlink_inode_ops; -+ } else { -+ init_special_inode(inode, inode->i_mode, -+ kdev_t_to_nr(inode->i_rdev)); -+ } -+ } -+ if(buf) -+ kfree(buf); -+ return rc; -+} -+ -+void -+cifs_read_inode(struct inode *inode) -+{ /* gets root inode */ -+ int xid; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsInodeInfo *cifs_inode; -+ -+ cifs_sb = CIFS_SB(inode->i_sb); -+ xid = GetXid(); -+ -+ cifs_inode = CIFS_I(inode); -+ cifs_inode->cifsAttrs = ATTR_DIRECTORY; -+ atomic_set(&cifs_inode->inUse, 0); -+ cifs_inode->time = 0; -+ inode->i_blksize = CIFS_MAX_MSGSIZE; -+ inode->i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */ -+ -+ INIT_LIST_HEAD(&cifs_inode->openFileList); -+ -+ if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) -+ cifs_get_inode_info_unix(&inode, "", inode->i_sb,xid); -+ else -+ cifs_get_inode_info(&inode, "", NULL, inode->i_sb,xid); -+ /* can not call macro FreeXid here since in a void func */ -+ _FreeXid(xid); -+} -+ -+int -+cifs_unlink(struct inode *inode, struct dentry *direntry) -+{ -+ int rc = 0; -+ int xid; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ char *full_path = NULL; -+ struct cifsInodeInfo *cifsInode; -+ FILE_BASIC_INFO * pinfo_buf; -+ -+ cFYI(1, (" cifs_unlink, inode = 0x%p with ", inode)); -+ -+ xid = GetXid(); -+ -+ cifs_sb = CIFS_SB(inode->i_sb); -+ pTcon = cifs_sb->tcon; -+ -+/* Unlink can be called from rename so we can not grab -+ the sem here since we deadlock otherwise */ -+/* down(&direntry->d_sb->s_vfs_rename_sem);*/ -+ full_path = build_path_from_dentry(direntry); -+/* up(&direntry->d_sb->s_vfs_rename_sem);*/ -+ if(full_path == NULL) { -+ FreeXid(xid); -+ return -ENOMEM; -+ } -+ rc = CIFSSMBDelFile(xid, pTcon, full_path, cifs_sb->local_nls); -+ -+ if (!rc) { -+ direntry->d_inode->i_nlink--; -+ } else if (rc == -ENOENT) { -+ d_drop(direntry); -+ } else if (rc == -ETXTBSY) { -+ int oplock = FALSE; -+ __u16 netfid; -+ -+ rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, DELETE, -+ CREATE_NOT_DIR | CREATE_DELETE_ON_CLOSE, -+ &netfid, &oplock, NULL, cifs_sb->local_nls); -+ if(rc==0) { -+ CIFSSMBRenameOpenFile(xid,pTcon,netfid, -+ NULL, cifs_sb->local_nls); -+ CIFSSMBClose(xid, pTcon, netfid); -+ direntry->d_inode->i_nlink--; -+ } -+ } else if (rc == -EACCES) { -+ /* try only if r/o attribute set in local lookup data? */ -+ pinfo_buf = (FILE_BASIC_INFO *)kmalloc(sizeof(FILE_BASIC_INFO),GFP_KERNEL); -+ if(pinfo_buf) { -+ memset(pinfo_buf,0,sizeof(FILE_BASIC_INFO)); -+ /* ATTRS set to normal clears r/o bit */ -+ pinfo_buf->Attributes = cpu_to_le32(ATTR_NORMAL); -+ rc = CIFSSMBSetTimes(xid, pTcon, full_path, pinfo_buf, -+ cifs_sb->local_nls); -+ kfree(pinfo_buf); -+ } -+ if(rc==0) { -+ rc = CIFSSMBDelFile(xid, pTcon, full_path, cifs_sb->local_nls); -+ if (!rc) { -+ direntry->d_inode->i_nlink--; -+ } else if (rc == -ETXTBSY) { -+ int oplock = FALSE; -+ __u16 netfid; -+ -+ rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, DELETE, -+ CREATE_NOT_DIR | CREATE_DELETE_ON_CLOSE, -+ &netfid, &oplock, NULL, cifs_sb->local_nls); -+ if(rc==0) { -+ CIFSSMBRenameOpenFile(xid,pTcon,netfid,NULL,cifs_sb->local_nls); -+ CIFSSMBClose(xid, pTcon, netfid); -+ direntry->d_inode->i_nlink--; -+ } -+ /* BB if rc = -ETXTBUSY goto the rename logic BB */ -+ } -+ } -+ } -+ cifsInode = CIFS_I(direntry->d_inode); -+ cifsInode->time = 0; /* will force revalidate to get info when needed */ -+ direntry->d_inode->i_ctime = inode->i_ctime = inode->i_mtime = -+ CURRENT_TIME; -+ cifsInode = CIFS_I(inode); -+ cifsInode->time = 0; /* force revalidate of dir as well */ -+ -+ if (full_path) -+ kfree(full_path); -+ FreeXid(xid); -+ return rc; -+} -+ -+int -+cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) -+{ -+ int rc = 0; -+ int xid; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ char *full_path = NULL; -+ struct inode *newinode = NULL; -+ -+ cFYI(1, ("In cifs_mkdir, mode = 0x%x inode = 0x%p ", mode, inode)); -+ -+ xid = GetXid(); -+ -+ cifs_sb = CIFS_SB(inode->i_sb); -+ pTcon = cifs_sb->tcon; -+ -+ down(&inode->i_sb->s_vfs_rename_sem); -+ full_path = build_path_from_dentry(direntry); -+ up(&inode->i_sb->s_vfs_rename_sem); -+ if(full_path == NULL) { -+ FreeXid(xid); -+ return -ENOMEM; -+ } -+ /* BB add setting the equivalent of mode via CreateX w/ACLs */ -+ rc = CIFSSMBMkDir(xid, pTcon, full_path, cifs_sb->local_nls); -+ if (rc) { -+ cFYI(1, ("cifs_mkdir returned 0x%x ", rc)); -+ d_drop(direntry); -+ } else { -+ inode->i_nlink++; -+ if (pTcon->ses->capabilities & CAP_UNIX) -+ rc = cifs_get_inode_info_unix(&newinode, full_path, -+ inode->i_sb,xid); -+ else -+ rc = cifs_get_inode_info(&newinode, full_path,NULL, -+ inode->i_sb,xid); -+ -+ direntry->d_op = &cifs_dentry_ops; -+ d_instantiate(direntry, newinode); -+ if(direntry->d_inode) -+ direntry->d_inode->i_nlink = 2; -+ if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) -+ CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode, -+ (__u64)-1, -+ (__u64)-1, -+ 0 /* dev_t */, -+ cifs_sb->local_nls); -+ else { /* BB to be implemented via Windows secrty descriptors*/ -+ /* eg CIFSSMBWinSetPerms(xid,pTcon,full_path,mode,-1,-1,local_nls);*/ -+ } -+ } -+ if (full_path) -+ kfree(full_path); -+ FreeXid(xid); -+ -+ return rc; -+} -+ -+int -+cifs_rmdir(struct inode *inode, struct dentry *direntry) -+{ -+ int rc = 0; -+ int xid; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ char *full_path = NULL; -+ struct cifsInodeInfo *cifsInode; -+ -+ cFYI(1, (" cifs_rmdir, inode = 0x%p with ", inode)); -+ -+ xid = GetXid(); -+ -+ cifs_sb = CIFS_SB(inode->i_sb); -+ pTcon = cifs_sb->tcon; -+ -+ down(&inode->i_sb->s_vfs_rename_sem); -+ full_path = build_path_from_dentry(direntry); -+ up(&inode->i_sb->s_vfs_rename_sem); -+ if(full_path == NULL) { -+ FreeXid(xid); -+ return -ENOMEM; -+ } -+ -+ rc = CIFSSMBRmDir(xid, pTcon, full_path, cifs_sb->local_nls); -+ -+ if (!rc) { -+ inode->i_nlink--; -+ direntry->d_inode->i_size = 0; -+ direntry->d_inode->i_nlink = 0; -+ } -+ -+ cifsInode = CIFS_I(direntry->d_inode); -+ cifsInode->time = 0; /* force revalidate to go get info when needed */ -+ direntry->d_inode->i_ctime = inode->i_ctime = inode->i_mtime = -+ CURRENT_TIME; -+ -+ if (full_path) -+ kfree(full_path); -+ FreeXid(xid); -+ return rc; -+} -+ -+int -+cifs_rename(struct inode *source_inode, struct dentry *source_direntry, -+ struct inode *target_inode, struct dentry *target_direntry) -+{ -+ char *fromName; -+ char *toName; -+ struct cifs_sb_info *cifs_sb_source; -+ struct cifs_sb_info *cifs_sb_target; -+ struct cifsTconInfo *pTcon; -+ int xid; -+ int rc = 0; -+ -+ xid = GetXid(); -+ -+ cifs_sb_target = CIFS_SB(target_inode->i_sb); -+ cifs_sb_source = CIFS_SB(source_inode->i_sb); -+ pTcon = cifs_sb_source->tcon; -+ -+ if (pTcon != cifs_sb_target->tcon) { -+ FreeXid(xid); -+ return -EXDEV; /* BB actually could be allowed if same server, but -+ different share. Might eventually add support for this */ -+ } -+ -+ /* we already have the rename sem so we do not need -+ to grab it again here to protect the path integrity */ -+ fromName = build_path_from_dentry(source_direntry); -+ toName = build_path_from_dentry(target_direntry); -+ if((fromName == NULL) || (toName == NULL)) { -+ rc = -ENOMEM; -+ goto cifs_rename_exit; -+ } -+ -+ rc = CIFSSMBRename(xid, pTcon, fromName, toName, -+ cifs_sb_source->local_nls); -+ if(rc == -EEXIST) { -+ /* check if they are the same file -+ because rename of hardlinked files is a noop */ -+ FILE_UNIX_BASIC_INFO * info_buf_source; -+ FILE_UNIX_BASIC_INFO * info_buf_target; -+ -+ info_buf_source = -+ kmalloc(2 * sizeof(FILE_UNIX_BASIC_INFO),GFP_KERNEL); -+ if(info_buf_source != NULL) { -+ info_buf_target = info_buf_source+1; -+ rc = CIFSSMBUnixQPathInfo(xid, pTcon, fromName, -+ info_buf_source, cifs_sb_source->local_nls); -+ if(rc == 0) { -+ rc = CIFSSMBUnixQPathInfo(xid,pTcon,toName, -+ info_buf_target, -+ cifs_sb_target->local_nls); -+ } -+ if((rc == 0) && -+ (info_buf_source->UniqueId == -+ info_buf_target->UniqueId)) { -+ /* do not rename since the files are hardlinked -+ which is a noop */ -+ } else { -+ /* we either can not tell the files are hardlinked -+ (as with Windows servers) or files are not hardlinked -+ so delete the target manually before renaming to -+ follow POSIX rather than Windows semantics */ -+ cifs_unlink(target_inode, target_direntry); -+ rc = CIFSSMBRename(xid, pTcon, fromName, toName, -+ cifs_sb_source->local_nls); -+ } -+ kfree(info_buf_source); -+ } /* if we can not get memory just leave rc as EEXIST */ -+ } -+ -+ if((rc == -EIO)||(rc == -EEXIST)) { -+ int oplock = FALSE; -+ __u16 netfid; -+ -+ rc = CIFSSMBOpen(xid, pTcon, fromName, FILE_OPEN, GENERIC_READ, -+ CREATE_NOT_DIR, -+ &netfid, &oplock, NULL, cifs_sb_source->local_nls); -+ if(rc==0) { -+ CIFSSMBRenameOpenFile(xid,pTcon,netfid, -+ toName, cifs_sb_source->local_nls); -+ CIFSSMBClose(xid, pTcon, netfid); -+ } -+ } -+ -+cifs_rename_exit: -+ if (fromName) -+ kfree(fromName); -+ if (toName) -+ kfree(toName); -+ -+ FreeXid(xid); -+ return rc; -+} -+ -+int -+cifs_revalidate(struct dentry *direntry) -+{ -+ int xid; -+ int rc = 0; -+ char *full_path; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsInodeInfo *cifsInode; -+ loff_t local_size; -+ time_t local_mtime; -+ int invalidate_inode = FALSE; -+ -+ if(direntry->d_inode == NULL) -+ return -ENOENT; -+ -+ cifsInode = CIFS_I(direntry->d_inode); -+ -+ if(cifsInode == NULL) -+ return -ENOENT; -+ -+ /* no sense revalidating inode info on file that no one can write */ -+ if(CIFS_I(direntry->d_inode)->clientCanCacheRead) -+ return rc; -+ -+ xid = GetXid(); -+ -+ cifs_sb = CIFS_SB(direntry->d_sb); -+ -+ /* can not safely grab the rename sem here if -+ rename calls revalidate since that would deadlock */ -+ full_path = build_path_from_dentry(direntry); -+ if(full_path == NULL) { -+ FreeXid(xid); -+ return -ENOMEM; -+ } -+ cFYI(1, -+ ("Revalidate: %s inode 0x%p count %d dentry: 0x%p d_time %ld jiffies %ld", -+ full_path, direntry->d_inode, -+ direntry->d_inode->i_count.counter, direntry, -+ direntry->d_time, jiffies)); -+ -+ if (cifsInode->time == 0){ -+ /* was set to zero previously to force revalidate */ -+ } else if (time_before(jiffies, cifsInode->time + HZ) && lookupCacheEnabled) { -+ if((S_ISREG(direntry->d_inode->i_mode) == 0) || -+ (direntry->d_inode->i_nlink == 1)) { -+ if (full_path) -+ kfree(full_path); -+ FreeXid(xid); -+ return rc; -+ } else { -+ cFYI(1,("Have to revalidate file due to hardlinks")); -+ } -+ } -+ -+ /* save mtime and size */ -+ local_mtime = direntry->d_inode->i_mtime; -+ local_size = direntry->d_inode->i_size; -+ -+ if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) { -+ rc = cifs_get_inode_info_unix(&direntry->d_inode, full_path, -+ direntry->d_sb,xid); -+ if(rc) { -+ cFYI(1,("error on getting revalidate info %d",rc)); -+/* if(rc != -ENOENT) -+ rc = 0; */ /* BB should we cache info on certain errors? */ -+ } -+ } else { -+ rc = cifs_get_inode_info(&direntry->d_inode, full_path, NULL, -+ direntry->d_sb,xid); -+ if(rc) { -+ cFYI(1,("error on getting revalidate info %d",rc)); -+/* if(rc != -ENOENT) -+ rc = 0; */ /* BB should we cache info on certain errors? */ -+ } -+ } -+ /* should we remap certain errors, access denied?, to zero */ -+ -+ /* if not oplocked, we invalidate inode pages if mtime -+ or file size had changed on server */ -+ -+ if((local_mtime == direntry->d_inode->i_mtime) && -+ (local_size == direntry->d_inode->i_size)) { -+ cFYI(1,("cifs_revalidate - inode unchanged")); -+ } else { -+ /* file may have changed on server */ -+ if(cifsInode->clientCanCacheRead) { -+ /* no need to invalidate inode pages since we were -+ the only ones who could have modified the file and -+ the server copy is staler than ours */ -+ } else { -+ invalidate_inode = TRUE; -+ } -+ } -+ -+ /* can not grab this sem since kernel filesys locking -+ documentation indicates i_sem may be taken by the kernel -+ on lookup and rename which could deadlock if we grab -+ the i_sem here as well */ -+/* down(&direntry->d_inode->i_sem);*/ -+ /* need to write out dirty pages here */ -+ if(direntry->d_inode->i_mapping) { -+ /* do we need to lock inode until after invalidate completes below? */ -+ filemap_fdatasync(direntry->d_inode->i_mapping); -+ } -+ if(invalidate_inode) { -+ filemap_fdatawait(direntry->d_inode->i_mapping); -+ /* may eventually have to do this for open files too */ -+ if(list_empty(&(cifsInode->openFileList))) { -+ /* Has changed on server - flush read ahead pages */ -+ cFYI(1,("Invalidating read ahead data on closed file")); -+ invalidate_inode_pages(direntry->d_inode); -+ } -+ } -+/* up(&direntry->d_inode->i_sem);*/ -+ -+ if (full_path) -+ kfree(full_path); -+ FreeXid(xid); -+ -+ return rc; -+} -+ -+/* int cifs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) -+{ -+ int err = cifs_revalidate(dentry); -+ if (!err) -+ generic_fillattr(dentry->d_inode, stat); -+ return err; -+} */ -+ -+void -+cifs_truncate_file(struct inode *inode) -+{ /* BB remove - may not need this function after all BB */ -+ int xid; -+ int rc = -EIO; -+ int found = FALSE; -+ struct cifsFileInfo *open_file = NULL; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ struct cifsInodeInfo *cifsInode; -+ struct dentry *dirent; -+ struct list_head * tmp; -+ char *full_path = NULL; -+ -+ xid = GetXid(); -+ -+ cifs_sb = CIFS_SB(inode->i_sb); -+ pTcon = cifs_sb->tcon; -+ -+ /* To avoid spurious oplock breaks from server, in the case -+ of inodes that we already have open, avoid doing path -+ based setting of file size if we can do it by handle. -+ This keeps our caching token (oplock) and avoids -+ timeouts when the local oplock break takes longer to flush -+ writebehind data than the SMB timeout for the SetPathInfo -+ request would allow */ -+ read_lock(&GlobalSMBSeslock); -+ cifsInode = CIFS_I(inode); -+ list_for_each(tmp, &cifsInode->openFileList) { -+ open_file = list_entry(tmp,struct cifsFileInfo, flist); -+ /* We check if file is open for writing first */ -+ if((open_file->pfile) && (!open_file->invalidHandle) && -+ ((open_file->pfile->f_flags & O_RDWR) || -+ (open_file->pfile->f_flags & O_WRONLY))) { -+ read_unlock(&GlobalSMBSeslock); -+ found = TRUE; -+ rc = CIFSSMBSetFileSize(xid, pTcon, inode->i_size, -+ open_file->netfid,open_file->pid,FALSE); -+ if(rc == 0) { -+ FreeXid(xid); -+ return; -+ } -+ /* Do not need reopen and retry on EAGAIN since we will -+ retry by pathname below */ -+ if(rc == -EAGAIN) -+ rc = -EHOSTDOWN; -+ -+ break; /* now that we found one valid file handle no -+ sense continuing to loop trying others */ -+ } -+ } -+ if(found == FALSE) -+ read_unlock(&GlobalSMBSeslock); -+ -+ if (list_empty(&inode->i_dentry)) { -+ cERROR(1, -+ ("Can not get pathname from empty dentry in inode 0x%p ", -+ inode)); -+ FreeXid(xid); -+ return; -+ } -+ -+ dirent = list_entry(inode->i_dentry.next, struct dentry, d_alias); -+ if (dirent) { -+ full_path = build_path_from_dentry(dirent); -+ rc = CIFSSMBSetEOF(xid, pTcon, full_path, inode->i_size,FALSE, -+ cifs_sb->local_nls); -+ cFYI(1,(" SetEOF (truncate) rc = %d",rc)); -+ if (!rc) -+ CIFSSMBSetEOF(xid,pTcon,full_path,inode->i_size,TRUE,cifs_sb->local_nls); -+ /* allocation size setting seems optional so ignore return code */ -+ } -+ if (full_path) -+ kfree(full_path); -+ FreeXid(xid); -+ return; -+} -+ -+static int cifs_truncate_page(struct address_space *mapping, loff_t from) -+{ -+ unsigned long index = from >> PAGE_CACHE_SHIFT; -+ unsigned offset = from & (PAGE_CACHE_SIZE-1); -+ struct page *page; -+ char *kaddr; -+ int rc = 0; -+ -+ page = grab_cache_page(mapping, index); -+ if (!page) -+ return -ENOMEM; -+ -+ kaddr = kmap_atomic(page, KM_USER0); -+ memset(kaddr + offset, 0, PAGE_CACHE_SIZE - offset); -+ flush_dcache_page(page); -+ kunmap_atomic(kaddr, KM_USER0); -+ unlock_page(page); -+ page_cache_release(page); -+ return rc; -+} -+ -+int -+cifs_setattr(struct dentry *direntry, struct iattr *attrs) -+{ -+ int xid; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ char *full_path = NULL; -+ int rc = -EACCES; -+ int found = FALSE; -+ struct cifsFileInfo *open_file = NULL; -+ FILE_BASIC_INFO time_buf; -+ int set_time = FALSE; -+ __u64 mode = 0xFFFFFFFFFFFFFFFFULL; -+ __u64 uid = 0xFFFFFFFFFFFFFFFFULL; -+ __u64 gid = 0xFFFFFFFFFFFFFFFFULL; -+ struct cifsInodeInfo *cifsInode; -+ struct list_head * tmp; -+ -+ xid = GetXid(); -+ -+ cFYI(1, -+ (" In cifs_setattr, name = %s attrs->iavalid 0x%x ", -+ direntry->d_name.name, attrs->ia_valid)); -+ cifs_sb = CIFS_SB(direntry->d_inode->i_sb); -+ pTcon = cifs_sb->tcon; -+ -+ down(&direntry->d_sb->s_vfs_rename_sem); -+ full_path = build_path_from_dentry(direntry); -+ up(&direntry->d_sb->s_vfs_rename_sem); -+ if(full_path == NULL) { -+ FreeXid(xid); -+ return -ENOMEM; -+ } -+ cifsInode = CIFS_I(direntry->d_inode); -+ -+ /* BB check if we need to refresh inode from server now ? BB */ -+ -+ /* need to flush data before changing file size on server */ -+ filemap_fdatasync(direntry->d_inode->i_mapping); -+ -+ if (attrs->ia_valid & ATTR_SIZE) { -+ read_lock(&GlobalSMBSeslock); -+ /* To avoid spurious oplock breaks from server, in the case -+ of inodes that we already have open, avoid doing path -+ based setting of file size if we can do it by handle. -+ This keeps our caching token (oplock) and avoids -+ timeouts when the local oplock break takes longer to flush -+ writebehind data than the SMB timeout for the SetPathInfo -+ request would allow */ -+ list_for_each(tmp, &cifsInode->openFileList) { -+ open_file = list_entry(tmp,struct cifsFileInfo, flist); -+ /* We check if file is open for writing first */ -+ if((open_file->pfile) && -+ ((open_file->pfile->f_flags & O_RDWR) || -+ (open_file->pfile->f_flags & O_WRONLY))) { -+ if(open_file->invalidHandle == FALSE) { -+ /* we found a valid, writeable network file -+ handle to use to try to set the file size */ -+ __u16 nfid = open_file->netfid; -+ __u32 npid = open_file->pid; -+ read_unlock(&GlobalSMBSeslock); -+ found = TRUE; -+ rc = CIFSSMBSetFileSize(xid, pTcon, attrs->ia_size, -+ nfid,npid,FALSE); -+ cFYI(1,("SetFileSize by handle (setattrs) rc = %d",rc)); -+ /* Do not need reopen and retry on EAGAIN since we will -+ retry by pathname below */ -+ -+ break; /* now that we found one valid file handle no -+ sense continuing to loop trying others */ -+ } -+ } -+ } -+ if(found == FALSE) { -+ read_unlock(&GlobalSMBSeslock); -+ } -+ -+ -+ if(rc != 0) { -+ /* Set file size by pathname rather than by handle either -+ because no valid, writeable file handle for it was found or -+ because there was an error setting it by handle */ -+ rc = CIFSSMBSetEOF(xid, pTcon, full_path, attrs->ia_size,FALSE, -+ cifs_sb->local_nls); -+ cFYI(1,(" SetEOF by path (setattrs) rc = %d",rc)); -+ } -+ -+ /* Server is ok setting allocation size implicitly - no need to call: */ -+ /*CIFSSMBSetEOF(xid, pTcon, full_path, attrs->ia_size, TRUE, cifs_sb->local_nls);*/ -+ -+ if (rc == 0) { -+ rc = vmtruncate(direntry->d_inode, attrs->ia_size); -+ cifs_truncate_page(direntry->d_inode->i_mapping, direntry->d_inode->i_size); -+ } -+ } -+ if (attrs->ia_valid & ATTR_UID) { -+ cFYI(1, (" CIFS - UID changed to %d", attrs->ia_uid)); -+ uid = attrs->ia_uid; -+ /* entry->uid = cpu_to_le16(attr->ia_uid); */ -+ } -+ if (attrs->ia_valid & ATTR_GID) { -+ cFYI(1, (" CIFS - GID changed to %d", attrs->ia_gid)); -+ gid = attrs->ia_gid; -+ /* entry->gid = cpu_to_le16(attr->ia_gid); */ -+ } -+ -+ time_buf.Attributes = 0; -+ if (attrs->ia_valid & ATTR_MODE) { -+ cFYI(1, (" CIFS - Mode changed to 0x%x", attrs->ia_mode)); -+ mode = attrs->ia_mode; -+ /* entry->mode = cpu_to_le16(attr->ia_mode); */ -+ } -+ -+ if ((cifs_sb->tcon->ses->capabilities & CAP_UNIX) -+ && (attrs->ia_valid & (ATTR_MODE | ATTR_GID | ATTR_UID))) -+ rc = CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode, uid, gid, -+ 0 /* dev_t */, cifs_sb->local_nls); -+ else if (attrs->ia_valid & ATTR_MODE) { -+ if((mode & S_IWUGO) == 0) /* not writeable */ { -+ if((cifsInode->cifsAttrs & ATTR_READONLY) == 0) -+ time_buf.Attributes = -+ cpu_to_le32(cifsInode->cifsAttrs | ATTR_READONLY); -+ } else if((mode & S_IWUGO) == S_IWUGO) { -+ if(cifsInode->cifsAttrs & ATTR_READONLY) -+ time_buf.Attributes = -+ cpu_to_le32(cifsInode->cifsAttrs & (~ATTR_READONLY)); -+ } -+ /* BB to be implemented - via Windows security descriptors or streams */ -+ /* CIFSSMBWinSetPerms(xid,pTcon,full_path,mode,uid,gid,cifs_sb->local_nls);*/ -+ } -+ -+ if (attrs->ia_valid & ATTR_ATIME) { -+ set_time = TRUE; -+ time_buf.LastAccessTime = -+ cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_atime)); -+ } else -+ time_buf.LastAccessTime = 0; -+ -+ if (attrs->ia_valid & ATTR_MTIME) { -+ set_time = TRUE; -+ time_buf.LastWriteTime = -+ cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_mtime)); -+ } else -+ time_buf.LastWriteTime = 0; -+ -+ if (attrs->ia_valid & ATTR_CTIME) { -+ set_time = TRUE; -+ time_buf.ChangeTime = -+ cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_ctime)); -+ } else -+ time_buf.ChangeTime = 0; -+ -+ if (set_time | time_buf.Attributes) { -+ /* BB what if setting one attribute fails -+ (such as size) but time setting works */ -+ time_buf.CreationTime = 0; /* do not change */ -+ /* In the future we should experiment - try setting timestamps -+ via Handle (SetFileInfo) instead of by path */ -+ rc = CIFSSMBSetTimes(xid, pTcon, full_path, &time_buf, -+ cifs_sb->local_nls); -+ } -+ -+ /* do not need local check to inode_check_ok since the server does that */ -+ if (!rc) -+ rc = inode_setattr(direntry->d_inode, attrs); -+ if (full_path) -+ kfree(full_path); -+ FreeXid(xid); -+ return rc; -+} -+ -+void -+cifs_delete_inode(struct inode *inode) -+{ -+ cFYI(1, ("In cifs_delete_inode, inode = 0x%p ", inode)); -+ /* may have to add back in if and when safe distributed caching of -+ directories added e.g. via FindNotify */ -+} -diff -urN linux-2.4.29.old/fs/cifs/link.c linux-2.4.29/fs/cifs/link.c ---- linux-2.4.29.old/fs/cifs/link.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/link.c 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,328 @@ -+/* -+ * fs/cifs/link.c -+ * -+ * Copyright (C) International Business Machines Corp., 2002,2003 -+ * Author(s): Steve French (sfrench@us.ibm.com) -+ * -+ * This library is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This library 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 Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+#include -+#include -+#include "cifsfs.h" -+#include "cifspdu.h" -+#include "cifsglob.h" -+#include "cifsproto.h" -+#include "cifs_debug.h" -+#include "cifs_fs_sb.h" -+ -+int -+cifs_hardlink(struct dentry *old_file, struct inode *inode, -+ struct dentry *direntry) -+{ -+ int rc = -EACCES; -+ int xid; -+ char *fromName = NULL; -+ char *toName = NULL; -+ struct cifs_sb_info *cifs_sb_target; -+ struct cifsTconInfo *pTcon; -+ struct cifsInodeInfo *cifsInode; -+ -+ xid = GetXid(); -+ -+ cifs_sb_target = CIFS_SB(inode->i_sb); -+ pTcon = cifs_sb_target->tcon; -+ -+/* No need to check for cross device links since server will do that -+ BB note DFS case in future though (when we may have to check) */ -+ -+ down(&inode->i_sb->s_vfs_rename_sem); -+ fromName = build_path_from_dentry(old_file); -+ toName = build_path_from_dentry(direntry); -+ up(&inode->i_sb->s_vfs_rename_sem); -+ if((fromName == NULL) || (toName == NULL)) { -+ rc = -ENOMEM; -+ goto cifs_hl_exit; -+ } -+ -+ if (cifs_sb_target->tcon->ses->capabilities & CAP_UNIX) -+ rc = CIFSUnixCreateHardLink(xid, pTcon, fromName, toName, -+ cifs_sb_target->local_nls); -+ else { -+ rc = CIFSCreateHardLink(xid, pTcon, fromName, toName, -+ cifs_sb_target->local_nls); -+ if(rc == -EIO) -+ rc = -EOPNOTSUPP; -+ } -+ -+/* if (!rc) */ -+ { -+ /* renew_parental_timestamps(old_file); -+ inode->i_nlink++; -+ mark_inode_dirty(inode); -+ d_instantiate(direntry, inode); */ -+ /* BB add call to either mark inode dirty or refresh its data and timestamp to current time */ -+ } -+ d_drop(direntry); /* force new lookup from server */ -+ cifsInode = CIFS_I(old_file->d_inode); -+ cifsInode->time = 0; /* will force revalidate to go get info when needed */ -+ -+cifs_hl_exit: -+ if (fromName) -+ kfree(fromName); -+ if (toName) -+ kfree(toName); -+ FreeXid(xid); -+ return rc; -+} -+ -+int -+cifs_follow_link(struct dentry *direntry, struct nameidata *nd) -+{ -+ struct inode *inode = direntry->d_inode; -+ int rc = -EACCES; -+ int xid; -+ char *full_path = NULL; -+ char * target_path; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ -+ xid = GetXid(); -+ -+ down(&direntry->d_sb->s_vfs_rename_sem); -+ full_path = build_path_from_dentry(direntry); -+ up(&direntry->d_sb->s_vfs_rename_sem); -+ -+ if(full_path == NULL) { -+ FreeXid(xid); -+ return -ENOMEM; -+ } -+ cFYI(1, ("Full path: %s inode = 0x%p", full_path, inode)); -+ cifs_sb = CIFS_SB(inode->i_sb); -+ pTcon = cifs_sb->tcon; -+ target_path = kmalloc(PATH_MAX, GFP_KERNEL); -+ if(target_path == NULL) { -+ if (full_path) -+ kfree(full_path); -+ FreeXid(xid); -+ return -ENOMEM; -+ } -+ /* can not call the following line due to EFAULT in vfs_readlink which is presumably expecting a user space buffer */ -+ /* length = cifs_readlink(direntry,target_path, sizeof(target_path) - 1); */ -+ -+/* BB add read reparse point symlink code and Unix extensions symlink code here BB */ -+ if (pTcon->ses->capabilities & CAP_UNIX) -+ rc = CIFSSMBUnixQuerySymLink(xid, pTcon, full_path, -+ target_path, -+ PATH_MAX-1, -+ cifs_sb->local_nls); -+ else { -+ /* rc = CIFSSMBQueryReparseLinkInfo */ -+ /* BB Add code to Query ReparsePoint info */ -+ } -+ /* BB Anything else to do to handle recursive links? */ -+ /* BB Should we be using page symlink ops here? */ -+ -+ if (rc == 0) { -+ -+/* BB Add special case check for Samba DFS symlinks */ -+ -+ target_path[PATH_MAX-1] = 0; -+ rc = vfs_follow_link(nd, target_path); -+ } -+ /* else EACCESS */ -+ -+ if (target_path) -+ kfree(target_path); -+ if (full_path) -+ kfree(full_path); -+ FreeXid(xid); -+ return rc; -+} -+ -+int -+cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname) -+{ -+ int rc = -EOPNOTSUPP; -+ int xid; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ char *full_path = NULL; -+ struct inode *newinode = NULL; -+ -+ xid = GetXid(); -+ -+ cifs_sb = CIFS_SB(inode->i_sb); -+ pTcon = cifs_sb->tcon; -+ -+ down(&inode->i_sb->s_vfs_rename_sem); -+ full_path = build_path_from_dentry(direntry); -+ up(&inode->i_sb->s_vfs_rename_sem); -+ -+ if(full_path == NULL) { -+ FreeXid(xid); -+ return -ENOMEM; -+ } -+ -+ cFYI(1, ("Full path: %s ", full_path)); -+ cFYI(1, ("symname is %s", symname)); -+ -+ /* BB what if DFS and this volume is on different share? BB */ -+ if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) -+ rc = CIFSUnixCreateSymLink(xid, pTcon, full_path, symname, -+ cifs_sb->local_nls); -+ /* else -+ rc = CIFSCreateReparseSymLink(xid, pTcon, fromName, toName,cifs_sb_target->local_nls); */ -+ -+ if (rc == 0) { -+ if (pTcon->ses->capabilities & CAP_UNIX) -+ rc = cifs_get_inode_info_unix(&newinode, full_path, -+ inode->i_sb,xid); -+ else -+ rc = cifs_get_inode_info(&newinode, full_path, NULL, -+ inode->i_sb,xid); -+ -+ if (rc != 0) { -+ cFYI(1, -+ ("Create symlink worked but get_inode_info failed with rc = %d ", -+ rc)); -+ } else { -+ direntry->d_op = &cifs_dentry_ops; -+ d_instantiate(direntry, newinode); -+ } -+ } -+ -+ if (full_path) -+ kfree(full_path); -+ FreeXid(xid); -+ return rc; -+} -+ -+int -+cifs_readlink(struct dentry *direntry, char *pBuffer, int buflen) -+{ -+ struct inode *inode = direntry->d_inode; -+ int rc = -EACCES; -+ int xid; -+ int oplock = FALSE; -+ struct cifs_sb_info *cifs_sb; -+ struct cifsTconInfo *pTcon; -+ char *full_path = NULL; -+ char *tmp_path = NULL; -+ char * tmpbuffer; -+ unsigned char * referrals = NULL; -+ int num_referrals = 0; -+ int len; -+ __u16 fid; -+ -+ xid = GetXid(); -+ cifs_sb = CIFS_SB(inode->i_sb); -+ pTcon = cifs_sb->tcon; -+ -+/* BB would it be safe against deadlock to grab this sem -+ even though rename itself grabs the sem and calls lookup? */ -+/* down(&inode->i_sb->s_vfs_rename_sem);*/ -+ full_path = build_path_from_dentry(direntry); -+/* up(&inode->i_sb->s_vfs_rename_sem);*/ -+ -+ if(full_path == NULL) { -+ FreeXid(xid); -+ return -ENOMEM; -+ } -+ -+ cFYI(1, -+ ("Full path: %s inode = 0x%p pBuffer = 0x%p buflen = %d", -+ full_path, inode, pBuffer, buflen)); -+ if(buflen > PATH_MAX) -+ len = PATH_MAX; -+ else -+ len = buflen; -+ tmpbuffer = kmalloc(len,GFP_KERNEL); -+ if(tmpbuffer == NULL) { -+ if (full_path) -+ kfree(full_path); -+ FreeXid(xid); -+ return -ENOMEM; -+ } -+ -+/* BB add read reparse point symlink code and Unix extensions symlink code here BB */ -+ if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) -+ rc = CIFSSMBUnixQuerySymLink(xid, pTcon, full_path, -+ tmpbuffer, -+ len - 1, -+ cifs_sb->local_nls); -+ else { -+ rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, GENERIC_READ, -+ OPEN_REPARSE_POINT,&fid, &oplock, NULL, cifs_sb->local_nls); -+ if(!rc) { -+ rc = CIFSSMBQueryReparseLinkInfo(xid, pTcon, full_path, -+ tmpbuffer, -+ len - 1, -+ fid, -+ cifs_sb->local_nls); -+ if(CIFSSMBClose(xid, pTcon, fid)) { -+ cFYI(1,("Error closing junction point (open for ioctl)")); -+ } -+ if(rc == -EIO) { -+ /* Query if DFS Junction */ -+ tmp_path = -+ kmalloc(MAX_TREE_SIZE + MAX_PATHCONF + 1, -+ GFP_KERNEL); -+ if (tmp_path) { -+ strncpy(tmp_path, pTcon->treeName, MAX_TREE_SIZE); -+ strncat(tmp_path, full_path, MAX_PATHCONF); -+ rc = get_dfs_path(xid, pTcon->ses, tmp_path, -+ cifs_sb->local_nls, &num_referrals, &referrals); -+ cFYI(1,("Get DFS for %s rc = %d ",tmp_path, rc)); -+ if((num_referrals == 0) && (rc == 0)) -+ rc = -EACCES; -+ else { -+ cFYI(1,("num referral: %d",num_referrals)); -+ if(referrals) { -+ cFYI(1,("referral string: %s ",referrals)); -+ strncpy(tmpbuffer, referrals, len-1); -+ } -+ } -+ if(referrals) -+ kfree(referrals); -+ kfree(tmp_path); -+ if(referrals) { -+ kfree(referrals); -+ } -+ } -+ /* BB add code like else decode referrals then memcpy to -+ tmpbuffer and free referrals string array BB */ -+ } -+ } -+ } -+ /* BB Anything else to do to handle recursive links? */ -+ /* BB Should we be using page ops here? */ -+ -+ /* BB null terminate returned string in pBuffer? BB */ -+ if (rc == 0) { -+ rc = vfs_readlink(direntry, pBuffer, len, tmpbuffer); -+ cFYI(1, -+ ("vfs_readlink called from cifs_readlink returned %d", -+ rc)); -+ } -+ -+ if (tmpbuffer) { -+ kfree(tmpbuffer); -+ } -+ if (full_path) { -+ kfree(full_path); -+ } -+ FreeXid(xid); -+ return rc; -+} -diff -urN linux-2.4.29.old/fs/cifs/Makefile linux-2.4.29/fs/cifs/Makefile ---- linux-2.4.29.old/fs/cifs/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/Makefile 2004-07-14 00:25:04.000000000 +0200 -@@ -0,0 +1,10 @@ -+# -+# Makefile for Linux CIFS VFS client -+# -+O_TARGET := cifs.o -+ -+obj-y := cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o inode.o link.o misc.o netmisc.o smbdes.o smbencrypt.o transport.o asn1.o md4.o md5.o cifs_unicode.o nterr.o cifsencrypt.o -+ -+obj-m := $(O_TARGET) -+ -+include $(TOPDIR)/Rules.make -diff -urN linux-2.4.29.old/fs/cifs/md4.c linux-2.4.29/fs/cifs/md4.c ---- linux-2.4.29.old/fs/cifs/md4.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/md4.c 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,203 @@ -+/* -+ Unix SMB/Netbios implementation. -+ Version 1.9. -+ a implementation of MD4 designed for use in the SMB authentication protocol -+ Copyright (C) Andrew Tridgell 1997-1998. -+ Modified by Steve French (sfrench@us.ibm.com) 2002-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., 675 Mass Ave, Cambridge, MA 02139, USA. -+*/ -+#include -+#include -+/* NOTE: This code makes no attempt to be fast! */ -+ -+static __u32 -+F(__u32 X, __u32 Y, __u32 Z) -+{ -+ return (X & Y) | ((~X) & Z); -+} -+ -+static __u32 -+G(__u32 X, __u32 Y, __u32 Z) -+{ -+ return (X & Y) | (X & Z) | (Y & Z); -+} -+ -+static __u32 -+H(__u32 X, __u32 Y, __u32 Z) -+{ -+ return X ^ Y ^ Z; -+} -+ -+static __u32 -+lshift(__u32 x, int s) -+{ -+ x &= 0xFFFFFFFF; -+ return ((x << s) & 0xFFFFFFFF) | (x >> (32 - s)); -+} -+ -+#define ROUND1(a,b,c,d,k,s) (*a) = lshift((*a) + F(*b,*c,*d) + X[k], s) -+#define ROUND2(a,b,c,d,k,s) (*a) = lshift((*a) + G(*b,*c,*d) + X[k] + (__u32)0x5A827999,s) -+#define ROUND3(a,b,c,d,k,s) (*a) = lshift((*a) + H(*b,*c,*d) + X[k] + (__u32)0x6ED9EBA1,s) -+ -+/* this applies md4 to 64 byte chunks */ -+static void -+mdfour64(__u32 * M, __u32 * A, __u32 *B, __u32 * C, __u32 *D) -+{ -+ int j; -+ __u32 AA, BB, CC, DD; -+ __u32 X[16]; -+ -+ -+ for (j = 0; j < 16; j++) -+ X[j] = M[j]; -+ -+ AA = *A; -+ BB = *B; -+ CC = *C; -+ DD = *D; -+ -+ ROUND1(A, B, C, D, 0, 3); -+ ROUND1(D, A, B, C, 1, 7); -+ ROUND1(C, D, A, B, 2, 11); -+ ROUND1(B, C, D, A, 3, 19); -+ ROUND1(A, B, C, D, 4, 3); -+ ROUND1(D, A, B, C, 5, 7); -+ ROUND1(C, D, A, B, 6, 11); -+ ROUND1(B, C, D, A, 7, 19); -+ ROUND1(A, B, C, D, 8, 3); -+ ROUND1(D, A, B, C, 9, 7); -+ ROUND1(C, D, A, B, 10, 11); -+ ROUND1(B, C, D, A, 11, 19); -+ ROUND1(A, B, C, D, 12, 3); -+ ROUND1(D, A, B, C, 13, 7); -+ ROUND1(C, D, A, B, 14, 11); -+ ROUND1(B, C, D, A, 15, 19); -+ -+ ROUND2(A, B, C, D, 0, 3); -+ ROUND2(D, A, B, C, 4, 5); -+ ROUND2(C, D, A, B, 8, 9); -+ ROUND2(B, C, D, A, 12, 13); -+ ROUND2(A, B, C, D, 1, 3); -+ ROUND2(D, A, B, C, 5, 5); -+ ROUND2(C, D, A, B, 9, 9); -+ ROUND2(B, C, D, A, 13, 13); -+ ROUND2(A, B, C, D, 2, 3); -+ ROUND2(D, A, B, C, 6, 5); -+ ROUND2(C, D, A, B, 10, 9); -+ ROUND2(B, C, D, A, 14, 13); -+ ROUND2(A, B, C, D, 3, 3); -+ ROUND2(D, A, B, C, 7, 5); -+ ROUND2(C, D, A, B, 11, 9); -+ ROUND2(B, C, D, A, 15, 13); -+ -+ ROUND3(A, B, C, D, 0, 3); -+ ROUND3(D, A, B, C, 8, 9); -+ ROUND3(C, D, A, B, 4, 11); -+ ROUND3(B, C, D, A, 12, 15); -+ ROUND3(A, B, C, D, 2, 3); -+ ROUND3(D, A, B, C, 10, 9); -+ ROUND3(C, D, A, B, 6, 11); -+ ROUND3(B, C, D, A, 14, 15); -+ ROUND3(A, B, C, D, 1, 3); -+ ROUND3(D, A, B, C, 9, 9); -+ ROUND3(C, D, A, B, 5, 11); -+ ROUND3(B, C, D, A, 13, 15); -+ ROUND3(A, B, C, D, 3, 3); -+ ROUND3(D, A, B, C, 11, 9); -+ ROUND3(C, D, A, B, 7, 11); -+ ROUND3(B, C, D, A, 15, 15); -+ -+ *A += AA; -+ *B += BB; -+ *C += CC; -+ *D += DD; -+ -+ *A &= 0xFFFFFFFF; -+ *B &= 0xFFFFFFFF; -+ *C &= 0xFFFFFFFF; -+ *D &= 0xFFFFFFFF; -+ -+ for (j = 0; j < 16; j++) -+ X[j] = 0; -+} -+ -+static void -+copy64(__u32 * M, unsigned char *in) -+{ -+ int i; -+ -+ for (i = 0; i < 16; i++) -+ M[i] = (in[i * 4 + 3] << 24) | (in[i * 4 + 2] << 16) | -+ (in[i * 4 + 1] << 8) | (in[i * 4 + 0] << 0); -+} -+ -+static void -+copy4(unsigned char *out, __u32 x) -+{ -+ out[0] = x & 0xFF; -+ out[1] = (x >> 8) & 0xFF; -+ out[2] = (x >> 16) & 0xFF; -+ out[3] = (x >> 24) & 0xFF; -+} -+ -+/* produce a md4 message digest from data of length n bytes */ -+void -+mdfour(unsigned char *out, unsigned char *in, int n) -+{ -+ unsigned char buf[128]; -+ __u32 M[16]; -+ __u32 b = n * 8; -+ int i; -+ __u32 A = 0x67452301; -+ __u32 B = 0xefcdab89; -+ __u32 C = 0x98badcfe; -+ __u32 D = 0x10325476; -+ -+ while (n > 64) { -+ copy64(M, in); -+ mdfour64(M,&A,&B, &C, &D); -+ in += 64; -+ n -= 64; -+ } -+ -+ for (i = 0; i < 128; i++) -+ buf[i] = 0; -+ memcpy(buf, in, n); -+ buf[n] = 0x80; -+ -+ if (n <= 55) { -+ copy4(buf + 56, b); -+ copy64(M, buf); -+ mdfour64(M, &A, &B, &C, &D); -+ } else { -+ copy4(buf + 120, b); -+ copy64(M, buf); -+ mdfour64(M, &A, &B, &C, &D); -+ copy64(M, buf + 64); -+ mdfour64(M, &A, &B, &C, &D); -+ } -+ -+ for (i = 0; i < 128; i++) -+ buf[i] = 0; -+ copy64(M, buf); -+ -+ copy4(out, A); -+ copy4(out + 4, B); -+ copy4(out + 8, C); -+ copy4(out + 12, D); -+ -+ A = B = C = D = 0; -+} -diff -urN linux-2.4.29.old/fs/cifs/md5.c linux-2.4.29/fs/cifs/md5.c ---- linux-2.4.29.old/fs/cifs/md5.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/md5.c 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,363 @@ -+/* -+ * This code implements the MD5 message-digest algorithm. -+ * The algorithm is due to Ron Rivest. This code was -+ * written by Colin Plumb in 1993, no copyright is claimed. -+ * This code is in the public domain; do with it what you wish. -+ * -+ * Equivalent code is available from RSA Data Security, Inc. -+ * This code has been tested against that, and is equivalent, -+ * except that you don't need to include two pages of legalese -+ * with every copy. -+ * -+ * To compute the message digest of a chunk of bytes, declare an -+ * MD5Context structure, pass it to MD5Init, call MD5Update as -+ * needed on buffers full of bytes, and then call MD5Final, which -+ * will fill a supplied 16-byte array with the digest. -+ */ -+ -+/* This code slightly modified to fit into Samba by -+ abartlet@samba.org Jun 2001 -+ and to fit the cifs vfs by -+ Steve French sfrench@us.ibm.com */ -+ -+#include -+#include "md5.h" -+ -+static void MD5Transform(__u32 buf[4], __u32 const in[16]); -+ -+/* -+ * Note: this code is harmless on little-endian machines. -+ */ -+static void -+byteReverse(unsigned char *buf, unsigned longs) -+{ -+ __u32 t; -+ do { -+ t = (__u32) ((unsigned) buf[3] << 8 | buf[2]) << 16 | -+ ((unsigned) buf[1] << 8 | buf[0]); -+ *(__u32 *) buf = t; -+ buf += 4; -+ } while (--longs); -+} -+ -+/* -+ * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious -+ * initialization constants. -+ */ -+void -+MD5Init(struct MD5Context *ctx) -+{ -+ ctx->buf[0] = 0x67452301; -+ ctx->buf[1] = 0xefcdab89; -+ ctx->buf[2] = 0x98badcfe; -+ ctx->buf[3] = 0x10325476; -+ -+ ctx->bits[0] = 0; -+ ctx->bits[1] = 0; -+} -+ -+/* -+ * Update context to reflect the concatenation of another buffer full -+ * of bytes. -+ */ -+void -+MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) -+{ -+ register __u32 t; -+ -+ /* Update bitcount */ -+ -+ t = ctx->bits[0]; -+ if ((ctx->bits[0] = t + ((__u32) len << 3)) < t) -+ ctx->bits[1]++; /* Carry from low to high */ -+ ctx->bits[1] += len >> 29; -+ -+ t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ -+ -+ /* Handle any leading odd-sized chunks */ -+ -+ if (t) { -+ unsigned char *p = (unsigned char *) ctx->in + t; -+ -+ t = 64 - t; -+ if (len < t) { -+ memmove(p, buf, len); -+ return; -+ } -+ memmove(p, buf, t); -+ byteReverse(ctx->in, 16); -+ MD5Transform(ctx->buf, (__u32 *) ctx->in); -+ buf += t; -+ len -= t; -+ } -+ /* Process data in 64-byte chunks */ -+ -+ while (len >= 64) { -+ memmove(ctx->in, buf, 64); -+ byteReverse(ctx->in, 16); -+ MD5Transform(ctx->buf, (__u32 *) ctx->in); -+ buf += 64; -+ len -= 64; -+ } -+ -+ /* Handle any remaining bytes of data. */ -+ -+ memmove(ctx->in, buf, len); -+} -+ -+/* -+ * Final wrapup - pad to 64-byte boundary with the bit pattern -+ * 1 0* (64-bit count of bits processed, MSB-first) -+ */ -+void -+MD5Final(unsigned char digest[16], struct MD5Context *ctx) -+{ -+ unsigned int count; -+ unsigned char *p; -+ -+ /* Compute number of bytes mod 64 */ -+ count = (ctx->bits[0] >> 3) & 0x3F; -+ -+ /* Set the first char of padding to 0x80. This is safe since there is -+ always at least one byte free */ -+ p = ctx->in + count; -+ *p++ = 0x80; -+ -+ /* Bytes of padding needed to make 64 bytes */ -+ count = 64 - 1 - count; -+ -+ /* Pad out to 56 mod 64 */ -+ if (count < 8) { -+ /* Two lots of padding: Pad the first block to 64 bytes */ -+ memset(p, 0, count); -+ byteReverse(ctx->in, 16); -+ MD5Transform(ctx->buf, (__u32 *) ctx->in); -+ -+ /* Now fill the next block with 56 bytes */ -+ memset(ctx->in, 0, 56); -+ } else { -+ /* Pad block to 56 bytes */ -+ memset(p, 0, count - 8); -+ } -+ byteReverse(ctx->in, 14); -+ -+ /* Append length in bits and transform */ -+ ((__u32 *) ctx->in)[14] = ctx->bits[0]; -+ ((__u32 *) ctx->in)[15] = ctx->bits[1]; -+ -+ MD5Transform(ctx->buf, (__u32 *) ctx->in); -+ byteReverse((unsigned char *) ctx->buf, 4); -+ memmove(digest, ctx->buf, 16); -+ memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ -+} -+ -+/* The four core functions - F1 is optimized somewhat */ -+ -+/* #define F1(x, y, z) (x & y | ~x & z) */ -+#define F1(x, y, z) (z ^ (x & (y ^ z))) -+#define F2(x, y, z) F1(z, x, y) -+#define F3(x, y, z) (x ^ y ^ z) -+#define F4(x, y, z) (y ^ (x | ~z)) -+ -+/* This is the central step in the MD5 algorithm. */ -+#define MD5STEP(f, w, x, y, z, data, s) \ -+ ( w += f(x, y, z) + data, w = w<>(32-s), w += x ) -+ -+/* -+ * The core of the MD5 algorithm, this alters an existing MD5 hash to -+ * reflect the addition of 16 longwords of new data. MD5Update blocks -+ * the data and converts bytes into longwords for this routine. -+ */ -+static void -+MD5Transform(__u32 buf[4], __u32 const in[16]) -+{ -+ register __u32 a, b, c, d; -+ -+ a = buf[0]; -+ b = buf[1]; -+ c = buf[2]; -+ d = buf[3]; -+ -+ MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); -+ MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); -+ MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); -+ MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); -+ MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); -+ MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); -+ MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); -+ MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); -+ MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); -+ MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); -+ MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); -+ MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); -+ MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); -+ MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); -+ MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); -+ MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); -+ -+ MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); -+ MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); -+ MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); -+ MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); -+ MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); -+ MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); -+ MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); -+ MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); -+ MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); -+ MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); -+ MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); -+ MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); -+ MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); -+ MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); -+ MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); -+ MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); -+ -+ MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); -+ MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); -+ MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); -+ MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); -+ MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); -+ MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); -+ MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); -+ MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); -+ MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); -+ MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); -+ MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); -+ MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); -+ MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); -+ MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); -+ MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); -+ MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); -+ -+ MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); -+ MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); -+ MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); -+ MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); -+ MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); -+ MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); -+ MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); -+ MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); -+ MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); -+ MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); -+ MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); -+ MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); -+ MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); -+ MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); -+ MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); -+ MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); -+ -+ buf[0] += a; -+ buf[1] += b; -+ buf[2] += c; -+ buf[3] += d; -+} -+ -+/*********************************************************************** -+ the rfc 2104 version of hmac_md5 initialisation. -+***********************************************************************/ -+void -+hmac_md5_init_rfc2104(unsigned char *key, int key_len, -+ struct HMACMD5Context *ctx) -+{ -+ int i; -+ -+ /* if key is longer than 64 bytes reset it to key=MD5(key) */ -+ if (key_len > 64) { -+ unsigned char tk[16]; -+ struct MD5Context tctx; -+ -+ MD5Init(&tctx); -+ MD5Update(&tctx, key, key_len); -+ MD5Final(tk, &tctx); -+ -+ key = tk; -+ key_len = 16; -+ } -+ -+ /* start out by storing key in pads */ -+ memset(ctx->k_ipad, 0, sizeof (ctx->k_ipad)); -+ memset(ctx->k_opad, 0, sizeof (ctx->k_opad)); -+ memcpy(ctx->k_ipad, key, key_len); -+ memcpy(ctx->k_opad, key, key_len); -+ -+ /* XOR key with ipad and opad values */ -+ for (i = 0; i < 64; i++) { -+ ctx->k_ipad[i] ^= 0x36; -+ ctx->k_opad[i] ^= 0x5c; -+ } -+ -+ MD5Init(&ctx->ctx); -+ MD5Update(&ctx->ctx, ctx->k_ipad, 64); -+} -+ -+/*********************************************************************** -+ the microsoft version of hmac_md5 initialisation. -+***********************************************************************/ -+void -+hmac_md5_init_limK_to_64(const unsigned char *key, int key_len, -+ struct HMACMD5Context *ctx) -+{ -+ int i; -+ -+ /* if key is longer than 64 bytes truncate it */ -+ if (key_len > 64) { -+ key_len = 64; -+ } -+ -+ /* start out by storing key in pads */ -+ memset(ctx->k_ipad, 0, sizeof (ctx->k_ipad)); -+ memset(ctx->k_opad, 0, sizeof (ctx->k_opad)); -+ memcpy(ctx->k_ipad, key, key_len); -+ memcpy(ctx->k_opad, key, key_len); -+ -+ /* XOR key with ipad and opad values */ -+ for (i = 0; i < 64; i++) { -+ ctx->k_ipad[i] ^= 0x36; -+ ctx->k_opad[i] ^= 0x5c; -+ } -+ -+ MD5Init(&ctx->ctx); -+ MD5Update(&ctx->ctx, ctx->k_ipad, 64); -+} -+ -+/*********************************************************************** -+ update hmac_md5 "inner" buffer -+***********************************************************************/ -+void -+hmac_md5_update(const unsigned char *text, int text_len, -+ struct HMACMD5Context *ctx) -+{ -+ MD5Update(&ctx->ctx, text, text_len); /* then text of datagram */ -+} -+ -+/*********************************************************************** -+ finish off hmac_md5 "inner" buffer and generate outer one. -+***********************************************************************/ -+void -+hmac_md5_final(unsigned char *digest, struct HMACMD5Context *ctx) -+{ -+ struct MD5Context ctx_o; -+ -+ MD5Final(digest, &ctx->ctx); -+ -+ MD5Init(&ctx_o); -+ MD5Update(&ctx_o, ctx->k_opad, 64); -+ MD5Update(&ctx_o, digest, 16); -+ MD5Final(digest, &ctx_o); -+} -+ -+/*********************************************************** -+ single function to calculate an HMAC MD5 digest from data. -+ use the microsoft hmacmd5 init method because the key is 16 bytes. -+************************************************************/ -+void -+hmac_md5(unsigned char key[16], unsigned char *data, int data_len, -+ unsigned char *digest) -+{ -+ struct HMACMD5Context ctx; -+ hmac_md5_init_limK_to_64(key, 16, &ctx); -+ if (data_len != 0) { -+ hmac_md5_update(data, data_len, &ctx); -+ } -+ hmac_md5_final(digest, &ctx); -+} -diff -urN linux-2.4.29.old/fs/cifs/md5.h linux-2.4.29/fs/cifs/md5.h ---- linux-2.4.29.old/fs/cifs/md5.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/md5.h 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,38 @@ -+#ifndef MD5_H -+#define MD5_H -+#ifndef HEADER_MD5_H -+/* Try to avoid clashes with OpenSSL */ -+#define HEADER_MD5_H -+#endif -+ -+struct MD5Context { -+ __u32 buf[4]; -+ __u32 bits[2]; -+ unsigned char in[64]; -+}; -+#endif /* !MD5_H */ -+ -+#ifndef _HMAC_MD5_H -+struct HMACMD5Context { -+ struct MD5Context ctx; -+ unsigned char k_ipad[65]; -+ unsigned char k_opad[65]; -+}; -+#endif /* _HMAC_MD5_H */ -+ -+void MD5Init(struct MD5Context *context); -+void MD5Update(struct MD5Context *context, unsigned char const *buf, -+ unsigned len); -+void MD5Final(unsigned char digest[16], struct MD5Context *context); -+ -+/* The following definitions come from lib/hmacmd5.c */ -+ -+void hmac_md5_init_rfc2104(unsigned char *key, int key_len, -+ struct HMACMD5Context *ctx); -+void hmac_md5_init_limK_to_64(const unsigned char *key, int key_len, -+ struct HMACMD5Context *ctx); -+void hmac_md5_update(const unsigned char *text, int text_len, -+ struct HMACMD5Context *ctx); -+void hmac_md5_final(unsigned char *digest, struct HMACMD5Context *ctx); -+void hmac_md5(unsigned char key[16], unsigned char *data, int data_len, -+ unsigned char *digest); -diff -urN linux-2.4.29.old/fs/cifs/misc.c linux-2.4.29/fs/cifs/misc.c ---- linux-2.4.29.old/fs/cifs/misc.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/misc.c 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,463 @@ -+/* -+ * fs/cifs/misc.c -+ * -+ * Copyright (C) International Business Machines Corp., 2002,2003 -+ * Author(s): Steve French (sfrench@us.ibm.com) -+ * -+ * This library is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This library 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 Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#include -+#include -+#include "cifspdu.h" -+#include "cifsglob.h" -+#include "cifsproto.h" -+#include "cifs_debug.h" -+#include "smberr.h" -+#include "nterr.h" -+ -+extern kmem_cache_t *cifs_req_cachep; -+extern struct task_struct * oplockThread; -+ -+__u16 GlobalMid; /* multiplex id - rotating counter */ -+ -+/* The xid serves as a useful identifier for each incoming vfs request, -+ in a similar way to the mid which is useful to track each sent smb, -+ and CurrentXid can also provide a running counter (although it -+ will eventually wrap past zero) of the total vfs operations handled -+ since the cifs fs was mounted */ -+ -+unsigned int -+_GetXid(void) -+{ -+ unsigned int xid; -+ -+ spin_lock(&GlobalMid_Lock); -+ GlobalTotalActiveXid++; -+ if (GlobalTotalActiveXid > GlobalMaxActiveXid) -+ GlobalMaxActiveXid = GlobalTotalActiveXid; /* keep high water mark for number of simultaneous vfs ops in our filesystem */ -+ xid = GlobalCurrentXid++; -+ spin_unlock(&GlobalMid_Lock); -+ return xid; -+} -+ -+void -+_FreeXid(unsigned int xid) -+{ -+ spin_lock(&GlobalMid_Lock); -+ /* if(GlobalTotalActiveXid == 0) -+ BUG(); */ -+ GlobalTotalActiveXid--; -+ spin_unlock(&GlobalMid_Lock); -+} -+ -+struct cifsSesInfo * -+sesInfoAlloc(void) -+{ -+ struct cifsSesInfo *ret_buf; -+ -+ ret_buf = -+ (struct cifsSesInfo *) kmalloc(sizeof (struct cifsSesInfo), -+ GFP_KERNEL); -+ if (ret_buf) { -+ memset(ret_buf, 0, sizeof (struct cifsSesInfo)); -+ write_lock(&GlobalSMBSeslock); -+ atomic_inc(&sesInfoAllocCount); -+ ret_buf->status = CifsNew; -+ list_add(&ret_buf->cifsSessionList, &GlobalSMBSessionList); -+ init_MUTEX(&ret_buf->sesSem); -+ write_unlock(&GlobalSMBSeslock); -+ } -+ return ret_buf; -+} -+ -+void -+sesInfoFree(struct cifsSesInfo *buf_to_free) -+{ -+ if (buf_to_free == NULL) { -+ cFYI(1, ("Null buffer passed to sesInfoFree")); -+ return; -+ } -+ -+ write_lock(&GlobalSMBSeslock); -+ atomic_dec(&sesInfoAllocCount); -+ list_del(&buf_to_free->cifsSessionList); -+ write_unlock(&GlobalSMBSeslock); -+ if (buf_to_free->serverOS) -+ kfree(buf_to_free->serverOS); -+ if (buf_to_free->serverDomain) -+ kfree(buf_to_free->serverDomain); -+ if (buf_to_free->serverNOS) -+ kfree(buf_to_free->serverNOS); -+ if (buf_to_free->password) -+ kfree(buf_to_free->password); -+ kfree(buf_to_free); -+} -+ -+struct cifsTconInfo * -+tconInfoAlloc(void) -+{ -+ struct cifsTconInfo *ret_buf; -+ ret_buf = -+ (struct cifsTconInfo *) kmalloc(sizeof (struct cifsTconInfo), -+ GFP_KERNEL); -+ if (ret_buf) { -+ memset(ret_buf, 0, sizeof (struct cifsTconInfo)); -+ write_lock(&GlobalSMBSeslock); -+ atomic_inc(&tconInfoAllocCount); -+ list_add(&ret_buf->cifsConnectionList, -+ &GlobalTreeConnectionList); -+ ret_buf->tidStatus = CifsNew; -+ INIT_LIST_HEAD(&ret_buf->openFileList); -+ init_MUTEX(&ret_buf->tconSem); -+#ifdef CONFIG_CIFS_STATS -+ ret_buf->stat_lock = SPIN_LOCK_UNLOCKED; -+#endif -+ write_unlock(&GlobalSMBSeslock); -+ } -+ return ret_buf; -+} -+ -+void -+tconInfoFree(struct cifsTconInfo *buf_to_free) -+{ -+ if (buf_to_free == NULL) { -+ cFYI(1, ("Null buffer passed to tconInfoFree")); -+ return; -+ } -+ write_lock(&GlobalSMBSeslock); -+ atomic_dec(&tconInfoAllocCount); -+ list_del(&buf_to_free->cifsConnectionList); -+ write_unlock(&GlobalSMBSeslock); -+ if (buf_to_free->nativeFileSystem) -+ kfree(buf_to_free->nativeFileSystem); -+ kfree(buf_to_free); -+} -+ -+struct smb_hdr * -+cifs_buf_get(void) -+{ -+ struct smb_hdr *ret_buf = NULL; -+ -+/* We could use negotiated size instead of max_msgsize - -+ but it may be more efficient to always alloc same size -+ albeit slightly larger than necessary and maxbuffersize -+ defaults to this and can not be bigger */ -+ ret_buf = -+ (struct smb_hdr *) kmem_cache_alloc(cifs_req_cachep, SLAB_KERNEL); -+ -+ /* clear the first few header bytes */ -+ if (ret_buf) { -+ memset(ret_buf, 0, sizeof (struct smb_hdr)); -+ atomic_inc(&bufAllocCount); -+ } -+ -+ return ret_buf; -+} -+ -+void -+cifs_buf_release(void *buf_to_free) -+{ -+ -+ if (buf_to_free == NULL) { -+ cFYI(1, ("Null buffer passed to cifs_buf_release")); -+ return; -+ } -+ kmem_cache_free(cifs_req_cachep, buf_to_free); -+ -+ atomic_dec(&bufAllocCount); -+ return; -+} -+ -+void -+header_assemble(struct smb_hdr *buffer, char smb_command /* command */ , -+ const struct cifsTconInfo *treeCon, int word_count -+ /* length of fixed section (word count) in two byte units */ -+ ) -+{ -+ int i; -+ __u32 tmp; -+ struct list_head* temp_item; -+ struct cifsSesInfo * ses; -+ char *temp = (char *) buffer; -+ -+ for (i = 0; i < MAX_CIFS_HDR_SIZE; i++) { -+ temp[i] = 0; /* BB is this needed ?? */ -+ } -+ -+ buffer->smb_buf_length = -+ (2 * word_count) + sizeof (struct smb_hdr) - -+ 4 /* RFC 1001 length field does not count */ + -+ 2 /* for bcc field itself */ ; -+ /* Note that this is the only network field that has to be converted to big endian and it is done just before we send it */ -+ -+ buffer->Protocol[0] = 0xFF; -+ buffer->Protocol[1] = 'S'; -+ buffer->Protocol[2] = 'M'; -+ buffer->Protocol[3] = 'B'; -+ buffer->Command = smb_command; -+ buffer->Flags = 0x00; /* case sensitive */ -+ buffer->Flags2 = SMBFLG2_KNOWS_LONG_NAMES; -+ tmp = cpu_to_le32(current->pid); -+ buffer->Pid = tmp & 0xFFFF; -+ tmp >>= 16; -+ buffer->PidHigh = tmp & 0xFFFF; -+ spin_lock(&GlobalMid_Lock); -+ GlobalMid++; -+ buffer->Mid = GlobalMid; -+ spin_unlock(&GlobalMid_Lock); -+ if (treeCon) { -+ buffer->Tid = treeCon->tid; -+ if (treeCon->ses) { -+ if (treeCon->ses->capabilities & CAP_UNICODE) -+ buffer->Flags2 |= SMBFLG2_UNICODE; -+ if (treeCon->ses->capabilities & CAP_STATUS32) { -+ buffer->Flags2 |= SMBFLG2_ERR_STATUS; -+ } -+ -+ buffer->Uid = treeCon->ses->Suid; /* always in LE format */ -+ if(multiuser_mount != 0) { -+ /* For the multiuser case, there are few obvious technically */ -+ /* possible mechanisms to match the local linux user (uid) */ -+ /* to a valid remote smb user (smb_uid): */ -+ /* 1) Query Winbind (or other local pam/nss daemon */ -+ /* for userid/password/logon_domain or credential */ -+ /* 2) Query Winbind for uid to sid to username mapping */ -+ /* and see if we have a matching password for existing*/ -+ /* session for that user perhas getting password by */ -+ /* adding a new pam_cifs module that stores passwords */ -+ /* so that the cifs vfs can get at that for all logged*/ -+ /* on users */ -+ /* 3) (Which is the mechanism we have chosen) */ -+ /* Search through sessions to the same server for a */ -+ /* a match on the uid that was passed in on mount */ -+ /* with the current processes uid (or euid?) and use */ -+ /* that smb uid. If no existing smb session for */ -+ /* that uid found, use the default smb session ie */ -+ /* the smb session for the volume mounted which is */ -+ /* the same as would be used if the multiuser mount */ -+ /* flag were disabled. */ -+ -+ /* BB Add support for establishing new tCon and SMB Session */ -+ /* with userid/password pairs found on the smb session */ -+ /* for other target tcp/ip addresses BB */ -+ if(current->uid != treeCon->ses->linux_uid) { -+ cFYI(1,("Multiuser mode and UID did not match tcon uid ")); -+ read_lock(&GlobalSMBSeslock); -+ list_for_each(temp_item, &GlobalSMBSessionList) { -+ ses = list_entry(temp_item, struct cifsSesInfo, cifsSessionList); -+ if(ses->linux_uid == current->uid) { -+ if(ses->server == treeCon->ses->server) { -+ cFYI(1,("found matching uid substitute right smb_uid")); -+ buffer->Uid = ses->Suid; -+ break; -+ } else { -+ /* BB eventually call cifs_setup_session here */ -+ cFYI(1,("local UID found but smb sess with this server does not exist")); -+ } -+ } -+ } -+ read_unlock(&GlobalSMBSeslock); -+ } -+ } -+ } -+ if (treeCon->Flags & SMB_SHARE_IS_IN_DFS) -+ buffer->Flags2 |= SMBFLG2_DFS; -+ if(treeCon->ses->server) -+ if(treeCon->ses->server->secMode & -+ (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) -+ buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; -+ } -+ -+/* endian conversion of flags is now done just before sending */ -+ buffer->WordCount = (char) word_count; -+ return; -+} -+ -+int -+checkSMBhdr(struct smb_hdr *smb, __u16 mid) -+{ -+ /* Make sure that this really is an SMB, that it is a response, -+ and that the message ids match */ -+ if ((*(unsigned int *) smb->Protocol == cpu_to_le32(0x424d53ff)) && -+ (mid == smb->Mid)) { -+ if(smb->Flags & SMBFLG_RESPONSE) -+ return 0; -+ else { -+ /* only one valid case where server sends us request */ -+ if(smb->Command == SMB_COM_LOCKING_ANDX) -+ return 0; -+ else -+ cERROR(1, ("Rcvd Request not response ")); -+ } -+ } else { /* bad signature or mid */ -+ if (*(unsigned int *) smb->Protocol != cpu_to_le32(0x424d53ff)) -+ cERROR(1, -+ ("Bad protocol string signature header %x ", -+ *(unsigned int *) smb->Protocol)); -+ if (mid != smb->Mid) -+ cERROR(1, ("Mids do not match")); -+ } -+ cERROR(1, ("bad smb detected. The Mid=%d", smb->Mid)); -+ return 1; -+} -+ -+int -+checkSMB(struct smb_hdr *smb, __u16 mid, int length) -+{ -+ cFYI(0, -+ ("Entering checkSMB with Length: %x, smb_buf_length: %x ", -+ length, ntohl(smb->smb_buf_length))); -+ if (((unsigned int)length < 2 + sizeof (struct smb_hdr)) -+ || (ntohl(smb->smb_buf_length) > -+ CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE - 4)) { -+ if ((unsigned int)length < 2 + sizeof (struct smb_hdr)) { -+ cERROR(1, ("Length less than 2 + sizeof smb_hdr ")); -+ if (((unsigned int)length >= sizeof (struct smb_hdr) - 1) -+ && (smb->Status.CifsError != 0)) -+ return 0; /* some error cases do not return wct and bcc */ -+ -+ } -+ if (ntohl(smb->smb_buf_length) > -+ CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE - 4) -+ cERROR(1, -+ ("smb_buf_length greater than CIFS_MAX_MSGSIZE ... ")); -+ cERROR(1, -+ ("bad smb detected. Illegal length. The mid=%d", -+ smb->Mid)); -+ return 1; -+ } -+ -+ if (checkSMBhdr(smb, mid)) -+ return 1; -+ -+ if ((4 + ntohl(smb->smb_buf_length) != smbCalcSize(smb)) -+ || (4 + ntohl(smb->smb_buf_length) != (unsigned int)length)) { -+ return 0; -+ } else { -+ cERROR(1, ("smbCalcSize %x ", smbCalcSize(smb))); -+ cERROR(1, -+ ("bad smb size detected. The Mid=%d", smb->Mid)); -+ return 1; -+ } -+} -+int -+is_valid_oplock_break(struct smb_hdr *buf) -+{ -+ struct smb_com_lock_req * pSMB = (struct smb_com_lock_req *)buf; -+ struct list_head *tmp; -+ struct list_head *tmp1; -+ struct cifsTconInfo *tcon; -+ struct cifsFileInfo *netfile; -+ -+ /* could add check for smb response flag 0x80 */ -+ cFYI(1,("Checking for oplock break")); -+ if(pSMB->hdr.Command != SMB_COM_LOCKING_ANDX) -+ return FALSE; -+ if(pSMB->hdr.Flags & SMBFLG_RESPONSE) { -+ /* no sense logging error on invalid handle on oplock -+ break - harmless race between close request and oplock -+ break response is expected from time to time writing out -+ large dirty files cached on the client */ -+ if ((NT_STATUS_INVALID_HANDLE) == -+ le32_to_cpu(pSMB->hdr.Status.CifsError)) { -+ cFYI(1,("invalid handle on oplock break")); -+ return TRUE; -+ } else if (ERRbadfid == -+ le16_to_cpu(pSMB->hdr.Status.DosError.Error)) { -+ return TRUE; -+ } else { -+ return FALSE; /* on valid oplock brk we get "request" */ -+ } -+ } -+ if(pSMB->hdr.WordCount != 8) -+ return FALSE; -+ -+ cFYI(1,(" oplock type 0x%d level 0x%d",pSMB->LockType,pSMB->OplockLevel)); -+ if(!(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE)) -+ return FALSE; -+ -+ /* look up tcon based on tid & uid */ -+ read_lock(&GlobalSMBSeslock); -+ list_for_each(tmp, &GlobalTreeConnectionList) { -+ tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); -+ if (tcon->tid == buf->Tid) { -+#ifdef CONFIG_CIFS_STATS -+ atomic_inc(&tcon->num_oplock_brks); -+#endif -+ list_for_each(tmp1,&tcon->openFileList){ -+ netfile = list_entry(tmp1,struct cifsFileInfo,tlist); -+ if(pSMB->Fid == netfile->netfid) { -+ struct cifsInodeInfo *pCifsInode; -+ read_unlock(&GlobalSMBSeslock); -+ cFYI(1,("Matching file id, processing oplock break")); -+ pCifsInode = -+ CIFS_I(netfile->pInode); -+ pCifsInode->clientCanCacheAll = FALSE; -+ if(pSMB->OplockLevel == 0) -+ pCifsInode->clientCanCacheRead = FALSE; -+ pCifsInode->oplockPending = TRUE; -+ AllocOplockQEntry(netfile->pInode, netfile->netfid, tcon); -+ cFYI(1,("about to wake up oplock thd")); -+ wake_up_process(oplockThread); -+ return TRUE; -+ } -+ } -+ read_unlock(&GlobalSMBSeslock); -+ cFYI(1,("No matching file for oplock break on connection")); -+ return TRUE; -+ } -+ } -+ read_unlock(&GlobalSMBSeslock); -+ cFYI(1,("Can not process oplock break for non-existent connection")); -+ return TRUE; -+} -+ -+void -+dump_smb(struct smb_hdr *smb_buf, int smb_buf_length) -+{ -+ int i, j; -+ char debug_line[17]; -+ unsigned char *buffer; -+ -+ if (traceSMB == 0) -+ return; -+ -+ buffer = (unsigned char *) smb_buf; -+ for (i = 0, j = 0; i < smb_buf_length; i++, j++) { -+ if (i % 8 == 0) { /* we have reached the beginning of line */ -+ printk(KERN_DEBUG "| "); -+ j = 0; -+ } -+ printk("%0#4x ", buffer[i]); -+ debug_line[2 * j] = ' '; -+ if (isprint(buffer[i])) -+ debug_line[1 + (2 * j)] = buffer[i]; -+ else -+ debug_line[1 + (2 * j)] = '_'; -+ -+ if (i % 8 == 7) { /* we have reached end of line, time to print ascii */ -+ debug_line[16] = 0; -+ printk(" | %s\n", debug_line); -+ } -+ } -+ for (; j < 8; j++) { -+ printk(" "); -+ debug_line[2 * j] = ' '; -+ debug_line[1 + (2 * j)] = ' '; -+ } -+ printk( " | %s\n", debug_line); -+ return; -+} -diff -urN linux-2.4.29.old/fs/cifs/netmisc.c linux-2.4.29/fs/cifs/netmisc.c ---- linux-2.4.29.old/fs/cifs/netmisc.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/netmisc.c 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,905 @@ -+/* -+ * fs/cifs/netmisc.c -+ * -+ * Copyright (c) International Business Machines Corp., 2002 -+ * Author(s): Steve French (sfrench@us.ibm.com) -+ * -+ * Error mapping routines from Samba libsmb/errormap.c -+ * Copyright (C) Andrew Tridgell 2001 -+ * -+ * -+ * 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 "cifsfs.h" -+#include "cifspdu.h" -+#include "cifsglob.h" -+#include "cifsproto.h" -+#include "smberr.h" -+#include "cifs_debug.h" -+#include "nterr.h" -+ -+struct smb_to_posix_error { -+ __u16 smb_err; -+ int posix_code; -+}; -+ -+const struct smb_to_posix_error mapping_table_ERRDOS[] = { -+ {ERRbadfunc, -EINVAL}, -+ {ERRbadfile, -ENOENT}, -+ {ERRbadpath, -ENOTDIR}, -+ {ERRnofids, -EMFILE}, -+ {ERRnoaccess, -EACCES}, -+ {ERRbadfid, -EBADF}, -+ {ERRbadmcb, -EIO}, -+ {ERRnomem, -ENOMEM}, -+ {ERRbadmem, -EFAULT}, -+ {ERRbadenv, -EFAULT}, -+ {ERRbadformat, -EINVAL}, -+ {ERRbadaccess, -EACCES}, -+ {ERRbaddata, -EIO}, -+ {ERRbaddrive, -ENXIO}, -+ {ERRremcd, -EACCES}, -+ {ERRdiffdevice, -EXDEV}, -+ {ERRnofiles, -ENOENT}, -+ {ERRbadshare, -ETXTBSY}, -+ {ERRlock, -EACCES}, -+ {ERRunsup, -EINVAL}, -+ {ERRnosuchshare,-ENXIO}, -+ {ERRfilexists, -EEXIST}, -+ {ERRinvparm, -EINVAL}, -+ {ERRdiskfull, -ENOSPC}, -+ {ERRinvname, -ENOENT}, -+ {ERRdirnotempty, -ENOTEMPTY}, -+ {ERRnotlocked, -ENOLCK}, -+ {ERRalreadyexists, -EEXIST}, -+ {ERRmoredata, -EOVERFLOW}, -+ {ErrQuota, -EDQUOT}, -+ {ErrNotALink, -ENOLINK}, -+ {ERRnetlogonNotStarted,-ENOPROTOOPT}, -+ {0, 0} -+}; -+ -+const struct smb_to_posix_error mapping_table_ERRSRV[] = { -+ {ERRerror, -EIO}, -+ {ERRbadpw, -EPERM}, -+ {ERRbadtype, -EREMOTE}, -+ {ERRaccess, -EACCES}, -+ {ERRinvtid, -ENXIO}, -+ {ERRinvnetname, -ENODEV}, -+ {ERRinvdevice, -ENXIO}, -+ {ERRqfull, -ENOSPC}, -+ {ERRqtoobig, -ENOSPC}, -+ {ERRqeof, -EIO}, -+ {ERRinvpfid, -EBADF}, -+ {ERRsmbcmd, -EBADRQC}, -+ {ERRsrverror, -EIO}, -+ {ERRbadBID, -EIO}, -+ {ERRfilespecs, -EINVAL}, -+ {ERRbadLink, -EIO}, -+ {ERRbadpermits, -EINVAL}, -+ {ERRbadPID, -ESRCH}, -+ {ERRsetattrmode, -EINVAL}, -+ {ERRpaused, -EHOSTDOWN}, -+ {ERRmsgoff, -EHOSTDOWN}, -+ {ERRnoroom, -ENOSPC}, -+ {ERRrmuns, -EUSERS}, -+ {ERRtimeout, -ETIME}, -+ {ERRnoresource, -ENOBUFS}, -+ {ERRtoomanyuids, -EUSERS}, -+ {ERRbaduid, -EACCES}, -+ {ERRusempx, -EIO}, -+ {ERRusestd, -EIO}, -+ {ERR_NOTIFY_ENUM_DIR, -ENOBUFS}, -+ {ERRaccountexpired, -EACCES}, -+ {ERRbadclient, -EACCES}, -+ {ERRbadLogonTime, -EACCES}, -+ {ERRpasswordExpired, -EACCES}, -+ {ERRnosupport, -EINVAL}, -+ {0, 0} -+}; -+ -+const struct smb_to_posix_error mapping_table_ERRHRD[] = { -+ {0, 0} -+}; -+ -+/* Convert string containing dotted ip address to binary form */ -+/* returns 0 if invalid address */ -+ -+/* BB add address family, change rc to status flag and return union or for ipv6 */ -+/* will need parent to call something like inet_pton to convert ipv6 address BB */ -+int -+cifs_inet_pton(int address_family, char *cp,void *dst) -+{ -+ struct in_addr address; -+ int value; -+ int digit; -+ int i; -+ char temp; -+ char bytes[4]; -+ char *end = bytes; -+ static const int addr_class_max[4] = -+ { 0xffffffff, 0xffffff, 0xffff, 0xff }; -+ -+ if(address_family != AF_INET) -+ return -EAFNOSUPPORT; -+ -+ for (i = 0; i < 4; i++) { -+ bytes[i] = 0; -+ } -+ -+ temp = *cp; -+ -+ while (TRUE) { -+ if (!isdigit(temp)) -+ return 0; -+ -+ value = 0; -+ digit = 0; -+ for (;;) { -+ if (isascii(temp) && isdigit(temp)) { -+ value = (value * 10) + temp - '0'; -+ temp = *++cp; -+ digit = 1; -+ } else -+ break; -+ } -+ -+ if (temp == '.') { -+ if ((end > bytes + 2) || (value > 255)) -+ return 0; -+ *end++ = value; -+ temp = *++cp; -+ } else if (temp == ':') { -+ cFYI(1,("IPv6 addresses not supported for CIFS mounts yet")); -+ return -1; -+ } else -+ break; -+ } -+ -+ /* check for last characters */ -+ if (temp != '\0' && (!isascii(temp) || !isspace(temp))) -+ if (temp != '\\') { -+ if (temp != '/') -+ return 0; -+ else -+ (*cp = '\\'); /* switch the slash the expected way */ -+ } -+ if (value > addr_class_max[end - bytes]) -+ return 0; -+ -+ address.s_addr = *((int *) bytes) | htonl(value); -+ *((int *)dst) = address.s_addr; -+ return 1; /* success */ -+} -+ -+/***************************************************************************** -+convert a NT status code to a dos class/code -+ *****************************************************************************/ -+/* NT status -> dos error map */ -+static const struct { -+ __u8 dos_class; -+ __u16 dos_code; -+ __u32 ntstatus; -+} ntstatus_to_dos_map[] = { -+ { -+ ERRDOS, ERRgeneral, NT_STATUS_UNSUCCESSFUL}, { -+ ERRDOS, ERRbadfunc, NT_STATUS_NOT_IMPLEMENTED}, { -+ ERRDOS, 87, NT_STATUS_INVALID_INFO_CLASS}, { -+ ERRDOS, 24, NT_STATUS_INFO_LENGTH_MISMATCH}, { -+ ERRHRD, ERRgeneral, NT_STATUS_ACCESS_VIOLATION}, { -+ ERRHRD, ERRgeneral, NT_STATUS_IN_PAGE_ERROR}, { -+ ERRHRD, ERRgeneral, NT_STATUS_PAGEFILE_QUOTA}, { -+ ERRDOS, ERRbadfid, NT_STATUS_INVALID_HANDLE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_BAD_INITIAL_STACK}, { -+ ERRDOS, 193, NT_STATUS_BAD_INITIAL_PC}, { -+ ERRDOS, 87, NT_STATUS_INVALID_CID}, { -+ ERRHRD, ERRgeneral, NT_STATUS_TIMER_NOT_CANCELED}, { -+ ERRDOS, 87, NT_STATUS_INVALID_PARAMETER}, { -+ ERRDOS, ERRbadfile, NT_STATUS_NO_SUCH_DEVICE}, { -+ ERRDOS, ERRbadfile, NT_STATUS_NO_SUCH_FILE}, { -+ ERRDOS, ERRbadfunc, NT_STATUS_INVALID_DEVICE_REQUEST}, { -+ ERRDOS, 38, NT_STATUS_END_OF_FILE}, { -+ ERRDOS, 34, NT_STATUS_WRONG_VOLUME}, { -+ ERRDOS, 21, NT_STATUS_NO_MEDIA_IN_DEVICE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_UNRECOGNIZED_MEDIA}, { -+ ERRDOS, 27, NT_STATUS_NONEXISTENT_SECTOR}, -+/* { This NT error code was 'sqashed' -+ from NT_STATUS_MORE_PROCESSING_REQUIRED to NT_STATUS_OK -+ during the session setup } */ -+ { -+ ERRDOS, ERRnomem, NT_STATUS_NO_MEMORY}, { -+ ERRDOS, 487, NT_STATUS_CONFLICTING_ADDRESSES}, { -+ ERRDOS, 487, NT_STATUS_NOT_MAPPED_VIEW}, { -+ ERRDOS, 87, NT_STATUS_UNABLE_TO_FREE_VM}, { -+ ERRDOS, 87, NT_STATUS_UNABLE_TO_DELETE_SECTION}, { -+ ERRDOS, 2142, NT_STATUS_INVALID_SYSTEM_SERVICE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_ILLEGAL_INSTRUCTION}, { -+ ERRDOS, ERRnoaccess, NT_STATUS_INVALID_LOCK_SEQUENCE}, { -+ ERRDOS, ERRnoaccess, NT_STATUS_INVALID_VIEW_SIZE}, { -+ ERRDOS, 193, NT_STATUS_INVALID_FILE_FOR_SECTION}, { -+ ERRDOS, ERRnoaccess, NT_STATUS_ALREADY_COMMITTED}, -+/* { This NT error code was 'sqashed' -+ from NT_STATUS_ACCESS_DENIED to NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE -+ during the session setup } */ -+ { -+ ERRDOS, ERRnoaccess, NT_STATUS_ACCESS_DENIED}, { -+ ERRDOS, 111, NT_STATUS_BUFFER_TOO_SMALL}, { -+ ERRDOS, ERRbadfid, NT_STATUS_OBJECT_TYPE_MISMATCH}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NONCONTINUABLE_EXCEPTION}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_DISPOSITION}, { -+ ERRHRD, ERRgeneral, NT_STATUS_UNWIND}, { -+ ERRHRD, ERRgeneral, NT_STATUS_BAD_STACK}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_UNWIND_TARGET}, { -+ ERRDOS, 158, NT_STATUS_NOT_LOCKED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_PARITY_ERROR}, { -+ ERRDOS, 487, NT_STATUS_UNABLE_TO_DECOMMIT_VM}, { -+ ERRDOS, 487, NT_STATUS_NOT_COMMITTED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_PORT_ATTRIBUTES}, { -+ ERRHRD, ERRgeneral, NT_STATUS_PORT_MESSAGE_TOO_LONG}, { -+ ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_MIX}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_QUOTA_LOWER}, { -+ ERRHRD, ERRgeneral, NT_STATUS_DISK_CORRUPT_ERROR}, { -+ ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_INVALID}, { /* mapping changed since shell does lookup on * and expects file not found */ -+ ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_NOT_FOUND}, { -+ ERRDOS, ERRalreadyexists, NT_STATUS_OBJECT_NAME_COLLISION}, { -+ ERRHRD, ERRgeneral, NT_STATUS_HANDLE_NOT_WAITABLE}, { -+ ERRDOS, ERRbadfid, NT_STATUS_PORT_DISCONNECTED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_DEVICE_ALREADY_ATTACHED}, { -+ ERRDOS, 161, NT_STATUS_OBJECT_PATH_INVALID}, { -+ ERRDOS, ERRbadpath, NT_STATUS_OBJECT_PATH_NOT_FOUND}, { -+ ERRDOS, 161, NT_STATUS_OBJECT_PATH_SYNTAX_BAD}, { -+ ERRHRD, ERRgeneral, NT_STATUS_DATA_OVERRUN}, { -+ ERRHRD, ERRgeneral, NT_STATUS_DATA_LATE_ERROR}, { -+ ERRDOS, 23, NT_STATUS_DATA_ERROR}, { -+ ERRDOS, 23, NT_STATUS_CRC_ERROR}, { -+ ERRDOS, ERRnomem, NT_STATUS_SECTION_TOO_BIG}, { -+ ERRDOS, ERRnoaccess, NT_STATUS_PORT_CONNECTION_REFUSED}, { -+ ERRDOS, ERRbadfid, NT_STATUS_INVALID_PORT_HANDLE}, { -+ ERRDOS, ERRbadshare, NT_STATUS_SHARING_VIOLATION}, { -+ ERRHRD, ERRgeneral, NT_STATUS_QUOTA_EXCEEDED}, { -+ ERRDOS, 87, NT_STATUS_INVALID_PAGE_PROTECTION}, { -+ ERRDOS, 288, NT_STATUS_MUTANT_NOT_OWNED}, { -+ ERRDOS, 298, NT_STATUS_SEMAPHORE_LIMIT_EXCEEDED}, { -+ ERRDOS, 87, NT_STATUS_PORT_ALREADY_SET}, { -+ ERRDOS, 87, NT_STATUS_SECTION_NOT_IMAGE}, { -+ ERRDOS, 156, NT_STATUS_SUSPEND_COUNT_EXCEEDED}, { -+ ERRDOS, ERRnoaccess, NT_STATUS_THREAD_IS_TERMINATING}, { -+ ERRDOS, 87, NT_STATUS_BAD_WORKING_SET_LIMIT}, { -+ ERRDOS, 87, NT_STATUS_INCOMPATIBLE_FILE_MAP}, { -+ ERRDOS, 87, NT_STATUS_SECTION_PROTECTION}, { -+ ERRDOS, 282, NT_STATUS_EAS_NOT_SUPPORTED}, { -+ ERRDOS, 255, NT_STATUS_EA_TOO_LARGE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NONEXISTENT_EA_ENTRY}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NO_EAS_ON_FILE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_EA_CORRUPT_ERROR}, { -+ ERRDOS, ERRlock, NT_STATUS_FILE_LOCK_CONFLICT}, { -+ ERRDOS, ERRlock, NT_STATUS_LOCK_NOT_GRANTED}, { -+ ERRDOS, ERRbadfile, NT_STATUS_DELETE_PENDING}, { -+ ERRDOS, ERRunsup, NT_STATUS_CTL_FILE_NOT_SUPPORTED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_UNKNOWN_REVISION}, { -+ ERRHRD, ERRgeneral, NT_STATUS_REVISION_MISMATCH}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_OWNER}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_PRIMARY_GROUP}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NO_IMPERSONATION_TOKEN}, { -+ ERRHRD, ERRgeneral, NT_STATUS_CANT_DISABLE_MANDATORY}, { -+ ERRDOS, 2215, NT_STATUS_NO_LOGON_SERVERS}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_LOGON_SESSION}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_PRIVILEGE}, { -+ ERRDOS, ERRnoaccess, NT_STATUS_PRIVILEGE_NOT_HELD}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_ACCOUNT_NAME}, { -+ ERRHRD, ERRgeneral, NT_STATUS_USER_EXISTS}, -+/* { This NT error code was 'sqashed' -+ from NT_STATUS_NO_SUCH_USER to NT_STATUS_LOGON_FAILURE -+ during the session setup } */ -+ { -+ ERRDOS, ERRnoaccess, NT_STATUS_NO_SUCH_USER}, { -+ ERRHRD, ERRgeneral, NT_STATUS_GROUP_EXISTS}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_GROUP}, { -+ ERRHRD, ERRgeneral, NT_STATUS_MEMBER_IN_GROUP}, { -+ ERRHRD, ERRgeneral, NT_STATUS_MEMBER_NOT_IN_GROUP}, { -+ ERRHRD, ERRgeneral, NT_STATUS_LAST_ADMIN}, -+/* { This NT error code was 'sqashed' -+ from NT_STATUS_WRONG_PASSWORD to NT_STATUS_LOGON_FAILURE -+ during the session setup } */ -+ { -+ ERRSRV, ERRbadpw, NT_STATUS_WRONG_PASSWORD}, { -+ ERRHRD, ERRgeneral, NT_STATUS_ILL_FORMED_PASSWORD}, { -+ ERRHRD, ERRgeneral, NT_STATUS_PASSWORD_RESTRICTION}, { -+ ERRDOS, ERRnoaccess, NT_STATUS_LOGON_FAILURE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_ACCOUNT_RESTRICTION}, { -+ ERRSRV, 2241, NT_STATUS_INVALID_LOGON_HOURS}, { -+ ERRSRV, 2240, NT_STATUS_INVALID_WORKSTATION}, { -+ ERRSRV, 2242, NT_STATUS_PASSWORD_EXPIRED}, { -+ ERRSRV, 2239, NT_STATUS_ACCOUNT_DISABLED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NONE_MAPPED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_LUIDS_REQUESTED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_LUIDS_EXHAUSTED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_SUB_AUTHORITY}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_ACL}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_SID}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_SECURITY_DESCR}, { -+ ERRDOS, 127, NT_STATUS_PROCEDURE_NOT_FOUND}, { -+ ERRDOS, 193, NT_STATUS_INVALID_IMAGE_FORMAT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NO_TOKEN}, { -+ ERRHRD, ERRgeneral, NT_STATUS_BAD_INHERITANCE_ACL}, { -+ ERRDOS, 158, NT_STATUS_RANGE_NOT_LOCKED}, { -+ ERRDOS, 112, NT_STATUS_DISK_FULL}, { -+ ERRHRD, ERRgeneral, NT_STATUS_SERVER_DISABLED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_SERVER_NOT_DISABLED}, { -+ ERRDOS, 68, NT_STATUS_TOO_MANY_GUIDS_REQUESTED}, { -+ ERRDOS, 259, NT_STATUS_GUIDS_EXHAUSTED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_ID_AUTHORITY}, { -+ ERRDOS, 259, NT_STATUS_AGENTS_EXHAUSTED}, { -+ ERRDOS, 154, NT_STATUS_INVALID_VOLUME_LABEL}, { -+ ERRDOS, 14, NT_STATUS_SECTION_NOT_EXTENDED}, { -+ ERRDOS, 487, NT_STATUS_NOT_MAPPED_DATA}, { -+ ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_DATA_NOT_FOUND}, { -+ ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_TYPE_NOT_FOUND}, { -+ ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_NAME_NOT_FOUND}, { -+ ERRHRD, ERRgeneral, NT_STATUS_ARRAY_BOUNDS_EXCEEDED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_FLOAT_DENORMAL_OPERAND}, { -+ ERRHRD, ERRgeneral, NT_STATUS_FLOAT_DIVIDE_BY_ZERO}, { -+ ERRHRD, ERRgeneral, NT_STATUS_FLOAT_INEXACT_RESULT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_FLOAT_INVALID_OPERATION}, { -+ ERRHRD, ERRgeneral, NT_STATUS_FLOAT_OVERFLOW}, { -+ ERRHRD, ERRgeneral, NT_STATUS_FLOAT_STACK_CHECK}, { -+ ERRHRD, ERRgeneral, NT_STATUS_FLOAT_UNDERFLOW}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INTEGER_DIVIDE_BY_ZERO}, { -+ ERRDOS, 534, NT_STATUS_INTEGER_OVERFLOW}, { -+ ERRHRD, ERRgeneral, NT_STATUS_PRIVILEGED_INSTRUCTION}, { -+ ERRDOS, ERRnomem, NT_STATUS_TOO_MANY_PAGING_FILES}, { -+ ERRHRD, ERRgeneral, NT_STATUS_FILE_INVALID}, { -+ ERRHRD, ERRgeneral, NT_STATUS_ALLOTTED_SPACE_EXCEEDED}, -+/* { This NT error code was 'sqashed' -+ from NT_STATUS_INSUFFICIENT_RESOURCES to NT_STATUS_INSUFF_SERVER_RESOURCES -+ during the session setup } */ -+ { -+ ERRDOS, ERRnomem, NT_STATUS_INSUFFICIENT_RESOURCES}, { -+ ERRDOS, ERRbadpath, NT_STATUS_DFS_EXIT_PATH_FOUND}, { -+ ERRDOS, 23, NT_STATUS_DEVICE_DATA_ERROR}, { -+ ERRHRD, ERRgeneral, NT_STATUS_DEVICE_NOT_CONNECTED}, { -+ ERRDOS, 21, NT_STATUS_DEVICE_POWER_FAILURE}, { -+ ERRDOS, 487, NT_STATUS_FREE_VM_NOT_AT_BASE}, { -+ ERRDOS, 487, NT_STATUS_MEMORY_NOT_ALLOCATED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_WORKING_SET_QUOTA}, { -+ ERRDOS, 19, NT_STATUS_MEDIA_WRITE_PROTECTED}, { -+ ERRDOS, 21, NT_STATUS_DEVICE_NOT_READY}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_GROUP_ATTRIBUTES}, { -+ ERRHRD, ERRgeneral, NT_STATUS_BAD_IMPERSONATION_LEVEL}, { -+ ERRHRD, ERRgeneral, NT_STATUS_CANT_OPEN_ANONYMOUS}, { -+ ERRHRD, ERRgeneral, NT_STATUS_BAD_VALIDATION_CLASS}, { -+ ERRHRD, ERRgeneral, NT_STATUS_BAD_TOKEN_TYPE}, { -+ ERRDOS, 87, NT_STATUS_BAD_MASTER_BOOT_RECORD}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INSTRUCTION_MISALIGNMENT}, { -+ ERRDOS, ERRpipebusy, NT_STATUS_INSTANCE_NOT_AVAILABLE}, { -+ ERRDOS, ERRpipebusy, NT_STATUS_PIPE_NOT_AVAILABLE}, { -+ ERRDOS, ERRbadpipe, NT_STATUS_INVALID_PIPE_STATE}, { -+ ERRDOS, ERRpipebusy, NT_STATUS_PIPE_BUSY}, { -+ ERRDOS, ERRbadfunc, NT_STATUS_ILLEGAL_FUNCTION}, { -+ ERRDOS, ERRnotconnected, NT_STATUS_PIPE_DISCONNECTED}, { -+ ERRDOS, ERRpipeclosing, NT_STATUS_PIPE_CLOSING}, { -+ ERRHRD, ERRgeneral, NT_STATUS_PIPE_CONNECTED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_PIPE_LISTENING}, { -+ ERRDOS, ERRbadpipe, NT_STATUS_INVALID_READ_MODE}, { -+ ERRDOS, 121, NT_STATUS_IO_TIMEOUT}, { -+ ERRDOS, 38, NT_STATUS_FILE_FORCED_CLOSED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_PROFILING_NOT_STARTED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_PROFILING_NOT_STOPPED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_COULD_NOT_INTERPRET}, { -+ ERRDOS, ERRnoaccess, NT_STATUS_FILE_IS_A_DIRECTORY}, { -+ ERRDOS, ERRunsup, NT_STATUS_NOT_SUPPORTED}, { -+ ERRDOS, 51, NT_STATUS_REMOTE_NOT_LISTENING}, { -+ ERRDOS, 52, NT_STATUS_DUPLICATE_NAME}, { -+ ERRDOS, 53, NT_STATUS_BAD_NETWORK_PATH}, { -+ ERRDOS, 54, NT_STATUS_NETWORK_BUSY}, { -+ ERRDOS, 55, NT_STATUS_DEVICE_DOES_NOT_EXIST}, { -+ ERRDOS, 56, NT_STATUS_TOO_MANY_COMMANDS}, { -+ ERRDOS, 57, NT_STATUS_ADAPTER_HARDWARE_ERROR}, { -+ ERRDOS, 58, NT_STATUS_INVALID_NETWORK_RESPONSE}, { -+ ERRDOS, 59, NT_STATUS_UNEXPECTED_NETWORK_ERROR}, { -+ ERRDOS, 60, NT_STATUS_BAD_REMOTE_ADAPTER}, { -+ ERRDOS, 61, NT_STATUS_PRINT_QUEUE_FULL}, { -+ ERRDOS, 62, NT_STATUS_NO_SPOOL_SPACE}, { -+ ERRDOS, 63, NT_STATUS_PRINT_CANCELLED}, { -+ ERRDOS, 64, NT_STATUS_NETWORK_NAME_DELETED}, { -+ ERRDOS, 65, NT_STATUS_NETWORK_ACCESS_DENIED}, { -+ ERRDOS, 66, NT_STATUS_BAD_DEVICE_TYPE}, { -+ ERRDOS, ERRnosuchshare, NT_STATUS_BAD_NETWORK_NAME}, { -+ ERRDOS, 68, NT_STATUS_TOO_MANY_NAMES}, { -+ ERRDOS, 69, NT_STATUS_TOO_MANY_SESSIONS}, { -+ ERRDOS, 70, NT_STATUS_SHARING_PAUSED}, { -+ ERRDOS, 71, NT_STATUS_REQUEST_NOT_ACCEPTED}, { -+ ERRDOS, 72, NT_STATUS_REDIRECTOR_PAUSED}, { -+ ERRDOS, 88, NT_STATUS_NET_WRITE_FAULT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_PROFILING_AT_LIMIT}, { -+ ERRDOS, ERRdiffdevice, NT_STATUS_NOT_SAME_DEVICE}, { -+ ERRDOS, ERRnoaccess, NT_STATUS_FILE_RENAMED}, { -+ ERRDOS, 240, NT_STATUS_VIRTUAL_CIRCUIT_CLOSED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NO_SECURITY_ON_OBJECT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_CANT_WAIT}, { -+ ERRDOS, ERRpipeclosing, NT_STATUS_PIPE_EMPTY}, { -+ ERRHRD, ERRgeneral, NT_STATUS_CANT_ACCESS_DOMAIN_INFO}, { -+ ERRHRD, ERRgeneral, NT_STATUS_CANT_TERMINATE_SELF}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_SERVER_STATE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_DOMAIN_STATE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_DOMAIN_ROLE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_DOMAIN}, { -+ ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_EXISTS}, { -+ ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_LIMIT_EXCEEDED}, { -+ ERRDOS, 300, NT_STATUS_OPLOCK_NOT_GRANTED}, { -+ ERRDOS, 301, NT_STATUS_INVALID_OPLOCK_PROTOCOL}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INTERNAL_DB_CORRUPTION}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INTERNAL_ERROR}, { -+ ERRHRD, ERRgeneral, NT_STATUS_GENERIC_NOT_MAPPED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_BAD_DESCRIPTOR_FORMAT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_USER_BUFFER}, { -+ ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_IO_ERROR}, { -+ ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_MM_CREATE_ERR}, { -+ ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_MM_MAP_ERROR}, { -+ ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_MM_EXTEND_ERR}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NOT_LOGON_PROCESS}, { -+ ERRHRD, ERRgeneral, NT_STATUS_LOGON_SESSION_EXISTS}, { -+ ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_1}, { -+ ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_2}, { -+ ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_3}, { -+ ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_4}, { -+ ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_5}, { -+ ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_6}, { -+ ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_7}, { -+ ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_8}, { -+ ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_9}, { -+ ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_10}, { -+ ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_11}, { -+ ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_12}, { -+ ERRDOS, ERRbadpath, NT_STATUS_REDIRECTOR_NOT_STARTED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_REDIRECTOR_STARTED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_STACK_OVERFLOW}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_PACKAGE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_BAD_FUNCTION_TABLE}, { -+ ERRDOS, 203, 0xc0000100}, { -+ ERRDOS, 145, NT_STATUS_DIRECTORY_NOT_EMPTY}, { -+ ERRHRD, ERRgeneral, NT_STATUS_FILE_CORRUPT_ERROR}, { -+ ERRDOS, 267, NT_STATUS_NOT_A_DIRECTORY}, { -+ ERRHRD, ERRgeneral, NT_STATUS_BAD_LOGON_SESSION_STATE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_LOGON_SESSION_COLLISION}, { -+ ERRDOS, 206, NT_STATUS_NAME_TOO_LONG}, { -+ ERRDOS, 2401, NT_STATUS_FILES_OPEN}, { -+ ERRDOS, 2404, NT_STATUS_CONNECTION_IN_USE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_MESSAGE_NOT_FOUND}, { -+ ERRDOS, ERRnoaccess, NT_STATUS_PROCESS_IS_TERMINATING}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_LOGON_TYPE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NO_GUID_TRANSLATION}, { -+ ERRHRD, ERRgeneral, NT_STATUS_CANNOT_IMPERSONATE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_IMAGE_ALREADY_LOADED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_ABIOS_NOT_PRESENT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_ABIOS_LID_NOT_EXIST}, { -+ ERRHRD, ERRgeneral, NT_STATUS_ABIOS_LID_ALREADY_OWNED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_ABIOS_NOT_LID_OWNER}, { -+ ERRHRD, ERRgeneral, NT_STATUS_ABIOS_INVALID_COMMAND}, { -+ ERRHRD, ERRgeneral, NT_STATUS_ABIOS_INVALID_LID}, { -+ ERRHRD, ERRgeneral, NT_STATUS_ABIOS_SELECTOR_NOT_AVAILABLE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_ABIOS_INVALID_SELECTOR}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NO_LDT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_LDT_SIZE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_LDT_OFFSET}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_LDT_DESCRIPTOR}, { -+ ERRDOS, 193, NT_STATUS_INVALID_IMAGE_NE_FORMAT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_RXACT_INVALID_STATE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_RXACT_COMMIT_FAILURE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_MAPPED_FILE_SIZE_ZERO}, { -+ ERRDOS, ERRnofids, NT_STATUS_TOO_MANY_OPENED_FILES}, { -+ ERRHRD, ERRgeneral, NT_STATUS_CANCELLED}, { -+ ERRDOS, ERRnoaccess, NT_STATUS_CANNOT_DELETE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_COMPUTER_NAME}, { -+ ERRDOS, ERRnoaccess, NT_STATUS_FILE_DELETED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_SPECIAL_ACCOUNT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_SPECIAL_GROUP}, { -+ ERRHRD, ERRgeneral, NT_STATUS_SPECIAL_USER}, { -+ ERRHRD, ERRgeneral, NT_STATUS_MEMBERS_PRIMARY_GROUP}, { -+ ERRDOS, ERRbadfid, NT_STATUS_FILE_CLOSED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_THREADS}, { -+ ERRHRD, ERRgeneral, NT_STATUS_THREAD_NOT_IN_PROCESS}, { -+ ERRHRD, ERRgeneral, NT_STATUS_TOKEN_ALREADY_IN_USE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_PAGEFILE_QUOTA_EXCEEDED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_COMMITMENT_LIMIT}, { -+ ERRDOS, 193, NT_STATUS_INVALID_IMAGE_LE_FORMAT}, { -+ ERRDOS, 193, NT_STATUS_INVALID_IMAGE_NOT_MZ}, { -+ ERRDOS, 193, NT_STATUS_INVALID_IMAGE_PROTECT}, { -+ ERRDOS, 193, NT_STATUS_INVALID_IMAGE_WIN_16}, { -+ ERRHRD, ERRgeneral, NT_STATUS_LOGON_SERVER_CONFLICT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_TIME_DIFFERENCE_AT_DC}, { -+ ERRHRD, ERRgeneral, NT_STATUS_SYNCHRONIZATION_REQUIRED}, { -+ ERRDOS, 126, NT_STATUS_DLL_NOT_FOUND}, { -+ ERRHRD, ERRgeneral, NT_STATUS_OPEN_FAILED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_IO_PRIVILEGE_FAILED}, { -+ ERRDOS, 182, NT_STATUS_ORDINAL_NOT_FOUND}, { -+ ERRDOS, 127, NT_STATUS_ENTRYPOINT_NOT_FOUND}, { -+ ERRHRD, ERRgeneral, NT_STATUS_CONTROL_C_EXIT}, { -+ ERRDOS, 64, NT_STATUS_LOCAL_DISCONNECT}, { -+ ERRDOS, 64, NT_STATUS_REMOTE_DISCONNECT}, { -+ ERRDOS, 51, NT_STATUS_REMOTE_RESOURCES}, { -+ ERRDOS, 59, NT_STATUS_LINK_FAILED}, { -+ ERRDOS, 59, NT_STATUS_LINK_TIMEOUT}, { -+ ERRDOS, 59, NT_STATUS_INVALID_CONNECTION}, { -+ ERRDOS, 59, NT_STATUS_INVALID_ADDRESS}, { -+ ERRHRD, ERRgeneral, NT_STATUS_DLL_INIT_FAILED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_MISSING_SYSTEMFILE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_UNHANDLED_EXCEPTION}, { -+ ERRHRD, ERRgeneral, NT_STATUS_APP_INIT_FAILURE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_PAGEFILE_CREATE_FAILED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NO_PAGEFILE}, { -+ ERRDOS, 124, NT_STATUS_INVALID_LEVEL}, { -+ ERRDOS, 86, NT_STATUS_WRONG_PASSWORD_CORE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_ILLEGAL_FLOAT_CONTEXT}, { -+ ERRDOS, 109, NT_STATUS_PIPE_BROKEN}, { -+ ERRHRD, ERRgeneral, NT_STATUS_REGISTRY_CORRUPT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_REGISTRY_IO_FAILED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NO_EVENT_PAIR}, { -+ ERRHRD, ERRgeneral, NT_STATUS_UNRECOGNIZED_VOLUME}, { -+ ERRHRD, ERRgeneral, NT_STATUS_SERIAL_NO_DEVICE_INITED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_ALIAS}, { -+ ERRHRD, ERRgeneral, NT_STATUS_MEMBER_NOT_IN_ALIAS}, { -+ ERRHRD, ERRgeneral, NT_STATUS_MEMBER_IN_ALIAS}, { -+ ERRHRD, ERRgeneral, NT_STATUS_ALIAS_EXISTS}, { -+ ERRHRD, ERRgeneral, NT_STATUS_LOGON_NOT_GRANTED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_SECRETS}, { -+ ERRHRD, ERRgeneral, NT_STATUS_SECRET_TOO_LONG}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INTERNAL_DB_ERROR}, { -+ ERRHRD, ERRgeneral, NT_STATUS_FULLSCREEN_MODE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_CONTEXT_IDS}, { -+ ERRDOS, ERRnoaccess, NT_STATUS_LOGON_TYPE_NOT_GRANTED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NOT_REGISTRY_FILE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NT_CROSS_ENCRYPTION_REQUIRED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_CTRLR_CONFIG_ERROR}, { -+ ERRHRD, ERRgeneral, NT_STATUS_FT_MISSING_MEMBER}, { -+ ERRHRD, ERRgeneral, NT_STATUS_ILL_FORMED_SERVICE_ENTRY}, { -+ ERRHRD, ERRgeneral, NT_STATUS_ILLEGAL_CHARACTER}, { -+ ERRHRD, ERRgeneral, NT_STATUS_UNMAPPABLE_CHARACTER}, { -+ ERRHRD, ERRgeneral, NT_STATUS_UNDEFINED_CHARACTER}, { -+ ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_VOLUME}, { -+ ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_ID_MARK_NOT_FOUND}, { -+ ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_WRONG_CYLINDER}, { -+ ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_UNKNOWN_ERROR}, { -+ ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_BAD_REGISTERS}, { -+ ERRHRD, ERRgeneral, NT_STATUS_DISK_RECALIBRATE_FAILED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_DISK_OPERATION_FAILED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_DISK_RESET_FAILED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_SHARED_IRQ_BUSY}, { -+ ERRHRD, ERRgeneral, NT_STATUS_FT_ORPHANING}, { -+ ERRHRD, ERRgeneral, 0xc000016e}, { -+ ERRHRD, ERRgeneral, 0xc000016f}, { -+ ERRHRD, ERRgeneral, 0xc0000170}, { -+ ERRHRD, ERRgeneral, 0xc0000171}, { -+ ERRHRD, ERRgeneral, NT_STATUS_PARTITION_FAILURE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_BLOCK_LENGTH}, { -+ ERRHRD, ERRgeneral, NT_STATUS_DEVICE_NOT_PARTITIONED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_UNABLE_TO_LOCK_MEDIA}, { -+ ERRHRD, ERRgeneral, NT_STATUS_UNABLE_TO_UNLOAD_MEDIA}, { -+ ERRHRD, ERRgeneral, NT_STATUS_EOM_OVERFLOW}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NO_MEDIA}, { -+ ERRHRD, ERRgeneral, 0xc0000179}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_MEMBER}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_MEMBER}, { -+ ERRHRD, ERRgeneral, NT_STATUS_KEY_DELETED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NO_LOG_SPACE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_SIDS}, { -+ ERRHRD, ERRgeneral, NT_STATUS_LM_CROSS_ENCRYPTION_REQUIRED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_KEY_HAS_CHILDREN}, { -+ ERRHRD, ERRgeneral, NT_STATUS_CHILD_MUST_BE_VOLATILE}, { -+ ERRDOS, 87, NT_STATUS_DEVICE_CONFIGURATION_ERROR}, { -+ ERRHRD, ERRgeneral, NT_STATUS_DRIVER_INTERNAL_ERROR}, { -+ ERRDOS, 22, NT_STATUS_INVALID_DEVICE_STATE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_IO_DEVICE_ERROR}, { -+ ERRHRD, ERRgeneral, NT_STATUS_DEVICE_PROTOCOL_ERROR}, { -+ ERRHRD, ERRgeneral, NT_STATUS_BACKUP_CONTROLLER}, { -+ ERRHRD, ERRgeneral, NT_STATUS_LOG_FILE_FULL}, { -+ ERRDOS, 19, NT_STATUS_TOO_LATE}, { -+ ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_LSA_SECRET}, -+/* { This NT error code was 'sqashed' -+ from NT_STATUS_NO_TRUST_SAM_ACCOUNT to NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE -+ during the session setup } */ -+ { -+ ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_SAM_ACCOUNT}, { -+ ERRDOS, ERRnoaccess, NT_STATUS_TRUSTED_DOMAIN_FAILURE}, { -+ ERRDOS, ERRnoaccess, NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_EVENTLOG_FILE_CORRUPT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_EVENTLOG_CANT_START}, { -+ ERRDOS, ERRnoaccess, NT_STATUS_TRUST_FAILURE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_MUTANT_LIMIT_EXCEEDED}, { -+ ERRDOS, ERRnetlogonNotStarted, NT_STATUS_NETLOGON_NOT_STARTED}, { -+ ERRSRV, 2239, NT_STATUS_ACCOUNT_EXPIRED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_POSSIBLE_DEADLOCK}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NETWORK_CREDENTIAL_CONFLICT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_REMOTE_SESSION_LIMIT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_EVENTLOG_FILE_CHANGED}, { -+ ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT}, { -+ ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT}, { -+ ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT}, -+/* { This NT error code was 'sqashed' -+ from NT_STATUS_DOMAIN_TRUST_INCONSISTENT to NT_STATUS_LOGON_FAILURE -+ during the session setup } */ -+ { -+ ERRDOS, ERRnoaccess, NT_STATUS_DOMAIN_TRUST_INCONSISTENT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_FS_DRIVER_REQUIRED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NO_USER_SESSION_KEY}, { -+ ERRDOS, 59, NT_STATUS_USER_SESSION_DELETED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_LANG_NOT_FOUND}, { -+ ERRDOS, ERRnomem, NT_STATUS_INSUFF_SERVER_RESOURCES}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_BUFFER_SIZE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_ADDRESS_COMPONENT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_ADDRESS_WILDCARD}, { -+ ERRDOS, 68, NT_STATUS_TOO_MANY_ADDRESSES}, { -+ ERRDOS, 52, NT_STATUS_ADDRESS_ALREADY_EXISTS}, { -+ ERRDOS, 64, NT_STATUS_ADDRESS_CLOSED}, { -+ ERRDOS, 64, NT_STATUS_CONNECTION_DISCONNECTED}, { -+ ERRDOS, 64, NT_STATUS_CONNECTION_RESET}, { -+ ERRDOS, 68, NT_STATUS_TOO_MANY_NODES}, { -+ ERRDOS, 59, NT_STATUS_TRANSACTION_ABORTED}, { -+ ERRDOS, 59, NT_STATUS_TRANSACTION_TIMED_OUT}, { -+ ERRDOS, 59, NT_STATUS_TRANSACTION_NO_RELEASE}, { -+ ERRDOS, 59, NT_STATUS_TRANSACTION_NO_MATCH}, { -+ ERRDOS, 59, NT_STATUS_TRANSACTION_RESPONDED}, { -+ ERRDOS, 59, NT_STATUS_TRANSACTION_INVALID_ID}, { -+ ERRDOS, 59, NT_STATUS_TRANSACTION_INVALID_TYPE}, { -+ ERRDOS, ERRunsup, NT_STATUS_NOT_SERVER_SESSION}, { -+ ERRDOS, ERRunsup, NT_STATUS_NOT_CLIENT_SESSION}, { -+ ERRHRD, ERRgeneral, NT_STATUS_CANNOT_LOAD_REGISTRY_FILE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_DEBUG_ATTACH_FAILED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_SYSTEM_PROCESS_TERMINATED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_DATA_NOT_ACCEPTED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NO_BROWSER_SERVERS_FOUND}, { -+ ERRHRD, ERRgeneral, NT_STATUS_VDM_HARD_ERROR}, { -+ ERRHRD, ERRgeneral, NT_STATUS_DRIVER_CANCEL_TIMEOUT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_REPLY_MESSAGE_MISMATCH}, { -+ ERRHRD, ERRgeneral, NT_STATUS_MAPPED_ALIGNMENT}, { -+ ERRDOS, 193, NT_STATUS_IMAGE_CHECKSUM_MISMATCH}, { -+ ERRHRD, ERRgeneral, NT_STATUS_LOST_WRITEBEHIND_DATA}, { -+ ERRHRD, ERRgeneral, NT_STATUS_CLIENT_SERVER_PARAMETERS_INVALID}, { -+ ERRSRV, 2242, NT_STATUS_PASSWORD_MUST_CHANGE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NOT_FOUND}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NOT_TINY_STREAM}, { -+ ERRHRD, ERRgeneral, NT_STATUS_RECOVERY_FAILURE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_STACK_OVERFLOW_READ}, { -+ ERRHRD, ERRgeneral, NT_STATUS_FAIL_CHECK}, { -+ ERRHRD, ERRgeneral, NT_STATUS_DUPLICATE_OBJECTID}, { -+ ERRHRD, ERRgeneral, NT_STATUS_OBJECTID_EXISTS}, { -+ ERRHRD, ERRgeneral, NT_STATUS_CONVERT_TO_LARGE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_RETRY}, { -+ ERRHRD, ERRgeneral, NT_STATUS_FOUND_OUT_OF_SCOPE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_ALLOCATE_BUCKET}, { -+ ERRHRD, ERRgeneral, NT_STATUS_PROPSET_NOT_FOUND}, { -+ ERRHRD, ERRgeneral, NT_STATUS_MARSHALL_OVERFLOW}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_VARIANT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND}, { -+ ERRDOS, ERRnoaccess, NT_STATUS_ACCOUNT_LOCKED_OUT}, { -+ ERRDOS, ERRbadfid, NT_STATUS_HANDLE_NOT_CLOSABLE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_REFUSED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_GRACEFUL_DISCONNECT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_ADDRESS_ALREADY_ASSOCIATED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_ADDRESS_NOT_ASSOCIATED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_INVALID}, { -+ ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_ACTIVE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NETWORK_UNREACHABLE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_HOST_UNREACHABLE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_PROTOCOL_UNREACHABLE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_PORT_UNREACHABLE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_REQUEST_ABORTED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_ABORTED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_BAD_COMPRESSION_BUFFER}, { -+ ERRHRD, ERRgeneral, NT_STATUS_USER_MAPPED_FILE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_AUDIT_FAILED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_TIMER_RESOLUTION_NOT_SET}, { -+ ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_COUNT_LIMIT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_LOGIN_TIME_RESTRICTION}, { -+ ERRHRD, ERRgeneral, NT_STATUS_LOGIN_WKSTA_RESTRICTION}, { -+ ERRDOS, 193, NT_STATUS_IMAGE_MP_UP_MISMATCH}, { -+ ERRHRD, ERRgeneral, 0xc000024a}, { -+ ERRHRD, ERRgeneral, 0xc000024b}, { -+ ERRHRD, ERRgeneral, 0xc000024c}, { -+ ERRHRD, ERRgeneral, 0xc000024d}, { -+ ERRHRD, ERRgeneral, 0xc000024e}, { -+ ERRHRD, ERRgeneral, 0xc000024f}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INSUFFICIENT_LOGON_INFO}, { -+ ERRHRD, ERRgeneral, NT_STATUS_BAD_DLL_ENTRYPOINT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_BAD_SERVICE_ENTRYPOINT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_LPC_REPLY_LOST}, { -+ ERRHRD, ERRgeneral, NT_STATUS_IP_ADDRESS_CONFLICT1}, { -+ ERRHRD, ERRgeneral, NT_STATUS_IP_ADDRESS_CONFLICT2}, { -+ ERRHRD, ERRgeneral, NT_STATUS_REGISTRY_QUOTA_LIMIT}, { -+ ERRSRV, 3, NT_STATUS_PATH_NOT_COVERED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_NO_CALLBACK_ACTIVE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_LICENSE_QUOTA_EXCEEDED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_PWD_TOO_SHORT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_PWD_TOO_RECENT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_PWD_HISTORY_CONFLICT}, { -+ ERRHRD, ERRgeneral, 0xc000025d}, { -+ ERRHRD, ERRgeneral, NT_STATUS_PLUGPLAY_NO_DEVICE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_UNSUPPORTED_COMPRESSION}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_HW_PROFILE}, { -+ ERRHRD, ERRgeneral, NT_STATUS_INVALID_PLUGPLAY_DEVICE_PATH}, { -+ ERRDOS, 182, NT_STATUS_DRIVER_ORDINAL_NOT_FOUND}, { -+ ERRDOS, 127, NT_STATUS_DRIVER_ENTRYPOINT_NOT_FOUND}, { -+ ERRDOS, 288, NT_STATUS_RESOURCE_NOT_OWNED}, { -+ ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_LINKS}, { -+ ERRHRD, ERRgeneral, NT_STATUS_QUOTA_LIST_INCONSISTENT}, { -+ ERRHRD, ERRgeneral, NT_STATUS_FILE_IS_OFFLINE}, { -+ ERRDOS, 21, 0xc000026e}, { -+ ERRDOS, 161, 0xc0000281}, { -+ ERRDOS, ERRnoaccess, 0xc000028a}, { -+ ERRDOS, ERRnoaccess, 0xc000028b}, { -+ ERRHRD, ERRgeneral, 0xc000028c}, { -+ ERRDOS, ERRnoaccess, 0xc000028d}, { -+ ERRDOS, ERRnoaccess, 0xc000028e}, { -+ ERRDOS, ERRnoaccess, 0xc000028f}, { -+ ERRDOS, ERRnoaccess, 0xc0000290}, { -+ERRDOS, ERRbadfunc, 0xc000029c},}; -+ -+/***************************************************************************** -+ Print an error message from the status code -+ *****************************************************************************/ -+static void -+cifs_print_status(__u32 status_code) -+{ -+ int idx = 0; -+ -+ while (nt_errs[idx].nt_errstr != NULL) { -+ if (((nt_errs[idx].nt_errcode) & 0xFFFFFF) == -+ (status_code & 0xFFFFFF)) { -+ printk(KERN_NOTICE "Status code returned 0x%08x %s\n", -+ status_code,nt_errs[idx].nt_errstr); -+ } -+ idx++; -+ } -+ return; -+} -+ -+ -+static void -+ntstatus_to_dos(__u32 ntstatus, __u8 * eclass, __u16 * ecode) -+{ -+ int i; -+ if (ntstatus == 0) { -+ *eclass = 0; -+ *ecode = 0; -+ return; -+ } -+ for (i = 0; ntstatus_to_dos_map[i].ntstatus; i++) { -+ if (ntstatus == ntstatus_to_dos_map[i].ntstatus) { -+ *eclass = ntstatus_to_dos_map[i].dos_class; -+ *ecode = ntstatus_to_dos_map[i].dos_code; -+ return; -+ } -+ } -+ *eclass = ERRHRD; -+ *ecode = ERRgeneral; -+} -+ -+int -+map_smb_to_linux_error(struct smb_hdr *smb) -+{ -+ unsigned int i; -+ int rc = -EIO; /* if transport error smb error may not be set */ -+ __u8 smberrclass; -+ __u16 smberrcode; -+ -+ /* BB if NT Status codes - map NT BB */ -+ -+ /* old style smb error codes */ -+ if (smb->Status.CifsError == 0) -+ return 0; -+ -+ if (smb->Flags2 & SMBFLG2_ERR_STATUS) { -+ /* translate the newer STATUS codes to old style errors and then to POSIX errors */ -+ smb->Status.CifsError = le32_to_cpu(smb->Status.CifsError); -+ if(cifsFYI) -+ cifs_print_status(smb->Status.CifsError); -+ ntstatus_to_dos(smb->Status.CifsError, &smberrclass, -+ &smberrcode); -+ } else { -+ smberrclass = smb->Status.DosError.ErrorClass; -+ smb->Status.DosError.Error = -+ le16_to_cpu(smb->Status.DosError.Error); -+ smberrcode = smb->Status.DosError.Error; -+ } -+ -+ /* old style errors */ -+ -+ /* DOS class smb error codes - map DOS */ -+ if (smberrclass == ERRDOS) { /* one byte field no need to byte reverse */ -+ for (i = 0; -+ i < -+ sizeof (mapping_table_ERRDOS) / -+ sizeof (struct smb_to_posix_error); i++) { -+ if (mapping_table_ERRDOS[i].smb_err == 0) -+ break; -+ else if (mapping_table_ERRDOS[i].smb_err == smberrcode) { -+ rc = mapping_table_ERRDOS[i].posix_code; -+ break; -+ } -+ /* else try the next error mapping one to see if it will match */ -+ } -+ } else if (smberrclass == ERRSRV) { /* server class of error codes */ -+ for (i = 0; -+ i < -+ sizeof (mapping_table_ERRSRV) / -+ sizeof (struct smb_to_posix_error); i++) { -+ if (mapping_table_ERRSRV[i].smb_err == 0) -+ break; -+ else if (mapping_table_ERRSRV[i].smb_err == smberrcode) { -+ rc = mapping_table_ERRSRV[i].posix_code; -+ break; -+ } -+ /* else try the next error mapping one to see if it will match */ -+ } -+ } -+ /* else ERRHRD class errors or junk - return EIO */ -+ -+ cFYI(1, (" !!Mapping smb error code %d to POSIX err %d !!", smberrcode,rc)); -+ -+ /* generic corrective action e.g. reconnect SMB session on ERRbaduid could be added */ -+ -+ return rc; -+} -+ -+/* -+ * calculate the size of the SMB message based on the fixed header -+ * portion, the number of word parameters and the data portion of the message -+ */ -+unsigned int -+smbCalcSize(struct smb_hdr *ptr) -+{ -+ return (sizeof (struct smb_hdr) + (2 * ptr->WordCount) + -+ BCC(ptr)); -+} -+ -+/* The following are taken from fs/ntfs/util.c */ -+ -+#define NTFS_TIME_OFFSET ((u64)(369*365 + 89) * 24 * 3600 * 10000000) -+ -+ /* -+ * Convert the NT UTC (based 1601-01-01, in hundred nanosecond units) -+ * into Unix UTC (based 1970-01-01, in seconds). -+ */ -+time_t -+cifs_NTtimeToUnix(__u64 ntutc) -+{ -+ /* BB what about the timezone? BB */ -+ -+ /* Subtract the NTFS time offset, then convert to 1s intervals. */ -+ u64 t; -+ -+ t = ntutc - NTFS_TIME_OFFSET; -+ do_div(t, 10000000); -+ return (time_t)t; -+} -+ -+/* Convert the Unix UTC into NT UTC. */ -+__u64 -+cifs_UnixTimeToNT(time_t t) -+{ -+ __u64 dce_time; -+ /* Convert to 100ns intervals and then add the NTFS time offset. */ -+ dce_time = (__u64) t * 10000000; -+ dce_time += NTFS_TIME_OFFSET; -+ return dce_time; -+} -diff -urN linux-2.4.29.old/fs/cifs/nterr.c linux-2.4.29/fs/cifs/nterr.c ---- linux-2.4.29.old/fs/cifs/nterr.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/nterr.c 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,687 @@ -+/* -+ * Unix SMB/Netbios implementation. -+ * Version 1.9. -+ * RPC Pipe client / server routines -+ * Copyright (C) Luke Kenneth Casson Leighton 1997-2001. -+ * -+ * 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. -+ */ -+ -+/* NT error codes - see nterr.h */ -+#include -+#include -+#include "nterr.h" -+ -+const struct nt_err_code_struct nt_errs[] = { -+ {"NT_STATUS_OK", NT_STATUS_OK}, -+ {"NT_STATUS_UNSUCCESSFUL", NT_STATUS_UNSUCCESSFUL}, -+ {"NT_STATUS_NOT_IMPLEMENTED", NT_STATUS_NOT_IMPLEMENTED}, -+ {"NT_STATUS_INVALID_INFO_CLASS", NT_STATUS_INVALID_INFO_CLASS}, -+ {"NT_STATUS_INFO_LENGTH_MISMATCH", NT_STATUS_INFO_LENGTH_MISMATCH}, -+ {"NT_STATUS_ACCESS_VIOLATION", NT_STATUS_ACCESS_VIOLATION}, -+ {"STATUS_BUFFER_OVERFLOW", STATUS_BUFFER_OVERFLOW}, -+ {"NT_STATUS_IN_PAGE_ERROR", NT_STATUS_IN_PAGE_ERROR}, -+ {"NT_STATUS_PAGEFILE_QUOTA", NT_STATUS_PAGEFILE_QUOTA}, -+ {"NT_STATUS_INVALID_HANDLE", NT_STATUS_INVALID_HANDLE}, -+ {"NT_STATUS_BAD_INITIAL_STACK", NT_STATUS_BAD_INITIAL_STACK}, -+ {"NT_STATUS_BAD_INITIAL_PC", NT_STATUS_BAD_INITIAL_PC}, -+ {"NT_STATUS_INVALID_CID", NT_STATUS_INVALID_CID}, -+ {"NT_STATUS_TIMER_NOT_CANCELED", NT_STATUS_TIMER_NOT_CANCELED}, -+ {"NT_STATUS_INVALID_PARAMETER", NT_STATUS_INVALID_PARAMETER}, -+ {"NT_STATUS_NO_SUCH_DEVICE", NT_STATUS_NO_SUCH_DEVICE}, -+ {"NT_STATUS_NO_SUCH_FILE", NT_STATUS_NO_SUCH_FILE}, -+ {"NT_STATUS_INVALID_DEVICE_REQUEST", -+ NT_STATUS_INVALID_DEVICE_REQUEST}, -+ {"NT_STATUS_END_OF_FILE", NT_STATUS_END_OF_FILE}, -+ {"NT_STATUS_WRONG_VOLUME", NT_STATUS_WRONG_VOLUME}, -+ {"NT_STATUS_NO_MEDIA_IN_DEVICE", NT_STATUS_NO_MEDIA_IN_DEVICE}, -+ {"NT_STATUS_UNRECOGNIZED_MEDIA", NT_STATUS_UNRECOGNIZED_MEDIA}, -+ {"NT_STATUS_NONEXISTENT_SECTOR", NT_STATUS_NONEXISTENT_SECTOR}, -+ {"NT_STATUS_MORE_PROCESSING_REQUIRED", -+ NT_STATUS_MORE_PROCESSING_REQUIRED}, -+ {"NT_STATUS_NO_MEMORY", NT_STATUS_NO_MEMORY}, -+ {"NT_STATUS_CONFLICTING_ADDRESSES", -+ NT_STATUS_CONFLICTING_ADDRESSES}, -+ {"NT_STATUS_NOT_MAPPED_VIEW", NT_STATUS_NOT_MAPPED_VIEW}, -+ {"NT_STATUS_UNABLE_TO_FREE_VM", NT_STATUS_UNABLE_TO_FREE_VM}, -+ {"NT_STATUS_UNABLE_TO_DELETE_SECTION", -+ NT_STATUS_UNABLE_TO_DELETE_SECTION}, -+ {"NT_STATUS_INVALID_SYSTEM_SERVICE", -+ NT_STATUS_INVALID_SYSTEM_SERVICE}, -+ {"NT_STATUS_ILLEGAL_INSTRUCTION", NT_STATUS_ILLEGAL_INSTRUCTION}, -+ {"NT_STATUS_INVALID_LOCK_SEQUENCE", -+ NT_STATUS_INVALID_LOCK_SEQUENCE}, -+ {"NT_STATUS_INVALID_VIEW_SIZE", NT_STATUS_INVALID_VIEW_SIZE}, -+ {"NT_STATUS_INVALID_FILE_FOR_SECTION", -+ NT_STATUS_INVALID_FILE_FOR_SECTION}, -+ {"NT_STATUS_ALREADY_COMMITTED", NT_STATUS_ALREADY_COMMITTED}, -+ {"NT_STATUS_ACCESS_DENIED", NT_STATUS_ACCESS_DENIED}, -+ {"NT_STATUS_BUFFER_TOO_SMALL", NT_STATUS_BUFFER_TOO_SMALL}, -+ {"NT_STATUS_OBJECT_TYPE_MISMATCH", NT_STATUS_OBJECT_TYPE_MISMATCH}, -+ {"NT_STATUS_NONCONTINUABLE_EXCEPTION", -+ NT_STATUS_NONCONTINUABLE_EXCEPTION}, -+ {"NT_STATUS_INVALID_DISPOSITION", NT_STATUS_INVALID_DISPOSITION}, -+ {"NT_STATUS_UNWIND", NT_STATUS_UNWIND}, -+ {"NT_STATUS_BAD_STACK", NT_STATUS_BAD_STACK}, -+ {"NT_STATUS_INVALID_UNWIND_TARGET", -+ NT_STATUS_INVALID_UNWIND_TARGET}, -+ {"NT_STATUS_NOT_LOCKED", NT_STATUS_NOT_LOCKED}, -+ {"NT_STATUS_PARITY_ERROR", NT_STATUS_PARITY_ERROR}, -+ {"NT_STATUS_UNABLE_TO_DECOMMIT_VM", -+ NT_STATUS_UNABLE_TO_DECOMMIT_VM}, -+ {"NT_STATUS_NOT_COMMITTED", NT_STATUS_NOT_COMMITTED}, -+ {"NT_STATUS_INVALID_PORT_ATTRIBUTES", -+ NT_STATUS_INVALID_PORT_ATTRIBUTES}, -+ {"NT_STATUS_PORT_MESSAGE_TOO_LONG", -+ NT_STATUS_PORT_MESSAGE_TOO_LONG}, -+ {"NT_STATUS_INVALID_PARAMETER_MIX", -+ NT_STATUS_INVALID_PARAMETER_MIX}, -+ {"NT_STATUS_INVALID_QUOTA_LOWER", NT_STATUS_INVALID_QUOTA_LOWER}, -+ {"NT_STATUS_DISK_CORRUPT_ERROR", NT_STATUS_DISK_CORRUPT_ERROR}, -+ {"NT_STATUS_OBJECT_NAME_INVALID", NT_STATUS_OBJECT_NAME_INVALID}, -+ {"NT_STATUS_OBJECT_NAME_NOT_FOUND", -+ NT_STATUS_OBJECT_NAME_NOT_FOUND}, -+ {"NT_STATUS_OBJECT_NAME_COLLISION", -+ NT_STATUS_OBJECT_NAME_COLLISION}, -+ {"NT_STATUS_HANDLE_NOT_WAITABLE", NT_STATUS_HANDLE_NOT_WAITABLE}, -+ {"NT_STATUS_PORT_DISCONNECTED", NT_STATUS_PORT_DISCONNECTED}, -+ {"NT_STATUS_DEVICE_ALREADY_ATTACHED", -+ NT_STATUS_DEVICE_ALREADY_ATTACHED}, -+ {"NT_STATUS_OBJECT_PATH_INVALID", NT_STATUS_OBJECT_PATH_INVALID}, -+ {"NT_STATUS_OBJECT_PATH_NOT_FOUND", -+ NT_STATUS_OBJECT_PATH_NOT_FOUND}, -+ {"NT_STATUS_OBJECT_PATH_SYNTAX_BAD", -+ NT_STATUS_OBJECT_PATH_SYNTAX_BAD}, -+ {"NT_STATUS_DATA_OVERRUN", NT_STATUS_DATA_OVERRUN}, -+ {"NT_STATUS_DATA_LATE_ERROR", NT_STATUS_DATA_LATE_ERROR}, -+ {"NT_STATUS_DATA_ERROR", NT_STATUS_DATA_ERROR}, -+ {"NT_STATUS_CRC_ERROR", NT_STATUS_CRC_ERROR}, -+ {"NT_STATUS_SECTION_TOO_BIG", NT_STATUS_SECTION_TOO_BIG}, -+ {"NT_STATUS_PORT_CONNECTION_REFUSED", -+ NT_STATUS_PORT_CONNECTION_REFUSED}, -+ {"NT_STATUS_INVALID_PORT_HANDLE", NT_STATUS_INVALID_PORT_HANDLE}, -+ {"NT_STATUS_SHARING_VIOLATION", NT_STATUS_SHARING_VIOLATION}, -+ {"NT_STATUS_QUOTA_EXCEEDED", NT_STATUS_QUOTA_EXCEEDED}, -+ {"NT_STATUS_INVALID_PAGE_PROTECTION", -+ NT_STATUS_INVALID_PAGE_PROTECTION}, -+ {"NT_STATUS_MUTANT_NOT_OWNED", NT_STATUS_MUTANT_NOT_OWNED}, -+ {"NT_STATUS_SEMAPHORE_LIMIT_EXCEEDED", -+ NT_STATUS_SEMAPHORE_LIMIT_EXCEEDED}, -+ {"NT_STATUS_PORT_ALREADY_SET", NT_STATUS_PORT_ALREADY_SET}, -+ {"NT_STATUS_SECTION_NOT_IMAGE", NT_STATUS_SECTION_NOT_IMAGE}, -+ {"NT_STATUS_SUSPEND_COUNT_EXCEEDED", -+ NT_STATUS_SUSPEND_COUNT_EXCEEDED}, -+ {"NT_STATUS_THREAD_IS_TERMINATING", -+ NT_STATUS_THREAD_IS_TERMINATING}, -+ {"NT_STATUS_BAD_WORKING_SET_LIMIT", -+ NT_STATUS_BAD_WORKING_SET_LIMIT}, -+ {"NT_STATUS_INCOMPATIBLE_FILE_MAP", -+ NT_STATUS_INCOMPATIBLE_FILE_MAP}, -+ {"NT_STATUS_SECTION_PROTECTION", NT_STATUS_SECTION_PROTECTION}, -+ {"NT_STATUS_EAS_NOT_SUPPORTED", NT_STATUS_EAS_NOT_SUPPORTED}, -+ {"NT_STATUS_EA_TOO_LARGE", NT_STATUS_EA_TOO_LARGE}, -+ {"NT_STATUS_NONEXISTENT_EA_ENTRY", NT_STATUS_NONEXISTENT_EA_ENTRY}, -+ {"NT_STATUS_NO_EAS_ON_FILE", NT_STATUS_NO_EAS_ON_FILE}, -+ {"NT_STATUS_EA_CORRUPT_ERROR", NT_STATUS_EA_CORRUPT_ERROR}, -+ {"NT_STATUS_FILE_LOCK_CONFLICT", NT_STATUS_FILE_LOCK_CONFLICT}, -+ {"NT_STATUS_LOCK_NOT_GRANTED", NT_STATUS_LOCK_NOT_GRANTED}, -+ {"NT_STATUS_DELETE_PENDING", NT_STATUS_DELETE_PENDING}, -+ {"NT_STATUS_CTL_FILE_NOT_SUPPORTED", -+ NT_STATUS_CTL_FILE_NOT_SUPPORTED}, -+ {"NT_STATUS_UNKNOWN_REVISION", NT_STATUS_UNKNOWN_REVISION}, -+ {"NT_STATUS_REVISION_MISMATCH", NT_STATUS_REVISION_MISMATCH}, -+ {"NT_STATUS_INVALID_OWNER", NT_STATUS_INVALID_OWNER}, -+ {"NT_STATUS_INVALID_PRIMARY_GROUP", -+ NT_STATUS_INVALID_PRIMARY_GROUP}, -+ {"NT_STATUS_NO_IMPERSONATION_TOKEN", -+ NT_STATUS_NO_IMPERSONATION_TOKEN}, -+ {"NT_STATUS_CANT_DISABLE_MANDATORY", -+ NT_STATUS_CANT_DISABLE_MANDATORY}, -+ {"NT_STATUS_NO_LOGON_SERVERS", NT_STATUS_NO_LOGON_SERVERS}, -+ {"NT_STATUS_NO_SUCH_LOGON_SESSION", -+ NT_STATUS_NO_SUCH_LOGON_SESSION}, -+ {"NT_STATUS_NO_SUCH_PRIVILEGE", NT_STATUS_NO_SUCH_PRIVILEGE}, -+ {"NT_STATUS_PRIVILEGE_NOT_HELD", NT_STATUS_PRIVILEGE_NOT_HELD}, -+ {"NT_STATUS_INVALID_ACCOUNT_NAME", NT_STATUS_INVALID_ACCOUNT_NAME}, -+ {"NT_STATUS_USER_EXISTS", NT_STATUS_USER_EXISTS}, -+ {"NT_STATUS_NO_SUCH_USER", NT_STATUS_NO_SUCH_USER}, -+ {"NT_STATUS_GROUP_EXISTS", NT_STATUS_GROUP_EXISTS}, -+ {"NT_STATUS_NO_SUCH_GROUP", NT_STATUS_NO_SUCH_GROUP}, -+ {"NT_STATUS_MEMBER_IN_GROUP", NT_STATUS_MEMBER_IN_GROUP}, -+ {"NT_STATUS_MEMBER_NOT_IN_GROUP", NT_STATUS_MEMBER_NOT_IN_GROUP}, -+ {"NT_STATUS_LAST_ADMIN", NT_STATUS_LAST_ADMIN}, -+ {"NT_STATUS_WRONG_PASSWORD", NT_STATUS_WRONG_PASSWORD}, -+ {"NT_STATUS_ILL_FORMED_PASSWORD", NT_STATUS_ILL_FORMED_PASSWORD}, -+ {"NT_STATUS_PASSWORD_RESTRICTION", NT_STATUS_PASSWORD_RESTRICTION}, -+ {"NT_STATUS_LOGON_FAILURE", NT_STATUS_LOGON_FAILURE}, -+ {"NT_STATUS_ACCOUNT_RESTRICTION", NT_STATUS_ACCOUNT_RESTRICTION}, -+ {"NT_STATUS_INVALID_LOGON_HOURS", NT_STATUS_INVALID_LOGON_HOURS}, -+ {"NT_STATUS_INVALID_WORKSTATION", NT_STATUS_INVALID_WORKSTATION}, -+ {"NT_STATUS_PASSWORD_EXPIRED", NT_STATUS_PASSWORD_EXPIRED}, -+ {"NT_STATUS_ACCOUNT_DISABLED", NT_STATUS_ACCOUNT_DISABLED}, -+ {"NT_STATUS_NONE_MAPPED", NT_STATUS_NONE_MAPPED}, -+ {"NT_STATUS_TOO_MANY_LUIDS_REQUESTED", -+ NT_STATUS_TOO_MANY_LUIDS_REQUESTED}, -+ {"NT_STATUS_LUIDS_EXHAUSTED", NT_STATUS_LUIDS_EXHAUSTED}, -+ {"NT_STATUS_INVALID_SUB_AUTHORITY", -+ NT_STATUS_INVALID_SUB_AUTHORITY}, -+ {"NT_STATUS_INVALID_ACL", NT_STATUS_INVALID_ACL}, -+ {"NT_STATUS_INVALID_SID", NT_STATUS_INVALID_SID}, -+ {"NT_STATUS_INVALID_SECURITY_DESCR", -+ NT_STATUS_INVALID_SECURITY_DESCR}, -+ {"NT_STATUS_PROCEDURE_NOT_FOUND", NT_STATUS_PROCEDURE_NOT_FOUND}, -+ {"NT_STATUS_INVALID_IMAGE_FORMAT", NT_STATUS_INVALID_IMAGE_FORMAT}, -+ {"NT_STATUS_NO_TOKEN", NT_STATUS_NO_TOKEN}, -+ {"NT_STATUS_BAD_INHERITANCE_ACL", NT_STATUS_BAD_INHERITANCE_ACL}, -+ {"NT_STATUS_RANGE_NOT_LOCKED", NT_STATUS_RANGE_NOT_LOCKED}, -+ {"NT_STATUS_DISK_FULL", NT_STATUS_DISK_FULL}, -+ {"NT_STATUS_SERVER_DISABLED", NT_STATUS_SERVER_DISABLED}, -+ {"NT_STATUS_SERVER_NOT_DISABLED", NT_STATUS_SERVER_NOT_DISABLED}, -+ {"NT_STATUS_TOO_MANY_GUIDS_REQUESTED", -+ NT_STATUS_TOO_MANY_GUIDS_REQUESTED}, -+ {"NT_STATUS_GUIDS_EXHAUSTED", NT_STATUS_GUIDS_EXHAUSTED}, -+ {"NT_STATUS_INVALID_ID_AUTHORITY", NT_STATUS_INVALID_ID_AUTHORITY}, -+ {"NT_STATUS_AGENTS_EXHAUSTED", NT_STATUS_AGENTS_EXHAUSTED}, -+ {"NT_STATUS_INVALID_VOLUME_LABEL", NT_STATUS_INVALID_VOLUME_LABEL}, -+ {"NT_STATUS_SECTION_NOT_EXTENDED", NT_STATUS_SECTION_NOT_EXTENDED}, -+ {"NT_STATUS_NOT_MAPPED_DATA", NT_STATUS_NOT_MAPPED_DATA}, -+ {"NT_STATUS_RESOURCE_DATA_NOT_FOUND", -+ NT_STATUS_RESOURCE_DATA_NOT_FOUND}, -+ {"NT_STATUS_RESOURCE_TYPE_NOT_FOUND", -+ NT_STATUS_RESOURCE_TYPE_NOT_FOUND}, -+ {"NT_STATUS_RESOURCE_NAME_NOT_FOUND", -+ NT_STATUS_RESOURCE_NAME_NOT_FOUND}, -+ {"NT_STATUS_ARRAY_BOUNDS_EXCEEDED", -+ NT_STATUS_ARRAY_BOUNDS_EXCEEDED}, -+ {"NT_STATUS_FLOAT_DENORMAL_OPERAND", -+ NT_STATUS_FLOAT_DENORMAL_OPERAND}, -+ {"NT_STATUS_FLOAT_DIVIDE_BY_ZERO", NT_STATUS_FLOAT_DIVIDE_BY_ZERO}, -+ {"NT_STATUS_FLOAT_INEXACT_RESULT", NT_STATUS_FLOAT_INEXACT_RESULT}, -+ {"NT_STATUS_FLOAT_INVALID_OPERATION", -+ NT_STATUS_FLOAT_INVALID_OPERATION}, -+ {"NT_STATUS_FLOAT_OVERFLOW", NT_STATUS_FLOAT_OVERFLOW}, -+ {"NT_STATUS_FLOAT_STACK_CHECK", NT_STATUS_FLOAT_STACK_CHECK}, -+ {"NT_STATUS_FLOAT_UNDERFLOW", NT_STATUS_FLOAT_UNDERFLOW}, -+ {"NT_STATUS_INTEGER_DIVIDE_BY_ZERO", -+ NT_STATUS_INTEGER_DIVIDE_BY_ZERO}, -+ {"NT_STATUS_INTEGER_OVERFLOW", NT_STATUS_INTEGER_OVERFLOW}, -+ {"NT_STATUS_PRIVILEGED_INSTRUCTION", -+ NT_STATUS_PRIVILEGED_INSTRUCTION}, -+ {"NT_STATUS_TOO_MANY_PAGING_FILES", -+ NT_STATUS_TOO_MANY_PAGING_FILES}, -+ {"NT_STATUS_FILE_INVALID", NT_STATUS_FILE_INVALID}, -+ {"NT_STATUS_ALLOTTED_SPACE_EXCEEDED", -+ NT_STATUS_ALLOTTED_SPACE_EXCEEDED}, -+ {"NT_STATUS_INSUFFICIENT_RESOURCES", -+ NT_STATUS_INSUFFICIENT_RESOURCES}, -+ {"NT_STATUS_DFS_EXIT_PATH_FOUND", NT_STATUS_DFS_EXIT_PATH_FOUND}, -+ {"NT_STATUS_DEVICE_DATA_ERROR", NT_STATUS_DEVICE_DATA_ERROR}, -+ {"NT_STATUS_DEVICE_NOT_CONNECTED", NT_STATUS_DEVICE_NOT_CONNECTED}, -+ {"NT_STATUS_DEVICE_POWER_FAILURE", NT_STATUS_DEVICE_POWER_FAILURE}, -+ {"NT_STATUS_FREE_VM_NOT_AT_BASE", NT_STATUS_FREE_VM_NOT_AT_BASE}, -+ {"NT_STATUS_MEMORY_NOT_ALLOCATED", NT_STATUS_MEMORY_NOT_ALLOCATED}, -+ {"NT_STATUS_WORKING_SET_QUOTA", NT_STATUS_WORKING_SET_QUOTA}, -+ {"NT_STATUS_MEDIA_WRITE_PROTECTED", -+ NT_STATUS_MEDIA_WRITE_PROTECTED}, -+ {"NT_STATUS_DEVICE_NOT_READY", NT_STATUS_DEVICE_NOT_READY}, -+ {"NT_STATUS_INVALID_GROUP_ATTRIBUTES", -+ NT_STATUS_INVALID_GROUP_ATTRIBUTES}, -+ {"NT_STATUS_BAD_IMPERSONATION_LEVEL", -+ NT_STATUS_BAD_IMPERSONATION_LEVEL}, -+ {"NT_STATUS_CANT_OPEN_ANONYMOUS", NT_STATUS_CANT_OPEN_ANONYMOUS}, -+ {"NT_STATUS_BAD_VALIDATION_CLASS", NT_STATUS_BAD_VALIDATION_CLASS}, -+ {"NT_STATUS_BAD_TOKEN_TYPE", NT_STATUS_BAD_TOKEN_TYPE}, -+ {"NT_STATUS_BAD_MASTER_BOOT_RECORD", -+ NT_STATUS_BAD_MASTER_BOOT_RECORD}, -+ {"NT_STATUS_INSTRUCTION_MISALIGNMENT", -+ NT_STATUS_INSTRUCTION_MISALIGNMENT}, -+ {"NT_STATUS_INSTANCE_NOT_AVAILABLE", -+ NT_STATUS_INSTANCE_NOT_AVAILABLE}, -+ {"NT_STATUS_PIPE_NOT_AVAILABLE", NT_STATUS_PIPE_NOT_AVAILABLE}, -+ {"NT_STATUS_INVALID_PIPE_STATE", NT_STATUS_INVALID_PIPE_STATE}, -+ {"NT_STATUS_PIPE_BUSY", NT_STATUS_PIPE_BUSY}, -+ {"NT_STATUS_ILLEGAL_FUNCTION", NT_STATUS_ILLEGAL_FUNCTION}, -+ {"NT_STATUS_PIPE_DISCONNECTED", NT_STATUS_PIPE_DISCONNECTED}, -+ {"NT_STATUS_PIPE_CLOSING", NT_STATUS_PIPE_CLOSING}, -+ {"NT_STATUS_PIPE_CONNECTED", NT_STATUS_PIPE_CONNECTED}, -+ {"NT_STATUS_PIPE_LISTENING", NT_STATUS_PIPE_LISTENING}, -+ {"NT_STATUS_INVALID_READ_MODE", NT_STATUS_INVALID_READ_MODE}, -+ {"NT_STATUS_IO_TIMEOUT", NT_STATUS_IO_TIMEOUT}, -+ {"NT_STATUS_FILE_FORCED_CLOSED", NT_STATUS_FILE_FORCED_CLOSED}, -+ {"NT_STATUS_PROFILING_NOT_STARTED", -+ NT_STATUS_PROFILING_NOT_STARTED}, -+ {"NT_STATUS_PROFILING_NOT_STOPPED", -+ NT_STATUS_PROFILING_NOT_STOPPED}, -+ {"NT_STATUS_COULD_NOT_INTERPRET", NT_STATUS_COULD_NOT_INTERPRET}, -+ {"NT_STATUS_FILE_IS_A_DIRECTORY", NT_STATUS_FILE_IS_A_DIRECTORY}, -+ {"NT_STATUS_NOT_SUPPORTED", NT_STATUS_NOT_SUPPORTED}, -+ {"NT_STATUS_REMOTE_NOT_LISTENING", NT_STATUS_REMOTE_NOT_LISTENING}, -+ {"NT_STATUS_DUPLICATE_NAME", NT_STATUS_DUPLICATE_NAME}, -+ {"NT_STATUS_BAD_NETWORK_PATH", NT_STATUS_BAD_NETWORK_PATH}, -+ {"NT_STATUS_NETWORK_BUSY", NT_STATUS_NETWORK_BUSY}, -+ {"NT_STATUS_DEVICE_DOES_NOT_EXIST", -+ NT_STATUS_DEVICE_DOES_NOT_EXIST}, -+ {"NT_STATUS_TOO_MANY_COMMANDS", NT_STATUS_TOO_MANY_COMMANDS}, -+ {"NT_STATUS_ADAPTER_HARDWARE_ERROR", -+ NT_STATUS_ADAPTER_HARDWARE_ERROR}, -+ {"NT_STATUS_INVALID_NETWORK_RESPONSE", -+ NT_STATUS_INVALID_NETWORK_RESPONSE}, -+ {"NT_STATUS_UNEXPECTED_NETWORK_ERROR", -+ NT_STATUS_UNEXPECTED_NETWORK_ERROR}, -+ {"NT_STATUS_BAD_REMOTE_ADAPTER", NT_STATUS_BAD_REMOTE_ADAPTER}, -+ {"NT_STATUS_PRINT_QUEUE_FULL", NT_STATUS_PRINT_QUEUE_FULL}, -+ {"NT_STATUS_NO_SPOOL_SPACE", NT_STATUS_NO_SPOOL_SPACE}, -+ {"NT_STATUS_PRINT_CANCELLED", NT_STATUS_PRINT_CANCELLED}, -+ {"NT_STATUS_NETWORK_NAME_DELETED", NT_STATUS_NETWORK_NAME_DELETED}, -+ {"NT_STATUS_NETWORK_ACCESS_DENIED", -+ NT_STATUS_NETWORK_ACCESS_DENIED}, -+ {"NT_STATUS_BAD_DEVICE_TYPE", NT_STATUS_BAD_DEVICE_TYPE}, -+ {"NT_STATUS_BAD_NETWORK_NAME", NT_STATUS_BAD_NETWORK_NAME}, -+ {"NT_STATUS_TOO_MANY_NAMES", NT_STATUS_TOO_MANY_NAMES}, -+ {"NT_STATUS_TOO_MANY_SESSIONS", NT_STATUS_TOO_MANY_SESSIONS}, -+ {"NT_STATUS_SHARING_PAUSED", NT_STATUS_SHARING_PAUSED}, -+ {"NT_STATUS_REQUEST_NOT_ACCEPTED", NT_STATUS_REQUEST_NOT_ACCEPTED}, -+ {"NT_STATUS_REDIRECTOR_PAUSED", NT_STATUS_REDIRECTOR_PAUSED}, -+ {"NT_STATUS_NET_WRITE_FAULT", NT_STATUS_NET_WRITE_FAULT}, -+ {"NT_STATUS_PROFILING_AT_LIMIT", NT_STATUS_PROFILING_AT_LIMIT}, -+ {"NT_STATUS_NOT_SAME_DEVICE", NT_STATUS_NOT_SAME_DEVICE}, -+ {"NT_STATUS_FILE_RENAMED", NT_STATUS_FILE_RENAMED}, -+ {"NT_STATUS_VIRTUAL_CIRCUIT_CLOSED", -+ NT_STATUS_VIRTUAL_CIRCUIT_CLOSED}, -+ {"NT_STATUS_NO_SECURITY_ON_OBJECT", -+ NT_STATUS_NO_SECURITY_ON_OBJECT}, -+ {"NT_STATUS_CANT_WAIT", NT_STATUS_CANT_WAIT}, -+ {"NT_STATUS_PIPE_EMPTY", NT_STATUS_PIPE_EMPTY}, -+ {"NT_STATUS_CANT_ACCESS_DOMAIN_INFO", -+ NT_STATUS_CANT_ACCESS_DOMAIN_INFO}, -+ {"NT_STATUS_CANT_TERMINATE_SELF", NT_STATUS_CANT_TERMINATE_SELF}, -+ {"NT_STATUS_INVALID_SERVER_STATE", NT_STATUS_INVALID_SERVER_STATE}, -+ {"NT_STATUS_INVALID_DOMAIN_STATE", NT_STATUS_INVALID_DOMAIN_STATE}, -+ {"NT_STATUS_INVALID_DOMAIN_ROLE", NT_STATUS_INVALID_DOMAIN_ROLE}, -+ {"NT_STATUS_NO_SUCH_DOMAIN", NT_STATUS_NO_SUCH_DOMAIN}, -+ {"NT_STATUS_DOMAIN_EXISTS", NT_STATUS_DOMAIN_EXISTS}, -+ {"NT_STATUS_DOMAIN_LIMIT_EXCEEDED", -+ NT_STATUS_DOMAIN_LIMIT_EXCEEDED}, -+ {"NT_STATUS_OPLOCK_NOT_GRANTED", NT_STATUS_OPLOCK_NOT_GRANTED}, -+ {"NT_STATUS_INVALID_OPLOCK_PROTOCOL", -+ NT_STATUS_INVALID_OPLOCK_PROTOCOL}, -+ {"NT_STATUS_INTERNAL_DB_CORRUPTION", -+ NT_STATUS_INTERNAL_DB_CORRUPTION}, -+ {"NT_STATUS_INTERNAL_ERROR", NT_STATUS_INTERNAL_ERROR}, -+ {"NT_STATUS_GENERIC_NOT_MAPPED", NT_STATUS_GENERIC_NOT_MAPPED}, -+ {"NT_STATUS_BAD_DESCRIPTOR_FORMAT", -+ NT_STATUS_BAD_DESCRIPTOR_FORMAT}, -+ {"NT_STATUS_INVALID_USER_BUFFER", NT_STATUS_INVALID_USER_BUFFER}, -+ {"NT_STATUS_UNEXPECTED_IO_ERROR", NT_STATUS_UNEXPECTED_IO_ERROR}, -+ {"NT_STATUS_UNEXPECTED_MM_CREATE_ERR", -+ NT_STATUS_UNEXPECTED_MM_CREATE_ERR}, -+ {"NT_STATUS_UNEXPECTED_MM_MAP_ERROR", -+ NT_STATUS_UNEXPECTED_MM_MAP_ERROR}, -+ {"NT_STATUS_UNEXPECTED_MM_EXTEND_ERR", -+ NT_STATUS_UNEXPECTED_MM_EXTEND_ERR}, -+ {"NT_STATUS_NOT_LOGON_PROCESS", NT_STATUS_NOT_LOGON_PROCESS}, -+ {"NT_STATUS_LOGON_SESSION_EXISTS", NT_STATUS_LOGON_SESSION_EXISTS}, -+ {"NT_STATUS_INVALID_PARAMETER_1", NT_STATUS_INVALID_PARAMETER_1}, -+ {"NT_STATUS_INVALID_PARAMETER_2", NT_STATUS_INVALID_PARAMETER_2}, -+ {"NT_STATUS_INVALID_PARAMETER_3", NT_STATUS_INVALID_PARAMETER_3}, -+ {"NT_STATUS_INVALID_PARAMETER_4", NT_STATUS_INVALID_PARAMETER_4}, -+ {"NT_STATUS_INVALID_PARAMETER_5", NT_STATUS_INVALID_PARAMETER_5}, -+ {"NT_STATUS_INVALID_PARAMETER_6", NT_STATUS_INVALID_PARAMETER_6}, -+ {"NT_STATUS_INVALID_PARAMETER_7", NT_STATUS_INVALID_PARAMETER_7}, -+ {"NT_STATUS_INVALID_PARAMETER_8", NT_STATUS_INVALID_PARAMETER_8}, -+ {"NT_STATUS_INVALID_PARAMETER_9", NT_STATUS_INVALID_PARAMETER_9}, -+ {"NT_STATUS_INVALID_PARAMETER_10", NT_STATUS_INVALID_PARAMETER_10}, -+ {"NT_STATUS_INVALID_PARAMETER_11", NT_STATUS_INVALID_PARAMETER_11}, -+ {"NT_STATUS_INVALID_PARAMETER_12", NT_STATUS_INVALID_PARAMETER_12}, -+ {"NT_STATUS_REDIRECTOR_NOT_STARTED", -+ NT_STATUS_REDIRECTOR_NOT_STARTED}, -+ {"NT_STATUS_REDIRECTOR_STARTED", NT_STATUS_REDIRECTOR_STARTED}, -+ {"NT_STATUS_STACK_OVERFLOW", NT_STATUS_STACK_OVERFLOW}, -+ {"NT_STATUS_NO_SUCH_PACKAGE", NT_STATUS_NO_SUCH_PACKAGE}, -+ {"NT_STATUS_BAD_FUNCTION_TABLE", NT_STATUS_BAD_FUNCTION_TABLE}, -+ {"NT_STATUS_DIRECTORY_NOT_EMPTY", NT_STATUS_DIRECTORY_NOT_EMPTY}, -+ {"NT_STATUS_FILE_CORRUPT_ERROR", NT_STATUS_FILE_CORRUPT_ERROR}, -+ {"NT_STATUS_NOT_A_DIRECTORY", NT_STATUS_NOT_A_DIRECTORY}, -+ {"NT_STATUS_BAD_LOGON_SESSION_STATE", -+ NT_STATUS_BAD_LOGON_SESSION_STATE}, -+ {"NT_STATUS_LOGON_SESSION_COLLISION", -+ NT_STATUS_LOGON_SESSION_COLLISION}, -+ {"NT_STATUS_NAME_TOO_LONG", NT_STATUS_NAME_TOO_LONG}, -+ {"NT_STATUS_FILES_OPEN", NT_STATUS_FILES_OPEN}, -+ {"NT_STATUS_CONNECTION_IN_USE", NT_STATUS_CONNECTION_IN_USE}, -+ {"NT_STATUS_MESSAGE_NOT_FOUND", NT_STATUS_MESSAGE_NOT_FOUND}, -+ {"NT_STATUS_PROCESS_IS_TERMINATING", -+ NT_STATUS_PROCESS_IS_TERMINATING}, -+ {"NT_STATUS_INVALID_LOGON_TYPE", NT_STATUS_INVALID_LOGON_TYPE}, -+ {"NT_STATUS_NO_GUID_TRANSLATION", NT_STATUS_NO_GUID_TRANSLATION}, -+ {"NT_STATUS_CANNOT_IMPERSONATE", NT_STATUS_CANNOT_IMPERSONATE}, -+ {"NT_STATUS_IMAGE_ALREADY_LOADED", NT_STATUS_IMAGE_ALREADY_LOADED}, -+ {"NT_STATUS_ABIOS_NOT_PRESENT", NT_STATUS_ABIOS_NOT_PRESENT}, -+ {"NT_STATUS_ABIOS_LID_NOT_EXIST", NT_STATUS_ABIOS_LID_NOT_EXIST}, -+ {"NT_STATUS_ABIOS_LID_ALREADY_OWNED", -+ NT_STATUS_ABIOS_LID_ALREADY_OWNED}, -+ {"NT_STATUS_ABIOS_NOT_LID_OWNER", NT_STATUS_ABIOS_NOT_LID_OWNER}, -+ {"NT_STATUS_ABIOS_INVALID_COMMAND", -+ NT_STATUS_ABIOS_INVALID_COMMAND}, -+ {"NT_STATUS_ABIOS_INVALID_LID", NT_STATUS_ABIOS_INVALID_LID}, -+ {"NT_STATUS_ABIOS_SELECTOR_NOT_AVAILABLE", -+ NT_STATUS_ABIOS_SELECTOR_NOT_AVAILABLE}, -+ {"NT_STATUS_ABIOS_INVALID_SELECTOR", -+ NT_STATUS_ABIOS_INVALID_SELECTOR}, -+ {"NT_STATUS_NO_LDT", NT_STATUS_NO_LDT}, -+ {"NT_STATUS_INVALID_LDT_SIZE", NT_STATUS_INVALID_LDT_SIZE}, -+ {"NT_STATUS_INVALID_LDT_OFFSET", NT_STATUS_INVALID_LDT_OFFSET}, -+ {"NT_STATUS_INVALID_LDT_DESCRIPTOR", -+ NT_STATUS_INVALID_LDT_DESCRIPTOR}, -+ {"NT_STATUS_INVALID_IMAGE_NE_FORMAT", -+ NT_STATUS_INVALID_IMAGE_NE_FORMAT}, -+ {"NT_STATUS_RXACT_INVALID_STATE", NT_STATUS_RXACT_INVALID_STATE}, -+ {"NT_STATUS_RXACT_COMMIT_FAILURE", NT_STATUS_RXACT_COMMIT_FAILURE}, -+ {"NT_STATUS_MAPPED_FILE_SIZE_ZERO", -+ NT_STATUS_MAPPED_FILE_SIZE_ZERO}, -+ {"NT_STATUS_TOO_MANY_OPENED_FILES", -+ NT_STATUS_TOO_MANY_OPENED_FILES}, -+ {"NT_STATUS_CANCELLED", NT_STATUS_CANCELLED}, -+ {"NT_STATUS_CANNOT_DELETE", NT_STATUS_CANNOT_DELETE}, -+ {"NT_STATUS_INVALID_COMPUTER_NAME", -+ NT_STATUS_INVALID_COMPUTER_NAME}, -+ {"NT_STATUS_FILE_DELETED", NT_STATUS_FILE_DELETED}, -+ {"NT_STATUS_SPECIAL_ACCOUNT", NT_STATUS_SPECIAL_ACCOUNT}, -+ {"NT_STATUS_SPECIAL_GROUP", NT_STATUS_SPECIAL_GROUP}, -+ {"NT_STATUS_SPECIAL_USER", NT_STATUS_SPECIAL_USER}, -+ {"NT_STATUS_MEMBERS_PRIMARY_GROUP", -+ NT_STATUS_MEMBERS_PRIMARY_GROUP}, -+ {"NT_STATUS_FILE_CLOSED", NT_STATUS_FILE_CLOSED}, -+ {"NT_STATUS_TOO_MANY_THREADS", NT_STATUS_TOO_MANY_THREADS}, -+ {"NT_STATUS_THREAD_NOT_IN_PROCESS", -+ NT_STATUS_THREAD_NOT_IN_PROCESS}, -+ {"NT_STATUS_TOKEN_ALREADY_IN_USE", NT_STATUS_TOKEN_ALREADY_IN_USE}, -+ {"NT_STATUS_PAGEFILE_QUOTA_EXCEEDED", -+ NT_STATUS_PAGEFILE_QUOTA_EXCEEDED}, -+ {"NT_STATUS_COMMITMENT_LIMIT", NT_STATUS_COMMITMENT_LIMIT}, -+ {"NT_STATUS_INVALID_IMAGE_LE_FORMAT", -+ NT_STATUS_INVALID_IMAGE_LE_FORMAT}, -+ {"NT_STATUS_INVALID_IMAGE_NOT_MZ", NT_STATUS_INVALID_IMAGE_NOT_MZ}, -+ {"NT_STATUS_INVALID_IMAGE_PROTECT", -+ NT_STATUS_INVALID_IMAGE_PROTECT}, -+ {"NT_STATUS_INVALID_IMAGE_WIN_16", NT_STATUS_INVALID_IMAGE_WIN_16}, -+ {"NT_STATUS_LOGON_SERVER_CONFLICT", -+ NT_STATUS_LOGON_SERVER_CONFLICT}, -+ {"NT_STATUS_TIME_DIFFERENCE_AT_DC", -+ NT_STATUS_TIME_DIFFERENCE_AT_DC}, -+ {"NT_STATUS_SYNCHRONIZATION_REQUIRED", -+ NT_STATUS_SYNCHRONIZATION_REQUIRED}, -+ {"NT_STATUS_DLL_NOT_FOUND", NT_STATUS_DLL_NOT_FOUND}, -+ {"NT_STATUS_OPEN_FAILED", NT_STATUS_OPEN_FAILED}, -+ {"NT_STATUS_IO_PRIVILEGE_FAILED", NT_STATUS_IO_PRIVILEGE_FAILED}, -+ {"NT_STATUS_ORDINAL_NOT_FOUND", NT_STATUS_ORDINAL_NOT_FOUND}, -+ {"NT_STATUS_ENTRYPOINT_NOT_FOUND", NT_STATUS_ENTRYPOINT_NOT_FOUND}, -+ {"NT_STATUS_CONTROL_C_EXIT", NT_STATUS_CONTROL_C_EXIT}, -+ {"NT_STATUS_LOCAL_DISCONNECT", NT_STATUS_LOCAL_DISCONNECT}, -+ {"NT_STATUS_REMOTE_DISCONNECT", NT_STATUS_REMOTE_DISCONNECT}, -+ {"NT_STATUS_REMOTE_RESOURCES", NT_STATUS_REMOTE_RESOURCES}, -+ {"NT_STATUS_LINK_FAILED", NT_STATUS_LINK_FAILED}, -+ {"NT_STATUS_LINK_TIMEOUT", NT_STATUS_LINK_TIMEOUT}, -+ {"NT_STATUS_INVALID_CONNECTION", NT_STATUS_INVALID_CONNECTION}, -+ {"NT_STATUS_INVALID_ADDRESS", NT_STATUS_INVALID_ADDRESS}, -+ {"NT_STATUS_DLL_INIT_FAILED", NT_STATUS_DLL_INIT_FAILED}, -+ {"NT_STATUS_MISSING_SYSTEMFILE", NT_STATUS_MISSING_SYSTEMFILE}, -+ {"NT_STATUS_UNHANDLED_EXCEPTION", NT_STATUS_UNHANDLED_EXCEPTION}, -+ {"NT_STATUS_APP_INIT_FAILURE", NT_STATUS_APP_INIT_FAILURE}, -+ {"NT_STATUS_PAGEFILE_CREATE_FAILED", -+ NT_STATUS_PAGEFILE_CREATE_FAILED}, -+ {"NT_STATUS_NO_PAGEFILE", NT_STATUS_NO_PAGEFILE}, -+ {"NT_STATUS_INVALID_LEVEL", NT_STATUS_INVALID_LEVEL}, -+ {"NT_STATUS_WRONG_PASSWORD_CORE", NT_STATUS_WRONG_PASSWORD_CORE}, -+ {"NT_STATUS_ILLEGAL_FLOAT_CONTEXT", -+ NT_STATUS_ILLEGAL_FLOAT_CONTEXT}, -+ {"NT_STATUS_PIPE_BROKEN", NT_STATUS_PIPE_BROKEN}, -+ {"NT_STATUS_REGISTRY_CORRUPT", NT_STATUS_REGISTRY_CORRUPT}, -+ {"NT_STATUS_REGISTRY_IO_FAILED", NT_STATUS_REGISTRY_IO_FAILED}, -+ {"NT_STATUS_NO_EVENT_PAIR", NT_STATUS_NO_EVENT_PAIR}, -+ {"NT_STATUS_UNRECOGNIZED_VOLUME", NT_STATUS_UNRECOGNIZED_VOLUME}, -+ {"NT_STATUS_SERIAL_NO_DEVICE_INITED", -+ NT_STATUS_SERIAL_NO_DEVICE_INITED}, -+ {"NT_STATUS_NO_SUCH_ALIAS", NT_STATUS_NO_SUCH_ALIAS}, -+ {"NT_STATUS_MEMBER_NOT_IN_ALIAS", NT_STATUS_MEMBER_NOT_IN_ALIAS}, -+ {"NT_STATUS_MEMBER_IN_ALIAS", NT_STATUS_MEMBER_IN_ALIAS}, -+ {"NT_STATUS_ALIAS_EXISTS", NT_STATUS_ALIAS_EXISTS}, -+ {"NT_STATUS_LOGON_NOT_GRANTED", NT_STATUS_LOGON_NOT_GRANTED}, -+ {"NT_STATUS_TOO_MANY_SECRETS", NT_STATUS_TOO_MANY_SECRETS}, -+ {"NT_STATUS_SECRET_TOO_LONG", NT_STATUS_SECRET_TOO_LONG}, -+ {"NT_STATUS_INTERNAL_DB_ERROR", NT_STATUS_INTERNAL_DB_ERROR}, -+ {"NT_STATUS_FULLSCREEN_MODE", NT_STATUS_FULLSCREEN_MODE}, -+ {"NT_STATUS_TOO_MANY_CONTEXT_IDS", NT_STATUS_TOO_MANY_CONTEXT_IDS}, -+ {"NT_STATUS_LOGON_TYPE_NOT_GRANTED", -+ NT_STATUS_LOGON_TYPE_NOT_GRANTED}, -+ {"NT_STATUS_NOT_REGISTRY_FILE", NT_STATUS_NOT_REGISTRY_FILE}, -+ {"NT_STATUS_NT_CROSS_ENCRYPTION_REQUIRED", -+ NT_STATUS_NT_CROSS_ENCRYPTION_REQUIRED}, -+ {"NT_STATUS_DOMAIN_CTRLR_CONFIG_ERROR", -+ NT_STATUS_DOMAIN_CTRLR_CONFIG_ERROR}, -+ {"NT_STATUS_FT_MISSING_MEMBER", NT_STATUS_FT_MISSING_MEMBER}, -+ {"NT_STATUS_ILL_FORMED_SERVICE_ENTRY", -+ NT_STATUS_ILL_FORMED_SERVICE_ENTRY}, -+ {"NT_STATUS_ILLEGAL_CHARACTER", NT_STATUS_ILLEGAL_CHARACTER}, -+ {"NT_STATUS_UNMAPPABLE_CHARACTER", NT_STATUS_UNMAPPABLE_CHARACTER}, -+ {"NT_STATUS_UNDEFINED_CHARACTER", NT_STATUS_UNDEFINED_CHARACTER}, -+ {"NT_STATUS_FLOPPY_VOLUME", NT_STATUS_FLOPPY_VOLUME}, -+ {"NT_STATUS_FLOPPY_ID_MARK_NOT_FOUND", -+ NT_STATUS_FLOPPY_ID_MARK_NOT_FOUND}, -+ {"NT_STATUS_FLOPPY_WRONG_CYLINDER", -+ NT_STATUS_FLOPPY_WRONG_CYLINDER}, -+ {"NT_STATUS_FLOPPY_UNKNOWN_ERROR", NT_STATUS_FLOPPY_UNKNOWN_ERROR}, -+ {"NT_STATUS_FLOPPY_BAD_REGISTERS", NT_STATUS_FLOPPY_BAD_REGISTERS}, -+ {"NT_STATUS_DISK_RECALIBRATE_FAILED", -+ NT_STATUS_DISK_RECALIBRATE_FAILED}, -+ {"NT_STATUS_DISK_OPERATION_FAILED", -+ NT_STATUS_DISK_OPERATION_FAILED}, -+ {"NT_STATUS_DISK_RESET_FAILED", NT_STATUS_DISK_RESET_FAILED}, -+ {"NT_STATUS_SHARED_IRQ_BUSY", NT_STATUS_SHARED_IRQ_BUSY}, -+ {"NT_STATUS_FT_ORPHANING", NT_STATUS_FT_ORPHANING}, -+ {"NT_STATUS_PARTITION_FAILURE", NT_STATUS_PARTITION_FAILURE}, -+ {"NT_STATUS_INVALID_BLOCK_LENGTH", NT_STATUS_INVALID_BLOCK_LENGTH}, -+ {"NT_STATUS_DEVICE_NOT_PARTITIONED", -+ NT_STATUS_DEVICE_NOT_PARTITIONED}, -+ {"NT_STATUS_UNABLE_TO_LOCK_MEDIA", NT_STATUS_UNABLE_TO_LOCK_MEDIA}, -+ {"NT_STATUS_UNABLE_TO_UNLOAD_MEDIA", -+ NT_STATUS_UNABLE_TO_UNLOAD_MEDIA}, -+ {"NT_STATUS_EOM_OVERFLOW", NT_STATUS_EOM_OVERFLOW}, -+ {"NT_STATUS_NO_MEDIA", NT_STATUS_NO_MEDIA}, -+ {"NT_STATUS_NO_SUCH_MEMBER", NT_STATUS_NO_SUCH_MEMBER}, -+ {"NT_STATUS_INVALID_MEMBER", NT_STATUS_INVALID_MEMBER}, -+ {"NT_STATUS_KEY_DELETED", NT_STATUS_KEY_DELETED}, -+ {"NT_STATUS_NO_LOG_SPACE", NT_STATUS_NO_LOG_SPACE}, -+ {"NT_STATUS_TOO_MANY_SIDS", NT_STATUS_TOO_MANY_SIDS}, -+ {"NT_STATUS_LM_CROSS_ENCRYPTION_REQUIRED", -+ NT_STATUS_LM_CROSS_ENCRYPTION_REQUIRED}, -+ {"NT_STATUS_KEY_HAS_CHILDREN", NT_STATUS_KEY_HAS_CHILDREN}, -+ {"NT_STATUS_CHILD_MUST_BE_VOLATILE", -+ NT_STATUS_CHILD_MUST_BE_VOLATILE}, -+ {"NT_STATUS_DEVICE_CONFIGURATION_ERROR", -+ NT_STATUS_DEVICE_CONFIGURATION_ERROR}, -+ {"NT_STATUS_DRIVER_INTERNAL_ERROR", -+ NT_STATUS_DRIVER_INTERNAL_ERROR}, -+ {"NT_STATUS_INVALID_DEVICE_STATE", NT_STATUS_INVALID_DEVICE_STATE}, -+ {"NT_STATUS_IO_DEVICE_ERROR", NT_STATUS_IO_DEVICE_ERROR}, -+ {"NT_STATUS_DEVICE_PROTOCOL_ERROR", -+ NT_STATUS_DEVICE_PROTOCOL_ERROR}, -+ {"NT_STATUS_BACKUP_CONTROLLER", NT_STATUS_BACKUP_CONTROLLER}, -+ {"NT_STATUS_LOG_FILE_FULL", NT_STATUS_LOG_FILE_FULL}, -+ {"NT_STATUS_TOO_LATE", NT_STATUS_TOO_LATE}, -+ {"NT_STATUS_NO_TRUST_LSA_SECRET", NT_STATUS_NO_TRUST_LSA_SECRET}, -+ {"NT_STATUS_NO_TRUST_SAM_ACCOUNT", NT_STATUS_NO_TRUST_SAM_ACCOUNT}, -+ {"NT_STATUS_TRUSTED_DOMAIN_FAILURE", -+ NT_STATUS_TRUSTED_DOMAIN_FAILURE}, -+ {"NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE", -+ NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE}, -+ {"NT_STATUS_EVENTLOG_FILE_CORRUPT", -+ NT_STATUS_EVENTLOG_FILE_CORRUPT}, -+ {"NT_STATUS_EVENTLOG_CANT_START", NT_STATUS_EVENTLOG_CANT_START}, -+ {"NT_STATUS_TRUST_FAILURE", NT_STATUS_TRUST_FAILURE}, -+ {"NT_STATUS_MUTANT_LIMIT_EXCEEDED", -+ NT_STATUS_MUTANT_LIMIT_EXCEEDED}, -+ {"NT_STATUS_NETLOGON_NOT_STARTED", NT_STATUS_NETLOGON_NOT_STARTED}, -+ {"NT_STATUS_ACCOUNT_EXPIRED", NT_STATUS_ACCOUNT_EXPIRED}, -+ {"NT_STATUS_POSSIBLE_DEADLOCK", NT_STATUS_POSSIBLE_DEADLOCK}, -+ {"NT_STATUS_NETWORK_CREDENTIAL_CONFLICT", -+ NT_STATUS_NETWORK_CREDENTIAL_CONFLICT}, -+ {"NT_STATUS_REMOTE_SESSION_LIMIT", NT_STATUS_REMOTE_SESSION_LIMIT}, -+ {"NT_STATUS_EVENTLOG_FILE_CHANGED", -+ NT_STATUS_EVENTLOG_FILE_CHANGED}, -+ {"NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT", -+ NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT}, -+ {"NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT", -+ NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT}, -+ {"NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT", -+ NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT}, -+ {"NT_STATUS_DOMAIN_TRUST_INCONSISTENT", -+ NT_STATUS_DOMAIN_TRUST_INCONSISTENT}, -+ {"NT_STATUS_FS_DRIVER_REQUIRED", NT_STATUS_FS_DRIVER_REQUIRED}, -+ {"NT_STATUS_NO_USER_SESSION_KEY", NT_STATUS_NO_USER_SESSION_KEY}, -+ {"NT_STATUS_USER_SESSION_DELETED", NT_STATUS_USER_SESSION_DELETED}, -+ {"NT_STATUS_RESOURCE_LANG_NOT_FOUND", -+ NT_STATUS_RESOURCE_LANG_NOT_FOUND}, -+ {"NT_STATUS_INSUFF_SERVER_RESOURCES", -+ NT_STATUS_INSUFF_SERVER_RESOURCES}, -+ {"NT_STATUS_INVALID_BUFFER_SIZE", NT_STATUS_INVALID_BUFFER_SIZE}, -+ {"NT_STATUS_INVALID_ADDRESS_COMPONENT", -+ NT_STATUS_INVALID_ADDRESS_COMPONENT}, -+ {"NT_STATUS_INVALID_ADDRESS_WILDCARD", -+ NT_STATUS_INVALID_ADDRESS_WILDCARD}, -+ {"NT_STATUS_TOO_MANY_ADDRESSES", NT_STATUS_TOO_MANY_ADDRESSES}, -+ {"NT_STATUS_ADDRESS_ALREADY_EXISTS", -+ NT_STATUS_ADDRESS_ALREADY_EXISTS}, -+ {"NT_STATUS_ADDRESS_CLOSED", NT_STATUS_ADDRESS_CLOSED}, -+ {"NT_STATUS_CONNECTION_DISCONNECTED", -+ NT_STATUS_CONNECTION_DISCONNECTED}, -+ {"NT_STATUS_CONNECTION_RESET", NT_STATUS_CONNECTION_RESET}, -+ {"NT_STATUS_TOO_MANY_NODES", NT_STATUS_TOO_MANY_NODES}, -+ {"NT_STATUS_TRANSACTION_ABORTED", NT_STATUS_TRANSACTION_ABORTED}, -+ {"NT_STATUS_TRANSACTION_TIMED_OUT", -+ NT_STATUS_TRANSACTION_TIMED_OUT}, -+ {"NT_STATUS_TRANSACTION_NO_RELEASE", -+ NT_STATUS_TRANSACTION_NO_RELEASE}, -+ {"NT_STATUS_TRANSACTION_NO_MATCH", NT_STATUS_TRANSACTION_NO_MATCH}, -+ {"NT_STATUS_TRANSACTION_RESPONDED", -+ NT_STATUS_TRANSACTION_RESPONDED}, -+ {"NT_STATUS_TRANSACTION_INVALID_ID", -+ NT_STATUS_TRANSACTION_INVALID_ID}, -+ {"NT_STATUS_TRANSACTION_INVALID_TYPE", -+ NT_STATUS_TRANSACTION_INVALID_TYPE}, -+ {"NT_STATUS_NOT_SERVER_SESSION", NT_STATUS_NOT_SERVER_SESSION}, -+ {"NT_STATUS_NOT_CLIENT_SESSION", NT_STATUS_NOT_CLIENT_SESSION}, -+ {"NT_STATUS_CANNOT_LOAD_REGISTRY_FILE", -+ NT_STATUS_CANNOT_LOAD_REGISTRY_FILE}, -+ {"NT_STATUS_DEBUG_ATTACH_FAILED", NT_STATUS_DEBUG_ATTACH_FAILED}, -+ {"NT_STATUS_SYSTEM_PROCESS_TERMINATED", -+ NT_STATUS_SYSTEM_PROCESS_TERMINATED}, -+ {"NT_STATUS_DATA_NOT_ACCEPTED", NT_STATUS_DATA_NOT_ACCEPTED}, -+ {"NT_STATUS_NO_BROWSER_SERVERS_FOUND", -+ NT_STATUS_NO_BROWSER_SERVERS_FOUND}, -+ {"NT_STATUS_VDM_HARD_ERROR", NT_STATUS_VDM_HARD_ERROR}, -+ {"NT_STATUS_DRIVER_CANCEL_TIMEOUT", -+ NT_STATUS_DRIVER_CANCEL_TIMEOUT}, -+ {"NT_STATUS_REPLY_MESSAGE_MISMATCH", -+ NT_STATUS_REPLY_MESSAGE_MISMATCH}, -+ {"NT_STATUS_MAPPED_ALIGNMENT", NT_STATUS_MAPPED_ALIGNMENT}, -+ {"NT_STATUS_IMAGE_CHECKSUM_MISMATCH", -+ NT_STATUS_IMAGE_CHECKSUM_MISMATCH}, -+ {"NT_STATUS_LOST_WRITEBEHIND_DATA", -+ NT_STATUS_LOST_WRITEBEHIND_DATA}, -+ {"NT_STATUS_CLIENT_SERVER_PARAMETERS_INVALID", -+ NT_STATUS_CLIENT_SERVER_PARAMETERS_INVALID}, -+ {"NT_STATUS_PASSWORD_MUST_CHANGE", NT_STATUS_PASSWORD_MUST_CHANGE}, -+ {"NT_STATUS_NOT_FOUND", NT_STATUS_NOT_FOUND}, -+ {"NT_STATUS_NOT_TINY_STREAM", NT_STATUS_NOT_TINY_STREAM}, -+ {"NT_STATUS_RECOVERY_FAILURE", NT_STATUS_RECOVERY_FAILURE}, -+ {"NT_STATUS_STACK_OVERFLOW_READ", NT_STATUS_STACK_OVERFLOW_READ}, -+ {"NT_STATUS_FAIL_CHECK", NT_STATUS_FAIL_CHECK}, -+ {"NT_STATUS_DUPLICATE_OBJECTID", NT_STATUS_DUPLICATE_OBJECTID}, -+ {"NT_STATUS_OBJECTID_EXISTS", NT_STATUS_OBJECTID_EXISTS}, -+ {"NT_STATUS_CONVERT_TO_LARGE", NT_STATUS_CONVERT_TO_LARGE}, -+ {"NT_STATUS_RETRY", NT_STATUS_RETRY}, -+ {"NT_STATUS_FOUND_OUT_OF_SCOPE", NT_STATUS_FOUND_OUT_OF_SCOPE}, -+ {"NT_STATUS_ALLOCATE_BUCKET", NT_STATUS_ALLOCATE_BUCKET}, -+ {"NT_STATUS_PROPSET_NOT_FOUND", NT_STATUS_PROPSET_NOT_FOUND}, -+ {"NT_STATUS_MARSHALL_OVERFLOW", NT_STATUS_MARSHALL_OVERFLOW}, -+ {"NT_STATUS_INVALID_VARIANT", NT_STATUS_INVALID_VARIANT}, -+ {"NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND", -+ NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND}, -+ {"NT_STATUS_ACCOUNT_LOCKED_OUT", NT_STATUS_ACCOUNT_LOCKED_OUT}, -+ {"NT_STATUS_HANDLE_NOT_CLOSABLE", NT_STATUS_HANDLE_NOT_CLOSABLE}, -+ {"NT_STATUS_CONNECTION_REFUSED", NT_STATUS_CONNECTION_REFUSED}, -+ {"NT_STATUS_GRACEFUL_DISCONNECT", NT_STATUS_GRACEFUL_DISCONNECT}, -+ {"NT_STATUS_ADDRESS_ALREADY_ASSOCIATED", -+ NT_STATUS_ADDRESS_ALREADY_ASSOCIATED}, -+ {"NT_STATUS_ADDRESS_NOT_ASSOCIATED", -+ NT_STATUS_ADDRESS_NOT_ASSOCIATED}, -+ {"NT_STATUS_CONNECTION_INVALID", NT_STATUS_CONNECTION_INVALID}, -+ {"NT_STATUS_CONNECTION_ACTIVE", NT_STATUS_CONNECTION_ACTIVE}, -+ {"NT_STATUS_NETWORK_UNREACHABLE", NT_STATUS_NETWORK_UNREACHABLE}, -+ {"NT_STATUS_HOST_UNREACHABLE", NT_STATUS_HOST_UNREACHABLE}, -+ {"NT_STATUS_PROTOCOL_UNREACHABLE", NT_STATUS_PROTOCOL_UNREACHABLE}, -+ {"NT_STATUS_PORT_UNREACHABLE", NT_STATUS_PORT_UNREACHABLE}, -+ {"NT_STATUS_REQUEST_ABORTED", NT_STATUS_REQUEST_ABORTED}, -+ {"NT_STATUS_CONNECTION_ABORTED", NT_STATUS_CONNECTION_ABORTED}, -+ {"NT_STATUS_BAD_COMPRESSION_BUFFER", -+ NT_STATUS_BAD_COMPRESSION_BUFFER}, -+ {"NT_STATUS_USER_MAPPED_FILE", NT_STATUS_USER_MAPPED_FILE}, -+ {"NT_STATUS_AUDIT_FAILED", NT_STATUS_AUDIT_FAILED}, -+ {"NT_STATUS_TIMER_RESOLUTION_NOT_SET", -+ NT_STATUS_TIMER_RESOLUTION_NOT_SET}, -+ {"NT_STATUS_CONNECTION_COUNT_LIMIT", -+ NT_STATUS_CONNECTION_COUNT_LIMIT}, -+ {"NT_STATUS_LOGIN_TIME_RESTRICTION", -+ NT_STATUS_LOGIN_TIME_RESTRICTION}, -+ {"NT_STATUS_LOGIN_WKSTA_RESTRICTION", -+ NT_STATUS_LOGIN_WKSTA_RESTRICTION}, -+ {"NT_STATUS_IMAGE_MP_UP_MISMATCH", NT_STATUS_IMAGE_MP_UP_MISMATCH}, -+ {"NT_STATUS_INSUFFICIENT_LOGON_INFO", -+ NT_STATUS_INSUFFICIENT_LOGON_INFO}, -+ {"NT_STATUS_BAD_DLL_ENTRYPOINT", NT_STATUS_BAD_DLL_ENTRYPOINT}, -+ {"NT_STATUS_BAD_SERVICE_ENTRYPOINT", -+ NT_STATUS_BAD_SERVICE_ENTRYPOINT}, -+ {"NT_STATUS_LPC_REPLY_LOST", NT_STATUS_LPC_REPLY_LOST}, -+ {"NT_STATUS_IP_ADDRESS_CONFLICT1", NT_STATUS_IP_ADDRESS_CONFLICT1}, -+ {"NT_STATUS_IP_ADDRESS_CONFLICT2", NT_STATUS_IP_ADDRESS_CONFLICT2}, -+ {"NT_STATUS_REGISTRY_QUOTA_LIMIT", NT_STATUS_REGISTRY_QUOTA_LIMIT}, -+ {"NT_STATUS_PATH_NOT_COVERED", NT_STATUS_PATH_NOT_COVERED}, -+ {"NT_STATUS_NO_CALLBACK_ACTIVE", NT_STATUS_NO_CALLBACK_ACTIVE}, -+ {"NT_STATUS_LICENSE_QUOTA_EXCEEDED", -+ NT_STATUS_LICENSE_QUOTA_EXCEEDED}, -+ {"NT_STATUS_PWD_TOO_SHORT", NT_STATUS_PWD_TOO_SHORT}, -+ {"NT_STATUS_PWD_TOO_RECENT", NT_STATUS_PWD_TOO_RECENT}, -+ {"NT_STATUS_PWD_HISTORY_CONFLICT", NT_STATUS_PWD_HISTORY_CONFLICT}, -+ {"NT_STATUS_PLUGPLAY_NO_DEVICE", NT_STATUS_PLUGPLAY_NO_DEVICE}, -+ {"NT_STATUS_UNSUPPORTED_COMPRESSION", -+ NT_STATUS_UNSUPPORTED_COMPRESSION}, -+ {"NT_STATUS_INVALID_HW_PROFILE", NT_STATUS_INVALID_HW_PROFILE}, -+ {"NT_STATUS_INVALID_PLUGPLAY_DEVICE_PATH", -+ NT_STATUS_INVALID_PLUGPLAY_DEVICE_PATH}, -+ {"NT_STATUS_DRIVER_ORDINAL_NOT_FOUND", -+ NT_STATUS_DRIVER_ORDINAL_NOT_FOUND}, -+ {"NT_STATUS_DRIVER_ENTRYPOINT_NOT_FOUND", -+ NT_STATUS_DRIVER_ENTRYPOINT_NOT_FOUND}, -+ {"NT_STATUS_RESOURCE_NOT_OWNED", NT_STATUS_RESOURCE_NOT_OWNED}, -+ {"NT_STATUS_TOO_MANY_LINKS", NT_STATUS_TOO_MANY_LINKS}, -+ {"NT_STATUS_QUOTA_LIST_INCONSISTENT", -+ NT_STATUS_QUOTA_LIST_INCONSISTENT}, -+ {"NT_STATUS_FILE_IS_OFFLINE", NT_STATUS_FILE_IS_OFFLINE}, -+ {"NT_STATUS_NO_MORE_ENTRIES", NT_STATUS_NO_MORE_ENTRIES}, -+ {"STATUS_MORE_ENTRIES", STATUS_MORE_ENTRIES}, -+ {"STATUS_SOME_UNMAPPED", STATUS_SOME_UNMAPPED}, -+ {NULL, 0} -+}; -diff -urN linux-2.4.29.old/fs/cifs/nterr.h linux-2.4.29/fs/cifs/nterr.h ---- linux-2.4.29.old/fs/cifs/nterr.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/nterr.h 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,556 @@ -+/* -+ Unix SMB/Netbios implementation. -+ Version 1.9. -+ NT error code constants -+ Copyright (C) Andrew Tridgell 1992-2000 -+ Copyright (C) John H Terpstra 1996-2000 -+ Copyright (C) Luke Kenneth Casson Leighton 1996-2000 -+ Copyright (C) Paul Ashton 1998-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., 675 Mass Ave, Cambridge, MA 02139, USA. -+*/ -+ -+ -+ -+#ifndef _NTERR_H -+#define _NTERR_H -+ -+struct nt_err_code_struct { -+ char *nt_errstr; -+ __u32 nt_errcode; -+}; -+ -+extern const struct nt_err_code_struct nt_errs[]; -+ -+/* Win32 Status codes. */ -+ -+#define STATUS_BUFFER_OVERFLOW 0x80000005 -+#define STATUS_MORE_ENTRIES 0x0105 -+#define ERROR_INVALID_PARAMETER 0x0057 -+#define ERROR_INSUFFICIENT_BUFFER 0x007a -+#define STATUS_1804 0x070c -+#define STATUS_NOTIFY_ENUM_DIR 0x010c -+ -+/* Win32 Error codes extracted using a loop in smbclient then printing a -+ netmon sniff to a file. */ -+ -+#define NT_STATUS_OK 0x0000 -+#define STATUS_SOME_UNMAPPED 0x0107 -+#define STATUS_BUFFER_OVERFLOW 0x80000005 -+#define NT_STATUS_NO_MORE_ENTRIES 0x8000001a -+#define NT_STATUS_UNSUCCESSFUL 0xC0000000 | 0x0001 -+#define NT_STATUS_NOT_IMPLEMENTED 0xC0000000 | 0x0002 -+#define NT_STATUS_INVALID_INFO_CLASS 0xC0000000 | 0x0003 -+#define NT_STATUS_INFO_LENGTH_MISMATCH 0xC0000000 | 0x0004 -+#define NT_STATUS_ACCESS_VIOLATION 0xC0000000 | 0x0005 -+#define NT_STATUS_IN_PAGE_ERROR 0xC0000000 | 0x0006 -+#define NT_STATUS_PAGEFILE_QUOTA 0xC0000000 | 0x0007 -+#define NT_STATUS_INVALID_HANDLE 0xC0000000 | 0x0008 -+#define NT_STATUS_BAD_INITIAL_STACK 0xC0000000 | 0x0009 -+#define NT_STATUS_BAD_INITIAL_PC 0xC0000000 | 0x000a -+#define NT_STATUS_INVALID_CID 0xC0000000 | 0x000b -+#define NT_STATUS_TIMER_NOT_CANCELED 0xC0000000 | 0x000c -+#define NT_STATUS_INVALID_PARAMETER 0xC0000000 | 0x000d -+#define NT_STATUS_NO_SUCH_DEVICE 0xC0000000 | 0x000e -+#define NT_STATUS_NO_SUCH_FILE 0xC0000000 | 0x000f -+#define NT_STATUS_INVALID_DEVICE_REQUEST 0xC0000000 | 0x0010 -+#define NT_STATUS_END_OF_FILE 0xC0000000 | 0x0011 -+#define NT_STATUS_WRONG_VOLUME 0xC0000000 | 0x0012 -+#define NT_STATUS_NO_MEDIA_IN_DEVICE 0xC0000000 | 0x0013 -+#define NT_STATUS_UNRECOGNIZED_MEDIA 0xC0000000 | 0x0014 -+#define NT_STATUS_NONEXISTENT_SECTOR 0xC0000000 | 0x0015 -+#define NT_STATUS_MORE_PROCESSING_REQUIRED 0xC0000000 | 0x0016 -+#define NT_STATUS_NO_MEMORY 0xC0000000 | 0x0017 -+#define NT_STATUS_CONFLICTING_ADDRESSES 0xC0000000 | 0x0018 -+#define NT_STATUS_NOT_MAPPED_VIEW 0xC0000000 | 0x0019 -+#define NT_STATUS_UNABLE_TO_FREE_VM 0x80000000 | 0x001a -+#define NT_STATUS_UNABLE_TO_DELETE_SECTION 0xC0000000 | 0x001b -+#define NT_STATUS_INVALID_SYSTEM_SERVICE 0xC0000000 | 0x001c -+#define NT_STATUS_ILLEGAL_INSTRUCTION 0xC0000000 | 0x001d -+#define NT_STATUS_INVALID_LOCK_SEQUENCE 0xC0000000 | 0x001e -+#define NT_STATUS_INVALID_VIEW_SIZE 0xC0000000 | 0x001f -+#define NT_STATUS_INVALID_FILE_FOR_SECTION 0xC0000000 | 0x0020 -+#define NT_STATUS_ALREADY_COMMITTED 0xC0000000 | 0x0021 -+#define NT_STATUS_ACCESS_DENIED 0xC0000000 | 0x0022 -+#define NT_STATUS_BUFFER_TOO_SMALL 0xC0000000 | 0x0023 -+#define NT_STATUS_OBJECT_TYPE_MISMATCH 0xC0000000 | 0x0024 -+#define NT_STATUS_NONCONTINUABLE_EXCEPTION 0xC0000000 | 0x0025 -+#define NT_STATUS_INVALID_DISPOSITION 0xC0000000 | 0x0026 -+#define NT_STATUS_UNWIND 0xC0000000 | 0x0027 -+#define NT_STATUS_BAD_STACK 0xC0000000 | 0x0028 -+#define NT_STATUS_INVALID_UNWIND_TARGET 0xC0000000 | 0x0029 -+#define NT_STATUS_NOT_LOCKED 0xC0000000 | 0x002a -+#define NT_STATUS_PARITY_ERROR 0xC0000000 | 0x002b -+#define NT_STATUS_UNABLE_TO_DECOMMIT_VM 0xC0000000 | 0x002c -+#define NT_STATUS_NOT_COMMITTED 0xC0000000 | 0x002d -+#define NT_STATUS_INVALID_PORT_ATTRIBUTES 0xC0000000 | 0x002e -+#define NT_STATUS_PORT_MESSAGE_TOO_LONG 0xC0000000 | 0x002f -+#define NT_STATUS_INVALID_PARAMETER_MIX 0xC0000000 | 0x0030 -+#define NT_STATUS_INVALID_QUOTA_LOWER 0xC0000000 | 0x0031 -+#define NT_STATUS_DISK_CORRUPT_ERROR 0xC0000000 | 0x0032 -+#define NT_STATUS_OBJECT_NAME_INVALID 0xC0000000 | 0x0033 -+#define NT_STATUS_OBJECT_NAME_NOT_FOUND 0xC0000000 | 0x0034 -+#define NT_STATUS_OBJECT_NAME_COLLISION 0xC0000000 | 0x0035 -+#define NT_STATUS_HANDLE_NOT_WAITABLE 0xC0000000 | 0x0036 -+#define NT_STATUS_PORT_DISCONNECTED 0xC0000000 | 0x0037 -+#define NT_STATUS_DEVICE_ALREADY_ATTACHED 0xC0000000 | 0x0038 -+#define NT_STATUS_OBJECT_PATH_INVALID 0xC0000000 | 0x0039 -+#define NT_STATUS_OBJECT_PATH_NOT_FOUND 0xC0000000 | 0x003a -+#define NT_STATUS_OBJECT_PATH_SYNTAX_BAD 0xC0000000 | 0x003b -+#define NT_STATUS_DATA_OVERRUN 0xC0000000 | 0x003c -+#define NT_STATUS_DATA_LATE_ERROR 0xC0000000 | 0x003d -+#define NT_STATUS_DATA_ERROR 0xC0000000 | 0x003e -+#define NT_STATUS_CRC_ERROR 0xC0000000 | 0x003f -+#define NT_STATUS_SECTION_TOO_BIG 0xC0000000 | 0x0040 -+#define NT_STATUS_PORT_CONNECTION_REFUSED 0xC0000000 | 0x0041 -+#define NT_STATUS_INVALID_PORT_HANDLE 0xC0000000 | 0x0042 -+#define NT_STATUS_SHARING_VIOLATION 0xC0000000 | 0x0043 -+#define NT_STATUS_QUOTA_EXCEEDED 0xC0000000 | 0x0044 -+#define NT_STATUS_INVALID_PAGE_PROTECTION 0xC0000000 | 0x0045 -+#define NT_STATUS_MUTANT_NOT_OWNED 0xC0000000 | 0x0046 -+#define NT_STATUS_SEMAPHORE_LIMIT_EXCEEDED 0xC0000000 | 0x0047 -+#define NT_STATUS_PORT_ALREADY_SET 0xC0000000 | 0x0048 -+#define NT_STATUS_SECTION_NOT_IMAGE 0xC0000000 | 0x0049 -+#define NT_STATUS_SUSPEND_COUNT_EXCEEDED 0xC0000000 | 0x004a -+#define NT_STATUS_THREAD_IS_TERMINATING 0xC0000000 | 0x004b -+#define NT_STATUS_BAD_WORKING_SET_LIMIT 0xC0000000 | 0x004c -+#define NT_STATUS_INCOMPATIBLE_FILE_MAP 0xC0000000 | 0x004d -+#define NT_STATUS_SECTION_PROTECTION 0xC0000000 | 0x004e -+#define NT_STATUS_EAS_NOT_SUPPORTED 0xC0000000 | 0x004f -+#define NT_STATUS_EA_TOO_LARGE 0xC0000000 | 0x0050 -+#define NT_STATUS_NONEXISTENT_EA_ENTRY 0xC0000000 | 0x0051 -+#define NT_STATUS_NO_EAS_ON_FILE 0xC0000000 | 0x0052 -+#define NT_STATUS_EA_CORRUPT_ERROR 0xC0000000 | 0x0053 -+#define NT_STATUS_FILE_LOCK_CONFLICT 0xC0000000 | 0x0054 -+#define NT_STATUS_LOCK_NOT_GRANTED 0xC0000000 | 0x0055 -+#define NT_STATUS_DELETE_PENDING 0xC0000000 | 0x0056 -+#define NT_STATUS_CTL_FILE_NOT_SUPPORTED 0xC0000000 | 0x0057 -+#define NT_STATUS_UNKNOWN_REVISION 0xC0000000 | 0x0058 -+#define NT_STATUS_REVISION_MISMATCH 0xC0000000 | 0x0059 -+#define NT_STATUS_INVALID_OWNER 0xC0000000 | 0x005a -+#define NT_STATUS_INVALID_PRIMARY_GROUP 0xC0000000 | 0x005b -+#define NT_STATUS_NO_IMPERSONATION_TOKEN 0xC0000000 | 0x005c -+#define NT_STATUS_CANT_DISABLE_MANDATORY 0xC0000000 | 0x005d -+#define NT_STATUS_NO_LOGON_SERVERS 0xC0000000 | 0x005e -+#define NT_STATUS_NO_SUCH_LOGON_SESSION 0xC0000000 | 0x005f -+#define NT_STATUS_NO_SUCH_PRIVILEGE 0xC0000000 | 0x0060 -+#define NT_STATUS_PRIVILEGE_NOT_HELD 0xC0000000 | 0x0061 -+#define NT_STATUS_INVALID_ACCOUNT_NAME 0xC0000000 | 0x0062 -+#define NT_STATUS_USER_EXISTS 0xC0000000 | 0x0063 -+#define NT_STATUS_NO_SUCH_USER 0xC0000000 | 0x0064 -+#define NT_STATUS_GROUP_EXISTS 0xC0000000 | 0x0065 -+#define NT_STATUS_NO_SUCH_GROUP 0xC0000000 | 0x0066 -+#define NT_STATUS_MEMBER_IN_GROUP 0xC0000000 | 0x0067 -+#define NT_STATUS_MEMBER_NOT_IN_GROUP 0xC0000000 | 0x0068 -+#define NT_STATUS_LAST_ADMIN 0xC0000000 | 0x0069 -+#define NT_STATUS_WRONG_PASSWORD 0xC0000000 | 0x006a -+#define NT_STATUS_ILL_FORMED_PASSWORD 0xC0000000 | 0x006b -+#define NT_STATUS_PASSWORD_RESTRICTION 0xC0000000 | 0x006c -+#define NT_STATUS_LOGON_FAILURE 0xC0000000 | 0x006d -+#define NT_STATUS_ACCOUNT_RESTRICTION 0xC0000000 | 0x006e -+#define NT_STATUS_INVALID_LOGON_HOURS 0xC0000000 | 0x006f -+#define NT_STATUS_INVALID_WORKSTATION 0xC0000000 | 0x0070 -+#define NT_STATUS_PASSWORD_EXPIRED 0xC0000000 | 0x0071 -+#define NT_STATUS_ACCOUNT_DISABLED 0xC0000000 | 0x0072 -+#define NT_STATUS_NONE_MAPPED 0xC0000000 | 0x0073 -+#define NT_STATUS_TOO_MANY_LUIDS_REQUESTED 0xC0000000 | 0x0074 -+#define NT_STATUS_LUIDS_EXHAUSTED 0xC0000000 | 0x0075 -+#define NT_STATUS_INVALID_SUB_AUTHORITY 0xC0000000 | 0x0076 -+#define NT_STATUS_INVALID_ACL 0xC0000000 | 0x0077 -+#define NT_STATUS_INVALID_SID 0xC0000000 | 0x0078 -+#define NT_STATUS_INVALID_SECURITY_DESCR 0xC0000000 | 0x0079 -+#define NT_STATUS_PROCEDURE_NOT_FOUND 0xC0000000 | 0x007a -+#define NT_STATUS_INVALID_IMAGE_FORMAT 0xC0000000 | 0x007b -+#define NT_STATUS_NO_TOKEN 0xC0000000 | 0x007c -+#define NT_STATUS_BAD_INHERITANCE_ACL 0xC0000000 | 0x007d -+#define NT_STATUS_RANGE_NOT_LOCKED 0xC0000000 | 0x007e -+#define NT_STATUS_DISK_FULL 0xC0000000 | 0x007f -+#define NT_STATUS_SERVER_DISABLED 0xC0000000 | 0x0080 -+#define NT_STATUS_SERVER_NOT_DISABLED 0xC0000000 | 0x0081 -+#define NT_STATUS_TOO_MANY_GUIDS_REQUESTED 0xC0000000 | 0x0082 -+#define NT_STATUS_GUIDS_EXHAUSTED 0xC0000000 | 0x0083 -+#define NT_STATUS_INVALID_ID_AUTHORITY 0xC0000000 | 0x0084 -+#define NT_STATUS_AGENTS_EXHAUSTED 0xC0000000 | 0x0085 -+#define NT_STATUS_INVALID_VOLUME_LABEL 0xC0000000 | 0x0086 -+#define NT_STATUS_SECTION_NOT_EXTENDED 0xC0000000 | 0x0087 -+#define NT_STATUS_NOT_MAPPED_DATA 0xC0000000 | 0x0088 -+#define NT_STATUS_RESOURCE_DATA_NOT_FOUND 0xC0000000 | 0x0089 -+#define NT_STATUS_RESOURCE_TYPE_NOT_FOUND 0xC0000000 | 0x008a -+#define NT_STATUS_RESOURCE_NAME_NOT_FOUND 0xC0000000 | 0x008b -+#define NT_STATUS_ARRAY_BOUNDS_EXCEEDED 0xC0000000 | 0x008c -+#define NT_STATUS_FLOAT_DENORMAL_OPERAND 0xC0000000 | 0x008d -+#define NT_STATUS_FLOAT_DIVIDE_BY_ZERO 0xC0000000 | 0x008e -+#define NT_STATUS_FLOAT_INEXACT_RESULT 0xC0000000 | 0x008f -+#define NT_STATUS_FLOAT_INVALID_OPERATION 0xC0000000 | 0x0090 -+#define NT_STATUS_FLOAT_OVERFLOW 0xC0000000 | 0x0091 -+#define NT_STATUS_FLOAT_STACK_CHECK 0xC0000000 | 0x0092 -+#define NT_STATUS_FLOAT_UNDERFLOW 0xC0000000 | 0x0093 -+#define NT_STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000000 | 0x0094 -+#define NT_STATUS_INTEGER_OVERFLOW 0xC0000000 | 0x0095 -+#define NT_STATUS_PRIVILEGED_INSTRUCTION 0xC0000000 | 0x0096 -+#define NT_STATUS_TOO_MANY_PAGING_FILES 0xC0000000 | 0x0097 -+#define NT_STATUS_FILE_INVALID 0xC0000000 | 0x0098 -+#define NT_STATUS_ALLOTTED_SPACE_EXCEEDED 0xC0000000 | 0x0099 -+#define NT_STATUS_INSUFFICIENT_RESOURCES 0xC0000000 | 0x009a -+#define NT_STATUS_DFS_EXIT_PATH_FOUND 0xC0000000 | 0x009b -+#define NT_STATUS_DEVICE_DATA_ERROR 0xC0000000 | 0x009c -+#define NT_STATUS_DEVICE_NOT_CONNECTED 0xC0000000 | 0x009d -+#define NT_STATUS_DEVICE_POWER_FAILURE 0xC0000000 | 0x009e -+#define NT_STATUS_FREE_VM_NOT_AT_BASE 0xC0000000 | 0x009f -+#define NT_STATUS_MEMORY_NOT_ALLOCATED 0xC0000000 | 0x00a0 -+#define NT_STATUS_WORKING_SET_QUOTA 0xC0000000 | 0x00a1 -+#define NT_STATUS_MEDIA_WRITE_PROTECTED 0xC0000000 | 0x00a2 -+#define NT_STATUS_DEVICE_NOT_READY 0xC0000000 | 0x00a3 -+#define NT_STATUS_INVALID_GROUP_ATTRIBUTES 0xC0000000 | 0x00a4 -+#define NT_STATUS_BAD_IMPERSONATION_LEVEL 0xC0000000 | 0x00a5 -+#define NT_STATUS_CANT_OPEN_ANONYMOUS 0xC0000000 | 0x00a6 -+#define NT_STATUS_BAD_VALIDATION_CLASS 0xC0000000 | 0x00a7 -+#define NT_STATUS_BAD_TOKEN_TYPE 0xC0000000 | 0x00a8 -+#define NT_STATUS_BAD_MASTER_BOOT_RECORD 0xC0000000 | 0x00a9 -+#define NT_STATUS_INSTRUCTION_MISALIGNMENT 0xC0000000 | 0x00aa -+#define NT_STATUS_INSTANCE_NOT_AVAILABLE 0xC0000000 | 0x00ab -+#define NT_STATUS_PIPE_NOT_AVAILABLE 0xC0000000 | 0x00ac -+#define NT_STATUS_INVALID_PIPE_STATE 0xC0000000 | 0x00ad -+#define NT_STATUS_PIPE_BUSY 0xC0000000 | 0x00ae -+#define NT_STATUS_ILLEGAL_FUNCTION 0xC0000000 | 0x00af -+#define NT_STATUS_PIPE_DISCONNECTED 0xC0000000 | 0x00b0 -+#define NT_STATUS_PIPE_CLOSING 0xC0000000 | 0x00b1 -+#define NT_STATUS_PIPE_CONNECTED 0xC0000000 | 0x00b2 -+#define NT_STATUS_PIPE_LISTENING 0xC0000000 | 0x00b3 -+#define NT_STATUS_INVALID_READ_MODE 0xC0000000 | 0x00b4 -+#define NT_STATUS_IO_TIMEOUT 0xC0000000 | 0x00b5 -+#define NT_STATUS_FILE_FORCED_CLOSED 0xC0000000 | 0x00b6 -+#define NT_STATUS_PROFILING_NOT_STARTED 0xC0000000 | 0x00b7 -+#define NT_STATUS_PROFILING_NOT_STOPPED 0xC0000000 | 0x00b8 -+#define NT_STATUS_COULD_NOT_INTERPRET 0xC0000000 | 0x00b9 -+#define NT_STATUS_FILE_IS_A_DIRECTORY 0xC0000000 | 0x00ba -+#define NT_STATUS_NOT_SUPPORTED 0xC0000000 | 0x00bb -+#define NT_STATUS_REMOTE_NOT_LISTENING 0xC0000000 | 0x00bc -+#define NT_STATUS_DUPLICATE_NAME 0xC0000000 | 0x00bd -+#define NT_STATUS_BAD_NETWORK_PATH 0xC0000000 | 0x00be -+#define NT_STATUS_NETWORK_BUSY 0xC0000000 | 0x00bf -+#define NT_STATUS_DEVICE_DOES_NOT_EXIST 0xC0000000 | 0x00c0 -+#define NT_STATUS_TOO_MANY_COMMANDS 0xC0000000 | 0x00c1 -+#define NT_STATUS_ADAPTER_HARDWARE_ERROR 0xC0000000 | 0x00c2 -+#define NT_STATUS_INVALID_NETWORK_RESPONSE 0xC0000000 | 0x00c3 -+#define NT_STATUS_UNEXPECTED_NETWORK_ERROR 0xC0000000 | 0x00c4 -+#define NT_STATUS_BAD_REMOTE_ADAPTER 0xC0000000 | 0x00c5 -+#define NT_STATUS_PRINT_QUEUE_FULL 0xC0000000 | 0x00c6 -+#define NT_STATUS_NO_SPOOL_SPACE 0xC0000000 | 0x00c7 -+#define NT_STATUS_PRINT_CANCELLED 0xC0000000 | 0x00c8 -+#define NT_STATUS_NETWORK_NAME_DELETED 0xC0000000 | 0x00c9 -+#define NT_STATUS_NETWORK_ACCESS_DENIED 0xC0000000 | 0x00ca -+#define NT_STATUS_BAD_DEVICE_TYPE 0xC0000000 | 0x00cb -+#define NT_STATUS_BAD_NETWORK_NAME 0xC0000000 | 0x00cc -+#define NT_STATUS_TOO_MANY_NAMES 0xC0000000 | 0x00cd -+#define NT_STATUS_TOO_MANY_SESSIONS 0xC0000000 | 0x00ce -+#define NT_STATUS_SHARING_PAUSED 0xC0000000 | 0x00cf -+#define NT_STATUS_REQUEST_NOT_ACCEPTED 0xC0000000 | 0x00d0 -+#define NT_STATUS_REDIRECTOR_PAUSED 0xC0000000 | 0x00d1 -+#define NT_STATUS_NET_WRITE_FAULT 0xC0000000 | 0x00d2 -+#define NT_STATUS_PROFILING_AT_LIMIT 0xC0000000 | 0x00d3 -+#define NT_STATUS_NOT_SAME_DEVICE 0xC0000000 | 0x00d4 -+#define NT_STATUS_FILE_RENAMED 0xC0000000 | 0x00d5 -+#define NT_STATUS_VIRTUAL_CIRCUIT_CLOSED 0xC0000000 | 0x00d6 -+#define NT_STATUS_NO_SECURITY_ON_OBJECT 0xC0000000 | 0x00d7 -+#define NT_STATUS_CANT_WAIT 0xC0000000 | 0x00d8 -+#define NT_STATUS_PIPE_EMPTY 0xC0000000 | 0x00d9 -+#define NT_STATUS_CANT_ACCESS_DOMAIN_INFO 0xC0000000 | 0x00da -+#define NT_STATUS_CANT_TERMINATE_SELF 0xC0000000 | 0x00db -+#define NT_STATUS_INVALID_SERVER_STATE 0xC0000000 | 0x00dc -+#define NT_STATUS_INVALID_DOMAIN_STATE 0xC0000000 | 0x00dd -+#define NT_STATUS_INVALID_DOMAIN_ROLE 0xC0000000 | 0x00de -+#define NT_STATUS_NO_SUCH_DOMAIN 0xC0000000 | 0x00df -+#define NT_STATUS_DOMAIN_EXISTS 0xC0000000 | 0x00e0 -+#define NT_STATUS_DOMAIN_LIMIT_EXCEEDED 0xC0000000 | 0x00e1 -+#define NT_STATUS_OPLOCK_NOT_GRANTED 0xC0000000 | 0x00e2 -+#define NT_STATUS_INVALID_OPLOCK_PROTOCOL 0xC0000000 | 0x00e3 -+#define NT_STATUS_INTERNAL_DB_CORRUPTION 0xC0000000 | 0x00e4 -+#define NT_STATUS_INTERNAL_ERROR 0xC0000000 | 0x00e5 -+#define NT_STATUS_GENERIC_NOT_MAPPED 0xC0000000 | 0x00e6 -+#define NT_STATUS_BAD_DESCRIPTOR_FORMAT 0xC0000000 | 0x00e7 -+#define NT_STATUS_INVALID_USER_BUFFER 0xC0000000 | 0x00e8 -+#define NT_STATUS_UNEXPECTED_IO_ERROR 0xC0000000 | 0x00e9 -+#define NT_STATUS_UNEXPECTED_MM_CREATE_ERR 0xC0000000 | 0x00ea -+#define NT_STATUS_UNEXPECTED_MM_MAP_ERROR 0xC0000000 | 0x00eb -+#define NT_STATUS_UNEXPECTED_MM_EXTEND_ERR 0xC0000000 | 0x00ec -+#define NT_STATUS_NOT_LOGON_PROCESS 0xC0000000 | 0x00ed -+#define NT_STATUS_LOGON_SESSION_EXISTS 0xC0000000 | 0x00ee -+#define NT_STATUS_INVALID_PARAMETER_1 0xC0000000 | 0x00ef -+#define NT_STATUS_INVALID_PARAMETER_2 0xC0000000 | 0x00f0 -+#define NT_STATUS_INVALID_PARAMETER_3 0xC0000000 | 0x00f1 -+#define NT_STATUS_INVALID_PARAMETER_4 0xC0000000 | 0x00f2 -+#define NT_STATUS_INVALID_PARAMETER_5 0xC0000000 | 0x00f3 -+#define NT_STATUS_INVALID_PARAMETER_6 0xC0000000 | 0x00f4 -+#define NT_STATUS_INVALID_PARAMETER_7 0xC0000000 | 0x00f5 -+#define NT_STATUS_INVALID_PARAMETER_8 0xC0000000 | 0x00f6 -+#define NT_STATUS_INVALID_PARAMETER_9 0xC0000000 | 0x00f7 -+#define NT_STATUS_INVALID_PARAMETER_10 0xC0000000 | 0x00f8 -+#define NT_STATUS_INVALID_PARAMETER_11 0xC0000000 | 0x00f9 -+#define NT_STATUS_INVALID_PARAMETER_12 0xC0000000 | 0x00fa -+#define NT_STATUS_REDIRECTOR_NOT_STARTED 0xC0000000 | 0x00fb -+#define NT_STATUS_REDIRECTOR_STARTED 0xC0000000 | 0x00fc -+#define NT_STATUS_STACK_OVERFLOW 0xC0000000 | 0x00fd -+#define NT_STATUS_NO_SUCH_PACKAGE 0xC0000000 | 0x00fe -+#define NT_STATUS_BAD_FUNCTION_TABLE 0xC0000000 | 0x00ff -+#define NT_STATUS_DIRECTORY_NOT_EMPTY 0xC0000000 | 0x0101 -+#define NT_STATUS_FILE_CORRUPT_ERROR 0xC0000000 | 0x0102 -+#define NT_STATUS_NOT_A_DIRECTORY 0xC0000000 | 0x0103 -+#define NT_STATUS_BAD_LOGON_SESSION_STATE 0xC0000000 | 0x0104 -+#define NT_STATUS_LOGON_SESSION_COLLISION 0xC0000000 | 0x0105 -+#define NT_STATUS_NAME_TOO_LONG 0xC0000000 | 0x0106 -+#define NT_STATUS_FILES_OPEN 0xC0000000 | 0x0107 -+#define NT_STATUS_CONNECTION_IN_USE 0xC0000000 | 0x0108 -+#define NT_STATUS_MESSAGE_NOT_FOUND 0xC0000000 | 0x0109 -+#define NT_STATUS_PROCESS_IS_TERMINATING 0xC0000000 | 0x010a -+#define NT_STATUS_INVALID_LOGON_TYPE 0xC0000000 | 0x010b -+#define NT_STATUS_NO_GUID_TRANSLATION 0xC0000000 | 0x010c -+#define NT_STATUS_CANNOT_IMPERSONATE 0xC0000000 | 0x010d -+#define NT_STATUS_IMAGE_ALREADY_LOADED 0xC0000000 | 0x010e -+#define NT_STATUS_ABIOS_NOT_PRESENT 0xC0000000 | 0x010f -+#define NT_STATUS_ABIOS_LID_NOT_EXIST 0xC0000000 | 0x0110 -+#define NT_STATUS_ABIOS_LID_ALREADY_OWNED 0xC0000000 | 0x0111 -+#define NT_STATUS_ABIOS_NOT_LID_OWNER 0xC0000000 | 0x0112 -+#define NT_STATUS_ABIOS_INVALID_COMMAND 0xC0000000 | 0x0113 -+#define NT_STATUS_ABIOS_INVALID_LID 0xC0000000 | 0x0114 -+#define NT_STATUS_ABIOS_SELECTOR_NOT_AVAILABLE 0xC0000000 | 0x0115 -+#define NT_STATUS_ABIOS_INVALID_SELECTOR 0xC0000000 | 0x0116 -+#define NT_STATUS_NO_LDT 0xC0000000 | 0x0117 -+#define NT_STATUS_INVALID_LDT_SIZE 0xC0000000 | 0x0118 -+#define NT_STATUS_INVALID_LDT_OFFSET 0xC0000000 | 0x0119 -+#define NT_STATUS_INVALID_LDT_DESCRIPTOR 0xC0000000 | 0x011a -+#define NT_STATUS_INVALID_IMAGE_NE_FORMAT 0xC0000000 | 0x011b -+#define NT_STATUS_RXACT_INVALID_STATE 0xC0000000 | 0x011c -+#define NT_STATUS_RXACT_COMMIT_FAILURE 0xC0000000 | 0x011d -+#define NT_STATUS_MAPPED_FILE_SIZE_ZERO 0xC0000000 | 0x011e -+#define NT_STATUS_TOO_MANY_OPENED_FILES 0xC0000000 | 0x011f -+#define NT_STATUS_CANCELLED 0xC0000000 | 0x0120 -+#define NT_STATUS_CANNOT_DELETE 0xC0000000 | 0x0121 -+#define NT_STATUS_INVALID_COMPUTER_NAME 0xC0000000 | 0x0122 -+#define NT_STATUS_FILE_DELETED 0xC0000000 | 0x0123 -+#define NT_STATUS_SPECIAL_ACCOUNT 0xC0000000 | 0x0124 -+#define NT_STATUS_SPECIAL_GROUP 0xC0000000 | 0x0125 -+#define NT_STATUS_SPECIAL_USER 0xC0000000 | 0x0126 -+#define NT_STATUS_MEMBERS_PRIMARY_GROUP 0xC0000000 | 0x0127 -+#define NT_STATUS_FILE_CLOSED 0xC0000000 | 0x0128 -+#define NT_STATUS_TOO_MANY_THREADS 0xC0000000 | 0x0129 -+#define NT_STATUS_THREAD_NOT_IN_PROCESS 0xC0000000 | 0x012a -+#define NT_STATUS_TOKEN_ALREADY_IN_USE 0xC0000000 | 0x012b -+#define NT_STATUS_PAGEFILE_QUOTA_EXCEEDED 0xC0000000 | 0x012c -+#define NT_STATUS_COMMITMENT_LIMIT 0xC0000000 | 0x012d -+#define NT_STATUS_INVALID_IMAGE_LE_FORMAT 0xC0000000 | 0x012e -+#define NT_STATUS_INVALID_IMAGE_NOT_MZ 0xC0000000 | 0x012f -+#define NT_STATUS_INVALID_IMAGE_PROTECT 0xC0000000 | 0x0130 -+#define NT_STATUS_INVALID_IMAGE_WIN_16 0xC0000000 | 0x0131 -+#define NT_STATUS_LOGON_SERVER_CONFLICT 0xC0000000 | 0x0132 -+#define NT_STATUS_TIME_DIFFERENCE_AT_DC 0xC0000000 | 0x0133 -+#define NT_STATUS_SYNCHRONIZATION_REQUIRED 0xC0000000 | 0x0134 -+#define NT_STATUS_DLL_NOT_FOUND 0xC0000000 | 0x0135 -+#define NT_STATUS_OPEN_FAILED 0xC0000000 | 0x0136 -+#define NT_STATUS_IO_PRIVILEGE_FAILED 0xC0000000 | 0x0137 -+#define NT_STATUS_ORDINAL_NOT_FOUND 0xC0000000 | 0x0138 -+#define NT_STATUS_ENTRYPOINT_NOT_FOUND 0xC0000000 | 0x0139 -+#define NT_STATUS_CONTROL_C_EXIT 0xC0000000 | 0x013a -+#define NT_STATUS_LOCAL_DISCONNECT 0xC0000000 | 0x013b -+#define NT_STATUS_REMOTE_DISCONNECT 0xC0000000 | 0x013c -+#define NT_STATUS_REMOTE_RESOURCES 0xC0000000 | 0x013d -+#define NT_STATUS_LINK_FAILED 0xC0000000 | 0x013e -+#define NT_STATUS_LINK_TIMEOUT 0xC0000000 | 0x013f -+#define NT_STATUS_INVALID_CONNECTION 0xC0000000 | 0x0140 -+#define NT_STATUS_INVALID_ADDRESS 0xC0000000 | 0x0141 -+#define NT_STATUS_DLL_INIT_FAILED 0xC0000000 | 0x0142 -+#define NT_STATUS_MISSING_SYSTEMFILE 0xC0000000 | 0x0143 -+#define NT_STATUS_UNHANDLED_EXCEPTION 0xC0000000 | 0x0144 -+#define NT_STATUS_APP_INIT_FAILURE 0xC0000000 | 0x0145 -+#define NT_STATUS_PAGEFILE_CREATE_FAILED 0xC0000000 | 0x0146 -+#define NT_STATUS_NO_PAGEFILE 0xC0000000 | 0x0147 -+#define NT_STATUS_INVALID_LEVEL 0xC0000000 | 0x0148 -+#define NT_STATUS_WRONG_PASSWORD_CORE 0xC0000000 | 0x0149 -+#define NT_STATUS_ILLEGAL_FLOAT_CONTEXT 0xC0000000 | 0x014a -+#define NT_STATUS_PIPE_BROKEN 0xC0000000 | 0x014b -+#define NT_STATUS_REGISTRY_CORRUPT 0xC0000000 | 0x014c -+#define NT_STATUS_REGISTRY_IO_FAILED 0xC0000000 | 0x014d -+#define NT_STATUS_NO_EVENT_PAIR 0xC0000000 | 0x014e -+#define NT_STATUS_UNRECOGNIZED_VOLUME 0xC0000000 | 0x014f -+#define NT_STATUS_SERIAL_NO_DEVICE_INITED 0xC0000000 | 0x0150 -+#define NT_STATUS_NO_SUCH_ALIAS 0xC0000000 | 0x0151 -+#define NT_STATUS_MEMBER_NOT_IN_ALIAS 0xC0000000 | 0x0152 -+#define NT_STATUS_MEMBER_IN_ALIAS 0xC0000000 | 0x0153 -+#define NT_STATUS_ALIAS_EXISTS 0xC0000000 | 0x0154 -+#define NT_STATUS_LOGON_NOT_GRANTED 0xC0000000 | 0x0155 -+#define NT_STATUS_TOO_MANY_SECRETS 0xC0000000 | 0x0156 -+#define NT_STATUS_SECRET_TOO_LONG 0xC0000000 | 0x0157 -+#define NT_STATUS_INTERNAL_DB_ERROR 0xC0000000 | 0x0158 -+#define NT_STATUS_FULLSCREEN_MODE 0xC0000000 | 0x0159 -+#define NT_STATUS_TOO_MANY_CONTEXT_IDS 0xC0000000 | 0x015a -+#define NT_STATUS_LOGON_TYPE_NOT_GRANTED 0xC0000000 | 0x015b -+#define NT_STATUS_NOT_REGISTRY_FILE 0xC0000000 | 0x015c -+#define NT_STATUS_NT_CROSS_ENCRYPTION_REQUIRED 0xC0000000 | 0x015d -+#define NT_STATUS_DOMAIN_CTRLR_CONFIG_ERROR 0xC0000000 | 0x015e -+#define NT_STATUS_FT_MISSING_MEMBER 0xC0000000 | 0x015f -+#define NT_STATUS_ILL_FORMED_SERVICE_ENTRY 0xC0000000 | 0x0160 -+#define NT_STATUS_ILLEGAL_CHARACTER 0xC0000000 | 0x0161 -+#define NT_STATUS_UNMAPPABLE_CHARACTER 0xC0000000 | 0x0162 -+#define NT_STATUS_UNDEFINED_CHARACTER 0xC0000000 | 0x0163 -+#define NT_STATUS_FLOPPY_VOLUME 0xC0000000 | 0x0164 -+#define NT_STATUS_FLOPPY_ID_MARK_NOT_FOUND 0xC0000000 | 0x0165 -+#define NT_STATUS_FLOPPY_WRONG_CYLINDER 0xC0000000 | 0x0166 -+#define NT_STATUS_FLOPPY_UNKNOWN_ERROR 0xC0000000 | 0x0167 -+#define NT_STATUS_FLOPPY_BAD_REGISTERS 0xC0000000 | 0x0168 -+#define NT_STATUS_DISK_RECALIBRATE_FAILED 0xC0000000 | 0x0169 -+#define NT_STATUS_DISK_OPERATION_FAILED 0xC0000000 | 0x016a -+#define NT_STATUS_DISK_RESET_FAILED 0xC0000000 | 0x016b -+#define NT_STATUS_SHARED_IRQ_BUSY 0xC0000000 | 0x016c -+#define NT_STATUS_FT_ORPHANING 0xC0000000 | 0x016d -+#define NT_STATUS_PARTITION_FAILURE 0xC0000000 | 0x0172 -+#define NT_STATUS_INVALID_BLOCK_LENGTH 0xC0000000 | 0x0173 -+#define NT_STATUS_DEVICE_NOT_PARTITIONED 0xC0000000 | 0x0174 -+#define NT_STATUS_UNABLE_TO_LOCK_MEDIA 0xC0000000 | 0x0175 -+#define NT_STATUS_UNABLE_TO_UNLOAD_MEDIA 0xC0000000 | 0x0176 -+#define NT_STATUS_EOM_OVERFLOW 0xC0000000 | 0x0177 -+#define NT_STATUS_NO_MEDIA 0xC0000000 | 0x0178 -+#define NT_STATUS_NO_SUCH_MEMBER 0xC0000000 | 0x017a -+#define NT_STATUS_INVALID_MEMBER 0xC0000000 | 0x017b -+#define NT_STATUS_KEY_DELETED 0xC0000000 | 0x017c -+#define NT_STATUS_NO_LOG_SPACE 0xC0000000 | 0x017d -+#define NT_STATUS_TOO_MANY_SIDS 0xC0000000 | 0x017e -+#define NT_STATUS_LM_CROSS_ENCRYPTION_REQUIRED 0xC0000000 | 0x017f -+#define NT_STATUS_KEY_HAS_CHILDREN 0xC0000000 | 0x0180 -+#define NT_STATUS_CHILD_MUST_BE_VOLATILE 0xC0000000 | 0x0181 -+#define NT_STATUS_DEVICE_CONFIGURATION_ERROR 0xC0000000 | 0x0182 -+#define NT_STATUS_DRIVER_INTERNAL_ERROR 0xC0000000 | 0x0183 -+#define NT_STATUS_INVALID_DEVICE_STATE 0xC0000000 | 0x0184 -+#define NT_STATUS_IO_DEVICE_ERROR 0xC0000000 | 0x0185 -+#define NT_STATUS_DEVICE_PROTOCOL_ERROR 0xC0000000 | 0x0186 -+#define NT_STATUS_BACKUP_CONTROLLER 0xC0000000 | 0x0187 -+#define NT_STATUS_LOG_FILE_FULL 0xC0000000 | 0x0188 -+#define NT_STATUS_TOO_LATE 0xC0000000 | 0x0189 -+#define NT_STATUS_NO_TRUST_LSA_SECRET 0xC0000000 | 0x018a -+#define NT_STATUS_NO_TRUST_SAM_ACCOUNT 0xC0000000 | 0x018b -+#define NT_STATUS_TRUSTED_DOMAIN_FAILURE 0xC0000000 | 0x018c -+#define NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE 0xC0000000 | 0x018d -+#define NT_STATUS_EVENTLOG_FILE_CORRUPT 0xC0000000 | 0x018e -+#define NT_STATUS_EVENTLOG_CANT_START 0xC0000000 | 0x018f -+#define NT_STATUS_TRUST_FAILURE 0xC0000000 | 0x0190 -+#define NT_STATUS_MUTANT_LIMIT_EXCEEDED 0xC0000000 | 0x0191 -+#define NT_STATUS_NETLOGON_NOT_STARTED 0xC0000000 | 0x0192 -+#define NT_STATUS_ACCOUNT_EXPIRED 0xC0000000 | 0x0193 -+#define NT_STATUS_POSSIBLE_DEADLOCK 0xC0000000 | 0x0194 -+#define NT_STATUS_NETWORK_CREDENTIAL_CONFLICT 0xC0000000 | 0x0195 -+#define NT_STATUS_REMOTE_SESSION_LIMIT 0xC0000000 | 0x0196 -+#define NT_STATUS_EVENTLOG_FILE_CHANGED 0xC0000000 | 0x0197 -+#define NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT 0xC0000000 | 0x0198 -+#define NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT 0xC0000000 | 0x0199 -+#define NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT 0xC0000000 | 0x019a -+#define NT_STATUS_DOMAIN_TRUST_INCONSISTENT 0xC0000000 | 0x019b -+#define NT_STATUS_FS_DRIVER_REQUIRED 0xC0000000 | 0x019c -+#define NT_STATUS_NO_USER_SESSION_KEY 0xC0000000 | 0x0202 -+#define NT_STATUS_USER_SESSION_DELETED 0xC0000000 | 0x0203 -+#define NT_STATUS_RESOURCE_LANG_NOT_FOUND 0xC0000000 | 0x0204 -+#define NT_STATUS_INSUFF_SERVER_RESOURCES 0xC0000000 | 0x0205 -+#define NT_STATUS_INVALID_BUFFER_SIZE 0xC0000000 | 0x0206 -+#define NT_STATUS_INVALID_ADDRESS_COMPONENT 0xC0000000 | 0x0207 -+#define NT_STATUS_INVALID_ADDRESS_WILDCARD 0xC0000000 | 0x0208 -+#define NT_STATUS_TOO_MANY_ADDRESSES 0xC0000000 | 0x0209 -+#define NT_STATUS_ADDRESS_ALREADY_EXISTS 0xC0000000 | 0x020a -+#define NT_STATUS_ADDRESS_CLOSED 0xC0000000 | 0x020b -+#define NT_STATUS_CONNECTION_DISCONNECTED 0xC0000000 | 0x020c -+#define NT_STATUS_CONNECTION_RESET 0xC0000000 | 0x020d -+#define NT_STATUS_TOO_MANY_NODES 0xC0000000 | 0x020e -+#define NT_STATUS_TRANSACTION_ABORTED 0xC0000000 | 0x020f -+#define NT_STATUS_TRANSACTION_TIMED_OUT 0xC0000000 | 0x0210 -+#define NT_STATUS_TRANSACTION_NO_RELEASE 0xC0000000 | 0x0211 -+#define NT_STATUS_TRANSACTION_NO_MATCH 0xC0000000 | 0x0212 -+#define NT_STATUS_TRANSACTION_RESPONDED 0xC0000000 | 0x0213 -+#define NT_STATUS_TRANSACTION_INVALID_ID 0xC0000000 | 0x0214 -+#define NT_STATUS_TRANSACTION_INVALID_TYPE 0xC0000000 | 0x0215 -+#define NT_STATUS_NOT_SERVER_SESSION 0xC0000000 | 0x0216 -+#define NT_STATUS_NOT_CLIENT_SESSION 0xC0000000 | 0x0217 -+#define NT_STATUS_CANNOT_LOAD_REGISTRY_FILE 0xC0000000 | 0x0218 -+#define NT_STATUS_DEBUG_ATTACH_FAILED 0xC0000000 | 0x0219 -+#define NT_STATUS_SYSTEM_PROCESS_TERMINATED 0xC0000000 | 0x021a -+#define NT_STATUS_DATA_NOT_ACCEPTED 0xC0000000 | 0x021b -+#define NT_STATUS_NO_BROWSER_SERVERS_FOUND 0xC0000000 | 0x021c -+#define NT_STATUS_VDM_HARD_ERROR 0xC0000000 | 0x021d -+#define NT_STATUS_DRIVER_CANCEL_TIMEOUT 0xC0000000 | 0x021e -+#define NT_STATUS_REPLY_MESSAGE_MISMATCH 0xC0000000 | 0x021f -+#define NT_STATUS_MAPPED_ALIGNMENT 0xC0000000 | 0x0220 -+#define NT_STATUS_IMAGE_CHECKSUM_MISMATCH 0xC0000000 | 0x0221 -+#define NT_STATUS_LOST_WRITEBEHIND_DATA 0xC0000000 | 0x0222 -+#define NT_STATUS_CLIENT_SERVER_PARAMETERS_INVALID 0xC0000000 | 0x0223 -+#define NT_STATUS_PASSWORD_MUST_CHANGE 0xC0000000 | 0x0224 -+#define NT_STATUS_NOT_FOUND 0xC0000000 | 0x0225 -+#define NT_STATUS_NOT_TINY_STREAM 0xC0000000 | 0x0226 -+#define NT_STATUS_RECOVERY_FAILURE 0xC0000000 | 0x0227 -+#define NT_STATUS_STACK_OVERFLOW_READ 0xC0000000 | 0x0228 -+#define NT_STATUS_FAIL_CHECK 0xC0000000 | 0x0229 -+#define NT_STATUS_DUPLICATE_OBJECTID 0xC0000000 | 0x022a -+#define NT_STATUS_OBJECTID_EXISTS 0xC0000000 | 0x022b -+#define NT_STATUS_CONVERT_TO_LARGE 0xC0000000 | 0x022c -+#define NT_STATUS_RETRY 0xC0000000 | 0x022d -+#define NT_STATUS_FOUND_OUT_OF_SCOPE 0xC0000000 | 0x022e -+#define NT_STATUS_ALLOCATE_BUCKET 0xC0000000 | 0x022f -+#define NT_STATUS_PROPSET_NOT_FOUND 0xC0000000 | 0x0230 -+#define NT_STATUS_MARSHALL_OVERFLOW 0xC0000000 | 0x0231 -+#define NT_STATUS_INVALID_VARIANT 0xC0000000 | 0x0232 -+#define NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND 0xC0000000 | 0x0233 -+#define NT_STATUS_ACCOUNT_LOCKED_OUT 0xC0000000 | 0x0234 -+#define NT_STATUS_HANDLE_NOT_CLOSABLE 0xC0000000 | 0x0235 -+#define NT_STATUS_CONNECTION_REFUSED 0xC0000000 | 0x0236 -+#define NT_STATUS_GRACEFUL_DISCONNECT 0xC0000000 | 0x0237 -+#define NT_STATUS_ADDRESS_ALREADY_ASSOCIATED 0xC0000000 | 0x0238 -+#define NT_STATUS_ADDRESS_NOT_ASSOCIATED 0xC0000000 | 0x0239 -+#define NT_STATUS_CONNECTION_INVALID 0xC0000000 | 0x023a -+#define NT_STATUS_CONNECTION_ACTIVE 0xC0000000 | 0x023b -+#define NT_STATUS_NETWORK_UNREACHABLE 0xC0000000 | 0x023c -+#define NT_STATUS_HOST_UNREACHABLE 0xC0000000 | 0x023d -+#define NT_STATUS_PROTOCOL_UNREACHABLE 0xC0000000 | 0x023e -+#define NT_STATUS_PORT_UNREACHABLE 0xC0000000 | 0x023f -+#define NT_STATUS_REQUEST_ABORTED 0xC0000000 | 0x0240 -+#define NT_STATUS_CONNECTION_ABORTED 0xC0000000 | 0x0241 -+#define NT_STATUS_BAD_COMPRESSION_BUFFER 0xC0000000 | 0x0242 -+#define NT_STATUS_USER_MAPPED_FILE 0xC0000000 | 0x0243 -+#define NT_STATUS_AUDIT_FAILED 0xC0000000 | 0x0244 -+#define NT_STATUS_TIMER_RESOLUTION_NOT_SET 0xC0000000 | 0x0245 -+#define NT_STATUS_CONNECTION_COUNT_LIMIT 0xC0000000 | 0x0246 -+#define NT_STATUS_LOGIN_TIME_RESTRICTION 0xC0000000 | 0x0247 -+#define NT_STATUS_LOGIN_WKSTA_RESTRICTION 0xC0000000 | 0x0248 -+#define NT_STATUS_IMAGE_MP_UP_MISMATCH 0xC0000000 | 0x0249 -+#define NT_STATUS_INSUFFICIENT_LOGON_INFO 0xC0000000 | 0x0250 -+#define NT_STATUS_BAD_DLL_ENTRYPOINT 0xC0000000 | 0x0251 -+#define NT_STATUS_BAD_SERVICE_ENTRYPOINT 0xC0000000 | 0x0252 -+#define NT_STATUS_LPC_REPLY_LOST 0xC0000000 | 0x0253 -+#define NT_STATUS_IP_ADDRESS_CONFLICT1 0xC0000000 | 0x0254 -+#define NT_STATUS_IP_ADDRESS_CONFLICT2 0xC0000000 | 0x0255 -+#define NT_STATUS_REGISTRY_QUOTA_LIMIT 0xC0000000 | 0x0256 -+#define NT_STATUS_PATH_NOT_COVERED 0xC0000000 | 0x0257 -+#define NT_STATUS_NO_CALLBACK_ACTIVE 0xC0000000 | 0x0258 -+#define NT_STATUS_LICENSE_QUOTA_EXCEEDED 0xC0000000 | 0x0259 -+#define NT_STATUS_PWD_TOO_SHORT 0xC0000000 | 0x025a -+#define NT_STATUS_PWD_TOO_RECENT 0xC0000000 | 0x025b -+#define NT_STATUS_PWD_HISTORY_CONFLICT 0xC0000000 | 0x025c -+#define NT_STATUS_PLUGPLAY_NO_DEVICE 0xC0000000 | 0x025e -+#define NT_STATUS_UNSUPPORTED_COMPRESSION 0xC0000000 | 0x025f -+#define NT_STATUS_INVALID_HW_PROFILE 0xC0000000 | 0x0260 -+#define NT_STATUS_INVALID_PLUGPLAY_DEVICE_PATH 0xC0000000 | 0x0261 -+#define NT_STATUS_DRIVER_ORDINAL_NOT_FOUND 0xC0000000 | 0x0262 -+#define NT_STATUS_DRIVER_ENTRYPOINT_NOT_FOUND 0xC0000000 | 0x0263 -+#define NT_STATUS_RESOURCE_NOT_OWNED 0xC0000000 | 0x0264 -+#define NT_STATUS_TOO_MANY_LINKS 0xC0000000 | 0x0265 -+#define NT_STATUS_QUOTA_LIST_INCONSISTENT 0xC0000000 | 0x0266 -+#define NT_STATUS_FILE_IS_OFFLINE 0xC0000000 | 0x0267 -+#define NT_STATUS_NO_SUCH_JOB 0xC0000000 | 0xEDE /* scheduler */ -+ -+#endif /* _NTERR_H */ -diff -urN linux-2.4.29.old/fs/cifs/ntlmssp.h linux-2.4.29/fs/cifs/ntlmssp.h ---- linux-2.4.29.old/fs/cifs/ntlmssp.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/ntlmssp.h 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,101 @@ -+/* -+ * fs/cifs/ntlmssp.h -+ * -+ * Copyright (c) International Business Machines Corp., 2002 -+ * Author(s): Steve French (sfrench@us.ibm.com) -+ * -+ * This library is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This library 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 Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#pragma pack(1) -+ -+#define NTLMSSP_SIGNATURE "NTLMSSP" -+/* Message Types */ -+#define NtLmNegotiate 1 -+#define NtLmChallenge 2 -+#define NtLmAuthenticate 3 -+#define UnknownMessage 8 -+ -+/* Negotiate Flags */ -+#define NTLMSSP_NEGOTIATE_UNICODE 0x01 // Text strings are in unicode -+#define NTLMSSP_NEGOTIATE_OEM 0x02 // Text strings are in OEM -+#define NTLMSSP_REQUEST_TARGET 0x04 // Server return its auth realm -+#define NTLMSSP_NEGOTIATE_SIGN 0x0010 // Request signature capability -+#define NTLMSSP_NEGOTIATE_SEAL 0x0020 // Request confidentiality -+#define NTLMSSP_NEGOTIATE_DGRAM 0x0040 -+#define NTLMSSP_NEGOTIATE_LM_KEY 0x0080 // Use LM session key for sign/seal -+#define NTLMSSP_NEGOTIATE_NTLM 0x0200 // NTLM authentication -+#define NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED 0x1000 -+#define NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED 0x2000 -+#define NTLMSSP_NEGOTIATE_LOCAL_CALL 0x4000 // client/server on same machine -+#define NTLMSSP_NEGOTIATE_ALWAYS_SIGN 0x8000 // Sign for all security levels -+#define NTLMSSP_TARGET_TYPE_DOMAIN 0x10000 -+#define NTLMSSP_TARGET_TYPE_SERVER 0x20000 -+#define NTLMSSP_TARGET_TYPE_SHARE 0x40000 -+#define NTLMSSP_NEGOTIATE_NTLMV2 0x80000 -+#define NTLMSSP_REQUEST_INIT_RESP 0x100000 -+#define NTLMSSP_REQUEST_ACCEPT_RESP 0x200000 -+#define NTLMSSP_REQUEST_NOT_NT_KEY 0x400000 -+#define NTLMSSP_NEGOTIATE_TARGET_INFO 0x800000 -+#define NTLMSSP_NEGOTIATE_128 0x20000000 -+#define NTLMSSP_NEGOTIATE_KEY_XCH 0x40000000 -+#define NTLMSSP_NEGOTIATE_56 0x80000000 -+ -+/* Although typedefs are not commonly used for structure definitions */ -+/* in the Linux kernel, in this particular case they are useful */ -+/* to more closely match the standards document for NTLMSSP from */ -+/* OpenGroup and to make the code more closely match the standard in */ -+/* appearance */ -+ -+typedef struct _SECURITY_BUFFER { -+ __u16 Length; -+ __u16 MaximumLength; -+ __u32 Buffer; /* offset to buffer */ -+} SECURITY_BUFFER; -+ -+typedef struct _NEGOTIATE_MESSAGE { -+ __u8 Signature[sizeof (NTLMSSP_SIGNATURE)]; -+ __u32 MessageType; /* 1 */ -+ __u32 NegotiateFlags; -+ SECURITY_BUFFER DomainName; /* RFC 1001 style and ASCII */ -+ SECURITY_BUFFER WorkstationName; /* RFC 1001 and ASCII */ -+ char DomainString[0]; -+ /* followed by WorkstationString */ -+} NEGOTIATE_MESSAGE, *PNEGOTIATE_MESSAGE; -+ -+typedef struct _CHALLENGE_MESSAGE { -+ __u8 Signature[sizeof (NTLMSSP_SIGNATURE)]; -+ __u32 MessageType; /* 2 */ -+ SECURITY_BUFFER TargetName; -+ __u32 NegotiateFlags; -+ __u8 Challenge[CIFS_CRYPTO_KEY_SIZE]; -+ __u8 Reserved[8]; -+ SECURITY_BUFFER TargetInfoArray; -+} CHALLENGE_MESSAGE, *PCHALLENGE_MESSAGE; -+ -+typedef struct _AUTHENTICATE_MESSAGE { -+ __u8 Signature[sizeof (NTLMSSP_SIGNATURE)]; -+ __u32 MessageType; /* 3 */ -+ SECURITY_BUFFER LmChallengeResponse; -+ SECURITY_BUFFER NtChallengeResponse; -+ SECURITY_BUFFER DomainName; -+ SECURITY_BUFFER UserName; -+ SECURITY_BUFFER WorkstationName; -+ SECURITY_BUFFER SessionKey; -+ __u32 NegotiateFlags; -+ char UserString[0]; -+} AUTHENTICATE_MESSAGE, *PAUTHENTICATE_MESSAGE; -+ -+#pragma pack() /* resume default structure packing */ -diff -urN linux-2.4.29.old/fs/cifs/README linux-2.4.29/fs/cifs/README ---- linux-2.4.29.old/fs/cifs/README 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/README 2004-07-14 00:25:04.000000000 +0200 -@@ -0,0 +1,356 @@ -+The CIFS VFS support for Linux supports many advanced network filesystem -+features such as heirarchical dfs like namespace, hardlinks, locking and more. -+It was designed to comply with the SNIA CIFS Technical Reference (which -+supersedes the 1992 X/Open SMB Standard) as well as to perform best practice -+practical interoperability with Windows 2000, Windows XP, Samba and equivalent -+servers. -+ -+For questions or bug reports please contact: -+ sfrench@samba.org (sfrench@us.ibm.com) -+ -+Build instructions: -+================== -+For Linux 2.4: -+1) Get the kernel source (e.g.from http://www.kernel.org) -+and download the cifs vfs source (see the project page -+at http://us1.samba.org/samba/Linux_CIFS_client.html) -+and change directory into the top of the kernel directory -+then patch the kernel (e.g. "patch -p1 < cifs_24.patch") -+to add the cifs vfs to your kernel configure options if -+it has not already been added (e.g. current SuSE and UL -+users do not need to apply the cifs_24.patch since the cifs vfs is -+already in the kernel configure menu) and then -+mkdir linux/fs/cifs and then copy the current cifs vfs files from -+the cifs download to your kernel build directory e.g. -+ -+ cp /fs/cifs/* to /fs/cifs -+ -+2) make menuconfig (or make xconfig) -+3) select cifs from within the network filesystem choices -+4) save and exit -+5) make dep -+6) make modules (or "make" if CIFS VFS not to be built as a module) -+ -+For Linux 2.5: -+1) Download the kernel (e.g. from http://www.kernel.org or from bitkeeper -+at bk://linux.bkbits.net/linux-2.5) and change directory into the top -+of the kernel directory tree (e.g. /usr/src/linux-2.5.73) -+2) make menuconfig (or make xconfig) -+3) select cifs from within the network filesystem choices -+4) save and exit -+5) make -+ -+ -+Installation instructions: -+========================= -+If you have built the CIFS vfs as module (successfully) simply -+type "make modules_install" (or if you prefer, manually copy the file to -+the modules directory e.g. /lib/modules/2.4.10-4GB/kernel/fs/cifs/cifs.o). -+ -+If you have built the CIFS vfs into the kernel itself, follow the instructions -+for your distribution on how to install a new kernel (usually you -+would simply type "make install"). -+ -+If you do not have the utility mount.cifs (in the Samba 3.0 source tree and on -+the CIFS VFS web site) copy it to the same directory in which mount.smbfs and -+similar files reside (usually /sbin). Although the helper software is not -+required, mount.cifs is recommended. Eventually the Samba 3.0 utility program -+"net" may also be helpful since it may someday provide easier mount syntax for -+users who are used to Windows e.g. net use -+Note that running the Winbind pam/nss module (logon service) on all of your -+Linux clients is useful in mapping Uids and Gids consistently across the -+domain to the proper network user. The mount.cifs mount helper can be -+trivially built from Samba 3.0 or later source e.g. by executing: -+ -+ gcc samba/source/client/mount.cifs.c -o mount.cifs -+ -+Note that when the mount.cifs utility is run suid (allowing user mounts), -+in order to reduce risks, the "nosuid" mount flag is passed in on mount to -+disallow execution of an suid program mounted on the remote target. -+When mount is executed as root, nosuid is not passed in by default, -+and execution of suid programs on the remote target would be enabled -+by default. This can be changed, as with nfs and other filesystems, -+by simply specifying "nosuid" among the mount options. For user mounts -+though to be able to pass the suid flag to mount requires rebuilding -+mount.cifs with the following flag: -+ -+ gcc samba/source/client/mount.cifs.c -DCIFS_ALLOW_USR_SUID -o mount.cifs -+ -+There is a corresponding manual page for cifs mounting in the Samba 3.0 and -+later source tree in docs/manpages/mount.cifs.8 -+ -+Samba Considerations -+==================== -+To get the maximum benefit from the CIFS VFS, we recommend using a server that -+supports the SNIA CIFS Unix Extensions standard (e.g. Samba 2.2.5 or later or -+Samba 3.0) but the CIFS vfs works fine with a wide variety of CIFS servers. -+Note that uid, gid and file permissions will display default values if you do -+not have a server that supports the Unix extensions for CIFS (such as Samba -+2.2.5 or later). To enable the Unix CIFS Extensions in the Samba server, add -+the line: -+ -+ unix extensions = yes -+ -+to your smb.conf file on the server. Note that the following smb.conf settings -+are also useful (on the Samba server) when the majority of clients are Unix or -+Linux: -+ -+ case sensitive = yes -+ delete readonly = yes -+ ea support = yes -+ -+Note that ea support is required for supporting Linux xattrs. -+Some administrators also change the "map archive" and the "create mask" -+parameters from their default values. Creating special devices (mknod) -+remotely may require specifying a mkdev function to Samba if you are not using -+Samba 3.0.5 or later. For more information on these see the manual pages -+("man smb.conf") on the Samba server system. Note that the cifs vfs, -+unlike the smbfs vfs, does not read the smb.conf on the client system -+(the few optional settings are passed in on mount via -o parameters instead). -+Note that Samba 2.2.7 or later includes a fix that allows the CIFS VFS to delete -+open files (required for strict POSIX compliance). Windows Servers already -+supported this feature. Samba server does not allow symlinks that refer to files -+outside of the share, so in Samba versions prior to 3.0.5, most symlinks to -+files with absolute paths (ie beginning with slash) such as: -+ ln -s /mnt/foo bar -+would be forbidden. Samba 3.0.5 server or later includes the ability to create -+such symlinks safely by converting unsafe symlinks (ie symlinks to server -+files that are outside of the share) to a samba specific format on the server -+that is ignored by local server applications and non-cifs clients and that will -+not be traversed by the Samba server). This is opaque to the Linux client -+application using the cifs vfs. Absolute symlinks will work to Samba 3.0.5 or -+later, but only for remote clients using the CIFS Unix extensions, and will -+be invisbile to Windows clients and typically will not affect local -+applications running on the same server as Samba. -+ -+Use instructions: -+================ -+Once the CIFS VFS support is built into the kernel or installed as a module -+(cifs.o), you can use mount syntax like the following to access Samba or Windows -+servers: -+ -+ mount -t cifs //9.53.216.11/e$ /mnt -o user=myname,pass=mypassword -+ -+Before -o the option -v may be specified to make the mount.cifs -+mount helper display the mount steps more verbosely. -+After -o the following commonly used cifs vfs specific options -+are supported: -+ -+ user= -+ pass= -+ domain= -+ -+Other cifs mount options are described below. Use of TCP names (in addition to -+ip addresses) is available if the mount helper (mount.cifs) is installed. If -+you do not trust the server to which are mounted, or if you do not have -+cifs signing enabled (and the physical network is insecure), consider use -+of the standard mount options "noexec" and "nosuid" to reduce the risk of -+running an altered binary on your local system (downloaded from a hostile server -+or altered by a hostile router). -+ -+When using the mount helper mount.cifs, passwords may be specified via alternate -+mechanisms, instead of specifying it after -o using the normal "pass=" syntax -+on the command line: -+1) By including it in a credential file. Specify credentials=filename as one -+of the mount options. Credential files contain two lines -+ username=someuser -+ password=your_password -+2) By specifying the password in the PASSWD environment variable (similarly -+the user name can be taken from the USER environment variable). -+3) By specifying the password in a file by name via PASSWD_FILE -+4) By specifying the password in a file by file descriptor via PASSWD_FD -+ -+If no password is provided, mount.cifs will prompt for password entry -+ -+Restrictions -+============ -+Servers must support the NTLM SMB dialect (which is the most recent, supported -+by Samba and Windows NT version 4, 2000 and XP and many other SMB/CIFS servers) -+Servers must support either "pure-TCP" (port 445 TCP/IP CIFS connections) or RFC -+1001/1002 support for "Netbios-Over-TCP/IP." Neither of these is likely to be a -+problem as most servers support this. IPv6 support is planned for the future. -+ -+CIFS VFS Mount Options -+====================== -+A partial list of the supported mount options follows: -+ user The user name to use when trying to establish -+ the CIFS session. -+ password The user password. If the mount helper is -+ installed, the user will be prompted for password -+ if it is not supplied. -+ ip The ip address of the target server -+ unc The target server Universal Network Name (export) to -+ mount. -+ domain Set the SMB/CIFS workgroup name prepended to the -+ username during CIFS session establishment -+ uid If CIFS Unix extensions are not supported by the server -+ this overrides the default uid for inodes. For mounts to -+ servers which do support the CIFS Unix extensions, such -+ as a properly configured Samba server, the server provides -+ the uid, gid and mode. For servers which do not support -+ the Unix extensions, the default uid (and gid) returned on -+ lookup of existing files is the uid (gid) of the person -+ who executed the mount (root, except when mount.cifs -+ is configured setuid for user mounts) unless the "uid=" -+ (gid) mount option is specified. For the uid (gid) of newly -+ created files and directories, ie files created since -+ the last mount of the server share, the expected uid -+ (gid) is cached as as long as the inode remains in -+ memory on the client. Also note that permission -+ checks (authorization checks) on accesses to a file occur -+ at the server, but there are cases in which an administrator -+ may want to restrict at the client as well. For those -+ servers which do not report a uid/gid owner -+ (such as Windows), permissions can also be checked at the -+ client, and a crude form of client side permission checking -+ can be enabled by specifying file_mode and dir_mode on -+ the client -+ gid If CIFS Unix extensions are not supported by the server -+ this overrides the default gid for inodes. -+ file_mode If CIFS Unix extensions are not supported by the server -+ this overrides the default mode for file inodes. -+ dir_mode If CIFS Unix extensions are not supported by the server -+ this overrides the default mode for directory inodes. -+ port attempt to contact the server on this tcp port, before -+ trying the usual ports (port 445, then 139). -+ iocharset Codepage used to convert local path names to and from -+ Unicode. Unicode is used by default for network path -+ names if the server supports it. If iocharset is -+ not specified then the nls_default specified -+ during the local client kernel build will be used. -+ If server does not support Unicode, this parameter is -+ unused. -+ rsize default read size -+ wsize default write size -+ rw mount the network share read-write (note that the -+ server may still consider the share read-only) -+ ro mount network share read-only -+ version used to distinguish different versions of the -+ mount helper utility (not typically needed) -+ sep if first mount option (after the -o), overrides -+ the comma as the separator between the mount -+ parms. e.g. -+ -o user=myname,password=mypassword,domain=mydom -+ could be passed instead with period as the separator by -+ -o sep=.user=myname.password=mypassword.domain=mydom -+ this might be useful when comma is contained within username -+ or password or domain. This option is less important -+ when the cifs mount helper cifs.mount (version 1.1 or later) -+ is used. -+ nosuid Do not allow remote executables with the suid bit -+ program to be executed. This is only meaningful for mounts -+ to servers such as Samba which support the CIFS Unix Extensions. -+ If you do not trust the servers in your network (your mount -+ targets) it is recommended that you specify this option for -+ greater security. -+ suid Allow remote files on this mountpoint with suid enabled to -+ be executed (default for mounts when executed as root, -+ nosuid is default for user mounts). -+ credentials Although ignored by the cifs kernel component, it is used by -+ the mount helper, mount.cifs. When mount.cifs is installed it -+ opens and reads the credential file specified in order -+ to obtain the userid and password arguments which are passed to -+ the cifs vfs. -+ guest Although ignored by the kernel component, the mount.cifs -+ mount helper will not prompt the user for a password -+ if guest is specified on the mount options. If no -+ password is specified a null password will be used. -+ -+The mount.cifs mount helper also accepts a few mount options before -o -+including: -+ -+ -S take password from stdin (equivalent to setting the environment -+ variable "PASSWD_FD=0" -+ -V print mount.cifs version -+ -? display simple usage information -+ -+With recent 2.6 kernel versions of modutils, the version of the cifs kernel -+module can be displayed via modinfo. -+ -+Misc /proc/fs/cifs Flags and Debug Info -+======================================= -+Informational pseudo-files: -+DebugData Displays information about active CIFS sessions -+ and shares. -+Stats Lists summary resource usage information as well as per -+ share statistics, if CONFIG_CIFS_STATS in enabled -+ in the kernel configuration. -+ -+Configuration pseudo-files: -+MultiuserMount If set to one, more than one CIFS session to -+ the same server ip address can be established -+ if more than one uid accesses the same mount -+ point and if the uids user/password mapping -+ information is available. (default is 0) -+PacketSigningEnabled If set to one, cifs packet signing is enabled -+ and will be used if the server requires -+ it. If set to two, cifs packet signing is -+ required even if the server considers packet -+ signing optional. (default 1) -+cifsFYI If set to one, additional debug information is -+ logged to the system error log. (default 0) -+ExtendedSecurity If set to one, SPNEGO session establishment -+ is allowed which enables more advanced -+ secure CIFS session establishment (default 0) -+NTLMV2Enabled If set to one, more secure password hashes -+ are used when the server supports them and -+ when kerberos is not negotiated (default 0) -+traceSMB If set to one, debug information is logged to the -+ system error log with the start of smb requests -+ and responses (default 0) -+LookupCacheEnable If set to one, inode information is kept cached -+ for one second improving performance of lookups -+ (default 1) -+OplockEnabled If set to one, safe distributed caching enabled. -+ (default 1) -+LinuxExtensionsEnabled If set to one then the client will attempt to -+ use the CIFS "UNIX" extensions which are optional -+ protocol enhancements that allow CIFS servers -+ to return accurate UID/GID information as well -+ as support symbolic links. If you use servers -+ such as Samba that support the CIFS Unix -+ extensions but do not want to use symbolic link -+ support and want to map the uid and gid fields -+ to values supplied at mount (rather than the -+ actual values, then set this to zero. (default 1) -+ -+These experimental features and tracing can be enabled by changing flags in -+/proc/fs/cifs (after the cifs module has been installed or built into the -+kernel, e.g. insmod cifs). To enable a feature set it to 1 e.g. to enable -+tracing to the kernel message log type: -+ -+ echo 1 > /proc/fs/cifs/cifsFYI -+ -+and for more extensive tracing including the start of smb requests and responses -+ -+ echo 1 > /proc/fs/cifs/traceSMB -+ -+Three other experimental features are under development and to test -+require enabling an ifdef (e.g. by adding "#define CIFS_FCNTL" in cifsglob.h) -+ -+ CONFIG_CIFS_QUOTA -+ -+ CONFIG_CIFS_XATTR -+ -+ CONFIG_CIFS_FCNTL (fcntl needed for support of directory change -+ notification and perhaps later for file leases) -+ -+Per share (per client mount) statistics are available in /proc/fs/cifs/DebugData -+if the kernel was configured with cifs statistics enabled. The statistics -+represent the number of successful (ie non-zero return code from the server) -+SMB responses to some of the more common commands (open, delete, mkdir etc.). -+Also recorded is the total bytes read and bytes written to the server for -+that share. Note that due to client caching effects this can be less than the -+number of bytes read and written by the application running on the client. -+The statistics for the number of total SMBs and oplock breaks are different in -+that they represent all for that share, not just those for which the server -+returned success. -+ -+Also note that "cat /proc/fs/cifs/DebugData" will display information about -+the active sessions and the shares that are mounted. Note: NTLMv2 enablement -+will not work since they its implementation is not quite complete yet. -+Do not alter these configuration values unless you are doing specific testing. -+Enabling extended security works to Windows 2000 Workstations and XP but not to -+Windows 2000 server or Samba since it does not usually send "raw NTLMSSP" -+(instead it sends NTLMSSP encapsulated in SPNEGO/GSSAPI, which support is not -+complete in the CIFS VFS yet). -diff -urN linux-2.4.29.old/fs/cifs/rfc1002pdu.h linux-2.4.29/fs/cifs/rfc1002pdu.h ---- linux-2.4.29.old/fs/cifs/rfc1002pdu.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/rfc1002pdu.h 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,79 @@ -+/* -+ * fs/cifs/rfc1002pdu.h -+ * -+ * Protocol Data Unit definitions for RFC 1001/1002 support -+ * -+ * Copyright (c) International Business Machines Corp., 2004 -+ * Author(s): Steve French (sfrench@us.ibm.com) -+ * -+ * This library is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This library 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 Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#pragma pack(1) -+ -+/* NB: unlike smb/cifs packets, the RFC1002 structures are big endian */ -+ -+ /* RFC 1002 session packet types */ -+#define RFC1002_SESSION_MESASAGE 0x00 -+#define RFC1002_SESSION_REQUEST 0x81 -+#define RFC1002_POSITIVE_SESSION_RESPONSE 0x82 -+#define RFC1002_NEGATIVE_SESSION_RESPONSE 0x83 -+#define RFC1002_RETARGET_SESSION_RESPONSE 0x83 -+#define RFC1002_SESSION_KEEP_ALIVE 0x85 -+ -+ /* RFC 1002 flags (only one defined */ -+#define RFC1002_LENGTH_EXTEND 0x80 /* high order bit of length (ie +64K) */ -+ -+struct rfc1002_session_packet { -+ __u8 type; -+ __u8 flags; -+ __u16 length; -+ union { -+ struct { -+ __u8 called_len; -+ __u8 called_name[32]; -+ __u8 scope1; /* null */ -+ __u8 calling_len; -+ __u8 calling_name[32]; -+ __u8 scope2; /* null */ -+ } session_req; -+ struct { -+ __u32 retarget_ip_addr; -+ __u16 port; -+ } retarget_resp; -+ __u8 neg_ses_resp_error_code; -+ /* POSITIVE_SESSION_RESPONSE packet does not include trailer. -+ SESSION_KEEP_ALIVE packet also does not include a trailer. -+ Trailer for the SESSION_MESSAGE packet is SMB/CIFS header */ -+ } trailer; -+}; -+ -+/* Negative Session Response error codes */ -+#define RFC1002_NOT_LISTENING_CALLED 0x80 /* not listening on called name */ -+#define RFC1002_NOT_LISTENING_CALLING 0x81 /* not listening on calling name */ -+#define RFC1002_NOT_PRESENT 0x82 /* called name not present */ -+#define RFC1002_INSUFFICIENT_RESOURCE 0x83 -+#define RFC1002_UNSPECIFIED_ERROR 0x8F -+ -+/* RFC 1002 Datagram service packets are not defined here as they -+are not needed for the network filesystem client unless we plan on -+implementing broadcast resolution of the server ip address (from -+server netbios name). Currently server names are resolved only via DNS -+(tcp name) or ip address or an /etc/hosts equivalent mapping to ip address.*/ -+ -+#define DEFAULT_CIFS_CALLED_NAME "*SMBSERVER " -+ -+#pragma pack() /* resume default structure packing */ -+ -diff -urN linux-2.4.29.old/fs/cifs/smbdes.c linux-2.4.29/fs/cifs/smbdes.c ---- linux-2.4.29.old/fs/cifs/smbdes.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/smbdes.c 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,408 @@ -+/* -+ Unix SMB/Netbios implementation. -+ Version 1.9. -+ -+ a partial implementation of DES designed for use in the -+ SMB authentication protocol -+ -+ Copyright (C) Andrew Tridgell 1998 -+ Modified by Steve French (sfrench@us.ibm.com) 2002,2004 -+ -+ 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. -+*/ -+ -+/* NOTES: -+ -+ This code makes no attempt to be fast! In fact, it is a very -+ slow implementation -+ -+ This code is NOT a complete DES implementation. It implements only -+ the minimum necessary for SMB authentication, as used by all SMB -+ products (including every copy of Microsoft Windows95 ever sold) -+ -+ In particular, it can only do a unchained forward DES pass. This -+ means it is not possible to use this code for encryption/decryption -+ of data, instead it is only useful as a "hash" algorithm. -+ -+ There is no entry point into this code that allows normal DES operation. -+ -+ I believe this means that this code does not come under ITAR -+ regulations but this is NOT a legal opinion. If you are concerned -+ about the applicability of ITAR regulations to this code then you -+ should confirm it for yourself (and maybe let me know if you come -+ up with a different answer to the one above) -+*/ -+#include -+#define uchar unsigned char -+ -+static uchar perm1[56] = { 57, 49, 41, 33, 25, 17, 9, -+ 1, 58, 50, 42, 34, 26, 18, -+ 10, 2, 59, 51, 43, 35, 27, -+ 19, 11, 3, 60, 52, 44, 36, -+ 63, 55, 47, 39, 31, 23, 15, -+ 7, 62, 54, 46, 38, 30, 22, -+ 14, 6, 61, 53, 45, 37, 29, -+ 21, 13, 5, 28, 20, 12, 4 -+}; -+ -+static uchar perm2[48] = { 14, 17, 11, 24, 1, 5, -+ 3, 28, 15, 6, 21, 10, -+ 23, 19, 12, 4, 26, 8, -+ 16, 7, 27, 20, 13, 2, -+ 41, 52, 31, 37, 47, 55, -+ 30, 40, 51, 45, 33, 48, -+ 44, 49, 39, 56, 34, 53, -+ 46, 42, 50, 36, 29, 32 -+}; -+ -+static uchar perm3[64] = { 58, 50, 42, 34, 26, 18, 10, 2, -+ 60, 52, 44, 36, 28, 20, 12, 4, -+ 62, 54, 46, 38, 30, 22, 14, 6, -+ 64, 56, 48, 40, 32, 24, 16, 8, -+ 57, 49, 41, 33, 25, 17, 9, 1, -+ 59, 51, 43, 35, 27, 19, 11, 3, -+ 61, 53, 45, 37, 29, 21, 13, 5, -+ 63, 55, 47, 39, 31, 23, 15, 7 -+}; -+ -+static uchar perm4[48] = { 32, 1, 2, 3, 4, 5, -+ 4, 5, 6, 7, 8, 9, -+ 8, 9, 10, 11, 12, 13, -+ 12, 13, 14, 15, 16, 17, -+ 16, 17, 18, 19, 20, 21, -+ 20, 21, 22, 23, 24, 25, -+ 24, 25, 26, 27, 28, 29, -+ 28, 29, 30, 31, 32, 1 -+}; -+ -+static uchar perm5[32] = { 16, 7, 20, 21, -+ 29, 12, 28, 17, -+ 1, 15, 23, 26, -+ 5, 18, 31, 10, -+ 2, 8, 24, 14, -+ 32, 27, 3, 9, -+ 19, 13, 30, 6, -+ 22, 11, 4, 25 -+}; -+ -+static uchar perm6[64] = { 40, 8, 48, 16, 56, 24, 64, 32, -+ 39, 7, 47, 15, 55, 23, 63, 31, -+ 38, 6, 46, 14, 54, 22, 62, 30, -+ 37, 5, 45, 13, 53, 21, 61, 29, -+ 36, 4, 44, 12, 52, 20, 60, 28, -+ 35, 3, 43, 11, 51, 19, 59, 27, -+ 34, 2, 42, 10, 50, 18, 58, 26, -+ 33, 1, 41, 9, 49, 17, 57, 25 -+}; -+ -+static uchar sc[16] = { 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1 }; -+ -+static uchar sbox[8][4][16] = { -+ {{14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7}, -+ {0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8}, -+ {4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0}, -+ {15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13}}, -+ -+ {{15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10}, -+ {3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5}, -+ {0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15}, -+ {13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9}}, -+ -+ {{10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8}, -+ {13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1}, -+ {13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7}, -+ {1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12}}, -+ -+ {{7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15}, -+ {13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9}, -+ {10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4}, -+ {3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14}}, -+ -+ {{2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9}, -+ {14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6}, -+ {4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14}, -+ {11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3}}, -+ -+ {{12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11}, -+ {10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8}, -+ {9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6}, -+ {4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13}}, -+ -+ {{4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1}, -+ {13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6}, -+ {1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2}, -+ {6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12}}, -+ -+ {{13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7}, -+ {1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2}, -+ {7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8}, -+ {2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11}} -+}; -+ -+static void -+permute(char *out, char *in, uchar * p, int n) -+{ -+ int i; -+ for (i = 0; i < n; i++) -+ out[i] = in[p[i] - 1]; -+} -+ -+static void -+lshift(char *d, int count, int n) -+{ -+ char out[64]; -+ int i; -+ for (i = 0; i < n; i++) -+ out[i] = d[(i + count) % n]; -+ for (i = 0; i < n; i++) -+ d[i] = out[i]; -+} -+ -+static void -+concat(char *out, char *in1, char *in2, int l1, int l2) -+{ -+ while (l1--) -+ *out++ = *in1++; -+ while (l2--) -+ *out++ = *in2++; -+} -+ -+static void -+xor(char *out, char *in1, char *in2, int n) -+{ -+ int i; -+ for (i = 0; i < n; i++) -+ out[i] = in1[i] ^ in2[i]; -+} -+ -+static void -+dohash(char *out, char *in, char *key, int forw) -+{ -+ int i, j, k; -+ char *pk1; -+ char c[28]; -+ char d[28]; -+ char *cd; -+ char ki[16][48]; -+ char *pd1; -+ char l[32], r[32]; -+ char *rl; -+ -+ /* Have to reduce stack usage */ -+ pk1 = kmalloc(56+56+64+64,GFP_KERNEL); -+ if(pk1 == NULL) -+ return; -+ -+ cd = pk1 + 56; -+ pd1= cd + 56; -+ rl = pd1 + 64; -+ -+ permute(pk1, key, perm1, 56); -+ -+ for (i = 0; i < 28; i++) -+ c[i] = pk1[i]; -+ for (i = 0; i < 28; i++) -+ d[i] = pk1[i + 28]; -+ -+ for (i = 0; i < 16; i++) { -+ lshift(c, sc[i], 28); -+ lshift(d, sc[i], 28); -+ -+ concat(cd, c, d, 28, 28); -+ permute(ki[i], cd, perm2, 48); -+ } -+ -+ permute(pd1, in, perm3, 64); -+ -+ for (j = 0; j < 32; j++) { -+ l[j] = pd1[j]; -+ r[j] = pd1[j + 32]; -+ } -+ -+ for (i = 0; i < 16; i++) { -+ char *er; /* er[48] */ -+ char *erk; /* erk[48] */ -+ char b[8][6]; -+ char *cb; /* cb[32] */ -+ char *pcb; /* pcb[32] */ -+ char *r2; /* r2[32] */ -+ -+ er = kmalloc(48+48+32+32+32, GFP_KERNEL); -+ if(er == NULL) { -+ kfree(pk1); -+ return; -+ } -+ erk = er+48; -+ cb = erk+48; -+ pcb = cb+32; -+ r2 = pcb+32; -+ -+ permute(er, r, perm4, 48); -+ -+ xor(erk, er, ki[forw ? i : 15 - i], 48); -+ -+ for (j = 0; j < 8; j++) -+ for (k = 0; k < 6; k++) -+ b[j][k] = erk[j * 6 + k]; -+ -+ for (j = 0; j < 8; j++) { -+ int m, n; -+ m = (b[j][0] << 1) | b[j][5]; -+ -+ n = (b[j][1] << 3) | (b[j][2] << 2) | (b[j][3] << -+ 1) | b[j][4]; -+ -+ for (k = 0; k < 4; k++) -+ b[j][k] = -+ (sbox[j][m][n] & (1 << (3 - k))) ? 1 : 0; -+ } -+ -+ for (j = 0; j < 8; j++) -+ for (k = 0; k < 4; k++) -+ cb[j * 4 + k] = b[j][k]; -+ permute(pcb, cb, perm5, 32); -+ -+ xor(r2, l, pcb, 32); -+ -+ for (j = 0; j < 32; j++) -+ l[j] = r[j]; -+ -+ for (j = 0; j < 32; j++) -+ r[j] = r2[j]; -+ -+ kfree(er); -+ } -+ -+ concat(rl, r, l, 32, 32); -+ -+ permute(out, rl, perm6, 64); -+ kfree(pk1); -+} -+ -+static void -+str_to_key(unsigned char *str, unsigned char *key) -+{ -+ int i; -+ -+ key[0] = str[0] >> 1; -+ key[1] = ((str[0] & 0x01) << 6) | (str[1] >> 2); -+ key[2] = ((str[1] & 0x03) << 5) | (str[2] >> 3); -+ key[3] = ((str[2] & 0x07) << 4) | (str[3] >> 4); -+ key[4] = ((str[3] & 0x0F) << 3) | (str[4] >> 5); -+ key[5] = ((str[4] & 0x1F) << 2) | (str[5] >> 6); -+ key[6] = ((str[5] & 0x3F) << 1) | (str[6] >> 7); -+ key[7] = str[6] & 0x7F; -+ for (i = 0; i < 8; i++) { -+ key[i] = (key[i] << 1); -+ } -+} -+ -+static void -+smbhash(unsigned char *out, unsigned char *in, unsigned char *key, int forw) -+{ -+ int i; -+ char *outb; /* outb[64] */ -+ char *inb; /* inb[64] */ -+ char *keyb; /* keyb[64] */ -+ unsigned char key2[8]; -+ -+ outb = kmalloc(64 * 3,GFP_KERNEL); -+ if(outb == NULL) -+ return; -+ -+ inb = outb + 64; -+ keyb = inb + 64; -+ -+ str_to_key(key, key2); -+ -+ for (i = 0; i < 64; i++) { -+ inb[i] = (in[i / 8] & (1 << (7 - (i % 8)))) ? 1 : 0; -+ keyb[i] = (key2[i / 8] & (1 << (7 - (i % 8)))) ? 1 : 0; -+ outb[i] = 0; -+ } -+ -+ dohash(outb, inb, keyb, forw); -+ -+ for (i = 0; i < 8; i++) { -+ out[i] = 0; -+ } -+ -+ for (i = 0; i < 64; i++) { -+ if (outb[i]) -+ out[i / 8] |= (1 << (7 - (i % 8))); -+ } -+ kfree(outb); -+} -+ -+void -+E_P16(unsigned char *p14, unsigned char *p16) -+{ -+ unsigned char sp8[8] = -+ { 0x4b, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 }; -+ smbhash(p16, sp8, p14, 1); -+ smbhash(p16 + 8, sp8, p14 + 7, 1); -+} -+ -+void -+E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24) -+{ -+ smbhash(p24, c8, p21, 1); -+ smbhash(p24 + 8, c8, p21 + 7, 1); -+ smbhash(p24 + 16, c8, p21 + 14, 1); -+} -+ -+void -+D_P16(unsigned char *p14, unsigned char *in, unsigned char *out) -+{ -+ smbhash(out, in, p14, 0); -+ smbhash(out + 8, in + 8, p14 + 7, 0); -+} -+ -+void -+E_old_pw_hash(unsigned char *p14, unsigned char *in, unsigned char *out) -+{ -+ smbhash(out, in, p14, 1); -+ smbhash(out + 8, in + 8, p14 + 7, 1); -+} -+ -+void -+cred_hash1(unsigned char *out, unsigned char *in, unsigned char *key) -+{ -+ unsigned char buf[8]; -+ -+ smbhash(buf, in, key, 1); -+ smbhash(out, buf, key + 9, 1); -+} -+ -+void -+cred_hash2(unsigned char *out, unsigned char *in, unsigned char *key) -+{ -+ unsigned char buf[8]; -+ static unsigned char key2[8]; -+ -+ smbhash(buf, in, key, 1); -+ key2[0] = key[7]; -+ smbhash(out, buf, key2, 1); -+} -+ -+void -+cred_hash3(unsigned char *out, unsigned char *in, unsigned char *key, int forw) -+{ -+ static unsigned char key2[8]; -+ -+ smbhash(out, in, key, forw); -+ key2[0] = key[7]; -+ smbhash(out + 8, in + 8, key2, forw); -+} -diff -urN linux-2.4.29.old/fs/cifs/smbencrypt.c linux-2.4.29/fs/cifs/smbencrypt.c ---- linux-2.4.29.old/fs/cifs/smbencrypt.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/smbencrypt.c 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,295 @@ -+/* -+ Unix SMB/Netbios implementation. -+ Version 1.9. -+ SMB parameters and setup -+ Copyright (C) Andrew Tridgell 1992-2000 -+ Copyright (C) Luke Kenneth Casson Leighton 1996-2000 -+ Modified by Jeremy Allison 1995. -+ Copyright (C) Andrew Bartlett 2002-2003 -+ Modified by Steve French (sfrench@us.ibm.com) 2002-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., 675 Mass Ave, Cambridge, MA 02139, USA. -+*/ -+ -+#include -+#include -+#include -+#include -+#include -+#include "cifs_unicode.h" -+#include "cifspdu.h" -+#include "md5.h" -+#include "cifs_debug.h" -+ -+#ifndef FALSE -+#define FALSE 0 -+#endif -+#ifndef TRUE -+#define TRUE 1 -+#endif -+ -+/* following came from the other byteorder.h to avoid include conflicts */ -+#define CVAL(buf,pos) (((unsigned char *)(buf))[pos]) -+#define SSVALX(buf,pos,val) (CVAL(buf,pos)=(val)&0xFF,CVAL(buf,pos+1)=(val)>>8) -+#define SSVAL(buf,pos,val) SSVALX((buf),(pos),((__u16)(val))) -+ -+/*The following definitions come from lib/md4.c */ -+ -+void mdfour(unsigned char *out, unsigned char *in, int n); -+ -+/*The following definitions come from libsmb/smbdes.c */ -+ -+void E_P16(unsigned char *p14, unsigned char *p16); -+void E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24); -+void D_P16(unsigned char *p14, unsigned char *in, unsigned char *out); -+void E_old_pw_hash(unsigned char *p14, unsigned char *in, unsigned char *out); -+void cred_hash1(unsigned char *out, unsigned char *in, unsigned char *key); -+void cred_hash2(unsigned char *out, unsigned char *in, unsigned char *key); -+void cred_hash3(unsigned char *out, unsigned char *in, unsigned char *key, -+ int forw); -+ -+/*The following definitions come from libsmb/smbencrypt.c */ -+ -+void SMBencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24); -+void E_md4hash(const unsigned char *passwd, unsigned char *p16); -+void nt_lm_owf_gen(char *pwd, unsigned char nt_p16[16], unsigned char p16[16]); -+void SMBOWFencrypt(unsigned char passwd[16], unsigned char *c8, -+ unsigned char p24[24]); -+void NTLMSSPOWFencrypt(unsigned char passwd[8], -+ unsigned char *ntlmchalresp, unsigned char p24[24]); -+void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24); -+int decode_pw_buffer(char in_buffer[516], char *new_pwrd, -+ int new_pwrd_size, __u32 * new_pw_len); -+ -+/* -+ This implements the X/Open SMB password encryption -+ It takes a password, a 8 byte "crypt key" and puts 24 bytes of -+ encrypted password into p24 */ -+/* Note that password must be uppercased and null terminated */ -+void -+SMBencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24) -+{ -+ unsigned char p14[15], p21[21]; -+ -+ memset(p21, '\0', 21); -+ memset(p14, '\0', 14); -+ strncpy((char *) p14, (char *) passwd, 14); -+ -+/* strupper((char *)p14); *//* BB at least uppercase the easy range */ -+ E_P16(p14, p21); -+ -+ SMBOWFencrypt(p21, c8, p24); -+ -+ memset(p14,0,15); -+ memset(p21,0,21); -+} -+ -+/* Routines for Windows NT MD4 Hash functions. */ -+static int -+_my_wcslen(__u16 * str) -+{ -+ int len = 0; -+ while (*str++ != 0) -+ len++; -+ return len; -+} -+ -+/* -+ * Convert a string into an NT UNICODE string. -+ * Note that regardless of processor type -+ * this must be in intel (little-endian) -+ * format. -+ */ -+ -+static int -+_my_mbstowcs(__u16 * dst, const unsigned char *src, int len) -+{ /* not a very good conversion routine - change/fix */ -+ int i; -+ __u16 val; -+ -+ for (i = 0; i < len; i++) { -+ val = *src; -+ SSVAL(dst, 0, val); -+ dst++; -+ src++; -+ if (val == 0) -+ break; -+ } -+ return i; -+} -+ -+/* -+ * Creates the MD4 Hash of the users password in NT UNICODE. -+ */ -+ -+void -+E_md4hash(const unsigned char *passwd, unsigned char *p16) -+{ -+ int len; -+ __u16 wpwd[129]; -+ -+ /* Password cannot be longer than 128 characters */ -+ if(passwd) { -+ len = strlen((char *) passwd); -+ if (len > 128) { -+ len = 128; -+ } -+ /* Password must be converted to NT unicode */ -+ _my_mbstowcs(wpwd, passwd, len); -+ } else -+ len = 0; -+ -+ wpwd[len] = 0; /* Ensure string is null terminated */ -+ /* Calculate length in bytes */ -+ len = _my_wcslen(wpwd) * sizeof (__u16); -+ -+ mdfour(p16, (unsigned char *) wpwd, len); -+ memset(wpwd,0,129 * 2); -+} -+ -+/* Does both the NT and LM owfs of a user's password */ -+void -+nt_lm_owf_gen(char *pwd, unsigned char nt_p16[16], unsigned char p16[16]) -+{ -+ char passwd[514]; -+ -+ memset(passwd, '\0', 514); -+ if (strlen(pwd) < 513) -+ strcpy(passwd, pwd); -+ else -+ memcpy(passwd, pwd, 512); -+ /* Calculate the MD4 hash (NT compatible) of the password */ -+ memset(nt_p16, '\0', 16); -+ E_md4hash(passwd, nt_p16); -+ -+ /* Mangle the passwords into Lanman format */ -+ passwd[14] = '\0'; -+/* strupper(passwd); */ -+ -+ /* Calculate the SMB (lanman) hash functions of the password */ -+ -+ memset(p16, '\0', 16); -+ E_P16((unsigned char *) passwd, (unsigned char *) p16); -+ -+ /* clear out local copy of user's password (just being paranoid). */ -+ memset(passwd, '\0', sizeof (passwd)); -+} -+ -+/* Does the NTLMv2 owfs of a user's password */ -+void -+ntv2_owf_gen(const unsigned char owf[16], const char *user_n, -+ const char *domain_n, unsigned char kr_buf[16], -+ const struct nls_table *nls_codepage) -+{ -+ wchar_t * user_u; -+ wchar_t * dom_u; -+ int user_l, domain_l; -+ struct HMACMD5Context ctx; -+ -+ /* might as well do one alloc to hold both (user_u and dom_u) */ -+ user_u = kmalloc(2048 * sizeof(wchar_t),GFP_KERNEL); -+ if(user_u == NULL) -+ return; -+ dom_u = user_u + 1024; -+ -+ /* push_ucs2(NULL, user_u, user_n, (user_l+1)*2, STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER); -+ push_ucs2(NULL, dom_u, domain_n, (domain_l+1)*2, STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER); */ -+ -+ /* BB user and domain may need to be uppercased */ -+ user_l = cifs_strtoUCS(user_u, user_n, 511, nls_codepage); -+ domain_l = cifs_strtoUCS(dom_u, domain_n, 511, nls_codepage); -+ -+ user_l++; /* trailing null */ -+ domain_l++; -+ -+ hmac_md5_init_limK_to_64(owf, 16, &ctx); -+ hmac_md5_update((const unsigned char *) user_u, user_l * 2, &ctx); -+ hmac_md5_update((const unsigned char *) dom_u, domain_l * 2, &ctx); -+ hmac_md5_final(kr_buf, &ctx); -+ -+ kfree(user_u); -+} -+ -+/* Does the des encryption from the NT or LM MD4 hash. */ -+void -+SMBOWFencrypt(unsigned char passwd[16], unsigned char *c8, -+ unsigned char p24[24]) -+{ -+ unsigned char p21[21]; -+ -+ memset(p21, '\0', 21); -+ -+ memcpy(p21, passwd, 16); -+ E_P24(p21, c8, p24); -+} -+ -+/* Does the des encryption from the FIRST 8 BYTES of the NT or LM MD4 hash. */ -+void -+NTLMSSPOWFencrypt(unsigned char passwd[8], -+ unsigned char *ntlmchalresp, unsigned char p24[24]) -+{ -+ unsigned char p21[21]; -+ -+ memset(p21, '\0', 21); -+ memcpy(p21, passwd, 8); -+ memset(p21 + 8, 0xbd, 8); -+ -+ E_P24(p21, ntlmchalresp, p24); -+} -+ -+/* Does the NT MD4 hash then des encryption. */ -+ -+void -+SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24) -+{ -+ unsigned char p21[21]; -+ -+ memset(p21, '\0', 21); -+ -+ E_md4hash(passwd, p21); -+ SMBOWFencrypt(p21, c8, p24); -+} -+ -+/* Does the md5 encryption from the NT hash for NTLMv2. */ -+void -+SMBOWFencrypt_ntv2(const unsigned char kr[16], -+ const struct data_blob * srv_chal, -+ const struct data_blob * cli_chal, unsigned char resp_buf[16]) -+{ -+ struct HMACMD5Context ctx; -+ -+ hmac_md5_init_limK_to_64(kr, 16, &ctx); -+ hmac_md5_update(srv_chal->data, srv_chal->length, &ctx); -+ hmac_md5_update(cli_chal->data, cli_chal->length, &ctx); -+ hmac_md5_final(resp_buf, &ctx); -+} -+ -+void -+SMBsesskeygen_ntv2(const unsigned char kr[16], -+ const unsigned char *nt_resp, __u8 sess_key[16]) -+{ -+ struct HMACMD5Context ctx; -+ -+ hmac_md5_init_limK_to_64(kr, 16, &ctx); -+ hmac_md5_update(nt_resp, 16, &ctx); -+ hmac_md5_final((unsigned char *) sess_key, &ctx); -+} -+ -+void -+SMBsesskeygen_ntv1(const unsigned char kr[16], -+ const unsigned char *nt_resp, __u8 sess_key[16]) -+{ -+ mdfour((unsigned char *) sess_key, (unsigned char *) kr, 16); -+} -diff -urN linux-2.4.29.old/fs/cifs/smberr.c linux-2.4.29/fs/cifs/smberr.c ---- linux-2.4.29.old/fs/cifs/smberr.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/smberr.c 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,240 @@ -+/* -+ Unix SMB/Netbios implementation. -+ Version 1.9. -+ Copyright (C) Andrew Tridgell 1998 -+ Copyright (C) Steve French (sfrench@us.ibm.com) 2002 -+ 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 "smberr.h" -+#define NO_SYSLOG -+/* error code stuff - put together by Merik Karman -+ merik@blackadder.dsh.oz.au */ -+ typedef const struct { -+ char *name; -+ int code; -+ char *message; -+ int posix_code; -+} err_code_struct; -+ -+/* Dos Error Messages */ -+err_code_struct dos_msgs[] = { -+ {"ERRbadfunc", ERRbadfunc, "Invalid function.", -EINVAL}, -+ {"ERRbadfile", ERRbadfile, "File not found.", -ENOENT}, -+ {"ERRbadpath", ERRbadpath, "Directory invalid.", -ENOENT}, -+ {"ERRnofids", ERRnofids, "No file descriptors available", -EMFILE}, -+ {"ERRnoaccess", ERRnoaccess, "Access denied.", -EACCES}, -+ {"ERRbadfid", ERRbadfid, "Invalid file handle.", -EBADF}, -+ {"ERRbadmcb", 7, "Memory control blocks destroyed.", -EIO}, -+ {"ERRnomem", ERRnomem, -+ "Insufficient server memory to perform the requested function.", -+ -ENOMEM}, -+ {"ERRbadmem", ERRbadmem, "Invalid memory block address.", -EFAULT}, -+ {"ERRbadenv", ERRbadenv, "Invalid environment.", -EFAULT}, -+ {"ERRbadformat", 11, "Invalid format.", -EINVAL}, -+ {"ERRbadaccess", ERRbadaccess, "Invalid open mode." - EACCES}, -+ {"ERRbaddata", ERRbaddata, "Invalid data.", -EIO}, -+ {"ERR", ERRres, "reserved.", -EIO}, -+ {"ERRbaddrive", ERRbaddrive, "Invalid drive specified.", -ENXIO}, -+ {"ERRremcd", ERRremcd, -+ "A Delete Directory request attempted to remove the server's current directory.", -+ -EIO}, -+ {"ERRdiffdevice", ERRdiffdevice, "Not same device.", -EXDEV}, -+ {"ERRnofiles", ERRnofiles, "A File Search command can find no more files matching the specified criteria.", -ENOENT}, /* Note: must map to zero manually in some places such as readdir */ -+ {"ERRbadshare", ERRbadshare, -+ "The sharing mode specified for an Open conflicts with existing FIDs on the file.", -+ -EXTBSY}, -+ {"ERRlock", ERRlock, -+ "A Lock request conflicted with an existing lock or specified an invalid mode, or an Unlock requested attempted to remove a lock held by another process.", -+ -EACCES}, -+ {"ERRunsup", ERRunsup, "The operation is unsupported", -EINVAL}, -+ {"ERRnosuchshare", ERRnosuchshare, -+ "You specified an invalid share name", -ENXIO}, -+ {"ERRfilexists", ERRfilexists, -+ "The file named in a Create Directory, Make New File or Link request already exists.", -+ -EEXIST}, -+ {"ERRinvalidname", ERRinvalidname, "Invalid name", -ENOENT}, -+ {"ERRdiskfull", ERRdiskfull, "Disk full", -ENOSPC} -+ -+ {"ERRmoredata", ERRmoredata, -+ "There is more data to be returned.",}, -+ {"ERRinvgroup", 2455, "Invalid workgroup (try the -W option)"}, -+ {NULL, -1, NULL, -EIO} -+}; -+ -+/* Server Error Messages */ -+err_code_struct server_msgs[] = { -+ {"ERRerror", 1, "Non-specific error code."}, -+ {"ERRbadpw", 2, -+ "Bad password - name/password pair in a Tree Connect or Session Setup are invalid."}, -+ {"ERRbadtype", 3, "reserved."}, -+ {"ERRaccess", 4, -+ "The requester does not have the necessary access rights within the specified context for the requested function. The context is defined by the TID or the UID."}, -+ {"ERRinvnid", 5, -+ "The tree ID (TID) specified in a command was invalid."}, -+ {"ERRinvnetname", 6, "Invalid network name in tree connect."}, -+ {"ERRinvdevice", 7, -+ "Invalid device - printer request made to non-printer connection or non-printer request made to printer connection."}, -+ {"ERRqfull", 49, -+ "Print queue full (files) -- returned by open print file."}, -+ {"ERRqtoobig", 50, "Print queue full -- no space."}, -+ {"ERRqeof", 51, "EOF on print queue dump."}, -+ {"ERRinvpfid", 52, "Invalid print file FID."}, -+ {"ERRsmbcmd", 64, -+ "The server did not recognize the command received."}, -+ {"ERRsrverror", 65, -+ "The server encountered an internal error, e.g., system file unavailable."}, -+ {"ERRfilespecs", 67, -+ "The file handle (FID) and pathname parameters contained an invalid combination of values."}, -+ {"ERRreserved", 68, "reserved."}, -+ {"ERRbadpermits", 69, -+ "The access permissions specified for a file or directory are not a valid combination. The server cannot set the requested attribute."}, -+ {"ERRreserved", 70, "reserved."}, -+ {"ERRsetattrmode", 71, -+ "The attribute mode in the Set File Attribute request is invalid."}, -+ {"ERRpaused", 81, "Server is paused."}, -+ {"ERRmsgoff", 82, "Not receiving messages."}, -+ {"ERRnoroom", 83, "No room to buffer message."}, -+ {"ERRrmuns", 87, "Too many remote user names."}, -+ {"ERRtimeout", 88, "Operation timed out."}, -+ {"ERRnoresource", 89, -+ "No resources currently available for request."}, -+ {"ERRtoomanyuids", 90, "Too many UIDs active on this session."}, -+ {"ERRbaduid", 91, -+ "The UID is not known as a valid ID on this session."}, -+ {"ERRusempx", 250, "Temp unable to support Raw, use MPX mode."}, -+ {"ERRusestd", 251, -+ "Temp unable to support Raw, use standard read/write."}, -+ {"ERRcontmpx", 252, "Continue in MPX mode."}, -+ {"ERRreserved", 253, "reserved."}, -+ {"ERRreserved", 254, "reserved."}, -+ {"ERRnosupport", 0xFFFF, "Function not supported."}, -+ {NULL, -1, NULL} -+}; -+ -+/* Hard Error Messages */ -+err_code_struct hard_msgs[] = { -+ {"ERRnowrite", 19, -+ "Attempt to write on write-protected diskette."}, -+ {"ERRbadunit", 20, "Unknown unit."}, -+ {"ERRnotready", 21, "Drive not ready."}, -+ {"ERRbadcmd", 22, "Unknown command."}, -+ {"ERRdata", 23, "Data error (CRC)."}, -+ {"ERRbadreq", 24, "Bad request structure length."}, -+ {"ERRseek", 25, "Seek error."}, -+ {"ERRbadmedia", 26, "Unknown media type."}, -+ {"ERRbadsector", 27, "Sector not found."}, -+ {"ERRnopaper", 28, "Printer out of paper."}, -+ {"ERRwrite", 29, "Write fault."}, -+ {"ERRread", 30, "Read fault."}, -+ {"ERRgeneral", 31, "General failure."}, -+ {"ERRbadshare", 32, "An open conflicts with an existing open."}, -+ {"ERRlock", 33, -+ "A Lock request conflicted with an existing lock or specified an invalid mode, or an Unlock requested attempted to remove a lock held by another process."}, -+ {"ERRwrongdisk", 34, "The wrong disk was found in a drive."}, -+ {"ERRFCBUnavail", 35, "No FCBs are available to process request."}, -+ {"ERRsharebufexc", 36, "A sharing buffer has been exceeded."}, -+ {NULL, -1, NULL} -+}; -+ -+ -+const struct { -+ int code; -+ char *class; -+ err_code_struct *err_msgs; -+} err_classes[] = { -+ { -+ 0, "SUCCESS", NULL}, { -+ 0x01, "ERRDOS", dos_msgs}, { -+ 0x02, "ERRSRV", server_msgs}, { -+ 0x03, "ERRHRD", hard_msgs}, { -+ 0x04, "ERRXOS", NULL}, { -+ 0xE1, "ERRRMX1", NULL}, { -+ 0xE2, "ERRRMX2", NULL}, { -+ 0xE3, "ERRRMX3", NULL}, { -+ 0xFF, "ERRCMD", NULL}, { -+-1, NULL, NULL}}; -+ -+ -+/**************************************************************************** -+return a SMB error string from a SMB buffer -+****************************************************************************/ -+char *smb_dos_errstr(char *inbuf) -+{ -+ static pstring ret; -+ int class = CVAL(inbuf, smb_rcls); -+ int num = SVAL(inbuf, smb_err); -+ int i, j; -+ -+ for (i = 0; err_classes[i].class; i++) -+ if (err_classes[i].code == class) { -+ if (err_classes[i].err_msgs) { -+ err_code_struct *err = -+ err_classes[i].err_msgs; -+ for (j = 0; err[j].name; j++) -+ if (num == err[j].code) { -+ if (DEBUGLEVEL > 0) -+ slprintf(ret, -+ sizeof -+ (ret) - 1, -+ "%s - %s (%s)", -+ err_classes -+ [i].class, -+ err[j]. -+ name, -+ err[j]. -+ message); -+ else -+ slprintf(ret, -+ sizeof -+ (ret) - 1, -+ "%s - %s", -+ err_classes -+ [i].class, -+ err[j]. -+ name); -+ return ret; -+ } -+ } -+ -+ slprintf(ret, sizeof(ret) - 1, "%s - %d", -+ err_classes[i].class, num); -+ return ret; -+ } -+ -+ slprintf(ret, sizeof(ret) - 1, "Error: Unknown error (%d,%d)", -+ class, num); -+ return (ret); -+} -+ -+ -+/***************************************************************************** -+ returns an WERROR error message. -+ *****************************************************************************/ -+char *werror_str(WERROR status) -+{ -+ static fstring msg; -+ slprintf(msg, sizeof(msg), "WIN32 code 0x%08x", W_ERROR_V(status)); -+ return msg; -+} -+ -+ -+/***************************************************************************** -+map a unix errno to a win32 error -+ *****************************************************************************/ -+WERROR map_werror_from_unix(int error) -+{ -+ NTSTATUS status = map_nt_error_from_unix(error); -+ return ntstatus_to_werror(status); -+} -diff -urN linux-2.4.29.old/fs/cifs/smberr.h linux-2.4.29/fs/cifs/smberr.h ---- linux-2.4.29.old/fs/cifs/smberr.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/smberr.h 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,113 @@ -+/* -+ * fs/cifs/smberr.h -+ * -+ * Copyright (c) International Business Machines Corp., 2002 -+ * Author(s): Steve French (sfrench@us.ibm.com) -+ * -+ * See Error Codes section of the SNIA CIFS Specification -+ * for more information -+ * -+ * This library is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This library 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 Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#define SUCCESS 0 /* The request was successful. */ -+#define ERRDOS 0x01 /* Error is from the core DOS operating system set */ -+#define ERRSRV 0x02 /* Error is generated by the file server daemon */ -+#define ERRHRD 0x03 /* Error is a hardware error. */ -+#define ERRCMD 0xFF /* Command was not in the "SMB" format. */ -+ -+/* The following error codes may be generated with the SUCCESS error class.*/ -+ -+#define SUCCESS 0 /* The request was successful. */ -+ -+/* The following error codes may be generated with the ERRDOS error class.*/ -+ -+#define ERRbadfunc 1 /* Invalid function. The server did not recognize or could not perform a system call generated by the server, e.g., set the DIRECTORY attribute on a data file, invalid seek mode. */ -+#define ERRbadfile 2 /*File not found. The last component of a file's pathname could not be found. */ -+#define ERRbadpath 3 /* Directory invalid. A directory component in a pathname could not be found. */ -+#define ERRnofids 4 /* Too many open files. The server has no file handles available. */ -+#define ERRnoaccess 5 /* Access denied, the client's context does not permit the requested function. This includes the following conditions: invalid rename command, write to Fid open for read only, read on Fid open for write only, attempt to delete a non-empty directory */ -+#define ERRbadfid 6 /* Invalid file handle. The file handle specified was not recognized by the server. */ -+#define ERRbadmcb 7 /* Memory control blocks destroyed. */ -+#define ERRnomem 8 /* Insufficient server memory to perform the requested function. */ -+#define ERRbadmem 9 /* Invalid memory block address. */ -+#define ERRbadenv 10 /* Invalid environment. */ -+#define ERRbadformat 11 /* Invalid format. */ -+#define ERRbadaccess 12 /* Invalid open mode. */ -+#define ERRbaddata 13 /* Invalid data (generated only by IOCTL calls within the server). */ -+#define ERRbaddrive 15 /* Invalid drive specified. */ -+#define ERRremcd 16 /* A Delete Directory request attempted to remove the server's current directory. */ -+#define ERRdiffdevice 17 /* Not same device (e.g., a cross volume rename was attempted */ -+#define ERRnofiles 18 /* A File Search command can find no more files matching the specified criteria. */ -+#define ERRgeneral 31 -+#define ERRbadshare 32 /* The sharing mode specified for an Open conflicts with existing FIDs on the file. */ -+#define ERRlock 33 /* A Lock request conflicted with an existing lock or specified an invalid mode, or an Unlock requested attempted to remove a lock held by another process. */ -+#define ERRunsup 50 -+#define ERRnosuchshare 67 -+#define ERRfilexists 80 /* The file named in the request already exists. */ -+#define ERRinvparm 87 -+#define ERRdiskfull 112 -+#define ERRinvname 123 -+#define ERRdirnotempty 145 -+#define ERRnotlocked 158 -+#define ERRalreadyexists 183 -+#define ERRbadpipe 230 -+#define ERRpipebusy 231 -+#define ERRpipeclosing 232 -+#define ERRnotconnected 233 -+#define ERRmoredata 234 -+#define ErrQuota 0x200 /* The operation would cause a quota limit to be exceeded. */ -+#define ErrNotALink 0x201 /* A link operation was performed on a pathname that -+ was not a link. */ -+ -+/* Following error codes may be generated with the ERRSRV error -+class.*/ -+ -+#define ERRerror 1 /* Non-specific error code. It is returned under the following conditions: resource other than disk space exhausted (e.g. TIDs), first SMB command was not negotiate, multiple negotiates attempted, and internal server error. */ -+#define ERRbadpw 2 /* Bad password - name/password pair in a TreeConnect or Session Setup are invalid. */ -+#define ERRbadtype 3 /* used for indicating DFS referral needed */ -+#define ERRaccess 4 /* The client does not have the necessary access rights within the specified context for requested function. */ -+#define ERRinvtid 5 /* The Tid specified in a command was invalid. */ -+#define ERRinvnetname 6 /* Invalid network name in tree connect. */ -+#define ERRinvdevice 7 /* Invalid device - printer request made to non-printer connection or non-printer request made to printer connection. */ -+#define ERRqfull 49 /* Print queue full (files) -- returned by open print file. */ -+#define ERRqtoobig 50 /* Print queue full -- no space. */ -+#define ERRqeof 51 /* EOF on print queue dump */ -+#define ERRinvpfid 52 /* Invalid print file FID. */ -+#define ERRsmbcmd 64 /* The server did not recognize the command received. */ -+#define ERRsrverror 65 /* The server encountered an internal error, e.g., system file unavailable. */ -+#define ERRbadBID 66 /* (obsolete) */ -+#define ERRfilespecs 67 /* The Fid and pathname parameters contained an invalid combination of values. */ -+#define ERRbadLink 68 /* (obsolete) */ -+#define ERRbadpermits 69 /* The access permissions specified for a file or directory are not a valid combination. */ -+#define ERRbadPID 70 -+#define ERRsetattrmode 71 /* attribute (mode) is invalid */ -+#define ERRpaused 81 /* Server is paused */ -+#define ERRmsgoff 82 /* reserved - messaging off */ -+#define ERRnoroom 83 /* reserved - no room for message */ -+#define ERRrmuns 87 /* reserved - too many remote names */ -+#define ERRtimeout 88 /* operation timed out */ -+#define ERRnoresource 89 /* No resources available for request */ -+#define ERRtoomanyuids 90 /* Too many UIDs active on this session */ -+#define ERRbaduid 91 /* The UID is not known as a valid user */ -+#define ERRusempx 250 /* temporarily unable to use raw */ -+#define ERRusestd 251 /* temporarily unable to use either raw or mpx */ -+#define ERR_NOTIFY_ENUM_DIR 1024 -+#define ERRaccountexpired 2239 -+#define ERRbadclient 2240 -+#define ERRbadLogonTime 2241 -+#define ERRpasswordExpired 2242 -+#define ERRnetlogonNotStarted 2455 -+#define ERRnosupport 0xFFFF -diff -urN linux-2.4.29.old/fs/cifs/TODO linux-2.4.29/fs/cifs/TODO ---- linux-2.4.29.old/fs/cifs/TODO 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/TODO 2004-07-14 00:25:04.000000000 +0200 -@@ -0,0 +1,106 @@ -+version 1.16 May 27, 2004 -+ -+A Partial List of Missing Features -+================================== -+ -+Contributions are welcome. There are plenty of opportunities -+for visible, important contributions to this module. Here -+is a partial list of the known problems and missing features: -+ -+a) Support for SecurityDescriptors for chmod/chgrp/chown so -+these can be supported for Windows servers -+ -+b) Better pam/winbind integration -+ -+c) multi-user mounts - multiplexed sessionsetups over single vc -+(ie tcp session) - prettying up needed -+ -+d) Kerberos/SPNEGO session setup support - (started) -+ -+e) NTLMv2 authentication (mostly implemented) -+ -+f) MD5-HMAC signing SMB PDUs when SPNEGO style SessionSetup -+used (Kerberos or NTLMSSP). Signing alreadyimplemented for NTLM -+and raw NTLMSSP already. This is important when enabling -+extended security and mounting to Windows 2003 Servers -+ -+f) Directory entry caching relies on a 1 second timer, rather than -+using FindNotify or equivalent. - (started) -+ -+g) A few byte range testcases fail due to POSIX vs. Windows/CIFS -+style byte range lock differences -+ -+h) quota support -+ -+i) support for the Linux 2.5 kernel new feature get_xattr and set_xattr -+which will allow us to expose dos attributes as well as real -+ACLs. This support has been started in the current code, but is -+ifdeffed out. -+ -+k) finish writepages support (multi-page write behind for improved -+performance) and syncpage -+ -+l) hook lower into the sockets api (as NFS/SunRPC does) to avoid the -+extra copy in/out of the socket buffers in some cases. -+ -+m) finish support for IPv6. This is mostly complete but -+needs a simple inet_pton like function to convert ipv6 -+addresses in string representation. -+ -+o) Better optimize open (and pathbased setfilesize) to reduce the -+oplock breaks coming from windows srv. Piggyback identical file -+opens on top of each other by incrementing reference count rather -+than resending (helps reduce server resource utilization and avoid -+spurious oplock breaks). -+ -+p) Improve performance of readpages by sending more than one read -+at a time when 8 pages or more are requested. Evaluate whether -+reads larger than 16K would be helpful. -+ -+q) For support of Windows9x/98 we need to retry failed mounts -+to *SMBSERVER (default server name) with the uppercase hostname -+in the RFC1001 session_init request. -+ -+r) Add Extended Attributed support (for storing UID/GID info -+to Windows servers) -+ -+s) Finish fcntl D_NOTIFY support so kde and gnome file list windows -+will autorefresh -+ -+t) Add GUI tool to configure /proc/fs/cifs settings and for display of -+the CIFS statistics -+ -+KNOWN BUGS (updated May 27, 2004) -+==================================== -+1) existing symbolic links (Windows reparse points) are recognized but -+can not be created remotely. They are implemented for Samba and those that -+support the CIFS Unix extensions but Samba has a bug currently handling -+symlink text beginning with slash -+2) follow_link and readdir code does not follow dfs junctions -+but recognizes them -+3) create of new files to FAT partitions on Windows servers can -+succeed but still return access denied (appears to be Windows -+server not cifs client problem) and has not been reproduced recently. -+NTFS partitions do not have this problem. -+4) debug connectathon lock test case 10 which fails against -+Samba (may be unmappable due to POSIX to Windows lock model -+differences but worth investigating). Also debug Samba to -+see why lock test case 7 takes longer to complete to Samba -+than to Windows. -+ -+Misc testing to do -+================== -+1) check out max path names and max path name components against various server -+types. Try nested symlinks. Return max path name in stat -f information -+ -+2) Modify file portion of ltp so it can run against a mounted network -+share and run it against cifs vfs. -+ -+3) Additional performance testing and optimization using iozone and similar - -+there are some easy changes that can be done to parallelize sequential writes, -+and when signing is disabled to request larger read sizes (larger than -+negotiated size) and send larger write sizes to modern servers. -+ -+4) More exhaustively test the recently added NT4 support against various -+NT4 service pack levels. -+ -diff -urN linux-2.4.29.old/fs/cifs/transport.c linux-2.4.29/fs/cifs/transport.c ---- linux-2.4.29.old/fs/cifs/transport.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/fs/cifs/transport.c 2004-07-14 00:25:05.000000000 +0200 -@@ -0,0 +1,434 @@ -+/* -+ * fs/cifs/transport.c -+ * -+ * Copyright (C) International Business Machines Corp., 2002,2004 -+ * Author(s): Steve French (sfrench@us.ibm.com) -+ * -+ * This library is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This library 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 Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * along with this library; 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 "cifspdu.h" -+#include "cifsglob.h" -+#include "cifsproto.h" -+#include "cifs_debug.h" -+ -+extern kmem_cache_t *cifs_mid_cachep; -+extern kmem_cache_t *cifs_oplock_cachep; -+ -+struct mid_q_entry * -+AllocMidQEntry(struct smb_hdr *smb_buffer, struct cifsSesInfo *ses) -+{ -+ struct mid_q_entry *temp; -+ -+ if (ses == NULL) { -+ cERROR(1, ("Null session passed in to AllocMidQEntry ")); -+ return NULL; -+ } -+ if (ses->server == NULL) { -+ cERROR(1, ("Null TCP session in AllocMidQEntry")); -+ return NULL; -+ } -+ -+ temp = (struct mid_q_entry *) kmem_cache_alloc(cifs_mid_cachep, -+ SLAB_KERNEL); -+ if (temp == NULL) -+ return temp; -+ else { -+ memset(temp, 0, sizeof (struct mid_q_entry)); -+ temp->mid = smb_buffer->Mid; /* always LE */ -+ temp->pid = current->pid; -+ temp->command = smb_buffer->Command; -+ cFYI(1, ("For smb_command %d", temp->command)); -+ do_gettimeofday(&temp->when_sent); -+ temp->ses = ses; -+ temp->tsk = current; -+ } -+ -+ spin_lock(&GlobalMid_Lock); -+ list_add_tail(&temp->qhead, &ses->server->pending_mid_q); -+ atomic_inc(&midCount); -+ temp->midState = MID_REQUEST_ALLOCATED; -+ spin_unlock(&GlobalMid_Lock); -+ return temp; -+} -+ -+void -+DeleteMidQEntry(struct mid_q_entry *midEntry) -+{ -+ spin_lock(&GlobalMid_Lock); -+ midEntry->midState = MID_FREE; -+ list_del(&midEntry->qhead); -+ atomic_dec(&midCount); -+ spin_unlock(&GlobalMid_Lock); -+ cifs_buf_release(midEntry->resp_buf); -+ kmem_cache_free(cifs_mid_cachep, midEntry); -+} -+ -+struct oplock_q_entry * -+AllocOplockQEntry(struct inode * pinode, __u16 fid, struct cifsTconInfo * tcon) -+{ -+ struct oplock_q_entry *temp; -+ if ((pinode== NULL) || (tcon == NULL)) { -+ cERROR(1, ("Null parms passed to AllocOplockQEntry")); -+ return NULL; -+ } -+ temp = (struct oplock_q_entry *) kmem_cache_alloc(cifs_oplock_cachep, -+ SLAB_KERNEL); -+ if (temp == NULL) -+ return temp; -+ else { -+ temp->pinode = pinode; -+ temp->tcon = tcon; -+ temp->netfid = fid; -+ spin_lock(&GlobalMid_Lock); -+ list_add_tail(&temp->qhead, &GlobalOplock_Q); -+ spin_unlock(&GlobalMid_Lock); -+ } -+ return temp; -+ -+} -+ -+void DeleteOplockQEntry(struct oplock_q_entry * oplockEntry) -+{ -+ spin_lock(&GlobalMid_Lock); -+ /* should we check if list empty first? */ -+ list_del(&oplockEntry->qhead); -+ spin_unlock(&GlobalMid_Lock); -+ kmem_cache_free(cifs_oplock_cachep, oplockEntry); -+} -+ -+int -+smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer, -+ unsigned int smb_buf_length, struct sockaddr *sin) -+{ -+ int rc = 0; -+ int i = 0; -+ struct msghdr smb_msg; -+ struct iovec iov; -+ mm_segment_t temp_fs; -+ -+ if(ssocket == NULL) -+ return -ENOTSOCK; /* BB eventually add reconnect code here */ -+ iov.iov_base = smb_buffer; -+ iov.iov_len = smb_buf_length + 4; -+ -+ smb_msg.msg_name = sin; -+ smb_msg.msg_namelen = sizeof (struct sockaddr); -+ smb_msg.msg_iov = &iov; -+ smb_msg.msg_iovlen = 1; -+ smb_msg.msg_control = NULL; -+ smb_msg.msg_controllen = 0; -+ smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; /* BB add more flags?*/ -+ -+ /* smb header is converted in header_assemble. bcc and rest of SMB word -+ area, and byte area if necessary, is converted to littleendian in -+ cifssmb.c and RFC1001 len is converted to bigendian in smb_send -+ Flags2 is converted in SendReceive */ -+ -+ smb_buffer->smb_buf_length = cpu_to_be32(smb_buffer->smb_buf_length); -+ cFYI(1, ("Sending smb of length %d ", smb_buf_length)); -+ dump_smb(smb_buffer, smb_buf_length + 4); -+ -+ temp_fs = get_fs(); /* we must turn off socket api parm checking */ -+ set_fs(get_ds()); -+ while(iov.iov_len > 0) { -+ rc = sock_sendmsg(ssocket, &smb_msg, smb_buf_length + 4); -+ if ((rc == -ENOSPC) || (rc == -EAGAIN)) { -+ i++; -+ if(i > 60) { -+ cERROR(1, -+ ("sends on sock %p stuck for 30 seconds", -+ ssocket)); -+ rc = -EAGAIN; -+ break; -+ } -+ set_current_state(TASK_INTERRUPTIBLE); -+ schedule_timeout(HZ/2); -+ continue; -+ } -+ if (rc < 0) -+ break; -+ iov.iov_base += rc; -+ iov.iov_len -= rc; -+ } -+ set_fs(temp_fs); -+ -+ if (rc < 0) { -+ cERROR(1,("Error %d sending data on socket to server.", rc)); -+ } else { -+ rc = 0; -+ } -+ -+ return rc; -+} -+ -+int -+SendReceive(const unsigned int xid, struct cifsSesInfo *ses, -+ struct smb_hdr *in_buf, struct smb_hdr *out_buf, -+ int *pbytes_returned, const int long_op) -+{ -+ int rc = 0; -+ unsigned int receive_len; -+ long timeout; -+ struct mid_q_entry *midQ; -+ -+ if (ses == NULL) { -+ cERROR(1,("Null smb session")); -+ return -EIO; -+ } -+ if(ses->server == NULL) { -+ cERROR(1,("Null tcp session")); -+ return -EIO; -+ } -+ -+ /* Ensure that we do not send more than 50 overlapping requests -+ to the same server. We may make this configurable later or -+ use ses->maxReq */ -+ if(long_op == -1) { -+ /* oplock breaks must not be held up */ -+ atomic_inc(&ses->server->inFlight); -+ } else { -+ spin_lock(&GlobalMid_Lock); -+ while(1) { -+ if(atomic_read(&ses->server->inFlight) >= CIFS_MAX_REQ){ -+ spin_unlock(&GlobalMid_Lock); -+ wait_event(ses->server->request_q, -+ atomic_read(&ses->server->inFlight) -+ < CIFS_MAX_REQ); -+ spin_lock(&GlobalMid_Lock); -+ } else { -+ if(ses->server->tcpStatus == CifsExiting) { -+ spin_unlock(&GlobalMid_Lock); -+ return -ENOENT; -+ } -+ -+ /* can not count locking commands against total since -+ they are allowed to block on server */ -+ -+ if(long_op < 3) { -+ /* update # of requests on the wire to server */ -+ atomic_inc(&ses->server->inFlight); -+ } -+ spin_unlock(&GlobalMid_Lock); -+ break; -+ } -+ } -+ } -+ /* make sure that we sign in the same order that we send on this socket -+ and avoid races inside tcp sendmsg code that could cause corruption -+ of smb data */ -+ -+ down(&ses->server->tcpSem); -+ -+ if (ses->server->tcpStatus == CifsExiting) { -+ rc = -ENOENT; -+ goto out_unlock; -+ } else if (ses->server->tcpStatus == CifsNeedReconnect) { -+ cFYI(1,("tcp session dead - return to caller to retry")); -+ rc = -EAGAIN; -+ goto out_unlock; -+ } else if (ses->status != CifsGood) { -+ /* check if SMB session is bad because we are setting it up */ -+ if((in_buf->Command != SMB_COM_SESSION_SETUP_ANDX) && -+ (in_buf->Command != SMB_COM_NEGOTIATE)) { -+ rc = -EAGAIN; -+ goto out_unlock; -+ } /* else ok - we are setting up session */ -+ } -+ midQ = AllocMidQEntry(in_buf, ses); -+ if (midQ == NULL) { -+ up(&ses->server->tcpSem); -+ /* If not lock req, update # of requests on wire to server */ -+ if(long_op < 3) { -+ atomic_dec(&ses->server->inFlight); -+ wake_up(&ses->server->request_q); -+ } -+ return -ENOMEM; -+ } -+ -+ if (in_buf->smb_buf_length > CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE - 4) { -+ up(&ses->server->tcpSem); -+ cERROR(1, -+ ("Illegal length, greater than maximum frame, %d ", -+ in_buf->smb_buf_length)); -+ DeleteMidQEntry(midQ); -+ /* If not lock req, update # of requests on wire to server */ -+ if(long_op < 3) { -+ atomic_dec(&ses->server->inFlight); -+ wake_up(&ses->server->request_q); -+ } -+ return -EIO; -+ } -+ -+ if (in_buf->smb_buf_length > 12) -+ in_buf->Flags2 = cpu_to_le16(in_buf->Flags2); -+ -+ rc = cifs_sign_smb(in_buf, ses, &midQ->sequence_number); -+ -+ midQ->midState = MID_REQUEST_SUBMITTED; -+ rc = smb_send(ses->server->ssocket, in_buf, in_buf->smb_buf_length, -+ (struct sockaddr *) &(ses->server->addr.sockAddr)); -+ if(rc < 0) { -+ DeleteMidQEntry(midQ); -+ up(&ses->server->tcpSem); -+ /* If not lock req, update # of requests on wire to server */ -+ if(long_op < 3) { -+ atomic_dec(&ses->server->inFlight); -+ wake_up(&ses->server->request_q); -+ } -+ return rc; -+ } else -+ up(&ses->server->tcpSem); -+ if (long_op == -1) -+ goto cifs_no_response_exit; -+ else if (long_op == 2) /* writes past end of file can take looooong time */ -+ timeout = 300 * HZ; -+ else if (long_op == 1) -+ timeout = 45 * HZ; /* should be greater than -+ servers oplock break timeout (about 43 seconds) */ -+ else if (long_op > 2) { -+ timeout = MAX_SCHEDULE_TIMEOUT; -+ } else -+ timeout = 15 * HZ; -+ /* wait for 15 seconds or until woken up due to response arriving or -+ due to last connection to this server being unmounted */ -+ if (signal_pending(current)) { -+ /* if signal pending do not hold up user for full smb timeout -+ but we still give response a change to complete */ -+ if(midQ->midState & MID_REQUEST_SUBMITTED) { -+ set_current_state(TASK_UNINTERRUPTIBLE); -+ timeout = sleep_on_timeout(&ses->server->response_q,2 * HZ); -+ } -+ } else { /* using normal timeout */ -+ /* timeout = wait_event_interruptible_timeout(ses->server->response_q, -+ (midQ->midState & MID_RESPONSE_RECEIVED) || -+ ((ses->server->tcpStatus != CifsGood) && -+ (ses->server->tcpStatus != CifsNew)), -+ timeout); */ -+ /* Can not allow user interrupts- wreaks havoc with performance */ -+ if(midQ->midState & MID_REQUEST_SUBMITTED) { -+ set_current_state(TASK_UNINTERRUPTIBLE); -+ timeout = sleep_on_timeout(&ses->server->response_q,timeout); -+ } -+ } -+ -+ spin_lock(&GlobalMid_Lock); -+ if (midQ->resp_buf) { -+ spin_unlock(&GlobalMid_Lock); -+ receive_len = be32_to_cpu(midQ->resp_buf->smb_buf_length); -+ } else { -+ cERROR(1,("No response buffer")); -+ if(midQ->midState == MID_REQUEST_SUBMITTED) { -+ if(ses->server->tcpStatus == CifsExiting) -+ rc = -EHOSTDOWN; -+ else { -+ ses->server->tcpStatus = CifsNeedReconnect; -+ midQ->midState = MID_RETRY_NEEDED; -+ } -+ } -+ -+ if (rc != -EHOSTDOWN) { -+ if(midQ->midState == MID_RETRY_NEEDED) { -+ rc = -EAGAIN; -+ cFYI(1,("marking request for retry")); -+ } else { -+ rc = -EIO; -+ } -+ } -+ spin_unlock(&GlobalMid_Lock); -+ DeleteMidQEntry(midQ); -+ /* If not lock req, update # of requests on wire to server */ -+ if(long_op < 3) { -+ atomic_dec(&ses->server->inFlight); -+ wake_up(&ses->server->request_q); -+ } -+ return rc; -+ } -+ -+ if (receive_len > CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE) { -+ cERROR(1, -+ ("Frame too large received. Length: %d Xid: %d", -+ receive_len, xid)); -+ rc = -EIO; -+ } else { /* rcvd frame is ok */ -+ -+ if (midQ->resp_buf && out_buf -+ && (midQ->midState == MID_RESPONSE_RECEIVED)) { -+ memcpy(out_buf, midQ->resp_buf, -+ receive_len + -+ 4 /* include 4 byte RFC1001 header */ ); -+ -+ dump_smb(out_buf, 92); -+ /* convert the length into a more usable form */ -+ out_buf->smb_buf_length = -+ be32_to_cpu(out_buf->smb_buf_length); -+ if((out_buf->smb_buf_length > 24) && -+ (ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))) { -+ rc = cifs_verify_signature(out_buf, ses->mac_signing_key,midQ->sequence_number); /* BB fix BB */ -+ if(rc) -+ cFYI(1,("Unexpected signature received from server")); -+ } -+ -+ if (out_buf->smb_buf_length > 12) -+ out_buf->Flags2 = le16_to_cpu(out_buf->Flags2); -+ if (out_buf->smb_buf_length > 28) -+ out_buf->Pid = le16_to_cpu(out_buf->Pid); -+ if (out_buf->smb_buf_length > 28) -+ out_buf->PidHigh = -+ le16_to_cpu(out_buf->PidHigh); -+ -+ *pbytes_returned = out_buf->smb_buf_length; -+ -+ /* BB special case reconnect tid and reconnect uid here? */ -+ rc = map_smb_to_linux_error(out_buf); -+ -+ /* convert ByteCount if necessary */ -+ if (receive_len >= -+ sizeof (struct smb_hdr) - -+ 4 /* do not count RFC1001 header */ + -+ (2 * out_buf->WordCount) + 2 /* bcc */ ) -+ BCC(out_buf) = le16_to_cpu(BCC(out_buf)); -+ } else { -+ rc = -EIO; -+ cFYI(1,("Bad MID state? ")); -+ } -+ } -+cifs_no_response_exit: -+ DeleteMidQEntry(midQ); -+ -+ if(long_op < 3) { -+ atomic_dec(&ses->server->inFlight); -+ wake_up(&ses->server->request_q); -+ } -+ -+ return rc; -+ -+out_unlock: -+ up(&ses->server->tcpSem); -+ /* If not lock req, update # of requests on wire to server */ -+ if(long_op < 3) { -+ atomic_dec(&ses->server->inFlight); -+ wake_up(&ses->server->request_q); -+ } -+ -+ return rc; -+} -diff -urN linux-2.4.29.old/fs/Config.in linux-2.4.29/fs/Config.in ---- linux-2.4.29.old/fs/Config.in 2005-03-21 19:30:22.000000000 +0100 -+++ linux-2.4.29/fs/Config.in 2005-03-21 19:36:51.000000000 +0100 -@@ -146,6 +146,10 @@ - define_bool CONFIG_LOCKD_V4 y - fi - -+ dep_tristate 'CIFS support (advanced network filesystem for Samba, Window and other CIFS compliant servers)' CONFIG_CIFS $CONFIG_INET -+ dep_mbool ' CIFS statistics' CONFIG_CIFS_STATS $CONFIG_CIFS -+ dep_mbool ' CIFS POSIX Protocol Extensions' CONFIG_CIFS_POSIX $CONFIG_CIFS -+ - dep_tristate 'SMB file system support (to mount Windows shares etc.)' CONFIG_SMB_FS $CONFIG_INET - if [ "$CONFIG_SMB_FS" != "n" ]; then - bool ' Use a default NLS' CONFIG_SMB_NLS_DEFAULT -diff -urN linux-2.4.29.old/fs/Makefile linux-2.4.29/fs/Makefile ---- linux-2.4.29.old/fs/Makefile 2005-03-21 19:30:22.000000000 +0100 -+++ linux-2.4.29/fs/Makefile 2005-03-21 19:36:51.000000000 +0100 -@@ -37,6 +37,7 @@ - subdir-$(CONFIG_VFAT_FS) += vfat - subdir-$(CONFIG_BFS_FS) += bfs - subdir-$(CONFIG_ISO9660_FS) += isofs -+subdir-$(CONFIG_CIFS) += cifs - subdir-$(CONFIG_DEVFS_FS) += devfs - subdir-$(CONFIG_HFSPLUS_FS) += hfsplus # Before hfs to find wrapped HFS+ - subdir-$(CONFIG_HFS_FS) += hfs -diff -urN linux-2.4.29.old/fs/nls/Config.in linux-2.4.29/fs/nls/Config.in ---- linux-2.4.29.old/fs/nls/Config.in 2003-08-25 13:44:43.000000000 +0200 -+++ linux-2.4.29/fs/nls/Config.in 2005-03-21 19:36:51.000000000 +0100 -@@ -11,6 +11,7 @@ - - # msdos and Joliet want NLS - if [ "$CONFIG_JOLIET" = "y" -o "$CONFIG_FAT_FS" != "n" \ -+ -o "$CONFIG_CIFS" != "n" \ - -o "$CONFIG_NTFS_FS" != "n" -o "$CONFIG_NCPFS_NLS" = "y" \ - -o "$CONFIG_SMB_NLS" = "y" -o "$CONFIG_JFS_FS" != "n" \ - -o "$CONFIG_BEFS_FS" != "n" -o "$CONFIG_HFSPLUS_FS" != "n" ]; then diff --git a/openwrt/package/linux/kernel-patches/309-drivers_net_b44_c.patch b/openwrt/package/linux/kernel-patches/309-drivers_net_b44_c.patch deleted file mode 100644 index 2794706260..0000000000 --- a/openwrt/package/linux/kernel-patches/309-drivers_net_b44_c.patch +++ /dev/null @@ -1,272 +0,0 @@ ---- linux-2.4.30/drivers/net/b44.c 2004-08-08 01:26:05.000000000 +0200 -+++ openwrt/build_mipsel/linux-2.4.30/drivers/net/b44.c 2005-05-01 20:10:19.193354917 +0200 -@@ -1,7 +1,8 @@ - /* b44.c: Broadcom 4400 device driver. - * - * Copyright (C) 2002 David S. Miller (davem@redhat.com) -- * Fixed by Pekka Pietikainen (pp@ee.oulu.fi) -+ * Copyright (C) 2004 Pekka Pietikainen (pp@ee.oulu.fi) -+ * Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org) - * - * Distribute under GPL. - */ -@@ -25,6 +26,16 @@ - - #include "b44.h" - -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ - #define DRV_MODULE_NAME "b44" - #define PFX DRV_MODULE_NAME ": " - #define DRV_MODULE_VERSION "0.93" -@@ -75,7 +86,7 @@ - DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; - - MODULE_AUTHOR("David S. Miller (davem@redhat.com)"); --MODULE_DESCRIPTION("Broadcom 4400 10/100 PCI ethernet driver"); -+MODULE_DESCRIPTION("Broadcom 4400/47xx 10/100 PCI ethernet driver"); - MODULE_LICENSE("GPL"); - MODULE_PARM(b44_debug, "i"); - MODULE_PARM_DESC(b44_debug, "B44 bitmapped debugging message enable value"); -@@ -89,6 +100,8 @@ - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, - { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4401B1, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, -+ { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4713, -+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, - { } /* terminate list with empty entry */ - }; - -@@ -236,6 +249,8 @@ - udelay(1); - } - -+static int b44_4713_instance; -+ - static int ssb_core_unit(struct b44 *bp) - { - #if 0 -@@ -258,6 +273,9 @@ - break; - }; - #endif -+ if (bp->pdev->device == PCI_DEVICE_ID_BCM4713) -+ return b44_4713_instance++; -+ else - return 0; - } - -@@ -267,6 +285,28 @@ - == SBTMSLOW_CLOCK); - } - -+static void __b44_cam_read(struct b44 *bp, unsigned char *data, int index) -+{ -+ u32 val; -+ -+ bw32(B44_CAM_CTRL, (CAM_CTRL_READ | -+ (index << CAM_CTRL_INDEX_SHIFT))); -+ -+ b44_wait_bit(bp, B44_CAM_CTRL, CAM_CTRL_BUSY, 100, 1); -+ -+ val = br32(B44_CAM_DATA_LO); -+ -+ data[2] = (val >> 24) & 0xFF; -+ data[3] = (val >> 16) & 0xFF; -+ data[4] = (val >> 8) & 0xFF; -+ data[5] = (val >> 0) & 0xFF; -+ -+ val = br32(B44_CAM_DATA_HI); -+ -+ data[0] = (val >> 8) & 0xFF; -+ data[1] = (val >> 0) & 0xFF; -+} -+ - static void __b44_cam_write(struct b44 *bp, unsigned char *data, int index) - { - u32 val; -@@ -307,6 +347,9 @@ - { - int err; - -+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY) -+ return 0; -+ - bw32(B44_EMAC_ISTAT, EMAC_INT_MII); - bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START | - (MDIO_OP_READ << MDIO_DATA_OP_SHIFT) | -@@ -321,6 +364,9 @@ - - static int b44_writephy(struct b44 *bp, int reg, u32 val) - { -+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY) -+ return 0; -+ - bw32(B44_EMAC_ISTAT, EMAC_INT_MII); - bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START | - (MDIO_OP_WRITE << MDIO_DATA_OP_SHIFT) | -@@ -336,6 +382,9 @@ - u32 val; - int err; - -+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY) -+ return 0; -+ - err = b44_writephy(bp, MII_BMCR, BMCR_RESET); - if (err) - return err; -@@ -406,6 +455,9 @@ - u32 val; - int err; - -+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY) -+ return 0; -+ - if ((err = b44_readphy(bp, B44_MII_ALEDCTRL, &val)) != 0) - goto out; - if ((err = b44_writephy(bp, B44_MII_ALEDCTRL, -@@ -498,6 +550,19 @@ - { - u32 bmsr, aux; - -+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY) { -+ bp->flags |= B44_FLAG_100_BASE_T; -+ bp->flags |= B44_FLAG_FULL_DUPLEX; -+ if (!netif_carrier_ok(bp->dev)) { -+ u32 val = br32(B44_TX_CTRL); -+ val |= TX_CTRL_DUPLEX; -+ bw32(B44_TX_CTRL, val); -+ netif_carrier_on(bp->dev); -+ b44_link_report(bp); -+ } -+ return; -+ } -+ - if (!b44_readphy(bp, MII_BMSR, &bmsr) && - !b44_readphy(bp, B44_MII_AUXCTRL, &aux) && - (bmsr != 0xffff)) { -@@ -1092,6 +1157,8 @@ - /* bp->lock is held. */ - static void b44_chip_reset(struct b44 *bp) - { -+ unsigned int sb_clock; -+ - if (ssb_is_core_up(bp)) { - bw32(B44_RCV_LAZY, 0); - bw32(B44_ENET_CTRL, ENET_CTRL_DISABLE); -@@ -1105,9 +1172,10 @@ - bw32(B44_DMARX_CTRL, 0); - bp->rx_prod = bp->rx_cons = 0; - } else { -- ssb_pci_setup(bp, (bp->core_unit == 0 ? -- SBINTVEC_ENET0 : -- SBINTVEC_ENET1)); -+ /*if (bp->pdev->device != PCI_DEVICE_ID_BCM4713)*/ -+ ssb_pci_setup(bp, (bp->core_unit == 0 ? -+ SBINTVEC_ENET0 : -+ SBINTVEC_ENET1)); - } - - ssb_core_reset(bp); -@@ -1115,6 +1183,11 @@ - b44_clear_stats(bp); - - /* Make PHY accessible. */ -+ if (bp->pdev->device == PCI_DEVICE_ID_BCM4713) -+ sb_clock = 100000000; /* 100 MHz */ -+ else -+ sb_clock = 62500000; /* 62.5 MHz */ -+ - bw32(B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE | - (0x0d & MDIO_CTRL_MAXF_MASK))); - br32(B44_MDIO_CTRL); -@@ -1669,20 +1742,42 @@ - { - u8 eeprom[128]; - int err; -+ unsigned long flags; - -- err = b44_read_eeprom(bp, &eeprom[0]); -- if (err) -- goto out; -- -- bp->dev->dev_addr[0] = eeprom[79]; -- bp->dev->dev_addr[1] = eeprom[78]; -- bp->dev->dev_addr[2] = eeprom[81]; -- bp->dev->dev_addr[3] = eeprom[80]; -- bp->dev->dev_addr[4] = eeprom[83]; -- bp->dev->dev_addr[5] = eeprom[82]; -- -- bp->phy_addr = eeprom[90] & 0x1f; -- bp->mdc_port = (eeprom[90] >> 14) & 0x1; -+ if (bp->pdev->device == PCI_DEVICE_ID_BCM4713) { -+ /* -+ * BCM47xx boards don't have a EEPROM. The MAC is stored in -+ * a NVRAM area somewhere in the flash memory. As we don't -+ * know the location and/or the format of the NVRAM area -+ * here, we simply rely on the bootloader to write the -+ * MAC into the CAM. -+ */ -+ spin_lock_irqsave(&bp->lock, flags); -+ __b44_cam_read(bp, bp->dev->dev_addr, 0); -+ spin_unlock_irqrestore(&bp->lock, flags); -+ -+ /* -+ * BCM47xx boards don't have a PHY. Usually there is a switch -+ * chip with multiple PHYs connected to the PHY port. -+ */ -+ bp->phy_addr = B44_PHY_ADDR_NO_PHY; -+ bp->dma_offset = 0; -+ } else { -+ err = b44_read_eeprom(bp, &eeprom[0]); -+ if (err) -+ return err; -+ -+ bp->dev->dev_addr[0] = eeprom[79]; -+ bp->dev->dev_addr[1] = eeprom[78]; -+ bp->dev->dev_addr[2] = eeprom[81]; -+ bp->dev->dev_addr[3] = eeprom[80]; -+ bp->dev->dev_addr[4] = eeprom[83]; -+ bp->dev->dev_addr[5] = eeprom[82]; -+ -+ bp->phy_addr = eeprom[90] & 0x1f; -+ bp->dma_offset = SB_PCI_DMA; -+ bp->mdc_port = (eeprom[90] >> 14) & 0x1; -+ } - - /* With this, plus the rx_header prepended to the data by the - * hardware, we'll land the ethernet header on a 2-byte boundary. -@@ -1692,13 +1787,12 @@ - bp->imask = IMASK_DEF; - - bp->core_unit = ssb_core_unit(bp); -- bp->dma_offset = ssb_get_addr(bp, SBID_PCI_DMA, 0); - - /* XXX - really required? - bp->flags |= B44_FLAG_BUGGY_TXPTR; - */ --out: -- return err; -+ -+ return 0; - } - - static int __devinit b44_init_one(struct pci_dev *pdev, -@@ -1819,7 +1913,8 @@ - - pci_save_state(bp->pdev, bp->pci_cfg_state); - -- printk(KERN_INFO "%s: Broadcom 4400 10/100BaseT Ethernet ", dev->name); -+ printk(KERN_INFO "%s: Broadcom %s 10/100BaseT Ethernet ", dev->name, -+ (pdev->device == PCI_DEVICE_ID_BCM4713) ? "47xx" : "4400"); - for (i = 0; i < 6; i++) - printk("%2.2x%c", dev->dev_addr[i], - i == 5 ? '\n' : ':'); diff --git a/openwrt/package/linux/kernel-patches/310-netfilter-maxconn b/openwrt/package/linux/kernel-patches/310-netfilter-maxconn deleted file mode 100644 index 87be89d72f..0000000000 --- a/openwrt/package/linux/kernel-patches/310-netfilter-maxconn +++ /dev/null @@ -1,20 +0,0 @@ ---- ../../buildroot-unpacked/build_mipsel/linux/net/ipv4/netfilter/ip_conntrack_core.c 2004-11-28 22:59:36.000000000 -0500 -+++ linux/net/ipv4/netfilter/ip_conntrack_core.c 2004-11-30 05:05:32.000000000 -0500 -@@ -1386,7 +1386,7 @@ - nf_unregister_sockopt(&so_getorigdst); - } - --static int hashsize = 0; -+static int hashsize = 5953 - MODULE_PARM(hashsize, "i"); - - int __init ip_conntrack_init(void) -@@ -1407,7 +1407,7 @@ - if (ip_conntrack_htable_size < 16) - ip_conntrack_htable_size = 16; - } -- ip_conntrack_max = 8 * ip_conntrack_htable_size; -+ ip_conntrack_max = ip_conntrack_htable_size; - - printk("ip_conntrack version %s (%u buckets, %d max)" - " - %Zd bytes per conntrack\n", IP_CONNTRACK_VERSION, diff --git a/openwrt/package/linux/kernel-patches/312-netfilter-TTL b/openwrt/package/linux/kernel-patches/312-netfilter-TTL deleted file mode 100644 index f630f61e38..0000000000 --- a/openwrt/package/linux/kernel-patches/312-netfilter-TTL +++ /dev/null @@ -1,180 +0,0 @@ -diff -urN linux-2.4.30.old/Documentation/Configure.help linux-2.4.30.dev/Documentation/Configure.help ---- linux-2.4.30.old/Documentation/Configure.help 2005-04-27 11:35:46.000000000 +0200 -+++ linux-2.4.30.dev/Documentation/Configure.help 2005-04-27 11:43:49.000000000 +0200 -@@ -3209,6 +3209,15 @@ - If you want to compile it as a module, say M here and read - . If unsure, say `N'. - -+TTL target support -+CONFIG_IP_NF_TARGET_TTL -+ This option adds a `TTL' target, which enables the user to set -+ the TTL value or increment / decrement the TTL value by a given -+ amount. -+ -+ If you want to compile it as a module, say M here and read -+ Documentation/modules.txt. If unsure, say `N'. -+ - ipchains (2.2-style) support - CONFIG_IP_NF_COMPAT_IPCHAINS - This option places ipchains (with masquerading and redirection -diff -urN linux-2.4.30.old/include/linux/netfilter_ipv4/ipt_TTL.h linux-2.4.30.dev/include/linux/netfilter_ipv4/ipt_TTL.h ---- linux-2.4.30.old/include/linux/netfilter_ipv4/ipt_TTL.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30.dev/include/linux/netfilter_ipv4/ipt_TTL.h 2005-04-27 11:43:49.000000000 +0200 -@@ -0,0 +1,21 @@ -+/* TTL modification module for IP tables -+ * (C) 2000 by Harald Welte */ -+ -+#ifndef _IPT_TTL_H -+#define _IPT_TTL_H -+ -+enum { -+ IPT_TTL_SET = 0, -+ IPT_TTL_INC, -+ IPT_TTL_DEC -+}; -+ -+#define IPT_TTL_MAXMODE IPT_TTL_DEC -+ -+struct ipt_TTL_info { -+ u_int8_t mode; -+ u_int8_t ttl; -+}; -+ -+ -+#endif -diff -urN linux-2.4.30.old/net/ipv4/netfilter/Config.in linux-2.4.30.dev/net/ipv4/netfilter/Config.in ---- linux-2.4.30.old/net/ipv4/netfilter/Config.in 2005-04-27 11:35:45.000000000 +0200 -+++ linux-2.4.30.dev/net/ipv4/netfilter/Config.in 2005-04-27 11:43:49.000000000 +0200 -@@ -129,6 +129,7 @@ - dep_tristate ' MARK target support' CONFIG_IP_NF_TARGET_MARK $CONFIG_IP_NF_MANGLE - fi - dep_tristate ' LOG target support' CONFIG_IP_NF_TARGET_LOG $CONFIG_IP_NF_IPTABLES -+ dep_tristate ' TTL target support' CONFIG_IP_NF_TARGET_TTL $CONFIG_IP_NF_IPTABLES - dep_tristate ' ULOG target support' CONFIG_IP_NF_TARGET_ULOG $CONFIG_IP_NF_IPTABLES - dep_tristate ' TCPMSS target support' CONFIG_IP_NF_TARGET_TCPMSS $CONFIG_IP_NF_IPTABLES - fi -diff -urN linux-2.4.30.old/net/ipv4/netfilter/ipt_TTL.c linux-2.4.30.dev/net/ipv4/netfilter/ipt_TTL.c ---- linux-2.4.30.old/net/ipv4/netfilter/ipt_TTL.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30.dev/net/ipv4/netfilter/ipt_TTL.c 2005-04-27 11:43:49.000000000 +0200 -@@ -0,0 +1,110 @@ -+/* TTL modification target for IP tables -+ * (C) 2000 by Harald Welte -+ * -+ * Version: $Revision$ -+ * -+ * This software is distributed under the terms of GNU GPL -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+MODULE_AUTHOR("Harald Welte "); -+MODULE_DESCRIPTION("IP tables TTL modification module"); -+MODULE_LICENSE("GPL"); -+ -+static unsigned int ipt_ttl_target(struct sk_buff **pskb, unsigned int hooknum, -+ const struct net_device *in, const struct net_device *out, -+ const void *targinfo, void *userinfo) -+{ -+ struct iphdr *iph = (*pskb)->nh.iph; -+ const struct ipt_TTL_info *info = targinfo; -+ u_int16_t diffs[2]; -+ int new_ttl; -+ -+ switch (info->mode) { -+ case IPT_TTL_SET: -+ new_ttl = info->ttl; -+ break; -+ case IPT_TTL_INC: -+ new_ttl = iph->ttl + info->ttl; -+ if (new_ttl > 255) -+ new_ttl = 255; -+ break; -+ case IPT_TTL_DEC: -+ new_ttl = iph->ttl - info->ttl; -+ if (new_ttl < 0) -+ new_ttl = 0; -+ break; -+ default: -+ new_ttl = iph->ttl; -+ break; -+ } -+ -+ if (new_ttl != iph->ttl) { -+ diffs[0] = htons(((unsigned)iph->ttl) << 8) ^ 0xFFFF; -+ iph->ttl = new_ttl; -+ diffs[1] = htons(((unsigned)iph->ttl) << 8); -+ iph->check = csum_fold(csum_partial((char *)diffs, -+ sizeof(diffs), -+ iph->check^0xFFFF)); -+ (*pskb)->nfcache |= NFC_ALTERED; -+ } -+ -+ return IPT_CONTINUE; -+} -+ -+static int ipt_ttl_checkentry(const char *tablename, -+ const struct ipt_entry *e, -+ void *targinfo, -+ unsigned int targinfosize, -+ unsigned int hook_mask) -+{ -+ struct ipt_TTL_info *info = targinfo; -+ -+ if (targinfosize != IPT_ALIGN(sizeof(struct ipt_TTL_info))) { -+ printk(KERN_WARNING "TTL: targinfosize %u != %Zu\n", -+ targinfosize, -+ IPT_ALIGN(sizeof(struct ipt_TTL_info))); -+ return 0; -+ } -+ -+ if (strcmp(tablename, "mangle")) { -+ printk(KERN_WARNING "TTL: can only be called from \"mangle\" table, not \"%s\"\n", tablename); -+ return 0; -+ } -+ -+ if (info->mode > IPT_TTL_MAXMODE) { -+ printk(KERN_WARNING "TTL: invalid or unknown Mode %u\n", -+ info->mode); -+ return 0; -+ } -+ -+ if ((info->mode != IPT_TTL_SET) && (info->ttl == 0)) { -+ printk(KERN_WARNING "TTL: increment/decrement doesn't make sense with value 0\n"); -+ return 0; -+ } -+ -+ return 1; -+} -+ -+static struct ipt_target ipt_TTL = { { NULL, NULL }, "TTL", -+ ipt_ttl_target, ipt_ttl_checkentry, NULL, THIS_MODULE }; -+ -+static int __init init(void) -+{ -+ return ipt_register_target(&ipt_TTL); -+} -+ -+static void __exit fini(void) -+{ -+ ipt_unregister_target(&ipt_TTL); -+} -+ -+module_init(init); -+module_exit(fini); -diff -urN linux-2.4.30.old/net/ipv4/netfilter/Makefile linux-2.4.30.dev/net/ipv4/netfilter/Makefile ---- linux-2.4.30.old/net/ipv4/netfilter/Makefile 2005-04-27 11:35:45.000000000 +0200 -+++ linux-2.4.30.dev/net/ipv4/netfilter/Makefile 2005-04-27 11:43:49.000000000 +0200 -@@ -112,6 +112,7 @@ - obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o - obj-$(CONFIG_IP_NF_NAT_SNMP_BASIC) += ip_nat_snmp_basic.o - obj-$(CONFIG_IP_NF_TARGET_LOG) += ipt_LOG.o -+obj-$(CONFIG_IP_NF_TARGET_TTL) += ipt_TTL.o - obj-$(CONFIG_IP_NF_TARGET_ULOG) += ipt_ULOG.o - obj-$(CONFIG_IP_NF_TARGET_TCPMSS) += ipt_TCPMSS.o - diff --git a/openwrt/package/linux/kernel-patches/314-drivers_net_b44_h.patch b/openwrt/package/linux/kernel-patches/314-drivers_net_b44_h.patch deleted file mode 100644 index 992c66ef89..0000000000 --- a/openwrt/package/linux/kernel-patches/314-drivers_net_b44_h.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- linux-2.4.30/drivers/net/b44.h 2003-08-25 13:44:42.000000000 +0200 -+++ openwrt/build_mipsel/linux-2.4.30/drivers/net/b44.h 2005-05-01 14:43:20.000000000 +0200 -@@ -461,6 +461,8 @@ - }; - - #define B44_MCAST_TABLE_SIZE 32 -+#define B44_PHY_ADDR_NO_PHY 30 -+#define B44_MDC_RATIO 5000000 - - /* SW copy of device statistics, kept up to date by periodic timer - * which probes HW values. Must have same relative layout as HW diff --git a/openwrt/package/linux/kernel-patches/315-include_linux_pci_ids_h.patch b/openwrt/package/linux/kernel-patches/315-include_linux_pci_ids_h.patch deleted file mode 100644 index 88e56979f3..0000000000 --- a/openwrt/package/linux/kernel-patches/315-include_linux_pci_ids_h.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- linux-2.4.30/include/linux/pci_ids.h 2005-04-04 03:42:20.000000000 +0200 -+++ openwrt/build_mipsel/linux-2.4.30/include/linux/pci_ids.h 2005-05-01 14:43:20.000000000 +0200 -@@ -1735,6 +1735,7 @@ - #define PCI_DEVICE_ID_TIGON3_5901_2 0x170e - #define PCI_DEVICE_ID_BCM4401 0x4401 - #define PCI_DEVICE_ID_BCM4401B0 0x4402 -+#define PCI_DEVICE_ID_BCM4713 0x4713 - - #define PCI_VENDOR_ID_ENE 0x1524 - #define PCI_DEVICE_ID_ENE_1211 0x1211 diff --git a/openwrt/package/linux/kernel-patches/316-b44_mii_phy.patch b/openwrt/package/linux/kernel-patches/316-b44_mii_phy.patch deleted file mode 100644 index 524f7eda31..0000000000 --- a/openwrt/package/linux/kernel-patches/316-b44_mii_phy.patch +++ /dev/null @@ -1,89 +0,0 @@ ---- linux-2.4.30.old/drivers/net/b44.c 2005-05-01 23:30:22.000000000 +0400 -+++ linux-2.4.30/drivers/net/b44.c 2005-05-10 16:51:24.410654488 +0400 -@@ -343,17 +343,14 @@ - bw32(B44_IMASK, bp->imask); - } - --static int b44_readphy(struct b44 *bp, int reg, u32 *val) -+static int __b44_readphy(struct b44 *bp, int phy_addr, int reg, u32 *val) - { - int err; - -- if (bp->phy_addr == B44_PHY_ADDR_NO_PHY) -- return 0; -- - bw32(B44_EMAC_ISTAT, EMAC_INT_MII); - bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START | - (MDIO_OP_READ << MDIO_DATA_OP_SHIFT) | -- (bp->phy_addr << MDIO_DATA_PMD_SHIFT) | -+ (phy_addr << MDIO_DATA_PMD_SHIFT) | - (reg << MDIO_DATA_RA_SHIFT) | - (MDIO_TA_VALID << MDIO_DATA_TA_SHIFT))); - err = b44_wait_bit(bp, B44_EMAC_ISTAT, EMAC_INT_MII, 100, 0); -@@ -362,21 +359,34 @@ - return err; - } - --static int b44_writephy(struct b44 *bp, int reg, u32 val) -+static int b44_readphy(struct b44 *bp, int reg, u32 *val) - { - if (bp->phy_addr == B44_PHY_ADDR_NO_PHY) - return 0; - -+ return __b44_readphy(bp, bp->phy_addr, reg, val); -+} -+ -+static int __b44_writephy(struct b44 *bp, int phy_addr, int reg, u32 val) -+{ - bw32(B44_EMAC_ISTAT, EMAC_INT_MII); - bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START | - (MDIO_OP_WRITE << MDIO_DATA_OP_SHIFT) | -- (bp->phy_addr << MDIO_DATA_PMD_SHIFT) | -+ (phy_addr << MDIO_DATA_PMD_SHIFT) | - (reg << MDIO_DATA_RA_SHIFT) | - (MDIO_TA_VALID << MDIO_DATA_TA_SHIFT) | - (val & MDIO_DATA_DATA))); - return b44_wait_bit(bp, B44_EMAC_ISTAT, EMAC_INT_MII, 100, 0); - } - -+static int b44_writephy(struct b44 *bp, int reg, u32 val) -+{ -+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY) -+ return 0; -+ -+ return __b44_writephy(bp, bp->phy_addr, reg, val); -+} -+ - static int b44_phy_reset(struct b44 *bp) - { - u32 val; -@@ -1701,7 +1711,7 @@ - u32 mii_regval; - - spin_lock_irq(&bp->lock); -- err = b44_readphy(bp, data->reg_num & 0x1f, &mii_regval); -+ err = __b44_readphy(bp, data->phy_id & 0x1f, data->reg_num & 0x1f, &mii_regval); - spin_unlock_irq(&bp->lock); - - data->val_out = mii_regval; -@@ -1714,7 +1724,7 @@ - return -EPERM; - - spin_lock_irq(&bp->lock); -- err = b44_writephy(bp, data->reg_num & 0x1f, data->val_in); -+ err = __b44_writephy(bp, data->phy_id & 0x1f, data->reg_num & 0x1f, data->val_in); - spin_unlock_irq(&bp->lock); - - return err; -@@ -1919,6 +1929,11 @@ - printk("%2.2x%c", dev->dev_addr[i], - i == 5 ? '\n' : ':'); - -+ /* Initialize phy */ -+ spin_lock_irq(&bp->lock); -+ b44_chip_reset(bp); -+ spin_unlock_irq(&bp->lock); -+ - return 0; - - err_out_iounmap: diff --git a/openwrt/package/linux/kernel-patches/400-i4l-cvs-2-4-29 b/openwrt/package/linux/kernel-patches/400-i4l-cvs-2-4-29 deleted file mode 100644 index c9833e2a30..0000000000 --- a/openwrt/package/linux/kernel-patches/400-i4l-cvs-2-4-29 +++ /dev/null @@ -1,20247 +0,0 @@ -diff -rNu linux-2.4.29.old/Documentation/isdn/CREDITS linux-2.4.29/Documentation/isdn/CREDITS ---- linux-2.4.29.old/Documentation/isdn/CREDITS 2005-03-22 14:48:26.000000000 +0100 -+++ linux-2.4.29/Documentation/isdn/CREDITS 2005-03-22 15:06:50.246454160 +0100 -@@ -37,7 +37,7 @@ - Andreas Kool (akool@Kool.f.EUnet.de) - For contribution of the isdnlog/isdnrep-tool - --Pedro Roque Marques (pedro_m@yahoo.com) -+Pedro Roque Marques (roque@di.fc.ul.pt) - For lot of new ideas and the pcbit driver. - - Eberhard Moenkeberg (emoenke@gwdg.de) -diff -rNu linux-2.4.29.old/Documentation/isdn/HiSax.cert linux-2.4.29/Documentation/isdn/HiSax.cert ---- linux-2.4.29.old/Documentation/isdn/HiSax.cert 2005-03-22 14:48:26.000000000 +0100 -+++ linux-2.4.29/Documentation/isdn/HiSax.cert 2005-03-22 15:06:50.264451424 +0100 -@@ -68,6 +68,8 @@ - drivers/isdn/hisax/elsa.c - drivers/isdn/hisax/diva.c - drivers/isdn/hisax/hfc_pci.c -+drivers/isdn/hisax/hfc_usbr.c -+drivers/isdn/hisax/hfc_usb.c - - Please send any changes, bugfixes and patches to me rather than implementing - them directly into the HiSax sources. -diff -rNu linux-2.4.29.old/Documentation/isdn/INTERFACE linux-2.4.29/Documentation/isdn/INTERFACE ---- linux-2.4.29.old/Documentation/isdn/INTERFACE 2005-03-22 14:48:26.000000000 +0100 -+++ linux-2.4.29/Documentation/isdn/INTERFACE 2005-03-22 15:06:50.288447776 +0100 -@@ -1,4 +1,4 @@ --$Id: INTERFACE,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $ -+$Id: INTERFACE,v 1.17 2002/01/31 13:26:35 keil Exp $ - - Description of the Interface between Linklevel and Hardwarelevel - of isdn4linux: -@@ -399,7 +399,7 @@ - protocol-Id is one of the constants ISDN_PROTO_L3... - parm.fax = Pointer to T30_s fax struct. (fax usage only) - -- ISDN_CMD_GETL2: (currently unused) -+ ISDN_CMD_GETL3: (currently unused) - - With this command, the HL-driver is told to return the current - setting of the Layer-3-protocol. -@@ -781,3 +781,22 @@ - arg = channel-number, locally to the driver. (starting with 0) - parm = unused. - -+ ISDN_STAT_ALERT: -+ -+ With this call, the HL-driver signals the receive of an ALERTING message to the LL. -+ -+ Parameter: -+ driver = driver-Id -+ command = ISDN_STAT_ALERT -+ arg = channel-number, locally to the driver. (starting with 0) -+ -+ ISDN_STAT_PROCEED: -+ -+ With this call, the HL-driver signals the receive of an CALL PROCEEDING message -+ to the LL. -+ -+ Parameter: -+ driver = driver-Id -+ command = ISDN_STAT_PROCEED -+ arg = channel-number, locally to the driver. (starting with 0) -+ -diff -rNu linux-2.4.29.old/Documentation/isdn/INTERFACE.fax linux-2.4.29/Documentation/isdn/INTERFACE.fax ---- linux-2.4.29.old/Documentation/isdn/INTERFACE.fax 2005-03-22 14:48:26.000000000 +0100 -+++ linux-2.4.29/Documentation/isdn/INTERFACE.fax 2005-03-22 15:06:50.312444128 +0100 -@@ -1,4 +1,4 @@ --$Id: INTERFACE.fax,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $ -+$Id: INTERFACE.fax,v 1.2 2000/08/06 09:22:50 armin Exp $ - - - Description of the fax-subinterface between linklevel and hardwarelevel of -diff -rNu linux-2.4.29.old/Documentation/isdn/README linux-2.4.29/Documentation/isdn/README ---- linux-2.4.29.old/Documentation/isdn/README 2005-03-22 14:48:26.000000000 +0100 -+++ linux-2.4.29/Documentation/isdn/README 2005-03-22 15:06:50.340439872 +0100 -@@ -278,6 +278,12 @@ - 1 = Add CPN to FCON message on - Bit 2: 0 = Add CDN to RING/FCON message off - 1 = Add CDN to RING/FCON message on -+ Bit 3: 0 = Do not signal RINGING -+ 1 = Signal RINGING if ALERT was received -+ Bit 4: 0 = Do not signal PROCEEDING -+ 1 = Signal PROCEEDING if CALL PROCEEDING -+ was received -+ - - Last but not least a (at the moment fairly primitive) device to request - the line-status (/dev/isdninfo) is made available. -diff -rNu linux-2.4.29.old/Documentation/isdn/README.HiSax linux-2.4.29/Documentation/isdn/README.HiSax ---- linux-2.4.29.old/Documentation/isdn/README.HiSax 2005-03-22 14:48:26.000000000 +0100 -+++ linux-2.4.29/Documentation/isdn/README.HiSax 2005-03-22 15:06:50.372435008 +0100 -@@ -41,10 +41,9 @@ - ELSA Quickstep 3000PCI - ELSA PCMCIA - ITK ix1-micro Rev.2 --Eicon Diva 2.0 ISA and PCI (S0 and U interface, no PRO version) --Eicon Diva 2.01 ISA and PCI --Eicon Diva 2.02 PCI --Eicon Diva Piccola -+Eicon.Diehl Diva 2.0 ISA and PCI (S0 and U interface, no PRO version) -+Eicon.Diehl Diva 2.01 ISA and PCI -+Eicon.Diehl Diva Piccola - ASUSCOM NETWORK INC. ISDNLink 128K PC adapter (order code I-IN100-ST-D) - Dynalink IS64PH (OEM version of ASUSCOM NETWORK INC. ISDNLink 128K adapter) - PCBIT-DP (OEM version of ASUSCOM NETWORK INC. ISDNLink) -@@ -53,7 +52,6 @@ - Sedlbauer Speed Star/Speed Star2 (PCMCIA) - Sedlbauer ISDN-Controller PC/104 - USR Sportster internal TA (compatible Stollmann tina-pp V3) --USR internal TA PCI - ith Kommunikationstechnik GmbH MIC 16 ISA card - Traverse Technologie NETjet PCI S0 card and NETspider U card - Ovislink ISDN sc100-p card (NETjet driver) -@@ -68,14 +66,14 @@ - HFC-PCI based cards - Winbond W6692 based cards - HFC-S+, HFC-SP/PCMCIA cards --formula-n enternow --Gerdes Power ISDN -+HFC-USB ISDN TAs - - Note: PCF, PCF-Pro: up to now, only the ISDN part is supported - PCC-8: not tested yet - Eicon.Diehl Diva U interface not tested - - If you know other passive cards with the Siemens chipset, please let me know. -+To use the PNP cards you need the isapnptools. - You can combine any card, if there is no conflict between the resources - (io, mem, irq). - -@@ -91,15 +89,8 @@ - modules. It is included in the normal "make [menu]config" target at the - kernel. Don't forget it, especially to select the right D-channel protocol. - --Please note: In older versions of the HiSax driver, all PnP cards --needed to be configured with isapnp and worked only with the HiSax --driver used as a module. -- --In the current version, HiSax will automatically use the in-kernel --ISAPnP support, provided you selected it during kernel configuration --(CONFIG_ISAPNP), if you don't give the io=, irq= command line parameters. -- --The affected card types are: 4,7,12,14,19,27-30 -+Please note: All PnP cards need to be configured with isapnp and will work -+only with the HiSax driver used as a module. - - a) when built as a module - ------------------------- -@@ -200,8 +191,6 @@ - 37 HFC 2BDS0 S+, SP irq,io - 38 NETspider U PCI card none - 39 HFC 2BDS0 SP/PCMCIA irq,io (set with cardmgr) -- 40 hotplug interface -- 41 Formula-n enter:now PCI none - - At the moment IRQ sharing is only possible with PCI cards. Please make sure - that your IRQ is free and enabled for ISA use. -@@ -227,13 +216,6 @@ - (IO 1 (BASE 0x0180)) - modprobe hisax type=4 protocol=2 irq=10 io0=0x580 io1=0x180 - -- In the current version of HiSax, you can instead simply use -- -- modprobe hisax type=4 protocol=2 -- -- if you configured your kernel for ISAPnP. Don't run isapnp in -- this case! -- - 6. Teles 16.3, Euro ISDN, I/O base 280 hex, IRQ 12 and - Teles 16.0, 1TR6, IRQ 5, Memory d0000 hex - modprobe hisax type=3,1 protocol=2,1 io=0x280 mem=0,0xd0000 -@@ -314,9 +296,7 @@ - 36 W6692 based PCI cards none - 37 HFC 2BDS0 S+,SP/PCMCIA ONLY WORKS AS A MODULE ! - 38 NETspider U PCI card none -- 39 HFC 2BDS0 SP/PCMCIA ONLY WORKS AS A MODULE ! -- 40 hotplug interface ONLY WORKS AS A MODULE ! -- 41 Formula-n enter:now PCI none -+ - - Running the driver - ------------------ -diff -rNu linux-2.4.29.old/Documentation/isdn/README.act2000 linux-2.4.29/Documentation/isdn/README.act2000 ---- linux-2.4.29.old/Documentation/isdn/README.act2000 2005-03-22 14:48:26.000000000 +0100 -+++ linux-2.4.29/Documentation/isdn/README.act2000 2005-03-22 15:06:50.388432576 +0100 -@@ -1,4 +1,4 @@ --$Id: README.act2000,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $ -+$Id: README.act2000,v 1.3 2000/08/06 09:22:51 armin Exp $ - - This document describes the ACT2000 driver for the - IBM Active 2000 ISDN card. -diff -rNu linux-2.4.29.old/Documentation/isdn/README.audio linux-2.4.29/Documentation/isdn/README.audio ---- linux-2.4.29.old/Documentation/isdn/README.audio 2005-03-22 14:48:26.000000000 +0100 -+++ linux-2.4.29/Documentation/isdn/README.audio 2005-03-22 15:06:50.404430144 +0100 -@@ -1,4 +1,4 @@ --$Id: README.audio,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $ -+$Id: README.audio,v 1.8 1999/07/11 17:17:29 armin Exp $ - - ISDN subsystem for Linux. - Description of audio mode. -diff -rNu linux-2.4.29.old/Documentation/isdn/README.eicon linux-2.4.29/Documentation/isdn/README.eicon ---- linux-2.4.29.old/Documentation/isdn/README.eicon 2005-03-22 14:48:26.000000000 +0100 -+++ linux-2.4.29/Documentation/isdn/README.eicon 2005-03-22 15:06:50.479418744 +0100 -@@ -1,4 +1,4 @@ --$Id: README.eicon,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $ -+$Id: README.eicon,v 1.10 2000/08/13 12:19:15 armin Exp $ - - (c) 1999,2000 Armin Schindler (mac@melware.de) - (c) 1999,2000 Cytronics & Melware (info@melware.de) -diff -rNu linux-2.4.29.old/Documentation/isdn/README.hysdn linux-2.4.29/Documentation/isdn/README.hysdn ---- linux-2.4.29.old/Documentation/isdn/README.hysdn 2005-03-22 14:48:26.000000000 +0100 -+++ linux-2.4.29/Documentation/isdn/README.hysdn 2005-03-22 15:06:50.522412208 +0100 -@@ -1,4 +1,4 @@ --$Id: README.hysdn,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $ -+$Id: README.hysdn,v 1.3.6.1 2001/02/10 14:41:19 kai Exp $ - The hysdn driver has been written by - by Werner Cornelius (werner@isdn4linux.de or werner@titro.de) - for Hypercope GmbH Aachen Germany. Hypercope agreed to publish this driver -diff -rNu linux-2.4.29.old/Documentation/isdn/README.icn linux-2.4.29/Documentation/isdn/README.icn ---- linux-2.4.29.old/Documentation/isdn/README.icn 2005-03-22 14:48:26.000000000 +0100 -+++ linux-2.4.29/Documentation/isdn/README.icn 2005-03-22 15:06:50.550407952 +0100 -@@ -1,4 +1,4 @@ --$Id: README.icn,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $ -+$Id: README.icn,v 1.7 2000/08/06 09:22:51 armin Exp $ - - You can get the ICN-ISDN-card from: - -diff -rNu linux-2.4.29.old/Documentation/isdn/README.pcbit linux-2.4.29/Documentation/isdn/README.pcbit ---- linux-2.4.29.old/Documentation/isdn/README.pcbit 2005-03-22 14:48:26.000000000 +0100 -+++ linux-2.4.29/Documentation/isdn/README.pcbit 2005-03-22 15:06:50.567405368 +0100 -@@ -37,4 +37,4 @@ - regards, - Pedro. - -- -+ -diff -rNu linux-2.4.29.old/Documentation/isdn/abcext_kernel.help linux-2.4.29/Documentation/isdn/abcext_kernel.help ---- linux-2.4.29.old/Documentation/isdn/abcext_kernel.help 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/Documentation/isdn/abcext_kernel.help 2005-03-22 15:06:50.600400352 +0100 -@@ -0,0 +1,166 @@ -+ -+ISDN-ABC-DW Extension -+CONFIG_ISDN_WITH_ABC -+ These are many brand new Options and Features for the -+ ISDN SUBSYSTEM. Including Logical Device bindings, -+ Compression and other good stuff for Optimizing your -+ ISDN System. -+ -+ To Use this Extensions you MUST HAVE THE NEWEST -+ ISDN4K-UTILS. You must have Version 3.1-Beta6 or -+ higher. Elsewhere you can not configure this Extensions. -+ -+ WARNING ! THIS STUF IS NOT PRODUCTION RELEASE THE -+ FUNCTION ARE UNDER DEVELOPMENT. This ist BETA-CODE. -+ You can use it at you Own Risk. -+ -+ For more Information on these Extensions take a look at -+ "linux/Documentation/isdn/dw-abc-extension-howto.txt or -+ Online at the Web "http://www.mediatronix.de/i4l/index.html" -+ -+ Please Report Bugs to "mario@mediatronix.de" or -+ "delefw@isdn4linux.de" -+ -+D-Channel-Callback with Channel in use check -+CONFIG_ISDN_WITH_ABC_CALLB -+ When a Interface is declared as an Callback Interface, -+ the Interface is checking that the other Side is not -+ Calling on the same time before the Interface is Dialing. -+ -+ See "linux/Documentation/isdn/dw-abc-extension-howto.txt" -+ for more Information -+ -+ In most case answer with "Yes" when you have Callback devices, -+ otherwise leave it "No" -+ -+Outgoing-EAZ-Support -+CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ -+ Enables the Feature to Define an other EAZ or MSN for -+ Outgoing calls on an Interface. -+ -+ See "linux/Documentation/isdn/dw-abc-extension-howto.txt" -+ for more Information -+ -+Least Cost Router Support -+CONFIG_ISDN_WITH_ABC_LCR_SUPPORT -+ This is the final Kernel Code for configuring an Least -+ Cost Router Softwarebased. The other Job is to do the -+ action in ISDNLOG. You need the ISDNLOG to use this -+ function. Currently the ISDNLOG have not the Support for -+ this Option. -+ So in most situations let the Option off. -+ -+TCP keepalive detect and response -+CONFIG_ISDN_WITH_ABC_IPV4_TCP_KEEPALIVE -+ This Option works only with the TCP/IP V4. It enables -+ the Function that ISDN Devices are Answering TCP_KEEPALIVE Pakets -+ localy. So that TCP KEEPALIVE Pakets not longer takes the Line -+ open. -+ -+Drop frames Sourceadresse is not Interfaceadress -+CONFIG_ISDN_WITH_ABC_IPV4_DYNADDR -+ This Option works only with the TCP/IP V4. It will allow only -+ the Transmitt of Pakets where the Sourceadresse is the Interface -+ adress. It is usefull when you have Lines with Dynamic IP. -+ -+ See "linux/Documentation/isdn/dw-abc-extension-howto.txt" -+ for more Information -+ -+Receive do not reset the Hanguptimer -+CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER -+ When you activate this option than the reiceive of pakets do -+ not reset the Hanguptimer. It is very usefull because if the -+ Paket vor your Network your Network generate an Response and -+ the Transmit is reseting the HUPTIMER. But when the Paket is -+ Rejected at your firewall your network generate no Response -+ and no Sendtraffic is generated. So in this case there is no -+ need to Reset the Huptimer because you have only received Data. -+ With that option only Transmitted Data/Pakets will reset the -+ HUPTIMER. -+ -+Support of (device-channel) and Binding Groups -+CONFIG_ISDN_WITH_ABC_ICALL_BIND -+ This Option enables the Feature to Bind logical ISDN Interfaces -+ to an prefered ISDN Card or ISDN Card plus Channel. So you have -+ the Chance to keep Channels exclusively for one (or more) -+ Connection. Very usefull when you have more channels and Use -+ Calling Line Identification, because you can organize that your -+ call is going out over the Line with the right EAZ for the CLI. -+ -+Skip channel if used external (Dial Only) -+CONFIG_ISDN_WITH_ABC_CH_EXTINUSE -+ When you have more than One ISDN Card in your System and you -+ will Dialout with an Interface you can become the Situation -+ that an External Device such a Telephone or Fax is Using the -+ B-Channels. Normaly ISDN4Linux does not detect this Situation -+ and dial everytime of the "External Busy" line out. With this -+ Option Enabled the I4L will detect that he can not dialout on -+ This Card and dial over the next Card out. -+ -+ See "linux/Documentation/isdn/dw-abc-extension-howto.txt" -+ for more Information -+ -+Interface autodisable if Config error -+CONFIG_ISDN_WITH_ABC_CONN_ERROR -+ This Option will detect an Device which generate Telephone -+ Cost but does not Function correctly because there are -+ Configerrors on one of the Site. In this Situation the -+ Interface will be marked as Unsuably for some time to do -+ not call every time this Site. -+ -+ See "linux/Documentation/isdn/dw-abc-extension-howto.txt" -+ for more Information -+ -+UDP-Info-Support -+CONFIG_ISDN_WITH_ABC_UDP_CHECK -+ This is the Mainoption to Enable or Disable the UDP -+ Info Support. An Option to Controll ISDN-Interfaces -+ Remotely. For this very Complex thing take a look at -+ -+ "linux/Documentation/isdn/dw-abc-extension-howto.txt" -+ for more Information. -+ -+UDP Hangup Support -+CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP -+ -+ Sorry no more Information! -+ -+ See "linux/Documentation/isdn/dw-abc-extension-howto.txt" -+ for more Information -+ -+UDP Dial Support -+CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL -+ -+ Sorry no more Information! -+ -+ See "linux/Documentation/isdn/dw-abc-extension-howto.txt" -+ for more Information -+ -+Limit on the line frames to two -+CONFIG_ISDN_WITH_ABC_FRAME_LIMIT -+ -+ This Option enables support for sending only 2 Pakets on -+ the Fly to the ISDN Driver. It is very usefull when you -+ will use the new RAW-IP Compression. Because of sending -+ Only 2 Pakets on the Fly makes the risk of overflowing -+ the ISDN Driver very smaller. -+ -+ See "linux/Documentation/isdn/dw-abc-extension-howto.txt" -+ for more Information -+ -+Compression with RAWIP and X75I -+CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS -+ -+ With this Option you have the ability to make Datacompression -+ on RAW-IP Lines. It is function on HDLC and X75I Connection, -+ but the Prefered L2-Protocol for Compression is X75I because -+ the HDLC Protocol have no Errorcorrection. -+ -+ To Use this Option YOU MUST HAVE ENABLED THE OPTION: -+ Support synchronous PPP -+ and must load after loading the main isdndrivers the -+ Modul "isdn_bsdcomp". -+ -+ See "linux/Documentation/isdn/dw-abc-extension-howto.txt" -+ for more Information -+ -diff -rNu linux-2.4.29.old/drivers/isdn/Config.in linux-2.4.29/drivers/isdn/Config.in ---- linux-2.4.29.old/drivers/isdn/Config.in 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/Config.in 2005-03-22 15:06:44.259364336 +0100 -@@ -4,11 +4,9 @@ - - # only included if CONFIG_ISDN != n - --define_bool CONFIG_ISDN_BOOL y - if [ "$CONFIG_INET" != "n" ]; then - bool ' Support synchronous PPP' CONFIG_ISDN_PPP - if [ "$CONFIG_ISDN_PPP" != "n" ]; then -- dep_bool ' PPP filtering for ISDN' CONFIG_IPPP_FILTER $CONFIG_FILTER - bool ' Use VJ-compression with synchronous PPP' CONFIG_ISDN_PPP_VJ - bool ' Support generic MP (RFC 1717)' CONFIG_ISDN_MPP - dep_tristate ' Support BSD compression' CONFIG_ISDN_PPP_BSDCOMP $CONFIG_ISDN -@@ -23,6 +21,30 @@ - fi - - mainmenu_option next_comment -+comment 'ISDN abc-dw-extension' -+bool 'Enable isdn-abc-dw-extension' CONFIG_ISDN_WITH_ABC -+if [ "$CONFIG_ISDN_WITH_ABC" != "n" ]; then -+ bool ' Use D-Channel-Callback with Channel in use check' CONFIG_ISDN_WITH_ABC_CALLB -+ bool ' Enable Outgoing-EAZ-Support' CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ -+ bool ' Enable LCR-Support (need isdnlog)' CONFIG_ISDN_WITH_ABC_LCR_SUPPORT -+ bool ' RX dont reset hanguptimeout' CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER -+ if [ "$CONFIG_EXPERIMENTAL" != "n" ]; then -+ bool ' Enable UDP-Info-Support' CONFIG_ISDN_WITH_ABC_UDP_CHECK -+ if [ "$CONFIG_ISDN_WITH_ABC_UDP_CHECK" != "n" ]; then -+ bool ' Enable Hangup-Support with UDP-INFO' CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP -+ bool ' Enable Dial-Support with UDP-INFO' CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL -+ fi -+ fi -+ -+ bool ' Skip channel if used external (dial only)' CONFIG_ISDN_WITH_ABC_CH_EXTINUSE -+ bool ' Support interface-auto-disable if config-error' CONFIG_ISDN_WITH_ABC_CONN_ERROR -+ if [ "$CONFIG_ISDN_PPP" != "n" ]; then -+ bool ' Enable Compression with rawip and x75i' CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS -+ fi -+fi -+endmenu -+ -+mainmenu_option next_comment - comment 'ISDN feature submodules' - dep_tristate 'isdnloop support' CONFIG_ISDN_DRV_LOOP $CONFIG_ISDN - dep_tristate 'Support isdn diversion services' CONFIG_ISDN_DIVERSION $CONFIG_ISDN -@@ -34,7 +56,6 @@ - comment 'Passive ISDN cards' - dep_tristate 'HiSax SiemensChipSet driver support' CONFIG_ISDN_DRV_HISAX $CONFIG_ISDN - if [ "$CONFIG_ISDN_DRV_HISAX" != "n" ]; then -- define_bool CONFIG_ISDN_HISAX y - comment ' D-channel protocol features' - bool ' HiSax Support for EURO/DSS1' CONFIG_HISAX_EURO - if [ "$CONFIG_HISAX_EURO" != "n" ]; then -@@ -45,31 +66,28 @@ - fi - bool ' HiSax Support for german 1TR6' CONFIG_HISAX_1TR6 - bool ' HiSax Support for US NI1' CONFIG_HISAX_NI1 -- int ' Maximum number of cards supported by HiSax' CONFIG_HISAX_MAX_CARDS 8 - comment ' HiSax supported cards' -- if [ "$CONFIG_ISA" != "n" ]; then -- bool ' Teles 16.0/8.0' CONFIG_HISAX_16_0 -- bool ' Teles 16.3 or PNP or PCMCIA' CONFIG_HISAX_16_3 -- bool ' AVM A1 (Fritz)' CONFIG_HISAX_AVM_A1 -- bool ' ITK ix1-micro Revision 2' CONFIG_HISAX_IX1MICROR2 -- bool ' ASUSCOM ISA cards' CONFIG_HISAX_ASUSCOM -- bool ' TELEINT cards' CONFIG_HISAX_TELEINT -- bool ' HFC-S based cards' CONFIG_HISAX_HFCS -- bool ' USR Sportster internal TA' CONFIG_HISAX_SPORTSTER -- bool ' MIC card' CONFIG_HISAX_MIC -- bool ' Siemens I-Surf card' CONFIG_HISAX_ISURF -- bool ' HST Saphir card' CONFIG_HISAX_HSTSAPHIR -- fi -+ bool ' Teles 16.0/8.0' CONFIG_HISAX_16_0 -+ bool ' Teles 16.3 or PNP or PCMCIA' CONFIG_HISAX_16_3 - bool ' Teles PCI' CONFIG_HISAX_TELESPCI - bool ' Teles S0Box' CONFIG_HISAX_S0BOX -+ bool ' AVM A1 (Fritz)' CONFIG_HISAX_AVM_A1 - bool ' AVM PnP/PCI (Fritz!PnP/PCI)' CONFIG_HISAX_FRITZPCI - bool ' AVM A1 PCMCIA (Fritz)' CONFIG_HISAX_AVM_A1_PCMCIA - bool ' Elsa cards' CONFIG_HISAX_ELSA -+ bool ' ITK ix1-micro Revision 2' CONFIG_HISAX_IX1MICROR2 - bool ' Eicon.Diehl Diva cards' CONFIG_HISAX_DIEHLDIVA -+ bool ' ASUSCOM ISA cards' CONFIG_HISAX_ASUSCOM -+ bool ' TELEINT cards' CONFIG_HISAX_TELEINT -+ bool ' HFC-S based cards' CONFIG_HISAX_HFCS - bool ' Sedlbauer cards' CONFIG_HISAX_SEDLBAUER -+ bool ' USR Sportster internal TA' CONFIG_HISAX_SPORTSTER -+ bool ' MIC card' CONFIG_HISAX_MIC - bool ' NETjet card' CONFIG_HISAX_NETJET - bool ' NETspider U card' CONFIG_HISAX_NETJET_U - bool ' Niccy PnP/PCI card' CONFIG_HISAX_NICCY -+ bool ' Siemens I-Surf card' CONFIG_HISAX_ISURF -+ bool ' HST Saphir card' CONFIG_HISAX_HSTSAPHIR - bool ' Telekom A4T card' CONFIG_HISAX_BKM_A4T - bool ' Scitel Quadro card' CONFIG_HISAX_SCT_QUADRO - bool ' Gazel cards' CONFIG_HISAX_GAZEL -@@ -78,20 +96,27 @@ - bool ' HFC-S+, HFC-SP, HFC-PCMCIA cards' CONFIG_HISAX_HFC_SX - if [ "$CONFIG_EXPERIMENTAL" != "n" ]; then - # bool ' TESTEMULATOR (EXPERIMENTAL)' CONFIG_HISAX_TESTEMU -- bool ' Formula-n enter:now PCI card' CONFIG_HISAX_ENTERNOW_PCI - if [ "$ARCH" = "sparc" -o "$ARCH" = "sparc64" ]; then - bool ' Am7930' CONFIG_HISAX_AMD7930 - fi - fi - bool ' HiSax debugging' CONFIG_HISAX_DEBUG - -- dep_tristate 'Sedlbauer PCMCIA cards' CONFIG_HISAX_SEDLBAUER_CS $CONFIG_ISDN_DRV_HISAX $CONFIG_PCMCIA -- dep_tristate 'ELSA PCMCIA MicroLink cards' CONFIG_HISAX_ELSA_CS $CONFIG_ISDN_DRV_HISAX $CONFIG_PCMCIA -- dep_tristate 'AVM A1 PCMCIA cards' CONFIG_HISAX_AVM_A1_CS $CONFIG_ISDN_DRV_HISAX $CONFIG_PCMCIA $CONFIG_HISAX_AVM_A1_PCMCIA -- dep_tristate 'ST5481 USB ISDN modem (EXPERIMENTAL)' CONFIG_HISAX_ST5481 $CONFIG_ISDN_DRV_HISAX $CONFIG_EXPERIMENTAL -- dep_tristate 'AVM Fritz!Card PCI/PCIv2/PnP support (EXPERIMENTAL)' CONFIG_HISAX_FRITZ_PCIPNP $CONFIG_ISDN_DRV_HISAX $CONFIG_EXPERIMENTAL -- dep_tristate 'Auerswald devices ISDN support' CONFIG_USB_AUERISDN $CONFIG_ISDN_DRV_HISAX -+ dep_tristate 'Sedlbauer PCMCIA cards' CONFIG_HISAX_SEDLBAUER_CS $CONFIG_PCMCIA -+ dep_tristate 'ELSA PCMCIA MicroLink cards' CONFIG_HISAX_ELSA_CS $CONFIG_PCMCIA -+ dep_tristate 'Colognechip HFC-USB support' CONFIG_HISAX_HFC_USB_CS $CONFIG_HISAX $CONFIG_USB -+ dep_tristate 'ST5481 USB ISDN modem (EXPERIMENTAL)' CONFIG_HISAX_ST5481 $CONFIG_HISAX $CONFIG_USB $CONFIG_EXPERIMENTAL -+ dep_tristate 'Fritz!PCIv2 support (EXPERIMENTAL)' CONFIG_HISAX_FRITZ_PCIPNP $CONFIG_HISAX $CONFIG_EXPERIMENTAL - -+ if [ "$CONFIG_HISAX_SEDLBAUER_CS" != "n" ]; then -+ define_bool CONFIG_HISAX_SEDLBAUER y -+ fi -+ if [ "$CONFIG_HISAX_ELSA_CS" != "n" ]; then -+ define_bool CONFIG_HISAX_ELSA y -+ fi -+ if [ "$CONFIG_HISAX_HFC_USB_CS" != "n" ]; then -+ define_bool CONFIG_HISAX_HFC_USB y -+ fi - fi - endmenu - -diff -rNu linux-2.4.29.old/drivers/isdn/Makefile linux-2.4.29/drivers/isdn/Makefile ---- linux-2.4.29.old/drivers/isdn/Makefile 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/Makefile 2005-03-22 15:06:44.277361600 +0100 -@@ -2,7 +2,7 @@ - - # The target object and module list name. - --O_TARGET := vmlinux-obj.o -+O_TARGET := isdn.a - - # Objects that export symbols. - -@@ -32,9 +32,9 @@ - - # Object files in subdirectories - --mod-subdirs := avmb1 eicon hisax -+mod-subdirs := avmb1 eicon - subdir-$(CONFIG_ISDN_DIVERSION) += divert --subdir-$(CONFIG_ISDN_HISAX) += hisax -+subdir-$(CONFIG_ISDN_DRV_HISAX) += hisax - subdir-$(CONFIG_ISDN_DRV_ICN) += icn - subdir-$(CONFIG_ISDN_DRV_PCBIT) += pcbit - subdir-$(CONFIG_ISDN_DRV_SC) += sc -diff -rNu linux-2.4.29.old/drivers/isdn/act2000/act2000.h linux-2.4.29/drivers/isdn/act2000/act2000.h ---- linux-2.4.29.old/drivers/isdn/act2000/act2000.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/act2000/act2000.h 2005-03-22 15:06:44.103388048 +0100 -@@ -1,4 +1,4 @@ --/* $Id: act2000.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id$ - * - * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000. - * -@@ -178,19 +178,19 @@ - char regname[35]; /* Name used for request_region */ - } act2000_card; - --static inline void act2000_schedule_tx(act2000_card *card) -+extern __inline__ void act2000_schedule_tx(act2000_card *card) - { - queue_task(&card->snd_tq, &tq_immediate); - mark_bh(IMMEDIATE_BH); - } - --static inline void act2000_schedule_rx(act2000_card *card) -+extern __inline__ void act2000_schedule_rx(act2000_card *card) - { - queue_task(&card->rcv_tq, &tq_immediate); - mark_bh(IMMEDIATE_BH); - } - --static inline void act2000_schedule_poll(act2000_card *card) -+extern __inline__ void act2000_schedule_poll(act2000_card *card) - { - queue_task(&card->poll_tq, &tq_immediate); - mark_bh(IMMEDIATE_BH); -diff -rNu linux-2.4.29.old/drivers/isdn/act2000/act2000_isa.c linux-2.4.29/drivers/isdn/act2000/act2000_isa.c ---- linux-2.4.29.old/drivers/isdn/act2000/act2000_isa.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/act2000/act2000_isa.c 2005-03-22 15:06:44.135383184 +0100 -@@ -1,4 +1,4 @@ --/* $Id: act2000_isa.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id$ - * - * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000 (ISA-Version). - * -@@ -178,8 +178,7 @@ - card->flags &= ~ACT2000_FLAGS_PVALID; - } - if (!check_region(portbase, ISA_REGION)) { -- if (request_region(portbase, ACT2000_PORTLEN, card->regname) == NULL) -- return -EIO; -+ request_region(portbase, ACT2000_PORTLEN, card->regname); - card->port = portbase; - card->flags |= ACT2000_FLAGS_PVALID; - return 0; -@@ -341,6 +340,9 @@ - while (skb->len) { - if (act2000_isa_writeb(card, *(skb->data))) { - /* Fifo is full, but more data to send */ -+#if 0 -+ printk(KERN_DEBUG "act2000_isa_send: %d bytes\n", l); -+#endif - test_and_clear_bit(ACT2000_LOCK_TX, (void *) &card->ilock); - /* Schedule myself */ - act2000_schedule_tx(card); -@@ -363,6 +365,9 @@ - } else - dev_kfree_skb(skb); - card->sbuf = NULL; -+#if 0 -+ printk(KERN_DEBUG "act2000_isa_send: %d bytes\n", l); -+#endif - } - } - -diff -rNu linux-2.4.29.old/drivers/isdn/act2000/act2000_isa.h linux-2.4.29/drivers/isdn/act2000/act2000_isa.h ---- linux-2.4.29.old/drivers/isdn/act2000/act2000_isa.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/act2000/act2000_isa.h 2005-03-22 15:06:44.152380600 +0100 -@@ -1,4 +1,4 @@ --/* $Id: act2000_isa.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id$ - * - * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000 (ISA-Version). - * -diff -rNu linux-2.4.29.old/drivers/isdn/act2000/capi.c linux-2.4.29/drivers/isdn/act2000/capi.c ---- linux-2.4.29.old/drivers/isdn/act2000/capi.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/act2000/capi.c 2005-03-22 15:06:44.172377560 +0100 -@@ -1,4 +1,4 @@ --/* $Id: capi.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id$ - * - * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000. - * CAPI encoder/decoder -@@ -76,6 +76,10 @@ - {{ 0x84, 0x03}, "DISCONNECT_B3_RESP"}, - {{ 0x86, 0x03}, "DATA_B3_RESP"}, - {{ 0xff, 0x03}, "MANUFACTURER_RESP"}, -+#if 0 -+/* CAPI 2.0 */ -+ {{ 0x05, 0x80}, "LISTEN_REQ (CAPI 2.0)"}, -+#endif - #endif - {{ 0x00, 0x00}, NULL}, - }; -diff -rNu linux-2.4.29.old/drivers/isdn/act2000/capi.h linux-2.4.29/drivers/isdn/act2000/capi.h ---- linux-2.4.29.old/drivers/isdn/act2000/capi.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/act2000/capi.h 2005-03-22 15:06:44.187375280 +0100 -@@ -1,4 +1,4 @@ --/* $Id: capi.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id$ - * - * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000. - * -@@ -294,6 +294,19 @@ - __u16 plci; - __u16 info; - } select_b3_protocol_conf; -+#if 0 -+ struct listen_req { -+ __u32 controller; -+ __u32 infomask; -+ __u32 cipmask; -+ __u32 cipmask2; -+ __u16 dummy; /* 2 Length-bytes of 2 Structs MUST always be 0!!! */ -+ } listen_req; -+ struct listen_conf { -+ __u32 controller; -+ __u16 info; -+ } listen_conf; -+#else - struct listen_req { - __u8 controller; - __u32 infomask __attribute__ ((packed)); -@@ -304,6 +317,7 @@ - __u8 controller; - __u16 info __attribute__ ((packed)); - } listen_conf; -+#endif - struct data_b3_req { - __u16 fakencci; - __u16 datalen; -@@ -330,7 +344,7 @@ - } msg; - } actcapi_msg; - --static inline unsigned short -+extern __inline__ unsigned short - actcapi_nextsmsg(act2000_card *card) - { - unsigned long flags; -diff -rNu linux-2.4.29.old/drivers/isdn/act2000/module.c linux-2.4.29/drivers/isdn/act2000/module.c ---- linux-2.4.29.old/drivers/isdn/act2000/module.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/act2000/module.c 2005-03-22 15:06:44.202373000 +0100 -@@ -1,4 +1,4 @@ --/* $Id: module.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id$ - * - * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000. - * -@@ -630,6 +630,10 @@ - card->interface.features = - ISDN_FEATURE_L2_X75I | - ISDN_FEATURE_L2_HDLC | -+#if 0 -+/* Not yet! New Firmware is on the way ... */ -+ ISDN_FEATURE_L2_TRANS | -+#endif - ISDN_FEATURE_L3_TRANS | - ISDN_FEATURE_P_UNKNOWN; - card->interface.hl_hdrlen = 20; -@@ -843,6 +847,39 @@ - } - printk(KERN_INFO "%s unloaded\n", DRIVERNAME); - } -+#if 0 -+#ifndef MODULE -+void -+act2000_setup(char *str, int *ints) -+{ -+ int i, j, argc, port, irq, bus; -+ -+ argc = ints[0]; -+ i = 1; -+ if (argc) -+ while (argc) { -+ port = irq = -1; -+ bus = 0; -+ if (argc) { -+ bus = ints[i]; -+ i++; -+ argc--; -+ } -+ if (argc) { -+ port = ints[i]; -+ i++; -+ argc--; -+ } -+ if (argc) { -+ irq = ints[i]; -+ i++; -+ argc--; -+ } -+ act2000_addcard(bus, port, irq, act_id); -+ } -+} -+#endif -+#endif - - module_init(act2000_init); - module_exit(act2000_exit); -diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/avm_cs.c linux-2.4.29/drivers/isdn/avmb1/avm_cs.c ---- linux-2.4.29.old/drivers/isdn/avmb1/avm_cs.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/avmb1/avm_cs.c 2005-03-22 15:06:44.696297912 +0100 -@@ -1,4 +1,4 @@ --/* $Id: avm_cs.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: avm_cs.c,v 1.6 2001/09/24 13:22:44 kai Exp $ - * - * A PCMCIA client driver for AVM B1/M1/M2 - * -diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/avmcard.h linux-2.4.29/drivers/isdn/avmb1/avmcard.h ---- linux-2.4.29.old/drivers/isdn/avmb1/avmcard.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/avmb1/avmcard.h 2005-03-22 15:06:44.711295632 +0100 -@@ -1,4 +1,4 @@ --/* $Id: avmcard.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: avmcard.h,v 1.12 2001/09/24 13:22:44 kai Exp $ - * - * Copyright 1999 by Carsten Paeth - * -diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/b1.c linux-2.4.29/drivers/isdn/avmb1/b1.c ---- linux-2.4.29.old/drivers/isdn/avmb1/b1.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/avmb1/b1.c 2005-03-22 15:06:44.733292288 +0100 -@@ -1,4 +1,4 @@ --/* $Id: b1.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: b1.c,v 1.26 2001/09/24 13:22:44 kai Exp $ - * - * Common module for AVM B1 cards. - * -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - #include - #include - #include "capilli.h" -@@ -27,7 +28,7 @@ - #include "capicmd.h" - #include "capiutil.h" - --static char *revision = "$Revision: 1.1.4.1 $"; -+static char *revision = "$Revision: 1.26 $"; - - /* ------------------------------------------------------------- */ - -diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/b1dma.c linux-2.4.29/drivers/isdn/avmb1/b1dma.c ---- linux-2.4.29.old/drivers/isdn/avmb1/b1dma.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/avmb1/b1dma.c 2005-03-22 15:06:44.750289704 +0100 -@@ -1,4 +1,4 @@ --/* $Id: b1dma.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: b1dma.c,v 1.18 2001/09/24 13:22:44 kai Exp $ - * - * Common module for AVM B1 cards that support dma with AMCC - * -@@ -21,6 +21,7 @@ - #include - #include - #include -+#include - #include - #include - #include "capilli.h" -@@ -28,7 +29,11 @@ - #include "capicmd.h" - #include "capiutil.h" - --static char *revision = "$Revision: 1.1.4.1 $"; -+#if BITS_PER_LONG != 32 -+#error FIXME: driver requires 32-bit platform -+#endif -+ -+static char *revision = "$Revision: 1.18 $"; - - /* ------------------------------------------------------------- */ - -@@ -851,7 +856,7 @@ - __u8 flag; - int len = 0; - char *s; -- u_long txaddr, txlen, rxaddr, rxlen, csr; -+ __u32 txaddr, txlen, rxaddr, rxlen, csr; - - len += sprintf(page+len, "%-16s %s\n", "name", card->name); - len += sprintf(page+len, "%-16s 0x%x\n", "io", card->port); -@@ -907,12 +912,12 @@ - save_flags(flags); - cli(); - -- txaddr = (u_long)phys_to_virt(b1dmainmeml(card->mbase+0x2c)); -- txaddr -= (u_long)card->dma->sendbuf; -+ txaddr = (__u32)phys_to_virt(b1dmainmeml(card->mbase+0x2c)); -+ txaddr -= (__u32)card->dma->sendbuf; - txlen = b1dmainmeml(card->mbase+0x30); - -- rxaddr = (u_long)phys_to_virt(b1dmainmeml(card->mbase+0x24)); -- rxaddr -= (u_long)card->dma->recvbuf; -+ rxaddr = (__u32)phys_to_virt(b1dmainmeml(card->mbase+0x24)); -+ rxaddr -= (__u32)card->dma->recvbuf; - rxlen = b1dmainmeml(card->mbase+0x28); - - csr = b1dmainmeml(card->mbase+AMCC_INTCSR); -diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/b1isa.c linux-2.4.29/drivers/isdn/avmb1/b1isa.c ---- linux-2.4.29.old/drivers/isdn/avmb1/b1isa.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/avmb1/b1isa.c 2005-03-22 15:06:44.766287272 +0100 -@@ -1,4 +1,4 @@ --/* $Id: b1isa.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: b1isa.c,v 1.14 2001/09/24 13:22:44 kai Exp $ - * - * Module for AVM B1 ISA-card. - * -@@ -19,12 +19,13 @@ - #include - #include - #include -+#include - #include "capicmd.h" - #include "capiutil.h" - #include "capilli.h" - #include "avmcard.h" - --static char *revision = "$Revision: 1.1.4.1 $"; -+static char *revision = "$Revision: 1.14 $"; - - /* ------------------------------------------------------------- */ - -diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/b1pci.c linux-2.4.29/drivers/isdn/avmb1/b1pci.c ---- linux-2.4.29.old/drivers/isdn/avmb1/b1pci.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/avmb1/b1pci.c 2005-03-22 15:06:44.781284992 +0100 -@@ -1,4 +1,4 @@ --/* $Id: b1pci.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: b1pci.c,v 1.40 2001/09/24 13:22:44 kai Exp $ - * - * Module for AVM B1 PCI-card. - * -@@ -21,21 +21,24 @@ - #include - #include - #include -+#include - #include "capicmd.h" - #include "capiutil.h" - #include "capilli.h" - #include "avmcard.h" - --static char *revision = "$Revision: 1.1.4.1 $"; -+static char *revision = "$Revision: 1.40 $"; - - /* ------------------------------------------------------------- */ - -+#ifndef COMPAT_HAS_2_2_PCI - static struct pci_device_id b1pci_pci_tbl[] __initdata = { - { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_B1, PCI_ANY_ID, PCI_ANY_ID }, - { } /* Terminating entry */ - }; - - MODULE_DEVICE_TABLE(pci, b1pci_pci_tbl); -+#endif - MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM B1 PCI card"); - MODULE_AUTHOR("Carsten Paeth"); - MODULE_LICENSE("GPL"); -@@ -416,14 +419,14 @@ - } - param.irq = dev->irq; - -- if (pci_resource_start(dev, 2)) { /* B1 PCI V4 */ -+ if (pci_resource_start_io(dev, 2)) { /* B1 PCI V4 */ - #ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4 - driver = &b1pciv4_driver; - - pci_set_master(dev); - #endif -- param.membase = pci_resource_start(dev, 0); -- param.port = pci_resource_start(dev, 2); -+ param.membase = pci_resource_start_mem(dev, 0); -+ param.port = pci_resource_start_io(dev, 2); - - printk(KERN_INFO - "%s: PCI BIOS reports AVM-B1 V4 at i/o %#x, irq %d, mem %#x\n", -@@ -440,7 +443,7 @@ - } - } else { - param.membase = 0; -- param.port = pci_resource_start(dev, 1); -+ param.port = pci_resource_start_io(dev, 1); - - printk(KERN_INFO - "%s: PCI BIOS reports AVM-B1 at i/o %#x, irq %d\n", -diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/b1pcmcia.c linux-2.4.29/drivers/isdn/avmb1/b1pcmcia.c ---- linux-2.4.29.old/drivers/isdn/avmb1/b1pcmcia.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/avmb1/b1pcmcia.c 2005-03-22 15:06:44.796282712 +0100 -@@ -1,4 +1,4 @@ --/* $Id: b1pcmcia.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: b1pcmcia.c,v 1.17 2001/09/24 13:22:44 kai Exp $ - * - * Module for AVM B1/M1/M2 PCMCIA-card. - * -@@ -25,7 +25,7 @@ - #include "capilli.h" - #include "avmcard.h" - --static char *revision = "$Revision: 1.1.4.1 $"; -+static char *revision = "$Revision: 1.17 $"; - - /* ------------------------------------------------------------- */ - -diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/c4.c linux-2.4.29/drivers/isdn/avmb1/c4.c ---- linux-2.4.29.old/drivers/isdn/avmb1/c4.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/avmb1/c4.c 2005-03-22 15:06:44.812280280 +0100 -@@ -1,4 +1,4 @@ --/* $Id: c4.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: c4.c,v 1.38 2001/09/24 13:22:44 kai Exp $ - * - * Module for AVM C4 & C2 card. - * -@@ -18,6 +18,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -29,7 +30,7 @@ - #include "capilli.h" - #include "avmcard.h" - --static char *revision = "$Revision: 1.1.4.1 $"; -+static char *revision = "$Revision: 1.38 $"; - - #undef CONFIG_C4_DEBUG - #undef CONFIG_C4_POLLDEBUG -@@ -38,6 +39,7 @@ - - static int suppress_pollack; - -+#ifndef COMPAT_HAS_2_2_PCI - static struct pci_device_id c4_pci_tbl[] __initdata = { - { PCI_VENDOR_ID_DEC,PCI_DEVICE_ID_DEC_21285, PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_C4 }, - { PCI_VENDOR_ID_DEC,PCI_DEVICE_ID_DEC_21285, PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_C2 }, -@@ -45,6 +47,7 @@ - }; - - MODULE_DEVICE_TABLE(pci, c4_pci_tbl); -+#endif - MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM C2/C4 cards"); - MODULE_AUTHOR("Carsten Paeth"); - MODULE_LICENSE("GPL"); -@@ -1328,9 +1331,9 @@ - } - pci_set_master(dev); - -- param.port = pci_resource_start(dev, 1); -+ param.port = pci_resource_start_io(dev, 1); - param.irq = dev->irq; -- param.membase = pci_resource_start(dev, 0); -+ param.membase = pci_resource_start_mem(dev, 0); - - printk(KERN_INFO - "%s: PCI BIOS reports AVM-C%d at i/o %#x, irq %d, mem %#x\n", -diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/capi.c linux-2.4.29/drivers/isdn/avmb1/capi.c ---- linux-2.4.29.old/drivers/isdn/avmb1/capi.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/avmb1/capi.c 2005-03-22 15:06:44.849274656 +0100 -@@ -1,4 +1,4 @@ --/* $Id: capi.c,v 1.1.4.2 2001/12/09 18:45:13 kai Exp $ -+/* $Id: capi.c,v 1.59 2001/11/07 22:35:48 kai Exp $ - * - * CAPI 2.0 Interface for Linux - * -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE - #include - #ifdef CONFIG_PPP -@@ -30,6 +31,9 @@ - #include - #include - #undef CAPI_PPP_ON_RAW_DEVICE -+#ifdef CAPI_PPP_ON_RAW_DEVICE -+#include -+#endif /* CAPI_PPP_ON_RAW_DEVICE */ - #endif /* CONFIG_PPP */ - #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ - #include -@@ -38,14 +42,16 @@ - #include - #include - #include -+#ifdef HAVE_DEVFS_FS - #include -+#endif /* HAVE_DEVFS_FS */ - #include "capiutil.h" - #include "capicmd.h" - #if defined(CONFIG_ISDN_CAPI_CAPIFS) || defined(CONFIG_ISDN_CAPI_CAPIFS_MODULE) - #include "capifs.h" - #endif - --static char *revision = "$Revision: 1.1.4.2 $"; -+static char *revision = "$Revision: 1.59 $"; - - MODULE_DESCRIPTION("CAPI4Linux: Userspace /dev/capi20 interface"); - MODULE_AUTHOR("Carsten Paeth"); -@@ -87,10 +93,10 @@ - struct capincci *nccip; - unsigned int minor; - -- u16 applid; -- u32 ncci; -- u16 datahandle; -- u16 msgid; -+ __u16 applid; -+ __u32 ncci; -+ __u16 datahandle; -+ __u16 msgid; - - struct file *file; - struct tty_struct *tty; -@@ -112,16 +118,22 @@ - /* transmit path */ - struct datahandle_queue { - struct datahandle_queue *next; -- u16 datahandle; -+ __u16 datahandle; - } *ackqueue; - int nack; - -+#ifdef CAPI_PPP_ON_RAW_DEVICE -+ /* interface to generic ppp layer */ -+ struct ppp_channel chan; -+ int chan_connected; -+ int chan_index; -+#endif - }; - #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ - - struct capincci { - struct capincci *next; -- u32 ncci; -+ __u32 ncci; - struct capidev *cdev; - #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE - struct capiminor *minorp; -@@ -131,8 +143,8 @@ - struct capidev { - struct capidev *next; - struct file *file; -- u16 applid; -- u16 errcode; -+ __u16 applid; -+ __u16 errcode; - unsigned int minor; - unsigned userflags; - -@@ -156,22 +168,28 @@ - static struct capiminor *minors = 0; - #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ - -+#ifdef COMPAT_HAS_kmem_cache - static kmem_cache_t *capidev_cachep = 0; - static kmem_cache_t *capincci_cachep = 0; - #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE - static kmem_cache_t *capiminor_cachep = 0; - static kmem_cache_t *capidh_cachep = 0; - #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ -+#endif - - #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE - /* -------- datahandles --------------------------------------------- */ - --static int capincci_add_ack(struct capiminor *mp, u16 datahandle) -+int capincci_add_ack(struct capiminor *mp, __u16 datahandle) - { - struct datahandle_queue *n, **pp; - - n = (struct datahandle_queue *) -+#ifdef COMPAT_HAS_kmem_cache - kmem_cache_alloc(capidh_cachep, GFP_ATOMIC); -+#else -+ kmalloc(sizeof(struct datahandle_queue), GFP_ATOMIC); -+#endif - if (!n) { - printk(KERN_ERR "capi: alloc datahandle failed\n"); - return -1; -@@ -184,7 +202,7 @@ - return 0; - } - --static int capiminor_del_ack(struct capiminor *mp, u16 datahandle) -+int capiminor_del_ack(struct capiminor *mp, __u16 datahandle) - { - struct datahandle_queue **pp, *p; - -@@ -192,7 +210,11 @@ - if ((*pp)->datahandle == datahandle) { - p = *pp; - *pp = (*pp)->next; -+#ifdef COMPAT_HAS_kmem_cache - kmem_cache_free(capidh_cachep, p); -+#else -+ kfree(p); -+#endif - mp->nack--; - return 0; - } -@@ -200,7 +222,7 @@ - return -1; - } - --static void capiminor_del_all_ack(struct capiminor *mp) -+void capiminor_del_all_ack(struct capiminor *mp) - { - struct datahandle_queue **pp, *p; - -@@ -208,7 +230,11 @@ - while (*pp) { - p = *pp; - *pp = (*pp)->next; -+#ifdef COMPAT_HAS_kmem_cache - kmem_cache_free(capidh_cachep, p); -+#else -+ kfree(p); -+#endif - mp->nack--; - } - } -@@ -216,13 +242,17 @@ - - /* -------- struct capiminor ---------------------------------------- */ - --static struct capiminor *capiminor_alloc(u16 applid, u32 ncci) -+struct capiminor *capiminor_alloc(__u16 applid, __u32 ncci) - { - struct capiminor *mp, **pp; - unsigned int minor = 0; - - MOD_INC_USE_COUNT; -+#ifdef COMPAT_HAS_kmem_cache - mp = (struct capiminor *)kmem_cache_alloc(capiminor_cachep, GFP_ATOMIC); -+#else -+ mp = (struct capiminor *)kmalloc(sizeof(struct capiminor), GFP_ATOMIC); -+#endif - if (!mp) { - MOD_DEC_USE_COUNT; - printk(KERN_ERR "capi: can't alloc capiminor\n"); -@@ -257,7 +287,7 @@ - return mp; - } - --static void capiminor_free(struct capiminor *mp) -+void capiminor_free(struct capiminor *mp) - { - struct capiminor **pp; - -@@ -271,7 +301,11 @@ - skb_queue_purge(&mp->inqueue); - skb_queue_purge(&mp->outqueue); - capiminor_del_all_ack(mp); -+#ifdef COMPAT_HAS_kmem_cache - kmem_cache_free(capiminor_cachep, mp); -+#else -+ kfree(mp); -+#endif - MOD_DEC_USE_COUNT; - #ifdef _DEBUG_REFCOUNT - printk(KERN_DEBUG "capiminor_free %d\n", GET_USE_COUNT(THIS_MODULE)); -@@ -283,7 +317,7 @@ - } - } - --static struct capiminor *capiminor_find(unsigned int minor) -+struct capiminor *capiminor_find(unsigned int minor) - { - struct capiminor *p; - for (p = minors; p && p->minor != minor; p = p->next) -@@ -294,7 +328,7 @@ - - /* -------- struct capincci ----------------------------------------- */ - --static struct capincci *capincci_alloc(struct capidev *cdev, u32 ncci) -+static struct capincci *capincci_alloc(struct capidev *cdev, __u32 ncci) - { - struct capincci *np, **pp; - #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE -@@ -302,7 +336,11 @@ - kdev_t kdev; - #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ - -+#ifdef COMPAT_HAS_kmem_cache - np = (struct capincci *)kmem_cache_alloc(capincci_cachep, GFP_ATOMIC); -+#else -+ np = (struct capincci *)kmalloc(sizeof(struct capincci), GFP_ATOMIC); -+#endif - if (!np) - return 0; - memset(np, 0, sizeof(struct capincci)); -@@ -331,7 +369,7 @@ - return np; - } - --static void capincci_free(struct capidev *cdev, u32 ncci) -+static void capincci_free(struct capidev *cdev, __u32 ncci) - { - struct capincci *np, **pp; - #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE -@@ -367,7 +405,11 @@ - } - } - #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ -+#ifdef COMPAT_HAS_kmem_cache - kmem_cache_free(capincci_cachep, np); -+#else -+ kfree(np); -+#endif - if (*pp == 0) return; - } else { - pp = &(*pp)->next; -@@ -375,7 +417,7 @@ - } - } - --static struct capincci *capincci_find(struct capidev *cdev, u32 ncci) -+struct capincci *capincci_find(struct capidev *cdev, __u32 ncci) - { - struct capincci *p; - -@@ -393,7 +435,11 @@ - struct capidev *cdev; - struct capidev **pp; - -+#ifdef COMPAT_HAS_kmem_cache - cdev = (struct capidev *)kmem_cache_alloc(capidev_cachep, GFP_KERNEL); -+#else -+ cdev = (struct capidev *)kmalloc(sizeof(struct capidev), GFP_KERNEL); -+#endif - if (!cdev) - return 0; - memset(cdev, 0, sizeof(struct capidev)); -@@ -423,10 +469,14 @@ - if (*pp) - *pp = cdev->next; - -+#ifdef COMPAT_HAS_kmem_cache - kmem_cache_free(capidev_cachep, cdev); -+#else -+ kfree(cdev); -+#endif - } - --static struct capidev *capidev_find(u16 applid) -+static struct capidev *capidev_find(__u16 applid) - { - struct capidev *p; - for (p=capidev_openlist; p; p = p->next) { -@@ -439,13 +489,13 @@ - #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE - /* -------- handle data queue --------------------------------------- */ - --static struct sk_buff * -+struct sk_buff * - gen_data_b3_resp_for(struct capiminor *mp, struct sk_buff *skb) - { - struct sk_buff *nskb; - nskb = alloc_skb(CAPI_DATA_B3_RESP_LEN, GFP_ATOMIC); - if (nskb) { -- u16 datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4+4+2); -+ __u16 datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4+4+2); - unsigned char *s = skb_put(nskb, CAPI_DATA_B3_RESP_LEN); - capimsg_setu16(s, 0, CAPI_DATA_B3_RESP_LEN); - capimsg_setu16(s, 2, mp->applid); -@@ -458,11 +508,11 @@ - return nskb; - } - --static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb) -+int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb) - { - struct sk_buff *nskb; - unsigned int datalen; -- u16 errcode, datahandle; -+ __u16 errcode, datahandle; - - datalen = skb->len - CAPIMSG_LEN(skb->data); - if (mp->tty) { -@@ -504,6 +554,28 @@ - kfree_skb(skb); - return 0; - -+#ifdef CAPI_PPP_ON_RAW_DEVICE -+ } else if (mp->chan_connected) { -+ if ((nskb = gen_data_b3_resp_for(mp, skb)) == 0) { -+ printk(KERN_ERR "capi: gen_data_b3_resp failed\n"); -+ return -1; -+ } -+ datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4); -+ errcode = (*capifuncs->capi_put_message)(mp->applid, nskb); -+ if (errcode != CAPI_NOERROR) { -+ printk(KERN_ERR "capi: send DATA_B3_RESP failed=%x\n", -+ errcode); -+ kfree_skb(nskb); -+ return -1; -+ } -+ (void)skb_pull(skb, CAPIMSG_LEN(skb->data)); -+#ifdef _DEBUG_DATAFLOW -+ printk(KERN_DEBUG "capi: DATA_B3_RESP %u len=%d => ppp\n", -+ datahandle, skb->len); -+#endif -+ ppp_input(&mp->chan, skb); -+ return 0; -+#endif - } else if (mp->file) { - if (skb_queue_len(&mp->recvqueue) > CAPINC_MAX_RECVQUEUE) { - #if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS) -@@ -538,7 +610,7 @@ - return -1; - } - --static void handle_minor_recv(struct capiminor *mp) -+void handle_minor_recv(struct capiminor *mp) - { - struct sk_buff *skb; - while ((skb = skb_dequeue(&mp->inqueue)) != 0) { -@@ -552,13 +624,13 @@ - } - } - --static int handle_minor_send(struct capiminor *mp) -+int handle_minor_send(struct capiminor *mp) - { - struct sk_buff *skb; -- u16 len; -+ __u16 len; - int count = 0; -- u16 errcode; -- u16 datahandle; -+ __u16 errcode; -+ __u16 datahandle; - - if (mp->tty && mp->ttyoutstop) { - #if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS) -@@ -569,7 +641,7 @@ - - while ((skb = skb_dequeue(&mp->outqueue)) != 0) { - datahandle = mp->datahandle; -- len = (u16)skb->len; -+ len = (__u16)skb->len; - skb_push(skb, CAPI_DATA_B3_REQ_LEN); - memset(skb->data, 0, CAPI_DATA_B3_REQ_LEN); - capimsg_setu16(skb->data, 0, CAPI_DATA_B3_REQ_LEN); -@@ -578,7 +650,7 @@ - capimsg_setu8 (skb->data, 5, CAPI_REQ); - capimsg_setu16(skb->data, 6, mp->msgid++); - capimsg_setu32(skb->data, 8, mp->ncci); /* NCCI */ -- capimsg_setu32(skb->data, 12, (u32) skb->data); /* Data32 */ -+ capimsg_setu32(skb->data, 12, (__u32) skb->data); /* Data32 */ - capimsg_setu16(skb->data, 16, len); /* Data length */ - capimsg_setu16(skb->data, 18, datahandle); - capimsg_setu16(skb->data, 20, 0); /* Flags */ -@@ -620,16 +692,16 @@ - #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ - /* -------- function called by lower level -------------------------- */ - --static void capi_signal(u16 applid, void *param) -+static void capi_signal(__u16 applid, void *param) - { - struct capidev *cdev = (struct capidev *)param; - #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE - struct capiminor *mp; -- u16 datahandle; -+ __u16 datahandle; - #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ - struct capincci *np; - struct sk_buff *skb = 0; -- u32 ncci; -+ __u32 ncci; - - (void) (*capifuncs->capi_get_message) (applid, &skb); - if (!skb) { -@@ -683,6 +755,12 @@ - #endif - kfree_skb(skb); - (void)capiminor_del_ack(mp, datahandle); -+#ifdef CAPI_PPP_ON_RAW_DEVICE -+ if (mp->chan_connected) { -+ ppp_output_wakeup(&mp->chan); -+ return; -+ } -+#endif - if (mp->tty) { - if (mp->tty->ldisc.write_wakeup) - mp->tty->ldisc.write_wakeup(mp->tty); -@@ -758,7 +836,7 @@ - struct capidev *cdev = (struct capidev *)file->private_data; - struct sk_buff *skb; - int retval; -- u16 mlen; -+ __u16 mlen; - - if (ppos != &file->f_pos) - return -ESPIPE; -@@ -998,7 +1076,7 @@ - sizeof(ncci)); - if (retval) - return -EFAULT; -- nccip = capincci_find(cdev, (u32) ncci); -+ nccip = capincci_find(cdev, (__u32) ncci); - if (!nccip) - return 0; - #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE -@@ -1023,7 +1101,7 @@ - sizeof(ncci)); - if (retval) - return -EFAULT; -- nccip = capincci_find(cdev, (u32) ncci); -+ nccip = capincci_find(cdev, (__u32) ncci); - if (!nccip || (mp = nccip->minorp) == 0) - return -ESRCH; - return mp->minor; -@@ -1070,7 +1148,9 @@ - - static struct file_operations capi_fops = - { -+#ifdef COMPAT_HAS_FILEOP_OWNER - owner: THIS_MODULE, -+#endif - llseek: no_llseek, - read: capi_read, - write: capi_write, -@@ -1233,6 +1313,45 @@ - return -EINVAL; - - switch (cmd) { -+#ifdef CAPI_PPP_ON_RAW_DEVICE -+ case PPPIOCATTACH: -+ { -+ int retval, val; -+ if (get_user(val, (int *) arg)) -+ break; -+ if (mp->chan_connected) -+ return -EALREADY; -+ mp->chan.private = mp; -+#if 1 -+ return -EINVAL; -+#else -+ mp->chan.ops = &ppp_ops; -+#endif -+ -+ retval = ppp_register_channel(&mp->chan, val); -+ if (retval) -+ return retval; -+ mp->chan_connected = 1; -+ mp->chan_index = val; -+ } -+ return 0; -+ case PPPIOCDETACH: -+ { -+ if (!mp->chan_connected) -+ return -ENXIO; -+ ppp_unregister_channel(&mp->chan); -+ mp->chan_connected = 0; -+ } -+ return 0; -+ case PPPIOCGUNIT: -+ { -+ if (!mp->chan_connected) -+ return -ENXIO; -+ if (put_user(mp->chan_index, (int *) arg)) -+ return -EFAULT; -+ } -+ return 0; -+#endif - } - return -EINVAL; - } -@@ -1260,7 +1379,9 @@ - - static struct file_operations capinc_raw_fops = - { -+#ifdef COMPAT_HAS_FILEOP_OWNER - owner: THIS_MODULE, -+#endif - llseek: no_llseek, - read: capinc_raw_read, - write: capinc_raw_write, -@@ -1272,7 +1393,7 @@ - - /* -------- tty_operations for capincci ----------------------------- */ - --static int capinc_tty_open(struct tty_struct * tty, struct file * file) -+int capinc_tty_open(struct tty_struct * tty, struct file * file) - { - struct capiminor *mp; - -@@ -1300,7 +1421,7 @@ - return 0; - } - --static void capinc_tty_close(struct tty_struct * tty, struct file * file) -+void capinc_tty_close(struct tty_struct * tty, struct file * file) - { - struct capiminor *mp; - -@@ -1325,8 +1446,8 @@ - #endif - } - --static int capinc_tty_write(struct tty_struct * tty, int from_user, -- const unsigned char *buf, int count) -+int capinc_tty_write(struct tty_struct * tty, int from_user, -+ const unsigned char *buf, int count) - { - struct capiminor *mp = (struct capiminor *)tty->driver_data; - struct sk_buff *skb; -@@ -1377,7 +1498,7 @@ - return count; - } - --static void capinc_tty_put_char(struct tty_struct *tty, unsigned char ch) -+void capinc_tty_put_char(struct tty_struct *tty, unsigned char ch) - { - struct capiminor *mp = (struct capiminor *)tty->driver_data; - struct sk_buff *skb; -@@ -1414,7 +1535,7 @@ - } - } - --static void capinc_tty_flush_chars(struct tty_struct *tty) -+void capinc_tty_flush_chars(struct tty_struct *tty) - { - struct capiminor *mp = (struct capiminor *)tty->driver_data; - struct sk_buff *skb; -@@ -1440,7 +1561,7 @@ - (void)handle_minor_recv(mp); - } - --static int capinc_tty_write_room(struct tty_struct *tty) -+int capinc_tty_write_room(struct tty_struct *tty) - { - struct capiminor *mp = (struct capiminor *)tty->driver_data; - int room; -@@ -1458,7 +1579,7 @@ - return room; - } - --static int capinc_tty_chars_in_buffer(struct tty_struct *tty) -+int capinc_tty_chars_in_buffer(struct tty_struct *tty) - { - struct capiminor *mp = (struct capiminor *)tty->driver_data; - if (!mp || !mp->nccip) { -@@ -1476,7 +1597,7 @@ - return mp->outbytes; - } - --static int capinc_tty_ioctl(struct tty_struct *tty, struct file * file, -+int capinc_tty_ioctl(struct tty_struct *tty, struct file * file, - unsigned int cmd, unsigned long arg) - { - int error = 0; -@@ -1488,14 +1609,14 @@ - return error; - } - --static void capinc_tty_set_termios(struct tty_struct *tty, struct termios * old) -+void capinc_tty_set_termios(struct tty_struct *tty, struct termios * old) - { - #ifdef _DEBUG_TTYFUNCS - printk(KERN_DEBUG "capinc_tty_set_termios\n"); - #endif - } - --static void capinc_tty_throttle(struct tty_struct * tty) -+void capinc_tty_throttle(struct tty_struct * tty) - { - struct capiminor *mp = (struct capiminor *)tty->driver_data; - #ifdef _DEBUG_TTYFUNCS -@@ -1505,7 +1626,7 @@ - mp->ttyinstop = 1; - } - --static void capinc_tty_unthrottle(struct tty_struct * tty) -+void capinc_tty_unthrottle(struct tty_struct * tty) - { - struct capiminor *mp = (struct capiminor *)tty->driver_data; - #ifdef _DEBUG_TTYFUNCS -@@ -1517,7 +1638,7 @@ - } - } - --static void capinc_tty_stop(struct tty_struct *tty) -+void capinc_tty_stop(struct tty_struct *tty) - { - struct capiminor *mp = (struct capiminor *)tty->driver_data; - #ifdef _DEBUG_TTYFUNCS -@@ -1528,7 +1649,7 @@ - } - } - --static void capinc_tty_start(struct tty_struct *tty) -+void capinc_tty_start(struct tty_struct *tty) - { - struct capiminor *mp = (struct capiminor *)tty->driver_data; - #ifdef _DEBUG_TTYFUNCS -@@ -1540,43 +1661,49 @@ - } - } - --static void capinc_tty_hangup(struct tty_struct *tty) -+void capinc_tty_hangup(struct tty_struct *tty) - { - #ifdef _DEBUG_TTYFUNCS - printk(KERN_DEBUG "capinc_tty_hangup\n"); - #endif - } - --static void capinc_tty_break_ctl(struct tty_struct *tty, int state) -+void capinc_tty_break_ctl(struct tty_struct *tty, int state) - { - #ifdef _DEBUG_TTYFUNCS - printk(KERN_DEBUG "capinc_tty_break_ctl(%d)\n", state); - #endif - } - --static void capinc_tty_flush_buffer(struct tty_struct *tty) -+void capinc_tty_flush_buffer(struct tty_struct *tty) - { - #ifdef _DEBUG_TTYFUNCS - printk(KERN_DEBUG "capinc_tty_flush_buffer\n"); - #endif - } - --static void capinc_tty_set_ldisc(struct tty_struct *tty) -+void capinc_tty_set_ldisc(struct tty_struct *tty) - { - #ifdef _DEBUG_TTYFUNCS - printk(KERN_DEBUG "capinc_tty_set_ldisc\n"); - #endif - } - --static void capinc_tty_send_xchar(struct tty_struct *tty, char ch) -+void capinc_tty_send_xchar(struct tty_struct *tty, char ch) - { - #ifdef _DEBUG_TTYFUNCS - printk(KERN_DEBUG "capinc_tty_send_xchar(%d)\n", ch); - #endif - } - --static int capinc_tty_read_proc(char *page, char **start, off_t off, -- int count, int *eof, void *data) -+int capinc_tty_read_proc(char *page, char **start, off_t off, -+ int count, int *eof, void *data) -+{ -+ return 0; -+} -+ -+int capinc_write_proc(struct file *file, const char *buffer, -+ unsigned long count, void *data) - { - return 0; - } -@@ -1588,7 +1715,7 @@ - static struct termios *capinc_tty_termios[CAPINC_NR_PORTS]; - static struct termios *capinc_tty_termios_locked[CAPINC_NR_PORTS]; - --static int capinc_tty_init(void) -+int capinc_tty_init(void) - { - struct tty_driver *drv = &capinc_tty_driver; - -@@ -1646,7 +1773,7 @@ - return 0; - } - --static void capinc_tty_exit(void) -+void capinc_tty_exit(void) - { - struct tty_driver *drv = &capinc_tty_driver; - int retval; -@@ -1771,8 +1898,9 @@ - - /* -------- init function and module interface ---------------------- */ - -+#ifdef COMPAT_HAS_kmem_cache - --static void alloc_exit(void) -+static void __exit alloc_exit(void) - { - if (capidev_cachep) { - (void)kmem_cache_destroy(capidev_cachep); -@@ -1837,8 +1965,9 @@ - #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ - return 0; - } -+#endif - --static void lower_callback(unsigned int cmd, u32 contr, void *data) -+static void lower_callback(unsigned int cmd, __u32 contr, void *data) - { - struct capi_ncciinfo *np; - struct capidev *cdev; -@@ -1900,15 +2029,19 @@ - MOD_DEC_USE_COUNT; - return -EIO; - } -+#ifdef HAVE_DEVFS_FS - devfs_register_series (NULL, "capi/r%u", CAPINC_NR_PORTS, - DEVFS_FL_DEFAULT, - capi_rawmajor, 0, - S_IFCHR | S_IRUSR | S_IWUSR, - &capinc_raw_fops, NULL); -+#endif - #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ -+#ifdef HAVE_DEVFS_FS - devfs_register (NULL, "isdn/capi20", DEVFS_FL_DEFAULT, - capi_major, 0, S_IFCHR | S_IRUSR | S_IWUSR, - &capi_fops, NULL); -+#endif - printk(KERN_NOTICE "capi20: started up with major %d\n", capi_major); - - if ((capifuncs = attach_capi_interface(&cuser)) == 0) { -@@ -1918,9 +2051,11 @@ - #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE - devfs_unregister_chrdev(capi_rawmajor, "capi/r%d"); - #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ -+#ifdef HAVE_DEVFS_FS - devfs_unregister(devfs_find_handle(NULL, "capi20", - capi_major, 0, - DEVFS_SPECIAL_CHR, 0)); -+#endif - return -EIO; - } - -@@ -1934,8 +2069,10 @@ - } - #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ - -+#ifdef COMPAT_HAS_kmem_cache - if (alloc_init() < 0) { - #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE -+#ifdef HAVE_DEVFS_FS - unsigned int j; - devfs_unregister_chrdev(capi_rawmajor, "capi/r%d"); - for (j = 0; j < CAPINC_NR_PORTS; j++) { -@@ -1943,16 +2080,20 @@ - sprintf(devname, "capi/r%u", j); - devfs_unregister(devfs_find_handle(NULL, devname, capi_rawmajor, j, DEVFS_SPECIAL_CHR, 0)); - } -+#endif - capinc_tty_exit(); - #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ - (void) detach_capi_interface(&cuser); - devfs_unregister_chrdev(capi_major, "capi20"); -+#ifdef HAVE_DEVFS_FS - devfs_unregister(devfs_find_handle(NULL, "capi20", - capi_major, 0, - DEVFS_SPECIAL_CHR, 0)); -+#endif - MOD_DEC_USE_COUNT; - return -ENOMEM; - } -+#endif /* COMPAT_HAS_kmem_cache */ - - (void)proc_init(); - -@@ -1975,23 +2116,31 @@ - static void __exit capi_exit(void) - { - #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE -+#ifdef HAVE_DEVFS_FS - unsigned int j; - #endif -+#endif -+#ifdef COMPAT_HAS_kmem_cache - alloc_exit(); -+#endif - (void)proc_exit(); - - devfs_unregister_chrdev(capi_major, "capi20"); -+#ifdef HAVE_DEVFS_FS - devfs_unregister(devfs_find_handle(NULL, "isdn/capi20", capi_major, 0, DEVFS_SPECIAL_CHR, 0)); -+#endif - - #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE - capinc_tty_exit(); - devfs_unregister_chrdev(capi_rawmajor, "capi/r%d"); -+#ifdef HAVE_DEVFS_FS - for (j = 0; j < CAPINC_NR_PORTS; j++) { - char devname[32]; - sprintf(devname, "capi/r%u", j); - devfs_unregister(devfs_find_handle(NULL, devname, capi_rawmajor, j, DEVFS_SPECIAL_CHR, 0)); - } - #endif -+#endif - (void) detach_capi_interface(&cuser); - printk(KERN_NOTICE "capi: Rev %s: unloaded\n", rev); - } -diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/capicmd.h linux-2.4.29/drivers/isdn/avmb1/capicmd.h ---- linux-2.4.29.old/drivers/isdn/avmb1/capicmd.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/avmb1/capicmd.h 2005-03-22 15:06:44.865272224 +0100 -@@ -1,4 +1,4 @@ --/* $Id: capicmd.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: capicmd.h,v 1.4 2001/09/24 13:22:44 kai Exp $ - * - * CAPI 2.0 Interface for Linux - * -diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/capidev.h linux-2.4.29/drivers/isdn/avmb1/capidev.h ---- linux-2.4.29.old/drivers/isdn/avmb1/capidev.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/avmb1/capidev.h 2005-03-22 15:06:44.880269944 +0100 -@@ -1,4 +1,4 @@ --/* $Id: capidev.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: capidev.h,v 1.8 2001/09/24 13:22:44 kai Exp $ - * - * CAPI 2.0 Interface for Linux - * -diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/capidrv.c linux-2.4.29/drivers/isdn/avmb1/capidrv.c ---- linux-2.4.29.old/drivers/isdn/avmb1/capidrv.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/avmb1/capidrv.c 2005-03-22 15:06:44.918264168 +0100 -@@ -1,4 +1,4 @@ --/* $Id: capidrv.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: capidrv.c,v 1.45 2001/09/24 13:22:44 kai Exp $ - * - * ISDN4Linux Driver, using capi20 interface (kernelcapi) - * -@@ -35,7 +35,7 @@ - #include "capicmd.h" - #include "capidrv.h" - --static char *revision = "$Revision: 1.1.4.1 $"; -+static char *revision = "$Revision: 1.45 $"; - static int debugmode = 0; - - MODULE_DESCRIPTION("CAPI4Linux: Interface to ISDN4Linux"); -@@ -105,7 +105,6 @@ - int oldstate; - /* */ - __u16 datahandle; -- spinlock_t lock; - struct ncci_datahandle_queue { - struct ncci_datahandle_queue *next; - __u16 datahandle; -@@ -423,7 +422,6 @@ - nccip->plcip = plcip; - nccip->chan = plcip->chan; - nccip->datahandle = 0; -- nccip->lock = SPIN_LOCK_UNLOCKED; - - nccip->next = plcip->ncci_list; - plcip->ncci_list = nccip; -@@ -480,7 +478,6 @@ - __u16 datahandle, int len) - { - struct ncci_datahandle_queue *n, **pp; -- unsigned long flags; - - n = (struct ncci_datahandle_queue *) - kmalloc(sizeof(struct ncci_datahandle_queue), GFP_ATOMIC); -@@ -491,31 +488,25 @@ - n->next = 0; - n->datahandle = datahandle; - n->len = len; -- spin_lock_irqsave(&nccip->lock, flags); - for (pp = &nccip->ackqueue; *pp; pp = &(*pp)->next) ; - *pp = n; -- spin_unlock_irqrestore(&nccip->lock, flags); - return 0; - } - - static int capidrv_del_ack(struct capidrv_ncci *nccip, __u16 datahandle) - { - struct ncci_datahandle_queue **pp, *p; -- unsigned long flags; - int len; - -- spin_lock_irqsave(&nccip->lock, flags); - for (pp = &nccip->ackqueue; *pp; pp = &(*pp)->next) { - if ((*pp)->datahandle == datahandle) { - p = *pp; - len = p->len; - *pp = (*pp)->next; -- spin_unlock_irqrestore(&nccip->lock, flags); - kfree(p); - return len; - } - } -- spin_unlock_irqrestore(&nccip->lock, flags); - return -1; - } - -@@ -523,25 +514,13 @@ - - static void send_message(capidrv_contr * card, _cmsg * cmsg) - { -- struct sk_buff *skb; -- size_t len; -- u16 err; -- -+ struct sk_buff *skb; -+ size_t len; - capi_cmsg2message(cmsg, cmsg->buf); - len = CAPIMSG_LEN(cmsg->buf); - skb = alloc_skb(len, GFP_ATOMIC); -- if(!skb) { -- printk(KERN_ERR "no skb len(%d) memory\n", len); -- return; -- } - memcpy(skb_put(skb, len), cmsg->buf, len); -- err = (*capifuncs->capi_put_message) (global.appid, skb); -- if (err) { -- printk(KERN_WARNING "%s: capi_put_message error: %04x\n", -- __FUNCTION__, err); -- kfree_skb(skb); -- return; -- } -+ (*capifuncs->capi_put_message) (global.appid, skb); - global.nsentctlpkt++; - } - -@@ -1932,8 +1911,10 @@ - (void)capidrv_del_ack(nccip, datahandle); - return 0; - } -+#if 1 - printk(KERN_DEBUG "capidrv-%d: only %d bytes headroom, need %d\n", - card->contrnr, skb_headroom(skb), msglen); -+#endif - memcpy(skb_push(nskb, msglen), sendcmsg.buf, msglen); - errcode = (*capifuncs->capi_put_message) (global.appid, nskb); - if (errcode == CAPI_NOERROR) { -@@ -2035,6 +2016,52 @@ - send_message(card, &cmdcmsg); - } - -+#if 0 -+static void disable_dchannel_trace(capidrv_contr *card) -+{ -+ __u8 manufacturer[CAPI_MANUFACTURER_LEN]; -+ capi_version version; -+ __u16 contr = card->contrnr; -+ __u16 errcode; -+ __u16 avmversion[3]; -+ -+ errcode = (*capifuncs->capi_get_manufacturer)(contr, manufacturer); -+ if (errcode != CAPI_NOERROR) { -+ printk(KERN_ERR "%s: can't get manufacturer (0x%x)\n", -+ card->name, errcode); -+ return; -+ } -+ if (strstr(manufacturer, "AVM") == 0) { -+ printk(KERN_ERR "%s: not from AVM, no d-channel trace possible (%s)\n", -+ card->name, manufacturer); -+ return; -+ } -+ errcode = (*capifuncs->capi_get_version)(contr, &version); -+ if (errcode != CAPI_NOERROR) { -+ printk(KERN_ERR "%s: can't get version (0x%x)\n", -+ card->name, errcode); -+ return; -+ } -+ avmversion[0] = (version.majormanuversion >> 4) & 0x0f; -+ avmversion[1] = (version.majormanuversion << 4) & 0xf0; -+ avmversion[1] |= (version.minormanuversion >> 4) & 0x0f; -+ avmversion[2] |= version.minormanuversion & 0x0f; -+ -+ if (avmversion[0] > 3 || (avmversion[0] == 3 && avmversion[1] > 5)) { -+ printk(KERN_INFO "%s: D2 trace disabled\n", card->name); -+ } else { -+ printk(KERN_INFO "%s: D3 trace disabled\n", card->name); -+ } -+ capi_fill_MANUFACTURER_REQ(&cmdcmsg, global.appid, -+ card->msgid++, -+ contr, -+ 0x214D5641, /* ManuID */ -+ 0, /* Class */ -+ 1, /* Function */ -+ (_cstruct)"\004\000\000\000\000"); -+ send_message(card, &cmdcmsg); -+} -+#endif - - static void send_listen(capidrv_contr *card) - { -@@ -2200,10 +2227,10 @@ - free_ncci(card, card->bchans[card->nbchan-1].nccip); - if (card->bchans[card->nbchan-1].plcip) - free_plci(card, card->bchans[card->nbchan-1].plcip); -+ if (card->plci_list) -+ printk(KERN_ERR "capidrv: bug in free_plci()\n"); - card->nbchan--; - } -- if (card->plci_list) -- printk(KERN_ERR "capidrv: bug in free_plci()\n"); - kfree(card->bchans); - card->bchans = 0; - -diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/capidrv.h linux-2.4.29/drivers/isdn/avmb1/capidrv.h ---- linux-2.4.29.old/drivers/isdn/avmb1/capidrv.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/avmb1/capidrv.h 2005-03-22 15:06:44.935261584 +0100 -@@ -1,4 +1,4 @@ --/* $Id: capidrv.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: capidrv.h,v 1.4 2001/09/24 13:22:44 kai Exp $ - * - * ISDN4Linux Driver, using capi20 interface (kernelcapi) - * -diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/capifs.c linux-2.4.29/drivers/isdn/avmb1/capifs.c ---- linux-2.4.29.old/drivers/isdn/avmb1/capifs.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/avmb1/capifs.c 2005-03-22 15:06:44.950259304 +0100 -@@ -1,4 +1,4 @@ --/* $Id: capifs.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: capifs.c,v 1.22 2001/09/24 13:22:44 kai Exp $ - * - * Copyright 2000 by Carsten Paeth - * -@@ -25,6 +25,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -32,7 +33,7 @@ - MODULE_AUTHOR("Carsten Paeth"); - MODULE_LICENSE("GPL"); - --static char *revision = "$Revision: 1.1.4.1 $"; -+static char *revision = "$Revision: 1.22 $"; - - struct capifs_ncci { - struct inode *inode; -@@ -69,14 +70,21 @@ - static int capifs_root_readdir(struct file *,void *,filldir_t); - static struct dentry *capifs_root_lookup(struct inode *,struct dentry *); - static int capifs_revalidate(struct dentry *, int); -+#ifdef COMPAT_VFS_2_4 - static struct inode *capifs_new_inode(struct super_block *sb); -+#endif - - static struct file_operations capifs_root_operations = { -+#ifdef COMPAT_VFS_2_4 - read: generic_read_dir, -+#endif - readdir: capifs_root_readdir, - }; - - struct inode_operations capifs_root_inode_operations = { -+#ifndef COMPAT_VFS_2_4 -+ default_file_ops: &capifs_root_operations, /* file operations */ -+#endif - lookup: capifs_root_lookup, - }; - -@@ -101,12 +109,20 @@ - switch(nr) - { - case 0: -+#ifdef COMPAT_VFS_2_4 - if (filldir(dirent, ".", 1, nr, inode->i_ino, DT_DIR) < 0) -+#else -+ if (filldir(dirent, ".", 1, nr, inode->i_ino) < 0) -+#endif - return 0; - filp->f_pos = ++nr; - /* fall through */ - case 1: -+#ifdef COMPAT_VFS_2_4 - if (filldir(dirent, "..", 2, nr, inode->i_ino, DT_DIR) < 0) -+#else -+ if (filldir(dirent, "..", 2, nr, inode->i_ino) < 0) -+#endif - return 0; - filp->f_pos = ++nr; - /* fall through */ -@@ -118,7 +134,11 @@ - char *p = numbuf; - if (np->type) *p++ = np->type; - sprintf(p, "%u", np->num); -+#ifdef COMPAT_VFS_2_4 - if ( filldir(dirent, numbuf, strlen(numbuf), nr, nr, DT_UNKNOWN) < 0 ) -+#else -+ if ( filldir(dirent, numbuf, strlen(numbuf), nr, nr) < 0 ) -+#endif - return 0; - } - filp->f_pos = ++nr; -@@ -180,7 +200,7 @@ - - dentry->d_inode = np->inode; - if ( dentry->d_inode ) -- atomic_inc(&dentry->d_inode->i_count); -+ i_count_inc(dentry->d_inode->i_count); - - d_add(dentry, dentry->d_inode); - -@@ -199,9 +219,9 @@ - - for ( i = 0 ; i < sbi->max_ncci ; i++ ) { - if ( (inode = sbi->nccis[i].inode) ) { -- if (atomic_read(&inode->i_count) != 1 ) -+ if (i_count_read(inode->i_count) != 1 ) - printk("capifs_put_super: badness: entry %d count %d\n", -- i, (unsigned)atomic_read(&inode->i_count)); -+ i, (unsigned)i_count_read(inode->i_count)); - inode->i_nlink--; - iput(inode); - } -@@ -213,11 +233,24 @@ - - kfree(sbi->nccis); - kfree(sbi); -+#ifndef COMPAT_VFS_2_4 -+ MOD_DEC_USE_COUNT; -+#endif - } - -+#ifdef COMPAT_VFS_2_4 - static int capifs_statfs(struct super_block *sb, struct statfs *buf); -+#else -+static int capifs_statfs(struct super_block *sb, struct statfs *buf, int bufsiz); -+static void capifs_write_inode(struct inode *inode) { }; -+static void capifs_read_inode(struct inode *inode); -+#endif - - static struct super_operations capifs_sops = { -+#ifndef COMPAT_VFS_2_4 -+ read_inode: capifs_read_inode, -+ write_inode: capifs_write_inode, -+#endif - put_super: capifs_put_super, - statfs: capifs_statfs, - }; -@@ -288,6 +321,10 @@ - struct dentry * root; - struct capifs_sb_info *sbi; - -+#ifndef COMPAT_VFS_2_4 -+ MOD_INC_USE_COUNT; -+ lock_super(s); -+#endif - /* Super block already completed? */ - if (s->s_root) - goto out; -@@ -322,6 +359,7 @@ - /* - * Get the root inode and dentry, but defer checking for errors. - */ -+#ifdef COMPAT_VFS_2_4 - root_inode = capifs_new_inode(s); - if (root_inode) { - root_inode->i_ino = 1; -@@ -331,6 +369,10 @@ - root_inode->i_nlink = 2; - } - root = d_alloc_root(root_inode); -+#else -+ root_inode = iget(s, 1); /* inode 1 == root directory */ -+ root = d_alloc_root(root_inode, NULL); -+#endif - - /* - * Check whether somebody else completed the super block. -@@ -370,11 +412,34 @@ - mounts = s; - - out: /* Success ... somebody else completed the super block for us. */ -+#ifndef COMPAT_VFS_2_4 -+ unlock_super(s); -+#endif - return s; - fail: -+#ifndef COMPAT_VFS_2_4 -+ unlock_super(s); -+ MOD_DEC_USE_COUNT; -+#endif - return NULL; - } - -+#ifndef COMPAT_VFS_2_4 -+static int capifs_statfs(struct super_block *sb, struct statfs *buf, int bufsiz) -+{ -+ struct statfs tmp; -+ -+ tmp.f_type = CAPIFS_SUPER_MAGIC; -+ tmp.f_bsize = 1024; -+ tmp.f_blocks = 0; -+ tmp.f_bfree = 0; -+ tmp.f_bavail = 0; -+ tmp.f_files = 0; -+ tmp.f_ffree = 0; -+ tmp.f_namelen = NAME_MAX; -+ return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0; -+} -+#else - static int capifs_statfs(struct super_block *sb, struct statfs *buf) - { - buf->f_type = CAPIFS_SUPER_MAGIC; -@@ -387,7 +452,9 @@ - buf->f_namelen = NAME_MAX; - return 0; - } -+#endif - -+#ifdef COMPAT_VFS_2_4 - static struct inode *capifs_new_inode(struct super_block *sb) - { - struct inode *inode = new_inode(sb); -@@ -399,8 +466,51 @@ - } - return inode; - } -+#else -+static void capifs_read_inode(struct inode *inode) -+{ -+ ino_t ino = inode->i_ino; -+ struct capifs_sb_info *sbi = SBI(inode->i_sb); -+ -+ inode->i_mode = 0; -+ inode->i_nlink = 0; -+ inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; -+ inode->i_blocks = 0; -+ inode->i_blksize = 1024; -+ inode->i_uid = inode->i_gid = 0; -+ -+ if ( ino == 1 ) { -+ inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR; -+ inode->i_op = &capifs_root_inode_operations; -+ inode->i_nlink = 2; -+ return; -+ } - -+ ino -= 2; -+ if ( ino >= sbi->max_ncci ) -+ return; /* Bogus */ -+ -+#ifdef COMPAT_VFS_2_4 -+ init_special_inode(inode, S_IFCHR, 0); -+#else -+ inode->i_mode = S_IFCHR; -+ inode->i_op = &chrdev_inode_operations; -+#endif -+ -+ return; -+} -+#endif -+ -+#ifndef COMPAT_VFS_2_4 -+static struct file_system_type capifs_fs_type = { -+ "capifs", -+ 0, -+ capifs_read_super, -+ NULL -+}; -+#else - static DECLARE_FSTYPE(capifs_fs_type, "capifs", capifs_read_super, 0); -+#endif - - void capifs_new_ncci(char type, unsigned int num, kdev_t device) - { -@@ -421,16 +531,26 @@ - break; - } - } -+#ifdef COMPAT_VFS_2_4 - if ( ino >= sbi->max_ncci ) - continue; - - if ((np->inode = capifs_new_inode(sb)) != NULL) { -+#else -+ if ((np->inode = iget(sb, ino+2)) != NULL) { -+#endif - struct inode *inode = np->inode; - inode->i_uid = sbi->setuid ? sbi->uid : current->fsuid; - inode->i_gid = sbi->setgid ? sbi->gid : current->fsgid; -+#ifdef COMPAT_VFS_2_4 - inode->i_nlink = 1; - inode->i_ino = ino + 2; - init_special_inode(inode, sbi->mode|S_IFCHR, np->kdev); -+#else -+ inode->i_mode = sbi->mode | S_IFCHR; -+ inode->i_rdev = np->kdev; -+ inode->i_nlink++; -+#endif - } - } - } -diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/capifs.h linux-2.4.29/drivers/isdn/avmb1/capifs.h ---- linux-2.4.29.old/drivers/isdn/avmb1/capifs.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/avmb1/capifs.h 2005-03-22 15:06:44.965257024 +0100 -@@ -1,4 +1,4 @@ --/* $Id: capifs.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: capifs.h,v 1.4 2001/09/24 13:22:44 kai Exp $ - * - * Copyright 2000 by Carsten Paeth - * -diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/capilli.h linux-2.4.29/drivers/isdn/avmb1/capilli.h ---- linux-2.4.29.old/drivers/isdn/avmb1/capilli.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/avmb1/capilli.h 2005-03-22 15:06:44.980254744 +0100 -@@ -1,4 +1,4 @@ --/* $Id: capilli.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: capilli.h,v 1.5 2001/09/24 13:22:44 kai Exp $ - * - * Kernel CAPI 2.0 Driver Interface for Linux - * -diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/capiutil.c linux-2.4.29/drivers/isdn/avmb1/capiutil.c ---- linux-2.4.29.old/drivers/isdn/avmb1/capiutil.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/avmb1/capiutil.c 2005-03-22 15:06:44.997252160 +0100 -@@ -1,4 +1,4 @@ --/* $Id: capiutil.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: capiutil.c,v 1.16 2001/09/24 13:22:44 kai Exp $ - * - * CAPI 2.0 convert capi message to capi message struct - * -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - #include "capiutil.h" - - MODULE_DESCRIPTION("CAPI4Linux: CAPI message conversion support"); -diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/capiutil.h linux-2.4.29/drivers/isdn/avmb1/capiutil.h ---- linux-2.4.29.old/drivers/isdn/avmb1/capiutil.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/avmb1/capiutil.h 2005-03-22 15:06:45.040245624 +0100 -@@ -1,4 +1,4 @@ --/* $Id: capiutil.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: capiutil.h,v 1.7 2001/09/24 13:22:44 kai Exp $ - * - * CAPI 2.0 defines & types - * -diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/kcapi.c linux-2.4.29/drivers/isdn/avmb1/kcapi.c ---- linux-2.4.29.old/drivers/isdn/avmb1/kcapi.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/avmb1/kcapi.c 2005-03-22 15:06:45.062242280 +0100 -@@ -1,4 +1,4 @@ --/* $Id: kcapi.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: kcapi.c,v 1.28 2001/09/24 13:22:44 kai Exp $ - * - * Kernel CAPI 2.0 Module - * -@@ -21,6 +21,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -33,7 +34,7 @@ - #include - #endif - --static char *revision = "$Revision: 1.1.4.1 $"; -+static char *revision = "$Revision: 1.28 $"; - - /* ------------------------------------------------------------- */ - -@@ -64,7 +65,6 @@ - __u32 ncci; - __u32 winsize; - int nmsg; -- spinlock_t lock; - struct msgidqueue *msgidqueue; - struct msgidqueue *msgidlast; - struct msgidqueue *msgidfree; -@@ -104,14 +104,14 @@ - #define APPL(a) (&applications[(a)-1]) - #define VALID_APPLID(a) ((a) && (a) <= CAPI_MAXAPPL && APPL(a)->applid == a) - #define APPL_IS_FREE(a) (APPL(a)->applid == 0) --#define APPL_MARK_FREE(a) do{ APPL(a)->applid=0; MOD_DEC_USE_COUNT; }while(0) --#define APPL_MARK_USED(a) do{ APPL(a)->applid=(a); MOD_INC_USE_COUNT; }while(0) -+#define APPL_MARK_FREE(a) do{ APPL(a)->applid=0; MOD_DEC_USE_COUNT; }while(0); -+#define APPL_MARK_USED(a) do{ APPL(a)->applid=(a); MOD_INC_USE_COUNT; }while(0); - - #define NCCI2CTRL(ncci) (((ncci) >> 24) & 0x7f) - - #define VALID_CARD(c) ((c) > 0 && (c) <= CAPI_MAXCONTR) - #define CARD(c) (&cards[(c)-1]) --#define CARDNR(cp) ((((cp)-cards)+1) & 0xff) -+#define CARDNR(cp) (((cp)-cards)+1) - - static struct capi_appl applications[CAPI_MAXAPPL]; - static struct capi_ctr cards[CAPI_MAXCONTR]; -@@ -535,9 +535,13 @@ - * of devices. Devices can only removed in - * user process, not in bh. - */ -+#ifdef COMPAT_HAS_SCHEDULE_TASK - MOD_INC_USE_COUNT; - if (schedule_task(&tq_state_notify) == 0) - MOD_DEC_USE_COUNT; -+#else -+ queue_task(&tq_state_notify, &tq_scheduler); -+#endif - return 0; - } - -@@ -546,13 +550,7 @@ - static void notify_up(__u32 contr) - { - struct capi_interface_user *p; -- __u16 appl; - -- for (appl = 1; appl <= CAPI_MAXAPPL; appl++) { -- if (!VALID_APPLID(appl)) continue; -- if (APPL(appl)->releasing) continue; -- CARD(contr)->driver->register_appl(CARD(contr), appl, &APPL(appl)->rparam); -- } - printk(KERN_NOTICE "kcapi: notify up contr %d\n", contr); - spin_lock(&capi_users_lock); - for (p = capi_users; p; p = p->next) { -@@ -639,7 +637,9 @@ - kfree(np); - MOD_DEC_USE_COUNT; - } -+#ifdef COMPAT_HAS_SCHEDULE_TASK - MOD_DEC_USE_COUNT; -+#endif - } - - /* -------- NCCI Handling ------------------------------------- */ -@@ -647,7 +647,6 @@ - static inline void mq_init(struct capi_ncci * np) - { - int i; -- np->lock = SPIN_LOCK_UNLOCKED; - np->msgidqueue = 0; - np->msgidlast = 0; - np->nmsg = 0; -@@ -662,11 +661,8 @@ - static inline int mq_enqueue(struct capi_ncci * np, __u16 msgid) - { - struct msgidqueue *mq; -- spin_lock_bh(&np->lock); -- if ((mq = np->msgidfree) == 0) { -- spin_unlock_bh(&np->lock); -+ if ((mq = np->msgidfree) == 0) - return 0; -- } - np->msgidfree = mq->next; - mq->msgid = msgid; - mq->next = 0; -@@ -676,14 +672,12 @@ - if (!np->msgidqueue) - np->msgidqueue = mq; - np->nmsg++; -- spin_unlock_bh(&np->lock); - return 1; - } - - static inline int mq_dequeue(struct capi_ncci * np, __u16 msgid) - { - struct msgidqueue **pp; -- spin_lock_bh(&np->lock); - for (pp = &np->msgidqueue; *pp; pp = &(*pp)->next) { - if ((*pp)->msgid == msgid) { - struct msgidqueue *mq = *pp; -@@ -693,11 +687,9 @@ - mq->next = np->msgidfree; - np->msgidfree = mq; - np->nmsg--; -- spin_unlock_bh(&np->lock); - return 1; - } - } -- spin_unlock_bh(&np->lock); - return 0; - } - -@@ -720,16 +712,12 @@ - nextpp = &(*pp)->next; - } - } -- if (APPL(appl)->releasing) { /* only release if the application was marked for release */ -- printk(KERN_DEBUG "kcapi: appl %d releasing(%d)\n", appl, APPL(appl)->releasing); -- APPL(appl)->releasing--; -- if (APPL(appl)->releasing <= 0) { -- APPL(appl)->signal = 0; -- APPL_MARK_FREE(appl); -- printk(KERN_INFO "kcapi: appl %d down\n", appl); -- } -- } else -- printk(KERN_WARNING "kcapi: appl %d card%d released without request\n", appl, card->cnr); -+ APPL(appl)->releasing--; -+ if (APPL(appl)->releasing <= 0) { -+ APPL(appl)->signal = 0; -+ APPL_MARK_FREE(appl); -+ printk(KERN_INFO "kcapi: appl %d down\n", appl); -+ } - } - /* - * ncci management -@@ -882,7 +870,16 @@ - - static void controllercb_ready(struct capi_ctr * card) - { -+ __u16 appl; -+ - card->cardstate = CARD_RUNNING; -+ -+ for (appl = 1; appl <= CAPI_MAXAPPL; appl++) { -+ if (!VALID_APPLID(appl)) continue; -+ if (APPL(appl)->releasing) continue; -+ card->driver->register_appl(card, appl, &APPL(appl)->rparam); -+ } -+ - printk(KERN_NOTICE "kcapi: card %d \"%s\" ready.\n", - CARDNR(card), card->name); - -diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/t1isa.c linux-2.4.29/drivers/isdn/avmb1/t1isa.c ---- linux-2.4.29.old/drivers/isdn/avmb1/t1isa.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/avmb1/t1isa.c 2005-03-22 15:06:45.078239848 +0100 -@@ -1,4 +1,4 @@ --/* $Id: t1isa.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: t1isa.c,v 1.22 2001/09/24 13:22:44 kai Exp $ - * - * Module for AVM T1 HEMA-card. - * -@@ -19,13 +19,14 @@ - #include - #include - #include -+#include - #include - #include "capicmd.h" - #include "capiutil.h" - #include "capilli.h" - #include "avmcard.h" - --static char *revision = "$Revision: 1.1.4.1 $"; -+static char *revision = "$Revision: 1.22 $"; - - /* ------------------------------------------------------------- */ - -diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/t1pci.c linux-2.4.29/drivers/isdn/avmb1/t1pci.c ---- linux-2.4.29.old/drivers/isdn/avmb1/t1pci.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/avmb1/t1pci.c 2005-03-22 15:06:45.094237416 +0100 -@@ -1,4 +1,4 @@ --/* $Id: t1pci.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: t1pci.c,v 1.25 2001/09/24 13:22:44 kai Exp $ - * - * Module for AVM T1 PCI-card. - * -@@ -18,6 +18,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -26,19 +27,21 @@ - #include "capilli.h" - #include "avmcard.h" - --static char *revision = "$Revision: 1.1.4.1 $"; -+static char *revision = "$Revision: 1.25 $"; - - #undef CONFIG_T1PCI_DEBUG - #undef CONFIG_T1PCI_POLLDEBUG - - /* ------------------------------------------------------------- */ - -+#ifndef COMPAT_HAS_2_2_PCI - static struct pci_device_id t1pci_pci_tbl[] __initdata = { - { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_T1, PCI_ANY_ID, PCI_ANY_ID }, - { } /* Terminating entry */ - }; - - MODULE_DEVICE_TABLE(pci, t1pci_pci_tbl); -+#endif - MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM T1 PCI card"); - MODULE_AUTHOR("Carsten Paeth"); - MODULE_LICENSE("GPL"); -@@ -264,9 +267,9 @@ - } - pci_set_master(dev); - -- param.port = pci_resource_start(dev, 1); -+ param.port = pci_resource_start_io(dev, 1); - param.irq = dev->irq; -- param.membase = pci_resource_start(dev, 0); -+ param.membase = pci_resource_start_mem(dev, 0); - - printk(KERN_INFO - "%s: PCI BIOS reports AVM-T1-PCI at i/o %#x, irq %d, mem %#x\n", -diff -rNu linux-2.4.29.old/drivers/isdn/divert/divert_procfs.c linux-2.4.29/drivers/isdn/divert/divert_procfs.c ---- linux-2.4.29.old/drivers/isdn/divert/divert_procfs.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/divert/divert_procfs.c 2005-03-22 15:06:45.158227688 +0100 -@@ -1,4 +1,4 @@ --/* $Id: divert_procfs.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id$ - * - * Filesystem handling for the diversion supplementary services. - * -@@ -14,13 +14,16 @@ - #include - #include - #include -+#ifndef COMPAT_USE_MODCOUNT_LOCK - #include -+#endif - #ifdef CONFIG_PROC_FS - #include - #else - #include - #endif - #include -+#include - #include "isdn_divert.h" - - /*********************************/ -@@ -80,7 +83,6 @@ - isdn_divert_read(struct file *file, char *buf, size_t count, loff_t * off) - { - struct divert_info *inf; -- loff_t pos = *off; - int len; - - if (!*((struct divert_info **) file->private_data)) { -@@ -92,11 +94,11 @@ - return (0); - - inf->usage_cnt--; /* new usage count */ -- file->private_data = &inf->next; /* next structure */ -+ (struct divert_info **) file->private_data = &inf->next; /* next structure */ - if ((len = strlen(inf->info_start)) <= count) { - if (copy_to_user(buf, inf->info_start, len)) - return -EFAULT; -- *off = pos + len; -+ file->f_pos += len; - return (len); - } - return (0); -@@ -136,17 +138,23 @@ - { - unsigned long flags; - -+#ifdef COMPAT_USE_MODCOUNT_LOCK -+ MOD_INC_USE_COUNT; -+#else - lock_kernel(); -+#endif - save_flags(flags); - cli(); - if_used++; - if (divert_info_head) -- filep->private_data = &(divert_info_tail->next); -+ (struct divert_info **) filep->private_data = &(divert_info_tail->next); - else -- filep->private_data = &divert_info_head; -+ (struct divert_info **) filep->private_data = &divert_info_head; - restore_flags(flags); - /* start_divert(); */ -+#ifndef COMPAT_USE_MODCOUNT_LOCK - unlock_kernel(); -+#endif - return (0); - } /* isdn_divert_open */ - -@@ -159,7 +167,9 @@ - struct divert_info *inf; - unsigned long flags; - -+#ifndef COMPAT_USE_MODCOUNT_LOCK - lock_kernel(); -+#endif - save_flags(flags); - cli(); - if_used--; -@@ -175,7 +185,11 @@ - divert_info_head = divert_info_head->next; - kfree(inf); - } -+#ifdef COMPAT_USE_MODCOUNT_LOCK -+ MOD_DEC_USE_COUNT; -+#else - unlock_kernel(); -+#endif - return (0); - } /* isdn_divert_close */ - -@@ -276,6 +290,9 @@ - open: isdn_divert_open, - release: isdn_divert_close, - }; -+#ifdef COMPAT_NO_SOFTNET -+struct inode_operations divert_file_inode_operations; -+#endif - - /****************************/ - /* isdn subdir in /proc/net */ -@@ -302,8 +319,16 @@ - remove_proc_entry("isdn", proc_net); - return (-1); - } -+#ifdef COMPAT_NO_SOFTNET -+ memset(&divert_file_inode_operations, 0, sizeof(struct inode_operations)); -+ divert_file_inode_operations.default_file_ops = &isdn_fops; -+ isdn_divert_entry->ops = &divert_file_inode_operations; -+#else - isdn_divert_entry->proc_fops = &isdn_fops; -+#ifdef COMPAT_HAS_FILEOP_OWNER - isdn_divert_entry->owner = THIS_MODULE; -+#endif -+#endif /* COMPAT_NO_SOFTNET */ - #endif /* CONFIG_PROC_FS */ - - return (0); -diff -rNu linux-2.4.29.old/drivers/isdn/divert/isdn_divert.c linux-2.4.29/drivers/isdn/divert/isdn_divert.c ---- linux-2.4.29.old/drivers/isdn/divert/isdn_divert.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/divert/isdn_divert.c 2005-03-22 15:06:45.173225408 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn_divert.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id$ - * - * DSS1 main diversion supplementary handling for i4l. - * -@@ -84,6 +84,9 @@ - restore_flags(flags); - break; - -+ case NETWORK_DIAL: -+ divert_if.dial_net_name(cs->deflect_dest); -+ - case DEFLECT_AUTODEL: - default: - save_flags(flags); -@@ -452,6 +455,7 @@ - case DEFLECT_PROCEED: - case DEFLECT_REPORT: - case DEFLECT_REJECT: -+ case NETWORK_DIAL: - if (dv->rule.action == DEFLECT_PROCEED) - if ((!if_used) || ((!extern_wait_max) && (!dv->rule.waittime))) - return(0); /* no external deflection needed */ -@@ -495,6 +499,11 @@ - else - { cs->deflect_dest[0] = '\0'; - retval = 4; /* only proceed */ -+ if (cs->akt_state == NETWORK_DIAL) { -+ strcpy(cs->deflect_dest,dv->rule.to_nr); -+ cs->timer.expires = jiffies + 10; -+ retval = 0; -+ } - } - sprintf(cs->info,"%d 0x%lx %s %s %s %s 0x%x 0x%x %d %d %s\n", - cs->akt_state, -@@ -739,6 +748,18 @@ - } - - -+#if 0 -+ sprintf(st, "0x%lx 0x%lx",ic->arg, ic->parm.dss1_io.ll_id); -+ p = st + strlen(st); -+ p1 = ic->parm.dss1_io.data; -+ i = ic->parm.dss1_io.datalen; -+ while ((i > 0) && (p - st < 530)) -+ { p += sprintf(p," %02x",(*p1++) & 0xFF); -+ i--; -+ } -+ sprintf(p, "\n"); -+ put_info_buffer(st); -+#endif - break; - - default: -diff -rNu linux-2.4.29.old/drivers/isdn/divert/isdn_divert.h linux-2.4.29/drivers/isdn/divert/isdn_divert.h ---- linux-2.4.29.old/drivers/isdn/divert/isdn_divert.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/divert/isdn_divert.h 2005-03-22 15:06:45.189222976 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn_divert.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id$ - * - * Header for the diversion supplementary ioctl interface. - * -@@ -36,9 +36,10 @@ - #define DEFLECT_PROCEED 2 /* deflect when externally triggered */ - #define DEFLECT_ALERT 3 /* alert and deflect after delay */ - #define DEFLECT_REJECT 4 /* reject immediately */ --#define DIVERT_ACTIVATE 5 /* diversion activate */ --#define DIVERT_DEACTIVATE 6 /* diversion deactivate */ --#define DIVERT_REPORT 7 /* interrogation result */ -+#define NETWORK_DIAL 5 /* dial a network interface */ -+#define DIVERT_ACTIVATE 16 /* diversion activate */ -+#define DIVERT_DEACTIVATE 17 /* diversion deactivate */ -+#define DIVERT_REPORT 18 /* interrogation result */ - #define DEFLECT_AUTODEL 255 /* only for internal use */ - - #define DEFLECT_ALL_IDS 0xFFFFFFFF /* all drivers selected */ -@@ -60,6 +61,7 @@ - 2 = report call, send proceed, wait max waittime secs - 3 = report call, alert and deflect after waittime - 4 = report call, reject immediately -+ 5 = dial net interface specified in to_nr - actions 1-2 only take place if interface is opened - */ - u_char waittime; /* maximum wait time for proceeding */ -diff -rNu linux-2.4.29.old/drivers/isdn/eicon/Divas_mod.c linux-2.4.29/drivers/isdn/eicon/Divas_mod.c ---- linux-2.4.29.old/drivers/isdn/eicon/Divas_mod.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/eicon/Divas_mod.c 2005-03-22 15:06:45.229216896 +0100 -@@ -20,6 +20,7 @@ - #include "adapter.h" - #include "uxio.h" - -+#include - - MODULE_DESCRIPTION("ISDN4Linux: Driver for Eicon Diva Server cards"); - MODULE_AUTHOR("Armin Schindler"); -diff -rNu linux-2.4.29.old/drivers/isdn/eicon/common.c linux-2.4.29/drivers/isdn/eicon/common.c ---- linux-2.4.29.old/drivers/isdn/eicon/common.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/eicon/common.c 2005-03-22 15:06:45.301205952 +0100 -@@ -808,9 +808,7 @@ - - while(i--) - { -- if (card->state == DIA_RUNNING) -- DivaDoCardDpc(card); -- card++; -+ DivaDoCardDpc(card++); - } - } - -diff -rNu linux-2.4.29.old/drivers/isdn/eicon/eicon.h linux-2.4.29/drivers/isdn/eicon/eicon.h ---- linux-2.4.29.old/drivers/isdn/eicon/eicon.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/eicon/eicon.h 2005-03-22 15:06:45.371195312 +0100 -@@ -1,4 +1,4 @@ --/* $Id: eicon.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: eicon.h,v 1.26 2001/09/24 13:22:47 kai Exp $ - * - * ISDN low-level module for Eicon active ISDN-Cards. - * -@@ -348,19 +348,19 @@ - extern char *eicon_ctype_name[]; - - --static inline void eicon_schedule_tx(eicon_card *card) -+extern __inline__ void eicon_schedule_tx(eicon_card *card) - { - queue_task(&card->snd_tq, &tq_immediate); - mark_bh(IMMEDIATE_BH); - } - --static inline void eicon_schedule_rx(eicon_card *card) -+extern __inline__ void eicon_schedule_rx(eicon_card *card) - { - queue_task(&card->rcv_tq, &tq_immediate); - mark_bh(IMMEDIATE_BH); - } - --static inline void eicon_schedule_ack(eicon_card *card) -+extern __inline__ void eicon_schedule_ack(eicon_card *card) - { - queue_task(&card->ack_tq, &tq_immediate); - mark_bh(IMMEDIATE_BH); -diff -rNu linux-2.4.29.old/drivers/isdn/eicon/eicon_dsp.h linux-2.4.29/drivers/isdn/eicon/eicon_dsp.h ---- linux-2.4.29.old/drivers/isdn/eicon/eicon_dsp.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/eicon/eicon_dsp.h 2005-03-22 15:06:45.386193032 +0100 -@@ -1,4 +1,4 @@ --/* $Id: eicon_dsp.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: eicon_dsp.h,v 1.8 2001/09/24 13:22:47 kai Exp $ - * - * ISDN lowlevel-module for Eicon active cards. - * DSP definitions -diff -rNu linux-2.4.29.old/drivers/isdn/eicon/eicon_idi.c linux-2.4.29/drivers/isdn/eicon/eicon_idi.c ---- linux-2.4.29.old/drivers/isdn/eicon/eicon_idi.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/eicon/eicon_idi.c 2005-03-22 15:06:45.421187712 +0100 -@@ -1,4 +1,4 @@ --/* $Id: eicon_idi.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: eicon_idi.c,v 1.45 2001/11/07 22:35:48 kai Exp $ - * - * ISDN lowlevel-module for Eicon active cards. - * IDI interface -@@ -25,7 +25,7 @@ - - #undef EICON_FULL_SERVICE_OKTETT - --char *eicon_idi_revision = "$Revision: 1.1.4.1 $"; -+char *eicon_idi_revision = "$Revision: 1.45 $"; - - eicon_manifbuf *manbuf; - -@@ -1583,6 +1583,37 @@ - return; - } - -+#if 0 -+ eicon_sff_dochead *doc = (eicon_sff_dochead *)skb->data; -+ eicon_sff_pagehead *page = (eicon_sff_pagehead *)skb->data + sizeof(eicon_sff_dochead); -+ -+ printk(KERN_DEBUG"SFF: doc %d / page %d (skb : %d)\n", -+ sizeof(eicon_sff_dochead), -+ sizeof(eicon_sff_pagehead), skb->len); -+ -+ if (skb->len >= sizeof(eicon_sff_dochead)) { -+ printk(KERN_DEBUG"SFF: id = 0x%x\n", doc->id); -+ printk(KERN_DEBUG"SFF: version = 0x%x\n", doc->version); -+ printk(KERN_DEBUG"SFF: reserved1 = 0x%x\n", doc->reserved1); -+ printk(KERN_DEBUG"SFF: userinfo = 0x%x\n", doc->userinfo); -+ printk(KERN_DEBUG"SFF: pagecount = 0x%x\n", doc->pagecount); -+ printk(KERN_DEBUG"SFF: off1pagehead = 0x%x\n", doc->off1pagehead); -+ printk(KERN_DEBUG"SFF: offnpagehead = 0x%x\n", doc->offnpagehead); -+ printk(KERN_DEBUG"SFF: offdocend = 0x%x\n", doc->offdocend); -+ } -+ if (skb->len >= (sizeof(eicon_sff_dochead) + sizeof(eicon_sff_pagehead))) { -+ printk(KERN_DEBUG"SFFp: id = 0x%x\n", page->pageheadid); -+ printk(KERN_DEBUG"SFFp: len = 0x%x\n", page->pageheadlen); -+ printk(KERN_DEBUG"SFFp: resvert = 0x%x\n", page->resvert); -+ printk(KERN_DEBUG"SFFp: reshoriz = 0x%x\n", page->reshoriz); -+ printk(KERN_DEBUG"SFFp: coding = 0x%x\n", page->coding); -+ printk(KERN_DEBUG"SFFp: reserved2 = 0x%x\n", page->reserved2); -+ printk(KERN_DEBUG"SFFp: linelength = 0x%x\n", page->linelength); -+ printk(KERN_DEBUG"SFFp: pagelength = 0x%x\n", page->pagelength); -+ printk(KERN_DEBUG"SFFp: offprevpage = 0x%x\n", page->offprevpage); -+ printk(KERN_DEBUG"SFFp: offnextpage = 0x%x\n", page->offnextpage); -+ } -+#endif - - - if (chan->fax->direction == ISDN_TTY_FAX_CONN_IN) { -@@ -2054,8 +2085,7 @@ - OutBuf.Len++; - } else { - *OutBuf.Next++ = 0; -- *(__u16 *) OutBuf.Next = (__u16) LineBuf.Len; -- OutBuf.Next += sizeof(__u16); -+ *((__u16 *) OutBuf.Next)++ = (__u16) LineBuf.Len; - OutBuf.Len += 3; - } - memcpy(OutBuf.Next, LineBuf.Data, LineBuf.Len); -@@ -2385,6 +2415,12 @@ - } else { - if (chan->e.B2Id) - idi_do_req(ccard, chan, REMOVE, 1); -+#if 0 -+ if (chan->e.D3Id) { -+ idi_do_req(ccard, chan, REMOVE, 0); -+ idi_do_req(ccard, chan, ASSIGN, 0); -+ } -+#endif - chan->statectrl &= ~WAITING_FOR_HANGUP; - chan->statectrl &= ~IN_HOLD; - if (chan->statectrl & HAVE_CONN_REQ) { -diff -rNu linux-2.4.29.old/drivers/isdn/eicon/eicon_idi.h linux-2.4.29/drivers/isdn/eicon/eicon_idi.h ---- linux-2.4.29.old/drivers/isdn/eicon/eicon_idi.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/eicon/eicon_idi.h 2005-03-22 15:06:45.437185280 +0100 -@@ -1,4 +1,4 @@ --/* $Id: eicon_idi.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: eicon_idi.h,v 1.12 2001/09/24 13:22:47 kai Exp $ - * - * ISDN lowlevel-module for the Eicon active cards. - * IDI-Interface -diff -rNu linux-2.4.29.old/drivers/isdn/eicon/eicon_io.c linux-2.4.29/drivers/isdn/eicon/eicon_io.c ---- linux-2.4.29.old/drivers/isdn/eicon/eicon_io.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/eicon/eicon_io.c 2005-03-22 15:06:45.453182848 +0100 -@@ -1,4 +1,4 @@ --/* $Id: eicon_io.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: eicon_io.c,v 1.15 2001/09/24 13:22:47 kai Exp $ - * - * ISDN low-level module for Eicon active ISDN-Cards. - * Code for communicating with hardware. -diff -rNu linux-2.4.29.old/drivers/isdn/eicon/eicon_isa.c linux-2.4.29/drivers/isdn/eicon/eicon_isa.c ---- linux-2.4.29.old/drivers/isdn/eicon/eicon_isa.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/eicon/eicon_isa.c 2005-03-22 15:06:45.469180416 +0100 -@@ -1,4 +1,4 @@ --/* $Id: eicon_isa.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: eicon_isa.c,v 1.18 2001/11/07 22:35:48 kai Exp $ - * - * ISDN low-level module for Eicon active ISDN-Cards. - * Hardware-specific code for old ISA cards. -@@ -20,7 +20,7 @@ - #define release_shmem release_region - #define request_shmem request_region - --char *eicon_isa_revision = "$Revision: 1.1.4.1 $"; -+char *eicon_isa_revision = "$Revision: 1.18 $"; - - #undef EICON_MCA_DEBUG - -@@ -38,8 +38,12 @@ - static void - eicon_isa_release_shmem(eicon_isa_card *card) { - if (card->mvalid) { -+#ifdef COMPAT_HAS_ISA_IOREMAP - iounmap(card->shmem); - release_mem_region(card->physmem, card->ramsize); -+#else -+ release_shmem((unsigned long)card->shmem, card->ramsize); -+#endif - } - card->mvalid = 0; - } -@@ -94,12 +98,20 @@ - Mem, Id); - return -1; - } -+#ifdef COMPAT_HAS_ISA_IOREMAP - if (check_mem_region(Mem, RAMSIZE)) { -+#else -+ if (check_shmem(Mem, RAMSIZE)) { -+#endif - printk(KERN_WARNING "eicon_isa_boot: memory at 0x%x already in use.\n", Mem); - return -1; - } - -+#ifdef COMPAT_HAS_ISA_IOREMAP - amem = (unsigned long) ioremap(Mem, RAMSIZE); -+#else -+ amem = (unsigned long) Mem; -+#endif - writew(0x55aa, amem + 0x402); - if (readw(amem + 0x402) != 0x55aa) primary = 0; - writew(0, amem + 0x402); -@@ -109,12 +121,16 @@ - if (primary) { - printk(KERN_INFO "Eicon: assuming pri card at 0x%x\n", Mem); - writeb(0, amem + 0x3ffe); -+#ifdef COMPAT_HAS_ISA_IOREMAP - iounmap((unsigned char *)amem); -+#endif - return EICON_CTYPE_ISAPRI; - } else { - printk(KERN_INFO "Eicon: assuming bri card at 0x%x\n", Mem); - writeb(0, amem + 0x400); -+#ifdef COMPAT_HAS_ISA_IOREMAP - iounmap((unsigned char *)amem); -+#endif - return EICON_CTYPE_ISABRI; - } - return -1; -@@ -151,6 +167,7 @@ - else - card->ramsize = RAMSIZE; - -+#ifdef COMPAT_HAS_ISA_IOREMAP - if (check_mem_region(card->physmem, card->ramsize)) { - printk(KERN_WARNING "eicon_isa_boot: memory at 0x%lx already in use.\n", - card->physmem); -@@ -159,6 +176,16 @@ - } - request_mem_region(card->physmem, card->ramsize, "Eicon ISA ISDN"); - card->shmem = (eicon_isa_shmem *) ioremap(card->physmem, card->ramsize); -+#else -+ /* Register shmem */ -+ if (check_shmem((unsigned long)card->shmem, card->ramsize)) { -+ printk(KERN_WARNING "eicon_isa_boot: memory at 0x%lx already in use.\n", -+ (unsigned long)card->shmem); -+ kfree(code); -+ return -EBUSY; -+ } -+ request_shmem((unsigned long)card->shmem, card->ramsize, "Eicon ISA ISDN"); -+#endif - #ifdef EICON_MCA_DEBUG - printk(KERN_INFO "eicon_isa_boot: card->ramsize = %d.\n", card->ramsize); - #endif -diff -rNu linux-2.4.29.old/drivers/isdn/eicon/eicon_isa.h linux-2.4.29/drivers/isdn/eicon/eicon_isa.h ---- linux-2.4.29.old/drivers/isdn/eicon/eicon_isa.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/eicon/eicon_isa.h 2005-03-22 15:06:45.485177984 +0100 -@@ -1,4 +1,4 @@ --/* $Id: eicon_isa.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: eicon_isa.h,v 1.11 2001/09/24 13:22:47 kai Exp $ - * - * ISDN low-level module for Eicon active ISDN-Cards. - * -diff -rNu linux-2.4.29.old/drivers/isdn/eicon/eicon_mod.c linux-2.4.29/drivers/isdn/eicon/eicon_mod.c ---- linux-2.4.29.old/drivers/isdn/eicon/eicon_mod.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/eicon/eicon_mod.c 2005-03-22 15:06:45.505174944 +0100 -@@ -1,4 +1,4 @@ --/* $Id: eicon_mod.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: eicon_mod.c,v 1.44 2001/11/20 09:48:25 armin Exp $ - * - * ISDN lowlevel-module for Eicon active cards. - * -@@ -44,7 +44,7 @@ - static eicon_card *cards = (eicon_card *) NULL; /* glob. var , contains - start of card-list */ - --static char *eicon_revision = "$Revision: 1.1.4.1 $"; -+static char *eicon_revision = "$Revision: 1.44 $"; - - extern char *eicon_pci_revision; - extern char *eicon_isa_revision; -@@ -639,6 +639,18 @@ - static int - if_writecmd(const u_char * buf, int len, int user, int id, int channel) - { -+#if 0 -+ /* Not yet used */ -+ eicon_card *card = eicon_findcard(id); -+ -+ if (card) { -+ if (!card->flags & EICON_FLAGS_RUNNING) -+ return (len); -+ return (len); -+ } -+ printk(KERN_ERR -+ "eicon: if_writecmd called with invalid driverId!\n"); -+#endif - return (len); - } - -@@ -665,11 +677,8 @@ - else - cnt = skb->len; - -- if (user) { -- spin_unlock_irqrestore(&eicon_lock, flags); -+ if (user) - copy_to_user(p, skb->data, cnt); -- spin_lock_irqsave(&eicon_lock, flags); -- } - else - memcpy(p, skb->data, cnt); - -@@ -1459,6 +1468,7 @@ - - #ifndef MODULE - -+#ifdef COMPAT_HAS_NEW_SETUP - static int __init - eicon_setup(char *line) - { -@@ -1467,6 +1477,12 @@ - char *str; - - str = get_options(line, 4, ints); -+#else -+void -+eicon_setup(char *str, int *ints) -+{ -+ int i, argc; -+#endif - - argc = ints[0]; - i = 1; -@@ -1494,9 +1510,13 @@ - #else - printk(KERN_INFO "Eicon ISDN active driver setup\n"); - #endif -+#ifdef COMPAT_HAS_NEW_SETUP - return(1); - } - __setup("eicon=", eicon_setup); -+#else -+} -+#endif - - #endif /* MODULE */ - -diff -rNu linux-2.4.29.old/drivers/isdn/eicon/eicon_pci.c linux-2.4.29/drivers/isdn/eicon/eicon_pci.c ---- linux-2.4.29.old/drivers/isdn/eicon/eicon_pci.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/eicon/eicon_pci.c 2005-03-22 15:06:45.522172360 +0100 -@@ -1,4 +1,4 @@ --/* $Id: eicon_pci.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: eicon_pci.c,v 1.18 2001/09/24 13:22:47 kai Exp $ - * - * ISDN low-level module for Eicon active ISDN-Cards. - * Hardware-specific code for PCI cards. -@@ -24,7 +24,7 @@ - #include "adapter.h" - #include "uxio.h" - --char *eicon_pci_revision = "$Revision: 1.1.4.1 $"; -+char *eicon_pci_revision = "$Revision: 1.18 $"; - - #if CONFIG_PCI /* intire stuff is only for PCI */ - #ifdef CONFIG_ISDN_DRV_EICON_PCI -diff -rNu linux-2.4.29.old/drivers/isdn/eicon/eicon_pci.h linux-2.4.29/drivers/isdn/eicon/eicon_pci.h ---- linux-2.4.29.old/drivers/isdn/eicon/eicon_pci.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/eicon/eicon_pci.h 2005-03-22 15:06:45.538169928 +0100 -@@ -1,4 +1,4 @@ --/* $Id: eicon_pci.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: eicon_pci.h,v 1.7 2001/09/24 13:22:47 kai Exp $ - * - * ISDN low-level module for Eicon active ISDN-Cards (PCI part). - * -diff -rNu linux-2.4.29.old/drivers/isdn/eicon/fourbri.c linux-2.4.29/drivers/isdn/eicon/fourbri.c ---- linux-2.4.29.old/drivers/isdn/eicon/fourbri.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/eicon/fourbri.c 2005-03-22 15:06:45.553167648 +0100 -@@ -337,8 +337,7 @@ - static int diva_server_4bri_start(card_t *card, byte *channels) - { - byte *ctl; -- byte *shared; -- int i; -+ byte *shared, i; - int adapter_num; - - DPRINTF(("divas: start Diva Server 4BRI")); -diff -rNu linux-2.4.29.old/drivers/isdn/eicon/kprintf.c linux-2.4.29/drivers/isdn/eicon/kprintf.c ---- linux-2.4.29.old/drivers/isdn/eicon/kprintf.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/eicon/kprintf.c 2005-03-22 15:06:45.601160352 +0100 -@@ -18,6 +18,468 @@ - #include "divalog.h" - #include "uxio.h" - -+/* -+ * Implementation of printf and sprintf for kernel -+ */ -+ -+#define MAX_BUFF (80) /* limit size of temporary buffers */ -+ -+#define WRITE_CHAR(BUFFER, SIZE, C) \ -+ if (--(SIZE) < 0) { (BUFFER)--; *(BUFFER) = '\0'; return; } *(BUFFER)++ = (C) -+ -+ -+/* -+ * convert a number to decimal ASCII -+ */ -+ -+static -+void do_decimal( char *temp, -+ int temp_len, -+ unsigned int value, -+ char *s) -+ -+{ -+ int i; -+ -+ temp[0] = '\0'; -+ -+ for (i = 1; i < temp_len; i++) -+ { -+ temp[i] = (char) ((value % 10) + (int) '0'); -+ value /= 10; -+ } -+ -+ for (i = (temp_len - 1); temp[i] == '0'; i--) -+ { -+ ; -+ } -+ -+ if (i == 0) -+ { -+ i++; -+ } -+ -+ while (i >= 0) -+ { -+ *s++ = temp[i--]; -+ } -+ -+ return; -+} -+ -+/* -+ * convert a number to octal ASCII -+ */ -+ -+static -+void do_octal( char *temp, -+ unsigned int value, -+ char *s) -+ -+{ -+ int i; -+ -+ temp[0] = '\0'; -+ -+ for (i = 1; i <= 11; i++) -+ { -+ temp[i] = (char) ((value & 07) + (int) '0'); -+ value >>= 3; -+ } -+ temp[11] &= '3'; -+ -+ for (i = 11; temp[i] == '0'; i--) -+ { -+ ; -+ } -+ -+ if (i == 0) -+ { -+ i++; -+ } -+ -+ while (i >= 0) -+ { -+ *s++ = temp[i--]; -+ } -+ -+ return; -+} -+ -+/* -+ * convert a number to hex ASCII -+ */ -+ -+static -+void do_hex( char *temp, -+ unsigned int value, -+ char *s) -+ -+{ -+ int i; -+ static -+ char *dec_to_hex = "0123456789abcdef"; -+ -+ temp[0] = '\0'; -+ -+ for (i = 1; i <= 8; i++) -+ { -+ temp[i] = dec_to_hex[value & 0x0f]; -+ value >>= 4; -+ } -+ -+ for (i = 8; temp[i] == '0'; i--) -+ { -+ ; -+ } -+ -+ if (i == 0) -+ { -+ i++; -+ } -+ -+ while (i >= 0) -+ { -+ *s++ = temp[i--]; -+ } -+ -+ return; -+} -+ -+/* -+ * convert a buffer to ASCII HEX -+ */ -+ -+static -+void do_buffer( char *buffer, -+ int length, -+ char *s) -+ -+{ -+ static -+ char hex_char [] = "0123456789abcdef"; -+ char *b = buffer; -+ int hex_byte; -+ int nybble; -+ -+ length = (length >= ((MAX_BUFF / 3) + 1)) ? (MAX_BUFF / 3) : length; -+ -+ while (length) -+ { -+ hex_byte = (int) *b++; -+ nybble = (hex_byte >> 4) & 0xf; -+ *s++ = hex_char[nybble]; -+ nybble = hex_byte & 0xf; -+ *s++ = hex_char[nybble]; -+ *s++ = ' '; -+ length--; -+ } -+ *s = '\0'; -+ -+ return; -+} -+ -+/* -+ * Body of sprintf function: behaves just like standard sprintf, except we -+ * have an extra argument (buffer size) which we use to ensure we don't -+ * overflow -+ */ -+ -+void Divas_vsprintf( char *buffer, -+ int size, -+ char *fmt, -+ va_list argptr) -+ -+{ -+ char c; /* single character buffer */ -+ int i; /* handy scratch counter */ -+ int f; /* format character (after %) */ -+ char *str; /* pointer into string */ -+ char temp[20]; /* temp buffer used in printing numbers */ -+ char string[MAX_BUFF]; /* output from number conversion */ -+ int length; /* length of string "str" */ -+ char fill; /* fill character ' ' or '0' */ -+ boolean_t leftjust; /* TRUE if left justified, else right justified */ -+ int fmax, fmin; /* field specifiers % MIN . MAX s */ -+ int leading; /* number of leading/trailing fill characters */ -+ char sign; /* set to '-' for negative decimals */ -+ int number; /* numeric argument */ -+ -+ char *buff_ptr; /* pointer to user's buffer of hex data */ -+ int buff_len; /* length of hex data */ -+ -+ /* make sure we have somthing to write into */ -+ -+ if ((!buffer) || (size <= 0)) -+ { -+ return; -+ } -+ -+ while (TRUE) -+ { -+ /* echo characters until end or '%' encountered */ -+ -+ while ((c = *fmt++) != '%') -+ { -+ if (!c) -+ { -+ *buffer = '\0'; -+ return; -+ } -+ WRITE_CHAR(buffer, size, c); -+ } -+ -+ /* echo %% as % */ -+ -+ if (*fmt == '%') -+ { -+ WRITE_CHAR(buffer, size, *fmt); -+ continue; -+ } -+ -+ /* %- turns on left-justify */ -+ -+ if ((leftjust = (boolean_t) ((*fmt == '-') ? TRUE : FALSE))) -+ { -+ fmt++; -+ } -+ -+ /* %0 turns on zero filling */ -+ -+ if (*fmt == '0') -+ { -+ fill = '0'; -+ } -+ else -+ { -+ fill = ' '; -+ } -+ -+ /* minium field width specifier for %d, u, x, c, s */ -+ -+ fmin = 0; -+ -+ if (*fmt == '*') -+ { -+ fmin = va_arg(argptr, int); -+ fmt++; -+ } -+ else -+ { -+ while ('0' <= *fmt && *fmt <= '9') -+ { -+ fmin = (fmin * 10) + (*fmt++ - '0'); -+ } -+ } -+ -+ /* maximum string width specifier for %s */ -+ -+ fmax = 0; -+ -+ if (*fmt == '.') -+ { -+ if (*(++fmt) == '*') -+ { -+ fmax = va_arg(argptr, int); -+ fmt++; -+ } -+ else -+ { -+ while ('0' <= *fmt && *fmt <= '9') -+ { -+ fmax = (fmax * 10) + (*fmt++ - '0'); -+ } -+ } -+ } -+ -+ /* skip over 'l' option (ints are assumed same size as longs) */ -+ -+ if (*fmt == 'l') -+ { -+ fmt++; -+ } -+ -+ /* get the format chacater */ -+ -+ if (!(f = *fmt++)) -+ { -+ WRITE_CHAR(buffer, size, '%'); -+ *buffer = '\0'; -+ return; -+ } -+ -+ sign = '\0'; /* sign == '-' for negative decimal */ -+ -+ str = string; -+ -+ switch (f) -+ { -+ case 'c' : -+ string[0] = (char) va_arg(argptr, int); -+ string[1] = '\0'; -+ fmax = 0; -+ fill = ' '; -+ break; -+ -+ case 's' : -+ str = va_arg(argptr, char *); -+ fill = ' '; -+ break; -+ -+ case 'D' : -+ case 'd' : -+ number = va_arg(argptr, int); -+ if (number < 0) -+ { -+ sign = '-'; -+ number = -number; -+ } -+ do_decimal(temp, DIM(temp), (unsigned int) number, str); -+ fmax = 0; -+ break; -+ -+ case 'U' : -+ case 'u' : -+ number = va_arg(argptr, int); -+ do_decimal(temp, DIM(temp), (unsigned int) number, str); -+ fmax = 0; -+ break; -+ -+ case 'O' : -+ case 'o' : -+ number = va_arg(argptr, int); -+ do_octal(temp, (unsigned int) number, str); -+ fmax = 0; -+ break; -+ -+ case 'X' : -+ case 'x' : -+ number = va_arg(argptr, int); -+ do_hex(temp, (unsigned int) number, str); -+ fmax = 0; -+ break; -+ -+ case 'H' : -+ case 'h' : -+ buff_ptr = va_arg(argptr, char *); -+ buff_len = va_arg(argptr, int); -+ do_buffer(buff_ptr, buff_len, str); -+ fmax = 0; -+ break; -+ -+ default : -+ WRITE_CHAR(buffer, size, ((char) f)); -+ break; -+ } -+ -+ /* get the length of the string */ -+ -+ length = 0; -+ while (str[length]) -+ { -+ length++; -+ } -+ -+ /* make sure we have fmax and fmin values that are O.K. */ -+ -+ if (fmin > DIM(string) || fmin < 0) -+ { -+ fmin = 0; -+ } -+ -+ if (fmax > DIM(string) || fmax < 0) -+ { -+ fmax = 0; -+ } -+ -+ /* figure out how many leading characters thare are */ -+ -+ leading = 0; -+ -+ if (fmax || fmin) -+ { -+ if (fmax) -+ { -+ if (length > fmax) -+ { -+ length = fmax; -+ } -+ } -+ -+ if (fmin) -+ { -+ leading = fmin - length; -+ } -+ -+ if (sign == '-') -+ { -+ leading--; -+ } -+ } -+ -+ /* output sign now, if fill is numeric */ -+ -+ if (sign == '-' && fill == '0') -+ { -+ WRITE_CHAR(buffer, size, '-'); -+ } -+ -+ /* if right justified, output fill characters */ -+ -+ if (!leftjust) -+ { -+ for (i = 0; i < leading; i++) -+ { -+ WRITE_CHAR(buffer, size, fill); -+ } -+ } -+ -+ /* output sign now, if fill is spaces */ -+ -+ if (sign == '-' && fill == ' ') -+ { -+ WRITE_CHAR(buffer, size, '-'); -+ } -+ -+ /* now the actual value */ -+ -+ for (i = 0; i < length; i++) -+ { -+ WRITE_CHAR(buffer, size, str[i]); -+ } -+ -+ /* if left justified, fill out with the fill character */ -+ -+ if (leftjust) -+ { -+ for (i = 0; i < leading; i++) -+ { -+ WRITE_CHAR(buffer, size, fill); -+ } -+ } -+ } -+} -+ -+/* -+ * sprintf for kernel -+ * -+ * call our vsprintf assuming user has a big buffer.... -+ */ -+ -+void DivasSprintf(char *buffer, char *fmt, ...) -+ -+{ -+ va_list argptr; /* pointer to additional args */ -+ -+ va_start(argptr, fmt); -+ -+ Divas_vsprintf(buffer, 1024, fmt, argptr); -+ -+ va_end(argptr); -+ -+ return; -+} -+ - void DivasPrintf(char *fmt, ...) - - { -@@ -40,7 +502,7 @@ - - /* call vsprintf to format the user's information */ - -- vsnprintf(log.buffer, DIM(log.buffer), fmt, argptr); -+ Divas_vsprintf(log.buffer, DIM(log.buffer), fmt, argptr); - - va_end(argptr); - -diff -rNu linux-2.4.29.old/drivers/isdn/eicon/lincfg.c linux-2.4.29/drivers/isdn/eicon/lincfg.c ---- linux-2.4.29.old/drivers/isdn/eicon/lincfg.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/eicon/lincfg.c 2005-03-22 15:06:45.620157464 +0100 -@@ -26,6 +26,9 @@ - #include "uxio.h" - - #include -+#ifndef COMPAT_HAS_2_2_PCI -+#include -+#endif - #include - #include - -diff -rNu linux-2.4.29.old/drivers/isdn/eicon/linchr.c linux-2.4.29/drivers/isdn/eicon/linchr.c ---- linux-2.4.29.old/drivers/isdn/eicon/linchr.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/eicon/linchr.c 2005-03-22 15:06:45.635155184 +0100 -@@ -154,17 +154,17 @@ - klog_t *pHeadItem; - - if (BufferSize < sizeof(klog_t)) -+ { -+ printk(KERN_WARNING "Divas: Divalog buffer specifed a size that is too small (%d - %d required)\n", -+ BufferSize, sizeof(klog_t)); - return -EIO; -+ } - - pHeadItem = (klog_t *) DivasLogFifoRead(); - - if (pHeadItem) - { -- if(copy_to_user(pClientLogBuffer, pHeadItem, sizeof(klog_t))) -- { -- kfree(pHeadItem); -- return -EFAULT; -- } -+ memcpy(pClientLogBuffer, pHeadItem, sizeof(klog_t)); - kfree(pHeadItem); - return sizeof(klog_t); - } -diff -rNu linux-2.4.29.old/drivers/isdn/eicon/linio.c linux-2.4.29/drivers/isdn/eicon/linio.c ---- linux-2.4.29.old/drivers/isdn/eicon/linio.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/eicon/linio.c 2005-03-22 15:06:45.651152752 +0100 -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - #undef N_DATA - - #include "uxio.h" -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/Makefile linux-2.4.29/drivers/isdn/hisax/Makefile ---- linux-2.4.29.old/drivers/isdn/hisax/Makefile 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/Makefile 2005-03-22 15:06:45.819127216 +0100 -@@ -4,20 +4,17 @@ - - O_TARGET := vmlinux-obj.o - --# Define maximum number of cards -- --EXTRA_CFLAGS += -DHISAX_MAX_CARDS=$(CONFIG_HISAX_MAX_CARDS) -- - # Objects that export symbols. - --export-objs := config.o hisax_isac.o isdnhdlc.o -+export-objs := config.o fsm.o hisax_isac.o - - # Multipart objects. - - list-multi := hisax.o hisax_st5481.o - hisax-objs := config.o isdnl1.o tei.o isdnl2.o isdnl3.o \ - lmgr.o q931.o callc.o fsm.o cert.o --hisax_st5481-objs := st5481_init.o st5481_usb.o st5481_d.o st5481_b.o -+hisax_st5481-objs := st5481_init.o st5481_usb.o st5481_d.o st5481_b.o \ -+ st5481_hdlc.o - - # Optional parts of multipart objects. - hisax-objs-$(CONFIG_HISAX_EURO) += l3dss1.o -@@ -33,7 +30,7 @@ - hisax-objs-$(CONFIG_HISAX_FRITZPCI) += avm_pci.o isac.o arcofi.o - hisax-objs-$(CONFIG_HISAX_ELSA) += elsa.o isac.o arcofi.o hscx.o - hisax-objs-$(CONFIG_HISAX_IX1MICROR2) += ix1_micro.o isac.o arcofi.o hscx.o --hisax-objs-$(CONFIG_HISAX_DIEHLDIVA) += diva.o isac.o arcofi.o hscx.o ipacx.o -+hisax-objs-$(CONFIG_HISAX_DIEHLDIVA) += diva.o isac.o arcofi.o hscx.o - hisax-objs-$(CONFIG_HISAX_ASUSCOM) += asuscom.o isac.o arcofi.o hscx.o - hisax-objs-$(CONFIG_HISAX_TELEINT) += teleint.o isac.o arcofi.o hfc_2bs0.o - hisax-objs-$(CONFIG_HISAX_SEDLBAUER) += sedlbauer.o isac.o arcofi.o hscx.o isar.o -@@ -44,6 +41,7 @@ - hisax-objs-$(CONFIG_HISAX_HFCS) += hfcscard.o hfc_2bds0.o - hisax-objs-$(CONFIG_HISAX_HFC_PCI) += hfc_pci.o - hisax-objs-$(CONFIG_HISAX_HFC_SX) += hfc_sx.o -+hisax-objs-$(CONFIG_HISAX_HFC_USB) += hfc_usbr.o - hisax-objs-$(CONFIG_HISAX_NICCY) += niccy.o isac.o arcofi.o hscx.o - hisax-objs-$(CONFIG_HISAX_ISURF) += isurf.o isac.o arcofi.o isar.o - hisax-objs-$(CONFIG_HISAX_HSTSAPHIR) += saphir.o isac.o arcofi.o hscx.o -@@ -51,7 +49,6 @@ - hisax-objs-$(CONFIG_HISAX_SCT_QUADRO) += bkm_a8.o isac.o arcofi.o hscx.o - hisax-objs-$(CONFIG_HISAX_GAZEL) += gazel.o isac.o arcofi.o hscx.o - hisax-objs-$(CONFIG_HISAX_W6692) += w6692.o --hisax-objs-$(CONFIG_HISAX_ENTERNOW_PCI) += enternow_pci.o amd7930_fn.o - #hisax-objs-$(CONFIG_HISAX_TESTEMU) += testemu.o - - hisax-objs += $(sort $(hisax-objs-y)) -@@ -61,10 +58,9 @@ - obj-$(CONFIG_ISDN_DRV_HISAX) += hisax.o - obj-$(CONFIG_HISAX_SEDLBAUER_CS) += sedlbauer_cs.o - obj-$(CONFIG_HISAX_ELSA_CS) += elsa_cs.o --obj-$(CONFIG_HISAX_AVM_A1_CS) += avma1_cs.o --obj-$(CONFIG_HISAX_ST5481) += hisax_st5481.o isdnhdlc.o --obj-$(CONFIG_HISAX_FRITZ_PCIPNP) += hisax_isac.o hisax_fcpcipnp.o --obj-$(CONFIG_USB_AUERISDN) += isdnhdlc.o -+obj-$(CONFIG_HISAX_HFC_USB_CS) += hfc_usb.o -+obj-$(CONFIG_HISAX_ST5481) += hisax_st5481.o -+obj-$(CONFIG_HISAX_FRITZ_PCIPNP) += hisax_fcpcipnp.o hisax_isac.o - - CERT := $(shell md5sum -c md5sums.asc >> /dev/null;echo $$?) - CFLAGS_cert.o := -DCERTIFICATION=$(CERT) -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/amd7930.c linux-2.4.29/drivers/isdn/hisax/amd7930.c ---- linux-2.4.29.old/drivers/isdn/hisax/amd7930.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/amd7930.c 2005-03-22 15:06:45.837124480 +0100 -@@ -0,0 +1,755 @@ -+/* $Id: amd7930.c,v 1.8 2001/09/24 13:22:55 kai Exp $ -+ * -+ * HiSax ISDN driver - chip specific routines for AMD 7930 -+ * -+ * Author Brent Baccala -+ * Copyright by Brent Baccala -+ * -+ * This software may be used and distributed according to the terms -+ * of the GNU General Public License, incorporated herein by reference. -+ * -+ * - Existing ISDN HiSax driver provides all the smarts -+ * - it compiles, runs, talks to an isolated phone switch, connects -+ * to a Cisco, pings go through -+ * - AMD 7930 support only (no DBRI yet) -+ * - no US NI-1 support (may not work on US phone system - untested) -+ * - periodic packet loss, apparently due to lost interrupts -+ * - ISDN sometimes freezes, requiring reboot before it will work again -+ * -+ * The code is unreliable enough to be consider alpha -+ * -+ * This file is (c) under GNU General Public License -+ * -+ * Advanced Micro Devices' Am79C30A is an ISDN/audio chip used in the -+ * SparcStation 1+. The chip provides microphone and speaker interfaces -+ * which provide mono-channel audio at 8K samples per second via either -+ * 8-bit A-law or 8-bit mu-law encoding. Also, the chip features an -+ * ISDN BRI Line Interface Unit (LIU), I.430 S/T physical interface, -+ * which performs basic D channel LAPD processing and provides raw -+ * B channel data. The digital audio channel, the two ISDN B channels, -+ * and two 64 Kbps channels to the microprocessor are all interconnected -+ * via a multiplexer. -+ * -+ * This driver interfaces to the Linux HiSax ISDN driver, which performs -+ * all high-level Q.921 and Q.931 ISDN functions. The file is not -+ * itself a hardware driver; rather it uses functions exported by -+ * the AMD7930 driver in the sparcaudio subsystem (drivers/sbus/audio), -+ * allowing the chip to be simultaneously used for both audio and ISDN data. -+ * The hardware driver does _no_ buffering, but provides several callbacks -+ * which are called during interrupt service and should therefore run quickly. -+ * -+ * D channel transmission is performed by passing the hardware driver the -+ * address and size of an skb's data area, then waiting for a callback -+ * to signal successful transmission of the packet. A task is then -+ * queued to notify the HiSax driver that another packet may be transmitted. -+ * -+ * D channel reception is quite simple, mainly because of: -+ * 1) the slow speed of the D channel - 16 kbps, and -+ * 2) the presence of an 8- or 32-byte (depending on chip version) FIFO -+ * to buffer the D channel data on the chip -+ * Worst case scenario of back-to-back packets with the 8 byte buffer -+ * at 16 kbps yields an service time of 4 ms - long enough to preclude -+ * the need for fancy buffering. We queue a background task that copies -+ * data out of the receive buffer into an skb, and the hardware driver -+ * simply does nothing until we're done with the receive buffer and -+ * reset it for a new packet. -+ * -+ * B channel processing is more complex, because of: -+ * 1) the faster speed - 64 kbps, -+ * 2) the lack of any on-chip buffering (it interrupts for every byte), and -+ * 3) the lack of any chip support for HDLC encapsulation -+ * -+ * The HiSax driver can put each B channel into one of three modes - -+ * L1_MODE_NULL (channel disabled), L1_MODE_TRANS (transparent data relay), -+ * and L1_MODE_HDLC (HDLC encapsulation by low-level driver). -+ * L1_MODE_HDLC is the most common, used for almost all "pure" digital -+ * data sessions. L1_MODE_TRANS is used for ISDN audio. -+ * -+ * HDLC B channel transmission is performed via a large buffer into -+ * which the skb is copied while performing HDLC bit-stuffing. A CRC -+ * is computed and attached to the end of the buffer, which is then -+ * passed to the low-level routines for raw transmission. Once -+ * transmission is complete, the hardware driver is set to enter HDLC -+ * idle by successive transmission of mark (all 1) bytes, waiting for -+ * the ISDN driver to prepare another packet for transmission and -+ * deliver it. -+ * -+ * HDLC B channel reception is performed via an X-byte ring buffer -+ * divided into N sections of X/N bytes each. Defaults: X=256 bytes, N=4. -+ * As the hardware driver notifies us that each section is full, we -+ * hand it the next section and schedule a background task to peruse -+ * the received section, bit-by-bit, with an HDLC decoder. As -+ * packets are detected, they are copied into a large buffer while -+ * decoding HDLC bit-stuffing. The ending CRC is verified, and if -+ * it is correct, we alloc a new skb of the correct length (which we -+ * now know), copy the packet into it, and hand it to the upper layers. -+ * Optimization: for large packets, we hand the buffer (which also -+ * happens to be an skb) directly to the upper layer after an skb_trim, -+ * and alloc a new large buffer for future packets, thus avoiding a copy. -+ * Then we return to HDLC processing; state is saved between calls. -+ * -+ */ -+ -+#define __NO_VERSION__ -+#include "hisax.h" -+#include "../../sbus/audio/amd7930.h" -+#include "isac.h" -+#include "isdnl1.h" -+#include "rawhdlc.h" -+#include -+ -+static const char *amd7930_revision = "$Revision: 1.8 $"; -+ -+#define RCV_BUFSIZE 1024 /* Size of raw receive buffer in bytes */ -+#define RCV_BUFBLKS 4 /* Number of blocks to divide buffer into -+ * (must divide RCV_BUFSIZE) */ -+ -+static void Bchan_fill_fifo(struct BCState *, struct sk_buff *); -+ -+static void -+Bchan_xmt_bh(struct BCState *bcs) -+{ -+ struct sk_buff *skb; -+ -+ if (bcs->hw.amd7930.tx_skb != NULL) { -+ dev_kfree_skb(bcs->hw.amd7930.tx_skb); -+ bcs->hw.amd7930.tx_skb = NULL; -+ } -+ -+ if ((skb = skb_dequeue(&bcs->squeue))) { -+ Bchan_fill_fifo(bcs, skb); -+ } else { -+ clear_bit(BC_FLG_BUSY, &bcs->Flag); -+ bcs->event |= 1 << B_XMTBUFREADY; -+ queue_task(&bcs->tqueue, &tq_immediate); -+ mark_bh(IMMEDIATE_BH); -+ } -+} -+ -+static void -+Bchan_xmit_callback(struct BCState *bcs) -+{ -+ queue_task(&bcs->hw.amd7930.tq_xmt, &tq_immediate); -+ mark_bh(IMMEDIATE_BH); -+} -+ -+/* B channel transmission: two modes (three, if you count L1_MODE_NULL) -+ * -+ * L1_MODE_HDLC - We need to do HDLC encapsulation before transmiting -+ * the packet (i.e. make_raw_hdlc_data). Since this can be a -+ * time-consuming operation, our completion callback just schedules -+ * a bottom half to do encapsulation for the next packet. In between, -+ * the link will just idle -+ * -+ * L1_MODE_TRANS - Data goes through, well, transparent. No HDLC encap, -+ * and we can't just let the link idle, so the "bottom half" actually -+ * gets called during the top half (it's our callback routine in this case), -+ * but it's a lot faster now since we don't call make_raw_hdlc_data -+ */ -+ -+static void -+Bchan_fill_fifo(struct BCState *bcs, struct sk_buff *skb) -+{ -+ struct IsdnCardState *cs = bcs->cs; -+ int len; -+ -+ if ((cs->debug & L1_DEB_HSCX) || (cs->debug & L1_DEB_HSCX_FIFO)) { -+ char tmp[1024]; -+ char *t = tmp; -+ -+ t += sprintf(t, "amd7930_fill_fifo %c cnt %d", -+ bcs->channel ? 'B' : 'A', skb->len); -+ if (cs->debug & L1_DEB_HSCX_FIFO) -+ QuickHex(t, skb->data, skb->len); -+ debugl1(cs, tmp); -+ } -+ -+ if (bcs->mode == L1_MODE_HDLC) { -+ len = make_raw_hdlc_data(skb->data, skb->len, -+ bcs->hw.amd7930.tx_buff, RAW_BUFMAX); -+ if (len > 0) -+ amd7930_bxmit(0, bcs->channel, -+ bcs->hw.amd7930.tx_buff, len, -+ (void *) &Bchan_xmit_callback, -+ (void *) bcs); -+ dev_kfree_skb(skb); -+ } else if (bcs->mode == L1_MODE_TRANS) { -+ amd7930_bxmit(0, bcs->channel, -+ bcs->hw.amd7930.tx_buff, skb->len, -+ (void *) &Bchan_xmt_bh, -+ (void *) bcs); -+ bcs->hw.amd7930.tx_skb = skb; -+ } else { -+ dev_kfree_skb(skb); -+ } -+} -+ -+static void -+Bchan_mode(struct BCState *bcs, int mode, int bc) -+{ -+ struct IsdnCardState *cs = bcs->cs; -+ -+ if (cs->debug & L1_DEB_HSCX) { -+ char tmp[40]; -+ sprintf(tmp, "AMD 7930 mode %d bchan %d/%d", -+ mode, bc, bcs->channel); -+ debugl1(cs, tmp); -+ } -+ bcs->mode = mode; -+} -+ -+/* Bchan_l2l1 is the entry point for upper layer routines that want to -+ * transmit on the B channel. PH_DATA_REQ is a normal packet that -+ * we either start transmitting (if idle) or queue (if busy). -+ * PH_PULL_REQ can be called to request a callback message (PH_PULL_CNF) -+ * once the link is idle. After a "pull" callback, the upper layer -+ * routines can use PH_PULL_IND to send data. -+ */ -+ -+static void -+Bchan_l2l1(struct PStack *st, int pr, void *arg) -+{ -+ struct sk_buff *skb = arg; -+ -+ switch (pr) { -+ case (PH_DATA_REQ): -+ if (test_bit(BC_FLG_BUSY, &st->l1.bcs->Flag)) { -+ skb_queue_tail(&st->l1.bcs->squeue, skb); -+ } else { -+ test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag); -+ Bchan_fill_fifo(st->l1.bcs, skb); -+ } -+ break; -+ case (PH_PULL_IND): -+ if (test_bit(BC_FLG_BUSY, &st->l1.bcs->Flag)) { -+ printk(KERN_WARNING "amd7930: this shouldn't happen\n"); -+ break; -+ } -+ test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag); -+ Bchan_fill_fifo(st->l1.bcs, skb); -+ break; -+ case (PH_PULL_REQ): -+ if (!test_bit(BC_FLG_BUSY, &st->l1.bcs->Flag)) { -+ clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags); -+ st->l1.l1l2(st, PH_PULL_CNF, NULL); -+ } else -+ set_bit(FLG_L1_PULL_REQ, &st->l1.Flags); -+ break; -+ } -+} -+ -+/* Receiver callback and bottom half - decodes HDLC at leisure (if -+ * L1_MODE_HDLC) and passes newly received skb on via bcs->rqueue. If -+ * a large packet is received, stick rv_skb (the buffer that the -+ * packet has been decoded into) on the receive queue and alloc a new -+ * (large) skb to act as buffer for future receives. If a small -+ * packet is received, leave rv_skb alone, alloc a new skb of the -+ * correct size, and copy the packet into it -+ */ -+ -+static void -+Bchan_recv_callback(struct BCState *bcs) -+{ -+ struct amd7930_hw *hw = &bcs->hw.amd7930; -+ -+ hw->rv_buff_in += RCV_BUFSIZE/RCV_BUFBLKS; -+ hw->rv_buff_in %= RCV_BUFSIZE; -+ -+ if (hw->rv_buff_in != hw->rv_buff_out) { -+ amd7930_brecv(0, bcs->channel, -+ hw->rv_buff + hw->rv_buff_in, -+ RCV_BUFSIZE/RCV_BUFBLKS, -+ (void *) &Bchan_recv_callback, (void *) bcs); -+ } -+ -+ queue_task(&hw->tq_rcv, &tq_immediate); -+ mark_bh(IMMEDIATE_BH); -+} -+ -+static void -+Bchan_rcv_bh(struct BCState *bcs) -+{ -+ struct IsdnCardState *cs = bcs->cs; -+ struct amd7930_hw *hw = &bcs->hw.amd7930; -+ struct sk_buff *skb; -+ int len; -+ -+ if (cs->debug & L1_DEB_HSCX) { -+ char tmp[1024]; -+ -+ sprintf(tmp, "amd7930_Bchan_rcv (%d/%d)", -+ hw->rv_buff_in, hw->rv_buff_out); -+ debugl1(cs, tmp); -+ QuickHex(tmp, hw->rv_buff + hw->rv_buff_out, -+ RCV_BUFSIZE/RCV_BUFBLKS); -+ debugl1(cs, tmp); -+ } -+ -+ do { -+ if (bcs->mode == L1_MODE_HDLC) { -+ while ((len = read_raw_hdlc_data(hw->hdlc_state, -+ hw->rv_buff + hw->rv_buff_out, RCV_BUFSIZE/RCV_BUFBLKS, -+ hw->rv_skb->tail, HSCX_BUFMAX))) { -+ if (len > 0 && (cs->debug & L1_DEB_HSCX_FIFO)) { -+ char tmp[1024]; -+ char *t = tmp; -+ -+ t += sprintf(t, "amd7930_Bchan_rcv %c cnt %d", bcs->channel ? 'B' : 'A', len); -+ QuickHex(t, hw->rv_skb->tail, len); -+ debugl1(cs, tmp); -+ } -+ -+ if (len > HSCX_BUFMAX/2) { -+ /* Large packet received */ -+ -+ if (!(skb = dev_alloc_skb(HSCX_BUFMAX))) { -+ printk(KERN_WARNING "amd7930: receive out of memory"); -+ } else { -+ skb_put(hw->rv_skb, len); -+ skb_queue_tail(&bcs->rqueue, hw->rv_skb); -+ hw->rv_skb = skb; -+ bcs->event |= 1 << B_RCVBUFREADY; -+ queue_task(&bcs->tqueue, &tq_immediate); -+ } -+ } else if (len > 0) { -+ /* Small packet received */ -+ -+ if (!(skb = dev_alloc_skb(len))) { -+ printk(KERN_WARNING "amd7930: receive out of memory\n"); -+ } else { -+ memcpy(skb_put(skb, len), hw->rv_skb->tail, len); -+ skb_queue_tail(&bcs->rqueue, skb); -+ bcs->event |= 1 << B_RCVBUFREADY; -+ queue_task(&bcs->tqueue, &tq_immediate); -+ mark_bh(IMMEDIATE_BH); -+ } -+ } else { -+ /* Reception Error */ -+ /* printk("amd7930: B channel receive error\n"); */ -+ } -+ } -+ } else if (bcs->mode == L1_MODE_TRANS) { -+ if (!(skb = dev_alloc_skb(RCV_BUFSIZE/RCV_BUFBLKS))) { -+ printk(KERN_WARNING "amd7930: receive out of memory\n"); -+ } else { -+ memcpy(skb_put(skb, RCV_BUFSIZE/RCV_BUFBLKS), -+ hw->rv_buff + hw->rv_buff_out, -+ RCV_BUFSIZE/RCV_BUFBLKS); -+ skb_queue_tail(&bcs->rqueue, skb); -+ bcs->event |= 1 << B_RCVBUFREADY; -+ queue_task(&bcs->tqueue, &tq_immediate); -+ mark_bh(IMMEDIATE_BH); -+ } -+ } -+ -+ if (hw->rv_buff_in == hw->rv_buff_out) { -+ /* Buffer was filled up - need to restart receiver */ -+ amd7930_brecv(0, bcs->channel, -+ hw->rv_buff + hw->rv_buff_in, -+ RCV_BUFSIZE/RCV_BUFBLKS, -+ (void *) &Bchan_recv_callback, -+ (void *) bcs); -+ } -+ -+ hw->rv_buff_out += RCV_BUFSIZE/RCV_BUFBLKS; -+ hw->rv_buff_out %= RCV_BUFSIZE; -+ -+ } while (hw->rv_buff_in != hw->rv_buff_out); -+} -+ -+static void -+Bchan_close(struct BCState *bcs) -+{ -+ struct sk_buff *skb; -+ -+ Bchan_mode(bcs, 0, 0); -+ amd7930_bclose(0, bcs->channel); -+ -+ if (test_bit(BC_FLG_INIT, &bcs->Flag)) { -+ skb_queue_purge(&bcs->rqueue); -+ skb_queue_purge(&bcs->squeue); -+ } -+ test_and_clear_bit(BC_FLG_INIT, &bcs->Flag); -+} -+ -+static int -+Bchan_open(struct BCState *bcs) -+{ -+ struct amd7930_hw *hw = &bcs->hw.amd7930; -+ -+ if (!test_and_set_bit(BC_FLG_INIT, &bcs->Flag)) { -+ skb_queue_head_init(&bcs->rqueue); -+ skb_queue_head_init(&bcs->squeue); -+ } -+ test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag); -+ -+ amd7930_bopen(0, bcs->channel, 0xff); -+ hw->rv_buff_in = 0; -+ hw->rv_buff_out = 0; -+ hw->tx_skb = NULL; -+ init_hdlc_state(hw->hdlc_state, 0); -+ amd7930_brecv(0, bcs->channel, -+ hw->rv_buff + hw->rv_buff_in, RCV_BUFSIZE/RCV_BUFBLKS, -+ (void *) &Bchan_recv_callback, (void *) bcs); -+ -+ bcs->event = 0; -+ bcs->tx_cnt = 0; -+ return (0); -+} -+ -+static void -+Bchan_init(struct BCState *bcs) -+{ -+ if (!(bcs->hw.amd7930.tx_buff = kmalloc(RAW_BUFMAX, GFP_ATOMIC))) { -+ printk(KERN_WARNING -+ "HiSax: No memory for amd7930.tx_buff\n"); -+ return; -+ } -+ if (!(bcs->hw.amd7930.rv_buff = kmalloc(RCV_BUFSIZE, GFP_ATOMIC))) { -+ printk(KERN_WARNING -+ "HiSax: No memory for amd7930.rv_buff\n"); -+ return; -+ } -+ if (!(bcs->hw.amd7930.rv_skb = dev_alloc_skb(HSCX_BUFMAX))) { -+ printk(KERN_WARNING -+ "HiSax: No memory for amd7930.rv_skb\n"); -+ return; -+ } -+ if (!(bcs->hw.amd7930.hdlc_state = kmalloc(sizeof(struct hdlc_state), -+ GFP_ATOMIC))) { -+ printk(KERN_WARNING -+ "HiSax: No memory for amd7930.hdlc_state\n"); -+ return; -+ } -+ -+ bcs->hw.amd7930.tq_rcv.sync = 0; -+ bcs->hw.amd7930.tq_rcv.routine = (void (*)(void *)) &Bchan_rcv_bh; -+ bcs->hw.amd7930.tq_rcv.data = (void *) bcs; -+ -+ bcs->hw.amd7930.tq_xmt.sync = 0; -+ bcs->hw.amd7930.tq_xmt.routine = (void (*)(void *)) &Bchan_xmt_bh; -+ bcs->hw.amd7930.tq_xmt.data = (void *) bcs; -+} -+ -+static void -+Bchan_manl1(struct PStack *st, int pr, -+ void *arg) -+{ -+ switch (pr) { -+ case (PH_ACTIVATE_REQ): -+ test_and_set_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag); -+ Bchan_mode(st->l1.bcs, st->l1.mode, st->l1.bc); -+ st->l1.l1man(st, PH_ACTIVATE_CNF, NULL); -+ break; -+ case (PH_DEACTIVATE_REQ): -+ if (!test_bit(BC_FLG_BUSY, &st->l1.bcs->Flag)) -+ Bchan_mode(st->l1.bcs, 0, 0); -+ test_and_clear_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag); -+ break; -+ } -+} -+ -+int -+setstack_amd7930(struct PStack *st, struct BCState *bcs) -+{ -+ if (Bchan_open(bcs)) -+ return (-1); -+ st->l1.bcs = bcs; -+ st->l2.l2l1 = Bchan_l2l1; -+ st->ma.manl1 = Bchan_manl1; -+ setstack_manager(st); -+ bcs->st = st; -+ return (0); -+} -+ -+ -+static void -+amd7930_drecv_callback(void *arg, int error, unsigned int count) -+{ -+ struct IsdnCardState *cs = (struct IsdnCardState *) arg; -+ static struct tq_struct task; -+ struct sk_buff *skb; -+ -+ /* NOTE: This function is called directly from an interrupt handler */ -+ -+ if (1) { -+ if (!(skb = alloc_skb(count, GFP_ATOMIC))) -+ printk(KERN_WARNING "HiSax: D receive out of memory\n"); -+ else { -+ memcpy(skb_put(skb, count), cs->rcvbuf, count); -+ skb_queue_tail(&cs->rq, skb); -+ } -+ -+ task.routine = (void *) DChannel_proc_rcv; -+ task.data = (void *) cs; -+ queue_task(&task, &tq_immediate); -+ mark_bh(IMMEDIATE_BH); -+ } -+ -+ if (cs->debug & L1_DEB_ISAC_FIFO) { -+ char tmp[128]; -+ char *t = tmp; -+ -+ t += sprintf(t, "amd7930 Drecv cnt %d", count); -+ if (error) t += sprintf(t, " ERR %x", error); -+ QuickHex(t, cs->rcvbuf, count); -+ debugl1(cs, tmp); -+ } -+ -+ amd7930_drecv(0, cs->rcvbuf, MAX_DFRAME_LEN, -+ &amd7930_drecv_callback, cs); -+} -+ -+static void -+amd7930_dxmit_callback(void *arg, int error) -+{ -+ struct IsdnCardState *cs = (struct IsdnCardState *) arg; -+ static struct tq_struct task; -+ -+ /* NOTE: This function is called directly from an interrupt handler */ -+ -+ /* may wish to do retransmission here, if error indicates collision */ -+ -+ if (cs->debug & L1_DEB_ISAC_FIFO) { -+ char tmp[128]; -+ char *t = tmp; -+ -+ t += sprintf(t, "amd7930 Dxmit cnt %d", cs->tx_skb->len); -+ if (error) t += sprintf(t, " ERR %x", error); -+ QuickHex(t, cs->tx_skb->data, cs->tx_skb->len); -+ debugl1(cs, tmp); -+ } -+ -+ cs->tx_skb = NULL; -+ -+ task.routine = (void *) DChannel_proc_xmt; -+ task.data = (void *) cs; -+ queue_task(&task, &tq_immediate); -+ mark_bh(IMMEDIATE_BH); -+} -+ -+static void -+amd7930_Dchan_l2l1(struct PStack *st, int pr, void *arg) -+{ -+ struct IsdnCardState *cs = (struct IsdnCardState *) st->l1.hardware; -+ struct sk_buff *skb = arg; -+ char str[64]; -+ -+ switch (pr) { -+ case (PH_DATA_REQ): -+ if (cs->tx_skb) { -+ skb_queue_tail(&cs->sq, skb); -+#ifdef L2FRAME_DEBUG /* psa */ -+ if (cs->debug & L1_DEB_LAPD) -+ Logl2Frame(cs, skb, "PH_DATA Queued", 0); -+#endif -+ } else { -+ if ((cs->dlogflag) && (!(skb->data[2] & 1))) { -+ /* I-FRAME */ -+ LogFrame(cs, skb->data, skb->len); -+ sprintf(str, "Q.931 frame user->network tei %d", st->l2.tei); -+ dlogframe(cs, skb->data+4, skb->len-4, -+ str); -+ } -+ cs->tx_skb = skb; -+ cs->tx_cnt = 0; -+#ifdef L2FRAME_DEBUG /* psa */ -+ if (cs->debug & L1_DEB_LAPD) -+ Logl2Frame(cs, skb, "PH_DATA", 0); -+#endif -+ amd7930_dxmit(0, skb->data, skb->len, -+ &amd7930_dxmit_callback, cs); -+ } -+ break; -+ case (PH_PULL_IND): -+ if (cs->tx_skb) { -+ if (cs->debug & L1_DEB_WARN) -+ debugl1(cs, " l2l1 tx_skb exist this shouldn't happen"); -+ skb_queue_tail(&cs->sq, skb); -+ break; -+ } -+ if ((cs->dlogflag) && (!(skb->data[2] & 1))) { /* I-FRAME */ -+ LogFrame(cs, skb->data, skb->len); -+ sprintf(str, "Q.931 frame user->network tei %d", st->l2.tei); -+ dlogframe(cs, skb->data + 4, skb->len - 4, -+ str); -+ } -+ cs->tx_skb = skb; -+ cs->tx_cnt = 0; -+#ifdef L2FRAME_DEBUG /* psa */ -+ if (cs->debug & L1_DEB_LAPD) -+ Logl2Frame(cs, skb, "PH_DATA_PULLED", 0); -+#endif -+ amd7930_dxmit(0, cs->tx_skb->data, cs->tx_skb->len, -+ &amd7930_dxmit_callback, cs); -+ break; -+ case (PH_PULL_REQ): -+#ifdef L2FRAME_DEBUG /* psa */ -+ if (cs->debug & L1_DEB_LAPD) -+ debugl1(cs, "-> PH_REQUEST_PULL"); -+#endif -+ if (!cs->tx_skb) { -+ test_and_clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags); -+ st->l1.l1l2(st, PH_PULL_CNF, NULL); -+ } else -+ test_and_set_bit(FLG_L1_PULL_REQ, &st->l1.Flags); -+ break; -+ } -+} -+ -+int -+setDstack_amd7930(struct PStack *st, struct IsdnCardState *cs) -+{ -+ st->l2.l2l1 = amd7930_Dchan_l2l1; -+ if (! cs->rcvbuf) { -+ printk("setDstack_amd7930: No cs->rcvbuf!\n"); -+ } else { -+ amd7930_drecv(0, cs->rcvbuf, MAX_DFRAME_LEN, -+ &amd7930_drecv_callback, cs); -+ } -+ return (0); -+} -+ -+static void -+manl1_msg(struct IsdnCardState *cs, int msg, void *arg) { -+ struct PStack *st; -+ -+ st = cs->stlist; -+ while (st) { -+ st->ma.manl1(st, msg, arg); -+ st = st->next; -+ } -+} -+ -+static void -+amd7930_new_ph(struct IsdnCardState *cs) -+{ -+ switch (amd7930_get_liu_state(0)) { -+ case 3: -+ manl1_msg(cs, PH_POWERUP_CNF, NULL); -+ break; -+ -+ case 7: -+ manl1_msg(cs, PH_I4_P8_IND, NULL); -+ break; -+ -+ case 8: -+ manl1_msg(cs, PH_RSYNC_IND, NULL); -+ break; -+ } -+} -+ -+/* amd7930 LIU state change callback */ -+ -+static void -+amd7930_liu_callback(struct IsdnCardState *cs) -+{ -+ static struct tq_struct task; -+ -+ if (!cs) -+ return; -+ -+ if (cs->debug & L1_DEB_ISAC) { -+ char tmp[32]; -+ sprintf(tmp, "amd7930_liu state %d", amd7930_get_liu_state(0)); -+ debugl1(cs, tmp); -+ } -+ -+ task.sync = 0; -+ task.routine = (void *) &amd7930_new_ph; -+ task.data = (void *) cs; -+ queue_task(&task, &tq_immediate); -+ mark_bh(IMMEDIATE_BH); -+} -+ -+void -+amd7930_l1cmd(struct IsdnCardState *cs, int msg, void *arg) -+{ -+ u_char val; -+ char tmp[32]; -+ -+ if (cs->debug & L1_DEB_ISAC) { -+ char tmp[32]; -+ sprintf(tmp, "amd7930_l1cmd msg %x", msg); -+ debugl1(cs, tmp); -+ } -+ -+ switch(msg) { -+ case PH_RESET_REQ: -+ if (amd7930_get_liu_state(0) <= 3) -+ amd7930_liu_activate(0,0); -+ else -+ amd7930_liu_deactivate(0); -+ break; -+ case PH_ENABLE_REQ: -+ break; -+ case PH_INFO3_REQ: -+ amd7930_liu_activate(0,0); -+ break; -+ case PH_TESTLOOP_REQ: -+ break; -+ default: -+ if (cs->debug & L1_DEB_WARN) { -+ sprintf(tmp, "amd7930_l1cmd unknown %4x", msg); -+ debugl1(cs, tmp); -+ } -+ break; -+ } -+} -+ -+static void init_amd7930(struct IsdnCardState *cs) -+{ -+ Bchan_init(&cs->bcs[0]); -+ Bchan_init(&cs->bcs[1]); -+ cs->bcs[0].BC_SetStack = setstack_amd7930; -+ cs->bcs[1].BC_SetStack = setstack_amd7930; -+ cs->bcs[0].BC_Close = Bchan_close; -+ cs->bcs[1].BC_Close = Bchan_close; -+ Bchan_mode(cs->bcs, 0, 0); -+ Bchan_mode(cs->bcs + 1, 0, 0); -+} -+ -+void -+release_amd7930(struct IsdnCardState *cs) -+{ -+} -+ -+static int -+amd7930_card_msg(struct IsdnCardState *cs, int mt, void *arg) -+{ -+ switch (mt) { -+ case CARD_RESET: -+ return(0); -+ case CARD_RELEASE: -+ release_amd7930(cs); -+ return(0); -+ case CARD_INIT: -+ cs->l1cmd = amd7930_l1cmd; -+ amd7930_liu_init(0, &amd7930_liu_callback, (void *)cs); -+ init_amd7930(cs); -+ return(0); -+ case CARD_TEST: -+ return(0); -+ } -+ return(0); -+} -+ -+int __init -+setup_amd7930(struct IsdnCard *card) -+{ -+ struct IsdnCardState *cs = card->cs; -+ char tmp[64]; -+ -+ strcpy(tmp, amd7930_revision); -+ printk(KERN_INFO "HiSax: AMD7930 driver Rev. %s\n", HiSax_getrev(tmp)); -+ if (cs->typ != ISDN_CTYPE_AMD7930) -+ return (0); -+ -+ cs->irq = amd7930_get_irqnum(0); -+ if (cs->irq == 0) -+ return (0); -+ -+ cs->cardmsg = &amd7930_card_msg; -+ -+ return (1); -+} -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/arcofi.c linux-2.4.29/drivers/isdn/hisax/arcofi.c ---- linux-2.4.29.old/drivers/isdn/hisax/arcofi.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/arcofi.c 2005-03-22 15:06:45.852122200 +0100 -@@ -1,4 +1,4 @@ --/* $Id: arcofi.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: arcofi.c,v 1.14 2001/09/24 13:22:55 kai Exp $ - * - * Ansteuerung ARCOFI 2165 - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/arcofi.h linux-2.4.29/drivers/isdn/hisax/arcofi.h ---- linux-2.4.29.old/drivers/isdn/hisax/arcofi.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/arcofi.h 2005-03-22 15:06:45.872119160 +0100 -@@ -1,4 +1,4 @@ --/* $Id: arcofi.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id$ - * - * Ansteuerung ARCOFI 2165 - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/asuscom.c linux-2.4.29/drivers/isdn/hisax/asuscom.c ---- linux-2.4.29.old/drivers/isdn/hisax/asuscom.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/asuscom.c 2005-03-22 15:06:45.889116576 +0100 -@@ -1,4 +1,4 @@ --/* $Id: asuscom.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: asuscom.c,v 1.14 2001/09/24 13:22:55 kai Exp $ - * - * low level stuff for ASUSCOM NETWORK INC. ISDNLink cards - * -@@ -14,7 +14,6 @@ - - #define __NO_VERSION__ - #include --#include - #include "hisax.h" - #include "isac.h" - #include "ipac.h" -@@ -23,7 +22,7 @@ - - extern const char *CardType[]; - --const char *Asuscom_revision = "$Revision: 1.1.4.1 $"; -+const char *Asuscom_revision = "$Revision: 1.14 $"; - - #define byteout(addr,val) outb(val,addr) - #define bytein(addr) inb(addr) -@@ -310,27 +309,6 @@ - return(0); - } - --#ifdef __ISAPNP__ --static struct isapnp_device_id asus_ids[] __initdata = { -- { ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1688), -- ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1688), -- (unsigned long) "Asus1688 PnP" }, -- { ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1690), -- ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1690), -- (unsigned long) "Asus1690 PnP" }, -- { ISAPNP_VENDOR('S', 'I', 'E'), ISAPNP_FUNCTION(0x0020), -- ISAPNP_VENDOR('S', 'I', 'E'), ISAPNP_FUNCTION(0x0020), -- (unsigned long) "Isurf2 PnP" }, -- { ISAPNP_VENDOR('E', 'L', 'F'), ISAPNP_FUNCTION(0x0000), -- ISAPNP_VENDOR('E', 'L', 'F'), ISAPNP_FUNCTION(0x0000), -- (unsigned long) "Iscas TE320" }, -- { 0, } --}; -- --static struct isapnp_device_id *adev = &asus_ids[0]; --static struct pci_bus *pnp_c __devinitdata = NULL; --#endif -- - int __init - setup_asuscom(struct IsdnCard *card) - { -@@ -343,45 +321,7 @@ - printk(KERN_INFO "HiSax: Asuscom ISDNLink driver Rev. %s\n", HiSax_getrev(tmp)); - if (cs->typ != ISDN_CTYPE_ASUSCOM) - return (0); --#ifdef __ISAPNP__ -- if (!card->para[1] && isapnp_present()) { -- struct pci_bus *pb; -- struct pci_dev *pd; -- -- while(adev->card_vendor) { -- if ((pb = isapnp_find_card(adev->card_vendor, -- adev->card_device, pnp_c))) { -- pnp_c = pb; -- pd = NULL; -- if ((pd = isapnp_find_dev(pnp_c, -- adev->vendor, adev->function, pd))) { -- printk(KERN_INFO "HiSax: %s detected\n", -- (char *)adev->driver_data); -- pd->prepare(pd); -- pd->deactivate(pd); -- pd->activate(pd); -- card->para[1] = pd->resource[0].start; -- card->para[0] = pd->irq_resource[0].start; -- if (!card->para[0] || !card->para[1]) { -- printk(KERN_ERR "AsusPnP:some resources are missing %ld/%lx\n", -- card->para[0], card->para[1]); -- pd->deactivate(pd); -- return(0); -- } -- break; -- } else { -- printk(KERN_ERR "AsusPnP: PnP error card found, no device\n"); -- } -- } -- adev++; -- pnp_c=NULL; -- } -- if (!adev->card_vendor) { -- printk(KERN_INFO "AsusPnP: no ISAPnP card found\n"); -- return(0); -- } -- } --#endif -+ - bytecnt = 8; - cs->hw.asus.cfg_reg = card->para[1]; - cs->irq = card->para[0]; -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/avm_a1.c linux-2.4.29/drivers/isdn/hisax/avm_a1.c ---- linux-2.4.29.old/drivers/isdn/hisax/avm_a1.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/avm_a1.c 2005-03-22 15:06:45.904114296 +0100 -@@ -1,4 +1,4 @@ --/* $Id: avm_a1.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: avm_a1.c,v 2.15 2001/09/24 13:22:55 kai Exp $ - * - * low level stuff for AVM A1 (Fritz) isdn cards - * -@@ -18,7 +18,7 @@ - #include "isdnl1.h" - - extern const char *CardType[]; --static const char *avm_revision = "$Revision: 1.1.4.1 $"; -+static const char *avm_revision = "$Revision: 2.15 $"; - - #define AVM_A1_STAT_ISAC 0x01 - #define AVM_A1_STAT_HSCX 0x02 -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/avm_a1p.c linux-2.4.29/drivers/isdn/hisax/avm_a1p.c ---- linux-2.4.29.old/drivers/isdn/hisax/avm_a1p.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/avm_a1p.c 2005-03-22 15:06:45.919112016 +0100 -@@ -1,4 +1,4 @@ --/* $Id: avm_a1p.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: avm_a1p.c,v 2.9 2001/09/24 13:22:55 kai Exp $ - * - * low level stuff for the following AVM cards: - * A1 PCMCIA -@@ -57,7 +57,7 @@ - #define byteout(addr,val) outb(val,addr) - #define bytein(addr) inb(addr) - --static const char *avm_revision = "$Revision: 1.1.4.1 $"; -+static const char *avm_revision = "$Revision: 2.9 $"; - - static inline u_char - ReadISAC(struct IsdnCardState *cs, u_char offset) -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/avm_pci.c linux-2.4.29/drivers/isdn/hisax/avm_pci.c ---- linux-2.4.29.old/drivers/isdn/hisax/avm_pci.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/avm_pci.c 2005-03-22 15:06:45.945108064 +0100 -@@ -1,4 +1,4 @@ --/* $Id: avm_pci.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: avm_pci.c,v 1.29 2001/09/24 13:22:55 kai Exp $ - * - * low level stuff for AVM Fritz!PCI and ISA PnP isdn cards - * -@@ -19,11 +19,11 @@ - #include "isac.h" - #include "isdnl1.h" - #include --#include -+#include - #include - - extern const char *CardType[]; --static const char *avm_pci_rev = "$Revision: 1.1.4.1 $"; -+static const char *avm_pci_rev = "$Revision: 1.29 $"; - - #define AVM_FRITZ_PCI 1 - #define AVM_FRITZ_PNP 2 -@@ -291,8 +291,7 @@ - debugl1(cs, "hdlc_empty_fifo: incoming packet too large"); - return; - } -- p = bcs->hw.hdlc.rcvbuf + bcs->hw.hdlc.rcvidx; -- ptr = (u_int *)p; -+ ptr = (u_int *) p = bcs->hw.hdlc.rcvbuf + bcs->hw.hdlc.rcvidx; - bcs->hw.hdlc.rcvidx += count; - if (cs->subtyp == AVM_FRITZ_PCI) { - outl(idx, cs->hw.avm.cfg_reg + 4); -@@ -353,8 +352,7 @@ - } - if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO)) - debugl1(cs, "hdlc_fill_fifo %d/%ld", count, bcs->tx_skb->len); -- p = bcs->tx_skb->data; -- ptr = (u_int *)p; -+ ptr = (u_int *) p = bcs->tx_skb->data; - skb_pull(bcs->tx_skb, count); - bcs->tx_cnt -= count; - bcs->hw.hdlc.count += count; -@@ -766,10 +764,6 @@ - } - - static struct pci_dev *dev_avm __initdata = NULL; --#ifdef __ISAPNP__ --static struct pci_bus *bus_avm __initdata = NULL; --static struct pci_dev *pnp_avm __initdata = NULL; --#endif - - int __init - setup_avm_pcipnp(struct IsdnCard *card) -@@ -783,47 +777,10 @@ - if (cs->typ != ISDN_CTYPE_FRITZPCI) - return (0); - if (card->para[1]) { -- /* old manual method */ - cs->hw.avm.cfg_reg = card->para[1]; - cs->irq = card->para[0]; - cs->subtyp = AVM_FRITZ_PNP; - } else { --#ifdef __ISAPNP__ -- if (isapnp_present()) { -- struct pci_bus *ba; -- if ((ba = isapnp_find_card( -- ISAPNP_VENDOR('A', 'V', 'M'), -- ISAPNP_FUNCTION(0x0900), bus_avm))) { -- bus_avm = ba; -- pnp_avm = NULL; -- if ((pnp_avm = isapnp_find_dev(bus_avm, -- ISAPNP_VENDOR('A', 'V', 'M'), -- ISAPNP_FUNCTION(0x0900), pnp_avm))) { -- pnp_avm->prepare(pnp_avm); -- pnp_avm->deactivate(pnp_avm); -- pnp_avm->activate(pnp_avm); -- cs->hw.avm.cfg_reg = -- pnp_avm->resource[0].start; -- cs->irq = -- pnp_avm->irq_resource[0].start; -- if (!cs->irq) { -- printk(KERN_ERR "FritzPnP:No IRQ\n"); -- pnp_avm->deactivate(pnp_avm); -- return(0); -- } -- if (!cs->hw.avm.cfg_reg) { -- printk(KERN_ERR "FritzPnP:No IO address\n"); -- pnp_avm->deactivate(pnp_avm); -- return(0); -- } -- cs->subtyp = AVM_FRITZ_PNP; -- goto ready; -- } -- } -- } else { -- printk(KERN_INFO "FritzPnP: no ISA PnP present\n"); -- } --#endif - #if CONFIG_PCI - if (!pci_present()) { - printk(KERN_ERR "FritzPCI: no PCI bus present\n"); -@@ -838,7 +795,7 @@ - } - if (pci_enable_device(dev_avm)) - return(0); -- cs->hw.avm.cfg_reg = pci_resource_start(dev_avm, 1); -+ cs->hw.avm.cfg_reg = pci_resource_start_io(dev_avm, 1); - if (!cs->hw.avm.cfg_reg) { - printk(KERN_ERR "FritzPCI: No IO-Adr for PCI card found\n"); - return(0); -@@ -854,7 +811,6 @@ - return (0); - #endif /* CONFIG_PCI */ - } --ready: - cs->hw.avm.isac = cs->hw.avm.cfg_reg + 0x10; - if (check_region((cs->hw.avm.cfg_reg), 32)) { - printk(KERN_WARNING -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/bkm_a4t.c linux-2.4.29/drivers/isdn/hisax/bkm_a4t.c ---- linux-2.4.29.old/drivers/isdn/hisax/bkm_a4t.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/bkm_a4t.c 2005-03-22 15:06:45.962105480 +0100 -@@ -1,4 +1,4 @@ --/* $Id: bkm_a4t.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: bkm_a4t.c,v 1.22 2001/09/24 13:22:55 kai Exp $ - * - * low level stuff for T-Berkom A4T - * -@@ -20,11 +20,12 @@ - #include "jade.h" - #include "isdnl1.h" - #include -+#include - #include "bkm_ax.h" - - extern const char *CardType[]; - --const char *bkm_a4t_revision = "$Revision: 1.1.4.1 $"; -+const char *bkm_a4t_revision = "$Revision: 1.22 $"; - - - static inline u_char -@@ -293,13 +294,13 @@ - u16 sub_sys; - u16 sub_vendor; - -- sub_vendor = dev_a4t->subsystem_vendor; -- sub_sys = dev_a4t->subsystem_device; -+ pci_get_sub_vendor(dev_a4t,sub_vendor); -+ pci_get_sub_system(dev_a4t,sub_sys); - if ((sub_sys == PCI_DEVICE_ID_BERKOM_A4T) && (sub_vendor == PCI_VENDOR_ID_BERKOM)) { - if (pci_enable_device(dev_a4t)) - return(0); - found = 1; -- pci_memaddr = pci_resource_start(dev_a4t, 0); -+ pci_memaddr = pci_resource_start_mem(dev_a4t, 0); - cs->irq = dev_a4t->irq; - break; - } -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/bkm_a8.c linux-2.4.29/drivers/isdn/hisax/bkm_a8.c ---- linux-2.4.29.old/drivers/isdn/hisax/bkm_a8.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/bkm_a8.c 2005-03-22 15:06:45.982102440 +0100 -@@ -1,4 +1,4 @@ --/* $Id: bkm_a8.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: bkm_a8.c,v 1.22 2001/09/24 13:22:55 kai Exp $ - * - * low level stuff for Scitel Quadro (4*S0, passive) - * -@@ -20,6 +20,7 @@ - #include "hscx.h" - #include "isdnl1.h" - #include -+#include - #include "bkm_ax.h" - - #if CONFIG_PCI -@@ -28,7 +29,7 @@ - - extern const char *CardType[]; - --const char sct_quadro_revision[] = "$Revision: 1.1.4.1 $"; -+const char sct_quadro_revision[] = "$Revision: 1.22 $"; - - static const char *sct_quadro_subtypes[] = - { -@@ -329,13 +330,13 @@ - while ((dev_a8 = pci_find_device(PCI_VENDOR_ID_PLX, - PCI_DEVICE_ID_PLX_9050, dev_a8))) { - -- sub_vendor_id = dev_a8->subsystem_vendor; -- sub_sys_id = dev_a8->subsystem_device; -+ pci_get_sub_vendor(dev_a8,sub_vendor_id); -+ pci_get_sub_system(dev_a8,sub_sys_id); - if ((sub_sys_id == PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO) && - (sub_vendor_id == PCI_VENDOR_ID_BERKOM)) { - if (pci_enable_device(dev_a8)) - return(0); -- pci_ioaddr1 = pci_resource_start(dev_a8, 1); -+ pci_ioaddr1 = pci_resource_start_io(dev_a8, 1); - pci_irq = dev_a8->irq; - pci_bus = dev_a8->bus->number; - pci_device_fn = dev_a8->devfn; -@@ -365,7 +366,7 @@ - pci_ioaddr1 &= PCI_BASE_ADDRESS_IO_MASK; - pcibios_write_config_dword(pci_bus, pci_device_fn, - PCI_BASE_ADDRESS_1, pci_ioaddr1); -- dev_a8->resource[ 1].start = pci_ioaddr1; -+ get_pcibase(dev_a8, 1) = pci_ioaddr1; - } - #endif /* End HACK */ - } -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/bkm_ax.h linux-2.4.29/drivers/isdn/hisax/bkm_ax.h ---- linux-2.4.29.old/drivers/isdn/hisax/bkm_ax.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/bkm_ax.h 2005-03-22 15:06:46.010098184 +0100 -@@ -1,4 +1,4 @@ --/* $Id: bkm_ax.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id$ - * - * low level decls for T-Berkom cards A4T and Scitel Quadro (4*S0, passive) - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/callc.c linux-2.4.29/drivers/isdn/hisax/callc.c ---- linux-2.4.29.old/drivers/isdn/hisax/callc.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/callc.c 2005-03-22 15:06:46.027095600 +0100 -@@ -1,4 +1,4 @@ --/* $Id: callc.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: callc.c,v 2.59 2002/02/09 21:19:11 keil Exp $ - * - * Author Karsten Keil - * Copyright by Karsten Keil -@@ -26,7 +26,7 @@ - #define MOD_USE_COUNT ( GET_USE_COUNT (&__this_module)) - #endif /* MODULE */ - --const char *lli_revision = "$Revision: 1.1.4.1 $"; -+const char *lli_revision = "$Revision: 2.59 $"; - - extern struct IsdnCard cards[]; - extern int nrcards; -@@ -145,9 +145,11 @@ - EV_PROCEED, /* 20 */ - EV_ALERT, /* 21 */ - EV_REDIR, /* 22 */ -+ EV_ALERTING, /* 23 */ -+ EV_PROCEEDING, /* 24 */ - }; - --#define EVENT_COUNT (EV_REDIR + 1) -+#define EVENT_COUNT (EV_PROCEEDING + 1) - - static char *strEvent[] = - { -@@ -174,6 +176,8 @@ - "EV_PROCEED", - "EV_ALERT", - "EV_REDIR", -+ "EV_ALERTING", -+ "EV_PROCEEDING", - }; - - -@@ -286,6 +290,22 @@ - } - - static void -+lli_alerting(struct FsmInst *fi, int event, void *arg) -+{ -+ struct Channel *chanp = fi->userdata; -+ -+ HL_LL(chanp, ISDN_STAT_ALERT); -+} -+ -+static void -+lli_proceeding(struct FsmInst *fi, int event, void *arg) -+{ -+ struct Channel *chanp = fi->userdata; -+ -+ HL_LL(chanp, ISDN_STAT_PROCEED); -+} -+ -+static void - lli_resume(struct FsmInst *fi, int event, void *arg) - { - struct Channel *chanp = fi->userdata; -@@ -784,6 +804,8 @@ - {ST_OUT_DIAL, EV_DISCONNECT_IND, lli_release_req}, - {ST_OUT_DIAL, EV_RELEASE, lli_dhup_close}, - {ST_OUT_DIAL, EV_NOSETUP_RSP, lli_no_setup_rsp}, -+ {ST_OUT_DIAL, EV_PROCEEDING, lli_proceeding}, -+ {ST_OUT_DIAL, EV_ALERTING, lli_alerting}, - {ST_OUT_DIAL, EV_SETUP_ERR, lli_error}, - {ST_IN_WAIT_LL, EV_LEASED_REL, lli_failure_l}, - {ST_IN_WAIT_LL, EV_ACCEPTD, lli_setup_rsp}, -@@ -925,7 +947,7 @@ - ic.driver = cs->myid; - ic.command = ISDN_STAT_REDIR; - ic.arg = chan; -- ic.parm.num[0] = result; -+ (ulong)(ic.parm.num[0]) = result; - cs->iif.statcallb(&ic); - } /* stat_redir_result */ - -@@ -997,8 +1019,13 @@ - FsmEvent(&chanp->fi, EV_RELEASE, NULL); - break; - case (CC_PROCEED_SEND | INDICATION): -+ break; - case (CC_PROCEEDING | INDICATION): -+ FsmEvent(&chanp->fi, EV_PROCEEDING, NULL); -+ break; - case (CC_ALERTING | INDICATION): -+ FsmEvent(&chanp->fi, EV_ALERTING, NULL); -+ break; - case (CC_PROGRESS | INDICATION): - case (CC_NOTIFY | INDICATION): - break; -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/cert.c linux-2.4.29/drivers/isdn/hisax/cert.c ---- linux-2.4.29.old/drivers/isdn/hisax/cert.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/cert.c 2005-03-22 15:06:46.042093320 +0100 -@@ -1,4 +1,4 @@ --/* $Id: cert.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: cert.c,v 2.6 2001/09/24 13:22:56 kai Exp $ - * - * Author Karsten Keil - * Copyright by Karsten Keil -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/config.c linux-2.4.29/drivers/isdn/hisax/config.c ---- linux-2.4.29.old/drivers/isdn/hisax/config.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/config.c 2005-03-22 15:06:46.077088000 +0100 -@@ -1,4 +1,4 @@ --/* $Id: config.c,v 1.1.4.5 2001/12/09 19:19:26 kai Exp $ -+/* $Id: config.c,v 2.84 2002/08/13 09:55:29 keil Exp $ - * - * Author Karsten Keil - * Copyright by Karsten Keil -@@ -24,6 +24,11 @@ - #include - #include - #include -+ -+#ifdef CONFIG_HISAX_HFC_USB -+#include "hisax_loadable.h" -+#endif -+ - #define HISAX_STATUS_BUFSIZE 4096 - #define INCLUDE_INLINE_FUNCS - -@@ -75,8 +80,7 @@ - * 37 HFC 2BDS0 S+/SP p0=irq p1=iobase - * 38 Travers Technologies NETspider-U PCI card - * 39 HFC 2BDS0-SP PCMCIA p0=irq p1=iobase -- * 40 hotplug interface -- * 41 Formula-n enter:now ISDN PCI a/b none -+ * 40 HFC-S USB none - * - * protocol can be either ISDN_PTYPE_EURO or ISDN_PTYPE_1TR6 or ISDN_PTYPE_NI1 - * -@@ -95,11 +99,17 @@ - "Siemens I-Surf", "Acer P10", "HST Saphir", "Telekom A4T", - "Scitel Quadro", "Gazel", "HFC 2BDS0 PCI", "Winbond 6692", - "HFC 2BDS0 SX", "NETspider-U", "HFC-2BDS0-SP PCMCIA", -- "Hotplug", "Formula-n enter:now PCI a/b", -+ "HFC-S USB", - }; - - void HiSax_closecard(int cardnr); - -+#ifdef CONFIG_HISAX_HFC_USB -+#define DEFAULT_CARD ISDN_CTYPE_HFC_USB -+#define DEFAULT_CFG {0,0,0,0} -+EXPORT_SYMBOL(hisax_register_hfcusb); -+#endif -+ - #ifdef CONFIG_HISAX_ELSA - #define DEFAULT_CARD ISDN_CTYPE_ELSA - #define DEFAULT_CFG {0,0,0,0} -@@ -339,19 +349,27 @@ - NULL, \ - } - --struct IsdnCard cards[HISAX_MAX_CARDS] = { -+#define EMPTY_CARD {0, DEFAULT_PROTO, {0, 0, 0, 0}, NULL} -+ -+struct IsdnCard cards[] = { - FIRST_CARD, -+ EMPTY_CARD, -+ EMPTY_CARD, -+ EMPTY_CARD, -+ EMPTY_CARD, -+ EMPTY_CARD, -+ EMPTY_CARD, -+ EMPTY_CARD, - }; - --#define HISAX_IDSIZE (HISAX_MAX_CARDS*8) --static char HiSaxID[HISAX_IDSIZE] __devinitdata = { 0, }; -+static char HiSaxID[64] __devinitdata = { 0, }; - - char *HiSax_id __devinitdata = HiSaxID; - #ifdef MODULE - /* Variables for insmod */ --static int type[HISAX_MAX_CARDS] __devinitdata = { 0, }; --static int protocol[HISAX_MAX_CARDS] __devinitdata = { 0, }; --static int io[HISAX_MAX_CARDS] __devinitdata = { 0, }; -+static int type[8] __devinitdata = { 0, }; -+static int protocol[8] __devinitdata = { 0, }; -+static int io[8] __devinitdata = { 0, }; - #undef IO0_IO1 - #ifdef CONFIG_HISAX_16_3 - #define IO0_IO1 -@@ -361,27 +379,23 @@ - #define IO0_IO1 - #endif - #ifdef IO0_IO1 --static int io0[HISAX_MAX_CARDS] __devinitdata = { 0, }; --static int io1[HISAX_MAX_CARDS] __devinitdata = { 0, }; -+static int io0[8] __devinitdata = { 0, }; -+static int io1[8] __devinitdata = { 0, }; - #endif --static int irq[HISAX_MAX_CARDS] __devinitdata = { 0, }; --static int mem[HISAX_MAX_CARDS] __devinitdata = { 0, }; -+static int irq[8] __devinitdata = { 0, }; -+static int mem[8] __devinitdata = { 0, }; - static char *id __devinitdata = HiSaxID; - --#define PARM_PARA "1-" __MODULE_STRING(HISAX_MAX_CARDS) "i" -- --MODULE_DESCRIPTION("ISDN4Linux: Driver for passive ISDN cards"); - MODULE_AUTHOR("Karsten Keil"); --MODULE_LICENSE("GPL"); --MODULE_PARM(type, PARM_PARA); --MODULE_PARM(protocol, PARM_PARA); --MODULE_PARM(io, PARM_PARA); --MODULE_PARM(irq, PARM_PARA); --MODULE_PARM(mem, PARM_PARA); -+MODULE_PARM(type, "1-8i"); -+MODULE_PARM(protocol, "1-8i"); -+MODULE_PARM(io, "1-8i"); -+MODULE_PARM(irq, "1-8i"); -+MODULE_PARM(mem, "1-8i"); - MODULE_PARM(id, "s"); - #ifdef IO0_IO1 --MODULE_PARM(io0, PARM_PARA); --MODULE_PARM(io1, PARM_PARA); -+MODULE_PARM(io0, "1-8i"); -+MODULE_PARM(io1, "1-8i"); - #endif - #endif /* MODULE */ - -@@ -432,6 +446,7 @@ - } - - #ifndef MODULE -+#ifdef COMPAT_HAS_NEW_SETUP - #define MAX_ARG (HISAX_MAX_CARDS*5) - static int __init HiSax_setup(char *line) - { -@@ -440,12 +455,16 @@ - char *str; - - str = get_options(line, MAX_ARG, ints); -+#else -+void __init HiSax_setup(char *str, int *ints) -+{ -+ int i, j, argc; -+#endif - argc = ints[0]; - printk(KERN_DEBUG "HiSax_setup: argc(%d) str(%s)\n", argc, str); - i = 0; - j = 1; - while (argc && (i < HISAX_MAX_CARDS)) { -- cards[i].protocol = DEFAULT_PROTO; - if (argc) { - cards[i].typ = ints[j]; - j++; -@@ -473,19 +492,21 @@ - } - i++; - } -- if (str && *str) { -- if (strlen(str) < HISAX_IDSIZE) -- strcpy(HiSaxID, str); -- else -- printk(KERN_WARNING "HiSax: ID too long!"); -- } else -+ if (str && *str) { -+ strcpy(HiSaxID, str); -+ HiSax_id = HiSaxID; -+ } else { - strcpy(HiSaxID, "HiSax"); -- -- HiSax_id = HiSaxID; -+ HiSax_id = HiSaxID; -+ } -+#ifdef COMPAT_HAS_NEW_SETUP - return 1; - } - - __setup("hisax=", HiSax_setup); -+#else -+} -+#endif /* COMPAT_HAS_NEW_SETUP */ - #endif /* MODULES */ - - #if CARD_TELES0 -@@ -560,6 +581,10 @@ - extern int setup_hfcpci(struct IsdnCard *card); - #endif - -+#if CONFIG_HISAX_HFC_USB -+extern int setup_hfc_usb(struct IsdnCard *card); -+#endif -+ - #if CARD_HFC_SX - extern int setup_hfcsx(struct IsdnCard *card); - #endif -@@ -604,10 +629,6 @@ - extern int setup_netjet_u(struct IsdnCard *card); - #endif - --#if CARD_FN_ENTERNOW_PCI --extern int setup_enternow_pci(struct IsdnCard *card); --#endif -- - /* - * Find card with given driverId - */ -@@ -899,7 +920,8 @@ - return 3; - } - --static int __devinit checkcard(int cardnr, char *id, int *busy_flag) -+static int __devinit checkcard(int cardnr, char *id, int *busy_flag, -+ void *load_drv) - { - long flags; - int ret = 0; -@@ -1093,6 +1115,12 @@ - ret = setup_hfcsx(card); - break; - #endif -+#if CONFIG_HISAX_HFC_USB -+ case ISDN_CTYPE_HFC_USB: -+ cs->hw.hfcusb.drv = load_drv; -+ ret = setup_hfc_usb(card); -+ break; -+#endif - #if CARD_NICCY - case ISDN_CTYPE_NICCY: - ret = setup_niccy(card); -@@ -1143,11 +1171,6 @@ - ret = setup_netjet_u(card); - break; - #endif --#if CARD_FN_ENTERNOW_PCI -- case ISDN_CTYPE_ENTERNOW: -- ret = setup_enternow_pci(card); -- break; --#endif - case ISDN_CTYPE_DYNAMIC: - ret = 2; - break; -@@ -1186,6 +1209,9 @@ - case ISDN_CTYPE_DYNAMIC: - ret = 0; - break; -+ case ISDN_CTYPE_HFC_USB: -+ ret = cs->cardmsg(cs, CARD_INIT, NULL); -+ break; - default: - ret = init_card(cs); - break; -@@ -1257,16 +1283,13 @@ - else - sprintf(ids, "%s%d", id, i); - } -- if (checkcard(i, ids, busy_flag)) { -+ if (checkcard(i, ids, busy_flag, NULL)) { - foundcards++; - i++; - } else { -- /* make sure we don't oops the module */ -- if (cards[i].typ > 0 && cards[i].typ <= ISDN_CTYPE_COUNT) { -- printk(KERN_WARNING -- "HiSax: Card %s not installed !\n", -- CardType[cards[i].typ]); -- } -+ printk(KERN_WARNING -+ "HiSax: Card %s not installed !\n", -+ CardType[cards[i].typ]); - HiSax_shiftcards(i); - nrcards--; - } -@@ -1342,6 +1365,49 @@ - #endif - } - -+#ifdef CONFIG_HISAX_HFC_USB -+int -+hisax_register_hfcusb(struct hisax_drvreg *l1drv) -+{ -+ int i; -+ char ids[30]; -+ -+ if (l1drv->version != HISAX_LOAD_VERSION) -+ return 1; -+ -+ switch (l1drv->cmd) { -+ case HISAX_LOAD_CHKVER: -+ break; /* success */ -+ -+ case HISAX_LOAD_REGISTER: -+ for (i = 0; i < HISAX_MAX_CARDS; i++) { -+ if (!cards[i].typ) -+ break; -+ } -+ if (i >= HISAX_MAX_CARDS) -+ return 1; /* no space */ -+ cards[i].typ = ISDN_CTYPE_HFC_USB; /* setup type */ -+ cards[i].protocol = DEFAULT_PROTO; -+ sprintf(ids, "%s%d", l1drv->drvname, i); -+ if (checkcard(i, ids, NULL, (void *) l1drv)) { -+ nrcards++; -+ return 0; -+ } -+ if (cards[i].cs) -+ kfree((void *) cards[i].cs); -+ cards[i].cs = NULL; -+ cards[i].typ = 0; /* no card present */ -+ return 1; -+ break; -+ -+ default: -+ return 1; /* unknown command */ -+ } -+ -+ return 0; -+} /* hisax_register_hfcusb */ -+#endif -+ - static int __init HiSax_init(void) - { - int i, retval; -@@ -1408,8 +1474,6 @@ - if (protocol[i]) { - cards[j].protocol = protocol[i]; - nzproto++; -- } else { -- cards[j].protocol = DEFAULT_PROTO; - } - switch (type[i]) { - case ISDN_CTYPE_16_0: -@@ -1487,22 +1551,15 @@ - } else { - /* QUADRO is a 4 BRI card */ - cards[j++].para[0] = 1; -- /* we need to check if further cards can be added */ -- if (j < HISAX_MAX_CARDS) { -- cards[j].typ = ISDN_CTYPE_SCT_QUADRO; -- cards[j].protocol = protocol[i]; -- cards[j++].para[0] = 2; -- } -- if (j < HISAX_MAX_CARDS) { -- cards[j].typ = ISDN_CTYPE_SCT_QUADRO; -- cards[j].protocol = protocol[i]; -- cards[j++].para[0] = 3; -- } -- if (j < HISAX_MAX_CARDS) { -- cards[j].typ = ISDN_CTYPE_SCT_QUADRO; -- cards[j].protocol = protocol[i]; -- cards[j].para[0] = 4; -- } -+ cards[j].typ = ISDN_CTYPE_SCT_QUADRO; -+ cards[j].protocol = protocol[i]; -+ cards[j++].para[0] = 2; -+ cards[j].typ = ISDN_CTYPE_SCT_QUADRO; -+ cards[j].protocol = protocol[i]; -+ cards[j++].para[0] = 3; -+ cards[j].typ = ISDN_CTYPE_SCT_QUADRO; -+ cards[j].protocol = protocol[i]; -+ cards[j].para[0] = 4; - } - break; - } -@@ -1526,10 +1583,15 @@ - nrcards, (nrcards > 1) ? "s" : ""); - - /* Install only, if at least one card found */ -- if (!HiSax_inithardware(NULL)) -- return -ENODEV; -+ if (!HiSax_inithardware(NULL)) { -+ retval = -EIO; -+ goto out_isdnl1; -+ } -+ - return 0; - -+ out_isdnl1: -+ Isdnl1Free(); - out_tei: - TeiFree(); - out_isdnl2: -@@ -1576,8 +1638,6 @@ - cards[i].typ = type[i]; - if (protocol[i]) { - cards[i].protocol = protocol[i]; -- } else { -- cards[i].protocol = DEFAULT_PROTO; - } - } - cards[0].para[0] = pcm_irq; -@@ -1595,8 +1655,7 @@ - printk(KERN_DEBUG "HiSax: Total %d card%s defined\n", - nrcards, (nrcards > 1) ? "s" : ""); - -- if (!HiSax_inithardware(busy_flag)) -- return -ENODEV; -+ HiSax_inithardware(busy_flag); - printk(KERN_NOTICE "HiSax: module installed\n"); - #endif - return 0; -@@ -1619,8 +1678,6 @@ - cards[i].typ = type[i]; - if (protocol[i]) { - cards[i].protocol = protocol[i]; -- } else { -- cards[i].protocol = DEFAULT_PROTO; - } - } - cards[0].para[0] = pcm_irq; -@@ -1638,8 +1695,7 @@ - printk(KERN_DEBUG "HiSax: Total %d card%s defined\n", - nrcards, (nrcards > 1) ? "s" : ""); - -- if (!HiSax_inithardware(busy_flag)) -- return -ENODEV; -+ HiSax_inithardware(busy_flag); - printk(KERN_NOTICE "HiSax: module installed\n"); - #endif - return 0; -@@ -1662,8 +1718,6 @@ - cards[i].typ = type[i]; - if (protocol[i]) { - cards[i].protocol = protocol[i]; -- } else { -- cards[i].protocol = DEFAULT_PROTO; - } - } - cards[0].para[0] = pcm_irq; -@@ -1681,8 +1735,7 @@ - printk(KERN_DEBUG "HiSax: Total %d card%s defined\n", - nrcards, (nrcards > 1) ? "s" : ""); - -- if (!HiSax_inithardware(busy_flag)) -- return -ENODEV; -+ HiSax_inithardware(busy_flag); - printk(KERN_NOTICE "HiSax: module installed\n"); - #endif - return 0; -@@ -1705,8 +1758,6 @@ - cards[i].typ = type[i]; - if (protocol[i]) { - cards[i].protocol = protocol[i]; -- } else { -- cards[i].protocol = DEFAULT_PROTO; - } - } - cards[0].para[0] = pcm_irq; -@@ -1724,8 +1775,7 @@ - printk(KERN_DEBUG "HiSax: Total %d card%s defined\n", - nrcards, (nrcards > 1) ? "s" : ""); - -- if (!HiSax_inithardware(busy_flag)) -- return -ENODEV; -+ HiSax_inithardware(busy_flag); - printk(KERN_NOTICE "HiSax: module installed\n"); - #endif - return 0; -@@ -1743,7 +1793,7 @@ - sprintf(ids, "HiSax%d", nrcards); - else - sprintf(ids, "HiSax"); -- if (!checkcard(nrcards, ids, busy_flag)) { -+ if (!checkcard(nrcards, ids, busy_flag, NULL)) { - return -1; - } - ret = nrcards; -@@ -1785,7 +1835,7 @@ - cards[i].protocol = protocol; - sprintf(id, "%s%d", name, i); - nrcards++; -- retval = checkcard(i, id, 0); -+ retval = checkcard(i, id, 0, NULL); - if (retval == 0) { // yuck - cards[i].typ = 0; - nrcards--; -@@ -2117,9 +2167,6 @@ - {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA20, PCI_ANY_ID, PCI_ANY_ID}, - {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA20_U, PCI_ANY_ID, PCI_ANY_ID}, - {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA201, PCI_ANY_ID, PCI_ANY_ID}, --//######################################################################################### -- {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA202, PCI_ANY_ID, PCI_ANY_ID}, --//######################################################################################### - #endif - #ifdef CONFIG_HISAX_ELSA - {PCI_VENDOR_ID_ELSA, PCI_DEVICE_ID_ELSA_MICROLINK, PCI_ANY_ID, PCI_ANY_ID}, -@@ -2178,11 +2225,3 @@ - - module_init(HiSax_init); - module_exit(HiSax_exit); -- --EXPORT_SYMBOL(FsmNew); --EXPORT_SYMBOL(FsmFree); --EXPORT_SYMBOL(FsmEvent); --EXPORT_SYMBOL(FsmChangeState); --EXPORT_SYMBOL(FsmInitTimer); --EXPORT_SYMBOL(FsmDelTimer); --EXPORT_SYMBOL(FsmRestartTimer); -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/diva.c linux-2.4.29/drivers/isdn/hisax/diva.c ---- linux-2.4.29.old/drivers/isdn/hisax/diva.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/diva.c 2005-03-22 15:06:46.106083592 +0100 -@@ -1,4 +1,4 @@ --/* $Id: diva.c,v 1.1.4.2 2002/08/30 11:21:00 keil Exp $ -+/* $Id: diva.c,v 1.33 2001/09/24 13:22:56 kai Exp $ - * - * low level stuff for Eicon.Diehl Diva Family ISDN cards - * -@@ -22,14 +22,13 @@ - #include "isac.h" - #include "hscx.h" - #include "ipac.h" --#include "ipacx.h" - #include "isdnl1.h" - #include --#include -+#include - - extern const char *CardType[]; - --const char *Diva_revision = "$Revision: 1.1.4.2 $"; -+const char *Diva_revision = "$Revision: 1.33 $"; - - #define byteout(addr,val) outb(val,addr) - #define bytein(addr) inb(addr) -@@ -51,7 +50,6 @@ - #define DIVA_PCI 2 - #define DIVA_IPAC_ISA 3 - #define DIVA_IPAC_PCI 4 --#define DIVA_IPACX_PCI 5 - - /* CTRL (Read) */ - #define DIVA_IRQ_STAT 0x01 -@@ -71,12 +69,10 @@ - #define PITA_MISC_REG 0x1c - #ifdef __BIG_ENDIAN - #define PITA_PARA_SOFTRESET 0x00000001 --#define PITA_SER_SOFTRESET 0x00000002 - #define PITA_PARA_MPX_MODE 0x00000004 - #define PITA_INT0_ENABLE 0x00000200 - #else - #define PITA_PARA_SOFTRESET 0x01000000 --#define PITA_SER_SOFTRESET 0x02000000 - #define PITA_PARA_MPX_MODE 0x04000000 - #define PITA_INT0_ENABLE 0x00020000 - #endif -@@ -244,47 +240,6 @@ - memwritereg(cs->hw.diva.cfg_reg, offset + (hscx ? 0x40 : 0), value); - } - --/* IO-Functions for IPACX type cards */ --static u_char --MemReadISAC_IPACX(struct IsdnCardState *cs, u_char offset) --{ -- return (memreadreg(cs->hw.diva.cfg_reg, offset)); --} -- --static void --MemWriteISAC_IPACX(struct IsdnCardState *cs, u_char offset, u_char value) --{ -- memwritereg(cs->hw.diva.cfg_reg, offset, value); --} -- --static void --MemReadISACfifo_IPACX(struct IsdnCardState *cs, u_char * data, int size) --{ -- while(size--) -- *data++ = memreadreg(cs->hw.diva.cfg_reg, 0); --} -- --static void --MemWriteISACfifo_IPACX(struct IsdnCardState *cs, u_char * data, int size) --{ -- while(size--) -- memwritereg(cs->hw.diva.cfg_reg, 0, *data++); --} -- --static u_char --MemReadHSCX_IPACX(struct IsdnCardState *cs, int hscx, u_char offset) --{ -- return(memreadreg(cs->hw.diva.cfg_reg, offset + -- (hscx ? IPACX_OFF_B2 : IPACX_OFF_B1))); --} -- --static void --MemWriteHSCX_IPACX(struct IsdnCardState *cs, int hscx, u_char offset, u_char value) --{ -- memwritereg(cs->hw.diva.cfg_reg, offset + -- (hscx ? IPACX_OFF_B2 : IPACX_OFF_B1), value); --} -- - /* - * fast interrupt HSCX stuff goes here - */ -@@ -595,7 +550,7 @@ - u_char exval; - struct BCState *bcs; - -- if (val & 0x01) { // EXB -+ if (val & 0x01) { - bcs = cs->bcs + 1; - exval = MemReadHSCX(cs, 1, HSCX_EXIR); - if (exval & 0x40) { -@@ -622,7 +577,7 @@ - debugl1(cs, "HSCX B interrupt %x", val); - Memhscx_interrupt(cs, val, 1); - } -- if (val & 0x02) { // EXA -+ if (val & 0x02) { - bcs = cs->bcs; - exval = MemReadHSCX(cs, 0, HSCX_EXIR); - if (exval & 0x40) { -@@ -644,7 +599,7 @@ - } else if (cs->debug & L1_DEB_HSCX) - debugl1(cs, "HSCX A EXIR %x", exval); - } -- if (val & 0x04) { // ICA -+ if (val & 0x04) { - exval = MemReadHSCX(cs, 0, HSCX_ISTA); - if (cs->debug & L1_DEB_HSCX) - debugl1(cs, "HSCX A interrupt %x", exval); -@@ -705,31 +660,12 @@ - memwritereg(cs->hw.diva.cfg_reg, IPAC_MASK, 0xC0); - } - --static void --diva_irq_ipacx_pci(int intno, void *dev_id, struct pt_regs *regs) --{ -- struct IsdnCardState *cs = dev_id; -- u_char val; -- u_char *cfg; -- -- if (!cs) { -- printk(KERN_WARNING "Diva: Spurious interrupt!\n"); -- return; -- } -- cfg = (u_char *) cs->hw.diva.pci_cfg; -- val = *cfg; -- if (!(val &PITA_INT0_STATUS)) return; // other shared IRQ -- interrupt_ipacx(cs); // handler for chip -- *cfg = PITA_INT0_STATUS; // Reset PLX interrupt --} -- - void - release_io_diva(struct IsdnCardState *cs) - { - int bytecnt; - -- if ((cs->subtyp == DIVA_IPAC_PCI) || -- (cs->subtyp == DIVA_IPACX_PCI) ) { -+ if (cs->subtyp == DIVA_IPAC_PCI) { - u_int *cfg = (unsigned int *)cs->hw.diva.pci_cfg; - - *cfg = 0; /* disable INT0/1 */ -@@ -776,16 +712,6 @@ - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout((10*HZ)/1000); - memwritereg(cs->hw.diva.cfg_reg, IPAC_MASK, 0xc0); -- } else if (cs->subtyp == DIVA_IPACX_PCI) { -- unsigned int *ireg = (unsigned int *)(cs->hw.diva.pci_cfg + -- PITA_MISC_REG); -- *ireg = PITA_PARA_SOFTRESET | PITA_PARA_MPX_MODE; -- set_current_state(TASK_UNINTERRUPTIBLE); -- schedule_timeout((10*HZ)/1000); -- *ireg = PITA_PARA_MPX_MODE | PITA_SER_SOFTRESET; -- set_current_state(TASK_UNINTERRUPTIBLE); -- schedule_timeout((10*HZ)/1000); -- MemWriteISAC_IPACX(cs, IPACX_MASK, 0xff); // Interrupts off - } else { /* DIVA 2.0 */ - cs->hw.diva.ctrl_reg = 0; /* Reset On */ - byteout(cs->hw.diva.ctrl, cs->hw.diva.ctrl_reg); -@@ -814,9 +740,7 @@ - { - int blink = 0; - -- if ((cs->subtyp == DIVA_IPAC_ISA) || -- (cs->subtyp == DIVA_IPAC_PCI) || -- (cs->subtyp == DIVA_IPACX_PCI) ) -+ if ((cs->subtyp == DIVA_IPAC_ISA) || (cs->subtyp == DIVA_IPAC_PCI)) - return; - del_timer(&cs->hw.diva.tl); - if (cs->hw.diva.status & DIVA_ASSIGN) -@@ -859,12 +783,6 @@ - release_io_diva(cs); - return(0); - case CARD_INIT: -- if (cs->subtyp == DIVA_IPACX_PCI) { -- ireg = (unsigned int *)cs->hw.diva.pci_cfg; -- *ireg = PITA_INT0_ENABLE; -- init_ipacx(cs, 3); // init chip and enable interrupts -- return (0); -- } - if (cs->subtyp == DIVA_IPAC_PCI) { - ireg = (unsigned int *)cs->hw.diva.pci_cfg; - *ireg = PITA_INT0_ENABLE; -@@ -901,9 +819,7 @@ - } - break; - } -- if ((cs->subtyp != DIVA_IPAC_ISA) && -- (cs->subtyp != DIVA_IPAC_PCI) && -- (cs->subtyp != DIVA_IPACX_PCI) ) -+ if ((cs->subtyp != DIVA_IPAC_ISA) && (cs->subtyp != DIVA_IPAC_PCI)) - diva_led_handler(cs); - return(0); - } -@@ -911,40 +827,11 @@ - static struct pci_dev *dev_diva __initdata = NULL; - static struct pci_dev *dev_diva_u __initdata = NULL; - static struct pci_dev *dev_diva201 __initdata = NULL; --static struct pci_dev *dev_diva202 __initdata = NULL; -- --#ifdef __ISAPNP__ --static struct isapnp_device_id diva_ids[] __initdata = { -- { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51), -- ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51), -- (unsigned long) "Diva picola" }, -- { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51), -- ISAPNP_VENDOR('E', 'I', 'C'), ISAPNP_FUNCTION(0x51), -- (unsigned long) "Diva picola" }, -- { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x71), -- ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x71), -- (unsigned long) "Diva 2.0" }, -- { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x71), -- ISAPNP_VENDOR('E', 'I', 'C'), ISAPNP_FUNCTION(0x71), -- (unsigned long) "Diva 2.0" }, -- { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0xA1), -- ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0xA1), -- (unsigned long) "Diva 2.01" }, -- { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0xA1), -- ISAPNP_VENDOR('E', 'I', 'C'), ISAPNP_FUNCTION(0xA1), -- (unsigned long) "Diva 2.01" }, -- { 0, } --}; -- --static struct isapnp_device_id *pdev = &diva_ids[0]; --static struct pci_bus *pnp_c __devinitdata = NULL; --#endif -- - - int __init - setup_diva(struct IsdnCard *card) - { -- int bytecnt = 8; -+ int bytecnt; - u_char val; - struct IsdnCardState *cs = card->cs; - char tmp[64]; -@@ -977,75 +864,8 @@ - cs->hw.diva.hscx_adr = card->para[1] + DIVA_HSCX_ADR; - } - cs->irq = card->para[0]; -+ bytecnt = 8; - } else { --#ifdef __ISAPNP__ -- if (isapnp_present()) { -- struct pci_bus *pb; -- struct pci_dev *pd; -- -- while(pdev->card_vendor) { -- if ((pb = isapnp_find_card(pdev->card_vendor, -- pdev->card_device, pnp_c))) { -- pnp_c = pb; -- pd = NULL; -- if ((pd = isapnp_find_dev(pnp_c, -- pdev->vendor, pdev->function, pd))) { -- printk(KERN_INFO "HiSax: %s detected\n", -- (char *)pdev->driver_data); -- pd->prepare(pd); -- pd->deactivate(pd); -- pd->activate(pd); -- card->para[1] = -- pd->resource[0].start; -- card->para[0] = -- pd->irq_resource[0].start; -- if (!card->para[0] || !card->para[1]) { -- printk(KERN_ERR "Diva PnP:some resources are missing %ld/%lx\n", -- card->para[0], card->para[1]); -- pd->deactivate(pd); -- return(0); -- } -- cs->hw.diva.cfg_reg = card->para[1]; -- cs->irq = card->para[0]; -- if (pdev->function == ISAPNP_FUNCTION(0xA1)) { -- cs->subtyp = DIVA_IPAC_ISA; -- cs->hw.diva.ctrl = 0; -- cs->hw.diva.isac = -- card->para[1] + DIVA_IPAC_DATA; -- cs->hw.diva.hscx = -- card->para[1] + DIVA_IPAC_DATA; -- cs->hw.diva.isac_adr = -- card->para[1] + DIVA_IPAC_ADR; -- cs->hw.diva.hscx_adr = -- card->para[1] + DIVA_IPAC_ADR; -- test_and_set_bit(HW_IPAC, &cs->HW_Flags); -- } else { -- cs->subtyp = DIVA_ISA; -- cs->hw.diva.ctrl = -- card->para[1] + DIVA_ISA_CTRL; -- cs->hw.diva.isac = -- card->para[1] + DIVA_ISA_ISAC_DATA; -- cs->hw.diva.hscx = -- card->para[1] + DIVA_HSCX_DATA; -- cs->hw.diva.isac_adr = -- card->para[1] + DIVA_ISA_ISAC_ADR; -- cs->hw.diva.hscx_adr = -- card->para[1] + DIVA_HSCX_ADR; -- } -- goto ready; -- } else { -- printk(KERN_ERR "Diva PnP: PnP error card found, no device\n"); -- return(0); -- } -- } -- pdev++; -- pnp_c=NULL; -- } -- if (!pdev->card_vendor) { -- printk(KERN_INFO "Diva PnP: no ISAPnP card found\n"); -- } -- } --#endif - #if CONFIG_PCI - if (!pci_present()) { - printk(KERN_ERR "Diva: no PCI bus present\n"); -@@ -1059,14 +879,14 @@ - return(0); - cs->subtyp = DIVA_PCI; - cs->irq = dev_diva->irq; -- cs->hw.diva.cfg_reg = pci_resource_start(dev_diva, 2); -+ cs->hw.diva.cfg_reg = pci_resource_start_io(dev_diva, 2); - } else if ((dev_diva_u = pci_find_device(PCI_VENDOR_ID_EICON, - PCI_DEVICE_ID_EICON_DIVA20_U, dev_diva_u))) { - if (pci_enable_device(dev_diva_u)) - return(0); - cs->subtyp = DIVA_PCI; - cs->irq = dev_diva_u->irq; -- cs->hw.diva.cfg_reg = pci_resource_start(dev_diva_u, 2); -+ cs->hw.diva.cfg_reg = pci_resource_start_io(dev_diva_u, 2); - } else if ((dev_diva201 = pci_find_device(PCI_VENDOR_ID_EICON, - PCI_DEVICE_ID_EICON_DIVA201, dev_diva201))) { - if (pci_enable_device(dev_diva201)) -@@ -1074,19 +894,9 @@ - cs->subtyp = DIVA_IPAC_PCI; - cs->irq = dev_diva201->irq; - cs->hw.diva.pci_cfg = -- (ulong) ioremap(pci_resource_start(dev_diva201, 0), 4096); -+ (ulong) ioremap(pci_resource_start_mem(dev_diva201, 0), 4096); - cs->hw.diva.cfg_reg = -- (ulong) ioremap(pci_resource_start(dev_diva201, 1), 4096); -- } else if ((dev_diva202 = pci_find_device(PCI_VENDOR_ID_EICON, -- PCI_DEVICE_ID_EICON_DIVA202, dev_diva202))) { -- if (pci_enable_device(dev_diva202)) -- return(0); -- cs->subtyp = DIVA_IPACX_PCI; -- cs->irq = dev_diva202->irq; -- cs->hw.diva.pci_cfg = -- (ulong) ioremap(pci_resource_start(dev_diva202, 0), 4096); -- cs->hw.diva.cfg_reg = -- (ulong) ioremap(pci_resource_start(dev_diva202, 1), 4096); -+ (ulong) ioremap(pci_resource_start_mem(dev_diva201, 1), 4096); - } else { - printk(KERN_WARNING "Diva: No PCI card found\n"); - return(0); -@@ -1107,8 +917,7 @@ - printk(KERN_WARNING "Diva: unable to config DIVA PCI\n"); - return (0); - #endif /* CONFIG_PCI */ -- if ((cs->subtyp == DIVA_IPAC_PCI) || -- (cs->subtyp == DIVA_IPACX_PCI) ) { -+ if (cs->subtyp == DIVA_IPAC_PCI) { - cs->hw.diva.ctrl = 0; - cs->hw.diva.isac = 0; - cs->hw.diva.hscx = 0; -@@ -1125,23 +934,18 @@ - bytecnt = 32; - } - } --ready: -+ - printk(KERN_INFO - "Diva: %s card configured at %#lx IRQ %d\n", - (cs->subtyp == DIVA_PCI) ? "PCI" : - (cs->subtyp == DIVA_ISA) ? "ISA" : -- (cs->subtyp == DIVA_IPAC_ISA) ? "IPAC ISA" : -- (cs->subtyp == DIVA_IPAC_PCI) ? "IPAC PCI" : "IPACX PCI", -+ (cs->subtyp == DIVA_IPAC_ISA) ? "IPAC ISA" : "IPAC PCI", - cs->hw.diva.cfg_reg, cs->irq); -- if ((cs->subtyp == DIVA_IPAC_PCI) || -- (cs->subtyp == DIVA_IPACX_PCI) || -- (cs->subtyp == DIVA_PCI) ) -- printk(KERN_INFO "Diva: %s space at %#lx\n", -- (cs->subtyp == DIVA_PCI) ? "PCI" : -- (cs->subtyp == DIVA_IPAC_PCI) ? "IPAC PCI" : "IPACX PCI", -+ if ((cs->subtyp == DIVA_IPAC_PCI) || (cs->subtyp == DIVA_PCI)) -+ printk(KERN_INFO "Diva: %s PCI space at %#lx\n", -+ (cs->subtyp == DIVA_PCI) ? "PCI" : "IPAC PCI", - cs->hw.diva.pci_cfg); -- if ((cs->subtyp != DIVA_IPAC_PCI) && -- (cs->subtyp != DIVA_IPACX_PCI) ) { -+ if (cs->subtyp != DIVA_IPAC_PCI) { - if (check_region(cs->hw.diva.cfg_reg, bytecnt)) { - printk(KERN_WARNING - "HiSax: %s config port %lx-%lx already in use\n", -@@ -1177,17 +981,6 @@ - cs->irq_func = &diva_irq_ipac_pci; - val = memreadreg(cs->hw.diva.cfg_reg, IPAC_ID); - printk(KERN_INFO "Diva: IPAC version %x\n", val); -- } else if (cs->subtyp == DIVA_IPACX_PCI) { -- cs->readisac = &MemReadISAC_IPACX; -- cs->writeisac = &MemWriteISAC_IPACX; -- cs->readisacfifo = &MemReadISACfifo_IPACX; -- cs->writeisacfifo = &MemWriteISACfifo_IPACX; -- cs->BC_Read_Reg = &MemReadHSCX_IPACX; -- cs->BC_Write_Reg = &MemWriteHSCX_IPACX; -- cs->BC_Send_Data = 0; // function located in ipacx module -- cs->irq_func = &diva_irq_ipacx_pci; -- printk(KERN_INFO "Diva: IPACX Design Id: %x\n", -- MemReadISAC_IPACX(cs, IPACX_ID) &0x3F); - } else { /* DIVA 2.0 */ - cs->hw.diva.tl.function = (void *) diva_led_handler; - cs->hw.diva.tl.data = (long) cs; -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/elsa.c linux-2.4.29/drivers/isdn/hisax/elsa.c ---- linux-2.4.29.old/drivers/isdn/hisax/elsa.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/elsa.c 2005-03-22 15:06:46.123081008 +0100 -@@ -1,4 +1,4 @@ --/* $Id: elsa.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: elsa.c,v 2.32 2001/09/24 13:22:56 kai Exp $ - * - * low level stuff for Elsa isdn cards - * -@@ -28,13 +28,13 @@ - #include "hscx.h" - #include "isdnl1.h" - #include --#include -+#include - #include - #include - - extern const char *CardType[]; - --const char *Elsa_revision = "$Revision: 1.1.4.1 $"; -+const char *Elsa_revision = "$Revision: 2.32 $"; - const char *Elsa_Types[] = - {"None", "PC", "PCC-8", "PCC-16", "PCF", "PCF-Pro", - "PCMCIA", "QS 1000", "QS 3000", "Microlink PCI", "QS 3000 PCI", -@@ -864,21 +864,6 @@ - static struct pci_dev *dev_qs1000 __devinitdata = NULL; - static struct pci_dev *dev_qs3000 __devinitdata = NULL; - --#ifdef __ISAPNP__ --static struct isapnp_device_id elsa_ids[] __initdata = { -- { ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0133), -- ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0133), -- (unsigned long) "Elsa QS1000" }, -- { ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0134), -- ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0134), -- (unsigned long) "Elsa QS3000" }, -- { 0, } --}; -- --static struct isapnp_device_id *pdev = &elsa_ids[0]; --static struct pci_bus *pnp_c __devinitdata = NULL; --#endif -- - int __devinit - setup_elsa(struct IsdnCard *card) - { -@@ -893,7 +878,6 @@ - cs->hw.elsa.ctrl_reg = 0; - cs->hw.elsa.status = 0; - cs->hw.elsa.MFlag = 0; -- cs->subtyp = 0; - if (cs->typ == ISDN_CTYPE_ELSA) { - cs->hw.elsa.base = card->para[0]; - printk(KERN_INFO "Elsa: Microlink IO probing\n"); -@@ -955,60 +939,9 @@ - return (0); - } - } else if (cs->typ == ISDN_CTYPE_ELSA_PNP) { --#ifdef __ISAPNP__ -- if (!card->para[1] && isapnp_present()) { -- struct pci_bus *pb; -- struct pci_dev *pd; -- -- while(pdev->card_vendor) { -- if ((pb = isapnp_find_card(pdev->card_vendor, -- pdev->card_device, pnp_c))) { -- pnp_c = pb; -- pd = NULL; -- if ((pd = isapnp_find_dev(pnp_c, -- pdev->vendor, pdev->function, pd))) { -- printk(KERN_INFO "HiSax: %s detected\n", -- (char *)pdev->driver_data); -- pd->prepare(pd); -- pd->deactivate(pd); -- pd->activate(pd); -- card->para[1] = -- pd->resource[0].start; -- card->para[0] = -- pd->irq_resource[0].start; -- if (!card->para[0] || !card->para[1]) { -- printk(KERN_ERR "Elsa PnP:some resources are missing %ld/%lx\n", -- card->para[0], card->para[1]); -- pd->deactivate(pd); -- return(0); -- } -- if (pdev->function == ISAPNP_FUNCTION(0x133)) -- cs->subtyp = ELSA_QS1000; -- else -- cs->subtyp = ELSA_QS3000; -- break; -- } else { -- printk(KERN_ERR "Elsa PnP: PnP error card found, no device\n"); -- return(0); -- } -- } -- pdev++; -- pnp_c=NULL; -- } -- if (!pdev->card_vendor) { -- printk(KERN_INFO "Elsa PnP: no ISAPnP card found\n"); -- return(0); -- } -- } --#endif -- if (card->para[1] && card->para[0]) { -- cs->hw.elsa.base = card->para[1]; -- cs->irq = card->para[0]; -- if (!cs->subtyp) -- cs->subtyp = ELSA_QS1000; -- } else { -- printk(KERN_ERR "Elsa PnP: no parameter\n"); -- } -+ cs->hw.elsa.base = card->para[1]; -+ cs->irq = card->para[0]; -+ cs->subtyp = ELSA_QS1000; - cs->hw.elsa.cfg = cs->hw.elsa.base + ELSA_CONFIG; - cs->hw.elsa.ale = cs->hw.elsa.base + ELSA_ALE; - cs->hw.elsa.isac = cs->hw.elsa.base + ELSA_ISAC; -@@ -1058,16 +991,16 @@ - return(0); - cs->subtyp = ELSA_QS1000PCI; - cs->irq = dev_qs1000->irq; -- cs->hw.elsa.cfg = pci_resource_start(dev_qs1000, 1); -- cs->hw.elsa.base = pci_resource_start(dev_qs1000, 3); -+ cs->hw.elsa.cfg = pci_resource_start_io(dev_qs1000, 1); -+ cs->hw.elsa.base = pci_resource_start_io(dev_qs1000, 3); - } else if ((dev_qs3000 = pci_find_device(PCI_VENDOR_ID_ELSA, - PCI_DEVICE_ID_ELSA_QS3000, dev_qs3000))) { - if (pci_enable_device(dev_qs3000)) - return(0); - cs->subtyp = ELSA_QS3000PCI; - cs->irq = dev_qs3000->irq; -- cs->hw.elsa.cfg = pci_resource_start(dev_qs3000, 1); -- cs->hw.elsa.base = pci_resource_start(dev_qs3000, 3); -+ cs->hw.elsa.cfg = pci_resource_start_io(dev_qs3000, 1); -+ cs->hw.elsa.base = pci_resource_start_io(dev_qs3000, 3); - } else { - printk(KERN_WARNING "Elsa: No PCI card found\n"); - return(0); -@@ -1123,7 +1056,6 @@ - break; - case ELSA_PCFPRO: - case ELSA_PCF: -- case ELSA_QS3000: - case ELSA_QS3000PCI: - bytecnt = 16; - break; -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/elsa_cs.c linux-2.4.29/drivers/isdn/hisax/elsa_cs.c ---- linux-2.4.29.old/drivers/isdn/hisax/elsa_cs.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/elsa_cs.c 2005-03-22 15:06:46.138078728 +0100 -@@ -72,7 +72,7 @@ - MODULE_PARM(pc_debug, "i"); - #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args); - static char *version = --"elsa_cs.c $Revision: 1.1.4.1 $ $Date: 2001/11/20 14:19:35 $ (K.Lichtenwalder)"; -+"elsa_cs.c $Revision: 1.2 $ $Date: 2001/09/24 13:22:56 $ (K.Lichtenwalder)"; - #else - #define DEBUG(n, args...) - #endif -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/elsa_ser.c linux-2.4.29/drivers/isdn/hisax/elsa_ser.c ---- linux-2.4.29.old/drivers/isdn/hisax/elsa_ser.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/elsa_ser.c 2005-03-22 15:06:46.158075688 +0100 -@@ -1,4 +1,4 @@ --/* $Id: elsa_ser.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: elsa_ser.c,v 2.14 2001/09/24 13:22:56 kai Exp $ - * - * stuff for the serial modem on ELSA cards - * -@@ -396,6 +396,74 @@ - } - } - -+#if 0 -+static inline void check_modem_status(struct IsdnCardState *cs) -+{ -+ int status; -+ struct async_struct *info = cs->hw.elsa.info; -+ struct async_icount *icount; -+ -+ status = serial_inp(info, UART_MSR); -+ -+ if (status & UART_MSR_ANY_DELTA) { -+ icount = &info->state->icount; -+ /* update input line counters */ -+ if (status & UART_MSR_TERI) -+ icount->rng++; -+ if (status & UART_MSR_DDSR) -+ icount->dsr++; -+ if (status & UART_MSR_DDCD) { -+ icount->dcd++; -+ } -+ if (status & UART_MSR_DCTS) -+ icount->cts++; -+// wake_up(&info->delta_msr_wait); -+ } -+ -+ if ((info->flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) { -+#if (defined(SERIAL_DEBUG_OPEN) || defined(SERIAL_DEBUG_INTR)) -+ printk("ttys%d CD now %s...", info->line, -+ (status & UART_MSR_DCD) ? "on" : "off"); -+#endif -+ if (status & UART_MSR_DCD) -+// wake_up(&info->open_wait); -+; -+ else if (!((info->flags & ASYNC_CALLOUT_ACTIVE) && -+ (info->flags & ASYNC_CALLOUT_NOHUP))) { -+#ifdef SERIAL_DEBUG_OPEN -+ printk("doing serial hangup..."); -+#endif -+ if (info->tty) -+ tty_hangup(info->tty); -+ } -+ } -+#if 0 -+ if (info->flags & ASYNC_CTS_FLOW) { -+ if (info->tty->hw_stopped) { -+ if (status & UART_MSR_CTS) { -+#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) -+ printk("CTS tx start..."); -+#endif -+ info->tty->hw_stopped = 0; -+ info->IER |= UART_IER_THRI; -+ serial_outp(info, UART_IER, info->IER); -+// rs_sched_event(info, RS_EVENT_WRITE_WAKEUP); -+ return; -+ } -+ } else { -+ if (!(status & UART_MSR_CTS)) { -+#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) -+ printk("CTS tx stop..."); -+#endif -+ info->tty->hw_stopped = 1; -+ info->IER &= ~UART_IER_THRI; -+ serial_outp(info, UART_IER, info->IER); -+ } -+ } -+ } -+#endif 0 -+} -+#endif - - static void rs_interrupt_elsa(int irq, struct IsdnCardState *cs) - { -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/fsm.c linux-2.4.29/drivers/isdn/hisax/fsm.c ---- linux-2.4.29.old/drivers/isdn/hisax/fsm.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/fsm.c 2005-03-22 15:06:46.174073256 +0100 -@@ -1,4 +1,4 @@ --/* $Id: fsm.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id$ - * - * Finite state machine - * -@@ -21,6 +21,14 @@ - - #define FSM_TIMER_DEBUG 0 - -+EXPORT_SYMBOL(FsmNew); -+EXPORT_SYMBOL(FsmFree); -+EXPORT_SYMBOL(FsmEvent); -+EXPORT_SYMBOL(FsmChangeState); -+EXPORT_SYMBOL(FsmInitTimer); -+EXPORT_SYMBOL(FsmDelTimer); -+EXPORT_SYMBOL(FsmRestartTimer); -+ - int __init - FsmNew(struct Fsm *fsm, struct FsmNode *fnlist, int fncount) - { -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/fsm.h linux-2.4.29/drivers/isdn/hisax/fsm.h ---- linux-2.4.29.old/drivers/isdn/hisax/fsm.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/fsm.h 2005-03-22 15:06:46.189070976 +0100 -@@ -1,4 +1,4 @@ --/* $Id: fsm.h,v 1.1.2.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id$ - * - * Finite state machine - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/gazel.c linux-2.4.29/drivers/isdn/hisax/gazel.c ---- linux-2.4.29.old/drivers/isdn/hisax/gazel.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/gazel.c 2005-03-22 15:06:46.205068544 +0100 -@@ -1,4 +1,4 @@ --/* $Id: gazel.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: gazel.c,v 2.19 2001/09/24 13:22:56 kai Exp $ - * - * low level stuff for Gazel isdn cards - * -@@ -20,9 +20,10 @@ - #include "isdnl1.h" - #include "ipac.h" - #include -+#include - - extern const char *CardType[]; --const char *gazel_revision = "$Revision: 1.1.4.1 $"; -+const char *gazel_revision = "$Revision: 2.19 $"; - - #define R647 1 - #define R685 2 -@@ -563,8 +564,8 @@ - if (pci_enable_device(dev_tel)) - return 1; - pci_irq = dev_tel->irq; -- pci_ioaddr0 = pci_resource_start(dev_tel, 1); -- pci_ioaddr1 = pci_resource_start(dev_tel, 2); -+ pci_ioaddr0 = pci_resource_start_io(dev_tel, 1); -+ pci_ioaddr1 = pci_resource_start_io(dev_tel, 2); - found = 1; - } - if (found) -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfc_2bds0.c linux-2.4.29/drivers/isdn/hisax/hfc_2bds0.c ---- linux-2.4.29.old/drivers/isdn/hisax/hfc_2bds0.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hfc_2bds0.c 2005-03-22 15:06:46.221066112 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hfc_2bds0.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: hfc_2bds0.c,v 1.18 2001/09/24 13:22:56 kai Exp $ - * - * specific routines for CCD's HFC 2BDS0 - * -@@ -616,6 +616,17 @@ - */ - if (!cs) - return; -+#if 0 -+ if (test_and_clear_bit(D_CLEARBUSY, &cs->event)) { -+ if (cs->debug) -+ debugl1(cs, "D-Channel Busy cleared"); -+ stptr = cs->stlist; -+ while (stptr != NULL) { -+ stptr->l1.l1l2(stptr, PH_PAUSE | CONFIRM, NULL); -+ stptr = stptr->next; -+ } -+ } -+#endif - if (test_and_clear_bit(D_L1STATECHANGE, &cs->event)) { - switch (cs->dc.hfcd.ph_state) { - case (0): -@@ -1090,6 +1101,32 @@ - cs->hw.hfcD.mst_m |= HFCD_MASTER; - cs->writeisac(cs, HFCD_MST_MODE, cs->hw.hfcD.mst_m); - break; -+#if 0 -+ case (HW_TESTLOOP | REQUEST): -+ u_char val = 0; -+ if (1 & (int) arg) -+ val |= 0x0c; -+ if (2 & (int) arg) -+ val |= 0x3; -+ if (test_bit(HW_IOM1, &cs->HW_Flags)) { -+ /* IOM 1 Mode */ -+ if (!val) { -+ cs->writeisac(cs, ISAC_SPCR, 0xa); -+ cs->writeisac(cs, ISAC_ADF1, 0x2); -+ } else { -+ cs->writeisac(cs, ISAC_SPCR, val); -+ cs->writeisac(cs, ISAC_ADF1, 0xa); -+ } -+ } else { -+ /* IOM 2 Mode */ -+ cs->writeisac(cs, ISAC_SPCR, val); -+ if (val) -+ cs->writeisac(cs, ISAC_ADF1, 0x8); -+ else -+ cs->writeisac(cs, ISAC_ADF1, 0x0); -+ } -+ break; -+#endif - default: - if (cs->debug & L1_DEB_WARN) - debugl1(cs, "hfcd_l1hw unknown pr %4x", pr); -@@ -1106,6 +1143,20 @@ - static void - hfc_dbusy_timer(struct IsdnCardState *cs) - { -+#if 0 -+ struct PStack *stptr; -+ if (test_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) { -+ if (cs->debug) -+ debugl1(cs, "D-Channel Busy"); -+ test_and_set_bit(FLG_L1_DBUSY, &cs->HW_Flags); -+ stptr = cs->stlist; -+ -+ while (stptr != NULL) { -+ stptr->l1.l1l2(stptr, PH_PAUSE | INDICATION, NULL); -+ stptr = stptr->next; -+ } -+ } -+#endif - } - - unsigned int __init -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfc_2bds0.h linux-2.4.29/drivers/isdn/hisax/hfc_2bds0.h ---- linux-2.4.29.old/drivers/isdn/hisax/hfc_2bds0.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hfc_2bds0.h 2005-03-22 15:06:46.236063832 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hfc_2bds0.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: hfc_2bds0.h,v 1.6 2001/09/24 13:22:56 kai Exp $ - * - * specific defines for CCD's HFC 2BDS0 - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfc_2bs0.c linux-2.4.29/drivers/isdn/hisax/hfc_2bs0.c ---- linux-2.4.29.old/drivers/isdn/hisax/hfc_2bs0.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hfc_2bs0.c 2005-03-22 15:06:46.272058360 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hfc_2bs0.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: hfc_2bs0.c,v 1.20 2001/09/24 13:22:56 kai Exp $ - * - * specific routines for CCD's HFC 2BS0 - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfc_2bs0.h linux-2.4.29/drivers/isdn/hisax/hfc_2bs0.h ---- linux-2.4.29.old/drivers/isdn/hisax/hfc_2bs0.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hfc_2bs0.h 2005-03-22 15:06:46.288055928 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hfc_2bs0.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: hfc_2bs0.h,v 1.5 2001/09/24 13:22:56 kai Exp $ - * - * specific defines for CCD's HFC 2BS0 - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfc_pci.c linux-2.4.29/drivers/isdn/hisax/hfc_pci.c ---- linux-2.4.29.old/drivers/isdn/hisax/hfc_pci.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hfc_pci.c 2005-03-22 15:06:46.305053344 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hfc_pci.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: hfc_pci.c,v 1.48 2001/09/24 13:22:56 kai Exp $ - * - * low level driver for CCD´s hfc-pci based cards - * -@@ -22,11 +22,12 @@ - #include "hfc_pci.h" - #include "isdnl1.h" - #include -+#include - #include - - extern const char *CardType[]; - --static const char *hfcpci_revision = "$Revision: 1.1.4.1 $"; -+static const char *hfcpci_revision = "$Revision: 1.48 $"; - - /* table entry in the PCI devices list */ - typedef struct { -@@ -76,8 +77,6 @@ - { - unsigned long flags; - -- printk(KERN_INFO "HiSax: release hfcpci at %p\n", -- cs->hw.hfcpci.pci_io); - save_flags(flags); - cli(); - cs->hw.hfcpci.int_m2 = 0; /* interrupt output off ! */ -@@ -88,11 +87,13 @@ - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout((30 * HZ) / 1000); /* Timeout 30ms */ - Write_hfc(cs, HFCPCI_CIRM, 0); /* Reset Off */ -+#if CONFIG_PCI - pcibios_write_config_word(cs->hw.hfcpci.pci_bus, cs->hw.hfcpci.pci_device_fn, PCI_COMMAND, 0); /* disable memory mapped ports + busmaster */ -+#endif /* CONFIG_PCI */ - del_timer(&cs->hw.hfcpci.timer); - kfree(cs->hw.hfcpci.share_start); - cs->hw.hfcpci.share_start = NULL; -- iounmap((void *)cs->hw.hfcpci.pci_io); -+ vfree(cs->hw.hfcpci.pci_io); - } - - /********************************************************************************/ -@@ -687,10 +688,6 @@ - debugl1(cs, "hfcpci_fill_fifo_trans %d frame length %d discarded", - bcs->channel, bcs->tx_skb->len); - -- if (bcs->st->lli.l1writewakeup && -- (PACKET_NOACK != bcs->tx_skb->pkt_type)) -- bcs->st->lli.l1writewakeup(bcs->st, bcs->tx_skb->len); -- - dev_kfree_skb_any(bcs->tx_skb); - cli(); - bcs->tx_skb = skb_dequeue(&bcs->squeue); /* fetch next data */ -@@ -1146,6 +1143,20 @@ - static void - hfcpci_dbusy_timer(struct IsdnCardState *cs) - { -+#if 0 -+ struct PStack *stptr; -+ if (test_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) { -+ if (cs->debug) -+ debugl1(cs, "D-Channel Busy"); -+ test_and_set_bit(FLG_L1_DBUSY, &cs->HW_Flags); -+ stptr = cs->stlist; -+ -+ while (stptr != NULL) { -+ stptr->l1.l1l2(stptr, PH_PAUSE | INDICATION, NULL); -+ stptr = stptr->next; -+ } -+ } -+#endif - } - - /*************************************/ -@@ -1550,6 +1561,17 @@ - */ - if (!cs) - return; -+#if 0 -+ if (test_and_clear_bit(D_CLEARBUSY, &cs->event)) { -+ if (cs->debug) -+ debugl1(cs, "D-Channel Busy cleared"); -+ stptr = cs->stlist; -+ while (stptr != NULL) { -+ stptr->l1.l1l2(stptr, PH_PAUSE | CONFIRM, NULL); -+ stptr = stptr->next; -+ } -+ } -+#endif - if (test_and_clear_bit(D_L1STATECHANGE, &cs->event)) { - if (!cs->hw.hfcpci.nt_mode) - switch (cs->dc.hfcpci.ph_state) { -@@ -1712,7 +1734,7 @@ - if (pci_enable_device(tmp_hfcpci)) - continue; - pci_set_master(tmp_hfcpci); -- if ((card->para[0]) && (card->para[0] != (tmp_hfcpci->resource[ 0].start & PCI_BASE_ADDRESS_IO_MASK))) -+ if ((card->para[0]) && (card->para[0] != (get_pcibase(tmp_hfcpci, 0) & PCI_BASE_ADDRESS_IO_MASK))) - continue; - else - break; -@@ -1729,7 +1751,7 @@ - printk(KERN_WARNING "HFC-PCI: No IRQ for PCI card found\n"); - return (0); - } -- cs->hw.hfcpci.pci_io = (char *) dev_hfcpci->resource[ 1].start; -+ cs->hw.hfcpci.pci_io = (char *) get_pcibase(dev_hfcpci, 1); - printk(KERN_INFO "HiSax: HFC-PCI card manufacturer: %s card name: %s\n", id_list[i].vendor_name, id_list[i].card_name); - } else { - printk(KERN_WARNING "HFC-PCI: No PCI card found\n"); -@@ -1746,7 +1768,7 @@ - printk(KERN_WARNING "HFC-PCI: Error allocating memory for FIFO!\n"); - return 0; - } -- cs->hw.hfcpci.fifos = (void *) -+ (ulong) cs->hw.hfcpci.fifos = - (((ulong) cs->hw.hfcpci.share_start) & ~0x7FFF) + 0x8000; - pcibios_write_config_dword(cs->hw.hfcpci.pci_bus, - cs->hw.hfcpci.pci_device_fn, 0x80, -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfc_pci.h linux-2.4.29/drivers/isdn/hisax/hfc_pci.h ---- linux-2.4.29.old/drivers/isdn/hisax/hfc_pci.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hfc_pci.h 2005-03-22 15:06:46.320051064 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hfc_pci.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: hfc_pci.h,v 1.10 2001/09/24 13:22:56 kai Exp $ - * - * specific defines for CCD's HFC 2BDS0 PCI chips - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfc_sx.c linux-2.4.29/drivers/isdn/hisax/hfc_sx.c ---- linux-2.4.29.old/drivers/isdn/hisax/hfc_sx.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hfc_sx.c 2005-03-22 15:06:46.350046504 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hfc_sx.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: hfc_sx.c,v 1.12 2001/09/24 13:22:56 kai Exp $ - * - * level driver for CCD´s hfc-s+/sp based cards - * -@@ -17,11 +17,10 @@ - #include "hfc_sx.h" - #include "isdnl1.h" - #include --#include - - extern const char *CardType[]; - --static const char *hfcsx_revision = "$Revision: 1.1.4.1 $"; -+static const char *hfcsx_revision = "$Revision: 1.12 $"; - - /***************************************/ - /* IRQ-table for CCDs demo board */ -@@ -940,6 +939,20 @@ - static void - hfcsx_dbusy_timer(struct IsdnCardState *cs) - { -+#if 0 -+ struct PStack *stptr; -+ if (test_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) { -+ if (cs->debug) -+ debugl1(cs, "D-Channel Busy"); -+ test_and_set_bit(FLG_L1_DBUSY, &cs->HW_Flags); -+ stptr = cs->stlist; -+ -+ while (stptr != NULL) { -+ stptr->l1.l1l2(stptr, PH_PAUSE | INDICATION, NULL); -+ stptr = stptr->next; -+ } -+ } -+#endif - } - - /*************************************/ -@@ -1333,6 +1346,17 @@ - */ - if (!cs) - return; -+#if 0 -+ if (test_and_clear_bit(D_CLEARBUSY, &cs->event)) { -+ if (cs->debug) -+ debugl1(cs, "D-Channel Busy cleared"); -+ stptr = cs->stlist; -+ while (stptr != NULL) { -+ stptr->l1.l1l2(stptr, PH_PAUSE | CONFIRM, NULL); -+ stptr = stptr->next; -+ } -+ } -+#endif - if (test_and_clear_bit(D_L1STATECHANGE, &cs->event)) { - if (!cs->hw.hfcsx.nt_mode) - switch (cs->dc.hfcsx.ph_state) { -@@ -1461,17 +1485,7 @@ - return (0); - } - --#ifdef __ISAPNP__ --static struct isapnp_device_id hfc_ids[] __initdata = { -- { ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2620), -- ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2620), -- (unsigned long) "Teles 16.3c2" }, -- { 0, } --}; - --static struct isapnp_device_id *hdev = &hfc_ids[0]; --static struct pci_bus *pnp_c __devinitdata = NULL; --#endif - - int __devinit - setup_hfcsx(struct IsdnCard *card) -@@ -1482,45 +1496,6 @@ - - strcpy(tmp, hfcsx_revision); - printk(KERN_INFO "HiSax: HFC-SX driver Rev. %s\n", HiSax_getrev(tmp)); --#ifdef __ISAPNP__ -- if (!card->para[1] && isapnp_present()) { -- struct pci_bus *pb; -- struct pci_dev *pd; -- -- while(hdev->card_vendor) { -- if ((pb = isapnp_find_card(hdev->card_vendor, -- hdev->card_device, pnp_c))) { -- pnp_c = pb; -- pd = NULL; -- if ((pd = isapnp_find_dev(pnp_c, -- hdev->vendor, hdev->function, pd))) { -- printk(KERN_INFO "HiSax: %s detected\n", -- (char *)hdev->driver_data); -- pd->prepare(pd); -- pd->deactivate(pd); -- pd->activate(pd); -- card->para[1] = pd->resource[0].start; -- card->para[0] = pd->irq_resource[0].start; -- if (!card->para[0] || !card->para[1]) { -- printk(KERN_ERR "HFC PnP:some resources are missing %ld/%lx\n", -- card->para[0], card->para[1]); -- pd->deactivate(pd); -- return(0); -- } -- break; -- } else { -- printk(KERN_ERR "HFC PnP: PnP error card found, no device\n"); -- } -- } -- hdev++; -- pnp_c=NULL; -- } -- if (!hdev->card_vendor) { -- printk(KERN_INFO "HFC PnP: no ISAPnP card found\n"); -- return(0); -- } -- } --#endif - cs->hw.hfcsx.base = card->para[1] & 0xfffe; - cs->irq = card->para[0]; - cs->hw.hfcsx.int_s1 = 0; -@@ -1603,3 +1578,7 @@ - cs->auxcmd = &hfcsx_auxcmd; - return (1); - } -+ -+ -+ -+ -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfc_sx.h linux-2.4.29/drivers/isdn/hisax/hfc_sx.h ---- linux-2.4.29.old/drivers/isdn/hisax/hfc_sx.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hfc_sx.h 2005-03-22 15:06:46.365044224 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hfc_sx.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id$ - * - * specific defines for CCD's HFC 2BDS0 S+,SP chips - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfc_usb.c linux-2.4.29/drivers/isdn/hisax/hfc_usb.c ---- linux-2.4.29.old/drivers/isdn/hisax/hfc_usb.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hfc_usb.c 2005-03-22 15:06:46.381041792 +0100 -@@ -0,0 +1,1189 @@ -+/* $Id: hfc_usb.c,v 2.3 2001/07/06 21:30:11 werner Exp $ -+ * -+ * -+ * -+ * Author (C) 2001 Werner Cornelius (werner@isdn-development.de) -+ * modular driver for Colognechip HFC-USB chip -+ * as plugin for HiSax isdn driver -+ * type approval valid for HFC-S USB based TAs -+ * -+ * Copyright 2001 by Werner Cornelius (werner@isdn-development.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, 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 "hisax.h" -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "hisax_loadable.h" -+ -+#define INCLUDE_INLINE_FUNCS -+ -+/***********/ -+/* defines */ -+/***********/ -+#define HFC_CTRL_TIMEOUT 5 /* 5ms timeout writing/reading regs */ -+#define HFC_TIMER_T3 7000 /* timeout for l1 activation timer */ -+ -+#define HFCUSB_L1_STATECHANGE 0 /* L1 state changed */ -+#define HFCUSB_L1_DRX 1 /* D-frame received */ -+#define HFCUSB_L1_ERX 2 /* E-frame received */ -+#define HFCUSB_L1_DTX 4 /* D-frames completed */ -+ -+#define MAX_BCH_SIZE 2048 /* allowed B-channel packet size */ -+ -+#define HFCUSB_RX_THRESHOLD 64 /* threshold for fifo report bit rx */ -+#define HFCUSB_TX_THRESHOLD 64 /* threshold for fifo report bit tx */ -+ -+#define HFCUSB_CHIP_ID 0x16 /* Chip ID register index */ -+#define HFCUSB_CIRM 0x00 /* cirm register index */ -+#define HFCUSB_USB_SIZE 0x07 /* int length register */ -+#define HFCUSB_USB_SIZE_I 0x06 /* iso length register */ -+#define HFCUSB_F_CROSS 0x0b /* bit order register */ -+#define HFCUSB_CLKDEL 0x37 /* bit delay register */ -+#define HFCUSB_CON_HDLC 0xfa /* channel connect register */ -+#define HFCUSB_HDLC_PAR 0xfb -+#define HFCUSB_SCTRL 0x31 /* S-bus control register (tx) */ -+#define HFCUSB_SCTRL_E 0x32 /* same for E and special funcs */ -+#define HFCUSB_SCTRL_R 0x33 /* S-bus control register (rx) */ -+#define HFCUSB_F_THRES 0x0c /* threshold register */ -+#define HFCUSB_FIFO 0x0f /* fifo select register */ -+#define HFCUSB_F_USAGE 0x1a /* fifo usage register */ -+#define HFCUSB_MST_MODE0 0x14 -+#define HFCUSB_MST_MODE1 0x15 -+#define HFCUSB_P_DATA 0x1f -+#define HFCUSB_INC_RES_F 0x0e -+#define HFCUSB_STATES 0x30 -+ -+#define HFCUSB_CHIPID 0x40 /* ID value of HFC-USB */ -+ -+/******************/ -+/* fifo registers */ -+/******************/ -+#define HFCUSB_NUM_FIFOS 8 /* maximum number of fifos */ -+#define HFCUSB_B1_TX 0 /* index for B1 transmit bulk/int */ -+#define HFCUSB_B1_RX 1 /* index for B1 receive bulk/int */ -+#define HFCUSB_B2_TX 2 -+#define HFCUSB_B2_RX 3 -+#define HFCUSB_D_TX 4 -+#define HFCUSB_D_RX 5 -+#define HFCUSB_PCM_TX 6 -+#define HFCUSB_PCM_RX 7 -+ -+/************/ -+/* LED mask */ -+/************/ -+#define LED_DRIVER 0x1 -+#define LED_L1 0x2 -+#define LED_BCH 0x4 -+ -+/**********/ -+/* macros */ -+/**********/ -+#define Write_hfc(a,b,c) usb_control_msg((a)->dev,(a)->ctrl_out_pipe,0,0x40,(c),(b),0,0,HFC_CTRL_TIMEOUT) -+#define Read_hfc(a,b,c) usb_control_msg((a)->dev,(a)->ctrl_in_pipe,1,0xC0,0,(b),(c),1,HFC_CTRL_TIMEOUT) -+ -+#ifdef COMPAT_HAS_USB_IDTAB -+/****************************************/ -+/* data defining the devices to be used */ -+/****************************************/ -+static __devinitdata const struct usb_device_id hfc_usb_idtab[3] = { -+ {USB_DEVICE(0x959, 0x2bd0)}, /* Colognechip ROM */ -+ {USB_DEVICE(0x7b0, 0x0006)}, /* USB TA 128 */ -+ {} /* end with an all-zeroes entry */ -+}; -+#endif -+ -+/*************************************************/ -+/* entry and size of output/input control buffer */ -+/*************************************************/ -+#define HFC_CTRL_BUFSIZE 32 -+typedef struct { -+ __u8 hfc_reg; /* register number */ -+ __u8 reg_val; /* value to be written (or read) */ -+} ctrl_buft; -+ -+/***************************************************************/ -+/* structure defining input+output fifos (interrupt/bulk mode) */ -+/***************************************************************/ -+struct hfcusb_data; /* forward definition */ -+typedef struct { -+ int fifonum; /* fifo index attached to this structure */ -+ __u8 fifo_mask; /* mask for this fifo */ -+ int active; /* fifo is currently active */ -+ struct hfcusb_data *hfc; /* pointer to main structure */ -+ int pipe; /* address of endpoint */ -+ __u8 usb_maxlen; /* maximum length for usb transfer */ -+ int max_size; /* maximum size of receive/send packet */ -+ int transmode; /* transparent mode selected */ -+ int framenum; /* number of frame when last tx completed */ -+ int rx_offset; /* offset inside rx buffer */ -+ int next_complete; /* complete marker */ -+ __u8 *act_ptr; /* pointer to next data */ -+ __u8 intervall; /* interrupt interval */ -+ struct sk_buff *buff; /* actual used buffer */ -+ urb_t urb; /* transfer structure for usb routines */ -+ __u8 buffer[128]; /* buffer incoming/outgoing data */ -+} usb_fifo; -+ -+/*********************************************/ -+/* structure holding all data for one device */ -+/*********************************************/ -+typedef struct hfcusb_data { -+ struct hisax_drvreg regd; /* register data and callbacks */ -+ struct usb_device *dev; /* our device */ -+ int if_used; /* used interface number */ -+ int alt_used; /* used alternate config */ -+ int ctrl_paksize; /* control pipe packet size */ -+ int ctrl_in_pipe, ctrl_out_pipe; /* handles for control pipe */ -+ -+ /* control pipe background handling */ -+ ctrl_buft ctrl_buff[HFC_CTRL_BUFSIZE]; /* buffer holding queued data */ -+ volatile int ctrl_in_idx, ctrl_out_idx, ctrl_cnt; /* input/output pointer + count */ -+ urb_t ctrl_urb; /* transfer structure for control channel */ -+ devrequest ctrl_write; /* buffer for control write request */ -+ devrequest ctrl_read; /* same for read request */ -+ -+ volatile __u8 dfifo_fill; /* value read from tx d-fifo */ -+ volatile __u8 active_fifos; /* fifos currently active as bit mask */ -+ volatile __u8 threshold_mask; /* threshold actually reported */ -+ volatile __u8 service_request; /* fifo needs service from task */ -+ volatile __u8 ctrl_fifo; /* last selected fifo */ -+ volatile __u8 bch_enables; /* or mask for sctrl_r and sctrl register values */ -+ volatile __u8 led_req; /* request status of adapters leds */ -+ volatile __u8 led_act; /* active status of adapters leds */ -+ usb_fifo fifos[HFCUSB_NUM_FIFOS]; /* structure holding all fifo data */ -+ -+ /* layer 1 activation/deactivation handling */ -+ volatile __u8 l1_state; /* actual l1 state */ -+ volatile ulong l1_event; /* event mask */ -+ struct tq_struct l1_tq; /* l1 bh structure */ -+ struct timer_list t3_timer; /* timer for activation/deactivation */ -+ struct timer_list t4_timer; /* timer for activation/deactivation */ -+} hfcusb_data; -+ -+#if 0 -+static void -+usb_dump_urb(purb_t purb) -+{ -+ printk("urb :%p\n", purb); -+ printk("next :%p\n", purb->next); -+ printk("dev :%p\n", purb->dev); -+ printk("pipe :%08X\n", purb->pipe); -+ printk("status :%d\n", purb->status); -+ printk("transfer_flags :%08X\n", purb->transfer_flags); -+ printk("transfer_buffer :%p\n", purb->transfer_buffer); -+ printk("transfer_buffer_length:%d\n", -+ purb->transfer_buffer_length); -+ printk("actual_length :%d\n", purb->actual_length); -+ printk("setup_packet :%p\n", purb->setup_packet); -+ printk("start_frame :%d\n", purb->start_frame); -+ printk("number_of_packets :%d\n", purb->number_of_packets); -+ printk("interval :%d\n", purb->interval); -+ printk("error_count :%d\n", purb->error_count); -+ printk("context :%p\n", purb->context); -+ printk("complete :%p\n", purb->complete); -+} -+#endif -+ -+/*************************************************************************/ -+/* bottom half handler for L1 activation/deactiavtaion + D-chan + E-chan */ -+/*************************************************************************/ -+static void -+usb_l1d_bh(hfcusb_data * hfc) -+{ -+ -+ while (hfc->l1_event) { -+ if (test_and_clear_bit -+ (HFCUSB_L1_STATECHANGE, &hfc->l1_event)) { -+ if (hfc->l1_state == 7) -+ hfc->led_req |= LED_L1; -+ else -+ hfc->led_req &= ~LED_L1; -+ if ((hfc->l1_state == 7) || -+ (hfc->l1_state == 3)) -+ hfc->regd.dch_l1l2(hfc->regd.arg_hisax, -+ (hfc->l1_state == -+ 7) ? (PH_ACTIVATE | -+ INDICATION) -+ : (PH_DEACTIVATE | INDICATION), -+ NULL); -+ } -+ if (test_and_clear_bit(HFCUSB_L1_DRX, &hfc->l1_event)) { -+ hfc->regd.dch_l1l2(hfc->regd.arg_hisax, -+ PH_DATA | INDICATION, -+ (void *) 0); -+ } -+ if (test_and_clear_bit(HFCUSB_L1_ERX, &hfc->l1_event)) { -+ hfc->regd.dch_l1l2(hfc->regd.arg_hisax, -+ PH_DATA | INDICATION, -+ (void *) 1); -+ } -+ if (test_and_clear_bit(HFCUSB_L1_DTX, &hfc->l1_event)) { -+ hfc->regd.dch_l1l2(hfc->regd.arg_hisax, -+ PH_DATA | CONFIRM, NULL); -+ } -+ } /* while */ -+} /* usb_l1d_bh */ -+ -+/******************************************************/ -+/* start next background transfer for control channel */ -+/******************************************************/ -+static void -+ctrl_start_transfer(hfcusb_data * hfc) -+{ -+ -+ if (hfc->ctrl_cnt) { -+ switch (hfc->ctrl_buff[hfc->ctrl_out_idx].hfc_reg) { -+ case HFCUSB_F_USAGE: -+ hfc->ctrl_urb.pipe = hfc->ctrl_in_pipe; -+ hfc->ctrl_urb.setup_packet = -+ (u_char *) & hfc->ctrl_read; -+ hfc->ctrl_urb.transfer_buffer_length = 1; -+ hfc->ctrl_read.index = -+ hfc->ctrl_buff[hfc->ctrl_out_idx]. -+ hfc_reg; -+ hfc->ctrl_urb.transfer_buffer = -+ (char *) &hfc->dfifo_fill; -+ break; -+ -+ default: /* write register */ -+ hfc->ctrl_urb.pipe = hfc->ctrl_out_pipe; -+ hfc->ctrl_urb.setup_packet = -+ (u_char *) & hfc->ctrl_write; -+ hfc->ctrl_urb.transfer_buffer = NULL; -+ hfc->ctrl_urb.transfer_buffer_length = 0; -+ hfc->ctrl_write.index = -+ hfc->ctrl_buff[hfc->ctrl_out_idx]. -+ hfc_reg; -+ hfc->ctrl_write.value = -+ hfc->ctrl_buff[hfc->ctrl_out_idx]. -+ reg_val; -+ break; -+ } -+ usb_submit_urb(&hfc->ctrl_urb); /* start transfer */ -+ } -+} /* ctrl_start_transfer */ -+ -+/************************************/ -+/* queue a control transfer request */ -+/* return 0 on success. */ -+/************************************/ -+static int -+queue_control_request(hfcusb_data * hfc, __u8 reg, __u8 val) -+{ -+ ctrl_buft *buf; -+ -+ if (hfc->ctrl_cnt >= HFC_CTRL_BUFSIZE) -+ return (1); /* no space left */ -+ buf = hfc->ctrl_buff + hfc->ctrl_in_idx; /* pointer to new index */ -+ buf->hfc_reg = reg; -+ buf->reg_val = val; -+ if (++hfc->ctrl_in_idx >= HFC_CTRL_BUFSIZE) -+ hfc->ctrl_in_idx = 0; /* pointer wrap */ -+ if (++hfc->ctrl_cnt == 1) -+ ctrl_start_transfer(hfc); -+ return (0); -+} /* queue_control_request */ -+ -+/**************************************/ -+/* called when timer t3 or t4 expires */ -+/**************************************/ -+static void -+l1_timer_expire(hfcusb_data * hfc) -+{ -+ if (timer_pending(&hfc->t4_timer)) -+ del_timer(&hfc->t4_timer); -+ queue_control_request(hfc, HFCUSB_STATES, 0x40); -+ test_and_set_bit(HFCUSB_L1_STATECHANGE, -+ &hfc->l1_event); -+ queue_task(&hfc->l1_tq, &tq_immediate); -+ mark_bh(IMMEDIATE_BH); -+} /* l1_timer_expire */ -+ -+/**************************************************/ -+/* (re)fills a tx-fifo urb. Queuing is done later */ -+/**************************************************/ -+static void -+fill_tx_urb(usb_fifo * fifo) -+{ -+ struct sk_buff *skb; -+ long flags; -+ int i, ii = 0; -+ -+ fifo->urb.dev = fifo->hfc->dev; -+ if ((fifo->buff) -+ && (fifo->urb.transfer_buffer_length < fifo->usb_maxlen)) { -+ switch (fifo->fifonum) { -+ case HFCUSB_B1_TX: -+ case HFCUSB_B2_TX: -+ skb = fifo->buff; -+ fifo->buff = NULL; -+ fifo->hfc->regd.bch_l1l2(fifo->hfc->regd. -+ arg_hisax, -+ (fifo->fifonum == -+ HFCUSB_B1_TX) ? 0 -+ : 1, -+ (PH_DATA | -+ CONFIRM), -+ (void *) skb); -+ fifo->hfc->service_request |= -+ fifo->fifo_mask; -+ return; -+ case HFCUSB_D_TX: -+ dev_kfree_skb_any(fifo->buff); -+ fifo->buff = NULL; -+ save_flags(flags); -+ cli(); -+ fifo->hfc->dfifo_fill = 0xff; /* currently invalid data */ -+ queue_control_request(fifo->hfc, -+ HFCUSB_FIFO, -+ HFCUSB_D_TX); -+ queue_control_request(fifo->hfc, -+ HFCUSB_F_USAGE, 0); -+ restore_flags(flags); -+ return; -+ default: -+ return; /* error, invalid fifo */ -+ } -+ } -+ -+ /* check if new buffer needed */ -+ if (!fifo->buff) { -+ switch (fifo->fifonum) { -+ case HFCUSB_B1_TX: -+ if (fifo->hfc->regd.bsk[0]) -+ fifo->buff = *fifo->hfc->regd.bsk[0]; /* B1-channel tx buffer */ -+ break; -+ case HFCUSB_B2_TX: -+ if (fifo->hfc->regd.bsk[1]) -+ fifo->buff = *fifo->hfc->regd.bsk[1]; /* B2-channel tx buffer */ -+ break; -+ case HFCUSB_D_TX: -+ if (fifo->hfc->regd.dsq) -+ fifo->buff = skb_dequeue(fifo->hfc->regd.dsq); /* D-channel tx queue */ -+ break; -+ default: -+ return; /* error, invalid fifo */ -+ } -+ if (!fifo->buff) { -+ fifo->active = 0; /* we are inactive now */ -+ fifo->hfc->active_fifos &= ~fifo->fifo_mask; -+ if (fifo->fifonum == HFCUSB_D_TX) { -+ test_and_set_bit(HFCUSB_L1_DTX, -+ &fifo->hfc->l1_event); -+ queue_task(&fifo->hfc->l1_tq, -+ &tq_immediate); -+ mark_bh(IMMEDIATE_BH); -+ } -+ return; -+ } -+ fifo->act_ptr = fifo->buff->data; /* start of data */ -+ fifo->active = 1; -+ ii = 1; -+ fifo->hfc->active_fifos |= fifo->fifo_mask; -+ fifo->hfc->service_request &= ~fifo->fifo_mask; -+ } -+ /* fillup the send buffer */ -+ i = fifo->buff->len - (fifo->act_ptr - fifo->buff->data); /* remaining length */ -+ fifo->buffer[0] = !fifo->transmode; /* not eof */ -+ if (i > (fifo->usb_maxlen - ii)) { -+ i = fifo->usb_maxlen - ii; -+ } -+ if (i) -+ memcpy(fifo->buffer + ii, fifo->act_ptr, i); -+ fifo->urb.transfer_buffer_length = i + ii; -+ fifo->rx_offset = ii; -+} /* fill_tx_urb */ -+ -+/************************************************/ -+/* transmit completion routine for all tx fifos */ -+/************************************************/ -+static void -+tx_complete(purb_t urb) -+{ -+ usb_fifo *fifo = (usb_fifo *) urb->context; /* pointer to our fifo */ -+ -+ fifo->hfc->service_request &= ~fifo->fifo_mask; /* no further handling */ -+ fifo->framenum = usb_get_current_frame_number(fifo->hfc->dev); -+ -+ /* check for deactivation or error */ -+ if ((!fifo->active) || (urb->status)) { -+ fifo->hfc->active_fifos &= ~fifo->fifo_mask; /* we are inactive */ -+ fifo->active = 0; -+ if ((fifo->buff) && (fifo->fifonum == HFCUSB_D_TX)) { -+ dev_kfree_skb_any(fifo->buff); -+ } -+ fifo->buff = NULL; -+ return; -+ } -+ fifo->act_ptr += (urb->transfer_buffer_length - fifo->rx_offset); /* adjust pointer */ -+ fill_tx_urb(fifo); /* refill the urb */ -+ fifo->hfc->threshold_mask |= fifo->fifo_mask; /* assume threshold reached */ -+ if (fifo->buff) -+ fifo->hfc->service_request |= fifo->fifo_mask; /* need to restart */ -+} /* tx_complete */ -+ -+/***********************************************/ -+/* receive completion routine for all rx fifos */ -+/***********************************************/ -+static void -+rx_complete(purb_t urb) -+{ -+ usb_fifo *fifo = (usb_fifo *) urb->context; /* pointer to our fifo */ -+ hfcusb_data *hfc = fifo->hfc; -+ usb_fifo *txfifo; -+ __u8 last_state; -+ int i, ii, currcnt, hdlci; -+ struct sk_buff *skb; -+ -+ urb->dev = hfc->dev; /* security init */ -+ if ((!fifo->active) || (urb->status)) { -+ hfc->service_request &= ~fifo->fifo_mask; /* no further handling */ -+ hfc->active_fifos &= ~fifo->fifo_mask; /* we are inactive */ -+ fifo->urb.interval = 0; /* cancel automatic rescheduling */ -+ if (fifo->buff) { -+ dev_kfree_skb_any(fifo->buff); -+ fifo->buff = NULL; -+ } -+ return; -+ } -+ -+ /* first check for any status changes */ -+ if ((urb->actual_length < fifo->rx_offset) -+ || (urb->actual_length > fifo->usb_maxlen)) -+ return; /* error condition */ -+ -+ if (fifo->rx_offset) { -+ hfc->threshold_mask = fifo->buffer[1]; /* update threshold status */ -+ fifo->next_complete = fifo->buffer[0] & 1; -+ if ((fifo->fifonum == HFCUSB_D_RX) && -+ (hfc->led_req != hfc->led_act)) -+ queue_control_request(hfc, HFCUSB_P_DATA, hfc->led_req); -+ -+ /* check if rescheduling needed */ -+ if ((i = -+ hfc->service_request & hfc->active_fifos & ~hfc-> -+ threshold_mask)) { -+ currcnt = -+ usb_get_current_frame_number(hfc->dev); -+ txfifo = hfc->fifos + HFCUSB_B1_TX; -+ ii = 3; -+ while (ii--) { -+ if ((i & txfifo->fifo_mask) -+ && (currcnt != txfifo->framenum)) { -+ hfc->service_request &= -+ ~txfifo->fifo_mask; -+ if (!txfifo->buff) -+ fill_tx_urb(txfifo); -+ if (txfifo->buff) -+ usb_submit_urb(&txfifo-> -+ urb); -+ } -+ txfifo += 2; -+ } -+ } -+ -+ /* handle l1 events */ -+ if ((fifo->buffer[0] >> 4) != hfc->l1_state) { -+ last_state = hfc->l1_state; -+ hfc->l1_state = fifo->buffer[0] >> 4; /* update status */ -+ if (timer_pending(&hfc->t4_timer)) -+ del_timer(&hfc->t4_timer); -+ if (((hfc->l1_state == 3) && -+ ((last_state == 7) || -+ (last_state == 8))) || -+ ((timer_pending(&hfc->t3_timer) && -+ (hfc->l1_state == 8)))) { -+ hfc->t4_timer.expires = jiffies + 2; -+ add_timer(&hfc->t4_timer); -+ } else { -+ if (timer_pending(&hfc->t3_timer) -+ && (hfc->l1_state == 7)) -+ del_timer(&hfc->t3_timer); /* no longer needed */ -+ test_and_set_bit(HFCUSB_L1_STATECHANGE, -+ &hfc->l1_event); -+ queue_task(&hfc->l1_tq, &tq_immediate); -+ mark_bh(IMMEDIATE_BH); -+ } -+ } -+ } -+ -+ /* check the length for data and move if present */ -+ if (fifo->next_complete || (urb->actual_length > fifo->rx_offset)) { -+ i = fifo->buff->len + urb->actual_length - fifo->rx_offset; /* new total length */ -+ hdlci = (fifo->transmode) ? 0 : 3; -+ if (i <= (fifo->max_size + hdlci)) { -+ memcpy(fifo->act_ptr, -+ fifo->buffer + fifo->rx_offset, -+ urb->actual_length - fifo->rx_offset); -+ fifo->act_ptr += -+ (urb->actual_length - fifo->rx_offset); -+ fifo->buff->len += -+ (urb->actual_length - fifo->rx_offset); -+ } else -+ fifo->buff->len = fifo->max_size + 4; /* mark frame as to long */ -+ if (fifo->next_complete && (urb->actual_length < fifo->usb_maxlen)) { -+ /* the frame is complete */ -+ fifo->next_complete = 0; -+ if (((!*(fifo->act_ptr - 1)) || fifo->transmode) && -+ (fifo->buff->len >= (hdlci + 1)) -+ && (fifo->buff->len <= -+ (fifo->max_size + hdlci)) && -+ ((skb = dev_alloc_skb(fifo->max_size + hdlci)) != NULL)) { -+ fifo->buff->len -= hdlci; /* adjust size */ -+ switch (fifo->fifonum) { -+ case HFCUSB_D_RX: -+ skb_queue_tail(hfc->regd. -+ drq, -+ fifo->buff); -+ test_and_set_bit -+ (HFCUSB_L1_DRX, -+ &hfc->l1_event); -+ queue_task(&hfc->l1_tq, -+ &tq_immediate); -+ mark_bh(IMMEDIATE_BH); -+ break; -+ -+ case HFCUSB_B1_RX: -+ if (hfc->regd.brq[0]) { -+ skb_queue_tail -+ (hfc->regd. -+ brq[0], -+ fifo->buff); -+ hfc->regd. -+ bch_l1l2(hfc-> -+ regd. -+ arg_hisax, -+ 0, -+ PH_DATA -+ | -+ INDICATION, -+ (void *) -+ fifo-> -+ buff); -+ } else -+ dev_kfree_skb_any -+ (fifo->buff); -+ break; -+ -+ case HFCUSB_B2_RX: -+ if (hfc->regd.brq[1]) { -+ skb_queue_tail -+ (hfc->regd. -+ brq[1], -+ fifo->buff); -+ hfc->regd. -+ bch_l1l2(hfc-> -+ regd. -+ arg_hisax, -+ 1, -+ PH_DATA -+ | -+ INDICATION, -+ (void -+ *) -+ fifo-> -+ buff); -+ } else -+ dev_kfree_skb_any -+ (fifo->buff); -+ break; -+ -+ case HFCUSB_PCM_RX: -+ skb_queue_tail(&hfc->regd. -+ erq, -+ fifo->buff); -+ test_and_set_bit -+ (HFCUSB_L1_ERX, -+ &hfc->l1_event); -+ queue_task(&hfc->l1_tq, -+ &tq_immediate); -+ mark_bh(IMMEDIATE_BH); -+ break; -+ -+ default: -+ dev_kfree_skb_any(fifo-> -+ buff); -+ break; -+ } -+ fifo->buff = skb; -+ } -+ fifo->buff->len = 0; /* reset counter */ -+ fifo->act_ptr = fifo->buff->data; /* and pointer */ -+ } -+ } -+ fifo->rx_offset = (urb->actual_length < fifo->usb_maxlen) ? 2 : 0; -+} /* rx_complete */ -+ -+/***************************************************/ -+/* start the interrupt transfer for the given fifo */ -+/***************************************************/ -+static void -+start_rx_fifo(usb_fifo * fifo) -+{ -+ if (fifo->buff) -+ return; /* still active */ -+ if (! -+ (fifo->buff = -+ dev_alloc_skb(fifo->max_size + (fifo->transmode ? 0 : 3)))) -+ return; -+ fifo->act_ptr = fifo->buff->data; -+ FILL_INT_URB(&fifo->urb, fifo->hfc->dev, fifo->pipe, fifo->buffer, -+ fifo->usb_maxlen, rx_complete, fifo, fifo->intervall); -+ fifo->next_complete = 0; -+ fifo->rx_offset = 2; -+ fifo->active = 1; /* must be marked active */ -+ fifo->hfc->active_fifos |= fifo->fifo_mask; -+ if (usb_submit_urb(&fifo->urb)) { -+ fifo->active = 0; -+ fifo->hfc->active_fifos &= ~fifo->fifo_mask; -+ dev_kfree_skb_any(fifo->buff); -+ fifo->buff = NULL; -+ } -+} /* start_rx_fifo */ -+ -+/***************************************************************/ -+/* control completion routine handling background control cmds */ -+/***************************************************************/ -+static void -+ctrl_complete(purb_t urb) -+{ -+ hfcusb_data *hfc = (hfcusb_data *) urb->context; -+ -+ urb->dev = hfc->dev; -+ if (hfc->ctrl_cnt) { -+ switch (hfc->ctrl_buff[hfc->ctrl_out_idx].hfc_reg) { -+ case HFCUSB_FIFO: -+ hfc->ctrl_fifo = -+ hfc->ctrl_buff[hfc->ctrl_out_idx]. -+ reg_val; -+ break; -+ case HFCUSB_F_USAGE: -+ if (!hfc->dfifo_fill) { -+ fill_tx_urb(hfc->fifos + -+ HFCUSB_D_TX); -+ if (hfc->fifos[HFCUSB_D_TX].buff) -+ usb_submit_urb(&hfc-> -+ fifos -+ [HFCUSB_D_TX]. -+ urb); -+ } else { -+ queue_control_request(hfc, -+ HFCUSB_FIFO, -+ HFCUSB_D_TX); -+ queue_control_request(hfc, -+ HFCUSB_F_USAGE, -+ 0); -+ } -+ break; -+ case HFCUSB_SCTRL_R: -+ switch (hfc->ctrl_fifo) { -+ case HFCUSB_B1_RX: -+ if (hfc->bch_enables & 1) -+ start_rx_fifo(hfc-> -+ fifos -+ + -+ HFCUSB_B1_RX); -+ break; -+ case HFCUSB_B2_RX: -+ if (hfc->bch_enables & 2) -+ start_rx_fifo(hfc-> -+ fifos -+ + -+ HFCUSB_B2_RX); -+ break; -+ } -+ if (hfc->bch_enables & 3) -+ hfc->led_req |= LED_BCH; -+ else -+ hfc->led_req &= ~LED_BCH; -+ break; -+ case HFCUSB_P_DATA: -+ hfc->led_act = -+ hfc->ctrl_buff[hfc->ctrl_out_idx]. -+ reg_val; -+ break; -+ } -+ hfc->ctrl_cnt--; /* decrement actual count */ -+ if (++hfc->ctrl_out_idx >= HFC_CTRL_BUFSIZE) -+ hfc->ctrl_out_idx = 0; /* pointer wrap */ -+ ctrl_start_transfer(hfc); /* start next transfer */ -+ } -+} /* ctrl_complete */ -+ -+/*****************************************/ -+/* Layer 1 + D channel access from HiSax */ -+/*****************************************/ -+static void -+hfcusb_l1_access(void *drvarg, int pr, void *arg) -+{ -+ hfcusb_data *hfc = (hfcusb_data *) drvarg; -+ -+ switch (pr) { -+ case (PH_DATA | REQUEST): -+ case (PH_PULL | INDICATION): -+ skb_queue_tail(hfc->regd.dsq, -+ (struct sk_buff *) arg); -+ if (!hfc->fifos[HFCUSB_D_TX].active -+ && !hfc->dfifo_fill) { -+ fill_tx_urb(hfc->fifos + HFCUSB_D_TX); -+ hfc->active_fifos |= -+ hfc->fifos[HFCUSB_D_TX].fifo_mask; -+ usb_submit_urb(&hfc->fifos[HFCUSB_D_TX]. -+ urb); -+ } -+ break; -+ case (PH_ACTIVATE | REQUEST): -+ switch (hfc->l1_state) { -+ case 6: -+ case 8: -+ hfc->regd.dch_l1l2(hfc->regd.arg_hisax, -+ (PH_DEACTIVATE | -+ INDICATION), NULL); -+ -+ break; -+ case 7: -+ hfc->regd.dch_l1l2(hfc->regd.arg_hisax, -+ (PH_ACTIVATE | -+ INDICATION), NULL); -+ -+ break; -+ default: -+ queue_control_request(hfc, HFCUSB_STATES, 0x60); /* start activation */ -+ hfc->t3_timer.expires = -+ jiffies + (HFC_TIMER_T3 * HZ) / 1000; -+ if (!timer_pending(&hfc->t3_timer)) -+ add_timer(&hfc->t3_timer); -+ break; -+ } -+ break; -+ -+ case (PH_DEACTIVATE | REQUEST): -+ queue_control_request(hfc, HFCUSB_STATES, 0x40); /* start deactivation */ -+ break; -+ default: -+ printk(KERN_INFO "unknown hfcusb l1_access 0x%x\n", -+ pr); -+ break; -+ } -+} /* hfcusb_l1_access */ -+ -+/*******************************/ -+/* B channel access from HiSax */ -+/*******************************/ -+static void -+hfcusb_bch_access(void *drvarg, int chan, int pr, void *arg) -+{ -+ hfcusb_data *hfc = (hfcusb_data *) drvarg; -+ usb_fifo *fifo = hfc->fifos + (chan ? HFCUSB_B2_TX : HFCUSB_B1_TX); -+ long flags; -+ -+ switch (pr) { -+ case (PH_DATA | REQUEST): -+ case (PH_PULL | INDICATION): -+ save_flags(flags); -+ cli(); -+ if (!fifo->active) { -+ fill_tx_urb(fifo); -+ hfc->active_fifos |= fifo->fifo_mask; -+ usb_submit_urb(&fifo->urb); -+ } -+ restore_flags(flags); -+ break; -+ case (PH_ACTIVATE | REQUEST): -+ if (!((int) arg)) { -+ hfc->bch_enables &= ~(1 << chan); -+ if (fifo->active) { -+ fifo->active = 0; -+ usb_unlink_urb(&fifo->urb); -+ } -+ save_flags(flags); -+ cli(); -+ queue_control_request(hfc, HFCUSB_FIFO, -+ fifo->fifonum); -+ queue_control_request(hfc, -+ HFCUSB_INC_RES_F, 2); -+ queue_control_request(hfc, HFCUSB_CON_HDLC, -+ 9); -+ queue_control_request(hfc, HFCUSB_SCTRL, -+ 0x40 + -+ hfc->bch_enables); -+ queue_control_request(hfc, HFCUSB_SCTRL_R, -+ hfc->bch_enables); -+ restore_flags(flags); -+ fifo++; -+ if (fifo->active) { -+ fifo->active = 0; -+ usb_unlink_urb(&fifo->urb); -+ } -+ return; /* fifo deactivated */ -+ } -+ fifo->transmode = ((int) arg == L1_MODE_TRANS); -+ fifo->max_size = -+ ((fifo->transmode) ? fifo-> -+ usb_maxlen : MAX_BCH_SIZE); -+ (fifo + 1)->transmode = fifo->transmode; -+ (fifo + 1)->max_size = fifo->max_size; -+ hfc->bch_enables |= (1 << chan); -+ save_flags(flags); -+ cli(); -+ queue_control_request(hfc, HFCUSB_FIFO, -+ fifo->fifonum); -+ queue_control_request(hfc, HFCUSB_CON_HDLC, -+ ((!fifo-> -+ transmode) ? 9 : 11)); -+ queue_control_request(hfc, HFCUSB_INC_RES_F, 2); -+ queue_control_request(hfc, HFCUSB_SCTRL, -+ 0x40 + hfc->bch_enables); -+ if ((int) arg == L1_MODE_HDLC) -+ queue_control_request(hfc, HFCUSB_CON_HDLC, -+ 8); -+ queue_control_request(hfc, HFCUSB_FIFO, -+ fifo->fifonum + 1); -+ queue_control_request(hfc, HFCUSB_CON_HDLC, -+ ((!fifo-> -+ transmode) ? 8 : 10)); -+ queue_control_request(hfc, HFCUSB_INC_RES_F, 2); -+ queue_control_request(hfc, HFCUSB_SCTRL_R, -+ hfc->bch_enables); -+ restore_flags(flags); -+ -+ break; -+ -+ default: -+ printk(KERN_INFO -+ "unknown hfcusb bch_access chan %d 0x%x\n", -+ chan, pr); -+ break; -+ } -+} /* hfcusb_bch_access */ -+ -+/***************************************************************************/ -+/* usb_init is called once when a new matching device is detected to setup */ -+/* main parmeters. It registers the driver at the main hisax module. */ -+/* on success 0 is returned. */ -+/***************************************************************************/ -+static int -+usb_init(hfcusb_data * hfc) -+{ -+ usb_fifo *fifo; -+ int i; -+ u_char b; -+ -+ /* check the chip id */ -+ if ((Read_hfc(hfc, HFCUSB_CHIP_ID, &b) != 1) || -+ (b != HFCUSB_CHIPID)) { -+ printk(KERN_INFO "HFC-USB: Invalid chip id 0x%02x\n", b); -+ return (1); -+ } -+ -+ /* first set the needed config, interface and alternate */ -+ usb_set_configuration(hfc->dev, 1); -+ usb_set_interface(hfc->dev, hfc->if_used, hfc->alt_used); -+ -+ /* init the led state request */ -+ hfc->led_req = LED_DRIVER; -+ -+ /* now we initialise the chip */ -+ Write_hfc(hfc, HFCUSB_CIRM, 0x10); /* aux = output, reset off */ -+ Write_hfc(hfc, HFCUSB_P_DATA, 0); /* leds = off */ -+ Write_hfc(hfc, HFCUSB_USB_SIZE, -+ (hfc->fifos[HFCUSB_B1_TX].usb_maxlen >> 3) | -+ ((hfc->fifos[HFCUSB_B1_RX].usb_maxlen >> 3) << 4)); -+ -+ /* enable PCM/GCI master mode */ -+ Write_hfc(hfc, HFCUSB_MST_MODE1, 0); /* set default values */ -+ Write_hfc(hfc, HFCUSB_MST_MODE0, 1); /* enable master mode */ -+ -+ /* init the fifos */ -+ Write_hfc(hfc, HFCUSB_F_THRES, (HFCUSB_TX_THRESHOLD >> 3) | -+ ((HFCUSB_RX_THRESHOLD >> 3) << 4)); -+ -+ for (i = 0, fifo = hfc->fifos + i; i < HFCUSB_NUM_FIFOS; -+ i++, fifo++) { -+ Write_hfc(hfc, HFCUSB_FIFO, i); /* select the desired fifo */ -+ -+ fifo->transmode = 0; /* hdlc mode selected */ -+ fifo->buff = NULL; /* init buffer pointer */ -+ fifo->max_size = -+ (i <= HFCUSB_B2_RX) ? MAX_BCH_SIZE : MAX_DFRAME_LEN; -+ Write_hfc(hfc, HFCUSB_HDLC_PAR, ((i <= HFCUSB_B2_RX) ? 0 : 2)); /* data length */ -+ Write_hfc(hfc, HFCUSB_CON_HDLC, ((i & 1) ? 0x08 : 0x09)); /* rx hdlc, tx fill 1 */ -+ Write_hfc(hfc, HFCUSB_INC_RES_F, 2); /* reset the fifo */ -+ } -+ -+ Write_hfc(hfc, HFCUSB_CLKDEL, 0x0f); /* clock delay value */ -+ Write_hfc(hfc, HFCUSB_STATES, 3 | 0x10); /* set deactivated mode */ -+ Write_hfc(hfc, HFCUSB_STATES, 3); /* enable state machine */ -+ -+ Write_hfc(hfc, HFCUSB_SCTRL_R, 0); /* disable both B receivers */ -+ Write_hfc(hfc, HFCUSB_SCTRL, 0x40); /* disable B transmitters + cap mode */ -+ -+ /* init the l1 timer */ -+ init_timer(&hfc->t3_timer); -+ hfc->t3_timer.data = (long) hfc; -+ hfc->t3_timer.function = (void *) l1_timer_expire; -+ hfc->t4_timer.data = (long) hfc; -+ hfc->t4_timer.function = (void *) l1_timer_expire; -+ hfc->l1_tq.routine = (void *) (void *) usb_l1d_bh; -+ hfc->l1_tq.sync = 0; -+ hfc->l1_tq.data = hfc; -+ -+ /* init the background control machinery */ -+ hfc->ctrl_read.requesttype = 0xc0; -+ hfc->ctrl_read.request = 1; -+ hfc->ctrl_read.length = 1; -+ hfc->ctrl_write.requesttype = 0x40; -+ hfc->ctrl_write.request = 0; -+ hfc->ctrl_write.length = 0; -+ FILL_CONTROL_URB(&hfc->ctrl_urb, hfc->dev, hfc->ctrl_out_pipe, -+ (u_char *) & hfc->ctrl_write, NULL, 0, -+ ctrl_complete, hfc); -+ -+ /* init the TX-urbs */ -+ fifo = hfc->fifos + HFCUSB_D_TX; -+ FILL_BULK_URB(&fifo->urb, hfc->dev, fifo->pipe, -+ (u_char *) fifo->buffer, 0, tx_complete, fifo); -+ fifo = hfc->fifos + HFCUSB_B1_TX; -+ FILL_BULK_URB(&fifo->urb, hfc->dev, fifo->pipe, -+ (u_char *) fifo->buffer, 0, tx_complete, fifo); -+ fifo = hfc->fifos + HFCUSB_B2_TX; -+ FILL_BULK_URB(&fifo->urb, hfc->dev, fifo->pipe, -+ (u_char *) fifo->buffer, 0, tx_complete, fifo); -+ -+ /* init the E-buffer */ -+ skb_queue_head_init(&hfc->regd.erq); -+ -+ /* now register ourself at hisax */ -+ hfc->regd.version = HISAX_LOAD_VERSION; /* set our version */ -+ hfc->regd.cmd = HISAX_LOAD_REGISTER; /* register command */ -+ hfc->regd.argl1 = (void *) hfc; /* argument for our local routine */ -+ hfc->regd.dch_l2l1 = hfcusb_l1_access; -+ hfc->regd.bch_l2l1 = hfcusb_bch_access; -+ hfc->regd.drvname = "hfc_usb"; -+ if (hisax_register_hfcusb(&hfc->regd)) { -+ printk(KERN_INFO "HFC-USB failed to register at hisax\n"); -+ Write_hfc(hfc, HFCUSB_CIRM, 0x08); /* aux = input, reset on */ -+ return (1); -+ } -+ -+ /* startup the D- and E-channel fifos */ -+ start_rx_fifo(hfc->fifos + HFCUSB_D_RX); /* D-fifo */ -+ if (hfc->fifos[HFCUSB_PCM_RX].pipe) -+ start_rx_fifo(hfc->fifos + HFCUSB_PCM_RX); /* E-fifo */ -+ -+ return (0); -+} /* usb_init */ -+ -+/*************************************************/ -+/* function called to probe a new plugged device */ -+/*************************************************/ -+static void * -+hfc_usb_probe(struct usb_device *dev, unsigned int interface -+#ifdef COMPAT_HAS_USB_IDTAB -+ , const struct usb_device_id *id_table) -+#else -+ ) -+#endif -+{ -+ hfcusb_data *context; -+ struct usb_interface *ifp = dev->actconfig->interface + interface; -+ struct usb_interface_descriptor *ifdp = -+ ifp->altsetting + ifp->act_altsetting; -+ struct usb_endpoint_descriptor *epd; -+ int i, idx, ep_msk; -+ -+#ifdef COMPAT_HAS_USB_IDTAB -+ if (id_table && (dev->descriptor.idVendor == id_table->idVendor) && -+ (dev->descriptor.idProduct == id_table->idProduct) && -+#else -+ if ((((dev->descriptor.idVendor == 0x959) && -+ (dev->descriptor.idProduct == 0x2bd0)) || -+ ((dev->descriptor.idVendor == 0x7b0) && -+ (dev->descriptor.idProduct == 0x0006))) && -+#endif -+ (ifdp->bNumEndpoints >= 6) && (ifdp->bNumEndpoints <= 16)) { -+ if (!(context = kmalloc(sizeof(hfcusb_data), GFP_KERNEL))) { -+ return (NULL); /* got no mem */ -+ }; -+ memset(context, 0, sizeof(hfcusb_data)); /* clear the structure */ -+ i = ifdp->bNumEndpoints; /* get number of endpoints */ -+ ep_msk = 0; /* none found */ -+ epd = ifdp->endpoint; /* first endpoint descriptor */ -+ while (i-- && ((ep_msk & 0xcf) != 0xcf)) { -+ -+ idx = (((epd->bEndpointAddress & 0x7f) - 1) << 1); /* get endpoint base */ -+ if (idx < 7) { -+ switch (epd->bmAttributes) { -+ case USB_ENDPOINT_XFER_INT: -+ if (! -+ (epd-> -+ bEndpointAddress & -+ 0x80)) -+ break; /* only interrupt in allowed */ -+ idx++; /* input index is odd */ -+ context->fifos[idx].pipe = -+ usb_rcvintpipe(dev, -+ epd-> -+ bEndpointAddress); -+ break; -+ -+ case USB_ENDPOINT_XFER_BULK: -+ if (epd-> -+ bEndpointAddress & -+ 0x80) -+ break; /* only bulk out allowed */ -+ context->fifos[idx].pipe = -+ usb_sndbulkpipe(dev, -+ epd-> -+ bEndpointAddress); -+ break; -+ default: -+ context->fifos[idx].pipe = 0; /* reset data */ -+ } /* switch attribute */ -+ -+ if (context->fifos[idx].pipe) { -+ context->fifos[idx].fifonum = idx; -+ context->fifos[idx].fifo_mask = -+ 1 << idx; -+ context->fifos[idx].hfc = context; -+ context->fifos[idx].usb_maxlen = -+ epd->wMaxPacketSize; -+ context->fifos[idx].intervall = -+ epd->bInterval; -+ ep_msk |= (1 << idx); -+ } else -+ ep_msk &= ~(1 << idx); -+ } /* idx < 7 */ -+ epd++; -+ } -+ -+ if ((ep_msk & 0x3f) != 0x3f) { -+ kfree(context); -+ return (NULL); -+ } -+ MOD_INC_USE_COUNT; /* lock our module */ -+ context->dev = dev; /* save device */ -+ context->if_used = interface; /* save used interface */ -+ context->alt_used = ifp->act_altsetting; /* and alternate config */ -+ context->ctrl_paksize = dev->descriptor.bMaxPacketSize0; /* control size */ -+ -+ /* create the control pipes needed for register access */ -+ context->ctrl_in_pipe = usb_rcvctrlpipe(context->dev, 0); -+ context->ctrl_out_pipe = usb_sndctrlpipe(context->dev, 0); -+ -+ /* init the chip and register the driver */ -+ if (usb_init(context)) { -+ kfree(context); -+ MOD_DEC_USE_COUNT; -+ return (NULL); -+ } -+ -+ printk(KERN_INFO -+ "HFC-USB: New device if=%d alt=%d registered\n", -+ context->if_used, context->alt_used); -+ return (context); -+ } -+ -+ return (NULL); /* no matching entry */ -+} /* hfc_usb_probe */ -+ -+/****************************************************/ -+/* function called when an active device is removed */ -+/****************************************************/ -+static void -+hfc_usb_disconnect(struct usb_device *usbdev, void *drv_context) -+{ -+ hfcusb_data *context = drv_context; -+ int i; -+ struct sk_buff *skb; -+ -+ /* tell all fifos to terminate */ -+ for (i = 0; i < HFCUSB_NUM_FIFOS; i++) -+ if (context->fifos[i].active) { -+ context->fifos[i].active = 0; -+ usb_unlink_urb(&context->fifos[i].urb); -+ } -+ while (context->active_fifos) { -+ set_current_state(TASK_INTERRUPTIBLE); -+ /* Timeout 10ms */ -+ schedule_timeout((10 * HZ) / 1000); -+ } -+ if (timer_pending(&context->t3_timer)) -+ del_timer(&context->t3_timer); -+ context->regd.release_driver(context->regd.arg_hisax); -+ while ((skb = skb_dequeue(&context->regd.erq)) != NULL) -+ dev_kfree_skb_any(skb); -+ -+ kfree(context); /* free our structure again */ -+ MOD_DEC_USE_COUNT; /* and decrement the usage counter */ -+} /* hfc_usb_disconnect */ -+ -+/************************************/ -+/* our driver information structure */ -+/************************************/ -+static struct usb_driver hfc_drv = { -+ name:"hfc_usb", -+#ifdef COMPAT_HAS_USB_IDTAB -+ id_table:hfc_usb_idtab, -+#endif -+ probe:hfc_usb_probe, -+ disconnect:hfc_usb_disconnect, -+}; -+ -+static void __exit -+hfc_usb_exit(void) -+{ -+ -+ usb_deregister(&hfc_drv); /* release our driver */ -+ printk(KERN_INFO "HFC-USB module removed\n"); -+} -+ -+static int __init -+hfc_usb_init(void) -+{ -+ struct hisax_drvreg drv; -+ -+ drv.version = HISAX_LOAD_VERSION; /* set our version */ -+ drv.cmd = HISAX_LOAD_CHKVER; /* check command only */ -+ if (hisax_register_hfcusb(&drv)) { -+ printk(KERN_INFO "HFC-USB <-> hisax version conflict\n"); -+ return (-1); /* unable to register */ -+ } -+ if (usb_register(&hfc_drv)) { -+ printk(KERN_INFO -+ "Unable to register HFC-USB module at usb stack\n"); -+ return (-1); /* unable to register */ -+ } -+ -+ printk(KERN_INFO "HFC-USB module loaded\n"); -+ return (0); -+} -+ -+module_init(hfc_usb_init); -+module_exit(hfc_usb_exit); -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfc_usbr.c linux-2.4.29/drivers/isdn/hisax/hfc_usbr.c ---- linux-2.4.29.old/drivers/isdn/hisax/hfc_usbr.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hfc_usbr.c 2005-03-22 15:06:46.397039360 +0100 -@@ -0,0 +1,471 @@ -+/* $Id: hfc_usbr.c,v 2.5 2001/07/06 21:30:11 werner Exp $ -+ -+ * hfc_usb.c low level driver for CCD´s hfc-usb single chip controllers -+ * type approval valid for HFC-S USB based TAs -+ * -+ * Author Werner Cornelius (werner@isdn-development.de) -+ * -+ * Copyright 2001 by Werner Cornelius (werner@isdn4linux.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, 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. -+ * -+ */ -+ -+#define __NO_VERSION__ -+#include -+#include "hisax.h" -+#include "isdnl1.h" -+#include "hisax_loadable.h" -+ -+extern const char *CardType[]; -+ -+static const char *hfcusb_revision = "$Revision: 2.5 $"; -+ -+/*********************************/ -+/* schedule a new b_channel task */ -+/*********************************/ -+static void -+hfcusb_sched_event(struct BCState *bcs, int event) -+{ -+ bcs->event |= 1 << event; -+ queue_task(&bcs->tqueue, &tq_immediate); -+ mark_bh(IMMEDIATE_BH); -+} -+ -+/************************************************/ -+/* select a b-channel entry matching and active */ -+/************************************************/ -+static -+struct BCState * -+Sel_BCS(struct IsdnCardState *cs, int channel) -+{ -+ if (cs->bcs[0].mode && (cs->bcs[0].channel == channel)) -+ return (&cs->bcs[0]); -+ else if (cs->bcs[1].mode && (cs->bcs[1].channel == channel)) -+ return (&cs->bcs[1]); -+ else -+ return (NULL); -+} -+ -+/**********************************************/ -+/* transfer function (D-channel from l2 to l1 */ -+/**********************************************/ -+static void -+hfcusb_d_l2l1(struct PStack *st, int pr, void *arg) -+{ -+ struct IsdnCardState *cs = st->l1.hardware; -+ struct hisax_drvreg *drv = cs->hw.hfcusb.drv; -+ -+ if (drv) { -+ switch (pr) { -+ case (PH_DATA | REQUEST): -+ case (PH_PULL | INDICATION): -+ cs->hw.hfcusb.dch_tx_busy = 1; -+ break; -+ case (PH_PULL | REQUEST): -+ if (!cs->hw.hfcusb.dch_tx_busy) { -+ test_and_clear_bit(FLG_L1_PULL_REQ, -+ &st->l1.Flags); -+ st->l1.l1l2(st, PH_PULL | CONFIRM, -+ NULL); -+ } else -+ test_and_set_bit(FLG_L1_PULL_REQ, -+ &st->l1.Flags); -+ return; -+ } -+ drv->dch_l2l1(drv, pr, arg); -+ } else -+ debugl1(cs, "hfcusb l2l1 called without existing driver"); -+} /* hfcusb_d_l2l1 */ -+ -+/*****************************/ -+/* E-channel receive routine */ -+/*****************************/ -+static void -+EChannel_proc_rcv(struct IsdnCardState *cs) -+{ -+ u_char *ptr; -+ struct sk_buff *skb; -+ struct hisax_drvreg *usbdrv = -+ (struct hisax_drvreg *) cs->hw.hfcusb.drv; -+ -+ -+ while ((skb = skb_dequeue(&usbdrv->erq)) != NULL) { -+ if (cs->debug & DEB_DLOG_HEX) { -+ ptr = cs->dlog; -+ if ((skb->len) < MAX_DLOG_SPACE / 3 - 10) { -+ *ptr++ = 'E'; -+ *ptr++ = 'C'; -+ *ptr++ = 'H'; -+ *ptr++ = 'O'; -+ *ptr++ = ':'; -+ ptr += QuickHex(ptr, skb->data, skb->len); -+ ptr--; -+ *ptr++ = '\n'; -+ *ptr = 0; -+ HiSax_putstatus(cs, NULL, cs->dlog); -+ } else -+ HiSax_putstatus(cs, "LogEcho: ", -+ "warning Frame too big (%d)", -+ skb->len); -+ } -+ dev_kfree_skb_any(skb); -+ } -+} -+ -+/******************************************/ -+/* transfer function called from L1 to L2 */ -+/******************************************/ -+static void -+hfcusb_d_l1l2(void *cs1, int pr, void *arg) -+{ -+ struct IsdnCardState *cs = (struct IsdnCardState *) cs1; -+ -+ switch (pr) { -+ case (PH_DATA | INDICATION): -+ if (!((int) arg)) -+ DChannel_proc_rcv(cs); -+ else -+ EChannel_proc_rcv(cs); -+ break; -+ -+ case (PH_DATA | CONFIRM): -+ cs->hw.hfcusb.dch_tx_busy = 0; -+ DChannel_proc_xmt(cs); -+ break; -+ -+ case (PH_ACTIVATE | INDICATION): -+ case (PH_ACTIVATE | CONFIRM): -+ cs->stlist->l1.l1l2(cs->stlist, pr, arg); -+ if (cs->debug & L1_DEB_ISAC) -+ debugl1(cs, "layer 1 activated"); -+ break; -+ -+ case (PH_DEACTIVATE | INDICATION): -+ case (PH_DEACTIVATE | CONFIRM): -+ cs->stlist->l1.l1l2(cs->stlist, pr, arg); -+ if (cs->debug & L1_DEB_ISAC) -+ debugl1(cs, "layer 1 deactivated"); -+ break; -+ -+ default: -+ debugl1(cs, "unknown l1 msg 0x%x ", pr); -+ } -+} /* hfcusb_d_l1l2 */ -+ -+ -+/******************************************/ -+/* transfer function called from L1 to L2 */ -+/******************************************/ -+static void -+hfcusb_b_l1l2(void *cs1, int chan, int pr, void *arg) -+{ -+ struct IsdnCardState *cs = (struct IsdnCardState *) cs1; -+ struct BCState *bcs = Sel_BCS(cs, chan); -+ -+ switch (pr) { -+ case (PH_DATA | INDICATION): -+ if (!bcs) -+ return; -+ hfcusb_sched_event(bcs, B_RCVBUFREADY); -+ break; -+ -+ case (PH_DATA | CONFIRM): -+ if (!bcs) -+ return; -+ bcs->tx_cnt -= bcs->tx_skb->len; -+ if (bcs->st->lli.l1writewakeup && -+ (PACKET_NOACK != bcs->tx_skb->pkt_type)) -+ bcs->st->lli.l1writewakeup(bcs->st, -+ bcs->tx_skb-> -+ len); -+ dev_kfree_skb_any(bcs->tx_skb); -+ bcs->tx_skb = skb_dequeue(&bcs->squeue); -+ break; -+ -+ case (PH_ACTIVATE | INDICATION): -+ case (PH_ACTIVATE | CONFIRM): -+ cs->stlist->l1.l1l2(cs->stlist, pr, arg); -+ if (cs->debug & L1_DEB_ISAC) -+ debugl1(cs, "layer 1 activated"); -+ break; -+ -+ case (PH_DEACTIVATE | INDICATION): -+ case (PH_DEACTIVATE | CONFIRM): -+ cs->stlist->l1.l1l2(cs->stlist, pr, arg); -+ if (cs->debug & L1_DEB_ISAC) -+ debugl1(cs, "layer 1 deactivated"); -+ break; -+ -+ default: -+ debugl1(cs, "unknown l1 b msg 0x%x ", pr); -+ } -+} /* hfcusb_b_l1l2 */ -+ -+ -+/***********************************************/ -+/* called during init setting l1 stack pointer */ -+/***********************************************/ -+void -+setstack_hfcusb(struct PStack *st, struct IsdnCardState *cs) -+{ -+ st->l2.l2l1 = hfcusb_d_l2l1; -+} -+ -+/**************************************/ -+/* send B-channel data if not blocked */ -+/**************************************/ -+static void -+hfcusb_send_data(struct BCState *bcs) -+{ -+ struct IsdnCardState *cs = bcs->cs; -+ struct hisax_drvreg *drv = -+ (struct hisax_drvreg *) cs->hw.hfcusb.drv; -+ -+ if (!drv) -+ return; -+ drv->bch_l2l1(drv->argl1, bcs->channel, PH_DATA | REQUEST, -+ bcs->tx_skb); -+} -+ -+/***************************************************************/ -+/* activate/deactivate hardware for selected channels and mode */ -+/***************************************************************/ -+void -+mode_hfcusb(struct BCState *bcs, int mode, int bc) -+{ -+ struct IsdnCardState *cs = bcs->cs; -+ struct hisax_drvreg *drv = cs->hw.hfcusb.drv; -+ -+ if (!drv) -+ return; -+ if (cs->debug & L1_DEB_HSCX) -+ debugl1(cs, "HFCUSB bchannel mode %d bchan %d/%d", -+ mode, bc, bcs->channel); -+ bcs->mode = mode; -+ bcs->channel = bc; -+ if (mode) { -+ drv->bsk[bc] = &bcs->tx_skb; -+ drv->brq[bc] = &bcs->rqueue; -+ } -+ drv->bch_l2l1(drv->argl1, bc, PH_ACTIVATE | REQUEST, -+ (void *) mode); -+ if (!mode) { -+ drv->bsk[bc] = NULL; -+ drv->brq[bc] = NULL; -+ } -+} -+ -+/******************************/ -+/* Layer2 -> Layer 1 Transfer */ -+/******************************/ -+static void -+hfcusb_b_l2l1(struct PStack *st, int pr, void *arg) -+{ -+ struct sk_buff *skb = arg; -+ struct hisax_drvreg *drv = st->l1.bcs->cs->hw.hfcusb.drv; -+ long flags; -+ -+ switch (pr) { -+ case (PH_DATA | REQUEST): -+ save_flags(flags); -+ cli(); -+ if (st->l1.bcs->tx_skb) { -+ skb_queue_tail(&st->l1.bcs->squeue, skb); -+ restore_flags(flags); -+ } else { -+ st->l1.bcs->tx_skb = skb; -+ st->l1.bcs->cs->BC_Send_Data(st->l1.bcs); -+ restore_flags(flags); -+ } -+ break; -+ case (PH_PULL | INDICATION): -+ if (st->l1.bcs->tx_skb) { -+ printk(KERN_WARNING -+ "hfc_l2l1: this shouldn't happen\n"); -+ break; -+ } -+ save_flags(flags); -+ cli(); -+ st->l1.bcs->tx_skb = skb; -+ st->l1.bcs->cs->BC_Send_Data(st->l1.bcs); -+ restore_flags(flags); -+ break; -+ case (PH_PULL | REQUEST): -+ if (!st->l1.bcs->tx_skb) { -+ test_and_clear_bit(FLG_L1_PULL_REQ, -+ &st->l1.Flags); -+ st->l1.l1l2(st, PH_PULL | CONFIRM, NULL); -+ } else -+ test_and_set_bit(FLG_L1_PULL_REQ, -+ &st->l1.Flags); -+ break; -+ case (PH_ACTIVATE | REQUEST): -+ if (drv) { -+ test_and_set_bit(BC_FLG_ACTIV, -+ &st->l1.bcs->Flag); -+ mode_hfcusb(st->l1.bcs, st->l1.mode, -+ st->l1.bc); -+ l1_msg_b(st, pr, arg); -+ } -+ break; -+ case (PH_DEACTIVATE | REQUEST): -+ l1_msg_b(st, pr, arg); -+ break; -+ case (PH_DEACTIVATE | CONFIRM): -+ test_and_clear_bit(BC_FLG_ACTIV, -+ &st->l1.bcs->Flag); -+ test_and_clear_bit(BC_FLG_BUSY, &st->l1.bcs->Flag); -+ mode_hfcusb(st->l1.bcs, 0, st->l1.bc); -+ st->l1.l1l2(st, PH_DEACTIVATE | CONFIRM, NULL); -+ break; -+ } -+} -+ -+/******************************************/ -+/* deactivate B-channel access and queues */ -+/******************************************/ -+static void -+close_hfcusb(struct BCState *bcs) -+{ -+ mode_hfcusb(bcs, 0, bcs->channel); -+ if (test_and_clear_bit(BC_FLG_INIT, &bcs->Flag)) { -+ skb_queue_purge(&bcs->rqueue); -+ skb_queue_purge(&bcs->squeue); -+ if (bcs->tx_skb) { -+ dev_kfree_skb_any(bcs->tx_skb); -+ bcs->tx_skb = NULL; -+ test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag); -+ } -+ } -+} -+ -+/*************************************/ -+/* init B-channel queues and control */ -+/*************************************/ -+static int -+open_hfcusbstate(struct IsdnCardState *cs, struct BCState *bcs) -+{ -+ if (!test_and_set_bit(BC_FLG_INIT, &bcs->Flag)) { -+ skb_queue_head_init(&bcs->rqueue); -+ skb_queue_head_init(&bcs->squeue); -+ } -+ bcs->tx_skb = NULL; -+ test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag); -+ bcs->event = 0; -+ bcs->tx_cnt = 0; -+ return (0); -+} -+ -+/*********************************/ -+/* inits the stack for B-channel */ -+/*********************************/ -+static int -+setstack_2b(struct PStack *st, struct BCState *bcs) -+{ -+ bcs->channel = st->l1.bc; -+ if (open_hfcusbstate(st->l1.hardware, bcs)) -+ return (-1); -+ st->l1.bcs = bcs; -+ st->l2.l2l1 = hfcusb_b_l2l1; -+ setstack_manager(st); -+ bcs->st = st; -+ setstack_l1_B(st); -+ return (0); -+} -+ -+/********************************/ -+/* called for card init message */ -+/********************************/ -+void __devinit -+inithfcusb(struct IsdnCardState *cs) -+{ -+ cs->setstack_d = setstack_hfcusb; -+ cs->BC_Send_Data = &hfcusb_send_data; -+ cs->bcs[0].BC_SetStack = setstack_2b; -+ cs->bcs[1].BC_SetStack = setstack_2b; -+ cs->bcs[0].BC_Close = close_hfcusb; -+ cs->bcs[1].BC_Close = close_hfcusb; -+ mode_hfcusb(cs->bcs, 0, 0); -+ mode_hfcusb(cs->bcs + 1, 0, 1); -+} -+ -+ -+ -+/*******************************************/ -+/* handle card messages from control layer */ -+/*******************************************/ -+static int -+hfcusb_card_msg(struct IsdnCardState *cs, int mt, void *arg) -+{ -+ if (cs->debug & L1_DEB_ISAC) -+ debugl1(cs, "HFCUSB: card_msg %x", mt); -+ switch (mt) { -+ case CARD_INIT: -+ inithfcusb(cs); -+ return (0); -+ case CARD_RELEASE: -+ case CARD_RESET: -+ case CARD_TEST: -+ return (0); -+ } -+ return (0); -+} -+ -+ -+extern void -+ HiSax_closecard(int cardnr); -+/*****************************/ -+/* release a driver instance */ -+/* called when hardware is */ -+/* no longer present. */ -+/*****************************/ -+static void -+release_hfcdrv(void *arg) -+{ -+ struct IsdnCardState *cs = (struct IsdnCardState *) arg; -+ -+ cs->hw.hfcusb.drv = NULL; /* disable any further use of driver */ -+ HiSax_closecard(cs->cardnr); -+} /* release_hfcdrv */ -+ -+/*********************************************/ -+/* called once when a new device is detected */ -+/* initialises local data */ -+/*********************************************/ -+int -+setup_hfc_usb(struct IsdnCard *card) -+{ -+ struct IsdnCardState *cs = card->cs; -+ char tmp[64]; -+ struct hisax_drvreg *usbdrv = -+ (struct hisax_drvreg *) cs->hw.hfcusb.drv; -+ -+ if (!usbdrv) -+ return (0); /* no driver data present */ -+ -+ strcpy(tmp, hfcusb_revision); -+ printk(KERN_INFO "HiSax: HFC-USB driver Rev. %s\n", -+ HiSax_getrev(tmp)); -+ -+ usbdrv->release_driver = &release_hfcdrv; /* release routine */ -+ usbdrv->arg_hisax = (void *) cs; /* parameter for calling */ -+ usbdrv->dch_l1l2 = &hfcusb_d_l1l2; /* access from L1 to HiSax */ -+ usbdrv->bch_l1l2 = &hfcusb_b_l1l2; -+ usbdrv->drq = &cs->rq; -+ usbdrv->dsq = &cs->sq; -+ cs->cardmsg = &hfcusb_card_msg; -+ return (1); /* success */ -+} -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfcscard.c linux-2.4.29/drivers/isdn/hisax/hfcscard.c ---- linux-2.4.29.old/drivers/isdn/hisax/hfcscard.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hfcscard.c 2005-03-22 15:06:46.412037080 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hfcscard.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $ -+/* $Id: hfcscard.c,v 1.10 2001/09/24 13:22:56 kai Exp $ - * - * low level stuff for hfcs based cards (Teles3c, ACER P10) - * -@@ -12,14 +12,13 @@ - - #define __NO_VERSION__ - #include --#include - #include "hisax.h" - #include "hfc_2bds0.h" - #include "isdnl1.h" - - extern const char *CardType[]; - --static const char *hfcs_revision = "$Revision: 1.1.4.1 $"; -+static const char *hfcs_revision = "$Revision: 1.10 $"; - - static void - hfcs_interrupt(int intno, void *dev_id, struct pt_regs *regs) -@@ -140,36 +139,6 @@ - return(0); - } - --#ifdef __ISAPNP__ --static struct isapnp_device_id hfc_ids[] __initdata = { -- { ISAPNP_VENDOR('A', 'N', 'X'), ISAPNP_FUNCTION(0x1114), -- ISAPNP_VENDOR('A', 'N', 'X'), ISAPNP_FUNCTION(0x1114), -- (unsigned long) "Acer P10" }, -- { ISAPNP_VENDOR('B', 'I', 'L'), ISAPNP_FUNCTION(0x0002), -- ISAPNP_VENDOR('B', 'I', 'L'), ISAPNP_FUNCTION(0x0002), -- (unsigned long) "Billion 2" }, -- { ISAPNP_VENDOR('B', 'I', 'L'), ISAPNP_FUNCTION(0x0001), -- ISAPNP_VENDOR('B', 'I', 'L'), ISAPNP_FUNCTION(0x0001), -- (unsigned long) "Billion 1" }, -- { ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x7410), -- ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x7410), -- (unsigned long) "IStar PnP" }, -- { ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2610), -- ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2610), -- (unsigned long) "Teles 16.3c" }, -- { ISAPNP_VENDOR('S', 'F', 'M'), ISAPNP_FUNCTION(0x0001), -- ISAPNP_VENDOR('S', 'F', 'M'), ISAPNP_FUNCTION(0x0001), -- (unsigned long) "Tornado Tipa C" }, -- { ISAPNP_VENDOR('K', 'Y', 'E'), ISAPNP_FUNCTION(0x0001), -- ISAPNP_VENDOR('K', 'Y', 'E'), ISAPNP_FUNCTION(0x0001), -- (unsigned long) "Genius Speed Surfer" }, -- { 0, } --}; -- --static struct isapnp_device_id *hdev = &hfc_ids[0]; --static struct pci_bus *pnp_c __devinitdata = NULL; --#endif -- - int __init - setup_hfcs(struct IsdnCard *card) - { -@@ -178,46 +147,6 @@ - - strcpy(tmp, hfcs_revision); - printk(KERN_INFO "HiSax: HFC-S driver Rev. %s\n", HiSax_getrev(tmp)); -- --#ifdef __ISAPNP__ -- if (!card->para[1] && isapnp_present()) { -- struct pci_bus *pb; -- struct pci_dev *pd; -- -- while(hdev->card_vendor) { -- if ((pb = isapnp_find_card(hdev->card_vendor, -- hdev->card_device, pnp_c))) { -- pnp_c = pb; -- pd = NULL; -- if ((pd = isapnp_find_dev(pnp_c, -- hdev->vendor, hdev->function, pd))) { -- printk(KERN_INFO "HiSax: %s detected\n", -- (char *)hdev->driver_data); -- pd->prepare(pd); -- pd->deactivate(pd); -- pd->activate(pd); -- card->para[1] = pd->resource[0].start; -- card->para[0] = pd->irq_resource[0].start; -- if (!card->para[0] || !card->para[1]) { -- printk(KERN_ERR "HFC PnP:some resources are missing %ld/%lx\n", -- card->para[0], card->para[1]); -- pd->deactivate(pd); -- return(0); -- } -- break; -- } else { -- printk(KERN_ERR "HFC PnP: PnP error card found, no device\n"); -- } -- } -- hdev++; -- pnp_c=NULL; -- } -- if (!hdev->card_vendor) { -- printk(KERN_INFO "HFC PnP: no ISAPnP card found\n"); -- return(0); -- } -- } --#endif - cs->hw.hfcD.addr = card->para[1] & 0xfffe; - cs->irq = card->para[0]; - cs->hw.hfcD.cip = 0; -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hisax.h linux-2.4.29/drivers/isdn/hisax/hisax.h ---- linux-2.4.29.old/drivers/isdn/hisax/hisax.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hisax.h 2005-03-22 15:06:46.431034192 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hisax.h,v 1.1.4.2 2001/12/09 19:15:28 kai Exp $ -+/* $Id: hisax.h,v 2.64 2001/09/24 13:22:56 kai Exp $ - * - * Basic declarations, defines and prototypes - * -@@ -24,7 +24,9 @@ - #include - #include - #include -+#ifndef COMPAT_NO_SOFTNET - #include -+#endif - - #define ERROR_STATISTIC - -@@ -68,9 +70,6 @@ - #define DL_DATA 0x0220 - #define DL_FLUSH 0x0224 - #define DL_UNIT_DATA 0x0230 -- --#define MDL_BC_RELEASE 0x0278 // Formula-n enter:now --#define MDL_BC_ASSIGN 0x027C // Formula-n enter:now - #define MDL_ASSIGN 0x0280 - #define MDL_REMOVE 0x0284 - #define MDL_ERROR 0x0288 -@@ -472,8 +471,6 @@ - #define BC_FLG_FTI_RUN 13 - #define BC_FLG_LL_OK 14 - #define BC_FLG_LL_CONN 15 --#define BC_FLG_FTI_FTS 16 --#define BC_FLG_FRH_WAIT 17 - - #define L1_MODE_NULL 0 - #define L1_MODE_TRANS 1 -@@ -695,6 +692,13 @@ - struct timer_list timer; - }; - -+#ifdef CONFIG_HISAX_HFC_USB -+struct hfcUSB_hw { -+ void *drv; /* pointer to driver structure */ -+ int dch_tx_busy; -+}; -+#endif -+ - struct hfcSX_hw { - unsigned long base; - unsigned char cirm; -@@ -838,17 +842,6 @@ - int ph_state; - }; - --struct amd7930_chip { -- u_char lmr1; -- u_char ph_state; -- u_char old_state; -- u_char flg_t3; -- unsigned int tx_xmtlen; -- struct timer_list timer3; -- void (*ph_command) (struct IsdnCardState *, u_char, char *); -- void (*setIrqMask) (struct IsdnCardState *, u_char); --}; -- - struct icc_chip { - int ph_state; - u_char *mon_tx; -@@ -902,6 +895,9 @@ - struct njet_hw njet; - struct hfcD_hw hfcD; - struct hfcPCI_hw hfcpci; -+#ifdef CONFIG_HISAX_HFC_USB -+ struct hfcUSB_hw hfcusb; -+#endif - struct hfcSX_hw hfcsx; - struct ix1_hw niccy; - struct isurf_hw isurf; -@@ -945,7 +941,6 @@ - struct hfcpci_chip hfcpci; - struct hfcsx_chip hfcsx; - struct w6692_chip w6692; -- struct amd7930_chip amd7930; - struct icc_chip icc; - } dc; - u_char *rcvbuf; -@@ -967,6 +962,8 @@ - #define MON0_TX 4 - #define MON1_TX 8 - -+#define HISAX_MAX_CARDS 8 -+ - #define ISDN_CTYPE_16_0 1 - #define ISDN_CTYPE_8_0 2 - #define ISDN_CTYPE_16_3 3 -@@ -1006,8 +1003,8 @@ - #define ISDN_CTYPE_HFC_SX 37 - #define ISDN_CTYPE_NETJET_U 38 - #define ISDN_CTYPE_HFC_SP_PCMCIA 39 --#define ISDN_CTYPE_DYNAMIC 40 --#define ISDN_CTYPE_ENTERNOW 41 -+#define ISDN_CTYPE_HFC_USB 40 -+#define ISDN_CTYPE_DYNAMIC 41 - #define ISDN_CTYPE_COUNT 41 - - -@@ -1267,10 +1264,6 @@ - #define CARD_NETJET_U 0 - #endif - --#ifdef CONFIG_HISAX_ENTERNOW_PCI --#define CARD_FN_ENTERNOW_PCI 1 --#endif -- - #define TEI_PER_CARD 1 - - /* L1 Debug */ -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hisax_debug.h linux-2.4.29/drivers/isdn/hisax/hisax_debug.h ---- linux-2.4.29.old/drivers/isdn/hisax/hisax_debug.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hisax_debug.h 2005-03-22 15:06:46.452031000 +0100 -@@ -28,7 +28,7 @@ - - #define DBG(level, format, arg...) do { \ - if (level & __debug_variable) \ --printk(KERN_DEBUG "%s: " format "\n" , __FUNCTION__ , ## arg); \ -+printk(KERN_DEBUG __FUNCTION__ ": " format "\n" , ## arg); \ - } while (0) - - #define DBG_PACKET(level,data,count) \ -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hisax_fcpcipnp.c linux-2.4.29/drivers/isdn/hisax/hisax_fcpcipnp.c ---- linux-2.4.29.old/drivers/isdn/hisax/hisax_fcpcipnp.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hisax_fcpcipnp.c 2005-03-22 15:06:46.468028568 +0100 -@@ -20,22 +20,19 @@ - * - * o POWER PC - * o clean up debugging -- * o tx_skb at PH_DEACTIVATE time - */ - - #include - #include - #include - #include --#include -+#include "hisax_isapnp.h" - #include - #include - #include - #include -- --#include -- - #include "hisax_fcpcipnp.h" -+#include "hisax_isac.h" - - // debugging cruft - #define __debug_variable debug -@@ -46,10 +43,14 @@ - MODULE_PARM(debug, "i"); - #endif - --MODULE_AUTHOR("Kai Germaschewski /Karsten Keil "); -+MODULE_AUTHOR("Kai Germaschewski "); - MODULE_DESCRIPTION("AVM Fritz!PCI/PnP ISDN driver"); - --static struct pci_device_id fcpci_ids[] __devinitdata = { -+#ifndef PCI_DEVICE_ID_AVM_A1_V2 -+#define PCI_DEVICE_ID_AVM_A1_V2 0x0e00 -+#endif -+ -+static struct pci_device_id fcpci_ids[] __initdata = { - { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1 , PCI_ANY_ID, PCI_ANY_ID, - 0, 0, (unsigned long) "Fritz!Card PCI" }, - { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1_V2, PCI_ANY_ID, PCI_ANY_ID, -@@ -58,7 +59,7 @@ - }; - MODULE_DEVICE_TABLE(pci, fcpci_ids); - --static struct isapnp_device_id fcpnp_ids[] __devinitdata = { -+static struct isapnp_device_id fcpnp_ids[] __initdata = { - { ISAPNP_VENDOR('A', 'V', 'M'), ISAPNP_FUNCTION(0x0900), - ISAPNP_VENDOR('A', 'V', 'M'), ISAPNP_FUNCTION(0x0900), - (unsigned long) "Fritz!Card PnP" }, -@@ -68,7 +69,8 @@ - - static int protocol = 2; /* EURO-ISDN Default */ - MODULE_PARM(protocol, "i"); --MODULE_LICENSE("GPL"); -+ -+static LIST_HEAD(adapter_list); - - // ---------------------------------------------------------------------- - -@@ -147,7 +149,7 @@ - outb(idx, adapter->io + AVM_INDEX); - val = inb(adapter->io + AVM_DATA + (offset & 0xf)); - spin_unlock_irqrestore(&adapter->hw_lock, flags); -- DBG(0x1000, " port %#x, value %#x", -+ DBG(0x1000, __FUNCTION__ " port %#x, value %#x", - offset, val); - return val; - } -@@ -160,7 +162,7 @@ - AVM_IDX_ISAC_REG_HIGH : AVM_IDX_ISAC_REG_LOW; - unsigned long flags; - -- DBG(0x1000, " port %#x, value %#x", -+ DBG(0x1000, __FUNCTION__ " port %#x, value %#x", - offset, value); - spin_lock_irqsave(&adapter->hw_lock, flags); - outb(idx, adapter->io + AVM_INDEX); -@@ -240,7 +242,7 @@ - outl(offset, adapter->io + AVM_ISACSX_INDEX); - val = inl(adapter->io + AVM_ISACSX_DATA); - spin_unlock_irqrestore(&adapter->hw_lock, flags); -- DBG(0x1000, " port %#x, value %#x", -+ DBG(0x1000, __FUNCTION__ " port %#x, value %#x", - offset, val); - - return val; -@@ -252,7 +254,7 @@ - struct fritz_adapter *adapter = isac->priv; - unsigned long flags; - -- DBG(0x1000, " port %#x, value %#x", -+ DBG(0x1000, __FUNCTION__ " port %#x, value %#x", - offset, value); - spin_lock_irqsave(&adapter->hw_lock, flags); - outl(offset, adapter->io + AVM_ISACSX_INDEX); -@@ -375,6 +377,9 @@ - - DBG(0x40, "hdlc_fill_fifo"); - -+ if (!skb) -+ BUG(); -+ - if (skb->len == 0) - BUG(); - -@@ -515,7 +520,6 @@ - } - skb_push(bcs->tx_skb, bcs->tx_cnt); - bcs->tx_cnt = 0; -- hdlc_fill_fifo(bcs); - } - - static inline void hdlc_xpr_irq(struct fritz_bcs *bcs) -@@ -536,7 +540,7 @@ - dev_kfree_skb_irq(skb); - } - --static void hdlc_irq_one(struct fritz_bcs *bcs, u32 stat) -+static void hdlc_irq(struct fritz_bcs *bcs, u32 stat) - { - DBG(0x10, "ch%d stat %#x", bcs->channel, stat); - if (stat & HDLC_INT_RPR) { -@@ -553,7 +557,7 @@ - } - } - --static inline void hdlc_irq(struct fritz_adapter *adapter) -+static inline void hdlc_interrupt(struct fritz_adapter *adapter) - { - int nr; - u32 stat; -@@ -562,7 +566,7 @@ - stat = adapter->read_hdlc_status(adapter, nr); - DBG(0x10, "HDLC %c stat %#x", 'A' + nr, stat); - if (stat & HDLC_INT_MASK) -- hdlc_irq_one(&adapter->bcs[nr], stat); -+ hdlc_irq(&adapter->bcs[nr], stat); - } - } - -@@ -584,14 +588,14 @@ - adapter->write_ctrl(bcs, 5); - break; - case L1_MODE_TRANS: -+ bcs->ctrl.sr.mode = HDLC_MODE_TRANS; -+ adapter->write_ctrl(bcs, 5); -+ bcs->ctrl.sr.cmd = HDLC_CMD_XRS; -+ adapter->write_ctrl(bcs, 1); -+ bcs->ctrl.sr.cmd = 0; -+ break; - case L1_MODE_HDLC: -- bcs->rcvidx = 0; -- bcs->tx_cnt = 0; -- bcs->tx_skb = NULL; -- if (mode == L1_MODE_TRANS) -- bcs->ctrl.sr.mode = HDLC_MODE_TRANS; -- else -- bcs->ctrl.sr.mode = HDLC_MODE_ITF_FLG; -+ bcs->ctrl.sr.mode = HDLC_MODE_ITF_FLG; - adapter->write_ctrl(bcs, 5); - bcs->ctrl.sr.cmd = HDLC_CMD_XRS; - adapter->write_ctrl(bcs, 1); -@@ -645,10 +649,10 @@ - return; - DBG(2, "STATUS0 %#x", val); - if (val & AVM_STATUS0_IRQ_ISAC) -- isacsx_irq(&adapter->isac); -+ isacsx_interrupt(&adapter->isac); - - if (val & AVM_STATUS0_IRQ_HDLC) -- hdlc_irq(adapter); -+ hdlc_interrupt(adapter); - } - - static void fcpci_irq(int intno, void *dev, struct pt_regs *regs) -@@ -662,10 +666,10 @@ - return; - DBG(2, "sval %#x", sval); - if (!(sval & AVM_STATUS0_IRQ_ISAC)) -- isac_irq(&adapter->isac); -+ isac_interrupt(&adapter->isac); - - if (!(sval & AVM_STATUS0_IRQ_HDLC)) -- hdlc_irq(adapter); -+ hdlc_interrupt(adapter); - } - - // ---------------------------------------------------------------------- -@@ -681,11 +685,6 @@ - { - outb(AVM_STATUS0_DIS_TIMER | AVM_STATUS0_RES_TIMER | - AVM_STATUS0_ENA_IRQ, adapter->io + AVM_STATUS0); -- -- outb(AVM_STATUS1_ENA_IOM | adapter->irq, -- adapter->io + AVM_STATUS1); -- set_current_state(TASK_UNINTERRUPTIBLE); -- schedule_timeout(50*HZ / 1000); /* Timeout 50ms */ - } - - // ---------------------------------------------------------------------- -@@ -693,6 +692,7 @@ - static int __devinit fcpcipnp_setup(struct fritz_adapter *adapter) - { - u32 val = 0; -+ struct pci_dev *pdev = adapter->pci_dev; - int retval; - - DBG(1,""); -@@ -700,21 +700,21 @@ - isac_init(&adapter->isac); // FIXME is this okay now - - retval = -EBUSY; -- if (!request_region(adapter->io, 32, "fcpcipnp")) -+ if (!request_region(adapter->io, 32, "hisax_fcpcipnp")) - goto err; - - switch (adapter->type) { - case AVM_FRITZ_PCIV2: -- retval = request_irq(adapter->irq, fcpci2_irq, SA_SHIRQ, -- "fcpcipnp", adapter); -+ retval = request_irq(pdev->irq, fcpci2_irq, SA_SHIRQ, -+ "hisax_fcpcipnp", adapter); - break; - case AVM_FRITZ_PCI: -- retval = request_irq(adapter->irq, fcpci_irq, SA_SHIRQ, -- "fcpcipnp", adapter); -+ retval = request_irq(pdev->irq, fcpci_irq, SA_SHIRQ, -+ "hisax_fcpcipnp", adapter); - break; - case AVM_FRITZ_PNP: -- retval = request_irq(adapter->irq, fcpci_irq, 0, -- "fcpcipnp", adapter); -+ retval = request_irq(pdev->irq, fcpci_irq, 0, -+ "hisax_fcpcipnp", adapter); - break; - } - if (retval) -@@ -808,11 +808,23 @@ - - static void __devexit fcpcipnp_release(struct fritz_adapter *adapter) - { -+ struct pci_dev *pdev = adapter->pci_dev; -+ - DBG(1,""); - - outb(0, adapter->io + AVM_STATUS0); -- free_irq(adapter->irq, adapter); -+ free_irq(pdev->irq, adapter); - release_region(adapter->io, 32); -+ -+ switch (adapter->type) { -+ case AVM_FRITZ_PCI: -+ case AVM_FRITZ_PCIV2: -+ pci_disable_device(pdev); -+ break; -+ case AVM_FRITZ_PNP: -+ pdev->deactivate(pdev); -+ break; -+ } - } - - // ---------------------------------------------------------------------- -@@ -830,6 +842,8 @@ - - memset(adapter, 0, sizeof(struct fritz_adapter)); - -+ adapter->pci_dev = pdev; -+ - SET_MODULE_OWNER(&adapter->isac.hisax_d_if); - adapter->isac.hisax_d_if.ifc.priv = &adapter->isac; - adapter->isac.hisax_d_if.ifc.l2l1 = isac_d_l2l1; -@@ -840,6 +854,7 @@ - adapter->bcs[i].b_if.ifc.priv = &adapter->bcs[i]; - adapter->bcs[i].b_if.ifc.l2l1 = fritz_b_l2l1; - } -+ list_add(&adapter->list, &adapter_list); - - pci_set_drvdata(pdev, adapter); - -@@ -854,6 +869,7 @@ - static void delete_adapter(struct fritz_adapter *adapter) - { - hisax_unregister(&adapter->isac.hisax_d_if); -+ list_del(&adapter->list); - kfree(adapter); - } - -@@ -863,12 +879,15 @@ - struct fritz_adapter *adapter; - int retval; - -+ printk(KERN_INFO "hisax_fcpcipnp: found adapter %s at %s\n", -+ (char *) ent->driver_data, pdev->slot_name); -+ - retval = -ENOMEM; - adapter = new_adapter(pdev); - if (!adapter) - goto err; - -- if (pdev->device == PCI_DEVICE_ID_AVM_A1_V2) -+ if (pdev->device == 0x0e00) - adapter->type = AVM_FRITZ_PCIV2; - else - adapter->type = AVM_FRITZ_PCI; -@@ -876,12 +895,7 @@ - retval = pci_enable_device(pdev); - if (retval) - goto err_free; -- - adapter->io = pci_resource_start(pdev, 1); -- adapter->irq = pdev->irq; -- -- printk(KERN_INFO "hisax_fcpcipnp: found adapter %s at %s\n", -- (char *) ent->driver_data, pdev->slot_name); - - retval = fcpcipnp_setup(adapter); - if (retval) -@@ -901,6 +915,9 @@ - struct fritz_adapter *adapter; - int retval; - -+ printk(KERN_INFO "hisax_fcpcipnp: found adapter %s\n", -+ (char *) ent->driver_data); -+ - retval = -ENOMEM; - adapter = new_adapter(pdev); - if (!adapter) -@@ -912,11 +929,8 @@ - pdev->deactivate(pdev); // why? - pdev->activate(pdev); - adapter->io = pdev->resource[0].start; -- adapter->irq = pdev->irq_resource[0].start; -- -- printk(KERN_INFO "hisax_fcpcipnp: found adapter %s at IO %#x irq %d\n", -- (char *) ent->driver_data, adapter->io, adapter->irq); -- -+ pdev->irq = pdev->irq_resource[0].start; -+ - retval = fcpcipnp_setup(adapter); - if (retval) - goto err_free; -@@ -929,43 +943,35 @@ - return retval; - } - --static void __devexit fcpci_remove(struct pci_dev *pdev) --{ -- struct fritz_adapter *adapter = pci_get_drvdata(pdev); -- -- fcpcipnp_release(adapter); -- pci_disable_device(pdev); -- delete_adapter(adapter); --} -- --static void __devexit fcpnp_remove(struct pci_dev *pdev) -+static void __devexit fcpcipnp_remove(struct pci_dev *pdev) - { - struct fritz_adapter *adapter = pci_get_drvdata(pdev); - - fcpcipnp_release(adapter); -- pdev->deactivate(pdev); - delete_adapter(adapter); - } - - static struct pci_driver fcpci_driver = { -- name: "fcpci", -- probe: fcpci_probe, -- remove: __devexit_p(fcpci_remove), -+ name: "fcpci", -+ probe: fcpci_probe, -+ remove: fcpcipnp_remove, - id_table: fcpci_ids, - }; - - static struct isapnp_driver fcpnp_driver = { -- name: "fcpnp", -- probe: fcpnp_probe, -- remove: __devexit_p(fcpnp_remove), -+ name: "fcpnp", -+ probe: fcpnp_probe, -+ remove: fcpcipnp_remove, - id_table: fcpnp_ids, - }; - --static int __init hisax_fcpcipnp_init(void) -+static LIST_HEAD(isapnp_drivers); -+ -+static int __init hisax_fcpci_init(void) - { - int retval, pci_nr_found; - -- printk(KERN_INFO "hisax_fcpcipnp: Fritz!Card PCI/PCIv2/PnP ISDN driver v0.0.1\n"); -+ printk(KERN_INFO "hisax_fcpcipnp: Fritz!PCI/PnP ISDN driver v0.0.1\n"); - - retval = pci_register_driver(&fcpci_driver); - if (retval < 0) -@@ -976,15 +982,14 @@ - if (retval < 0) - goto out_unregister_pci; - --#if !defined(CONFIG_HOTPLUG) || defined(MODULE) -+#if !defined(CONFIG_HOTPLUG) && defined(MODULE) - if (pci_nr_found + retval == 0) { - retval = -ENODEV; - goto out_unregister_isapnp; -- } - #endif - return 0; - --#if !defined(CONFIG_HOTPLUG) || defined(MODULE) -+#if !defined(CONFIG_HOTPLUG) && defined(MODULE) - out_unregister_isapnp: - isapnp_unregister_driver(&fcpnp_driver); - #endif -@@ -994,11 +999,15 @@ - return retval; - } - --static void __exit hisax_fcpcipnp_exit(void) -+static void __exit hisax_fcpci_exit(void) - { - isapnp_unregister_driver(&fcpnp_driver); - pci_unregister_driver(&fcpci_driver); - } - --module_init(hisax_fcpcipnp_init); --module_exit(hisax_fcpcipnp_exit); -+module_init(hisax_fcpci_init); -+module_exit(hisax_fcpci_exit); -+ -+#ifdef __ISAPNP__ -+#include "hisax_isapnp.c" -+#endif -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hisax_fcpcipnp.h linux-2.4.29/drivers/isdn/hisax/hisax_fcpcipnp.h ---- linux-2.4.29.old/drivers/isdn/hisax/hisax_fcpcipnp.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hisax_fcpcipnp.h 2005-03-22 15:06:46.484026136 +0100 -@@ -43,10 +43,12 @@ - }; - - struct fritz_adapter { -+ struct list_head list; -+ struct pci_dev *pci_dev; -+ - int type; - spinlock_t hw_lock; - unsigned int io; -- unsigned int irq; - struct isac isac; - - struct fritz_bcs bcs[2]; -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hisax_isac.c linux-2.4.29/drivers/isdn/hisax/hisax_isac.c ---- linux-2.4.29.old/drivers/isdn/hisax/hisax_isac.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hisax_isac.c 2005-03-22 15:06:46.543017168 +0100 -@@ -34,7 +34,7 @@ - static int debug = 1; - MODULE_PARM(debug, "i"); - --static char *ISACVer[] = { -+static char *ISACVer[] __devinitdata = { - "2086/2186 V1.1", - "2085 B1", - "2085 B2", -@@ -42,10 +42,6 @@ - }; - #endif - --MODULE_AUTHOR("Kai Germaschewski /Karsten Keil "); --MODULE_DESCRIPTION("ISAC/ISAC-SX driver"); --MODULE_LICENSE("GPL"); -- - #define DBG_WARN 0x0001 - #define DBG_IRQ 0x0002 - #define DBG_L1M 0x0004 -@@ -438,7 +434,7 @@ - va_end(args); - } - --static void isac_version(struct isac *cs) -+static void __devinit isac_version(struct isac *cs) - { - int val; - -@@ -602,7 +598,7 @@ - } - } - --void isac_irq(struct isac *isac) -+void isac_interrupt(struct isac *isac) - { - unsigned char val; - -@@ -635,8 +631,6 @@ - if (val & ISAC_ISTA_SIN) { - DBG(DBG_WARN, "SIN"); - } -- isac->write_isac(isac, ISAC_MASK, 0xff); -- isac->write_isac(isac, ISAC_MASK, 0x00); - } - - // ====================================================================== -@@ -742,7 +736,7 @@ - } - } - --void isacsx_irq(struct isac *isac) -+void isacsx_interrupt(struct isac *isac) - { - unsigned char val; - -@@ -755,7 +749,7 @@ - isacsx_cic_interrupt(isac); - } - --void isac_init(struct isac *isac) -+void __devinit isac_init(struct isac *isac) - { - isac->tx_skb = NULL; - isac->l1m.fsm = &l1fsm; -@@ -770,7 +764,7 @@ - FsmInitTimer(&isac->l1m, &isac->timer); - } - --void isac_setup(struct isac *isac) -+void __devinit isac_setup(struct isac *isac) - { - int val, eval; - -@@ -781,7 +775,7 @@ - - isac->write_isac(isac, ISAC_MASK, 0xff); - isac->mocr = 0xaa; -- if (test_bit(ISAC_IOM1, &isac->flags)) { -+ if (test_bit(HW_IOM1, &isac->flags)) { - /* IOM 1 Mode */ - isac->write_isac(isac, ISAC_ADF2, 0x0); - isac->write_isac(isac, ISAC_SPCR, 0xa); -@@ -817,7 +811,7 @@ - FsmEvent(&isac->l1m, (val >> 2) & 0xf, NULL); - - isac->write_isac(isac, ISAC_MASK, 0x0); -- // RESET Receiver and Transmitter -+ /* RESET Receiver and Transmitter */ - isac->write_isac(isac, ISAC_CMDR, ISAC_CMDR_XRES | ISAC_CMDR_RRES); - } - -@@ -888,10 +882,10 @@ - EXPORT_SYMBOL(isac_d_l2l1); - - EXPORT_SYMBOL(isacsx_setup); --EXPORT_SYMBOL(isacsx_irq); -+EXPORT_SYMBOL(isacsx_interrupt); - - EXPORT_SYMBOL(isac_setup); --EXPORT_SYMBOL(isac_irq); -+EXPORT_SYMBOL(isac_interrupt); - - module_init(hisax_isac_init); - module_exit(hisax_isac_exit); -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hisax_isac.h linux-2.4.29/drivers/isdn/hisax/hisax_isac.h ---- linux-2.4.29.old/drivers/isdn/hisax/hisax_isac.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hisax_isac.h 2005-03-22 15:06:46.559014736 +0100 -@@ -8,7 +8,7 @@ - #define TIMER3_VALUE 7000 - #define MAX_DFRAME_LEN_L1 300 - --#define ISAC_IOM1 0 -+#define HW_IOM1 0 - - struct isac { - void *priv; -@@ -37,9 +37,9 @@ - void isac_d_l2l1(struct hisax_if *hisax_d_if, int pr, void *arg); - - void isac_setup(struct isac *isac); --void isac_irq(struct isac *isac); -+void isac_interrupt(struct isac *isac); - - void isacsx_setup(struct isac *isac); --void isacsx_irq(struct isac *isac); -+void isacsx_interrupt(struct isac *isac); - - #endif -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hisax_isapnp.c linux-2.4.29/drivers/isdn/hisax/hisax_isapnp.c ---- linux-2.4.29.old/drivers/isdn/hisax/hisax_isapnp.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hisax_isapnp.c 2005-03-22 15:06:46.576012152 +0100 -@@ -0,0 +1,105 @@ -+// FIXME copied -+static const struct isapnp_device_id * -+isapnp_match_device(const struct isapnp_device_id *ids, struct pci_dev *dev) -+{ -+ DBG(1,""); -+ -+ while (ids->card_vendor || ids->card_device) { -+ if ((ids->card_vendor == ISAPNP_ANY_ID || ids->card_vendor == dev->bus->vendor) && -+ (ids->card_device == ISAPNP_ANY_ID || ids->card_device == dev->bus->device) && -+ (ids->vendor == ISAPNP_ANY_ID || ids->vendor == dev->vendor) && -+ (ids->function == ISAPNP_ANY_ID || ids->function == dev->device)) -+ return ids; -+ ids++; -+ } -+ return NULL; -+} -+ -+/** -+ * pci_dev_driver - get the pci_driver of a device -+ * @dev: the device to query -+ * -+ * Returns the appropriate pci_driver structure or %NULL if there is no -+ * registered driver for the device. -+ */ -+struct pci_driver *isapnp_dev_driver(const struct pci_dev *dev) -+{ -+ return dev->driver; -+} -+ -+static int isapnp_announce_device(struct isapnp_driver *drv, struct pci_dev *dev) -+{ -+ const struct isapnp_device_id *id; -+ int ret = 0; -+ -+ DBG(1,""); -+ -+ if (drv->id_table) { -+ id = isapnp_match_device(drv->id_table, dev); -+ if (!id) { -+ ret = 0; -+ goto out; -+ } -+ } else -+ id = NULL; -+ -+// dev_probe_lock(); -+ if (drv->probe(dev, id) >= 0) { -+ dev->driver = (struct pci_driver *) drv; -+ ret = 1; -+ } -+// dev_probe_unlock(); -+out: -+ return ret; -+} -+ -+/** -+ * FIXME pci_register_driver - register a new pci driver -+ * @drv: the driver structure to register -+ * -+ * Adds the driver structure to the list of registered drivers -+ * Returns the number of pci devices which were claimed by the driver -+ * during registration. The driver remains registered even if the -+ * return value is zero. -+ */ -+int isapnp_register_driver(struct isapnp_driver *drv) -+{ -+ struct pci_dev *dev; -+ int count = 0; -+ -+ DBG(1,""); -+ -+ list_add_tail(&drv->node, &isapnp_drivers); -+ isapnp_for_each_dev(dev) { -+ if (!isapnp_dev_driver(dev)) -+ count += isapnp_announce_device(drv, dev); -+ } -+ return count; -+} -+ -+/** -+ * pci_unregister_driver - unregister a pci driver -+ * @drv: the driver structure to unregister -+ * -+ * Deletes the driver structure from the list of registered PCI drivers, -+ * gives it a chance to clean up by calling its remove() function for -+ * each device it was responsible for, and marks those devices as -+ * driverless. -+ */ -+ -+void isapnp_unregister_driver(struct isapnp_driver *drv) -+{ -+ struct pci_dev *dev; -+ -+ DBG(1,""); -+ -+ list_del(&drv->node); -+ isapnp_for_each_dev(dev) { -+ if (dev->driver == (struct pci_driver *) drv) { -+ if (drv->remove) -+ drv->remove(dev); -+ dev->driver = NULL; -+ } -+ } -+} -+ -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hisax_isapnp.h linux-2.4.29/drivers/isdn/hisax/hisax_isapnp.h ---- linux-2.4.29.old/drivers/isdn/hisax/hisax_isapnp.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hisax_isapnp.h 2005-03-22 15:06:46.590010024 +0100 -@@ -0,0 +1,33 @@ -+#ifndef __HISAX_ISAPNP_H__ -+#define __HISAX_ISAPNP_H__ -+ -+#include -+ -+#ifdef COMPAT_NEED_ISAPNP_DRIVER -+struct isapnp_driver { -+ struct list_head node; -+ char *name; -+ const struct isapnp_device_id *id_table; /* NULL if wants all devices */ -+ int (*probe) (struct pci_dev *dev, const struct isapnp_device_id *id); /* New device inserted */ -+ void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ -+}; -+#endif -+#ifdef __ISAPNP__ -+ -+int isapnp_register_driver(struct isapnp_driver *drv); -+void isapnp_unregister_driver(struct isapnp_driver *drv); -+ -+#else -+ -+static inline int isapnp_register_driver(struct isapnp_driver *drv) -+{ -+ return 0; -+} -+ -+static inline void isapnp_unregister_driver(struct isapnp_driver *drv) -+{ -+} -+ -+#endif -+ -+#endif -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hisax_loadable.h linux-2.4.29/drivers/isdn/hisax/hisax_loadable.h ---- linux-2.4.29.old/drivers/isdn/hisax/hisax_loadable.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hisax_loadable.h 2005-03-22 15:06:46.606007592 +0100 -@@ -0,0 +1,74 @@ -+/* $Id: hisax_loadable.h,v 2.1 2001/06/08 22:19:16 werner Exp $ -+ * -+ * -+ * Author (C) 2001 Werner Cornelius (werner@isdn-development.de) -+ * modular driver for Colognechip HFC-USB chip -+ * as plugin for HiSax isdn driver -+ * -+ * Copyright 2001 by Werner Cornelius (werner@isdn4linux.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, 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 -+ -+/***************************************/ -+/* additional defines for l1 constants */ -+/***************************************/ -+#define B1_DATA 0x1f0 -+#define B1_SETMODE 0x1f4 -+#define B2_DATA 0x1f8 -+#define B2_SETMODE 0x1fc -+ -+ -+/********************************************************/ -+/* structure used for register and release of L1 driver */ -+/********************************************************/ -+struct hisax_drvreg { -+ int version; /* actual version for check */ -+ int cmd; /* command code */ -+ -+ /* function pointers set by hisax during register call */ -+ void (*release_driver) (void *arg_hisax); /* set by hisax, release function for driver */ -+ void (*dch_l1l2) (void *arg_hisax, int pr, void *arg); /* set by hisax, notify dch+l1 events */ -+ void (*bch_l1l2) (void *arg_hisax, int chan, int pr, void *arg); /* set by hisax, notify bch events */ -+ void *arg_hisax; /* argument when calling hisax main */ -+ struct sk_buff_head *drq; /* pointer to D-receive queue */ -+ struct sk_buff_head *dsq; /* pointer to D-send queue */ -+ struct sk_buff_head erq; /* E-receive queue */ -+ struct sk_buff_head *brq[2]; /* pointer to B-receive queues */ -+ struct sk_buff **bsk[2]; /* pointer to B-transmit buffer */ -+ -+ /* function pointers set by l1 driver before calling the register function */ -+ void (*dch_l2l1) (void *argl1, int pr, void *arg); /* function dch+l1 from hisax -> l1 */ -+ void (*bch_l2l1) (void *argl1, int chan, int pr, void *arg); /* function bch from hisax -> l1 */ -+ void *argl1; /* pointer to l1 data structure when calling l1 */ -+ -+ char *drvname; /* driver name for hisax usage */ -+}; -+ -+/**************************/ -+/* constants and commands */ -+/**************************/ -+#define HISAX_LOAD_VERSION 4 /* change when interface changes */ -+#define HISAX_LOAD_CHKVER 0 /* check version command (returns 0 on success) */ -+#define HISAX_LOAD_REGISTER 1 /* register the L1 driver and return 0 on success */ -+ -+/***************************************/ -+/* definition of the register function */ -+/***************************************/ -+extern int hisax_register_hfcusb(struct hisax_drvreg *l1drv); -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hscx.c linux-2.4.29/drivers/isdn/hisax/hscx.c ---- linux-2.4.29.old/drivers/isdn/hisax/hscx.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hscx.c 2005-03-22 15:06:46.621005312 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hscx.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: hscx.c,v 1.24 2001/09/24 13:22:56 kai Exp $ - * - * HSCX specific routines - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hscx.h linux-2.4.29/drivers/isdn/hisax/hscx.h ---- linux-2.4.29.old/drivers/isdn/hisax/hscx.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hscx.h 2005-03-22 15:06:46.640002424 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hscx.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: hscx.h,v 1.8 2001/09/24 13:22:56 kai Exp $ - * - * HSCX specific defines - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hscx_irq.c linux-2.4.29/drivers/isdn/hisax/hscx_irq.c ---- linux-2.4.29.old/drivers/isdn/hisax/hscx_irq.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/hscx_irq.c 2005-03-22 15:06:46.655999992 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hscx_irq.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: hscx_irq.c,v 1.18 2001/09/24 13:22:56 kai Exp $ - * - * low level b-channel stuff for Siemens HSCX - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/icc.c linux-2.4.29/drivers/isdn/hisax/icc.c ---- linux-2.4.29.old/drivers/isdn/hisax/icc.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/icc.c 2005-03-22 15:06:46.672997408 +0100 -@@ -1,4 +1,4 @@ --/* $Id: icc.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: icc.c,v 1.8 2001/09/24 13:22:56 kai Exp $ - * - * ICC specific routines - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/icc.h linux-2.4.29/drivers/isdn/hisax/icc.h ---- linux-2.4.29.old/drivers/isdn/hisax/icc.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/icc.h 2005-03-22 15:06:46.687995128 +0100 -@@ -1,4 +1,4 @@ --/* $Id: icc.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: icc.h,v 1.4 2001/09/24 13:22:56 kai Exp $ - * - * ICC specific routines - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/ipac.h linux-2.4.29/drivers/isdn/hisax/ipac.h ---- linux-2.4.29.old/drivers/isdn/hisax/ipac.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/ipac.h 2005-03-22 15:06:46.702992848 +0100 -@@ -1,4 +1,4 @@ --/* $Id: ipac.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: ipac.h,v 1.7 2001/09/24 13:22:56 kai Exp $ - * - * IPAC specific defines - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isac.c linux-2.4.29/drivers/isdn/hisax/isac.c ---- linux-2.4.29.old/drivers/isdn/hisax/isac.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/isac.c 2005-03-22 15:06:46.844971264 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isac.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: isac.c,v 1.31 2001/09/24 13:22:56 kai Exp $ - * - * ISAC specific routines - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isac.h linux-2.4.29/drivers/isdn/hisax/isac.h ---- linux-2.4.29.old/drivers/isdn/hisax/isac.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/isac.h 2005-03-22 15:06:47.111930680 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isac.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: isac.h,v 1.9 2001/09/24 13:22:56 kai Exp $ - * - * ISAC specific defines - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isar.c linux-2.4.29/drivers/isdn/hisax/isar.c ---- linux-2.4.29.old/drivers/isdn/hisax/isar.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/isar.c 2005-03-22 15:06:47.302901648 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isar.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: isar.c,v 1.22 2001/09/23 12:00:05 keil Exp $ - * - * isar.c ISAR (Siemens PSB 7110) specific routines - * -@@ -21,12 +21,10 @@ - #define DLE 0x10 - #define ETX 0x03 - --#define FAXMODCNT 13 --const u_char faxmodulation[] = {3,24,48,72,73,74,96,97,98,121,122,145,146}; --static u_int modmask = 0x1fff; --static int frm_extra_delay = 2; --static int para_TOA = 6; --const u_char *FC1_CMD[] = {"FAE", "FTS", "FRS", "FTM", "FRM", "FTH", "FRH", "CTRL" }; -+ -+const u_char faxmodulation_s[] = "3,24,48,72,73,74,96,97,98,121,122,145,146"; -+const u_char faxmodulation[] = {3,24,48,72,73,74,96,97,98,121,122,145,146}; -+#define FAXMODCNT 13 - - void isar_setup(struct IsdnCardState *cs); - static void isar_pump_cmd(struct BCState *bcs, u_char cmd, u_char para); -@@ -127,7 +125,7 @@ - ireg->clsb = cs->BC_Read_Reg(cs, 1, ISAR_CTRL_L); - #if DUMP_MBOXFRAME - if (cs->debug & L1_DEB_HSCX) -- debugl1(cs, "irq_stat(%02x,%02x,%d)", ireg->iis, ireg->cmsb, -+ debugl1(cs, "rcv_mbox(%02x,%02x,%d)", ireg->iis, ireg->cmsb, - ireg->clsb); - #endif - } -@@ -414,7 +412,6 @@ - } - cs->debug = debug; - isar_setup(cs); -- - ret = 0; - reterrflg: - restore_flags(flags); -@@ -428,21 +425,6 @@ - return(ret); - } - --static inline void --ll_deliver_faxstat(struct BCState *bcs, u_char status) --{ -- isdn_ctrl ic; -- struct Channel *chanp = (struct Channel *) bcs->st->lli.userdata; -- -- if (bcs->cs->debug & L1_DEB_HSCX) -- debugl1(bcs->cs, "HL->LL FAXIND %x", status); -- ic.driver = bcs->cs->myid; -- ic.command = ISDN_STAT_FAXIND; -- ic.arg = chanp->chan; -- ic.parm.aux.cmd = status; -- bcs->cs->iif.statcallb(&ic); --} -- - extern void BChannel_bh(struct BCState *); - #define B_LL_NOCARRIER 8 - #define B_LL_CONNECT 9 -@@ -599,6 +581,7 @@ - if (ireg->cmsb & SART_NMD) { /* ABORT */ - if (cs->debug & L1_DEB_WARN) - debugl1(cs, "isar_rcv_frame: no more data"); -+ cs->BC_Write_Reg(cs, 1, ISAR_IIA, 0); - bcs->hw.isar.rcvidx = 0; - send_DLE_ETX(bcs); - sendmsg(cs, SET_DPS(bcs->hw.isar.dpath) | -@@ -609,6 +592,7 @@ - } - } else { - printk(KERN_WARNING "HiSax: skb out of memory\n"); -+ cs->BC_Write_Reg(cs, 1, ISAR_IIA, 0); - } - break; - } -@@ -633,9 +617,8 @@ - bcs->hw.isar.rcvidx = 0; - cs->BC_Write_Reg(cs, 1, ISAR_IIA, 0); - } else { -- if (ireg->cmsb & HDLC_FSD) { -+ if (ireg->cmsb & HDLC_FSD) - bcs->hw.isar.rcvidx = 0; -- } - ptr = bcs->hw.isar.rcvbuf + bcs->hw.isar.rcvidx; - bcs->hw.isar.rcvidx += ireg->clsb; - rcv_mbox(cs, ireg, ptr); -@@ -646,8 +629,6 @@ - if (cs->debug & L1_DEB_WARN) - debugl1(cs, "isar frame to short %d", - bcs->hw.isar.rcvidx); -- printk(KERN_WARNING "ISAR: frame to short %d\n", -- bcs->hw.isar.rcvidx); - } else if (!(skb = dev_alloc_skb(bcs->hw.isar.rcvidx))) { - printk(KERN_WARNING "ISAR: receive out of memory\n"); - } else { -@@ -658,7 +639,6 @@ - isar_sched_event(bcs, B_RCVBUFREADY); - send_DLE_ETX(bcs); - isar_sched_event(bcs, B_LL_OK); -- test_and_clear_bit(BC_FLG_FRH_WAIT, &bcs->Flag); - } - bcs->hw.isar.rcvidx = 0; - } -@@ -666,14 +646,13 @@ - if (ireg->cmsb & SART_NMD) { /* ABORT */ - if (cs->debug & L1_DEB_WARN) - debugl1(cs, "isar_rcv_frame: no more data"); -+ cs->BC_Write_Reg(cs, 1, ISAR_IIA, 0); - bcs->hw.isar.rcvidx = 0; -+ send_DLE_ETX(bcs); - sendmsg(cs, SET_DPS(bcs->hw.isar.dpath) | - ISAR_HIS_PUMPCTRL, PCTRL_CMD_ESC, 0, NULL); - bcs->hw.isar.state = STFAX_ESCAPE; -- if (test_and_clear_bit(BC_FLG_FRH_WAIT, &bcs->Flag)) { -- send_DLE_ETX(bcs); -- isar_sched_event(bcs, B_LL_NOCARRIER); -- } -+ isar_sched_event(bcs, B_LL_NOCARRIER); - } - break; - default: -@@ -977,6 +956,21 @@ - } - } - -+static inline void -+ll_deliver_faxstat(struct BCState *bcs, u_char status) -+{ -+ isdn_ctrl ic; -+ struct Channel *chanp = (struct Channel *) bcs->st->lli.userdata; -+ -+ if (bcs->cs->debug & L1_DEB_HSCX) -+ debugl1(bcs->cs, "HL->LL FAXIND %x", status); -+ ic.driver = bcs->cs->myid; -+ ic.command = ISDN_STAT_FAXIND; -+ ic.arg = chanp->chan; -+ ic.parm.aux.cmd = status; -+ bcs->cs->iif.statcallb(&ic); -+} -+ - static void - isar_pump_statev_fax(struct BCState *bcs, u_char devt) { - struct IsdnCardState *cs = bcs->cs; -@@ -1081,22 +1075,19 @@ - if (cs->debug & L1_DEB_HSCX) - debugl1(cs, "pump stev RSP_DISC"); - if (bcs->hw.isar.state == STFAX_ESCAPE) { -- p1 = 5; - switch(bcs->hw.isar.newcmd) { - case 0: - bcs->hw.isar.state = STFAX_READY; - break; -- case PCTRL_CMD_FTM: -- p1 = 2; - case PCTRL_CMD_FTH: -+ case PCTRL_CMD_FTM: -+ p1 = 10; - sendmsg(cs, dps | ISAR_HIS_PUMPCTRL, - PCTRL_CMD_SILON, 1, &p1); - bcs->hw.isar.state = STFAX_SILDET; - break; -- case PCTRL_CMD_FRM: -- if (frm_extra_delay) -- mdelay(frm_extra_delay); - case PCTRL_CMD_FRH: -+ case PCTRL_CMD_FRM: - p1 = bcs->hw.isar.mod = bcs->hw.isar.newmod; - bcs->hw.isar.newmod = 0; - bcs->hw.isar.cmd = bcs->hw.isar.newcmd; -@@ -1215,9 +1206,6 @@ - isar_pump_statev_modem(bcs, ireg->cmsb); - } else if (bcs->mode == L1_MODE_FAX) { - isar_pump_statev_fax(bcs, ireg->cmsb); -- } else if (ireg->cmsb == PSEV_10MS_TIMER) { -- if (cs->debug & L1_DEB_HSCX) -- debugl1(cs, "pump stev TIMER"); - } else { - if (cs->debug & L1_DEB_WARN) - debugl1(cs, "isar IIS_PSTEV pmode %d stat %x", -@@ -1278,9 +1266,6 @@ - if (test_and_clear_bit(BC_FLG_LL_CONN, &bcs->Flag)) { - isar_sched_event(bcs, B_LL_CONNECT); - } -- if (test_and_clear_bit(BC_FLG_FTI_FTS, &bcs->Flag)) { -- isar_sched_event(bcs, B_LL_OK); -- } - } - - static void -@@ -1303,7 +1288,7 @@ - } else { - param[5] = PV32P6_ATN; - } -- param[0] = para_TOA; /* 6 db */ -+ param[0] = 6; /* 6 db */ - param[1] = PV32P2_V23R | PV32P2_V22A | PV32P2_V22B | - PV32P2_V22C | PV32P2_V21 | PV32P2_BEL; - param[2] = PV32P3_AMOD | PV32P3_V32B | PV32P3_V23B; -@@ -1319,7 +1304,7 @@ - } else { - param[1] = PFAXP2_ATN; - } -- param[0] = para_TOA; /* 6 db */ -+ param[0] = 6; /* 6 db */ - sendmsg(cs, dps | ISAR_HIS_PUMPCFG, ctrl, 2, param); - bcs->hw.isar.state = STFAX_NULL; - bcs->hw.isar.newcmd = 0; -@@ -1348,6 +1333,7 @@ - "\0\0"); - break; - case L1_MODE_HDLC: -+ case L1_MODE_FAX: - param[0] = 0; - sendmsg(cs, dps | ISAR_HIS_SARTCFG, SMODE_HDLC, 1, - param); -@@ -1359,9 +1345,6 @@ - sendmsg(cs, dps | ISAR_HIS_SARTCFG, ctrl, 2, - param); - break; -- case L1_MODE_FAX: -- /* SART must not configured with FAX */ -- break; - } - udelay(1000); - sendmsg(cs, dps | ISAR_HIS_BSTREQ, 0, 0, NULL); -@@ -1465,7 +1448,6 @@ - - switch(cmd) { - case ISDN_FAX_CLASS1_FTM: -- test_and_clear_bit(BC_FLG_FRH_WAIT, &bcs->Flag); - if (bcs->hw.isar.state == STFAX_READY) { - p1 = para; - ctrl = PCTRL_CMD_FTM; -@@ -1489,7 +1471,6 @@ - } - break; - case ISDN_FAX_CLASS1_FTH: -- test_and_clear_bit(BC_FLG_FRH_WAIT, &bcs->Flag); - if (bcs->hw.isar.state == STFAX_READY) { - p1 = para; - ctrl = PCTRL_CMD_FTH; -@@ -1513,7 +1494,6 @@ - } - break; - case ISDN_FAX_CLASS1_FRM: -- test_and_clear_bit(BC_FLG_FRH_WAIT, &bcs->Flag); - if (bcs->hw.isar.state == STFAX_READY) { - p1 = para; - ctrl = PCTRL_CMD_FRM; -@@ -1537,7 +1517,6 @@ - } - break; - case ISDN_FAX_CLASS1_FRH: -- test_and_set_bit(BC_FLG_FRH_WAIT, &bcs->Flag); - if (bcs->hw.isar.state == STFAX_READY) { - p1 = para; - ctrl = PCTRL_CMD_FRH; -@@ -1560,11 +1539,6 @@ - bcs->hw.isar.state = STFAX_ESCAPE; - } - break; -- case ISDN_FAXPUMP_HALT: -- bcs->hw.isar.state = STFAX_NULL; -- nom = 0; -- ctrl = PCTRL_CMD_HALT; -- break; - } - if (ctrl) - sendmsg(cs, dps | ISAR_HIS_PUMPCTRL, ctrl, nom, &p1); -@@ -1658,15 +1632,6 @@ - l1_msg_b(st, pr, arg); - break; - case (PH_DEACTIVATE | CONFIRM): -- switch(st->l1.mode) { -- case L1_MODE_TRANS: -- case L1_MODE_HDLC: -- case L1_MODE_V32: -- break; -- case L1_MODE_FAX: -- isar_pump_cmd(st->l1.bcs, ISDN_FAXPUMP_HALT, 0); -- break; -- } - test_and_clear_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag); - test_and_clear_bit(BC_FLG_BUSY, &st->l1.bcs->Flag); - if (st->l1.bcs->cs->debug & L1_DEB_HSCX) -@@ -1758,51 +1723,6 @@ - test_and_set_bit(BC_FLG_DLEETX, - &bcs->Flag); - break; -- case ISDN_FAX_CLASS1_FTS: -- if (ic->parm.aux.subcmd == AT_QUERY) { -- ic->command = ISDN_STAT_FAXIND; -- ic->parm.aux.cmd = ISDN_FAX_CLASS1_OK; -- cs->iif.statcallb(ic); -- return(0); -- } else if (ic->parm.aux.subcmd == AT_EQ_QUERY) { -- strcpy(ic->parm.aux.para, "0-255"); -- ic->command = ISDN_STAT_FAXIND; -- ic->parm.aux.cmd = ISDN_FAX_CLASS1_QUERY; -- cs->iif.statcallb(ic); -- return(0); -- } else if (ic->parm.aux.subcmd == AT_EQ_VALUE) { -- if (cs->debug & L1_DEB_HSCX) -- debugl1(cs, "isar_auxcmd %s=%d", -- FC1_CMD[ic->parm.aux.cmd], ic->parm.aux.para[0]); -- if (bcs->hw.isar.state == STFAX_READY) { -- if (! ic->parm.aux.para[0]) { -- ic->command = ISDN_STAT_FAXIND; -- ic->parm.aux.cmd = ISDN_FAX_CLASS1_OK; -- cs->iif.statcallb(ic); -- return(0); -- } -- if (! test_and_set_bit(BC_FLG_FTI_RUN, &bcs->Flag)) { -- /* n*10 ms */ -- bcs->hw.isar.ftimer.expires = -- jiffies + ((ic->parm.aux.para[0] * 10 * HZ)/1000); -- test_and_set_bit(BC_FLG_FTI_FTS, &bcs->Flag); -- add_timer(&bcs->hw.isar.ftimer); -- return(0); -- } else { -- if (cs->debug) -- debugl1(cs, "isar FTS=%d and FTI busy", -- ic->parm.aux.para[0]); -- } -- } else { -- if (cs->debug) -- debugl1(cs, "isar FTS=%d and isar.state not ready(%x)", -- ic->parm.aux.para[0],bcs->hw.isar.state); -- } -- ic->command = ISDN_STAT_FAXIND; -- ic->parm.aux.cmd = ISDN_FAX_CLASS1_ERROR; -- cs->iif.statcallb(ic); -- } -- break; - case ISDN_FAX_CLASS1_FRM: - case ISDN_FAX_CLASS1_FRH: - case ISDN_FAX_CLASS1_FTM: -@@ -1815,24 +1735,16 @@ - cs->iif.statcallb(ic); - return(0); - } else if (ic->parm.aux.subcmd == AT_EQ_QUERY) { -- char *p = ic->parm.aux.para; -- for(i=0;iparm.aux.para, faxmodulation_s); - ic->command = ISDN_STAT_FAXIND; - ic->parm.aux.cmd = ISDN_FAX_CLASS1_QUERY; - cs->iif.statcallb(ic); - return(0); - } else if (ic->parm.aux.subcmd == AT_EQ_VALUE) { -- if (cs->debug & L1_DEB_HSCX) -- debugl1(cs, "isar_auxcmd %s=%d", -- FC1_CMD[ic->parm.aux.cmd], ic->parm.aux.para[0]); - for(i=0;iparm.aux.para[0]) - break; -- if ((i < FAXMODCNT) && ((1< i) && - test_bit(BC_FLG_INIT, &bcs->Flag)) { - isar_pump_cmd(bcs, - ic->parm.aux.cmd, -@@ -1850,7 +1762,7 @@ - break; - case (ISDN_CMD_IOCTL): - switch (ic->arg) { -- case 9: /* load firmware */ -+ case (9): /* load firmware */ - features = ISDN_FEATURE_L2_MODEM | - ISDN_FEATURE_L2_FAX | - ISDN_FEATURE_L3_FCLASS1; -@@ -1860,26 +1772,6 @@ - else - ll_run(cs, features); - break; -- case 20: -- features = *(unsigned int *) ic->parm.num; -- printk(KERN_DEBUG "HiSax: max modulation old(%04x) new(%04x)\n", -- modmask, features); -- modmask = features; -- break; -- case 21: -- features = *(unsigned int *) ic->parm.num; -- printk(KERN_DEBUG "HiSax: FRM extra delay old(%d) new(%d) ms\n", -- frm_extra_delay, features); -- if (features >= 0) -- frm_extra_delay = features; -- break; -- case 22: -- features = *(unsigned int *) ic->parm.num; -- printk(KERN_DEBUG "HiSax: TOA old(%d) new(%d) db\n", -- para_TOA, features); -- if (features >= 0 && features < 32) -- para_TOA = features; -- break; - default: - printk(KERN_DEBUG "HiSax: invalid ioctl %d\n", - (int) ic->arg); -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isar.h linux-2.4.29/drivers/isdn/hisax/isar.h ---- linux-2.4.29.old/drivers/isdn/hisax/isar.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/isar.h 2005-03-22 15:06:47.457878088 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isar.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: isar.h,v 1.11 2001/09/24 13:22:56 kai Exp $ - * - * ISAR (Siemens PSB 7110) specific defines - * -@@ -28,8 +28,6 @@ - #define ISAR_HIS_FIRM 0x1e - #define ISAR_HIS_STDSP 0x08 - #define ISAR_HIS_DIAG 0x05 --#define ISAR_HIS_WAITSTATE 0x27 --#define ISAR_HIS_TIMERIRQ 0x25 - #define ISAR_HIS_P0CFG 0x3c - #define ISAR_HIS_P12CFG 0x24 - #define ISAR_HIS_SARTCFG 0x25 -@@ -45,10 +43,6 @@ - #define ISAR_HIS_DPS2 0x80 - #define SET_DPS(x) ((x<<6) & 0xc0) - --#define ISAR_CMD_TIMERIRQ_OFF 0x20 --#define ISAR_CMD_TIMERIRQ_ON 0x21 -- -- - #define ISAR_IIS_MSCMSD 0x3f - #define ISAR_IIS_VNR 0x15 - #define ISAR_IIS_DKEY 0x03 -@@ -213,8 +207,6 @@ - #define STFAX_ESCAPE 5 - #define STFAX_SILDET 6 - --#define ISDN_FAXPUMP_HALT 100 -- - extern int ISARVersion(struct IsdnCardState *cs, char *s); - extern void isar_int_main(struct IsdnCardState *cs); - extern void initisar(struct IsdnCardState *cs); -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isdnl1.c linux-2.4.29/drivers/isdn/hisax/isdnl1.c ---- linux-2.4.29.old/drivers/isdn/hisax/isdnl1.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/isdnl1.c 2005-03-22 15:06:47.582859088 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdnl1.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: isdnl1.c,v 2.46 2001/09/24 13:22:56 kai Exp $ - * - * common low level stuff for Siemens Chipsetbased isdn cards - * -@@ -18,7 +18,7 @@ - * - */ - --const char *l1_revision = "$Revision: 1.1.4.1 $"; -+const char *l1_revision = "$Revision: 2.46 $"; - - #define __NO_VERSION__ - #include -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isdnl1.h linux-2.4.29/drivers/isdn/hisax/isdnl1.h ---- linux-2.4.29.old/drivers/isdn/hisax/isdnl1.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/isdnl1.h 2005-03-22 15:06:47.615854072 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdnl1.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: isdnl1.h,v 2.12 2001/09/24 13:22:56 kai Exp $ - * - * Layer 1 defines - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isdnl2.c linux-2.4.29/drivers/isdn/hisax/isdnl2.c ---- linux-2.4.29.old/drivers/isdn/hisax/isdnl2.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/isdnl2.c 2005-03-22 15:06:47.631851640 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdnl2.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: isdnl2.c,v 2.30 2001/09/24 13:22:56 kai Exp $ - * - * Author Karsten Keil - * based on the teles driver from Jan den Ouden -@@ -20,7 +20,7 @@ - #include "hisax.h" - #include "isdnl2.h" - --const char *l2_revision = "$Revision: 1.1.4.1 $"; -+const char *l2_revision = "$Revision: 2.30 $"; - - static void l2m_debug(struct FsmInst *fi, char *fmt, ...); - -@@ -1418,8 +1418,8 @@ - freewin(st); - st->l2.tei = -1; - stop_t200(st, 17); -- st5_dl_release_l2l3(st); - FsmChangeState(fi, ST_L2_1); -+ st5_dl_release_l2l3(st); - } - - static void -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isdnl2.h linux-2.4.29/drivers/isdn/hisax/isdnl2.h ---- linux-2.4.29.old/drivers/isdn/hisax/isdnl2.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/isdnl2.h 2005-03-22 15:06:47.647849208 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdnl2.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id$ - * - * Layer 2 defines - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isdnl3.c linux-2.4.29/drivers/isdn/hisax/isdnl3.c ---- linux-2.4.29.old/drivers/isdn/hisax/isdnl3.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/isdnl3.c 2005-03-22 15:06:47.663846776 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdnl3.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: isdnl3.c,v 2.22 2001/09/24 13:22:56 kai Exp $ - * - * Author Karsten Keil - * based on the teles driver from Jan den Ouden -@@ -21,7 +21,7 @@ - #include "isdnl3.h" - #include - --const char *l3_revision = "$Revision: 1.1.4.1 $"; -+const char *l3_revision = "$Revision: 2.22 $"; - - static struct Fsm l3fsm; - -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isdnl3.h linux-2.4.29/drivers/isdn/hisax/isdnl3.h ---- linux-2.4.29.old/drivers/isdn/hisax/isdnl3.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/isdnl3.h 2005-03-22 15:06:47.679844344 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdnl3.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id$ - * - * This software may be used and distributed according to the terms - * of the GNU General Public License, incorporated herein by reference. -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isurf.c linux-2.4.29/drivers/isdn/hisax/isurf.c ---- linux-2.4.29.old/drivers/isdn/hisax/isurf.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/isurf.c 2005-03-22 15:06:47.699841304 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isurf.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: isurf.c,v 1.12 2001/09/24 13:22:56 kai Exp $ - * - * low level stuff for Siemens I-Surf/I-Talk cards - * -@@ -16,11 +16,10 @@ - #include "isac.h" - #include "isar.h" - #include "isdnl1.h" --#include - - extern const char *CardType[]; - --static const char *ISurf_revision = "$Revision: 1.1.4.1 $"; -+static const char *ISurf_revision = "$Revision: 1.12 $"; - - #define byteout(addr,val) outb(val,addr) - #define bytein(addr) inb(addr) -@@ -128,8 +127,10 @@ - release_io_isurf(struct IsdnCardState *cs) - { - release_region(cs->hw.isurf.reset, 1); -+#ifdef COMPAT_HAS_ISA_IOREMAP - iounmap((unsigned char *)cs->hw.isurf.isar); - release_mem_region(cs->hw.isurf.phymem, ISURF_IOMEM_SIZE); -+#endif - } - - static void -@@ -194,10 +195,6 @@ - return(isar_auxcmd(cs, ic)); - } - --#ifdef __ISAPNP__ --static struct pci_bus *pnp_surf __devinitdata = NULL; --#endif -- - int __init - setup_isurf(struct IsdnCard *card) - { -@@ -215,58 +212,9 @@ - cs->hw.isurf.phymem = card->para[2]; - cs->irq = card->para[0]; - } else { --#ifdef __ISAPNP__ -- struct pci_bus *pb; -- struct pci_dev *pd; -- -- if (isapnp_present()) { -- cs->subtyp = 0; -- if ((pb = isapnp_find_card( -- ISAPNP_VENDOR('S', 'I', 'E'), -- ISAPNP_FUNCTION(0x0010), pnp_surf))) { -- pnp_surf = pb; -- pd = NULL; -- if (!(pd = isapnp_find_dev(pnp_surf, -- ISAPNP_VENDOR('S', 'I', 'E'), -- ISAPNP_FUNCTION(0x0010), pd))) { -- printk(KERN_ERR "ISurfPnP: PnP error card found, no device\n"); -- return (0); -- } -- pd->prepare(pd); -- pd->deactivate(pd); -- pd->activate(pd); -- /* The ISA-PnP logic apparently -- * expects upper limit address to be -- * set. Since the isa-pnp module -- * doesn't do this, so we have to make -- * up for it. -- */ -- isapnp_cfg_begin(pd->bus->number, pd->devfn); -- isapnp_write_word(ISAPNP_CFG_MEM+3, -- pd->resource[8].end >> 8); -- isapnp_cfg_end(); -- cs->hw.isurf.reset = pd->resource[0].start; -- cs->hw.isurf.phymem = pd->resource[8].start; -- cs->irq = pd->irq_resource[0].start; -- if (!cs->irq || !cs->hw.isurf.reset || !cs->hw.isurf.phymem) { -- printk(KERN_ERR "ISurfPnP:some resources are missing %d/%x/%lx\n", -- cs->irq, cs->hw.isurf.reset, cs->hw.isurf.phymem); -- pd->deactivate(pd); -- return(0); -- } -- } else { -- printk(KERN_INFO "ISurfPnP: no ISAPnP card found\n"); -- return(0); -- } -- } else { -- printk(KERN_INFO "ISurfPnP: no ISAPnP bus found\n"); -- return(0); -- } --#else - printk(KERN_WARNING "HiSax: %s port/mem not set\n", - CardType[card->typ]); - return (0); --#endif - } - if (check_region(cs->hw.isurf.reset, 1)) { - printk(KERN_WARNING -@@ -277,6 +225,7 @@ - } else { - request_region(cs->hw.isurf.reset, 1, "isurf isdn"); - } -+#ifdef COMPAT_HAS_ISA_IOREMAP - if (check_mem_region(cs->hw.isurf.phymem, ISURF_IOMEM_SIZE)) { - printk(KERN_WARNING - "HiSax: %s memory region %lx-%lx already in use\n", -@@ -292,6 +241,10 @@ - cs->hw.isurf.isar = - (unsigned long) ioremap(cs->hw.isurf.phymem, ISURF_IOMEM_SIZE); - cs->hw.isurf.isac = cs->hw.isurf.isar + ISURF_ISAC_OFFSET; -+#else -+ cs->hw.isurf.isar = cs->hw.isurf.phymem + ISURF_ISAR_OFFSET; -+ cs->hw.isurf.isac = cs->hw.isurf.phymem + ISURF_ISAC_OFFSET; -+#endif - printk(KERN_INFO - "ISurf: defined at 0x%x 0x%lx IRQ %d\n", - cs->hw.isurf.reset, -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/ix1_micro.c linux-2.4.29/drivers/isdn/hisax/ix1_micro.c ---- linux-2.4.29.old/drivers/isdn/hisax/ix1_micro.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/ix1_micro.c 2005-03-22 15:06:47.714839024 +0100 -@@ -1,4 +1,4 @@ --/* $Id: ix1_micro.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: ix1_micro.c,v 2.12 2001/09/24 13:22:56 kai Exp $ - * - * low level stuff for ITK ix1-micro Rev.2 isdn cards - * derived from the original file teles3.c from Karsten Keil -@@ -19,14 +19,13 @@ - - #define __NO_VERSION__ - #include --#include - #include "hisax.h" - #include "isac.h" - #include "hscx.h" - #include "isdnl1.h" - - extern const char *CardType[]; --const char *ix1_revision = "$Revision: 1.1.4.1 $"; -+const char *ix1_revision = "$Revision: 2.12 $"; - - #define byteout(addr,val) outb(val,addr) - #define bytein(addr) inb(addr) -@@ -219,21 +218,6 @@ - return(0); - } - --#ifdef __ISAPNP__ --static struct isapnp_device_id itk_ids[] __initdata = { -- { ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x25), -- ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x25), -- (unsigned long) "ITK micro 2" }, -- { ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x29), -- ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x29), -- (unsigned long) "ITK micro 2." }, -- { 0, } --}; -- --static struct isapnp_device_id *idev = &itk_ids[0]; --static struct pci_bus *pnp_c __devinitdata = NULL; --#endif -- - - int __init - setup_ix1micro(struct IsdnCard *card) -@@ -246,45 +230,6 @@ - if (cs->typ != ISDN_CTYPE_IX1MICROR2) - return (0); - --#ifdef __ISAPNP__ -- if (!card->para[1] && isapnp_present()) { -- struct pci_bus *pb; -- struct pci_dev *pd; -- -- while(idev->card_vendor) { -- if ((pb = isapnp_find_card(idev->card_vendor, -- idev->card_device, pnp_c))) { -- pnp_c = pb; -- pd = NULL; -- if ((pd = isapnp_find_dev(pnp_c, -- idev->vendor, idev->function, pd))) { -- printk(KERN_INFO "HiSax: %s detected\n", -- (char *)idev->driver_data); -- pd->prepare(pd); -- pd->deactivate(pd); -- pd->activate(pd); -- card->para[1] = pd->resource[0].start; -- card->para[0] = pd->irq_resource[0].start; -- if (!card->para[0] || !card->para[1]) { -- printk(KERN_ERR "ITK PnP:some resources are missing %ld/%lx\n", -- card->para[0], card->para[1]); -- pd->deactivate(pd); -- return(0); -- } -- break; -- } else { -- printk(KERN_ERR "ITK PnP: PnP error card found, no device\n"); -- } -- } -- idev++; -- pnp_c=NULL; -- } -- if (!idev->card_vendor) { -- printk(KERN_INFO "ITK PnP: no ISAPnP card found\n"); -- return(0); -- } -- } --#endif - /* IO-Ports */ - cs->hw.ix1.isac_ale = card->para[1] + ISAC_COMMAND_OFFSET; - cs->hw.ix1.hscx_ale = card->para[1] + HSCX_COMMAND_OFFSET; -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/jade.c linux-2.4.29/drivers/isdn/hisax/jade.c ---- linux-2.4.29.old/drivers/isdn/hisax/jade.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/jade.c 2005-03-22 15:06:47.729836744 +0100 -@@ -1,4 +1,4 @@ --/* $Id: jade.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: jade.c,v 1.9 2001/09/24 13:22:56 kai Exp $ - * - * JADE stuff (derived from original hscx.c) - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/jade.h linux-2.4.29/drivers/isdn/hisax/jade.h ---- linux-2.4.29.old/drivers/isdn/hisax/jade.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/jade.h 2005-03-22 15:06:47.745834312 +0100 -@@ -1,4 +1,4 @@ --/* $Id: jade.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: jade.h,v 1.5 2001/09/24 13:22:56 kai Exp $ - * - * JADE specific defines - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/jade_irq.c linux-2.4.29/drivers/isdn/hisax/jade_irq.c ---- linux-2.4.29.old/drivers/isdn/hisax/jade_irq.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/jade_irq.c 2005-03-22 15:06:47.760832032 +0100 -@@ -1,4 +1,4 @@ --/* $Id: jade_irq.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: jade_irq.c,v 1.7 2001/09/24 13:22:56 kai Exp $ - * - * Low level JADE IRQ stuff (derived from original hscx_irq.c) - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/l3_1tr6.c linux-2.4.29/drivers/isdn/hisax/l3_1tr6.c ---- linux-2.4.29.old/drivers/isdn/hisax/l3_1tr6.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/l3_1tr6.c 2005-03-22 15:06:47.777829448 +0100 -@@ -1,4 +1,4 @@ --/* $Id: l3_1tr6.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: l3_1tr6.c,v 2.15 2001/09/24 13:22:56 kai Exp $ - * - * German 1TR6 D-channel protocol - * -@@ -20,7 +20,7 @@ - #include - - extern char *HiSax_getrev(const char *revision); --const char *l3_1tr6_revision = "$Revision: 1.1.4.1 $"; -+const char *l3_1tr6_revision = "$Revision: 2.15 $"; - - #define MsgHead(ptr, cref, mty, dis) \ - *ptr++ = dis; \ -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/l3_1tr6.h linux-2.4.29/drivers/isdn/hisax/l3_1tr6.h ---- linux-2.4.29.old/drivers/isdn/hisax/l3_1tr6.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/l3_1tr6.h 2005-03-22 15:06:47.796826560 +0100 -@@ -1,4 +1,4 @@ --/* $Id: l3_1tr6.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id$ - * - * German 1TR6 D-channel protocol defines - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/l3dss1.c linux-2.4.29/drivers/isdn/hisax/l3dss1.c ---- linux-2.4.29.old/drivers/isdn/hisax/l3dss1.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/l3dss1.c 2005-03-22 15:06:47.822822608 +0100 -@@ -1,4 +1,4 @@ --/* $Id: l3dss1.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: l3dss1.c,v 2.32 2001/09/24 13:22:56 kai Exp $ - * - * EURO/DSS1 D-channel protocol - * -@@ -27,7 +27,7 @@ - #include - - extern char *HiSax_getrev(const char *revision); --const char *dss1_revision = "$Revision: 1.1.4.1 $"; -+const char *dss1_revision = "$Revision: 2.32 $"; - - #define EXT_BEARER_CAPS 1 - -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/l3dss1.h linux-2.4.29/drivers/isdn/hisax/l3dss1.h ---- linux-2.4.29.old/drivers/isdn/hisax/l3dss1.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/l3dss1.h 2005-03-22 15:06:47.842819568 +0100 -@@ -1,4 +1,4 @@ --/* $Id: l3dss1.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id$ - * - * DSS1 (Euro) D-channel protocol defines - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/l3ni1.c linux-2.4.29/drivers/isdn/hisax/l3ni1.c ---- linux-2.4.29.old/drivers/isdn/hisax/l3ni1.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/l3ni1.c 2005-03-22 15:06:47.859816984 +0100 -@@ -1,4 +1,4 @@ --/* $Id: l3ni1.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: l3ni1.c,v 2.8 2001/09/24 13:22:56 kai Exp $ - * - * NI1 D-channel protocol - * -@@ -25,7 +25,7 @@ - #include - - extern char *HiSax_getrev(const char *revision); --const char *ni1_revision = "$Revision: 1.1.4.1 $"; -+const char *ni1_revision = "$Revision: 2.8 $"; - - #define EXT_BEARER_CAPS 1 - -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/l3ni1.h linux-2.4.29/drivers/isdn/hisax/l3ni1.h ---- linux-2.4.29.old/drivers/isdn/hisax/l3ni1.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/l3ni1.h 2005-03-22 15:06:47.877814248 +0100 -@@ -1,4 +1,4 @@ --/* $Id: l3ni1.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id$ - * - * NI1 D-channel protocol - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/lmgr.c linux-2.4.29/drivers/isdn/hisax/lmgr.c ---- linux-2.4.29.old/drivers/isdn/hisax/lmgr.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/lmgr.c 2005-03-22 15:06:47.895811512 +0100 -@@ -1,4 +1,4 @@ --/* $Id: lmgr.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id$ - * - * Layermanagement module - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/md5sums.asc linux-2.4.29/drivers/isdn/hisax/md5sums.asc ---- linux-2.4.29.old/drivers/isdn/hisax/md5sums.asc 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/md5sums.asc 2005-03-22 15:06:47.910809232 +0100 -@@ -1,33 +1,22 @@ -------BEGIN PGP SIGNED MESSAGE----- --Hash: SHA1 -- - # This are valid md5sums for certificated HiSax driver. - # The certification is valid only if the md5sums of all files match. - # The certification is valid only for ELSA Microlink PCI, --# Eicon Technology Diva 2.01 PCI, Sedlbauer SpeedFax+, --# HFC-S PCI A based cards and HFC-S USB based ISDN --# terminal adapters in the moment. -+# Eicon Technology Diva 2.01 PCI, Sedlbauer SpeedFax+, -+# HFC-S PCI A based cards and HFC-S USB based isdn tas -+# in the moment. - # Read ../../../Documentation/isdn/HiSax.cert for more informations. - # --cd4a9917e1147039d5dfc66440d42054 isac.c --211840e78b56c9d4753be9c85da21a50 isdnl1.c --5ce9b1fff42a02f9c2eb4fb81c701b1f isdnl2.c --6948de0c43513dd23c6706feb5fc2209 isdnl3.c --3730780b69368218d756024165efea79 tei.c --16e72710eb58da01415b877490f5d2ac callc.c --6abc55c77e0f3149ae9334f3257a1a1a cert.c --27bdb2800d4590e00da20eff241edc47 l3dss1.c --df8bb877b854c4302d396b554e4e84ef l3_1tr6.c --9d8b4bed15370063d1b16e47080f50e1 elsa.c --210f4a3f1eebca70229d786b15cf3e90 diva.c --4ddf21079dd77e892380f789bae250a7 sedlbauer.c --8200d818771e3cbdef2a3c3e818d25ac hfc_pci.c -+6f9433a8b696076562562d090e3c420f isac.c -+13c3eed869f5139f44c563e3a8fea1f5 isdnl1.c -+addcff863b0ff1e366c0f2ae9fa6e81e isdnl2.c -+7076deb94a363945c21ea27aca4a720a isdnl3.c -+51c603829b6cc4f8421f744ad657ceff tei.c -+669050ab5079f02887ed0239d86e5474 callc.c -+ecacd146b8f8881ef9349935dab3df4a cert.c -+fadeb3b85bb23bc1ac48470c0848d6fa l3dss1.c -+cf7dec9fac6283716904d26b99188476 l3_1tr6.c -+2f75c8765e1be13d114d5f4433cf364b elsa.c -+b4cf8a4dceed9ea6dcba65a85b4eecc7 diva.c -+dee3f8f40c6fe78a4b57729804b7e6cd sedlbauer.c -+0d79fe6dfc5bfaa4826970c41a6d273d hfc_pci.c - # end of md5sums -------BEGIN PGP SIGNATURE----- --Version: GnuPG v1.0.6 (GNU/Linux) --Comment: For info see http://www.gnupg.org -- --iD8DBQE9rE91DiY0VZsg4ukRAkKfAJ4xWUfqjc0hW+V+JPue5yr7mrt+RwCdGdSf --GIKgAEdRLzERmpt/bCCwAbY= --=FaHw -------END PGP SIGNATURE----- -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/mic.c linux-2.4.29/drivers/isdn/hisax/mic.c ---- linux-2.4.29.old/drivers/isdn/hisax/mic.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/mic.c 2005-03-22 15:06:47.926806800 +0100 -@@ -1,4 +1,4 @@ --/* $Id: mic.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: mic.c,v 1.12 2001/09/24 13:22:56 kai Exp $ - * - * low level stuff for mic cards - * -@@ -19,7 +19,7 @@ - - extern const char *CardType[]; - --const char *mic_revision = "$Revision: 1.1.4.1 $"; -+const char *mic_revision = "$Revision: 1.12 $"; - - #define byteout(addr,val) outb(val,addr) - #define bytein(addr) inb(addr) -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/netjet.c linux-2.4.29/drivers/isdn/hisax/netjet.c ---- linux-2.4.29.old/drivers/isdn/hisax/netjet.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/netjet.c 2005-03-22 15:06:47.941804520 +0100 -@@ -1,4 +1,4 @@ --/* $Id: netjet.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: netjet.c,v 1.29 2001/09/24 13:22:56 kai Exp $ - * - * low level stuff for Traverse Technologie NETJet ISDN cards - * -@@ -8,9 +8,7 @@ - * This software may be used and distributed according to the terms - * of the GNU General Public License, incorporated herein by reference. - * -- * Thanks to Traverse Technologies Australia for documents and information -- * -- * 16-Apr-2002 - led code added - Guy Ellis (guy@traverse.com.au) -+ * Thanks to Traverse Technologie Australia for documents and information - * - */ - -@@ -26,7 +24,7 @@ - #include - #include "netjet.h" - --const char *NETjet_revision = "$Revision: 1.1.4.1 $"; -+const char *NETjet_revision = "$Revision: 1.29 $"; - - /* Interface functions */ - -@@ -135,7 +133,6 @@ - mode_tiger(struct BCState *bcs, int mode, int bc) - { - struct IsdnCardState *cs = bcs->cs; -- u_char led; - - if (cs->debug & L1_DEB_HSCX) - debugl1(cs, "Tiger mode %d bchan %d/%d", -@@ -157,15 +154,6 @@ - cs->hw.njet.dmactrl); - byteout(cs->hw.njet.base + NETJET_IRQMASK0, 0); - } -- if (cs->typ == ISDN_CTYPE_NETJET_S) -- { -- // led off -- led = bc & 0x01; -- led = 0x01 << (6 + led); // convert to mask -- led = ~led; -- cs->hw.njet.auxd &= led; -- byteout(cs->hw.njet.auxa, cs->hw.njet.auxd); -- } - break; - case (L1_MODE_TRANS): - break; -@@ -191,14 +179,6 @@ - bcs->hw.tiger.sendp = bcs->hw.tiger.send; - bcs->hw.tiger.free = NETJET_DMA_TXSIZE; - test_and_set_bit(BC_FLG_EMPTY, &bcs->Flag); -- if (cs->typ == ISDN_CTYPE_NETJET_S) -- { -- // led on -- led = bc & 0x01; -- led = 0x01 << (6 + led); // convert to mask -- cs->hw.njet.auxd |= led; -- byteout(cs->hw.njet.auxa, cs->hw.njet.auxd); -- } - break; - } - if (cs->debug & L1_DEB_HSCX) -@@ -874,13 +854,9 @@ - case (PH_ACTIVATE | REQUEST): - test_and_set_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag); - mode_tiger(st->l1.bcs, st->l1.mode, st->l1.bc); -- /* 2001/10/04 Christoph Ersfeld, Formula-n Europe AG */ -- st->l1.bcs->cs->cardmsg(st->l1.bcs->cs, MDL_BC_ASSIGN, (void *)(&st->l1.bc)); - l1_msg_b(st, pr, arg); - break; - case (PH_DEACTIVATE | REQUEST): -- /* 2001/10/04 Christoph Ersfeld, Formula-n Europe AG */ -- st->l1.bcs->cs->cardmsg(st->l1.bcs->cs, MDL_BC_RELEASE, (void *)(&st->l1.bc)); - l1_msg_b(st, pr, arg); - break; - case (PH_DEACTIVATE | CONFIRM): -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/netjet.h linux-2.4.29/drivers/isdn/hisax/netjet.h ---- linux-2.4.29.old/drivers/isdn/hisax/netjet.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/netjet.h 2005-03-22 15:06:47.956802240 +0100 -@@ -1,4 +1,4 @@ --/* $Id: netjet.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: netjet.h,v 2.8 2001/09/24 13:22:56 kai Exp $ - * - * NETjet common header file - * -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/niccy.c linux-2.4.29/drivers/isdn/hisax/niccy.c ---- linux-2.4.29.old/drivers/isdn/hisax/niccy.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/niccy.c 2005-03-22 15:06:47.977799048 +0100 -@@ -1,4 +1,4 @@ --/* $Id: niccy.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: niccy.c,v 1.21 2001/10/20 22:05:00 kai Exp $ - * - * low level stuff for Dr. Neuhaus NICCY PnP and NICCY PCI and - * compatible (SAGEM cybermodem) -@@ -22,10 +22,10 @@ - #include "hscx.h" - #include "isdnl1.h" - #include --#include -+#include - - extern const char *CardType[]; --const char *niccy_revision = "$Revision: 1.1.4.1 $"; -+const char *niccy_revision = "$Revision: 1.21 $"; - - #define byteout(addr,val) outb(val,addr) - #define bytein(addr) inb(addr) -@@ -239,9 +239,6 @@ - } - - static struct pci_dev *niccy_dev __initdata = NULL; --#ifdef __ISAPNP__ --static struct pci_bus *pnp_c __devinitdata = NULL; --#endif - - int __init - setup_niccy(struct IsdnCard *card) -@@ -253,39 +250,7 @@ - printk(KERN_INFO "HiSax: Niccy driver Rev. %s\n", HiSax_getrev(tmp)); - if (cs->typ != ISDN_CTYPE_NICCY) - return (0); --#ifdef __ISAPNP__ -- if (!card->para[1] && isapnp_present()) { -- struct pci_bus *pb; -- struct pci_dev *pd; -- -- if ((pb = isapnp_find_card( -- ISAPNP_VENDOR('S', 'D', 'A'), -- ISAPNP_FUNCTION(0x0150), pnp_c))) { -- pnp_c = pb; -- pd = NULL; -- if (!(pd = isapnp_find_dev(pnp_c, -- ISAPNP_VENDOR('S', 'D', 'A'), -- ISAPNP_FUNCTION(0x0150), pd))) { -- printk(KERN_ERR "NiccyPnP: PnP error card found, no device\n"); -- return (0); -- } -- pd->prepare(pd); -- pd->deactivate(pd); -- pd->activate(pd); -- card->para[1] = pd->resource[0].start; -- card->para[2] = pd->resource[1].start; -- card->para[0] = pd->irq_resource[0].start; -- if (!card->para[0] || !card->para[1] || !card->para[2]) { -- printk(KERN_ERR "NiccyPnP:some resources are missing %ld/%lx/%lx\n", -- card->para[0], card->para[1], card->para[2]); -- pd->deactivate(pd); -- return(0); -- } -- } else { -- printk(KERN_INFO "NiccyPnP: no ISAPnP card found\n"); -- } -- } --#endif -+ - if (card->para[1]) { - cs->hw.niccy.isac = card->para[1] + ISAC_PNP; - cs->hw.niccy.hscx = card->para[1] + HSCX_PNP; -@@ -331,12 +296,12 @@ - return(0); - } - cs->irq = niccy_dev->irq; -- cs->hw.niccy.cfg_reg = pci_resource_start(niccy_dev, 0); -+ cs->hw.niccy.cfg_reg = pci_resource_start_io(niccy_dev, 0); - if (!cs->hw.niccy.cfg_reg) { - printk(KERN_WARNING "Niccy: No IO-Adr for PCI cfg found\n"); - return(0); - } -- pci_ioaddr = pci_resource_start(niccy_dev, 1); -+ pci_ioaddr = pci_resource_start_io(niccy_dev, 1); - if (!pci_ioaddr) { - printk(KERN_WARNING "Niccy: No IO-Adr for PCI card found\n"); - return(0); -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/nj_s.c linux-2.4.29/drivers/isdn/hisax/nj_s.c ---- linux-2.4.29.old/drivers/isdn/hisax/nj_s.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/nj_s.c 2005-03-22 15:06:47.993796616 +0100 -@@ -1,4 +1,4 @@ --/* $Id: nj_s.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: nj_s.c,v 2.13 2001/09/24 13:22:56 kai Exp $ - * - * This software may be used and distributed according to the terms - * of the GNU General Public License, incorporated herein by reference. -@@ -12,11 +12,12 @@ - #include "isac.h" - #include "isdnl1.h" - #include -+#include - #include - #include - #include "netjet.h" - --const char *NETjet_S_revision = "$Revision: 1.1.4.1 $"; -+const char *NETjet_S_revision = "$Revision: 2.13 $"; - - static u_char dummyrr(struct IsdnCardState *cs, int chan, u_char off) - { -@@ -130,7 +131,6 @@ - release_io_netjet(cs); - return(0); - case CARD_INIT: -- reset_netjet_s(cs); - inittiger(cs); - clear_pending_isac_ints(cs); - initisac(cs); -@@ -180,19 +180,11 @@ - printk(KERN_WARNING "NETjet-S: No IRQ for PCI card found\n"); - return(0); - } -- cs->hw.njet.base = pci_resource_start(dev_netjet, 0); -+ cs->hw.njet.base = pci_resource_start_io(dev_netjet, 0); - if (!cs->hw.njet.base) { - printk(KERN_WARNING "NETjet-S: No IO-Adr for PCI card found\n"); - return(0); - } -- /* 2001/10/04 Christoph Ersfeld, Formula-n Europe AG www.formula-n.com */ -- if ((dev_netjet->subsystem_vendor == 0x55) && -- (dev_netjet->subsystem_device == 0x02)) { -- printk(KERN_WARNING "Netjet: You tried to load this driver with an incompatible TigerJet-card\n"); -- printk(KERN_WARNING "Use type=41 for Formula-n enter:now ISDN PCI and compatible\n"); -- return(0); -- } -- /* end new code */ - } else { - printk(KERN_WARNING "NETjet-S: No PCI card found\n"); - return(0); -@@ -263,6 +255,7 @@ - } else { - request_region(cs->hw.njet.base, bytecnt, "netjet-s isdn"); - } -+ reset_netjet_s(cs); - cs->readisac = &NETjet_ReadIC; - cs->writeisac = &NETjet_WriteIC; - cs->readisacfifo = &NETjet_ReadICfifo; -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/nj_u.c linux-2.4.29/drivers/isdn/hisax/nj_u.c ---- linux-2.4.29.old/drivers/isdn/hisax/nj_u.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/nj_u.c 2005-03-22 15:06:48.008794336 +0100 -@@ -1,4 +1,4 @@ --/* $Id: nj_u.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: nj_u.c,v 2.14 2001/09/24 13:22:56 kai Exp $ - * - * This software may be used and distributed according to the terms - * of the GNU General Public License, incorporated herein by reference. -@@ -12,11 +12,12 @@ - #include "icc.h" - #include "isdnl1.h" - #include -+#include - #include - #include - #include "netjet.h" - --const char *NETjet_U_revision = "$Revision: 1.1.4.1 $"; -+const char *NETjet_U_revision = "$Revision: 2.14 $"; - - static u_char dummyrr(struct IsdnCardState *cs, int chan, u_char off) - { -@@ -181,7 +182,7 @@ - printk(KERN_WARNING "NETspider-U: No IRQ for PCI card found\n"); - return(0); - } -- cs->hw.njet.base = pci_resource_start(dev_netjet, 0); -+ cs->hw.njet.base = pci_resource_start_io(dev_netjet, 0); - if (!cs->hw.njet.base) { - printk(KERN_WARNING "NETspider-U: No IO-Adr for PCI card found\n"); - return(0); -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/q931.c linux-2.4.29/drivers/isdn/hisax/q931.c ---- linux-2.4.29.old/drivers/isdn/hisax/q931.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/q931.c 2005-03-22 15:06:48.032790688 +0100 -@@ -1,4 +1,4 @@ --/* $Id: q931.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: q931.c,v 1.12 2001/09/24 13:22:56 kai Exp $ - * - * code to decode ITU Q.931 call control messages - * -@@ -197,6 +197,31 @@ - - #define MT_N1_LEN (sizeof(mt_n1) / sizeof(struct MessageType)) - -+#if 0 -+static struct MessageType fac_1tr6[] = -+{ -+ {FAC_Sperre, "Sperre"}, -+ {FAC_Forward1, "Forward 1"}, -+ {FAC_Forward2, "Forward 2"}, -+ {FAC_Konferenz, "Konferenz"}, -+ {FAC_GrabBchan, "Grab Bchannel"}, -+ {FAC_Reactivate, "Reactivate"}, -+ {FAC_Konferenz3, "Dreier Konferenz"}, -+ {FAC_Dienstwechsel1, "Einseitiger Dienstwechsel"}, -+ {FAC_Dienstwechsel2, "Zweiseitiger Dienstwechsel"}, -+ {FAC_NummernIdent, "Rufnummer-Identifizierung"}, -+ {FAC_GBG, "GBG"}, -+ {FAC_DisplayUebergeben, "Display Uebergeben"}, -+ {FAC_DisplayUmgeleitet, "Display Umgeleitet"}, -+ {FAC_Unterdruecke, "Unterdruecke Rufnummer"}, -+ {FAC_Deactivate, "Deactivate"}, -+ {FAC_Activate, "Activate"}, -+ {FAC_SPV, "SPV"}, -+ {FAC_Rueckwechsel, "Rueckwechsel"}, -+ {FAC_Umleitung, "Umleitung"} -+}; -+#define FAC_1TR6_LEN (sizeof(fac_1tr6) / sizeof(struct MessageType)) -+#endif - - static int - prbits(char *dest, u_char b, int start, int len) -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/rawhdlc.c linux-2.4.29/drivers/isdn/hisax/rawhdlc.c ---- linux-2.4.29.old/drivers/isdn/hisax/rawhdlc.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/rawhdlc.c 2005-03-22 15:06:48.047788408 +0100 -@@ -0,0 +1,543 @@ -+/* $Id: rawhdlc.c,v 1.7 2001/09/24 13:22:57 kai Exp $ -+ * -+ * support routines for cards that don't support HDLC -+ * -+ * Author Brent Baccala -+ * Copyright by Karsten Keil -+ * by Brent Baccala -+ * -+ * This software may be used and distributed according to the terms -+ * of the GNU General Public License, incorporated herein by reference. -+ * -+ * -+ * Some passive ISDN cards, such as the Traverse NETJet and the AMD 7930, -+ * don't perform HDLC encapsulation over the B channel. Drivers for -+ * such cards use support routines in this file to perform B channel HDLC. -+ * -+ * Bit-synchronous HDLC encapsulation is a means of encapsulating packets -+ * over a continuously transmitting serial communications link. -+ * It looks like this: -+ * -+ * 11111111101111110...........0111111011111111111 -+ * iiiiiiiiiffffffffdddddddddddffffffffiiiiiiiiiii -+ * -+ * i = idle f = flag d = data -+ * -+ * When idle, the channel sends a continuous string of ones (mark -+ * idle; illustrated), or a continuous string of flag characters (flag -+ * idle). The beginning of a data frame is marked by a flag character -+ * (01111110), then comes the actual data, followed by another flag -+ * character, after which another frame may be sent immediately (a -+ * single flag may serve as both the end of one frame and the start of -+ * the next), or the link may return to idle. Obviously, the flag -+ * character can not appear anywhere in the data (or a false -+ * end-of-frame would occur), so the transmitter performs -+ * "bit-stuffing" - inserting a zero bit after every five one bits, -+ * irregardless of the original bit after the five ones. Byte -+ * ordering is irrelevent at this point - the data is treated as a -+ * string of bits, not bytes. Since no more than 5 ones may now occur -+ * in a row, the flag sequence, with its 6 ones, is unique. -+ * -+ * Upon reception, a zero bit that occur after 5 one bits is simply -+ * discarded. A series of 6 one bits is end-of-frame, and a series of -+ * 7 one bits is an abort. Once bit-stuffing has been corrected for, -+ * an integer number of bytes should now be present. The last two -+ * of these bytes form the Frame Check Sequence, a CRC that is verified -+ * and then discarded. Note that bit-stuffing is performed on the FCS -+ * just as if it were regular data. -+ * -+ * -+ * -+ * int make_raw_hdlc_data(u_char *src, u_int slen, -+ * u_char *dst, u_int dsize) -+ * -+ * Used for transmission. Copies slen bytes from src to dst, performing -+ * HDLC encapsulation (flag bytes, bit-stuffing, CRC) in the process. -+ * dsize is size of destination buffer, and should be at least -+ * ((6*slen)/5)+5 bytes to ensure adequate space will be available. -+ * Function returns length (in bytes) of valid destination buffer, or -+ * 0 upon destination overflow. -+ * -+ * void init_hdlc_state(struct hdlc_state *stateptr, int mode) -+ * -+ * Initializes hdlc_state structure before first call to read_raw_hdlc_data -+ * -+ * mode = 0: Sane mode -+ * mode = 1/2: -+ * Insane mode; NETJet use a shared unsigned int memory block ( -+ * with busmaster DMA), the bit pattern of every word is -+ * <8 B1> <8 B2> <8 Mon> <2 D> <4 C/I> -+ * according to Siemens IOM-2 interface, so we have to handle -+ * the src buffer as unsigned int and have to shift/mask the -+ * B-channel bytes. -+ * mode 1 -> B1 mode 2 -> B2 data is used -+ * -+ * int read_raw_hdlc_data(struct hdlc_state *saved_state, -+ * u_char *src, u_int slen, -+ * u_char *dst, u_int dsize) -+ * -+ * Used for reception. Scans source buffer bit-by-bit looking for -+ * valid HDLC frames, which are copied to destination buffer. HDLC -+ * state information is stored in a structure, which allows this -+ * function to process frames spread across several blocks of raw -+ * HDLC data. Part of the state information is bit offsets into -+ * the source and destination buffers. -+ * -+ * A return value >0 indicates the length of a valid frame, now -+ * stored in the destination buffer. In this case, the source -+ * buffer might not be completely processed, so this function should -+ * be called again with the same source buffer, possibly with a -+ * different destination buffer. -+ * -+ * A return value of zero indicates that the source buffer was -+ * completely processed without finding a valid end-of-packet; -+ * however, we might be in the middle of packet reception, so -+ * the function should be called again with the next block of -+ * raw HDLC data and the same destination buffer. It is NOT -+ * permitted to change the destination buffer in this case, -+ * since data may already have begun to be stored there. -+ * -+ * A return value of -1 indicates some kind of error - destination -+ * buffer overflow, CRC check failed, frame not a multiple of 8 -+ * bits. Destination buffer probably contains invalid data, which -+ * should be discarded. Call function again with same source buffer -+ * and a new (or same) destination buffer. -+ * -+ * Suggested calling sequence: -+ * -+ * init_hdlc_state(...); -+ * for (EACH_RAW_DATA_BLOCK) { -+ * while (len = read_raw_hdlc_data(...)) { -+ * if (len == -1) DISCARD_FRAME; -+ * else PROCESS_FRAME; -+ * } -+ * } -+ * -+ * -+ * Test the code in this file as follows: -+ * gcc -DDEBUGME -o rawhdlctest rawhdlc.c -+ * ./rawhdlctest < rawdata -+ * -+ * The file "rawdata" can be easily generated from a HISAX B-channel -+ * hex dump (CF CF CF 02 ...) using the following perl script: -+ * -+ * while(<>) { -+ * @hexlist = split ' '; -+ * while ($hexstr = shift(@hexlist)) { -+ * printf "%c", hex($hexstr); -+ * } -+ * } -+ * -+ */ -+ -+#ifdef DEBUGME -+#include -+#endif -+ -+#include -+#include -+#include "rawhdlc.h" -+ -+/* There's actually an identical copy of this table in the PPP code -+ * (ppp_crc16_table), but I don't want this code dependent on PPP -+ */ -+ -+// static -+__u16 fcstab[256] = -+{ -+ 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, -+ 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, -+ 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, -+ 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, -+ 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, -+ 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, -+ 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, -+ 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, -+ 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, -+ 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, -+ 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, -+ 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, -+ 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, -+ 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, -+ 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, -+ 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, -+ 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, -+ 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, -+ 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, -+ 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, -+ 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, -+ 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, -+ 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, -+ 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, -+ 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, -+ 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, -+ 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, -+ 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, -+ 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, -+ 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, -+ 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, -+ 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78 -+}; -+ -+#define HDLC_ZERO_SEARCH 0 -+#define HDLC_FLAG_SEARCH 1 -+#define HDLC_FLAG_FOUND 2 -+#define HDLC_FRAME_FOUND 3 -+#define HDLC_NULL 4 -+#define HDLC_PART 5 -+#define HDLC_FULL 6 -+ -+#define HDLC_FLAG_VALUE 0x7e -+ -+ -+#define MAKE_RAW_BYTE for (j=0; j<8; j++) { \ -+ bitcnt++;\ -+ out_val >>= 1;\ -+ if (val & 1) {\ -+ s_one++;\ -+ out_val |= 0x80;\ -+ } else {\ -+ s_one = 0;\ -+ out_val &= 0x7f;\ -+ }\ -+ if (bitcnt==8) {\ -+ if (d_cnt == dsize) return 0;\ -+ dst[d_cnt++] = out_val;\ -+ bitcnt = 0;\ -+ }\ -+ if (s_one == 5) {\ -+ out_val >>= 1;\ -+ out_val &= 0x7f;\ -+ bitcnt++;\ -+ s_one = 0;\ -+ }\ -+ if (bitcnt==8) {\ -+ if (d_cnt == dsize) return 0;\ -+ dst[d_cnt++] = out_val;\ -+ bitcnt = 0;\ -+ }\ -+ val >>= 1;\ -+ } -+ -+/* Optimization suggestion: If needed, this function could be -+ * dramatically sped up using a state machine. Each state would -+ * correspond to having seen N one bits, and being offset M bits into -+ * the current output byte. N ranges from 0 to 4, M from 0 to 7, so -+ * we need 5*8 = 35 states. Each state would have a table with 256 -+ * entries, one for each input character. Each entry would contain -+ * three output characters, an output state, an a byte increment -+ * that's either 1 or 2. All this could fit in four bytes; so we need -+ * 4 bytes * 256 characters = 1 KB for each state (35 KB total). Zero -+ * the output buffer before you start. For each character in your -+ * input, you look it up in the current state's table and get three -+ * bytes to be or'ed into the output at the current byte offset, and -+ * an byte increment to move your pointer forward. A simple Perl -+ * script could generate the tables. Given HDLC semantics, probably -+ * would be better to set output to all 1s, then use ands instead of ors. -+ * A smaller state machine could operate on nibbles instead of bytes. -+ * A state machine for 32-bit architectures could use word offsets -+ * instead of byte offsets, requiring 5*32 = 160 states; probably -+ * best to work on nibbles in such a case. -+ */ -+ -+ -+int make_raw_hdlc_data(u_char *src, u_int slen, u_char *dst, u_int dsize) -+{ -+ register u_int i,d_cnt=0; -+ register u_char j; -+ register u_char val; -+ register u_char s_one = 0; -+ register u_char out_val = 0; -+ register u_char bitcnt = 0; -+ u_int fcs; -+ -+ -+ dst[d_cnt++] = HDLC_FLAG_VALUE; -+ fcs = PPP_INITFCS; -+ for (i=0; i>8) & 0xff; -+ MAKE_RAW_BYTE; -+ val = HDLC_FLAG_VALUE; -+ for (j=0; j<8; j++) { -+ bitcnt++; -+ out_val >>= 1; -+ if (val & 1) -+ out_val |= 0x80; -+ else -+ out_val &= 0x7f; -+ if (bitcnt==8) { -+ if (d_cnt == dsize) return 0; -+ dst[d_cnt++] = out_val; -+ bitcnt = 0; -+ } -+ val >>= 1; -+ } -+ if (bitcnt) { -+ while (8>bitcnt++) { -+ out_val >>= 1; -+ out_val |= 0x80; -+ } -+ if (d_cnt == dsize) return 0; -+ dst[d_cnt++] = out_val; -+ } -+ -+ return d_cnt; -+} -+ -+void init_hdlc_state(struct hdlc_state *stateptr, int mode) -+{ -+ stateptr->state = HDLC_ZERO_SEARCH; -+ stateptr->r_one = 0; -+ stateptr->r_val = 0; -+ stateptr->o_bitcnt = 0; -+ stateptr->i_bitcnt = 0; -+ stateptr->insane_mode = mode; -+} -+ -+/* Optimization suggestion: A similar state machine could surely -+ * be developed for this function as well. -+ */ -+ -+int read_raw_hdlc_data(struct hdlc_state *saved_state, -+ u_char *src, u_int slen, u_char *dst, u_int dsize) -+{ -+ int retval=0; -+ register u_char val; -+ register u_char state = saved_state->state; -+ register u_char r_one = saved_state->r_one; -+ register u_char r_val = saved_state->r_val; -+ register u_int o_bitcnt = saved_state->o_bitcnt; -+ register u_int i_bitcnt = saved_state->i_bitcnt; -+ register u_int fcs = saved_state->fcs; -+ register u_int *isrc = (u_int *) src; -+ -+ /* Use i_bitcnt (bit offset into source buffer) to reload "val" -+ * in case we're starting up again partway through a source buffer -+ */ -+ -+ if ((i_bitcnt >> 3) < slen) { -+ if (saved_state->insane_mode==1) { -+ val = isrc[(i_bitcnt >> 3)] & 0xff; -+ } else if (saved_state->insane_mode==2) { -+ val = (isrc[i_bitcnt >> 3] >>8) & 0xff; -+ } else { -+ val = src[i_bitcnt >> 3]; -+ } -+ val >>= i_bitcnt & 7; -+ } -+ -+ /* One bit per loop. Keep going until we've got something to -+ * report (retval != 0), or we exhaust the source buffer -+ */ -+ -+ while ((retval == 0) && ((i_bitcnt >> 3) < slen)) { -+ if ((i_bitcnt & 7) == 0) { -+ if (saved_state->insane_mode==1) { -+ val = isrc[(i_bitcnt >> 3)] & 0xff; -+ } else if (saved_state->insane_mode==2) { -+ val = (isrc[i_bitcnt >> 3] >>8) & 0xff; -+ } else { -+ val = src[i_bitcnt >> 3]; -+ } -+#ifdef DEBUGME -+ printf("Input byte %d: 0x%2x\n", i_bitcnt>>3, val); -+#endif -+ if (val == 0xff) { -+ state = HDLC_ZERO_SEARCH; -+ o_bitcnt = 0; -+ r_one = 0; -+ i_bitcnt += 8; -+ continue; -+ } -+ } -+ -+#ifdef DEBUGME -+ /* printf("Data bit=%d (%d/%d)\n", val&1, i_bitcnt>>3, i_bitcnt&7);*/ -+#endif -+ -+ if (state == HDLC_ZERO_SEARCH) { -+ if (val & 1) { -+ r_one++; -+ } else { -+ r_one=0; -+ state= HDLC_FLAG_SEARCH; -+ } -+ } else if (state == HDLC_FLAG_SEARCH) { -+ if (val & 1) { -+ r_one++; -+ if (r_one>6) { -+ state=HDLC_ZERO_SEARCH; -+ } -+ } else { -+ if (r_one==6) { -+ o_bitcnt=0; -+ r_val=0; -+ state=HDLC_FLAG_FOUND; -+ } -+ r_one=0; -+ } -+ } else if (state == HDLC_FLAG_FOUND) { -+ if (val & 1) { -+ r_one++; -+ if (r_one>6) { -+ state=HDLC_ZERO_SEARCH; -+ } else { -+ r_val >>= 1; -+ r_val |= 0x80; -+ o_bitcnt++; -+ } -+ } else { -+ if (r_one==6) { -+ o_bitcnt=0; -+ r_val=0; -+ r_one=0; -+ i_bitcnt++; -+ val >>= 1; -+ continue; -+ } else if (r_one!=5) { -+ r_val >>= 1; -+ r_val &= 0x7f; -+ o_bitcnt++; -+ } -+ r_one=0; -+ } -+ if ((state != HDLC_ZERO_SEARCH) && -+ !(o_bitcnt & 7)) { -+#ifdef DEBUGME -+ printf("HDLC_FRAME_FOUND at i_bitcnt:%d\n",i_bitcnt); -+#endif -+ state=HDLC_FRAME_FOUND; -+ fcs = PPP_INITFCS; -+ dst[0] = r_val; -+ fcs = PPP_FCS (fcs, r_val); -+ } -+ } else if (state == HDLC_FRAME_FOUND) { -+ if (val & 1) { -+ r_one++; -+ if (r_one>6) { -+ state=HDLC_ZERO_SEARCH; -+ o_bitcnt=0; -+ } else { -+ r_val >>= 1; -+ r_val |= 0x80; -+ o_bitcnt++; -+ } -+ } else { -+ if (r_one==6) { -+ r_val=0; -+ r_one=0; -+ o_bitcnt++; -+ if (o_bitcnt & 7) { -+ /* Alignment error */ -+#ifdef DEBUGME -+ printf("Alignment error\n"); -+#endif -+ state=HDLC_FLAG_SEARCH; -+ retval = -1; -+ } else if (fcs==PPP_GOODFCS) { -+ /* Valid frame */ -+ state=HDLC_FLAG_FOUND; -+ retval = (o_bitcnt>>3)-3; -+ } else { -+ /* CRC error */ -+#ifdef DEBUGME -+ printf("CRC error; fcs was 0x%x, should have been 0x%x\n", fcs, PPP_GOODFCS); -+#endif -+ state=HDLC_FLAG_FOUND; -+ retval = -1; -+ } -+ } else if (r_one==5) { -+ r_one=0; -+ i_bitcnt++; -+ val >>= 1; -+ continue; -+ } else { -+ r_val >>= 1; -+ r_val &= 0x7f; -+ o_bitcnt++; -+ } -+ r_one=0; -+ } -+ if ((state == HDLC_FRAME_FOUND) && -+ !(o_bitcnt & 7)) { -+ if ((o_bitcnt>>3)>=dsize) { -+ /* Buffer overflow error */ -+#ifdef DEBUGME -+ printf("Buffer overflow error\n"); -+#endif -+ r_val=0; -+ state=HDLC_FLAG_SEARCH; -+ retval = -1; -+ } else { -+ dst[(o_bitcnt>>3)-1] = r_val; -+ fcs = PPP_FCS (fcs, r_val); -+#ifdef DEBUGME -+ printf("Output byte %d: 0x%02x; FCS 0x%04x\n", (o_bitcnt>>3)-1, r_val, fcs); -+#endif -+ } -+ } -+ } -+ i_bitcnt ++; -+ val >>= 1; -+ } -+ -+ /* We exhausted the source buffer before anything else happened -+ * (retval==0). Reset i_bitcnt in expectation of a new source -+ * buffer. Other, we either had an error or a valid frame, so -+ * reset o_bitcnt in expectation of a new destination buffer. -+ */ -+ -+ if (retval == 0) { -+ i_bitcnt = 0; -+ } else { -+ o_bitcnt = 0; -+ } -+ -+ saved_state->state = state; -+ saved_state->r_one = r_one; -+ saved_state->r_val = r_val; -+ saved_state->fcs = fcs; -+ saved_state->o_bitcnt = o_bitcnt; -+ saved_state->i_bitcnt = i_bitcnt; -+ -+ return (retval); -+} -+ -+ -+ -+#ifdef DEBUGME -+ -+char buffer[1024]; -+char obuffer[1024]; -+ -+main() -+{ -+ int buflen=0; -+ int len; -+ struct hdlc_state hdlc_state; -+ -+ while((buffer[buflen] = getc(stdin)) != EOF && buflen<1024) buflen++; -+ -+ printf("buflen = %d\n", buflen); -+ -+ init_hdlc_state(&hdlc_state, 0); -+ -+ while (len = read_raw_hdlc_data(&hdlc_state,buffer,buflen,obuffer,1024)) { -+ if (len == -1) printf("Error @ byte %d/bit %d\n", -+ hdlc_state.i_bitcnt>>3, hdlc_state.i_bitcnt & 7); -+ else { -+ printf("Frame received: len %d\n", len); -+ } -+ } -+ -+ printf("Done\n"); -+} -+ -+#endif -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/rawhdlc.h linux-2.4.29/drivers/isdn/hisax/rawhdlc.h ---- linux-2.4.29.old/drivers/isdn/hisax/rawhdlc.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/rawhdlc.h 2005-03-22 15:06:48.076784000 +0100 -@@ -0,0 +1,28 @@ -+/* $Id: rawhdlc.h,v 1.5 2001/09/24 13:22:57 kai Exp $ -+ * -+ * Author Brent Baccala -+ * Copyright by Brent Baccala -+ * -+ * This software may be used and distributed according to the terms -+ * of the GNU General Public License, incorporated herein by reference. -+ * -+ */ -+ -+#ifndef RAWHDLC_H -+struct hdlc_state { -+ char insane_mode; -+ u_char state; -+ u_char r_one; -+ u_char r_val; -+ u_int o_bitcnt; -+ u_int i_bitcnt; -+ u_int fcs; -+}; -+ -+ -+int make_raw_hdlc_data(u_char *src, u_int slen, u_char *dst, u_int dsize); -+void init_hdlc_state(struct hdlc_state *stateptr, int mode); -+int read_raw_hdlc_data(struct hdlc_state *saved_state, -+ u_char *src, u_int slen, u_char *dst, u_int dsize); -+#define RAWHDLC_H -+#endif -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/s0box.c linux-2.4.29/drivers/isdn/hisax/s0box.c ---- linux-2.4.29.old/drivers/isdn/hisax/s0box.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/s0box.c 2005-03-22 15:06:48.092781568 +0100 -@@ -1,4 +1,4 @@ --/* $Id: s0box.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: s0box.c,v 2.6 2001/09/24 13:22:57 kai Exp $ - * - * low level stuff for Creatix S0BOX - * -@@ -18,7 +18,7 @@ - #include "isdnl1.h" - - extern const char *CardType[]; --const char *s0box_revision = "$Revision: 1.1.4.1 $"; -+const char *s0box_revision = "$Revision: 2.6 $"; - - static inline void - writereg(unsigned int padr, signed int addr, u_char off, u_char val) { -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/saphir.c linux-2.4.29/drivers/isdn/hisax/saphir.c ---- linux-2.4.29.old/drivers/isdn/hisax/saphir.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/saphir.c 2005-03-22 15:06:48.107779288 +0100 -@@ -1,4 +1,4 @@ --/* $Id: saphir.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: saphir.c,v 1.10 2001/09/24 13:22:57 kai Exp $ - * - * low level stuff for HST Saphir 1 - * -@@ -20,7 +20,7 @@ - #include "isdnl1.h" - - extern const char *CardType[]; --static char *saphir_rev = "$Revision: 1.1.4.1 $"; -+static char *saphir_rev = "$Revision: 1.10 $"; - - #define byteout(addr,val) outb(val,addr) - #define bytein(addr) inb(addr) -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/sedlbauer.c linux-2.4.29/drivers/isdn/hisax/sedlbauer.c ---- linux-2.4.29.old/drivers/isdn/hisax/sedlbauer.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/sedlbauer.c 2005-03-22 15:06:48.123776856 +0100 -@@ -1,4 +1,4 @@ --/* $Id: sedlbauer.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: sedlbauer.c,v 1.34 2002/02/09 21:00:57 keil Exp $ - * - * low level stuff for Sedlbauer cards - * includes support for the Sedlbauer speed star (speed star II), -@@ -48,18 +48,19 @@ - #include "isar.h" - #include "isdnl1.h" - #include --#include -+#include - - extern const char *CardType[]; - --const char *Sedlbauer_revision = "$Revision: 1.1.4.1 $"; -+const char *Sedlbauer_revision = "$Revision: 1.34 $"; - - const char *Sedlbauer_Types[] = - {"None", "speed card/win", "speed star", "speed fax+", - "speed win II / ISDN PC/104", "speed star II", "speed pci", -- "speed fax+ pyramid", "speed fax+ pci"}; -+ "speed fax+ pyramid", "speed fax+ pci", "HST Saphir III"}; - - #define PCI_SUBVENDOR_SPEEDFAX_PYRAMID 0x51 -+#define PCI_SUBVENDOR_HST_SAPHIR3 0x52 - #define PCI_SUBVENDOR_SEDLBAUER_PCI 0x53 - #define PCI_SUBVENDOR_SPEEDFAX_PCI 0x54 - #define PCI_SUB_ID_SEDLBAUER 0x01 -@@ -72,6 +73,7 @@ - #define SEDL_SPEED_PCI 6 - #define SEDL_SPEEDFAX_PYRAMID 7 - #define SEDL_SPEEDFAX_PCI 8 -+#define HST_SAPHIR3 9 - - #define SEDL_CHIP_TEST 0 - #define SEDL_CHIP_ISAC_HSCX 1 -@@ -531,21 +533,6 @@ - - static struct pci_dev *dev_sedl __devinitdata = NULL; - --#ifdef __ISAPNP__ --static struct isapnp_device_id sedl_ids[] __initdata = { -- { ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x01), -- ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x01), -- (unsigned long) "Speed win" }, -- { ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x02), -- ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x02), -- (unsigned long) "Speed Fax+" }, -- { 0, } --}; -- --static struct isapnp_device_id *pdev = &sedl_ids[0]; --static struct pci_bus *pnp_c __devinitdata = NULL; --#endif -- - int __devinit - setup_sedlbauer(struct IsdnCard *card) - { -@@ -581,57 +568,6 @@ - bytecnt = 16; - } - } else { --#ifdef __ISAPNP__ -- if (isapnp_present()) { -- struct pci_bus *pb; -- struct pci_dev *pd; -- -- while(pdev->card_vendor) { -- if ((pb = isapnp_find_card(pdev->card_vendor, -- pdev->card_device, pnp_c))) { -- pnp_c = pb; -- pd = NULL; -- if ((pd = isapnp_find_dev(pnp_c, -- pdev->vendor, pdev->function, pd))) { -- printk(KERN_INFO "HiSax: %s detected\n", -- (char *)pdev->driver_data); -- pd->prepare(pd); -- pd->deactivate(pd); -- pd->activate(pd); -- card->para[1] = -- pd->resource[0].start; -- card->para[0] = -- pd->irq_resource[0].start; -- if (!card->para[0] || !card->para[1]) { -- printk(KERN_ERR "Sedlbauer PnP:some resources are missing %ld/%lx\n", -- card->para[0], card->para[1]); -- pd->deactivate(pd); -- return(0); -- } -- cs->hw.sedl.cfg_reg = card->para[1]; -- cs->irq = card->para[0]; -- if (pdev->function == ISAPNP_FUNCTION(0x2)) { -- cs->subtyp = SEDL_SPEED_FAX; -- cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR; -- bytecnt = 16; -- } else { -- cs->subtyp = SEDL_SPEED_CARD_WIN; -- cs->hw.sedl.chip = SEDL_CHIP_TEST; -- } -- goto ready; -- } else { -- printk(KERN_ERR "Sedlbauer PnP: PnP error card found, no device\n"); -- return(0); -- } -- } -- pdev++; -- pnp_c=NULL; -- } -- if (!pdev->card_vendor) { -- printk(KERN_INFO "Sedlbauer PnP: no ISAPnP card found\n"); -- } -- } --#endif - /* Probe for Sedlbauer speed pci */ - #if CONFIG_PCI - if (!pci_present()) { -@@ -647,15 +583,15 @@ - printk(KERN_WARNING "Sedlbauer: No IRQ for PCI card found\n"); - return(0); - } -- cs->hw.sedl.cfg_reg = pci_resource_start(dev_sedl, 0); -+ cs->hw.sedl.cfg_reg = pci_resource_start_io(dev_sedl, 0); - } else { - printk(KERN_WARNING "Sedlbauer: No PCI card found\n"); - return(0); - } - cs->irq_flags |= SA_SHIRQ; - cs->hw.sedl.bus = SEDL_BUS_PCI; -- sub_vendor_id = dev_sedl->subsystem_vendor; -- sub_id = dev_sedl->subsystem_device; -+ pci_get_sub_vendor(dev_sedl,sub_vendor_id); -+ pci_get_sub_system(dev_sedl,sub_id); - printk(KERN_INFO "Sedlbauer: PCI subvendor:%x subid %x\n", - sub_vendor_id, sub_id); - printk(KERN_INFO "Sedlbauer: PCI base adr %#x\n", -@@ -670,6 +606,9 @@ - } else if (sub_vendor_id == PCI_SUBVENDOR_SPEEDFAX_PCI) { - cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR; - cs->subtyp = SEDL_SPEEDFAX_PCI; -+ } else if (sub_vendor_id == PCI_SUBVENDOR_HST_SAPHIR3) { -+ cs->hw.sedl.chip = SEDL_CHIP_IPAC; -+ cs->subtyp = HST_SAPHIR3; - } else if (sub_vendor_id == PCI_SUBVENDOR_SEDLBAUER_PCI) { - cs->hw.sedl.chip = SEDL_CHIP_IPAC; - cs->subtyp = SEDL_SPEED_PCI; -@@ -683,8 +622,8 @@ - cs->hw.sedl.reset_off = SEDL_ISAR_PCI_ISAR_RESET_OFF; - byteout(cs->hw.sedl.cfg_reg, 0xff); - byteout(cs->hw.sedl.cfg_reg, 0x00); -- byteout(cs->hw.sedl.cfg_reg+ 2, 0xdd); -- byteout(cs->hw.sedl.cfg_reg+ 5, 0x02); -+ byteout(cs->hw.sedl.cfg_reg +2, 0xdd); -+ byteout(cs->hw.sedl.cfg_reg +5, 0x02); - byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_on); - save_flags(flags); - sti(); -@@ -697,7 +636,7 @@ - return (0); - #endif /* CONFIG_PCI */ - } --ready: -+ - /* In case of the sedlbauer pcmcia card, this region is in use, - * reserved for us by the card manager. So we do not check it - * here, it would fail. -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/sportster.c linux-2.4.29/drivers/isdn/hisax/sportster.c ---- linux-2.4.29.old/drivers/isdn/hisax/sportster.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/sportster.c 2005-03-22 15:06:48.169769864 +0100 -@@ -1,4 +1,4 @@ --/* $Id: sportster.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: sportster.c,v 1.16 2001/09/24 13:22:57 kai Exp $ - * - * low level stuff for USR Sportster internal TA - * -@@ -20,7 +20,7 @@ - #include "isdnl1.h" - - extern const char *CardType[]; --const char *sportster_revision = "$Revision: 1.1.4.1 $"; -+const char *sportster_revision = "$Revision: 1.16 $"; - - #define byteout(addr,val) outb(val,addr) - #define bytein(addr) inb(addr) -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/st5481-debug.h linux-2.4.29/drivers/isdn/hisax/st5481-debug.h ---- linux-2.4.29.old/drivers/isdn/hisax/st5481-debug.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/st5481-debug.h 2005-03-22 15:06:48.184767584 +0100 -@@ -0,0 +1,103 @@ -+#define ST5481_DEBUG 0x0 -+ -+#if ST5481_DEBUG -+ -+ -+/* -+ DEBUG flags. Set compile option ST5481_DEBUG with the following bits set to trace -+ the given subsections: -+ -+ 0x01: USB -+ 0x02: D -+ 0x04: B -+ 0x08: PH -+ 0x10: PACKET_DUMP D out -+ 0x20: ISO_DUMP D out -+ 0x40: PACKET_DUMP D in -+ 0x80: ISO_DUMP in -+ 0x100: PACKET_DUMP B out -+ 0x200: ISO_DUMP B out -+ 0x400: PACKET_DUMP B in -+*/ -+ -+#define DBG(level, format, arg...) \ -+if (level & ST5481_DEBUG) \ -+printk(KERN_DEBUG __FUNCTION__ ": " format "\n" , ## arg) \ -+ -+static inline void -+dump_packet(const char *name,const u_char *data,int pkt_len) -+{ -+#define DUMP_HDR_SIZE 200 -+#define DUMP_TLR_SIZE 8 -+ if (pkt_len) { -+ int i,len1,len2; -+ -+ printk(KERN_DEBUG "%s: length=%d,data=",name,pkt_len); -+ -+ if (pkt_len > DUMP_HDR_SIZE+ DUMP_TLR_SIZE) { -+ len1 = DUMP_HDR_SIZE; -+ len2 = DUMP_TLR_SIZE; -+ } else { -+ len1 = pkt_len > DUMP_HDR_SIZE ? DUMP_HDR_SIZE : pkt_len; -+ len2 = 0; -+ } -+ for (i = 0; i < len1; ++i) { -+ printk ("%.2x", data[i]); -+ } -+ if (len2) { -+ printk (".."); -+ for (i = pkt_len-DUMP_TLR_SIZE; i < pkt_len; ++i) { -+ printk ("%.2x", data[i]); -+ } -+ } -+ printk ("\n"); -+ } -+#undef DUMP_HDR_SIZE -+#undef DUMP_TLR_SIZE -+} -+ -+static inline void -+dump_iso_packet(const char *name,urb_t *urb) -+{ -+ int i,j; -+ int len,ofs; -+ u_char *data; -+ -+ printk(KERN_DEBUG "%s: packets=%d,errors=%d\n", -+ name,urb->number_of_packets,urb->error_count); -+ for (i = 0; i < urb->number_of_packets; ++i) { -+ if (urb->pipe & USB_DIR_IN) { -+ len = urb->iso_frame_desc[i].actual_length; -+ } else { -+ len = urb->iso_frame_desc[i].length; -+ } -+ ofs = urb->iso_frame_desc[i].offset; -+ printk(KERN_DEBUG "len=%.2d,ofs=%.3d ",len,ofs); -+ if (len) { -+ data = urb->transfer_buffer+ofs; -+ for (j=0; j < len; j++) { -+ printk ("%.2x", data[j]); -+ } -+ } -+ printk("\n"); -+ } -+} -+ -+#define DUMP_PACKET(level,data,count) \ -+ if (level & ST5481_DEBUG) dump_packet(__FUNCTION__,data,count) -+#define DUMP_SKB(level,skb) \ -+ if ((level & ST5481_DEBUG) && skb) dump_packet(__FUNCTION__,skb->data,skb->len) -+#define DUMP_ISO_PACKET(level,urb) \ -+ if (level & ST5481_DEBUG) dump_iso_packet(__FUNCTION__,urb) -+ -+#else -+ -+#define DBG(level,format, arg...) do {} while (0) -+#define DUMP_PACKET(level,data,count) do {} while (0) -+#define DUMP_SKB(level,skb) do {} while (0) -+#define DUMP_ISO_PACKET(level,urb) do {} while (0) -+ -+#endif -+ -+ -+ -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/st5481.h linux-2.4.29/drivers/isdn/hisax/st5481.h ---- linux-2.4.29.old/drivers/isdn/hisax/st5481.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/st5481.h 2005-03-22 15:06:48.201765000 +0100 -@@ -219,15 +219,15 @@ - #define L1_EVENT_COUNT (EV_TIMER3 + 1) - - #define ERR(format, arg...) \ --printk(KERN_ERR "%s:%s: " format "\n" , __FILE__, __FUNCTION__ , ## arg) -+printk(KERN_ERR __FILE__ ": " __FUNCTION__ ": " format "\n" , ## arg) - - #define WARN(format, arg...) \ --printk(KERN_WARNING "%s:%s: " format "\n" , __FILE__, __FUNCTION__ , ## arg) -+printk(KERN_WARNING __FILE__ ": " __FUNCTION__ ": " format "\n" , ## arg) - - #define INFO(format, arg...) \ --printk(KERN_INFO "%s:%s: " format "\n" , __FILE__, __FUNCTION__ , ## arg) -+printk(KERN_INFO __FILE__ ": " __FUNCTION__ ": " format "\n" , ## arg) - --#include "isdnhdlc.h" -+#include "st5481_hdlc.h" - #include "fsm.h" - #include "hisax_if.h" - #include -@@ -236,7 +236,7 @@ - * FIFO handling - */ - --/* Generic FIFO structure */ -+/* Generic FIFO structure */ - struct fifo { - u_char r,w,count,size; - spinlock_t lock; -@@ -270,7 +270,7 @@ - index = -1; - } else { - // Return index where to get the next data to add to the FIFO -- index = fifo->w++ & (fifo->size-1); -+ index = fifo->w++ & (fifo->size-1); - fifo->count++; - } - spin_unlock_irqrestore(&fifo->lock, flags); -@@ -289,13 +289,13 @@ - return -1; - } - -- spin_lock_irqsave(&fifo->lock, flags); -+ spin_lock_irqsave(&fifo->lock, flags); - if (!fifo->count) { - // FIFO empty - index = -1; - } else { - // Return index where to get the next data from the FIFO -- index = fifo->r++ & (fifo->size-1); -+ index = fifo->r++ & (fifo->size-1); - fifo->count--; - } - spin_unlock_irqrestore(&fifo->lock, flags); -@@ -309,7 +309,7 @@ - typedef void (*ctrl_complete_t)(void *); - - typedef struct ctrl_msg { -- struct usb_ctrlrequest dr; -+ devrequest dr; - ctrl_complete_t complete; - void *context; - } ctrl_msg; -@@ -336,7 +336,7 @@ - }; - - struct st5481_d_out { -- struct isdnhdlc_vars hdlc_state; -+ struct hdlc_vars hdlc_state; - struct urb *urb[2]; /* double buffering */ - unsigned long busy; - struct sk_buff *tx_skb; -@@ -344,7 +344,7 @@ - }; - - struct st5481_b_out { -- struct isdnhdlc_vars hdlc_state; -+ struct hdlc_vars hdlc_state; - struct urb *urb[2]; /* double buffering */ - u_char flow_event; - u_long busy; -@@ -352,7 +352,7 @@ - }; - - struct st5481_in { -- struct isdnhdlc_vars hdlc_state; -+ struct hdlc_vars hdlc_state; - struct urb *urb[2]; /* double buffering */ - int mode; - int bufsize; -@@ -478,7 +478,7 @@ - if (level & __debug_variable) dump_iso_packet(__FUNCTION__,urb) - - static void __attribute__((unused)) --dump_iso_packet(const char *name,struct urb *urb) -+dump_iso_packet(const char *name,urb_t *urb) - { - int i,j; - int len,ofs; -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/st5481_b.c linux-2.4.29/drivers/isdn/hisax/st5481_b.c ---- linux-2.4.29.old/drivers/isdn/hisax/st5481_b.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/st5481_b.c 2005-03-22 15:06:48.216762720 +0100 -@@ -67,28 +67,24 @@ - bytes_sent = buf_size - len; - if (skb->len < bytes_sent) - bytes_sent = skb->len; -- { /* swap tx bytes to get hearable audio data */ -- register unsigned char *src = skb->data; -- register unsigned char *dest = urb->transfer_buffer+len; -- register unsigned int count; -- for (count = 0; count < bytes_sent; count++) -- *dest++ = isdnhdlc_bit_rev_tab[*src++]; -- } -+ -+ memcpy(urb->transfer_buffer+len, skb->data, bytes_sent); -+ - len += bytes_sent; - } else { -- len += isdnhdlc_encode(&b_out->hdlc_state, -- skb->data, skb->len, &bytes_sent, -- urb->transfer_buffer+len, buf_size-len); -+ len += hdlc_encode(&b_out->hdlc_state, -+ skb->data, skb->len, &bytes_sent, -+ urb->transfer_buffer+len, buf_size-len); - } - - skb_pull(skb, bytes_sent); -- -+ - if (!skb->len) { - // Frame sent - b_out->tx_skb = NULL; - B_L1L2(bcs, PH_DATA | CONFIRM, (void *) skb->truesize); - dev_kfree_skb_any(skb); -- -+ - /* if (!(bcs->tx_skb = skb_dequeue(&bcs->sq))) { */ - /* st5481B_sched_event(bcs, B_XMTBUFREADY); */ - /* } */ -@@ -99,9 +95,9 @@ - len = buf_size; - } else { - // Send flags -- len += isdnhdlc_encode(&b_out->hdlc_state, -- NULL, 0, &bytes_sent, -- urb->transfer_buffer+len, buf_size-len); -+ len += hdlc_encode(&b_out->hdlc_state, -+ NULL, 0, &bytes_sent, -+ urb->transfer_buffer+len, buf_size-len); - } - } - } -@@ -213,7 +209,7 @@ - if (bcs->mode != L1_MODE_NULL) { - // Open the B channel - if (bcs->mode != L1_MODE_TRANS) { -- isdnhdlc_out_init(&b_out->hdlc_state, 0, bcs->mode == L1_MODE_HDLC_56K); -+ hdlc_out_init(&b_out->hdlc_state, 0, bcs->mode == L1_MODE_HDLC_56K); - } - st5481_usb_pipe_reset(adapter, (bcs->channel+1)*2, NULL, NULL); - -@@ -279,7 +275,7 @@ - usb_b_out_complete, bcs); - } - --static void st5481_release_b_out(struct st5481_bcs *bcs) -+static void __devexit st5481_release_b_out(struct st5481_bcs *bcs) - { - struct st5481_b_out *b_out = &bcs->b_out; - -@@ -320,7 +316,7 @@ - /* - * Release buffers and URBs for the B channels - */ --void st5481_release_b(struct st5481_bcs *bcs) -+void __devexit st5481_release_b(struct st5481_bcs *bcs) - { - DBG(4,""); - -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/st5481_d.c linux-2.4.29/drivers/isdn/hisax/st5481_d.c ---- linux-2.4.29.old/drivers/isdn/hisax/st5481_d.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/st5481_d.c 2005-03-22 15:06:48.231760440 +0100 -@@ -162,8 +162,8 @@ - {ST_L1_F8, EV_TIMER3, l1_timer3}, - {ST_L1_F8, EV_IND_DP, l1_go_f3}, - {ST_L1_F8, EV_IND_AP, l1_go_f6}, -- {ST_L1_F8, EV_IND_AI8, l1_go_f7}, -- {ST_L1_F8, EV_IND_AI10, l1_go_f7}, -+ {ST_L1_F8, EV_IND_AI8, l1_go_f8}, -+ {ST_L1_F8, EV_IND_AI10, l1_go_f8}, - {ST_L1_F8, EV_IND_RSY, l1_ignore}, - }; - -@@ -297,7 +297,7 @@ - unsigned int num_packets, packet_offset; - int len, buf_size, bytes_sent; - struct sk_buff *skb; -- struct iso_packet_descriptor *desc; -+ iso_packet_descriptor_t *desc; - - if (d_out->fsm.state != ST_DOUT_NORMAL) - return; -@@ -313,15 +313,15 @@ - buf_size = NUM_ISO_PACKETS_D * SIZE_ISO_PACKETS_D_OUT; - - if (skb) { -- len = isdnhdlc_encode(&d_out->hdlc_state, -- skb->data, skb->len, &bytes_sent, -- urb->transfer_buffer, buf_size); -+ len = hdlc_encode(&d_out->hdlc_state, -+ skb->data, skb->len, &bytes_sent, -+ urb->transfer_buffer, buf_size); - skb_pull(skb,bytes_sent); - } else { - // Send flags or idle -- len = isdnhdlc_encode(&d_out->hdlc_state, -- NULL, 0, &bytes_sent, -- urb->transfer_buffer, buf_size); -+ len = hdlc_encode(&d_out->hdlc_state, -+ NULL, 0, &bytes_sent, -+ urb->transfer_buffer, buf_size); - } - - if (len < buf_size) { -@@ -413,7 +413,7 @@ - - DBG(2,"len=%d",skb->len); - -- isdnhdlc_out_init(&d_out->hdlc_state, 1, 0); -+ hdlc_out_init(&d_out->hdlc_state, 1, 0); - - if (test_and_set_bit(buf_nr, &d_out->busy)) { - WARN("ep %d urb %d busy %#lx", EP_D_OUT, buf_nr, d_out->busy); -@@ -422,9 +422,9 @@ - urb = d_out->urb[buf_nr]; - - DBG_SKB(0x10, skb); -- len = isdnhdlc_encode(&d_out->hdlc_state, -- skb->data, skb->len, &bytes_sent, -- urb->transfer_buffer, 16); -+ len = hdlc_encode(&d_out->hdlc_state, -+ skb->data, skb->len, &bytes_sent, -+ urb->transfer_buffer, 16); - skb_pull(skb, bytes_sent); - - if(len < 16) -@@ -673,7 +673,7 @@ - usb_d_out_complete, adapter); - } - --static void st5481_release_d_out(struct st5481_adapter *adapter) -+static void __devexit st5481_release_d_out(struct st5481_adapter *adapter) - { - struct st5481_d_out *d_out = &adapter->d_out; - -@@ -723,7 +723,7 @@ - return retval; - } - --void st5481_release_d(struct st5481_adapter *adapter) -+void __devexit st5481_release_d(struct st5481_adapter *adapter) - { - DBG(2,""); - -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/st5481_init.c linux-2.4.29/drivers/isdn/hisax/st5481_init.c ---- linux-2.4.29.old/drivers/isdn/hisax/st5481_init.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/st5481_init.c 2005-03-22 15:06:48.268754816 +0100 -@@ -14,6 +14,7 @@ - * TODO: - * - * b layer1 delay? -+ * hdlc as module - * hotplug / unregister issues - * mod_inc/dec_use_count - * unify parts of d/b channel usb handling -@@ -177,7 +178,7 @@ - static struct usb_driver st5481_usb_driver = { - name: "st5481_usb", - probe: probe_st5481, -- disconnect: __devexit_p(disconnect_st5481), -+ disconnect: disconnect_st5481, - id_table: st5481_ids, - }; - -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/st5481_usb.c linux-2.4.29/drivers/isdn/hisax/st5481_usb.c ---- linux-2.4.29.old/drivers/isdn/hisax/st5481_usb.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/st5481_usb.c 2005-03-22 15:06:48.284752384 +0100 -@@ -41,9 +41,9 @@ - (unsigned char *)&ctrl->msg_fifo.data[r_index]; - - DBG(1,"request=0x%02x,value=0x%04x,index=%x", -- ((struct ctrl_msg *)urb->setup_packet)->dr.bRequest, -- ((struct ctrl_msg *)urb->setup_packet)->dr.wValue, -- ((struct ctrl_msg *)urb->setup_packet)->dr.wIndex); -+ ((struct ctrl_msg *)urb->setup_packet)->dr.request, -+ ((struct ctrl_msg *)urb->setup_packet)->dr.value, -+ ((struct ctrl_msg *)urb->setup_packet)->dr.index); - - // Prepare the URB - urb->dev = adapter->usb_dev; -@@ -69,11 +69,11 @@ - } - ctrl_msg = &ctrl->msg_fifo.data[w_index]; - -- ctrl_msg->dr.bRequestType = requesttype; -- ctrl_msg->dr.bRequest = request; -- ctrl_msg->dr.wValue = cpu_to_le16p(&value); -- ctrl_msg->dr.wIndex = cpu_to_le16p(&index); -- ctrl_msg->dr.wLength = 0; -+ ctrl_msg->dr.requesttype = requesttype; -+ ctrl_msg->dr.request = request; -+ ctrl_msg->dr.value = cpu_to_le16p(&value); -+ ctrl_msg->dr.index = cpu_to_le16p(&index); -+ ctrl_msg->dr.length = 0; - ctrl_msg->complete = complete; - ctrl_msg->context = context; - -@@ -140,17 +140,17 @@ - - ctrl_msg = (struct ctrl_msg *)urb->setup_packet; - -- if (ctrl_msg->dr.bRequest == USB_REQ_CLEAR_FEATURE) { -+ if (ctrl_msg->dr.request == USB_REQ_CLEAR_FEATURE) { - /* Special case handling for pipe reset */ -- le16_to_cpus(&ctrl_msg->dr.wIndex); -+ le16_to_cpus(&ctrl_msg->dr.index); - usb_endpoint_running(adapter->usb_dev, -- ctrl_msg->dr.wIndex & ~USB_DIR_IN, -- (ctrl_msg->dr.wIndex & USB_DIR_IN) == 0); -+ ctrl_msg->dr.index & ~USB_DIR_IN, -+ (ctrl_msg->dr.index & USB_DIR_IN) == 0); - - /* toggle is reset on clear */ - usb_settoggle(adapter->usb_dev, -- ctrl_msg->dr.wIndex & ~USB_DIR_IN, -- (ctrl_msg->dr.wIndex & USB_DIR_IN) == 0, -+ ctrl_msg->dr.index & ~USB_DIR_IN, -+ (ctrl_msg->dr.index & USB_DIR_IN) == 0, - 0); - - -@@ -235,7 +235,7 @@ - struct usb_interface_descriptor *altsetting; - struct usb_endpoint_descriptor *endpoint; - int status; -- struct urb *urb; -+ urb_t *urb; - u_char *buf; - - DBG(1,""); -@@ -307,7 +307,7 @@ - * Release buffers and URBs for the interrupt and control - * endpoint. - */ --void st5481_release_usb(struct st5481_adapter *adapter) -+void __devexit st5481_release_usb(struct st5481_adapter *adapter) - { - struct st5481_intr *intr = &adapter->intr; - struct st5481_ctrl *ctrl = &adapter->ctrl; -@@ -443,7 +443,7 @@ - return retval; - } - --void st5481_release_isocpipes(struct urb* urb[2]) -+void __devexit st5481_release_isocpipes(struct urb* urb[2]) - { - int j; - -@@ -484,18 +484,16 @@ - ptr = urb->transfer_buffer; - while (len > 0) { - if (in->mode == L1_MODE_TRANS) { -- /* swap rx bytes to get hearable audio */ -- register unsigned char *dest = in->rcvbuf; -+ memcpy(in->rcvbuf, ptr, len); - status = len; -- for (; len; len--) -- *dest++ = isdnhdlc_bit_rev_tab[*ptr++]; -+ len = 0; - } else { -- status = isdnhdlc_decode(&in->hdlc_state, ptr, len, &count, -- in->rcvbuf, in->bufsize); -+ status = hdlc_decode(&in->hdlc_state, ptr, len, &count, -+ in->rcvbuf, in->bufsize); - ptr += count; - len -= count; - } -- -+ - if (status > 0) { - // Good frame received - DBG(4,"count=%d",status); -@@ -549,7 +547,7 @@ - return retval; - } - --void st5481_release_in(struct st5481_in *in) -+void __devexit st5481_release_in(struct st5481_in *in) - { - DBG(2,""); - -@@ -562,8 +560,7 @@ - */ - int st5481_isoc_flatten(struct urb *urb) - { -- struct iso_packet_descriptor *pipd; -- struct iso_packet_descriptor *pend; -+ piso_packet_descriptor_t pipd,pend; - unsigned char *src,*dst; - unsigned int len; - -@@ -624,10 +621,15 @@ - - if (in->mode != L1_MODE_NULL) { - if (in->mode != L1_MODE_TRANS) -- isdnhdlc_rcv_init(&in->hdlc_state, -- in->mode == L1_MODE_HDLC_56K); -+ hdlc_rcv_init(&in->hdlc_state, -+ in->mode == L1_MODE_HDLC_56K); - - st5481_usb_pipe_reset(in->adapter, in->ep, NULL, NULL); -+#if 0 -+ st5481_usb_device_ctrl_msg(in->adapter, in->counter, -+ in->packet_size, -+ st5481_start_rcv, in); -+#endif - st5481_usb_device_ctrl_msg(in->adapter, in->counter, - in->packet_size, - NULL, NULL); -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/tei.c linux-2.4.29/drivers/isdn/hisax/tei.c ---- linux-2.4.29.old/drivers/isdn/hisax/tei.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/tei.c 2005-03-22 15:06:48.316747520 +0100 -@@ -1,4 +1,4 @@ --/* $Id: tei.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: tei.c,v 2.20 2001/09/24 13:22:57 kai Exp $ - * - * Author Karsten Keil - * based on the teles driver from Jan den Ouden -@@ -21,7 +21,7 @@ - #include - #include - --const char *tei_revision = "$Revision: 1.1.4.1 $"; -+const char *tei_revision = "$Revision: 2.20 $"; - - #define ID_REQUEST 1 - #define ID_ASSIGNED 2 -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/teleint.c linux-2.4.29/drivers/isdn/hisax/teleint.c ---- linux-2.4.29.old/drivers/isdn/hisax/teleint.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/teleint.c 2005-03-22 15:06:48.330745392 +0100 -@@ -1,4 +1,4 @@ --/* $Id: teleint.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: teleint.c,v 1.16 2001/09/24 13:22:57 kai Exp $ - * - * low level stuff for TeleInt isdn cards - * -@@ -19,7 +19,7 @@ - - extern const char *CardType[]; - --const char *TeleInt_revision = "$Revision: 1.1.4.1 $"; -+const char *TeleInt_revision = "$Revision: 1.16 $"; - - #define byteout(addr,val) outb(val,addr) - #define bytein(addr) inb(addr) -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/teles0.c linux-2.4.29/drivers/isdn/hisax/teles0.c ---- linux-2.4.29.old/drivers/isdn/hisax/teles0.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/teles0.c 2005-03-22 15:06:48.348742656 +0100 -@@ -1,4 +1,4 @@ --/* $Id: teles0.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: teles0.c,v 2.15 2001/09/24 13:22:57 kai Exp $ - * - * low level stuff for Teles Memory IO isdn cards - * -@@ -24,7 +24,7 @@ - - extern const char *CardType[]; - --const char *teles0_revision = "$Revision: 1.1.4.1 $"; -+const char *teles0_revision = "$Revision: 2.15 $"; - - #define TELES_IOMEM_SIZE 0x400 - #define byteout(addr,val) outb(val,addr) -@@ -189,8 +189,10 @@ - { - if (cs->hw.teles0.cfg_reg) - release_region(cs->hw.teles0.cfg_reg, 8); -+#ifdef COMPAT_HAS_ISA_IOREMAP - iounmap((unsigned char *)cs->hw.teles0.membase); - release_mem_region(cs->hw.teles0.phymem, TELES_IOMEM_SIZE); -+#endif - } - - static int -@@ -327,6 +329,7 @@ - /* 16.0 and 8.0 designed for IOM1 */ - test_and_set_bit(HW_IOM1, &cs->HW_Flags); - cs->hw.teles0.phymem = card->para[1]; -+#ifdef COMPAT_HAS_ISA_IOREMAP - if (check_mem_region(cs->hw.teles0.phymem, TELES_IOMEM_SIZE)) { - printk(KERN_WARNING - "HiSax: %s memory region %lx-%lx already in use\n", -@@ -342,6 +345,9 @@ - } - cs->hw.teles0.membase = - (unsigned long) ioremap(cs->hw.teles0.phymem, TELES_IOMEM_SIZE); -+#else -+ cs->hw.teles0.membase = cs->hw.teles0.phymem; -+#endif - printk(KERN_INFO - "HiSax: %s config irq:%d mem:0x%lX cfg:0x%X\n", - CardType[cs->typ], cs->irq, -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/teles3.c linux-2.4.29/drivers/isdn/hisax/teles3.c ---- linux-2.4.29.old/drivers/isdn/hisax/teles3.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/teles3.c 2005-03-22 15:06:48.367739768 +0100 -@@ -1,4 +1,4 @@ --/* $Id: teles3.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: teles3.c,v 2.19 2001/09/24 13:22:57 kai Exp $ - * - * low level stuff for Teles 16.3 & PNP isdn cards - * -@@ -15,14 +15,13 @@ - */ - #define __NO_VERSION__ - #include --#include - #include "hisax.h" - #include "isac.h" - #include "hscx.h" - #include "isdnl1.h" - - extern const char *CardType[]; --const char *teles3_revision = "$Revision: 1.1.4.1 $"; -+const char *teles3_revision = "$Revision: 2.19 $"; - - #define byteout(addr,val) outb(val,addr) - #define bytein(addr) inb(addr) -@@ -255,24 +254,6 @@ - return(0); - } - --#ifdef __ISAPNP__ --static struct isapnp_device_id teles_ids[] __initdata = { -- { ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2110), -- ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2110), -- (unsigned long) "Teles 16.3 PnP" }, -- { ISAPNP_VENDOR('C', 'T', 'X'), ISAPNP_FUNCTION(0x0), -- ISAPNP_VENDOR('C', 'T', 'X'), ISAPNP_FUNCTION(0x0), -- (unsigned long) "Creatix 16.3 PnP" }, -- { ISAPNP_VENDOR('C', 'P', 'Q'), ISAPNP_FUNCTION(0x1002), -- ISAPNP_VENDOR('C', 'P', 'Q'), ISAPNP_FUNCTION(0x1002), -- (unsigned long) "Compaq ISDN S0" }, -- { 0, } --}; -- --static struct isapnp_device_id *tdev = &teles_ids[0]; --static struct pci_bus *pnp_c __devinitdata = NULL; --#endif -- - int __devinit - setup_teles3(struct IsdnCard *card) - { -@@ -286,47 +267,6 @@ - && (cs->typ != ISDN_CTYPE_TELESPCMCIA) && (cs->typ != ISDN_CTYPE_COMPAQ_ISA)) - return (0); - --#ifdef __ISAPNP__ -- if (!card->para[1] && isapnp_present()) { -- struct pci_bus *pb; -- struct pci_dev *pd; -- -- while(tdev->card_vendor) { -- if ((pb = isapnp_find_card(tdev->card_vendor, -- tdev->card_device, pnp_c))) { -- pnp_c = pb; -- pd = NULL; -- if ((pd = isapnp_find_dev(pnp_c, -- tdev->vendor, tdev->function, pd))) { -- printk(KERN_INFO "HiSax: %s detected\n", -- (char *)tdev->driver_data); -- pd->prepare(pd); -- pd->deactivate(pd); -- pd->activate(pd); -- card->para[3] = pd->resource[2].start; -- card->para[2] = pd->resource[1].start; -- card->para[1] = pd->resource[0].start; -- card->para[0] = pd->irq_resource[0].start; -- if (!card->para[0] || !card->para[1] || !card->para[2]) { -- printk(KERN_ERR "Teles PnP:some resources are missing %ld/%lx/%lx\n", -- card->para[0], card->para[1], card->para[2]); -- pd->deactivate(pd); -- return(0); -- } -- break; -- } else { -- printk(KERN_ERR "Teles PnP: PnP error card found, no device\n"); -- } -- } -- tdev++; -- pnp_c=NULL; -- } -- if (!tdev->card_vendor) { -- printk(KERN_INFO "Teles PnP: no ISAPnP card found\n"); -- return(0); -- } -- } --#endif - if (cs->typ == ISDN_CTYPE_16_3) { - cs->hw.teles3.cfg_reg = card->para[1]; - switch (cs->hw.teles3.cfg_reg) { -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/telespci.c linux-2.4.29/drivers/isdn/hisax/telespci.c ---- linux-2.4.29.old/drivers/isdn/hisax/telespci.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/telespci.c 2005-03-22 15:06:48.382737488 +0100 -@@ -1,4 +1,4 @@ --/* $Id: telespci.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: telespci.c,v 2.23 2001/09/24 13:22:57 kai Exp $ - * - * low level stuff for Teles PCI isdn cards - * -@@ -20,9 +20,10 @@ - #include "hscx.h" - #include "isdnl1.h" - #include -+#include - - extern const char *CardType[]; --const char *telespci_revision = "$Revision: 1.1.4.1 $"; -+const char *telespci_revision = "$Revision: 2.23 $"; - - #define ZORAN_PO_RQ_PEN 0x02000000 - #define ZORAN_PO_WR 0x00800000 -@@ -307,10 +308,10 @@ - printk(KERN_WARNING "Teles: No IRQ for PCI card found\n"); - return(0); - } -- cs->hw.teles0.membase = (u_long) ioremap(pci_resource_start(dev_tel, 0), -+ cs->hw.teles0.membase = (u_long) ioremap(pci_resource_start_mem(dev_tel, 0), - PAGE_SIZE); - printk(KERN_INFO "Found: Zoran, base-address: 0x%lx, irq: 0x%x\n", -- pci_resource_start(dev_tel, 0), dev_tel->irq); -+ pci_resource_start_mem(dev_tel, 0), dev_tel->irq); - } else { - printk(KERN_WARNING "TelesPCI: No PCI card found\n"); - return(0); -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/w6692.c linux-2.4.29/drivers/isdn/hisax/w6692.c ---- linux-2.4.29.old/drivers/isdn/hisax/w6692.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/w6692.c 2005-03-22 15:06:48.398735056 +0100 -@@ -1,4 +1,4 @@ --/* $Id: w6692.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: w6692.c,v 1.18 2001/09/24 13:22:57 kai Exp $ - * - * Winbond W6692 specific routines - * -@@ -18,6 +18,7 @@ - #include "isdnl1.h" - #include - #include -+#include - - /* table entry in the PCI devices list */ - typedef struct { -@@ -29,20 +30,14 @@ - - static const PCI_ENTRY id_list[] = - { -- {PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_6692, "Winbond", "W6692"}, - {PCI_VENDOR_ID_DYNALINK, PCI_DEVICE_ID_DYNALINK_IS64PH, "Dynalink/AsusCom", "IS64PH"}, -- {0, 0, "U.S.Robotics", "ISDN PCI Card TA"} -+ {PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_6692, "Winbond", "W6692"}, -+ {0, 0, NULL, NULL} - }; - --#define W6692_SV_USR 0x16ec --#define W6692_SD_USR 0x3409 --#define W6692_WINBOND 0 --#define W6692_DYNALINK 1 --#define W6692_USR 2 -- - extern const char *CardType[]; - --const char *w6692_revision = "$Revision: 1.1.4.1 $"; -+const char *w6692_revision = "$Revision: 1.18 $"; - - #define DBUSY_TIMER_VALUE 80 - -@@ -675,6 +670,16 @@ - static void - DC_Close_W6692(struct IsdnCardState *cs) - { -+#if 0 -+ if (cs->dc.w6692.mon_rx) { -+ kfree(cs->dc.w6692.mon_rx); -+ cs->dc.w6692.mon_rx = NULL; -+ } -+ if (cs->dc.w6692.mon_tx) { -+ kfree(cs->dc.w6692.mon_tx); -+ cs->dc.w6692.mon_tx = NULL; -+ } -+#endif - } - - static void -@@ -865,38 +870,31 @@ - return (0); - } - --void resetW6692(struct IsdnCardState *cs) --{ -- cs->writeW6692(cs, W_D_CTL, W_D_CTL_SRST); -- schedule_timeout((10*HZ)/1000); -- cs->writeW6692(cs, W_D_CTL, 0x00); -- schedule_timeout((10*HZ)/1000); -- cs->writeW6692(cs, W_IMASK, 0xff); -- cs->writeW6692(cs, W_D_SAM, 0xff); -- cs->writeW6692(cs, W_D_TAM, 0xff); -- cs->writeW6692(cs, W_D_EXIM, 0x00); -- cs->writeW6692(cs, W_D_MODE, W_D_MODE_RACT); -- cs->writeW6692(cs, W_IMASK, 0x18); -- if (cs->subtyp == W6692_USR) { -- /* seems that USR implemented some power control features -- * Pin 79 is connected to the oscilator circuit so we -- * have to handle it here -- */ -- cs->writeW6692(cs, W_PCTL, 0x80); -- cs->writeW6692(cs, W_XDATA, 0x00); -- } --} -- - void __init initW6692(struct IsdnCardState *cs, int part) - { - if (part & 1) { - cs->tqueue.routine = (void *) (void *) W6692_bh; - cs->setstack_d = setstack_W6692; - cs->DC_Close = DC_Close_W6692; -+#if 0 -+ cs->dc.w6692.mon_tx = NULL; -+ cs->dc.w6692.mon_rx = NULL; -+#endif - cs->dbusytimer.function = (void *) dbusy_timer_handler; - cs->dbusytimer.data = (long) cs; - init_timer(&cs->dbusytimer); -- resetW6692(cs); -+ -+ cs->writeW6692(cs, W_D_CTL, W_D_CTL_SRST); -+ cs->writeW6692(cs, W_D_CTL, 0x00); -+ cs->writeW6692(cs, W_IMASK, 0xff); -+#if 0 -+ cs->dc.w6692.mocr = 0xaa; -+#endif -+ cs->writeW6692(cs, W_D_SAM, 0xff); -+ cs->writeW6692(cs, W_D_TAM, 0xff); -+ cs->writeW6692(cs, W_D_EXIM, 0x00); -+ cs->writeW6692(cs, W_D_MODE, W_D_MODE_RACT); -+ cs->writeW6692(cs, W_IMASK, 0x18); - ph_command(cs, W_L1CMD_RST); - cs->dc.w6692.ph_state = W_L1CMD_RST; - W6692_new_ph(cs); -@@ -963,14 +961,9 @@ - { - switch (mt) { - case CARD_RESET: -- resetW6692(cs); - return (0); - case CARD_RELEASE: -- cs->writeW6692(cs, W_IMASK, 0xff); - release_region(cs->hw.w6692.iobase, 256); -- if (cs->subtyp == W6692_USR) { -- cs->writeW6692(cs, W_XDATA, 0x04); -- } - return (0); - case CARD_INIT: - initW6692(cs, 3); -@@ -1013,7 +1006,6 @@ - if (dev_w6692) { - if (pci_enable_device(dev_w6692)) - continue; -- cs->subtyp = id_idx; - break; - } - id_idx++; -@@ -1023,14 +1015,7 @@ - pci_irq = dev_w6692->irq; - /* I think address 0 is allways the configuration area */ - /* and address 1 is the real IO space KKe 03.09.99 */ -- pci_ioaddr = pci_resource_start(dev_w6692, 1); -- /* USR ISDN PCI card TA need some special handling */ -- if (cs->subtyp == W6692_WINBOND) { -- if ((W6692_SV_USR == dev_w6692->subsystem_vendor) && -- (W6692_SD_USR == dev_w6692->subsystem_device)) { -- cs->subtyp = W6692_USR; -- } -- } -+ pci_ioaddr = pci_resource_start_io(dev_w6692, 1); - } - if (!found) { - printk(KERN_WARNING "W6692: No PCI card found\n"); -@@ -1047,18 +1032,18 @@ - } - cs->hw.w6692.iobase = pci_ioaddr; - printk(KERN_INFO "Found: %s %s, I/O base: 0x%x, irq: %d\n", -- id_list[cs->subtyp].vendor_name, id_list[cs->subtyp].card_name, -- pci_ioaddr, pci_irq); -+ id_list[id_idx].vendor_name, id_list[id_idx].card_name, -+ pci_ioaddr, dev_w6692->irq); - if (check_region((cs->hw.w6692.iobase), 256)) { - printk(KERN_WARNING - "HiSax: %s I/O ports %x-%x already in use\n", -- id_list[cs->subtyp].card_name, -+ id_list[id_idx].card_name, - cs->hw.w6692.iobase, - cs->hw.w6692.iobase + 255); - return (0); - } else { - request_region(cs->hw.w6692.iobase, 256, -- id_list[cs->subtyp].card_name); -+ id_list[id_idx].card_name); - } - #else - printk(KERN_WARNING "HiSax: W6692 and NO_PCI_BIOS\n"); -@@ -1068,7 +1053,7 @@ - - printk(KERN_INFO - "HiSax: %s config irq:%d I/O:%x\n", -- id_list[cs->subtyp].card_name, cs->irq, -+ id_list[id_idx].card_name, cs->irq, - cs->hw.w6692.iobase); - - cs->readW6692 = &ReadW6692; -diff -rNu linux-2.4.29.old/drivers/isdn/hisax/w6692.h linux-2.4.29/drivers/isdn/hisax/w6692.h ---- linux-2.4.29.old/drivers/isdn/hisax/w6692.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hisax/w6692.h 2005-03-22 15:06:48.414732624 +0100 -@@ -1,4 +1,4 @@ --/* $Id: w6692.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ -+/* $Id: w6692.h,v 1.4 2001/09/24 13:22:57 kai Exp $ - * - * Winbond W6692 specific defines - * -diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/boardergo.c linux-2.4.29/drivers/isdn/hysdn/boardergo.c ---- linux-2.4.29.old/drivers/isdn/hysdn/boardergo.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hysdn/boardergo.c 2005-03-22 15:06:48.468724416 +0100 -@@ -1,27 +1,41 @@ --/* $Id: boardergo.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -- * -+/* $Id: boardergo.c,v 1.9 2001/07/19 20:39:51 kai Exp $ -+ - * Linux driver for HYSDN cards, specific routines for ergo type boards. - * -- * Author Werner Cornelius (werner@titro.de) for Hypercope GmbH -- * Copyright 1999 by Werner Cornelius (werner@titro.de) -- * -- * This software may be used and distributed according to the terms -- * of the GNU General Public License, incorporated herein by reference. -- * - * As all Linux supported cards Champ2, Ergo and Metro2/4 use the same - * DPRAM interface and layout with only minor differences all related - * stuff is done here, not in separate modules. - * -+ * written by Werner Cornelius (werner@titro.de) for Hypercope GmbH -+ * -+ * Copyright 1999 by Werner Cornelius (werner@titro.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, 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. -+ * - */ - -+#define __NO_VERSION__ - #include --#include -+#include -+#include -+#include - #include - #include - #include - #include - #include --#include - - #include "hysdn_defs.h" - #include "boardergo.h" -@@ -45,11 +59,10 @@ - if (!card->irq_enabled) - return; /* other device interrupting or irq switched off */ - -- save_flags(flags); -- cli(); /* no further irqs allowed */ -+ HYSDN_SPIN_LOCK(&card->irq_lock, flags); - - if (!(bytein(card->iobase + PCI9050_INTR_REG) & PCI9050_INTR_REG_STAT1)) { -- restore_flags(flags); /* restore old state */ -+ HYSDN_SPIN_UNLOCK(&card->irq_lock, flags); - return; /* no interrupt requested by E1 */ - } - /* clear any pending ints on the board */ -@@ -63,7 +76,7 @@ - queue_task(&card->irq_queue, &tq_immediate); - mark_bh(IMMEDIATE_BH); - } -- restore_flags(flags); -+ HYSDN_SPIN_UNLOCK(&card->irq_lock, flags); - } /* ergo_interrupt */ - - /******************************************************************************/ -@@ -83,17 +96,15 @@ - return; /* invalid call */ - - dpr = card->dpram; /* point to DPRAM */ -+ HYSDN_SPIN_LOCK(&card->irq_lock, flags); - -- save_flags(flags); -- cli(); - if (card->hw_lock) { -- restore_flags(flags); /* hardware currently unavailable */ -+ HYSDN_SPIN_UNLOCK(&card->irq_lock, flags); - return; - } - card->hw_lock = 1; /* we now lock the hardware */ - - do { -- sti(); /* reenable other ints */ - again = 0; /* assume loop not to be repeated */ - - if (!dpr->ToHyFlag) { -@@ -113,15 +124,13 @@ - again = 1; /* restart loop */ - } - } /* a message has arrived for us */ -- cli(); /* no further ints */ - if (again) { - dpr->ToHyInt = 1; - dpr->ToPcInt = 1; /* interrupt to E1 for all cards */ - } else - card->hw_lock = 0; /* free hardware again */ - } while (again); /* until nothing more to do */ -- -- restore_flags(flags); -+ HYSDN_SPIN_UNLOCK(&card->irq_lock, flags); - } /* ergo_irq_bh */ - - -@@ -138,8 +147,7 @@ - #ifdef CONFIG_HYSDN_CAPI - hycapi_capi_stop(card); - #endif /* CONFIG_HYSDN_CAPI */ -- save_flags(flags); -- cli(); -+ HYSDN_SPIN_LOCK(&card->irq_lock, flags); - val = bytein(card->iobase + PCI9050_INTR_REG); /* get actual value */ - val &= ~(PCI9050_INTR_REG_ENPCI | PCI9050_INTR_REG_EN1); /* mask irq */ - byteout(card->iobase + PCI9050_INTR_REG, val); -@@ -147,8 +155,7 @@ - byteout(card->iobase + PCI9050_USER_IO, PCI9050_E1_RESET); /* reset E1 processor */ - card->state = CARD_STATE_UNUSED; - card->err_log_state = ERRLOG_STATE_OFF; /* currently no log active */ -- -- restore_flags(flags); -+ HYSDN_SPIN_UNLOCK(&card->irq_lock, flags); - } /* ergo_stopcard */ - - /**************************************************************************/ -@@ -163,20 +170,17 @@ - card->err_log_state = ERRLOG_STATE_OFF; /* must be off */ - return; - } -- save_flags(flags); -- cli(); -- -+ HYSDN_SPIN_LOCK(&card->irq_lock, flags); - if (((card->err_log_state == ERRLOG_STATE_OFF) && !on) || - ((card->err_log_state == ERRLOG_STATE_ON) && on)) { -- restore_flags(flags); -+ HYSDN_SPIN_UNLOCK(&card->irq_lock, flags); - return; /* nothing to do */ - } - if (on) - card->err_log_state = ERRLOG_STATE_START; /* request start */ - else - card->err_log_state = ERRLOG_STATE_STOP; /* request stop */ -- -- restore_flags(flags); -+ HYSDN_SPIN_UNLOCK(&card->irq_lock, flags); - queue_task(&card->irq_queue, &tq_immediate); - mark_bh(IMMEDIATE_BH); - } /* ergo_set_errlog_state */ -@@ -245,9 +249,6 @@ - while (!dpram->ToHyNoDpramErrLog); /* reread volatile register to flush PCI */ - - byteout(card->iobase + PCI9050_USER_IO, PCI9050_E1_RUN); /* start E1 processor */ -- /* the interrupts are still masked */ -- -- sti(); - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout((20 * HZ) / 1000); /* Timeout 20ms */ - -@@ -282,7 +283,6 @@ - dst = sp->Data; /* point to data in spool structure */ - buflen = sp->Len; /* maximum len of spooled data */ - wr_mirror = sp->WrPtr; /* only once read */ -- sti(); - - /* try until all bytes written or error */ - i = 0x1000; /* timeout value */ -@@ -358,9 +358,7 @@ - - if (card->debug_flags & LOG_POF_RECORD) - hysdn_addlog(card, "ERGO: pof boot success"); -- save_flags(flags); -- cli(); -- -+ HYSDN_SPIN_LOCK(&card->irq_lock, flags); - card->state = CARD_STATE_RUN; /* now card is running */ - /* enable the cards interrupt */ - byteout(card->iobase + PCI9050_INTR_REG, -@@ -371,8 +369,7 @@ - dpr->ToPcFlag = 0; /* reset data indicator */ - dpr->ToHyInt = 1; - dpr->ToPcInt = 1; /* interrupt to E1 for all cards */ -- -- restore_flags(flags); -+ HYSDN_SPIN_UNLOCK(&card->irq_lock, flags); - if ((hynet_enable & (1 << card->myid)) - && (i = hysdn_net_create(card))) - { -@@ -387,7 +384,6 @@ - #endif /* CONFIG_HYSDN_CAPI */ - return (0); /* success */ - } /* data has arrived */ -- sti(); - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout((50 * HZ) / 1000); /* Timeout 50ms */ - } /* wait until timeout */ -diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/boardergo.h linux-2.4.29/drivers/isdn/hysdn/boardergo.h ---- linux-2.4.29.old/drivers/isdn/hysdn/boardergo.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hysdn/boardergo.h 2005-03-22 15:06:48.485721832 +0100 -@@ -1,4 +1,4 @@ --/* $Id: boardergo.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Linux driver for HYSDN cards, definitions for ergo type boards (buffers..). - * -@@ -10,6 +10,7 @@ - * - */ - -+#include - - /************************************************/ - /* defines for the dual port memory of the card */ -diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/hycapi.c linux-2.4.29/drivers/isdn/hysdn/hycapi.c ---- linux-2.4.29.old/drivers/isdn/hysdn/hycapi.c 2005-03-22 14:47:57.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hysdn/hycapi.c 2005-03-22 15:06:48.500719552 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hycapi.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Linux driver for HYSDN cards, CAPI2.0-Interface. - * -@@ -29,7 +29,7 @@ - #include "hysdn_defs.h" - #include - --static char hycapi_revision[]="$Revision: 1.1.4.1 $"; -+static char hycapi_revision[]="$Revision$"; - - unsigned int hycapi_enable = 0xffffffff; - MODULE_PARM(hycapi_enable, "i"); -diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/hysdn_boot.c linux-2.4.29/drivers/isdn/hysdn/hysdn_boot.c ---- linux-2.4.29.old/drivers/isdn/hysdn/hysdn_boot.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hysdn/hysdn_boot.c 2005-03-22 15:06:48.516717120 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hysdn_boot.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Linux driver for HYSDN cards - * specific routines for booting and pof handling -@@ -143,7 +143,7 @@ - (boot->pof_recid == TAG_CABSDATA) ? "CABSDATA" : "ABSDATA", - datlen, boot->pof_recoffset); - -- if ((boot->last_error = card->writebootseq(card, boot->buf.BootBuf, datlen)) < 0) -+ if ((boot->last_error = card->writebootseq(card, boot->buf.BootBuf, datlen) < 0)) - return (boot->last_error); /* error writing data */ - - if (boot->pof_recoffset + datlen >= boot->pof_reclen) -diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/hysdn_defs.h linux-2.4.29/drivers/isdn/hysdn/hysdn_defs.h ---- linux-2.4.29.old/drivers/isdn/hysdn/hysdn_defs.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hysdn/hysdn_defs.h 2005-03-22 15:06:48.533714536 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hysdn_defs.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id: hysdn_defs.h,v 1.10 2001/09/24 13:23:03 kai Exp $ - * - * Linux driver for HYSDN cards - * global definitions and exported vars and functions. -@@ -19,6 +19,11 @@ - #include - #include - #include -+#include -+#include -+ -+#define HYSDN_SPIN_LOCK(a,b) spin_lock(a) -+#define HYSDN_SPIN_UNLOCK(a,b) spin_unlock(a) - - /****************************/ - /* storage type definitions */ -@@ -176,6 +181,7 @@ - struct tq_struct irq_queue; /* interrupt task queue */ - uchar volatile irq_enabled; /* interrupt enabled if != 0 */ - uchar volatile hw_lock; /* hardware is currently locked -> no access */ -+ spinlock_t irq_lock; - - /* boot process */ - void *boot; /* pointer to boot private data */ -diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/hysdn_init.c linux-2.4.29/drivers/isdn/hysdn/hysdn_init.c ---- linux-2.4.29.old/drivers/isdn/hysdn/hysdn_init.c 2005-03-22 14:47:57.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hysdn/hysdn_init.c 2005-03-22 15:06:48.551711800 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hysdn_init.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Linux driver for HYSDN cards, init functions. - * -@@ -21,6 +21,7 @@ - - #include "hysdn_defs.h" - -+#ifndef COMPAT_HAS_2_2_PCI - static struct pci_device_id hysdn_pci_tbl[] __initdata = { - {PCI_VENDOR_ID_HYPERCOPE, PCI_DEVICE_ID_HYPERCOPE_PLX, PCI_ANY_ID, PCI_SUBDEVICE_ID_HYPERCOPE_METRO}, - {PCI_VENDOR_ID_HYPERCOPE, PCI_DEVICE_ID_HYPERCOPE_PLX, PCI_ANY_ID, PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2}, -@@ -29,11 +30,12 @@ - { } /* Terminating entry */ - }; - MODULE_DEVICE_TABLE(pci, hysdn_pci_tbl); -+#endif - MODULE_DESCRIPTION("ISDN4Linux: Driver for HYSDN cards"); - MODULE_AUTHOR("Werner Cornelius"); - MODULE_LICENSE("GPL"); - --static char *hysdn_init_revision = "$Revision: 1.1.4.1 $"; -+static char *hysdn_init_revision = "$Revision$"; - int cardmax; /* number of found cards */ - hysdn_card *card_root = NULL; /* pointer to first card */ - -@@ -91,11 +93,11 @@ - card->myid = cardmax; /* set own id */ - card->bus = akt_pcidev->bus->number; - card->devfn = akt_pcidev->devfn; /* slot + function */ -- card->subsysid = akt_pcidev->subsystem_device; -+ pci_get_sub_system(akt_pcidev,card->subsysid); - card->irq = akt_pcidev->irq; -- card->iobase = pci_resource_start(akt_pcidev, PCI_REG_PLX_IO_BASE); -- card->plxbase = pci_resource_start(akt_pcidev, PCI_REG_PLX_MEM_BASE); -- card->membase = pci_resource_start(akt_pcidev, PCI_REG_MEMORY_BASE); -+ card->iobase = pci_resource_start_io(akt_pcidev, PCI_REG_PLX_IO_BASE); -+ card->plxbase = pci_resource_start_mem(akt_pcidev, PCI_REG_PLX_MEM_BASE); -+ card->membase = pci_resource_start_mem(akt_pcidev, PCI_REG_MEMORY_BASE); - card->brdtype = BD_NONE; /* unknown */ - card->debug_flags = DEF_DEB_FLAGS; /* set default debug */ - card->faxchans = 0; /* default no fax channels */ -diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/hysdn_net.c linux-2.4.29/drivers/isdn/hysdn/hysdn_net.c ---- linux-2.4.29.old/drivers/isdn/hysdn/hysdn_net.c 2005-03-22 14:47:57.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hysdn/hysdn_net.c 2005-03-22 15:06:48.567709368 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hysdn_net.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Linux driver for HYSDN cards, net (ethernet type) handling routines. - * -@@ -29,7 +29,7 @@ - MODULE_PARM(hynet_enable, "i"); - - /* store the actual version for log reporting */ --char *hysdn_net_revision = "$Revision: 1.1.4.1 $"; -+char *hysdn_net_revision = "$Revision$"; - - #define MAX_SKB_BUFFERS 20 /* number of buffers for keeping TX-data */ - -@@ -45,6 +45,10 @@ - /* additional vars may be added here */ - char dev_name[9]; /* our own device name */ - -+#ifdef COMPAT_NO_SOFTNET -+ struct sk_buff *tx_skb; /* buffer for tx operation */ -+ -+#else - /* Tx control lock. This protects the transmit buffer ring - * state along with the "tx full" state of the driver. This - * means all netif_queue flow control actions are protected -@@ -56,6 +60,7 @@ - int sk_count; /* number of buffers currently in ring */ - - int is_open; /* flag controlling module locking */ -+#endif - }; /* net_local */ - - -@@ -83,11 +88,19 @@ - hysdn_card *card = dev->priv; - int i; - -+#ifdef COMPAT_NO_SOFTNET -+ dev->tbusy = 0; /* non busy state */ -+ dev->interrupt = 0; -+ if (!dev->start) -+ MOD_INC_USE_COUNT; /* increment only if device is down */ -+ dev->start = 1; /* and started */ -+#else - if (!((struct net_local *) dev)->is_open) - MOD_INC_USE_COUNT; /* increment only if interface is actually down */ - ((struct net_local *) dev)->is_open = 1; /* device actually open */ - - netif_start_queue(dev); /* start tx-queueing */ -+#endif - - /* Fill in the MAC-level header (if not already set) */ - if (!card->mac_addr[0]) { -@@ -104,6 +117,7 @@ - return (0); - } /* net_open */ - -+#ifndef COMPAT_NO_SOFTNET - /*******************************************/ - /* flush the currently occupied tx-buffers */ - /* must only be called when device closed */ -@@ -119,6 +133,7 @@ - nl->sk_count--; - } - } /* flush_tx_buffers */ -+#endif - - - /*********************************************************************/ -@@ -129,6 +144,15 @@ - net_close(struct net_device *dev) - { - -+#ifdef COMPAT_NO_SOFTNET -+ dev->tbusy = 1; /* we are busy */ -+ -+ if (dev->start) -+ MOD_DEC_USE_COUNT; /* dec only if device has been active */ -+ -+ dev->start = 0; /* and not started */ -+ -+#else - netif_stop_queue(dev); /* disable queueing */ - - if (((struct net_local *) dev)->is_open) -@@ -136,9 +160,52 @@ - ((struct net_local *) dev)->is_open = 0; - flush_tx_buffers((struct net_local *) dev); - -+#endif - return (0); /* success */ - } /* net_close */ - -+#ifdef COMPAT_NO_SOFTNET -+/************************************/ -+/* send a packet on this interface. */ -+/* only for kernel versions < 2.3.33 */ -+/************************************/ -+static int -+net_send_packet(struct sk_buff *skb, struct net_device *dev) -+{ -+ struct net_local *lp = (struct net_local *) dev; -+ -+ if (dev->tbusy) { -+ /* -+ * If we get here, some higher level has decided we are broken. -+ * There should really be a "kick me" function call instead. -+ * As ISDN may have higher timeouts than real ethernet 10s timeout -+ */ -+ int tickssofar = jiffies - dev->trans_start; -+ if (tickssofar < (10000 * HZ) / 1000) -+ return 1; -+ printk(KERN_WARNING "%s: transmit timed out. \n", dev->name); -+ dev->tbusy = 0; -+ dev->trans_start = jiffies; -+ } -+ /* -+ * Block a timer-based transmit from overlapping. This could better be -+ * done with atomic_swap(1, dev->tbusy), but set_bit() works as well. -+ */ -+ if (test_and_set_bit(0, (void *) &dev->tbusy) != 0) -+ printk(KERN_WARNING "%s: Transmitter access conflict.\n", dev->name); -+ -+ else { -+ lp->stats.tx_bytes += skb->len; -+ dev->trans_start = jiffies; -+ lp->tx_skb = skb; /* remember skb pointer */ -+ queue_task(&((hysdn_card *) dev->priv)->irq_queue, &tq_immediate); -+ mark_bh(IMMEDIATE_BH); -+ } -+ -+ return (0); /* success */ -+} /* net_send_packet */ -+ -+#else - /************************************/ - /* send a packet on this interface. */ - /* new style for kernel >= 2.3.33 */ -@@ -176,6 +243,7 @@ - return (0); /* success */ - } /* net_send_packet */ - -+#endif - - - /***********************************************************************/ -@@ -190,6 +258,15 @@ - if (!lp) - return; /* non existing device */ - -+#ifdef COMPAT_NO_SOFTNET -+ if (lp->tx_skb) -+ dev_kfree_skb(lp->tx_skb); /* free tx pointer */ -+ lp->tx_skb = NULL; /* reset pointer */ -+ -+ lp->stats.tx_packets++; -+ lp->netdev.tbusy = 0; -+ mark_bh(NET_BH); /* Inform upper layers. */ -+#else - - if (!lp->sk_count) - return; /* error condition */ -@@ -203,6 +280,7 @@ - - if (lp->sk_count-- == MAX_SKB_BUFFERS) /* dec usage count */ - netif_start_queue((struct net_device *) lp); -+#endif - } /* hysdn_tx_netack */ - - /*****************************************************/ -@@ -250,10 +328,15 @@ - if (!lp) - return (NULL); /* non existing device */ - -+#ifdef COMPAT_NO_SOFTNET -+ return (lp->tx_skb); /* return packet pointer */ -+ -+#else - if (!lp->sk_count) - return (NULL); /* nothing available */ - - return (lp->skbs[lp->out_idx]); /* next packet to send */ -+#endif - } /* hysdn_tx_netget */ - - -@@ -296,15 +379,21 @@ - } - memset(dev, 0, sizeof(struct net_local)); /* clean the structure */ - -+#ifndef COMPAT_NO_SOFTNET - spin_lock_init(&((struct net_local *) dev)->lock); -+#endif - - /* initialise necessary or informing fields */ - dev->base_addr = card->iobase; /* IO address */ - dev->irq = card->irq; /* irq */ - dev->init = net_init; /* the init function of the device */ -+#ifdef COMPAT_NO_SOFTNET -+ dev->name = ((struct net_local *) dev)->dev_name; /* device name */ -+#else - if(dev->name) { - strcpy(dev->name, ((struct net_local *) dev)->dev_name); - } -+#endif - if ((i = register_netdev(dev))) { - printk(KERN_WARNING "HYSDN: unable to create network device\n"); - kfree(dev); -@@ -333,7 +422,9 @@ - card->netif = NULL; /* clear out pointer */ - dev->stop(dev); /* close the device */ - -+#ifndef COMPAT_NO_SOFTNET - flush_tx_buffers((struct net_local *) dev); /* empty buffers */ -+#endif - - unregister_netdev(dev); /* release the device */ - kfree(dev); /* release the memory allocated */ -diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/hysdn_pof.h linux-2.4.29/drivers/isdn/hysdn/hysdn_pof.h ---- linux-2.4.29.old/drivers/isdn/hysdn/hysdn_pof.h 2005-03-22 14:47:57.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hysdn/hysdn_pof.h 2005-03-22 15:06:48.583706936 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hysdn_pof.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Linux driver for HYSDN cards, definitions used for handling pof-files. - * -diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/hysdn_procconf.c linux-2.4.29/drivers/isdn/hysdn/hysdn_procconf.c ---- linux-2.4.29.old/drivers/isdn/hysdn/hysdn_procconf.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hysdn/hysdn_procconf.c 2005-03-22 15:06:48.598704656 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hysdn_procconf.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Linux driver for HYSDN cards, /proc/net filesystem dir and conf functions. - * -@@ -17,11 +17,13 @@ - #include - #include - #include -+#ifndef COMPAT_USE_MODCOUNT_LOCK - #include -+#endif - - #include "hysdn_defs.h" - --static char *hysdn_procconf_revision = "$Revision: 1.1.4.1 $"; -+static char *hysdn_procconf_revision = "$Revision$"; - - #define INFO_OUT_LEN 80 /* length of info line including lf */ - -@@ -212,32 +214,29 @@ - static ssize_t - hysdn_conf_read(struct file *file, char *buf, size_t count, loff_t * off) - { -- loff_t pos = *off; - char *cp; - int i; - - if (off != &file->f_pos) /* fs error check */ - return -ESPIPE; - -- if (!(file->f_mode & FMODE_READ)) -- return -EPERM; -- -- if (!(cp = file->private_data)) -- return (-EFAULT); /* should never happen */ -- -- i = strlen(cp); /* get total string length */ -- -- if (pos != (unsigned)pos || pos >= i) -- return 0; -- -- /* still bytes to transfer */ -- cp += pos; /* point to desired data offset */ -- i -= pos; /* remaining length */ -- if (i > count) -- i = count; /* limit length to transfer */ -- if (copy_to_user(buf, cp, i)) -- return (-EFAULT); /* copy error */ -- *off = pos + i; /* adjust offset */ -+ if (file->f_mode & FMODE_READ) { -+ if (!(cp = file->private_data)) -+ return (-EFAULT); /* should never happen */ -+ i = strlen(cp); /* get total string length */ -+ if (*off < i) { -+ /* still bytes to transfer */ -+ cp += *off; /* point to desired data offset */ -+ i -= *off; /* remaining length */ -+ if (i > count) -+ i = count; /* limit length to transfer */ -+ if (copy_to_user(buf, cp, i)) -+ return (-EFAULT); /* copy error */ -+ *off += i; /* adjust offset */ -+ } else -+ return (0); -+ } else -+ return (-EPERM); /* no permission to read */ - - return (i); - } /* hysdn_conf_read */ -@@ -254,7 +253,11 @@ - char *cp, *tmp; - - /* now search the addressed card */ -+#ifdef COMPAT_USE_MODCOUNT_LOCK -+ MOD_INC_USE_COUNT; -+#else - lock_kernel(); -+#endif - card = card_root; - while (card) { - pd = card->procconf; -@@ -263,7 +266,11 @@ - card = card->next; /* search next entry */ - } - if (!card) { -+#ifdef COMPAT_USE_MODCOUNT_LOCK -+ MOD_DEC_USE_COUNT; -+#else - unlock_kernel(); -+#endif - return (-ENODEV); /* device is unknown/invalid */ - } - if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL)) -@@ -274,7 +281,11 @@ - /* write only access -> write boot file or conf line */ - - if (!(cnf = kmalloc(sizeof(struct conf_writedata), GFP_KERNEL))) { -+#ifdef COMPAT_USE_MODCOUNT_LOCK -+ MOD_DEC_USE_COUNT; -+#else - unlock_kernel(); -+#endif - return (-EFAULT); - } - cnf->card = card; -@@ -286,7 +297,11 @@ - /* read access -> output card info data */ - - if (!(tmp = (char *) kmalloc(INFO_OUT_LEN * 2 + 2, GFP_KERNEL))) { -+#ifdef COMPAT_USE_MODCOUNT_LOCK -+ MOD_DEC_USE_COUNT; -+#else - unlock_kernel(); -+#endif - return (-EFAULT); /* out of memory */ - } - filep->private_data = tmp; /* start of string */ -@@ -320,10 +335,16 @@ - *cp++ = '\n'; - *cp = 0; /* end of string */ - } else { /* simultaneous read/write access forbidden ! */ -+#ifdef COMPAT_USE_MODCOUNT_LOCK -+ MOD_DEC_USE_COUNT; -+#else - unlock_kernel(); -+#endif - return (-EPERM); /* no permission this time */ - } -+#ifndef COMPAT_USE_MODCOUNT_LOCK - unlock_kernel(); -+#endif - return (0); - } /* hysdn_conf_open */ - -@@ -338,7 +359,9 @@ - int retval = 0; - struct proc_dir_entry *pd; - -+#ifndef COMPAT_USE_MODCOUNT_LOCK - lock_kernel(); -+#endif - /* search the addressed card */ - card = card_root; - while (card) { -@@ -348,7 +371,9 @@ - card = card->next; /* search next entry */ - } - if (!card) { -+#ifndef COMPAT_USE_MODCOUNT_LOCK - unlock_kernel(); -+#endif - return (-ENODEV); /* device is unknown/invalid */ - } - if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL)) -@@ -371,7 +396,11 @@ - if (filep->private_data) - kfree(filep->private_data); /* release memory */ - } -+#ifdef COMPAT_USE_MODCOUNT_LOCK -+ MOD_DEC_USE_COUNT; -+#else - unlock_kernel(); -+#endif - return (retval); - } /* hysdn_conf_close */ - -@@ -387,6 +416,9 @@ - release: hysdn_conf_close, - }; - -+#ifdef COMPAT_NO_SOFTNET -+static struct inode_operations conf_inode_operations; -+#endif - /*****************************/ - /* hysdn subdir in /proc/net */ - /*****************************/ -@@ -415,8 +447,17 @@ - if ((card->procconf = (void *) create_proc_entry(conf_name, - S_IFREG | S_IRUGO | S_IWUSR, - hysdn_proc_entry)) != NULL) { -+#ifdef COMPAT_NO_SOFTNET -+ memset(&conf_inode_operations, 0, sizeof(struct inode_operations)); -+ conf_inode_operations.default_file_ops = &conf_fops; -+ -+ ((struct proc_dir_entry *) card->procconf)->ops = &conf_inode_operations; -+#else - ((struct proc_dir_entry *) card->procconf)->proc_fops = &conf_fops; -+#ifdef COMPAT_HAS_FILEOP_OWNER - ((struct proc_dir_entry *) card->procconf)->owner = THIS_MODULE; -+#endif -+#endif - hysdn_proclog_init(card); /* init the log file entry */ - } - card = card->next; /* next entry */ -diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/hysdn_proclog.c linux-2.4.29/drivers/isdn/hysdn/hysdn_proclog.c ---- linux-2.4.29.old/drivers/isdn/hysdn/hysdn_proclog.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hysdn/hysdn_proclog.c 2005-03-22 15:06:48.613702376 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hysdn_proclog.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Linux driver for HYSDN cards, /proc/net filesystem log functions. - * -@@ -16,7 +16,9 @@ - #include - #include - #include -+#ifndef COMPAT_USE_MODCOUNT_LOCK - #include -+#endif - - #include "hysdn_defs.h" - -@@ -115,8 +117,7 @@ - strcpy(ib->log_start, cp); /* set output string */ - ib->next = NULL; - ib->proc_ctrl = pd; /* point to own control structure */ -- save_flags(flags); -- cli(); -+ HYSDN_SPIN_LOCK(&card->irq_lock, flags); - ib->usage_cnt = pd->if_used; - if (!pd->log_head) - pd->log_head = ib; /* new head */ -@@ -124,7 +125,7 @@ - pd->log_tail->next = ib; /* follows existing messages */ - pd->log_tail = ib; /* new tail */ - i = pd->del_lock++; /* get lock state */ -- restore_flags(flags); -+ HYSDN_SPIN_UNLOCK(&card->irq_lock, flags); - - /* delete old entrys */ - if (!i) -@@ -210,7 +211,6 @@ - word ino; - struct procdata *pd = NULL; - hysdn_card *card; -- loff_t pos = *off; - - if (!*((struct log_data **) file->private_data)) { - if (file->f_flags & O_NONBLOCK) -@@ -235,11 +235,11 @@ - return (0); - - inf->usage_cnt--; /* new usage count */ -- file->private_data = &inf->next; /* next structure */ -+ (struct log_data **) file->private_data = &inf->next; /* next structure */ - if ((len = strlen(inf->log_start)) <= count) { - if (copy_to_user(buf, inf->log_start, len)) - return -EFAULT; -- *off = pos + len; -+ file->f_pos += len; - return (len); - } - return (0); -@@ -255,7 +255,11 @@ - struct procdata *pd = NULL; - ulong flags; - -+#ifdef COMPAT_USE_MODCOUNT_LOCK -+ MOD_INC_USE_COUNT; -+#else - lock_kernel(); -+#endif - card = card_root; - while (card) { - pd = card->proclog; -@@ -264,7 +268,11 @@ - card = card->next; /* search next entry */ - } - if (!card) { -+#ifdef COMPAT_USE_MODCOUNT_LOCK -+ MOD_DEC_USE_COUNT; -+#else - unlock_kernel(); -+#endif - return (-ENODEV); /* device is unknown/invalid */ - } - filep->private_data = card; /* remember our own card */ -@@ -274,19 +282,24 @@ - } else if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) { - - /* read access -> log/debug read */ -- save_flags(flags); -- cli(); -+ HYSDN_SPIN_LOCK(&card->irq_lock, flags); - pd->if_used++; - if (pd->log_head) -- filep->private_data = &(pd->log_tail->next); -+ (struct log_data **) filep->private_data = &(pd->log_tail->next); - else -- filep->private_data = &(pd->log_head); -- restore_flags(flags); -+ (struct log_data **) filep->private_data = &(pd->log_head); -+ HYSDN_SPIN_UNLOCK(&card->irq_lock, flags); - } else { /* simultaneous read/write access forbidden ! */ -+#ifdef COMPAT_USE_MODCOUNT_LOCK -+ MOD_DEC_USE_COUNT; -+#else - unlock_kernel(); -+#endif - return (-EPERM); /* no permission this time */ - } -+#ifndef COMPAT_USE_MODCOUNT_LOCK - unlock_kernel(); -+#endif - return (0); - } /* hysdn_log_open */ - -@@ -306,7 +319,9 @@ - int flags, retval = 0; - - -+#ifndef COMPAT_USE_MODCOUNT_LOCK - lock_kernel(); -+#endif - if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) { - /* write only access -> write debug level written */ - retval = 0; /* success */ -@@ -314,8 +329,7 @@ - /* read access -> log/debug read, mark one further file as closed */ - - pd = NULL; -- save_flags(flags); -- cli(); -+ HYSDN_SPIN_LOCK(&card->irq_lock, flags); - inf = *((struct log_data **) filep->private_data); /* get first log entry */ - if (inf) - pd = (struct procdata *) inf->proc_ctrl; /* still entries there */ -@@ -338,7 +352,7 @@ - inf->usage_cnt--; /* decrement usage count for buffers */ - inf = inf->next; - } -- restore_flags(flags); -+ HYSDN_SPIN_UNLOCK(&card->irq_lock, flags); - - if (pd) - if (pd->if_used <= 0) /* delete buffers if last file closed */ -@@ -348,7 +362,11 @@ - kfree(inf); - } - } /* read access */ -+#ifdef COMPAT_USE_MODCOUNT_LOCK -+ MOD_DEC_USE_COUNT; -+#else - unlock_kernel(); -+#endif - - return (retval); - } /* hysdn_log_close */ -@@ -400,6 +418,9 @@ - release: hysdn_log_close, - }; - -+#ifdef COMPAT_NO_SOFTNET -+struct inode_operations log_inode_operations; -+#endif - - /***********************************************************************************/ - /* hysdn_proclog_init is called when the module is loaded after creating the cards */ -@@ -414,10 +435,20 @@ - - if ((pd = (struct procdata *) kmalloc(sizeof(struct procdata), GFP_KERNEL)) != NULL) { - memset(pd, 0, sizeof(struct procdata)); -+#ifdef COMPAT_NO_SOFTNET -+ memset(&log_inode_operations, 0, sizeof(struct inode_operations)); -+ log_inode_operations.default_file_ops = &log_fops; -+#endif - sprintf(pd->log_name, "%s%d", PROC_LOG_BASENAME, card->myid); - if ((pd->log = create_proc_entry(pd->log_name, S_IFREG | S_IRUGO | S_IWUSR, hysdn_proc_entry)) != NULL) { -+#ifdef COMPAT_NO_SOFTNET -+ pd->log->ops = &log_inode_operations; /* set new operations table */ -+#else - pd->log->proc_fops = &log_fops; -+#ifdef COMPAT_HAS_FILEOP_OWNER - pd->log->owner = THIS_MODULE; -+#endif -+#endif - } - - init_waitqueue_head(&(pd->rd_queue)); -diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/hysdn_sched.c linux-2.4.29/drivers/isdn/hysdn/hysdn_sched.c ---- linux-2.4.29.old/drivers/isdn/hysdn/hysdn_sched.c 2005-03-22 14:47:57.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/hysdn/hysdn_sched.c 2005-03-22 15:06:48.630699792 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hysdn_sched.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id: hysdn_sched.c,v 1.9 2001/09/24 13:23:03 kai Exp $ - * - * Linux driver for HYSDN cards - * scheduler routines for handling exchange card <-> pc. -@@ -12,11 +12,9 @@ - */ - - #include --#include - #include - #include - #include --#include - #include - - #include "hysdn_defs.h" -@@ -151,22 +149,19 @@ - - if (card->debug_flags & LOG_SCHED_ASYN) - hysdn_addlog(card, "async tx-cfg chan=%d len=%d", chan, strlen(line) + 1); -- -- save_flags(flags); -- cli(); -+ HYSDN_SPIN_LOCK(&card->irq_lock, flags); - while (card->async_busy) { -- sti(); -- -+ HYSDN_SPIN_UNLOCK(&card->irq_lock, flags); - if (card->debug_flags & LOG_SCHED_ASYN) - hysdn_addlog(card, "async tx-cfg delayed"); - - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout((20 * HZ) / 1000); /* Timeout 20ms */ - if (!--cnt) { -- restore_flags(flags); -+ HYSDN_SPIN_UNLOCK(&card->irq_lock, flags); - return (-ERR_ASYNC_TIME); /* timed out */ - } -- cli(); -+ HYSDN_SPIN_LOCK(&card->irq_lock, flags); - } /* wait for buffer to become free */ - - strcpy(card->async_data, line); -@@ -177,31 +172,26 @@ - /* now queue the task */ - queue_task(&card->irq_queue, &tq_immediate); - mark_bh(IMMEDIATE_BH); -- sti(); -- -+ HYSDN_SPIN_UNLOCK(&card->irq_lock, flags); - if (card->debug_flags & LOG_SCHED_ASYN) - hysdn_addlog(card, "async tx-cfg data queued"); - - cnt++; /* short delay */ -- cli(); -- -+ HYSDN_SPIN_LOCK(&card->irq_lock, flags); - while (card->async_busy) { -- sti(); -- -+ HYSDN_SPIN_UNLOCK(&card->irq_lock, flags); - if (card->debug_flags & LOG_SCHED_ASYN) - hysdn_addlog(card, "async tx-cfg waiting for tx-ready"); - - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout((20 * HZ) / 1000); /* Timeout 20ms */ - if (!--cnt) { -- restore_flags(flags); -+ HYSDN_SPIN_UNLOCK(&card->irq_lock, flags); - return (-ERR_ASYNC_TIME); /* timed out */ - } -- cli(); -+ HYSDN_SPIN_LOCK(&card->irq_lock, flags); - } /* wait for buffer to become free again */ -- -- restore_flags(flags); -- -+ HYSDN_SPIN_UNLOCK(&card->irq_lock, flags); - if (card->debug_flags & LOG_SCHED_ASYN) - hysdn_addlog(card, "async tx-cfg data send"); - -diff -rNu linux-2.4.29.old/drivers/isdn/icn/icn.c linux-2.4.29/drivers/isdn/icn/icn.c ---- linux-2.4.29.old/drivers/isdn/icn/icn.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/icn/icn.c 2005-03-22 15:06:48.722685808 +0100 -@@ -1,4 +1,4 @@ --/* $Id: icn.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * ISDN low-level module for the ICN active ISDN-Card. - * -@@ -41,7 +41,7 @@ - #undef MAP_DEBUG - - static char --*revision = "$Revision: 1.1.4.1 $"; -+*revision = "$Revision$"; - - static int icn_addcard(int, char *, char *); - -@@ -1634,6 +1634,7 @@ - } - - #ifndef MODULE -+#ifdef COMPAT_HAS_NEW_SETUP - static int __init - icn_setup(char *line) - { -@@ -1643,6 +1644,14 @@ - static char sid2[20]; - - str = get_options(line, 2, ints); -+#else -+void -+icn_setup(char *str, int *ints) -+{ -+ char *p; -+ static char sid[20]; -+ static char sid2[20]; -+#endif - if (ints[0]) - portbase = ints[1]; - if (ints[0] > 1) -@@ -1656,9 +1665,13 @@ - icn_id2 = sid2; - } - } -+#ifdef COMPAT_HAS_NEW_SETUP - return(1); - } - __setup("icn=", icn_setup); -+#else -+} -+#endif - #endif /* MODULE */ - - static int __init icn_init(void) -diff -rNu linux-2.4.29.old/drivers/isdn/icn/icn.h linux-2.4.29/drivers/isdn/icn/icn.h ---- linux-2.4.29.old/drivers/isdn/icn/icn.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/icn/icn.h 2005-03-22 15:06:48.752681248 +0100 -@@ -1,4 +1,4 @@ --/* $Id: icn.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * ISDN lowlevel-module for the ICN active ISDN-Card. - * -diff -rNu linux-2.4.29.old/drivers/isdn/isdn_audio.c linux-2.4.29/drivers/isdn/isdn_audio.c ---- linux-2.4.29.old/drivers/isdn/isdn_audio.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdn_audio.c 2005-03-22 15:06:44.306357192 +0100 -@@ -1,9 +1,9 @@ --/* $Id: isdn_audio.c,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $ -+/* $Id: isdn_audio.c,v 1.24 2002/08/13 09:57:26 keil Exp $ - * - * Linux ISDN subsystem, audio conversion and compression (linklevel). - * - * Copyright 1994-1999 by Fritz Elfert (fritz@isdn4linux.de) -- * DTMF code (c) 1996 by Christian Mock (cm@kukuruz.ping.at) -+ * DTMF code (c) 1996 by Christian Mock (cm@tahina.priv.at) - * Silence detection (c) 1998 by Armin Schindler (mac@gismo.telekom.de) - * - * This software may be used and distributed according to the terms -@@ -15,7 +15,7 @@ - #include "isdn_audio.h" - #include "isdn_common.h" - --char *isdn_audio_revision = "$Revision: 1.1.4.1 $"; -+char *isdn_audio_revision = "$Revision: 1.24 $"; - - /* - * Misc. lookup-tables. -@@ -169,19 +169,39 @@ - 0x8a, 0x8a, 0x6a, 0x6a, 0xea, 0xea, 0x2a, 0x2a - }; - --#define NCOEFF 8 /* number of frequencies to be analyzed */ --#define DTMF_TRESH 4000 /* above this is dtmf */ -+#define NCOEFF 16 /* number of frequencies to be analyzed */ -+#define DTMF_TRESH 25000 /* above this is dtmf */ - #define SILENCE_TRESH 200 /* below this is silence */ -+#define H2_TRESH 20000 /* 2nd harmonic */ - #define AMP_BITS 9 /* bits per sample, reduced to avoid overflow */ - #define LOGRP 0 - #define HIGRP 1 - -+typedef struct { -+ int grp; /* low/high group */ -+ int k; /* k */ -+ int k2; /* k fuer 2. harmonic */ -+} dtmf_t; -+ - /* For DTMF recognition: - * 2 * cos(2 * PI * k / N) precalculated for all k - */ - static int cos2pik[NCOEFF] = - { -- 55813, 53604, 51193, 48591, 38114, 33057, 25889, 18332 -+ 55812, 29528, 53603, 24032, 51193, 14443, 48590, 6517, -+ 38113, -21204, 33057, -32186, 25889, -45081, 18332, -55279 -+}; -+ -+static dtmf_t dtmf_tones[8] = -+{ -+ {LOGRP, 0, 1}, /* 697 Hz */ -+ {LOGRP, 2, 3}, /* 770 Hz */ -+ {LOGRP, 4, 5}, /* 852 Hz */ -+ {LOGRP, 6, 7}, /* 941 Hz */ -+ {HIGRP, 8, 9}, /* 1209 Hz */ -+ {HIGRP, 10, 11}, /* 1336 Hz */ -+ {HIGRP, 12, 13}, /* 1477 Hz */ -+ {HIGRP, 14, 15} /* 1633 Hz */ - }; - - static char dtmf_matrix[4][4] = -@@ -208,7 +228,7 @@ - : "memory", "ax"); - #else - while (n--) -- *buff = table[*(unsigned char *)buff], buff++; -+ *buff++ = table[*(unsigned char *)buff]; - #endif - } - -@@ -479,18 +499,6 @@ - sk2 = sk1; - sk1 = sk; - } -- /* Avoid overflows */ -- sk >>= 1; -- sk2 >>= 1; -- /* compute |X(k)|**2 */ -- /* report overflows. This should not happen. */ -- /* Comment this out if desired */ -- if (sk < -32768 || sk > 32767) -- printk(KERN_DEBUG -- "isdn_audio: dtmf goertzel overflow, sk=%d\n", sk); -- if (sk2 < -32768 || sk2 > 32767) -- printk(KERN_DEBUG -- "isdn_audio: dtmf goertzel overflow, sk2=%d\n", sk2); - result[k] = - ((sk * sk) >> AMP_BITS) - - ((((cos2pik[k] * sk) >> 15) * sk2) >> AMP_BITS) + -@@ -514,58 +522,28 @@ - int grp[2]; - char what; - char *p; -- int thresh; - - while ((skb = skb_dequeue(&info->dtmf_queue))) { - result = (int *) skb->data; - s = info->dtmf_state; -- grp[LOGRP] = grp[HIGRP] = -1; -+ grp[LOGRP] = grp[HIGRP] = -2; - silence = 0; -- thresh = 0; -- for (i = 0; i < NCOEFF; i++) { -- if (result[i] > DTMF_TRESH) { -- if (result[i] > thresh) -- thresh = result[i]; -- } -- else if (result[i] < SILENCE_TRESH) -+ for (i = 0; i < 8; i++) { -+ if ((result[dtmf_tones[i].k] > DTMF_TRESH) && -+ (result[dtmf_tones[i].k2] < H2_TRESH)) -+ grp[dtmf_tones[i].grp] = (grp[dtmf_tones[i].grp] == -2) ? i : -1; -+ else if ((result[dtmf_tones[i].k] < SILENCE_TRESH) && -+ (result[dtmf_tones[i].k2] < SILENCE_TRESH)) - silence++; - } -- if (silence == NCOEFF) -+ if (silence == 8) - what = ' '; - else { -- if (thresh > 0) { -- thresh = thresh >> 4; /* touchtones must match within 12 dB */ -- for (i = 0; i < NCOEFF; i++) { -- if (result[i] < thresh) -- continue; /* ignore */ -- /* good level found. This is allowed only one time per group */ -- if (i < NCOEFF / 2) { -- /* lowgroup*/ -- if (grp[LOGRP] >= 0) { -- // Bad. Another tone found. */ -- grp[LOGRP] = -1; -- break; -- } -- else -- grp[LOGRP] = i; -- } -- else { /* higroup */ -- if (grp[HIGRP] >= 0) { // Bad. Another tone found. */ -- grp[HIGRP] = -1; -- break; -- } -- else -- grp[HIGRP] = i - NCOEFF/2; -- } -- } -- if ((grp[LOGRP] >= 0) && (grp[HIGRP] >= 0)) { -- what = dtmf_matrix[grp[LOGRP]][grp[HIGRP]]; -- if (s->last != ' ' && s->last != '.') -- s->last = what; /* min. 1 non-DTMF between DTMF */ -- } else -- what = '.'; -- } -- else -+ if ((grp[LOGRP] >= 0) && (grp[HIGRP] >= 0)) { -+ what = dtmf_matrix[grp[LOGRP]][grp[HIGRP] - 4]; -+ if (s->last != ' ' && s->last != '.') -+ s->last = what; /* min. 1 non-DTMF between DTMF */ -+ } else - what = '.'; - } - if ((what != s->last) && (what != ' ') && (what != '.')) { -diff -rNu linux-2.4.29.old/drivers/isdn/isdn_audio.h linux-2.4.29/drivers/isdn/isdn_audio.h ---- linux-2.4.29.old/drivers/isdn/isdn_audio.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdn_audio.h 2005-03-22 15:06:44.321354912 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn_audio.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: isdn_audio.h,v 1.10 2001/09/24 13:22:42 kai Exp $ - * - * Linux ISDN subsystem, audio conversion and compression (linklevel). - * -@@ -20,7 +20,6 @@ - - typedef struct dtmf_state { - char last; -- char llast; - int idx; - int buf[DTMF_NPOINTS]; - } dtmf_state; -diff -rNu linux-2.4.29.old/drivers/isdn/isdn_bsdcomp.c linux-2.4.29/drivers/isdn/isdn_bsdcomp.c ---- linux-2.4.29.old/drivers/isdn/isdn_bsdcomp.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdn_bsdcomp.c 2005-03-22 15:06:44.339352176 +0100 -@@ -105,6 +105,14 @@ - - #define DEBUG 1 - -+#ifdef CONFIG_ISDN_WITH_ABC -+#define BSD_C_MALLOC(x) kmalloc((x),GFP_ATOMIC) -+#define BSD_C_FREE(x) kfree(x) -+#else -+#define BSD_C_MALLOC(x) vmalloc(x) -+#define BSD_C_FREE(x) vfree(x) -+#endif -+ - /* - * A dictionary for doing BSD compress. - */ -@@ -285,7 +293,7 @@ - * Release the dictionary - */ - if (db->dict) { -- vfree (db->dict); -+ BSD_C_FREE (db->dict); - db->dict = NULL; - } - -@@ -293,7 +301,7 @@ - * Release the string buffer - */ - if (db->lens) { -- vfree (db->lens); -+ BSD_C_FREE (db->lens); - db->lens = NULL; - } - -@@ -350,14 +358,19 @@ - * Allocate space for the dictionary. This may be more than one page in - * length. - */ -- db->dict = (struct bsd_dict *) vmalloc (hsize * sizeof (struct bsd_dict)); -+ db->dict = (struct bsd_dict *) BSD_C_MALLOC (hsize * sizeof (struct bsd_dict)); -+ -+ MOD_INC_USE_COUNT; -+ /* -+ ** MOD_INC_USE_COUNT must be before bsd_free -+ ** bsd_free make MOD_DEC_USE_COUNT if db != NULL -+ */ -+ - if (!db->dict) { - bsd_free (db); - return NULL; - } - -- MOD_INC_USE_COUNT; -- - /* - * If this is the compression buffer then there is no length data. - * For decompression, the length information is needed as well. -@@ -365,7 +378,7 @@ - if (!decomp) - db->lens = NULL; - else { -- db->lens = (unsigned short *) vmalloc ((maxmaxcode + 1) * -+ db->lens = (unsigned short *) BSD_C_MALLOC ((maxmaxcode + 1) * - sizeof (db->lens[0])); - if (!db->lens) { - bsd_free (db); /* calls MOD_DEC_USE_COUNT; */ -@@ -478,7 +491,11 @@ - int hval,disp,ilen,mxcode; - unsigned char *rptr = skb_in->data; - int isize = skb_in->len; -+#ifdef CONFIG_ISDN_WITH_ABC -+ long secure = 0; -+#endif - -+#ifndef CONFIG_ISDN_WITH_ABC - #define OUTPUT(ent) \ - { \ - bitno -= n_bits; \ -@@ -490,17 +507,45 @@ - bitno += 8; \ - } while (bitno <= 24); \ - } -+#else -+#define OUTPUT(ent) \ -+ { \ -+ secure = 0; \ -+ bitno -= n_bits; \ -+ accm |= ((ent) << bitno); \ -+ do { \ -+ if(skb_out && skb_tailroom(skb_out) > 0) \ -+ *(skb_put(skb_out,1)) = (unsigned char) (accm>>24); \ -+ accm <<= 8; \ -+ bitno += 8; \ -+ } while (bitno <= 24 && ++secure < 10000); \ -+ if(secure >= 10000) { \ -+ printk(KERN_DEBUG "BSD in OUTPUT secure counter reached\n"); \ -+ return 0; \ -+ } \ -+ } -+#endif - - /* - * If the protocol is not in the range we're interested in, - * just return without compressing the packet. If it is, - * the protocol becomes the first byte to compress. - */ -+#ifdef CONFIG_ISDN_WITH_ABC -+ ent = proto; -+ -+ if (proto < 0x21 || proto > 0xf9 || !(proto & 0x1) ) { -+ -+ printk(KERN_DEBUG "bsd_compress called with %x\n",proto); -+ return 0; -+ } -+#else - printk(KERN_DEBUG "bsd_compress called with %x\n",proto); - - ent = proto; - if (proto < 0x21 || proto > 0xf9 || !(proto & 0x1) ) - return 0; -+#endif - - db = (struct bsd_db *) state; - hshift = db->hshift; -@@ -538,6 +583,9 @@ - - /* continue probing until a match or invalid entry */ - disp = (hval == 0) ? 1 : hval; -+#ifdef CONFIG_ISDN_WITH_ABC -+ secure = 0; -+#endif - - do { - hval += disp; -@@ -546,7 +594,15 @@ - dictp = dict_ptr (db, hval); - if (dictp->codem1 >= max_ent) - goto nomatch; -+#ifndef CONFIG_ISDN_WITH_ABC - } while (dictp->fcode != fcode); -+#else -+ } while (dictp->fcode != fcode && ++secure < 100000); -+ if(secure >= 100000) { -+ printk(KERN_DEBUG "BSD: compress while dictp->fcode != fcode secure-counter reached\n"); -+ return 0; -+ } -+#endif - - ent = dictp->codem1 + 1; /* finally found (prefix,suffix) */ - continue; -@@ -669,6 +725,9 @@ - int ilen; - int codelen; - int extra; -+#ifdef CONFIG_ISDN_WITH_ABC -+ unsigned long secure = 0; -+#endif - - db = (struct bsd_db *) state; - max_ent = db->max_ent; -@@ -677,7 +736,9 @@ - n_bits = db->n_bits; - tgtbitno = 32 - n_bits; /* bitno when we have a code */ - -+#ifndef CONFIG_ISDN_WITH_ABC - printk(KERN_DEBUG "bsd_decompress called\n"); -+#endif - - if(!skb_in || !skb_out) { - printk(KERN_ERR "bsd_decompress called with NULL parameter\n"); -@@ -795,7 +856,11 @@ - - p = skb_put(skb_out,codelen); - p += codelen; -+#ifdef CONFIG_ISDN_WITH_ABC -+ for(secure = 0; finchar > LAST && secure < 50000;secure++) { -+#else - while (finchar > LAST) { -+#endif - struct bsd_dict *dictp2 = dict_ptr (db, finchar); - - dictp = dict_ptr (db, dictp2->cptr); -@@ -822,6 +887,12 @@ - } - } - *--p = finchar; -+#ifdef CONFIG_ISDN_WITH_ABC -+ if(secure >= 50000) { -+ printk(KERN_DEBUG "BSD: decompress secure-counter reached\n"); -+ return DECOMP_FATALERROR; -+ } -+#endif - - #ifdef DEBUG - if (--codelen != 0) -@@ -851,12 +922,23 @@ - /* look for a free hash table entry */ - if (dictp->codem1 < max_ent) { - disp = (hval == 0) ? 1 : hval; -+#ifdef CONFIG_ISDN_WITH_ABC -+ secure = 0; -+#endif - do { - hval += disp; - if (hval >= db->hsize) - hval -= db->hsize; - dictp = dict_ptr (db, hval); -+#ifndef CONFIG_ISDN_WITH_ABC - } while (dictp->codem1 < max_ent); -+#else -+ } while (dictp->codem1 < max_ent && ++secure < 50000); -+ if(secure >= 50000) { -+ printk(KERN_DEBUG "BSD: decomp while (dictp->codem1 < max_ent) secure-counter reached\n"); -+ return DECOMP_FATALERROR; -+ } -+#endif - } - - /* -@@ -895,11 +977,21 @@ - db->comp_bytes += skb_in->len - BSD_OVHD; - db->uncomp_bytes += skb_out->len; - -+#ifdef CONFIG_ISDN_WITH_ABC -+ /* -+ ** bsd_check will call bsd_clear -+ ** and so on the internal tables will be cleared. -+ ** -+ ** I think that's not what we will at this point ????? -+ ** For me at works without bsd_check. -+ */ -+#else - if (bsd_check(db)) { - if (db->debug) - printk(KERN_DEBUG "bsd_decomp%d: peer should have cleared dictionary on %d\n", - db->unit, db->seqno - 1); - } -+#endif - return skb_out->len; - } - -diff -rNu linux-2.4.29.old/drivers/isdn/isdn_common.c linux-2.4.29/drivers/isdn/isdn_common.c ---- linux-2.4.29.old/drivers/isdn/isdn_common.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdn_common.c 2005-03-22 15:06:44.359349136 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn_common.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: isdn_common.c,v 1.137 2002/02/09 21:19:11 keil Exp $ - * - * Linux ISDN subsystem, common used functions (linklevel). - * -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - #include "isdn_common.h" - #include "isdn_tty.h" - #include "isdn_net.h" -@@ -33,7 +34,9 @@ - #include - #endif /* CONFIG_ISDN_DIVERSION */ - #include "isdn_v110.h" -+#ifdef HAVE_DEVFS_FS - #include -+#endif /* HAVE_DEVFS_FS */ - - /* Debugflags */ - #undef ISDN_DEBUG_STATCALLB -@@ -44,7 +47,7 @@ - - isdn_dev *dev; - --static char *isdn_revision = "$Revision: 1.1.4.1 $"; -+static char *isdn_revision = "$Revision: 1.137 $"; - - extern char *isdn_net_revision; - extern char *isdn_tty_revision; -@@ -67,19 +70,19 @@ - - static int isdn_writebuf_stub(int, int, const u_char *, int, int); - static void set_global_features(void); -+#ifdef HAVE_DEVFS_FS - static void isdn_register_devfs(int); - static void isdn_unregister_devfs(int); -+#endif /* HAVE_DEVFS_FS */ - static int isdn_wildmat(char *s, char *p); - - void - isdn_lock_drivers(void) - { - int i; -- isdn_ctrl cmd; - -- for (i = 0; i < ISDN_MAX_DRIVERS; i++) { -- if (!dev->drv[i]) -- continue; -+ for (i = 0; i < dev->drivers; i++) { -+ isdn_ctrl cmd; - - cmd.driver = i; - cmd.arg = 0; -@@ -101,10 +104,7 @@ - { - int i; - -- for (i = 0; i < ISDN_MAX_DRIVERS; i++) { -- if (!dev->drv[i]) -- continue; -- -+ for (i = 0; i < dev->drivers; i++) - if (dev->drv[i]->locks > 0) { - isdn_ctrl cmd; - -@@ -114,7 +114,6 @@ - isdn_command(&cmd); - dev->drv[i]->locks--; - } -- } - } - - void -@@ -473,6 +472,7 @@ - dev->drv[di]->flags &= ~DRV_FLAG_RUNNING; - break; - case ISDN_STAT_ICALL: -+ case ISDN_STAT_ICALLW: - if (i < 0) - return -1; - #ifdef ISDN_DEBUG_STATCALLB -@@ -718,7 +718,9 @@ - dev->drvmap[i] = -1; - dev->chanmap[i] = -1; - dev->usage[i] &= ~ISDN_USAGE_DISABLED; -+#ifdef HAVE_DEVFS_FS - isdn_unregister_devfs(i); -+#endif /* HAVE_DEVFS_FS */ - } - dev->drivers--; - dev->channels -= dev->drv[di]->channels; -@@ -755,6 +757,10 @@ - if (divert_if) - return(divert_if->stat_callback(c)); - #endif /* CONFIG_ISDN_DIVERSION */ -+ case ISDN_STAT_ALERT: -+ case ISDN_STAT_PROCEED: -+ isdn_tty_stat_callback(i, c); -+ break; - default: - return -1; - } -@@ -900,72 +906,239 @@ - return (dev->chanmap[minor]); - } - --static char * --isdn_statstr(void) -+// ---------------------------------------------------------------------- -+// /dev/isdninfo -+// -+// This device has somewhat insane semantics, but we need to support -+// them for the sake of compatibility. -+// -+// After opening, the first read will succeed and return the current state -+// Then, unless O_NONBLOCK is set, it will block until a state change happens -+// and then return the new state. -+// Also, if the buffer size for the read is too small, we'll just return -+// EOF -+ -+struct isdnstatus_dev { -+ struct list_head list; -+ int update; -+}; -+ -+static DECLARE_WAIT_QUEUE_HEAD(isdnstatus_waitq); -+static LIST_HEAD(isdnstatus_devs); -+static spinlock_t isdnstatus_devs_lock = SPIN_LOCK_UNLOCKED; -+ -+void -+isdn_info_update(void) -+{ -+ struct list_head *p; -+ struct isdnstatus_dev *idev; -+ -+ spin_lock(&isdnstatus_devs_lock); -+ list_for_each(p, &isdnstatus_devs) { -+ idev = list_entry(p, struct isdnstatus_dev, list); -+ idev->update = 1; -+ } -+ spin_unlock(&isdnstatus_devs_lock); -+ wake_up_interruptible(&isdnstatus_waitq); -+} -+ -+static int -+isdnstatus_open(struct inode *ino, struct file *filep) -+{ -+ struct isdnstatus_dev *p; -+ -+ p = kmalloc(sizeof(struct isdnstatus_dev), GFP_USER); -+ if (!p) -+ return -ENOMEM; -+ -+ /* At opening time we allow a single update */ -+ p->update = 1; -+ spin_lock(&isdnstatus_devs_lock); -+ list_add(&p->list, &isdnstatus_devs); -+ spin_unlock(&isdnstatus_devs_lock); -+ filep->private_data = p; -+ -+ return 0; -+} -+ -+static void -+isdnstatus_close(struct inode *ino, struct file *filep) -+{ -+ struct isdnstatus_dev *p = filep->private_data; -+ -+ spin_lock(&isdnstatus_devs_lock); -+ list_del(&p->list); -+ spin_unlock(&isdnstatus_devs_lock); -+ kfree(p); -+} -+ -+// FIXME we don't lock against the state changing whilst being -+// printed -+ -+void -+isdn_statstr(char *buf) - { -- static char istatbuf[2048]; - char *p; - int i; - -- sprintf(istatbuf, "idmap:\t"); -- p = istatbuf + strlen(istatbuf); -+ p = buf; -+ p += sprintf(p, "idmap:\t"); - for (i = 0; i < ISDN_MAX_CHANNELS; i++) { -- sprintf(p, "%s ", (dev->drvmap[i] < 0) ? "-" : dev->drvid[dev->drvmap[i]]); -- p = istatbuf + strlen(istatbuf); -+ p += sprintf(p, "%s ", (dev->drvmap[i] < 0) ? "-" : dev->drvid[dev->drvmap[i]]); - } -- sprintf(p, "\nchmap:\t"); -- p = istatbuf + strlen(istatbuf); -+ p += sprintf(p, "\nchmap:\t"); - for (i = 0; i < ISDN_MAX_CHANNELS; i++) { -- sprintf(p, "%d ", dev->chanmap[i]); -- p = istatbuf + strlen(istatbuf); -+ p += sprintf(p, "%d ", dev->chanmap[i]); - } -- sprintf(p, "\ndrmap:\t"); -- p = istatbuf + strlen(istatbuf); -+ p += sprintf(p, "\ndrmap:\t"); - for (i = 0; i < ISDN_MAX_CHANNELS; i++) { -- sprintf(p, "%d ", dev->drvmap[i]); -- p = istatbuf + strlen(istatbuf); -+ p += sprintf(p, "%d ", dev->drvmap[i]); - } -- sprintf(p, "\nusage:\t"); -- p = istatbuf + strlen(istatbuf); -+ p += sprintf(p, "\nusage:\t"); - for (i = 0; i < ISDN_MAX_CHANNELS; i++) { -- sprintf(p, "%d ", dev->usage[i]); -- p = istatbuf + strlen(istatbuf); -+ p += sprintf(p, "%d ", dev->usage[i]); - } -- sprintf(p, "\nflags:\t"); -- p = istatbuf + strlen(istatbuf); -+ p += sprintf(p, "\nflags:\t"); - for (i = 0; i < ISDN_MAX_DRIVERS; i++) { - if (dev->drv[i]) { -- sprintf(p, "%ld ", dev->drv[i]->online); -- p = istatbuf + strlen(istatbuf); -+ p += sprintf(p, "%ld ", dev->drv[i]->online); - } else { -- sprintf(p, "? "); -- p = istatbuf + strlen(istatbuf); -+ p += sprintf(p, "? "); - } - } -- sprintf(p, "\nphone:\t"); -- p = istatbuf + strlen(istatbuf); -+ p += sprintf(p, "\nphone:\t"); - for (i = 0; i < ISDN_MAX_CHANNELS; i++) { -- sprintf(p, "%s ", dev->num[i]); -- p = istatbuf + strlen(istatbuf); -+ p += sprintf(p, "%s ", dev->num[i]); - } -- sprintf(p, "\n"); -- return istatbuf; -+ p += sprintf(p, "\n"); - } - --/* Module interface-code */ -+static ssize_t -+isdnstatus_read(struct file *file, char *buf, size_t count, loff_t * off) -+{ -+ static DECLARE_MUTEX(istatbuf_mutex); -+ static char istatbuf[2048]; - --void --isdn_info_update(void) -+ DECLARE_WAITQUEUE(wait, current); -+ struct isdnstatus_dev *idev; -+ int retval = 0; -+ unsigned int len; -+ -+ idev = file->private_data; -+ -+ if (off != &file->f_pos) -+ return -ESPIPE; -+ -+ add_wait_queue(&isdnstatus_waitq, &wait); -+ for (;;) { -+ set_current_state(TASK_INTERRUPTIBLE); -+ -+ if (idev->update) -+ break; -+ -+ retval = -EAGAIN; -+ if (file->f_flags & O_NONBLOCK) -+ break; -+ -+ retval = -ERESTARTSYS; -+ if (signal_pending(current)) -+ break; -+ -+ schedule(); -+ } -+ __set_current_state(TASK_RUNNING); -+ remove_wait_queue(&isdnstatus_waitq, &wait); -+ -+ if (!idev->update) -+ goto out; -+ -+ idev->update = 0; -+ down(&istatbuf_mutex); -+ isdn_statstr(istatbuf); -+ len = strlen(istatbuf); -+ if (len > count) { -+ retval = 0; -+ goto out_unlock; -+ } -+ if (copy_to_user(buf, istatbuf, len)) { -+ retval = -EFAULT; -+ goto out_unlock; -+ } -+ *off += len; -+ retval = len; -+ -+ out_unlock: -+ up(&istatbuf_mutex); -+ out: -+ return retval; -+} -+ -+static ssize_t -+isdnstatus_write(struct file *file, const char *buf, size_t count, loff_t * off) - { -- infostruct *p = dev->infochain; -+ return -EINVAL; -+} -+ -+static unsigned int -+isdnstatus_poll(struct file *file, poll_table * wait) -+{ -+ struct isdnstatus_dev *idev; -+ unsigned int mask = 0; -+ -+ idev = file->private_data; - -- while (p) { -- *(p->private) = 1; -- p = (infostruct *) p->next; -+ poll_wait(file, &isdnstatus_waitq, wait); -+ if (idev->update) { -+ mask |= POLLIN | POLLRDNORM; - } -- wake_up_interruptible(&(dev->info_waitq)); -+ return mask; - } - -+static int -+isdnstatus_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) -+{ -+ int retval; -+ isdn_net_ioctl_phone phone; -+ -+ switch (cmd) { -+ case IIOCGETDVR: -+ return (TTY_DV + -+ (NET_DV << 8) + -+ (INF_DV << 16)); -+ case IIOCGETCPS: -+ if (arg) { -+ ulong *p = (ulong *) arg; -+ int i; -+ if ((retval = verify_area(VERIFY_WRITE, (void *) arg, -+ sizeof(ulong) * ISDN_MAX_CHANNELS * 2))) -+ return retval; -+ for (i = 0; i < ISDN_MAX_CHANNELS; i++) { -+ put_user(dev->ibytes[i], p++); -+ put_user(dev->obytes[i], p++); -+ } -+ return 0; -+ } else -+ return -EINVAL; -+ break; -+#ifdef CONFIG_NETDEVICES -+ case IIOCNETGPN: -+ /* Get peer phone number of a connected -+ * isdn network interface */ -+ if (arg) { -+ if (copy_from_user((char *) &phone, (char *) arg, sizeof(phone))) -+ return -EFAULT; -+ return isdn_net_getpeer(&phone, (isdn_net_ioctl_phone *) arg); -+ } else -+ return -EINVAL; -+#endif -+ default: -+ return -EINVAL; -+ } -+} -+ -+// ---------------------------------------------------------------------- -+ -+ - static ssize_t - isdn_read(struct file *file, char *buf, size_t count, loff_t * off) - { -@@ -976,37 +1149,16 @@ - int chidx; - int retval; - char *p; -- loff_t pos = *off; - - if (off != &file->f_pos) - return -ESPIPE; - -- if (pos != (unsigned) pos) -- return -EINVAL; -- -+#ifndef COMPAT_HAVE_READ_LOCK_KERNEL - lock_kernel(); -- if (minor == ISDN_MINOR_STATUS) { -- if (!file->private_data) { -- if (file->f_flags & O_NONBLOCK) { -- retval = -EAGAIN; -- goto out; -- } -- interruptible_sleep_on(&(dev->info_waitq)); -- } -- p = isdn_statstr(); -- file->private_data = 0; -- if ((len = strlen(p)) <= count) { -- if (copy_to_user(buf, p, len)) { -- retval = -EFAULT; -- goto out; -- } -- *off = pos + len; -- retval = len; -- goto out; -- } -- retval = 0; -- goto out; -- } -+#endif -+ if (minor == ISDN_MINOR_STATUS) -+ return isdnstatus_read(file, buf, count, off); -+ - if (!dev->drivers) { - retval = -ENODEV; - goto out; -@@ -1031,7 +1183,7 @@ - cli(); - len = isdn_readbchan(drvidx, chidx, p, 0, count, - &dev->drv[drvidx]->rcv_waitq[chidx]); -- *off = pos + len; -+ *off += len; - restore_flags(flags); - if (copy_to_user(buf,p,len)) - len = -EFAULT; -@@ -1052,6 +1204,9 @@ - } - interruptible_sleep_on(&(dev->drv[drvidx]->st_waitq)); - } -+#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT -+ if(drvidx || (len = isdn_dw_abc_lcr_readstat(buf,count)) < 1) { -+#endif - if (dev->drv[drvidx]->interface->readstat) { - if (count > dev->drv[drvidx]->stavail) - count = dev->drv[drvidx]->stavail; -@@ -1061,6 +1216,9 @@ - } else { - len = 0; - } -+#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT -+ } -+#endif - save_flags(flags); - cli(); - if (len) -@@ -1068,7 +1226,7 @@ - else - dev->drv[drvidx]->stavail = 0; - restore_flags(flags); -- *off = pos + len; -+ *off += len; - retval = len; - goto out; - } -@@ -1080,7 +1238,9 @@ - #endif - retval = -ENODEV; - out: -+#ifndef COMPAT_HAVE_READ_LOCK_KERNEL - unlock_kernel(); -+#endif - return retval; - } - -@@ -1092,15 +1252,18 @@ - int chidx; - int retval; - -+ if (minor == ISDN_MINOR_STATUS) -+ return isdnstatus_write(file, buf, count, off); -+ - if (off != &file->f_pos) - return -ESPIPE; - -- if (minor == ISDN_MINOR_STATUS) -- return -EPERM; - if (!dev->drivers) - return -ENODEV; - -+#ifndef COMPAT_HAVE_WRITE_LOCK_KERNEL - lock_kernel(); -+#endif - if (minor <= ISDN_MINOR_BMAX) { - printk(KERN_WARNING "isdn_write minor %d obsolete!\n", minor); - drvidx = isdn_minor2drv(minor); -@@ -1145,7 +1308,9 @@ - #endif - retval = -ENODEV; - out: -+#ifndef COMPAT_HAVE_WRITE_LOCK_KERNEL - unlock_kernel(); -+#endif - return retval; - } - -@@ -1156,15 +1321,12 @@ - unsigned int minor = MINOR(file->f_dentry->d_inode->i_rdev); - int drvidx = isdn_minor2drv(minor - ISDN_MINOR_CTRL); - -+#ifndef COMPAT_HAVE_POLL_LOCK_KERNEL - lock_kernel(); -- if (minor == ISDN_MINOR_STATUS) { -- poll_wait(file, &(dev->info_waitq), wait); -- /* mask = POLLOUT | POLLWRNORM; */ -- if (file->private_data) { -- mask |= POLLIN | POLLRDNORM; -- } -- goto out; -- } -+#endif -+ if (minor == ISDN_MINOR_STATUS) -+ return isdnstatus_poll(file, wait); -+ - if (minor >= ISDN_MINOR_CTRL && minor <= ISDN_MINOR_CTRLMAX) { - if (drvidx < 0) { - /* driver deregistered while file open */ -@@ -1186,7 +1348,9 @@ - #endif - mask = POLLERR; - out: -+#ifndef COMPAT_HAVE_POLL_LOCK_KERNEL - unlock_kernel(); -+#endif - return mask; - } - -@@ -1216,42 +1380,9 @@ - #define phone iocpar.phone - #define cfg iocpar.cfg - -- if (minor == ISDN_MINOR_STATUS) { -- switch (cmd) { -- case IIOCGETDVR: -- return (TTY_DV + -- (NET_DV << 8) + -- (INF_DV << 16)); -- case IIOCGETCPS: -- if (arg) { -- ulong *p = (ulong *) arg; -- int i; -- if ((ret = verify_area(VERIFY_WRITE, (void *) arg, -- sizeof(ulong) * ISDN_MAX_CHANNELS * 2))) -- return ret; -- for (i = 0; i < ISDN_MAX_CHANNELS; i++) { -- put_user(dev->ibytes[i], p++); -- put_user(dev->obytes[i], p++); -- } -- return 0; -- } else -- return -EINVAL; -- break; --#ifdef CONFIG_NETDEVICES -- case IIOCNETGPN: -- /* Get peer phone number of a connected -- * isdn network interface */ -- if (arg) { -- if (copy_from_user((char *) &phone, (char *) arg, sizeof(phone))) -- return -EFAULT; -- return isdn_net_getpeer(&phone, (isdn_net_ioctl_phone *) arg); -- } else -- return -EINVAL; --#endif -- default: -- return -EINVAL; -- } -- } -+ if (minor == ISDN_MINOR_STATUS) -+ return isdnstatus_ioctl(inode, file, cmd, arg); -+ - if (!dev->drivers) - return -ENODEV; - if (minor <= ISDN_MINOR_BMAX) { -@@ -1273,11 +1404,34 @@ - */ - switch (cmd) { - case IIOCNETDWRSET: -+#ifdef CONFIG_ISDN_WITH_ABC -+ if (arg) { -+ -+ if (copy_from_user(name, (char *) arg, sizeof(name))) { -+ -+ return(-EFAULT); -+ -+ } else { -+ -+ isdn_net_dev *p = isdn_net_findif(name); -+ -+ if(p == NULL) -+ return(-EINVAL); -+ -+ return(isdn_dw_abc_reset_interface(p->local,1)); -+ } -+ } -+#else - printk(KERN_INFO "INFO: ISDN_DW_ABC_EXTENSION not enabled\n"); -+#endif - return(-EINVAL); - case IIOCNETLCR: -+#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT -+ return(isdn_dw_abc_lcr_ioctl(arg)); -+#else - printk(KERN_INFO "INFO: ISDN_ABC_LCR_SUPPORT not enabled\n"); - return -ENODEV; -+#endif - #ifdef CONFIG_NETDEVICES - case IIOCNETAIF: - /* Add a network-interface */ -@@ -1650,22 +1804,12 @@ - int chidx; - int retval = -ENODEV; - -+#ifdef COMPAT_USE_MODCOUNT_LOCK -+ MOD_INC_USE_COUNT; -+#endif - - if (minor == ISDN_MINOR_STATUS) { -- infostruct *p; -- -- if ((p = kmalloc(sizeof(infostruct), GFP_KERNEL))) { -- p->next = (char *) dev->infochain; -- p->private = (char *) &(filep->private_data); -- dev->infochain = p; -- /* At opening we allow a single update */ -- filep->private_data = (char *) 1; -- retval = 0; -- goto out; -- } else { -- retval = -ENOMEM; -- goto out; -- } -+ return isdnstatus_open(ino, filep); - } - if (!dev->channels) - goto out; -@@ -1688,6 +1832,9 @@ - if (drvidx < 0) - goto out; - isdn_lock_drivers(); -+#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT -+ if(!drvidx) isdn_dw_abc_lcr_open(); -+#endif - retval = 0; - goto out; - } -@@ -1700,6 +1847,10 @@ - } - #endif - out: -+#ifdef COMPAT_USE_MODCOUNT_LOCK -+ if (retval) -+ MOD_DEC_USE_COUNT; -+#endif - return retval; - } - -@@ -1708,25 +1859,11 @@ - { - uint minor = MINOR(ino->i_rdev); - -+#ifndef COMPAT_USE_MODCOUNT_LOCK - lock_kernel(); -+#endif - if (minor == ISDN_MINOR_STATUS) { -- infostruct *p = dev->infochain; -- infostruct *q = NULL; -- -- while (p) { -- if (p->private == (char *) &(filep->private_data)) { -- if (q) -- q->next = p->next; -- else -- dev->infochain = (infostruct *) (p->next); -- kfree(p); -- goto out; -- } -- q = p; -- p = (infostruct *) (p->next); -- } -- printk(KERN_WARNING "isdn: No private data while closing isdnctrl\n"); -- goto out; -+ isdnstatus_close(ino, filep); - } - isdn_unlock_drivers(); - if (minor <= ISDN_MINOR_BMAX) -@@ -1734,6 +1871,12 @@ - if (minor <= ISDN_MINOR_CTRLMAX) { - if (dev->profd == current) - dev->profd = NULL; -+#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT -+ { -+ int drvidx = isdn_minor2drv(minor - ISDN_MINOR_CTRL); -+ if(!drvidx) isdn_dw_abc_lcr_close(); -+ } -+#endif - goto out; - } - #ifdef CONFIG_ISDN_PPP -@@ -1742,13 +1885,19 @@ - #endif - - out: -+#ifdef COMPAT_USE_MODCOUNT_LOCK -+ MOD_DEC_USE_COUNT; -+#else - unlock_kernel(); -+#endif - return 0; - } - - static struct file_operations isdn_fops = - { -+#ifdef COMPAT_HAS_FILEOP_OWNER - owner: THIS_MODULE, -+#endif - llseek: no_llseek, - read: isdn_read, - write: isdn_write, -@@ -1801,6 +1950,15 @@ - if (USG_NONE(dev->usage[i]) && - (dev->drvmap[i] != -1)) { - int d = dev->drvmap[i]; -+#ifdef CONFIG_ISDN_WITH_ABC_CH_EXTINUSE -+ if(jiffies < dev->dwabc_chan_external_inuse[i]) { -+ -+ if((dev->dwabc_chan_external_inuse[i] - jiffies) > (HZ * 120)) -+ dev->dwabc_chan_external_inuse[i] = 0; -+ else -+ continue; -+ } -+#endif - if ((dev->usage[i] & ISDN_USAGE_EXCLUSIVE) && - ((pre_dev != d) || (pre_chan != dev->chanmap[i]))) - continue; -@@ -1819,7 +1977,11 @@ - restore_flags(flags); - return i; - } else { -+#ifdef CONFIG_ISDN_WITH_ABC -+ if ((pre_dev == d) && ((pre_chan == dev->chanmap[i]) || pre_chan > 1000)) { -+#else - if ((pre_dev == d) && (pre_chan == dev->chanmap[i])) { -+#endif - dev->usage[i] &= ISDN_USAGE_EXCLUSIVE; - dev->usage[i] |= usage; - isdn_info_update(); -@@ -2006,7 +2168,7 @@ - - if ((adding) && (d->rcverr)) - kfree(d->rcverr); -- if (!(d->rcverr = kmalloc(sizeof(int) * m, GFP_KERNEL))) { -+ if (!(d->rcverr = (int *) kmalloc(sizeof(int) * m, GFP_KERNEL))) { - printk(KERN_WARNING "register_isdn: Could not alloc rcverr\n"); - return -1; - } -@@ -2014,7 +2176,7 @@ - - if ((adding) && (d->rcvcount)) - kfree(d->rcvcount); -- if (!(d->rcvcount = kmalloc(sizeof(int) * m, GFP_KERNEL))) { -+ if (!(d->rcvcount = (int *) kmalloc(sizeof(int) * m, GFP_KERNEL))) { - printk(KERN_WARNING "register_isdn: Could not alloc rcvcount\n"); - if (!adding) kfree(d->rcverr); - return -1; -@@ -2026,7 +2188,8 @@ - skb_queue_purge(&d->rpqueue[j]); - kfree(d->rpqueue); - } -- if (!(d->rpqueue = kmalloc(sizeof(struct sk_buff_head) * m, GFP_KERNEL))) { -+ if (!(d->rpqueue = -+ (struct sk_buff_head *) kmalloc(sizeof(struct sk_buff_head) * m, GFP_KERNEL))) { - printk(KERN_WARNING "register_isdn: Could not alloc rpqueue\n"); - if (!adding) { - kfree(d->rcvcount); -@@ -2040,7 +2203,8 @@ - - if ((adding) && (d->rcv_waitq)) - kfree(d->rcv_waitq); -- d->rcv_waitq = kmalloc(sizeof(wait_queue_head_t) * 2 * m, GFP_KERNEL); -+ d->rcv_waitq = (wait_queue_head_t *) -+ kmalloc(sizeof(wait_queue_head_t) * 2 * m, GFP_KERNEL); - if (!d->rcv_waitq) { - printk(KERN_WARNING "register_isdn: Could not alloc rcv_waitq\n"); - if (!adding) { -@@ -2064,7 +2228,9 @@ - if (dev->chanmap[k] < 0) { - dev->chanmap[k] = j; - dev->drvmap[k] = drvidx; -+#ifdef HAVE_DEVFS_FS - isdn_register_devfs(k); -+#endif /* HAVE_DEVFS_FS */ - break; - } - restore_flags(flags); -@@ -2128,6 +2294,7 @@ - i_div->ll_cmd = isdn_command; /* set command function */ - i_div->drv_to_name = map_drvname; - i_div->name_to_drv = map_namedrv; -+ i_div->dial_net_name = isdn_net_force_dial; - MOD_INC_USE_COUNT; - divert_if = i_div; /* remember interface */ - return(DIVERT_NO_ERR); -@@ -2165,7 +2332,7 @@ - printk(KERN_WARNING "register_isdn: No write routine given.\n"); - return 0; - } -- if (!(d = kmalloc(sizeof(driver), GFP_KERNEL))) { -+ if (!(d = (driver *) kmalloc(sizeof(driver), GFP_KERNEL))) { - printk(KERN_WARNING "register_isdn: Could not alloc driver-struct\n"); - return 0; - } -@@ -2225,6 +2392,7 @@ - return rev; - } - -+#ifdef HAVE_DEVFS_FS - #ifdef CONFIG_DEVFS_FS - - static devfs_handle_t devfs_handle; -@@ -2314,6 +2482,7 @@ - } - - #endif /* CONFIG_DEVFS_FS */ -+#endif /* HAVE_DEVFS_FS */ - - /* - * Allocate and initialize all data, register modem-devices -@@ -2331,7 +2500,6 @@ - init_timer(&dev->timer); - dev->timer.function = isdn_timer_funct; - init_MUTEX(&dev->sem); -- init_waitqueue_head(&dev->info_waitq); - for (i = 0; i < ISDN_MAX_CHANNELS; i++) { - dev->drvmap[i] = -1; - dev->chanmap[i] = -1; -@@ -2345,7 +2513,9 @@ - vfree(dev); - return -EIO; - } -+#ifdef HAVE_DEVFS_FS - isdn_init_devfs(); -+#endif /* HAVE_DEVFS_FS */ - if ((i = isdn_tty_modem_init()) < 0) { - printk(KERN_WARNING "isdn: Could not register tty devices\n"); - if (i == -3) -@@ -2353,7 +2523,9 @@ - if (i <= -2) - tty_unregister_driver(&dev->mdm.tty_modem); - vfree(dev); -+#ifdef HAVE_DEVFS_FS - isdn_cleanup_devfs(); -+#endif /* HAVE_DEVFS_FS */ - devfs_unregister_chrdev(ISDN_MAJOR, "isdn"); - return -EIO; - } -@@ -2364,7 +2536,9 @@ - tty_unregister_driver(&dev->mdm.cua_modem); - for (i = 0; i < ISDN_MAX_CHANNELS; i++) - kfree(dev->mdm.info[i].xmit_buf - 4); -+#ifdef HAVE_DEVFS_FS - isdn_cleanup_devfs(); -+#endif /* HAVE_DEVFS_FS */ - devfs_unregister_chrdev(ISDN_MAJOR, "isdn"); - vfree(dev); - return -EIO; -@@ -2390,6 +2564,9 @@ - printk("\n"); - #endif - isdn_info_update(); -+#ifdef CONFIG_ISDN_WITH_ABC -+ isdn_dw_abc_init_func(); -+#endif - return 0; - } - -@@ -2398,7 +2575,7 @@ - */ - static void __exit isdn_exit(void) - { -- unsigned long flags; -+ int flags; - int i; - - #ifdef CONFIG_ISDN_PPP -@@ -2432,13 +2609,18 @@ - printk(KERN_WARNING "isdn: controldevice busy, remove cancelled\n"); - restore_flags(flags); - } else { -+#ifdef HAVE_DEVFS_FS - isdn_cleanup_devfs(); -+#endif /* HAVE_DEVFS_FS */ - del_timer(&dev->timer); - restore_flags(flags); - /* call vfree with interrupts enabled, else it will hang */ - vfree(dev); - printk(KERN_NOTICE "ISDN-subsystem unloaded\n"); - } -+#ifdef CONFIG_ISDN_WITH_ABC -+ isdn_dw_abc_release_func(); -+#endif - } - - module_init(isdn_init); -diff -rNu linux-2.4.29.old/drivers/isdn/isdn_common.h linux-2.4.29/drivers/isdn/isdn_common.h ---- linux-2.4.29.old/drivers/isdn/isdn_common.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdn_common.h 2005-03-22 15:06:44.374346856 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn_common.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: isdn_common.h,v 1.22 2001/09/24 13:22:42 kai Exp $ - * - * header for Linux ISDN subsystem - * common used functions and debugging-switches (linklevel). -@@ -24,6 +24,9 @@ - #undef ISDN_DEBUG_NET_DIAL - #undef ISDN_DEBUG_NET_ICALL - -+#ifdef CONFIG_ISDN_WITH_ABC -+int isdn_net_force_dial_lp(isdn_net_local *); -+#endif - /* Prototypes */ - extern void isdn_MOD_INC_USE_COUNT(void); - extern void isdn_MOD_DEC_USE_COUNT(void); -diff -rNu linux-2.4.29.old/drivers/isdn/isdn_concap.c linux-2.4.29/drivers/isdn/isdn_concap.c ---- linux-2.4.29.old/drivers/isdn/isdn_concap.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdn_concap.c 2005-03-22 15:06:44.389344576 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn_concap.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: isdn_concap.c,v 1.9 2001/09/24 13:22:42 kai Exp $ - * - * Linux ISDN subsystem, protocol encapsulation - * -diff -rNu linux-2.4.29.old/drivers/isdn/isdn_concap.h linux-2.4.29/drivers/isdn/isdn_concap.h ---- linux-2.4.29.old/drivers/isdn/isdn_concap.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdn_concap.h 2005-03-22 15:06:44.405342144 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn_concap.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: isdn_concap.h,v 1.4 2001/09/24 13:22:42 kai Exp $ - * - * Linux ISDN subsystem, protocol encapsulation - * -diff -rNu linux-2.4.29.old/drivers/isdn/isdn_dwabc.c linux-2.4.29/drivers/isdn/isdn_dwabc.c ---- linux-2.4.29.old/drivers/isdn/isdn_dwabc.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdn_dwabc.c 2005-03-22 15:06:44.421339712 +0100 -@@ -0,0 +1,1053 @@ -+ -+/* $Id: isdn_dwabc.c,v 1.27 2001/12/01 23:18:21 detabc Exp $ -+ -+ * Linux ISDN subsystem, abc-extension releated funktions. -+ * -+ * Copyright by abc GmbH -+ * written by Detlef Wengorz -+ * -+ * 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. -+ * -+ */ -+ -+#include -+#define __NO_VERSION__ -+ -+#ifdef CONFIG_ISDN_WITH_ABC -+ -+static char *dwabcrevison = "$Revision: 1.27 $"; -+ -+#include -+#define CONFIG_ISDN_WITH_ABC_NEED_DWSJIFFIES 1 -+#include -+#include -+#include "isdn_common.h" -+#include "isdn_net.h" -+ -+#include -+ -+#include -+#include -+#include -+ -+ -+#if CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS && CONFIG_ISDN_PPP -+#include -+extern struct isdn_ppp_compressor *isdn_ippp_comp_head; -+#define ipc_head isdn_ippp_comp_head -+#ifndef CI_BSD_COMPRESS -+#define CI_BSD_COMPRESS 21 -+#endif -+#endif -+ -+#define NBYTEORDER_30BYTES 0x1e00 -+#define DWABC_TMRES (HZ / 10) -+ -+#define VERBLEVEL (dev->net_verbose > 2) -+ -+static struct timer_list dw_abc_timer; -+ -+ -+#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT -+static ISDN_DWSPINLOCK lcr_spin = ISDN_DWSPIN_UNLOCKED; -+#define LCR_LOCK() isdn_dwspin_trylock(&lcr_spin) -+#define LCR_ULOCK() isdn_dwspin_unlock(&lcr_spin) -+ -+typedef struct ISDN_DW_ABC_LCR { -+ -+ struct list_head dll; -+ char lcr_printbuf[64 + ISDN_MSNLEN + ISDN_MSNLEN]; -+ char *lcr_poin; -+ char *lcr_epoin; -+ -+} ISDN_DW_ABC_LCR; -+ -+static LIST_HEAD(lcr_dll); -+static atomic_t lcr_open_count = ATOMIC_INIT(0); -+static volatile ulong lcr_call_counter = 0; -+ -+ -+static int myjiftime(char *p,u_long nj) -+{ -+ sprintf(p,"%02ld:%02ld.%02ld", -+ ((nj / 100) / 60) % 100, (nj / 100) % 60,nj % 100); -+ -+ return(8); -+} -+ -+ -+static void dw_lcr_clear_all(void) -+{ -+ struct list_head *lh; -+ -+ if(!LCR_LOCK()) { -+ -+ while((lh = lcr_dll.next) != &lcr_dll) { -+ -+ ISDN_DW_ABC_LCR *p = list_entry(lh,ISDN_DW_ABC_LCR,dll); -+ list_del(&p->dll); -+ kfree(p); -+ } -+ -+ LCR_ULOCK(); -+ } -+} -+ -+void isdn_dw_abc_lcr_open(void) -+{ atomic_inc(&lcr_open_count); } -+ -+void isdn_dw_abc_lcr_close(void) -+{ -+ if(atomic_dec_and_test(&lcr_open_count)) -+ dw_lcr_clear_all(); -+} -+ -+int isdn_dw_abc_lcr_lock(void) -+{ return(LCR_LOCK()); } -+ -+void isdn_dw_abc_lcr_ulock(void) -+{ LCR_ULOCK(); } -+ -+ -+size_t isdn_dw_abc_lcr_readstat(char *buf,size_t count) -+{ -+ size_t retw = 0; -+ -+ while(buf != NULL && count > 0) { -+ -+ struct list_head *lh = NULL; -+ ISDN_DW_ABC_LCR *p = NULL; -+ char *dp = NULL; -+ size_t n; -+ -+ if((n = LCR_LOCK())) { -+ -+ if(!retw) -+ retw = n; -+ -+ break; -+ } -+ -+ -+ while((lh = lcr_dll.next) != &lcr_dll) { -+ -+ p = list_entry(lh,ISDN_DW_ABC_LCR,dll); -+ -+ if(p->lcr_poin >= p->lcr_epoin) { -+ -+ list_del(&p->dll); -+ kfree(p); -+ p = NULL; -+ -+ } else break; -+ } -+ -+ if(p == NULL) { -+ -+ LCR_ULOCK(); -+ break; -+ } -+ -+ n = p->lcr_epoin - p->lcr_poin; -+ -+ if(n > count) -+ n = count; -+ -+ dp = p->lcr_poin; -+ p->lcr_poin += n; -+ retw += n; -+ LCR_ULOCK(); -+ copy_to_user(buf,dp,n); -+ buf += n; -+ } -+ -+ return(retw); -+} -+ -+ -+static void isdn_dw_abc_lcr_clear_helper(isdn_net_local *lp) -+{ -+ if(lp != NULL) { -+ -+ void *a,*b; -+ -+ a = lp->dw_abc_lcr_cmd; -+ b = lp->dw_abc_lcr_io; -+ lp->dw_abc_lcr_io = NULL; -+ lp->dw_abc_lcr_cmd = NULL; -+ lp->dw_abc_lcr_callid = -+ lp->dw_abc_lcr_start_request = -+ lp->dw_abc_lcr_end_request = 0; -+ -+ if(a) kfree(a); -+ if(b) kfree(b); -+ } -+} -+ -+void isdn_dw_abc_lcr_clear(isdn_net_local *lp) -+{ -+ if(!LCR_LOCK()) { -+ isdn_dw_abc_lcr_clear_helper(lp); -+ LCR_ULOCK(); -+ } -+} -+ -+ -+u_long isdn_dw_abc_lcr_call_number( isdn_net_local *lp,isdn_ctrl *call_cmd) -+{ -+ u_long mid = 0; -+ -+ if(LCR_LOCK()) -+ return(0); -+ -+ isdn_dw_abc_lcr_clear_helper(lp); -+ -+ if( atomic_read(&lcr_open_count) > 0 && -+ lp != NULL && -+ call_cmd != NULL) { -+ -+ ISDN_DW_ABC_LCR *lc = NULL; -+ int ab = 0; -+ -+ if((lp->dw_abc_lcr_cmd = -+ ( isdn_ctrl *)kmalloc(sizeof(isdn_ctrl),GFP_ATOMIC)) == NULL) { -+ -+no_mem_out:; -+ isdn_dw_abc_lcr_clear_helper(lp); -+ LCR_ULOCK(); -+ printk(KERN_DEBUG "%s %d : LCR no memory\n",__FILE__,__LINE__); -+ return(0); -+ } -+ -+ memcpy(lp->dw_abc_lcr_cmd,call_cmd,sizeof(*call_cmd)); -+ while(!(lp->dw_abc_lcr_callid = mid = lcr_call_counter++)); -+ -+ lp->dw_abc_lcr_end_request = lp->dw_abc_lcr_start_request = jiffies; -+ lp->dw_abc_lcr_end_request += HZ * 3; -+ -+ if((lc = (ISDN_DW_ABC_LCR *)kmalloc(sizeof(*lc),GFP_KERNEL)) == NULL) -+ goto no_mem_out; -+ -+ lc->lcr_poin = lc->lcr_epoin = lc->lcr_printbuf; -+ lc->lcr_epoin += myjiftime(lc->lcr_epoin,jiffies); -+ -+ sprintf(lc->lcr_epoin," DW_ABC_LCR\t%lu\t%.*s\t%.*s\n", -+ mid, -+ (int)ISDN_MSNLEN, -+ call_cmd->parm.setup.eazmsn, -+ (int)ISDN_MSNLEN, -+ call_cmd->parm.setup.phone); -+ -+ lc->lcr_epoin += strlen(lc->lcr_epoin); -+ ab = lc->lcr_epoin - lc->lcr_poin; -+ -+ list_add_tail(&lc->dll,&lcr_dll); -+ LCR_ULOCK(); -+ -+ if(ab > 0) { -+ -+ if(dev->drv[0] != NULL ) { -+ -+ dev->drv[0]->stavail += ab; -+ wake_up_interruptible(&dev->drv[0]->st_waitq); -+ } -+ } -+ -+ } else LCR_ULOCK(); -+ -+ return(mid); -+} -+ -+ -+int isdn_dw_abc_lcr_ioctl(u_long arg) -+{ -+ struct ISDN_DWABC_LCR_IOCTL i; -+ int need = sizeof(struct ISDN_DWABC_LCR_IOCTL); -+ isdn_net_dev *p; -+ -+ memset(&i,0,sizeof(struct ISDN_DWABC_LCR_IOCTL)); -+ copy_from_user(&i,(char *)arg,sizeof(int)); -+ -+ if(i.lcr_ioctl_sizeof < need) -+ need = i.lcr_ioctl_sizeof; -+ -+ if(need > 0) -+ copy_from_user(&i,(char *)arg,need); -+ -+ if(LCR_LOCK()) -+ return(-EAGAIN); -+ -+ p = dev->netdev; -+ -+ for(;p ; p = p->next) { -+ -+ isdn_net_local *lp = p->local; -+ -+ if( lp->dw_abc_lcr_callid != i.lcr_ioctl_callid) -+ continue; -+ -+ if(lp->dw_abc_lcr_cmd == NULL) -+ continue; -+ -+ if(lp->dw_abc_lcr_io == NULL) -+ lp->dw_abc_lcr_io = (struct ISDN_DWABC_LCR_IOCTL *) -+ kmalloc(sizeof(struct ISDN_DWABC_LCR_IOCTL),GFP_ATOMIC); -+ -+ if(lp->dw_abc_lcr_io == NULL) { -+ -+ printk(KERN_DEBUG "%s %d : no memory\n",__FILE__,__LINE__); -+ continue; -+ } -+ -+ memcpy(lp->dw_abc_lcr_io,&i,sizeof(struct ISDN_DWABC_LCR_IOCTL)); -+ -+ if(i.lcr_ioctl_flags & DWABC_LCR_FLG_NEWNUMBER) { -+ -+ char *xx = i.lcr_ioctl_nr; -+ char *exx = xx + sizeof(i.lcr_ioctl_nr); -+ char *d = lp->dw_abc_lcr_cmd->parm.setup.phone; -+ char *ed = d + sizeof(lp->dw_abc_lcr_cmd->parm.setup.phone) - 1; -+ -+ while(d < ed && xx < exx && *xx) *(d++) = *(xx++); -+ while(d < ed) *(d++) = 0; -+ *d = 0; -+ } -+ } -+ -+ LCR_ULOCK(); -+ return(0); -+} -+ -+#endif -+ -+ -+#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK -+int dw_abc_udp_test(struct sk_buff *skb,struct net_device *ndev) -+{ -+ if(ndev != NULL && skb != NULL && skb->protocol == htons(ETH_P_IP)) { -+ -+ struct iphdr *iph = (struct iphdr *)skb->data; -+ isdn_net_local *lp = (isdn_net_local *) ndev->priv; -+ int rklen = skb->len; -+ -+ if (skb->nh.raw > skb->data && skb->nh.raw < skb->tail) { -+ -+ rklen -= (char *)skb->nh.raw - (char *)skb->data; -+ iph = (struct iphdr *)skb->nh.raw; -+ } -+ -+ if(rklen >= 20 && iph->version == 4 && -+ !(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_UDP_CHECK)) { -+ -+ if( iph->tot_len == NBYTEORDER_30BYTES && -+ iph->protocol == IPPROTO_UDP) { -+ -+ struct udphdr *udp = -+ (struct udphdr *)((char *)iph + (iph->ihl << 2)); -+ -+ ushort usrc = ntohs(udp->source); -+ -+ if( udp->dest == htons(25001) && -+ usrc >= 20000 && usrc < 25000) { -+ -+ char *p = (char *)(udp + 1); -+ -+ if(p[0] == p[1]) { -+ -+ char mc = 0; -+ -+ switch(*p) { -+ case 0x30: -+ -+ mc = *p; -+ -+ if((lp->flags & ISDN_NET_CONNECTED) && (!lp->dialstate)) -+ mc++; -+ -+ break; -+ -+ case 0x32: -+ -+ mc = *p; -+#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL -+ if((lp->flags & ISDN_NET_CONNECTED) && (!lp->dialstate)) { -+ -+ mc++; -+ break; -+ } -+ -+ if(!isdn_net_force_dial_lp(lp)) mc++; -+#endif -+ break; -+ -+ case 0x11: -+ mc = *p + 1; -+ isdn_dw_abc_reset_interface(lp,1); -+ break; -+ -+ case 0x28: mc = *p + 1; break; -+ case 0x2a: -+ case 0x2c: -+ -+ mc = *p; -+#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP -+ if(!(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_UDP_HANGUP)) { -+ -+ if(lp->isdn_device >= 0) { -+ -+ isdn_net_hangup(ndev); -+ mc = *p + 1; -+ } -+ } -+#endif -+ break; -+ } -+ -+ if(mc) { -+ -+ struct sk_buff *nskb; -+ int need = 2+sizeof(struct iphdr)+sizeof(struct udphdr); -+ int hneed = need + ndev->hard_header_len; -+ -+ if((nskb = (struct sk_buff *)dev_alloc_skb(hneed)) != NULL) { -+ -+ ushort n = sizeof(struct udphdr) + 2; -+ struct iphdr *niph; -+ struct udphdr *nup; -+ skb_reserve(nskb,ndev->hard_header_len); -+ -+ if((niph = (struct iphdr *)skb_put(nskb,need))==NULL){ -+ -+ printk(KERN_DEBUG "%s: skb_put failt (%d bytes)\n", lp->name,hneed); -+ dev_kfree_skb(nskb); -+ return(0); -+ } -+ -+ nup = (struct udphdr *)(niph + 1); -+ ((char *)(nup + 1))[0] = mc; -+ ((char *)(nup + 1))[1] = mc; -+ nup->source=udp->dest; -+ nup->dest=udp->source; -+ nup->len=htons(n); -+ nup->check=0; /* dont need checksum */ -+ memset((void *)niph,0,sizeof(*niph)); -+ niph->version=4; -+ niph->ihl=5; -+ niph->tot_len=NBYTEORDER_30BYTES; -+ niph->ttl = 32; -+ niph->protocol = IPPROTO_UDP; -+ niph->saddr=iph->daddr; -+ niph->daddr=iph->saddr; -+ niph->id=iph->id; -+ niph->check=ip_fast_csum((unsigned char *)niph,niph->ihl); -+ nskb->dev = ndev; -+ nskb->pkt_type = PACKET_HOST; -+ nskb->protocol = htons(ETH_P_IP); -+ nskb->mac.raw = nskb->data; -+ netif_rx(nskb); -+ } -+ -+ return(1); -+ } -+ } -+ } -+ } -+ } -+ } -+ -+ return(0); -+} -+#endif -+ -+ -+void isdn_dw_clear_if(ulong pm,isdn_net_local *lp) -+{ -+ if(lp != NULL) { -+#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT -+ isdn_dw_abc_lcr_clear(lp); -+#endif -+ } -+} -+ -+ -+ -+static void dw_abc_timer_func(u_long dont_need_yet) -+{ -+ register u_long t; -+ -+ if(!((t = ++isdn_dwabc_jiffies.msec_100) & 1)) -+ if(isdn_dwabc_jiffies.msec_200++ & 1) -+ isdn_dwabc_jiffies.msec_400++; -+ -+ if(!(t % 5)) -+ if(isdn_dwabc_jiffies.msec_500++ & 1) -+ isdn_dwabc_jiffies.msec_1000++; -+ -+ dw_abc_timer.expires = jiffies + DWABC_TMRES; -+ add_timer(&dw_abc_timer); -+} -+ -+ -+void isdn_dw_abc_init_func(void) -+{ -+ -+ init_timer(&dw_abc_timer); -+ dw_abc_timer.function = dw_abc_timer_func; -+ -+ -+ printk( KERN_INFO -+ "abc-extension %s Kernel 0x%06X\n" -+ "written by\nDetlef Wengorz \n" -+ "Installed options:\n" -+#ifdef CONFIG_ISDN_WITH_ABC_CALLB -+ "CONFIG_ISDN_WITH_ABC_CALLB\n" -+#endif -+#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK -+ "CONFIG_ISDN_WITH_ABC_UDP_CHECK\n" -+#endif -+#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP -+ "CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP\n" -+#endif -+#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL -+ "CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL\n" -+#endif -+#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ -+ "CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ\n" -+#endif -+#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT -+ "CONFIG_ISDN_WITH_ABC_LCR_SUPPORT\n" -+#endif -+#ifdef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER -+ "CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER\n" -+#endif -+#ifdef CONFIG_ISDN_WITH_ABC_CH_EXTINUSE -+ "CONFIG_ISDN_WITH_ABC_CH_EXTINUSE\n" -+#endif -+#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR -+ "CONFIG_ISDN_WITH_ABC_CONN_ERROR\n" -+#endif -+#ifdef CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS -+ "CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS\n" -+#endif -+ "loaded\n", -+ dwabcrevison,LINUX_VERSION_CODE); -+ dwsjiffies = 0; -+ dw_abc_timer.expires = jiffies + DWABC_TMRES; -+ add_timer(&dw_abc_timer); -+} -+ -+void isdn_dw_abc_release_func(void) -+{ -+ del_timer(&dw_abc_timer); -+#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT -+ dw_lcr_clear_all(); -+#endif -+ printk( KERN_INFO -+ "abc-extension %s Kernel 0x%06X\n" -+ "written by\n" -+ "Detlef Wengorz \n" -+ "unloaded\n", -+ dwabcrevison,LINUX_VERSION_CODE); -+} -+ -+ -+void isdn_dwabc_test_phone(isdn_net_local *lp) -+{ -+ if(lp != NULL) { -+ -+ isdn_net_phone *h = lp->phone[0]; -+ ulong oflags = lp->dw_abc_flags; -+ int secure = 0; -+ -+ lp->dw_abc_flags = 0; -+#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ -+ *lp->dw_out_msn = 0; -+#endif -+ -+ for(;h != NULL && secure < 1000;secure++,h = h->next) { -+ -+ char *p = h->num; -+ char *ep = p + ISDN_MSNLEN; -+ -+ for(;p < ep && *p && (*p <= ' ' || *p == '"' || *p == '\'');p++); -+ -+ if(p >= ep) -+ continue; -+ -+#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ -+ if(*p == '>') { -+ -+ if(++p < ep && *p != '<' && *p != '>') { -+ -+ char *d = lp->dw_out_msn; -+ -+ for(;*p && (p < ep) && (*p == ' ' || *p == '\t');p++); -+ for(ep--;*p && (p < ep);) *(d++) = *(p++); -+ *d = 0; -+ continue; -+ } -+ } -+#endif -+ -+ if(*p == '~') { -+ -+ /* abc switch's */ -+ -+ for(p++;p < ep && *p;p++) switch(*p) { -+ case 'u': lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_NO_UDP_CHECK; break; -+ case 'h': lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_NO_UDP_HANGUP; break; -+ case 'd': lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_NO_UDP_DIAL; break; -+ case 'c': lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_NO_CH_EXTINUSE; break; -+ case 'e': lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_NO_CONN_ERROR; break; -+ case 'l': lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_NO_LCR; break; -+ -+ case 'x': -+ case 'X': lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_RCV_NO_HUPTIMER; break; -+ -+ case 'B': lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_BSD_COMPRESS; break; -+ case 'L': lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_LEASED_LINE; break; -+ -+ case '"': -+ case ' ': -+ case '\t': -+ case '\'': break; -+ -+ default: -+ printk(KERN_DEBUG"isdn_net: %s abc-switch <~%c> unknown\n",lp->name,*p); -+ break; -+ } -+ } -+ } -+ -+ if(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_LEASED_LINE) { -+ -+ lp->dw_abc_flags |= -+ ISDN_DW_ABC_FLAG_NO_UDP_CHECK | -+ ISDN_DW_ABC_FLAG_NO_UDP_HANGUP | -+ ISDN_DW_ABC_FLAG_NO_UDP_DIAL | -+ ISDN_DW_ABC_FLAG_NO_CH_EXTINUSE | -+ ISDN_DW_ABC_FLAG_NO_CONN_ERROR | -+ ISDN_DW_ABC_FLAG_NO_LCR; -+ } -+ -+ if(dev->net_verbose && (lp->dw_abc_flags != oflags || dev->net_verbose > 4)) -+ printk(KERN_DEBUG "isdn_net %s abc-flags 0x%lx\n",lp->name,lp->dw_abc_flags); -+ -+ } -+} -+ -+ -+int isdn_dw_abc_reset_interface(isdn_net_local *lp,int with_message) -+{ -+ int r = -EINVAL; -+ -+ if(lp != NULL) { -+ -+ r = 0; -+ -+ lp->dw_abc_bchan_last_connect = 0; -+ lp->dw_abc_dialstart = 0; -+ lp->dw_abc_inuse_secure = 0; -+#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR -+ lp->dw_abc_bchan_errcnt = 0; -+#endif -+ -+ if(with_message && dev->net_verbose > 0) -+ printk(KERN_INFO -+ "%s: NOTE: reset (clear) abc-interface-secure-counter\n", -+ lp->name); -+ } -+ -+ return(r); -+} -+ -+ -+#if CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS && CONFIG_ISDN_PPP -+ -+#define DWBSD_PKT_FIRST_LEN 16 -+#define DWBSD_PKT_SWITCH 165 -+#define DWBSD_PKT_BSD 189 -+ -+#define DWBSD_VERSION 0x2 -+ -+void dwabc_bsd_first_gen(isdn_net_local *lp) -+{ -+ if(lp != NULL && lp->p_encap == ISDN_NET_ENCAP_RAWIP && -+ (lp->dw_abc_flags & ISDN_DW_ABC_FLAG_BSD_COMPRESS)) { -+ -+ struct sk_buff *skb = NULL; -+ char *p = NULL; -+ char *ep = NULL; -+ -+ if((skb =(struct sk_buff *)dev_alloc_skb(128)) == NULL) { -+ -+ printk(KERN_INFO "%s: dwabc: alloc-skb failed for 128 bytes\n",lp->name); -+ return; -+ } -+ -+ skb_reserve(skb,64); -+ p = skb_put(skb,DWBSD_PKT_FIRST_LEN); -+ ep = p + DWBSD_PKT_FIRST_LEN; -+ -+ *(p++) = DWBSD_PKT_SWITCH; -+ *(p++) = DWBSD_VERSION; -+ for(;p < ep;p++) *(p++) = 0; -+ -+ isdn_net_write_super(lp, skb); -+ -+ if(dev->net_verbose > 2) -+ printk(KERN_INFO "%s: dwabc: sending comm-header version 0x%x\n",lp->name,DWBSD_VERSION); -+ } -+} -+ -+ -+void dwabc_bsd_free(isdn_net_local *lp) -+{ -+ if(lp != NULL) { -+ -+ if(lp->dw_abc_bsd_stat_rx || lp->dw_abc_bsd_stat_tx) { -+ -+ struct isdn_ppp_compressor *c = NULL; -+ -+ if(!(c = (struct isdn_ppp_compressor *)lp->dw_abc_bsd_compressor)) { -+ -+ printk(KERN_WARNING -+ "%s: PANIC: freeing bsd compressmemory without compressor\n", -+ lp->name); -+ -+ } else { -+ -+ if(lp->dw_abc_bsd_stat_rx) (*c->free)(lp->dw_abc_bsd_stat_rx); -+ if(lp->dw_abc_bsd_stat_tx) (*c->free)(lp->dw_abc_bsd_stat_tx); -+ -+ if(dev->net_verbose > 2) -+ printk(KERN_INFO -+ "%s: free bsd compress-memory\n", -+ lp->name); -+ } -+ } -+ -+ lp->dw_abc_bsd_compressor = NULL; -+ lp->dw_abc_bsd_stat_rx = NULL; -+ lp->dw_abc_bsd_stat_tx = NULL; -+ lp->dw_abc_if_flags &= ~ISDN_DW_ABC_IFFLAG_BSDAKTIV; -+ -+ if(dev->net_verbose > 0) { -+ -+ if(lp->dw_abc_bsd_rcv != lp->dw_abc_bsd_bsd_rcv) { -+ -+ printk(KERN_INFO "%s: Receive %lu<-%lu kb\n",lp->name, -+ lp->dw_abc_bsd_rcv >> 10 , lp->dw_abc_bsd_bsd_rcv >> 10); -+ } -+ -+ -+ if(lp->dw_abc_bsd_snd != lp->dw_abc_bsd_bsd_snd) { -+ -+ printk(KERN_INFO "%s: Send %lu->%lu kb\n",lp->name, -+ lp->dw_abc_bsd_snd >> 10 , lp->dw_abc_bsd_bsd_snd >> 10); -+ } -+ } -+ -+ lp->dw_abc_bsd_rcv = -+ lp->dw_abc_bsd_bsd_rcv = -+ lp->dw_abc_bsd_snd = -+ lp->dw_abc_bsd_bsd_snd = 0; -+ } -+} -+ -+ -+int dwabc_bsd_init(isdn_net_local *lp) -+{ -+ int r = 1; -+ -+ if(lp != NULL) { -+ -+ dwabc_bsd_free(lp); -+ -+ if(lp->p_encap == ISDN_NET_ENCAP_RAWIP) { -+ -+ void *rx = NULL; -+ void *tx = NULL; -+ struct isdn_ppp_comp_data *cp = NULL; -+ struct isdn_ppp_compressor *c = NULL; -+ -+ if(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_BSD_COMPRESS) do { -+ -+ for(c = ipc_head ; -+ c != NULL && c->num != CI_BSD_COMPRESS; c = c->next); -+ -+ if(c == NULL) { -+ -+ printk(KERN_INFO -+ "%s: Module isdn_bsdcompress not loaded\n", -+ lp->name); -+ -+ break; -+ } -+ -+ cp = (struct isdn_ppp_comp_data *) -+ kmalloc(sizeof(struct isdn_ppp_comp_data),GFP_ATOMIC); -+ -+ if(cp == NULL) { -+ -+ printk(KERN_INFO -+ "%s: allocation of isdn_ppp_comp_data failed\n", -+ lp->name); -+ -+ break; -+ } -+ -+ memset(cp,0,sizeof(*cp)); -+ cp->num = CI_BSD_COMPRESS; -+ cp->optlen = 1; -+ -+ /* -+ ** set BSD_VERSION 1 and 12 bits compressmode -+ */ -+ *cp->options = (1 << 5) | 12; -+ -+ if((rx = (*c->alloc)(cp)) == NULL) { -+ -+ printk(KERN_INFO -+ "%s: allocation of bsd rx-memory failed\n", -+ lp->name); -+ -+ break; -+ } -+ -+ if(!(*c->init)(rx,cp,0,1)) { -+ -+ printk(KERN_INFO -+ "%s: init of bsd rx-stream failed\n",lp->name); -+ -+ break; -+ } -+ -+ cp->flags = IPPP_COMP_FLAG_XMIT; -+ -+ if((tx = (*c->alloc)(cp)) == NULL) { -+ -+ printk(KERN_INFO -+ "%s: allocation of bsd tx-memory failed\n", -+ lp->name); -+ -+ break; -+ } -+ -+ if(!(*c->init)(tx,cp,0,1)) { -+ -+ printk(KERN_INFO -+ "%s: init of bsd tx-stream failed\n", -+ lp->name); -+ -+ break; -+ } -+ -+ lp->dw_abc_bsd_compressor = (void *)c; -+ lp->dw_abc_bsd_stat_rx = rx; -+ lp->dw_abc_bsd_stat_tx = tx; -+ rx = tx = NULL; -+ r = 0; -+ -+ if(dev->net_verbose > 2) -+ printk(KERN_INFO -+ "%s: bsd compress-memory and init ok\n", -+ lp->name); -+ -+ } while(0); -+ -+ if(cp != NULL) -+ kfree(cp); -+ -+ if(c != NULL) { -+ -+ if(tx != NULL) (*c->free)(tx); -+ if(rx != NULL) (*c->free)(rx); -+ } -+ -+ } else if(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_BSD_COMPRESS) { -+ -+ printk(KERN_INFO -+ "%s: bsd-compress only with encapsulation rawip allowed\n", -+ lp->name); -+ } -+ } -+ -+ return(r); -+} -+ -+struct sk_buff *dwabc_bsd_compress( isdn_net_local *lp, -+ struct sk_buff *skb, -+ struct net_device *ndev) -+{ -+ if(lp != NULL && lp->p_encap == ISDN_NET_ENCAP_RAWIP && -+ (lp->dw_abc_flags & ISDN_DW_ABC_FLAG_BSD_COMPRESS) && -+ (lp->dw_abc_if_flags & ISDN_DW_ABC_IFFLAG_BSDAKTIV)) { -+ -+ if(lp->dw_abc_bsd_stat_tx != NULL && lp->dw_abc_bsd_compressor) { -+ -+ struct isdn_ppp_compressor *cp = -+ (struct isdn_ppp_compressor *)lp->dw_abc_bsd_compressor; -+ -+ struct sk_buff *nskb = (struct sk_buff *) -+ dev_alloc_skb(skb->len * 2 + ndev->hard_header_len); -+ -+ int l = 0; -+ -+ if(nskb == NULL) { -+ -+ (void)(*cp->reset)(lp->dw_abc_bsd_stat_tx,0,0,NULL,0,NULL); -+ printk(KERN_INFO "%s: dwabc-compress no memory\n",lp->name); -+ -+ } else { -+ -+ skb_reserve(nskb,ndev->hard_header_len); -+ *(unsigned char *)skb_put(nskb,1) = DWBSD_PKT_BSD; -+ l = (*cp->compress)(lp->dw_abc_bsd_stat_tx,skb,nskb,0x21); -+ -+ if(l < 1 || l > skb->len) { -+ -+ (void)(*cp->reset)(lp->dw_abc_bsd_stat_tx,0,0,NULL,0,NULL); -+ dev_kfree_skb(nskb); -+ -+ } else { -+ -+ u_short sqnr; -+ -+ dev_kfree_skb(skb); -+ skb = nskb; -+ sqnr = ((*(u_char *)skb->data) << 8) + -+ ((u_char)skb->data[1]); -+ -+ if(sqnr > 65500) -+ (void)(*cp->reset) -+ (lp->dw_abc_bsd_stat_tx,0,0,NULL,0,NULL); -+ } -+ } -+ } -+ } -+ -+ return(skb); -+} -+ -+struct sk_buff *dwabc_bsd_rx_pkt( isdn_net_local *lp, -+ struct sk_buff *skb, -+ struct net_device *ndev) -+{ -+ struct sk_buff *r = skb; -+ -+ if(lp != NULL && lp->p_encap == ISDN_NET_ENCAP_RAWIP && -+ (lp->dw_abc_flags & ISDN_DW_ABC_FLAG_BSD_COMPRESS)) { -+ -+ unsigned char *p = (unsigned char *)skb->data; -+ struct isdn_ppp_compressor *cp = -+ (struct isdn_ppp_compressor *)lp->dw_abc_bsd_compressor; -+ -+ if(*p == DWBSD_PKT_SWITCH) { -+ -+ if(skb->len == DWBSD_PKT_FIRST_LEN) { -+ -+ if((lp->dw_abc_remote_version = p[1]) < 0x2) { -+ -+ printk(KERN_INFO -+ "%s: I can't really talk with remote version 0x%x\n" -+ "Please upgrade remote or disable rawip-compression\n", -+ lp->name, -+ p[1]); -+ } -+ -+ lp->dw_abc_if_flags |= ISDN_DW_ABC_IFFLAG_BSDAKTIV; -+ dev_kfree_skb(skb); -+ -+ if(cp && lp->dw_abc_bsd_stat_tx) -+ (void)(*cp->reset)(lp->dw_abc_bsd_stat_tx,0,0,NULL,0,NULL); -+ -+ if(dev->net_verbose > 2) -+ printk(KERN_INFO -+ "%s: receive comm-header rem-version 0x%02x\n", -+ lp->name, -+ lp->dw_abc_remote_version); -+ -+ return(NULL); -+ } -+ -+ } else if(*p == DWBSD_PKT_BSD && lp->dw_abc_bsd_stat_rx != NULL && cp) { -+ -+ struct sk_buff *nskb = NULL; -+ -+ if(test_and_set_bit(ISDN_DW_ABC_BITLOCK_RECEIVE, -+ &lp->dw_abc_bitlocks)) { -+ -+ printk(KERN_INFO "%s: bsd-decomp called recursivly\n",lp->name); -+ dev_kfree_skb(skb); -+ dwabc_bsd_first_gen(lp); -+ return(NULL); -+ } -+ -+ nskb = (struct sk_buff *) -+ dev_alloc_skb(2048 + ndev->hard_header_len); -+ -+ if(nskb != NULL) { -+ -+ int l = 0; -+ u_short sqnr; -+ -+ skb_reserve(nskb,ndev->hard_header_len); -+ skb_pull(skb, 1); -+ sqnr = ((*(u_char *)skb->data) << 8) | ((u_char)skb->data[1]); -+ -+ if(!sqnr && cp && lp->dw_abc_bsd_stat_rx) -+ (void)(*cp->reset)(lp->dw_abc_bsd_stat_rx,0,0,NULL,0,NULL); -+ -+ if((l = (*cp->decompress) -+ (lp->dw_abc_bsd_stat_rx,skb,nskb,NULL)) < 1 || l>8000) { -+ -+ printk(KERN_INFO "%s: abc-decomp failed\n",lp->name); -+ dev_kfree_skb(nskb); -+ dev_kfree_skb(skb); -+ nskb = NULL; -+ dwabc_bsd_first_gen(lp); -+ -+ } else { -+ -+ if (nskb->data[0] & 0x1) -+ skb_pull(nskb, 1); /* protocol ID is only 8 bit */ -+ else -+ skb_pull(nskb, 2); -+ -+ nskb->dev = skb->dev; -+ nskb->pkt_type = skb->pkt_type; -+ nskb->mac.raw = nskb->data; -+ dev_kfree_skb(skb); -+ } -+ -+ } else { -+ -+ printk(KERN_INFO "%s: PANIC abc-decomp no memory\n",lp->name); -+ dev_kfree_skb(skb); -+ dwabc_bsd_first_gen(lp); -+ } -+ -+ clear_bit(ISDN_DW_ABC_BITLOCK_RECEIVE,&lp->dw_abc_bitlocks); -+ r = nskb; -+ } -+ } -+ -+ return(r); -+} -+ -+#else -+int dwabc_bsd_init(isdn_net_local *lp) { return(1); } -+void dwabc_bsd_free(isdn_net_local *lp) { return; } -+void dwabc_bsd_first_gen(isdn_net_local *lp) { return ; } -+ -+struct sk_buff *dwabc_bsd_compress(isdn_net_local *lp,struct sk_buff *skb,struct net_device *ndev) -+{ return(skb); } -+ -+struct sk_buff *dwabc_bsd_rx_pkt(isdn_net_local *lp,struct sk_buff *skb,struct net_device *ndev) -+{ return(skb); } -+#endif -+#endif -diff -rNu linux-2.4.29.old/drivers/isdn/isdn_net.c linux-2.4.29/drivers/isdn/isdn_net.c ---- linux-2.4.29.old/drivers/isdn/isdn_net.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdn_net.c 2005-03-22 15:06:44.447335760 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn_net.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: isdn_net.c,v 1.153 2002/08/17 18:35:23 detabc Exp $ - * - * Linux ISDN subsystem, network interfaces and related functions (linklevel). - * -@@ -9,14 +9,6 @@ - * This software may be used and distributed according to the terms - * of the GNU General Public License, incorporated herein by reference. - * -- * Data Over Voice (DOV) support added - Guy Ellis 23-Mar-02 -- * guy@traverse.com.au -- * Outgoing calls - looks for a 'V' in first char of dialed number -- * Incoming calls - checks first character of eaz as follows: -- * Numeric - accept DATA only - original functionality -- * 'V' - accept VOICE (DOV) only -- * 'B' - accept BOTH DATA and DOV types -- * - * Jan 2001: fix CISCO HDLC Bjoern A. Zeeb - * for info on the protocol, see - * http://i4l.zabbadoz.net/i4l/cisco-hdlc.txt -@@ -38,6 +30,10 @@ - #include "isdn_concap.h" - #endif - -+#ifdef CONFIG_ISDN_WITH_ABC -+#include -+#define isdn_net_log_skb(skb,lp) isdn_net_log_skb_dwabc(skb,lp,NULL) -+#endif - - /* - * Outline of new tbusy handling: -@@ -79,7 +75,11 @@ - dev = lp->master; - else - dev = &n->dev; -+#ifdef COMPAT_NO_SOFTNET -+ return dev->start; -+#else - return netif_running(dev); -+#endif - } - - /* -@@ -143,6 +143,10 @@ - atomic_inc(&lp->frame_cnt); - if (isdn_net_device_busy(lp)) - isdn_net_device_stop_queue(lp); -+#if 0 -+ printk(KERN_DEBUG "%s: inc_frame_cnt now %d\n", lp->name, -+ atomic_read(&lp->frame_cnt)); -+#endif - } - - static __inline__ void isdn_net_dec_frame_cnt(isdn_net_local *lp) -@@ -157,11 +161,19 @@ - isdn_net_device_wake_queue(lp); - } - } -+#if 0 -+ printk(KERN_DEBUG "%s: dec_frame_cnt now %d\n", lp->name, -+ atomic_read(&lp->frame_cnt)); -+#endif - } - - static __inline__ void isdn_net_zero_frame_cnt(isdn_net_local *lp) - { - atomic_set(&lp->frame_cnt, 0); -+#if 0 -+ printk(KERN_DEBUG "%s: zero_frame_cnt now %d\n", lp->name, -+ atomic_read(&lp->frame_cnt)); -+#endif - } - - /* For 2.2.x we leave the transmitter busy timeout at 2 secs, just -@@ -173,23 +185,101 @@ - * which might rely on the tx timeout. If so, we'll find out this way... - */ - -+#ifdef COMPAT_NO_SOFTNET -+#define ISDN_NET_TX_TIMEOUT (2*HZ) -+#else - #define ISDN_NET_TX_TIMEOUT (20*HZ) -+#endif - - /* Prototypes */ - -+#ifndef CONFIG_ISDN_WITH_ABC - int isdn_net_force_dial_lp(isdn_net_local *); -+#endif - static int isdn_net_start_xmit(struct sk_buff *, struct net_device *); - - static void isdn_net_ciscohdlck_connected(isdn_net_local *lp); - static void isdn_net_ciscohdlck_disconnected(isdn_net_local *lp); - --char *isdn_net_revision = "$Revision: 1.1.4.1 $"; -+char *isdn_net_revision = "$Revision: 1.153 $"; - - /* - * Code for raw-networking over ISDN - */ -+#ifdef CONFIG_ISDN_WITH_ABC -+#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR -+static int isdn_dwabc_encap_with_conerr(isdn_net_local *lp) -+{ -+ if(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_CONN_ERROR) -+ return(0); -+ -+ return( -+ lp->p_encap == ISDN_NET_ENCAP_SYNCPPP || -+ lp->p_encap == ISDN_NET_ENCAP_RAWIP || -+ lp->p_encap == ISDN_NET_ENCAP_CISCOHDLCK || -+ lp->p_encap == ISDN_NET_ENCAP_UIHDLC ); -+} -+ -+static int isdn_dwabc_conerr_ippktok(struct sk_buff *skb) -+{ -+ struct iphdr *iph = (struct iphdr *)skb->data; -+ return(iph->version == 6 || (skb->len >= 20 && iph->version == 4)); -+} -+ -+#endif -+ -+static int isdn_dwabc_is_interface_disabled(isdn_net_local *lp) -+{ -+ if(lp == NULL) -+ return(0); -+ -+ lp->dw_abc_inuse_secure = 0; -+ lp->dw_abc_dialstart = 0; -+ -+ /* -+ ** check for jiffies overflow -+ */ -+ if(lp->dw_abc_bchan_last_connect > jiffies) { -+ -+#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR -+ lp->dw_abc_bchan_errcnt = 0; -+#endif -+ lp->dw_abc_bchan_last_connect = 0; -+ } -+ -+#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR -+ if(!(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_CONN_ERROR) && isdn_dwabc_encap_with_conerr(lp)) { -+ -+ if(lp->dw_abc_bchan_errcnt > 3 && !(lp->dw_abc_bchan_errcnt & 3)) { - -+ ulong nj = jiffies; -+ ulong delay = lp->dw_abc_bchan_errcnt * -+ lp->dw_abc_bchan_errcnt * -+ lp->dw_abc_bchan_errcnt; -+ -+ if(delay > 86400) delay = 86400; -+ delay = (lp->dw_abc_bchan_last_connect + delay * HZ); -+ -+ if(delay > nj) { -+ -+ printk(KERN_INFO -+ "%s: interface auto-disabled (bchannel connect-error %lu seconds left)\n", -+ lp->name,(delay - nj) / HZ); -+ -+ return(1); -+ } -+ } -+ } -+#endif -+ return(0); -+} -+#endif -+ -+#ifdef CONFIG_ISDN_WITH_ABC -+void -+#else - static void -+#endif - isdn_net_unreachable(struct net_device *dev, struct sk_buff *skb, char *reason) - { - if(skb) { -@@ -297,6 +387,12 @@ - - save_flags(flags); - cli(); -+#ifdef CONFIG_ISDN_WITH_ABC -+ isdn_dw_clear_if(0l,lp); -+ lp->dw_abc_if_flags &= ~ISDN_DW_ABC_IFFLAG_NODCHAN; -+ lp->dw_abc_inuse_secure = 0; -+ dwabc_bsd_free(lp); -+#endif - skb_queue_purge(&lp->super_tx_queue); - - if (!lp->master) { /* reset only master device */ -@@ -351,6 +447,26 @@ - if ((l->flags & ISDN_NET_CONNECTED) && (!l->dialstate)) { - anymore = 1; - l->huptimer++; -+#ifdef CONFIG_ISDN_WITH_ABC -+#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR -+ if( isdn_dwabc_encap_with_conerr(l) && l->dw_abc_bchan_errcnt > 0) { -+ -+ int n = 180; -+ -+ if(l->dw_abc_bchan_errcnt > 3) n = 120; -+ if(l->dw_abc_bchan_errcnt > 6) n = 90; -+ if(l->dw_abc_bchan_errcnt > 9) n = 60; -+ -+ if(l->huptimer > n) { -+ -+ printk(KERN_INFO "%s: bchan conf-error auto-secure-hangup\n",l->name); -+ isdn_net_hangup(&p->dev); -+ p = (isdn_net_dev *) p->next; -+ continue; -+ } -+ } -+#endif -+#endif - /* - * if there is some dialmode where timeout-hangup - * should _not_ be done, check for that here -@@ -465,8 +581,32 @@ - printk(KERN_INFO "%s: Chargesum is %d\n", lp->name, - lp->charge); - isdn_net_unbind_channel(lp); -+#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR -+ if(lp->dw_abc_bchan_errcnt) { -+ -+ printk(KERN_INFO -+ "%s: Note: bchannel-error-counter is %hd\n", -+ lp->name, -+ lp->dw_abc_bchan_errcnt); -+ } -+#endif - return 1; - } -+#ifdef CONFIG_ISDN_WITH_ABC_CH_EXTINUSE -+ if(!(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_CH_EXTINUSE)) { -+ if((lp->dialstate == 4 || lp->dialstate == 12) && -+ lp->dw_abc_dialstart && (idx < ISDN_MAX_CHANNELS)) { -+ -+ if((jiffies - lp->dw_abc_dialstart) < (HZ >>2)) { -+ -+ lp->dw_abc_if_flags |= ISDN_DW_ABC_IFFLAG_NODCHAN; -+ lp->dialstate = 1; -+ dev->dwabc_chan_external_inuse[idx] = jiffies + HZ * 30; -+ printk(KERN_INFO "%s: Channel %d look like external in use\n",lp->name,idx); -+ } -+ } -+ } -+#endif - break; - #ifdef CONFIG_ISDN_X25 - case ISDN_STAT_BHUP: -@@ -507,6 +647,19 @@ - } - } - printk(KERN_INFO "isdn_net: %s connected\n", lp->name); -+#ifdef CONFIG_ISDN_WITH_ABC -+ if(!dwabc_bsd_init(lp)) dwabc_bsd_first_gen(lp); -+ lp->dw_abc_bchan_last_connect = jiffies; -+#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR -+ if(!(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_CONN_ERROR)) { -+ -+ lp->dw_abc_bchan_errcnt += isdn_dwabc_encap_with_conerr(lp); -+ -+ if(lp->dw_abc_bchan_errcnt > 32000) -+ lp->dw_abc_bchan_errcnt = 32000; -+ } -+#endif -+#endif - /* If first Chargeinfo comes before B-Channel connect, - * we correct the timestamp here. - */ -@@ -578,7 +731,6 @@ - int i; - unsigned long flags; - isdn_ctrl cmd; -- u_char *phone_number; - - while (p) { - isdn_net_local *lp = p->local; -@@ -597,6 +749,47 @@ - */ - save_flags(flags); - cli(); -+#ifdef CONFIG_ISDN_WITH_ABC_CH_EXTINUSE -+ if(!(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_CH_EXTINUSE) && -+ (lp->dw_abc_if_flags & ISDN_DW_ABC_IFFLAG_NODCHAN)) { -+ -+ int chi = 0; -+ short lsecure = 0; -+ -+ lsecure = lp->dw_abc_inuse_secure; -+ isdn_net_unbind_channel(lp); -+ lp->dw_abc_inuse_secure = lsecure + 1; -+ -+ /* Grab a free ISDN-Channel */ -+ if ((lsecure >= ISDN_MAX_CHANNELS ) || (chi = -+ isdn_get_free_channel( -+ ISDN_USAGE_NET, -+ lp->l2_proto, -+ lp->l3_proto, -+ lp->pre_device, -+ lp->pre_channel, -+#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ -+ (*lp->dw_out_msn) ? lp->dw_out_msn : lp->msn) -+#else -+ lp->msn) -+#endif -+ ) < 0) { -+ -+ restore_flags(flags); -+ isdn_net_unreachable(&p->dev, NULL, -+ "DWABC: redial-external-inuse NO FREE CHANNEL\n"); -+ isdn_net_hangup(&p->dev); -+ break; -+ } -+ -+ isdn_net_bind_channel(lp, chi); -+ lp->dialstate = 1; -+ lp->dialstarted = 0; -+ lp->dialwait_timer = 0; -+ } -+ -+ lp->dw_abc_if_flags &= ~ISDN_DW_ABC_IFFLAG_NODCHAN; -+#endif - lp->dial = lp->phone[1]; - restore_flags(flags); - if (!lp->dial) { -@@ -621,18 +814,69 @@ - cmd.arg = lp->isdn_channel; - cmd.command = ISDN_CMD_CLREAZ; - isdn_command(&cmd); -+#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ -+ sprintf(cmd.parm.num, "%s", -+ isdn_map_eaz2msn((*lp->dw_out_msn) ? lp->dw_out_msn : lp->msn, cmd.driver)); -+#else - sprintf(cmd.parm.num, "%s", isdn_map_eaz2msn(lp->msn, cmd.driver)); -+#endif - cmd.command = ISDN_CMD_SETEAZ; - isdn_command(&cmd); - lp->dialretry = 0; - anymore = 1; - lp->dialstate++; -+#ifdef CONFIG_ISDN_WITH_ABC -+ lp->onhtime = lp->dw_abc_old_onhtime; -+#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT -+ isdn_dw_abc_lcr_clear(lp); -+#endif -+#endif - /* Fall through */ - case 3: - /* Setup interface, dial current phone-number, switch to next number. - * If list of phone-numbers is exhausted, increment - * retry-counter. - */ -+#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT -+ if(!isdn_dw_abc_lcr_lock()) { -+ -+ if( lp->dw_abc_lcr_cmd != NULL && -+ lp->dw_abc_lcr_start_request != -+ lp->dw_abc_lcr_end_request) { -+ -+ if( lp->dw_abc_lcr_io == NULL && -+ lp->dw_abc_lcr_start_request <= jiffies && -+ lp->dw_abc_lcr_end_request > jiffies) { -+ -+ isdn_dw_abc_lcr_ulock(); -+ anymore = 1; -+ break; -+ } -+ -+ if(lp->dw_abc_lcr_io != NULL) { -+ -+ if(lp->dw_abc_lcr_io->lcr_ioctl_flags & -+ DWABC_LCR_FLG_DISABLE) { -+ -+ isdn_dw_abc_lcr_ulock(); -+ isdn_net_hangup(&p->dev); -+ break; -+ } -+ -+ if(lp->dw_abc_lcr_io->lcr_ioctl_flags & -+ DWABC_LCR_FLG_NEWHUPTIME) { -+ lp->onhtime = lp->dw_abc_lcr_io->lcr_ioctl_onhtime; -+ } -+ } -+ -+ memcpy(&cmd,lp->dw_abc_lcr_cmd,sizeof(cmd)); -+ isdn_dw_abc_lcr_ulock(); -+ goto dw_abc_lcr_next_click; -+ } -+ -+ isdn_dw_abc_lcr_ulock(); -+ } -+#endif - if(dev->global_flags & ISDN_GLOBAL_STOPPED || (ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_OFF)) { - char *s; - if (dev->global_flags & ISDN_GLOBAL_STOPPED) -@@ -677,20 +921,7 @@ - break; - } - -- cmd.driver = lp->isdn_device; -- cmd.command = ISDN_CMD_DIAL; -- cmd.parm.setup.si2 = 0; -- -- /* check for DOV */ -- phone_number = lp->dial->num; -- if ((*phone_number == 'v') || -- (*phone_number == 'V')) { /* DOV call */ -- cmd.parm.setup.si1 = 1; -- } else { /* DATA call */ -- cmd.parm.setup.si1 = 7; -- } -- -- strcpy(cmd.parm.setup.phone, phone_number); -+ sprintf(cmd.parm.setup.phone, "%s", lp->dial->num); - /* - * Switch to next number or back to start if at end of list. - */ -@@ -710,17 +941,70 @@ - } - } - restore_flags(flags); -+ cmd.driver = lp->isdn_device; -+ cmd.command = ISDN_CMD_DIAL; -+ cmd.parm.setup.si1 = 7; -+ cmd.parm.setup.si2 = 0; -+#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ -+ sprintf(cmd.parm.setup.eazmsn, "%s", -+ isdn_map_eaz2msn((*lp->dw_out_msn) ? lp->dw_out_msn : lp->msn, cmd.driver)); -+#else - sprintf(cmd.parm.setup.eazmsn, "%s", - isdn_map_eaz2msn(lp->msn, cmd.driver)); -+#endif -+#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT -+ /* -+ ** if callback-out we dont need -+ ** low-cost-routing LCR -+ */ -+ if(!(lp->flags & ISDN_NET_CBOUT) && -+ !(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_LCR)) { -+ -+ isdn_dw_abc_lcr_call_number(lp,&cmd); -+ -+ if(lp->dw_abc_lcr_start_request != lp->dw_abc_lcr_end_request) { -+ -+ if(dev->net_verbose > 2) { -+ -+ printk(KERN_INFO -+ "%s: Waiting for LCR-response from isdnlog %s -> %s...\n", -+ lp->name, -+ cmd.parm.setup.eazmsn, -+ cmd.parm.setup.phone); -+ } -+ -+ anymore = 1; -+ break; -+ } -+ } -+ -+dw_abc_lcr_next_click:; -+ isdn_dw_abc_lcr_clear(lp); -+#endif - i = isdn_dc2minor(lp->isdn_device, lp->isdn_channel); - if (i >= 0) { - strcpy(dev->num[i], cmd.parm.setup.phone); - dev->usage[i] |= ISDN_USAGE_OUTGOING; - isdn_info_update(); - } -- printk(KERN_INFO "%s: dialing %d %s... %s\n", lp->name, -- lp->dialretry, cmd.parm.setup.phone, -- (cmd.parm.setup.si1 == 1) ? "DOV" : ""); -+#ifdef CONFIG_ISDN_WITH_ABC -+ printk(KERN_INFO "%s: dialing %d %s -> %s...\n", lp->name, -+ lp->dialretry, -+ cmd.parm.setup.eazmsn, -+ cmd.parm.setup.phone); -+#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR -+ if(lp->dw_abc_bchan_errcnt) { -+ -+ printk(KERN_INFO -+ "%s: Note: bchannel-error-counter is %hd\n", -+ lp->name, -+ lp->dw_abc_bchan_errcnt); -+ } -+#endif -+#else -+ printk(KERN_INFO "%s: dialing %d %s...\n", lp->name, -+ lp->dialretry, cmd.parm.setup.phone); -+#endif - lp->dtimer = 0; - #ifdef ISDN_DEBUG_NET_DIAL - printk(KERN_DEBUG "dial: d=%d c=%d\n", lp->isdn_device, -@@ -741,6 +1025,10 @@ - lp->dialstate = - (lp->cbdelay && - (lp->flags & ISDN_NET_CBOUT)) ? 12 : 4; -+#ifdef CONFIG_ISDN_WITH_ABC -+ lp->dw_abc_if_flags &= ~ISDN_DW_ABC_IFFLAG_NODCHAN; -+ lp->dw_abc_dialstart = jiffies; -+#endif - break; - case 4: - /* Wait for D-Channel-connect. -@@ -890,6 +1178,15 @@ - isdn_command(&cmd); - printk(KERN_INFO "%s: Chargesum is %d\n", lp->name, lp->charge); - isdn_all_eaz(lp->isdn_device, lp->isdn_channel); -+#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR -+ if(lp->dw_abc_bchan_errcnt) { -+ -+ printk(KERN_INFO -+ "%s: Note: bchannel-error-counter is %hd\n", -+ lp->name, -+ lp->dw_abc_bchan_errcnt); -+ } -+#endif - } - isdn_net_unbind_channel(lp); - } -@@ -899,8 +1196,13 @@ - unsigned short dest; - } ip_ports; - -+#ifdef CONFIG_ISDN_WITH_ABC -+void -+isdn_net_log_skb_dwabc(struct sk_buff * skb, isdn_net_local * lp,char *reason) -+#else - static void - isdn_net_log_skb(struct sk_buff * skb, isdn_net_local * lp) -+#endif - { - u_char *p = skb->nh.raw; /* hopefully, this was set correctly */ - unsigned short proto = ntohs(skb->protocol); -@@ -972,7 +1274,13 @@ - break; - } - printk(KERN_INFO -+#ifdef CONFIG_ISDN_WITH_ABC -+ "%s %s: %d.%d.%d.%d -> %d.%d.%d.%d%s\n", -+ (reason == NULL) ? "OPEN" : reason, -+ (lp != NULL) ? lp->name : "", -+#else - "OPEN: %d.%d.%d.%d -> %d.%d.%d.%d%s\n", -+#endif - - p[12], p[13], p[14], p[15], - p[16], p[17], p[18], p[19], -@@ -980,7 +1288,13 @@ - break; - case ETH_P_ARP: - printk(KERN_INFO -+#ifdef CONFIG_ISDN_WITH_ABC -+ "%s %s: ARP %d.%d.%d.%d -> *.*.*.* ?%d.%d.%d.%d\n", -+ (reason == NULL) ? "OPEN" : reason, -+ (lp != NULL) ? lp->name : "", -+#else - "OPEN: ARP %d.%d.%d.%d -> *.*.*.* ?%d.%d.%d.%d\n", -+#endif - p[14], p[15], p[16], p[17], - p[24], p[25], p[26], p[27]); - break; -@@ -1004,11 +1318,22 @@ - } - - spin_lock_bh(&lp->xmit_lock); -+ - if (!isdn_net_lp_busy(lp)) { -+#ifdef CONFIG_ISDN_WITH_ABC -+ if(!skb_queue_empty(&lp->super_tx_queue)) { -+ /* -+ ** don't reverse the frame flow -+ ** compression need frames in order and maybe other's too -+ */ -+ skb_queue_tail(&lp->super_tx_queue, skb); -+ skb = skb_dequeue(&lp->super_tx_queue); -+ } -+#endif - isdn_net_writebuf_skb(lp, skb); -- } else { -- skb_queue_tail(&lp->super_tx_queue, skb); -- } -+ -+ } else skb_queue_tail(&lp->super_tx_queue, skb); -+ - spin_unlock_bh(&lp->xmit_lock); - } - -@@ -1056,7 +1381,6 @@ - printk(KERN_WARNING "%s: HL driver queue full\n", lp->name); - goto error; - } -- - lp->transcount += len; - isdn_net_inc_frame_cnt(lp); - return; -@@ -1064,9 +1388,19 @@ - error: - dev_kfree_skb(skb); - lp->stats.tx_errors++; -- - } - -+#if 0 -+int isdn_net_send_skb(struct net_device *ndev, isdn_net_local * lp,struct sk_buff *skb) -+{ -+ if (isdn_net_lp_busy(lp)) { -+ printk(KERN_WARNING "isdn_net_send_skb: HL channel busy\n"); -+ return 1; -+ } -+ isdn_net_writebuf_skb(lp, skb); -+ return 0; -+} -+#endif - - /* - * Helper function for isdn_net_start_xmit. -@@ -1109,7 +1443,54 @@ - - /* Reset hangup-timeout */ - lp->huptimer = 0; // FIXME? -+#ifdef CONFIG_ISDN_WITH_ABC -+ -+ if(test_and_set_bit(ISDN_DW_ABC_BITLOCK_SEND,&lp->dw_abc_bitlocks)) { -+ -+ if(dev->net_verbose > 2) -+ printk(KERN_INFO "%s: isdn_net_xmit called recursivly\n",lp->name); -+ -+ spin_unlock_bh(&lp->xmit_lock); -+ return(1); -+ } -+ -+ if(skb != NULL) { -+ -+ int l = skb->len; -+ int nl = l; -+ -+ if( lp->p_encap == ISDN_NET_ENCAP_RAWIP && -+ (lp->dw_abc_if_flags & ISDN_DW_ABC_IFFLAG_BSDAKTIV)) { -+ -+ if((skb = dwabc_bsd_compress(lp,skb,ndev)) != NULL) { -+ -+ int r = 0; -+ nl = skb->len; -+ skb_queue_tail(&lp->super_tx_queue,skb); -+ -+ if(l != nl && (r = isdn_dc2minor(lp->isdn_device,lp->isdn_channel)) >= 0) { -+ -+ dev->obytes[r] += l - nl; -+ lp->stats.tx_bytes += l - nl; -+ } -+ } -+ -+ } else skb_queue_tail(&lp->super_tx_queue,skb); -+ -+ if(lp->p_encap == ISDN_NET_ENCAP_RAWIP) { -+ -+ lp->dw_abc_bsd_snd += l; -+ lp->dw_abc_bsd_bsd_snd += nl; -+ } -+ } -+ clear_bit(ISDN_DW_ABC_BITLOCK_SEND,&lp->dw_abc_bitlocks); -+ -+ while(!isdn_net_lp_busy(lp) && (skb = skb_dequeue(&lp->super_tx_queue))) -+ isdn_net_writebuf_skb(lp, skb); -+ -+#else - isdn_net_writebuf_skb(lp, skb); -+#endif - spin_unlock_bh(&lp->xmit_lock); - - /* the following stuff is here for backwards compatibility. -@@ -1143,6 +1524,69 @@ - - return retv; - -+#if 0 -+ if (lp->cps > lp->triggercps) { -+ /* Device overloaded */ -+ -+ /* -+ * Packet-delivery via round-robin over master -+ * and all connected slaves. -+ */ -+ if (lp->master) { -+ /* Slaves always deliver themselves */ -+ spin_lock_bh(&lp->xmit_lock); -+ if (!isdn_net_lp_busy(lp)) { -+ isdn_net_writebuf_skb(lp, skb); -+ ret = 0; -+ } else { -+ isdn_net_device_stop_queue(lp); -+ ret = 1; -+ } -+ ret = isdn_net_send_skb(ndev, lp, skb); -+ spin_unlock_bh(&lp->xmit_lock); -+ } else { -+ isdn_net_local *slp = (isdn_net_local *) (lp->srobin->priv); -+ /* Master delivers via srobin and maintains srobin */ -+ if (lp->srobin == ndev) { -+ spin_lock_bh(&lp->xmit_lock); -+ ret = isdn_net_send_skb(ndev, lp, skb); -+ spin_unlock_bh(&lp->xmit_lock); -+ } else { -+ ret = isdn_net_start_xmit(skb, lp->srobin); -+ } -+ lp->srobin = (slp->slave) ? slp->slave : ndev; -+ slp = (isdn_net_local *) (lp->srobin->priv); -+ if (!((slp->flags & ISDN_NET_CONNECTED) && (slp->dialstate == 0))) -+ lp->srobin = ndev; -+ } -+ /* Slave-startup using delay-variable */ -+ if (lp->slave) { -+ if (!lp->sqfull) { -+ /* First time overload: set timestamp only */ -+ lp->sqfull = 1; -+ lp->sqfull_stamp = jiffies; -+ } else { -+ /* subsequent overload: if slavedelay exceeded, start dialing */ -+ if ((jiffies - lp->sqfull_stamp) > lp->slavedelay) -+ isdn_net_force_dial_lp((isdn_net_local *) lp->slave->priv); -+ } -+ } -+ } else { -+ /* Not overloaded, deliver locally */ -+ spin_lock_bh(&lp->xmit_lock); -+ if (!isdn_net_lp_busy(lp)) { -+ isdn_net_writebuf_skb(lp, skb); -+ ret = 0; -+ } else { -+ isdn_net_device_stop_queue(lp); -+ ret = 1; -+ } -+ spin_unlock_bh(&lp->xmit_lock); -+ if (lp->sqfull && ((jiffies - lp->sqfull_stamp) > (lp->slavedelay + (10 * HZ)))) -+ lp->sqfull = 0; -+ } -+ return ret; -+#endif - } - - static void -@@ -1161,6 +1605,7 @@ - } - - -+#ifndef COMPAT_NO_SOFTNET - void isdn_net_tx_timeout(struct net_device * ndev) - { - isdn_net_local *lp = (isdn_net_local *) ndev->priv; -@@ -1188,19 +1633,206 @@ - ndev->trans_start = jiffies; - netif_wake_queue(ndev); - } -+#endif - - /* - * Try sending a packet. - * If this interface isn't connected to a ISDN-Channel, find a free channel, - * and start dialing. - */ -+#ifdef CONFIG_ISDN_WITH_ABC -+static int dwabc_isdn_net_start_xmit(struct sk_buff *,struct net_device *); -+ -+static int isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev) -+{ -+ if(skb == NULL || ndev == NULL) -+ return(dwabc_isdn_net_start_xmit(skb,ndev)); -+#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK -+ if(!(((isdn_net_local *)ndev->priv)->dw_abc_flags & -+ ISDN_DW_ABC_FLAG_NO_UDP_CHECK)) { -+ -+ if(dw_abc_udp_test(skb,ndev)) { -+ dev_kfree_skb(skb); -+ return(0); -+ } -+ } -+#endif -+ return(dwabc_isdn_net_start_xmit(skb,ndev)); -+} -+ -+ -+#ifdef CONFIG_ISDN_WITH_ABC -+int isdn_auto_dial_helper( isdn_net_local *lp, -+ struct sk_buff *skb, -+ int dm_manual_allowed) -+/********************************************************************** -+ return's: -+ -1 dial not allowed or impossible -+ 0 interface is connected -+ 1 dial is started -+***********************************************************************/ -+{ -+ int retw = -1; -+ int chi; -+ ulong flags; -+ char *errmsg = NULL; -+ -+#ifdef ISDN_DEBUG_NET_DUMP -+ { -+ char *buf = skb->data; -+ isdn_dumppkt("S:", buf, skb->len, 40); -+ } -+#endif -+ if (lp->flags & ISDN_NET_CONNECTED) -+ return(0); -+ -+ save_flags(flags); -+ cli(); -+ -+ do { -+ -+ /* Log packet, which triggered dialing */ -+ if (dev->net_verbose) -+ isdn_net_log_skb(skb, lp); -+ /* only do autodial if allowed by config */ -+ if (!(ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_AUTO)) { -+ errmsg = "dial rejected: interface not in dialmode `auto'"; -+ -+ if(dm_manual_allowed && -+ !(ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_MANUAL)) { -+ -+ errmsg = -+ "dial rejected: interface not in dialmode `auto or manual'"; -+ } -+ break; -+ } -+ -+ if (!lp->phone[1]) { -+ -+ errmsg = "No phone number"; -+ break; -+ } -+ -+ if(lp->dialwait_timer <= 0) { -+ -+ if( lp->dialstarted > 0 && -+ lp->dialtimeout > 0 && -+ jiffies < (lp->dialstarted + lp->dialtimeout + lp->dialwait)) { -+ -+ lp->dialwait_timer = -+ lp->dialstarted + lp->dialtimeout + lp->dialwait; -+ } -+ } -+ -+ if(lp->dialwait_timer > 0) { -+ -+ if(jiffies < lp->dialwait_timer) { -+ -+ errmsg = "dial rejected: retry-time not reached"; -+ break; -+ -+ } else lp->dialwait_timer = 0; -+ } -+#ifdef CONFIG_ISDN_WITH_ABC -+ if(isdn_dwabc_is_interface_disabled(lp)) -+ break; -+#endif -+ /* Grab a free ISDN-Channel */ -+ if (((chi = -+ isdn_get_free_channel( -+ ISDN_USAGE_NET, -+ lp->l2_proto, -+ lp->l3_proto, -+ lp->pre_device, -+ lp->pre_channel, -+#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ -+ (*lp->dw_out_msn) ? lp->dw_out_msn : -+#endif -+ lp->msn) -+ ) < 0) && -+ ((chi = -+ isdn_get_free_channel( -+ ISDN_USAGE_NET, -+ lp->l2_proto, -+ lp->l3_proto, -+ lp->pre_device, -+ lp->pre_channel^1, -+#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ -+ (*lp->dw_out_msn) ? lp->dw_out_msn : -+#endif -+ lp->msn) -+ ) < 0)) { -+ -+ errmsg = "No channel"; -+ break; -+ } -+ -+ lp->dialstate = 1; -+ /* Connect interface with channel */ -+ isdn_net_bind_channel(lp, chi); -+#ifdef CONFIG_ISDN_PPP -+ if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP) { -+ /* no 'first_skb' handling for syncPPP */ -+ if (isdn_ppp_bind(lp) < 0) { -+ isdn_net_unbind_channel(lp); -+ break; -+ } -+ -+ isdn_net_dial(); /* Initiate dialing */ -+ netif_stop_queue(&lp->netdev->dev); -+ retw = 1; -+ break; -+ /* let upper layer requeue skb packet */ -+ } -+#endif -+ /* Initiate dialing */ -+ isdn_net_dial(); -+ isdn_net_device_stop_queue(lp); -+ retw = 1; -+ -+ } while(0); -+ -+ if(retw < 0 && errmsg != NULL) -+ isdn_net_unreachable(&lp->netdev->dev, skb, errmsg); -+ -+ restore_flags(flags); -+ return(retw); -+} -+#endif -+ -+ -+ -+static int -+dwabc_isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev) -+#else - static int - isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev) -+#endif - { - isdn_net_local *lp = (isdn_net_local *) ndev->priv; - #ifdef CONFIG_ISDN_X25 - struct concap_proto * cprot = lp -> netdev -> cprot; - #endif -+#ifdef COMPAT_NO_SOFTNET -+ /* some comment as with the softnet TX timeout -+ when this happens, it's a bug in the HL card driver -+ and should be fixed there, so we can supposedly get rid of -+ this here at all. -+ I added a debugging message to find out if it ever occurs --KG -+ */ -+ -+ if (ndev->tbusy) { -+ if (jiffies - ndev->trans_start < ISDN_NET_TX_TIMEOUT) -+ return 1; -+ if (!lp->dialstate){ -+ lp->stats.tx_errors++; -+ printk(KERN_WARNING "isdn_tx_timeout dev %s dialstate %d\n", -+ ndev->name, lp->dialstate); -+ } -+ ndev->trans_start = jiffies; -+ netif_wake_queue(ndev); -+ } -+#endif - #ifdef CONFIG_ISDN_X25 - /* At this point hard_start_xmit() passes control to the encapsulation - protocol (if present). -@@ -1220,6 +1852,40 @@ - } else - #endif - /* auto-dialing xmit function */ -+#ifdef CONFIG_ISDN_WITH_ABC -+ { -+ int r; -+ -+ isdn_net_adjust_hdr(skb, ndev); -+ -+ if(!(r = isdn_auto_dial_helper(lp,skb,0))) { -+ -+ /* -+ ** Device is connected to an ISDN channel -+ */ -+ ndev->trans_start = jiffies; -+ -+ if (!lp->dialstate) { -+ -+ /* -+ ** ISDN connection is established, try sending -+ */ -+ r = isdn_net_xmit(ndev, skb); -+ -+ } else r = 1; -+ -+ if(r) -+ netif_stop_queue(ndev); -+ -+ } else if(r < 0) { -+ -+ dev_kfree_skb(skb); -+ r = 0; -+ } -+ -+ return(r); -+ } -+#else - { - #ifdef ISDN_DEBUG_NET_DUMP - u_char *buf; -@@ -1256,6 +1922,14 @@ - } else - lp->dialwait_timer = 0; - } -+#ifdef CONFIG_ISDN_WITH_ABC -+ if(isdn_dwabc_is_interface_disabled(lp)) { -+ -+ dev_kfree_skb(skb); -+ restore_flags(flags); -+ return(0); -+ } -+#endif - /* Grab a free ISDN-Channel */ - if (((chi = - isdn_get_free_channel( -@@ -1264,6 +1938,9 @@ - lp->l3_proto, - lp->pre_device, - lp->pre_channel, -+#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ -+ (*lp->dw_out_msn) ? lp->dw_out_msn : -+#endif - lp->msn) - ) < 0) && - ((chi = -@@ -1273,6 +1950,9 @@ - lp->l3_proto, - lp->pre_device, - lp->pre_channel^1, -+#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ -+ (*lp->dw_out_msn) ? lp->dw_out_msn : -+#endif - lp->msn) - ) < 0)) { - restore_flags(flags); -@@ -1296,16 +1976,6 @@ - restore_flags(flags); - return 0; /* STN (skb to nirvana) ;) */ - } --#ifdef CONFIG_IPPP_FILTER -- if (isdn_ppp_autodial_filter(skb, lp)) { -- isdn_ppp_free(lp); -- isdn_net_unbind_channel(lp); -- restore_flags(flags); -- isdn_net_unreachable(ndev, skb, "dial rejected: packet filtered"); -- dev_kfree_skb(skb); -- return 0; -- } --#endif - restore_flags(flags); - isdn_net_dial(); /* Initiate dialing */ - netif_stop_queue(ndev); -@@ -1337,6 +2007,7 @@ - } - } - return 1; -+#endif - } - - /* -@@ -1356,6 +2027,9 @@ - if( cprot && cprot -> pops ) cprot -> pops -> close( cprot ); - #endif - netif_stop_queue(dev); -+#ifdef COMPAT_NO_SOFTNET -+ dev->start = 0; -+#endif - if ((p = (((isdn_net_local *) dev->priv)->slave))) { - /* If this interface has slaves, stop them also */ - while (p) { -@@ -1776,6 +2450,10 @@ - } - - switch (type) { -+ case CISCO_TYPE_INET: -+ skb->protocol = htons(ETH_P_IP); -+ netif_rx(skb); -+ break; - case CISCO_TYPE_SLARP: - isdn_net_ciscohdlck_slarp_in(lp, skb); - goto out_free; -@@ -1785,11 +2463,11 @@ - "\"no cdp enable\" on cisco.\n", lp->name); - goto out_free; - default: -- /* no special cisco protocol */ -- skb->protocol = htons(type); -- netif_rx(skb); -- return; -+ printk(KERN_WARNING "%s: Unknown Cisco type 0x%04x\n", -+ lp->name, type); -+ goto out_free; - } -+ return; - - out_free: - kfree_skb(skb); -@@ -1803,9 +2481,19 @@ - { - isdn_net_local *lp = (isdn_net_local *) ndev->priv; - isdn_net_local *olp = lp; /* original 'lp' */ -+#ifdef CONFIG_ISDN_PPP -+ int proto = PPP_PROTOCOL(skb->data); -+#endif - #ifdef CONFIG_ISDN_X25 - struct concap_proto *cprot = lp -> netdev -> cprot; - #endif -+#ifdef CONFIG_ISDN_WITH_ABC -+ struct net_device *ondev = ndev; -+#ifdef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER -+ ulong lp_huptimer = 0; -+ ulong olp_huptimer = 0; -+#endif -+#endif - lp->transcount += skb->len; - - lp->stats.rx_packets++; -@@ -1819,6 +2507,10 @@ - lp->stats.rx_packets++; - lp->stats.rx_bytes += skb->len; - } -+#ifdef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER -+ lp_huptimer = lp->huptimer; -+ olp_huptimer = olp->huptimer; -+#endif - skb->dev = ndev; - skb->pkt_type = PACKET_HOST; - skb->mac.raw = skb->data; -@@ -1840,9 +2532,40 @@ - /* Fall through */ - case ISDN_NET_ENCAP_RAWIP: - /* RAW-IP without MAC-Header */ -+#ifdef CONFIG_ISDN_WITH_ABC -+ if(olp->p_encap == ISDN_NET_ENCAP_RAWIP) { -+ -+ ushort l = skb->len; -+ short r = 0; -+ -+ olp->dw_abc_bsd_bsd_rcv += l; -+ -+ if((skb = dwabc_bsd_rx_pkt(olp,skb,ondev)) == NULL) { -+ -+ olp->dw_abc_bsd_rcv += l; -+ return; -+ } -+ -+ olp->dw_abc_bsd_rcv += skb->len; -+ -+ if( l != skb->len && -+ (r=isdn_dc2minor(olp->isdn_device,olp->isdn_channel))>=0) { -+ -+ dev->ibytes[r] += skb->len - l; -+ olp->stats.rx_bytes += skb->len - l; -+ -+ if(olp != lp) -+ lp->stats.rx_bytes += skb->len - l; -+ } -+ } -+#endif - olp->huptimer = 0; - lp->huptimer = 0; - skb->protocol = htons(ETH_P_IP); -+#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR -+ if(isdn_dwabc_conerr_ippktok(skb)) -+ lp->dw_abc_bchan_errcnt = 0; -+#endif - break; - case ISDN_NET_ENCAP_CISCOHDLCK: - isdn_net_ciscohdlck_receive(lp, skb); -@@ -1862,8 +2585,22 @@ - break; - #ifdef CONFIG_ISDN_PPP - case ISDN_NET_ENCAP_SYNCPPP: -- /* huptimer is done in isdn_ppp_push_higher */ -+ /* -+ * If encapsulation is syncppp, don't reset -+ * huptimer on LCP packets. -+ */ -+ if (proto != PPP_LCP) { -+ olp->huptimer = 0; -+ lp->huptimer = 0; -+ } - isdn_ppp_receive(lp->netdev, olp, skb); -+#ifdef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER -+ if(olp->dw_abc_flags & ISDN_DW_ABC_FLAG_RCV_NO_HUPTIMER) { -+ -+ lp->huptimer = lp_huptimer + 1; -+ olp->huptimer = olp_huptimer+ 1; -+ } -+#endif - return; - #endif - -@@ -1873,6 +2610,15 @@ - if(cprot) if(cprot -> pops) - if( cprot -> pops -> data_ind){ - cprot -> pops -> data_ind(cprot,skb); -+#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR -+ lp->dw_abc_bchan_errcnt = 0; -+#ifdef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER -+ if(olp->dw_abc_flags & ISDN_DW_ABC_FLAG_RCV_NO_HUPTIMER) { -+ lp->huptimer = lp_huptimer; -+ olp->huptimer = olp_huptimer; -+ } -+#endif -+#endif - return; - }; - #endif /* CONFIG_ISDN_X25 */ -@@ -1882,6 +2628,15 @@ - return; - } - -+#ifdef CONFIG_ISDN_WITH_ABC -+#ifdef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER -+ if(olp->dw_abc_flags & ISDN_DW_ABC_FLAG_RCV_NO_HUPTIMER) { -+ -+ lp->huptimer = lp_huptimer; -+ olp->huptimer = olp_huptimer; -+ } -+#endif -+#endif - netif_rx(skb); - return; - } -@@ -2160,8 +2915,10 @@ - isdn_net_phone *n; - ulong flags; - char nr[32]; -- char *my_eaz; -- -+#ifdef CONFIG_ISDN_WITH_ABC -+ if(dev->net_verbose > 2) -+ printk(KERN_DEBUG "n_fi: di=%d ch=%d idx=%d usg=0x%04X\n", di, ch, idx,dev->usage[idx]); -+#endif - /* Search name in netdev-chain */ - save_flags(flags); - cli(); -@@ -2180,17 +2937,15 @@ - eaz = setup->eazmsn; - if (dev->net_verbose > 1) - printk(KERN_INFO "isdn_net: call from %s,%d,%d -> %s\n", nr, si1, si2, eaz); -- /* Accept DATA and VOICE calls at this stage -- local eaz is checked later for allowed call types */ -- if ((si1 != 7) && (si1 != 1)) { -- restore_flags(flags); -- if (dev->net_verbose > 1) -- printk(KERN_INFO "isdn_net: Service-Indicator not 1 or 7, ignored\n"); -- return 0; -- } -- --n = (isdn_net_phone *) 0; --p = dev->netdev; -+ /* Accept only calls with Si1 = 7 (Data-Transmission) */ -+ if (si1 != 7) { -+ restore_flags(flags); -+ if (dev->net_verbose > 1) -+ printk(KERN_INFO "isdn_net: Service-Indicator not 7, ignored\n"); -+ return 0; -+ } -+ n = (isdn_net_phone *) 0; -+ p = dev->netdev; - ematch = wret = swapped = 0; - #ifdef ISDN_DEBUG_NET_ICALL - printk(KERN_DEBUG "n_fi: di=%d ch=%d idx=%d usg=%d\n", di, ch, idx, -@@ -2210,25 +2965,8 @@ - break; - } - swapped = 0; -- /* check acceptable call types for DOV */ -- my_eaz = isdn_map_eaz2msn(lp->msn, di); -- if (si1 == 1) { /* it's a DOV call, check if we allow it */ -- if (*my_eaz == 'v' || *my_eaz == 'V' || -- *my_eaz == 'b' || *my_eaz == 'B') -- my_eaz++; /* skip to allow a match */ -- else -- my_eaz = 0; /* force non match */ -- } else { /* it's a DATA call, check if we allow it */ -- if (*my_eaz == 'b' || *my_eaz == 'B') -- my_eaz++; /* skip to allow a match */ -- } -- if (my_eaz) -- matchret = isdn_msncmp(eaz, my_eaz); -- else -- matchret = 1; -- if (!matchret) -- ematch = 1; -- -+ if (!(matchret = isdn_msncmp(eaz, isdn_map_eaz2msn(lp->msn, di)))) -+ ematch = 1; - /* Remember if more numbers eventually can match */ - if (matchret > wret) - wret = matchret; -@@ -2236,17 +2974,122 @@ - printk(KERN_DEBUG "n_fi: if='%s', l.msn=%s, l.flags=%d, l.dstate=%d\n", - lp->name, lp->msn, lp->flags, lp->dialstate); - #endif -+#ifdef CONFIG_ISDN_WITH_ABC_CALLB -+ if ((!matchret) && /* EAZ is matching */ -+ (((!(lp->flags & ISDN_NET_CONNECTED)) && /* but not connected */ -+ (USG_NONE(dev->usage[idx]))) || /* and ch. unused or */ -+ (lp->dialstate == 4) || (lp->dialstate == 12) || /* if dialing */ -+ ((lp->flags & ISDN_NET_CBOUT) != 0 && /* init a callback */ -+ lp->outgoing != 0 ))) -+ -+ /* -+ ** we dont stop call's anymore (both sides call's syncron) -+ ** it will be problem in any case. -+ ** both sides will make the same. -+ ** i try later to make a switch (check the phon-numbers) -+ ** to detect with side must be stop the call. -+ */ -+#else - if ((!matchret) && /* EAZ is matching */ - (((!(lp->flags & ISDN_NET_CONNECTED)) && /* but not connected */ - (USG_NONE(dev->usage[idx]))) || /* and ch. unused or */ - ((((lp->dialstate == 4) || (lp->dialstate == 12)) && /* if dialing */ - (!(lp->flags & ISDN_NET_CALLBACK))) /* but no callback */ - ))) -+#endif - { - #ifdef ISDN_DEBUG_NET_ICALL - printk(KERN_DEBUG "n_fi: match1, pdev=%d pch=%d\n", - lp->pre_device, lp->pre_channel); - #endif -+#ifdef CONFIG_ISDN_WITH_ABC -+#ifdef CONFIG_ISDN_WITH_ABC_CALLB -+ { -+ int use_this_call = 0; -+ -+ if(!(lp->flags & ISDN_NET_CBOUT) && ((lp->dialstate == 4) || (lp->dialstate == 12))) { -+ -+ /* -+ ** searching for a diff. in the calling-number and the EAZ -+ ** the remote will make the same -+ */ -+ -+ char *pnr = nr; -+ char *pea = eaz; -+ -+ for(;*pnr;pnr++); -+ for(;*pea;pea++); -+ for(pnr--,pea--;pnr >= nr && pea >= eaz && *pea != *pnr;pnr--,pea--); -+ -+ if(pnr < nr || pea < eaz || *pea > *pnr) { -+ -+ p = (isdn_net_dev *) p->next; -+ continue; -+ } -+ -+ use_this_call = 1; -+ } -+ -+ if( use_this_call || -+ ((lp->flags & ISDN_NET_CBOUT) && (lp->flags & ISDN_NET_CONNECTED))) { -+ -+ /* -+ ** the incoming call was to quick. -+ ** the callback-delay-time ist not reached. -+ ** in that case we can stop the call -+ */ -+ -+ if(lp->isdn_device > -1 && lp->isdn_channel > -1) { -+ -+ int minor = isdn_dc2minor(lp->isdn_device,lp->isdn_channel); -+ -+ if(lp->isdn_device != di || lp->isdn_channel != ch) { -+ -+ isdn_ctrl cmd; -+ -+ memset((void *)&cmd,0,sizeof(cmd)); -+ cmd.driver = lp->isdn_device; -+ cmd.command = ISDN_CMD_HANGUP; -+ cmd.arg = lp->isdn_channel; -+ (void) dev->drv[cmd.driver]->interface->command(&cmd); -+ isdn_all_eaz(lp->isdn_device, lp->isdn_channel); -+ -+ if(dev->net_verbose > 1) { -+ -+ printk(KERN_INFO -+ "%s: found outgoing call hangup old call on di %d ch %d\n", -+ lp->name,lp->isdn_device,lp->isdn_channel); -+ } -+ -+ } else if (dev->net_verbose > 1) { -+ -+ printk(KERN_INFO "%s: found outgoing call on same di %d ch %d\n", -+ lp->name,lp->isdn_device,lp->isdn_channel); -+ } -+ -+ if(minor >= 0) { -+ -+ dev->rx_netdev[minor] = NULL; -+ dev->st_netdev[minor] = NULL; -+ } -+ -+ isdn_free_channel(lp->isdn_device, -+ lp->isdn_channel, ISDN_USAGE_NET); -+ -+ } else if (dev->net_verbose > 1) { -+ -+ printk(KERN_INFO "%s: found outgoing call reset callstate \n",lp->name); -+ } -+ -+ lp->flags &= ~ISDN_NET_CONNECTED; -+ lp->isdn_device = -1; -+ lp->isdn_channel = -1; -+ lp->dtimer = 0; -+ lp->dialstate = 0; -+ } -+ } -+#endif -+#endif - if (dev->usage[idx] & ISDN_USAGE_EXCLUSIVE) { - if ((lp->pre_channel != ch) || - (lp->pre_device != di)) { -@@ -2375,6 +3218,12 @@ - continue; - } - } -+#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR -+ if(isdn_dwabc_is_interface_disabled(lp)) { -+ restore_flags(flags); -+ return 3; -+ } -+#endif - if (lp->flags & ISDN_NET_CALLBACK) { - int chi; - /* -@@ -2427,6 +3276,47 @@ - restore_flags(flags); - return 0; - } else { -+#ifdef CONFIG_ISDN_WITH_ABC_CALLB -+ { -+ /* -+ ** this is a sanity-check. -+ ** check for double use (device and channel) -+ ** will be very near to a kernel-crash in that case -+ */ -+ isdn_net_dev *sp = dev->netdev; -+ int s_shl; -+ isdn_net_local *ml; -+ -+ for(s_shl=0; s_shl < 2048 && sp != NULL; sp = (isdn_net_dev *)sp->next, s_shl++) { -+ -+ if(sp == p || (ml = sp->local) == NULL) -+ continue; -+ -+ if(ml->isdn_device != di || ml->isdn_channel != ch) -+ continue; -+ -+ if(ml->dialstate != 4 && ml->dialstate != 12) { -+ -+ /* -+ ** wrong situation -+ */ -+ break; -+ } -+ -+ isdn_net_unbind_channel(ml); -+ } -+ -+ if(sp != NULL) { -+ -+ printk(KERN_DEBUG -+"%s: call from %s -> %s (drv %d chan %d duplicated with %s) \n", -+ lp->name, nr, eaz,di,ch, -+ sp->local->name ); -+ -+ restore_flags(flags); -+ return 3; -+ }} -+#endif - printk(KERN_DEBUG "%s: call from %s -> %s accepted\n", lp->name, nr, - eaz); - /* if this interface is dialing, it does it probably on a different -@@ -2516,7 +3406,11 @@ - lp->l3_proto, - lp->pre_device, - lp->pre_channel, -+#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ -+ (*lp->dw_out_msn) ? lp->dw_out_msn : lp->msn) -+#else - lp->msn) -+#endif - ) < 0) { - printk(KERN_WARNING "isdn_net_force_dial: No channel for %s\n", lp->name); - restore_flags(flags); -@@ -2599,7 +3493,11 @@ - strcpy(netdev->local->name, " "); - else - strcpy(netdev->local->name, name); -+#ifdef COMPAT_NO_SOFTNET -+ netdev->dev.name = netdev->local->name; -+#else - strcpy(netdev->dev.name, netdev->local->name); -+#endif - netdev->dev.priv = netdev->local; - netdev->dev.init = isdn_net_init; - netdev->local->p_encap = ISDN_NET_ENCAP_RAWIP; -@@ -2617,11 +3515,13 @@ - ((isdn_net_local *) q->priv)->slave = &(netdev->dev); - } else { - /* Device shall be a master */ -+#ifndef COMPAT_NO_SOFTNET - /* - * Watchdog timer (currently) for master only. - */ - netdev->dev.tx_timeout = isdn_net_tx_timeout; - netdev->dev.watchdog_timeo = ISDN_NET_TX_TIMEOUT; -+#endif - if (register_netdev(&netdev->dev) != 0) { - printk(KERN_WARNING "isdn_net: Could not register net-device\n"); - kfree(netdev->local); -@@ -2658,6 +3558,9 @@ - netdev->local->hupflags = ISDN_INHUP; /* Do hangup even on incoming calls */ - netdev->local->onhtime = 10; /* Default hangup-time for saving costs - of those who forget configuring this */ -+#ifdef CONFIG_ISDN_WITH_ABC -+ netdev->local->dw_abc_old_onhtime = netdev->local->onhtime; -+#endif - netdev->local->dialmax = 1; - netdev->local->flags = ISDN_NET_CBHUP | ISDN_NET_DM_MANUAL; /* Hangup before Callback, manual dial */ - netdev->local->cbdelay = 25; /* Wait 5 secs before Callback */ -@@ -2831,7 +3734,6 @@ - - /* If binding is exclusive, try to grab the channel */ - save_flags(flags); -- cli(); - if ((i = isdn_get_free_channel(ISDN_USAGE_NET, - lp->l2_proto, lp->l3_proto, drvidx, - chidx, lp->msn)) < 0) { -@@ -2859,6 +3761,9 @@ - lp->pre_device = drvidx; - lp->pre_channel = chidx; - lp->onhtime = cfg->onhtime; -+#ifdef CONFIG_ISDN_WITH_ABC -+ lp->dw_abc_old_onhtime = lp->onhtime; -+#endif - lp->charge = cfg->charge; - lp->l2_proto = cfg->l2_proto; - lp->l3_proto = cfg->l3_proto; -@@ -2932,6 +3837,9 @@ - } - } - lp->p_encap = cfg->p_encap; -+#ifdef CONFIG_ISDN_WITH_ABC -+ isdn_dw_abc_reset_interface(lp,0); -+#endif - return 0; - } - return -ENODEV; -@@ -3007,6 +3915,9 @@ - strcpy(n->num, phone->phone); - n->next = p->local->phone[phone->outgoing & 1]; - p->local->phone[phone->outgoing & 1] = n; -+#ifdef CONFIG_ISDN_WITH_ABC -+ isdn_dwabc_test_phone(p->local); -+#endif - return 0; - } - return -ENODEV; -@@ -3100,6 +4011,9 @@ - else - p->local->phone[inout] = n->next; - kfree(n); -+#ifdef CONFIG_ISDN_WITH_ABC -+ isdn_dwabc_test_phone(p->local); -+#endif - restore_flags(flags); - return 0; - } -@@ -3135,6 +4049,9 @@ - p->local->phone[i] = NULL; - } - p->local->dial = NULL; -+#ifdef CONFIG_ISDN_WITH_ABC -+ isdn_dwabc_test_phone(p->local); -+#endif - restore_flags(flags); - return 0; - } -@@ -3218,6 +4135,10 @@ - /* If no more net-devices remain, disable auto-hangup timer */ - if (dev->netdev == NULL) - isdn_timer_ctrl(ISDN_TIMER_NETHANGUP, 0); -+#ifdef CONFIG_ISDN_WITH_ABC -+ isdn_dw_clear_if(~0l,p->local); -+ dwabc_bsd_free(p->local); -+#endif - restore_flags(flags); - kfree(p->local); - kfree(p); -diff -rNu linux-2.4.29.old/drivers/isdn/isdn_net.h linux-2.4.29/drivers/isdn/isdn_net.h ---- linux-2.4.29.old/drivers/isdn/isdn_net.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdn_net.h 2005-03-22 15:06:44.463333328 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn_net.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: isdn_net.h,v 1.23 2001/11/07 22:35:48 kai Exp $ - * - * header for Linux ISDN subsystem, network related functions (linklevel). - * -@@ -26,6 +26,7 @@ - #define CISCO_ADDR_BROADCAST 0x8f - #define CISCO_CTRL 0x00 - #define CISCO_TYPE_CDP 0x2000 -+#define CISCO_TYPE_INET 0x0800 - #define CISCO_TYPE_SLARP 0x8035 - #define CISCO_SLARP_REQUEST 0 - #define CISCO_SLARP_REPLY 1 -@@ -106,8 +107,6 @@ - spin_lock_irqsave(&nd->queue_lock, flags); - - lp = nd->queue; --// printk(KERN_DEBUG __FUNCTION__": lp:%s(%p) nlp:%s(%p) last(%p)\n", --// lp->name, lp, nlp->name, nlp, lp->last); - nlp->last = lp->last; - lp->last->next = nlp; - lp->last = nlp; -@@ -127,20 +126,12 @@ - if (lp->master) - master_lp = (isdn_net_local *) lp->master->priv; - --// printk(KERN_DEBUG __FUNCTION__": lp:%s(%p) mlp:%s(%p) last(%p) next(%p) mndq(%p)\n", --// lp->name, lp, master_lp->name, master_lp, lp->last, lp->next, master_lp->netdev->queue); - spin_lock_irqsave(&master_lp->netdev->queue_lock, flags); - lp->last->next = lp->next; - lp->next->last = lp->last; -- if (master_lp->netdev->queue == lp) { -+ if (master_lp->netdev->queue == lp) - master_lp->netdev->queue = lp->next; -- if (lp->next == lp) { /* last in queue */ -- master_lp->netdev->queue = master_lp->netdev->local; -- } -- } - lp->next = lp->last = lp; /* (re)set own pointers */ --// printk(KERN_DEBUG __FUNCTION__": mndq(%p)\n", --// master_lp->netdev->queue); - spin_unlock_irqrestore(&master_lp->netdev->queue_lock, flags); - } - -diff -rNu linux-2.4.29.old/drivers/isdn/isdn_ppp.c linux-2.4.29/drivers/isdn/isdn_ppp.c ---- linux-2.4.29.old/drivers/isdn/isdn_ppp.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdn_ppp.c 2005-03-22 15:06:44.481330592 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn_ppp.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: isdn_ppp.c,v 1.94 2001/11/07 22:35:48 kai Exp $ - * - * Linux ISDN subsystem, functions for synchronous PPP (linklevel). - * -@@ -13,9 +13,6 @@ - #include - #include - #include --#ifdef CONFIG_IPPP_FILTER --#include --#endif - - #include "isdn_common.h" - #include "isdn_ppp.h" -@@ -72,11 +69,19 @@ - static int isdn_ppp_bundle(struct ippp_struct *, int unit); - #endif /* CONFIG_ISDN_MPP */ - --char *isdn_ppp_revision = "$Revision: 1.1.4.1 $"; -+char *isdn_ppp_revision = "$Revision: 1.94 $"; - - static struct ippp_struct *ippp_table[ISDN_MAX_CHANNELS]; - -+#ifndef CONFIG_ISDN_WITH_ABC - static struct isdn_ppp_compressor *ipc_head = NULL; -+#else -+ /* -+ ** make compressor's common usable -+ */ -+struct isdn_ppp_compressor *isdn_ippp_comp_head = NULL; -+#define ipc_head isdn_ippp_comp_head -+#endif - - /* - * frame log (debug) -@@ -110,11 +115,8 @@ - unsigned long flags; - struct ippp_struct *is; - -- if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) { -- printk(KERN_ERR "%s: ppp_slot(%d) out of range\n", -- __FUNCTION__, lp->ppp_slot); -+ if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) - return 0; -- } - - save_flags(flags); - cli(); -@@ -130,12 +132,7 @@ - lp->netdev->pb->ref_ct--; - spin_unlock(&lp->netdev->pb->lock); - #endif /* CONFIG_ISDN_MPP */ -- if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) { -- printk(KERN_ERR "%s: ppp_slot(%d) now invalid\n", -- __FUNCTION__, lp->ppp_slot); -- restore_flags(flags); -- return 0; -- } -+ - is = ippp_table[lp->ppp_slot]; - if ((is->state & IPPP_CONNECT)) - isdn_ppp_closewait(lp->ppp_slot); /* force wakeup on ippp device */ -@@ -231,13 +228,12 @@ - void - isdn_ppp_wakeup_daemon(isdn_net_local * lp) - { -- if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) { -- printk(KERN_ERR "%s: ppp_slot(%d) out of range\n", -- __FUNCTION__, lp->ppp_slot); -+ if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) - return; -- } -+ - ippp_table[lp->ppp_slot]->state = IPPP_OPEN | IPPP_CONNECT | IPPP_NOBLOCK; -- wake_up_interruptible(&ippp_table[lp->ppp_slot]->wq); -+ -+ wake_up_interruptible(&ippp_table[lp->ppp_slot]->wq); - } - - /* -@@ -250,14 +246,13 @@ - { - struct ippp_struct *is; - -- if (slot < 0 || slot >= ISDN_MAX_CHANNELS) { -- printk(KERN_ERR "%s: slot(%d) out of range\n", -- __FUNCTION__, slot); -+ if (slot < 0 || slot >= ISDN_MAX_CHANNELS) - return 0; -- } - is = ippp_table[slot]; -+ - if (is->state) - wake_up_interruptible(&is->wq); -+ - is->state = IPPP_CLOSEWAIT; - return 1; - } -@@ -295,9 +290,11 @@ - return -EBUSY; - } - is = file->private_data = ippp_table[slot]; -- -- printk(KERN_DEBUG "ippp, open, slot: %d, minor: %d, state: %04x\n", -- slot, min, is->state); -+ -+#if 0 -+ if (is->debug & 0x1) -+#endif -+ printk(KERN_DEBUG "ippp, open, slot: %d, minor: %d, state: %04x\n", slot, min, is->state); - - /* compression stuff */ - is->link_compressor = is->compressor = NULL; -@@ -327,10 +324,7 @@ - */ - is->slcomp = slhc_init(16, 16); /* not necessary for 2. link in bundle */ - #endif --#ifdef CONFIG_IPPP_FILTER -- is->pass_filter.filter = NULL; -- is->active_filter.filter = NULL; --#endif -+ - is->state = IPPP_OPEN; - - return 0; -@@ -349,20 +343,12 @@ - return; - is = file->private_data; - -- if (!is) { -- printk(KERN_ERR "%s: no file->private_data\n", __FUNCTION__); -- return; -- } - if (is->debug & 0x1) - printk(KERN_DEBUG "ippp: release, minor: %d %lx\n", min, (long) is->lp); - - if (is->lp) { /* a lp address says: this link is still up */ - isdn_net_dev *p = is->lp->netdev; - -- if (!p) { -- printk(KERN_ERR "%s: no lp->netdev\n", __FUNCTION__); -- return; -- } - is->state &= ~IPPP_CONNECT; /* -> effect: no call of wakeup */ - /* - * isdn_net_hangup() calls isdn_ppp_free() -@@ -385,18 +371,8 @@ - slhc_free(is->slcomp); - is->slcomp = NULL; - #endif --#ifdef CONFIG_IPPP_FILTER -- if (is->pass_filter.filter) { -- kfree(is->pass_filter.filter); -- is->pass_filter.filter = NULL; -- } -- if (is->active_filter.filter) { -- kfree(is->active_filter.filter); -- is->active_filter.filter = NULL; -- } --#endif - --/* TODO: if this was the previous master: link the stuff to the new master */ -+/* TODO: if this was the previous master: link the the stuff to the new master */ - if(is->comp_stat) - is->compressor->free(is->comp_stat); - if(is->link_comp_stat) -@@ -509,13 +485,15 @@ - if (val & SC_ENABLE_IP && !(is->pppcfg & SC_ENABLE_IP) && (is->state & IPPP_CONNECT)) { - if (lp) { - /* OK .. we are ready to send buffers */ -- is->pppcfg = val; /* isdn_ppp_xmit test for SC_ENABLE_IP !!! */ - netif_wake_queue(&lp->netdev->dev); -- break; - } - } - is->pppcfg = val; - break; -+#if 0 -+ case PPPIOCGSTAT: /* read PPP statistic information */ -+ break; -+#endif - case PPPIOCGIDLE: /* get idle time information */ - if (lp) { - struct ppp_idle pidle; -@@ -604,39 +582,6 @@ - } - return set_arg((void *)arg,&pci,sizeof(struct pppcallinfo)); - } --#ifdef CONFIG_IPPP_FILTER -- case PPPIOCSPASS: -- case PPPIOCSACTIVE: -- { -- struct sock_fprog uprog, *filtp; -- struct sock_filter *code = NULL; -- int len, err; -- -- if (copy_from_user(&uprog, (void *) arg, sizeof(uprog))) -- return -EFAULT; -- if (uprog.len > 0 && uprog.len < 65536) { -- len = uprog.len * sizeof(struct sock_filter); -- code = kmalloc(len, GFP_KERNEL); -- if (code == NULL) -- return -ENOMEM; -- if (copy_from_user(code, uprog.filter, len)) { -- kfree(code); -- return -EFAULT; -- } -- err = sk_chk_filter(code, uprog.len); -- if (err) { -- kfree(code); -- return err; -- } -- } -- filtp = (cmd == PPPIOCSPASS) ? &is->pass_filter : &is->active_filter; -- if (filtp->filter) -- kfree(filtp->filter); -- filtp->filter = code; -- filtp->len = uprog.len; -- break; -- } --#endif /* CONFIG_IPPP_FILTER */ - default: - break; - } -@@ -699,7 +644,7 @@ - struct ippp_struct *is; - - if (slot < 0 || slot >= ISDN_MAX_CHANNELS) { -- printk(KERN_WARNING "ippp: illegal slot(%d).\n", slot); -+ printk(KERN_WARNING "ippp: illegal slot.\n"); - return 0; - } - is = ippp_table[slot]; -@@ -976,8 +921,7 @@ - - slot = lp->ppp_slot; - if (slot < 0 || slot > ISDN_MAX_CHANNELS) { -- printk(KERN_ERR "isdn_ppp_receive: lp->ppp_slot(%d)\n", -- lp->ppp_slot); -+ printk(KERN_ERR "isdn_ppp_receive: lp->ppp_slot %d\n", lp->ppp_slot); - kfree_skb(skb); - return; - } -@@ -1026,23 +970,19 @@ - { - struct net_device *dev = &net_dev->dev; - struct ippp_struct *is, *mis; -- isdn_net_local *mlp = NULL; - int slot; - - slot = lp->ppp_slot; - if (slot < 0 || slot > ISDN_MAX_CHANNELS) { -- printk(KERN_ERR "isdn_ppp_push_higher: lp->ppp_slot(%d)\n", -- lp->ppp_slot); -+ printk(KERN_ERR "isdn_ppp_push_higher: lp->ppp_slot %d\n", lp->ppp_slot); - goto drop_packet; - } - is = ippp_table[slot]; - - if (lp->master) { // FIXME? -- mlp = (isdn_net_local *) lp->master->priv; -- slot = mlp->ppp_slot; -+ slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot; - if (slot < 0 || slot > ISDN_MAX_CHANNELS) { -- printk(KERN_ERR "isdn_ppp_push_higher: master->ppp_slot(%d)\n", -- lp->ppp_slot); -+ printk(KERN_ERR "isdn_ppp_push_higher: master->ppp_slot %d\n", lp->ppp_slot); - goto drop_packet; - } - } -@@ -1076,11 +1016,6 @@ - case PPP_VJC_UNCOMP: - if (is->debug & 0x20) - printk(KERN_DEBUG "isdn_ppp: VJC_UNCOMP\n"); -- if (net_dev->local->ppp_slot < 0) { -- printk(KERN_ERR "%s: net_dev->local->ppp_slot(%d) out of range\n", -- __FUNCTION__, net_dev->local->ppp_slot); -- goto drop_packet; -- } - if (slhc_remember(ippp_table[net_dev->local->ppp_slot]->slcomp, skb->data, skb->len) <= 0) { - printk(KERN_WARNING "isdn_ppp: received illegal VJC_UNCOMP frame!\n"); - goto drop_packet; -@@ -1102,11 +1037,6 @@ - } - skb_put(skb, skb_old->len + 128); - memcpy(skb->data, skb_old->data, skb_old->len); -- if (net_dev->local->ppp_slot < 0) { -- printk(KERN_ERR "%s: net_dev->local->ppp_slot(%d) out of range\n", -- __FUNCTION__, net_dev->local->ppp_slot); -- goto drop_packet; -- } - pkt_len = slhc_uncompress(ippp_table[net_dev->local->ppp_slot]->slcomp, - skb->data, skb_old->len); - kfree_skb(skb_old); -@@ -1133,36 +1063,12 @@ - return; - } - --#ifdef CONFIG_IPPP_FILTER -- /* check if the packet passes the pass and active filters -- * the filter instructions are constructed assuming -- * a four-byte PPP header on each packet (which is still present) */ -- skb_push(skb, 4); -- skb->data[0] = 0; /* indicate inbound */ -- -- if (is->pass_filter.filter -- && sk_run_filter(skb, is->pass_filter.filter, -- is->pass_filter.len) == 0) { -- if (is->debug & 0x2) -- printk(KERN_DEBUG "IPPP: inbound frame filtered.\n"); -- kfree_skb(skb); -- return; -- } -- if (!(is->active_filter.filter -- && sk_run_filter(skb, is->active_filter.filter, -- is->active_filter.len) == 0)) { -- if (is->debug & 0x2) -- printk(KERN_DEBUG "IPPP: link-active filter: reseting huptimer.\n"); -- lp->huptimer = 0; -- if (mlp) -- mlp->huptimer = 0; -- } -- skb_pull(skb, 4); --#else /* CONFIG_IPPP_FILTER */ -- lp->huptimer = 0; -- if (mlp) -- mlp->huptimer = 0; --#endif /* CONFIG_IPPP_FILTER */ -+ /* Reset hangup-timer */ -+ lp->huptimer = 0; -+#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR -+ lp->dw_abc_bchan_errcnt = 0; -+#endif -+ - skb->dev = dev; - skb->mac.raw = skb->data; - netif_rx(skb); -@@ -1199,6 +1105,7 @@ - return skb_push(skb,len); - } - -+ - /* - * send ppp frame .. we expect a PIDCOMPressable proto -- - * (here: currently always PPP_IP,PPP_VJC_COMP,PPP_VJC_UNCOMP) -@@ -1214,25 +1121,23 @@ - isdn_net_dev *nd; - unsigned int proto = PPP_IP; /* 0x21 */ - struct ippp_struct *ipt,*ipts; -- int slot, retval = 0; -+ int slot; - - mlp = (isdn_net_local *) (netdev->priv); - nd = mlp->netdev; /* get master lp */ - - slot = mlp->ppp_slot; - if (slot < 0 || slot > ISDN_MAX_CHANNELS) { -- printk(KERN_ERR "isdn_ppp_xmit: lp->ppp_slot(%d)\n", -- mlp->ppp_slot); -+ printk(KERN_ERR "isdn_ppp_xmit: lp->ppp_slot %d\n", mlp->ppp_slot); - kfree_skb(skb); -- goto out; -+ return 0; - } - ipts = ippp_table[slot]; - - if (!(ipts->pppcfg & SC_ENABLE_IP)) { /* PPP connected ? */ - if (ipts->debug & 0x1) - printk(KERN_INFO "%s: IP frame delayed.\n", netdev->name); -- retval = 1; -- goto out; -+ return 1; - } - - switch (ntohs(skb->protocol)) { -@@ -1246,25 +1151,24 @@ - printk(KERN_ERR "isdn_ppp: skipped unsupported protocol: %#x.\n", - skb->protocol); - dev_kfree_skb(skb); -- goto out; -+ return 0; - } - - lp = isdn_net_get_locked_lp(nd); - if (!lp) { - printk(KERN_WARNING "%s: all channels busy - requeuing!\n", netdev->name); -- retval = 1; -- goto out; -+ return 1; - } - /* we have our lp locked from now on */ - - slot = lp->ppp_slot; - if (slot < 0 || slot > ISDN_MAX_CHANNELS) { -- printk(KERN_ERR "isdn_ppp_xmit: lp->ppp_slot(%d)\n", -- lp->ppp_slot); -+ printk(KERN_ERR "isdn_ppp_xmit: lp->ppp_slot %d\n", lp->ppp_slot); - kfree_skb(skb); -- goto unlock; -+ return 0; - } - ipt = ippp_table[slot]; -+ lp->huptimer = 0; - - /* - * after this line .. requeueing in the device queue is no longer allowed!!! -@@ -1275,34 +1179,6 @@ - */ - skb_pull(skb,IPPP_MAX_HEADER); - --#ifdef CONFIG_IPPP_FILTER -- /* check if we should pass this packet -- * the filter instructions are constructed assuming -- * a four-byte PPP header on each packet */ -- skb_push(skb, 4); -- skb->data[0] = 1; /* indicate outbound */ -- *(u_int16_t *)(skb->data + 2) = htons(proto); -- -- if (ipt->pass_filter.filter -- && sk_run_filter(skb, ipt->pass_filter.filter, -- ipt->pass_filter.len) == 0) { -- if (ipt->debug & 0x4) -- printk(KERN_DEBUG "IPPP: outbound frame filtered.\n"); -- kfree_skb(skb); -- goto unlock; -- } -- if (!(ipt->active_filter.filter -- && sk_run_filter(skb, ipt->active_filter.filter, -- ipt->active_filter.len) == 0)) { -- if (ipt->debug & 0x4) -- printk(KERN_DEBUG "IPPP: link-active filter: reseting huptimer.\n"); -- lp->huptimer = 0; -- } -- skb_pull(skb, 4); --#else /* CONFIG_IPPP_FILTER */ -- lp->huptimer = 0; --#endif /* CONFIG_IPPP_FILTER */ -- - if (ipt->debug & 0x4) - printk(KERN_DEBUG "xmit skb, len %d\n", (int) skb->len); - if (ipts->debug & 0x40) -@@ -1440,54 +1316,9 @@ - - unlock: - spin_unlock_bh(&lp->xmit_lock); -- out: -- return retval; -+ return 0; - } - --#ifdef CONFIG_IPPP_FILTER --/* -- * check if this packet may trigger auto-dial. -- */ -- --int isdn_ppp_autodial_filter(struct sk_buff *skb, isdn_net_local *lp) --{ -- struct ippp_struct *is = ippp_table[lp->ppp_slot]; -- u_int16_t proto; -- int drop = 0; -- -- switch (ntohs(skb->protocol)) { -- case ETH_P_IP: -- proto = PPP_IP; -- break; -- case ETH_P_IPX: -- proto = PPP_IPX; -- break; -- default: -- printk(KERN_ERR "isdn_ppp_autodial_filter: unsupported protocol 0x%x.\n", -- skb->protocol); -- return 1; -- } -- -- /* the filter instructions are constructed assuming -- * a four-byte PPP header on each packet. we have to -- * temporarily remove part of the fake header stuck on -- * earlier. -- */ -- skb_pull(skb, IPPP_MAX_HEADER - 4); -- skb->data[0] = 1; /* indicate outbound */ -- *(u_int16_t *)(skb->data + 2) = htons(proto); -- -- drop |= is->pass_filter.filter -- && sk_run_filter(skb, is->pass_filter.filter, -- is->pass_filter.len) == 0; -- drop |= is->active_filter.filter -- && sk_run_filter(skb, is->active_filter.filter, -- is->active_filter.len) == 0; -- -- skb_push(skb, IPPP_MAX_HEADER - 4); -- return drop; --} --#endif - #ifdef CONFIG_ISDN_MPP - - /* this is _not_ rfc1990 header, but something we convert both short and long -@@ -1537,15 +1368,8 @@ - - static int isdn_ppp_mp_init( isdn_net_local * lp, ippp_bundle * add_to ) - { -- struct ippp_struct * is; -- -- if (lp->ppp_slot < 0) { -- printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n", -- __FUNCTION__, lp->ppp_slot); -- return(-EINVAL); -- } -- -- is = ippp_table[lp->ppp_slot]; -+ struct ippp_struct * is = ippp_table[lp->ppp_slot]; -+ - if (add_to) { - if( lp->netdev->pb ) - lp->netdev->pb->ref_ct--; -@@ -1591,8 +1415,7 @@ - stats = &mp->stats; - slot = lp->ppp_slot; - if (slot < 0 || slot > ISDN_MAX_CHANNELS) { -- printk(KERN_ERR "%s: lp->ppp_slot(%d)\n", -- __FUNCTION__, lp->ppp_slot); -+ printk(KERN_ERR "isdn_ppp_mp_receive: lp->ppp_slot %d\n", lp->ppp_slot); - stats->frame_drops++; - dev_kfree_skb(skb); - spin_unlock_irqrestore(&mp->lock, flags); -@@ -1628,8 +1451,7 @@ - for (lpq = net_dev->queue;;) { - slot = lpq->ppp_slot; - if (slot < 0 || slot > ISDN_MAX_CHANNELS) { -- printk(KERN_ERR "%s: lpq->ppp_slot(%d)\n", -- __FUNCTION__, lpq->ppp_slot); -+ printk(KERN_ERR "isdn_ppp_mp_receive: lpq->ppp_slot %d\n", lpq->ppp_slot); - } else { - u32 lls = ippp_table[slot]->last_link_seqno; - if (MP_LT(lls, minseq)) -@@ -1861,14 +1683,9 @@ - struct sk_buff * skb; - unsigned int tot_len; - -- if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) { -- printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n", -- __FUNCTION__, lp->ppp_slot); -- return; -- } - if( MP_FLAGS(from) == (MP_BEGIN_FRAG | MP_END_FRAG) ) { - if( ippp_table[lp->ppp_slot]->debug & 0x40 ) -- printk(KERN_DEBUG "isdn_mppp: reassembly: frame %d, " -+ printk(KERN_DEBUG"isdn_mppp: reassembly: frame %d, " - "len %d\n", MP_SEQ(from), from->len ); - skb = from; - skb_pull(skb, MP_HEADER_LEN); -@@ -1987,10 +1804,8 @@ - memset(&t, 0, sizeof(struct ppp_stats)); - if (dev->flags & IFF_UP) { - t.p.ppp_ipackets = lp->stats.rx_packets; -- t.p.ppp_ibytes = lp->stats.rx_bytes; - t.p.ppp_ierrors = lp->stats.rx_errors; - t.p.ppp_opackets = lp->stats.tx_packets; -- t.p.ppp_obytes = lp->stats.tx_bytes; - t.p.ppp_oerrors = lp->stats.tx_errors; - #ifdef CONFIG_ISDN_PPP_VJ - if (slot >= 0 && ippp_table[slot]->slcomp) { -@@ -2018,6 +1833,9 @@ - int len; - isdn_net_local *lp = (isdn_net_local *) dev->priv; - -+#if 0 -+ printk(KERN_DEBUG "ippp, dev_ioctl: cmd %#08x , %d \n", cmd, lp->ppp_slot); -+#endif - - if (lp->p_encap != ISDN_NET_ENCAP_SYNCPPP) - return -EINVAL; -@@ -2431,7 +2249,7 @@ - return; - } - rs->state = CCPResetSentReq; -- /* We always expect an Ack if the decompressor doesn't -+ /* We always expect an Ack if the decompressor doesnt - know better */ - rs->expra = 1; - rs->dlen = 0; -@@ -2582,7 +2400,13 @@ - } - - if(type) { /* type=1 => Link compression */ -+#if 0 -+ compressor = is->link_compressor; -+ stat = is->link_comp_stat; -+ new_proto = PPP_LINK_COMP; -+#else - return skb_in; -+#endif - } - else { - if(!master) { -@@ -2630,31 +2454,18 @@ - static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp, - struct sk_buff *skb,int proto) - { -- struct ippp_struct *is; -+ struct ippp_struct *is = ippp_table[lp->ppp_slot]; - struct ippp_struct *mis; - int len; - struct isdn_ppp_resetparams rsparm; - unsigned char rsdata[IPPP_RESET_MAXDATABYTES]; - -- printk(KERN_DEBUG "Received CCP frame from peer slot(%d)\n", -- lp->ppp_slot); -- if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) { -- printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n", -- __FUNCTION__, lp->ppp_slot); -- return; -- } -- is = ippp_table[lp->ppp_slot]; -+ printk(KERN_DEBUG "Received CCP frame from peer\n"); - isdn_ppp_frame_log("ccp-rcv", skb->data, skb->len, 32, is->unit,lp->ppp_slot); - -- if(lp->master) { -- int slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot; -- if (slot < 0 || slot > ISDN_MAX_CHANNELS) { -- printk(KERN_ERR "%s: slot(%d) out of range\n", -- __FUNCTION__, slot); -- return; -- } -- mis = ippp_table[slot]; -- } else -+ if(lp->master) -+ mis = ippp_table[((isdn_net_local *) (lp->master->priv))->ppp_slot]; -+ else - mis = is; - - switch(skb->data[0]) { -@@ -2806,18 +2617,13 @@ - - static void isdn_ppp_send_ccp(isdn_net_dev *net_dev, isdn_net_local *lp, struct sk_buff *skb) - { -- struct ippp_struct *mis,*is; -- int proto, slot = lp->ppp_slot; -+ struct ippp_struct *mis,*is = ippp_table[lp->ppp_slot]; -+ int proto; - unsigned char *data; - - if(!skb || skb->len < 3) - return; -- if (slot < 0 || slot > ISDN_MAX_CHANNELS) { -- printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n", -- __FUNCTION__, slot); -- return; -- } -- is = ippp_table[slot]; -+ - /* Daemon may send with or without address and control field comp */ - data = skb->data; - if(!(is->pppcfg & SC_COMP_AC) && data[0] == 0xff && data[1] == 0x03) { -@@ -2833,17 +2639,12 @@ - printk(KERN_DEBUG "Received CCP frame from daemon:\n"); - isdn_ppp_frame_log("ccp-xmit", skb->data, skb->len, 32, is->unit,lp->ppp_slot); - -- if (lp->master) { -- slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot; -- if (slot < 0 || slot > ISDN_MAX_CHANNELS) { -- printk(KERN_ERR "%s: slot(%d) out of range\n", -- __FUNCTION__, slot); -- return; -- } -- mis = ippp_table[slot]; -- } else -- mis = is; -- if (mis != is) -+ if(lp->master) -+ mis = ippp_table[((isdn_net_local *) (lp->master->priv))->ppp_slot]; -+ else -+ mis = is; -+ -+ if(mis != is) - printk(KERN_DEBUG "isdn_ppp: Ouch! Master CCP sends on slave slot!\n"); - - switch(data[2]) { -diff -rNu linux-2.4.29.old/drivers/isdn/isdn_ppp.h linux-2.4.29/drivers/isdn/isdn_ppp.h ---- linux-2.4.29.old/drivers/isdn/isdn_ppp.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdn_ppp.h 2005-03-22 15:06:44.497328160 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn_ppp.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: isdn_ppp.h,v 1.18 2001/09/24 13:22:42 kai Exp $ - * - * header for Linux ISDN subsystem, functions for synchronous PPP (linklevel). - * -@@ -19,7 +19,6 @@ - extern void isdn_ppp_cleanup(void); - extern int isdn_ppp_free(isdn_net_local *); - extern int isdn_ppp_bind(isdn_net_local *); --extern int isdn_ppp_autodial_filter(struct sk_buff *, isdn_net_local *); - extern int isdn_ppp_xmit(struct sk_buff *, struct net_device *); - extern void isdn_ppp_receive(isdn_net_dev *, isdn_net_local *, struct sk_buff *); - extern int isdn_ppp_dev_ioctl(struct net_device *, struct ifreq *, int); -diff -rNu linux-2.4.29.old/drivers/isdn/isdn_tty.c linux-2.4.29/drivers/isdn/isdn_tty.c ---- linux-2.4.29.old/drivers/isdn/isdn_tty.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdn_tty.c 2005-03-22 15:06:44.524324056 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn_tty.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: isdn_tty.c,v 1.104 2002/02/09 21:19:11 keil Exp $ - * - * Linux ISDN subsystem, tty functions and AT-command emulator (linklevel). - * -@@ -53,7 +53,7 @@ - static int si2bit[8] = - {4, 1, 4, 4, 4, 4, 4, 4}; - --char *isdn_tty_revision = "$Revision: 1.1.4.1 $"; -+char *isdn_tty_revision = "$Revision: 1.104 $"; - - - /* isdn_tty_try_read() is called from within isdn_tty_rcv_skb() -@@ -321,7 +321,10 @@ - info->send_outstanding++; - info->msr &= ~UART_MSR_CTS; - info->lsr &= ~UART_LSR_TEMT; -- tty_wakeup(tty); -+ if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && -+ tty->ldisc.write_wakeup) -+ (tty->ldisc.write_wakeup) (tty); -+ wake_up_interruptible(&tty->write_wait); - return; - } - if (slen < 0) { -@@ -1211,7 +1214,10 @@ - /* If DLE decoding results in zero-transmit, but - * c originally was non-zero, do a wakeup. - */ -- tty_wakeup(tty); -+ if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && -+ tty->ldisc.write_wakeup) -+ (tty->ldisc.write_wakeup) (tty); -+ wake_up_interruptible(&tty->write_wait); - info->msr |= UART_MSR_CTS; - info->lsr |= UART_LSR_TEMT; - } -@@ -1232,6 +1238,7 @@ - } - } - } else -+#ifdef ISDN_TTY_FCLASS1 - if (TTY_IS_FCLASS1(info)) { - int cc = isdn_tty_handleDLEdown(info, m, c); - -@@ -1252,6 +1259,7 @@ - info->xmit_count += cc; - } else - #endif -+#endif - info->xmit_count += c; - } else { - info->msr |= UART_MSR_CTS; -@@ -1329,7 +1337,10 @@ - isdn_tty_cleanup_xmit(info); - info->xmit_count = 0; - restore_flags(flags); -- tty_wakeup(tty); -+ wake_up_interruptible(&tty->write_wait); -+ if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && -+ tty->ldisc.write_wakeup) -+ (tty->ldisc.write_wakeup) (tty); - } - - static void -@@ -1858,7 +1869,8 @@ - isdn_tty_shutdown(info); - if (tty->driver.flush_buffer) - tty->driver.flush_buffer(tty); -- tty_ldisc_flush(tty); -+ if (tty->ldisc.flush_buffer) -+ tty->ldisc.flush_buffer(tty); - info->tty = 0; - info->ncarrier = 0; - tty->closing = 0; -@@ -2306,6 +2318,22 @@ - isdn_tty_at_cout("\r\n", info); - } - return 1; -+ case ISDN_STAT_ALERT: -+#ifdef ISDN_TTY_STAT_DEBUG -+ printk(KERN_DEBUG "tty_STAT_ALERT ttyI%d\n", info->line); -+#endif -+ /* Signal RINGING to tty-device if requested */ -+ if (info->emu.mdmreg[REG_ALERT] & BIT_ALERT) -+ isdn_tty_modem_result(RESULT_RINGING, info); -+ return 1; -+ case ISDN_STAT_PROCEED: -+#ifdef ISDN_TTY_STAT_DEBUG -+ printk(KERN_DEBUG "tty_STAT_PROCEED ttyI%d\n", info->line); -+#endif -+ /* Signal PROCEEDING to tty-device if requested */ -+ if (info->emu.mdmreg[REG_PROCEED] & BIT_PROCEED) -+ isdn_tty_modem_result(RESULT_PROCEEDING, info); -+ return 1; - case ISDN_STAT_DCONN: - #ifdef ISDN_TTY_STAT_DEBUG - printk(KERN_DEBUG "tty_STAT_DCONN ttyI%d\n", info->line); -@@ -2618,7 +2646,7 @@ - static char *msg[] = - {"OK", "CONNECT", "RING", "NO CARRIER", "ERROR", - "CONNECT 64000", "NO DIALTONE", "BUSY", "NO ANSWER", -- "RINGING", "NO MSN/EAZ", "VCON", "RUNG"}; -+ "RINGING", "NO MSN/EAZ", "VCON", "RUNG", "PROCEEDING"}; - ulong flags; - char s[ISDN_MSNLEN+10]; - -@@ -2781,7 +2809,8 @@ - restore_flags(flags); - return; - } -- tty_ldisc_flush(info->tty); -+ if (info->tty->ldisc.flush_buffer) -+ info->tty->ldisc.flush_buffer(info->tty); - if ((info->flags & ISDN_ASYNC_CHECK_CD) && - (!((info->flags & ISDN_ASYNC_CALLOUT_ACTIVE) && - (info->flags & ISDN_ASYNC_CALLOUT_NOHUP)))) { -@@ -3296,9 +3325,11 @@ - #ifdef CONFIG_ISDN_TTY_FAX - if (TTY_IS_FCLASS2(info)) - sprintf(rs, "\r\n2"); -+#ifdef ISDN_TTY_FCLASS1 - else if (TTY_IS_FCLASS1(info)) - sprintf(rs, "\r\n1"); - #endif -+#endif - isdn_tty_at_cout(rs, info); - break; - case '=': -@@ -3313,6 +3344,7 @@ - m->mdmreg[REG_PSIZE] * 16; - break; - #ifdef CONFIG_ISDN_TTY_FAX -+#ifdef ISDN_TTY_FCLASS1 - case '1': - p[0]++; - if (!(dev->global_features & -@@ -3324,6 +3356,7 @@ - info->xmit_size = - m->mdmreg[REG_PSIZE] * 16; - break; -+#endif - case '2': - p[0]++; - if (!(dev->global_features & -@@ -3348,9 +3381,11 @@ - p[0]++; - strcpy(rs, "\r\n0,"); - #ifdef CONFIG_ISDN_TTY_FAX -+#ifdef ISDN_TTY_FCLASS1 - if (dev->global_features & - ISDN_FEATURE_L3_FCLASS1) - strcat(rs, "1,"); -+#endif - if (dev->global_features & - ISDN_FEATURE_L3_FCLASS2) - strcat(rs, "2,"); -diff -rNu linux-2.4.29.old/drivers/isdn/isdn_tty.h linux-2.4.29/drivers/isdn/isdn_tty.h ---- linux-2.4.29.old/drivers/isdn/isdn_tty.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdn_tty.h 2005-03-22 15:06:44.545320864 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn_tty.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: isdn_tty.h,v 1.25 2002/02/09 21:19:11 keil Exp $ - * - * header for Linux ISDN subsystem, tty related functions (linklevel). - * -@@ -78,6 +78,10 @@ - #define BIT_CPNFCON 2 - #define REG_CDN 23 - #define BIT_CDN 4 -+#define REG_ALERT 23 -+#define BIT_ALERT 8 -+#define REG_PROCEED 23 -+#define BIT_PROCEED 16 - - /* defines for result codes */ - #define RESULT_OK 0 -@@ -93,10 +97,13 @@ - #define RESULT_NO_MSN_EAZ 10 - #define RESULT_VCON 11 - #define RESULT_RUNG 12 -+#define RESULT_PROCEEDING 13 - -+#ifdef ISDN_TTY_FCLASS1 - #define TTY_IS_FCLASS1(info) \ - ((info->emu.mdmreg[REG_L2PROT] == ISDN_PROTO_L2_FAX) && \ - (info->emu.mdmreg[REG_L3PROT] == ISDN_PROTO_L3_FCLASS1)) -+#endif - #define TTY_IS_FCLASS2(info) \ - ((info->emu.mdmreg[REG_L2PROT] == ISDN_PROTO_L2_FAX) && \ - (info->emu.mdmreg[REG_L3PROT] == ISDN_PROTO_L3_FCLASS2)) -diff -rNu linux-2.4.29.old/drivers/isdn/isdn_ttyfax.c linux-2.4.29/drivers/isdn/isdn_ttyfax.c ---- linux-2.4.29.old/drivers/isdn/isdn_ttyfax.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdn_ttyfax.c 2005-03-22 15:06:44.561318432 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn_ttyfax.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: isdn_ttyfax.c,v 1.9 2001/09/24 13:22:43 kai Exp $ - * - * Linux ISDN subsystem, tty_fax AT-command emulator (linklevel). - * -@@ -20,7 +20,7 @@ - #include "isdn_ttyfax.h" - - --static char *isdn_tty_fax_revision = "$Revision: 1.1.4.1 $"; -+static char *isdn_tty_fax_revision = "$Revision: 1.9 $"; - - #define PARSE_ERROR1 { isdn_tty_fax_modem_result(1, info); return 1; } - -@@ -148,6 +148,7 @@ - } - } - -+#ifdef ISDN_TTY_FCLASS1 - int - isdn_tty_fax_command1(modem_info * info, isdn_ctrl * c) - { -@@ -186,6 +187,7 @@ - } - return (0); - } -+#endif - - int - isdn_tty_fax_command(modem_info * info, isdn_ctrl * c) -@@ -193,8 +195,10 @@ - T30_s *f = info->fax; - char rs[10]; - -+#ifdef ISDN_TTY_FCLASS1 - if (TTY_IS_FCLASS1(info)) - return (isdn_tty_fax_command1(info, c)); -+#endif - - #ifdef ISDN_TTY_FAX_CMD_DEBUG - printk(KERN_DEBUG "isdn_tty: Fax cmd %d on ttyI%d\n", -@@ -312,6 +316,7 @@ - } - } - -+#ifdef ISDN_TTY_FCLASS1 - /* - * Parse AT+F.. FAX class 1 commands - */ -@@ -403,6 +408,7 @@ - } - return 1; - } -+#endif - - /* - * Parse AT+F.. FAX class 2 commands -@@ -970,6 +976,70 @@ - } - return 0; - } -+#if 0 -+ /* LO=n - Flow control opts */ -+ if (!strncmp(p[0], "LO", 2)) { /* TODO */ -+ p[0] += 2; -+ switch (*p[0]) { -+ case '?': -+ p[0]++; -+ sprintf(rs, "\r\n%d", f->lo); -+ isdn_tty_at_cout(rs, info); -+ break; -+ case '=': -+ p[0]++; -+ if (*p[0] == '?') { -+ p[0]++; -+ sprintf(rs, "\r\n0,1,2"); -+ isdn_tty_at_cout(rs, info); -+ } else { -+ par = isdn_getnum(p); -+ if ((par < 0) || (par > 2)) -+ PARSE_ERROR1; -+ f->lo = par; -+#ifdef ISDN_TTY_FAX_STAT_DEBUG -+ printk(KERN_DEBUG "isdn_tty: Fax FLO=%d\n", par); -+#endif -+ } -+ break; -+ default: -+ PARSE_ERROR1; -+ } -+ return 0; -+ } -+#endif -+#if 0 -+ /* LPL=n - Doc for polling cmd */ -+ if (!strncmp(p[0], "LPL", 3)) { /* TODO */ -+ p[0] += 3; -+ switch (*p[0]) { -+ case '?': -+ p[0]++; -+ sprintf(rs, "\r\n%d", f->lpl); -+ isdn_tty_at_cout(rs, info); -+ break; -+ case '=': -+ p[0]++; -+ if (*p[0] == '?') { -+ p[0]++; -+ sprintf(rs, "\r\n0,1"); -+ isdn_tty_at_cout(rs, info); -+ } else { -+ par = isdn_getnum(p); -+ if ((par < 0) || (par > 1)) -+ PARSE_ERROR1; -+ f->lpl = par; -+#ifdef ISDN_TTY_FAX_STAT_DEBUG -+ printk(KERN_DEBUG "isdn_tty: Fax FLPL=%d\n", par); -+#endif -+ } -+ break; -+ default: -+ PARSE_ERROR1; -+ } -+ return 0; -+ } -+#endif - - /* MDL? - DCE Model */ - if (!strncmp(p[0], "MDL?", 4)) { -@@ -1049,6 +1119,38 @@ - } - return 0; - } -+#if 0 -+ /* PTS=n - Page transfer status */ -+ if (!strncmp(p[0], "PTS", 3)) { /* TODO */ -+ p[0] += 3; -+ switch (*p[0]) { -+ case '?': -+ p[0]++; -+ sprintf(rs, "\r\n%d", f->pts); -+ isdn_tty_at_cout(rs, info); -+ break; -+ case '=': -+ p[0]++; -+ if (*p[0] == '?') { -+ p[0]++; -+ sprintf(rs, "\r\n0-5"); -+ isdn_tty_at_cout(rs, info); -+ } else { -+ par = isdn_getnum(p); -+ if ((par < 0) || (par > 5)) -+ PARSE_ERROR1; -+ f->pts = par; -+#ifdef ISDN_TTY_FAX_STAT_DEBUG -+ printk(KERN_DEBUG "isdn_tty: Fax FPTS=%d\n", par); -+#endif -+ } -+ break; -+ default: -+ PARSE_ERROR1; -+ } -+ return 0; -+ } -+#endif - - /* REL=n - Phase C received EOL alignment */ - if (!strncmp(p[0], "REL", 3)) { -@@ -1091,6 +1193,38 @@ - isdn_tty_at_cout(rs, info); - return 0; - } -+#if 0 -+ /* SPL=n - Enable polling */ -+ if (!strncmp(p[0], "SPL", 3)) { /* TODO */ -+ p[0] += 3; -+ switch (*p[0]) { -+ case '?': -+ p[0]++; -+ sprintf(rs, "\r\n%d", f->spl); -+ isdn_tty_at_cout(rs, info); -+ break; -+ case '=': -+ p[0]++; -+ if (*p[0] == '?') { -+ p[0]++; -+ sprintf(rs, "\r\n0,1"); -+ isdn_tty_at_cout(rs, info); -+ } else { -+ par = isdn_getnum(p); -+ if ((par < 0) || (par > 1)) -+ PARSE_ERROR1; -+ f->spl = par; -+#ifdef ISDN_TTY_FAX_STAT_DEBUG -+ printk(KERN_DEBUG "isdn_tty: Fax FSPL=%d\n", par); -+#endif -+ } -+ break; -+ default: -+ PARSE_ERROR1; -+ } -+ return 0; -+ } -+#endif - - /* Phase C Transmit Data Block Size */ - if (!strncmp(p[0], "TBC=", 4)) { /* dummy, not used */ -@@ -1116,7 +1250,9 @@ - { - if (TTY_IS_FCLASS2(info)) - return (isdn_tty_cmd_FCLASS2(p, info)); -+#ifdef ISDN_TTY_FCLASS1 - else if (TTY_IS_FCLASS1(info)) - return (isdn_tty_cmd_FCLASS1(p, info)); -+#endif - PARSE_ERROR1; - } -diff -rNu linux-2.4.29.old/drivers/isdn/isdn_ttyfax.h linux-2.4.29/drivers/isdn/isdn_ttyfax.h ---- linux-2.4.29.old/drivers/isdn/isdn_ttyfax.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdn_ttyfax.h 2005-03-22 15:06:44.576316152 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn_ttyfax.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: isdn_ttyfax.h,v 1.3 2001/09/24 13:22:43 kai Exp $ - * - * header for Linux ISDN subsystem, tty_fax related functions (linklevel). - * -diff -rNu linux-2.4.29.old/drivers/isdn/isdn_v110.c linux-2.4.29/drivers/isdn/isdn_v110.c ---- linux-2.4.29.old/drivers/isdn/isdn_v110.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdn_v110.c 2005-03-22 15:06:44.593313568 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn_v110.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: isdn_v110.c,v 1.8 2001/09/24 13:22:43 kai Exp $ - * - * Linux ISDN subsystem, V.110 related functions (linklevel). - * -@@ -19,7 +19,7 @@ - - #undef ISDN_V110_DEBUG - --char *isdn_v110_revision = "$Revision: 1.1.4.1 $"; -+char *isdn_v110_revision = "$Revision: 1.8 $"; - - #define V110_38400 255 - #define V110_19200 15 -@@ -138,6 +138,14 @@ - return; - #ifdef ISDN_V110_DEBUG - printk(KERN_DEBUG "v110 close\n"); -+#if 0 -+ printk(KERN_DEBUG "isdn_v110_close: nbytes=%d\n", v->nbytes); -+ printk(KERN_DEBUG "isdn_v110_close: nbits=%d\n", v->nbits); -+ printk(KERN_DEBUG "isdn_v110_close: key=%d\n", v->key); -+ printk(KERN_DEBUG "isdn_v110_close: SyncInit=%d\n", v->SyncInit); -+ printk(KERN_DEBUG "isdn_v110:close: decodelen=%d\n", v->decodelen); -+ printk(KERN_DEBUG "isdn_v110_close: framelen=%d\n", v->framelen); -+#endif - #endif - kfree(v->encodebuf); - kfree(v); -diff -rNu linux-2.4.29.old/drivers/isdn/isdn_v110.h linux-2.4.29/drivers/isdn/isdn_v110.h ---- linux-2.4.29.old/drivers/isdn/isdn_v110.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdn_v110.h 2005-03-22 15:06:44.608311288 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn_v110.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: isdn_v110.h,v 1.5 2001/09/24 13:22:43 kai Exp $ - * - * Linux ISDN subsystem, V.110 related functions (linklevel). - * -diff -rNu linux-2.4.29.old/drivers/isdn/isdn_x25iface.c linux-2.4.29/drivers/isdn/isdn_x25iface.c ---- linux-2.4.29.old/drivers/isdn/isdn_x25iface.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdn_x25iface.c 2005-03-22 15:06:44.626308552 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn_x25iface.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: isdn_x25iface.c,v 1.10 2001/09/24 13:22:43 kai Exp $ - * - * Linux ISDN subsystem, X.25 related functions - * -diff -rNu linux-2.4.29.old/drivers/isdn/isdn_x25iface.h linux-2.4.29/drivers/isdn/isdn_x25iface.h ---- linux-2.4.29.old/drivers/isdn/isdn_x25iface.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdn_x25iface.h 2005-03-22 15:06:44.645305664 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn_x25iface.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ -+/* $Id: isdn_x25iface.h,v 1.4 2001/09/24 13:22:43 kai Exp $ - * - * header for Linux ISDN subsystem, x.25 related functions - * -diff -rNu linux-2.4.29.old/drivers/isdn/isdnloop/isdnloop.c linux-2.4.29/drivers/isdn/isdnloop/isdnloop.c ---- linux-2.4.29.old/drivers/isdn/isdnloop/isdnloop.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdnloop/isdnloop.c 2005-03-22 15:06:48.813671976 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdnloop.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id: isdnloop.c,v 1.17 2001/08/30 10:45:42 kai Exp $ - * - * ISDN low-level module implementing a dummy loop driver. - * -@@ -14,7 +14,7 @@ - #include - #include "isdnloop.h" - --static char *revision = "$Revision: 1.1.4.1 $"; -+static char *revision = "$Revision$"; - static char *isdnloop_id; - - MODULE_DESCRIPTION("ISDN4Linux: Pseudo Driver that simulates an ISDN card"); -@@ -22,8 +22,8 @@ - MODULE_LICENSE("GPL"); - MODULE_PARM(isdnloop_id, "s"); - MODULE_PARM_DESC(isdnloop_id, "ID-String of first card"); -- --static int isdnloop_addcard(char *); -+ -+ static int isdnloop_addcard(char *); - - /* - * Free queue completely. -@@ -1542,11 +1542,7 @@ - } else - strcpy(rev, " ??? "); - printk(KERN_NOTICE "isdnloop-ISDN-driver Rev%s\n", rev); -- -- if (isdnloop_id) -- return (isdnloop_addcard(isdnloop_id)); -- -- return 0; -+ return (isdnloop_addcard(isdnloop_id)); - } - - static void __exit -diff -rNu linux-2.4.29.old/drivers/isdn/isdnloop/isdnloop.h linux-2.4.29/drivers/isdn/isdnloop/isdnloop.h ---- linux-2.4.29.old/drivers/isdn/isdnloop/isdnloop.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/isdnloop/isdnloop.h 2005-03-22 15:06:48.834668784 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdnloop.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Loopback lowlevel module for testing of linklevel. - * -diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/callbacks.c linux-2.4.29/drivers/isdn/pcbit/callbacks.c ---- linux-2.4.29.old/drivers/isdn/pcbit/callbacks.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/pcbit/callbacks.c 2005-03-22 15:06:48.909657384 +0100 -@@ -3,7 +3,7 @@ - * - * Copyright (C) 1996 Universidade de Lisboa - * -- * Written by Pedro Roque Marques (pedro_m@yahoo.com) -+ * Written by Pedro Roque Marques (roque@di.fc.ul.pt) - * - * This software may be used and distributed according to the terms of - * the GNU General Public License, incorporated herein by reference. -diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/callbacks.h linux-2.4.29/drivers/isdn/pcbit/callbacks.h ---- linux-2.4.29.old/drivers/isdn/pcbit/callbacks.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/pcbit/callbacks.h 2005-03-22 15:06:48.953650696 +0100 -@@ -3,7 +3,7 @@ - * - * Copyright (C) 1996 Universidade de Lisboa - * -- * Written by Pedro Roque Marques (pedro_m@yahoo.com) -+ * Written by Pedro Roque Marques (roque@di.fc.ul.pt) - * - * This software may be used and distributed according to the terms of - * the GNU General Public License, incorporated herein by reference. -diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/capi.c linux-2.4.29/drivers/isdn/pcbit/capi.c ---- linux-2.4.29.old/drivers/isdn/pcbit/capi.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/pcbit/capi.c 2005-03-22 15:06:49.042637168 +0100 -@@ -4,7 +4,7 @@ - * - * Copyright (C) 1996 Universidade de Lisboa - * -- * Written by Pedro Roque Marques (pedro_m@yahoo.com) -+ * Written by Pedro Roque Marques (roque@di.fc.ul.pt) - * - * This software may be used and distributed according to the terms of - * the GNU General Public License, incorporated herein by reference. -diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/capi.h linux-2.4.29/drivers/isdn/pcbit/capi.h ---- linux-2.4.29.old/drivers/isdn/pcbit/capi.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/pcbit/capi.h 2005-03-22 15:06:49.071632760 +0100 -@@ -3,7 +3,7 @@ - * - * Copyright (C) 1996 Universidade de Lisboa - * -- * Written by Pedro Roque Marques (pedro_m@yahoo.com) -+ * Written by Pedro Roque Marques (roque@di.fc.ul.pt) - * - * This software may be used and distributed according to the terms of - * the GNU General Public License, incorporated herein by reference. -@@ -63,7 +63,8 @@ - extern int capi_decode_debug_188(u_char *hdr, ushort hdrlen); - #endif - --static inline struct pcbit_chan * -+extern __inline__ -+struct pcbit_chan * - capi_channel(struct pcbit_dev *dev, struct sk_buff *skb) - { - ushort callref; -diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/drv.c linux-2.4.29/drivers/isdn/pcbit/drv.c ---- linux-2.4.29.old/drivers/isdn/pcbit/drv.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/pcbit/drv.c 2005-03-22 15:06:49.091629720 +0100 -@@ -3,7 +3,7 @@ - * - * Copyright (C) 1996 Universidade de Lisboa - * -- * Written by Pedro Roque Marques (pedro_m@yahoo.com) -+ * Written by Pedro Roque Marques (roque@di.fc.ul.pt) - * - * This software may be used and distributed according to the terms of - * the GNU General Public License, incorporated herein by reference. -@@ -35,7 +35,9 @@ - #include - #include - #include -+#ifdef COMPAT_HAS_ISA_IOREMAP - #include -+#endif - - #include "pcbit.h" - #include "edss1.h" -@@ -89,6 +91,7 @@ - - if (mem_base >= 0xA0000 && mem_base <= 0xFFFFF ) { - dev->ph_mem = mem_base; -+#ifdef COMPAT_HAS_ISA_IOREMAP - if (check_mem_region(dev->ph_mem, 4096)) { - printk(KERN_WARNING - "PCBIT: memory region %lx-%lx already in use\n", -@@ -100,6 +103,9 @@ - request_mem_region(dev->ph_mem, 4096, "PCBIT mem"); - } - dev->sh_mem = (unsigned char*)ioremap(dev->ph_mem, 4096); -+#else -+ dev->sh_mem = (unsigned char*) mem_base; -+#endif - } - else - { -@@ -112,8 +118,10 @@ - dev->b1 = kmalloc(sizeof(struct pcbit_chan), GFP_KERNEL); - if (!dev->b1) { - printk("pcbit_init: couldn't malloc pcbit_chan struct\n"); -+#ifdef COMPAT_HAS_ISA_IOREMAP - iounmap((unsigned char*)dev->sh_mem); - release_mem_region(dev->ph_mem, 4096); -+#endif - kfree(dev); - return -ENOMEM; - } -@@ -122,8 +130,10 @@ - if (!dev->b2) { - printk("pcbit_init: couldn't malloc pcbit_chan struct\n"); - kfree(dev->b1); -+#ifdef COMPAT_HAS_ISA_IOREMAP - iounmap((unsigned char*)dev->sh_mem); - release_mem_region(dev->ph_mem, 4096); -+#endif - kfree(dev); - return -ENOMEM; - } -@@ -144,8 +154,10 @@ - { - kfree(dev->b1); - kfree(dev->b2); -+#ifdef COMPAT_HAS_ISA_IOREMAP - iounmap((unsigned char*)dev->sh_mem); - release_mem_region(dev->ph_mem, 4096); -+#endif - kfree(dev); - dev_pcbit[board] = NULL; - return -EIO; -@@ -166,8 +178,10 @@ - free_irq(irq, dev); - kfree(dev->b1); - kfree(dev->b2); -+#ifdef COMPAT_HAS_ISA_IOREMAP - iounmap((unsigned char*)dev->sh_mem); - release_mem_region(dev->ph_mem, 4096); -+#endif - kfree(dev); - dev_pcbit[board] = NULL; - return -EIO; -@@ -197,8 +211,10 @@ - free_irq(irq, dev); - kfree(dev->b1); - kfree(dev->b2); -+#ifdef COMPAT_HAS_ISA_IOREMAP - iounmap((unsigned char*)dev->sh_mem); - release_mem_region(dev->ph_mem, 4096); -+#endif - kfree(dev); - dev_pcbit[board] = NULL; - return -EIO; -@@ -235,8 +251,10 @@ - del_timer(&dev->b2->fsm_timer); - kfree(dev->b1); - kfree(dev->b2); -+#ifdef COMPAT_HAS_ISA_IOREMAP - iounmap((unsigned char*)dev->sh_mem); - release_mem_region(dev->ph_mem, 4096); -+#endif - kfree(dev); - } - } -@@ -430,7 +448,7 @@ - switch(dev->l2_state) { - case L2_LWMODE: - /* check (size <= rdp_size); write buf into board */ -- if (len < 0 || len > BANK4 + 1) -+ if (len > BANK4 + 1) - { - printk("pcbit_writecmd: invalid length %d\n", len); - return -EINVAL; -@@ -609,6 +627,20 @@ - dev->b1->s_refnum, - dev->b2->s_refnum); - #endif -+#if 0 -+ if (dev->b1->s_refnum == refnum) -+ chan = dev->b1; -+ else { -+ -+ if (dev->b2->s_refnum == refnum) -+ chan = dev->b2; -+ else { -+ chan = NULL; -+ printk(KERN_WARNING "Connection Confirm - refnum doesn't match chan\n"); -+ break; -+ } -+ } -+#else - /* We just try to find a channel in the right state */ - - if (dev->b1->fsm_state == ST_CALL_INIT) -@@ -622,6 +654,7 @@ - break; - } - } -+#endif - if (capi_decode_conn_conf(chan, skb, &complete)) { - printk(KERN_DEBUG "conn_conf indicates error\n"); - pcbit_fsm_event(dev, chan, EV_ERROR, NULL); -diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/edss1.c linux-2.4.29/drivers/isdn/pcbit/edss1.c ---- linux-2.4.29.old/drivers/isdn/pcbit/edss1.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/pcbit/edss1.c 2005-03-22 15:06:49.119625464 +0100 -@@ -4,7 +4,7 @@ - * - * Copyright (C) 1996 Universidade de Lisboa - * -- * Written by Pedro Roque Marques (pedro_m@yahoo.com) -+ * Written by Pedro Roque Marques (roque@di.fc.ul.pt) - * - * This software may be used and distributed according to the terms of - * the GNU General Public License, incorporated herein by reference. -diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/edss1.h linux-2.4.29/drivers/isdn/pcbit/edss1.h ---- linux-2.4.29.old/drivers/isdn/pcbit/edss1.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/pcbit/edss1.h 2005-03-22 15:06:49.161619080 +0100 -@@ -3,7 +3,7 @@ - * - * Copyright (C) 1996 Universidade de Lisboa - * -- * Written by Pedro Roque Marques (pedro_m@yahoo.com) -+ * Written by Pedro Roque Marques (roque@di.fc.ul.pt) - * - * This software may be used and distributed according to the terms of - * the GNU General Public License, incorporated herein by reference. -diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/layer2.c linux-2.4.29/drivers/isdn/pcbit/layer2.c ---- linux-2.4.29.old/drivers/isdn/pcbit/layer2.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/pcbit/layer2.c 2005-03-22 15:06:49.195613912 +0100 -@@ -3,7 +3,7 @@ - * - * Copyright (C) 1996 Universidade de Lisboa - * -- * Written by Pedro Roque Marques (pedro_m@yahoo.com) -+ * Written by Pedro Roque Marques (roque@di.fc.ul.pt) - * - * This software may be used and distributed according to the terms of - * the GNU General Public License, incorporated herein by reference. -@@ -369,11 +369,16 @@ - - if (dev->read_frame) { - printk(KERN_DEBUG "pcbit_receive: Type 0 frame and read_frame != NULL\n"); -+#if 0 -+ pcbit_l2_error(dev); -+ return; -+#else - /* discard previous queued frame */ - if (dev->read_frame->skb) - kfree_skb(dev->read_frame->skb); - kfree(dev->read_frame); - dev->read_frame = NULL; -+#endif - } - frame = kmalloc(sizeof(struct frame_buf), GFP_ATOMIC); - -@@ -449,10 +454,14 @@ - - if (!(frame = dev->read_frame)) { - printk("Type 1 frame and no frame queued\n"); -+#if 1 - /* usually after an error: toss frame */ - dev->readptr += tt; - if (dev->readptr > dev->sh_mem + BANK2 + BANKLEN) - dev->readptr -= BANKLEN; -+#else -+ pcbit_l2_error(dev); -+#endif - return; - - } -diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/layer2.h linux-2.4.29/drivers/isdn/pcbit/layer2.h ---- linux-2.4.29.old/drivers/isdn/pcbit/layer2.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/pcbit/layer2.h 2005-03-22 15:06:49.228608896 +0100 -@@ -3,7 +3,7 @@ - * - * Copyright (C) 1996 Universidade de Lisboa - * -- * Written by Pedro Roque Marques (pedro_m@yahoo.com) -+ * Written by Pedro Roque Marques (roque@di.fc.ul.pt) - * - * This software may be used and distributed according to the terms of - * the GNU General Public License, incorporated herein by reference. -diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/module.c linux-2.4.29/drivers/isdn/pcbit/module.c ---- linux-2.4.29.old/drivers/isdn/pcbit/module.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/pcbit/module.c 2005-03-22 15:06:49.251605400 +0100 -@@ -3,7 +3,7 @@ - * - * Copyright (C) 1996 Universidade de Lisboa - * -- * Written by Pedro Roque Marques (pedro_m@yahoo.com) -+ * Written by Pedro Roque Marques (roque@di.fc.ul.pt) - * - * This software may be used and distributed according to the terms of - * the GNU General Public License, incorporated herein by reference. -@@ -92,6 +92,7 @@ - } - - #ifndef MODULE -+#ifdef COMPAT_HAS_NEW_SETUP - #define MAX_PARA (MAX_PCBIT_CARDS * 2) - static int __init pcbit_setup(char *line) - { -@@ -100,6 +101,11 @@ - int ints[MAX_PARA+1]; - - str = get_options(line, MAX_PARA, ints); -+#else -+void pcbit_setup(char *str, int *ints) -+{ -+ int i, j, argc; -+#endif - argc = ints[0]; - i = 0; - j = 1; -@@ -118,9 +124,13 @@ - - i++; - } -+#ifdef COMPAT_HAS_NEW_SETUP - return(1); - } - __setup("pcbit=", pcbit_setup); -+#else -+} -+#endif - #endif - - module_init(pcbit_init); -diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/pcbit.h linux-2.4.29/drivers/isdn/pcbit/pcbit.h ---- linux-2.4.29.old/drivers/isdn/pcbit/pcbit.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/pcbit/pcbit.h 2005-03-22 15:06:49.284600384 +0100 -@@ -3,7 +3,7 @@ - * - * Copyright (C) 1996 Universidade de Lisboa - * -- * Written by Pedro Roque Marques (pedro_m@yahoo.com) -+ * Written by Pedro Roque Marques (roque@di.fc.ul.pt) - * - * This software may be used and distributed according to the terms of - * the GNU General Public License, incorporated herein by reference. -diff -rNu linux-2.4.29.old/drivers/isdn/sc/card.h linux-2.4.29/drivers/isdn/sc/card.h ---- linux-2.4.29.old/drivers/isdn/sc/card.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/sc/card.h 2005-03-22 15:06:49.333592936 +0100 -@@ -1,4 +1,4 @@ --/* $Id: card.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Driver parameters for SpellCaster ISA ISDN adapters - * -diff -rNu linux-2.4.29.old/drivers/isdn/sc/command.c linux-2.4.29/drivers/isdn/sc/command.c ---- linux-2.4.29.old/drivers/isdn/sc/command.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/sc/command.c 2005-03-22 15:06:49.348590656 +0100 -@@ -1,4 +1,4 @@ --/* $Id: command.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Copyright (C) 1996 SpellCaster Telecommunications Inc. - * -@@ -95,7 +95,7 @@ - if(adapter[i]->driverId == driver) - return i; - } -- return -ENODEV; -+ return -NODEV; - } - - /* -diff -rNu linux-2.4.29.old/drivers/isdn/sc/debug.c linux-2.4.29/drivers/isdn/sc/debug.c ---- linux-2.4.29.old/drivers/isdn/sc/debug.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/sc/debug.c 2005-03-22 15:06:49.363588376 +0100 -@@ -1,4 +1,4 @@ --/* $Id: debug.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Copyright (C) 1996 SpellCaster Telecommunications Inc. - * -diff -rNu linux-2.4.29.old/drivers/isdn/sc/debug.h linux-2.4.29/drivers/isdn/sc/debug.h ---- linux-2.4.29.old/drivers/isdn/sc/debug.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/sc/debug.h 2005-03-22 15:06:49.378586096 +0100 -@@ -1,4 +1,4 @@ --/* $Id: debug.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Copyright (C) 1996 SpellCaster Telecommunications Inc. - * -diff -rNu linux-2.4.29.old/drivers/isdn/sc/event.c linux-2.4.29/drivers/isdn/sc/event.c ---- linux-2.4.29.old/drivers/isdn/sc/event.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/sc/event.c 2005-03-22 15:06:49.394583664 +0100 -@@ -1,4 +1,4 @@ --/* $Id: event.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Copyright (C) 1996 SpellCaster Telecommunications Inc. - * -diff -rNu linux-2.4.29.old/drivers/isdn/sc/init.c linux-2.4.29/drivers/isdn/sc/init.c ---- linux-2.4.29.old/drivers/isdn/sc/init.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/sc/init.c 2005-03-22 15:06:49.432577888 +0100 -@@ -514,6 +514,15 @@ - schedule_timeout(HZ); - sig = readl(rambase + SIG_OFFSET); - pr_debug("Looking for a signature, got 0x%x\n", sig); -+#if 0 -+/* -+ * For Gary: -+ * If it's a timing problem, it should be gone with the above schedule() -+ * Another possible reason may be the missing volatile in the original -+ * code. readl() does this for us. -+ */ -+ printk(""); /* Hack! Doesn't work without this !!!??? */ -+#endif - if(sig == SIGNATURE) - return PRI_BOARD; - -@@ -525,6 +534,9 @@ - schedule_timeout(HZ); - sig = readl(rambase + SIG_OFFSET); - pr_debug("Looking for a signature, got 0x%x\n", sig); -+#if 0 -+ printk(""); /* Hack! Doesn't work without this !!!??? */ -+#endif - if(sig == SIGNATURE) - return BRI_BOARD; - -diff -rNu linux-2.4.29.old/drivers/isdn/sc/interrupt.c linux-2.4.29/drivers/isdn/sc/interrupt.c ---- linux-2.4.29.old/drivers/isdn/sc/interrupt.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/sc/interrupt.c 2005-03-22 15:06:49.447575608 +0100 -@@ -1,4 +1,4 @@ --/* $Id: interrupt.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Copyright (C) 1996 SpellCaster Telecommunications Inc. - * -diff -rNu linux-2.4.29.old/drivers/isdn/sc/ioctl.c linux-2.4.29/drivers/isdn/sc/ioctl.c ---- linux-2.4.29.old/drivers/isdn/sc/ioctl.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/sc/ioctl.c 2005-03-22 15:06:49.463573176 +0100 -@@ -23,6 +23,9 @@ - - extern board *adapter[]; - -+#if 0 -+static char *ChannelStates[] = { "Idle", "Ready", "Connecting", "Connected", "Disconnecting" }; -+#endif - - int GetStatus(int card, boardInfo *); - -diff -rNu linux-2.4.29.old/drivers/isdn/sc/message.c linux-2.4.29/drivers/isdn/sc/message.c ---- linux-2.4.29.old/drivers/isdn/sc/message.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/sc/message.c 2005-03-22 15:06:49.478570896 +0100 -@@ -1,4 +1,4 @@ --/* $Id: message.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * functions for sending and receiving control messages - * -diff -rNu linux-2.4.29.old/drivers/isdn/sc/message.h linux-2.4.29/drivers/isdn/sc/message.h ---- linux-2.4.29.old/drivers/isdn/sc/message.h 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/sc/message.h 2005-03-22 15:06:49.495568312 +0100 -@@ -1,4 +1,4 @@ --/* $Id: message.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Copyright (C) 1996 SpellCaster Telecommunications Inc. - * -diff -rNu linux-2.4.29.old/drivers/isdn/sc/packet.c linux-2.4.29/drivers/isdn/sc/packet.c ---- linux-2.4.29.old/drivers/isdn/sc/packet.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/sc/packet.c 2005-03-22 15:06:49.514565424 +0100 -@@ -1,4 +1,4 @@ --/* $Id: packet.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Copyright (C) 1996 SpellCaster Telecommunications Inc. - * -diff -rNu linux-2.4.29.old/drivers/isdn/sc/shmem.c linux-2.4.29/drivers/isdn/sc/shmem.c ---- linux-2.4.29.old/drivers/isdn/sc/shmem.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/sc/shmem.c 2005-03-22 15:06:49.560558432 +0100 -@@ -1,4 +1,4 @@ --/* $Id: shmem.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Copyright (C) 1996 SpellCaster Telecommunications Inc. - * -diff -rNu linux-2.4.29.old/drivers/isdn/sc/timer.c linux-2.4.29/drivers/isdn/sc/timer.c ---- linux-2.4.29.old/drivers/isdn/sc/timer.c 2005-03-22 14:47:56.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/sc/timer.c 2005-03-22 15:06:49.575556152 +0100 -@@ -1,4 +1,4 @@ --/* $Id: timer.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Copyright (C) 1996 SpellCaster Telecommunications Inc. - * -diff -rNu linux-2.4.29.old/drivers/isdn/tpam/tpam.h linux-2.4.29/drivers/isdn/tpam/tpam.h ---- linux-2.4.29.old/drivers/isdn/tpam/tpam.h 2005-03-22 14:47:57.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/tpam/tpam.h 2005-03-22 15:06:49.648545056 +0100 -@@ -1,4 +1,4 @@ --/* $Id: tpam.h,v 1.1.2.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id: tpam.h,v 1.3 2001/09/24 13:23:12 kai Exp $ - * - * Turbo PAM ISDN driver for Linux. (Kernel Driver) - * -diff -rNu linux-2.4.29.old/drivers/isdn/tpam/tpam_commands.c linux-2.4.29/drivers/isdn/tpam/tpam_commands.c ---- linux-2.4.29.old/drivers/isdn/tpam/tpam_commands.c 2005-03-22 14:47:57.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/tpam/tpam_commands.c 2005-03-22 15:06:49.664542624 +0100 -@@ -1,4 +1,4 @@ --/* $Id: tpam_commands.c,v 1.1.2.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id: tpam_commands.c,v 1.3 2001/09/24 13:23:12 kai Exp $ - * - * Turbo PAM ISDN driver for Linux. (Kernel Driver - ISDN commands) - * -diff -rNu linux-2.4.29.old/drivers/isdn/tpam/tpam_crcpc.c linux-2.4.29/drivers/isdn/tpam/tpam_crcpc.c ---- linux-2.4.29.old/drivers/isdn/tpam/tpam_crcpc.c 2005-03-22 14:47:57.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/tpam/tpam_crcpc.c 2005-03-22 15:06:49.681540040 +0100 -@@ -1,4 +1,4 @@ --/* $Id: tpam_crcpc.c,v 1.1.2.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Turbo PAM ISDN driver for Linux. (Kernel Driver - CRC encoding) - * -diff -rNu linux-2.4.29.old/drivers/isdn/tpam/tpam_hdlc.c linux-2.4.29/drivers/isdn/tpam/tpam_hdlc.c ---- linux-2.4.29.old/drivers/isdn/tpam/tpam_hdlc.c 2005-03-22 14:47:57.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/tpam/tpam_hdlc.c 2005-03-22 15:06:49.702536848 +0100 -@@ -1,4 +1,4 @@ --/* $Id: tpam_hdlc.c,v 1.1.2.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id: tpam_hdlc.c,v 1.3 2001/09/24 13:23:12 kai Exp $ - * - * Turbo PAM ISDN driver for Linux. (Kernel Driver - HDLC encoding) - * -diff -rNu linux-2.4.29.old/drivers/isdn/tpam/tpam_main.c linux-2.4.29/drivers/isdn/tpam/tpam_main.c ---- linux-2.4.29.old/drivers/isdn/tpam/tpam_main.c 2005-03-22 14:47:57.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/tpam/tpam_main.c 2005-03-22 15:06:49.717534568 +0100 -@@ -1,4 +1,4 @@ --/* $Id: tpam_main.c,v 1.1.2.2 2001/12/09 18:45:14 kai Exp $ -+/* $Id$ - * - * Turbo PAM ISDN driver for Linux. (Kernel Driver - main routines) - * -@@ -254,7 +254,7 @@ - name: "tpam", - id_table: tpam_pci_tbl, - probe: tpam_probe, -- remove: __devexit_p(tpam_remove), -+ remove: tpam_remove, - }; - - static int __init tpam_init(void) { -diff -rNu linux-2.4.29.old/drivers/isdn/tpam/tpam_memory.c linux-2.4.29/drivers/isdn/tpam/tpam_memory.c ---- linux-2.4.29.old/drivers/isdn/tpam/tpam_memory.c 2005-03-22 14:47:57.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/tpam/tpam_memory.c 2005-03-22 15:06:49.734531984 +0100 -@@ -1,4 +1,4 @@ --/* $Id: tpam_memory.c,v 1.1.2.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Turbo PAM ISDN driver for Linux. (Kernel Driver - Board Memory Access) - * -diff -rNu linux-2.4.29.old/drivers/isdn/tpam/tpam_nco.c linux-2.4.29/drivers/isdn/tpam/tpam_nco.c ---- linux-2.4.29.old/drivers/isdn/tpam/tpam_nco.c 2005-03-22 14:47:57.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/tpam/tpam_nco.c 2005-03-22 15:06:49.749529704 +0100 -@@ -1,4 +1,4 @@ --/* $Id: tpam_nco.c,v 1.1.2.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Turbo PAM ISDN driver for Linux. - * (Kernel Driver - Low Level NCO Manipulation) -diff -rNu linux-2.4.29.old/drivers/isdn/tpam/tpam_queues.c linux-2.4.29/drivers/isdn/tpam/tpam_queues.c ---- linux-2.4.29.old/drivers/isdn/tpam/tpam_queues.c 2005-03-22 14:47:57.000000000 +0100 -+++ linux-2.4.29/drivers/isdn/tpam/tpam_queues.c 2005-03-22 15:06:49.764527424 +0100 -@@ -1,4 +1,4 @@ --/* $Id: tpam_queues.c,v 1.1.2.1 2001/11/20 14:19:37 kai Exp $ -+/* $Id$ - * - * Turbo PAM ISDN driver for Linux. (Kernel Driver) - * -@@ -146,7 +146,6 @@ - do { - hpic = readl(card->bar0 + TPAM_HPIC_REGISTER); - if (waiting_too_long++ > 0xfffffff) { -- kfree_skb(skb); - spin_unlock(&card->lock); - printk(KERN_ERR "TurboPAM(tpam_irq): " - "waiting too long...\n"); -diff -rNu linux-2.4.29.old/include/linux/b1lli.h linux-2.4.29/include/linux/b1lli.h ---- linux-2.4.29.old/include/linux/b1lli.h 2005-03-22 14:47:32.000000000 +0100 -+++ linux-2.4.29/include/linux/b1lli.h 2005-03-22 15:06:49.881509640 +0100 -@@ -1,4 +1,4 @@ --/* $Id: b1lli.h,v 1.8.8.3 2001/09/23 22:25:05 kai Exp $ -+/* $Id$ - * - * ISDN lowlevel-module for AVM B1-card. - * -diff -rNu linux-2.4.29.old/include/linux/b1pcmcia.h linux-2.4.29/include/linux/b1pcmcia.h ---- linux-2.4.29.old/include/linux/b1pcmcia.h 2005-03-22 14:47:32.000000000 +0100 -+++ linux-2.4.29/include/linux/b1pcmcia.h 2005-03-22 15:06:49.862512528 +0100 -@@ -1,4 +1,4 @@ --/* $Id: b1pcmcia.h,v 1.1.8.2 2001/09/23 22:25:05 kai Exp $ -+/* $Id$ - * - * Exported functions of module b1pcmcia to be called by - * avm_cs card services module. -diff -rNu linux-2.4.29.old/include/linux/capi.h linux-2.4.29/include/linux/capi.h ---- linux-2.4.29.old/include/linux/capi.h 2005-03-22 14:47:32.000000000 +0100 -+++ linux-2.4.29/include/linux/capi.h 2005-03-22 15:06:49.922503408 +0100 -@@ -1,4 +1,4 @@ --/* $Id: capi.h,v 1.1.4.1 2001/11/20 14:19:38 kai Exp $ -+/* $Id$ - * - * CAPI 2.0 Interface for Linux - * -diff -rNu linux-2.4.29.old/include/linux/concap.h linux-2.4.29/include/linux/concap.h ---- linux-2.4.29.old/include/linux/concap.h 2005-03-22 14:47:32.000000000 +0100 -+++ linux-2.4.29/include/linux/concap.h 2005-03-22 15:06:49.906505840 +0100 -@@ -1,4 +1,4 @@ --/* $Id: concap.h,v 1.2.8.1 2001/09/23 22:25:05 kai Exp $ -+/* $Id: concap.h,v 1.3 2001/09/24 13:23:13 kai Exp $ - * - * Copyright 1997 by Henner Eisen - * -@@ -11,6 +11,7 @@ - #ifdef __KERNEL__ - #include - #include -+#include - - /* Stuff to support encapsulation protocols genericly. The encapsulation - protocol is processed at the uppermost layer of the network interface. -diff -rNu linux-2.4.29.old/include/linux/hysdn_if.h linux-2.4.29/include/linux/hysdn_if.h ---- linux-2.4.29.old/include/linux/hysdn_if.h 2005-03-22 14:47:32.000000000 +0100 -+++ linux-2.4.29/include/linux/hysdn_if.h 2005-03-22 15:06:49.974495504 +0100 -@@ -1,4 +1,4 @@ --/* $Id: hysdn_if.h,v 1.1.8.3 2001/09/23 22:25:05 kai Exp $ -+/* $Id$ - * - * Linux driver for HYSDN cards - * ioctl definitions shared by hynetmgr and driver. -diff -rNu linux-2.4.29.old/include/linux/isdn/tpam.h linux-2.4.29/include/linux/isdn/tpam.h ---- linux-2.4.29.old/include/linux/isdn/tpam.h 2005-03-22 14:47:32.000000000 +0100 -+++ linux-2.4.29/include/linux/isdn/tpam.h 2005-03-22 15:06:49.947499608 +0100 -@@ -1,4 +1,4 @@ --/* $Id: tpam.h,v 1.1.2.1 2001/11/20 14:19:38 kai Exp $ -+/* $Id$ - * - * Turbo PAM ISDN driver for Linux. (Kernel Driver) - * -diff -rNu linux-2.4.29.old/include/linux/isdn.h linux-2.4.29/include/linux/isdn.h ---- linux-2.4.29.old/include/linux/isdn.h 2005-03-22 14:47:31.000000000 +0100 -+++ linux-2.4.29/include/linux/isdn.h 2005-03-22 15:06:50.001491400 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn.h,v 1.1.4.1 2001/11/20 14:19:38 kai Exp $ -+/* $Id: isdn.h,v 1.125 2001/12/01 23:18:21 detabc Exp $ - * - * Main header for the Linux ISDN subsystem (linklevel). - * -@@ -14,6 +14,7 @@ - #ifndef __ISDN_H__ - #define __ISDN_H__ - -+#include - #include - - #ifdef CONFIG_COBALT_MICRO_SERVER -@@ -93,9 +94,15 @@ - #define ISDN_LMSNLEN 255 /* Length of tty's Listen-MSN string */ - #define ISDN_CMSGLEN 50 /* Length of CONNECT-Message to add for Modem */ - -+#ifdef BIG_PHONE_NUMBERS - #define ISDN_MSNLEN 32 - #define NET_DV 0x06 /* Data version for isdn_net_ioctl_cfg */ - #define TTY_DV 0x06 /* Data version for iprofd etc. */ -+#else -+#define ISDN_MSNLEN 20 -+#define NET_DV 0x05 /* Data version for isdn_net_ioctl_cfg */ -+#define TTY_DV 0x05 /* Data version for iprofd etc. */ -+#endif - - #define INF_DV 0x01 /* Data version for /dev/isdninfo */ - -@@ -187,6 +194,61 @@ - #define ISDN_MINOR_PPPMAX (128 + (ISDN_MAX_CHANNELS-1)) - #define ISDN_MINOR_STATUS 255 - -+#ifndef CONFIG_ISDN_WITH_ABC -+#undef CONFIG_ISDN_WITH_ABC_CALLB -+#undef CONFIG_ISDN_WITH_ABC_UDP_CHECK -+#undef CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP -+#undef CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL -+#undef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ -+#undef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT -+#undef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER -+#undef CONFIG_ISDN_WITH_ABC_CH_EXTINUSE -+#undef CONFIG_ISDN_WITH_ABC_CONN_ERROR -+#undef CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS -+#else /* CONFIG_ISDN_WITH_ABC */ -+#include -+ -+ -+typedef struct DWABCJIFFIES { -+ -+ u_long msec_1000; -+ u_long msec_500; -+ u_long msec_400; -+ u_long msec_200; -+ u_long msec_100; -+ -+} DWABCJIFFIES; -+ -+ -+#ifdef CONFIG_ISDN_WITH_ABC_NEED_DWSJIFFIES -+DWABCJIFFIES isdn_dwabc_jiffies; -+#else -+extern DWABCJIFFIES isdn_dwabc_jiffies; -+#endif -+#define dwsjiffies (isdn_dwabc_jiffies.msec_1000) -+ -+#define ISDN_DW_ABC_FLAG_UNUSED00001 0x00000001L -+#define ISDN_DW_ABC_FLAG_NO_UDP_CHECK 0x00000002L -+#define ISDN_DW_ABC_FLAG_NO_UDP_HANGUP 0x00000004L -+#define ISDN_DW_ABC_FLAG_NO_UDP_DIAL 0x00000008L -+#define ISDN_DW_ABC_FLAG_UNUSED00010 0x00000010L -+#define ISDN_DW_ABC_FLAG_RCV_NO_HUPTIMER 0x00000020L -+#define ISDN_DW_ABC_FLAG_NO_CH_EXTINUSE 0x00000040L -+#define ISDN_DW_ABC_FLAG_NO_CONN_ERROR 0x00000080L -+#define ISDN_DW_ABC_FLAG_BSD_COMPRESS 0x00000100L -+#define ISDN_DW_ABC_FLAG_NO_LCR 0x00000200L -+#define ISDN_DW_ABC_FLAG_LEASED_LINE 0x00001000L -+ -+#define ISDN_DW_ABC_IFFLAG_NODCHAN 0x00000001L -+#define ISDN_DW_ABC_IFFLAG_BSDAKTIV 0x00000002L -+ -+#define ISDN_DW_ABC_BITLOCK_SEND 0 -+#define ISDN_DW_ABC_BITLOCK_RECEIVE 1 -+ -+#endif /* CONFIG_ISDN_WITH_ABC */ -+ -+ -+ - #ifdef CONFIG_ISDN_PPP - - #ifdef CONFIG_ISDN_PPP_VJ -@@ -204,9 +266,11 @@ - # include - #endif - -+#ifdef HAVE_DEVFS_FS - #ifdef CONFIG_DEVFS_FS - # include - #endif -+#endif /* HAVE_DEVFS_FS */ - - #include - -@@ -272,6 +336,12 @@ - #define ISDN_NET_CALLBACK 0x04 /* activate callback */ - #define ISDN_NET_CBHUP 0x08 /* hangup before callback */ - #define ISDN_NET_CBOUT 0x10 /* remote machine does callback */ -+#if 0 -+/* Unused??? */ -+#define ISDN_NET_CLONE 0x08 /* clone a tmp interface when called */ -+#define ISDN_NET_TMP 0x10 /* tmp interface until getting an IP */ -+#define ISDN_NET_DYNAMIC 0x20 /* this link is dynamically allocated */ -+#endif - - #define ISDN_NET_MAGIC 0x49344C02 /* for paranoia-checking */ - -@@ -386,6 +456,38 @@ - char cisco_debserint; /* debugging flag of cisco hdlc with slarp */ - struct timer_list cisco_timer; - struct tq_struct tqueue; -+#ifdef CONFIG_ISDN_WITH_ABC -+ ulong dw_abc_flags; -+ ulong dw_abc_if_flags; -+ int dw_abc_inuse_secure; -+ ulong dw_abc_dialstart; -+ int dw_abc_old_onhtime; -+ int dw_abc_remote_version; -+ int dw_abc_bitlocks; -+#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ -+ char dw_out_msn[ISDN_MSNLEN]; /* eaz for outgoing call if *out_msn != 0 */ -+#endif -+#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT -+ ulong dw_abc_lcr_callid; -+ ulong dw_abc_lcr_start_request; -+ ulong dw_abc_lcr_end_request; -+ isdn_ctrl *dw_abc_lcr_cmd; -+ struct ISDN_DWABC_LCR_IOCTL *dw_abc_lcr_io; -+#endif -+ ulong dw_abc_bchan_last_connect; -+#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR -+ short dw_abc_bchan_errcnt; -+#endif -+#ifdef CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS -+ void *dw_abc_bsd_compressor; -+ void *dw_abc_bsd_stat_rx; -+ void *dw_abc_bsd_stat_tx; -+#endif -+ ulong dw_abc_bsd_snd; -+ ulong dw_abc_bsd_bsd_snd; -+ ulong dw_abc_bsd_rcv; -+ ulong dw_abc_bsd_bsd_rcv; -+#endif - } isdn_net_local; - - /* the interface itself */ -@@ -608,12 +710,13 @@ - int tflags; /* Timer-Flags: */ - /* see ISDN_TIMER_..defines */ - int global_flags; -- infostruct *infochain; /* List of open info-devs. */ -- wait_queue_head_t info_waitq; /* Wait-Queue for isdninfo */ - struct timer_list timer; /* Misc.-function Timer */ - int chanmap[ISDN_MAX_CHANNELS];/* Map minor->device-channel */ - int drvmap[ISDN_MAX_CHANNELS]; /* Map minor->driver-index */ - int usage[ISDN_MAX_CHANNELS]; /* Used by tty/ip/voice */ -+#ifdef CONFIG_ISDN_WITH_ABC_CH_EXTINUSE -+ ulong dwabc_chan_external_inuse[ISDN_MAX_CHANNELS]; -+#endif - char num[ISDN_MAX_CHANNELS][ISDN_MSNLEN]; - /* Remote number of active ch.*/ - int m_idx[ISDN_MAX_CHANNELS]; /* Index for mdm.... */ -@@ -631,6 +734,7 @@ - isdn_v110_stream *v110[ISDN_MAX_CHANNELS]; /* V.110 private data */ - struct semaphore sem; /* serialize list access*/ - unsigned long global_features; -+#ifdef HAVE_DEVFS_FS - #ifdef CONFIG_DEVFS_FS - devfs_handle_t devfs_handle_isdninfo; - devfs_handle_t devfs_handle_isdnctrl; -@@ -640,10 +744,41 @@ - devfs_handle_t devfs_handle_ipppX[ISDN_MAX_CHANNELS]; - #endif - #endif /* CONFIG_DEVFS_FS */ -+#endif /* HAVE_DEVFS_FS */ - } isdn_dev; - - extern isdn_dev *dev; - -+#ifdef CONFIG_ISDN_WITH_ABC -+extern int isdn_auto_dial_helper(isdn_net_local *,struct sk_buff *,int); -+extern void dwisdn_nfw_send(isdn_net_local *lp,int drop_only); -+extern void isdn_net_unreachable(struct net_device *,struct sk_buff *,char *); -+extern void isdn_net_log_skb_dwabc(struct sk_buff *,isdn_net_local *,char *); -+extern void isdn_net_hangup(struct net_device *d); -+extern void isdn_dw_clear_if(ulong pm,isdn_net_local *); -+extern void isdn_dwabc_test_phone(isdn_net_local *); -+extern void isdn_dw_abc_init_func(void); -+extern void isdn_dw_abc_release_func(void); -+extern int isdn_dw_abc_reset_interface(isdn_net_local *,int); -+extern int dwabc_bsd_init(isdn_net_local *lp); -+extern void dwabc_bsd_free(isdn_net_local *lp); -+extern struct sk_buff *dwabc_bsd_compress(isdn_net_local *,struct sk_buff *,struct net_device *); -+extern void dwabc_bsd_first_gen(isdn_net_local *); -+extern struct sk_buff *dwabc_bsd_rx_pkt(isdn_net_local *,struct sk_buff *,struct net_device *); -+#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT -+extern size_t isdn_dw_abc_lcr_readstat(char *,size_t); -+extern ulong isdn_dw_abc_lcr_call_number(isdn_net_local *,isdn_ctrl *); -+extern void isdn_dw_abc_lcr_open(void); -+extern void isdn_dw_abc_lcr_close(void); -+extern int isdn_dw_abc_lcr_ioctl(ulong); -+extern void isdn_dw_abc_lcr_clear(isdn_net_local *); -+extern int isdn_dw_abc_lcr_lock(void); -+extern void isdn_dw_abc_lcr_ulock(void); -+#endif -+#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK -+extern int dw_abc_udp_test(struct sk_buff *skb,struct net_device *ndev); -+#endif -+#endif - - #endif /* __KERNEL__ */ - -diff -rNu linux-2.4.29.old/include/linux/isdn_compat.h linux-2.4.29/include/linux/isdn_compat.h ---- linux-2.4.29.old/include/linux/isdn_compat.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/include/linux/isdn_compat.h 2005-03-22 15:06:50.017488968 +0100 -@@ -0,0 +1,261 @@ -+/* $Id: isdn_compat.h,v 1.53 2001/09/24 13:23:13 kai Exp $ -+ * -+ * Linux ISDN subsystem -+ * Compatibility for various Linux kernel versions -+ * -+ * This software may be used and distributed according to the terms -+ * of the GNU General Public License, incorporated herein by reference. -+ * -+ */ -+ -+#ifndef _LINUX_ISDN_COMPAT_H -+#define _LINUX_ISDN_COMPAT_H -+ -+#ifdef __KERNEL__ -+ -+#ifndef ISDN_COMPAT_NOT_GENERIC -+/* when using std2kern -u, this part is left out and instead provided -+ by the .ctrl files */ -+ -+#include -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18) -+ -+#define set_current_state(sta) (current->state = sta) -+#define module_init(x) int init_module(void) { return x(); } -+#define module_exit(x) void cleanup_module(void) { x(); } -+#define BUG() do { printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); *(int *)0 = 0; } while (0) -+#define init_MUTEX(x) *(x)=MUTEX -+#define init_MUTEX_LOCKED(x) *(x)=MUTEX_LOCKED -+#define __devinit -+#define __devinitdata -+ -+#else /* 2.2.18 and later */ -+ -+#define COMPAT_HAS_NEW_SETUP -+#define COMPAT_HAS_NEW_WAITQ -+ -+#endif -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) -+ -+#define dev_kfree_skb_irq(a) dev_kfree_skb(a) -+#define dev_kfree_skb_any(a) dev_kfree_skb(a) -+#define COMPAT_HAS_2_2_PCI -+#define get_pcibase(ps, nr) ps->base_address[nr] -+#define pci_resource_start_io(pdev, nr) ((pdev)->base_address[nr] & PCI_BASE_ADDRESS_IO_MASK) -+#define pci_resource_start_mem(pdev, nr) ((pdev)->base_address[nr] & PCI_BASE_ADDRESS_MEM_MASK) -+#define pci_get_sub_vendor(pdev, id) pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &id) -+#define pci_get_sub_system(pdev, id) pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &id) -+ -+#define __exit -+#define __devinit -+#define __devinitdata -+ -+#define net_device device -+#define COMPAT_NO_SOFTNET -+#define netif_running(d) test_bit(LINK_STATE_START, &d->state) -+#define COMPAT_NEED_MPPP_DEFS -+#define spin_lock_bh(lock) -+#define spin_unlock_bh(lock) -+#define COMPAT_NEED_SPIN_LOCK_BH -+#define i_count_read(ic) ic -+#define i_count_inc(ic) ic++ -+#define COMPAT_USE_MODCOUNT_LOCK -+#define devfs_register_chrdev(m,n,f) register_chrdev(m,n,f) -+#define devfs_unregister_chrdev(m,n) unregister_chrdev(m,n) -+#define COMPAT_NEED_PCI_IDS -+#define in_irq() (local_irq_count[smp_processor_id()] != 0) -+ -+#else /* 2.4.0 and later */ -+ -+#define pci_resource_start_io(pdev, nr) pci_resource_start(pdev, nr) -+#define pci_resource_start_mem(pdev, nr) pci_resource_start(pdev, nr) -+#define get_pcibase(ps, nr) ps->resource[nr].start -+#define pci_get_sub_system(pdev, id) id = pdev->subsystem_device -+#define pci_get_sub_vendor(pdev, id) id = pdev->subsystem_vendor -+ -+#define BIG_PHONE_NUMBERS -+#define COMPAT_HAS_ISA_IOREMAP -+#define i_count_read(ic) atomic_read(&ic) -+#define i_count_inc(ic) atomic_inc(&ic) -+#define COMPAT_HAS_FILEOP_OWNER -+#define COMPAT_HAVE_NEW_FILLDIR -+#define COMPAT_has_fileops_in_inode -+#define COMPAT_HAS_init_special_inode -+#define COMPAT_d_alloc_root_one_parameter -+#define HAVE_DEVFS_FS -+#define COMPAT_HAS_SCHEDULE_TASK -+#define COMPAT_HAS_USB_IDTAB -+ -+#endif -+ -+#endif /* ISDN_COMPAT_GENERIC */ -+ -+#ifdef COMPAT_HAS_2_2_PCI -+#include -+#ifdef __powerpc__ -+static inline int pci_enable_device(struct pci_dev *dev) -+{ -+ u16 cmd; -+ pci_read_config_word(dev, PCI_COMMAND, &cmd); -+ cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_IO | PCI_COMMAND_SERR; -+ cmd &= ~PCI_COMMAND_FAST_BACK; -+ pci_write_config_word(dev, PCI_COMMAND, cmd); -+ return(0); -+} -+#else -+static inline int pci_enable_device(struct pci_dev *dev) -+{ -+ return 0; -+} -+#endif /* __powerpc__ */ -+ -+#define PCI_ANY_ID (~0) -+ -+/* as this is included multiple times, we make it inline */ -+ -+static inline struct pci_dev * pci_find_subsys(unsigned int vendor, unsigned int device, -+ unsigned int ss_vendor, unsigned int ss_device, -+ struct pci_dev *from) -+{ -+ unsigned short subsystem_vendor, subsystem_device; -+ -+ while ((from = pci_find_device(vendor, device, from))) { -+ pci_read_config_word(from, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vendor); -+ pci_read_config_word(from, PCI_SUBSYSTEM_ID, &subsystem_device); -+ if ((ss_vendor == PCI_ANY_ID || subsystem_vendor == ss_vendor) && -+ (ss_device == PCI_ANY_ID || subsystem_device == ss_device)) -+ return from; -+ } -+ return NULL; -+} -+#endif -+ -+#ifdef COMPAT_NO_SOFTNET -+#include -+ -+/* -+ * Tell upper layers that the network device is ready to xmit more frames. -+ */ -+static void __inline__ netif_wake_queue(struct net_device * dev) -+{ -+ dev->tbusy = 0; -+ mark_bh(NET_BH); -+} -+ -+/* -+ * called during net_device open() -+ */ -+static void __inline__ netif_start_queue(struct net_device * dev) -+{ -+ dev->tbusy = 0; -+ /* actually, we never use the interrupt flag at all */ -+ dev->interrupt = 0; -+ dev->start = 1; -+} -+ -+/* -+ * Ask upper layers to temporarily cease passing us more xmit frames. -+ */ -+static void __inline__ netif_stop_queue(struct net_device * dev) -+{ -+ dev->tbusy = 1; -+} -+ -+#endif /* COMPAT_NO_SOFTNET */ -+ -+#ifndef COMPAT_HAS_NEW_WAITQ -+typedef struct wait_queue wait_queue_t; -+typedef struct wait_queue *wait_queue_head_t; -+ -+#define DECLARE_WAITQUEUE(wait, current) struct wait_queue wait = { current, NULL } -+#define DECLARE_WAIT_QUEUE_HEAD(wait) wait_queue_head_t wait -+#define init_waitqueue_head(x) *(x)=NULL -+#define init_waitqueue_entry(q,p) ((q)->task)=(p) -+#endif /* COMPAT_HAS_NEW_WAITQ */ -+ -+#ifdef COMPAT_NEED_PCI_IDS -+ -+#define PCI_ANY_ID (~0) -+ -+#define PCI_VENDOR_ID_DYNALINK 0x0675 -+#define PCI_DEVICE_ID_DYNALINK_IS64PH 0x1702 -+ -+#define PCI_DEVICE_ID_WINBOND2_6692 0x6692 -+ -+#define PCI_DEVICE_ID_PLX_R685 0x1030 -+#define PCI_DEVICE_ID_PLX_DJINN_ITOO 0x1151 -+#define PCI_DEVICE_ID_PLX_R753 0x1152 -+ -+#define PCI_VENDOR_ID_ELSA 0x1048 -+#define PCI_DEVICE_ID_ELSA_MICROLINK 0x1000 -+#define PCI_DEVICE_ID_ELSA_QS3000 0x3000 -+ -+#define PCI_VENDOR_ID_EICON 0x1133 -+#define PCI_DEVICE_ID_EICON_DIVA20PRO 0xe001 -+#define PCI_DEVICE_ID_EICON_DIVA20 0xe002 -+#define PCI_DEVICE_ID_EICON_DIVA20PRO_U 0xe003 -+#define PCI_DEVICE_ID_EICON_DIVA20_U 0xe004 -+#define PCI_DEVICE_ID_EICON_DIVA201 0xe005 -+#define PCI_DEVICE_ID_EICON_MAESTRA 0xe010 -+#define PCI_DEVICE_ID_EICON_MAESTRAQ 0xe012 -+#define PCI_DEVICE_ID_EICON_MAESTRAQ_U 0xe013 -+#define PCI_DEVICE_ID_EICON_MAESTRAP 0xe014 -+ -+#define PCI_VENDOR_ID_CCD 0x1397 -+#define PCI_DEVICE_ID_CCD_2BD0 0x2BD0 -+#define PCI_DEVICE_ID_CCD_B000 0xB000 -+#define PCI_DEVICE_ID_CCD_B006 0xB006 -+#define PCI_DEVICE_ID_CCD_B007 0xB007 -+#define PCI_DEVICE_ID_CCD_B008 0xB008 -+#define PCI_DEVICE_ID_CCD_B009 0xB009 -+#define PCI_DEVICE_ID_CCD_B00A 0xB00A -+#define PCI_DEVICE_ID_CCD_B00B 0xB00B -+#define PCI_DEVICE_ID_CCD_B00C 0xB00C -+#define PCI_DEVICE_ID_CCD_B100 0xB100 -+ -+#define PCI_VENDOR_ID_ASUSTEK 0x1043 -+#define PCI_DEVICE_ID_ASUSTEK_0675 0x0675 -+ -+#define PCI_VENDOR_ID_BERKOM 0x0871 -+#define PCI_DEVICE_ID_BERKOM_A1T 0xFFA1 -+#define PCI_DEVICE_ID_BERKOM_T_CONCEPT 0xFFA2 -+#define PCI_DEVICE_ID_BERKOM_A4T 0xFFA4 -+#define PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO 0xFFA8 -+ -+#define PCI_DEVICE_ID_SATSAGEM_NICCY 0x1016 -+ -+#define PCI_DEVICE_ID_TIGERJET_100 0x0002 -+ -+#define PCI_VENDOR_ID_ANIGMA 0x1051 -+#define PCI_DEVICE_ID_ANIGMA_MC145575 0x0100 -+ -+#define PCI_VENDOR_ID_ZOLTRIX 0x15b0 -+#define PCI_DEVICE_ID_ZOLTRIX_2BD0 0x2BD0 -+ -+#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_E 0x0070 -+#define PCI_DEVICE_ID_DIGI_DF_M_E 0x0071 -+#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072 -+#define PCI_DEVICE_ID_DIGI_DF_M_A 0x0073 -+ -+#define PCI_DEVICE_ID_AVM_B1 0x0700 -+#define PCI_DEVICE_ID_AVM_C4 0x0800 -+#define PCI_DEVICE_ID_AVM_C2 0x1100 -+#define PCI_DEVICE_ID_AVM_T1 0x1200 -+ -+#define PCI_VENDOR_ID_HYPERCOPE 0x1365 -+#define PCI_DEVICE_ID_HYPERCOPE_PLX 0x9050 -+#define PCI_SUBDEVICE_ID_HYPERCOPE_OLD_ERGO 0x0104 -+#define PCI_SUBDEVICE_ID_HYPERCOPE_ERGO 0x0106 -+#define PCI_SUBDEVICE_ID_HYPERCOPE_METRO 0x0107 -+#define PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2 0x0108 -+#define PCI_SUBDEVICE_ID_HYPERCOPE_PLEXUS 0x0109 -+ -+#define PCI_VENDOR_ID_ABOCOM 0x13D1 -+#define PCI_DEVICE_ID_ABOCOM_2BD1 0x2BD1 -+ -+#endif /* COMPAT_NEED_PCI_IDS */ -+ -+#endif /* __KERNEL__ */ -+#endif /* _LINUX_ISDN_COMPAT_H */ -diff -rNu linux-2.4.29.old/include/linux/isdn_divertif.h linux-2.4.29/include/linux/isdn_divertif.h ---- linux-2.4.29.old/include/linux/isdn_divertif.h 2005-03-22 14:47:32.000000000 +0100 -+++ linux-2.4.29/include/linux/isdn_divertif.h 2005-03-22 15:06:50.032486688 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn_divertif.h,v 1.1.4.1 2001/11/20 14:19:38 kai Exp $ -+/* $Id$ - * - * Header for the diversion supplementary interface for i4l. - * -@@ -14,7 +14,7 @@ - /***********************************************************/ - /* magic value is also used to control version information */ - /***********************************************************/ --#define DIVERT_IF_MAGIC 0x25873401 -+#define DIVERT_IF_MAGIC 0x25873402 - #define DIVERT_CMD_REG 0x00 /* register command */ - #define DIVERT_CMD_REL 0x01 /* release command */ - #define DIVERT_NO_ERR 0x00 /* return value no error */ -@@ -34,6 +34,7 @@ - int (*ll_cmd)(isdn_ctrl *); /* supplied by hl on return */ - char * (*drv_to_name)(int); /* map a driver id to name, supplied by hl */ - int (*name_to_drv)(char *); /* map a driver id to name, supplied by hl */ -+ int (*dial_net_name)(char *); /* force dial of a ll net interface */ - } isdn_divert_if; - - /*********************/ -diff -rNu linux-2.4.29.old/include/linux/isdn_dwabc.h linux-2.4.29/include/linux/isdn_dwabc.h ---- linux-2.4.29.old/include/linux/isdn_dwabc.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.29/include/linux/isdn_dwabc.h 2005-03-22 15:06:50.048484256 +0100 -@@ -0,0 +1,84 @@ -+/* $Id: isdn_dwabc.h,v 1.9 2001/09/26 20:32:08 detabc Exp $ -+ * -+ * Header for the Linux ISDN abc-extension. -+ * -+ * Copyright by abc GmbH -+ * written by Detlef Wengorz -+ * -+ * This software may be used and distributed according to the terms -+ * of the GNU General Public License, incorporated herein by reference. -+ * -+ */ -+ -+#ifndef ISDN_DWABC_H -+#define ISDN_DWABC_H -+ -+#ifdef __KERNEL__ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+ -+typedef struct ISDN_DWSPINLOCK { -+ -+ spinlock_t spin; -+ short owner; -+ short my_flags; -+ ulong irq_flags; -+ -+} ISDN_DWSPINLOCK; -+ -+#define ISDN_DWSPIN_UNLOCKED \ -+ (ISDN_DWSPINLOCK) { \ -+ spin: SPIN_LOCK_UNLOCKED, \ -+ owner: -1, \ -+ my_flags: 0, \ -+ irq_flags: 0, \ -+ } -+ -+#define ISDN_DWSPIN_INIT(x) \ -+ do { *(x) = ISDN_DWSPIN_UNLOCKED; } while(0); -+ -+static __inline__ int isdn_dwspin_trylock(ISDN_DWSPINLOCK *spin) -+{ -+ if(!spin_trylock(&spin->spin)) { -+ -+ if(spin->owner == smp_processor_id()) -+ return(-EAGAIN); -+ -+ spin_lock(&spin->spin); -+ } -+ -+ spin->owner = smp_processor_id(); -+ return(0); -+} -+ -+static __inline__ void isdn_dwspin_unlock(ISDN_DWSPINLOCK *spin) -+{ -+ spin->owner = -1; -+ spin_unlock(&spin->spin); -+} -+ -+ -+#else -+#include -+#endif -+ -+#define DWABC_LCR_FLG_NEWNUMBER 0x00000001L -+#define DWABC_LCR_FLG_DISABLE 0x00000002L -+#define DWABC_LCR_FLG_NEWHUPTIME 0x00000004L -+ -+ -+struct ISDN_DWABC_LCR_IOCTL { -+ -+ int lcr_ioctl_sizeof; /* mustbe sizeof(ISDN_DWABC_LCR_IOCTL) */ -+ u_short lcr_ioctl_onhtime; /* new hanguptime */ -+ u_long lcr_ioctl_callid; /* callid from lcr-subsystem */ -+ u_long lcr_ioctl_flags; /* see above */ -+ char lcr_ioctl_nr[32]; /* new destination phonenumber */ -+}; -+ -+#endif -diff -rNu linux-2.4.29.old/include/linux/isdn_lzscomp.h linux-2.4.29/include/linux/isdn_lzscomp.h ---- linux-2.4.29.old/include/linux/isdn_lzscomp.h 2005-03-22 14:47:32.000000000 +0100 -+++ linux-2.4.29/include/linux/isdn_lzscomp.h 2005-03-22 15:06:50.089478024 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdn_lzscomp.h,v 1.1.4.1 2001/11/20 14:19:38 kai Exp $ -+/* $Id$ - * - * Header for isdn_lzscomp.c - * Concentrated here to not mess up half a dozen kernel headers with code -diff -rNu linux-2.4.29.old/include/linux/isdn_ppp.h linux-2.4.29/include/linux/isdn_ppp.h ---- linux-2.4.29.old/include/linux/isdn_ppp.h 2005-03-22 14:47:31.000000000 +0100 -+++ linux-2.4.29/include/linux/isdn_ppp.h 2005-03-22 15:06:50.116473920 +0100 -@@ -8,6 +8,7 @@ - #ifndef _LINUX_ISDN_PPP_H - #define _LINUX_ISDN_PPP_H - -+#include - - #define CALLTYPE_INCOMING 0x1 - #define CALLTYPE_OUTGOING 0x2 -@@ -33,6 +34,11 @@ - #define PPPIOCSCOMPRESSOR _IOW('t',135,int) - #define PPPIOCGIFNAME _IOR('t',136, char [IFNAMSIZ] ) - -+#ifdef COMPAT_NEED_MPPP_DEFS -+#define PPP_MP 0x003d -+#define PPP_COMPFRAG 0x00fb -+#define PPP_CCPFRAG 0x80fb -+#endif - - #define SC_MP_PROT 0x00000200 - #define SC_REJ_MP_PROT 0x00000400 -@@ -65,9 +71,6 @@ - - #include - --#ifdef CONFIG_IPPP_FILTER --#include --#endif - - #define DECOMP_ERR_NOMEM (-10) - -@@ -226,10 +229,6 @@ - unsigned char *cbuf; - struct slcompress *slcomp; - #endif --#ifdef CONFIG_IPPP_FILTER -- struct sock_fprog pass_filter; /* filter for packets to pass */ -- struct sock_fprog active_filter; /* filter for pkts to reset idle */ --#endif - unsigned long debug; - struct isdn_ppp_compressor *compressor,*decompressor; - struct isdn_ppp_compressor *link_compressor,*link_decompressor; -diff -rNu linux-2.4.29.old/include/linux/isdnif.h linux-2.4.29/include/linux/isdnif.h ---- linux-2.4.29.old/include/linux/isdnif.h 2005-03-22 14:47:31.000000000 +0100 -+++ linux-2.4.29/include/linux/isdnif.h 2005-03-22 15:06:50.132471488 +0100 -@@ -1,4 +1,4 @@ --/* $Id: isdnif.h,v 1.1.4.1 2001/11/20 14:19:38 kai Exp $ -+/* $Id: isdnif.h,v 1.43 2002/02/09 21:19:11 keil Exp $ - * - * Linux ISDN subsystem - * Definition of the interface between the subsystem and its low-level drivers. -@@ -14,6 +14,7 @@ - #ifndef __ISDNIF_H__ - #define __ISDNIF_H__ - -+#include - - /* - * Values for general protocol-selection -@@ -213,6 +214,8 @@ - #define ISDN_STAT_FAXIND 276 /* FAX indications from HL-driver */ - #define ISDN_STAT_AUDIO 277 /* DTMF, DSP indications */ - #define ISDN_STAT_DISCH 278 /* Disable/Enable channel usage */ -+#define ISDN_STAT_ALERT 279 /* Signal alerting */ -+#define ISDN_STAT_PROCEED 280 /* Signal proceeding */ - - /* - * Audio commands -diff -rNu linux-2.4.29.old/include/linux/kernelcapi.h linux-2.4.29/include/linux/kernelcapi.h ---- linux-2.4.29.old/include/linux/kernelcapi.h 2005-03-22 14:47:32.000000000 +0100 -+++ linux-2.4.29/include/linux/kernelcapi.h 2005-03-22 15:06:50.147469208 +0100 -@@ -1,12 +1,10 @@ --/* $Id: kernelcapi.h,v 1.1.4.2 2002/01/28 18:25:10 kai Exp $ -+/* -+ * $Id: kernelcapi.h,v 1.9 2000/11/28 09:34:02 kai Exp $ - * - * Kernel CAPI 2.0 Interface for Linux - * - * (c) Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de) - * -- * This software may be used and distributed according to the terms -- * of the GNU General Public License, incorporated herein by reference. -- * - */ - - #ifndef __KERNELCAPI_H__ diff --git a/openwrt/package/linux/kernel-patches/403-netdev_random_core.patch b/openwrt/package/linux/kernel-patches/403-netdev_random_core.patch deleted file mode 100644 index 784b65e41c..0000000000 --- a/openwrt/package/linux/kernel-patches/403-netdev_random_core.patch +++ /dev/null @@ -1,296 +0,0 @@ -diff -urN linux-2.4.26-pre5/Documentation/Configure.help linux-2.4.26-pre5-netdev-core/Documentation/Configure.help ---- linux-2.4.26-pre5/Documentation/Configure.help Sat Mar 20 10:08:18 2004 -+++ linux-2.4.26-pre5-netdev-core/Documentation/Configure.help Sun Mar 21 10:16:14 2004 -@@ -10419,6 +10419,20 @@ - - If you don't know what to use this for, you don't need it. - -+Allow Net Devices to contribute to /dev/random -+CONFIG_NET_RANDOM -+ If you say Y here, network device interrupts will contribute to the -+ kernel entropy pool. Normally, block devices and some other devices -+ feed the pool. Some systems, such as those that are headless or diskless, -+ need additional entropy sources. Some people, however, feel that network -+ devices should not contribute to /dev/random because an external attacker -+ could observe incoming packets in an attempt to learn the entropy pool's -+ state. If you say N, no network device will contribute entropy. -+ -+ If you believe there is a chance of your network packets being observed -+ and you doubt the security of the entropy pool's one-way hash, do not -+ enable this. If unsure, say N. -+ - Ethertap network tap (OBSOLETE) - CONFIG_ETHERTAP - If you say Y here (and have said Y to "Kernel/User network link -diff -urN linux-2.4.26-pre5/drivers/net/Config.in linux-2.4.26-pre5-netdev-core/drivers/net/Config.in ---- linux-2.4.26-pre5/drivers/net/Config.in Sat Mar 20 10:08:18 2004 -+++ linux-2.4.26-pre5-netdev-core/drivers/net/Config.in Sun Mar 21 10:16:14 2004 -@@ -8,6 +8,7 @@ - tristate 'Bonding driver support' CONFIG_BONDING - tristate 'EQL (serial line load balancing) support' CONFIG_EQUALIZER - tristate 'Universal TUN/TAP device driver support' CONFIG_TUN -+bool 'Allow Net Devices to contribute to /dev/random' CONFIG_NET_RANDOM - if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - tristate 'Ethertap network tap (OBSOLETE)' CONFIG_ETHERTAP - fi -diff -urN linux-2.4.26-pre5/include/asm-alpha/signal.h linux-2.4.26-pre5-netdev-core/include/asm-alpha/signal.h ---- linux-2.4.26-pre5/include/asm-alpha/signal.h Sat Dec 1 18:27:14 2001 -+++ linux-2.4.26-pre5-netdev-core/include/asm-alpha/signal.h Sun Mar 21 10:16:14 2004 -@@ -121,7 +121,14 @@ - #define SA_PROBE SA_ONESHOT - #define SA_SAMPLE_RANDOM SA_RESTART - #define SA_SHIRQ 0x40000000 -+ -+#ifdef CONFIG_NET_RANDOM -+#define SA_NET_RANDOM SA_SAMPLE_RANDOM -+#else -+#define SA_NET_RANDOM 0 - #endif -+ -+#endif /* __KERNEL__ */ - - #define SIG_BLOCK 1 /* for blocking signals */ - #define SIG_UNBLOCK 2 /* for unblocking signals */ -diff -urN linux-2.4.26-pre5/include/asm-arm/signal.h linux-2.4.26-pre5-netdev-core/include/asm-arm/signal.h ---- linux-2.4.26-pre5/include/asm-arm/signal.h Sat Sep 13 07:57:29 2003 -+++ linux-2.4.26-pre5-netdev-core/include/asm-arm/signal.h Sun Mar 21 10:16:14 2004 -@@ -125,7 +125,14 @@ - #define SA_PROBE 0x80000000 - #define SA_SAMPLE_RANDOM 0x10000000 - #define SA_SHIRQ 0x04000000 -+ -+#ifdef CONFIG_NET_RANDOM -+#define SA_NET_RANDOM SA_SAMPLE_RANDOM -+#else -+#define SA_NET_RANDOM 0 - #endif -+ -+#endif /* __KERNEL__ */ - - #define SIG_BLOCK 0 /* for blocking signals */ - #define SIG_UNBLOCK 1 /* for unblocking signals */ -diff -urN linux-2.4.26-pre5/include/asm-cris/signal.h linux-2.4.26-pre5-netdev-core/include/asm-cris/signal.h ---- linux-2.4.26-pre5/include/asm-cris/signal.h Sat Dec 1 18:27:14 2001 -+++ linux-2.4.26-pre5-netdev-core/include/asm-cris/signal.h Sun Mar 21 10:16:14 2004 -@@ -120,7 +120,14 @@ - #define SA_PROBE SA_ONESHOT - #define SA_SAMPLE_RANDOM SA_RESTART - #define SA_SHIRQ 0x04000000 -+ -+#ifdef CONFIG_NET_RANDOM -+#define SA_NET_RANDOM SA_SAMPLE_RANDOM -+#else -+#define SA_NET_RANDOM 0 - #endif -+ -+#endif /* __KERNEL__ */ - - #define SIG_BLOCK 0 /* for blocking signals */ - #define SIG_UNBLOCK 1 /* for unblocking signals */ -diff -urN linux-2.4.26-pre5/include/asm-i386/signal.h linux-2.4.26-pre5-netdev-core/include/asm-i386/signal.h ---- linux-2.4.26-pre5/include/asm-i386/signal.h Sun Mar 21 00:00:43 2004 -+++ linux-2.4.26-pre5-netdev-core/include/asm-i386/signal.h Sun Mar 21 10:16:14 2004 -@@ -119,7 +119,14 @@ - #define SA_PROBE SA_ONESHOT - #define SA_SAMPLE_RANDOM SA_RESTART - #define SA_SHIRQ 0x04000000 -+ -+#ifdef CONFIG_NET_RANDOM -+#define SA_NET_RANDOM SA_SAMPLE_RANDOM -+#else -+#define SA_NET_RANDOM 0 - #endif -+ -+#endif /* __KERNEL__ */ - - #define SIG_BLOCK 0 /* for blocking signals */ - #define SIG_UNBLOCK 1 /* for unblocking signals */ -diff -urN linux-2.4.26-pre5/include/asm-ia64/signal.h linux-2.4.26-pre5-netdev-core/include/asm-ia64/signal.h ---- linux-2.4.26-pre5/include/asm-ia64/signal.h Sat Mar 20 10:08:20 2004 -+++ linux-2.4.26-pre5-netdev-core/include/asm-ia64/signal.h Sun Mar 21 10:16:14 2004 -@@ -117,6 +117,12 @@ - #define SA_SHIRQ 0x04000000 - #define SA_PERCPU_IRQ 0x02000000 - -+#ifdef CONFIG_NET_RANDOM -+#define SA_NET_RANDOM SA_SAMPLE_RANDOM -+#else -+#define SA_NET_RANDOM 0 -+#endif -+ - #endif /* __KERNEL__ */ - - #define SIG_BLOCK 0 /* for blocking signals */ -diff -urN linux-2.4.26-pre5/include/asm-m68k/signal.h linux-2.4.26-pre5-netdev-core/include/asm-m68k/signal.h ---- linux-2.4.26-pre5/include/asm-m68k/signal.h Fri Feb 20 07:38:33 2004 -+++ linux-2.4.26-pre5-netdev-core/include/asm-m68k/signal.h Sun Mar 21 10:16:14 2004 -@@ -116,7 +116,14 @@ - #define SA_PROBE SA_ONESHOT - #define SA_SAMPLE_RANDOM SA_RESTART - #define SA_SHIRQ 0x04000000 -+ -+#ifdef CONFIG_NET_RANDOM -+#define SA_NET_RANDOM SA_SAMPLE_RANDOM -+#else -+#define SA_NET_RANDOM 0 - #endif -+ -+#endif /* __KERNEL__ */ - - #define SIG_BLOCK 0 /* for blocking signals */ - #define SIG_UNBLOCK 1 /* for unblocking signals */ -diff -urN linux-2.4.26-pre5/include/asm-mips/signal.h linux-2.4.26-pre5-netdev-core/include/asm-mips/signal.h ---- linux-2.4.26-pre5/include/asm-mips/signal.h Sat Sep 13 07:57:31 2003 -+++ linux-2.4.26-pre5-netdev-core/include/asm-mips/signal.h Sun Mar 21 10:16:14 2004 -@@ -111,6 +111,12 @@ - #define SA_SAMPLE_RANDOM SA_RESTART - #define SA_SHIRQ 0x02000000 - -+#ifdef CONFIG_NET_RANDOM -+#define SA_NET_RANDOM SA_SAMPLE_RANDOM -+#else -+#define SA_NET_RANDOM 0 -+#endif -+ - #endif /* __KERNEL__ */ - - #define SIG_BLOCK 1 /* for blocking signals */ -diff -urN linux-2.4.26-pre5/include/asm-mips64/signal.h linux-2.4.26-pre5-netdev-core/include/asm-mips64/signal.h ---- linux-2.4.26-pre5/include/asm-mips64/signal.h Sat Sep 13 07:57:32 2003 -+++ linux-2.4.26-pre5-netdev-core/include/asm-mips64/signal.h Sun Mar 21 10:16:14 2004 -@@ -119,6 +119,12 @@ - #define SA_SAMPLE_RANDOM SA_RESTART - #define SA_SHIRQ 0x02000000 - -+#ifdef CONFIG_NET_RANDOM -+#define SA_NET_RANDOM SA_SAMPLE_RANDOM -+#else -+#define SA_NET_RANDOM 0 -+#endif -+ - #endif /* __KERNEL__ */ - - #define SIG_BLOCK 1 /* for blocking signals */ -diff -urN linux-2.4.26-pre5/include/asm-parisc/signal.h linux-2.4.26-pre5-netdev-core/include/asm-parisc/signal.h ---- linux-2.4.26-pre5/include/asm-parisc/signal.h Sun Jan 11 18:48:21 2004 -+++ linux-2.4.26-pre5-netdev-core/include/asm-parisc/signal.h Sun Mar 21 10:16:14 2004 -@@ -100,6 +100,12 @@ - #define SA_SAMPLE_RANDOM SA_RESTART - #define SA_SHIRQ 0x04000000 - -+#ifdef CONFIG_NET_RANDOM -+#define SA_NET_RANDOM SA_SAMPLE_RANDOM -+#else -+#define SA_NET_RANDOM 0 -+#endif -+ - #endif /* __KERNEL__ */ - - #define SIG_BLOCK 0 /* for blocking signals */ -diff -urN linux-2.4.26-pre5/include/asm-ppc/signal.h linux-2.4.26-pre5-netdev-core/include/asm-ppc/signal.h ---- linux-2.4.26-pre5/include/asm-ppc/signal.h Sat Sep 13 07:57:32 2003 -+++ linux-2.4.26-pre5-netdev-core/include/asm-ppc/signal.h Sun Mar 21 10:16:14 2004 -@@ -111,6 +111,13 @@ - #define SA_PROBE SA_ONESHOT - #define SA_SAMPLE_RANDOM SA_RESTART - #define SA_SHIRQ 0x04000000 -+ -+#ifdef CONFIG_NET_RANDOM -+#define SA_NET_RANDOM SA_SAMPLE_RANDOM -+#else -+#define SA_NET_RANDOM 0 -+#endif -+ - #endif /* __KERNEL__ */ - - #define SIG_BLOCK 0 /* for blocking signals */ -diff -urN linux-2.4.26-pre5/include/asm-s390/signal.h linux-2.4.26-pre5-netdev-core/include/asm-s390/signal.h ---- linux-2.4.26-pre5/include/asm-s390/signal.h Fri Feb 20 07:38:34 2004 -+++ linux-2.4.26-pre5-netdev-core/include/asm-s390/signal.h Sun Mar 21 10:16:14 2004 -@@ -129,7 +129,14 @@ - #define SA_SHIRQ 0x04000000 - #define SA_DOPATHGROUP 0x00100000 - #define SA_FORCE 0x00200000 -+ -+#ifdef CONFIG_NET_RANDOM -+#define SA_NET_RANDOM SA_SAMPLE_RANDOM -+#else -+#define SA_NET_RANDOM 0 - #endif -+ -+#endif /* __KERNEL__ */ - - #define SIG_BLOCK 0 /* for blocking signals */ - #define SIG_UNBLOCK 1 /* for unblocking signals */ -diff -urN linux-2.4.26-pre5/include/asm-s390x/signal.h linux-2.4.26-pre5-netdev-core/include/asm-s390x/signal.h ---- linux-2.4.26-pre5/include/asm-s390x/signal.h Fri Feb 20 07:38:34 2004 -+++ linux-2.4.26-pre5-netdev-core/include/asm-s390x/signal.h Sun Mar 21 10:16:14 2004 -@@ -129,7 +129,14 @@ - #define SA_SHIRQ 0x04000000 - #define SA_DOPATHGROUP 0x00100000 - #define SA_FORCE 0x00200000 -+ -+#ifdef CONFIG_NET_RANDOM -+#define SA_NET_RANDOM SA_SAMPLE_RANDOM -+#else -+#define SA_NET_RANDOM 0 - #endif -+ -+#endif /* __KERNEL__ */ - - #define SIG_BLOCK 0 /* for blocking signals */ - #define SIG_UNBLOCK 1 /* for unblocking signals */ -diff -urN linux-2.4.26-pre5/include/asm-sh/signal.h linux-2.4.26-pre5-netdev-core/include/asm-sh/signal.h ---- linux-2.4.26-pre5/include/asm-sh/signal.h Sat Dec 1 18:27:13 2001 -+++ linux-2.4.26-pre5-netdev-core/include/asm-sh/signal.h Sun Mar 21 10:16:14 2004 -@@ -107,7 +107,14 @@ - #define SA_PROBE SA_ONESHOT - #define SA_SAMPLE_RANDOM SA_RESTART - #define SA_SHIRQ 0x04000000 -+ -+#ifdef CONFIG_NET_RANDOM -+#define SA_NET_RANDOM SA_SAMPLE_RANDOM -+#else -+#define SA_NET_RANDOM 0 - #endif -+ -+#endif /* __KERNEL__ */ - - #define SIG_BLOCK 0 /* for blocking signals */ - #define SIG_UNBLOCK 1 /* for unblocking signals */ -diff -urN linux-2.4.26-pre5/include/asm-sparc/signal.h linux-2.4.26-pre5-netdev-core/include/asm-sparc/signal.h ---- linux-2.4.26-pre5/include/asm-sparc/signal.h Sat Dec 1 18:27:14 2001 -+++ linux-2.4.26-pre5-netdev-core/include/asm-sparc/signal.h Sun Mar 21 10:16:14 2004 -@@ -176,7 +176,14 @@ - #define SA_PROBE SA_ONESHOT - #define SA_SAMPLE_RANDOM SA_RESTART - #define SA_STATIC_ALLOC 0x80 -+ -+#ifdef CONFIG_NET_RANDOM -+#define SA_NET_RANDOM SA_SAMPLE_RANDOM -+#else -+#define SA_NET_RANDOM 0 - #endif -+ -+#endif /* __KERNEL__ */ - - /* Type of a signal handler. */ - #ifdef __KERNEL__ -diff -urN linux-2.4.26-pre5/include/asm-sparc64/signal.h linux-2.4.26-pre5-netdev-core/include/asm-sparc64/signal.h ---- linux-2.4.26-pre5/include/asm-sparc64/signal.h Sat Dec 1 18:27:14 2001 -+++ linux-2.4.26-pre5-netdev-core/include/asm-sparc64/signal.h Sun Mar 21 10:16:14 2004 -@@ -192,7 +192,14 @@ - #define SA_PROBE SA_ONESHOT - #define SA_SAMPLE_RANDOM SA_RESTART - #define SA_STATIC_ALLOC 0x80 -+ -+#ifdef CONFIG_NET_RANDOM -+#define SA_NET_RANDOM SA_SAMPLE_RANDOM -+#else -+#define SA_NET_RANDOM 0 - #endif -+ -+#endif /* __KERNEL__ */ - - /* Type of a signal handler. */ - #ifdef __KERNEL__ diff --git a/openwrt/package/linux/kernel-patches/404-netdev_random_et.patch b/openwrt/package/linux/kernel-patches/404-netdev_random_et.patch deleted file mode 100644 index e14a43c354..0000000000 --- a/openwrt/package/linux/kernel-patches/404-netdev_random_et.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- linux-2.4.30.old/drivers/net/et/et_linux.c 2005-05-05 02:53:35.000000000 +0200 -+++ linux-2.4.30/drivers/net/et/et_linux.c 2005-05-05 02:54:01.000000000 +0200 -@@ -192,7 +192,7 @@ - #endif - - /* register our interrupt handler */ -- if (request_irq(pdev->irq, et_isr, SA_SHIRQ, dev->name, et)) { -+ if (request_irq(pdev->irq, et_isr, SA_SHIRQ | SA_NET_RANDOM, dev->name, et)) { - ET_ERROR(("et%d: request_irq() failed\n", unit)); - goto fail; - } diff --git a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/Makefile b/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/Makefile deleted file mode 100644 index eae8eba49c..0000000000 --- a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# -# Makefile for Broadcom BCM947XX boards -# -# Copyright 2004, Broadcom Corporation -# All Rights Reserved. -# -# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY -# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM -# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. -# -# $Id$ -# - -O_TARGET := bcm947xx.o - -export-objs := nvram_linux.o setup.o -obj-y := prom.o setup.o time.o sbmips.o sbpci.o pcibios.o perfcntr.o gpio.o -obj-y += sflash.o nvram.o nvram_linux.o - -vpath %.c $(SRCBASE)/shared $(SRCBASE)/shared/nvram - -include $(TOPDIR)/Rules.make diff --git a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/compressed/Makefile b/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/compressed/Makefile deleted file mode 100644 index ead9d07439..0000000000 --- a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/compressed/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# -# Makefile for Broadcom BCM947XX boards -# -# Copyright 2001-2003, Broadcom Corporation -# All Rights Reserved. -# -# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY -# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM -# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. -# -# $Id$ -# - -OBJCOPY := $(CROSS_COMPILE)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S -SYSTEM ?= $(TOPDIR)/vmlinux - -all: vmlinuz - -# Don't build dependencies, this may die if $(CC) isn't gcc -dep: - -# Create a gzipped version named vmlinuz for compatibility -vmlinuz: piggy - gzip -c9 $< > $@ - -piggy: $(SYSTEM) - $(OBJCOPY) $< $@ - -mrproper: clean - -clean: - rm -f vmlinuz piggy diff --git a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/gpio.c b/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/gpio.c deleted file mode 100644 index d20b763338..0000000000 --- a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/gpio.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * GPIO char driver - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -static void *gpio_sbh; -static int gpio_major; -static devfs_handle_t gpio_dir; -static struct { - char *name; - devfs_handle_t handle; -} gpio_file[] = { - { "in", NULL }, - { "out", NULL }, - { "outen", NULL }, - { "control", NULL } -}; - -static int -gpio_open(struct inode *inode, struct file * file) -{ - if (MINOR(inode->i_rdev) > ARRAYSIZE(gpio_file)) - return -ENODEV; - - MOD_INC_USE_COUNT; - return 0; -} - -static int -gpio_release(struct inode *inode, struct file * file) -{ - MOD_DEC_USE_COUNT; - return 0; -} - -static ssize_t -gpio_read(struct file *file, char *buf, size_t count, loff_t *ppos) -{ - u32 val; - - switch (MINOR(file->f_dentry->d_inode->i_rdev)) { - case 0: - val = sb_gpioin(gpio_sbh); - break; - case 1: - val = sb_gpioout(gpio_sbh, 0, 0); - break; - case 2: - val = sb_gpioouten(gpio_sbh, 0, 0); - break; - case 3: - val = sb_gpiocontrol(gpio_sbh, 0, 0); - break; - default: - return -ENODEV; - } - - if (put_user(val, (u32 *) buf)) - return -EFAULT; - - return sizeof(val); -} - -static ssize_t -gpio_write(struct file *file, const char *buf, size_t count, loff_t *ppos) -{ - u32 val; - - if (get_user(val, (u32 *) buf)) - return -EFAULT; - - switch (MINOR(file->f_dentry->d_inode->i_rdev)) { - case 0: - return -EACCES; - case 1: - sb_gpioout(gpio_sbh, ~0, val); - break; - case 2: - sb_gpioouten(gpio_sbh, ~0, val); - break; - case 3: - sb_gpiocontrol(gpio_sbh, ~0, val); - break; - default: - return -ENODEV; - } - - return sizeof(val); -} - -static struct file_operations gpio_fops = { - owner: THIS_MODULE, - open: gpio_open, - release: gpio_release, - read: gpio_read, - write: gpio_write, -}; - -static int __init -gpio_init(void) -{ - int i; - - if (!(gpio_sbh = sb_kattach())) - return -ENODEV; - - sb_gpiosetcore(gpio_sbh); - - if ((gpio_major = devfs_register_chrdev(0, "gpio", &gpio_fops)) < 0) - return gpio_major; - - gpio_dir = devfs_mk_dir(NULL, "gpio", NULL); - - for (i = 0; i < ARRAYSIZE(gpio_file); i++) { - gpio_file[i].handle = devfs_register(gpio_dir, - gpio_file[i].name, - DEVFS_FL_DEFAULT, gpio_major, i, - S_IFCHR | S_IRUGO | S_IWUGO, - &gpio_fops, NULL); - } - - return 0; -} - -static void __exit -gpio_exit(void) -{ - int i; - - for (i = 0; i < ARRAYSIZE(gpio_file); i++) - devfs_unregister(gpio_file[i].handle); - devfs_unregister(gpio_dir); - devfs_unregister_chrdev(gpio_major, "gpio"); - sb_detach(gpio_sbh); -} - -module_init(gpio_init); -module_exit(gpio_exit); diff --git a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/nvram.c b/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/nvram.c deleted file mode 100644 index af12ced3ff..0000000000 --- a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/nvram.c +++ /dev/null @@ -1,317 +0,0 @@ -/* - * NVRAM variable manipulation (common) - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#include -#include -#include -#include -#include -#include - -extern struct nvram_tuple * _nvram_realloc(struct nvram_tuple *t, const char *name, const char *value); -extern void _nvram_free(struct nvram_tuple *t); -extern int _nvram_read(void *buf); - -char * _nvram_get(const char *name); -int _nvram_set(const char *name, const char *value); -int _nvram_unset(const char *name); -int _nvram_getall(char *buf, int count); -int _nvram_commit(struct nvram_header *header); -int _nvram_init(void); -void _nvram_exit(void); - -static struct nvram_tuple * nvram_hash[257]; -static struct nvram_tuple * nvram_dead; - -/* Free all tuples. Should be locked. */ -static void -nvram_free(void) -{ - uint i; - struct nvram_tuple *t, *next; - - /* Free hash table */ - for (i = 0; i < ARRAYSIZE(nvram_hash); i++) { - for (t = nvram_hash[i]; t; t = next) { - next = t->next; - _nvram_free(t); - } - nvram_hash[i] = NULL; - } - - /* Free dead table */ - for (t = nvram_dead; t; t = next) { - next = t->next; - _nvram_free(t); - } - nvram_dead = NULL; - - /* Indicate to per-port code that all tuples have been freed */ - _nvram_free(NULL); -} - -/* String hash */ -static INLINE uint -hash(const char *s) -{ - uint hash = 0; - - while (*s) - hash = 31 * hash + *s++; - - return hash; -} - -/* (Re)initialize the hash table. Should be locked. */ -static int -nvram_rehash(struct nvram_header *header) -{ - char buf[] = "0xXXXXXXXX", *name, *value, *end, *eq; - - /* (Re)initialize hash table */ - nvram_free(); - - /* Parse and set "name=value\0 ... \0\0" */ - name = (char *) &header[1]; - end = (char *) header + NVRAM_SPACE - 2; - end[0] = end[1] = '\0'; - for (; *name; name = value + strlen(value) + 1) { - if (!(eq = strchr(name, '='))) - break; - *eq = '\0'; - value = eq + 1; - _nvram_set(name, value); - *eq = '='; - } - - /* Set special SDRAM parameters */ - if (!_nvram_get("sdram_init")) { - sprintf(buf, "0x%04X", (uint16)(header->crc_ver_init >> 16)); - _nvram_set("sdram_init", buf); - } - if (!_nvram_get("sdram_config")) { - sprintf(buf, "0x%04X", (uint16)(header->config_refresh & 0xffff)); - _nvram_set("sdram_config", buf); - } - if (!_nvram_get("sdram_refresh")) { - sprintf(buf, "0x%04X", (uint16)((header->config_refresh >> 16) & 0xffff)); - _nvram_set("sdram_refresh", buf); - } - if (!_nvram_get("sdram_ncdl")) { - sprintf(buf, "0x%08X", header->config_ncdl); - _nvram_set("sdram_ncdl", buf); - } - - return 0; -} - -/* Get the value of an NVRAM variable. Should be locked. */ -char * -_nvram_get(const char *name) -{ - uint i; - struct nvram_tuple *t; - char *value; - - if (!name) - return NULL; - - /* Hash the name */ - i = hash(name) % ARRAYSIZE(nvram_hash); - - /* Find the associated tuple in the hash table */ - for (t = nvram_hash[i]; t && strcmp(t->name, name); t = t->next); - - value = t ? t->value : NULL; - - return value; -} - -/* Get the value of an NVRAM variable. Should be locked. */ -int -_nvram_set(const char *name, const char *value) -{ - uint i; - struct nvram_tuple *t, *u, **prev; - - /* Hash the name */ - i = hash(name) % ARRAYSIZE(nvram_hash); - - /* Find the associated tuple in the hash table */ - for (prev = &nvram_hash[i], t = *prev; t && strcmp(t->name, name); prev = &t->next, t = *prev); - - /* (Re)allocate tuple */ - if (!(u = _nvram_realloc(t, name, value))) - return -12; /* -ENOMEM */ - - /* Value reallocated */ - if (t && t == u) - return 0; - - /* Move old tuple to the dead table */ - if (t) { - *prev = t->next; - t->next = nvram_dead; - nvram_dead = t; - } - - /* Add new tuple to the hash table */ - u->next = nvram_hash[i]; - nvram_hash[i] = u; - - return 0; -} - -/* Unset the value of an NVRAM variable. Should be locked. */ -int -_nvram_unset(const char *name) -{ - uint i; - struct nvram_tuple *t, **prev; - - if (!name) - return 0; - - /* Hash the name */ - i = hash(name) % ARRAYSIZE(nvram_hash); - - /* Find the associated tuple in the hash table */ - for (prev = &nvram_hash[i], t = *prev; t && strcmp(t->name, name); prev = &t->next, t = *prev); - - /* Move it to the dead table */ - if (t) { - *prev = t->next; - t->next = nvram_dead; - nvram_dead = t; - } - - return 0; -} - -/* Get all NVRAM variables. Should be locked. */ -int -_nvram_getall(char *buf, int count) -{ - uint i; - struct nvram_tuple *t; - int len = 0; - - bzero(buf, count); - - /* Write name=value\0 ... \0\0 */ - for (i = 0; i < ARRAYSIZE(nvram_hash); i++) { - for (t = nvram_hash[i]; t; t = t->next) { - if ((count - len) > (strlen(t->name) + 1 + strlen(t->value) + 1)) - len += sprintf(buf + len, "%s=%s", t->name, t->value) + 1; - else - break; - } - } - - return 0; -} - -/* Regenerate NVRAM. Should be locked. */ -int -_nvram_commit(struct nvram_header *header) -{ - char *init, *config, *refresh, *ncdl; - char *ptr, *end; - int i; - struct nvram_tuple *t; - struct nvram_header tmp; - uint8 crc; - - /* Regenerate header */ - header->magic = NVRAM_MAGIC; - header->crc_ver_init = (NVRAM_VERSION << 8); - if (!(init = _nvram_get("sdram_init")) || - !(config = _nvram_get("sdram_config")) || - !(refresh = _nvram_get("sdram_refresh")) || - !(ncdl = _nvram_get("sdram_ncdl"))) { - header->crc_ver_init |= SDRAM_INIT << 16; - header->config_refresh = SDRAM_CONFIG; - header->config_refresh |= SDRAM_REFRESH << 16; - header->config_ncdl = 0; - } else { - header->crc_ver_init |= (bcm_strtoul(init, NULL, 0) & 0xffff) << 16; - header->config_refresh = bcm_strtoul(config, NULL, 0) & 0xffff; - header->config_refresh |= (bcm_strtoul(refresh, NULL, 0) & 0xffff) << 16; - header->config_ncdl = bcm_strtoul(ncdl, NULL, 0); - } - - /* Clear data area */ - ptr = (char *) header + sizeof(struct nvram_header); - bzero(ptr, NVRAM_SPACE - sizeof(struct nvram_header)); - - /* Leave space for a double NUL at the end */ - end = (char *) header + NVRAM_SPACE - 2; - - /* Write out all tuples */ - for (i = 0; i < ARRAYSIZE(nvram_hash); i++) { - for (t = nvram_hash[i]; t; t = t->next) { - if ((ptr + strlen(t->name) + 1 + strlen(t->value) + 1) > end) - break; - ptr += sprintf(ptr, "%s=%s", t->name, t->value) + 1; - } - } - - /* End with a double NUL */ - ptr += 2; - - /* Set new length */ - header->len = ROUNDUP(ptr - (char *) header, 4); - - /* Little-endian CRC8 over the last 11 bytes of the header */ - tmp.crc_ver_init = htol32(header->crc_ver_init); - tmp.config_refresh = htol32(header->config_refresh); - tmp.config_ncdl = htol32(header->config_ncdl); - crc = crc8((char *) &tmp + 9, sizeof(struct nvram_header) - 9, CRC8_INIT_VALUE); - - /* Continue CRC8 over data bytes */ - crc = crc8((char *) &header[1], header->len - sizeof(struct nvram_header), crc); - - /* Set new CRC8 */ - header->crc_ver_init |= crc; - - /* Reinitialize hash table */ - return nvram_rehash(header); -} - -/* Initialize hash table. Should be locked. */ -int -_nvram_init(void) -{ - struct nvram_header *header; - int ret; - - if (!(header = (struct nvram_header *) MALLOC(NVRAM_SPACE))) { - printf("nvram_init: out of memory\n"); - return -12; /* -ENOMEM */ - } - - if ((ret = _nvram_read(header)) == 0 && - header->magic == NVRAM_MAGIC) - nvram_rehash(header); - - MFREE(header, NVRAM_SPACE); - return ret; -} - -/* Free hash table. Should be locked. */ -void -_nvram_exit(void) -{ - nvram_free(); -} diff --git a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/nvram_linux.c b/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/nvram_linux.c deleted file mode 100644 index bbbc1eb735..0000000000 --- a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/nvram_linux.c +++ /dev/null @@ -1,638 +0,0 @@ -/* - * NVRAM variable manipulation (Linux kernel half) - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* In BSS to minimize text size and page aligned so it can be mmap()-ed */ -static char nvram_buf[NVRAM_SPACE] __attribute__((aligned(PAGE_SIZE))); - -#ifdef MODULE - -#define early_nvram_get(name) nvram_get(name) - -#else /* !MODULE */ - -/* Global SB handle */ -extern void *bcm947xx_sbh; -extern spinlock_t bcm947xx_sbh_lock; - -/* Convenience */ -#define sbh bcm947xx_sbh -#define sbh_lock bcm947xx_sbh_lock -#define KB * 1024 -#define MB * 1024 * 1024 - -/* Probe for NVRAM header */ -static void __init -early_nvram_init(void) -{ - struct nvram_header *header; - chipcregs_t *cc; - struct sflash *info = NULL; - int i; - uint32 base, off, lim; - - if ((cc = sb_setcore(sbh, SB_CC, 0)) != NULL) { - base = CC_FLASH_BASE; - switch (readl(&cc->capabilities) & CAP_FLASH_MASK) { - case PFLASH: - lim = CC_FLASH_MAX; - break; - - case SFLASH_ST: - case SFLASH_AT: - if ((info = sflash_init(cc)) == NULL) - return; - lim = info->size; - break; - - case FLASH_NONE: - default: - return; - } - } else { - /* extif assumed, Stop at 4 MB */ - base = FLASH_BASE; - lim = FLASH_MAX; - } - - off = FLASH_MIN; - while (off <= lim) { - /* Windowed flash access */ - header = (struct nvram_header *) KSEG1ADDR(base + off - NVRAM_SPACE); - if (header->magic == NVRAM_MAGIC) { - u32 *src = (u32 *) header; - u32 *dst = (u32 *) nvram_buf; - for (i = 0; i < sizeof(struct nvram_header); i += 4) - *dst++ = *src++; - for (; i < header->len && i < NVRAM_SPACE; i += 4) - *dst++ = ltoh32(*src++); - return; - } - - /* Try embedded NVRAM at 4 KB and 1 KB as last resorts */ - if (off == 1 KB) - break; - else if (off == 4 KB) - off = 1 KB; - else if (off == lim) - off = 4 KB; - else - off <<= 1; - } -} - -/* Early (before mm or mtd) read-only access to NVRAM */ -static char * __init -early_nvram_get(const char *name) -{ - char *var, *value, *end, *eq; - - if (!name) - return NULL; - - if (!nvram_buf[0]) - early_nvram_init(); - - /* Look for name=value and return value */ - var = &nvram_buf[sizeof(struct nvram_header)]; - end = nvram_buf + sizeof(nvram_buf) - 2; - end[0] = end[1] = '\0'; - for (; *var; var = value + strlen(value) + 1) { - if (!(eq = strchr(var, '='))) - break; - value = eq + 1; - if ((eq - var) == strlen(name) && strncmp(var, name, (eq - var)) == 0) - return value; - } - - return NULL; -} - -#endif /* !MODULE */ - -extern char * _nvram_get(const char *name); -extern int _nvram_set(const char *name, const char *value); -extern int _nvram_unset(const char *name); -extern int _nvram_getall(char *buf, int count); -extern int _nvram_commit(struct nvram_header *header); -extern int _nvram_init(void); -extern void _nvram_exit(void); - -/* Globals */ -static spinlock_t nvram_lock = SPIN_LOCK_UNLOCKED; -static struct semaphore nvram_sem; -static unsigned long nvram_offset = 0; -static int nvram_major = -1; -static devfs_handle_t nvram_handle = NULL; -static struct mtd_info *nvram_mtd = NULL; - -int -_nvram_read(char *buf) -{ - struct nvram_header *header = (struct nvram_header *) buf; - size_t len; - - if (!nvram_mtd || - MTD_READ(nvram_mtd, nvram_mtd->size - NVRAM_SPACE, NVRAM_SPACE, &len, buf) || - len != NVRAM_SPACE || - header->magic != NVRAM_MAGIC) { - /* Maybe we can recover some data from early initialization */ - memcpy(buf, nvram_buf, NVRAM_SPACE); - } - - return 0; -} - -struct nvram_tuple * -_nvram_realloc(struct nvram_tuple *t, const char *name, const char *value) -{ - if ((nvram_offset + strlen(value) + 1) > NVRAM_SPACE) - return NULL; - - if (!t) { - if (!(t = kmalloc(sizeof(struct nvram_tuple) + strlen(name) + 1, GFP_ATOMIC))) - return NULL; - - /* Copy name */ - t->name = (char *) &t[1]; - strcpy(t->name, name); - - t->value = NULL; - } - - /* Copy value */ - if (!t->value || strcmp(t->value, value)) { - t->value = &nvram_buf[nvram_offset]; - strcpy(t->value, value); - nvram_offset += strlen(value) + 1; - } - - return t; -} - -void -_nvram_free(struct nvram_tuple *t) -{ - if (!t) - nvram_offset = 0; - else - kfree(t); -} - -int -nvram_set(const char *name, const char *value) -{ - unsigned long flags; - int ret; - struct nvram_header *header; - - spin_lock_irqsave(&nvram_lock, flags); - if ((ret = _nvram_set(name, value))) { - /* Consolidate space and try again */ - if ((header = kmalloc(NVRAM_SPACE, GFP_ATOMIC))) { - if (_nvram_commit(header) == 0) - ret = _nvram_set(name, value); - kfree(header); - } - } - spin_unlock_irqrestore(&nvram_lock, flags); - - return ret; -} - -char * -real_nvram_get(const char *name) -{ - unsigned long flags; - char *value; - - spin_lock_irqsave(&nvram_lock, flags); - value = _nvram_get(name); - spin_unlock_irqrestore(&nvram_lock, flags); - - return value; -} - -char * -nvram_get(const char *name) -{ - if (nvram_major >= 0) - return real_nvram_get(name); - else - return early_nvram_get(name); -} - -int -nvram_unset(const char *name) -{ - unsigned long flags; - int ret; - - spin_lock_irqsave(&nvram_lock, flags); - ret = _nvram_unset(name); - spin_unlock_irqrestore(&nvram_lock, flags); - - return ret; -} - -static void -erase_callback(struct erase_info *done) -{ - wait_queue_head_t *wait_q = (wait_queue_head_t *) done->priv; - wake_up(wait_q); -} - -int -nvram_commit(void) -{ - char *buf; - size_t erasesize, len; - unsigned int i; - int ret; - struct nvram_header *header; - unsigned long flags; - u_int32_t offset; - DECLARE_WAITQUEUE(wait, current); - wait_queue_head_t wait_q; - struct erase_info erase; - - printk("nvram_commit(): init\n"); - - if (!nvram_mtd) { - printk("nvram_commit: NVRAM not found\n"); - return -ENODEV; - } - - if (in_interrupt()) { - printk("nvram_commit: not committing in interrupt\n"); - return -EINVAL; - } - - /* Backup sector blocks to be erased */ - erasesize = ROUNDUP(NVRAM_SPACE, nvram_mtd->erasesize); - if (!(buf = kmalloc(erasesize, GFP_KERNEL))) { - printk("nvram_commit: out of memory\n"); - return -ENOMEM; - } - - down(&nvram_sem); -#if 0 - offset = nvram_mtd->size - erasesize; - i = erasesize - NVRAM_SPACE; - ret = MTD_READ(nvram_mtd, offset, i, &len, buf); - if (ret || len != i) { - printk("nvram_commit: read error\n"); - ret = -EIO; - goto done; -#endif - if ((i = erasesize - NVRAM_SPACE) > 0) { - offset = nvram_mtd->size - erasesize; - len = 0; - ret = MTD_READ(nvram_mtd, offset, i, &len, buf); - if (ret || len != i) { - printk("nvram_commit: read error ret = %d, len = %d/%d\n", ret, len, i); - ret = -EIO; - goto done; - } - header = (struct nvram_header *)(buf + i); - } else { - offset = nvram_mtd->size - NVRAM_SPACE; - header = (struct nvram_header *)buf; - } - - /* Regenerate NVRAM */ - spin_lock_irqsave(&nvram_lock, flags); - ret = _nvram_commit(header); - spin_unlock_irqrestore(&nvram_lock, flags); - if (ret) - goto done; - - /* Erase sector blocks */ - init_waitqueue_head(&wait_q); - for (; offset < nvram_mtd->size - NVRAM_SPACE + header->len; offset += nvram_mtd->erasesize) { - erase.mtd = nvram_mtd; - erase.addr = offset; - erase.len = nvram_mtd->erasesize; - erase.callback = erase_callback; - erase.priv = (u_long) &wait_q; - - set_current_state(TASK_INTERRUPTIBLE); - add_wait_queue(&wait_q, &wait); - - /* Unlock sector blocks */ - if (nvram_mtd->unlock) - nvram_mtd->unlock(nvram_mtd, offset, nvram_mtd->erasesize); - - if ((ret = MTD_ERASE(nvram_mtd, &erase))) { - set_current_state(TASK_RUNNING); - remove_wait_queue(&wait_q, &wait); - printk("nvram_commit: erase error\n"); - goto done; - } - - /* Wait for erase to finish */ - schedule(); - remove_wait_queue(&wait_q, &wait); - } - - /* Write partition up to end of data area */ - offset = nvram_mtd->size - erasesize; - i = erasesize - NVRAM_SPACE + header->len; - ret = MTD_WRITE(nvram_mtd, offset, i, &len, buf); - if (ret || len != i) { - printk("nvram_commit: write error\n"); - ret = -EIO; - goto done; - } - /* - * Reading a few bytes back here will put the device - * back to the correct mode on certain flashes */ - - offset = nvram_mtd->size - erasesize; - ret = MTD_READ(nvram_mtd, offset, 4, &len, buf); - - done: - up(&nvram_sem); - kfree(buf); - printk("nvram_commit(): end\n"); - return ret; -} - -int -nvram_getall(char *buf, int count) -{ - unsigned long flags; - int ret; - - spin_lock_irqsave(&nvram_lock, flags); - ret = _nvram_getall(buf, count); - spin_unlock_irqrestore(&nvram_lock, flags); - - return ret; -} - -EXPORT_SYMBOL(nvram_get); -EXPORT_SYMBOL(nvram_getall); -EXPORT_SYMBOL(nvram_set); -EXPORT_SYMBOL(nvram_unset); -EXPORT_SYMBOL(nvram_commit); - -/* User mode interface below */ - -static ssize_t -dev_nvram_read(struct file *file, char *buf, size_t count, loff_t *ppos) -{ - char tmp[100], *name = tmp, *value; - ssize_t ret; - unsigned long off; - - if (count > sizeof(tmp)) { - if (!(name = kmalloc(count, GFP_KERNEL))) - return -ENOMEM; - } - - if (copy_from_user(name, buf, count)) { - ret = -EFAULT; - goto done; - } - - if (*name == '\0') { - /* Get all variables */ - ret = nvram_getall(name, count); - if (ret == 0) { - if (copy_to_user(buf, name, count)) { - ret = -EFAULT; - goto done; - } - ret = count; - } - } else { - if (!(value = nvram_get(name))) { - ret = 0; - goto done; - } - - /* Provide the offset into mmap() space */ - off = (unsigned long) value - (unsigned long) nvram_buf; - - if (put_user(off, (unsigned long *) buf)) { - ret = -EFAULT; - goto done; - } - - ret = sizeof(unsigned long); - } - - flush_cache_all(); - -done: - if (name != tmp) - kfree(name); - - return ret; -} - -static ssize_t -dev_nvram_write(struct file *file, const char *buf, size_t count, loff_t *ppos) -{ - char tmp[100], *name = tmp, *value; - ssize_t ret; - - if (count > sizeof(tmp)) { - if (!(name = kmalloc(count, GFP_KERNEL))) - return -ENOMEM; - } - - if (copy_from_user(name, buf, count)) { - ret = -EFAULT; - goto done; - } - - value = name; - name = strsep(&value, "="); - if (value) - ret = nvram_set(name, value) ? : count; - else - ret = nvram_unset(name) ? : count; - - done: - if (name != tmp) - kfree(name); - - return ret; -} - -static int -dev_nvram_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) -{ - if (cmd != NVRAM_MAGIC) - return -EINVAL; - return nvram_commit(); -} - -static int -dev_nvram_mmap(struct file *file, struct vm_area_struct *vma) -{ - unsigned long offset = virt_to_phys(nvram_buf); - - if (remap_page_range(vma->vm_start, offset, vma->vm_end-vma->vm_start, - vma->vm_page_prot)) - return -EAGAIN; - - return 0; -} - -static int -dev_nvram_open(struct inode *inode, struct file * file) -{ - MOD_INC_USE_COUNT; - return 0; -} - -static int -dev_nvram_release(struct inode *inode, struct file * file) -{ - MOD_DEC_USE_COUNT; - return 0; -} - -static struct file_operations dev_nvram_fops = { - owner: THIS_MODULE, - open: dev_nvram_open, - release: dev_nvram_release, - read: dev_nvram_read, - write: dev_nvram_write, - ioctl: dev_nvram_ioctl, - mmap: dev_nvram_mmap, -}; - -static void -dev_nvram_exit(void) -{ - int order = 0; - struct page *page, *end; - - if (nvram_handle) - devfs_unregister(nvram_handle); - - if (nvram_major >= 0) - devfs_unregister_chrdev(nvram_major, "nvram"); - - if (nvram_mtd) - put_mtd_device(nvram_mtd); - - while ((PAGE_SIZE << order) < NVRAM_SPACE) - order++; - end = virt_to_page(nvram_buf + (PAGE_SIZE << order) - 1); - for (page = virt_to_page(nvram_buf); page <= end; page++) - mem_map_unreserve(page); - - _nvram_exit(); -} - -static int __init -dev_nvram_init(void) -{ - int order = 0, ret = 0; - struct page *page, *end; - unsigned int i; - - /* Allocate and reserve memory to mmap() */ - while ((PAGE_SIZE << order) < NVRAM_SPACE) - order++; - end = virt_to_page(nvram_buf + (PAGE_SIZE << order) - 1); - for (page = virt_to_page(nvram_buf); page <= end; page++) - mem_map_reserve(page); - -#ifdef CONFIG_MTD - /* Find associated MTD device */ - for (i = 0; i < MAX_MTD_DEVICES; i++) { - nvram_mtd = get_mtd_device(NULL, i); - if (nvram_mtd) { - if (!strcmp(nvram_mtd->name, "nvram") && - nvram_mtd->size >= NVRAM_SPACE) - break; - put_mtd_device(nvram_mtd); - } - } - if (i >= MAX_MTD_DEVICES) - nvram_mtd = NULL; -#endif - - /* Initialize hash table lock */ - spin_lock_init(&nvram_lock); - - /* Initialize commit semaphore */ - init_MUTEX(&nvram_sem); - - /* Register char device */ - if ((nvram_major = devfs_register_chrdev(0, "nvram", &dev_nvram_fops)) < 0) { - ret = nvram_major; - goto err; - } - - /* Initialize hash table */ - _nvram_init(); - - /* Create /dev/nvram handle */ - nvram_handle = devfs_register(NULL, "nvram", DEVFS_FL_NONE, nvram_major, 0, - S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP, &dev_nvram_fops, NULL); - - /* Set the SDRAM NCDL value into NVRAM if not already done */ - if (getintvar(NULL, "sdram_ncdl") == 0) { - unsigned int ncdl; - char buf[] = "0x00000000"; - - if ((ncdl = sb_memc_get_ncdl(sbh))) { - sprintf(buf, "0x%08x", ncdl); - nvram_set("sdram_ncdl", buf); - nvram_commit(); - } - } - - return 0; - - err: - dev_nvram_exit(); - return ret; -} - -module_init(dev_nvram_init); -module_exit(dev_nvram_exit); diff --git a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/pcibios.c b/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/pcibios.c deleted file mode 100644 index 4077a79f34..0000000000 --- a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/pcibios.c +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Low-Level PCI and SB support for BCM47xx (Linux support code) - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -/* Global SB handle */ -extern void *bcm947xx_sbh; -extern spinlock_t bcm947xx_sbh_lock; - -/* Convenience */ -#define sbh bcm947xx_sbh -#define sbh_lock bcm947xx_sbh_lock - -static int -sbpci_read_config_byte(struct pci_dev *dev, int where, u8 *value) -{ - unsigned long flags; - int ret; - - spin_lock_irqsave(&sbh_lock, flags); - ret = sbpci_read_config(sbh, dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), where, value, sizeof(*value)); - spin_unlock_irqrestore(&sbh_lock, flags); - return ret ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL; -} - -static int -sbpci_read_config_word(struct pci_dev *dev, int where, u16 *value) -{ - unsigned long flags; - int ret; - - spin_lock_irqsave(&sbh_lock, flags); - ret = sbpci_read_config(sbh, dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), where, value, sizeof(*value)); - spin_unlock_irqrestore(&sbh_lock, flags); - return ret ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL; -} - -static int -sbpci_read_config_dword(struct pci_dev *dev, int where, u32 *value) -{ - unsigned long flags; - int ret; - - spin_lock_irqsave(&sbh_lock, flags); - ret = sbpci_read_config(sbh, dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), where, value, sizeof(*value)); - spin_unlock_irqrestore(&sbh_lock, flags); - return ret ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL; -} - -static int -sbpci_write_config_byte(struct pci_dev *dev, int where, u8 value) -{ - unsigned long flags; - int ret; - - spin_lock_irqsave(&sbh_lock, flags); - ret = sbpci_write_config(sbh, dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), where, &value, sizeof(value)); - spin_unlock_irqrestore(&sbh_lock, flags); - return ret ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL; -} - -static int -sbpci_write_config_word(struct pci_dev *dev, int where, u16 value) -{ - unsigned long flags; - int ret; - - spin_lock_irqsave(&sbh_lock, flags); - ret = sbpci_write_config(sbh, dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), where, &value, sizeof(value)); - spin_unlock_irqrestore(&sbh_lock, flags); - return ret ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL; -} - -static int -sbpci_write_config_dword(struct pci_dev *dev, int where, u32 value) -{ - unsigned long flags; - int ret; - - spin_lock_irqsave(&sbh_lock, flags); - ret = sbpci_write_config(sbh, dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), where, &value, sizeof(value)); - spin_unlock_irqrestore(&sbh_lock, flags); - return ret ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL; -} - -static struct pci_ops pcibios_ops = { - sbpci_read_config_byte, - sbpci_read_config_word, - sbpci_read_config_dword, - sbpci_write_config_byte, - sbpci_write_config_word, - sbpci_write_config_dword -}; - - -void __init -pcibios_init(void) -{ - ulong flags; - - if (!(sbh = sb_kattach())) - panic("sb_kattach failed"); - spin_lock_init(&sbh_lock); - - spin_lock_irqsave(&sbh_lock, flags); - sbpci_init(sbh); - spin_unlock_irqrestore(&sbh_lock, flags); - - set_io_port_base((unsigned long) ioremap_nocache(SB_PCI_MEM, 0x04000000)); - - /* Scan the SB bus */ - pci_scan_bus(0, &pcibios_ops, NULL); - -} - -char * __init -pcibios_setup(char *str) -{ - if (!strncmp(str, "ban=", 4)) { - sbpci_ban(simple_strtoul(str + 4, NULL, 0)); - return NULL; - } - - return (str); -} - -static u32 pci_iobase = 0x100; -static u32 pci_membase = SB_PCI_DMA; - -void __init -pcibios_fixup_bus(struct pci_bus *b) -{ - struct list_head *ln; - struct pci_dev *d; - struct resource *res; - int pos, size; - u32 *base; - u8 irq; - - printk("PCI: Fixing up bus %d\n", b->number); - - /* Fix up SB */ - if (b->number == 0) { - for (ln=b->devices.next; ln != &b->devices; ln=ln->next) { - d = pci_dev_b(ln); - /* Fix up interrupt lines */ - pci_read_config_byte(d, PCI_INTERRUPT_LINE, &irq); - d->irq = irq + 2; - pci_write_config_byte(d, PCI_INTERRUPT_LINE, d->irq); - } - } - - /* Fix up external PCI */ - else { - for (ln=b->devices.next; ln != &b->devices; ln=ln->next) { - d = pci_dev_b(ln); - /* Fix up resource bases */ - for (pos = 0; pos < 6; pos++) { - res = &d->resource[pos]; - base = (res->flags & IORESOURCE_IO) ? &pci_iobase : &pci_membase; - if (res->end) { - size = res->end - res->start + 1; - if (*base & (size - 1)) - *base = (*base + size) & ~(size - 1); - res->start = *base; - res->end = res->start + size - 1; - *base += size; - pci_write_config_dword(d, PCI_BASE_ADDRESS_0 + (pos << 2), res->start); - } - /* Fix up PCI bridge BAR0 only */ - if (b->number == 1 && PCI_SLOT(d->devfn) == 0) - break; - } - /* Fix up interrupt lines */ - if (pci_find_device(VENDOR_BROADCOM, SB_PCI, NULL)) - d->irq = (pci_find_device(VENDOR_BROADCOM, SB_PCI, NULL))->irq; - pci_write_config_byte(d, PCI_INTERRUPT_LINE, d->irq); - } - } -} - -unsigned int -pcibios_assign_all_busses(void) -{ - return 1; -} - -void -pcibios_align_resource(void *data, struct resource *res, - unsigned long size, unsigned long align) -{ -} - -int -pcibios_enable_resources(struct pci_dev *dev) -{ - u16 cmd, old_cmd; - int idx; - struct resource *r; - - /* External PCI only */ - if (dev->bus->number == 0) - return 0; - - pci_read_config_word(dev, PCI_COMMAND, &cmd); - old_cmd = cmd; - for(idx=0; idx<6; idx++) { - r = &dev->resource[idx]; - if (r->flags & IORESOURCE_IO) - cmd |= PCI_COMMAND_IO; - if (r->flags & IORESOURCE_MEM) - cmd |= PCI_COMMAND_MEMORY; - } - if (dev->resource[PCI_ROM_RESOURCE].start) - cmd |= PCI_COMMAND_MEMORY; - if (cmd != old_cmd) { - printk("PCI: Enabling device %s (%04x -> %04x)\n", dev->slot_name, old_cmd, cmd); - pci_write_config_word(dev, PCI_COMMAND, cmd); - } - return 0; -} - -int -pcibios_enable_device(struct pci_dev *dev, int mask) -{ - ulong flags; - uint coreidx; - - /* External PCI device enable */ - if (dev->bus->number != 0) - return pcibios_enable_resources(dev); - - /* These cores come out of reset enabled */ - if (dev->device == SB_MIPS || - dev->device == SB_MIPS33 || - dev->device == SB_EXTIF || - dev->device == SB_CC) - return 0; - - spin_lock_irqsave(&sbh_lock, flags); - coreidx = sb_coreidx(sbh); - if (!sb_setcoreidx(sbh, PCI_SLOT(dev->devfn))) - return PCIBIOS_DEVICE_NOT_FOUND; - - /* - * The USB core requires a special bit to be set during core - * reset to enable host (OHCI) mode. Resetting the SB core in - * pcibios_enable_device() is a hack for compatibility with - * vanilla usb-ohci so that it does not have to know about - * SB. A driver that wants to use the USB core in device mode - * should know about SB and should reset the bit back to 0 - * after calling pcibios_enable_device(). - */ - if (sb_coreid(sbh) == SB_USB) { - sb_core_disable(sbh, sb_coreflags(sbh, 0, 0)); - sb_core_reset(sbh, 1 << 29); - } else - sb_core_reset(sbh, 0); - - sb_setcoreidx(sbh, coreidx); - spin_unlock_irqrestore(&sbh_lock, flags); - - return 0; -} - -void -pcibios_update_resource(struct pci_dev *dev, struct resource *root, - struct resource *res, int resource) -{ - unsigned long where, size; - u32 reg; - - /* External PCI only */ - if (dev->bus->number == 0) - return; - - where = PCI_BASE_ADDRESS_0 + (resource * 4); - size = res->end - res->start; - pci_read_config_dword(dev, where, ®); - reg = (reg & size) | (((u32)(res->start - root->start)) & ~size); - pci_write_config_dword(dev, where, reg); -} - -static void __init -quirk_sbpci_bridge(struct pci_dev *dev) -{ - if (dev->bus->number != 1 || PCI_SLOT(dev->devfn) != 0) - return; - - printk("PCI: Fixing up bridge\n"); - - /* Enable PCI bridge bus mastering and memory space */ - pci_set_master(dev); - pcibios_enable_resources(dev); - - /* Enable PCI bridge BAR1 prefetch and burst */ - pci_write_config_dword(dev, PCI_BAR1_CONTROL, 3); -} - -/* - * If we set up a device for bus mastering, we need to check the latency - * timer as certain crappy BIOSes forget to set it properly. - */ -unsigned int pcibios_max_latency = 255; - -void pcibios_set_master(struct pci_dev *dev) -{ - u8 lat; - pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); - if (lat < 16) - lat = (64 <= pcibios_max_latency) ? 64 : pcibios_max_latency; - else if (lat > pcibios_max_latency) - lat = pcibios_max_latency; - else - return; - printk(KERN_DEBUG "PCI: Setting latency timer of device %s to %d\n", dev->slot_name, lat); - pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat); -} - -struct pci_fixup pcibios_fixups[] = { - { PCI_FIXUP_HEADER, PCI_ANY_ID, PCI_ANY_ID, quirk_sbpci_bridge }, - { 0 } -}; diff --git a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/perfcntr.c b/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/perfcntr.c deleted file mode 100644 index aa0608e6e3..0000000000 --- a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/perfcntr.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Broadcom BCM47xx Performance Counter /proc/cpuinfo support - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#include - -/* - * BCM4710 performance counter register select values - * No even-odd control-counter mapping, just counters - */ -#define PERF_DCACHE_HIT 0 -#define PERF_DCACHE_MISS 1 -#define PERF_ICACHE_HIT 2 -#define PERF_ICACHE_MISS 3 -#define PERF_ICOUNT 4 - -/* - * Move from Coprocessor 0 Register 25 Select n - * data <- CPR[0,25,n] - * GPR[1] <- data - */ -#define read_bcm4710_perf_cntr(n) \ -({ int __res; \ - __asm__ __volatile__( \ - ".set\tnoreorder\n\t" \ - ".set\tnoat\n\t" \ - ".word\t"STR(0x4001c800|(n))"\n\t" \ - "move\t%0,$1\n\t" \ - ".set\tat\n\t" \ - ".set\treorder" \ - :"=r" (__res)); \ - __res;}) - -asmlinkage unsigned int read_perf_cntr(unsigned int counter) -{ - switch (counter) { - case PERF_DCACHE_HIT: return read_bcm4710_perf_cntr(PERF_DCACHE_HIT); - case PERF_DCACHE_MISS: return read_bcm4710_perf_cntr(PERF_DCACHE_MISS); - case PERF_ICACHE_HIT: return read_bcm4710_perf_cntr(PERF_ICACHE_HIT); - case PERF_ICACHE_MISS: return read_bcm4710_perf_cntr(PERF_ICACHE_MISS); - case PERF_ICOUNT: return read_bcm4710_perf_cntr(PERF_ICOUNT); - } - return 0; -} - -asmlinkage void write_perf_cntr(unsigned int counter, unsigned int val) -{ -} - -asmlinkage unsigned int read_perf_cntl(unsigned int counter) -{ - return 0; -} - -asmlinkage void write_perf_cntl(unsigned int counter, unsigned int val) -{ -} diff --git a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/prom.c b/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/prom.c deleted file mode 100644 index e41f44b9e2..0000000000 --- a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/prom.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Early initialization code for BCM94710 boards - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#include -#include -#include -#include -#include - -void __init -prom_init(int argc, const char **argv) -{ - unsigned long mem; - - mips_machgroup = MACH_GROUP_BRCM; - mips_machtype = MACH_BCM947XX; - - /* Figure out memory size by finding aliases */ - for (mem = (1 << 20); mem < (128 << 20); mem += (1 << 20)) { - if (*(unsigned long *)((unsigned long)(prom_init) + mem) == - *(unsigned long *)(prom_init)) - break; - } - add_memory_region(0, mem, BOOT_MEM_RAM); -} - -void __init -prom_free_prom_memory(void) -{ -} diff --git a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/sbmips.c b/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/sbmips.c deleted file mode 100644 index 6daaeb78c0..0000000000 --- a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/sbmips.c +++ /dev/null @@ -1,951 +0,0 @@ -/* - * BCM47XX Sonics SiliconBackplane MIPS core routines - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * Memory segments (32bit kernel mode addresses) - */ -#undef KUSEG -#undef KSEG0 -#undef KSEG1 -#undef KSEG2 -#undef KSEG3 -#define KUSEG 0x00000000 -#define KSEG0 0x80000000 -#define KSEG1 0xa0000000 -#define KSEG2 0xc0000000 -#define KSEG3 0xe0000000 - -/* - * Map an address to a certain kernel segment - */ -#undef KSEG0ADDR -#undef KSEG1ADDR -#undef KSEG2ADDR -#undef KSEG3ADDR -#define KSEG0ADDR(a) (((a) & 0x1fffffff) | KSEG0) -#define KSEG1ADDR(a) (((a) & 0x1fffffff) | KSEG1) -#define KSEG2ADDR(a) (((a) & 0x1fffffff) | KSEG2) -#define KSEG3ADDR(a) (((a) & 0x1fffffff) | KSEG3) - -/* - * The following macros are especially useful for __asm__ - * inline assembler. - */ -#ifndef __STR -#define __STR(x) #x -#endif -#ifndef STR -#define STR(x) __STR(x) -#endif - -/* ********************************************************************* - * CP0 Registers - ********************************************************************* */ - -#define C0_INX 0 /* CP0: TLB Index */ -#define C0_RAND 1 /* CP0: TLB Random */ -#define C0_TLBLO0 2 /* CP0: TLB EntryLo0 */ -#define C0_TLBLO C0_TLBLO0 /* CP0: TLB EntryLo0 */ -#define C0_TLBLO1 3 /* CP0: TLB EntryLo1 */ -#define C0_CTEXT 4 /* CP0: Context */ -#define C0_PGMASK 5 /* CP0: TLB PageMask */ -#define C0_WIRED 6 /* CP0: TLB Wired */ -#define C0_BADVADDR 8 /* CP0: Bad Virtual Address */ -#define C0_COUNT 9 /* CP0: Count */ -#define C0_TLBHI 10 /* CP0: TLB EntryHi */ -#define C0_COMPARE 11 /* CP0: Compare */ -#define C0_SR 12 /* CP0: Processor Status */ -#define C0_STATUS C0_SR /* CP0: Processor Status */ -#define C0_CAUSE 13 /* CP0: Exception Cause */ -#define C0_EPC 14 /* CP0: Exception PC */ -#define C0_PRID 15 /* CP0: Processor Revision Indentifier */ -#define C0_CONFIG 16 /* CP0: Config */ -#define C0_LLADDR 17 /* CP0: LLAddr */ -#define C0_WATCHLO 18 /* CP0: WatchpointLo */ -#define C0_WATCHHI 19 /* CP0: WatchpointHi */ -#define C0_XCTEXT 20 /* CP0: XContext */ -#define C0_DIAGNOSTIC 22 /* CP0: Diagnostic */ -#define C0_BROADCOM C0_DIAGNOSTIC /* CP0: Broadcom Register */ -#define C0_ECC 26 /* CP0: ECC */ -#define C0_CACHEERR 27 /* CP0: CacheErr */ -#define C0_TAGLO 28 /* CP0: TagLo */ -#define C0_TAGHI 29 /* CP0: TagHi */ -#define C0_ERREPC 30 /* CP0: ErrorEPC */ - -/* - * Macros to access the system control coprocessor - */ - -#define MFC0(source, sel) \ -({ \ - int __res; \ - __asm__ __volatile__( \ - ".set\tnoreorder\n\t" \ - ".set\tnoat\n\t" \ - ".word\t"STR(0x40010000 | ((source)<<11) | (sel))"\n\t" \ - "move\t%0,$1\n\t" \ - ".set\tat\n\t" \ - ".set\treorder" \ - :"=r" (__res) \ - : \ - :"$1"); \ - __res; \ -}) - -#define MTC0(source, sel, value) \ -do { \ - __asm__ __volatile__( \ - ".set\tnoreorder\n\t" \ - ".set\tnoat\n\t" \ - "move\t$1,%z0\n\t" \ - ".word\t"STR(0x40810000 | ((source)<<11) | (sel))"\n\t" \ - ".set\tat\n\t" \ - ".set\treorder" \ - : \ - :"Jr" (value) \ - :"$1"); \ -} while (0) - -/* - * R4x00 interrupt enable / cause bits - */ -#undef IE_SW0 -#undef IE_SW1 -#undef IE_IRQ0 -#undef IE_IRQ1 -#undef IE_IRQ2 -#undef IE_IRQ3 -#undef IE_IRQ4 -#undef IE_IRQ5 -#define IE_SW0 (1<< 8) -#define IE_SW1 (1<< 9) -#define IE_IRQ0 (1<<10) -#define IE_IRQ1 (1<<11) -#define IE_IRQ2 (1<<12) -#define IE_IRQ3 (1<<13) -#define IE_IRQ4 (1<<14) -#define IE_IRQ5 (1<<15) - -/* - * Bitfields in the R4xx0 cp0 status register - */ -#define ST0_IE 0x00000001 -#define ST0_EXL 0x00000002 -#define ST0_ERL 0x00000004 -#define ST0_KSU 0x00000018 -# define KSU_USER 0x00000010 -# define KSU_SUPERVISOR 0x00000008 -# define KSU_KERNEL 0x00000000 -#define ST0_UX 0x00000020 -#define ST0_SX 0x00000040 -#define ST0_KX 0x00000080 -#define ST0_DE 0x00010000 -#define ST0_CE 0x00020000 - -/* - * Status register bits available in all MIPS CPUs. - */ -#define ST0_IM 0x0000ff00 -#define ST0_CH 0x00040000 -#define ST0_SR 0x00100000 -#define ST0_TS 0x00200000 -#define ST0_BEV 0x00400000 -#define ST0_RE 0x02000000 -#define ST0_FR 0x04000000 -#define ST0_CU 0xf0000000 -#define ST0_CU0 0x10000000 -#define ST0_CU1 0x20000000 -#define ST0_CU2 0x40000000 -#define ST0_CU3 0x80000000 -#define ST0_XX 0x80000000 /* MIPS IV naming */ - -/* - * Cache Operations - */ - -#ifndef Fill_I -#define Fill_I 0x14 -#endif - -#define cache_unroll(base,op) \ - __asm__ __volatile__(" \ - .set noreorder; \ - .set mips3; \ - cache %1, (%0); \ - .set mips0; \ - .set reorder" \ - : \ - : "r" (base), \ - "i" (op)); - -/* - * These are the UART port assignments, expressed as offsets from the base - * register. These assignments should hold for any serial port based on - * a 8250, 16450, or 16550(A). - */ - -#define UART_MCR 4 /* Out: Modem Control Register */ -#define UART_MSR 6 /* In: Modem Status Register */ -#define UART_MCR_LOOP 0x10 /* Enable loopback test mode */ - -/* - * Returns TRUE if an external UART exists at the given base - * register. - */ -static bool -serial_exists(uint8 *regs) -{ - uint8 save_mcr, status1; - - save_mcr = R_REG(®s[UART_MCR]); - W_REG(®s[UART_MCR], UART_MCR_LOOP | 0x0a); - status1 = R_REG(®s[UART_MSR]) & 0xf0; - W_REG(®s[UART_MCR], save_mcr); - - return (status1 == 0x90); -} - -/* - * Initializes UART access. The callback function will be called once - * per found UART. -*/ -void -sb_serial_init(void *sbh, void (*add)(void *regs, uint irq, uint baud_base, uint reg_shift)) -{ - void *regs; - ulong base; - uint irq; - int i, n; - - if ((regs = sb_setcore(sbh, SB_EXTIF, 0))) { - extifregs_t *eir = (extifregs_t *) regs; - sbconfig_t *sb; - - /* Determine external UART register base */ - sb = (sbconfig_t *)((ulong) eir + SBCONFIGOFF); - base = EXTIF_CFGIF_BASE(sb_base(R_REG(&sb->sbadmatch1))); - - /* Determine IRQ */ - irq = sb_irq(sbh); - - /* Disable GPIO interrupt initially */ - W_REG(&eir->gpiointpolarity, 0); - W_REG(&eir->gpiointmask, 0); - - /* Search for external UARTs */ - n = 2; - for (i = 0; i < 2; i++) { - regs = (void *) REG_MAP(base + (i * 8), 8); - if (serial_exists(regs)) { - /* Set GPIO 1 to be the external UART IRQ */ - W_REG(&eir->gpiointmask, 2); - if (add) - add(regs, irq, 13500000, 0); - } - } - - /* Add internal UART if enabled */ - if (R_REG(&eir->corecontrol) & CC_UE) - if (add) - add((void *) &eir->uartdata, irq, sb_clock(sbh), 2); - } else if ((regs = sb_setcore(sbh, SB_CC, 0))) { - chipcregs_t *cc = (chipcregs_t *) regs; - uint32 rev, cap, pll, baud_base, div; - - /* Determine core revision and capabilities */ - rev = sb_corerev(sbh); - cap = R_REG(&cc->capabilities); - pll = cap & CAP_PLL_MASK; - - /* Determine IRQ */ - irq = sb_irq(sbh); - - if (pll == PLL_TYPE1) { - /* PLL clock */ - baud_base = sb_clock_rate(pll, - R_REG(&cc->clockcontrol_n), - R_REG(&cc->clockcontrol_m2)); - div = 1; - } else if (rev >= 3) { - /* Internal backplane clock */ - baud_base = sb_clock_rate(pll, - R_REG(&cc->clockcontrol_n), - R_REG(&cc->clockcontrol_sb)); - div = 2; /* Minimum divisor */ - W_REG(&cc->clkdiv, ((R_REG(&cc->clkdiv) & ~CLKD_UART) | div)); - } else { - /* Fixed internal backplane clock */ - baud_base = 88000000; - div = 48; - } - - /* Clock source depends on strapping if UartClkOverride is unset */ - if ((rev > 0) && ((R_REG(&cc->corecontrol) & CC_UARTCLKO) == 0)) { - if ((cap & CAP_UCLKSEL) == CAP_UINTCLK) { - /* Internal divided backplane clock */ - baud_base /= div; - } else { - /* Assume external clock of 1.8432 MHz */ - baud_base = 1843200; - } - } - - /* Add internal UARTs */ - n = cap & CAP_UARTS_MASK; - for (i = 0; i < n; i++) { - /* Register offset changed after revision 0 */ - if (rev) - regs = (void *)((ulong) &cc->uart0data + (i * 256)); - else - regs = (void *)((ulong) &cc->uart0data + (i * 8)); - - if (add) - add(regs, irq, baud_base, 0); - } - } -} - -/* Returns the SB interrupt flag of the current core. */ -uint32 -sb_flag(void *sbh) -{ - void *regs; - sbconfig_t *sb; - - regs = sb_coreregs(sbh); - sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF); - - return (R_REG(&sb->sbtpsflag) & SBTPS_NUM0_MASK); -} - -static const uint32 sbips_int_mask[] = { - 0, - SBIPS_INT1_MASK, - SBIPS_INT2_MASK, - SBIPS_INT3_MASK, - SBIPS_INT4_MASK -}; - -static const uint32 sbips_int_shift[] = { - 0, - 0, - SBIPS_INT2_SHIFT, - SBIPS_INT3_SHIFT, - SBIPS_INT4_SHIFT -}; - -/* - * Returns the MIPS IRQ assignment of the current core. If unassigned, - * 0 is returned. - */ -uint -sb_irq(void *sbh) -{ - uint idx; - void *regs; - sbconfig_t *sb; - uint32 flag, sbipsflag; - uint irq = 0; - - flag = sb_flag(sbh); - - idx = sb_coreidx(sbh); - - if ((regs = sb_setcore(sbh, SB_MIPS, 0)) || - (regs = sb_setcore(sbh, SB_MIPS33, 0))) { - sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF); - - /* sbipsflag specifies which core is routed to interrupts 1 to 4 */ - sbipsflag = R_REG(&sb->sbipsflag); - for (irq = 1; irq <= 4; irq++) { - if (((sbipsflag & sbips_int_mask[irq]) >> sbips_int_shift[irq]) == flag) - break; - } - if (irq == 5) - irq = 0; - } - - sb_setcoreidx(sbh, idx); - - return irq; -} - -/* Clears the specified MIPS IRQ. */ -static void -sb_clearirq(void *sbh, uint irq) -{ - void *regs; - sbconfig_t *sb; - - if (!(regs = sb_setcore(sbh, SB_MIPS, 0)) && - !(regs = sb_setcore(sbh, SB_MIPS33, 0))) - ASSERT(regs); - sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF); - - if (irq == 0) - W_REG(&sb->sbintvec, 0); - else - OR_REG(&sb->sbipsflag, sbips_int_mask[irq]); -} - -/* - * Assigns the specified MIPS IRQ to the specified core. Shared MIPS - * IRQ 0 may be assigned more than once. - */ -static void -sb_setirq(void *sbh, uint irq, uint coreid, uint coreunit) -{ - void *regs; - sbconfig_t *sb; - uint32 flag; - - regs = sb_setcore(sbh, coreid, coreunit); - ASSERT(regs); - flag = sb_flag(sbh); - - if (!(regs = sb_setcore(sbh, SB_MIPS, 0)) && - !(regs = sb_setcore(sbh, SB_MIPS33, 0))) - ASSERT(regs); - sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF); - - if (irq == 0) - OR_REG(&sb->sbintvec, 1 << flag); - else { - flag <<= sbips_int_shift[irq]; - ASSERT(!(flag & ~sbips_int_mask[irq])); - flag |= R_REG(&sb->sbipsflag) & ~sbips_int_mask[irq]; - W_REG(&sb->sbipsflag, flag); - } -} - -/* - * Initializes clocks and interrupts. SB and NVRAM access must be - * initialized prior to calling. - */ -void -sb_mips_init(void *sbh) -{ - ulong hz, ns, tmp; - extifregs_t *eir; - chipcregs_t *cc; - char *value; - uint irq; - - /* Figure out current SB clock speed */ - if ((hz = sb_clock(sbh)) == 0) - hz = 100000000; - ns = 1000000000 / hz; - - /* Setup external interface timing */ - if ((eir = sb_setcore(sbh, SB_EXTIF, 0))) { - /* Initialize extif so we can get to the LEDs and external UART */ - W_REG(&eir->prog_config, CF_EN); - - /* Set timing for the flash */ - tmp = CEIL(10, ns) << FW_W3_SHIFT; /* W3 = 10nS */ - tmp = tmp | (CEIL(40, ns) << FW_W1_SHIFT); /* W1 = 40nS */ - tmp = tmp | CEIL(120, ns); /* W0 = 120nS */ - W_REG(&eir->prog_waitcount, tmp); /* 0x01020a0c for a 100Mhz clock */ - - /* Set programmable interface timing for external uart */ - tmp = CEIL(10, ns) << FW_W3_SHIFT; /* W3 = 10nS */ - tmp = tmp | (CEIL(20, ns) << FW_W2_SHIFT); /* W2 = 20nS */ - tmp = tmp | (CEIL(100, ns) << FW_W1_SHIFT); /* W1 = 100nS */ - tmp = tmp | CEIL(120, ns); /* W0 = 120nS */ - W_REG(&eir->prog_waitcount, tmp); /* 0x01020a0c for a 100Mhz clock */ - } else if ((cc = sb_setcore(sbh, SB_CC, 0))) { - /* Set timing for the flash */ - tmp = CEIL(10, ns) << FW_W3_SHIFT; /* W3 = 10nS */ - tmp |= CEIL(10, ns) << FW_W1_SHIFT; /* W1 = 10nS */ - tmp |= CEIL(120, ns); /* W0 = 120nS */ - W_REG(&cc->flash_waitcount, tmp); - - W_REG(&cc->pcmcia_memwait, tmp); - } - - /* Chip specific initialization */ - switch (sb_chip(sbh)) { - case BCM4710_DEVICE_ID: - /* Clear interrupt map */ - for (irq = 0; irq <= 4; irq++) - sb_clearirq(sbh, irq); - sb_setirq(sbh, 0, SB_CODEC, 0); - sb_setirq(sbh, 0, SB_EXTIF, 0); - sb_setirq(sbh, 2, SB_ENET, 1); - sb_setirq(sbh, 3, SB_ILINE20, 0); - sb_setirq(sbh, 4, SB_PCI, 0); - ASSERT(eir); - value = nvram_get("et0phyaddr"); - if (value && !strcmp(value, "31")) { - /* Enable internal UART */ - W_REG(&eir->corecontrol, CC_UE); - /* Give USB its own interrupt */ - sb_setirq(sbh, 1, SB_USB, 0); - } else { - /* Disable internal UART */ - W_REG(&eir->corecontrol, 0); - /* Give Ethernet its own interrupt */ - sb_setirq(sbh, 1, SB_ENET, 0); - sb_setirq(sbh, 0, SB_USB, 0); - } - break; - case BCM4310_DEVICE_ID: - MTC0(C0_BROADCOM, 0, MFC0(C0_BROADCOM, 0) & ~(1 << 22)); - break; - } -} - -uint32 -sb_mips_clock(void *sbh) -{ - extifregs_t *eir; - chipcregs_t *cc; - uint32 n, m; - uint idx; - uint32 pll_type, rate = 0; - - /* get index of the current core */ - idx = sb_coreidx(sbh); - pll_type = PLL_TYPE1; - - /* switch to extif or chipc core */ - if ((eir = (extifregs_t *) sb_setcore(sbh, SB_EXTIF, 0))) { - n = R_REG(&eir->clockcontrol_n); - m = R_REG(&eir->clockcontrol_sb); - } else if ((cc = (chipcregs_t *) sb_setcore(sbh, SB_CC, 0))) { - pll_type = R_REG(&cc->capabilities) & CAP_PLL_MASK; - n = R_REG(&cc->clockcontrol_n); - if ((pll_type == PLL_TYPE2) || (pll_type == PLL_TYPE4)) - m = R_REG(&cc->clockcontrol_mips); - else if (pll_type == PLL_TYPE3) { - rate = 200000000; - goto out; - } else - m = R_REG(&cc->clockcontrol_sb); - } else - goto out; - - /* calculate rate */ - rate = sb_clock_rate(pll_type, n, m); - -out: - /* switch back to previous core */ - sb_setcoreidx(sbh, idx); - - return rate; -} - -static void -icache_probe(int *size, int *lsize) -{ - uint32 config1; - uint sets, ways; - - config1 = MFC0(C0_CONFIG, 1); - - /* Instruction Cache Size = Associativity * Line Size * Sets Per Way */ - if ((*lsize = ((config1 >> 19) & 7))) - *lsize = 2 << *lsize; - sets = 64 << ((config1 >> 22) & 7); - ways = 1 + ((config1 >> 16) & 7); - *size = *lsize * sets * ways; -} - -#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4) - -static void -handler(void) -{ - /* Step 11 */ - __asm__ ( - ".set\tmips32\n\t" - "ssnop\n\t" - "ssnop\n\t" - /* Disable interrupts */ - /* MTC0(C0_STATUS, 0, MFC0(C0_STATUS, 0) & ~(ALLINTS | STO_IE)); */ - "mfc0 $15, $12\n\t" - "and $15, $15, -31746\n\t" - "mtc0 $15, $12\n\t" - "eret\n\t" - "nop\n\t" - "nop\n\t" - ".set\tmips0" - ); -} - -/* The following MUST come right after handler() */ -static void -afterhandler(void) -{ -} - -/* - * Set the MIPS, backplane and PCI clocks as closely as possible. - */ -bool -sb_mips_setclock(void *sbh, uint32 mipsclock, uint32 sbclock, uint32 pciclock) -{ - extifregs_t *eir = NULL; - chipcregs_t *cc = NULL; - mipsregs_t *mipsr = NULL; - volatile uint32 *clockcontrol_n, *clockcontrol_sb, *clockcontrol_pci; - uint32 orig_n, orig_sb, orig_pci, orig_m2, orig_mips, orig_ratio_parm, new_ratio; - uint32 pll_type, sync_mode; - uint idx, i; - typedef struct { - uint32 mipsclock; - uint16 n; - uint32 sb; - uint32 pci33; - uint32 pci25; - } n3m_table_t; - static n3m_table_t type1_table[] = { - { 96000000, 0x0303, 0x04020011, 0x11030011, 0x11050011 }, /* 96.000 32.000 24.000 */ - { 100000000, 0x0009, 0x04020011, 0x11030011, 0x11050011 }, /* 100.000 33.333 25.000 */ - { 104000000, 0x0802, 0x04020011, 0x11050009, 0x11090009 }, /* 104.000 31.200 24.960 */ - { 108000000, 0x0403, 0x04020011, 0x11050009, 0x02000802 }, /* 108.000 32.400 24.923 */ - { 112000000, 0x0205, 0x04020011, 0x11030021, 0x02000403 }, /* 112.000 32.000 24.889 */ - { 115200000, 0x0303, 0x04020009, 0x11030011, 0x11050011 }, /* 115.200 32.000 24.000 */ - { 120000000, 0x0011, 0x04020011, 0x11050011, 0x11090011 }, /* 120.000 30.000 24.000 */ - { 124800000, 0x0802, 0x04020009, 0x11050009, 0x11090009 }, /* 124.800 31.200 24.960 */ - { 128000000, 0x0305, 0x04020011, 0x11050011, 0x02000305 }, /* 128.000 32.000 24.000 */ - { 132000000, 0x0603, 0x04020011, 0x11050011, 0x02000305 }, /* 132.000 33.000 24.750 */ - { 136000000, 0x0c02, 0x04020011, 0x11090009, 0x02000603 }, /* 136.000 32.640 24.727 */ - { 140000000, 0x0021, 0x04020011, 0x11050021, 0x02000c02 }, /* 140.000 30.000 24.706 */ - { 144000000, 0x0405, 0x04020011, 0x01020202, 0x11090021 }, /* 144.000 30.857 24.686 */ - { 150857142, 0x0605, 0x04020021, 0x02000305, 0x02000605 }, /* 150.857 33.000 24.000 */ - { 152000000, 0x0e02, 0x04020011, 0x11050021, 0x02000e02 }, /* 152.000 32.571 24.000 */ - { 156000000, 0x0802, 0x04020005, 0x11050009, 0x11090009 }, /* 156.000 31.200 24.960 */ - { 160000000, 0x0309, 0x04020011, 0x11090011, 0x02000309 }, /* 160.000 32.000 24.000 */ - { 163200000, 0x0c02, 0x04020009, 0x11090009, 0x02000603 }, /* 163.200 32.640 24.727 */ - { 168000000, 0x0205, 0x04020005, 0x11030021, 0x02000403 }, /* 168.000 32.000 24.889 */ - { 176000000, 0x0602, 0x04020003, 0x11050005, 0x02000602 }, /* 176.000 33.000 24.000 */ - }; - typedef struct { - uint32 mipsclock; - uint32 sbclock; - uint16 n; - uint32 sb; - uint32 pci33; - uint32 m2; - uint32 m3; - uint32 ratio; - uint32 ratio_parm; - } n4m_table_t; - - static n4m_table_t type2_table[] = { - { 180000000, 80000000, 0x0403, 0x01010000, 0x01020300, 0x01020600, 0x05000100, 0x94, 0x012a0115 }, - { 180000000, 90000000, 0x0403, 0x01000100, 0x01020300, 0x01000100, 0x05000100, 0x21, 0x0aaa0555 }, - { 200000000, 100000000, 0x0303, 0x01000000, 0x01000600, 0x01000000, 0x05000000, 0x21, 0x0aaa0555 }, - { 211200000, 105600000, 0x0902, 0x01000200, 0x01030400, 0x01000200, 0x05000200, 0x21, 0x0aaa0555 }, - { 220800000, 110400000, 0x1500, 0x01000200, 0x01030400, 0x01000200, 0x05000200, 0x21, 0x0aaa0555 }, - { 230400000, 115200000, 0x0604, 0x01000200, 0x01020600, 0x01000200, 0x05000200, 0x21, 0x0aaa0555 }, - { 234000000, 104000000, 0x0b01, 0x01010000, 0x01010700, 0x01020600, 0x05000100, 0x94, 0x012a0115 }, - { 240000000, 120000000, 0x0803, 0x01000200, 0x01020600, 0x01000200, 0x05000200, 0x21, 0x0aaa0555 }, - { 252000000, 126000000, 0x0504, 0x01000100, 0x01020500, 0x01000100, 0x05000100, 0x21, 0x0aaa0555 }, - { 264000000, 132000000, 0x0903, 0x01000200, 0x01020700, 0x01000200, 0x05000200, 0x21, 0x0aaa0555 }, - { 270000000, 120000000, 0x0703, 0x01010000, 0x01030400, 0x01020600, 0x05000100, 0x94, 0x012a0115 }, - { 276000000, 122666666, 0x1500, 0x01010000, 0x01030400, 0x01020600, 0x05000100, 0x94, 0x012a0115 }, - { 280000000, 140000000, 0x0503, 0x01000000, 0x01010600, 0x01000000, 0x05000000, 0x21, 0x0aaa0555 }, - { 288000000, 128000000, 0x0604, 0x01010000, 0x01030400, 0x01020600, 0x05000100, 0x94, 0x012a0115 }, - { 288000000, 144000000, 0x0404, 0x01000000, 0x01010600, 0x01000000, 0x05000000, 0x21, 0x0aaa0555 }, - { 300000000, 133333333, 0x0803, 0x01010000, 0x01020600, 0x01020600, 0x05000100, 0x94, 0x012a0115 }, - { 300000000, 150000000, 0x0803, 0x01000100, 0x01020600, 0x01000100, 0x05000100, 0x21, 0x0aaa0555 } - }; - - static n4m_table_t type4_table[] = { - { 192000000, 96000000, 0x0702, 0x04020011, 0x11030011, 0x04020011, 0x04020003, 0x21, 0x0aaa0555 }, - { 200000000, 100000000, 0x0009, 0x04020011, 0x11030011, 0x04020011, 0x04020003, 0x21, 0x0aaa0555 }, - { 216000000, 108000000, 0x0111, 0x11020005, 0x01030303, 0x11020005, 0x04000005, 0x21, 0x0aaa0555 }, - { 228000000, 101333333, 0x0e02, 0x11030003, 0x11210005, 0x11030305, 0x04000005, 0x94, 0x012a00a9 }, - { 228000000, 114000000, 0x0e02, 0x11020005, 0x11210005, 0x11020005, 0x04000005, 0x21, 0x0aaa0555 }, - { 240000000, 120000000, 0x0109, 0x11030002, 0x01050203, 0x11030002, 0x04000003, 0x21, 0x0aaa0555 }, - { 252000000, 126000000, 0x0203, 0x04000005, 0x11050005, 0x04000005, 0x04000002, 0x21, 0x0aaa0555 }, - { 264000000, 132000000, 0x0602, 0x04000005, 0x11050005, 0x04000005, 0x04000002, 0x21, 0x0aaa0555 }, - { 272000000, 116571428, 0x0c02, 0x04000021, 0x02000909, 0x02000221, 0x04000003, 0x73, 0x254a14a9 }, - { 280000000, 120000000, 0x0209, 0x04000021, 0x01030303, 0x02000221, 0x04000003, 0x73, 0x254a14a9 }, - { 288000000, 123428571, 0x0111, 0x04000021, 0x01030303, 0x02000221, 0x04000003, 0x73, 0x254a14a9 }, - { 300000000, 120000000, 0x0009, 0x04000009, 0x01030203, 0x02000902, 0x04000002, 0x52, 0x02520129 } - }; - uint icache_size, ic_lsize; - ulong start, end, dst; - bool ret = FALSE; - - /* get index of the current core */ - idx = sb_coreidx(sbh); - - /* switch to extif or chipc core */ - if ((eir = (extifregs_t *) sb_setcore(sbh, SB_EXTIF, 0))) { - pll_type = PLL_TYPE1; - clockcontrol_n = &eir->clockcontrol_n; - clockcontrol_sb = &eir->clockcontrol_sb; - clockcontrol_pci = &eir->clockcontrol_pci; - } else if ((cc = (chipcregs_t *) sb_setcore(sbh, SB_CC, 0))) { - pll_type = R_REG(&cc->capabilities) & CAP_PLL_MASK; - clockcontrol_n = &cc->clockcontrol_n; - clockcontrol_sb = &cc->clockcontrol_sb; - clockcontrol_pci = &cc->clockcontrol_pci; - } else - goto done; - - /* Store the current clock register values */ - orig_n = R_REG(clockcontrol_n); - orig_sb = R_REG(clockcontrol_sb); - orig_pci = R_REG(clockcontrol_pci); - - if (pll_type == PLL_TYPE1) { - /* Keep the current PCI clock if not specified */ - if (pciclock == 0) { - pciclock = sb_clock_rate(pll_type, R_REG(clockcontrol_n), R_REG(clockcontrol_pci)); - pciclock = (pciclock <= 25000000) ? 25000000 : 33000000; - } - - /* Search for the closest MIPS clock less than or equal to a preferred value */ - for (i = 0; i < ARRAYSIZE(type1_table); i++) { - ASSERT(type1_table[i].mipsclock == - sb_clock_rate(pll_type, type1_table[i].n, type1_table[i].sb)); - if (type1_table[i].mipsclock > mipsclock) - break; - } - if (i == 0) { - ret = FALSE; - goto done; - } else { - ret = TRUE; - i--; - } - ASSERT(type1_table[i].mipsclock <= mipsclock); - - /* No PLL change */ - if ((orig_n == type1_table[i].n) && - (orig_sb == type1_table[i].sb) && - (orig_pci == type1_table[i].pci33)) - goto done; - - /* Set the PLL controls */ - W_REG(clockcontrol_n, type1_table[i].n); - W_REG(clockcontrol_sb, type1_table[i].sb); - if (pciclock == 25000000) - W_REG(clockcontrol_pci, type1_table[i].pci25); - else - W_REG(clockcontrol_pci, type1_table[i].pci33); - - /* Reset */ - sb_watchdog(sbh, 1); - while (1); - } else if ((pll_type == PLL_TYPE2) || (pll_type == PLL_TYPE4)) { - n4m_table_t *table = (pll_type == PLL_TYPE2) ? type2_table : type4_table; - uint tabsz = (pll_type == PLL_TYPE2) ? ARRAYSIZE(type2_table) : ARRAYSIZE(type4_table); - - ASSERT(cc); - - /* Store the current clock register values */ - orig_m2 = R_REG(&cc->clockcontrol_m2); - orig_mips = R_REG(&cc->clockcontrol_mips); - orig_ratio_parm = 0; - - /* Look up current ratio */ - for (i = 0; i < tabsz; i++) { - if ((orig_n == table[i].n) && - (orig_sb == table[i].sb) && - (orig_pci == table[i].pci33) && - (orig_m2 == table[i].m2) && - (orig_mips == table[i].m3)) { - orig_ratio_parm = table[i].ratio_parm; - break; - } - } - - /* Search for the closest MIPS clock greater or equal to a preferred value */ - for (i = 0; i < tabsz; i++) { - ASSERT(table[i].mipsclock == - sb_clock_rate(pll_type, table[i].n, table[i].m3)); - if ((mipsclock <= table[i].mipsclock) && - ((sbclock == 0) || (sbclock <= table[i].sbclock))) - break; - } - if (i == tabsz) { - ret = FALSE; - goto done; - } else { - ret = TRUE; - } - - /* No PLL change */ - if ((orig_n == table[i].n) && - (orig_sb == table[i].sb) && - (orig_pci == table[i].pci33) && - (orig_m2 == table[i].m2) && - (orig_mips == table[i].m3)) - goto done; - - /* Set the PLL controls */ - W_REG(clockcontrol_n, table[i].n); - W_REG(clockcontrol_sb, table[i].sb); - W_REG(clockcontrol_pci, table[i].pci33); - W_REG(&cc->clockcontrol_m2, table[i].m2); - W_REG(&cc->clockcontrol_mips, table[i].m3); - - /* No ratio change */ - if (orig_ratio_parm == table[i].ratio_parm) - goto end_fill; - - new_ratio = table[i].ratio_parm; - - icache_probe(&icache_size, &ic_lsize); - - /* Preload the code into the cache */ - start = ((ulong) &&start_fill) & ~(ic_lsize - 1); - end = ((ulong) &&end_fill + (ic_lsize - 1)) & ~(ic_lsize - 1); - while (start < end) { - cache_unroll(start, Fill_I); - start += ic_lsize; - } - - /* Copy the handler */ - start = (ulong) &handler; - end = (ulong) &afterhandler; - dst = KSEG1ADDR(0x180); - for (i = 0; i < (end - start); i += 4) - *((ulong *)(dst + i)) = *((ulong *)(start + i)); - - /* Preload handler into the cache one line at a time */ - for (i = 0; i < (end - start); i += 4) - cache_unroll(dst + i, Fill_I); - - /* Clear BEV bit */ - MTC0(C0_STATUS, 0, MFC0(C0_STATUS, 0) & ~ST0_BEV); - - /* Enable interrupts */ - MTC0(C0_STATUS, 0, MFC0(C0_STATUS, 0) | (ALLINTS | ST0_IE)); - - /* Enable MIPS timer interrupt */ - if (!(mipsr = sb_setcore(sbh, SB_MIPS, 0)) && - !(mipsr = sb_setcore(sbh, SB_MIPS33, 0))) - ASSERT(mipsr); - W_REG(&mipsr->intmask, 1); - - start_fill: - /* step 1, set clock ratios */ - MTC0(C0_BROADCOM, 3, new_ratio); - MTC0(C0_BROADCOM, 1, 8); - - /* step 2: program timer intr */ - W_REG(&mipsr->timer, 100); - (void) R_REG(&mipsr->timer); - - /* step 3, switch to async */ - sync_mode = MFC0(C0_BROADCOM, 4); - MTC0(C0_BROADCOM, 4, 1 << 22); - - /* step 4, set cfg active */ - MTC0(C0_BROADCOM, 2, 0x9); - - - /* steps 5 & 6 */ - __asm__ __volatile__ ( - ".set\tmips3\n\t" - "wait\n\t" - ".set\tmips0" - ); - - /* step 7, clear cfg_active */ - MTC0(C0_BROADCOM, 2, 0); - - /* Additional Step: set back to orig sync mode */ - MTC0(C0_BROADCOM, 4, sync_mode); - - /* step 8, fake soft reset */ - MTC0(C0_BROADCOM, 5, MFC0(C0_BROADCOM, 5) | 4); - - end_fill: - /* step 9 set watchdog timer */ - sb_watchdog(sbh, 20); - (void) R_REG(&cc->chipid); - - /* step 11 */ - __asm__ __volatile__ ( - ".set\tmips3\n\t" - "sync\n\t" - "wait\n\t" - ".set\tmips0" - ); - while (1); - } - -done: - /* switch back to previous core */ - sb_setcoreidx(sbh, idx); - - return ret; -} - - -/* returns the ncdl value to be programmed into sdram_ncdl for calibration */ -uint32 -sb_memc_get_ncdl(void *sbh) -{ - sbmemcregs_t *memc; - uint32 ret = 0; - uint32 config, rd, wr, misc, dqsg, cd, sm, sd; - uint idx, rev; - - idx = sb_coreidx(sbh); - - memc = (sbmemcregs_t *)sb_setcore(sbh, SB_MEMC, 0); - if (memc == 0) - goto out; - - rev = sb_corerev(sbh); - - config = R_REG(&memc->config); - wr = R_REG(&memc->wrncdlcor); - rd = R_REG(&memc->rdncdlcor); - misc = R_REG(&memc->miscdlyctl); - dqsg = R_REG(&memc->dqsgatencdl); - - rd &= MEMC_RDNCDLCOR_RD_MASK; - wr &= MEMC_WRNCDLCOR_WR_MASK; - dqsg &= MEMC_DQSGATENCDL_G_MASK; - - if (config & MEMC_CONFIG_DDR) { - ret = (wr << 16) | (rd << 8) | dqsg; - } else { - if (rev > 0) - cd = rd; - else - cd = (rd == MEMC_CD_THRESHOLD) ? rd : (wr + MEMC_CD_THRESHOLD); - sm = (misc & MEMC_MISC_SM_MASK) >> MEMC_MISC_SM_SHIFT; - sd = (misc & MEMC_MISC_SD_MASK) >> MEMC_MISC_SD_SHIFT; - ret = (sm << 16) | (sd << 8) | cd; - } - -out: - /* switch back to previous core */ - sb_setcoreidx(sbh, idx); - - return ret; -} diff --git a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/sbpci.c b/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/sbpci.c deleted file mode 100644 index 538dea57ba..0000000000 --- a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/sbpci.c +++ /dev/null @@ -1,557 +0,0 @@ -/* - * Low-Level PCI and SB support for BCM47xx - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* Can free sbpci_init() memory after boot */ -#ifndef linux -#define __init -#endif - -/* Emulated configuration space */ -static pci_config_regs sb_config_regs[SB_MAXCORES]; - -/* Banned cores */ -static uint16 pci_ban[32] = { 0 }; -static uint pci_banned = 0; - -/* CardBus mode */ -static bool cardbus = FALSE; - -/* Disable PCI host core */ -static bool pci_disabled = FALSE; - -/* - * Functions for accessing external PCI configuration space - */ - -/* Assume one-hot slot wiring */ -#define PCI_SLOT_MAX 16 - -static uint32 -config_cmd(void *sbh, uint bus, uint dev, uint func, uint off) -{ - uint coreidx; - sbpciregs_t *regs; - uint32 addr = 0; - - /* CardBusMode supports only one device */ - if (cardbus && dev > 1) - return 0; - - coreidx = sb_coreidx(sbh); - regs = (sbpciregs_t *) sb_setcore(sbh, SB_PCI, 0); - - /* Type 0 transaction */ - if (bus == 1) { - /* Skip unwired slots */ - if (dev < PCI_SLOT_MAX) { - /* Slide the PCI window to the appropriate slot */ - W_REG(®s->sbtopci1, SBTOPCI_CFG0 | ((1 << (dev + 16)) & SBTOPCI1_MASK)); - addr = SB_PCI_CFG | ((1 << (dev + 16)) & ~SBTOPCI1_MASK) | - (func << 8) | (off & ~3); - } - } - - /* Type 1 transaction */ - else { - W_REG(®s->sbtopci1, SBTOPCI_CFG1); - addr = SB_PCI_CFG | (bus << 16) | (dev << 11) | (func << 8) | (off & ~3); - } - - sb_setcoreidx(sbh, coreidx); - - return addr; -} - -static int -extpci_read_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len) -{ - uint32 addr, *reg = NULL, val; - int ret = 0; - - if (pci_disabled || - !(addr = config_cmd(sbh, bus, dev, func, off)) || - !(reg = (uint32 *) REG_MAP(addr, len)) || - BUSPROBE(val, reg)) - val = 0xffffffff; - - val >>= 8 * (off & 3); - if (len == 4) - *((uint32 *) buf) = val; - else if (len == 2) - *((uint16 *) buf) = (uint16) val; - else if (len == 1) - *((uint8 *) buf) = (uint8) val; - else - ret = -1; - - if (reg) - REG_UNMAP(reg); - - return ret; -} - -static int -extpci_write_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len) -{ - uint32 addr, *reg = NULL, val; - int ret = 0; - - if (pci_disabled || - !(addr = config_cmd(sbh, bus, dev, func, off)) || - !(reg = (uint32 *) REG_MAP(addr, len)) || - BUSPROBE(val, reg)) - goto done; - - if (len == 4) - val = *((uint32 *) buf); - else if (len == 2) { - val &= ~(0xffff << (8 * (off & 3))); - val |= *((uint16 *) buf) << (8 * (off & 3)); - } else if (len == 1) { - val &= ~(0xff << (8 * (off & 3))); - val |= *((uint8 *) buf) << (8 * (off & 3)); - } else - ret = -1; - - W_REG(reg, val); - - done: - if (reg) - REG_UNMAP(reg); - - return ret; -} - -/* - * Functions for accessing translated SB configuration space - */ - -static int -sb_read_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len) -{ - pci_config_regs *cfg; - - if (dev >= SB_MAXCORES || (off + len) > sizeof(pci_config_regs)) - return -1; - cfg = &sb_config_regs[dev]; - - ASSERT(ISALIGNED(off, len)); - ASSERT(ISALIGNED(buf, len)); - - if (len == 4) - *((uint32 *) buf) = ltoh32(*((uint32 *)((ulong) cfg + off))); - else if (len == 2) - *((uint16 *) buf) = ltoh16(*((uint16 *)((ulong) cfg + off))); - else if (len == 1) - *((uint8 *) buf) = *((uint8 *)((ulong) cfg + off)); - else - return -1; - - return 0; -} - -static int -sb_write_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len) -{ - uint coreidx, n; - void *regs; - sbconfig_t *sb; - pci_config_regs *cfg; - - if (dev >= SB_MAXCORES || (off + len) > sizeof(pci_config_regs)) - return -1; - cfg = &sb_config_regs[dev]; - - ASSERT(ISALIGNED(off, len)); - ASSERT(ISALIGNED(buf, len)); - - /* Emulate BAR sizing */ - if (off >= OFFSETOF(pci_config_regs, base[0]) && off <= OFFSETOF(pci_config_regs, base[3]) && - len == 4 && *((uint32 *) buf) == ~0) { - coreidx = sb_coreidx(sbh); - if ((regs = sb_setcoreidx(sbh, dev))) { - sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF); - /* Highest numbered address match register */ - n = (R_REG(&sb->sbidlow) & SBIDL_AR_MASK) >> SBIDL_AR_SHIFT; - if (off == OFFSETOF(pci_config_regs, base[0])) - cfg->base[0] = ~(sb_size(R_REG(&sb->sbadmatch0)) - 1); - else if (off == OFFSETOF(pci_config_regs, base[1]) && n >= 1) - cfg->base[1] = ~(sb_size(R_REG(&sb->sbadmatch1)) - 1); - else if (off == OFFSETOF(pci_config_regs, base[2]) && n >= 2) - cfg->base[2] = ~(sb_size(R_REG(&sb->sbadmatch2)) - 1); - else if (off == OFFSETOF(pci_config_regs, base[3]) && n >= 3) - cfg->base[3] = ~(sb_size(R_REG(&sb->sbadmatch3)) - 1); - } - sb_setcoreidx(sbh, coreidx); - return 0; - } - - if (len == 4) - *((uint32 *)((ulong) cfg + off)) = htol32(*((uint32 *) buf)); - else if (len == 2) - *((uint16 *)((ulong) cfg + off)) = htol16(*((uint16 *) buf)); - else if (len == 1) - *((uint8 *)((ulong) cfg + off)) = *((uint8 *) buf); - else - return -1; - - return 0; -} - -int -sbpci_read_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len) -{ - if (bus == 0) - return sb_read_config(sbh, bus, dev, func, off, buf, len); - else - return extpci_read_config(sbh, bus, dev, func, off, buf, len); -} - -int -sbpci_write_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len) -{ - if (bus == 0) - return sb_write_config(sbh, bus, dev, func, off, buf, len); - else - return extpci_write_config(sbh, bus, dev, func, off, buf, len); -} - -void -sbpci_ban(uint16 core) -{ - if (pci_banned < ARRAYSIZE(pci_ban)) - pci_ban[pci_banned++] = core; -} - -int __init -sbpci_init(void *sbh) -{ - uint chip, chiprev, chippkg, coreidx, host, i; - uint32 boardflags; - sbpciregs_t *pci; - sbconfig_t *sb; - pci_config_regs *cfg; - void *regs; - char varname[8]; - uint wlidx = 0; - uint16 vendor, core; - uint8 class, subclass, progif; - uint32 val; - uint32 sbips_int_mask[] = { 0, SBIPS_INT1_MASK, SBIPS_INT2_MASK, SBIPS_INT3_MASK, SBIPS_INT4_MASK }; - uint32 sbips_int_shift[] = { 0, 0, SBIPS_INT2_SHIFT, SBIPS_INT3_SHIFT, SBIPS_INT4_SHIFT }; - - chip = sb_chip(sbh); - chiprev = sb_chiprev(sbh); - chippkg = sb_chippkg(sbh); - coreidx = sb_coreidx(sbh); - - if (!(pci = (sbpciregs_t *) sb_setcore(sbh, SB_PCI, 0))) - return -1; - sb_core_reset(sbh, 0); - - boardflags = (uint32) getintvar(NULL, "boardflags"); - - if ((chip == BCM4310_DEVICE_ID) && (chiprev == 0)) - pci_disabled = TRUE; - - /* - * The 200-pin BCM4712 package does not bond out PCI. Even when - * PCI is bonded out, some boards may leave the pins - * floating. - */ - if (((chip == BCM4712_DEVICE_ID) && - ((chippkg == BCM4712SMALL_PKG_ID) || - (chippkg == BCM4712MID_PKG_ID))) || - (boardflags & BFL_NOPCI)) - pci_disabled = TRUE; - - /* - * If the PCI core should not be touched (disabled, not bonded - * out, or pins floating), do not even attempt to access core - * registers. Otherwise, try to determine if it is in host - * mode. - */ - if (pci_disabled) - host = 0; - else - host = !BUSPROBE(val, &pci->control); - - if (!host) { - /* Disable PCI interrupts in client mode */ - sb = (sbconfig_t *)((ulong) pci + SBCONFIGOFF); - W_REG(&sb->sbintvec, 0); - - /* Disable the PCI bridge in client mode */ - sbpci_ban(SB_PCI); - printf("PCI: Disabled\n"); - } else { - /* Reset the external PCI bus and enable the clock */ - W_REG(&pci->control, 0x5); /* enable the tristate drivers */ - W_REG(&pci->control, 0xd); /* enable the PCI clock */ - OSL_DELAY(150); /* delay > 100 us */ - W_REG(&pci->control, 0xf); /* deassert PCI reset */ - W_REG(&pci->arbcontrol, PCI_INT_ARB); /* use internal arbiter */ - OSL_DELAY(1); /* delay 1 us */ - - /* Enable CardBusMode */ - cardbus = nvram_match("cardbus", "1"); - if (cardbus) { - printf("PCI: Enabling CardBus\n"); - /* GPIO 1 resets the CardBus device on bcm94710ap */ - sb_gpioout(sbh, 1, 1); - sb_gpioouten(sbh, 1, 1); - W_REG(&pci->sprom[0], R_REG(&pci->sprom[0]) | 0x400); - } - - /* 64 MB I/O access window */ - W_REG(&pci->sbtopci0, SBTOPCI_IO); - /* 64 MB configuration access window */ - W_REG(&pci->sbtopci1, SBTOPCI_CFG0); - /* 1 GB memory access window */ - W_REG(&pci->sbtopci2, SBTOPCI_MEM | SB_PCI_DMA); - - /* Enable PCI bridge BAR0 prefetch and burst */ - val = 6; - sbpci_write_config(sbh, 1, 0, 0, PCI_CFG_CMD, &val, sizeof(val)); - - /* Enable PCI interrupts */ - W_REG(&pci->intmask, PCI_INTA); - } - - /* Scan the SB bus */ - bzero(sb_config_regs, sizeof(sb_config_regs)); - for (cfg = sb_config_regs; cfg < &sb_config_regs[SB_MAXCORES]; cfg++) { - cfg->vendor = 0xffff; - if (!(regs = sb_setcoreidx(sbh, cfg - sb_config_regs))) - continue; - sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF); - - /* Read ID register and parse vendor and core */ - val = R_REG(&sb->sbidhigh); - vendor = (val & SBIDH_VC_MASK) >> SBIDH_VC_SHIFT; - core = (val & SBIDH_CC_MASK) >> SBIDH_CC_SHIFT; - progif = 0; - - /* Check if this core is banned */ - for (i = 0; i < pci_banned; i++) - if (core == pci_ban[i]) - break; - if (i < pci_banned) - continue; - - /* Known vendor translations */ - switch (vendor) { - case SB_VEND_BCM: - vendor = VENDOR_BROADCOM; - break; - } - - /* Determine class based on known core codes */ - switch (core) { - case SB_ILINE20: - class = PCI_CLASS_NET; - subclass = PCI_NET_ETHER; - core = BCM47XX_ILINE_ID; - break; - case SB_ILINE100: - class = PCI_CLASS_NET; - subclass = PCI_NET_ETHER; - core = BCM4610_ILINE_ID; - break; - case SB_ENET: - class = PCI_CLASS_NET; - subclass = PCI_NET_ETHER; - core = BCM47XX_ENET_ID; - break; - case SB_SDRAM: - case SB_MEMC: - class = PCI_CLASS_MEMORY; - subclass = PCI_MEMORY_RAM; - break; - case SB_PCI: - class = PCI_CLASS_BRIDGE; - subclass = PCI_BRIDGE_PCI; - break; - case SB_MIPS: - case SB_MIPS33: - class = PCI_CLASS_CPU; - subclass = PCI_CPU_MIPS; - break; - case SB_CODEC: - class = PCI_CLASS_COMM; - subclass = PCI_COMM_MODEM; - core = BCM47XX_V90_ID; - break; - case SB_USB: - class = PCI_CLASS_SERIAL; - subclass = PCI_SERIAL_USB; - progif = 0x10; /* OHCI */ - core = BCM47XX_USB_ID; - break; - case SB_USB11H: - class = PCI_CLASS_SERIAL; - subclass = PCI_SERIAL_USB; - progif = 0x10; /* OHCI */ - core = BCM47XX_USBH_ID; - break; - case SB_USB11D: - class = PCI_CLASS_SERIAL; - subclass = PCI_SERIAL_USB; - core = BCM47XX_USBD_ID; - break; - case SB_IPSEC: - class = PCI_CLASS_CRYPT; - subclass = PCI_CRYPT_NETWORK; - core = BCM47XX_IPSEC_ID; - break; - case SB_EXTIF: - case SB_CC: - class = PCI_CLASS_MEMORY; - subclass = PCI_MEMORY_FLASH; - break; - case SB_D11: - class = PCI_CLASS_NET; - subclass = PCI_NET_OTHER; - /* Let an nvram variable override this */ - sprintf(varname, "wl%did", wlidx); - wlidx++; - if ((core = getintvar(NULL, varname)) == 0) { - if (chip == BCM4712_DEVICE_ID) { - if (chippkg == BCM4712SMALL_PKG_ID) - core = BCM4306_D11G_ID; - else - core = BCM4306_D11DUAL_ID; - } else { - /* 4310 */ - core = BCM4310_D11B_ID; - } - } - break; - - default: - class = subclass = progif = 0xff; - break; - } - - /* Supported translations */ - cfg->vendor = htol16(vendor); - cfg->device = htol16(core); - cfg->rev_id = chiprev; - cfg->prog_if = progif; - cfg->sub_class = subclass; - cfg->base_class = class; - cfg->base[0] = htol32(sb_base(R_REG(&sb->sbadmatch0))); - cfg->base[1] = htol32(sb_base(R_REG(&sb->sbadmatch1))); - cfg->base[2] = htol32(sb_base(R_REG(&sb->sbadmatch2))); - cfg->base[3] = htol32(sb_base(R_REG(&sb->sbadmatch3))); - cfg->base[4] = 0; - cfg->base[5] = 0; - if (class == PCI_CLASS_BRIDGE && subclass == PCI_BRIDGE_PCI) - cfg->header_type = PCI_HEADER_BRIDGE; - else - cfg->header_type = PCI_HEADER_NORMAL; - /* Save core interrupt flag */ - cfg->int_pin = R_REG(&sb->sbtpsflag) & SBTPS_NUM0_MASK; - /* Default to MIPS shared interrupt 0 */ - cfg->int_line = 0; - /* MIPS sbipsflag maps core interrupt flags to interrupts 1 through 4 */ - if ((regs = sb_setcore(sbh, SB_MIPS, 0)) || - (regs = sb_setcore(sbh, SB_MIPS33, 0))) { - sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF); - val = R_REG(&sb->sbipsflag); - for (cfg->int_line = 1; cfg->int_line <= 4; cfg->int_line++) { - if (((val & sbips_int_mask[cfg->int_line]) >> sbips_int_shift[cfg->int_line]) == cfg->int_pin) - break; - } - if (cfg->int_line > 4) - cfg->int_line = 0; - } - /* Emulated core */ - *((uint32 *) &cfg->sprom_control) = 0xffffffff; - } - - sb_setcoreidx(sbh, coreidx); - return 0; -} - -void -sbpci_check(void *sbh) -{ - uint coreidx; - sbpciregs_t *pci; - uint32 sbtopci1; - uint32 buf[64], *ptr, i; - ulong pa; - volatile uint j; - - coreidx = sb_coreidx(sbh); - pci = (sbpciregs_t *) sb_setcore(sbh, SB_PCI, 0); - - /* Clear the test array */ - pa = (ulong) DMA_MAP(NULL, buf, sizeof(buf), DMA_RX, NULL); - ptr = (uint32 *) OSL_UNCACHED(&buf[0]); - memset(ptr, 0, sizeof(buf)); - - /* Point PCI window 1 to memory */ - sbtopci1 = R_REG(&pci->sbtopci1); - W_REG(&pci->sbtopci1, SBTOPCI_MEM | (pa & SBTOPCI1_MASK)); - - /* Fill the test array via PCI window 1 */ - ptr = (uint32 *) REG_MAP(SB_PCI_CFG + (pa & ~SBTOPCI1_MASK), sizeof(buf)); - for (i = 0; i < ARRAYSIZE(buf); i++) { - for (j = 0; j < 2; j++); - W_REG(&ptr[i], i); - } - REG_UNMAP(ptr); - - /* Restore PCI window 1 */ - W_REG(&pci->sbtopci1, sbtopci1); - - /* Check the test array */ - DMA_UNMAP(NULL, pa, sizeof(buf), DMA_RX, NULL); - ptr = (uint32 *) OSL_UNCACHED(&buf[0]); - for (i = 0; i < ARRAYSIZE(buf); i++) { - if (ptr[i] != i) - break; - } - - /* Change the clock if the test fails */ - if (i < ARRAYSIZE(buf)) { - uint32 req, cur; - - cur = sb_clock(sbh); - printf("PCI: Test failed at %d MHz\n", (cur + 500000) / 1000000); - for (req = 104000000; req < 176000000; req += 4000000) { - printf("PCI: Resetting to %d MHz\n", (req + 500000) / 1000000); - /* This will only reset if the clocks are valid and have changed */ - sb_mips_setclock(sbh, req, 0, 0); - } - /* Should not reach here */ - ASSERT(0); - } - - sb_setcoreidx(sbh, coreidx); -} diff --git a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/setup.c b/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/setup.c deleted file mode 100644 index 2132c00837..0000000000 --- a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/setup.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Generic setup routines for Broadcom MIPS boards - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef CONFIG_MTD_PARTITIONS -#include -#include -#endif - -#include -#include -#include -#include -#include -#include - -extern void bcm947xx_time_init(void); -extern void bcm947xx_timer_setup(struct irqaction *irq); - -#ifdef CONFIG_REMOTE_DEBUG -extern void set_debug_traps(void); -extern void rs_kgdb_hook(struct serial_state *); -extern void breakpoint(void); -#endif - -#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) -extern struct ide_ops std_ide_ops; -#endif - -/* Global SB handle */ -void *bcm947xx_sbh = NULL; -spinlock_t bcm947xx_sbh_lock = SPIN_LOCK_UNLOCKED; -EXPORT_SYMBOL(bcm947xx_sbh); -EXPORT_SYMBOL(bcm947xx_sbh_lock); - -/* Convenience */ -#define sbh bcm947xx_sbh -#define sbh_lock bcm947xx_sbh_lock - -/* Kernel command line */ -char arcs_cmdline[CL_SIZE] __initdata = CONFIG_CMDLINE; - -void -bcm947xx_machine_restart(char *command) -{ - printk("Please stand by while rebooting the system...\n"); - - /* Set the watchdog timer to reset immediately */ - __cli(); - sb_watchdog(sbh, 1); - while (1); -} - -void -bcm947xx_machine_halt(void) -{ - printk("System halted\n"); - - /* Disable interrupts and watchdog and spin forever */ - __cli(); - sb_watchdog(sbh, 0); - while (1); -} - -#ifdef CONFIG_SERIAL - -static struct serial_struct rs = { - line: 0, - flags: ASYNC_BOOT_AUTOCONF, - io_type: SERIAL_IO_MEM, -}; - -static void __init -serial_add(void *regs, uint irq, uint baud_base, uint reg_shift) -{ - rs.iomem_base = regs; - rs.irq = irq + 2; - rs.baud_base = baud_base / 16; - rs.iomem_reg_shift = reg_shift; - - early_serial_setup(&rs); - - rs.line++; -} - -static void __init -serial_setup(void *sbh) -{ - sb_serial_init(sbh, serial_add); - -#ifdef CONFIG_REMOTE_DEBUG - /* Use the last port for kernel debugging */ - if (rs.iomem_base) - rs_kgdb_hook(&rs); -#endif -} - -#endif /* CONFIG_SERIAL */ - -void __init -brcm_setup(void) -{ - char *value; - - /* Get global SB handle */ - sbh = sb_kattach(); - - /* Initialize clocks and interrupts */ - sb_mips_init(sbh); - -#ifdef CONFIG_SERIAL - /* Initialize UARTs */ - serial_setup(sbh); -#endif - -#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) - ide_ops = &std_ide_ops; -#endif - - /* Override default command line arguments */ - value = nvram_get("kernel_args"); - if (value && strlen(value) && strncmp(value, "empty", 5)) - strncpy(arcs_cmdline, value, sizeof(arcs_cmdline)); - - - /* Generic setup */ - _machine_restart = bcm947xx_machine_restart; - _machine_halt = bcm947xx_machine_halt; - _machine_power_off = bcm947xx_machine_halt; - - board_time_init = bcm947xx_time_init; - board_timer_setup = bcm947xx_timer_setup; -} - -const char * -get_system_type(void) -{ - return "Broadcom BCM947XX"; -} - -void __init -bus_error_init(void) -{ -} - -#ifdef CONFIG_MTD_PARTITIONS - -static struct mtd_partition bcm947xx_parts[] = { - { name: "pmon", offset: 0, size: 0, mask_flags: MTD_WRITEABLE, }, - { name: "linux", offset: 0, size: 0, }, - { name: "rootfs", offset: 0, size: 0, }, - { name: "nvram", offset: 0, size: 0, }, - { name: "OpenWrt", offset: 0, size: 0, }, - { name: NULL, }, -}; - -static int __init -find_root(struct mtd_info *mtd, size_t size, struct mtd_partition *part) -{ - struct trx_header *trx; - unsigned char buf[512]; - int off; - size_t len; - - trx = (struct trx_header *) buf; - - for (off = (256*1024); off < size; off += mtd->erasesize) { - memset(buf, 0xe5, sizeof(buf)); - - /* - * Read into buffer - */ - if (MTD_READ(mtd, off, sizeof(buf), &len, buf) || - len != sizeof(buf)) - continue; - - /* found a TRX header */ - if (le32_to_cpu(trx->magic) == TRX_MAGIC) { - part->offset = le32_to_cpu(trx->offsets[2]) ? : - le32_to_cpu(trx->offsets[1]); - part->size = le32_to_cpu(trx->len); - - part->size -= part->offset; - part->offset += off; - - goto done; - } - } - - printk(KERN_NOTICE - "%s: Couldn't find root filesystem\n", - mtd->name); - return -1; - - done: - return part->size; -} - -struct mtd_partition * __init -init_mtd_partitions(struct mtd_info *mtd, size_t size) -{ - - /* boot loader */ - bcm947xx_parts[0].offset=0; - bcm947xx_parts[0].size=256*1024; - - /* nvram */ - bcm947xx_parts[3].offset = size - ROUNDUP(NVRAM_SPACE, mtd->erasesize); - bcm947xx_parts[3].size = size - bcm947xx_parts[3].offset; - - /* Size linux (kernel and rootfs) */ - bcm947xx_parts[1].offset = bcm947xx_parts[0].size; - bcm947xx_parts[1].size = bcm947xx_parts[3].offset - bcm947xx_parts[1].offset; - - /* Find and size rootfs */ - if (find_root(mtd,size,&bcm947xx_parts[2])==0) { - /* entirely jffs2 */ - bcm947xx_parts[2].size = bcm947xx_parts[3].offset - bcm947xx_parts[2].offset; - bcm947xx_parts[4].name = NULL; - } else { - /* legacy setup */ - /* calculate leftover flash, and assign it to the jffs2 partition */ - bcm947xx_parts[4].offset = bcm947xx_parts[2].offset + bcm947xx_parts[2].size; - bcm947xx_parts[4].offset = ROUNDUP(bcm947xx_parts[4].offset, mtd->erasesize); - bcm947xx_parts[4].size = bcm947xx_parts[3].offset - bcm947xx_parts[4].offset; - } - - return bcm947xx_parts; -} - -EXPORT_SYMBOL(init_mtd_partitions); - -#endif diff --git a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/sflash.c b/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/sflash.c deleted file mode 100644 index 4f69880cac..0000000000 --- a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/sflash.c +++ /dev/null @@ -1,346 +0,0 @@ -/* - * Broadcom SiliconBackplane chipcommon serial flash interface - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#include -#include -#include -#include -#include - -/* Private global state */ -static struct sflash sflash; - -/* Issue a serial flash command */ -static INLINE void -sflash_cmd(chipcregs_t *cc, uint opcode) -{ - W_REG(&cc->flashcontrol, SFLASH_START | opcode); - while (R_REG(&cc->flashcontrol) & SFLASH_BUSY); -} - -/* Initialize serial flash access */ -struct sflash * -sflash_init(chipcregs_t *cc) -{ - uint32 id, id2; - - bzero(&sflash, sizeof(sflash)); - - sflash.type = R_REG(&cc->capabilities) & CAP_FLASH_MASK; - - switch (sflash.type) { - case SFLASH_ST: - /* Probe for ST chips */ - sflash_cmd(cc, SFLASH_ST_DP); - sflash_cmd(cc, SFLASH_ST_RES); - id = R_REG(&cc->flashdata); - switch (id) { - case 0x11: - /* ST M25P20 2 Mbit Serial Flash */ - sflash.blocksize = 64 * 1024; - sflash.numblocks = 4; - break; - case 0x12: - /* ST M25P40 4 Mbit Serial Flash */ - sflash.blocksize = 64 * 1024; - sflash.numblocks = 8; - break; - case 0x13: - /* ST M25P80 8 Mbit Serial Flash */ - sflash.blocksize = 64 * 1024; - sflash.numblocks = 16; - break; - case 0x14: - /* ST M25P16 16 Mbit Serial Flash */ - sflash.blocksize = 64 * 1024; - sflash.numblocks = 32; - break; - case 0xbf: - W_REG(&cc->flashaddress, 1); - sflash_cmd(cc, SFLASH_ST_RES); - id2 = R_REG(&cc->flashdata); - if (id2 == 0x44) { - /* SST M25VF80 4 Mbit Serial Flash */ - sflash.blocksize = 64 * 1024; - sflash.numblocks = 8; - } - break; - } - break; - - case SFLASH_AT: - /* Probe for Atmel chips */ - sflash_cmd(cc, SFLASH_AT_STATUS); - id = R_REG(&cc->flashdata) & 0x3c; - switch (id) { - case 0x2c: - /* Atmel AT45DB161 16Mbit Serial Flash */ - sflash.blocksize = 512; - sflash.numblocks = 4096; - break; - case 0x34: - /* Atmel AT45DB321 32Mbit Serial Flash */ - sflash.blocksize = 512; - sflash.numblocks = 8192; - break; - case 0x3c: - /* Atmel AT45DB642 64Mbit Serial Flash */ - sflash.blocksize = 1024; - sflash.numblocks = 8192; - break; - } - break; - } - - sflash.size = sflash.blocksize * sflash.numblocks; - return sflash.size ? &sflash : NULL; -} - -/* Read len bytes starting at offset into buf. Returns number of bytes read. */ -int -sflash_read(chipcregs_t *cc, uint offset, uint len, uchar *buf) -{ - int cnt; - uint32 *from, *to; - - if (!len) - return 0; - - if ((offset + len) > sflash.size) - return -22; - - if ((len >= 4) && (offset & 3)) - cnt = 4 - (offset & 3); - else if ((len >= 4) && ((uint32)buf & 3)) - cnt = 4 - ((uint32)buf & 3); - else - cnt = len; - - from = (uint32 *)(CC_FLASH_BASE + offset); - to = (uint32 *)buf; - - if (cnt < 4) { - bcopy(from, to, cnt); - return cnt; - } - - while (cnt >= 4) { - *to++ = *from++; - cnt -= 4; - } - - return (len - cnt); -} - -/* Poll for command completion. Returns zero when complete. */ -int -sflash_poll(chipcregs_t *cc, uint offset) -{ - if (offset >= sflash.size) - return -22; - - switch (sflash.type) { - case SFLASH_ST: - /* Check for ST Write In Progress bit */ - sflash_cmd(cc, SFLASH_ST_RDSR); - return R_REG(&cc->flashdata) & SFLASH_ST_WIP; - case SFLASH_AT: - /* Check for Atmel Ready bit */ - sflash_cmd(cc, SFLASH_AT_STATUS); - return !(R_REG(&cc->flashdata) & SFLASH_AT_READY); - } - - return 0; -} - -/* Write len bytes starting at offset into buf. Returns number of bytes - * written. Caller should poll for completion. - */ -int -sflash_write(chipcregs_t *cc, uint offset, uint len, const uchar *buf) -{ - struct sflash *sfl; - int ret = 0; - uint32 page, byte, mask; - - if (!len) - return 0; - - if ((offset + len) > sflash.size) - return -22; - - sfl = &sflash; - switch (sfl->type) { - case SFLASH_ST: - ret = 1; - /* Enable writes */ - sflash_cmd(cc, SFLASH_ST_WREN); - W_REG(&cc->flashaddress, offset); - W_REG(&cc->flashdata, *buf); - /* Page program */ - sflash_cmd(cc, SFLASH_ST_PP); - break; - case SFLASH_AT: - mask = sfl->blocksize - 1; - page = (offset & ~mask) << 1; - byte = offset & mask; - /* Read main memory page into buffer 1 */ - if (byte || len < sfl->blocksize) { - W_REG(&cc->flashaddress, page); - sflash_cmd(cc, SFLASH_AT_BUF1_LOAD); - /* 250 us for AT45DB321B */ - SPINWAIT(sflash_poll(cc, offset), 1000); - ASSERT(!sflash_poll(cc, offset)); - } - /* Write into buffer 1 */ - for (ret = 0; ret < len && byte < sfl->blocksize; ret++) { - W_REG(&cc->flashaddress, byte++); - W_REG(&cc->flashdata, *buf++); - sflash_cmd(cc, SFLASH_AT_BUF1_WRITE); - } - /* Write buffer 1 into main memory page */ - W_REG(&cc->flashaddress, page); - sflash_cmd(cc, SFLASH_AT_BUF1_PROGRAM); - break; - } - - return ret; -} - -/* Erase a region. Returns number of bytes scheduled for erasure. - * Caller should poll for completion. - */ -int -sflash_erase(chipcregs_t *cc, uint offset) -{ - struct sflash *sfl; - - if (offset >= sflash.size) - return -22; - - sfl = &sflash; - switch (sfl->type) { - case SFLASH_ST: - sflash_cmd(cc, SFLASH_ST_WREN); - W_REG(&cc->flashaddress, offset); - sflash_cmd(cc, SFLASH_ST_SE); - return sfl->blocksize; - case SFLASH_AT: - W_REG(&cc->flashaddress, offset << 1); - sflash_cmd(cc, SFLASH_AT_PAGE_ERASE); - return sfl->blocksize; - } - - return 0; -} - -/* - * writes the appropriate range of flash, a NULL buf simply erases - * the region of flash - */ -int -sflash_commit(chipcregs_t *cc, uint offset, uint len, const uchar *buf) -{ - struct sflash *sfl; - uchar *block = NULL, *cur_ptr, *blk_ptr; - uint blocksize = 0, mask, cur_offset, cur_length, cur_retlen, remainder; - uint blk_offset, blk_len, copied; - int bytes, ret = 0; - - /* Check address range */ - if (len <= 0) - return 0; - - sfl = &sflash; - if ((offset + len) > sfl->size) - return -1; - - blocksize = sfl->blocksize; - mask = blocksize - 1; - - /* Allocate a block of mem */ - if (!(block = MALLOC(blocksize))) - return -1; - - while (len) { - /* Align offset */ - cur_offset = offset & ~mask; - cur_length = blocksize; - cur_ptr = block; - - remainder = blocksize - (offset & mask); - if (len < remainder) - cur_retlen = len; - else - cur_retlen = remainder; - - /* buf == NULL means erase only */ - if (buf) { - /* Copy existing data into holding block if necessary */ - if ((offset & mask) || (len < blocksize)) { - blk_offset = cur_offset; - blk_len = cur_length; - blk_ptr = cur_ptr; - - /* Copy entire block */ - while(blk_len) { - copied = sflash_read(cc, blk_offset, blk_len, blk_ptr); - blk_offset += copied; - blk_len -= copied; - blk_ptr += copied; - } - } - - /* Copy input data into holding block */ - memcpy(cur_ptr + (offset & mask), buf, cur_retlen); - } - - /* Erase block */ - if ((ret = sflash_erase(cc, (uint) cur_offset)) < 0) - goto done; - while (sflash_poll(cc, (uint) cur_offset)); - - /* buf == NULL means erase only */ - if (!buf) { - offset += cur_retlen; - len -= cur_retlen; - continue; - } - - /* Write holding block */ - while (cur_length > 0) { - if ((bytes = sflash_write(cc, - (uint) cur_offset, - (uint) cur_length, - (uchar *) cur_ptr)) < 0) { - ret = bytes; - goto done; - } - while (sflash_poll(cc, (uint) cur_offset)); - cur_offset += bytes; - cur_length -= bytes; - cur_ptr += bytes; - } - - offset += cur_retlen; - len -= cur_retlen; - buf += cur_retlen; - } - -done: - if (block) - MFREE(block, blocksize); - return ret; -} - diff --git a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/time.c b/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/time.c deleted file mode 100644 index 9b7574663d..0000000000 --- a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/bcm947xx/time.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -/* Global SB handle */ -extern void *bcm947xx_sbh; -extern spinlock_t bcm947xx_sbh_lock; - -/* Convenience */ -#define sbh bcm947xx_sbh -#define sbh_lock bcm947xx_sbh_lock - -extern int panic_timeout; -static int watchdog = 0; -static u8 *mcr = NULL; - -void __init -bcm947xx_time_init(void) -{ - unsigned int hz; - extifregs_t *eir; - - /* - * Use deterministic values for initial counter interrupt - * so that calibrate delay avoids encountering a counter wrap. - */ - write_c0_count(0); - write_c0_compare(0xffff); - - if (!(hz = sb_mips_clock(sbh))) - hz = 100000000; - - printk("CPU: BCM%04x rev %d at %d MHz\n", sb_chip(sbh), sb_chiprev(sbh), - (hz + 500000) / 1000000); - - /* Set MIPS counter frequency for fixed_rate_gettimeoffset() */ - mips_hpt_frequency = hz / 2; - - /* Set watchdog interval in ms */ - watchdog = simple_strtoul(nvram_safe_get("watchdog"), NULL, 0); - - /* Please set the watchdog to 3 sec if it is less than 3 but not equal to 0 */ - if (watchdog > 0) { - if (watchdog < 3000) - watchdog = 3000; - } - - - /* Set panic timeout in seconds */ - panic_timeout = watchdog / 1000; - - /* Setup blink */ - if ((eir = sb_setcore(sbh, SB_EXTIF, 0))) { - sbconfig_t *sb = (sbconfig_t *)((unsigned int) eir + SBCONFIGOFF); - unsigned long base = EXTIF_CFGIF_BASE(sb_base(readl(&sb->sbadmatch1))); - mcr = (u8 *) ioremap_nocache(base + UART_MCR, 1); - } -} - -static void -bcm947xx_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) -{ - /* Generic MIPS timer code */ - timer_interrupt(irq, dev_id, regs); - - /* Set the watchdog timer to reset after the specified number of ms */ - if (watchdog > 0) - sb_watchdog(sbh, WATCHDOG_CLOCK / 1000 * watchdog); - -#ifdef CONFIG_HWSIM - (*((int *)0xa0000f1c))++; -#else - /* Blink one of the LEDs in the external UART */ - if (mcr && !(jiffies % (HZ/2))) - writeb(readb(mcr) ^ UART_MCR_OUT2, mcr); -#endif -} - -static struct irqaction bcm947xx_timer_irqaction = { - bcm947xx_timer_interrupt, - SA_INTERRUPT, - 0, - "timer", - NULL, - NULL -}; - -void __init -bcm947xx_timer_setup(struct irqaction *irq) -{ - /* Enable the timer interrupt */ - setup_irq(7, &bcm947xx_timer_irqaction); -} diff --git a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/generic/Makefile b/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/generic/Makefile deleted file mode 100644 index e16a80e56b..0000000000 --- a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/generic/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# -# Makefile for generic Broadcom MIPS boards -# -# Copyright 2004, Broadcom Corporation -# All Rights Reserved. -# -# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY -# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM -# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. -# -# $Id$ -# - -.S.s: - $(CPP) $(AFLAGS) $< -o $*.s -.S.o: - $(CC) $(AFLAGS) -c $< -o $*.o - -O_TARGET := brcm.o - -obj-y := int-handler.o irq.o - -obj-$(CONFIG_REMOTE_DEBUG) += gdb_hook.o - -include $(TOPDIR)/Rules.make diff --git a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/generic/gdb_hook.c b/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/generic/gdb_hook.c deleted file mode 100644 index 1345289bbc..0000000000 --- a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/generic/gdb_hook.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * Carsten Langgaard, carstenl@mips.com - * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. - * - * ######################################################################## - * - * This program is free software; you can distribute 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 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. - * - * ######################################################################## - * - * This is the interface to the remote debugger stub. - * - */ - -#include -#include - -#include -#include - -static struct async_struct kdb_port_info = {0}; - -static __inline__ unsigned int serial_in(struct async_struct *info, int offset) -{ - return readb((unsigned long) info->iomem_base + - (offset<iomem_reg_shift)); -} - -static __inline__ void serial_out(struct async_struct *info, int offset, - int value) -{ - writeb(value, (unsigned long) info->iomem_base + - (offset<iomem_reg_shift)); -} - -void rs_kgdb_hook(struct serial_state *ser) { - int t; - - kdb_port_info.state = ser; - kdb_port_info.magic = SERIAL_MAGIC; - kdb_port_info.port = ser->port; - kdb_port_info.flags = ser->flags; - kdb_port_info.iomem_base = ser->iomem_base; - kdb_port_info.iomem_reg_shift = ser->iomem_reg_shift; - kdb_port_info.MCR = UART_MCR_DTR | UART_MCR_RTS; - - /* - * Clear all interrupts - */ - serial_in(&kdb_port_info, UART_LSR); - serial_in(&kdb_port_info, UART_RX); - serial_in(&kdb_port_info, UART_IIR); - serial_in(&kdb_port_info, UART_MSR); - - /* - * Now, initialize the UART - */ - serial_out(&kdb_port_info, UART_LCR, UART_LCR_WLEN8); /* reset DLAB */ - serial_out(&kdb_port_info, UART_MCR, kdb_port_info.MCR); - - /* - * and set the speed of the serial port - * (currently hardwired to 115200 8N1 - */ - - /* baud rate is fixed to 115200 (is this sufficient?)*/ - t = kdb_port_info.state->baud_base / 115200; - /* set DLAB */ - serial_out(&kdb_port_info, UART_LCR, UART_LCR_WLEN8 | UART_LCR_DLAB); - serial_out(&kdb_port_info, UART_DLL, t & 0xff);/* LS of divisor */ - serial_out(&kdb_port_info, UART_DLM, t >> 8); /* MS of divisor */ - /* reset DLAB */ - serial_out(&kdb_port_info, UART_LCR, UART_LCR_WLEN8); -} - -int putDebugChar(char c) -{ - - if (!kdb_port_info.state) { /* need to init device first */ - return 0; - } - - while ((serial_in(&kdb_port_info, UART_LSR) & UART_LSR_THRE) == 0) - ; - - serial_out(&kdb_port_info, UART_TX, c); - - return 1; -} - -char getDebugChar(void) -{ - if (!kdb_port_info.state) { /* need to init device first */ - return 0; - } - - while (!(serial_in(&kdb_port_info, UART_LSR) & 1)) - ; - - return(serial_in(&kdb_port_info, UART_RX)); -} diff --git a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/generic/int-handler.S b/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/generic/int-handler.S deleted file mode 100644 index de8f115c29..0000000000 --- a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/generic/int-handler.S +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Generic interrupt handler for Broadcom MIPS boards - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#include - -#include -#include -#include -#include - -/* - * MIPS IRQ Source - * -------- ------ - * 0 Software (ignored) - * 1 Software (ignored) - * 2 Combined hardware interrupt (hw0) - * 3 Hardware - * 4 Hardware - * 5 Hardware - * 6 Hardware - * 7 R4k timer - */ - - .text - .set noreorder - .set noat - .align 5 - NESTED(brcmIRQ, PT_SIZE, sp) - SAVE_ALL - CLI - .set at - .set noreorder - - jal brcm_irq_dispatch - move a0, sp - - j ret_from_irq - nop - - END(brcmIRQ) diff --git a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/generic/irq.c b/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/generic/irq.c deleted file mode 100644 index 157c6b3803..0000000000 --- a/openwrt/package/linux/kernel-source/arch/mips/brcm-boards/generic/irq.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Generic interrupt control functions for Broadcom MIPS boards - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5) - -extern asmlinkage void brcmIRQ(void); -extern asmlinkage unsigned int do_IRQ(int irq, struct pt_regs *regs); - -void -brcm_irq_dispatch(struct pt_regs *regs) -{ - u32 cause; - - cause = read_c0_cause() & - read_c0_status() & - CAUSEF_IP; - -#ifdef CONFIG_KERNPROF - change_c0_status(cause | 1, 1); -#else - clear_c0_status(cause); -#endif - - if (cause & CAUSEF_IP7) - do_IRQ(7, regs); - if (cause & CAUSEF_IP2) - do_IRQ(2, regs); - if (cause & CAUSEF_IP3) - do_IRQ(3, regs); - if (cause & CAUSEF_IP4) - do_IRQ(4, regs); - if (cause & CAUSEF_IP5) - do_IRQ(5, regs); - if (cause & CAUSEF_IP6) - do_IRQ(6, regs); -} - -static void -enable_brcm_irq(unsigned int irq) -{ - if (irq < 8) - set_c0_status(1 << (irq + 8)); - else - set_c0_status(IE_IRQ0); -} - -static void -disable_brcm_irq(unsigned int irq) -{ - if (irq < 8) - clear_c0_status(1 << (irq + 8)); - else - clear_c0_status(IE_IRQ0); -} - -static void -ack_brcm_irq(unsigned int irq) -{ - /* Already done in brcm_irq_dispatch */ -} - -static unsigned int -startup_brcm_irq(unsigned int irq) -{ - enable_brcm_irq(irq); - - return 0; /* never anything pending */ -} - -static void -end_brcm_irq(unsigned int irq) -{ - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) - enable_brcm_irq(irq); -} - -static struct hw_interrupt_type brcm_irq_type = { - typename: "MIPS", - startup: startup_brcm_irq, - shutdown: disable_brcm_irq, - enable: enable_brcm_irq, - disable: disable_brcm_irq, - ack: ack_brcm_irq, - end: end_brcm_irq, - NULL -}; - -void __init -init_IRQ(void) -{ - int i; - - for (i = 0; i < NR_IRQS; i++) { - irq_desc[i].status = IRQ_DISABLED; - irq_desc[i].action = 0; - irq_desc[i].depth = 1; - irq_desc[i].handler = &brcm_irq_type; - } - - set_except_vector(0, brcmIRQ); - change_c0_status(ST0_IM, ALLINTS); - -#ifdef CONFIG_REMOTE_DEBUG - printk("Breaking into debugger...\n"); - set_debug_traps(); - breakpoint(); -#endif -} diff --git a/openwrt/package/linux/kernel-source/drivers/mtd/chips/cfi_cmdset_0701.c b/openwrt/package/linux/kernel-source/drivers/mtd/chips/cfi_cmdset_0701.c deleted file mode 100644 index 5087477bbf..0000000000 --- a/openwrt/package/linux/kernel-source/drivers/mtd/chips/cfi_cmdset_0701.c +++ /dev/null @@ -1,855 +0,0 @@ -/* - * Common Flash Interface support: - * SST Standard Vendor Command Set (ID 0x0701) - * - * Copyright (C) 2000 Crossnet Co. - * - * 2_by_8 routines added by Simon Munton - * - * This code is GPL - * - * $Id$ - * - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -static int cfi_sststd_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); -static int cfi_sststd_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); -static int cfi_sststd_erase_onesize(struct mtd_info *, struct erase_info *); -static int cfi_sststd_erase_varsize(struct mtd_info *, struct erase_info *); -static void cfi_sststd_sync (struct mtd_info *); -static int cfi_sststd_suspend (struct mtd_info *); -static void cfi_sststd_resume (struct mtd_info *); - -static void cfi_sststd_destroy(struct mtd_info *); - -struct mtd_info *cfi_cmdset_0701(struct map_info *, int); -static struct mtd_info *cfi_sststd_setup (struct map_info *); - - -static struct mtd_chip_driver cfi_sststd_chipdrv = { - probe: NULL, /* Not usable directly */ - destroy: cfi_sststd_destroy, - name: "cfi_cmdset_0701", - module: THIS_MODULE -}; - -struct mtd_info *cfi_cmdset_0701(struct map_info *map, int primary) -{ - struct cfi_private *cfi = map->fldrv_priv; - int ofs_factor = cfi->interleave * cfi->device_type; - int i; - __u8 major, minor; - __u32 base = cfi->chips[0].start; - - if (cfi->cfi_mode==1){ - __u16 adr = primary?cfi->cfiq->P_ADR:cfi->cfiq->A_ADR; - - cfi_send_gen_cmd(0xAA, 0x5555, base, map, cfi, cfi->device_type, NULL); - cfi_send_gen_cmd(0x55, 0x2AAA, base, map, cfi, cfi->device_type, NULL); - cfi_send_gen_cmd(0x98, 0x5555, base, map, cfi, cfi->device_type, NULL); - - major = cfi_read_query(map, base + (adr+3)*ofs_factor); - minor = cfi_read_query(map, base + (adr+4)*ofs_factor); - - printk(" SST Query Table v%c.%c at 0x%4.4X\n", - major, minor, adr); - cfi_send_gen_cmd(0xf0, 0x5555, base, map, cfi, cfi->device_type, NULL); - - cfi_send_gen_cmd(0xAA, 0x5555, base, map, cfi, cfi->device_type, NULL); - cfi_send_gen_cmd(0x55, 0x2AAA, base, map, cfi, cfi->device_type, NULL); - cfi_send_gen_cmd(0x90, 0x5555, base, map, cfi, cfi->device_type, NULL); - cfi->mfr = cfi_read_query(map, base); - cfi->id = cfi_read_query(map, base + ofs_factor); - - cfi_send_gen_cmd(0xAA, 0x5555, base, map, cfi, cfi->device_type, NULL); - cfi_send_gen_cmd(0x55, 0x2AAA, base, map, cfi, cfi->device_type, NULL); - cfi_send_gen_cmd(0x98, 0x5555, base, map, cfi, cfi->device_type, NULL); - - switch (cfi->device_type) { - case CFI_DEVICETYPE_X16: - cfi->addr_unlock1 = 0x5555; - cfi->addr_unlock2 = 0x2AAA; - break; - default: - printk(KERN_NOTICE "Eep. Unknown cfi_cmdset_0701 device type %d\n", cfi->device_type); - return NULL; - } - } /* CFI mode */ - - for (i=0; i< cfi->numchips; i++) { - cfi->chips[i].word_write_time = 1<cfiq->WordWriteTimeoutTyp; - cfi->chips[i].buffer_write_time = 1<cfiq->BufWriteTimeoutTyp; - cfi->chips[i].erase_time = 1<cfiq->BlockEraseTimeoutTyp; - } - - map->fldrv = &cfi_sststd_chipdrv; - MOD_INC_USE_COUNT; - - cfi_send_gen_cmd(0xf0, 0x5555, base, map, cfi, cfi->device_type, NULL); - return cfi_sststd_setup(map); -} - -static struct mtd_info *cfi_sststd_setup(struct map_info *map) -{ - struct cfi_private *cfi = map->fldrv_priv; - struct mtd_info *mtd; - unsigned long devsize = (1<cfiq->DevSize) * cfi->interleave; - - mtd = kmalloc(sizeof(*mtd), GFP_KERNEL); - printk("number of %s chips: %d\n", (cfi->cfi_mode)?"JEDEC":"CFI",cfi->numchips); - - if (!mtd) { - printk("Failed to allocate memory for MTD device\n"); - kfree(cfi->cmdset_priv); - return NULL; - } - - memset(mtd, 0, sizeof(*mtd)); - mtd->priv = map; - mtd->type = MTD_NORFLASH; - /* Also select the correct geometry setup too */ - mtd->size = devsize * cfi->numchips; - - if (cfi->cfiq->NumEraseRegions == 1) { - /* No need to muck about with multiple erase sizes */ - mtd->erasesize = ((cfi->cfiq->EraseRegionInfo[0] >> 8) & ~0xff) * cfi->interleave; - } else { - unsigned long offset = 0; - int i,j; - - mtd->numeraseregions = cfi->cfiq->NumEraseRegions * cfi->numchips; - mtd->eraseregions = kmalloc(sizeof(struct mtd_erase_region_info) * mtd->numeraseregions, GFP_KERNEL); - if (!mtd->eraseregions) { - printk("Failed to allocate memory for MTD erase region info\n"); - kfree(cfi->cmdset_priv); - return NULL; - } - - for (i=0; icfiq->NumEraseRegions; i++) { - unsigned long ernum, ersize; - ersize = ((cfi->cfiq->EraseRegionInfo[i] >> 8) & ~0xff) * cfi->interleave; - ernum = (cfi->cfiq->EraseRegionInfo[i] & 0xffff) + 1; - - if (mtd->erasesize < ersize) { - mtd->erasesize = ersize; - } - for (j=0; jnumchips; j++) { - mtd->eraseregions[(j*cfi->cfiq->NumEraseRegions)+i].offset = (j*devsize)+offset; - mtd->eraseregions[(j*cfi->cfiq->NumEraseRegions)+i].erasesize = ersize; - mtd->eraseregions[(j*cfi->cfiq->NumEraseRegions)+i].numblocks = ernum; - } - offset += (ersize * ernum); - } - - // debug - for (i=0; inumeraseregions;i++){ - printk("%d: offset=0x%x,size=0x%x,blocks=%d\n", - i,mtd->eraseregions[i].offset, - mtd->eraseregions[i].erasesize, - mtd->eraseregions[i].numblocks); - } - } - - switch (CFIDEV_BUSWIDTH) - { - case 1: - case 2: - case 4: - if (mtd->numeraseregions > 1) - mtd->erase = cfi_sststd_erase_varsize; - else - mtd->erase = cfi_sststd_erase_onesize; - mtd->read = cfi_sststd_read; - mtd->write = cfi_sststd_write; - break; - - default: - printk("Unsupported buswidth\n"); - kfree(mtd); - kfree(cfi->cmdset_priv); - return NULL; - break; - } - mtd->sync = cfi_sststd_sync; - mtd->suspend = cfi_sststd_suspend; - mtd->resume = cfi_sststd_resume; - mtd->flags = MTD_CAP_NORFLASH; - map->fldrv = &cfi_sststd_chipdrv; - mtd->name = map->name; - MOD_INC_USE_COUNT; - return mtd; -} - -static inline int do_read_onechip(struct map_info *map, struct flchip *chip, loff_t adr, size_t len, u_char *buf) -{ - DECLARE_WAITQUEUE(wait, current); - unsigned long timeo = jiffies + HZ; - - retry: - cfi_spin_lock(chip->mutex); - - if (chip->state != FL_READY){ - printk("Waiting for chip to read, status = %d\n", chip->state); - set_current_state(TASK_UNINTERRUPTIBLE); - add_wait_queue(&chip->wq, &wait); - - cfi_spin_unlock(chip->mutex); - - schedule(); - remove_wait_queue(&chip->wq, &wait); - timeo = jiffies + HZ; - - goto retry; - } - - adr += chip->start; - - chip->state = FL_READY; - - map->copy_from(map, buf, adr, len); - - wake_up(&chip->wq); - cfi_spin_unlock(chip->mutex); - - return 0; -} - -static int cfi_sststd_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) -{ - struct map_info *map = mtd->priv; - struct cfi_private *cfi = map->fldrv_priv; - unsigned long ofs; - int chipnum; - int ret = 0; - - /* ofs: offset within the first chip that the first read should start */ - - chipnum = (from >> cfi->chipshift); - ofs = from - (chipnum << cfi->chipshift); - - - *retlen = 0; - - while (len) { - unsigned long thislen; - - if (chipnum >= cfi->numchips) - break; - - if ((len + ofs -1) >> cfi->chipshift) - thislen = (1<chipshift) - ofs; - else - thislen = len; - - ret = do_read_onechip(map, &cfi->chips[chipnum], ofs, thislen, buf); - if (ret) - break; - - *retlen += thislen; - len -= thislen; - buf += thislen; - - ofs = 0; - chipnum++; - } - return ret; -} - -static int do_write_oneword(struct map_info *map, struct flchip *chip, unsigned long adr, __u32 datum, int fast) -{ - unsigned long timeo = jiffies + HZ; - unsigned int Last[4]; - unsigned long Count = 0; - struct cfi_private *cfi = map->fldrv_priv; - DECLARE_WAITQUEUE(wait, current); - int ret = 0; - - retry: - cfi_spin_lock(chip->mutex); - - if (chip->state != FL_READY){ - printk("Waiting for chip to write, status = %d\n", chip->state); - set_current_state(TASK_UNINTERRUPTIBLE); - add_wait_queue(&chip->wq, &wait); - - cfi_spin_unlock(chip->mutex); - - schedule(); - remove_wait_queue(&chip->wq, &wait); - printk("Wake up to write:\n"); - timeo = jiffies + HZ; - - goto retry; - } - - chip->state = FL_WRITING; - - adr += chip->start; - ENABLE_VPP(map); - cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, chip->start, map, cfi, CFI_DEVICETYPE_X16, NULL); - cfi_send_gen_cmd(0x55, cfi->addr_unlock2, chip->start, map, cfi, CFI_DEVICETYPE_X16, NULL); - cfi_send_gen_cmd(0xA0, cfi->addr_unlock1, chip->start, map, cfi, CFI_DEVICETYPE_X16, NULL); - - cfi_write(map, datum, adr); - - cfi_spin_unlock(chip->mutex); - cfi_udelay(chip->word_write_time); - cfi_spin_lock(chip->mutex); - - Last[0] = cfi_read(map, adr); - // printk("Last[0] is %x\n", Last[0]); - Last[1] = cfi_read(map, adr); - // printk("Last[1] is %x\n", Last[1]); - Last[2] = cfi_read(map, adr); - // printk("Last[2] is %x\n", Last[2]); - - for (Count = 3; Last[(Count - 1) % 4] != Last[(Count - 2) % 4] && Count < 10000; Count++){ - cfi_spin_unlock(chip->mutex); - cfi_udelay(10); - cfi_spin_lock(chip->mutex); - - Last[Count % 4] = cfi_read(map, adr); - // printk("Last[%d%%4] is %x\n", Count, Last[Count%4]); - } - - if (Last[(Count - 1) % 4] != datum){ - printk("Last[%ld] is %x, datum is %x\n",(Count - 1) % 4,Last[(Count - 1) % 4],datum); - cfi_send_gen_cmd(0xF0, 0, chip->start, map, cfi, cfi->device_type, NULL); - DISABLE_VPP(map); - ret = -EIO; - } - DISABLE_VPP(map); - chip->state = FL_READY; - wake_up(&chip->wq); - cfi_spin_unlock(chip->mutex); - - return ret; -} - -static int cfi_sststd_write (struct mtd_info *mtd, loff_t to , size_t len, size_t *retlen, const u_char *buf) -{ - struct map_info *map = mtd->priv; - struct cfi_private *cfi = map->fldrv_priv; - int ret = 0; - int chipnum; - unsigned long ofs, chipstart; - - *retlen = 0; - if (!len) - return 0; - - chipnum = to >> cfi->chipshift; - ofs = to - (chipnum << cfi->chipshift); - chipstart = cfi->chips[chipnum].start; - - /* If it's not bus-aligned, do the first byte write */ - if (ofs & (CFIDEV_BUSWIDTH-1)) { - unsigned long bus_ofs = ofs & ~(CFIDEV_BUSWIDTH-1); - int i = ofs - bus_ofs; - int n = 0; - u_char tmp_buf[4]; - __u32 datum; - - map->copy_from(map, tmp_buf, bus_ofs + cfi->chips[chipnum].start, CFIDEV_BUSWIDTH); - while (len && i < CFIDEV_BUSWIDTH) - tmp_buf[i++] = buf[n++], len--; - - if (cfi_buswidth_is_2()) { - datum = *(__u16*)tmp_buf; - } else if (cfi_buswidth_is_4()) { - datum = *(__u32*)tmp_buf; - } else { - return -EINVAL; /* should never happen, but be safe */ - } - - ret = do_write_oneword(map, &cfi->chips[chipnum], - bus_ofs, datum, 0); - if (ret) - return ret; - - ofs += n; - buf += n; - (*retlen) += n; - - if (ofs >> cfi->chipshift) { - chipnum ++; - ofs = 0; - if (chipnum == cfi->numchips) - return 0; - } - } - - /* We are now aligned, write as much as possible */ - while(len >= CFIDEV_BUSWIDTH) { - __u32 datum; - - if (cfi_buswidth_is_1()) { - datum = *(__u8*)buf; - } else if (cfi_buswidth_is_2()) { - datum = *(__u16*)buf; - } else if (cfi_buswidth_is_4()) { - datum = *(__u32*)buf; - } else { - return -EINVAL; - } - ret = do_write_oneword(map, &cfi->chips[chipnum], - ofs, datum, cfi->fast_prog); - if (ret) { - return ret; - } - - ofs += CFIDEV_BUSWIDTH; - buf += CFIDEV_BUSWIDTH; - (*retlen) += CFIDEV_BUSWIDTH; - len -= CFIDEV_BUSWIDTH; - - if (ofs >> cfi->chipshift) { - chipnum ++; - ofs = 0; - if (chipnum == cfi->numchips) - return 0; - chipstart = cfi->chips[chipnum].start; - } - } - - if (len & (CFIDEV_BUSWIDTH-1)) { - int i = 0, n = 0; - u_char tmp_buf[4]; - __u32 datum; - - map->copy_from(map, tmp_buf, ofs + cfi->chips[chipnum].start, CFIDEV_BUSWIDTH); - while (len--) - tmp_buf[i++] = buf[n++]; - - if (cfi_buswidth_is_2()) { - datum = *(__u16*)tmp_buf; - } else if (cfi_buswidth_is_4()) { - datum = *(__u32*)tmp_buf; - } else { - return -EINVAL; /* should never happen, but be safe */ - } - - ret = do_write_oneword(map, &cfi->chips[chipnum], - ofs, datum, 0); - if (ret) - return ret; - - (*retlen) += n; - } - - return 0; -} - -static inline int do_erase_oneblock(struct map_info *map, struct flchip *chip, unsigned long adr) -{ - unsigned int status; - unsigned long timeo = jiffies + HZ; - struct cfi_private *cfi = map->fldrv_priv; - unsigned int rdy_mask; - DECLARE_WAITQUEUE(wait, current); - - retry: - cfi_spin_lock(chip->mutex); - - if (chip->state != FL_READY){ - set_current_state(TASK_UNINTERRUPTIBLE); - add_wait_queue(&chip->wq, &wait); - - cfi_spin_unlock(chip->mutex); - - schedule(); - remove_wait_queue(&chip->wq, &wait); - timeo = jiffies + HZ; - - goto retry; - } - - chip->state = FL_ERASING; - - adr += chip->start; - ENABLE_VPP(map); - cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, chip->start, map, cfi, CFI_DEVICETYPE_X16, NULL); - cfi_send_gen_cmd(0x55, cfi->addr_unlock2, chip->start, map, cfi, CFI_DEVICETYPE_X16, NULL); - cfi_send_gen_cmd(0x80, cfi->addr_unlock1, chip->start, map, cfi, CFI_DEVICETYPE_X16, NULL); - cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, chip->start, map, cfi, CFI_DEVICETYPE_X16, NULL); - cfi_send_gen_cmd(0x55, cfi->addr_unlock2, chip->start, map, cfi, CFI_DEVICETYPE_X16, NULL); - cfi_write(map, CMD(0x30), adr); - - timeo = jiffies + (HZ*20); - - cfi_spin_unlock(chip->mutex); - schedule_timeout(HZ); - cfi_spin_lock(chip->mutex); - - rdy_mask = CMD(0x80); - - /* Once the state machine's known to be working I'll do that */ - - while ( ( (status = cfi_read(map,adr)) & rdy_mask ) != rdy_mask ) { - static int z=0; - - if (chip->state != FL_ERASING) { - /* Someone's suspended the erase. Sleep */ - set_current_state(TASK_UNINTERRUPTIBLE); - add_wait_queue(&chip->wq, &wait); - - cfi_spin_unlock(chip->mutex); - printk("erase suspended. Sleeping\n"); - - schedule(); - remove_wait_queue(&chip->wq, &wait); - timeo = jiffies + (HZ*2); - cfi_spin_lock(chip->mutex); - continue; - } - - /* OK Still waiting */ - if (time_after(jiffies, timeo)) { - chip->state = FL_READY; - cfi_spin_unlock(chip->mutex); - printk("waiting for erase to complete timed out."); - DISABLE_VPP(map); - return -EIO; - } - - /* Latency issues. Drop the lock, wait a while and retry */ - cfi_spin_unlock(chip->mutex); - - z++; - if ( 0 && !(z % 100 )) - printk("chip not ready yet after erase. looping\n"); - - cfi_udelay(1); - - cfi_spin_lock(chip->mutex); - continue; - } - - /* Done and happy. */ - DISABLE_VPP(map); - chip->state = FL_READY; - wake_up(&chip->wq); - cfi_spin_unlock(chip->mutex); - return 0; -} - -static int cfi_sststd_erase_varsize(struct mtd_info *mtd, struct erase_info *instr) -{ - struct map_info *map = mtd->priv; - struct cfi_private *cfi = map->fldrv_priv; - unsigned long adr, len; - int chipnum, ret = 0; - int i, first; - struct mtd_erase_region_info *regions = mtd->eraseregions; - - if (instr->addr > mtd->size) - return -EINVAL; - - if ((instr->len + instr->addr) > mtd->size) - return -EINVAL; - - /* Check that both start and end of the requested erase are - * aligned with the erasesize at the appropriate addresses. - */ - - i = 0; - - /* Skip all erase regions which are ended before the start of - the requested erase. Actually, to save on the calculations, - we skip to the first erase region which starts after the - start of the requested erase, and then go back one. - */ - - while (i < mtd->numeraseregions && instr->addr >= regions[i].offset) - i++; - i--; - - /* OK, now i is pointing at the erase region in which this - erase request starts. Check the start of the requested - erase range is aligned with the erase size which is in - effect here. - */ - - if (instr->addr & (regions[i].erasesize-1)) - return -EINVAL; - - /* Remember the erase region we start on */ - first = i; - - /* Next, check that the end of the requested erase is aligned - * with the erase region at that address. - */ - - while (inumeraseregions && (instr->addr + instr->len) >= regions[i].offset) - i++; - - /* As before, drop back one to point at the region in which - the address actually falls - */ - i--; - - if ((instr->addr + instr->len) & (regions[i].erasesize-1)) - return -EINVAL; - - chipnum = instr->addr >> cfi->chipshift; - adr = instr->addr - (chipnum << cfi->chipshift); - len = instr->len; - - i=first; - - while(len) { - ret = do_erase_oneblock(map, &cfi->chips[chipnum], adr); - - if (ret) - return ret; - - adr += regions[i].erasesize; - len -= regions[i].erasesize; - - if (adr % (1<< cfi->chipshift) == ((regions[i].offset + (regions[i].erasesize * regions[i].numblocks)) %( 1<< cfi->chipshift))) - i++; - - if (adr >> cfi->chipshift) { - adr = 0; - chipnum++; - - if (chipnum >= cfi->numchips) - break; - } - } - - instr->state = MTD_ERASE_DONE; - if (instr->callback) - instr->callback(instr); - - return 0; -} - -static int cfi_sststd_erase_onesize(struct mtd_info *mtd, struct erase_info *instr) -{ - struct map_info *map = mtd->priv; - struct cfi_private *cfi = map->fldrv_priv; - unsigned long adr, len; - int chipnum, ret = 0; - - if (instr->addr & (mtd->erasesize - 1)) - return -EINVAL; - - if (instr->len & (mtd->erasesize -1)) - return -EINVAL; - - if ((instr->len + instr->addr) > mtd->size) - return -EINVAL; - - chipnum = instr->addr >> cfi->chipshift; - adr = instr->addr - (chipnum << cfi->chipshift); - len = instr->len; - - while(len) { - ret = do_erase_oneblock(map, &cfi->chips[chipnum], adr); - - if (ret) - return ret; - - adr += mtd->erasesize; - len -= mtd->erasesize; - - if (adr >> cfi->chipshift) { - adr = 0; - chipnum++; - - if (chipnum >= cfi->numchips) - break; - } - } - - instr->state = MTD_ERASE_DONE; - if (instr->callback) - instr->callback(instr); - - return 0; -} - -static void cfi_sststd_sync (struct mtd_info *mtd) -{ - struct map_info *map = mtd->priv; - struct cfi_private *cfi = map->fldrv_priv; - int i; - struct flchip *chip; - int ret = 0; - DECLARE_WAITQUEUE(wait, current); - - for (i=0; !ret && inumchips; i++) { - chip = &cfi->chips[i]; - - retry: - cfi_spin_lock(chip->mutex); - - switch(chip->state) { - case FL_READY: - case FL_STATUS: - case FL_CFI_QUERY: - case FL_JEDEC_QUERY: - chip->oldstate = chip->state; - chip->state = FL_SYNCING; - /* No need to wake_up() on this state change - - * as the whole point is that nobody can do anything - * with the chip now anyway. - */ - case FL_SYNCING: - cfi_spin_unlock(chip->mutex); - break; - - default: - /* Not an idle state */ - add_wait_queue(&chip->wq, &wait); - - cfi_spin_unlock(chip->mutex); - - schedule(); - - remove_wait_queue(&chip->wq, &wait); - - goto retry; - } - } - - /* Unlock the chips again */ - - for (i--; i >=0; i--) { - chip = &cfi->chips[i]; - - cfi_spin_lock(chip->mutex); - - if (chip->state == FL_SYNCING) { - chip->state = chip->oldstate; - wake_up(&chip->wq); - } - cfi_spin_unlock(chip->mutex); - } -} - - -static int cfi_sststd_suspend(struct mtd_info *mtd) -{ - struct map_info *map = mtd->priv; - struct cfi_private *cfi = map->fldrv_priv; - int i; - struct flchip *chip; - int ret = 0; -//printk("suspend\n"); - - for (i=0; !ret && inumchips; i++) { - chip = &cfi->chips[i]; - - cfi_spin_lock(chip->mutex); - - switch(chip->state) { - case FL_READY: - case FL_STATUS: - case FL_CFI_QUERY: - case FL_JEDEC_QUERY: - chip->oldstate = chip->state; - chip->state = FL_PM_SUSPENDED; - /* No need to wake_up() on this state change - - * as the whole point is that nobody can do anything - * with the chip now anyway. - */ - case FL_PM_SUSPENDED: - break; - - default: - ret = -EAGAIN; - break; - } - cfi_spin_unlock(chip->mutex); - } - - /* Unlock the chips again */ - - if (ret) { - for (i--; i >=0; i--) { - chip = &cfi->chips[i]; - - cfi_spin_lock(chip->mutex); - - if (chip->state == FL_PM_SUSPENDED) { - chip->state = chip->oldstate; - wake_up(&chip->wq); - } - cfi_spin_unlock(chip->mutex); - } - } - - return ret; -} - -static void cfi_sststd_resume(struct mtd_info *mtd) -{ - struct map_info *map = mtd->priv; - struct cfi_private *cfi = map->fldrv_priv; - int i; - struct flchip *chip; -//printk("resume\n"); - - for (i=0; inumchips; i++) { - - chip = &cfi->chips[i]; - - cfi_spin_lock(chip->mutex); - - if (chip->state == FL_PM_SUSPENDED) { - chip->state = FL_READY; - cfi_write(map, CMD(0xF0), chip->start); - wake_up(&chip->wq); - } - else - printk("Argh. Chip not in PM_SUSPENDED state upon resume()\n"); - - cfi_spin_unlock(chip->mutex); - } -} - -static void cfi_sststd_destroy(struct mtd_info *mtd) -{ - struct map_info *map = mtd->priv; - struct cfi_private *cfi = map->fldrv_priv; - kfree(cfi->cmdset_priv); - kfree(cfi); -} - -#if LINUX_VERSION_CODE < 0x20212 && defined(MODULE) -#define cfi_sststd_init init_module -#define cfi_sststd_exit cleanup_module -#endif - -static char im_name[]="cfi_cmdset_0701"; - -mod_init_t cfi_sststd_init(void) -{ - inter_module_register(im_name, THIS_MODULE, &cfi_cmdset_0701); - return 0; -} - -mod_exit_t cfi_sststd_exit(void) -{ - inter_module_unregister(im_name); -} - -module_init(cfi_sststd_init); -module_exit(cfi_sststd_exit); - diff --git a/openwrt/package/linux/kernel-source/drivers/mtd/maps/bcm947xx-flash.c b/openwrt/package/linux/kernel-source/drivers/mtd/maps/bcm947xx-flash.c deleted file mode 100644 index 716867ff1a..0000000000 --- a/openwrt/package/linux/kernel-source/drivers/mtd/maps/bcm947xx-flash.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Flash mapping for BCM947XX boards - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -/* Global SB handle */ -extern void *bcm947xx_sbh; -extern spinlock_t bcm947xx_sbh_lock; - -/* Convenience */ -#define sbh bcm947xx_sbh -#define sbh_lock bcm947xx_sbh_lock - -#ifdef CONFIG_MTD_PARTITIONS -extern struct mtd_partition * init_mtd_partitions(struct mtd_info *mtd, size_t size); -#endif - -#define WINDOW_ADDR 0x1fc00000 -#define WINDOW_SIZE 0x400000 -#define BUSWIDTH 2 - -/* e.g., flash=2M or flash=4M */ -static int flash = 0; -MODULE_PARM(flash, "i"); -static int __init -bcm947xx_setup(char *str) -{ - flash = memparse(str, &str); - return 1; -} -__setup("flash=", bcm947xx_setup); - -static struct mtd_info *bcm947xx_mtd; - -__u8 bcm947xx_map_read8(struct map_info *map, unsigned long ofs) -{ - if (map->map_priv_2 == 1) - return __raw_readb(map->map_priv_1 + ofs); - - u16 val = __raw_readw(map->map_priv_1 + (ofs & ~1)); - if (ofs & 1) - return ((val >> 8) & 0xff); - else - return (val & 0xff); -} - -__u16 bcm947xx_map_read16(struct map_info *map, unsigned long ofs) -{ - return __raw_readw(map->map_priv_1 + ofs); -} - -__u32 bcm947xx_map_read32(struct map_info *map, unsigned long ofs) -{ - return __raw_readl(map->map_priv_1 + ofs); -} - -void bcm947xx_map_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) -{ - if (len==1) { - memcpy_fromio(to, map->map_priv_1 + from, len); - } else { - int i; - u16 *dest = (u16 *) to; - u16 *src = (u16 *) (map->map_priv_1 + from); - for (i = 0; i < (len / 2); i++) { - dest[i] = src[i]; - } - if (len & 1) - *((u8 *)dest+len-1) = src[i] & 0xff; - } -} - -void bcm947xx_map_write8(struct map_info *map, __u8 d, unsigned long adr) -{ - __raw_writeb(d, map->map_priv_1 + adr); - mb(); -} - -void bcm947xx_map_write16(struct map_info *map, __u16 d, unsigned long adr) -{ - __raw_writew(d, map->map_priv_1 + adr); - mb(); -} - -void bcm947xx_map_write32(struct map_info *map, __u32 d, unsigned long adr) -{ - __raw_writel(d, map->map_priv_1 + adr); - mb(); -} - -void bcm947xx_map_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len) -{ - memcpy_toio(map->map_priv_1 + to, from, len); -} - -struct map_info bcm947xx_map = { - name: "Physically mapped flash", - size: WINDOW_SIZE, - buswidth: BUSWIDTH, - read8: bcm947xx_map_read8, - read16: bcm947xx_map_read16, - read32: bcm947xx_map_read32, - copy_from: bcm947xx_map_copy_from, - write8: bcm947xx_map_write8, - write16: bcm947xx_map_write16, - write32: bcm947xx_map_write32, - copy_to: bcm947xx_map_copy_to -}; - -#if LINUX_VERSION_CODE < 0x20212 && defined(MODULE) -#define init_bcm947xx_map init_module -#define cleanup_bcm947xx_map cleanup_module -#endif - -mod_init_t init_bcm947xx_map(void) -{ - ulong flags; - uint coreidx; - chipcregs_t *cc; - uint32 fltype; - uint window_addr = 0, window_size = 0; - size_t size; - int ret = 0; -#ifdef CONFIG_MTD_PARTITIONS - struct mtd_partition *parts; - int i; -#endif - - spin_lock_irqsave(&sbh_lock, flags); - coreidx = sb_coreidx(sbh); - - /* Check strapping option if chipcommon exists */ - if ((cc = sb_setcore(sbh, SB_CC, 0))) { - fltype = readl(&cc->capabilities) & CAP_FLASH_MASK; - if (fltype == PFLASH) { - bcm947xx_map.map_priv_2 = 1; - window_addr = 0x1c000000; - bcm947xx_map.size = window_size = 32 * 1024 * 1024; - if ((readl(&cc->flash_config) & CC_CFG_DS) == 0) - bcm947xx_map.buswidth = 1; - } - } else { - fltype = PFLASH; - bcm947xx_map.map_priv_2 = 0; - window_addr = WINDOW_ADDR; - window_size = WINDOW_SIZE; - } - - sb_setcoreidx(sbh, coreidx); - spin_unlock_irqrestore(&sbh_lock, flags); - - if (fltype != PFLASH) { - printk(KERN_ERR "pflash: found no supported devices\n"); - ret = -ENODEV; - goto fail; - } - - bcm947xx_map.map_priv_1 = (unsigned long) ioremap(window_addr, window_size); - if (!bcm947xx_map.map_priv_1) { - printk(KERN_ERR "pflash: ioremap failed\n"); - ret = -EIO; - goto fail; - } - - if (!(bcm947xx_mtd = do_map_probe("cfi_probe", &bcm947xx_map))) { - printk(KERN_ERR "pflash: cfi_probe failed\n"); - ret = -ENXIO; - goto fail; - } - - bcm947xx_mtd->module = THIS_MODULE; - - /* Allow size override for testing */ - size = flash ? : bcm947xx_mtd->size; - - printk(KERN_NOTICE "Flash device: 0x%x at 0x%x\n", size, window_addr); - -#ifdef CONFIG_MTD_PARTITIONS - parts = init_mtd_partitions(bcm947xx_mtd, size); - for (i = 0; parts[i].name; i++); - ret = add_mtd_partitions(bcm947xx_mtd, parts, i); - if (ret) { - printk(KERN_ERR "pflash: add_mtd_partitions failed\n"); - goto fail; - } -#endif - - return 0; - - fail: - if (bcm947xx_mtd) - map_destroy(bcm947xx_mtd); - if (bcm947xx_map.map_priv_1) - iounmap((void *) bcm947xx_map.map_priv_1); - bcm947xx_map.map_priv_1 = 0; - return ret; -} - -mod_exit_t cleanup_bcm947xx_map(void) -{ -#ifdef CONFIG_MTD_PARTITIONS - del_mtd_partitions(bcm947xx_mtd); -#endif - map_destroy(bcm947xx_mtd); - iounmap((void *) bcm947xx_map.map_priv_1); - bcm947xx_map.map_priv_1 = 0; -} - -module_init(init_bcm947xx_map); -module_exit(cleanup_bcm947xx_map); diff --git a/openwrt/package/linux/kernel-source/drivers/net/diag/Makefile b/openwrt/package/linux/kernel-source/drivers/net/diag/Makefile deleted file mode 100644 index e00f095f9c..0000000000 --- a/openwrt/package/linux/kernel-source/drivers/net/diag/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -O_TARGET := diag.o - -MAC_OBJS := diag_led.o - -export-objs := -obj-y := $(MAC_OBJS) -obj-m := $(O_TARGET) - -include $(TOPDIR)/Rules.make diff --git a/openwrt/package/linux/kernel-source/drivers/net/diag/diag_led.c b/openwrt/package/linux/kernel-source/drivers/net/diag/diag_led.c deleted file mode 100644 index 00d19cd525..0000000000 --- a/openwrt/package/linux/kernel-source/drivers/net/diag/diag_led.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * diag_led.c - replacement diag module - * - * Copyright (C) 2004 Mike Baker, - * Imre Kaloz - * - * 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. - * - * $Id$ - */ - -/* - * ChangeLog: - * 2004/03/28 initial release - * 2004/08/26 asus & buffalo support added - * 2005/03/14 asus wl-500g deluxe and buffalo v2 support added - * 2005/04/13 added licensing informations - * 2005/04/18 base reset polarity off initial readings - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -extern char * nvram_get(const char *name); -static void *sbh; - -// v2.x - - - - - -#define DIAG_GPIO (1<<1) -#define DMZ_GPIO (1<<7) - -static void set_gpio(uint32 mask, uint32 value) { - sb_gpiocontrol(sbh,mask,0); - sb_gpioouten(sbh,mask,mask); - sb_gpioout(sbh,mask,value); -} - -static void v2_set_diag(u8 state) { - set_gpio(DIAG_GPIO,state); -} -static void v2_set_dmz(u8 state) { - set_gpio(DMZ_GPIO,state); -} - -// v1.x - - - - - -#define LED_DIAG 0x13 -#define LED_DMZ 0x12 - -static void v1_set_diag(u8 state) { - if (!state) { - *(volatile u8*)(KSEG1ADDR(BCM4710_EUART)+LED_DIAG)=0xFF; - } else { - *(volatile u8*)(KSEG1ADDR(BCM4710_EUART)+LED_DIAG); - } -} -static void v1_set_dmz(u8 state) { - if (!state) { - *(volatile u8*)(KSEG1ADDR(BCM4710_EUART)+LED_DMZ)=0xFF; - } else { - *(volatile u8*)(KSEG1ADDR(BCM4710_EUART)+LED_DMZ); - } -} - -// - - - - - -static void ignore(u8 ignored) {}; - -// - - - - - -#define BIT_DMZ 0x01 -#define BIT_DIAG 0x04 - -void (*set_diag)(u8 state); -void (*set_dmz)(u8 state); - -static unsigned int diag = 0; - -static void diag_change() -{ - set_diag(0xFF); // off - set_dmz(0xFF); // off - - if(diag & BIT_DIAG) - set_diag(0x00); // on - if(diag & BIT_DMZ) - set_dmz(0x00); // on -} - -static int proc_diag(ctl_table *table, int write, struct file *filp, - void *buffer, size_t *lenp) -{ - int r; - r = proc_dointvec(table, write, filp, buffer, lenp); - if (write && !r) { - diag_change(); - } - return r; -} - -// - - - - - -static unsigned char reset_gpio = 0; -static unsigned char reset_polarity = 0; -static unsigned int reset = 0; - -static int proc_reset(ctl_table *table, int write, struct file *filp, - void *buffer, size_t *lenp) -{ - - if (reset_gpio) { - sb_gpiocontrol(sbh,reset_gpio,reset_gpio); - sb_gpioouten(sbh,reset_gpio,0); - reset=!(sb_gpioin(sbh)&reset_gpio); - - if (reset_polarity) reset=!reset; - } else { - reset=0; - } - - return proc_dointvec(table, write, filp, buffer, lenp); -} - -// - - - - - -static struct ctl_table_header *diag_sysctl_header; - -static ctl_table sys_diag[] = { - { - ctl_name: 2000, - procname: "diag", - data: &diag, - maxlen: sizeof(diag), - mode: 0644, - proc_handler: proc_diag - }, - { - ctl_name: 2001, - procname: "reset", - data: &reset, - maxlen: sizeof(reset), - mode: 0444, - proc_handler: proc_reset - }, - { 0 } -}; - -static int __init diag_init() -{ - char *buf; - u32 board_type; - sbh = sb_kattach(); - sb_gpiosetcore(sbh); - - board_type = sb_boardtype(sbh); - printk(KERN_INFO "diag boardtype: %08x\n",board_type); - - set_diag=ignore; - set_dmz=ignore; - - if ((board_type & 0xf00) == 0x400) { - buf=nvram_get("boardtype")?:""; - if (!strcmp(buf,"bcm94710dev")) { - buf=nvram_get("boardnum")?:""; - if (!strcmp(buf,"42")) { - // wrt54g v1.x - set_diag=v1_set_diag; - set_dmz=v1_set_dmz; - reset_gpio=(1<<6); - } - if (!strcmp(buf,"asusX")) { - //asus wl-500g - reset_gpio=(1<<6); - } - } - if (!strcmp(buf,"bcm94710ap")) { - buf=nvram_get("boardnum")?:""; - if (!strcmp(buf,"42")) { - // buffalo - set_dmz=v2_set_dmz; - reset_gpio=(1<<4); - } - if (!strcmp(buf,"44")) { - //dell truemobile - set_dmz=v2_set_dmz; - reset_gpio=(1<<0); - } - } - } else { - buf=nvram_get("boardnum")?:""; - if (!strcmp(buf,"42")) { - //linksys - set_diag=v2_set_diag; - set_dmz=v2_set_dmz; - reset_gpio=(1<<6); - } - if (!strcmp(buf,"44")) { - //motorola - reset_gpio=(1<<5); - } - if (!strcmp(buf,"00")) { - //buffalo - reset_gpio=(1<<7); - } - if (!strcmp(buf,"45")) { - //wl-500g deluxe - reset_gpio=(1<<6); - } - } - - - sb_gpiocontrol(sbh,reset_gpio,reset_gpio); - sb_gpioouten(sbh,reset_gpio,0); - reset_polarity=!(sb_gpioin(sbh)&reset_gpio); - - diag_sysctl_header = register_sysctl_table(sys_diag, 0); - diag_change(); - - return 0; -} - -static void __exit diag_exit() -{ - unregister_sysctl_table(diag_sysctl_header); -} - -EXPORT_NO_SYMBOLS; -MODULE_AUTHOR("openwrt.org"); -MODULE_LICENSE("GPL"); - -module_init(diag_init); -module_exit(diag_exit); diff --git a/openwrt/package/linux/kernel-source/drivers/net/et/Makefile b/openwrt/package/linux/kernel-source/drivers/net/et/Makefile deleted file mode 100644 index 152b18e9ad..0000000000 --- a/openwrt/package/linux/kernel-source/drivers/net/et/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -# -# Makefile for the Broadcom et driver -# -# Copyright 2004, Broadcom Corporation -# All Rights Reserved. -# -# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY -# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM -# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. -# -# $Id$ -# - -O_TARGET := et.o - -ET_OBJS := et_linux.o etc.o - -ifeq ($(CONFIG_ET_47XX),y) -ET_OBJS += etc47xx.o etc_robo.o etc_adm.o -EXTRA_CFLAGS += -DBCM47XX_CHOPS -endif -ifeq ($(CONFIG_ET_4413),y) -ET_OBJS += etc4413.o -EXTRA_CFLAGS += -DBCM4413_CHOPS -endif - -export-objs := -obj-y := $(ET_OBJS) -obj-m := $(O_TARGET) - -EXTRA_CFLAGS += -DDMA - -include $(TOPDIR)/Rules.make diff --git a/openwrt/package/linux/kernel-source/drivers/net/hnd/Config.in b/openwrt/package/linux/kernel-source/drivers/net/hnd/Config.in deleted file mode 100644 index 5ced207f33..0000000000 --- a/openwrt/package/linux/kernel-source/drivers/net/hnd/Config.in +++ /dev/null @@ -1,35 +0,0 @@ -# -# Broadcom Home Networking Division (HND) driver configuration -# -# Copyright 2004, Broadcom Corporation -# All Rights Reserved. -# -# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY -# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM -# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. -# - -mainmenu_option next_comment -comment 'Broadcom HND network devices' - tristate 'Broadcom HND network device support' CONFIG_HND $CONFIG_PCI - if [ "$CONFIG_HND" != "n" ]; then - dep_tristate ' Broadcom InsideLine HPNA support' CONFIG_IL $CONFIG_HND - if [ "$CONFIG_IL" != "n" ]; then - bool ' Broadcom BCM42xx support' CONFIG_IL_42XX - bool ' Broadcom BCM47xx support' CONFIG_IL_47XX - int ' LARQ buffer allocation (0 = tiny, 2 = huge)' CONFIG_LARQ_BUF 0 - fi - dep_tristate ' Broadcom 10/100 Ethernet support' CONFIG_ET $CONFIG_HND - if [ "$CONFIG_ET" != "n" ]; then - bool ' Broadcom BCM4413 support' CONFIG_ET_4413 - bool ' Broadcom BCM47xx support' CONFIG_ET_47XX - fi - dep_tristate ' Broadcom BCM43xx 802.11 Wireless support' CONFIG_WL $CONFIG_HND - if [ "$CONFIG_WL" != "n" ]; then - bool ' Access Point Mode Supported' CONFIG_WL_AP - bool ' STA Mode Supported' CONFIG_WL_STA - bool ' OID Interface Supported' CONFIG_WL_OID - fi - fi -endmenu diff --git a/openwrt/package/linux/kernel-source/drivers/net/hnd/Makefile b/openwrt/package/linux/kernel-source/drivers/net/hnd/Makefile deleted file mode 100644 index 5adaa5abed..0000000000 --- a/openwrt/package/linux/kernel-source/drivers/net/hnd/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# Makefile for Broadcom Home Networking Division (HND) shared driver code -# -# Copyright 2004, Broadcom Corporation -# All Rights Reserved. -# -# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY -# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM -# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. -# -# $Id$ -# - -O_TARGET := hnd.o - -HND_OBJS := bcmutils.o hnddma.o linux_osl.o sbutils.o bcmsrom.o - -ifneq ($(CONFIG_BCM947XX),y) -HND_OBJS += nvramstubs.o -endif - -export-objs := shared_ksyms.o -obj-y := shared_ksyms.o $(HND_OBJS) -obj-m := $(O_TARGET) - -include $(TOPDIR)/Rules.make - -shared_ksyms.c: shared_ksyms.sh $(HND_OBJS) - sh -e $< $(HND_OBJS) > $@ diff --git a/openwrt/package/linux/kernel-source/drivers/net/hnd/bcmsrom.c b/openwrt/package/linux/kernel-source/drivers/net/hnd/bcmsrom.c deleted file mode 100644 index 8a0f05d955..0000000000 --- a/openwrt/package/linux/kernel-source/drivers/net/hnd/bcmsrom.c +++ /dev/null @@ -1,711 +0,0 @@ -/* - * Misc useful routines to access NIC SROM - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * $Id$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include /* for sprom content groking */ - -#define VARS_MAX 4096 /* should be reduced */ - -static int initvars_srom_pci(void *curmap, char **vars, int *count); -static int initvars_cis_pcmcia(void *sbh, void *curmap, void *osh, char **vars, int *count); -static int sprom_cmd_pcmcia(void *osh, uint8 cmd); -static int sprom_read_pcmcia(void *osh, uint16 addr, uint16 *data); -static int sprom_write_pcmcia(void *osh, uint16 addr, uint16 data); -static int sprom_read_pci(uint16 *sprom, uint byteoff, uint16 *buf, uint nbytes, bool check_crc); - -/* - * Initialize the vars from the right source for this platform. - * Return 0 on success, nonzero on error. - */ -int -srom_var_init(void *sbh, uint bus, void *curmap, void *osh, char **vars, int *count) -{ - if (vars == NULL) - return (0); - - switch (bus) { - case SB_BUS: - /* These two could be asserts ... */ - *vars = NULL; - *count = 0; - return(0); - - case PCI_BUS: - ASSERT(curmap); /* can not be NULL */ - return(initvars_srom_pci(curmap, vars, count)); - - case PCMCIA_BUS: - return(initvars_cis_pcmcia(sbh, curmap, osh, vars, count)); - - - default: - ASSERT(0); - } - return (-1); -} - - -/* support only 16-bit word read from srom */ -int -srom_read(uint bus, void *curmap, void *osh, uint byteoff, uint nbytes, uint16 *buf) -{ - void *srom; - uint i, off, nw; - - /* check input - 16-bit access only */ - if (byteoff & 1 || nbytes & 1 || (byteoff + nbytes) > (SPROM_SIZE * 2)) - return 1; - - if (bus == PCI_BUS) { - if (!curmap) - return 1; - srom = (void *)((uint)curmap + PCI_BAR0_SPROM_OFFSET); - if (sprom_read_pci(srom, byteoff, buf, nbytes, FALSE)) - return 1; - } else if (bus == PCMCIA_BUS) { - off = byteoff / 2; - nw = nbytes / 2; - for (i = 0; i < nw; i++) { - if (sprom_read_pcmcia(osh, (uint16)(off + i), (uint16*)(buf + i))) - return 1; - } - } else { - return 1; - } - - return 0; -} - -/* support only 16-bit word write into srom */ -int -srom_write(uint bus, void *curmap, void *osh, uint byteoff, uint nbytes, uint16 *buf) -{ - uint16 *srom; - uint i, off, nw, crc_range; - uint16 image[SPROM_SIZE], *p; - uint8 crc; - volatile uint32 val32; - - /* check input - 16-bit access only */ - if (byteoff & 1 || nbytes & 1 || (byteoff + nbytes) > (SPROM_SIZE * 2)) - return 1; - - crc_range = ((bus == PCMCIA_BUS) ? SPROM_SIZE : SPROM_CRC_RANGE) * 2; - - /* if changes made inside crc cover range */ - if (byteoff < crc_range) { - nw = (((byteoff + nbytes) > crc_range) ? byteoff + nbytes : crc_range) / 2; - /* read data including entire first 64 words from srom */ - if (srom_read(bus, curmap, osh, 0, nw * 2, image)) - return 1; - /* make changes */ - bcopy((void*)buf, (void*)&image[byteoff / 2], nbytes); - /* calculate crc */ - htol16_buf(image, crc_range); - crc = ~crc8((uint8 *)image, crc_range - 1, CRC8_INIT_VALUE); - ltoh16_buf(image, crc_range); - image[(crc_range / 2) - 1] = (crc << 8) | (image[(crc_range / 2) - 1] & 0xff); - p = image; - off = 0; - } else { - p = buf; - off = byteoff / 2; - nw = nbytes / 2; - } - - if (bus == PCI_BUS) { - srom = (uint16*)((uint)curmap + PCI_BAR0_SPROM_OFFSET); - /* enable writes to the SPROM */ - val32 = OSL_PCI_READ_CONFIG(osh, PCI_SPROM_CONTROL, sizeof(uint32)); - val32 |= SPROM_WRITEEN; - OSL_PCI_WRITE_CONFIG(osh, PCI_SPROM_CONTROL, sizeof(uint32), val32); - bcm_mdelay(500); - /* write srom */ - for (i = 0; i < nw; i++) { - W_REG(&srom[off + i], p[i]); - bcm_mdelay(20); - } - /* disable writes to the SPROM */ - OSL_PCI_WRITE_CONFIG(osh, PCI_SPROM_CONTROL, sizeof(uint32), val32 & ~SPROM_WRITEEN); - } else if (bus == PCMCIA_BUS) { - /* enable writes to the SPROM */ - if (sprom_cmd_pcmcia(osh, SROM_WEN)) - return 1; - bcm_mdelay(500); - /* write srom */ - for (i = 0; i < nw; i++) { - sprom_write_pcmcia(osh, (uint16)(off + i), p[i]); - bcm_mdelay(20); - } - /* disable writes to the SPROM */ - if (sprom_cmd_pcmcia(osh, SROM_WDS)) - return 1; - } else { - return 1; - } - - bcm_mdelay(500); - return 0; -} - - -int -srom_parsecis(uint8 *cis, char **vars, int *count) -{ - char eabuf[32]; - char *vp, *base; - uint8 tup, tlen, sromrev = 1; - int i, j; - uint varsize; - bool ag_init = FALSE; - uint16 w; - - ASSERT(vars); - ASSERT(count); - - base = vp = MALLOC(VARS_MAX); - ASSERT(vp); - - i = 0; - do { - tup = cis[i++]; - tlen = cis[i++]; - if ((i + tlen) >= CIS_SIZE) - break; - - switch (tup) { - case CISTPL_MANFID: - vp += sprintf(vp, "manfid=%d", (cis[i + 1] << 8) + cis[i]); - vp++; - vp += sprintf(vp, "prodid=%d", (cis[i + 3] << 8) + cis[i + 2]); - vp++; - break; - - case CISTPL_FUNCE: - if (cis[i] == LAN_NID) { - ASSERT(cis[i + 1] == ETHER_ADDR_LEN); - bcm_ether_ntoa((uchar*)&cis[i + 2], eabuf); - vp += sprintf(vp, "il0macaddr=%s", eabuf); - vp++; - } - break; - - case CISTPL_CFTABLE: - vp += sprintf(vp, "regwindowsz=%d", (cis[i + 7] << 8) | cis[i + 6]); - vp++; - break; - - case CISTPL_BRCM_HNBU: - switch (cis[i]) { - case HNBU_CHIPID: - vp += sprintf(vp, "vendid=%d", (cis[i + 2] << 8) + cis[i + 1]); - vp++; - vp += sprintf(vp, "devid=%d", (cis[i + 4] << 8) + cis[i + 3]); - vp++; - if (tlen == 7) { - vp += sprintf(vp, "chiprev=%d", (cis[i + 6] << 8) + cis[i + 5]); - vp++; - } - break; - - case HNBU_BOARDREV: - vp += sprintf(vp, "boardrev=%d", cis[i + 1]); - vp++; - break; - - case HNBU_AA: - vp += sprintf(vp, "aa0=%d", cis[i + 1]); - vp++; - break; - - case HNBU_AG: - vp += sprintf(vp, "ag0=%d", cis[i + 1]); - vp++; - ag_init = TRUE; - break; - - case HNBU_CC: - vp += sprintf(vp, "cc=%d", cis[i + 1]); - vp++; - break; - - case HNBU_PAPARMS: - vp += sprintf(vp, "pa0maxpwr=%d", cis[i + tlen - 1]); - vp++; - if (tlen == 9) { - /* New version */ - for (j = 0; j < 3; j++) { - vp += sprintf(vp, "pa0b%d=%d", j, - (cis[i + (j * 2) + 2] << 8) + cis[i + (j * 2) + 1]); - vp++; - } - vp += sprintf(vp, "pa0itssit=%d", cis[i + 7]); - vp++; - } - break; - - case HNBU_OEM: - vp += sprintf(vp, "oem=%02x%02x%02x%02x%02x%02x%02x%02x", - cis[i + 1], cis[i + 2], cis[i + 3], cis[i + 4], - cis[i + 5], cis[i + 6], cis[i + 7], cis[i + 8]); - vp++; - break; - case HNBU_BOARDFLAGS: - w = (cis[i + 2] << 8) + cis[i + 1]; - if (w == 0xffff) w = 0; - vp += sprintf(vp, "boardflags=%d", w); - vp++; - break; - case HNBU_LED: - if (cis[i + 1] != 0xff) { - vp += sprintf(vp, "wl0gpio0=%d", cis[i + 1]); - vp++; - } - if (cis[i + 2] != 0xff) { - vp += sprintf(vp, "wl0gpio1=%d", cis[i + 2]); - vp++; - } - if (cis[i + 3] != 0xff) { - vp += sprintf(vp, "wl0gpio2=%d", cis[i + 3]); - vp++; - } - if (cis[i + 4] != 0xff) { - vp += sprintf(vp, "wl0gpio3=%d", cis[i + 4]); - vp++; - } - break; - } - break; - - } - i += tlen; - } while (tup != 0xff); - - /* Set the srom version */ - vp += sprintf(vp, "sromrev=%d", sromrev); - vp++; - - /* For now just set boardflags2 to zero */ - vp += sprintf(vp, "boardflags2=0"); - vp++; - - /* if there is no antenna gain field, set default */ - if (ag_init == FALSE) { - vp += sprintf(vp, "ag0=%d", 0xff); - vp++; - } - - /* final nullbyte terminator */ - *vp++ = '\0'; - varsize = (uint)vp - (uint)base; - - ASSERT(varsize < VARS_MAX); - - if (varsize == VARS_MAX) { - *vars = base; - } else { - vp = MALLOC(varsize); - ASSERT(vp); - bcopy(base, vp, varsize); - MFREE(base, VARS_MAX); - *vars = vp; - } - *count = varsize; - - return (0); -} - - -/* set PCMCIA sprom command register */ -static int -sprom_cmd_pcmcia(void *osh, uint8 cmd) -{ - uint8 status; - uint wait_cnt = 1000; - - /* write sprom command register */ - OSL_PCMCIA_WRITE_ATTR(osh, SROM_CS, &cmd, 1); - - /* wait status */ - while (wait_cnt--) { - OSL_PCMCIA_READ_ATTR(osh, SROM_CS, &status, 1); - if (status & SROM_DONE) - return 0; - } - - return 1; -} - -/* read a word from the PCMCIA srom */ -static int -sprom_read_pcmcia(void *osh, uint16 addr, uint16 *data) -{ - uint8 addr_l, addr_h, data_l, data_h; - - addr_l = (uint8)((addr * 2) & 0xff); - addr_h = (uint8)(((addr * 2) >> 8) & 0xff); - - /* set address */ - OSL_PCMCIA_WRITE_ATTR(osh, SROM_ADDRH, &addr_h, 1); - OSL_PCMCIA_WRITE_ATTR(osh, SROM_ADDRL, &addr_l, 1); - - /* do read */ - if (sprom_cmd_pcmcia(osh, SROM_READ)) - return 1; - - /* read data */ - OSL_PCMCIA_READ_ATTR(osh, SROM_DATAH, &data_h, 1); - OSL_PCMCIA_READ_ATTR(osh, SROM_DATAL, &data_l, 1); - - *data = (data_h << 8) | data_l; - return 0; -} - -/* write a word to the PCMCIA srom */ -static int -sprom_write_pcmcia(void *osh, uint16 addr, uint16 data) -{ - uint8 addr_l, addr_h, data_l, data_h; - - addr_l = (uint8)((addr * 2) & 0xff); - addr_h = (uint8)(((addr * 2) >> 8) & 0xff); - data_l = (uint8)(data & 0xff); - data_h = (uint8)((data >> 8) & 0xff); - - /* set address */ - OSL_PCMCIA_WRITE_ATTR(osh, SROM_ADDRH, &addr_h, 1); - OSL_PCMCIA_WRITE_ATTR(osh, SROM_ADDRL, &addr_l, 1); - - /* write data */ - OSL_PCMCIA_WRITE_ATTR(osh, SROM_DATAH, &data_h, 1); - OSL_PCMCIA_WRITE_ATTR(osh, SROM_DATAL, &data_l, 1); - - /* do write */ - return sprom_cmd_pcmcia(osh, SROM_WRITE); -} - -/* - * Read in and validate sprom. - * Return 0 on success, nonzero on error. - */ -static int -sprom_read_pci(uint16 *sprom, uint byteoff, uint16 *buf, uint nbytes, bool check_crc) -{ - int off, nw; - uint8 chk8; - int i; - - off = byteoff / 2; - nw = ROUNDUP(nbytes, 2) / 2; - - /* read the sprom */ - for (i = 0; i < nw; i++) - buf[i] = R_REG(&sprom[off + i]); - - if (check_crc) { - /* fixup the endianness so crc8 will pass */ - htol16_buf(buf, nw * 2); - if ((chk8 = crc8((uchar*)buf, nbytes, CRC8_INIT_VALUE)) != CRC8_GOOD_VALUE) - return (1); - /* now correct the endianness of the byte array */ - ltoh16_buf(buf, nw * 2); - } - - return (0); -} - -/* - * Initialize nonvolatile variable table from sprom. - * Return 0 on success, nonzero on error. - */ - -static int -initvars_srom_pci(void *curmap, char **vars, int *count) -{ - uint16 w, b[64]; - uint8 sromrev; - struct ether_addr ea; - char eabuf[32]; - uint32 bfl; - int c, woff, i; - char *vp, *base; - - if (sprom_read_pci((void *)((uint)curmap + PCI_BAR0_SPROM_OFFSET), 0, b, sizeof (b), TRUE)) - return (-1); - - /* top word of sprom contains version and crc8 */ - sromrev = b[63] & 0xff; - if ((sromrev != 1) && (sromrev != 2)) { - return (-2); - } - - ASSERT(vars); - ASSERT(count); - - base = vp = MALLOC(VARS_MAX); - ASSERT(vp); - - vp += sprintf(vp, "sromrev=%d", sromrev); - vp++; - - if (sromrev >= 2) { - /* New section takes over the 4th hardware function space */ - - /* Word 29 is max power 11a high/low */ - w = b[29]; - vp += sprintf(vp, "pa1himaxpwr=%d", w & 0xff); - vp++; - vp += sprintf(vp, "pa1lomaxpwr=%d", (w >> 8) & 0xff); - vp++; - - /* Words 30-32 set the 11alow pa settings, - * 33-35 are the 11ahigh ones. - */ - for (i = 0; i < 3; i++) { - vp += sprintf(vp, "pa1lob%d=%d", i, b[30 + i]); - vp++; - vp += sprintf(vp, "pa1hib%d=%d", i, b[33 + i]); - vp++; - } - w = b[59]; - if (w == 0) - vp += sprintf(vp, "ccode="); - else - vp += sprintf(vp, "ccode=%c%c", (w >> 8), (w & 0xff)); - vp++; - - } - - /* parameter section of sprom starts at byte offset 72 */ - woff = 72/2; - - /* first 6 bytes are il0macaddr */ - ea.octet[0] = (b[woff] >> 8) & 0xff; - ea.octet[1] = b[woff] & 0xff; - ea.octet[2] = (b[woff+1] >> 8) & 0xff; - ea.octet[3] = b[woff+1] & 0xff; - ea.octet[4] = (b[woff+2] >> 8) & 0xff; - ea.octet[5] = b[woff+2] & 0xff; - woff += ETHER_ADDR_LEN/2 ; - bcm_ether_ntoa((uchar*)&ea, eabuf); - vp += sprintf(vp, "il0macaddr=%s", eabuf); - vp++; - - /* next 6 bytes are et0macaddr */ - ea.octet[0] = (b[woff] >> 8) & 0xff; - ea.octet[1] = b[woff] & 0xff; - ea.octet[2] = (b[woff+1] >> 8) & 0xff; - ea.octet[3] = b[woff+1] & 0xff; - ea.octet[4] = (b[woff+2] >> 8) & 0xff; - ea.octet[5] = b[woff+2] & 0xff; - woff += ETHER_ADDR_LEN/2 ; - bcm_ether_ntoa((uchar*)&ea, eabuf); - vp += sprintf(vp, "et0macaddr=%s", eabuf); - vp++; - - /* next 6 bytes are et1macaddr */ - ea.octet[0] = (b[woff] >> 8) & 0xff; - ea.octet[1] = b[woff] & 0xff; - ea.octet[2] = (b[woff+1] >> 8) & 0xff; - ea.octet[3] = b[woff+1] & 0xff; - ea.octet[4] = (b[woff+2] >> 8) & 0xff; - ea.octet[5] = b[woff+2] & 0xff; - woff += ETHER_ADDR_LEN/2 ; - bcm_ether_ntoa((uchar*)&ea, eabuf); - vp += sprintf(vp, "et1macaddr=%s", eabuf); - vp++; - - /* - * Enet phy settings one or two singles or a dual - * Bits 4-0 : MII address for enet0 (0x1f for not there) - * Bits 9-5 : MII address for enet1 (0x1f for not there) - * Bit 14 : Mdio for enet0 - * Bit 15 : Mdio for enet1 - */ - w = b[woff]; - vp += sprintf(vp, "et0phyaddr=%d", (w & 0x1f)); - vp++; - vp += sprintf(vp, "et1phyaddr=%d", ((w >> 5) & 0x1f)); - vp++; - vp += sprintf(vp, "et0mdcport=%d", ((w >> 14) & 0x1)); - vp++; - vp += sprintf(vp, "et1mdcport=%d", ((w >> 15) & 0x1)); - vp++; - - /* Word 46 has board rev, antennas 0/1 & Country code/control */ - w = b[46]; - vp += sprintf(vp, "boardrev=%d", w & 0xff); - vp++; - - if (sromrev > 1) - vp += sprintf(vp, "cctl=%d", (w >> 8) & 0xf); - else - vp += sprintf(vp, "cc=%d", (w >> 8) & 0xf); - vp++; - - vp += sprintf(vp, "aa0=%d", (w >> 12) & 0x3); - vp++; - - vp += sprintf(vp, "aa1=%d", (w >> 14) & 0x3); - vp++; - - /* Words 47-49 set the (wl) pa settings */ - woff = 47; - - for (i = 0; i < 3; i++) { - vp += sprintf(vp, "pa0b%d=%d", i, b[woff+i]); - vp++; - vp += sprintf(vp, "pa1b%d=%d", i, b[woff+i+6]); - vp++; - } - - /* - * Words 50-51 set the customer-configured wl led behavior. - * 8 bits/gpio pin. High bit: activehi=0, activelo=1; - * LED behavior values defined in wlioctl.h . - */ - w = b[50]; - if ((w != 0) && (w != 0xffff)) { - /* gpio0 */ - vp += sprintf(vp, "wl0gpio0=%d", (w & 0xff)); - vp++; - - /* gpio1 */ - vp += sprintf(vp, "wl0gpio1=%d", (w >> 8) & 0xff); - vp++; - } - w = b[51]; - if ((w != 0) && (w != 0xffff)) { - /* gpio2 */ - vp += sprintf(vp, "wl0gpio2=%d", w & 0xff); - vp++; - - /* gpio3 */ - vp += sprintf(vp, "wl0gpio3=%d", (w >> 8) & 0xff); - vp++; - } - - /* Word 52 is max power 0/1 */ - w = b[52]; - vp += sprintf(vp, "pa0maxpwr=%d", w & 0xff); - vp++; - vp += sprintf(vp, "pa1maxpwr=%d", (w >> 8) & 0xff); - vp++; - - /* Word 56 is idle tssi target 0/1 */ - w = b[56]; - vp += sprintf(vp, "pa0itssit=%d", w & 0xff); - vp++; - vp += sprintf(vp, "pa1itssit=%d", (w >> 8) & 0xff); - vp++; - - /* Word 57 is boardflags, if not programmed make it zero */ - bfl = (uint32)b[57]; - if (bfl == 0xffff) bfl = 0; - if (sromrev > 1) { - /* Word 28 is boardflags2 */ - bfl |= (uint32)b[28] << 16; - } - vp += sprintf(vp, "boardflags=%d", bfl); - vp++; - - /* Word 58 is antenna gain 0/1 */ - w = b[58]; - vp += sprintf(vp, "ag0=%d", w & 0xff); - vp++; - - vp += sprintf(vp, "ag1=%d", (w >> 8) & 0xff); - vp++; - - if (sromrev == 1) { - /* set the oem string */ - vp += sprintf(vp, "oem=%02x%02x%02x%02x%02x%02x%02x%02x", - ((b[59] >> 8) & 0xff), (b[59] & 0xff), - ((b[60] >> 8) & 0xff), (b[60] & 0xff), - ((b[61] >> 8) & 0xff), (b[61] & 0xff), - ((b[62] >> 8) & 0xff), (b[62] & 0xff)); - vp++; - } else { - if (sromrev >= 1){ - /* Word 60 OFDM tx power offset from CCK level */ - /* OFDM Power Offset - opo */ - w = b[60] & 0xff; - if (w == 0xff) - w = 16; - vp += sprintf(vp, "opo=%d", w); - vp++; - } - } - - /* final nullbyte terminator */ - *vp++ = '\0'; - - c = vp - base; - ASSERT(c <= VARS_MAX); - - if (c == VARS_MAX) { - *vars = base; - } else { - vp = MALLOC(c); - ASSERT(vp); - bcopy(base, vp, c); - MFREE(base, VARS_MAX); - *vars = vp; - } - *count = c; - - return (0); -} - -/* - * Read the cis and call parsecis to initialize the vars. - * Return 0 on success, nonzero on error. - */ -static int -initvars_cis_pcmcia(void *sbh, void *curmap, void *osh, char **vars, int *count) -{ - uint8 *cis = NULL; - int rc; - uint data_sz; - - data_sz = (sb_pcmciarev(sbh) == 1) ? (SPROM_SIZE * 2) : CIS_SIZE; - - if ((cis = MALLOC(data_sz)) == NULL) - return (-1); - - if (sb_pcmciarev(sbh) == 1) { - if (srom_read(PCMCIA_BUS, (void *)NULL, osh, 0, data_sz, (uint16 *)cis)) { - MFREE(cis, data_sz); - return (-1); - } - /* fix up endianess for 16-bit data vs 8-bit parsing */ - ltoh16_buf((uint16 *)cis, data_sz); - } else - OSL_PCMCIA_READ_ATTR(osh, 0, cis, data_sz); - - rc = srom_parsecis(cis, vars, count); - - MFREE(cis, data_sz); - - return (rc); -} - diff --git a/openwrt/package/linux/kernel-source/drivers/net/hnd/bcmutils.c b/openwrt/package/linux/kernel-source/drivers/net/hnd/bcmutils.c deleted file mode 100644 index 1b37c511e9..0000000000 --- a/openwrt/package/linux/kernel-source/drivers/net/hnd/bcmutils.c +++ /dev/null @@ -1,803 +0,0 @@ -/* - * Misc useful OS-independent routines. - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * $Id$ - */ - -#include -#include -#include -#include -#include - -unsigned char bcm_ctype[] = { - _BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C, /* 0-7 */ - _BCM_C,_BCM_C|_BCM_S,_BCM_C|_BCM_S,_BCM_C|_BCM_S,_BCM_C|_BCM_S,_BCM_C|_BCM_S,_BCM_C,_BCM_C, /* 8-15 */ - _BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C, /* 16-23 */ - _BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C, /* 24-31 */ - _BCM_S|_BCM_SP,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 32-39 */ - _BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 40-47 */ - _BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D, /* 48-55 */ - _BCM_D,_BCM_D,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 56-63 */ - _BCM_P,_BCM_U|_BCM_X,_BCM_U|_BCM_X,_BCM_U|_BCM_X,_BCM_U|_BCM_X,_BCM_U|_BCM_X,_BCM_U|_BCM_X,_BCM_U, /* 64-71 */ - _BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U, /* 72-79 */ - _BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U, /* 80-87 */ - _BCM_U,_BCM_U,_BCM_U,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 88-95 */ - _BCM_P,_BCM_L|_BCM_X,_BCM_L|_BCM_X,_BCM_L|_BCM_X,_BCM_L|_BCM_X,_BCM_L|_BCM_X,_BCM_L|_BCM_X,_BCM_L, /* 96-103 */ - _BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L, /* 104-111 */ - _BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L, /* 112-119 */ - _BCM_L,_BCM_L,_BCM_L,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_C, /* 120-127 */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */ - _BCM_S|_BCM_SP,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 160-175 */ - _BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 176-191 */ - _BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U, /* 192-207 */ - _BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_P,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_L, /* 208-223 */ - _BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L, /* 224-239 */ - _BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_P,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L /* 240-255 */ -}; - -uchar -bcm_toupper(uchar c) -{ - if (bcm_islower(c)) - c -= 'a'-'A'; - return (c); -} - -ulong -bcm_strtoul(char *cp, char **endp, uint base) -{ - ulong result, value; - bool minus; - - minus = FALSE; - - while (bcm_isspace(*cp)) - cp++; - - if (cp[0] == '+') - cp++; - else if (cp[0] == '-') { - minus = TRUE; - cp++; - } - - if (base == 0) { - if (cp[0] == '0') { - if ((cp[1] == 'x') || (cp[1] == 'X')) { - base = 16; - cp = &cp[2]; - } else { - base = 8; - cp = &cp[1]; - } - } else - base = 10; - } else if (base == 16 && (cp[0] == '0') && ((cp[1] == 'x') || (cp[1] == 'X'))) { - cp = &cp[2]; - } - - result = 0; - - while (bcm_isxdigit(*cp) && - (value = bcm_isdigit(*cp) ? *cp-'0' : bcm_toupper(*cp)-'A'+10) < base) { - result = result*base + value; - cp++; - } - - if (minus) - result = (ulong)(result * -1); - - if (endp) - *endp = (char *)cp; - - return (result); -} - -uint -bcm_atoi(char *s) -{ - uint n; - - n = 0; - - while (bcm_isdigit(*s)) - n = (n * 10) + *s++ - '0'; - return (n); -} - -void -deadbeef(char *p, uint len) -{ - static uchar meat[] = { 0xde, 0xad, 0xbe, 0xef }; - - while (len-- > 0) { - *p = meat[((uint)p) & 3]; - p++; - } -} - -/* pretty hex print a contiguous buffer */ -void -prhex(char *msg, uchar *buf, uint nbytes) -{ - char line[256]; - char* p; - uint i; - - if (msg && (msg[0] != '\0')) - printf("%s: ", msg); - - p = line; - for (i = 0; i < nbytes; i++) { - if (i % 16 == 0) { - p += sprintf(p, "%04d: ", i); /* line prefix */ - } - p += sprintf(p, "%02x ", buf[i]); - if (i % 16 == 15) { - printf("%s\n", line); /* flush line */ - p = line; - } - } - - /* flush last partial line */ - if (p != line) - printf("%s\n", line); -} - -/* pretty hex print a pkt buffer chain */ -void -prpkt(char *msg, void *drv, void *p0) -{ - void *p; - - if (msg && (msg[0] != '\0')) - printf("%s: ", msg); - - for (p = p0; p; p = PKTNEXT(drv, p)) - prhex(NULL, PKTDATA(drv, p), PKTLEN(drv, p)); -} - -/* copy a pkt buffer chain into a buffer */ -uint -pktcopy(void *drv, void *p, uint offset, int len, uchar *buf) -{ - uint n, ret = 0; - - if (len < 0) - len = 4096; /* "infinite" */ - - /* skip 'offset' bytes */ - for (; p && offset; p = PKTNEXT(drv, p)) { - if (offset < (uint)PKTLEN(drv, p)) - break; - offset -= PKTLEN(drv, p); - } - - if (!p) - return 0; - - /* copy the data */ - for (; p && len; p = PKTNEXT(drv, p)) { - n = MIN((uint)PKTLEN(drv, p) - offset, (uint)len); - bcopy(PKTDATA(drv, p) + offset, buf, n); - buf += n; - len -= n; - ret += n; - offset = 0; - } - - return ret; -} - -/* return total length of buffer chain */ -uint -pkttotlen(void *drv, void *p) -{ - uint total; - - total = 0; - for (; p; p = PKTNEXT(drv, p)) - total += PKTLEN(drv, p); - return (total); -} - - -uchar* -bcm_ether_ntoa(char *ea, char *buf) -{ - sprintf(buf,"%02x:%02x:%02x:%02x:%02x:%02x", - (uchar)ea[0]&0xff, (uchar)ea[1]&0xff, (uchar)ea[2]&0xff, - (uchar)ea[3]&0xff, (uchar)ea[4]&0xff, (uchar)ea[5]&0xff); - return (buf); -} - -/* parse a xx:xx:xx:xx:xx:xx format ethernet address */ -int -bcm_ether_atoe(char *p, char *ea) -{ - int i = 0; - - for (;;) { - ea[i++] = (char) bcm_strtoul(p, &p, 16); - if (!*p++ || i == 6) - break; - } - - return (i == 6); -} - -/* - * Advance from the current 1-byte tag/1-byte length/variable-length value - * triple, to the next, returning a pointer to the next. - */ -bcm_tlv_t * -bcm_next_tlv(bcm_tlv_t *elt, int *buflen) -{ - int len; - - /* validate current elt */ - if (*buflen < 2) { - return NULL; - } - - len = elt->len; - - /* validate remaining buflen */ - if (*buflen >= (2 + len + 2)) { - elt = (bcm_tlv_t*)(elt->data + len); - *buflen -= (2 + len); - } else { - elt = NULL; - } - - return elt; -} - -/* - * Traverse a string of 1-byte tag/1-byte length/variable-length value - * triples, returning a pointer to the substring whose first element - * matches tag. Stop parsing when we see an element whose ID is greater - * than the target key. - */ -bcm_tlv_t * -bcm_parse_ordered_tlvs(void *buf, int buflen, uint key) -{ - bcm_tlv_t *elt; - int totlen; - - elt = (bcm_tlv_t*)buf; - totlen = buflen; - - /* find tagged parameter */ - while (totlen >= 2) { - uint id = elt->id; - int len = elt->len; - - /* Punt if we start seeing IDs > than target key */ - if (id > key) - return(NULL); - - /* validate remaining totlen */ - if ((id == key) && (totlen >= (len + 2))) - return (elt); - - elt = (bcm_tlv_t*)((uint8*)elt + (len + 2)); - totlen -= (len + 2); - } - return NULL; -} - - -/* - * Traverse a string of 1-byte tag/1-byte length/variable-length value - * triples, returning a pointer to the substring whose first element - * matches tag - */ -bcm_tlv_t * -bcm_parse_tlvs(void *buf, int buflen, uint key) -{ - bcm_tlv_t *elt; - int totlen; - - elt = (bcm_tlv_t*)buf; - totlen = buflen; - - /* find tagged parameter */ - while (totlen >= 2) { - int len = elt->len; - - /* validate remaining totlen */ - if ((elt->id == key) && (totlen >= (len + 2))) - return (elt); - - elt = (bcm_tlv_t*)((uint8*)elt + (len + 2)); - totlen -= (len + 2); - } - - return NULL; -} - -void -pktq_init(struct pktq *q, uint maxlen, bool priority) -{ - q->head = q->tail = NULL; - q->priority = priority; - q->maxlen = maxlen; - q->len = 0; -} - -bool -pktenq(struct pktq *q, void *p, bool lifo) -{ - void *next, *prev; - - /* Queue is full */ - if (q->len >= q->maxlen) - return FALSE; - - /* Queueing chains not allowed */ - ASSERT(PKTLINK(p) == NULL); - - /* Queue is empty */ - if (q->tail == NULL) { - ASSERT(q->head == NULL); - q->head = q->tail = p; - } - - /* Insert at head or tail */ - else if (q->priority == FALSE) { - /* Insert at head (LIFO) */ - if (lifo) { - PKTSETLINK(p, q->head); - q->head = p; - } - /* Insert at tail (FIFO) */ - else { - ASSERT(PKTLINK(q->tail) == NULL); - PKTSETLINK(q->tail, p); - PKTSETLINK(p, NULL); - q->tail = p; - } - } - - /* Insert by priority */ - else { - ASSERT(q->head); - ASSERT(q->tail); - /* Shortcut to insertion at tail */ - if (PKTPRIO(p) < PKTPRIO(q->tail) || - (!lifo && PKTPRIO(p) <= PKTPRIO(q->tail))) { - prev = q->tail; - next = NULL; - } - /* Insert at head or in the middle */ - else { - prev = NULL; - next = q->head; - } - /* Walk the queue */ - for (; next; prev = next, next = PKTLINK(next)) { - /* Priority queue invariant */ - ASSERT(!prev || PKTPRIO(prev) >= PKTPRIO(next)); - /* Insert at head of string of packets of same priority (LIFO) */ - if (lifo) { - if (PKTPRIO(p) >= PKTPRIO(next)) - break; - } - /* Insert at tail of string of packets of same priority (FIFO) */ - else { - if (PKTPRIO(p) > PKTPRIO(next)) - break; - } - } - /* Insert at tail */ - if (next == NULL) { - ASSERT(PKTLINK(q->tail) == NULL); - PKTSETLINK(q->tail, p); - PKTSETLINK(p, NULL); - q->tail = p; - } - /* Insert in the middle */ - else if (prev) { - PKTSETLINK(prev, p); - PKTSETLINK(p, next); - } - /* Insert at head */ - else { - PKTSETLINK(p, q->head); - q->head = p; - } - } - - /* List invariants after insertion */ - ASSERT(q->head); - ASSERT(PKTLINK(q->tail) == NULL); - - q->len++; - return TRUE; -} - -void* -pktdeq(struct pktq *q) -{ - void *p; - - if ((p = q->head)) { - ASSERT(q->tail); - q->head = PKTLINK(p); - PKTSETLINK(p, NULL); - q->len--; - if (q->head == NULL) - q->tail = NULL; - } - else { - ASSERT(q->tail == NULL); - } - - return (p); -} - -/******************************************************************************* - * crc8 - * - * Computes a crc8 over the input data using the polynomial: - * - * x^8 + x^7 +x^6 + x^4 + x^2 + 1 - * - * The caller provides the initial value (either CRC8_INIT_VALUE - * or the previous returned value) to allow for processing of - * discontiguous blocks of data. When generating the CRC the - * caller is responsible for complementing the final return value - * and inserting it into the byte stream. When checking, a final - * return value of CRC8_GOOD_VALUE indicates a valid CRC. - * - * Reference: Dallas Semiconductor Application Note 27 - * Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms", - * ver 3, Aug 1993, ross@guest.adelaide.edu.au, Rocksoft Pty Ltd., - * ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt - * - ******************************************************************************/ - -static uint8 crc8_table[256] = { - 0x00, 0xF7, 0xB9, 0x4E, 0x25, 0xD2, 0x9C, 0x6B, - 0x4A, 0xBD, 0xF3, 0x04, 0x6F, 0x98, 0xD6, 0x21, - 0x94, 0x63, 0x2D, 0xDA, 0xB1, 0x46, 0x08, 0xFF, - 0xDE, 0x29, 0x67, 0x90, 0xFB, 0x0C, 0x42, 0xB5, - 0x7F, 0x88, 0xC6, 0x31, 0x5A, 0xAD, 0xE3, 0x14, - 0x35, 0xC2, 0x8C, 0x7B, 0x10, 0xE7, 0xA9, 0x5E, - 0xEB, 0x1C, 0x52, 0xA5, 0xCE, 0x39, 0x77, 0x80, - 0xA1, 0x56, 0x18, 0xEF, 0x84, 0x73, 0x3D, 0xCA, - 0xFE, 0x09, 0x47, 0xB0, 0xDB, 0x2C, 0x62, 0x95, - 0xB4, 0x43, 0x0D, 0xFA, 0x91, 0x66, 0x28, 0xDF, - 0x6A, 0x9D, 0xD3, 0x24, 0x4F, 0xB8, 0xF6, 0x01, - 0x20, 0xD7, 0x99, 0x6E, 0x05, 0xF2, 0xBC, 0x4B, - 0x81, 0x76, 0x38, 0xCF, 0xA4, 0x53, 0x1D, 0xEA, - 0xCB, 0x3C, 0x72, 0x85, 0xEE, 0x19, 0x57, 0xA0, - 0x15, 0xE2, 0xAC, 0x5B, 0x30, 0xC7, 0x89, 0x7E, - 0x5F, 0xA8, 0xE6, 0x11, 0x7A, 0x8D, 0xC3, 0x34, - 0xAB, 0x5C, 0x12, 0xE5, 0x8E, 0x79, 0x37, 0xC0, - 0xE1, 0x16, 0x58, 0xAF, 0xC4, 0x33, 0x7D, 0x8A, - 0x3F, 0xC8, 0x86, 0x71, 0x1A, 0xED, 0xA3, 0x54, - 0x75, 0x82, 0xCC, 0x3B, 0x50, 0xA7, 0xE9, 0x1E, - 0xD4, 0x23, 0x6D, 0x9A, 0xF1, 0x06, 0x48, 0xBF, - 0x9E, 0x69, 0x27, 0xD0, 0xBB, 0x4C, 0x02, 0xF5, - 0x40, 0xB7, 0xF9, 0x0E, 0x65, 0x92, 0xDC, 0x2B, - 0x0A, 0xFD, 0xB3, 0x44, 0x2F, 0xD8, 0x96, 0x61, - 0x55, 0xA2, 0xEC, 0x1B, 0x70, 0x87, 0xC9, 0x3E, - 0x1F, 0xE8, 0xA6, 0x51, 0x3A, 0xCD, 0x83, 0x74, - 0xC1, 0x36, 0x78, 0x8F, 0xE4, 0x13, 0x5D, 0xAA, - 0x8B, 0x7C, 0x32, 0xC5, 0xAE, 0x59, 0x17, 0xE0, - 0x2A, 0xDD, 0x93, 0x64, 0x0F, 0xF8, 0xB6, 0x41, - 0x60, 0x97, 0xD9, 0x2E, 0x45, 0xB2, 0xFC, 0x0B, - 0xBE, 0x49, 0x07, 0xF0, 0x9B, 0x6C, 0x22, 0xD5, - 0xF4, 0x03, 0x4D, 0xBA, 0xD1, 0x26, 0x68, 0x9F -}; - -/* - * Search the name=value vars for a specific one and return its value. - * Returns NULL if not found. - */ -char* -getvar(char *vars, char *name) -{ - char *s; - int len; - - len = strlen(name); - - /* first look in vars[] */ - for (s = vars; s && *s; ) { - if ((bcmp(s, name, len) == 0) && (s[len] == '=')) - return (&s[len+1]); - - while (*s++) - ; - } - - /* then query nvram */ - return (nvram_get(name)); -} - -/* - * Search the vars for a specific one and return its value as - * an integer. Returns 0 if not found. - */ -int -getintvar(char *vars, char *name) -{ - char *val; - - if ((val = getvar(vars, name)) == NULL) - return (0); - - return (bcm_strtoul(val, NULL, 0)); -} - -/* return pointer to location of substring 'needle' in 'haystack' */ -char* -bcmstrstr(char *haystack, char *needle) -{ - int len, nlen; - int i; - - if ((haystack == NULL) || (needle == NULL)) - return (haystack); - - nlen = strlen(needle); - len = strlen(haystack) - nlen + 1; - - for (i = 0; i < len; i++) - if (bcmp(needle, &haystack[i], nlen) == 0) - return (&haystack[i]); - return (NULL); -} - -void -bcm_mdelay(uint ms) -{ - uint i; - - for (i = 0; i < ms; i++) { - OSL_DELAY(1000); - } -} - -#define CRC_INNER_LOOP(n, c, x) \ - (c) = ((c) >> 8) ^ crc##n##_table[((c) ^ (x)) & 0xff] - -uint8 -crc8( - uint8 *pdata, /* pointer to array of data to process */ - uint nbytes, /* number of input data bytes to process */ - uint8 crc /* either CRC8_INIT_VALUE or previous return value */ -) -{ - /* hard code the crc loop instead of using CRC_INNER_LOOP macro - * to avoid the undefined and unnecessary (uint8 >> 8) operation. */ - while (nbytes-- > 0) - crc = crc8_table[(crc ^ *pdata++) & 0xff]; - - return crc; -} - -/******************************************************************************* - * crc16 - * - * Computes a crc16 over the input data using the polynomial: - * - * x^16 + x^12 +x^5 + 1 - * - * The caller provides the initial value (either CRC16_INIT_VALUE - * or the previous returned value) to allow for processing of - * discontiguous blocks of data. When generating the CRC the - * caller is responsible for complementing the final return value - * and inserting it into the byte stream. When checking, a final - * return value of CRC16_GOOD_VALUE indicates a valid CRC. - * - * Reference: Dallas Semiconductor Application Note 27 - * Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms", - * ver 3, Aug 1993, ross@guest.adelaide.edu.au, Rocksoft Pty Ltd., - * ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt - * - ******************************************************************************/ - -static uint16 crc16_table[256] = { - 0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF, - 0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7, - 0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E, - 0x9CC9, 0x8D40, 0xBFDB, 0xAE52, 0xDAED, 0xCB64, 0xF9FF, 0xE876, - 0x2102, 0x308B, 0x0210, 0x1399, 0x6726, 0x76AF, 0x4434, 0x55BD, - 0xAD4A, 0xBCC3, 0x8E58, 0x9FD1, 0xEB6E, 0xFAE7, 0xC87C, 0xD9F5, - 0x3183, 0x200A, 0x1291, 0x0318, 0x77A7, 0x662E, 0x54B5, 0x453C, - 0xBDCB, 0xAC42, 0x9ED9, 0x8F50, 0xFBEF, 0xEA66, 0xD8FD, 0xC974, - 0x4204, 0x538D, 0x6116, 0x709F, 0x0420, 0x15A9, 0x2732, 0x36BB, - 0xCE4C, 0xDFC5, 0xED5E, 0xFCD7, 0x8868, 0x99E1, 0xAB7A, 0xBAF3, - 0x5285, 0x430C, 0x7197, 0x601E, 0x14A1, 0x0528, 0x37B3, 0x263A, - 0xDECD, 0xCF44, 0xFDDF, 0xEC56, 0x98E9, 0x8960, 0xBBFB, 0xAA72, - 0x6306, 0x728F, 0x4014, 0x519D, 0x2522, 0x34AB, 0x0630, 0x17B9, - 0xEF4E, 0xFEC7, 0xCC5C, 0xDDD5, 0xA96A, 0xB8E3, 0x8A78, 0x9BF1, - 0x7387, 0x620E, 0x5095, 0x411C, 0x35A3, 0x242A, 0x16B1, 0x0738, - 0xFFCF, 0xEE46, 0xDCDD, 0xCD54, 0xB9EB, 0xA862, 0x9AF9, 0x8B70, - 0x8408, 0x9581, 0xA71A, 0xB693, 0xC22C, 0xD3A5, 0xE13E, 0xF0B7, - 0x0840, 0x19C9, 0x2B52, 0x3ADB, 0x4E64, 0x5FED, 0x6D76, 0x7CFF, - 0x9489, 0x8500, 0xB79B, 0xA612, 0xD2AD, 0xC324, 0xF1BF, 0xE036, - 0x18C1, 0x0948, 0x3BD3, 0x2A5A, 0x5EE5, 0x4F6C, 0x7DF7, 0x6C7E, - 0xA50A, 0xB483, 0x8618, 0x9791, 0xE32E, 0xF2A7, 0xC03C, 0xD1B5, - 0x2942, 0x38CB, 0x0A50, 0x1BD9, 0x6F66, 0x7EEF, 0x4C74, 0x5DFD, - 0xB58B, 0xA402, 0x9699, 0x8710, 0xF3AF, 0xE226, 0xD0BD, 0xC134, - 0x39C3, 0x284A, 0x1AD1, 0x0B58, 0x7FE7, 0x6E6E, 0x5CF5, 0x4D7C, - 0xC60C, 0xD785, 0xE51E, 0xF497, 0x8028, 0x91A1, 0xA33A, 0xB2B3, - 0x4A44, 0x5BCD, 0x6956, 0x78DF, 0x0C60, 0x1DE9, 0x2F72, 0x3EFB, - 0xD68D, 0xC704, 0xF59F, 0xE416, 0x90A9, 0x8120, 0xB3BB, 0xA232, - 0x5AC5, 0x4B4C, 0x79D7, 0x685E, 0x1CE1, 0x0D68, 0x3FF3, 0x2E7A, - 0xE70E, 0xF687, 0xC41C, 0xD595, 0xA12A, 0xB0A3, 0x8238, 0x93B1, - 0x6B46, 0x7ACF, 0x4854, 0x59DD, 0x2D62, 0x3CEB, 0x0E70, 0x1FF9, - 0xF78F, 0xE606, 0xD49D, 0xC514, 0xB1AB, 0xA022, 0x92B9, 0x8330, - 0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78 -}; - -uint16 -crc16( - uint8 *pdata, /* pointer to array of data to process */ - uint nbytes, /* number of input data bytes to process */ - uint16 crc /* either CRC16_INIT_VALUE or previous return value */ -) -{ - while (nbytes-- > 0) - CRC_INNER_LOOP(16, crc, *pdata++); - return crc; -} - -static uint32 crc32_table[256] = { - 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, - 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, - 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, - 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, - 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, - 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, - 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, - 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, - 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, - 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, - 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, - 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, - 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, - 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, - 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, - 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, - 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, - 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, - 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, - 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, - 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, - 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, - 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, - 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, - 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, - 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, - 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, - 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, - 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, - 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, - 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, - 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, - 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, - 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, - 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, - 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, - 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, - 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, - 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, - 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, - 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, - 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, - 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, - 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, - 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, - 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, - 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, - 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, - 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, - 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, - 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, - 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, - 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, - 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, - 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, - 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, - 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, - 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, - 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, - 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, - 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, - 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, - 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, - 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D -}; - -uint32 -crc32( - uint8 *pdata, /* pointer to array of data to process */ - uint nbytes, /* number of input data bytes to process */ - uint32 crc /* either CRC32_INIT_VALUE or previous return value */ -) -{ - uint8 *pend; -#ifdef __mips__ - uint8 tmp[4]; - ulong *tptr = (ulong *)tmp; - - /* in case the beginning of the buffer isn't aligned */ - pend = (uint8 *)((uint)(pdata + 3) & 0xfffffffc); - nbytes -= (pend - pdata); - while (pdata < pend) - CRC_INNER_LOOP(32, crc, *pdata++); - - /* handle bulk of data as 32-bit words */ - pend = pdata + (nbytes & 0xfffffffc); - while (pdata < pend) { - *tptr = (*((ulong *)pdata))++; - CRC_INNER_LOOP(32, crc, tmp[0]); - CRC_INNER_LOOP(32, crc, tmp[1]); - CRC_INNER_LOOP(32, crc, tmp[2]); - CRC_INNER_LOOP(32, crc, tmp[3]); - } - - /* 1-3 bytes at end of buffer */ - pend = pdata + (nbytes & 0x03); - while (pdata < pend) - CRC_INNER_LOOP(32, crc, *pdata++); -#else - pend = pdata + nbytes; - while (pdata < pend) - CRC_INNER_LOOP(32, crc, *pdata++); -#endif - - return crc; -} - -#ifdef notdef -#define CLEN 1499 -#define CBUFSIZ (CLEN+4) -#define CNBUFS 5 - -void testcrc32(void) -{ - uint j,k,l; - uint8 *buf; - uint len[CNBUFS]; - uint32 crcr; - uint32 crc32tv[CNBUFS] = - {0xd2cb1faa, 0xd385c8fa, 0xf5b4f3f3, 0x55789e20, 0x00343110}; - - ASSERT((buf = MALLOC(CBUFSIZ*CNBUFS)) != NULL); - - /* step through all possible alignments */ - for (l=0;l<=4;l++) { - for (j=0; j -#include -#include -#include - -struct dma_info; /* forward declaration */ -#define di_t struct dma_info -#include - -/* debug/trace */ -#define DMA_ERROR(args) -#define DMA_TRACE(args) - -/* default dma message level(if input msg_level pointer is null in dma_attach()) */ -static uint dma_msg_level = 0; - -#define MAXNAMEL 8 -#define MAXDD (DMAMAXRINGSZ / sizeof (dmadd_t)) - -/* dma engine software state */ -typedef struct dma_info { - hnddma_t hnddma; /* exported structure */ - uint *msg_level; /* message level pointer */ - - char name[MAXNAMEL]; /* callers name for diag msgs */ - void *drv; /* driver handle */ - void *dev; /* device handle */ - dmaregs_t *regs; /* dma engine registers */ - - dmadd_t *txd; /* pointer to chip-specific tx descriptor ring */ - uint txin; /* index of next descriptor to reclaim */ - uint txout; /* index of next descriptor to post */ - uint txavail; /* # free tx descriptors */ - void *txp[MAXDD]; /* parallel array of pointers to packets */ - ulong txdpa; /* physical address of descriptor ring */ - uint txdalign; /* #bytes added to alloc'd mem to align txd */ - - dmadd_t *rxd; /* pointer to chip-specific rx descriptor ring */ - uint rxin; /* index of next descriptor to reclaim */ - uint rxout; /* index of next descriptor to post */ - void *rxp[MAXDD]; /* parallel array of pointers to packets */ - ulong rxdpa; /* physical address of descriptor ring */ - uint rxdalign; /* #bytes added to alloc'd mem to align rxd */ - - /* tunables */ - uint ntxd; /* # tx descriptors */ - uint nrxd; /* # rx descriptors */ - uint rxbufsize; /* rx buffer size in bytes */ - uint nrxpost; /* # rx buffers to keep posted */ - uint rxoffset; /* rxcontrol offset */ - uint ddoffset; /* add to get dma address of descriptor ring */ - uint dataoffset; /* add to get dma address of data buffer */ -} dma_info_t; - -/* descriptor bumping macros */ -#define TXD(x) ((x) & (di->ntxd - 1)) -#define RXD(x) ((x) & (di->nrxd - 1)) -#define NEXTTXD(i) TXD(i + 1) -#define PREVTXD(i) TXD(i - 1) -#define NEXTRXD(i) RXD(i + 1) -#define NTXDACTIVE(h, t) TXD(t - h) -#define NRXDACTIVE(h, t) RXD(t - h) - -/* macros to convert between byte offsets and indexes */ -#define B2I(bytes) ((bytes) / sizeof (dmadd_t)) -#define I2B(index) ((index) * sizeof (dmadd_t)) - -void* -dma_attach(void *drv, void *dev, char *name, dmaregs_t *regs, uint ntxd, uint nrxd, - uint rxbufsize, uint nrxpost, uint rxoffset, uint ddoffset, uint dataoffset, uint *msg_level) -{ - dma_info_t *di; - void *va; - - ASSERT(ntxd <= MAXDD); - ASSERT(nrxd <= MAXDD); - - /* allocate private info structure */ - if ((di = MALLOC(sizeof (dma_info_t))) == NULL) - return (NULL); - bzero((char*)di, sizeof (dma_info_t)); - - /* set message level */ - di->msg_level = msg_level ? msg_level : &dma_msg_level; - - DMA_TRACE(("%s: dma_attach: drv 0x%x dev 0x%x regs 0x%x ntxd %d nrxd %d rxbufsize %d nrxpost %d rxoffset %d ddoffset 0x%x dataoffset 0x%x\n", name, (uint)drv, (uint)dev, (uint)regs, ntxd, nrxd, rxbufsize, nrxpost, rxoffset, ddoffset, dataoffset)); - - /* make a private copy of our callers name */ - strncpy(di->name, name, MAXNAMEL); - di->name[MAXNAMEL-1] = '\0'; - - di->drv = drv; - di->dev = dev; - di->regs = regs; - - /* allocate transmit descriptor ring */ - if (ntxd) { - if ((va = DMA_ALLOC_CONSISTENT(dev, (DMAMAXRINGSZ + DMARINGALIGN), &di->txdpa)) == NULL) - goto fail; - di->txd = (dmadd_t*) ROUNDUP(va, DMARINGALIGN); - di->txdalign = ((uint)di->txd - (uint)va); - di->txdpa = di->txdpa + di->txdalign; - ASSERT(ISALIGNED(di->txd, DMARINGALIGN)); - } - - /* allocate receive descriptor ring */ - if (nrxd) { - if ((va = DMA_ALLOC_CONSISTENT(dev, (DMAMAXRINGSZ + DMARINGALIGN), &di->rxdpa)) == NULL) - goto fail; - di->rxd = (dmadd_t*) ROUNDUP(va, DMARINGALIGN); - di->rxdalign = ((uint)di->rxd - (uint)va); - di->rxdpa = di->rxdpa + di->rxdalign; - ASSERT(ISALIGNED(di->rxd, DMARINGALIGN)); - } - - /* save tunables */ - di->ntxd = ntxd; - di->nrxd = nrxd; - di->rxbufsize = rxbufsize; - di->nrxpost = nrxpost; - di->rxoffset = rxoffset; - di->ddoffset = ddoffset; - di->dataoffset = dataoffset; - - return ((void*)di); - -fail: - dma_detach((void*)di); - return (NULL); -} - -/* may be called with core in reset */ -void -dma_detach(dma_info_t *di) -{ - if (di == NULL) - return; - - DMA_TRACE(("%s: dma_detach\n", di->name)); - - /* shouldn't be here if descriptors are unreclaimed */ - ASSERT(di->txin == di->txout); - ASSERT(di->rxin == di->rxout); - - /* free dma descriptor rings */ - if (di->txd) - DMA_FREE_CONSISTENT(di->dev, (void *)((uint)di->txd - di->txdalign), (DMAMAXRINGSZ + DMARINGALIGN), di->txdpa); - if (di->rxd) - DMA_FREE_CONSISTENT(di->dev, (void *)((uint)di->rxd - di->rxdalign), (DMAMAXRINGSZ + DMARINGALIGN), di->rxdpa); - - /* free our private info structure */ - MFREE((void*)di, sizeof (dma_info_t)); -} - - -void -dma_txreset(dma_info_t *di) -{ - uint32 status; - - DMA_TRACE(("%s: dma_txreset\n", di->name)); - - /* suspend tx DMA first */ - W_REG(&di->regs->xmtcontrol, XC_SE); - SPINWAIT((status = (R_REG(&di->regs->xmtstatus) & XS_XS_MASK)) != XS_XS_DISABLED && - status != XS_XS_IDLE && - status != XS_XS_STOPPED, - 10000); - - W_REG(&di->regs->xmtcontrol, 0); - SPINWAIT((status = (R_REG(&di->regs->xmtstatus) & XS_XS_MASK)) != XS_XS_DISABLED, - 10000); - - if (status != XS_XS_DISABLED) { - DMA_ERROR(("%s: dma_txreset: dma cannot be stopped\n", di->name)); - } - - /* wait for the last transaction to complete */ - OSL_DELAY(300); -} - -void -dma_rxreset(dma_info_t *di) -{ - uint32 status; - - DMA_TRACE(("%s: dma_rxreset\n", di->name)); - - W_REG(&di->regs->rcvcontrol, 0); - SPINWAIT((status = (R_REG(&di->regs->rcvstatus) & RS_RS_MASK)) != RS_RS_DISABLED, - 10000); - - if (status != RS_RS_DISABLED) { - DMA_ERROR(("%s: dma_rxreset: dma cannot be stopped\n", di->name)); - } -} - -void -dma_txinit(dma_info_t *di) -{ - DMA_TRACE(("%s: dma_txinit\n", di->name)); - - di->txin = di->txout = 0; - di->txavail = di->ntxd - 1; - - /* clear tx descriptor ring */ - BZERO_SM((void*)di->txd, (di->ntxd * sizeof (dmadd_t))); - - W_REG(&di->regs->xmtcontrol, XC_XE); - W_REG(&di->regs->xmtaddr, (di->txdpa + di->ddoffset)); -} - -bool -dma_txenabled(dma_info_t *di) -{ - uint32 xc; - - /* If the chip is dead, it is not enabled :-) */ - xc = R_REG(&di->regs->xmtcontrol); - return ((xc != 0xffffffff) && (xc & XC_XE)); -} - -void -dma_txsuspend(dma_info_t *di) -{ - DMA_TRACE(("%s: dma_txsuspend\n", di->name)); - OR_REG(&di->regs->xmtcontrol, XC_SE); -} - -void -dma_txresume(dma_info_t *di) -{ - DMA_TRACE(("%s: dma_txresume\n", di->name)); - AND_REG(&di->regs->xmtcontrol, ~XC_SE); -} - -bool -dma_txsuspended(dma_info_t *di) -{ - if (!(R_REG(&di->regs->xmtcontrol) & XC_SE)) - return 0; - - if ((R_REG(&di->regs->xmtstatus) & XS_XS_MASK) != XS_XS_IDLE) - return 0; - - OSL_DELAY(2); - return ((R_REG(&di->regs->xmtstatus) & XS_XS_MASK) == XS_XS_IDLE); -} - -bool -dma_txstopped(dma_info_t *di) -{ - return ((R_REG(&di->regs->xmtstatus) & XS_XS_MASK) == XS_XS_STOPPED); -} - -bool -dma_rxstopped(dma_info_t *di) -{ - return ((R_REG(&di->regs->rcvstatus) & RS_RS_MASK) == RS_RS_STOPPED); -} - -void -dma_fifoloopbackenable(dma_info_t *di) -{ - DMA_TRACE(("%s: dma_fifoloopbackenable\n", di->name)); - OR_REG(&di->regs->xmtcontrol, XC_LE); -} - -void -dma_rxinit(dma_info_t *di) -{ - DMA_TRACE(("%s: dma_rxinit\n", di->name)); - - di->rxin = di->rxout = 0; - - /* clear rx descriptor ring */ - BZERO_SM((void*)di->rxd, (di->nrxd * sizeof (dmadd_t))); - - dma_rxenable(di); - W_REG(&di->regs->rcvaddr, (di->rxdpa + di->ddoffset)); -} - -void -dma_rxenable(dma_info_t *di) -{ - DMA_TRACE(("%s: dma_rxenable\n", di->name)); - W_REG(&di->regs->rcvcontrol, ((di->rxoffset << RC_RO_SHIFT) | RC_RE)); -} - -bool -dma_rxenabled(dma_info_t *di) -{ - uint32 rc; - - rc = R_REG(&di->regs->rcvcontrol); - return ((rc != 0xffffffff) && (rc & RC_RE)); -} - -/* - * The BCM47XX family supports full 32bit dma engine buffer addressing so - * dma buffers can cross 4 Kbyte page boundaries. - */ -int -dma_txfast(dma_info_t *di, void *p0, uint32 coreflags) -{ - void *p, *next; - uchar *data; - uint len; - uint txout; - uint32 ctrl; - uint32 pa; - - DMA_TRACE(("%s: dma_txfast\n", di->name)); - - txout = di->txout; - ctrl = 0; - - /* - * Walk the chain of packet buffers - * allocating and initializing transmit descriptor entries. - */ - for (p = p0; p; p = next) { - data = PKTDATA(di->drv, p); - len = PKTLEN(di->drv, p); - next = PKTNEXT(di->drv, p); - - /* return nonzero if out of tx descriptors */ - if (NEXTTXD(txout) == di->txin) - goto outoftxd; - - if (len == 0) - continue; - - /* get physical address of buffer start */ - pa = (uint32) DMA_MAP(di->dev, data, len, DMA_TX, p); - - /* build the descriptor control value */ - ctrl = len & CTRL_BC_MASK; - - ctrl |= coreflags; - - if (p == p0) - ctrl |= CTRL_SOF; - if (next == NULL) - ctrl |= (CTRL_IOC | CTRL_EOF); - if (txout == (di->ntxd - 1)) - ctrl |= CTRL_EOT; - - /* init the tx descriptor */ - W_SM(&di->txd[txout].ctrl, BUS_SWAP32(ctrl)); - W_SM(&di->txd[txout].addr, BUS_SWAP32(pa + di->dataoffset)); - - ASSERT(di->txp[txout] == NULL); - - txout = NEXTTXD(txout); - } - - /* if last txd eof not set, fix it */ - if (!(ctrl & CTRL_EOF)) - W_SM(&di->txd[PREVTXD(txout)].ctrl, BUS_SWAP32(ctrl | CTRL_IOC | CTRL_EOF)); - - /* save the packet */ - di->txp[PREVTXD(txout)] = p0; - - /* bump the tx descriptor index */ - di->txout = txout; - - /* kick the chip */ - W_REG(&di->regs->xmtptr, I2B(txout)); - - /* tx flow control */ - di->txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1; - - return (0); - -outoftxd: - DMA_ERROR(("%s: dma_txfast: out of txds\n", di->name)); - PKTFREE(di->drv, p0, TRUE); - di->txavail = 0; - di->hnddma.txnobuf++; - return (-1); -} - -#define PAGESZ 4096 -#define PAGEBASE(x) ((uint)(x) & ~4095) - -/* - * Just like above except go through the extra effort of splitting - * buffers that cross 4Kbyte boundaries into multiple tx descriptors. - */ -int -dma_tx(dma_info_t *di, void *p0, uint32 coreflags) -{ - void *p, *next; - uchar *data; - uint plen, len; - uchar *page, *start, *end; - uint txout; - uint32 ctrl; - uint32 pa; - - DMA_TRACE(("%s: dma_tx\n", di->name)); - - txout = di->txout; - ctrl = 0; - - /* - * Walk the chain of packet buffers - * splitting those that cross 4 Kbyte boundaries - * allocating and initializing transmit descriptor entries. - */ - for (p = p0; p; p = next) { - data = PKTDATA(di->drv, p); - plen = PKTLEN(di->drv, p); - next = PKTNEXT(di->drv, p); - - if (plen == 0) - continue; - - for (page = (uchar*)PAGEBASE(data); - page <= (uchar*)PAGEBASE(data + plen - 1); - page += PAGESZ) { - - /* return nonzero if out of tx descriptors */ - if (NEXTTXD(txout) == di->txin) - goto outoftxd; - - start = (page == (uchar*)PAGEBASE(data))? data: page; - end = (page == (uchar*)PAGEBASE(data + plen))? - (data + plen): (page + PAGESZ); - len = end - start; - - /* build the descriptor control value */ - ctrl = len & CTRL_BC_MASK; - - ctrl |= coreflags; - - if ((p == p0) && (start == data)) - ctrl |= CTRL_SOF; - if ((next == NULL) && (end == (data + plen))) - ctrl |= (CTRL_IOC | CTRL_EOF); - if (txout == (di->ntxd - 1)) - ctrl |= CTRL_EOT; - - /* get physical address of buffer start */ - pa = (uint32) DMA_MAP(di->dev, start, len, DMA_TX, p); - - /* init the tx descriptor */ - W_SM(&di->txd[txout].ctrl, BUS_SWAP32(ctrl)); - W_SM(&di->txd[txout].addr, BUS_SWAP32(pa + di->dataoffset)); - - ASSERT(di->txp[txout] == NULL); - - txout = NEXTTXD(txout); - } - } - - /* if last txd eof not set, fix it */ - if (!(ctrl & CTRL_EOF)) - W_SM(&di->txd[PREVTXD(txout)].ctrl, BUS_SWAP32(ctrl | CTRL_IOC | CTRL_EOF)); - - /* save the packet */ - di->txp[PREVTXD(txout)] = p0; - - /* bump the tx descriptor index */ - di->txout = txout; - - /* kick the chip */ - W_REG(&di->regs->xmtptr, I2B(txout)); - - /* tx flow control */ - di->txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1; - - return (0); - -outoftxd: - DMA_ERROR(("%s: dma_tx: out of txds\n", di->name)); - PKTFREE(di->drv, p0, TRUE); - di->txavail = 0; - di->hnddma.txnobuf++; - return (-1); -} - -/* returns a pointer to the next frame received, or NULL if there are no more */ -void* -dma_rx(dma_info_t *di) -{ - void *p; - uint len; - int skiplen = 0; - - while ((p = dma_getnextrxp(di, FALSE))) { - /* skip giant packets which span multiple rx descriptors */ - if (skiplen > 0) { - skiplen -= di->rxbufsize; - if (skiplen < 0) - skiplen = 0; - PKTFREE(di->drv, p, FALSE); - continue; - } - - len = ltoh16(*(uint16*)(PKTDATA(di->drv, p))); - DMA_TRACE(("%s: dma_rx len %d\n", di->name, len)); - - /* bad frame length check */ - if (len > (di->rxbufsize - di->rxoffset)) { - DMA_ERROR(("%s: dma_rx: bad frame length (%d)\n", di->name, len)); - if (len > 0) - skiplen = len - (di->rxbufsize - di->rxoffset); - PKTFREE(di->drv, p, FALSE); - di->hnddma.rxgiants++; - continue; - } - - /* set actual length */ - PKTSETLEN(di->drv, p, (di->rxoffset + len)); - - break; - } - - return (p); -} - -/* post receive buffers */ -void -dma_rxfill(dma_info_t *di) -{ - void *p; - uint rxin, rxout; - uint ctrl; - uint n; - uint i; - uint32 pa; - uint rxbufsize; - - /* - * Determine how many receive buffers we're lacking - * from the full complement, allocate, initialize, - * and post them, then update the chip rx lastdscr. - */ - - rxin = di->rxin; - rxout = di->rxout; - rxbufsize = di->rxbufsize; - - n = di->nrxpost - NRXDACTIVE(rxin, rxout); - - DMA_TRACE(("%s: dma_rxfill: post %d\n", di->name, n)); - - for (i = 0; i < n; i++) { - if ((p = PKTGET(di->drv, rxbufsize, FALSE)) == NULL) { - DMA_ERROR(("%s: dma_rxfill: out of rxbufs\n", di->name)); - di->hnddma.rxnobuf++; - break; - } - - *(uint32*)(OSL_UNCACHED(PKTDATA(di->drv, p))) = 0; - - pa = (uint32) DMA_MAP(di->dev, PKTDATA(di->drv, p), rxbufsize, DMA_RX, p); - ASSERT(ISALIGNED(pa, 4)); - - /* save the free packet pointer */ - ASSERT(di->rxp[rxout] == NULL); - di->rxp[rxout] = p; - - /* prep the descriptor control value */ - ctrl = rxbufsize; - if (rxout == (di->nrxd - 1)) - ctrl |= CTRL_EOT; - - /* init the rx descriptor */ - W_SM(&di->rxd[rxout].ctrl, BUS_SWAP32(ctrl)); - W_SM(&di->rxd[rxout].addr, BUS_SWAP32(pa + di->dataoffset)); - - rxout = NEXTRXD(rxout); - } - - di->rxout = rxout; - - /* update the chip lastdscr pointer */ - W_REG(&di->regs->rcvptr, I2B(rxout)); -} - -void -dma_txreclaim(dma_info_t *di, bool forceall) -{ - void *p; - - DMA_TRACE(("%s: dma_txreclaim %s\n", di->name, forceall ? "all" : "")); - - while ((p = dma_getnexttxp(di, forceall))) - PKTFREE(di->drv, p, TRUE); -} - -/* - * Reclaim next completed txd (txds if using chained buffers) and - * return associated packet. - * If 'force' is true, reclaim txd(s) and return associated packet - * regardless of the value of the hardware "curr" pointer. - */ -void* -dma_getnexttxp(dma_info_t *di, bool forceall) -{ - uint start, end, i; - void *txp; - - DMA_TRACE(("%s: dma_getnexttxp %s\n", di->name, forceall ? "all" : "")); - - txp = NULL; - - start = di->txin; - if (forceall) - end = di->txout; - else - end = B2I(R_REG(&di->regs->xmtstatus) & XS_CD_MASK); - - if ((start == 0) && (end > di->txout)) - goto bogus; - - for (i = start; i != end && !txp; i = NEXTTXD(i)) { - DMA_UNMAP(di->dev, (BUS_SWAP32(R_SM(&di->txd[i].addr)) - di->dataoffset), - (BUS_SWAP32(R_SM(&di->txd[i].ctrl)) & CTRL_BC_MASK), DMA_TX, di->txp[i]); - W_SM(&di->txd[i].addr, 0xdeadbeef); - txp = di->txp[i]; - di->txp[i] = NULL; - } - - di->txin = i; - - /* tx flow control */ - di->txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1; - - return (txp); - -bogus: -/* - DMA_ERROR(("dma_getnexttxp: bogus curr: start %d end %d txout %d force %d\n", - start, end, di->txout, forceall)); -*/ - return (NULL); -} - -/* like getnexttxp but no reclaim */ -void* -dma_peeknexttxp(dma_info_t *di) -{ - uint end, i; - - end = B2I(R_REG(&di->regs->xmtstatus) & XS_CD_MASK); - - for (i = di->txin; i != end; i = NEXTTXD(i)) - if (di->txp[i]) - return (di->txp[i]); - - return (NULL); -} - -void -dma_rxreclaim(dma_info_t *di) -{ - void *p; - - DMA_TRACE(("%s: dma_rxreclaim\n", di->name)); - - while ((p = dma_getnextrxp(di, TRUE))) - PKTFREE(di->drv, p, FALSE); -} - -void * -dma_getnextrxp(dma_info_t *di, bool forceall) -{ - uint i; - void *rxp; - - /* if forcing, dma engine must be disabled */ - ASSERT(!forceall || !dma_rxenabled(di)); - - i = di->rxin; - - /* return if no packets posted */ - if (i == di->rxout) - return (NULL); - - /* ignore curr if forceall */ - if (!forceall && (i == B2I(R_REG(&di->regs->rcvstatus) & RS_CD_MASK))) - return (NULL); - - /* get the packet pointer that corresponds to the rx descriptor */ - rxp = di->rxp[i]; - ASSERT(rxp); - di->rxp[i] = NULL; - - /* clear this packet from the descriptor ring */ - DMA_UNMAP(di->dev, (BUS_SWAP32(R_SM(&di->rxd[i].addr)) - di->dataoffset), - di->rxbufsize, DMA_RX, rxp); - W_SM(&di->rxd[i].addr, 0xdeadbeef); - - di->rxin = NEXTRXD(i); - - return (rxp); -} - -char* -dma_dumptx(dma_info_t *di, char *buf) -{ - buf += sprintf(buf, "txd 0x%lx txdpa 0x%lx txp 0x%lx txin %d txout %d txavail %d\n", - (ulong)di->txd, di->txdpa, (ulong)di->txp, di->txin, di->txout, di->txavail); - buf += sprintf(buf, "xmtcontrol 0x%x xmtaddr 0x%x xmtptr 0x%x xmtstatus 0x%x\n", - R_REG(&di->regs->xmtcontrol), - R_REG(&di->regs->xmtaddr), - R_REG(&di->regs->xmtptr), - R_REG(&di->regs->xmtstatus)); - return (buf); -} - -char* -dma_dumprx(dma_info_t *di, char *buf) -{ - buf += sprintf(buf, "rxd 0x%lx rxdpa 0x%lx rxp 0x%lx rxin %d rxout %d\n", - (ulong)di->rxd, di->rxdpa, (ulong)di->rxp, di->rxin, di->rxout); - buf += sprintf(buf, "rcvcontrol 0x%x rcvaddr 0x%x rcvptr 0x%x rcvstatus 0x%x\n", - R_REG(&di->regs->rcvcontrol), - R_REG(&di->regs->rcvaddr), - R_REG(&di->regs->rcvptr), - R_REG(&di->regs->rcvstatus)); - return (buf); -} - -char* -dma_dump(dma_info_t *di, char *buf) -{ - buf = dma_dumptx(di, buf); - buf = dma_dumprx(di, buf); - return (buf); -} - -uint -dma_getvar(dma_info_t *di, char *name) -{ - if (!strcmp(name, "&txavail")) - return ((uint) &di->txavail); - else { - ASSERT(0); - } - return (0); -} - -void -dma_txblock(dma_info_t *di) -{ - di->txavail = 0; -} - -void -dma_txunblock(dma_info_t *di) -{ - di->txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1; -} - -uint -dma_txactive(dma_info_t *di) -{ - return (NTXDACTIVE(di->txin, di->txout)); -} - -/* - * Rotate all active tx dma ring entries "forward" by (ActiveDescriptor - txin). - */ -void -dma_txrotate(di_t *di) -{ - uint ad; - uint nactive; - uint rot; - uint old, new; - uint32 w; - uint first, last; - - ASSERT(dma_txsuspended(di)); - - nactive = dma_txactive(di); - ad = B2I((R_REG(&di->regs->xmtstatus) & XS_AD_MASK) >> XS_AD_SHIFT); - rot = TXD(ad - di->txin); - - ASSERT(rot < di->ntxd); - - /* full-ring case is a lot harder - don't worry about this */ - if (rot >= (di->ntxd - nactive)) { - DMA_ERROR(("%s: dma_txrotate: ring full - punt\n", di->name)); - return; - } - - first = di->txin; - last = PREVTXD(di->txout); - - /* move entries starting at last and moving backwards to first */ - for (old = last; old != PREVTXD(first); old = PREVTXD(old)) { - new = TXD(old + rot); - - /* - * Move the tx dma descriptor. - * EOT is set only in the last entry in the ring. - */ - w = R_SM(&di->txd[old].ctrl) & ~CTRL_EOT; - if (new == (di->ntxd - 1)) - w |= CTRL_EOT; - W_SM(&di->txd[new].ctrl, w); - W_SM(&di->txd[new].addr, R_SM(&di->txd[old].addr)); - - /* zap the old tx dma descriptor address field */ - W_SM(&di->txd[old].addr, 0xdeadbeef); - - /* move the corresponding txp[] entry */ - ASSERT(di->txp[new] == NULL); - di->txp[new] = di->txp[old]; - di->txp[old] = NULL; - } - - /* update txin and txout */ - di->txin = ad; - di->txout = TXD(di->txout + rot); - di->txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1; - - /* kick the chip */ - W_REG(&di->regs->xmtptr, I2B(di->txout)); -} diff --git a/openwrt/package/linux/kernel-source/drivers/net/hnd/linux_osl.c b/openwrt/package/linux/kernel-source/drivers/net/hnd/linux_osl.c deleted file mode 100644 index 575b046fbe..0000000000 --- a/openwrt/package/linux/kernel-source/drivers/net/hnd/linux_osl.c +++ /dev/null @@ -1,465 +0,0 @@ -/* - * Linux OS Independent Layer - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#define LINUX_OSL - -#include -#include -#include -#include -#include -#include -#ifdef mips -#include -#endif -#include - -#define PCI_CFG_RETRY 10 - -void* -osl_pktget(void *drv, uint len, bool send) -{ - struct sk_buff *skb; - - if ((skb = dev_alloc_skb(len)) == NULL) - return (NULL); - - skb_put(skb, len); - - /* ensure the cookie field is cleared */ - PKTSETCOOKIE(skb, NULL); - - return ((void*) skb); -} - -void -osl_pktfree(void *p) -{ - struct sk_buff *skb, *nskb; - - skb = (struct sk_buff*) p; - - /* perversion: we use skb->next to chain multi-skb packets */ - while (skb) { - nskb = skb->next; - skb->next = NULL; - if (skb->destructor) { - /* cannot kfree_skb() on hard IRQ (net/core/skbuff.c) if destructor exists */ - dev_kfree_skb_any(skb); - } else { - /* can free immediately (even in_irq()) if destructor does not exist */ - dev_kfree_skb(skb); - } - skb = nskb; - } -} - -uint32 -osl_pci_read_config(void *loc, uint offset, uint size) -{ - struct pci_dev *pdev; - uint val; - uint retry=PCI_CFG_RETRY; - - /* only 4byte access supported */ - ASSERT(size == 4); - - pdev = (struct pci_dev*)loc; - do { - pci_read_config_dword(pdev, offset, &val); - if (val != 0xffffffff) - break; - } while (retry--); - - - return (val); -} - -void -osl_pci_write_config(void *loc, uint offset, uint size, uint val) -{ - struct pci_dev *pdev; - uint retry=PCI_CFG_RETRY; - - /* only 4byte access supported */ - ASSERT(size == 4); - - pdev = (struct pci_dev*)loc; - - do { - pci_write_config_dword(pdev, offset, val); - if (offset!=PCI_BAR0_WIN) - break; - if (osl_pci_read_config(loc,offset,size) == val) - break; - } while (retry--); - -} - -static void -osl_pcmcia_attr(void *osh, uint offset, char *buf, int size, bool write) -{ -} - -void -osl_pcmcia_read_attr(void *osh, uint offset, void *buf, int size) -{ - osl_pcmcia_attr(osh, offset, (char *) buf, size, FALSE); -} - -void -osl_pcmcia_write_attr(void *osh, uint offset, void *buf, int size) -{ - osl_pcmcia_attr(osh, offset, (char *) buf, size, TRUE); -} - -#if defined(BINOSL) - -void -osl_assert(char *exp, char *file, int line) -{ - char tempbuf[255]; - - sprintf(tempbuf, "assertion \"%s\" failed: file \"%s\", line %d\n", exp, file, line); - panic(tempbuf); -} - - - -void* -osl_malloc(uint size) -{ - return (kmalloc(size, GFP_ATOMIC)); -} - -void -osl_mfree(void *addr, uint size) -{ - kfree(addr); -} - -uint -osl_malloced(void) -{ -#ifdef MODULE - return malloced; -#else - return 0; -#endif -} - -#endif /* defined(BCMDBG) || defined(BINOSL) */ - -/* - * BINOSL selects the slightly slower function-call-based binary compatible osl. - */ -#ifdef BINOSL - -int -osl_printf(const char *format, ...) -{ - va_list args; - char buf[1024]; - int len; - - /* sprintf into a local buffer because there *is* no "vprintk()".. */ - va_start(args, format); - len = vsprintf(buf, format, args); - va_end(args); - - if (len > sizeof (buf)) { - printk("osl_printf: buffer overrun\n"); - return (0); - } - - return (printk(buf)); -} - -int -osl_sprintf(char *buf, const char *format, ...) -{ - va_list args; - int rc; - - va_start(args, format); - rc = vsprintf(buf, format, args); - va_end(args); - return (rc); -} - -int -osl_strcmp(const char *s1, const char *s2) -{ - return (strcmp(s1, s2)); -} - -int -osl_strncmp(const char *s1, const char *s2, uint n) -{ - return (strncmp(s1, s2, n)); -} - -int -osl_strlen(char *s) -{ - return (strlen(s)); -} - -char* -osl_strcpy(char *d, const char *s) -{ - return (strcpy(d, s)); -} - -char* -osl_strncpy(char *d, const char *s, uint n) -{ - return (strncpy(d, s, n)); -} - -void -bcopy(const void *src, void *dst, int len) -{ - memcpy(dst, src, len); -} - -int -bcmp(const void *b1, const void *b2, int len) -{ - return (memcmp(b1, b2, len)); -} - -void -bzero(void *b, int len) -{ - memset(b, '\0', len); -} - -uint32 -osl_readl(volatile uint32 *r) -{ - return (readl(r)); -} - -uint16 -osl_readw(volatile uint16 *r) -{ - return (readw(r)); -} - -uint8 -osl_readb(volatile uint8 *r) -{ - return (readb(r)); -} - -void -osl_writel(uint32 v, volatile uint32 *r) -{ - writel(v, r); -} - -void -osl_writew(uint16 v, volatile uint16 *r) -{ - writew(v, r); -} - -void -osl_writeb(uint8 v, volatile uint8 *r) -{ - writeb(v, r); -} - -void * -osl_uncached(void *va) -{ -#ifdef mips - return ((void*)KSEG1ADDR(va)); -#else - return ((void*)va); -#endif -} - -uint -osl_getcycles(void) -{ - uint cycles; - -#if defined(mips) - cycles = read_c0_count() * 2; -#elif defined(__i386__) - rdtscl(cycles); -#else - cycles = 0; -#endif - return cycles; -} - -void * -osl_reg_map(uint32 pa, uint size) -{ - return (ioremap_nocache((unsigned long)pa, (unsigned long)size)); -} - -void -osl_reg_unmap(void *va) -{ - iounmap(va); -} - -int -osl_busprobe(uint32 *val, uint32 addr) -{ -#ifdef mips - return get_dbe(*val, (uint32*)addr); -#else - *val = readl(addr); - return 0; -#endif -} - -void* -osl_dma_alloc_consistent(void *dev, uint size, ulong *pap) -{ - return (pci_alloc_consistent((struct pci_dev*)dev, size, (dma_addr_t*)pap)); -} - -void -osl_dma_free_consistent(void *dev, void *va, uint size, ulong pa) -{ - pci_free_consistent((struct pci_dev*)dev, size, va, (dma_addr_t)pa); -} - -uint -osl_dma_map(void *dev, void *va, uint size, int direction) -{ - int dir; - - dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE; - return (pci_map_single(dev, va, size, dir)); -} - -void -osl_dma_unmap(void *dev, uint pa, uint size, int direction) -{ - int dir; - - dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE; - pci_unmap_single(dev, (uint32)pa, size, dir); -} - -void -osl_delay(uint usec) -{ - udelay(usec); -} - -uchar* -osl_pktdata(void *drv, void *skb) -{ - return (((struct sk_buff*)skb)->data); -} - -uint -osl_pktlen(void *drv, void *skb) -{ - return (((struct sk_buff*)skb)->len); -} - -uint -osl_pktheadroom(void *drv, void *skb) -{ - return (uint) skb_headroom((struct sk_buff *) skb); -} - -uint -osl_pkttailroom(void *drv, void *skb) -{ - return (uint) skb_tailroom((struct sk_buff *) skb); -} - -void* -osl_pktnext(void *drv, void *skb) -{ - return (((struct sk_buff*)skb)->next); -} - -void -osl_pktsetnext(void *skb, void *x) -{ - ((struct sk_buff*)skb)->next = (struct sk_buff*)x; -} - -void -osl_pktsetlen(void *drv, void *skb, uint len) -{ - __skb_trim((struct sk_buff*)skb, len); -} - -uchar* -osl_pktpush(void *drv, void *skb, int bytes) -{ - return (skb_push((struct sk_buff*)skb, bytes)); -} - -uchar* -osl_pktpull(void *drv, void *skb, int bytes) -{ - return (skb_pull((struct sk_buff*)skb, bytes)); -} - -void* -osl_pktdup(void *drv, void *skb) -{ - return (skb_clone((struct sk_buff*)skb, GFP_ATOMIC)); -} - -void* -osl_pktcookie(void *skb) -{ - return ((void*)((struct sk_buff*)skb)->csum); -} - -void -osl_pktsetcookie(void *skb, void *x) -{ - ((struct sk_buff*)skb)->csum = (uint)x; -} - -void* -osl_pktlink(void *skb) -{ - return (((struct sk_buff*)skb)->prev); -} - -void -osl_pktsetlink(void *skb, void *x) -{ - ((struct sk_buff*)skb)->prev = (struct sk_buff*)x; -} - -uint -osl_pktprio(void *skb) -{ - return (((struct sk_buff*)skb)->priority); -} - -void -osl_pktsetprio(void *skb, uint x) -{ - ((struct sk_buff*)skb)->priority = x; -} - -#endif /* BINOSL */ diff --git a/openwrt/package/linux/kernel-source/drivers/net/hnd/sbutils.c b/openwrt/package/linux/kernel-source/drivers/net/hnd/sbutils.c deleted file mode 100644 index 1b221e0b36..0000000000 --- a/openwrt/package/linux/kernel-source/drivers/net/hnd/sbutils.c +++ /dev/null @@ -1,2164 +0,0 @@ -/* - * Misc utility routines for accessing chip-specific features - * of the SiliconBackplane-based Broadcom chips. - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * $Id$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* debug/trace */ -#define SB_ERROR(args) - -typedef uint32 (*sb_intrsoff_t)(void *intr_arg); -typedef void (*sb_intrsrestore_t)(void *intr_arg, uint32 arg); -typedef bool (*sb_intrsenabled_t)(void *intr_arg); - -/* misc sb info needed by some of the routines */ -typedef struct sb_info { - uint chip; /* chip number */ - uint chiprev; /* chip revision */ - uint chippkg; /* chip package option */ - uint boardtype; /* board type */ - uint boardvendor; /* board vendor id */ - uint bus; /* what bus type we are going through */ - - void *osh; /* osl os handle */ - void *sdh; /* bcmsdh handle */ - - void *curmap; /* current regs va */ - void *regs[SB_MAXCORES]; /* other regs va */ - - uint curidx; /* current core index */ - uint dev_coreid; /* the core provides driver functions */ - uint pciidx; /* pci core index */ - uint pcirev; /* pci core rev */ - - uint pcmciaidx; /* pcmcia core index */ - uint pcmciarev; /* pcmcia core rev */ - bool memseg; /* flag to toggle MEM_SEG register */ - - uint ccrev; /* chipc core rev */ - - uint gpioidx; /* gpio control core index */ - uint gpioid; /* gpio control coretype */ - - uint numcores; /* # discovered cores */ - uint coreid[SB_MAXCORES]; /* id of each core */ - - void *intr_arg; /* interrupt callback function arg */ - sb_intrsoff_t intrsoff_fn; /* function turns chip interrupts off */ - sb_intrsrestore_t intrsrestore_fn; /* function restore chip interrupts */ - sb_intrsenabled_t intrsenabled_fn; /* function to check if chip interrupts are enabled */ -} sb_info_t; - -/* local prototypes */ -static void* sb_doattach(sb_info_t *si, uint devid, void *osh, void *regs, uint bustype, void *sdh, char **vars, int *varsz); -static void sb_scan(sb_info_t *si); -static uint sb_corereg(void *sbh, uint coreidx, uint regoff, uint mask, uint val); -static uint _sb_coreidx(void *sbh); -static uint sb_findcoreidx(void *sbh, uint coreid, uint coreunit); -static uint sb_pcidev2chip(uint pcidev); -static uint sb_chip2numcores(uint chip); - -#define SB_INFO(sbh) (sb_info_t*)sbh -#define SET_SBREG(sbh, r, mask, val) W_SBREG((sbh), (r), ((R_SBREG((sbh), (r)) & ~(mask)) | (val))) -#define GOODCOREADDR(x) (((x) >= SB_ENUM_BASE) && ((x) <= SB_ENUM_LIM) && ISALIGNED((x), SB_CORE_SIZE)) -#define GOODREGS(regs) (regs && ISALIGNED(regs, SB_CORE_SIZE)) -#define REGS2SB(va) (sbconfig_t*) ((uint)(va) + SBCONFIGOFF) -#define GOODIDX(idx) (((uint)idx) < SB_MAXCORES) -#define BADIDX (SB_MAXCORES+1) - -#define R_SBREG(sbh, sbr) sb_read_sbreg((sbh), (sbr)) -#define W_SBREG(sbh, sbr, v) sb_write_sbreg((sbh), (sbr), (v)) -#define AND_SBREG(sbh, sbr, v) W_SBREG((sbh), (sbr), (R_SBREG((sbh), (sbr)) & (v))) -#define OR_SBREG(sbh, sbr, v) W_SBREG((sbh), (sbr), (R_SBREG((sbh), (sbr)) | (v))) - -/* - * Macros to disable/restore function core(D11, ENET, ILINE20, etc) interrupts before/ - * after core switching to avoid invalid register accesss inside ISR. - */ -#define INTR_OFF(si, intr_val) \ - if ((si)->intrsoff_fn && (si)->coreid[(si)->curidx] == (si)->dev_coreid) { \ - intr_val = (*(si)->intrsoff_fn)((si)->intr_arg); } -#define INTR_RESTORE(si, intr_val) \ - if ((si)->intrsrestore_fn && (si)->coreid[(si)->curidx] == (si)->dev_coreid) { \ - (*(si)->intrsrestore_fn)((si)->intr_arg, intr_val); } - -/* power control defines */ -#define LPOMINFREQ 25000 /* low power oscillator min */ -#define LPOMAXFREQ 43000 /* low power oscillator max */ -#define XTALMINFREQ 19800000 /* 20mhz - 1% */ -#define XTALMAXFREQ 20200000 /* 20mhz + 1% */ -#define PCIMINFREQ 25000000 /* 25mhz */ -#define PCIMAXFREQ 34000000 /* 33mhz + fudge */ -#define SCC_DEF_DIV 0 /* default slow clock divider */ - -#define XTAL_ON_DELAY 1000 /* Xtal power on delay in us */ - -#define SCC_LOW2FAST_LIMIT 5000 /* turn on fast clock time, in unit of ms */ - - -static uint32 -sb_read_sbreg(void *sbh, volatile uint32 *sbr) -{ - sb_info_t *si; - uint8 tmp; - uint32 val, intr_val = 0; - - si = SB_INFO(sbh); - - /* - * compact flash only has 11 bits address, while we needs 12 bits address. - * MEM_SEG will be OR'd with other 11 bits address in hardware, - * so we program MEM_SEG with 12th bit when necessary(access sb regsiters). - * For normal PCMCIA bus(CFTable_regwinsz > 2k), do nothing special - */ - if(si->memseg) { - INTR_OFF(si, intr_val); - tmp = 1; - OSL_PCMCIA_WRITE_ATTR(si->osh, MEM_SEG, &tmp, 1); - sbr = (uint32 *) (((uint32) sbr) & ~(1 << 11)); /* mask out bit 11*/ - } - - val = R_REG(sbr); - - if(si->memseg) { - tmp = 0; - OSL_PCMCIA_WRITE_ATTR(si->osh, MEM_SEG, &tmp, 1); - INTR_RESTORE(si, intr_val); - } - - return (val); -} - -static void -sb_write_sbreg(void *sbh, volatile uint32 *sbr, uint32 v) -{ - sb_info_t *si; - uint8 tmp; - volatile uint32 dummy; - uint32 intr_val = 0; - - si = SB_INFO(sbh); - - /* - * compact flash only has 11 bits address, while we needs 12 bits address. - * MEM_SEG will be OR'd with other 11 bits address in hardware, - * so we program MEM_SEG with 12th bit when necessary(access sb regsiters). - * For normal PCMCIA bus(CFTable_regwinsz > 2k), do nothing special - */ - if(si->memseg) { - INTR_OFF(si, intr_val); - tmp = 1; - OSL_PCMCIA_WRITE_ATTR(si->osh, MEM_SEG, &tmp, 1); - sbr = (uint32 *) (((uint32) sbr) & ~(1 << 11)); /* mask out bit 11*/ - } - - if (si->bus == PCMCIA_BUS) { -#ifdef IL_BIGENDIAN - dummy = R_REG(sbr); - W_REG((volatile uint16 *)((uint32)sbr + 2), (uint16)((v >> 16) & 0xffff)); - dummy = R_REG(sbr); - W_REG((volatile uint16 *)sbr, (uint16)(v & 0xffff)); -#else - dummy = R_REG(sbr); - W_REG((volatile uint16 *)sbr, (uint16)(v & 0xffff)); - dummy = R_REG(sbr); - W_REG((volatile uint16 *)((uint32)sbr + 2), (uint16)((v >> 16) & 0xffff)); -#endif - } else - W_REG(sbr, v); - - if(si->memseg) { - tmp = 0; - OSL_PCMCIA_WRITE_ATTR(si->osh, MEM_SEG, &tmp, 1); - INTR_RESTORE(si, intr_val); - } -} - -/* - * Allocate a sb handle. - * devid - pci device id (used to determine chip#) - * osh - opaque OS handle - * regs - virtual address of initial core registers - * bustype - pci/pcmcia/sb/sdio/etc - * vars - pointer to a pointer area for "environment" variables - * varsz - pointer to int to return the size of the vars - */ -void* -sb_attach(uint devid, void *osh, void *regs, uint bustype, void *sdh, char **vars, int *varsz) -{ - sb_info_t *si; - - /* alloc sb_info_t */ - if ((si = MALLOC(sizeof (sb_info_t))) == NULL) { - SB_ERROR(("sb_attach: malloc failed!\n")); - return (NULL); - } - - return (sb_doattach(si, devid, osh, regs, bustype, sdh, vars, varsz)); -} - -/* global kernel resource */ -static sb_info_t ksi; - -/* generic kernel variant of sb_attach() */ -void* -sb_kattach() -{ - uint32 *regs; - char *unused; - int varsz; - - if (ksi.curmap == NULL) { - uint32 cid; - - regs = (uint32 *)REG_MAP(SB_ENUM_BASE, SB_CORE_SIZE); - cid = R_REG((uint32 *)regs); - if (((cid & (CID_ID_MASK | CID_PKG_MASK)) == 0x00104712) && - ((cid & CID_REV_MASK) <= 0x00020000)) { - uint32 *scc, val; - - scc = (uint32 *)((uint32)regs + OFFSETOF(chipcregs_t, slow_clk_ctl)); - val = R_REG(scc); - SB_ERROR((" initial scc = 0x%x\n", val)); - val |= SCC_SS_XTAL; - W_REG(scc, val); - } - - sb_doattach(&ksi, BCM4710_DEVICE_ID, NULL, (void*)regs, - SB_BUS, NULL, &unused, &varsz); - } - - return &ksi; -} - -static void* -sb_doattach(sb_info_t *si, uint devid, void *osh, void *regs, uint bustype, void *sdh, char **vars, int *varsz) -{ - uint origidx; - chipcregs_t *cc; - uint32 w; - - ASSERT(GOODREGS(regs)); - - bzero((uchar*)si, sizeof (sb_info_t)); - - si->pciidx = si->gpioidx = BADIDX; - - si->osh = osh; - si->curmap = regs; - si->sdh = sdh; - - /* check to see if we are a sb core mimic'ing a pci core */ - if (bustype == PCI_BUS) { - if (OSL_PCI_READ_CONFIG(osh, PCI_SPROM_CONTROL, sizeof (uint32)) == 0xffffffff) - bustype = SB_BUS; - else - bustype = PCI_BUS; - } - - si->bus = bustype; - - if (si->bus == PCMCIA_BUS) - /* need to set memseg flag for CF card first before any sb registers access, - * such as the access inside sb_scan. the card type is detected and memseg - * flag is reassigned later after srom_var_init. there should be no effect - * for PCMCIA cards even though the memseg flag is set - */ - si->memseg = TRUE; - - /* kludge to enable the clock on the 4306 which lacks a slowclock */ - if (si->bus == PCI_BUS) - sb_pwrctl_xtal((void*)si, XTAL|PLL, ON); - - /* initialize current core index value */ - si->curidx = _sb_coreidx((void*)si); - if (si->curidx == BADIDX) - goto bad; - - /* keep and reuse the initial register mapping */ - origidx = si->curidx; - if (si->bus == SB_BUS) - si->regs[origidx] = regs; - - /* is core-0 a chipcommon core? */ - si->numcores = 1; - cc = (chipcregs_t*) sb_setcoreidx((void*)si, 0); - if (sb_coreid((void*)si) != SB_CC) - cc = NULL; - - /* determine chip id and rev */ - if (cc) { - /* chip common core found! */ - si->chip = R_REG(&cc->chipid) & CID_ID_MASK; - si->chiprev = (R_REG(&cc->chipid) & CID_REV_MASK) >> CID_REV_SHIFT; - si->chippkg = (R_REG(&cc->chipid) & CID_PKG_MASK) >> CID_PKG_SHIFT; - } else { - /* The only pcmcia chip without a chipcommon core is a 4301 */ - if (si->bus == PCMCIA_BUS) - devid = BCM4301_DEVICE_ID; - - /* no chip common core -- must convert device id to chip id */ - if ((si->chip = sb_pcidev2chip(devid)) == 0) { - SB_ERROR(("sb_attach: unrecognized device id 0x%04x\n", devid)); - goto bad; - } - } - - /* get chipcommon rev */ - si->ccrev = cc? sb_corerev((void*)si) : 0; - - /* determine numcores */ - if ((si->ccrev == 4) || (si->ccrev >= 6)) - si->numcores = (R_REG(&cc->chipid) & CID_CC_MASK) >> CID_CC_SHIFT; - else - si->numcores = sb_chip2numcores(si->chip); - - /* return to original core */ - sb_setcoreidx((void*)si, origidx); - - /* sanity checks */ - ASSERT(si->chip); - - /* scan for cores */ - sb_scan(si); - - /* initialize the vars after sb_scan so that the core rev. information - * collected by sb_scan is available for the srom_var_init. - */ - if (srom_var_init(si, si->bus, si->curmap, osh, vars, varsz)) { - SB_ERROR(("sb_attach: srom_var_init failed\n")); - goto bad; - } - - if (cc == NULL) { - /* - * The chip revision number is hardwired into all - * of the pci function config rev fields and is - * independent from the individual core revision numbers. - * For example, the "A0" silicon of each chip is chip rev 0. - * For PCMCIA we get it from the CIS instead. - */ - if (si->bus == PCMCIA_BUS) { - ASSERT(vars); - si->chiprev = getintvar(*vars, "chiprev"); - } else if (si->bus == PCI_BUS) { - w = OSL_PCI_READ_CONFIG(osh, PCI_CFG_REV, sizeof (uint32)); - si->chiprev = w & 0xff; - } else - si->chiprev = 0; - } - - if (si->bus == PCMCIA_BUS) { - w = getintvar(*vars, "regwindowsz"); - si->memseg = (w <= CFTABLE_REGWIN_2K) ? TRUE : FALSE; - } - - /* pci core is required */ - if (!GOODIDX(si->pciidx)) { - SB_ERROR(("sb_attach: pci core not found\n")); - goto bad; - } - - /* gpio control core is required */ - if (!GOODIDX(si->gpioidx)) { - SB_ERROR(("sb_attach: gpio control core not found\n")); - goto bad; - } - - /* get boardtype and boardrev */ - switch (si->bus) { - case PCI_BUS: - /* do a pci config read to get subsystem id and subvendor id */ - w = OSL_PCI_READ_CONFIG(osh, PCI_CFG_SVID, sizeof (uint32)); - si->boardvendor = w & 0xffff; - si->boardtype = (w >> 16) & 0xffff; - break; - - case PCMCIA_BUS: - case SDIO_BUS: - si->boardvendor = getintvar(*vars, "manfid"); - si->boardtype = getintvar(*vars, "prodid"); - break; - - case SB_BUS: - si->boardvendor = VENDOR_BROADCOM; - si->boardtype = 0xffff; - break; - } - - if (si->boardtype == 0) { - SB_ERROR(("sb_attach: unknown board type\n")); - ASSERT(si->boardtype); - } - - /* clear any previous epidiag-induced target abort */ - sb_taclear((void*)si); - - return ((void*)si); - -bad: - MFREE(si, sizeof (sb_info_t)); - return (NULL); -} - -uint -sb_coreid(void *sbh) -{ - sb_info_t *si; - sbconfig_t *sb; - - si = SB_INFO(sbh); - sb = REGS2SB(si->curmap); - - return ((R_SBREG(sbh, &(sb)->sbidhigh) & SBIDH_CC_MASK) >> SBIDH_CC_SHIFT); -} - -uint -sb_coreidx(void *sbh) -{ - sb_info_t *si; - - si = SB_INFO(sbh); - return (si->curidx); -} - -/* return current index of core */ -static uint -_sb_coreidx(void *sbh) -{ - sb_info_t *si; - sbconfig_t *sb; - uint32 sbaddr = 0; - - si = SB_INFO(sbh); - ASSERT(si); - - switch (si->bus) { - case SB_BUS: - sb = REGS2SB(si->curmap); - sbaddr = sb_base(R_SBREG(sbh, &sb->sbadmatch0)); - break; - - case PCI_BUS: - sbaddr = OSL_PCI_READ_CONFIG(si->osh, PCI_BAR0_WIN, sizeof (uint32)); - break; - - case PCMCIA_BUS: { - uint8 tmp; - - OSL_PCMCIA_READ_ATTR(si->osh, PCMCIA_ADDR0, &tmp, 1); - sbaddr = (uint)tmp << 12; - OSL_PCMCIA_READ_ATTR(si->osh, PCMCIA_ADDR1, &tmp, 1); - sbaddr |= (uint)tmp << 16; - OSL_PCMCIA_READ_ATTR(si->osh, PCMCIA_ADDR2, &tmp, 1); - sbaddr |= (uint)tmp << 24; - break; - } - default: - ASSERT(0); - } - - if (!GOODCOREADDR(sbaddr)) - return BADIDX; - - return ((sbaddr - SB_ENUM_BASE) / SB_CORE_SIZE); -} - -uint -sb_corevendor(void *sbh) -{ - sb_info_t *si; - sbconfig_t *sb; - - si = SB_INFO(sbh); - sb = REGS2SB(si->curmap); - - return ((R_SBREG(sbh, &(sb)->sbidhigh) & SBIDH_VC_MASK) >> SBIDH_VC_SHIFT); -} - -uint -sb_corerev(void *sbh) -{ - sb_info_t *si; - sbconfig_t *sb; - - si = SB_INFO(sbh); - sb = REGS2SB(si->curmap); - - return (R_SBREG(sbh, &(sb)->sbidhigh) & SBIDH_RC_MASK); -} - -#define SBTML_ALLOW (SBTML_PE | SBTML_FGC | SBTML_FL_MASK) - -/* set/clear sbtmstatelow core-specific flags */ -uint32 -sb_coreflags(void *sbh, uint32 mask, uint32 val) -{ - sb_info_t *si; - sbconfig_t *sb; - uint32 w; - - si = SB_INFO(sbh); - sb = REGS2SB(si->curmap); - - ASSERT((val & ~mask) == 0); - ASSERT((mask & ~SBTML_ALLOW) == 0); - - /* mask and set */ - if (mask || val) { - w = (R_SBREG(sbh, &sb->sbtmstatelow) & ~mask) | val; - W_SBREG(sbh, &sb->sbtmstatelow, w); - } - - /* return the new value */ - return (R_SBREG(sbh, &sb->sbtmstatelow) & SBTML_ALLOW); -} - -/* set/clear sbtmstatehigh core-specific flags */ -uint32 -sb_coreflagshi(void *sbh, uint32 mask, uint32 val) -{ - sb_info_t *si; - sbconfig_t *sb; - uint32 w; - - si = SB_INFO(sbh); - sb = REGS2SB(si->curmap); - - ASSERT((val & ~mask) == 0); - ASSERT((mask & ~SBTMH_FL_MASK) == 0); - - /* mask and set */ - if (mask || val) { - w = (R_SBREG(sbh, &sb->sbtmstatehigh) & ~mask) | val; - W_SBREG(sbh, &sb->sbtmstatehigh, w); - } - - /* return the new value */ - return (R_SBREG(sbh, &sb->sbtmstatehigh) & SBTMH_FL_MASK); -} - -bool -sb_iscoreup(void *sbh) -{ - sb_info_t *si; - sbconfig_t *sb; - - si = SB_INFO(sbh); - sb = REGS2SB(si->curmap); - - return ((R_SBREG(sbh, &(sb)->sbtmstatelow) & (SBTML_RESET | SBTML_REJ | SBTML_CLK)) == SBTML_CLK); -} - -/* - * Switch to 'coreidx', issue a single arbitrary 32bit register mask&set operation, - * switch back to the original core, and return the new value. - */ -static uint -sb_corereg(void *sbh, uint coreidx, uint regoff, uint mask, uint val) -{ - sb_info_t *si; - uint origidx; - uint32 *r; - uint w; - uint intr_val = 0; - - ASSERT(GOODIDX(coreidx)); - ASSERT(regoff < SB_CORE_SIZE); - ASSERT((val & ~mask) == 0); - - si = SB_INFO(sbh); - - INTR_OFF(si, intr_val); - - /* save current core index */ - origidx = sb_coreidx(sbh); - - /* switch core */ - r = (uint32*) ((uint) sb_setcoreidx(sbh, coreidx) + regoff); - - /* mask and set */ - if (mask || val) { - if (regoff >= SBCONFIGOFF) { - w = (R_SBREG(sbh, r) & ~mask) | val; - W_SBREG(sbh, r, w); - } else { - w = (R_REG(r) & ~mask) | val; - W_REG(r, w); - } - } - - /* readback */ - if (regoff >= SBCONFIGOFF) - w = R_SBREG(sbh, r); - else - w = R_REG(r); - - /* restore core index */ - if (origidx != coreidx) - sb_setcoreidx(sbh, origidx); - - INTR_RESTORE(si, intr_val); - return (w); -} - -/* scan the sb enumerated space to identify all cores */ -static void -sb_scan(sb_info_t *si) -{ - void *sbh; - uint origidx; - uint i; - - sbh = (void*) si; - - /* numcores should already be set */ - ASSERT((si->numcores > 0) && (si->numcores <= SB_MAXCORES)); - - /* save current core index */ - origidx = sb_coreidx(sbh); - - si->pciidx = si->gpioidx = BADIDX; - - for (i = 0; i < si->numcores; i++) { - sb_setcoreidx(sbh, i); - si->coreid[i] = sb_coreid(sbh); - - if (si->coreid[i] == SB_PCI) { - si->pciidx = i; - si->pcirev = sb_corerev(sbh); - - } else if (si->coreid[i] == SB_PCMCIA) { - si->pcmciaidx = i; - si->pcmciarev = sb_corerev(sbh); - } - } - - /* - * Find the gpio "controlling core" type and index. - * Precedence: - * - if there's a chip common core - use that - * - else if there's a pci core (rev >= 2) - use that - * - else there had better be an extif core (4710 only) - */ - if (GOODIDX(sb_findcoreidx(sbh, SB_CC, 0))) { - si->gpioidx = sb_findcoreidx(sbh, SB_CC, 0); - si->gpioid = SB_CC; - } else if (GOODIDX(si->pciidx) && (si->pcirev >= 2)) { - si->gpioidx = si->pciidx; - si->gpioid = SB_PCI; - } else if (sb_findcoreidx(sbh, SB_EXTIF, 0)) { - si->gpioidx = sb_findcoreidx(sbh, SB_EXTIF, 0); - si->gpioid = SB_EXTIF; - } - - /* return to original core index */ - sb_setcoreidx(sbh, origidx); -} - -/* may be called with core in reset */ -void -sb_detach(void *sbh) -{ - sb_info_t *si; - uint idx; - - si = SB_INFO(sbh); - - if (si == NULL) - return; - - if (si->bus == SB_BUS) - for (idx = 0; idx < SB_MAXCORES; idx++) - if (si->regs[idx]) { - REG_UNMAP(si->regs[idx]); - si->regs[idx] = NULL; - } - - MFREE(si, sizeof (sb_info_t)); -} - -/* use pci dev id to determine chip id for chips not having a chipcommon core */ -static uint -sb_pcidev2chip(uint pcidev) -{ - if ((pcidev >= BCM4710_DEVICE_ID) && (pcidev <= BCM47XX_USB_ID)) - return (BCM4710_DEVICE_ID); - if ((pcidev >= BCM4610_DEVICE_ID) && (pcidev <= BCM4610_USB_ID)) - return (BCM4610_DEVICE_ID); - if ((pcidev >= BCM4402_DEVICE_ID) && (pcidev <= BCM4402_V90_ID)) - return (BCM4402_DEVICE_ID); - if ((pcidev >= BCM4307_V90_ID) && (pcidev <= BCM4307_D11B_ID)) - return (BCM4307_DEVICE_ID); - if (pcidev == BCM4301_DEVICE_ID) - return (BCM4301_DEVICE_ID); - - return (0); -} - -/* convert chip number to number of i/o cores */ -static uint -sb_chip2numcores(uint chip) -{ - if (chip == 0x4710) - return (9); - if (chip == 0x4610) - return (9); - if (chip == 0x4402) - return (3); - if ((chip == 0x4307) || (chip == 0x4301)) - return (5); - if (chip == 0x4310) - return (8); - if (chip == 0x4306) /* < 4306c0 */ - return (6); - if (chip == 0x4704) - return (9); - if (chip == 0x5365) - return (7); - - SB_ERROR(("sb_chip2numcores: unsupported chip 0x%x\n", chip)); - ASSERT(0); - return (1); -} - -/* return index of coreid or BADIDX if not found */ -static uint -sb_findcoreidx(void *sbh, uint coreid, uint coreunit) -{ - sb_info_t *si; - uint found; - uint i; - - si = SB_INFO(sbh); - found = 0; - - for (i = 0; i < si->numcores; i++) - if (si->coreid[i] == coreid) { - if (found == coreunit) - return (i); - found++; - } - - return (BADIDX); -} - -/* - * this function changes logical "focus" to the indiciated core, - * must be called with interrupt off. - * Moreover, callers should keep interrupts off during switching out of and back to d11 core - */ -void* -sb_setcoreidx(void *sbh, uint coreidx) -{ - sb_info_t *si; - uint32 sbaddr; - uint8 tmp; - - si = SB_INFO(sbh); - - if (coreidx >= si->numcores) - return (NULL); - - /* - * If the user has provided an interrupt mask enabled function, - * then assert interrupts are disabled before switching the core. - */ - ASSERT((si->intrsenabled_fn == NULL) || !(*(si)->intrsenabled_fn)((si)->intr_arg)); - - sbaddr = SB_ENUM_BASE + (coreidx * SB_CORE_SIZE); - - switch (si->bus) { - case SB_BUS: - /* map new one */ - if (!si->regs[coreidx]) { - si->regs[coreidx] = (void*)REG_MAP(sbaddr, SB_CORE_SIZE); - ASSERT(GOODREGS(si->regs[coreidx])); - } - si->curmap = si->regs[coreidx]; - break; - - case PCI_BUS: - /* point bar0 window */ - OSL_PCI_WRITE_CONFIG(si->osh, PCI_BAR0_WIN, 4, sbaddr); - break; - - case PCMCIA_BUS: - tmp = (sbaddr >> 12) & 0x0f; - OSL_PCMCIA_WRITE_ATTR(si->osh, PCMCIA_ADDR0, &tmp, 1); - tmp = (sbaddr >> 16) & 0xff; - OSL_PCMCIA_WRITE_ATTR(si->osh, PCMCIA_ADDR1, &tmp, 1); - tmp = (sbaddr >> 24) & 0xff; - OSL_PCMCIA_WRITE_ATTR(si->osh, PCMCIA_ADDR2, &tmp, 1); - break; - } - - si->curidx = coreidx; - - return (si->curmap); -} - -/* - * this function changes logical "focus" to the indiciated core, - * must be called with interrupt off. - * Moreover, callers should keep interrupts off during switching out of and back to d11 core - */ -void* -sb_setcore(void *sbh, uint coreid, uint coreunit) -{ - sb_info_t *si; - uint idx; - - si = SB_INFO(sbh); - - idx = sb_findcoreidx(sbh, coreid, coreunit); - if (!GOODIDX(idx)) - return (NULL); - - return (sb_setcoreidx(sbh, idx)); -} - -/* return chip number */ -uint -sb_chip(void *sbh) -{ - sb_info_t *si; - - si = SB_INFO(sbh); - return (si->chip); -} - -/* return chip revision number */ -uint -sb_chiprev(void *sbh) -{ - sb_info_t *si; - - si = SB_INFO(sbh); - return (si->chiprev); -} - -/* return chip common revision number */ -uint -sb_chipcrev(void *sbh) -{ - sb_info_t *si; - - si = SB_INFO(sbh); - return (si->ccrev); -} - -/* return chip package option */ -uint -sb_chippkg(void *sbh) -{ - sb_info_t *si; - - si = SB_INFO(sbh); - return (si->chippkg); -} - -/* return PCI core rev. */ -uint -sb_pcirev(void *sbh) -{ - sb_info_t *si; - - si = SB_INFO(sbh); - return (si->pcirev); -} - -/* return PCMCIA core rev. */ -uint -sb_pcmciarev(void *sbh) -{ - sb_info_t *si; - - si = SB_INFO(sbh); - return (si->pcmciarev); -} - -/* return board vendor id */ -uint -sb_boardvendor(void *sbh) -{ - sb_info_t *si; - - si = SB_INFO(sbh); - return (si->boardvendor); -} - -/* return boardtype */ -uint -sb_boardtype(void *sbh) -{ - sb_info_t *si; - char *var; - - si = SB_INFO(sbh); - - if (si->bus == SB_BUS && si->boardtype == 0xffff) { - /* boardtype format is a hex string */ - si->boardtype = getintvar(NULL, "boardtype"); - - /* backward compatibility for older boardtype string format */ - if ((si->boardtype == 0) && (var = getvar(NULL, "boardtype"))) { - if (!strcmp(var, "bcm94710dev")) - si->boardtype = BCM94710D_BOARD; - else if (!strcmp(var, "bcm94710ap")) - si->boardtype = BCM94710AP_BOARD; - else if (!strcmp(var, "bcm94310u")) - si->boardtype = BCM94310U_BOARD; - else if (!strcmp(var, "bu4711")) - si->boardtype = BU4711_BOARD; - else if (!strcmp(var, "bu4710")) - si->boardtype = BU4710_BOARD; - else if (!strcmp(var, "bcm94702mn")) - si->boardtype = BCM94702MN_BOARD; - else if (!strcmp(var, "bcm94710r1")) - si->boardtype = BCM94710R1_BOARD; - else if (!strcmp(var, "bcm94710r4")) - si->boardtype = BCM94710R4_BOARD; - else if (!strcmp(var, "bcm94702cpci")) - si->boardtype = BCM94702CPCI_BOARD; - else if (!strcmp(var, "bcm95380_rr")) - si->boardtype = BCM95380RR_BOARD; - } - } - - return (si->boardtype); -} - -/* return board bus style */ -uint -sb_boardstyle(void *sbh) -{ - sb_info_t *si; - uint16 w; - - si = SB_INFO(sbh); - - if (si->bus == PCMCIA_BUS) - return (BOARDSTYLE_PCMCIA); - - if (si->bus == SB_BUS) - return (BOARDSTYLE_SOC); - - /* bus is PCI */ - - if (OSL_PCI_READ_CONFIG(si->osh, PCI_CFG_CIS, sizeof (uint32)) != 0) - return (BOARDSTYLE_CARDBUS); - - if ((srom_read(si->bus, si->curmap, si->osh, (SPROM_SIZE - 1) * 2, 2, &w) == 0) && - (w == 0x0313)) - return (BOARDSTYLE_CARDBUS); - - return (BOARDSTYLE_PCI); -} - -/* return boolean if sbh device is in pci hostmode or client mode */ -uint -sb_bus(void *sbh) -{ - sb_info_t *si; - - si = SB_INFO(sbh); - return (si->bus); -} - -/* return list of found cores */ -uint -sb_corelist(void *sbh, uint coreid[]) -{ - sb_info_t *si; - - si = SB_INFO(sbh); - - bcopy((uchar*)si->coreid, (uchar*)coreid, (si->numcores * sizeof (uint))); - return (si->numcores); -} - -/* return current register mapping */ -void * -sb_coreregs(void *sbh) -{ - sb_info_t *si; - - si = SB_INFO(sbh); - ASSERT(GOODREGS(si->curmap)); - - return (si->curmap); -} - -/* traverse all cores to find and clear source of serror */ -static void -sb_serr_clear(void *sbh) -{ - sb_info_t *si; - sbconfig_t *sb; - uint origidx; - uint i, intr_val = 0; - void * corereg = NULL; - - si = SB_INFO(sbh); - - INTR_OFF(si, intr_val); - origidx = sb_coreidx(sbh); - - for (i = 0; i < si->numcores; i++) { - corereg = sb_setcoreidx(sbh, i); - if (NULL != corereg) { - sb = REGS2SB(corereg); - if ((si->chip == BCM4317_DEVICE_ID) && (si->chiprev == 0)) { - W_SBREG(sbh, &sb->sbtmstatehigh, 0); - } else { - if ((R_SBREG(sbh, &sb->sbtmstatehigh)) & SBTMH_SERR) { - AND_SBREG(sbh, &sb->sbtmstatehigh, ~SBTMH_SERR); - SB_ERROR(("sb_serr_clear: SError at core 0x%x\n", sb_coreid(sbh))); - } - } - } - } - - sb_setcoreidx(sbh, origidx); - INTR_RESTORE(si, intr_val); -} - -/* check if any inband, outband or timeout errors has happened and clear them */ -/* !! must be called with chip clk on */ -bool -sb_taclear(void *sbh) -{ - sb_info_t *si; - sbconfig_t *sb; - uint origidx; - uint intr_val = 0; - bool rc = FALSE; - uint32 inband = 0, serror = 0, timeout = 0; - void *corereg = NULL; - volatile uint32 imstate, tmstate; - - si = SB_INFO(sbh); - - if (si->bus == PCI_BUS) { - volatile uint32 stcmd; - - /* inband error is Target abort for PCI */ - stcmd = OSL_PCI_READ_CONFIG(si->osh, PCI_CFG_CMD, sizeof(uint32)); - inband = stcmd & PCI_CFG_CMD_STAT_TA; - if (inband) - OSL_PCI_WRITE_CONFIG(si->osh, PCI_CFG_CMD, sizeof(uint32), stcmd); - - /* serror */ - stcmd = OSL_PCI_READ_CONFIG(si->osh, PCI_INT_STATUS, sizeof(uint32)); - serror = stcmd & PCI_SBIM_STATUS_SERR; - if (serror) { - sb_serr_clear(sbh); - OSL_PCI_WRITE_CONFIG(si->osh, PCI_INT_STATUS, sizeof(uint32), stcmd); - } - - /* timeout */ - imstate = sb_corereg(sbh, si->pciidx, SBCONFIGOFF + OFFSETOF(sbconfig_t, sbimstate), 0, 0); - if ((imstate != 0xffffffff) && (imstate & (SBIM_IBE | SBIM_TO))) { - sb_corereg(sbh, si->pciidx, SBCONFIGOFF + OFFSETOF(sbconfig_t, sbimstate), ~0, - (imstate & ~(SBIM_IBE | SBIM_TO))); - /* inband = imstate & SBIM_IBE; same as TA above */ - timeout = imstate & SBIM_TO; - } - - } else if (si->bus == PCMCIA_BUS) { - - INTR_OFF(si, intr_val); - origidx = sb_coreidx(sbh); - - corereg = sb_setcore(sbh, SB_PCMCIA, 0); - if (NULL != corereg) { - sb = REGS2SB(corereg); - - imstate = R_SBREG(sbh, &sb->sbimstate); - /* handle surprise removal */ - if ((imstate != 0xffffffff) && (imstate & (SBIM_IBE | SBIM_TO))) { - AND_SBREG(sbh, &sb->sbimstate, ~(SBIM_IBE | SBIM_TO)); - inband = imstate & SBIM_IBE; - timeout = imstate & SBIM_TO; - } - tmstate = R_SBREG(sbh, &sb->sbtmstatehigh); - if ((tmstate != 0xffffffff) && (tmstate & SBTMH_INT_STATUS)) { - if (!inband) { - serror = 1; - sb_serr_clear(sbh); - } - OR_SBREG(sbh, &sb->sbtmstatelow, SBTML_INT_ACK); - AND_SBREG(sbh, &sb->sbtmstatelow, ~SBTML_INT_ACK); - } - } - sb_setcoreidx(sbh, origidx); - INTR_RESTORE(si, intr_val); - - } else if (si->bus == SDIO_BUS) { - - INTR_OFF(si, intr_val); - origidx = sb_coreidx(sbh); - - corereg = sb_setcore(sbh, SB_PCMCIA, 0); - if (NULL != corereg) { - sb = REGS2SB(corereg); - - imstate = R_SBREG(sbh, &sb->sbimstate); - if ((imstate != 0xffffffff) && (imstate & (SBIM_IBE | SBIM_TO))) { - AND_SBREG(sbh, &sb->sbimstate, ~(SBIM_IBE | SBIM_TO)); - /* inband = imstate & SBIM_IBE; cmd error */ - timeout = imstate & SBIM_TO; - } - tmstate = R_SBREG(sbh, &sb->sbtmstatehigh); - if ((tmstate != 0xffffffff) && (tmstate & SBTMH_INT_STATUS)) { - sb_serr_clear(sbh); - serror = 1; - OR_SBREG(sbh, &sb->sbtmstatelow, SBTML_INT_ACK); - AND_SBREG(sbh, &sb->sbtmstatelow, ~SBTML_INT_ACK); - } - } - - sb_setcoreidx(sbh, origidx); - INTR_RESTORE(si, intr_val); - } - - if ((inband | timeout | serror) != 0) { - rc = TRUE; - SB_ERROR(("sb_taclear: inband 0x%x, serror 0x%x, timeout 0x%x!\n", inband, serror, timeout)); - } - - return (rc); -} - -/* do buffered registers update */ -void -sb_commit(void *sbh) -{ - sb_info_t *si; - sbpciregs_t *pciregs; - uint origidx; - uint intr_val = 0; - - si = SB_INFO(sbh); - - origidx = si->curidx; - ASSERT(GOODIDX(origidx)); - - INTR_OFF(si, intr_val); - /* switch over to pci core */ - pciregs = (sbpciregs_t*) sb_setcore(sbh, SB_PCI, 0); - - /* do the buffer registers update */ - W_REG(&pciregs->bcastaddr, SB_COMMIT); - W_REG(&pciregs->bcastdata, 0x0); - - /* restore core index */ - sb_setcoreidx(sbh, origidx); - INTR_RESTORE(si, intr_val); -} - -/* reset and re-enable a core */ -void -sb_core_reset(void *sbh, uint32 bits) -{ - sb_info_t *si; - sbconfig_t *sb; - volatile uint32 dummy; - - si = SB_INFO(sbh); - ASSERT(GOODREGS(si->curmap)); - sb = REGS2SB(si->curmap); - - /* - * Must do the disable sequence first to work for arbitrary current core state. - */ - sb_core_disable(sbh, bits); - - /* - * Now do the initialization sequence. - */ - - /* set reset while enabling the clock and forcing them on throughout the core */ - W_SBREG(sbh, &sb->sbtmstatelow, (SBTML_FGC | SBTML_CLK | SBTML_RESET | bits)); - dummy = R_SBREG(sbh, &sb->sbtmstatelow); - - if (sb_coreid(sbh) == SB_ILINE100) { - bcm_mdelay(50); - } else { - OSL_DELAY(1); - } - - if (R_SBREG(sbh, &sb->sbtmstatehigh) & SBTMH_SERR) { - W_SBREG(sbh, &sb->sbtmstatehigh, 0); - } - if ((dummy = R_SBREG(sbh, &sb->sbimstate)) & (SBIM_IBE | SBIM_TO)) { - AND_SBREG(sbh, &sb->sbimstate, ~(SBIM_IBE | SBIM_TO)); - } - - /* clear reset and allow it to propagate throughout the core */ - W_SBREG(sbh, &sb->sbtmstatelow, (SBTML_FGC | SBTML_CLK | bits)); - dummy = R_SBREG(sbh, &sb->sbtmstatelow); - OSL_DELAY(1); - - /* leave clock enabled */ - W_SBREG(sbh, &sb->sbtmstatelow, (SBTML_CLK | bits)); - dummy = R_SBREG(sbh, &sb->sbtmstatelow); - OSL_DELAY(1); -} - -void -sb_core_tofixup(void *sbh) -{ - sb_info_t *si; - sbconfig_t *sb; - - si = SB_INFO(sbh); - - if (si->pcirev >= 5) - return; - - ASSERT(GOODREGS(si->curmap)); - sb = REGS2SB(si->curmap); - - if (si->bus == SB_BUS) { - SET_SBREG(sbh, &sb->sbimconfiglow, - SBIMCL_RTO_MASK | SBIMCL_STO_MASK, - (0x5 << SBIMCL_RTO_SHIFT) | 0x3); - } else { - if (sb_coreid(sbh) == SB_PCI) { - SET_SBREG(sbh, &sb->sbimconfiglow, - SBIMCL_RTO_MASK | SBIMCL_STO_MASK, - (0x3 << SBIMCL_RTO_SHIFT) | 0x2); - } else { - SET_SBREG(sbh, &sb->sbimconfiglow, (SBIMCL_RTO_MASK | SBIMCL_STO_MASK), 0); - } - } - - sb_commit(sbh); -} - -void -sb_core_disable(void *sbh, uint32 bits) -{ - sb_info_t *si; - volatile uint32 dummy; - sbconfig_t *sb; - - si = SB_INFO(sbh); - - ASSERT(GOODREGS(si->curmap)); - sb = REGS2SB(si->curmap); - - /* must return if core is already in reset */ - if (R_SBREG(sbh, &sb->sbtmstatelow) & SBTML_RESET) - return; - - /* put into reset and return if clocks are not enabled */ - if ((R_SBREG(sbh, &sb->sbtmstatelow) & SBTML_CLK) == 0) - goto disable; - - /* set the reject bit */ - W_SBREG(sbh, &sb->sbtmstatelow, (SBTML_CLK | SBTML_REJ)); - - /* spin until reject is set */ - while ((R_SBREG(sbh, &sb->sbtmstatelow) & SBTML_REJ) == 0) - OSL_DELAY(1); - - /* spin until sbtmstatehigh.busy is clear */ - while (R_SBREG(sbh, &sb->sbtmstatehigh) & SBTMH_BUSY) - OSL_DELAY(1); - - /* set reset and reject while enabling the clocks */ - W_SBREG(sbh, &sb->sbtmstatelow, (bits | SBTML_FGC | SBTML_CLK | SBTML_REJ | SBTML_RESET)); - dummy = R_SBREG(sbh, &sb->sbtmstatelow); - OSL_DELAY(10); - - disable: - /* leave reset and reject asserted */ - W_SBREG(sbh, &sb->sbtmstatelow, (bits | SBTML_REJ | SBTML_RESET)); - OSL_DELAY(1); -} - -void -sb_watchdog(void *sbh, uint ticks) -{ - sb_info_t *si = SB_INFO(sbh); - - /* instant NMI */ - switch (si->gpioid) { - case SB_CC: - sb_corereg(sbh, si->gpioidx, OFFSETOF(chipcregs_t, watchdog), ~0, ticks); - break; - case SB_EXTIF: - sb_corereg(sbh, si->gpioidx, OFFSETOF(extifregs_t, watchdog), ~0, ticks); - break; - } -} - -/* initialize the pcmcia core */ -void -sb_pcmcia_init(void *sbh) -{ - sb_info_t *si; - uint8 cor; - - si = SB_INFO(sbh); - - /* enable d11 mac interrupts */ - if (si->chip == BCM4301_DEVICE_ID) { - /* Have to use FCR2 in 4301 */ - OSL_PCMCIA_READ_ATTR(si->osh, PCMCIA_FCR2 + PCMCIA_COR, &cor, 1); - cor |= COR_IRQEN | COR_FUNEN; - OSL_PCMCIA_WRITE_ATTR(si->osh, PCMCIA_FCR2 + PCMCIA_COR, &cor, 1); - } else { - OSL_PCMCIA_READ_ATTR(si->osh, PCMCIA_FCR0 + PCMCIA_COR, &cor, 1); - cor |= COR_IRQEN | COR_FUNEN; - OSL_PCMCIA_WRITE_ATTR(si->osh, PCMCIA_FCR0 + PCMCIA_COR, &cor, 1); - } - -} - - -/* - * Configure the pci core for pci client (NIC) action - * and get appropriate dma offset value. - * coremask is the bitvec of cores by index to be enabled. - */ -void -sb_pci_setup(void *sbh, uint32 *dmaoffset, uint coremask) -{ - sb_info_t *si; - sbconfig_t *sb; - sbpciregs_t *pciregs; - uint32 sbflag; - uint32 w; - uint idx; - - si = SB_INFO(sbh); - - if (dmaoffset) - *dmaoffset = 0; - - /* if not pci bus, we're done */ - if (si->bus != PCI_BUS) - return; - - ASSERT(si->pciidx); - - /* get current core index */ - idx = si->curidx; - - /* we interrupt on this backplane flag number */ - ASSERT(GOODREGS(si->curmap)); - sb = REGS2SB(si->curmap); - sbflag = R_SBREG(sbh, &sb->sbtpsflag) & SBTPS_NUM0_MASK; - - /* switch over to pci core */ - pciregs = (sbpciregs_t*) sb_setcoreidx(sbh, si->pciidx); - sb = REGS2SB(pciregs); - - /* - * Enable sb->pci interrupts. Assume - * PCI rev 2.3 support was added in pci core rev 6 and things changed.. - */ - if (si->pcirev < 6) { - /* set sbintvec bit for our flag number */ - OR_SBREG(sbh, &sb->sbintvec, (1 << sbflag)); - } else { - /* pci config write to set this core bit in PCIIntMask */ - w = OSL_PCI_READ_CONFIG(si->osh, PCI_INT_MASK, sizeof(uint32)); - w |= (coremask << PCI_SBIM_SHIFT); - OSL_PCI_WRITE_CONFIG(si->osh, PCI_INT_MASK, sizeof(uint32), w); - } - - /* enable prefetch and bursts for sonics-to-pci translation 2 */ - OR_REG(&pciregs->sbtopci2, (SBTOPCI_PREF|SBTOPCI_BURST)); - - if (si->pcirev < 5) { - SET_SBREG(sbh, &sb->sbimconfiglow, SBIMCL_RTO_MASK | SBIMCL_STO_MASK, - (0x3 << SBIMCL_RTO_SHIFT) | 0x2); - sb_commit(sbh); - } - - /* switch back to previous core */ - sb_setcoreidx(sbh, idx); - - /* use large sb pci dma window */ - if (dmaoffset) - *dmaoffset = SB_PCI_DMA; -} - -uint32 -sb_base(uint32 admatch) -{ - uint32 base; - uint type; - - type = admatch & SBAM_TYPE_MASK; - ASSERT(type < 3); - - base = 0; - - if (type == 0) { - base = admatch & SBAM_BASE0_MASK; - } else if (type == 1) { - ASSERT(!(admatch & SBAM_ADNEG)); /* neg not supported */ - base = admatch & SBAM_BASE1_MASK; - } else if (type == 2) { - ASSERT(!(admatch & SBAM_ADNEG)); /* neg not supported */ - base = admatch & SBAM_BASE2_MASK; - } - - return (base); -} - -uint32 -sb_size(uint32 admatch) -{ - uint32 size; - uint type; - - type = admatch & SBAM_TYPE_MASK; - ASSERT(type < 3); - - size = 0; - - if (type == 0) { - size = 1 << (((admatch & SBAM_ADINT0_MASK) >> SBAM_ADINT0_SHIFT) + 1); - } else if (type == 1) { - ASSERT(!(admatch & SBAM_ADNEG)); /* neg not supported */ - size = 1 << (((admatch & SBAM_ADINT1_MASK) >> SBAM_ADINT1_SHIFT) + 1); - } else if (type == 2) { - ASSERT(!(admatch & SBAM_ADNEG)); /* neg not supported */ - size = 1 << (((admatch & SBAM_ADINT2_MASK) >> SBAM_ADINT2_SHIFT) + 1); - } - - return (size); -} - -/* return the core-type instantiation # of the current core */ -uint -sb_coreunit(void *sbh) -{ - sb_info_t *si; - uint idx; - uint coreid; - uint coreunit; - uint i; - - si = SB_INFO(sbh); - coreunit = 0; - - idx = si->curidx; - - ASSERT(GOODREGS(si->curmap)); - coreid = sb_coreid(sbh); - - /* count the cores of our type */ - for (i = 0; i < idx; i++) - if (si->coreid[i] == coreid) - coreunit++; - - return (coreunit); -} - -static INLINE uint32 -factor6(uint32 x) -{ - switch (x) { - case CC_F6_2: return 2; - case CC_F6_3: return 3; - case CC_F6_4: return 4; - case CC_F6_5: return 5; - case CC_F6_6: return 6; - case CC_F6_7: return 7; - default: return 0; - } -} - -/* calculate the speed the SB would run at given a set of clockcontrol values */ -uint32 -sb_clock_rate(uint32 pll_type, uint32 n, uint32 m) -{ - uint32 n1, n2, clock, m1, m2, m3, mc; - - n1 = n & CN_N1_MASK; - n2 = (n & CN_N2_MASK) >> CN_N2_SHIFT; - - if ((pll_type == PLL_TYPE1) || (pll_type == PLL_TYPE4)) { - n1 = factor6(n1); - n2 += CC_F5_BIAS; - } else if (pll_type == PLL_TYPE2) { - n1 += CC_T2_BIAS; - n2 += CC_T2_BIAS; - ASSERT((n1 >= 2) && (n1 <= 7)); - ASSERT((n2 >= 5) && (n2 <= 23)); - } else if (pll_type == PLL_TYPE3) { - return (100000000); - } else - ASSERT((pll_type >= PLL_TYPE1) && (pll_type <= PLL_TYPE4)); - - clock = CC_CLOCK_BASE * n1 * n2; - - if (clock == 0) - return 0; - - m1 = m & CC_M1_MASK; - m2 = (m & CC_M2_MASK) >> CC_M2_SHIFT; - m3 = (m & CC_M3_MASK) >> CC_M3_SHIFT; - mc = (m & CC_MC_MASK) >> CC_MC_SHIFT; - - if ((pll_type == PLL_TYPE1) || (pll_type == PLL_TYPE4)) { - m1 = factor6(m1); - if (pll_type == PLL_TYPE1) - m2 += CC_F5_BIAS; - else - m2 = factor6(m2); - m3 = factor6(m3); - - switch (mc) { - case CC_MC_BYPASS: return (clock); - case CC_MC_M1: return (clock / m1); - case CC_MC_M1M2: return (clock / (m1 * m2)); - case CC_MC_M1M2M3: return (clock / (m1 * m2 * m3)); - case CC_MC_M1M3: return (clock / (m1 * m3)); - default: return (0); - } - } else { - ASSERT(pll_type == PLL_TYPE2); - - m1 += CC_T2_BIAS; - m2 += CC_T2M2_BIAS; - m3 += CC_T2_BIAS; - ASSERT((m1 >= 2) && (m1 <= 7)); - ASSERT((m2 >= 3) && (m2 <= 10)); - ASSERT((m3 >= 2) && (m3 <= 7)); - - if ((mc & CC_T2MC_M1BYP) == 0) - clock /= m1; - if ((mc & CC_T2MC_M2BYP) == 0) - clock /= m2; - if ((mc & CC_T2MC_M3BYP) == 0) - clock /= m3; - - return(clock); - } -} - -/* returns the current speed the SB is running at */ -uint32 -sb_clock(void *sbh) -{ - sb_info_t *si; - extifregs_t *eir; - chipcregs_t *cc; - uint32 n, m; - uint idx; - uint32 pll_type, rate; - uint intr_val = 0; - - si = SB_INFO(sbh); - idx = si->curidx; - pll_type = PLL_TYPE1; - - INTR_OFF(si, intr_val); - - /* switch to extif or chipc core */ - if ((eir = (extifregs_t *) sb_setcore(sbh, SB_EXTIF, 0))) { - n = R_REG(&eir->clockcontrol_n); - m = R_REG(&eir->clockcontrol_sb); - } else if ((cc = (chipcregs_t *) sb_setcore(sbh, SB_CC, 0))) { - pll_type = R_REG(&cc->capabilities) & CAP_PLL_MASK; - n = R_REG(&cc->clockcontrol_n); - m = R_REG(&cc->clockcontrol_sb); - } else { - INTR_RESTORE(si, intr_val); - return 0; - } - - /* calculate rate */ - rate = sb_clock_rate(pll_type, n, m); - - /* switch back to previous core */ - sb_setcoreidx(sbh, idx); - - INTR_RESTORE(si, intr_val); - - return rate; -} - -/* change logical "focus" to the gpio core for optimized access */ -void* -sb_gpiosetcore(void *sbh) -{ - sb_info_t *si; - - si = SB_INFO(sbh); - - return (sb_setcoreidx(sbh, si->gpioidx)); -} - -/* mask&set gpiocontrol bits */ -uint32 -sb_gpiocontrol(void *sbh, uint32 mask, uint32 val) -{ - sb_info_t *si; - uint regoff; - - si = SB_INFO(sbh); - regoff = 0; - - switch (si->gpioid) { - case SB_CC: - regoff = OFFSETOF(chipcregs_t, gpiocontrol); - break; - - case SB_PCI: - regoff = OFFSETOF(sbpciregs_t, gpiocontrol); - break; - - case SB_EXTIF: - return (0); - } - - return (sb_corereg(sbh, si->gpioidx, regoff, mask, val)); -} - -/* mask&set gpio output enable bits */ -uint32 -sb_gpioouten(void *sbh, uint32 mask, uint32 val) -{ - sb_info_t *si; - uint regoff; - - si = SB_INFO(sbh); - regoff = 0; - - switch (si->gpioid) { - case SB_CC: - regoff = OFFSETOF(chipcregs_t, gpioouten); - break; - - case SB_PCI: - regoff = OFFSETOF(sbpciregs_t, gpioouten); - break; - - case SB_EXTIF: - regoff = OFFSETOF(extifregs_t, gpio[0].outen); - break; - } - - return (sb_corereg(sbh, si->gpioidx, regoff, mask, val)); -} - -/* mask&set gpio output bits */ -uint32 -sb_gpioout(void *sbh, uint32 mask, uint32 val) -{ - sb_info_t *si; - uint regoff; - - si = SB_INFO(sbh); - regoff = 0; - - switch (si->gpioid) { - case SB_CC: - regoff = OFFSETOF(chipcregs_t, gpioout); - break; - - case SB_PCI: - regoff = OFFSETOF(sbpciregs_t, gpioout); - break; - - case SB_EXTIF: - regoff = OFFSETOF(extifregs_t, gpio[0].out); - break; - } - - return (sb_corereg(sbh, si->gpioidx, regoff, mask, val)); -} - -/* return the current gpioin register value */ -uint32 -sb_gpioin(void *sbh) -{ - sb_info_t *si; - uint regoff; - - si = SB_INFO(sbh); - regoff = 0; - - switch (si->gpioid) { - case SB_CC: - regoff = OFFSETOF(chipcregs_t, gpioin); - break; - - case SB_PCI: - regoff = OFFSETOF(sbpciregs_t, gpioin); - break; - - case SB_EXTIF: - regoff = OFFSETOF(extifregs_t, gpioin); - break; - } - - return (sb_corereg(sbh, si->gpioidx, regoff, 0, 0)); -} - -/* mask&set gpio interrupt polarity bits */ -uint32 -sb_gpiointpolarity(void *sbh, uint32 mask, uint32 val) -{ - sb_info_t *si; - uint regoff; - - si = SB_INFO(sbh); - regoff = 0; - - switch (si->gpioid) { - case SB_CC: - regoff = OFFSETOF(chipcregs_t, gpiointpolarity); - break; - - case SB_PCI: - /* pci gpio implementation does not support interrupt polarity */ - ASSERT(0); - break; - - case SB_EXTIF: - regoff = OFFSETOF(extifregs_t, gpiointpolarity); - break; - } - - return (sb_corereg(sbh, si->gpioidx, regoff, mask, val)); -} - -/* mask&set gpio interrupt mask bits */ -uint32 -sb_gpiointmask(void *sbh, uint32 mask, uint32 val) -{ - sb_info_t *si; - uint regoff; - - si = SB_INFO(sbh); - regoff = 0; - - switch (si->gpioid) { - case SB_CC: - regoff = OFFSETOF(chipcregs_t, gpiointmask); - break; - - case SB_PCI: - /* pci gpio implementation does not support interrupt mask */ - ASSERT(0); - break; - - case SB_EXTIF: - regoff = OFFSETOF(extifregs_t, gpiointmask); - break; - } - - return (sb_corereg(sbh, si->gpioidx, regoff, mask, val)); -} - - -/* - * Return the slow clock source. - * Three sources of SLOW CLOCK: LPO, Xtal, PCI - */ -static uint -sb_slowclk_src(void *sbh) -{ - sb_info_t *si; - chipcregs_t *cc; - uint32 v; - - si = SB_INFO(sbh); - - ASSERT(sb_coreid(sbh) == SB_CC); - - if (si->ccrev < 6) { - switch (si->bus) { - case PCMCIA_BUS: return (SCC_SS_XTAL); - case PCI_BUS: - v = OSL_PCI_READ_CONFIG(si->osh, PCI_GPIO_OUT, sizeof (uint32)); - if (v & PCI_CFG_GPIO_SCS) - return (SCC_SS_PCI); - else - return (SCC_SS_XTAL); - default: return (SCC_SS_XTAL); - } - } else if (si->ccrev < 10) { - cc = (chipcregs_t*) sb_setcoreidx(sbh, si->curidx); - v = R_REG(&cc->slow_clk_ctl) & SCC_SS_MASK; - return (v); - } else { - return (SCC_SS_XTAL); - } -} - -/* - * Return the slowclock min or max frequency. - * Three sources of SLOW CLOCK: - * 1. On Chip LPO - 32khz or 160khz - * 2. On Chip Xtal OSC - 20mhz/4*(divider+1) - * 3. External PCI clock - 66mhz/4*(divider+1) - */ -static uint -sb_slowclk_freq(void *sbh, bool max) -{ - sb_info_t *si; - chipcregs_t *cc; - uint32 slowclk; - uint div; - - si = SB_INFO(sbh); - - ASSERT(sb_coreid(sbh) == SB_CC); - - cc = (chipcregs_t*) sb_setcoreidx(sbh, si->curidx); - - /* shouldn't be here unless we've established the chip has dynamic power control */ - ASSERT(R_REG(&cc->capabilities) & CAP_PWR_CTL); - - slowclk = sb_slowclk_src(sbh); - if (si->ccrev < 6) { - if (slowclk == SCC_SS_PCI) - return (max? (PCIMAXFREQ/64) : (PCIMINFREQ/64)); - else - return (max? (XTALMAXFREQ/32) : (XTALMINFREQ/32)); - } else if (si->ccrev < 10) { - div = 4 * (((R_REG(&cc->slow_clk_ctl) & SCC_CD_MASK) >> SCC_CD_SHF) + 1); - if (slowclk == SCC_SS_LPO) - return (max? LPOMAXFREQ : LPOMINFREQ); - else if (slowclk == SCC_SS_XTAL) - return (max? (XTALMAXFREQ/div) : (XTALMINFREQ/div)); - else if (slowclk == SCC_SS_PCI) - return (max? (PCIMAXFREQ/div) : (PCIMINFREQ/div)); - else - ASSERT(0); - } else { - /* Chipc rev 10 is InstaClock */ - div = R_REG(&cc->system_clk_ctl) >> SYCC_CD_SHF; - div = 4 * (div + 1); - return (max ? XTALMAXFREQ : (XTALMINFREQ/div)); - } - return (0); -} - -static void -sb_pwrctl_setdelay(void *sbh, void *chipcregs) -{ - chipcregs_t * cc; - uint slowmaxfreq, pll_delay, slowclk; - uint pll_on_delay, fref_sel_delay; - - pll_delay = PLL_DELAY; - - /* If the slow clock is not sourced by the xtal then add the xtal_on_delay - * since the xtal will also be powered down by dynamic power control logic. - */ - slowclk = sb_slowclk_src(sbh); - if (slowclk != SCC_SS_XTAL) - pll_delay += XTAL_ON_DELAY; - - slowmaxfreq = sb_slowclk_freq(sbh, TRUE); - - pll_on_delay = ((slowmaxfreq * pll_delay) + 999999) / 1000000; - fref_sel_delay = ((slowmaxfreq * FREF_DELAY) + 999999) / 1000000; - - cc = (chipcregs_t *)chipcregs; - W_REG(&cc->pll_on_delay, pll_on_delay); - W_REG(&cc->fref_sel_delay, fref_sel_delay); -} - -/* set or get slow clock divider */ -int -sb_pwrctl_slowclk(void *sbh, bool set, uint *div) -{ - sb_info_t *si; - uint origidx; - chipcregs_t *cc; - uint intr_val = 0; - uint err = 0; - - si = SB_INFO(sbh); - - /* chipcommon cores prior to rev6 don't support slowclkcontrol */ - if (si->ccrev < 6) - return 1; - - /* chipcommon cores rev10 are a whole new ball game */ - if (si->ccrev >= 10) - return 1; - - if (set && ((*div % 4) || (*div < 4))) - return 2; - - INTR_OFF(si, intr_val); - origidx = si->curidx; - cc = (chipcregs_t*) sb_setcore(sbh, SB_CC, 0); - ASSERT(cc != NULL); - - if (!(R_REG(&cc->capabilities) & CAP_PWR_CTL)) { - err = 3; - goto done; - } - - if (set) { - SET_REG(&cc->slow_clk_ctl, SCC_CD_MASK, ((*div / 4 - 1) << SCC_CD_SHF)); - sb_pwrctl_setdelay(sbh, (void *)cc); - } else - *div = 4 * (((R_REG(&cc->slow_clk_ctl) & SCC_CD_MASK) >> SCC_CD_SHF) + 1); - -done: - sb_setcoreidx(sbh, origidx); - INTR_RESTORE(si, intr_val); - return err; -} - -/* initialize power control delay registers */ -void -sb_pwrctl_init(void *sbh) -{ - sb_info_t *si; - uint origidx; - chipcregs_t *cc; - - si = SB_INFO(sbh); - - if (si->bus == SB_BUS) - return; - - origidx = si->curidx; - - if ((cc = (chipcregs_t*) sb_setcore(sbh, SB_CC, 0)) == NULL) - return; - - if (!(R_REG(&cc->capabilities) & CAP_PWR_CTL)) - goto done; - - /* 4317pc does not work with SlowClock less than 5Mhz */ - if (si->bus == PCMCIA_BUS) { - if ((si->ccrev >= 6) && (si->ccrev < 10)) - SET_REG(&cc->slow_clk_ctl, SCC_CD_MASK, (SCC_DEF_DIV << SCC_CD_SHF)); - } - - sb_pwrctl_setdelay(sbh, (void *)cc); - -done: - sb_setcoreidx(sbh, origidx); -} - -/* return the value suitable for writing to the dot11 core FAST_PWRUP_DELAY register */ -uint16 -sb_pwrctl_fast_pwrup_delay(void *sbh) -{ - sb_info_t *si; - uint origidx; - chipcregs_t *cc; - uint slowminfreq; - uint16 fpdelay; - uint intr_val = 0; - - si = SB_INFO(sbh); - fpdelay = 0; - origidx = si->curidx; - - if (si->bus == SB_BUS) - goto done; - - INTR_OFF(si, intr_val); - - if ((cc = (chipcregs_t*) sb_setcore(sbh, SB_CC, 0)) == NULL) - goto done; - - if (!(R_REG(&cc->capabilities) & CAP_PWR_CTL)) - goto done; - - slowminfreq = sb_slowclk_freq(sbh, FALSE); - fpdelay = (((R_REG(&cc->pll_on_delay) + 2) * 1000000) + (slowminfreq - 1)) / slowminfreq; - -done: - sb_setcoreidx(sbh, origidx); - INTR_RESTORE(si, intr_val); - return (fpdelay); -} - -/* turn primary xtal and/or pll off/on */ -int -sb_pwrctl_xtal(void *sbh, uint what, bool on) -{ - sb_info_t *si; - uint32 in, out, outen; - - si = SB_INFO(sbh); - - switch (si->bus) { - - - case PCMCIA_BUS: - return (0); - - - case PCI_BUS: - - in = OSL_PCI_READ_CONFIG(si->osh, PCI_GPIO_IN, sizeof (uint32)); - out = OSL_PCI_READ_CONFIG(si->osh, PCI_GPIO_OUT, sizeof (uint32)); - outen = OSL_PCI_READ_CONFIG(si->osh, PCI_GPIO_OUTEN, sizeof (uint32)); - - /* - * We can't actually read the state of the PLLPD so we infer it - * by the value of XTAL_PU which *is* readable via gpioin. - */ - if (on && (in & PCI_CFG_GPIO_XTAL)) - return (0); - - if (what & XTAL) - outen |= PCI_CFG_GPIO_XTAL; - if (what & PLL) - outen |= PCI_CFG_GPIO_PLL; - - if (on) { - /* turn primary xtal on */ - if (what & XTAL) { - out |= PCI_CFG_GPIO_XTAL; - if (what & PLL) - out |= PCI_CFG_GPIO_PLL; - OSL_PCI_WRITE_CONFIG(si->osh, PCI_GPIO_OUT, sizeof (uint32), out); - OSL_PCI_WRITE_CONFIG(si->osh, PCI_GPIO_OUTEN, sizeof (uint32), outen); - OSL_DELAY(XTAL_ON_DELAY); - } - - /* turn pll on */ - if (what & PLL) { - out &= ~PCI_CFG_GPIO_PLL; - OSL_PCI_WRITE_CONFIG(si->osh, PCI_GPIO_OUT, sizeof (uint32), out); - OSL_DELAY(2000); - } - } else { - if (what & XTAL) - out &= ~PCI_CFG_GPIO_XTAL; - if (what & PLL) - out |= PCI_CFG_GPIO_PLL; - OSL_PCI_WRITE_CONFIG(si->osh, PCI_GPIO_OUT, sizeof (uint32), out); - OSL_PCI_WRITE_CONFIG(si->osh, PCI_GPIO_OUTEN, sizeof (uint32), outen); - } - - default: - return (-1); - } - - return (0); -} - -/* set dynamic power control mode (forceslow, forcefast, dynamic) */ -/* returns true if ignore pll off is set and false if it is not */ -bool -sb_pwrctl_clk(void *sbh, uint mode) -{ - sb_info_t *si; - uint origidx; - chipcregs_t *cc; - uint32 scc; - bool forcefastclk=FALSE; - uint intr_val = 0; - - si = SB_INFO(sbh); - - /* chipcommon cores prior to rev6 don't support slowclkcontrol */ - if (si->ccrev < 6) - return (FALSE); - - /* chipcommon cores rev10 are a whole new ball game */ - if (si->ccrev >= 10) - return (FALSE); - - INTR_OFF(si, intr_val); - - origidx = si->curidx; - - cc = (chipcregs_t*) sb_setcore(sbh, SB_CC, 0); - ASSERT(cc != NULL); - - if (!(R_REG(&cc->capabilities) & CAP_PWR_CTL)) - goto done; - - switch (mode) { - case CLK_FAST: /* force fast (pll) clock */ - /* don't forget to force xtal back on before we clear SCC_DYN_XTAL.. */ - sb_pwrctl_xtal(sbh, XTAL, ON); - - SET_REG(&cc->slow_clk_ctl, (SCC_XC | SCC_FS | SCC_IP), SCC_IP); - break; - - case CLK_SLOW: /* force slow clock */ - if ((si->bus == SDIO_BUS) || (si->bus == PCMCIA_BUS)) - return (-1); - - if (si->ccrev >= 6) - OR_REG(&cc->slow_clk_ctl, SCC_FS); - break; - - case CLK_DYNAMIC: /* enable dynamic power control */ - scc = R_REG(&cc->slow_clk_ctl); - scc &= ~(SCC_FS | SCC_IP | SCC_XC); - if ((scc & SCC_SS_MASK) != SCC_SS_XTAL) - scc |= SCC_XC; - W_REG(&cc->slow_clk_ctl, scc); - - /* for dynamic control, we have to release our xtal_pu "force on" */ - if (scc & SCC_XC) - sb_pwrctl_xtal(sbh, XTAL, OFF); - break; - } - - /* Is the h/w forcing the use of the fast clk */ - forcefastclk = (bool)((R_REG(&cc->slow_clk_ctl) & SCC_IP) == SCC_IP); - -done: - sb_setcoreidx(sbh, origidx); - INTR_RESTORE(si, intr_val); - return (forcefastclk); -} - -/* register driver interrupt disabling and restoring callback functions */ -void -sb_register_intr_callback(void *sbh, void *intrsoff_fn, void *intrsrestore_fn, void *intrsenabled_fn, void *intr_arg) -{ - sb_info_t *si; - - si = SB_INFO(sbh); - si->intr_arg = intr_arg; - si->intrsoff_fn = (sb_intrsoff_t)intrsoff_fn; - si->intrsrestore_fn = (sb_intrsrestore_t)intrsrestore_fn; - si->intrsenabled_fn = (sb_intrsenabled_t)intrsenabled_fn; - /* save current core id. when this function called, the current core - * must be the core which provides driver functions(il, et, wl, etc.) - */ - si->dev_coreid = si->coreid[si->curidx]; -} - - diff --git a/openwrt/package/linux/kernel-source/drivers/net/hnd/shared_ksyms.sh b/openwrt/package/linux/kernel-source/drivers/net/hnd/shared_ksyms.sh deleted file mode 100644 index 0187d47ea5..0000000000 --- a/openwrt/package/linux/kernel-source/drivers/net/hnd/shared_ksyms.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# -# Copyright 2004, Broadcom Corporation -# All Rights Reserved. -# -# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY -# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM -# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. -# -# $Id$ -# - -cat < -#include -EOF - -for file in $* ; do - ${NM} $file | sed -ne 's/[0-9A-Fa-f]* [DT] \([^ ]*\)/extern void \1; EXPORT_SYMBOL(\1);/p' -done diff --git a/openwrt/package/linux/kernel-source/drivers/net/wl/Makefile b/openwrt/package/linux/kernel-source/drivers/net/wl/Makefile deleted file mode 100644 index 7c82e6519b..0000000000 --- a/openwrt/package/linux/kernel-source/drivers/net/wl/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -# -# Makefile for the Broadcom wl driver -# -# Copyright 2004, Broadcom Corporation -# All Rights Reserved. -# -# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY -# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM -# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. -# -# $Id$ -# - -O_TARGET := wl.o - -WL_OBJS := wl_linux.o wlc.o d11ucode.o wlc_phy.o wlc_rate.o wlc_led.o wlc_security.o rc4.o tkhash.o bcmwpa.o - -INSUP_OBJS := aes.o aeskeywrap.o hmac.o md5.o passhash.o prf.o rijndael-alg-fst.o sha1.o - -# Alternate ioctl interfaces -#ifeq ($(CONFIG_NET_WIRELESS),y) -#WL_OBJS += wlc_cmn_ioctl.o -#endif -ifeq ($(CONFIG_WL_OID),y) -WL_OBJS += wl_oid.o -endif - -ifeq ($(CONFIG_WL_STA),y) -WL_OBJS += $(INSUP_OBJS) -endif - -# Prefix driver variants -WL_APOBJS := $(foreach obj,$(WL_OBJS),ap_$(obj)) -WL_STAOBJS := $(foreach obj,$(WL_OBJS) wlc_sup.o,sta_$(obj)) -WL_APSTAOBJS := $(foreach obj,$(WL_OBJS) wlc_sup.o,apsta_$(obj)) -ifneq ($(CONFIG_WL_STA),y) -WL_APSTAOBJS += $(foreach obj,$(INSUP_OBJS), apsta_$(obj)) -endif - -# Either or both -ifeq ($(CONFIG_WL_AP),y) -AP := AP -endif -ifeq ($(CONFIG_WL_STA),y) -STA := STA -endif - -# Build all variants as modules but link only one of them -export-objs := -obj-y := $(WL_$(AP)$(STA)OBJS) -obj-m := $(O_TARGET) -variant-objs := $(WL_APOBJS) $(WL_STAOBJS) $(WL_APSTAOBJS) - -EXTRA_CFLAGS += -DDMA - -include $(TOPDIR)/Rules.make - - diff --git a/openwrt/package/linux/kernel-source/drivers/parport/parport_splink.c b/openwrt/package/linux/kernel-source/drivers/parport/parport_splink.c deleted file mode 100644 index 0f5a81b85d..0000000000 --- a/openwrt/package/linux/kernel-source/drivers/parport/parport_splink.c +++ /dev/null @@ -1,345 +0,0 @@ -/* Low-level parallel port routines for the ASUS WL-500g built-in port - * - * Author: Nuno Grilo - * Based on parport_pc source - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#define SPLINK_ADDRESS 0xBF800010 - -#undef DEBUG - -#ifdef DEBUG -#define DPRINTK printk -#else -#define DPRINTK(stuff...) -#endif - - -/* __parport_splink_frob_control differs from parport_splink_frob_control in that - * it doesn't do any extra masking. */ -static __inline__ unsigned char __parport_splink_frob_control (struct parport *p, - unsigned char mask, - unsigned char val) -{ - struct parport_pc_private *priv = p->physport->private_data; - unsigned char *io = (unsigned char *) p->base; - unsigned char ctr = priv->ctr; -#ifdef DEBUG_PARPORT - printk (KERN_DEBUG - "__parport_splink_frob_control(%02x,%02x): %02x -> %02x\n", - mask, val, ctr, ((ctr & ~mask) ^ val) & priv->ctr_writable); -#endif - ctr = (ctr & ~mask) ^ val; - ctr &= priv->ctr_writable; /* only write writable bits. */ - *(io+2) = ctr; - priv->ctr = ctr; /* Update soft copy */ - return ctr; -} - - - -static void parport_splink_data_forward (struct parport *p) -{ - DPRINTK(KERN_DEBUG "parport_splink: parport_data_forward called\n"); - __parport_splink_frob_control (p, 0x20, 0); -} - -static void parport_splink_data_reverse (struct parport *p) -{ - DPRINTK(KERN_DEBUG "parport_splink: parport_data_forward called\n"); - __parport_splink_frob_control (p, 0x20, 0x20); -} - -/* -static void parport_splink_interrupt(int irq, void *dev_id, struct pt_regs *regs) -{ - DPRINTK(KERN_DEBUG "parport_splink: IRQ handler called\n"); - parport_generic_irq(irq, (struct parport *) dev_id, regs); -} -*/ - -static void parport_splink_enable_irq(struct parport *p) -{ - DPRINTK(KERN_DEBUG "parport_splink: parport_splink_enable_irq called\n"); - __parport_splink_frob_control (p, 0x10, 0x10); -} - -static void parport_splink_disable_irq(struct parport *p) -{ - DPRINTK(KERN_DEBUG "parport_splink: parport_splink_disable_irq called\n"); - __parport_splink_frob_control (p, 0x10, 0); -} - -static void parport_splink_init_state(struct pardevice *dev, struct parport_state *s) -{ - DPRINTK(KERN_DEBUG "parport_splink: parport_splink_init_state called\n"); - s->u.pc.ctr = 0xc | (dev->irq_func ? 0x10 : 0x0); - if (dev->irq_func && - dev->port->irq != PARPORT_IRQ_NONE) - /* Set ackIntEn */ - s->u.pc.ctr |= 0x10; -} - -static void parport_splink_save_state(struct parport *p, struct parport_state *s) -{ - const struct parport_pc_private *priv = p->physport->private_data; - DPRINTK(KERN_DEBUG "parport_splink: parport_splink_save_state called\n"); - s->u.pc.ctr = priv->ctr; -} - -static void parport_splink_restore_state(struct parport *p, struct parport_state *s) -{ - struct parport_pc_private *priv = p->physport->private_data; - unsigned char *io = (unsigned char *) p->base; - unsigned char ctr = s->u.pc.ctr; - - DPRINTK(KERN_DEBUG "parport_splink: parport_splink_restore_state called\n"); - *(io+2) = ctr; - priv->ctr = ctr; -} - -static void parport_splink_setup_interrupt(void) { - return; -} - -static void parport_splink_write_data(struct parport *p, unsigned char d) { - DPRINTK(KERN_DEBUG "parport_splink: write data called\n"); - unsigned char *io = (unsigned char *) p->base; - *io = d; -} - -static unsigned char parport_splink_read_data(struct parport *p) { - DPRINTK(KERN_DEBUG "parport_splink: read data called\n"); - unsigned char *io = (unsigned char *) p->base; - return *io; -} - -static void parport_splink_write_control(struct parport *p, unsigned char d) -{ - const unsigned char wm = (PARPORT_CONTROL_STROBE | - PARPORT_CONTROL_AUTOFD | - PARPORT_CONTROL_INIT | - PARPORT_CONTROL_SELECT); - - DPRINTK(KERN_DEBUG "parport_splink: write control called\n"); - /* Take this out when drivers have adapted to the newer interface. */ - if (d & 0x20) { - printk (KERN_DEBUG "%s (%s): use data_reverse for this!\n", - p->name, p->cad->name); - parport_splink_data_reverse (p); - } - - __parport_splink_frob_control (p, wm, d & wm); -} - -static unsigned char parport_splink_read_control(struct parport *p) -{ - const unsigned char wm = (PARPORT_CONTROL_STROBE | - PARPORT_CONTROL_AUTOFD | - PARPORT_CONTROL_INIT | - PARPORT_CONTROL_SELECT); - DPRINTK(KERN_DEBUG "parport_splink: read control called\n"); - const struct parport_pc_private *priv = p->physport->private_data; - return priv->ctr & wm; /* Use soft copy */ -} - -static unsigned char parport_splink_frob_control (struct parport *p, unsigned char mask, - unsigned char val) -{ - const unsigned char wm = (PARPORT_CONTROL_STROBE | - PARPORT_CONTROL_AUTOFD | - PARPORT_CONTROL_INIT | - PARPORT_CONTROL_SELECT); - - DPRINTK(KERN_DEBUG "parport_splink: frob control called\n"); - /* Take this out when drivers have adapted to the newer interface. */ - if (mask & 0x20) { - printk (KERN_DEBUG "%s (%s): use data_%s for this!\n", - p->name, p->cad->name, - (val & 0x20) ? "reverse" : "forward"); - if (val & 0x20) - parport_splink_data_reverse (p); - else - parport_splink_data_forward (p); - } - - /* Restrict mask and val to control lines. */ - mask &= wm; - val &= wm; - - return __parport_splink_frob_control (p, mask, val); -} - -static unsigned char parport_splink_read_status(struct parport *p) -{ - DPRINTK(KERN_DEBUG "parport_splink: read status called\n"); - unsigned char *io = (unsigned char *) p->base; - return *(io+1); -} - -static void parport_splink_inc_use_count(void) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -static void parport_splink_dec_use_count(void) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - -static struct parport_operations parport_splink_ops = -{ - parport_splink_write_data, - parport_splink_read_data, - - parport_splink_write_control, - parport_splink_read_control, - parport_splink_frob_control, - - parport_splink_read_status, - - parport_splink_enable_irq, - parport_splink_disable_irq, - - parport_splink_data_forward, - parport_splink_data_reverse, - - parport_splink_init_state, - parport_splink_save_state, - parport_splink_restore_state, - - parport_splink_inc_use_count, - parport_splink_dec_use_count, - - parport_ieee1284_epp_write_data, - parport_ieee1284_epp_read_data, - parport_ieee1284_epp_write_addr, - parport_ieee1284_epp_read_addr, - - parport_ieee1284_ecp_write_data, - parport_ieee1284_ecp_read_data, - parport_ieee1284_ecp_write_addr, - - parport_ieee1284_write_compat, - parport_ieee1284_read_nibble, - parport_ieee1284_read_byte, -}; - -/* --- Initialisation code -------------------------------- */ - -static struct parport *parport_splink_probe_port (unsigned long int base) -{ - struct parport_pc_private *priv; - struct parport_operations *ops; - struct parport *p; - - if (check_mem_region(base, 3)) { - printk (KERN_DEBUG "parport (0x%lx): iomem region not available\n", base); - return NULL; - } - priv = kmalloc (sizeof (struct parport_pc_private), GFP_KERNEL); - if (!priv) { - printk (KERN_DEBUG "parport (0x%lx): no memory!\n", base); - return NULL; - } - ops = kmalloc (sizeof (struct parport_operations), GFP_KERNEL); - if (!ops) { - printk (KERN_DEBUG "parport (0x%lx): no memory for ops!\n", - base); - kfree (priv); - return NULL; - } - memcpy (ops, &parport_splink_ops, sizeof (struct parport_operations)); - priv->ctr = 0xc; - priv->ctr_writable = 0xff; - - if (!(p = parport_register_port(base, PARPORT_IRQ_NONE, - PARPORT_DMA_NONE, ops))) { - printk (KERN_DEBUG "parport (0x%lx): registration failed!\n", - base); - kfree (priv); - kfree (ops); - return NULL; - } - - p->modes = PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT; - p->size = (p->modes & PARPORT_MODE_EPP)?8:3; - p->private_data = priv; - - parport_proc_register(p); - request_mem_region (p->base, 3, p->name); - - /* Done probing. Now put the port into a sensible start-up state. */ - parport_splink_write_data(p, 0); - parport_splink_data_forward (p); - - /* Now that we've told the sharing engine about the port, and - found out its characteristics, let the high-level drivers - know about it. */ - parport_announce_port (p); - - DPRINTK(KERN_DEBUG "parport (0x%lx): init ok!\n", - base); - return p; -} - -static void parport_splink_unregister_port(struct parport *p) { - struct parport_pc_private *priv = p->private_data; - struct parport_operations *ops = p->ops; - - if (p->irq != PARPORT_IRQ_NONE) - free_irq(p->irq, p); - release_mem_region(p->base, 3); - parport_proc_unregister(p); - kfree (priv); - parport_unregister_port(p); - kfree (ops); -} - - -int parport_splink_init(void) -{ - int ret; - - DPRINTK(KERN_DEBUG "parport_splink init called\n"); - parport_splink_setup_interrupt(); - ret = !parport_splink_probe_port(SPLINK_ADDRESS); - - return ret; -} - -void parport_splink_cleanup(void) { - struct parport *p = parport_enumerate(), *tmp; - DPRINTK(KERN_DEBUG "parport_splink cleanup called\n"); - if (p->size) { - if (p->modes & PARPORT_MODE_PCSPP) { - while(p) { - tmp = p->next; - parport_splink_unregister_port(p); - p = tmp; - } - } - } -} - -MODULE_AUTHOR("Nuno Grilo "); -MODULE_DESCRIPTION("Parport Driver for ASUS WL-500g router builtin Port"); -MODULE_SUPPORTED_DEVICE("ASUS WL-500g builtin Parallel Port"); -MODULE_LICENSE("GPL"); - -module_init(parport_splink_init) -module_exit(parport_splink_cleanup) - diff --git a/openwrt/package/linux/kernel-source/drivers/pcmcia/bcm4710_generic.c b/openwrt/package/linux/kernel-source/drivers/pcmcia/bcm4710_generic.c deleted file mode 100644 index 18eba46791..0000000000 --- a/openwrt/package/linux/kernel-source/drivers/pcmcia/bcm4710_generic.c +++ /dev/null @@ -1,912 +0,0 @@ -/* - * - * bcm47xx pcmcia driver - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * Based on sa1100_generic.c from www.handhelds.org, - * and au1000_generic.c from oss.sgi.com. - * - * $Id$ - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include "cs_internal.h" - -#include -#include -#include - -#include -#include -#include - -#include "bcm4710pcmcia.h" - -#ifdef PCMCIA_DEBUG -static int pc_debug = PCMCIA_DEBUG; -#endif - -MODULE_DESCRIPTION("Linux PCMCIA Card Services: bcm47xx Socket Controller"); - -/* This structure maintains housekeeping state for each socket, such - * as the last known values of the card detect pins, or the Card Services - * callback value associated with the socket: - */ -static struct bcm47xx_pcmcia_socket *pcmcia_socket; -static int socket_count; - - -/* Returned by the low-level PCMCIA interface: */ -static struct pcmcia_low_level *pcmcia_low_level; - -/* Event poll timer structure */ -static struct timer_list poll_timer; - - -/* Prototypes for routines which are used internally: */ - -static int bcm47xx_pcmcia_driver_init(void); -static void bcm47xx_pcmcia_driver_shutdown(void); -static void bcm47xx_pcmcia_task_handler(void *data); -static void bcm47xx_pcmcia_poll_event(unsigned long data); -static void bcm47xx_pcmcia_interrupt(int irq, void *dev, struct pt_regs *regs); -static struct tq_struct bcm47xx_pcmcia_task; - -#ifdef CONFIG_PROC_FS -static int bcm47xx_pcmcia_proc_status(char *buf, char **start, - off_t pos, int count, int *eof, void *data); -#endif - - -/* Prototypes for operations which are exported to the - * in-kernel PCMCIA core: - */ - -static int bcm47xx_pcmcia_init(unsigned int sock); -static int bcm47xx_pcmcia_suspend(unsigned int sock); -static int bcm47xx_pcmcia_register_callback(unsigned int sock, - void (*handler)(void *, unsigned int), void *info); -static int bcm47xx_pcmcia_inquire_socket(unsigned int sock, socket_cap_t *cap); -static int bcm47xx_pcmcia_get_status(unsigned int sock, u_int *value); -static int bcm47xx_pcmcia_get_socket(unsigned int sock, socket_state_t *state); -static int bcm47xx_pcmcia_set_socket(unsigned int sock, socket_state_t *state); -static int bcm47xx_pcmcia_get_io_map(unsigned int sock, struct pccard_io_map *io); -static int bcm47xx_pcmcia_set_io_map(unsigned int sock, struct pccard_io_map *io); -static int bcm47xx_pcmcia_get_mem_map(unsigned int sock, struct pccard_mem_map *mem); -static int bcm47xx_pcmcia_set_mem_map(unsigned int sock, struct pccard_mem_map *mem); -#ifdef CONFIG_PROC_FS -static void bcm47xx_pcmcia_proc_setup(unsigned int sock, struct proc_dir_entry *base); -#endif - -static struct pccard_operations bcm47xx_pcmcia_operations = { - bcm47xx_pcmcia_init, - bcm47xx_pcmcia_suspend, - bcm47xx_pcmcia_register_callback, - bcm47xx_pcmcia_inquire_socket, - bcm47xx_pcmcia_get_status, - bcm47xx_pcmcia_get_socket, - bcm47xx_pcmcia_set_socket, - bcm47xx_pcmcia_get_io_map, - bcm47xx_pcmcia_set_io_map, - bcm47xx_pcmcia_get_mem_map, - bcm47xx_pcmcia_set_mem_map, -#ifdef CONFIG_PROC_FS - bcm47xx_pcmcia_proc_setup -#endif -}; - - -/* - * bcm47xx_pcmcia_driver_init() - * - * This routine performs a basic sanity check to ensure that this - * kernel has been built with the appropriate board-specific low-level - * PCMCIA support, performs low-level PCMCIA initialization, registers - * this socket driver with Card Services, and then spawns the daemon - * thread which is the real workhorse of the socket driver. - * - * Please see linux/Documentation/arm/SA1100/PCMCIA for more information - * on the low-level kernel interface. - * - * Returns: 0 on success, -1 on error - */ -static int __init bcm47xx_pcmcia_driver_init(void) -{ - servinfo_t info; - struct pcmcia_init pcmcia_init; - struct pcmcia_state state; - unsigned int i; - unsigned long tmp; - - - printk("\nBCM47XX PCMCIA (CS release %s)\n", CS_RELEASE); - - CardServices(GetCardServicesInfo, &info); - - if (info.Revision != CS_RELEASE_CODE) { - printk(KERN_ERR "Card Services release codes do not match\n"); - return -1; - } - -#ifdef CONFIG_BCM4710 - pcmcia_low_level=&bcm4710_pcmcia_ops; -#else -#error Unsupported Broadcom BCM47XX board. -#endif - - pcmcia_init.handler=bcm47xx_pcmcia_interrupt; - - if ((socket_count = pcmcia_low_level->init(&pcmcia_init)) < 0) { - printk(KERN_ERR "Unable to initialize PCMCIA service.\n"); - return -EIO; - } else { - printk("\t%d PCMCIA sockets initialized.\n", socket_count); - } - - pcmcia_socket = - kmalloc(sizeof(struct bcm47xx_pcmcia_socket) * socket_count, - GFP_KERNEL); - memset(pcmcia_socket, 0, - sizeof(struct bcm47xx_pcmcia_socket) * socket_count); - if (!pcmcia_socket) { - printk(KERN_ERR "Card Services can't get memory \n"); - return -1; - } - - for (i = 0; i < socket_count; i++) { - if (pcmcia_low_level->socket_state(i, &state) < 0) { - printk(KERN_ERR "Unable to get PCMCIA status\n"); - return -EIO; - } - pcmcia_socket[i].k_state = state; - pcmcia_socket[i].cs_state.csc_mask = SS_DETECT; - - if (i == 0) { - pcmcia_socket[i].virt_io = - (unsigned long)ioremap_nocache(EXTIF_PCMCIA_IOBASE(BCM4710_EXTIF), 0x1000); - /* Substract ioport base which gets added by in/out */ - pcmcia_socket[i].virt_io -= mips_io_port_base; - pcmcia_socket[i].phys_attr = - (unsigned long)EXTIF_PCMCIA_CFGBASE(BCM4710_EXTIF); - pcmcia_socket[i].phys_mem = - (unsigned long)EXTIF_PCMCIA_MEMBASE(BCM4710_EXTIF); - } else { - printk(KERN_ERR "bcm4710: socket 1 not supported\n"); - return 1; - } - } - - /* Only advertise as many sockets as we can detect: */ - if (register_ss_entry(socket_count, &bcm47xx_pcmcia_operations) < 0) { - printk(KERN_ERR "Unable to register socket service routine\n"); - return -ENXIO; - } - - /* Start the event poll timer. - * It will reschedule by itself afterwards. - */ - bcm47xx_pcmcia_poll_event(0); - - DEBUG(1, "bcm4710: initialization complete\n"); - return 0; - -} - -module_init(bcm47xx_pcmcia_driver_init); - - -/* - * bcm47xx_pcmcia_driver_shutdown() - * - * Invokes the low-level kernel service to free IRQs associated with this - * socket controller and reset GPIO edge detection. - */ -static void __exit bcm47xx_pcmcia_driver_shutdown(void) -{ - int i; - - del_timer_sync(&poll_timer); - unregister_ss_entry(&bcm47xx_pcmcia_operations); - pcmcia_low_level->shutdown(); - flush_scheduled_tasks(); - for (i = 0; i < socket_count; i++) { - if (pcmcia_socket[i].virt_io) - iounmap((void *)pcmcia_socket[i].virt_io); - if (pcmcia_socket[i].phys_attr) - iounmap((void *)pcmcia_socket[i].phys_attr); - if (pcmcia_socket[i].phys_mem) - iounmap((void *)pcmcia_socket[i].phys_mem); - } - DEBUG(1, "bcm4710: shutdown complete\n"); -} - -module_exit(bcm47xx_pcmcia_driver_shutdown); - -/* - * bcm47xx_pcmcia_init() - * We perform all of the interesting initialization tasks in - * bcm47xx_pcmcia_driver_init(). - * - * Returns: 0 - */ -static int bcm47xx_pcmcia_init(unsigned int sock) -{ - DEBUG(1, "%s(): initializing socket %u\n", __FUNCTION__, sock); - - return 0; -} - -/* - * bcm47xx_pcmcia_suspend() - * - * We don't currently perform any actions on a suspend. - * - * Returns: 0 - */ -static int bcm47xx_pcmcia_suspend(unsigned int sock) -{ - DEBUG(1, "%s(): suspending socket %u\n", __FUNCTION__, sock); - - return 0; -} - - -/* - * bcm47xx_pcmcia_events() - * - * Helper routine to generate a Card Services event mask based on - * state information obtained from the kernel low-level PCMCIA layer - * in a recent (and previous) sampling. Updates `prev_state'. - * - * Returns: an event mask for the given socket state. - */ -static inline unsigned -bcm47xx_pcmcia_events(struct pcmcia_state *state, - struct pcmcia_state *prev_state, - unsigned int mask, unsigned int flags) -{ - unsigned int events=0; - - if (state->bvd1 != prev_state->bvd1) { - - DEBUG(3, "%s(): card BVD1 value %u\n", __FUNCTION__, state->bvd1); - - events |= mask & (flags & SS_IOCARD) ? SS_STSCHG : SS_BATDEAD; - } - - if (state->bvd2 != prev_state->bvd2) { - - DEBUG(3, "%s(): card BVD2 value %u\n", __FUNCTION__, state->bvd2); - - events |= mask & (flags & SS_IOCARD) ? 0 : SS_BATWARN; - } - - if (state->detect != prev_state->detect) { - - DEBUG(3, "%s(): card detect value %u\n", __FUNCTION__, state->detect); - - events |= mask & SS_DETECT; - } - - - if (state->ready != prev_state->ready) { - - DEBUG(3, "%s(): card ready value %u\n", __FUNCTION__, state->ready); - - events |= mask & ((flags & SS_IOCARD) ? 0 : SS_READY); - } - - if (events != 0) { - DEBUG(2, "events: %s%s%s%s%s\n", - (events & SS_DETECT) ? "DETECT " : "", - (events & SS_READY) ? "READY " : "", - (events & SS_BATDEAD) ? "BATDEAD " : "", - (events & SS_BATWARN) ? "BATWARN " : "", - (events & SS_STSCHG) ? "STSCHG " : ""); - } - - *prev_state=*state; - return events; -} - - -/* - * bcm47xx_pcmcia_task_handler() - * - * Processes serviceable socket events using the "eventd" thread context. - * - * Event processing (specifically, the invocation of the Card Services event - * callback) occurs in this thread rather than in the actual interrupt - * handler due to the use of scheduling operations in the PCMCIA core. - */ -static void bcm47xx_pcmcia_task_handler(void *data) -{ - struct pcmcia_state state; - int i, events, irq_status; - - DEBUG(4, "%s(): entering PCMCIA monitoring thread\n", __FUNCTION__); - - for (i = 0; i < socket_count; i++) { - if ((irq_status = pcmcia_low_level->socket_state(i, &state)) < 0) - printk(KERN_ERR "Error in kernel low-level PCMCIA service.\n"); - - events = bcm47xx_pcmcia_events(&state, - &pcmcia_socket[i].k_state, - pcmcia_socket[i].cs_state.csc_mask, - pcmcia_socket[i].cs_state.flags); - - if (pcmcia_socket[i].handler != NULL) { - pcmcia_socket[i].handler(pcmcia_socket[i].handler_info, - events); - } - } -} - -static struct tq_struct bcm47xx_pcmcia_task = { - routine: bcm47xx_pcmcia_task_handler -}; - - -/* - * bcm47xx_pcmcia_poll_event() - * - * Let's poll for events in addition to IRQs since IRQ only is unreliable... - */ -static void bcm47xx_pcmcia_poll_event(unsigned long dummy) -{ - DEBUG(4, "%s(): polling for events\n", __FUNCTION__); - - poll_timer.function = bcm47xx_pcmcia_poll_event; - poll_timer.expires = jiffies + BCM47XX_PCMCIA_POLL_PERIOD; - add_timer(&poll_timer); - schedule_task(&bcm47xx_pcmcia_task); -} - - -/* - * bcm47xx_pcmcia_interrupt() - * - * Service routine for socket driver interrupts (requested by the - * low-level PCMCIA init() operation via bcm47xx_pcmcia_thread()). - * - * The actual interrupt-servicing work is performed by - * bcm47xx_pcmcia_task(), largely because the Card Services event- - * handling code performs scheduling operations which cannot be - * executed from within an interrupt context. - */ -static void -bcm47xx_pcmcia_interrupt(int irq, void *dev, struct pt_regs *regs) -{ - DEBUG(3, "%s(): servicing IRQ %d\n", __FUNCTION__, irq); - schedule_task(&bcm47xx_pcmcia_task); -} - - -/* - * bcm47xx_pcmcia_register_callback() - * - * Implements the register_callback() operation for the in-kernel - * PCMCIA service (formerly SS_RegisterCallback in Card Services). If - * the function pointer `handler' is not NULL, remember the callback - * location in the state for `sock', and increment the usage counter - * for the driver module. (The callback is invoked from the interrupt - * service routine, bcm47xx_pcmcia_interrupt(), to notify Card Services - * of interesting events.) Otherwise, clear the callback pointer in the - * socket state and decrement the module usage count. - * - * Returns: 0 - */ -static int -bcm47xx_pcmcia_register_callback(unsigned int sock, - void (*handler)(void *, unsigned int), void *info) -{ - if (handler == NULL) { - pcmcia_socket[sock].handler = NULL; - MOD_DEC_USE_COUNT; - } else { - MOD_INC_USE_COUNT; - pcmcia_socket[sock].handler = handler; - pcmcia_socket[sock].handler_info = info; - } - return 0; -} - - -/* - * bcm47xx_pcmcia_inquire_socket() - * - * Implements the inquire_socket() operation for the in-kernel PCMCIA - * service (formerly SS_InquireSocket in Card Services). Of note is - * the setting of the SS_CAP_PAGE_REGS bit in the `features' field of - * `cap' to "trick" Card Services into tolerating large "I/O memory" - * addresses. Also set is SS_CAP_STATIC_MAP, which disables the memory - * resource database check. (Mapped memory is set up within the socket - * driver itself.) - * - * In conjunction with the STATIC_MAP capability is a new field, - * `io_offset', recommended by David Hinds. Rather than go through - * the SetIOMap interface (which is not quite suited for communicating - * window locations up from the socket driver), we just pass up - * an offset which is applied to client-requested base I/O addresses - * in alloc_io_space(). - * - * Returns: 0 on success, -1 if no pin has been configured for `sock' - */ -static int -bcm47xx_pcmcia_inquire_socket(unsigned int sock, socket_cap_t *cap) -{ - struct pcmcia_irq_info irq_info; - - if (sock >= socket_count) { - printk(KERN_ERR "bcm47xx: socket %u not configured\n", sock); - return -1; - } - - /* SS_CAP_PAGE_REGS: used by setup_cis_mem() in cistpl.c to set the - * force_low argument to validate_mem() in rsrc_mgr.c -- since in - * general, the mapped * addresses of the PCMCIA memory regions - * will not be within 0xffff, setting force_low would be - * undesirable. - * - * SS_CAP_STATIC_MAP: don't bother with the (user-configured) memory - * resource database; we instead pass up physical address ranges - * and allow other parts of Card Services to deal with remapping. - * - * SS_CAP_PCCARD: we can deal with 16-bit PCMCIA & CF cards, but - * not 32-bit CardBus devices. - */ - cap->features = (SS_CAP_PAGE_REGS | SS_CAP_STATIC_MAP | SS_CAP_PCCARD); - - irq_info.sock = sock; - irq_info.irq = -1; - - if (pcmcia_low_level->get_irq_info(&irq_info) < 0) { - printk(KERN_ERR "Error obtaining IRQ info socket %u\n", sock); - return -1; - } - - cap->irq_mask = 0; - cap->map_size = PAGE_SIZE; - cap->pci_irq = irq_info.irq; - cap->io_offset = pcmcia_socket[sock].virt_io; - - return 0; -} - - -/* - * bcm47xx_pcmcia_get_status() - * - * Implements the get_status() operation for the in-kernel PCMCIA - * service (formerly SS_GetStatus in Card Services). Essentially just - * fills in bits in `status' according to internal driver state or - * the value of the voltage detect chipselect register. - * - * As a debugging note, during card startup, the PCMCIA core issues - * three set_socket() commands in a row the first with RESET deasserted, - * the second with RESET asserted, and the last with RESET deasserted - * again. Following the third set_socket(), a get_status() command will - * be issued. The kernel is looking for the SS_READY flag (see - * setup_socket(), reset_socket(), and unreset_socket() in cs.c). - * - * Returns: 0 - */ -static int -bcm47xx_pcmcia_get_status(unsigned int sock, unsigned int *status) -{ - struct pcmcia_state state; - - - if ((pcmcia_low_level->socket_state(sock, &state)) < 0) { - printk(KERN_ERR "Unable to get PCMCIA status from kernel.\n"); - return -1; - } - - pcmcia_socket[sock].k_state = state; - - *status = state.detect ? SS_DETECT : 0; - - *status |= state.ready ? SS_READY : 0; - - /* The power status of individual sockets is not available - * explicitly from the hardware, so we just remember the state - * and regurgitate it upon request: - */ - *status |= pcmcia_socket[sock].cs_state.Vcc ? SS_POWERON : 0; - - if (pcmcia_socket[sock].cs_state.flags & SS_IOCARD) - *status |= state.bvd1 ? SS_STSCHG : 0; - else { - if (state.bvd1 == 0) - *status |= SS_BATDEAD; - else if (state.bvd2 == 0) - *status |= SS_BATWARN; - } - - *status |= state.vs_3v ? SS_3VCARD : 0; - - *status |= state.vs_Xv ? SS_XVCARD : 0; - - DEBUG(2, "\tstatus: %s%s%s%s%s%s%s%s\n", - (*status&SS_DETECT)?"DETECT ":"", - (*status&SS_READY)?"READY ":"", - (*status&SS_BATDEAD)?"BATDEAD ":"", - (*status&SS_BATWARN)?"BATWARN ":"", - (*status&SS_POWERON)?"POWERON ":"", - (*status&SS_STSCHG)?"STSCHG ":"", - (*status&SS_3VCARD)?"3VCARD ":"", - (*status&SS_XVCARD)?"XVCARD ":""); - - return 0; -} - - -/* - * bcm47xx_pcmcia_get_socket() - * - * Implements the get_socket() operation for the in-kernel PCMCIA - * service (formerly SS_GetSocket in Card Services). Not a very - * exciting routine. - * - * Returns: 0 - */ -static int -bcm47xx_pcmcia_get_socket(unsigned int sock, socket_state_t *state) -{ - DEBUG(2, "%s() for sock %u\n", __FUNCTION__, sock); - - /* This information was given to us in an earlier call to set_socket(), - * so we're just regurgitating it here: - */ - *state = pcmcia_socket[sock].cs_state; - return 0; -} - - -/* - * bcm47xx_pcmcia_set_socket() - * - * Implements the set_socket() operation for the in-kernel PCMCIA - * service (formerly SS_SetSocket in Card Services). We more or - * less punt all of this work and let the kernel handle the details - * of power configuration, reset, &c. We also record the value of - * `state' in order to regurgitate it to the PCMCIA core later. - * - * Returns: 0 - */ -static int -bcm47xx_pcmcia_set_socket(unsigned int sock, socket_state_t *state) -{ - struct pcmcia_configure configure; - - DEBUG(2, "\tmask: %s%s%s%s%s%s\n\tflags: %s%s%s%s%s%s\n" - "\tVcc %d Vpp %d irq %d\n", - (state->csc_mask == 0) ? "" : "", - (state->csc_mask & SS_DETECT) ? "DETECT " : "", - (state->csc_mask & SS_READY) ? "READY " : "", - (state->csc_mask & SS_BATDEAD) ? "BATDEAD " : "", - (state->csc_mask & SS_BATWARN) ? "BATWARN " : "", - (state->csc_mask & SS_STSCHG) ? "STSCHG " : "", - (state->flags == 0) ? "" : "", - (state->flags & SS_PWR_AUTO) ? "PWR_AUTO " : "", - (state->flags & SS_IOCARD) ? "IOCARD " : "", - (state->flags & SS_RESET) ? "RESET " : "", - (state->flags & SS_SPKR_ENA) ? "SPKR_ENA " : "", - (state->flags & SS_OUTPUT_ENA) ? "OUTPUT_ENA " : "", - state->Vcc, state->Vpp, state->io_irq); - - configure.sock = sock; - configure.vcc = state->Vcc; - configure.vpp = state->Vpp; - configure.output = (state->flags & SS_OUTPUT_ENA) ? 1 : 0; - configure.speaker = (state->flags & SS_SPKR_ENA) ? 1 : 0; - configure.reset = (state->flags & SS_RESET) ? 1 : 0; - - if (pcmcia_low_level->configure_socket(&configure) < 0) { - printk(KERN_ERR "Unable to configure socket %u\n", sock); - return -1; - } - - pcmcia_socket[sock].cs_state = *state; - return 0; -} - - -/* - * bcm47xx_pcmcia_get_io_map() - * - * Implements the get_io_map() operation for the in-kernel PCMCIA - * service (formerly SS_GetIOMap in Card Services). Just returns an - * I/O map descriptor which was assigned earlier by a set_io_map(). - * - * Returns: 0 on success, -1 if the map index was out of range - */ -static int -bcm47xx_pcmcia_get_io_map(unsigned int sock, struct pccard_io_map *map) -{ - DEBUG(2, "bcm47xx_pcmcia_get_io_map: sock %d\n", sock); - - if (map->map >= MAX_IO_WIN) { - printk(KERN_ERR "%s(): map (%d) out of range\n", - __FUNCTION__, map->map); - return -1; - } - - *map = pcmcia_socket[sock].io_map[map->map]; - return 0; -} - - -/* - * bcm47xx_pcmcia_set_io_map() - * - * Implements the set_io_map() operation for the in-kernel PCMCIA - * service (formerly SS_SetIOMap in Card Services). We configure - * the map speed as requested, but override the address ranges - * supplied by Card Services. - * - * Returns: 0 on success, -1 on error - */ -int -bcm47xx_pcmcia_set_io_map(unsigned int sock, struct pccard_io_map *map) -{ - unsigned int speed; - unsigned long start; - - DEBUG(2, "\tmap %u speed %u\n\tstart 0x%08lx stop 0x%08lx\n" - "\tflags: %s%s%s%s%s%s%s%s\n", - map->map, map->speed, map->start, map->stop, - (map->flags == 0) ? "" : "", - (map->flags & MAP_ACTIVE) ? "ACTIVE " : "", - (map->flags & MAP_16BIT) ? "16BIT " : "", - (map->flags & MAP_AUTOSZ) ? "AUTOSZ " : "", - (map->flags & MAP_0WS) ? "0WS " : "", - (map->flags & MAP_WRPROT) ? "WRPROT " : "", - (map->flags & MAP_USE_WAIT) ? "USE_WAIT " : "", - (map->flags & MAP_PREFETCH) ? "PREFETCH " : ""); - - if (map->map >= MAX_IO_WIN) { - printk(KERN_ERR "%s(): map (%d) out of range\n", - __FUNCTION__, map->map); - return -1; - } - - if (map->flags & MAP_ACTIVE) { - speed = (map->speed > 0) ? map->speed : BCM47XX_PCMCIA_IO_SPEED; - pcmcia_socket[sock].speed_io = speed; - } - - start = map->start; - - if (map->stop == 1) { - map->stop = PAGE_SIZE - 1; - } - - map->start = pcmcia_socket[sock].virt_io; - map->stop = map->start + (map->stop - start); - pcmcia_socket[sock].io_map[map->map] = *map; - DEBUG(2, "set_io_map %d start %x stop %x\n", - map->map, map->start, map->stop); - return 0; -} - - -/* - * bcm47xx_pcmcia_get_mem_map() - * - * Implements the get_mem_map() operation for the in-kernel PCMCIA - * service (formerly SS_GetMemMap in Card Services). Just returns a - * memory map descriptor which was assigned earlier by a - * set_mem_map() request. - * - * Returns: 0 on success, -1 if the map index was out of range - */ -static int -bcm47xx_pcmcia_get_mem_map(unsigned int sock, struct pccard_mem_map *map) -{ - DEBUG(2, "%s() for sock %u\n", __FUNCTION__, sock); - - if (map->map >= MAX_WIN) { - printk(KERN_ERR "%s(): map (%d) out of range\n", - __FUNCTION__, map->map); - return -1; - } - - *map = pcmcia_socket[sock].mem_map[map->map]; - return 0; -} - - -/* - * bcm47xx_pcmcia_set_mem_map() - * - * Implements the set_mem_map() operation for the in-kernel PCMCIA - * service (formerly SS_SetMemMap in Card Services). We configure - * the map speed as requested, but override the address ranges - * supplied by Card Services. - * - * Returns: 0 on success, -1 on error - */ -static int -bcm47xx_pcmcia_set_mem_map(unsigned int sock, struct pccard_mem_map *map) -{ - unsigned int speed; - unsigned long start; - u_long flags; - - if (map->map >= MAX_WIN) { - printk(KERN_ERR "%s(): map (%d) out of range\n", - __FUNCTION__, map->map); - return -1; - } - - DEBUG(2, "\tmap %u speed %u\n\tsys_start %#lx\n" - "\tsys_stop %#lx\n\tcard_start %#x\n" - "\tflags: %s%s%s%s%s%s%s%s\n", - map->map, map->speed, map->sys_start, map->sys_stop, - map->card_start, (map->flags == 0) ? "" : "", - (map->flags & MAP_ACTIVE) ? "ACTIVE " : "", - (map->flags & MAP_16BIT) ? "16BIT " : "", - (map->flags & MAP_AUTOSZ) ? "AUTOSZ " : "", - (map->flags & MAP_0WS) ? "0WS " : "", - (map->flags & MAP_WRPROT) ? "WRPROT " : "", - (map->flags & MAP_ATTRIB) ? "ATTRIB " : "", - (map->flags & MAP_USE_WAIT) ? "USE_WAIT " : ""); - - if (map->flags & MAP_ACTIVE) { - /* When clients issue RequestMap, the access speed is not always - * properly configured: - */ - speed = (map->speed > 0) ? map->speed : BCM47XX_PCMCIA_MEM_SPEED; - - /* TBD */ - if (map->flags & MAP_ATTRIB) { - pcmcia_socket[sock].speed_attr = speed; - } else { - pcmcia_socket[sock].speed_mem = speed; - } - } - - save_flags(flags); - cli(); - start = map->sys_start; - - if (map->sys_stop == 0) - map->sys_stop = PAGE_SIZE - 1; - - if (map->flags & MAP_ATTRIB) { - map->sys_start = pcmcia_socket[sock].phys_attr + - map->card_start; - } else { - map->sys_start = pcmcia_socket[sock].phys_mem + - map->card_start; - } - - map->sys_stop = map->sys_start + (map->sys_stop - start); - pcmcia_socket[sock].mem_map[map->map] = *map; - restore_flags(flags); - DEBUG(2, "set_mem_map %d start %x stop %x card_start %x\n", - map->map, map->sys_start, map->sys_stop, - map->card_start); - return 0; -} - - -#if defined(CONFIG_PROC_FS) - -/* - * bcm47xx_pcmcia_proc_setup() - * - * Implements the proc_setup() operation for the in-kernel PCMCIA - * service (formerly SS_ProcSetup in Card Services). - * - * Returns: 0 on success, -1 on error - */ -static void -bcm47xx_pcmcia_proc_setup(unsigned int sock, struct proc_dir_entry *base) -{ - struct proc_dir_entry *entry; - - if ((entry = create_proc_entry("status", 0, base)) == NULL) { - printk(KERN_ERR "Unable to install \"status\" procfs entry\n"); - return; - } - - entry->read_proc = bcm47xx_pcmcia_proc_status; - entry->data = (void *)sock; -} - - -/* - * bcm47xx_pcmcia_proc_status() - * - * Implements the /proc/bus/pccard/??/status file. - * - * Returns: the number of characters added to the buffer - */ -static int -bcm47xx_pcmcia_proc_status(char *buf, char **start, off_t pos, - int count, int *eof, void *data) -{ - char *p = buf; - unsigned int sock = (unsigned int)data; - - p += sprintf(p, "k_flags : %s%s%s%s%s%s%s\n", - pcmcia_socket[sock].k_state.detect ? "detect " : "", - pcmcia_socket[sock].k_state.ready ? "ready " : "", - pcmcia_socket[sock].k_state.bvd1 ? "bvd1 " : "", - pcmcia_socket[sock].k_state.bvd2 ? "bvd2 " : "", - pcmcia_socket[sock].k_state.wrprot ? "wrprot " : "", - pcmcia_socket[sock].k_state.vs_3v ? "vs_3v " : "", - pcmcia_socket[sock].k_state.vs_Xv ? "vs_Xv " : ""); - - p += sprintf(p, "status : %s%s%s%s%s%s%s%s%s\n", - pcmcia_socket[sock].k_state.detect ? "SS_DETECT " : "", - pcmcia_socket[sock].k_state.ready ? "SS_READY " : "", - pcmcia_socket[sock].cs_state.Vcc ? "SS_POWERON " : "", - pcmcia_socket[sock].cs_state.flags & SS_IOCARD ? "SS_IOCARD " : "", - (pcmcia_socket[sock].cs_state.flags & SS_IOCARD && - pcmcia_socket[sock].k_state.bvd1) ? "SS_STSCHG " : "", - ((pcmcia_socket[sock].cs_state.flags & SS_IOCARD) == 0 && - (pcmcia_socket[sock].k_state.bvd1 == 0)) ? "SS_BATDEAD " : "", - ((pcmcia_socket[sock].cs_state.flags & SS_IOCARD) == 0 && - (pcmcia_socket[sock].k_state.bvd2 == 0)) ? "SS_BATWARN " : "", - pcmcia_socket[sock].k_state.vs_3v ? "SS_3VCARD " : "", - pcmcia_socket[sock].k_state.vs_Xv ? "SS_XVCARD " : ""); - - p += sprintf(p, "mask : %s%s%s%s%s\n", - pcmcia_socket[sock].cs_state.csc_mask & SS_DETECT ? "SS_DETECT " : "", - pcmcia_socket[sock].cs_state.csc_mask & SS_READY ? "SS_READY " : "", - pcmcia_socket[sock].cs_state.csc_mask & SS_BATDEAD ? "SS_BATDEAD " : "", - pcmcia_socket[sock].cs_state.csc_mask & SS_BATWARN ? "SS_BATWARN " : "", - pcmcia_socket[sock].cs_state.csc_mask & SS_STSCHG ? "SS_STSCHG " : ""); - - p += sprintf(p, "cs_flags : %s%s%s%s%s\n", - pcmcia_socket[sock].cs_state.flags & SS_PWR_AUTO ? - "SS_PWR_AUTO " : "", - pcmcia_socket[sock].cs_state.flags & SS_IOCARD ? - "SS_IOCARD " : "", - pcmcia_socket[sock].cs_state.flags & SS_RESET ? - "SS_RESET " : "", - pcmcia_socket[sock].cs_state.flags & SS_SPKR_ENA ? - "SS_SPKR_ENA " : "", - pcmcia_socket[sock].cs_state.flags & SS_OUTPUT_ENA ? - "SS_OUTPUT_ENA " : ""); - - p += sprintf(p, "Vcc : %d\n", pcmcia_socket[sock].cs_state.Vcc); - p += sprintf(p, "Vpp : %d\n", pcmcia_socket[sock].cs_state.Vpp); - p += sprintf(p, "irq : %d\n", pcmcia_socket[sock].cs_state.io_irq); - p += sprintf(p, "I/O : %u\n", pcmcia_socket[sock].speed_io); - p += sprintf(p, "attribute: %u\n", pcmcia_socket[sock].speed_attr); - p += sprintf(p, "common : %u\n", pcmcia_socket[sock].speed_mem); - return p-buf; -} - - -#endif /* defined(CONFIG_PROC_FS) */ diff --git a/openwrt/package/linux/kernel-source/drivers/pcmcia/bcm4710_pcmcia.c b/openwrt/package/linux/kernel-source/drivers/pcmcia/bcm4710_pcmcia.c deleted file mode 100644 index 6e3da040c8..0000000000 --- a/openwrt/package/linux/kernel-source/drivers/pcmcia/bcm4710_pcmcia.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - * BCM4710 specific pcmcia routines. - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include "cs_internal.h" - -#include -#include -#include - - -#include -#include -#include -#include -#include - -#include "bcm4710pcmcia.h" - -/* Use a static var for irq dev_id */ -static int bcm47xx_pcmcia_dev_id; - -/* Do we think we have a card or not? */ -static int bcm47xx_pcmcia_present = 0; - - -static void bcm4710_pcmcia_reset(void) -{ - extifregs_t *eir; - unsigned long s; - uint32 out0, out1, outen; - - - eir = (extifregs_t *) ioremap_nocache(BCM4710_REG_EXTIF, sizeof(extifregs_t)); - - save_and_cli(s); - - /* Use gpio7 to reset the pcmcia slot */ - outen = readl(&eir->gpio[0].outen); - outen |= BCM47XX_PCMCIA_RESET; - out0 = readl(&eir->gpio[0].out); - out0 &= ~(BCM47XX_PCMCIA_RESET); - out1 = out0 | BCM47XX_PCMCIA_RESET; - - writel(out0, &eir->gpio[0].out); - writel(outen, &eir->gpio[0].outen); - mdelay(1); - writel(out1, &eir->gpio[0].out); - mdelay(1); - writel(out0, &eir->gpio[0].out); - - restore_flags(s); -} - - -static int bcm4710_pcmcia_init(struct pcmcia_init *init) -{ - struct pci_dev *pdev; - extifregs_t *eir; - uint32 outen, intp, intm, tmp; - uint16 *attrsp; - int rc = 0, i; - extern unsigned long bcm4710_cpu_cycle; - - - if (!(pdev = pci_find_device(VENDOR_BROADCOM, SB_EXTIF, NULL))) { - printk(KERN_ERR "bcm4710_pcmcia: extif not found\n"); - return -ENODEV; - } - eir = (extifregs_t *) ioremap_nocache(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0)); - - /* Initialize the pcmcia i/f: 16bit no swap */ - writel(CF_EM_PCMCIA | CF_DS | CF_EN, &eir->pcmcia_config); - -#ifdef notYet - - /* Set the timing for memory accesses */ - tmp = (19 / bcm4710_cpu_cycle) << 24; /* W3 = 10nS */ - tmp = tmp | ((29 / bcm4710_cpu_cycle) << 16); /* W2 = 20nS */ - tmp = tmp | ((109 / bcm4710_cpu_cycle) << 8); /* W1 = 100nS */ - tmp = tmp | (129 / bcm4710_cpu_cycle); /* W0 = 120nS */ - writel(tmp, &eir->pcmcia_memwait); /* 0x01020a0c for a 100Mhz clock */ - - /* Set the timing for I/O accesses */ - tmp = (19 / bcm4710_cpu_cycle) << 24; /* W3 = 10nS */ - tmp = tmp | ((29 / bcm4710_cpu_cycle) << 16); /* W2 = 20nS */ - tmp = tmp | ((109 / bcm4710_cpu_cycle) << 8); /* W1 = 100nS */ - tmp = tmp | (129 / bcm4710_cpu_cycle); /* W0 = 120nS */ - writel(tmp, &eir->pcmcia_iowait); /* 0x01020a0c for a 100Mhz clock */ - - /* Set the timing for attribute accesses */ - tmp = (19 / bcm4710_cpu_cycle) << 24; /* W3 = 10nS */ - tmp = tmp | ((29 / bcm4710_cpu_cycle) << 16); /* W2 = 20nS */ - tmp = tmp | ((109 / bcm4710_cpu_cycle) << 8); /* W1 = 100nS */ - tmp = tmp | (129 / bcm4710_cpu_cycle); /* W0 = 120nS */ - writel(tmp, &eir->pcmcia_attrwait); /* 0x01020a0c for a 100Mhz clock */ - -#endif - /* Make sure gpio0 and gpio5 are inputs */ - outen = readl(&eir->gpio[0].outen); - outen &= ~(BCM47XX_PCMCIA_WP | BCM47XX_PCMCIA_STSCHG | BCM47XX_PCMCIA_RESET); - writel(outen, &eir->gpio[0].outen); - - /* Issue a reset to the pcmcia socket */ - bcm4710_pcmcia_reset(); - -#ifdef DO_BCM47XX_PCMCIA_INTERRUPTS - /* Setup gpio5 to be the STSCHG interrupt */ - intp = readl(&eir->gpiointpolarity); - writel(intp | BCM47XX_PCMCIA_STSCHG, &eir->gpiointpolarity); /* Active low */ - intm = readl(&eir->gpiointmask); - writel(intm | BCM47XX_PCMCIA_STSCHG, &eir->gpiointmask); /* Enable it */ -#endif - - DEBUG(2, "bcm4710_pcmcia after reset:\n"); - DEBUG(2, "\textstatus\t= 0x%08x:\n", readl(&eir->extstatus)); - DEBUG(2, "\tpcmcia_config\t= 0x%08x:\n", readl(&eir->pcmcia_config)); - DEBUG(2, "\tpcmcia_memwait\t= 0x%08x:\n", readl(&eir->pcmcia_memwait)); - DEBUG(2, "\tpcmcia_attrwait\t= 0x%08x:\n", readl(&eir->pcmcia_attrwait)); - DEBUG(2, "\tpcmcia_iowait\t= 0x%08x:\n", readl(&eir->pcmcia_iowait)); - DEBUG(2, "\tgpioin\t\t= 0x%08x:\n", readl(&eir->gpioin)); - DEBUG(2, "\tgpio_outen0\t= 0x%08x:\n", readl(&eir->gpio[0].outen)); - DEBUG(2, "\tgpio_out0\t= 0x%08x:\n", readl(&eir->gpio[0].out)); - DEBUG(2, "\tgpiointpolarity\t= 0x%08x:\n", readl(&eir->gpiointpolarity)); - DEBUG(2, "\tgpiointmask\t= 0x%08x:\n", readl(&eir->gpiointmask)); - -#ifdef DO_BCM47XX_PCMCIA_INTERRUPTS - /* Request pcmcia interrupt */ - rc = request_irq(BCM47XX_PCMCIA_IRQ, init->handler, SA_INTERRUPT, - "PCMCIA Interrupt", &bcm47xx_pcmcia_dev_id); -#endif - - attrsp = (uint16 *)ioremap_nocache(EXTIF_PCMCIA_CFGBASE(BCM4710_EXTIF), 0x1000); - tmp = readw(&attrsp[0]); - DEBUG(2, "\tattr[0] = 0x%04x\n", tmp); - if ((tmp == 0x7fff) || (tmp == 0x7f00)) { - bcm47xx_pcmcia_present = 0; - } else { - bcm47xx_pcmcia_present = 1; - } - - /* There's only one socket */ - return 1; -} - -static int bcm4710_pcmcia_shutdown(void) -{ - extifregs_t *eir; - uint32 intm; - - eir = (extifregs_t *) ioremap_nocache(BCM4710_REG_EXTIF, sizeof(extifregs_t)); - - /* Disable the pcmcia i/f */ - writel(0, &eir->pcmcia_config); - - /* Reset gpio's */ - intm = readl(&eir->gpiointmask); - writel(intm & ~BCM47XX_PCMCIA_STSCHG, &eir->gpiointmask); /* Disable it */ - - free_irq(BCM47XX_PCMCIA_IRQ, &bcm47xx_pcmcia_dev_id); - - return 0; -} - -static int -bcm4710_pcmcia_socket_state(unsigned sock, struct pcmcia_state *state) -{ - extifregs_t *eir; - - eir = (extifregs_t *) ioremap_nocache(BCM4710_REG_EXTIF, sizeof(extifregs_t)); - - - if (sock != 0) { - printk(KERN_ERR "bcm4710 socket_state bad sock %d\n", sock); - return -1; - } - - if (bcm47xx_pcmcia_present) { - state->detect = 1; - state->ready = 1; - state->bvd1 = 1; - state->bvd2 = 1; - state->wrprot = (readl(&eir->gpioin) & BCM47XX_PCMCIA_WP) == BCM47XX_PCMCIA_WP; - state->vs_3v = 0; - state->vs_Xv = 0; - } else { - state->detect = 0; - state->ready = 0; - } - - return 1; -} - - -static int bcm4710_pcmcia_get_irq_info(struct pcmcia_irq_info *info) -{ - if (info->sock >= BCM47XX_PCMCIA_MAX_SOCK) return -1; - - info->irq = BCM47XX_PCMCIA_IRQ; - - return 0; -} - - -static int -bcm4710_pcmcia_configure_socket(const struct pcmcia_configure *configure) -{ - if (configure->sock >= BCM47XX_PCMCIA_MAX_SOCK) return -1; - - - DEBUG(2, "Vcc %dV Vpp %dV output %d speaker %d reset %d\n", configure->vcc, - configure->vpp, configure->output, configure->speaker, configure->reset); - - if ((configure->vcc != 50) || (configure->vpp != 50)) { - printk("%s: bad Vcc/Vpp (%d:%d)\n", __FUNCTION__, configure->vcc, - configure->vpp); - } - - if (configure->reset) { - /* Issue a reset to the pcmcia socket */ - DEBUG(1, "%s: Reseting socket\n", __FUNCTION__); - bcm4710_pcmcia_reset(); - } - - - return 0; -} - -struct pcmcia_low_level bcm4710_pcmcia_ops = { - bcm4710_pcmcia_init, - bcm4710_pcmcia_shutdown, - bcm4710_pcmcia_socket_state, - bcm4710_pcmcia_get_irq_info, - bcm4710_pcmcia_configure_socket -}; - diff --git a/openwrt/package/linux/kernel-source/drivers/pcmcia/bcm4710pcmcia.h b/openwrt/package/linux/kernel-source/drivers/pcmcia/bcm4710pcmcia.h deleted file mode 100644 index 42a7463bd7..0000000000 --- a/openwrt/package/linux/kernel-source/drivers/pcmcia/bcm4710pcmcia.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * - * bcm47xx pcmcia driver - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * Based on sa1100.h and include/asm-arm/arch-sa1100/pcmica.h - * from www.handhelds.org, - * and au1000_generic.c from oss.sgi.com. - * - * $Id$ - */ - -#if !defined(_BCM4710PCMCIA_H) -#define _BCM4710PCMCIA_H - -#include -#include -#include -#include -#include "cs_internal.h" - - -/* The 47xx can only support one socket */ -#define BCM47XX_PCMCIA_MAX_SOCK 1 - -/* In the bcm947xx gpio's are used for some pcmcia functions */ -#define BCM47XX_PCMCIA_WP 0x01 /* Bit 0 is WP input */ -#define BCM47XX_PCMCIA_STSCHG 0x20 /* Bit 5 is STSCHG input/interrupt */ -#define BCM47XX_PCMCIA_RESET 0x80 /* Bit 7 is RESET */ - -#define BCM47XX_PCMCIA_IRQ 2 - -/* The socket driver actually works nicely in interrupt-driven form, - * so the (relatively infrequent) polling is "just to be sure." - */ -#define BCM47XX_PCMCIA_POLL_PERIOD (2 * HZ) - -#define BCM47XX_PCMCIA_IO_SPEED (255) -#define BCM47XX_PCMCIA_MEM_SPEED (300) - - -struct pcmcia_state { - unsigned detect: 1, - ready: 1, - bvd1: 1, - bvd2: 1, - wrprot: 1, - vs_3v: 1, - vs_Xv: 1; -}; - - -struct pcmcia_configure { - unsigned sock: 8, - vcc: 8, - vpp: 8, - output: 1, - speaker: 1, - reset: 1; -}; - -struct pcmcia_irq_info { - unsigned int sock; - unsigned int irq; -}; - -/* This structure encapsulates per-socket state which we might need to - * use when responding to a Card Services query of some kind. - */ -struct bcm47xx_pcmcia_socket { - socket_state_t cs_state; - struct pcmcia_state k_state; - unsigned int irq; - void (*handler)(void *, unsigned int); - void *handler_info; - pccard_io_map io_map[MAX_IO_WIN]; - pccard_mem_map mem_map[MAX_WIN]; - ioaddr_t virt_io, phys_attr, phys_mem; - unsigned short speed_io, speed_attr, speed_mem; -}; - -struct pcmcia_init { - void (*handler)(int irq, void *dev, struct pt_regs *regs); -}; - -struct pcmcia_low_level { - int (*init)(struct pcmcia_init *); - int (*shutdown)(void); - int (*socket_state)(unsigned sock, struct pcmcia_state *); - int (*get_irq_info)(struct pcmcia_irq_info *); - int (*configure_socket)(const struct pcmcia_configure *); -}; - -extern struct pcmcia_low_level bcm47xx_pcmcia_ops; - -/* I/O pins replacing memory pins - * (PCMCIA System Architecture, 2nd ed., by Don Anderson, p.75) - * - * These signals change meaning when going from memory-only to - * memory-or-I/O interface: - */ -#define iostschg bvd1 -#define iospkr bvd2 - - -/* - * Declaration for implementation specific low_level operations. - */ -extern struct pcmcia_low_level bcm4710_pcmcia_ops; - -#endif /* !defined(_BCM4710PCMCIA_H) */ diff --git a/openwrt/package/linux/kernel-source/include/bcm4710.h b/openwrt/package/linux/kernel-source/include/bcm4710.h deleted file mode 100644 index 8b059978b4..0000000000 --- a/openwrt/package/linux/kernel-source/include/bcm4710.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * BCM4710 address space map and definitions - * Think twice before adding to this file, this is not the kitchen sink - * These definitions are not guaranteed for all 47xx chips, only the 4710 - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#ifndef _bcm4710_h_ -#define _bcm4710_h_ - -/* Address map */ -#define BCM4710_SDRAM 0x00000000 /* Physical SDRAM */ -#define BCM4710_PCI_MEM 0x08000000 /* Host Mode PCI memory access space (64 MB) */ -#define BCM4710_PCI_CFG 0x0c000000 /* Host Mode PCI configuration space (64 MB) */ -#define BCM4710_PCI_DMA 0x40000000 /* Client Mode PCI memory access space (1 GB) */ -#define BCM4710_SDRAM_SWAPPED 0x10000000 /* Byteswapped Physical SDRAM */ -#define BCM4710_ENUM 0x18000000 /* Beginning of core enumeration space */ - -/* Core register space */ -#define BCM4710_REG_SDRAM 0x18000000 /* SDRAM core registers */ -#define BCM4710_REG_ILINE20 0x18001000 /* InsideLine20 core registers */ -#define BCM4710_REG_EMAC0 0x18002000 /* Ethernet MAC 0 core registers */ -#define BCM4710_REG_CODEC 0x18003000 /* Codec core registers */ -#define BCM4710_REG_USB 0x18004000 /* USB core registers */ -#define BCM4710_REG_PCI 0x18005000 /* PCI core registers */ -#define BCM4710_REG_MIPS 0x18006000 /* MIPS core registers */ -#define BCM4710_REG_EXTIF 0x18007000 /* External Interface core registers */ -#define BCM4710_REG_EMAC1 0x18008000 /* Ethernet MAC 1 core registers */ - -#define BCM4710_EXTIF 0x1f000000 /* External Interface base address */ -#define BCM4710_PCMCIA_MEM 0x1f000000 /* External Interface PCMCIA memory access */ -#define BCM4710_PCMCIA_IO 0x1f100000 /* PCMCIA I/O access */ -#define BCM4710_PCMCIA_CONF 0x1f200000 /* PCMCIA configuration */ -#define BCM4710_PROG 0x1f800000 /* Programable interface */ -#define BCM4710_FLASH 0x1fc00000 /* Flash */ - -#define BCM4710_EJTAG 0xff200000 /* MIPS EJTAG space (2M) */ - -#define BCM4710_UART (BCM4710_REG_EXTIF + 0x00000300) - -#define BCM4710_EUART (BCM4710_EXTIF + 0x00800000) -#define BCM4710_LED (BCM4710_EXTIF + 0x00900000) - -#define SBFLAG_PCI 0 -#define SBFLAG_ENET0 1 -#define SBFLAG_ILINE20 2 -#define SBFLAG_CODEC 3 -#define SBFLAG_USB 4 -#define SBFLAG_EXTIF 5 -#define SBFLAG_ENET1 6 - -#ifdef CONFIG_HWSIM -#define BCM4710_TRACE(trval) do { *((int *)0xa0000f18) = (trval); } while (0) -#else -#define BCM4710_TRACE(trval) -#endif - - -/* BCM94702 CPCI -ExtIF used for LocalBus devs */ - -#define BCM94702_CPCI_RESET_ADDR BCM4710_EXTIF -#define BCM94702_CPCI_BOARDID_ADDR (BCM4710_EXTIF | 0x4000) -#define BCM94702_CPCI_DOC_ADDR (BCM4710_EXTIF | 0x6000) -#define BCM94702_DOC_ADDR BCM94702_CPCI_DOC_ADDR -#define BCM94702_CPCI_LED_ADDR (BCM4710_EXTIF | 0xc000) -#define BCM94702_CPCI_NVRAM_ADDR (BCM4710_EXTIF | 0xe000) -#define BCM94702_CPCI_NVRAM_SIZE 0x1ff0 /* 8K NVRAM : DS1743/STM48txx*/ -#define BCM94702_CPCI_TOD_REG_BASE (BCM94702_CPCI_NVRAM_ADDR | 0x1ff0) - -#define LED_REG(x) \ - (*(volatile unsigned char *) (KSEG1ADDR(BCM94702_CPCI_LED_ADDR) + (x))) - -/* - * Reset function implemented in PLD. Read or write should trigger hard reset - */ -#define SYS_HARD_RESET() \ - { for (;;) \ - *( (volatile unsigned char *)\ - KSEG1ADDR(BCM94702_CPCI_RESET_ADDR) ) = 0x80; \ - } - -#endif /* _bcm4710_h_ */ diff --git a/openwrt/package/linux/kernel-source/include/bcmdevs.h b/openwrt/package/linux/kernel-source/include/bcmdevs.h deleted file mode 100644 index 92590287cd..0000000000 --- a/openwrt/package/linux/kernel-source/include/bcmdevs.h +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Broadcom device-specific manifest constants. - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * $Id$ - */ - -#ifndef _BCMDEVS_H -#define _BCMDEVS_H - - -/* Known PCI vendor Id's */ -#define VENDOR_EPIGRAM 0xfeda -#define VENDOR_BROADCOM 0x14e4 -#define VENDOR_3COM 0x10b7 -#define VENDOR_NETGEAR 0x1385 -#define VENDOR_DIAMOND 0x1092 -#define VENDOR_DELL 0x1028 -#define VENDOR_HP 0x0e11 -#define VENDOR_APPLE 0x106b - -/* PCI Device Id's */ -#define BCM4210_DEVICE_ID 0x1072 /* never used */ -#define BCM4211_DEVICE_ID 0x4211 -#define BCM4230_DEVICE_ID 0x1086 /* never used */ -#define BCM4231_DEVICE_ID 0x4231 - -#define BCM4410_DEVICE_ID 0x4410 /* bcm44xx family pci iline */ -#define BCM4430_DEVICE_ID 0x4430 /* bcm44xx family cardbus iline */ -#define BCM4412_DEVICE_ID 0x4412 /* bcm44xx family pci enet */ -#define BCM4432_DEVICE_ID 0x4432 /* bcm44xx family cardbus enet */ - -#define BCM3352_DEVICE_ID 0x3352 /* bcm3352 device id */ -#define BCM3360_DEVICE_ID 0x3360 /* bcm3360 device id */ - -#define EPI41210_DEVICE_ID 0xa0fa /* bcm4210 */ -#define EPI41230_DEVICE_ID 0xa10e /* bcm4230 */ - -#define BCM47XX_ILINE_ID 0x4711 /* 47xx iline20 */ -#define BCM47XX_V90_ID 0x4712 /* 47xx v90 codec */ -#define BCM47XX_ENET_ID 0x4713 /* 47xx enet */ -#define BCM47XX_EXT_ID 0x4714 /* 47xx external i/f */ -#define BCM47XX_USB_ID 0x4715 /* 47xx usb */ -#define BCM47XX_USBH_ID 0x4716 /* 47xx usb host */ -#define BCM47XX_USBD_ID 0x4717 /* 47xx usb device */ -#define BCM47XX_IPSEC_ID 0x4718 /* 47xx ipsec */ - -#define BCM4710_DEVICE_ID 0x4710 /* 4710 primary function 0 */ - -#define BCM4610_DEVICE_ID 0x4610 /* 4610 primary function 0 */ -#define BCM4610_ILINE_ID 0x4611 /* 4610 iline100 */ -#define BCM4610_V90_ID 0x4612 /* 4610 v90 codec */ -#define BCM4610_ENET_ID 0x4613 /* 4610 enet */ -#define BCM4610_EXT_ID 0x4614 /* 4610 external i/f */ -#define BCM4610_USB_ID 0x4615 /* 4610 usb */ - -#define BCM4402_DEVICE_ID 0x4402 /* 4402 primary function 0 */ -#define BCM4402_ENET_ID 0x4402 /* 4402 enet */ -#define BCM4402_V90_ID 0x4403 /* 4402 v90 codec */ - -#define BCM4301_DEVICE_ID 0x4301 /* 4301 primary function 0 */ -#define BCM4301_D11B_ID 0x4301 /* 4301 802.11b */ - -#define BCM4307_DEVICE_ID 0x4307 /* 4307 primary function 0 */ -#define BCM4307_V90_ID 0x4305 /* 4307 v90 codec */ -#define BCM4307_ENET_ID 0x4306 /* 4307 enet */ -#define BCM4307_D11B_ID 0x4307 /* 4307 802.11b */ - -#define BCM4306_DEVICE_ID 0x4306 /* 4306 chipcommon chipid */ -#define BCM4306_D11G_ID 0x4320 /* 4306 802.11g */ -#define BCM4306_D11G_ID2 0x4325 -#define BCM4306_D11A_ID 0x4321 /* 4306 802.11a */ -#define BCM4306_UART_ID 0x4322 /* 4306 uart */ -#define BCM4306_V90_ID 0x4323 /* 4306 v90 codec */ -#define BCM4306_D11DUAL_ID 0x4324 /* 4306 dual A+B */ - -#define BCM4309_PKG_ID 1 /* 4309 package id */ - -#define BCM4303_D11B_ID 0x4303 /* 4303 802.11b */ -#define BCM4303_PKG_ID 2 /* 4303 package id */ - -#define BCM4310_DEVICE_ID 0x4310 /* 4310 chipcommon chipid */ -#define BCM4310_D11B_ID 0x4311 /* 4310 802.11b */ -#define BCM4310_UART_ID 0x4312 /* 4310 uart */ -#define BCM4310_ENET_ID 0x4313 /* 4310 enet */ -#define BCM4310_USB_ID 0x4315 /* 4310 usb */ - -#define BCM4704_DEVICE_ID 0x4704 /* 4704 chipcommon chipid */ -#define BCM4704_ENET_ID 0x4706 /* 4704 enet (Use 47XX_ENET_ID instead!) */ - -#define BCM4317_DEVICE_ID 0x4317 /* 4317 chip common chipid */ - -#define BCM4712_DEVICE_ID 0x4712 /* 4712 chipcommon chipid */ -#define BCM4712_MIPS_ID 0x4720 /* 4712 base devid */ -#define BCM4712LARGE_PKG_ID 0 /* 340pin 4712 package id */ -#define BCM4712SMALL_PKG_ID 1 /* 200pin 4712 package id */ -#define BCM4712MID_PKG_ID 2 /* 225pin 4712 package id */ - -#define SDIOH_FPGA_ID 0x4380 /* sdio host fpga */ - -#define BCM5365_DEVICE_ID 0x5365 /* 5365 chipcommon chipid */ - - -/* PCMCIA vendor Id's */ - -#define VENDOR_BROADCOM_PCMCIA 0x02d0 - -/* SDIO vendor Id's */ -#define VENDOR_BROADCOM_SDIO 0x00BF - - -/* boardflags */ -#define BFL_BTCOEXIST 0x0001 /* This board implements Bluetooth coexistance */ -#define BFL_PACTRL 0x0002 /* This board has gpio 9 controlling the PA */ -#define BFL_AIRLINEMODE 0x0004 /* This board implements gpio13 radio disable indication */ -#define BFL_ENETSPI 0x0010 /* This board has ephy roboswitch spi */ -#define BFL_CCKHIPWR 0x0040 /* Can do high-power CCK transmission */ -#define BFL_ENETADM 0x0080 /* This board has ADMtek switch */ -#define BFL_ENETVLAN 0x0100 /* This board can do vlan */ -#define BFL_AFTERBURNER 0x0200 /* This board supports Afterburner mode */ -#define BFL_NOPCI 0x0400 /* This board leaves PCI floating */ -#define BFL_FEM 0x0800 /* This board supports the Front End Module */ - -/* board specific GPIO assignment, gpio 0-3 are also customer-configurable led */ -#define BOARD_GPIO_HWRAD_B 0x010 /* bit 4 is HWRAD input on 4301 */ -#define BOARD_GPIO_BTC_IN 0x080 /* bit 7 is BT Coexistance Input */ -#define BOARD_GPIO_BTC_OUT 0x100 /* bit 8 is BT Coexistance Out */ -#define BOARD_GPIO_PACTRL 0x200 /* bit 9 controls the PA on new 4306 boards */ -#define PCI_CFG_GPIO_SCS 0x10 /* PCI config space bit 4 for 4306c0 slow clock source */ -#define PCI_CFG_GPIO_HWRAD 0x20 /* PCI config space GPIO 13 for hw radio disable */ -#define PCI_CFG_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */ -#define PCI_CFG_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */ - -/* Bus types */ -#define SB_BUS 0 /* Silicon Backplane */ -#define PCI_BUS 1 /* PCI target */ -#define PCMCIA_BUS 2 /* PCMCIA target */ -#define SDIO_BUS 3 /* SDIO target */ - -/* power control defines */ -#define PLL_DELAY 150 /* 150us pll on delay */ -#define FREF_DELAY 200 /* 200us fref change delay */ -#define MIN_SLOW_CLK 32 /* 32us Slow clock period */ - -/* Reference Board Types */ - -#define BU4710_BOARD 0x0400 -#define VSIM4710_BOARD 0x0401 -#define QT4710_BOARD 0x0402 - -#define BU4610_BOARD 0x0403 -#define VSIM4610_BOARD 0x0404 - -#define BU4307_BOARD 0x0405 -#define BCM94301CB_BOARD 0x0406 -#define BCM94301PC_BOARD 0x0406 /* Pcmcia 5v card */ -#define BCM94301MP_BOARD 0x0407 -#define BCM94307MP_BOARD 0x0408 -#define BCMAP4307_BOARD 0x0409 - -#define BU4309_BOARD 0x040a -#define BCM94309CB_BOARD 0x040b -#define BCM94309MP_BOARD 0x040c -#define BCM4309AP_BOARD 0x040d - -#define BCM94302MP_BOARD 0x040e - -#define VSIM4310_BOARD 0x040f -#define BU4711_BOARD 0x0410 -#define BCM94310U_BOARD 0x0411 -#define BCM94310AP_BOARD 0x0412 -#define BCM94310MP_BOARD 0x0414 - -#define BU4306_BOARD 0x0416 -#define BCM94306CB_BOARD 0x0417 -#define BCM94306MP_BOARD 0x0418 - -#define BCM94710D_BOARD 0x041a -#define BCM94710R1_BOARD 0x041b -#define BCM94710R4_BOARD 0x041c -#define BCM94710AP_BOARD 0x041d - - -#define BU2050_BOARD 0x041f - - -#define BCM94309G_BOARD 0x0421 - -#define BCM94301PC3_BOARD 0x0422 /* Pcmcia 3.3v card */ - -#define BU4704_BOARD 0x0423 -#define BU4702_BOARD 0x0424 - -#define BCM94306PC_BOARD 0x0425 /* pcmcia 3.3v 4306 card */ - -#define BU4317_BOARD 0x0426 - - -#define BCM94702MN_BOARD 0x0428 - -/* BCM4702 1U CompactPCI Board */ -#define BCM94702CPCI_BOARD 0x0429 - -/* BCM4702 with BCM95380 VLAN Router */ -#define BCM95380RR_BOARD 0x042a - -/* cb4306 with SiGe PA */ -#define BCM94306CBSG_BOARD 0x042b - -/* mp4301 with 2050 radio */ -#define BCM94301MPL_BOARD 0x042c - -/* cb4306 with SiGe PA */ -#define PCSG94306_BOARD 0x042d - -/* bu4704 with sdram */ -#define BU4704SD_BOARD 0x042e - -/* Dual 11a/11g Router */ -#define BCM94704AGR_BOARD 0x042f - -/* 11a-only minipci */ -#define BCM94308MP_BOARD 0x0430 - - - -/* BCM94317 boards */ -#define BCM94317CB_BOARD 0x0440 -#define BCM94317MP_BOARD 0x0441 -#define BCM94317PCMCIA_BOARD 0x0442 -#define BCM94317SDIO_BOARD 0x0443 - -#define BU4712_BOARD 0x0444 - -/* BCM4712 boards */ -#define BCM94712AGR_BOARD 0x0445 -#define BCM94712AP_BOARD 0x0446 - -/* BCM4702 boards */ -#define CT4702AP_BOARD 0x0447 - -/* BRCM 4306 w/ Front End Modules */ -#define BCM94306MPM 0x0450 -#define BCM94306MPL 0x0453 - - -#endif /* _BCMDEVS_H */ diff --git a/openwrt/package/linux/kernel-source/include/bcmendian.h b/openwrt/package/linux/kernel-source/include/bcmendian.h deleted file mode 100644 index 6a2ed90f61..0000000000 --- a/openwrt/package/linux/kernel-source/include/bcmendian.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * local version of endian.h - byte order defines - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ -*/ - -#ifndef _BCMENDIAN_H_ -#define _BCMENDIAN_H_ - -#include - -/* Byte swap a 16 bit value */ -#define BCMSWAP16(val) \ - ((uint16)( \ - (((uint16)(val) & (uint16)0x00ffU) << 8) | \ - (((uint16)(val) & (uint16)0xff00U) >> 8) )) - -/* Byte swap a 32 bit value */ -#define BCMSWAP32(val) \ - ((uint32)( \ - (((uint32)(val) & (uint32)0x000000ffUL) << 24) | \ - (((uint32)(val) & (uint32)0x0000ff00UL) << 8) | \ - (((uint32)(val) & (uint32)0x00ff0000UL) >> 8) | \ - (((uint32)(val) & (uint32)0xff000000UL) >> 24) )) - -static INLINE uint16 -bcmswap16(uint16 val) -{ - return BCMSWAP16(val); -} - -static INLINE uint32 -bcmswap32(uint32 val) -{ - return BCMSWAP32(val); -} - -/* buf - start of buffer of shorts to swap */ -/* len - byte length of buffer */ -static INLINE void -bcmswap16_buf(uint16 *buf, uint len) -{ - len = len/2; - - while(len--){ - *buf = bcmswap16(*buf); - buf++; - } -} - -#ifndef hton16 -#ifndef IL_BIGENDIAN -#define HTON16(i) BCMSWAP16(i) -#define hton16(i) bcmswap16(i) -#define hton32(i) bcmswap32(i) -#define ntoh16(i) bcmswap16(i) -#define ntoh32(i) bcmswap32(i) -#define ltoh16(i) (i) -#define ltoh32(i) (i) -#define htol16(i) (i) -#define htol32(i) (i) -#else -#define HTON16(i) (i) -#define hton16(i) (i) -#define hton32(i) (i) -#define ntoh16(i) (i) -#define ntoh32(i) (i) -#define ltoh16(i) bcmswap16(i) -#define ltoh32(i) bcmswap32(i) -#define htol16(i) bcmswap16(i) -#define htol32(i) bcmswap32(i) -#endif -#endif - -#ifndef IL_BIGENDIAN -#define ltoh16_buf(buf, i) -#define htol16_buf(buf, i) -#else -#define ltoh16_buf(buf, i) bcmswap16_buf((uint16*)buf, i) -#define htol16_buf(buf, i) bcmswap16_buf((uint16*)buf, i) -#endif - -/* -* load 16-bit value from unaligned little endian byte array. -*/ -static INLINE uint16 -ltoh16_ua(uint8 *bytes) -{ - return (bytes[1]<<8)+bytes[0]; -} - -/* -* load 32-bit value from unaligned little endian byte array. -*/ -static INLINE uint32 -ltoh32_ua(uint8 *bytes) -{ - return (bytes[3]<<24)+(bytes[2]<<16)+(bytes[1]<<8)+bytes[0]; -} - -/* -* load 16-bit value from unaligned big(network) endian byte array. -*/ -static INLINE uint16 -ntoh16_ua(uint8 *bytes) -{ - return (bytes[0]<<8)+bytes[1]; -} - -/* -* load 32-bit value from unaligned big(network) endian byte array. -*/ -static INLINE uint32 -ntoh32_ua(uint8 *bytes) -{ - return (bytes[0]<<24)+(bytes[1]<<16)+(bytes[2]<<8)+bytes[3]; -} - -#endif /* _BCMENDIAN_H_ */ diff --git a/openwrt/package/linux/kernel-source/include/bcmenet47xx.h b/openwrt/package/linux/kernel-source/include/bcmenet47xx.h deleted file mode 100644 index 22d7ee26d2..0000000000 --- a/openwrt/package/linux/kernel-source/include/bcmenet47xx.h +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Hardware-specific definitions for - * Broadcom BCM47XX 10/100 Mbps Ethernet cores. - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * $Id$ - */ - -#ifndef _bcmenet_47xx_h_ -#define _bcmenet_47xx_h_ - -#include -#include - -#define BCMENET_NFILTERS 64 /* # ethernet address filter entries */ -#define BCMENET_MCHASHBASE 0x200 /* multicast hash filter base address */ -#define BCMENET_MCHASHSIZE 256 /* multicast hash filter size in bytes */ -#define BCMENET_MAX_DMA 4096 /* chip has 12 bits of DMA addressing */ - -/* power management event wakeup pattern constants */ -#define BCMENET_NPMP 4 /* chip supports 4 wakeup patterns */ -#define BCMENET_PMPBASE 0x400 /* wakeup pattern base address */ -#define BCMENET_PMPSIZE 0x80 /* 128bytes each pattern */ -#define BCMENET_PMMBASE 0x600 /* wakeup mask base address */ -#define BCMENET_PMMSIZE 0x10 /* 128bits each mask */ - -/* cpp contortions to concatenate w/arg prescan */ -#ifndef PAD -#define _PADLINE(line) pad ## line -#define _XSTR(line) _PADLINE(line) -#define PAD _XSTR(__LINE__) -#endif /* PAD */ - -/* sometimes you just need the enet mib definitions */ -#include - -/* - * Host Interface Registers - */ -typedef volatile struct _bcmenettregs { - /* Device and Power Control */ - uint32 devcontrol; - uint32 PAD[2]; - uint32 biststatus; - uint32 wakeuplength; - uint32 PAD[3]; - - /* Interrupt Control */ - uint32 intstatus; - uint32 intmask; - uint32 gptimer; - uint32 PAD[23]; - - /* Ethernet MAC Address Filtering Control */ - uint32 PAD[2]; - uint32 enetftaddr; - uint32 enetftdata; - uint32 PAD[2]; - - /* Ethernet MAC Control */ - uint32 emactxmaxburstlen; - uint32 emacrxmaxburstlen; - uint32 emaccontrol; - uint32 emacflowcontrol; - - uint32 PAD[20]; - - /* DMA Lazy Interrupt Control */ - uint32 intrecvlazy; - uint32 PAD[63]; - - /* DMA engine */ - dmaregs_t dmaregs; - dmafifo_t dmafifo; - uint32 PAD[116]; - - /* EMAC Registers */ - uint32 rxconfig; - uint32 rxmaxlength; - uint32 txmaxlength; - uint32 PAD; - uint32 mdiocontrol; - uint32 mdiodata; - uint32 emacintmask; - uint32 emacintstatus; - uint32 camdatalo; - uint32 camdatahi; - uint32 camcontrol; - uint32 enetcontrol; - uint32 txcontrol; - uint32 txwatermark; - uint32 mibcontrol; - uint32 PAD[49]; - - /* EMAC MIB counters */ - bcmenetmib_t mib; - - uint32 PAD[585]; - - /* Sonics SiliconBackplane config registers */ - sbconfig_t sbconfig; -} bcmenetregs_t; - -/* device control */ -#define DC_PM ((uint32)1 << 7) /* pattern filtering enable */ -#define DC_IP ((uint32)1 << 10) /* internal ephy present (rev >= 1) */ -#define DC_ER ((uint32)1 << 15) /* ephy reset */ -#define DC_MP ((uint32)1 << 16) /* mii phy mode enable */ -#define DC_CO ((uint32)1 << 17) /* mii phy mode: enable clocks */ -#define DC_PA_MASK 0x7c0000 /* mii phy mode: mdc/mdio phy address */ -#define DC_PA_SHIFT 18 - -/* wakeup length */ -#define WL_P0_MASK 0x7f /* pattern 0 */ -#define WL_D0 ((uint32)1 << 7) -#define WL_P1_MASK 0x7f00 /* pattern 1 */ -#define WL_P1_SHIFT 8 -#define WL_D1 ((uint32)1 << 15) -#define WL_P2_MASK 0x7f0000 /* pattern 2 */ -#define WL_P2_SHIFT 16 -#define WL_D2 ((uint32)1 << 23) -#define WL_P3_MASK 0x7f000000 /* pattern 3 */ -#define WL_P3_SHIFT 24 -#define WL_D3 ((uint32)1 << 31) - -/* intstatus and intmask */ -#define I_PME ((uint32)1 << 6) /* power management event */ -#define I_TO ((uint32)1 << 7) /* general purpose timeout */ -#define I_PC ((uint32)1 << 10) /* descriptor error */ -#define I_PD ((uint32)1 << 11) /* data error */ -#define I_DE ((uint32)1 << 12) /* descriptor protocol error */ -#define I_RU ((uint32)1 << 13) /* receive descriptor underflow */ -#define I_RO ((uint32)1 << 14) /* receive fifo overflow */ -#define I_XU ((uint32)1 << 15) /* transmit fifo underflow */ -#define I_RI ((uint32)1 << 16) /* receive interrupt */ -#define I_XI ((uint32)1 << 24) /* transmit interrupt */ -#define I_EM ((uint32)1 << 26) /* emac interrupt */ -#define I_MW ((uint32)1 << 27) /* mii write */ -#define I_MR ((uint32)1 << 28) /* mii read */ - -/* emaccontrol */ -#define EMC_CG ((uint32)1 << 0) /* crc32 generation enable */ -#define EMC_EP ((uint32)1 << 2) /* onchip ephy: powerdown (rev >= 1) */ -#define EMC_ED ((uint32)1 << 3) /* onchip ephy: energy detected (rev >= 1) */ -#define EMC_LC_MASK 0xe0 /* onchip ephy: led control (rev >= 1) */ -#define EMC_LC_SHIFT 5 - -/* emacflowcontrol */ -#define EMF_RFH_MASK 0xff /* rx fifo hi water mark */ -#define EMF_PG ((uint32)1 << 15) /* enable pause frame generation */ - -/* interrupt receive lazy */ -#define IRL_TO_MASK 0x00ffffff /* timeout */ -#define IRL_FC_MASK 0xff000000 /* frame count */ -#define IRL_FC_SHIFT 24 /* frame count */ - -/* emac receive config */ -#define ERC_DB ((uint32)1 << 0) /* disable broadcast */ -#define ERC_AM ((uint32)1 << 1) /* accept all multicast */ -#define ERC_RDT ((uint32)1 << 2) /* receive disable while transmitting */ -#define ERC_PE ((uint32)1 << 3) /* promiscuous enable */ -#define ERC_LE ((uint32)1 << 4) /* loopback enable */ -#define ERC_FE ((uint32)1 << 5) /* enable flow control */ -#define ERC_UF ((uint32)1 << 6) /* accept unicast flow control frame */ -#define ERC_RF ((uint32)1 << 7) /* reject filter */ - -/* emac mdio control */ -#define MC_MF_MASK 0x7f /* mdc frequency */ -#define MC_PE ((uint32)1 << 7) /* mii preamble enable */ - -/* emac mdio data */ -#define MD_DATA_MASK 0xffff /* r/w data */ -#define MD_TA_MASK 0x30000 /* turnaround value */ -#define MD_TA_SHIFT 16 -#define MD_TA_VALID (2 << MD_TA_SHIFT) /* valid ta */ -#define MD_RA_MASK 0x7c0000 /* register address */ -#define MD_RA_SHIFT 18 -#define MD_PMD_MASK 0xf800000 /* physical media device */ -#define MD_PMD_SHIFT 23 -#define MD_OP_MASK 0x30000000 /* opcode */ -#define MD_OP_SHIFT 28 -#define MD_OP_WRITE (1 << MD_OP_SHIFT) /* write op */ -#define MD_OP_READ (2 << MD_OP_SHIFT) /* read op */ -#define MD_SB_MASK 0xc0000000 /* start bits */ -#define MD_SB_SHIFT 30 -#define MD_SB_START (0x1 << MD_SB_SHIFT) /* start of frame */ - -/* emac intstatus and intmask */ -#define EI_MII ((uint32)1 << 0) /* mii mdio interrupt */ -#define EI_MIB ((uint32)1 << 1) /* mib interrupt */ -#define EI_FLOW ((uint32)1 << 2) /* flow control interrupt */ - -/* emac cam data high */ -#define CD_V ((uint32)1 << 16) /* valid bit */ - -/* emac cam control */ -#define CC_CE ((uint32)1 << 0) /* cam enable */ -#define CC_MS ((uint32)1 << 1) /* mask select */ -#define CC_RD ((uint32)1 << 2) /* read */ -#define CC_WR ((uint32)1 << 3) /* write */ -#define CC_INDEX_MASK 0x3f0000 /* index */ -#define CC_INDEX_SHIFT 16 -#define CC_CB ((uint32)1 << 31) /* cam busy */ - -/* emac ethernet control */ -#define EC_EE ((uint32)1 << 0) /* emac enable */ -#define EC_ED ((uint32)1 << 1) /* emac disable */ -#define EC_ES ((uint32)1 << 2) /* emac soft reset */ -#define EC_EP ((uint32)1 << 3) /* external phy select */ - -/* emac transmit control */ -#define EXC_FD ((uint32)1 << 0) /* full duplex */ -#define EXC_FM ((uint32)1 << 1) /* flowmode */ -#define EXC_SB ((uint32)1 << 2) /* single backoff enable */ -#define EXC_SS ((uint32)1 << 3) /* small slottime */ - -/* emac mib control */ -#define EMC_RZ ((uint32)1 << 0) /* autoclear on read */ - -/* sometimes you just need the enet rxheader definitions */ -#include - -#endif /* _bcmenet_47xx_h_ */ diff --git a/openwrt/package/linux/kernel-source/include/bcmenetmib.h b/openwrt/package/linux/kernel-source/include/bcmenetmib.h deleted file mode 100644 index 260d071ba8..0000000000 --- a/openwrt/package/linux/kernel-source/include/bcmenetmib.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Hardware-specific MIB definition for - * Broadcom Home Networking Division - * BCM44XX and BCM47XX 10/100 Mbps Ethernet cores. - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * $Id$ - */ - -#ifndef _bcmenetmib_h_ -#define _bcmenetmib_h_ - -/* cpp contortions to concatenate w/arg prescan */ -#ifndef PAD -#define _PADLINE(line) pad ## line -#define _XSTR(line) _PADLINE(line) -#define PAD _XSTR(__LINE__) -#endif /* PAD */ - -/* - * EMAC MIB Registers - */ -typedef volatile struct { - uint32 tx_good_octets; - uint32 tx_good_pkts; - uint32 tx_octets; - uint32 tx_pkts; - uint32 tx_broadcast_pkts; - uint32 tx_multicast_pkts; - uint32 tx_len_64; - uint32 tx_len_65_to_127; - uint32 tx_len_128_to_255; - uint32 tx_len_256_to_511; - uint32 tx_len_512_to_1023; - uint32 tx_len_1024_to_max; - uint32 tx_jabber_pkts; - uint32 tx_oversize_pkts; - uint32 tx_fragment_pkts; - uint32 tx_underruns; - uint32 tx_total_cols; - uint32 tx_single_cols; - uint32 tx_multiple_cols; - uint32 tx_excessive_cols; - uint32 tx_late_cols; - uint32 tx_defered; - uint32 tx_carrier_lost; - uint32 tx_pause_pkts; - uint32 PAD[8]; - - uint32 rx_good_octets; - uint32 rx_good_pkts; - uint32 rx_octets; - uint32 rx_pkts; - uint32 rx_broadcast_pkts; - uint32 rx_multicast_pkts; - uint32 rx_len_64; - uint32 rx_len_65_to_127; - uint32 rx_len_128_to_255; - uint32 rx_len_256_to_511; - uint32 rx_len_512_to_1023; - uint32 rx_len_1024_to_max; - uint32 rx_jabber_pkts; - uint32 rx_oversize_pkts; - uint32 rx_fragment_pkts; - uint32 rx_missed_pkts; - uint32 rx_crc_align_errs; - uint32 rx_undersize; - uint32 rx_crc_errs; - uint32 rx_align_errs; - uint32 rx_symbol_errs; - uint32 rx_pause_pkts; - uint32 rx_nonpause_pkts; -} bcmenetmib_t; - -#endif /* _bcmenetmib_h_ */ diff --git a/openwrt/package/linux/kernel-source/include/bcmenetrxh.h b/openwrt/package/linux/kernel-source/include/bcmenetrxh.h deleted file mode 100644 index 835e42ba4e..0000000000 --- a/openwrt/package/linux/kernel-source/include/bcmenetrxh.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Hardware-specific Receive Data Header for the - * Broadcom Home Networking Division - * BCM44XX and BCM47XX 10/100 Mbps Ethernet cores. - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * $Id$ - */ - -#ifndef _bcmenetrxh_h_ -#define _bcmenetrxh_h_ - -/* - * The Ethernet MAC core returns an 8-byte Receive Frame Data Header - * with every frame consisting of - * 16bits of frame length, followed by - * 16bits of EMAC rx descriptor info, followed by 32bits of undefined. - */ -typedef volatile struct { - uint16 len; - uint16 flags; - uint16 pad[12]; -} bcmenetrxh_t; - -#define RXHDR_LEN 28 - -#define RXF_L ((uint16)1 << 11) /* last buffer in a frame */ -#define RXF_MISS ((uint16)1 << 7) /* received due to promisc mode */ -#define RXF_BRDCAST ((uint16)1 << 6) /* dest is broadcast address */ -#define RXF_MULT ((uint16)1 << 5) /* dest is multicast address */ -#define RXF_LG ((uint16)1 << 4) /* frame length > rxmaxlength */ -#define RXF_NO ((uint16)1 << 3) /* odd number of nibbles */ -#define RXF_RXER ((uint16)1 << 2) /* receive symbol error */ -#define RXF_CRC ((uint16)1 << 1) /* crc error */ -#define RXF_OV ((uint16)1 << 0) /* fifo overflow */ - -#endif /* _bcmenetrxh_h_ */ diff --git a/openwrt/package/linux/kernel-source/include/bcmnvram.h b/openwrt/package/linux/kernel-source/include/bcmnvram.h deleted file mode 100644 index 3c452634e8..0000000000 --- a/openwrt/package/linux/kernel-source/include/bcmnvram.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * NVRAM variable manipulation - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#ifndef _bcmnvram_h_ -#define _bcmnvram_h_ - -#ifndef _LANGUAGE_ASSEMBLY - -#include - -struct nvram_header { - uint32 magic; - uint32 len; - uint32 crc_ver_init; /* 0:7 crc, 8:15 ver, 16:27 init, mem. test 28, 29-31 reserved */ - uint32 config_refresh; /* 0:15 config, 16:31 refresh */ - uint32 config_ncdl; /* ncdl values for memc */ -}; - -struct nvram_tuple { - char *name; - char *value; - struct nvram_tuple *next; -}; - -/* - * Initialize NVRAM access. May be unnecessary or undefined on certain - * platforms. - */ -extern int nvram_init(void *sbh); - -/* - * Disable NVRAM access. May be unnecessary or undefined on certain - * platforms. - */ -extern void nvram_exit(void); - -/* - * Get the value of an NVRAM variable. The pointer returned may be - * invalid after a set. - * @param name name of variable to get - * @return value of variable or NULL if undefined - */ -extern char * nvram_get(const char *name); - -/* - * Get the value of an NVRAM variable. - * @param name name of variable to get - * @return value of variable or NUL if undefined - */ -#define nvram_safe_get(name) (nvram_get(name) ? : "") - -#define nvram_safe_unset(name) ({ \ - if(nvram_get(name)) \ - nvram_unset(name); \ -}) - -#define nvram_safe_set(name, value) ({ \ - if(!nvram_get(name) || strcmp(nvram_get(name), value)) \ - nvram_set(name, value); \ -}) - -/* - * Match an NVRAM variable. - * @param name name of variable to match - * @param match value to compare against value of variable - * @return TRUE if variable is defined and its value is string equal - * to match or FALSE otherwise - */ -static INLINE int -nvram_match(char *name, char *match) { - const char *value = nvram_get(name); - return (value && !strcmp(value, match)); -} - -/* - * Inversely match an NVRAM variable. - * @param name name of variable to match - * @param match value to compare against value of variable - * @return TRUE if variable is defined and its value is not string - * equal to invmatch or FALSE otherwise - */ -static INLINE int -nvram_invmatch(char *name, char *invmatch) { - const char *value = nvram_get(name); - return (value && strcmp(value, invmatch)); -} - -/* - * Set the value of an NVRAM variable. The name and value strings are - * copied into private storage. Pointers to previously set values - * may become invalid. The new value may be immediately - * retrieved but will not be permanently stored until a commit. - * @param name name of variable to set - * @param value value of variable - * @return 0 on success and errno on failure - */ -extern int nvram_set(const char *name, const char *value); - -/* - * Unset an NVRAM variable. Pointers to previously set values - * remain valid until a set. - * @param name name of variable to unset - * @return 0 on success and errno on failure - * NOTE: use nvram_commit to commit this change to flash. - */ -extern int nvram_unset(const char *name); - -/* - * Commit NVRAM variables to permanent storage. All pointers to values - * may be invalid after a commit. - * NVRAM values are undefined after a commit. - * @return 0 on success and errno on failure - */ -extern int nvram_commit(void); - -/* - * Get all NVRAM variables (format name=value\0 ... \0\0). - * @param buf buffer to store variables - * @param count size of buffer in bytes - * @return 0 on success and errno on failure - */ -extern int nvram_getall(char *buf, int count); - -extern int file2nvram(char *filename, char *varname); -extern int nvram2file(char *varname, char *filename); - -#endif /* _LANGUAGE_ASSEMBLY */ - -#define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */ -#define NVRAM_VERSION 1 -#define NVRAM_HEADER_SIZE 20 -#define NVRAM_SPACE 0x8000 -#define FLASH_BASE 0xbfc00000 /* Extif core */ -#define FLASH_MIN 0x00100000 /* Minimum flash size */ -#define FLASH_MAX 0x00400000 /* Maximum flash size with extif */ - -#endif /* _bcmnvram_h_ */ diff --git a/openwrt/package/linux/kernel-source/include/bcmsrom.h b/openwrt/package/linux/kernel-source/include/bcmsrom.h deleted file mode 100755 index f444deed7d..0000000000 --- a/openwrt/package/linux/kernel-source/include/bcmsrom.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Misc useful routines to access NIC srom - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#ifndef _bcmsrom_h_ -#define _bcmsrom_h_ - -extern int srom_var_init(void *sbh, uint bus, void *curmap, void *osh, char **vars, int *count); - -extern int srom_read(uint bus, void *curmap, void *osh, uint byteoff, uint nbytes, uint16 *buf); -extern int srom_write(uint bus, void *curmap, void *osh, uint byteoff, uint nbytes, uint16 *buf); -extern int srom_parsecis(uint8 *cis, char **vars, int *count); - -#endif /* _bcmsrom_h_ */ diff --git a/openwrt/package/linux/kernel-source/include/bcmutils.h b/openwrt/package/linux/kernel-source/include/bcmutils.h deleted file mode 100644 index 05ad41d9d8..0000000000 --- a/openwrt/package/linux/kernel-source/include/bcmutils.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Misc useful os-independent macros and functions. - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * $Id$ - */ - -#ifndef _bcmutils_h_ -#define _bcmutils_h_ - -#ifndef MIN -#define MIN(a, b) (((a)<(b))?(a):(b)) -#endif - -#ifndef MAX -#define MAX(a, b) (((a)>(b))?(a):(b)) -#endif - -#define CEIL(x, y) (((x) + ((y)-1)) / (y)) -#define ROUNDUP(x, y) ((((ulong)(x)+((y)-1))/(y))*(y)) -#define ISALIGNED(a, x) (((uint)(a) & ((x)-1)) == 0) -#define ISPOWEROF2(x) ((((x)-1)&(x))==0) -#define OFFSETOF(type, member) ((uint) &((type *)0)->member) -#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0])) - -/* bit map related macros */ -#ifndef setbit -#define NBBY 8 /* 8 bits per byte */ -#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) -#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) -#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) -#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) -#endif - -#define NBITS(type) (sizeof (type) * 8) - -#define _BCM_U 0x01 /* upper */ -#define _BCM_L 0x02 /* lower */ -#define _BCM_D 0x04 /* digit */ -#define _BCM_C 0x08 /* cntrl */ -#define _BCM_P 0x10 /* punct */ -#define _BCM_S 0x20 /* white space (space/lf/tab) */ -#define _BCM_X 0x40 /* hex digit */ -#define _BCM_SP 0x80 /* hard space (0x20) */ - -extern unsigned char bcm_ctype[]; -#define bcm_ismask(x) (bcm_ctype[(int)(unsigned char)(x)]) - -#define bcm_isalnum(c) ((bcm_ismask(c)&(_BCM_U|_BCM_L|_BCM_D)) != 0) -#define bcm_isalpha(c) ((bcm_ismask(c)&(_BCM_U|_BCM_L)) != 0) -#define bcm_iscntrl(c) ((bcm_ismask(c)&(_BCM_C)) != 0) -#define bcm_isdigit(c) ((bcm_ismask(c)&(_BCM_D)) != 0) -#define bcm_isgraph(c) ((bcm_ismask(c)&(_BCM_P|_BCM_U|_BCM_L|_BCM_D)) != 0) -#define bcm_islower(c) ((bcm_ismask(c)&(_BCM_L)) != 0) -#define bcm_isprint(c) ((bcm_ismask(c)&(_BCM_P|_BCM_U|_BCM_L|_BCM_D|_BCM_SP)) != 0) -#define bcm_ispunct(c) ((bcm_ismask(c)&(_BCM_P)) != 0) -#define bcm_isspace(c) ((bcm_ismask(c)&(_BCM_S)) != 0) -#define bcm_isupper(c) ((bcm_ismask(c)&(_BCM_U)) != 0) -#define bcm_isxdigit(c) ((bcm_ismask(c)&(_BCM_D|_BCM_X)) != 0) - -/* - * Spin at most 'us' microseconds while 'exp' is true. - * Caller should explicitly test 'exp' when this completes - * and take appropriate error action if 'exp' is still true. - */ -#define SPINWAIT(exp, us) { \ - uint countdown = (us) + 9; \ - while ((exp) && (countdown >= 10)) {\ - OSL_DELAY(10); \ - countdown -= 10; \ - } \ -} - -/* generic osl packet queue */ -struct pktq { - void *head; /* first packet to dequeue */ - void *tail; /* last packet to dequeue */ - uint len; /* number of queued packets */ - uint maxlen; /* maximum number of queued packets */ - bool priority; /* enqueue by packet priority */ -}; -#define DEFAULT_QLEN 128 - -#define pktq_len(q) ((q)->len) -#define pktq_avail(q) ((q)->maxlen - (q)->len) -#define pktq_head(q) ((q)->head) -#define pktq_full(q) ((q)->len >= (q)->maxlen) - -/* crc defines */ -#define CRC8_INIT_VALUE 0xff /* Initial CRC8 checksum value */ -#define CRC8_GOOD_VALUE 0x9f /* Good final CRC8 checksum value */ -#define CRC16_INIT_VALUE 0xffff /* Initial CRC16 checksum value */ -#define CRC16_GOOD_VALUE 0xf0b8 /* Good final CRC16 checksum value */ -#define CRC32_INIT_VALUE 0xffffffff /* Initial CRC32 checksum value */ -#define CRC32_GOOD_VALUE 0xdebb20e3 /* Good final CRC32 checksum value */ - -/* tag_ID/length/value_buffer tuple */ -typedef struct bcm_tlv { - uint8 id; - uint8 len; - uint8 data[1]; -} bcm_tlv_t; - -/* Check that bcm_tlv_t fits into the given buflen */ -#define bcm_valid_tlv(elt, buflen) ((buflen) >= 2 && (buflen) >= 2 + (elt)->len) - -/* buffer length for ethernet address from bcm_ether_ntoa() */ -#define ETHER_ADDR_STR_LEN 18 - -/* -* load 32-bit value from unaligned byte array -*/ -#ifdef IL_BIGENDIAN -#define load32_ua(a) ((((uint8 *)(a))[0] << 24) + (((uint8 *)(a))[1] << 16) + \ - (((uint8 *)(a))[2] << 8) + ((uint8 *)(a))[3]) -#else -#define load32_ua(a) ((((uint8 *)(a))[3] << 24) + (((uint8 *)(a))[2] << 16) + \ - (((uint8 *)(a))[1] << 8) + ((uint8 *)(a))[0]) -#endif - -/* externs */ -extern uint bcm_atoi(char *s); -extern uchar bcm_toupper(uchar c); -extern ulong bcm_strtoul(char *cp, char **endp, uint base); -extern void deadbeef(char *p, uint len); -extern void prhex(char *msg, uchar *buf, uint len); -extern void prpkt(char *msg, void *drv, void *p0); -extern uint pktcopy(void *drv, void *p, uint offset, int len, uchar *buf); -extern uint pkttotlen(void *drv, void *); -extern uchar *bcm_ether_ntoa(char *ea, char *buf); -extern int bcm_ether_atoe(char *p, char *ea); -extern void bcm_mdelay(uint ms); -extern char *getvar(char *vars, char *name); -extern int getintvar(char *vars, char *name); -extern char *bcmstrstr(char *haystack, char *needle); - -extern uint8 crc8(uint8 *p, uint nbytes, uint8 crc); -extern uint16 crc16(uint8 *p, uint nbytes, uint16 crc); -extern uint32 crc32(uint8 *p, uint nbytes, uint32 crc); -extern bcm_tlv_t *bcm_next_tlv(bcm_tlv_t *elt, int *buflen); -extern bcm_tlv_t *bcm_parse_tlvs(void *buf, int buflen, uint key); -extern bcm_tlv_t *bcm_parse_ordered_tlvs(void *buf, int buflen, uint key); -extern void pktq_init(struct pktq *q, uint maxlen, bool priority); -extern bool pktenq(struct pktq *q, void *p, bool lifo); -extern void *pktdeq(struct pktq *q); - -#define bcmlog(fmt, a1, a2) -#define bcmdumplog(buf, size) *buf = '\0' -#define bcmdumplogent(buf, idx) -1 - -#endif /* _bcmutils_h_ */ diff --git a/openwrt/package/linux/kernel-source/include/epivers.h b/openwrt/package/linux/kernel-source/include/epivers.h deleted file mode 100644 index e174fb50d8..0000000000 --- a/openwrt/package/linux/kernel-source/include/epivers.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - * -*/ - -#ifndef _epivers_h_ -#define _epivers_h_ - -#ifdef linux -#include -#endif - -/* Vendor Name, ASCII, 32 chars max */ -#ifdef COMPANYNAME -#define HPNA_VENDOR COMPANYNAME -#else -#define HPNA_VENDOR "Broadcom Corporation" -#endif - -/* Driver Date, ASCII, 32 chars max */ -#define HPNA_DRV_BUILD_DATE __DATE__ - -/* Hardware Manufacture Date, ASCII, 32 chars max */ -#define HPNA_HW_MFG_DATE "Not Specified" - -/* See documentation for Device Type values, 32 values max */ -#ifndef HPNA_DEV_TYPE - -#if defined(CONFIG_BRCM_VJ) -#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_DISPLAY } - -#elif defined(CONFIG_BCRM_93725) -#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_CM_BRIDGE, CDCF_V0_DEVICE_DISPLAY } - -#else -#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_PCINIC } - -#endif - -#endif /* !HPNA_DEV_TYPE */ - - -#define EPI_MAJOR_VERSION 3 - -#define EPI_MINOR_VERSION 60 - -#define EPI_RC_NUMBER 13 - -#define EPI_INCREMENTAL_NUMBER 0 - -#define EPI_BUILD_NUMBER 0 - -#define EPI_VERSION 3,60,13,0 - -#define EPI_VERSION_NUM 0x033c0d00 - -/* Driver Version String, ASCII, 32 chars max */ -#define EPI_VERSION_STR "3.60.13.0" -#define EPI_ROUTER_VERSION_STR "3.61.13.0" - -#endif /* _epivers_h_ */ diff --git a/openwrt/package/linux/kernel-source/include/etsockio.h b/openwrt/package/linux/kernel-source/include/etsockio.h deleted file mode 100644 index 59b6af1f81..0000000000 --- a/openwrt/package/linux/kernel-source/include/etsockio.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Driver-specific socket ioctls - * used by BSD, Linux, and PSOS - * Broadcom BCM44XX 10/100Mbps Ethernet Device Driver - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#ifndef _etsockio_h_ -#define _etsockio_h_ - -/* THESE MUST BE CONTIGUOUS AND CONSISTENT WITH VALUES IN ETC.H */ - - -#if defined(linux) -#define SIOCSETCUP (SIOCDEVPRIVATE + 0) -#define SIOCSETCDOWN (SIOCDEVPRIVATE + 1) -#define SIOCSETCLOOP (SIOCDEVPRIVATE + 2) -#define SIOCGETCDUMP (SIOCDEVPRIVATE + 3) -#define SIOCSETCSETMSGLEVEL (SIOCDEVPRIVATE + 4) -#define SIOCSETCPROMISC (SIOCDEVPRIVATE + 5) -#define SIOCSETCTXDOWN (SIOCDEVPRIVATE + 6) /* obsolete */ -#define SIOCSETCSPEED (SIOCDEVPRIVATE + 7) -#define SIOCTXGEN (SIOCDEVPRIVATE + 8) -#define SIOCGETCPHYRD (SIOCDEVPRIVATE + 9) -#define SIOCSETCPHYWR (SIOCDEVPRIVATE + 10) - -#else /* !linux */ - -#define SIOCSETCUP _IOWR('e', 130 + 0, struct ifreq) -#define SIOCSETCDOWN _IOWR('e', 130 + 1, struct ifreq) -#define SIOCSETCLOOP _IOWR('e', 130 + 2, struct ifreq) -#define SIOCGETCDUMP _IOWR('e', 130 + 3, struct ifreq) -#define SIOCSETCSETMSGLEVEL _IOWR('e', 130 + 4, struct ifreq) -#define SIOCSETCPROMISC _IOWR('e', 130 + 5, struct ifreq) -#define SIOCSETCTXDOWN _IOWR('e', 130 + 6, struct ifreq) /* obsolete */ -#define SIOCSETCSPEED _IOWR('e', 130 + 7, struct ifreq) -#define SIOCTXGEN _IOWR('e', 130 + 8, struct ifreq) - -#endif - -/* arg to SIOCTXGEN */ -struct txg { - uint32 num; /* number of frames to send */ - uint32 delay; /* delay in microseconds between sending each */ - uint32 size; /* size of ether frame to send */ - uchar buf[1514]; /* starting ether frame data */ -}; - -#endif diff --git a/openwrt/package/linux/kernel-source/include/hnddma.h b/openwrt/package/linux/kernel-source/include/hnddma.h deleted file mode 100644 index 35f2095fb2..0000000000 --- a/openwrt/package/linux/kernel-source/include/hnddma.h +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Generic Broadcom Home Networking Division (HND) DMA engine definitions. - * This supports the following chips: BCM42xx, 44xx, 47xx . - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * $Id$ - */ - -#ifndef _hnddma_h_ -#define _hnddma_h_ - -/* - * Each DMA processor consists of a transmit channel and a receive channel. - */ -typedef volatile struct { - /* transmit channel */ - uint32 xmtcontrol; /* enable, et al */ - uint32 xmtaddr; /* descriptor ring base address (4K aligned) */ - uint32 xmtptr; /* last descriptor posted to chip */ - uint32 xmtstatus; /* current active descriptor, et al */ - - /* receive channel */ - uint32 rcvcontrol; /* enable, et al */ - uint32 rcvaddr; /* descriptor ring base address (4K aligned) */ - uint32 rcvptr; /* last descriptor posted to chip */ - uint32 rcvstatus; /* current active descriptor, et al */ -} dmaregs_t; - -typedef volatile struct { - /* diag access */ - uint32 fifoaddr; /* diag address */ - uint32 fifodatalow; /* low 32bits of data */ - uint32 fifodatahigh; /* high 32bits of data */ - uint32 pad; /* reserved */ -} dmafifo_t; - -/* transmit channel control */ -#define XC_XE ((uint32)1 << 0) /* transmit enable */ -#define XC_SE ((uint32)1 << 1) /* transmit suspend request */ -#define XC_LE ((uint32)1 << 2) /* loopback enable */ -#define XC_FL ((uint32)1 << 4) /* flush request */ - -/* transmit descriptor table pointer */ -#define XP_LD_MASK 0xfff /* last valid descriptor */ - -/* transmit channel status */ -#define XS_CD_MASK 0x0fff /* current descriptor pointer */ -#define XS_XS_MASK 0xf000 /* transmit state */ -#define XS_XS_SHIFT 12 -#define XS_XS_DISABLED 0x0000 /* disabled */ -#define XS_XS_ACTIVE 0x1000 /* active */ -#define XS_XS_IDLE 0x2000 /* idle wait */ -#define XS_XS_STOPPED 0x3000 /* stopped */ -#define XS_XS_SUSP 0x4000 /* suspend pending */ -#define XS_XE_MASK 0xf0000 /* transmit errors */ -#define XS_XE_SHIFT 16 -#define XS_XE_NOERR 0x00000 /* no error */ -#define XS_XE_DPE 0x10000 /* descriptor protocol error */ -#define XS_XE_DFU 0x20000 /* data fifo underrun */ -#define XS_XE_BEBR 0x30000 /* bus error on buffer read */ -#define XS_XE_BEDA 0x40000 /* bus error on descriptor access */ -#define XS_AD_MASK 0xfff00000 /* active descriptor */ -#define XS_AD_SHIFT 20 - -/* receive channel control */ -#define RC_RE ((uint32)1 << 0) /* receive enable */ -#define RC_RO_MASK 0xfe /* receive frame offset */ -#define RC_RO_SHIFT 1 -#define RC_FM ((uint32)1 << 8) /* direct fifo receive (pio) mode */ - -/* receive descriptor table pointer */ -#define RP_LD_MASK 0xfff /* last valid descriptor */ - -/* receive channel status */ -#define RS_CD_MASK 0x0fff /* current descriptor pointer */ -#define RS_RS_MASK 0xf000 /* receive state */ -#define RS_RS_SHIFT 12 -#define RS_RS_DISABLED 0x0000 /* disabled */ -#define RS_RS_ACTIVE 0x1000 /* active */ -#define RS_RS_IDLE 0x2000 /* idle wait */ -#define RS_RS_STOPPED 0x3000 /* reserved */ -#define RS_RE_MASK 0xf0000 /* receive errors */ -#define RS_RE_SHIFT 16 -#define RS_RE_NOERR 0x00000 /* no error */ -#define RS_RE_DPE 0x10000 /* descriptor protocol error */ -#define RS_RE_DFO 0x20000 /* data fifo overflow */ -#define RS_RE_BEBW 0x30000 /* bus error on buffer write */ -#define RS_RE_BEDA 0x40000 /* bus error on descriptor access */ -#define RS_AD_MASK 0xfff00000 /* active descriptor */ -#define RS_AD_SHIFT 20 - -/* fifoaddr */ -#define FA_OFF_MASK 0xffff /* offset */ -#define FA_SEL_MASK 0xf0000 /* select */ -#define FA_SEL_SHIFT 16 -#define FA_SEL_XDD 0x00000 /* transmit dma data */ -#define FA_SEL_XDP 0x10000 /* transmit dma pointers */ -#define FA_SEL_RDD 0x40000 /* receive dma data */ -#define FA_SEL_RDP 0x50000 /* receive dma pointers */ -#define FA_SEL_XFD 0x80000 /* transmit fifo data */ -#define FA_SEL_XFP 0x90000 /* transmit fifo pointers */ -#define FA_SEL_RFD 0xc0000 /* receive fifo data */ -#define FA_SEL_RFP 0xd0000 /* receive fifo pointers */ - -/* - * DMA Descriptor - * Descriptors are only read by the hardware, never written back. - */ -typedef volatile struct { - uint32 ctrl; /* misc control bits & bufcount */ - uint32 addr; /* data buffer address */ -} dmadd_t; - -/* - * Each descriptor ring must be 4096byte aligned - * and fit within a single 4096byte page. - */ -#define DMAMAXRINGSZ 4096 -#define DMARINGALIGN 4096 - -/* control flags */ -#define CTRL_BC_MASK 0x1fff /* buffer byte count */ -#define CTRL_EOT ((uint32)1 << 28) /* end of descriptor table */ -#define CTRL_IOC ((uint32)1 << 29) /* interrupt on completion */ -#define CTRL_EOF ((uint32)1 << 30) /* end of frame */ -#define CTRL_SOF ((uint32)1 << 31) /* start of frame */ - -/* control flags in the range [27:20] are core-specific and not defined here */ -#define CTRL_CORE_MASK 0x0ff00000 - -/* export structure */ -typedef volatile struct { - /* rx error counters */ - uint rxgiants; /* rx giant frames */ - uint rxnobuf; /* rx out of dma descriptors */ - /* tx error counters */ - uint txnobuf; /* tx out of dma descriptors */ -} hnddma_t; - -#ifndef di_t -#define di_t void -#endif - -/* externs */ -extern void *dma_attach(void *drv, void *dev, char *name, dmaregs_t *dmaregs, - uint ntxd, uint nrxd, uint rxbufsize, uint nrxpost, uint rxoffset, - uint ddoffset, uint dataoffset, uint *msg_level); -extern void dma_detach(di_t *di); -extern void dma_txreset(di_t *di); -extern void dma_rxreset(di_t *di); -extern void dma_txinit(di_t *di); -extern bool dma_txenabled(di_t *di); -extern void dma_rxinit(di_t *di); -extern void dma_rxenable(di_t *di); -extern bool dma_rxenabled(di_t *di); -extern void dma_txsuspend(di_t *di); -extern void dma_txresume(di_t *di); -extern bool dma_txsuspended(di_t *di); -extern bool dma_txstopped(di_t *di); -extern bool dma_rxstopped(di_t *di); -extern int dma_txfast(di_t *di, void *p, uint32 coreflags); -extern int dma_tx(di_t *di, void *p, uint32 coreflags); -extern void dma_fifoloopbackenable(di_t *di); -extern void *dma_rx(di_t *di); -extern void dma_rxfill(di_t *di); -extern void dma_txreclaim(di_t *di, bool forceall); -extern void dma_rxreclaim(di_t *di); -extern char *dma_dump(di_t *di, char *buf); -extern char *dma_dumptx(di_t *di, char *buf); -extern char *dma_dumprx(di_t *di, char *buf); -extern uint dma_getvar(di_t *di, char *name); -extern void *dma_getnexttxp(di_t *di, bool forceall); -extern void *dma_peeknexttxp(di_t *di); -extern void *dma_getnextrxp(di_t *di, bool forceall); -extern void dma_txblock(di_t *di); -extern void dma_txunblock(di_t *di); -extern uint dma_txactive(di_t *di); -extern void dma_txrotate(di_t *di); - -#endif /* _hnddma_h_ */ diff --git a/openwrt/package/linux/kernel-source/include/hndmips.h b/openwrt/package/linux/kernel-source/include/hndmips.h deleted file mode 100644 index ca65c69dca..0000000000 --- a/openwrt/package/linux/kernel-source/include/hndmips.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Alternate include file for HND sbmips.h since CFE also ships with - * a sbmips.h. - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#include "sbmips.h" diff --git a/openwrt/package/linux/kernel-source/include/linux_osl.h b/openwrt/package/linux/kernel-source/include/linux_osl.h deleted file mode 100644 index e1a3627551..0000000000 --- a/openwrt/package/linux/kernel-source/include/linux_osl.h +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Linux OS Independent Layer - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#ifndef _linux_osl_h_ -#define _linux_osl_h_ - -#include - -/* use current 2.4.x calling conventions */ -#include - -/* assert and panic */ -#define ASSERT(exp) do {} while (0) - -/* PCMCIA attribute space access macros */ -#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) -struct pcmcia_dev { - dev_link_t link; /* PCMCIA device pointer */ - dev_node_t node; /* PCMCIA node structure */ - void *base; /* Mapped attribute memory window */ - size_t size; /* Size of window */ - void *drv; /* Driver data */ -}; -#endif -#define OSL_PCMCIA_READ_ATTR(osh, offset, buf, size) \ - osl_pcmcia_read_attr((osh), (offset), (buf), (size)) -#define OSL_PCMCIA_WRITE_ATTR(osh, offset, buf, size) \ - osl_pcmcia_write_attr((osh), (offset), (buf), (size)) -extern void osl_pcmcia_read_attr(void *osh, uint offset, void *buf, int size); -extern void osl_pcmcia_write_attr(void *osh, uint offset, void *buf, int size); - -/* PCI configuration space access macros */ -#define OSL_PCI_READ_CONFIG(loc, offset, size) \ - osl_pci_read_config((loc), (offset), (size)) -#define OSL_PCI_WRITE_CONFIG(loc, offset, size, val) \ - osl_pci_write_config((loc), (offset), (size), (val)) -extern uint32 osl_pci_read_config(void *loc, uint size, uint offset); -extern void osl_pci_write_config(void *loc, uint offset, uint size, uint val); - -/* OSL initialization */ -#define osl_init() do {} while (0) - -/* host/bus architecture-specific byte swap */ -#define BUS_SWAP32(v) (v) - -/* general purpose memory allocation */ -#if defined(BINOSL) - -#if defined(BCMDBG_MEM) - -#define MALLOC(size) osl_debug_malloc((size), __LINE__, __FILE__) -#define MFREE(addr, size) osl_debug_mfree((addr), (size)) -#define MALLOCED() osl_malloced() -extern void* osl_debug_malloc(uint size, int line, char* file); -extern void osl_debug_mfree(void *addr, uint size); -extern void osl_debug_memdump(void); - -#else - -#define MALLOC(size) osl_malloc((size)) -#define MFREE(addr, size) osl_mfree((addr), (size)) -#define MALLOCED() osl_malloced() - -#endif - -extern void *osl_malloc(uint size); -extern void osl_mfree(void *addr, uint size); -extern uint osl_malloced(void); - -#else - -#define MALLOC(size) kmalloc((size), GFP_ATOMIC) -#define MFREE(addr, size) kfree((addr)) -#define MALLOCED() (0) - -#endif - -/* - * BINOSL selects the slightly slower function-call-based binary compatible osl. - * Macros expand to calls to functions defined in linux_osl.c . - */ -#ifndef BINOSL - -/* string library, kernel mode */ -#define printf(fmt, args...) printk(fmt, ## args) -#include -#include - -/* register access macros */ -#define R_REG(r) ( \ - sizeof(*(r)) == sizeof(uint8) ? readb((volatile uint8*)(r)) : \ - sizeof(*(r)) == sizeof(uint16) ? readw((volatile uint16*)(r)) : \ - readl((volatile uint32*)(r)) \ -) -#define W_REG(r, v) do { \ - switch (sizeof(*(r))) { \ - case sizeof(uint8): writeb((uint8)(v), (volatile uint8*)(r)); break; \ - case sizeof(uint16): writew((uint16)(v), (volatile uint16*)(r)); break; \ - case sizeof(uint32): writel((uint32)(v), (volatile uint32*)(r)); break; \ - } \ -} while (0) - -#define AND_REG(r, v) W_REG((r), R_REG(r) & (v)) -#define OR_REG(r, v) W_REG((r), R_REG(r) | (v)) - -/* bcopy, bcmp, and bzero */ -#define bcopy(src, dst, len) memcpy((dst), (src), (len)) -#define bcmp(b1, b2, len) memcmp((b1), (b2), (len)) -#define bzero(b, len) memset((b), '\0', (len)) - -/* uncached virtual address */ -#ifdef mips -#define OSL_UNCACHED(va) KSEG1ADDR((va)) -#include -#else -#define OSL_UNCACHED(va) (va) -#endif - -/* get processor cycle count */ -#if defined(mips) -#define OSL_GETCYCLES(x) ((x) = read_c0_count() * 2) -#elif defined(__i386__) -#define OSL_GETCYCLES(x) rdtscl((x)) -#else -#define OSL_GETCYCLES(x) ((x) = 0) -#endif - -/* dereference an address that may cause a bus exception */ -#ifdef mips -#if defined(MODULE) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,17)) -#define BUSPROBE(val, addr) panic("get_dbe() will not fixup a bus exception when compiled into a module") -#else -#define BUSPROBE(val, addr) get_dbe((val), (addr)) -#include -#endif -#else -#define BUSPROBE(val, addr) ({ (val) = R_REG((addr)); 0; }) -#endif - -/* map/unmap physical to virtual I/O */ -#define REG_MAP(pa, size) ioremap_nocache((unsigned long)(pa), (unsigned long)(size)) -#define REG_UNMAP(va) iounmap((void *)(va)) - -/* allocate/free shared (dma-able) consistent (uncached) memory */ -#define DMA_ALLOC_CONSISTENT(dev, size, pap) \ - pci_alloc_consistent((dev), (size), (dma_addr_t*)(pap)) -#define DMA_FREE_CONSISTENT(dev, va, size, pa) \ - pci_free_consistent((dev), (size), (va), (dma_addr_t)(pa)) - -/* map/unmap direction */ -#define DMA_TX PCI_DMA_TODEVICE -#define DMA_RX PCI_DMA_FROMDEVICE - -/* map/unmap shared (dma-able) memory */ -#define DMA_MAP(dev, va, size, direction, p) \ - pci_map_single((dev), (va), (size), (direction)) -#define DMA_UNMAP(dev, pa, size, direction, p) \ - pci_unmap_single((dev), (dma_addr_t)(pa), (size), (direction)) - -/* microsecond delay */ -#define OSL_DELAY(usec) udelay(usec) -#include - -/* shared (dma-able) memory access macros */ -#define R_SM(r) *(r) -#define W_SM(r, v) (*(r) = (v)) -#define BZERO_SM(r, len) memset((r), '\0', (len)) - -/* packet primitives */ -#define PKTGET(drv, len, send) osl_pktget((drv), (len), (send)) -#define PKTFREE(drv, skb, send) osl_pktfree((skb)) -#define PKTDATA(drv, skb) (((struct sk_buff*)(skb))->data) -#define PKTLEN(drv, skb) (((struct sk_buff*)(skb))->len) -#define PKTHEADROOM(drv, skb) (PKTDATA(drv,skb)-(((struct sk_buff*)(skb))->head)) -#define PKTTAILROOM(drv, skb) ((((struct sk_buff*)(skb))->end)-(((struct sk_buff*)(skb))->tail)) -#define PKTNEXT(drv, skb) (((struct sk_buff*)(skb))->next) -#define PKTSETNEXT(skb, x) (((struct sk_buff*)(skb))->next = (struct sk_buff*)(x)) -#define PKTSETLEN(drv, skb, len) __skb_trim((struct sk_buff*)(skb), (len)) -#define PKTPUSH(drv, skb, bytes) skb_push((struct sk_buff*)(skb), (bytes)) -#define PKTPULL(drv, skb, bytes) skb_pull((struct sk_buff*)(skb), (bytes)) -#define PKTDUP(drv, skb) skb_clone((struct sk_buff*)(skb), GFP_ATOMIC) -#define PKTCOOKIE(skb) ((void*)((struct sk_buff*)(skb))->csum) -#define PKTSETCOOKIE(skb, x) (((struct sk_buff*)(skb))->csum = (uint)(x)) -#define PKTLINK(skb) (((struct sk_buff*)(skb))->prev) -#define PKTSETLINK(skb, x) (((struct sk_buff*)(skb))->prev = (struct sk_buff*)(x)) -#define PKTPRIO(skb) (((struct sk_buff*)(skb))->priority) -#define PKTSETPRIO(skb, x) (((struct sk_buff*)(skb))->priority = (x)) -extern void *osl_pktget(void *drv, uint len, bool send); -extern void osl_pktfree(void *skb); - -#else /* BINOSL */ - -/* string library */ -#ifndef LINUX_OSL -#undef printf -#define printf(fmt, args...) osl_printf((fmt), ## args) -#undef sprintf -#define sprintf(buf, fmt, args...) osl_sprintf((buf), (fmt), ## args) -#undef strcmp -#define strcmp(s1, s2) osl_strcmp((s1), (s2)) -#undef strncmp -#define strncmp(s1, s2, n) osl_strncmp((s1), (s2), (n)) -#undef strlen -#define strlen(s) osl_strlen((s)) -#undef strcpy -#define strcpy(d, s) osl_strcpy((d), (s)) -#undef strncpy -#define strncpy(d, s, n) osl_strncpy((d), (s), (n)) -#endif -extern int osl_printf(const char *format, ...); -extern int osl_sprintf(char *buf, const char *format, ...); -extern int osl_strcmp(const char *s1, const char *s2); -extern int osl_strncmp(const char *s1, const char *s2, uint n); -extern int osl_strlen(char *s); -extern char* osl_strcpy(char *d, const char *s); -extern char* osl_strncpy(char *d, const char *s, uint n); - -/* register access macros */ -#define R_REG(r) ( \ - sizeof(*(r)) == sizeof(uint8) ? osl_readb((volatile uint8*)(r)) : \ - sizeof(*(r)) == sizeof(uint16) ? osl_readw((volatile uint16*)(r)) : \ - osl_readl((volatile uint32*)(r)) \ -) -#define W_REG(r, v) do { \ - switch (sizeof(*(r))) { \ - case sizeof(uint8): osl_writeb((uint8)(v), (volatile uint8*)(r)); break; \ - case sizeof(uint16): osl_writew((uint16)(v), (volatile uint16*)(r)); break; \ - case sizeof(uint32): osl_writel((uint32)(v), (volatile uint32*)(r)); break; \ - } \ -} while (0) -#define AND_REG(r, v) W_REG((r), R_REG(r) & (v)) -#define OR_REG(r, v) W_REG((r), R_REG(r) | (v)) -extern uint8 osl_readb(volatile uint8 *r); -extern uint16 osl_readw(volatile uint16 *r); -extern uint32 osl_readl(volatile uint32 *r); -extern void osl_writeb(uint8 v, volatile uint8 *r); -extern void osl_writew(uint16 v, volatile uint16 *r); -extern void osl_writel(uint32 v, volatile uint32 *r); - -/* bcopy, bcmp, and bzero */ -extern void bcopy(const void *src, void *dst, int len); -extern int bcmp(const void *b1, const void *b2, int len); -extern void bzero(void *b, int len); - -/* uncached virtual address */ -#define OSL_UNCACHED(va) osl_uncached((va)) -extern void *osl_uncached(void *va); - -/* get processor cycle count */ -#define OSL_GETCYCLES(x) ((x) = osl_getcycles()) -extern uint osl_getcycles(void); - -/* dereference an address that may target abort */ -#define BUSPROBE(val, addr) osl_busprobe(&(val), (addr)) -extern int osl_busprobe(uint32 *val, uint32 addr); - -/* map/unmap physical to virtual */ -#define REG_MAP(pa, size) osl_reg_map((pa), (size)) -#define REG_UNMAP(va) osl_reg_unmap((va)) -extern void *osl_reg_map(uint32 pa, uint size); -extern void osl_reg_unmap(void *va); - -/* allocate/free shared (dma-able) consistent (uncached) memory */ -#define DMA_ALLOC_CONSISTENT(dev, size, pap) \ - osl_dma_alloc_consistent((dev), (size), (pap)) -#define DMA_FREE_CONSISTENT(dev, va, size, pa) \ - osl_dma_free_consistent((dev), (void*)(va), (size), (pa)) -extern void *osl_dma_alloc_consistent(void *dev, uint size, ulong *pap); -extern void osl_dma_free_consistent(void *dev, void *va, uint size, ulong pa); - -/* map/unmap direction */ -#define DMA_TX 1 -#define DMA_RX 2 - -/* map/unmap shared (dma-able) memory */ -#define DMA_MAP(dev, va, size, direction, p) \ - osl_dma_map((dev), (va), (size), (direction)) -#define DMA_UNMAP(dev, pa, size, direction, p) \ - osl_dma_unmap((dev), (pa), (size), (direction)) -extern uint osl_dma_map(void *dev, void *va, uint size, int direction); -extern void osl_dma_unmap(void *dev, uint pa, uint size, int direction); - -/* microsecond delay */ -#define OSL_DELAY(usec) osl_delay((usec)) -extern void osl_delay(uint usec); - -/* shared (dma-able) memory access macros */ -#define R_SM(r) *(r) -#define W_SM(r, v) (*(r) = (v)) -#define BZERO_SM(r, len) bzero((r), (len)) - -/* packet primitives */ -#define PKTGET(drv, len, send) osl_pktget((drv), (len), (send)) -#define PKTFREE(drv, skb, send) osl_pktfree((skb)) -#define PKTDATA(drv, skb) osl_pktdata((drv), (skb)) -#define PKTLEN(drv, skb) osl_pktlen((drv), (skb)) -#define PKTHEADROOM(drv, skb) osl_pktheadroom((drv), (skb)) -#define PKTTAILROOM(drv, skb) osl_pkttailroom((drv), (skb)) -#define PKTNEXT(drv, skb) osl_pktnext((drv), (skb)) -#define PKTSETNEXT(skb, x) osl_pktsetnext((skb), (x)) -#define PKTSETLEN(drv, skb, len) osl_pktsetlen((drv), (skb), (len)) -#define PKTPUSH(drv, skb, bytes) osl_pktpush((drv), (skb), (bytes)) -#define PKTPULL(drv, skb, bytes) osl_pktpull((drv), (skb), (bytes)) -#define PKTDUP(drv, skb) osl_pktdup((drv), (skb)) -#define PKTCOOKIE(skb) osl_pktcookie((skb)) -#define PKTSETCOOKIE(skb, x) osl_pktsetcookie((skb), (x)) -#define PKTLINK(skb) osl_pktlink((skb)) -#define PKTSETLINK(skb, x) osl_pktsetlink((skb), (x)) -#define PKTPRIO(skb) osl_pktprio((skb)) -#define PKTSETPRIO(skb, x) osl_pktsetprio((skb), (x)) -extern void *osl_pktget(void *drv, uint len, bool send); -extern void osl_pktfree(void *skb); -extern uchar *osl_pktdata(void *drv, void *skb); -extern uint osl_pktlen(void *drv, void *skb); -extern uint osl_pktheadroom(void *drv, void *skb); -extern uint osl_pkttailroom(void *drv, void *skb); -extern void *osl_pktnext(void *drv, void *skb); -extern void osl_pktsetnext(void *skb, void *x); -extern void osl_pktsetlen(void *drv, void *skb, uint len); -extern uchar *osl_pktpush(void *drv, void *skb, int bytes); -extern uchar *osl_pktpull(void *drv, void *skb, int bytes); -extern void *osl_pktdup(void *drv, void *skb); -extern void *osl_pktcookie(void *skb); -extern void osl_pktsetcookie(void *skb, void *x); -extern void *osl_pktlink(void *skb); -extern void osl_pktsetlink(void *skb, void *x); -extern uint osl_pktprio(void *skb); -extern void osl_pktsetprio(void *skb, uint x); - -#endif /* BINOSL */ - -#endif /* _linux_osl_h_ */ diff --git a/openwrt/package/linux/kernel-source/include/linuxver.h b/openwrt/package/linux/kernel-source/include/linuxver.h deleted file mode 100644 index ed89097848..0000000000 --- a/openwrt/package/linux/kernel-source/include/linuxver.h +++ /dev/null @@ -1,392 +0,0 @@ -/* - * Linux-specific abstractions to gain some independence from linux kernel versions. - * Pave over some 2.2 versus 2.4 versus 2.6 kernel differences. - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#ifndef _linuxver_h_ -#define _linuxver_h_ - -#include -#include - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)) -/* __NO_VERSION__ must be defined for all linkables except one in 2.2 */ -#ifdef __UNDEF_NO_VERSION__ -#undef __NO_VERSION__ -#else -#define __NO_VERSION__ -#endif -#endif - -#if defined(MODULE) && defined(MODVERSIONS) -#include -#endif - -/* linux/malloc.h is deprecated, use linux/slab.h instead. */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,9)) -#include -#else -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41)) -#include -#else -#include -#define work_struct tq_struct -#define INIT_WORK(_work, _func, _data) INIT_TQUEUE((_work), (_func), (_data)) -#define schedule_work(_work) schedule_task((_work)) -#define flush_scheduled_work() flush_scheduled_tasks() -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) -/* Some distributions have their own 2.6.x compatibility layers */ -#ifndef IRQ_NONE -typedef void irqreturn_t; -#define IRQ_NONE -#define IRQ_HANDLED -#define IRQ_RETVAL(x) -#endif -#endif - -#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) - -#include -#include -#include -#include -#include -#include - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,69)) -/* In 2.5 (as of 2.5.69 at least) there is a cs_error exported which - * does this, but it's not in 2.4 so we do our own for now. */ -static inline void -cs_error(client_handle_t handle, int func, int ret) -{ - error_info_t err = { func, ret }; - CardServices(ReportError, handle, &err); -} -#endif - -#endif /* CONFIG_PCMCIA */ - -#ifndef __exit -#define __exit -#endif -#ifndef __devexit -#define __devexit -#endif -#ifndef __devinit -#define __devinit __init -#endif -#ifndef __devinitdata -#define __devinitdata -#endif -#ifndef __devexit_p -#define __devexit_p(x) x -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) - -#define pci_get_drvdata(dev) (dev)->sysdata -#define pci_set_drvdata(dev, value) (dev)->sysdata=(value) - -/* - * New-style (2.4.x) PCI/hot-pluggable PCI/CardBus registration - */ - -struct pci_device_id { - unsigned int vendor, device; /* Vendor and device ID or PCI_ANY_ID */ - unsigned int subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */ - unsigned int class, class_mask; /* (class,subclass,prog-if) triplet */ - unsigned long driver_data; /* Data private to the driver */ -}; - -struct pci_driver { - struct list_head node; - char *name; - const struct pci_device_id *id_table; /* NULL if wants all devices */ - int (*probe)(struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */ - void (*remove)(struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ - void (*suspend)(struct pci_dev *dev); /* Device suspended */ - void (*resume)(struct pci_dev *dev); /* Device woken up */ -}; - -#define MODULE_DEVICE_TABLE(type, name) -#define PCI_ANY_ID (~0) - -/* compatpci.c */ -#define pci_module_init pci_register_driver -extern int pci_register_driver(struct pci_driver *drv); -extern void pci_unregister_driver(struct pci_driver *drv); - -#endif /* PCI registration */ - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) -#ifdef MODULE -#define module_init(x) int init_module(void) { return x(); } -#define module_exit(x) void cleanup_module(void) { x(); } -#else -#define module_init(x) __initcall(x); -#define module_exit(x) __exitcall(x); -#endif -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,48)) -#define list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13)) -#define pci_resource_start(dev, bar) ((dev)->base_address[(bar)]) -#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,44)) -#define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start) -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,23)) -#define pci_enable_device(dev) do { } while (0) -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,14)) -#define net_device device -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,42)) - -/* - * DMA mapping - * - * See linux/Documentation/DMA-mapping.txt - */ - -#ifndef PCI_DMA_TODEVICE -#define PCI_DMA_TODEVICE 1 -#define PCI_DMA_FROMDEVICE 2 -#endif - -typedef u32 dma_addr_t; - -/* Pure 2^n version of get_order */ -static inline int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - -static inline void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, - dma_addr_t *dma_handle) -{ - void *ret; - int gfp = GFP_ATOMIC | GFP_DMA; - - ret = (void *)__get_free_pages(gfp, get_order(size)); - - if (ret != NULL) { - memset(ret, 0, size); - *dma_handle = virt_to_bus(ret); - } - return ret; -} -static inline void pci_free_consistent(struct pci_dev *hwdev, size_t size, - void *vaddr, dma_addr_t dma_handle) -{ - free_pages((unsigned long)vaddr, get_order(size)); -} -#ifdef ILSIM -extern uint pci_map_single(void *dev, void *va, uint size, int direction); -extern void pci_unmap_single(void *dev, uint pa, uint size, int direction); -#else -#define pci_map_single(cookie, address, size, dir) virt_to_bus(address) -#define pci_unmap_single(cookie, address, size, dir) -#endif - -#endif /* DMA mapping */ - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,43)) - -#define dev_kfree_skb_any(a) dev_kfree_skb(a) -#define netif_down(dev) do { (dev)->start = 0; } while(0) - -/* pcmcia-cs provides its own netdevice compatibility layer */ -#ifndef _COMPAT_NETDEVICE_H - -/* - * SoftNet - * - * For pre-softnet kernels we need to tell the upper layer not to - * re-enter start_xmit() while we are in there. However softnet - * guarantees not to enter while we are in there so there is no need - * to do the netif_stop_queue() dance unless the transmit queue really - * gets stuck. This should also improve performance according to tests - * done by Aman Singla. - */ - -#define dev_kfree_skb_irq(a) dev_kfree_skb(a) -#define netif_wake_queue(dev) do { clear_bit(0, &(dev)->tbusy); mark_bh(NET_BH); } while(0) -#define netif_stop_queue(dev) set_bit(0, &(dev)->tbusy) - -static inline void netif_start_queue(struct net_device *dev) -{ - dev->tbusy = 0; - dev->interrupt = 0; - dev->start = 1; -} - -#define netif_queue_stopped(dev) (dev)->tbusy -#define netif_running(dev) (dev)->start - -#endif /* _COMPAT_NETDEVICE_H */ - -#define netif_device_attach(dev) netif_start_queue(dev) -#define netif_device_detach(dev) netif_stop_queue(dev) - -/* 2.4.x renamed bottom halves to tasklets */ -#define tasklet_struct tq_struct -static inline void tasklet_schedule(struct tasklet_struct *tasklet) -{ - queue_task(tasklet, &tq_immediate); - mark_bh(IMMEDIATE_BH); -} - -static inline void tasklet_init(struct tasklet_struct *tasklet, - void (*func)(unsigned long), - unsigned long data) -{ - tasklet->next = NULL; - tasklet->sync = 0; - tasklet->routine = (void (*)(void *))func; - tasklet->data = (void *)data; -} -#define tasklet_kill(tasklet) {do{} while(0);} - -/* 2.4.x introduced del_timer_sync() */ -#define del_timer_sync(timer) del_timer(timer) - -#else - -#define netif_down(dev) - -#endif /* SoftNet */ - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3)) - -/* - * Emit code to initialise a tq_struct's routine and data pointers - */ -#define PREPARE_TQUEUE(_tq, _routine, _data) \ - do { \ - (_tq)->routine = _routine; \ - (_tq)->data = _data; \ - } while (0) - -/* - * Emit code to initialise all of a tq_struct - */ -#define INIT_TQUEUE(_tq, _routine, _data) \ - do { \ - INIT_LIST_HEAD(&(_tq)->list); \ - (_tq)->sync = 0; \ - PREPARE_TQUEUE((_tq), (_routine), (_data)); \ - } while (0) - -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,6)) - -/* Power management related routines */ - -static inline int -pci_save_state(struct pci_dev *dev, u32 *buffer) -{ - int i; - if (buffer) { - for (i = 0; i < 16; i++) - pci_read_config_dword(dev, i * 4,&buffer[i]); - } - return 0; -} - -static inline int -pci_restore_state(struct pci_dev *dev, u32 *buffer) -{ - int i; - - if (buffer) { - for (i = 0; i < 16; i++) - pci_write_config_dword(dev,i * 4, buffer[i]); - } - /* - * otherwise, write the context information we know from bootup. - * This works around a problem where warm-booting from Windows - * combined with a D3(hot)->D0 transition causes PCI config - * header data to be forgotten. - */ - else { - for (i = 0; i < 6; i ++) - pci_write_config_dword(dev, - PCI_BASE_ADDRESS_0 + (i * 4), - pci_resource_start(dev, i)); - pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); - } - return 0; -} - -#endif /* PCI power management */ - -/* Old cp0 access macros deprecated in 2.4.19 */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19)) -#define read_c0_count() read_32bit_cp0_register(CP0_COUNT) -#endif - -/* Module refcount handled internally in 2.6.x */ -#ifndef SET_MODULE_OWNER -#define SET_MODULE_OWNER(dev) do {} while (0) -#define OLD_MOD_INC_USE_COUNT MOD_INC_USE_COUNT -#define OLD_MOD_DEC_USE_COUNT MOD_DEC_USE_COUNT -#else -#define OLD_MOD_INC_USE_COUNT do {} while (0) -#define OLD_MOD_DEC_USE_COUNT do {} while (0) -#endif - -#ifndef SET_NETDEV_DEV -#define SET_NETDEV_DEV(net, pdev) do {} while (0) -#endif - -#ifndef HAVE_FREE_NETDEV -#define free_netdev(dev) kfree(dev) -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) -/* struct packet_type redefined in 2.6.x */ -#define af_packet_priv data -#endif - -#endif /* _linuxver_h_ */ diff --git a/openwrt/package/linux/kernel-source/include/osl.h b/openwrt/package/linux/kernel-source/include/osl.h deleted file mode 100644 index f67290ecd8..0000000000 --- a/openwrt/package/linux/kernel-source/include/osl.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * OS Independent Layer - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * $Id$ - */ - -#ifndef _osl_h_ -#define _osl_h_ - -#ifdef V2_HAL -#include -#elif defined(linux) -#include -#elif PMON -#include -#elif defined(NDIS) -#include -#elif defined(_CFE_) -#include -#elif defined(MACOS9) -#include -#elif defined(MACOSX) -#include -#else -#error "Unsupported OSL requested" -#endif - -/* handy */ -#define SET_REG(r, mask, val) W_REG((r), ((R_REG(r) & ~(mask)) | (val))) - -#endif /* _osl_h_ */ diff --git a/openwrt/package/linux/kernel-source/include/pcicfg.h b/openwrt/package/linux/kernel-source/include/pcicfg.h deleted file mode 100644 index e440381218..0000000000 --- a/openwrt/package/linux/kernel-source/include/pcicfg.h +++ /dev/null @@ -1,369 +0,0 @@ -/* - * pcicfg.h: PCI configuration constants and structures. - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#ifndef _h_pci_ -#define _h_pci_ - -/* The following inside ifndef's so we don't collide with NTDDK.H */ -#ifndef PCI_MAX_BUS -#define PCI_MAX_BUS 0x100 -#endif -#ifndef PCI_MAX_DEVICES -#define PCI_MAX_DEVICES 0x20 -#endif -#ifndef PCI_MAX_FUNCTION -#define PCI_MAX_FUNCTION 0x8 -#endif - -#ifndef PCI_INVALID_VENDORID -#define PCI_INVALID_VENDORID 0xffff -#endif -#ifndef PCI_INVALID_DEVICEID -#define PCI_INVALID_DEVICEID 0xffff -#endif - - -/* Convert between bus-slot-function-register and config addresses */ - -#define PCICFG_BUS_SHIFT 16 /* Bus shift */ -#define PCICFG_SLOT_SHIFT 11 /* Slot shift */ -#define PCICFG_FUN_SHIFT 8 /* Function shift */ -#define PCICFG_OFF_SHIFT 0 /* Bus shift */ - -#define PCICFG_BUS_MASK 0xff /* Bus mask */ -#define PCICFG_SLOT_MASK 0x1f /* Slot mask */ -#define PCICFG_FUN_MASK 7 /* Function mask */ -#define PCICFG_OFF_MASK 0xff /* Bus mask */ - -#define PCI_CONFIG_ADDR(b, s, f, o) \ - ((((b) & PCICFG_BUS_MASK) << PCICFG_BUS_SHIFT) \ - | (((s) & PCICFG_SLOT_MASK) << PCICFG_SLOT_SHIFT) \ - | (((f) & PCICFG_FUN_MASK) << PCICFG_FUN_SHIFT) \ - | (((o) & PCICFG_OFF_MASK) << PCICFG_OFF_SHIFT)) - -#define PCI_CONFIG_BUS(a) (((a) >> PCICFG_BUS_SHIFT) & PCICFG_BUS_MASK) -#define PCI_CONFIG_SLOT(a) (((a) >> PCICFG_SLOT_SHIFT) & PCICFG_SLOT_MASK) -#define PCI_CONFIG_FUN(a) (((a) >> PCICFG_FUN_SHIFT) & PCICFG_FUN_MASK) -#define PCI_CONFIG_OFF(a) (((a) >> PCICFG_OFF_SHIFT) & PCICFG_OFF_MASK) - - -/* The actual config space */ - -#define PCI_BAR_MAX 6 - -#define PCI_ROM_BAR 8 - -#define PCR_RSVDA_MAX 2 - -typedef struct _pci_config_regs { - unsigned short vendor; - unsigned short device; - unsigned short command; - unsigned short status; - unsigned char rev_id; - unsigned char prog_if; - unsigned char sub_class; - unsigned char base_class; - unsigned char cache_line_size; - unsigned char latency_timer; - unsigned char header_type; - unsigned char bist; - unsigned long base[PCI_BAR_MAX]; - unsigned long cardbus_cis; - unsigned short subsys_vendor; - unsigned short subsys_id; - unsigned long baserom; - unsigned long rsvd_a[PCR_RSVDA_MAX]; - unsigned char int_line; - unsigned char int_pin; - unsigned char min_gnt; - unsigned char max_lat; - unsigned char dev_dep[192]; -} pci_config_regs; - -#define SZPCR (sizeof (pci_config_regs)) -#define MINSZPCR 64 /* offsetof (dev_dep[0] */ - -/* A structure for the config registers is nice, but in most - * systems the config space is not memory mapped, so we need - * filed offsetts. :-( - */ -#define PCI_CFG_VID 0 -#define PCI_CFG_DID 2 -#define PCI_CFG_CMD 4 -#define PCI_CFG_STAT 6 -#define PCI_CFG_REV 8 -#define PCI_CFG_PROGIF 9 -#define PCI_CFG_SUBCL 0xa -#define PCI_CFG_BASECL 0xb -#define PCI_CFG_CLSZ 0xc -#define PCI_CFG_LATTIM 0xd -#define PCI_CFG_HDR 0xe -#define PCI_CFG_BIST 0xf -#define PCI_CFG_BAR0 0x10 -#define PCI_CFG_BAR1 0x14 -#define PCI_CFG_BAR2 0x18 -#define PCI_CFG_BAR3 0x1c -#define PCI_CFG_BAR4 0x20 -#define PCI_CFG_BAR5 0x24 -#define PCI_CFG_CIS 0x28 -#define PCI_CFG_SVID 0x2c -#define PCI_CFG_SSID 0x2e -#define PCI_CFG_ROMBAR 0x30 -#define PCI_CFG_INT 0x3c -#define PCI_CFG_PIN 0x3d -#define PCI_CFG_MINGNT 0x3e -#define PCI_CFG_MAXLAT 0x3f - -/* Classes and subclasses */ - -typedef enum { - PCI_CLASS_OLD = 0, - PCI_CLASS_DASDI, - PCI_CLASS_NET, - PCI_CLASS_DISPLAY, - PCI_CLASS_MMEDIA, - PCI_CLASS_MEMORY, - PCI_CLASS_BRIDGE, - PCI_CLASS_COMM, - PCI_CLASS_BASE, - PCI_CLASS_INPUT, - PCI_CLASS_DOCK, - PCI_CLASS_CPU, - PCI_CLASS_SERIAL, - PCI_CLASS_INTELLIGENT = 0xe, - PCI_CLASS_SATELLITE, - PCI_CLASS_CRYPT, - PCI_CLASS_DSP, - PCI_CLASS_MAX -} pci_classes; - -typedef enum { - PCI_DASDI_SCSI, - PCI_DASDI_IDE, - PCI_DASDI_FLOPPY, - PCI_DASDI_IPI, - PCI_DASDI_RAID, - PCI_DASDI_OTHER = 0x80 -} pci_dasdi_subclasses; - -typedef enum { - PCI_NET_ETHER, - PCI_NET_TOKEN, - PCI_NET_FDDI, - PCI_NET_ATM, - PCI_NET_OTHER = 0x80 -} pci_net_subclasses; - -typedef enum { - PCI_DISPLAY_VGA, - PCI_DISPLAY_XGA, - PCI_DISPLAY_3D, - PCI_DISPLAY_OTHER = 0x80 -} pci_display_subclasses; - -typedef enum { - PCI_MMEDIA_VIDEO, - PCI_MMEDIA_AUDIO, - PCI_MMEDIA_PHONE, - PCI_MEDIA_OTHER = 0x80 -} pci_mmedia_subclasses; - -typedef enum { - PCI_MEMORY_RAM, - PCI_MEMORY_FLASH, - PCI_MEMORY_OTHER = 0x80 -} pci_memory_subclasses; - -typedef enum { - PCI_BRIDGE_HOST, - PCI_BRIDGE_ISA, - PCI_BRIDGE_EISA, - PCI_BRIDGE_MC, - PCI_BRIDGE_PCI, - PCI_BRIDGE_PCMCIA, - PCI_BRIDGE_NUBUS, - PCI_BRIDGE_CARDBUS, - PCI_BRIDGE_RACEWAY, - PCI_BRIDGE_OTHER = 0x80 -} pci_bridge_subclasses; - -typedef enum { - PCI_COMM_UART, - PCI_COMM_PARALLEL, - PCI_COMM_MULTIUART, - PCI_COMM_MODEM, - PCI_COMM_OTHER = 0x80 -} pci_comm_subclasses; - -typedef enum { - PCI_BASE_PIC, - PCI_BASE_DMA, - PCI_BASE_TIMER, - PCI_BASE_RTC, - PCI_BASE_PCI_HOTPLUG, - PCI_BASE_OTHER = 0x80 -} pci_base_subclasses; - -typedef enum { - PCI_INPUT_KBD, - PCI_INPUT_PEN, - PCI_INPUT_MOUSE, - PCI_INPUT_SCANNER, - PCI_INPUT_GAMEPORT, - PCI_INPUT_OTHER = 0x80 -} pci_input_subclasses; - -typedef enum { - PCI_DOCK_GENERIC, - PCI_DOCK_OTHER = 0x80 -} pci_dock_subclasses; - -typedef enum { - PCI_CPU_386, - PCI_CPU_486, - PCI_CPU_PENTIUM, - PCI_CPU_ALPHA = 0x10, - PCI_CPU_POWERPC = 0x20, - PCI_CPU_MIPS = 0x30, - PCI_CPU_COPROC = 0x40, - PCI_CPU_OTHER = 0x80 -} pci_cpu_subclasses; - -typedef enum { - PCI_SERIAL_IEEE1394, - PCI_SERIAL_ACCESS, - PCI_SERIAL_SSA, - PCI_SERIAL_USB, - PCI_SERIAL_FIBER, - PCI_SERIAL_SMBUS, - PCI_SERIAL_OTHER = 0x80 -} pci_serial_subclasses; - -typedef enum { - PCI_INTELLIGENT_I2O, -} pci_intelligent_subclasses; - -typedef enum { - PCI_SATELLITE_TV, - PCI_SATELLITE_AUDIO, - PCI_SATELLITE_VOICE, - PCI_SATELLITE_DATA, - PCI_SATELLITE_OTHER = 0x80 -} pci_satellite_subclasses; - -typedef enum { - PCI_CRYPT_NETWORK, - PCI_CRYPT_ENTERTAINMENT, - PCI_CRYPT_OTHER = 0x80 -} pci_crypt_subclasses; - -typedef enum { - PCI_DSP_DPIO, - PCI_DSP_OTHER = 0x80 -} pci_dsp_subclasses; - -/* Header types */ -typedef enum { - PCI_HEADER_NORMAL, - PCI_HEADER_BRIDGE, - PCI_HEADER_CARDBUS -} pci_header_types; - - -/* Overlay for a PCI-to-PCI bridge */ - -#define PPB_RSVDA_MAX 2 -#define PPB_RSVDD_MAX 8 - -typedef struct _ppb_config_regs { - unsigned short vendor; - unsigned short device; - unsigned short command; - unsigned short status; - unsigned char rev_id; - unsigned char prog_if; - unsigned char sub_class; - unsigned char base_class; - unsigned char cache_line_size; - unsigned char latency_timer; - unsigned char header_type; - unsigned char bist; - unsigned long rsvd_a[PPB_RSVDA_MAX]; - unsigned char prim_bus; - unsigned char sec_bus; - unsigned char sub_bus; - unsigned char sec_lat; - unsigned char io_base; - unsigned char io_lim; - unsigned short sec_status; - unsigned short mem_base; - unsigned short mem_lim; - unsigned short pf_mem_base; - unsigned short pf_mem_lim; - unsigned long pf_mem_base_hi; - unsigned long pf_mem_lim_hi; - unsigned short io_base_hi; - unsigned short io_lim_hi; - unsigned short subsys_vendor; - unsigned short subsys_id; - unsigned long rsvd_b; - unsigned char rsvd_c; - unsigned char int_pin; - unsigned short bridge_ctrl; - unsigned char chip_ctrl; - unsigned char diag_ctrl; - unsigned short arb_ctrl; - unsigned long rsvd_d[PPB_RSVDD_MAX]; - unsigned char dev_dep[192]; -} ppb_config_regs; - -/* Eveything below is BRCM HND proprietary */ - -#define PCI_BAR0_WIN 0x80 /* backplane addres space accessed by BAR0 */ -#define PCI_BAR1_WIN 0x84 /* backplane addres space accessed by BAR1 */ -#define PCI_SPROM_CONTROL 0x88 /* sprom property control */ -#define PCI_BAR1_CONTROL 0x8c /* BAR1 region burst control */ -#define PCI_INT_STATUS 0x90 /* PCI and other cores interrupts */ -#define PCI_INT_MASK 0x94 /* mask of PCI and other cores interrupts */ -#define PCI_TO_SB_MB 0x98 /* signal backplane interrupts */ -#define PCI_BACKPLANE_ADDR 0xA0 /* address an arbitrary location on the system backplane */ -#define PCI_BACKPLANE_DATA 0xA4 /* data at the location specified by above address register */ -#define PCI_GPIO_IN 0xb0 /* pci config space gpio input (>=rev3) */ -#define PCI_GPIO_OUT 0xb4 /* pci config space gpio output (>=rev3) */ -#define PCI_GPIO_OUTEN 0xb8 /* pci config space gpio output enable (>=rev3) */ - -#define PCI_BAR0_SPROM_OFFSET (4 * 1024) /* bar0 + 4K accesses external sprom */ -#define PCI_BAR0_PCIREGS_OFFSET (6 * 1024) /* bar0 + 6K accesses pci core registers */ - -/* PCI_INT_STATUS */ -#define PCI_SBIM_STATUS_SERR 0x4 /* backplane SBErr interrupt status */ - -/* PCI_INT_MASK */ -#define PCI_SBIM_SHIFT 8 /* backplane core interrupt mask bits offset */ -#define PCI_SBIM_MASK 0xff00 /* backplane core interrupt mask */ -#define PCI_SBIM_MASK_SERR 0x4 /* backplane SBErr interrupt mask */ - -/* PCI_SPROM_CONTROL */ -#define SPROM_BLANK 0x04 /* indicating a blank sprom */ -#define SPROM_WRITEEN 0x10 /* sprom write enable */ -#define SPROM_BOOTROM_WE 0x20 /* external bootrom write enable */ - -#define SPROM_SIZE 256 /* sprom size in 16-bit */ -#define SPROM_CRC_RANGE 64 /* crc cover range in 16-bit */ - -/* PCI_CFG_CMD_STAT */ -#define PCI_CFG_CMD_STAT_TA 0x08000000 /* target abort status */ - -#endif diff --git a/openwrt/package/linux/kernel-source/include/proto/802.11.h b/openwrt/package/linux/kernel-source/include/proto/802.11.h deleted file mode 100644 index ea57850ce5..0000000000 --- a/openwrt/package/linux/kernel-source/include/proto/802.11.h +++ /dev/null @@ -1,852 +0,0 @@ -/* - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * Fundamental types and constants relating to 802.11 - * - * $Id$ - */ - -#ifndef _802_11_H_ -#define _802_11_H_ - -#ifndef _TYPEDEFS_H_ -#include -#endif - -#ifndef _NET_ETHERNET_H_ -#include -#endif - -/* enable structure packing */ -#if !defined(__GNUC__) -#pragma pack(1) -#endif - -/* some platforms require stronger medicine */ -#if defined(__GNUC__) -#define PACKED __attribute__((packed)) -#else -#define PACKED -#endif - - -#define DOT11_TU_TO_US 1024 /* 802.11 Time Unit is 1024 microseconds */ - -/* Generic 802.11 frame constants */ -#define DOT11_A3_HDR_LEN 24 -#define DOT11_A4_HDR_LEN 30 -#define DOT11_MAC_HDR_LEN DOT11_A3_HDR_LEN -#define DOT11_FCS_LEN 4 -#define DOT11_ICV_LEN 4 -#define DOT11_ICV_AES_LEN 8 -#define DOT11_QOS_LEN 2 - -#define DOT11_KEY_INDEX_SHIFT 6 -#define DOT11_IV_LEN 4 -#define DOT11_IV_TKIP_LEN 8 -#define DOT11_IV_AES_OCB_LEN 4 -#define DOT11_IV_AES_CCM_LEN 8 - -/* Includes MIC */ -#define DOT11_MAX_MPDU_BODY_LEN 2304 -/* A4 header + QoS + CCMP + PDU + ICV + FCS = 2352 */ -#define DOT11_MAX_MPDU_LEN (DOT11_A4_HDR_LEN + \ - DOT11_QOS_LEN + \ - DOT11_IV_AES_CCM_LEN + \ - DOT11_MAX_MPDU_BODY_LEN + \ - DOT11_ICV_LEN + \ - DOT11_FCS_LEN) - -#define DOT11_MAX_SSID_LEN 32 - -/* dot11RTSThreshold */ -#define DOT11_DEFAULT_RTS_LEN 2347 -#define DOT11_MAX_RTS_LEN 2347 - -/* dot11FragmentationThreshold */ -#define DOT11_MIN_FRAG_LEN 256 -#define DOT11_MAX_FRAG_LEN 2346 /* Max frag is also limited by aMPDUMaxLength of the attached PHY */ -#define DOT11_DEFAULT_FRAG_LEN 2346 - -/* dot11BeaconPeriod */ -#define DOT11_MIN_BEACON_PERIOD 1 -#define DOT11_MAX_BEACON_PERIOD 0xFFFF - -/* dot11DTIMPeriod */ -#define DOT11_MIN_DTIM_PERIOD 1 -#define DOT11_MAX_DTIM_PERIOD 0xFF - -/* 802.2 LLC/SNAP header used by 802.11 per 802.1H */ -#define DOT11_LLC_SNAP_HDR_LEN 8 -#define DOT11_OUI_LEN 3 -struct dot11_llc_snap_header { - uint8 dsap; /* always 0xAA */ - uint8 ssap; /* always 0xAA */ - uint8 ctl; /* always 0x03 */ - uint8 oui[DOT11_OUI_LEN]; /* RFC1042: 0x00 0x00 0x00 - Bridge-Tunnel: 0x00 0x00 0xF8 */ - uint16 type; /* ethertype */ -} PACKED; - -/* RFC1042 header used by 802.11 per 802.1H */ -#define RFC1042_HDR_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN) - -/* Generic 802.11 MAC header */ -/* - * N.B.: This struct reflects the full 4 address 802.11 MAC header. - * The fields are defined such that the shorter 1, 2, and 3 - * address headers just use the first k fields. - */ -struct dot11_header { - uint16 fc; /* frame control */ - uint16 durid; /* duration/ID */ - struct ether_addr a1; /* address 1 */ - struct ether_addr a2; /* address 2 */ - struct ether_addr a3; /* address 3 */ - uint16 seq; /* sequence control */ - struct ether_addr a4; /* address 4 */ -} PACKED; - -/* Control frames */ - -struct dot11_rts_frame { - uint16 fc; /* frame control */ - uint16 durid; /* duration/ID */ - struct ether_addr ra; /* receiver address */ - struct ether_addr ta; /* transmitter address */ -} PACKED; -#define DOT11_RTS_LEN 16 - -struct dot11_cts_frame { - uint16 fc; /* frame control */ - uint16 durid; /* duration/ID */ - struct ether_addr ra; /* receiver address */ -} PACKED; -#define DOT11_CTS_LEN 10 - -struct dot11_ack_frame { - uint16 fc; /* frame control */ - uint16 durid; /* duration/ID */ - struct ether_addr ra; /* receiver address */ -} PACKED; -#define DOT11_ACK_LEN 10 - -struct dot11_ps_poll_frame { - uint16 fc; /* frame control */ - uint16 durid; /* AID */ - struct ether_addr bssid; /* receiver address, STA in AP */ - struct ether_addr ta; /* transmitter address */ -} PACKED; -#define DOT11_PS_POLL_LEN 16 - -struct dot11_cf_end_frame { - uint16 fc; /* frame control */ - uint16 durid; /* duration/ID */ - struct ether_addr ra; /* receiver address */ - struct ether_addr bssid; /* transmitter address, STA in AP */ -} PACKED; -#define DOT11_CS_END_LEN 16 - -/* Management frame header */ -struct dot11_management_header { - uint16 fc; /* frame control */ - uint16 durid; /* duration/ID */ - struct ether_addr da; /* receiver address */ - struct ether_addr sa; /* transmitter address */ - struct ether_addr bssid; /* BSS ID */ - uint16 seq; /* sequence control */ -} PACKED; -#define DOT11_MGMT_HDR_LEN 24 - -/* Management frame payloads */ - -struct dot11_bcn_prb { - uint32 timestamp[2]; - uint16 beacon_interval; - uint16 capability; -} PACKED; -#define DOT11_BCN_PRB_LEN 12 - -struct dot11_auth { - uint16 alg; /* algorithm */ - uint16 seq; /* sequence control */ - uint16 status; /* status code */ -} PACKED; -#define DOT11_AUTH_FIXED_LEN 6 /* length of auth frame without challenge info elt */ - -struct dot11_assoc_req { - uint16 capability; /* capability information */ - uint16 listen; /* listen interval */ -} PACKED; - -struct dot11_assoc_resp { - uint16 capability; /* capability information */ - uint16 status; /* status code */ - uint16 aid; /* association ID */ -} PACKED; - -struct dot11_action_measure { - uint8 category; - uint8 action; - uint8 token; - uint8 data[1]; -} PACKED; -#define DOT11_ACTION_MEASURE_LEN 3 - -/************** - 802.11h related definitions. -**************/ -typedef struct { - uint8 id; - uint8 len; - uint8 power; -} dot11_power_cnst_t; - -typedef struct { - uint8 min; - uint8 max; -} dot11_power_cap_t; - -typedef struct { - uint8 id; - uint8 len; - uint8 tx_pwr; - uint8 margin; -} dot11_tpc_rep_t; -#define DOT11_MNG_IE_TPC_REPORT_LEN 2 /* length of IE data, not including 2 byte header */ - -typedef struct { - uint8 id; - uint8 len; - uint8 first_channel; - uint8 num_channels; -} dot11_supp_channels_t; - -struct dot11_channel_switch { - uint8 id; - uint8 len; - uint8 mode; - uint8 channel; - uint8 count; -} PACKED; -typedef struct dot11_channel_switch dot11_channel_switch_t; - -/* 802.11h Measurement Request/Report IEs */ -/* Measurement Type field */ -#define DOT11_MEASURE_TYPE_BASIC 0 -#define DOT11_MEASURE_TYPE_CCA 1 -#define DOT11_MEASURE_TYPE_RPI 2 - -/* Measurement Mode field */ - -/* Measurement Request Modes */ -#define DOT11_MEASURE_MODE_ENABLE (1<<1) -#define DOT11_MEASURE_MODE_REQUEST (1<<2) -#define DOT11_MEASURE_MODE_REPORT (1<<3) -/* Measurement Report Modes */ -#define DOT11_MEASURE_MODE_LATE (1<<0) -#define DOT11_MEASURE_MODE_INCAPABLE (1<<1) -#define DOT11_MEASURE_MODE_REFUSED (1<<2) -/* Basic Measurement Map bits */ -#define DOT11_MEASURE_BASIC_MAP_BSS ((uint8)(1<<0)) -#define DOT11_MEASURE_BASIC_MAP_OFDM ((uint8)(1<<1)) -#define DOT11_MEASURE_BASIC_MAP_UKNOWN ((uint8)(1<<2)) -#define DOT11_MEASURE_BASIC_MAP_RADAR ((uint8)(1<<3)) -#define DOT11_MEASURE_BASIC_MAP_UNMEAS ((uint8)(1<<4)) - -typedef struct { - uint8 id; - uint8 len; - uint8 token; - uint8 mode; - uint8 type; - uint8 channel; - uint8 start_time[8]; - uint16 duration; -} dot11_meas_req_t; -#define DOT11_MNG_IE_MREQ_LEN 14 -/* length of Measure Request IE data not including variable len */ -#define DOT11_MNG_IE_MREQ_FIXED_LEN 3 - -struct dot11_meas_rep { - uint8 id; - uint8 len; - uint8 token; - uint8 mode; - uint8 type; - union - { - struct { - uint8 channel; - uint8 start_time[8]; - uint16 duration; - uint8 map; - } PACKED basic; - uint8 data[1]; - } PACKED rep; -} PACKED; -typedef struct dot11_meas_rep dot11_meas_rep_t; - -/* length of Measure Report IE data not including variable len */ -#define DOT11_MNG_IE_MREP_FIXED_LEN 3 - -struct dot11_meas_rep_basic { - uint8 channel; - uint8 start_time[8]; - uint16 duration; - uint8 map; -} PACKED; -typedef struct dot11_meas_rep_basic dot11_meas_rep_basic_t; -#define DOT11_MEASURE_BASIC_REP_LEN 12 - -struct dot11_quiet { - uint8 id; - uint8 len; - uint8 count; /* TBTTs until beacon interval in quiet starts */ - uint8 period; /* Beacon intervals between periodic quiet periods ? */ - uint16 duration;/* Length of quiet period, in TU's */ - uint16 offset; /* TU's offset from TBTT in Count field */ -} PACKED; -typedef struct dot11_quiet dot11_quiet_t; - -typedef struct { - uint8 channel; - uint8 map; -} chan_map_tuple_t; - -typedef struct { - uint8 id; - uint8 len; - uint8 eaddr[ETHER_ADDR_LEN]; - uint8 interval; - chan_map_tuple_t map[1]; -} dot11_ibss_dfs_t; - -/* WME Elements */ -#define WME_OUI "\x00\x50\xf2" -#define WME_VER 1 -#define WME_TYPE 2 -#define WME_SUBTYPE_IE 0 /* Information Element */ -#define WME_SUBTYPE_PARAM_IE 1 /* Parameter Element */ -#define WME_SUBTYPE_TSPEC 2 /* Traffic Specification */ - -/* WME Access Category Indices (ACIs) */ -#define AC_BE 0 /* Best Effort */ -#define AC_BK 1 /* Background */ -#define AC_VI 2 /* Video */ -#define AC_VO 3 /* Voice */ -#define AC_MAX 4 - -/* WME Information Element (IE) */ -struct wme_ie { - uint8 oui[3]; - uint8 type; - uint8 subtype; - uint8 version; - uint8 acinfo; -} PACKED; -typedef struct wme_ie wme_ie_t; -#define WME_IE_LEN 7 - -struct wme_acparam { - uint8 ACI; - uint8 ECW; - uint16 TXOP; /* stored in network order (ls octet first) */ -} PACKED; -typedef struct wme_acparam wme_acparam_t; - -/* WME Parameter Element (PE) */ -struct wme_params { - uint8 oui[3]; - uint8 type; - uint8 subtype; - uint8 version; - uint8 acinfo; - uint8 rsvd; - wme_acparam_t acparam[4]; -} PACKED; -typedef struct wme_params wme_params_t; -#define WME_PARAMS_IE_LEN 24 - -/* acinfo */ -#define WME_COUNT_MASK 0x0f -/* ACI */ -#define WME_AIFS_MASK 0x0f -#define WME_ACM_MASK 0x10 -#define WME_ACI_MASK 0x60 -#define WME_ACI_SHIFT 5 -/* ECW */ -#define WME_CWMIN_MASK 0x0f -#define WME_CWMAX_MASK 0xf0 -#define WME_CWMAX_SHIFT 4 - -#define WME_TXOP_UNITS 32 - -/* WME Traffic Specification (TSPEC) element */ -#define WME_SUBTYPE_TSPEC 2 -#define WME_TSPEC_HDR_LEN 2 -#define WME_TSPEC_BODY_OFF 2 -struct wme_tspec { - uint8 oui[DOT11_OUI_LEN]; /* WME_OUI */ - uint8 type; /* WME_TYPE */ - uint8 subtype; /* WME_SUBTYPE_TSPEC */ - uint8 version; /* WME_VERSION */ - uint16 ts_info; /* TS Info */ - uint16 nom_msdu_size; /* (Nominal or fixed) MSDU Size (bytes) */ - uint16 max_msdu_size; /* Maximum MSDU Size (bytes) */ - uint32 min_service_interval; /* Minimum Service Interval (us) */ - uint32 max_service_interval; /* Maximum Service Interval (us) */ - uint32 inactivity_interval; /* Inactivity Interval (us) */ - uint32 service_start; /* Service Start Time (us) */ - uint32 min_rate; /* Minimum Data Rate (bps) */ - uint32 mean_rate; /* Mean Data Rate (bps) */ - uint32 max_burst_size; /* Maximum Burst Size (bytes) */ - uint32 min_phy_rate; /* Minimum PHY Rate (bps) */ - uint32 peak_rate; /* Peak Data Rate (bps) */ - uint32 delay_bound; /* Delay Bound (us) */ - uint16 surplus_bandwidth; /* Surplus Bandwidth Allowance Factor */ - uint16 medium_time; /* Medium Time (32 us/s periods) */ -} PACKED; -typedef struct wme_tspec wme_tspec_t; -#define WME_TSPEC_LEN 56 /* not including 2-byte header */ - -/* ts_info */ -/* 802.1D priority is duplicated - bits 13-11 AND bits 3-1 */ -#define TS_INFO_PRIO_SHIFT_HI 11 -#define TS_INFO_PRIO_MASK_HI (0x7 << TS_INFO_PRIO_SHIFT_HI) -#define TS_INFO_PRIO_SHIFT_LO 1 -#define TS_INFO_PRIO_MASK_LO (0x7 << TS_INFO_PRIO_SHIFT_LO) -#define TS_INFO_CONTENTION_SHIFT 7 -#define TS_INFO_CONTENTION_MASK (0x1 << TS_INFO_CONTENTION_SHIFT) -#define TS_INFO_DIRECTION_SHIFT 5 -#define TS_INFO_DIRECTION_MASK (0x3 << TS_INFO_DIRECTION_SHIFT) -#define TS_INFO_UPLINK (0 << TS_INFO_DIRECTION_SHIFT) -#define TS_INFO_DOWNLINK (1 << TS_INFO_DIRECTION_SHIFT) -#define TS_INFO_BIDIRECTIONAL (3 << TS_INFO_DIRECTION_SHIFT) - -/* nom_msdu_size */ -#define FIXED_MSDU_SIZE 0x8000 /* MSDU size is fixed */ -#define MSDU_SIZE_MASK 0x7fff /* (Nominal or fixed) MSDU size */ - -/* surplus_bandwidth */ -/* Represented as 3 bits of integer, binary point, 13 bits fraction */ -#define INTEGER_SHIFT 13 -#define FRACTION_MASK 0x1FFF - -/* Management Notification Frame */ -struct dot11_management_notification { - uint8 category; /* DOT11_ACTION_NOTIFICATION */ - uint8 action; - uint8 token; - uint8 status; - uint8 data[1]; /* Elements */ -} PACKED; -#define DOT11_MGMT_NOTIFICATION_LEN 4 /* Fixed length */ - -/* WME Action Codes */ -#define WME_SETUP_REQUEST 0 -#define WME_SETUP_RESPONSE 1 -#define WME_TEARDOWN 2 - -/* WME Setup Response Status Codes */ -#define WME_ADMISSION_ACCEPTED 0 -#define WME_INVALID_PARAMETERS 1 -#define WME_ADMISSION_REFUSED 3 - -/* Macro to take a pointer to a beacon or probe response - * header and return the char* pointer to the SSID info element - */ -#define BCN_PRB_SSID(hdr) ((char*)(hdr) + DOT11_MGMT_HDR_LEN + DOT11_BCN_PRB_LEN) - -/* Authentication frame payload constants */ -#define DOT11_OPEN_SYSTEM 0 -#define DOT11_SHARED_KEY 1 -#define DOT11_CHALLENGE_LEN 128 - -/* Frame control macros */ -#define FC_PVER_MASK 0x3 -#define FC_PVER_SHIFT 0 -#define FC_TYPE_MASK 0xC -#define FC_TYPE_SHIFT 2 -#define FC_SUBTYPE_MASK 0xF0 -#define FC_SUBTYPE_SHIFT 4 -#define FC_TODS 0x100 -#define FC_TODS_SHIFT 8 -#define FC_FROMDS 0x200 -#define FC_FROMDS_SHIFT 9 -#define FC_MOREFRAG 0x400 -#define FC_MOREFRAG_SHIFT 10 -#define FC_RETRY 0x800 -#define FC_RETRY_SHIFT 11 -#define FC_PM 0x1000 -#define FC_PM_SHIFT 12 -#define FC_MOREDATA 0x2000 -#define FC_MOREDATA_SHIFT 13 -#define FC_WEP 0x4000 -#define FC_WEP_SHIFT 14 -#define FC_ORDER 0x8000 -#define FC_ORDER_SHIFT 15 - -/* sequence control macros */ -#define SEQNUM_SHIFT 4 -#define FRAGNUM_MASK 0xF - -/* Frame Control type/subtype defs */ - -/* FC Types */ -#define FC_TYPE_MNG 0 -#define FC_TYPE_CTL 1 -#define FC_TYPE_DATA 2 - -/* Management Subtypes */ -#define FC_SUBTYPE_ASSOC_REQ 0 -#define FC_SUBTYPE_ASSOC_RESP 1 -#define FC_SUBTYPE_REASSOC_REQ 2 -#define FC_SUBTYPE_REASSOC_RESP 3 -#define FC_SUBTYPE_PROBE_REQ 4 -#define FC_SUBTYPE_PROBE_RESP 5 -#define FC_SUBTYPE_BEACON 8 -#define FC_SUBTYPE_ATIM 9 -#define FC_SUBTYPE_DISASSOC 10 -#define FC_SUBTYPE_AUTH 11 -#define FC_SUBTYPE_DEAUTH 12 -#define FC_SUBTYPE_ACTION 13 - -/* Control Subtypes */ -#define FC_SUBTYPE_PS_POLL 10 -#define FC_SUBTYPE_RTS 11 -#define FC_SUBTYPE_CTS 12 -#define FC_SUBTYPE_ACK 13 -#define FC_SUBTYPE_CF_END 14 -#define FC_SUBTYPE_CF_END_ACK 15 - -/* Data Subtypes */ -#define FC_SUBTYPE_DATA 0 -#define FC_SUBTYPE_DATA_CF_ACK 1 -#define FC_SUBTYPE_DATA_CF_POLL 2 -#define FC_SUBTYPE_DATA_CF_ACK_POLL 3 -#define FC_SUBTYPE_NULL 4 -#define FC_SUBTYPE_CF_ACK 5 -#define FC_SUBTYPE_CF_POLL 6 -#define FC_SUBTYPE_CF_ACK_POLL 7 -#define FC_SUBTYPE_QOS_DATA 8 -#define FC_SUBTYPE_QOS_NULL 12 - -/* type-subtype combos */ -#define FC_KIND_MASK (FC_TYPE_MASK | FC_SUBTYPE_MASK) - -#define FC_KIND(t, s) (((t) << FC_TYPE_SHIFT) | ((s) << FC_SUBTYPE_SHIFT)) - -#define FC_ASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_REQ) -#define FC_ASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_RESP) -#define FC_REASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_REQ) -#define FC_REASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_RESP) -#define FC_PROBE_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_REQ) -#define FC_PROBE_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_RESP) -#define FC_BEACON FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_BEACON) -#define FC_DISASSOC FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DISASSOC) -#define FC_AUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_AUTH) -#define FC_DEAUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DEAUTH) -#define FC_ACTION FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION) - -#define FC_PS_POLL FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_PS_POLL) -#define FC_RTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_RTS) -#define FC_CTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTS) -#define FC_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_ACK) -#define FC_CF_END FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END) -#define FC_CF_END_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END_ACK) - -#define FC_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA) -#define FC_NULL_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_NULL) -#define FC_DATA_CF_ACK FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA_CF_ACK) -#define FC_QOS_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_DATA) -#define FC_QOS_NULL FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_NULL) - -/* QoS Control Field */ - -/* 802.1D Tag */ -#define QOS_PRIO_SHIFT 0 -#define QOS_PRIO_MASK 0x0007 -#define QOS_PRIO(qos) (((qos) & QOS_PRIO_MASK) >> QOS_PRIO_SHIFT) - -/* Ack Policy (0 means Acknowledge) */ -#define QOS_ACK_SHIFT 5 -#define QOS_ACK_MASK 0x0060 -#define QOS_ACK(qos) (((qos) & QOS_ACK_MASK) >> QOS_ACK_SHIFT) - -/* Management Frames */ - -/* Management Frame Constants */ - -/* Fixed fields */ -#define DOT11_MNG_AUTH_ALGO_LEN 2 -#define DOT11_MNG_AUTH_SEQ_LEN 2 -#define DOT11_MNG_BEACON_INT_LEN 2 -#define DOT11_MNG_CAP_LEN 2 -#define DOT11_MNG_AP_ADDR_LEN 6 -#define DOT11_MNG_LISTEN_INT_LEN 2 -#define DOT11_MNG_REASON_LEN 2 -#define DOT11_MNG_AID_LEN 2 -#define DOT11_MNG_STATUS_LEN 2 -#define DOT11_MNG_TIMESTAMP_LEN 8 - -/* DUR/ID field in assoc resp is 0xc000 | AID */ -#define DOT11_AID_MASK 0x3fff - -/* Reason Codes */ -#define DOT11_RC_RESERVED 0 -#define DOT11_RC_UNSPECIFIED 1 /* Unspecified reason */ -#define DOT11_RC_AUTH_INVAL 2 /* Previous authentication no longer valid */ -#define DOT11_RC_DEAUTH_LEAVING 3 /* Deauthenticated because sending station is - leaving (or has left) IBSS or ESS */ -#define DOT11_RC_INACTIVITY 4 /* Disassociated due to inactivity */ -#define DOT11_RC_BUSY 5 /* Disassociated because AP is unable to handle - all currently associated stations */ -#define DOT11_RC_INVAL_CLASS_2 6 /* Class 2 frame received from - nonauthenticated station */ -#define DOT11_RC_INVAL_CLASS_3 7 /* Class 3 frame received from - nonassociated station */ -#define DOT11_RC_DISASSOC_LEAVING 8 /* Disassociated because sending station is - leaving (or has left) BSS */ -#define DOT11_RC_NOT_AUTH 9 /* Station requesting (re)association is - not authenticated with responding station */ -#define DOT11_RC_MAX 23 /* Reason codes > 23 are reserved */ - -/* Status Codes */ -#define DOT11_STATUS_SUCCESS 0 /* Successful */ -#define DOT11_STATUS_FAILURE 1 /* Unspecified failure */ -#define DOT11_STATUS_CAP_MISMATCH 10 /* Cannot support all requested capabilities - in the Capability Information field */ -#define DOT11_STATUS_REASSOC_FAIL 11 /* Reassociation denied due to inability to - confirm that association exists */ -#define DOT11_STATUS_ASSOC_FAIL 12 /* Association denied due to reason outside - the scope of this standard */ -#define DOT11_STATUS_AUTH_MISMATCH 13 /* Responding station does not support the - specified authentication algorithm */ -#define DOT11_STATUS_AUTH_SEQ 14 /* Received an Authentication frame with - authentication transaction sequence number - out of expected sequence */ -#define DOT11_STATUS_AUTH_CHALLENGE_FAIL 15 /* Authentication rejected because of challenge failure */ -#define DOT11_STATUS_AUTH_TIMEOUT 16 /* Authentication rejected due to timeout waiting - for next frame in sequence */ -#define DOT11_STATUS_ASSOC_BUSY_FAIL 17 /* Association denied because AP is unable to - handle additional associated stations */ -#define DOT11_STATUS_ASSOC_RATE_MISMATCH 18 /* Association denied due to requesting station - not supporting all of the data rates in the - BSSBasicRateSet parameter */ -#define DOT11_STATUS_ASSOC_SHORT_REQUIRED 19 /* Association denied due to requesting station - not supporting the Short Preamble option */ -#define DOT11_STATUS_ASSOC_PBCC_REQUIRED 20 /* Association denied due to requesting station - not supporting the PBCC Modulation option */ -#define DOT11_STATUS_ASSOC_AGILITY_REQUIRED 21 /* Association denied due to requesting station - not supporting the Channel Agility option */ -#define DOT11_STATUS_ASSOC_SPECTRUM_REQUIRED 22 /* Association denied because Spectrum Management - capability is required. */ -#define DOT11_STATUS_ASSOC_BAD_POWER_CAP 23 /* Association denied because the info in the - Power Cap element is unacceptable. */ -#define DOT11_STATUS_ASSOC_BAD_SUP_CHANNELS 24 /* Association denied because the info in the - Supported Channel element is unacceptable */ -#define DOT11_STATUS_ASSOC_SHORTSLOT_REQUIRED 25 /* Association denied due to requesting station - not supporting the Short Slot Time option */ -#define DOT11_STATUS_ASSOC_ERPBCC_REQUIRED 26 /* Association denied due to requesting station - not supporting the ER-PBCC Modulation option */ -#define DOT11_STATUS_ASSOC_DSSOFDM_REQUIRED 27 /* Association denied due to requesting station - not supporting the DSS-OFDM option */ - -/* Info Elts, length of INFORMATION portion of Info Elts */ -#define DOT11_MNG_DS_PARAM_LEN 1 -#define DOT11_MNG_IBSS_PARAM_LEN 2 - -/* TIM Info element has 3 bytes fixed info in INFORMATION field, - * followed by 1 to 251 bytes of Partial Virtual Bitmap */ -#define DOT11_MNG_TIM_FIXED_LEN 3 -#define DOT11_MNG_TIM_DTIM_COUNT 0 -#define DOT11_MNG_TIM_DTIM_PERIOD 1 -#define DOT11_MNG_TIM_BITMAP_CTL 2 -#define DOT11_MNG_TIM_PVB 3 - -/* TLV defines */ -#define TLV_TAG_OFF 0 -#define TLV_LEN_OFF 1 -#define TLV_HDR_LEN 2 -#define TLV_BODY_OFF 2 - -/* Management Frame Information Element IDs */ -#define DOT11_MNG_SSID_ID 0 -#define DOT11_MNG_RATES_ID 1 -#define DOT11_MNG_FH_PARMS_ID 2 -#define DOT11_MNG_DS_PARMS_ID 3 -#define DOT11_MNG_CF_PARMS_ID 4 -#define DOT11_MNG_TIM_ID 5 -#define DOT11_MNG_IBSS_PARMS_ID 6 -#define DOT11_MNG_COUNTRY_ID 7 -#define DOT11_MNG_HOPPING_PARMS_ID 8 -#define DOT11_MNG_HOPPING_TABLE_ID 9 -#define DOT11_MNG_REQUEST_ID 10 -#define DOT11_MNG_CHALLENGE_ID 16 -#define DOT11_MNG_PWR_CONSTRAINT_ID 32 /* 11H PowerConstraint */ -#define DOT11_MNG_PWR_CAP_ID 33 /* 11H PowerCapability */ -#define DOT11_MNG_TPC_REQUEST_ID 34 /* 11H TPC Request */ -#define DOT11_MNG_TPC_REPORT_ID 35 /* 11H TPC Report */ -#define DOT11_MNG_SUPP_CHANNELS_ID 36 /* 11H Supported Channels */ -#define DOT11_MNG_CHANNEL_SWITCH_ID 37 /* 11H ChannelSwitch Announcement*/ -#define DOT11_MNG_MEASURE_REQUEST_ID 38 /* 11H MeasurementRequest */ -#define DOT11_MNG_MEASURE_REPORT_ID 39 /* 11H MeasurementReport */ -#define DOT11_MNG_QUIET_ID 40 /* 11H Quiet */ -#define DOT11_MNG_IBSS_DFS_ID 41 /* 11H IBSS_DFS */ -#define DOT11_MNG_ERP_ID 42 -#define DOT11_MNG_NONERP_ID 47 -#define DOT11_MNG_EXT_RATES_ID 50 -#define DOT11_MNG_WPA_ID 221 -#define DOT11_MNG_PROPR_ID 221 - -/* ERP info element bit values */ -#define DOT11_MNG_ERP_LEN 1 /* ERP is currently 1 byte long */ -#define DOT11_MNG_NONERP_PRESENT 0x01 /* NonERP (802.11b) STAs are present in the BSS */ -#define DOT11_MNG_USE_PROTECTION 0x02 /* Use protection mechanisms for ERP-OFDM frames */ -#define DOT11_MNG_BARKER_PREAMBLE 0x04 /* Short Preambles: 0 == allowed, 1 == not allowed */ - -/* Capability Information Field */ -#define DOT11_CAP_ESS 0x0001 -#define DOT11_CAP_IBSS 0x0002 -#define DOT11_CAP_POLLABLE 0x0004 -#define DOT11_CAP_POLL_RQ 0x0008 -#define DOT11_CAP_PRIVACY 0x0010 -#define DOT11_CAP_SHORT 0x0020 -#define DOT11_CAP_PBCC 0x0040 -#define DOT11_CAP_AGILITY 0x0080 -#define DOT11_CAP_SPECTRUM 0x0100 -#define DOT11_CAP_SHORTSLOT 0x0400 -#define DOT11_CAP_CCK_OFDM 0x2000 - -/* Action Frame Constants */ -#define DOT11_ACTION_CAT_ERR_MASK 0x80 -#define DOT11_ACTION_CAT_SPECT_MNG 0x00 -#define DOT11_ACTION_NOTIFICATION 0x11 /* 17 */ - -#define DOT11_ACTION_ID_M_REQ 0 -#define DOT11_ACTION_ID_M_REP 1 -#define DOT11_ACTION_ID_TPC_REQ 2 -#define DOT11_ACTION_ID_TPC_REP 3 -#define DOT11_ACTION_ID_CHANNEL_SWITCH 4 - -/* MLME Enumerations */ -#define DOT11_BSSTYPE_INFRASTRUCTURE 0 -#define DOT11_BSSTYPE_INDEPENDENT 1 -#define DOT11_BSSTYPE_ANY 2 -#define DOT11_SCANTYPE_ACTIVE 0 -#define DOT11_SCANTYPE_PASSIVE 1 - -/* 802.11 A PHY constants */ -#define APHY_SLOT_TIME 9 -#define APHY_SIFS_TIME 16 -#define APHY_DIFS_TIME (APHY_SIFS_TIME + (2 * APHY_SLOT_TIME)) -#define APHY_PREAMBLE_TIME 16 -#define APHY_SIGNAL_TIME 4 -#define APHY_SYMBOL_TIME 4 -#define APHY_SERVICE_NBITS 16 -#define APHY_TAIL_NBITS 6 -#define APHY_CWMIN 15 - -/* 802.11 B PHY constants */ -#define BPHY_SLOT_TIME 20 -#define BPHY_SIFS_TIME 10 -#define BPHY_DIFS_TIME 50 -#define BPHY_PLCP_TIME 192 -#define BPHY_PLCP_SHORT_TIME 96 -#define BPHY_CWMIN 31 - -/* 802.11 G constants */ -#define DOT11_OFDM_SIGNAL_EXTENSION 6 - -#define PHY_CWMAX 1023 - -#define DOT11_MAXNUMFRAGS 16 /* max # fragments per MSDU */ - -/* dot11Counters Table - 802.11 spec., Annex D */ -typedef struct d11cnt { - uint32 txfrag; /* dot11TransmittedFragmentCount */ - uint32 txmulti; /* dot11MulticastTransmittedFrameCount */ - uint32 txfail; /* dot11FailedCount */ - uint32 txretry; /* dot11RetryCount */ - uint32 txretrie; /* dot11MultipleRetryCount */ - uint32 rxdup; /* dot11FrameduplicateCount */ - uint32 txrts; /* dot11RTSSuccessCount */ - uint32 txnocts; /* dot11RTSFailureCount */ - uint32 txnoack; /* dot11ACKFailureCount */ - uint32 rxfrag; /* dot11ReceivedFragmentCount */ - uint32 rxmulti; /* dot11MulticastReceivedFrameCount */ - uint32 rxcrc; /* dot11FCSErrorCount */ - uint32 txfrmsnt; /* dot11TransmittedFrameCount */ - uint32 rxundec; /* dot11WEPUndecryptableCount */ -} d11cnt_t; - -/* BRCM OUI */ -#define BRCM_OUI "\x00\x10\x18" - -/* BRCM info element */ -struct brcm_ie { - uchar id; - uchar len; - uchar oui[3]; - uchar ver; - uchar assoc; /* # of assoc STAs */ - uchar flags; /* misc flags */ -} PACKED; -#define BRCM_IE_LEN 8 -typedef struct brcm_ie brcm_ie_t; -#define BRCM_IE_VER 1 - -/* brcm_ie flags */ -#define BRF_ABCAP 0x1 /* afterburner capable */ -#define BRF_ABRQRD 0x2 /* afterburner requested */ - -/* WPA definitions */ -#define WPA_VERSION 1 -#define WPA_OUI "\x00\x50\xF2" - -#define WPA_OUI_LEN 3 - -/* WPA authentication modes */ -#define WPA_AUTH_NONE 0 /* None */ -#define WPA_AUTH_UNSPECIFIED 1 /* Unspecified authentication over 802.1X: default for WPA */ -#define WPA_AUTH_PSK 2 /* Pre-shared Key over 802.1X */ -#define WPA_AUTH_DISABLED 255 /* Legacy (i.e., non-WPA) */ - -#define IS_WPA_AUTH(auth) ((auth) == WPA_AUTH_NONE || \ - (auth) == WPA_AUTH_UNSPECIFIED || \ - (auth) == WPA_AUTH_PSK) - - -/* Key related defines */ -#define DOT11_MAX_DEFAULT_KEYS 4 /* number of default keys */ -#define DOT11_MAX_KEY_SIZE 32 /* max size of any key */ -#define DOT11_MAX_IV_SIZE 16 /* max size of any IV */ -#define DOT11_EXT_IV_FLAG (1<<5) /* flag to indicate IV is > 4 bytes */ - -#define WEP1_KEY_SIZE 5 /* max size of any WEP key */ -#define WEP1_KEY_HEX_SIZE 10 /* size of WEP key in hex. */ -#define WEP128_KEY_SIZE 13 /* max size of any WEP key */ -#define WEP128_KEY_HEX_SIZE 26 /* size of WEP key in hex. */ -#define TKIP_MIC_SIZE 8 /* size of TKIP MIC */ -#define TKIP_EOM_SIZE 7 /* max size of TKIP EOM */ -#define TKIP_EOM_FLAG 0x5a /* TKIP EOM flag byte */ -#define TKIP_KEY_SIZE 32 /* size of any TKIP key */ -#define TKIP_MIC_AUTH_TX 16 /* offset to Authenticator MIC TX key */ -#define TKIP_MIC_AUTH_RX 24 /* offset to Authenticator MIC RX key */ -#define TKIP_MIC_SUP_RX 16 /* offset to Supplicant MIC RX key */ -#define TKIP_MIC_SUP_TX 24 /* offset to Supplicant MIC TX key */ -#define AES_KEY_SIZE 16 /* size of AES key */ - -#undef PACKED -#if !defined(__GNUC__) -#pragma pack() -#endif - -#endif /* _802_11_H_ */ diff --git a/openwrt/package/linux/kernel-source/include/proto/ethernet.h b/openwrt/package/linux/kernel-source/include/proto/ethernet.h deleted file mode 100644 index 0089ec78d9..0000000000 --- a/openwrt/package/linux/kernel-source/include/proto/ethernet.h +++ /dev/null @@ -1,164 +0,0 @@ -/******************************************************************************* - * $Id$ - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * From FreeBSD 2.2.7: Fundamental constants relating to ethernet. - ******************************************************************************/ - -#ifndef _NET_ETHERNET_H_ /* use native BSD ethernet.h when available */ -#define _NET_ETHERNET_H_ - -#ifndef _TYPEDEFS_H_ -#include "typedefs.h" -#endif - -#if defined(__GNUC__) -#define PACKED __attribute__((packed)) -#else -#define PACKED -#endif - -/* - * The number of bytes in an ethernet (MAC) address. - */ -#define ETHER_ADDR_LEN 6 - -/* - * The number of bytes in the type field. - */ -#define ETHER_TYPE_LEN 2 - -/* - * The number of bytes in the trailing CRC field. - */ -#define ETHER_CRC_LEN 4 - -/* - * The length of the combined header. - */ -#define ETHER_HDR_LEN (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN) - -/* - * The minimum packet length. - */ -#define ETHER_MIN_LEN 64 - -/* - * The minimum packet user data length. - */ -#define ETHER_MIN_DATA 46 - -/* - * The maximum packet length. - */ -#define ETHER_MAX_LEN 1518 - -/* - * The maximum packet user data length. - */ -#define ETHER_MAX_DATA 1500 - -/* - * Used to uniquely identify a 802.1q VLAN-tagged header. - */ -#define VLAN_TAG 0x8100 - -/* - * Located after dest & src address in ether header. - */ -#define VLAN_FIELDS_OFFSET (ETHER_ADDR_LEN * 2) - -/* - * 4 bytes of vlan field info. - */ -#define VLAN_FIELDS_SIZE 4 - -/* location of bits in 16-bit vlan fields */ -#define VLAN_PRI_SHIFT 13 /* user priority */ -#define VLAN_CFI_SHIFT 12 /* canonical format indicator bit */ - -/* 3 bits of priority */ -#define VLAN_PRI_MASK 7 -/* 12 bits of vlan identfier (VID) */ -#define VLAN_VID_MASK 0xFFF /* VLAN identifier (VID) field */ - -struct vlan_tags { - uint16 tag_type; /* 0x8100 for VLAN */ - uint16 tag_control; /* prio | cfi | vid */ -} PACKED ; - -/* 802.1X ethertype */ - -#define ETHER_TYPE_IP 0x0800 /* IP */ -#define ETHER_TYPE_BRCM 0x886c /* Broadcom Corp. */ -#define ETHER_TYPE_802_1X 0x888e /* 802.1x */ - -#define ETHER_BRCM_SUBTYPE_LEN 4 /* Broadcom 4byte subtype follows ethertype */ -#define ETHER_BRCM_CRAM 0x1 /* Broadcom subtype cram protocol */ - -/* - * A macro to validate a length with - */ -#define ETHER_IS_VALID_LEN(foo) \ - ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) - - -#ifndef __INCif_etherh /* Quick and ugly hack for VxWorks */ -/* - * Structure of a 10Mb/s Ethernet header. - */ -struct ether_header { - uint8 ether_dhost[ETHER_ADDR_LEN]; - uint8 ether_shost[ETHER_ADDR_LEN]; - uint16 ether_type; -} PACKED ; - -/* - * Structure of a 48-bit Ethernet address. - */ -struct ether_addr { - uint8 octet[ETHER_ADDR_LEN]; -} PACKED ; -#endif - -/* - * Takes a pointer, returns true if a 48-bit multicast address - * (including broadcast, since it is all ones) - */ -#define ETHER_ISMULTI(ea) (((uint8 *)(ea))[0] & 1) - -/* - * Takes a pointer, returns true if a 48-bit broadcast (all ones) - */ -#define ETHER_ISBCAST(ea) ((((uint8 *)(ea))[0] & \ - ((uint8 *)(ea))[1] & \ - ((uint8 *)(ea))[2] & \ - ((uint8 *)(ea))[3] & \ - ((uint8 *)(ea))[4] & \ - ((uint8 *)(ea))[5]) == 0xff) - -static const struct ether_addr ether_bcast = {{255, 255, 255, 255, 255, 255}}; - -/* - * Takes a pointer, returns true if a 48-bit null address (all zeros) - */ -#define ETHER_ISNULLADDR(ea) ((((uint8 *)(ea))[0] | \ - ((uint8 *)(ea))[1] | \ - ((uint8 *)(ea))[2] | \ - ((uint8 *)(ea))[3] | \ - ((uint8 *)(ea))[4] | \ - ((uint8 *)(ea))[5]) == 0) - -/* Differentiated Services Codepoint - lower 6 bits of tos in iphdr */ -#define DSCP_PRI_MASK 0x3F /* bits 0-6 */ -#define DSCP_WME_PRI_MASK 0x38 /* bits 3-6 */ -#define DSCP_WME_PRI_SHIFT 3 - -#undef PACKED - -#endif /* _NET_ETHERNET_H_ */ diff --git a/openwrt/package/linux/kernel-source/include/sbchipc.h b/openwrt/package/linux/kernel-source/include/sbchipc.h deleted file mode 100644 index 7f37b2a6fd..0000000000 --- a/openwrt/package/linux/kernel-source/include/sbchipc.h +++ /dev/null @@ -1,367 +0,0 @@ -/* - * SiliconBackplane Chipcommon core hardware definitions. - * - * The chipcommon core provides chip identification, SB control, - * jtag, 0/1/2 uarts, clock frequency control, a watchdog interrupt timer, - * gpio interface, extbus, and support for serial and parallel flashes. - * - * $Id$ - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - */ - -#ifndef _SBCHIPC_H -#define _SBCHIPC_H - - -#ifndef _LANGUAGE_ASSEMBLY - -/* cpp contortions to concatenate w/arg prescan */ -#ifndef PAD -#define _PADLINE(line) pad ## line -#define _XSTR(line) _PADLINE(line) -#define PAD _XSTR(__LINE__) -#endif /* PAD */ - -typedef volatile struct { - uint32 chipid; /* 0x0 */ - uint32 capabilities; - uint32 corecontrol; /* corerev >= 1 */ - uint32 bist; - - /* OTP */ - uint32 otpstatus; /* 0x10, corerev >= 10 */ - uint32 otpcontrol; - uint32 otpprog; - uint32 PAD; - - /* Interrupt control */ - uint32 intstatus; /* 0x20 */ - uint32 intmask; - uint32 PAD[2]; - - /* Jtag Master */ - uint32 jtagcmd; /* 0x30, rev >= 10 */ - uint32 jtagir; - uint32 jtagdr; - uint32 jtagctrl; - - /* serial flash interface registers */ - uint32 flashcontrol; /* 0x40 */ - uint32 flashaddress; - uint32 flashdata; - uint32 PAD[1]; - - /* Silicon backplane configuration broadcast control */ - uint32 broadcastaddress; /* 0x50 */ - uint32 broadcastdata; - uint32 PAD[2]; - - /* gpio - cleared only by power-on-reset */ - uint32 gpioin; /* 0x60 */ - uint32 gpioout; - uint32 gpioouten; - uint32 gpiocontrol; - uint32 gpiointpolarity; - uint32 gpiointmask; - uint32 PAD[2]; - - /* Watchdog timer */ - uint32 watchdog; /* 0x80 */ - uint32 PAD[3]; - - /* clock control */ - uint32 clockcontrol_n; /* 0x90 */ - uint32 clockcontrol_sb; /* aka m0 */ - uint32 clockcontrol_pci; /* aka m1 */ - uint32 clockcontrol_m2; /* mii/uart/mipsref */ - uint32 clockcontrol_mips; /* aka m3 */ - uint32 clkdiv; /* corerev >= 3 */ - uint32 PAD[2]; - - /* pll delay registers (corerev >= 4) */ - uint32 pll_on_delay; /* 0xb0 */ - uint32 fref_sel_delay; - uint32 slow_clk_ctl; /* 5 < corerev < 10 */ - uint32 PAD[1]; - - /* Instaclock registers (corerev >= 10) */ - uint32 system_clk_ctl; /* 0xc0 */ - uint32 clkstatestretch; - uint32 PAD[14]; - - /* ExtBus control registers (corerev >= 3) */ - uint32 pcmcia_config; /* 0x100 */ - uint32 pcmcia_memwait; - uint32 pcmcia_attrwait; - uint32 pcmcia_iowait; - uint32 ide_config; - uint32 ide_memwait; - uint32 ide_attrwait; - uint32 ide_iowait; - uint32 prog_config; - uint32 prog_waitcount; - uint32 flash_config; - uint32 flash_waitcount; - uint32 PAD[116]; - - /* uarts */ - uint8 uart0data; /* 0x300 */ - uint8 uart0imr; - uint8 uart0fcr; - uint8 uart0lcr; - uint8 uart0mcr; - uint8 uart0lsr; - uint8 uart0msr; - uint8 uart0scratch; - uint8 PAD[248]; /* corerev >= 1 */ - - uint8 uart1data; /* 0x400 */ - uint8 uart1imr; - uint8 uart1fcr; - uint8 uart1lcr; - uint8 uart1mcr; - uint8 uart1lsr; - uint8 uart1msr; - uint8 uart1scratch; -} chipcregs_t; - -#endif /* _LANGUAGE_ASSEMBLY */ - -#define CC_CHIPID 0 -#define CC_CAPABILITIES 4 -#define CC_JTAGCMD 0x30 -#define CC_JTAGIR 0x34 -#define CC_JTAGDR 0x38 -#define CC_JTAGCTRL 0x3c -#define CC_CLKDIV 0xa4 - -/* chipid */ -#define CID_ID_MASK 0x0000ffff /* Chip Id mask */ -#define CID_REV_MASK 0x000f0000 /* Chip Revision mask */ -#define CID_REV_SHIFT 16 /* Chip Revision shift */ -#define CID_PKG_MASK 0x00f00000 /* Package Option mask */ -#define CID_PKG_SHIFT 20 /* Package Option shift */ -#define CID_CC_MASK 0x0f000000 /* CoreCount (corerev >= 4) */ -#define CID_CC_SHIFT 24 - -/* capabilities */ -#define CAP_UARTS_MASK 0x00000003 /* Number of uarts */ -#define CAP_MIPSEB 0x00000004 /* MIPS is in big-endian mode */ -#define CAP_UCLKSEL 0x00000018 /* UARTs clock select */ -#define CAP_UINTCLK 0x00000008 /* UARTs are driven by internal divided clock */ -#define CAP_UARTGPIO 0x00000020 /* UARTs own Gpio's 15:12 */ -#define CAP_EXTBUS 0x00000040 /* External bus present */ -#define CAP_FLASH_MASK 0x00000700 /* Type of flash */ -#define CAP_PLL_MASK 0x00038000 /* Type of PLL */ -#define CAP_PWR_CTL 0x00040000 /* Power control */ -#define CAP_OTPSIZE 0x00380000 /* OTP Size (0 = none) */ -#define CAP_JTAGP 0x00400000 /* JTAG Master Present */ -#define CAP_ROM 0x00800000 /* Internal boot rom active */ - -/* PLL type */ -#define PLL_NONE 0x00000000 -#define PLL_TYPE1 0x00010000 /* 48Mhz base, 3 dividers */ -#define PLL_TYPE2 0x00020000 /* 48Mhz, 4 dividers */ -#define PLL_TYPE3 0x00030000 /* 25Mhz, 2 dividers */ -#define PLL_TYPE4 0x00008000 /* 48Mhz, 4 dividers */ - -/* corecontrol */ -#define CC_UARTCLKO 0x00000001 /* Drive UART with internal clock */ -#define CC_SE 0x00000002 /* sync clk out enable (corerev >= 3) */ - -/* jtagcmd */ -#define JCMD_START 0x80000000 -#define JCMD_BUSY 0x80000000 -#define JCMD_PAUSE 0x40000000 -#define JCMD0_ACC_MASK 0x0000f000 -#define JCMD0_ACC_IRDR 0x00000000 -#define JCMD0_ACC_DR 0x00001000 -#define JCMD0_ACC_IR 0x00002000 -#define JCMD0_ACC_RESET 0x00003000 -#define JCMD0_ACC_IRPDR 0x00004000 -#define JCMD0_ACC_PDR 0x00005000 -#define JCMD0_IRW_MASK 0x00000f00 -#define JCMD_ACC_MASK 0x000f0000 /* Changes for corerev 11 */ -#define JCMD_ACC_IRDR 0x00000000 -#define JCMD_ACC_DR 0x00010000 -#define JCMD_ACC_IR 0x00020000 -#define JCMD_ACC_RESET 0x00030000 -#define JCMD_ACC_IRPDR 0x00040000 -#define JCMD_ACC_PDR 0x00050000 -#define JCMD_IRW_MASK 0x00001f00 -#define JCMD_IRW_SHIFT 8 -#define JCMD_DRW_MASK 0x0000003f - -/* jtagctrl */ -#define JCTRL_FORCE_CLK 4 /* Force clock */ -#define JCTRL_EXT_EN 2 /* Enable external targets */ -#define JCTRL_EN 1 /* Enable Jtag master */ - -/* Fields in clkdiv */ -#define CLKD_SFLASH 0x0f000000 -#define CLKD_SFLASH_SHIFT 24 -#define CLKD_OTP 0x000f0000 -#define CLKD_OTP_SHIFT 16 -#define CLKD_JTAG 0x00000f00 -#define CLKD_JTAG_SHIFT 8 -#define CLKD_UART 0x000000ff - -/* intstatus/intmask */ -#define CI_GPIO 0x00000001 /* gpio intr */ -#define CI_EI 0x00000002 /* ro: ext intr pin (corerev >= 3) */ -#define CI_WDREST 0x80000000 /* watchdog reset occurred */ - -/* slow_clk_ctl */ -#define SCC_SS_MASK 0x00000007 /* slow clock source mask */ -#define SCC_SS_LPO 0x00000000 /* source of slow clock is LPO */ -#define SCC_SS_XTAL 0x00000001 /* source of slow clock is crystal */ -#define SCC_SS_PCI 0x00000002 /* source of slow clock is PCI */ -#define SCC_LF 0x00000200 /* LPOFreqSel, 1: 160Khz, 0: 32KHz */ -#define SCC_LP 0x00000400 /* LPOPowerDown, 1: LPO is disabled, 0: LPO is enabled */ -#define SCC_FS 0x00000800 /* ForceSlowClk, 1: sb/cores running on slow clock, 0: power logic control */ -#define SCC_IP 0x00001000 /* IgnorePllOffReq, 1/0: power logic ignores/honors PLL clock disable requests from core */ -#define SCC_XC 0x00002000 /* XtalControlEn, 1/0: power logic does/doesn't disable crystal when appropriate */ -#define SCC_XP 0x00004000 /* XtalPU (RO), 1/0: crystal running/disabled */ -#define SCC_CD_MASK 0xffff0000 /* ClockDivider mask, SlowClk = 1/(4+divisor) * crystal/PCI clock */ -#define SCC_CD_SHF 16 /* CLockDivider shift */ - -/* sys_clk_ctl */ -#define SYCC_IE 0x00000001 /* ILPen: Enable Idle Low Power */ -#define SYCC_AE 0x00000002 /* ALPen: Enable Active Low Power */ -#define SYCC_FP 0x00000004 /* ForcePLLOn */ -#define SYCC_AR 0x00000008 /* Force ALP (or HT if ALPen is not set */ -#define SYCC_HR 0x00000010 /* Force HT */ -#define SYCC_CD_MASK 0xffff0000 /* ClockDivider mask, SlowClk = 1/(4+divisor) * crystal/PCI clock */ -#define SYCC_CD_SHF 16 /* CLockDivider shift */ - -/* clockcontrol_n */ -#define CN_N1_MASK 0x3f /* n1 control */ -#define CN_N2_MASK 0x3f00 /* n2 control */ -#define CN_N2_SHIFT 8 - -/* clockcontrol_sb/pci/uart */ -#define CC_M1_MASK 0x3f /* m1 control */ -#define CC_M2_MASK 0x3f00 /* m2 control */ -#define CC_M2_SHIFT 8 -#define CC_M3_MASK 0x3f0000 /* m3 control */ -#define CC_M3_SHIFT 16 -#define CC_MC_MASK 0x1f000000 /* mux control */ -#define CC_MC_SHIFT 24 - -/* N3M Clock control values for 125Mhz */ -#define CC_125_N 0x0802 /* Default values for bcm4310 */ -#define CC_125_M 0x04020009 -#define CC_125_M25 0x11090009 -#define CC_125_M33 0x11090005 - -/* N3M Clock control magic field values */ -#define CC_F6_2 0x02 /* A factor of 2 in */ -#define CC_F6_3 0x03 /* 6-bit fields like */ -#define CC_F6_4 0x05 /* N1, M1 or M3 */ -#define CC_F6_5 0x09 -#define CC_F6_6 0x11 -#define CC_F6_7 0x21 - -#define CC_F5_BIAS 5 /* 5-bit fields get this added */ - -#define CC_MC_BYPASS 0x08 -#define CC_MC_M1 0x04 -#define CC_MC_M1M2 0x02 -#define CC_MC_M1M2M3 0x01 -#define CC_MC_M1M3 0x11 - -/* Type 2 Clock control magic field values */ -#define CC_T2_BIAS 2 /* n1, n2, m1 & m3 bias */ -#define CC_T2M2_BIAS 3 /* m2 bias */ - -#define CC_T2MC_M1BYP 1 -#define CC_T2MC_M2BYP 2 -#define CC_T2MC_M3BYP 4 - -/* Common clock base */ -#define CC_CLOCK_BASE 24000000 /* Half the clock freq */ - - -/* Flash types in the chipcommon capabilities register */ -#define FLASH_NONE 0x000 /* No flash */ -#define SFLASH_ST 0x100 /* ST serial flash */ -#define SFLASH_AT 0x200 /* Atmel serial flash */ -#define PFLASH 0x700 /* Parallel flash */ - -/* Prefered flash window in chipcommon */ -#define CC_FLASH_BASE 0xbc000000 /* Chips with chipcommon cores */ -#define CC_FLASH_MAX 0x02000000 /* Maximum flash size with chipc */ - - -/* Bits in the config registers */ -#define CC_CFG_EN 0x0001 /* Enable */ -#define CC_CFG_EM_MASK 0x000e /* Extif Mode */ -#define CC_CFG_EM_ASYNC 0x0002 /* Async/Parallel flash */ -#define CC_CFG_EM_SYNC 0x0004 /* Synchronous */ -#define CC_CFG_EM_PCMCIA 0x0008 /* PCMCIA */ -#define CC_CFG_EM_IDE 0x000a /* IDE */ -#define CC_CFG_DS 0x0010 /* Data size, 0=8bit, 1=16bit */ -#define CC_CFG_CD_MASK 0x0060 /* Sync: Clock divisor */ -#define CC_CFG_CE 0x0080 /* Sync: Clock enable */ -#define CC_CFG_SB 0x0100 /* Sync: Size/Bytestrobe */ - -/* Start/busy bit in flashcontrol */ -#define SFLASH_START 0x80000000 -#define SFLASH_BUSY SFLASH_START - -/* flashcontrol opcodes for ST flashes */ -#define SFLASH_ST_WREN 0x0006 /* Write Enable */ -#define SFLASH_ST_WRDIS 0x0004 /* Write Disable */ -#define SFLASH_ST_RDSR 0x0105 /* Read Status Register */ -#define SFLASH_ST_WRSR 0x0101 /* Write Status Register */ -#define SFLASH_ST_READ 0x0303 /* Read Data Bytes */ -#define SFLASH_ST_PP 0x0302 /* Page Program */ -#define SFLASH_ST_SE 0x02d8 /* Sector Erase */ -#define SFLASH_ST_BE 0x00c7 /* Bulk Erase */ -#define SFLASH_ST_DP 0x00b9 /* Deep Power-down */ -#define SFLASH_ST_RES 0x03ab /* Read Electronic Signature */ - -/* Status register bits for ST flashes */ -#define SFLASH_ST_WIP 0x01 /* Write In Progress */ -#define SFLASH_ST_WEL 0x02 /* Write Enable Latch */ -#define SFLASH_ST_BP_MASK 0x1c /* Block Protect */ -#define SFLASH_ST_BP_SHIFT 2 -#define SFLASH_ST_SRWD 0x80 /* Status Register Write Disable */ - -/* flashcontrol opcodes for Atmel flashes */ -#define SFLASH_AT_READ 0x07e8 -#define SFLASH_AT_PAGE_READ 0x07d2 -#define SFLASH_AT_BUF1_READ -#define SFLASH_AT_BUF2_READ -#define SFLASH_AT_STATUS 0x01d7 -#define SFLASH_AT_BUF1_WRITE 0x0384 -#define SFLASH_AT_BUF2_WRITE 0x0387 -#define SFLASH_AT_BUF1_ERASE_PROGRAM 0x0283 -#define SFLASH_AT_BUF2_ERASE_PROGRAM 0x0286 -#define SFLASH_AT_BUF1_PROGRAM 0x0288 -#define SFLASH_AT_BUF2_PROGRAM 0x0289 -#define SFLASH_AT_PAGE_ERASE 0x0281 -#define SFLASH_AT_BLOCK_ERASE 0x0250 -#define SFLASH_AT_BUF1_WRITE_ERASE_PROGRAM 0x0382 -#define SFLASH_AT_BUF2_WRITE_ERASE_PROGRAM 0x0385 -#define SFLASH_AT_BUF1_LOAD 0x0253 -#define SFLASH_AT_BUF2_LOAD 0x0255 -#define SFLASH_AT_BUF1_COMPARE 0x0260 -#define SFLASH_AT_BUF2_COMPARE 0x0261 -#define SFLASH_AT_BUF1_REPROGRAM 0x0258 -#define SFLASH_AT_BUF2_REPROGRAM 0x0259 - -/* Status register bits for Atmel flashes */ -#define SFLASH_AT_READY 0x80 -#define SFLASH_AT_MISMATCH 0x40 -#define SFLASH_AT_ID_MASK 0x38 -#define SFLASH_AT_ID_SHIFT 3 - -#endif /* _SBCHIPC_H */ diff --git a/openwrt/package/linux/kernel-source/include/sbconfig.h b/openwrt/package/linux/kernel-source/include/sbconfig.h deleted file mode 100644 index b5122d5ea4..0000000000 --- a/openwrt/package/linux/kernel-source/include/sbconfig.h +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Broadcom SiliconBackplane hardware register definitions. - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * $Id$ - */ - -#ifndef _SBCONFIG_H -#define _SBCONFIG_H - -/* cpp contortions to concatenate w/arg prescan */ -#ifndef PAD -#define _PADLINE(line) pad ## line -#define _XSTR(line) _PADLINE(line) -#define PAD _XSTR(__LINE__) -#endif - -/* - * SiliconBackplane Address Map. - * All regions may not exist on all chips. - */ -#define SB_SDRAM_BASE 0x00000000 /* Physical SDRAM */ -#define SB_PCI_MEM 0x08000000 /* Host Mode PCI memory access space (64 MB) */ -#define SB_PCI_CFG 0x0c000000 /* Host Mode PCI configuration space (64 MB) */ -#define SB_SDRAM_SWAPPED 0x10000000 /* Byteswapped Physical SDRAM */ -#define SB_ENUM_BASE 0x18000000 /* Enumeration space base */ -#define SB_ENUM_LIM 0x18010000 /* Enumeration space limit */ -#define SB_EXTIF_BASE 0x1f000000 /* External Interface region base address */ -#define SB_PCI_DMA 0x40000000 /* Client Mode PCI memory access space (1 GB) */ -#define SB_EUART (SB_EXTIF_BASE + 0x00800000) -#define SB_LED (SB_EXTIF_BASE + 0x00900000) - -/* enumeration space related defs */ -#define SB_CORE_SIZE 0x1000 /* each core gets 4Kbytes for registers */ -#define SB_MAXCORES ((SB_ENUM_LIM - SB_ENUM_BASE)/SB_CORE_SIZE) -#define SBCONFIGOFF 0xf00 /* core sbconfig regs are top 256bytes of regs */ -#define SBCONFIGSIZE 256 /* sizeof (sbconfig_t) */ - -/* mips address */ -#define SB_EJTAG 0xff200000 /* MIPS EJTAG space (2M) */ - -/* - * Sonics Configuration Space Registers. - */ -#define SBIPSFLAG 0x08 -#define SBTPSFLAG 0x18 -#define SBTMERRLOGA 0x48 /* sonics >= 2.3 */ -#define SBTMERRLOG 0x50 /* sonics >= 2.3 */ -#define SBADMATCH3 0x60 -#define SBADMATCH2 0x68 -#define SBADMATCH1 0x70 -#define SBIMSTATE 0x90 -#define SBINTVEC 0x94 -#define SBTMSTATELOW 0x98 -#define SBTMSTATEHIGH 0x9c -#define SBBWA0 0xa0 -#define SBIMCONFIGLOW 0xa8 -#define SBIMCONFIGHIGH 0xac -#define SBADMATCH0 0xb0 -#define SBTMCONFIGLOW 0xb8 -#define SBTMCONFIGHIGH 0xbc -#define SBBCONFIG 0xc0 -#define SBBSTATE 0xc8 -#define SBACTCNFG 0xd8 -#define SBFLAGST 0xe8 -#define SBIDLOW 0xf8 -#define SBIDHIGH 0xfc - -#ifndef _LANGUAGE_ASSEMBLY - -typedef volatile struct _sbconfig { - uint32 PAD[2]; - uint32 sbipsflag; /* initiator port ocp slave flag */ - uint32 PAD[3]; - uint32 sbtpsflag; /* target port ocp slave flag */ - uint32 PAD[11]; - uint32 sbtmerrloga; /* (sonics >= 2.3) */ - uint32 PAD; - uint32 sbtmerrlog; /* (sonics >= 2.3) */ - uint32 PAD[3]; - uint32 sbadmatch3; /* address match3 */ - uint32 PAD; - uint32 sbadmatch2; /* address match2 */ - uint32 PAD; - uint32 sbadmatch1; /* address match1 */ - uint32 PAD[7]; - uint32 sbimstate; /* initiator agent state */ - uint32 sbintvec; /* interrupt mask */ - uint32 sbtmstatelow; /* target state */ - uint32 sbtmstatehigh; /* target state */ - uint32 sbbwa0; /* bandwidth allocation table0 */ - uint32 PAD; - uint32 sbimconfiglow; /* initiator configuration */ - uint32 sbimconfighigh; /* initiator configuration */ - uint32 sbadmatch0; /* address match0 */ - uint32 PAD; - uint32 sbtmconfiglow; /* target configuration */ - uint32 sbtmconfighigh; /* target configuration */ - uint32 sbbconfig; /* broadcast configuration */ - uint32 PAD; - uint32 sbbstate; /* broadcast state */ - uint32 PAD[3]; - uint32 sbactcnfg; /* activate configuration */ - uint32 PAD[3]; - uint32 sbflagst; /* current sbflags */ - uint32 PAD[3]; - uint32 sbidlow; /* identification */ - uint32 sbidhigh; /* identification */ -} sbconfig_t; - -#endif /* _LANGUAGE_ASSEMBLY */ - -/* sbipsflag */ -#define SBIPS_INT1_MASK 0x3f /* which sbflags get routed to mips interrupt 1 */ -#define SBIPS_INT1_SHIFT 0 -#define SBIPS_INT2_MASK 0x3f00 /* which sbflags get routed to mips interrupt 2 */ -#define SBIPS_INT2_SHIFT 8 -#define SBIPS_INT3_MASK 0x3f0000 /* which sbflags get routed to mips interrupt 3 */ -#define SBIPS_INT3_SHIFT 16 -#define SBIPS_INT4_MASK 0x3f000000 /* which sbflags get routed to mips interrupt 4 */ -#define SBIPS_INT4_SHIFT 24 - -/* sbtpsflag */ -#define SBTPS_NUM0_MASK 0x3f /* interrupt sbFlag # generated by this core */ -#define SBTPS_F0EN0 0x40 /* interrupt is always sent on the backplane */ - -/* sbtmerrlog */ -#define SBTMEL_CM 0x00000007 /* command */ -#define SBTMEL_CI 0x0000ff00 /* connection id */ -#define SBTMEL_EC 0x0f000000 /* error code */ -#define SBTMEL_ME 0x80000000 /* multiple error */ - -/* sbimstate */ -#define SBIM_PC 0xf /* pipecount */ -#define SBIM_AP_MASK 0x30 /* arbitration policy */ -#define SBIM_AP_BOTH 0x00 /* use both timeslaces and token */ -#define SBIM_AP_TS 0x10 /* use timesliaces only */ -#define SBIM_AP_TK 0x20 /* use token only */ -#define SBIM_AP_RSV 0x30 /* reserved */ -#define SBIM_IBE 0x20000 /* inbanderror */ -#define SBIM_TO 0x40000 /* timeout */ -#define SBIM_BY 0x01800000 /* busy (sonics >= 2.3) */ -#define SBIM_RJ 0x02000000 /* reject (sonics >= 2.3) */ - -/* sbtmstatelow */ -#define SBTML_RESET 0x1 /* reset */ -#define SBTML_REJ 0x2 /* reject */ -#define SBTML_CLK 0x10000 /* clock enable */ -#define SBTML_FGC 0x20000 /* force gated clocks on */ -#define SBTML_FL_MASK 0x3ffc0000 /* core-specific flags */ -#define SBTML_PE 0x40000000 /* pme enable */ -#define SBTML_BE 0x80000000 /* bist enable */ - -/* sbtmstatehigh */ -#define SBTMH_SERR 0x1 /* serror */ -#define SBTMH_INT 0x2 /* interrupt */ -#define SBTMH_BUSY 0x4 /* busy */ -#define SBTMH_TO 0x00000020 /* timeout (sonics >= 2.3) */ -#define SBTMH_FL_MASK 0x1fff0000 /* core-specific flags */ -#define SBTMH_GCR 0x20000000 /* gated clock request */ -#define SBTMH_BISTF 0x40000000 /* bist failed */ -#define SBTMH_BISTD 0x80000000 /* bist done */ - -/* sbbwa0 */ -#define SBBWA_TAB0_MASK 0xffff /* lookup table 0 */ -#define SBBWA_TAB1_MASK 0xffff /* lookup table 1 */ -#define SBBWA_TAB1_SHIFT 16 - -/* sbimconfiglow */ -#define SBIMCL_STO_MASK 0x7 /* service timeout */ -#define SBIMCL_RTO_MASK 0x70 /* request timeout */ -#define SBIMCL_RTO_SHIFT 4 -#define SBIMCL_CID_MASK 0xff0000 /* connection id */ -#define SBIMCL_CID_SHIFT 16 - -/* sbimconfighigh */ -#define SBIMCH_IEM_MASK 0xc /* inband error mode */ -#define SBIMCH_TEM_MASK 0x30 /* timeout error mode */ -#define SBIMCH_TEM_SHIFT 4 -#define SBIMCH_BEM_MASK 0xc0 /* bus error mode */ -#define SBIMCH_BEM_SHIFT 6 - -/* sbadmatch0 */ -#define SBAM_TYPE_MASK 0x3 /* address type */ -#define SBAM_AD64 0x4 /* reserved */ -#define SBAM_ADINT0_MASK 0xf8 /* type0 size */ -#define SBAM_ADINT0_SHIFT 3 -#define SBAM_ADINT1_MASK 0x1f8 /* type1 size */ -#define SBAM_ADINT1_SHIFT 3 -#define SBAM_ADINT2_MASK 0x1f8 /* type2 size */ -#define SBAM_ADINT2_SHIFT 3 -#define SBAM_ADEN 0x400 /* enable */ -#define SBAM_ADNEG 0x800 /* negative decode */ -#define SBAM_BASE0_MASK 0xffffff00 /* type0 base address */ -#define SBAM_BASE0_SHIFT 8 -#define SBAM_BASE1_MASK 0xfffff000 /* type1 base address for the core */ -#define SBAM_BASE1_SHIFT 12 -#define SBAM_BASE2_MASK 0xffff0000 /* type2 base address for the core */ -#define SBAM_BASE2_SHIFT 16 - -/* sbtmconfiglow */ -#define SBTMCL_CD_MASK 0xff /* clock divide */ -#define SBTMCL_CO_MASK 0xf800 /* clock offset */ -#define SBTMCL_CO_SHIFT 11 -#define SBTMCL_IF_MASK 0xfc0000 /* interrupt flags */ -#define SBTMCL_IF_SHIFT 18 -#define SBTMCL_IM_MASK 0x3000000 /* interrupt mode */ -#define SBTMCL_IM_SHIFT 24 - -/* sbtmconfighigh */ -#define SBTMCH_BM_MASK 0x3 /* busy mode */ -#define SBTMCH_RM_MASK 0x3 /* retry mode */ -#define SBTMCH_RM_SHIFT 2 -#define SBTMCH_SM_MASK 0x30 /* stop mode */ -#define SBTMCH_SM_SHIFT 4 -#define SBTMCH_EM_MASK 0x300 /* sb error mode */ -#define SBTMCH_EM_SHIFT 8 -#define SBTMCH_IM_MASK 0xc00 /* int mode */ -#define SBTMCH_IM_SHIFT 10 - -/* sbbconfig */ -#define SBBC_LAT_MASK 0x3 /* sb latency */ -#define SBBC_MAX0_MASK 0xf0000 /* maxccntr0 */ -#define SBBC_MAX0_SHIFT 16 -#define SBBC_MAX1_MASK 0xf00000 /* maxccntr1 */ -#define SBBC_MAX1_SHIFT 20 - -/* sbbstate */ -#define SBBS_SRD 0x1 /* st reg disable */ -#define SBBS_HRD 0x2 /* hold reg disable */ - -/* sbidlow */ -#define SBIDL_CS_MASK 0x3 /* config space */ -#define SBIDL_AR_MASK 0x38 /* # address ranges supported */ -#define SBIDL_AR_SHIFT 3 -#define SBIDL_SYNCH 0x40 /* sync */ -#define SBIDL_INIT 0x80 /* initiator */ -#define SBIDL_MINLAT_MASK 0xf00 /* minimum backplane latency */ -#define SBIDL_MINLAT_SHIFT 8 -#define SBIDL_MAXLAT 0xf000 /* maximum backplane latency */ -#define SBIDL_MAXLAT_SHIFT 12 -#define SBIDL_FIRST 0x10000 /* this initiator is first */ -#define SBIDL_CW_MASK 0xc0000 /* cycle counter width */ -#define SBIDL_CW_SHIFT 18 -#define SBIDL_TP_MASK 0xf00000 /* target ports */ -#define SBIDL_TP_SHIFT 20 -#define SBIDL_IP_MASK 0xf000000 /* initiator ports */ -#define SBIDL_IP_SHIFT 24 -#define SBIDL_RV_MASK 0xf0000000 /* sonics backplane revision code */ -#define SBIDL_RV_SHIFT 28 - -/* sbidhigh */ -#define SBIDH_RC_MASK 0xf /* revision code*/ -#define SBIDH_CC_MASK 0xfff0 /* core code */ -#define SBIDH_CC_SHIFT 4 -#define SBIDH_VC_MASK 0xffff0000 /* vendor code */ -#define SBIDH_VC_SHIFT 16 - -#define SB_COMMIT 0xfd8 /* update buffered registers value */ - -/* vendor codes */ -#define SB_VEND_BCM 0x4243 /* Broadcom's SB vendor code */ - -/* core codes */ -#define SB_CC 0x800 /* chipcommon core */ -#define SB_ILINE20 0x801 /* iline20 core */ -#define SB_SDRAM 0x803 /* sdram core */ -#define SB_PCI 0x804 /* pci core */ -#define SB_MIPS 0x805 /* mips core */ -#define SB_ENET 0x806 /* enet mac core */ -#define SB_CODEC 0x807 /* v90 codec core */ -#define SB_USB 0x808 /* usb 1.1 host/device core */ -#define SB_ILINE100 0x80a /* iline100 core */ -#define SB_IPSEC 0x80b /* ipsec core */ -#define SB_PCMCIA 0x80d /* pcmcia core */ -#define SB_MEMC 0x80f /* memc sdram core */ -#define SB_EXTIF 0x811 /* external interface core */ -#define SB_D11 0x812 /* 802.11 MAC core */ -#define SB_MIPS33 0x816 /* mips3302 core */ -#define SB_USB11H 0x817 /* usb 1.1 host core */ -#define SB_USB11D 0x818 /* usb 1.1 device core */ -#define SB_USB20H 0x819 /* usb 2.0 host core */ -#define SB_USB20D 0x81A /* usb 2.0 device core */ -#define SB_SDIOH 0x81B /* sdio host core */ - -#endif /* _SBCONFIG_H */ diff --git a/openwrt/package/linux/kernel-source/include/sbextif.h b/openwrt/package/linux/kernel-source/include/sbextif.h deleted file mode 100644 index 32274b8165..0000000000 --- a/openwrt/package/linux/kernel-source/include/sbextif.h +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Hardware-specific External Interface I/O core definitions - * for the BCM47xx family of SiliconBackplane-based chips. - * - * The External Interface core supports a total of three external chip selects - * supporting external interfaces. One of the external chip selects is - * used for Flash, one is used for PCMCIA, and the other may be - * programmed to support either a synchronous interface or an - * asynchronous interface. The asynchronous interface can be used to - * support external devices such as UARTs and the BCM2019 Bluetooth - * baseband processor. - * The external interface core also contains 2 on-chip 16550 UARTs, clock - * frequency control, a watchdog interrupt timer, and a GPIO interface. - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * $Id$ - */ - -#ifndef _SBEXTIF_H -#define _SBEXTIF_H - -/* external interface address space */ -#define EXTIF_PCMCIA_MEMBASE(x) (x) -#define EXTIF_PCMCIA_IOBASE(x) ((x) + 0x100000) -#define EXTIF_PCMCIA_CFGBASE(x) ((x) + 0x200000) -#define EXTIF_CFGIF_BASE(x) ((x) + 0x800000) -#define EXTIF_FLASH_BASE(x) ((x) + 0xc00000) - -/* cpp contortions to concatenate w/arg prescan */ -#ifndef PAD -#define _PADLINE(line) pad ## line -#define _XSTR(line) _PADLINE(line) -#define PAD _XSTR(__LINE__) -#endif /* PAD */ - -/* - * The multiple instances of output and output enable registers - * are present to allow driver software for multiple cores to control - * gpio outputs without needing to share a single register pair. - */ -struct gpiouser { - uint32 out; - uint32 outen; -}; -#define NGPIOUSER 5 - -typedef volatile struct { - uint32 corecontrol; - uint32 extstatus; - uint32 PAD[2]; - - /* pcmcia control registers */ - uint32 pcmcia_config; - uint32 pcmcia_memwait; - uint32 pcmcia_attrwait; - uint32 pcmcia_iowait; - - /* programmable interface control registers */ - uint32 prog_config; - uint32 prog_waitcount; - - /* flash control registers */ - uint32 flash_config; - uint32 flash_waitcount; - uint32 PAD[4]; - - uint32 watchdog; - - /* clock control */ - uint32 clockcontrol_n; - uint32 clockcontrol_sb; - uint32 clockcontrol_pci; - uint32 clockcontrol_mii; - uint32 PAD[3]; - - /* gpio */ - uint32 gpioin; - struct gpiouser gpio[NGPIOUSER]; - uint32 PAD; - uint32 ejtagouten; - uint32 gpiointpolarity; - uint32 gpiointmask; - uint32 PAD[153]; - - uint8 uartdata; - uint8 PAD[3]; - uint8 uartimer; - uint8 PAD[3]; - uint8 uartfcr; - uint8 PAD[3]; - uint8 uartlcr; - uint8 PAD[3]; - uint8 uartmcr; - uint8 PAD[3]; - uint8 uartlsr; - uint8 PAD[3]; - uint8 uartmsr; - uint8 PAD[3]; - uint8 uartscratch; - uint8 PAD[3]; -} extifregs_t; - -/* corecontrol */ -#define CC_UE (1 << 0) /* uart enable */ - -/* extstatus */ -#define ES_EM (1 << 0) /* endian mode (ro) */ -#define ES_EI (1 << 1) /* external interrupt pin (ro) */ -#define ES_GI (1 << 2) /* gpio interrupt pin (ro) */ - -/* gpio bit mask */ -#define GPIO_BIT0 (1 << 0) -#define GPIO_BIT1 (1 << 1) -#define GPIO_BIT2 (1 << 2) -#define GPIO_BIT3 (1 << 3) -#define GPIO_BIT4 (1 << 4) -#define GPIO_BIT5 (1 << 5) -#define GPIO_BIT6 (1 << 6) -#define GPIO_BIT7 (1 << 7) - - -/* pcmcia/prog/flash_config */ -#define CF_EN (1 << 0) /* enable */ -#define CF_EM_MASK 0xe /* mode */ -#define CF_EM_SHIFT 1 -#define CF_EM_FLASH 0x0 /* flash/asynchronous mode */ -#define CF_EM_SYNC 0x2 /* synchronous mode */ -#define CF_EM_PCMCIA 0x4 /* pcmcia mode */ -#define CF_DS (1 << 4) /* destsize: 0=8bit, 1=16bit */ -#define CF_BS (1 << 5) /* byteswap */ -#define CF_CD_MASK 0xc0 /* clock divider */ -#define CF_CD_SHIFT 6 -#define CF_CD_DIV2 0x0 /* backplane/2 */ -#define CF_CD_DIV3 0x40 /* backplane/3 */ -#define CF_CD_DIV4 0x80 /* backplane/4 */ -#define CF_CE (1 << 8) /* clock enable */ -#define CF_SB (1 << 9) /* size/bytestrobe (synch only) */ - -/* pcmcia_memwait */ -#define PM_W0_MASK 0x3f /* waitcount0 */ -#define PM_W1_MASK 0x1f00 /* waitcount1 */ -#define PM_W1_SHIFT 8 -#define PM_W2_MASK 0x1f0000 /* waitcount2 */ -#define PM_W2_SHIFT 16 -#define PM_W3_MASK 0x1f000000 /* waitcount3 */ -#define PM_W3_SHIFT 24 - -/* pcmcia_attrwait */ -#define PA_W0_MASK 0x3f /* waitcount0 */ -#define PA_W1_MASK 0x1f00 /* waitcount1 */ -#define PA_W1_SHIFT 8 -#define PA_W2_MASK 0x1f0000 /* waitcount2 */ -#define PA_W2_SHIFT 16 -#define PA_W3_MASK 0x1f000000 /* waitcount3 */ -#define PA_W3_SHIFT 24 - -/* pcmcia_iowait */ -#define PI_W0_MASK 0x3f /* waitcount0 */ -#define PI_W1_MASK 0x1f00 /* waitcount1 */ -#define PI_W1_SHIFT 8 -#define PI_W2_MASK 0x1f0000 /* waitcount2 */ -#define PI_W2_SHIFT 16 -#define PI_W3_MASK 0x1f000000 /* waitcount3 */ -#define PI_W3_SHIFT 24 - -/* prog_waitcount */ -#define PW_W0_MASK 0x0000001f /* waitcount0 */ -#define PW_W1_MASK 0x00001f00 /* waitcount1 */ -#define PW_W1_SHIFT 8 -#define PW_W2_MASK 0x001f0000 /* waitcount2 */ -#define PW_W2_SHIFT 16 -#define PW_W3_MASK 0x1f000000 /* waitcount3 */ -#define PW_W3_SHIFT 24 - -#define PW_W0 0x0000000c -#define PW_W1 0x00000a00 -#define PW_W2 0x00020000 -#define PW_W3 0x01000000 - -/* flash_waitcount */ -#define FW_W0_MASK 0x1f /* waitcount0 */ -#define FW_W1_MASK 0x1f00 /* waitcount1 */ -#define FW_W1_SHIFT 8 -#define FW_W2_MASK 0x1f0000 /* waitcount2 */ -#define FW_W2_SHIFT 16 -#define FW_W3_MASK 0x1f000000 /* waitcount3 */ -#define FW_W3_SHIFT 24 - -/* watchdog */ -#define WATCHDOG_CLOCK 48000000 /* Hz */ - -/* clockcontrol_n */ -#define CN_N1_MASK 0x3f /* n1 control */ -#define CN_N2_MASK 0x3f00 /* n2 control */ -#define CN_N2_SHIFT 8 - -/* clockcontrol_sb/pci/mii */ -#define CC_M1_MASK 0x3f /* m1 control */ -#define CC_M2_MASK 0x3f00 /* m2 control */ -#define CC_M2_SHIFT 8 -#define CC_M3_MASK 0x3f0000 /* m3 control */ -#define CC_M3_SHIFT 16 -#define CC_MC_MASK 0x1f000000 /* mux control */ -#define CC_MC_SHIFT 24 - -/* Clock control default values */ -#define CC_DEF_N 0x0009 /* Default values for bcm4710 */ -#define CC_DEF_100 0x04020011 -#define CC_DEF_33 0x11030011 -#define CC_DEF_25 0x11050011 - -/* Clock control values for 125Mhz */ -#define CC_125_N 0x0802 -#define CC_125_M 0x04020009 -#define CC_125_M25 0x11090009 -#define CC_125_M33 0x11090005 - -/* Clock control magic field values */ -#define CC_F6_2 0x02 /* A factor of 2 in */ -#define CC_F6_3 0x03 /* 6-bit fields like */ -#define CC_F6_4 0x05 /* N1, M1 or M3 */ -#define CC_F6_5 0x09 -#define CC_F6_6 0x11 -#define CC_F6_7 0x21 - -#define CC_F5_BIAS 5 /* 5-bit fields get this added */ - -#define CC_MC_BYPASS 0x08 -#define CC_MC_M1 0x04 -#define CC_MC_M1M2 0x02 -#define CC_MC_M1M2M3 0x01 -#define CC_MC_M1M3 0x11 - -#define CC_CLOCK_BASE 24000000 /* Half the clock freq. in the 4710 */ - -#endif /* _SBEXTIF_H */ diff --git a/openwrt/package/linux/kernel-source/include/sbmemc.h b/openwrt/package/linux/kernel-source/include/sbmemc.h deleted file mode 100644 index d0002ac345..0000000000 --- a/openwrt/package/linux/kernel-source/include/sbmemc.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * BCM47XX Sonics SiliconBackplane DDR/SDRAM controller core hardware definitions. - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#ifndef _SBMEMC_H -#define _SBMEMC_H - -#ifdef _LANGUAGE_ASSEMBLY - -#define MEMC_CONTROL 0x00 -#define MEMC_CONFIG 0x04 -#define MEMC_REFRESH 0x08 -#define MEMC_BISTSTAT 0x0c -#define MEMC_MODEBUF 0x10 -#define MEMC_BKCLS 0x14 -#define MEMC_PRIORINV 0x18 -#define MEMC_DRAMTIM 0x1c -#define MEMC_INTSTAT 0x20 -#define MEMC_INTMASK 0x24 -#define MEMC_INTINFO 0x28 -#define MEMC_NCDLCTL 0x30 -#define MEMC_RDNCDLCOR 0x34 -#define MEMC_WRNCDLCOR 0x38 -#define MEMC_MISCDLYCTL 0x3c -#define MEMC_DQSGATENCDL 0x40 -#define MEMC_SPARE 0x44 -#define MEMC_TPADDR 0x48 -#define MEMC_TPDATA 0x4c -#define MEMC_BARRIER 0x50 -#define MEMC_CORE 0x54 - - -#else - -/* Sonics side: MEMC core registers */ -typedef volatile struct sbmemcregs { - uint32 control; - uint32 config; - uint32 refresh; - uint32 biststat; - uint32 modebuf; - uint32 bkcls; - uint32 priorinv; - uint32 dramtim; - uint32 intstat; - uint32 intmask; - uint32 intinfo; - uint32 reserved1; - uint32 ncdlctl; - uint32 rdncdlcor; - uint32 wrncdlcor; - uint32 miscdlyctl; - uint32 dqsgatencdl; - uint32 spare; - uint32 tpaddr; - uint32 tpdata; - uint32 barrier; - uint32 core; -} sbmemcregs_t; - -#endif - -/* MEMC Core Init values (OCP ID 0x80f) */ - -/* For sdr: */ -#define MEMC_SD_CONFIG_INIT 0x00048000 -#define MEMC_SD_DRAMTIM2_INIT 0x000754d8 -#define MEMC_SD_DRAMTIM3_INIT 0x000754da -#define MEMC_SD_RDNCDLCOR_INIT 0x00000000 -#define MEMC_SD_WRNCDLCOR_INIT 0x49351200 -#define MEMC_SD1_WRNCDLCOR_INIT 0x14500200 /* For corerev 1 (4712) */ -#define MEMC_SD_MISCDLYCTL_INIT 0x00061c1b -#define MEMC_SD1_MISCDLYCTL_INIT 0x00021416 /* For corerev 1 (4712) */ -#define MEMC_SD_CONTROL_INIT0 0x00000002 -#define MEMC_SD_CONTROL_INIT1 0x00000008 -#define MEMC_SD_CONTROL_INIT2 0x00000004 -#define MEMC_SD_CONTROL_INIT3 0x00000010 -#define MEMC_SD_CONTROL_INIT4 0x00000001 -#define MEMC_SD_MODEBUF_INIT 0x00000000 -#define MEMC_SD_REFRESH_INIT 0x0000840f - - -/* This is for SDRM8X8X4 */ -#define MEMC_SDR_INIT 0x0008 -#define MEMC_SDR_MODE 0x32 -#define MEMC_SDR_NCDL 0x00020032 -#define MEMC_SDR1_NCDL 0x0002020f /* For corerev 1 (4712) */ - -/* For ddr: */ -#define MEMC_CONFIG_INIT 0x00048000 -#define MEMC_DRAMTIM2_INIT 0x000754d8 -#define MEMC_DRAMTIM25_INIT 0x000754d9 -#define MEMC_RDNCDLCOR_INIT 0x00000000 -#define MEMC_WRNCDLCOR_INIT 0x49351200 -#define MEMC_1_WRNCDLCOR_INIT 0x14500200 -#define MEMC_DQSGATENCDL_INIT 0x00030000 -#define MEMC_MISCDLYCTL_INIT 0x21061c1b -#define MEMC_1_MISCDLYCTL_INIT 0x21021400 -#define MEMC_NCDLCTL_INIT 0x00002001 -#define MEMC_CONTROL_INIT0 0x00000002 -#define MEMC_CONTROL_INIT1 0x00000008 -#define MEMC_MODEBUF_INIT0 0x00004000 -#define MEMC_CONTROL_INIT2 0x00000010 -#define MEMC_MODEBUF_INIT1 0x00000100 -#define MEMC_CONTROL_INIT3 0x00000010 -#define MEMC_CONTROL_INIT4 0x00000008 -#define MEMC_REFRESH_INIT 0x0000840f -#define MEMC_CONTROL_INIT5 0x00000004 -#define MEMC_MODEBUF_INIT2 0x00000000 -#define MEMC_CONTROL_INIT6 0x00000010 -#define MEMC_CONTROL_INIT7 0x00000001 - - -/* This is for DDRM16X16X2 */ -#define MEMC_DDR_INIT 0x0009 -#define MEMC_DDR_MODE 0x62 -#define MEMC_DDR_NCDL 0x0005050a -#define MEMC_DDR1_NCDL 0x00000a0a /* For corerev 1 (4712) */ - -/* mask for sdr/ddr calibration registers */ -#define MEMC_RDNCDLCOR_RD_MASK 0x000000ff -#define MEMC_WRNCDLCOR_WR_MASK 0x000000ff -#define MEMC_DQSGATENCDL_G_MASK 0x000000ff - -/* masks for miscdlyctl registers */ -#define MEMC_MISC_SM_MASK 0x30000000 -#define MEMC_MISC_SM_SHIFT 28 -#define MEMC_MISC_SD_MASK 0x0f000000 -#define MEMC_MISC_SD_SHIFT 24 - -/* hw threshhold for calculating wr/rd for sdr memc */ -#define MEMC_CD_THRESHOLD 128 - -/* Low bit of init register says if memc is ddr or sdr */ -#define MEMC_CONFIG_DDR 0x00000001 - -#endif /* _SBMEMC_H */ diff --git a/openwrt/package/linux/kernel-source/include/sbmips.h b/openwrt/package/linux/kernel-source/include/sbmips.h deleted file mode 100644 index 677eaca5f2..0000000000 --- a/openwrt/package/linux/kernel-source/include/sbmips.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Broadcom SiliconBackplane MIPS definitions - * - * SB MIPS cores are custom MIPS32 processors with SiliconBackplane - * OCP interfaces. The CP0 processor ID is 0x00024000, where bits - * 23:16 mean Broadcom and bits 15:8 mean a MIPS core with an OCP - * interface. The core revision is stored in the SB ID register in SB - * configuration space. - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#ifndef _SBMIPS_H -#define _SBMIPS_H - -#ifndef _LANGUAGE_ASSEMBLY - -/* cpp contortions to concatenate w/arg prescan */ -#ifndef PAD -#define _PADLINE(line) pad ## line -#define _XSTR(line) _PADLINE(line) -#define PAD _XSTR(__LINE__) -#endif /* PAD */ - -typedef volatile struct { - uint32 corecontrol; - uint32 PAD[2]; - uint32 biststatus; - uint32 PAD[4]; - uint32 intstatus; - uint32 intmask; - uint32 timer; -} mipsregs_t; - -extern uint32 sb_flag(void *sbh); -extern uint sb_irq(void *sbh); - -extern void sb_serial_init(void *sbh, void (*add)(void *regs, uint irq, uint baud_base, uint reg_shift)); - -extern void sb_mips_init(void *sbh); -extern uint32 sb_mips_clock(void *sbh); -extern bool sb_mips_setclock(void *sbh, uint32 mipsclock, uint32 sbclock, uint32 pciclock); - -extern uint32 sb_memc_get_ncdl(void *sbh); - -#endif /* _LANGUAGE_ASSEMBLY */ - -#endif /* _SBMIPS_H */ diff --git a/openwrt/package/linux/kernel-source/include/sbpci.h b/openwrt/package/linux/kernel-source/include/sbpci.h deleted file mode 100644 index d39a91b3a5..0000000000 --- a/openwrt/package/linux/kernel-source/include/sbpci.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * BCM47XX Sonics SiliconBackplane PCI core hardware definitions. - * - * $Id$ - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - */ - -#ifndef _SBPCI_H -#define _SBPCI_H - -/* cpp contortions to concatenate w/arg prescan */ -#ifndef PAD -#define _PADLINE(line) pad ## line -#define _XSTR(line) _PADLINE(line) -#define PAD _XSTR(__LINE__) -#endif - -/* Sonics side: PCI core and host control registers */ -typedef struct sbpciregs { - uint32 control; /* PCI control */ - uint32 PAD[3]; - uint32 arbcontrol; /* PCI arbiter control */ - uint32 PAD[3]; - uint32 intstatus; /* Interrupt status */ - uint32 intmask; /* Interrupt mask */ - uint32 sbtopcimailbox; /* Sonics to PCI mailbox */ - uint32 PAD[9]; - uint32 bcastaddr; /* Sonics broadcast address */ - uint32 bcastdata; /* Sonics broadcast data */ - uint32 PAD[2]; - uint32 gpioin; /* ro: gpio input (>=rev2) */ - uint32 gpioout; /* rw: gpio output (>=rev2) */ - uint32 gpioouten; /* rw: gpio output enable (>= rev2) */ - uint32 gpiocontrol; /* rw: gpio control (>= rev2) */ - uint32 PAD[36]; - uint32 sbtopci0; /* Sonics to PCI translation 0 */ - uint32 sbtopci1; /* Sonics to PCI translation 1 */ - uint32 sbtopci2; /* Sonics to PCI translation 2 */ - uint32 PAD[445]; - uint16 sprom[36]; /* SPROM shadow Area */ - uint32 PAD[46]; -} sbpciregs_t; - -/* PCI control */ -#define PCI_RST_OE 0x01 /* When set, drives PCI_RESET out to pin */ -#define PCI_RST 0x02 /* Value driven out to pin */ -#define PCI_CLK_OE 0x04 /* When set, drives clock as gated by PCI_CLK out to pin */ -#define PCI_CLK 0x08 /* Gate for clock driven out to pin */ - -/* PCI arbiter control */ -#define PCI_INT_ARB 0x01 /* When set, use an internal arbiter */ -#define PCI_EXT_ARB 0x02 /* When set, use an external arbiter */ -#define PCI_PARKID_MASK 0x06 /* Selects which agent is parked on an idle bus */ -#define PCI_PARKID_SHIFT 1 -#define PCI_PARKID_LAST 0 /* Last requestor */ -#define PCI_PARKID_4710 1 /* 4710 */ -#define PCI_PARKID_EXTREQ0 2 /* External requestor 0 */ -#define PCI_PARKID_EXTREQ1 3 /* External requestor 1 */ - -/* Interrupt status/mask */ -#define PCI_INTA 0x01 /* PCI INTA# is asserted */ -#define PCI_INTB 0x02 /* PCI INTB# is asserted */ -#define PCI_SERR 0x04 /* PCI SERR# has been asserted (write one to clear) */ -#define PCI_PERR 0x08 /* PCI PERR# has been asserted (write one to clear) */ -#define PCI_PME 0x10 /* PCI PME# is asserted */ - -/* (General) PCI/SB mailbox interrupts, two bits per pci function */ -#define MAILBOX_F0_0 0x100 /* function 0, int 0 */ -#define MAILBOX_F0_1 0x200 /* function 0, int 1 */ -#define MAILBOX_F1_0 0x400 /* function 1, int 0 */ -#define MAILBOX_F1_1 0x800 /* function 1, int 1 */ -#define MAILBOX_F2_0 0x1000 /* function 2, int 0 */ -#define MAILBOX_F2_1 0x2000 /* function 2, int 1 */ -#define MAILBOX_F3_0 0x4000 /* function 3, int 0 */ -#define MAILBOX_F3_1 0x8000 /* function 3, int 1 */ - -/* Sonics broadcast address */ -#define BCAST_ADDR_MASK 0xff /* Broadcast register address */ - -/* Sonics to PCI translation types */ -#define SBTOPCI0_MASK 0xfc000000 -#define SBTOPCI1_MASK 0xfc000000 -#define SBTOPCI2_MASK 0xc0000000 -#define SBTOPCI_MEM 0 -#define SBTOPCI_IO 1 -#define SBTOPCI_CFG0 2 -#define SBTOPCI_CFG1 3 -#define SBTOPCI_PREF 0x4 /* prefetch enable */ -#define SBTOPCI_BURST 0x8 /* burst enable */ - -/* PCI side: Reserved PCI configuration registers (see pcicfg.h) */ -#define cap_list rsvd_a[0] -#define bar0_window dev_dep[0x80 - 0x40] -#define bar1_window dev_dep[0x84 - 0x40] -#define sprom_control dev_dep[0x88 - 0x40] - -#ifndef _LANGUAGE_ASSEMBLY - -extern int sbpci_read_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len); -extern int sbpci_write_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len); -extern void sbpci_ban(uint16 core); -extern int sbpci_init(void *sbh); -extern void sbpci_check(void *sbh); - -#endif /* !_LANGUAGE_ASSEMBLY */ - -#endif /* _SBPCI_H */ diff --git a/openwrt/package/linux/kernel-source/include/sbpcmcia.h b/openwrt/package/linux/kernel-source/include/sbpcmcia.h deleted file mode 100644 index 2493d8c7ad..0000000000 --- a/openwrt/package/linux/kernel-source/include/sbpcmcia.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * BCM43XX Sonics SiliconBackplane PCMCIA core hardware definitions. - * - * $Id$ - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - */ - -#ifndef _SBPCMCIA_H -#define _SBPCMCIA_H - - -/* All the addresses that are offsets in attribute space are divided - * by two to account for the fact that odd bytes are invalid in - * attribute space and our read/write routines make the space appear - * as if they didn't exist. Still we want to show the original numbers - * as documented in the hnd_pcmcia core manual. - */ - -/* PCMCIA Function Configuration Registers */ -#define PCMCIA_FCR (0x700 / 2) - -#define FCR0_OFF 0 -#define FCR1_OFF (0x40 / 2) -#define FCR2_OFF (0x80 / 2) -#define FCR3_OFF (0xc0 / 2) - -#define PCMCIA_FCR0 (0x700 / 2) -#define PCMCIA_FCR1 (0x740 / 2) -#define PCMCIA_FCR2 (0x780 / 2) -#define PCMCIA_FCR3 (0x7c0 / 2) - -/* Standard PCMCIA FCR registers */ - -#define PCMCIA_COR 0 - -#define COR_RST 0x80 -#define COR_LEV 0x40 -#define COR_IRQEN 0x04 -#define COR_BLREN 0x01 -#define COR_FUNEN 0x01 - - -#define PCICIA_FCSR (2 / 2) -#define PCICIA_PRR (4 / 2) -#define PCICIA_SCR (6 / 2) -#define PCICIA_ESR (8 / 2) - - -#define PCM_MEMOFF 0x0000 -#define F0_MEMOFF 0x1000 -#define F1_MEMOFF 0x2000 -#define F2_MEMOFF 0x3000 -#define F3_MEMOFF 0x4000 - -/* Memory base in the function fcr's */ -#define MEM_ADDR0 (0x728 / 2) -#define MEM_ADDR1 (0x72a / 2) -#define MEM_ADDR2 (0x72c / 2) - -/* PCMCIA base plus Srom access in fcr0: */ -#define PCMCIA_ADDR0 (0x072e / 2) -#define PCMCIA_ADDR1 (0x0730 / 2) -#define PCMCIA_ADDR2 (0x0732 / 2) - -#define MEM_SEG (0x0734 / 2) -#define SROM_CS (0x0736 / 2) -#define SROM_DATAL (0x0738 / 2) -#define SROM_DATAH (0x073a / 2) -#define SROM_ADDRL (0x073c / 2) -#define SROM_ADDRH (0x073e / 2) - -/* Values for srom_cs: */ -#define SROM_IDLE 0 -#define SROM_WRITE 1 -#define SROM_READ 2 -#define SROM_WEN 4 -#define SROM_WDS 7 -#define SROM_DONE 8 - -/* CIS stuff */ - -/* The CIS stops where the FCRs start */ -#define CIS_SIZE PCMCIA_FCR - -/* Standard tuples we know about */ - -#define CISTPL_MANFID 0x20 /* Manufacturer and device id */ -#define CISTPL_FUNCE 0x22 /* Function extensions */ -#define CISTPL_CFTABLE 0x1b /* Config table entry */ - -/* Function extensions for LANs */ - -#define LAN_TECH 1 /* Technology type */ -#define LAN_SPEED 2 /* Raw bit rate */ -#define LAN_MEDIA 3 /* Transmission media */ -#define LAN_NID 4 /* Node identification (aka MAC addr) */ -#define LAN_CONN 5 /* Connector standard */ - - -/* CFTable */ -#define CFTABLE_REGWIN_2K 0x08 /* 2k reg windows size */ -#define CFTABLE_REGWIN_4K 0x10 /* 4k reg windows size */ -#define CFTABLE_REGWIN_8K 0x20 /* 8k reg windows size */ - -/* Vendor unique tuples are 0x80-0x8f. Within Broadcom we'll - * take one for HNBU, and use "extensions" (a la FUNCE) within it. - */ - -#define CISTPL_BRCM_HNBU 0x80 - -/* Subtypes of BRCM_HNBU: */ - -#define HNBU_CHIPID 0x01 /* Six bytes with PCI vendor & - * device id and chiprev - */ -#define HNBU_BOARDREV 0x02 /* Two bytes board revision */ -#define HNBU_PAPARMS 0x03 /* Eleven bytes PA parameters */ -#define HNBU_OEM 0x04 /* Eight bytes OEM data */ -#define HNBU_CC 0x05 /* Default country code */ -#define HNBU_AA 0x06 /* Antennas available */ -#define HNBU_AG 0x07 /* Antenna gain */ -#define HNBU_BOARDFLAGS 0x08 /* board flags */ -#define HNBU_LED 0x09 /* LED set */ - - -/* sbtmstatelow */ -#define SBTML_INT_ACK 0x40000 /* ack the sb interrupt */ -#define SBTML_INT_EN 0x20000 /* enable sb interrupt */ - -/* sbtmstatehigh */ -#define SBTMH_INT_STATUS 0x40000 /* sb interrupt status */ - -#endif /* _SBPCMCIA_H */ diff --git a/openwrt/package/linux/kernel-source/include/sbsdram.h b/openwrt/package/linux/kernel-source/include/sbsdram.h deleted file mode 100644 index 1b4c539a84..0000000000 --- a/openwrt/package/linux/kernel-source/include/sbsdram.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * BCM47XX Sonics SiliconBackplane SDRAM controller core hardware definitions. - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * $Id$ - */ - -#ifndef _SBSDRAM_H -#define _SBSDRAM_H - -#ifndef _LANGUAGE_ASSEMBLY - -/* Sonics side: SDRAM core registers */ -typedef volatile struct sbsdramregs { - uint32 initcontrol; /* Generates external SDRAM initialization sequence */ - uint32 config; /* Initializes external SDRAM mode register */ - uint32 refresh; /* Controls external SDRAM refresh rate */ - uint32 pad1; - uint32 pad2; -} sbsdramregs_t; - -#endif - -/* SDRAM initialization control (initcontrol) register bits */ -#define SDRAM_CBR 0x0001 /* Writing 1 generates refresh cycle and toggles bit */ -#define SDRAM_PRE 0x0002 /* Writing 1 generates precharge cycle and toggles bit */ -#define SDRAM_MRS 0x0004 /* Writing 1 generates mode register select cycle and toggles bit */ -#define SDRAM_EN 0x0008 /* When set, enables access to SDRAM */ -#define SDRAM_16Mb 0x0000 /* Use 16 Megabit SDRAM */ -#define SDRAM_64Mb 0x0010 /* Use 64 Megabit SDRAM */ -#define SDRAM_128Mb 0x0020 /* Use 128 Megabit SDRAM */ -#define SDRAM_RSVMb 0x0030 /* Use special SDRAM */ -#define SDRAM_RST 0x0080 /* Writing 1 causes soft reset of controller */ -#define SDRAM_SELFREF 0x0100 /* Writing 1 enables self refresh mode */ -#define SDRAM_PWRDOWN 0x0200 /* Writing 1 causes controller to power down */ -#define SDRAM_32BIT 0x0400 /* When set, indicates 32 bit SDRAM interface */ -#define SDRAM_9BITCOL 0x0800 /* When set, indicates 9 bit column */ - -/* SDRAM configuration (config) register bits */ -#define SDRAM_BURSTFULL 0x0000 /* Use full page bursts */ -#define SDRAM_BURST8 0x0001 /* Use burst of 8 */ -#define SDRAM_BURST4 0x0002 /* Use burst of 4 */ -#define SDRAM_BURST2 0x0003 /* Use burst of 2 */ -#define SDRAM_CAS3 0x0000 /* Use CAS latency of 3 */ -#define SDRAM_CAS2 0x0004 /* Use CAS latency of 2 */ - -/* SDRAM refresh control (refresh) register bits */ -#define SDRAM_REF(p) (((p)&0xff) | SDRAM_REF_EN) /* Refresh period */ -#define SDRAM_REF_EN 0x8000 /* Writing 1 enables periodic refresh */ - -/* SDRAM Core default Init values (OCP ID 0x803) */ -#define SDRAM_INIT MEM4MX16X2 -#define SDRAM_CONFIG SDRAM_BURSTFULL -#define SDRAM_REFRESH SDRAM_REF(0x40) - -#define MEM1MX16 0x009 /* 2 MB */ -#define MEM1MX16X2 0x409 /* 4 MB */ -#define MEM2MX8X2 0x809 /* 4 MB */ -#define MEM2MX8X4 0xc09 /* 8 MB */ -#define MEM2MX32 0x439 /* 8 MB */ -#define MEM4MX16 0x019 /* 8 MB */ -#define MEM4MX16X2 0x419 /* 16 MB */ -#define MEM8MX8X2 0x819 /* 16 MB */ -#define MEM8MX16 0x829 /* 16 MB */ -#define MEM4MX32 0x429 /* 16 MB */ -#define MEM8MX8X4 0xc19 /* 32 MB */ -#define MEM8MX16X2 0xc29 /* 32 MB */ - -#endif /* _SBSDRAM_H */ diff --git a/openwrt/package/linux/kernel-source/include/sbutils.h b/openwrt/package/linux/kernel-source/include/sbutils.h deleted file mode 100644 index 1ab09f19d4..0000000000 --- a/openwrt/package/linux/kernel-source/include/sbutils.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Misc utility routines for accessing chip-specific features - * of Broadcom HNBU SiliconBackplane-based chips. - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#ifndef _sbutils_h_ -#define _sbutils_h_ - -/* Board styles (bustype) */ -#define BOARDSTYLE_SOC 0 /* Silicon Backplane */ -#define BOARDSTYLE_PCI 1 /* PCI/MiniPCI board */ -#define BOARDSTYLE_PCMCIA 2 /* PCMCIA board */ -#define BOARDSTYLE_CARDBUS 3 /* Cardbus board */ - -/* - * Many of the routines below take an 'sbh' handle as their first arg. - * Allocate this by calling sb_attach(). Free it by calling sb_detach(). - * At any one time, the sbh is logically focused on one particular sb core - * (the "current core"). - * Use sb_setcore() or sb_setcoreidx() to change the association to another core. - */ - -/* exported externs */ -extern void *sb_attach(uint pcidev, void *osh, void *regs, uint bustype, void *sdh, char **vars, int *varsz); -extern void *sb_kattach(void); -extern void sb_detach(void *sbh); -extern uint sb_chip(void *sbh); -extern uint sb_chiprev(void *sbh); -extern uint sb_chipcrev(void *sbh); -extern uint sb_chippkg(void *sbh); -extern uint sb_pcirev(void *sbh); -extern uint sb_pcmciarev(void *sbh); -extern uint sb_boardvendor(void *sbh); -extern uint sb_boardtype(void *sbh); -extern uint sb_boardstyle(void *sbh); -extern uint sb_bus(void *sbh); -extern uint sb_corelist(void *sbh, uint coreid[]); -extern uint sb_coreid(void *sbh); -extern uint sb_coreidx(void *sbh); -extern uint sb_coreunit(void *sbh); -extern uint sb_corevendor(void *sbh); -extern uint sb_corerev(void *sbh); -extern void *sb_coreregs(void *sbh); -extern uint32 sb_coreflags(void *sbh, uint32 mask, uint32 val); -extern uint32 sb_coreflagshi(void *sbh, uint32 mask, uint32 val); -extern bool sb_iscoreup(void *sbh); -extern void *sb_setcoreidx(void *sbh, uint coreidx); -extern void *sb_setcore(void *sbh, uint coreid, uint coreunit); -extern void sb_commit(void *sbh); -extern uint32 sb_base(uint32 admatch); -extern uint32 sb_size(uint32 admatch); -extern void sb_core_reset(void *sbh, uint32 bits); -extern void sb_core_tofixup(void *sbh); -extern void sb_core_disable(void *sbh, uint32 bits); -extern uint32 sb_clock_rate(uint32 pll_type, uint32 n, uint32 m); -extern uint32 sb_clock(void *sbh); -extern void sb_pci_setup(void *sbh, uint32 *dmaoffset, uint coremask); -extern void sb_pcmcia_init(void *sbh); -extern void sb_watchdog(void *sbh, uint ticks); -extern void *sb_gpiosetcore(void *sbh); -extern uint32 sb_gpiocontrol(void *sbh, uint32 mask, uint32 val); -extern uint32 sb_gpioouten(void *sbh, uint32 mask, uint32 val); -extern uint32 sb_gpioout(void *sbh, uint32 mask, uint32 val); -extern uint32 sb_gpioin(void *sbh); -extern uint32 sb_gpiointpolarity(void *sbh, uint32 mask, uint32 val); -extern uint32 sb_gpiointmask(void *sbh, uint32 mask, uint32 val); -extern bool sb_taclear(void *sbh); -extern void sb_pwrctl_init(void *sbh); -extern uint16 sb_pwrctl_fast_pwrup_delay(void *sbh); -extern bool sb_pwrctl_clk(void *sbh, uint mode); -extern int sb_pwrctl_xtal(void *sbh, uint what, bool on); -extern int sb_pwrctl_slowclk(void *sbh, bool set, uint *div); -extern void sb_register_intr_callback(void *sbh, void *intrsoff_fn, void *intrsrestore_fn, void *intrsenabled_fn, void *intr_arg); - -/* pwrctl xtal what flags */ -#define XTAL 0x1 /* primary crystal oscillator (2050) */ -#define PLL 0x2 /* main chip pll */ - -/* pwrctl clk mode */ -#define CLK_FAST 0 /* force fast (pll) clock */ -#define CLK_SLOW 1 /* force slow clock */ -#define CLK_DYNAMIC 2 /* enable dynamic power control */ - -#endif /* _sbutils_h_ */ diff --git a/openwrt/package/linux/kernel-source/include/sflash.h b/openwrt/package/linux/kernel-source/include/sflash.h deleted file mode 100644 index 4691b5c344..0000000000 --- a/openwrt/package/linux/kernel-source/include/sflash.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Broadcom SiliconBackplane chipcommon serial flash interface - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#ifndef _sflash_h_ -#define _sflash_h_ - -#include -#include - -struct sflash { - uint blocksize; /* Block size */ - uint numblocks; /* Number of blocks */ - uint32 type; /* Type */ - uint size; /* Total size in bytes */ -}; - -/* Utility functions */ -extern int sflash_poll(chipcregs_t *cc, uint offset); -extern int sflash_read(chipcregs_t *cc, uint offset, uint len, uchar *buf); -extern int sflash_write(chipcregs_t *cc, uint offset, uint len, const uchar *buf); -extern int sflash_erase(chipcregs_t *cc, uint offset); -extern int sflash_commit(chipcregs_t *cc, uint offset, uint len, const uchar *buf); -extern struct sflash * sflash_init(chipcregs_t *cc); - -#endif /* _sflash_h_ */ diff --git a/openwrt/package/linux/kernel-source/include/trxhdr.h b/openwrt/package/linux/kernel-source/include/trxhdr.h deleted file mode 100644 index 93b100fee0..0000000000 --- a/openwrt/package/linux/kernel-source/include/trxhdr.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * TRX image file header format. - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * $Id$ - */ - -#include - -#define TRX_MAGIC 0x30524448 /* "HDR0" */ -#define TRX_VERSION 1 -#define TRX_MAX_LEN 0x3A0000 -#define TRX_NO_HEADER 1 /* Do not write TRX header */ - -struct trx_header { - uint32 magic; /* "HDR0" */ - uint32 len; /* Length of file including header */ - uint32 crc32; /* 32-bit CRC from flag_version to end of file */ - uint32 flag_version; /* 0:15 flags, 16:31 version */ - uint32 offsets[3]; /* Offsets of partitions from start of header */ -}; - -/* Compatibility */ -typedef struct trx_header TRXHDR, *PTRXHDR; diff --git a/openwrt/package/linux/kernel-source/include/typedefs.h b/openwrt/package/linux/kernel-source/include/typedefs.h deleted file mode 100644 index 6b0c25e042..0000000000 --- a/openwrt/package/linux/kernel-source/include/typedefs.h +++ /dev/null @@ -1,293 +0,0 @@ -/* - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * $Id$ - */ - -#ifndef _TYPEDEFS_H_ -#define _TYPEDEFS_H_ - - -/* Define 'SITE_TYPEDEFS' in the compile to include a site specific - * typedef file "site_typedefs.h". - * - * If 'SITE_TYPEDEFS' is not defined, then the "Inferred Typedefs" - * section of this file makes inferences about the compile environment - * based on defined symbols and possibly compiler pragmas. - * - * Following these two sections is the "Default Typedefs" - * section. This section is only prcessed if 'USE_TYPEDEF_DEFAULTS' is - * defined. This section has a default set of typedefs and a few - * proprocessor symbols (TRUE, FALSE, NULL, ...). - */ - -#ifdef SITE_TYPEDEFS - -/******************************************************************************* - * Site Specific Typedefs - *******************************************************************************/ - -#include "site_typedefs.h" - -#else - -/******************************************************************************* - * Inferred Typedefs - *******************************************************************************/ - -/* Infer the compile environment based on preprocessor symbols and pramas. - * Override type definitions as needed, and include configuration dependent - * header files to define types. - */ - -#ifdef __cplusplus - -#define TYPEDEF_BOOL -#ifndef FALSE -#define FALSE false -#endif -#ifndef TRUE -#define TRUE true -#endif - -#else /* ! __cplusplus */ - -/* for Windows build, define bool as a uchar instead of the default int */ -#if defined(_WIN32) - -#define TYPEDEF_BOOL -typedef unsigned char bool; - -#endif /* _WIN32 */ - -#endif /* ! __cplusplus */ - -#ifdef _MSC_VER /* Microsoft C */ -#define TYPEDEF_INT64 -#define TYPEDEF_UINT64 -typedef signed __int64 int64; -typedef unsigned __int64 uint64; -#endif - -#if defined(MACOSX) && defined(KERNEL) -#define TYPEDEF_BOOL -#endif - - -#if defined(linux) -#define TYPEDEF_UINT -#define TYPEDEF_USHORT -#define TYPEDEF_ULONG -#endif - -#if !defined(linux) && !defined(_WIN32) && !defined(PMON) && !defined(_CFE_) -#define TYPEDEF_UINT -#define TYPEDEF_USHORT -#endif - - -/* Do not support the (u)int64 types with strict ansi for GNU C */ -#if defined(__GNUC__) && defined(__STRICT_ANSI__) -#define TYPEDEF_INT64 -#define TYPEDEF_UINT64 -#endif - -/* ICL accepts unsigned 64 bit type only, and complains in ANSI mode - * for singned or unsigned */ -#if defined(__ICL) - -#define TYPEDEF_INT64 - -#if defined(__STDC__) -#define TYPEDEF_UINT64 -#endif - -#endif /* __ICL */ - - -#if !defined(_WIN32) && !defined(PMON) && !defined(_CFE_) - -/* pick up ushort & uint from standard types.h */ -#if defined(linux) && defined(__KERNEL__) - -#include /* sys/types.h and linux/types.h are oil and water */ - -#else - -#include - -#endif - -#endif /* !_WIN32 && !PMON && !_CFE_ */ - -#if defined(MACOSX) && defined(KERNEL) -#include -#endif - - -/* use the default typedefs in the next section of this file */ -#define USE_TYPEDEF_DEFAULTS - -#endif /* SITE_TYPEDEFS */ - - -/******************************************************************************* - * Default Typedefs - *******************************************************************************/ - -#ifdef USE_TYPEDEF_DEFAULTS -#undef USE_TYPEDEF_DEFAULTS - -#ifndef TYPEDEF_BOOL -typedef int bool; -#endif - -/*----------------------- define uchar, ushort, uint, ulong ----------------*/ - -#ifndef TYPEDEF_UCHAR -typedef unsigned char uchar; -#endif - -#ifndef TYPEDEF_USHORT -typedef unsigned short ushort; -#endif - -#ifndef TYPEDEF_UINT -typedef unsigned int uint; -#endif - -#ifndef TYPEDEF_ULONG -typedef unsigned long ulong; -#endif - -/*----------------------- define [u]int8/16/32/64 --------------------------*/ - -#ifndef TYPEDEF_UINT8 -typedef unsigned char uint8; -#endif - -#ifndef TYPEDEF_UINT16 -typedef unsigned short uint16; -#endif - -#ifndef TYPEDEF_UINT32 -typedef unsigned int uint32; -#endif - -#ifndef TYPEDEF_UINT64 -typedef unsigned long long uint64; -#endif - -#ifndef TYPEDEF_INT8 -typedef signed char int8; -#endif - -#ifndef TYPEDEF_INT16 -typedef signed short int16; -#endif - -#ifndef TYPEDEF_INT32 -typedef signed int int32; -#endif - -#ifndef TYPEDEF_INT64 -typedef signed long long int64; -#endif - -/*----------------------- define float32/64, float_t -----------------------*/ - -#ifndef TYPEDEF_FLOAT32 -typedef float float32; -#endif - -#ifndef TYPEDEF_FLOAT64 -typedef double float64; -#endif - -/* - * abstracted floating point type allows for compile time selection of - * single or double precision arithmetic. Compiling with -DFLOAT32 - * selects single precision; the default is double precision. - */ - -#ifndef TYPEDEF_FLOAT_T - -#if defined(FLOAT32) -typedef float32 float_t; -#else /* default to double precision floating point */ -typedef float64 float_t; -#endif - -#endif /* TYPEDEF_FLOAT_T */ - -/*----------------------- define macro values -----------------------------*/ - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef NULL -#define NULL 0 -#endif - -#ifndef OFF -#define OFF 0 -#endif - -#ifndef ON -#define ON 1 -#endif - -/*----------------------- define PTRSZ, INLINE ----------------------------*/ - -#ifndef PTRSZ -#define PTRSZ sizeof (char*) -#endif - -#ifndef INLINE - -#ifdef _MSC_VER - -#define INLINE __inline - -#elif __GNUC__ - -#define INLINE __inline__ - -#else - -#define INLINE - -#endif /* _MSC_VER */ - -#endif /* INLINE */ - -#undef TYPEDEF_BOOL -#undef TYPEDEF_UCHAR -#undef TYPEDEF_USHORT -#undef TYPEDEF_UINT -#undef TYPEDEF_ULONG -#undef TYPEDEF_UINT8 -#undef TYPEDEF_UINT16 -#undef TYPEDEF_UINT32 -#undef TYPEDEF_UINT64 -#undef TYPEDEF_INT8 -#undef TYPEDEF_INT16 -#undef TYPEDEF_INT32 -#undef TYPEDEF_INT64 -#undef TYPEDEF_FLOAT32 -#undef TYPEDEF_FLOAT64 -#undef TYPEDEF_FLOAT_T - -#endif /* USE_TYPEDEF_DEFAULTS */ - -#endif /* _TYPEDEFS_H_ */ diff --git a/openwrt/package/linux/linux-2.4/linux.mk b/openwrt/package/linux/linux-2.4/linux.mk deleted file mode 100644 index 9fdef71f78..0000000000 --- a/openwrt/package/linux/linux-2.4/linux.mk +++ /dev/null @@ -1,114 +0,0 @@ -############################################################# -# $Id$ -# -# Linux 2.4 kernel target for the OpenWRT project -# -# patches are sorted by numbers -# 0xx needed patches for board, cpu, filesystem -# 1xx addon patches for new features (netfilter, ebtables, cifs,..) -# 2xx compile fixes, driver fixes -# -############################################################# - -LINUX_FORMAT=zImage -LINUX_KARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \ - -e 's/mipsel/mips/' \ - -e 's/powerpc/ppc/' \ - -e 's/sh[234]/sh/' \ - ) - -LINUX_BINARY_DRIVER_SITE=http://openwrt.org/downloads/ -LINUX_SOURCE=linux-$(LINUX_VERSION).tar.bz2 -LINUX_KCONFIG=./linux-2.4/linux.config -LINUX_PATCHES=./linux-2.4/patches -LINUX_BINLOC=arch/$(LINUX_KARCH)/bcm947xx/compressed/piggy -# Used by pcmcia-cs and others -LINUX_SOURCE_DIR=$(LINUX_DIR)-$(LINUX_VERSION) - -# proprietary driver, extracted from asus GPL sourcetree GPL_1941.zip -LINUX_BINARY_WL_DRIVER=kernel-binary-wl-0.3.tar.gz -LINUX_BINARY_WL_MD5SUM=cc45df670bcfb4e74a709b9d7beba636 -LINUX_ET_DRIVER=kernel-source-et-0.7.tar.gz -LINUX_ET_MD5SUM=2d12b6dae78b20c88fee9fb41e88a51b - -TARGET_MODULES_DIR=$(TARGET_DIR)/lib/modules/$(LINUX_VERSION) - -$(DL_DIR)/$(LINUX_BINARY_WL_DRIVER): - $(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_BINARY_WL_DRIVER) $(LINUX_BINARY_WL_MD5SUM) $(LINUX_BINARY_DRIVER_SITE) - -$(DL_DIR)/$(LINUX_ET_DRIVER): - $(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_ET_DRIVER) $(LINUX_ET_MD5SUM) $(LINUX_BINARY_DRIVER_SITE) - -$(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE) $(DL_DIR)/$(LINUX_BINARY_WL_DRIVER) $(DL_DIR)/$(LINUX_ET_DRIVER) - -mkdir -p $(BUILD_DIR) - bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - - ln -sf $(LINUX_DIR)-$(LINUX_VERSION) $(LINUX_DIR) - zcat $(DL_DIR)/$(LINUX_BINARY_WL_DRIVER) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - - zcat $(DL_DIR)/$(LINUX_ET_DRIVER) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - - touch $(LINUX_DIR)/.unpacked - -$(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked - # copy binary wlan driver - mkdir $(LINUX_DIR)/drivers/net/{et,wl} - cp -a $(BUILD_DIR)/wl/*.o $(LINUX_DIR)/drivers/net/wl - # copy proprietary et source - cp -a $(BUILD_DIR)/et/* $(LINUX_DIR)/drivers/net/et - mkdir -p $(LINUX_DIR)/arch/mips/bcm947xx/include/ - cp -a $(BUILD_DIR)/et/*.h $(LINUX_DIR)/arch/mips/bcm947xx/include/ - $(PATCH) $(LINUX_DIR) $(LINUX_PATCHES) - touch $(LINUX_DIR)/.patched - -$(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched - -cp $(LINUX_KCONFIG) $(LINUX_DIR)/.config - $(SED) "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" \ - $(LINUX_DIR)/Makefile \ - $(LINUX_DIR)/arch/mips/Makefile - $(SED) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR)/arch/mips/Makefile - $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) oldconfig include/linux/version.h - touch $(LINUX_DIR)/.configured - -$(LINUX_DIR)/.depend_done: $(LINUX_DIR)/.configured - $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) dep - touch $(LINUX_DIR)/.depend_done - -$(LINUX_DIR)/$(LINUX_BINLOC): $(LINUX_DIR)/.depend_done - $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) CFLAGS_KERNEL="-fno-delayed-branch " $(LINUX_FORMAT) - -$(LINUX_KERNEL): $(LINUX_DIR)/$(LINUX_BINLOC) - cp -fa $< $@ - touch -c $(LINUX_KERNEL) - -$(LINUX_IMAGE): $(LINUX_KERNEL) - cat $^ | $(BUILD_DIR)/lzma/lzma e -si -so -eos > $@ || (rm -f $@ && false) - -$(LINUX_DIR)/.modules_done: $(LINUX_KERNEL) $(LINUX_IMAGE) - rm -rf $(BUILD_DIR)/modules - $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) CFLAGS_KERNEL="-fno-delayed-branch " modules - $(MAKE) -C $(LINUX_DIR) DEPMOD=true INSTALL_MOD_PATH=$(BUILD_DIR)/modules modules_install - touch $(LINUX_DIR)/.modules_done - -$(STAGING_DIR)/include/linux/version.h: $(LINUX_DIR)/.configured - mkdir -p $(STAGING_DIR)/include - tar -ch -C $(LINUX_DIR)/include -f - linux | tar -xf - -C $(STAGING_DIR)/include/ - tar -ch -C $(LINUX_DIR)/include -f - asm | tar -xf - -C $(STAGING_DIR)/include/ - -$(TARGET_MODULES_DIR): - -mkdir -p $(TARGET_MODULES_DIR) - -linux: $(LINUX_DIR)/.modules_done $(TARGET_MODULES_DIR) - -linux-source: $(DL_DIR)/$(LINUX_SOURCE) - -# This has been renamed so we do _NOT_ by default run this on 'make clean' -linuxclean: clean - rm -f $(LINUX_KERNEL) $(LINUX_IMAGE) - -$(MAKE) -C $(LINUX_DIR) clean - -linux-dirclean: - rm -f $(BUILD_DIR)/openwrt-kmodules.tar.bz2 - rm -rf $(LINUX_DIR)-$(LINUX_VERSION) - rm -rf $(LINUX_DIR) - rm -rf $(BUILD_DIR)/modules - rm -rf $(BUILD_DIR)/wl - rm -rf $(BUILD_DIR)/et - diff --git a/openwrt/package/linux/linux-2.4/patches/000-linux-mips.patch b/openwrt/package/linux/linux-2.4/patches/000-linux-mips.patch deleted file mode 100644 index e2ebfce285..0000000000 --- a/openwrt/package/linux/linux-2.4/patches/000-linux-mips.patch +++ /dev/null @@ -1,26900 +0,0 @@ -diff -Nur linux-2.4.30/Makefile linux-2.4.30-mips/Makefile ---- linux-2.4.30/Makefile 2005-04-04 03:42:20.000000000 +0200 -+++ linux-2.4.30-mips/Makefile 2005-04-05 21:09:54.000000000 +0200 -@@ -5,7 +5,7 @@ - - KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) - --ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) -+ARCH = mips - KERNELPATH=kernel-$(shell echo $(KERNELRELEASE) | sed -e "s/-//g") - - CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ -@@ -462,10 +462,11 @@ - $(MAKE) -C Documentation/DocBook mrproper - - distclean: mrproper -- rm -f core `find . \( -not -type d \) -and \ -- \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ -- -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ -- -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f -print` TAGS tags -+ find . \( -not -type d \) -and \ -+ \( -name core -o -name '*.orig' -o -name '*.rej' \ -+ -o -name '*~' -o -name '*.bak' -o -name '#*#' \ -+ -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \ -+ -o -name TAGS -o -name tags \) -print | env -i xargs rm -f - - backup: mrproper - cd .. && tar cf - linux/ | gzip -9 > backup.gz -@@ -492,7 +493,7 @@ - $(MAKE) -C Documentation/DocBook man - - sums: -- find . -type f -print | sort | xargs sum > .SUMS -+ find . -type f -print | sort | env -i xargs sum > .SUMS - - dep-files: scripts/mkdep archdep include/linux/version.h - rm -f .depend .hdepend -diff -Nur linux-2.4.30/arch/mips/Makefile linux-2.4.30-mips/arch/mips/Makefile ---- linux-2.4.30/arch/mips/Makefile 2005-01-19 15:09:26.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/Makefile 2005-01-30 09:01:26.000000000 +0100 -@@ -211,7 +211,7 @@ - endif - - # --# Au1000 (Alchemy Semi PB1000) eval board -+# Au1x AMD Alchemy eval boards - # - ifdef CONFIG_MIPS_PB1000 - LIBS += arch/mips/au1000/pb1000/pb1000.o \ -@@ -220,9 +220,6 @@ - LOADADDR := 0x80100000 - endif - --# --# Au1100 (Alchemy Semi PB1100) eval board --# - ifdef CONFIG_MIPS_PB1100 - LIBS += arch/mips/au1000/pb1100/pb1100.o \ - arch/mips/au1000/common/au1000.o -@@ -230,9 +227,6 @@ - LOADADDR += 0x80100000 - endif - --# --# Au1500 (Alchemy Semi PB1500) eval board --# - ifdef CONFIG_MIPS_PB1500 - LIBS += arch/mips/au1000/pb1500/pb1500.o \ - arch/mips/au1000/common/au1000.o -@@ -240,9 +234,6 @@ - LOADADDR := 0x80100000 - endif - --# --# Au1x00 (AMD/Alchemy) eval boards --# - ifdef CONFIG_MIPS_DB1000 - LIBS += arch/mips/au1000/db1x00/db1x00.o \ - arch/mips/au1000/common/au1000.o -@@ -313,6 +304,27 @@ - LOADADDR += 0x80100000 - endif - -+ifdef CONFIG_MIPS_PB1200 -+LIBS += arch/mips/au1000/pb1200/pb1200.o \ -+ arch/mips/au1000/common/au1000.o -+SUBDIRS += arch/mips/au1000/pb1200 arch/mips/au1000/common -+LOADADDR += 0x80100000 -+endif -+ -+ifdef CONFIG_MIPS_DB1200 -+LIBS += arch/mips/au1000/pb1200/pb1200.o \ -+ arch/mips/au1000/common/au1000.o -+SUBDIRS += arch/mips/au1000/pb1200 arch/mips/au1000/common -+LOADADDR += 0x80100000 -+endif -+ -+ifdef CONFIG_MIPS_FICMMP -+LIBS += arch/mips/au1000/ficmmp/ficmmp.o \ -+ arch/mips/au1000/common/au1000.o -+SUBDIRS += arch/mips/au1000/ficmmp arch/mips/au1000/common -+LOADADDR += 0x80100000 -+endif -+ - - # - # Cogent CSB250 -diff -Nur linux-2.4.30/arch/mips/au1000/common/Makefile linux-2.4.30-mips/arch/mips/au1000/common/Makefile ---- linux-2.4.30/arch/mips/au1000/common/Makefile 2005-01-19 15:09:26.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/common/Makefile 2005-01-30 09:01:27.000000000 +0100 -@@ -19,9 +19,9 @@ - export-objs = prom.o clocks.o power.o usbdev.o - - obj-y := prom.o int-handler.o irq.o puts.o time.o reset.o cputable.o \ -- au1xxx_irqmap.o clocks.o power.o setup.o sleeper.o dma.o dbdma.o -+ au1xxx_irqmap.o clocks.o power.o setup.o sleeper.o dma.o dbdma.o gpio.o - --export-objs += dma.o dbdma.o -+export-objs += dma.o dbdma.o gpio.o - - obj-$(CONFIG_AU1X00_USB_DEVICE) += usbdev.o - obj-$(CONFIG_KGDB) += dbg_io.o -diff -Nur linux-2.4.30/arch/mips/au1000/common/au1xxx_irqmap.c linux-2.4.30-mips/arch/mips/au1000/common/au1xxx_irqmap.c ---- linux-2.4.30/arch/mips/au1000/common/au1xxx_irqmap.c 2005-01-19 15:09:26.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/common/au1xxx_irqmap.c 2005-01-30 09:01:27.000000000 +0100 -@@ -172,14 +172,14 @@ - { AU1550_PSC1_INT, INTC_INT_HIGH_LEVEL, 0}, - { AU1550_PSC2_INT, INTC_INT_HIGH_LEVEL, 0}, - { AU1550_PSC3_INT, INTC_INT_HIGH_LEVEL, 0}, -- { AU1550_TOY_INT, INTC_INT_RISE_EDGE, 0 }, -- { AU1550_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, -- { AU1550_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, -- { AU1550_TOY_MATCH2_INT, INTC_INT_RISE_EDGE, 1 }, -- { AU1550_RTC_INT, INTC_INT_RISE_EDGE, 0 }, -- { AU1550_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, -- { AU1550_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, -- { AU1550_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 }, -+ { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, -+ { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, -+ { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, -+ { AU1000_TOY_MATCH2_INT, INTC_INT_RISE_EDGE, 1 }, -+ { AU1000_RTC_INT, INTC_INT_RISE_EDGE, 0 }, -+ { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, -+ { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, -+ { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 }, - { AU1550_NAND_INT, INTC_INT_RISE_EDGE, 0}, - { AU1550_USB_DEV_REQ_INT, INTC_INT_HIGH_LEVEL, 0 }, - { AU1550_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 }, -@@ -200,14 +200,14 @@ - { AU1200_PSC1_INT, INTC_INT_HIGH_LEVEL, 0}, - { AU1200_AES_INT, INTC_INT_HIGH_LEVEL, 0}, - { AU1200_CAMERA_INT, INTC_INT_HIGH_LEVEL, 0}, -- { AU1200_TOY_INT, INTC_INT_RISE_EDGE, 0 }, -- { AU1200_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, -- { AU1200_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, -- { AU1200_TOY_MATCH2_INT, INTC_INT_RISE_EDGE, 1 }, -- { AU1200_RTC_INT, INTC_INT_RISE_EDGE, 0 }, -- { AU1200_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, -- { AU1200_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, -- { AU1200_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 }, -+ { AU1000_TOY_INT, INTC_INT_RISE_EDGE, 0 }, -+ { AU1000_TOY_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, -+ { AU1000_TOY_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, -+ { AU1000_TOY_MATCH2_INT, INTC_INT_RISE_EDGE, 1 }, -+ { AU1000_RTC_INT, INTC_INT_RISE_EDGE, 0 }, -+ { AU1000_RTC_MATCH0_INT, INTC_INT_RISE_EDGE, 0 }, -+ { AU1000_RTC_MATCH1_INT, INTC_INT_RISE_EDGE, 0 }, -+ { AU1000_RTC_MATCH2_INT, INTC_INT_RISE_EDGE, 0 }, - { AU1200_NAND_INT, INTC_INT_RISE_EDGE, 0}, - { AU1200_USB_INT, INTC_INT_HIGH_LEVEL, 0 }, - { AU1200_LCD_INT, INTC_INT_HIGH_LEVEL, 0}, -diff -Nur linux-2.4.30/arch/mips/au1000/common/cputable.c linux-2.4.30-mips/arch/mips/au1000/common/cputable.c ---- linux-2.4.30/arch/mips/au1000/common/cputable.c 2005-01-19 15:09:26.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/common/cputable.c 2005-01-30 09:01:27.000000000 +0100 -@@ -39,7 +39,8 @@ - { 0xffffffff, 0x02030203, "Au1100 BD", 0, 1 }, - { 0xffffffff, 0x02030204, "Au1100 BE", 0, 1 }, - { 0xffffffff, 0x03030200, "Au1550 AA", 0, 1 }, -- { 0xffffffff, 0x04030200, "Au1200 AA", 0, 1 }, -+ { 0xffffffff, 0x04030200, "Au1200 AB", 0, 0 }, -+ { 0xffffffff, 0x04030201, "Au1200 AC", 0, 0 }, - { 0x00000000, 0x00000000, "Unknown Au1xxx", 1, 0 }, - }; - -diff -Nur linux-2.4.30/arch/mips/au1000/common/dbdma.c linux-2.4.30-mips/arch/mips/au1000/common/dbdma.c ---- linux-2.4.30/arch/mips/au1000/common/dbdma.c 2005-01-19 15:09:26.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/common/dbdma.c 2005-02-08 07:28:37.000000000 +0100 -@@ -41,6 +41,8 @@ - #include - #include - -+#include -+ - #if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200) - - /* -@@ -60,37 +62,10 @@ - */ - #define ALIGN_ADDR(x, a) ((((u32)(x)) + (a-1)) & ~(a-1)) - --static volatile dbdma_global_t *dbdma_gptr = (dbdma_global_t *)DDMA_GLOBAL_BASE; --static int dbdma_initialized; -+static dbdma_global_t *dbdma_gptr = (dbdma_global_t *)DDMA_GLOBAL_BASE; -+static int dbdma_initialized=0; - static void au1xxx_dbdma_init(void); - --typedef struct dbdma_device_table { -- u32 dev_id; -- u32 dev_flags; -- u32 dev_tsize; -- u32 dev_devwidth; -- u32 dev_physaddr; /* If FIFO */ -- u32 dev_intlevel; -- u32 dev_intpolarity; --} dbdev_tab_t; -- --typedef struct dbdma_chan_config { -- u32 chan_flags; -- u32 chan_index; -- dbdev_tab_t *chan_src; -- dbdev_tab_t *chan_dest; -- au1x_dma_chan_t *chan_ptr; -- au1x_ddma_desc_t *chan_desc_base; -- au1x_ddma_desc_t *get_ptr, *put_ptr, *cur_ptr; -- void *chan_callparam; -- void (*chan_callback)(int, void *, struct pt_regs *); --} chan_tab_t; -- --#define DEV_FLAGS_INUSE (1 << 0) --#define DEV_FLAGS_ANYUSE (1 << 1) --#define DEV_FLAGS_OUT (1 << 2) --#define DEV_FLAGS_IN (1 << 3) -- - static dbdev_tab_t dbdev_tab[] = { - #ifdef CONFIG_SOC_AU1550 - /* UARTS */ -@@ -156,13 +131,13 @@ - { DSCR_CMD0_MAE_BOTH, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }, - { DSCR_CMD0_LCD, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }, - -- { DSCR_CMD0_SDMS_TX0, DEV_FLAGS_OUT, 0, 0, 0x00000000, 0, 0 }, -- { DSCR_CMD0_SDMS_RX0, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 }, -- { DSCR_CMD0_SDMS_TX1, DEV_FLAGS_OUT, 0, 0, 0x00000000, 0, 0 }, -- { DSCR_CMD0_SDMS_RX1, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 }, -+ { DSCR_CMD0_SDMS_TX0, DEV_FLAGS_OUT, 4, 8, 0x10600000, 0, 0 }, -+ { DSCR_CMD0_SDMS_RX0, DEV_FLAGS_IN, 4, 8, 0x10600004, 0, 0 }, -+ { DSCR_CMD0_SDMS_TX1, DEV_FLAGS_OUT, 4, 8, 0x10680000, 0, 0 }, -+ { DSCR_CMD0_SDMS_RX1, DEV_FLAGS_IN, 4, 8, 0x10680004, 0, 0 }, - -- { DSCR_CMD0_AES_TX, DEV_FLAGS_OUT, 0, 0, 0x00000000, 0, 0 }, -- { DSCR_CMD0_AES_RX, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 }, -+ { DSCR_CMD0_AES_RX, DEV_FLAGS_IN , 4, 32, 0x10300008, 0, 0 }, -+ { DSCR_CMD0_AES_TX, DEV_FLAGS_OUT, 4, 32, 0x10300004, 0, 0 }, - - { DSCR_CMD0_PSC0_TX, DEV_FLAGS_OUT, 0, 0, 0x11a0001c, 0, 0 }, - { DSCR_CMD0_PSC0_RX, DEV_FLAGS_IN, 0, 0, 0x11a0001c, 0, 0 }, -@@ -172,9 +147,9 @@ - { DSCR_CMD0_PSC1_RX, DEV_FLAGS_IN, 0, 0, 0x11b0001c, 0, 0 }, - { DSCR_CMD0_PSC1_SYNC, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }, - -- { DSCR_CMD0_CIM_RXA, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 }, -- { DSCR_CMD0_CIM_RXB, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 }, -- { DSCR_CMD0_CIM_RXC, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 }, -+ { DSCR_CMD0_CIM_RXA, DEV_FLAGS_IN, 0, 32, 0x14004020, 0, 0 }, -+ { DSCR_CMD0_CIM_RXB, DEV_FLAGS_IN, 0, 32, 0x14004040, 0, 0 }, -+ { DSCR_CMD0_CIM_RXC, DEV_FLAGS_IN, 0, 32, 0x14004060, 0, 0 }, - { DSCR_CMD0_CIM_SYNC, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }, - - { DSCR_CMD0_NAND_FLASH, DEV_FLAGS_IN, 0, 0, 0x00000000, 0, 0 }, -@@ -183,6 +158,24 @@ - - { DSCR_CMD0_THROTTLE, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }, - { DSCR_CMD0_ALWAYS, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }, -+ -+ /* Provide 16 user definable device types */ -+ { 0, 0, 0, 0, 0, 0, 0 }, -+ { 0, 0, 0, 0, 0, 0, 0 }, -+ { 0, 0, 0, 0, 0, 0, 0 }, -+ { 0, 0, 0, 0, 0, 0, 0 }, -+ { 0, 0, 0, 0, 0, 0, 0 }, -+ { 0, 0, 0, 0, 0, 0, 0 }, -+ { 0, 0, 0, 0, 0, 0, 0 }, -+ { 0, 0, 0, 0, 0, 0, 0 }, -+ { 0, 0, 0, 0, 0, 0, 0 }, -+ { 0, 0, 0, 0, 0, 0, 0 }, -+ { 0, 0, 0, 0, 0, 0, 0 }, -+ { 0, 0, 0, 0, 0, 0, 0 }, -+ { 0, 0, 0, 0, 0, 0, 0 }, -+ { 0, 0, 0, 0, 0, 0, 0 }, -+ { 0, 0, 0, 0, 0, 0, 0 }, -+ { 0, 0, 0, 0, 0, 0, 0 }, - }; - - #define DBDEV_TAB_SIZE (sizeof(dbdev_tab) / sizeof(dbdev_tab_t)) -@@ -202,6 +195,30 @@ - return NULL; - } - -+u32 -+au1xxx_ddma_add_device(dbdev_tab_t *dev) -+{ -+ u32 ret = 0; -+ dbdev_tab_t *p=NULL; -+ static u16 new_id=0x1000; -+ -+ p = find_dbdev_id(0); -+ if ( NULL != p ) -+ { -+ memcpy(p, dev, sizeof(dbdev_tab_t)); -+ p->dev_id = DSCR_DEV2CUSTOM_ID(new_id,dev->dev_id); -+ ret = p->dev_id; -+ new_id++; -+#if 0 -+ printk("add_device: id:%x flags:%x padd:%x\n", -+ p->dev_id, p->dev_flags, p->dev_physaddr ); -+#endif -+ } -+ -+ return ret; -+} -+EXPORT_SYMBOL(au1xxx_ddma_add_device); -+ - /* Allocate a channel and return a non-zero descriptor if successful. - */ - u32 -@@ -214,7 +231,7 @@ - int i; - dbdev_tab_t *stp, *dtp; - chan_tab_t *ctp; -- volatile au1x_dma_chan_t *cp; -+ au1x_dma_chan_t *cp; - - /* We do the intialization on the first channel allocation. - * We have to wait because of the interrupt handler initialization -@@ -224,9 +241,6 @@ - au1xxx_dbdma_init(); - dbdma_initialized = 1; - -- if ((srcid > DSCR_NDEV_IDS) || (destid > DSCR_NDEV_IDS)) -- return 0; -- - if ((stp = find_dbdev_id(srcid)) == NULL) return 0; - if ((dtp = find_dbdev_id(destid)) == NULL) return 0; - -@@ -268,9 +282,9 @@ - /* If kmalloc fails, it is caught below same - * as a channel not available. - */ -- ctp = (chan_tab_t *)kmalloc(sizeof(chan_tab_t), GFP_KERNEL); -+ ctp = (chan_tab_t *) -+ kmalloc(sizeof(chan_tab_t), GFP_KERNEL); - chan_tab_ptr[i] = ctp; -- ctp->chan_index = chan = i; - break; - } - } -@@ -278,10 +292,11 @@ - - if (ctp != NULL) { - memset(ctp, 0, sizeof(chan_tab_t)); -+ ctp->chan_index = chan = i; - dcp = DDMA_CHANNEL_BASE; - dcp += (0x0100 * chan); - ctp->chan_ptr = (au1x_dma_chan_t *)dcp; -- cp = (volatile au1x_dma_chan_t *)dcp; -+ cp = (au1x_dma_chan_t *)dcp; - ctp->chan_src = stp; - ctp->chan_dest = dtp; - ctp->chan_callback = callback; -@@ -298,6 +313,9 @@ - i |= DDMA_CFG_DED; - if (dtp->dev_intpolarity) - i |= DDMA_CFG_DP; -+ if ((stp->dev_flags & DEV_FLAGS_SYNC) || -+ (dtp->dev_flags & DEV_FLAGS_SYNC)) -+ i |= DDMA_CFG_SYNC; - cp->ddma_cfg = i; - au_sync(); - -@@ -308,14 +326,14 @@ - rv = (u32)(&chan_tab_ptr[chan]); - } - else { -- /* Release devices. -- */ -+ /* Release devices */ - stp->dev_flags &= ~DEV_FLAGS_INUSE; - dtp->dev_flags &= ~DEV_FLAGS_INUSE; - } - } - return rv; - } -+EXPORT_SYMBOL(au1xxx_dbdma_chan_alloc); - - /* Set the device width if source or destination is a FIFO. - * Should be 8, 16, or 32 bits. -@@ -343,6 +361,7 @@ - - return rv; - } -+EXPORT_SYMBOL(au1xxx_dbdma_set_devwidth); - - /* Allocate a descriptor ring, initializing as much as possible. - */ -@@ -369,7 +388,8 @@ - * and if we try that first we are likely to not waste larger - * slabs of memory. - */ -- desc_base = (u32)kmalloc(entries * sizeof(au1x_ddma_desc_t), GFP_KERNEL); -+ desc_base = (u32)kmalloc(entries * sizeof(au1x_ddma_desc_t), -+ GFP_KERNEL|GFP_DMA); - if (desc_base == 0) - return 0; - -@@ -380,7 +400,7 @@ - kfree((const void *)desc_base); - i = entries * sizeof(au1x_ddma_desc_t); - i += (sizeof(au1x_ddma_desc_t) - 1); -- if ((desc_base = (u32)kmalloc(i, GFP_KERNEL)) == 0) -+ if ((desc_base = (u32)kmalloc(i, GFP_KERNEL|GFP_DMA)) == 0) - return 0; - - desc_base = ALIGN_ADDR(desc_base, sizeof(au1x_ddma_desc_t)); -@@ -460,9 +480,14 @@ - /* If source input is fifo, set static address. - */ - if (stp->dev_flags & DEV_FLAGS_IN) { -- src0 = stp->dev_physaddr; -- src1 |= DSCR_SRC1_SAM(DSCR_xAM_STATIC); -+ if ( stp->dev_flags & DEV_FLAGS_BURSTABLE ) -+ src1 |= DSCR_SRC1_SAM(DSCR_xAM_BURST); -+ else -+ src1 |= DSCR_SRC1_SAM(DSCR_xAM_STATIC); -+ - } -+ if (stp->dev_physaddr) -+ src0 = stp->dev_physaddr; - - /* Set up dest1. For now, assume no stride and increment. - * A channel attribute update can change this later. -@@ -486,10 +511,18 @@ - /* If destination output is fifo, set static address. - */ - if (dtp->dev_flags & DEV_FLAGS_OUT) { -- dest0 = dtp->dev_physaddr; -+ if ( dtp->dev_flags & DEV_FLAGS_BURSTABLE ) -+ dest1 |= DSCR_DEST1_DAM(DSCR_xAM_BURST); -+ else - dest1 |= DSCR_DEST1_DAM(DSCR_xAM_STATIC); - } -+ if (dtp->dev_physaddr) -+ dest0 = dtp->dev_physaddr; - -+#if 0 -+ printk("did:%x sid:%x cmd0:%x cmd1:%x source0:%x source1:%x dest0:%x dest1:%x\n", -+ dtp->dev_id, stp->dev_id, cmd0, cmd1, src0, src1, dest0, dest1 ); -+#endif - for (i=0; idscr_cmd0 = cmd0; - dp->dscr_cmd1 = cmd1; -@@ -498,6 +531,7 @@ - dp->dscr_dest0 = dest0; - dp->dscr_dest1 = dest1; - dp->dscr_stat = 0; -+ dp->sw_context = dp->sw_status = 0; - dp->dscr_nxtptr = DSCR_NXTPTR(virt_to_phys(dp + 1)); - dp++; - } -@@ -510,13 +544,14 @@ - - return (u32)(ctp->chan_desc_base); - } -+EXPORT_SYMBOL(au1xxx_dbdma_ring_alloc); - - /* Put a source buffer into the DMA ring. - * This updates the source pointer and byte count. Normally used - * for memory to fifo transfers. - */ - u32 --au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes) -+_au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags) - { - chan_tab_t *ctp; - au1x_ddma_desc_t *dp; -@@ -543,24 +578,40 @@ - */ - dp->dscr_source0 = virt_to_phys(buf); - dp->dscr_cmd1 = nbytes; -- dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */ -- ctp->chan_ptr->ddma_dbell = 0xffffffff; /* Make it go */ -- -+ /* Check flags */ -+ if (flags & DDMA_FLAGS_IE) -+ dp->dscr_cmd0 |= DSCR_CMD0_IE; -+ if (flags & DDMA_FLAGS_NOIE) -+ dp->dscr_cmd0 &= ~DSCR_CMD0_IE; - /* Get next descriptor pointer. - */ - ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); - -+ /* -+ * There is an errata on the Au1200/Au1550 parts that could result -+ * in "stale" data being DMA'd. It has to do with the snoop logic on -+ * the dache eviction buffer. NONCOHERENT_IO is on by default for -+ * these parts. If it is fixedin the future, these dma_cache_inv will -+ * just be nothing more than empty macros. See io.h. -+ * */ -+ dma_cache_wback_inv(buf,nbytes); -+ dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */ -+ au_sync(); -+ dma_cache_wback_inv(dp, sizeof(dp)); -+ ctp->chan_ptr->ddma_dbell = 0; -+ - /* return something not zero. - */ - return nbytes; - } -+EXPORT_SYMBOL(_au1xxx_dbdma_put_source); - - /* Put a destination buffer into the DMA ring. - * This updates the destination pointer and byte count. Normally used - * to place an empty buffer into the ring for fifo to memory transfers. - */ - u32 --au1xxx_dbdma_put_dest(u32 chanid, void *buf, int nbytes) -+_au1xxx_dbdma_put_dest(u32 chanid, void *buf, int nbytes, u32 flags) - { - chan_tab_t *ctp; - au1x_ddma_desc_t *dp; -@@ -582,11 +633,33 @@ - if (dp->dscr_cmd0 & DSCR_CMD0_V) - return 0; - -- /* Load up buffer address and byte count. -- */ -+ /* Load up buffer address and byte count */ -+ -+ /* Check flags */ -+ if (flags & DDMA_FLAGS_IE) -+ dp->dscr_cmd0 |= DSCR_CMD0_IE; -+ if (flags & DDMA_FLAGS_NOIE) -+ dp->dscr_cmd0 &= ~DSCR_CMD0_IE; -+ - dp->dscr_dest0 = virt_to_phys(buf); - dp->dscr_cmd1 = nbytes; -+#if 0 -+ printk("cmd0:%x cmd1:%x source0:%x source1:%x dest0:%x dest1:%x\n", -+ dp->dscr_cmd0, dp->dscr_cmd1, dp->dscr_source0, -+ dp->dscr_source1, dp->dscr_dest0, dp->dscr_dest1 ); -+#endif -+ /* -+ * There is an errata on the Au1200/Au1550 parts that could result in -+ * "stale" data being DMA'd. It has to do with the snoop logic on the -+ * dache eviction buffer. NONCOHERENT_IO is on by default for these -+ * parts. If it is fixedin the future, these dma_cache_inv will just -+ * be nothing more than empty macros. See io.h. -+ * */ -+ dma_cache_inv(buf,nbytes); - dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */ -+ au_sync(); -+ dma_cache_wback_inv(dp, sizeof(dp)); -+ ctp->chan_ptr->ddma_dbell = 0; - - /* Get next descriptor pointer. - */ -@@ -596,6 +669,7 @@ - */ - return nbytes; - } -+EXPORT_SYMBOL(_au1xxx_dbdma_put_dest); - - /* Get a destination buffer into the DMA ring. - * Normally used to get a full buffer from the ring during fifo -@@ -645,7 +719,7 @@ - au1xxx_dbdma_stop(u32 chanid) - { - chan_tab_t *ctp; -- volatile au1x_dma_chan_t *cp; -+ au1x_dma_chan_t *cp; - int halt_timeout = 0; - - ctp = *((chan_tab_t **)chanid); -@@ -665,6 +739,7 @@ - cp->ddma_stat |= (DDMA_STAT_DB | DDMA_STAT_V); - au_sync(); - } -+EXPORT_SYMBOL(au1xxx_dbdma_stop); - - /* Start using the current descriptor pointer. If the dbdma encounters - * a not valid descriptor, it will stop. In this case, we can just -@@ -674,17 +749,17 @@ - au1xxx_dbdma_start(u32 chanid) - { - chan_tab_t *ctp; -- volatile au1x_dma_chan_t *cp; -+ au1x_dma_chan_t *cp; - - ctp = *((chan_tab_t **)chanid); -- - cp = ctp->chan_ptr; - cp->ddma_desptr = virt_to_phys(ctp->cur_ptr); - cp->ddma_cfg |= DDMA_CFG_EN; /* Enable channel */ - au_sync(); -- cp->ddma_dbell = 0xffffffff; /* Make it go */ -+ cp->ddma_dbell = 0; - au_sync(); - } -+EXPORT_SYMBOL(au1xxx_dbdma_start); - - void - au1xxx_dbdma_reset(u32 chanid) -@@ -703,15 +778,21 @@ - - do { - dp->dscr_cmd0 &= ~DSCR_CMD0_V; -+ /* reset our SW status -- this is used to determine -+ * if a descriptor is in use by upper level SW. Since -+ * posting can reset 'V' bit. -+ */ -+ dp->sw_status = 0; - dp = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); - } while (dp != ctp->chan_desc_base); - } -+EXPORT_SYMBOL(au1xxx_dbdma_reset); - - u32 - au1xxx_get_dma_residue(u32 chanid) - { - chan_tab_t *ctp; -- volatile au1x_dma_chan_t *cp; -+ au1x_dma_chan_t *cp; - u32 rv; - - ctp = *((chan_tab_t **)chanid); -@@ -746,15 +827,16 @@ - - kfree(ctp); - } -+EXPORT_SYMBOL(au1xxx_dbdma_chan_free); - - static void - dbdma_interrupt(int irq, void *dev_id, struct pt_regs *regs) - { -- u32 intstat; -+ u32 intstat, flags; - u32 chan_index; - chan_tab_t *ctp; - au1x_ddma_desc_t *dp; -- volatile au1x_dma_chan_t *cp; -+ au1x_dma_chan_t *cp; - - intstat = dbdma_gptr->ddma_intstat; - au_sync(); -@@ -773,18 +855,26 @@ - (ctp->chan_callback)(irq, ctp->chan_callparam, regs); - - ctp->cur_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); -- - } - --static void --au1xxx_dbdma_init(void) -+static void au1xxx_dbdma_init(void) - { -+ int irq_nr; -+ - dbdma_gptr->ddma_config = 0; - dbdma_gptr->ddma_throttle = 0; - dbdma_gptr->ddma_inten = 0xffff; - au_sync(); - -- if (request_irq(AU1550_DDMA_INT, dbdma_interrupt, SA_INTERRUPT, -+#if defined(CONFIG_SOC_AU1550) -+ irq_nr = AU1550_DDMA_INT; -+#elif defined(CONFIG_SOC_AU1200) -+ irq_nr = AU1200_DDMA_INT; -+#else -+ #error Unknown Au1x00 SOC -+#endif -+ -+ if (request_irq(irq_nr, dbdma_interrupt, SA_INTERRUPT, - "Au1xxx dbdma", (void *)dbdma_gptr)) - printk("Can't get 1550 dbdma irq"); - } -@@ -795,7 +885,8 @@ - chan_tab_t *ctp; - au1x_ddma_desc_t *dp; - dbdev_tab_t *stp, *dtp; -- volatile au1x_dma_chan_t *cp; -+ au1x_dma_chan_t *cp; -+ u32 i = 0; - - ctp = *((chan_tab_t **)chanid); - stp = ctp->chan_src; -@@ -820,15 +911,64 @@ - dp = ctp->chan_desc_base; - - do { -- printk("dp %08x, cmd0 %08x, cmd1 %08x\n", -- (u32)dp, dp->dscr_cmd0, dp->dscr_cmd1); -- printk("src0 %08x, src1 %08x, dest0 %08x\n", -- dp->dscr_source0, dp->dscr_source1, dp->dscr_dest0); -- printk("dest1 %08x, stat %08x, nxtptr %08x\n", -- dp->dscr_dest1, dp->dscr_stat, dp->dscr_nxtptr); -+ printk("Dp[%d]= %08x, cmd0 %08x, cmd1 %08x\n", -+ i++, (u32)dp, dp->dscr_cmd0, dp->dscr_cmd1); -+ printk("src0 %08x, src1 %08x, dest0 %08x, dest1 %08x\n", -+ dp->dscr_source0, dp->dscr_source1, dp->dscr_dest0, dp->dscr_dest1); -+ printk("stat %08x, nxtptr %08x\n", -+ dp->dscr_stat, dp->dscr_nxtptr); - dp = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); - } while (dp != ctp->chan_desc_base); - } - -+/* Put a descriptor into the DMA ring. -+ * This updates the source/destination pointers and byte count. -+ */ -+u32 -+au1xxx_dbdma_put_dscr(u32 chanid, au1x_ddma_desc_t *dscr ) -+{ -+ chan_tab_t *ctp; -+ au1x_ddma_desc_t *dp; -+ u32 nbytes=0; -+ -+ /* I guess we could check this to be within the -+ * range of the table...... -+ */ -+ ctp = *((chan_tab_t **)chanid); -+ -+ /* We should have multiple callers for a particular channel, -+ * an interrupt doesn't affect this pointer nor the descriptor, -+ * so no locking should be needed. -+ */ -+ dp = ctp->put_ptr; -+ -+ /* If the descriptor is valid, we are way ahead of the DMA -+ * engine, so just return an error condition. -+ */ -+ if (dp->dscr_cmd0 & DSCR_CMD0_V) -+ return 0; -+ -+ /* Load up buffer addresses and byte count. -+ */ -+ dp->dscr_dest0 = dscr->dscr_dest0; -+ dp->dscr_source0 = dscr->dscr_source0; -+ dp->dscr_dest1 = dscr->dscr_dest1; -+ dp->dscr_source1 = dscr->dscr_source1; -+ dp->dscr_cmd1 = dscr->dscr_cmd1; -+ nbytes = dscr->dscr_cmd1; -+ /* Allow the caller to specifiy if an interrupt is generated */ -+ dp->dscr_cmd0 &= ~DSCR_CMD0_IE; -+ dp->dscr_cmd0 |= dscr->dscr_cmd0 | DSCR_CMD0_V; -+ ctp->chan_ptr->ddma_dbell = 0; -+ -+ /* Get next descriptor pointer. -+ */ -+ ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr)); -+ -+ /* return something not zero. -+ */ -+ return nbytes; -+} -+ - #endif /* defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200) */ - -diff -Nur linux-2.4.30/arch/mips/au1000/common/gpio.c linux-2.4.30-mips/arch/mips/au1000/common/gpio.c ---- linux-2.4.30/arch/mips/au1000/common/gpio.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/common/gpio.c 2005-01-30 09:01:27.000000000 +0100 -@@ -0,0 +1,118 @@ -+/* -+ * 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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED -+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN -+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ * 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 -+ -+#define gpio1 sys -+#if !defined(CONFIG_SOC_AU1000) -+static AU1X00_GPIO2 * const gpio2 = (AU1X00_GPIO2 *)GPIO2_BASE; -+ -+#define GPIO2_OUTPUT_ENABLE_MASK 0x00010000 -+ -+int au1xxx_gpio2_read(int signal) -+{ -+ signal -= 200; -+/* gpio2->dir &= ~(0x01 << signal); //Set GPIO to input */ -+ return ((gpio2->pinstate >> signal) & 0x01); -+} -+ -+void au1xxx_gpio2_write(int signal, int value) -+{ -+ signal -= 200; -+ -+ gpio2->output = (GPIO2_OUTPUT_ENABLE_MASK << signal) | -+ (value << signal); -+} -+ -+void au1xxx_gpio2_tristate(int signal) -+{ -+ signal -= 200; -+ gpio2->dir &= ~(0x01 << signal); /* Set GPIO to input */ -+} -+#endif -+ -+int au1xxx_gpio1_read(int signal) -+{ -+/* gpio1->trioutclr |= (0x01 << signal); */ -+ return ((gpio1->pinstaterd >> signal) & 0x01); -+} -+ -+void au1xxx_gpio1_write(int signal, int value) -+{ -+ if(value) -+ gpio1->outputset = (0x01 << signal); -+ else -+ gpio1->outputclr = (0x01 << signal); /* Output a Zero */ -+} -+ -+void au1xxx_gpio1_tristate(int signal) -+{ -+ gpio1->trioutclr = (0x01 << signal); /* Tristate signal */ -+} -+ -+ -+int au1xxx_gpio_read(int signal) -+{ -+ if(signal >= 200) -+#if defined(CONFIG_SOC_AU1000) -+ return 0; -+#else -+ return au1xxx_gpio2_read(signal); -+#endif -+ else -+ return au1xxx_gpio1_read(signal); -+} -+ -+void au1xxx_gpio_write(int signal, int value) -+{ -+ if(signal >= 200) -+#if defined(CONFIG_SOC_AU1000) -+ ; -+#else -+ au1xxx_gpio2_write(signal, value); -+#endif -+ else -+ au1xxx_gpio1_write(signal, value); -+} -+ -+void au1xxx_gpio_tristate(int signal) -+{ -+ if(signal >= 200) -+#if defined(CONFIG_SOC_AU1000) -+ ; -+#else -+ au1xxx_gpio2_tristate(signal); -+#endif -+ else -+ au1xxx_gpio1_tristate(signal); -+} -+ -+void au1xxx_gpio1_set_inputs(void) -+{ -+ gpio1->pininputen = 0; -+} -+ -+EXPORT_SYMBOL(au1xxx_gpio1_set_inputs); -+EXPORT_SYMBOL(au1xxx_gpio_tristate); -+EXPORT_SYMBOL(au1xxx_gpio_write); -+EXPORT_SYMBOL(au1xxx_gpio_read); -diff -Nur linux-2.4.30/arch/mips/au1000/common/irq.c linux-2.4.30-mips/arch/mips/au1000/common/irq.c ---- linux-2.4.30/arch/mips/au1000/common/irq.c 2005-01-19 15:09:26.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/common/irq.c 2005-03-13 08:56:57.000000000 +0100 -@@ -303,8 +303,30 @@ - }; - - #ifdef CONFIG_PM --void startup_match20_interrupt(void) -+void startup_match20_interrupt(void (*handler)(int, void *, struct pt_regs *)) - { -+ static struct irqaction action; -+ /* This is a big problem.... since we didn't use request_irq -+ when kernel/irq.c calls probe_irq_xxx this interrupt will -+ be probed for usage. This will end up disabling the device :( -+ -+ Give it a bogus "action" pointer -- this will keep it from -+ getting auto-probed! -+ -+ By setting the status to match that of request_irq() we -+ can avoid it. --cgray -+ */ -+ action.dev_id = handler; -+ action.flags = 0; -+ action.mask = 0; -+ action.name = "Au1xxx TOY"; -+ action.handler = handler; -+ action.next = NULL; -+ -+ irq_desc[AU1000_TOY_MATCH2_INT].action = &action; -+ irq_desc[AU1000_TOY_MATCH2_INT].status -+ &= ~(IRQ_DISABLED | IRQ_AUTODETECT | IRQ_WAITING | IRQ_INPROGRESS); -+ - local_enable_irq(AU1000_TOY_MATCH2_INT); - } - #endif -@@ -508,6 +530,7 @@ - - if (!intc0_req0) return; - -+#ifdef AU1000_USB_DEV_REQ_INT - /* - * Because of the tight timing of SETUP token to reply - * transactions, the USB devices-side packet complete -@@ -518,6 +541,7 @@ - do_IRQ(AU1000_USB_DEV_REQ_INT, regs); - return; - } -+#endif - - irq = au_ffs(intc0_req0) - 1; - intc0_req0 &= ~(1<bus->number; - unsigned int dev_fn = dev->devfn; -@@ -170,7 +171,6 @@ - unsigned long offset, status; - unsigned long cfg_base; - unsigned long flags; -- int error = PCIBIOS_SUCCESSFUL; - unsigned long entryLo0, entryLo1; - - if (device > 19) { -@@ -205,9 +205,8 @@ - last_entryLo0 = last_entryLo1 = 0xffffffff; - } - -- /* Since the Au1xxx doesn't do the idsel timing exactly to spec, -- * many board vendors implement their own off-chip idsel, so call -- * it now. If it doesn't succeed, may as well bail out at this point. -+ /* Allow board vendors to implement their own off-chip idsel. -+ * If it doesn't succeed, may as well bail out at this point. - */ - if (board_pci_idsel) { - if (board_pci_idsel(device, 1) == 0) { -@@ -271,8 +270,11 @@ - } - - local_irq_restore(flags); -- return error; -+#else -+ /* Fake out Config space access with no responder */ -+ *data = 0xFFFFFFFF; - #endif -+ return error; - } - #endif - -diff -Nur linux-2.4.30/arch/mips/au1000/common/power.c linux-2.4.30-mips/arch/mips/au1000/common/power.c ---- linux-2.4.30/arch/mips/au1000/common/power.c 2005-01-19 15:09:26.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/common/power.c 2005-04-07 02:37:19.000000000 +0200 -@@ -50,7 +50,6 @@ - - static void calibrate_delay(void); - --extern void set_au1x00_speed(unsigned int new_freq); - extern unsigned int get_au1x00_speed(void); - extern unsigned long get_au1x00_uart_baud_base(void); - extern void set_au1x00_uart_baud_base(unsigned long new_baud_base); -@@ -116,6 +115,7 @@ - sleep_uart0_clkdiv = au_readl(UART0_ADDR + UART_CLK); - sleep_uart0_enable = au_readl(UART0_ADDR + UART_MOD_CNTRL); - -+#ifndef CONFIG_SOC_AU1200 - /* Shutdown USB host/device. - */ - sleep_usbhost_enable = au_readl(USB_HOST_CONFIG); -@@ -127,6 +127,7 @@ - - sleep_usbdev_enable = au_readl(USBD_ENABLE); - au_writel(0, USBD_ENABLE); au_sync(); -+#endif - - /* Save interrupt controller state. - */ -@@ -212,14 +213,12 @@ - int au_sleep(void) - { - unsigned long wakeup, flags; -- extern void save_and_sleep(void); -+ extern unsigned int save_and_sleep(void); - - spin_lock_irqsave(&pm_lock,flags); - - save_core_regs(); - -- flush_cache_all(); -- - /** The code below is all system dependent and we should probably - ** have a function call out of here to set this up. You need - ** to configure the GPIO or timer interrupts that will bring -@@ -227,27 +226,26 @@ - ** For testing, the TOY counter wakeup is useful. - **/ - --#if 0 -+#if 1 - au_writel(au_readl(SYS_PINSTATERD) & ~(1 << 11), SYS_PINSTATERD); - - /* gpio 6 can cause a wake up event */ - wakeup = au_readl(SYS_WAKEMSK); - wakeup &= ~(1 << 8); /* turn off match20 wakeup */ -- wakeup |= 1 << 6; /* turn on gpio 6 wakeup */ -+ wakeup = 1 << 5; /* turn on gpio 6 wakeup */ - #else -- /* For testing, allow match20 to wake us up. -- */ -+ /* For testing, allow match20 to wake us up. */ - #ifdef SLEEP_TEST_TIMEOUT - wakeup_counter0_set(sleep_ticks); - #endif - wakeup = 1 << 8; /* turn on match20 wakeup */ - wakeup = 0; - #endif -- au_writel(1, SYS_WAKESRC); /* clear cause */ -+ au_writel(0, SYS_WAKESRC); /* clear cause */ - au_sync(); - au_writel(wakeup, SYS_WAKEMSK); - au_sync(); -- -+ DPRINTK("Entering sleep!\n"); - save_and_sleep(); - - /* after a wakeup, the cpu vectors back to 0x1fc00000 so -@@ -255,6 +253,7 @@ - */ - restore_core_regs(); - spin_unlock_irqrestore(&pm_lock, flags); -+ DPRINTK("Leaving sleep!\n"); - return 0; - } - -@@ -285,7 +284,6 @@ - - if (retval) - return retval; -- - au_sleep(); - retval = pm_send_all(PM_RESUME, (void *) 0); - } -@@ -296,7 +294,6 @@ - void *buffer, size_t * len) - { - int retval = 0; -- void au1k_wait(void); - - if (!write) { - *len = 0; -@@ -305,119 +302,9 @@ - if (retval) - return retval; - suspend_mode = 1; -- au1k_wait(); -- retval = pm_send_all(PM_RESUME, (void *) 0); -- } -- return retval; --} - -- --static int pm_do_freq(ctl_table * ctl, int write, struct file *file, -- void *buffer, size_t * len) --{ -- int retval = 0, i; -- unsigned long val, pll; --#define TMPBUFLEN 64 --#define MAX_CPU_FREQ 396 -- char buf[TMPBUFLEN], *p; -- unsigned long flags, intc0_mask, intc1_mask; -- unsigned long old_baud_base, old_cpu_freq, baud_rate, old_clk, -- old_refresh; -- unsigned long new_baud_base, new_cpu_freq, new_clk, new_refresh; -- -- spin_lock_irqsave(&pm_lock, flags); -- if (!write) { -- *len = 0; -- } else { -- /* Parse the new frequency */ -- if (*len > TMPBUFLEN - 1) { -- spin_unlock_irqrestore(&pm_lock, flags); -- return -EFAULT; -- } -- if (copy_from_user(buf, buffer, *len)) { -- spin_unlock_irqrestore(&pm_lock, flags); -- return -EFAULT; -- } -- buf[*len] = 0; -- p = buf; -- val = simple_strtoul(p, &p, 0); -- if (val > MAX_CPU_FREQ) { -- spin_unlock_irqrestore(&pm_lock, flags); -- return -EFAULT; -- } -- -- pll = val / 12; -- if ((pll > 33) || (pll < 7)) { /* 396 MHz max, 84 MHz min */ -- /* revisit this for higher speed cpus */ -- spin_unlock_irqrestore(&pm_lock, flags); -- return -EFAULT; -- } -- -- old_baud_base = get_au1x00_uart_baud_base(); -- old_cpu_freq = get_au1x00_speed(); -- -- new_cpu_freq = pll * 12 * 1000000; -- new_baud_base = (new_cpu_freq / (2 * ((int)(au_readl(SYS_POWERCTRL)&0x03) + 2) * 16)); -- set_au1x00_speed(new_cpu_freq); -- set_au1x00_uart_baud_base(new_baud_base); -- -- old_refresh = au_readl(MEM_SDREFCFG) & 0x1ffffff; -- new_refresh = -- ((old_refresh * new_cpu_freq) / -- old_cpu_freq) | (au_readl(MEM_SDREFCFG) & ~0x1ffffff); -- -- au_writel(pll, SYS_CPUPLL); -- au_sync_delay(1); -- au_writel(new_refresh, MEM_SDREFCFG); -- au_sync_delay(1); -- -- for (i = 0; i < 4; i++) { -- if (au_readl -- (UART_BASE + UART_MOD_CNTRL + -- i * 0x00100000) == 3) { -- old_clk = -- au_readl(UART_BASE + UART_CLK + -- i * 0x00100000); -- // baud_rate = baud_base/clk -- baud_rate = old_baud_base / old_clk; -- /* we won't get an exact baud rate and the error -- * could be significant enough that our new -- * calculation will result in a clock that will -- * give us a baud rate that's too far off from -- * what we really want. -- */ -- if (baud_rate > 100000) -- baud_rate = 115200; -- else if (baud_rate > 50000) -- baud_rate = 57600; -- else if (baud_rate > 30000) -- baud_rate = 38400; -- else if (baud_rate > 17000) -- baud_rate = 19200; -- else -- (baud_rate = 9600); -- // new_clk = new_baud_base/baud_rate -- new_clk = new_baud_base / baud_rate; -- au_writel(new_clk, -- UART_BASE + UART_CLK + -- i * 0x00100000); -- au_sync_delay(10); -- } -- } -+ retval = pm_send_all(PM_RESUME, (void *) 0); - } -- -- -- /* We don't want _any_ interrupts other than -- * match20. Otherwise our calibrate_delay() -- * calculation will be off, potentially a lot. -- */ -- intc0_mask = save_local_and_disable(0); -- intc1_mask = save_local_and_disable(1); -- local_enable_irq(AU1000_TOY_MATCH2_INT); -- spin_unlock_irqrestore(&pm_lock, flags); -- calibrate_delay(); -- restore_local_and_enable(0, intc0_mask); -- restore_local_and_enable(1, intc1_mask); - return retval; - } - -@@ -425,7 +312,6 @@ - static struct ctl_table pm_table[] = { - {ACPI_S1_SLP_TYP, "suspend", NULL, 0, 0600, NULL, &pm_do_suspend}, - {ACPI_SLEEP, "sleep", NULL, 0, 0600, NULL, &pm_do_sleep}, -- {CTL_ACPI, "freq", NULL, 0, 0600, NULL, &pm_do_freq}, - {0} - }; - -diff -Nur linux-2.4.30/arch/mips/au1000/common/reset.c linux-2.4.30-mips/arch/mips/au1000/common/reset.c ---- linux-2.4.30/arch/mips/au1000/common/reset.c 2005-01-19 15:09:26.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/common/reset.c 2005-03-19 08:17:51.000000000 +0100 -@@ -37,8 +37,6 @@ - #include - #include - --extern int au_sleep(void); -- - void au1000_restart(char *command) - { - /* Set all integrated peripherals to disabled states */ -@@ -144,6 +142,26 @@ - au_writel(0x00, 0xb1900064); /* sys_auxpll */ - au_writel(0x00, 0xb1900100); /* sys_pininputen */ - break; -+ case 0x04000000: /* Au1200 */ -+ au_writel(0x00, 0xb400300c); /* ddma */ -+ au_writel(0x00, 0xb1a00004); /* psc 0 */ -+ au_writel(0x00, 0xb1b00004); /* psc 1 */ -+ au_writel(0x00d02000, 0xb4020004); /* ehci, ohci, udc, otg */ -+ au_writel(0x00, 0xb5000004); /* lcd */ -+ au_writel(0x00, 0xb060000c); /* sd0 */ -+ au_writel(0x00, 0xb068000c); /* sd1 */ -+ au_writel(0x00, 0xb1100100); /* swcnt */ -+ au_writel(0x00, 0xb0300000); /* aes */ -+ au_writel(0x00, 0xb4004000); /* cim */ -+ au_writel(0x00, 0xb1100100); /* uart0_enable */ -+ au_writel(0x00, 0xb1200100); /* uart1_enable */ -+ au_writel(0x00, 0xb1900020); /* sys_freqctrl0 */ -+ au_writel(0x00, 0xb1900024); /* sys_freqctrl1 */ -+ au_writel(0x00, 0xb1900028); /* sys_clksrc */ -+ au_writel(0x10, 0xb1900060); /* sys_cpupll */ -+ au_writel(0x00, 0xb1900064); /* sys_auxpll */ -+ au_writel(0x00, 0xb1900100); /* sys_pininputen */ -+ break; - - default: - break; -@@ -163,32 +181,23 @@ - - void au1000_halt(void) - { --#if defined(CONFIG_MIPS_PB1550) -- /* power off system */ -- printk("\n** Powering off Pb1550\n"); -- au_writew(au_readw(0xAF00001C) | (3<<14), 0xAF00001C); -- au_sync(); -- while(1); /* should not get here */ --#endif -- printk(KERN_NOTICE "\n** You can safely turn off the power\n"); --#ifdef CONFIG_MIPS_MIRAGE -- au_writel((1 << 26) | (1 << 10), GPIO2_OUTPUT); --#endif --#ifdef CONFIG_PM -- au_sleep(); -- -- /* should not get here */ -- printk(KERN_ERR "Unable to put cpu in sleep mode\n"); -- while(1); --#else -- while (1) -+ /* Use WAIT in a low-power infinite spin loop */ -+ while (1) { - __asm__(".set\tmips3\n\t" - "wait\n\t" - ".set\tmips0"); --#endif -+ } - } - - void au1000_power_off(void) - { -+ extern void board_power_off (void); -+ -+ printk(KERN_NOTICE "\n** You can safely turn off the power\n"); -+ -+ /* Give board a chance to power-off */ -+ board_power_off(); -+ -+ /* If board can't power-off, spin forever */ - au1000_halt(); - } -diff -Nur linux-2.4.30/arch/mips/au1000/common/setup.c linux-2.4.30-mips/arch/mips/au1000/common/setup.c ---- linux-2.4.30/arch/mips/au1000/common/setup.c 2005-01-19 15:09:26.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/common/setup.c 2005-01-30 09:01:27.000000000 +0100 -@@ -174,6 +174,40 @@ - initrd_end = (unsigned long)&__rd_end; - #endif - -+#if defined(CONFIG_SOC_AU1200) -+#ifdef CONFIG_USB_EHCI_HCD -+ if ((argptr = strstr(argptr, "usb_ehci=")) == NULL) { -+ char usb_args[80]; -+ argptr = prom_getcmdline(); -+ memset(usb_args, 0, sizeof(usb_args)); -+ sprintf(usb_args, " usb_ehci=base:0x%x,len:0x%x,irq:%d", -+ USB_EHCI_BASE, USB_EHCI_LEN, AU1000_USB_HOST_INT); -+ strcat(argptr, usb_args); -+ } -+#ifdef CONFIG_USB_AMD5536UDC -+ /* enable EHC + OHC + UDC clocks, memory and bus mastering */ -+/* au_writel( 0x00DF207F, USB_MSR_BASE + 4); */ -+ au_writel( 0xC0DF207F, USB_MSR_BASE + 4); // incl. prefetch -+#else -+ /* enable EHC + OHC clocks, memory and bus mastering */ -+/* au_writel( 0x00DB200F, USB_MSR_BASE + 4); */ -+ au_writel( 0xC0DB200F, USB_MSR_BASE + 4); /* incl. prefetch */ -+#endif -+ udelay(1000); -+ -+#else /* CONFIG_USB_EHCI_HCD */ -+ -+#ifdef CONFIG_USB_AMD5536UDC -+#ifndef CONFIG_USB_OHCI -+ /* enable UDC clocks, memory and bus mastering */ -+/* au_writel( 0x00DC2070, USB_MSR_BASE + 4); */ -+ au_writel( 0xC0DC2070, USB_MSR_BASE + 4); // incl. prefetch -+ udelay(1000); -+#endif -+#endif -+#endif /* CONFIG_USB_EHCI_HCD */ -+#endif /* CONFIG_SOC_AU1200 */ -+ - #if defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE) - #ifdef CONFIG_USB_OHCI - if ((argptr = strstr(argptr, "usb_ohci=")) == NULL) { -@@ -187,19 +221,38 @@ - #endif - - #ifdef CONFIG_USB_OHCI -- // enable host controller and wait for reset done -+#if defined(CONFIG_SOC_AU1200) -+#ifndef CONFIG_USB_EHCI_HCD -+#ifdef CONFIG_USB_AMD5536UDC -+ /* enable OHC + UDC clocks, memory and bus mastering */ -+/* au_writel( 0x00DD2073, USB_MSR_BASE + 4); */ -+ au_writel( 0xC0DD2073, USB_MSR_BASE + 4); // incl. prefetch -+#else -+ /* enable OHC clocks, memory and bus mastering */ -+ au_writel( 0x00D12003, USB_MSR_BASE + 4); -+#endif -+ udelay(1000); -+printk("DEBUG: Reading Au1200 USB2 reg 0x%x\n", au_readl(USB_MSR_BASE + 4)); -+#endif -+#else -+ /* Au1000, Au1500, Au1100, Au1550 */ -+ /* enable host controller and wait for reset done */ - au_writel(0x08, USB_HOST_CONFIG); - udelay(1000); - au_writel(0x0E, USB_HOST_CONFIG); - udelay(1000); -- au_readl(USB_HOST_CONFIG); // throw away first read -+ au_readl(USB_HOST_CONFIG); /* throw away first read */ - while (!(au_readl(USB_HOST_CONFIG) & 0x10)) - au_readl(USB_HOST_CONFIG); -+#endif /* CONFIG_SOC_AU1200 */ - #endif --#endif // defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE) -+#else -+ -+#endif /* defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE) */ -+ - - #ifdef CONFIG_FB -- // Needed if PCI video card in use -+ /* Needed if PCI video card in use */ - conswitchp = &dummy_con; - #endif - -@@ -209,8 +262,7 @@ - #endif - - #ifdef CONFIG_BLK_DEV_IDE -- /* Board setup takes precedence for unique devices. -- */ -+ /* Board setup takes precedence for unique devices. */ - if ((ide_ops == NULL) || (ide_ops == &no_ide_ops)) - ide_ops = &std_ide_ops; - #endif -diff -Nur linux-2.4.30/arch/mips/au1000/common/sleeper.S linux-2.4.30-mips/arch/mips/au1000/common/sleeper.S ---- linux-2.4.30/arch/mips/au1000/common/sleeper.S 2004-02-18 14:36:30.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/common/sleeper.S 2005-01-30 09:01:27.000000000 +0100 -@@ -15,17 +15,48 @@ - #include - #include - #include -+#include -+ -+/* -+ * Note: This file is *not* conditional on CONFIG_PM since Alchemy sleep -+ * need not be tied to any particular power management scheme. -+ */ -+ -+ .extern ___flush_cache_all - - .text -- .set macro -- .set noat - .align 5 - --/* Save all of the processor general registers and go to sleep. -- * A wakeup condition will get us back here to restore the registers. -+/* -+ * Save the processor general registers and go to sleep. A wakeup -+ * condition will get us back here to restore the registers. - */ --LEAF(save_and_sleep) - -+/* still need to fix alignment issues here */ -+save_and_sleep_frmsz = 48 -+NESTED(save_and_sleep, save_and_sleep_frmsz, ra) -+ .set noreorder -+ .set nomacro -+ .set noat -+ subu sp, save_and_sleep_frmsz -+ sw ra, save_and_sleep_frmsz-4(sp) -+ sw s0, save_and_sleep_frmsz-8(sp) -+ sw s1, save_and_sleep_frmsz-12(sp) -+ sw s2, save_and_sleep_frmsz-16(sp) -+ sw s3, save_and_sleep_frmsz-20(sp) -+ sw s4, save_and_sleep_frmsz-24(sp) -+ sw s5, save_and_sleep_frmsz-28(sp) -+ sw s6, save_and_sleep_frmsz-32(sp) -+ sw s7, save_and_sleep_frmsz-36(sp) -+ sw s8, save_and_sleep_frmsz-40(sp) -+ sw gp, save_and_sleep_frmsz-44(sp) -+ -+ /* We only need to save the registers that the calling function -+ * hasn't saved for us. 0 is always zero. 8 - 15, 24 and 25 are -+ * temporaries and can be used without saving. 26 and 27 are reserved -+ * for interrupt/trap handling and expected to change. 29 is the -+ * stack pointer which is handled as a special case here. -+ */ - subu sp, PT_SIZE - sw $1, PT_R1(sp) - sw $2, PT_R2(sp) -@@ -34,14 +65,6 @@ - sw $5, PT_R5(sp) - sw $6, PT_R6(sp) - sw $7, PT_R7(sp) -- sw $8, PT_R8(sp) -- sw $9, PT_R9(sp) -- sw $10, PT_R10(sp) -- sw $11, PT_R11(sp) -- sw $12, PT_R12(sp) -- sw $13, PT_R13(sp) -- sw $14, PT_R14(sp) -- sw $15, PT_R15(sp) - sw $16, PT_R16(sp) - sw $17, PT_R17(sp) - sw $18, PT_R18(sp) -@@ -50,32 +73,47 @@ - sw $21, PT_R21(sp) - sw $22, PT_R22(sp) - sw $23, PT_R23(sp) -- sw $24, PT_R24(sp) -- sw $25, PT_R25(sp) -- sw $26, PT_R26(sp) -- sw $27, PT_R27(sp) - sw $28, PT_R28(sp) -- sw $29, PT_R29(sp) - sw $30, PT_R30(sp) - sw $31, PT_R31(sp) -+#define PT_C0STATUS PT_LO -+#define PT_CONTEXT PT_HI -+#define PT_PAGEMASK PT_EPC -+#define PT_CONFIG PT_BVADDR - mfc0 k0, CP0_STATUS -- sw k0, 0x20(sp) -+ sw k0, PT_C0STATUS(sp) // 0x20 - mfc0 k0, CP0_CONTEXT -- sw k0, 0x1c(sp) -+ sw k0, PT_CONTEXT(sp) // 0x1c - mfc0 k0, CP0_PAGEMASK -- sw k0, 0x18(sp) -+ sw k0, PT_PAGEMASK(sp) // 0x18 - mfc0 k0, CP0_CONFIG -- sw k0, 0x14(sp) -+ sw k0, PT_CONFIG(sp) // 0x14 -+ -+ .set macro -+ .set at -+ -+ li t0, SYS_SLPPWR -+ sw zero, 0(t0) /* Get the processor ready to sleep */ -+ sync - - /* Now set up the scratch registers so the boot rom will - * return to this point upon wakeup. -+ * sys_scratch0 : SP -+ * sys_scratch1 : RA -+ */ -+ li t0, SYS_SCRATCH0 -+ li t1, SYS_SCRATCH1 -+ sw sp, 0(t0) -+ la k0, resume_from_sleep -+ sw k0, 0(t1) -+ -+/* -+ * Flush DCACHE to make sure context is in memory - */ -- la k0, 1f -- lui k1, 0xb190 -- ori k1, 0x18 -- sw sp, 0(k1) -- ori k1, 0x1c -- sw k0, 0(k1) -+ la t1,___flush_cache_all /* _flush_cache_all is a function pointer */ -+ lw t0,0(t1) -+ jal t0 -+ nop - - /* Put SDRAM into self refresh. Preload instructions into cache, - * issue a precharge, then auto refresh, then sleep commands to it. -@@ -88,30 +126,65 @@ - cache 0x14, 96(t0) - .set mips0 - -+ /* Put SDRAM to sleep */ - sdsleep: -- lui k0, 0xb400 -- sw zero, 0x001c(k0) /* Precharge */ -- sw zero, 0x0020(k0) /* Auto refresh */ -- sw zero, 0x0030(k0) /* SDRAM sleep */ -+ li a0, MEM_PHYS_ADDR -+ or a0, a0, 0xA0000000 -+#if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1100) || defined(CONFIG_SOC_AU1500) -+ lw k0, MEM_SDMODE0(a0) -+ sw zero, MEM_SDPRECMD(a0) /* Precharge */ -+ sw zero, MEM_SDAUTOREF(a0) /* Auto Refresh */ -+ sw zero, MEM_SDSLEEP(a0) /* Sleep */ - sync -- -- lui k1, 0xb190 -- sw zero, 0x0078(k1) /* get ready to sleep */ -+#endif -+#if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200) -+ sw zero, MEM_SDPRECMD(a0) /* Precharge */ -+ sw zero, MEM_SDSREF(a0) -+ -+ #lw t0, MEM_SDSTAT(a0) -+ #and t0, t0, 0x01000000 -+ li t0, 0x01000000 -+refresh_not_set: -+ lw t1, MEM_SDSTAT(a0) -+ and t2, t1, t0 -+ beq zero, t2, refresh_not_set -+ nop -+ -+ li t0, ~0x30000000 -+ lw t1, MEM_SDCONFIGA(a0) -+ and t1, t0, t1 -+ sw t1, MEM_SDCONFIGA(a0) - sync -- sw zero, 0x007c(k1) /* Put processor to sleep */ -+#endif -+ -+ li t0, SYS_SLEEP -+ sw zero, 0(t0) /* Put processor to sleep */ - sync -+ nop -+ nop -+ nop -+ nop -+ nop -+ nop -+ nop -+ nop -+ - - /* This is where we return upon wakeup. - * Reload all of the registers and return. - */ --1: nop -- lw k0, 0x20(sp) -+resume_from_sleep: -+ nop -+ .set nomacro -+ .set noat -+ -+ lw k0, PT_C0STATUS(sp) // 0x20 - mtc0 k0, CP0_STATUS -- lw k0, 0x1c(sp) -+ lw k0, PT_CONTEXT(sp) // 0x1c - mtc0 k0, CP0_CONTEXT -- lw k0, 0x18(sp) -+ lw k0, PT_PAGEMASK(sp) // 0x18 - mtc0 k0, CP0_PAGEMASK -- lw k0, 0x14(sp) -+ lw k0, PT_CONFIG(sp) // 0x14 - mtc0 k0, CP0_CONFIG - lw $1, PT_R1(sp) - lw $2, PT_R2(sp) -@@ -120,14 +193,6 @@ - lw $5, PT_R5(sp) - lw $6, PT_R6(sp) - lw $7, PT_R7(sp) -- lw $8, PT_R8(sp) -- lw $9, PT_R9(sp) -- lw $10, PT_R10(sp) -- lw $11, PT_R11(sp) -- lw $12, PT_R12(sp) -- lw $13, PT_R13(sp) -- lw $14, PT_R14(sp) -- lw $15, PT_R15(sp) - lw $16, PT_R16(sp) - lw $17, PT_R17(sp) - lw $18, PT_R18(sp) -@@ -136,15 +201,36 @@ - lw $21, PT_R21(sp) - lw $22, PT_R22(sp) - lw $23, PT_R23(sp) -- lw $24, PT_R24(sp) -- lw $25, PT_R25(sp) -- lw $26, PT_R26(sp) -- lw $27, PT_R27(sp) - lw $28, PT_R28(sp) -- lw $29, PT_R29(sp) - lw $30, PT_R30(sp) - lw $31, PT_R31(sp) -+ -+ .set macro -+ .set at -+ -+ /* clear the wake source, but save it as the return value of the function */ -+ li t0, SYS_WAKESRC -+ lw v0, 0(t0) -+ sw v0, PT_R2(sp) -+ sw zero, 0(t0) -+ - addiu sp, PT_SIZE - -+ lw gp, save_and_sleep_frmsz-44(sp) -+ lw s8, save_and_sleep_frmsz-40(sp) -+ lw s7, save_and_sleep_frmsz-36(sp) -+ lw s6, save_and_sleep_frmsz-32(sp) -+ lw s5, save_and_sleep_frmsz-28(sp) -+ lw s4, save_and_sleep_frmsz-24(sp) -+ lw s3, save_and_sleep_frmsz-20(sp) -+ lw s2, save_and_sleep_frmsz-16(sp) -+ lw s1, save_and_sleep_frmsz-12(sp) -+ lw s0, save_and_sleep_frmsz-8(sp) -+ lw ra, save_and_sleep_frmsz-4(sp) -+ -+ addu sp, save_and_sleep_frmsz - jr ra -+ nop -+ .set reorder - END(save_and_sleep) -+ -diff -Nur linux-2.4.30/arch/mips/au1000/common/time.c linux-2.4.30-mips/arch/mips/au1000/common/time.c ---- linux-2.4.30/arch/mips/au1000/common/time.c 2005-01-19 15:09:26.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/common/time.c 2005-04-08 10:33:17.000000000 +0200 -@@ -50,7 +50,6 @@ - #include - #include - --extern void startup_match20_interrupt(void); - extern void do_softirq(void); - extern volatile unsigned long wall_jiffies; - unsigned long missed_heart_beats = 0; -@@ -59,14 +58,14 @@ - static unsigned long r4k_cur; /* What counter should be at next timer irq */ - extern rwlock_t xtime_lock; - int no_au1xxx_32khz; --void (*au1k_wait_ptr)(void); -+extern int allow_au1k_wait; /* default off for CP0 Counter */ - - /* Cycle counter value at the previous timer interrupt.. */ - static unsigned int timerhi = 0, timerlo = 0; - - #ifdef CONFIG_PM - #define MATCH20_INC 328 --extern void startup_match20_interrupt(void); -+extern void startup_match20_interrupt(void (*handler)(int, void *, struct pt_regs *)); - static unsigned long last_pc0, last_match20; - #endif - -@@ -385,7 +384,6 @@ - { - unsigned int est_freq; - extern unsigned long (*do_gettimeoffset)(void); -- extern void au1k_wait(void); - - printk("calculating r4koff... "); - r4k_offset = cal_r4koff(); -@@ -437,9 +435,6 @@ - au_writel(0, SYS_TOYWRITE); - while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C0S); - -- au_writel(au_readl(SYS_WAKEMSK) | (1<<8), SYS_WAKEMSK); -- au_writel(~0, SYS_WAKESRC); -- au_sync(); - while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20); - - /* setup match20 to interrupt once every 10ms */ -@@ -447,13 +442,13 @@ - au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2); - au_sync(); - while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20); -- startup_match20_interrupt(); -+ startup_match20_interrupt(counter0_irq); - - do_gettimeoffset = do_fast_pm_gettimeoffset; - - /* We can use the real 'wait' instruction. - */ -- au1k_wait_ptr = au1k_wait; -+ allow_au1k_wait = 1; - } - - #else -diff -Nur linux-2.4.30/arch/mips/au1000/db1x00/Makefile linux-2.4.30-mips/arch/mips/au1000/db1x00/Makefile ---- linux-2.4.30/arch/mips/au1000/db1x00/Makefile 2005-01-19 15:09:26.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/db1x00/Makefile 2005-01-30 09:06:19.000000000 +0100 -@@ -17,4 +17,11 @@ - obj-y := init.o board_setup.o irqmap.o - obj-$(CONFIG_WM97XX_COMODULE) += mirage_ts.o - -+ifdef CONFIG_MIPS_DB1100 -+ifdef CONFIG_MMC -+obj-y += mmc_support.o -+export-objs += mmc_support.o -+endif -+endif -+ - include $(TOPDIR)/Rules.make -diff -Nur linux-2.4.30/arch/mips/au1000/db1x00/board_setup.c linux-2.4.30-mips/arch/mips/au1000/db1x00/board_setup.c ---- linux-2.4.30/arch/mips/au1000/db1x00/board_setup.c 2005-01-19 15:09:26.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/db1x00/board_setup.c 2005-03-19 08:17:51.000000000 +0100 -@@ -46,10 +46,22 @@ - #include - #include - --extern struct rtc_ops no_rtc_ops; -+#if defined(CONFIG_BLK_DEV_IDE_AU1XXX) && defined(CONFIG_MIPS_DB1550) -+#include -+extern struct ide_ops *ide_ops; -+extern struct ide_ops au1xxx_ide_ops; -+extern u32 au1xxx_ide_virtbase; -+extern u64 au1xxx_ide_physbase; -+extern int au1xxx_ide_irq; -+ -+/* Ddma */ -+chan_tab_t *ide_read_ch, *ide_write_ch; -+u32 au1xxx_ide_ddma_enable = 0, switch4ddma = 1; // PIO+ddma -+ -+dbdev_tab_t new_dbdev_tab_element = { DSCR_CMD0_THROTTLE, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }; -+#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX */ - --/* not correct for db1550 */ --static BCSR * const bcsr = (BCSR *)0xAE000000; -+extern struct rtc_ops no_rtc_ops; - - void board_reset (void) - { -@@ -57,6 +69,13 @@ - au_writel(0x00000000, 0xAE00001C); - } - -+void board_power_off (void) -+{ -+#ifdef CONFIG_MIPS_MIRAGE -+ au_writel((1 << 26) | (1 << 10), GPIO2_OUTPUT); -+#endif -+} -+ - void __init board_setup(void) - { - u32 pin_func; -@@ -108,8 +127,42 @@ - au_writel(0x02000200, GPIO2_OUTPUT); - #endif - -+#if defined(CONFIG_AU1XXX_SMC91111) -+#define CPLD_CONTROL (0xAF00000C) -+ { -+ extern uint32_t au1xxx_smc91111_base; -+ extern unsigned int au1xxx_smc91111_irq; -+ extern int au1xxx_smc91111_nowait; -+ -+ au1xxx_smc91111_base = 0xAC000300; -+ au1xxx_smc91111_irq = AU1000_GPIO_8; -+ au1xxx_smc91111_nowait = 1; -+ -+ /* set up the Static Bus timing - only 396Mhz */ -+ bcsr->resets |= 0x7; -+ au_writel(0x00010003, MEM_STCFG0); -+ au_writel(0x000c00c0, MEM_STCFG2); -+ au_writel(0x85E1900D, MEM_STTIME2); -+ } -+#endif /* end CONFIG_SMC91111 */ - au_sync(); - -+#if defined(CONFIG_BLK_DEV_IDE_AU1XXX) && defined(CONFIG_MIPS_DB1550) -+ /* -+ * Iniz IDE parameters -+ */ -+ ide_ops = &au1xxx_ide_ops; -+ au1xxx_ide_irq = DAUGHTER_CARD_IRQ; -+ au1xxx_ide_physbase = AU1XXX_ATA_PHYS_ADDR; -+ au1xxx_ide_virtbase = KSEG1ADDR(AU1XXX_ATA_PHYS_ADDR); -+ -+ /* -+ * change PIO or PIO+Ddma -+ * check the GPIO-6 pin condition. db1550:s6_dot -+ */ -+ switch4ddma = (au_readl(SYS_PINSTATERD) & (1 << 6)) ? 1 : 0; -+#endif -+ - #ifdef CONFIG_MIPS_DB1000 - printk("AMD Alchemy Au1000/Db1000 Board\n"); - #endif -diff -Nur linux-2.4.30/arch/mips/au1000/db1x00/irqmap.c linux-2.4.30-mips/arch/mips/au1000/db1x00/irqmap.c ---- linux-2.4.30/arch/mips/au1000/db1x00/irqmap.c 2005-01-19 15:09:26.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/db1x00/irqmap.c 2005-01-30 09:06:19.000000000 +0100 -@@ -53,6 +53,7 @@ - #ifdef CONFIG_MIPS_DB1550 - { AU1000_GPIO_3, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card 0 IRQ# - { AU1000_GPIO_5, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card 1 IRQ# -+ { AU1000_GPIO_8, INTC_INT_LOW_LEVEL, 0 }, // Daughtercard IRQ# - #else - { AU1000_GPIO_0, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card 0 Fully_Interted# - { AU1000_GPIO_1, INTC_INT_LOW_LEVEL, 0 }, // PCMCIA Card 0 STSCHG# -diff -Nur linux-2.4.30/arch/mips/au1000/db1x00/mmc_support.c linux-2.4.30-mips/arch/mips/au1000/db1x00/mmc_support.c ---- linux-2.4.30/arch/mips/au1000/db1x00/mmc_support.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/db1x00/mmc_support.c 2005-01-30 09:07:01.000000000 +0100 -@@ -0,0 +1,126 @@ -+/* -+ * BRIEF MODULE DESCRIPTION -+ * -+ * MMC support routines for DB1100. -+ * -+ * -+ * Copyright (c) 2003-2004 Embedded Edge, LLC. -+ * Author: Embedded Edge, LLC. -+ * Contact: dan@embeddededge.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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED -+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN -+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ * 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 -+ -+ -+/* SD/MMC controller support functions */ -+ -+/* -+ * Detect card. -+ */ -+void mmc_card_inserted(int _n_, int *_res_) -+{ -+ u32 gpios = au_readl(SYS_PINSTATERD); -+ u32 emptybit = (_n_) ? (1<<20) : (1<<19); -+ *_res_ = ((gpios & emptybit) == 0); -+} -+ -+/* -+ * Check card write protection. -+ */ -+void mmc_card_writable(int _n_, int *_res_) -+{ -+ BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR; -+ unsigned long mmc_wp, board_specific; -+ -+ if (_n_) { -+ mmc_wp = BCSR_BOARD_SD1_WP; -+ } else { -+ mmc_wp = BCSR_BOARD_SD0_WP; -+ } -+ -+ board_specific = au_readl((unsigned long)(&bcsr->specific)); -+ -+ if (!(board_specific & mmc_wp)) {/* low means card writable */ -+ *_res_ = 1; -+ } else { -+ *_res_ = 0; -+ } -+} -+ -+/* -+ * Apply power to card slot. -+ */ -+void mmc_power_on(int _n_) -+{ -+ BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR; -+ unsigned long mmc_pwr, board_specific; -+ -+ if (_n_) { -+ mmc_pwr = BCSR_BOARD_SD1_PWR; -+ } else { -+ mmc_pwr = BCSR_BOARD_SD0_PWR; -+ } -+ -+ board_specific = au_readl((unsigned long)(&bcsr->specific)); -+ board_specific |= mmc_pwr; -+ -+ au_writel(board_specific, (int)(&bcsr->specific)); -+ au_sync_delay(1); -+} -+ -+/* -+ * Remove power from card slot. -+ */ -+void mmc_power_off(int _n_) -+{ -+ BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR; -+ unsigned long mmc_pwr, board_specific; -+ -+ if (_n_) { -+ mmc_pwr = BCSR_BOARD_SD1_PWR; -+ } else { -+ mmc_pwr = BCSR_BOARD_SD0_PWR; -+ } -+ -+ board_specific = au_readl((unsigned long)(&bcsr->specific)); -+ board_specific &= ~mmc_pwr; -+ -+ au_writel(board_specific, (int)(&bcsr->specific)); -+ au_sync_delay(1); -+} -+ -+EXPORT_SYMBOL(mmc_card_inserted); -+EXPORT_SYMBOL(mmc_card_writable); -+EXPORT_SYMBOL(mmc_power_on); -+EXPORT_SYMBOL(mmc_power_off); -+ -diff -Nur linux-2.4.30/arch/mips/au1000/ficmmp/Makefile linux-2.4.30-mips/arch/mips/au1000/ficmmp/Makefile ---- linux-2.4.30/arch/mips/au1000/ficmmp/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/ficmmp/Makefile 2005-01-30 09:01:27.000000000 +0100 -@@ -0,0 +1,25 @@ -+# -+# Copyright 2000 MontaVista Software Inc. -+# Author: MontaVista Software, Inc. -+# ppopov@mvista.com or source@mvista.com -+# -+# Makefile for the Alchemy Semiconductor FIC board. -+# -+# Note! Dependencies are done automagically by 'make dep', which also -+# removes any old dependencies. DON'T put your own dependencies here -+# unless it's something special (ie not a .c file). -+# -+ -+USE_STANDARD_AS_RULE := true -+ -+O_TARGET := ficmmp.o -+ -+obj-y := init.o board_setup.o irqmap.o au1200_ibutton.o au1xxx_dock.o -+ -+ifdef CONFIG_MMC -+obj-y += mmc_support.o -+export-objs +=mmc_support.o -+endif -+ -+ -+include $(TOPDIR)/Rules.make -diff -Nur linux-2.4.30/arch/mips/au1000/ficmmp/au1200_ibutton.c linux-2.4.30-mips/arch/mips/au1000/ficmmp/au1200_ibutton.c ---- linux-2.4.30/arch/mips/au1000/ficmmp/au1200_ibutton.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/ficmmp/au1200_ibutton.c 2005-02-03 07:35:29.000000000 +0100 -@@ -0,0 +1,270 @@ -+/* ---------------------------------------------------------------------- -+ * mtwilson_keys.c -+ * -+ * Copyright (C) 2003 Intrinsyc Software Inc. -+ * -+ * Intel Personal Media Player buttons -+ * -+ * 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. -+ * -+ * May 02, 2003 : Initial version [FB] -+ * -+ ------------------------------------------------------------------------*/ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define DRIVER_VERSION "V1.0" -+#define DRIVER_AUTHOR "FIC" -+#define DRIVER_DESC "FIC Travis Media Player Button Driver" -+#define DRIVER_NAME "Au1200Button" -+ -+#define BUTTON_MAIN (1<<1) -+#define BUTTON_SELECT (1<<6) -+#define BUTTON_GUIDE (1<<12) -+#define BUTTON_DOWN (1<<17) -+#define BUTTON_LEFT (1<<19) -+#define BUTTON_RIGHT (1<<26) -+#define BUTTON_UP (1<<28) -+ -+#define BUTTON_MASK (\ -+ BUTTON_MAIN \ -+ | BUTTON_SELECT \ -+ | BUTTON_GUIDE \ -+ | BUTTON_DOWN \ -+ | BUTTON_LEFT \ -+ | BUTTON_RIGHT \ -+ | BUTTON_UP \ -+ ) -+ -+#define BUTTON_INVERT (\ -+ BUTTON_MAIN \ -+ | 0 \ -+ | BUTTON_GUIDE \ -+ | 0 \ -+ | 0 \ -+ | 0 \ -+ | 0 \ -+ ) -+ -+char button_map[32]={0,KEY_S,0,0,0,0,KEY_ENTER,0,0,0,0,0,KEY_G,0,0,0,0,KEY_DOWN,0,KEY_LEFT,0,0,0,0,0,0,KEY_RIGHT,0,KEY_UP,0,0,0}; -+//char button_map[32]={0,0,0,0,0,0,KEY_ENTER,0,0,0,0,0,KEY_G,0,0,0,0,KEY_DOWN,0,KEY_LEFT,0,0,0,0,0,0,KEY_RIGHT,0,KEY_UP,0,0,0}; -+ -+//char button_map[32]={0,KEY_TAB,0,0,0,0,KEY_M,0,0,0,0,0,KEY_S,0,0,0,0,KEY_DOWN,0,KEY_LEFT,0,0,0,0,0,0,KEY_RIGHT,0,KEY_UP,0,0,0}; -+//char button_map[32]={0,0,0,0,0,0,KEY_M,0,0,0,0,0,KEY_S,0,0,0,0,KEY_DOWN,0,KEY_LEFT,0,0,0,0,0,0,KEY_RIGHT,0,KEY_UP,0,0,0}; -+ -+#define BUTTON_COUNT (sizeof (button_map) / sizeof (button_map[0])) -+ -+struct input_dev dev; -+struct timeval cur_tv; -+ -+static unsigned int old_tv_usec = 0; -+ -+static unsigned int read_button_state(void) -+{ -+ unsigned int state; -+ -+ state = au_readl(SYS_PINSTATERD) & BUTTON_MASK; /* get gpio status */ -+ -+ state ^= BUTTON_INVERT; /* invert main & guide button */ -+ -+ /* printk("au1200_ibutton.c: button state [0x%X]\r\n",state); */ -+ return state; -+} -+ -+//This function returns 0 if the allowed microseconds have elapsed since the last call to ths function, otherwise it returns 1 to indicate a bounce condition -+static unsigned int bounce() -+{ -+ -+ unsigned int elapsed_time; -+ -+ do_gettimeofday (&cur_tv); -+ -+ if (!old_tv_usec) { -+ old_tv_usec = cur_tv.tv_usec; -+ return 0; -+ } -+ -+ if(cur_tv.tv_usec > old_tv_usec) { -+ /* If there hasn't been rollover */ -+ elapsed_time = ((cur_tv.tv_usec - old_tv_usec)); -+ } -+ else { -+ /* Accounting for rollover */ -+ elapsed_time = ((1000000 - old_tv_usec + cur_tv.tv_usec)); -+ } -+ -+ if (elapsed_time > 250000) { -+ old_tv_usec = 0; /* reset the bounce time */ -+ return 0; -+ } -+ -+ return 1; -+} -+ -+/* button interrupt handler */ -+static void button_interrupt(int irq, void *dev, struct pt_regs *regs) -+{ -+ -+ unsigned int i,bit_mask, key_choice; -+ u32 button_state; -+ -+ /* Report state to upper level */ -+ -+ button_state = read_button_state() & BUTTON_MASK; /* get new gpio status */ -+ -+ /* Return if this is a repeated (bouncing) event */ -+ if(bounce()) -+ return; -+ -+ /* we want to make keystrokes */ -+ for( i=0; i< BUTTON_COUNT; i++) { -+ bit_mask = 1< -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+ -+#if defined(CONFIG_MIPS_FICMMP) -+ #define DOCK_GPIO 215 -+#else -+ #error Unsupported Au1xxx Platform -+#endif -+ -+#define MAKE_FLAG 0x20 -+ -+#undef DEBUG -+ -+#define DEBUG 0 -+//#define DEBUG 1 -+ -+#if DEBUG -+#define DPRINTK(format, args...) printk(__FUNCTION__ ": " format, ## args) -+#else -+#define DPRINTK(format, args...) do { } while (0) -+#endif -+ -+/* Please note that this driver is based on a timer and is not interrupt -+ * driven. If you are going to make use of this driver, you will need to have -+ * your application open the dock listing from the /dev directory first. -+ */ -+ -+struct au1xxx_dock { -+ struct fasync_struct *fasync; -+ wait_queue_head_t read_wait; -+ int open_count; -+ unsigned int debounce; -+ unsigned int current; -+ unsigned int last; -+}; -+ -+static struct au1xxx_dock dock_info; -+ -+ -+static void dock_timer_periodic(void *data); -+ -+static struct tq_struct dock_task = { -+ routine: dock_timer_periodic, -+ data: NULL -+}; -+ -+static int cleanup_flag = 0; -+static DECLARE_WAIT_QUEUE_HEAD(cleanup_wait_queue); -+ -+ -+static unsigned int read_dock_state(void) -+{ -+ u32 state; -+ -+ state = au1xxx_gpio_read(DOCK_GPIO); -+ -+ /* printk( "Current Dock State: %d\n", state ); */ -+ -+ return state; -+} -+ -+ -+static void dock_timer_periodic(void *data) -+{ -+ struct au1xxx_dock *dock = (struct au1xxx_dock *)data; -+ unsigned long dock_state; -+ -+ /* If cleanup wants us to die */ -+ if (cleanup_flag) { -+ /* now cleanup_module can return */ -+ wake_up(&cleanup_wait_queue); -+ } else { -+ /* put ourselves back in the task queue */ -+ queue_task(&dock_task, &tq_timer); -+ } -+ -+ /* read current dock */ -+ dock_state = read_dock_state(); -+ -+ /* if dock states hasn't changed */ -+ /* save time and be done. */ -+ if (dock_state == dock->current) { -+ return; -+ } -+ -+ if (dock_state == dock->debounce) { -+ dock->current = dock_state; -+ } else { -+ dock->debounce = dock_state; -+ } -+ if (dock->current != dock->last) { -+ if (waitqueue_active(&dock->read_wait)) { -+ wake_up_interruptible(&dock->read_wait); -+ } -+ } -+} -+ -+ -+static ssize_t au1xxx_dock_read(struct file *filp, char *buffer, size_t count, loff_t *ppos) -+{ -+ struct au1xxx_dock *dock = filp->private_data; -+ char event[3]; -+ int last; -+ int cur; -+ int err; -+ -+try_again: -+ -+ while (dock->current == dock->last) { -+ if (filp->f_flags & O_NONBLOCK) { -+ return -EAGAIN; -+ } -+ interruptible_sleep_on(&dock->read_wait); -+ if (signal_pending(current)) { -+ return -ERESTARTSYS; -+ } -+ } -+ -+ cur = dock->current; -+ last = dock->last; -+ -+ if(cur != last) -+ { -+ event[0] = cur ? 'D' : 'U'; -+ event[1] = '\r'; -+ event[2] = '\n'; -+ } -+ else -+ goto try_again; -+ -+ dock->last = cur; -+ err = copy_to_user(buffer, &event, 3); -+ if (err) { -+ return err; -+ } -+ -+ return 3; -+} -+ -+ -+static int au1xxx_dock_open(struct inode *inode, struct file *filp) -+{ -+ struct au1xxx_dock *dock = &dock_info; -+ -+ MOD_INC_USE_COUNT; -+ -+ filp->private_data = dock; -+ -+ if (dock->open_count++ == 0) { -+ dock_task.data = dock; -+ cleanup_flag = 0; -+ queue_task(&dock_task, &tq_timer); -+ } -+ -+ return 0; -+} -+ -+ -+static unsigned int au1xxx_dock_poll(struct file *filp, poll_table *wait) -+{ -+ struct au1xxx_dock *dock = filp->private_data; -+ int ret = 0; -+ -+ DPRINTK("start\n"); -+ poll_wait(filp, &dock->read_wait, wait); -+ if (dock->current != dock->last) { -+ ret = POLLIN | POLLRDNORM; -+ } -+ return ret; -+} -+ -+ -+static int au1xxx_dock_release(struct inode *inode, struct file *filp) -+{ -+ struct au1xxx_dock *dock = filp->private_data; -+ -+ DPRINTK("start\n"); -+ -+ if (--dock->open_count == 0) { -+ cleanup_flag = 1; -+ sleep_on(&cleanup_wait_queue); -+ } -+ MOD_DEC_USE_COUNT; -+ -+ return 0; -+} -+ -+ -+ -+static struct file_operations au1xxx_dock_fops = { -+ owner: THIS_MODULE, -+ read: au1xxx_dock_read, -+ poll: au1xxx_dock_poll, -+ open: au1xxx_dock_open, -+ release: au1xxx_dock_release, -+}; -+ -+/* -+ * The au1xxx dock is a misc device: -+ * Major 10 char -+ * Minor 22 /dev/dock -+ * -+ * This is /dev/misc/dock if devfs is used. -+ */ -+ -+static struct miscdevice au1xxx_dock_dev = { -+ minor: 23, -+ name: "dock", -+ fops: &au1xxx_dock_fops, -+}; -+ -+static int __init au1xxx_dock_init(void) -+{ -+ struct au1xxx_dock *dock = &dock_info; -+ int ret; -+ -+ DPRINTK("Initializing dock driver\n"); -+ dock->open_count = 0; -+ cleanup_flag = 0; -+ init_waitqueue_head(&dock->read_wait); -+ -+ -+ /* yamon configures GPIO pins for the dock -+ * no initialization needed -+ */ -+ -+ ret = misc_register(&au1xxx_dock_dev); -+ -+ DPRINTK("dock driver fully initialized.\n"); -+ -+ return ret; -+} -+ -+ -+static void __exit au1xxx_dock_exit(void) -+{ -+ DPRINTK("unloading dock driver\n"); -+ misc_deregister(&au1xxx_dock_dev); -+} -+ -+ -+module_init(au1xxx_dock_init); -+module_exit(au1xxx_dock_exit); -diff -Nur linux-2.4.30/arch/mips/au1000/ficmmp/board_setup.c linux-2.4.30-mips/arch/mips/au1000/ficmmp/board_setup.c ---- linux-2.4.30/arch/mips/au1000/ficmmp/board_setup.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/ficmmp/board_setup.c 2005-03-19 08:17:51.000000000 +0100 -@@ -0,0 +1,226 @@ -+/* -+ * -+ * BRIEF MODULE DESCRIPTION -+ * Alchemy Pb1200 board setup. -+ * -+ * 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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED -+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN -+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ * 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 -+ -+#if defined(CONFIG_BLK_DEV_IDE_AU1XXX) -+#include -+#endif -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+extern struct rtc_ops no_rtc_ops; -+ -+/* value currently in the board configuration register */ -+u16 ficmmp_config = 0; -+ -+#if defined(CONFIG_BLK_DEV_IDE_AU1XXX) -+extern struct ide_ops *ide_ops; -+extern struct ide_ops au1xxx_ide_ops; -+extern u32 au1xxx_ide_virtbase; -+extern u64 au1xxx_ide_physbase; -+extern int au1xxx_ide_irq; -+ -+u32 led_base_addr; -+/* Ddma */ -+chan_tab_t *ide_read_ch, *ide_write_ch; -+u32 au1xxx_ide_ddma_enable = 0, switch4ddma = 1; // PIO+ddma -+ -+dbdev_tab_t new_dbdev_tab_element = { DSCR_CMD0_THROTTLE, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }; -+#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX */ -+ -+void board_reset (void) -+{ -+ au_writel(0, 0xAD80001C); -+} -+ -+void board_power_off (void) -+{ -+} -+ -+void __init board_setup(void) -+{ -+ char *argptr = NULL; -+ u32 pin_func; -+ rtc_ops = &no_rtc_ops; -+ -+ ficmmp_config_init(); //Initialize FIC control register -+ -+#if 0 -+ /* Enable PSC1 SYNC for AC97. Normaly done in audio driver, -+ * but it is board specific code, so put it here. -+ */ -+ pin_func = au_readl(SYS_PINFUNC); -+ au_sync(); -+ pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1; -+ au_writel(pin_func, SYS_PINFUNC); -+ -+ au_writel(0, (u32)bcsr|0x10); /* turn off pcmcia power */ -+ au_sync(); -+#endif -+ -+#if defined( CONFIG_I2C_ALGO_AU1550 ) -+ { -+ u32 freq0, clksrc; -+ -+ /* Select SMBUS in CPLD */ -+ /* bcsr->resets &= ~(BCSR_RESETS_PCS0MUX); */ -+ -+ pin_func = au_readl(SYS_PINFUNC); -+ au_sync(); -+ pin_func &= ~(3<<17 | 1<<4); -+ /* Set GPIOs correctly */ -+ pin_func |= 2<<17; -+ au_writel(pin_func, SYS_PINFUNC); -+ au_sync(); -+ -+ /* The i2c driver depends on 50Mhz clock */ -+ freq0 = au_readl(SYS_FREQCTRL0); -+ au_sync(); -+ freq0 &= ~(SYS_FC_FRDIV1_MASK | SYS_FC_FS1 | SYS_FC_FE1); -+ freq0 |= (3<resets bit 12: 0=SMB 1=SPI -+ */ -+#if defined(CONFIG_AU1550_PSC_SPI) && defined(CONFIG_I2C_ALGO_AU1550) -+ #error I2C and SPI are mutually exclusive. Both are physically connected to PSC0.\ -+ Refer to Pb1200 documentation. -+#elif defined( CONFIG_AU1550_PSC_SPI ) -+ //bcsr->resets |= BCSR_RESETS_PCS0MUX; -+#elif defined( CONFIG_I2C_ALGO_AU1550 ) -+ //bcsr->resets &= (~BCSR_RESETS_PCS0MUX); -+#endif -+ au_sync(); -+ -+ printk("FIC Multimedia Player Board\n"); -+ au1xxx_gpio_tristate(5); -+ printk("B1900100: %X\n", *((volatile u32*)0xB1900100)); -+ printk("B190002C: %X\n", *((volatile u32*)0xB190002C)); -+} -+ -+int -+board_au1200fb_panel (void) -+{ -+ au1xxx_gpio_tristate(6); -+ -+ if (au1xxx_gpio_read(12) == 0) -+ return 9; /* FS453_640x480 (Composite/S-Video) */ -+ else -+ return 7; /* Sharp 320x240 TFT */ -+} -+ -+int -+board_au1200fb_panel_init (void) -+{ -+ /*Enable data buffers*/ -+ ficmmp_config_clear(FICMMP_CONFIG_LCMDATAOUT); -+ /*Take LCD out of reset*/ -+ ficmmp_config_set(FICMMP_CONFIG_LCMPWREN | FICMMP_CONFIG_LCMEN); -+ return 0; -+} -+ -+int -+board_au1200fb_panel_shutdown (void) -+{ -+ /*Disable data buffers*/ -+ ficmmp_config_set(FICMMP_CONFIG_LCMDATAOUT); -+ /*Put LCD in reset, remove power*/ -+ ficmmp_config_clear(FICMMP_CONFIG_LCMEN | FICMMP_CONFIG_LCMPWREN); -+ return 0; -+} -+ -diff -Nur linux-2.4.30/arch/mips/au1000/ficmmp/init.c linux-2.4.30-mips/arch/mips/au1000/ficmmp/init.c ---- linux-2.4.30/arch/mips/au1000/ficmmp/init.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/ficmmp/init.c 2005-01-30 09:01:27.000000000 +0100 -@@ -0,0 +1,76 @@ -+/* -+ * -+ * BRIEF MODULE DESCRIPTION -+ * PB1200 board setup -+ * -+ * 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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED -+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN -+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ * 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 -+ -+int prom_argc; -+char **prom_argv, **prom_envp; -+extern void __init prom_init_cmdline(void); -+extern char *prom_getenv(char *envname); -+ -+const char *get_system_type(void) -+{ -+ return "FIC Multimedia Player (Au1200)"; -+} -+ -+u32 mae_memsize = 0; -+ -+int __init prom_init(int argc, char **argv, char **envp, int *prom_vec) -+{ -+ unsigned char *memsize_str; -+ unsigned long memsize; -+ -+ prom_argc = argc; -+ prom_argv = argv; -+ prom_envp = envp; -+ -+ mips_machgroup = MACH_GROUP_ALCHEMY; -+ mips_machtype = MACH_PB1000; /* set the platform # */ -+ prom_init_cmdline(); -+ -+ memsize_str = prom_getenv("memsize"); -+ if (!memsize_str) { -+ memsize = 0x08000000; -+ } else { -+ memsize = simple_strtol(memsize_str, NULL, 0); -+ } -+ -+ /* reserved 32MB for MAE driver */ -+ memsize -= (32 * 1024 * 1024); -+ add_memory_region(0, memsize, BOOT_MEM_RAM); -+ mae_memsize = memsize; /* for drivers/char/au1xxx_mae.c */ -+ return 0; -+} -+ -diff -Nur linux-2.4.30/arch/mips/au1000/ficmmp/irqmap.c linux-2.4.30-mips/arch/mips/au1000/ficmmp/irqmap.c ---- linux-2.4.30/arch/mips/au1000/ficmmp/irqmap.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/ficmmp/irqmap.c 2005-01-30 09:01:27.000000000 +0100 -@@ -0,0 +1,61 @@ -+/* -+ * BRIEF MODULE DESCRIPTION -+ * Au1xxx irq map table -+ * -+ * 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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED -+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN -+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ * 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 -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+au1xxx_irq_map_t au1xxx_irq_map[] = { -+ { FICMMP_IDE_INT, INTC_INT_HIGH_LEVEL, 0 }, -+ { AU1XXX_SMC91111_IRQ, INTC_INT_HIGH_LEVEL, 0 }, -+ { AU1000_GPIO_1 , INTC_INT_FALL_EDGE, 0 }, // main button -+ { AU1000_GPIO_6 , INTC_INT_RISE_EDGE, 0 }, // select button -+ { AU1000_GPIO_12, INTC_INT_FALL_EDGE, 0 }, // guide button -+ { AU1000_GPIO_17, INTC_INT_RISE_EDGE, 0 }, // down button -+ { AU1000_GPIO_19, INTC_INT_RISE_EDGE, 0 }, // left button -+ { AU1000_GPIO_26, INTC_INT_RISE_EDGE, 0 }, // right button -+ { AU1000_GPIO_28, INTC_INT_RISE_EDGE, 0 }, // up button -+}; -+ -+int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t); -+ -diff -Nur linux-2.4.30/arch/mips/au1000/hydrogen3/Makefile linux-2.4.30-mips/arch/mips/au1000/hydrogen3/Makefile ---- linux-2.4.30/arch/mips/au1000/hydrogen3/Makefile 2005-01-19 15:09:26.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/hydrogen3/Makefile 2005-02-11 22:09:55.000000000 +0100 -@@ -14,6 +14,11 @@ - - O_TARGET := hydrogen3.o - --obj-y := init.o board_setup.o irqmap.o -+obj-y := init.o board_setup.o irqmap.o buttons.o -+ -+ifdef CONFIG_MMC -+obj-y += mmc_support.o -+export-objs +=mmc_support.o -+endif - - include $(TOPDIR)/Rules.make -diff -Nur linux-2.4.30/arch/mips/au1000/hydrogen3/board_setup.c linux-2.4.30-mips/arch/mips/au1000/hydrogen3/board_setup.c ---- linux-2.4.30/arch/mips/au1000/hydrogen3/board_setup.c 2005-01-19 15:09:26.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/hydrogen3/board_setup.c 2005-03-19 08:17:51.000000000 +0100 -@@ -51,12 +51,19 @@ - { - } - -+void board_power_off (void) -+{ -+} -+ - void __init board_setup(void) - { - u32 pin_func; - - rtc_ops = &no_rtc_ops; - -+ /* Set GPIO14 high to make CD/DAT1 high for MMC to work */ -+ au_writel(1<<14, SYS_OUTPUTSET); -+ - #ifdef CONFIG_AU1X00_USB_DEVICE - // 2nd USB port is USB device - pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8000); -diff -Nur linux-2.4.30/arch/mips/au1000/hydrogen3/buttons.c linux-2.4.30-mips/arch/mips/au1000/hydrogen3/buttons.c ---- linux-2.4.30/arch/mips/au1000/hydrogen3/buttons.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/hydrogen3/buttons.c 2005-02-11 22:09:55.000000000 +0100 -@@ -0,0 +1,308 @@ -+/* -+ * Copyright (C) 2003 Metrowerks, 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 version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define BUTTON_SELECT (1<<1) -+#define BUTTON_1 (1<<2) -+#define BUTTON_2 (1<<3) -+#define BUTTON_ONOFF (1<<6) -+#define BUTTON_3 (1<<7) -+#define BUTTON_4 (1<<8) -+#define BUTTON_LEFT (1<<9) -+#define BUTTON_DOWN (1<<10) -+#define BUTTON_RIGHT (1<<11) -+#define BUTTON_UP (1<<12) -+ -+#define BUTTON_MASK (\ -+ BUTTON_SELECT \ -+ | BUTTON_1 \ -+ | BUTTON_2 \ -+ | BUTTON_ONOFF \ -+ | BUTTON_3 \ -+ | BUTTON_4 \ -+ | BUTTON_LEFT \ -+ | BUTTON_DOWN \ -+ | BUTTON_RIGHT \ -+ | BUTTON_UP \ -+ ) -+ -+#define BUTTON_INVERT (\ -+ BUTTON_SELECT \ -+ | BUTTON_1 \ -+ | BUTTON_2 \ -+ | BUTTON_3 \ -+ | BUTTON_4 \ -+ | BUTTON_LEFT \ -+ | BUTTON_DOWN \ -+ | BUTTON_RIGHT \ -+ | BUTTON_UP \ -+ ) -+ -+ -+ -+#define MAKE_FLAG 0x20 -+ -+#undef DEBUG -+ -+#define DEBUG 0 -+//#define DEBUG 1 -+ -+#if DEBUG -+#define DPRINTK(format, args...) printk(__FUNCTION__ ": " format, ## args) -+#else -+#define DPRINTK(format, args...) do { } while (0) -+#endif -+ -+/* Please note that this driver is based on a timer and is not interrupt -+ * driven. If you are going to make use of this driver, you will need to have -+ * your application open the buttons listing from the /dev directory first. -+ */ -+ -+struct hydrogen3_buttons { -+ struct fasync_struct *fasync; -+ wait_queue_head_t read_wait; -+ int open_count; -+ unsigned int debounce; -+ unsigned int current; -+ unsigned int last; -+}; -+ -+static struct hydrogen3_buttons buttons_info; -+ -+ -+static void button_timer_periodic(void *data); -+ -+static struct tq_struct button_task = { -+ routine: button_timer_periodic, -+ data: NULL -+}; -+ -+static int cleanup_flag = 0; -+static DECLARE_WAIT_QUEUE_HEAD(cleanup_wait_queue); -+ -+ -+static unsigned int read_button_state(void) -+{ -+ unsigned long state; -+ -+ state = inl(SYS_PINSTATERD) & BUTTON_MASK; -+ state ^= BUTTON_INVERT; -+ -+ DPRINTK( "Current Button State: %d\n", state ); -+ -+ return state; -+} -+ -+ -+static void button_timer_periodic(void *data) -+{ -+ struct hydrogen3_buttons *buttons = (struct hydrogen3_buttons *)data; -+ unsigned long button_state; -+ -+ // If cleanup wants us to die -+ if (cleanup_flag) { -+ wake_up(&cleanup_wait_queue); // now cleanup_module can return -+ } else { -+ queue_task(&button_task, &tq_timer); // put ourselves back in the task queue -+ } -+ -+ // read current buttons -+ button_state = read_button_state(); -+ -+ // if no buttons are down and nothing to do then -+ // save time and be done. -+ if ((button_state == 0) && (buttons->current == 0)) { -+ return; -+ } -+ -+ if (button_state == buttons->debounce) { -+ buttons->current = button_state; -+ } else { -+ buttons->debounce = button_state; -+ } -+// printk("0x%04x\n", button_state); -+ if (buttons->current != buttons->last) { -+ if (waitqueue_active(&buttons->read_wait)) { -+ wake_up_interruptible(&buttons->read_wait); -+ } -+ } -+} -+ -+ -+static ssize_t hydrogen3_buttons_read(struct file *filp, char *buffer, size_t count, loff_t *ppos) -+{ -+ struct hydrogen3_buttons *buttons = filp->private_data; -+ char events[16]; -+ int index; -+ int last; -+ int cur; -+ int bit; -+ int bit_mask; -+ int err; -+ -+ DPRINTK("start\n"); -+ -+try_again: -+ -+ while (buttons->current == buttons->last) { -+ if (filp->f_flags & O_NONBLOCK) { -+ return -EAGAIN; -+ } -+ interruptible_sleep_on(&buttons->read_wait); -+ if (signal_pending(current)) { -+ return -ERESTARTSYS; -+ } -+ } -+ -+ cur = buttons->current; -+ last = buttons->last; -+ -+ index = 0; -+ bit_mask = 1; -+ for (bit = 0; (bit < 16) && count; bit++) { -+ if ((cur ^ last) & bit_mask) { -+ if (cur & bit_mask) { -+ events[index] = (bit | MAKE_FLAG) + 'A'; -+ last |= bit_mask; -+ } else { -+ events[index] = bit + 'A'; -+ last &= ~bit_mask; -+ } -+ index++; -+ count--; -+ } -+ bit_mask <<= 1; -+ } -+ buttons->last = last; -+ -+ if (index == 0) { -+ goto try_again; -+ } -+ -+ err = copy_to_user(buffer, events, index); -+ if (err) { -+ return err; -+ } -+ -+ return index; -+} -+ -+ -+static int hydrogen3_buttons_open(struct inode *inode, struct file *filp) -+{ -+ struct hydrogen3_buttons *buttons = &buttons_info; -+ -+ DPRINTK("start\n"); -+ MOD_INC_USE_COUNT; -+ -+ filp->private_data = buttons; -+ -+ if (buttons->open_count++ == 0) { -+ button_task.data = buttons; -+ cleanup_flag = 0; -+ queue_task(&button_task, &tq_timer); -+ } -+ -+ return 0; -+} -+ -+ -+static unsigned int hydrogen3_buttons_poll(struct file *filp, poll_table *wait) -+{ -+ struct hydrogen3_buttons *buttons = filp->private_data; -+ int ret = 0; -+ -+ DPRINTK("start\n"); -+ poll_wait(filp, &buttons->read_wait, wait); -+ if (buttons->current != buttons->last) { -+ ret = POLLIN | POLLRDNORM; -+ } -+ return ret; -+} -+ -+ -+static int hydrogen3_buttons_release(struct inode *inode, struct file *filp) -+{ -+ struct hydrogen3_buttons *buttons = filp->private_data; -+ -+ DPRINTK("start\n"); -+ -+ if (--buttons->open_count == 0) { -+ cleanup_flag = 1; -+ sleep_on(&cleanup_wait_queue); -+ } -+ MOD_DEC_USE_COUNT; -+ -+ return 0; -+} -+ -+ -+ -+static struct file_operations hydrogen3_buttons_fops = { -+ owner: THIS_MODULE, -+ read: hydrogen3_buttons_read, -+ poll: hydrogen3_buttons_poll, -+ open: hydrogen3_buttons_open, -+ release: hydrogen3_buttons_release, -+}; -+ -+/* -+ * The hydrogen3 buttons is a misc device: -+ * Major 10 char -+ * Minor 22 /dev/buttons -+ * -+ * This is /dev/misc/buttons if devfs is used. -+ */ -+ -+static struct miscdevice hydrogen3_buttons_dev = { -+ minor: 22, -+ name: "buttons", -+ fops: &hydrogen3_buttons_fops, -+}; -+ -+static int __init hydrogen3_buttons_init(void) -+{ -+ struct hydrogen3_buttons *buttons = &buttons_info; -+ int ret; -+ -+ DPRINTK("Initializing buttons driver\n"); -+ buttons->open_count = 0; -+ cleanup_flag = 0; -+ init_waitqueue_head(&buttons->read_wait); -+ -+ -+ // yamon configures GPIO pins for the buttons -+ // no initialization needed -+ -+ ret = misc_register(&hydrogen3_buttons_dev); -+ -+ DPRINTK("Buttons driver fully initialized.\n"); -+ -+ return ret; -+} -+ -+ -+static void __exit hydrogen3_buttons_exit(void) -+{ -+ DPRINTK("unloading buttons driver\n"); -+ misc_deregister(&hydrogen3_buttons_dev); -+} -+ -+ -+module_init(hydrogen3_buttons_init); -+module_exit(hydrogen3_buttons_exit); -diff -Nur linux-2.4.30/arch/mips/au1000/hydrogen3/mmc_support.c linux-2.4.30-mips/arch/mips/au1000/hydrogen3/mmc_support.c ---- linux-2.4.30/arch/mips/au1000/hydrogen3/mmc_support.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/hydrogen3/mmc_support.c 2005-02-02 05:27:06.000000000 +0100 -@@ -0,0 +1,89 @@ -+/* -+ * BRIEF MODULE DESCRIPTION -+ * -+ * MMC support routines for Hydrogen3. -+ * -+ * -+ * Copyright (c) 2003-2004 Embedded Edge, LLC. -+ * Author: Embedded Edge, LLC. -+ * Contact: dan@embeddededge.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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED -+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN -+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ * 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 -+ -+#define GPIO_17_WP 0x20000 -+ -+/* SD/MMC controller support functions */ -+ -+/* -+ * Detect card. -+ */ -+void mmc_card_inserted(int _n_, int *_res_) -+{ -+ u32 gpios = au_readl(SYS_PINSTATERD); -+ u32 emptybit = (1<<16); -+ *_res_ = ((gpios & emptybit) == 0); -+} -+ -+/* -+ * Check card write protection. -+ */ -+void mmc_card_writable(int _n_, int *_res_) -+{ -+ unsigned long mmc_wp, board_specific; -+ board_specific = au_readl(SYS_OUTPUTSET); -+ mmc_wp=GPIO_17_WP; -+ if (!(board_specific & mmc_wp)) {/* low means card writable */ -+ *_res_ = 1; -+ } else { -+ *_res_ = 0; -+ } -+} -+/* -+ * Apply power to card slot. -+ */ -+void mmc_power_on(int _n_) -+{ -+} -+ -+/* -+ * Remove power from card slot. -+ */ -+void mmc_power_off(int _n_) -+{ -+} -+ -+EXPORT_SYMBOL(mmc_card_inserted); -+EXPORT_SYMBOL(mmc_card_writable); -+EXPORT_SYMBOL(mmc_power_on); -+EXPORT_SYMBOL(mmc_power_off); -+ -diff -Nur linux-2.4.30/arch/mips/au1000/mtx-1/board_setup.c linux-2.4.30-mips/arch/mips/au1000/mtx-1/board_setup.c ---- linux-2.4.30/arch/mips/au1000/mtx-1/board_setup.c 2004-02-18 14:36:30.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/mtx-1/board_setup.c 2004-11-26 09:37:16.000000000 +0100 -@@ -48,6 +48,12 @@ - - extern struct rtc_ops no_rtc_ops; - -+void board_reset (void) -+{ -+ /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ -+ au_writel(0x00000000, 0xAE00001C); -+} -+ - void __init board_setup(void) - { - rtc_ops = &no_rtc_ops; -diff -Nur linux-2.4.30/arch/mips/au1000/mtx-1/irqmap.c linux-2.4.30-mips/arch/mips/au1000/mtx-1/irqmap.c ---- linux-2.4.30/arch/mips/au1000/mtx-1/irqmap.c 2005-01-19 15:09:26.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/mtx-1/irqmap.c 2004-11-26 09:37:16.000000000 +0100 -@@ -72,10 +72,10 @@ - * A B C D - */ - { -- {INTA, INTB, INTC, INTD}, /* IDSEL 0 */ -- {INTA, INTB, INTC, INTD}, /* IDSEL 1 */ -- {INTA, INTB, INTC, INTD}, /* IDSEL 2 */ -- {INTA, INTB, INTC, INTD}, /* IDSEL 3 */ -+ {INTA, INTB, INTX, INTX}, /* IDSEL 0 */ -+ {INTB, INTA, INTX, INTX}, /* IDSEL 1 */ -+ {INTC, INTD, INTX, INTX}, /* IDSEL 2 */ -+ {INTD, INTC, INTX, INTX}, /* IDSEL 3 */ - }; - const long min_idsel = 0, max_idsel = 3, irqs_per_slot = 4; - return PCI_IRQ_TABLE_LOOKUP; -diff -Nur linux-2.4.30/arch/mips/au1000/pb1000/board_setup.c linux-2.4.30-mips/arch/mips/au1000/pb1000/board_setup.c ---- linux-2.4.30/arch/mips/au1000/pb1000/board_setup.c 2005-01-19 15:09:26.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/pb1000/board_setup.c 2005-03-19 08:17:51.000000000 +0100 -@@ -58,6 +58,10 @@ - { - } - -+void board_power_off (void) -+{ -+} -+ - void __init board_setup(void) - { - u32 pin_func, static_cfg0; -diff -Nur linux-2.4.30/arch/mips/au1000/pb1100/Makefile linux-2.4.30-mips/arch/mips/au1000/pb1100/Makefile ---- linux-2.4.30/arch/mips/au1000/pb1100/Makefile 2003-08-25 13:44:39.000000000 +0200 -+++ linux-2.4.30-mips/arch/mips/au1000/pb1100/Makefile 2005-01-30 09:10:29.000000000 +0100 -@@ -16,4 +16,10 @@ - - obj-y := init.o board_setup.o irqmap.o - -+ -+ifdef CONFIG_MMC -+obj-y += mmc_support.o -+export-objs += mmc_support.o -+endif -+ - include $(TOPDIR)/Rules.make -diff -Nur linux-2.4.30/arch/mips/au1000/pb1100/board_setup.c linux-2.4.30-mips/arch/mips/au1000/pb1100/board_setup.c ---- linux-2.4.30/arch/mips/au1000/pb1100/board_setup.c 2005-01-19 15:09:26.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/pb1100/board_setup.c 2005-03-19 08:17:51.000000000 +0100 -@@ -62,6 +62,10 @@ - au_writel(0x00000000, 0xAE00001C); - } - -+void board_power_off (void) -+{ -+} -+ - void __init board_setup(void) - { - u32 pin_func; -diff -Nur linux-2.4.30/arch/mips/au1000/pb1100/mmc_support.c linux-2.4.30-mips/arch/mips/au1000/pb1100/mmc_support.c ---- linux-2.4.30/arch/mips/au1000/pb1100/mmc_support.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/pb1100/mmc_support.c 2005-01-30 09:10:29.000000000 +0100 -@@ -0,0 +1,126 @@ -+/* -+ * BRIEF MODULE DESCRIPTION -+ * -+ * MMC support routines for PB1100. -+ * -+ * -+ * Copyright (c) 2003-2004 Embedded Edge, LLC. -+ * Author: Embedded Edge, LLC. -+ * Contact: dan@embeddededge.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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED -+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN -+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ * 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 -+ -+ -+/* SD/MMC controller support functions */ -+ -+/* -+ * Detect card. -+ */ -+void mmc_card_inserted(int _n_, int *_res_) -+{ -+ u32 gpios = au_readl(SYS_PINSTATERD); -+ u32 emptybit = (_n_) ? (1<<15) : (1<<14); -+ *_res_ = ((gpios & emptybit) == 0); -+} -+ -+/* -+ * Check card write protection. -+ */ -+void mmc_card_writable(int _n_, int *_res_) -+{ -+ BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR; -+ unsigned long mmc_wp, board_specific; -+ -+ if (_n_) { -+ mmc_wp = BCSR_PCMCIA_SD1_WP; -+ } else { -+ mmc_wp = BCSR_PCMCIA_SD0_WP; -+ } -+ -+ board_specific = au_readl((unsigned long)(&bcsr->pcmcia)); -+ -+ if (!(board_specific & mmc_wp)) {/* low means card writable */ -+ *_res_ = 1; -+ } else { -+ *_res_ = 0; -+ } -+} -+ -+/* -+ * Apply power to card slot. -+ */ -+void mmc_power_on(int _n_) -+{ -+ BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR; -+ unsigned long mmc_pwr, board_specific; -+ -+ if (_n_) { -+ mmc_pwr = BCSR_PCMCIA_SD1_PWR; -+ } else { -+ mmc_pwr = BCSR_PCMCIA_SD0_PWR; -+ } -+ -+ board_specific = au_readl((unsigned long)(&bcsr->pcmcia)); -+ board_specific |= mmc_pwr; -+ -+ au_writel(board_specific, (int)(&bcsr->pcmcia)); -+ au_sync_delay(1); -+} -+ -+/* -+ * Remove power from card slot. -+ */ -+void mmc_power_off(int _n_) -+{ -+ BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR; -+ unsigned long mmc_pwr, board_specific; -+ -+ if (_n_) { -+ mmc_pwr = BCSR_PCMCIA_SD1_PWR; -+ } else { -+ mmc_pwr = BCSR_PCMCIA_SD0_PWR; -+ } -+ -+ board_specific = au_readl((unsigned long)(&bcsr->pcmcia)); -+ board_specific &= ~mmc_pwr; -+ -+ au_writel(board_specific, (int)(&bcsr->pcmcia)); -+ au_sync_delay(1); -+} -+ -+EXPORT_SYMBOL(mmc_card_inserted); -+EXPORT_SYMBOL(mmc_card_writable); -+EXPORT_SYMBOL(mmc_power_on); -+EXPORT_SYMBOL(mmc_power_off); -+ -diff -Nur linux-2.4.30/arch/mips/au1000/pb1200/Makefile linux-2.4.30-mips/arch/mips/au1000/pb1200/Makefile ---- linux-2.4.30/arch/mips/au1000/pb1200/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/pb1200/Makefile 2005-01-30 09:01:27.000000000 +0100 -@@ -0,0 +1,25 @@ -+# -+# Copyright 2000 MontaVista Software Inc. -+# Author: MontaVista Software, Inc. -+# ppopov@mvista.com or source@mvista.com -+# -+# Makefile for the Alchemy Semiconductor PB1000 board. -+# -+# Note! Dependencies are done automagically by 'make dep', which also -+# removes any old dependencies. DON'T put your own dependencies here -+# unless it's something special (ie not a .c file). -+# -+ -+USE_STANDARD_AS_RULE := true -+ -+O_TARGET := pb1200.o -+ -+obj-y := init.o board_setup.o irqmap.o -+ -+ifdef CONFIG_MMC -+obj-y += mmc_support.o -+export-objs +=mmc_support.o -+endif -+ -+ -+include $(TOPDIR)/Rules.make -diff -Nur linux-2.4.30/arch/mips/au1000/pb1200/board_setup.c linux-2.4.30-mips/arch/mips/au1000/pb1200/board_setup.c ---- linux-2.4.30/arch/mips/au1000/pb1200/board_setup.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/pb1200/board_setup.c 2005-03-19 08:17:51.000000000 +0100 -@@ -0,0 +1,221 @@ -+/* -+ * -+ * BRIEF MODULE DESCRIPTION -+ * Alchemy Pb1200 board setup. -+ * -+ * 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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED -+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN -+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ * 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 -+ -+#if defined(CONFIG_BLK_DEV_IDE_AU1XXX) -+#include -+#endif -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#ifdef CONFIG_MIPS_PB1200 -+#include -+#endif -+ -+#ifdef CONFIG_MIPS_DB1200 -+#include -+#define PB1200_ETH_INT DB1200_ETH_INT -+#define PB1200_IDE_INT DB1200_IDE_INT -+#endif -+ -+extern struct rtc_ops no_rtc_ops; -+ -+extern void _board_init_irq(void); -+extern void (*board_init_irq)(void); -+ -+#ifdef CONFIG_BLK_DEV_IDE_AU1XXX -+extern struct ide_ops *ide_ops; -+extern struct ide_ops au1xxx_ide_ops; -+extern u32 au1xxx_ide_virtbase; -+extern u64 au1xxx_ide_physbase; -+extern int au1xxx_ide_irq; -+ -+u32 led_base_addr; -+/* Ddma */ -+chan_tab_t *ide_read_ch, *ide_write_ch; -+u32 au1xxx_ide_ddma_enable = 0, switch4ddma = 1; // PIO+ddma -+ -+dbdev_tab_t new_dbdev_tab_element = { DSCR_CMD0_THROTTLE, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 }; -+#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX */ -+ -+void board_reset (void) -+{ -+ bcsr->resets = 0; -+} -+ -+void board_power_off (void) -+{ -+ bcsr->resets = 0xC000; -+} -+ -+void __init board_setup(void) -+{ -+ char *argptr = NULL; -+ u32 pin_func; -+ rtc_ops = &no_rtc_ops; -+ -+#if 0 -+ /* Enable PSC1 SYNC for AC97. Normaly done in audio driver, -+ * but it is board specific code, so put it here. -+ */ -+ pin_func = au_readl(SYS_PINFUNC); -+ au_sync(); -+ pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1; -+ au_writel(pin_func, SYS_PINFUNC); -+ -+ au_writel(0, (u32)bcsr|0x10); /* turn off pcmcia power */ -+ au_sync(); -+#endif -+ -+#if defined( CONFIG_I2C_ALGO_AU1550 ) -+ { -+ u32 freq0, clksrc; -+ -+ /* Select SMBUS in CPLD */ -+ bcsr->resets &= ~(BCSR_RESETS_PCS0MUX); -+ -+ pin_func = au_readl(SYS_PINFUNC); -+ au_sync(); -+ pin_func &= ~(3<<17 | 1<<4); -+ /* Set GPIOs correctly */ -+ pin_func |= 2<<17; -+ au_writel(pin_func, SYS_PINFUNC); -+ au_sync(); -+ -+ /* The i2c driver depends on 50Mhz clock */ -+ freq0 = au_readl(SYS_FREQCTRL0); -+ au_sync(); -+ freq0 &= ~(SYS_FC_FRDIV1_MASK | SYS_FC_FS1 | SYS_FC_FE1); -+ freq0 |= (3<resets bit 12: 0=SMB 1=SPI -+ */ -+#if defined(CONFIG_AU1550_PSC_SPI) && defined(CONFIG_I2C_ALGO_AU1550) -+ #error I2C and SPI are mutually exclusive. Both are physically connected to PSC0.\ -+ Refer to Pb1200/Db1200 documentation. -+#elif defined( CONFIG_AU1550_PSC_SPI ) -+ bcsr->resets |= BCSR_RESETS_PCS0MUX; -+#elif defined( CONFIG_I2C_ALGO_AU1550 ) -+ bcsr->resets &= (~BCSR_RESETS_PCS0MUX); -+#endif -+ au_sync(); -+ -+#ifdef CONFIG_MIPS_PB1200 -+ printk("AMD Alchemy Pb1200 Board\n"); -+#endif -+#ifdef CONFIG_MIPS_DB1200 -+ printk("AMD Alchemy Db1200 Board\n"); -+#endif -+ -+ /* Setup Pb1200 External Interrupt Controller */ -+ { -+ extern void (*board_init_irq)(void); -+ extern void _board_init_irq(void); -+ board_init_irq = _board_init_irq; -+ } -+} -+ -+int -+board_au1200fb_panel (void) -+{ -+ BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR; -+ int p; -+ -+ p = bcsr->switches; -+ p >>= 8; -+ p &= 0x0F; -+ return p; -+} -+ -+int -+board_au1200fb_panel_init (void) -+{ -+ /* Apply power */ -+ BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR; -+ bcsr->board |= (BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD | BCSR_BOARD_LCDBL); -+ return 0; -+} -+ -+int -+board_au1200fb_panel_shutdown (void) -+{ -+ /* Remove power */ -+ BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR; -+ bcsr->board &= ~(BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD | BCSR_BOARD_LCDBL); -+ return 0; -+} -+ -diff -Nur linux-2.4.30/arch/mips/au1000/pb1200/init.c linux-2.4.30-mips/arch/mips/au1000/pb1200/init.c ---- linux-2.4.30/arch/mips/au1000/pb1200/init.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/pb1200/init.c 2005-01-30 09:01:28.000000000 +0100 -@@ -0,0 +1,72 @@ -+/* -+ * -+ * BRIEF MODULE DESCRIPTION -+ * PB1200 board setup -+ * -+ * 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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED -+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN -+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ * 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 -+ -+int prom_argc; -+char **prom_argv, **prom_envp; -+extern void __init prom_init_cmdline(void); -+extern char *prom_getenv(char *envname); -+ -+const char *get_system_type(void) -+{ -+ return "AMD Alchemy Au1200/Pb1200"; -+} -+ -+u32 mae_memsize = 0; -+ -+int __init prom_init(int argc, char **argv, char **envp, int *prom_vec) -+{ -+ unsigned char *memsize_str; -+ unsigned long memsize; -+ -+ prom_argc = argc; -+ prom_argv = argv; -+ prom_envp = envp; -+ -+ mips_machgroup = MACH_GROUP_ALCHEMY; -+ mips_machtype = MACH_PB1000; /* set the platform # */ -+ prom_init_cmdline(); -+ -+ memsize_str = prom_getenv("memsize"); -+ if (!memsize_str) { -+ memsize = 0x08000000; -+ } else { -+ memsize = simple_strtol(memsize_str, NULL, 0); -+ } -+ add_memory_region(0, memsize, BOOT_MEM_RAM); -+ return 0; -+} -+ -diff -Nur linux-2.4.30/arch/mips/au1000/pb1200/irqmap.c linux-2.4.30-mips/arch/mips/au1000/pb1200/irqmap.c ---- linux-2.4.30/arch/mips/au1000/pb1200/irqmap.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/pb1200/irqmap.c 2005-01-30 09:01:28.000000000 +0100 -@@ -0,0 +1,180 @@ -+/* -+ * BRIEF MODULE DESCRIPTION -+ * Au1xxx irq map table -+ * -+ * 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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED -+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN -+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ * 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 -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#ifdef CONFIG_MIPS_PB1200 -+#include -+#endif -+ -+#ifdef CONFIG_MIPS_DB1200 -+#include -+#define PB1200_INT_BEGIN DB1200_INT_BEGIN -+#define PB1200_INT_END DB1200_INT_END -+#endif -+ -+au1xxx_irq_map_t au1xxx_irq_map[] = { -+ { AU1000_GPIO_7, INTC_INT_LOW_LEVEL, 0 }, // This is exteranl interrupt cascade -+}; -+ -+int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t); -+ -+/* -+ * Support for External interrupts on the PbAu1200 Development platform. -+ */ -+static volatile int pb1200_cascade_en=0; -+ -+void pb1200_cascade_handler( int irq, void *dev_id, struct pt_regs *regs) -+{ -+ unsigned short bisr = bcsr->int_status; -+ int extirq_nr = 0; -+ -+ /* Clear all the edge interrupts. This has no effect on level */ -+ bcsr->int_status = bisr; -+ for( ; bisr; bisr &= (bisr-1) ) -+ { -+ extirq_nr = (PB1200_INT_BEGIN-1) + au_ffs(bisr); -+ /* Ack and dispatch IRQ */ -+ do_IRQ(extirq_nr,regs); -+ } -+} -+ -+inline void pb1200_enable_irq(unsigned int irq_nr) -+{ -+ bcsr->intset_mask = 1<<(irq_nr - PB1200_INT_BEGIN); -+ bcsr->intset = 1<<(irq_nr - PB1200_INT_BEGIN); -+} -+ -+inline void pb1200_disable_irq(unsigned int irq_nr) -+{ -+ bcsr->intclr_mask = 1<<(irq_nr - PB1200_INT_BEGIN); -+ bcsr->intclr = 1<<(irq_nr - PB1200_INT_BEGIN); -+} -+ -+static unsigned int pb1200_startup_irq( unsigned int irq_nr ) -+{ -+ if (++pb1200_cascade_en == 1) -+ { -+ request_irq(AU1000_GPIO_7, &pb1200_cascade_handler, -+ 0, "Pb1200 Cascade", &pb1200_cascade_handler ); -+#ifdef CONFIG_MIPS_PB1200 -+ /* We have a problem with CPLD rev3. Enable a workaround */ -+ if( ((bcsr->whoami & BCSR_WHOAMI_CPLD)>>4) <= 3) -+ { -+ printk("\nWARNING!!!\n"); -+ printk("\nWARNING!!!\n"); -+ printk("\nWARNING!!!\n"); -+ printk("\nWARNING!!!\n"); -+ printk("\nWARNING!!!\n"); -+ printk("\nWARNING!!!\n"); -+ printk("Pb1200 must be at CPLD rev4. Please have Pb1200\n"); -+ printk("updated to latest revision. This software will not\n"); -+ printk("work on anything less than CPLD rev4\n"); -+ printk("\nWARNING!!!\n"); -+ printk("\nWARNING!!!\n"); -+ printk("\nWARNING!!!\n"); -+ printk("\nWARNING!!!\n"); -+ printk("\nWARNING!!!\n"); -+ printk("\nWARNING!!!\n"); -+ while(1); -+ } -+#endif -+ } -+ pb1200_enable_irq(irq_nr); -+ return 0; -+} -+ -+static void pb1200_shutdown_irq( unsigned int irq_nr ) -+{ -+ pb1200_disable_irq(irq_nr); -+ if (--pb1200_cascade_en == 0) -+ { -+ free_irq(AU1000_GPIO_7,&pb1200_cascade_handler ); -+ } -+ return; -+} -+ -+static inline void pb1200_mask_and_ack_irq(unsigned int irq_nr) -+{ -+ pb1200_disable_irq( irq_nr ); -+} -+ -+static void pb1200_end_irq(unsigned int irq_nr) -+{ -+ if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))) { -+ pb1200_enable_irq(irq_nr); -+ } -+} -+ -+static struct hw_interrupt_type external_irq_type = -+{ -+#ifdef CONFIG_MIPS_PB1200 -+ "Pb1200 Ext", -+#endif -+#ifdef CONFIG_MIPS_DB1200 -+ "Db1200 Ext", -+#endif -+ pb1200_startup_irq, -+ pb1200_shutdown_irq, -+ pb1200_enable_irq, -+ pb1200_disable_irq, -+ pb1200_mask_and_ack_irq, -+ pb1200_end_irq, -+ NULL -+}; -+ -+void _board_init_irq(void) -+{ -+ int irq_nr; -+ -+ for (irq_nr = PB1200_INT_BEGIN; irq_nr <= PB1200_INT_END; irq_nr++) -+ { -+ irq_desc[irq_nr].handler = &external_irq_type; -+ pb1200_disable_irq(irq_nr); -+ } -+ -+ /* GPIO_7 can not be hooked here, so it is hooked upon first -+ request of any source attached to the cascade */ -+} -+ -diff -Nur linux-2.4.30/arch/mips/au1000/pb1200/mmc_support.c linux-2.4.30-mips/arch/mips/au1000/pb1200/mmc_support.c ---- linux-2.4.30/arch/mips/au1000/pb1200/mmc_support.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/pb1200/mmc_support.c 2005-01-30 09:01:28.000000000 +0100 -@@ -0,0 +1,141 @@ -+/* -+ * BRIEF MODULE DESCRIPTION -+ * -+ * MMC support routines for PB1200. -+ * -+ * -+ * Copyright (c) 2003-2004 Embedded Edge, LLC. -+ * Author: Embedded Edge, LLC. -+ * Contact: dan@embeddededge.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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED -+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN -+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ * 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 -+ -+#ifdef CONFIG_MIPS_PB1200 -+#include -+#endif -+ -+#ifdef CONFIG_MIPS_DB1200 -+/* NOTE: DB1200 only has SD0 pinned out and usable */ -+#include -+#endif -+ -+/* SD/MMC controller support functions */ -+ -+/* -+ * Detect card. -+ */ -+void mmc_card_inserted(int socket, int *result) -+{ -+ u16 mask; -+ -+ if (socket) -+#ifdef CONFIG_MIPS_DB1200 -+ mask = 0; -+#else -+ mask = BCSR_INT_SD1INSERT; -+#endif -+ else -+ mask = BCSR_INT_SD0INSERT; -+ -+ *result = ((bcsr->sig_status & mask) != 0); -+} -+ -+/* -+ * Check card write protection. -+ */ -+void mmc_card_writable(int socket, int *result) -+{ -+ u16 mask; -+ -+ if (socket) -+#ifdef CONFIG_MIPS_DB1200 -+ mask = 0; -+#else -+ mask = BCSR_STATUS_SD1WP; -+#endif -+ else -+ mask = BCSR_STATUS_SD0WP; -+ -+ /* low means card writable */ -+ if (!(bcsr->status & mask)) { -+ *result = 1; -+ } else { -+ *result = 0; -+ } -+} -+ -+/* -+ * Apply power to card slot. -+ */ -+void mmc_power_on(int socket) -+{ -+ u16 mask; -+ -+ if (socket) -+#ifdef CONFIG_MIPS_DB1200 -+ mask = 0; -+#else -+ mask = BCSR_BOARD_SD1PWR; -+#endif -+ else -+ mask = BCSR_BOARD_SD0PWR; -+ -+ bcsr->board |= mask; -+ au_sync_delay(1); -+} -+ -+/* -+ * Remove power from card slot. -+ */ -+void mmc_power_off(int socket) -+{ -+ u16 mask; -+ -+ if (socket) -+#ifdef CONFIG_MIPS_DB1200 -+ mask = 0; -+#else -+ mask = BCSR_BOARD_SD1PWR; -+#endif -+ else -+ mask = BCSR_BOARD_SD0PWR; -+ -+ bcsr->board &= ~mask; -+ au_sync_delay(1); -+} -+ -+EXPORT_SYMBOL(mmc_card_inserted); -+EXPORT_SYMBOL(mmc_card_writable); -+EXPORT_SYMBOL(mmc_power_on); -+EXPORT_SYMBOL(mmc_power_off); -+ -diff -Nur linux-2.4.30/arch/mips/au1000/pb1500/board_setup.c linux-2.4.30-mips/arch/mips/au1000/pb1500/board_setup.c ---- linux-2.4.30/arch/mips/au1000/pb1500/board_setup.c 2005-01-19 15:09:26.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/pb1500/board_setup.c 2005-03-19 08:17:51.000000000 +0100 -@@ -62,6 +62,10 @@ - au_writel(0x00000000, 0xAE00001C); - } - -+void board_power_off (void) -+{ -+} -+ - void __init board_setup(void) - { - u32 pin_func; -diff -Nur linux-2.4.30/arch/mips/au1000/pb1550/board_setup.c linux-2.4.30-mips/arch/mips/au1000/pb1550/board_setup.c ---- linux-2.4.30/arch/mips/au1000/pb1550/board_setup.c 2005-01-19 15:09:26.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/pb1550/board_setup.c 2005-03-19 08:17:51.000000000 +0100 -@@ -48,12 +48,31 @@ - - extern struct rtc_ops no_rtc_ops; - -+#if defined(CONFIG_BLK_DEV_IDE_AU1XXX) -+extern struct ide_ops *ide_ops; -+extern struct ide_ops au1xxx_ide_ops; -+extern u32 au1xxx_ide_virtbase; -+extern u64 au1xxx_ide_physbase; -+extern unsigned int au1xxx_ide_irq; -+ -+u32 au1xxx_ide_ddma_enable = 0, switch4ddma = 1; // PIO+ddma -+#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX */ -+ - void board_reset (void) - { - /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ - au_writew(au_readw(0xAF00001C) & ~(1<<15), 0xAF00001C); - } - -+void board_power_off (void) -+{ -+ /* power off system */ -+ printk("\n** Powering off Pb1550\n"); -+ au_writew(au_readw(0xAF00001C) | (3<<14), 0xAF00001C); -+ au_sync(); -+ while(1); /* should not get here */ -+} -+ - void __init board_setup(void) - { - u32 pin_func; -@@ -78,5 +97,36 @@ - au_writel(0, (u32)bcsr|0x10); /* turn off pcmcia power */ - au_sync(); - -+#if defined(CONFIG_AU1XXX_SMC91111) -+#if defined(CONFIG_BLK_DEV_IDE_AU1XXX) -+#error "Resource conflict occured. Disable either Ethernet or IDE daughter card." -+#else -+#define CPLD_CONTROL (0xAF00000C) -+ { -+ /* set up the Static Bus timing */ -+ /* only 396Mhz */ -+ /* reset the DC */ -+ au_writew(au_readw(CPLD_CONTROL) | 0x0f, CPLD_CONTROL); -+ au_writel(0x00010003, MEM_STCFG0); -+ au_writel(0x000c00c0, MEM_STCFG2); -+ au_writel(0x85E1900D, MEM_STTIME2); -+ } -+#endif -+#endif /* end CONFIG_SMC91111 */ -+ -+#if defined(CONFIG_BLK_DEV_IDE_AU1XXX) -+ /* -+ * Iniz IDE parameters -+ */ -+ ide_ops = &au1xxx_ide_ops; -+ au1xxx_ide_irq = DAUGHTER_CARD_IRQ;; -+ au1xxx_ide_physbase = AU1XXX_ATA_PHYS_ADDR; -+ au1xxx_ide_virtbase = KSEG1ADDR(AU1XXX_ATA_PHYS_ADDR); -+ /* -+ * change PIO or PIO+Ddma -+ * check the GPIO-6 pin condition. pb1550:s15_dot -+ */ -+ switch4ddma = (au_readl(SYS_PINSTATERD) & (1 << 6)) ? 1 : 0; -+#endif - printk("AMD Alchemy Pb1550 Board\n"); - } -diff -Nur linux-2.4.30/arch/mips/au1000/pb1550/irqmap.c linux-2.4.30-mips/arch/mips/au1000/pb1550/irqmap.c ---- linux-2.4.30/arch/mips/au1000/pb1550/irqmap.c 2005-01-19 15:09:26.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/au1000/pb1550/irqmap.c 2005-01-30 09:01:28.000000000 +0100 -@@ -50,6 +50,9 @@ - au1xxx_irq_map_t au1xxx_irq_map[] = { - { AU1000_GPIO_0, INTC_INT_LOW_LEVEL, 0 }, - { AU1000_GPIO_1, INTC_INT_LOW_LEVEL, 0 }, -+#ifdef CONFIG_AU1XXX_SMC91111 -+ { AU1000_GPIO_3, INTC_INT_LOW_LEVEL, 0 }, -+#endif - }; - - int au1xxx_nr_irqs = sizeof(au1xxx_irq_map)/sizeof(au1xxx_irq_map_t); -diff -Nur linux-2.4.30/arch/mips/config-shared.in linux-2.4.30-mips/arch/mips/config-shared.in ---- linux-2.4.30/arch/mips/config-shared.in 2005-01-19 15:09:27.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/config-shared.in 2005-01-30 09:01:26.000000000 +0100 -@@ -21,16 +21,19 @@ - comment 'Machine selection' - dep_bool 'Support for Acer PICA 1 chipset (EXPERIMENTAL)' CONFIG_ACER_PICA_61 $CONFIG_EXPERIMENTAL - dep_bool 'Support for Alchemy Bosporus board' CONFIG_MIPS_BOSPORUS $CONFIG_MIPS32 -+dep_bool 'Support for FIC Multimedia Player board' CONFIG_MIPS_FICMMP $CONFIG_MIPS32 - dep_bool 'Support for Alchemy Mirage board' CONFIG_MIPS_MIRAGE $CONFIG_MIPS32 - dep_bool 'Support for Alchemy Db1000 board' CONFIG_MIPS_DB1000 $CONFIG_MIPS32 - dep_bool 'Support for Alchemy Db1100 board' CONFIG_MIPS_DB1100 $CONFIG_MIPS32 - dep_bool 'Support for Alchemy Db1500 board' CONFIG_MIPS_DB1500 $CONFIG_MIPS32 - dep_bool 'Support for Alchemy Db1550 board' CONFIG_MIPS_DB1550 $CONFIG_MIPS32 -+dep_bool 'Support for Alchemy Db1200 board' CONFIG_MIPS_DB1200 $CONFIG_MIPS32 - dep_bool 'Support for Alchemy PB1000 board' CONFIG_MIPS_PB1000 $CONFIG_MIPS32 - dep_bool 'Support for Alchemy PB1100 board' CONFIG_MIPS_PB1100 $CONFIG_MIPS32 - dep_bool 'Support for Alchemy PB1500 board' CONFIG_MIPS_PB1500 $CONFIG_MIPS32 --dep_bool 'Support for Alchemy Hydrogen3 board' CONFIG_MIPS_HYDROGEN3 $CONFIG_MIPS32 - dep_bool 'Support for Alchemy PB1550 board' CONFIG_MIPS_PB1550 $CONFIG_MIPS32 -+dep_bool 'Support for Alchemy PB1200 board' CONFIG_MIPS_PB1200 $CONFIG_MIPS32 -+dep_bool 'Support for Alchemy Hydrogen3 board' CONFIG_MIPS_HYDROGEN3 $CONFIG_MIPS32 - dep_bool 'Support for MyCable XXS1500 board' CONFIG_MIPS_XXS1500 $CONFIG_MIPS32 - dep_bool 'Support for 4G Systems MTX-1 board' CONFIG_MIPS_MTX1 $CONFIG_MIPS32 - dep_bool 'Support for Cogent CSB250 board' CONFIG_COGENT_CSB250 $CONFIG_MIPS32 -@@ -249,6 +252,12 @@ - define_bool CONFIG_PC_KEYB y - define_bool CONFIG_NONCOHERENT_IO y - fi -+if [ "$CONFIG_MIPS_FICMMP" = "y" ]; then -+ define_bool CONFIG_SOC_AU1X00 y -+ define_bool CONFIG_SOC_AU1200 y -+ define_bool CONFIG_NONCOHERENT_IO y -+ define_bool CONFIG_PC_KEYB y -+fi - if [ "$CONFIG_MIPS_BOSPORUS" = "y" ]; then - define_bool CONFIG_SOC_AU1X00 y - define_bool CONFIG_SOC_AU1500 y -@@ -263,6 +272,12 @@ - define_bool CONFIG_SWAP_IO_SPACE_W y - define_bool CONFIG_SWAP_IO_SPACE_L y - fi -+if [ "$CONFIG_MIPS_PB1500" = "y" ]; then -+ define_bool CONFIG_SOC_AU1X00 y -+ define_bool CONFIG_SOC_AU1500 y -+ define_bool CONFIG_NONCOHERENT_IO y -+ define_bool CONFIG_PC_KEYB y -+fi - if [ "$CONFIG_MIPS_PB1100" = "y" ]; then - define_bool CONFIG_SOC_AU1X00 y - define_bool CONFIG_SOC_AU1100 y -@@ -271,9 +286,15 @@ - define_bool CONFIG_SWAP_IO_SPACE_W y - define_bool CONFIG_SWAP_IO_SPACE_L y - fi --if [ "$CONFIG_MIPS_PB1500" = "y" ]; then -+if [ "$CONFIG_MIPS_PB1550" = "y" ]; then - define_bool CONFIG_SOC_AU1X00 y -- define_bool CONFIG_SOC_AU1500 y -+ define_bool CONFIG_SOC_AU1550 y -+ define_bool CONFIG_NONCOHERENT_IO n -+ define_bool CONFIG_PC_KEYB y -+fi -+if [ "$CONFIG_MIPS_PB1200" = "y" ]; then -+ define_bool CONFIG_SOC_AU1X00 y -+ define_bool CONFIG_SOC_AU1200 y - define_bool CONFIG_NONCOHERENT_IO y - define_bool CONFIG_PC_KEYB y - fi -@@ -290,18 +311,24 @@ - define_bool CONFIG_NONCOHERENT_IO y - define_bool CONFIG_PC_KEYB y - fi -+if [ "$CONFIG_MIPS_DB1100" = "y" ]; then -+ define_bool CONFIG_SOC_AU1X00 y -+ define_bool CONFIG_SOC_AU1100 y -+ define_bool CONFIG_NONCOHERENT_IO y -+ define_bool CONFIG_PC_KEYB y -+ define_bool CONFIG_SWAP_IO_SPACE y -+fi - if [ "$CONFIG_MIPS_DB1550" = "y" ]; then - define_bool CONFIG_SOC_AU1X00 y - define_bool CONFIG_SOC_AU1550 y - define_bool CONFIG_NONCOHERENT_IO y - define_bool CONFIG_PC_KEYB y - fi --if [ "$CONFIG_MIPS_DB1100" = "y" ]; then -+if [ "$CONFIG_MIPS_DB1200" = "y" ]; then - define_bool CONFIG_SOC_AU1X00 y -- define_bool CONFIG_SOC_AU1100 y -+ define_bool CONFIG_SOC_AU1200 y - define_bool CONFIG_NONCOHERENT_IO y - define_bool CONFIG_PC_KEYB y -- define_bool CONFIG_SWAP_IO_SPACE y - fi - if [ "$CONFIG_MIPS_HYDROGEN3" = "y" ]; then - define_bool CONFIG_SOC_AU1X00 y -@@ -327,12 +354,6 @@ - define_bool CONFIG_NONCOHERENT_IO y - define_bool CONFIG_PC_KEYB y - fi --if [ "$CONFIG_MIPS_PB1550" = "y" ]; then -- define_bool CONFIG_SOC_AU1X00 y -- define_bool CONFIG_SOC_AU1550 y -- define_bool CONFIG_NONCOHERENT_IO n -- define_bool CONFIG_PC_KEYB y --fi - if [ "$CONFIG_MIPS_COBALT" = "y" ]; then - define_bool CONFIG_BOOT_ELF32 y - define_bool CONFIG_COBALT_LCD y -@@ -729,6 +750,13 @@ - "$CONFIG_MIPS_PB1000" = "y" -o \ - "$CONFIG_MIPS_PB1100" = "y" -o \ - "$CONFIG_MIPS_PB1500" = "y" -o \ -+ "$CONFIG_MIPS_PB1550" = "y" -o \ -+ "$CONFIG_MIPS_PB1200" = "y" -o \ -+ "$CONFIG_MIPS_DB1000" = "y" -o \ -+ "$CONFIG_MIPS_DB1100" = "y" -o \ -+ "$CONFIG_MIPS_DB1500" = "y" -o \ -+ "$CONFIG_MIPS_DB1550" = "y" -o \ -+ "$CONFIG_MIPS_DB1200" = "y" -o \ - "$CONFIG_NEC_OSPREY" = "y" -o \ - "$CONFIG_NEC_EAGLE" = "y" -o \ - "$CONFIG_NINO" = "y" -o \ -diff -Nur linux-2.4.30/arch/mips/defconfig linux-2.4.30-mips/arch/mips/defconfig ---- linux-2.4.30/arch/mips/defconfig 2005-01-19 15:09:27.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -235,11 +235,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -319,9 +314,11 @@ - # CONFIG_SCSI_MEGARAID is not set - # CONFIG_SCSI_MEGARAID2 is not set - # CONFIG_SCSI_SATA is not set -+# CONFIG_SCSI_SATA_AHCI is not set - # CONFIG_SCSI_SATA_SVW is not set - # CONFIG_SCSI_ATA_PIIX is not set - # CONFIG_SCSI_SATA_NV is not set -+# CONFIG_SCSI_SATA_QSTOR is not set - # CONFIG_SCSI_SATA_PROMISE is not set - # CONFIG_SCSI_SATA_SX4 is not set - # CONFIG_SCSI_SATA_SIL is not set -@@ -465,7 +462,6 @@ - # CONFIG_SERIAL is not set - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-atlas linux-2.4.30-mips/arch/mips/defconfig-atlas ---- linux-2.4.30/arch/mips/defconfig-atlas 2005-01-19 15:09:27.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-atlas 2005-03-18 13:13:21.000000000 +0100 -@@ -28,8 +28,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -235,11 +235,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -317,9 +312,11 @@ - # CONFIG_SCSI_MEGARAID is not set - # CONFIG_SCSI_MEGARAID2 is not set - # CONFIG_SCSI_SATA is not set -+# CONFIG_SCSI_SATA_AHCI is not set - # CONFIG_SCSI_SATA_SVW is not set - # CONFIG_SCSI_ATA_PIIX is not set - # CONFIG_SCSI_SATA_NV is not set -+# CONFIG_SCSI_SATA_QSTOR is not set - # CONFIG_SCSI_SATA_PROMISE is not set - # CONFIG_SCSI_SATA_SX4 is not set - # CONFIG_SCSI_SATA_SIL is not set -@@ -528,7 +525,6 @@ - CONFIG_SERIAL_CONSOLE=y - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-bosporus linux-2.4.30-mips/arch/mips/defconfig-bosporus ---- linux-2.4.30/arch/mips/defconfig-bosporus 2005-01-19 15:09:27.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-bosporus 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -208,9 +208,7 @@ - CONFIG_MTD_BOSPORUS=y - # CONFIG_MTD_XXS1500 is not set - # CONFIG_MTD_MTX1 is not set --# CONFIG_MTD_DB1X00 is not set - # CONFIG_MTD_PB1550 is not set --# CONFIG_MTD_HYDROGEN3 is not set - # CONFIG_MTD_MIRAGE is not set - # CONFIG_MTD_CSTM_MIPS_IXX is not set - # CONFIG_MTD_OCELOT is not set -@@ -229,7 +227,6 @@ - # - # Disk-On-Chip Device Drivers - # --# CONFIG_MTD_DOC1000 is not set - # CONFIG_MTD_DOC2000 is not set - # CONFIG_MTD_DOC2001 is not set - # CONFIG_MTD_DOCPROBE is not set -@@ -373,11 +370,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -457,9 +449,11 @@ - # CONFIG_SCSI_MEGARAID is not set - # CONFIG_SCSI_MEGARAID2 is not set - # CONFIG_SCSI_SATA is not set -+# CONFIG_SCSI_SATA_AHCI is not set - # CONFIG_SCSI_SATA_SVW is not set - # CONFIG_SCSI_ATA_PIIX is not set - # CONFIG_SCSI_SATA_NV is not set -+# CONFIG_SCSI_SATA_QSTOR is not set - # CONFIG_SCSI_SATA_PROMISE is not set - # CONFIG_SCSI_SATA_SX4 is not set - # CONFIG_SCSI_SATA_SIL is not set -@@ -681,7 +675,6 @@ - # CONFIG_AU1X00_USB_TTY is not set - # CONFIG_AU1X00_USB_RAW is not set - # CONFIG_TXX927_SERIAL is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-capcella linux-2.4.30-mips/arch/mips/defconfig-capcella ---- linux-2.4.30/arch/mips/defconfig-capcella 2005-01-19 15:09:27.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-capcella 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -228,11 +228,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -472,7 +467,6 @@ - CONFIG_SERIAL_CONSOLE=y - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - # CONFIG_VR41XX_KIU is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 -diff -Nur linux-2.4.30/arch/mips/defconfig-cobalt linux-2.4.30-mips/arch/mips/defconfig-cobalt ---- linux-2.4.30/arch/mips/defconfig-cobalt 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-cobalt 2005-03-18 13:13:21.000000000 +0100 -@@ -28,8 +28,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -222,11 +222,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -505,7 +500,6 @@ - CONFIG_SERIAL_CONSOLE=y - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=16 - -diff -Nur linux-2.4.30/arch/mips/defconfig-csb250 linux-2.4.30-mips/arch/mips/defconfig-csb250 ---- linux-2.4.30/arch/mips/defconfig-csb250 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-csb250 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - CONFIG_COGENT_CSB250=y -@@ -268,11 +268,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -556,7 +551,6 @@ - # CONFIG_AU1X00_USB_TTY is not set - # CONFIG_AU1X00_USB_RAW is not set - # CONFIG_TXX927_SERIAL is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-db1000 linux-2.4.30-mips/arch/mips/defconfig-db1000 ---- linux-2.4.30/arch/mips/defconfig-db1000 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-db1000 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -214,11 +214,7 @@ - # CONFIG_MTD_BOSPORUS is not set - # CONFIG_MTD_XXS1500 is not set - # CONFIG_MTD_MTX1 is not set --CONFIG_MTD_DB1X00=y --CONFIG_MTD_DB1X00_BOOT=y --CONFIG_MTD_DB1X00_USER=y - # CONFIG_MTD_PB1550 is not set --# CONFIG_MTD_HYDROGEN3 is not set - # CONFIG_MTD_MIRAGE is not set - # CONFIG_MTD_CSTM_MIPS_IXX is not set - # CONFIG_MTD_OCELOT is not set -@@ -237,7 +233,6 @@ - # - # Disk-On-Chip Device Drivers - # --# CONFIG_MTD_DOC1000 is not set - # CONFIG_MTD_DOC2000 is not set - # CONFIG_MTD_DOC2001 is not set - # CONFIG_MTD_DOCPROBE is not set -@@ -342,11 +337,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -636,7 +626,6 @@ - # CONFIG_AU1X00_USB_TTY is not set - # CONFIG_AU1X00_USB_RAW is not set - # CONFIG_TXX927_SERIAL is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-db1100 linux-2.4.30-mips/arch/mips/defconfig-db1100 ---- linux-2.4.30/arch/mips/defconfig-db1100 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-db1100 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -214,11 +214,7 @@ - # CONFIG_MTD_BOSPORUS is not set - # CONFIG_MTD_XXS1500 is not set - # CONFIG_MTD_MTX1 is not set --CONFIG_MTD_DB1X00=y --# CONFIG_MTD_DB1X00_BOOT is not set --CONFIG_MTD_DB1X00_USER=y - # CONFIG_MTD_PB1550 is not set --# CONFIG_MTD_HYDROGEN3 is not set - # CONFIG_MTD_MIRAGE is not set - # CONFIG_MTD_CSTM_MIPS_IXX is not set - # CONFIG_MTD_OCELOT is not set -@@ -237,7 +233,6 @@ - # - # Disk-On-Chip Device Drivers - # --# CONFIG_MTD_DOC1000 is not set - # CONFIG_MTD_DOC2000 is not set - # CONFIG_MTD_DOC2001 is not set - # CONFIG_MTD_DOCPROBE is not set -@@ -342,11 +337,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -636,7 +626,6 @@ - # CONFIG_AU1X00_USB_TTY is not set - # CONFIG_AU1X00_USB_RAW is not set - # CONFIG_TXX927_SERIAL is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -@@ -884,6 +873,7 @@ - # CONFIG_FB_PM2 is not set - # CONFIG_FB_PM3 is not set - # CONFIG_FB_CYBER2000 is not set -+CONFIG_FB_AU1100=y - # CONFIG_FB_MATROX is not set - # CONFIG_FB_ATY is not set - # CONFIG_FB_RADEON is not set -@@ -895,7 +885,6 @@ - # CONFIG_FB_VOODOO1 is not set - # CONFIG_FB_TRIDENT is not set - # CONFIG_FB_E1356 is not set --CONFIG_FB_AU1100=y - # CONFIG_FB_IT8181 is not set - # CONFIG_FB_VIRTUAL is not set - CONFIG_FBCON_ADVANCED=y -diff -Nur linux-2.4.30/arch/mips/defconfig-db1200 linux-2.4.30-mips/arch/mips/defconfig-db1200 ---- linux-2.4.30/arch/mips/defconfig-db1200 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-db1200 2005-03-18 13:13:21.000000000 +0100 -@@ -0,0 +1,1032 @@ -+# -+# Automatically generated make config: don't edit -+# -+CONFIG_MIPS=y -+CONFIG_MIPS32=y -+# CONFIG_MIPS64 is not set -+ -+# -+# Code maturity level options -+# -+CONFIG_EXPERIMENTAL=y -+ -+# -+# Loadable module support -+# -+CONFIG_MODULES=y -+# CONFIG_MODVERSIONS is not set -+CONFIG_KMOD=y -+ -+# -+# Machine selection -+# -+# CONFIG_ACER_PICA_61 is not set -+# CONFIG_MIPS_BOSPORUS is not set -+# CONFIG_MIPS_MIRAGE is not set -+# CONFIG_MIPS_DB1000 is not set -+# CONFIG_MIPS_DB1100 is not set -+# CONFIG_MIPS_DB1500 is not set -+# CONFIG_MIPS_DB1550 is not set -+# CONFIG_MIPS_PB1000 is not set -+# CONFIG_MIPS_PB1100 is not set -+# CONFIG_MIPS_PB1500 is not set -+# CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set -+# CONFIG_MIPS_XXS1500 is not set -+# CONFIG_MIPS_MTX1 is not set -+# CONFIG_COGENT_CSB250 is not set -+# CONFIG_BAGET_MIPS is not set -+# CONFIG_CASIO_E55 is not set -+# CONFIG_MIPS_COBALT is not set -+# CONFIG_DECSTATION is not set -+# CONFIG_MIPS_EV64120 is not set -+# CONFIG_MIPS_EV96100 is not set -+# CONFIG_MIPS_IVR is not set -+# CONFIG_HP_LASERJET is not set -+# CONFIG_IBM_WORKPAD is not set -+# CONFIG_LASAT is not set -+# CONFIG_MIPS_ITE8172 is not set -+# CONFIG_MIPS_ATLAS is not set -+# CONFIG_MIPS_MAGNUM_4000 is not set -+# CONFIG_MIPS_MALTA is not set -+# CONFIG_MIPS_SEAD is not set -+# CONFIG_MOMENCO_OCELOT is not set -+# CONFIG_MOMENCO_OCELOT_G is not set -+# CONFIG_MOMENCO_OCELOT_C is not set -+# CONFIG_MOMENCO_JAGUAR_ATX is not set -+# CONFIG_PMC_BIG_SUR is not set -+# CONFIG_PMC_STRETCH is not set -+# CONFIG_PMC_YOSEMITE is not set -+# CONFIG_DDB5074 is not set -+# CONFIG_DDB5476 is not set -+# CONFIG_DDB5477 is not set -+# CONFIG_NEC_OSPREY is not set -+# CONFIG_NEC_EAGLE is not set -+# CONFIG_OLIVETTI_M700 is not set -+# CONFIG_NINO is not set -+# CONFIG_SGI_IP22 is not set -+# CONFIG_SGI_IP27 is not set -+# CONFIG_SIBYTE_SB1xxx_SOC is not set -+# CONFIG_SNI_RM200_PCI is not set -+# CONFIG_TANBAC_TB0226 is not set -+# CONFIG_TANBAC_TB0229 is not set -+# CONFIG_TOSHIBA_JMR3927 is not set -+# CONFIG_TOSHIBA_RBTX4927 is not set -+# CONFIG_VICTOR_MPC30X is not set -+# CONFIG_ZAO_CAPCELLA is not set -+# CONFIG_HIGHMEM is not set -+CONFIG_RWSEM_GENERIC_SPINLOCK=y -+# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set -+# CONFIG_MIPS_AU1000 is not set -+ -+# -+# CPU selection -+# -+CONFIG_CPU_MIPS32=y -+# CONFIG_CPU_MIPS64 is not set -+# CONFIG_CPU_R3000 is not set -+# CONFIG_CPU_TX39XX is not set -+# CONFIG_CPU_VR41XX is not set -+# CONFIG_CPU_R4300 is not set -+# CONFIG_CPU_R4X00 is not set -+# CONFIG_CPU_TX49XX is not set -+# CONFIG_CPU_R5000 is not set -+# CONFIG_CPU_R5432 is not set -+# CONFIG_CPU_R6000 is not set -+# CONFIG_CPU_NEVADA is not set -+# CONFIG_CPU_R8000 is not set -+# CONFIG_CPU_R10000 is not set -+# CONFIG_CPU_RM7000 is not set -+# CONFIG_CPU_RM9000 is not set -+# CONFIG_CPU_SB1 is not set -+CONFIG_PAGE_SIZE_4KB=y -+# CONFIG_PAGE_SIZE_16KB is not set -+# CONFIG_PAGE_SIZE_64KB is not set -+CONFIG_CPU_HAS_PREFETCH=y -+# CONFIG_VTAG_ICACHE is not set -+CONFIG_64BIT_PHYS_ADDR=y -+# CONFIG_CPU_ADVANCED is not set -+CONFIG_CPU_HAS_LLSC=y -+# CONFIG_CPU_HAS_LLDSCD is not set -+# CONFIG_CPU_HAS_WB is not set -+CONFIG_CPU_HAS_SYNC=y -+ -+# -+# General setup -+# -+CONFIG_CPU_LITTLE_ENDIAN=y -+# CONFIG_BUILD_ELF64 is not set -+CONFIG_NET=y -+CONFIG_PCI=y -+CONFIG_PCI_NEW=y -+CONFIG_PCI_AUTO=y -+# CONFIG_PCI_NAMES is not set -+# CONFIG_ISA is not set -+# CONFIG_TC is not set -+# CONFIG_MCA is not set -+# CONFIG_SBUS is not set -+CONFIG_HOTPLUG=y -+ -+# -+# PCMCIA/CardBus support -+# -+CONFIG_PCMCIA=m -+# CONFIG_CARDBUS is not set -+# CONFIG_TCIC is not set -+# CONFIG_I82092 is not set -+# CONFIG_I82365 is not set -+ -+# -+# PCI Hotplug Support -+# -+# CONFIG_HOTPLUG_PCI is not set -+# CONFIG_HOTPLUG_PCI_COMPAQ is not set -+# CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM is not set -+# CONFIG_HOTPLUG_PCI_SHPC is not set -+# CONFIG_HOTPLUG_PCI_SHPC_POLL_EVENT_MODE is not set -+# CONFIG_HOTPLUG_PCI_PCIE is not set -+# CONFIG_HOTPLUG_PCI_PCIE_POLL_EVENT_MODE is not set -+CONFIG_SYSVIPC=y -+# CONFIG_BSD_PROCESS_ACCT is not set -+CONFIG_SYSCTL=y -+CONFIG_KCORE_ELF=y -+# CONFIG_KCORE_AOUT is not set -+# CONFIG_BINFMT_AOUT is not set -+CONFIG_BINFMT_ELF=y -+# CONFIG_MIPS32_COMPAT is not set -+# CONFIG_MIPS32_O32 is not set -+# CONFIG_MIPS32_N32 is not set -+# CONFIG_BINFMT_ELF32 is not set -+# CONFIG_BINFMT_MISC is not set -+# CONFIG_OOM_KILLER is not set -+CONFIG_CMDLINE_BOOL=y -+CONFIG_CMDLINE="mem=96M" -+ -+# -+# Memory Technology Devices (MTD) -+# -+# CONFIG_MTD is not set -+ -+# -+# Parallel port support -+# -+# CONFIG_PARPORT is not set -+ -+# -+# Plug and Play configuration -+# -+# CONFIG_PNP is not set -+# CONFIG_ISAPNP is not set -+ -+# -+# Block devices -+# -+# CONFIG_BLK_DEV_FD is not set -+# CONFIG_BLK_DEV_XD is not set -+# CONFIG_PARIDE is not set -+# CONFIG_BLK_CPQ_DA is not set -+# CONFIG_BLK_CPQ_CISS_DA is not set -+# CONFIG_CISS_SCSI_TAPE is not set -+# CONFIG_CISS_MONITOR_THREAD is not set -+# CONFIG_BLK_DEV_DAC960 is not set -+# CONFIG_BLK_DEV_UMEM is not set -+# CONFIG_BLK_DEV_SX8 is not set -+CONFIG_BLK_DEV_LOOP=y -+# CONFIG_BLK_DEV_NBD is not set -+# CONFIG_BLK_DEV_RAM is not set -+# CONFIG_BLK_DEV_INITRD is not set -+# CONFIG_BLK_STATS is not set -+ -+# -+# Multi-device support (RAID and LVM) -+# -+# CONFIG_MD is not set -+# CONFIG_BLK_DEV_MD is not set -+# CONFIG_MD_LINEAR is not set -+# CONFIG_MD_RAID0 is not set -+# CONFIG_MD_RAID1 is not set -+# CONFIG_MD_RAID5 is not set -+# CONFIG_MD_MULTIPATH is not set -+# CONFIG_BLK_DEV_LVM is not set -+ -+# -+# Networking options -+# -+CONFIG_PACKET=y -+# CONFIG_PACKET_MMAP is not set -+# CONFIG_NETLINK_DEV is not set -+CONFIG_NETFILTER=y -+# CONFIG_NETFILTER_DEBUG is not set -+CONFIG_FILTER=y -+CONFIG_UNIX=y -+CONFIG_INET=y -+CONFIG_IP_MULTICAST=y -+# CONFIG_IP_ADVANCED_ROUTER is not set -+CONFIG_IP_PNP=y -+# CONFIG_IP_PNP_DHCP is not set -+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_IP_MROUTE is not set -+# CONFIG_ARPD is not set -+# CONFIG_INET_ECN is not set -+# CONFIG_SYN_COOKIES is not set -+ -+# -+# IP: Netfilter Configuration -+# -+# CONFIG_IP_NF_CONNTRACK is not set -+# CONFIG_IP_NF_QUEUE is not set -+# CONFIG_IP_NF_IPTABLES is not set -+# CONFIG_IP_NF_ARPTABLES is not set -+# CONFIG_IP_NF_COMPAT_IPCHAINS is not set -+# CONFIG_IP_NF_COMPAT_IPFWADM is not set -+ -+# -+# IP: Virtual Server Configuration -+# -+# CONFIG_IP_VS is not set -+# CONFIG_IPV6 is not set -+# CONFIG_KHTTPD is not set -+ -+# -+# SCTP Configuration (EXPERIMENTAL) -+# -+# CONFIG_IP_SCTP is not set -+# CONFIG_ATM is not set -+# CONFIG_VLAN_8021Q is not set -+ -+# -+# -+# -+# CONFIG_IPX is not set -+# CONFIG_ATALK is not set -+# CONFIG_DECNET is not set -+# CONFIG_BRIDGE is not set -+# CONFIG_X25 is not set -+# CONFIG_LAPB is not set -+# CONFIG_LLC is not set -+# CONFIG_NET_DIVERT is not set -+# CONFIG_ECONET is not set -+# CONFIG_WAN_ROUTER is not set -+# CONFIG_NET_FASTROUTE is not set -+# CONFIG_NET_HW_FLOWCONTROL is not set -+ -+# -+# QoS and/or fair queueing -+# -+# CONFIG_NET_SCHED is not set -+ -+# -+# Network testing -+# -+# CONFIG_NET_PKTGEN is not set -+ -+# -+# Telephony Support -+# -+# CONFIG_PHONE is not set -+# CONFIG_PHONE_IXJ is not set -+# CONFIG_PHONE_IXJ_PCMCIA is not set -+ -+# -+# ATA/IDE/MFM/RLL support -+# -+CONFIG_IDE=y -+ -+# -+# IDE, ATA and ATAPI Block devices -+# -+CONFIG_BLK_DEV_IDE=y -+ -+# -+# Please see Documentation/ide.txt for help/info on IDE drives -+# -+# CONFIG_BLK_DEV_HD_IDE is not set -+# CONFIG_BLK_DEV_HD is not set -+# CONFIG_BLK_DEV_IDE_SATA is not set -+CONFIG_BLK_DEV_IDEDISK=y -+CONFIG_IDEDISK_MULTI_MODE=y -+CONFIG_IDEDISK_STROKE=y -+CONFIG_BLK_DEV_IDECS=m -+# CONFIG_BLK_DEV_DELKIN is not set -+# CONFIG_BLK_DEV_IDECD is not set -+# CONFIG_BLK_DEV_IDETAPE is not set -+# CONFIG_BLK_DEV_IDEFLOPPY is not set -+# CONFIG_BLK_DEV_IDESCSI is not set -+# CONFIG_IDE_TASK_IOCTL is not set -+ -+# -+# IDE chipset support/bugfixes -+# -+# CONFIG_BLK_DEV_CMD640 is not set -+# CONFIG_BLK_DEV_CMD640_ENHANCED is not set -+# CONFIG_BLK_DEV_ISAPNP is not set -+# CONFIG_BLK_DEV_IDEPCI is not set -+# CONFIG_IDE_CHIPSETS is not set -+# CONFIG_IDEDMA_AUTO is not set -+# CONFIG_DMA_NONPCI is not set -+# CONFIG_BLK_DEV_ATARAID is not set -+# CONFIG_BLK_DEV_ATARAID_PDC is not set -+# CONFIG_BLK_DEV_ATARAID_HPT is not set -+# CONFIG_BLK_DEV_ATARAID_MEDLEY is not set -+# CONFIG_BLK_DEV_ATARAID_SII is not set -+ -+# -+# SCSI support -+# -+CONFIG_SCSI=y -+ -+# -+# SCSI support type (disk, tape, CD-ROM) -+# -+CONFIG_BLK_DEV_SD=y -+CONFIG_SD_EXTRA_DEVS=40 -+CONFIG_CHR_DEV_ST=y -+# CONFIG_CHR_DEV_OSST is not set -+CONFIG_BLK_DEV_SR=y -+# CONFIG_BLK_DEV_SR_VENDOR is not set -+CONFIG_SR_EXTRA_DEVS=2 -+# CONFIG_CHR_DEV_SG is not set -+ -+# -+# Some SCSI devices (e.g. CD jukebox) support multiple LUNs -+# -+# CONFIG_SCSI_DEBUG_QUEUES is not set -+# CONFIG_SCSI_MULTI_LUN is not set -+CONFIG_SCSI_CONSTANTS=y -+# CONFIG_SCSI_LOGGING is not set -+ -+# -+# SCSI low-level drivers -+# -+# CONFIG_BLK_DEV_3W_XXXX_RAID is not set -+# CONFIG_SCSI_7000FASST is not set -+# CONFIG_SCSI_ACARD is not set -+# CONFIG_SCSI_AHA152X is not set -+# CONFIG_SCSI_AHA1542 is not set -+# CONFIG_SCSI_AHA1740 is not set -+# CONFIG_SCSI_AACRAID is not set -+# CONFIG_SCSI_AIC7XXX is not set -+# CONFIG_SCSI_AIC79XX is not set -+# CONFIG_SCSI_AIC7XXX_OLD is not set -+# CONFIG_SCSI_DPT_I2O is not set -+# CONFIG_SCSI_ADVANSYS is not set -+# CONFIG_SCSI_IN2000 is not set -+# CONFIG_SCSI_AM53C974 is not set -+# CONFIG_SCSI_MEGARAID is not set -+# CONFIG_SCSI_MEGARAID2 is not set -+# CONFIG_SCSI_SATA is not set -+# CONFIG_SCSI_SATA_AHCI is not set -+# CONFIG_SCSI_SATA_SVW is not set -+# CONFIG_SCSI_ATA_PIIX is not set -+# CONFIG_SCSI_SATA_NV is not set -+# CONFIG_SCSI_SATA_QSTOR is not set -+# CONFIG_SCSI_SATA_PROMISE is not set -+# CONFIG_SCSI_SATA_SX4 is not set -+# CONFIG_SCSI_SATA_SIL is not set -+# CONFIG_SCSI_SATA_SIS is not set -+# CONFIG_SCSI_SATA_ULI is not set -+# CONFIG_SCSI_SATA_VIA is not set -+# CONFIG_SCSI_SATA_VITESSE is not set -+# CONFIG_SCSI_BUSLOGIC is not set -+# CONFIG_SCSI_CPQFCTS is not set -+# CONFIG_SCSI_DMX3191D 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_PIO 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_INITIO is not set -+# CONFIG_SCSI_INIA100 is not set -+# CONFIG_SCSI_NCR53C406A is not set -+# CONFIG_SCSI_NCR53C7xx is not set -+# CONFIG_SCSI_SYM53C8XX_2 is not set -+# CONFIG_SCSI_NCR53C8XX is not set -+# CONFIG_SCSI_SYM53C8XX is not set -+# CONFIG_SCSI_PAS16 is not set -+# CONFIG_SCSI_PCI2000 is not set -+# CONFIG_SCSI_PCI2220I is not set -+# CONFIG_SCSI_PSI240I is not set -+# CONFIG_SCSI_QLOGIC_FAS is not set -+# CONFIG_SCSI_QLOGIC_ISP is not set -+# CONFIG_SCSI_QLOGIC_FC is not set -+# CONFIG_SCSI_QLOGIC_1280 is not set -+# CONFIG_SCSI_SIM710 is not set -+# CONFIG_SCSI_SYM53C416 is not set -+# CONFIG_SCSI_DC390T is not set -+# CONFIG_SCSI_T128 is not set -+# CONFIG_SCSI_U14_34F is not set -+# CONFIG_SCSI_NSP32 is not set -+# CONFIG_SCSI_DEBUG is not set -+ -+# -+# PCMCIA SCSI adapter support -+# -+# CONFIG_SCSI_PCMCIA is not set -+ -+# -+# Fusion MPT device support -+# -+# CONFIG_FUSION is not set -+# CONFIG_FUSION_BOOT is not set -+# CONFIG_FUSION_ISENSE is not set -+# CONFIG_FUSION_CTL is not set -+# CONFIG_FUSION_LAN is not set -+ -+# -+# IEEE 1394 (FireWire) support (EXPERIMENTAL) -+# -+# CONFIG_IEEE1394 is not set -+ -+# -+# I2O device support -+# -+# CONFIG_I2O is not set -+# CONFIG_I2O_PCI is not set -+# CONFIG_I2O_BLOCK is not set -+# CONFIG_I2O_LAN is not set -+# CONFIG_I2O_SCSI is not set -+# CONFIG_I2O_PROC is not set -+ -+# -+# Network device support -+# -+CONFIG_NETDEVICES=y -+ -+# -+# ARCnet devices -+# -+# CONFIG_ARCNET is not set -+# CONFIG_DUMMY is not set -+# CONFIG_BONDING is not set -+# CONFIG_EQUALIZER is not set -+# CONFIG_TUN is not set -+# CONFIG_ETHERTAP is not set -+ -+# -+# Ethernet (10 or 100Mbit) -+# -+CONFIG_NET_ETHERNET=y -+# CONFIG_SUNLANCE is not set -+# CONFIG_HAPPYMEAL is not set -+# CONFIG_SUNBMAC is not set -+# CONFIG_SUNQE is not set -+# CONFIG_SUNGEM 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 -+# CONFIG_HP100 is not set -+# CONFIG_NET_ISA is not set -+# CONFIG_NET_PCI is not set -+# CONFIG_NET_POCKET is not set -+ -+# -+# Ethernet (1000 Mbit) -+# -+# CONFIG_ACENIC is not set -+# CONFIG_DL2K is not set -+# CONFIG_E1000 is not set -+# CONFIG_MYRI_SBUS is not set -+# CONFIG_NS83820 is not set -+# CONFIG_HAMACHI is not set -+# CONFIG_YELLOWFIN is not set -+# CONFIG_R8169 is not set -+# CONFIG_SK98LIN is not set -+# CONFIG_TIGON3 is not set -+# CONFIG_FDDI is not set -+# CONFIG_HIPPI is not set -+# CONFIG_PLIP is not set -+# CONFIG_PPP is not set -+# CONFIG_SLIP is not set -+ -+# -+# Wireless LAN (non-hamradio) -+# -+# CONFIG_NET_RADIO is not set -+ -+# -+# Token Ring devices -+# -+# CONFIG_TR is not set -+# CONFIG_NET_FC is not set -+# CONFIG_RCPCI is not set -+# CONFIG_SHAPER is not set -+ -+# -+# Wan interfaces -+# -+# CONFIG_WAN is not set -+ -+# -+# PCMCIA network device support -+# -+# CONFIG_NET_PCMCIA is not set -+ -+# -+# Amateur Radio support -+# -+# CONFIG_HAMRADIO is not set -+ -+# -+# IrDA (infrared) support -+# -+# CONFIG_IRDA is not set -+ -+# -+# ISDN subsystem -+# -+# CONFIG_ISDN is not set -+ -+# -+# Input core support -+# -+CONFIG_INPUT=y -+CONFIG_INPUT_KEYBDEV=y -+CONFIG_INPUT_MOUSEDEV=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_UINPUT is not set -+ -+# -+# Character devices -+# -+CONFIG_VT=y -+# CONFIG_VT_CONSOLE is not set -+# CONFIG_SERIAL is not set -+# CONFIG_SERIAL_EXTENDED is not set -+CONFIG_SERIAL_NONSTANDARD=y -+# CONFIG_COMPUTONE is not set -+# CONFIG_ROCKETPORT is not set -+# CONFIG_CYCLADES is not set -+# CONFIG_DIGIEPCA is not set -+# CONFIG_DIGI is not set -+# CONFIG_ESPSERIAL is not set -+# CONFIG_MOXA_INTELLIO is not set -+# CONFIG_MOXA_SMARTIO is not set -+# CONFIG_ISI is not set -+# CONFIG_SYNCLINK is not set -+# CONFIG_SYNCLINKMP is not set -+# CONFIG_N_HDLC is not set -+# CONFIG_RISCOM8 is not set -+# CONFIG_SPECIALIX is not set -+# CONFIG_SX is not set -+# CONFIG_RIO is not set -+# CONFIG_STALDRV is not set -+# CONFIG_SERIAL_TX3912 is not set -+# CONFIG_SERIAL_TX3912_CONSOLE is not set -+# CONFIG_SERIAL_TXX9 is not set -+# CONFIG_SERIAL_TXX9_CONSOLE is not set -+# CONFIG_TXX927_SERIAL is not set -+CONFIG_UNIX98_PTYS=y -+CONFIG_UNIX98_PTY_COUNT=256 -+ -+# -+# I2C support -+# -+# CONFIG_I2C is not set -+ -+# -+# Mice -+# -+# CONFIG_BUSMOUSE is not set -+# CONFIG_MOUSE is not set -+ -+# -+# Joysticks -+# -+# CONFIG_INPUT_GAMEPORT is not set -+# CONFIG_INPUT_NS558 is not set -+# CONFIG_INPUT_LIGHTNING is not set -+# CONFIG_INPUT_PCIGAME is not set -+# CONFIG_INPUT_CS461X is not set -+# CONFIG_INPUT_EMU10K1 is not set -+# CONFIG_INPUT_SERIO is not set -+# CONFIG_INPUT_SERPORT is not set -+ -+# -+# Joysticks -+# -+# CONFIG_INPUT_ANALOG is not set -+# CONFIG_INPUT_A3D is not set -+# CONFIG_INPUT_ADI is not set -+# CONFIG_INPUT_COBRA is not set -+# CONFIG_INPUT_GF2K is not set -+# CONFIG_INPUT_GRIP is not set -+# CONFIG_INPUT_INTERACT is not set -+# CONFIG_INPUT_TMDC is not set -+# CONFIG_INPUT_SIDEWINDER is not set -+# CONFIG_INPUT_IFORCE_USB is not set -+# CONFIG_INPUT_IFORCE_232 is not set -+# CONFIG_INPUT_WARRIOR is not set -+# CONFIG_INPUT_MAGELLAN is not set -+# CONFIG_INPUT_SPACEORB is not set -+# CONFIG_INPUT_SPACEBALL is not set -+# CONFIG_INPUT_STINGER is not set -+# CONFIG_INPUT_DB9 is not set -+# CONFIG_INPUT_GAMECON is not set -+# CONFIG_INPUT_TURBOGRAFX is not set -+# CONFIG_QIC02_TAPE is not set -+# CONFIG_IPMI_HANDLER is not set -+# CONFIG_IPMI_PANIC_EVENT is not set -+# CONFIG_IPMI_DEVICE_INTERFACE is not set -+# CONFIG_IPMI_KCS is not set -+# CONFIG_IPMI_WATCHDOG is not set -+ -+# -+# Watchdog Cards -+# -+# CONFIG_WATCHDOG is not set -+# CONFIG_SCx200 is not set -+# CONFIG_SCx200_GPIO is not set -+# CONFIG_AMD_PM768 is not set -+# CONFIG_NVRAM is not set -+# CONFIG_RTC is not set -+# CONFIG_DTLK is not set -+# CONFIG_R3964 is not set -+# CONFIG_APPLICOM is not set -+ -+# -+# Ftape, the floppy tape device driver -+# -+# CONFIG_FTAPE is not set -+# CONFIG_AGP is not set -+ -+# -+# Direct Rendering Manager (XFree86 DRI support) -+# -+# CONFIG_DRM is not set -+ -+# -+# PCMCIA character devices -+# -+# CONFIG_PCMCIA_SERIAL_CS is not set -+# CONFIG_SYNCLINK_CS is not set -+ -+# -+# File systems -+# -+# CONFIG_QUOTA is not set -+# CONFIG_QFMT_V2 is not set -+CONFIG_AUTOFS_FS=y -+# CONFIG_AUTOFS4_FS is not set -+# CONFIG_REISERFS_FS is not set -+# CONFIG_REISERFS_CHECK is not set -+# CONFIG_REISERFS_PROC_INFO is not set -+# CONFIG_ADFS_FS is not set -+# CONFIG_ADFS_FS_RW 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_BEFS_DEBUG is not set -+# CONFIG_BFS_FS is not set -+CONFIG_EXT3_FS=y -+CONFIG_JBD=y -+# CONFIG_JBD_DEBUG is not set -+CONFIG_FAT_FS=y -+CONFIG_MSDOS_FS=y -+# CONFIG_UMSDOS_FS is not set -+CONFIG_VFAT_FS=y -+# CONFIG_EFS_FS is not set -+# CONFIG_JFFS_FS is not set -+# CONFIG_JFFS2_FS is not set -+# CONFIG_CRAMFS is not set -+CONFIG_TMPFS=y -+CONFIG_RAMFS=y -+# CONFIG_ISO9660_FS is not set -+# CONFIG_JOLIET is not set -+# CONFIG_ZISOFS is not set -+# CONFIG_JFS_FS is not set -+# CONFIG_JFS_DEBUG is not set -+# CONFIG_JFS_STATISTICS is not set -+# CONFIG_MINIX_FS is not set -+# CONFIG_VXFS_FS is not set -+# CONFIG_NTFS_FS is not set -+# CONFIG_NTFS_RW is not set -+# CONFIG_HPFS_FS is not set -+CONFIG_PROC_FS=y -+# CONFIG_DEVFS_FS is not set -+# CONFIG_DEVFS_MOUNT is not set -+# CONFIG_DEVFS_DEBUG is not set -+CONFIG_DEVPTS_FS=y -+# CONFIG_QNX4FS_FS is not set -+# CONFIG_QNX4FS_RW is not set -+# CONFIG_ROMFS_FS is not set -+CONFIG_EXT2_FS=y -+# CONFIG_SYSV_FS is not set -+# CONFIG_UDF_FS is not set -+# CONFIG_UDF_RW is not set -+# CONFIG_UFS_FS is not set -+# CONFIG_UFS_FS_WRITE is not set -+# CONFIG_XFS_FS is not set -+# CONFIG_XFS_QUOTA is not set -+# CONFIG_XFS_RT is not set -+# CONFIG_XFS_TRACE is not set -+# CONFIG_XFS_DEBUG is not set -+ -+# -+# Network File Systems -+# -+# CONFIG_CODA_FS is not set -+# CONFIG_INTERMEZZO_FS is not set -+CONFIG_NFS_FS=y -+CONFIG_NFS_V3=y -+# CONFIG_NFS_DIRECTIO is not set -+CONFIG_ROOT_NFS=y -+# CONFIG_NFSD is not set -+# CONFIG_NFSD_V3 is not set -+# CONFIG_NFSD_TCP is not set -+CONFIG_SUNRPC=y -+CONFIG_LOCKD=y -+CONFIG_LOCKD_V4=y -+# CONFIG_SMB_FS is not set -+# CONFIG_NCP_FS is not set -+# CONFIG_NCPFS_PACKET_SIGNING is not set -+# CONFIG_NCPFS_IOCTL_LOCKING is not set -+# CONFIG_NCPFS_STRONG is not set -+# CONFIG_NCPFS_NFS_NS is not set -+# CONFIG_NCPFS_OS2_NS is not set -+# CONFIG_NCPFS_SMALLDOS is not set -+# CONFIG_NCPFS_NLS is not set -+# CONFIG_NCPFS_EXTRAS is not set -+# CONFIG_ZISOFS_FS is not set -+ -+# -+# Partition Types -+# -+# CONFIG_PARTITION_ADVANCED is not set -+CONFIG_MSDOS_PARTITION=y -+# CONFIG_SMB_NLS is not set -+CONFIG_NLS=y -+ -+# -+# Native Language Support -+# -+CONFIG_NLS_DEFAULT="iso8859-1" -+# 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_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_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_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 -+ -+# -+# Multimedia devices -+# -+# CONFIG_VIDEO_DEV is not set -+ -+# -+# Console drivers -+# -+# CONFIG_VGA_CONSOLE is not set -+# CONFIG_MDA_CONSOLE is not set -+ -+# -+# Frame-buffer support -+# -+CONFIG_FB=y -+CONFIG_DUMMY_CONSOLE=y -+# CONFIG_FB_RIVA is not set -+# CONFIG_FB_CLGEN is not set -+# CONFIG_FB_PM2 is not set -+# CONFIG_FB_PM3 is not set -+# CONFIG_FB_CYBER2000 is not set -+# CONFIG_FB_MATROX is not set -+# CONFIG_FB_ATY is not set -+# CONFIG_FB_RADEON is not set -+# CONFIG_FB_ATY128 is not set -+# CONFIG_FB_INTEL is not set -+# CONFIG_FB_SIS is not set -+# CONFIG_FB_NEOMAGIC is not set -+# CONFIG_FB_3DFX is not set -+# CONFIG_FB_VOODOO1 is not set -+# CONFIG_FB_TRIDENT is not set -+# CONFIG_FB_E1356 is not set -+# CONFIG_FB_IT8181 is not set -+# CONFIG_FB_VIRTUAL is not set -+CONFIG_FBCON_ADVANCED=y -+# CONFIG_FBCON_MFB is not set -+# CONFIG_FBCON_CFB2 is not set -+# CONFIG_FBCON_CFB4 is not set -+# CONFIG_FBCON_CFB8 is not set -+CONFIG_FBCON_CFB16=y -+# CONFIG_FBCON_CFB24 is not set -+CONFIG_FBCON_CFB32=y -+# CONFIG_FBCON_AFB is not set -+# CONFIG_FBCON_ILBM is not set -+# CONFIG_FBCON_IPLAN2P2 is not set -+# CONFIG_FBCON_IPLAN2P4 is not set -+# CONFIG_FBCON_IPLAN2P8 is not set -+# CONFIG_FBCON_MAC is not set -+# CONFIG_FBCON_VGA_PLANES is not set -+# CONFIG_FBCON_VGA is not set -+# CONFIG_FBCON_HGA is not set -+# CONFIG_FBCON_FONTWIDTH8_ONLY is not set -+CONFIG_FBCON_FONTS=y -+CONFIG_FONT_8x8=y -+CONFIG_FONT_8x16=y -+# CONFIG_FONT_SUN8x16 is not set -+# CONFIG_FONT_SUN12x22 is not set -+# CONFIG_FONT_6x11 is not set -+# CONFIG_FONT_PEARL_8x8 is not set -+# CONFIG_FONT_ACORN_8x8 is not set -+ -+# -+# Sound -+# -+CONFIG_SOUND=y -+# CONFIG_SOUND_ALI5455 is not set -+# CONFIG_SOUND_BT878 is not set -+# CONFIG_SOUND_CMPCI is not set -+# CONFIG_SOUND_EMU10K1 is not set -+# CONFIG_MIDI_EMU10K1 is not set -+# CONFIG_SOUND_FUSION is not set -+# CONFIG_SOUND_CS4281 is not set -+# CONFIG_SOUND_ES1370 is not set -+# CONFIG_SOUND_ES1371 is not set -+# CONFIG_SOUND_ESSSOLO1 is not set -+# CONFIG_SOUND_MAESTRO is not set -+# CONFIG_SOUND_MAESTRO3 is not set -+# CONFIG_SOUND_FORTE is not set -+# CONFIG_SOUND_ICH is not set -+# CONFIG_SOUND_RME96XX is not set -+# CONFIG_SOUND_SONICVIBES is not set -+# CONFIG_SOUND_TRIDENT is not set -+# CONFIG_SOUND_MSNDCLAS is not set -+# CONFIG_SOUND_MSNDPIN is not set -+# CONFIG_SOUND_VIA82CXXX is not set -+# CONFIG_MIDI_VIA82CXXX is not set -+# CONFIG_SOUND_OSS is not set -+# CONFIG_SOUND_TVMIXER is not set -+# CONFIG_SOUND_AD1980 is not set -+# CONFIG_SOUND_WM97XX is not set -+ -+# -+# USB support -+# -+CONFIG_USB=y -+# CONFIG_USB_DEBUG is not set -+ -+# -+# Miscellaneous USB options -+# -+CONFIG_USB_DEVICEFS=y -+# CONFIG_USB_BANDWIDTH is not set -+ -+# -+# USB Host Controller Drivers -+# -+# CONFIG_USB_EHCI_HCD is not set -+# CONFIG_USB_UHCI is not set -+# CONFIG_USB_UHCI_ALT is not set -+CONFIG_USB_OHCI=y -+ -+# -+# USB Device Class drivers -+# -+# CONFIG_USB_AUDIO is not set -+# CONFIG_USB_EMI26 is not set -+# CONFIG_USB_BLUETOOTH is not set -+# CONFIG_USB_MIDI is not set -+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_HP8200e 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_ACM is not set -+# CONFIG_USB_PRINTER is not set -+ -+# -+# USB Human Interface Devices (HID) -+# -+CONFIG_USB_HID=y -+CONFIG_USB_HIDINPUT=y -+CONFIG_USB_HIDDEV=y -+# CONFIG_USB_AIPTEK is not set -+# CONFIG_USB_WACOM is not set -+# CONFIG_USB_KBTAB is not set -+# CONFIG_USB_POWERMATE is not set -+ -+# -+# USB Imaging devices -+# -+# CONFIG_USB_DC2XX is not set -+# CONFIG_USB_MDC800 is not set -+# CONFIG_USB_SCANNER is not set -+# CONFIG_USB_MICROTEK is not set -+# CONFIG_USB_HPUSBSCSI is not set -+ -+# -+# USB Multimedia devices -+# -+ -+# -+# Video4Linux support is needed for USB Multimedia device support -+# -+ -+# -+# USB Network adaptors -+# -+# CONFIG_USB_PEGASUS is not set -+# CONFIG_USB_RTL8150 is not set -+# CONFIG_USB_KAWETH is not set -+# CONFIG_USB_CATC is not set -+# CONFIG_USB_CDCETHER is not set -+# CONFIG_USB_USBNET is not set -+ -+# -+# USB port drivers -+# -+# CONFIG_USB_USS720 is not set -+ -+# -+# USB Serial Converter support -+# -+# CONFIG_USB_SERIAL is not set -+ -+# -+# USB Miscellaneous drivers -+# -+# CONFIG_USB_RIO500 is not set -+# CONFIG_USB_AUERSWALD is not set -+# CONFIG_USB_TIGL is not set -+# CONFIG_USB_BRLVGER is not set -+# CONFIG_USB_LCD is not set -+ -+# -+# Support for USB gadgets -+# -+# CONFIG_USB_GADGET is not set -+ -+# -+# Bluetooth support -+# -+# CONFIG_BLUEZ is not set -+ -+# -+# Kernel hacking -+# -+CONFIG_CROSSCOMPILE=y -+# CONFIG_RUNTIME_DEBUG is not set -+# CONFIG_KGDB is not set -+# CONFIG_GDB_CONSOLE is not set -+# CONFIG_DEBUG_INFO is not set -+# CONFIG_MAGIC_SYSRQ is not set -+# CONFIG_MIPS_UNCACHED is not set -+CONFIG_LOG_BUF_SHIFT=0 -+ -+# -+# Cryptographic options -+# -+# CONFIG_CRYPTO is not set -+ -+# -+# Library routines -+# -+# CONFIG_CRC32 is not set -+CONFIG_ZLIB_INFLATE=m -+CONFIG_ZLIB_DEFLATE=m -+# CONFIG_FW_LOADER is not set -diff -Nur linux-2.4.30/arch/mips/defconfig-db1500 linux-2.4.30-mips/arch/mips/defconfig-db1500 ---- linux-2.4.30/arch/mips/defconfig-db1500 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-db1500 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -267,11 +267,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -555,7 +550,6 @@ - # CONFIG_AU1X00_USB_TTY is not set - # CONFIG_AU1X00_USB_RAW is not set - # CONFIG_TXX927_SERIAL is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-db1550 linux-2.4.30-mips/arch/mips/defconfig-db1550 ---- linux-2.4.30/arch/mips/defconfig-db1550 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-db1550 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -213,11 +213,9 @@ - # CONFIG_MTD_BOSPORUS is not set - # CONFIG_MTD_XXS1500 is not set - # CONFIG_MTD_MTX1 is not set --# CONFIG_MTD_DB1X00 is not set - CONFIG_MTD_PB1550=y - CONFIG_MTD_PB1550_BOOT=y - CONFIG_MTD_PB1550_USER=y --# CONFIG_MTD_HYDROGEN3 is not set - # CONFIG_MTD_MIRAGE is not set - # CONFIG_MTD_CSTM_MIPS_IXX is not set - # CONFIG_MTD_OCELOT is not set -@@ -236,7 +234,6 @@ - # - # Disk-On-Chip Device Drivers - # --# CONFIG_MTD_DOC1000 is not set - # CONFIG_MTD_DOC2000 is not set - # CONFIG_MTD_DOC2001 is not set - # CONFIG_MTD_DOCPROBE is not set -@@ -343,11 +340,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -633,7 +625,6 @@ - # CONFIG_AU1X00_USB_TTY is not set - # CONFIG_AU1X00_USB_RAW is not set - # CONFIG_TXX927_SERIAL is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-ddb5476 linux-2.4.30-mips/arch/mips/defconfig-ddb5476 ---- linux-2.4.30/arch/mips/defconfig-ddb5476 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-ddb5476 2005-03-18 13:13:21.000000000 +0100 -@@ -28,8 +28,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -226,11 +226,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -517,7 +512,6 @@ - CONFIG_SERIAL_CONSOLE=y - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-ddb5477 linux-2.4.30-mips/arch/mips/defconfig-ddb5477 ---- linux-2.4.30/arch/mips/defconfig-ddb5477 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-ddb5477 2005-03-18 13:13:21.000000000 +0100 -@@ -28,8 +28,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -226,11 +226,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -434,7 +429,6 @@ - CONFIG_SERIAL_CONSOLE=y - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-decstation linux-2.4.30-mips/arch/mips/defconfig-decstation ---- linux-2.4.30/arch/mips/defconfig-decstation 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-decstation 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -223,11 +223,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -306,9 +301,11 @@ - # CONFIG_SCSI_MEGARAID is not set - # CONFIG_SCSI_MEGARAID2 is not set - # CONFIG_SCSI_SATA is not set -+# CONFIG_SCSI_SATA_AHCI is not set - # CONFIG_SCSI_SATA_SVW is not set - # CONFIG_SCSI_ATA_PIIX is not set - # CONFIG_SCSI_SATA_NV is not set -+# CONFIG_SCSI_SATA_QSTOR is not set - # CONFIG_SCSI_SATA_PROMISE is not set - # CONFIG_SCSI_SATA_SX4 is not set - # CONFIG_SCSI_SATA_SIL is not set -@@ -477,7 +474,6 @@ - CONFIG_SERIAL_DEC_CONSOLE=y - CONFIG_DZ=y - CONFIG_ZS=y --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-e55 linux-2.4.30-mips/arch/mips/defconfig-e55 ---- linux-2.4.30/arch/mips/defconfig-e55 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-e55 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -222,11 +222,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -426,7 +421,6 @@ - # CONFIG_SERIAL_MULTIPORT is not set - # CONFIG_HUB6 is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - # CONFIG_VR41XX_KIU is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 -diff -Nur linux-2.4.30/arch/mips/defconfig-eagle linux-2.4.30-mips/arch/mips/defconfig-eagle ---- linux-2.4.30/arch/mips/defconfig-eagle 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-eagle 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -208,8 +208,8 @@ - # Mapping drivers for chip access - # - CONFIG_MTD_PHYSMAP=y --CONFIG_MTD_PHYSMAP_START=1c000000 --CONFIG_MTD_PHYSMAP_LEN=2000000 -+CONFIG_MTD_PHYSMAP_START=0x1c000000 -+CONFIG_MTD_PHYSMAP_LEN=0x2000000 - CONFIG_MTD_PHYSMAP_BUSWIDTH=4 - # CONFIG_MTD_PB1000 is not set - # CONFIG_MTD_PB1500 is not set -@@ -217,9 +217,7 @@ - # CONFIG_MTD_BOSPORUS is not set - # CONFIG_MTD_XXS1500 is not set - # CONFIG_MTD_MTX1 is not set --# CONFIG_MTD_DB1X00 is not set - # CONFIG_MTD_PB1550 is not set --# CONFIG_MTD_HYDROGEN3 is not set - # CONFIG_MTD_MIRAGE is not set - # CONFIG_MTD_CSTM_MIPS_IXX is not set - # CONFIG_MTD_OCELOT is not set -@@ -238,7 +236,6 @@ - # - # Disk-On-Chip Device Drivers - # --# CONFIG_MTD_DOC1000 is not set - # CONFIG_MTD_DOC2000 is not set - # CONFIG_MTD_DOC2001 is not set - # CONFIG_MTD_DOCPROBE is not set -@@ -327,11 +324,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -587,7 +579,6 @@ - CONFIG_SERIAL_CONSOLE=y - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - # CONFIG_VR41XX_KIU is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 -diff -Nur linux-2.4.30/arch/mips/defconfig-ev64120 linux-2.4.30-mips/arch/mips/defconfig-ev64120 ---- linux-2.4.30/arch/mips/defconfig-ev64120 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-ev64120 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -230,11 +230,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -443,7 +438,6 @@ - # CONFIG_SERIAL_CONSOLE is not set - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-ev96100 linux-2.4.30-mips/arch/mips/defconfig-ev96100 ---- linux-2.4.30/arch/mips/defconfig-ev96100 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-ev96100 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -232,11 +232,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -441,7 +436,6 @@ - CONFIG_SERIAL_CONSOLE=y - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-ficmmp linux-2.4.30-mips/arch/mips/defconfig-ficmmp ---- linux-2.4.30/arch/mips/defconfig-ficmmp 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-ficmmp 2005-03-18 13:13:21.000000000 +0100 -@@ -0,0 +1,862 @@ -+# -+# Automatically generated make config: don't edit -+# -+CONFIG_MIPS=y -+CONFIG_MIPS32=y -+# CONFIG_MIPS64 is not set -+ -+# -+# Code maturity level options -+# -+CONFIG_EXPERIMENTAL=y -+ -+# -+# Loadable module support -+# -+CONFIG_MODULES=y -+# CONFIG_MODVERSIONS is not set -+CONFIG_KMOD=y -+ -+# -+# Machine selection -+# -+# CONFIG_ACER_PICA_61 is not set -+# CONFIG_MIPS_BOSPORUS is not set -+# CONFIG_MIPS_MIRAGE is not set -+# CONFIG_MIPS_DB1000 is not set -+# CONFIG_MIPS_DB1100 is not set -+# CONFIG_MIPS_DB1500 is not set -+# CONFIG_MIPS_DB1550 is not set -+# CONFIG_MIPS_PB1000 is not set -+# CONFIG_MIPS_PB1100 is not set -+# CONFIG_MIPS_PB1500 is not set -+# CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set -+# CONFIG_MIPS_XXS1500 is not set -+# CONFIG_MIPS_MTX1 is not set -+# CONFIG_COGENT_CSB250 is not set -+# CONFIG_BAGET_MIPS is not set -+# CONFIG_CASIO_E55 is not set -+# CONFIG_MIPS_COBALT is not set -+# CONFIG_DECSTATION is not set -+# CONFIG_MIPS_EV64120 is not set -+# CONFIG_MIPS_EV96100 is not set -+# CONFIG_MIPS_IVR is not set -+# CONFIG_HP_LASERJET is not set -+# CONFIG_IBM_WORKPAD is not set -+# CONFIG_LASAT is not set -+# CONFIG_MIPS_ITE8172 is not set -+# CONFIG_MIPS_ATLAS is not set -+# CONFIG_MIPS_MAGNUM_4000 is not set -+# CONFIG_MIPS_MALTA is not set -+# CONFIG_MIPS_SEAD is not set -+# CONFIG_MOMENCO_OCELOT is not set -+# CONFIG_MOMENCO_OCELOT_G is not set -+# CONFIG_MOMENCO_OCELOT_C is not set -+# CONFIG_MOMENCO_JAGUAR_ATX is not set -+# CONFIG_PMC_BIG_SUR is not set -+# CONFIG_PMC_STRETCH is not set -+# CONFIG_PMC_YOSEMITE is not set -+# CONFIG_DDB5074 is not set -+# CONFIG_DDB5476 is not set -+# CONFIG_DDB5477 is not set -+# CONFIG_NEC_OSPREY is not set -+# CONFIG_NEC_EAGLE is not set -+# CONFIG_OLIVETTI_M700 is not set -+# CONFIG_NINO is not set -+# CONFIG_SGI_IP22 is not set -+# CONFIG_SGI_IP27 is not set -+# CONFIG_SIBYTE_SB1xxx_SOC is not set -+# CONFIG_SNI_RM200_PCI is not set -+# CONFIG_TANBAC_TB0226 is not set -+# CONFIG_TANBAC_TB0229 is not set -+# CONFIG_TOSHIBA_JMR3927 is not set -+# CONFIG_TOSHIBA_RBTX4927 is not set -+# CONFIG_VICTOR_MPC30X is not set -+# CONFIG_ZAO_CAPCELLA is not set -+# CONFIG_HIGHMEM is not set -+CONFIG_RWSEM_GENERIC_SPINLOCK=y -+# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set -+# CONFIG_MIPS_AU1000 is not set -+ -+# -+# CPU selection -+# -+CONFIG_CPU_MIPS32=y -+# CONFIG_CPU_MIPS64 is not set -+# CONFIG_CPU_R3000 is not set -+# CONFIG_CPU_TX39XX is not set -+# CONFIG_CPU_VR41XX is not set -+# CONFIG_CPU_R4300 is not set -+# CONFIG_CPU_R4X00 is not set -+# CONFIG_CPU_TX49XX is not set -+# CONFIG_CPU_R5000 is not set -+# CONFIG_CPU_R5432 is not set -+# CONFIG_CPU_R6000 is not set -+# CONFIG_CPU_NEVADA is not set -+# CONFIG_CPU_R8000 is not set -+# CONFIG_CPU_R10000 is not set -+# CONFIG_CPU_RM7000 is not set -+# CONFIG_CPU_RM9000 is not set -+# CONFIG_CPU_SB1 is not set -+CONFIG_PAGE_SIZE_4KB=y -+# CONFIG_PAGE_SIZE_16KB is not set -+# CONFIG_PAGE_SIZE_64KB is not set -+CONFIG_CPU_HAS_PREFETCH=y -+# CONFIG_VTAG_ICACHE is not set -+CONFIG_64BIT_PHYS_ADDR=y -+# CONFIG_CPU_ADVANCED is not set -+CONFIG_CPU_HAS_LLSC=y -+# CONFIG_CPU_HAS_LLDSCD is not set -+# CONFIG_CPU_HAS_WB is not set -+CONFIG_CPU_HAS_SYNC=y -+ -+# -+# General setup -+# -+CONFIG_CPU_LITTLE_ENDIAN=y -+# CONFIG_BUILD_ELF64 is not set -+CONFIG_NET=y -+# CONFIG_PCI is not set -+# CONFIG_PCI_NEW is not set -+CONFIG_PCI_AUTO=y -+# CONFIG_ISA is not set -+# CONFIG_TC is not set -+# CONFIG_MCA is not set -+# CONFIG_SBUS is not set -+# CONFIG_HOTPLUG is not set -+# CONFIG_PCMCIA is not set -+# CONFIG_HOTPLUG_PCI is not set -+CONFIG_SYSVIPC=y -+# CONFIG_BSD_PROCESS_ACCT is not set -+CONFIG_SYSCTL=y -+CONFIG_KCORE_ELF=y -+# CONFIG_KCORE_AOUT is not set -+# CONFIG_BINFMT_AOUT is not set -+CONFIG_BINFMT_ELF=y -+# CONFIG_MIPS32_COMPAT is not set -+# CONFIG_MIPS32_O32 is not set -+# CONFIG_MIPS32_N32 is not set -+# CONFIG_BINFMT_ELF32 is not set -+# CONFIG_BINFMT_MISC is not set -+# CONFIG_OOM_KILLER is not set -+CONFIG_CMDLINE_BOOL=y -+CONFIG_CMDLINE="ide3=dma mem=96M root=/dev/hda2 rootflags=data=journal" -+ -+# -+# Memory Technology Devices (MTD) -+# -+# CONFIG_MTD is not set -+ -+# -+# Parallel port support -+# -+# CONFIG_PARPORT is not set -+ -+# -+# Plug and Play configuration -+# -+# CONFIG_PNP is not set -+# CONFIG_ISAPNP is not set -+ -+# -+# Block devices -+# -+# CONFIG_BLK_DEV_FD is not set -+# CONFIG_BLK_DEV_XD is not set -+# CONFIG_PARIDE is not set -+# CONFIG_BLK_CPQ_DA is not set -+# CONFIG_BLK_CPQ_CISS_DA is not set -+# CONFIG_CISS_SCSI_TAPE is not set -+# CONFIG_CISS_MONITOR_THREAD is not set -+# CONFIG_BLK_DEV_DAC960 is not set -+# CONFIG_BLK_DEV_UMEM is not set -+# CONFIG_BLK_DEV_SX8 is not set -+CONFIG_BLK_DEV_LOOP=y -+# CONFIG_BLK_DEV_NBD is not set -+# CONFIG_BLK_DEV_RAM is not set -+# CONFIG_BLK_DEV_INITRD is not set -+# CONFIG_BLK_STATS is not set -+ -+# -+# Multi-device support (RAID and LVM) -+# -+# CONFIG_MD is not set -+# CONFIG_BLK_DEV_MD is not set -+# CONFIG_MD_LINEAR is not set -+# CONFIG_MD_RAID0 is not set -+# CONFIG_MD_RAID1 is not set -+# CONFIG_MD_RAID5 is not set -+# CONFIG_MD_MULTIPATH is not set -+# CONFIG_BLK_DEV_LVM is not set -+ -+# -+# Networking options -+# -+CONFIG_PACKET=y -+# CONFIG_PACKET_MMAP is not set -+# CONFIG_NETLINK_DEV is not set -+CONFIG_NETFILTER=y -+# CONFIG_NETFILTER_DEBUG is not set -+CONFIG_FILTER=y -+CONFIG_UNIX=y -+CONFIG_INET=y -+CONFIG_IP_MULTICAST=y -+# CONFIG_IP_ADVANCED_ROUTER is not set -+# CONFIG_IP_PNP is not set -+# CONFIG_NET_IPIP is not set -+# CONFIG_NET_IPGRE is not set -+# CONFIG_IP_MROUTE is not set -+# CONFIG_ARPD is not set -+# CONFIG_INET_ECN is not set -+# CONFIG_SYN_COOKIES is not set -+ -+# -+# IP: Netfilter Configuration -+# -+# CONFIG_IP_NF_CONNTRACK is not set -+# CONFIG_IP_NF_QUEUE is not set -+# CONFIG_IP_NF_IPTABLES is not set -+# CONFIG_IP_NF_ARPTABLES is not set -+# CONFIG_IP_NF_COMPAT_IPCHAINS is not set -+# CONFIG_IP_NF_COMPAT_IPFWADM is not set -+ -+# -+# IP: Virtual Server Configuration -+# -+# CONFIG_IP_VS is not set -+# CONFIG_IPV6 is not set -+# CONFIG_KHTTPD is not set -+ -+# -+# SCTP Configuration (EXPERIMENTAL) -+# -+# CONFIG_IP_SCTP is not set -+# CONFIG_ATM is not set -+# CONFIG_VLAN_8021Q is not set -+ -+# -+# -+# -+# CONFIG_IPX is not set -+# CONFIG_ATALK is not set -+# CONFIG_DECNET is not set -+# CONFIG_BRIDGE is not set -+# CONFIG_X25 is not set -+# CONFIG_LAPB is not set -+# CONFIG_LLC is not set -+# CONFIG_NET_DIVERT is not set -+# CONFIG_ECONET is not set -+# CONFIG_WAN_ROUTER is not set -+# CONFIG_NET_FASTROUTE is not set -+# CONFIG_NET_HW_FLOWCONTROL is not set -+ -+# -+# QoS and/or fair queueing -+# -+# CONFIG_NET_SCHED is not set -+ -+# -+# Network testing -+# -+# CONFIG_NET_PKTGEN is not set -+ -+# -+# Telephony Support -+# -+# CONFIG_PHONE is not set -+# CONFIG_PHONE_IXJ is not set -+# CONFIG_PHONE_IXJ_PCMCIA is not set -+ -+# -+# ATA/IDE/MFM/RLL support -+# -+CONFIG_IDE=y -+ -+# -+# IDE, ATA and ATAPI Block devices -+# -+CONFIG_BLK_DEV_IDE=y -+ -+# -+# Please see Documentation/ide.txt for help/info on IDE drives -+# -+CONFIG_BLK_DEV_HD_IDE=y -+CONFIG_BLK_DEV_HD=y -+# CONFIG_BLK_DEV_IDE_SATA is not set -+CONFIG_BLK_DEV_IDEDISK=y -+CONFIG_IDEDISK_MULTI_MODE=y -+CONFIG_IDEDISK_STROKE=y -+# CONFIG_BLK_DEV_IDECS is not set -+# CONFIG_BLK_DEV_DELKIN is not set -+# CONFIG_BLK_DEV_IDECD is not set -+# CONFIG_BLK_DEV_IDETAPE is not set -+# CONFIG_BLK_DEV_IDEFLOPPY is not set -+# CONFIG_BLK_DEV_IDESCSI is not set -+# CONFIG_IDE_TASK_IOCTL is not set -+ -+# -+# IDE chipset support/bugfixes -+# -+# CONFIG_BLK_DEV_CMD640 is not set -+# CONFIG_BLK_DEV_CMD640_ENHANCED is not set -+# CONFIG_BLK_DEV_ISAPNP is not set -+# CONFIG_IDE_CHIPSETS is not set -+# CONFIG_IDEDMA_AUTO is not set -+# CONFIG_DMA_NONPCI is not set -+# CONFIG_BLK_DEV_ATARAID is not set -+# CONFIG_BLK_DEV_ATARAID_PDC is not set -+# CONFIG_BLK_DEV_ATARAID_HPT is not set -+# CONFIG_BLK_DEV_ATARAID_MEDLEY is not set -+# CONFIG_BLK_DEV_ATARAID_SII is not set -+ -+# -+# SCSI support -+# -+CONFIG_SCSI=y -+ -+# -+# SCSI support type (disk, tape, CD-ROM) -+# -+CONFIG_BLK_DEV_SD=y -+CONFIG_SD_EXTRA_DEVS=40 -+CONFIG_CHR_DEV_ST=y -+# CONFIG_CHR_DEV_OSST is not set -+CONFIG_BLK_DEV_SR=y -+# CONFIG_BLK_DEV_SR_VENDOR is not set -+CONFIG_SR_EXTRA_DEVS=2 -+# CONFIG_CHR_DEV_SG is not set -+ -+# -+# Some SCSI devices (e.g. CD jukebox) support multiple LUNs -+# -+# CONFIG_SCSI_DEBUG_QUEUES is not set -+# CONFIG_SCSI_MULTI_LUN is not set -+CONFIG_SCSI_CONSTANTS=y -+# CONFIG_SCSI_LOGGING is not set -+ -+# -+# SCSI low-level drivers -+# -+# CONFIG_SCSI_7000FASST is not set -+# CONFIG_SCSI_ACARD is not set -+# CONFIG_SCSI_AHA152X is not set -+# CONFIG_SCSI_AHA1542 is not set -+# CONFIG_SCSI_AHA1740 is not set -+# CONFIG_SCSI_AACRAID is not set -+# CONFIG_SCSI_AIC7XXX is not set -+# CONFIG_SCSI_AIC79XX is not set -+# CONFIG_SCSI_AIC7XXX_OLD is not set -+# CONFIG_SCSI_DPT_I2O is not set -+# CONFIG_SCSI_ADVANSYS is not set -+# CONFIG_SCSI_IN2000 is not set -+# CONFIG_SCSI_AM53C974 is not set -+# CONFIG_SCSI_MEGARAID is not set -+# CONFIG_SCSI_MEGARAID2 is not set -+# CONFIG_SCSI_SATA is not set -+# CONFIG_SCSI_SATA_AHCI is not set -+# CONFIG_SCSI_SATA_SVW is not set -+# CONFIG_SCSI_ATA_PIIX is not set -+# CONFIG_SCSI_SATA_NV is not set -+# CONFIG_SCSI_SATA_QSTOR is not set -+# CONFIG_SCSI_SATA_PROMISE is not set -+# CONFIG_SCSI_SATA_SX4 is not set -+# CONFIG_SCSI_SATA_SIL is not set -+# CONFIG_SCSI_SATA_SIS is not set -+# CONFIG_SCSI_SATA_ULI is not set -+# CONFIG_SCSI_SATA_VIA is not set -+# CONFIG_SCSI_SATA_VITESSE is not set -+# CONFIG_SCSI_BUSLOGIC is not set -+# CONFIG_SCSI_DMX3191D 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_PIO 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_INITIO is not set -+# CONFIG_SCSI_INIA100 is not set -+# CONFIG_SCSI_NCR53C406A is not set -+# CONFIG_SCSI_NCR53C7xx is not set -+# CONFIG_SCSI_PAS16 is not set -+# CONFIG_SCSI_PCI2000 is not set -+# CONFIG_SCSI_PCI2220I is not set -+# CONFIG_SCSI_PSI240I is not set -+# CONFIG_SCSI_QLOGIC_FAS is not set -+# CONFIG_SCSI_SIM710 is not set -+# CONFIG_SCSI_SYM53C416 is not set -+# CONFIG_SCSI_T128 is not set -+# CONFIG_SCSI_U14_34F is not set -+# CONFIG_SCSI_NSP32 is not set -+# CONFIG_SCSI_DEBUG is not set -+ -+# -+# Fusion MPT device support -+# -+# CONFIG_FUSION is not set -+# CONFIG_FUSION_BOOT is not set -+# CONFIG_FUSION_ISENSE is not set -+# CONFIG_FUSION_CTL is not set -+# CONFIG_FUSION_LAN is not set -+ -+# -+# Network device support -+# -+CONFIG_NETDEVICES=y -+ -+# -+# ARCnet devices -+# -+# CONFIG_ARCNET is not set -+# CONFIG_DUMMY is not set -+# CONFIG_BONDING is not set -+# CONFIG_EQUALIZER is not set -+# CONFIG_TUN is not set -+# CONFIG_ETHERTAP is not set -+ -+# -+# Ethernet (10 or 100Mbit) -+# -+CONFIG_NET_ETHERNET=y -+# CONFIG_SUNLANCE is not set -+# CONFIG_SUNBMAC is not set -+# CONFIG_SUNQE is not set -+# CONFIG_SUNGEM 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 -+# CONFIG_NET_ISA is not set -+# CONFIG_NET_PCI is not set -+# CONFIG_NET_POCKET is not set -+ -+# -+# Ethernet (1000 Mbit) -+# -+# CONFIG_ACENIC is not set -+# CONFIG_DL2K is not set -+# CONFIG_E1000 is not set -+# CONFIG_MYRI_SBUS is not set -+# CONFIG_NS83820 is not set -+# CONFIG_HAMACHI is not set -+# CONFIG_YELLOWFIN is not set -+# CONFIG_R8169 is not set -+# CONFIG_SK98LIN is not set -+# CONFIG_TIGON3 is not set -+# CONFIG_FDDI is not set -+# CONFIG_HIPPI is not set -+# CONFIG_PLIP is not set -+# CONFIG_PPP is not set -+# CONFIG_SLIP is not set -+ -+# -+# Wireless LAN (non-hamradio) -+# -+# CONFIG_NET_RADIO is not set -+ -+# -+# Token Ring devices -+# -+# CONFIG_TR is not set -+# CONFIG_NET_FC is not set -+# CONFIG_RCPCI is not set -+# CONFIG_SHAPER is not set -+ -+# -+# Wan interfaces -+# -+# CONFIG_WAN is not set -+ -+# -+# Amateur Radio support -+# -+# CONFIG_HAMRADIO is not set -+ -+# -+# IrDA (infrared) support -+# -+# CONFIG_IRDA is not set -+ -+# -+# ISDN subsystem -+# -+# CONFIG_ISDN is not set -+ -+# -+# Input core support -+# -+CONFIG_INPUT=y -+CONFIG_INPUT_KEYBDEV=y -+CONFIG_INPUT_MOUSEDEV=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_UINPUT is not set -+ -+# -+# Character devices -+# -+CONFIG_VT=y -+CONFIG_VT_CONSOLE=y -+# CONFIG_SERIAL is not set -+# CONFIG_SERIAL_EXTENDED is not set -+CONFIG_SERIAL_NONSTANDARD=y -+# CONFIG_COMPUTONE is not set -+# CONFIG_ROCKETPORT is not set -+# CONFIG_CYCLADES is not set -+# CONFIG_DIGIEPCA is not set -+# CONFIG_DIGI is not set -+# CONFIG_ESPSERIAL is not set -+# CONFIG_MOXA_INTELLIO is not set -+# CONFIG_MOXA_SMARTIO is not set -+# CONFIG_ISI is not set -+# CONFIG_SYNCLINK is not set -+# CONFIG_SYNCLINKMP is not set -+# CONFIG_N_HDLC is not set -+# CONFIG_RISCOM8 is not set -+# CONFIG_SPECIALIX is not set -+# CONFIG_SX is not set -+# CONFIG_RIO is not set -+# CONFIG_STALDRV is not set -+# CONFIG_SERIAL_TX3912 is not set -+# CONFIG_SERIAL_TX3912_CONSOLE is not set -+# CONFIG_SERIAL_TXX9 is not set -+# CONFIG_SERIAL_TXX9_CONSOLE is not set -+# CONFIG_TXX927_SERIAL is not set -+CONFIG_UNIX98_PTYS=y -+CONFIG_UNIX98_PTY_COUNT=256 -+ -+# -+# I2C support -+# -+CONFIG_I2C=y -+# CONFIG_I2C_ALGOBIT is not set -+# CONFIG_SCx200_ACB is not set -+# CONFIG_I2C_ALGOPCF is not set -+# CONFIG_I2C_CHARDEV is not set -+# CONFIG_I2C_PROC is not set -+ -+# -+# Mice -+# -+# CONFIG_BUSMOUSE is not set -+# CONFIG_MOUSE is not set -+ -+# -+# Joysticks -+# -+# CONFIG_INPUT_GAMEPORT is not set -+# CONFIG_INPUT_NS558 is not set -+# CONFIG_INPUT_LIGHTNING is not set -+# CONFIG_INPUT_PCIGAME is not set -+# CONFIG_INPUT_CS461X is not set -+# CONFIG_INPUT_EMU10K1 is not set -+# CONFIG_INPUT_SERIO is not set -+# CONFIG_INPUT_SERPORT is not set -+ -+# -+# Joysticks -+# -+# CONFIG_INPUT_ANALOG is not set -+# CONFIG_INPUT_A3D is not set -+# CONFIG_INPUT_ADI is not set -+# CONFIG_INPUT_COBRA is not set -+# CONFIG_INPUT_GF2K is not set -+# CONFIG_INPUT_GRIP is not set -+# CONFIG_INPUT_INTERACT is not set -+# CONFIG_INPUT_TMDC is not set -+# CONFIG_INPUT_SIDEWINDER is not set -+# CONFIG_INPUT_IFORCE_USB is not set -+# CONFIG_INPUT_IFORCE_232 is not set -+# CONFIG_INPUT_WARRIOR is not set -+# CONFIG_INPUT_MAGELLAN is not set -+# CONFIG_INPUT_SPACEORB is not set -+# CONFIG_INPUT_SPACEBALL is not set -+# CONFIG_INPUT_STINGER is not set -+# CONFIG_INPUT_DB9 is not set -+# CONFIG_INPUT_GAMECON is not set -+# CONFIG_INPUT_TURBOGRAFX is not set -+# CONFIG_QIC02_TAPE is not set -+# CONFIG_IPMI_HANDLER is not set -+# CONFIG_IPMI_PANIC_EVENT is not set -+# CONFIG_IPMI_DEVICE_INTERFACE is not set -+# CONFIG_IPMI_KCS is not set -+# CONFIG_IPMI_WATCHDOG is not set -+ -+# -+# Watchdog Cards -+# -+# CONFIG_WATCHDOG is not set -+# CONFIG_SCx200 is not set -+# CONFIG_SCx200_GPIO is not set -+# CONFIG_AMD_PM768 is not set -+# CONFIG_NVRAM is not set -+# CONFIG_RTC is not set -+# CONFIG_DTLK is not set -+# CONFIG_R3964 is not set -+# CONFIG_APPLICOM is not set -+ -+# -+# Ftape, the floppy tape device driver -+# -+# CONFIG_FTAPE is not set -+# CONFIG_AGP is not set -+ -+# -+# Direct Rendering Manager (XFree86 DRI support) -+# -+# CONFIG_DRM is not set -+ -+# -+# File systems -+# -+# CONFIG_QUOTA is not set -+# CONFIG_QFMT_V2 is not set -+CONFIG_AUTOFS_FS=y -+# CONFIG_AUTOFS4_FS is not set -+# CONFIG_REISERFS_FS is not set -+# CONFIG_REISERFS_CHECK is not set -+# CONFIG_REISERFS_PROC_INFO is not set -+# CONFIG_ADFS_FS is not set -+# CONFIG_ADFS_FS_RW 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_BEFS_DEBUG is not set -+# CONFIG_BFS_FS is not set -+CONFIG_EXT3_FS=y -+CONFIG_JBD=y -+# CONFIG_JBD_DEBUG is not set -+CONFIG_FAT_FS=y -+CONFIG_MSDOS_FS=y -+# CONFIG_UMSDOS_FS is not set -+CONFIG_VFAT_FS=y -+# CONFIG_EFS_FS is not set -+# CONFIG_JFFS_FS is not set -+# CONFIG_JFFS2_FS is not set -+# CONFIG_CRAMFS is not set -+# CONFIG_TMPFS is not set -+CONFIG_RAMFS=y -+# CONFIG_ISO9660_FS is not set -+# CONFIG_JOLIET is not set -+# CONFIG_ZISOFS is not set -+# CONFIG_JFS_FS is not set -+# CONFIG_JFS_DEBUG is not set -+# CONFIG_JFS_STATISTICS is not set -+# CONFIG_MINIX_FS is not set -+# CONFIG_VXFS_FS is not set -+# CONFIG_NTFS_FS is not set -+# CONFIG_NTFS_RW is not set -+# CONFIG_HPFS_FS is not set -+CONFIG_PROC_FS=y -+# CONFIG_DEVFS_FS is not set -+# CONFIG_DEVFS_MOUNT is not set -+# CONFIG_DEVFS_DEBUG is not set -+CONFIG_DEVPTS_FS=y -+# CONFIG_QNX4FS_FS is not set -+# CONFIG_QNX4FS_RW is not set -+# CONFIG_ROMFS_FS is not set -+CONFIG_EXT2_FS=y -+# CONFIG_SYSV_FS is not set -+# CONFIG_UDF_FS is not set -+# CONFIG_UDF_RW is not set -+# CONFIG_UFS_FS is not set -+# CONFIG_UFS_FS_WRITE is not set -+# CONFIG_XFS_FS is not set -+# CONFIG_XFS_QUOTA is not set -+# CONFIG_XFS_RT is not set -+# CONFIG_XFS_TRACE is not set -+# CONFIG_XFS_DEBUG is not set -+ -+# -+# Network File Systems -+# -+# CONFIG_CODA_FS is not set -+# CONFIG_INTERMEZZO_FS is not set -+# CONFIG_NFS_FS is not set -+# CONFIG_NFS_V3 is not set -+# CONFIG_NFS_DIRECTIO is not set -+# CONFIG_ROOT_NFS is not set -+# CONFIG_NFSD is not set -+# CONFIG_NFSD_V3 is not set -+# CONFIG_NFSD_TCP is not set -+# CONFIG_SUNRPC is not set -+# CONFIG_LOCKD is not set -+# CONFIG_SMB_FS is not set -+# CONFIG_NCP_FS is not set -+# CONFIG_NCPFS_PACKET_SIGNING is not set -+# CONFIG_NCPFS_IOCTL_LOCKING is not set -+# CONFIG_NCPFS_STRONG is not set -+# CONFIG_NCPFS_NFS_NS is not set -+# CONFIG_NCPFS_OS2_NS is not set -+# CONFIG_NCPFS_SMALLDOS is not set -+# CONFIG_NCPFS_NLS is not set -+# CONFIG_NCPFS_EXTRAS is not set -+# CONFIG_ZISOFS_FS is not set -+ -+# -+# Partition Types -+# -+# CONFIG_PARTITION_ADVANCED is not set -+CONFIG_MSDOS_PARTITION=y -+# CONFIG_SMB_NLS is not set -+CONFIG_NLS=y -+ -+# -+# Native Language Support -+# -+CONFIG_NLS_DEFAULT="iso8859-1" -+# 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_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_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_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 -+ -+# -+# Multimedia devices -+# -+# CONFIG_VIDEO_DEV is not set -+ -+# -+# Console drivers -+# -+# CONFIG_VGA_CONSOLE is not set -+# CONFIG_MDA_CONSOLE is not set -+ -+# -+# Frame-buffer support -+# -+CONFIG_FB=y -+CONFIG_DUMMY_CONSOLE=y -+# CONFIG_FB_CYBER2000 is not set -+# CONFIG_FB_VIRTUAL is not set -+CONFIG_FBCON_ADVANCED=y -+# CONFIG_FBCON_MFB is not set -+# CONFIG_FBCON_CFB2 is not set -+# CONFIG_FBCON_CFB4 is not set -+# CONFIG_FBCON_CFB8 is not set -+CONFIG_FBCON_CFB16=y -+# CONFIG_FBCON_CFB24 is not set -+# CONFIG_FBCON_CFB32 is not set -+# CONFIG_FBCON_AFB is not set -+# CONFIG_FBCON_ILBM is not set -+# CONFIG_FBCON_IPLAN2P2 is not set -+# CONFIG_FBCON_IPLAN2P4 is not set -+# CONFIG_FBCON_IPLAN2P8 is not set -+# CONFIG_FBCON_MAC is not set -+# CONFIG_FBCON_VGA_PLANES is not set -+# CONFIG_FBCON_VGA is not set -+# CONFIG_FBCON_HGA is not set -+# CONFIG_FBCON_FONTWIDTH8_ONLY is not set -+CONFIG_FBCON_FONTS=y -+CONFIG_FONT_8x8=y -+CONFIG_FONT_8x16=y -+# CONFIG_FONT_SUN8x16 is not set -+# CONFIG_FONT_SUN12x22 is not set -+# CONFIG_FONT_6x11 is not set -+# CONFIG_FONT_PEARL_8x8 is not set -+# CONFIG_FONT_ACORN_8x8 is not set -+ -+# -+# Sound -+# -+CONFIG_SOUND=y -+# CONFIG_SOUND_ALI5455 is not set -+# CONFIG_SOUND_BT878 is not set -+# CONFIG_SOUND_CMPCI is not set -+# CONFIG_SOUND_EMU10K1 is not set -+# CONFIG_MIDI_EMU10K1 is not set -+# CONFIG_SOUND_FUSION is not set -+# CONFIG_SOUND_CS4281 is not set -+# CONFIG_SOUND_ES1370 is not set -+# CONFIG_SOUND_ES1371 is not set -+# CONFIG_SOUND_ESSSOLO1 is not set -+# CONFIG_SOUND_MAESTRO is not set -+# CONFIG_SOUND_MAESTRO3 is not set -+# CONFIG_SOUND_FORTE is not set -+# CONFIG_SOUND_ICH is not set -+# CONFIG_SOUND_RME96XX is not set -+# CONFIG_SOUND_SONICVIBES is not set -+# CONFIG_SOUND_TRIDENT is not set -+# CONFIG_SOUND_MSNDCLAS is not set -+# CONFIG_SOUND_MSNDPIN is not set -+# CONFIG_SOUND_VIA82CXXX is not set -+# CONFIG_MIDI_VIA82CXXX is not set -+# CONFIG_SOUND_OSS is not set -+# CONFIG_SOUND_TVMIXER is not set -+# CONFIG_SOUND_AD1980 is not set -+# CONFIG_SOUND_WM97XX is not set -+ -+# -+# USB support -+# -+# CONFIG_USB is not set -+ -+# -+# Support for USB gadgets -+# -+# CONFIG_USB_GADGET is not set -+ -+# -+# Bluetooth support -+# -+# CONFIG_BLUEZ is not set -+ -+# -+# Kernel hacking -+# -+CONFIG_CROSSCOMPILE=y -+# CONFIG_RUNTIME_DEBUG is not set -+# CONFIG_KGDB is not set -+# CONFIG_GDB_CONSOLE is not set -+# CONFIG_DEBUG_INFO is not set -+# CONFIG_MAGIC_SYSRQ is not set -+# CONFIG_MIPS_UNCACHED is not set -+CONFIG_LOG_BUF_SHIFT=0 -+ -+# -+# Cryptographic options -+# -+# CONFIG_CRYPTO is not set -+ -+# -+# Library routines -+# -+# CONFIG_CRC32 is not set -+CONFIG_ZLIB_INFLATE=m -+CONFIG_ZLIB_DEFLATE=m -diff -Nur linux-2.4.30/arch/mips/defconfig-hp-lj linux-2.4.30-mips/arch/mips/defconfig-hp-lj ---- linux-2.4.30/arch/mips/defconfig-hp-lj 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-hp-lj 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -184,8 +184,8 @@ - # Mapping drivers for chip access - # - CONFIG_MTD_PHYSMAP=y --CONFIG_MTD_PHYSMAP_START=10040000 --CONFIG_MTD_PHYSMAP_LEN=00fc0000 -+CONFIG_MTD_PHYSMAP_START=0x10040000 -+CONFIG_MTD_PHYSMAP_LEN=0x00fc0000 - CONFIG_MTD_PHYSMAP_BUSWIDTH=4 - # CONFIG_MTD_PB1000 is not set - # CONFIG_MTD_PB1500 is not set -@@ -193,9 +193,7 @@ - # CONFIG_MTD_BOSPORUS is not set - # CONFIG_MTD_XXS1500 is not set - # CONFIG_MTD_MTX1 is not set --# CONFIG_MTD_DB1X00 is not set - # CONFIG_MTD_PB1550 is not set --# CONFIG_MTD_HYDROGEN3 is not set - # CONFIG_MTD_MIRAGE is not set - # CONFIG_MTD_CSTM_MIPS_IXX is not set - # CONFIG_MTD_OCELOT is not set -@@ -214,7 +212,6 @@ - # - # Disk-On-Chip Device Drivers - # --# CONFIG_MTD_DOC1000 is not set - # CONFIG_MTD_DOC2000 is not set - # CONFIG_MTD_DOC2001 is not set - # CONFIG_MTD_DOCPROBE is not set -@@ -304,11 +301,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -604,7 +596,6 @@ - CONFIG_SERIAL_CONSOLE=y - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - # CONFIG_UNIX98_PTYS is not set - - # -diff -Nur linux-2.4.30/arch/mips/defconfig-hydrogen3 linux-2.4.30-mips/arch/mips/defconfig-hydrogen3 ---- linux-2.4.30/arch/mips/defconfig-hydrogen3 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-hydrogen3 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --CONFIG_MIPS_HYDROGEN3=y - # CONFIG_MIPS_PB1550 is not set -+CONFIG_MIPS_HYDROGEN3=y - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -214,9 +214,7 @@ - # CONFIG_MTD_BOSPORUS is not set - # CONFIG_MTD_XXS1500 is not set - # CONFIG_MTD_MTX1 is not set --# CONFIG_MTD_DB1X00 is not set - # CONFIG_MTD_PB1550 is not set --CONFIG_MTD_HYDROGEN3=y - # CONFIG_MTD_MIRAGE is not set - # CONFIG_MTD_CSTM_MIPS_IXX is not set - # CONFIG_MTD_OCELOT is not set -@@ -235,7 +233,6 @@ - # - # Disk-On-Chip Device Drivers - # --# CONFIG_MTD_DOC1000 is not set - # CONFIG_MTD_DOC2000 is not set - # CONFIG_MTD_DOC2001 is not set - # CONFIG_MTD_DOCPROBE is not set -@@ -340,11 +337,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -590,7 +582,6 @@ - # CONFIG_AU1X00_USB_TTY is not set - # CONFIG_AU1X00_USB_RAW is not set - # CONFIG_TXX927_SERIAL is not set --CONFIG_MIPS_HYDROGEN3_BUTTONS=y - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -@@ -838,6 +829,7 @@ - # CONFIG_FB_PM2 is not set - # CONFIG_FB_PM3 is not set - # CONFIG_FB_CYBER2000 is not set -+CONFIG_FB_AU1100=y - # CONFIG_FB_MATROX is not set - # CONFIG_FB_ATY is not set - # CONFIG_FB_RADEON is not set -@@ -849,7 +841,6 @@ - # CONFIG_FB_VOODOO1 is not set - # CONFIG_FB_TRIDENT is not set - # CONFIG_FB_E1356 is not set --CONFIG_FB_AU1100=y - # CONFIG_FB_IT8181 is not set - # CONFIG_FB_VIRTUAL is not set - CONFIG_FBCON_ADVANCED=y -diff -Nur linux-2.4.30/arch/mips/defconfig-ip22 linux-2.4.30-mips/arch/mips/defconfig-ip22 ---- linux-2.4.30/arch/mips/defconfig-ip22 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-ip22 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -235,11 +235,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -319,9 +314,11 @@ - # CONFIG_SCSI_MEGARAID is not set - # CONFIG_SCSI_MEGARAID2 is not set - # CONFIG_SCSI_SATA is not set -+# CONFIG_SCSI_SATA_AHCI is not set - # CONFIG_SCSI_SATA_SVW is not set - # CONFIG_SCSI_ATA_PIIX is not set - # CONFIG_SCSI_SATA_NV is not set -+# CONFIG_SCSI_SATA_QSTOR is not set - # CONFIG_SCSI_SATA_PROMISE is not set - # CONFIG_SCSI_SATA_SX4 is not set - # CONFIG_SCSI_SATA_SIL is not set -@@ -465,7 +462,6 @@ - # CONFIG_SERIAL is not set - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-it8172 linux-2.4.30-mips/arch/mips/defconfig-it8172 ---- linux-2.4.30/arch/mips/defconfig-it8172 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-it8172 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -186,8 +186,8 @@ - # Mapping drivers for chip access - # - CONFIG_MTD_PHYSMAP=y --CONFIG_MTD_PHYSMAP_START=8000000 --CONFIG_MTD_PHYSMAP_LEN=2000000 -+CONFIG_MTD_PHYSMAP_START=0x8000000 -+CONFIG_MTD_PHYSMAP_LEN=0x2000000 - CONFIG_MTD_PHYSMAP_BUSWIDTH=4 - # CONFIG_MTD_PB1000 is not set - # CONFIG_MTD_PB1500 is not set -@@ -195,9 +195,7 @@ - # CONFIG_MTD_BOSPORUS is not set - # CONFIG_MTD_XXS1500 is not set - # CONFIG_MTD_MTX1 is not set --# CONFIG_MTD_DB1X00 is not set - # CONFIG_MTD_PB1550 is not set --# CONFIG_MTD_HYDROGEN3 is not set - # CONFIG_MTD_MIRAGE is not set - # CONFIG_MTD_CSTM_MIPS_IXX is not set - # CONFIG_MTD_OCELOT is not set -@@ -216,7 +214,6 @@ - # - # Disk-On-Chip Device Drivers - # --# CONFIG_MTD_DOC1000 is not set - # CONFIG_MTD_DOC2000 is not set - # CONFIG_MTD_DOC2001 is not set - # CONFIG_MTD_DOCPROBE is not set -@@ -304,11 +301,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -592,7 +584,6 @@ - CONFIG_PC_KEYB=y - # CONFIG_IT8172_SCR0 is not set - # CONFIG_IT8172_SCR1 is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-ivr linux-2.4.30-mips/arch/mips/defconfig-ivr ---- linux-2.4.30/arch/mips/defconfig-ivr 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-ivr 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -226,11 +226,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -516,7 +511,6 @@ - CONFIG_QTRONIX_KEYBOARD=y - CONFIG_IT8172_CIR=y - # CONFIG_IT8172_SCR0 is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-jmr3927 linux-2.4.30-mips/arch/mips/defconfig-jmr3927 ---- linux-2.4.30/arch/mips/defconfig-jmr3927 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-jmr3927 2005-03-18 13:13:21.000000000 +0100 -@@ -28,8 +28,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -225,11 +225,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -454,7 +449,6 @@ - # CONFIG_SERIAL_TXX9_CONSOLE is not set - CONFIG_TXX927_SERIAL=y - CONFIG_TXX927_SERIAL_CONSOLE=y --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - # CONFIG_UNIX98_PTYS is not set - - # -diff -Nur linux-2.4.30/arch/mips/defconfig-lasat linux-2.4.30-mips/arch/mips/defconfig-lasat ---- linux-2.4.30/arch/mips/defconfig-lasat 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-lasat 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -198,9 +198,7 @@ - # CONFIG_MTD_BOSPORUS is not set - # CONFIG_MTD_XXS1500 is not set - # CONFIG_MTD_MTX1 is not set --# CONFIG_MTD_DB1X00 is not set - # CONFIG_MTD_PB1550 is not set --# CONFIG_MTD_HYDROGEN3 is not set - # CONFIG_MTD_MIRAGE is not set - # CONFIG_MTD_CSTM_MIPS_IXX is not set - # CONFIG_MTD_OCELOT is not set -@@ -219,7 +217,6 @@ - # - # Disk-On-Chip Device Drivers - # --# CONFIG_MTD_DOC1000 is not set - # CONFIG_MTD_DOC2000 is not set - # CONFIG_MTD_DOC2001 is not set - # CONFIG_MTD_DOCPROBE is not set -@@ -303,11 +300,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -584,7 +576,6 @@ - CONFIG_SERIAL_CONSOLE=y - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-malta linux-2.4.30-mips/arch/mips/defconfig-malta ---- linux-2.4.30/arch/mips/defconfig-malta 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-malta 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -237,11 +237,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -319,9 +314,11 @@ - # CONFIG_SCSI_MEGARAID is not set - # CONFIG_SCSI_MEGARAID2 is not set - # CONFIG_SCSI_SATA is not set -+# CONFIG_SCSI_SATA_AHCI is not set - # CONFIG_SCSI_SATA_SVW is not set - # CONFIG_SCSI_ATA_PIIX is not set - # CONFIG_SCSI_SATA_NV is not set -+# CONFIG_SCSI_SATA_QSTOR is not set - # CONFIG_SCSI_SATA_PROMISE is not set - # CONFIG_SCSI_SATA_SX4 is not set - # CONFIG_SCSI_SATA_SIL is not set -@@ -524,7 +521,6 @@ - CONFIG_SERIAL_CONSOLE=y - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-mirage linux-2.4.30-mips/arch/mips/defconfig-mirage ---- linux-2.4.30/arch/mips/defconfig-mirage 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-mirage 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -209,9 +209,7 @@ - # CONFIG_MTD_BOSPORUS is not set - # CONFIG_MTD_XXS1500 is not set - # CONFIG_MTD_MTX1 is not set --# CONFIG_MTD_DB1X00 is not set - # CONFIG_MTD_PB1550 is not set --# CONFIG_MTD_HYDROGEN3 is not set - CONFIG_MTD_MIRAGE=y - # CONFIG_MTD_CSTM_MIPS_IXX is not set - # CONFIG_MTD_OCELOT is not set -@@ -230,7 +228,6 @@ - # - # Disk-On-Chip Device Drivers - # --# CONFIG_MTD_DOC1000 is not set - # CONFIG_MTD_DOC2000 is not set - # CONFIG_MTD_DOC2001 is not set - # CONFIG_MTD_DOCPROBE is not set -@@ -335,11 +332,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -560,7 +552,6 @@ - # CONFIG_AU1X00_USB_TTY is not set - # CONFIG_AU1X00_USB_RAW is not set - # CONFIG_TXX927_SERIAL is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-mpc30x linux-2.4.30-mips/arch/mips/defconfig-mpc30x ---- linux-2.4.30/arch/mips/defconfig-mpc30x 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-mpc30x 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -228,11 +228,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -400,7 +395,6 @@ - CONFIG_SERIAL_CONSOLE=y - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - # CONFIG_VR41XX_KIU is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 -diff -Nur linux-2.4.30/arch/mips/defconfig-mtx-1 linux-2.4.30-mips/arch/mips/defconfig-mtx-1 ---- linux-2.4.30/arch/mips/defconfig-mtx-1 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-mtx-1 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - CONFIG_MIPS_MTX1=y - # CONFIG_COGENT_CSB250 is not set -@@ -193,9 +193,7 @@ - # CONFIG_MTD_BOSPORUS is not set - # CONFIG_MTD_XXS1500 is not set - CONFIG_MTD_MTX1=y --# CONFIG_MTD_DB1X00 is not set - # CONFIG_MTD_PB1550 is not set --# CONFIG_MTD_HYDROGEN3 is not set - # CONFIG_MTD_MIRAGE is not set - # CONFIG_MTD_CSTM_MIPS_IXX is not set - # CONFIG_MTD_OCELOT is not set -@@ -214,7 +212,6 @@ - # - # Disk-On-Chip Device Drivers - # --# CONFIG_MTD_DOC1000 is not set - # CONFIG_MTD_DOC2000 is not set - # CONFIG_MTD_DOC2001 is not set - # CONFIG_MTD_DOCPROBE is not set -@@ -371,11 +368,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - CONFIG_BRIDGE=m - # CONFIG_X25 is not set -@@ -479,9 +471,11 @@ - # CONFIG_SCSI_MEGARAID is not set - # CONFIG_SCSI_MEGARAID2 is not set - # CONFIG_SCSI_SATA is not set -+# CONFIG_SCSI_SATA_AHCI is not set - # CONFIG_SCSI_SATA_SVW is not set - # CONFIG_SCSI_ATA_PIIX is not set - # CONFIG_SCSI_SATA_NV is not set -+# CONFIG_SCSI_SATA_QSTOR is not set - # CONFIG_SCSI_SATA_PROMISE is not set - # CONFIG_SCSI_SATA_SX4 is not set - # CONFIG_SCSI_SATA_SIL is not set -@@ -700,7 +694,6 @@ - # CONFIG_AU1X00_USB_TTY is not set - # CONFIG_AU1X00_USB_RAW is not set - # CONFIG_TXX927_SERIAL is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-nino linux-2.4.30-mips/arch/mips/defconfig-nino ---- linux-2.4.30/arch/mips/defconfig-nino 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-nino 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -226,11 +226,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -339,7 +334,6 @@ - # CONFIG_SERIAL_TXX9 is not set - # CONFIG_SERIAL_TXX9_CONSOLE is not set - # CONFIG_TXX927_SERIAL is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - # CONFIG_UNIX98_PTYS is not set - - # -diff -Nur linux-2.4.30/arch/mips/defconfig-ocelot linux-2.4.30-mips/arch/mips/defconfig-ocelot ---- linux-2.4.30/arch/mips/defconfig-ocelot 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-ocelot 2005-03-18 13:13:21.000000000 +0100 -@@ -28,8 +28,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -194,9 +194,7 @@ - # CONFIG_MTD_BOSPORUS is not set - # CONFIG_MTD_XXS1500 is not set - # CONFIG_MTD_MTX1 is not set --# CONFIG_MTD_DB1X00 is not set - # CONFIG_MTD_PB1550 is not set --# CONFIG_MTD_HYDROGEN3 is not set - # CONFIG_MTD_MIRAGE is not set - # CONFIG_MTD_CSTM_MIPS_IXX is not set - CONFIG_MTD_OCELOT=y -@@ -215,7 +213,6 @@ - # - # Disk-On-Chip Device Drivers - # --# CONFIG_MTD_DOC1000 is not set - CONFIG_MTD_DOC2000=y - # CONFIG_MTD_DOC2001 is not set - CONFIG_MTD_DOCPROBE=y -@@ -307,11 +304,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -513,7 +505,6 @@ - CONFIG_SERIAL_CONSOLE=y - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-osprey linux-2.4.30-mips/arch/mips/defconfig-osprey ---- linux-2.4.30/arch/mips/defconfig-osprey 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-osprey 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -227,11 +227,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -388,7 +383,6 @@ - # CONFIG_SERIAL_MULTIPORT is not set - # CONFIG_HUB6 is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - # CONFIG_VR41XX_KIU is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 -diff -Nur linux-2.4.30/arch/mips/defconfig-pb1000 linux-2.4.30-mips/arch/mips/defconfig-pb1000 ---- linux-2.4.30/arch/mips/defconfig-pb1000 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-pb1000 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - CONFIG_MIPS_PB1000=y - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -215,9 +215,7 @@ - # CONFIG_MTD_BOSPORUS is not set - # CONFIG_MTD_XXS1500 is not set - # CONFIG_MTD_MTX1 is not set --# CONFIG_MTD_DB1X00 is not set - # CONFIG_MTD_PB1550 is not set --# CONFIG_MTD_HYDROGEN3 is not set - # CONFIG_MTD_MIRAGE is not set - # CONFIG_MTD_CSTM_MIPS_IXX is not set - # CONFIG_MTD_OCELOT is not set -@@ -236,7 +234,6 @@ - # - # Disk-On-Chip Device Drivers - # --# CONFIG_MTD_DOC1000 is not set - # CONFIG_MTD_DOC2000 is not set - # CONFIG_MTD_DOC2001 is not set - # CONFIG_MTD_DOCPROBE is not set -@@ -324,11 +321,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -622,7 +614,6 @@ - # CONFIG_AU1X00_USB_TTY is not set - # CONFIG_AU1X00_USB_RAW is not set - # CONFIG_TXX927_SERIAL is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -@@ -707,7 +698,7 @@ - # - # CONFIG_PCMCIA_SERIAL_CS is not set - # CONFIG_SYNCLINK_CS is not set --CONFIG_AU1X00_GPIO=m -+CONFIG_AU1X00_GPIO=y - # CONFIG_TS_AU1X00_ADS7846 is not set - - # -diff -Nur linux-2.4.30/arch/mips/defconfig-pb1100 linux-2.4.30-mips/arch/mips/defconfig-pb1100 ---- linux-2.4.30/arch/mips/defconfig-pb1100 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-pb1100 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - CONFIG_MIPS_PB1100=y - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -198,9 +198,7 @@ - # CONFIG_MTD_MTX1 is not set - CONFIG_MTD_PB1500_BOOT=y - CONFIG_MTD_PB1500_USER=y --# CONFIG_MTD_DB1X00 is not set - # CONFIG_MTD_PB1550 is not set --# CONFIG_MTD_HYDROGEN3 is not set - # CONFIG_MTD_MIRAGE is not set - # CONFIG_MTD_CSTM_MIPS_IXX is not set - # CONFIG_MTD_OCELOT is not set -@@ -219,7 +217,6 @@ - # - # Disk-On-Chip Device Drivers - # --# CONFIG_MTD_DOC1000 is not set - # CONFIG_MTD_DOC2000 is not set - # CONFIG_MTD_DOC2001 is not set - # CONFIG_MTD_DOCPROBE is not set -@@ -324,11 +321,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -613,7 +605,6 @@ - # CONFIG_AU1X00_USB_TTY is not set - # CONFIG_AU1X00_USB_RAW is not set - # CONFIG_TXX927_SERIAL is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -@@ -859,6 +850,7 @@ - # CONFIG_FB_PM2 is not set - # CONFIG_FB_PM3 is not set - # CONFIG_FB_CYBER2000 is not set -+CONFIG_FB_AU1100=y - # CONFIG_FB_MATROX is not set - # CONFIG_FB_ATY is not set - # CONFIG_FB_RADEON is not set -@@ -870,7 +862,6 @@ - # CONFIG_FB_VOODOO1 is not set - # CONFIG_FB_TRIDENT is not set - # CONFIG_FB_E1356 is not set --CONFIG_FB_AU1100=y - # CONFIG_FB_IT8181 is not set - # CONFIG_FB_VIRTUAL is not set - CONFIG_FBCON_ADVANCED=y -diff -Nur linux-2.4.30/arch/mips/defconfig-pb1200 linux-2.4.30-mips/arch/mips/defconfig-pb1200 ---- linux-2.4.30/arch/mips/defconfig-pb1200 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-pb1200 2005-03-18 13:13:21.000000000 +0100 -@@ -0,0 +1,1060 @@ -+# -+# Automatically generated make config: don't edit -+# -+CONFIG_MIPS=y -+CONFIG_MIPS32=y -+# CONFIG_MIPS64 is not set -+ -+# -+# Code maturity level options -+# -+CONFIG_EXPERIMENTAL=y -+ -+# -+# Loadable module support -+# -+CONFIG_MODULES=y -+# CONFIG_MODVERSIONS is not set -+CONFIG_KMOD=y -+ -+# -+# Machine selection -+# -+# CONFIG_ACER_PICA_61 is not set -+# CONFIG_MIPS_BOSPORUS is not set -+# CONFIG_MIPS_MIRAGE is not set -+# CONFIG_MIPS_DB1000 is not set -+# CONFIG_MIPS_DB1100 is not set -+# CONFIG_MIPS_DB1500 is not set -+# CONFIG_MIPS_DB1550 is not set -+# CONFIG_MIPS_PB1000 is not set -+# CONFIG_MIPS_PB1100 is not set -+# CONFIG_MIPS_PB1500 is not set -+# CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set -+# CONFIG_MIPS_XXS1500 is not set -+# CONFIG_MIPS_MTX1 is not set -+# CONFIG_COGENT_CSB250 is not set -+# CONFIG_BAGET_MIPS is not set -+# CONFIG_CASIO_E55 is not set -+# CONFIG_MIPS_COBALT is not set -+# CONFIG_DECSTATION is not set -+# CONFIG_MIPS_EV64120 is not set -+# CONFIG_MIPS_EV96100 is not set -+# CONFIG_MIPS_IVR is not set -+# CONFIG_HP_LASERJET is not set -+# CONFIG_IBM_WORKPAD is not set -+# CONFIG_LASAT is not set -+# CONFIG_MIPS_ITE8172 is not set -+# CONFIG_MIPS_ATLAS is not set -+# CONFIG_MIPS_MAGNUM_4000 is not set -+# CONFIG_MIPS_MALTA is not set -+# CONFIG_MIPS_SEAD is not set -+# CONFIG_MOMENCO_OCELOT is not set -+# CONFIG_MOMENCO_OCELOT_G is not set -+# CONFIG_MOMENCO_OCELOT_C is not set -+# CONFIG_MOMENCO_JAGUAR_ATX is not set -+# CONFIG_PMC_BIG_SUR is not set -+# CONFIG_PMC_STRETCH is not set -+# CONFIG_PMC_YOSEMITE is not set -+# CONFIG_DDB5074 is not set -+# CONFIG_DDB5476 is not set -+# CONFIG_DDB5477 is not set -+# CONFIG_NEC_OSPREY is not set -+# CONFIG_NEC_EAGLE is not set -+# CONFIG_OLIVETTI_M700 is not set -+# CONFIG_NINO is not set -+# CONFIG_SGI_IP22 is not set -+# CONFIG_SGI_IP27 is not set -+# CONFIG_SIBYTE_SB1xxx_SOC is not set -+# CONFIG_SNI_RM200_PCI is not set -+# CONFIG_TANBAC_TB0226 is not set -+# CONFIG_TANBAC_TB0229 is not set -+# CONFIG_TOSHIBA_JMR3927 is not set -+# CONFIG_TOSHIBA_RBTX4927 is not set -+# CONFIG_VICTOR_MPC30X is not set -+# CONFIG_ZAO_CAPCELLA is not set -+# CONFIG_HIGHMEM is not set -+CONFIG_RWSEM_GENERIC_SPINLOCK=y -+# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set -+CONFIG_SOC_AU1X00=y -+CONFIG_SOC_AU1200=y -+CONFIG_NONCOHERENT_IO=y -+CONFIG_PC_KEYB=y -+# CONFIG_MIPS_AU1000 is not set -+ -+# -+# CPU selection -+# -+CONFIG_CPU_MIPS32=y -+# CONFIG_CPU_MIPS64 is not set -+# CONFIG_CPU_R3000 is not set -+# CONFIG_CPU_TX39XX is not set -+# CONFIG_CPU_VR41XX is not set -+# CONFIG_CPU_R4300 is not set -+# CONFIG_CPU_R4X00 is not set -+# CONFIG_CPU_TX49XX is not set -+# CONFIG_CPU_R5000 is not set -+# CONFIG_CPU_R5432 is not set -+# CONFIG_CPU_R6000 is not set -+# CONFIG_CPU_NEVADA is not set -+# CONFIG_CPU_R8000 is not set -+# CONFIG_CPU_R10000 is not set -+# CONFIG_CPU_RM7000 is not set -+# CONFIG_CPU_RM9000 is not set -+# CONFIG_CPU_SB1 is not set -+CONFIG_PAGE_SIZE_4KB=y -+# CONFIG_PAGE_SIZE_16KB is not set -+# CONFIG_PAGE_SIZE_64KB is not set -+CONFIG_CPU_HAS_PREFETCH=y -+# CONFIG_VTAG_ICACHE is not set -+CONFIG_64BIT_PHYS_ADDR=y -+# CONFIG_CPU_ADVANCED is not set -+CONFIG_CPU_HAS_LLSC=y -+# CONFIG_CPU_HAS_LLDSCD is not set -+# CONFIG_CPU_HAS_WB is not set -+CONFIG_CPU_HAS_SYNC=y -+ -+# -+# General setup -+# -+CONFIG_CPU_LITTLE_ENDIAN=y -+# CONFIG_BUILD_ELF64 is not set -+CONFIG_NET=y -+CONFIG_PCI=y -+CONFIG_PCI_NEW=y -+CONFIG_PCI_AUTO=y -+# CONFIG_PCI_NAMES is not set -+# CONFIG_ISA is not set -+# CONFIG_TC is not set -+# CONFIG_MCA is not set -+# CONFIG_SBUS is not set -+CONFIG_HOTPLUG=y -+ -+# -+# PCMCIA/CardBus support -+# -+CONFIG_PCMCIA=m -+# CONFIG_CARDBUS is not set -+# CONFIG_TCIC is not set -+# CONFIG_I82092 is not set -+# CONFIG_I82365 is not set -+CONFIG_PCMCIA_AU1X00=m -+ -+# -+# PCI Hotplug Support -+# -+# CONFIG_HOTPLUG_PCI is not set -+# CONFIG_HOTPLUG_PCI_COMPAQ is not set -+# CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM is not set -+# CONFIG_HOTPLUG_PCI_SHPC is not set -+# CONFIG_HOTPLUG_PCI_SHPC_POLL_EVENT_MODE is not set -+# CONFIG_HOTPLUG_PCI_PCIE is not set -+# CONFIG_HOTPLUG_PCI_PCIE_POLL_EVENT_MODE is not set -+CONFIG_SYSVIPC=y -+# CONFIG_BSD_PROCESS_ACCT is not set -+CONFIG_SYSCTL=y -+CONFIG_KCORE_ELF=y -+# CONFIG_KCORE_AOUT is not set -+# CONFIG_BINFMT_AOUT is not set -+CONFIG_BINFMT_ELF=y -+# CONFIG_MIPS32_COMPAT is not set -+# CONFIG_MIPS32_O32 is not set -+# CONFIG_MIPS32_N32 is not set -+# CONFIG_BINFMT_ELF32 is not set -+# CONFIG_BINFMT_MISC is not set -+# CONFIG_OOM_KILLER is not set -+CONFIG_CMDLINE_BOOL=y -+CONFIG_CMDLINE="mem=96M" -+# CONFIG_PM is not set -+ -+# -+# Memory Technology Devices (MTD) -+# -+# CONFIG_MTD is not set -+ -+# -+# Parallel port support -+# -+# CONFIG_PARPORT is not set -+ -+# -+# Plug and Play configuration -+# -+# CONFIG_PNP is not set -+# CONFIG_ISAPNP is not set -+ -+# -+# Block devices -+# -+# CONFIG_BLK_DEV_FD is not set -+# CONFIG_BLK_DEV_XD is not set -+# CONFIG_PARIDE is not set -+# CONFIG_BLK_CPQ_DA is not set -+# CONFIG_BLK_CPQ_CISS_DA is not set -+# CONFIG_CISS_SCSI_TAPE is not set -+# CONFIG_CISS_MONITOR_THREAD is not set -+# CONFIG_BLK_DEV_DAC960 is not set -+# CONFIG_BLK_DEV_UMEM is not set -+# CONFIG_BLK_DEV_SX8 is not set -+CONFIG_BLK_DEV_LOOP=y -+# CONFIG_BLK_DEV_NBD is not set -+# CONFIG_BLK_DEV_RAM is not set -+# CONFIG_BLK_DEV_INITRD is not set -+# CONFIG_BLK_STATS is not set -+ -+# -+# Multi-device support (RAID and LVM) -+# -+# CONFIG_MD is not set -+# CONFIG_BLK_DEV_MD is not set -+# CONFIG_MD_LINEAR is not set -+# CONFIG_MD_RAID0 is not set -+# CONFIG_MD_RAID1 is not set -+# CONFIG_MD_RAID5 is not set -+# CONFIG_MD_MULTIPATH is not set -+# CONFIG_BLK_DEV_LVM is not set -+ -+# -+# Networking options -+# -+CONFIG_PACKET=y -+# CONFIG_PACKET_MMAP is not set -+# CONFIG_NETLINK_DEV is not set -+CONFIG_NETFILTER=y -+# CONFIG_NETFILTER_DEBUG is not set -+CONFIG_FILTER=y -+CONFIG_UNIX=y -+CONFIG_INET=y -+CONFIG_IP_MULTICAST=y -+# CONFIG_IP_ADVANCED_ROUTER is not set -+CONFIG_IP_PNP=y -+# CONFIG_IP_PNP_DHCP is not set -+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_IP_MROUTE is not set -+# CONFIG_ARPD is not set -+# CONFIG_INET_ECN is not set -+# CONFIG_SYN_COOKIES is not set -+ -+# -+# IP: Netfilter Configuration -+# -+# CONFIG_IP_NF_CONNTRACK is not set -+# CONFIG_IP_NF_QUEUE is not set -+# CONFIG_IP_NF_IPTABLES is not set -+# CONFIG_IP_NF_ARPTABLES is not set -+# CONFIG_IP_NF_COMPAT_IPCHAINS is not set -+# CONFIG_IP_NF_COMPAT_IPFWADM is not set -+ -+# -+# IP: Virtual Server Configuration -+# -+# CONFIG_IP_VS is not set -+# CONFIG_IPV6 is not set -+# CONFIG_KHTTPD is not set -+ -+# -+# SCTP Configuration (EXPERIMENTAL) -+# -+# CONFIG_IP_SCTP is not set -+# CONFIG_ATM is not set -+# CONFIG_VLAN_8021Q is not set -+ -+# -+# -+# -+# CONFIG_IPX is not set -+# CONFIG_ATALK is not set -+# CONFIG_DECNET is not set -+# CONFIG_BRIDGE is not set -+# CONFIG_X25 is not set -+# CONFIG_LAPB is not set -+# CONFIG_LLC is not set -+# CONFIG_NET_DIVERT is not set -+# CONFIG_ECONET is not set -+# CONFIG_WAN_ROUTER is not set -+# CONFIG_NET_FASTROUTE is not set -+# CONFIG_NET_HW_FLOWCONTROL is not set -+ -+# -+# QoS and/or fair queueing -+# -+# CONFIG_NET_SCHED is not set -+ -+# -+# Network testing -+# -+# CONFIG_NET_PKTGEN is not set -+ -+# -+# Telephony Support -+# -+# CONFIG_PHONE is not set -+# CONFIG_PHONE_IXJ is not set -+# CONFIG_PHONE_IXJ_PCMCIA is not set -+ -+# -+# ATA/IDE/MFM/RLL support -+# -+CONFIG_IDE=y -+ -+# -+# IDE, ATA and ATAPI Block devices -+# -+CONFIG_BLK_DEV_IDE=y -+ -+# -+# Please see Documentation/ide.txt for help/info on IDE drives -+# -+# CONFIG_BLK_DEV_HD_IDE is not set -+# CONFIG_BLK_DEV_HD is not set -+# CONFIG_BLK_DEV_IDE_SATA is not set -+CONFIG_BLK_DEV_IDEDISK=y -+CONFIG_IDEDISK_MULTI_MODE=y -+CONFIG_IDEDISK_STROKE=y -+CONFIG_BLK_DEV_IDECS=m -+# CONFIG_BLK_DEV_DELKIN is not set -+# CONFIG_BLK_DEV_IDECD is not set -+# CONFIG_BLK_DEV_IDETAPE is not set -+# CONFIG_BLK_DEV_IDEFLOPPY is not set -+# CONFIG_BLK_DEV_IDESCSI is not set -+# CONFIG_IDE_TASK_IOCTL is not set -+ -+# -+# IDE chipset support/bugfixes -+# -+# CONFIG_BLK_DEV_CMD640 is not set -+# CONFIG_BLK_DEV_CMD640_ENHANCED is not set -+# CONFIG_BLK_DEV_ISAPNP is not set -+# CONFIG_BLK_DEV_IDEPCI is not set -+# CONFIG_IDE_CHIPSETS is not set -+# CONFIG_IDEDMA_AUTO is not set -+# CONFIG_DMA_NONPCI is not set -+# CONFIG_BLK_DEV_ATARAID is not set -+# CONFIG_BLK_DEV_ATARAID_PDC is not set -+# CONFIG_BLK_DEV_ATARAID_HPT is not set -+# CONFIG_BLK_DEV_ATARAID_MEDLEY is not set -+# CONFIG_BLK_DEV_ATARAID_SII is not set -+ -+# -+# SCSI support -+# -+CONFIG_SCSI=y -+ -+# -+# SCSI support type (disk, tape, CD-ROM) -+# -+CONFIG_BLK_DEV_SD=y -+CONFIG_SD_EXTRA_DEVS=40 -+CONFIG_CHR_DEV_ST=y -+# CONFIG_CHR_DEV_OSST is not set -+CONFIG_BLK_DEV_SR=y -+# CONFIG_BLK_DEV_SR_VENDOR is not set -+CONFIG_SR_EXTRA_DEVS=2 -+# CONFIG_CHR_DEV_SG is not set -+ -+# -+# Some SCSI devices (e.g. CD jukebox) support multiple LUNs -+# -+# CONFIG_SCSI_DEBUG_QUEUES is not set -+# CONFIG_SCSI_MULTI_LUN is not set -+CONFIG_SCSI_CONSTANTS=y -+# CONFIG_SCSI_LOGGING is not set -+ -+# -+# SCSI low-level drivers -+# -+# CONFIG_BLK_DEV_3W_XXXX_RAID is not set -+# CONFIG_SCSI_7000FASST is not set -+# CONFIG_SCSI_ACARD is not set -+# CONFIG_SCSI_AHA152X is not set -+# CONFIG_SCSI_AHA1542 is not set -+# CONFIG_SCSI_AHA1740 is not set -+# CONFIG_SCSI_AACRAID is not set -+# CONFIG_SCSI_AIC7XXX is not set -+# CONFIG_SCSI_AIC79XX is not set -+# CONFIG_SCSI_AIC7XXX_OLD is not set -+# CONFIG_SCSI_DPT_I2O is not set -+# CONFIG_SCSI_ADVANSYS is not set -+# CONFIG_SCSI_IN2000 is not set -+# CONFIG_SCSI_AM53C974 is not set -+# CONFIG_SCSI_MEGARAID is not set -+# CONFIG_SCSI_MEGARAID2 is not set -+# CONFIG_SCSI_SATA is not set -+# CONFIG_SCSI_SATA_AHCI is not set -+# CONFIG_SCSI_SATA_SVW is not set -+# CONFIG_SCSI_ATA_PIIX is not set -+# CONFIG_SCSI_SATA_NV is not set -+# CONFIG_SCSI_SATA_QSTOR is not set -+# CONFIG_SCSI_SATA_PROMISE is not set -+# CONFIG_SCSI_SATA_SX4 is not set -+# CONFIG_SCSI_SATA_SIL is not set -+# CONFIG_SCSI_SATA_SIS is not set -+# CONFIG_SCSI_SATA_ULI is not set -+# CONFIG_SCSI_SATA_VIA is not set -+# CONFIG_SCSI_SATA_VITESSE is not set -+# CONFIG_SCSI_BUSLOGIC is not set -+# CONFIG_SCSI_CPQFCTS is not set -+# CONFIG_SCSI_DMX3191D 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_PIO 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_INITIO is not set -+# CONFIG_SCSI_INIA100 is not set -+# CONFIG_SCSI_NCR53C406A is not set -+# CONFIG_SCSI_NCR53C7xx is not set -+# CONFIG_SCSI_SYM53C8XX_2 is not set -+# CONFIG_SCSI_NCR53C8XX is not set -+# CONFIG_SCSI_SYM53C8XX is not set -+# CONFIG_SCSI_PAS16 is not set -+# CONFIG_SCSI_PCI2000 is not set -+# CONFIG_SCSI_PCI2220I is not set -+# CONFIG_SCSI_PSI240I is not set -+# CONFIG_SCSI_QLOGIC_FAS is not set -+# CONFIG_SCSI_QLOGIC_ISP is not set -+# CONFIG_SCSI_QLOGIC_FC is not set -+# CONFIG_SCSI_QLOGIC_1280 is not set -+# CONFIG_SCSI_SIM710 is not set -+# CONFIG_SCSI_SYM53C416 is not set -+# CONFIG_SCSI_DC390T is not set -+# CONFIG_SCSI_T128 is not set -+# CONFIG_SCSI_U14_34F is not set -+# CONFIG_SCSI_NSP32 is not set -+# CONFIG_SCSI_DEBUG is not set -+ -+# -+# PCMCIA SCSI adapter support -+# -+# CONFIG_SCSI_PCMCIA is not set -+ -+# -+# Fusion MPT device support -+# -+# CONFIG_FUSION is not set -+# CONFIG_FUSION_BOOT is not set -+# CONFIG_FUSION_ISENSE is not set -+# CONFIG_FUSION_CTL is not set -+# CONFIG_FUSION_LAN is not set -+ -+# -+# IEEE 1394 (FireWire) support (EXPERIMENTAL) -+# -+# CONFIG_IEEE1394 is not set -+ -+# -+# I2O device support -+# -+# CONFIG_I2O is not set -+# CONFIG_I2O_PCI is not set -+# CONFIG_I2O_BLOCK is not set -+# CONFIG_I2O_LAN is not set -+# CONFIG_I2O_SCSI is not set -+# CONFIG_I2O_PROC is not set -+ -+# -+# Network device support -+# -+CONFIG_NETDEVICES=y -+ -+# -+# ARCnet devices -+# -+# CONFIG_ARCNET is not set -+# CONFIG_DUMMY is not set -+# CONFIG_BONDING is not set -+# CONFIG_EQUALIZER is not set -+# CONFIG_TUN is not set -+# CONFIG_ETHERTAP is not set -+ -+# -+# Ethernet (10 or 100Mbit) -+# -+CONFIG_NET_ETHERNET=y -+# CONFIG_MIPS_AU1X00_ENET is not set -+# CONFIG_SUNLANCE is not set -+# CONFIG_HAPPYMEAL is not set -+# CONFIG_SUNBMAC is not set -+# CONFIG_SUNQE is not set -+# CONFIG_SUNGEM 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 -+# CONFIG_HP100 is not set -+# CONFIG_NET_ISA is not set -+# CONFIG_NET_PCI is not set -+# CONFIG_NET_POCKET is not set -+ -+# -+# Ethernet (1000 Mbit) -+# -+# CONFIG_ACENIC is not set -+# CONFIG_DL2K is not set -+# CONFIG_E1000 is not set -+# CONFIG_MYRI_SBUS is not set -+# CONFIG_NS83820 is not set -+# CONFIG_HAMACHI is not set -+# CONFIG_YELLOWFIN is not set -+# CONFIG_R8169 is not set -+# CONFIG_SK98LIN is not set -+# CONFIG_TIGON3 is not set -+# CONFIG_FDDI is not set -+# CONFIG_HIPPI is not set -+# CONFIG_PLIP is not set -+CONFIG_PPP=m -+CONFIG_PPP_MULTILINK=y -+# CONFIG_PPP_FILTER is not set -+CONFIG_PPP_ASYNC=m -+# CONFIG_PPP_SYNC_TTY is not set -+CONFIG_PPP_DEFLATE=m -+# CONFIG_PPP_BSDCOMP is not set -+CONFIG_PPPOE=m -+# CONFIG_SLIP is not set -+ -+# -+# Wireless LAN (non-hamradio) -+# -+# CONFIG_NET_RADIO is not set -+ -+# -+# Token Ring devices -+# -+# CONFIG_TR is not set -+# CONFIG_NET_FC is not set -+# CONFIG_RCPCI is not set -+# CONFIG_SHAPER is not set -+ -+# -+# Wan interfaces -+# -+# CONFIG_WAN is not set -+ -+# -+# PCMCIA network device support -+# -+# CONFIG_NET_PCMCIA is not set -+ -+# -+# Amateur Radio support -+# -+# CONFIG_HAMRADIO is not set -+ -+# -+# IrDA (infrared) support -+# -+# CONFIG_IRDA is not set -+ -+# -+# ISDN subsystem -+# -+# CONFIG_ISDN is not set -+ -+# -+# Input core support -+# -+CONFIG_INPUT=y -+CONFIG_INPUT_KEYBDEV=y -+CONFIG_INPUT_MOUSEDEV=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_UINPUT is not set -+ -+# -+# Character devices -+# -+CONFIG_VT=y -+# CONFIG_VT_CONSOLE is not set -+# CONFIG_SERIAL is not set -+# CONFIG_SERIAL_EXTENDED is not set -+CONFIG_SERIAL_NONSTANDARD=y -+# CONFIG_COMPUTONE is not set -+# CONFIG_ROCKETPORT is not set -+# CONFIG_CYCLADES is not set -+# CONFIG_DIGIEPCA is not set -+# CONFIG_DIGI is not set -+# CONFIG_ESPSERIAL is not set -+# CONFIG_MOXA_INTELLIO is not set -+# CONFIG_MOXA_SMARTIO is not set -+# CONFIG_ISI is not set -+# CONFIG_SYNCLINK is not set -+# CONFIG_SYNCLINKMP is not set -+# CONFIG_N_HDLC is not set -+# CONFIG_RISCOM8 is not set -+# CONFIG_SPECIALIX is not set -+# CONFIG_SX is not set -+# CONFIG_RIO is not set -+# CONFIG_STALDRV is not set -+# CONFIG_SERIAL_TX3912 is not set -+# CONFIG_SERIAL_TX3912_CONSOLE is not set -+# CONFIG_SERIAL_TXX9 is not set -+# CONFIG_SERIAL_TXX9_CONSOLE is not set -+CONFIG_AU1X00_UART=y -+CONFIG_AU1X00_SERIAL_CONSOLE=y -+# CONFIG_AU1X00_USB_TTY is not set -+# CONFIG_AU1X00_USB_RAW is not set -+# CONFIG_TXX927_SERIAL is not set -+CONFIG_UNIX98_PTYS=y -+CONFIG_UNIX98_PTY_COUNT=256 -+ -+# -+# I2C support -+# -+CONFIG_I2C=y -+# CONFIG_I2C_ALGOBIT is not set -+# CONFIG_SCx200_ACB is not set -+# CONFIG_I2C_ALGOPCF is not set -+# CONFIG_I2C_CHARDEV is not set -+CONFIG_I2C_PROC=y -+ -+# -+# Mice -+# -+# CONFIG_BUSMOUSE is not set -+# CONFIG_MOUSE is not set -+ -+# -+# Joysticks -+# -+# CONFIG_INPUT_GAMEPORT is not set -+# CONFIG_INPUT_NS558 is not set -+# CONFIG_INPUT_LIGHTNING is not set -+# CONFIG_INPUT_PCIGAME is not set -+# CONFIG_INPUT_CS461X is not set -+# CONFIG_INPUT_EMU10K1 is not set -+# CONFIG_INPUT_SERIO is not set -+# CONFIG_INPUT_SERPORT is not set -+ -+# -+# Joysticks -+# -+# CONFIG_INPUT_ANALOG is not set -+# CONFIG_INPUT_A3D is not set -+# CONFIG_INPUT_ADI is not set -+# CONFIG_INPUT_COBRA is not set -+# CONFIG_INPUT_GF2K is not set -+# CONFIG_INPUT_GRIP is not set -+# CONFIG_INPUT_INTERACT is not set -+# CONFIG_INPUT_TMDC is not set -+# CONFIG_INPUT_SIDEWINDER is not set -+# CONFIG_INPUT_IFORCE_USB is not set -+# CONFIG_INPUT_IFORCE_232 is not set -+# CONFIG_INPUT_WARRIOR is not set -+# CONFIG_INPUT_MAGELLAN is not set -+# CONFIG_INPUT_SPACEORB is not set -+# CONFIG_INPUT_SPACEBALL is not set -+# CONFIG_INPUT_STINGER is not set -+# CONFIG_INPUT_DB9 is not set -+# CONFIG_INPUT_GAMECON is not set -+# CONFIG_INPUT_TURBOGRAFX is not set -+# CONFIG_QIC02_TAPE is not set -+# CONFIG_IPMI_HANDLER is not set -+# CONFIG_IPMI_PANIC_EVENT is not set -+# CONFIG_IPMI_DEVICE_INTERFACE is not set -+# CONFIG_IPMI_KCS is not set -+# CONFIG_IPMI_WATCHDOG is not set -+ -+# -+# Watchdog Cards -+# -+# CONFIG_WATCHDOG is not set -+# CONFIG_SCx200 is not set -+# CONFIG_SCx200_GPIO is not set -+# CONFIG_AMD_PM768 is not set -+# CONFIG_NVRAM is not set -+# CONFIG_RTC is not set -+# CONFIG_DTLK is not set -+# CONFIG_R3964 is not set -+# CONFIG_APPLICOM is not set -+ -+# -+# Ftape, the floppy tape device driver -+# -+# CONFIG_FTAPE is not set -+# CONFIG_AGP is not set -+ -+# -+# Direct Rendering Manager (XFree86 DRI support) -+# -+# CONFIG_DRM is not set -+ -+# -+# PCMCIA character devices -+# -+# CONFIG_PCMCIA_SERIAL_CS is not set -+# CONFIG_SYNCLINK_CS is not set -+# CONFIG_AU1X00_GPIO is not set -+# CONFIG_TS_AU1X00_ADS7846 is not set -+ -+# -+# File systems -+# -+# CONFIG_QUOTA is not set -+# CONFIG_QFMT_V2 is not set -+CONFIG_AUTOFS_FS=y -+# CONFIG_AUTOFS4_FS is not set -+# CONFIG_REISERFS_FS is not set -+# CONFIG_REISERFS_CHECK is not set -+# CONFIG_REISERFS_PROC_INFO is not set -+# CONFIG_ADFS_FS is not set -+# CONFIG_ADFS_FS_RW 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_BEFS_DEBUG is not set -+# CONFIG_BFS_FS is not set -+CONFIG_EXT3_FS=y -+CONFIG_JBD=y -+# CONFIG_JBD_DEBUG is not set -+CONFIG_FAT_FS=y -+CONFIG_MSDOS_FS=y -+# CONFIG_UMSDOS_FS is not set -+CONFIG_VFAT_FS=y -+# CONFIG_EFS_FS is not set -+# CONFIG_JFFS_FS is not set -+# CONFIG_JFFS2_FS is not set -+# CONFIG_CRAMFS is not set -+CONFIG_TMPFS=y -+CONFIG_RAMFS=y -+# CONFIG_ISO9660_FS is not set -+# CONFIG_JOLIET is not set -+# CONFIG_ZISOFS is not set -+# CONFIG_JFS_FS is not set -+# CONFIG_JFS_DEBUG is not set -+# CONFIG_JFS_STATISTICS is not set -+# CONFIG_MINIX_FS is not set -+# CONFIG_VXFS_FS is not set -+# CONFIG_NTFS_FS is not set -+# CONFIG_NTFS_RW is not set -+# CONFIG_HPFS_FS is not set -+CONFIG_PROC_FS=y -+# CONFIG_DEVFS_FS is not set -+# CONFIG_DEVFS_MOUNT is not set -+# CONFIG_DEVFS_DEBUG is not set -+CONFIG_DEVPTS_FS=y -+# CONFIG_QNX4FS_FS is not set -+# CONFIG_QNX4FS_RW is not set -+# CONFIG_ROMFS_FS is not set -+CONFIG_EXT2_FS=y -+# CONFIG_SYSV_FS is not set -+# CONFIG_UDF_FS is not set -+# CONFIG_UDF_RW is not set -+# CONFIG_UFS_FS is not set -+# CONFIG_UFS_FS_WRITE is not set -+# CONFIG_XFS_FS is not set -+# CONFIG_XFS_QUOTA is not set -+# CONFIG_XFS_RT is not set -+# CONFIG_XFS_TRACE is not set -+# CONFIG_XFS_DEBUG is not set -+ -+# -+# Network File Systems -+# -+# CONFIG_CODA_FS is not set -+# CONFIG_INTERMEZZO_FS is not set -+CONFIG_NFS_FS=y -+CONFIG_NFS_V3=y -+# CONFIG_NFS_DIRECTIO is not set -+CONFIG_ROOT_NFS=y -+# CONFIG_NFSD is not set -+# CONFIG_NFSD_V3 is not set -+# CONFIG_NFSD_TCP is not set -+CONFIG_SUNRPC=y -+CONFIG_LOCKD=y -+CONFIG_LOCKD_V4=y -+# CONFIG_SMB_FS is not set -+# CONFIG_NCP_FS is not set -+# CONFIG_NCPFS_PACKET_SIGNING is not set -+# CONFIG_NCPFS_IOCTL_LOCKING is not set -+# CONFIG_NCPFS_STRONG is not set -+# CONFIG_NCPFS_NFS_NS is not set -+# CONFIG_NCPFS_OS2_NS is not set -+# CONFIG_NCPFS_SMALLDOS is not set -+# CONFIG_NCPFS_NLS is not set -+# CONFIG_NCPFS_EXTRAS is not set -+# CONFIG_ZISOFS_FS is not set -+ -+# -+# Partition Types -+# -+# CONFIG_PARTITION_ADVANCED is not set -+CONFIG_MSDOS_PARTITION=y -+# CONFIG_SMB_NLS is not set -+CONFIG_NLS=y -+ -+# -+# Native Language Support -+# -+CONFIG_NLS_DEFAULT="iso8859-1" -+# 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_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_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_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 -+ -+# -+# Multimedia devices -+# -+# CONFIG_VIDEO_DEV is not set -+ -+# -+# Console drivers -+# -+# CONFIG_VGA_CONSOLE is not set -+# CONFIG_MDA_CONSOLE is not set -+ -+# -+# Frame-buffer support -+# -+CONFIG_FB=y -+CONFIG_DUMMY_CONSOLE=y -+# CONFIG_FB_RIVA is not set -+# CONFIG_FB_CLGEN is not set -+# CONFIG_FB_PM2 is not set -+# CONFIG_FB_PM3 is not set -+# CONFIG_FB_CYBER2000 is not set -+# CONFIG_FB_MATROX is not set -+# CONFIG_FB_ATY is not set -+# CONFIG_FB_RADEON is not set -+# CONFIG_FB_ATY128 is not set -+# CONFIG_FB_INTEL is not set -+# CONFIG_FB_SIS is not set -+# CONFIG_FB_NEOMAGIC is not set -+# CONFIG_FB_3DFX is not set -+# CONFIG_FB_VOODOO1 is not set -+# CONFIG_FB_TRIDENT is not set -+# CONFIG_FB_E1356 is not set -+# CONFIG_FB_IT8181 is not set -+# CONFIG_FB_VIRTUAL is not set -+CONFIG_FBCON_ADVANCED=y -+# CONFIG_FBCON_MFB is not set -+# CONFIG_FBCON_CFB2 is not set -+# CONFIG_FBCON_CFB4 is not set -+# CONFIG_FBCON_CFB8 is not set -+CONFIG_FBCON_CFB16=y -+# CONFIG_FBCON_CFB24 is not set -+CONFIG_FBCON_CFB32=y -+# CONFIG_FBCON_AFB is not set -+# CONFIG_FBCON_ILBM is not set -+# CONFIG_FBCON_IPLAN2P2 is not set -+# CONFIG_FBCON_IPLAN2P4 is not set -+# CONFIG_FBCON_IPLAN2P8 is not set -+# CONFIG_FBCON_MAC is not set -+# CONFIG_FBCON_VGA_PLANES is not set -+# CONFIG_FBCON_VGA is not set -+# CONFIG_FBCON_HGA is not set -+# CONFIG_FBCON_FONTWIDTH8_ONLY is not set -+CONFIG_FBCON_FONTS=y -+CONFIG_FONT_8x8=y -+CONFIG_FONT_8x16=y -+# CONFIG_FONT_SUN8x16 is not set -+# CONFIG_FONT_SUN12x22 is not set -+# CONFIG_FONT_6x11 is not set -+# CONFIG_FONT_PEARL_8x8 is not set -+# CONFIG_FONT_ACORN_8x8 is not set -+ -+# -+# Sound -+# -+CONFIG_SOUND=y -+# CONFIG_SOUND_ALI5455 is not set -+# CONFIG_SOUND_BT878 is not set -+# CONFIG_SOUND_CMPCI is not set -+# CONFIG_SOUND_EMU10K1 is not set -+# CONFIG_MIDI_EMU10K1 is not set -+# CONFIG_SOUND_FUSION is not set -+# CONFIG_SOUND_CS4281 is not set -+# CONFIG_SOUND_ES1370 is not set -+# CONFIG_SOUND_ES1371 is not set -+# CONFIG_SOUND_ESSSOLO1 is not set -+# CONFIG_SOUND_MAESTRO is not set -+# CONFIG_SOUND_MAESTRO3 is not set -+# CONFIG_SOUND_FORTE is not set -+# CONFIG_SOUND_ICH is not set -+# CONFIG_SOUND_RME96XX is not set -+# CONFIG_SOUND_SONICVIBES is not set -+# CONFIG_SOUND_AU1X00 is not set -+CONFIG_SOUND_AU1550_PSC=y -+# CONFIG_SOUND_AU1550_I2S is not set -+# CONFIG_SOUND_TRIDENT is not set -+# CONFIG_SOUND_MSNDCLAS is not set -+# CONFIG_SOUND_MSNDPIN is not set -+# CONFIG_SOUND_VIA82CXXX is not set -+# CONFIG_MIDI_VIA82CXXX is not set -+# CONFIG_SOUND_OSS is not set -+# CONFIG_SOUND_TVMIXER is not set -+# CONFIG_SOUND_AD1980 is not set -+# CONFIG_SOUND_WM97XX is not set -+ -+# -+# USB support -+# -+CONFIG_USB=y -+# CONFIG_USB_DEBUG is not set -+ -+# -+# Miscellaneous USB options -+# -+CONFIG_USB_DEVICEFS=y -+# CONFIG_USB_BANDWIDTH is not set -+ -+# -+# USB Host Controller Drivers -+# -+# CONFIG_USB_EHCI_HCD is not set -+# CONFIG_USB_UHCI is not set -+# CONFIG_USB_UHCI_ALT is not set -+CONFIG_USB_OHCI=y -+ -+# -+# USB Device Class drivers -+# -+# CONFIG_USB_AUDIO is not set -+# CONFIG_USB_EMI26 is not set -+# CONFIG_USB_BLUETOOTH is not set -+# CONFIG_USB_MIDI is not set -+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_HP8200e 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_ACM is not set -+# CONFIG_USB_PRINTER is not set -+ -+# -+# USB Human Interface Devices (HID) -+# -+CONFIG_USB_HID=y -+CONFIG_USB_HIDINPUT=y -+CONFIG_USB_HIDDEV=y -+# CONFIG_USB_AIPTEK is not set -+# CONFIG_USB_WACOM is not set -+# CONFIG_USB_KBTAB is not set -+# CONFIG_USB_POWERMATE is not set -+ -+# -+# USB Imaging devices -+# -+# CONFIG_USB_DC2XX is not set -+# CONFIG_USB_MDC800 is not set -+# CONFIG_USB_SCANNER is not set -+# CONFIG_USB_MICROTEK is not set -+# CONFIG_USB_HPUSBSCSI is not set -+ -+# -+# USB Multimedia devices -+# -+ -+# -+# Video4Linux support is needed for USB Multimedia device support -+# -+ -+# -+# USB Network adaptors -+# -+# CONFIG_USB_PEGASUS is not set -+# CONFIG_USB_RTL8150 is not set -+# CONFIG_USB_KAWETH is not set -+# CONFIG_USB_CATC is not set -+# CONFIG_USB_CDCETHER is not set -+# CONFIG_USB_USBNET is not set -+ -+# -+# USB port drivers -+# -+# CONFIG_USB_USS720 is not set -+ -+# -+# USB Serial Converter support -+# -+# CONFIG_USB_SERIAL is not set -+ -+# -+# USB Miscellaneous drivers -+# -+# CONFIG_USB_RIO500 is not set -+# CONFIG_USB_AUERSWALD is not set -+# CONFIG_USB_TIGL is not set -+# CONFIG_USB_BRLVGER is not set -+# CONFIG_USB_LCD is not set -+ -+# -+# Support for USB gadgets -+# -+# CONFIG_USB_GADGET is not set -+ -+# -+# Bluetooth support -+# -+# CONFIG_BLUEZ is not set -+ -+# -+# Kernel hacking -+# -+CONFIG_CROSSCOMPILE=y -+# CONFIG_RUNTIME_DEBUG is not set -+# CONFIG_KGDB is not set -+# CONFIG_GDB_CONSOLE is not set -+# CONFIG_DEBUG_INFO is not set -+# CONFIG_MAGIC_SYSRQ is not set -+# CONFIG_MIPS_UNCACHED is not set -+CONFIG_LOG_BUF_SHIFT=0 -+ -+# -+# Cryptographic options -+# -+# CONFIG_CRYPTO is not set -+ -+# -+# Library routines -+# -+# CONFIG_CRC32 is not set -+CONFIG_ZLIB_INFLATE=m -+CONFIG_ZLIB_DEFLATE=m -+# CONFIG_FW_LOADER is not set -diff -Nur linux-2.4.30/arch/mips/defconfig-pb1500 linux-2.4.30-mips/arch/mips/defconfig-pb1500 ---- linux-2.4.30/arch/mips/defconfig-pb1500 2005-01-19 15:09:28.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-pb1500 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - CONFIG_MIPS_PB1500=y --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -215,9 +215,7 @@ - # CONFIG_MTD_MTX1 is not set - CONFIG_MTD_PB1500_BOOT=y - # CONFIG_MTD_PB1500_USER is not set --# CONFIG_MTD_DB1X00 is not set - # CONFIG_MTD_PB1550 is not set --# CONFIG_MTD_HYDROGEN3 is not set - # CONFIG_MTD_MIRAGE is not set - # CONFIG_MTD_CSTM_MIPS_IXX is not set - # CONFIG_MTD_OCELOT is not set -@@ -236,7 +234,6 @@ - # - # Disk-On-Chip Device Drivers - # --# CONFIG_MTD_DOC1000 is not set - # CONFIG_MTD_DOC2000 is not set - # CONFIG_MTD_DOC2001 is not set - # CONFIG_MTD_DOCPROBE is not set -@@ -341,11 +338,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -675,7 +667,6 @@ - # CONFIG_AU1X00_USB_TTY is not set - # CONFIG_AU1X00_USB_RAW is not set - # CONFIG_TXX927_SERIAL is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-pb1550 linux-2.4.30-mips/arch/mips/defconfig-pb1550 ---- linux-2.4.30/arch/mips/defconfig-pb1550 2005-01-19 15:09:29.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-pb1550 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - CONFIG_MIPS_PB1550=y -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -213,11 +213,9 @@ - # CONFIG_MTD_BOSPORUS is not set - # CONFIG_MTD_XXS1500 is not set - # CONFIG_MTD_MTX1 is not set --# CONFIG_MTD_DB1X00 is not set - CONFIG_MTD_PB1550=y - CONFIG_MTD_PB1550_BOOT=y - CONFIG_MTD_PB1550_USER=y --# CONFIG_MTD_HYDROGEN3 is not set - # CONFIG_MTD_MIRAGE is not set - # CONFIG_MTD_CSTM_MIPS_IXX is not set - # CONFIG_MTD_OCELOT is not set -@@ -236,7 +234,6 @@ - # - # Disk-On-Chip Device Drivers - # --# CONFIG_MTD_DOC1000 is not set - # CONFIG_MTD_DOC2000 is not set - # CONFIG_MTD_DOC2001 is not set - # CONFIG_MTD_DOCPROBE is not set -@@ -343,11 +340,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -633,7 +625,6 @@ - # CONFIG_AU1X00_USB_TTY is not set - # CONFIG_AU1X00_USB_RAW is not set - # CONFIG_TXX927_SERIAL is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-rbtx4927 linux-2.4.30-mips/arch/mips/defconfig-rbtx4927 ---- linux-2.4.30/arch/mips/defconfig-rbtx4927 2005-01-19 15:09:29.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-rbtx4927 2005-03-18 13:13:21.000000000 +0100 -@@ -28,8 +28,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -223,11 +223,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -466,7 +461,6 @@ - CONFIG_SERIAL_TXX9=y - CONFIG_SERIAL_TXX9_CONSOLE=y - # CONFIG_TXX927_SERIAL is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - # CONFIG_UNIX98_PTYS is not set - - # -diff -Nur linux-2.4.30/arch/mips/defconfig-rm200 linux-2.4.30-mips/arch/mips/defconfig-rm200 ---- linux-2.4.30/arch/mips/defconfig-rm200 2005-01-19 15:09:29.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-rm200 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -229,11 +229,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -340,7 +335,6 @@ - # CONFIG_SERIAL is not set - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-sb1250-swarm linux-2.4.30-mips/arch/mips/defconfig-sb1250-swarm ---- linux-2.4.30/arch/mips/defconfig-sb1250-swarm 2005-01-19 15:09:29.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-sb1250-swarm 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -90,6 +90,7 @@ - # CONFIG_SIBYTE_TBPROF is not set - CONFIG_SIBYTE_GENBUS_IDE=y - CONFIG_SMP_CAPABLE=y -+CONFIG_MIPS_RTC=y - # CONFIG_SNI_RM200_PCI is not set - # CONFIG_TANBAC_TB0226 is not set - # CONFIG_TANBAC_TB0229 is not set -@@ -253,11 +254,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -469,7 +465,6 @@ - CONFIG_SIBYTE_SB1250_DUART=y - CONFIG_SIBYTE_SB1250_DUART_CONSOLE=y - CONFIG_SERIAL_CONSOLE=y --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-sead linux-2.4.30-mips/arch/mips/defconfig-sead ---- linux-2.4.30/arch/mips/defconfig-sead 2005-01-19 15:09:29.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-sead 2005-03-18 13:13:21.000000000 +0100 -@@ -28,8 +28,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -244,7 +244,6 @@ - CONFIG_SERIAL_CONSOLE=y - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - # CONFIG_UNIX98_PTYS is not set - - # -diff -Nur linux-2.4.30/arch/mips/defconfig-stretch linux-2.4.30-mips/arch/mips/defconfig-stretch ---- linux-2.4.30/arch/mips/defconfig-stretch 2005-01-19 15:09:29.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-stretch 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -240,11 +240,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -324,9 +319,11 @@ - # CONFIG_SCSI_MEGARAID is not set - # CONFIG_SCSI_MEGARAID2 is not set - # CONFIG_SCSI_SATA is not set -+# CONFIG_SCSI_SATA_AHCI is not set - # CONFIG_SCSI_SATA_SVW is not set - # CONFIG_SCSI_ATA_PIIX is not set - # CONFIG_SCSI_SATA_NV is not set -+# CONFIG_SCSI_SATA_QSTOR is not set - # CONFIG_SCSI_SATA_PROMISE is not set - # CONFIG_SCSI_SATA_SX4 is not set - # CONFIG_SCSI_SATA_SIL is not set -@@ -516,7 +513,6 @@ - # CONFIG_SERIAL_TXX9 is not set - # CONFIG_SERIAL_TXX9_CONSOLE is not set - # CONFIG_TXX927_SERIAL is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-tb0226 linux-2.4.30-mips/arch/mips/defconfig-tb0226 ---- linux-2.4.30/arch/mips/defconfig-tb0226 2005-01-19 15:09:29.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-tb0226 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -228,11 +228,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -312,9 +307,11 @@ - # CONFIG_SCSI_MEGARAID is not set - # CONFIG_SCSI_MEGARAID2 is not set - # CONFIG_SCSI_SATA is not set -+# CONFIG_SCSI_SATA_AHCI is not set - # CONFIG_SCSI_SATA_SVW is not set - # CONFIG_SCSI_ATA_PIIX is not set - # CONFIG_SCSI_SATA_NV is not set -+# CONFIG_SCSI_SATA_QSTOR is not set - # CONFIG_SCSI_SATA_PROMISE is not set - # CONFIG_SCSI_SATA_SX4 is not set - # CONFIG_SCSI_SATA_SIL is not set -@@ -518,7 +515,6 @@ - CONFIG_SERIAL_CONSOLE=y - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - # CONFIG_VR41XX_KIU is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 -diff -Nur linux-2.4.30/arch/mips/defconfig-tb0229 linux-2.4.30-mips/arch/mips/defconfig-tb0229 ---- linux-2.4.30/arch/mips/defconfig-tb0229 2005-01-19 15:09:29.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-tb0229 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -230,11 +230,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -445,7 +440,6 @@ - CONFIG_SERIAL_CONSOLE=y - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - # CONFIG_VR41XX_KIU is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 -diff -Nur linux-2.4.30/arch/mips/defconfig-ti1500 linux-2.4.30-mips/arch/mips/defconfig-ti1500 ---- linux-2.4.30/arch/mips/defconfig-ti1500 2005-01-19 15:09:29.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-ti1500 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - CONFIG_MIPS_XXS1500=y - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -213,9 +213,7 @@ - # CONFIG_MTD_BOSPORUS is not set - CONFIG_MTD_XXS1500=y - # CONFIG_MTD_MTX1 is not set --# CONFIG_MTD_DB1X00 is not set - # CONFIG_MTD_PB1550 is not set --# CONFIG_MTD_HYDROGEN3 is not set - # CONFIG_MTD_MIRAGE is not set - # CONFIG_MTD_CSTM_MIPS_IXX is not set - # CONFIG_MTD_OCELOT is not set -@@ -234,7 +232,6 @@ - # - # Disk-On-Chip Device Drivers - # --# CONFIG_MTD_DOC1000 is not set - # CONFIG_MTD_DOC2000 is not set - # CONFIG_MTD_DOC2001 is not set - # CONFIG_MTD_DOCPROBE is not set -@@ -339,11 +336,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -600,7 +592,6 @@ - # CONFIG_AU1X00_USB_TTY is not set - # CONFIG_AU1X00_USB_RAW is not set - # CONFIG_TXX927_SERIAL is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-workpad linux-2.4.30-mips/arch/mips/defconfig-workpad ---- linux-2.4.30/arch/mips/defconfig-workpad 2005-01-19 15:09:29.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-workpad 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -222,11 +222,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -426,7 +421,6 @@ - # CONFIG_SERIAL_MULTIPORT is not set - # CONFIG_HUB6 is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - # CONFIG_VR41XX_KIU is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 -diff -Nur linux-2.4.30/arch/mips/defconfig-xxs1500 linux-2.4.30-mips/arch/mips/defconfig-xxs1500 ---- linux-2.4.30/arch/mips/defconfig-xxs1500 2005-01-19 15:09:29.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-xxs1500 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - CONFIG_MIPS_XXS1500=y - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -213,9 +213,7 @@ - # CONFIG_MTD_BOSPORUS is not set - CONFIG_MTD_XXS1500=y - # CONFIG_MTD_MTX1 is not set --# CONFIG_MTD_DB1X00 is not set - # CONFIG_MTD_PB1550 is not set --# CONFIG_MTD_HYDROGEN3 is not set - # CONFIG_MTD_MIRAGE is not set - # CONFIG_MTD_CSTM_MIPS_IXX is not set - # CONFIG_MTD_OCELOT is not set -@@ -234,7 +232,6 @@ - # - # Disk-On-Chip Device Drivers - # --# CONFIG_MTD_DOC1000 is not set - # CONFIG_MTD_DOC2000 is not set - # CONFIG_MTD_DOC2001 is not set - # CONFIG_MTD_DOCPROBE is not set -@@ -339,11 +336,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -671,7 +663,6 @@ - # CONFIG_AU1X00_USB_TTY is not set - # CONFIG_AU1X00_USB_RAW is not set - # CONFIG_TXX927_SERIAL is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/defconfig-yosemite linux-2.4.30-mips/arch/mips/defconfig-yosemite ---- linux-2.4.30/arch/mips/defconfig-yosemite 2005-01-19 15:09:29.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/defconfig-yosemite 2005-03-18 13:13:21.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -227,11 +227,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -310,9 +305,11 @@ - # CONFIG_SCSI_MEGARAID is not set - # CONFIG_SCSI_MEGARAID2 is not set - # CONFIG_SCSI_SATA is not set -+# CONFIG_SCSI_SATA_AHCI is not set - # CONFIG_SCSI_SATA_SVW is not set - # CONFIG_SCSI_ATA_PIIX is not set - # CONFIG_SCSI_SATA_NV is not set -+# CONFIG_SCSI_SATA_QSTOR is not set - # CONFIG_SCSI_SATA_PROMISE is not set - # CONFIG_SCSI_SATA_SX4 is not set - # CONFIG_SCSI_SATA_SIL is not set -@@ -477,7 +474,6 @@ - # CONFIG_SERIAL_TXX9 is not set - # CONFIG_SERIAL_TXX9_CONSOLE is not set - # CONFIG_TXX927_SERIAL is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips/kernel/cpu-probe.c linux-2.4.30-mips/arch/mips/kernel/cpu-probe.c ---- linux-2.4.30/arch/mips/kernel/cpu-probe.c 2005-01-19 15:09:29.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/kernel/cpu-probe.c 2005-04-08 10:33:17.000000000 +0200 -@@ -34,16 +34,12 @@ - ".set\tmips0"); - } - --/* The Au1xxx wait is available only if we run CONFIG_PM and -- * the timer setup found we had a 32KHz counter available. -- * There are still problems with functions that may call au1k_wait -- * directly, but that will be discovered pretty quickly. -- */ --extern void (*au1k_wait_ptr)(void); --void au1k_wait(void) -+/* The Au1xxx wait is available only if using 32khz counter or -+ * external timer source, but specifically not CP0 Counter. */ -+int allow_au1k_wait; -+static void au1k_wait(void) - { --#ifdef CONFIG_PM -- unsigned long addr; -+ unsigned long addr = 0; - /* using the wait instruction makes CP0 counter unusable */ - __asm__("la %0,au1k_wait\n\t" - ".set mips3\n\t" -@@ -58,10 +54,6 @@ - "nop\n\t" - ".set mips0\n\t" - : : "r" (addr)); --#else -- __asm__("nop\n\t" -- "nop"); --#endif - } - - static inline void check_wait(void) -@@ -100,20 +92,17 @@ - cpu_wait = r4k_wait; - printk(" available.\n"); - break; --#ifdef CONFIG_PM - case CPU_AU1000: - case CPU_AU1100: - case CPU_AU1500: - case CPU_AU1550: -- if (au1k_wait_ptr != NULL) { -- cpu_wait = au1k_wait_ptr; -+ case CPU_AU1200: -+ if (allow_au1k_wait) { -+ cpu_wait = au1k_wait; - printk(" available.\n"); -- } -- else { -+ } else - printk(" unavailable.\n"); -- } - break; --#endif - default: - printk(" unavailable.\n"); - break; -diff -Nur linux-2.4.30/arch/mips/kernel/head.S linux-2.4.30-mips/arch/mips/kernel/head.S ---- linux-2.4.30/arch/mips/kernel/head.S 2005-01-19 15:09:29.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/kernel/head.S 2004-11-22 14:38:23.000000000 +0100 -@@ -43,9 +43,9 @@ - - /* Cache Error */ - LEAF(except_vec2_generic) -+ .set push - .set noreorder - .set noat -- .set mips0 - /* - * This is a very bad place to be. Our cache error - * detection has triggered. If we have write-back data -@@ -64,10 +64,9 @@ - - j cache_parity_error - nop -+ .set pop - END(except_vec2_generic) - -- .set at -- - /* - * Special interrupt vector for embedded MIPS. This is a - * dedicated interrupt vector which reduces interrupt processing -@@ -76,8 +75,11 @@ - * size! - */ - NESTED(except_vec4, 0, sp) -+ .set push -+ .set noreorder - 1: j 1b /* Dummy, will be replaced */ - nop -+ .set pop - END(except_vec4) - - /* -@@ -87,8 +89,11 @@ - * unconditional jump to this vector. - */ - NESTED(except_vec_ejtag_debug, 0, sp) -+ .set push -+ .set noreorder - j ejtag_debug_handler - nop -+ .set pop - END(except_vec_ejtag_debug) - - __FINIT -@@ -97,6 +102,7 @@ - * EJTAG debug exception handler. - */ - NESTED(ejtag_debug_handler, PT_SIZE, sp) -+ .set push - .set noat - .set noreorder - mtc0 k0, CP0_DESAVE -@@ -120,7 +126,7 @@ - deret - .set mips0 - nop -- .set at -+ .set pop - END(ejtag_debug_handler) - - __INIT -@@ -132,13 +138,17 @@ - * unconditional jump to this vector. - */ - NESTED(except_vec_nmi, 0, sp) -+ .set push -+ .set noreorder - j nmi_handler - nop -+ .set pop - END(except_vec_nmi) - - __FINIT - - NESTED(nmi_handler, PT_SIZE, sp) -+ .set push - .set noat - .set noreorder - .set mips3 -@@ -147,8 +157,7 @@ - move a0, sp - RESTORE_ALL - eret -- .set at -- .set mips0 -+ .set pop - END(nmi_handler) - - __INIT -@@ -157,7 +166,20 @@ - * Kernel entry point - */ - NESTED(kernel_entry, 16, sp) -+ .set push -+ /* -+ * For the moment disable interrupts and mark the kernel mode. -+ * A full initialization of the CPU's status register is done -+ * later in per_cpu_trap_init(). -+ */ -+ mfc0 t0, CP0_STATUS -+ or t0, ST0_CU0|0x1f -+ xor t0, 0x1f -+ mtc0 t0, CP0_STATUS -+ - .set noreorder -+ sll zero,3 # ehb -+ .set reorder - - /* - * The firmware/bootloader passes argc/argp/envp -@@ -170,8 +192,8 @@ - la t1, (_end - 4) - 1: - addiu t0, 4 -+ sw zero, (t0) - bne t0, t1, 1b -- sw zero, (t0) - - /* - * Stack for kernel and init, current variable -@@ -182,7 +204,7 @@ - sw t0, kernelsp - - jal init_arch -- nop -+ .set pop - END(kernel_entry) - - -@@ -193,17 +215,26 @@ - * function after setting up the stack and gp registers. - */ - LEAF(smp_bootstrap) -- .set push -- .set noreorder -- mtc0 zero, CP0_WIRED -- CLI -+ .set push -+ /* -+ * For the moment disable interrupts and bootstrap exception -+ * vectors and mark the kernel mode. A full initialization of -+ * the CPU's status register is done later in -+ * per_cpu_trap_init(). -+ */ - mfc0 t0, CP0_STATUS -- li t1, ~(ST0_CU1|ST0_CU2|ST0_CU3|ST0_KX|ST0_SX|ST0_UX) -- and t0, t1 -- or t0, (ST0_CU0); -+ or t0, ST0_CU0|ST0_BEV|0x1f -+ xor t0, ST0_BEV|0x1f -+ mtc0 t0, CP0_STATUS -+ -+ .set noreorder -+ sll zero,3 # ehb -+ .set reorder -+ -+ mtc0 zero, CP0_WIRED -+ - jal start_secondary -- mtc0 t0, CP0_STATUS -- .set pop -+ .set pop - END(smp_bootstrap) - #endif - -diff -Nur linux-2.4.30/arch/mips/kernel/scall_o32.S linux-2.4.30-mips/arch/mips/kernel/scall_o32.S ---- linux-2.4.30/arch/mips/kernel/scall_o32.S 2005-01-19 15:09:29.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/kernel/scall_o32.S 2005-02-07 22:21:53.000000000 +0100 -@@ -121,15 +121,14 @@ - - trace_a_syscall: - SAVE_STATIC -- sw t2, PT_R1(sp) -+ move s0, t2 - jal syscall_trace -- lw t2, PT_R1(sp) - - lw a0, PT_R4(sp) # Restore argument registers - lw a1, PT_R5(sp) - lw a2, PT_R6(sp) - lw a3, PT_R7(sp) -- jalr t2 -+ jalr s0 - - li t0, -EMAXERRNO - 1 # error? - sltu t0, t0, v0 -diff -Nur linux-2.4.30/arch/mips/kernel/setup.c linux-2.4.30-mips/arch/mips/kernel/setup.c ---- linux-2.4.30/arch/mips/kernel/setup.c 2005-01-19 15:09:29.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/kernel/setup.c 2005-01-13 22:15:57.000000000 +0100 -@@ -5,7 +5,7 @@ - * - * Copyright (C) 1995 Linus Torvalds - * Copyright (C) 1995 Waldorf Electronics -- * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001 Ralf Baechle -+ * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 01, 05 Ralf Baechle - * Copyright (C) 1996 Stoned Elipot - * Copyright (C) 2000, 2001, 2002 Maciej W. Rozycki - */ -@@ -71,6 +71,8 @@ - extern struct rtc_ops no_rtc_ops; - struct rtc_ops *rtc_ops; - -+EXPORT_SYMBOL(rtc_ops); -+ - #ifdef CONFIG_PC_KEYB - struct kbd_ops *kbd_ops; - #endif -@@ -132,10 +134,6 @@ - */ - load_mmu(); - -- /* Disable coprocessors and set FPU for 16/32 FPR register model */ -- clear_c0_status(ST0_CU1|ST0_CU2|ST0_CU3|ST0_KX|ST0_SX|ST0_FR); -- set_c0_status(ST0_CU0); -- - start_kernel(); - } - -diff -Nur linux-2.4.30/arch/mips/kernel/traps.c linux-2.4.30-mips/arch/mips/kernel/traps.c ---- linux-2.4.30/arch/mips/kernel/traps.c 2005-01-19 15:09:29.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/kernel/traps.c 2005-04-12 22:25:34.000000000 +0200 -@@ -452,9 +452,10 @@ - } - ll_task = current; - -+ compute_return_epc(regs); -+ - regs->regs[(opcode & RT) >> 16] = value; - -- compute_return_epc(regs); - return; - - sig: -@@ -485,8 +486,8 @@ - goto sig; - } - if (ll_bit == 0 || ll_task != current) { -- regs->regs[reg] = 0; - compute_return_epc(regs); -+ regs->regs[reg] = 0; - return; - } - -@@ -495,9 +496,9 @@ - goto sig; - } - -+ compute_return_epc(regs); - regs->regs[reg] = 1; - -- compute_return_epc(regs); - return; - - sig: -@@ -887,12 +888,18 @@ - void __init per_cpu_trap_init(void) - { - unsigned int cpu = smp_processor_id(); -+ unsigned int status_set = ST0_CU0; - -- /* Some firmware leaves the BEV flag set, clear it. */ -- clear_c0_status(ST0_CU3|ST0_CU2|ST0_CU1|ST0_BEV|ST0_KX|ST0_SX|ST0_UX); -- -+ /* -+ * Disable coprocessors and 64-bit addressing and set FPU for -+ * the 16/32 FPR register model. Reset the BEV flag that some -+ * firmware may have left set and the TS bit (for IP27). Set -+ * XX for ISA IV code to work. -+ */ - if (current_cpu_data.isa_level == MIPS_CPU_ISA_IV) -- set_c0_status(ST0_XX); -+ status_set |= ST0_XX; -+ change_c0_status(ST0_CU|ST0_FR|ST0_BEV|ST0_TS|ST0_KX|ST0_SX|ST0_UX, -+ status_set); - - /* - * Some MIPS CPUs have a dedicated interrupt vector which reduces the -@@ -902,7 +909,7 @@ - set_c0_cause(CAUSEF_IV); - - cpu_data[cpu].asid_cache = ASID_FIRST_VERSION; -- write_c0_context(cpu << 23); -+ TLBMISS_HANDLER_SETUP(); - - atomic_inc(&init_mm.mm_count); - current->active_mm = &init_mm; -@@ -918,8 +925,6 @@ - extern char except_vec4; - unsigned long i; - -- per_cpu_trap_init(); -- - /* Copy the generic exception handler code to it's final destination. */ - memcpy((void *)(KSEG0 + 0x80), &except_vec1_generic, 0x80); - -@@ -1020,10 +1025,5 @@ - - flush_icache_range(KSEG0, KSEG0 + 0x400); - -- atomic_inc(&init_mm.mm_count); /* XXX UP? */ -- current->active_mm = &init_mm; -- -- /* XXX Must be done for all CPUs */ -- current_cpu_data.asid_cache = ASID_FIRST_VERSION; -- TLBMISS_HANDLER_SETUP(); -+ per_cpu_trap_init(); - } -diff -Nur linux-2.4.30/arch/mips/lib/rtc-no.c linux-2.4.30-mips/arch/mips/lib/rtc-no.c ---- linux-2.4.30/arch/mips/lib/rtc-no.c 2004-02-18 14:36:30.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/lib/rtc-no.c 2005-01-13 22:15:57.000000000 +0100 -@@ -6,10 +6,9 @@ - * Stub RTC routines to keep Linux from crashing on machine which don't - * have a RTC chip. - * -- * Copyright (C) 1998, 2001 by Ralf Baechle -+ * Copyright (C) 1998, 2001, 2005 by Ralf Baechle - */ - #include --#include - #include - - static unsigned int shouldnt_happen(void) -@@ -29,5 +28,3 @@ - .rtc_write_data = (void *) &shouldnt_happen, - .rtc_bcd_mode = (void *) &shouldnt_happen - }; -- --EXPORT_SYMBOL(rtc_ops); -diff -Nur linux-2.4.30/arch/mips/lib/rtc-std.c linux-2.4.30-mips/arch/mips/lib/rtc-std.c ---- linux-2.4.30/arch/mips/lib/rtc-std.c 2004-02-18 14:36:30.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/lib/rtc-std.c 2005-01-13 22:15:57.000000000 +0100 -@@ -5,9 +5,8 @@ - * - * RTC routines for PC style attached Dallas chip. - * -- * Copyright (C) 1998, 2001 by Ralf Baechle -+ * Copyright (C) 1998, 2001, 05 by Ralf Baechle - */ --#include - #include - #include - -@@ -33,5 +32,3 @@ - &std_rtc_write_data, - &std_rtc_bcd_mode - }; -- --EXPORT_SYMBOL(rtc_ops); -diff -Nur linux-2.4.30/arch/mips/mm/c-r4k.c linux-2.4.30-mips/arch/mips/mm/c-r4k.c ---- linux-2.4.30/arch/mips/mm/c-r4k.c 2005-01-19 15:09:29.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/mm/c-r4k.c 2005-02-06 22:55:42.000000000 +0100 -@@ -867,9 +867,16 @@ - * normally they'd suffer from aliases but magic in the hardware deals - * with that for us so we don't need to take care ourselves. - */ -- if (c->cputype != CPU_R10000 && c->cputype != CPU_R12000) -- if (c->dcache.waysize > PAGE_SIZE) -- c->dcache.flags |= MIPS_CACHE_ALIASES; -+ switch (c->cputype) { -+ case CPU_R10000: -+ case CPU_R12000: -+ break; -+ case CPU_24K: -+ if (!(read_c0_config7() & (1 << 16))) -+ default: -+ if (c->dcache.waysize > PAGE_SIZE) -+ c->dcache.flags |= MIPS_CACHE_ALIASES; -+ } - - switch (c->cputype) { - case CPU_20KC: -@@ -1069,9 +1076,6 @@ - probe_pcache(); - setup_scache(); - -- if (c->dcache.sets * c->dcache.ways > PAGE_SIZE) -- c->dcache.flags |= MIPS_CACHE_ALIASES; -- - r4k_blast_dcache_page_setup(); - r4k_blast_dcache_page_indexed_setup(); - r4k_blast_dcache_setup(); -diff -Nur linux-2.4.30/arch/mips/mm/cerr-sb1.c linux-2.4.30-mips/arch/mips/mm/cerr-sb1.c ---- linux-2.4.30/arch/mips/mm/cerr-sb1.c 2004-02-18 14:36:30.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/mm/cerr-sb1.c 2004-12-13 18:37:23.000000000 +0100 -@@ -252,14 +252,14 @@ - - /* Masks to select bits for Hamming parity, mask_72_64[i] for bit[i] */ - static const uint64_t mask_72_64[8] = { -- 0x0738C808099264FFL, -- 0x38C808099264FF07L, -- 0xC808099264FF0738L, -- 0x08099264FF0738C8L, -- 0x099264FF0738C808L, -- 0x9264FF0738C80809L, -- 0x64FF0738C8080992L, -- 0xFF0738C808099264L -+ 0x0738C808099264FFULL, -+ 0x38C808099264FF07ULL, -+ 0xC808099264FF0738ULL, -+ 0x08099264FF0738C8ULL, -+ 0x099264FF0738C808ULL, -+ 0x9264FF0738C80809ULL, -+ 0x64FF0738C8080992ULL, -+ 0xFF0738C808099264ULL - }; - - /* Calculate the parity on a range of bits */ -@@ -331,9 +331,9 @@ - ((lru >> 4) & 0x3), - ((lru >> 6) & 0x3)); - } -- va = (taglo & 0xC0000FFFFFFFE000) | addr; -+ va = (taglo & 0xC0000FFFFFFFE000ULL) | addr; - if ((taglo & (1 << 31)) && (((taglo >> 62) & 0x3) == 3)) -- va |= 0x3FFFF00000000000; -+ va |= 0x3FFFF00000000000ULL; - valid = ((taghi >> 29) & 1); - if (valid) { - tlo_tmp = taglo & 0xfff3ff; -@@ -474,7 +474,7 @@ - : "r" ((way << 13) | addr)); - - taglo = ((unsigned long long)taglohi << 32) | taglolo; -- pa = (taglo & 0xFFFFFFE000) | addr; -+ pa = (taglo & 0xFFFFFFE000ULL) | addr; - if (way == 0) { - lru = (taghi >> 14) & 0xff; - prom_printf("[Bank %d Set 0x%02x] LRU > %d %d %d %d > MRU\n", -diff -Nur linux-2.4.30/arch/mips/mm/tlb-r4k.c linux-2.4.30-mips/arch/mips/mm/tlb-r4k.c ---- linux-2.4.30/arch/mips/mm/tlb-r4k.c 2005-01-19 15:09:29.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/mm/tlb-r4k.c 2004-11-25 23:18:38.000000000 +0100 -@@ -3,17 +3,12 @@ - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * -- * r4xx0.c: R4000 processor variant specific MMU/Cache routines. -- * - * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com) - * Copyright (C) 1997, 1998, 1999, 2000 Ralf Baechle ralf@gnu.org -- * -- * To do: -- * -- * - this code is a overbloated pig -- * - many of the bug workarounds are not efficient at all, but at -- * least they are functional ... -+ * Carsten Langgaard, carstenl@mips.com -+ * Copyright (C) 2002 MIPS Technologies, Inc. All rights reserved. - */ -+#include - #include - #include - #include -@@ -25,9 +20,6 @@ - #include - #include - --#undef DEBUG_TLB --#undef DEBUG_TLBUPDATE -- - extern char except_vec0_nevada, except_vec0_r4000, except_vec0_r4600; - - /* CP0 hazard avoidance. */ -@@ -41,33 +33,23 @@ - unsigned long old_ctx; - int entry; - --#ifdef DEBUG_TLB -- printk("[tlball]"); --#endif -- - local_irq_save(flags); - /* Save old context and create impossible VPN2 value */ - old_ctx = read_c0_entryhi(); - write_c0_entrylo0(0); - write_c0_entrylo1(0); -- BARRIER; - - entry = read_c0_wired(); - - /* Blast 'em all away. */ - while (entry < current_cpu_data.tlbsize) { -- /* -- * Make sure all entries differ. If they're not different -- * MIPS32 will take revenge ... -- */ - write_c0_entryhi(KSEG0 + entry*0x2000); - write_c0_index(entry); -- BARRIER; -+ mtc0_tlbw_hazard(); - tlb_write_indexed(); -- BARRIER; - entry++; - } -- BARRIER; -+ tlbw_use_hazard(); - write_c0_entryhi(old_ctx); - local_irq_restore(flags); - } -@@ -76,12 +58,8 @@ - { - int cpu = smp_processor_id(); - -- if (cpu_context(cpu, mm) != 0) { --#ifdef DEBUG_TLB -- printk("[tlbmm<%d>]", cpu_context(cpu, mm)); --#endif -+ if (cpu_context(cpu, mm) != 0) - drop_mmu_context(mm,cpu); -- } - } - - void local_flush_tlb_range(struct mm_struct *mm, unsigned long start, -@@ -93,10 +71,6 @@ - unsigned long flags; - int size; - --#ifdef DEBUG_TLB -- printk("[tlbrange<%02x,%08lx,%08lx>]", -- cpu_asid(cpu, mm), start, end); --#endif - local_irq_save(flags); - size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT; - size = (size + 1) >> 1; -@@ -112,7 +86,7 @@ - - write_c0_entryhi(start | newpid); - start += (PAGE_SIZE << 1); -- BARRIER; -+ mtc0_tlbw_hazard(); - tlb_probe(); - BARRIER; - idx = read_c0_index(); -@@ -122,10 +96,10 @@ - continue; - /* Make sure all entries differ. */ - write_c0_entryhi(KSEG0 + idx*0x2000); -- BARRIER; -+ mtc0_tlbw_hazard(); - tlb_write_indexed(); -- BARRIER; - } -+ tlbw_use_hazard(); - write_c0_entryhi(oldpid); - } else { - drop_mmu_context(mm, cpu); -@@ -138,34 +112,30 @@ - { - int cpu = smp_processor_id(); - -- if (!vma || cpu_context(cpu, vma->vm_mm) != 0) { -+ if (cpu_context(cpu, vma->vm_mm) != 0) { - unsigned long flags; -- int oldpid, newpid, idx; -+ unsigned long oldpid, newpid, idx; - --#ifdef DEBUG_TLB -- printk("[tlbpage<%d,%08lx>]", cpu_context(cpu, vma->vm_mm), -- page); --#endif - newpid = cpu_asid(cpu, vma->vm_mm); - page &= (PAGE_MASK << 1); - local_irq_save(flags); - oldpid = read_c0_entryhi(); - write_c0_entryhi(page | newpid); -- BARRIER; -+ mtc0_tlbw_hazard(); - tlb_probe(); - BARRIER; - idx = read_c0_index(); - write_c0_entrylo0(0); - write_c0_entrylo1(0); -- if(idx < 0) -+ if (idx < 0) - goto finish; - /* Make sure all entries differ. */ - write_c0_entryhi(KSEG0+idx*0x2000); -- BARRIER; -+ mtc0_tlbw_hazard(); - tlb_write_indexed(); -+ tlbw_use_hazard(); - - finish: -- BARRIER; - write_c0_entryhi(oldpid); - local_irq_restore(flags); - } -@@ -185,7 +155,7 @@ - - local_irq_save(flags); - write_c0_entryhi(page); -- BARRIER; -+ mtc0_tlbw_hazard(); - tlb_probe(); - BARRIER; - idx = read_c0_index(); -@@ -194,18 +164,19 @@ - if (idx >= 0) { - /* Make sure all entries differ. */ - write_c0_entryhi(KSEG0+idx*0x2000); -+ mtc0_tlbw_hazard(); - tlb_write_indexed(); -+ tlbw_use_hazard(); - } -- BARRIER; - write_c0_entryhi(oldpid); -+ - local_irq_restore(flags); - } - - EXPORT_SYMBOL(local_flush_tlb_one); - --/* We will need multiple versions of update_mmu_cache(), one that just -- * updates the TLB with the new pte(s), and another which also checks -- * for the R4k "end of page" hardware bug and does the needy. -+/* -+ * Updates the TLB with the new pte(s). - */ - void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte) - { -@@ -223,25 +194,16 @@ - - pid = read_c0_entryhi() & ASID_MASK; - --#ifdef DEBUG_TLB -- if ((pid != cpu_asid(cpu, vma->vm_mm)) || -- (cpu_context(vma->vm_mm) == 0)) { -- printk("update_mmu_cache: Wheee, bogus tlbpid mmpid=%d " -- "tlbpid=%d\n", (int) (cpu_asid(cpu, vma->vm_mm)), pid); -- } --#endif -- - local_irq_save(flags); - address &= (PAGE_MASK << 1); - write_c0_entryhi(address | pid); - pgdp = pgd_offset(vma->vm_mm, address); -- BARRIER; -+ mtc0_tlbw_hazard(); - tlb_probe(); - BARRIER; - pmdp = pmd_offset(pgdp, address); - idx = read_c0_index(); - ptep = pte_offset(pmdp, address); -- BARRIER; - #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) - write_c0_entrylo0(ptep->pte_high); - ptep++; -@@ -251,15 +213,13 @@ - write_c0_entrylo1(pte_val(*ptep) >> 6); - #endif - write_c0_entryhi(address | pid); -- BARRIER; -- if (idx < 0) { -+ mtc0_tlbw_hazard(); -+ if (idx < 0) - tlb_write_random(); -- } else { -+ else - tlb_write_indexed(); -- } -- BARRIER; -+ tlbw_use_hazard(); - write_c0_entryhi(pid); -- BARRIER; - local_irq_restore(flags); - } - -@@ -279,24 +239,26 @@ - asid = read_c0_entryhi() & ASID_MASK; - write_c0_entryhi(address | asid); - pgdp = pgd_offset(vma->vm_mm, address); -+ mtc0_tlbw_hazard(); - tlb_probe(); -+ BARRIER; - pmdp = pmd_offset(pgdp, address); - idx = read_c0_index(); - ptep = pte_offset(pmdp, address); - write_c0_entrylo0(pte_val(*ptep++) >> 6); - write_c0_entrylo1(pte_val(*ptep) >> 6); -- BARRIER; -+ mtc0_tlbw_hazard(); - if (idx < 0) - tlb_write_random(); - else - tlb_write_indexed(); -- BARRIER; -+ tlbw_use_hazard(); - local_irq_restore(flags); - } - #endif - - void __init add_wired_entry(unsigned long entrylo0, unsigned long entrylo1, -- unsigned long entryhi, unsigned long pagemask) -+ unsigned long entryhi, unsigned long pagemask) - { - unsigned long flags; - unsigned long wired; -@@ -315,9 +277,9 @@ - write_c0_entryhi(entryhi); - write_c0_entrylo0(entrylo0); - write_c0_entrylo1(entrylo1); -- BARRIER; -+ mtc0_tlbw_hazard(); - tlb_write_indexed(); -- BARRIER; -+ tlbw_use_hazard(); - - write_c0_entryhi(old_ctx); - BARRIER; -@@ -355,17 +317,15 @@ - } - - write_c0_index(temp_tlb_entry); -- BARRIER; - write_c0_pagemask(pagemask); - write_c0_entryhi(entryhi); - write_c0_entrylo0(entrylo0); - write_c0_entrylo1(entrylo1); -- BARRIER; -+ mtc0_tlbw_hazard(); - tlb_write_indexed(); -- BARRIER; -+ tlbw_use_hazard(); - - write_c0_entryhi(old_ctx); -- BARRIER; - write_c0_pagemask(old_pagemask); - out: - local_irq_restore(flags); -@@ -375,7 +335,7 @@ - static void __init probe_tlb(unsigned long config) - { - struct cpuinfo_mips *c = ¤t_cpu_data; -- unsigned int reg; -+ unsigned int config1; - - /* - * If this isn't a MIPS32 / MIPS64 compliant CPU. Config 1 register -@@ -385,16 +345,16 @@ - if ((c->processor_id & 0xff0000) == PRID_COMP_LEGACY) - return; - -- reg = read_c0_config1(); -+ config1 = read_c0_config1(); - if (!((config >> 7) & 3)) - panic("No TLB present"); - -- c->tlbsize = ((reg >> 25) & 0x3f) + 1; -+ c->tlbsize = ((config1 >> 25) & 0x3f) + 1; - } - - void __init r4k_tlb_init(void) - { -- u32 config = read_c0_config(); -+ unsigned int config = read_c0_config(); - - /* - * You should never change this register: -diff -Nur linux-2.4.30/arch/mips/mm/tlbex-mips32.S linux-2.4.30-mips/arch/mips/mm/tlbex-mips32.S ---- linux-2.4.30/arch/mips/mm/tlbex-mips32.S 2004-02-18 14:36:30.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/mm/tlbex-mips32.S 2004-11-29 00:33:15.000000000 +0100 -@@ -196,7 +196,7 @@ - .set noat; \ - SAVE_ALL; \ - mfc0 a2, CP0_BADVADDR; \ -- STI; \ -+ KMODE; \ - .set at; \ - move a0, sp; \ - jal do_page_fault; \ -diff -Nur linux-2.4.30/arch/mips/mm/tlbex-r4k.S linux-2.4.30-mips/arch/mips/mm/tlbex-r4k.S ---- linux-2.4.30/arch/mips/mm/tlbex-r4k.S 2004-02-18 14:36:30.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips/mm/tlbex-r4k.S 2004-11-25 23:18:38.000000000 +0100 -@@ -184,13 +184,10 @@ - P_MTC0 k0, CP0_ENTRYLO0 # load it - PTE_SRL k1, k1, 6 # convert to entrylo1 - P_MTC0 k1, CP0_ENTRYLO1 # load it -- b 1f -- rm9000_tlb_hazard -+ mtc0_tlbw_hazard - tlbwr # write random tlb entry --1: -- nop -- rm9000_tlb_hazard -- eret # return from trap -+ tlbw_eret_hazard -+ eret - END(except_vec0_r4000) - - /* TLB refill, EXL == 0, R4600 version */ -@@ -468,13 +465,10 @@ - PTE_PRESENT(k0, k1, nopage_tlbl) - PTE_MAKEVALID(k0, k1) - PTE_RELOAD(k1, k0) -- rm9000_tlb_hazard -- nop -- b 1f -- tlbwi --1: -+ mtc0_tlbw_hazard -+ tlbwi - nop -- rm9000_tlb_hazard -+ tlbw_eret_hazard - .set mips3 - eret - .set mips0 -@@ -496,13 +490,10 @@ - PTE_WRITABLE(k0, k1, nopage_tlbs) - PTE_MAKEWRITE(k0, k1) - PTE_RELOAD(k1, k0) -- rm9000_tlb_hazard -- nop -- b 1f -- tlbwi --1: -+ mtc0_tlbw_hazard -+ tlbwi - nop -- rm9000_tlb_hazard -+ tlbw_eret_hazard - .set mips3 - eret - .set mips0 -@@ -529,13 +520,10 @@ - - /* Now reload the entry into the tlb. */ - PTE_RELOAD(k1, k0) -- rm9000_tlb_hazard -- nop -- b 1f -- tlbwi --1: -- rm9000_tlb_hazard -+ mtc0_tlbw_hazard -+ tlbwi - nop -+ tlbw_eret_hazard - .set mips3 - eret - .set mips0 -diff -Nur linux-2.4.30/arch/mips64/defconfig linux-2.4.30-mips/arch/mips64/defconfig ---- linux-2.4.30/arch/mips64/defconfig 2005-01-19 15:09:30.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/defconfig 2005-03-18 13:13:23.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -470,9 +470,11 @@ - # CONFIG_SCSI_MEGARAID is not set - # CONFIG_SCSI_MEGARAID2 is not set - # CONFIG_SCSI_SATA is not set -+# CONFIG_SCSI_SATA_AHCI is not set - # CONFIG_SCSI_SATA_SVW is not set - # CONFIG_SCSI_ATA_PIIX is not set - # CONFIG_SCSI_SATA_NV is not set -+# CONFIG_SCSI_SATA_QSTOR is not set - # CONFIG_SCSI_SATA_PROMISE is not set - # CONFIG_SCSI_SATA_SX4 is not set - # CONFIG_SCSI_SATA_SIL is not set -@@ -658,7 +660,6 @@ - CONFIG_SERIAL_CONSOLE=y - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips64/defconfig-atlas linux-2.4.30-mips/arch/mips64/defconfig-atlas ---- linux-2.4.30/arch/mips64/defconfig-atlas 2005-01-19 15:09:30.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/defconfig-atlas 2005-03-18 13:13:23.000000000 +0100 -@@ -28,8 +28,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -232,11 +232,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -314,9 +309,11 @@ - # CONFIG_SCSI_MEGARAID is not set - # CONFIG_SCSI_MEGARAID2 is not set - # CONFIG_SCSI_SATA is not set -+# CONFIG_SCSI_SATA_AHCI is not set - # CONFIG_SCSI_SATA_SVW is not set - # CONFIG_SCSI_ATA_PIIX is not set - # CONFIG_SCSI_SATA_NV is not set -+# CONFIG_SCSI_SATA_QSTOR is not set - # CONFIG_SCSI_SATA_PROMISE is not set - # CONFIG_SCSI_SATA_SX4 is not set - # CONFIG_SCSI_SATA_SIL is not set -@@ -474,7 +471,6 @@ - CONFIG_SERIAL_CONSOLE=y - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips64/defconfig-decstation linux-2.4.30-mips/arch/mips64/defconfig-decstation ---- linux-2.4.30/arch/mips64/defconfig-decstation 2005-01-19 15:09:30.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/defconfig-decstation 2005-03-18 13:13:23.000000000 +0100 -@@ -28,8 +28,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -224,11 +224,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -307,9 +302,11 @@ - # CONFIG_SCSI_MEGARAID is not set - # CONFIG_SCSI_MEGARAID2 is not set - # CONFIG_SCSI_SATA is not set -+# CONFIG_SCSI_SATA_AHCI is not set - # CONFIG_SCSI_SATA_SVW is not set - # CONFIG_SCSI_ATA_PIIX is not set - # CONFIG_SCSI_SATA_NV is not set -+# CONFIG_SCSI_SATA_QSTOR is not set - # CONFIG_SCSI_SATA_PROMISE is not set - # CONFIG_SCSI_SATA_SX4 is not set - # CONFIG_SCSI_SATA_SIL is not set -@@ -477,7 +474,6 @@ - CONFIG_SERIAL_DEC_CONSOLE=y - # CONFIG_DZ is not set - CONFIG_ZS=y --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips64/defconfig-ip22 linux-2.4.30-mips/arch/mips64/defconfig-ip22 ---- linux-2.4.30/arch/mips64/defconfig-ip22 2005-01-19 15:09:31.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/defconfig-ip22 2005-03-18 13:13:23.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -235,11 +235,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -319,9 +314,11 @@ - # CONFIG_SCSI_MEGARAID is not set - # CONFIG_SCSI_MEGARAID2 is not set - # CONFIG_SCSI_SATA is not set -+# CONFIG_SCSI_SATA_AHCI is not set - # CONFIG_SCSI_SATA_SVW is not set - # CONFIG_SCSI_ATA_PIIX is not set - # CONFIG_SCSI_SATA_NV is not set -+# CONFIG_SCSI_SATA_QSTOR is not set - # CONFIG_SCSI_SATA_PROMISE is not set - # CONFIG_SCSI_SATA_SX4 is not set - # CONFIG_SCSI_SATA_SIL is not set -@@ -488,7 +485,6 @@ - # CONFIG_SERIAL_TXX9_CONSOLE is not set - # CONFIG_TXX927_SERIAL is not set - CONFIG_IP22_SERIAL=y --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips64/defconfig-ip27 linux-2.4.30-mips/arch/mips64/defconfig-ip27 ---- linux-2.4.30/arch/mips64/defconfig-ip27 2005-01-19 15:09:31.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/defconfig-ip27 2005-03-18 13:13:23.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -470,9 +470,11 @@ - # CONFIG_SCSI_MEGARAID is not set - # CONFIG_SCSI_MEGARAID2 is not set - # CONFIG_SCSI_SATA is not set -+# CONFIG_SCSI_SATA_AHCI is not set - # CONFIG_SCSI_SATA_SVW is not set - # CONFIG_SCSI_ATA_PIIX is not set - # CONFIG_SCSI_SATA_NV is not set -+# CONFIG_SCSI_SATA_QSTOR is not set - # CONFIG_SCSI_SATA_PROMISE is not set - # CONFIG_SCSI_SATA_SX4 is not set - # CONFIG_SCSI_SATA_SIL is not set -@@ -658,7 +660,6 @@ - CONFIG_SERIAL_CONSOLE=y - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips64/defconfig-jaguar linux-2.4.30-mips/arch/mips64/defconfig-jaguar ---- linux-2.4.30/arch/mips64/defconfig-jaguar 2005-01-19 15:09:31.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/defconfig-jaguar 2005-03-18 13:13:23.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -227,11 +227,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -403,7 +398,6 @@ - # CONFIG_SERIAL_TXX9 is not set - # CONFIG_SERIAL_TXX9_CONSOLE is not set - # CONFIG_TXX927_SERIAL is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips64/defconfig-malta linux-2.4.30-mips/arch/mips64/defconfig-malta ---- linux-2.4.30/arch/mips64/defconfig-malta 2005-01-19 15:09:31.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/defconfig-malta 2005-03-18 13:13:23.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -235,11 +235,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -317,9 +312,11 @@ - # CONFIG_SCSI_MEGARAID is not set - # CONFIG_SCSI_MEGARAID2 is not set - # CONFIG_SCSI_SATA is not set -+# CONFIG_SCSI_SATA_AHCI is not set - # CONFIG_SCSI_SATA_SVW is not set - # CONFIG_SCSI_ATA_PIIX is not set - # CONFIG_SCSI_SATA_NV is not set -+# CONFIG_SCSI_SATA_QSTOR is not set - # CONFIG_SCSI_SATA_PROMISE is not set - # CONFIG_SCSI_SATA_SX4 is not set - # CONFIG_SCSI_SATA_SIL is not set -@@ -477,7 +474,6 @@ - CONFIG_SERIAL_CONSOLE=y - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips64/defconfig-ocelotc linux-2.4.30-mips/arch/mips64/defconfig-ocelotc ---- linux-2.4.30/arch/mips64/defconfig-ocelotc 2005-01-19 15:09:31.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/defconfig-ocelotc 2005-03-18 13:13:23.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -231,11 +231,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -453,7 +448,6 @@ - # CONFIG_SERIAL_TXX9 is not set - # CONFIG_SERIAL_TXX9_CONSOLE is not set - # CONFIG_TXX927_SERIAL is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips64/defconfig-sb1250-swarm linux-2.4.30-mips/arch/mips64/defconfig-sb1250-swarm ---- linux-2.4.30/arch/mips64/defconfig-sb1250-swarm 2005-01-19 15:09:31.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/defconfig-sb1250-swarm 2005-03-18 13:13:23.000000000 +0100 -@@ -30,8 +30,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -90,6 +90,7 @@ - # CONFIG_SIBYTE_TBPROF is not set - CONFIG_SIBYTE_GENBUS_IDE=y - CONFIG_SMP_CAPABLE=y -+CONFIG_MIPS_RTC=y - # CONFIG_SNI_RM200_PCI is not set - # CONFIG_TANBAC_TB0226 is not set - # CONFIG_TANBAC_TB0229 is not set -@@ -253,11 +254,6 @@ - # - # CONFIG_IPX is not set - # CONFIG_ATALK is not set -- --# --# Appletalk devices --# --# CONFIG_DEV_APPLETALK is not set - # CONFIG_DECNET is not set - # CONFIG_BRIDGE is not set - # CONFIG_X25 is not set -@@ -432,7 +428,6 @@ - CONFIG_SIBYTE_SB1250_DUART=y - CONFIG_SIBYTE_SB1250_DUART_CONSOLE=y - CONFIG_SERIAL_CONSOLE=y --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - CONFIG_UNIX98_PTYS=y - CONFIG_UNIX98_PTY_COUNT=256 - -diff -Nur linux-2.4.30/arch/mips64/defconfig-sead linux-2.4.30-mips/arch/mips64/defconfig-sead ---- linux-2.4.30/arch/mips64/defconfig-sead 2005-01-19 15:09:31.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/defconfig-sead 2005-03-18 13:13:23.000000000 +0100 -@@ -28,8 +28,8 @@ - # CONFIG_MIPS_PB1000 is not set - # CONFIG_MIPS_PB1100 is not set - # CONFIG_MIPS_PB1500 is not set --# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_PB1550 is not set -+# CONFIG_MIPS_HYDROGEN3 is not set - # CONFIG_MIPS_XXS1500 is not set - # CONFIG_MIPS_MTX1 is not set - # CONFIG_COGENT_CSB250 is not set -@@ -242,7 +242,6 @@ - CONFIG_SERIAL_CONSOLE=y - # CONFIG_SERIAL_EXTENDED is not set - # CONFIG_SERIAL_NONSTANDARD is not set --# CONFIG_MIPS_HYDROGEN3_BUTTONS is not set - # CONFIG_UNIX98_PTYS is not set - - # -diff -Nur linux-2.4.30/arch/mips64/kernel/binfmt_elfn32.c linux-2.4.30-mips/arch/mips64/kernel/binfmt_elfn32.c ---- linux-2.4.30/arch/mips64/kernel/binfmt_elfn32.c 2003-08-25 13:44:40.000000000 +0200 -+++ linux-2.4.30-mips/arch/mips64/kernel/binfmt_elfn32.c 2005-01-26 03:40:47.000000000 +0100 -@@ -116,4 +116,7 @@ - #undef MODULE_DESCRIPTION - #undef MODULE_AUTHOR - -+#undef TASK_SIZE -+#define TASK_SIZE TASK_SIZE32 -+ - #include "../../../fs/binfmt_elf.c" -diff -Nur linux-2.4.30/arch/mips64/kernel/binfmt_elfo32.c linux-2.4.30-mips/arch/mips64/kernel/binfmt_elfo32.c ---- linux-2.4.30/arch/mips64/kernel/binfmt_elfo32.c 2003-08-25 13:44:40.000000000 +0200 -+++ linux-2.4.30-mips/arch/mips64/kernel/binfmt_elfo32.c 2005-01-26 03:40:47.000000000 +0100 -@@ -137,4 +137,7 @@ - #undef MODULE_DESCRIPTION - #undef MODULE_AUTHOR - -+#undef TASK_SIZE -+#define TASK_SIZE TASK_SIZE32 -+ - #include "../../../fs/binfmt_elf.c" -diff -Nur linux-2.4.30/arch/mips64/kernel/head.S linux-2.4.30-mips/arch/mips64/kernel/head.S ---- linux-2.4.30/arch/mips64/kernel/head.S 2004-02-18 14:36:30.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/kernel/head.S 2004-11-22 14:38:26.000000000 +0100 -@@ -91,6 +91,21 @@ - __INIT - - NESTED(kernel_entry, 16, sp) # kernel entry point -+ .set push -+ /* -+ * For the moment disable interrupts, mark the kernel mode and -+ * set ST0_KX so that the CPU does not spit fire when using -+ * 64-bit addresses. A full initialization of the CPU's status -+ * register is done later in per_cpu_trap_init(). -+ */ -+ mfc0 t0, CP0_STATUS -+ or t0, ST0_CU0|ST0_KX|0x1f -+ xor t0, 0x1f -+ mtc0 t0, CP0_STATUS -+ -+ .set noreorder -+ sll zero,3 # ehb -+ .set reorder - - ori sp, 0xf # align stack on 16 byte. - xori sp, 0xf -@@ -103,8 +118,6 @@ - - ARC64_TWIDDLE_PC - -- CLI # disable interrupts -- - /* - * The firmware/bootloader passes argc/argp/envp - * to us as arguments. But clear bss first because -@@ -125,6 +138,7 @@ - dsubu sp, 4*SZREG # init stack pointer - - j init_arch -+ .set pop - END(kernel_entry) - - #ifdef CONFIG_SMP -@@ -133,6 +147,23 @@ - * function after setting up the stack and gp registers. - */ - NESTED(smp_bootstrap, 16, sp) -+ .set push -+ /* -+ * For the moment disable interrupts and bootstrap exception -+ * vectors, mark the kernel mode and set ST0_KX so that the CPU -+ * does not spit fire when using 64-bit addresses. A full -+ * initialization of the CPU's status register is done later in -+ * per_cpu_trap_init(). -+ */ -+ mfc0 t0, CP0_STATUS -+ or t0, ST0_CU0|ST0_BEV|ST0_KX|0x1f -+ xor t0, ST0_BEV|0x1f -+ mtc0 t0, CP0_STATUS -+ -+ .set noreorder -+ sll zero,3 # ehb -+ .set reorder -+ - #ifdef CONFIG_SGI_IP27 - GET_NASID_ASM t1 - dli t0, KLDIR_OFFSET + (KLI_KERN_VARS * KLDIR_ENT_SIZE) + \ -@@ -146,19 +177,8 @@ - ARC64_TWIDDLE_PC - #endif /* CONFIG_SGI_IP27 */ - -- CLI -- -- /* -- * For the moment set ST0_KU so the CPU will not spit fire when -- * executing 64-bit instructions. The full initialization of the -- * CPU's status register is done later in per_cpu_trap_init(). -- */ -- mfc0 t0, CP0_STATUS -- or t0, ST0_KX -- mtc0 t0, CP0_STATUS -- - jal start_secondary # XXX: IP27: cboot -- -+ .set pop - END(smp_bootstrap) - #endif /* CONFIG_SMP */ - -diff -Nur linux-2.4.30/arch/mips64/kernel/ioctl32.c linux-2.4.30-mips/arch/mips64/kernel/ioctl32.c ---- linux-2.4.30/arch/mips64/kernel/ioctl32.c 2005-01-19 15:09:31.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/kernel/ioctl32.c 2005-01-26 03:36:17.000000000 +0100 -@@ -2352,7 +2352,7 @@ - IOCTL32_HANDLER(AUTOFS_IOC_SETTIMEOUT32, ioc_settimeout), - IOCTL32_DEFAULT(AUTOFS_IOC_EXPIRE), - IOCTL32_DEFAULT(AUTOFS_IOC_EXPIRE_MULTI), -- IOCTL32_DEFAULT(AUTOFS_IOC_PROTSUBVER), -+ IOCTL32_DEFAULT(AUTOFS_IOC_PROTOSUBVER), - IOCTL32_DEFAULT(AUTOFS_IOC_ASKREGHOST), - IOCTL32_DEFAULT(AUTOFS_IOC_TOGGLEREGHOST), - IOCTL32_DEFAULT(AUTOFS_IOC_ASKUMOUNT), -diff -Nur linux-2.4.30/arch/mips64/kernel/linux32.c linux-2.4.30-mips/arch/mips64/kernel/linux32.c ---- linux-2.4.30/arch/mips64/kernel/linux32.c 2005-04-04 03:42:19.000000000 +0200 -+++ linux-2.4.30-mips/arch/mips64/kernel/linux32.c 2005-03-18 13:13:23.000000000 +0100 -@@ -1187,72 +1187,19 @@ - lseek back to original location. They fail just like lseek does on - non-seekable files. */ - --asmlinkage ssize_t sys32_pread(unsigned int fd, char * buf, -- size_t count, u32 unused, u64 a4, u64 a5) -+asmlinkage ssize_t sys32_pread(unsigned int fd, char *buf, -+ size_t count, u32 unused, u64 a4, u64 a5) - { -- ssize_t ret; -- struct file * file; -- ssize_t (*read)(struct file *, char *, size_t, loff_t *); -- loff_t pos; -- -- ret = -EBADF; -- file = fget(fd); -- if (!file) -- goto bad_file; -- if (!(file->f_mode & FMODE_READ)) -- goto out; -- pos = merge_64(a4, a5); -- ret = locks_verify_area(FLOCK_VERIFY_READ, file->f_dentry->d_inode, -- file, pos, count); -- if (ret) -- goto out; -- ret = -EINVAL; -- if (!file->f_op || !(read = file->f_op->read)) -- goto out; -- if (pos < 0) -- goto out; -- ret = read(file, buf, count, &pos); -- if (ret > 0) -- dnotify_parent(file->f_dentry, DN_ACCESS); --out: -- fput(file); --bad_file: -- return ret; -+ return sys_pread(fd, buf, count, merge_64(a4, a5)); - } - - asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char * buf, - size_t count, u32 unused, u64 a4, u64 a5) - { -- ssize_t ret; -- struct file * file; -- ssize_t (*write)(struct file *, const char *, size_t, loff_t *); -- loff_t pos; -- -- ret = -EBADF; -- file = fget(fd); -- if (!file) -- goto bad_file; -- if (!(file->f_mode & FMODE_WRITE)) -- goto out; -- pos = merge_64(a4, a5); -- ret = locks_verify_area(FLOCK_VERIFY_WRITE, file->f_dentry->d_inode, -- file, pos, count); -- if (ret) -- goto out; -- ret = -EINVAL; -- if (!file->f_op || !(write = file->f_op->write)) -- goto out; -- if (pos < 0) -- goto out; -- -- ret = write(file, buf, count, &pos); -- if (ret > 0) -- dnotify_parent(file->f_dentry, DN_MODIFY); --out: -- fput(file); --bad_file: -- return ret; -+ return sys_pwrite(fd, buf, count, merge_64(a4, a5)); - } -+ -+ - /* - * Ooo, nasty. We need here to frob 32-bit unsigned longs to - * 64-bit unsigned longs. -diff -Nur linux-2.4.30/arch/mips64/kernel/scall_64.S linux-2.4.30-mips/arch/mips64/kernel/scall_64.S ---- linux-2.4.30/arch/mips64/kernel/scall_64.S 2005-01-19 15:09:32.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/kernel/scall_64.S 2005-02-07 22:21:54.000000000 +0100 -@@ -102,15 +102,14 @@ - - trace_a_syscall: - SAVE_STATIC -- sd t2,PT_R1(sp) -+ move s0, t2 - jal syscall_trace -- ld t2,PT_R1(sp) - - ld a0, PT_R4(sp) # Restore argument registers - ld a1, PT_R5(sp) - ld a2, PT_R6(sp) - ld a3, PT_R7(sp) -- jalr t2 -+ jalr s0 - - li t0, -EMAXERRNO - 1 # error? - sltu t0, t0, v0 -diff -Nur linux-2.4.30/arch/mips64/kernel/scall_n32.S linux-2.4.30-mips/arch/mips64/kernel/scall_n32.S ---- linux-2.4.30/arch/mips64/kernel/scall_n32.S 2005-01-19 15:09:32.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/kernel/scall_n32.S 2005-02-07 22:21:54.000000000 +0100 -@@ -106,15 +106,14 @@ - - trace_a_syscall: - SAVE_STATIC -- sd t2,PT_R1(sp) -+ move s0, t2 - jal syscall_trace -- ld t2,PT_R1(sp) - - ld a0, PT_R4(sp) # Restore argument registers - ld a1, PT_R5(sp) - ld a2, PT_R6(sp) - ld a3, PT_R7(sp) -- jalr t2 -+ jalr s0 - - li t0, -EMAXERRNO - 1 # error? - sltu t0, t0, v0 -diff -Nur linux-2.4.30/arch/mips64/kernel/scall_o32.S linux-2.4.30-mips/arch/mips64/kernel/scall_o32.S ---- linux-2.4.30/arch/mips64/kernel/scall_o32.S 2005-01-19 15:09:32.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/kernel/scall_o32.S 2005-02-14 04:52:57.000000000 +0100 -@@ -118,9 +118,8 @@ - sd a6, PT_R10(sp) - sd a7, PT_R11(sp) - -- sd t2,PT_R1(sp) -+ move s0, t2 - jal syscall_trace -- ld t2,PT_R1(sp) - - ld a0, PT_R4(sp) # Restore argument registers - ld a1, PT_R5(sp) -@@ -129,7 +128,7 @@ - ld a4, PT_R8(sp) - ld a5, PT_R9(sp) - -- jalr t2 -+ jalr s0 - - li t0, -EMAXERRNO - 1 # error? - sltu t0, t0, v0 -@@ -576,6 +575,8 @@ - sys_call_table: - syscalltable - -+ .purgem sys -+ - .macro sys function, nargs - .byte \nargs - .endm -diff -Nur linux-2.4.30/arch/mips64/kernel/setup.c linux-2.4.30-mips/arch/mips64/kernel/setup.c ---- linux-2.4.30/arch/mips64/kernel/setup.c 2005-01-19 15:09:32.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/kernel/setup.c 2004-11-22 14:38:26.000000000 +0100 -@@ -129,14 +129,6 @@ - */ - load_mmu(); - -- /* -- * On IP27, I am seeing the TS bit set when the kernel is loaded. -- * Maybe because the kernel is in ckseg0 and not xkphys? Clear it -- * anyway ... -- */ -- clear_c0_status(ST0_BEV|ST0_TS|ST0_CU1|ST0_CU2|ST0_CU3); -- set_c0_status(ST0_CU0|ST0_KX|ST0_SX|ST0_FR); -- - start_kernel(); - } - -diff -Nur linux-2.4.30/arch/mips64/kernel/signal_n32.c linux-2.4.30-mips/arch/mips64/kernel/signal_n32.c ---- linux-2.4.30/arch/mips64/kernel/signal_n32.c 2005-01-19 15:09:33.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/kernel/signal_n32.c 2005-02-07 22:10:53.000000000 +0100 -@@ -68,7 +68,7 @@ - }; - - extern asmlinkage int restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc); --extern int inline setup_sigcontext(struct pt_regs *regs, struct sigcontext *sc); -+extern int setup_sigcontext(struct pt_regs *regs, struct sigcontext *sc); - - asmlinkage void sysn32_rt_sigreturn(abi64_no_regargs, struct pt_regs regs) - { -diff -Nur linux-2.4.30/arch/mips64/kernel/traps.c linux-2.4.30-mips/arch/mips64/kernel/traps.c ---- linux-2.4.30/arch/mips64/kernel/traps.c 2005-01-19 15:09:33.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/kernel/traps.c 2005-04-12 22:25:34.000000000 +0200 -@@ -462,9 +462,10 @@ - } - ll_task = current; - -+ compute_return_epc(regs); -+ - regs->regs[(opcode & RT) >> 16] = value; - -- compute_return_epc(regs); - return; - - sig: -@@ -495,8 +496,8 @@ - goto sig; - } - if (ll_bit == 0 || ll_task != current) { -- regs->regs[reg] = 0; - compute_return_epc(regs); -+ regs->regs[reg] = 0; - return; - } - -@@ -505,9 +506,9 @@ - goto sig; - } - -+ compute_return_epc(regs); - regs->regs[reg] = 1; - -- compute_return_epc(regs); - return; - - sig: -@@ -809,13 +810,18 @@ - void __init per_cpu_trap_init(void) - { - unsigned int cpu = smp_processor_id(); -+ unsigned int status_set = ST0_CU0|ST0_FR|ST0_KX|ST0_SX|ST0_UX; - -- /* Some firmware leaves the BEV flag set, clear it. */ -- clear_c0_status(ST0_CU1|ST0_CU2|ST0_CU3|ST0_BEV); -- set_c0_status(ST0_CU0|ST0_FR|ST0_KX|ST0_SX|ST0_UX); -- -+ /* -+ * Disable coprocessors, enable 64-bit addressing and set FPU -+ * for the 32/32 FPR register model. Reset the BEV flag that -+ * some firmware may have left set and the TS bit (for IP27). -+ * Set XX for ISA IV code to work. -+ */ - if (current_cpu_data.isa_level == MIPS_CPU_ISA_IV) -- set_c0_status(ST0_XX); -+ status_set |= ST0_XX; -+ change_c0_status(ST0_CU|ST0_FR|ST0_BEV|ST0_TS|ST0_KX|ST0_SX|ST0_UX, -+ status_set); - - /* - * Some MIPS CPUs have a dedicated interrupt vector which reduces the -@@ -825,13 +831,11 @@ - set_c0_cause(CAUSEF_IV); - - cpu_data[cpu].asid_cache = ASID_FIRST_VERSION; -- write_c0_context(((long)(&pgd_current[cpu])) << 23); -- write_c0_wired(0); -+ TLBMISS_HANDLER_SETUP(); - - atomic_inc(&init_mm.mm_count); - current->active_mm = &init_mm; -- if (current->mm) -- BUG(); -+ BUG_ON(current->mm); - enter_lazy_tlb(&init_mm, current, cpu); - } - -@@ -842,8 +846,6 @@ - extern char except_vec4; - unsigned long i; - -- per_cpu_trap_init(); -- - /* Copy the generic exception handlers to their final destination. */ - memcpy((void *) KSEG0 , &except_vec0_generic, 0x80); - memcpy((void *)(KSEG0 + 0x180), &except_vec3_generic, 0x80); -@@ -933,6 +935,5 @@ - - flush_icache_range(KSEG0, KSEG0 + 0x400); - -- atomic_inc(&init_mm.mm_count); /* XXX UP? */ -- current->active_mm = &init_mm; -+ per_cpu_trap_init(); - } -diff -Nur linux-2.4.30/arch/mips64/mm/c-r4k.c linux-2.4.30-mips/arch/mips64/mm/c-r4k.c ---- linux-2.4.30/arch/mips64/mm/c-r4k.c 2005-01-19 15:09:33.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/mm/c-r4k.c 2005-02-06 22:55:42.000000000 +0100 -@@ -867,9 +867,16 @@ - * normally they'd suffer from aliases but magic in the hardware deals - * with that for us so we don't need to take care ourselves. - */ -- if (c->cputype != CPU_R10000 && c->cputype != CPU_R12000) -- if (c->dcache.waysize > PAGE_SIZE) -- c->dcache.flags |= MIPS_CACHE_ALIASES; -+ switch (c->cputype) { -+ case CPU_R10000: -+ case CPU_R12000: -+ break; -+ case CPU_24K: -+ if (!(read_c0_config7() & (1 << 16))) -+ default: -+ if (c->dcache.waysize > PAGE_SIZE) -+ c->dcache.flags |= MIPS_CACHE_ALIASES; -+ } - - switch (c->cputype) { - case CPU_20KC: -@@ -1070,9 +1077,6 @@ - setup_scache(); - coherency_setup(); - -- if (c->dcache.sets * c->dcache.ways > PAGE_SIZE) -- c->dcache.flags |= MIPS_CACHE_ALIASES; -- - r4k_blast_dcache_page_setup(); - r4k_blast_dcache_page_indexed_setup(); - r4k_blast_dcache_setup(); -diff -Nur linux-2.4.30/arch/mips64/mm/cerr-sb1.c linux-2.4.30-mips/arch/mips64/mm/cerr-sb1.c ---- linux-2.4.30/arch/mips64/mm/cerr-sb1.c 2004-02-18 14:36:30.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/mm/cerr-sb1.c 2004-12-13 18:37:26.000000000 +0100 -@@ -252,14 +252,14 @@ - - /* Masks to select bits for Hamming parity, mask_72_64[i] for bit[i] */ - static const uint64_t mask_72_64[8] = { -- 0x0738C808099264FFL, -- 0x38C808099264FF07L, -- 0xC808099264FF0738L, -- 0x08099264FF0738C8L, -- 0x099264FF0738C808L, -- 0x9264FF0738C80809L, -- 0x64FF0738C8080992L, -- 0xFF0738C808099264L -+ 0x0738C808099264FFULL, -+ 0x38C808099264FF07ULL, -+ 0xC808099264FF0738ULL, -+ 0x08099264FF0738C8ULL, -+ 0x099264FF0738C808ULL, -+ 0x9264FF0738C80809ULL, -+ 0x64FF0738C8080992ULL, -+ 0xFF0738C808099264ULL - }; - - /* Calculate the parity on a range of bits */ -@@ -331,9 +331,9 @@ - ((lru >> 4) & 0x3), - ((lru >> 6) & 0x3)); - } -- va = (taglo & 0xC0000FFFFFFFE000) | addr; -+ va = (taglo & 0xC0000FFFFFFFE000ULL) | addr; - if ((taglo & (1 << 31)) && (((taglo >> 62) & 0x3) == 3)) -- va |= 0x3FFFF00000000000; -+ va |= 0x3FFFF00000000000ULL; - valid = ((taghi >> 29) & 1); - if (valid) { - tlo_tmp = taglo & 0xfff3ff; -@@ -474,7 +474,7 @@ - : "r" ((way << 13) | addr)); - - taglo = ((unsigned long long)taglohi << 32) | taglolo; -- pa = (taglo & 0xFFFFFFE000) | addr; -+ pa = (taglo & 0xFFFFFFE000ULL) | addr; - if (way == 0) { - lru = (taghi >> 14) & 0xff; - prom_printf("[Bank %d Set 0x%02x] LRU > %d %d %d %d > MRU\n", -diff -Nur linux-2.4.30/arch/mips64/mm/tlb-r4k.c linux-2.4.30-mips/arch/mips64/mm/tlb-r4k.c ---- linux-2.4.30/arch/mips64/mm/tlb-r4k.c 2005-01-19 15:09:33.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/mm/tlb-r4k.c 2004-11-25 23:18:38.000000000 +0100 -@@ -1,24 +1,12 @@ - /* -- * Carsten Langgaard, carstenl@mips.com -- * Copyright (C) 2002 MIPS Technologies, Inc. All rights reserved. -- * -- * This program is free software; you can distribute 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 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 -+ * 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. - * -- * 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. -- * -- * MIPS64 CPU variant specific MMU routines. -- * These routine are not optimized in any way, they are done in a generic way -- * so they can be used on all MIPS64 compliant CPUs, and also done in an -- * attempt not to break anything for the R4xx0 style CPUs. -+ * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com) -+ * Copyright (C) 1997, 1998, 1999, 2000 Ralf Baechle ralf@gnu.org -+ * Carsten Langgaard, carstenl@mips.com -+ * Copyright (C) 2002 MIPS Technologies, Inc. All rights reserved. - */ - #include - #include -@@ -30,9 +18,6 @@ - #include - #include - --#undef DEBUG_TLB --#undef DEBUG_TLBUPDATE -- - extern void except_vec1_r4k(void); - - /* CP0 hazard avoidance. */ -@@ -46,31 +31,23 @@ - unsigned long old_ctx; - int entry; - --#ifdef DEBUG_TLB -- printk("[tlball]"); --#endif -- - local_irq_save(flags); - /* Save old context and create impossible VPN2 value */ - old_ctx = read_c0_entryhi(); -- write_c0_entryhi(XKPHYS); - write_c0_entrylo0(0); - write_c0_entrylo1(0); -- BARRIER; - - entry = read_c0_wired(); - - /* Blast 'em all away. */ -- while(entry < current_cpu_data.tlbsize) { -- /* Make sure all entries differ. */ -- write_c0_entryhi(XKPHYS+entry*0x2000); -+ while (entry < current_cpu_data.tlbsize) { -+ write_c0_entryhi(XKPHYS + entry*0x2000); - write_c0_index(entry); -- BARRIER; -+ mtc0_tlbw_hazard(); - tlb_write_indexed(); -- BARRIER; - entry++; - } -- BARRIER; -+ tlbw_use_hazard(); - write_c0_entryhi(old_ctx); - local_irq_restore(flags); - } -@@ -79,12 +56,8 @@ - { - int cpu = smp_processor_id(); - -- if (cpu_context(cpu, mm) != 0) { --#ifdef DEBUG_TLB -- printk("[tlbmm<%d>]", mm->context); --#endif -+ if (cpu_context(cpu, mm) != 0) - drop_mmu_context(mm,cpu); -- } - } - - void local_flush_tlb_range(struct mm_struct *mm, unsigned long start, -@@ -96,10 +69,6 @@ - unsigned long flags; - int size; - --#ifdef DEBUG_TLB -- printk("[tlbrange<%02x,%08lx,%08lx>]", (mm->context & ASID_MASK), -- start, end); --#endif - local_irq_save(flags); - size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT; - size = (size + 1) >> 1; -@@ -110,25 +79,25 @@ - start &= (PAGE_MASK << 1); - end += ((PAGE_SIZE << 1) - 1); - end &= (PAGE_MASK << 1); -- while(start < end) { -+ while (start < end) { - int idx; - - write_c0_entryhi(start | newpid); - start += (PAGE_SIZE << 1); -- BARRIER; -+ mtc0_tlbw_hazard(); - tlb_probe(); - BARRIER; - idx = read_c0_index(); - write_c0_entrylo0(0); - write_c0_entrylo1(0); -- if(idx < 0) -+ if (idx < 0) - continue; - /* Make sure all entries differ. */ - write_c0_entryhi(XKPHYS+idx*0x2000); -- BARRIER; -+ mtc0_tlbw_hazard(); - tlb_write_indexed(); -- BARRIER; - } -+ tlbw_use_hazard(); - write_c0_entryhi(oldpid); - } else { - drop_mmu_context(mm, cpu); -@@ -145,28 +114,26 @@ - unsigned long flags; - unsigned long oldpid, newpid, idx; - --#ifdef DEBUG_TLB -- printk("[tlbpage<%d,%08lx>]", vma->vm_mm->context, page); --#endif - newpid = cpu_asid(cpu, vma->vm_mm); - page &= (PAGE_MASK << 1); - local_irq_save(flags); - oldpid = read_c0_entryhi(); - write_c0_entryhi(page | newpid); -- BARRIER; -+ mtc0_tlbw_hazard(); - tlb_probe(); - BARRIER; - idx = read_c0_index(); - write_c0_entrylo0(0); - write_c0_entrylo1(0); -- if(idx < 0) -+ if (idx < 0) - goto finish; - /* Make sure all entries differ. */ - write_c0_entryhi(XKPHYS+idx*0x2000); -- BARRIER; -+ mtc0_tlbw_hazard(); - tlb_write_indexed(); -+ tlbw_use_hazard(); -+ - finish: -- BARRIER; - write_c0_entryhi(oldpid); - local_irq_restore(flags); - } -@@ -186,7 +153,7 @@ - - local_irq_save(flags); - write_c0_entryhi(page); -- BARRIER; -+ mtc0_tlbw_hazard(); - tlb_probe(); - BARRIER; - idx = read_c0_index(); -@@ -195,10 +162,12 @@ - if (idx >= 0) { - /* Make sure all entries differ. */ - write_c0_entryhi(KSEG0+idx*0x2000); -+ mtc0_tlbw_hazard(); - tlb_write_indexed(); -+ tlbw_use_hazard(); - } -- BARRIER; - write_c0_entryhi(oldpid); -+ - local_irq_restore(flags); - } - -@@ -208,7 +177,6 @@ - void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte) - { - unsigned long flags; -- unsigned int asid; - pgd_t *pgdp; - pmd_t *pmdp; - pte_t *ptep; -@@ -222,70 +190,58 @@ - - pid = read_c0_entryhi() & ASID_MASK; - --#ifdef DEBUG_TLB -- if ((pid != (cpu_asid(smp_processor_id(), vma->vm_mm))) || -- (cpu_context(smp_processor_id(), vma->vm_mm) == 0)) { -- printk("update_mmu_cache: Wheee, bogus tlbpid mmpid=%d" -- "tlbpid=%d\n", (int) (cpu_context(smp_processor_id(), -- vma->vm_mm) & ASID_MASK), pid); -- } --#endif -- - local_irq_save(flags); - address &= (PAGE_MASK << 1); -- write_c0_entryhi(address | (pid)); -+ write_c0_entryhi(address | pid); - pgdp = pgd_offset(vma->vm_mm, address); -- BARRIER; -+ mtc0_tlbw_hazard(); - tlb_probe(); - BARRIER; - pmdp = pmd_offset(pgdp, address); - idx = read_c0_index(); - ptep = pte_offset(pmdp, address); -- BARRIER; - write_c0_entrylo0(pte_val(*ptep++) >> 6); - write_c0_entrylo1(pte_val(*ptep) >> 6); -- write_c0_entryhi(address | (pid)); -- BARRIER; -- if(idx < 0) { -+ write_c0_entryhi(address | pid); -+ mtc0_tlbw_hazard(); -+ if (idx < 0) - tlb_write_random(); -- } else { -+ else - tlb_write_indexed(); -- } -- BARRIER; -+ tlbw_use_hazard(); - write_c0_entryhi(pid); -- BARRIER; - local_irq_restore(flags); - } - --void add_wired_entry(unsigned long entrylo0, unsigned long entrylo1, -- unsigned long entryhi, unsigned long pagemask) -+void __init add_wired_entry(unsigned long entrylo0, unsigned long entrylo1, -+ unsigned long entryhi, unsigned long pagemask) - { -- unsigned long flags; -- unsigned long wired; -- unsigned long old_pagemask; -- unsigned long old_ctx; -- -- local_irq_save(flags); -- /* Save old context and create impossible VPN2 value */ -- old_ctx = (read_c0_entryhi() & ASID_MASK); -- old_pagemask = read_c0_pagemask(); -- wired = read_c0_wired(); -- write_c0_wired(wired + 1); -- write_c0_index(wired); -- BARRIER; -- write_c0_pagemask(pagemask); -- write_c0_entryhi(entryhi); -- write_c0_entrylo0(entrylo0); -- write_c0_entrylo1(entrylo1); -- BARRIER; -- tlb_write_indexed(); -- BARRIER; -- -- write_c0_entryhi(old_ctx); -- BARRIER; -- write_c0_pagemask(old_pagemask); -- local_flush_tlb_all(); -- local_irq_restore(flags); -+ unsigned long flags; -+ unsigned long wired; -+ unsigned long old_pagemask; -+ unsigned long old_ctx; -+ -+ local_irq_save(flags); -+ /* Save old context and create impossible VPN2 value */ -+ old_ctx = read_c0_entryhi() & ASID_MASK; -+ old_pagemask = read_c0_pagemask(); -+ wired = read_c0_wired(); -+ write_c0_wired(wired + 1); -+ write_c0_index(wired); -+ BARRIER; -+ write_c0_pagemask(pagemask); -+ write_c0_entryhi(entryhi); -+ write_c0_entrylo0(entrylo0); -+ write_c0_entrylo1(entrylo1); -+ mtc0_tlbw_hazard(); -+ tlb_write_indexed(); -+ tlbw_use_hazard(); -+ -+ write_c0_entryhi(old_ctx); -+ BARRIER; -+ write_c0_pagemask(old_pagemask); -+ local_flush_tlb_all(); -+ local_irq_restore(flags); - } - - /* -@@ -317,17 +273,15 @@ - } - - write_c0_index(temp_tlb_entry); -- BARRIER; - write_c0_pagemask(pagemask); - write_c0_entryhi(entryhi); - write_c0_entrylo0(entrylo0); - write_c0_entrylo1(entrylo1); -- BARRIER; -+ mtc0_tlbw_hazard(); - tlb_write_indexed(); -- BARRIER; -+ tlbw_use_hazard(); - - write_c0_entryhi(old_ctx); -- BARRIER; - write_c0_pagemask(old_pagemask); - out: - local_irq_restore(flags); -@@ -348,15 +302,23 @@ - return; - - config1 = read_c0_config1(); -- if (!((config1 >> 7) & 3)) -- panic("No MMU present"); -+ if (!((config >> 7) & 3)) -+ panic("No TLB present"); - - c->tlbsize = ((config1 >> 25) & 0x3f) + 1; - } - - void __init r4k_tlb_init(void) - { -- unsigned long config = read_c0_config(); -+ unsigned int config = read_c0_config(); -+ -+ /* -+ * You should never change this register: -+ * - On R4600 1.7 the tlbp never hits for pages smaller than -+ * the value in the c0_pagemask register. -+ * - The entire mm handling assumes the c0_pagemask register to -+ * be set for 4kb pages. -+ */ - probe_tlb(config); - write_c0_pagemask(PM_DEFAULT_MASK); - write_c0_wired(0); -diff -Nur linux-2.4.30/arch/mips64/mm/tlbex-r4k.S linux-2.4.30-mips/arch/mips64/mm/tlbex-r4k.S ---- linux-2.4.30/arch/mips64/mm/tlbex-r4k.S 2004-02-18 14:36:30.000000000 +0100 -+++ linux-2.4.30-mips/arch/mips64/mm/tlbex-r4k.S 2004-11-25 23:18:38.000000000 +0100 -@@ -151,11 +151,9 @@ - ld k0, 0(k1) # get even pte - ld k1, 8(k1) # get odd pte - PTE_RELOAD k0 k1 -- rm9000_tlb_hazard -- b 1f -- tlbwr --1: nop -- rm9000_tlb_hazard -+ mtc0_tlbw_hazard -+ tlbwr -+1: tlbw_eret_hazard - eret - - 9: # handle the vmalloc range -@@ -163,11 +161,9 @@ - ld k0, 0(k1) # get even pte - ld k1, 8(k1) # get odd pte - PTE_RELOAD k0 k1 -- rm9000_tlb_hazard -- b 1f -- tlbwr --1: nop -- rm9000_tlb_hazard -+ mtc0_tlbw_hazard -+ tlbwr -+1: tlbw_eret_hazard - eret - END(handle_vec1_r4k) - -@@ -195,10 +191,9 @@ - ld k0, 0(k1) # get even pte - ld k1, 8(k1) # get odd pte - PTE_RELOAD k0 k1 -- rm9000_tlb_hazard -- nop -+ mtc0_tlbw_hazard - tlbwr -- rm9000_tlb_hazard -+ tlbw_eret_hazard - eret - - 9: # handle the vmalloc range -@@ -206,10 +201,9 @@ - ld k0, 0(k1) # get even pte - ld k1, 8(k1) # get odd pte - PTE_RELOAD k0 k1 -- rm9000_tlb_hazard -- nop -+ mtc0_tlbw_hazard - tlbwr -- rm9000_tlb_hazard -+ tlbw_eret_hazard - eret - END(handle_vec1_r10k) - -diff -Nur linux-2.4.30/drivers/char/Config.in linux-2.4.30-mips/drivers/char/Config.in ---- linux-2.4.30/drivers/char/Config.in 2004-08-08 01:26:04.000000000 +0200 -+++ linux-2.4.30-mips/drivers/char/Config.in 2005-02-11 22:09:56.000000000 +0100 -@@ -313,14 +313,11 @@ - if [ "$CONFIG_OBSOLETE" = "y" -a "$CONFIG_ALPHA_BOOK1" = "y" ]; then - bool 'Tadpole ANA H8 Support (OBSOLETE)' CONFIG_H8 - fi --if [ "$CONFIG_MIPS" = "y" -a "$CONFIG_NEW_TIME_C" = "y" ]; then -- tristate 'Generic MIPS RTC Support' CONFIG_MIPS_RTC --fi - if [ "$CONFIG_SGI_IP22" = "y" ]; then -- bool 'SGI DS1286 RTC support' CONFIG_SGI_DS1286 -+ tristate 'Dallas DS1286 RTC support' CONFIG_DS1286 - fi - if [ "$CONFIG_SGI_IP27" = "y" ]; then -- bool 'SGI M48T35 RTC support' CONFIG_SGI_IP27_RTC -+ tristate 'SGI M48T35 RTC support' CONFIG_SGI_IP27_RTC - fi - if [ "$CONFIG_TOSHIBA_RBTX4927" = "y" -o "$CONFIG_TOSHIBA_JMR3927" = "y" ]; then - tristate 'Dallas DS1742 RTC support' CONFIG_DS1742 -@@ -383,6 +380,11 @@ - source drivers/char/drm/Config.in - fi - fi -+ -+if [ "$CONFIG_X86" = "y" ]; then -+ tristate 'ACP Modem (Mwave) support' CONFIG_MWAVE -+fi -+ - endmenu - - if [ "$CONFIG_HOTPLUG" = "y" -a "$CONFIG_PCMCIA" != "n" ]; then -@@ -391,6 +393,7 @@ - if [ "$CONFIG_SOC_AU1X00" = "y" ]; then - tristate ' Alchemy Au1x00 GPIO device support' CONFIG_AU1X00_GPIO - tristate ' Au1000/ADS7846 touchscreen support' CONFIG_TS_AU1X00_ADS7846 -+ #tristate ' Alchemy Au1550 PSC SPI support' CONFIG_AU1550_PSC_SPI - fi - if [ "$CONFIG_MIPS_ITE8172" = "y" ]; then - tristate ' ITE GPIO' CONFIG_ITE_GPIO -diff -Nur linux-2.4.30/drivers/char/Makefile linux-2.4.30-mips/drivers/char/Makefile ---- linux-2.4.30/drivers/char/Makefile 2004-08-08 01:26:04.000000000 +0200 -+++ linux-2.4.30-mips/drivers/char/Makefile 2005-02-11 22:09:56.000000000 +0100 -@@ -48,7 +48,12 @@ - KEYBD = - endif - ifeq ($(CONFIG_VR41XX_KIU),y) -- KEYMAP = -+ ifeq ($(CONFIG_IBM_WORKPAD),y) -+ KEYMAP = ibm_workpad_keymap.o -+ endif -+ ifeq ($(CONFIG_VICTOR_MPC30X),y) -+ KEYMAP = victor_mpc30x_keymap.o -+ endif - KEYBD = vr41xx_keyb.o - endif - endif -@@ -251,7 +256,6 @@ - obj-$(CONFIG_RTC) += rtc.o - obj-$(CONFIG_GEN_RTC) += genrtc.o - obj-$(CONFIG_EFI_RTC) += efirtc.o --obj-$(CONFIG_SGI_DS1286) += ds1286.o - obj-$(CONFIG_MIPS_RTC) += mips_rtc.o - obj-$(CONFIG_SGI_IP27_RTC) += ip27-rtc.o - ifeq ($(CONFIG_PPC),) -@@ -259,6 +263,7 @@ - endif - obj-$(CONFIG_TOSHIBA) += toshiba.o - obj-$(CONFIG_I8K) += i8k.o -+obj-$(CONFIG_DS1286) += ds1286.o - obj-$(CONFIG_DS1620) += ds1620.o - obj-$(CONFIG_DS1742) += ds1742.o - obj-$(CONFIG_INTEL_RNG) += i810_rng.o -@@ -269,6 +274,7 @@ - - obj-$(CONFIG_ITE_GPIO) += ite_gpio.o - obj-$(CONFIG_AU1X00_GPIO) += au1000_gpio.o -+obj-$(CONFIG_AU1550_PSC_SPI) += au1550_psc_spi.o - obj-$(CONFIG_AU1X00_USB_TTY) += au1000_usbtty.o - obj-$(CONFIG_AU1X00_USB_RAW) += au1000_usbraw.o - obj-$(CONFIG_COBALT_LCD) += lcd.o -@@ -353,3 +359,9 @@ - - qtronixmap.c: qtronixmap.map - set -e ; loadkeys --mktable $< | sed -e 's/^static *//' > $@ -+ -+ibm_workpad_keymap.c: ibm_workpad_keymap.map -+ set -e ; loadkeys --mktable $< | sed -e 's/^static *//' > $@ -+ -+victor_mpc30x_keymap.c: victor_mpc30x_keymap.map -+ set -e ; loadkeys --mktable $< | sed -e 's/^static *//' > $@ -diff -Nur linux-2.4.30/drivers/char/au1000_gpio.c linux-2.4.30-mips/drivers/char/au1000_gpio.c ---- linux-2.4.30/drivers/char/au1000_gpio.c 2003-08-25 13:44:41.000000000 +0200 -+++ linux-2.4.30-mips/drivers/char/au1000_gpio.c 2003-12-20 14:18:51.000000000 +0100 -@@ -246,7 +246,7 @@ - - static struct miscdevice au1000gpio_miscdev = - { -- GPIO_MINOR, -+ MISC_DYNAMIC_MINOR, - "au1000_gpio", - &au1000gpio_fops - }; -diff -Nur linux-2.4.30/drivers/char/au1550_psc_spi.c linux-2.4.30-mips/drivers/char/au1550_psc_spi.c ---- linux-2.4.30/drivers/char/au1550_psc_spi.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/drivers/char/au1550_psc_spi.c 2005-02-11 21:37:24.000000000 +0100 -@@ -0,0 +1,466 @@ -+/* -+ * Driver for Alchemy Au1550 SPI on the PSC. -+ * -+ * Copyright 2004 Embedded Edge, LLC. -+ * dan@embeddededge.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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED -+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN -+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ * 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 -+#include -+ -+#ifdef CONFIG_MIPS_PB1550 -+#include -+#endif -+ -+#ifdef CONFIG_MIPS_DB1550 -+#include -+#endif -+ -+#ifdef CONFIG_MIPS_PB1200 -+#include -+#endif -+ -+/* This is just a simple programmed I/O SPI interface on the PSC of the 1550. -+ * We support open, close, write, and ioctl. The SPI is a full duplex -+ * interface, you can't read without writing. So, the write system call -+ * copies the bytes out to the SPI, and whatever is returned is placed -+ * in the same buffer. Kinda weird, maybe we'll change it, but for now -+ * it works OK. -+ * I didn't implement any DMA yet, and it's a debate about the necessity. -+ * The SPI clocks are usually quite fast, so data is sent/received as -+ * quickly as you can stuff the FIFO. The overhead of DMA and interrupts -+ * are usually far greater than the data transfer itself. If, however, -+ * we find applications that move large amounts of data, we may choose -+ * use the overhead of buffering and DMA to do the work. -+ */ -+ -+/* The maximum clock rate specified in the manual is 2mHz. -+*/ -+#define MAX_BAUD_RATE (2 * 1000000) -+#define PSC_INTCLK_RATE (32 * 1000000) -+ -+static int inuse; -+ -+/* We have to know what the user requested for the data length -+ * so we know how to stuff the fifo. The FIFO is 32 bits wide, -+ * and we have to load it with the bits to go in a single transfer. -+ */ -+static uint spi_datalen; -+ -+static int -+au1550spi_master_done( int ms ) -+{ -+ int timeout=ms; -+ volatile psc_spi_t *sp; -+ -+ sp = (volatile psc_spi_t *)SPI_PSC_BASE; -+ -+ /* Loop until MD is set or timeout has expired */ -+ while(!(sp->psc_spievent & PSC_SPIEVNT_MD) && timeout--) udelay(1000); -+ -+ if ( !timeout ) -+ return 0; -+ else -+ sp->psc_spievent |= PSC_SPIEVNT_MD; -+ -+ return 1; -+} -+ -+static int -+au1550spi_open(struct inode *inode, struct file *file) -+{ -+ if (inuse) -+ return -EBUSY; -+ -+ inuse = 1; -+ -+ MOD_INC_USE_COUNT; -+ -+ return 0; -+} -+ -+static ssize_t -+au1550spi_write(struct file *fp, const char *bp, size_t count, loff_t *ppos) -+{ -+ int bytelen, i; -+ size_t rcount, retval; -+ unsigned char sb, *rp, *wp; -+ uint fifoword, pcr, stat; -+ volatile psc_spi_t *sp; -+ -+ /* Get the number of bytes per transfer. -+ */ -+ bytelen = ((spi_datalen - 1) / 8) + 1; -+ -+ /* User needs to send us multiple of this count. -+ */ -+ if ((count % bytelen) != 0) -+ return -EINVAL; -+ -+ rp = wp = (unsigned char *)bp; -+ retval = rcount = count; -+ -+ /* Reset the FIFO. -+ */ -+ sp = (volatile psc_spi_t *)SPI_PSC_BASE; -+ sp->psc_spipcr = (PSC_SPIPCR_RC | PSC_SPIPCR_TC); -+ au_sync(); -+ do { -+ pcr = sp->psc_spipcr; -+ au_sync(); -+ } while (pcr != 0); -+ -+ /* Prime the transmit FIFO. -+ */ -+ while (count > 0) { -+ fifoword = 0; -+ for (i=0; ipsc_spitxrx = fifoword; -+ au_sync(); -+ stat = sp->psc_spistat; -+ au_sync(); -+ if (stat & PSC_SPISTAT_TF) -+ break; -+ } -+ -+ /* Start the transfer. -+ */ -+ sp->psc_spipcr = PSC_SPIPCR_MS; -+ au_sync(); -+ -+ /* Now, just keep the transmit fifo full and empty the receive. -+ */ -+ while (count > 0) { -+ stat = sp->psc_spistat; -+ au_sync(); -+ while ((stat & PSC_SPISTAT_RE) == 0) { -+ fifoword = sp->psc_spitxrx; -+ au_sync(); -+ for (i=0; i>= 8; -+ rp++; -+ } -+ rcount -= bytelen; -+ stat = sp->psc_spistat; -+ au_sync(); -+ } -+ if ((stat & PSC_SPISTAT_TF) == 0) { -+ fifoword = 0; -+ for (i=0; ipsc_spitxrx = fifoword; -+ au_sync(); -+ } -+ } -+ -+ /* All of the bytes for transmit have been written. Hang -+ * out waiting for any residual bytes that are yet to be -+ * read from the fifo. -+ */ -+ while (rcount > 0) { -+ stat = sp->psc_spistat; -+ au_sync(); -+ if ((stat & PSC_SPISTAT_RE) == 0) { -+ fifoword = sp->psc_spitxrx; -+ au_sync(); -+ for (i=0; i>= 8; -+ rp++; -+ } -+ rcount -= bytelen; -+ } -+ } -+ -+ /* Wait for MasterDone event. 30ms timeout */ -+ if (!au1550spi_master_done(30) ) retval = -EFAULT; -+ return retval; -+} -+ -+static int -+au1550spi_release(struct inode *inode, struct file *file) -+{ -+ MOD_DEC_USE_COUNT; -+ -+ inuse = 0; -+ -+ return 0; -+} -+ -+/* Set the baud rate closest to the request, then return the actual -+ * value we are using. -+ */ -+static uint -+set_baud_rate(uint baud) -+{ -+ uint rate, tmpclk, brg, ctl, stat; -+ volatile psc_spi_t *sp; -+ -+ /* For starters, the input clock is divided by two. -+ */ -+ tmpclk = PSC_INTCLK_RATE/2; -+ -+ rate = tmpclk / baud; -+ -+ /* The dividers work as follows: -+ * baud = tmpclk / (2 * (brg + 1)) -+ */ -+ brg = (rate/2) - 1; -+ -+ /* Test BRG to ensure it will fit into the 6 bits allocated. -+ */ -+ -+ /* Make sure the device is disabled while we make the change. -+ */ -+ sp = (volatile psc_spi_t *)SPI_PSC_BASE; -+ ctl = sp->psc_spicfg; -+ au_sync(); -+ sp->psc_spicfg = ctl & ~PSC_SPICFG_DE_ENABLE; -+ au_sync(); -+ ctl = PSC_SPICFG_CLR_BAUD(ctl); -+ ctl |= PSC_SPICFG_SET_BAUD(brg); -+ sp->psc_spicfg = ctl; -+ au_sync(); -+ -+ /* If the device was running prior to getting here, wait for -+ * it to restart. -+ */ -+ if (ctl & PSC_SPICFG_DE_ENABLE) { -+ do { -+ stat = sp->psc_spistat; -+ au_sync(); -+ } while ((stat & PSC_SPISTAT_DR) == 0); -+ } -+ -+ /* Return the actual value. -+ */ -+ rate = tmpclk / (2 * (brg + 1)); -+ -+ return(rate); -+} -+ -+static uint -+set_word_len(uint len) -+{ -+ uint ctl, stat; -+ volatile psc_spi_t *sp; -+ -+ if ((len < 4) || (len > 24)) -+ return -EINVAL; -+ -+ /* Make sure the device is disabled while we make the change. -+ */ -+ sp = (volatile psc_spi_t *)SPI_PSC_BASE; -+ ctl = sp->psc_spicfg; -+ au_sync(); -+ sp->psc_spicfg = ctl & ~PSC_SPICFG_DE_ENABLE; -+ au_sync(); -+ ctl = PSC_SPICFG_CLR_LEN(ctl); -+ ctl |= PSC_SPICFG_SET_LEN(len); -+ sp->psc_spicfg = ctl; -+ au_sync(); -+ -+ /* If the device was running prior to getting here, wait for -+ * it to restart. -+ */ -+ if (ctl & PSC_SPICFG_DE_ENABLE) { -+ do { -+ stat = sp->psc_spistat; -+ au_sync(); -+ } while ((stat & PSC_SPISTAT_DR) == 0); -+ } -+ -+ return 0; -+} -+ -+static int -+au1550spi_ioctl(struct inode *inode, struct file *file, -+ unsigned int cmd, unsigned long arg) -+{ -+ int status; -+ u32 val; -+ -+ status = 0; -+ -+ switch(cmd) { -+ case AU1550SPI_WORD_LEN: -+ status = set_word_len(arg); -+ break; -+ -+ case AU1550SPI_SET_BAUD: -+ if (get_user(val, (u32 *)arg)) -+ return -EFAULT; -+ -+ val = set_baud_rate(val); -+ if (put_user(val, (u32 *)arg)) -+ return -EFAULT; -+ break; -+ -+ default: -+ status = -ENOIOCTLCMD; -+ -+ } -+ -+ return status; -+} -+ -+ -+static struct file_operations au1550spi_fops = -+{ -+ owner: THIS_MODULE, -+ write: au1550spi_write, -+ ioctl: au1550spi_ioctl, -+ open: au1550spi_open, -+ release: au1550spi_release, -+}; -+ -+ -+static struct miscdevice au1550spi_miscdev = -+{ -+ MISC_DYNAMIC_MINOR, -+ "au1550_spi", -+ &au1550spi_fops -+}; -+ -+ -+int __init -+au1550spi_init(void) -+{ -+ uint clk, rate, stat; -+ volatile psc_spi_t *sp; -+ -+ /* Wire up Freq3 as a clock for the SPI. The PSC does -+ * factor of 2 divisor, so run a higher rate so we can -+ * get some granularity to the clock speeds. -+ * We can't do this in board set up because the frequency -+ * is computed too late. -+ */ -+ rate = get_au1x00_speed(); -+ rate /= PSC_INTCLK_RATE; -+ -+ /* The FRDIV in the frequency control is (FRDIV + 1) * 2 -+ */ -+ rate /=2; -+ rate--; -+ clk = au_readl(SYS_FREQCTRL1); -+ au_sync(); -+ clk &= ~SYS_FC_FRDIV3_MASK; -+ clk |= (rate << SYS_FC_FRDIV3_BIT); -+ clk |= SYS_FC_FE3; -+ au_writel(clk, SYS_FREQCTRL1); -+ au_sync(); -+ -+ /* Set up the clock source routing to get Freq3 to PSC0_intclk. -+ */ -+ clk = au_readl(SYS_CLKSRC); -+ au_sync(); -+ clk &= ~0x03e0; -+ clk |= (5 << 7); -+ au_writel(clk, SYS_CLKSRC); -+ au_sync(); -+ -+ /* Set up GPIO pin function to drive PSC0_SYNC1, which is -+ * the SPI Select. -+ */ -+ clk = au_readl(SYS_PINFUNC); -+ au_sync(); -+ clk |= 1; -+ au_writel(clk, SYS_PINFUNC); -+ au_sync(); -+ -+ /* Now, set up the PSC for SPI PIO mode. -+ */ -+ sp = (volatile psc_spi_t *)SPI_PSC_BASE; -+ sp->psc_ctrl = PSC_CTRL_DISABLE; -+ au_sync(); -+ sp->psc_sel = PSC_SEL_PS_SPIMODE; -+ sp->psc_spicfg = 0; -+ au_sync(); -+ sp->psc_ctrl = PSC_CTRL_ENABLE; -+ au_sync(); -+ do { -+ stat = sp->psc_spistat; -+ au_sync(); -+ } while ((stat & PSC_SPISTAT_SR) == 0); -+ -+ sp->psc_spicfg = (PSC_SPICFG_RT_FIFO8 | PSC_SPICFG_TT_FIFO8 | -+ PSC_SPICFG_DD_DISABLE | PSC_SPICFG_MO); -+ sp->psc_spicfg |= PSC_SPICFG_SET_LEN(8); -+ spi_datalen = 8; -+ sp->psc_spimsk = PSC_SPIMSK_ALLMASK; -+ au_sync(); -+ -+ set_baud_rate(1000000); -+ -+ sp->psc_spicfg |= PSC_SPICFG_DE_ENABLE; -+ do { -+ stat = sp->psc_spistat; -+ au_sync(); -+ } while ((stat & PSC_SPISTAT_DR) == 0); -+ -+ misc_register(&au1550spi_miscdev); -+ printk("Au1550 SPI driver\n"); -+ return 0; -+} -+ -+ -+void __exit -+au1550spi_exit(void) -+{ -+ misc_deregister(&au1550spi_miscdev); -+} -+ -+ -+module_init(au1550spi_init); -+module_exit(au1550spi_exit); -diff -Nur linux-2.4.30/drivers/char/decserial.c linux-2.4.30-mips/drivers/char/decserial.c ---- linux-2.4.30/drivers/char/decserial.c 2003-08-25 13:44:41.000000000 +0200 -+++ linux-2.4.30-mips/drivers/char/decserial.c 2004-09-28 02:53:01.000000000 +0200 -@@ -3,95 +3,105 @@ - * choose the right serial device at boot time - * - * triemer 6-SEP-1998 -- * sercons.c is designed to allow the three different kinds -+ * sercons.c is designed to allow the three different kinds - * of serial devices under the decstation world to co-exist -- * in the same kernel. The idea here is to abstract -+ * in the same kernel. The idea here is to abstract - * the pieces of the drivers that are common to this file - * so that they do not clash at compile time and runtime. - * - * HK 16-SEP-1998 v0.002 - * removed the PROM console as this is not a real serial - * device. Added support for PROM console in drivers/char/tty_io.c -- * instead. Although it may work to enable more than one -+ * instead. Although it may work to enable more than one - * console device I strongly recommend to use only one. -+ * -+ * Copyright (C) 2004 Maciej W. Rozycki - */ - - #include -+#include - #include -+ - #include -+#include -+ -+extern int register_zs_hook(unsigned int channel, -+ struct dec_serial_hook *hook); -+extern int unregister_zs_hook(unsigned int channel); -+ -+extern int register_dz_hook(unsigned int channel, -+ struct dec_serial_hook *hook); -+extern int unregister_dz_hook(unsigned int channel); - -+int register_dec_serial_hook(unsigned int channel, -+ struct dec_serial_hook *hook) -+{ - #ifdef CONFIG_ZS --extern int zs_init(void); -+ if (IOASIC) -+ return register_zs_hook(channel, hook); - #endif -- - #ifdef CONFIG_DZ --extern int dz_init(void); -+ if (!IOASIC) -+ return register_dz_hook(channel, hook); - #endif -+ return 0; -+} - --#ifdef CONFIG_SERIAL_DEC_CONSOLE -- -+int unregister_dec_serial_hook(unsigned int channel) -+{ - #ifdef CONFIG_ZS --extern void zs_serial_console_init(void); -+ if (IOASIC) -+ return unregister_zs_hook(channel); - #endif -- - #ifdef CONFIG_DZ --extern void dz_serial_console_init(void); --#endif -- -+ if (!IOASIC) -+ return unregister_dz_hook(channel); - #endif -+ return 0; -+} - --/* rs_init - starts up the serial interface - -- handle normal case of starting up the serial interface */ - --#ifdef CONFIG_SERIAL_DEC -+extern int zs_init(void); -+extern int dz_init(void); - -+/* -+ * rs_init - starts up the serial interface - -+ * handle normal case of starting up the serial interface -+ */ - int __init rs_init(void) - { -- --#if defined(CONFIG_ZS) && defined(CONFIG_DZ) -- if (IOASIC) -- return zs_init(); -- else -- return dz_init(); --#else -- - #ifdef CONFIG_ZS -- return zs_init(); -+ if (IOASIC) -+ return zs_init(); - #endif -- - #ifdef CONFIG_DZ -- return dz_init(); --#endif -- -+ if (!IOASIC) -+ return dz_init(); - #endif -+ return -ENXIO; - } - - __initcall(rs_init); - --#endif - - #ifdef CONFIG_SERIAL_DEC_CONSOLE - --/* dec_serial_console_init handles the special case of starting -- * up the console on the serial port -+extern void zs_serial_console_init(void); -+extern void dz_serial_console_init(void); -+ -+/* -+ * dec_serial_console_init handles the special case of starting -+ * up the console on the serial port - */ - void __init dec_serial_console_init(void) - { --#if defined(CONFIG_ZS) && defined(CONFIG_DZ) -- if (IOASIC) -- zs_serial_console_init(); -- else -- dz_serial_console_init(); --#else -- - #ifdef CONFIG_ZS -- zs_serial_console_init(); -+ if (IOASIC) -+ zs_serial_console_init(); - #endif -- - #ifdef CONFIG_DZ -- dz_serial_console_init(); --#endif -- -+ if (!IOASIC) -+ dz_serial_console_init(); - #endif - } - -diff -Nur linux-2.4.30/drivers/char/ds1286.c linux-2.4.30-mips/drivers/char/ds1286.c ---- linux-2.4.30/drivers/char/ds1286.c 2004-02-18 14:36:31.000000000 +0100 -+++ linux-2.4.30-mips/drivers/char/ds1286.c 2004-01-10 06:21:39.000000000 +0100 -@@ -1,6 +1,10 @@ - /* - * DS1286 Real Time Clock interface for Linux - * -+ * Copyright (C) 2003 TimeSys Corp. -+ * S. James Hill (James.Hill@timesys.com) -+ * (sjhill@realitydiluted.com) -+ * - * Copyright (C) 1998, 1999, 2000 Ralf Baechle - * - * Based on code written by Paul Gortmaker. -@@ -29,6 +33,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -95,6 +100,12 @@ - return -EIO; - } - -+void rtc_ds1286_wait(void) -+{ -+ unsigned char sec = CMOS_READ(RTC_SECONDS); -+ while (sec == CMOS_READ(RTC_SECONDS)); -+} -+ - static int ds1286_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg) - { -@@ -249,23 +260,22 @@ - { - spin_lock_irq(&ds1286_lock); - -- if (ds1286_status & RTC_IS_OPEN) -- goto out_busy; -+ if (ds1286_status & RTC_IS_OPEN) { -+ spin_unlock_irq(&ds1286_lock); -+ return -EBUSY; -+ } - - ds1286_status |= RTC_IS_OPEN; - -- spin_lock_irq(&ds1286_lock); -+ spin_unlock_irq(&ds1286_lock); - return 0; -- --out_busy: -- spin_lock_irq(&ds1286_lock); -- return -EBUSY; - } - - static int ds1286_release(struct inode *inode, struct file *file) - { -+ spin_lock_irq(&ds1286_lock); - ds1286_status &= ~RTC_IS_OPEN; -- -+ spin_unlock_irq(&ds1286_lock); - return 0; - } - -@@ -276,32 +286,6 @@ - return 0; - } - --/* -- * The various file operations we support. -- */ -- --static struct file_operations ds1286_fops = { -- .llseek = no_llseek, -- .read = ds1286_read, -- .poll = ds1286_poll, -- .ioctl = ds1286_ioctl, -- .open = ds1286_open, -- .release = ds1286_release, --}; -- --static struct miscdevice ds1286_dev= --{ -- .minor = RTC_MINOR, -- .name = "rtc", -- .fops = &ds1286_fops, --}; -- --int __init ds1286_init(void) --{ -- printk(KERN_INFO "DS1286 Real Time Clock Driver v%s\n", DS1286_VERSION); -- return misc_register(&ds1286_dev); --} -- - static char *days[] = { - "***", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" - }; -@@ -528,3 +512,38 @@ - BCD_TO_BIN(alm_tm->tm_hour); - alm_tm->tm_sec = 0; - } -+ -+static struct file_operations ds1286_fops = { -+ .owner = THIS_MODULE, -+ .llseek = no_llseek, -+ .read = ds1286_read, -+ .poll = ds1286_poll, -+ .ioctl = ds1286_ioctl, -+ .open = ds1286_open, -+ .release = ds1286_release, -+}; -+ -+static struct miscdevice ds1286_dev = -+{ -+ .minor = RTC_MINOR, -+ .name = "rtc", -+ .fops = &ds1286_fops, -+}; -+ -+static int __init ds1286_init(void) -+{ -+ printk(KERN_INFO "DS1286 Real Time Clock Driver v%s\n", DS1286_VERSION); -+ return misc_register(&ds1286_dev); -+} -+ -+static void __exit ds1286_exit(void) -+{ -+ misc_deregister(&ds1286_dev); -+} -+ -+module_init(ds1286_init); -+module_exit(ds1286_exit); -+EXPORT_NO_SYMBOLS; -+ -+MODULE_AUTHOR("Ralf Baechle"); -+MODULE_LICENSE("GPL"); -diff -Nur linux-2.4.30/drivers/char/ds1742.c linux-2.4.30-mips/drivers/char/ds1742.c ---- linux-2.4.30/drivers/char/ds1742.c 2004-02-18 14:36:31.000000000 +0100 -+++ linux-2.4.30-mips/drivers/char/ds1742.c 2004-01-09 20:27:16.000000000 +0100 -@@ -142,6 +142,7 @@ - CMOS_WRITE(RTC_WRITE, RTC_CONTROL); - - /* convert */ -+ memset(&tm, 0, sizeof(struct rtc_time)); - to_tm(t, &tm); - - /* check each field one by one */ -@@ -216,6 +217,7 @@ - unsigned long curr_time; - - curr_time = rtc_ds1742_get_time(); -+ memset(&tm, 0, sizeof(struct rtc_time)); - to_tm(curr_time, &tm); - - p = buf; -@@ -251,8 +253,8 @@ - - void rtc_ds1742_wait(void) - { -- while (CMOS_READ(RTC_SECONDS) & 1); -- while (!(CMOS_READ(RTC_SECONDS) & 1)); -+ unsigned char sec = CMOS_READ(RTC_SECONDS); -+ while (sec == CMOS_READ(RTC_SECONDS)); - } - - static int ds1742_ioctl(struct inode *inode, struct file *file, -@@ -264,6 +266,7 @@ - switch (cmd) { - case RTC_RD_TIME: /* Read the time/date from RTC */ - curr_time = rtc_ds1742_get_time(); -+ memset(&rtc_tm, 0, sizeof(struct rtc_time)); - to_tm(curr_time, &rtc_tm); - rtc_tm.tm_year -= 1900; - return copy_to_user((void *) arg, &rtc_tm, sizeof(rtc_tm)) ? -diff -Nur linux-2.4.30/drivers/char/dummy_keyb.c linux-2.4.30-mips/drivers/char/dummy_keyb.c ---- linux-2.4.30/drivers/char/dummy_keyb.c 2003-08-25 13:44:41.000000000 +0200 -+++ linux-2.4.30-mips/drivers/char/dummy_keyb.c 2004-01-09 09:53:08.000000000 +0100 -@@ -140,3 +140,7 @@ - { - printk("Dummy keyboard driver installed.\n"); - } -+#ifdef CONFIG_MAGIC_SYSRQ -+unsigned char kbd_sysrq_key; -+unsigned char kbd_sysrq_xlate[128]; -+#endif -diff -Nur linux-2.4.30/drivers/char/dz.c linux-2.4.30-mips/drivers/char/dz.c ---- linux-2.4.30/drivers/char/dz.c 2005-01-19 15:09:44.000000000 +0100 -+++ linux-2.4.30-mips/drivers/char/dz.c 2004-12-27 05:13:42.000000000 +0100 -@@ -1,11 +1,13 @@ - /* -- * dz.c: Serial port driver for DECStations equiped -+ * dz.c: Serial port driver for DECstations equipped - * with the DZ chipset. - * - * Copyright (C) 1998 Olivier A. D. Lebaillif - * - * Email: olivier.lebaillif@ifrsys.com - * -+ * Copyright (C) 2004 Maciej W. Rozycki -+ * - * [31-AUG-98] triemer - * Changed IRQ to use Harald's dec internals interrupts.h - * removed base_addr code - moving address assignment to setup.c -@@ -24,6 +26,7 @@ - #undef DEBUG_DZ - - #include -+#include - #include - #include - #include -@@ -54,33 +57,56 @@ - #include - #include - --#define CONSOLE_LINE (3) /* for definition of struct console */ -+#ifdef CONFIG_MAGIC_SYSRQ -+#include -+#endif - - #include "dz.h" - --#define DZ_INTR_DEBUG 1 -- - DECLARE_TASK_QUEUE(tq_serial); - --static struct dz_serial *lines[4]; --static unsigned char tmp_buffer[256]; -+static struct dz_serial multi[DZ_NB_PORT]; /* Four serial lines in the DZ chip */ -+static struct tty_driver serial_driver, callout_driver; -+ -+static struct tty_struct *serial_table[DZ_NB_PORT]; -+static struct termios *serial_termios[DZ_NB_PORT]; -+static struct termios *serial_termios_locked[DZ_NB_PORT]; -+ -+static int serial_refcount; - --#ifdef DEBUG_DZ - /* -- * debugging code to send out chars via prom -+ * tmp_buf is used as a temporary buffer by serial_write. We need to -+ * lock it in case the copy_from_user blocks while swapping in a page, -+ * and some other program tries to do a serial write at the same time. -+ * Since the lock will only come under contention when the system is -+ * swapping and available memory is low, it makes sense to share one -+ * buffer across all the serial ports, since it significantly saves -+ * memory if large numbers of serial ports are open. - */ --static void debug_console(const char *s, int count) --{ -- unsigned i; -+static unsigned char *tmp_buf; -+static DECLARE_MUTEX(tmp_buf_sem); - -- for (i = 0; i < count; i++) { -- if (*s == 10) -- prom_printf("%c", 13); -- prom_printf("%c", *s++); -- } --} -+static char *dz_name __initdata = "DECstation DZ serial driver version "; -+static char *dz_version __initdata = "1.03"; -+ -+static struct dz_serial *lines[DZ_NB_PORT]; -+static unsigned char tmp_buffer[256]; -+ -+#ifdef CONFIG_SERIAL_DEC_CONSOLE -+static struct console dz_sercons; -+#endif -+#if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && \ -+ !defined(MODULE) -+static unsigned long break_pressed; /* break, really ... */ - #endif - -+static void change_speed (struct dz_serial *); -+ -+static int baud_table[] = { -+ 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, -+ 9600, 0 -+}; -+ - /* - * ------------------------------------------------------------ - * dz_in () and dz_out () -@@ -94,15 +120,16 @@ - { - volatile unsigned short *addr = - (volatile unsigned short *) (info->port + offset); -+ - return *addr; - } - - static inline void dz_out(struct dz_serial *info, unsigned offset, - unsigned short value) - { -- - volatile unsigned short *addr = - (volatile unsigned short *) (info->port + offset); -+ - *addr = value; - } - -@@ -143,25 +170,24 @@ - - tmp |= mask; /* set the TX flag */ - dz_out(info, DZ_TCR, tmp); -- - } - - /* - * ------------------------------------------------------------ -- * Here starts the interrupt handling routines. All of the -- * following subroutines are declared as inline and are folded -- * into dz_interrupt. They were separated out for readability's -- * sake. - * -- * Note: rs_interrupt() is a "fast" interrupt, which means that it -+ * Here starts the interrupt handling routines. All of the following -+ * subroutines are declared as inline and are folded into -+ * dz_interrupt(). They were separated out for readability's sake. -+ * -+ * Note: dz_interrupt() is a "fast" interrupt, which means that it - * runs with interrupts turned off. People who may want to modify -- * rs_interrupt() should try to keep the interrupt handler as fast as -+ * dz_interrupt() should try to keep the interrupt handler as fast as - * possible. After you are done making modifications, it is not a bad - * idea to do: - * - * gcc -S -DKERNEL -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer dz.c - * -- * and look at the resulting assemble code in serial.s. -+ * and look at the resulting assemble code in dz.s. - * - * ------------------------------------------------------------ - */ -@@ -188,101 +214,97 @@ - * This routine deals with inputs from any lines. - * ------------------------------------------------------------ - */ --static inline void receive_chars(struct dz_serial *info_in) -+static inline void receive_chars(struct dz_serial *info_in, -+ struct pt_regs *regs) - { -- - struct dz_serial *info; -- struct tty_struct *tty = 0; -+ struct tty_struct *tty; - struct async_icount *icount; -- int ignore = 0; -- unsigned short status, tmp; -- unsigned char ch; -- -- /* this code is going to be a problem... -- the call to tty_flip_buffer is going to need -- to be rethought... -- */ -- do { -- status = dz_in(info_in, DZ_RBUF); -- info = lines[LINE(status)]; -+ int lines_rx[DZ_NB_PORT] = { [0 ... DZ_NB_PORT - 1] = 0 }; -+ unsigned short status; -+ unsigned char ch, flag; -+ int i; - -- /* punt so we don't get duplicate characters */ -- if (!(status & DZ_DVAL)) -- goto ignore_char; -- -- ch = UCHAR(status); /* grab the char */ -- --#if 0 -- if (info->is_console) { -- if (ch == 0) -- return; /* it's a break ... */ -- } --#endif -+ while ((status = dz_in(info_in, DZ_RBUF)) & DZ_DVAL) { -+ info = lines[LINE(status)]; -+ tty = info->tty; /* point to the proper dev */ - -- tty = info->tty; /* now tty points to the proper dev */ -- icount = &info->icount; -+ ch = UCHAR(status); /* grab the char */ - -- if (!tty) -- break; -- if (tty->flip.count >= TTY_FLIPBUF_SIZE) -- break; -+ if (!tty && (!info->hook || !info->hook->rx_char)) -+ continue; - -- *tty->flip.char_buf_ptr = ch; -- *tty->flip.flag_buf_ptr = 0; -+ icount = &info->icount; - icount->rx++; - -- /* keep track of the statistics */ -- if (status & (DZ_OERR | DZ_FERR | DZ_PERR)) { -- if (status & DZ_PERR) /* parity error */ -- icount->parity++; -- else if (status & DZ_FERR) /* frame error */ -- icount->frame++; -- if (status & DZ_OERR) /* overrun error */ -- icount->overrun++; -- -- /* check to see if we should ignore the character -- and mask off conditions that should be ignored -+ flag = 0; -+ if (status & DZ_FERR) { /* frame error */ -+ /* -+ * There is no separate BREAK status bit, so -+ * treat framing errors as BREAKs for Magic SysRq -+ * and SAK; normally, otherwise. - */ -- -- if (status & info->ignore_status_mask) { -- if (++ignore > 100) -- break; -- goto ignore_char; -+#if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && \ -+ !defined(MODULE) -+ if (info->line == dz_sercons.index) { -+ if (!break_pressed) -+ break_pressed = jiffies; -+ continue; - } -- /* mask off the error conditions we want to ignore */ -- tmp = status & info->read_status_mask; -- -- if (tmp & DZ_PERR) { -- *tty->flip.flag_buf_ptr = TTY_PARITY; --#ifdef DEBUG_DZ -- debug_console("PERR\n", 5); --#endif -- } else if (tmp & DZ_FERR) { -- *tty->flip.flag_buf_ptr = TTY_FRAME; --#ifdef DEBUG_DZ -- debug_console("FERR\n", 5); - #endif -+ flag = TTY_BREAK; -+ if (info->flags & DZ_SAK) -+ do_SAK(tty); -+ else -+ flag = TTY_FRAME; -+ } else if (status & DZ_OERR) /* overrun error */ -+ flag = TTY_OVERRUN; -+ else if (status & DZ_PERR) /* parity error */ -+ flag = TTY_PARITY; -+ -+#if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && \ -+ !defined(MODULE) -+ if (break_pressed && info->line == dz_sercons.index) { -+ if (time_before(jiffies, break_pressed + HZ * 5)) { -+ handle_sysrq(ch, regs, NULL, NULL); -+ break_pressed = 0; -+ continue; - } -- if (tmp & DZ_OERR) { --#ifdef DEBUG_DZ -- debug_console("OERR\n", 5); -+ break_pressed = 0; -+ } - #endif -- if (tty->flip.count < TTY_FLIPBUF_SIZE) { -- tty->flip.count++; -- tty->flip.flag_buf_ptr++; -- tty->flip.char_buf_ptr++; -- *tty->flip.flag_buf_ptr = TTY_OVERRUN; -- } -- } -+ -+ if (info->hook && info->hook->rx_char) { -+ (*info->hook->rx_char)(ch, flag); -+ return; - } -- tty->flip.flag_buf_ptr++; -- tty->flip.char_buf_ptr++; -- tty->flip.count++; -- ignore_char: -- } while (status & DZ_DVAL); - -- if (tty) -- tty_flip_buffer_push(tty); -+ /* keep track of the statistics */ -+ switch (flag) { -+ case TTY_FRAME: -+ icount->frame++; -+ break; -+ case TTY_PARITY: -+ icount->parity++; -+ break; -+ case TTY_OVERRUN: -+ icount->overrun++; -+ break; -+ case TTY_BREAK: -+ icount->brk++; -+ break; -+ default: -+ break; -+ } -+ -+ if ((status & info->ignore_status_mask) == 0) { -+ tty_insert_flip_char(tty, ch, flag); -+ lines_rx[LINE(status)] = 1; -+ } -+ } -+ for (i = 0; i < DZ_NB_PORT; i++) -+ if (lines_rx[i]) -+ tty_flip_buffer_push(lines[i]->tty); - } - - /* -@@ -292,20 +314,34 @@ - * This routine deals with outputs to any lines. - * ------------------------------------------------------------ - */ --static inline void transmit_chars(struct dz_serial *info) -+static inline void transmit_chars(struct dz_serial *info_in) - { -+ struct dz_serial *info; -+ unsigned short status; - unsigned char tmp; - -+ status = dz_in(info_in, DZ_CSR); -+ info = lines[LINE(status)]; - -+ if (info->hook || !info->tty) { -+ unsigned short mask, tmp; - -- if (info->x_char) { /* XON/XOFF chars */ -+ mask = 1 << info->line; -+ tmp = dz_in(info, DZ_TCR); /* read the TX flag */ -+ tmp &= ~mask; /* clear the TX flag */ -+ dz_out(info, DZ_TCR, tmp); -+ return; -+ } -+ -+ if (info->x_char) { /* XON/XOFF chars */ - dz_out(info, DZ_TDR, info->x_char); - info->icount.tx++; - info->x_char = 0; - return; - } - /* if nothing to do or stopped or hardware stopped */ -- if ((info->xmit_cnt <= 0) || info->tty->stopped || info->tty->hw_stopped) { -+ if (info->xmit_cnt <= 0 || -+ info->tty->stopped || info->tty->hw_stopped) { - dz_stop(info->tty); - return; - } -@@ -359,15 +395,14 @@ - */ - static void dz_interrupt(int irq, void *dev, struct pt_regs *regs) - { -- struct dz_serial *info; -+ struct dz_serial *info = (struct dz_serial *)dev; - unsigned short status; - - /* get the reason why we just got an irq */ -- status = dz_in((struct dz_serial *) dev, DZ_CSR); -- info = lines[LINE(status)]; /* re-arrange info the proper port */ -+ status = dz_in(info, DZ_CSR); - - if (status & DZ_RDONE) -- receive_chars(info); /* the receive function */ -+ receive_chars(info, regs); - - if (status & DZ_TRDY) - transmit_chars(info); -@@ -514,7 +549,7 @@ - - - info->cflags &= ~DZ_CREAD; /* turn off receive enable flag */ -- dz_out(info, DZ_LPR, info->cflags); -+ dz_out(info, DZ_LPR, info->cflags | info->line); - - if (info->xmit_buf) { /* free Tx buffer */ - free_page((unsigned long) info->xmit_buf); -@@ -545,18 +580,21 @@ - { - unsigned long flags; - unsigned cflag; -- int baud; -+ int baud, i; - -- if (!info->tty || !info->tty->termios) -- return; -+ if (!info->hook) { -+ if (!info->tty || !info->tty->termios) -+ return; -+ cflag = info->tty->termios->c_cflag; -+ } else { -+ cflag = info->hook->cflags; -+ } - - save_flags(flags); - cli(); - - info->cflags = info->line; - -- cflag = info->tty->termios->c_cflag; -- - switch (cflag & CSIZE) { - case CS5: - info->cflags |= DZ_CS5; -@@ -579,7 +617,16 @@ - if (cflag & PARODD) - info->cflags |= DZ_PARODD; - -- baud = tty_get_baud_rate(info->tty); -+ i = cflag & CBAUD; -+ if (i & CBAUDEX) { -+ i &= ~CBAUDEX; -+ if (!info->hook) -+ info->tty->termios->c_cflag &= ~CBAUDEX; -+ else -+ info->hook->cflags &= ~CBAUDEX; -+ } -+ baud = baud_table[i]; -+ - switch (baud) { - case 50: - info->cflags |= DZ_B50; -@@ -629,16 +676,16 @@ - } - - info->cflags |= DZ_RXENAB; -- dz_out(info, DZ_LPR, info->cflags); -+ dz_out(info, DZ_LPR, info->cflags | info->line); - - /* setup accept flag */ - info->read_status_mask = DZ_OERR; -- if (I_INPCK(info->tty)) -+ if (info->tty && I_INPCK(info->tty)) - info->read_status_mask |= (DZ_FERR | DZ_PERR); - - /* characters to ignore */ - info->ignore_status_mask = 0; -- if (I_IGNPAR(info->tty)) -+ if (info->tty && I_IGNPAR(info->tty)) - info->ignore_status_mask |= (DZ_FERR | DZ_PERR); - - restore_flags(flags); -@@ -694,7 +741,7 @@ - - down(&tmp_buf_sem); - while (1) { -- c = MIN(count, MIN(DZ_XMIT_SIZE - info->xmit_cnt - 1, DZ_XMIT_SIZE - info->xmit_head)); -+ c = min(count, min(DZ_XMIT_SIZE - info->xmit_cnt - 1, DZ_XMIT_SIZE - info->xmit_head)); - if (c <= 0) - break; - -@@ -707,7 +754,7 @@ - save_flags(flags); - cli(); - -- c = MIN(c, MIN(DZ_XMIT_SIZE - info->xmit_cnt - 1, DZ_XMIT_SIZE - info->xmit_head)); -+ c = min(c, min(DZ_XMIT_SIZE - info->xmit_cnt - 1, DZ_XMIT_SIZE - info->xmit_head)); - memcpy(info->xmit_buf + info->xmit_head, tmp_buf, c); - info->xmit_head = ((info->xmit_head + c) & (DZ_XMIT_SIZE - 1)); - info->xmit_cnt += c; -@@ -727,7 +774,7 @@ - save_flags(flags); - cli(); - -- c = MIN(count, MIN(DZ_XMIT_SIZE - info->xmit_cnt - 1, DZ_XMIT_SIZE - info->xmit_head)); -+ c = min(count, min(DZ_XMIT_SIZE - info->xmit_cnt - 1, DZ_XMIT_SIZE - info->xmit_head)); - if (c <= 0) { - restore_flags(flags); - break; -@@ -845,7 +892,7 @@ - - /* - * ------------------------------------------------------------ -- * rs_ioctl () and friends -+ * dz_ioctl () and friends - * ------------------------------------------------------------ - */ - static int get_serial_info(struct dz_serial *info, -@@ -958,6 +1005,9 @@ - struct dz_serial *info = (struct dz_serial *) tty->driver_data; - int retval; - -+ if (info->hook) -+ return -ENODEV; -+ - if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && - (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGWILD) && - (cmd != TIOCSERSWILD) && (cmd != TIOCSERGSTRUCT)) { -@@ -1252,19 +1302,14 @@ - int retval, line; - - line = MINOR(tty->device) - tty->driver.minor_start; -- -- /* The dz lines for the mouse/keyboard must be -- * opened using their respective drivers. -- */ - if ((line < 0) || (line >= DZ_NB_PORT)) - return -ENODEV; -+ info = lines[line]; - -- if ((line == DZ_KEYBOARD) || (line == DZ_MOUSE)) -+ if (info->hook) - return -ENODEV; - -- info = lines[line]; - info->count++; -- - tty->driver_data = info; - info->tty = tty; - -@@ -1285,14 +1330,21 @@ - else - *tty->termios = info->callout_termios; - change_speed(info); -- - } -+#ifdef CONFIG_SERIAL_DEC_CONSOLE -+ if (dz_sercons.cflag && dz_sercons.index == line) { -+ tty->termios->c_cflag = dz_sercons.cflag; -+ dz_sercons.cflag = 0; -+ change_speed(info); -+ } -+#endif -+ - info->session = current->session; - info->pgrp = current->pgrp; - return 0; - } - --static void show_serial_version(void) -+static void __init show_serial_version(void) - { - printk("%s%s\n", dz_name, dz_version); - } -@@ -1300,7 +1352,6 @@ - int __init dz_init(void) - { - int i; -- long flags; - struct dz_serial *info; - - /* Setup base handler, and timer table. */ -@@ -1311,9 +1362,9 @@ - memset(&serial_driver, 0, sizeof(struct tty_driver)); - serial_driver.magic = TTY_DRIVER_MAGIC; - #if (LINUX_VERSION_CODE > 0x2032D && defined(CONFIG_DEVFS_FS)) -- serial_driver.name = "ttyS"; --#else - serial_driver.name = "tts/%d"; -+#else -+ serial_driver.name = "ttyS"; - #endif - serial_driver.major = TTY_MAJOR; - serial_driver.minor_start = 64; -@@ -1352,9 +1403,9 @@ - */ - callout_driver = serial_driver; - #if (LINUX_VERSION_CODE > 0x2032D && defined(CONFIG_DEVFS_FS)) -- callout_driver.name = "cua"; --#else - callout_driver.name = "cua/%d"; -+#else -+ callout_driver.name = "cua"; - #endif - callout_driver.major = TTYAUX_MAJOR; - callout_driver.subtype = SERIAL_TYPE_CALLOUT; -@@ -1363,25 +1414,27 @@ - panic("Couldn't register serial driver"); - if (tty_register_driver(&callout_driver)) - panic("Couldn't register callout driver"); -- save_flags(flags); -- cli(); - - for (i = 0; i < DZ_NB_PORT; i++) { - info = &multi[i]; - lines[i] = info; -- info->magic = SERIAL_MAGIC; -- -+ info->tty = 0; -+ info->x_char = 0; - if (mips_machtype == MACH_DS23100 || - mips_machtype == MACH_DS5100) - info->port = (unsigned long) KN01_DZ11_BASE; - else - info->port = (unsigned long) KN02_DZ11_BASE; -- - info->line = i; -- info->tty = 0; -+ -+ if (info->hook && info->hook->init_info) { -+ (*info->hook->init_info)(info); -+ continue; -+ } -+ -+ info->magic = SERIAL_MAGIC; - info->close_delay = 50; - info->closing_wait = 3000; -- info->x_char = 0; - info->event = 0; - info->count = 0; - info->blocked_open = 0; -@@ -1393,25 +1446,16 @@ - info->normal_termios = serial_driver.init_termios; - init_waitqueue_head(&info->open_wait); - init_waitqueue_head(&info->close_wait); -- -- /* -- * If we are pointing to address zero then punt - not correctly -- * set up in setup.c to handle this. -- */ -- if (!info->port) -- return 0; -- -- printk("ttyS%02d at 0x%08x (irq = %d)\n", info->line, -- info->port, dec_interrupt[DEC_IRQ_DZ11]); -- -+ printk("ttyS%02d at 0x%08x (irq = %d) is a DC7085 DZ\n", -+ info->line, info->port, dec_interrupt[DEC_IRQ_DZ11]); - tty_register_devfs(&serial_driver, 0, -- serial_driver.minor_start + info->line); -+ serial_driver.minor_start + info->line); - tty_register_devfs(&callout_driver, 0, -- callout_driver.minor_start + info->line); -+ callout_driver.minor_start + info->line); - } - -- /* reset the chip */ - #ifndef CONFIG_SERIAL_DEC_CONSOLE -+ /* reset the chip */ - dz_out(info, DZ_CSR, DZ_CLR); - while (dz_in(info, DZ_CSR) & DZ_CLR); - iob(); -@@ -1420,43 +1464,104 @@ - dz_out(info, DZ_CSR, DZ_MSE); - #endif - -- /* order matters here... the trick is that flags -- is updated... in request_irq - to immediatedly obliterate -- it is unwise. */ -- restore_flags(flags); -- -- - if (request_irq(dec_interrupt[DEC_IRQ_DZ11], dz_interrupt, -- SA_INTERRUPT, "DZ", lines[0])) -+ 0, "DZ", lines[0])) - panic("Unable to register DZ interrupt"); - -+ for (i = 0; i < DZ_NB_PORT; i++) -+ if (lines[i]->hook) { -+ startup(lines[i]); -+ if (lines[i]->hook->init_channel) -+ (*lines[i]->hook->init_channel)(lines[i]); -+ } -+ - return 0; - } - --#ifdef CONFIG_SERIAL_DEC_CONSOLE --static void dz_console_put_char(unsigned char ch) -+/* -+ * polling I/O routines -+ */ -+static int dz_poll_tx_char(void *handle, unsigned char ch) - { - unsigned long flags; -- int loops = 2500; -- unsigned short tmp = ch; -- /* this code sends stuff out to serial device - spinning its -- wheels and waiting. */ -+ struct dz_serial *info = handle; -+ unsigned short csr, tcr, trdy, mask; -+ int loops = 10000; -+ int ret; - -- /* force the issue - point it at lines[3] */ -- dz_console = &multi[CONSOLE_LINE]; -+ local_irq_save(flags); -+ csr = dz_in(info, DZ_CSR); -+ dz_out(info, DZ_CSR, csr & ~DZ_TIE); -+ tcr = dz_in(info, DZ_TCR); -+ tcr |= 1 << info->line; -+ mask = tcr; -+ dz_out(info, DZ_TCR, mask); -+ iob(); -+ local_irq_restore(flags); - -- save_flags(flags); -- cli(); -+ while (loops--) { -+ trdy = dz_in(info, DZ_CSR); -+ if (!(trdy & DZ_TRDY)) -+ continue; -+ trdy = (trdy & DZ_TLINE) >> 8; -+ if (trdy == info->line) -+ break; -+ mask &= ~(1 << trdy); -+ dz_out(info, DZ_TCR, mask); -+ iob(); -+ udelay(2); -+ } - -+ if (loops) { -+ dz_out(info, DZ_TDR, ch); -+ ret = 0; -+ } else -+ ret = -EAGAIN; - -- /* spin our wheels */ -- while (((dz_in(dz_console, DZ_CSR) & DZ_TRDY) != DZ_TRDY) && loops--); -+ dz_out(info, DZ_TCR, tcr); -+ dz_out(info, DZ_CSR, csr); - -- /* Actually transmit the character. */ -- dz_out(dz_console, DZ_TDR, tmp); -+ return ret; -+} - -- restore_flags(flags); -+static int dz_poll_rx_char(void *handle) -+{ -+ return -ENODEV; -+} -+ -+int register_dz_hook(unsigned int channel, struct dec_serial_hook *hook) -+{ -+ struct dz_serial *info = multi + channel; -+ -+ if (info->hook) { -+ printk("%s: line %d has already a hook registered\n", -+ __FUNCTION__, channel); -+ -+ return 0; -+ } else { -+ hook->poll_rx_char = dz_poll_rx_char; -+ hook->poll_tx_char = dz_poll_tx_char; -+ info->hook = hook; -+ -+ return 1; -+ } -+} -+ -+int unregister_dz_hook(unsigned int channel) -+{ -+ struct dz_serial *info = &multi[channel]; -+ -+ if (info->hook) { -+ info->hook = NULL; -+ return 1; -+ } else { -+ printk("%s: trying to unregister hook on line %d," -+ " but none is registered\n", __FUNCTION__, channel); -+ return 0; -+ } - } -+ -+#ifdef CONFIG_SERIAL_DEC_CONSOLE - /* - * ------------------------------------------------------------------- - * dz_console_print () -@@ -1465,17 +1570,19 @@ - * The console must be locked when we get here. - * ------------------------------------------------------------------- - */ --static void dz_console_print(struct console *cons, -+static void dz_console_print(struct console *co, - const char *str, - unsigned int count) - { -+ struct dz_serial *info = multi + co->index; -+ - #ifdef DEBUG_DZ - prom_printf((char *) str); - #endif - while (count--) { - if (*str == '\n') -- dz_console_put_char('\r'); -- dz_console_put_char(*str++); -+ dz_poll_tx_char(info, '\r'); -+ dz_poll_tx_char(info, *str++); - } - } - -@@ -1486,12 +1593,12 @@ - - static int __init dz_console_setup(struct console *co, char *options) - { -+ struct dz_serial *info = multi + co->index; - int baud = 9600; - int bits = 8; - int parity = 'n'; - int cflag = CREAD | HUPCL | CLOCAL; - char *s; -- unsigned short mask, tmp; - - if (options) { - baud = simple_strtoul(options, NULL, 10); -@@ -1542,44 +1649,31 @@ - } - co->cflag = cflag; - -- /* TOFIX: force to console line */ -- dz_console = &multi[CONSOLE_LINE]; - if ((mips_machtype == MACH_DS23100) || (mips_machtype == MACH_DS5100)) -- dz_console->port = KN01_DZ11_BASE; -+ info->port = KN01_DZ11_BASE; - else -- dz_console->port = KN02_DZ11_BASE; -- dz_console->line = CONSOLE_LINE; -+ info->port = KN02_DZ11_BASE; -+ info->line = co->index; - -- dz_out(dz_console, DZ_CSR, DZ_CLR); -- while ((tmp = dz_in(dz_console, DZ_CSR)) & DZ_CLR); -+ dz_out(info, DZ_CSR, DZ_CLR); -+ while (dz_in(info, DZ_CSR) & DZ_CLR); - - /* enable scanning */ -- dz_out(dz_console, DZ_CSR, DZ_MSE); -+ dz_out(info, DZ_CSR, DZ_MSE); - - /* Set up flags... */ -- dz_console->cflags = 0; -- dz_console->cflags |= DZ_B9600; -- dz_console->cflags |= DZ_CS8; -- dz_console->cflags |= DZ_PARENB; -- dz_out(dz_console, DZ_LPR, dz_console->cflags); -- -- mask = 1 << dz_console->line; -- tmp = dz_in(dz_console, DZ_TCR); /* read the TX flag */ -- if (!(tmp & mask)) { -- tmp |= mask; /* set the TX flag */ -- dz_out(dz_console, DZ_TCR, tmp); -- } -+ dz_out(info, DZ_LPR, cflag | info->line); -+ - return 0; - } - --static struct console dz_sercons = --{ -- .name = "ttyS", -- .write = dz_console_print, -- .device = dz_console_device, -- .setup = dz_console_setup, -- .flags = CON_CONSDEV | CON_PRINTBUFFER, -- .index = CONSOLE_LINE, -+static struct console dz_sercons = { -+ .name = "ttyS", -+ .write = dz_console_print, -+ .device = dz_console_device, -+ .setup = dz_console_setup, -+ .flags = CON_PRINTBUFFER, -+ .index = -1, - }; - - void __init dz_serial_console_init(void) -diff -Nur linux-2.4.30/drivers/char/dz.h linux-2.4.30-mips/drivers/char/dz.h ---- linux-2.4.30/drivers/char/dz.h 2002-08-03 02:39:43.000000000 +0200 -+++ linux-2.4.30-mips/drivers/char/dz.h 2004-09-28 02:53:01.000000000 +0200 -@@ -10,6 +10,8 @@ - #ifndef DZ_SERIAL_H - #define DZ_SERIAL_H - -+#include -+ - #define SERIAL_MAGIC 0x5301 - - /* -@@ -17,6 +19,7 @@ - */ - #define DZ_TRDY 0x8000 /* Transmitter empty */ - #define DZ_TIE 0x4000 /* Transmitter Interrupt Enable */ -+#define DZ_TLINE 0x0300 /* Transmitter Line Number */ - #define DZ_RDONE 0x0080 /* Receiver data ready */ - #define DZ_RIE 0x0040 /* Receive Interrupt Enable */ - #define DZ_MSE 0x0020 /* Master Scan Enable */ -@@ -37,19 +40,30 @@ - #define UCHAR(x) (unsigned char)(x & DZ_RBUF_MASK) - - /* -- * Definitions for the Transmit Register. -+ * Definitions for the Transmit Control Register. - */ - #define DZ_LINE_KEYBOARD 0x0001 - #define DZ_LINE_MOUSE 0x0002 - #define DZ_LINE_MODEM 0x0004 - #define DZ_LINE_PRINTER 0x0008 - -+#define DZ_MODEM_RTS 0x0800 /* RTS for the modem line (2) */ - #define DZ_MODEM_DTR 0x0400 /* DTR for the modem line (2) */ -+#define DZ_PRINT_RTS 0x0200 /* RTS for the printer line (3) */ -+#define DZ_PRINT_DTR 0x0100 /* DTR for the printer line (3) */ -+#define DZ_LNENB 0x000f /* Transmitter Line Enable */ - - /* - * Definitions for the Modem Status Register. - */ -+#define DZ_MODEM_RI 0x0800 /* RI for the modem line (2) */ -+#define DZ_MODEM_CD 0x0400 /* CD for the modem line (2) */ - #define DZ_MODEM_DSR 0x0200 /* DSR for the modem line (2) */ -+#define DZ_MODEM_CTS 0x0100 /* CTS for the modem line (2) */ -+#define DZ_PRINT_RI 0x0008 /* RI for the printer line (2) */ -+#define DZ_PRINT_CD 0x0004 /* CD for the printer line (2) */ -+#define DZ_PRINT_DSR 0x0002 /* DSR for the printer line (2) */ -+#define DZ_PRINT_CTS 0x0001 /* CTS for the printer line (2) */ - - /* - * Definitions for the Transmit Data Register. -@@ -115,9 +129,6 @@ - - #define DZ_EVENT_WRITE_WAKEUP 0 - --#ifndef MIN --#define MIN(a,b) ((a) < (b) ? (a) : (b)) -- - #define DZ_INITIALIZED 0x80000000 /* Serial port was initialized */ - #define DZ_CALLOUT_ACTIVE 0x40000000 /* Call out device is active */ - #define DZ_NORMAL_ACTIVE 0x20000000 /* Normal device is active */ -@@ -129,6 +140,7 @@ - #define DZ_CLOSING_WAIT_INF 0 - #define DZ_CLOSING_WAIT_NONE 65535 - -+#define DZ_SAK 0x0004 /* Secure Attention Key (Orange book) */ - #define DZ_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */ - #define DZ_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */ - #define DZ_PGRP_LOCKOUT 0x0200 /* Lock out cua opens based on pgrp */ -@@ -166,79 +178,9 @@ - long session; /* Session of opening process */ - long pgrp; /* pgrp of opening process */ - -+ struct dec_serial_hook *hook; /* Hook on this channel. */ - unsigned char is_console; /* flag indicating a serial console */ - unsigned char is_initialized; - }; - --static struct dz_serial multi[DZ_NB_PORT]; /* Four serial lines in the DZ chip */ --static struct dz_serial *dz_console; --static struct tty_driver serial_driver, callout_driver; -- --static struct tty_struct *serial_table[DZ_NB_PORT]; --static struct termios *serial_termios[DZ_NB_PORT]; --static struct termios *serial_termios_locked[DZ_NB_PORT]; -- --static int serial_refcount; -- --/* -- * tmp_buf is used as a temporary buffer by serial_write. We need to -- * lock it in case the copy_from_user blocks while swapping in a page, -- * and some other program tries to do a serial write at the same time. -- * Since the lock will only come under contention when the system is -- * swapping and available memory is low, it makes sense to share one -- * buffer across all the serial ports, since it significantly saves -- * memory if large numbers of serial ports are open. -- */ --static unsigned char *tmp_buf; --static DECLARE_MUTEX(tmp_buf_sem); -- --static char *dz_name = "DECstation DZ serial driver version "; --static char *dz_version = "1.02"; -- --static inline unsigned short dz_in (struct dz_serial *, unsigned); --static inline void dz_out (struct dz_serial *, unsigned, unsigned short); -- --static inline void dz_sched_event (struct dz_serial *, int); --static inline void receive_chars (struct dz_serial *); --static inline void transmit_chars (struct dz_serial *); --static inline void check_modem_status (struct dz_serial *); -- --static void dz_stop (struct tty_struct *); --static void dz_start (struct tty_struct *); --static void dz_interrupt (int, void *, struct pt_regs *); --static void do_serial_bh (void); --static void do_softint (void *); --static void do_serial_hangup (void *); --static void change_speed (struct dz_serial *); --static void dz_flush_chars (struct tty_struct *); --static void dz_console_print (struct console *, const char *, unsigned int); --static void dz_flush_buffer (struct tty_struct *); --static void dz_throttle (struct tty_struct *); --static void dz_unthrottle (struct tty_struct *); --static void dz_send_xchar (struct tty_struct *, char); --static void shutdown (struct dz_serial *); --static void send_break (struct dz_serial *, int); --static void dz_set_termios (struct tty_struct *, struct termios *); --static void dz_close (struct tty_struct *, struct file *); --static void dz_hangup (struct tty_struct *); --static void show_serial_version (void); -- --static int dz_write (struct tty_struct *, int, const unsigned char *, int); --static int dz_write_room (struct tty_struct *); --static int dz_chars_in_buffer (struct tty_struct *); --static int startup (struct dz_serial *); --static int get_serial_info (struct dz_serial *, struct serial_struct *); --static int set_serial_info (struct dz_serial *, struct serial_struct *); --static int get_lsr_info (struct dz_serial *, unsigned int *); --static int dz_ioctl (struct tty_struct *, struct file *, unsigned int, unsigned long); --static int block_til_ready (struct tty_struct *, struct file *, struct dz_serial *); --static int dz_open (struct tty_struct *, struct file *); -- --#ifdef MODULE --int init_module (void) --void cleanup_module (void) --#endif -- --#endif -- - #endif /* DZ_SERIAL_H */ -diff -Nur linux-2.4.30/drivers/char/ibm_workpad_keymap.map linux-2.4.30-mips/drivers/char/ibm_workpad_keymap.map ---- linux-2.4.30/drivers/char/ibm_workpad_keymap.map 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/drivers/char/ibm_workpad_keymap.map 2003-12-20 15:20:44.000000000 +0100 -@@ -0,0 +1,343 @@ -+# Keymap for IBM Workpad z50 -+# US Mapping -+# -+# by Michael Klar -+# -+# This is a great big mess on account of how the Caps Lock key is handled as -+# LeftShift-RightShift. Right shift key had to be broken out, so don't use -+# use this map file as a basis for other keyboards that don't do the same -+# thing with Caps Lock. -+# -+# 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. -+ -+keymaps 0-2,4-5,8,12,32-33,36-37 -+strings as usual -+ -+keycode 0 = F1 F11 Console_13 -+ shiftr keycode 0 = F11 -+ shift shiftr keycode 0 = F11 -+ control keycode 0 = F1 -+ alt keycode 0 = Console_1 -+ control alt keycode 0 = Console_1 -+keycode 1 = F3 F13 Console_15 -+ shiftr keycode 1 = F13 -+ shift shiftr keycode 1 = F13 -+ control keycode 1 = F3 -+ alt keycode 1 = Console_3 -+ control alt keycode 1 = Console_3 -+keycode 2 = F5 F15 Console_17 -+ shiftr keycode 2 = F15 -+ shift shiftr keycode 2 = F15 -+ control keycode 2 = F5 -+ alt keycode 2 = Console_5 -+ control alt keycode 2 = Console_5 -+keycode 3 = F7 F17 Console_19 -+ shiftr keycode 3 = F17 -+ shift shiftr keycode 3 = F17 -+ control keycode 3 = F7 -+ alt keycode 3 = Console_7 -+ control alt keycode 3 = Console_7 -+keycode 4 = F9 F19 Console_21 -+ shiftr keycode 4 = F19 -+ shift shiftr keycode 4 = F19 -+ control keycode 4 = F9 -+ alt keycode 4 = Console_9 -+ control alt keycode 4 = Console_9 -+#keycode 5 is contrast down -+#keycode 6 is contrast up -+keycode 7 = F11 F11 Console_23 -+ shiftr keycode 7 = F11 -+ shift shiftr keycode 7 = F11 -+ control keycode 7 = F11 -+ alt keycode 7 = Console_11 -+ control alt keycode 7 = Console_11 -+keycode 8 = F2 F12 Console_14 -+ shiftr keycode 8 = F12 -+ shift shiftr keycode 8 = F12 -+ control keycode 8 = F2 -+ alt keycode 8 = Console_2 -+ control alt keycode 8 = Console_2 -+keycode 9 = F4 F14 Console_16 -+ shiftr keycode 9 = F14 -+ shift shiftr keycode 9 = F14 -+ control keycode 9 = F4 -+ alt keycode 9 = Console_4 -+ control alt keycode 9 = Console_4 -+keycode 10 = F6 F16 Console_18 -+ shiftr keycode 10 = F16 -+ shift shiftr keycode 10 = F16 -+ control keycode 10 = F6 -+ alt keycode 10 = Console_6 -+ control alt keycode 10 = Console_6 -+keycode 11 = F8 F18 Console_20 -+ shiftr keycode 11 = F18 -+ shift shiftr keycode 11 = F18 -+ control keycode 11 = F8 -+ alt keycode 11 = Console_8 -+ control alt keycode 11 = Console_8 -+keycode 12 = F10 F20 Console_22 -+ shiftr keycode 12 = F20 -+ shift shiftr keycode 12 = F20 -+ control keycode 12 = F10 -+ alt keycode 12 = Console_10 -+ control alt keycode 12 = Console_10 -+#keycode 13 is brightness down -+#keycode 14 is brightness up -+keycode 15 = F12 F12 Console_24 -+ shiftr keycode 15 = F12 -+ shift shiftr keycode 15 = F12 -+ control keycode 15 = F12 -+ alt keycode 15 = Console_12 -+ control alt keycode 15 = Console_12 -+keycode 16 = apostrophe quotedbl -+ shiftr keycode 16 = quotedbl -+ shift shiftr keycode 16 = quotedbl -+ control keycode 16 = Control_g -+ alt keycode 16 = Meta_apostrophe -+keycode 17 = bracketleft braceleft -+ shiftr keycode 17 = braceleft -+ shift shiftr keycode 17 = braceleft -+ control keycode 17 = Escape -+ alt keycode 17 = Meta_bracketleft -+keycode 18 = minus underscore backslash -+ shiftr keycode 18 = underscore -+ shift shiftr keycode 18 = underscore -+ control keycode 18 = Control_underscore -+ shift control keycode 18 = Control_underscore -+ shiftr control keycode 18 = Control_underscore -+ shift shiftr control keycode 18 = Control_underscore -+ alt keycode 18 = Meta_minus -+keycode 19 = zero parenright braceright -+ shiftr keycode 19 = parenright -+ shift shiftr keycode 19 = parenright -+ alt keycode 19 = Meta_zero -+keycode 20 = p -+ shiftr keycode 20 = +P -+ shift shiftr keycode 20 = +p -+keycode 21 = semicolon colon -+ shiftr keycode 21 = colon -+ shift shiftr keycode 21 = colon -+ alt keycode 21 = Meta_semicolon -+keycode 22 = Up Scroll_Backward -+ shiftr keycode 22 = Scroll_Backward -+ shift shiftr keycode 22 = Scroll_Backward -+ alt keycode 22 = Prior -+keycode 23 = slash question -+ shiftr keycode 23 = question -+ shift shiftr keycode 23 = question -+ control keycode 23 = Delete -+ alt keycode 23 = Meta_slash -+ -+keycode 27 = nine parenleft bracketright -+ shiftr keycode 27 = parenleft -+ shift shiftr keycode 27 = parenleft -+ alt keycode 27 = Meta_nine -+keycode 28 = o -+ shiftr keycode 28 = +O -+ shift shiftr keycode 28 = +o -+keycode 29 = l -+ shiftr keycode 29 = +L -+ shift shiftr keycode 29 = +l -+keycode 30 = period greater -+ shiftr keycode 30 = greater -+ shift shiftr keycode 30 = greater -+ control keycode 30 = Compose -+ alt keycode 30 = Meta_period -+ -+keycode 32 = Left Decr_Console -+ shiftr keycode 32 = Decr_Console -+ shift shiftr keycode 32 = Decr_Console -+ alt keycode 32 = Home -+keycode 33 = bracketright braceright asciitilde -+ shiftr keycode 33 = braceright -+ shift shiftr keycode 33 = braceright -+ control keycode 33 = Control_bracketright -+ alt keycode 33 = Meta_bracketright -+keycode 34 = equal plus -+ shiftr keycode 34 = plus -+ shift shiftr keycode 34 = plus -+ alt keycode 34 = Meta_equal -+keycode 35 = eight asterisk bracketleft -+ shiftr keycode 35 = asterisk -+ shift shiftr keycode 35 = asterisk -+ control keycode 35 = Delete -+ alt keycode 35 = Meta_eight -+keycode 36 = i -+ shiftr keycode 36 = +I -+ shift shiftr keycode 36 = +i -+keycode 37 = k -+ shiftr keycode 37 = +K -+ shift shiftr keycode 37 = +k -+keycode 38 = comma less -+ shiftr keycode 38 = less -+ shift shiftr keycode 38 = less -+ alt keycode 38 = Meta_comma -+ -+keycode 40 = h -+ shiftr keycode 40 = +H -+ shift shiftr keycode 40 = +h -+keycode 41 = y -+ shiftr keycode 41 = +Y -+ shift shiftr keycode 41 = +y -+keycode 42 = six asciicircum -+ shiftr keycode 42 = asciicircum -+ shift shiftr keycode 42 = asciicircum -+ control keycode 42 = Control_asciicircum -+ alt keycode 42 = Meta_six -+keycode 43 = seven ampersand braceleft -+ shiftr keycode 43 = ampersand -+ shift shiftr keycode 43 = ampersand -+ control keycode 43 = Control_underscore -+ alt keycode 43 = Meta_seven -+keycode 44 = u -+ shiftr keycode 44 = +U -+ shift shiftr keycode 44 = +u -+keycode 45 = j -+ shiftr keycode 45 = +J -+ shift shiftr keycode 45 = +j -+keycode 46 = m -+ shiftr keycode 46 = +M -+ shift shiftr keycode 46 = +m -+keycode 47 = n -+ shiftr keycode 47 = +N -+ shift shiftr keycode 47 = +n -+ -+# This is the "Backspace" key: -+keycode 49 = Delete Delete -+ shiftr keycode 49 = Delete -+ shift shiftr keycode 49 = Delete -+ control keycode 49 = BackSpace -+ alt keycode 49 = Meta_Delete -+keycode 50 = Num_Lock -+ shift keycode 50 = Bare_Num_Lock -+ shiftr keycode 50 = Bare_Num_Lock -+ shift shiftr keycode 50 = Bare_Num_Lock -+# This is the "Delete" key: -+keycode 51 = Remove -+ control alt keycode 51 = Boot -+ -+keycode 53 = backslash bar -+ shiftr keycode 53 = bar -+ shift shiftr keycode 53 = bar -+ control keycode 53 = Control_backslash -+ alt keycode 53 = Meta_backslash -+keycode 54 = Return -+ alt keycode 54 = Meta_Control_m -+keycode 55 = space space -+ shiftr keycode 55 = space -+ shift shiftr keycode 55 = space -+ control keycode 55 = nul -+ alt keycode 55 = Meta_space -+keycode 56 = g -+ shiftr keycode 56 = +G -+ shift shiftr keycode 56 = +g -+keycode 57 = t -+ shiftr keycode 57 = +T -+ shift shiftr keycode 57 = +t -+keycode 58 = five percent -+ shiftr keycode 58 = percent -+ shift shiftr keycode 58 = percent -+ control keycode 58 = Control_bracketright -+ alt keycode 58 = Meta_five -+keycode 59 = four dollar dollar -+ shiftr keycode 59 = dollar -+ shift shiftr keycode 59 = dollar -+ control keycode 59 = Control_backslash -+ alt keycode 59 = Meta_four -+keycode 60 = r -+ shiftr keycode 60 = +R -+ shift shiftr keycode 60 = +r -+keycode 61 = f -+ shiftr keycode 61 = +F -+ shift shiftr keycode 61 = +f -+ altgr keycode 61 = Hex_F -+keycode 62 = v -+ shiftr keycode 62 = +V -+ shift shiftr keycode 62 = +v -+keycode 63 = b -+ shiftr keycode 63 = +B -+ shift shiftr keycode 63 = +b -+ altgr keycode 63 = Hex_B -+ -+keycode 67 = three numbersign -+ shiftr keycode 67 = numbersign -+ shift shiftr keycode 67 = numbersign -+ control keycode 67 = Escape -+ alt keycode 67 = Meta_three -+keycode 68 = e -+ shiftr keycode 68 = +E -+ shift shiftr keycode 68 = +e -+ altgr keycode 68 = Hex_E -+keycode 69 = d -+ shiftr keycode 69 = +D -+ shift shiftr keycode 69 = +d -+ altgr keycode 69 = Hex_D -+keycode 70 = c -+ shiftr keycode 70 = +C -+ shift shiftr keycode 70 = +c -+ altgr keycode 70 = Hex_C -+keycode 71 = Right Incr_Console -+ shiftr keycode 71 = Incr_Console -+ shift shiftr keycode 71 = Incr_Console -+ alt keycode 71 = End -+ -+keycode 75 = two at at -+ shiftr keycode 75 = at -+ shift shiftr keycode 75 = at -+ control keycode 75 = nul -+ shift control keycode 75 = nul -+ shiftr control keycode 75 = nul -+ shift shiftr control keycode 75 = nul -+ alt keycode 75 = Meta_two -+keycode 76 = w -+ shiftr keycode 76 = +W -+ shift shiftr keycode 76 = +w -+keycode 77 = s -+ shiftr keycode 77 = +S -+ shift shiftr keycode 77 = +s -+keycode 78 = x -+ shiftr keycode 78 = +X -+ shift shiftr keycode 78 = +x -+keycode 79 = Down Scroll_Forward -+ shiftr keycode 79 = Scroll_Forward -+ shift shiftr keycode 79 = Scroll_Forward -+ alt keycode 79 = Next -+keycode 80 = Escape Escape -+ shiftr keycode 80 = Escape -+ shift shiftr keycode 80 = Escape -+ alt keycode 80 = Meta_Escape -+keycode 81 = Tab Tab -+ shiftr keycode 81 = Tab -+ shift shiftr keycode 81 = Tab -+ alt keycode 81 = Meta_Tab -+keycode 82 = grave asciitilde -+ shiftr keycode 82 = asciitilde -+ shift shiftr keycode 82 = asciitilde -+ control keycode 82 = nul -+ alt keycode 82 = Meta_grave -+keycode 83 = one exclam -+ shiftr keycode 83 = exclam -+ shift shiftr keycode 83 = exclam -+ alt keycode 83 = Meta_one -+keycode 84 = q -+ shiftr keycode 84 = +Q -+ shift shiftr keycode 84 = +q -+keycode 85 = a -+ shiftr keycode 85 = +A -+ shift shiftr keycode 85 = +a -+ altgr keycode 85 = Hex_A -+keycode 86 = z -+ shiftr keycode 86 = +Z -+ shift shiftr keycode 86 = +z -+ -+# This is the windows key: -+keycode 88 = Decr_Console -+keycode 89 = Shift -+keycode 90 = Control -+keycode 91 = Control -+keycode 92 = Alt -+keycode 93 = AltGr -+keycode 94 = ShiftR -+ shift keycode 94 = Caps_Lock -diff -Nur linux-2.4.30/drivers/char/indydog.c linux-2.4.30-mips/drivers/char/indydog.c ---- linux-2.4.30/drivers/char/indydog.c 2003-08-25 13:44:41.000000000 +0200 -+++ linux-2.4.30-mips/drivers/char/indydog.c 2004-06-22 17:32:07.000000000 +0200 -@@ -1,5 +1,5 @@ - /* -- * IndyDog 0.2 A Hardware Watchdog Device for SGI IP22 -+ * IndyDog 0.3 A Hardware Watchdog Device for SGI IP22 - * - * (c) Copyright 2002 Guido Guenther , All Rights Reserved. - * -@@ -7,10 +7,10 @@ - * 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. -- * -+ * - * based on softdog.c by Alan Cox - */ -- -+ - #include - #include - #include -@@ -19,13 +19,12 @@ - #include - #include - #include --#include - #include - #include - #include - --static unsigned long indydog_alive; --static int expect_close = 0; -+#define PFX "indydog: " -+static int indydog_alive; - - #ifdef CONFIG_WATCHDOG_NOWAYOUT - static int nowayout = 1; -@@ -33,10 +32,30 @@ - static int nowayout = 0; - #endif - -+#define WATCHDOG_TIMEOUT 30 /* 30 sec default timeout */ -+ - MODULE_PARM(nowayout,"i"); - MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); - --static inline void indydog_ping(void) -+static void indydog_start(void) -+{ -+ u32 mc_ctrl0 = sgimc->cpuctrl0; -+ -+ mc_ctrl0 = sgimc->cpuctrl0 | SGIMC_CCTRL0_WDOG; -+ sgimc->cpuctrl0 = mc_ctrl0; -+} -+ -+static void indydog_stop(void) -+{ -+ u32 mc_ctrl0 = sgimc->cpuctrl0; -+ -+ mc_ctrl0 &= ~SGIMC_CCTRL0_WDOG; -+ sgimc->cpuctrl0 = mc_ctrl0; -+ -+ printk(KERN_INFO PFX "Stopped watchdog timer.\n"); -+} -+ -+static void indydog_ping(void) - { - sgimc->watchdogt = 0; - } -@@ -46,18 +65,14 @@ - */ - static int indydog_open(struct inode *inode, struct file *file) - { -- u32 mc_ctrl0; -- -- if (test_and_set_bit(0,&indydog_alive)) -+ if (indydog_alive) - return -EBUSY; - -- if (nowayout) { -+ if (nowayout) - MOD_INC_USE_COUNT; -- } - - /* Activate timer */ -- mc_ctrl0 = sgimc->cpuctrl0 | SGIMC_CCTRL0_WDOG; -- sgimc->cpuctrl0 = mc_ctrl0; -+ indydog_start(); - indydog_ping(); - - indydog_alive = 1; -@@ -69,63 +84,48 @@ - static int indydog_release(struct inode *inode, struct file *file) - { - /* Shut off the timer. -- * Lock it in if it's a module and we set nowayout. */ -- lock_kernel(); -- if (expect_close) { -- u32 mc_ctrl0 = sgimc->cpuctrl0; -+ * Lock it in if it's a module and we defined ...NOWAYOUT */ -+ if (!nowayout) { -+ u32 mc_ctrl0 = sgimc->cpuctrl0; - mc_ctrl0 &= ~SGIMC_CCTRL0_WDOG; - sgimc->cpuctrl0 = mc_ctrl0; - printk(KERN_INFO "Stopped watchdog timer.\n"); -- } else -- printk(KERN_CRIT "WDT device closed unexpectedly. WDT will not stop!\n"); -- clear_bit(0, &indydog_alive); -- unlock_kernel(); -+ } -+ indydog_alive = 0; - - return 0; - } - - static ssize_t indydog_write(struct file *file, const char *data, size_t len, loff_t *ppos) - { -- /* Can't seek (pwrite) on this device */ -+ /* Can't seek (pwrite) on this device */ - if (ppos != &file->f_pos) - return -ESPIPE; - -- /* -- * Refresh the timer. -- */ -+ /* Refresh the timer. */ - if (len) { -- if (!nowayout) { -- size_t i; -- -- /* In case it was set long ago */ -- expect_close = 0; -- -- for (i = 0; i != len; i++) { -- char c; -- if (get_user(c, data + i)) -- return -EFAULT; -- if (c == 'V') -- expect_close = 1; -- } -- } - indydog_ping(); -- return 1; - } -- return 0; -+ return len; - } - - static int indydog_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg) - { -+ int options, retval = -EINVAL; - static struct watchdog_info ident = { -- options: WDIOF_MAGICCLOSE, -- identity: "Hardware Watchdog for SGI IP22", -+ .options = WDIOF_KEEPALIVEPING | -+ WDIOF_MAGICCLOSE, -+ .firmware_version = 0, -+ .identity = "Hardware Watchdog for SGI IP22", - }; -+ - switch (cmd) { - default: - return -ENOIOCTLCMD; - case WDIOC_GETSUPPORT: -- if(copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))) -+ if (copy_to_user((struct watchdog_info *)arg, -+ &ident, sizeof(ident))) - return -EFAULT; - return 0; - case WDIOC_GETSTATUS: -@@ -134,31 +134,53 @@ - case WDIOC_KEEPALIVE: - indydog_ping(); - return 0; -+ case WDIOC_GETTIMEOUT: -+ return put_user(WATCHDOG_TIMEOUT,(int *)arg); -+ case WDIOC_SETOPTIONS: -+ { -+ if (get_user(options, (int *)arg)) -+ return -EFAULT; -+ -+ if (options & WDIOS_DISABLECARD) { -+ indydog_stop(); -+ retval = 0; -+ } -+ -+ if (options & WDIOS_ENABLECARD) { -+ indydog_start(); -+ retval = 0; -+ } -+ -+ return retval; -+ } - } - } - - static struct file_operations indydog_fops = { -- owner: THIS_MODULE, -- write: indydog_write, -- ioctl: indydog_ioctl, -- open: indydog_open, -- release: indydog_release, -+ .owner = THIS_MODULE, -+ .write = indydog_write, -+ .ioctl = indydog_ioctl, -+ .open = indydog_open, -+ .release = indydog_release, - }; - - static struct miscdevice indydog_miscdev = { -- minor: WATCHDOG_MINOR, -- name: "watchdog", -- fops: &indydog_fops, -+ .minor = WATCHDOG_MINOR, -+ .name = "watchdog", -+ .fops = &indydog_fops, - }; - --static const char banner[] __initdata = KERN_INFO "Hardware Watchdog Timer for SGI IP22: 0.2\n"; -+static char banner[] __initdata = -+ KERN_INFO PFX "Hardware Watchdog Timer for SGI IP22: 0.3\n"; - - static int __init watchdog_init(void) - { - int ret = misc_register(&indydog_miscdev); -- -- if (ret) -+ if (ret) { -+ printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", -+ WATCHDOG_MINOR, ret); - return ret; -+ } - - printk(banner); - -@@ -172,4 +194,7 @@ - - module_init(watchdog_init); - module_exit(watchdog_exit); -+ -+MODULE_AUTHOR("Guido Guenther "); -+MODULE_DESCRIPTION("Hardware Watchdog Device for SGI IP22"); - MODULE_LICENSE("GPL"); -diff -Nur linux-2.4.30/drivers/char/ip27-rtc.c linux-2.4.30-mips/drivers/char/ip27-rtc.c ---- linux-2.4.30/drivers/char/ip27-rtc.c 2004-02-18 14:36:31.000000000 +0100 -+++ linux-2.4.30-mips/drivers/char/ip27-rtc.c 2004-04-06 03:35:30.000000000 +0200 -@@ -44,6 +44,7 @@ - #include - #include - #include -+#include - - static int rtc_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg); -@@ -209,11 +210,8 @@ - - static int __init rtc_init(void) - { -- nasid_t nid; -- -- nid = get_nasid(); - rtc = (struct m48t35_rtc *) -- (KL_CONFIG_CH_CONS_INFO(nid)->memory_base + IOC3_BYTEBUS_DEV0); -+ (KL_CONFIG_CH_CONS_INFO(master_nasid)->memory_base + IOC3_BYTEBUS_DEV0); - - printk(KERN_INFO "Real Time Clock Driver v%s\n", RTC_VERSION); - if (misc_register(&rtc_dev)) { -@@ -325,3 +323,7 @@ - - rtc_tm->tm_mon--; - } -+ -+MODULE_AUTHOR("Ralf Baechle "); -+MODULE_DESCRIPTION("SGI IP27 M48T35 RTC driver"); -+MODULE_LICENSE("GPL"); -diff -Nur linux-2.4.30/drivers/char/mips_rtc.c linux-2.4.30-mips/drivers/char/mips_rtc.c ---- linux-2.4.30/drivers/char/mips_rtc.c 2004-01-05 14:53:56.000000000 +0100 -+++ linux-2.4.30-mips/drivers/char/mips_rtc.c 2004-06-28 14:54:53.000000000 +0200 -@@ -53,14 +53,6 @@ - #include - #include - #include -- --/* -- * Check machine -- */ --#if !defined(CONFIG_MIPS) || !defined(CONFIG_NEW_TIME_C) --#error "This driver is for MIPS machines with CONFIG_NEW_TIME_C defined" --#endif -- - #include - - static unsigned long rtc_status = 0; /* bitmapped status byte. */ -diff -Nur linux-2.4.30/drivers/char/sb1250_duart.c linux-2.4.30-mips/drivers/char/sb1250_duart.c ---- linux-2.4.30/drivers/char/sb1250_duart.c 2004-02-18 14:36:31.000000000 +0100 -+++ linux-2.4.30-mips/drivers/char/sb1250_duart.c 2004-09-17 01:25:44.000000000 +0200 -@@ -328,10 +328,11 @@ - if (c <= 0) break; - - if (from_user) { -+ spin_unlock_irqrestore(&us->outp_lock, flags); - if (copy_from_user(us->outp_buf + us->outp_tail, buf, c)) { -- spin_unlock_irqrestore(&us->outp_lock, flags); - return -EFAULT; - } -+ spin_lock_irqsave(&us->outp_lock, flags); - } else { - memcpy(us->outp_buf + us->outp_tail, buf, c); - } -@@ -498,9 +499,31 @@ - duart_set_cflag(us->line, tty->termios->c_cflag); - } - -+static int get_serial_info(uart_state_t *us, struct serial_struct * retinfo) { -+ -+ struct serial_struct tmp; -+ -+ memset(&tmp, 0, sizeof(tmp)); -+ -+ tmp.type=PORT_SB1250; -+ tmp.line=us->line; -+ tmp.port=A_DUART_CHANREG(tmp.line,0); -+ tmp.irq=K_INT_UART_0 + tmp.line; -+ tmp.xmit_fifo_size=16; /* fixed by hw */ -+ tmp.baud_base=5000000; -+ tmp.io_type=SERIAL_IO_MEM; -+ -+ if (copy_to_user(retinfo,&tmp,sizeof(*retinfo))) -+ return -EFAULT; -+ -+ return 0; -+} -+ - static int duart_ioctl(struct tty_struct *tty, struct file * file, - unsigned int cmd, unsigned long arg) - { -+ uart_state_t *us = (uart_state_t *) tty->driver_data; -+ - /* if (serial_paranoia_check(info, tty->device, "rs_ioctl")) - return -ENODEV;*/ - switch (cmd) { -@@ -517,7 +540,7 @@ - printk("Ignoring TIOCMSET\n"); - break; - case TIOCGSERIAL: -- printk("Ignoring TIOCGSERIAL\n"); -+ return get_serial_info(us,(struct serial_struct *) arg); - break; - case TIOCSSERIAL: - printk("Ignoring TIOCSSERIAL\n"); -diff -Nur linux-2.4.30/drivers/char/serial.c linux-2.4.30-mips/drivers/char/serial.c ---- linux-2.4.30/drivers/char/serial.c 2005-01-19 15:09:50.000000000 +0100 -+++ linux-2.4.30-mips/drivers/char/serial.c 2004-12-27 05:13:43.000000000 +0100 -@@ -62,6 +62,12 @@ - * Robert Schwebel , - * Juergen Beisert , - * Theodore Ts'o -+ * -+ * 10/00: Added suport for MIPS Atlas board. -+ * 11/00: Hooks for serial kernel debug port support added. -+ * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, -+ * carstenl@mips.com -+ * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. - */ - - static char *serial_version = "5.05c"; -@@ -413,6 +419,22 @@ - return 0; - } - -+#if defined(CONFIG_MIPS_ATLAS) || defined(CONFIG_MIPS_SEAD) -+ -+#include -+ -+static _INLINE_ unsigned int serial_in(struct async_struct *info, int offset) -+{ -+ return (*(volatile unsigned int *)(mips_io_port_base + ATLAS_UART_REGS_BASE + offset*8) & 0xff); -+} -+ -+static _INLINE_ void serial_out(struct async_struct *info, int offset, int value) -+{ -+ *(volatile unsigned int *)(mips_io_port_base + ATLAS_UART_REGS_BASE + offset*8) = value; -+} -+ -+#else -+ - static _INLINE_ unsigned int serial_in(struct async_struct *info, int offset) - { - switch (info->io_type) { -@@ -447,6 +469,8 @@ - outb(value, info->port+offset); - } - } -+#endif -+ - - /* - * We used to support using pause I/O for certain machines. We -diff -Nur linux-2.4.30/drivers/char/victor_mpc30x_keymap.map linux-2.4.30-mips/drivers/char/victor_mpc30x_keymap.map ---- linux-2.4.30/drivers/char/victor_mpc30x_keymap.map 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/drivers/char/victor_mpc30x_keymap.map 2004-02-05 18:04:42.000000000 +0100 -@@ -0,0 +1,102 @@ -+# Victor Interlink MP-C303/304 keyboard keymap -+# -+# Copyright (C) 2003 Yoichi Yuasa -+# -+# 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. -+keymaps 0-1,4-5,8-9,12 -+alt_is_meta -+strings as usual -+compose as usual for "iso-8859-1" -+ -+# First line -+keycode 89 = Escape -+keycode 9 = Delete -+ -+# 2nd line -+keycode 73 = one exclam -+keycode 18 = two quotedbl -+keycode 92 = three numbersign -+ control keycode 92 = Escape -+keycode 53 = four dollar -+ control keycode 53 = Control_backslash -+keycode 21 = five percent -+ control keycode 21 = Control_bracketright -+keycode 50 = six ampersand -+ control keycode 50 = Control_underscore -+keycode 48 = seven apostrophe -+keycode 51 = eight parenleft -+keycode 16 = nine parenright -+keycode 80 = zero asciitilde -+ control keycode 80 = nul -+keycode 49 = minus equal -+keycode 30 = asciicircum asciitilde -+ control keycode 30 = Control_asciicircum -+keycode 5 = backslash bar -+ control keycode 5 = Control_backslash -+keycode 13 = BackSpace -+# 3rd line -+keycode 57 = Tab -+keycode 74 = q -+keycode 26 = w -+keycode 81 = e -+keycode 29 = r -+keycode 37 = t -+keycode 45 = y -+keycode 72 = u -+keycode 24 = i -+keycode 32 = o -+keycode 41 = p -+keycode 1 = at grave -+ control keycode 1 = nul -+keycode 54 = bracketleft braceleft -+keycode 63 = Return -+ alt keycode 63 = Meta_Control_m -+# 4th line -+keycode 23 = Caps_Lock -+keycode 34 = a -+keycode 66 = s -+keycode 52 = d -+keycode 20 = f -+keycode 84 = g -+keycode 67 = h -+keycode 64 = j -+keycode 17 = k -+keycode 83 = l -+keycode 22 = semicolon plus -+keycode 61 = colon asterisk -+ control keycode 61 = Control_g -+keycode 65 = bracketright braceright -+ control keycode 65 = Control_bracketright -+# 5th line -+keycode 91 = Shift -+keycode 76 = z -+keycode 68 = x -+keycode 28 = c -+keycode 36 = v -+keycode 44 = b -+keycode 19 = n -+keycode 27 = m -+keycode 35 = comma less -+keycode 3 = period greater -+ control keycode 3 = Compose -+keycode 38 = slash question -+ control keycode 38 = Delete -+ shift control keycode 38 = Delete -+keycode 6 = backslash underscore -+ control keycode 6 = Control_backslash -+keycode 55 = Up -+ alt keycode 55 = PageUp -+keycode 14 = Shift -+# 6th line -+keycode 56 = Control -+keycode 42 = Alt -+keycode 33 = space -+ control keycode 33 = nul -+keycode 7 = Left -+ alt keycode 7 = Home -+keycode 31 = Down -+ alt keycode 31 = PageDown -+keycode 47 = Right -+ alt keycode 47 = End -diff -Nur linux-2.4.30/drivers/char/vr41xx_keyb.c linux-2.4.30-mips/drivers/char/vr41xx_keyb.c ---- linux-2.4.30/drivers/char/vr41xx_keyb.c 2004-02-18 14:36:31.000000000 +0100 -+++ linux-2.4.30-mips/drivers/char/vr41xx_keyb.c 2004-02-17 13:08:55.000000000 +0100 -@@ -308,7 +308,7 @@ - if (found != 0) { - kiu_base = VRC4173_KIU_OFFSET; - mkiuintreg = VRC4173_MKIUINTREG_OFFSET; -- vrc4173_clock_supply(VRC4173_KIU_CLOCK); -+ vrc4173_supply_clock(VRC4173_KIU_CLOCK); - } - } - #endif -@@ -325,7 +325,7 @@ - - if (current_cpu_data.cputype == CPU_VR4111 || - current_cpu_data.cputype == CPU_VR4121) -- vr41xx_clock_supply(KIU_CLOCK); -+ vr41xx_supply_clock(KIU_CLOCK); - - kiu_writew(KIURST_KIURST, KIURST); - -diff -Nur linux-2.4.30/drivers/i2c/Config.in linux-2.4.30-mips/drivers/i2c/Config.in ---- linux-2.4.30/drivers/i2c/Config.in 2004-04-14 15:05:29.000000000 +0200 -+++ linux-2.4.30-mips/drivers/i2c/Config.in 2005-02-11 20:49:04.000000000 +0100 -@@ -57,6 +57,10 @@ - if [ "$CONFIG_SGI_IP22" = "y" ]; then - dep_tristate 'I2C SGI interfaces' CONFIG_I2C_ALGO_SGI $CONFIG_I2C - fi -+ -+ if [ "$CONFIG_SOC_AU1550" = "y" -o "$CONFIG_SOC_AU1200" ]; then -+ dep_tristate 'Au1550/Au1200 SMBus interface' CONFIG_I2C_ALGO_AU1550 $CONFIG_I2C -+ fi - - # This is needed for automatic patch generation: sensors code starts here - # This is needed for automatic patch generation: sensors code ends here -diff -Nur linux-2.4.30/drivers/i2c/Makefile linux-2.4.30-mips/drivers/i2c/Makefile ---- linux-2.4.30/drivers/i2c/Makefile 2004-02-18 14:36:31.000000000 +0100 -+++ linux-2.4.30-mips/drivers/i2c/Makefile 2005-02-11 20:49:04.000000000 +0100 -@@ -6,7 +6,7 @@ - - export-objs := i2c-core.o i2c-algo-bit.o i2c-algo-pcf.o \ - i2c-algo-ite.o i2c-algo-sibyte.o i2c-algo-sgi.o \ -- i2c-proc.o -+ i2c-algo-au1550.o i2c-proc.o i2c-au1550.o - - obj-$(CONFIG_I2C) += i2c-core.o - obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o -@@ -25,6 +25,7 @@ - obj-$(CONFIG_I2C_ALGO_SIBYTE) += i2c-algo-sibyte.o i2c-sibyte.o - obj-$(CONFIG_I2C_MAX1617) += i2c-max1617.o - obj-$(CONFIG_I2C_ALGO_SGI) += i2c-algo-sgi.o -+obj-$(CONFIG_I2C_ALGO_AU1550) += i2c-algo-au1550.o i2c-au1550.o - - # This is needed for automatic patch generation: sensors code starts here - # This is needed for automatic patch generation: sensors code ends here -diff -Nur linux-2.4.30/drivers/i2c/i2c-algo-au1550.c linux-2.4.30-mips/drivers/i2c/i2c-algo-au1550.c ---- linux-2.4.30/drivers/i2c/i2c-algo-au1550.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/drivers/i2c/i2c-algo-au1550.c 2005-02-11 20:49:04.000000000 +0100 -@@ -0,0 +1,340 @@ -+/* -+ * i2c-algo-au1550.c: SMBus (i2c) driver algorithms for Alchemy PSC interface -+ * Copyright (C) 2004 Embedded Edge, LLC -+ * -+ * The documentation describes this as an SMBus controller, but it doesn't -+ * understand any of the SMBus protocol in hardware. It's really an I2C -+ * controller that could emulate most of the SMBus in software. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+#include -+#include -+ -+static int -+wait_xfer_done(struct i2c_algo_au1550_data *adap) -+{ -+ u32 stat; -+ int i; -+ volatile psc_smb_t *sp; -+ -+ sp = (volatile psc_smb_t *)(adap->psc_base); -+ -+ /* Wait for Tx FIFO Underflow. -+ */ -+ for (i = 0; i < adap->xfer_timeout; i++) { -+ stat = sp->psc_smbevnt; -+ au_sync(); -+ if ((stat & PSC_SMBEVNT_TU) != 0) { -+ /* Clear it. */ -+ sp->psc_smbevnt = PSC_SMBEVNT_TU; -+ au_sync(); -+ return 0; -+ } -+ udelay(1); -+ } -+ -+ return -ETIMEDOUT; -+} -+ -+static int -+wait_ack(struct i2c_algo_au1550_data *adap) -+{ -+ u32 stat; -+ volatile psc_smb_t *sp; -+ -+ if (wait_xfer_done(adap)) -+ return -ETIMEDOUT; -+ -+ sp = (volatile psc_smb_t *)(adap->psc_base); -+ -+ stat = sp->psc_smbevnt; -+ au_sync(); -+ -+ if ((stat & (PSC_SMBEVNT_DN | PSC_SMBEVNT_AN | PSC_SMBEVNT_AL)) != 0) -+ return -ETIMEDOUT; -+ -+ return 0; -+} -+ -+static int -+wait_master_done(struct i2c_algo_au1550_data *adap) -+{ -+ u32 stat; -+ int i; -+ volatile psc_smb_t *sp; -+ -+ sp = (volatile psc_smb_t *)(adap->psc_base); -+ -+ /* Wait for Master Done. -+ */ -+ for (i = 0; i < adap->xfer_timeout; i++) { -+ stat = sp->psc_smbevnt; -+ au_sync(); -+ if ((stat & PSC_SMBEVNT_MD) != 0) -+ return 0; -+ udelay(1); -+ } -+ -+ return -ETIMEDOUT; -+} -+ -+static int -+do_address(struct i2c_algo_au1550_data *adap, unsigned int addr, int rd) -+{ -+ volatile psc_smb_t *sp; -+ u32 stat; -+ -+ sp = (volatile psc_smb_t *)(adap->psc_base); -+ -+ /* Reset the FIFOs, clear events. -+ */ -+ sp->psc_smbpcr = PSC_SMBPCR_DC; -+ sp->psc_smbevnt = PSC_SMBEVNT_ALLCLR; -+ au_sync(); -+ do { -+ stat = sp->psc_smbpcr; -+ au_sync(); -+ } while ((stat & PSC_SMBPCR_DC) != 0); -+ -+ /* Write out the i2c chip address and specify operation -+ */ -+ addr <<= 1; -+ if (rd) -+ addr |= 1; -+ -+ /* Put byte into fifo, start up master. -+ */ -+ sp->psc_smbtxrx = addr; -+ au_sync(); -+ sp->psc_smbpcr = PSC_SMBPCR_MS; -+ au_sync(); -+ if (wait_ack(adap)) -+ return -EIO; -+ return 0; -+} -+ -+static u32 -+wait_for_rx_byte(struct i2c_algo_au1550_data *adap, u32 *ret_data) -+{ -+ int j; -+ u32 data, stat; -+ volatile psc_smb_t *sp; -+ -+ if (wait_xfer_done(adap)) -+ return -EIO; -+ -+ sp = (volatile psc_smb_t *)(adap->psc_base); -+ -+ j = adap->xfer_timeout * 100; -+ do { -+ j--; -+ if (j <= 0) -+ return -EIO; -+ -+ stat = sp->psc_smbstat; -+ au_sync(); -+ if ((stat & PSC_SMBSTAT_RE) == 0) -+ j = 0; -+ else -+ udelay(1); -+ } while (j > 0); -+ data = sp->psc_smbtxrx; -+ au_sync(); -+ *ret_data = data; -+ -+ return 0; -+} -+ -+static int -+i2c_read(struct i2c_algo_au1550_data *adap, unsigned char *buf, -+ unsigned int len) -+{ -+ int i; -+ u32 data; -+ volatile psc_smb_t *sp; -+ -+ if (len == 0) -+ return 0; -+ -+ /* A read is performed by stuffing the transmit fifo with -+ * zero bytes for timing, waiting for bytes to appear in the -+ * receive fifo, then reading the bytes. -+ */ -+ -+ sp = (volatile psc_smb_t *)(adap->psc_base); -+ -+ i = 0; -+ while (i < (len-1)) { -+ sp->psc_smbtxrx = 0; -+ au_sync(); -+ if (wait_for_rx_byte(adap, &data)) -+ return -EIO; -+ -+ buf[i] = data; -+ i++; -+ } -+ -+ /* The last byte has to indicate transfer done. -+ */ -+ sp->psc_smbtxrx = PSC_SMBTXRX_STP; -+ au_sync(); -+ if (wait_master_done(adap)) -+ return -EIO; -+ -+ data = sp->psc_smbtxrx; -+ au_sync(); -+ buf[i] = data; -+ return 0; -+} -+ -+static int -+i2c_write(struct i2c_algo_au1550_data *adap, unsigned char *buf, -+ unsigned int len) -+{ -+ int i; -+ u32 data; -+ volatile psc_smb_t *sp; -+ -+ if (len == 0) -+ return 0; -+ -+ sp = (volatile psc_smb_t *)(adap->psc_base); -+ -+ i = 0; -+ while (i < (len-1)) { -+ data = buf[i]; -+ sp->psc_smbtxrx = data; -+ au_sync(); -+ if (wait_ack(adap)) -+ return -EIO; -+ i++; -+ } -+ -+ /* The last byte has to indicate transfer done. -+ */ -+ data = buf[i]; -+ data |= PSC_SMBTXRX_STP; -+ sp->psc_smbtxrx = data; -+ au_sync(); -+ if (wait_master_done(adap)) -+ return -EIO; -+ return 0; -+} -+ -+static int -+au1550_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num) -+{ -+ struct i2c_algo_au1550_data *adap = i2c_adap->algo_data; -+ struct i2c_msg *p; -+ int i, err = 0; -+ -+ for (i = 0; !err && i < num; i++) { -+ p = &msgs[i]; -+ err = do_address(adap, p->addr, p->flags & I2C_M_RD); -+ if (err || !p->len) -+ continue; -+ if (p->flags & I2C_M_RD) -+ err = i2c_read(adap, p->buf, p->len); -+ else -+ err = i2c_write(adap, p->buf, p->len); -+ } -+ -+ /* Return the number of messages processed, or the error code. -+ */ -+ if (err == 0) -+ err = num; -+ return err; -+} -+ -+static u32 -+au1550_func(struct i2c_adapter *adap) -+{ -+ return I2C_FUNC_I2C; -+} -+ -+static struct i2c_algorithm au1550_algo = { -+ .name = "Au1550 algorithm", -+ .id = I2C_ALGO_AU1550, -+ .master_xfer = au1550_xfer, -+ .functionality = au1550_func, -+}; -+ -+/* -+ * registering functions to load algorithms at runtime -+ * Prior to calling us, the 50MHz clock frequency and routing -+ * must have been set up for the PSC indicated by the adapter. -+ */ -+int -+i2c_au1550_add_bus(struct i2c_adapter *i2c_adap) -+{ -+ struct i2c_algo_au1550_data *adap = i2c_adap->algo_data; -+ volatile psc_smb_t *sp; -+ u32 stat; -+ -+ i2c_adap->algo = &au1550_algo; -+ -+ /* Now, set up the PSC for SMBus PIO mode. -+ */ -+ sp = (volatile psc_smb_t *)(adap->psc_base); -+ sp->psc_ctrl = PSC_CTRL_DISABLE; -+ au_sync(); -+ sp->psc_sel = PSC_SEL_PS_SMBUSMODE; -+ sp->psc_smbcfg = 0; -+ au_sync(); -+ sp->psc_ctrl = PSC_CTRL_ENABLE; -+ au_sync(); -+ do { -+ stat = sp->psc_smbstat; -+ au_sync(); -+ } while ((stat & PSC_SMBSTAT_SR) == 0); -+ -+ sp->psc_smbcfg = (PSC_SMBCFG_RT_FIFO8 | PSC_SMBCFG_TT_FIFO8 | -+ PSC_SMBCFG_DD_DISABLE); -+ -+ /* Divide by 8 to get a 6.25 MHz clock. The later protocol -+ * timings are based on this clock. -+ */ -+ sp->psc_smbcfg |= PSC_SMBCFG_SET_DIV(PSC_SMBCFG_DIV2); -+ sp->psc_smbmsk = PSC_SMBMSK_ALLMASK; -+ au_sync(); -+ -+ /* Set the protocol timer values. See Table 71 in the -+ * Au1550 Data Book for standard timing values. -+ */ -+ sp->psc_smbtmr = PSC_SMBTMR_SET_TH(2) | PSC_SMBTMR_SET_PS(15) | \ -+ PSC_SMBTMR_SET_PU(11) | PSC_SMBTMR_SET_SH(11) | \ -+ PSC_SMBTMR_SET_SU(11) | PSC_SMBTMR_SET_CL(15) | \ -+ PSC_SMBTMR_SET_CH(11); -+ au_sync(); -+ -+ sp->psc_smbcfg |= PSC_SMBCFG_DE_ENABLE; -+ do { -+ stat = sp->psc_smbstat; -+ au_sync(); -+ } while ((stat & PSC_SMBSTAT_DR) == 0); -+ -+ return i2c_add_adapter(i2c_adap); -+} -+ -+ -+int -+i2c_au1550_del_bus(struct i2c_adapter *adap) -+{ -+ return i2c_del_adapter(adap); -+} -+ -+EXPORT_SYMBOL(i2c_au1550_add_bus); -+EXPORT_SYMBOL(i2c_au1550_del_bus); -+ -+MODULE_AUTHOR("Dan Malek "); -+MODULE_DESCRIPTION("SMBus Au1550 algorithm"); -+MODULE_LICENSE("GPL"); -diff -Nur linux-2.4.30/drivers/i2c/i2c-au1550.c linux-2.4.30-mips/drivers/i2c/i2c-au1550.c ---- linux-2.4.30/drivers/i2c/i2c-au1550.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/drivers/i2c/i2c-au1550.c 2005-02-11 20:49:04.000000000 +0100 -@@ -0,0 +1,154 @@ -+/* -+ * i2c-au1550.c: SMBus (i2c) adapter for Alchemy PSC interface -+ * Copyright (C) 2004 Embedded Edge, LLC -+ * -+ * This is just a skeleton adapter to use with the Au1550 PSC -+ * algorithm. It was developed for the Pb1550, but will work with -+ * any Au1550 board that has a similar PSC configuration. -+ * -+ * 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 -+#if defined( CONFIG_MIPS_PB1550 ) -+ #include -+#endif -+#if defined( CONFIG_MIPS_PB1200 ) -+ #include -+#endif -+#if defined( CONFIG_MIPS_DB1200 ) -+ #include -+#endif -+#if defined( CONFIG_MIPS_FICMMP ) -+ #include -+#endif -+ -+#include -+#include -+ -+ -+ -+static int -+pb1550_reg(struct i2c_client *client) -+{ -+ return 0; -+} -+ -+static int -+pb1550_unreg(struct i2c_client *client) -+{ -+ return 0; -+} -+ -+static void -+pb1550_inc_use(struct i2c_adapter *adap) -+{ -+#ifdef MODULE -+ MOD_INC_USE_COUNT; -+#endif -+} -+ -+static void -+pb1550_dec_use(struct i2c_adapter *adap) -+{ -+#ifdef MODULE -+ MOD_DEC_USE_COUNT; -+#endif -+} -+ -+static struct i2c_algo_au1550_data pb1550_i2c_info = { -+ SMBUS_PSC_BASE, 200, 200 -+}; -+ -+static struct i2c_adapter pb1550_board_adapter = { -+ name: "pb1550 adapter", -+ id: I2C_HW_AU1550_PSC, -+ algo: NULL, -+ algo_data: &pb1550_i2c_info, -+ inc_use: pb1550_inc_use, -+ dec_use: pb1550_dec_use, -+ client_register: pb1550_reg, -+ client_unregister: pb1550_unreg, -+ client_count: 0, -+}; -+ -+int __init -+i2c_pb1550_init(void) -+{ -+ /* This is where we would set up a 50MHz clock source -+ * and routing. On the Pb1550, the SMBus is PSC2, which -+ * uses a shared clock with USB. This has been already -+ * configured by Yamon as a 48MHz clock, close enough -+ * for our work. -+ */ -+ if (i2c_au1550_add_bus(&pb1550_board_adapter) < 0) -+ return -ENODEV; -+ -+ return 0; -+} -+ -+/* BIG hack to support the control interface on the Wolfson WM8731 -+ * audio codec on the Pb1550 board. We get an address and two data -+ * bytes to write, create an i2c message, and send it across the -+ * i2c transfer function. We do this here because we have access to -+ * the i2c adapter structure. -+ */ -+static struct i2c_msg wm_i2c_msg; /* We don't want this stuff on the stack */ -+static u8 i2cbuf[2]; -+ -+int -+pb1550_wm_codec_write(u8 addr, u8 reg, u8 val) -+{ -+ wm_i2c_msg.addr = addr; -+ wm_i2c_msg.flags = 0; -+ wm_i2c_msg.buf = i2cbuf; -+ wm_i2c_msg.len = 2; -+ i2cbuf[0] = reg; -+ i2cbuf[1] = val; -+ -+ return pb1550_board_adapter.algo->master_xfer(&pb1550_board_adapter, &wm_i2c_msg, 1); -+} -+ -+/* the next function is needed by DVB driver. */ -+int pb1550_i2c_xfer(struct i2c_msg msgs[], int num) -+{ -+ return pb1550_board_adapter.algo->master_xfer(&pb1550_board_adapter, msgs, num); -+} -+ -+EXPORT_SYMBOL(pb1550_wm_codec_write); -+EXPORT_SYMBOL(pb1550_i2c_xfer); -+ -+MODULE_AUTHOR("Dan Malek, Embedded Edge, LLC."); -+MODULE_DESCRIPTION("SMBus adapter Alchemy pb1550"); -+MODULE_LICENSE("GPL"); -+ -+int -+init_module(void) -+{ -+ return i2c_pb1550_init(); -+} -+ -+void -+cleanup_module(void) -+{ -+ i2c_au1550_del_bus(&pb1550_board_adapter); -+} -diff -Nur linux-2.4.30/drivers/i2c/i2c-core.c linux-2.4.30-mips/drivers/i2c/i2c-core.c ---- linux-2.4.30/drivers/i2c/i2c-core.c 2005-01-19 15:09:54.000000000 +0100 -+++ linux-2.4.30-mips/drivers/i2c/i2c-core.c 2004-11-29 18:47:16.000000000 +0100 -@@ -1280,6 +1280,9 @@ - #ifdef CONFIG_I2C_MAX1617 - extern int i2c_max1617_init(void); - #endif -+#ifdef CONFIG_I2C_ALGO_AU1550 -+ extern int i2c_pb1550_init(void); -+#endif - - #ifdef CONFIG_I2C_PROC - extern int sensors_init(void); -@@ -1335,6 +1338,10 @@ - i2c_max1617_init(); - #endif - -+#ifdef CONFIG_I2C_ALGO_AU1550 -+ i2c_pb1550_init(); -+#endif -+ - /* -------------- proc interface ---- */ - #ifdef CONFIG_I2C_PROC - sensors_init(); -diff -Nur linux-2.4.30/drivers/media/video/indycam.c linux-2.4.30-mips/drivers/media/video/indycam.c ---- linux-2.4.30/drivers/media/video/indycam.c 2004-02-18 14:36:31.000000000 +0100 -+++ linux-2.4.30-mips/drivers/media/video/indycam.c 2004-12-09 21:32:05.000000000 +0100 -@@ -50,13 +50,14 @@ - 0x80, /* INDYCAM_GAMMA */ - }; - -- int err = 0; - struct indycam *camera; - struct i2c_client *client; -+ int err = 0; - - client = kmalloc(sizeof(*client), GFP_KERNEL); -- if (!client) -+ if (!client) - return -ENOMEM; -+ - camera = kmalloc(sizeof(*camera), GFP_KERNEL); - if (!camera) { - err = -ENOMEM; -@@ -67,7 +68,7 @@ - client->adapter = adap; - client->addr = addr; - client->driver = &i2c_driver_indycam; -- strcpy(client->name, "IndyCam client"); -+ strcpy(client->name, "IndyCam client"); - camera->client = client; - - err = i2c_attach_client(client); -@@ -75,18 +76,18 @@ - goto out_free_camera; - - camera->version = i2c_smbus_read_byte_data(client, INDYCAM_VERSION); -- if (camera->version != CAMERA_VERSION_INDY && -- camera->version != CAMERA_VERSION_MOOSE) { -+ if ((camera->version != CAMERA_VERSION_INDY) && -+ (camera->version != CAMERA_VERSION_MOOSE)) { - err = -ENODEV; - goto out_detach_client; - } -- printk(KERN_INFO "Indycam v%d.%d detected.\n", -+ printk(KERN_INFO "IndyCam v%d.%d detected.\n", - INDYCAM_VERSION_MAJOR(camera->version), - INDYCAM_VERSION_MINOR(camera->version)); - - err = i2c_master_send(client, initseq, sizeof(initseq)); - if (err) -- printk(KERN_INFO "IndyCam initalization failed\n"); -+ printk(KERN_ERR "IndyCam initalization failed.\n"); - - MOD_INC_USE_COUNT; - return 0; -diff -Nur linux-2.4.30/drivers/media/video/vino.c linux-2.4.30-mips/drivers/media/video/vino.c ---- linux-2.4.30/drivers/media/video/vino.c 2004-02-18 14:36:31.000000000 +0100 -+++ linux-2.4.30-mips/drivers/media/video/vino.c 2004-12-10 05:02:54.000000000 +0100 -@@ -5,6 +5,8 @@ - * License version 2 as published by the Free Software Foundation. - * - * Copyright (C) 2003 Ladislav Michl -+ * Copyright (C) 2004 Mikael Nousiainen -+ * - */ - - #include -@@ -37,13 +39,23 @@ - #define DEBUG(x...) - #endif - -+/* Channels (who could have guessed) */ -+#define VINO_CHAN_NONE 0 -+#define VINO_CHAN_A 1 -+#define VINO_CHAN_B 2 -+ - /* VINO video size */ - #define VINO_PAL_WIDTH 768 - #define VINO_PAL_HEIGHT 576 - #define VINO_NTSC_WIDTH 646 - #define VINO_NTSC_HEIGHT 486 - --/* set this to some sensible values. note: VINO_MIN_WIDTH has to be 8*x */ -+/* Minimum value for Y-clipping (for smaller values the images -+ * will be corrupted) */ -+#define VINO_MIN_Y_CLIPPING 2 -+ -+/* Set these to some sensible values. -+ * Note: the picture width has to be divisible by 8 */ - #define VINO_MIN_WIDTH 32 - #define VINO_MIN_HEIGHT 32 - -@@ -64,9 +76,7 @@ - - struct vino_device { - struct video_device vdev; --#define VINO_CHAN_A 1 --#define VINO_CHAN_B 2 -- int chan; -+ int chan; /* VINO_CHAN_NONE, VINO_CHAN_A or VINO_CHAN_B */ - int alpha; - /* clipping... */ - unsigned int left, right, top, bottom; -@@ -106,7 +116,7 @@ - - struct vino_client { - struct i2c_client *driver; -- int owner; -+ int owner; /* VINO_CHAN_NONE, VINO_CHAN_A or VINO_CHAN_B */ - }; - - struct vino_video { -@@ -362,6 +372,7 @@ - static int dma_setup(struct vino_device *v) - { - u32 ctrl, intr; -+ int ofs; - struct sgi_vino_channel *ch; - - ch = (v->chan == VINO_CHAN_A) ? &vino->a : &vino->b; -@@ -377,14 +388,24 @@ - ch->line_size = v->line_size - 8; - /* set the alpha register */ - ch->alpha = v->alpha; -- /* set cliping registers */ -- ch->clip_start = VINO_CLIP_ODD(v->top) | VINO_CLIP_EVEN(v->top+1) | -+ /* Set the clipping registers, this is the constant source of fun :) -+ * Y clipping start has to be >= 2 and end has to be start + height/2 -+ * The values of top and bottom are even so dividing is not a problem -+ * -+ * The docs say that clipping values for the even field should be -+ * odd_end + something_to_skip_vertical_blanking + some_lines and -+ * even_start + height/2, though the image is good this way also -+ * -+ * TODO: for analog sources (SAA7191), the clipping values are a bit -+ * different and that case isn't yet handled -+ */ -+ ofs = VINO_MIN_Y_CLIPPING; /* Should depend on input source */ -+ ch->clip_start = VINO_CLIP_ODD(ofs + v->top / 2) | -+ VINO_CLIP_EVEN(ofs + v->top / 2 + 1) | - VINO_CLIP_X(v->left); -- ch->clip_end = VINO_CLIP_ODD(v->bottom) | VINO_CLIP_EVEN(v->bottom+1) | -+ ch->clip_end = VINO_CLIP_ODD(ofs + v->bottom / 2 - 1) | -+ VINO_CLIP_EVEN(ofs + v->bottom / 2) | - VINO_CLIP_X(v->right); -- /* FIXME: end-of-field bug workaround -- VINO_CLIP_X(VINO_PAL_WIDTH); -- */ - /* init the frame rate and norm (full frame rate only for now...) */ - ch->frame_rate = VINO_FRAMERT_RT(0x1fff) | - (get_capture_norm(v) == VIDEO_MODE_PAL ? -@@ -510,6 +531,7 @@ - static void vino_interrupt(int irq, void *dev_id, struct pt_regs *regs) - { - u32 intr, ctrl; -+ int a_eof, b_eof; - - spin_lock(&Vino->vino_lock); - ctrl = vino->control; -@@ -525,12 +547,14 @@ - vino->control = ctrl; - clear_eod(&Vino->chB); - } -+ a_eof = intr & VINO_INTSTAT_A_EOF; -+ b_eof = intr & VINO_INTSTAT_B_EOF; - vino->intr_status = ~intr; - spin_unlock(&Vino->vino_lock); -- /* FIXME: For now we are assuming that interrupt means that frame is -- * done. That's not true, but we can live with such brokeness for -- * a while ;-) */ -- field_done(&Vino->chA); -+ if (a_eof) -+ field_done(&Vino->chA); -+ if (b_eof) -+ field_done(&Vino->chB); - } - - static int vino_grab(struct vino_device *v, int frame) -diff -Nur linux-2.4.30/drivers/mtd/devices/docprobe.c linux-2.4.30-mips/drivers/mtd/devices/docprobe.c ---- linux-2.4.30/drivers/mtd/devices/docprobe.c 2003-06-13 16:51:34.000000000 +0200 -+++ linux-2.4.30-mips/drivers/mtd/devices/docprobe.c 2003-06-16 01:42:21.000000000 +0200 -@@ -89,10 +89,10 @@ - 0xe4000000, - #elif defined(CONFIG_MOMENCO_OCELOT) - 0x2f000000, -- 0xff000000, -+ 0xff000000, - #elif defined(CONFIG_MOMENCO_OCELOT_G) || defined (CONFIG_MOMENCO_OCELOT_C) -- 0xff000000, --##else -+ 0xff000000, -+#else - #warning Unknown architecture for DiskOnChip. No default probe locations defined - #endif - 0 }; -diff -Nur linux-2.4.30/drivers/mtd/devices/ms02-nv.c linux-2.4.30-mips/drivers/mtd/devices/ms02-nv.c ---- linux-2.4.30/drivers/mtd/devices/ms02-nv.c 2003-06-13 16:51:34.000000000 +0200 -+++ linux-2.4.30-mips/drivers/mtd/devices/ms02-nv.c 2004-07-30 12:22:40.000000000 +0200 -@@ -1,10 +1,10 @@ - /* -- * Copyright (c) 2001 Maciej W. Rozycki -+ * Copyright (c) 2001 Maciej W. Rozycki - * -- * 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 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: ms02-nv.c,v 1.2 2003/01/24 14:05:17 dwmw2 Exp $ - */ -@@ -29,18 +29,18 @@ - - - static char version[] __initdata = -- "ms02-nv.c: v.1.0.0 13 Aug 2001 Maciej W. Rozycki.\n"; -+ "ms02-nv.c: v.1.0.0 13 Aug 2001 Maciej W. Rozycki.\n"; - --MODULE_AUTHOR("Maciej W. Rozycki "); -+MODULE_AUTHOR("Maciej W. Rozycki "); - MODULE_DESCRIPTION("DEC MS02-NV NVRAM module driver"); - MODULE_LICENSE("GPL"); - - - /* - * Addresses we probe for an MS02-NV at. Modules may be located -- * at any 8MB boundary within a 0MB up to 112MB range or at any 32MB -- * boundary within a 0MB up to 448MB range. We don't support a module -- * at 0MB, though. -+ * at any 8MiB boundary within a 0MiB up to 112MiB range or at any 32MiB -+ * boundary within a 0MiB up to 448MiB range. We don't support a module -+ * at 0MiB, though. - */ - static ulong ms02nv_addrs[] __initdata = { - 0x07000000, 0x06800000, 0x06000000, 0x05800000, 0x05000000, -@@ -130,7 +130,7 @@ - - int ret = -ENODEV; - -- /* The module decodes 8MB of address space. */ -+ /* The module decodes 8MiB of address space. */ - mod_res = kmalloc(sizeof(*mod_res), GFP_KERNEL); - if (!mod_res) - return -ENOMEM; -@@ -233,7 +233,7 @@ - goto err_out_csr_res; - } - -- printk(KERN_INFO "mtd%d: %s at 0x%08lx, size %uMB.\n", -+ printk(KERN_INFO "mtd%d: %s at 0x%08lx, size %uMiB.\n", - mtd->index, ms02nv_name, addr, size >> 20); - - mp->next = root_ms02nv_mtd; -@@ -293,12 +293,12 @@ - - switch (mips_machtype) { - case MACH_DS5000_200: -- csr = (volatile u32 *)KN02_CSR_ADDR; -+ csr = (volatile u32 *)KN02_CSR_BASE; - if (*csr & KN02_CSR_BNK32M) - stride = 2; - break; - case MACH_DS5000_2X0: -- case MACH_DS5000: -+ case MACH_DS5900: - csr = (volatile u32 *)KN03_MCR_BASE; - if (*csr & KN03_MCR_BNK32M) - stride = 2; -diff -Nur linux-2.4.30/drivers/mtd/devices/ms02-nv.h linux-2.4.30-mips/drivers/mtd/devices/ms02-nv.h ---- linux-2.4.30/drivers/mtd/devices/ms02-nv.h 2002-11-29 00:53:13.000000000 +0100 -+++ linux-2.4.30-mips/drivers/mtd/devices/ms02-nv.h 2004-07-30 12:22:40.000000000 +0200 -@@ -1,32 +1,96 @@ - /* -- * Copyright (c) 2001 Maciej W. Rozycki -+ * Copyright (c) 2001, 2003 Maciej W. Rozycki - * -- * 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. -+ * DEC MS02-NV (54-20948-01) battery backed-up NVRAM module for -+ * DECstation/DECsystem 5000/2x0 and DECsystem 5900 and 5900/260 -+ * systems. -+ * -+ * 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: ms02-nv.h,v 1.3 2003/08/19 09:25:36 dwmw2 Exp $ - */ - - #include - #include - -+/* -+ * Addresses are decoded as follows: -+ * -+ * 0x000000 - 0x3fffff SRAM -+ * 0x400000 - 0x7fffff CSR -+ * -+ * Within the SRAM area the following ranges are forced by the system -+ * firmware: -+ * -+ * 0x000000 - 0x0003ff diagnostic area, destroyed upon a reboot -+ * 0x000400 - ENDofRAM storage area, available to operating systems -+ * -+ * but we can't really use the available area right from 0x000400 as -+ * the first word is used by the firmware as a status flag passed -+ * from an operating system. If anything but the valid data magic -+ * ID value is found, the firmware considers the SRAM clean, i.e. -+ * containing no valid data, and disables the battery resulting in -+ * data being erased as soon as power is switched off. So the choice -+ * for the start address of the user-available is 0x001000 which is -+ * nicely page aligned. The area between 0x000404 and 0x000fff may -+ * be used by the driver for own needs. -+ * -+ * The diagnostic area defines two status words to be read by an -+ * operating system, a magic ID to distinguish a MS02-NV board from -+ * anything else and a status information providing results of tests -+ * as well as the size of SRAM available, which can be 1MiB or 2MiB -+ * (that's what the firmware handles; no idea if 2MiB modules ever -+ * existed). -+ * -+ * The firmware only handles the MS02-NV board if installed in the -+ * last (15th) slot, so for any other location the status information -+ * stored in the SRAM cannot be relied upon. But from the hardware -+ * point of view there is no problem using up to 14 such boards in a -+ * system -- only the 1st slot needs to be filled with a DRAM module. -+ * The MS02-NV board is ECC-protected, like other MS02 memory boards. -+ * -+ * The state of the battery as provided by the CSR is reflected on -+ * the two onboard LEDs. When facing the battery side of the board, -+ * with the LEDs at the top left and the battery at the bottom right -+ * (i.e. looking from the back side of the system box), their meaning -+ * is as follows (the system has to be powered on): -+ * -+ * left LED battery disable status: lit = enabled -+ * right LED battery condition status: lit = OK -+ */ -+ - /* MS02-NV iomem register offsets. */ - #define MS02NV_CSR 0x400000 /* control & status register */ - -+/* MS02-NV CSR status bits. */ -+#define MS02NV_CSR_BATT_OK 0x01 /* battery OK */ -+#define MS02NV_CSR_BATT_OFF 0x02 /* battery disabled */ -+ -+ - /* MS02-NV memory offsets. */ - #define MS02NV_DIAG 0x0003f8 /* diagnostic status */ - #define MS02NV_MAGIC 0x0003fc /* MS02-NV magic ID */ --#define MS02NV_RAM 0x000400 /* general-purpose RAM start */ -+#define MS02NV_VALID 0x000400 /* valid data magic ID */ -+#define MS02NV_RAM 0x001000 /* user-exposed RAM start */ - --/* MS02-NV diagnostic status constants. */ --#define MS02NV_DIAG_SIZE_MASK 0xf0 /* RAM size mask */ --#define MS02NV_DIAG_SIZE_SHIFT 0x10 /* RAM size shift (left) */ -+/* MS02-NV diagnostic status bits. */ -+#define MS02NV_DIAG_TEST 0x01 /* SRAM test done (?) */ -+#define MS02NV_DIAG_RO 0x02 /* SRAM r/o test done */ -+#define MS02NV_DIAG_RW 0x04 /* SRAM r/w test done */ -+#define MS02NV_DIAG_FAIL 0x08 /* SRAM test failed */ -+#define MS02NV_DIAG_SIZE_MASK 0xf0 /* SRAM size mask */ -+#define MS02NV_DIAG_SIZE_SHIFT 0x10 /* SRAM size shift (left) */ - - /* MS02-NV general constants. */ - #define MS02NV_ID 0x03021966 /* MS02-NV magic ID value */ -+#define MS02NV_VALID_ID 0xbd100248 /* valid data magic ID value */ - #define MS02NV_SLOT_SIZE 0x800000 /* size of the address space - decoded by the module */ - -+ - typedef volatile u32 ms02nv_uint; - - struct ms02nv_private { -diff -Nur linux-2.4.30/drivers/mtd/maps/Config.in linux-2.4.30-mips/drivers/mtd/maps/Config.in ---- linux-2.4.30/drivers/mtd/maps/Config.in 2003-06-13 16:51:34.000000000 +0200 -+++ linux-2.4.30-mips/drivers/mtd/maps/Config.in 2004-02-26 01:46:35.000000000 +0100 -@@ -51,11 +51,26 @@ - dep_tristate ' Pb1000 MTD support' CONFIG_MTD_PB1000 $CONFIG_MIPS_PB1000 - dep_tristate ' Pb1500 MTD support' CONFIG_MTD_PB1500 $CONFIG_MIPS_PB1500 - dep_tristate ' Pb1100 MTD support' CONFIG_MTD_PB1100 $CONFIG_MIPS_PB1100 -+ dep_tristate ' Bosporus MTD support' CONFIG_MTD_BOSPORUS $CONFIG_MIPS_BOSPORUS -+ dep_tristate ' XXS1500 boot flash device' CONFIG_MTD_XXS1500 $CONFIG_MIPS_XXS1500 -+ dep_tristate ' MTX-1 flash device' CONFIG_MTD_MTX1 $CONFIG_MIPS_MTX1 - if [ "$CONFIG_MTD_PB1500" = "y" -o "$CONFIG_MTD_PB1500" = "m" \ - -o "$CONFIG_MTD_PB1100" = "y" -o "$CONFIG_MTD_PB1100" = "m" ]; then - bool ' Pb[15]00 boot flash device' CONFIG_MTD_PB1500_BOOT - bool ' Pb[15]00 user flash device (2nd 32MiB bank)' CONFIG_MTD_PB1500_USER - fi -+ tristate ' Db1x00 MTD support' CONFIG_MTD_DB1X00 -+ if [ "$CONFIG_MTD_DB1X00" = "y" -o "$CONFIG_MTD_DB1X00" = "m" ]; then -+ bool ' Db1x00 boot flash device' CONFIG_MTD_DB1X00_BOOT -+ bool ' Db1x00 user flash device (2nd bank)' CONFIG_MTD_DB1X00_USER -+ fi -+ tristate ' Pb1550 MTD support' CONFIG_MTD_PB1550 -+ if [ "$CONFIG_MTD_PB1550" = "y" -o "$CONFIG_MTD_PB1550" = "m" ]; then -+ bool ' Pb1550 Boot Flash' CONFIG_MTD_PB1550_BOOT -+ bool ' Pb1550 User Parameter Flash' CONFIG_MTD_PB1550_USER -+ fi -+ dep_tristate ' Hydrogen 3 MTD support' CONFIG_MTD_HYDROGEN3 $CONFIG_MIPS_HYDROGEN3 -+ dep_tristate ' Mirage MTD support' CONFIG_MTD_MIRAGE $CONFIG_MIPS_MIRAGE - dep_tristate ' Flash chip mapping on ITE QED-4N-S01B, Globespan IVR or custom board' CONFIG_MTD_CSTM_MIPS_IXX $CONFIG_MTD_CFI $CONFIG_MTD_JEDEC $CONFIG_MTD_PARTITIONS - if [ "$CONFIG_MTD_CSTM_MIPS_IXX" = "y" -o "$CONFIG_MTD_CSTM_MIPS_IXX" = "m" ]; then - hex ' Physical start address of flash mapping' CONFIG_MTD_CSTM_MIPS_IXX_START 0x8000000 -diff -Nur linux-2.4.30/drivers/mtd/maps/Makefile linux-2.4.30-mips/drivers/mtd/maps/Makefile ---- linux-2.4.30/drivers/mtd/maps/Makefile 2003-06-13 16:51:34.000000000 +0200 -+++ linux-2.4.30-mips/drivers/mtd/maps/Makefile 2004-02-26 01:46:35.000000000 +0100 -@@ -52,7 +52,13 @@ - obj-$(CONFIG_MTD_PB1000) += pb1xxx-flash.o - obj-$(CONFIG_MTD_PB1100) += pb1xxx-flash.o - obj-$(CONFIG_MTD_PB1500) += pb1xxx-flash.o -+obj-$(CONFIG_MTD_XXS1500) += xxs1500.o -+obj-$(CONFIG_MTD_MTX1) += mtx-1.o - obj-$(CONFIG_MTD_LASAT) += lasat.o -+obj-$(CONFIG_MTD_DB1X00) += db1x00-flash.o -+obj-$(CONFIG_MTD_PB1550) += pb1550-flash.o -+obj-$(CONFIG_MTD_HYDROGEN3) += hydrogen3-flash.o -+obj-$(CONFIG_MTD_BOSPORUS) += pb1xxx-flash.o - obj-$(CONFIG_MTD_AUTCPU12) += autcpu12-nvram.o - obj-$(CONFIG_MTD_EDB7312) += edb7312.o - obj-$(CONFIG_MTD_IMPA7) += impa7.o -@@ -61,5 +67,6 @@ - obj-$(CONFIG_MTD_UCLINUX) += uclinux.o - obj-$(CONFIG_MTD_NETtel) += nettel.o - obj-$(CONFIG_MTD_SCB2_FLASH) += scb2_flash.o -+obj-$(CONFIG_MTD_MIRAGE) += mirage-flash.o - - include $(TOPDIR)/Rules.make -diff -Nur linux-2.4.30/drivers/mtd/maps/db1x00-flash.c linux-2.4.30-mips/drivers/mtd/maps/db1x00-flash.c ---- linux-2.4.30/drivers/mtd/maps/db1x00-flash.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/drivers/mtd/maps/db1x00-flash.c 2005-02-03 07:35:29.000000000 +0100 -@@ -0,0 +1,283 @@ -+/* -+ * Flash memory access on Alchemy Db1xxx boards -+ * -+ * (C) 2003 Pete Popov -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+#ifdef DEBUG_RW -+#define DBG(x...) printk(x) -+#else -+#define DBG(x...) -+#endif -+ -+static unsigned long window_addr; -+static unsigned long window_size; -+static unsigned long flash_size; -+ -+__u8 physmap_read8(struct map_info *map, unsigned long ofs) -+{ -+ __u8 ret; -+ ret = __raw_readb(map->map_priv_1 + ofs); -+ DBG("read8 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret); -+ return ret; -+} -+ -+__u16 physmap_read16(struct map_info *map, unsigned long ofs) -+{ -+ __u16 ret; -+ ret = __raw_readw(map->map_priv_1 + ofs); -+ DBG("read16 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret); -+ return ret; -+} -+ -+__u32 physmap_read32(struct map_info *map, unsigned long ofs) -+{ -+ __u32 ret; -+ ret = __raw_readl(map->map_priv_1 + ofs); -+ DBG("read32 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret); -+ return ret; -+} -+ -+void physmap_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) -+{ -+ DBG("physmap_copy from %x to %x\n", (unsigned)from, (unsigned)to); -+ memcpy_fromio(to, map->map_priv_1 + from, len); -+} -+ -+void physmap_write8(struct map_info *map, __u8 d, unsigned long adr) -+{ -+ DBG("write8 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d); -+ __raw_writeb(d, map->map_priv_1 + adr); -+ mb(); -+} -+ -+void physmap_write16(struct map_info *map, __u16 d, unsigned long adr) -+{ -+ DBG("write16 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d); -+ __raw_writew(d, map->map_priv_1 + adr); -+ mb(); -+} -+ -+void physmap_write32(struct map_info *map, __u32 d, unsigned long adr) -+{ -+ DBG("write32 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d); -+ __raw_writel(d, map->map_priv_1 + adr); -+ mb(); -+} -+ -+void physmap_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len) -+{ -+ DBG("physmap_copy_to %x from %x\n", (unsigned)to, (unsigned)from); -+ memcpy_toio(map->map_priv_1 + to, from, len); -+} -+ -+static struct map_info db1x00_map = { -+ name: "Db1x00 flash", -+ read8: physmap_read8, -+ read16: physmap_read16, -+ read32: physmap_read32, -+ copy_from: physmap_copy_from, -+ write8: physmap_write8, -+ write16: physmap_write16, -+ write32: physmap_write32, -+ copy_to: physmap_copy_to, -+}; -+ -+static unsigned char flash_buswidth = 4; -+ -+/* -+ * The Db1x boards support different flash densities. We setup -+ * the mtd_partition structures below for default of 64Mbit -+ * flash densities, and override the partitions sizes, if -+ * necessary, after we check the board status register. -+ */ -+ -+#ifdef DB1X00_BOTH_BANKS -+/* both banks will be used. Combine the first bank and the first -+ * part of the second bank together into a single jffs/jffs2 -+ * partition. -+ */ -+static struct mtd_partition db1x00_partitions[] = { -+ { -+ name: "User FS", -+ size: 0x1c00000, -+ offset: 0x0000000 -+ },{ -+ name: "yamon", -+ size: 0x0100000, -+ offset: MTDPART_OFS_APPEND, -+ mask_flags: MTD_WRITEABLE -+ },{ -+ name: "raw kernel", -+ size: (0x300000-0x40000), /* last 256KB is yamon env */ -+ offset: MTDPART_OFS_APPEND, -+ } -+}; -+#elif defined(DB1X00_BOOT_ONLY) -+static struct mtd_partition db1x00_partitions[] = { -+ { -+ name: "User FS", -+ size: 0x00c00000, -+ offset: 0x0000000 -+ },{ -+ name: "yamon", -+ size: 0x0100000, -+ offset: MTDPART_OFS_APPEND, -+ mask_flags: MTD_WRITEABLE -+ },{ -+ name: "raw kernel", -+ size: (0x300000-0x40000), /* last 256KB is yamon env */ -+ offset: MTDPART_OFS_APPEND, -+ } -+}; -+#elif defined(DB1X00_USER_ONLY) -+static struct mtd_partition db1x00_partitions[] = { -+ { -+ name: "User FS", -+ size: 0x0e00000, -+ offset: 0x0000000 -+ },{ -+ name: "raw kernel", -+ size: MTDPART_SIZ_FULL, -+ offset: MTDPART_OFS_APPEND, -+ } -+}; -+#else -+#error MTD_DB1X00 define combo error /* should never happen */ -+#endif -+ -+ -+#define NB_OF(x) (sizeof(x)/sizeof(x[0])) -+ -+static struct mtd_partition *parsed_parts; -+static struct mtd_info *mymtd; -+ -+/* -+ * Probe the flash density and setup window address and size -+ * based on user CONFIG options. There are times when we don't -+ * want the MTD driver to be probing the boot or user flash, -+ * so having the option to enable only one bank is important. -+ */ -+int setup_flash_params() -+{ -+ switch ((bcsr->status >> 14) & 0x3) { -+ case 0: /* 64Mbit devices */ -+ flash_size = 0x800000; /* 8MB per part */ -+#if defined(DB1X00_BOTH_BANKS) -+ window_addr = 0x1E000000; -+ window_size = 0x2000000; -+#elif defined(DB1X00_BOOT_ONLY) -+ window_addr = 0x1F000000; -+ window_size = 0x1000000; -+#else /* USER ONLY */ -+ window_addr = 0x1E000000; -+ window_size = 0x1000000; -+#endif -+ break; -+ case 1: -+ /* 128 Mbit devices */ -+ flash_size = 0x1000000; /* 16MB per part */ -+#if defined(DB1X00_BOTH_BANKS) -+ window_addr = 0x1C000000; -+ window_size = 0x4000000; -+ /* USERFS from 0x1C00 0000 to 0x1FC0 0000 */ -+ db1x00_partitions[0].size = 0x3C00000; -+#elif defined(DB1X00_BOOT_ONLY) -+ window_addr = 0x1E000000; -+ window_size = 0x2000000; -+ /* USERFS from 0x1E00 0000 to 0x1FC0 0000 */ -+ db1x00_partitions[0].size = 0x1C00000; -+#else /* USER ONLY */ -+ window_addr = 0x1C000000; -+ window_size = 0x2000000; -+ /* USERFS from 0x1C00 0000 to 0x1DE00000 */ -+ db1x00_partitions[0].size = 0x1DE0000; -+#endif -+ break; -+ case 2: -+ /* 256 Mbit devices */ -+ flash_size = 0x4000000; /* 64MB per part */ -+#if defined(DB1X00_BOTH_BANKS) -+ return 1; -+#elif defined(DB1X00_BOOT_ONLY) -+ /* Boot ROM flash bank only; no user bank */ -+ window_addr = 0x1C000000; -+ window_size = 0x4000000; -+ /* USERFS from 0x1C00 0000 to 0x1FC00000 */ -+ db1x00_partitions[0].size = 0x3C00000; -+#else /* USER ONLY */ -+ return 1; -+#endif -+ break; -+ default: -+ return 1; -+ } -+ return 0; -+} -+ -+int __init db1x00_mtd_init(void) -+{ -+ struct mtd_partition *parts; -+ int nb_parts = 0; -+ char *part_type; -+ -+ /* Default flash buswidth */ -+ db1x00_map.buswidth = flash_buswidth; -+ -+ if (setup_flash_params()) -+ return -ENXIO; -+ -+ /* -+ * Static partition definition selection -+ */ -+ part_type = "static"; -+ parts = db1x00_partitions; -+ nb_parts = NB_OF(db1x00_partitions); -+ db1x00_map.size = window_size; -+ -+ /* -+ * Now let's probe for the actual flash. Do it here since -+ * specific machine settings might have been set above. -+ */ -+ printk(KERN_NOTICE "Db1xxx flash: probing %d-bit flash bus\n", -+ db1x00_map.buswidth*8); -+ db1x00_map.map_priv_1 = -+ (unsigned long)ioremap(window_addr, window_size); -+ mymtd = do_map_probe("cfi_probe", &db1x00_map); -+ if (!mymtd) return -ENXIO; -+ mymtd->module = THIS_MODULE; -+ -+ add_mtd_partitions(mymtd, parts, nb_parts); -+ return 0; -+} -+ -+static void __exit db1x00_mtd_cleanup(void) -+{ -+ if (mymtd) { -+ del_mtd_partitions(mymtd); -+ map_destroy(mymtd); -+ if (parsed_parts) -+ kfree(parsed_parts); -+ } -+} -+ -+module_init(db1x00_mtd_init); -+module_exit(db1x00_mtd_cleanup); -+ -+MODULE_AUTHOR("Pete Popov"); -+MODULE_DESCRIPTION("Db1x00 mtd map driver"); -+MODULE_LICENSE("GPL"); -diff -Nur linux-2.4.30/drivers/mtd/maps/hydrogen3-flash.c linux-2.4.30-mips/drivers/mtd/maps/hydrogen3-flash.c ---- linux-2.4.30/drivers/mtd/maps/hydrogen3-flash.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/drivers/mtd/maps/hydrogen3-flash.c 2004-01-10 23:40:18.000000000 +0100 -@@ -0,0 +1,189 @@ -+/* -+ * Flash memory access on Alchemy HydrogenIII boards -+ * -+ * (C) 2003 Pete Popov -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+#include -+#include -+ -+#ifdef DEBUG_RW -+#define DBG(x...) printk(x) -+#else -+#define DBG(x...) -+#endif -+ -+#define WINDOW_ADDR 0x1E000000 -+#define WINDOW_SIZE 0x02000000 -+ -+ -+__u8 physmap_read8(struct map_info *map, unsigned long ofs) -+{ -+ __u8 ret; -+ ret = __raw_readb(map->map_priv_1 + ofs); -+ DBG("read8 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret); -+ return ret; -+} -+ -+__u16 physmap_read16(struct map_info *map, unsigned long ofs) -+{ -+ __u16 ret; -+ ret = __raw_readw(map->map_priv_1 + ofs); -+ DBG("read16 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret); -+ return ret; -+} -+ -+__u32 physmap_read32(struct map_info *map, unsigned long ofs) -+{ -+ __u32 ret; -+ ret = __raw_readl(map->map_priv_1 + ofs); -+ DBG("read32 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret); -+ return ret; -+} -+ -+void physmap_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) -+{ -+ DBG("physmap_copy from %x to %x\n", (unsigned)from, (unsigned)to); -+ memcpy_fromio(to, map->map_priv_1 + from, len); -+} -+ -+void physmap_write8(struct map_info *map, __u8 d, unsigned long adr) -+{ -+ DBG("write8 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d); -+ __raw_writeb(d, map->map_priv_1 + adr); -+ mb(); -+} -+ -+void physmap_write16(struct map_info *map, __u16 d, unsigned long adr) -+{ -+ DBG("write16 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d); -+ __raw_writew(d, map->map_priv_1 + adr); -+ mb(); -+} -+ -+void physmap_write32(struct map_info *map, __u32 d, unsigned long adr) -+{ -+ DBG("write32 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d); -+ __raw_writel(d, map->map_priv_1 + adr); -+ mb(); -+} -+ -+void physmap_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len) -+{ -+ DBG("physmap_copy_to %x from %x\n", (unsigned)to, (unsigned)from); -+ memcpy_toio(map->map_priv_1 + to, from, len); -+} -+ -+static struct map_info hydrogen3_map = { -+ name: "HydrogenIII flash", -+ read8: physmap_read8, -+ read16: physmap_read16, -+ read32: physmap_read32, -+ copy_from: physmap_copy_from, -+ write8: physmap_write8, -+ write16: physmap_write16, -+ write32: physmap_write32, -+ copy_to: physmap_copy_to, -+}; -+ -+static unsigned char flash_buswidth = 4; -+ -+/* MTDPART_OFS_APPEND is vastly preferred to any attempt at statically lining -+ * up the offsets. */ -+static struct mtd_partition hydrogen3_partitions[] = { -+ { -+ name: "User FS", -+ size: 0x1c00000, -+ offset: 0x0000000 -+ },{ -+ name: "yamon", -+ size: 0x0100000, -+ offset: MTDPART_OFS_APPEND, -+ mask_flags: MTD_WRITEABLE -+ },{ -+ name: "raw kernel", -+ size: 0x02c0000, -+ offset: MTDPART_OFS_APPEND -+ } -+}; -+ -+#define NB_OF(x) (sizeof(x)/sizeof(x[0])) -+ -+static struct mtd_partition *parsed_parts; -+static struct mtd_info *mymtd; -+ -+int __init hydrogen3_mtd_init(void) -+{ -+ struct mtd_partition *parts; -+ int nb_parts = 0; -+ char *part_type; -+ -+ /* Default flash buswidth */ -+ hydrogen3_map.buswidth = flash_buswidth; -+ -+ /* -+ * Static partition definition selection -+ */ -+ part_type = "static"; -+ parts = hydrogen3_partitions; -+ nb_parts = NB_OF(hydrogen3_partitions); -+ hydrogen3_map.size = WINDOW_SIZE; -+ -+ /* -+ * Now let's probe for the actual flash. Do it here since -+ * specific machine settings might have been set above. -+ */ -+ printk(KERN_NOTICE "HydrogenIII flash: probing %d-bit flash bus\n", -+ hydrogen3_map.buswidth*8); -+ hydrogen3_map.map_priv_1 = -+ (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE); -+ mymtd = do_map_probe("cfi_probe", &hydrogen3_map); -+ if (!mymtd) return -ENXIO; -+ mymtd->module = THIS_MODULE; -+ -+ add_mtd_partitions(mymtd, parts, nb_parts); -+ return 0; -+} -+ -+static void __exit hydrogen3_mtd_cleanup(void) -+{ -+ if (mymtd) { -+ del_mtd_partitions(mymtd); -+ map_destroy(mymtd); -+ if (parsed_parts) -+ kfree(parsed_parts); -+ } -+} -+ -+/*#ifndef MODULE -+ -+static int __init _bootflashonly(char *str) -+{ -+ bootflashonly = simple_strtol(str, NULL, 0); -+ return 1; -+} -+ -+ -+__setup("bootflashonly=", _bootflashonly); -+ -+#endif*/ -+ -+ -+module_init(hydrogen3_mtd_init); -+module_exit(hydrogen3_mtd_cleanup); -+ -+MODULE_PARM(bootflashonly, "i"); -+MODULE_PARM_DESC(bootflashonly, "1=use \"boot flash only\""); -+MODULE_AUTHOR("Pete Popov"); -+MODULE_DESCRIPTION("HydrogenIII mtd map driver"); -+MODULE_LICENSE("GPL"); -diff -Nur linux-2.4.30/drivers/mtd/maps/lasat.c linux-2.4.30-mips/drivers/mtd/maps/lasat.c ---- linux-2.4.30/drivers/mtd/maps/lasat.c 2003-06-13 16:51:34.000000000 +0200 -+++ linux-2.4.30-mips/drivers/mtd/maps/lasat.c 2003-08-18 04:59:02.000000000 +0200 -@@ -1,15 +1,6 @@ - /* - * Flash device on lasat 100 and 200 boards - * -- * Presumably (C) 2002 Brian Murphy or whoever he -- * works for. -- * -- * 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. -- * -- * $Id: lasat.c,v 1.1 2003/01/24 14:26:38 dwmw2 Exp $ -- * - */ - - #include -@@ -21,7 +12,6 @@ - #include - #include - #include --#include - - static struct mtd_info *mymtd; - -@@ -69,30 +59,33 @@ - } - - static struct map_info sp_map = { -- .name = "SP flash", -- .buswidth = 4, -- .read8 = sp_read8, -- .read16 = sp_read16, -- .read32 = sp_read32, -- .copy_from = sp_copy_from, -- .write8 = sp_write8, -- .write16 = sp_write16, -- .write32 = sp_write32, -- .copy_to = sp_copy_to -+ name: "SP flash", -+ buswidth: 4, -+ read8: sp_read8, -+ read16: sp_read16, -+ read32: sp_read32, -+ copy_from: sp_copy_from, -+ write8: sp_write8, -+ write16: sp_write16, -+ write32: sp_write32, -+ copy_to: sp_copy_to - }; - - static struct mtd_partition partition_info[LASAT_MTD_LAST]; --static char *lasat_mtd_partnames[] = {"Bootloader", "Service", "Normal", "Filesystem", "Config"}; -+static char *lasat_mtd_partnames[] = {"Bootloader", "Service", "Normal", "Config", "Filesystem"}; - - static int __init init_sp(void) - { - int i; -+ int nparts = 0; - /* this does not play well with the old flash code which - * protects and uprotects the flash when necessary */ - printk(KERN_NOTICE "Unprotecting flash\n"); - *lasat_misc->flash_wp_reg |= 1 << lasat_misc->flash_wp_bit; - -- sp_map.map_priv_1 = lasat_flash_partition_start(LASAT_MTD_BOOTLOADER); -+ sp_map.map_priv_1 = ioremap_nocache( -+ lasat_flash_partition_start(LASAT_MTD_BOOTLOADER), -+ lasat_board_info.li_flash_size); - sp_map.size = lasat_board_info.li_flash_size; - - printk(KERN_NOTICE "sp flash device: %lx at %lx\n", -@@ -109,12 +102,15 @@ - - for (i=0; i < LASAT_MTD_LAST; i++) { - size = lasat_flash_partition_size(i); -- partition_info[i].size = size; -- partition_info[i].offset = offset; -- offset += size; -+ if (size != 0) { -+ nparts++; -+ partition_info[i].size = size; -+ partition_info[i].offset = offset; -+ offset += size; -+ } - } - -- add_mtd_partitions( mymtd, partition_info, LASAT_MTD_LAST ); -+ add_mtd_partitions( mymtd, partition_info, nparts ); - return 0; - } - -@@ -124,11 +120,11 @@ - static void __exit cleanup_sp(void) - { - if (mymtd) { -- del_mtd_partitions(mymtd); -- map_destroy(mymtd); -+ del_mtd_partitions(mymtd); -+ map_destroy(mymtd); - } - if (sp_map.map_priv_1) { -- sp_map.map_priv_1 = 0; -+ sp_map.map_priv_1 = 0; - } - } - -diff -Nur linux-2.4.30/drivers/mtd/maps/mirage-flash.c linux-2.4.30-mips/drivers/mtd/maps/mirage-flash.c ---- linux-2.4.30/drivers/mtd/maps/mirage-flash.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/drivers/mtd/maps/mirage-flash.c 2003-12-22 04:37:22.000000000 +0100 -@@ -0,0 +1,194 @@ -+/* -+ * Flash memory access on AMD Mirage board. -+ * -+ * (C) 2003 Embedded Edge -+ * based on mirage-flash.c: -+ * (C) 2003 Pete Popov -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+#include -+#include -+//#include -+ -+#ifdef DEBUG_RW -+#define DBG(x...) printk(x) -+#else -+#define DBG(x...) -+#endif -+ -+static unsigned long window_addr; -+static unsigned long window_size; -+static unsigned long flash_size; -+ -+__u8 physmap_read8(struct map_info *map, unsigned long ofs) -+{ -+ __u8 ret; -+ ret = __raw_readb(map->map_priv_1 + ofs); -+ DBG("read8 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret); -+ return ret; -+} -+ -+__u16 physmap_read16(struct map_info *map, unsigned long ofs) -+{ -+ __u16 ret; -+ ret = __raw_readw(map->map_priv_1 + ofs); -+ DBG("read16 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret); -+ return ret; -+} -+ -+__u32 physmap_read32(struct map_info *map, unsigned long ofs) -+{ -+ __u32 ret; -+ ret = __raw_readl(map->map_priv_1 + ofs); -+ DBG("read32 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret); -+ return ret; -+} -+ -+void physmap_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) -+{ -+ DBG("physmap_copy from %x to %x\n", (unsigned)from, (unsigned)to); -+ memcpy_fromio(to, map->map_priv_1 + from, len); -+} -+ -+void physmap_write8(struct map_info *map, __u8 d, unsigned long adr) -+{ -+ DBG("write8 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d); -+ __raw_writeb(d, map->map_priv_1 + adr); -+ mb(); -+} -+ -+void physmap_write16(struct map_info *map, __u16 d, unsigned long adr) -+{ -+ DBG("write16 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d); -+ __raw_writew(d, map->map_priv_1 + adr); -+ mb(); -+} -+ -+void physmap_write32(struct map_info *map, __u32 d, unsigned long adr) -+{ -+ DBG("write32 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d); -+ __raw_writel(d, map->map_priv_1 + adr); -+ mb(); -+} -+ -+void physmap_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len) -+{ -+ DBG("physmap_copy_to %x from %x\n", (unsigned)to, (unsigned)from); -+ memcpy_toio(map->map_priv_1 + to, from, len); -+} -+ -+static struct map_info mirage_map = { -+ name: "Mirage flash", -+ read8: physmap_read8, -+ read16: physmap_read16, -+ read32: physmap_read32, -+ copy_from: physmap_copy_from, -+ write8: physmap_write8, -+ write16: physmap_write16, -+ write32: physmap_write32, -+ copy_to: physmap_copy_to, -+}; -+ -+static unsigned char flash_buswidth = 4; -+ -+static struct mtd_partition mirage_partitions[] = { -+ { -+ name: "User FS", -+ size: 0x1c00000, -+ offset: 0x0000000 -+ },{ -+ name: "yamon", -+ size: 0x0100000, -+ offset: MTDPART_OFS_APPEND, -+ mask_flags: MTD_WRITEABLE -+ },{ -+ name: "raw kernel", -+ size: (0x300000-0x40000), /* last 256KB is yamon env */ -+ offset: MTDPART_OFS_APPEND, -+ } -+}; -+ -+#define NB_OF(x) (sizeof(x)/sizeof(x[0])) -+ -+static struct mtd_partition *parsed_parts; -+static struct mtd_info *mymtd; -+ -+/* -+ * Probe the flash density and setup window address and size -+ * based on user CONFIG options. There are times when we don't -+ * want the MTD driver to be probing the boot or user flash, -+ * so having the option to enable only one bank is important. -+ */ -+int setup_flash_params() -+{ -+ flash_size = 0x4000000; /* 64MB per part */ -+ /* Boot ROM flash bank only; no user bank */ -+ window_addr = 0x1C000000; -+ window_size = 0x4000000; -+ /* USERFS from 0x1C00 0000 to 0x1FC00000 */ -+ mirage_partitions[0].size = 0x3C00000; -+ return 0; -+} -+ -+int __init mirage_mtd_init(void) -+{ -+ struct mtd_partition *parts; -+ int nb_parts = 0; -+ char *part_type; -+ -+ /* Default flash buswidth */ -+ mirage_map.buswidth = flash_buswidth; -+ -+ if (setup_flash_params()) -+ return -ENXIO; -+ -+ /* -+ * Static partition definition selection -+ */ -+ part_type = "static"; -+ parts = mirage_partitions; -+ nb_parts = NB_OF(mirage_partitions); -+ mirage_map.size = window_size; -+ -+ /* -+ * Now let's probe for the actual flash. Do it here since -+ * specific machine settings might have been set above. -+ */ -+ printk(KERN_NOTICE "Mirage flash: probing %d-bit flash bus\n", -+ mirage_map.buswidth*8); -+ mirage_map.map_priv_1 = -+ (unsigned long)ioremap(window_addr, window_size); -+ mymtd = do_map_probe("cfi_probe", &mirage_map); -+ if (!mymtd) return -ENXIO; -+ mymtd->module = THIS_MODULE; -+ -+ add_mtd_partitions(mymtd, parts, nb_parts); -+ return 0; -+} -+ -+static void __exit mirage_mtd_cleanup(void) -+{ -+ if (mymtd) { -+ del_mtd_partitions(mymtd); -+ map_destroy(mymtd); -+ if (parsed_parts) -+ kfree(parsed_parts); -+ } -+} -+ -+module_init(mirage_mtd_init); -+module_exit(mirage_mtd_cleanup); -+ -+MODULE_AUTHOR("Embedded Edge"); -+MODULE_DESCRIPTION("Mirage mtd map driver"); -+MODULE_LICENSE("GPL"); -diff -Nur linux-2.4.30/drivers/mtd/maps/mtx-1.c linux-2.4.30-mips/drivers/mtd/maps/mtx-1.c ---- linux-2.4.30/drivers/mtd/maps/mtx-1.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/drivers/mtd/maps/mtx-1.c 2003-06-27 02:04:35.000000000 +0200 -@@ -0,0 +1,181 @@ -+/* -+ * Flash memory access on 4G Systems MTX-1 board -+ * -+ * (C) 2003 Pete Popov -+ * Bruno Randolf -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+#include -+#include -+ -+#ifdef DEBUG_RW -+#define DBG(x...) printk(x) -+#else -+#define DBG(x...) -+#endif -+ -+#ifdef CONFIG_MIPS_MTX1 -+#define WINDOW_ADDR 0x1E000000 -+#define WINDOW_SIZE 0x2000000 -+#endif -+ -+__u8 physmap_read8(struct map_info *map, unsigned long ofs) -+{ -+ __u8 ret; -+ ret = __raw_readb(map->map_priv_1 + ofs); -+ DBG("read8 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret); -+ return ret; -+} -+ -+__u16 physmap_read16(struct map_info *map, unsigned long ofs) -+{ -+ __u16 ret; -+ ret = __raw_readw(map->map_priv_1 + ofs); -+ DBG("read16 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret); -+ return ret; -+} -+ -+__u32 physmap_read32(struct map_info *map, unsigned long ofs) -+{ -+ __u32 ret; -+ ret = __raw_readl(map->map_priv_1 + ofs); -+ DBG("read32 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret); -+ return ret; -+} -+ -+void physmap_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) -+{ -+ DBG("physmap_copy from %x to %x\n", (unsigned)from, (unsigned)to); -+ memcpy_fromio(to, map->map_priv_1 + from, len); -+} -+ -+void physmap_write8(struct map_info *map, __u8 d, unsigned long adr) -+{ -+ DBG("write8 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d); -+ __raw_writeb(d, map->map_priv_1 + adr); -+ mb(); -+} -+ -+void physmap_write16(struct map_info *map, __u16 d, unsigned long adr) -+{ -+ DBG("write16 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d); -+ __raw_writew(d, map->map_priv_1 + adr); -+ mb(); -+} -+ -+void physmap_write32(struct map_info *map, __u32 d, unsigned long adr) -+{ -+ DBG("write32 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d); -+ __raw_writel(d, map->map_priv_1 + adr); -+ mb(); -+} -+ -+void physmap_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len) -+{ -+ DBG("physmap_copy_to %x from %x\n", (unsigned)to, (unsigned)from); -+ memcpy_toio(map->map_priv_1 + to, from, len); -+} -+ -+ -+ -+static struct map_info mtx1_map = { -+ name: "MTX-1 flash", -+ read8: physmap_read8, -+ read16: physmap_read16, -+ read32: physmap_read32, -+ copy_from: physmap_copy_from, -+ write8: physmap_write8, -+ write16: physmap_write16, -+ write32: physmap_write32, -+ copy_to: physmap_copy_to, -+}; -+ -+ -+static unsigned long flash_size = 0x01000000; -+static unsigned char flash_buswidth = 4; -+static struct mtd_partition mtx1_partitions[] = { -+ { -+ name: "user fs", -+ size: 0x1c00000, -+ offset: 0, -+ },{ -+ name: "yamon", -+ size: 0x0100000, -+ offset: MTDPART_OFS_APPEND, -+ mask_flags: MTD_WRITEABLE -+ },{ -+ name: "raw kernel", -+ size: 0x02c0000, -+ offset: MTDPART_OFS_APPEND, -+ },{ -+ name: "yamon env vars", -+ size: 0x0040000, -+ offset: MTDPART_OFS_APPEND, -+ mask_flags: MTD_WRITEABLE -+ } -+}; -+ -+ -+#define NB_OF(x) (sizeof(x)/sizeof(x[0])) -+ -+static struct mtd_partition *parsed_parts; -+static struct mtd_info *mymtd; -+ -+int __init mtx1_mtd_init(void) -+{ -+ struct mtd_partition *parts; -+ int nb_parts = 0; -+ char *part_type; -+ -+ /* Default flash buswidth */ -+ mtx1_map.buswidth = flash_buswidth; -+ -+ /* -+ * Static partition definition selection -+ */ -+ part_type = "static"; -+ parts = mtx1_partitions; -+ nb_parts = NB_OF(mtx1_partitions); -+ mtx1_map.size = flash_size; -+ -+ /* -+ * Now let's probe for the actual flash. Do it here since -+ * specific machine settings might have been set above. -+ */ -+ printk(KERN_NOTICE "MTX-1 flash: probing %d-bit flash bus\n", -+ mtx1_map.buswidth*8); -+ mtx1_map.map_priv_1 = -+ (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE); -+ mymtd = do_map_probe("cfi_probe", &mtx1_map); -+ if (!mymtd) return -ENXIO; -+ mymtd->module = THIS_MODULE; -+ -+ add_mtd_partitions(mymtd, parts, nb_parts); -+ return 0; -+} -+ -+static void __exit mtx1_mtd_cleanup(void) -+{ -+ if (mymtd) { -+ del_mtd_partitions(mymtd); -+ map_destroy(mymtd); -+ if (parsed_parts) -+ kfree(parsed_parts); -+ } -+} -+ -+module_init(mtx1_mtd_init); -+module_exit(mtx1_mtd_cleanup); -+ -+MODULE_AUTHOR("Pete Popov"); -+MODULE_DESCRIPTION("MTX-1 CFI map driver"); -+MODULE_LICENSE("GPL"); -diff -Nur linux-2.4.30/drivers/mtd/maps/pb1550-flash.c linux-2.4.30-mips/drivers/mtd/maps/pb1550-flash.c ---- linux-2.4.30/drivers/mtd/maps/pb1550-flash.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/drivers/mtd/maps/pb1550-flash.c 2004-02-26 01:48:48.000000000 +0100 -@@ -0,0 +1,270 @@ -+/* -+ * Flash memory access on Alchemy Pb1550 board -+ * -+ * (C) 2004 Embedded Edge, LLC, based on pb1550-flash.c: -+ * (C) 2003 Pete Popov -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+#ifdef DEBUG_RW -+#define DBG(x...) printk(x) -+#else -+#define DBG(x...) -+#endif -+ -+static unsigned long window_addr; -+static unsigned long window_size; -+ -+__u8 physmap_read8(struct map_info *map, unsigned long ofs) -+{ -+ __u8 ret; -+ ret = __raw_readb(map->map_priv_1 + ofs); -+ DBG("read8 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret); -+ return ret; -+} -+ -+__u16 physmap_read16(struct map_info *map, unsigned long ofs) -+{ -+ __u16 ret; -+ ret = __raw_readw(map->map_priv_1 + ofs); -+ DBG("read16 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret); -+ return ret; -+} -+ -+__u32 physmap_read32(struct map_info *map, unsigned long ofs) -+{ -+ __u32 ret; -+ ret = __raw_readl(map->map_priv_1 + ofs); -+ DBG("read32 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret); -+ return ret; -+} -+ -+void physmap_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) -+{ -+ DBG("physmap_copy from %x to %x\n", (unsigned)from, (unsigned)to); -+ memcpy_fromio(to, map->map_priv_1 + from, len); -+} -+ -+void physmap_write8(struct map_info *map, __u8 d, unsigned long adr) -+{ -+ DBG("write8 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d); -+ __raw_writeb(d, map->map_priv_1 + adr); -+ mb(); -+} -+ -+void physmap_write16(struct map_info *map, __u16 d, unsigned long adr) -+{ -+ DBG("write16 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d); -+ __raw_writew(d, map->map_priv_1 + adr); -+ mb(); -+} -+ -+void physmap_write32(struct map_info *map, __u32 d, unsigned long adr) -+{ -+ DBG("write32 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d); -+ __raw_writel(d, map->map_priv_1 + adr); -+ mb(); -+} -+ -+void physmap_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len) -+{ -+ DBG("physmap_copy_to %x from %x\n", (unsigned)to, (unsigned)from); -+ memcpy_toio(map->map_priv_1 + to, from, len); -+} -+ -+static struct map_info pb1550_map = { -+ name: "Pb1550 flash", -+ read8: physmap_read8, -+ read16: physmap_read16, -+ read32: physmap_read32, -+ copy_from: physmap_copy_from, -+ write8: physmap_write8, -+ write16: physmap_write16, -+ write32: physmap_write32, -+ copy_to: physmap_copy_to, -+}; -+ -+static unsigned char flash_buswidth = 4; -+ -+/* -+ * Support only 64MB NOR Flash parts -+ */ -+ -+#ifdef PB1550_BOTH_BANKS -+/* both banks will be used. Combine the first bank and the first -+ * part of the second bank together into a single jffs/jffs2 -+ * partition. -+ */ -+static struct mtd_partition pb1550_partitions[] = { -+ /* assume boot[2:0]:swap is '0000' or '1000', which translates to: -+ * 1C00 0000 1FFF FFFF CE0 64MB Boot NOR Flash -+ * 1800 0000 1BFF FFFF CE0 64MB Param NOR Flash -+ */ -+ { -+ name: "User FS", -+ size: (0x1FC00000 - 0x18000000), -+ offset: 0x0000000 -+ },{ -+ name: "yamon", -+ size: 0x0100000, -+ offset: MTDPART_OFS_APPEND, -+ mask_flags: MTD_WRITEABLE -+ },{ -+ name: "raw kernel", -+ size: (0x300000 - 0x40000), /* last 256KB is yamon env */ -+ offset: MTDPART_OFS_APPEND, -+ } -+}; -+#elif defined(PB1550_BOOT_ONLY) -+static struct mtd_partition pb1550_partitions[] = { -+ /* assume boot[2:0]:swap is '0000' or '1000', which translates to: -+ * 1C00 0000 1FFF FFFF CE0 64MB Boot NOR Flash -+ */ -+ { -+ name: "User FS", -+ size: 0x03c00000, -+ offset: 0x0000000 -+ },{ -+ name: "yamon", -+ size: 0x0100000, -+ offset: MTDPART_OFS_APPEND, -+ mask_flags: MTD_WRITEABLE -+ },{ -+ name: "raw kernel", -+ size: (0x300000-0x40000), /* last 256KB is yamon env */ -+ offset: MTDPART_OFS_APPEND, -+ } -+}; -+#elif defined(PB1550_USER_ONLY) -+static struct mtd_partition pb1550_partitions[] = { -+ /* assume boot[2:0]:swap is '0000' or '1000', which translates to: -+ * 1800 0000 1BFF FFFF CE0 64MB Param NOR Flash -+ */ -+ { -+ name: "User FS", -+ size: (0x4000000 - 0x200000), /* reserve 2MB for raw kernel */ -+ offset: 0x0000000 -+ },{ -+ name: "raw kernel", -+ size: MTDPART_SIZ_FULL, -+ offset: MTDPART_OFS_APPEND, -+ } -+}; -+#else -+#error MTD_PB1550 define combo error /* should never happen */ -+#endif -+ -+#define NB_OF(x) (sizeof(x)/sizeof(x[0])) -+ -+static struct mtd_partition *parsed_parts; -+static struct mtd_info *mymtd; -+ -+/* -+ * Probe the flash density and setup window address and size -+ * based on user CONFIG options. There are times when we don't -+ * want the MTD driver to be probing the boot or user flash, -+ * so having the option to enable only one bank is important. -+ */ -+int setup_flash_params() -+{ -+ u16 boot_swapboot; -+ boot_swapboot = (au_readl(MEM_STSTAT) & (0x7<<1)) | -+ ((bcsr->status >> 6) & 0x1); -+ printk("Pb1550 MTD: boot:swap %d\n", boot_swapboot); -+ -+ switch (boot_swapboot) { -+ case 0: /* 512Mbit devices, both enabled */ -+ case 1: -+ case 8: -+ case 9: -+#if defined(PB1550_BOTH_BANKS) -+ window_addr = 0x18000000; -+ window_size = 0x8000000; -+#elif defined(PB1550_BOOT_ONLY) -+ window_addr = 0x1C000000; -+ window_size = 0x4000000; -+#else /* USER ONLY */ -+ window_addr = 0x1E000000; -+ window_size = 0x1000000; -+#endif -+ break; -+ case 0xC: -+ case 0xD: -+ case 0xE: -+ case 0xF: -+ /* 64 MB Boot NOR Flash is disabled */ -+ /* and the start address is moved to 0x0C00000 */ -+ window_addr = 0x0C000000; -+ window_size = 0x4000000; -+ default: -+ printk("Pb1550 MTD: unsupported boot:swap setting\n"); -+ return 1; -+ } -+ return 0; -+} -+ -+int __init pb1550_mtd_init(void) -+{ -+ struct mtd_partition *parts; -+ int nb_parts = 0; -+ char *part_type; -+ -+ /* Default flash buswidth */ -+ pb1550_map.buswidth = flash_buswidth; -+ -+ if (setup_flash_params()) -+ return -ENXIO; -+ -+ /* -+ * Static partition definition selection -+ */ -+ part_type = "static"; -+ parts = pb1550_partitions; -+ nb_parts = NB_OF(pb1550_partitions); -+ pb1550_map.size = window_size; -+ -+ /* -+ * Now let's probe for the actual flash. Do it here since -+ * specific machine settings might have been set above. -+ */ -+ printk(KERN_NOTICE "Pb1550 flash: probing %d-bit flash bus\n", -+ pb1550_map.buswidth*8); -+ pb1550_map.map_priv_1 = -+ (unsigned long)ioremap(window_addr, window_size); -+ mymtd = do_map_probe("cfi_probe", &pb1550_map); -+ if (!mymtd) return -ENXIO; -+ mymtd->module = THIS_MODULE; -+ -+ add_mtd_partitions(mymtd, parts, nb_parts); -+ return 0; -+} -+ -+static void __exit pb1550_mtd_cleanup(void) -+{ -+ if (mymtd) { -+ del_mtd_partitions(mymtd); -+ map_destroy(mymtd); -+ if (parsed_parts) -+ kfree(parsed_parts); -+ } -+} -+ -+module_init(pb1550_mtd_init); -+module_exit(pb1550_mtd_cleanup); -+ -+MODULE_AUTHOR("Embedded Edge, LLC"); -+MODULE_DESCRIPTION("Pb1550 mtd map driver"); -+MODULE_LICENSE("GPL"); -diff -Nur linux-2.4.30/drivers/mtd/maps/pb1xxx-flash.c linux-2.4.30-mips/drivers/mtd/maps/pb1xxx-flash.c ---- linux-2.4.30/drivers/mtd/maps/pb1xxx-flash.c 2003-06-13 16:51:34.000000000 +0200 -+++ linux-2.4.30-mips/drivers/mtd/maps/pb1xxx-flash.c 2003-05-19 08:27:22.000000000 +0200 -@@ -192,6 +192,34 @@ - #else - #error MTD_PB1500 define combo error /* should never happen */ - #endif -+#elif defined(CONFIG_MTD_BOSPORUS) -+static unsigned char flash_buswidth = 2; -+static unsigned long flash_size = 0x02000000; -+#define WINDOW_ADDR 0x1F000000 -+#define WINDOW_SIZE 0x2000000 -+static struct mtd_partition pb1xxx_partitions[] = { -+ { -+ name: "User FS", -+ size: 0x00400000, -+ offset: 0x00000000, -+ },{ -+ name: "Yamon-2", -+ size: 0x00100000, -+ offset: 0x00400000, -+ },{ -+ name: "Root FS", -+ size: 0x00700000, -+ offset: 0x00500000, -+ },{ -+ name: "Yamon-1", -+ size: 0x00100000, -+ offset: 0x00C00000, -+ },{ -+ name: "Kernel", -+ size: 0x00300000, -+ offset: 0x00D00000, -+ } -+}; - #else - #error Unsupported board - #endif -diff -Nur linux-2.4.30/drivers/mtd/maps/xxs1500.c linux-2.4.30-mips/drivers/mtd/maps/xxs1500.c ---- linux-2.4.30/drivers/mtd/maps/xxs1500.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/drivers/mtd/maps/xxs1500.c 2003-08-02 04:06:01.000000000 +0200 -@@ -0,0 +1,186 @@ -+/* -+ * Flash memory access on MyCable XXS1500 board -+ * -+ * (C) 2003 Pete Popov -+ * -+ * $Id: xxs1500.c,v 1.1.2.2 2003/08/02 02:06:01 ppopov Exp $ -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+#include -+#include -+ -+#ifdef DEBUG_RW -+#define DBG(x...) printk(x) -+#else -+#define DBG(x...) -+#endif -+ -+#ifdef CONFIG_MIPS_XXS1500 -+#define WINDOW_ADDR 0x1F000000 -+#define WINDOW_SIZE 0x1000000 -+#endif -+ -+__u8 physmap_read8(struct map_info *map, unsigned long ofs) -+{ -+ __u8 ret; -+ ret = __raw_readb(map->map_priv_1 + ofs); -+ DBG("read8 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret); -+ return ret; -+} -+ -+__u16 physmap_read16(struct map_info *map, unsigned long ofs) -+{ -+ __u16 ret; -+ ret = __raw_readw(map->map_priv_1 + ofs); -+ DBG("read16 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret); -+ return ret; -+} -+ -+__u32 physmap_read32(struct map_info *map, unsigned long ofs) -+{ -+ __u32 ret; -+ ret = __raw_readl(map->map_priv_1 + ofs); -+ DBG("read32 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret); -+ return ret; -+} -+ -+void physmap_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) -+{ -+ DBG("physmap_copy from %x to %x\n", (unsigned)from, (unsigned)to); -+ memcpy_fromio(to, map->map_priv_1 + from, len); -+} -+ -+void physmap_write8(struct map_info *map, __u8 d, unsigned long adr) -+{ -+ DBG("write8 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d); -+ __raw_writeb(d, map->map_priv_1 + adr); -+ mb(); -+} -+ -+void physmap_write16(struct map_info *map, __u16 d, unsigned long adr) -+{ -+ DBG("write16 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d); -+ __raw_writew(d, map->map_priv_1 + adr); -+ mb(); -+} -+ -+void physmap_write32(struct map_info *map, __u32 d, unsigned long adr) -+{ -+ DBG("write32 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d); -+ __raw_writel(d, map->map_priv_1 + adr); -+ mb(); -+} -+ -+void physmap_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len) -+{ -+ DBG("physmap_copy_to %x from %x\n", (unsigned)to, (unsigned)from); -+ memcpy_toio(map->map_priv_1 + to, from, len); -+} -+ -+ -+ -+static struct map_info xxs1500_map = { -+ name: "XXS1500 flash", -+ read8: physmap_read8, -+ read16: physmap_read16, -+ read32: physmap_read32, -+ copy_from: physmap_copy_from, -+ write8: physmap_write8, -+ write16: physmap_write16, -+ write32: physmap_write32, -+ copy_to: physmap_copy_to, -+}; -+ -+ -+static unsigned long flash_size = 0x00800000; -+static unsigned char flash_buswidth = 4; -+static struct mtd_partition xxs1500_partitions[] = { -+ { -+ name: "kernel image", -+ size: 0x00200000, -+ offset: 0, -+ },{ -+ name: "user fs 0", -+ size: (0x00C00000-0x200000), -+ offset: MTDPART_OFS_APPEND, -+ },{ -+ name: "yamon", -+ size: 0x00100000, -+ offset: MTDPART_OFS_APPEND, -+ mask_flags: MTD_WRITEABLE -+ },{ -+ name: "user fs 1", -+ size: 0x2c0000, -+ offset: MTDPART_OFS_APPEND, -+ },{ -+ name: "yamon env vars", -+ size: 0x040000, -+ offset: MTDPART_OFS_APPEND, -+ mask_flags: MTD_WRITEABLE -+ } -+}; -+ -+ -+#define NB_OF(x) (sizeof(x)/sizeof(x[0])) -+ -+static struct mtd_partition *parsed_parts; -+static struct mtd_info *mymtd; -+ -+int __init xxs1500_mtd_init(void) -+{ -+ struct mtd_partition *parts; -+ int nb_parts = 0; -+ char *part_type; -+ -+ /* Default flash buswidth */ -+ xxs1500_map.buswidth = flash_buswidth; -+ -+ /* -+ * Static partition definition selection -+ */ -+ part_type = "static"; -+ parts = xxs1500_partitions; -+ nb_parts = NB_OF(xxs1500_partitions); -+ xxs1500_map.size = flash_size; -+ -+ /* -+ * Now let's probe for the actual flash. Do it here since -+ * specific machine settings might have been set above. -+ */ -+ printk(KERN_NOTICE "XXS1500 flash: probing %d-bit flash bus\n", -+ xxs1500_map.buswidth*8); -+ xxs1500_map.map_priv_1 = -+ (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE); -+ mymtd = do_map_probe("cfi_probe", &xxs1500_map); -+ if (!mymtd) return -ENXIO; -+ mymtd->module = THIS_MODULE; -+ -+ add_mtd_partitions(mymtd, parts, nb_parts); -+ return 0; -+} -+ -+static void __exit xxs1500_mtd_cleanup(void) -+{ -+ if (mymtd) { -+ del_mtd_partitions(mymtd); -+ map_destroy(mymtd); -+ if (parsed_parts) -+ kfree(parsed_parts); -+ } -+} -+ -+module_init(xxs1500_mtd_init); -+module_exit(xxs1500_mtd_cleanup); -+ -+MODULE_AUTHOR("Pete Popov"); -+MODULE_DESCRIPTION("XXS1500 CFI map driver"); -+MODULE_LICENSE("GPL"); -diff -Nur linux-2.4.30/drivers/net/defxx.c linux-2.4.30-mips/drivers/net/defxx.c ---- linux-2.4.30/drivers/net/defxx.c 2004-11-17 12:54:21.000000000 +0100 -+++ linux-2.4.30-mips/drivers/net/defxx.c 2004-11-19 01:28:39.000000000 +0100 -@@ -10,24 +10,18 @@ - * - * Abstract: - * A Linux device driver supporting the Digital Equipment Corporation -- * FDDI EISA and PCI controller families. Supported adapters include: -+ * FDDI TURBOchannel, EISA and PCI controller families. Supported -+ * adapters include: - * -- * DEC FDDIcontroller/EISA (DEFEA) -- * DEC FDDIcontroller/PCI (DEFPA) -+ * DEC FDDIcontroller/TURBOchannel (DEFTA) -+ * DEC FDDIcontroller/EISA (DEFEA) -+ * DEC FDDIcontroller/PCI (DEFPA) - * -- * Maintainers: -- * LVS Lawrence V. Stefani -- * -- * Contact: -- * The author may be reached at: -+ * The original author: -+ * LVS Lawrence V. Stefani - * -- * Inet: stefani@lkg.dec.com -- * (NOTE! this address no longer works -jgarzik) -- * -- * Mail: Digital Equipment Corporation -- * 550 King Street -- * M/S: LKG1-3/M07 -- * Littleton, MA 01460 -+ * Maintainers: -+ * macro Maciej W. Rozycki - * - * Credits: - * I'd like to thank Patricia Cross for helping me get started with -@@ -197,16 +191,16 @@ - * Sep 2000 tjeerd Fix leak on unload, cosmetic code cleanup - * Feb 2001 Skb allocation fixes - * Feb 2001 davej PCI enable cleanups. -+ * 04 Aug 2003 macro Converted to the DMA API. -+ * 14 Aug 2004 macro Fix device names reported. -+ * 26 Sep 2004 macro TURBOchannel support. - */ - - /* Include files */ - - #include -- - #include --#include - #include --#include - #include - #include - #include -@@ -215,19 +209,33 @@ - #include - #include - #include -+#include -+#include -+ - #include - #include - #include - --#include --#include -+#ifdef CONFIG_TC -+#include -+#else -+static int search_tc_card(const char *name) { return -ENODEV; } -+static void claim_tc_card(int slot) { } -+static void release_tc_card(int slot) { } -+static unsigned long get_tc_base_addr(int slot) { return 0; } -+static unsigned long get_tc_irq_nr(int slot) { return -1; } -+#endif - - #include "defxx.h" - --/* Version information string - should be updated prior to each new release!!! */ -+/* Version information string should be updated prior to each new release! */ -+#define DRV_NAME "defxx" -+#define DRV_VERSION "v1.07T" -+#define DRV_RELDATE "2004/09/26" - - static char version[] __devinitdata = -- "defxx.c:v1.05e 2001/02/03 Lawrence V. Stefani and others\n"; -+ DRV_NAME ": " DRV_VERSION " " DRV_RELDATE -+ " Lawrence V. Stefani and others\n"; - - #define DYNAMIC_BUFFERS 1 - -@@ -243,7 +251,7 @@ - static void dfx_bus_init(struct net_device *dev); - static void dfx_bus_config_check(DFX_board_t *bp); - --static int dfx_driver_init(struct net_device *dev); -+static int dfx_driver_init(struct net_device *dev, const char *print_name); - static int dfx_adap_init(DFX_board_t *bp, int get_buffers); - - static int dfx_open(struct net_device *dev); -@@ -337,48 +345,84 @@ - int offset, - u8 data - ) -+{ -+ if (bp->bus_type == DFX_BUS_TYPE_TC) -+ { -+ volatile u8 *addr = (void *)(bp->base_addr + offset); - -+ *addr = data; -+ mb(); -+ } -+ else - { - u16 port = bp->base_addr + offset; - - outb(data, port); - } -+} - - static inline void dfx_port_read_byte( - DFX_board_t *bp, - int offset, - u8 *data - ) -+{ -+ if (bp->bus_type == DFX_BUS_TYPE_TC) -+ { -+ volatile u8 *addr = (void *)(bp->base_addr + offset); - -+ mb(); -+ *data = *addr; -+ } -+ else - { - u16 port = bp->base_addr + offset; - - *data = inb(port); - } -+} - - static inline void dfx_port_write_long( - DFX_board_t *bp, - int offset, - u32 data - ) -+{ -+ if (bp->bus_type == DFX_BUS_TYPE_TC) -+ { -+ volatile u32 *addr = (void *)(bp->base_addr + offset); - -+ *addr = data; -+ mb(); -+ } -+ else - { - u16 port = bp->base_addr + offset; - - outl(data, port); - } -+} - - static inline void dfx_port_read_long( - DFX_board_t *bp, - int offset, - u32 *data - ) -+{ -+ if (bp->bus_type == DFX_BUS_TYPE_TC) -+ { -+ volatile u32 *addr = (void *)(bp->base_addr + offset); - -+ mb(); -+ *data = *addr; -+ } -+ else - { - u16 port = bp->base_addr + offset; - - *data = inl(port); - } -+} - - - /* -@@ -393,8 +437,9 @@ - * Condition code - * - * Arguments: -- * pdev - pointer to pci device information (NULL for EISA) -- * ioaddr - pointer to port (NULL for PCI) -+ * pdev - pointer to pci device information (NULL for EISA or TURBOchannel) -+ * bus_type - bus type (one of DFX_BUS_TYPE_*) -+ * handle - bus-specific data: slot (TC), pointer to port (EISA), NULL (PCI) - * - * Functional Description: - * -@@ -410,54 +455,68 @@ - * initialized and the board resources are read and stored in - * the device structure. - */ --static int __devinit dfx_init_one_pci_or_eisa(struct pci_dev *pdev, long ioaddr) -+static int __devinit dfx_init_one_pci_or_eisa(struct pci_dev *pdev, u32 bus_type, long handle) - { -+ static int version_disp; -+ char *print_name = DRV_NAME; - struct net_device *dev; - DFX_board_t *bp; /* board pointer */ -+ long ioaddr; /* pointer to port */ -+ unsigned long len; /* resource length */ -+ int alloc_size; /* total buffer size used */ - int err; - --#ifndef MODULE -- static int version_disp; -- -- if (!version_disp) /* display version info if adapter is found */ -- { -+ if (!version_disp) { /* display version info if adapter is found */ - version_disp = 1; /* set display flag to TRUE so that */ - printk(version); /* we only display this string ONCE */ - } --#endif - -- /* -- * init_fddidev() allocates a device structure with private data, clears the device structure and private data, -- * and calls fddi_setup() and register_netdev(). Not much left to do for us here. -- */ -- dev = init_fddidev(NULL, sizeof(*bp)); -+ if (pdev != NULL) -+ print_name = pdev->slot_name; -+ -+ dev = alloc_fddidev(sizeof(*bp)); - if (!dev) { -- printk (KERN_ERR "defxx: unable to allocate fddidev, aborting\n"); -+ printk(KERN_ERR "%s: unable to allocate fddidev, aborting\n", -+ print_name); - return -ENOMEM; - } - - /* Enable PCI device. */ -- if (pdev != NULL) { -+ if (bus_type == DFX_BUS_TYPE_PCI) { - err = pci_enable_device (pdev); - if (err) goto err_out; - ioaddr = pci_resource_start (pdev, 1); - } - - SET_MODULE_OWNER(dev); -+ SET_NETDEV_DEV(dev, &pdev->dev); - - bp = dev->priv; - -- if (!request_region (ioaddr, pdev ? PFI_K_CSR_IO_LEN : PI_ESIC_K_CSR_IO_LEN, dev->name)) { -- printk (KERN_ERR "%s: Cannot reserve I/O resource 0x%x @ 0x%lx, aborting\n", -- dev->name, PFI_K_CSR_IO_LEN, ioaddr); -+ if (bus_type == DFX_BUS_TYPE_TC) { -+ /* TURBOchannel board */ -+ bp->slot = handle; -+ claim_tc_card(bp->slot); -+ ioaddr = get_tc_base_addr(handle) + PI_TC_K_CSR_OFFSET; -+ len = PI_TC_K_CSR_LEN; -+ } else if (bus_type == DFX_BUS_TYPE_EISA) { -+ /* EISA board */ -+ ioaddr = handle; -+ len = PI_ESIC_K_CSR_IO_LEN; -+ } else -+ /* PCI board */ -+ len = PFI_K_CSR_IO_LEN; -+ dev->base_addr = ioaddr; /* save port (I/O) base address */ -+ -+ if (!request_region(ioaddr, len, print_name)) { -+ printk(KERN_ERR "%s: Cannot reserve I/O resource " -+ "0x%lx @ 0x%lx, aborting\n", print_name, len, ioaddr); - err = -EBUSY; - goto err_out; - } - - /* Initialize new device structure */ - -- dev->base_addr = ioaddr; /* save port (I/O) base address */ -- - dev->get_stats = dfx_ctl_get_stats; - dev->open = dfx_open; - dev->stop = dfx_close; -@@ -465,37 +524,54 @@ - dev->set_multicast_list = dfx_ctl_set_multicast_list; - dev->set_mac_address = dfx_ctl_set_mac_address; - -- if (pdev == NULL) { -- /* EISA board */ -- bp->bus_type = DFX_BUS_TYPE_EISA; -+ bp->bus_type = bus_type; -+ if (bus_type == DFX_BUS_TYPE_TC || bus_type == DFX_BUS_TYPE_EISA) { -+ /* TURBOchannel or EISA board */ - bp->next = root_dfx_eisa_dev; - root_dfx_eisa_dev = dev; - } else { - /* PCI board */ -- bp->bus_type = DFX_BUS_TYPE_PCI; - bp->pci_dev = pdev; - pci_set_drvdata (pdev, dev); - pci_set_master (pdev); - } - -- if (dfx_driver_init(dev) != DFX_K_SUCCESS) { -+ -+ if (dfx_driver_init(dev, print_name) != DFX_K_SUCCESS) { - err = -ENODEV; - goto err_out_region; - } - -+ err = register_netdev(dev); -+ if (err) -+ goto err_out_kfree; -+ -+ printk("%s: registered as %s\n", print_name, dev->name); - return 0; - -+err_out_kfree: -+ alloc_size = sizeof(PI_DESCR_BLOCK) + -+ PI_CMD_REQ_K_SIZE_MAX + PI_CMD_RSP_K_SIZE_MAX + -+#ifndef DYNAMIC_BUFFERS -+ (bp->rcv_bufs_to_post * PI_RCV_DATA_K_SIZE_MAX) + -+#endif -+ sizeof(PI_CONSUMER_BLOCK) + -+ (PI_ALIGN_K_DESC_BLK - 1); -+ if (bp->kmalloced) -+ pci_free_consistent(pdev, alloc_size, -+ bp->kmalloced, bp->kmalloced_dma); - err_out_region: -- release_region(ioaddr, pdev ? PFI_K_CSR_IO_LEN : PI_ESIC_K_CSR_IO_LEN); -+ release_region(ioaddr, len); - err_out: -- unregister_netdev(dev); -- kfree(dev); -+ if (bp->bus_type == DFX_BUS_TYPE_TC) -+ release_tc_card(bp->slot); -+ free_netdev(dev); - return err; - } - - static int __devinit dfx_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) - { -- return dfx_init_one_pci_or_eisa(pdev, 0); -+ return dfx_init_one_pci_or_eisa(pdev, DFX_BUS_TYPE_PCI, 0); - } - - static int __init dfx_eisa_init(void) -@@ -507,6 +583,7 @@ - - DBG_printk("In dfx_eisa_init...\n"); - -+#ifdef CONFIG_EISA - /* Scan for FDDI EISA controllers */ - - for (i=0; i < DFX_MAX_EISA_SLOTS; i++) /* only scan for up to 16 EISA slots */ -@@ -517,9 +594,27 @@ - { - port = (i << 12); /* recalc base addr */ - -- if (dfx_init_one_pci_or_eisa(NULL, port) == 0) rc = 0; -+ if (dfx_init_one_pci_or_eisa(NULL, DFX_BUS_TYPE_EISA, port) == 0) rc = 0; - } - } -+#endif -+ return rc; -+} -+ -+static int __init dfx_tc_init(void) -+{ -+ int rc = -ENODEV; -+ int slot; /* TC slot number */ -+ -+ DBG_printk("In dfx_tc_init...\n"); -+ -+ /* Scan for FDDI TC controllers */ -+ while ((slot = search_tc_card("PMAF-F")) >= 0) { -+ if (dfx_init_one_pci_or_eisa(NULL, DFX_BUS_TYPE_TC, slot) == 0) -+ rc = 0; -+ else -+ break; -+ } - return rc; - } - -@@ -583,8 +678,9 @@ - - /* Initialize adapter based on bus type */ - -- if (bp->bus_type == DFX_BUS_TYPE_EISA) -- { -+ if (bp->bus_type == DFX_BUS_TYPE_TC) { -+ dev->irq = get_tc_irq_nr(bp->slot); -+ } else if (bp->bus_type == DFX_BUS_TYPE_EISA) { - /* Get the interrupt level from the ESIC chip */ - - dfx_port_read_byte(bp, PI_ESIC_K_IO_CONFIG_STAT_0, &val); -@@ -766,6 +862,7 @@ - * - * Arguments: - * dev - pointer to device information -+ * print_name - printable device name - * - * Functional Description: - * This function allocates additional resources such as the host memory -@@ -780,20 +877,21 @@ - * or read adapter MAC address - * - * Assumptions: -- * Memory allocated from kmalloc() call is physically contiguous, locked -- * memory whose physical address equals its virtual address. -+ * Memory allocated from pci_alloc_consistent() call is physically -+ * contiguous, locked memory. - * - * Side Effects: - * Adapter is reset and should be in DMA_UNAVAILABLE state before - * returning from this routine. - */ - --static int __devinit dfx_driver_init(struct net_device *dev) -+static int __devinit dfx_driver_init(struct net_device *dev, -+ const char *print_name) - { - DFX_board_t *bp = dev->priv; - int alloc_size; /* total buffer size needed */ - char *top_v, *curr_v; /* virtual addrs into memory block */ -- u32 top_p, curr_p; /* physical addrs into memory block */ -+ dma_addr_t top_p, curr_p; /* physical addrs into memory block */ - u32 data; /* host data register value */ - - DBG_printk("In dfx_driver_init...\n"); -@@ -837,26 +935,20 @@ - - /* Read the factory MAC address from the adapter then save it */ - -- if (dfx_hw_port_ctrl_req(bp, -- PI_PCTRL_M_MLA, -- PI_PDATA_A_MLA_K_LO, -- 0, -- &data) != DFX_K_SUCCESS) -- { -- printk("%s: Could not read adapter factory MAC address!\n", dev->name); -+ if (dfx_hw_port_ctrl_req(bp, PI_PCTRL_M_MLA, PI_PDATA_A_MLA_K_LO, 0, -+ &data) != DFX_K_SUCCESS) { -+ printk("%s: Could not read adapter factory MAC address!\n", -+ print_name); - return(DFX_K_FAILURE); -- } -+ } - memcpy(&bp->factory_mac_addr[0], &data, sizeof(u32)); - -- if (dfx_hw_port_ctrl_req(bp, -- PI_PCTRL_M_MLA, -- PI_PDATA_A_MLA_K_HI, -- 0, -- &data) != DFX_K_SUCCESS) -- { -- printk("%s: Could not read adapter factory MAC address!\n", dev->name); -+ if (dfx_hw_port_ctrl_req(bp, PI_PCTRL_M_MLA, PI_PDATA_A_MLA_K_HI, 0, -+ &data) != DFX_K_SUCCESS) { -+ printk("%s: Could not read adapter factory MAC address!\n", -+ print_name); - return(DFX_K_FAILURE); -- } -+ } - memcpy(&bp->factory_mac_addr[4], &data, sizeof(u16)); - - /* -@@ -867,28 +959,27 @@ - */ - - memcpy(dev->dev_addr, bp->factory_mac_addr, FDDI_K_ALEN); -- if (bp->bus_type == DFX_BUS_TYPE_EISA) -- printk("%s: DEFEA at I/O addr = 0x%lX, IRQ = %d, Hardware addr = %02X-%02X-%02X-%02X-%02X-%02X\n", -- dev->name, -- dev->base_addr, -- dev->irq, -- dev->dev_addr[0], -- dev->dev_addr[1], -- dev->dev_addr[2], -- dev->dev_addr[3], -- dev->dev_addr[4], -- dev->dev_addr[5]); -+ if (bp->bus_type == DFX_BUS_TYPE_TC) -+ printk("%s: DEFTA at addr = 0x%lX, IRQ = %d, " -+ "Hardware addr = %02X-%02X-%02X-%02X-%02X-%02X\n", -+ print_name, dev->base_addr, dev->irq, -+ dev->dev_addr[0], dev->dev_addr[1], -+ dev->dev_addr[2], dev->dev_addr[3], -+ dev->dev_addr[4], dev->dev_addr[5]); -+ else if (bp->bus_type == DFX_BUS_TYPE_EISA) -+ printk("%s: DEFEA at I/O addr = 0x%lX, IRQ = %d, " -+ "Hardware addr = %02X-%02X-%02X-%02X-%02X-%02X\n", -+ print_name, dev->base_addr, dev->irq, -+ dev->dev_addr[0], dev->dev_addr[1], -+ dev->dev_addr[2], dev->dev_addr[3], -+ dev->dev_addr[4], dev->dev_addr[5]); - else -- printk("%s: DEFPA at I/O addr = 0x%lX, IRQ = %d, Hardware addr = %02X-%02X-%02X-%02X-%02X-%02X\n", -- dev->name, -- dev->base_addr, -- dev->irq, -- dev->dev_addr[0], -- dev->dev_addr[1], -- dev->dev_addr[2], -- dev->dev_addr[3], -- dev->dev_addr[4], -- dev->dev_addr[5]); -+ printk("%s: DEFPA at I/O addr = 0x%lX, IRQ = %d, " -+ "Hardware addr = %02X-%02X-%02X-%02X-%02X-%02X\n", -+ print_name, dev->base_addr, dev->irq, -+ dev->dev_addr[0], dev->dev_addr[1], -+ dev->dev_addr[2], dev->dev_addr[3], -+ dev->dev_addr[4], dev->dev_addr[5]); - - /* - * Get memory for descriptor block, consumer block, and other buffers -@@ -903,14 +994,15 @@ - #endif - sizeof(PI_CONSUMER_BLOCK) + - (PI_ALIGN_K_DESC_BLK - 1); -- bp->kmalloced = top_v = (char *) kmalloc(alloc_size, GFP_KERNEL); -- if (top_v == NULL) -- { -- printk("%s: Could not allocate memory for host buffers and structures!\n", dev->name); -+ bp->kmalloced = top_v = pci_alloc_consistent(bp->pci_dev, alloc_size, -+ &bp->kmalloced_dma); -+ if (top_v == NULL) { -+ printk("%s: Could not allocate memory for host buffers " -+ "and structures!\n", print_name); - return(DFX_K_FAILURE); -- } -+ } - memset(top_v, 0, alloc_size); /* zero out memory before continuing */ -- top_p = virt_to_bus(top_v); /* get physical address of buffer */ -+ top_p = bp->kmalloced_dma; /* get physical address of buffer */ - - /* - * To guarantee the 8K alignment required for the descriptor block, 8K - 1 -@@ -924,7 +1016,7 @@ - * for allocating the needed memory. - */ - -- curr_p = (u32) (ALIGN(top_p, PI_ALIGN_K_DESC_BLK)); -+ curr_p = ALIGN(top_p, PI_ALIGN_K_DESC_BLK); - curr_v = top_v + (curr_p - top_p); - - /* Reserve space for descriptor block */ -@@ -965,14 +1057,20 @@ - - /* Display virtual and physical addresses if debug driver */ - -- DBG_printk("%s: Descriptor block virt = %0lX, phys = %0X\n", dev->name, (long)bp->descr_block_virt, bp->descr_block_phys); -- DBG_printk("%s: Command Request buffer virt = %0lX, phys = %0X\n", dev->name, (long)bp->cmd_req_virt, bp->cmd_req_phys); -- DBG_printk("%s: Command Response buffer virt = %0lX, phys = %0X\n", dev->name, (long)bp->cmd_rsp_virt, bp->cmd_rsp_phys); -- DBG_printk("%s: Receive buffer block virt = %0lX, phys = %0X\n", dev->name, (long)bp->rcv_block_virt, bp->rcv_block_phys); -- DBG_printk("%s: Consumer block virt = %0lX, phys = %0X\n", dev->name, (long)bp->cons_block_virt, bp->cons_block_phys); -+ DBG_printk("%s: Descriptor block virt = %0lX, phys = %0X\n", -+ print_name, -+ (long)bp->descr_block_virt, bp->descr_block_phys); -+ DBG_printk("%s: Command Request buffer virt = %0lX, phys = %0X\n", -+ print_name, (long)bp->cmd_req_virt, bp->cmd_req_phys); -+ DBG_printk("%s: Command Response buffer virt = %0lX, phys = %0X\n", -+ print_name, (long)bp->cmd_rsp_virt, bp->cmd_rsp_phys); -+ DBG_printk("%s: Receive buffer block virt = %0lX, phys = %0X\n", -+ print_name, (long)bp->rcv_block_virt, bp->rcv_block_phys); -+ DBG_printk("%s: Consumer block virt = %0lX, phys = %0X\n", -+ print_name, (long)bp->cons_block_virt, bp->cons_block_phys); - - return(DFX_K_SUCCESS); -- } -+} - - - /* -@@ -1218,7 +1316,9 @@ - - /* Register IRQ - support shared interrupts by passing device ptr */ - -- ret = request_irq(dev->irq, (void *)dfx_interrupt, SA_SHIRQ, dev->name, dev); -+ ret = request_irq(dev->irq, (void *)dfx_interrupt, -+ (bp->bus_type == DFX_BUS_TYPE_TC) ? 0 : SA_SHIRQ, -+ dev->name, dev); - if (ret) { - printk(KERN_ERR "%s: Requested IRQ %d is busy\n", dev->name, dev->irq); - return ret; -@@ -1737,7 +1837,7 @@ - dfx_port_write_long(bp, PFI_K_REG_MODE_CTRL, - (PFI_MODE_M_PDQ_INT_ENB + PFI_MODE_M_DMA_ENB)); - } -- else -+ else if (bp->bus_type == DFX_BUS_TYPE_EISA) - { - /* Disable interrupts at the ESIC */ - -@@ -1755,6 +1855,13 @@ - tmp |= PI_CONFIG_STAT_0_M_INT_ENB; - dfx_port_write_byte(bp, PI_ESIC_K_IO_CONFIG_STAT_0, tmp); - } -+ else { -+ /* TC doesn't share interrupts so no need to disable them */ -+ -+ /* Call interrupt service routine for this adapter */ -+ -+ dfx_int_common(dev); -+ } - - spin_unlock(&bp->lock); - } -@@ -2663,12 +2770,12 @@ - - static void my_skb_align(struct sk_buff *skb, int n) - { -- u32 x=(u32)skb->data; /* We only want the low bits .. */ -- u32 v; -+ unsigned long x = (unsigned long)skb->data; -+ unsigned long v; - -- v=(x+n-1)&~(n-1); /* Where we want to be */ -+ v = ALIGN(x, n); /* Where we want to be */ - -- skb_reserve(skb, v-x); -+ skb_reserve(skb, v - x); - } - - -@@ -2745,7 +2852,10 @@ - */ - - my_skb_align(newskb, 128); -- bp->descr_block_virt->rcv_data[i+j].long_1 = virt_to_bus(newskb->data); -+ bp->descr_block_virt->rcv_data[i + j].long_1 = -+ (u32)pci_map_single(bp->pci_dev, newskb->data, -+ NEW_SKB_SIZE, -+ PCI_DMA_FROMDEVICE); - /* - * p_rcv_buff_va is only used inside the - * kernel so we put the skb pointer here. -@@ -2859,9 +2969,17 @@ - - my_skb_align(newskb, 128); - skb = (struct sk_buff *)bp->p_rcv_buff_va[entry]; -+ pci_unmap_single(bp->pci_dev, -+ bp->descr_block_virt->rcv_data[entry].long_1, -+ NEW_SKB_SIZE, -+ PCI_DMA_FROMDEVICE); - skb_reserve(skb, RCV_BUFF_K_PADDING); - bp->p_rcv_buff_va[entry] = (char *)newskb; -- bp->descr_block_virt->rcv_data[entry].long_1 = virt_to_bus(newskb->data); -+ bp->descr_block_virt->rcv_data[entry].long_1 = -+ (u32)pci_map_single(bp->pci_dev, -+ newskb->data, -+ NEW_SKB_SIZE, -+ PCI_DMA_FROMDEVICE); - } else - skb = NULL; - } else -@@ -2934,7 +3052,7 @@ - * is contained in a single physically contiguous buffer - * in which the virtual address of the start of packet - * (skb->data) can be converted to a physical address -- * by using virt_to_bus(). -+ * by using pci_map_single(). - * - * Since the adapter architecture requires a three byte - * packet request header to prepend the start of packet, -@@ -3082,12 +3200,13 @@ - * skb->data. - * 6. The physical address of the start of packet - * can be determined from the virtual address -- * by using virt_to_bus() and is only 32-bits -+ * by using pci_map_single() and is only 32-bits - * wide. - */ - - p_xmt_descr->long_0 = (u32) (PI_XMT_DESCR_M_SOP | PI_XMT_DESCR_M_EOP | ((skb->len) << PI_XMT_DESCR_V_SEG_LEN)); -- p_xmt_descr->long_1 = (u32) virt_to_bus(skb->data); -+ p_xmt_descr->long_1 = (u32)pci_map_single(bp->pci_dev, skb->data, -+ skb->len, PCI_DMA_TODEVICE); - - /* - * Verify that descriptor is actually available -@@ -3171,6 +3290,7 @@ - { - XMT_DRIVER_DESCR *p_xmt_drv_descr; /* ptr to transmit driver descriptor */ - PI_TYPE_2_CONSUMER *p_type_2_cons; /* ptr to rcv/xmt consumer block register */ -+ u8 comp; /* local transmit completion index */ - int freed = 0; /* buffers freed */ - - /* Service all consumed transmit frames */ -@@ -3188,7 +3308,11 @@ - bp->xmt_total_bytes += p_xmt_drv_descr->p_skb->len; - - /* Return skb to operating system */ -- -+ comp = bp->rcv_xmt_reg.index.xmt_comp; -+ pci_unmap_single(bp->pci_dev, -+ bp->descr_block_virt->xmt_data[comp].long_1, -+ p_xmt_drv_descr->p_skb->len, -+ PCI_DMA_TODEVICE); - dev_kfree_skb_irq(p_xmt_drv_descr->p_skb); - - /* -@@ -3297,6 +3421,7 @@ - { - u32 prod_cons; /* rcv/xmt consumer block longword */ - XMT_DRIVER_DESCR *p_xmt_drv_descr; /* ptr to transmit driver descriptor */ -+ u8 comp; /* local transmit completion index */ - - /* Flush all outstanding transmit frames */ - -@@ -3307,7 +3432,11 @@ - p_xmt_drv_descr = &(bp->xmt_drv_descr_blk[bp->rcv_xmt_reg.index.xmt_comp]); - - /* Return skb to operating system */ -- -+ comp = bp->rcv_xmt_reg.index.xmt_comp; -+ pci_unmap_single(bp->pci_dev, -+ bp->descr_block_virt->xmt_data[comp].long_1, -+ p_xmt_drv_descr->p_skb->len, -+ PCI_DMA_TODEVICE); - dev_kfree_skb(p_xmt_drv_descr->p_skb); - - /* Increment transmit error counter */ -@@ -3337,12 +3466,36 @@ - - static void __devexit dfx_remove_one_pci_or_eisa(struct pci_dev *pdev, struct net_device *dev) - { -- DFX_board_t *bp = dev->priv; -+ DFX_board_t *bp = dev->priv; -+ unsigned long len; /* resource length */ -+ int alloc_size; /* total buffer size used */ - -+ if (bp->bus_type == DFX_BUS_TYPE_TC) { -+ /* TURBOchannel board */ -+ len = PI_TC_K_CSR_LEN; -+ } else if (bp->bus_type == DFX_BUS_TYPE_EISA) { -+ /* EISA board */ -+ len = PI_ESIC_K_CSR_IO_LEN; -+ } else { -+ len = PFI_K_CSR_IO_LEN; -+ } - unregister_netdev(dev); -- release_region(dev->base_addr, pdev ? PFI_K_CSR_IO_LEN : PI_ESIC_K_CSR_IO_LEN ); -- if (bp->kmalloced) kfree(bp->kmalloced); -- kfree(dev); -+ release_region(dev->base_addr, len); -+ -+ if (bp->bus_type == DFX_BUS_TYPE_TC) -+ release_tc_card(bp->slot); -+ -+ alloc_size = sizeof(PI_DESCR_BLOCK) + -+ PI_CMD_REQ_K_SIZE_MAX + PI_CMD_RSP_K_SIZE_MAX + -+#ifndef DYNAMIC_BUFFERS -+ (bp->rcv_bufs_to_post * PI_RCV_DATA_K_SIZE_MAX) + -+#endif -+ sizeof(PI_CONSUMER_BLOCK) + -+ (PI_ALIGN_K_DESC_BLK - 1); -+ if (bp->kmalloced) -+ pci_free_consistent(pdev, alloc_size, bp->kmalloced, -+ bp->kmalloced_dma); -+ free_netdev(dev); - } - - static void __devexit dfx_remove_one (struct pci_dev *pdev) -@@ -3353,21 +3506,22 @@ - pci_set_drvdata(pdev, NULL); - } - --static struct pci_device_id dfx_pci_tbl[] __devinitdata = { -+static struct pci_device_id dfx_pci_tbl[] = { - { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_FDDI, PCI_ANY_ID, PCI_ANY_ID, }, - { 0, } - }; - MODULE_DEVICE_TABLE(pci, dfx_pci_tbl); - - static struct pci_driver dfx_driver = { -- name: "defxx", -- probe: dfx_init_one, -- remove: __devexit_p(dfx_remove_one), -- id_table: dfx_pci_tbl, -+ .name = "defxx", -+ .probe = dfx_init_one, -+ .remove = __devexit_p(dfx_remove_one), -+ .id_table = dfx_pci_tbl, - }; - - static int dfx_have_pci; - static int dfx_have_eisa; -+static int dfx_have_tc; - - - static void __exit dfx_eisa_cleanup(void) -@@ -3388,12 +3542,7 @@ - - static int __init dfx_init(void) - { -- int rc_pci, rc_eisa; -- --/* when a module, this is printed whether or not devices are found in probe */ --#ifdef MODULE -- printk(version); --#endif -+ int rc_pci, rc_eisa, rc_tc; - - rc_pci = pci_module_init(&dfx_driver); - if (rc_pci >= 0) dfx_have_pci = 1; -@@ -3401,20 +3550,27 @@ - rc_eisa = dfx_eisa_init(); - if (rc_eisa >= 0) dfx_have_eisa = 1; - -- return ((rc_eisa < 0) ? 0 : rc_eisa) + ((rc_pci < 0) ? 0 : rc_pci); -+ rc_tc = dfx_tc_init(); -+ if (rc_tc >= 0) dfx_have_tc = 1; -+ -+ return ((rc_tc < 0) ? 0 : rc_tc) + -+ ((rc_eisa < 0) ? 0 : rc_eisa) + -+ ((rc_pci < 0) ? 0 : rc_pci); - } - - static void __exit dfx_cleanup(void) - { - if (dfx_have_pci) - pci_unregister_driver(&dfx_driver); -- if (dfx_have_eisa) -+ if (dfx_have_eisa || dfx_have_tc) - dfx_eisa_cleanup(); -- - } - - module_init(dfx_init); - module_exit(dfx_cleanup); -+MODULE_AUTHOR("Lawrence V. Stefani"); -+MODULE_DESCRIPTION("DEC FDDIcontroller EISA/PCI (DEFEA/DEFPA) driver " -+ DRV_VERSION " " DRV_RELDATE); - MODULE_LICENSE("GPL"); - - -diff -Nur linux-2.4.30/drivers/net/defxx.h linux-2.4.30-mips/drivers/net/defxx.h ---- linux-2.4.30/drivers/net/defxx.h 2001-02-13 22:15:05.000000000 +0100 -+++ linux-2.4.30-mips/drivers/net/defxx.h 2004-10-03 20:06:48.000000000 +0200 -@@ -12,17 +12,11 @@ - * Contains all definitions specified by port specification and required - * by the defxx.c driver. - * -- * Maintainers: -- * LVS Lawrence V. Stefani -- * -- * Contact: -- * The author may be reached at: -+ * The original author: -+ * LVS Lawrence V. Stefani - * -- * Inet: stefani@lkg.dec.com -- * Mail: Digital Equipment Corporation -- * 550 King Street -- * M/S: LKG1-3/M07 -- * Littleton, MA 01460 -+ * Maintainers: -+ * macro Maciej W. Rozycki - * - * Modification History: - * Date Name Description -@@ -30,6 +24,7 @@ - * 09-Sep-96 LVS Added group_prom field. Moved read/write I/O - * macros to DEFXX.C. - * 12-Sep-96 LVS Removed packet request header pointers. -+ * 04 Aug 2003 macro Converted to the DMA API. - */ - - #ifndef _DEFXX_H_ -@@ -1467,6 +1462,11 @@ - - #endif /* #ifndef BIG_ENDIAN */ - -+/* Define TC PDQ CSR offset and length */ -+ -+#define PI_TC_K_CSR_OFFSET 0x100000 -+#define PI_TC_K_CSR_LEN 0x80 /* 128 bytes */ -+ - /* Define EISA controller register offsets */ - - #define PI_ESIC_K_BURST_HOLDOFF 0x040 -@@ -1634,6 +1634,7 @@ - - #define DFX_BUS_TYPE_PCI 0 /* type code for DEC FDDIcontroller/PCI */ - #define DFX_BUS_TYPE_EISA 1 /* type code for DEC FDDIcontroller/EISA */ -+#define DFX_BUS_TYPE_TC 2 /* type code for DEC FDDIcontroller/TURBOchannel */ - - #define DFX_FC_PRH2_PRH1_PRH0 0x54003820 /* Packet Request Header bytes + FC */ - #define DFX_PRH0_BYTE 0x20 /* Packet Request Header byte 0 */ -@@ -1704,17 +1705,19 @@ - { - /* Keep virtual and physical pointers to locked, physically contiguous memory */ - -- char *kmalloced; /* kfree this on unload */ -+ char *kmalloced; /* pci_free_consistent this on unload */ -+ dma_addr_t kmalloced_dma; -+ /* DMA handle for the above */ - PI_DESCR_BLOCK *descr_block_virt; /* PDQ descriptor block virt address */ -- u32 descr_block_phys; /* PDQ descriptor block phys address */ -+ dma_addr_t descr_block_phys; /* PDQ descriptor block phys address */ - PI_DMA_CMD_REQ *cmd_req_virt; /* Command request buffer virt address */ -- u32 cmd_req_phys; /* Command request buffer phys address */ -+ dma_addr_t cmd_req_phys; /* Command request buffer phys address */ - PI_DMA_CMD_RSP *cmd_rsp_virt; /* Command response buffer virt address */ -- u32 cmd_rsp_phys; /* Command response buffer phys address */ -+ dma_addr_t cmd_rsp_phys; /* Command response buffer phys address */ - char *rcv_block_virt; /* LLC host receive queue buf blk virt */ -- u32 rcv_block_phys; /* LLC host receive queue buf blk phys */ -+ dma_addr_t rcv_block_phys; /* LLC host receive queue buf blk phys */ - PI_CONSUMER_BLOCK *cons_block_virt; /* PDQ consumer block virt address */ -- u32 cons_block_phys; /* PDQ consumer block phys address */ -+ dma_addr_t cons_block_phys; /* PDQ consumer block phys address */ - - /* Keep local copies of Type 1 and Type 2 register data */ - -@@ -1758,8 +1761,9 @@ - - struct net_device *dev; /* pointer to device structure */ - struct net_device *next; -- u32 bus_type; /* bus type (0 == PCI, 1 == EISA) */ -- u16 base_addr; /* base I/O address (same as dev->base_addr) */ -+ u32 bus_type; /* bus type (0 == PCI, 1 == EISA, 2 == TC) */ -+ long base_addr; /* base I/O address (same as dev->base_addr) */ -+ int slot; /* TC slot number */ - struct pci_dev * pci_dev; - u32 full_duplex_enb; /* FDDI Full Duplex enable (1 == on, 2 == off) */ - u32 req_ttrt; /* requested TTRT value (in 80ns units) */ -diff -Nur linux-2.4.30/drivers/net/hamradio/hdlcdrv.c linux-2.4.30-mips/drivers/net/hamradio/hdlcdrv.c ---- linux-2.4.30/drivers/net/hamradio/hdlcdrv.c 2002-02-25 20:37:59.000000000 +0100 -+++ linux-2.4.30-mips/drivers/net/hamradio/hdlcdrv.c 2004-05-04 14:04:27.000000000 +0200 -@@ -587,6 +587,8 @@ - return -EINVAL; - s = (struct hdlcdrv_state *)dev->priv; - -+ netif_stop_queue(dev); -+ - if (s->ops && s->ops->close) - i = s->ops->close(dev); - if (s->skb) -diff -Nur linux-2.4.30/drivers/net/irda/au1k_ir.c linux-2.4.30-mips/drivers/net/irda/au1k_ir.c ---- linux-2.4.30/drivers/net/irda/au1k_ir.c 2004-02-18 14:36:31.000000000 +0100 -+++ linux-2.4.30-mips/drivers/net/irda/au1k_ir.c 2005-02-03 07:35:29.000000000 +0100 -@@ -81,10 +81,6 @@ - - #define RUN_AT(x) (jiffies + (x)) - --#if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100) --static BCSR * const bcsr = (BCSR *)0xAE000000; --#endif -- - static spinlock_t ir_lock = SPIN_LOCK_UNLOCKED; - - /* -diff -Nur linux-2.4.30/drivers/pci/pci.c linux-2.4.30-mips/drivers/pci/pci.c ---- linux-2.4.30/drivers/pci/pci.c 2004-11-17 12:54:21.000000000 +0100 -+++ linux-2.4.30-mips/drivers/pci/pci.c 2004-11-19 01:28:41.000000000 +0100 -@@ -1281,11 +1281,17 @@ - { - unsigned int buses; - unsigned short cr; -+ unsigned short bctl; - struct pci_bus *child; - int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS); - - pci_read_config_dword(dev, PCI_PRIMARY_BUS, &buses); - DBG("Scanning behind PCI bridge %s, config %06x, pass %d\n", dev->slot_name, buses & 0xffffff, pass); -+ /* Disable MasterAbortMode during probing to avoid reporting -+ of bus errors (in some architectures) */ -+ pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &bctl); -+ pci_write_config_word(dev, PCI_BRIDGE_CONTROL, -+ bctl & ~PCI_BRIDGE_CTL_MASTER_ABORT); - if ((buses & 0xffff00) && !pcibios_assign_all_busses()) { - /* - * Bus already configured by firmware, process it in the first -@@ -1351,6 +1357,7 @@ - pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max); - pci_write_config_word(dev, PCI_COMMAND, cr); - } -+ pci_write_config_word(dev, PCI_BRIDGE_CONTROL, bctl); - sprintf(child->name, (is_cardbus ? "PCI CardBus #%02x" : "PCI Bus #%02x"), child->number); - return max; - } -diff -Nur linux-2.4.30/drivers/pcmcia/Config.in linux-2.4.30-mips/drivers/pcmcia/Config.in ---- linux-2.4.30/drivers/pcmcia/Config.in 2004-02-18 14:36:31.000000000 +0100 -+++ linux-2.4.30-mips/drivers/pcmcia/Config.in 2004-02-22 06:21:34.000000000 +0100 -@@ -30,16 +30,14 @@ - dep_tristate ' M8xx support' CONFIG_PCMCIA_M8XX $CONFIG_PCMCIA - fi - if [ "$CONFIG_SOC_AU1X00" = "y" ]; then -- dep_tristate ' Au1x00 PCMCIA support' CONFIG_PCMCIA_AU1X00 $CONFIG_PCMCIA -- if [ "$CONFIG_PCMCIA_AU1X00" != "n" ]; then -- bool ' Pb1x00 board support' CONFIG_PCMCIA_PB1X00 -- bool ' Db1x00 board support' CONFIG_PCMCIA_DB1X00 -- bool ' XXS1500 board support' CONFIG_PCMCIA_XXS1500 -- fi -+ dep_tristate ' Au1x00 PCMCIA support' CONFIG_PCMCIA_AU1X00 $CONFIG_PCMCIA - fi - if [ "$CONFIG_SIBYTE_SB1xxx_SOC" = "y" ]; then - dep_bool ' SiByte PCMCIA support' CONFIG_PCMCIA_SIBYTE $CONFIG_PCMCIA $CONFIG_BLK_DEV_IDE_SIBYTE - fi -+ if [ "$CONFIG_VRC4171" = "y" -o "$CONFIG_VRC4171" = "m" ]; then -+ dep_tristate ' NEC VRC4171 Card Controllers support' CONFIG_PCMCIA_VRC4171 $CONFIG_PCMCIA -+ fi - if [ "$CONFIG_VRC4173" = "y" -o "$CONFIG_VRC4173" = "m" ]; then - dep_tristate ' NEC VRC4173 CARDU support' CONFIG_PCMCIA_VRC4173 $CONFIG_PCMCIA - fi -diff -Nur linux-2.4.30/drivers/pcmcia/Makefile linux-2.4.30-mips/drivers/pcmcia/Makefile ---- linux-2.4.30/drivers/pcmcia/Makefile 2004-02-18 14:36:31.000000000 +0100 -+++ linux-2.4.30-mips/drivers/pcmcia/Makefile 2005-02-03 07:35:30.000000000 +0100 -@@ -61,9 +61,18 @@ - - obj-$(CONFIG_PCMCIA_AU1X00) += au1x00_ss.o - au1000_ss-objs-y := au1000_generic.o --au1000_ss-objs-$(CONFIG_PCMCIA_PB1X00) += au1000_pb1x00.o --au1000_ss-objs-$(CONFIG_PCMCIA_DB1X00) += au1000_db1x00.o --au1000_ss-objs-$(CONFIG_PCMCIA_XXS1500) += au1000_xxs1500.o -+au1000_ss-objs-$(CONFIG_MIPS_PB1000) += au1000_pb1x00.o -+au1000_ss-objs-$(CONFIG_MIPS_PB1100) += au1000_pb1x00.o -+au1000_ss-objs-$(CONFIG_MIPS_PB1500) += au1000_pb1x00.o -+au1000_ss-objs-$(CONFIG_MIPS_PB1550) += au1000_pb1550.o -+au1000_ss-objs-$(CONFIG_MIPS_PB1200) += au1000_db1x00.o -+au1000_ss-objs-$(CONFIG_MIPS_DB1000) += au1000_db1x00.o -+au1000_ss-objs-$(CONFIG_MIPS_DB1100) += au1000_db1x00.o -+au1000_ss-objs-$(CONFIG_MIPS_DB1500) += au1000_db1x00.o -+au1000_ss-objs-$(CONFIG_MIPS_DB1550) += au1000_db1x00.o -+au1000_ss-objs-$(CONFIG_MIPS_DB1200) += au1000_db1x00.o -+au1000_ss-objs-$(CONFIG_MIPS_HYDROGEN3) += au1000_hydrogen3.o -+au1000_ss-objs-$(CONFIG_MIPS_XXS1500) += au1000_xxs1500.o - - obj-$(CONFIG_PCMCIA_SA1100) += sa1100_cs.o - obj-$(CONFIG_PCMCIA_M8XX) += m8xx_pcmcia.o -@@ -89,6 +98,7 @@ - sa1100_cs-objs-$(CONFIG_SA1100_XP860) += sa1100_xp860.o sa1111_generic.o - sa1100_cs-objs-$(CONFIG_SA1100_YOPY) += sa1100_yopy.o - -+obj-$(CONFIG_PCMCIA_VRC4171) += vrc4171_card.o - obj-$(CONFIG_PCMCIA_VRC4173) += vrc4173_cardu.o - - include $(TOPDIR)/Rules.make -diff -Nur linux-2.4.30/drivers/pcmcia/au1000_db1x00.c linux-2.4.30-mips/drivers/pcmcia/au1000_db1x00.c ---- linux-2.4.30/drivers/pcmcia/au1000_db1x00.c 2005-01-19 15:09:57.000000000 +0100 -+++ linux-2.4.30-mips/drivers/pcmcia/au1000_db1x00.c 2005-02-03 07:35:30.000000000 +0100 -@@ -1,6 +1,6 @@ - /* - * -- * Alchemy Semi Db1x00 boards specific pcmcia routines. -+ * AMD Alchemy DUAL-SLOT Db1x00 boards' specific pcmcia routines. - * - * Copyright 2002 MontaVista Software Inc. - * Author: MontaVista Software, Inc. -@@ -54,9 +54,20 @@ - #include - #include - -+#if defined(CONFIG_MIPS_PB1200) -+#include -+#elif defined(CONFIG_MIPS_DB1200) -+#include -+#else - #include -+#endif - --static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR; -+#define PCMCIA_MAX_SOCK 1 -+#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1) -+ -+/* VPP/VCC */ -+#define SET_VCC_VPP(VCC, VPP, SLOT)\ -+ ((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8)) - - static int db1x00_pcmcia_init(struct pcmcia_init *init) - { -@@ -76,7 +87,7 @@ - db1x00_pcmcia_socket_state(unsigned sock, struct pcmcia_state *state) - { - u32 inserted; -- unsigned char vs; -+ u16 vs; - - if(sock > PCMCIA_MAX_SOCK) return -1; - -@@ -87,11 +98,11 @@ - - if (sock == 0) { - vs = bcsr->status & 0x3; -- inserted = !(bcsr->status & (1<<4)); -+ inserted = BOARD_CARD_INSERTED(0); - } - else { - vs = (bcsr->status & 0xC)>>2; -- inserted = !(bcsr->status & (1<<5)); -+ inserted = BOARD_CARD_INSERTED(1); - } - - DEBUG(KERN_DEBUG "db1x00 socket %d: inserted %d, vs %d\n", -@@ -144,16 +155,9 @@ - if(info->sock > PCMCIA_MAX_SOCK) return -1; - - if(info->sock == 0) --#ifdef CONFIG_MIPS_DB1550 -- info->irq = AU1000_GPIO_3; -+ info->irq = BOARD_PC0_INT; - else -- info->irq = AU1000_GPIO_5; --#else -- info->irq = AU1000_GPIO_2; -- else -- info->irq = AU1000_GPIO_5; --#endif -- -+ info->irq = BOARD_PC1_INT; - return 0; - } - -diff -Nur linux-2.4.30/drivers/pcmcia/vrc4171_card.c linux-2.4.30-mips/drivers/pcmcia/vrc4171_card.c ---- linux-2.4.30/drivers/pcmcia/vrc4171_card.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/drivers/pcmcia/vrc4171_card.c 2004-01-19 16:54:58.000000000 +0100 -@@ -0,0 +1,886 @@ -+/* -+ * vrc4171_card.c, NEC VRC4171 Card Controller driver for Socket Services. -+ * -+ * Copyright (C) 2003 Yoichi Yuasa -+ * -+ * 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 "i82365.h" -+ -+MODULE_DESCRIPTION("NEC VRC4171 Card Controllers driver for Socket Services"); -+MODULE_AUTHOR("Yoichi Yuasa "); -+MODULE_LICENSE("GPL"); -+ -+#define CARD_MAX_SLOTS 2 -+#define CARD_SLOTA 0 -+#define CARD_SLOTB 1 -+#define CARD_SLOTB_OFFSET 0x40 -+ -+#define CARD_MEM_START 0x10000000 -+#define CARD_MEM_END 0x13ffffff -+#define CARD_MAX_MEM_OFFSET 0x3ffffff -+#define CARD_MAX_MEM_SPEED 1000 -+ -+#define CARD_CONTROLLER_INDEX 0x03e0 -+#define CARD_CONTROLLER_DATA 0x03e1 -+#define CARD_CONTROLLER_SIZE 2 -+ /* Power register */ -+ #define VPP_GET_VCC 0x01 -+ #define POWER_ENABLE 0x10 -+ #define CARD_VOLTAGE_SENSE 0x1f -+ #define VCC_3VORXV_CAPABLE 0x00 -+ #define VCC_XV_ONLY 0x01 -+ #define VCC_3V_CAPABLE 0x02 -+ #define VCC_5V_ONLY 0x03 -+ #define CARD_VOLTAGE_SELECT 0x2f -+ #define VCC_3V 0x01 -+ #define VCC_5V 0x00 -+ #define VCC_XV 0x02 -+ #define VCC_STATUS_3V 0x02 -+ #define VCC_STATUS_5V 0x01 -+ #define VCC_STATUS_XV 0x03 -+ #define GLOBAL_CONTROL 0x1e -+ #define EXWRBK 0x04 -+ #define IRQPM_EN 0x08 -+ #define CLRPMIRQ 0x10 -+ -+#define IO_MAX_MAPS 2 -+#define MEM_MAX_MAPS 5 -+ -+enum { -+ SLOTB_PROBE = 0, -+ SLOTB_NOPROBE_IO, -+ SLOTB_NOPROBE_MEM, -+ SLOTB_NOPROBE_ALL -+}; -+ -+typedef struct vrc4171_socket { -+ int noprobe; -+ void (*handler)(void *, unsigned int); -+ void *info; -+ socket_cap_t cap; -+ spinlock_t event_lock; -+ uint16_t events; -+ struct socket_info_t *pcmcia_socket; -+ struct tq_struct tq_task; -+ char name[24]; -+ int csc_irq; -+ int io_irq; -+} vrc4171_socket_t; -+ -+static vrc4171_socket_t vrc4171_sockets[CARD_MAX_SLOTS]; -+static int vrc4171_slotb = SLOTB_IS_NONE; -+static unsigned int vrc4171_irq; -+static uint16_t vrc4171_irq_mask = 0xdeb8; -+ -+extern struct socket_info_t *pcmcia_register_socket(int slot, -+ struct pccard_operations *vtable, -+ int use_bus_pm); -+extern void pcmcia_unregister_socket(struct socket_info_t *s); -+ -+static inline uint8_t exca_read_byte(int slot, uint8_t index) -+{ -+ if (slot == CARD_SLOTB) -+ index += CARD_SLOTB_OFFSET; -+ -+ outb(index, CARD_CONTROLLER_INDEX); -+ return inb(CARD_CONTROLLER_DATA); -+} -+ -+static inline uint16_t exca_read_word(int slot, uint8_t index) -+{ -+ uint16_t data; -+ -+ if (slot == CARD_SLOTB) -+ index += CARD_SLOTB_OFFSET; -+ -+ outb(index++, CARD_CONTROLLER_INDEX); -+ data = inb(CARD_CONTROLLER_DATA); -+ -+ outb(index, CARD_CONTROLLER_INDEX); -+ data |= ((uint16_t)inb(CARD_CONTROLLER_DATA)) << 8; -+ -+ return data; -+} -+ -+static inline uint8_t exca_write_byte(int slot, uint8_t index, uint8_t data) -+{ -+ if (slot == CARD_SLOTB) -+ index += CARD_SLOTB_OFFSET; -+ -+ outb(index, CARD_CONTROLLER_INDEX); -+ outb(data, CARD_CONTROLLER_DATA); -+ -+ return data; -+} -+ -+static inline uint16_t exca_write_word(int slot, uint8_t index, uint16_t data) -+{ -+ if (slot == CARD_SLOTB) -+ index += CARD_SLOTB_OFFSET; -+ -+ outb(index++, CARD_CONTROLLER_INDEX); -+ outb(data, CARD_CONTROLLER_DATA); -+ -+ outb(index, CARD_CONTROLLER_INDEX); -+ outb((uint8_t)(data >> 8), CARD_CONTROLLER_DATA); -+ -+ return data; -+} -+ -+static inline int search_nonuse_irq(void) -+{ -+ int i; -+ -+ for (i = 0; i < 16; i++) { -+ if (vrc4171_irq_mask & (1 << i)) { -+ vrc4171_irq_mask &= ~(1 << i); -+ return i; -+ } -+ } -+ -+ return -1; -+} -+ -+static int pccard_init(unsigned int slot) -+{ -+ vrc4171_socket_t *socket = &vrc4171_sockets[slot]; -+ -+ socket->cap.features |= SS_CAP_PCCARD | SS_CAP_PAGE_REGS; -+ socket->cap.irq_mask = 0; -+ socket->cap.pci_irq = vrc4171_irq; -+ socket->cap.map_size = 0x1000; -+ socket->events = 0; -+ spin_lock_init(socket->event_lock); -+ socket->csc_irq = search_nonuse_irq(); -+ socket->io_irq = search_nonuse_irq(); -+ -+ return 0; -+} -+ -+static int pccard_suspend(unsigned int slot) -+{ -+ return -EINVAL; -+} -+ -+static int pccard_register_callback(unsigned int slot, -+ void (*handler)(void *, unsigned int), -+ void *info) -+{ -+ vrc4171_socket_t *socket; -+ -+ if (slot >= CARD_MAX_SLOTS) -+ return -EINVAL; -+ -+ socket = &vrc4171_sockets[slot]; -+ -+ socket->handler = handler; -+ socket->info = info; -+ -+ if (handler) -+ MOD_INC_USE_COUNT; -+ else -+ MOD_DEC_USE_COUNT; -+ -+ return 0; -+} -+ -+static int pccard_inquire_socket(unsigned int slot, socket_cap_t *cap) -+{ -+ vrc4171_socket_t *socket; -+ -+ if (slot >= CARD_MAX_SLOTS || cap == NULL) -+ return -EINVAL; -+ -+ socket = &vrc4171_sockets[slot]; -+ -+ *cap = socket->cap; -+ -+ return 0; -+} -+ -+static int pccard_get_status(unsigned int slot, u_int *value) -+{ -+ uint8_t status, sense; -+ u_int val = 0; -+ -+ if (slot >= CARD_MAX_SLOTS || value == NULL) -+ return -EINVAL; -+ -+ status = exca_read_byte(slot, I365_STATUS); -+ if (exca_read_byte(slot, I365_INTCTL) & I365_PC_IOCARD) { -+ if (status & I365_CS_STSCHG) -+ val |= SS_STSCHG; -+ } else { -+ if (!(status & I365_CS_BVD1)) -+ val |= SS_BATDEAD; -+ else if ((status & (I365_CS_BVD1 | I365_CS_BVD2)) == I365_CS_BVD1) -+ val |= SS_BATWARN; -+ } -+ if ((status & I365_CS_DETECT) == I365_CS_DETECT) -+ val |= SS_DETECT; -+ if (status & I365_CS_WRPROT) -+ val |= SS_WRPROT; -+ if (status & I365_CS_READY) -+ val |= SS_READY; -+ if (status & I365_CS_POWERON) -+ val |= SS_POWERON; -+ -+ sense = exca_read_byte(slot, CARD_VOLTAGE_SENSE); -+ switch (sense) { -+ case VCC_3VORXV_CAPABLE: -+ val |= SS_3VCARD | SS_XVCARD; -+ break; -+ case VCC_XV_ONLY: -+ val |= SS_XVCARD; -+ break; -+ case VCC_3V_CAPABLE: -+ val |= SS_3VCARD; -+ break; -+ default: -+ /* 5V only */ -+ break; -+ } -+ -+ *value = val; -+ -+ return 0; -+} -+ -+static inline u_char get_Vcc_value(uint8_t voltage) -+{ -+ switch (voltage) { -+ case VCC_STATUS_3V: -+ return 33; -+ case VCC_STATUS_5V: -+ return 50; -+ default: -+ break; -+ } -+ -+ return 0; -+} -+ -+static inline u_char get_Vpp_value(uint8_t power, u_char Vcc) -+{ -+ if ((power & 0x03) == 0x01 || (power & 0x03) == 0x02) -+ return Vcc; -+ -+ return 0; -+} -+ -+static int pccard_get_socket(unsigned int slot, socket_state_t *state) -+{ -+ vrc4171_socket_t *socket; -+ uint8_t power, voltage, control, cscint; -+ -+ if (slot >= CARD_MAX_SLOTS || state == NULL) -+ return -EINVAL; -+ -+ socket = &vrc4171_sockets[slot]; -+ -+ power = exca_read_byte(slot, I365_POWER); -+ voltage = exca_read_byte(slot, CARD_VOLTAGE_SELECT); -+ -+ state->Vcc = get_Vcc_value(voltage); -+ state->Vpp = get_Vpp_value(power, state->Vcc); -+ -+ state->flags = 0; -+ if (power & POWER_ENABLE) -+ state->flags |= SS_PWR_AUTO; -+ if (power & I365_PWR_OUT) -+ state->flags |= SS_OUTPUT_ENA; -+ -+ control = exca_read_byte(slot, I365_INTCTL); -+ if (control & I365_PC_IOCARD) -+ state->flags |= SS_IOCARD; -+ if (!(control & I365_PC_RESET)) -+ state->flags |= SS_RESET; -+ -+ cscint = exca_read_byte(slot, I365_CSCINT); -+ state->csc_mask = 0; -+ if (state->flags & SS_IOCARD) { -+ if (cscint & I365_CSC_STSCHG) -+ state->flags |= SS_STSCHG; -+ } else { -+ if (cscint & I365_CSC_BVD1) -+ state->csc_mask |= SS_BATDEAD; -+ if (cscint & I365_CSC_BVD2) -+ state->csc_mask |= SS_BATWARN; -+ } -+ if (cscint & I365_CSC_READY) -+ state->csc_mask |= SS_READY; -+ if (cscint & I365_CSC_DETECT) -+ state->csc_mask |= SS_DETECT; -+ -+ return 0; -+} -+ -+static inline uint8_t set_Vcc_value(u_char Vcc) -+{ -+ switch (Vcc) { -+ case 33: -+ return VCC_3V; -+ case 50: -+ return VCC_5V; -+ } -+ -+ /* Small voltage is chosen for safety. */ -+ return VCC_3V; -+} -+ -+static int pccard_set_socket(unsigned int slot, socket_state_t *state) -+{ -+ vrc4171_socket_t *socket; -+ uint8_t voltage, power, control, cscint; -+ -+ if (slot >= CARD_MAX_SLOTS || -+ (state->Vpp != state->Vcc && state->Vpp != 0) || -+ (state->Vcc != 50 && state->Vcc != 33 && state->Vcc != 0)) -+ return -EINVAL; -+ -+ socket = &vrc4171_sockets[slot]; -+ -+ spin_lock_irq(&socket->event_lock); -+ -+ voltage = set_Vcc_value(state->Vcc); -+ exca_write_byte(slot, CARD_VOLTAGE_SELECT, voltage); -+ -+ power = POWER_ENABLE; -+ if (state->Vpp == state->Vcc) -+ power |= VPP_GET_VCC; -+ if (state->flags & SS_OUTPUT_ENA) -+ power |= I365_PWR_OUT; -+ exca_write_byte(slot, I365_POWER, power); -+ -+ control = 0; -+ if (state->io_irq != 0) -+ control |= socket->io_irq; -+ if (state->flags & SS_IOCARD) -+ control |= I365_PC_IOCARD; -+ if (state->flags & SS_RESET) -+ control &= ~I365_PC_RESET; -+ else -+ control |= I365_PC_RESET; -+ exca_write_byte(slot, I365_INTCTL, control); -+ -+ cscint = 0; -+ exca_write_byte(slot, I365_CSCINT, cscint); -+ exca_read_byte(slot, I365_CSC); /* clear CardStatus change */ -+ if (state->csc_mask != 0) -+ cscint |= socket->csc_irq << 8; -+ if (state->flags & SS_IOCARD) { -+ if (state->csc_mask & SS_STSCHG) -+ cscint |= I365_CSC_STSCHG; -+ } else { -+ if (state->csc_mask & SS_BATDEAD) -+ cscint |= I365_CSC_BVD1; -+ if (state->csc_mask & SS_BATWARN) -+ cscint |= I365_CSC_BVD2; -+ } -+ if (state->csc_mask & SS_READY) -+ cscint |= I365_CSC_READY; -+ if (state->csc_mask & SS_DETECT) -+ cscint |= I365_CSC_DETECT; -+ exca_write_byte(slot, I365_CSCINT, cscint); -+ -+ spin_unlock_irq(&socket->event_lock); -+ -+ return 0; -+} -+ -+static int pccard_get_io_map(unsigned int slot, struct pccard_io_map *io) -+{ -+ vrc4171_socket_t *socket; -+ uint8_t ioctl, addrwin; -+ u_char map; -+ -+ if (slot >= CARD_MAX_SLOTS || io == NULL || -+ io->map >= IO_MAX_MAPS) -+ return -EINVAL; -+ -+ socket = &vrc4171_sockets[slot]; -+ map = io->map; -+ -+ io->start = exca_read_word(slot, I365_IO(map)+I365_W_START); -+ io->stop = exca_read_word(slot, I365_IO(map)+I365_W_STOP); -+ -+ ioctl = exca_read_byte(slot, I365_IOCTL); -+ if (io->flags & I365_IOCTL_WAIT(map)) -+ io->speed = 1; -+ else -+ io->speed = 0; -+ -+ io->flags = 0; -+ if (ioctl & I365_IOCTL_16BIT(map)) -+ io->flags |= MAP_16BIT; -+ if (ioctl & I365_IOCTL_IOCS16(map)) -+ io->flags |= MAP_AUTOSZ; -+ if (ioctl & I365_IOCTL_0WS(map)) -+ io->flags |= MAP_0WS; -+ -+ addrwin = exca_read_byte(slot, I365_ADDRWIN); -+ if (addrwin & I365_ENA_IO(map)) -+ io->flags |= MAP_ACTIVE; -+ -+ return 0; -+} -+ -+static int pccard_set_io_map(unsigned int slot, struct pccard_io_map *io) -+{ -+ vrc4171_socket_t *socket; -+ uint8_t ioctl, addrwin; -+ u_char map; -+ -+ if (slot >= CARD_MAX_SLOTS || -+ io == NULL || io->map >= IO_MAX_MAPS || -+ io->start > 0xffff || io->stop > 0xffff || io->start > io->stop) -+ return -EINVAL; -+ -+ socket = &vrc4171_sockets[slot]; -+ map = io->map; -+ -+ addrwin = exca_read_byte(slot, I365_ADDRWIN); -+ if (addrwin & I365_ENA_IO(map)) { -+ addrwin &= ~I365_ENA_IO(map); -+ exca_write_byte(slot, I365_ADDRWIN, addrwin); -+ } -+ -+ exca_write_word(slot, I365_IO(map)+I365_W_START, io->start); -+ exca_write_word(slot, I365_IO(map)+I365_W_STOP, io->stop); -+ -+ ioctl = 0; -+ if (io->speed > 0) -+ ioctl |= I365_IOCTL_WAIT(map); -+ if (io->flags & MAP_16BIT) -+ ioctl |= I365_IOCTL_16BIT(map); -+ if (io->flags & MAP_AUTOSZ) -+ ioctl |= I365_IOCTL_IOCS16(map); -+ if (io->flags & MAP_0WS) -+ ioctl |= I365_IOCTL_0WS(map); -+ exca_write_byte(slot, I365_IOCTL, ioctl); -+ -+ if (io->flags & MAP_ACTIVE) { -+ addrwin |= I365_ENA_IO(map); -+ exca_write_byte(slot, I365_ADDRWIN, addrwin); -+ } -+ -+ return 0; -+} -+ -+static int pccard_get_mem_map(unsigned int slot, struct pccard_mem_map *mem) -+{ -+ vrc4171_socket_t *socket; -+ uint8_t addrwin; -+ u_long start, stop; -+ u_int offset; -+ u_char map; -+ -+ if (slot >= CARD_MAX_SLOTS || mem == NULL || mem->map >= MEM_MAX_MAPS) -+ return -EINVAL; -+ -+ socket = &vrc4171_sockets[slot]; -+ map = mem->map; -+ -+ mem->flags = 0; -+ mem->speed = 0; -+ -+ addrwin = exca_read_byte(slot, I365_ADDRWIN); -+ if (addrwin & I365_ENA_MEM(map)) -+ mem->flags |= MAP_ACTIVE; -+ -+ start = exca_read_word(slot, I365_MEM(map)+I365_W_START); -+ if (start & I365_MEM_16BIT) -+ mem->flags |= MAP_16BIT; -+ mem->sys_start = (start & 0x3fffUL) << 12; -+ -+ stop = exca_read_word(slot, I365_MEM(map)+I365_W_STOP); -+ if (start & I365_MEM_WS0) -+ mem->speed += 1; -+ if (start & I365_MEM_WS1) -+ mem->speed += 2; -+ mem->sys_stop = ((stop & 0x3fffUL) << 12) + 0xfffUL; -+ -+ offset = exca_read_word(slot, I365_MEM(map)+I365_W_OFF); -+ if (offset & I365_MEM_REG) -+ mem->flags |= MAP_ATTRIB; -+ if (offset & I365_MEM_WRPROT) -+ mem->flags |= MAP_WRPROT; -+ mem->card_start = (offset & 0x3fffUL) << 12; -+ -+ mem->sys_start += CARD_MEM_START; -+ mem->sys_stop += CARD_MEM_START; -+ -+ return 0; -+} -+ -+static int pccard_set_mem_map(unsigned int slot, struct pccard_mem_map *mem) -+{ -+ vrc4171_socket_t *socket; -+ uint16_t start, stop, offset; -+ uint8_t addrwin; -+ u_char map; -+ -+ if (slot >= CARD_MAX_SLOTS || -+ mem == NULL || mem->map >= MEM_MAX_MAPS || -+ mem->sys_start < CARD_MEM_START || mem->sys_start > CARD_MEM_END || -+ mem->sys_stop < CARD_MEM_START || mem->sys_stop > CARD_MEM_END || -+ mem->sys_start > mem->sys_stop || -+ mem->card_start > CARD_MAX_MEM_OFFSET || -+ mem->speed > CARD_MAX_MEM_SPEED) -+ return -EINVAL; -+ -+ socket = &vrc4171_sockets[slot]; -+ map = mem->map; -+ -+ addrwin = exca_read_byte(slot, I365_ADDRWIN); -+ if (addrwin & I365_ENA_MEM(map)) { -+ addrwin &= ~I365_ENA_MEM(map); -+ exca_write_byte(slot, I365_ADDRWIN, addrwin); -+ } -+ -+ start = (mem->sys_start >> 12) & 0x3fff; -+ if (mem->flags & MAP_16BIT) -+ start |= I365_MEM_16BIT; -+ exca_write_word(slot, I365_MEM(map)+I365_W_START, start); -+ -+ stop = (mem->sys_stop >> 12) & 0x3fff; -+ switch (mem->speed) { -+ case 0: -+ break; -+ case 1: -+ stop |= I365_MEM_WS0; -+ break; -+ case 2: -+ stop |= I365_MEM_WS1; -+ break; -+ default: -+ stop |= I365_MEM_WS0 | I365_MEM_WS1; -+ break; -+ } -+ exca_write_word(slot, I365_MEM(map)+I365_W_STOP, stop); -+ -+ offset = (mem->card_start >> 12) & 0x3fff; -+ if (mem->flags & MAP_ATTRIB) -+ offset |= I365_MEM_REG; -+ if (mem->flags & MAP_WRPROT) -+ offset |= I365_MEM_WRPROT; -+ exca_write_word(slot, I365_MEM(map)+I365_W_OFF, offset); -+ -+ if (mem->flags & MAP_ACTIVE) { -+ addrwin |= I365_ENA_MEM(map); -+ exca_write_byte(slot, I365_ADDRWIN, addrwin); -+ } -+ -+ return 0; -+} -+ -+static void pccard_proc_setup(unsigned int slot, struct proc_dir_entry *base) -+{ -+} -+ -+static struct pccard_operations vrc4171_pccard_operations = { -+ .init = pccard_init, -+ .suspend = pccard_suspend, -+ .register_callback = pccard_register_callback, -+ .inquire_socket = pccard_inquire_socket, -+ .get_status = pccard_get_status, -+ .get_socket = pccard_get_socket, -+ .set_socket = pccard_set_socket, -+ .get_io_map = pccard_get_io_map, -+ .set_io_map = pccard_set_io_map, -+ .get_mem_map = pccard_get_mem_map, -+ .set_mem_map = pccard_set_mem_map, -+ .proc_setup = pccard_proc_setup, -+}; -+ -+static void pccard_bh(void *data) -+{ -+ vrc4171_socket_t *socket = (vrc4171_socket_t *)data; -+ uint16_t events; -+ -+ spin_lock_irq(&socket->event_lock); -+ events = socket->events; -+ socket->events = 0; -+ spin_unlock_irq(&socket->event_lock); -+ -+ if (socket->handler) -+ socket->handler(socket->info, events); -+} -+ -+static inline uint16_t get_events(int slot) -+{ -+ uint16_t events = 0; -+ uint8_t status, csc; -+ -+ status = exca_read_byte(slot, I365_STATUS); -+ csc = exca_read_byte(slot, I365_CSC); -+ -+ if (exca_read_byte(slot, I365_INTCTL) & I365_PC_IOCARD) { -+ if ((csc & I365_CSC_STSCHG) && (status & I365_CS_STSCHG)) -+ events |= SS_STSCHG; -+ } else { -+ if (csc & (I365_CSC_BVD1 | I365_CSC_BVD2)) { -+ if (!(status & I365_CS_BVD1)) -+ events |= SS_BATDEAD; -+ else if ((status & (I365_CS_BVD1 | I365_CS_BVD2)) == I365_CS_BVD1) -+ events |= SS_BATWARN; -+ } -+ } -+ if ((csc & I365_CSC_READY) && (status & I365_CS_READY)) -+ events |= SS_READY; -+ if ((csc & I365_CSC_DETECT) && ((status & I365_CS_DETECT) == I365_CS_DETECT)) -+ events |= SS_DETECT; -+ -+ return events; -+} -+ -+static void pccard_status_change(int slot, vrc4171_socket_t *socket) -+{ -+ uint16_t events; -+ -+ socket->tq_task.routine = pccard_bh; -+ socket->tq_task.data = socket; -+ -+ events = get_events(slot); -+ if (events) { -+ spin_lock(&socket->event_lock); -+ socket->events |= events; -+ spin_unlock(&socket->event_lock); -+ schedule_task(&socket->tq_task); -+ } -+} -+ -+static void pccard_interrupt(int irq, void *dev_id, struct pt_regs *regs) -+{ -+ vrc4171_socket_t *socket; -+ uint16_t status; -+ -+ status = vrc4171_get_irq_status(); -+ if (status & IRQ_A) { -+ socket = &vrc4171_sockets[CARD_SLOTA]; -+ if (socket->noprobe == SLOTB_PROBE) { -+ if (status & (1 << socket->csc_irq)) -+ pccard_status_change(CARD_SLOTA, socket); -+ } -+ } -+ -+ if (status & IRQ_B) { -+ socket = &vrc4171_sockets[CARD_SLOTB]; -+ if (socket->noprobe == SLOTB_PROBE) { -+ if (status & (1 << socket->csc_irq)) -+ pccard_status_change(CARD_SLOTB, socket); -+ } -+ } -+} -+ -+static inline void reserve_using_irq(int slot) -+{ -+ unsigned int irq; -+ -+ irq = exca_read_byte(slot, I365_INTCTL); -+ irq &= 0x0f; -+ vrc4171_irq_mask &= ~(1 << irq); -+ -+ irq = exca_read_byte(slot, I365_CSCINT); -+ irq = (irq & 0xf0) >> 4; -+ vrc4171_irq_mask &= ~(1 << irq); -+} -+ -+static int __devinit vrc4171_add_socket(int slot) -+{ -+ vrc4171_socket_t *socket; -+ -+ if (slot >= CARD_MAX_SLOTS) -+ return -EINVAL; -+ -+ socket = &vrc4171_sockets[slot]; -+ if (socket->noprobe != SLOTB_PROBE) { -+ uint8_t addrwin; -+ -+ switch (socket->noprobe) { -+ case SLOTB_NOPROBE_MEM: -+ addrwin = exca_read_byte(slot, I365_ADDRWIN); -+ addrwin &= 0x1f; -+ exca_write_byte(slot, I365_ADDRWIN, addrwin); -+ break; -+ case SLOTB_NOPROBE_IO: -+ addrwin = exca_read_byte(slot, I365_ADDRWIN); -+ addrwin &= 0xc0; -+ exca_write_byte(slot, I365_ADDRWIN, addrwin); -+ break; -+ default: -+ break; -+ } -+ -+ reserve_using_irq(slot); -+ -+ return 0; -+ } -+ -+ sprintf(socket->name, "NEC VRC4171 Card Slot %1c", 'A' + slot); -+ -+ socket->pcmcia_socket = pcmcia_register_socket(slot, &vrc4171_pccard_operations, 1); -+ if (socket->pcmcia_socket == NULL) -+ return -ENOMEM; -+ -+ exca_write_byte(slot, I365_ADDRWIN, 0); -+ -+ exca_write_byte(slot, GLOBAL_CONTROL, 0); -+ -+ return 0; -+} -+ -+static void vrc4171_remove_socket(int slot) -+{ -+ vrc4171_socket_t *socket; -+ -+ if (slot >= CARD_MAX_SLOTS) -+ return; -+ -+ socket = &vrc4171_sockets[slot]; -+ -+ if (socket->pcmcia_socket != NULL) { -+ pcmcia_unregister_socket(socket->pcmcia_socket); -+ socket->pcmcia_socket = NULL; -+ } -+} -+ -+static int __devinit vrc4171_card_setup(char *options) -+{ -+ if (options == NULL || *options == '\0') -+ return 0; -+ -+ if (strncmp(options, "irq:", 4) == 0) { -+ int irq; -+ options += 4; -+ irq = simple_strtoul(options, &options, 0); -+ if (irq >= 0 && irq < NR_IRQS) -+ vrc4171_irq = irq; -+ -+ if (*options != ',') -+ return 0; -+ options++; -+ } -+ -+ if (strncmp(options, "slota:", 6) == 0) { -+ options += 6; -+ if (*options != '\0') { -+ if (strncmp(options, "noprobe", 7) == 0) { -+ vrc4171_sockets[CARD_SLOTA].noprobe = 1; -+ options += 7; -+ } -+ -+ if (*options != ',') -+ return 0; -+ options++; -+ } else -+ return 0; -+ -+ } -+ -+ if (strncmp(options, "slotb:", 6) == 0) { -+ options += 6; -+ if (*options != '\0') { -+ if (strncmp(options, "pccard", 6) == 0) { -+ vrc4171_slotb = SLOTB_IS_PCCARD; -+ options += 6; -+ } else if (strncmp(options, "cf", 2) == 0) { -+ vrc4171_slotb = SLOTB_IS_CF; -+ options += 2; -+ } else if (strncmp(options, "flashrom", 8) == 0) { -+ vrc4171_slotb = SLOTB_IS_FLASHROM; -+ options += 8; -+ } else if (strncmp(options, "none", 4) == 0) { -+ vrc4171_slotb = SLOTB_IS_NONE; -+ options += 4; -+ } -+ -+ if (*options != ',') -+ return 0; -+ options++; -+ -+ if ( strncmp(options, "memnoprobe", 10) == 0) -+ vrc4171_sockets[CARD_SLOTB].noprobe = SLOTB_NOPROBE_MEM; -+ if ( strncmp(options, "ionoprobe", 9) == 0) -+ vrc4171_sockets[CARD_SLOTB].noprobe = SLOTB_NOPROBE_IO; -+ if ( strncmp(options, "noprobe", 7) == 0) -+ vrc4171_sockets[CARD_SLOTB].noprobe = SLOTB_NOPROBE_ALL; -+ } -+ } -+ -+ return 0; -+} -+ -+__setup("vrc4171_card=", vrc4171_card_setup); -+ -+static int __devinit vrc4171_card_init(void) -+{ -+ int retval, slot; -+ -+ vrc4171_set_multifunction_pin(vrc4171_slotb); -+ -+ if (request_region(CARD_CONTROLLER_INDEX, CARD_CONTROLLER_SIZE, -+ "NEC VRC4171 Card Controller") == NULL) -+ return -EBUSY; -+ -+ for (slot = 0; slot < CARD_MAX_SLOTS; slot++) { -+ if (slot == CARD_SLOTB && vrc4171_slotb == SLOTB_IS_NONE) -+ break; -+ -+ retval = vrc4171_add_socket(slot); -+ if (retval != 0) -+ return retval; -+ } -+ -+ retval = request_irq(vrc4171_irq, pccard_interrupt, SA_SHIRQ, -+ "NEC VRC4171 Card Controller", vrc4171_sockets); -+ if (retval < 0) { -+ for (slot = 0; slot < CARD_MAX_SLOTS; slot++) -+ vrc4171_remove_socket(slot); -+ -+ return retval; -+ } -+ -+ printk(KERN_INFO "NEC VRC4171 Card Controller, connected to IRQ %d\n", vrc4171_irq); -+ -+ return 0; -+} -+ -+static void __devexit vrc4171_card_exit(void) -+{ -+ int slot; -+ -+ for (slot = 0; slot < CARD_MAX_SLOTS; slot++) -+ vrc4171_remove_socket(slot); -+ -+ release_region(CARD_CONTROLLER_INDEX, CARD_CONTROLLER_SIZE); -+} -+ -+module_init(vrc4171_card_init); -+module_exit(vrc4171_card_exit); -diff -Nur linux-2.4.30/drivers/scsi/NCR53C9x.h linux-2.4.30-mips/drivers/scsi/NCR53C9x.h ---- linux-2.4.30/drivers/scsi/NCR53C9x.h 2004-02-18 14:36:31.000000000 +0100 -+++ linux-2.4.30-mips/drivers/scsi/NCR53C9x.h 2003-12-15 19:19:51.000000000 +0100 -@@ -144,12 +144,7 @@ - - #ifndef MULTIPLE_PAD_SIZES - --#ifdef CONFIG_CPU_HAS_WB --#include --#define esp_write(__reg, __val) do{(__reg) = (__val); wbflush();} while(0) --#else --#define esp_write(__reg, __val) ((__reg) = (__val)) --#endif -+#define esp_write(__reg, __val) do{(__reg) = (__val); iob();} while(0) - #define esp_read(__reg) (__reg) - - struct ESP_regs { -diff -Nur linux-2.4.30/drivers/sound/au1550_i2s.c linux-2.4.30-mips/drivers/sound/au1550_i2s.c ---- linux-2.4.30/drivers/sound/au1550_i2s.c 2005-01-19 15:10:04.000000000 +0100 -+++ linux-2.4.30-mips/drivers/sound/au1550_i2s.c 2005-02-08 08:07:50.000000000 +0100 -@@ -41,6 +41,7 @@ - * 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ -+ - #include - #include - #include -@@ -62,7 +63,45 @@ - #include - #include - #include -+ -+#if defined(CONFIG_SOC_AU1550) - #include -+#endif -+ -+#if defined(CONFIG_MIPS_PB1200) -+#define WM8731 -+#define WM_MODE_USB -+#include -+#endif -+ -+#if defined(CONFIG_MIPS_FICMMP) -+#define WM8721 -+#define WM_MODE_NORMAL -+#include -+#endif -+ -+ -+#define WM_VOLUME_MIN 47 -+#define WM_VOLUME_SCALE 80 -+ -+#if defined(WM8731) -+ /* OSS interface to the wm i2s.. */ -+ #define CODEC_NAME "Wolfson WM8731 I2S" -+ #define WM_I2S_STEREO_MASK (SOUND_MASK_PCM | SOUND_MASK_LINE) -+ #define WM_I2S_SUPPORTED_MASK (WM_I2S_STEREO_MASK | SOUND_MASK_MIC) -+ #define WM_I2S_RECORD_MASK (SOUND_MASK_MIC | SOUND_MASK_LINE1 | SOUND_MASK_LINE) -+#elif defined(WM8721) -+ #define CODEC_NAME "Wolfson WM8721 I2S" -+ #define WM_I2S_STEREO_MASK (SOUND_MASK_PCM) -+ #define WM_I2S_SUPPORTED_MASK (WM_I2S_STEREO_MASK) -+ #define WM_I2S_RECORD_MASK (0) -+#endif -+ -+ -+#define supported_mixer(FOO) ((FOO >= 0) && \ -+ (FOO < SOUND_MIXER_NRDEVICES) && \ -+ WM_I2S_SUPPORTED_MASK & (1< - #include - -@@ -98,13 +137,51 @@ - * 0 = no VRA, 1 = use VRA if codec supports it - * The framework is here, but we currently force no VRA. - */ -+#if defined(CONFIG_MIPS_PB1200) | defined(CONFIG_MIPS_PB1550) - static int vra = 0; -+#elif defined(CONFIG_MIPS_FICMMP) -+static int vra = 1; -+#endif -+ -+#define WM_REG_L_HEADPHONE_OUT 0x02 -+#define WM_REG_R_HEADPHONE_OUT 0x03 -+#define WM_REG_ANALOGUE_AUDIO_PATH_CTRL 0x04 -+#define WM_REG_DIGITAL_AUDIO_PATH_CTRL 0x05 -+#define WM_REG_POWER_DOWN_CTRL 0x06 -+#define WM_REG_DIGITAL_AUDIO_IF 0x07 -+#define WM_REG_SAMPLING_CONTROL 0x08 -+#define WM_REG_ACTIVE_CTRL 0x09 -+#define WM_REG_RESET 0x0F -+#define WM_SC_SR_96000 (0x7<<2) -+#define WM_SC_SR_88200 (0xF<<2) -+#define WM_SC_SR_48000 (0x0<<2) -+#define WM_SC_SR_44100 (0x8<<2) -+#define WM_SC_SR_32000 (0x6<<2) -+#define WM_SC_SR_8018 (0x9<<2) -+#define WM_SC_SR_8000 (0x1<<2) -+#define WM_SC_MODE_USB 1 -+#define WM_SC_MODE_NORMAL 0 -+#define WM_SC_BOSR_250FS (0<<1) -+#define WM_SC_BOSR_272FS (1<<1) -+#define WM_SC_BOSR_256FS (0<<1) -+#define WM_SC_BOSR_128FS (0<<1) -+#define WM_SC_BOSR_384FS (1<<1) -+#define WM_SC_BOSR_192FS (1<<1) -+ -+#define WS_64FS 31 -+#define WS_96FS 47 -+#define WS_128FS 63 -+#define WS_192FS 95 -+ -+#define MIN_Q_COUNT 2 -+ - MODULE_PARM(vra, "i"); - MODULE_PARM_DESC(vra, "if 1 use VRA if codec supports it"); - - static struct au1550_state { - /* soundcore stuff */ - int dev_audio; -+ int dev_mixer; - - spinlock_t lock; - struct semaphore open_sem; -@@ -114,6 +191,11 @@ - int no_vra; - volatile psc_i2s_t *psc_addr; - -+ int level_line; -+ int level_mic; -+ int level_left; -+ int level_right; -+ - struct dmabuf { - u32 dmanr; - unsigned sample_rate; -@@ -195,60 +277,224 @@ - } - } - --/* Just a place holder. The Wolfson codec is a write only device, -- * so we would have to keep a local copy of the data. -- */ --#if 0 --static u8 --rdcodec(u8 addr) --{ -- return 0 /* data */; --} --#endif -- -- - static void --wrcodec(u8 ctlreg, u8 val) -+wrcodec(u8 ctlreg, u16 val) - { - int rcnt; - extern int pb1550_wm_codec_write(u8 addr, u8 reg, u8 val); -- - /* The codec is a write only device, with a 16-bit control/data - * word. Although it is written as two bytes on the I2C, the - * format is actually 7 bits of register and 9 bits of data. - * The ls bit of the first byte is the ms bit of the data. - */ - rcnt = 0; -- while ((pb1550_wm_codec_write((0x36 >> 1), ctlreg, val) != 1) -- && (rcnt < 50)) { -+ while ((pb1550_wm_codec_write((0x36 >> 1), -+ (ctlreg << 1) | ((val >> 8) & 0x01), -+ (u8) (val & 0x00FF)) != 1) && -+ (rcnt < 50)) { - rcnt++; --#if 0 -- printk("Codec write retry %02x %02x\n", ctlreg, val); --#endif - } -+ -+ au1550_delay(10); -+} -+ -+static int -+au1550_open_mixdev(struct inode *inode, struct file *file) -+{ -+ file->private_data = &au1550_state; -+ return 0; -+} -+ -+static int -+au1550_release_mixdev(struct inode *inode, struct file *file) -+{ -+ return 0; -+} -+ -+static int wm_i2s_read_mixer(struct au1550_state *s, int oss_channel) -+{ -+ int ret = 0; -+ -+ if (WM_I2S_STEREO_MASK & (1 << oss_channel)) { -+ /* nice stereo mixers .. */ -+ -+ ret = s->level_left | (s->level_right << 8); -+ } else if (oss_channel == SOUND_MIXER_MIC) { -+ ret = 0; -+ /* TODO: Implement read mixer for input/output codecs */ -+ } -+ -+ return ret; - } - -+static void wm_i2s_write_mixer(struct au1550_state *s, int oss_channel, unsigned int left, unsigned int right) -+{ -+ if (WM_I2S_STEREO_MASK & (1 << oss_channel)) { -+ /* stereo mixers */ -+ s->level_left = left; -+ s->level_right = right; -+ -+ right = (right * WM_VOLUME_SCALE) / 100; -+ left = (left * WM_VOLUME_SCALE) / 100; -+ if (right > WM_VOLUME_SCALE) -+ right = WM_VOLUME_SCALE; -+ if (left > WM_VOLUME_SCALE) -+ left = WM_VOLUME_SCALE; -+ -+ right += WM_VOLUME_MIN; -+ left += WM_VOLUME_MIN; -+ -+ wrcodec(WM_REG_L_HEADPHONE_OUT, left); -+ wrcodec(WM_REG_R_HEADPHONE_OUT, right); -+ -+ }else if (oss_channel == SOUND_MIXER_MIC) { -+ /* TODO: implement write mixer for input/output codecs */ -+ } -+} -+ -+/* a thin wrapper for write_mixer */ -+static void wm_i2s_set_mixer(struct au1550_state *s, 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; -+ -+ wm_i2s_write_mixer(s, oss_mixer, left, right); -+} -+ -+static int -+au1550_ioctl_mixdev(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) -+{ -+ struct au1550_state *s = (struct au1550_state *)file->private_data; -+ -+ int i, val = 0; -+ -+ if (cmd == SOUND_MIXER_INFO) { -+ mixer_info info; -+ strncpy(info.id, CODEC_NAME, sizeof(info.id)); -+ strncpy(info.name, CODEC_NAME, sizeof(info.name)); -+ info.modify_counter = 0; -+ if (copy_to_user((void *)arg, &info, sizeof(info))) -+ return -EFAULT; -+ return 0; -+ } -+ if (cmd == SOUND_OLD_MIXER_INFO) { -+ _old_mixer_info info; -+ strncpy(info.id, CODEC_NAME, sizeof(info.id)); -+ strncpy(info.name, CODEC_NAME, sizeof(info.name)); -+ if (copy_to_user((void *)arg, &info, sizeof(info))) -+ return -EFAULT; -+ return 0; -+ } -+ -+ if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int)) -+ return -EINVAL; -+ -+ if (cmd == OSS_GETVERSION) -+ return put_user(SOUND_VERSION, (int *)arg); -+ -+ if (_SIOC_DIR(cmd) == _SIOC_READ) { -+ switch (_IOC_NR(cmd)) { -+ case SOUND_MIXER_RECSRC: /* give them the current record src */ -+ val = 0; -+ /* -+ if (!codec->recmask_io) { -+ val = 0; -+ } else { -+ val = codec->recmask_io(codec, 1, 0); -+ }*/ -+ break; -+ -+ case SOUND_MIXER_DEVMASK: /* give them the supported mixers */ -+ val = WM_I2S_SUPPORTED_MASK; -+ break; -+ -+ case SOUND_MIXER_RECMASK: -+ /* Arg contains a bit for each supported recording -+ * source */ -+ val = WM_I2S_RECORD_MASK; -+ break; -+ -+ case SOUND_MIXER_STEREODEVS: -+ /* Mixer channels supporting stereo */ -+ val = WM_I2S_STEREO_MASK; -+ break; -+ -+ case SOUND_MIXER_CAPS: -+ val = SOUND_CAP_EXCL_INPUT; -+ break; -+ -+ default: /* read a specific mixer */ -+ i = _IOC_NR(cmd); -+ -+ if (!supported_mixer(i)) -+ return -EINVAL; -+ -+ val = wm_i2s_read_mixer(s, i); -+ break; -+ } -+ return put_user(val, (int *)arg); -+ } -+ -+ if (_SIOC_DIR(cmd) == (_SIOC_WRITE|_SIOC_READ)) { -+ if (get_user(val, (int *)arg)) -+ return -EFAULT; -+ -+ switch (_IOC_NR(cmd)) { -+ case SOUND_MIXER_RECSRC: -+ /* Arg contains a bit for each recording source */ -+ if (!WM_I2S_RECORD_MASK) -+ return -EINVAL; -+ if (!val) -+ return 0; -+ if (!(val &= WM_I2S_RECORD_MASK)) -+ return -EINVAL; -+ -+ return 0; -+ default: /* write a specific mixer */ -+ i = _IOC_NR(cmd); -+ -+ if (!supported_mixer(i)) -+ return -EINVAL; -+ -+ wm_i2s_set_mixer(s, i, val); -+ -+ return 0; -+ } -+} -+ return -EINVAL; -+} -+ -+static loff_t -+au1550_llseek(struct file *file, loff_t offset, int origin) -+{ -+ return -ESPIPE; -+} -+ -+static /*const */ struct file_operations au1550_mixer_fops = { -+ owner:THIS_MODULE, -+ llseek:au1550_llseek, -+ ioctl:au1550_ioctl_mixdev, -+ open:au1550_open_mixdev, -+ release:au1550_release_mixdev, -+}; -+ - void --codec_init(void) -+codec_init(struct au1550_state *s) - { -- wrcodec(0x1e, 0x00); /* Reset */ -- au1550_delay(200); -- wrcodec(0x0c, 0x00); /* Power up everything */ -- au1550_delay(10); -- wrcodec(0x12, 0x00); /* Deactivate codec */ -- au1550_delay(10); -- wrcodec(0x08, 0x10); /* Select DAC outputs to line out */ -- au1550_delay(10); -- wrcodec(0x0a, 0x00); /* Disable output mute */ -- au1550_delay(10); -- wrcodec(0x05, 0x70); /* lower output volume on headphone */ -- au1550_delay(10); -- wrcodec(0x0e, 0x02); /* Set slave, 16-bit, I2S modes */ -- au1550_delay(10); -- wrcodec(0x10, 0x01); /* 12MHz (USB), 250fs */ -- au1550_delay(10); -- wrcodec(0x12, 0x01); /* Activate codec */ -- au1550_delay(10); -+ wrcodec(WM_REG_RESET, 0x00); /* Reset */ -+ wrcodec(WM_REG_POWER_DOWN_CTRL, 0x00); /* Power up everything */ -+ wrcodec(WM_REG_ACTIVE_CTRL, 0x00); /* Deactivate codec */ -+ wrcodec(WM_REG_ANALOGUE_AUDIO_PATH_CTRL, 0x10); /* Select DAC outputs to line out */ -+ wrcodec(WM_REG_DIGITAL_AUDIO_PATH_CTRL, 0x00); /* Disable output mute */ -+ wm_i2s_write_mixer(s, SOUND_MIXER_PCM, 74, 74); -+ wrcodec(WM_REG_DIGITAL_AUDIO_IF, 0x02); /* Set slave, 16-bit, I2S modes */ -+ wrcodec(WM_REG_ACTIVE_CTRL, 0x01); /* Activate codec */ - } - - /* stop the ADC before calling */ -@@ -256,27 +502,16 @@ - set_adc_rate(struct au1550_state *s, unsigned rate) - { - struct dmabuf *adc = &s->dma_adc; -- struct dmabuf *dac = &s->dma_dac; - -- if (s->no_vra) { -- /* calc SRC factor -- */ -+ #if defined(WM_MODE_USB) - adc->src_factor = (((SAMP_RATE*2) / rate) + 1) >> 1; - adc->sample_rate = SAMP_RATE / adc->src_factor; - return; -- } -+ #else -+ //TODO: Need code for normal mode -+ #endif - - adc->src_factor = 1; -- -- --#if 0 -- rate = rate > SAMP_RATE ? SAMP_RATE : rate; -- -- wrcodec(0, 0); /* I don't yet know what to write here if we vra */ -- -- adc->sample_rate = rate; -- dac->sample_rate = rate; --#endif - } - - /* stop the DAC before calling */ -@@ -284,26 +519,89 @@ - set_dac_rate(struct au1550_state *s, unsigned rate) - { - struct dmabuf *dac = &s->dma_dac; -- struct dmabuf *adc = &s->dma_adc; - -- if (s->no_vra) { -- /* calc SRC factor -- */ -- dac->src_factor = (((SAMP_RATE*2) / rate) + 1) >> 1; -- dac->sample_rate = SAMP_RATE / dac->src_factor; -- return; -+ u16 sr, ws, div, bosr, mode; -+ volatile psc_i2s_t* ip = (volatile psc_i2s_t *)I2S_PSC_BASE; -+ u32 cfg; -+ -+ #if defined(CONFIG_MIPS_FICMMP) -+ rate = ficmmp_set_i2s_sample_rate(rate); -+ #endif -+ -+ switch(rate) -+ { -+ case 96000: -+ sr = WM_SC_SR_96000; -+ ws = WS_64FS; -+ div = PSC_I2SCFG_DIV2; -+ break; -+ case 88200: -+ sr = WM_SC_SR_88200; -+ ws = WS_64FS; -+ div = PSC_I2SCFG_DIV2; -+ break; -+ case 44100: -+ sr = WM_SC_SR_44100; -+ ws = WS_128FS; -+ div = PSC_I2SCFG_DIV2; -+ break; -+ case 48000: -+ sr = WM_SC_SR_48000; -+ ws = WS_128FS; -+ div = PSC_I2SCFG_DIV2; -+ break; -+ case 32000: -+ sr = WM_SC_SR_32000; -+ ws = WS_96FS; -+ div = PSC_I2SCFG_DIV4; -+ break; -+ case 8018: -+ sr = WM_SC_SR_8018; -+ ws = WS_128FS; -+ div = PSC_I2SCFG_DIV2; -+ break; -+ case 8000: -+ default: -+ sr = WM_SC_SR_8000; -+ ws = WS_96FS; -+ div = PSC_I2SCFG_DIV16; -+ break; - } - -+ #if defined(WM_MODE_USB) -+ mode = WM_SC_MODE_USB; -+ #else -+ mode = WM_SC_MODE_NORMAL; -+ #endif -+ -+ bosr = 0; -+ - dac->src_factor = 1; -+ dac->sample_rate = rate; - --#if 0 -- rate = rate > SAMP_RATE ? SAMP_RATE : rate; -+ /* Deactivate codec */ -+ wrcodec(WM_REG_ACTIVE_CTRL, 0x00); - -- wrcodec(0, 0); /* I don't yet know what to write here if we vra */ -+ /* Disable I2S controller */ -+ ip->psc_i2scfg &= ~PSC_I2SCFG_DE_ENABLE; -+ /* Wait for device disabled */ -+ while ((ip->psc_i2sstat & PSC_I2SSTAT_DR) == 1); -+ -+ cfg = ip->psc_i2scfg; -+ /* Clear WS and DIVIDER values */ -+ cfg &= ~(PSC_I2SCFG_WS_MASK | PSC_I2SCFG_DIV_MASK); -+ cfg |= PSC_I2SCFG_WS(ws) | div; -+ /* Reconfigure and enable */ -+ ip->psc_i2scfg = cfg | PSC_I2SCFG_DE_ENABLE; - -- adc->sample_rate = rate; -- dac->sample_rate = rate; --#endif -+ /* Wait for device enabled */ -+ while ((ip->psc_i2sstat & PSC_I2SSTAT_DR) == 0); -+ -+ /* Set appropriate sampling rate */ -+ wrcodec(WM_REG_SAMPLING_CONTROL, bosr | mode | sr); -+ -+ /* Activate codec */ -+ wrcodec(WM_REG_ACTIVE_CTRL, 0x01); - } - - static void -@@ -354,8 +652,7 @@ - ip->psc_i2spcr = PSC_I2SPCR_RP; - au_sync(); - -- /* Wait for Receive Busy to show disabled. -- */ -+ /* Wait for Receive Busy to show disabled. */ - do { - stat = ip->psc_i2sstat; - au_sync(); -@@ -463,7 +760,6 @@ - if (db->num_channels == 1) - db->cnt_factor *= 2; - db->cnt_factor *= db->src_factor; -- - db->count = 0; - db->dma_qcount = 0; - db->nextIn = db->nextOut = db->rawbuf; -@@ -546,12 +842,13 @@ - if (i2s_stat & (PSC_I2SSTAT_TF | PSC_I2SSTAT_TR | PSC_I2SSTAT_TF)) - dbg("I2S status = 0x%08x", i2s_stat); - #endif -+ - db->dma_qcount--; - - if (db->count >= db->fragsize) { -- if (au1xxx_dbdma_put_source(db->dmanr, db->nextOut, -- db->fragsize) == 0) { -- err("qcount < 2 and no ring room!"); -+ if (au1xxx_dbdma_put_source(db->dmanr, db->nextOut, db->fragsize) == 0) -+ { -+ err("qcount < MIN_Q_COUNT and no ring room!"); - } - db->nextOut += db->fragsize; - if (db->nextOut >= db->rawbuf + db->dmasize) -@@ -606,65 +903,43 @@ - - } - --static loff_t --au1550_llseek(struct file *file, loff_t offset, int origin) --{ -- return -ESPIPE; --} -- -- --#if 0 --static int --au1550_open_mixdev(struct inode *inode, struct file *file) --{ -- file->private_data = &au1550_state; -- return 0; --} -- --static int --au1550_release_mixdev(struct inode *inode, struct file *file) --{ -- return 0; --} -- --static int --mixdev_ioctl(struct ac97_codec *codec, unsigned int cmd, -- unsigned long arg) --{ -- return codec->mixer_ioctl(codec, cmd, arg); --} -- --static int --au1550_ioctl_mixdev(struct inode *inode, struct file *file, -- unsigned int cmd, unsigned long arg) --{ -- struct au1550_state *s = (struct au1550_state *)file->private_data; -- struct ac97_codec *codec = s->codec; -- -- return mixdev_ioctl(codec, cmd, arg); --} -- --static /*const */ struct file_operations au1550_mixer_fops = { -- owner:THIS_MODULE, -- llseek:au1550_llseek, -- ioctl:au1550_ioctl_mixdev, -- open:au1550_open_mixdev, -- release:au1550_release_mixdev, --}; --#endif -- - static int - drain_dac(struct au1550_state *s, int nonblock) - { - unsigned long flags; - int count, tmo; - -+ struct dmabuf *db = &s->dma_dac; -+ -+ //DPRINTF(); - if (s->dma_dac.mapped || !s->dma_dac.ready || s->dma_dac.stopped) - return 0; - - for (;;) { - spin_lock_irqsave(&s->lock, flags); -- count = s->dma_dac.count; -+ count = db->count; -+ -+ /* Pad the ddma buffer with zeros if the amount remaining -+ * is not a multiple of fragsize */ -+ if(count % db->fragsize != 0) -+ { -+ int pad = db->fragsize - (count % db->fragsize); -+ char* bufptr = db->nextIn; -+ char* bufend = db->rawbuf + db->dmasize; -+ -+ if((bufend - bufptr) < pad) -+ printk("Error! ddma padding is bigger than available ring space!\n"); -+ else -+ { -+ memset((void*)bufptr, 0, pad); -+ count += pad; -+ db->nextIn += pad; -+ db->count += pad; -+ if (db->dma_qcount == 0) -+ start_dac(s); -+ db->dma_qcount++; -+ } -+ } - spin_unlock_irqrestore(&s->lock, flags); - if (count <= 0) - break; -@@ -672,9 +947,9 @@ - break; - if (nonblock) - return -EBUSY; -- tmo = 1000 * count / (s->no_vra ? -- SAMP_RATE : s->dma_dac.sample_rate); -+ tmo = 1000 * count / s->dma_dac.sample_rate; - tmo /= s->dma_dac.dma_bytes_per_sample; -+ - au1550_delay(tmo); - } - if (signal_pending(current)) -@@ -698,8 +973,7 @@ - * If interpolating (no VRA), duplicate every audio frame src_factor times. - */ - static int --translate_from_user(struct dmabuf *db, char* dmabuf, char* userbuf, -- int dmacount) -+translate_from_user(struct dmabuf *db, char* dmabuf, char* userbuf, int dmacount) - { - int sample, i; - int interp_bytes_per_sample; -@@ -737,11 +1011,12 @@ - - /* duplicate every audio frame src_factor times - */ -- for (i = 0; i < db->src_factor; i++) -+ for (i = 0; i < db->src_factor; i++) { - memcpy(dmabuf, dmasample, db->dma_bytes_per_sample); -+ dmabuf += interp_bytes_per_sample; -+ } - - userbuf += db->user_bytes_per_sample; -- dmabuf += interp_bytes_per_sample; - } - - return num_samples * interp_bytes_per_sample; -@@ -996,15 +1271,14 @@ - * on the dma queue. If the queue count reaches zero, - * we know the dma has stopped. - */ -- while ((db->dma_qcount < 2) && (db->count >= db->fragsize)) { -+ while ((db->dma_qcount < MIN_Q_COUNT) && (db->count >= db->fragsize)) { - if (au1xxx_dbdma_put_source(db->dmanr, db->nextOut, - db->fragsize) == 0) { -- err("qcount < 2 and no ring room!"); -+ err("qcount < MIN_Q_COUNT and no ring room!"); - } - db->nextOut += db->fragsize; - if (db->nextOut >= db->rawbuf + db->dmasize) - db->nextOut -= db->dmasize; -- db->count -= db->fragsize; - db->total_bytes += db->dma_fragsize; - if (db->dma_qcount == 0) - start_dac(s); -@@ -1017,7 +1291,6 @@ - buffer += usercnt; - ret += usercnt; - } /* while (count > 0) */ -- - out: - up(&s->sem); - out2: -@@ -1371,9 +1644,6 @@ - s->dma_dac.cnt_factor; - abinfo.fragstotal = s->dma_dac.numfrag; - abinfo.fragments = abinfo.bytes >> s->dma_dac.fragshift; --#ifdef AU1000_VERBOSE_DEBUG -- dbg("bytes=%d, fragments=%d", abinfo.bytes, abinfo.fragments); --#endif - return copy_to_user((void *) arg, &abinfo, - sizeof(abinfo)) ? -EFAULT : 0; - -@@ -1536,13 +1806,9 @@ - case SNDCTL_DSP_SETSYNCRO: - case SOUND_PCM_READ_FILTER: - return -EINVAL; -+ default: break; - } -- --#if 0 -- return mixdev_ioctl(s->codec, cmd, arg); --#else - return 0; --#endif - } - - -@@ -1664,15 +1930,15 @@ - MODULE_AUTHOR("Advanced Micro Devices (AMD), dan@embeddededge.com"); - MODULE_DESCRIPTION("Au1550 Audio Driver"); - -+#if defined(WM_MODE_USB) - /* Set up an internal clock for the PSC3. This will then get - * driven out of the Au1550 as the master. - */ - static void - intclk_setup(void) - { -- uint clk, rate, stat; -- -- /* Wire up Freq4 as a clock for the PSC3. -+ uint clk, rate; -+ /* Wire up Freq4 as a clock for the PSC. - * We know SMBus uses Freq3. - * By making changes to this rate, plus the word strobe - * size, we can make fine adjustments to the actual data rate. -@@ -1700,11 +1966,17 @@ - */ - clk = au_readl(SYS_CLKSRC); - au_sync(); -+#if defined(CONFIG_SOC_AU1550) - clk &= ~0x01f00000; - clk |= (6 << 22); -+#elif defined(CONFIG_SOC_AU1200) -+ clk &= ~0x3e000000; -+ clk |= (6 << 27); -+#endif - au_writel(clk, SYS_CLKSRC); - au_sync(); - } -+#endif - - static int __devinit - au1550_probe(void) -@@ -1724,6 +1996,11 @@ - init_MUTEX(&s->open_sem); - spin_lock_init(&s->lock); - -+ /* CPLD Mux for I2s */ -+ -+#if defined(CONFIG_MIPS_PB1200) -+ bcsr->resets |= BCSR_RESETS_PCS1MUX; -+#endif - - s->psc_addr = (volatile psc_i2s_t *)I2S_PSC_BASE; - ip = s->psc_addr; -@@ -1765,9 +2042,8 @@ - - if ((s->dev_audio = register_sound_dsp(&au1550_audio_fops, -1)) < 0) - goto err_dev1; --#if 0 -- if ((s->codec->dev_mixer = -- register_sound_mixer(&au1550_mixer_fops, -1)) < 0) -+#if 1 -+ if ((s->dev_mixer = register_sound_mixer(&au1550_mixer_fops, -1)) < 0) - goto err_dev2; - #endif - -@@ -1777,7 +2053,6 @@ - proc_au1550_dump, NULL); - #endif /* AU1550_DEBUG */ - -- intclk_setup(); - - /* The GPIO for the appropriate PSC was configured by the - * board specific start up. -@@ -1786,7 +2061,12 @@ - */ - ip->psc_ctrl = PSC_CTRL_DISABLE; /* Disable PSC */ - au_sync(); -+#if defined(WM_MODE_USB) -+ intclk_setup(); - ip->psc_sel = (PSC_SEL_CLK_INTCLK | PSC_SEL_PS_I2SMODE); -+#else -+ ip->psc_sel = (PSC_SEL_CLK_EXTCLK | PSC_SEL_PS_I2SMODE); -+#endif - au_sync(); - - /* Enable PSC -@@ -1806,42 +2086,18 @@ - * Actual I2S mode (first bit delayed by one clock). - * Master mode (We provide the clock from the PSC). - */ -- val = PSC_I2SCFG_SET_LEN(16); --#ifdef TRY_441KHz -- /* This really should be 250, but it appears that all of the -- * PLLs, dividers and so on in the chain shift it. That's the -- * problem with sourceing the clock instead of letting the very -- * stable codec provide it. But, the PSC doesn't appear to want -- * to work in slave mode, so this is what we get. It's not -- * studio quality timing, but it's good enough for listening -- * to mp3s. -- */ -- val |= PSC_I2SCFG_SET_WS(252); --#else -- val |= PSC_I2SCFG_SET_WS(250); --#endif -- val |= PSC_I2SCFG_RT_FIFO8 | PSC_I2SCFG_TT_FIFO8 | \ -+ -+ val = PSC_I2SCFG_SET_LEN(16) | PSC_I2SCFG_WS(WS_128FS) | PSC_I2SCFG_RT_FIFO8 | PSC_I2SCFG_TT_FIFO8 | \ - PSC_I2SCFG_BI | PSC_I2SCFG_XM; - -- ip->psc_i2scfg = val; -- au_sync(); -- val |= PSC_I2SCFG_DE_ENABLE; -- ip->psc_i2scfg = val; -- au_sync(); -+ ip->psc_i2scfg = val | PSC_I2SCFG_DE_ENABLE; - -- /* Wait for Device ready. -- */ -- do { -- val = ip->psc_i2sstat; -- au_sync(); -- } while ((val & PSC_I2SSTAT_DR) == 0); -+ set_dac_rate(s, 8000); //Set default rate - -- val = ip->psc_i2scfg; -- au_sync(); -+ codec_init(s); - -- codec_init(); -+ s->no_vra = vra ? 0 : 1; - -- s->no_vra = 1; - if (s->no_vra) - info("no VRA, interpolating and decimating"); - -@@ -1866,6 +2122,8 @@ - err_dev2: - unregister_sound_dsp(s->dev_audio); - #endif -+ err_dev2: -+ unregister_sound_dsp(s->dev_audio); - err_dev1: - au1xxx_dbdma_chan_free(s->dma_adc.dmanr); - err_dma2: -diff -Nur linux-2.4.30/drivers/sound/au1550_psc.c linux-2.4.30-mips/drivers/sound/au1550_psc.c ---- linux-2.4.30/drivers/sound/au1550_psc.c 2005-01-19 15:10:04.000000000 +0100 -+++ linux-2.4.30-mips/drivers/sound/au1550_psc.c 2005-01-30 09:01:28.000000000 +0100 -@@ -30,6 +30,7 @@ - * 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ -+ - #include - #include - #include -@@ -63,6 +64,14 @@ - #include - #endif - -+#ifdef CONFIG_MIPS_PB1200 -+#include -+#endif -+ -+#ifdef CONFIG_MIPS_DB1200 -+#include -+#endif -+ - #undef OSS_DOCUMENTED_MIXER_SEMANTICS - - #define AU1550_MODULE_NAME "Au1550 psc audio" -@@ -521,7 +530,14 @@ - spin_unlock_irqrestore(&s->lock, flags); - } - -- -+/* -+ NOTE: The xmit slots cannot be changed on the fly when in full-duplex -+ because the AC'97 block must be stopped/started. When using this driver -+ in full-duplex (in & out at the same time), the DMA engine will stop if -+ you disable the block. -+ TODO: change implementation to properly restart adc/dac after setting -+ xmit slots. -+*/ - static void - set_xmit_slots(int num_channels) - { -@@ -565,6 +581,14 @@ - } while ((stat & PSC_AC97STAT_DR) == 0); - } - -+/* -+ NOTE: The recv slots cannot be changed on the fly when in full-duplex -+ because the AC'97 block must be stopped/started. When using this driver -+ in full-duplex (in & out at the same time), the DMA engine will stop if -+ you disable the block. -+ TODO: change implementation to properly restart adc/dac after setting -+ recv slots. -+*/ - static void - set_recv_slots(int num_channels) - { -@@ -608,7 +632,6 @@ - - spin_lock_irqsave(&s->lock, flags); - -- set_xmit_slots(db->num_channels); - au_writel(PSC_AC97PCR_TC, PSC_AC97PCR); - au_sync(); - au_writel(PSC_AC97PCR_TS, PSC_AC97PCR); -@@ -640,7 +663,6 @@ - db->nextIn -= db->dmasize; - } - -- set_recv_slots(db->num_channels); - au1xxx_dbdma_start(db->dmanr); - au_writel(PSC_AC97PCR_RC, PSC_AC97PCR); - au_sync(); -@@ -752,12 +774,16 @@ - if (ac97c_stat & (AC97C_XU | AC97C_XO | AC97C_TE)) - dbg("AC97C status = 0x%08x", ac97c_stat); - #endif -+ /* There is a possiblity that we are getting 1 interrupt for -+ multiple descriptors. Use ddma api to find out how many -+ completed. -+ */ - db->dma_qcount--; - - if (db->count >= db->fragsize) { - if (au1xxx_dbdma_put_source(db->dmanr, db->nextOut, - db->fragsize) == 0) { -- err("qcount < 2 and no ring room!"); -+ err("qcount < 2 and no ring room1!"); - } - db->nextOut += db->fragsize; - if (db->nextOut >= db->rawbuf + db->dmasize) -@@ -941,11 +967,12 @@ - - /* duplicate every audio frame src_factor times - */ -- for (i = 0; i < db->src_factor; i++) -+ for (i = 0; i < db->src_factor; i++) { - memcpy(dmabuf, dmasample, db->dma_bytes_per_sample); -+ dmabuf += interp_bytes_per_sample; -+ } - - userbuf += db->user_bytes_per_sample; -- dmabuf += interp_bytes_per_sample; - } - - return num_samples * interp_bytes_per_sample; -@@ -1203,7 +1230,7 @@ - while ((db->dma_qcount < 2) && (db->count >= db->fragsize)) { - if (au1xxx_dbdma_put_source(db->dmanr, db->nextOut, - db->fragsize) == 0) { -- err("qcount < 2 and no ring room!"); -+ err("qcount < 2 and no ring room!0"); - } - db->nextOut += db->fragsize; - if (db->nextOut >= db->rawbuf + db->dmasize) -@@ -1481,6 +1508,7 @@ - return -EINVAL; - stop_adc(s); - s->dma_adc.num_channels = val; -+ set_recv_slots(val); - if ((ret = prog_dmabuf_adc(s))) - return ret; - } -@@ -1538,6 +1566,7 @@ - } - - s->dma_dac.num_channels = val; -+ set_xmit_slots(val); - if ((ret = prog_dmabuf_dac(s))) - return ret; - } -@@ -1832,10 +1861,8 @@ - down(&s->open_sem); - } - -- stop_dac(s); -- stop_adc(s); -- - if (file->f_mode & FMODE_READ) { -+ stop_adc(s); - s->dma_adc.ossfragshift = s->dma_adc.ossmaxfrags = - s->dma_adc.subdivision = s->dma_adc.total_bytes = 0; - s->dma_adc.num_channels = 1; -@@ -1846,6 +1873,7 @@ - } - - if (file->f_mode & FMODE_WRITE) { -+ stop_dac(s); - s->dma_dac.ossfragshift = s->dma_dac.ossmaxfrags = - s->dma_dac.subdivision = s->dma_dac.total_bytes = 0; - s->dma_dac.num_channels = 1; -@@ -2091,6 +2119,9 @@ - ac97_read_proc, &s->codec); - #endif - -+ set_xmit_slots(1); -+ set_recv_slots(1); -+ - return 0; - - err_dev3: -diff -Nur linux-2.4.30/drivers/tc/lk201.c linux-2.4.30-mips/drivers/tc/lk201.c ---- linux-2.4.30/drivers/tc/lk201.c 2004-02-18 14:36:31.000000000 +0100 -+++ linux-2.4.30-mips/drivers/tc/lk201.c 2004-09-28 02:53:04.000000000 +0200 -@@ -5,7 +5,7 @@ - * for more details. - * - * Copyright (C) 1999-2002 Harald Koerfgen -- * Copyright (C) 2001, 2002, 2003 Maciej W. Rozycki -+ * Copyright (C) 2001, 2002, 2003, 2004 Maciej W. Rozycki - */ - - #include -@@ -23,8 +23,8 @@ - #include - #include - #include -+#include - --#include "zs.h" - #include "lk201.h" - - /* -@@ -55,19 +55,20 @@ - unsigned char kbd_sysrq_key = -1; - #endif - --#define KEYB_LINE 3 -+#define KEYB_LINE_ZS 3 -+#define KEYB_LINE_DZ 0 - --static int __init lk201_init(struct dec_serial *); --static void __init lk201_info(struct dec_serial *); --static void lk201_kbd_rx_char(unsigned char, unsigned char); -+static int __init lk201_init(void *); -+static void __init lk201_info(void *); -+static void lk201_rx_char(unsigned char, unsigned char); - --struct zs_hook lk201_kbdhook = { -+static struct dec_serial_hook lk201_hook = { - .init_channel = lk201_init, - .init_info = lk201_info, - .rx_char = NULL, - .poll_rx_char = NULL, - .poll_tx_char = NULL, -- .cflags = B4800 | CS8 | CSTOPB | CLOCAL -+ .cflags = B4800 | CS8 | CSTOPB | CLOCAL, - }; - - /* -@@ -93,28 +94,28 @@ - LK_CMD_ENB_BELL, LK_PARAM_VOLUME(4), - }; - --static struct dec_serial* lk201kbd_info; -+static void *lk201_handle; - --static int lk201_send(struct dec_serial *info, unsigned char ch) -+static int lk201_send(unsigned char ch) - { -- if (info->hook->poll_tx_char(info, ch)) { -+ if (lk201_hook.poll_tx_char(lk201_handle, ch)) { - printk(KERN_ERR "lk201: transmit timeout\n"); - return -EIO; - } - return 0; - } - --static inline int lk201_get_id(struct dec_serial *info) -+static inline int lk201_get_id(void) - { -- return lk201_send(info, LK_CMD_REQ_ID); -+ return lk201_send(LK_CMD_REQ_ID); - } - --static int lk201_reset(struct dec_serial *info) -+static int lk201_reset(void) - { - int i, r; - - for (i = 0; i < sizeof(lk201_reset_string); i++) { -- r = lk201_send(info, lk201_reset_string[i]); -+ r = lk201_send(lk201_reset_string[i]); - if (r < 0) - return r; - } -@@ -203,24 +204,26 @@ - - static int write_kbd_rate(struct kbd_repeat *rep) - { -- struct dec_serial* info = lk201kbd_info; - int delay, rate; - int i; - - delay = rep->delay / 5; - rate = rep->rate; - for (i = 0; i < 4; i++) { -- if (info->hook->poll_tx_char(info, LK_CMD_RPT_RATE(i))) -+ if (lk201_hook.poll_tx_char(lk201_handle, -+ LK_CMD_RPT_RATE(i))) - return 1; -- if (info->hook->poll_tx_char(info, LK_PARAM_DELAY(delay))) -+ if (lk201_hook.poll_tx_char(lk201_handle, -+ LK_PARAM_DELAY(delay))) - return 1; -- if (info->hook->poll_tx_char(info, LK_PARAM_RATE(rate))) -+ if (lk201_hook.poll_tx_char(lk201_handle, -+ LK_PARAM_RATE(rate))) - return 1; - } - return 0; - } - --static int lk201kbd_rate(struct kbd_repeat *rep) -+static int lk201_kbd_rate(struct kbd_repeat *rep) - { - if (rep == NULL) - return -EINVAL; -@@ -237,10 +240,8 @@ - return 0; - } - --static void lk201kd_mksound(unsigned int hz, unsigned int ticks) -+static void lk201_kd_mksound(unsigned int hz, unsigned int ticks) - { -- struct dec_serial* info = lk201kbd_info; -- - if (!ticks) - return; - -@@ -253,20 +254,19 @@ - ticks = 7; - ticks = 7 - ticks; - -- if (info->hook->poll_tx_char(info, LK_CMD_ENB_BELL)) -+ if (lk201_hook.poll_tx_char(lk201_handle, LK_CMD_ENB_BELL)) - return; -- if (info->hook->poll_tx_char(info, LK_PARAM_VOLUME(ticks))) -+ if (lk201_hook.poll_tx_char(lk201_handle, LK_PARAM_VOLUME(ticks))) - return; -- if (info->hook->poll_tx_char(info, LK_CMD_BELL)) -+ if (lk201_hook.poll_tx_char(lk201_handle, LK_CMD_BELL)) - return; - } - - void kbd_leds(unsigned char leds) - { -- struct dec_serial* info = lk201kbd_info; - unsigned char l = 0; - -- if (!info) /* FIXME */ -+ if (!lk201_handle) /* FIXME */ - return; - - /* FIXME -- Only Hold and Lock LEDs for now. --macro */ -@@ -275,13 +275,13 @@ - if (leds & LED_CAP) - l |= LK_LED_LOCK; - -- if (info->hook->poll_tx_char(info, LK_CMD_LEDS_ON)) -+ if (lk201_hook.poll_tx_char(lk201_handle, LK_CMD_LEDS_ON)) - return; -- if (info->hook->poll_tx_char(info, LK_PARAM_LED_MASK(l))) -+ if (lk201_hook.poll_tx_char(lk201_handle, LK_PARAM_LED_MASK(l))) - return; -- if (info->hook->poll_tx_char(info, LK_CMD_LEDS_OFF)) -+ if (lk201_hook.poll_tx_char(lk201_handle, LK_CMD_LEDS_OFF)) - return; -- if (info->hook->poll_tx_char(info, LK_PARAM_LED_MASK(~l))) -+ if (lk201_hook.poll_tx_char(lk201_handle, LK_PARAM_LED_MASK(~l))) - return; - } - -@@ -307,7 +307,7 @@ - return 0x80; - } - --static void lk201_kbd_rx_char(unsigned char ch, unsigned char stat) -+static void lk201_rx_char(unsigned char ch, unsigned char fl) - { - static unsigned char id[6]; - static int id_i; -@@ -316,9 +316,8 @@ - static int prev_scancode; - unsigned char c = scancodeRemap[ch]; - -- if (stat && stat != TTY_OVERRUN) { -- printk(KERN_ERR "lk201: keyboard receive error: 0x%02x\n", -- stat); -+ if (fl != TTY_NORMAL && fl != TTY_OVERRUN) { -+ printk(KERN_ERR "lk201: keyboard receive error: 0x%02x\n", fl); - return; - } - -@@ -335,7 +334,7 @@ - /* OK, the power-up concluded. */ - lk201_report(id); - if (id[2] == LK_STAT_PWRUP_OK) -- lk201_get_id(lk201kbd_info); -+ lk201_get_id(); - else { - id_i = 0; - printk(KERN_ERR "lk201: keyboard power-up " -@@ -345,7 +344,7 @@ - /* We got the ID; report it and start operation. */ - id_i = 0; - lk201_id(id); -- lk201_reset(lk201kbd_info); -+ lk201_reset(); - } - return; - } -@@ -398,29 +397,28 @@ - tasklet_schedule(&keyboard_tasklet); - } - --static void __init lk201_info(struct dec_serial *info) -+static void __init lk201_info(void *handle) - { - } - --static int __init lk201_init(struct dec_serial *info) -+static int __init lk201_init(void *handle) - { - /* First install handlers. */ -- lk201kbd_info = info; -- kbd_rate = lk201kbd_rate; -- kd_mksound = lk201kd_mksound; -+ lk201_handle = handle; -+ kbd_rate = lk201_kbd_rate; -+ kd_mksound = lk201_kd_mksound; - -- info->hook->rx_char = lk201_kbd_rx_char; -+ lk201_hook.rx_char = lk201_rx_char; - - /* Then just issue a reset -- the handlers will do the rest. */ -- lk201_send(info, LK_CMD_POWER_UP); -+ lk201_send(LK_CMD_POWER_UP); - - return 0; - } - - void __init kbd_init_hw(void) - { -- extern int register_zs_hook(unsigned int, struct zs_hook *); -- extern int unregister_zs_hook(unsigned int); -+ int keyb_line; - - /* Maxine uses LK501 at the Access.Bus. */ - if (!LK_IFACE) -@@ -428,19 +426,15 @@ - - printk(KERN_INFO "lk201: DECstation LK keyboard driver v0.05.\n"); - -- if (LK_IFACE_ZS) { -- /* -- * kbd_init_hw() is being called before -- * rs_init() so just register the kbd hook -- * and let zs_init do the rest :-) -- */ -- if(!register_zs_hook(KEYB_LINE, &lk201_kbdhook)) -- unregister_zs_hook(KEYB_LINE); -- } else { -- /* -- * TODO: modify dz.c to allow similar hooks -- * for LK201 handling on DS2100, DS3100, and DS5000/200 -- */ -- printk(KERN_ERR "lk201: support for DZ11 not yet ready.\n"); -- } -+ /* -+ * kbd_init_hw() is being called before -+ * rs_init() so just register the kbd hook -+ * and let zs_init do the rest :-) -+ */ -+ if (LK_IFACE_ZS) -+ keyb_line = KEYB_LINE_ZS; -+ else -+ keyb_line = KEYB_LINE_DZ; -+ if (!register_dec_serial_hook(keyb_line, &lk201_hook)) -+ unregister_dec_serial_hook(keyb_line); - } -diff -Nur linux-2.4.30/drivers/tc/zs.c linux-2.4.30-mips/drivers/tc/zs.c ---- linux-2.4.30/drivers/tc/zs.c 2005-01-19 15:10:05.000000000 +0100 -+++ linux-2.4.30-mips/drivers/tc/zs.c 2004-12-27 05:13:50.000000000 +0100 -@@ -68,6 +68,8 @@ - #include - #include - #include -+#include -+ - #ifdef CONFIG_DECSTATION - #include - #include -@@ -160,8 +162,8 @@ - #ifdef CONFIG_SERIAL_DEC_CONSOLE - static struct console sercons; - #endif --#if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) \ -- && !defined(MODULE) -+#if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && \ -+ !defined(MODULE) - static unsigned long break_pressed; /* break, really ... */ - #endif - -@@ -196,7 +198,6 @@ - /* - * Debugging. - */ --#undef SERIAL_DEBUG_INTR - #undef SERIAL_DEBUG_OPEN - #undef SERIAL_DEBUG_FLOW - #undef SERIAL_DEBUG_THROTTLE -@@ -221,10 +222,6 @@ - static struct termios *serial_termios[NUM_CHANNELS]; - static struct termios *serial_termios_locked[NUM_CHANNELS]; - --#ifndef MIN --#define MIN(a,b) ((a) < (b) ? (a) : (b)) --#endif -- - /* - * tmp_buf is used as a temporary buffer by serial_write. We need to - * lock it in case the copy_from_user blocks while swapping in a page, -@@ -386,8 +383,6 @@ - * ----------------------------------------------------------------------- - */ - --static int tty_break; /* Set whenever BREAK condition is detected. */ -- - /* - * This routine is used by the interrupt handler to schedule - * processing in the software interrupt portion of the driver. -@@ -414,20 +409,15 @@ - if (!tty && (!info->hook || !info->hook->rx_char)) - continue; - -- if (tty_break) { -- tty_break = 0; --#if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && !defined(MODULE) -- if (info->line == sercons.index) { -- if (!break_pressed) { -- break_pressed = jiffies; -- goto ignore_char; -- } -- break_pressed = 0; -- } --#endif -+ flag = TTY_NORMAL; -+ if (info->tty_break) { -+ info->tty_break = 0; - flag = TTY_BREAK; - if (info->flags & ZILOG_SAK) - do_SAK(tty); -+ /* Ignore the null char got when BREAK is removed. */ -+ if (ch == 0) -+ continue; - } else { - if (stat & Rx_OVR) { - flag = TTY_OVERRUN; -@@ -435,20 +425,22 @@ - flag = TTY_FRAME; - } else if (stat & PAR_ERR) { - flag = TTY_PARITY; -- } else -- flag = 0; -- if (flag) -+ } -+ if (flag != TTY_NORMAL) - /* reset the error indication */ - write_zsreg(info->zs_channel, R0, ERR_RES); - } - --#if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && !defined(MODULE) -+#if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && \ -+ !defined(MODULE) - if (break_pressed && info->line == sercons.index) { -- if (ch != 0 && -- time_before(jiffies, break_pressed + HZ*5)) { -+ /* Ignore the null char got when BREAK is removed. */ -+ if (ch == 0) -+ continue; -+ if (time_before(jiffies, break_pressed + HZ * 5)) { - handle_sysrq(ch, regs, NULL, NULL); - break_pressed = 0; -- goto ignore_char; -+ continue; - } - break_pressed = 0; - } -@@ -459,23 +451,7 @@ - return; - } - -- if (tty->flip.count >= TTY_FLIPBUF_SIZE) { -- static int flip_buf_ovf; -- ++flip_buf_ovf; -- continue; -- } -- tty->flip.count++; -- { -- static int flip_max_cnt; -- if (flip_max_cnt < tty->flip.count) -- flip_max_cnt = tty->flip.count; -- } -- -- *tty->flip.flag_buf_ptr++ = flag; -- *tty->flip.char_buf_ptr++ = ch; --#if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && !defined(MODULE) -- ignore_char: --#endif -+ tty_insert_flip_char(tty, ch, flag); - } - if (tty) - tty_flip_buffer_push(tty); -@@ -517,11 +493,15 @@ - /* Get status from Read Register 0 */ - stat = read_zsreg(info->zs_channel, R0); - -- if (stat & BRK_ABRT) { --#ifdef SERIAL_DEBUG_INTR -- printk("handling break...."); -+ if ((stat & BRK_ABRT) && !(info->read_reg_zero & BRK_ABRT)) { -+#if defined(CONFIG_SERIAL_DEC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && \ -+ !defined(MODULE) -+ if (info->line == sercons.index) { -+ if (!break_pressed) -+ break_pressed = jiffies; -+ } else - #endif -- tty_break = 1; -+ info->tty_break = 1; - } - - if (info->zs_channel != info->zs_chan_a) { -@@ -957,7 +937,7 @@ - save_flags(flags); - while (1) { - cli(); -- c = MIN(count, MIN(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, -+ c = min(count, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, - SERIAL_XMIT_SIZE - info->xmit_head)); - if (c <= 0) - break; -@@ -965,7 +945,7 @@ - if (from_user) { - down(&tmp_buf_sem); - copy_from_user(tmp_buf, buf, c); -- c = MIN(c, MIN(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, -+ c = min(c, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, - SERIAL_XMIT_SIZE - info->xmit_head)); - memcpy(info->xmit_buf + info->xmit_head, tmp_buf, c); - up(&tmp_buf_sem); -@@ -1282,46 +1262,48 @@ - } - - switch (cmd) { -- case TIOCMGET: -- error = verify_area(VERIFY_WRITE, (void *) arg, -- sizeof(unsigned int)); -- if (error) -- return error; -- return get_modem_info(info, (unsigned int *) arg); -- case TIOCMBIS: -- case TIOCMBIC: -- case TIOCMSET: -- return set_modem_info(info, cmd, (unsigned int *) arg); -- case TIOCGSERIAL: -- error = verify_area(VERIFY_WRITE, (void *) arg, -- sizeof(struct serial_struct)); -- if (error) -- return error; -- return get_serial_info(info, -- (struct serial_struct *) arg); -- case TIOCSSERIAL: -- return set_serial_info(info, -- (struct serial_struct *) arg); -- case TIOCSERGETLSR: /* Get line status register */ -- error = verify_area(VERIFY_WRITE, (void *) arg, -- sizeof(unsigned int)); -- if (error) -- return error; -- else -- return get_lsr_info(info, (unsigned int *) arg); -+ case TIOCMGET: -+ error = verify_area(VERIFY_WRITE, (void *)arg, -+ sizeof(unsigned int)); -+ if (error) -+ return error; -+ return get_modem_info(info, (unsigned int *)arg); - -- case TIOCSERGSTRUCT: -- error = verify_area(VERIFY_WRITE, (void *) arg, -- sizeof(struct dec_serial)); -- if (error) -- return error; -- copy_from_user((struct dec_serial *) arg, -- info, sizeof(struct dec_serial)); -- return 0; -+ case TIOCMBIS: -+ case TIOCMBIC: -+ case TIOCMSET: -+ return set_modem_info(info, cmd, (unsigned int *)arg); - -- default: -- return -ENOIOCTLCMD; -- } -+ case TIOCGSERIAL: -+ error = verify_area(VERIFY_WRITE, (void *)arg, -+ sizeof(struct serial_struct)); -+ if (error) -+ return error; -+ return get_serial_info(info, (struct serial_struct *)arg); -+ -+ case TIOCSSERIAL: -+ return set_serial_info(info, (struct serial_struct *)arg); -+ -+ case TIOCSERGETLSR: /* Get line status register */ -+ error = verify_area(VERIFY_WRITE, (void *)arg, -+ sizeof(unsigned int)); -+ if (error) -+ return error; -+ else -+ return get_lsr_info(info, (unsigned int *)arg); -+ -+ case TIOCSERGSTRUCT: -+ error = verify_area(VERIFY_WRITE, (void *)arg, -+ sizeof(struct dec_serial)); -+ if (error) -+ return error; -+ copy_from_user((struct dec_serial *)arg, info, -+ sizeof(struct dec_serial)); -+ return 0; -+ -+ default: -+ return -ENOIOCTLCMD; -+ } - return 0; - } - -@@ -1446,7 +1428,8 @@ - static void rs_wait_until_sent(struct tty_struct *tty, int timeout) - { - struct dec_serial *info = (struct dec_serial *) tty->driver_data; -- unsigned long orig_jiffies, char_time; -+ unsigned long orig_jiffies; -+ int char_time; - - if (serial_paranoia_check(info, tty->device, "rs_wait_until_sent")) - return; -@@ -1462,7 +1445,7 @@ - if (char_time == 0) - char_time = 1; - if (timeout) -- char_time = MIN(char_time, timeout); -+ char_time = min(char_time, timeout); - while ((read_zsreg(info->zs_channel, 1) & Tx_BUF_EMP) == 0) { - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(char_time); -@@ -1714,7 +1697,7 @@ - - static void __init show_serial_version(void) - { -- printk("DECstation Z8530 serial driver version 0.08\n"); -+ printk("DECstation Z8530 serial driver version 0.09\n"); - } - - /* Initialize Z8530s zs_channels -@@ -1994,8 +1977,9 @@ - * polling I/O routines - */ - static int --zs_poll_tx_char(struct dec_serial *info, unsigned char ch) -+zs_poll_tx_char(void *handle, unsigned char ch) - { -+ struct dec_serial *info = handle; - struct dec_zschannel *chan = info->zs_channel; - int ret; - -@@ -2017,8 +2001,9 @@ - } - - static int --zs_poll_rx_char(struct dec_serial *info) -+zs_poll_rx_char(void *handle) - { -+ struct dec_serial *info = handle; - struct dec_zschannel *chan = info->zs_channel; - int ret; - -@@ -2038,12 +2023,13 @@ - return -ENODEV; - } - --unsigned int register_zs_hook(unsigned int channel, struct zs_hook *hook) -+int register_zs_hook(unsigned int channel, struct dec_serial_hook *hook) - { - struct dec_serial *info = &zs_soft[channel]; - - if (info->hook) { -- printk(__FUNCTION__": line %d has already a hook registered\n", channel); -+ printk("%s: line %d has already a hook registered\n", -+ __FUNCTION__, channel); - - return 0; - } else { -@@ -2055,7 +2041,7 @@ - } - } - --unsigned int unregister_zs_hook(unsigned int channel) -+int unregister_zs_hook(unsigned int channel) - { - struct dec_serial *info = &zs_soft[channel]; - -@@ -2063,8 +2049,8 @@ - info->hook = NULL; - return 1; - } else { -- printk(__FUNCTION__": trying to unregister hook on line %d," -- " but none is registered\n", channel); -+ printk("%s: trying to unregister hook on line %d," -+ " but none is registered\n", __FUNCTION__, channel); - return 0; - } - } -@@ -2319,22 +2305,23 @@ - write_zsreg(chan, 9, nine); - } - --static int kgdbhook_init_channel(struct dec_serial* info) -+static int kgdbhook_init_channel(void *handle) - { - return 0; - } - --static void kgdbhook_init_info(struct dec_serial* info) -+static void kgdbhook_init_info(void *handle) - { - } - --static void kgdbhook_rx_char(struct dec_serial* info, -- unsigned char ch, unsigned char stat) -+static void kgdbhook_rx_char(void *handle, unsigned char ch, unsigned char fl) - { -+ struct dec_serial *info = handle; -+ -+ if (fl != TTY_NORMAL) -+ return; - if (ch == 0x03 || ch == '$') - breakpoint(); -- if (stat & (Rx_OVR|FRM_ERR|PAR_ERR)) -- write_zsreg(info->zs_channel, 0, ERR_RES); - } - - /* This sets up the serial port we're using, and turns on -@@ -2360,11 +2347,11 @@ - * for /dev/ttyb which is determined in setup_arch() from the - * boot command line flags. - */ --struct zs_hook zs_kgdbhook = { -- init_channel : kgdbhook_init_channel, -- init_info : kgdbhook_init_info, -- cflags : B38400|CS8|CLOCAL, -- rx_char : kgdbhook_rx_char, -+struct dec_serial_hook zs_kgdbhook = { -+ .init_channel = kgdbhook_init_channel, -+ .init_info = kgdbhook_init_info, -+ .rx_char = kgdbhook_rx_char, -+ .cflags = B38400 | CS8 | CLOCAL, - } - - void __init zs_kgdb_hook(int tty_num) -diff -Nur linux-2.4.30/drivers/tc/zs.h linux-2.4.30-mips/drivers/tc/zs.h ---- linux-2.4.30/drivers/tc/zs.h 2004-02-18 14:36:31.000000000 +0100 -+++ linux-2.4.30-mips/drivers/tc/zs.h 2004-07-01 15:28:54.000000000 +0200 -@@ -1,14 +1,18 @@ - /* -- * macserial.h: Definitions for the Macintosh Z8530 serial driver. -+ * drivers/tc/zs.h: Definitions for the DECstation Z85C30 serial driver. - * - * Adapted from drivers/sbus/char/sunserial.h by Paul Mackerras. -+ * Adapted from drivers/macintosh/macserial.h by Harald Koerfgen. - * - * Copyright (C) 1996 Paul Mackerras (Paul.Mackerras@cs.anu.edu.au) - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) -+ * Copyright (C) 2004 Maciej W. Rozycki - */ - #ifndef _DECSERIAL_H - #define _DECSERIAL_H - -+#include -+ - #define NUM_ZSREGS 16 - - struct serial_struct { -@@ -89,63 +93,50 @@ - unsigned char curregs[NUM_ZSREGS]; - }; - --struct dec_serial; -- --struct zs_hook { -- int (*init_channel)(struct dec_serial* info); -- void (*init_info)(struct dec_serial* info); -- void (*rx_char)(unsigned char ch, unsigned char stat); -- int (*poll_rx_char)(struct dec_serial* info); -- int (*poll_tx_char)(struct dec_serial* info, -- unsigned char ch); -- unsigned cflags; --}; -- - struct dec_serial { -- struct dec_serial *zs_next; /* For IRQ servicing chain */ -- struct dec_zschannel *zs_channel; /* Channel registers */ -- struct dec_zschannel *zs_chan_a; /* A side registers */ -- unsigned char read_reg_zero; -- -- char soft_carrier; /* Use soft carrier on this channel */ -- char break_abort; /* Is serial console in, so process brk/abrt */ -- struct zs_hook *hook; /* Hook on this channel */ -- char is_cons; /* Is this our console. */ -- unsigned char tx_active; /* character is being xmitted */ -- unsigned char tx_stopped; /* output is suspended */ -- -- /* We need to know the current clock divisor -- * to read the bps rate the chip has currently -- * loaded. -+ struct dec_serial *zs_next; /* For IRQ servicing chain. */ -+ struct dec_zschannel *zs_channel; /* Channel registers. */ -+ struct dec_zschannel *zs_chan_a; /* A side registers. */ -+ unsigned char read_reg_zero; -+ -+ struct dec_serial_hook *hook; /* Hook on this channel. */ -+ int tty_break; /* Set on BREAK condition. */ -+ int is_cons; /* Is this our console. */ -+ int tx_active; /* Char is being xmitted. */ -+ int tx_stopped; /* Output is suspended. */ -+ -+ /* -+ * We need to know the current clock divisor -+ * to read the bps rate the chip has currently loaded. - */ -- unsigned char clk_divisor; /* May be 1, 16, 32, or 64 */ -- int zs_baud; -+ int clk_divisor; /* May be 1, 16, 32, or 64. */ -+ int zs_baud; - -- char change_needed; -+ char change_needed; - - int magic; - int baud_base; - int port; - int irq; -- int flags; /* defined in tty.h */ -- int type; /* UART type */ -+ int flags; /* Defined in tty.h. */ -+ int type; /* UART type. */ - struct tty_struct *tty; - int read_status_mask; - int ignore_status_mask; - int timeout; - int xmit_fifo_size; - int custom_divisor; -- int x_char; /* xon/xoff character */ -+ int x_char; /* XON/XOFF character. */ - int close_delay; - unsigned short closing_wait; - unsigned short closing_wait2; - unsigned long event; - unsigned long last_active; - int line; -- int count; /* # of fd on device */ -- int blocked_open; /* # of blocked opens */ -- long session; /* Session of opening process */ -- long pgrp; /* pgrp of opening process */ -+ int count; /* # of fds on device. */ -+ int blocked_open; /* # of blocked opens. */ -+ long session; /* Sess of opening process. */ -+ long pgrp; /* Pgrp of opening process. */ - unsigned char *xmit_buf; - int xmit_head; - int xmit_tail; -diff -Nur linux-2.4.30/drivers/video/Config.in linux-2.4.30-mips/drivers/video/Config.in ---- linux-2.4.30/drivers/video/Config.in 2004-02-18 14:36:31.000000000 +0100 -+++ linux-2.4.30-mips/drivers/video/Config.in 2005-02-11 22:16:44.000000000 +0100 -@@ -87,8 +87,8 @@ - if [ "$CONFIG_HP300" = "y" ]; then - define_bool CONFIG_FB_HP300 y - fi -- if [ "$ARCH" = "alpha" ]; then -- tristate ' TGA framebuffer support' CONFIG_FB_TGA -+ if [ "$ARCH" = "alpha" -o "$CONFIG_TC" = "y" ]; then -+ tristate ' TGA/SFB+ framebuffer support' CONFIG_FB_TGA - fi - if [ "$CONFIG_X86" = "y" ]; then - bool ' VESA VGA graphics console' CONFIG_FB_VESA -@@ -121,6 +121,17 @@ - hex ' Framebuffer Base Address' CONFIG_E1355_FB_BASE a8200000 - fi - fi -+ if [ "$CONFIG_SOC_AU1100" = "y" ]; then -+ bool ' Au1100 LCD Driver' CONFIG_FB_AU1100 -+ fi -+ -+ if [ "$CONFIG_SOC_AU1200" = "y" ]; then -+ bool ' Au1200 LCD Driver' CONFIG_FB_AU1200 -+ if [ "$CONFIG_FB_AU1200" = "y" ]; then -+ int ' Number of planes (1 to 4)' CONFIG_FB_AU1200_DEVS 1 -+ fi -+ fi -+ - if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - if [ "$CONFIG_PCI" != "n" ]; then - tristate ' Matrox acceleration (EXPERIMENTAL)' CONFIG_FB_MATROX -@@ -178,9 +189,6 @@ - bool ' Use CRT on Pb1100 ' CONFIG_PB1500_CRT - bool ' Use TFT Panel on Pb1100 ' CONFIG_PB1500_TFT - fi -- if [ "$CONFIG_SOC_AU1100" = "y" ]; then -- bool ' Au1100 LCD Driver' CONFIG_FB_AU1100 -- fi - fi - fi - fi -diff -Nur linux-2.4.30/drivers/video/Makefile linux-2.4.30-mips/drivers/video/Makefile ---- linux-2.4.30/drivers/video/Makefile 2004-02-18 14:36:31.000000000 +0100 -+++ linux-2.4.30-mips/drivers/video/Makefile 2005-02-11 22:16:44.000000000 +0100 -@@ -87,6 +87,7 @@ - obj-$(CONFIG_FB_MAXINE) += maxinefb.o - obj-$(CONFIG_FB_TX3912) += tx3912fb.o - obj-$(CONFIG_FB_AU1100) += au1100fb.o fbgen.o -+obj-$(CONFIG_FB_AU1200) += au1200fb.o fbgen.o - obj-$(CONFIG_FB_IT8181) += it8181fb.o fbgen.o - - subdir-$(CONFIG_STI_CONSOLE) += sti -diff -Nur linux-2.4.30/drivers/video/au1200fb.c linux-2.4.30-mips/drivers/video/au1200fb.c ---- linux-2.4.30/drivers/video/au1200fb.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.4.30-mips/drivers/video/au1200fb.c 2005-03-13 09:04:16.000000000 +0100 -@@ -0,0 +1,1564 @@ -+/* -+ * BRIEF MODULE DESCRIPTION -+ * Au1200 LCD Driver. -+ * -+ * Copyright 2004 AMD -+ * Author: AMD -+ * -+ * Based on: -+ * linux/drivers/video/skeletonfb.c -- Skeleton for a frame buffer device -+ * Created 28 Dec 1997 by Geert Uytterhoeven -+ * -+ * 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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED -+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN -+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ * 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 -+#include -+ -+#include -+#include -+#include "au1200fb.h" -+ -+#include